spexcode 0.6.2 → 0.6.6
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/README.md +3 -1
- package/bin/spex.mjs +4 -0
- package/node_modules/@spexcode/session-core/dist/delivery-queue.d.ts +23 -0
- package/node_modules/@spexcode/session-core/dist/delivery-queue.js +195 -0
- package/node_modules/@spexcode/session-core/dist/index.d.ts +5 -0
- package/node_modules/@spexcode/session-core/dist/index.js +5 -0
- package/node_modules/@spexcode/session-core/dist/internal.d.ts +3 -0
- package/node_modules/@spexcode/session-core/dist/internal.js +3 -0
- package/node_modules/@spexcode/session-core/dist/message.d.ts +22 -0
- package/node_modules/@spexcode/session-core/dist/message.js +52 -0
- package/node_modules/@spexcode/session-core/dist/record-lock.d.ts +7 -0
- package/node_modules/@spexcode/session-core/dist/record-lock.js +152 -0
- package/node_modules/@spexcode/session-core/dist/runtime-session.d.ts +50 -0
- package/node_modules/@spexcode/session-core/dist/runtime-session.js +286 -0
- package/node_modules/@spexcode/session-core/dist/session-cursors.d.ts +14 -0
- package/node_modules/@spexcode/session-core/dist/session-cursors.js +82 -0
- package/node_modules/@spexcode/session-core/dist/session-timeline.d.ts +46 -0
- package/node_modules/@spexcode/session-core/dist/session-timeline.js +216 -0
- package/node_modules/@spexcode/session-core/package.json +33 -0
- package/node_modules/@spexcode/spec-cli/bin/spex.mjs +77 -0
- package/node_modules/@spexcode/spec-cli/dist/attach.d.ts +2 -0
- package/node_modules/@spexcode/spec-cli/dist/attach.js +48 -0
- package/node_modules/@spexcode/spec-cli/dist/claude-headless.d.ts +36 -0
- package/node_modules/@spexcode/spec-cli/dist/claude-headless.js +316 -0
- package/node_modules/@spexcode/spec-cli/dist/cli.d.ts +1 -0
- package/node_modules/@spexcode/spec-cli/dist/cli.js +1908 -0
- package/node_modules/@spexcode/spec-cli/dist/client.d.ts +112 -0
- package/node_modules/@spexcode/spec-cli/dist/client.js +481 -0
- package/node_modules/@spexcode/spec-cli/dist/cockpit.d.ts +7 -0
- package/node_modules/@spexcode/spec-cli/dist/cockpit.js +26 -0
- package/node_modules/@spexcode/spec-cli/dist/codex-headless.d.ts +1 -0
- package/{spec-cli/src/codex-headless.ts → node_modules/@spexcode/spec-cli/dist/codex-headless.js} +3 -9
- package/node_modules/@spexcode/spec-cli/dist/codex-runtime-generations.d.ts +58 -0
- package/node_modules/@spexcode/spec-cli/dist/codex-runtime-generations.js +798 -0
- package/node_modules/@spexcode/spec-cli/dist/commit-surgery.d.ts +1 -0
- package/node_modules/@spexcode/spec-cli/dist/commit-surgery.js +90 -0
- package/node_modules/@spexcode/spec-cli/dist/contract-filter.d.ts +14 -0
- package/node_modules/@spexcode/spec-cli/dist/contract-filter.js +219 -0
- package/node_modules/@spexcode/spec-cli/dist/dashboard-assets.d.ts +6 -0
- package/node_modules/@spexcode/spec-cli/dist/dashboard-assets.js +50 -0
- package/node_modules/@spexcode/spec-cli/dist/doctor.d.ts +9 -0
- package/node_modules/@spexcode/spec-cli/dist/doctor.js +553 -0
- package/node_modules/@spexcode/spec-cli/dist/eval-host.d.ts +1 -0
- package/node_modules/@spexcode/spec-cli/dist/eval-host.js +19 -0
- package/node_modules/@spexcode/spec-cli/dist/execution-trace.d.ts +26 -0
- package/node_modules/@spexcode/spec-cli/dist/execution-trace.js +475 -0
- package/node_modules/@spexcode/spec-cli/dist/file-write.d.ts +2 -0
- package/node_modules/@spexcode/spec-cli/dist/file-write.js +26 -0
- package/node_modules/@spexcode/spec-cli/dist/flat.d.ts +89 -0
- package/node_modules/@spexcode/spec-cli/dist/flat.js +1076 -0
- package/node_modules/@spexcode/spec-cli/dist/gateway-auth.d.ts +56 -0
- package/node_modules/@spexcode/spec-cli/dist/gateway-auth.js +168 -0
- package/node_modules/@spexcode/spec-cli/dist/gateway-hub.d.ts +28 -0
- package/node_modules/@spexcode/spec-cli/dist/gateway-hub.js +363 -0
- package/node_modules/@spexcode/spec-cli/dist/gateway.d.ts +38 -0
- package/node_modules/@spexcode/spec-cli/dist/gateway.js +527 -0
- package/node_modules/@spexcode/spec-cli/dist/graphCache.d.ts +27 -0
- package/node_modules/@spexcode/spec-cli/dist/graphCache.js +717 -0
- package/node_modules/@spexcode/spec-cli/dist/graphSnapshot.d.ts +14 -0
- package/node_modules/@spexcode/spec-cli/dist/graphSnapshot.js +36 -0
- package/node_modules/@spexcode/spec-cli/dist/graphStream.d.ts +85 -0
- package/node_modules/@spexcode/spec-cli/dist/graphStream.js +1195 -0
- package/node_modules/@spexcode/spec-cli/dist/guidance-catalog.d.ts +64 -0
- package/node_modules/@spexcode/spec-cli/dist/guidance-catalog.js +166 -0
- package/node_modules/@spexcode/spec-cli/dist/guide.d.ts +8 -0
- package/{spec-cli/src/guide.ts → node_modules/@spexcode/spec-cli/dist/guide.js} +36 -32
- package/node_modules/@spexcode/spec-cli/dist/harness-select.d.ts +18 -0
- package/node_modules/@spexcode/spec-cli/dist/harness-select.js +62 -0
- package/node_modules/@spexcode/spec-cli/dist/harness.d.ts +338 -0
- package/node_modules/@spexcode/spec-cli/dist/harness.js +3146 -0
- package/node_modules/@spexcode/spec-cli/dist/headless-controller.d.ts +9 -0
- package/node_modules/@spexcode/spec-cli/dist/headless-controller.js +47 -0
- package/node_modules/@spexcode/spec-cli/dist/help.d.ts +15 -0
- package/node_modules/@spexcode/spec-cli/dist/help.js +594 -0
- package/node_modules/@spexcode/spec-cli/dist/hook-prompts.d.ts +18 -0
- package/node_modules/@spexcode/spec-cli/dist/hook-prompts.js +122 -0
- package/node_modules/@spexcode/spec-cli/dist/hooks.d.ts +1 -0
- package/{spec-cli/src/hooks.ts → node_modules/@spexcode/spec-cli/dist/hooks.js} +15 -15
- package/node_modules/@spexcode/spec-cli/dist/host-resources.d.ts +97 -0
- package/node_modules/@spexcode/spec-cli/dist/host-resources.js +795 -0
- package/node_modules/@spexcode/spec-cli/dist/host.d.ts +88 -0
- package/node_modules/@spexcode/spec-cli/dist/host.js +663 -0
- package/node_modules/@spexcode/spec-cli/dist/index.d.ts +1 -0
- package/node_modules/@spexcode/spec-cli/dist/index.js +899 -0
- package/node_modules/@spexcode/spec-cli/dist/init.d.ts +1 -0
- package/node_modules/@spexcode/spec-cli/dist/init.js +284 -0
- package/node_modules/@spexcode/spec-cli/dist/issues-cli.d.ts +6 -0
- package/node_modules/@spexcode/spec-cli/dist/issues-cli.js +334 -0
- package/node_modules/@spexcode/spec-cli/dist/issues.d.ts +69 -0
- package/node_modules/@spexcode/spec-cli/dist/issues.js +189 -0
- package/node_modules/@spexcode/spec-cli/dist/lint.d.ts +34 -0
- package/node_modules/@spexcode/spec-cli/dist/lint.js +476 -0
- package/node_modules/@spexcode/spec-cli/dist/listen.d.ts +8 -0
- package/node_modules/@spexcode/spec-cli/dist/listen.js +24 -0
- package/node_modules/@spexcode/spec-cli/dist/localIssues.d.ts +65 -0
- package/node_modules/@spexcode/spec-cli/dist/localIssues.js +582 -0
- package/node_modules/@spexcode/spec-cli/dist/login-page.d.ts +5 -0
- package/{spec-cli/src/login-page.ts → node_modules/@spexcode/spec-cli/dist/login-page.js} +7 -7
- package/node_modules/@spexcode/spec-cli/dist/loop-in.d.ts +23 -0
- package/{spec-cli/src/loop-in.ts → node_modules/@spexcode/spec-cli/dist/loop-in.js} +35 -45
- package/node_modules/@spexcode/spec-cli/dist/machine-peer.d.ts +69 -0
- package/node_modules/@spexcode/spec-cli/dist/machine-peer.js +603 -0
- package/node_modules/@spexcode/spec-cli/dist/materialize.d.ts +18 -0
- package/node_modules/@spexcode/spec-cli/dist/materialize.js +468 -0
- package/node_modules/@spexcode/spec-cli/dist/mentions.d.ts +50 -0
- package/node_modules/@spexcode/spec-cli/dist/mentions.js +117 -0
- package/node_modules/@spexcode/spec-cli/dist/opencode-headless.d.ts +5 -0
- package/node_modules/@spexcode/spec-cli/dist/opencode-headless.js +215 -0
- package/node_modules/@spexcode/spec-cli/dist/opencode.d.ts +3 -0
- package/{spec-cli/src/opencode.ts → node_modules/@spexcode/spec-cli/dist/opencode.js} +9 -13
- package/node_modules/@spexcode/spec-cli/dist/pi-harness.d.ts +3 -0
- package/{spec-cli/src/pi-harness.ts → node_modules/@spexcode/spec-cli/dist/pi-harness.js} +45 -40
- package/node_modules/@spexcode/spec-cli/dist/pi-headless.d.ts +25 -0
- package/node_modules/@spexcode/spec-cli/dist/pi-headless.js +196 -0
- package/node_modules/@spexcode/spec-cli/dist/plugin-harness.d.ts +21 -0
- package/node_modules/@spexcode/spec-cli/dist/plugin-harness.js +146 -0
- package/node_modules/@spexcode/spec-cli/dist/pty-bridge.d.ts +10 -0
- package/node_modules/@spexcode/spec-cli/dist/pty-bridge.js +404 -0
- package/node_modules/@spexcode/spec-cli/dist/pty-helper.d.mts +1 -0
- package/node_modules/@spexcode/spec-cli/dist/pty-helper.mjs +101 -0
- package/node_modules/@spexcode/spec-cli/dist/pty-native-helper.d.mts +2 -0
- package/node_modules/@spexcode/spec-cli/dist/pty-native-helper.mjs +23 -0
- package/node_modules/@spexcode/spec-cli/dist/public-graph.d.ts +46 -0
- package/node_modules/@spexcode/spec-cli/dist/public-graph.js +56 -0
- package/node_modules/@spexcode/spec-cli/dist/ranker.d.ts +15 -0
- package/node_modules/@spexcode/spec-cli/dist/ranker.js +188 -0
- package/node_modules/@spexcode/spec-cli/dist/reaper.d.ts +6 -0
- package/node_modules/@spexcode/spec-cli/dist/reaper.js +81 -0
- package/node_modules/@spexcode/spec-cli/dist/reviews.d.ts +189 -0
- package/node_modules/@spexcode/spec-cli/dist/reviews.js +350 -0
- package/node_modules/@spexcode/spec-cli/dist/runtime-guard.d.ts +6 -0
- package/node_modules/@spexcode/spec-cli/dist/runtime-guard.js +37 -0
- package/node_modules/@spexcode/spec-cli/dist/runtime-ownership.d.ts +21 -0
- package/node_modules/@spexcode/spec-cli/dist/runtime-ownership.js +84 -0
- package/node_modules/@spexcode/spec-cli/dist/runtime-rotate.d.ts +1 -0
- package/node_modules/@spexcode/spec-cli/dist/runtime-rotate.js +58 -0
- package/node_modules/@spexcode/spec-cli/dist/search.bench.d.mts +1 -0
- package/node_modules/@spexcode/spec-cli/dist/search.bench.mjs +75 -0
- package/node_modules/@spexcode/spec-cli/dist/search.d.ts +20 -0
- package/node_modules/@spexcode/spec-cli/dist/search.js +61 -0
- package/node_modules/@spexcode/spec-cli/dist/session-declarations.d.ts +13 -0
- package/node_modules/@spexcode/spec-cli/dist/session-declarations.js +126 -0
- package/node_modules/@spexcode/spec-cli/dist/session-execution.d.ts +10 -0
- package/node_modules/@spexcode/spec-cli/dist/session-execution.js +70 -0
- package/node_modules/@spexcode/spec-cli/dist/session-files.d.ts +28 -0
- package/node_modules/@spexcode/spec-cli/dist/session-files.js +130 -0
- package/node_modules/@spexcode/spec-cli/dist/session-follow.d.ts +31 -0
- package/node_modules/@spexcode/spec-cli/dist/session-follow.js +179 -0
- package/node_modules/@spexcode/spec-cli/dist/session-reparent.d.ts +10 -0
- package/node_modules/@spexcode/spec-cli/dist/session-reparent.js +33 -0
- package/node_modules/@spexcode/spec-cli/dist/session-timeline.d.ts +11 -0
- package/node_modules/@spexcode/spec-cli/dist/session-timeline.js +20 -0
- package/node_modules/@spexcode/spec-cli/dist/session-web.d.ts +24 -0
- package/node_modules/@spexcode/spec-cli/dist/session-web.js +141 -0
- package/node_modules/@spexcode/spec-cli/dist/sessions.d.ts +433 -0
- package/node_modules/@spexcode/spec-cli/dist/sessions.js +4667 -0
- package/node_modules/@spexcode/spec-cli/dist/sh.d.ts +1 -0
- package/node_modules/@spexcode/spec-cli/dist/sh.js +3 -0
- package/node_modules/@spexcode/spec-cli/dist/shim-runtime.d.ts +1 -0
- package/{spec-cli/src/shim-runtime.ts → node_modules/@spexcode/spec-cli/dist/shim-runtime.js} +3 -4
- package/node_modules/@spexcode/spec-cli/dist/slash-commands.d.ts +9 -0
- package/node_modules/@spexcode/spec-cli/dist/slash-commands.js +307 -0
- package/node_modules/@spexcode/spec-cli/dist/source-files.d.ts +9 -0
- package/node_modules/@spexcode/spec-cli/dist/source-files.js +113 -0
- package/node_modules/@spexcode/spec-cli/dist/supervise.d.ts +1 -0
- package/node_modules/@spexcode/spec-cli/dist/supervise.js +308 -0
- package/node_modules/@spexcode/spec-cli/dist/tree.d.ts +25 -0
- package/node_modules/@spexcode/spec-cli/dist/tree.js +98 -0
- package/node_modules/@spexcode/spec-cli/dist/tsx-bin.d.ts +3 -0
- package/node_modules/@spexcode/spec-cli/dist/tsx-bin.js +41 -0
- package/node_modules/@spexcode/spec-cli/dist/uninstall.d.ts +3 -0
- package/node_modules/@spexcode/spec-cli/dist/uninstall.js +177 -0
- package/node_modules/@spexcode/spec-cli/dist/uploads.d.ts +36 -0
- package/node_modules/@spexcode/spec-cli/dist/uploads.js +243 -0
- package/node_modules/@spexcode/spec-cli/dist/worktree-sources.d.ts +1 -0
- package/node_modules/@spexcode/spec-cli/dist/worktree-sources.js +47 -0
- package/{spec-cli → node_modules/@spexcode/spec-cli}/hooks/dispatch.sh +5 -5
- package/{spec-cli → node_modules/@spexcode/spec-cli}/hooks/harness.sh +1 -1
- package/node_modules/@spexcode/spec-cli/package.json +49 -0
- package/node_modules/@spexcode/spec-cli/templates/spec/project/.plugins/commands/supervisor/spec.md +8 -0
- package/{spec-cli → node_modules/@spexcode/spec-cli}/templates/spec/project/.plugins/core/spec-first/spec-first.sh +1 -1
- package/{spec-cli → node_modules/@spexcode/spec-cli}/templates/spec/project/.plugins/core/spec-of-file/spec-of-file.sh +1 -0
- package/{spec-cli → node_modules/@spexcode/spec-cli}/templates/spec/project/.plugins/core/stop-gate/spec.md +2 -2
- package/{spec-cli → node_modules/@spexcode/spec-cli}/templates/spec/project/.plugins/core/stop-gate/stop-gate.sh +31 -29
- package/node_modules/@spexcode/spec-core/dist/anchors.d.ts +94 -0
- package/node_modules/@spexcode/spec-core/dist/anchors.js +730 -0
- package/node_modules/@spexcode/spec-core/dist/git.d.ts +170 -0
- package/node_modules/@spexcode/spec-core/dist/git.js +2768 -0
- package/node_modules/@spexcode/spec-core/dist/graph-delta.d.ts +44 -0
- package/node_modules/@spexcode/spec-core/dist/graph-delta.js +72 -0
- package/node_modules/@spexcode/spec-core/dist/graph.d.ts +34 -0
- package/node_modules/@spexcode/spec-core/dist/graph.js +237 -0
- package/node_modules/@spexcode/spec-core/dist/graphDelta.d.ts +3 -0
- package/node_modules/@spexcode/spec-core/dist/graphDelta.js +13 -0
- package/node_modules/@spexcode/spec-core/dist/harness-identity.d.ts +31 -0
- package/node_modules/@spexcode/spec-core/dist/harness-identity.js +20 -0
- package/node_modules/@spexcode/spec-core/dist/identity-presets.d.ts +152 -0
- package/node_modules/@spexcode/spec-core/dist/identity-presets.js +132 -0
- package/node_modules/@spexcode/spec-core/dist/index.d.ts +45 -0
- package/node_modules/@spexcode/spec-core/dist/index.js +19 -0
- package/node_modules/@spexcode/spec-core/dist/layout.d.ts +187 -0
- package/node_modules/@spexcode/spec-core/dist/layout.js +548 -0
- package/node_modules/@spexcode/spec-core/dist/process-identity.d.ts +37 -0
- package/node_modules/@spexcode/spec-core/dist/process-identity.js +214 -0
- package/node_modules/@spexcode/spec-core/dist/project-identity.d.ts +12 -0
- package/node_modules/@spexcode/spec-core/dist/project-identity.js +71 -0
- package/node_modules/@spexcode/spec-core/dist/project-store.d.ts +3 -0
- package/node_modules/@spexcode/spec-core/dist/project-store.js +14 -0
- package/node_modules/@spexcode/spec-core/dist/resilience.d.ts +2 -0
- package/node_modules/@spexcode/spec-core/dist/resilience.js +40 -0
- package/node_modules/@spexcode/spec-core/dist/review/index.d.ts +3 -0
- package/node_modules/@spexcode/spec-core/dist/review/index.js +5 -0
- package/node_modules/@spexcode/spec-core/dist/review/reviewFilters.d.ts +77 -0
- package/node_modules/@spexcode/spec-core/dist/review/reviewFilters.js +308 -0
- package/node_modules/@spexcode/spec-core/dist/review/reviewQuery.d.ts +66 -0
- package/node_modules/@spexcode/spec-core/dist/review/reviewQuery.js +180 -0
- package/node_modules/@spexcode/spec-core/dist/review/session.d.ts +4 -0
- package/node_modules/@spexcode/spec-core/dist/review/session.js +8 -0
- package/node_modules/@spexcode/spec-core/dist/reviewSnapshot.d.ts +15 -0
- package/node_modules/@spexcode/spec-core/dist/reviewSnapshot.js +12 -0
- package/node_modules/@spexcode/spec-core/dist/root-lru.d.ts +4 -0
- package/{spec-cli/src/root-lru.ts → node_modules/@spexcode/spec-core/dist/root-lru.js} +26 -30
- package/node_modules/@spexcode/spec-core/dist/specs.d.ts +117 -0
- package/node_modules/@spexcode/spec-core/dist/specs.js +489 -0
- package/node_modules/@spexcode/spec-core/package.json +28 -0
- package/node_modules/@spexcode/spec-eval/dist/cache.d.ts +10 -0
- package/node_modules/@spexcode/spec-eval/dist/cache.js +50 -0
- package/node_modules/@spexcode/spec-eval/dist/cli.d.ts +22 -0
- package/node_modules/@spexcode/spec-eval/dist/cli.js +981 -0
- package/node_modules/@spexcode/spec-eval/dist/evaltab.d.ts +98 -0
- package/node_modules/@spexcode/spec-eval/dist/evaltab.js +176 -0
- package/node_modules/@spexcode/spec-eval/dist/filing.d.ts +16 -0
- package/node_modules/@spexcode/spec-eval/dist/filing.js +36 -0
- package/node_modules/@spexcode/spec-eval/dist/freshness.d.ts +48 -0
- package/node_modules/@spexcode/spec-eval/dist/freshness.js +799 -0
- package/node_modules/@spexcode/spec-eval/dist/host.d.ts +46 -0
- package/node_modules/@spexcode/spec-eval/dist/host.js +53 -0
- package/node_modules/@spexcode/spec-eval/dist/humanok.d.ts +11 -0
- package/node_modules/@spexcode/spec-eval/dist/humanok.js +27 -0
- package/node_modules/@spexcode/spec-eval/dist/index.d.ts +4 -0
- package/node_modules/@spexcode/spec-eval/dist/index.js +4 -0
- package/node_modules/@spexcode/spec-eval/dist/remarks.d.ts +31 -0
- package/node_modules/@spexcode/spec-eval/dist/remarks.js +1 -0
- package/node_modules/@spexcode/spec-eval/dist/scenariofresh.d.ts +13 -0
- package/node_modules/@spexcode/spec-eval/dist/scenariofresh.js +303 -0
- package/node_modules/@spexcode/spec-eval/dist/scenarios.d.ts +99 -0
- package/node_modules/@spexcode/spec-eval/dist/scenarios.js +650 -0
- package/node_modules/@spexcode/spec-eval/dist/sessioneval.d.ts +307 -0
- package/node_modules/@spexcode/spec-eval/dist/sessioneval.js +1883 -0
- package/node_modules/@spexcode/spec-eval/dist/sidecar.d.ts +55 -0
- package/node_modules/@spexcode/spec-eval/dist/sidecar.js +82 -0
- package/node_modules/@spexcode/spec-eval/dist/timeline.d.ts +25 -0
- package/node_modules/@spexcode/spec-eval/dist/timeline.js +65 -0
- package/node_modules/@spexcode/spec-eval/dist/ui-path.d.ts +1 -0
- package/node_modules/@spexcode/spec-eval/dist/ui-path.js +2 -0
- package/node_modules/@spexcode/spec-eval/package.json +36 -0
- package/node_modules/@spexcode/spec-forge/dist/cache.d.ts +29 -0
- package/node_modules/@spexcode/spec-forge/dist/cache.js +59 -0
- package/node_modules/@spexcode/spec-forge/dist/cli.d.ts +1 -0
- package/node_modules/@spexcode/spec-forge/dist/cli.js +100 -0
- package/node_modules/@spexcode/spec-forge/dist/drivers/github.d.ts +2 -0
- package/node_modules/@spexcode/spec-forge/dist/drivers/github.js +116 -0
- package/node_modules/@spexcode/spec-forge/dist/drivers/gitlab.d.ts +7 -0
- package/node_modules/@spexcode/spec-forge/dist/drivers/gitlab.js +144 -0
- package/node_modules/@spexcode/spec-forge/dist/drivers.d.ts +10 -0
- package/node_modules/@spexcode/spec-forge/dist/drivers.js +83 -0
- package/node_modules/@spexcode/spec-forge/dist/index.d.ts +4 -0
- package/node_modules/@spexcode/spec-forge/dist/index.js +4 -0
- package/node_modules/@spexcode/spec-forge/dist/links.d.ts +15 -0
- package/node_modules/@spexcode/spec-forge/dist/links.js +65 -0
- package/node_modules/@spexcode/spec-forge/dist/needs-eval.d.ts +10 -0
- package/node_modules/@spexcode/spec-forge/dist/needs-eval.js +20 -0
- package/node_modules/@spexcode/spec-forge/dist/port.d.ts +53 -0
- package/node_modules/@spexcode/spec-forge/dist/port.js +1 -0
- package/node_modules/@spexcode/spec-forge/dist/resident.d.ts +7 -0
- package/node_modules/@spexcode/spec-forge/dist/resident.js +43 -0
- package/node_modules/@spexcode/spec-forge/package.json +32 -0
- package/package.json +33 -19
- package/spec-cli/bin/spex.mjs +0 -69
- package/spec-cli/src/anchors.ts +0 -728
- package/spec-cli/src/attach.ts +0 -43
- package/spec-cli/src/claude-headless.ts +0 -321
- package/spec-cli/src/cli.ts +0 -1258
- package/spec-cli/src/client.ts +0 -414
- package/spec-cli/src/cockpit.ts +0 -43
- package/spec-cli/src/codex-runtime-generations.ts +0 -646
- package/spec-cli/src/commit-surgery.ts +0 -68
- package/spec-cli/src/contract-filter.ts +0 -202
- package/spec-cli/src/delivery-queue.ts +0 -165
- package/spec-cli/src/doctor.ts +0 -516
- package/spec-cli/src/execution-trace.ts +0 -444
- package/spec-cli/src/file-write.ts +0 -22
- package/spec-cli/src/gateway-auth.ts +0 -181
- package/spec-cli/src/gateway-hub.ts +0 -358
- package/spec-cli/src/gateway.ts +0 -461
- package/spec-cli/src/git.ts +0 -2556
- package/spec-cli/src/graph.ts +0 -271
- package/spec-cli/src/graphCache.ts +0 -710
- package/spec-cli/src/graphDelta.ts +0 -77
- package/spec-cli/src/graphStream.ts +0 -1019
- package/spec-cli/src/harness-select.ts +0 -77
- package/spec-cli/src/harness.ts +0 -3025
- package/spec-cli/src/headless-controller.ts +0 -63
- package/spec-cli/src/help.ts +0 -492
- package/spec-cli/src/host-resources.ts +0 -762
- package/spec-cli/src/host.ts +0 -611
- package/spec-cli/src/identity-presets.d.ts +0 -13
- package/spec-cli/src/identity-presets.js +0 -138
- package/spec-cli/src/index.ts +0 -818
- package/spec-cli/src/init.ts +0 -258
- package/spec-cli/src/issues-cli.ts +0 -276
- package/spec-cli/src/issues.ts +0 -237
- package/spec-cli/src/layout.ts +0 -640
- package/spec-cli/src/lint.ts +0 -488
- package/spec-cli/src/listen.ts +0 -28
- package/spec-cli/src/localIssues.ts +0 -538
- package/spec-cli/src/materialize.ts +0 -417
- package/spec-cli/src/mentions.ts +0 -81
- package/spec-cli/src/opencode-headless.ts +0 -205
- package/spec-cli/src/pi-headless.ts +0 -153
- package/spec-cli/src/plugin-harness.ts +0 -157
- package/spec-cli/src/process-identity.ts +0 -207
- package/spec-cli/src/project-identity.ts +0 -73
- package/spec-cli/src/project-store.ts +0 -17
- package/spec-cli/src/pty-bridge.ts +0 -396
- package/spec-cli/src/pty-helper.mjs +0 -96
- package/spec-cli/src/pty-native-helper.mjs +0 -22
- package/spec-cli/src/ranker.ts +0 -191
- package/spec-cli/src/reaper.ts +0 -125
- package/spec-cli/src/resilience.ts +0 -41
- package/spec-cli/src/reviewSnapshot.ts +0 -28
- package/spec-cli/src/reviews.ts +0 -434
- package/spec-cli/src/runtime-guard.ts +0 -35
- package/spec-cli/src/runtime-ownership.ts +0 -88
- package/spec-cli/src/search.bench.mjs +0 -80
- package/spec-cli/src/search.ts +0 -63
- package/spec-cli/src/session-cursors.ts +0 -91
- package/spec-cli/src/session-execution.ts +0 -68
- package/spec-cli/src/session-files.ts +0 -121
- package/spec-cli/src/session-follow.ts +0 -182
- package/spec-cli/src/session-reparent.ts +0 -33
- package/spec-cli/src/session-timeline.ts +0 -247
- package/spec-cli/src/session-web.ts +0 -135
- package/spec-cli/src/sessions.ts +0 -3883
- package/spec-cli/src/sh.ts +0 -3
- package/spec-cli/src/slash-commands.ts +0 -318
- package/spec-cli/src/source-files.ts +0 -104
- package/spec-cli/src/specs.ts +0 -498
- package/spec-cli/src/supervise.ts +0 -245
- package/spec-cli/src/tree.ts +0 -118
- package/spec-cli/src/tsx-bin.ts +0 -18
- package/spec-cli/src/uninstall.ts +0 -171
- package/spec-cli/src/uploads.ts +0 -253
- package/spec-cli/src/worktree-sources.ts +0 -42
- package/spec-cli/templates/spec/project/.plugins/commands/supervisor/spec.md +0 -8
- package/spec-dashboard/dist/assets/App-B6IbFbGu.js +0 -2
- package/spec-dashboard/dist/assets/Dashboard-C5ap-Sga.css +0 -1
- package/spec-dashboard/dist/assets/Dashboard-_sDk7Rcg.js +0 -27
- package/spec-dashboard/dist/assets/EvalsPage-BT357Lyt.js +0 -2
- package/spec-dashboard/dist/assets/IssuesPage-BG9rNOgV.js +0 -1
- package/spec-dashboard/dist/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
- package/spec-dashboard/dist/assets/KaTeX_AMS-Regular-DMm9YOAa.woff +0 -0
- package/spec-dashboard/dist/assets/KaTeX_AMS-Regular-DRggAlZN.ttf +0 -0
- package/spec-dashboard/dist/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf +0 -0
- package/spec-dashboard/dist/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff +0 -0
- package/spec-dashboard/dist/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
- package/spec-dashboard/dist/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff +0 -0
- package/spec-dashboard/dist/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
- package/spec-dashboard/dist/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf +0 -0
- package/spec-dashboard/dist/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf +0 -0
- package/spec-dashboard/dist/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff +0 -0
- package/spec-dashboard/dist/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
- package/spec-dashboard/dist/assets/KaTeX_Fraktur-Regular-CB_wures.ttf +0 -0
- package/spec-dashboard/dist/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
- package/spec-dashboard/dist/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff +0 -0
- package/spec-dashboard/dist/assets/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
- package/spec-dashboard/dist/assets/KaTeX_Main-Bold-Jm3AIy58.woff +0 -0
- package/spec-dashboard/dist/assets/KaTeX_Main-Bold-waoOVXN0.ttf +0 -0
- package/spec-dashboard/dist/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
- package/spec-dashboard/dist/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf +0 -0
- package/spec-dashboard/dist/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff +0 -0
- package/spec-dashboard/dist/assets/KaTeX_Main-Italic-3WenGoN9.ttf +0 -0
- package/spec-dashboard/dist/assets/KaTeX_Main-Italic-BMLOBm91.woff +0 -0
- package/spec-dashboard/dist/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
- package/spec-dashboard/dist/assets/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
- package/spec-dashboard/dist/assets/KaTeX_Main-Regular-Dr94JaBh.woff +0 -0
- package/spec-dashboard/dist/assets/KaTeX_Main-Regular-ypZvNtVU.ttf +0 -0
- package/spec-dashboard/dist/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf +0 -0
- package/spec-dashboard/dist/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
- package/spec-dashboard/dist/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff +0 -0
- package/spec-dashboard/dist/assets/KaTeX_Math-Italic-DA0__PXp.woff +0 -0
- package/spec-dashboard/dist/assets/KaTeX_Math-Italic-flOr_0UB.ttf +0 -0
- package/spec-dashboard/dist/assets/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
- package/spec-dashboard/dist/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf +0 -0
- package/spec-dashboard/dist/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
- package/spec-dashboard/dist/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff +0 -0
- package/spec-dashboard/dist/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
- package/spec-dashboard/dist/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff +0 -0
- package/spec-dashboard/dist/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf +0 -0
- package/spec-dashboard/dist/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf +0 -0
- package/spec-dashboard/dist/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff +0 -0
- package/spec-dashboard/dist/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
- package/spec-dashboard/dist/assets/KaTeX_Script-Regular-C5JkGWo-.ttf +0 -0
- package/spec-dashboard/dist/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
- package/spec-dashboard/dist/assets/KaTeX_Script-Regular-D5yQViql.woff +0 -0
- package/spec-dashboard/dist/assets/KaTeX_Size1-Regular-C195tn64.woff +0 -0
- package/spec-dashboard/dist/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf +0 -0
- package/spec-dashboard/dist/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
- package/spec-dashboard/dist/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf +0 -0
- package/spec-dashboard/dist/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
- package/spec-dashboard/dist/assets/KaTeX_Size2-Regular-oD1tc_U0.woff +0 -0
- package/spec-dashboard/dist/assets/KaTeX_Size3-Regular-CTq5MqoE.woff +0 -0
- package/spec-dashboard/dist/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf +0 -0
- package/spec-dashboard/dist/assets/KaTeX_Size4-Regular-BF-4gkZK.woff +0 -0
- package/spec-dashboard/dist/assets/KaTeX_Size4-Regular-DWFBv043.ttf +0 -0
- package/spec-dashboard/dist/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
- package/spec-dashboard/dist/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff +0 -0
- package/spec-dashboard/dist/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
- package/spec-dashboard/dist/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf +0 -0
- package/spec-dashboard/dist/assets/MobileApp-D9yPMR3A.js +0 -2
- package/spec-dashboard/dist/assets/Modal-B3EcgeA3.js +0 -1
- package/spec-dashboard/dist/assets/PageScroll-CNZOugWV.js +0 -1
- package/spec-dashboard/dist/assets/ProjectsPage-C2CRHmvs.js +0 -1
- package/spec-dashboard/dist/assets/SessionInterface-6GBZ9nXN.css +0 -32
- package/spec-dashboard/dist/assets/SessionInterface-DOEjuT3l.js +0 -40
- package/spec-dashboard/dist/assets/SessionWindow-1nYgZ4CL.js +0 -1
- package/spec-dashboard/dist/assets/Settings-7WeTJn0V.js +0 -1
- package/spec-dashboard/dist/assets/Thread-CEbzAFQn.js +0 -13
- package/spec-dashboard/dist/assets/bindings-BC9vqpYU.js +0 -1
- package/spec-dashboard/dist/assets/data-SlvxNA2r.js +0 -1
- package/spec-dashboard/dist/assets/index-DLVeOHL-.js +0 -41
- package/spec-dashboard/dist/assets/index-DYLGfPjx.css +0 -1
- package/spec-dashboard/dist/assets/launch-Cp579UoJ.css +0 -1
- package/spec-dashboard/dist/assets/launch-yxCYr64x.js +0 -276
- package/spec-dashboard/dist/assets/sessionSurface--7l69h4F.js +0 -1
- package/spec-dashboard/dist/index.html +0 -29
- package/spec-dashboard/src/reviewFilters.js +0 -322
- package/spec-dashboard/src/reviewQuery.js +0 -174
- package/spec-dashboard/src/session.js +0 -199
- package/spec-eval/src/cache.ts +0 -57
- package/spec-eval/src/cli.ts +0 -894
- package/spec-eval/src/evaltab.ts +0 -264
- package/spec-eval/src/filing.ts +0 -39
- package/spec-eval/src/freshness.ts +0 -836
- package/spec-eval/src/humanok.ts +0 -28
- package/spec-eval/src/scenariofresh.ts +0 -244
- package/spec-eval/src/scenarios.ts +0 -672
- package/spec-eval/src/sessioneval.ts +0 -2220
- package/spec-eval/src/sidecar.ts +0 -93
- package/spec-eval/src/timeline.ts +0 -54
- package/spec-forge/src/__fixtures__/github-forge.json +0 -63
- package/spec-forge/src/cache.ts +0 -66
- package/spec-forge/src/cli.ts +0 -99
- package/spec-forge/src/drivers/github.ts +0 -132
- package/spec-forge/src/drivers/gitlab.ts +0 -153
- package/spec-forge/src/drivers.ts +0 -73
- package/spec-forge/src/links.ts +0 -72
- package/spec-forge/src/needs-eval.ts +0 -29
- package/spec-forge/src/port.ts +0 -36
- package/spec-forge/src/resident.ts +0 -46
- /package/{spec-cli → node_modules/@spexcode/spec-cli}/README.md +0 -0
- /package/{spec-cli → node_modules/@spexcode/spec-cli}/hooks/compat/mark-active-0.5.2-eef1.fixture +0 -0
- /package/{spec-cli → node_modules/@spexcode/spec-cli}/hooks/compat/mark-active-sed-v0.fixture +0 -0
- /package/{spec-cli → node_modules/@spexcode/spec-cli}/templates/hooks/commit-msg +0 -0
- /package/{spec-cli → node_modules/@spexcode/spec-cli}/templates/hooks/post-checkout +0 -0
- /package/{spec-cli → node_modules/@spexcode/spec-cli}/templates/hooks/post-merge +0 -0
- /package/{spec-cli → node_modules/@spexcode/spec-cli}/templates/hooks/pre-commit +0 -0
- /package/{spec-cli → node_modules/@spexcode/spec-cli}/templates/hooks/prepare-commit-msg +0 -0
- /package/{spec-cli → node_modules/@spexcode/spec-cli}/templates/hooks/reference-transaction +0 -0
- /package/{spec-cli → node_modules/@spexcode/spec-cli}/templates/spec/project/.plugins/commands/extract/spec.md +0 -0
- /package/{spec-cli → node_modules/@spexcode/spec-cli}/templates/spec/project/.plugins/commands/regroup/spec.md +0 -0
- /package/{spec-cli → node_modules/@spexcode/spec-cli}/templates/spec/project/.plugins/commands/rename/spec.md +0 -0
- /package/{spec-cli → node_modules/@spexcode/spec-cli}/templates/spec/project/.plugins/commands/spec.md +0 -0
- /package/{spec-cli → node_modules/@spexcode/spec-cli}/templates/spec/project/.plugins/commands/tidy/spec.md +0 -0
- /package/{spec-cli → node_modules/@spexcode/spec-cli}/templates/spec/project/.plugins/core/comment-altitude/spec.md +0 -0
- /package/{spec-cli → node_modules/@spexcode/spec-cli}/templates/spec/project/.plugins/core/idle/idle.sh +0 -0
- /package/{spec-cli → node_modules/@spexcode/spec-cli}/templates/spec/project/.plugins/core/idle/spec.md +0 -0
- /package/{spec-cli → node_modules/@spexcode/spec-cli}/templates/spec/project/.plugins/core/mark-active/mark-active.sh +0 -0
- /package/{spec-cli → node_modules/@spexcode/spec-cli}/templates/spec/project/.plugins/core/mark-active/spec.md +0 -0
- /package/{spec-cli → node_modules/@spexcode/spec-cli}/templates/spec/project/.plugins/core/session-fail/fail.sh +0 -0
- /package/{spec-cli → node_modules/@spexcode/spec-cli}/templates/spec/project/.plugins/core/session-fail/spec.md +0 -0
- /package/{spec-cli → node_modules/@spexcode/spec-cli}/templates/spec/project/.plugins/core/spec-first/spec.md +0 -0
- /package/{spec-cli → node_modules/@spexcode/spec-cli}/templates/spec/project/.plugins/core/spec-of-file/spec.md +0 -0
- /package/{spec-cli → node_modules/@spexcode/spec-cli}/templates/spec/project/.plugins/core/spec.md +0 -0
- /package/{spec-cli → node_modules/@spexcode/spec-cli}/templates/spec/project/.plugins/prompts/atomic-landing/spec.md +0 -0
- /package/{spec-cli → node_modules/@spexcode/spec-cli}/templates/spec/project/.plugins/prompts/forge-link/spec.md +0 -0
- /package/{spec-cli → node_modules/@spexcode/spec-cli}/templates/spec/project/.plugins/prompts/memory-hygiene/spec.md +0 -0
- /package/{spec-cli → node_modules/@spexcode/spec-cli}/templates/spec/project/.plugins/prompts/reproduce-before-fix/spec.md +0 -0
- /package/{spec-cli → node_modules/@spexcode/spec-cli}/templates/spec/project/.plugins/prompts/spec.md +0 -0
- /package/{spec-cli → node_modules/@spexcode/spec-cli}/templates/spec/project/.plugins/skills/distill/digest.mjs +0 -0
- /package/{spec-cli → node_modules/@spexcode/spec-cli}/templates/spec/project/.plugins/skills/distill/spec.md +0 -0
- /package/{spec-cli → node_modules/@spexcode/spec-cli}/templates/spec/project/.plugins/skills/spec.md +0 -0
- /package/{spec-cli → node_modules/@spexcode/spec-cli}/templates/spec/project/.plugins/spec.md +0 -0
- /package/{spec-cli → node_modules/@spexcode/spec-cli}/templates/spec/project/spec.md +0 -0
- /package/{spec-cli → node_modules/@spexcode/spec-core}/templates/spexcode.json +0 -0
|
@@ -1,417 +0,0 @@
|
|
|
1
|
-
import { writeFileSync, mkdirSync, readFileSync, existsSync, readdirSync, renameSync, rmSync, rmdirSync } from 'node:fs'
|
|
2
|
-
import { join, dirname, relative } from 'node:path'
|
|
3
|
-
import { fileURLToPath } from 'node:url'
|
|
4
|
-
import { execFileSync } from 'node:child_process'
|
|
5
|
-
import { loadSystemConfig, loadSkillConfig, loadAgentConfig, loadConfig } from './specs.js'
|
|
6
|
-
import { compileManifest } from './hooks.js'
|
|
7
|
-
import { writeManagedBlock, removeManagedBlock, HARNESSES, type HarnessArtifacts } from './harness.js'
|
|
8
|
-
import { git, gitBinary } from './git.js'
|
|
9
|
-
import { runtimeRoot, treeSlotDir, mainCheckout, readConfig } from './layout.js'
|
|
10
|
-
import { resolveHarnessTargets, partitionHarnesses } from './harness-select.js'
|
|
11
|
-
import { emitPlugin, cleanPlugin, pluginBundleDir, pluginVersion } from './plugin-harness.js'
|
|
12
|
-
import { clearContractFilterPayload, contractFilterPlanted, plantContractFilter, removeContractFilter, settleIndexStat, type ContractFilterBinding, type ContractFilterPayload } from './contract-filter.js'
|
|
13
|
-
import { writeFileIfChanged } from './file-write.js'
|
|
14
|
-
|
|
15
|
-
export type MaterializedArtifact = {
|
|
16
|
-
kind: 'hook manifest' | 'contract' | 'shim' | 'skill' | 'agent' | 'plugin bundle' | 'trust'
|
|
17
|
-
path: string
|
|
18
|
-
}
|
|
19
|
-
export type MaterializeResult = { contentHash: string; planted: MaterializedArtifact[] }
|
|
20
|
-
|
|
21
|
-
const PKG = fileURLToPath(new URL('..', import.meta.url)) // installed spec-cli root
|
|
22
|
-
const DISPATCH = join(PKG, 'hooks', 'dispatch.sh')
|
|
23
|
-
// the ONE spex entry: the launcher (bin/spex.mjs), never a raw `tsx cli.ts` pair — the launcher owns tsx
|
|
24
|
-
// resolution AND the mid-merge guard (a conflicted source tree degrades to one line + exit 75, not an
|
|
25
|
-
// esbuild stacktrace), so every hook-baked callback inherits both.
|
|
26
|
-
const SPEX = join(PKG, 'bin', 'spex.mjs')
|
|
27
|
-
// the manifest + content-hash marker + plugin-folder ledger land in the materialized TREE's own slot of the
|
|
28
|
-
// GLOBAL per-project store (layout.treeSlotDir — trees/<enc-worktree>), NOT the worktree and NOT one shared
|
|
29
|
-
// per-project file: each is a pure function of ONE tree's .plugins, and the old single slot let the last-
|
|
30
|
-
// materialized tree's hook set reach every other tree's dispatch ([[hook-dispatch]]). The worktree keeps
|
|
31
|
-
// zero SpexCode-materialized runtime; only the harness-discovered contract files + shims (which the harness
|
|
32
|
-
// must find in-tree) are written under proj below.
|
|
33
|
-
|
|
34
|
-
// the deterministic content fingerprint of the config roots + THE TOOLCHAIN ITSELF (`hp_config_hash` in the
|
|
35
|
-
// shell mirror, harness.sh). Stamped as a freshness record after every materialize; it folds in
|
|
36
|
-
// hp_toolchain_version (the toolchain-side content hash), so a stale stamp is diagnosable after a toolchain
|
|
37
|
-
// update ([[harness-delivery]]).
|
|
38
|
-
export function contentHash(proj: string): string {
|
|
39
|
-
try {
|
|
40
|
-
const harnessSh = join(PKG, 'hooks', 'harness.sh')
|
|
41
|
-
const gitDir = dirname(gitBinary(process.env))
|
|
42
|
-
const env = { ...process.env, PATH: `${gitDir}:${process.env.PATH || ''}` }
|
|
43
|
-
return execFileSync('bash', ['-c', `cd "${proj}" && . "${harnessSh}" && hp_config_hash`], { env }).toString().trim()
|
|
44
|
-
} catch { return '' }
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export function retiredAxisNotice(cfg: { render?: string; private?: boolean }): void {
|
|
48
|
-
if (!cfg.render?.trim() && !cfg.private) return
|
|
49
|
-
const field = cfg.render?.trim() ? `"render": "${cfg.render.trim()}"` : '"private": true'
|
|
50
|
-
console.error(
|
|
51
|
-
`spexcode: the render vote is retired — ${field} is ignored. Materialized artifacts are never tracked:\n` +
|
|
52
|
-
` tree-local ignore rules live in a filtered working .gitignore, and a host-tracked contract is covered by the\n` +
|
|
53
|
-
` clean/smudge filter, and a clone without spex runs \`spex materialize\` in its setup step. Remove the\n` +
|
|
54
|
-
` field from spexcode.json / spexcode.local.json to retire this notice (see \`spex guide footprint\`).`,
|
|
55
|
-
)
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
function gitCommonDirOf(proj: string): string {
|
|
59
|
-
return git(['-C', proj, 'rev-parse', '--path-format=absolute', '--git-common-dir']).trim()
|
|
60
|
-
}
|
|
61
|
-
function infoExcludePath(proj: string): string {
|
|
62
|
-
return join(gitCommonDirOf(proj), 'info', 'exclude')
|
|
63
|
-
}
|
|
64
|
-
function isTracked(proj: string, file: string): boolean {
|
|
65
|
-
try { git(['-C', proj, 'ls-files', '--error-unmatch', file]); return true } catch { return false }
|
|
66
|
-
}
|
|
67
|
-
function clearSkipWorktree(proj: string, file: string): void {
|
|
68
|
-
if (!isTracked(proj, file)) return
|
|
69
|
-
try { git(['-C', proj, 'update-index', '--no-skip-worktree', file]) } catch {}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
function registeredTrees(proj: string): string[] {
|
|
73
|
-
const rows = git(['-C', mainCheckout(proj), 'worktree', 'list', '--porcelain', '-z']).split('\0')
|
|
74
|
-
return rows.filter((row) => row.startsWith('worktree ')).map((row) => row.slice('worktree '.length))
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
function selectionBody(selected: typeof HARNESSES, plugin = false): string {
|
|
78
|
-
return [...new Set([...selected.map((h) => h.dispatchId), ...(plugin ? ['plugin'] : [])])].sort().join('\n') + '\n'
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
function publishSelection(path: string, body: string): void {
|
|
82
|
-
try { if (readFileSync(path, 'utf8') === body) return } catch (error: any) { if (error?.code !== 'ENOENT') throw error }
|
|
83
|
-
const prepared = `${path}.${process.pid}.tmp`
|
|
84
|
-
writeFileSync(prepared, body)
|
|
85
|
-
renameSync(prepared, path)
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
function managedBlockPattern(comment: readonly [string, string]): RegExp {
|
|
89
|
-
const [open, close] = comment
|
|
90
|
-
const escape = (value: string) => value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
|
|
91
|
-
return new RegExp(`\\n*${escape(`${open}spexcode:start${close}`)}[\\s\\S]*?${escape(`${open}spexcode:end${close}`)}\\n*`)
|
|
92
|
-
}
|
|
93
|
-
export function stripSpexcodeBlock(text: string, comment: readonly [string, string] = ['<!-- ', ' -->']): string {
|
|
94
|
-
const sentinel = managedBlockPattern(comment)
|
|
95
|
-
const m = sentinel.exec(text)
|
|
96
|
-
if (!m) return text
|
|
97
|
-
// mirror removeManagedBlock exactly: our block + its surrounding blanks collapse to one '\n', and only a
|
|
98
|
-
// block sitting at the TOP of the file drops the leading newline (a host file beginning with its own
|
|
99
|
-
// blank lines keeps them — clean(smudge(x)) == x).
|
|
100
|
-
const replaced = text.replace(sentinel, '\n')
|
|
101
|
-
return m.index === 0 ? replaced.replace(/^\n+/, '') : replaced
|
|
102
|
-
}
|
|
103
|
-
function hostContentOf(file: string): string {
|
|
104
|
-
if (!existsSync(file)) return ''
|
|
105
|
-
return stripSpexcodeBlock(readFileSync(file, 'utf8'))
|
|
106
|
-
}
|
|
107
|
-
// the identity stamp on every generated skill/agent file — what lets the erase phase forget a product whose
|
|
108
|
-
// NODE was renamed or deleted (the name-scoped sweep can only reconstruct paths the LIVE config still names).
|
|
109
|
-
export const GENERATED_MARK = '<!-- spexcode:generated -->'
|
|
110
|
-
function pruneGeneratedSkills(dir: string | null, keep: ReadonlySet<string>): boolean {
|
|
111
|
-
if (!dir || !existsSync(dir)) return false
|
|
112
|
-
let changed = false
|
|
113
|
-
for (const e of readdirSync(dir, { withFileTypes: true })) {
|
|
114
|
-
if (!e.isDirectory()) continue
|
|
115
|
-
const f = join(dir, e.name, 'SKILL.md')
|
|
116
|
-
try {
|
|
117
|
-
if (!keep.has(e.name) && existsSync(f) && readFileSync(f, 'utf8').includes(GENERATED_MARK)) {
|
|
118
|
-
rmSync(join(dir, e.name), { recursive: true, force: true })
|
|
119
|
-
changed = true
|
|
120
|
-
}
|
|
121
|
-
} catch { /* unreadable → not provably ours */ }
|
|
122
|
-
}
|
|
123
|
-
return changed
|
|
124
|
-
}
|
|
125
|
-
function pruneGeneratedAgents(dir: string | null, keep: ReadonlySet<string>): boolean {
|
|
126
|
-
if (!dir || !existsSync(dir)) return false
|
|
127
|
-
let changed = false
|
|
128
|
-
for (const e of readdirSync(dir, { withFileTypes: true })) {
|
|
129
|
-
if (!e.isFile() || !e.name.endsWith('.md')) continue
|
|
130
|
-
const f = join(dir, e.name)
|
|
131
|
-
try {
|
|
132
|
-
if (!keep.has(e.name.slice(0, -3)) && readFileSync(f, 'utf8').includes(GENERATED_MARK)) {
|
|
133
|
-
rmSync(f, { force: true })
|
|
134
|
-
changed = true
|
|
135
|
-
}
|
|
136
|
-
} catch { /* unreadable → not provably ours */ }
|
|
137
|
-
}
|
|
138
|
-
return changed
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
type TreeTargets = {
|
|
142
|
-
contracts: ReadonlySet<string>
|
|
143
|
-
treeShims: ReadonlySet<string>
|
|
144
|
-
anchors: ReadonlySet<string>
|
|
145
|
-
skills: ReadonlyMap<string, ReadonlySet<string>>
|
|
146
|
-
agents: ReadonlyMap<string, ReadonlySet<string>>
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
function cleanupHarnessDirs(proj: string): void {
|
|
150
|
-
const roots = new Set([proj, mainCheckout(proj)])
|
|
151
|
-
const dirs = HARNESSES.flatMap((h) => {
|
|
152
|
-
const anchor = h.worktreeHookAnchor(proj)
|
|
153
|
-
return [h.skillDir(proj), h.agentDir(proj), dirname(h.shimFile(proj)), anchor ? dirname(anchor) : null]
|
|
154
|
-
}).filter((d): d is string => !!d)
|
|
155
|
-
for (const d of [...new Set([...dirs, ...dirs.map((dir) => dirname(dir))])]
|
|
156
|
-
.filter((dir) => !roots.has(dir)).sort((a, b) => b.length - a.length)) {
|
|
157
|
-
try { rmdirSync(d) } catch {}
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
function reconcileTree(proj: string, targets: TreeTargets, tracked: (file: string) => boolean): void {
|
|
162
|
-
let removed = false
|
|
163
|
-
const contractFiles = new Set(HARNESSES.flatMap((h) => h.contractFiles(proj)))
|
|
164
|
-
for (const file of contractFiles) {
|
|
165
|
-
if (targets.contracts.has(file) || !existsSync(file)) continue
|
|
166
|
-
const text = readFileSync(file, 'utf8')
|
|
167
|
-
if (!text.includes('<!-- spexcode:start -->')) continue
|
|
168
|
-
removeManagedBlock(file, ['<!-- ', ' -->'], !tracked(file))
|
|
169
|
-
removed = true
|
|
170
|
-
}
|
|
171
|
-
const treeShims = new Set(HARNESSES.filter((h) => h.shimScope === 'tree').map((h) => h.shimFile(proj)))
|
|
172
|
-
const anchors = new Set(HARNESSES.map((h) => h.worktreeHookAnchor(proj)).filter((path): path is string => !!path))
|
|
173
|
-
for (const file of [...treeShims, ...anchors]) {
|
|
174
|
-
if (targets.treeShims.has(file) || targets.anchors.has(file) || !existsSync(file)) continue
|
|
175
|
-
if (readFileSync(file, 'utf8').includes('dispatch.sh')) { rmSync(file, { force: true }); removed = true }
|
|
176
|
-
}
|
|
177
|
-
for (const dir of new Set(HARNESSES.map((h) => h.skillDir(proj)).filter((path): path is string => !!path)))
|
|
178
|
-
removed = pruneGeneratedSkills(dir, targets.skills.get(dir) ?? new Set()) || removed
|
|
179
|
-
for (const dir of new Set(HARNESSES.map((h) => h.agentDir(proj)).filter((path): path is string => !!path)))
|
|
180
|
-
removed = pruneGeneratedAgents(dir, targets.agents.get(dir) ?? new Set()) || removed
|
|
181
|
-
if (removed) cleanupHarnessDirs(proj)
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
function eraseTree(proj: string, arts: HarnessArtifacts, preserveProject: boolean): void {
|
|
185
|
-
for (const h of HARNESSES) {
|
|
186
|
-
// h.clean = the adapter's surgical inverse: contract block (sentinels, deleteIfEmpty), the dispatch.sh-
|
|
187
|
-
// stamped shim + worktree anchor, the trust block, and the arts-named skill/agent files.
|
|
188
|
-
h.clean(proj, arts, preserveProject)
|
|
189
|
-
for (const f of h.contractFiles(proj)) clearSkipWorktree(proj, f)
|
|
190
|
-
pruneGeneratedSkills(h.skillDir(proj), new Set())
|
|
191
|
-
pruneGeneratedAgents(h.agentDir(proj), new Set())
|
|
192
|
-
}
|
|
193
|
-
// same authorship rule as the contract files: deleteIfEmpty only when .gitignore is UNTRACKED (wholly-ours
|
|
194
|
-
// generated file); a HOST-TRACKED .gitignore that carried nothing but our block is stripped, never deleted.
|
|
195
|
-
removeManagedBlock(join(proj, '.gitignore'), ['# ', ''], !isTracked(proj, '.gitignore'))
|
|
196
|
-
clearContractFilterPayload(proj, [...HARNESSES.flatMap((h) => h.contractFiles(proj)), join(proj, '.gitignore')])
|
|
197
|
-
// the block-strip left tracked contract files stat-dirty (under a filter git NEVER content-verifies them,
|
|
198
|
-
// and even unfiltered the phantom-`M` lingers) — settle the index stat, content-guarded so a user's real
|
|
199
|
-
// unstaged edit is never staged ([[content-filter]] edge 2).
|
|
200
|
-
try { settleIndexStat(proj, HARNESSES.flatMap((h) => h.contractFiles(proj))) } catch { /* not a git repo */ }
|
|
201
|
-
// leaving nothing behind: drop the now-EMPTY dirs the assert phase mkdir'ed (.claude/.codex/.opencode/.pi
|
|
202
|
-
// and their skills/agents/plugins/extensions subdirs). Each dir AND its parent are swept deepest-first,
|
|
203
|
-
// because a harness may nest its shim a level below its home (opencode's .opencode/plugins/, pi's
|
|
204
|
-
// .pi/extensions/) — but never the checkout roots themselves. rmdirSync is NON-recursive, so a dir holding
|
|
205
|
-
// any user file survives untouched; `.git/spexcode/` is deliberately NOT swept (shared per-clone home).
|
|
206
|
-
cleanupHarnessDirs(proj)
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
export function dematerialize(proj = process.cwd(), arts: HarnessArtifacts = { skills: [], agents: [] }): void {
|
|
210
|
-
const trees = registeredTrees(proj)
|
|
211
|
-
const current = git(['-C', proj, 'rev-parse', '--show-toplevel']).trim()
|
|
212
|
-
for (const tree of trees) {
|
|
213
|
-
if (!existsSync(tree)) throw new Error(`cannot dematerialize project while registered worktree ${tree} is inaccessible — repair or remove/prune it first`)
|
|
214
|
-
git(['-C', tree, 'rev-parse', '--show-toplevel'])
|
|
215
|
-
}
|
|
216
|
-
for (const tree of trees) {
|
|
217
|
-
// Only the caller's live spec may widen the name sweep. Siblings are identity-stamp-only: the
|
|
218
|
-
// same name there may be user-owned or may not exist in this tree's divergent spec at all.
|
|
219
|
-
eraseTree(tree, tree === current ? arts : { skills: [], agents: [] }, false)
|
|
220
|
-
}
|
|
221
|
-
try { removeManagedBlock(infoExcludePath(proj), ['# ', ''], false) } catch { /* not a git repo */ }
|
|
222
|
-
removeContractFilter(proj, [...HARNESSES.flatMap((h) => h.contractFiles(proj)), join(proj, '.gitignore')], true)
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
// the whole pay-per-change materialize. proj defaults to cwd. Its receipt is populated at each successful
|
|
226
|
-
// write so callers report the actual selected footprint instead of maintaining a second artifact inventory.
|
|
227
|
-
export function materialize(proj = process.cwd()): MaterializeResult {
|
|
228
|
-
const rt = treeSlotDir(proj) // this tree's slot in the global store, not the worktree
|
|
229
|
-
mkdirSync(rt, { recursive: true })
|
|
230
|
-
const planted: MaterializedArtifact[] = []
|
|
231
|
-
const record = (kind: MaterializedArtifact['kind'], path: string) => {
|
|
232
|
-
if (!planted.some((a) => a.kind === kind && a.path === path)) planted.push({ kind, path })
|
|
233
|
-
}
|
|
234
|
-
// (1) hook manifest (persistent — the dispatcher reads it; regenerated only here, on change).
|
|
235
|
-
const manifest = join(rt, 'hooks-manifest')
|
|
236
|
-
writeFileIfChanged(manifest, compileManifest())
|
|
237
|
-
record('hook manifest', manifest)
|
|
238
|
-
// (2) the contract = the surface:system plugin bodies (in name order), written WHOLE into EACH harness's
|
|
239
|
-
// contract file(s) + (3) each harness's thin shim → dispatch.sh + (4) its trust. All owned by the adapter.
|
|
240
|
-
// ONE source, no per-project escape hatch: the contract IS the surface:system plugin bodies. A project's
|
|
241
|
-
// own hand-written prose is not folded in — repo-local notes belong in the harness file's own
|
|
242
|
-
// block-outside region (untracked, per-clone), and anything that must reach EVERY agent is a plugin node.
|
|
243
|
-
const contract = loadSystemConfig().map((c) => c.body.trim()).filter(Boolean).join('\n\n')
|
|
244
|
-
// WHICH harnesses to deliver into ([[harness-select]]): this tree's explicit spexcode.json `harnesses` set.
|
|
245
|
-
// resolveHarnessTargets FAILS LOUD on an illegal set (plugin+native, plugin w/o folder).
|
|
246
|
-
const cfg = readConfig(proj)
|
|
247
|
-
const targets = resolveHarnessTargets(cfg.harnesses)
|
|
248
|
-
retiredAxisNotice(cfg) // [[residence]] — the vote axis is retired
|
|
249
|
-
const { selected, plugins } = partitionHarnesses(targets)
|
|
250
|
-
const skillNodes = loadSkillConfig()
|
|
251
|
-
const agentNodes = loadAgentConfig()
|
|
252
|
-
const commandNodes = loadConfig()
|
|
253
|
-
|
|
254
|
-
// a skill node → the agentskills.io SKILL.md primitive: `name`+`description` frontmatter (the load-trigger)
|
|
255
|
-
// over the body instructions, closed by the GENERATED_MARK identity stamp (what the erase phase keys on).
|
|
256
|
-
// One pure artifact builder shared by every harness — divergence is only its skillDir.
|
|
257
|
-
const skillArtifact = (sk: { name: string; desc: string; body: string }) =>
|
|
258
|
-
`---\nname: ${sk.name}\ndescription: ${JSON.stringify(sk.desc)}\n---\n\n${sk.body}\n\n${GENERATED_MARK}\n`
|
|
259
|
-
// an agent node → a coding-agent sub-agent definition (the same primitive .claude/agents/*.md ships): the
|
|
260
|
-
// node's `desc` is the on-demand load-trigger, its `tools` the harness tool allowlist, its body the agent's
|
|
261
|
-
// system prompt. Same stamp, same reason.
|
|
262
|
-
const agentArtifact = (ag: { name: string; desc: string; tools: string[]; body: string }) =>
|
|
263
|
-
`---\nname: ${ag.name}\ndescription: ${ag.desc}\ntools: ${ag.tools.join(', ')}\n---\n\n${ag.body}\n\n${GENERATED_MARK}\n`
|
|
264
|
-
// a command node → a host `/`-menu command file: plugin-only (the native path serves command presets via
|
|
265
|
-
// the dashboard /api/slash-commands instead).
|
|
266
|
-
const commandArtifact = (cm: { desc: string; body: string }) =>
|
|
267
|
-
(cm.desc ? `---\ndescription: ${JSON.stringify(cm.desc)}\n---\n\n` : '') + `${cm.body}\n`
|
|
268
|
-
// materialized artifacts and machine facts both land in the same per-clone exclude; contract files are kept separate
|
|
269
|
-
// because their residence is the live three-state kind detection below, not a static entry.
|
|
270
|
-
const artifactPaths: string[] = []
|
|
271
|
-
const machinePaths: string[] = []
|
|
272
|
-
const contractTargets = new Map<string, string>()
|
|
273
|
-
const treeShimTargets = new Map<string, string>()
|
|
274
|
-
const anchorTargets = new Map<string, string>()
|
|
275
|
-
const skillTargets = new Map<string, string>()
|
|
276
|
-
const agentTargets = new Map<string, string>()
|
|
277
|
-
const skillsByDir = new Map<string, Set<string>>()
|
|
278
|
-
const agentsByDir = new Map<string, Set<string>>()
|
|
279
|
-
const addTarget = (targets: Map<string, string>, path: string, content: string) => {
|
|
280
|
-
const prior = targets.get(path)
|
|
281
|
-
if (prior !== undefined && prior !== content) throw new Error(`conflicting materialize targets for ${path}`)
|
|
282
|
-
targets.set(path, content)
|
|
283
|
-
}
|
|
284
|
-
for (const h of selected) {
|
|
285
|
-
if (contract) for (const f of h.contractFiles(proj)) addTarget(contractTargets, f, contract)
|
|
286
|
-
const shim = h.shim(DISPATCH, SPEX)
|
|
287
|
-
if (h.shimScope === 'tree') {
|
|
288
|
-
addTarget(treeShimTargets, h.shimFile(proj), shim.content)
|
|
289
|
-
}
|
|
290
|
-
// a linked-worktree ANCHOR copy of the shim, when the harness needs one (codex: the shim lives at the main
|
|
291
|
-
// checkout, so the worktree gets no `.codex/` unless we place one). One adapter line; null otherwise.
|
|
292
|
-
const anchor = h.worktreeHookAnchor(proj)
|
|
293
|
-
if (anchor) addTarget(anchorTargets, anchor, shim.content)
|
|
294
|
-
}
|
|
295
|
-
for (const sk of skillNodes) for (const h of selected) {
|
|
296
|
-
const dir = h.skillDir(proj); if (!dir) continue
|
|
297
|
-
addTarget(skillTargets, join(dir, sk.name, 'SKILL.md'), skillArtifact(sk))
|
|
298
|
-
const names = skillsByDir.get(dir) ?? new Set<string>(); names.add(sk.name); skillsByDir.set(dir, names)
|
|
299
|
-
}
|
|
300
|
-
for (const ag of agentNodes) for (const h of selected) {
|
|
301
|
-
const dir = h.agentDir(proj); if (!dir) continue
|
|
302
|
-
addTarget(agentTargets, join(dir, `${ag.name}.md`), agentArtifact(ag))
|
|
303
|
-
const names = agentsByDir.get(dir) ?? new Set<string>(); names.add(ag.name); agentsByDir.set(dir, names)
|
|
304
|
-
}
|
|
305
|
-
const tracked = new Map<string, boolean>()
|
|
306
|
-
const isTrackedHere = (file: string) => {
|
|
307
|
-
const known = tracked.get(file)
|
|
308
|
-
if (known !== undefined) return known
|
|
309
|
-
const value = isTracked(proj, file); tracked.set(file, value); return value
|
|
310
|
-
}
|
|
311
|
-
reconcileTree(proj, {
|
|
312
|
-
contracts: new Set(contractTargets.keys()), treeShims: new Set(treeShimTargets.keys()), anchors: new Set(anchorTargets.keys()),
|
|
313
|
-
skills: skillsByDir, agents: agentsByDir,
|
|
314
|
-
}, isTrackedHere)
|
|
315
|
-
const changedMaterialized = new Set<string>()
|
|
316
|
-
for (const [file, content] of contractTargets) {
|
|
317
|
-
if (writeManagedBlock(file, content)) changedMaterialized.add(file)
|
|
318
|
-
record('contract', file)
|
|
319
|
-
}
|
|
320
|
-
const contractPaths = [...contractTargets.keys()]
|
|
321
|
-
for (const [file, content] of treeShimTargets) {
|
|
322
|
-
mkdirSync(dirname(file), { recursive: true }); writeFileIfChanged(file, content)
|
|
323
|
-
record('shim', file); machinePaths.push(file)
|
|
324
|
-
}
|
|
325
|
-
for (const [file, content] of anchorTargets) {
|
|
326
|
-
mkdirSync(dirname(file), { recursive: true }); writeFileIfChanged(file, content)
|
|
327
|
-
record('shim', file); machinePaths.push(file)
|
|
328
|
-
}
|
|
329
|
-
const selectedByDispatch = new Map(selected.map((h) => [h.dispatchId, h]))
|
|
330
|
-
for (const h of selectedByDispatch.values()) {
|
|
331
|
-
const shim = h.shim(DISPATCH, SPEX)
|
|
332
|
-
if (h.shimScope === 'project') {
|
|
333
|
-
const file = h.shimFile(proj)
|
|
334
|
-
mkdirSync(dirname(file), { recursive: true }); writeFileIfChanged(file, shim.content)
|
|
335
|
-
record('shim', file)
|
|
336
|
-
}
|
|
337
|
-
for (const file of h.writeTrust(proj, shim.cmd)) record('trust', file)
|
|
338
|
-
}
|
|
339
|
-
for (const [file, content] of skillTargets) {
|
|
340
|
-
mkdirSync(dirname(file), { recursive: true }); writeFileIfChanged(file, content)
|
|
341
|
-
artifactPaths.push(file); record('skill', file)
|
|
342
|
-
}
|
|
343
|
-
for (const [file, content] of agentTargets) {
|
|
344
|
-
mkdirSync(dirname(file), { recursive: true }); writeFileIfChanged(file, content)
|
|
345
|
-
artifactPaths.push(file); record('agent', file)
|
|
346
|
-
}
|
|
347
|
-
// (8) the PLUGIN target ([[plugin-harness]]): materialize the whole system into one self-contained Claude-plugin
|
|
348
|
-
// bundle per selected folder. A plugin is EXCLUSIVE (`selected` is empty then). Pruning a DESELECTED
|
|
349
|
-
// folder needs the PREVIOUS folder set, which the live config no longer names — the one landing point
|
|
350
|
-
// the identity-stamped erase cannot enumerate (a folder is an arbitrary path) — so a tiny ledger in the
|
|
351
|
-
// global store records the folders emitted last run; any prev folder absent from the current set is
|
|
352
|
-
// clean()ed, then the current folders are emitted and the ledger rewritten.
|
|
353
|
-
const ledger = join(rt, 'plugin-folders')
|
|
354
|
-
const prevFolders = existsSync(ledger) ? readFileSync(ledger, 'utf8').split('\n').map((l) => l.trim()).filter(Boolean) : []
|
|
355
|
-
const curFolders = plugins.map((p) => p.folder)
|
|
356
|
-
for (const f of prevFolders) if (!curFolders.includes(f)) cleanPlugin(proj, f)
|
|
357
|
-
if (plugins.length) {
|
|
358
|
-
const bundle = {
|
|
359
|
-
contract,
|
|
360
|
-
skills: skillNodes.map((s) => ({ name: s.name, content: skillArtifact(s) })),
|
|
361
|
-
agents: agentNodes.map((a) => ({ name: a.name, content: agentArtifact(a) })),
|
|
362
|
-
commands: commandNodes.map((c) => ({ name: c.name, content: commandArtifact(c) })),
|
|
363
|
-
spex: SPEX,
|
|
364
|
-
version: pluginVersion(),
|
|
365
|
-
}
|
|
366
|
-
for (const p of plugins) {
|
|
367
|
-
emitPlugin(proj, p.folder, bundle)
|
|
368
|
-
record('plugin bundle', pluginBundleDir(proj, p.folder))
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
writeFileIfChanged(ledger, curFolders.join('\n'))
|
|
372
|
-
// (9) ignore + mixed text. Only checkout-invariant residue and project-shared shims belong in the COMMON
|
|
373
|
-
// info/exclude; selection-dependent paths live in this tree's filtered working .gitignore.
|
|
374
|
-
const mc = mainCheckout(proj)
|
|
375
|
-
const bundlePaths = curFolders.map((f) => pluginBundleDir(proj, f))
|
|
376
|
-
const commonEntries = [
|
|
377
|
-
...[...new Set(HARNESSES.filter((h) => h.shimScope === 'project' && existsSync(h.shimFile(proj)) &&
|
|
378
|
-
readFileSync(h.shimFile(proj), 'utf8').includes('dispatch.sh')).map((h) => relative(mc, h.shimFile(proj))))]
|
|
379
|
-
.filter((p) => !p.startsWith('..')),
|
|
380
|
-
'spexcode.local.json', '.worktrees/', '.session',
|
|
381
|
-
]
|
|
382
|
-
const entries = (list: string[]) => [...new Set(list)].sort().join('\n')
|
|
383
|
-
// Contract residence stays a live fact. Selection-dependent untracked products are ignored by this tree's
|
|
384
|
-
// working .gitignore, whose own managed block is filtered when the host tracks/owns that file.
|
|
385
|
-
const filterContracts: string[] = []
|
|
386
|
-
const oursContracts: string[] = []
|
|
387
|
-
for (const f of contractPaths) {
|
|
388
|
-
if (isTrackedHere(f) || hostContentOf(f).trim()) filterContracts.push(f)
|
|
389
|
-
else oursContracts.push(f)
|
|
390
|
-
}
|
|
391
|
-
const localEntries = [...machinePaths, ...bundlePaths, ...artifactPaths, ...oursContracts]
|
|
392
|
-
.map((p) => relative(proj, p)).filter((p) => !p.startsWith('..'))
|
|
393
|
-
const ignoreFile = join(proj, '.gitignore')
|
|
394
|
-
const ignoreTracked = isTrackedHere(ignoreFile)
|
|
395
|
-
const ignoreHost = existsSync(ignoreFile) ? stripSpexcodeBlock(readFileSync(ignoreFile, 'utf8'), ['# ', '']) : ''
|
|
396
|
-
if (!ignoreTracked && !ignoreHost.trim()) localEntries.push('.gitignore')
|
|
397
|
-
const ignoreBody = entries(localEntries)
|
|
398
|
-
if (writeManagedBlock(ignoreFile, ignoreBody, ['# ', ''])) changedMaterialized.add(ignoreFile)
|
|
399
|
-
|
|
400
|
-
const payloads: ContractFilterPayload[] = filterContracts.map((file) => ({ file: relative(proj, file), content: contract }))
|
|
401
|
-
if (ignoreTracked || ignoreHost.trim()) payloads.push({ file: '.gitignore', content: ignoreBody })
|
|
402
|
-
const bindings: ContractFilterBinding[] = [
|
|
403
|
-
...[...new Set(HARNESSES.flatMap((h) => h.contractFiles(proj).map((file) => relative(proj, file))))]
|
|
404
|
-
.map((file) => ({ file, start: '<!-- spexcode:start -->', end: '<!-- spexcode:end -->' })),
|
|
405
|
-
{ file: '.gitignore', start: '# spexcode:start', end: '# spexcode:end' },
|
|
406
|
-
]
|
|
407
|
-
if (payloads.length) plantContractFilter(proj, payloads, bindings, [...changedMaterialized])
|
|
408
|
-
else if (contractFilterPlanted(proj)) removeContractFilter(proj, [...HARNESSES.flatMap((h) => h.contractFiles(proj)), join(proj, '.gitignore')])
|
|
409
|
-
// (5) finish diagnostics, then atomically publish the allowlist LAST. Dispatch consumes only that
|
|
410
|
-
// final receipt; a killed writer leaves the preceding successful selection intact.
|
|
411
|
-
const h = contentHash(proj)
|
|
412
|
-
writeFileIfChanged(join(rt, 'content-hash'), h)
|
|
413
|
-
writeFileIfChanged(join(runtimeRoot(proj), 'harness-selection-v1'), '')
|
|
414
|
-
writeManagedBlock(infoExcludePath(proj), entries(commonEntries), ['# ', ''])
|
|
415
|
-
publishSelection(join(rt, 'harnesses'), selectionBody(selected, plugins.length > 0))
|
|
416
|
-
return { contentHash: h, planted }
|
|
417
|
-
}
|
package/spec-cli/src/mentions.ts
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
// @@@ mentions - the two passive in-text references: `[[node]]` names a topic and
|
|
2
|
-
// `@session` names a retained session. The grammar is shared by every composer; neither
|
|
3
|
-
// reference is control. Sending to a session, launching one, and inheriting one remain
|
|
4
|
-
// explicit `spex session send`, `spex session new`, and `/distill <id>` actions.
|
|
5
|
-
const SESSION_RE = /(?:^|\s)@([\p{L}\p{N}_-]+(?::[\p{L}\p{N}_.-]+)?)/gu
|
|
6
|
-
const NODE_RE = /\[\[([^\]\s]+)\]\]/g
|
|
7
|
-
|
|
8
|
-
const uniq = (xs: string[]): string[] => [...new Set(xs)]
|
|
9
|
-
|
|
10
|
-
// In free text a sigil separates a reference from prose. A CLI argument is already a
|
|
11
|
-
// reference, so it tolerates either sigil without widening its normal matching grammar.
|
|
12
|
-
export function stripRefSigil(token: string): string {
|
|
13
|
-
const wrapped = /^\[\[(.*)\]\]$/.exec(token)
|
|
14
|
-
if (wrapped) return wrapped[1]
|
|
15
|
-
return token.startsWith('@') ? token.slice(1) : token
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export function parseMentions(text: string): { sessions: string[]; nodes: string[] } {
|
|
19
|
-
const sessions: string[] = []
|
|
20
|
-
const nodes: string[] = []
|
|
21
|
-
for (const m of text.matchAll(SESSION_RE)) sessions.push(m[1])
|
|
22
|
-
for (const m of text.matchAll(NODE_RE)) nodes.push(m[1])
|
|
23
|
-
return { sessions: uniq(sessions), nodes: uniq(nodes) }
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
// The originator courtesy is the only automatic notification left in this module. It
|
|
27
|
-
// resolves explicit stored session ids against online rows; prose @ references never call it.
|
|
28
|
-
type Session = { id: string; node: string | null; name: string | null; title: string | null; liveness: string }
|
|
29
|
-
|
|
30
|
-
function resolveOnlineSession(token: string, sessions: Session[]): Session | null {
|
|
31
|
-
const online = sessions.filter((session) => session.liveness === 'online')
|
|
32
|
-
const text = token.toLowerCase()
|
|
33
|
-
const label = (session: Session) => (session.name || session.title || '').toLowerCase()
|
|
34
|
-
return online.find((session) => session.id === token)
|
|
35
|
-
|| online.find((session) => session.id.startsWith(token))
|
|
36
|
-
|| online.find((session) => label(session) === text)
|
|
37
|
-
|| online.find((session) => label(session).startsWith(text) && text.length >= 2)
|
|
38
|
-
|| null
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export type LoopIn = { originator: string }
|
|
42
|
-
export type LoopInPick =
|
|
43
|
-
| { kind: 'deliver'; originator: string; session: Session }
|
|
44
|
-
| { kind: 'none' }
|
|
45
|
-
|
|
46
|
-
// A committed reply can notify its originator as a courtesy. This is not a mention
|
|
47
|
-
// dispatch or assignment, and it never creates a worker or retries an offline session.
|
|
48
|
-
export function pickLoopIn(chain: (string | null)[], replier: string, sessions: Session[]): LoopInPick {
|
|
49
|
-
const seen = new Set<string>()
|
|
50
|
-
for (const originator of chain) {
|
|
51
|
-
if (!originator || originator === replier || seen.has(originator)) continue
|
|
52
|
-
seen.add(originator)
|
|
53
|
-
const session = resolveOnlineSession(originator, sessions)
|
|
54
|
-
if (session) return { kind: 'deliver', originator, session }
|
|
55
|
-
}
|
|
56
|
-
return { kind: 'none' }
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
function originatorPrompt(threadId: string, node: string | null, replier: string, text: string): string {
|
|
60
|
-
const re = node ? ` (re: ${node})` : ''
|
|
61
|
-
return `A new reply landed on a thread you originated - "${threadId}"${re}, from ${replier}:\n\n ${text.trim()}\n\n` +
|
|
62
|
-
`This is a courtesy heads-up, not an assignment. Look if it concerns you; ` +
|
|
63
|
-
`\`spex issue ls --all\` lists threads and \`spex issue reply ${threadId} --body -\` replies.`
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
export async function notifyOriginator(
|
|
67
|
-
chain: (string | null)[],
|
|
68
|
-
replier: string,
|
|
69
|
-
text: string,
|
|
70
|
-
ctx: { threadId: string; node: string | null },
|
|
71
|
-
): Promise<LoopIn | null> {
|
|
72
|
-
if (!chain.some((candidate) => candidate && candidate !== replier)) return null
|
|
73
|
-
const { sendText, listSessions } = await import('./sessions.js')
|
|
74
|
-
const pick = pickLoopIn(chain, replier, await listSessions() as unknown as Session[])
|
|
75
|
-
if (pick.kind !== 'deliver') return null
|
|
76
|
-
const result = await sendText(pick.session.id, originatorPrompt(ctx.threadId, ctx.node, replier, text), 'issues')
|
|
77
|
-
return result.ok ? { originator: pick.originator } : null
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
export const summarizeLoopIn = (loopIn?: LoopIn | null): string =>
|
|
81
|
-
loopIn ? `looped in originator @${loopIn.originator} (online)` : ''
|