@warpgogol/forge 6.3.2 → 6.3.5
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 +21 -0
- package/dist/os/compass/handlers/compass-docs-scaffold.d.ts.map +1 -1
- package/dist/os/compass/handlers/compass-docs-scaffold.js +26 -3
- package/dist/os/compass/handlers/compass-docs-scaffold.js.map +1 -1
- package/dist/os/spec/spec-schema.d.ts +3 -0
- package/dist/os/spec/spec-schema.d.ts.map +1 -1
- package/dist/os/spec/spec-schema.js +1 -0
- package/dist/os/spec/spec-schema.js.map +1 -1
- package/dist/os/spec/spec-validate.d.ts.map +1 -1
- package/dist/os/spec/spec-validate.js +17 -0
- package/dist/os/spec/spec-validate.js.map +1 -1
- package/dist/os/spec/spec.module.d.ts.map +1 -1
- package/dist/os/spec/spec.module.js +4 -1
- package/dist/os/spec/spec.module.js.map +1 -1
- package/dist/src/onboarding/agents-generate.d.ts +2 -0
- package/dist/src/onboarding/agents-generate.d.ts.map +1 -1
- package/dist/src/onboarding/agents-generate.js +33 -14
- package/dist/src/onboarding/agents-generate.js.map +1 -1
- package/dist/src/onboarding/compass-docs/semantic-layer-block.d.ts +40 -0
- package/dist/src/onboarding/compass-docs/semantic-layer-block.d.ts.map +1 -0
- package/dist/src/onboarding/compass-docs/semantic-layer-block.js +116 -0
- package/dist/src/onboarding/compass-docs/semantic-layer-block.js.map +1 -0
- package/dist/src/onboarding/doctor.d.ts.map +1 -1
- package/dist/src/onboarding/doctor.js +3 -5
- package/dist/src/onboarding/doctor.js.map +1 -1
- package/dist/src/onboarding/nested-agents-generate.d.ts +2 -0
- package/dist/src/onboarding/nested-agents-generate.d.ts.map +1 -1
- package/dist/src/onboarding/nested-agents-generate.js +31 -6
- package/dist/src/onboarding/nested-agents-generate.js.map +1 -1
- package/dist/src/onboarding/nested-agents-templates.d.ts +6 -1
- package/dist/src/onboarding/nested-agents-templates.d.ts.map +1 -1
- package/dist/src/onboarding/nested-agents-templates.js +19 -4
- package/dist/src/onboarding/nested-agents-templates.js.map +1 -1
- package/docs/reference/compass-docs.md +57 -39
- package/os/compass/handlers/compass-docs-scaffold.ts +26 -3
- package/os/spec/spec-schema.ts +4 -0
- package/os/spec/spec-validate.test.ts +62 -13
- package/os/spec/spec-validate.ts +17 -0
- package/os/spec/spec.module.ts +4 -1
- package/package.json +1 -1
- package/src/onboarding/agents-generate.ts +36 -18
- package/src/onboarding/compass-docs/semantic-layer-block.test.ts +137 -0
- package/src/onboarding/compass-docs/semantic-layer-block.ts +132 -0
- package/src/onboarding/doctor.ts +3 -5
- package/src/onboarding/nested-agents-generate.ts +40 -6
- package/src/onboarding/nested-agents-templates.ts +24 -4
- package/src/tests/agents-generate.test.ts +128 -0
- package/src/tests/compass-docs-scaffold.test.ts +67 -0
- package/src/tests/fixtures/agents-generate-business-before.txt +4 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nested-agents-templates.d.ts","sourceRoot":"","sources":["../../../src/onboarding/nested-agents-templates.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"nested-agents-templates.d.ts","sourceRoot":"","sources":["../../../src/onboarding/nested-agents-templates.ts"],"names":[],"mappings":"AAyBA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAE7D,OAAO,KAAK,EAAE,YAAY,EAAiB,MAAM,0BAA0B,CAAC;AAC5E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAC1E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAIjE,MAAM,WAAW,WAAW;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS,CAAC,CAAC;IACpF,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC1C;AAgBD;;;GAGG;AACH,eAAO,MAAM,oBAAoB,+EAC6C,CAAC;AAgF/E;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAClC,aAAa,EAAE,oBAAoB,GAAG,SAAS,EAC/C,OAAO,EAAE,YAAY,GAAG,SAAS,EACjC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACnC,QAAQ,EAAE,MAAM,GACf,MAAM,CA+BR;AAYD,wBAAgB,mBAAmB,CACjC,SAAS,EAAE,YAAY,EACvB,MAAM,EAAE,WAAW,EACnB,WAAW,CAAC,EAAE,WAAW,GACxB,MAAM,CAkER"}
|
|
@@ -8,7 +8,6 @@ content-rich AGENTS.md for a workspace from its package.json metadata. No I/O.</
|
|
|
8
8
|
</non-goals>
|
|
9
9
|
</MODULE_CONTRACT>
|
|
10
10
|
<CHANGE_SUMMARY>
|
|
11
|
-
<item>RFC-0611: initial minimal stub template for app, package, service workspaces.</item>
|
|
12
11
|
<item>RFC-0643: selectNestedTemplate() for profile-driven template selection with path traversal guard.</item>
|
|
13
12
|
<item>RFC-1097: step 6 — compass.migrate codemod run
|
|
14
13
|
|
|
@@ -17,10 +16,13 @@ Mechanical v1 to v2 header migration across the workspace: 942 files rewritten
|
|
|
17
16
|
|
|
18
17
|
Sweep batch 4: 73 Compass headers on headerless engine files (certification, component-runtime, isolation, evolution, testing), real KEY_DECISIONS on 75 files (kernel, cache, dht, swim, gitmesh, runtime), ~80 purpose expansions (CONTRACT-02/PURPOSE-02), non-goals on 13 CONTRACT-03 files, CS-07 history literal fix repo-wide (253 files). Policy: .template.ts/.template.astro excludedPaths. werkstatt-engine now 0 diagnostics.</item>
|
|
19
18
|
<item>Drop the blank line pushed after the generated header — the header ends in a newline so the extra line rendered two blank lines that prettier collapsed, ping-ponging doctor's stale check.</item>
|
|
19
|
+
<item>Emit the marker-wrapped semantic-layer read-first block ahead of the footer when paths.compassDocs is bound; footer literal exported as NESTED_AGENTS_FOOTER (consumer field report follow-up to RFC-1253).</item>
|
|
20
|
+
<history>RFC-0611</history>
|
|
20
21
|
</CHANGE_SUMMARY>
|
|
21
22
|
*/
|
|
22
23
|
import { alignMarkdownTable, buildGeneratedHeader } from "../utils/index.js";
|
|
23
|
-
import { resolveForgePackageRoot } from "../config/forge-config.js";
|
|
24
|
+
import { resolveBinding, resolveForgePackageRoot } from "../config/forge-config.js";
|
|
25
|
+
import { semanticLayerLines } from "./compass-docs/semantic-layer-block.js";
|
|
24
26
|
import * as fs from "../utils/sync-fs.js";
|
|
25
27
|
import path from "node:path";
|
|
26
28
|
const TYPE_GUIDANCE = {
|
|
@@ -33,6 +35,11 @@ const TYPE_LABEL = {
|
|
|
33
35
|
package: "Package",
|
|
34
36
|
service: "Service",
|
|
35
37
|
};
|
|
38
|
+
/**
|
|
39
|
+
* Canonical nested-guide footer — the last substantive line of every render.
|
|
40
|
+
* Legacy marker-less files merge against this boundary; it must stay last.
|
|
41
|
+
*/
|
|
42
|
+
export const NESTED_AGENTS_FOOTER = "See the root `AGENTS.md` for project-wide rules, skills, and capabilities.";
|
|
36
43
|
function extractEntryPoints(exports, main) {
|
|
37
44
|
if (!exports || typeof exports !== "object") {
|
|
38
45
|
if (main)
|
|
@@ -138,7 +145,7 @@ export function selectNestedTemplate(workspaceType, profile, terminology, fallba
|
|
|
138
145
|
function substituteNestedTemplate(content, terminology) {
|
|
139
146
|
return content.replace(/\{\{terminology\.(\w+)\}\}/g, (_, key) => terminology[key] ?? key);
|
|
140
147
|
}
|
|
141
|
-
export function buildNestedAgentsMd(workspace,
|
|
148
|
+
export function buildNestedAgentsMd(workspace, config, packageInfo) {
|
|
142
149
|
const header = buildGeneratedHeader({
|
|
143
150
|
filePath: "AGENTS.md",
|
|
144
151
|
ownerCommand: "forge.agents.generate",
|
|
@@ -176,7 +183,15 @@ export function buildNestedAgentsMd(workspace, _config, packageInfo) {
|
|
|
176
183
|
}
|
|
177
184
|
lines.push(...buildScriptsTable(packageInfo?.scripts));
|
|
178
185
|
lines.push(...buildDependenciesSection(packageInfo?.dependencies));
|
|
179
|
-
|
|
186
|
+
// Compass corpus read-first block (RFC-1253): emitted ahead of the footer —
|
|
187
|
+
// the footer line is the canonical merge boundary for legacy marker-less
|
|
188
|
+
// files and must stay the render's last non-empty line.
|
|
189
|
+
const compassDocs = resolveBinding(config, "paths.compassDocs");
|
|
190
|
+
const semanticLayerDocs = (Array.isArray(compassDocs) ? compassDocs : []).filter((d) => typeof d === "string");
|
|
191
|
+
if (semanticLayerDocs.length > 0) {
|
|
192
|
+
lines.push(...semanticLayerLines(semanticLayerDocs), "");
|
|
193
|
+
}
|
|
194
|
+
lines.push(NESTED_AGENTS_FOOTER);
|
|
180
195
|
lines.push("");
|
|
181
196
|
return lines.join("\n");
|
|
182
197
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nested-agents-templates.js","sourceRoot":"","sources":["../../../src/onboarding/nested-agents-templates.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"nested-agents-templates.js","sourceRoot":"","sources":["../../../src/onboarding/nested-agents-templates.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;EAqBE;AAEF,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC7E,OAAO,EAAE,cAAc,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAEpF,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAI5E,OAAO,KAA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E,CAAC,CAAC;IAEf,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -1,19 +1,17 @@
|
|
|
1
1
|
# Compass docs corpus
|
|
2
2
|
|
|
3
|
-
The Compass docs corpus is a small set of machine-readable XML documents that
|
|
4
|
-
gives AI agents a semantic layer over the repository: *what reads X, what breaks
|
|
5
|
-
if I change Y* — without a full re-scan.
|
|
3
|
+
The Compass docs corpus is a small set of machine-readable XML documents that gives AI agents a semantic layer over the repository: _what reads X, what breaks if I change Y_ — without a full re-scan.
|
|
6
4
|
|
|
7
5
|
Canonical documents (default layout, all under `docs/`):
|
|
8
6
|
|
|
9
|
-
| Document
|
|
10
|
-
|
|
|
11
|
-
| `requirements.xml`
|
|
12
|
-
| `technology.xml`
|
|
13
|
-
| `development-plan.xml`
|
|
14
|
-
| `knowledge-graph.xml`
|
|
15
|
-
| `verification-plan.xml`
|
|
16
|
-
| `source-markup.xml`
|
|
7
|
+
| Document | Status on scaffold | Content |
|
|
8
|
+
| --- | --- | --- |
|
|
9
|
+
| `requirements.xml` | draft (TODOs) | What the repository exists to do; what "correct" is |
|
|
10
|
+
| `technology.xml` | active | Stack, toolchain, workspace inventory (from state) |
|
|
11
|
+
| `development-plan.xml` | draft (TODOs) | Durable principles and change workflow |
|
|
12
|
+
| `knowledge-graph.xml` | active | Workspace nodes + links (generated, merge-only) |
|
|
13
|
+
| `verification-plan.xml` | draft (TODOs) | Gates, commands, evidence standards |
|
|
14
|
+
| `source-markup.xml` | active | Compass source-markup contract (resolved policy) |
|
|
17
15
|
|
|
18
16
|
## Format contract
|
|
19
17
|
|
|
@@ -28,13 +26,9 @@ Every corpus document declares the schema marker inside its `<meta>` block:
|
|
|
28
26
|
</meta>
|
|
29
27
|
```
|
|
30
28
|
|
|
31
|
-
`forge/compass-docs@1` identifies the corpus format generation. Documents
|
|
32
|
-
without the marker — or with a different schema id — still validate but earn a
|
|
33
|
-
`COMPASS-DOC-04` warning so migration drift stays visible.
|
|
29
|
+
`forge/compass-docs@1` identifies the corpus format generation. Documents without the marker — or with a different schema id — still validate but earn a `COMPASS-DOC-04` warning so migration drift stays visible.
|
|
34
30
|
|
|
35
|
-
Corpus membership for that check: the six canonical basenames plus every path
|
|
36
|
-
listed in `bindings.paths.compassDocs`. Generated non-corpus XML such as
|
|
37
|
-
`docs/compass-inventory.xml` is never expected to carry the marker.
|
|
31
|
+
Corpus membership for that check: the six canonical basenames plus every path listed in `bindings.paths.compassDocs`. Generated non-corpus XML such as `docs/compass-inventory.xml` is never expected to carry the marker.
|
|
38
32
|
|
|
39
33
|
## Binding
|
|
40
34
|
|
|
@@ -52,11 +46,7 @@ bindings:
|
|
|
52
46
|
- docs/source-markup.xml
|
|
53
47
|
```
|
|
54
48
|
|
|
55
|
-
Paths may point anywhere in the workspace; `compass.docs.scaffold` maps the
|
|
56
|
-
canonical documents onto declared paths by basename (custom layouts are
|
|
57
|
-
honored, never rewritten). `forge doctor` reports declared-but-missing paths
|
|
58
|
-
as invalid and emits a scaffold remediation notice; paths outside `docs/` get
|
|
59
|
-
a convention notice.
|
|
49
|
+
Paths may point anywhere in the workspace; `compass.docs.scaffold` maps the canonical documents onto declared paths by basename (custom layouts are honored, never rewritten). `forge doctor` reports declared-but-missing paths as invalid and emits a scaffold remediation notice; paths outside `docs/` get a convention notice.
|
|
60
50
|
|
|
61
51
|
## Commands
|
|
62
52
|
|
|
@@ -65,28 +55,38 @@ forge compass.docs.scaffold [--dry-run] # materialize/merge the corpus
|
|
|
65
55
|
forge compass.docs.validate # corpus integrity gate
|
|
66
56
|
```
|
|
67
57
|
|
|
68
|
-
`compass.docs.scaffold` reads the real repository state — workspace discovery,
|
|
69
|
-
stack profile, resolved Compass policy — and:
|
|
58
|
+
`compass.docs.scaffold` reads the real repository state — workspace discovery, stack profile, resolved Compass policy — and:
|
|
70
59
|
|
|
71
60
|
- creates missing corpus documents from templates,
|
|
72
|
-
- merges **only missing workspace nodes** into an existing
|
|
73
|
-
`knowledge-graph.xml` (authored content is never overwritten),
|
|
61
|
+
- merges **only missing workspace nodes** into an existing `knowledge-graph.xml` (authored content is never overwritten),
|
|
74
62
|
- writes/merges `bindings.paths.compassDocs` in `forge.yaml`,
|
|
75
63
|
- stays byte-stable on reruns; `--dry-run` prints the action manifest.
|
|
76
64
|
|
|
77
|
-
`compass.docs.validate` scans `docs/*.xml` ∪ the bound paths (deduplicated)
|
|
78
|
-
and enforces:
|
|
65
|
+
`compass.docs.validate` scans `docs/*.xml` ∪ the bound paths (deduplicated) and enforces:
|
|
79
66
|
|
|
80
|
-
| Rule
|
|
81
|
-
|
|
|
82
|
-
| `COMPASS-DOC-00` | error
|
|
83
|
-
| `COMPASS-DOC-01` | error
|
|
84
|
-
| `COMPASS-DOC-02` | error
|
|
85
|
-
| `COMPASS-DOC-03` | warning
|
|
86
|
-
| `COMPASS-DOC-04` | warning
|
|
67
|
+
| Rule | Severity | Check |
|
|
68
|
+
| ---------------- | -------- | ---------------------------------------------------- |
|
|
69
|
+
| `COMPASS-DOC-00` | error | well-formed XML (tag balance) |
|
|
70
|
+
| `COMPASS-DOC-01` | error | `<path>` references resolve under the workspace root |
|
|
71
|
+
| `COMPASS-DOC-02` | error | workspace ids (`pkg-*`, `svc-*`, `app-*`) exist |
|
|
72
|
+
| `COMPASS-DOC-03` | warning | `<link>` targets resolve to nodes or files |
|
|
73
|
+
| `COMPASS-DOC-04` | warning | corpus docs carry the `forge/compass-docs@1` marker |
|
|
74
|
+
|
|
75
|
+
`forge validate` runs the corpus validator automatically when the binding resolves non-empty and feeds errors into `allPassed`.
|
|
76
|
+
|
|
77
|
+
### Workspace id convention
|
|
78
|
+
|
|
79
|
+
Workspace node ids follow the **location** convention `COMPASS-DOC-02` enforces — the prefix names the top-level directory, not the detected workspace type:
|
|
80
|
+
|
|
81
|
+
| Location | Emitted id | Example |
|
|
82
|
+
| ----------------------------- | ------------------------- | -------------------------- |
|
|
83
|
+
| `apps/<name>` | `app-<name>` | `apps/api` → `app-api` |
|
|
84
|
+
| `packages/<name>` | `pkg-<name>` | `packages/foo` → `pkg-foo` |
|
|
85
|
+
| `services/<name>` | `svc-<name>` | `services/x` → `svc-x` |
|
|
86
|
+
| anywhere else / nested deeper | `<dir>.<…>.<name>` dotted | `tools/x` → `tools.x` |
|
|
87
|
+
|
|
88
|
+
The prefix never comes from content detection — a worker under `apps/` still gets `app-*`, so scaffold output always validates clean. Dotted ids outside `apps`/`packages`/`services` are semantic handles: `COMPASS-DOC-02` resolves only their first two segments (or leaves unmapped prefixes unchecked), while the node's `<path>` still pins the real directory via `COMPASS-DOC-01`.
|
|
87
89
|
|
|
88
|
-
`forge validate` runs the corpus validator automatically when the binding
|
|
89
|
-
resolves non-empty and feeds errors into `allPassed`.
|
|
90
90
|
|
|
91
91
|
## Lifecycle opt-in
|
|
92
92
|
|
|
@@ -98,5 +98,23 @@ forge upgrade --compass-docs
|
|
|
98
98
|
|
|
99
99
|
`--compass-docs` runs `compass.docs.scaffold` after the primary operation.
|
|
100
100
|
When the binding resolves non-empty, `forge agents.generate` emits a
|
|
101
|
-
"Semantic layer — read first" block
|
|
102
|
-
|
|
101
|
+
"Semantic layer — read first" block — marker-wrapped in
|
|
102
|
+
`<!-- forge:begin semantic-layer -->` / `<!-- forge:end semantic-layer -->` —
|
|
103
|
+
into the generated root `AGENTS.md` and every generated nested workspace
|
|
104
|
+
guide, so agents read the corpus before planning or editing code.
|
|
105
|
+
|
|
106
|
+
### Discoverability in hand-written AGENTS.md
|
|
107
|
+
|
|
108
|
+
Hand-written files are never overwritten — but they can opt in to the block.
|
|
109
|
+
Drop the sentinel anywhere in the file:
|
|
110
|
+
|
|
111
|
+
```md
|
|
112
|
+
<!-- forge:semantic-layer -->
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
The next `agents.generate` (or `upgrade`, or `doctor --fix`) expands it into
|
|
116
|
+
a full marker-wrapped region listing the bound corpus docs. Regions already
|
|
117
|
+
present are refreshed in place — a block pasted from generated output keeps
|
|
118
|
+
updating when `paths.compassDocs` changes. Files without the sentinel are
|
|
119
|
+
left untouched.
|
|
120
|
+
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
</KEY_DECISIONS>
|
|
15
15
|
<CHANGE_SUMMARY>
|
|
16
16
|
<item>RFC-1253: created — six-doc scaffold, KG node merge, binding patch, dry-run manifest.</item>
|
|
17
|
+
<item>Derive workspace node id prefixes from directory location (apps/→app-, packages/→pkg-, services/→svc-, dotted elsewhere) — COMPASS-DOC-02 resolves prefixes to paths, so type-derived ids failed validation on apps/ repos (consumer field report).</item>
|
|
17
18
|
</CHANGE_SUMMARY>
|
|
18
19
|
*/
|
|
19
20
|
|
|
@@ -97,10 +98,32 @@ interface ScaffoldWorkspace {
|
|
|
97
98
|
name: string;
|
|
98
99
|
}
|
|
99
100
|
|
|
101
|
+
/**
|
|
102
|
+
* COMPASS-DOC-02 resolves workspace ids by top-level-directory convention:
|
|
103
|
+
* app-* names apps/<rest>, pkg-* names packages/<rest>, svc-* names
|
|
104
|
+
* services/<rest>. Deriving the prefix from the detected workspace type breaks
|
|
105
|
+
* that contract on repos whose apps/ workspaces miss content detection — a
|
|
106
|
+
* non-astro, non-docker workspace under apps/ detects as "package" and would
|
|
107
|
+
* emit pkg-<name>, which the validator resolves to a packages/<name> path that
|
|
108
|
+
* does not exist. Derive the prefix from the location instead; locations the
|
|
109
|
+
* prefixed convention cannot express (nested deeper than <dir>/<name>, or
|
|
110
|
+
* outside apps/packages/services) fall back to the dotted semantic-id form —
|
|
111
|
+
* DOC-02 resolves it through its first two segments or leaves unmapped
|
|
112
|
+
* prefixes unchecked, and DOC-01 still verifies the real path via <path>.
|
|
113
|
+
*/
|
|
114
|
+
const WORKSPACE_ID_PREFIX: Record<string, string> = {
|
|
115
|
+
apps: "app",
|
|
116
|
+
packages: "pkg",
|
|
117
|
+
services: "svc",
|
|
118
|
+
};
|
|
119
|
+
|
|
100
120
|
function workspaceNodeId(dir: WorkspaceDir): string {
|
|
101
|
-
const
|
|
102
|
-
|
|
103
|
-
|
|
121
|
+
const segments = dir.path.replace(/\\/g, "/").split("/").filter(Boolean);
|
|
122
|
+
if (segments.length === 2) {
|
|
123
|
+
const prefix = WORKSPACE_ID_PREFIX[segments[0]!];
|
|
124
|
+
if (prefix) return `${prefix}-${segments[1]}`;
|
|
125
|
+
}
|
|
126
|
+
return segments.join(".");
|
|
104
127
|
}
|
|
105
128
|
|
|
106
129
|
function readPackageName(
|
package/os/spec/spec-schema.ts
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
<CHANGE_SUMMARY>
|
|
10
10
|
<item>RFC-0394: initial spec schema — forge/spec@1, integrity manifest, decision/rfc/wave types.</item>
|
|
11
11
|
<item>RFC-1240: consumers field on roadmap nodes (consumer ownership filtering); severity field on SpecViolation for warning diagnostics.</item>
|
|
12
|
+
<item>Handoff xrepo-personal-agent-to-forge-spec-validate-sweep: skippedDirs field on SpecValidateResult for sweep-mode transparency.</item>
|
|
12
13
|
</CHANGE_SUMMARY>
|
|
13
14
|
*/
|
|
14
15
|
|
|
@@ -154,6 +155,9 @@ export interface SpecValidateResult {
|
|
|
154
155
|
status: string;
|
|
155
156
|
violations: SpecViolation[];
|
|
156
157
|
}>;
|
|
158
|
+
/** Dirs under specsDir skipped in sweep mode — non-package dirs carry no
|
|
159
|
+
* forge-spec.yaml (authored/live work areas). Always [] under --spec. */
|
|
160
|
+
skippedDirs: string[];
|
|
157
161
|
}
|
|
158
162
|
|
|
159
163
|
// ---------------------------------------------------------------------------
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/*
|
|
2
2
|
<MODULE_CONTRACT>
|
|
3
|
-
<purpose>Prove vendored spec validation
|
|
3
|
+
<purpose>Prove vendored spec validation behaviors — consumer rules, SPEC-07 archive resolution, and sweep-mode package scoping.</purpose>
|
|
4
4
|
<non-goals><item>Do not duplicate individual integrity, graph, or amendment rule tests.</item></non-goals>
|
|
5
5
|
</MODULE_CONTRACT>
|
|
6
|
-
<CHANGE_SUMMARY><item>Gap fix: cover SPEC-07 after terminal RFC archival.</item></CHANGE_SUMMARY>
|
|
6
|
+
<CHANGE_SUMMARY><item>Gap fix: cover SPEC-07 after terminal RFC archival.</item><item>Handoff xrepo-personal-agent-to-forge-spec-validate-sweep: cover sweep-mode manifest-dir scoping and skippedDirs.</item></CHANGE_SUMMARY>
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import fs from "node:fs/promises";
|
|
@@ -19,11 +19,10 @@ afterEach(async () => {
|
|
|
19
19
|
await Promise.all(roots.splice(0).map((root) => fs.rm(root, { recursive: true, force: true })));
|
|
20
20
|
});
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
await fs.writeFile(path.join(specDir, "forge-spec.yaml"), `schema: forge/spec@1
|
|
22
|
+
async function writeConsumerSpec(workspaceRoot: string, consumersYaml: string): Promise<void> {
|
|
23
|
+
const specDir = path.join(workspaceRoot, "docs/specs/example");
|
|
24
|
+
await fs.mkdir(specDir, { recursive: true });
|
|
25
|
+
await fs.writeFile(path.join(specDir, "forge-spec.yaml"), `schema: forge/spec@1
|
|
27
26
|
id: example
|
|
28
27
|
title: Example
|
|
29
28
|
version: 1.0.0
|
|
@@ -44,14 +43,15 @@ ${consumersYaml}waves:
|
|
|
44
43
|
name: Test
|
|
45
44
|
goal: Exercise consumer rules
|
|
46
45
|
`);
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
await fs.writeFile(path.join(specDir, "integrity.yaml"), "schema: forge/spec-integrity@1\nfiles: {}\n");
|
|
47
|
+
}
|
|
49
48
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
49
|
+
function ctx(workspaceRoot: string): ForgeRuntimeContext {
|
|
50
|
+
return { workspaceRoot, dryRun: false, outputFormat: "json",
|
|
51
|
+
logger: { section() {}, info() {}, warn() {}, error() {}, success() {} } } as ForgeRuntimeContext;
|
|
52
|
+
}
|
|
54
53
|
|
|
54
|
+
describe("spec.validate consumer rules (RFC-1240)", () => {
|
|
55
55
|
it("emits SPEC-13 warning without failing when consumers exist but no local identity is configured", async () => {
|
|
56
56
|
const workspaceRoot = await fs.mkdtemp(path.join(os.tmpdir(), "spec-validate-consumer-"));
|
|
57
57
|
roots.push(workspaceRoot);
|
|
@@ -123,3 +123,52 @@ waves:
|
|
|
123
123
|
specs: [{ id: "example", violations: [] }] } });
|
|
124
124
|
});
|
|
125
125
|
});
|
|
126
|
+
|
|
127
|
+
describe("spec.validate sweep scoping (xrepo-personal-agent-to-forge-spec-validate-sweep)", () => {
|
|
128
|
+
it("skips dirs without forge-spec.yaml and reports them in skippedDirs", async () => {
|
|
129
|
+
const workspaceRoot = await fs.mkdtemp(path.join(os.tmpdir(), "spec-validate-sweep-"));
|
|
130
|
+
roots.push(workspaceRoot);
|
|
131
|
+
await writeConsumerSpec(workspaceRoot, "");
|
|
132
|
+
await fs.mkdir(path.join(workspaceRoot, "docs/specs/authored-draft"), { recursive: true });
|
|
133
|
+
await fs.mkdir(path.join(workspaceRoot, "docs/specs/live"), { recursive: true });
|
|
134
|
+
const result = await runSpecValidate({ argv: [], flags: {} }, ctx(workspaceRoot));
|
|
135
|
+
expect(result.exitCode).toBe(0);
|
|
136
|
+
expect(result.data!.status).toBe("pass");
|
|
137
|
+
expect(result.data!.specs.map((s) => s.id)).toEqual(["example"]);
|
|
138
|
+
expect(result.data!.skippedDirs.sort()).toEqual(["authored-draft", "live"]);
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
it("passes with empty specs when every dir lacks a manifest", async () => {
|
|
142
|
+
const workspaceRoot = await fs.mkdtemp(path.join(os.tmpdir(), "spec-validate-sweep-"));
|
|
143
|
+
roots.push(workspaceRoot);
|
|
144
|
+
await fs.mkdir(path.join(workspaceRoot, "docs/specs/authored-draft"), { recursive: true });
|
|
145
|
+
const result = await runSpecValidate({ argv: [], flags: {} }, ctx(workspaceRoot));
|
|
146
|
+
expect(result).toMatchObject({ exitCode: 0, data: { status: "pass",
|
|
147
|
+
specs: [], skippedDirs: ["authored-draft"] } });
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
it("keeps SPEC-02 when --spec names a dir without a manifest", async () => {
|
|
151
|
+
const workspaceRoot = await fs.mkdtemp(path.join(os.tmpdir(), "spec-validate-sweep-"));
|
|
152
|
+
roots.push(workspaceRoot);
|
|
153
|
+
await fs.mkdir(path.join(workspaceRoot, "docs/specs/authored-draft"), { recursive: true });
|
|
154
|
+
const result = await runSpecValidate(
|
|
155
|
+
{ argv: [], flags: { spec: "authored-draft" } }, ctx(workspaceRoot));
|
|
156
|
+
expect(result.exitCode).toBe(1);
|
|
157
|
+
expect(result.data!.specs[0]!.violations).toEqual([
|
|
158
|
+
{ rule: "SPEC-02", message: "forge-spec.yaml not found" },
|
|
159
|
+
]);
|
|
160
|
+
expect(result.data!.skippedDirs).toEqual([]);
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
it("still reports SPEC-02 in sweep mode for a present-but-corrupt manifest", async () => {
|
|
164
|
+
const workspaceRoot = await fs.mkdtemp(path.join(os.tmpdir(), "spec-validate-sweep-"));
|
|
165
|
+
roots.push(workspaceRoot);
|
|
166
|
+
const broken = path.join(workspaceRoot, "docs/specs/broken");
|
|
167
|
+
await fs.mkdir(broken, { recursive: true });
|
|
168
|
+
await fs.writeFile(path.join(broken, "forge-spec.yaml"), "schema: [unclosed\n");
|
|
169
|
+
const result = await runSpecValidate({ argv: [], flags: {} }, ctx(workspaceRoot));
|
|
170
|
+
expect(result.exitCode).toBe(1);
|
|
171
|
+
expect(result.data!.skippedDirs).toEqual([]);
|
|
172
|
+
expect(result.data!.specs[0]!.violations[0]!.rule).toBe("SPEC-02");
|
|
173
|
+
});
|
|
174
|
+
});
|
package/os/spec/spec-validate.ts
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
<item>RFC-0394: initial spec.validate handler with SPEC-01..07 rules.</item>
|
|
12
12
|
<item>Gap fix: resolve materialized RFCs recursively so terminal RFC archival does not invalidate accepted specs.</item>
|
|
13
13
|
<item>RFC-1240: SPEC-12 consumers list hygiene, SPEC-13 consumer-identity warning; warnings no longer fail validation.</item>
|
|
14
|
+
<item>Handoff xrepo-personal-agent-to-forge-spec-validate-sweep: sweep mode skips dirs without forge-spec.yaml (authored/live areas are not packages), reports them as skippedDirs; --spec keeps SPEC-02.</item>
|
|
14
15
|
</CHANGE_SUMMARY>
|
|
15
16
|
*/
|
|
16
17
|
|
|
@@ -456,6 +457,7 @@ export async function runSpecValidate(
|
|
|
456
457
|
const filterSpec = input.flags["spec"] as string | undefined;
|
|
457
458
|
|
|
458
459
|
let specDirs = await listSpecDirs(specsRoot);
|
|
460
|
+
const skippedDirs: string[] = [];
|
|
459
461
|
if (filterSpec) {
|
|
460
462
|
if (!specDirs.includes(filterSpec)) {
|
|
461
463
|
return {
|
|
@@ -463,12 +465,21 @@ export async function runSpecValidate(
|
|
|
463
465
|
command: "spec.validate",
|
|
464
466
|
status: "fail",
|
|
465
467
|
specs: [],
|
|
468
|
+
skippedDirs,
|
|
466
469
|
},
|
|
467
470
|
exitCode: 1,
|
|
468
471
|
summary: `spec.validate: spec '${filterSpec}' not found. Available: ${specDirs.join(", ") || "(none)"}`,
|
|
469
472
|
};
|
|
470
473
|
}
|
|
471
474
|
specDirs = [filterSpec];
|
|
475
|
+
} else {
|
|
476
|
+
// Sweep mode: only manifest-bearing dirs are spec packages — authored
|
|
477
|
+
// work areas and docs/specs/live/ carry no forge-spec.yaml and are skipped.
|
|
478
|
+
specDirs = specDirs.filter((dir) => {
|
|
479
|
+
if (existsSync(path.join(specsRoot, dir, "forge-spec.yaml"))) return true;
|
|
480
|
+
skippedDirs.push(dir);
|
|
481
|
+
return false;
|
|
482
|
+
});
|
|
472
483
|
}
|
|
473
484
|
|
|
474
485
|
const rfcDir = path.join(workspaceRoot, "docs", "rfcs");
|
|
@@ -553,6 +564,11 @@ export async function runSpecValidate(
|
|
|
553
564
|
}
|
|
554
565
|
}
|
|
555
566
|
}
|
|
567
|
+
if (skippedDirs.length > 0) {
|
|
568
|
+
logger.info(
|
|
569
|
+
`Skipped ${skippedDirs.length} non-package dir(s) without forge-spec.yaml: ${skippedDirs.join(", ")}`,
|
|
570
|
+
);
|
|
571
|
+
}
|
|
556
572
|
}
|
|
557
573
|
|
|
558
574
|
return {
|
|
@@ -560,6 +576,7 @@ export async function runSpecValidate(
|
|
|
560
576
|
command: "spec.validate",
|
|
561
577
|
status: hasFailures ? "fail" : "pass",
|
|
562
578
|
specs: results,
|
|
579
|
+
skippedDirs,
|
|
563
580
|
},
|
|
564
581
|
exitCode: hasFailures ? 1 : 0,
|
|
565
582
|
summary: hasFailures
|
package/os/spec/spec.module.ts
CHANGED
|
@@ -17,6 +17,7 @@ assertAllFlagAccepted, message updated. 417 declaration sites + type
|
|
|
17
17
|
surfaces (KernelCommandMetadata, ForgeCommandMetadata) in one atomic pass.</item>
|
|
18
18
|
<item>RFC-1234: spec.live.validate description lists V-LS-09 drift rule.</item>
|
|
19
19
|
<item>RFC-1240: --consumer flag on spec.validate/spec.status/spec.materialize; SPEC-12/13 rules in spec.validate description.</item>
|
|
20
|
+
<item>Handoff xrepo-personal-agent-to-forge-spec-validate-sweep: spec.validate description documents sweep-mode manifest-dir scoping.</item>
|
|
20
21
|
<history>RFC-0394, RFC-0396, RFC-0711</history>
|
|
21
22
|
</CHANGE_SUMMARY>
|
|
22
23
|
*/
|
|
@@ -62,7 +63,9 @@ const { runSpecValidate } = await import("./spec-validate.ts");
|
|
|
62
63
|
"Checks integrity (SHA-256), schema, dependency graph (acyclic), " +
|
|
63
64
|
"reference resolution, wave coverage, duplicate ids, materializedAs links, " +
|
|
64
65
|
"and consumer hygiene (SPEC-12 duplicates/empty, SPEC-13 identity warning). " +
|
|
65
|
-
"
|
|
66
|
+
"Sweep mode skips directories without forge-spec.yaml (authored/live dirs " +
|
|
67
|
+
"are not packages); --spec=<id> validates one spec and reports SPEC-02 " +
|
|
68
|
+
"when the named dir lacks a manifest.",
|
|
66
69
|
scope: "workspace",
|
|
67
70
|
flags: {
|
|
68
71
|
spec: {
|
package/package.json
CHANGED
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
</non-goals>
|
|
8
8
|
</MODULE_CONTRACT>
|
|
9
9
|
<CHANGE_SUMMARY>
|
|
10
|
-
<item>RFC-0664: added project memory layer read discipline section to generated AGENTS.md.</item>
|
|
11
10
|
<item>RFC-1253: emit "Semantic layer — read first" block listing bound paths.compassDocs before the Skills table when the binding resolves non-empty.</item>
|
|
12
11
|
<item>RFC-1097: step 6 — compass.migrate codemod run
|
|
13
12
|
|
|
@@ -16,7 +15,8 @@ Mechanical v1 to v2 header migration across the workspace: 942 files rewritten
|
|
|
16
15
|
|
|
17
16
|
Sweep batch 2: real KEY_DECISIONS on 10 files, expanded purposes (CONTRACT-02/PURPOSE-02), headers on mission/index + gen-upstreams, sanitizeItemText in summary.record (literal Compass tags corrupted history), excludedPaths for wrangler types, test-fixtures testPattern. forge+services now 0 diagnostics under --mode error.</item>
|
|
18
17
|
<item>Single blank line after the generated header — header ends in a newline so "\n\n" produced two blank lines that prettier collapsed, ping-ponging doctor's stale check. wsTypes resolution moved to shared resolveWorkspaceTypes.</item>
|
|
19
|
-
<
|
|
18
|
+
<item>Semantic-layer block rendered marker-wrapped via shared semantic-layer-block module and injected/refreshed inside hand-written roots carrying the sentinel or a pasted region; result gains injected[] (consumer field report follow-up to RFC-1253).</item>
|
|
19
|
+
<history>RFC-0391, RFC-0393, RFC-0548, RFC-0549, RFC-0551, RFC-0611, RFC-0640, RFC-0643, RFC-0664</history>
|
|
20
20
|
</CHANGE_SUMMARY>
|
|
21
21
|
*/
|
|
22
22
|
|
|
@@ -29,6 +29,7 @@ import { resolveAllTerminology } from "../profiles/terminology-utils.ts";
|
|
|
29
29
|
import { FORGE_SKILLS } from "../registry.ts";
|
|
30
30
|
import { alignMarkdownTable, buildGeneratedHeader, hasEditableGeneratedMarker, hasGeneratedMarker, mergeEditableGenerated, writeFileIfChanged } from "../utils/index.ts";
|
|
31
31
|
import { generateNestedAgentsMd } from "./nested-agents-generate.ts";
|
|
32
|
+
import { injectSemanticLayerBlock, semanticLayerLines } from "./compass-docs/semantic-layer-block.ts";
|
|
32
33
|
import { resolveWorkspaceTypes } from "./workspace-discovery.ts";
|
|
33
34
|
import type { StackProfile } from "../profiles/stack-profile.ts";
|
|
34
35
|
import type {
|
|
@@ -235,6 +236,8 @@ interface AgentsGenerateResult {
|
|
|
235
236
|
configPath: string;
|
|
236
237
|
generated: string[];
|
|
237
238
|
skipped: string[];
|
|
239
|
+
/** Hand-written files that accepted the marker-guarded semantic-layer block. */
|
|
240
|
+
injected: string[];
|
|
238
241
|
errors: string[];
|
|
239
242
|
renderedFiles?: { [relPath: string]: string };
|
|
240
243
|
details?: Array<{ path: string; domain?: string; register?: string; workspaceType?: string }>;
|
|
@@ -265,6 +268,7 @@ export async function runAgentsGenerate(
|
|
|
265
268
|
configPath: "forge.yaml",
|
|
266
269
|
generated: [],
|
|
267
270
|
skipped: [],
|
|
271
|
+
injected: [],
|
|
268
272
|
errors: [msg],
|
|
269
273
|
},
|
|
270
274
|
exitCode: 1,
|
|
@@ -305,21 +309,15 @@ export async function runAgentsGenerate(
|
|
|
305
309
|
|
|
306
310
|
// RFC-1253: Compass corpus read-first block — only when the binding
|
|
307
311
|
// resolves non-empty (DNA-90: instructions live where agents read them).
|
|
312
|
+
// Marker-wrapped so hand-written files that pasted it stay refreshable.
|
|
308
313
|
const compassDocsReadFirst = resolveBinding(config, "paths.compassDocs");
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
dynamicLines.push(
|
|
316
|
-
for (const doc of compassDocsReadFirst) {
|
|
317
|
-
dynamicLines.push(`- \`${doc}\``);
|
|
318
|
-
}
|
|
319
|
-
dynamicLines.push("");
|
|
320
|
-
dynamicLines.push(
|
|
321
|
-
"Treat these XML documents as the primary semantic layer for AI work and keep them synchronized with code, architecture, and verification changes.",
|
|
322
|
-
);
|
|
314
|
+
const semanticLayerDocs = (Array.isArray(compassDocsReadFirst) ? compassDocsReadFirst : []).filter(
|
|
315
|
+
(d): d is string => typeof d === "string",
|
|
316
|
+
);
|
|
317
|
+
const semanticLayerBlock =
|
|
318
|
+
semanticLayerDocs.length > 0 ? semanticLayerLines(semanticLayerDocs).join("\n") : "";
|
|
319
|
+
if (semanticLayerBlock) {
|
|
320
|
+
dynamicLines.push(semanticLayerBlock);
|
|
323
321
|
dynamicLines.push("");
|
|
324
322
|
}
|
|
325
323
|
|
|
@@ -417,6 +415,7 @@ export async function runAgentsGenerate(
|
|
|
417
415
|
|
|
418
416
|
const generated: string[] = [];
|
|
419
417
|
const skipped: string[] = [];
|
|
418
|
+
const injected: string[] = [];
|
|
420
419
|
const renderedFiles: { [relPath: string]: string } = {};
|
|
421
420
|
const details: Array<{ path: string; domain?: string; register?: string; workspaceType?: string }> = [];
|
|
422
421
|
details.push({
|
|
@@ -429,7 +428,24 @@ export async function runAgentsGenerate(
|
|
|
429
428
|
renderedFiles["AGENTS.md"] = content;
|
|
430
429
|
generated.push("AGENTS.md");
|
|
431
430
|
} else if (rootSkipped) {
|
|
432
|
-
|
|
431
|
+
// Marker-guarded opt-in: a hand-written root carrying the semantic-layer
|
|
432
|
+
// sentinel (or a pasted marked region) gets the block refreshed —
|
|
433
|
+
// surrounding prose is never touched.
|
|
434
|
+
let rootInjected = false;
|
|
435
|
+
if (semanticLayerBlock) {
|
|
436
|
+
try {
|
|
437
|
+
const existing = await fio.readFile(agentsMdPath);
|
|
438
|
+
const injection = injectSemanticLayerBlock(existing, semanticLayerBlock);
|
|
439
|
+
if (injection.changed) {
|
|
440
|
+
await writeFileIfChanged(agentsMdPath, injection.content, fio);
|
|
441
|
+
rootInjected = true;
|
|
442
|
+
}
|
|
443
|
+
} catch {
|
|
444
|
+
// Unreadable — leave the hand-written file alone.
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
skipped.push(`AGENTS.md (hand-written${rootInjected ? " — semantic-layer injected" : ""})`);
|
|
448
|
+
if (rootInjected) injected.push("AGENTS.md");
|
|
433
449
|
} else {
|
|
434
450
|
// RFC-1153: merge instead of overwrite — preserve the custom tail below
|
|
435
451
|
// the forge:custom boundary; fail-closed skip when no boundary resolves.
|
|
@@ -478,6 +494,7 @@ export async function runAgentsGenerate(
|
|
|
478
494
|
const nestedResult = await generateNestedAgentsMd(workspaceRoot, config, dryRun, workspaceTypes, fio);
|
|
479
495
|
generated.push(...nestedResult.generated);
|
|
480
496
|
skipped.push(...nestedResult.skipped);
|
|
497
|
+
injected.push(...nestedResult.injected);
|
|
481
498
|
Object.assign(renderedFiles, nestedResult.renderedFiles);
|
|
482
499
|
|
|
483
500
|
// RFC-0643: add details for nested files
|
|
@@ -505,6 +522,7 @@ export async function runAgentsGenerate(
|
|
|
505
522
|
configPath: "forge.yaml",
|
|
506
523
|
generated,
|
|
507
524
|
skipped,
|
|
525
|
+
injected,
|
|
508
526
|
errors: [],
|
|
509
527
|
details,
|
|
510
528
|
...(rootSkipped ? { rootSkipped: true, rootSkipReason: "hand-written" } : {}),
|
|
@@ -513,6 +531,6 @@ export async function runAgentsGenerate(
|
|
|
513
531
|
exitCode: 0,
|
|
514
532
|
summary: dryRun
|
|
515
533
|
? `forge.agents.generate: [dry-run] would generate ${generated.length} file(s), skip ${skipped.length}`
|
|
516
|
-
: `forge.agents.generate: OK — ${generated.length} file(s) generated, ${skipped.length} skipped${rootSkipped ? " (root AGENTS.md hand-written — skipped)" : ""}`,
|
|
534
|
+
: `forge.agents.generate: OK — ${generated.length} file(s) generated, ${skipped.length} skipped${injected.length > 0 ? `, ${injected.length} semantic-layer injected` : ""}${rootSkipped ? " (root AGENTS.md hand-written — skipped)" : ""}`,
|
|
517
535
|
};
|
|
518
536
|
}
|