@warpgogol/forge 9.2.3 → 9.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +33 -0
- package/bin/cli.ts +3 -2
- package/dist/bin/cli.js +3 -2
- package/dist/bin/cli.js.map +1 -1
- package/dist/os/adr/handlers/implement-stamp.d.ts +6 -0
- package/dist/os/adr/handlers/implement-stamp.d.ts.map +1 -1
- package/dist/os/adr/handlers/implement-stamp.js +23 -15
- package/dist/os/adr/handlers/implement-stamp.js.map +1 -1
- package/dist/os/checks/handlers/counters-journal.d.ts.map +1 -1
- package/dist/os/checks/handlers/counters-journal.js +9 -1
- package/dist/os/checks/handlers/counters-journal.js.map +1 -1
- package/dist/os/core/core.module.d.ts.map +1 -1
- package/dist/os/core/core.module.js +27 -36
- package/dist/os/core/core.module.js.map +1 -1
- package/dist/os/core/lock-holder.d.ts +32 -0
- package/dist/os/core/lock-holder.d.ts.map +1 -0
- package/dist/os/core/lock-holder.js +81 -0
- package/dist/os/core/lock-holder.js.map +1 -0
- package/dist/os/core/stamp-lock.d.ts +30 -0
- package/dist/os/core/stamp-lock.d.ts.map +1 -0
- package/dist/os/core/stamp-lock.js +112 -0
- package/dist/os/core/stamp-lock.js.map +1 -0
- package/dist/os/flow/digest.d.ts +19 -0
- package/dist/os/flow/digest.d.ts.map +1 -1
- package/dist/os/flow/digest.js +33 -4
- package/dist/os/flow/digest.js.map +1 -1
- package/dist/os/flow/flow.module.d.ts.map +1 -1
- package/dist/os/flow/flow.module.js +61 -6
- package/dist/os/flow/flow.module.js.map +1 -1
- package/dist/os/flow/handlers/flow-cut.d.ts +8 -0
- package/dist/os/flow/handlers/flow-cut.d.ts.map +1 -1
- package/dist/os/flow/handlers/flow-cut.js +91 -5
- package/dist/os/flow/handlers/flow-cut.js.map +1 -1
- package/dist/os/flow/handlers/flow-digest.d.ts.map +1 -1
- package/dist/os/flow/handlers/flow-digest.js +6 -0
- package/dist/os/flow/handlers/flow-digest.js.map +1 -1
- package/dist/os/flow/handlers/flow-discard.d.ts.map +1 -1
- package/dist/os/flow/handlers/flow-discard.js +17 -13
- package/dist/os/flow/handlers/flow-discard.js.map +1 -1
- package/dist/os/flow/handlers/flow-fix.d.ts.map +1 -1
- package/dist/os/flow/handlers/flow-fix.js +99 -10
- package/dist/os/flow/handlers/flow-fix.js.map +1 -1
- package/dist/os/flow/handlers/flow-integrate.d.ts.map +1 -1
- package/dist/os/flow/handlers/flow-integrate.js +32 -15
- package/dist/os/flow/handlers/flow-integrate.js.map +1 -1
- package/dist/os/flow/handlers/flow-publication-retire.d.ts +17 -0
- package/dist/os/flow/handlers/flow-publication-retire.d.ts.map +1 -0
- package/dist/os/flow/handlers/flow-publication-retire.js +132 -0
- package/dist/os/flow/handlers/flow-publication-retire.js.map +1 -0
- package/dist/os/flow/handlers/flow-push.d.ts +7 -0
- package/dist/os/flow/handlers/flow-push.d.ts.map +1 -1
- package/dist/os/flow/handlers/flow-push.js +106 -15
- package/dist/os/flow/handlers/flow-push.js.map +1 -1
- package/dist/os/flow/locks.d.ts +6 -1
- package/dist/os/flow/locks.d.ts.map +1 -1
- package/dist/os/flow/locks.js +53 -23
- package/dist/os/flow/locks.js.map +1 -1
- package/dist/os/flow/publication-order.d.ts +25 -0
- package/dist/os/flow/publication-order.d.ts.map +1 -0
- package/dist/os/flow/publication-order.js +75 -0
- package/dist/os/flow/publication-order.js.map +1 -0
- package/dist/os/flow/publish.d.ts +18 -0
- package/dist/os/flow/publish.d.ts.map +1 -1
- package/dist/os/flow/publish.js +58 -2
- package/dist/os/flow/publish.js.map +1 -1
- package/dist/os/flow/registry.d.ts +1 -1
- package/dist/os/flow/registry.d.ts.map +1 -1
- package/dist/os/flow/registry.js +2 -1
- package/dist/os/flow/registry.js.map +1 -1
- package/dist/os/flow/release-tags.d.ts +1 -0
- package/dist/os/flow/release-tags.d.ts.map +1 -1
- package/dist/os/flow/release-tags.js +5 -4
- package/dist/os/flow/release-tags.js.map +1 -1
- package/dist/os/flow/scripts.d.ts +1 -1
- package/dist/os/flow/scripts.d.ts.map +1 -1
- package/dist/os/flow/scripts.js +6 -1
- package/dist/os/flow/scripts.js.map +1 -1
- package/dist/os/flow/task-files.d.ts +11 -0
- package/dist/os/flow/task-files.d.ts.map +1 -0
- package/dist/os/flow/task-files.js +51 -0
- package/dist/os/flow/task-files.js.map +1 -0
- package/dist/os/flow/tests/helpers.d.ts +4 -1
- package/dist/os/flow/tests/helpers.d.ts.map +1 -1
- package/dist/os/flow/tests/helpers.js +9 -5
- package/dist/os/flow/tests/helpers.js.map +1 -1
- package/dist/os/mission/handlers/archive.d.ts.map +1 -1
- package/dist/os/mission/handlers/archive.js +30 -74
- package/dist/os/mission/handlers/archive.js.map +1 -1
- package/dist/os/mission/lockfile.d.ts +21 -0
- package/dist/os/mission/lockfile.d.ts.map +1 -0
- package/dist/os/mission/lockfile.js +76 -0
- package/dist/os/mission/lockfile.js.map +1 -0
- package/dist/os/mission/mission.module.d.ts.map +1 -1
- package/dist/os/mission/mission.module.js +2 -1
- package/dist/os/mission/mission.module.js.map +1 -1
- package/dist/os/rfc/handlers/implement-stamp.d.ts +6 -0
- package/dist/os/rfc/handlers/implement-stamp.d.ts.map +1 -1
- package/dist/os/rfc/handlers/implement-stamp.js +24 -19
- package/dist/os/rfc/handlers/implement-stamp.js.map +1 -1
- package/dist/os/system/handlers/outbox-validate.d.ts +8 -0
- package/dist/os/system/handlers/outbox-validate.d.ts.map +1 -0
- package/dist/os/system/handlers/outbox-validate.js +102 -0
- package/dist/os/system/handlers/outbox-validate.js.map +1 -0
- package/dist/os/system/handlers/system-map-validate.d.ts +13 -0
- package/dist/os/system/handlers/system-map-validate.d.ts.map +1 -0
- package/dist/os/system/handlers/system-map-validate.js +78 -0
- package/dist/os/system/handlers/system-map-validate.js.map +1 -0
- package/dist/os/system/handlers/system-outbox-scan.d.ts +10 -0
- package/dist/os/system/handlers/system-outbox-scan.d.ts.map +1 -0
- package/dist/os/system/handlers/system-outbox-scan.js +195 -0
- package/dist/os/system/handlers/system-outbox-scan.js.map +1 -0
- package/dist/os/system/handlers/system-task-collect.d.ts +13 -0
- package/dist/os/system/handlers/system-task-collect.d.ts.map +1 -0
- package/dist/os/system/handlers/system-task-collect.js +238 -0
- package/dist/os/system/handlers/system-task-collect.js.map +1 -0
- package/dist/os/system/handlers/system-task-create.d.ts +32 -0
- package/dist/os/system/handlers/system-task-create.d.ts.map +1 -0
- package/dist/os/system/handlers/system-task-create.js +216 -0
- package/dist/os/system/handlers/system-task-create.js.map +1 -0
- package/dist/os/system/handlers/system-task-dispatch.d.ts +14 -0
- package/dist/os/system/handlers/system-task-dispatch.d.ts.map +1 -0
- package/dist/os/system/handlers/system-task-dispatch.js +290 -0
- package/dist/os/system/handlers/system-task-dispatch.js.map +1 -0
- package/dist/os/system/handlers/system-task-move.d.ts +12 -0
- package/dist/os/system/handlers/system-task-move.d.ts.map +1 -0
- package/dist/os/system/handlers/system-task-move.js +217 -0
- package/dist/os/system/handlers/system-task-move.js.map +1 -0
- package/dist/os/system/handlers/system-task-status.d.ts +20 -0
- package/dist/os/system/handlers/system-task-status.d.ts.map +1 -0
- package/dist/os/system/handlers/system-task-status.js +139 -0
- package/dist/os/system/handlers/system-task-status.js.map +1 -0
- package/dist/os/system/handlers/system-versionset-record.d.ts +12 -0
- package/dist/os/system/handlers/system-versionset-record.d.ts.map +1 -0
- package/dist/os/system/handlers/system-versionset-record.js +332 -0
- package/dist/os/system/handlers/system-versionset-record.js.map +1 -0
- package/dist/os/system/index.d.ts +6 -0
- package/dist/os/system/index.d.ts.map +1 -0
- package/dist/os/system/index.js +18 -0
- package/dist/os/system/index.js.map +1 -0
- package/dist/os/system/outbox-schema.d.ts +30 -0
- package/dist/os/system/outbox-schema.d.ts.map +1 -0
- package/dist/os/system/outbox-schema.js +29 -0
- package/dist/os/system/outbox-schema.js.map +1 -0
- package/dist/os/system/repo.d.ts +64 -0
- package/dist/os/system/repo.d.ts.map +1 -0
- package/dist/os/system/repo.js +364 -0
- package/dist/os/system/repo.js.map +1 -0
- package/dist/os/system/scenario-schemas.d.ts +26 -0
- package/dist/os/system/scenario-schemas.d.ts.map +1 -0
- package/dist/os/system/scenario-schemas.js +53 -0
- package/dist/os/system/scenario-schemas.js.map +1 -0
- package/dist/os/system/schemas.d.ts +63 -0
- package/dist/os/system/schemas.d.ts.map +1 -0
- package/dist/os/system/schemas.js +83 -0
- package/dist/os/system/schemas.js.map +1 -0
- package/dist/os/system/system.module.d.ts +3 -0
- package/dist/os/system/system.module.d.ts.map +1 -0
- package/dist/os/system/system.module.js +429 -0
- package/dist/os/system/system.module.js.map +1 -0
- package/dist/os/system/task-schemas.d.ts +108 -0
- package/dist/os/system/task-schemas.d.ts.map +1 -0
- package/dist/os/system/task-schemas.js +152 -0
- package/dist/os/system/task-schemas.js.map +1 -0
- package/dist/os/system/task-store.d.ts +41 -0
- package/dist/os/system/task-store.d.ts.map +1 -0
- package/dist/os/system/task-store.js +142 -0
- package/dist/os/system/task-store.js.map +1 -0
- package/dist/os/system/tests/helpers.d.ts +30 -0
- package/dist/os/system/tests/helpers.d.ts.map +1 -0
- package/dist/os/system/tests/helpers.js +178 -0
- package/dist/os/system/tests/helpers.js.map +1 -0
- package/dist/src/index.d.ts +3 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +5 -4
- package/dist/src/index.js.map +1 -1
- package/os/adr/handlers/implement-stamp-lock.test.ts +90 -0
- package/os/adr/handlers/implement-stamp.ts +29 -20
- package/os/checks/handlers/counters-journal.test.ts +10 -0
- package/os/checks/handlers/counters-journal.ts +8 -1
- package/os/core/core.module.ts +32 -36
- package/os/core/lock-holder.ts +88 -0
- package/os/core/stamp-lock.ts +142 -0
- package/os/flow/digest.ts +46 -4
- package/os/flow/flow.module.ts +62 -6
- package/os/flow/handlers/flow-cut.ts +118 -5
- package/os/flow/handlers/flow-digest.ts +6 -0
- package/os/flow/handlers/flow-discard.ts +22 -13
- package/os/flow/handlers/flow-fix.ts +116 -10
- package/os/flow/handlers/flow-integrate.ts +31 -15
- package/os/flow/handlers/flow-publication-retire.ts +156 -0
- package/os/flow/handlers/flow-push.ts +128 -13
- package/os/flow/locks.ts +75 -25
- package/os/flow/publication-order.ts +99 -0
- package/os/flow/publish.ts +73 -2
- package/os/flow/registry.ts +5 -2
- package/os/flow/release-tags.ts +5 -4
- package/os/flow/scripts.ts +12 -5
- package/os/flow/task-files.ts +59 -0
- package/os/flow/tests/flow-cut-prepare.test.ts +298 -0
- package/os/flow/tests/flow-cut.test.ts +5 -1
- package/os/flow/tests/flow-publication-retire.test.ts +191 -0
- package/os/flow/tests/flow-push-supersede.test.ts +221 -0
- package/os/flow/tests/flow-task-files.test.ts +59 -0
- package/os/flow/tests/helpers.ts +9 -5
- package/os/flow/tests/locks.test.ts +219 -0
- package/os/flow/tests/publication-order.test.ts +102 -0
- package/os/flow/tests/scripts.test.ts +13 -0
- package/os/mission/handlers/archive.test.ts +97 -52
- package/os/mission/handlers/archive.ts +31 -76
- package/os/mission/lockfile.ts +84 -0
- package/os/mission/mission.module.ts +2 -1
- package/os/rfc/handlers/implement-stamp-lock.test.ts +133 -0
- package/os/rfc/handlers/implement-stamp.ts +30 -24
- package/os/system/handlers/outbox-validate.ts +120 -0
- package/os/system/handlers/system-map-validate.ts +107 -0
- package/os/system/handlers/system-outbox-scan.ts +320 -0
- package/os/system/handlers/system-task-collect.ts +305 -0
- package/os/system/handlers/system-task-create.ts +271 -0
- package/os/system/handlers/system-task-dispatch.ts +387 -0
- package/os/system/handlers/system-task-move.ts +353 -0
- package/os/system/handlers/system-task-status.ts +176 -0
- package/os/system/handlers/system-versionset-record.ts +476 -0
- package/os/system/index.ts +47 -0
- package/os/system/outbox-schema.ts +47 -0
- package/os/system/repo.ts +451 -0
- package/os/system/scenario-schemas.ts +62 -0
- package/os/system/schemas.ts +102 -0
- package/os/system/system.module.ts +449 -0
- package/os/system/task-schemas.ts +190 -0
- package/os/system/task-store.ts +184 -0
- package/os/system/tests/helpers.ts +189 -0
- package/os/system/tests/outbox-validate.test.ts +92 -0
- package/os/system/tests/system-map-validate.test.ts +321 -0
- package/os/system/tests/system-outbox-scan.test.ts +273 -0
- package/os/system/tests/system-profile.test.ts +90 -0
- package/os/system/tests/system-task-collect.test.ts +293 -0
- package/os/system/tests/system-task-dispatch.test.ts +279 -0
- package/os/system/tests/system-task-status.test.ts +153 -0
- package/os/system/tests/system-task.test.ts +330 -0
- package/os/system/tests/system-versionset.test.ts +314 -0
- package/package.json +33 -1
- package/profiles/forge-shell.yaml +1 -2
- package/profiles/knowledge.yaml +1 -1
- package/profiles/system.yaml +650 -0
- package/profiles/typescript.yaml +0 -1
- package/skills/fo/fo-outbox/SKILL.md +71 -0
- package/skills/fo/fo-system-dispatch/SKILL.md +65 -0
- package/skills/fo/fo-task-run/SKILL.md +75 -0
- package/src/index.ts +11 -4
- package/src/tests/fixtures/agents-generate-business-before.txt +6 -0
- package/src/tests/profile-flow-hooks.test.ts +15 -0
- package/src/tests/profile-schema.test.ts +2 -1
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>system.versionset.record tests (RFC-1511) — governed product
|
|
4
|
+
repositories under os.tmpdir() with annotated forge/release-tag@1 tags; checks
|
|
5
|
+
run argv vectors (process.execPath -e or git) inside detached tag worktrees.
|
|
6
|
+
Covers AC-1..AC-8 plus SYSTEM-VS-01/02/03 diagnostics.</purpose>
|
|
7
|
+
<non-goals>
|
|
8
|
+
<item>No real flow/mission commands — direct handler invocation only.</item>
|
|
9
|
+
</non-goals>
|
|
10
|
+
</MODULE_CONTRACT>
|
|
11
|
+
<CHANGE_SUMMARY>
|
|
12
|
+
<item>RFC-1511: step 1 — versionset test harness</item>
|
|
13
|
+
<item>RFC-1511: scenarios, version sets and system.versionset.record</item>
|
|
14
|
+
</CHANGE_SUMMARY>
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
// @vitest-environment node
|
|
18
|
+
|
|
19
|
+
import { readFile } from "node:fs/promises";
|
|
20
|
+
import path from "node:path";
|
|
21
|
+
|
|
22
|
+
import { describe, expect, it } from "vitest";
|
|
23
|
+
import YAML from "yaml";
|
|
24
|
+
|
|
25
|
+
import type { ForgeCommandInput, ForgeFlagValue } from "../../../src/types.ts";
|
|
26
|
+
import { gitExec } from "../../flow/tests/helpers.ts";
|
|
27
|
+
import { runSystemVersionSetRecord } from "../handlers/system-versionset-record.ts";
|
|
28
|
+
import { versionSetSchema } from "../scenario-schemas.ts";
|
|
29
|
+
import {
|
|
30
|
+
localMapFor,
|
|
31
|
+
makeContext,
|
|
32
|
+
makeProduct,
|
|
33
|
+
makeSystemRepo,
|
|
34
|
+
VALID_EDGES_YAML,
|
|
35
|
+
VALID_PRODUCTS_YAML,
|
|
36
|
+
VALID_SYSTEM_YAML,
|
|
37
|
+
} from "./helpers.ts";
|
|
38
|
+
|
|
39
|
+
const TAG = "v1.0.0";
|
|
40
|
+
|
|
41
|
+
function input(flags: Record<string, ForgeFlagValue> = {}): ForgeCommandInput {
|
|
42
|
+
return { argv: [], flags };
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** The release-tag annotation a real flow.cut writes (forge/release-tag@1). */
|
|
46
|
+
const RELEASE_ANNOTATION = [
|
|
47
|
+
"release v1.0.0",
|
|
48
|
+
"",
|
|
49
|
+
"schema: forge/release-tag@1",
|
|
50
|
+
"line: v",
|
|
51
|
+
"version: 1.0.0",
|
|
52
|
+
"level: minor",
|
|
53
|
+
"previous: null",
|
|
54
|
+
'rfcs: ["RFC-0001"]',
|
|
55
|
+
"fingerprints: {}",
|
|
56
|
+
].join("\n");
|
|
57
|
+
|
|
58
|
+
async function tagProduct(root: string, tag = TAG, annotation = RELEASE_ANNOTATION): Promise<void> {
|
|
59
|
+
const res = await gitExec(root, ["tag", "-a", tag, "HEAD", "-m", annotation]);
|
|
60
|
+
if (res.exitCode !== 0) throw new Error(`tag failed: ${res.stderr}`);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function scenarioYaml(id: string, checks: { product: string; argv: string[]; timeoutSec?: number }[]): string {
|
|
64
|
+
const checksYaml = checks
|
|
65
|
+
.map(
|
|
66
|
+
(c) =>
|
|
67
|
+
` - product: ${c.product}\n argv: ${JSON.stringify(c.argv)}` +
|
|
68
|
+
(c.timeoutSec !== undefined ? `\n timeoutSec: ${c.timeoutSec}` : ""),
|
|
69
|
+
)
|
|
70
|
+
.join("\n");
|
|
71
|
+
return `schema: forge/system-scenario@1
|
|
72
|
+
id: ${id}
|
|
73
|
+
title: ${id} fixture
|
|
74
|
+
products: [${[...new Set(checks.map((c) => c.product))].join(", ")}]
|
|
75
|
+
contracts: []
|
|
76
|
+
checks:
|
|
77
|
+
${checksYaml}
|
|
78
|
+
`;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
interface Fixture {
|
|
82
|
+
systemRoot: string;
|
|
83
|
+
alpha: string;
|
|
84
|
+
beta: string;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/** System repo + two governed products, each carrying an annotated release tag. */
|
|
88
|
+
async function fixture(files: Record<string, string> = {}): Promise<Fixture> {
|
|
89
|
+
const alpha = await makeProduct();
|
|
90
|
+
const beta = await makeProduct();
|
|
91
|
+
await tagProduct(alpha);
|
|
92
|
+
await tagProduct(beta);
|
|
93
|
+
const systemRoot = await makeSystemRepo({
|
|
94
|
+
"system/system.yaml": VALID_SYSTEM_YAML,
|
|
95
|
+
"system/products.yaml": VALID_PRODUCTS_YAML,
|
|
96
|
+
"system/edges.yaml": VALID_EDGES_YAML,
|
|
97
|
+
"system/products.local.yaml": localMapFor({ alpha, beta }),
|
|
98
|
+
...files,
|
|
99
|
+
});
|
|
100
|
+
return { systemRoot, alpha, beta };
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
async function worktreePaths(repo: string): Promise<string[]> {
|
|
104
|
+
const res = await gitExec(repo, ["worktree", "list", "--porcelain"]);
|
|
105
|
+
return res.stdout
|
|
106
|
+
.split("\n")
|
|
107
|
+
.filter((l) => l.startsWith("worktree "))
|
|
108
|
+
.map((l) => l.slice("worktree ".length));
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
describe("system.versionset.record", () => {
|
|
112
|
+
it("AC-1+AC-2: all-green checks write VS-0001 with sha256 evidence per scenario", async () => {
|
|
113
|
+
const { systemRoot } = await fixture({
|
|
114
|
+
"system/scenarios/lead-flow.yaml": scenarioYaml("lead-flow", [
|
|
115
|
+
{ product: "alpha", argv: [process.execPath, "-e", "console.log('ok')"] },
|
|
116
|
+
{ product: "beta", argv: [process.execPath, "-e", "console.log('ok-beta')"] },
|
|
117
|
+
]),
|
|
118
|
+
});
|
|
119
|
+
const result = await runSystemVersionSetRecord(
|
|
120
|
+
input({ products: `alpha=${TAG},beta=${TAG}`, scenarios: "lead-flow" }),
|
|
121
|
+
makeContext(systemRoot),
|
|
122
|
+
);
|
|
123
|
+
expect(result.exitCode).toBe(0);
|
|
124
|
+
expect(result.data!.created).toBe(true);
|
|
125
|
+
const setFile = YAML.parse(
|
|
126
|
+
await readFile(path.join(systemRoot, "system/version-sets/VS-0001.yaml"), "utf8"),
|
|
127
|
+
);
|
|
128
|
+
const parsed = versionSetSchema.safeParse(setFile);
|
|
129
|
+
expect(parsed.success).toBe(true);
|
|
130
|
+
expect(setFile.id).toBe("VS-0001");
|
|
131
|
+
expect(setFile.products).toEqual({ alpha: TAG, beta: TAG });
|
|
132
|
+
expect(setFile.evidence["lead-flow"]).toMatch(/^sha256:[0-9a-f]{64}$/);
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
it("AC-3+AC-4: a failing check exits non-zero with SYSTEM-VS-04 and writes no set", async () => {
|
|
136
|
+
const { systemRoot } = await fixture({
|
|
137
|
+
"system/scenarios/lead-flow.yaml": scenarioYaml("lead-flow", [
|
|
138
|
+
{ product: "alpha", argv: [process.execPath, "-e", "process.exit(3)"] },
|
|
139
|
+
]),
|
|
140
|
+
});
|
|
141
|
+
const result = await runSystemVersionSetRecord(
|
|
142
|
+
input({ products: `alpha=${TAG},beta=${TAG}`, scenarios: "lead-flow" }),
|
|
143
|
+
makeContext(systemRoot),
|
|
144
|
+
);
|
|
145
|
+
expect(result.exitCode).toBe(1);
|
|
146
|
+
expect(result.data!.diagnostics.some((d) => d.ruleId === "SYSTEM-VS-04")).toBe(true);
|
|
147
|
+
expect(result.data!.created).toBe(false);
|
|
148
|
+
await expect(
|
|
149
|
+
readFile(path.join(systemRoot, "system/version-sets/VS-0001.yaml"), "utf8"),
|
|
150
|
+
).rejects.toThrow();
|
|
151
|
+
// the log stays for reading
|
|
152
|
+
const log = await readFile(
|
|
153
|
+
path.join(systemRoot, "system/version-sets/evidence/VS-0001/lead-flow.log"),
|
|
154
|
+
"utf8",
|
|
155
|
+
);
|
|
156
|
+
expect(log).toContain("process.exit(3)");
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
it("AC-5: a check's cwd is the detached checkout of the named tag", async () => {
|
|
160
|
+
const { systemRoot, alpha } = await fixture({
|
|
161
|
+
"system/scenarios/lead-flow.yaml": scenarioYaml("lead-flow", [
|
|
162
|
+
{ product: "alpha", argv: ["git", "rev-parse", "HEAD"] },
|
|
163
|
+
]),
|
|
164
|
+
});
|
|
165
|
+
const result = await runSystemVersionSetRecord(
|
|
166
|
+
input({ products: `alpha=${TAG},beta=${TAG}`, scenarios: "lead-flow" }),
|
|
167
|
+
makeContext(systemRoot),
|
|
168
|
+
);
|
|
169
|
+
expect(result.exitCode).toBe(0);
|
|
170
|
+
const tagged = await gitExec(alpha, ["rev-parse", `${TAG}^{commit}`]);
|
|
171
|
+
const log = await readFile(
|
|
172
|
+
path.join(systemRoot, "system/version-sets/evidence/VS-0001/lead-flow.log"),
|
|
173
|
+
"utf8",
|
|
174
|
+
);
|
|
175
|
+
expect(log).toContain(tagged.stdout.trim());
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
it("AC-6: no temporary worktree survives the run", async () => {
|
|
179
|
+
const { systemRoot, alpha, beta } = await fixture({
|
|
180
|
+
"system/scenarios/lead-flow.yaml": scenarioYaml("lead-flow", [
|
|
181
|
+
{ product: "alpha", argv: [process.execPath, "-e", "console.log('x')"] },
|
|
182
|
+
{ product: "beta", argv: [process.execPath, "-e", "console.log('y')"] },
|
|
183
|
+
]),
|
|
184
|
+
});
|
|
185
|
+
await runSystemVersionSetRecord(
|
|
186
|
+
input({ products: `alpha=${TAG},beta=${TAG}`, scenarios: "lead-flow" }),
|
|
187
|
+
makeContext(systemRoot),
|
|
188
|
+
);
|
|
189
|
+
for (const repo of [alpha, beta]) {
|
|
190
|
+
const paths = await worktreePaths(repo);
|
|
191
|
+
expect(paths).toEqual([repo]);
|
|
192
|
+
}
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
it("AC-7: a non-release tag exits non-zero with SYSTEM-VS-03", async () => {
|
|
196
|
+
const { systemRoot, alpha } = await fixture({
|
|
197
|
+
"system/scenarios/lead-flow.yaml": scenarioYaml("lead-flow", [
|
|
198
|
+
{ product: "alpha", argv: [process.execPath, "-e", "console.log('x')"] },
|
|
199
|
+
]),
|
|
200
|
+
});
|
|
201
|
+
await tagProduct(alpha, "v9.9.9", "not a release annotation");
|
|
202
|
+
const result = await runSystemVersionSetRecord(
|
|
203
|
+
input({ products: "alpha=v9.9.9", scenarios: "lead-flow" }),
|
|
204
|
+
makeContext(systemRoot),
|
|
205
|
+
);
|
|
206
|
+
expect(result.exitCode).toBe(1);
|
|
207
|
+
expect(result.data!.diagnostics.some((d) => d.ruleId === "SYSTEM-VS-03")).toBe(true);
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
it("AC-7b: a missing tag exits non-zero with SYSTEM-VS-03", async () => {
|
|
211
|
+
const { systemRoot } = await fixture({
|
|
212
|
+
"system/scenarios/lead-flow.yaml": scenarioYaml("lead-flow", [
|
|
213
|
+
{ product: "alpha", argv: [process.execPath, "-e", "console.log('x')"] },
|
|
214
|
+
]),
|
|
215
|
+
});
|
|
216
|
+
const result = await runSystemVersionSetRecord(
|
|
217
|
+
input({ products: "alpha=v8.8.8", scenarios: "lead-flow" }),
|
|
218
|
+
makeContext(systemRoot),
|
|
219
|
+
);
|
|
220
|
+
expect(result.exitCode).toBe(1);
|
|
221
|
+
expect(result.data!.diagnostics.some((d) => d.ruleId === "SYSTEM-VS-03")).toBe(true);
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
it("AC-8: --dry-run creates no worktree and writes nothing", async () => {
|
|
225
|
+
const { systemRoot, alpha } = await fixture({
|
|
226
|
+
"system/scenarios/lead-flow.yaml": scenarioYaml("lead-flow", [
|
|
227
|
+
{ product: "alpha", argv: [process.execPath, "-e", "console.log('x')"] },
|
|
228
|
+
]),
|
|
229
|
+
});
|
|
230
|
+
const result = await runSystemVersionSetRecord(
|
|
231
|
+
input({ products: `alpha=${TAG}`, scenarios: "lead-flow", "dry-run": true }),
|
|
232
|
+
makeContext(systemRoot),
|
|
233
|
+
);
|
|
234
|
+
expect(result.exitCode).toBe(0);
|
|
235
|
+
expect(await worktreePaths(alpha)).toEqual([alpha]);
|
|
236
|
+
await expect(
|
|
237
|
+
readFile(path.join(systemRoot, "system/version-sets/VS-0001.yaml"), "utf8"),
|
|
238
|
+
).rejects.toThrow();
|
|
239
|
+
});
|
|
240
|
+
|
|
241
|
+
it("SYSTEM-VS-01: an unknown scenario id is an error", async () => {
|
|
242
|
+
const { systemRoot } = await fixture();
|
|
243
|
+
const result = await runSystemVersionSetRecord(
|
|
244
|
+
input({ products: `alpha=${TAG}`, scenarios: "ghost" }),
|
|
245
|
+
makeContext(systemRoot),
|
|
246
|
+
);
|
|
247
|
+
expect(result.exitCode).toBe(1);
|
|
248
|
+
expect(result.data!.diagnostics.some((d) => d.ruleId === "SYSTEM-VS-01")).toBe(true);
|
|
249
|
+
});
|
|
250
|
+
|
|
251
|
+
it("SYSTEM-VS-01: a malformed --products entry is an error", async () => {
|
|
252
|
+
const { systemRoot } = await fixture();
|
|
253
|
+
const result = await runSystemVersionSetRecord(
|
|
254
|
+
input({ products: "alpha-no-equals", scenarios: "x" }),
|
|
255
|
+
makeContext(systemRoot),
|
|
256
|
+
);
|
|
257
|
+
expect(result.exitCode).toBe(1);
|
|
258
|
+
expect(result.data!.diagnostics.some((d) => d.ruleId === "SYSTEM-VS-01")).toBe(true);
|
|
259
|
+
});
|
|
260
|
+
|
|
261
|
+
it("SYSTEM-VS-02: a scenario product missing from --products is an error", async () => {
|
|
262
|
+
const { systemRoot } = await fixture({
|
|
263
|
+
"system/scenarios/lead-flow.yaml": scenarioYaml("lead-flow", [
|
|
264
|
+
{ product: "alpha", argv: [process.execPath, "-e", "console.log('x')"] },
|
|
265
|
+
]),
|
|
266
|
+
});
|
|
267
|
+
const result = await runSystemVersionSetRecord(
|
|
268
|
+
input({ products: `beta=${TAG}`, scenarios: "lead-flow" }),
|
|
269
|
+
makeContext(systemRoot),
|
|
270
|
+
);
|
|
271
|
+
expect(result.exitCode).toBe(1);
|
|
272
|
+
expect(result.data!.diagnostics.some((d) => d.ruleId === "SYSTEM-VS-02")).toBe(true);
|
|
273
|
+
});
|
|
274
|
+
|
|
275
|
+
it("SYSTEM-VS-04: a check exceeding timeoutSec is a failure", async () => {
|
|
276
|
+
const { systemRoot } = await fixture({
|
|
277
|
+
"system/scenarios/slow.yaml": scenarioYaml("slow", [
|
|
278
|
+
{ product: "alpha", argv: [process.execPath, "-e", "setTimeout(() => {}, 5000)"], timeoutSec: 1 },
|
|
279
|
+
]),
|
|
280
|
+
});
|
|
281
|
+
const result = await runSystemVersionSetRecord(
|
|
282
|
+
input({ products: `alpha=${TAG}`, scenarios: "slow" }),
|
|
283
|
+
makeContext(systemRoot),
|
|
284
|
+
);
|
|
285
|
+
expect(result.exitCode).toBe(1);
|
|
286
|
+
expect(
|
|
287
|
+
result.data!.diagnostics.some(
|
|
288
|
+
(d) => d.ruleId === "SYSTEM-VS-04" && d.message.includes("timed out"),
|
|
289
|
+
),
|
|
290
|
+
).toBe(true);
|
|
291
|
+
expect(result.data!.created).toBe(false);
|
|
292
|
+
}, 20000);
|
|
293
|
+
|
|
294
|
+
it("ids continue from the highest existing VS-NNNN", async () => {
|
|
295
|
+
const { systemRoot } = await fixture({
|
|
296
|
+
"system/version-sets/VS-0007.yaml": `schema: forge/version-set@1
|
|
297
|
+
id: VS-0007
|
|
298
|
+
products: {alpha: v0.9.0}
|
|
299
|
+
scenarios: [old]
|
|
300
|
+
evidence: {}
|
|
301
|
+
verifiedAt: "2026-01-01T00:00:00Z"
|
|
302
|
+
`,
|
|
303
|
+
"system/scenarios/lead-flow.yaml": scenarioYaml("lead-flow", [
|
|
304
|
+
{ product: "alpha", argv: [process.execPath, "-e", "console.log('x')"] },
|
|
305
|
+
]),
|
|
306
|
+
});
|
|
307
|
+
const result = await runSystemVersionSetRecord(
|
|
308
|
+
input({ products: `alpha=${TAG}`, scenarios: "lead-flow" }),
|
|
309
|
+
makeContext(systemRoot),
|
|
310
|
+
);
|
|
311
|
+
expect(result.exitCode).toBe(0);
|
|
312
|
+
expect(result.data!.id).toBe("VS-0008");
|
|
313
|
+
});
|
|
314
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@warpgogol/forge",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.3.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -60,6 +60,10 @@
|
|
|
60
60
|
"types": "./os/core/core.module.ts",
|
|
61
61
|
"default": "./os/core/core.module.ts"
|
|
62
62
|
},
|
|
63
|
+
"./os/core/lock-holder": {
|
|
64
|
+
"types": "./os/core/lock-holder.ts",
|
|
65
|
+
"default": "./os/core/lock-holder.ts"
|
|
66
|
+
},
|
|
63
67
|
"./os/compass": {
|
|
64
68
|
"types": "./os/compass/index.ts",
|
|
65
69
|
"default": "./os/compass/index.ts"
|
|
@@ -132,6 +136,10 @@
|
|
|
132
136
|
"types": "./os/mission/index.ts",
|
|
133
137
|
"default": "./os/mission/index.ts"
|
|
134
138
|
},
|
|
139
|
+
"./os/mission/lockfile": {
|
|
140
|
+
"types": "./os/mission/lockfile.ts",
|
|
141
|
+
"default": "./os/mission/lockfile.ts"
|
|
142
|
+
},
|
|
135
143
|
"./os/mission-module": {
|
|
136
144
|
"types": "./os/mission/mission.module.ts",
|
|
137
145
|
"default": "./os/mission/mission.module.ts"
|
|
@@ -283,6 +291,14 @@
|
|
|
283
291
|
"./os/trajectory": {
|
|
284
292
|
"types": "./os/trajectory/index.ts",
|
|
285
293
|
"default": "./os/trajectory/index.ts"
|
|
294
|
+
},
|
|
295
|
+
"./os/system": {
|
|
296
|
+
"types": "./os/system/index.ts",
|
|
297
|
+
"default": "./os/system/index.ts"
|
|
298
|
+
},
|
|
299
|
+
"./os/system-module": {
|
|
300
|
+
"types": "./os/system/system.module.ts",
|
|
301
|
+
"default": "./os/system/system.module.ts"
|
|
286
302
|
}
|
|
287
303
|
},
|
|
288
304
|
"files": [
|
|
@@ -366,6 +382,10 @@
|
|
|
366
382
|
"types": "./dist/os/core/core.module.d.ts",
|
|
367
383
|
"default": "./dist/os/core/core.module.js"
|
|
368
384
|
},
|
|
385
|
+
"./os/core/lock-holder": {
|
|
386
|
+
"types": "./dist/os/core/lock-holder.d.ts",
|
|
387
|
+
"default": "./dist/os/core/lock-holder.js"
|
|
388
|
+
},
|
|
369
389
|
"./os/compass": {
|
|
370
390
|
"types": "./dist/os/compass/index.d.ts",
|
|
371
391
|
"default": "./dist/os/compass/index.js"
|
|
@@ -438,6 +458,10 @@
|
|
|
438
458
|
"types": "./dist/os/mission/index.d.ts",
|
|
439
459
|
"default": "./dist/os/mission/index.js"
|
|
440
460
|
},
|
|
461
|
+
"./os/mission/lockfile": {
|
|
462
|
+
"types": "./dist/os/mission/lockfile.d.ts",
|
|
463
|
+
"default": "./dist/os/mission/lockfile.js"
|
|
464
|
+
},
|
|
441
465
|
"./os/mission-module": {
|
|
442
466
|
"types": "./dist/os/mission/mission.module.d.ts",
|
|
443
467
|
"default": "./dist/os/mission/mission.module.js"
|
|
@@ -577,6 +601,14 @@
|
|
|
577
601
|
"./os/trajectory": {
|
|
578
602
|
"types": "./dist/os/trajectory/index.d.ts",
|
|
579
603
|
"default": "./dist/os/trajectory/index.js"
|
|
604
|
+
},
|
|
605
|
+
"./os/system": {
|
|
606
|
+
"types": "./dist/os/system/index.d.ts",
|
|
607
|
+
"default": "./dist/os/system/index.js"
|
|
608
|
+
},
|
|
609
|
+
"./os/system-module": {
|
|
610
|
+
"types": "./dist/os/system/system.module.d.ts",
|
|
611
|
+
"default": "./dist/os/system/system.module.js"
|
|
580
612
|
}
|
|
581
613
|
}
|
|
582
614
|
},
|
|
@@ -593,7 +593,6 @@ workspace:
|
|
|
593
593
|
|
|
594
594
|
```sh
|
|
595
595
|
pnpm exec forge doctor
|
|
596
|
-
pnpm exec forge validate
|
|
597
596
|
```
|
|
598
597
|
|
|
599
598
|
## Stack
|
|
@@ -614,7 +613,7 @@ workspace:
|
|
|
614
613
|
# cwd: the worktree under judgment; non-zero exit refuses.
|
|
615
614
|
set -eu
|
|
616
615
|
if [ -e node_modules/.bin/forge ]; then
|
|
617
|
-
pnpm exec forge
|
|
616
|
+
pnpm exec forge doctor
|
|
618
617
|
else
|
|
619
618
|
echo "integration-gate: forge is not installed — skipping validation" >&2
|
|
620
619
|
exit 0
|
package/profiles/knowledge.yaml
CHANGED
|
@@ -437,7 +437,7 @@ workspace:
|
|
|
437
437
|
# cwd: the worktree under judgment; non-zero exit refuses.
|
|
438
438
|
set -eu
|
|
439
439
|
if [ -e node_modules/.bin/forge ]; then
|
|
440
|
-
pnpm exec forge
|
|
440
|
+
pnpm exec forge doctor
|
|
441
441
|
else
|
|
442
442
|
echo "integration-gate: forge is not installed — skipping validation" >&2
|
|
443
443
|
exit 0
|