Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions packages/gittensory-engine/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ The logic is extracted from the app's `src/` in follow-up issues; this skeleton
the meantime. The root `package.json` already globs `packages/*` in its `workspaces` field, so `npm ci`
discovers this package with no additional wiring.

## Version pin

`ENGINE_VERSION` mirrors `package.json`'s `version` field and is exported from the package barrel so consumers can
log or assert which engine build produced a deterministic result.

## Build

```
Expand Down
1 change: 1 addition & 0 deletions packages/gittensory-engine/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// backend and the gittensory-miner (scoring preview/model, predicted-gate types, reward-risk, slop signals,
// focus-manifest parse/compile core, duplicate-winner adjudication, and their engine-parity fixtures).
// More modules land in follow-up issues.
export { ENGINE_VERSION } from "./version.js";
export {
pickTopRankedOpportunities,
rankOpportunityScore,
Expand Down
5 changes: 5 additions & 0 deletions packages/gittensory-engine/src/version.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/**
* Published semver of `@jsonbored/gittensory-engine`. Keep in lockstep with `package.json` `version`
* (enforced by `test/unit/engine-version.test.ts`).
*/
export const ENGINE_VERSION = "0.1.0";
21 changes: 21 additions & 0 deletions test/unit/engine-version.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { readFileSync } from "node:fs";
import { dirname, join } from "node:path";
import { fileURLToPath } from "node:url";
import { describe, expect, it } from "vitest";

import { ENGINE_VERSION } from "../../packages/gittensory-engine/src/version";

const pkgPath = join(dirname(fileURLToPath(import.meta.url)), "../../packages/gittensory-engine/package.json");

describe("ENGINE_VERSION", () => {
it("matches packages/gittensory-engine/package.json version", () => {
const pkg = JSON.parse(readFileSync(pkgPath, "utf8")) as { version: string };
expect(ENGINE_VERSION).toBe(pkg.version);
});

it("is exported from the package barrel", async () => {
const barrel = await import("../../packages/gittensory-engine/src/index");
expect(barrel.ENGINE_VERSION).toBe(ENGINE_VERSION);
expect(barrel.ENGINE_VERSION.length).toBeGreaterThan(0);
});
});
Loading