@warpgogol/forge 6.3.0 → 6.3.2
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 +153 -0
- package/bin/cli.js +13 -2
- package/dist/os/core/core.module.d.ts.map +1 -1
- package/dist/os/core/core.module.js +6 -8
- package/dist/os/core/core.module.js.map +1 -1
- package/dist/os/core/handlers/package-health.d.ts.map +1 -1
- package/dist/os/core/handlers/package-health.js +213 -13
- package/dist/os/core/handlers/package-health.js.map +1 -1
- package/dist/src/onboarding/agents-generate.d.ts.map +1 -1
- package/dist/src/onboarding/agents-generate.js +14 -25
- package/dist/src/onboarding/agents-generate.js.map +1 -1
- package/dist/src/onboarding/doctor.d.ts.map +1 -1
- package/dist/src/onboarding/doctor.js +69 -28
- package/dist/src/onboarding/doctor.js.map +1 -1
- package/dist/src/onboarding/init.d.ts.map +1 -1
- package/dist/src/onboarding/init.js +35 -4
- package/dist/src/onboarding/init.js.map +1 -1
- package/dist/src/onboarding/nested-agents-templates.d.ts.map +1 -1
- package/dist/src/onboarding/nested-agents-templates.js +1 -1
- package/dist/src/onboarding/nested-agents-templates.js.map +1 -1
- package/dist/src/onboarding/prettierignore.d.ts +8 -2
- package/dist/src/onboarding/prettierignore.d.ts.map +1 -1
- package/dist/src/onboarding/prettierignore.js +36 -4
- package/dist/src/onboarding/prettierignore.js.map +1 -1
- package/dist/src/onboarding/skill-markers.d.ts +1 -0
- package/dist/src/onboarding/skill-markers.d.ts.map +1 -1
- package/dist/src/onboarding/skill-markers.js +1 -1
- package/dist/src/onboarding/skill-markers.js.map +1 -1
- package/dist/src/onboarding/upgrade.d.ts +4 -0
- package/dist/src/onboarding/upgrade.d.ts.map +1 -1
- package/dist/src/onboarding/upgrade.js +73 -9
- package/dist/src/onboarding/upgrade.js.map +1 -1
- package/dist/src/onboarding/workspace-discovery.d.ts +9 -0
- package/dist/src/onboarding/workspace-discovery.d.ts.map +1 -1
- package/dist/src/onboarding/workspace-discovery.js +30 -0
- package/dist/src/onboarding/workspace-discovery.js.map +1 -1
- package/dist/src/utils/generated-marker.d.ts.map +1 -1
- package/dist/src/utils/generated-marker.js +14 -6
- package/dist/src/utils/generated-marker.js.map +1 -1
- package/docs/reference/cli.md +1 -1
- package/os/core/core.module.ts +6 -8
- package/os/core/docs-archive.test.ts +2 -5
- package/os/core/handlers/package-health.test.ts +262 -4
- package/os/core/handlers/package-health.ts +223 -13
- package/os/rfc/verification-emit.test.ts +1 -1
- package/os/rfc/verification-refresh.test.ts +1 -1
- package/os/spec/spec-validate.test.ts +4 -4
- package/package.json +2 -2
- package/profiles/forge-shell.yaml +5 -14
- package/profiles/godot-game.yaml +5 -14
- package/profiles/phaser-game.yaml +5 -14
- package/profiles/typescript.yaml +5 -14
- package/skills/fo/fo-handoff/SKILL.md +5 -4
- package/skills/fo/fo-step-commit/SKILL.md +4 -1
- package/src/onboarding/agents-generate.ts +14 -25
- package/src/onboarding/doctor.ts +74 -26
- package/src/onboarding/init.ts +35 -4
- package/src/onboarding/nested-agents-templates.ts +1 -1
- package/src/onboarding/prettierignore.ts +45 -2
- package/src/onboarding/skill-markers.ts +5 -1
- package/src/onboarding/templates/behavioral-layer-core.md +2 -0
- package/src/onboarding/templates/root-agents-business.md +1 -0
- package/src/onboarding/templates/root-agents-creative.md +1 -0
- package/src/onboarding/upgrade.ts +122 -11
- package/src/onboarding/workspace-discovery.ts +33 -0
- package/src/tests/bindings-schema.test.ts +1 -0
- package/src/tests/compass-docs-flag.test.ts +2 -0
- package/src/tests/doctor-version-sync.test.ts +155 -0
- package/src/tests/file-size-lint.test.ts +7 -5
- package/src/tests/fixtures/agents-generate-business-before.txt +4 -2
- package/src/tests/forge-config.test.ts +2 -3
- package/src/tests/generated-marker.test.ts +17 -0
- package/src/tests/prettierignore-manage.test.ts +30 -0
- package/src/tests/session-handlers.test.ts +2 -2
- package/src/tests/session-pbt.test.ts +1 -1
- package/src/tests/skill-agents-sync.test.ts +25 -0
- package/src/tests/upgrade.test.ts +82 -1
- package/src/utils/generated-marker.ts +15 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@warpgogol/forge",
|
|
3
|
-
"version": "6.3.
|
|
3
|
+
"version": "6.3.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -175,7 +175,7 @@
|
|
|
175
175
|
"CHANGELOG.md"
|
|
176
176
|
],
|
|
177
177
|
"scripts": {
|
|
178
|
-
"build": "pnpm exec tsc -p tsconfig.json",
|
|
178
|
+
"build": "pnpm exec tsc -p tsconfig.build.json",
|
|
179
179
|
"build:check": "pnpm exec tsc -p tsconfig.json --noEmit",
|
|
180
180
|
"lint": "pnpm exec eslint \"src/**/*.ts\" \"os/**/*.ts\"",
|
|
181
181
|
"typecheck": "pnpm exec tsc -p tsconfig.json --noEmit",
|
|
@@ -169,25 +169,16 @@ workspace:
|
|
|
169
169
|
- path: tools/kernel.config.ts
|
|
170
170
|
content: |
|
|
171
171
|
import { defineKernelConfig } from "@warpgogol/werkstatt-engine/kernel/types";
|
|
172
|
+
import { forgeModuleLoaders } from "@warpgogol/werkstatt-engine/kernel/module-map";
|
|
172
173
|
|
|
173
174
|
export default defineKernelConfig({
|
|
174
175
|
name: "__PROJECT_NAME__",
|
|
175
176
|
description: "__PROJECT_NAME__ workshop",
|
|
176
177
|
moduleLoaders: {
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
"forge-audit": async () => (await import("@warpgogol/forge/os/audit-module")).forgeAuditModule,
|
|
182
|
-
"forge-compass": async () => (await import("@warpgogol/forge/os/compass")).forgeCompassModule,
|
|
183
|
-
"forge-naming": async () => (await import("@warpgogol/forge/os/naming-module")).forgeNamingModule,
|
|
184
|
-
"forge-workflow": async () => (await import("@warpgogol/forge/os/workflow-module")).forgeWorkflowModule,
|
|
185
|
-
"forge-session": async () => (await import("@warpgogol/forge/os/session-module")).forgeSessionModule,
|
|
186
|
-
"forge-mission": async () => (await import("@warpgogol/forge/os/mission-module")).forgeMissionModule,
|
|
187
|
-
"forge-spec": async () => (await import("@warpgogol/forge/os/spec-module")).forgeSpecModule,
|
|
188
|
-
"forge-exploration": async () => (await import("@warpgogol/forge/os/exploration")).forgeExplorationModule,
|
|
189
|
-
"forge-program": async () => (await import("@warpgogol/forge/os/program")).forgeProgramModule,
|
|
190
|
-
"forge-werkstatt": async () => (await import("@warpgogol/forge/os/werkstatt")).forgeWerkstattModule,
|
|
178
|
+
// Forge governance modules — single-sourced in
|
|
179
|
+
// @warpgogol/werkstatt-engine/kernel/module-map (WORKSHOP_MODULE_MAP.forge).
|
|
180
|
+
// Do not add forge loaders here; new forge modules join the map once.
|
|
181
|
+
...forgeModuleLoaders(),
|
|
191
182
|
},
|
|
192
183
|
});
|
|
193
184
|
- path: .npmrc
|
package/profiles/godot-game.yaml
CHANGED
|
@@ -629,26 +629,17 @@ workspace:
|
|
|
629
629
|
- path: tools/kernel.config.ts
|
|
630
630
|
content: |
|
|
631
631
|
import { defineKernelConfig } from "@warpgogol/werkstatt-engine/kernel/types";
|
|
632
|
+
import { forgeModuleLoaders } from "@warpgogol/werkstatt-engine/kernel/module-map";
|
|
632
633
|
import { werkstattGodotPlugin } from "@warpgogol/werkstatt-godot-game";
|
|
633
634
|
|
|
634
635
|
export default defineKernelConfig({
|
|
635
636
|
name: "__PROJECT_NAME__",
|
|
636
637
|
description: "__PROJECT_NAME__ workshop",
|
|
637
638
|
moduleLoaders: {
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
"forge-audit": async () => (await import("@warpgogol/forge/os/audit-module")).forgeAuditModule,
|
|
643
|
-
"forge-compass": async () => (await import("@warpgogol/forge/os/compass")).forgeCompassModule,
|
|
644
|
-
"forge-naming": async () => (await import("@warpgogol/forge/os/naming-module")).forgeNamingModule,
|
|
645
|
-
"forge-workflow": async () => (await import("@warpgogol/forge/os/workflow-module")).forgeWorkflowModule,
|
|
646
|
-
"forge-session": async () => (await import("@warpgogol/forge/os/session-module")).forgeSessionModule,
|
|
647
|
-
"forge-mission": async () => (await import("@warpgogol/forge/os/mission-module")).forgeMissionModule,
|
|
648
|
-
"forge-spec": async () => (await import("@warpgogol/forge/os/spec-module")).forgeSpecModule,
|
|
649
|
-
"forge-exploration": async () => (await import("@warpgogol/forge/os/exploration")).forgeExplorationModule,
|
|
650
|
-
"forge-program": async () => (await import("@warpgogol/forge/os/program")).forgeProgramModule,
|
|
651
|
-
"forge-werkstatt": async () => (await import("@warpgogol/forge/os/werkstatt")).forgeWerkstattModule,
|
|
639
|
+
// Forge governance modules — single-sourced in
|
|
640
|
+
// @warpgogol/werkstatt-engine/kernel/module-map (WORKSHOP_MODULE_MAP.forge).
|
|
641
|
+
// Do not add forge loaders here; new forge modules join the map once.
|
|
642
|
+
...forgeModuleLoaders(),
|
|
652
643
|
mission: async () => (await import("@warpgogol/werkstatt-engine/mission-module")).createMissionModule(),
|
|
653
644
|
sternsystem: async () => (await import("@warpgogol/werkstatt-engine/sternsystem-module")).createSternsystemModule(),
|
|
654
645
|
bordbuch: async () => (await import("@warpgogol/werkstatt-engine/bordbuch-module")).createBordbuchModule(),
|
|
@@ -232,26 +232,17 @@ workspace:
|
|
|
232
232
|
- path: tools/kernel.config.ts
|
|
233
233
|
content: |
|
|
234
234
|
import { defineKernelConfig } from "@warpgogol/werkstatt-engine/kernel/types";
|
|
235
|
+
import { forgeModuleLoaders } from "@warpgogol/werkstatt-engine/kernel/module-map";
|
|
235
236
|
import { werkstattPhaserPlugin } from "@warpgogol/werkstatt-phaser-game";
|
|
236
237
|
|
|
237
238
|
export default defineKernelConfig({
|
|
238
239
|
name: "__PROJECT_NAME__",
|
|
239
240
|
description: "__PROJECT_NAME__ workshop",
|
|
240
241
|
moduleLoaders: {
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
"forge-audit": async () => (await import("@warpgogol/forge/os/audit-module")).forgeAuditModule,
|
|
246
|
-
"forge-compass": async () => (await import("@warpgogol/forge/os/compass")).forgeCompassModule,
|
|
247
|
-
"forge-naming": async () => (await import("@warpgogol/forge/os/naming-module")).forgeNamingModule,
|
|
248
|
-
"forge-workflow": async () => (await import("@warpgogol/forge/os/workflow-module")).forgeWorkflowModule,
|
|
249
|
-
"forge-session": async () => (await import("@warpgogol/forge/os/session-module")).forgeSessionModule,
|
|
250
|
-
"forge-mission": async () => (await import("@warpgogol/forge/os/mission-module")).forgeMissionModule,
|
|
251
|
-
"forge-spec": async () => (await import("@warpgogol/forge/os/spec-module")).forgeSpecModule,
|
|
252
|
-
"forge-exploration": async () => (await import("@warpgogol/forge/os/exploration")).forgeExplorationModule,
|
|
253
|
-
"forge-program": async () => (await import("@warpgogol/forge/os/program")).forgeProgramModule,
|
|
254
|
-
"forge-werkstatt": async () => (await import("@warpgogol/forge/os/werkstatt")).forgeWerkstattModule,
|
|
242
|
+
// Forge governance modules — single-sourced in
|
|
243
|
+
// @warpgogol/werkstatt-engine/kernel/module-map (WORKSHOP_MODULE_MAP.forge).
|
|
244
|
+
// Do not add forge loaders here; new forge modules join the map once.
|
|
245
|
+
...forgeModuleLoaders(),
|
|
255
246
|
mission: async () => (await import("@warpgogol/werkstatt-engine/mission-module")).createMissionModule(),
|
|
256
247
|
sternsystem: async () => (await import("@warpgogol/werkstatt-engine/sternsystem-module")).createSternsystemModule(),
|
|
257
248
|
bordbuch: async () => (await import("@warpgogol/werkstatt-engine/bordbuch-module")).createBordbuchModule(),
|
package/profiles/typescript.yaml
CHANGED
|
@@ -462,25 +462,16 @@ workspace:
|
|
|
462
462
|
- path: tools/kernel.config.ts
|
|
463
463
|
content: |
|
|
464
464
|
import { defineKernelConfig } from "@warpgogol/werkstatt-engine/kernel/types";
|
|
465
|
+
import { forgeModuleLoaders } from "@warpgogol/werkstatt-engine/kernel/module-map";
|
|
465
466
|
|
|
466
467
|
export default defineKernelConfig({
|
|
467
468
|
name: "__PROJECT_NAME__",
|
|
468
469
|
description: "__PROJECT_NAME__ TypeScript TurboRepo workshop",
|
|
469
470
|
moduleLoaders: {
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
"forge-audit": async () => (await import("@warpgogol/forge/os/audit-module")).forgeAuditModule,
|
|
475
|
-
"forge-compass": async () => (await import("@warpgogol/forge/os/compass")).forgeCompassModule,
|
|
476
|
-
"forge-naming": async () => (await import("@warpgogol/forge/os/naming-module")).forgeNamingModule,
|
|
477
|
-
"forge-workflow": async () => (await import("@warpgogol/forge/os/workflow-module")).forgeWorkflowModule,
|
|
478
|
-
"forge-session": async () => (await import("@warpgogol/forge/os/session-module")).forgeSessionModule,
|
|
479
|
-
"forge-mission": async () => (await import("@warpgogol/forge/os/mission-module")).forgeMissionModule,
|
|
480
|
-
"forge-spec": async () => (await import("@warpgogol/forge/os/spec-module")).forgeSpecModule,
|
|
481
|
-
"forge-exploration": async () => (await import("@warpgogol/forge/os/exploration")).forgeExplorationModule,
|
|
482
|
-
"forge-program": async () => (await import("@warpgogol/forge/os/program")).forgeProgramModule,
|
|
483
|
-
"forge-werkstatt": async () => (await import("@warpgogol/forge/os/werkstatt")).forgeWerkstattModule,
|
|
471
|
+
// Forge governance modules — single-sourced in
|
|
472
|
+
// @warpgogol/werkstatt-engine/kernel/module-map (WORKSHOP_MODULE_MAP.forge).
|
|
473
|
+
// Do not add forge loaders here; new forge modules join the map once.
|
|
474
|
+
...forgeModuleLoaders(),
|
|
484
475
|
"typescript-checks": async () => (await import("@warpgogol/werkstatt-typescript/checks/module")).createTypescriptCheckModule(),
|
|
485
476
|
},
|
|
486
477
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: fo-handoff
|
|
3
|
-
description: Compact the
|
|
3
|
+
description: Compact the conversation into a handoff document for another agent. Saves to docs/handoffs/ (paths.handoffsDir) and commits via the project's commit command (ecosystem.commit where registered).
|
|
4
4
|
invocation: user
|
|
5
5
|
category: fo
|
|
6
6
|
concerns: document-only
|
|
@@ -11,7 +11,7 @@ triggerPhrases: ["create a handoff document", "compact conversation for next age
|
|
|
11
11
|
|
|
12
12
|
<!--
|
|
13
13
|
<MODULE_CONTRACT>
|
|
14
|
-
<purpose>fo-handoff skill — Compact the current conversation into a handoff document for another agent to pick up. Saves to docs/handoffs/ (resolved from forge.yaml paths.handoffsDir) and commits via ecosystem.commit.</purpose>
|
|
14
|
+
<purpose>fo-handoff skill — Compact the current conversation into a handoff document for another agent to pick up. Saves to docs/handoffs/ (resolved from forge.yaml paths.handoffsDir) and commits via the project's commit command (ecosystem.commit where registered).</purpose>
|
|
15
15
|
<non-goals>
|
|
16
16
|
<item>Do not execute skill logic — this document instructs agents; it is not runnable code.</item>
|
|
17
17
|
</non-goals>
|
|
@@ -20,6 +20,7 @@ triggerPhrases: ["create a handoff document", "compact conversation for next age
|
|
|
20
20
|
<item>RFC-1097: sweep — SKILL.md headers + classification fixes
|
|
21
21
|
|
|
22
22
|
Sweep batch 1: add Compass v2 headers to 45 SKILL.md files (purpose derived from frontmatter description). Fix non-skill-markdown exclusion to check filename not workspace-relative path (packages/AGENTS.md escaped it). Add .coverage to ignoredDirs.</item>
|
|
23
|
+
<item>fix: commit references resolve by project type — ecosystem.commit where registered, plain git commit in forge workshops</item>
|
|
23
24
|
</CHANGE_SUMMARY>
|
|
24
25
|
-->
|
|
25
26
|
|
|
@@ -69,7 +70,7 @@ If the operator passed arguments, treat them as a description of what the next s
|
|
|
69
70
|
|
|
70
71
|
### 4. Commit
|
|
71
72
|
|
|
72
|
-
Commit the handoff document so it survives stash operations and is available to the next session. Delegate the commit mechanics to `fo-step-commit` (it resolves the project's commit command and staging rules); where the project has no such skill, use
|
|
73
|
+
Commit the handoff document so it survives stash operations and is available to the next session. Delegate the commit mechanics to `fo-step-commit` (it resolves the project's commit command and staging rules); where the project has no such skill, use the commit command the project declares — `ecosystem.commit` where it is registered, plain `git commit` otherwise.
|
|
73
74
|
|
|
74
75
|
### 5. Report
|
|
75
76
|
|
|
@@ -78,7 +79,7 @@ Tell the operator the absolute path of the handoff document and suggest opening
|
|
|
78
79
|
## Constraints
|
|
79
80
|
|
|
80
81
|
- **Save to `docs/handoffs/`** (or the directory resolved from `forge.yaml` `paths.handoffsDir`). Never save to `/tmp/` or other temporary directories.
|
|
81
|
-
- **Commit the handoff document** after saving (via `fo-step-commit` or the project's ecosystem commit
|
|
82
|
+
- **Commit the handoff document** after saving (via `fo-step-commit` or the project's commit command — `ecosystem.commit` where registered, `git commit` otherwise).
|
|
82
83
|
- **Do not duplicate existing artifacts.** Reference them by path or URL.
|
|
83
84
|
- **Redact sensitive information.** API keys, passwords, PII.
|
|
84
85
|
- **Stage only the handoff file.** See `_shared/fo-pipeline-conventions.md` §Commit discipline.
|
|
@@ -28,6 +28,7 @@ triggerPhrases:
|
|
|
28
28
|
|
|
29
29
|
Sweep batch 1: add Compass v2 headers to 45 SKILL.md files (purpose derived from frontmatter description). Fix non-skill-markdown exclusion to check filename not workspace-relative path (packages/AGENTS.md escaped it). Add .coverage to ignoredDirs.</item>
|
|
30
30
|
<item>RFC-1247: triggerPhrases vocabulary sync — mined operator phrasing applied to this skill's trigger set.</item>
|
|
31
|
+
<item>fix: step 5 resolves the commit path by project type — plain git commit in forge workshops where ecosystem.commit is not registered</item>
|
|
31
32
|
</CHANGE_SUMMARY>
|
|
32
33
|
-->
|
|
33
34
|
|
|
@@ -50,7 +51,9 @@ After every standalone operator request that produces file changes, perform the
|
|
|
50
51
|
2. **Verify diff before staging.** Run `git diff` (not just `git diff --cached`) on every file the agent touched in this request, in each dirty tree. Confirm the changes are the agent's own work and not foreign changes from another session. If foreign changes are found, exclude them from staging.
|
|
51
52
|
3. **Stage only agent-changed files.** Stage only the files the agent modified in this request. Never use `git add -A` or `git add .` — another agent or session may have unrelated changes in the working tree. Stage files by explicit path: `git add <path1> <path2> ...`.
|
|
52
53
|
4. **Form commit message.** Write a conventional commit message (`fix:`, `feat:`, `refactor:`, `docs:`, `chore:`) based on the work performed in this request. The agent determines the type and description from the context of the request.
|
|
53
|
-
5. **Commit in monorepo.**
|
|
54
|
+
5. **Commit in monorepo.** Pick the commit path by project type:
|
|
55
|
+
- **`ecosystem.commit` projects** — the Werkstatt platform monorepo and site-workshops that load the site check module (detect: `packages/werkstatt-site/` or `node_modules/@warpgogol/werkstatt-site/` exists): use `pnpm exec werkstatt run ecosystem.commit --message "<message>"`. It handles platform-scope version bumps and X-Platform-Bump trailers automatically. Stage files with `git add <paths>` first (the pre-commit hook blocks raw `git commit` for platform-scope files). For non-platform-only changes (docs/**), `ecosystem.commit` delegates to a plain `git commit` without version bump.
|
|
56
|
+
- **Forge workshops without `ecosystem.commit`** (no `werkstatt-site` in dependencies — typescript/forge-shell/knowledge profiles): run plain `git commit -m "<message>"` on the staged paths. No platform-scope gate applies.
|
|
54
57
|
6. **Commit in mission workpiece (if applicable).** If the agent changed files in the active mission workpiece, commit there via `git commit` in the workpiece directory.
|
|
55
58
|
7. **Verify clean trees.** After all commits, run `bash scripts/check-clean-trees.sh` again. If any tree is still dirty, report to the operator.
|
|
56
59
|
|
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
</non-goals>
|
|
8
8
|
</MODULE_CONTRACT>
|
|
9
9
|
<CHANGE_SUMMARY>
|
|
10
|
-
<item>RFC-0643: terminology substitution on final content, root template selection by register, details field in result.</item>
|
|
11
10
|
<item>RFC-0664: added project memory layer read discipline section to generated AGENTS.md.</item>
|
|
12
11
|
<item>RFC-1253: emit "Semantic layer — read first" block listing bound paths.compassDocs before the Skills table when the binding resolves non-empty.</item>
|
|
13
12
|
<item>RFC-1097: step 6 — compass.migrate codemod run
|
|
@@ -16,7 +15,8 @@ Mechanical v1 to v2 header migration across the workspace: 942 files rewritten
|
|
|
16
15
|
<item>RFC-1097: sweep — packages/forge + services clean
|
|
17
16
|
|
|
18
17
|
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>
|
|
19
|
-
<
|
|
18
|
+
<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
|
+
<history>RFC-0391, RFC-0393, RFC-0548, RFC-0549, RFC-0551, RFC-0611, RFC-0640, RFC-0643</history>
|
|
20
20
|
</CHANGE_SUMMARY>
|
|
21
21
|
*/
|
|
22
22
|
|
|
@@ -29,9 +29,8 @@ 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 {
|
|
32
|
+
import { resolveWorkspaceTypes } from "./workspace-discovery.ts";
|
|
33
33
|
import type { StackProfile } from "../profiles/stack-profile.ts";
|
|
34
|
-
import type { ProfileWorkspaceType } from "../profiles/profile-schema.ts";
|
|
35
34
|
import type {
|
|
36
35
|
ForgeCommandInput,
|
|
37
36
|
ForgeCommandResult,
|
|
@@ -408,8 +407,9 @@ export async function runAgentsGenerate(
|
|
|
408
407
|
const dynamicSections = dynamicLines.join("\n");
|
|
409
408
|
let content = replaceProjectPlaceholders(rootTemplate, config, dynamicSections);
|
|
410
409
|
|
|
411
|
-
// Prepend generated header (above template content)
|
|
412
|
-
|
|
410
|
+
// Prepend generated header (above template content) — header ends in a
|
|
411
|
+
// newline, so a single "\n" here yields the prettier-normal one blank line.
|
|
412
|
+
content = header + "\n" + content;
|
|
413
413
|
|
|
414
414
|
// RFC-0643: Apply terminology substitution on final assembled content
|
|
415
415
|
const resolvedTerminology = resolveAllTerminology(config, profile);
|
|
@@ -466,26 +466,15 @@ export async function runAgentsGenerate(
|
|
|
466
466
|
}
|
|
467
467
|
|
|
468
468
|
// Nested AGENTS.md generation (RFC-0611)
|
|
469
|
-
// RFC-0640:
|
|
470
|
-
//
|
|
471
|
-
let
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
}
|
|
475
|
-
|
|
476
|
-
const forgeRoot = resolveForgeRoot(workspaceRoot);
|
|
477
|
-
const profiles = listStackProfiles(forgeRoot);
|
|
478
|
-
for (const stackId of config.project.stack) {
|
|
479
|
-
const stackProfile = profiles.find((p) => p.id === stackId);
|
|
480
|
-
if (stackProfile?.workspaceTypes && stackProfile.workspaceTypes.length > 0) {
|
|
481
|
-
workspaceTypes = stackProfile.workspaceTypes;
|
|
482
|
-
break;
|
|
483
|
-
}
|
|
484
|
-
}
|
|
485
|
-
} catch {
|
|
486
|
-
// forge root not resolvable — fallback to hardcoded detection
|
|
487
|
-
}
|
|
469
|
+
// RFC-0640/RFC-0643: resolveWorkspaceTypes prefers config.profile (loaded by
|
|
470
|
+
// loadForgeConfig), falls back to the stack-based catalog lookup.
|
|
471
|
+
let forgeRootForTypes: string | undefined;
|
|
472
|
+
try {
|
|
473
|
+
forgeRootForTypes = resolveForgeRoot(workspaceRoot);
|
|
474
|
+
} catch {
|
|
475
|
+
// forge root not resolvable — fallback to hardcoded detection
|
|
488
476
|
}
|
|
477
|
+
const workspaceTypes = resolveWorkspaceTypes(config, forgeRootForTypes);
|
|
489
478
|
const nestedResult = await generateNestedAgentsMd(workspaceRoot, config, dryRun, workspaceTypes, fio);
|
|
490
479
|
generated.push(...nestedResult.generated);
|
|
491
480
|
skipped.push(...nestedResult.skipped);
|
package/src/onboarding/doctor.ts
CHANGED
|
@@ -8,16 +8,14 @@ Checks for forge.yaml, AGENTS.md, PREFERENCES.md, .agents/skills/, docs/rfcs/,
|
|
|
8
8
|
</non-goals>
|
|
9
9
|
</MODULE_CONTRACT>
|
|
10
10
|
<CHANGE_SUMMARY>
|
|
11
|
-
<item>RFC-1097: step 6 — compass.migrate codemod run
|
|
12
|
-
|
|
13
|
-
Mechanical v1 to v2 header migration across the workspace: 942 files rewritten — CHANGE_SUMMARY windows collapsed into history, forbidden v1 blocks stripped, KEY_DECISIONS seeded from @ai-invariant comments (5 files) or TODO placeholders (103 files), blocks reordered to canonical order.</item>
|
|
14
11
|
<item>RFC-1097: sweep — packages/forge + services clean
|
|
15
12
|
|
|
16
13
|
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>
|
|
17
14
|
<item>RFC-1224: preserve operator forge.yaml content on upgrade, promote adrImplementStamp binding</item>
|
|
18
15
|
<item>RFC-1226: skills-unmanaged check — warn on SKILL.md-bearing dirs without .forge-managed marker</item>
|
|
19
16
|
<item>RFC-1249: wire werkstatt.commands.validate into packages.check + retire CMD-OUTPUT debt</item>
|
|
20
|
-
<
|
|
17
|
+
<item>forge-version-sync check — warns when the installed @warpgogol/forge version diverges from forge.yaml syncedVersion (pnpm up drifts it silently); nested wsTypes resolution moved to shared resolveWorkspaceTypes.</item>
|
|
18
|
+
<history>RFC-0391, RFC-0393, RFC-0524, RFC-0539, RFC-0540, RFC-0611, RFC-0640, RFC-0660, RFC-0661, RFC-0663, RFC-0664, RFC-0675, RFC-0704, RFC-0941, RFC-1097, RFC-1224</history>
|
|
21
19
|
</CHANGE_SUMMARY>
|
|
22
20
|
*/
|
|
23
21
|
|
|
@@ -35,7 +33,7 @@ import type {
|
|
|
35
33
|
} from "../types.ts";
|
|
36
34
|
import { resolveForgeRoot, loadForgeConfig, resolveBinding, resolveTerminology, FORGE_CLI_BINDING_DEFAULTS, resolvePmRunner } from "../config/forge-config.ts";
|
|
37
35
|
import { FORGE_SKILLS, discoverPackSkills } from "../registry.ts";
|
|
38
|
-
import { discoverWorkspaces } from "./workspace-discovery.ts";
|
|
36
|
+
import { discoverWorkspaces, resolveWorkspaceTypes } from "./workspace-discovery.ts";
|
|
39
37
|
import { buildNestedAgentsMd, selectNestedTemplate } from "./nested-agents-templates.ts";
|
|
40
38
|
import { readPackageInfo, generateNestedAgentsMd } from "./nested-agents-generate.ts";
|
|
41
39
|
import { listStackProfiles, type StackProfile } from "../profiles/stack-profile.ts";
|
|
@@ -876,6 +874,66 @@ async function checkPackManifests(workspaceRoot: string, _io: WorkspaceIO): Prom
|
|
|
876
874
|
};
|
|
877
875
|
}
|
|
878
876
|
|
|
877
|
+
// ---------------------------------------------------------------------------
|
|
878
|
+
// Forge version sync — installed package vs forge.yaml syncedVersion
|
|
879
|
+
// ---------------------------------------------------------------------------
|
|
880
|
+
|
|
881
|
+
/**
|
|
882
|
+
* `pnpm up`/`npm update` bumps the installed @warpgogol/forge package but never
|
|
883
|
+
* touches forge.yaml — syncedVersion goes stale silently and the next
|
|
884
|
+
* `forge.upgrade` (or stale-skill sync) runs against a wrong baseline. Warn so
|
|
885
|
+
* the drift surfaces; pass when either side is unreadable (first init,
|
|
886
|
+
* source checkout without forge.yaml).
|
|
887
|
+
*/
|
|
888
|
+
function checkForgeVersionSync(workspaceRoot: string, forgeRoot: string): DoctorCheck {
|
|
889
|
+
let config;
|
|
890
|
+
try {
|
|
891
|
+
config = loadForgeConfig(workspaceRoot);
|
|
892
|
+
} catch {
|
|
893
|
+
return {
|
|
894
|
+
name: "forge-version-sync",
|
|
895
|
+
status: "pass",
|
|
896
|
+
message: "forge.yaml not loadable — version sync check skipped",
|
|
897
|
+
};
|
|
898
|
+
}
|
|
899
|
+
|
|
900
|
+
const synced = config.forge?.syncedVersion ?? null;
|
|
901
|
+
if (synced === null) {
|
|
902
|
+
return {
|
|
903
|
+
name: "forge-version-sync",
|
|
904
|
+
status: "pass",
|
|
905
|
+
message: "no syncedVersion recorded — version sync check skipped",
|
|
906
|
+
};
|
|
907
|
+
}
|
|
908
|
+
|
|
909
|
+
let installed: string | null = null;
|
|
910
|
+
try {
|
|
911
|
+
const pkg = JSON.parse(readFileSync(join(forgeRoot, "package.json"), "utf8")) as {
|
|
912
|
+
version?: unknown;
|
|
913
|
+
};
|
|
914
|
+
if (typeof pkg.version === "string") installed = pkg.version;
|
|
915
|
+
} catch {
|
|
916
|
+
// package.json unreadable — treated as unresolvable below
|
|
917
|
+
}
|
|
918
|
+
|
|
919
|
+
if (installed === null) {
|
|
920
|
+
return {
|
|
921
|
+
name: "forge-version-sync",
|
|
922
|
+
status: "pass",
|
|
923
|
+
message: "installed forge version unreadable — version sync check skipped",
|
|
924
|
+
};
|
|
925
|
+
}
|
|
926
|
+
|
|
927
|
+
const inSync = installed === synced;
|
|
928
|
+
return {
|
|
929
|
+
name: "forge-version-sync",
|
|
930
|
+
status: inSync ? "pass" : "warn",
|
|
931
|
+
message: inSync
|
|
932
|
+
? `syncedVersion matches installed v${installed}`
|
|
933
|
+
: `installed @warpgogol/forge v${installed} ≠ forge.yaml syncedVersion ${synced} — run 'forge upgrade'`,
|
|
934
|
+
};
|
|
935
|
+
}
|
|
936
|
+
|
|
879
937
|
// ---------------------------------------------------------------------------
|
|
880
938
|
// Nested AGENTS.md diagnostics (RFC-0611)
|
|
881
939
|
// ---------------------------------------------------------------------------
|
|
@@ -1484,6 +1542,10 @@ export async function runDoctor(
|
|
|
1484
1542
|
: `Bindings: ${bindingsResult.invalid.length} invalid — ${bindingsResult.invalid.join(", ")}`,
|
|
1485
1543
|
});
|
|
1486
1544
|
|
|
1545
|
+
// Installed forge version vs forge.yaml syncedVersion — `pnpm up` bumps the
|
|
1546
|
+
// package without running forge.upgrade, leaving syncedVersion stale.
|
|
1547
|
+
checks.push(checkForgeVersionSync(workspaceRoot, forgeRoot));
|
|
1548
|
+
|
|
1487
1549
|
// Check stale knowledge files (RFC-0524, RFC-0539)
|
|
1488
1550
|
const staleCheck = await checkStaleKnowledgeFiles(workspaceRoot, forgeRoot, fio);
|
|
1489
1551
|
checks.push(staleCheck);
|
|
@@ -1531,28 +1593,14 @@ export async function runDoctor(
|
|
|
1531
1593
|
// entirely for non-software domains. Now runs for all domains — profile-driven
|
|
1532
1594
|
// wsTypes replace hardcoded detection when present.
|
|
1533
1595
|
let wsTypes: ProfileWorkspaceType[] | undefined;
|
|
1534
|
-
{
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
} else {
|
|
1541
|
-
const profiles = listStackProfiles(forgeRoot);
|
|
1542
|
-
for (const stackId of config.project.stack) {
|
|
1543
|
-
const profile = profiles.find((p) => p.id === stackId);
|
|
1544
|
-
if (profile?.workspaceTypes && profile.workspaceTypes.length > 0) {
|
|
1545
|
-
wsTypes = profile.workspaceTypes;
|
|
1546
|
-
break;
|
|
1547
|
-
}
|
|
1548
|
-
}
|
|
1549
|
-
}
|
|
1550
|
-
} catch {
|
|
1551
|
-
// profiles not loadable
|
|
1552
|
-
}
|
|
1553
|
-
const nestedCheck = await checkNestedAgentsMd(workspaceRoot, wsTypes, fio);
|
|
1554
|
-
checks.push(nestedCheck);
|
|
1596
|
+
try {
|
|
1597
|
+
// RFC-0643: resolveWorkspaceTypes prefers config.profile (loaded by
|
|
1598
|
+
// loadForgeConfig), falls back to the stack-based catalog lookup.
|
|
1599
|
+
wsTypes = resolveWorkspaceTypes(loadForgeConfig(workspaceRoot), forgeRoot);
|
|
1600
|
+
} catch {
|
|
1601
|
+
// config/profiles not loadable — nested check runs without profile types
|
|
1555
1602
|
}
|
|
1603
|
+
checks.push(await checkNestedAgentsMd(workspaceRoot, wsTypes, fio));
|
|
1556
1604
|
|
|
1557
1605
|
// RFC-0640: --strict flag elevates warn to fail for domain-related checks
|
|
1558
1606
|
const finalChecks = strict
|
package/src/onboarding/init.ts
CHANGED
|
@@ -7,16 +7,16 @@
|
|
|
7
7
|
</non-goals>
|
|
8
8
|
</MODULE_CONTRACT>
|
|
9
9
|
<CHANGE_SUMMARY>
|
|
10
|
-
<item>RFC-0663: added syncSharedKnowledge step to sync shared knowledge layer to .agents/skills/shared-knowledge/.</item>
|
|
11
|
-
<item>RFC-0941: create forge.plugin.yaml manifests for skill packs that lack them before calling discoverPackSkills.</item>
|
|
12
10
|
<item>RFC-1019: extend PREFERENCES.md with formOfAddress, session-end protocol, skill invocation tracking, plan confirmation vs implementation, commit granularity rules.</item>
|
|
11
|
+
<item>fix: copy skills/_shared/ convention docs to .agents/skills/_shared/ on init — fo-* SKILL.md references dangled without it</item>
|
|
13
12
|
<item>RFC-1097: step 6 — compass.migrate codemod run
|
|
14
13
|
|
|
15
14
|
Mechanical v1 to v2 header migration across the workspace: 942 files rewritten — CHANGE_SUMMARY windows collapsed into history, forbidden v1 blocks stripped, KEY_DECISIONS seeded from @ai-invariant comments (5 files) or TODO placeholders (103 files), blocks reordered to canonical order.</item>
|
|
16
15
|
<item>RFC-1097: sweep — packages/forge + services clean
|
|
17
16
|
|
|
18
17
|
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>
|
|
19
|
-
<
|
|
18
|
+
<item>Prettierignore plan on init now enumerates generated AGENTS.md paths (workspace types resolved via shared resolveWorkspaceTypes).</item>
|
|
19
|
+
<history>RFC-0374, RFC-0391, RFC-0392, RFC-0393, RFC-0524, RFC-0539, RFC-0543, RFC-0544, RFC-0552, RFC-0640, RFC-0643, RFC-0663, RFC-0941</history>
|
|
20
20
|
</CHANGE_SUMMARY>
|
|
21
21
|
*/
|
|
22
22
|
|
|
@@ -27,6 +27,7 @@ import { FORGE_SKILLS, discoverPackSkills } from "../registry.ts";
|
|
|
27
27
|
import { syncKnowledgeFile } from "../knowledge/index.ts";
|
|
28
28
|
import { writeSkillMarkerSync } from "./skill-markers.ts";
|
|
29
29
|
import { planPrettierignoreSync, applyPrettierignoreSync } from "./prettierignore.ts";
|
|
30
|
+
import { resolveWorkspaceTypes } from "./workspace-discovery.ts";
|
|
30
31
|
import { defaultForgeConfig, loadForgeConfig, resolveForgeRoot, type ForgeConfig } from "../config/forge-config.ts";
|
|
31
32
|
import { listStackProfiles, detectStack } from "../profiles/stack-profile.ts";
|
|
32
33
|
|
|
@@ -418,13 +419,43 @@ export function runInit(
|
|
|
418
419
|
);
|
|
419
420
|
}
|
|
420
421
|
|
|
422
|
+
// Sync skills/_shared/ convention docs to .agents/skills/_shared/ — fo-*
|
|
423
|
+
// SKILL.md files link these by relative path. Verbatim copy, forge-managed
|
|
424
|
+
// via marker (mirrors the upgrade-path syncSharedConventions step).
|
|
425
|
+
const sharedConvSrc = path.join(forgeRoot, "skills", "_shared");
|
|
426
|
+
if (fs.existsSync(sharedConvSrc)) {
|
|
427
|
+
const sharedConvDestDir = path.join(agentsSkillsDir, "_shared");
|
|
428
|
+
fs.mkdirSync(sharedConvDestDir, { recursive: true });
|
|
429
|
+
const sharedFiles: string[] = [];
|
|
430
|
+
const walk = (dir: string, prefix: string): void => {
|
|
431
|
+
for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
|
|
432
|
+
const rel = prefix ? `${prefix}/${entry.name}` : entry.name;
|
|
433
|
+
if (entry.isDirectory()) {
|
|
434
|
+
walk(path.join(dir, entry.name), rel);
|
|
435
|
+
} else {
|
|
436
|
+
sharedFiles.push(rel);
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
};
|
|
440
|
+
walk(sharedConvSrc, "");
|
|
441
|
+
for (const rel of sharedFiles) {
|
|
442
|
+
fs.mkdirSync(path.dirname(path.join(sharedConvDestDir, rel)), { recursive: true });
|
|
443
|
+
fs.copyFileSync(path.join(sharedConvSrc, rel), path.join(sharedConvDestDir, rel));
|
|
444
|
+
created.push(`${config.paths.skillsDir}/_shared/${rel}`);
|
|
445
|
+
}
|
|
446
|
+
writeSkillMarkerSync(sharedConvDestDir, sharedFiles);
|
|
447
|
+
}
|
|
448
|
+
|
|
421
449
|
// RFC-1154: reconcile the forge-managed .prettierignore block (prettier
|
|
422
450
|
// consumers only; additive + idempotent, no-op otherwise). Non-fatal —
|
|
423
451
|
// a prettierignore write failure must not fail init.
|
|
424
452
|
try {
|
|
425
453
|
applyPrettierignoreSync(
|
|
426
454
|
workspaceRoot,
|
|
427
|
-
planPrettierignoreSync(workspaceRoot, config.paths.skillsDir
|
|
455
|
+
planPrettierignoreSync(workspaceRoot, config.paths.skillsDir, {
|
|
456
|
+
workspaceTypes: resolveWorkspaceTypes(config, forgeRoot),
|
|
457
|
+
workspaceSkipDirs: config.bindings?.workspaces?.skipDirs,
|
|
458
|
+
}),
|
|
428
459
|
);
|
|
429
460
|
} catch (err) {
|
|
430
461
|
errors.push(`.prettierignore reconcile failed: ${(err as Error).message}`);
|
|
@@ -16,6 +16,7 @@ Mechanical v1 to v2 header migration across the workspace: 942 files rewritten
|
|
|
16
16
|
<item>RFC-1097: sweep — werkstatt-engine clean
|
|
17
17
|
|
|
18
18
|
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
|
+
<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
20
|
</CHANGE_SUMMARY>
|
|
20
21
|
*/
|
|
21
22
|
|
|
@@ -199,7 +200,6 @@ export function buildNestedAgentsMd(
|
|
|
199
200
|
|
|
200
201
|
const lines: string[] = [];
|
|
201
202
|
lines.push(header);
|
|
202
|
-
lines.push("");
|
|
203
203
|
|
|
204
204
|
const displayName = packageInfo?.name ?? workspace.path;
|
|
205
205
|
lines.push(`# \`${displayName}\` — Agent Guide`);
|
|
@@ -21,6 +21,7 @@ operator-owned.
|
|
|
21
21
|
</MODULE_CONTRACT>
|
|
22
22
|
<CHANGE_SUMMARY>
|
|
23
23
|
<item>RFC-1154: initial implementation — plan/apply + delimited-block reconcile.</item>
|
|
24
|
+
<item>Enumerate generated AGENTS.md paths (root + nested workspaces via discoverWorkspaces) in the managed block — prettier normalization byte-diverges from the generator render and trips doctor's stale check on every format-on-commit.</item>
|
|
24
25
|
</CHANGE_SUMMARY>
|
|
25
26
|
*/
|
|
26
27
|
|
|
@@ -31,6 +32,9 @@ import { writeFileIfChanged } from "../utils/fs-idempotent.ts";
|
|
|
31
32
|
import { fileExists } from "../utils/fs.ts";
|
|
32
33
|
import * as sfs from "../utils/sync-fs.ts";
|
|
33
34
|
import { SKILL_MARKER_FILE } from "./skill-markers.ts";
|
|
35
|
+
import { discoverWorkspaces } from "./workspace-discovery.ts";
|
|
36
|
+
import { hasGeneratedMarker } from "../utils/index.ts";
|
|
37
|
+
import type { ProfileWorkspaceType } from "../profiles/profile-schema.ts";
|
|
34
38
|
|
|
35
39
|
export const PRETTIERIGNORE_BLOCK_BEGIN = "# forge-managed generated paths (RFC-1154)";
|
|
36
40
|
export const PRETTIERIGNORE_BLOCK_END = "# end forge-managed";
|
|
@@ -65,6 +69,12 @@ export interface PrettierignorePlan {
|
|
|
65
69
|
fileExists: boolean;
|
|
66
70
|
}
|
|
67
71
|
|
|
72
|
+
/** Optional discovery inputs for generated-AGENTS.md enumeration. */
|
|
73
|
+
export interface PrettierignorePlanOptions {
|
|
74
|
+
workspaceTypes?: ProfileWorkspaceType[];
|
|
75
|
+
workspaceSkipDirs?: readonly string[];
|
|
76
|
+
}
|
|
77
|
+
|
|
68
78
|
export type PrettierignoreResult = "written" | "updated" | "unchanged" | "skipped";
|
|
69
79
|
|
|
70
80
|
function packageJsonUsesPrettier(pkg: Record<string, unknown>): boolean {
|
|
@@ -153,19 +163,50 @@ function listManagedSkillEntriesSync(workspaceRoot: string, skillsDirRel: string
|
|
|
153
163
|
return entries.sort();
|
|
154
164
|
}
|
|
155
165
|
|
|
166
|
+
/**
|
|
167
|
+
* Generated AGENTS.md paths — root file plus per-workspace nested guides.
|
|
168
|
+
* Only marker-bearing files are listed: generated AGENTS.md is forge-owned
|
|
169
|
+
* head + operator tail (RFC-1153), and prettier normalization in the head
|
|
170
|
+
* (blank-line collapse, table realign) byte-diverges from the generator's
|
|
171
|
+
* render, tripping doctor's stale check on every format-on-commit. Excluding
|
|
172
|
+
* them keeps the drift class out; hand-written AGENTS.md (no marker) stays
|
|
173
|
+
* operator-owned and prettier-covered.
|
|
174
|
+
*/
|
|
175
|
+
function listGeneratedAgentsMdEntries(
|
|
176
|
+
workspaceRoot: string,
|
|
177
|
+
opts: PrettierignorePlanOptions,
|
|
178
|
+
): string[] {
|
|
179
|
+
const entries: string[] = [];
|
|
180
|
+
try {
|
|
181
|
+
if (hasGeneratedMarker(sfs.readFileSync(path.join(workspaceRoot, "AGENTS.md"), "utf8"))) {
|
|
182
|
+
// Anchored — a bare "AGENTS.md" pattern matches at every depth and would
|
|
183
|
+
// also ignore hand-written nested guides.
|
|
184
|
+
entries.push("/AGENTS.md");
|
|
185
|
+
}
|
|
186
|
+
} catch {
|
|
187
|
+
// root AGENTS.md absent or unreadable
|
|
188
|
+
}
|
|
189
|
+
for (const ws of discoverWorkspaces(workspaceRoot, opts.workspaceTypes, opts.workspaceSkipDirs)) {
|
|
190
|
+
if (ws.isGenerated) entries.push(`${ws.path}/AGENTS.md`);
|
|
191
|
+
}
|
|
192
|
+
return entries.sort();
|
|
193
|
+
}
|
|
194
|
+
|
|
156
195
|
export async function planPrettierignore(
|
|
157
196
|
workspaceRoot: string,
|
|
158
197
|
skillsDirRel = ".agents/skills",
|
|
159
198
|
io?: WorkspaceIO,
|
|
199
|
+
opts: PrettierignorePlanOptions = {},
|
|
160
200
|
): Promise<PrettierignorePlan> {
|
|
161
201
|
const fio = resolveIo(io);
|
|
162
202
|
const applies = await detectPrettier(workspaceRoot, fio);
|
|
163
203
|
const skillEntries = applies
|
|
164
204
|
? await listManagedSkillEntries(workspaceRoot, skillsDirRel, fio)
|
|
165
205
|
: [];
|
|
206
|
+
const agentsMdEntries = applies ? listGeneratedAgentsMdEntries(workspaceRoot, opts) : [];
|
|
166
207
|
return {
|
|
167
208
|
applies,
|
|
168
|
-
entries: [...skillEntries, ...FIXED_ENTRIES],
|
|
209
|
+
entries: [...skillEntries, ...agentsMdEntries, ...FIXED_ENTRIES],
|
|
169
210
|
fileExists: await fileExists(path.join(workspaceRoot, ".prettierignore")),
|
|
170
211
|
};
|
|
171
212
|
}
|
|
@@ -174,12 +215,14 @@ export async function planPrettierignore(
|
|
|
174
215
|
export function planPrettierignoreSync(
|
|
175
216
|
workspaceRoot: string,
|
|
176
217
|
skillsDirRel = ".agents/skills",
|
|
218
|
+
opts: PrettierignorePlanOptions = {},
|
|
177
219
|
): PrettierignorePlan {
|
|
178
220
|
const applies = detectPrettierSync(workspaceRoot);
|
|
179
221
|
const skillEntries = applies ? listManagedSkillEntriesSync(workspaceRoot, skillsDirRel) : [];
|
|
222
|
+
const agentsMdEntries = applies ? listGeneratedAgentsMdEntries(workspaceRoot, opts) : [];
|
|
180
223
|
return {
|
|
181
224
|
applies,
|
|
182
|
-
entries: [...skillEntries, ...FIXED_ENTRIES],
|
|
225
|
+
entries: [...skillEntries, ...agentsMdEntries, ...FIXED_ENTRIES],
|
|
183
226
|
fileExists: sfs.existsSync(path.join(workspaceRoot, ".prettierignore")),
|
|
184
227
|
};
|
|
185
228
|
}
|