@warpgogol/forge 9.7.0 → 10.0.0
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/AGENTS.md +50 -27
- package/CHANGELOG.md +52 -0
- package/bin/cli.js +0 -0
- package/dist/os/adr/handlers/archive.d.ts.map +1 -1
- package/dist/os/adr/handlers/archive.js +3 -7
- package/dist/os/adr/handlers/archive.js.map +1 -1
- package/dist/os/adr/handlers/list-create.d.ts.map +1 -1
- package/dist/os/adr/handlers/list-create.js +8 -6
- package/dist/os/adr/handlers/list-create.js.map +1 -1
- package/dist/os/audit/handlers/archive.d.ts.map +1 -1
- package/dist/os/audit/handlers/archive.js +3 -7
- package/dist/os/audit/handlers/archive.js.map +1 -1
- package/dist/os/codebase/handlers/codebase-measure-symbols.d.ts.map +1 -1
- package/dist/os/codebase/handlers/codebase-measure-symbols.js +35 -4
- package/dist/os/codebase/handlers/codebase-measure-symbols.js.map +1 -1
- package/dist/os/core/archive-regen.d.ts +1 -0
- package/dist/os/core/archive-regen.d.ts.map +1 -1
- package/dist/os/core/archive-regen.js +31 -6
- package/dist/os/core/archive-regen.js.map +1 -1
- package/dist/os/core/core.module.d.ts.map +1 -1
- package/dist/os/core/core.module.js +6 -69
- package/dist/os/core/core.module.js.map +1 -1
- package/dist/os/core/handlers/assets-helpers.d.ts.map +1 -1
- package/dist/os/core/handlers/assets-helpers.js +2 -3
- package/dist/os/core/handlers/assets-helpers.js.map +1 -1
- package/dist/os/core/handlers/determinism-check.d.ts.map +1 -1
- package/dist/os/core/handlers/determinism-check.js +2 -3
- package/dist/os/core/handlers/determinism-check.js.map +1 -1
- package/dist/os/core/handlers/pinned-check.d.ts +13 -0
- package/dist/os/core/handlers/pinned-check.d.ts.map +1 -1
- package/dist/os/core/handlers/pinned-check.js +25 -0
- package/dist/os/core/handlers/pinned-check.js.map +1 -1
- package/dist/os/core/handlers/pinned-types.d.ts +7 -0
- package/dist/os/core/handlers/pinned-types.d.ts.map +1 -1
- package/dist/os/core/handlers/pinned-validate.d.ts.map +1 -1
- package/dist/os/core/handlers/pinned-validate.js +24 -1
- package/dist/os/core/handlers/pinned-validate.js.map +1 -1
- package/dist/os/core/handlers/release-prepare.d.ts.map +1 -1
- package/dist/os/core/handlers/release-prepare.js +2 -4
- package/dist/os/core/handlers/release-prepare.js.map +1 -1
- package/dist/os/flow/digest.d.ts +73 -1
- package/dist/os/flow/digest.d.ts.map +1 -1
- package/dist/os/flow/digest.js +344 -92
- package/dist/os/flow/digest.js.map +1 -1
- package/dist/os/flow/evidence-lock.d.ts +36 -0
- package/dist/os/flow/evidence-lock.d.ts.map +1 -0
- package/dist/os/flow/evidence-lock.js +156 -0
- package/dist/os/flow/evidence-lock.js.map +1 -0
- package/dist/os/flow/flow.module.d.ts.map +1 -1
- package/dist/os/flow/flow.module.js +36 -14
- package/dist/os/flow/flow.module.js.map +1 -1
- package/dist/os/flow/git.d.ts +50 -3
- package/dist/os/flow/git.d.ts.map +1 -1
- package/dist/os/flow/git.js +144 -12
- package/dist/os/flow/git.js.map +1 -1
- package/dist/os/flow/handlers/flow-digest.d.ts.map +1 -1
- package/dist/os/flow/handlers/flow-digest.js +3 -5
- package/dist/os/flow/handlers/flow-digest.js.map +1 -1
- package/dist/os/flow/handlers/flow-peers.js +1 -1
- package/dist/os/flow/handlers/flow-peers.js.map +1 -1
- package/dist/os/flow/handlers/flow-push.d.ts +81 -0
- package/dist/os/flow/handlers/flow-push.d.ts.map +1 -1
- package/dist/os/flow/handlers/flow-push.js +642 -138
- package/dist/os/flow/handlers/flow-push.js.map +1 -1
- package/dist/os/flow/locks.d.ts +8 -0
- package/dist/os/flow/locks.d.ts.map +1 -1
- package/dist/os/flow/locks.js +6 -3
- package/dist/os/flow/locks.js.map +1 -1
- package/dist/os/{mission → flow}/open-missions.d.ts +1 -2
- package/dist/os/flow/open-missions.d.ts.map +1 -0
- package/dist/os/flow/open-missions.js +37 -0
- package/dist/os/flow/open-missions.js.map +1 -0
- package/dist/os/flow/preflight.d.ts.map +1 -1
- package/dist/os/flow/preflight.js +5 -3
- package/dist/os/flow/preflight.js.map +1 -1
- package/dist/os/flow/registry.d.ts +9 -5
- package/dist/os/flow/registry.d.ts.map +1 -1
- package/dist/os/flow/registry.js +2 -2
- package/dist/os/flow/registry.js.map +1 -1
- package/dist/os/friction/friction.module.d.ts.map +1 -1
- package/dist/os/friction/friction.module.js +30 -5
- package/dist/os/friction/friction.module.js.map +1 -1
- package/dist/os/friction/handlers/friction-add.d.ts.map +1 -1
- package/dist/os/friction/handlers/friction-add.js +10 -17
- package/dist/os/friction/handlers/friction-add.js.map +1 -1
- package/dist/os/friction/handlers/friction-migrate.d.ts.map +1 -1
- package/dist/os/friction/handlers/friction-migrate.js +188 -2
- package/dist/os/friction/handlers/friction-migrate.js.map +1 -1
- package/dist/os/friction/store.d.ts +4 -0
- package/dist/os/friction/store.d.ts.map +1 -1
- package/dist/os/friction/store.js +20 -0
- package/dist/os/friction/store.js.map +1 -1
- package/dist/os/friction/types.d.ts +12 -0
- package/dist/os/friction/types.d.ts.map +1 -1
- package/dist/os/friction/types.js +8 -0
- package/dist/os/friction/types.js.map +1 -1
- package/dist/os/gate/handlers/gate-probe-catalog.d.ts.map +1 -1
- package/dist/os/gate/handlers/gate-probe-catalog.js +38 -5
- package/dist/os/gate/handlers/gate-probe-catalog.js.map +1 -1
- package/dist/os/plan/handlers/archive.d.ts.map +1 -1
- package/dist/os/plan/handlers/archive.js +3 -7
- package/dist/os/plan/handlers/archive.js.map +1 -1
- package/dist/os/rfc/handlers/archive.d.ts.map +1 -1
- package/dist/os/rfc/handlers/archive.js +3 -7
- package/dist/os/rfc/handlers/archive.js.map +1 -1
- package/dist/os/rfc/handlers/list-create.d.ts.map +1 -1
- package/dist/os/rfc/handlers/list-create.js +15 -7
- package/dist/os/rfc/handlers/list-create.js.map +1 -1
- package/dist/os/session/handlers/archive.d.ts.map +1 -1
- package/dist/os/session/handlers/archive.js +3 -7
- package/dist/os/session/handlers/archive.js.map +1 -1
- package/dist/os/system/handlers/system-product-register.d.ts +24 -0
- package/dist/os/system/handlers/system-product-register.d.ts.map +1 -0
- package/dist/os/system/handlers/system-product-register.js +322 -0
- package/dist/os/system/handlers/system-product-register.js.map +1 -0
- package/dist/os/system/handlers/system-products-status.d.ts +23 -0
- package/dist/os/system/handlers/system-products-status.d.ts.map +1 -0
- package/dist/os/system/handlers/system-products-status.js +235 -0
- package/dist/os/system/handlers/system-products-status.js.map +1 -0
- package/dist/os/system/schemas.d.ts +13 -0
- package/dist/os/system/schemas.d.ts.map +1 -1
- package/dist/os/system/schemas.js +15 -0
- package/dist/os/system/schemas.js.map +1 -1
- package/dist/os/system/system.module.d.ts.map +1 -1
- package/dist/os/system/system.module.js +113 -3
- package/dist/os/system/system.module.js.map +1 -1
- package/dist/src/command-modules.d.ts.map +1 -1
- package/dist/src/command-modules.js +0 -2
- package/dist/src/command-modules.js.map +1 -1
- package/dist/src/config/forge-config.d.ts +2 -0
- package/dist/src/config/forge-config.d.ts.map +1 -1
- package/dist/src/config/forge-config.js +11 -10
- package/dist/src/config/forge-config.js.map +1 -1
- package/dist/src/index.d.ts +0 -2
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +0 -2
- package/dist/src/index.js.map +1 -1
- package/dist/src/onboarding/create.d.ts.map +1 -1
- package/dist/src/onboarding/create.js +27 -2
- package/dist/src/onboarding/create.js.map +1 -1
- package/dist/src/onboarding/doctor.d.ts +0 -5
- package/dist/src/onboarding/doctor.d.ts.map +1 -1
- package/dist/src/onboarding/doctor.js +6 -79
- package/dist/src/onboarding/doctor.js.map +1 -1
- package/dist/src/onboarding/npm-token-check.d.ts +1 -1
- package/dist/src/onboarding/npm-token-check.d.ts.map +1 -1
- package/dist/src/onboarding/npm-token-check.js +2 -2
- package/dist/src/onboarding/npm-token-check.js.map +1 -1
- package/dist/src/profiles/stack-profile.js +2 -2
- package/dist/src/types.js +2 -2
- package/dist/src/utils/hash.d.ts +1 -0
- package/dist/src/utils/hash.d.ts.map +1 -1
- package/dist/src/utils/hash.js +4 -0
- package/dist/src/utils/hash.js.map +1 -1
- package/dist/{os/mission → src/utils}/lockfile.d.ts +1 -18
- package/dist/src/utils/lockfile.d.ts.map +1 -0
- package/dist/src/utils/lockfile.js +70 -0
- package/dist/src/utils/lockfile.js.map +1 -0
- package/dist/src/utils/verifier-git.d.ts +27 -1
- package/dist/src/utils/verifier-git.d.ts.map +1 -1
- package/dist/src/utils/verifier-git.js +36 -6
- package/dist/src/utils/verifier-git.js.map +1 -1
- package/docs/reference/system-hub.md +104 -0
- package/os/adr/handlers/archive.ts +3 -11
- package/os/adr/handlers/list-create.test.ts +174 -0
- package/os/adr/handlers/list-create.ts +16 -8
- package/os/audit/handlers/archive.ts +3 -11
- package/os/codebase/handlers/codebase-measure-symbols.ts +32 -4
- package/os/core/archive-regen.ts +33 -7
- package/os/core/core.module.ts +10 -76
- package/os/core/docs-archive.test.ts +25 -0
- package/os/core/handlers/assets-helpers.ts +2 -4
- package/os/core/handlers/determinism-check.ts +2 -3
- package/os/core/handlers/lifecycle-handlers.test.ts +529 -0
- package/os/core/handlers/pinned-check.ts +30 -0
- package/os/core/handlers/pinned-types.ts +7 -0
- package/os/core/handlers/pinned-validate.ts +28 -3
- package/os/core/handlers/release-prepare.ts +2 -4
- package/os/correctness/gate/trust-boundary-cx18.test.ts +1 -1
- package/os/flow/digest.ts +436 -95
- package/os/flow/evidence-lock.ts +184 -0
- package/os/flow/flow.module.ts +37 -14
- package/os/flow/git.ts +206 -11
- package/os/flow/handlers/flow-digest.ts +12 -8
- package/os/flow/handlers/flow-peers.ts +1 -1
- package/os/flow/handlers/flow-push.ts +725 -137
- package/os/flow/locks.ts +24 -7
- package/os/flow/open-missions.ts +45 -0
- package/os/flow/preflight.ts +5 -3
- package/os/flow/registry.ts +7 -3
- package/os/flow/tests/digest-id-inputs.test.ts +106 -0
- package/os/flow/tests/digest-persist.test.ts +243 -0
- package/os/flow/tests/evidence-preflight-surface-skip.test.ts +218 -0
- package/os/flow/tests/flow-push-attest.test.ts +137 -0
- package/os/flow/tests/flow-push-review-baseline.test.ts +339 -0
- package/os/flow/tests/flow-push-verifier-batch.test.ts +134 -0
- package/os/flow/tests/release-lines.test.ts +136 -0
- package/os/flow/tests/state-roots.test.ts +1 -48
- package/os/friction/friction-add.test.ts +42 -0
- package/os/friction/friction-migrate.test.ts +67 -2
- package/os/friction/friction.module.ts +33 -5
- package/os/friction/handlers/friction-add.ts +10 -15
- package/os/friction/handlers/friction-migrate.ts +220 -1
- package/os/friction/store.ts +19 -0
- package/os/friction/types.ts +8 -0
- package/os/gate/handlers/gate-probe-catalog.ts +39 -7
- package/os/gate/handlers/gate-probe-ratchet.test.ts +57 -22
- package/os/plan/handlers/archive.ts +3 -11
- package/os/rfc/handlers/archive.ts +3 -11
- package/os/rfc/handlers/list-create.ts +22 -17
- package/os/rfc/handlers/validate-corpus.test.ts +149 -0
- package/os/rfc/probe-batch.test.ts +253 -0
- package/os/rfc/verifier/rfc-1391/ac10-operating-model-policy.acceptance.test.ts +63 -0
- package/os/session/handlers/archive.ts +3 -11
- package/os/system/handlers/system-product-register.ts +492 -0
- package/os/system/handlers/system-products-status.ts +395 -0
- package/os/system/schemas.ts +17 -0
- package/os/system/system.module.ts +117 -3
- package/os/system/tests/system-product-register.test.ts +304 -0
- package/os/system/tests/system-products-status.test.ts +154 -0
- package/package.json +161 -506
- package/profiles/root-agents-system.md +82 -0
- package/profiles/system.yaml +1 -0
- package/src/command-modules.ts +0 -2
- package/src/config/forge-config.ts +16 -11
- package/src/index.ts +0 -2
- package/src/onboarding/create-superfolder-guard.test.ts +73 -0
- package/src/onboarding/create.ts +28 -2
- package/src/onboarding/doctor.ts +9 -96
- package/src/onboarding/npm-token-check.ts +3 -3
- package/src/profiles/stack-profile.ts +2 -2
- package/src/tests/evidence-consult-serialization.test.ts +202 -0
- package/src/tests/pinned-validate.test.ts +194 -0
- package/src/tests/pkg-health-self-scan.test.ts +29 -0
- package/src/tests/profile-flow-hooks.test.ts +1 -0
- package/src/tests/profile-schema.test.ts +1 -0
- package/src/tests/rfc-evidence-sync.test.ts +369 -0
- package/src/tests/skill-agents-sync.test.ts +192 -0
- package/src/tests/stack-profile.test.ts +1 -0
- package/src/types.ts +2 -2
- package/src/utils/hash.ts +5 -0
- package/src/utils/lockfile.ts +78 -0
- package/src/utils/verifier-git.ts +53 -5
- package/dist/os/core/handlers/forge-autonomy-validate.d.ts +0 -25
- package/dist/os/core/handlers/forge-autonomy-validate.d.ts.map +0 -1
- package/dist/os/core/handlers/forge-autonomy-validate.js +0 -208
- package/dist/os/core/handlers/forge-autonomy-validate.js.map +0 -1
- package/dist/os/mission/handlers/archive.d.ts +0 -4
- package/dist/os/mission/handlers/archive.d.ts.map +0 -1
- package/dist/os/mission/handlers/archive.js +0 -587
- package/dist/os/mission/handlers/archive.js.map +0 -1
- package/dist/os/mission/importer-block.d.ts +0 -19
- package/dist/os/mission/importer-block.d.ts.map +0 -1
- package/dist/os/mission/importer-block.js +0 -124
- package/dist/os/mission/importer-block.js.map +0 -1
- package/dist/os/mission/index.d.ts +0 -2
- package/dist/os/mission/index.d.ts.map +0 -1
- package/dist/os/mission/index.js +0 -15
- package/dist/os/mission/index.js.map +0 -1
- package/dist/os/mission/lockfile.d.ts.map +0 -1
- package/dist/os/mission/lockfile.js +0 -138
- package/dist/os/mission/lockfile.js.map +0 -1
- package/dist/os/mission/mission.module.d.ts +0 -3
- package/dist/os/mission/mission.module.d.ts.map +0 -1
- package/dist/os/mission/mission.module.js +0 -63
- package/dist/os/mission/mission.module.js.map +0 -1
- package/dist/os/mission/open-missions.d.ts.map +0 -1
- package/dist/os/mission/open-missions.js +0 -42
- package/dist/os/mission/open-missions.js.map +0 -1
- package/dist/os/mission/types.d.ts +0 -23
- package/dist/os/mission/types.d.ts.map +0 -1
- package/dist/os/mission/types.js +0 -19
- package/dist/os/mission/types.js.map +0 -1
- package/dist/os/werkstatt/handlers/lock.d.ts +0 -10
- package/dist/os/werkstatt/handlers/lock.d.ts.map +0 -1
- package/dist/os/werkstatt/handlers/lock.js +0 -153
- package/dist/os/werkstatt/handlers/lock.js.map +0 -1
- package/dist/os/werkstatt/handlers/schema.d.ts +0 -33
- package/dist/os/werkstatt/handlers/schema.d.ts.map +0 -1
- package/dist/os/werkstatt/handlers/schema.js +0 -42
- package/dist/os/werkstatt/handlers/schema.js.map +0 -1
- package/dist/os/werkstatt/handlers/werkstatt-lock-recover.d.ts +0 -15
- package/dist/os/werkstatt/handlers/werkstatt-lock-recover.d.ts.map +0 -1
- package/dist/os/werkstatt/handlers/werkstatt-lock-recover.js +0 -171
- package/dist/os/werkstatt/handlers/werkstatt-lock-recover.js.map +0 -1
- package/dist/os/werkstatt/handlers/werkstatt-lock-status.d.ts +0 -18
- package/dist/os/werkstatt/handlers/werkstatt-lock-status.d.ts.map +0 -1
- package/dist/os/werkstatt/handlers/werkstatt-lock-status.js +0 -51
- package/dist/os/werkstatt/handlers/werkstatt-lock-status.js.map +0 -1
- package/dist/os/werkstatt/handlers/werkstatt-operation-validate.d.ts +0 -11
- package/dist/os/werkstatt/handlers/werkstatt-operation-validate.d.ts.map +0 -1
- package/dist/os/werkstatt/handlers/werkstatt-operation-validate.js +0 -86
- package/dist/os/werkstatt/handlers/werkstatt-operation-validate.js.map +0 -1
- package/dist/os/werkstatt/handlers/workspace-deps.d.ts +0 -12
- package/dist/os/werkstatt/handlers/workspace-deps.d.ts.map +0 -1
- package/dist/os/werkstatt/handlers/workspace-deps.js +0 -42
- package/dist/os/werkstatt/handlers/workspace-deps.js.map +0 -1
- package/dist/os/werkstatt/index.d.ts +0 -7
- package/dist/os/werkstatt/index.d.ts.map +0 -1
- package/dist/os/werkstatt/index.js +0 -18
- package/dist/os/werkstatt/index.js.map +0 -1
- package/dist/os/werkstatt/werkstatt.module.d.ts +0 -3
- package/dist/os/werkstatt/werkstatt.module.d.ts.map +0 -1
- package/dist/os/werkstatt/werkstatt.module.js +0 -91
- package/dist/os/werkstatt/werkstatt.module.js.map +0 -1
- package/os/core/handlers/forge-autonomy-validate.ts +0 -276
- package/os/correctness/gate/trust-boundary-cx19.test.ts +0 -514
- package/os/mission/handlers/archive.test.ts +0 -764
- package/os/mission/handlers/archive.ts +0 -719
- package/os/mission/handlers/ship-inflight-degraded.test.ts +0 -105
- package/os/mission/importer-block.ts +0 -119
- package/os/mission/index.ts +0 -15
- package/os/mission/lockfile.ts +0 -152
- package/os/mission/mission.module.ts +0 -68
- package/os/mission/open-missions.ts +0 -50
- package/os/mission/types.ts +0 -42
- package/os/werkstatt/handlers/lock.ts +0 -168
- package/os/werkstatt/handlers/schema.ts +0 -47
- package/os/werkstatt/handlers/werkstatt-lock-recover.ts +0 -206
- package/os/werkstatt/handlers/werkstatt-lock-status.ts +0 -82
- package/os/werkstatt/handlers/werkstatt-operation-validate.ts +0 -112
- package/os/werkstatt/handlers/workspace-deps.ts +0 -56
- package/os/werkstatt/index.ts +0 -39
- package/os/werkstatt/werkstatt.module.ts +0 -95
- package/src/tests/doctor-autonomy.test.ts +0 -246
- package/src/tests/forge-autonomy-validate.test.ts +0 -159
- package/src/tests/werkstatt-lock.test.ts +0 -357
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export type CollectFilesFn = (root: string, options?: {
|
|
2
|
-
extensions?: string[];
|
|
3
|
-
ignore?: (name: string) => boolean;
|
|
4
|
-
}) => Promise<string[]>;
|
|
5
|
-
export type ByteHashFileFn = (filePath: string) => Promise<string>;
|
|
6
|
-
interface WorkspaceDeps {
|
|
7
|
-
collectFiles: CollectFilesFn;
|
|
8
|
-
byteHashFile: ByteHashFileFn;
|
|
9
|
-
}
|
|
10
|
-
export declare function loadWorkspaceDeps(): Promise<WorkspaceDeps>;
|
|
11
|
-
export {};
|
|
12
|
-
//# sourceMappingURL=workspace-deps.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"workspace-deps.d.ts","sourceRoot":"","sources":["../../../../os/werkstatt/handlers/workspace-deps.ts"],"names":[],"mappings":"AAcA,MAAM,MAAM,cAAc,GAAG,CAC3B,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE;IACR,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;CACpC,KACE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;AAEvB,MAAM,MAAM,cAAc,GAAG,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;AAEnE,UAAU,aAAa;IACrB,YAAY,EAAE,cAAc,CAAC;IAC7B,YAAY,EAAE,cAAc,CAAC;CAC9B;AAKD,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,aAAa,CAAC,CAuBhE"}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
<MODULE_CONTRACT>
|
|
3
|
-
<purpose>Lazy dynamic-import bridge for @warpgogol/werkstatt-shared/node/fs and @warpgogol/werkstatt-shared/fingerprint. These workspace packages are not published to npm — when forge is installed standalone from npm, they are unavailable and handlers that depend on them must degrade gracefully.</purpose>
|
|
4
|
-
<non-goals>
|
|
5
|
-
<item>Do not re-export types from @warpgogol/* — only runtime functions.</item>
|
|
6
|
-
<item>Do not use static imports — that would break npm installs without workspace deps.</item>
|
|
7
|
-
</non-goals>
|
|
8
|
-
</MODULE_CONTRACT>
|
|
9
|
-
<CHANGE_SUMMARY>
|
|
10
|
-
<item>RFC-0682: extract dynamic-import helper so forge publishes without workspace:* deps.</item>
|
|
11
|
-
<item>RFC-0940: moved from os/core/handlers/ to os/werkstatt/handlers/ — this module imports @warpgogol/werkstatt-engine and belongs in the adapter directory.</item>
|
|
12
|
-
</CHANGE_SUMMARY>
|
|
13
|
-
*/
|
|
14
|
-
let cached = null;
|
|
15
|
-
let loadError = null;
|
|
16
|
-
export async function loadWorkspaceDeps() {
|
|
17
|
-
if (cached)
|
|
18
|
-
return cached;
|
|
19
|
-
if (loadError)
|
|
20
|
-
throw new Error(loadError);
|
|
21
|
-
try {
|
|
22
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
23
|
-
// @ts-ignore — workspace dep, may not be installed when forge is used standalone from npm
|
|
24
|
-
const shareMod = await import("@warpgogol/werkstatt-shared/node/fs");
|
|
25
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
26
|
-
// @ts-ignore — workspace dep, may not be installed when forge is used standalone from npm
|
|
27
|
-
const fpMod = await import("@warpgogol/werkstatt-shared/fingerprint");
|
|
28
|
-
cached = {
|
|
29
|
-
collectFiles: shareMod.collectFiles,
|
|
30
|
-
byteHashFile: fpMod.byteHashFile,
|
|
31
|
-
};
|
|
32
|
-
return cached;
|
|
33
|
-
}
|
|
34
|
-
catch (err) {
|
|
35
|
-
loadError =
|
|
36
|
-
`@warpgogol/werkstatt-shared/fingerprint and @warpgogol/werkstatt-shared/node/fs are required for this command but not installed. ` +
|
|
37
|
-
`When using forge standalone from npm, install them separately or use forge within the warpgogol workspace. ` +
|
|
38
|
-
`Error: ${err.message}`;
|
|
39
|
-
throw new Error(loadError);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
//# sourceMappingURL=workspace-deps.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"workspace-deps.js","sourceRoot":"","sources":["../../../../os/werkstatt/handlers/workspace-deps.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;EAYE;AAiBF,IAAI,MAAM,GAAyB,IAAI,CAAC;AACxC,IAAI,SAAS,GAAkB,IAAI,CAAC;AAEpC,MAAM,CAAC,KAAK,UAAU,iBAAiB;IACrC,IAAI,MAAM;QAAE,OAAO,MAAM,CAAC;IAC1B,IAAI,SAAS;QAAE,MAAM,IAAI,KAAK,CAAC,SAAS,CAAC,CAAC;IAE1C,IAAI,CAAC;QACH,6DAA6D;QAC7D,0FAA0F;QAC1F,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,qCAAqC,CAAC,CAAC;QACrE,6DAA6D;QAC7D,0FAA0F;QAC1F,MAAM,KAAK,GAAG,MAAM,MAAM,CAAC,yCAAyC,CAAC,CAAC;QACtE,MAAM,GAAG;YACP,YAAY,EAAE,QAAQ,CAAC,YAA8B;YACrD,YAAY,EAAE,KAAK,CAAC,YAA8B;SACnD,CAAC;QACF,OAAO,MAAM,CAAC;IAChB,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,SAAS;YACP,mIAAmI;gBACnI,6GAA6G;gBAC7G,UAAW,GAAa,CAAC,OAAO,EAAE,CAAC;QACrC,MAAM,IAAI,KAAK,CAAC,SAAS,CAAC,CAAC;IAC7B,CAAC;AACH,CAAC"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export { forgeWerkstattModule } from "./werkstatt.module.ts";
|
|
2
|
-
export { werkstattLockSchema, werkstattOperationRecordSchema, type WerkstattLock, type WerkstattOperationRecord, } from "./handlers/schema.ts";
|
|
3
|
-
export { acquireLock, releaseLock, heartbeatLock, readAllLocks, isLockStale, removeStaleLock, } from "./handlers/lock.ts";
|
|
4
|
-
export { runWerkstattLockStatus, type WerkstattLockStatusData, } from "./handlers/werkstatt-lock-status.ts";
|
|
5
|
-
export { runWerkstattLockRecover, type WerkstattLockRecoverData, } from "./handlers/werkstatt-lock-recover.ts";
|
|
6
|
-
export { runWerkstattOperationValidate, type WerkstattOperationValidateData, } from "./handlers/werkstatt-operation-validate.ts";
|
|
7
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../os/werkstatt/index.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EACL,mBAAmB,EACnB,8BAA8B,EAC9B,KAAK,aAAa,EAClB,KAAK,wBAAwB,GAC9B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,WAAW,EACX,WAAW,EACX,aAAa,EACb,YAAY,EACZ,WAAW,EACX,eAAe,GAChB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,sBAAsB,EACtB,KAAK,uBAAuB,GAC7B,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EACL,uBAAuB,EACvB,KAAK,wBAAwB,GAC9B,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACL,6BAA6B,EAC7B,KAAK,8BAA8B,GACpC,MAAM,4CAA4C,CAAC"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
<MODULE_CONTRACT>
|
|
3
|
-
<purpose>Expose forge Werkstatt kernel commands through a stable package subpath.</purpose>
|
|
4
|
-
<non-goals>
|
|
5
|
-
<item>Do not implement werkstatt handler logic.</item>
|
|
6
|
-
</non-goals>
|
|
7
|
-
</MODULE_CONTRACT>
|
|
8
|
-
<CHANGE_SUMMARY>
|
|
9
|
-
<item>RFC-0374: initial werkstatt module barrel.</item>
|
|
10
|
-
</CHANGE_SUMMARY>
|
|
11
|
-
*/
|
|
12
|
-
export { forgeWerkstattModule } from "./werkstatt.module.js";
|
|
13
|
-
export { werkstattLockSchema, werkstattOperationRecordSchema, } from "./handlers/schema.js";
|
|
14
|
-
export { acquireLock, releaseLock, heartbeatLock, readAllLocks, isLockStale, removeStaleLock, } from "./handlers/lock.js";
|
|
15
|
-
export { runWerkstattLockStatus, } from "./handlers/werkstatt-lock-status.js";
|
|
16
|
-
export { runWerkstattLockRecover, } from "./handlers/werkstatt-lock-recover.js";
|
|
17
|
-
export { runWerkstattOperationValidate, } from "./handlers/werkstatt-operation-validate.js";
|
|
18
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../os/werkstatt/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AAEF,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EACL,mBAAmB,EACnB,8BAA8B,GAG/B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,WAAW,EACX,WAAW,EACX,aAAa,EACb,YAAY,EACZ,WAAW,EACX,eAAe,GAChB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,sBAAsB,GAEvB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EACL,uBAAuB,GAExB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACL,6BAA6B,GAE9B,MAAM,4CAA4C,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"werkstatt.module.d.ts","sourceRoot":"","sources":["../../../os/werkstatt/werkstatt.module.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAK7D,eAAO,MAAM,oBAAoB,EAAE,WAmElC,CAAC"}
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
<MODULE_CONTRACT>
|
|
3
|
-
<purpose>Register forge Werkstatt lock and operation validation commands with the kernel registry.</purpose>
|
|
4
|
-
<non-goals>
|
|
5
|
-
<item>Do not implement werkstatt handler logic — delegate to handlers/ inlined by RFC-0556.</item>
|
|
6
|
-
</non-goals>
|
|
7
|
-
</MODULE_CONTRACT>
|
|
8
|
-
<CHANGE_SUMMARY>
|
|
9
|
-
<item>RFC-1231: step 1 — rename supportsAllSites to acceptsAllFlag
|
|
10
|
-
|
|
11
|
-
Mechanical sweep: the field only ever gated --all argv acceptance; fan-out
|
|
12
|
-
follows the parsed selector. Guard renamed assertAllSitesAllowed ->
|
|
13
|
-
assertAllFlagAccepted, message updated. 417 declaration sites + type
|
|
14
|
-
surfaces (KernelCommandMetadata, ForgeCommandMetadata) in one atomic pass.</item>
|
|
15
|
-
<item>RFC-1248: VITE-CLIENT-DEP-02 lazy-import gate + SCAN-02 validator reads-root existence check (RFC-1248)</item>
|
|
16
|
-
<item>RFC-1462: isolate parallel agent sessions in per-session git worktrees — session.open/close/status, registry, commit overlap warning</item>
|
|
17
|
-
<item>RFC-1462: repair RFC-1462 session-worktree r1 findings — last-commit status, real inside-worktree skip, loud residue commit</item>
|
|
18
|
-
<item>RFC-1487: step 7 — remove RFC-1462 session-worktree paths, COMMIT-FGN-01 guard, and .sessions model; document flow lifecycle</item>
|
|
19
|
-
<history>RFC-0374, RFC-0556, RFC-1173, RFC-1360</history>
|
|
20
|
-
</CHANGE_SUMMARY>
|
|
21
|
-
*/
|
|
22
|
-
import { runWerkstattLockStatus } from "./handlers/werkstatt-lock-status.js";
|
|
23
|
-
import { runWerkstattLockRecover } from "./handlers/werkstatt-lock-recover.js";
|
|
24
|
-
import { runWerkstattOperationValidate } from "./handlers/werkstatt-operation-validate.js";
|
|
25
|
-
export const forgeWerkstattModule = {
|
|
26
|
-
name: "forge-werkstatt",
|
|
27
|
-
version: "0.1.0",
|
|
28
|
-
runtime: "werkstatt-adapter",
|
|
29
|
-
declarations: [],
|
|
30
|
-
commands: [
|
|
31
|
-
{
|
|
32
|
-
name: "werkstatt.lock.status",
|
|
33
|
-
coverage: "operator",
|
|
34
|
-
mutatesState: false,
|
|
35
|
-
description: "Report all Werkstatt locks, their age, owner, and staleness (RFC-0362).",
|
|
36
|
-
scope: "workspace",
|
|
37
|
-
acceptsAllFlag: false,
|
|
38
|
-
flags: {},
|
|
39
|
-
reads: [".werkstatt/locks/**"],
|
|
40
|
-
execute: runWerkstattLockStatus,
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
name: "werkstatt.lock.recover",
|
|
44
|
-
coverage: "operator",
|
|
45
|
-
description: "Classify and clean stale locks and staging artifacts (RFC-0362). Flags: --scope, --purge.",
|
|
46
|
-
scope: "workspace",
|
|
47
|
-
acceptsAllFlag: false,
|
|
48
|
-
mutatesState: true,
|
|
49
|
-
flags: {
|
|
50
|
-
scope: { kind: "string", description: "Recover only a single lock scope." },
|
|
51
|
-
purge: {
|
|
52
|
-
kind: "boolean",
|
|
53
|
-
description: "Remove stale artifacts instead of classifying them.",
|
|
54
|
-
},
|
|
55
|
-
},
|
|
56
|
-
writes: [
|
|
57
|
-
".werkstatt/locks/**",
|
|
58
|
-
"systems/*.tmp",
|
|
59
|
-
"systems/*.staging-*",
|
|
60
|
-
"systems/*.incomplete",
|
|
61
|
-
"systems/*.failed-*",
|
|
62
|
-
"missions/*.tmp",
|
|
63
|
-
"missions/*.staging-*",
|
|
64
|
-
"missions/*.incomplete",
|
|
65
|
-
"missions/*.failed-*",
|
|
66
|
-
"releases/*.tmp",
|
|
67
|
-
"releases/*.staging-*",
|
|
68
|
-
"releases/*.incomplete",
|
|
69
|
-
"releases/*.failed-*",
|
|
70
|
-
],
|
|
71
|
-
generates: [],
|
|
72
|
-
reads: [".werkstatt/locks/**"],
|
|
73
|
-
cacheable: false,
|
|
74
|
-
execute: runWerkstattLockRecover,
|
|
75
|
-
},
|
|
76
|
-
{
|
|
77
|
-
name: "werkstatt.operation.validate",
|
|
78
|
-
mutatesState: false,
|
|
79
|
-
contract: "werkstatt",
|
|
80
|
-
rules: [],
|
|
81
|
-
description: "Validate that mutating Werkstatt commands use shared lock/idempotency/atomic-write helpers (RFC-0362).",
|
|
82
|
-
scope: "workspace",
|
|
83
|
-
acceptsAllFlag: false,
|
|
84
|
-
flags: {},
|
|
85
|
-
reads: ["packages/werkstatt-engine/src/handoff/**/*.ts"],
|
|
86
|
-
execute: runWerkstattOperationValidate,
|
|
87
|
-
},
|
|
88
|
-
],
|
|
89
|
-
pipelines: [],
|
|
90
|
-
};
|
|
91
|
-
//# sourceMappingURL=werkstatt.module.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"werkstatt.module.js","sourceRoot":"","sources":["../../../os/werkstatt/werkstatt.module.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;EAoBE;AAGF,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAC7E,OAAO,EAAE,uBAAuB,EAAE,MAAM,sCAAsC,CAAC;AAC/E,OAAO,EAAE,6BAA6B,EAAE,MAAM,4CAA4C,CAAC;AAE3F,MAAM,CAAC,MAAM,oBAAoB,GAAgB;IAC/C,IAAI,EAAE,iBAAiB;IACvB,OAAO,EAAE,OAAO;IAChB,OAAO,EAAE,mBAAmB;IAC5B,YAAY,EAAE,EAAE;IAChB,QAAQ,EAAE;QACR;YACE,IAAI,EAAE,uBAAuB;YAC7B,QAAQ,EAAE,UAAmB;YAC7B,YAAY,EAAE,KAAK;YACnB,WAAW,EAAE,yEAAyE;YACtF,KAAK,EAAE,WAAW;YAClB,cAAc,EAAE,KAAK;YACrB,KAAK,EAAE,EAAE;YACT,KAAK,EAAE,CAAC,qBAAqB,CAAC;YAC9B,OAAO,EAAE,sBAAsB;SAChC;QACD;YACE,IAAI,EAAE,wBAAwB;YAC9B,QAAQ,EAAE,UAAmB;YAC7B,WAAW,EACT,2FAA2F;YAC7F,KAAK,EAAE,WAAW;YAClB,cAAc,EAAE,KAAK;YACrB,YAAY,EAAE,IAAI;YAClB,KAAK,EAAE;gBACL,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,mCAAmC,EAAE;gBAC3E,KAAK,EAAE;oBACL,IAAI,EAAE,SAAS;oBACf,WAAW,EAAE,qDAAqD;iBACnE;aACF;YACD,MAAM,EAAE;gBACN,qBAAqB;gBACrB,eAAe;gBACf,qBAAqB;gBACrB,sBAAsB;gBACtB,oBAAoB;gBACpB,gBAAgB;gBAChB,sBAAsB;gBACtB,uBAAuB;gBACvB,qBAAqB;gBACrB,gBAAgB;gBAChB,sBAAsB;gBACtB,uBAAuB;gBACvB,qBAAqB;aACtB;YACD,SAAS,EAAE,EAAE;YACb,KAAK,EAAE,CAAC,qBAAqB,CAAC;YAC9B,SAAS,EAAE,KAAK;YAChB,OAAO,EAAE,uBAAuB;SACjC;QACD;YACE,IAAI,EAAE,8BAA8B;YACpC,YAAY,EAAE,KAAK;YACnB,QAAQ,EAAE,WAAW;YACrB,KAAK,EAAE,EAAE;YACT,WAAW,EACT,wGAAwG;YAC1G,KAAK,EAAE,WAAW;YAClB,cAAc,EAAE,KAAK;YACrB,KAAK,EAAE,EAAE;YACT,KAAK,EAAE,CAAC,+CAA+C,CAAC;YACxD,OAAO,EAAE,6BAA6B;SACvC;KACF;IACD,SAAS,EAAE,EAAE;CACd,CAAC"}
|
|
@@ -1,276 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
<MODULE_CONTRACT>
|
|
3
|
-
<purpose>forge.autonomy.validate — scans packages/forge/os/** for forbidden
|
|
4
|
-
@warpgogol/werkstatt-engine imports outside os/werkstatt/. Enforces FORGE-AUTONOMY-01
|
|
5
|
-
(RFC-0940, DNA-64). @warpgogol/werkstatt-shared is exempt (shared infrastructure).
|
|
6
|
-
Type-only imports (import type) are exempt.</purpose>
|
|
7
|
-
|
|
8
|
-
<non-goals>
|
|
9
|
-
<item>Does not scan test files — .test.ts and .spec.ts are always excluded.</item>
|
|
10
|
-
<item>Does not scan os/werkstatt/ — the adapter directory may import @warpgogol/werkstatt-engine.</item>
|
|
11
|
-
<item>Does not flag @warpgogol/werkstatt-shared — shared infrastructure, not the engine.</item>
|
|
12
|
-
<item>Does not flag import type statements — type-only imports are erased at compile time.</item>
|
|
13
|
-
<item>RFC-1606: the strip-types arm (FORGE-AUTONOMY-02) covers the os/ + bin/ trees — diagnostics in imported dependency sources (werkstatt-shared etc.) are reported under outOfScopeDiagnostics, not violations.</item>
|
|
14
|
-
</non-goals>
|
|
15
|
-
</MODULE_CONTRACT>
|
|
16
|
-
<CHANGE_SUMMARY>
|
|
17
|
-
<item>RFC-0940: initial forge.autonomy.validate handler implementing FORGE-AUTONOMY-01.</item>
|
|
18
|
-
<item>ADR-0019: inlined scanDirectoryForImports to make forge dependency-free.</item>
|
|
19
|
-
<item>RFC-1097: step 6 — compass.migrate codemod run
|
|
20
|
-
|
|
21
|
-
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>
|
|
22
|
-
<item>RFC-1097: sweep — werkstatt-engine clean
|
|
23
|
-
|
|
24
|
-
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>
|
|
25
|
-
</CHANGE_SUMMARY>
|
|
26
|
-
*/
|
|
27
|
-
|
|
28
|
-
import { join, relative } from "node:path";
|
|
29
|
-
import { ambientIo, resolveIo } from "../../../src/utils/io.ts";
|
|
30
|
-
|
|
31
|
-
// Ambient default for helper fns without a context param — handlers override
|
|
32
|
-
// with `const io = resolveIo(context.io)` inside their own scope.
|
|
33
|
-
const io = ambientIo;
|
|
34
|
-
import type {
|
|
35
|
-
ForgeCommandInput,
|
|
36
|
-
ForgeCommandResult,
|
|
37
|
-
ForgeRuntimeContext,
|
|
38
|
-
} from "../../../src/types.ts";
|
|
39
|
-
|
|
40
|
-
const FORBIDDEN_PACKAGE = "@warpgogol/werkstatt-engine";
|
|
41
|
-
const ADAPTER_DIR_PREFIX = "packages/forge/os/werkstatt/";
|
|
42
|
-
|
|
43
|
-
const EXCLUDE_DIRS = new Set(["node_modules", "tests", "tests-handoff", "dist", "templates"]);
|
|
44
|
-
const EXCLUDE_SUFFIXES = [".test.ts", ".spec.ts"];
|
|
45
|
-
const IMPORT_PATTERN =
|
|
46
|
-
/(?:^|\n)\s*(?:import\s+(?:type\s+)?[^;]+?\s+from\s+|require\s*\(\s*)["'`]([^"'`]+)["'`]/g;
|
|
47
|
-
|
|
48
|
-
function shouldExcludeFile(fileName: string): boolean {
|
|
49
|
-
return EXCLUDE_SUFFIXES.some((suffix) => fileName.endsWith(suffix));
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
async function scanDirectoryForImports(
|
|
53
|
-
dir: string,
|
|
54
|
-
workspaceRoot: string,
|
|
55
|
-
specifierFilter: (specifier: string) => boolean,
|
|
56
|
-
): Promise<{ violations: { file: string; specifier: string }[]; scannedFiles: number }> {
|
|
57
|
-
let scannedFiles = 0;
|
|
58
|
-
const violations: { file: string; specifier: string }[] = [];
|
|
59
|
-
const entries = await io.readdir(dir).catch(() => []);
|
|
60
|
-
|
|
61
|
-
for (const entry of entries) {
|
|
62
|
-
const fullPath = join(dir, entry.name);
|
|
63
|
-
|
|
64
|
-
if (entry.isDirectory) {
|
|
65
|
-
if (EXCLUDE_DIRS.has(entry.name)) continue;
|
|
66
|
-
const subResult = await scanDirectoryForImports(fullPath, workspaceRoot, specifierFilter);
|
|
67
|
-
scannedFiles += subResult.scannedFiles;
|
|
68
|
-
violations.push(...subResult.violations);
|
|
69
|
-
} else if (entry.name.endsWith(".ts") && !shouldExcludeFile(entry.name)) {
|
|
70
|
-
scannedFiles++;
|
|
71
|
-
const content = await io.readFile(fullPath).catch(() => "");
|
|
72
|
-
let match: RegExpExecArray | null;
|
|
73
|
-
const pattern = new RegExp(IMPORT_PATTERN.source, "g");
|
|
74
|
-
while ((match = pattern.exec(content)) !== null) {
|
|
75
|
-
const specifier = match[1]!;
|
|
76
|
-
if (specifierFilter(specifier)) {
|
|
77
|
-
violations.push({
|
|
78
|
-
// Reported paths are repo-relative logical paths — forward
|
|
79
|
-
// slashes on every platform.
|
|
80
|
-
file: relative(workspaceRoot, fullPath).replace(/\\/g, "/"),
|
|
81
|
-
specifier,
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
return { violations, scannedFiles };
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
export interface ForgeAutonomyViolation {
|
|
92
|
-
ruleId: "FORGE-AUTONOMY-01" | "FORGE-AUTONOMY-02";
|
|
93
|
-
file: string;
|
|
94
|
-
specifier?: string;
|
|
95
|
-
message?: string;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
export interface ForgeAutonomyValidateResult {
|
|
99
|
-
command: "forge.autonomy.validate";
|
|
100
|
-
status: "pass" | "fail";
|
|
101
|
-
violations: ForgeAutonomyViolation[];
|
|
102
|
-
scannedFiles: number;
|
|
103
|
-
modules: Record<string, { runtime: "autonomous" | "werkstatt-adapter"; violations: number }>;
|
|
104
|
-
stripTypes?: {
|
|
105
|
-
diagnosticFiles: number;
|
|
106
|
-
durationMs: number;
|
|
107
|
-
skipped?: string;
|
|
108
|
-
outOfScopeDiagnostics: number;
|
|
109
|
-
};
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
function isTypeOnlyImport(content: string, specifier: string): boolean {
|
|
113
|
-
const specifierIdx = content.indexOf(specifier);
|
|
114
|
-
if (specifierIdx === -1) return false;
|
|
115
|
-
|
|
116
|
-
const importStart = content.lastIndexOf("import", specifierIdx);
|
|
117
|
-
if (importStart === -1) return false;
|
|
118
|
-
|
|
119
|
-
const importLine = content.slice(importStart, specifierIdx);
|
|
120
|
-
return /\bimport\s+type\b/.test(importLine);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
export async function runForgeAutonomyValidate(
|
|
124
|
-
_input: ForgeCommandInput,
|
|
125
|
-
context: ForgeRuntimeContext,
|
|
126
|
-
): Promise<ForgeCommandResult<ForgeAutonomyValidateResult>> {
|
|
127
|
-
const io = resolveIo(context.io);
|
|
128
|
-
const workspaceRoot = context.workspaceRoot;
|
|
129
|
-
const forgeOsDir = join(workspaceRoot, "packages", "forge", "os");
|
|
130
|
-
|
|
131
|
-
const { violations: rawViolations, scannedFiles } = await scanDirectoryForImports(
|
|
132
|
-
forgeOsDir,
|
|
133
|
-
workspaceRoot,
|
|
134
|
-
(specifier) => specifier === FORBIDDEN_PACKAGE || specifier.startsWith(FORBIDDEN_PACKAGE + "/"),
|
|
135
|
-
);
|
|
136
|
-
|
|
137
|
-
const violations: ForgeAutonomyViolation[] = [];
|
|
138
|
-
for (const v of rawViolations) {
|
|
139
|
-
if (v.file.startsWith(ADAPTER_DIR_PREFIX)) continue;
|
|
140
|
-
|
|
141
|
-
const fullPath = join(workspaceRoot, v.file);
|
|
142
|
-
const content = await io.readFile(fullPath).catch(() => "");
|
|
143
|
-
if (!isTypeOnlyImport(content, v.specifier)) {
|
|
144
|
-
violations.push({
|
|
145
|
-
ruleId: "FORGE-AUTONOMY-01",
|
|
146
|
-
file: v.file,
|
|
147
|
-
specifier: v.specifier,
|
|
148
|
-
});
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
const modules: Record<
|
|
153
|
-
string,
|
|
154
|
-
{ runtime: "autonomous" | "werkstatt-adapter"; violations: number }
|
|
155
|
-
> = {};
|
|
156
|
-
for (const v of violations) {
|
|
157
|
-
const parts = v.file.split("/");
|
|
158
|
-
const modKey = parts.slice(0, 4).join("/");
|
|
159
|
-
if (!modules[modKey]) {
|
|
160
|
-
const isAdapter = v.file.startsWith(ADAPTER_DIR_PREFIX);
|
|
161
|
-
modules[modKey] = {
|
|
162
|
-
runtime: isAdapter ? "werkstatt-adapter" : "autonomous",
|
|
163
|
-
violations: 0,
|
|
164
|
-
};
|
|
165
|
-
}
|
|
166
|
-
modules[modKey]!.violations++;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
// ── RFC-1606 AC-3: FORGE-AUTONOMY-02 strip-types arm ──────────────────
|
|
170
|
-
// `node --experimental-strip-types` can only strip erasable syntax — any
|
|
171
|
-
// runtime TypeScript construct (parameter properties, enums, namespaces)
|
|
172
|
-
// in os/** + bin/** breaks the standalone CLI under strip-types. The arm
|
|
173
|
-
// spawns `tsc -p tsconfig.strip-types.json` and parses its diagnostics;
|
|
174
|
-
// diagnostics inside imported dependency sources (werkstatt-shared etc.)
|
|
175
|
-
// are out of scope and reported separately rather than failing the arm.
|
|
176
|
-
const stripTypes = await runStripTypesArm(workspaceRoot, io);
|
|
177
|
-
for (const v of stripTypes.violations) violations.push(v);
|
|
178
|
-
|
|
179
|
-
const status = violations.length === 0 ? "pass" : "fail";
|
|
180
|
-
|
|
181
|
-
return {
|
|
182
|
-
data: {
|
|
183
|
-
command: "forge.autonomy.validate",
|
|
184
|
-
status,
|
|
185
|
-
violations,
|
|
186
|
-
scannedFiles,
|
|
187
|
-
modules,
|
|
188
|
-
stripTypes: {
|
|
189
|
-
diagnosticFiles: stripTypes.checkedFiles,
|
|
190
|
-
durationMs: stripTypes.durationMs,
|
|
191
|
-
skipped: stripTypes.skipped,
|
|
192
|
-
outOfScopeDiagnostics: stripTypes.outOfScopeDiagnostics,
|
|
193
|
-
},
|
|
194
|
-
},
|
|
195
|
-
exitCode: status === "pass" ? 0 : 1,
|
|
196
|
-
summary: `[forge.autonomy.validate] ${status.toUpperCase()} — ${violations.length} violation(s) across ${scannedFiles} files`,
|
|
197
|
-
};
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
const armErrMessage = (err: unknown) => (err instanceof Error ? err.message : String(err));
|
|
201
|
-
|
|
202
|
-
/** Diagnostic line shape: `path(line,col): error TSnnnn: message`. */
|
|
203
|
-
const TSC_DIAG_LINE = /^(.+?)\((\d+),(\d+)\): error (TS\d+): (.+)$/;
|
|
204
|
-
|
|
205
|
-
/**
|
|
206
|
-
* FORGE-AUTONOMY-02 — the os/ + bin/ trees must be erasable-syntax-only
|
|
207
|
-
* (F-0227, RFC-1606). Runs `tsc -p tsconfig.strip-types.json` scoped to the
|
|
208
|
-
* forge package; diagnostics outside the package's own os//bin trees are
|
|
209
|
-
* dependency-source findings — reported as outOfScopeDiagnostics, never
|
|
210
|
-
* violations. Degrades (never blocks) when io lacks exec.
|
|
211
|
-
*/
|
|
212
|
-
async function runStripTypesArm(
|
|
213
|
-
workspaceRoot: string,
|
|
214
|
-
ioArg: typeof ambientIo,
|
|
215
|
-
): Promise<{
|
|
216
|
-
violations: ForgeAutonomyViolation[];
|
|
217
|
-
checkedFiles: number;
|
|
218
|
-
durationMs: number;
|
|
219
|
-
skipped?: string;
|
|
220
|
-
outOfScopeDiagnostics: number;
|
|
221
|
-
}> {
|
|
222
|
-
const started = Date.now();
|
|
223
|
-
const empty = {
|
|
224
|
-
violations: [] as ForgeAutonomyViolation[],
|
|
225
|
-
checkedFiles: 0,
|
|
226
|
-
durationMs: 0,
|
|
227
|
-
outOfScopeDiagnostics: 0,
|
|
228
|
-
};
|
|
229
|
-
if (typeof ioArg.exec !== "function") {
|
|
230
|
-
return { ...empty, skipped: "io.exec unavailable" };
|
|
231
|
-
}
|
|
232
|
-
const forgeDir = join(workspaceRoot, "packages", "forge");
|
|
233
|
-
const tscBin = join(forgeDir, "node_modules", ".bin", "tsc");
|
|
234
|
-
// Reduced/fake workspaces carry no node_modules — degrade like a missing
|
|
235
|
-
// exec rather than refusing the scan (io.exec-lacks rule, RFC-1606).
|
|
236
|
-
if (typeof ioArg.exists === "function" && !(await ioArg.exists(tscBin))) {
|
|
237
|
-
return { ...empty, skipped: "tsc binary unavailable" };
|
|
238
|
-
}
|
|
239
|
-
// Direct binary — `pnpm exec` rewrites pnpm-lock.yaml as a side effect
|
|
240
|
-
// (F-0201), and this arm must not dirty the tree it inspects.
|
|
241
|
-
let res: { stdout?: string; stderr?: string };
|
|
242
|
-
try {
|
|
243
|
-
res = await ioArg.exec(
|
|
244
|
-
tscBin,
|
|
245
|
-
["-p", "tsconfig.strip-types.json", "--noEmit"],
|
|
246
|
-
{ cwd: forgeDir },
|
|
247
|
-
);
|
|
248
|
-
} catch (err) {
|
|
249
|
-
return { ...empty, skipped: `tsc spawn failed: ${armErrMessage(err)}` };
|
|
250
|
-
}
|
|
251
|
-
const durationMs = Date.now() - started;
|
|
252
|
-
const output = `${res.stdout ?? ""}\n${res.stderr ?? ""}`;
|
|
253
|
-
const violations: ForgeAutonomyViolation[] = [];
|
|
254
|
-
let outOfScopeDiagnostics = 0;
|
|
255
|
-
const diagnosticFiles = new Set<string>();
|
|
256
|
-
for (const line of output.split("\n")) {
|
|
257
|
-
const m = TSC_DIAG_LINE.exec(line.trim());
|
|
258
|
-
if (!m) continue;
|
|
259
|
-
const [, rawPath, lineNo, , code, message] = m;
|
|
260
|
-
const rel = rawPath!.replace(/\\/g, "/");
|
|
261
|
-
diagnosticFiles.add(rel);
|
|
262
|
-
// Scope: only diagnostics inside this package's os//bin trees fail the
|
|
263
|
-
// arm — imported dependency sources are reported, not refused (RFC-1606).
|
|
264
|
-
const inScope = !rel.includes("../") && /^(os|bin)\//.test(rel);
|
|
265
|
-
if (!inScope) {
|
|
266
|
-
outOfScopeDiagnostics++;
|
|
267
|
-
continue;
|
|
268
|
-
}
|
|
269
|
-
violations.push({
|
|
270
|
-
ruleId: "FORGE-AUTONOMY-02",
|
|
271
|
-
file: `packages/forge/${rel}`,
|
|
272
|
-
message: `${code} at line ${lineNo}: ${message}`,
|
|
273
|
-
});
|
|
274
|
-
}
|
|
275
|
-
return { violations, checkedFiles: diagnosticFiles.size, durationMs, outOfScopeDiagnostics };
|
|
276
|
-
}
|