@blxzer/pactile 0.5.0 → 0.6.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +612 -563
- package/LICENSE +235 -235
- package/README.md +108 -105
- package/README.zh-CN.md +105 -105
- package/bin/compat-warning.js +11 -11
- package/bin/cstl.js +6 -6
- package/bin/pactile.js +3 -3
- package/bin/smart-search.js +38 -38
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +79 -30
- package/dist/cli/index.js.map +1 -1
- package/dist/commands/codex.d.ts +3 -0
- package/dist/commands/codex.d.ts.map +1 -0
- package/dist/commands/codex.js +54 -0
- package/dist/commands/codex.js.map +1 -0
- package/dist/commands/context.d.ts +3 -0
- package/dist/commands/context.d.ts.map +1 -0
- package/dist/commands/context.js +272 -0
- package/dist/commands/context.js.map +1 -0
- package/dist/commands/init.d.ts +0 -20
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +285 -456
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/migrate.js +1 -1
- package/dist/commands/migrate.js.map +1 -1
- package/dist/commands/parallel.d.ts +2 -0
- package/dist/commands/parallel.d.ts.map +1 -0
- package/dist/commands/parallel.js +26 -0
- package/dist/commands/parallel.js.map +1 -0
- package/dist/commands/pi.d.ts +3 -0
- package/dist/commands/pi.d.ts.map +1 -0
- package/dist/commands/pi.js +94 -0
- package/dist/commands/pi.js.map +1 -0
- package/dist/commands/session.d.ts +2 -0
- package/dist/commands/session.d.ts.map +1 -0
- package/dist/commands/session.js +169 -0
- package/dist/commands/session.js.map +1 -0
- package/dist/commands/task.d.ts +3 -0
- package/dist/commands/task.d.ts.map +1 -0
- package/dist/commands/task.js +1026 -0
- package/dist/commands/task.js.map +1 -0
- package/dist/commands/update.d.ts +3 -1
- package/dist/commands/update.d.ts.map +1 -1
- package/dist/commands/update.js +130 -47
- package/dist/commands/update.js.map +1 -1
- package/dist/commands/workflow.d.ts.map +1 -1
- package/dist/commands/workflow.js +1 -2
- package/dist/commands/workflow.js.map +1 -1
- package/dist/configurators/index.d.ts +5 -51
- package/dist/configurators/index.d.ts.map +1 -1
- package/dist/configurators/index.js +9 -140
- package/dist/configurators/index.js.map +1 -1
- package/dist/configurators/shared.d.ts +7 -66
- package/dist/configurators/shared.d.ts.map +1 -1
- package/dist/configurators/shared.js +17 -262
- package/dist/configurators/shared.js.map +1 -1
- package/dist/configurators/workflow.d.ts +5 -6
- package/dist/configurators/workflow.d.ts.map +1 -1
- package/dist/configurators/workflow.js +11 -39
- package/dist/configurators/workflow.js.map +1 -1
- package/dist/constants/paths.d.ts +1 -5
- package/dist/constants/paths.d.ts.map +1 -1
- package/dist/constants/paths.js +1 -5
- package/dist/constants/paths.js.map +1 -1
- package/dist/core/compat/environment.d.ts +43 -0
- package/dist/core/compat/environment.d.ts.map +1 -0
- package/dist/core/compat/environment.js +91 -0
- package/dist/core/compat/environment.js.map +1 -0
- package/dist/core/compat/index.d.ts +2 -0
- package/dist/core/compat/index.d.ts.map +1 -0
- package/dist/core/compat/index.js +2 -0
- package/dist/core/compat/index.js.map +1 -0
- package/dist/core/index.d.ts +4 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +6 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/pactile/capability.d.ts +65 -0
- package/dist/core/pactile/capability.d.ts.map +1 -0
- package/dist/core/pactile/capability.js +199 -0
- package/dist/core/pactile/capability.js.map +1 -0
- package/dist/core/pactile/index.d.ts +15 -0
- package/dist/core/pactile/index.d.ts.map +1 -0
- package/dist/core/pactile/index.js +13 -0
- package/dist/core/pactile/index.js.map +1 -0
- package/dist/core/pactile/lifecycle.d.ts +106 -0
- package/dist/core/pactile/lifecycle.d.ts.map +1 -0
- package/dist/core/pactile/lifecycle.js +607 -0
- package/dist/core/pactile/lifecycle.js.map +1 -0
- package/dist/core/pactile/middleware/index.d.ts +3 -0
- package/dist/core/pactile/middleware/index.d.ts.map +1 -0
- package/dist/core/pactile/middleware/index.js +2 -0
- package/dist/core/pactile/middleware/index.js.map +1 -0
- package/dist/core/pactile/middleware/redaction.d.ts +4 -0
- package/dist/core/pactile/middleware/redaction.d.ts.map +1 -0
- package/dist/core/pactile/middleware/redaction.js +34 -0
- package/dist/core/pactile/middleware/redaction.js.map +1 -0
- package/dist/core/pactile/middleware/resolver.d.ts +62 -0
- package/dist/core/pactile/middleware/resolver.d.ts.map +1 -0
- package/dist/core/pactile/middleware/resolver.js +803 -0
- package/dist/core/pactile/middleware/resolver.js.map +1 -0
- package/dist/core/pactile/projection.d.ts +81 -0
- package/dist/core/pactile/projection.d.ts.map +1 -0
- package/dist/core/pactile/projection.js +399 -0
- package/dist/core/pactile/projection.js.map +1 -0
- package/dist/core/pactile/provider.d.ts +81 -0
- package/dist/core/pactile/provider.d.ts.map +1 -0
- package/dist/core/pactile/provider.js +313 -0
- package/dist/core/pactile/provider.js.map +1 -0
- package/dist/core/pactile/runtime.d.ts +56 -0
- package/dist/core/pactile/runtime.d.ts.map +1 -0
- package/dist/core/pactile/runtime.js +176 -0
- package/dist/core/pactile/runtime.js.map +1 -0
- package/dist/core/pactile/tile-compiler-types.d.ts +32 -0
- package/dist/core/pactile/tile-compiler-types.d.ts.map +1 -0
- package/dist/core/pactile/tile-compiler-types.js +2 -0
- package/dist/core/pactile/tile-compiler-types.js.map +1 -0
- package/dist/core/pactile/tile.d.ts +71 -0
- package/dist/core/pactile/tile.d.ts.map +1 -0
- package/dist/core/pactile/tile.js +228 -0
- package/dist/core/pactile/tile.js.map +1 -0
- package/dist/core/pactile/trace-runtime/index.d.ts +38 -0
- package/dist/core/pactile/trace-runtime/index.d.ts.map +1 -0
- package/dist/core/pactile/trace-runtime/index.js +292 -0
- package/dist/core/pactile/trace-runtime/index.js.map +1 -0
- package/dist/core/pactile/trace.d.ts +42 -0
- package/dist/core/pactile/trace.d.ts.map +1 -0
- package/dist/core/pactile/trace.js +221 -0
- package/dist/core/pactile/trace.js.map +1 -0
- package/dist/core/pactile/validation.d.ts +91 -0
- package/dist/core/pactile/validation.d.ts.map +1 -0
- package/dist/core/pactile/validation.js +301 -0
- package/dist/core/pactile/validation.js.map +1 -0
- package/dist/core/task/adapter-middleware.d.ts +122 -0
- package/dist/core/task/adapter-middleware.d.ts.map +1 -0
- package/dist/core/task/adapter-middleware.js +476 -0
- package/dist/core/task/adapter-middleware.js.map +1 -0
- package/dist/core/task/compat.d.ts +7 -0
- package/dist/core/task/compat.d.ts.map +1 -0
- package/dist/core/task/compat.js +2 -0
- package/dist/core/task/compat.js.map +1 -0
- package/dist/core/task/contract-migrate.d.ts +29 -0
- package/dist/core/task/contract-migrate.d.ts.map +1 -0
- package/dist/core/task/contract-migrate.js +207 -0
- package/dist/core/task/contract-migrate.js.map +1 -0
- package/dist/core/task/full-quality.d.ts +89 -0
- package/dist/core/task/full-quality.d.ts.map +1 -0
- package/dist/core/task/full-quality.js +379 -0
- package/dist/core/task/full-quality.js.map +1 -0
- package/dist/core/task/index.d.ts +32 -0
- package/dist/core/task/index.d.ts.map +1 -0
- package/dist/core/task/index.js +20 -0
- package/dist/core/task/index.js.map +1 -0
- package/dist/core/task/kernel-cli.d.ts +51 -0
- package/dist/core/task/kernel-cli.d.ts.map +1 -0
- package/dist/core/task/kernel-cli.js +301 -0
- package/dist/core/task/kernel-cli.js.map +1 -0
- package/dist/core/task/kernel-contract.d.ts +164 -0
- package/dist/core/task/kernel-contract.d.ts.map +1 -0
- package/dist/core/task/kernel-contract.js +475 -0
- package/dist/core/task/kernel-contract.js.map +1 -0
- package/dist/core/task/kernel-store.d.ts +130 -0
- package/dist/core/task/kernel-store.d.ts.map +1 -0
- package/dist/core/task/kernel-store.js +905 -0
- package/dist/core/task/kernel-store.js.map +1 -0
- package/dist/core/task/kernel-surface.d.ts +70 -0
- package/dist/core/task/kernel-surface.d.ts.map +1 -0
- package/dist/core/task/kernel-surface.js +121 -0
- package/dist/core/task/kernel-surface.js.map +1 -0
- package/dist/core/task/lite-context-pack.d.ts +71 -0
- package/dist/core/task/lite-context-pack.d.ts.map +1 -0
- package/dist/core/task/lite-context-pack.js +175 -0
- package/dist/core/task/lite-context-pack.js.map +1 -0
- package/dist/core/task/ondemand-topology.d.ts +108 -0
- package/dist/core/task/ondemand-topology.d.ts.map +1 -0
- package/dist/core/task/ondemand-topology.js +456 -0
- package/dist/core/task/ondemand-topology.js.map +1 -0
- package/dist/core/task/p36-artifact-migrate.d.ts +58 -0
- package/dist/core/task/p36-artifact-migrate.d.ts.map +1 -0
- package/dist/core/task/p36-artifact-migrate.js +293 -0
- package/dist/core/task/p36-artifact-migrate.js.map +1 -0
- package/dist/core/task/p36-wave-c.d.ts +39 -0
- package/dist/core/task/p36-wave-c.d.ts.map +1 -0
- package/dist/core/task/p36-wave-c.js +100 -0
- package/dist/core/task/p36-wave-c.js.map +1 -0
- package/dist/core/task/paths.d.ts +37 -0
- package/dist/core/task/paths.d.ts.map +1 -0
- package/dist/core/task/paths.js +49 -0
- package/dist/core/task/paths.js.map +1 -0
- package/dist/core/task/phase.d.ts +27 -0
- package/dist/core/task/phase.d.ts.map +1 -0
- package/dist/core/task/phase.js +24 -0
- package/dist/core/task/phase.js.map +1 -0
- package/dist/core/task/records.d.ts +48 -0
- package/dist/core/task/records.d.ts.map +1 -0
- package/dist/core/task/records.js +100 -0
- package/dist/core/task/records.js.map +1 -0
- package/dist/core/task/schema.d.ts +77 -0
- package/dist/core/task/schema.d.ts.map +1 -0
- package/dist/core/task/schema.js +220 -0
- package/dist/core/task/schema.js.map +1 -0
- package/dist/core/testing/index.d.ts +2 -0
- package/dist/core/testing/index.d.ts.map +1 -0
- package/dist/core/testing/index.js +4 -0
- package/dist/core/testing/index.js.map +1 -0
- package/dist/migrations/manifests/0.1.0.json +9 -9
- package/dist/migrations/manifests/0.1.1.json +9 -9
- package/dist/migrations/manifests/0.1.2.json +9 -9
- package/dist/migrations/manifests/0.1.3.json +9 -9
- package/dist/migrations/manifests/0.1.4.json +9 -9
- package/dist/migrations/manifests/0.2.1.json +9 -9
- package/dist/migrations/manifests/0.2.10.json +374 -374
- package/dist/migrations/manifests/0.2.2.json +8 -8
- package/dist/migrations/manifests/0.2.3.json +9 -9
- package/dist/migrations/manifests/0.2.4.json +8 -8
- package/dist/migrations/manifests/0.2.5.json +8 -8
- package/dist/migrations/manifests/0.2.6.json +8 -8
- package/dist/migrations/manifests/0.2.7.json +8 -8
- package/dist/migrations/manifests/0.2.8.json +9 -9
- package/dist/migrations/manifests/0.2.9.json +9 -9
- package/dist/migrations/manifests/0.3.0.json +89 -89
- package/dist/migrations/manifests/0.3.1.json +32 -32
- package/dist/migrations/manifests/0.3.2.json +16 -16
- package/dist/migrations/manifests/0.3.3.json +9 -9
- package/dist/migrations/manifests/0.3.4.json +9 -9
- package/dist/migrations/manifests/0.3.5.json +9 -9
- package/dist/migrations/manifests/0.3.6.json +9 -9
- package/dist/migrations/manifests/0.4.0.json +9 -9
- package/dist/migrations/manifests/0.4.1.json +9 -9
- package/dist/migrations/manifests/0.4.2.json +9 -9
- package/dist/migrations/manifests/0.4.3.json +9 -9
- package/dist/migrations/manifests/0.5.0-beta.0.json +9 -9
- package/dist/migrations/manifests/0.5.0-beta.1.json +9 -9
- package/dist/migrations/manifests/0.5.0-beta.2.json +8 -8
- package/dist/migrations/manifests/0.5.0-beta.3.json +8 -8
- package/dist/migrations/manifests/0.5.0-beta.4.json +9 -9
- package/dist/migrations/manifests/0.5.0-beta.5.json +9 -9
- package/dist/migrations/manifests/0.5.0.json +9 -0
- package/dist/migrations/manifests/0.6.0-beta.1.json +35 -0
- package/dist/migrations/manifests/0.6.0-beta.2.json +9 -0
- package/dist/migrations/manifests/0.6.0.json +9 -0
- package/dist/pactile/adapters/codex/index.js +1 -1
- package/dist/pactile/adapters/codex/index.js.map +1 -1
- package/dist/pactile/adapters/index.d.ts +0 -1
- package/dist/pactile/adapters/index.d.ts.map +1 -1
- package/dist/pactile/adapters/index.js +0 -1
- package/dist/pactile/adapters/index.js.map +1 -1
- package/dist/pactile/adoption/bindings.d.ts +1 -1
- package/dist/pactile/adoption/bindings.d.ts.map +1 -1
- package/dist/pactile/adoption/bindings.js +1 -1
- package/dist/pactile/adoption/bindings.js.map +1 -1
- package/dist/pactile/adoption/inventory.d.ts +1 -1
- package/dist/pactile/adoption/inventory.d.ts.map +1 -1
- package/dist/pactile/adoption/inventory.js +1 -1
- package/dist/pactile/adoption/inventory.js.map +1 -1
- package/dist/pactile/adoption/safety.js +1 -1
- package/dist/pactile/adoption/safety.js.map +1 -1
- package/dist/pactile/adoption/workflow.d.ts +1 -1
- package/dist/pactile/adoption/workflow.d.ts.map +1 -1
- package/dist/pactile/adoption/workflow.js +1 -1
- package/dist/pactile/adoption/workflow.js.map +1 -1
- package/dist/pactile/codex/bridge.d.ts +71 -0
- package/dist/pactile/codex/bridge.d.ts.map +1 -0
- package/dist/pactile/codex/bridge.js +271 -0
- package/dist/pactile/codex/bridge.js.map +1 -0
- package/dist/pactile/compat/init-context.js +1 -1
- package/dist/pactile/compat/init-context.js.map +1 -1
- package/dist/pactile/compat/node-entry-migration.d.ts +3 -0
- package/dist/pactile/compat/node-entry-migration.d.ts.map +1 -0
- package/dist/pactile/compat/node-entry-migration.js +25 -0
- package/dist/pactile/compat/node-entry-migration.js.map +1 -0
- package/dist/pactile/exit/receipt.js +1 -1
- package/dist/pactile/exit/receipt.js.map +1 -1
- package/dist/pactile/exit/service.d.ts +1 -1
- package/dist/pactile/exit/service.d.ts.map +1 -1
- package/dist/pactile/exit/service.js +1 -3
- package/dist/pactile/exit/service.js.map +1 -1
- package/dist/pactile/lifecycle/command-runner.d.ts +1 -1
- package/dist/pactile/lifecycle/command-runner.d.ts.map +1 -1
- package/dist/pactile/lifecycle/command-runner.js +1 -3
- package/dist/pactile/lifecycle/command-runner.js.map +1 -1
- package/dist/pactile/lifecycle/default-adapters.d.ts.map +1 -1
- package/dist/pactile/lifecycle/default-adapters.js +8 -32
- package/dist/pactile/lifecycle/default-adapters.js.map +1 -1
- package/dist/pactile/lifecycle/orchestrator.d.ts +1 -1
- package/dist/pactile/lifecycle/orchestrator.d.ts.map +1 -1
- package/dist/pactile/lifecycle/orchestrator.js +1 -1
- package/dist/pactile/lifecycle/orchestrator.js.map +1 -1
- package/dist/pactile/lifecycle/project-files.d.ts.map +1 -1
- package/dist/pactile/lifecycle/project-files.js +4 -1
- package/dist/pactile/lifecycle/project-files.js.map +1 -1
- package/dist/pactile/middleware/manifest-loader.d.ts +1 -1
- package/dist/pactile/middleware/manifest-loader.d.ts.map +1 -1
- package/dist/pactile/middleware/manifest-loader.js +1 -1
- package/dist/pactile/middleware/manifest-loader.js.map +1 -1
- package/dist/pactile/migration/transaction.d.ts +1 -1
- package/dist/pactile/migration/transaction.d.ts.map +1 -1
- package/dist/pactile/migration/transaction.js +1 -1
- package/dist/pactile/migration/transaction.js.map +1 -1
- package/dist/pactile/parallel/batch.d.ts +41 -0
- package/dist/pactile/parallel/batch.d.ts.map +1 -0
- package/dist/pactile/parallel/batch.js +190 -0
- package/dist/pactile/parallel/batch.js.map +1 -0
- package/dist/pactile/parallel/policy.d.ts +18 -0
- package/dist/pactile/parallel/policy.d.ts.map +1 -0
- package/dist/pactile/parallel/policy.js +174 -0
- package/dist/pactile/parallel/policy.js.map +1 -0
- package/dist/pactile/pi/bridge.d.ts +51 -0
- package/dist/pactile/pi/bridge.d.ts.map +1 -0
- package/dist/pactile/pi/bridge.js +353 -0
- package/dist/pactile/pi/bridge.js.map +1 -0
- package/dist/pactile/pi/rpc.d.ts +41 -0
- package/dist/pactile/pi/rpc.d.ts.map +1 -0
- package/dist/pactile/pi/rpc.js +219 -0
- package/dist/pactile/pi/rpc.js.map +1 -0
- package/dist/pactile/projection/planner.d.ts +1 -1
- package/dist/pactile/projection/planner.d.ts.map +1 -1
- package/dist/pactile/projection/planner.js +1 -1
- package/dist/pactile/projection/planner.js.map +1 -1
- package/dist/pactile/projection/shared/index.js +1 -1
- package/dist/pactile/projection/shared/index.js.map +1 -1
- package/dist/pactile/projection/store.js +1 -1
- package/dist/pactile/projection/store.js.map +1 -1
- package/dist/pactile/providers/probes.d.ts +2 -2
- package/dist/pactile/providers/probes.d.ts.map +1 -1
- package/dist/pactile/providers/probes.js +0 -6
- package/dist/pactile/providers/probes.js.map +1 -1
- package/dist/pactile/registry.d.ts +1 -8
- package/dist/pactile/registry.d.ts.map +1 -1
- package/dist/pactile/registry.js +8 -25
- package/dist/pactile/registry.js.map +1 -1
- package/dist/pactile/retrieval/envelope.d.ts +19 -0
- package/dist/pactile/retrieval/envelope.d.ts.map +1 -0
- package/dist/pactile/retrieval/envelope.js +115 -0
- package/dist/pactile/retrieval/envelope.js.map +1 -0
- package/dist/pactile/retrieval/evidence.js +1 -1
- package/dist/pactile/retrieval/evidence.js.map +1 -1
- package/dist/pactile/retrieval/pack.d.ts +9 -0
- package/dist/pactile/retrieval/pack.d.ts.map +1 -0
- package/dist/pactile/retrieval/pack.js +300 -0
- package/dist/pactile/retrieval/pack.js.map +1 -0
- package/dist/pactile/retrieval/planner.d.ts +1 -1
- package/dist/pactile/retrieval/planner.d.ts.map +1 -1
- package/dist/pactile/retrieval/planner.js +1 -1
- package/dist/pactile/retrieval/planner.js.map +1 -1
- package/dist/pactile/retrieval/types.d.ts +1 -1
- package/dist/pactile/retrieval/types.d.ts.map +1 -1
- package/dist/pactile/runtime/json-api.d.ts +1 -1
- package/dist/pactile/runtime/json-api.js +1 -1
- package/dist/pactile/runtime/paths.js +1 -1
- package/dist/pactile/runtime/paths.js.map +1 -1
- package/dist/pactile/runtime/stores.d.ts +1 -1
- package/dist/pactile/runtime/stores.d.ts.map +1 -1
- package/dist/pactile/runtime/stores.js +1 -1
- package/dist/pactile/runtime/stores.js.map +1 -1
- package/dist/pactile/runtime/unicode-nfc-data.d.ts +1 -1
- package/dist/pactile/runtime/unicode-nfc-data.js +1 -1
- package/dist/pactile/task/config.d.ts +9 -0
- package/dist/pactile/task/config.d.ts.map +1 -0
- package/dist/pactile/task/config.js +103 -0
- package/dist/pactile/task/config.js.map +1 -0
- package/dist/pactile/task/context.d.ts +19 -0
- package/dist/pactile/task/context.d.ts.map +1 -0
- package/dist/pactile/task/context.js +117 -0
- package/dist/pactile/task/context.js.map +1 -0
- package/dist/pactile/task/guards.d.ts +21 -0
- package/dist/pactile/task/guards.d.ts.map +1 -0
- package/dist/pactile/task/guards.js +232 -0
- package/dist/pactile/task/guards.js.map +1 -0
- package/dist/pactile/task/scaffold.d.ts +6 -0
- package/dist/pactile/task/scaffold.d.ts.map +1 -0
- package/dist/pactile/task/scaffold.js +57 -0
- package/dist/pactile/task/scaffold.js.map +1 -0
- package/dist/pactile/task/session-memory.d.ts +2 -0
- package/dist/pactile/task/session-memory.d.ts.map +1 -0
- package/dist/pactile/task/session-memory.js +123 -0
- package/dist/pactile/task/session-memory.js.map +1 -0
- package/dist/pactile/task/session-pack.d.ts +3 -0
- package/dist/pactile/task/session-pack.d.ts.map +1 -0
- package/dist/pactile/task/session-pack.js +139 -0
- package/dist/pactile/task/session-pack.js.map +1 -0
- package/dist/pactile/task/session.d.ts +13 -0
- package/dist/pactile/task/session.d.ts.map +1 -0
- package/dist/pactile/task/session.js +105 -0
- package/dist/pactile/task/session.js.map +1 -0
- package/dist/pactile/task/strategy.d.ts +24 -0
- package/dist/pactile/task/strategy.d.ts.map +1 -0
- package/dist/pactile/task/strategy.js +136 -0
- package/dist/pactile/task/strategy.js.map +1 -0
- package/dist/pactile/task/task-map.d.ts +35 -0
- package/dist/pactile/task/task-map.d.ts.map +1 -0
- package/dist/pactile/task/task-map.js +217 -0
- package/dist/pactile/task/task-map.js.map +1 -0
- package/dist/pactile/task/workflow-phase.d.ts +3 -0
- package/dist/pactile/task/workflow-phase.d.ts.map +1 -0
- package/dist/pactile/task/workflow-phase.js +56 -0
- package/dist/pactile/task/workflow-phase.js.map +1 -0
- package/dist/pactile/tiles/catalog.d.ts +1 -1
- package/dist/pactile/tiles/catalog.d.ts.map +1 -1
- package/dist/pactile/tiles/catalog.js +1 -1
- package/dist/pactile/tiles/catalog.js.map +1 -1
- package/dist/pactile/tiles/compiler.d.ts +1 -1
- package/dist/pactile/tiles/compiler.d.ts.map +1 -1
- package/dist/pactile/tiles/compiler.js +1 -1
- package/dist/pactile/tiles/compiler.js.map +1 -1
- package/dist/pactile/tiles/content/ondemand/index.d.ts +2 -2
- package/dist/pactile/tiles/content/ondemand/index.d.ts.map +1 -1
- package/dist/pactile/tiles/content/ondemand/index.js +2 -16
- package/dist/pactile/tiles/content/ondemand/index.js.map +1 -1
- package/dist/pactile/tiles/loader.d.ts +1 -1
- package/dist/pactile/tiles/loader.d.ts.map +1 -1
- package/dist/pactile/tiles/loader.js +1 -1
- package/dist/pactile/tiles/loader.js.map +1 -1
- package/dist/templates/common/bundled-skills/pactile-check/SKILL.md +161 -161
- package/dist/templates/common/bundled-skills/pactile-check/references/fowler-12-smells.md +28 -28
- package/dist/templates/common/bundled-skills/pactile-handoff/SKILL.md +117 -117
- package/dist/templates/common/bundled-skills/pactile-meta/SKILL.md +75 -75
- package/dist/templates/common/bundled-skills/pactile-meta/references/customize-local/add-project-local-conventions.md +83 -83
- package/dist/templates/common/bundled-skills/pactile-meta/references/customize-local/change-agents.md +5 -47
- package/dist/templates/common/bundled-skills/pactile-meta/references/customize-local/change-context-loading.md +79 -84
- package/dist/templates/common/bundled-skills/pactile-meta/references/customize-local/change-hooks.md +5 -57
- package/dist/templates/common/bundled-skills/pactile-meta/references/customize-local/change-skills-or-commands.md +7 -77
- package/dist/templates/common/bundled-skills/pactile-meta/references/customize-local/change-spec-structure.md +83 -83
- package/dist/templates/common/bundled-skills/pactile-meta/references/customize-local/change-task-lifecycle.md +82 -88
- package/dist/templates/common/bundled-skills/pactile-meta/references/customize-local/change-workflow.md +65 -65
- package/dist/templates/common/bundled-skills/pactile-meta/references/customize-local/overview.md +12 -55
- package/dist/templates/common/bundled-skills/pactile-meta/references/local-architecture/context-injection.md +68 -68
- package/dist/templates/common/bundled-skills/pactile-meta/references/local-architecture/generated-files.md +7 -83
- package/dist/templates/common/bundled-skills/pactile-meta/references/local-architecture/overview.md +7 -51
- package/dist/templates/common/bundled-skills/pactile-meta/references/local-architecture/spec-system.md +102 -102
- package/dist/templates/common/bundled-skills/pactile-meta/references/local-architecture/task-system.md +138 -133
- package/dist/templates/common/bundled-skills/pactile-meta/references/local-architecture/workflow.md +75 -75
- package/dist/templates/common/bundled-skills/pactile-meta/references/local-architecture/workspace-memory.md +71 -71
- package/dist/templates/common/bundled-skills/pactile-meta/references/platform-files/agents.md +7 -69
- package/dist/templates/common/bundled-skills/pactile-meta/references/platform-files/hooks-and-settings.md +7 -59
- package/dist/templates/common/bundled-skills/pactile-meta/references/platform-files/overview.md +5 -45
- package/dist/templates/common/bundled-skills/pactile-meta/references/platform-files/platform-map.md +9 -45
- package/dist/templates/common/bundled-skills/pactile-meta/references/platform-files/skills-and-commands.md +7 -108
- package/dist/templates/common/bundled-skills/pactile-micro-grill/SKILL.md +68 -68
- package/dist/templates/common/bundled-skills/pactile-skill-creator/SKILL.md +47 -47
- package/dist/templates/common/bundled-skills/pactile-skill-creator/references/authoring-rules.md +170 -170
- package/dist/templates/common/bundled-skills/pactile-skill-creator/references/general-authoring.md +189 -189
- package/dist/templates/common/bundled-skills/pactile-skill-creator/references/pactile-skill-locations.md +11 -52
- package/dist/templates/common/bundled-skills/pactile-skill-creator/references/review-checklist.md +52 -52
- package/dist/templates/common/bundled-skills/pactile-spec-bootstrap/SKILL.md +41 -41
- package/dist/templates/common/bundled-skills/pactile-spec-bootstrap/references/mcp-setup.md +18 -90
- package/dist/templates/common/bundled-skills/pactile-spec-bootstrap/references/repository-analysis.md +41 -59
- package/dist/templates/common/bundled-skills/pactile-spec-bootstrap/references/spec-task-planning.md +61 -61
- package/dist/templates/common/bundled-skills/pactile-spec-bootstrap/references/spec-writing.md +70 -70
- package/dist/templates/common/bundled-skills/smart-search-cli/SKILL.md +393 -393
- package/dist/templates/common/bundled-skills/smart-search-cli/agents/openai.yaml +3 -3
- package/dist/templates/common/bundled-skills/smart-search-cli/examples/batch-search.md +98 -98
- package/dist/templates/common/bundled-skills/smart-search-cli/examples/evidence-gathering.md +89 -89
- package/dist/templates/common/bundled-skills/smart-search-cli/references/cli-contract.md +323 -323
- package/dist/templates/common/commands/continue.md +60 -62
- package/dist/templates/common/commands/finish-work.md +84 -82
- package/dist/templates/common/commands/start.md +66 -66
- package/dist/templates/common/index.d.ts +0 -20
- package/dist/templates/common/index.d.ts.map +1 -1
- package/dist/templates/common/index.js +0 -16
- package/dist/templates/common/index.js.map +1 -1
- package/dist/templates/common/skills/before-dev.md +35 -35
- package/dist/templates/common/skills/brainstorm.md +204 -204
- package/dist/templates/common/skills/break-loop.md +125 -125
- package/dist/templates/common/skills/update-spec.md +363 -363
- package/dist/templates/extract.d.ts +1 -8
- package/dist/templates/extract.d.ts.map +1 -1
- package/dist/templates/extract.js +0 -31
- package/dist/templates/extract.js.map +1 -1
- package/dist/templates/markdown/agents.md +14 -14
- package/dist/templates/markdown/framework/artifact-locale-guide.md.txt +93 -93
- package/dist/templates/markdown/framework/codex-worker-dispatch.md.txt +9 -0
- package/dist/templates/markdown/framework/dogfood-only-surfaces.md.txt +7 -28
- package/dist/templates/markdown/framework/execution-strategy.md.txt +14 -45
- package/dist/templates/markdown/framework/index.md.txt +20 -31
- package/dist/templates/markdown/framework/injection-budget-guide.md.txt +7 -111
- package/dist/templates/markdown/framework/middleware-protocol.md.txt +139 -238
- package/dist/templates/markdown/framework/parallel-first-execution.md.txt +116 -116
- package/dist/templates/markdown/framework/prd-grill-frontier.md.txt +105 -105
- package/dist/templates/markdown/framework/release-boundary.md.txt +30 -30
- package/dist/templates/markdown/framework/retrieval-daily-guide.md.txt +9 -199
- package/dist/templates/markdown/framework/upgrade.md.txt +15 -15
- package/dist/templates/markdown/framework/verification-strength-guide.md.txt +185 -185
- package/dist/templates/markdown/gitignore.txt +15 -15
- package/dist/templates/markdown/index.d.ts +1 -5
- package/dist/templates/markdown/index.d.ts.map +1 -1
- package/dist/templates/markdown/index.js +3 -23
- package/dist/templates/markdown/index.js.map +1 -1
- package/dist/templates/markdown/spec/backend/database-guidelines.md.txt +51 -51
- package/dist/templates/markdown/spec/backend/directory-structure.md.txt +54 -54
- package/dist/templates/markdown/spec/backend/error-handling.md.txt +51 -51
- package/dist/templates/markdown/spec/backend/index.md.txt +38 -38
- package/dist/templates/markdown/spec/backend/logging-guidelines.md.txt +51 -51
- package/dist/templates/markdown/spec/backend/quality-guidelines.md.txt +51 -51
- package/dist/templates/markdown/spec/frontend/component-guidelines.md.txt +59 -59
- package/dist/templates/markdown/spec/frontend/directory-structure.md.txt +54 -54
- package/dist/templates/markdown/spec/frontend/hook-guidelines.md.txt +51 -51
- package/dist/templates/markdown/spec/frontend/index.md.txt +39 -39
- package/dist/templates/markdown/spec/frontend/quality-guidelines.md.txt +51 -51
- package/dist/templates/markdown/spec/frontend/state-management.md.txt +51 -51
- package/dist/templates/markdown/spec/frontend/type-safety.md.txt +51 -51
- package/dist/templates/markdown/spec/guides/code-reuse-thinking-guide.md.txt +174 -174
- package/dist/templates/markdown/spec/guides/cross-layer-thinking-guide.md.txt +162 -162
- package/dist/templates/markdown/spec/guides/cross-platform-thinking-guide.md.txt +17 -634
- package/dist/templates/markdown/spec/guides/debug-loop-guide.md.txt +227 -227
- package/dist/templates/markdown/spec/guides/durable-learning-decision-guide.md.txt +75 -75
- package/dist/templates/markdown/spec/guides/e2e-walkthrough-guide.md.txt +88 -93
- package/dist/templates/markdown/spec/guides/index.md.txt +131 -131
- package/dist/templates/markdown/spec/guides/prototype-guide.md.txt +137 -139
- package/dist/templates/markdown/spec/guides/test-discipline-guide.md.txt +179 -179
- package/dist/templates/markdown/workspace-index.md +122 -125
- package/dist/templates/markdown/worktree.yaml.txt +58 -58
- package/dist/templates/pactile/CONTEXT.md +101 -113
- package/dist/templates/pactile/config/execution-strategy-rules.json +30 -31
- package/dist/templates/pactile/config.yaml +111 -130
- package/dist/templates/pactile/docs/adr/README.md +21 -21
- package/dist/templates/pactile/gitignore.txt +35 -35
- package/dist/templates/pactile/index.d.ts +3 -127
- package/dist/templates/pactile/index.d.ts.map +1 -1
- package/dist/templates/pactile/index.js +13 -298
- package/dist/templates/pactile/index.js.map +1 -1
- package/dist/templates/pactile/modules/approval-personal/contract.md +43 -43
- package/dist/templates/pactile/modules/close-basic/contract.md +37 -37
- package/dist/templates/pactile/modules/context-progressive/contract.md +44 -44
- package/dist/templates/pactile/modules/debug-recovery/contract.md +44 -44
- package/dist/templates/pactile/modules/define-basic/contract.md +39 -39
- package/dist/templates/pactile/modules/define-extended/contract.md +45 -45
- package/dist/templates/pactile/modules/execute-agent/contract.md +38 -38
- package/dist/templates/pactile/modules/independent-check/contract.md +35 -35
- package/dist/templates/pactile/modules/index.json +127 -133
- package/dist/templates/pactile/modules/intake-basic/contract.md +34 -34
- package/dist/templates/pactile/modules/observability-local/contract.md +31 -31
- package/dist/templates/pactile/modules/parent-child/contract.md +45 -45
- package/dist/templates/pactile/modules/personal-memory/contract.md +55 -55
- package/dist/templates/pactile/modules/retention-storage/contract.md +43 -43
- package/dist/templates/pactile/modules/retrieval-extended/contract.md +78 -77
- package/dist/templates/pactile/modules/session-transfer/contract.md +41 -41
- package/dist/templates/pactile/modules/spec-learning/contract.md +50 -50
- package/dist/templates/pactile/modules/vcs-integration/contract.md +46 -46
- package/dist/templates/pactile/modules/verify-basic/contract.md +38 -38
- package/dist/templates/pactile/modules/worker-orchestration/contract.md +47 -47
- package/dist/templates/pactile/scripts/retrieval_probe_matrix_template.json +43 -43
- package/dist/templates/pactile/tasks/locale/en/default-prd.md +27 -27
- package/dist/templates/pactile/tasks/locale/zh/default-prd.md +27 -27
- package/dist/templates/pactile/tasks/templates/release-execution/design.md +60 -60
- package/dist/templates/pactile/tasks/templates/release-execution/handoff-template.md +28 -28
- package/dist/templates/pactile/tasks/templates/release-execution/implement.md +28 -28
- package/dist/templates/pactile/tasks/templates/release-execution/prd.md +30 -30
- package/dist/templates/pactile/tasks/templates/release-readiness/design.md +49 -49
- package/dist/templates/pactile/tasks/templates/release-readiness/handoff-template.md +38 -38
- package/dist/templates/pactile/tasks/templates/release-readiness/implement.md +28 -28
- package/dist/templates/pactile/tasks/templates/release-readiness/prd.md +30 -30
- package/dist/templates/pactile/workflow.md +65 -64
- package/dist/types/ai-tools.d.ts +12 -13
- package/dist/types/ai-tools.d.ts.map +1 -1
- package/dist/types/ai-tools.js +15 -14
- package/dist/types/ai-tools.js.map +1 -1
- package/dist/utils/codebase-retrieval-router.d.ts +1 -1
- package/dist/utils/codebase-retrieval-router.d.ts.map +1 -1
- package/dist/utils/cwd-guard.js +1 -1
- package/dist/utils/cwd-guard.js.map +1 -1
- package/dist/utils/developer.d.ts +5 -0
- package/dist/utils/developer.d.ts.map +1 -0
- package/dist/utils/developer.js +38 -0
- package/dist/utils/developer.js.map +1 -0
- package/dist/utils/git-root.d.ts +3 -0
- package/dist/utils/git-root.d.ts.map +1 -0
- package/dist/utils/git-root.js +24 -0
- package/dist/utils/git-root.js.map +1 -0
- package/dist/utils/local-date.d.ts +3 -0
- package/dist/utils/local-date.d.ts.map +1 -0
- package/dist/utils/local-date.js +8 -0
- package/dist/utils/local-date.js.map +1 -0
- package/dist/utils/manifest-prune.d.ts +5 -4
- package/dist/utils/manifest-prune.d.ts.map +1 -1
- package/dist/utils/manifest-prune.js +11 -21
- package/dist/utils/manifest-prune.js.map +1 -1
- package/dist/utils/p36-upgrade.d.ts +1 -1
- package/dist/utils/p36-upgrade.d.ts.map +1 -1
- package/dist/utils/p36-upgrade.js +1 -1
- package/dist/utils/p36-upgrade.js.map +1 -1
- package/dist/utils/post-update-smoke.d.ts +1 -4
- package/dist/utils/post-update-smoke.d.ts.map +1 -1
- package/dist/utils/post-update-smoke.js +13 -25
- package/dist/utils/post-update-smoke.js.map +1 -1
- package/dist/utils/project-capabilities.d.ts +2 -17
- package/dist/utils/project-capabilities.d.ts.map +1 -1
- package/dist/utils/project-capabilities.js +14 -119
- package/dist/utils/project-capabilities.js.map +1 -1
- package/dist/utils/readiness.d.ts +14 -0
- package/dist/utils/readiness.d.ts.map +1 -1
- package/dist/utils/readiness.js +61 -30
- package/dist/utils/readiness.js.map +1 -1
- package/dist/utils/retrieval-execution-telemetry.d.ts +1 -1
- package/dist/utils/retrieval-execution-telemetry.d.ts.map +1 -1
- package/dist/utils/retrieval-result-ranking.d.ts +1 -1
- package/dist/utils/retrieval-result-ranking.d.ts.map +1 -1
- package/dist/utils/retrieval-tool-classification.d.ts +1 -1
- package/dist/utils/retrieval-tool-classification.d.ts.map +1 -1
- package/dist/utils/task-json.d.ts +3 -3
- package/dist/utils/task-json.d.ts.map +1 -1
- package/dist/utils/task-json.js +3 -3
- package/dist/utils/task-json.js.map +1 -1
- package/dist/utils/template-hash.d.ts +4 -0
- package/dist/utils/template-hash.d.ts.map +1 -1
- package/dist/utils/template-hash.js +1 -1
- package/dist/utils/template-hash.js.map +1 -1
- package/dist/utils/update-rollout-report.d.ts +9 -0
- package/dist/utils/update-rollout-report.d.ts.map +1 -1
- package/dist/utils/update-rollout-report.js +14 -1
- package/dist/utils/update-rollout-report.js.map +1 -1
- package/package.json +22 -11
- package/scripts/postinstall.js +6 -6
- package/dist/commands/channel/adapters/claude.d.ts +0 -29
- package/dist/commands/channel/adapters/claude.d.ts.map +0 -1
- package/dist/commands/channel/adapters/claude.js +0 -203
- package/dist/commands/channel/adapters/claude.js.map +0 -1
- package/dist/commands/channel/adapters/codex.d.ts +0 -85
- package/dist/commands/channel/adapters/codex.d.ts.map +0 -1
- package/dist/commands/channel/adapters/codex.js +0 -505
- package/dist/commands/channel/adapters/codex.js.map +0 -1
- package/dist/commands/channel/adapters/index.d.ts +0 -84
- package/dist/commands/channel/adapters/index.d.ts.map +0 -1
- package/dist/commands/channel/adapters/index.js +0 -115
- package/dist/commands/channel/adapters/index.js.map +0 -1
- package/dist/commands/channel/adapters/types.d.ts +0 -33
- package/dist/commands/channel/adapters/types.d.ts.map +0 -1
- package/dist/commands/channel/adapters/types.js +0 -2
- package/dist/commands/channel/adapters/types.js.map +0 -1
- package/dist/commands/channel/agent-loader.d.ts +0 -32
- package/dist/commands/channel/agent-loader.d.ts.map +0 -1
- package/dist/commands/channel/agent-loader.js +0 -154
- package/dist/commands/channel/agent-loader.js.map +0 -1
- package/dist/commands/channel/context-loader.d.ts +0 -26
- package/dist/commands/channel/context-loader.d.ts.map +0 -1
- package/dist/commands/channel/context-loader.js +0 -290
- package/dist/commands/channel/context-loader.js.map +0 -1
- package/dist/commands/channel/context.d.ts +0 -16
- package/dist/commands/channel/context.d.ts.map +0 -1
- package/dist/commands/channel/context.js +0 -83
- package/dist/commands/channel/context.js.map +0 -1
- package/dist/commands/channel/create.d.ts +0 -27
- package/dist/commands/channel/create.d.ts.map +0 -1
- package/dist/commands/channel/create.js +0 -39
- package/dist/commands/channel/create.js.map +0 -1
- package/dist/commands/channel/dev-parse-trace.d.ts +0 -14
- package/dist/commands/channel/dev-parse-trace.d.ts.map +0 -1
- package/dist/commands/channel/dev-parse-trace.js +0 -70
- package/dist/commands/channel/dev-parse-trace.js.map +0 -1
- package/dist/commands/channel/guard.d.ts +0 -150
- package/dist/commands/channel/guard.d.ts.map +0 -1
- package/dist/commands/channel/guard.js +0 -475
- package/dist/commands/channel/guard.js.map +0 -1
- package/dist/commands/channel/index.d.ts +0 -3
- package/dist/commands/channel/index.d.ts.map +0 -1
- package/dist/commands/channel/index.js +0 -531
- package/dist/commands/channel/index.js.map +0 -1
- package/dist/commands/channel/interrupt.d.ts +0 -10
- package/dist/commands/channel/interrupt.d.ts.map +0 -1
- package/dist/commands/channel/interrupt.js +0 -22
- package/dist/commands/channel/interrupt.js.map +0 -1
- package/dist/commands/channel/kill.d.ts +0 -7
- package/dist/commands/channel/kill.d.ts.map +0 -1
- package/dist/commands/channel/kill.js +0 -121
- package/dist/commands/channel/kill.js.map +0 -1
- package/dist/commands/channel/list.d.ts +0 -17
- package/dist/commands/channel/list.d.ts.map +0 -1
- package/dist/commands/channel/list.js +0 -233
- package/dist/commands/channel/list.js.map +0 -1
- package/dist/commands/channel/messages.d.ts +0 -15
- package/dist/commands/channel/messages.d.ts.map +0 -1
- package/dist/commands/channel/messages.js +0 -245
- package/dist/commands/channel/messages.js.map +0 -1
- package/dist/commands/channel/rm.d.ts +0 -27
- package/dist/commands/channel/rm.d.ts.map +0 -1
- package/dist/commands/channel/rm.js +0 -216
- package/dist/commands/channel/rm.js.map +0 -1
- package/dist/commands/channel/run.d.ts +0 -30
- package/dist/commands/channel/run.d.ts.map +0 -1
- package/dist/commands/channel/run.js +0 -130
- package/dist/commands/channel/run.js.map +0 -1
- package/dist/commands/channel/send.d.ts +0 -11
- package/dist/commands/channel/send.d.ts.map +0 -1
- package/dist/commands/channel/send.js +0 -24
- package/dist/commands/channel/send.js.map +0 -1
- package/dist/commands/channel/spawn.d.ts +0 -40
- package/dist/commands/channel/spawn.d.ts.map +0 -1
- package/dist/commands/channel/spawn.js +0 -242
- package/dist/commands/channel/spawn.js.map +0 -1
- package/dist/commands/channel/store/events.d.ts +0 -39
- package/dist/commands/channel/store/events.d.ts.map +0 -1
- package/dist/commands/channel/store/events.js +0 -87
- package/dist/commands/channel/store/events.js.map +0 -1
- package/dist/commands/channel/store/filter.d.ts +0 -3
- package/dist/commands/channel/store/filter.d.ts.map +0 -1
- package/dist/commands/channel/store/filter.js +0 -2
- package/dist/commands/channel/store/filter.js.map +0 -1
- package/dist/commands/channel/store/lock.d.ts +0 -23
- package/dist/commands/channel/store/lock.d.ts.map +0 -1
- package/dist/commands/channel/store/lock.js +0 -99
- package/dist/commands/channel/store/lock.js.map +0 -1
- package/dist/commands/channel/store/paths.d.ts +0 -63
- package/dist/commands/channel/store/paths.d.ts.map +0 -1
- package/dist/commands/channel/store/paths.js +0 -247
- package/dist/commands/channel/store/paths.js.map +0 -1
- package/dist/commands/channel/store/schema.d.ts +0 -27
- package/dist/commands/channel/store/schema.d.ts.map +0 -1
- package/dist/commands/channel/store/schema.js +0 -34
- package/dist/commands/channel/store/schema.js.map +0 -1
- package/dist/commands/channel/store/thread-state.d.ts +0 -5
- package/dist/commands/channel/store/thread-state.d.ts.map +0 -1
- package/dist/commands/channel/store/thread-state.js +0 -16
- package/dist/commands/channel/store/thread-state.js.map +0 -1
- package/dist/commands/channel/store/watch.d.ts +0 -19
- package/dist/commands/channel/store/watch.d.ts.map +0 -1
- package/dist/commands/channel/store/watch.js +0 -146
- package/dist/commands/channel/store/watch.js.map +0 -1
- package/dist/commands/channel/supervisor/idle.d.ts +0 -46
- package/dist/commands/channel/supervisor/idle.d.ts.map +0 -1
- package/dist/commands/channel/supervisor/idle.js +0 -72
- package/dist/commands/channel/supervisor/idle.js.map +0 -1
- package/dist/commands/channel/supervisor/inbox.d.ts +0 -30
- package/dist/commands/channel/supervisor/inbox.d.ts.map +0 -1
- package/dist/commands/channel/supervisor/inbox.js +0 -160
- package/dist/commands/channel/supervisor/inbox.js.map +0 -1
- package/dist/commands/channel/supervisor/shutdown.d.ts +0 -68
- package/dist/commands/channel/supervisor/shutdown.d.ts.map +0 -1
- package/dist/commands/channel/supervisor/shutdown.js +0 -146
- package/dist/commands/channel/supervisor/shutdown.js.map +0 -1
- package/dist/commands/channel/supervisor/stdout.d.ts +0 -51
- package/dist/commands/channel/supervisor/stdout.d.ts.map +0 -1
- package/dist/commands/channel/supervisor/stdout.js +0 -121
- package/dist/commands/channel/supervisor/stdout.js.map +0 -1
- package/dist/commands/channel/supervisor/turns.d.ts +0 -31
- package/dist/commands/channel/supervisor/turns.d.ts.map +0 -1
- package/dist/commands/channel/supervisor/turns.js +0 -45
- package/dist/commands/channel/supervisor/turns.js.map +0 -1
- package/dist/commands/channel/supervisor/warning.d.ts +0 -48
- package/dist/commands/channel/supervisor/warning.d.ts.map +0 -1
- package/dist/commands/channel/supervisor/warning.js +0 -77
- package/dist/commands/channel/supervisor/warning.js.map +0 -1
- package/dist/commands/channel/supervisor.d.ts +0 -59
- package/dist/commands/channel/supervisor.d.ts.map +0 -1
- package/dist/commands/channel/supervisor.js +0 -345
- package/dist/commands/channel/supervisor.js.map +0 -1
- package/dist/commands/channel/text-body.d.ts +0 -13
- package/dist/commands/channel/text-body.d.ts.map +0 -1
- package/dist/commands/channel/text-body.js +0 -47
- package/dist/commands/channel/text-body.js.map +0 -1
- package/dist/commands/channel/threads.d.ts +0 -39
- package/dist/commands/channel/threads.d.ts.map +0 -1
- package/dist/commands/channel/threads.js +0 -106
- package/dist/commands/channel/threads.js.map +0 -1
- package/dist/commands/channel/title.d.ts +0 -12
- package/dist/commands/channel/title.d.ts.map +0 -1
- package/dist/commands/channel/title.js +0 -24
- package/dist/commands/channel/title.js.map +0 -1
- package/dist/commands/channel/wait.d.ts +0 -17
- package/dist/commands/channel/wait.d.ts.map +0 -1
- package/dist/commands/channel/wait.js +0 -75
- package/dist/commands/channel/wait.js.map +0 -1
- package/dist/commands/validate-rules.d.ts +0 -6
- package/dist/commands/validate-rules.d.ts.map +0 -1
- package/dist/commands/validate-rules.js +0 -33
- package/dist/commands/validate-rules.js.map +0 -1
- package/dist/configurators/cursor.d.ts +0 -21
- package/dist/configurators/cursor.d.ts.map +0 -1
- package/dist/configurators/cursor.js +0 -51
- package/dist/configurators/cursor.js.map +0 -1
- package/dist/pactile/adapters/cursor/index.d.ts +0 -60
- package/dist/pactile/adapters/cursor/index.d.ts.map +0 -1
- package/dist/pactile/adapters/cursor/index.js +0 -186
- package/dist/pactile/adapters/cursor/index.js.map +0 -1
- package/dist/templates/common/optional-skills/chrome-cdp/SKILL.md +0 -179
- package/dist/templates/common/optional-skills/chrome-cdp/examples/fetch-hook-api-capture.md +0 -149
- package/dist/templates/common/optional-skills/chrome-cdp/scripts/cdp.mjs +0 -904
- package/dist/templates/cursor/agents/pactile-check.md +0 -58
- package/dist/templates/cursor/agents/pactile-implement.md +0 -56
- package/dist/templates/cursor/agents/pactile-research.md +0 -51
- package/dist/templates/cursor/commands/handoff.md +0 -101
- package/dist/templates/cursor/fixtures/expected-rules.d.ts +0 -14
- package/dist/templates/cursor/fixtures/expected-rules.d.ts.map +0 -1
- package/dist/templates/cursor/fixtures/expected-rules.js +0 -20
- package/dist/templates/cursor/fixtures/expected-rules.js.map +0 -1
- package/dist/templates/cursor/hooks.json +0 -52
- package/dist/templates/cursor/index.d.ts +0 -19
- package/dist/templates/cursor/index.d.ts.map +0 -1
- package/dist/templates/cursor/index.js +0 -19
- package/dist/templates/cursor/index.js.map +0 -1
- package/dist/templates/cursor/rules/pactile-bootstrap.mdc +0 -18
- package/dist/templates/cursor/worktrees.json +0 -11
- package/dist/templates/markdown/framework/cursor-context-injection-guide.md.txt +0 -85
- package/dist/templates/markdown/framework/cursor-native-modes-guide.md.txt +0 -239
- package/dist/templates/markdown/framework/cursor-semantic-compliance.md.txt +0 -41
- package/dist/templates/markdown/framework/cursor-subagent-policy.md.txt +0 -90
- package/dist/templates/markdown/framework/internal-skills-cursor-reachability.md.txt +0 -45
- package/dist/templates/markdown/prompts/run-semantic-slice-12.md.txt +0 -25
- package/dist/templates/pactile/modules/candidate-pool/contract.md +0 -37
- package/dist/templates/pactile/pool/README.md +0 -149
- package/dist/templates/pactile/pool/items/.gitkeep +0 -0
- package/dist/templates/pactile/pool/plan.md +0 -50
- package/dist/templates/pactile/scripts/__init__.py +0 -5
- package/dist/templates/pactile/scripts/add_session.py +0 -547
- package/dist/templates/pactile/scripts/build_context_pack.py +0 -17
- package/dist/templates/pactile/scripts/build_retrieval_pack.py +0 -376
- package/dist/templates/pactile/scripts/codegraph_session_smoke.py +0 -76
- package/dist/templates/pactile/scripts/common/__init__.py +0 -103
- package/dist/templates/pactile/scripts/common/active_task.py +0 -576
- package/dist/templates/pactile/scripts/common/adapter_middleware.py +0 -1373
- package/dist/templates/pactile/scripts/common/artifact_locale.py +0 -303
- package/dist/templates/pactile/scripts/common/artifact_search.py +0 -587
- package/dist/templates/pactile/scripts/common/cli_adapter.py +0 -135
- package/dist/templates/pactile/scripts/common/cli_environment.py +0 -155
- package/dist/templates/pactile/scripts/common/codebase_retrieval_router.py +0 -1339
- package/dist/templates/pactile/scripts/common/config.py +0 -497
- package/dist/templates/pactile/scripts/common/context_pack.py +0 -371
- package/dist/templates/pactile/scripts/common/cursor_retrieval_env.py +0 -31
- package/dist/templates/pactile/scripts/common/developer.py +0 -190
- package/dist/templates/pactile/scripts/common/execution_strategy.py +0 -268
- package/dist/templates/pactile/scripts/common/full_quality.py +0 -237
- package/dist/templates/pactile/scripts/common/git.py +0 -37
- package/dist/templates/pactile/scripts/common/git_context.py +0 -198
- package/dist/templates/pactile/scripts/common/injection_budget.py +0 -317
- package/dist/templates/pactile/scripts/common/io.py +0 -37
- package/dist/templates/pactile/scripts/common/kernel_command.py +0 -369
- package/dist/templates/pactile/scripts/common/lite_context.py +0 -280
- package/dist/templates/pactile/scripts/common/log.py +0 -45
- package/dist/templates/pactile/scripts/common/ondemand_topology.py +0 -419
- package/dist/templates/pactile/scripts/common/packages_context.py +0 -239
- package/dist/templates/pactile/scripts/common/pactile_config.py +0 -131
- package/dist/templates/pactile/scripts/common/parallel_declaration.py +0 -369
- package/dist/templates/pactile/scripts/common/parent_orchestration.py +0 -1198
- package/dist/templates/pactile/scripts/common/paths.py +0 -756
- package/dist/templates/pactile/scripts/common/pool_refs.py +0 -119
- package/dist/templates/pactile/scripts/common/pool_slice.py +0 -269
- package/dist/templates/pactile/scripts/common/pool_store.py +0 -766
- package/dist/templates/pactile/scripts/common/project_file_stats.py +0 -91
- package/dist/templates/pactile/scripts/common/retrieval_adapter_metadata.py +0 -943
- package/dist/templates/pactile/scripts/common/retrieval_agent_instructions.py +0 -123
- package/dist/templates/pactile/scripts/common/retrieval_evidence.py +0 -915
- package/dist/templates/pactile/scripts/common/retrieval_pack.py +0 -422
- package/dist/templates/pactile/scripts/common/retrieval_pack_context.py +0 -122
- package/dist/templates/pactile/scripts/common/retrieval_plan_gate.py +0 -61
- package/dist/templates/pactile/scripts/common/retrieval_result_ranking.py +0 -104
- package/dist/templates/pactile/scripts/common/retrieval_tool_classification.py +0 -166
- package/dist/templates/pactile/scripts/common/safe_commit.py +0 -285
- package/dist/templates/pactile/scripts/common/semantic_plan_gate.py +0 -53
- package/dist/templates/pactile/scripts/common/session_context.py +0 -1213
- package/dist/templates/pactile/scripts/common/session_memory.py +0 -386
- package/dist/templates/pactile/scripts/common/session_pack.py +0 -886
- package/dist/templates/pactile/scripts/common/smart_search_evidence.py +0 -514
- package/dist/templates/pactile/scripts/common/smart_search_resolve.py +0 -150
- package/dist/templates/pactile/scripts/common/subagent_dispatch.py +0 -592
- package/dist/templates/pactile/scripts/common/task_context.py +0 -241
- package/dist/templates/pactile/scripts/common/task_dashboard.py +0 -286
- package/dist/templates/pactile/scripts/common/task_dependencies.py +0 -648
- package/dist/templates/pactile/scripts/common/task_gates.py +0 -2478
- package/dist/templates/pactile/scripts/common/task_map.py +0 -703
- package/dist/templates/pactile/scripts/common/task_queue.py +0 -188
- package/dist/templates/pactile/scripts/common/task_store.py +0 -2252
- package/dist/templates/pactile/scripts/common/task_utils.py +0 -274
- package/dist/templates/pactile/scripts/common/tasks.py +0 -231
- package/dist/templates/pactile/scripts/common/test_adapter_middleware.py +0 -199
- package/dist/templates/pactile/scripts/common/test_depends_mode_block.py +0 -509
- package/dist/templates/pactile/scripts/common/test_full_quality.py +0 -197
- package/dist/templates/pactile/scripts/common/test_kernel_command.py +0 -336
- package/dist/templates/pactile/scripts/common/test_lite_path.py +0 -190
- package/dist/templates/pactile/scripts/common/test_observable_defaults.py +0 -141
- package/dist/templates/pactile/scripts/common/test_ondemand_topology.py +0 -237
- package/dist/templates/pactile/scripts/common/test_parallel_declaration.py +0 -264
- package/dist/templates/pactile/scripts/common/test_pool_slice.py +0 -198
- package/dist/templates/pactile/scripts/common/test_pool_store.py +0 -452
- package/dist/templates/pactile/scripts/common/test_retrieval_arbitration.py +0 -331
- package/dist/templates/pactile/scripts/common/test_task_dashboard.py +0 -155
- package/dist/templates/pactile/scripts/common/test_task_dependencies.py +0 -329
- package/dist/templates/pactile/scripts/common/test_task_store_kernel_patch.py +0 -163
- package/dist/templates/pactile/scripts/common/types.py +0 -110
- package/dist/templates/pactile/scripts/common/workflow_phase.py +0 -194
- package/dist/templates/pactile/scripts/compile_session_pack.py +0 -15
- package/dist/templates/pactile/scripts/cursor_retrieval_probe.py +0 -64
- package/dist/templates/pactile/scripts/cursor_retrieval_probe_prompt.md +0 -33
- package/dist/templates/pactile/scripts/generate_dispatch_prompt.py +0 -182
- package/dist/templates/pactile/scripts/get_context.py +0 -19
- package/dist/templates/pactile/scripts/get_developer.py +0 -26
- package/dist/templates/pactile/scripts/hooks/linear_sync.py +0 -243
- package/dist/templates/pactile/scripts/init_developer.py +0 -51
- package/dist/templates/pactile/scripts/injection_budget_probe.py +0 -69
- package/dist/templates/pactile/scripts/pool.py +0 -237
- package/dist/templates/pactile/scripts/rank_retrieval_candidates.py +0 -98
- package/dist/templates/pactile/scripts/route_codebase_retrieval.py +0 -72
- package/dist/templates/pactile/scripts/run_smart_search.py +0 -12
- package/dist/templates/pactile/scripts/score_evidence.py +0 -131
- package/dist/templates/pactile/scripts/search_artifacts.py +0 -13
- package/dist/templates/pactile/scripts/search_memory.py +0 -12
- package/dist/templates/pactile/scripts/spec_health_outcomes.py +0 -160
- package/dist/templates/pactile/scripts/task.py +0 -1118
- package/dist/templates/pactile/scripts/verify_evidence_probe.py +0 -138
- package/dist/templates/shared-hooks/event-bridge.py +0 -121
- package/dist/templates/shared-hooks/index.d.ts +0 -50
- package/dist/templates/shared-hooks/index.d.ts.map +0 -1
- package/dist/templates/shared-hooks/index.js +0 -96
- package/dist/templates/shared-hooks/index.js.map +0 -1
- package/dist/templates/shared-hooks/inject-retrieval-plan.py +0 -217
- package/dist/templates/shared-hooks/inject-shell-session-context.py +0 -183
- package/dist/templates/shared-hooks/inject-subagent-context.py +0 -267
- package/dist/templates/shared-hooks/inject-workflow-state.py +0 -106
- package/dist/templates/shared-hooks/rename-session-for-task.py +0 -231
- package/dist/templates/shared-hooks/research-end-retrieval-pack.py +0 -345
- package/dist/templates/shared-hooks/session-start.py +0 -355
- package/dist/templates/shared-hooks/spec-write-audit.py +0 -173
- package/dist/utils/mirror-check.d.ts +0 -22
- package/dist/utils/mirror-check.d.ts.map +0 -1
- package/dist/utils/mirror-check.js +0 -90
- package/dist/utils/mirror-check.js.map +0 -1
- package/dist/utils/validate-rules.d.ts +0 -21
- package/dist/utils/validate-rules.d.ts.map +0 -1
- package/dist/utils/validate-rules.js +0 -88
- package/dist/utils/validate-rules.js.map +0 -1
|
@@ -0,0 +1,1026 @@
|
|
|
1
|
+
import { execFileSync, execSync } from "node:child_process";
|
|
2
|
+
import fs from "node:fs";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { applyKernelArchive, applyKernelCreate, applyKernelPatch, applyKernelRecordGate, applyKernelStart, assertFullQualityForPhase, buildAcEvidenceLedger, emptyTaskRecord, parseAcceptanceItems, qualityFingerprint, readDependencyGraph, readKernel, readTopology, resolveRequiredControls, unmetRequires } from "../core/task/index.js";
|
|
5
|
+
import { addContextEntry, CONTEXT_FILES, readContextEntries, validateContextFile } from "../pactile/task/context.js";
|
|
6
|
+
import { readPactileConfig } from "../pactile/task/config.js";
|
|
7
|
+
import { checkArchive, checkStartExecution, dependencyStatus } from "../pactile/task/guards.js";
|
|
8
|
+
import { exitTask, resolveSelectedTask, resolveTaskDir, selectTask } from "../pactile/task/session.js";
|
|
9
|
+
import { artifactFingerprint, contractFingerprint, currentGateErrors, readStrategyContract, requiredGates } from "../pactile/task/strategy.js";
|
|
10
|
+
import { CHILD_STATES, childStateErrors, ensureTaskMap, readTaskMap, writeTaskMap } from "../pactile/task/task-map.js";
|
|
11
|
+
import { readDeveloper } from "../utils/developer.js";
|
|
12
|
+
import { sameGitRoot } from "../utils/git-root.js";
|
|
13
|
+
import { localDate } from "../utils/local-date.js";
|
|
14
|
+
import { getAllTaskTemplates } from "../templates/pactile/index.js";
|
|
15
|
+
import { learningScaffold, prepareArchiveEvidence } from "../pactile/task/scaffold.js";
|
|
16
|
+
function option(args, name) {
|
|
17
|
+
const index = args.indexOf(name);
|
|
18
|
+
return index >= 0 ? args[index + 1] : undefined;
|
|
19
|
+
}
|
|
20
|
+
function requireArgument(value, label) {
|
|
21
|
+
if (!value || value.startsWith("--"))
|
|
22
|
+
throw new Error(`${label} is required`);
|
|
23
|
+
return value;
|
|
24
|
+
}
|
|
25
|
+
function taskDir(root, reference) {
|
|
26
|
+
const dir = resolveTaskDir(root, reference);
|
|
27
|
+
if (!fs.statSync(dir, { throwIfNoEntry: false })?.isDirectory())
|
|
28
|
+
throw new Error(`Task not found: ${reference}`);
|
|
29
|
+
return dir;
|
|
30
|
+
}
|
|
31
|
+
function taskRecord(dir) {
|
|
32
|
+
try {
|
|
33
|
+
const value = JSON.parse(fs.readFileSync(path.join(dir, "task.json"), "utf8"));
|
|
34
|
+
return value && typeof value === "object" ? value : null;
|
|
35
|
+
}
|
|
36
|
+
catch {
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
function runTaskHooks(root, event, taskJson) {
|
|
41
|
+
const hooks = readPactileConfig(root).hooks;
|
|
42
|
+
const entries = hooks && typeof hooks === "object" && !Array.isArray(hooks) ? hooks[event] : undefined;
|
|
43
|
+
if (!Array.isArray(entries))
|
|
44
|
+
return;
|
|
45
|
+
for (const command of entries) {
|
|
46
|
+
if (typeof command !== "string" || !command.trim())
|
|
47
|
+
continue;
|
|
48
|
+
try {
|
|
49
|
+
execSync(command, { cwd: root, env: { ...process.env, TASK_JSON_PATH: taskJson }, encoding: "utf8", stdio: ["ignore", "pipe", "pipe"], timeout: 60_000 });
|
|
50
|
+
}
|
|
51
|
+
catch (error) {
|
|
52
|
+
console.warn(`[WARN] Hook failed (${event}): ${command} — ${error instanceof Error ? error.message : String(error)}`);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
function patchTask(root, reference, change, operation, extras) {
|
|
57
|
+
const dir = taskDir(root, reference);
|
|
58
|
+
if (!taskRecord(dir))
|
|
59
|
+
throw new Error(`task.json not found at ${dir}`);
|
|
60
|
+
const revision = readKernel({ taskDir: dir, cwd: root }).kernel.revision;
|
|
61
|
+
applyKernelPatch({
|
|
62
|
+
taskDir: dir,
|
|
63
|
+
cwd: root,
|
|
64
|
+
expectedRevision: revision,
|
|
65
|
+
actor: `pactile task ${operation}`,
|
|
66
|
+
idempotencyKey: `patch:${operation}:${path.basename(dir)}:r${revision}`,
|
|
67
|
+
evidence: Object.keys(change).join(",") || operation,
|
|
68
|
+
record: change,
|
|
69
|
+
extras,
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
function activeTasks(root) {
|
|
73
|
+
const tasks = path.join(root, ".pactile", "tasks");
|
|
74
|
+
if (!fs.existsSync(tasks))
|
|
75
|
+
return [];
|
|
76
|
+
return fs.readdirSync(tasks, { withFileTypes: true })
|
|
77
|
+
.filter((entry) => entry.isDirectory() && entry.name !== "archive" && entry.name !== "locale" && entry.name !== "templates")
|
|
78
|
+
.map((entry) => ({ dir: entry.name, record: taskRecord(path.join(tasks, entry.name)) }))
|
|
79
|
+
.filter((item) => item.record !== null)
|
|
80
|
+
.sort((left, right) => left.dir.localeCompare(right.dir));
|
|
81
|
+
}
|
|
82
|
+
function locale(root) {
|
|
83
|
+
try {
|
|
84
|
+
const config = fs.readFileSync(path.join(root, ".pactile", "config.yaml"), "utf8");
|
|
85
|
+
return /^artifact_locale:\s*en\s*$/m.test(config) ? "en" : "zh";
|
|
86
|
+
}
|
|
87
|
+
catch {
|
|
88
|
+
return "zh";
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
function verifySeed(taskLocale) {
|
|
92
|
+
return taskLocale === "zh"
|
|
93
|
+
? "# 验证证据\n\n## Planning check\n\n_可选(Full 任务)— 记录规划阶段审查结果。_\n\n## Execution evidence\n\n### Validation commands\n\n<!-- 示例:Validation commands: <命令> — <结果> -->\n\n### Acceptance\n\n<!-- 示例:Final acceptance evidence: <验收标准达成说明> -->\n\n### Durable learning\n\n<!-- 示例:Durable learning decision: no durable learning -->\n"
|
|
94
|
+
: "# Verification Evidence\n\n## Planning check\n\n_Optional for Full tasks — record planning review outcomes._\n\n## Execution evidence\n\n### Validation commands\n\n<!-- Example: Validation commands: <command> — <outcome> -->\n\n### Acceptance\n\n<!-- Example: Final acceptance evidence: <criteria met> -->\n\n### Durable learning\n\n<!-- Example: Durable learning decision: no durable learning -->\n";
|
|
95
|
+
}
|
|
96
|
+
function createTask(args, root) {
|
|
97
|
+
const title = requireArgument(args[0], "title");
|
|
98
|
+
const slug = (option(args, "--slug") ?? title.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, ""));
|
|
99
|
+
if (!/^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(slug))
|
|
100
|
+
throw new Error("slug must contain lowercase letters, digits and hyphens");
|
|
101
|
+
const parentRef = option(args, "--parent");
|
|
102
|
+
if (parentRef) {
|
|
103
|
+
const parent = taskRecord(taskDir(root, parentRef));
|
|
104
|
+
if (parent?.status !== "planning")
|
|
105
|
+
throw new Error("create --parent requires a planning Parent task");
|
|
106
|
+
}
|
|
107
|
+
const developer = readDeveloper(root);
|
|
108
|
+
const assignee = option(args, "--assignee") ?? developer;
|
|
109
|
+
if (!assignee)
|
|
110
|
+
throw new Error("No developer set. Run pactile init --user <name> or pass --assignee");
|
|
111
|
+
const now = new Date();
|
|
112
|
+
const today = localDate(now);
|
|
113
|
+
const prefix = today.slice(5);
|
|
114
|
+
const dirName = `${prefix}-${slug}`;
|
|
115
|
+
const tasks = path.join(root, ".pactile", "tasks");
|
|
116
|
+
const dir = path.join(tasks, dirName);
|
|
117
|
+
if (fs.existsSync(path.join(dir, "task.json")))
|
|
118
|
+
throw new Error(`Task already exists: ${dirName}`);
|
|
119
|
+
const archive = path.join(tasks, "archive");
|
|
120
|
+
if (fs.existsSync(archive) && fs.readdirSync(archive, { withFileTypes: true }).some((month) => month.isDirectory() && fs.existsSync(path.join(archive, month.name, dirName)))) {
|
|
121
|
+
throw new Error(`Task already archived: ${dirName}`);
|
|
122
|
+
}
|
|
123
|
+
const taskLocale = locale(root);
|
|
124
|
+
const templatePath = path.join(tasks, "locale", taskLocale, "default-prd.md");
|
|
125
|
+
const prdTemplate = fs.existsSync(templatePath)
|
|
126
|
+
? fs.readFileSync(templatePath, "utf8")
|
|
127
|
+
: getAllTaskTemplates().get(`tasks/locale/${taskLocale}/default-prd.md`);
|
|
128
|
+
if (!prdTemplate)
|
|
129
|
+
throw new Error(`Task PRD template not found for locale ${taskLocale}`);
|
|
130
|
+
const contextSeeds = fs.existsSync(path.join(root, ".codex"))
|
|
131
|
+
? [".pactile/spec/guides/index.md", ".pactile/framework/verification-strength-guide.md", ".pactile/framework/injection-budget-guide.md"]
|
|
132
|
+
.filter((entry) => fs.existsSync(path.join(root, entry)))
|
|
133
|
+
: [];
|
|
134
|
+
if (fs.existsSync(path.join(root, ".codex")) && contextSeeds.length < 2) {
|
|
135
|
+
throw new Error("task create requires at least two existing spec guide paths for JSONL seed");
|
|
136
|
+
}
|
|
137
|
+
let baseBranch = "main";
|
|
138
|
+
try {
|
|
139
|
+
baseBranch = execFileSync("git", ["branch", "--show-current"], { cwd: root, encoding: "utf8", stdio: ["ignore", "pipe", "pipe"] }).trim() || "main";
|
|
140
|
+
}
|
|
141
|
+
catch { /* A non-Git project still has a valid default base branch. */ }
|
|
142
|
+
const description = option(args, "--description") ?? "";
|
|
143
|
+
const record = emptyTaskRecord({
|
|
144
|
+
id: slug, name: slug, title, description,
|
|
145
|
+
priority: option(args, "--priority") ?? "P2",
|
|
146
|
+
package: option(args, "--package") ?? null,
|
|
147
|
+
creator: developer ?? assignee,
|
|
148
|
+
assignee,
|
|
149
|
+
createdAt: today,
|
|
150
|
+
base_branch: baseBranch,
|
|
151
|
+
});
|
|
152
|
+
const rigor = option(args, "--rigor") ?? "lite";
|
|
153
|
+
if (rigor !== "lite" && rigor !== "full")
|
|
154
|
+
throw new Error("--rigor must be lite or full");
|
|
155
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
156
|
+
applyKernelCreate({ taskDir: dir, record, actor: "pactile task create", idempotencyKey: `create:${slug}`, evidence: "pactile task create", cwd: root,
|
|
157
|
+
extras: { required_controls: resolveRequiredControls({ rigor }) } });
|
|
158
|
+
const prd = path.join(dir, "prd.md");
|
|
159
|
+
const verify = path.join(dir, "verify.md");
|
|
160
|
+
if (!fs.existsSync(prd)) {
|
|
161
|
+
fs.writeFileSync(prd, prdTemplate.replaceAll("{title}", title).replaceAll("{goal}", description || (taskLocale === "zh" ? "待补充。" : "TBD.")), "utf8");
|
|
162
|
+
}
|
|
163
|
+
if (!fs.existsSync(verify))
|
|
164
|
+
fs.writeFileSync(verify, verifySeed(taskLocale), "utf8");
|
|
165
|
+
if (fs.existsSync(path.join(root, ".codex"))) {
|
|
166
|
+
for (const name of CONTEXT_FILES) {
|
|
167
|
+
const file = path.join(dir, name);
|
|
168
|
+
if (!fs.existsSync(file))
|
|
169
|
+
fs.writeFileSync(file, `${contextSeeds.map((entry) => JSON.stringify({ file: entry, reason: "default spec seed — curate entries for this task" })).join("\n")}\n`, "utf8");
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
if (parentRef)
|
|
173
|
+
linkChild(root, parentRef, dirName);
|
|
174
|
+
runTaskHooks(root, "after_create", path.join(dir, "task.json"));
|
|
175
|
+
console.log(path.relative(root, dir).replaceAll("\\", "/"));
|
|
176
|
+
}
|
|
177
|
+
function linkChild(root, parentRef, childRef) {
|
|
178
|
+
const parentDir = taskDir(root, parentRef);
|
|
179
|
+
const childDir = taskDir(root, childRef);
|
|
180
|
+
if (parentDir === childDir)
|
|
181
|
+
throw new Error("a task cannot be its own parent");
|
|
182
|
+
const parent = taskRecord(parentDir);
|
|
183
|
+
const child = taskRecord(childDir);
|
|
184
|
+
if (!parent || !child)
|
|
185
|
+
throw new Error("parent and child need task.json");
|
|
186
|
+
if (child.parent && child.parent !== path.basename(parentDir))
|
|
187
|
+
throw new Error(`single-parent tree: child already belongs to ${child.parent}`);
|
|
188
|
+
if (parent.parent === path.basename(childDir) || child.children.includes(path.basename(parentDir)))
|
|
189
|
+
throw new Error("parent-child cycle rejected");
|
|
190
|
+
if (parent.status !== "planning" || child.status !== "planning")
|
|
191
|
+
throw new Error("link children while both tasks are planning");
|
|
192
|
+
if (parent.children.includes(path.basename(childDir)) && child.parent === path.basename(parentDir))
|
|
193
|
+
return;
|
|
194
|
+
const nextChildren = [...new Set([...parent.children, path.basename(childDir)])];
|
|
195
|
+
patchTask(root, path.basename(parentDir), { children: nextChildren }, "add-subtask");
|
|
196
|
+
try {
|
|
197
|
+
patchTask(root, path.basename(childDir), { parent: path.basename(parentDir) }, "add-subtask");
|
|
198
|
+
}
|
|
199
|
+
catch (error) {
|
|
200
|
+
patchTask(root, path.basename(parentDir), { children: parent.children }, "add-subtask-rollback", { topology: { ...readTopology(readKernel({ taskDir: parentDir, cwd: root }).kernel.projection?.extras ?? {}), children: parent.children } });
|
|
201
|
+
throw error;
|
|
202
|
+
}
|
|
203
|
+
const nextParent = taskRecord(parentDir);
|
|
204
|
+
if (!nextParent)
|
|
205
|
+
throw new Error("parent projection vanished after link");
|
|
206
|
+
ensureTaskMap(parentDir, nextParent, `Linked Child ${path.basename(childDir)}.`);
|
|
207
|
+
}
|
|
208
|
+
function unlinkChild(root, parentRef, childRef) {
|
|
209
|
+
const parentDir = taskDir(root, parentRef);
|
|
210
|
+
const childDir = taskDir(root, childRef);
|
|
211
|
+
const parent = taskRecord(parentDir);
|
|
212
|
+
const child = taskRecord(childDir);
|
|
213
|
+
if (!parent || !child)
|
|
214
|
+
throw new Error("parent and child need task.json");
|
|
215
|
+
if (!parent.children.includes(path.basename(childDir)) || child.parent !== path.basename(parentDir))
|
|
216
|
+
throw new Error("parent-child link not found");
|
|
217
|
+
const map = readTaskMap(parentDir).data;
|
|
218
|
+
const entry = map?.children.find((item) => item.id === path.basename(childDir));
|
|
219
|
+
if (parent.status !== "planning" || child.status !== "planning" || (entry && entry.state !== "open"))
|
|
220
|
+
throw new Error("unlink only an open Child while both tasks are planning");
|
|
221
|
+
const nextChildren = parent.children.filter((id) => id !== path.basename(childDir));
|
|
222
|
+
const parentTopology = readTopology(readKernel({ taskDir: parentDir, cwd: root }).kernel.projection?.extras ?? {});
|
|
223
|
+
const childTopology = readTopology(readKernel({ taskDir: childDir, cwd: root }).kernel.projection?.extras ?? {});
|
|
224
|
+
patchTask(root, path.basename(childDir), { parent: null }, "remove-subtask", { topology: { ...childTopology, parent_id: null } });
|
|
225
|
+
patchTask(root, path.basename(parentDir), { children: nextChildren }, "remove-subtask", { topology: { ...parentTopology, children: nextChildren } });
|
|
226
|
+
const nextParent = taskRecord(parentDir);
|
|
227
|
+
if (nextParent)
|
|
228
|
+
ensureTaskMap(parentDir, nextParent, `Unlinked Child ${path.basename(childDir)}.`);
|
|
229
|
+
}
|
|
230
|
+
function prepareChildWorktree(root, args) {
|
|
231
|
+
const parentDir = taskDir(root, requireArgument(args[0], "parent task"));
|
|
232
|
+
const childDir = taskDir(root, requireArgument(args[1], "child task"));
|
|
233
|
+
const branch = requireArgument(option(args, "--branch"), "--branch");
|
|
234
|
+
const parent = taskRecord(parentDir);
|
|
235
|
+
const child = taskRecord(childDir);
|
|
236
|
+
if (!parent || !child)
|
|
237
|
+
throw new Error("Parent and Child need task.json");
|
|
238
|
+
if (child.parent !== path.basename(parentDir) || !parent.children.includes(path.basename(childDir)))
|
|
239
|
+
throw new Error("Child must be linked to the Parent");
|
|
240
|
+
const map = readTaskMap(parentDir);
|
|
241
|
+
if (!map.data?.children.some((entry) => entry.id === path.basename(childDir)))
|
|
242
|
+
throw new Error("Child missing from Parent task-map.md");
|
|
243
|
+
const base = option(args, "--base") ?? child.base_branch ?? parent.base_branch ?? "HEAD";
|
|
244
|
+
const worktreeRoot = path.resolve(root, ".pactile", "worktrees");
|
|
245
|
+
const destination = path.resolve(root, option(args, "--path") ?? path.join(worktreeRoot, path.basename(childDir)));
|
|
246
|
+
const relative = path.relative(worktreeRoot, destination);
|
|
247
|
+
const errors = [];
|
|
248
|
+
if (!relative || relative === ".." || relative.startsWith(`..${path.sep}`) || path.isAbsolute(relative))
|
|
249
|
+
errors.push("worktree path must stay under .pactile/worktrees");
|
|
250
|
+
if (fs.lstatSync(path.join(root, ".pactile"), { throwIfNoEntry: false })?.isSymbolicLink())
|
|
251
|
+
errors.push(".pactile must not be a symlink");
|
|
252
|
+
if (fs.lstatSync(worktreeRoot, { throwIfNoEntry: false })?.isSymbolicLink())
|
|
253
|
+
errors.push(".pactile/worktrees must not be a symlink");
|
|
254
|
+
let ancestor = worktreeRoot;
|
|
255
|
+
for (const segment of relative.split(path.sep).slice(0, -1)) {
|
|
256
|
+
ancestor = path.join(ancestor, segment);
|
|
257
|
+
if (fs.lstatSync(ancestor, { throwIfNoEntry: false })?.isSymbolicLink())
|
|
258
|
+
errors.push(`worktree path crosses a symlink: ${ancestor}`);
|
|
259
|
+
}
|
|
260
|
+
if (fs.existsSync(destination))
|
|
261
|
+
errors.push(`worktree path already exists: ${destination}`);
|
|
262
|
+
if (branch.startsWith("-") || /[\r\n]/.test(branch))
|
|
263
|
+
errors.push("invalid branch name");
|
|
264
|
+
if (typeof base !== "string" || base.startsWith("-") || /[\r\n]/.test(base))
|
|
265
|
+
errors.push("invalid base ref");
|
|
266
|
+
const git = (...gitArgs) => execFileSync("git", gitArgs, { cwd: root, encoding: "utf8", stdio: ["ignore", "pipe", "pipe"] }).trim();
|
|
267
|
+
try {
|
|
268
|
+
if (!sameGitRoot(git("rev-parse", "--show-toplevel"), root))
|
|
269
|
+
errors.push("prepare-child-worktree requires the project Git root");
|
|
270
|
+
git("check-ref-format", "--branch", branch);
|
|
271
|
+
if (typeof base === "string" && !base.startsWith("-"))
|
|
272
|
+
git("rev-parse", "--verify", `${base}^{commit}`);
|
|
273
|
+
}
|
|
274
|
+
catch {
|
|
275
|
+
errors.push("Git repository, branch, or base ref validation failed");
|
|
276
|
+
}
|
|
277
|
+
if (errors.length) {
|
|
278
|
+
console.error(errors.map((error) => ` - ${error}`).join("\n"));
|
|
279
|
+
return 1;
|
|
280
|
+
}
|
|
281
|
+
const worktreePath = path.relative(root, destination).replaceAll("\\", "/");
|
|
282
|
+
if (args.includes("--check")) {
|
|
283
|
+
console.log(`Prepare-child-worktree check: PASS\nBranch: ${branch}\nBase: ${base}\nPath: ${worktreePath}\nNo files changed.`);
|
|
284
|
+
return 0;
|
|
285
|
+
}
|
|
286
|
+
fs.mkdirSync(path.dirname(destination), { recursive: true });
|
|
287
|
+
let branchExists = false;
|
|
288
|
+
try {
|
|
289
|
+
git("rev-parse", "--verify", `refs/heads/${branch}`);
|
|
290
|
+
branchExists = true;
|
|
291
|
+
}
|
|
292
|
+
catch { /* New local branch. */ }
|
|
293
|
+
try {
|
|
294
|
+
git("worktree", "add", ...(branchExists ? [] : ["-b", branch]), destination, ...(branchExists ? [branch] : [base]));
|
|
295
|
+
}
|
|
296
|
+
catch (error) {
|
|
297
|
+
console.error(`git worktree add failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
298
|
+
return 1;
|
|
299
|
+
}
|
|
300
|
+
patchTask(root, path.basename(childDir), { branch, worktree_path: worktreePath }, "prepare-child-worktree");
|
|
301
|
+
const entry = map.data?.children.find((item) => item.id === path.basename(childDir));
|
|
302
|
+
if (!map.data || !entry)
|
|
303
|
+
throw new Error("Child vanished from Parent task-map.md after worktree creation");
|
|
304
|
+
Object.assign(entry, { isolation: "git-worktree", branch, worktree_path: worktreePath, base_ref: base, ref: `refs/heads/${branch}` });
|
|
305
|
+
writeTaskMap(parentDir, map.data, map.body, `Prepared Child ${entry.id} git worktree at ${worktreePath} from ${base}.`);
|
|
306
|
+
console.log(`Child worktree prepared: ${entry.id}\nBranch: ${branch}\nPath: ${worktreePath}`);
|
|
307
|
+
return 0;
|
|
308
|
+
}
|
|
309
|
+
function updateChildState(root, args, integrated) {
|
|
310
|
+
const parentDir = taskDir(root, requireArgument(args[0], "parent task"));
|
|
311
|
+
const childDir = taskDir(root, requireArgument(args[1], "child task"));
|
|
312
|
+
const state = requireArgument(args[2], "state");
|
|
313
|
+
if (!CHILD_STATES.includes(state))
|
|
314
|
+
throw new Error(`unknown child state: ${state}`);
|
|
315
|
+
if (integrated !== ["changes", "accepted", "integrating", "integrated", "cancelled"].includes(state))
|
|
316
|
+
throw new Error(integrated ? "use a Parent-controlled integration state" : "use integrate-child for Parent-controlled states");
|
|
317
|
+
const parent = taskRecord(parentDir);
|
|
318
|
+
const child = taskRecord(childDir);
|
|
319
|
+
if (!parent || !child)
|
|
320
|
+
throw new Error("parent and child need task.json");
|
|
321
|
+
if (child.parent !== path.basename(parentDir))
|
|
322
|
+
throw new Error("child is not linked to parent");
|
|
323
|
+
const evidence = requireArgument(option(args, "--evidence"), "--evidence");
|
|
324
|
+
const ref = option(args, "--ref");
|
|
325
|
+
const reason = option(args, "--reason");
|
|
326
|
+
const errors = childStateErrors(parentDir, parent, childDir, state, evidence, { ref, reason });
|
|
327
|
+
if (integrated && ["accepted", "integrating", "integrated"].includes(state)) {
|
|
328
|
+
const extras = readKernel({ taskDir: childDir, cwd: root }).kernel.projection?.extras ?? {};
|
|
329
|
+
if (extras.required_controls?.rigor === "full") {
|
|
330
|
+
const parsed = readStrategyContract(childDir);
|
|
331
|
+
errors.push(...parsed.errors);
|
|
332
|
+
if (parsed.contract)
|
|
333
|
+
errors.push(...currentGateErrors(childDir, child, "child-review", requiredGates("child-review", parsed.contract), parsed.contract, readKernel({ taskDir: childDir, cwd: root }).kernel.gates));
|
|
334
|
+
try {
|
|
335
|
+
assertFullQualityForPhase(childDir, extras, "archive");
|
|
336
|
+
}
|
|
337
|
+
catch (error) {
|
|
338
|
+
errors.push(error instanceof Error ? error.message : String(error));
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
const executeMerge = args.includes("--execute-merge");
|
|
343
|
+
if (executeMerge) {
|
|
344
|
+
if (!integrated || state !== "integrated")
|
|
345
|
+
errors.push("--execute-merge is only valid with integrate-child ... integrated");
|
|
346
|
+
if (!ref || ref.startsWith("-") || /[\r\n]/.test(ref))
|
|
347
|
+
errors.push("--execute-merge requires a valid --ref");
|
|
348
|
+
const git = (...gitArgs) => execFileSync("git", gitArgs, { cwd: root, encoding: "utf8", stdio: ["ignore", "pipe", "pipe"] }).trim();
|
|
349
|
+
try {
|
|
350
|
+
if (!sameGitRoot(git("rev-parse", "--show-toplevel"), root))
|
|
351
|
+
errors.push("merge execution requires the project Git root");
|
|
352
|
+
if (ref)
|
|
353
|
+
git("rev-parse", "--verify", `${ref}^{commit}`);
|
|
354
|
+
}
|
|
355
|
+
catch {
|
|
356
|
+
errors.push(`merge ref does not resolve to a commit: ${ref ?? "(missing)"}`);
|
|
357
|
+
}
|
|
358
|
+
try {
|
|
359
|
+
const dirty = git("status", "--porcelain", "--untracked-files=all").split(/\r?\n/).filter(Boolean)
|
|
360
|
+
.map((line) => line.slice(3).trim().replaceAll("\\", "/").replace(/^"|"$/g, ""))
|
|
361
|
+
.filter((file) => file !== ".pactile" && !file.startsWith(".pactile/"));
|
|
362
|
+
if (dirty.length)
|
|
363
|
+
errors.push(`non-Pactile working tree changes block merge execution: ${dirty.slice(0, 8).join(", ")}`);
|
|
364
|
+
}
|
|
365
|
+
catch {
|
|
366
|
+
errors.push("git status failed during merge preflight");
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
if (errors.length) {
|
|
370
|
+
console.error(errors.map((error) => ` - ${error}`).join("\n"));
|
|
371
|
+
return 1;
|
|
372
|
+
}
|
|
373
|
+
if (args.includes("--check")) {
|
|
374
|
+
console.log(`Child state check: PASS (${state})`);
|
|
375
|
+
return 0;
|
|
376
|
+
}
|
|
377
|
+
if (executeMerge) {
|
|
378
|
+
try {
|
|
379
|
+
execFileSync("git", ["merge", "--no-ff", "--no-commit", ref], { cwd: root, stdio: ["ignore", "pipe", "pipe"] });
|
|
380
|
+
}
|
|
381
|
+
catch (error) {
|
|
382
|
+
console.error(`git merge failed; Parent task-map was not advanced to integrated: ${error instanceof Error ? error.message : String(error)}`);
|
|
383
|
+
return 1;
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
const { data, body } = readTaskMap(parentDir);
|
|
387
|
+
if (!data)
|
|
388
|
+
throw new Error("task-map.md missing");
|
|
389
|
+
const entry = data.children.find((item) => item.id === path.basename(childDir));
|
|
390
|
+
if (!entry)
|
|
391
|
+
throw new Error("child missing from task-map.md");
|
|
392
|
+
entry.state = state;
|
|
393
|
+
entry.evidence = evidence;
|
|
394
|
+
if (ref)
|
|
395
|
+
entry.ref = ref;
|
|
396
|
+
if (reason)
|
|
397
|
+
entry.reason = reason;
|
|
398
|
+
if (state === "integrating" && !data.integration_queue.includes(entry.id))
|
|
399
|
+
data.integration_queue.push(entry.id);
|
|
400
|
+
else if (state !== "integrating")
|
|
401
|
+
data.integration_queue = data.integration_queue.filter((id) => id !== entry.id);
|
|
402
|
+
const previous = readKernel({ taskDir: parentDir, cwd: root }).kernel.projection?.extras ?? {};
|
|
403
|
+
const states = previous.task_map_states && typeof previous.task_map_states === "object" ? previous.task_map_states : {};
|
|
404
|
+
patchTask(root, path.basename(parentDir), {}, integrated ? "integrate-child" : "set-child-state", { task_map_states: { ...states, [entry.id]: state }, ...(integrated ? { integration_action: "integrate-child", integration_actor: "parent" } : {}) });
|
|
405
|
+
writeTaskMap(parentDir, data, body, `${integrated ? "Parent integrated" : "Child reported"} ${entry.id} as ${state}. Evidence: ${evidence}.`);
|
|
406
|
+
console.log(`${entry.id}: ${state}`);
|
|
407
|
+
return 0;
|
|
408
|
+
}
|
|
409
|
+
function reviewChild(root, args) {
|
|
410
|
+
const parentDir = taskDir(root, requireArgument(args[0], "parent task"));
|
|
411
|
+
const childDir = taskDir(root, requireArgument(args[1], "child task"));
|
|
412
|
+
const parent = taskRecord(parentDir);
|
|
413
|
+
const child = taskRecord(childDir);
|
|
414
|
+
if (child?.parent !== path.basename(parentDir) || !parent?.children.includes(path.basename(childDir)))
|
|
415
|
+
throw new Error("linked Parent and Child task.json are required");
|
|
416
|
+
const map = readTaskMap(parentDir).data;
|
|
417
|
+
const entry = map?.children.find((item) => item.id === path.basename(childDir));
|
|
418
|
+
if (!entry)
|
|
419
|
+
throw new Error("Child missing from Parent task-map.md");
|
|
420
|
+
const decision = option(args, "--decision");
|
|
421
|
+
if (decision && !["accept", "changes", "cancel", "integrate-through"].includes(decision))
|
|
422
|
+
throw new Error("--decision must be accept, changes, cancel, or integrate-through");
|
|
423
|
+
const check = args.includes("--check") || !decision;
|
|
424
|
+
const ref = option(args, "--ref");
|
|
425
|
+
const reason = option(args, "--reason");
|
|
426
|
+
const notes = option(args, "--notes");
|
|
427
|
+
const verifyFile = path.join(childDir, "verify.md");
|
|
428
|
+
const handoffFile = path.join(childDir, "handoff.md");
|
|
429
|
+
const verify = fs.existsSync(verifyFile) ? fs.readFileSync(verifyFile, "utf8") : "";
|
|
430
|
+
const handoff = fs.existsSync(handoffFile) ? fs.readFileSync(handoffFile, "utf8") : "";
|
|
431
|
+
const excerpt = (content) => content.slice(0, 800).trim().split(/\r?\n/).map((line) => `> ${line}`).join("\n") || "> (empty)";
|
|
432
|
+
const report = [
|
|
433
|
+
`# Parent review — \`${path.basename(childDir)}\``, "", `- Timestamp: ${new Date().toISOString()}`,
|
|
434
|
+
`- Current integration state: \`${entry.state}\``, `- Decision: \`${check ? "check-only" : decision}\``, "",
|
|
435
|
+
"## Handoff artifacts", "", `- verify.md: ${verify.trim() ? "present" : "missing"}`,
|
|
436
|
+
`- handoff.md: ${handoff.trim() ? "present" : "missing"}`,
|
|
437
|
+
`- validation signal: ${/^\s*(?:[-*]\s*)?validation(?:\s+(?:commands?|results?|evidence))?\s*:\s*\S.{2,}$/im.test(verify)}`,
|
|
438
|
+
`- acceptance signal: ${/^\s*(?:[-*]\s*)?(?:(?:final|user)\s+)?acceptance(?:\s+evidence)?\s*:\s*\S.{2,}$/im.test(verify)}`,
|
|
439
|
+
`- durable learning decision signal: ${/durable learning decision\s*:/i.test(verify)}`, "",
|
|
440
|
+
...(notes ? ["## Parent notes", "", excerpt(notes), ""] : []),
|
|
441
|
+
"## verify.md excerpt", "", excerpt(verify), "",
|
|
442
|
+
"## handoff.md excerpt", "", excerpt(handoff), "",
|
|
443
|
+
].join("\n");
|
|
444
|
+
if (check) {
|
|
445
|
+
const errors = [
|
|
446
|
+
...(entry.state !== "review" ? [`Child must be in review state, got ${entry.state}`] : []),
|
|
447
|
+
...(!verify.trim() ? ["verify.md missing"] : []),
|
|
448
|
+
...(!handoff.trim() ? ["handoff.md missing"] : []),
|
|
449
|
+
];
|
|
450
|
+
console.log(`Review-child check: ${errors.length ? "FAIL" : "PASS"}\n${errors.map((error) => ` - ${error}`).join("\n")}\n\n${report}`);
|
|
451
|
+
return errors.length ? 1 : 0;
|
|
452
|
+
}
|
|
453
|
+
const state = decision === "accept" || decision === "integrate-through" ? "accepted" : decision === "changes" ? "changes" : "cancelled";
|
|
454
|
+
const transition = (target, evidence) => updateChildState(root, [path.basename(parentDir), path.basename(childDir), target, "--evidence", evidence, ...(ref ? ["--ref", ref] : []), ...(reason ? ["--reason", reason] : [])], true);
|
|
455
|
+
// Validate the first transition before writing any review artifact or Parent evidence.
|
|
456
|
+
const firstCheck = updateChildState(root, [path.basename(parentDir), path.basename(childDir), state, "--evidence", "handoff.md", ...(ref ? ["--ref", ref] : []), ...(reason ? ["--reason", reason] : []), "--check"], true);
|
|
457
|
+
if (firstCheck !== 0)
|
|
458
|
+
return firstCheck;
|
|
459
|
+
if (transition(state, "handoff.md") !== 0)
|
|
460
|
+
return 1;
|
|
461
|
+
if (decision === "integrate-through") {
|
|
462
|
+
if (transition("integrating", "task-map.md") !== 0 || transition("integrated", "task-map.md") !== 0)
|
|
463
|
+
return 1;
|
|
464
|
+
}
|
|
465
|
+
const reviewFile = path.join(parentDir, `review-${path.basename(childDir)}.md`);
|
|
466
|
+
if (args.includes("--write-artifact"))
|
|
467
|
+
fs.writeFileSync(reviewFile, `${report}\n`, "utf8");
|
|
468
|
+
if (!args.includes("--no-append-parent-verify")) {
|
|
469
|
+
const parentVerify = path.join(parentDir, "verify.md");
|
|
470
|
+
const current = fs.existsSync(parentVerify) ? fs.readFileSync(parentVerify, "utf8") : "# Verification Evidence\n";
|
|
471
|
+
const note = `## Parent review — \`${path.basename(childDir)}\`\n\n- Decision: ${decision}\n- Child handoff: ${path.basename(childDir)}/handoff.md\n- Child verification: ${path.basename(childDir)}/verify.md\n- Review artifact: ${args.includes("--write-artifact") ? path.basename(reviewFile) : "not written"}\n`;
|
|
472
|
+
fs.writeFileSync(parentVerify, `${current.trimEnd()}\n\n${note}`, "utf8");
|
|
473
|
+
}
|
|
474
|
+
console.log(report);
|
|
475
|
+
return 0;
|
|
476
|
+
}
|
|
477
|
+
function listTasks(args, root) {
|
|
478
|
+
const developer = readDeveloper(root);
|
|
479
|
+
const mine = args.includes("--mine") || args.includes("-m");
|
|
480
|
+
if (mine && !developer)
|
|
481
|
+
throw new Error("No developer set. Run pactile init --user <name>");
|
|
482
|
+
const assignee = option(args, "--assignee") ?? (mine ? developer : undefined);
|
|
483
|
+
const status = option(args, "--status") ?? option(args, "-s");
|
|
484
|
+
const selected = resolveSelectedTask(root).taskPath;
|
|
485
|
+
const tasks = activeTasks(root).filter(({ record }) => (!assignee || record.assignee === assignee) && (!status || record.status === status));
|
|
486
|
+
console.log(assignee ? `Tasks (assignee: ${assignee}):` : "All active tasks:");
|
|
487
|
+
console.log();
|
|
488
|
+
for (const { dir, record } of tasks) {
|
|
489
|
+
const marker = `.pactile/tasks/${dir}` === selected ? " <- selected" : "";
|
|
490
|
+
console.log(` - ${dir}/ (${record.status})${record.package ? ` @${record.package}` : ""} [${record.assignee || "-"}]${marker}`);
|
|
491
|
+
}
|
|
492
|
+
if (!tasks.length)
|
|
493
|
+
console.log(" (no active tasks)");
|
|
494
|
+
console.log(`\nTotal: ${tasks.length} task(s)`);
|
|
495
|
+
}
|
|
496
|
+
function listArchive(root, month) {
|
|
497
|
+
if (month && !/^\d{4}-(?:0[1-9]|1[0-2])$/.test(month))
|
|
498
|
+
throw new Error("archive month must be YYYY-MM");
|
|
499
|
+
const archive = path.join(root, ".pactile", "tasks", "archive");
|
|
500
|
+
console.log("Archived tasks:\n");
|
|
501
|
+
if (!fs.existsSync(archive))
|
|
502
|
+
return;
|
|
503
|
+
const months = month ? [month] : fs.readdirSync(archive, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name).sort();
|
|
504
|
+
for (const name of months) {
|
|
505
|
+
const monthDir = path.join(archive, name);
|
|
506
|
+
if (!fs.statSync(monthDir, { throwIfNoEntry: false })?.isDirectory()) {
|
|
507
|
+
console.log(` No archives for ${name}`);
|
|
508
|
+
continue;
|
|
509
|
+
}
|
|
510
|
+
const tasks = fs.readdirSync(monthDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name).sort();
|
|
511
|
+
console.log(`[${name}]${month ? "" : ` - ${tasks.length} task(s)`}`);
|
|
512
|
+
if (month)
|
|
513
|
+
for (const task of tasks)
|
|
514
|
+
console.log(` - ${task}/`);
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
function dashboard(root) {
|
|
518
|
+
const selected = resolveSelectedTask(root);
|
|
519
|
+
console.log("Task Dashboard\nPactile framework: active");
|
|
520
|
+
console.log(`Selected task: ${selected.taskPath ?? "none"}${selected.taskPath ? ` (${selected.source})` : ""}\n`);
|
|
521
|
+
const tasks = activeTasks(root);
|
|
522
|
+
if (!tasks.length)
|
|
523
|
+
console.log("Tasks: none");
|
|
524
|
+
for (const [status, heading] of [["planning", "Define"], ["in_progress", "Execute"], ["review", "Verify"]]) {
|
|
525
|
+
const matching = tasks.filter(({ record }) => record.status === status);
|
|
526
|
+
if (!matching.length)
|
|
527
|
+
continue;
|
|
528
|
+
console.log(`${heading}:`);
|
|
529
|
+
for (const { dir, record } of matching)
|
|
530
|
+
console.log(` - .pactile/tasks/${dir} (${heading}) [${record.assignee || "-"}]`);
|
|
531
|
+
console.log();
|
|
532
|
+
}
|
|
533
|
+
console.log("Suggested actions:\n - Select a task: pactile task select <task>\n - Create a task: pactile task create \"<title>\" --slug <slug>\n - Inspect raw list: pactile task list");
|
|
534
|
+
}
|
|
535
|
+
function startExecution(root, args) {
|
|
536
|
+
const dir = taskDir(root, requireArgument(args[0], "task"));
|
|
537
|
+
const record = taskRecord(dir);
|
|
538
|
+
if (!record)
|
|
539
|
+
throw new Error(`task.json not found at ${dir}`);
|
|
540
|
+
const check = args.includes("--check");
|
|
541
|
+
const approved = args.includes("--approved");
|
|
542
|
+
if (check === approved)
|
|
543
|
+
throw new Error("choose --check or --approved");
|
|
544
|
+
const guard = checkStartExecution(root, dir, record, approved, args.includes("--ignore-deps"));
|
|
545
|
+
for (const warning of guard.warnings)
|
|
546
|
+
console.error(`[dependencies] WARN: ${warning}`);
|
|
547
|
+
if (!guard.ok) {
|
|
548
|
+
console.error(`Start-execution check: FAIL\n${guard.errors.map((error) => ` - ${error}`).join("\n")}`);
|
|
549
|
+
return 1;
|
|
550
|
+
}
|
|
551
|
+
if (check) {
|
|
552
|
+
console.log(`Start-execution check: PASS\nContract fingerprint: ${guard.contractFingerprint}\nArtifact fingerprint: ${guard.artifactFingerprint}`);
|
|
553
|
+
console.log("Artifact gates are ready. Ask the user for explicit execution approval before running --approved.");
|
|
554
|
+
return 0;
|
|
555
|
+
}
|
|
556
|
+
const prior = record;
|
|
557
|
+
const priorApproval = prior.execution_approval;
|
|
558
|
+
if (priorApproval && typeof priorApproval === "object") {
|
|
559
|
+
const old = priorApproval;
|
|
560
|
+
if (old.contract_fingerprint !== guard.contractFingerprint || old.artifact_fingerprint !== guard.artifactFingerprint) {
|
|
561
|
+
throw new Error("stale execution approval; return to Planning and ask for explicit approval again");
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
const checkedAt = new Date().toISOString().replace(/\.\d{3}Z$/, "Z");
|
|
565
|
+
const baseline = {
|
|
566
|
+
schema_version: 1, transition: "start-execution", gate: "baseline-check", result: "PASS",
|
|
567
|
+
reviewer: "pactile-cli", evidence: "task.json", checked_at: checkedAt,
|
|
568
|
+
contract_fingerprint: guard.contractFingerprint, artifact_fingerprint: guard.artifactFingerprint,
|
|
569
|
+
issue_fingerprint: null, consecutive_failures: 0, approved_skip: null,
|
|
570
|
+
};
|
|
571
|
+
const existingQgr = prior.quality_gate_results && typeof prior.quality_gate_results === "object"
|
|
572
|
+
? prior.quality_gate_results : {};
|
|
573
|
+
const transitions = existingQgr.transitions && typeof existingQgr.transitions === "object"
|
|
574
|
+
? existingQgr.transitions : {};
|
|
575
|
+
const qualityGateResults = {
|
|
576
|
+
...existingQgr,
|
|
577
|
+
schema_version: 1,
|
|
578
|
+
contract_fingerprint: guard.contractFingerprint,
|
|
579
|
+
artifact_fingerprint: guard.artifactFingerprint,
|
|
580
|
+
transitions: { ...transitions, "start-execution": { "baseline-check": baseline } },
|
|
581
|
+
};
|
|
582
|
+
const approval = {
|
|
583
|
+
schema_version: 1, transition: "start-execution", approved_at: checkedAt,
|
|
584
|
+
approved_by: "user", approval_source: "pactile task start-execution --approved",
|
|
585
|
+
contract_fingerprint: guard.contractFingerprint, artifact_fingerprint: guard.artifactFingerprint,
|
|
586
|
+
};
|
|
587
|
+
const extras = { quality_gate_results: qualityGateResults, execution_approval: approval };
|
|
588
|
+
const dependencyFacts = dependencyStatus(root, dir, record);
|
|
589
|
+
const priorExtras = readKernel({ taskDir: dir, cwd: root }).kernel.projection?.extras ?? {};
|
|
590
|
+
const attestedSatisfied = Array.isArray(priorExtras.dependency_satisfied)
|
|
591
|
+
? priorExtras.dependency_satisfied.filter((item) => typeof item === "string") : [];
|
|
592
|
+
extras.dependency_satisfied = [...new Set([...attestedSatisfied, ...dependencyFacts.satisfied])];
|
|
593
|
+
const controls = readKernel({ taskDir: dir, cwd: root }).kernel.projection?.extras?.required_controls;
|
|
594
|
+
if (controls && typeof controls === "object" && controls.rigor === "full") {
|
|
595
|
+
const parsed = readStrategyContract(dir);
|
|
596
|
+
if (!parsed.contract)
|
|
597
|
+
throw new Error(parsed.errors.join("; "));
|
|
598
|
+
const currentContract = contractFingerprint(dir, record, parsed.contract);
|
|
599
|
+
const autoGates = requiredGates("start-execution", parsed.contract);
|
|
600
|
+
for (const gate of autoGates) {
|
|
601
|
+
const stamp = new Date().toISOString();
|
|
602
|
+
const artifact = artifactFingerprint(dir, record, "start-execution", gate);
|
|
603
|
+
const gateRecord = { schema_version: 1, transition: "start-execution", gate, result: "PASS", reviewer: "pactile-cli", evidence: gate === "requirements-review" ? "prd.md" : "design.md + implement.md",
|
|
604
|
+
checked_at: stamp, contract_fingerprint: currentContract, artifact_fingerprint: artifact,
|
|
605
|
+
issue_fingerprint: null, consecutive_failures: 0, approved_skip: null };
|
|
606
|
+
const gateRevision = readKernel({ taskDir: dir, cwd: root }).kernel.revision;
|
|
607
|
+
applyKernelRecordGate({ taskDir: dir, cwd: root, expectedRevision: gateRevision,
|
|
608
|
+
actor: "pactile task start-execution planning review", idempotencyKey: `planning:${record.id}:${gate}:r${gateRevision}`,
|
|
609
|
+
transition: "start-execution", gateName: gate, record: gateRecord, evidence: String(gateRecord.evidence) });
|
|
610
|
+
const transitionRows = qualityGateResults.transitions["start-execution"];
|
|
611
|
+
transitionRows[gate] = gateRecord;
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
if (args.includes("--ignore-deps")) {
|
|
615
|
+
extras.dependency_override = {
|
|
616
|
+
schema_version: 1,
|
|
617
|
+
approved_by: "user",
|
|
618
|
+
transition: "start-execution",
|
|
619
|
+
dependencies: unmetRequires(readDependencyGraph(priorExtras), extras.dependency_satisfied, record.id),
|
|
620
|
+
source: "pactile task start-execution --approved --ignore-deps",
|
|
621
|
+
at: checkedAt,
|
|
622
|
+
};
|
|
623
|
+
}
|
|
624
|
+
const revision = readKernel({ taskDir: dir, cwd: root }).kernel.revision;
|
|
625
|
+
applyKernelStart({
|
|
626
|
+
taskDir: dir, cwd: root, expectedRevision: revision,
|
|
627
|
+
actor: "pactile task start-execution --approved",
|
|
628
|
+
idempotencyKey: `start:${record.id || path.basename(dir)}:${checkedAt}`,
|
|
629
|
+
evidence: "pactile task start-execution --approved",
|
|
630
|
+
record: { ...record, status: "in_progress" },
|
|
631
|
+
extras,
|
|
632
|
+
});
|
|
633
|
+
runTaskHooks(root, "after_start", path.join(dir, "task.json"));
|
|
634
|
+
console.log(`Execution approved for: ${path.relative(root, dir).replaceAll("\\", "/")}\nStatus: in_progress`);
|
|
635
|
+
return 0;
|
|
636
|
+
}
|
|
637
|
+
function recordGate(root, args) {
|
|
638
|
+
const dir = taskDir(root, requireArgument(args[0], "task"));
|
|
639
|
+
const task = taskRecord(dir);
|
|
640
|
+
if (!task)
|
|
641
|
+
throw new Error(`task.json not found at ${dir}`);
|
|
642
|
+
const transition = requireArgument(option(args, "--transition"), "--transition");
|
|
643
|
+
const gate = requireArgument(option(args, "--gate"), "--gate");
|
|
644
|
+
const result = requireArgument(option(args, "--result"), "--result").toUpperCase();
|
|
645
|
+
const reviewer = requireArgument(option(args, "--reviewer"), "--reviewer");
|
|
646
|
+
const evidence = requireArgument(option(args, "--evidence"), "--evidence");
|
|
647
|
+
if (!["PASS", "FAIL", "SKIPPED"].includes(result))
|
|
648
|
+
throw new Error("--result must be PASS, FAIL, or SKIPPED");
|
|
649
|
+
const allowed = {
|
|
650
|
+
"start-execution": ["requirements-review", "architecture-review"],
|
|
651
|
+
"full-task-complete": ["code-review", "architecture-review", "architecture-deep-review"],
|
|
652
|
+
"child-review": ["code-review", "architecture-review", "architecture-deep-review"],
|
|
653
|
+
"parent-integrated": ["integration-review"],
|
|
654
|
+
};
|
|
655
|
+
if (!allowed[transition]?.includes(gate))
|
|
656
|
+
throw new Error(`unsupported transition/gate pair: ${transition}/${gate}`);
|
|
657
|
+
if (!/^[A-Za-z0-9_.:@/-]+$/.test(reviewer))
|
|
658
|
+
throw new Error("--reviewer must be a short identifier");
|
|
659
|
+
if (!evidence.trim() || evidence.length > 240 || /[\r\n]/.test(evidence))
|
|
660
|
+
throw new Error("--evidence must be a short single-line reference");
|
|
661
|
+
if (result === "FAIL" && (!option(args, "--issue-fingerprint") || !option(args, "--root-cause")))
|
|
662
|
+
throw new Error("FAIL requires --issue-fingerprint and --root-cause");
|
|
663
|
+
if (result === "FAIL" && !["implementation-defect", "contract-changing-defect", "validation-environment-blocker"].includes(option(args, "--root-cause") ?? ""))
|
|
664
|
+
throw new Error("--root-cause is not a known failure route");
|
|
665
|
+
if (result === "SKIPPED" && (option(args, "--skip-approved-by") !== "user" || !option(args, "--skip-reason")))
|
|
666
|
+
throw new Error("SKIPPED requires --skip-approved-by user and --skip-reason");
|
|
667
|
+
const parsed = fs.existsSync(path.join(dir, "implement.md")) ? readStrategyContract(dir) : { contract: null, errors: [] };
|
|
668
|
+
if (parsed.errors.length && transition !== "parent-integrated")
|
|
669
|
+
throw new Error(parsed.errors.join("; "));
|
|
670
|
+
const currentContract = contractFingerprint(dir, task, parsed.contract);
|
|
671
|
+
const currentArtifact = artifactFingerprint(dir, task, transition, gate);
|
|
672
|
+
if (option(args, "--contract-fingerprint") && option(args, "--contract-fingerprint") !== currentContract)
|
|
673
|
+
throw new Error("contract fingerprint assertion is stale");
|
|
674
|
+
if (option(args, "--artifact-fingerprint") && option(args, "--artifact-fingerprint") !== currentArtifact)
|
|
675
|
+
throw new Error("artifact fingerprint assertion is stale");
|
|
676
|
+
const record = {
|
|
677
|
+
schema_version: 1, transition, gate, result, reviewer, evidence, checked_at: new Date().toISOString(),
|
|
678
|
+
contract_fingerprint: currentContract, artifact_fingerprint: currentArtifact,
|
|
679
|
+
issue_fingerprint: result === "FAIL" ? option(args, "--issue-fingerprint") : null,
|
|
680
|
+
root_cause: result === "FAIL" ? option(args, "--root-cause") : null,
|
|
681
|
+
issue_summary: result === "FAIL" ? option(args, "--issue-summary") ?? null : null,
|
|
682
|
+
consecutive_failures: result === "FAIL" ? 1 : 0,
|
|
683
|
+
approved_skip: result === "SKIPPED" ? { approved_by: "user", reason: option(args, "--skip-reason") } : null,
|
|
684
|
+
};
|
|
685
|
+
const revision = readKernel({ taskDir: dir, cwd: root }).kernel.revision;
|
|
686
|
+
applyKernelRecordGate({ taskDir: dir, cwd: root, expectedRevision: revision, actor: `pactile task record-gate ${reviewer}`,
|
|
687
|
+
idempotencyKey: `record-gate:${task.id}:${transition}:${gate}:r${revision}`,
|
|
688
|
+
transition, gateName: gate, record, evidence });
|
|
689
|
+
console.log(`${transition}/${gate}: ${result}`);
|
|
690
|
+
return 0;
|
|
691
|
+
}
|
|
692
|
+
function recordAcEvidence(root, args) {
|
|
693
|
+
const reference = requireArgument(args[0], "task");
|
|
694
|
+
const dir = taskDir(root, reference);
|
|
695
|
+
const prd = fs.readFileSync(path.join(dir, "prd.md"), "utf8");
|
|
696
|
+
const verify = fs.readFileSync(path.join(dir, "verify.md"), "utf8");
|
|
697
|
+
const mappings = [];
|
|
698
|
+
for (let index = 1; index < args.length; index += 1) {
|
|
699
|
+
if (args[index] !== "--map")
|
|
700
|
+
continue;
|
|
701
|
+
const assignment = requireArgument(args[index + 1], "--map AC-N=reference");
|
|
702
|
+
const equal = assignment.indexOf("=");
|
|
703
|
+
if (equal < 0)
|
|
704
|
+
throw new Error("--map must be AC-N=reference");
|
|
705
|
+
mappings.push({ ac_id: assignment.slice(0, equal), evidence_ref: assignment.slice(equal + 1) });
|
|
706
|
+
index += 1;
|
|
707
|
+
}
|
|
708
|
+
if (!mappings.length)
|
|
709
|
+
throw new Error("at least one --map AC-N=reference is required");
|
|
710
|
+
const codeRef = requireArgument(option(args, "--code-ref"), "--code-ref");
|
|
711
|
+
const ledger = buildAcEvidenceLedger({ acceptanceItems: parseAcceptanceItems(prd), mappings,
|
|
712
|
+
sourceFingerprint: qualityFingerprint(prd), evidenceFingerprint: qualityFingerprint(verify), testedCodeFingerprint: codeRef });
|
|
713
|
+
patchTask(root, reference, {}, "record-ac-evidence", { ac_evidence_ledger: ledger });
|
|
714
|
+
console.log(`AC evidence ledger recorded: ${ledger.items.length} mapped criteria`);
|
|
715
|
+
return 0;
|
|
716
|
+
}
|
|
717
|
+
function recordIndependentCheck(root, args) {
|
|
718
|
+
const reference = requireArgument(args[0], "task");
|
|
719
|
+
const mode = requireArgument(option(args, "--mode"), "--mode");
|
|
720
|
+
const result = requireArgument(option(args, "--result"), "--result").toUpperCase();
|
|
721
|
+
const evidence = requireArgument(option(args, "--evidence"), "--evidence");
|
|
722
|
+
const codeRef = requireArgument(option(args, "--code-ref"), "--code-ref");
|
|
723
|
+
if (mode !== "self-review" && mode !== "true-independent")
|
|
724
|
+
throw new Error("--mode must be self-review or true-independent");
|
|
725
|
+
if (!["PASS", "FAIL", "BLOCKED"].includes(result))
|
|
726
|
+
throw new Error("--result must be PASS, FAIL, or BLOCKED");
|
|
727
|
+
const independentWorker = args.includes("--independent-worker");
|
|
728
|
+
if (mode === "true-independent" && result === "PASS" && !independentWorker)
|
|
729
|
+
throw new Error("true-independent PASS requires --independent-worker");
|
|
730
|
+
const reviewer = option(args, "--reviewer");
|
|
731
|
+
if (mode === "true-independent" && result === "PASS" && !reviewer)
|
|
732
|
+
throw new Error("true-independent PASS requires --reviewer");
|
|
733
|
+
const verdict = { schema_version: 1, mode, readonly: true, result, evidence,
|
|
734
|
+
independent_worker: independentWorker, reviewer: reviewer ?? null, code_fingerprint: codeRef, checked_at: new Date().toISOString() };
|
|
735
|
+
patchTask(root, reference, {}, "record-independent-check", { independent_check: verdict });
|
|
736
|
+
console.log(`Independent check: ${result} (${mode})`);
|
|
737
|
+
return 0;
|
|
738
|
+
}
|
|
739
|
+
function archiveTask(root, args) {
|
|
740
|
+
const dir = taskDir(root, requireArgument(args[0], "task"));
|
|
741
|
+
const record = taskRecord(dir);
|
|
742
|
+
if (!record)
|
|
743
|
+
throw new Error(`task.json not found at ${dir}`);
|
|
744
|
+
const guard = checkArchive(dir, record);
|
|
745
|
+
const activeChildren = record.children.map((id) => path.join(root, ".pactile", "tasks", id)).filter((candidate) => fs.existsSync(candidate));
|
|
746
|
+
if (activeChildren.length && !args.includes("--archive-integrated-children"))
|
|
747
|
+
guard.errors.push(`active children remain: ${activeChildren.map((candidate) => path.basename(candidate)).join(", ")}; use --archive-integrated-children after preflight`);
|
|
748
|
+
if (activeChildren.length && args.includes("--archive-integrated-children")) {
|
|
749
|
+
for (const childDir of activeChildren) {
|
|
750
|
+
const child = taskRecord(childDir);
|
|
751
|
+
if (!child) {
|
|
752
|
+
guard.errors.push(`child task.json missing: ${path.basename(childDir)}`);
|
|
753
|
+
continue;
|
|
754
|
+
}
|
|
755
|
+
guard.errors.push(...checkArchive(childDir, child).errors.map((message) => `${path.basename(childDir)}: ${message}`));
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
guard.ok = guard.errors.length === 0;
|
|
759
|
+
if (!guard.ok) {
|
|
760
|
+
console.error(`Archive check: FAIL\n${guard.errors.map((error) => ` - ${error}`).join("\n")}`);
|
|
761
|
+
return 1;
|
|
762
|
+
}
|
|
763
|
+
if (args.includes("--check")) {
|
|
764
|
+
console.log("Archive check: PASS");
|
|
765
|
+
return 0;
|
|
766
|
+
}
|
|
767
|
+
if (activeChildren.length) {
|
|
768
|
+
for (const childDir of activeChildren) {
|
|
769
|
+
const childArgs = [path.basename(childDir), "--no-commit"];
|
|
770
|
+
if (archiveTask(root, childArgs) !== 0)
|
|
771
|
+
throw new Error(`child archive failed: ${path.basename(childDir)}`);
|
|
772
|
+
}
|
|
773
|
+
}
|
|
774
|
+
const now = new Date();
|
|
775
|
+
const completedAt = localDate(now);
|
|
776
|
+
const month = completedAt.slice(0, 7);
|
|
777
|
+
const destination = path.join(root, ".pactile", "tasks", "archive", month, path.basename(dir));
|
|
778
|
+
if (fs.existsSync(destination))
|
|
779
|
+
throw new Error(`Archive destination already exists: ${destination}`);
|
|
780
|
+
const revision = readKernel({ taskDir: dir, cwd: root }).kernel.revision;
|
|
781
|
+
const archivedRelative = path.relative(root, destination).replaceAll("\\", "/");
|
|
782
|
+
const verifyText = fs.readFileSync(path.join(dir, "verify.md"), "utf8");
|
|
783
|
+
const acceptance = verifyText.match(/^\s*(?:[-*]\s*)?(?:(?:final|user)\s+)?acceptance(?:\s+evidence)?\s*:\s*(\S[^\r\n]*)$/im)?.[1]?.trim();
|
|
784
|
+
const points = acceptance ? [{ text: acceptance, source: "verify.md", confidence: "low" }] : [];
|
|
785
|
+
const notesProjection = {
|
|
786
|
+
schema_version: 1,
|
|
787
|
+
summary: points.map((point) => point.text).join("; ").split(/\s+/).slice(0, 150).join(" "),
|
|
788
|
+
pointers: [archivedRelative, `${archivedRelative}/verify.md`],
|
|
789
|
+
source: "cmd_archive",
|
|
790
|
+
points,
|
|
791
|
+
};
|
|
792
|
+
applyKernelArchive({
|
|
793
|
+
taskDir: dir, cwd: root, expectedRevision: revision,
|
|
794
|
+
actor: "pactile task archive", idempotencyKey: `archive:${path.basename(dir)}:${completedAt}`,
|
|
795
|
+
evidence: "pactile task archive",
|
|
796
|
+
record: { ...record, status: "completed", completedAt },
|
|
797
|
+
extras: { notes_projection: notesProjection },
|
|
798
|
+
});
|
|
799
|
+
fs.mkdirSync(path.dirname(destination), { recursive: true });
|
|
800
|
+
fs.renameSync(dir, destination);
|
|
801
|
+
runTaskHooks(root, "after_archive", path.join(destination, "task.json"));
|
|
802
|
+
const selected = resolveSelectedTask(root);
|
|
803
|
+
if (selected.taskPath === `.pactile/tasks/${path.basename(dir)}`)
|
|
804
|
+
exitTask(root);
|
|
805
|
+
if (!args.includes("--no-commit") && readPactileConfig(root).session_auto_commit !== "false") {
|
|
806
|
+
const relativeSource = path.relative(root, dir).replaceAll("\\", "/");
|
|
807
|
+
const relativeDestination = path.relative(root, destination).replaceAll("\\", "/");
|
|
808
|
+
let isRepo = false;
|
|
809
|
+
try {
|
|
810
|
+
isRepo = execFileSync("git", ["rev-parse", "--is-inside-work-tree"], { cwd: root, encoding: "utf8", stdio: ["ignore", "pipe", "ignore"] }).trim() === "true";
|
|
811
|
+
}
|
|
812
|
+
catch { /* Archive remains valid in a non-Git project. */ }
|
|
813
|
+
try {
|
|
814
|
+
if (isRepo) {
|
|
815
|
+
let ignored = false;
|
|
816
|
+
try {
|
|
817
|
+
execFileSync("git", ["check-ignore", "-q", "--", relativeDestination], { cwd: root, stdio: ["ignore", "pipe", "ignore"] });
|
|
818
|
+
ignored = true;
|
|
819
|
+
}
|
|
820
|
+
catch { /* The archive path is not ignored. */ }
|
|
821
|
+
if (!ignored) {
|
|
822
|
+
execFileSync("git", ["add", "-A", "--", relativeSource, relativeDestination], { cwd: root, stdio: ["ignore", "pipe", "pipe"] });
|
|
823
|
+
const message = `chore(task): archive ${path.basename(dir)}`;
|
|
824
|
+
execFileSync("git", ["commit", "--only", "-m", message, "--", relativeSource, relativeDestination], { cwd: root, stdio: ["ignore", "pipe", "pipe"] });
|
|
825
|
+
}
|
|
826
|
+
}
|
|
827
|
+
}
|
|
828
|
+
catch (error) {
|
|
829
|
+
console.warn(`Archive state is complete, but scoped git auto-commit failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
830
|
+
}
|
|
831
|
+
}
|
|
832
|
+
console.log(path.relative(root, destination).replaceAll("\\", "/"));
|
|
833
|
+
return 0;
|
|
834
|
+
}
|
|
835
|
+
/** Node entry for the existing task command vocabulary. */
|
|
836
|
+
export function runTaskCli(argv, root = process.cwd()) {
|
|
837
|
+
const [command, ...args] = argv;
|
|
838
|
+
try {
|
|
839
|
+
switch (command) {
|
|
840
|
+
case "create":
|
|
841
|
+
createTask(args, root);
|
|
842
|
+
return 0;
|
|
843
|
+
case "start-execution": return startExecution(root, args);
|
|
844
|
+
case "record-gate": return recordGate(root, args);
|
|
845
|
+
case "record-ac-evidence": return recordAcEvidence(root, args);
|
|
846
|
+
case "record-independent-check": return recordIndependentCheck(root, args);
|
|
847
|
+
case "add-subtask":
|
|
848
|
+
linkChild(root, requireArgument(args[0], "parent task"), requireArgument(args[1], "child task"));
|
|
849
|
+
return 0;
|
|
850
|
+
case "remove-subtask":
|
|
851
|
+
unlinkChild(root, requireArgument(args[0], "parent task"), requireArgument(args[1], "child task"));
|
|
852
|
+
return 0;
|
|
853
|
+
case "prepare-child-worktree": return prepareChildWorktree(root, args);
|
|
854
|
+
case "set-child-state": return updateChildState(root, args, false);
|
|
855
|
+
case "integrate-child": return updateChildState(root, args, true);
|
|
856
|
+
case "review-child": return reviewChild(root, args);
|
|
857
|
+
case "parent-status": {
|
|
858
|
+
const dir = taskDir(root, requireArgument(args[0], "parent task"));
|
|
859
|
+
const snapshot = readTaskMap(dir).data;
|
|
860
|
+
if (!snapshot)
|
|
861
|
+
throw new Error("task-map.md missing");
|
|
862
|
+
console.log(args.includes("--json") ? JSON.stringify(snapshot, null, 2) : snapshot.children.map((child) => `${child.id}: ${child.state}`).join("\n"));
|
|
863
|
+
return 0;
|
|
864
|
+
}
|
|
865
|
+
case "archive": return archiveTask(root, args);
|
|
866
|
+
case "prepare-archive-evidence": {
|
|
867
|
+
const dir = taskDir(root, requireArgument(args[0], "task"));
|
|
868
|
+
const record = taskRecord(dir);
|
|
869
|
+
if (!record)
|
|
870
|
+
throw new Error(`task.json not found at ${dir}`);
|
|
871
|
+
for (const line of prepareArchiveEvidence(dir, record, args.includes("--dry-run")))
|
|
872
|
+
console.log(line);
|
|
873
|
+
return 0;
|
|
874
|
+
}
|
|
875
|
+
case "prepare-learning-scaffold": {
|
|
876
|
+
const dir = taskDir(root, requireArgument(args[0], "task"));
|
|
877
|
+
const record = taskRecord(dir);
|
|
878
|
+
if (!record)
|
|
879
|
+
throw new Error(`task.json not found at ${dir}`);
|
|
880
|
+
console.log(learningScaffold(root, dir, record, option(args, "--trigger")));
|
|
881
|
+
return 0;
|
|
882
|
+
}
|
|
883
|
+
case "dashboard":
|
|
884
|
+
dashboard(root);
|
|
885
|
+
return 0;
|
|
886
|
+
case "list":
|
|
887
|
+
listTasks(args, root);
|
|
888
|
+
return 0;
|
|
889
|
+
case "list-archive":
|
|
890
|
+
listArchive(root, args[0]);
|
|
891
|
+
return 0;
|
|
892
|
+
case "select": {
|
|
893
|
+
const chosen = selectTask(root, requireArgument(args[0], "task"));
|
|
894
|
+
console.log(`Selected task: ${chosen.taskPath}\nSource: ${chosen.source}\nTask status unchanged.`);
|
|
895
|
+
return 0;
|
|
896
|
+
}
|
|
897
|
+
case "selected": {
|
|
898
|
+
const chosen = resolveSelectedTask(root);
|
|
899
|
+
if (args.includes("--source")) {
|
|
900
|
+
console.log(`Selected task: ${chosen.taskPath ?? "(none)"}\nSource: ${chosen.source}`);
|
|
901
|
+
if (chosen.stale)
|
|
902
|
+
console.log("State: stale");
|
|
903
|
+
}
|
|
904
|
+
else if (chosen.taskPath)
|
|
905
|
+
console.log(chosen.taskPath);
|
|
906
|
+
else
|
|
907
|
+
console.error("No task selected for this live session.");
|
|
908
|
+
return chosen.taskPath ? 0 : 1;
|
|
909
|
+
}
|
|
910
|
+
case "exit": {
|
|
911
|
+
const previous = exitTask(root);
|
|
912
|
+
console.log(previous.taskPath ? `Cleared selected task (was: ${previous.taskPath})\nTask status unchanged.` : "No selected task set");
|
|
913
|
+
return 0;
|
|
914
|
+
}
|
|
915
|
+
case "add-context": {
|
|
916
|
+
const dir = taskDir(root, requireArgument(args[0], "task"));
|
|
917
|
+
const name = requireArgument(args[1], "manifest");
|
|
918
|
+
const reference = requireArgument(args[2], "path");
|
|
919
|
+
const added = addContextEntry(root, dir, name, reference, args[3]);
|
|
920
|
+
console.log(added ? `Added: ${reference}` : `Entry already exists: ${reference}`);
|
|
921
|
+
return 0;
|
|
922
|
+
}
|
|
923
|
+
case "set-branch":
|
|
924
|
+
case "set-base-branch":
|
|
925
|
+
case "set-scope": {
|
|
926
|
+
const reference = requireArgument(args[0], "task");
|
|
927
|
+
const value = requireArgument(args[1], command === "set-scope" ? "scope" : "branch");
|
|
928
|
+
const key = command === "set-branch" ? "branch" : command === "set-base-branch" ? "base_branch" : "scope";
|
|
929
|
+
patchTask(root, reference, { [key]: value }, command);
|
|
930
|
+
console.log(`${key} set to: ${value}`);
|
|
931
|
+
return 0;
|
|
932
|
+
}
|
|
933
|
+
case "set-deps": {
|
|
934
|
+
const reference = requireArgument(args[0], "task");
|
|
935
|
+
const dependencies = [...new Set(args.slice(1).filter((item) => item.trim()))];
|
|
936
|
+
const dir = taskDir(root, reference);
|
|
937
|
+
const record = taskRecord(dir);
|
|
938
|
+
if (!record)
|
|
939
|
+
throw new Error(`task.json not found at ${dir}`);
|
|
940
|
+
const projection = readKernel({ taskDir: dir, cwd: root }).kernel.projection?.extras ?? {};
|
|
941
|
+
const rawDeps = record.depends_on;
|
|
942
|
+
const oldDeps = Array.isArray(rawDeps) ? rawDeps.filter((item) => typeof item === "string") : [];
|
|
943
|
+
const graph = readDependencyGraph(projection);
|
|
944
|
+
const edges = graph.edges.filter((edge) => !(edge.from === record.id && edge.type === "requires" && oldDeps.includes(edge.to)));
|
|
945
|
+
const satisfied = Array.isArray(projection.dependency_satisfied) ? projection.dependency_satisfied.filter((item) => typeof item === "string" && !oldDeps.includes(item)) : [];
|
|
946
|
+
patchTask(root, reference, {}, command, { depends_on: dependencies, dependency_graph: { ...graph, edges }, dependency_satisfied: satisfied });
|
|
947
|
+
console.log(dependencies.length ? `depends_on set: ${dependencies.join(", ")}` : "depends_on cleared to []");
|
|
948
|
+
return 0;
|
|
949
|
+
}
|
|
950
|
+
case "set-depends-mode": {
|
|
951
|
+
const reference = requireArgument(args[0], "task");
|
|
952
|
+
const mode = requireArgument(args[1], "mode");
|
|
953
|
+
if (mode !== "block")
|
|
954
|
+
throw new Error("Node Kernel uses hard requires for all depends_on; only block is supported");
|
|
955
|
+
const record = taskRecord(taskDir(root, reference));
|
|
956
|
+
if (!record)
|
|
957
|
+
throw new Error(`task.json not found for ${reference}`);
|
|
958
|
+
patchTask(root, reference, { meta: { ...record.meta, depends_mode: mode } }, command);
|
|
959
|
+
console.log(`depends_mode: ${mode}`);
|
|
960
|
+
return 0;
|
|
961
|
+
}
|
|
962
|
+
case "artifact-locale": {
|
|
963
|
+
const operation = requireArgument(args[0], "artifact-locale operation");
|
|
964
|
+
const reference = option(args, "--task");
|
|
965
|
+
if (operation === "get") {
|
|
966
|
+
const task = reference ? taskRecord(taskDir(root, reference)) : null;
|
|
967
|
+
const taskLocale = task?.meta && typeof task.meta === "object" ? task.meta.artifact_locale : undefined;
|
|
968
|
+
console.log(taskLocale === "en" || taskLocale === "zh" ? taskLocale : locale(root));
|
|
969
|
+
return 0;
|
|
970
|
+
}
|
|
971
|
+
if (operation !== "set")
|
|
972
|
+
throw new Error("use artifact-locale get|set");
|
|
973
|
+
const value = requireArgument(args[1], "locale");
|
|
974
|
+
if (value !== "zh" && value !== "en")
|
|
975
|
+
throw new Error("artifact_locale must be zh or en");
|
|
976
|
+
if (reference) {
|
|
977
|
+
const record = taskRecord(taskDir(root, reference));
|
|
978
|
+
if (!record)
|
|
979
|
+
throw new Error(`task.json not found for ${reference}`);
|
|
980
|
+
patchTask(root, reference, { meta: { ...record.meta, artifact_locale: value } }, command);
|
|
981
|
+
console.log(`artifact_locale set to ${value} (task ${path.basename(taskDir(root, reference))})`);
|
|
982
|
+
return 0;
|
|
983
|
+
}
|
|
984
|
+
const configFile = path.join(root, ".pactile", "config.yaml");
|
|
985
|
+
const content = fs.existsSync(configFile) ? fs.readFileSync(configFile, "utf8") : "# Pactile Configuration\n";
|
|
986
|
+
const replacement = `artifact_locale: ${value}`;
|
|
987
|
+
fs.mkdirSync(path.dirname(configFile), { recursive: true });
|
|
988
|
+
fs.writeFileSync(configFile, /^\s*artifact_locale:\s*[^\r\n]*/m.test(content)
|
|
989
|
+
? content.replace(/^\s*artifact_locale:\s*[^\r\n]*/m, replacement)
|
|
990
|
+
: `${content.trimEnd()}\n\n${replacement}\n`, "utf8");
|
|
991
|
+
console.log(`artifact_locale set to ${value} (workspace)`);
|
|
992
|
+
return 0;
|
|
993
|
+
}
|
|
994
|
+
case "validate": {
|
|
995
|
+
const dir = taskDir(root, requireArgument(args[0], "task"));
|
|
996
|
+
const results = CONTEXT_FILES.map((name) => validateContextFile(root, dir, name));
|
|
997
|
+
for (const result of results) {
|
|
998
|
+
console.log(`${result.file}: ${result.errors.length ? "FAIL" : "PASS"} (${result.entries} entries)`);
|
|
999
|
+
for (const message of [...result.errors, ...result.warnings])
|
|
1000
|
+
console.log(` - ${message}`);
|
|
1001
|
+
}
|
|
1002
|
+
return results.some((result) => result.errors.length) ? 1 : 0;
|
|
1003
|
+
}
|
|
1004
|
+
case "list-context": {
|
|
1005
|
+
const dir = taskDir(root, requireArgument(args[0], "task"));
|
|
1006
|
+
for (const name of CONTEXT_FILES) {
|
|
1007
|
+
console.log(`[${name}]`);
|
|
1008
|
+
const entries = readContextEntries(dir, name);
|
|
1009
|
+
for (const [index, entry] of entries.entries())
|
|
1010
|
+
console.log(` ${index + 1}. ${entry.file} — ${entry.reason ?? "-"}`);
|
|
1011
|
+
if (!entries.length)
|
|
1012
|
+
console.log(" (no curated entries)");
|
|
1013
|
+
}
|
|
1014
|
+
return 0;
|
|
1015
|
+
}
|
|
1016
|
+
default:
|
|
1017
|
+
console.error("Usage: pactile task <create|start-execution|archive|prepare-archive-evidence|prepare-learning-scaffold|review-child|dashboard|list|select|selected|exit|add-context|validate|list-context|set-branch|set-base-branch|set-scope|set-deps|set-depends-mode> ...");
|
|
1018
|
+
return 1;
|
|
1019
|
+
}
|
|
1020
|
+
}
|
|
1021
|
+
catch (err) {
|
|
1022
|
+
console.error(`Error: ${err instanceof Error ? err.message : String(err)}`);
|
|
1023
|
+
return 1;
|
|
1024
|
+
}
|
|
1025
|
+
}
|
|
1026
|
+
//# sourceMappingURL=task.js.map
|