@blxzer/pactile 0.5.0 → 0.6.0-beta.4
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/LICENSE +235 -235
- package/README.md +123 -111
- package/README.zh-CN.md +120 -111
- package/dist/bin/compat-warning.d.ts +2 -0
- package/dist/bin/compat-warning.d.ts.map +1 -0
- package/dist/bin/compat-warning.js +8 -0
- package/dist/bin/compat-warning.js.map +1 -0
- package/dist/bin/cstl.d.ts +3 -0
- package/dist/bin/cstl.d.ts.map +1 -0
- package/dist/bin/cstl.js +5 -0
- package/dist/bin/cstl.js.map +1 -0
- package/dist/bin/pactile.d.ts +3 -0
- package/dist/bin/pactile.d.ts.map +1 -0
- package/dist/bin/pactile.js +4 -0
- package/dist/bin/pactile.js.map +1 -0
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +149 -40
- package/dist/cli/index.js.map +1 -1
- package/dist/commands/capability.d.ts +3 -0
- package/dist/commands/capability.d.ts.map +1 -0
- package/dist/commands/capability.js +129 -0
- package/dist/commands/capability.js.map +1 -0
- package/dist/commands/codex.d.ts +3 -0
- package/dist/commands/codex.d.ts.map +1 -0
- package/dist/commands/codex.js +102 -0
- package/dist/commands/codex.js.map +1 -0
- package/dist/commands/context.d.ts +5 -0
- package/dist/commands/context.d.ts.map +1 -0
- package/dist/commands/context.js +598 -0
- package/dist/commands/context.js.map +1 -0
- package/dist/commands/detach.d.ts.map +1 -1
- package/dist/commands/detach.js +5 -4
- package/dist/commands/detach.js.map +1 -1
- package/dist/commands/init.d.ts +0 -20
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +736 -551
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/legacy-task.d.ts +3 -0
- package/dist/commands/legacy-task.d.ts.map +1 -0
- package/dist/commands/legacy-task.js +295 -0
- package/dist/commands/legacy-task.js.map +1 -0
- 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 +4 -0
- package/dist/commands/pi.d.ts.map +1 -0
- package/dist/commands/pi.js +417 -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 +293 -0
- package/dist/commands/session.js.map +1 -0
- package/dist/commands/task-schedule.d.ts +17 -0
- package/dist/commands/task-schedule.d.ts.map +1 -0
- package/dist/commands/task-schedule.js +395 -0
- package/dist/commands/task-schedule.js.map +1 -0
- package/dist/commands/task-verify-plan.d.ts +3 -0
- package/dist/commands/task-verify-plan.d.ts.map +1 -0
- package/dist/commands/task-verify-plan.js +503 -0
- package/dist/commands/task-verify-plan.js.map +1 -0
- package/dist/commands/task-worktree-close.d.ts +4 -0
- package/dist/commands/task-worktree-close.d.ts.map +1 -0
- package/dist/commands/task-worktree-close.js +81 -0
- package/dist/commands/task-worktree-close.js.map +1 -0
- package/dist/commands/task.d.ts +6 -0
- package/dist/commands/task.d.ts.map +1 -0
- package/dist/commands/task.js +2215 -0
- package/dist/commands/task.js.map +1 -0
- package/dist/commands/tile-selection.d.ts +3 -0
- package/dist/commands/tile-selection.d.ts.map +1 -0
- package/dist/commands/tile-selection.js +174 -0
- package/dist/commands/tile-selection.js.map +1 -0
- package/dist/commands/update.d.ts +4 -2
- package/dist/commands/update.d.ts.map +1 -1
- package/dist/commands/update.js +208 -100
- 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/commands/worktree.d.ts +4 -0
- package/dist/commands/worktree.d.ts.map +1 -0
- package/dist/commands/worktree.js +198 -0
- package/dist/commands/worktree.js.map +1 -0
- 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 +42 -0
- package/dist/core/compat/environment.d.ts.map +1 -0
- package/dist/core/compat/environment.js +83 -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/bounded-capabilities.d.ts +127 -0
- package/dist/core/pactile/bounded-capabilities.d.ts.map +1 -0
- package/dist/core/pactile/bounded-capabilities.js +188 -0
- package/dist/core/pactile/bounded-capabilities.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 +16 -0
- package/dist/core/pactile/index.d.ts.map +1 -0
- package/dist/core/pactile/index.js +14 -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 +34 -0
- package/dist/core/task/index.d.ts.map +1 -0
- package/dist/core/task/index.js +21 -0
- package/dist/core/task/index.js.map +1 -0
- package/dist/core/task/kernel-cli.d.ts +64 -0
- package/dist/core/task/kernel-cli.d.ts.map +1 -0
- package/dist/core/task/kernel-cli.js +429 -0
- package/dist/core/task/kernel-cli.js.map +1 -0
- package/dist/core/task/kernel-contract.d.ts +167 -0
- package/dist/core/task/kernel-contract.d.ts.map +1 -0
- package/dist/core/task/kernel-contract.js +523 -0
- package/dist/core/task/kernel-contract.js.map +1 -0
- package/dist/core/task/kernel-store.d.ts +136 -0
- package/dist/core/task/kernel-store.d.ts.map +1 -0
- package/dist/core/task/kernel-store.js +957 -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/legacy-task-migration-reader.d.ts +137 -0
- package/dist/core/task/legacy-task-migration-reader.d.ts.map +1 -0
- package/dist/core/task/legacy-task-migration-reader.js +512 -0
- package/dist/core/task/legacy-task-migration-reader.js.map +1 -0
- package/dist/core/task/legacy-task-migration.d.ts +105 -0
- package/dist/core/task/legacy-task-migration.d.ts.map +1 -0
- package/dist/core/task/legacy-task-migration.js +562 -0
- package/dist/core/task/legacy-task-migration.js.map +1 -0
- package/dist/core/task/legacy-task-overlay-durable-io.d.ts +18 -0
- package/dist/core/task/legacy-task-overlay-durable-io.d.ts.map +1 -0
- package/dist/core/task/legacy-task-overlay-durable-io.js +66 -0
- package/dist/core/task/legacy-task-overlay-durable-io.js.map +1 -0
- package/dist/core/task/legacy-task-reconciliation-reader.d.ts +26 -0
- package/dist/core/task/legacy-task-reconciliation-reader.d.ts.map +1 -0
- package/dist/core/task/legacy-task-reconciliation-reader.js +324 -0
- package/dist/core/task/legacy-task-reconciliation-reader.js.map +1 -0
- package/dist/core/task/legacy-task-v2-import.d.ts +67 -0
- package/dist/core/task/legacy-task-v2-import.d.ts.map +1 -0
- package/dist/core/task/legacy-task-v2-import.js +1046 -0
- package/dist/core/task/legacy-task-v2-import.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/project-file-observer.d.ts +46 -0
- package/dist/core/task/project-file-observer.d.ts.map +1 -0
- package/dist/core/task/project-file-observer.js +618 -0
- package/dist/core/task/project-file-observer.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/task/start-authority.d.ts +14 -0
- package/dist/core/task/start-authority.d.ts.map +1 -0
- package/dist/core/task/start-authority.js +146 -0
- package/dist/core/task/start-authority.js.map +1 -0
- package/dist/core/task/strategy.d.ts +24 -0
- package/dist/core/task/strategy.d.ts.map +1 -0
- package/dist/core/task/strategy.js +136 -0
- package/dist/core/task/strategy.js.map +1 -0
- package/dist/core/task/task-candidate-observer.d.ts +111 -0
- package/dist/core/task/task-candidate-observer.d.ts.map +1 -0
- package/dist/core/task/task-candidate-observer.js +762 -0
- package/dist/core/task/task-candidate-observer.js.map +1 -0
- package/dist/core/task/task-kernel-close.d.ts +5 -0
- package/dist/core/task/task-kernel-close.d.ts.map +1 -0
- package/dist/core/task/task-kernel-close.js +367 -0
- package/dist/core/task/task-kernel-close.js.map +1 -0
- package/dist/core/task/task-kernel-dependencies.d.ts +3 -0
- package/dist/core/task/task-kernel-dependencies.d.ts.map +1 -0
- package/dist/core/task/task-kernel-dependencies.js +24 -0
- package/dist/core/task/task-kernel-dependencies.js.map +1 -0
- package/dist/core/task/task-kernel-host.d.ts +5 -0
- package/dist/core/task/task-kernel-host.d.ts.map +1 -0
- package/dist/core/task/task-kernel-host.js +136 -0
- package/dist/core/task/task-kernel-host.js.map +1 -0
- package/dist/core/task/task-kernel-paths.d.ts +19 -0
- package/dist/core/task/task-kernel-paths.d.ts.map +1 -0
- package/dist/core/task/task-kernel-paths.js +237 -0
- package/dist/core/task/task-kernel-paths.js.map +1 -0
- package/dist/core/task/task-kernel-reviews.d.ts +3 -0
- package/dist/core/task/task-kernel-reviews.d.ts.map +1 -0
- package/dist/core/task/task-kernel-reviews.js +100 -0
- package/dist/core/task/task-kernel-reviews.js.map +1 -0
- package/dist/core/task/task-kernel-runs.d.ts +5 -0
- package/dist/core/task/task-kernel-runs.d.ts.map +1 -0
- package/dist/core/task/task-kernel-runs.js +196 -0
- package/dist/core/task/task-kernel-runs.js.map +1 -0
- package/dist/core/task/task-kernel-schema.d.ts +29 -0
- package/dist/core/task/task-kernel-schema.d.ts.map +1 -0
- package/dist/core/task/task-kernel-schema.js +1169 -0
- package/dist/core/task/task-kernel-schema.js.map +1 -0
- package/dist/core/task/task-kernel-store-v2.d.ts +33 -0
- package/dist/core/task/task-kernel-store-v2.d.ts.map +1 -0
- package/dist/core/task/task-kernel-store-v2.js +574 -0
- package/dist/core/task/task-kernel-store-v2.js.map +1 -0
- package/dist/core/task/task-kernel-types.d.ts +585 -0
- package/dist/core/task/task-kernel-types.d.ts.map +1 -0
- package/dist/core/task/task-kernel-types.js +31 -0
- package/dist/core/task/task-kernel-types.js.map +1 -0
- package/dist/core/task/task-kernel-workspaces.d.ts +10 -0
- package/dist/core/task/task-kernel-workspaces.d.ts.map +1 -0
- package/dist/core/task/task-kernel-workspaces.js +250 -0
- package/dist/core/task/task-kernel-workspaces.js.map +1 -0
- package/dist/core/task/task-kernel-write-set.d.ts +3 -0
- package/dist/core/task/task-kernel-write-set.d.ts.map +1 -0
- package/dist/core/task/task-kernel-write-set.js +12 -0
- package/dist/core/task/task-kernel-write-set.js.map +1 -0
- package/dist/core/task/task-kernel.d.ts +19 -0
- package/dist/core/task/task-kernel.d.ts.map +1 -0
- package/dist/core/task/task-kernel.js +17 -0
- package/dist/core/task/task-kernel.js.map +1 -0
- package/dist/core/task/task-pull-request-observer.d.ts +25 -0
- package/dist/core/task/task-pull-request-observer.d.ts.map +1 -0
- package/dist/core/task/task-pull-request-observer.js +187 -0
- package/dist/core/task/task-pull-request-observer.js.map +1 -0
- package/dist/core/task/task-review-evidence.d.ts +27 -0
- package/dist/core/task/task-review-evidence.d.ts.map +1 -0
- package/dist/core/task/task-review-evidence.js +383 -0
- package/dist/core/task/task-review-evidence.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/index.d.ts +1 -1
- package/dist/migrations/index.d.ts.map +1 -1
- package/dist/migrations/index.js +5 -3
- package/dist/migrations/index.js.map +1 -1
- 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-beta.3.json +9 -0
- package/dist/migrations/manifests/0.6.0-beta.4.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/artifacts/documents.d.ts +72 -0
- package/dist/pactile/artifacts/documents.d.ts.map +1 -0
- package/dist/pactile/artifacts/documents.js +406 -0
- package/dist/pactile/artifacts/documents.js.map +1 -0
- package/dist/pactile/artifacts/index.d.ts +6 -0
- package/dist/pactile/artifacts/index.d.ts.map +1 -0
- package/dist/pactile/artifacts/index.js +6 -0
- package/dist/pactile/artifacts/index.js.map +1 -0
- package/dist/pactile/artifacts/projection.d.ts +50 -0
- package/dist/pactile/artifacts/projection.d.ts.map +1 -0
- package/dist/pactile/artifacts/projection.js +139 -0
- package/dist/pactile/artifacts/projection.js.map +1 -0
- package/dist/pactile/artifacts/reader.d.ts +20 -0
- package/dist/pactile/artifacts/reader.d.ts.map +1 -0
- package/dist/pactile/artifacts/reader.js +559 -0
- package/dist/pactile/artifacts/reader.js.map +1 -0
- package/dist/pactile/artifacts/schema.d.ts +4 -0
- package/dist/pactile/artifacts/schema.d.ts.map +1 -0
- package/dist/pactile/artifacts/schema.js +217 -0
- package/dist/pactile/artifacts/schema.js.map +1 -0
- package/dist/pactile/artifacts/types.d.ts +66 -0
- package/dist/pactile/artifacts/types.d.ts.map +1 -0
- package/dist/pactile/artifacts/types.js +45 -0
- package/dist/pactile/artifacts/types.js.map +1 -0
- package/dist/pactile/capabilities/claim.d.ts +3 -0
- package/dist/pactile/capabilities/claim.d.ts.map +1 -0
- package/dist/pactile/capabilities/claim.js +97 -0
- package/dist/pactile/capabilities/claim.js.map +1 -0
- package/dist/pactile/capabilities/command.d.ts +6 -0
- package/dist/pactile/capabilities/command.d.ts.map +1 -0
- package/dist/pactile/capabilities/command.js +253 -0
- package/dist/pactile/capabilities/command.js.map +1 -0
- package/dist/pactile/capabilities/discover.d.ts +6 -0
- package/dist/pactile/capabilities/discover.d.ts.map +1 -0
- package/dist/pactile/capabilities/discover.js +48 -0
- package/dist/pactile/capabilities/discover.js.map +1 -0
- package/dist/pactile/capabilities/node.d.ts +15 -0
- package/dist/pactile/capabilities/node.d.ts.map +1 -0
- package/dist/pactile/capabilities/node.js +292 -0
- package/dist/pactile/capabilities/node.js.map +1 -0
- package/dist/pactile/capabilities/read.d.ts +6 -0
- package/dist/pactile/capabilities/read.d.ts.map +1 -0
- package/dist/pactile/capabilities/read.js +100 -0
- package/dist/pactile/capabilities/read.js.map +1 -0
- package/dist/pactile/capabilities/receipts.d.ts +17 -0
- package/dist/pactile/capabilities/receipts.d.ts.map +1 -0
- package/dist/pactile/capabilities/receipts.js +90 -0
- package/dist/pactile/capabilities/receipts.js.map +1 -0
- package/dist/pactile/capabilities/search.d.ts +6 -0
- package/dist/pactile/capabilities/search.d.ts.map +1 -0
- package/dist/pactile/capabilities/search.js +181 -0
- package/dist/pactile/capabilities/search.js.map +1 -0
- package/dist/pactile/capabilities/shared.d.ts +29 -0
- package/dist/pactile/capabilities/shared.d.ts.map +1 -0
- package/dist/pactile/capabilities/shared.js +134 -0
- package/dist/pactile/capabilities/shared.js.map +1 -0
- package/dist/pactile/capabilities/workspace.d.ts +19 -0
- package/dist/pactile/capabilities/workspace.d.ts.map +1 -0
- package/dist/pactile/capabilities/workspace.js +273 -0
- package/dist/pactile/capabilities/workspace.js.map +1 -0
- package/dist/pactile/codex/bridge.d.ts +174 -0
- package/dist/pactile/codex/bridge.d.ts.map +1 -0
- package/dist/pactile/codex/bridge.js +1445 -0
- package/dist/pactile/codex/bridge.js.map +1 -0
- package/dist/pactile/codex/dispatch-stop-proof.d.ts +43 -0
- package/dist/pactile/codex/dispatch-stop-proof.d.ts.map +1 -0
- package/dist/pactile/codex/dispatch-stop-proof.js +177 -0
- package/dist/pactile/codex/dispatch-stop-proof.js.map +1 -0
- package/dist/pactile/codex/host-stop.d.ts +47 -0
- package/dist/pactile/codex/host-stop.d.ts.map +1 -0
- package/dist/pactile/codex/host-stop.js +344 -0
- package/dist/pactile/codex/host-stop.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/coordination/index.d.ts +4 -0
- package/dist/pactile/coordination/index.d.ts.map +1 -0
- package/dist/pactile/coordination/index.js +4 -0
- package/dist/pactile/coordination/index.js.map +1 -0
- package/dist/pactile/coordination/journal.d.ts +10 -0
- package/dist/pactile/coordination/journal.d.ts.map +1 -0
- package/dist/pactile/coordination/journal.js +255 -0
- package/dist/pactile/coordination/journal.js.map +1 -0
- package/dist/pactile/coordination/kernel-resume.d.ts +8 -0
- package/dist/pactile/coordination/kernel-resume.d.ts.map +1 -0
- package/dist/pactile/coordination/kernel-resume.js +87 -0
- package/dist/pactile/coordination/kernel-resume.js.map +1 -0
- package/dist/pactile/coordination/model.d.ts +553 -0
- package/dist/pactile/coordination/model.d.ts.map +1 -0
- package/dist/pactile/coordination/model.js +239 -0
- package/dist/pactile/coordination/model.js.map +1 -0
- package/dist/pactile/coordination/state.d.ts +46 -0
- package/dist/pactile/coordination/state.d.ts.map +1 -0
- package/dist/pactile/coordination/state.js +301 -0
- package/dist/pactile/coordination/state.js.map +1 -0
- package/dist/pactile/coordination/store.d.ts +94 -0
- package/dist/pactile/coordination/store.d.ts.map +1 -0
- package/dist/pactile/coordination/store.js +396 -0
- package/dist/pactile/coordination/store.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/index.d.ts +7 -1
- package/dist/pactile/index.d.ts.map +1 -1
- package/dist/pactile/index.js +7 -1
- package/dist/pactile/index.js.map +1 -1
- package/dist/pactile/jev/contracts.d.ts +104 -0
- package/dist/pactile/jev/contracts.d.ts.map +1 -0
- package/dist/pactile/jev/contracts.js +53 -0
- package/dist/pactile/jev/contracts.js.map +1 -0
- package/dist/pactile/jev/decision.d.ts +58 -0
- package/dist/pactile/jev/decision.d.ts.map +1 -0
- package/dist/pactile/jev/decision.js +149 -0
- package/dist/pactile/jev/decision.js.map +1 -0
- package/dist/pactile/jev/http.d.ts +25 -0
- package/dist/pactile/jev/http.d.ts.map +1 -0
- package/dist/pactile/jev/http.js +234 -0
- package/dist/pactile/jev/http.js.map +1 -0
- package/dist/pactile/jev/index.d.ts +8 -0
- package/dist/pactile/jev/index.d.ts.map +1 -0
- package/dist/pactile/jev/index.js +4 -0
- package/dist/pactile/jev/index.js.map +1 -0
- package/dist/pactile/jev/outbound.d.ts +15 -0
- package/dist/pactile/jev/outbound.d.ts.map +1 -0
- package/dist/pactile/jev/outbound.js +264 -0
- package/dist/pactile/jev/outbound.js.map +1 -0
- package/dist/pactile/jev/project-policy.d.ts +10 -0
- package/dist/pactile/jev/project-policy.d.ts.map +1 -0
- package/dist/pactile/jev/project-policy.js +53 -0
- package/dist/pactile/jev/project-policy.js.map +1 -0
- package/dist/pactile/jev/response.d.ts +17 -0
- package/dist/pactile/jev/response.d.ts.map +1 -0
- package/dist/pactile/jev/response.js +280 -0
- package/dist/pactile/jev/response.js.map +1 -0
- package/dist/pactile/jev/scheduler-advice.d.ts +92 -0
- package/dist/pactile/jev/scheduler-advice.d.ts.map +1 -0
- package/dist/pactile/jev/scheduler-advice.js +323 -0
- package/dist/pactile/jev/scheduler-advice.js.map +1 -0
- package/dist/pactile/jev/transport.d.ts +6 -0
- package/dist/pactile/jev/transport.d.ts.map +1 -0
- package/dist/pactile/jev/transport.js +87 -0
- package/dist/pactile/jev/transport.js.map +1 -0
- 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/deferred-live.d.ts +17 -0
- package/dist/pactile/lifecycle/deferred-live.d.ts.map +1 -0
- package/dist/pactile/lifecycle/deferred-live.js +173 -0
- package/dist/pactile/lifecycle/deferred-live.js.map +1 -0
- package/dist/pactile/lifecycle/legacy-import.d.ts +1 -1
- package/dist/pactile/lifecycle/legacy-import.js +3 -3
- package/dist/pactile/lifecycle/legacy-import.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 +5 -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/legacy-task-batch-generation.d.ts +23 -0
- package/dist/pactile/migration/legacy-task-batch-generation.d.ts.map +1 -0
- package/dist/pactile/migration/legacy-task-batch-generation.js +102 -0
- package/dist/pactile/migration/legacy-task-batch-generation.js.map +1 -0
- package/dist/pactile/migration/legacy-task-batch-io.d.ts +9 -0
- package/dist/pactile/migration/legacy-task-batch-io.d.ts.map +1 -0
- package/dist/pactile/migration/legacy-task-batch-io.js +208 -0
- package/dist/pactile/migration/legacy-task-batch-io.js.map +1 -0
- package/dist/pactile/migration/legacy-task-batch-journal.d.ts +6 -0
- package/dist/pactile/migration/legacy-task-batch-journal.d.ts.map +1 -0
- package/dist/pactile/migration/legacy-task-batch-journal.js +121 -0
- package/dist/pactile/migration/legacy-task-batch-journal.js.map +1 -0
- package/dist/pactile/migration/legacy-task-batch-orchestrator.d.ts +18 -0
- package/dist/pactile/migration/legacy-task-batch-orchestrator.d.ts.map +1 -0
- package/dist/pactile/migration/legacy-task-batch-orchestrator.js +634 -0
- package/dist/pactile/migration/legacy-task-batch-orchestrator.js.map +1 -0
- package/dist/pactile/migration/legacy-task-batch-source.d.ts +8 -0
- package/dist/pactile/migration/legacy-task-batch-source.d.ts.map +1 -0
- package/dist/pactile/migration/legacy-task-batch-source.js +158 -0
- package/dist/pactile/migration/legacy-task-batch-source.js.map +1 -0
- package/dist/pactile/migration/legacy-task-batch-types.d.ts +127 -0
- package/dist/pactile/migration/legacy-task-batch-types.d.ts.map +1 -0
- package/dist/pactile/migration/legacy-task-batch-types.js +127 -0
- package/dist/pactile/migration/legacy-task-batch-types.js.map +1 -0
- package/dist/pactile/migration/legacy-task-batch.d.ts +3 -0
- package/dist/pactile/migration/legacy-task-batch.d.ts.map +1 -0
- package/dist/pactile/migration/legacy-task-batch.js +2 -0
- package/dist/pactile/migration/legacy-task-batch.js.map +1 -0
- package/dist/pactile/migration/legacy-task-held-source-reader.d.ts +27 -0
- package/dist/pactile/migration/legacy-task-held-source-reader.d.ts.map +1 -0
- package/dist/pactile/migration/legacy-task-held-source-reader.js +261 -0
- package/dist/pactile/migration/legacy-task-held-source-reader.js.map +1 -0
- package/dist/pactile/migration/legacy-task-reconciliation.d.ts +46 -0
- package/dist/pactile/migration/legacy-task-reconciliation.d.ts.map +1 -0
- package/dist/pactile/migration/legacy-task-reconciliation.js +589 -0
- package/dist/pactile/migration/legacy-task-reconciliation.js.map +1 -0
- package/dist/pactile/migration/legacy-task-update.d.ts +19 -0
- package/dist/pactile/migration/legacy-task-update.d.ts.map +1 -0
- package/dist/pactile/migration/legacy-task-update.js +164 -0
- package/dist/pactile/migration/legacy-task-update.js.map +1 -0
- 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 +60 -0
- package/dist/pactile/parallel/batch.d.ts.map +1 -0
- package/dist/pactile/parallel/batch.js +411 -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 +202 -0
- package/dist/pactile/parallel/policy.js.map +1 -0
- package/dist/pactile/pi/bridge.d.ts +188 -0
- package/dist/pactile/pi/bridge.d.ts.map +1 -0
- package/dist/pactile/pi/bridge.js +1564 -0
- package/dist/pactile/pi/bridge.js.map +1 -0
- package/dist/pactile/pi/rpc.d.ts +60 -0
- package/dist/pactile/pi/rpc.d.ts.map +1 -0
- package/dist/pactile/pi/rpc.js +420 -0
- package/dist/pactile/pi/rpc.js.map +1 -0
- package/dist/pactile/pi/v2-dispatch.d.ts +113 -0
- package/dist/pactile/pi/v2-dispatch.d.ts.map +1 -0
- package/dist/pactile/pi/v2-dispatch.js +919 -0
- package/dist/pactile/pi/v2-dispatch.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 +2 -2
- 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 +64 -9
- package/dist/pactile/registry.d.ts.map +1 -1
- package/dist/pactile/registry.js +640 -28
- 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/index.d.ts +1 -0
- package/dist/pactile/retrieval/index.d.ts.map +1 -1
- package/dist/pactile/retrieval/index.js +1 -0
- package/dist/pactile/retrieval/index.js.map +1 -1
- package/dist/pactile/retrieval/jev-planning.d.ts +28 -0
- package/dist/pactile/retrieval/jev-planning.d.ts.map +1 -0
- package/dist/pactile/retrieval/jev-planning.js +96 -0
- package/dist/pactile/retrieval/jev-planning.js.map +1 -0
- 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/review/contract.d.ts +232 -0
- package/dist/pactile/review/contract.d.ts.map +1 -0
- package/dist/pactile/review/contract.js +695 -0
- package/dist/pactile/review/contract.js.map +1 -0
- package/dist/pactile/review/escalation-artifacts.d.ts +41 -0
- package/dist/pactile/review/escalation-artifacts.d.ts.map +1 -0
- package/dist/pactile/review/escalation-artifacts.js +415 -0
- package/dist/pactile/review/escalation-artifacts.js.map +1 -0
- package/dist/pactile/review/escalation-contract.d.ts +115 -0
- package/dist/pactile/review/escalation-contract.d.ts.map +1 -0
- package/dist/pactile/review/escalation-contract.js +151 -0
- package/dist/pactile/review/escalation-contract.js.map +1 -0
- package/dist/pactile/review/escalation-finalize.d.ts +14 -0
- package/dist/pactile/review/escalation-finalize.d.ts.map +1 -0
- package/dist/pactile/review/escalation-finalize.js +319 -0
- package/dist/pactile/review/escalation-finalize.js.map +1 -0
- package/dist/pactile/review/escalation-reply.d.ts +10 -0
- package/dist/pactile/review/escalation-reply.d.ts.map +1 -0
- package/dist/pactile/review/escalation-reply.js +61 -0
- package/dist/pactile/review/escalation-reply.js.map +1 -0
- package/dist/pactile/review/escalation-transport.d.ts +32 -0
- package/dist/pactile/review/escalation-transport.d.ts.map +1 -0
- package/dist/pactile/review/escalation-transport.js +216 -0
- package/dist/pactile/review/escalation-transport.js.map +1 -0
- package/dist/pactile/review/escalation.d.ts +7 -0
- package/dist/pactile/review/escalation.d.ts.map +1 -0
- package/dist/pactile/review/escalation.js +6 -0
- package/dist/pactile/review/escalation.js.map +1 -0
- package/dist/pactile/review/evidence.d.ts +25 -0
- package/dist/pactile/review/evidence.d.ts.map +1 -0
- package/dist/pactile/review/evidence.js +58 -0
- package/dist/pactile/review/evidence.js.map +1 -0
- package/dist/pactile/review/jev-escalation-advice.d.ts +77 -0
- package/dist/pactile/review/jev-escalation-advice.d.ts.map +1 -0
- package/dist/pactile/review/jev-escalation-advice.js +358 -0
- package/dist/pactile/review/jev-escalation-advice.js.map +1 -0
- 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/scheduler/index.d.ts +6 -0
- package/dist/pactile/scheduler/index.d.ts.map +1 -0
- package/dist/pactile/scheduler/index.js +5 -0
- package/dist/pactile/scheduler/index.js.map +1 -0
- package/dist/pactile/scheduler/project-lease-store.d.ts +35 -0
- package/dist/pactile/scheduler/project-lease-store.d.ts.map +1 -0
- package/dist/pactile/scheduler/project-lease-store.js +189 -0
- package/dist/pactile/scheduler/project-lease-store.js.map +1 -0
- package/dist/pactile/scheduler/scheduler.d.ts +91 -0
- package/dist/pactile/scheduler/scheduler.d.ts.map +1 -0
- package/dist/pactile/scheduler/scheduler.js +589 -0
- package/dist/pactile/scheduler/scheduler.js.map +1 -0
- package/dist/pactile/scheduler/task-kernel-admission.d.ts +173 -0
- package/dist/pactile/scheduler/task-kernel-admission.d.ts.map +1 -0
- package/dist/pactile/scheduler/task-kernel-admission.js +1560 -0
- package/dist/pactile/scheduler/task-kernel-admission.js.map +1 -0
- package/dist/pactile/scheduler/task-kernel-wave-dispatch.d.ts +184 -0
- package/dist/pactile/scheduler/task-kernel-wave-dispatch.d.ts.map +1 -0
- package/dist/pactile/scheduler/task-kernel-wave-dispatch.js +952 -0
- package/dist/pactile/scheduler/task-kernel-wave-dispatch.js.map +1 -0
- package/dist/pactile/scheduler/task-map-scheduler.d.ts +116 -0
- package/dist/pactile/scheduler/task-map-scheduler.d.ts.map +1 -0
- package/dist/pactile/scheduler/task-map-scheduler.js +1448 -0
- package/dist/pactile/scheduler/task-map-scheduler.js.map +1 -0
- package/dist/pactile/scheduler/task-run-dispatch-state.d.ts +7 -0
- package/dist/pactile/scheduler/task-run-dispatch-state.d.ts.map +1 -0
- package/dist/pactile/scheduler/task-run-dispatch-state.js +69 -0
- package/dist/pactile/scheduler/task-run-dispatch-state.js.map +1 -0
- package/dist/pactile/task/authorization.d.ts +3 -0
- package/dist/pactile/task/authorization.d.ts.map +1 -0
- package/dist/pactile/task/authorization.js +43 -0
- package/dist/pactile/task/authorization.js.map +1 -0
- 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/creation.d.ts +22 -0
- package/dist/pactile/task/creation.d.ts.map +1 -0
- package/dist/pactile/task/creation.js +95 -0
- package/dist/pactile/task/creation.js.map +1 -0
- package/dist/pactile/task/guards.d.ts +18 -0
- package/dist/pactile/task/guards.d.ts.map +1 -0
- package/dist/pactile/task/guards.js +180 -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-jev-receipt.d.ts +58 -0
- package/dist/pactile/task/session-jev-receipt.d.ts.map +1 -0
- package/dist/pactile/task/session-jev-receipt.js +375 -0
- package/dist/pactile/task/session-jev-receipt.js.map +1 -0
- package/dist/pactile/task/session-jev.d.ts +7 -0
- package/dist/pactile/task/session-jev.d.ts.map +1 -0
- package/dist/pactile/task/session-jev.js +217 -0
- package/dist/pactile/task/session-jev.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 +278 -0
- package/dist/pactile/task/session-pack.js.map +1 -0
- package/dist/pactile/task/session-retrieval-jev-receipt.d.ts +49 -0
- package/dist/pactile/task/session-retrieval-jev-receipt.d.ts.map +1 -0
- package/dist/pactile/task/session-retrieval-jev-receipt.js +97 -0
- package/dist/pactile/task/session-retrieval-jev-receipt.js.map +1 -0
- package/dist/pactile/task/session-retrieval-jev.d.ts +8 -0
- package/dist/pactile/task/session-retrieval-jev.d.ts.map +1 -0
- package/dist/pactile/task/session-retrieval-jev.js +352 -0
- package/dist/pactile/task/session-retrieval-jev.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 +2 -0
- package/dist/pactile/task/strategy.d.ts.map +1 -0
- package/dist/pactile/task/strategy.js +3 -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/jev-selection.d.ts +44 -0
- package/dist/pactile/tiles/jev-selection.d.ts.map +1 -0
- package/dist/pactile/tiles/jev-selection.js +210 -0
- package/dist/pactile/tiles/jev-selection.js.map +1 -0
- 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/pactile/tiles/safe-yaml.d.ts +5 -1
- package/dist/pactile/tiles/safe-yaml.d.ts.map +1 -1
- package/dist/pactile/tiles/safe-yaml.js +8 -8
- package/dist/pactile/tiles/safe-yaml.js.map +1 -1
- package/dist/pactile/tiles/selection-receipts.d.ts +71 -0
- package/dist/pactile/tiles/selection-receipts.d.ts.map +1 -0
- package/dist/pactile/tiles/selection-receipts.js +319 -0
- package/dist/pactile/tiles/selection-receipts.js.map +1 -0
- package/dist/pactile/tiles/selection.d.ts +185 -0
- package/dist/pactile/tiles/selection.d.ts.map +1 -0
- package/dist/pactile/tiles/selection.js +985 -0
- package/dist/pactile/tiles/selection.js.map +1 -0
- package/dist/pactile/verification/git-observer.d.ts +3 -0
- package/dist/pactile/verification/git-observer.d.ts.map +1 -0
- package/dist/pactile/verification/git-observer.js +3 -0
- package/dist/pactile/verification/git-observer.js.map +1 -0
- package/dist/pactile/verification/index.d.ts +11 -0
- package/dist/pactile/verification/index.d.ts.map +1 -0
- package/dist/pactile/verification/index.js +6 -0
- package/dist/pactile/verification/index.js.map +1 -0
- package/dist/pactile/verification/jev-advice.d.ts +78 -0
- package/dist/pactile/verification/jev-advice.d.ts.map +1 -0
- package/dist/pactile/verification/jev-advice.js +397 -0
- package/dist/pactile/verification/jev-advice.js.map +1 -0
- package/dist/pactile/verification/planner.d.ts +15 -0
- package/dist/pactile/verification/planner.d.ts.map +1 -0
- package/dist/pactile/verification/planner.js +412 -0
- package/dist/pactile/verification/planner.js.map +1 -0
- package/dist/pactile/verification/receipt.d.ts +101 -0
- package/dist/pactile/verification/receipt.d.ts.map +1 -0
- package/dist/pactile/verification/receipt.js +400 -0
- package/dist/pactile/verification/receipt.js.map +1 -0
- package/dist/pactile/verification/types.d.ts +72 -0
- package/dist/pactile/verification/types.d.ts.map +1 -0
- package/dist/pactile/verification/types.js +21 -0
- package/dist/pactile/verification/types.js.map +1 -0
- package/dist/pactile/worktree/git-probe.d.ts +32 -0
- package/dist/pactile/worktree/git-probe.d.ts.map +1 -0
- package/dist/pactile/worktree/git-probe.js +336 -0
- package/dist/pactile/worktree/git-probe.js.map +1 -0
- package/dist/pactile/worktree/git-removal.d.ts +3 -0
- package/dist/pactile/worktree/git-removal.d.ts.map +1 -0
- package/dist/pactile/worktree/git-removal.js +11 -0
- package/dist/pactile/worktree/git-removal.js.map +1 -0
- package/dist/pactile/worktree/index.d.ts +2 -0
- package/dist/pactile/worktree/index.d.ts.map +1 -0
- package/dist/pactile/worktree/index.js +2 -0
- package/dist/pactile/worktree/index.js.map +1 -0
- package/dist/pactile/worktree/integration-evidence.d.ts +80 -0
- package/dist/pactile/worktree/integration-evidence.d.ts.map +1 -0
- package/dist/pactile/worktree/integration-evidence.js +166 -0
- package/dist/pactile/worktree/integration-evidence.js.map +1 -0
- package/dist/pactile/worktree/manager-core.d.ts +50 -0
- package/dist/pactile/worktree/manager-core.d.ts.map +1 -0
- package/dist/pactile/worktree/manager-core.js +359 -0
- package/dist/pactile/worktree/manager-core.js.map +1 -0
- package/dist/pactile/worktree/manager-provenance.d.ts +32 -0
- package/dist/pactile/worktree/manager-provenance.d.ts.map +1 -0
- package/dist/pactile/worktree/manager-provenance.js +409 -0
- package/dist/pactile/worktree/manager-provenance.js.map +1 -0
- package/dist/pactile/worktree/manager-types.d.ts +84 -0
- package/dist/pactile/worktree/manager-types.d.ts.map +1 -0
- package/dist/pactile/worktree/manager-types.js +11 -0
- package/dist/pactile/worktree/manager-types.js.map +1 -0
- package/dist/pactile/worktree/manager.d.ts +10 -0
- package/dist/pactile/worktree/manager.d.ts.map +1 -0
- package/dist/pactile/worktree/manager.js +6 -0
- package/dist/pactile/worktree/manager.js.map +1 -0
- package/dist/pactile/worktree/run-workspace-cleanup.d.ts +10 -0
- package/dist/pactile/worktree/run-workspace-cleanup.d.ts.map +1 -0
- package/dist/pactile/worktree/run-workspace-cleanup.js +695 -0
- package/dist/pactile/worktree/run-workspace-cleanup.js.map +1 -0
- package/dist/pactile/worktree/run-workspace-lifecycle.d.ts +65 -0
- package/dist/pactile/worktree/run-workspace-lifecycle.d.ts.map +1 -0
- package/dist/pactile/worktree/run-workspace-lifecycle.js +276 -0
- package/dist/pactile/worktree/run-workspace-lifecycle.js.map +1 -0
- 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 +395 -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 +210 -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 +28 -116
- package/dist/templates/markdown/framework/prd-grill-frontier.md.txt +105 -105
- package/dist/templates/markdown/framework/release-boundary.md.txt +29 -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 +113 -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 +31 -43
- package/dist/templates/pactile/modules/close-basic/contract.md +35 -38
- 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 +35 -39
- package/dist/templates/pactile/modules/define-extended/contract.md +45 -45
- package/dist/templates/pactile/modules/execute-agent/contract.md +30 -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 +37 -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 +29 -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 +61 -61
- 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 +50 -50
- package/dist/templates/pactile/tasks/templates/release-readiness/handoff-template.md +45 -39
- 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 +61 -64
- package/dist/templates/template-utils.d.ts +1 -2
- package/dist/templates/template-utils.d.ts.map +1 -1
- package/dist/templates/template-utils.js +2 -13
- package/dist/templates/template-utils.js.map +1 -1
- 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 +3 -3
- package/dist/utils/p36-upgrade.d.ts.map +1 -1
- package/dist/utils/p36-upgrade.js +3 -11
- 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 +16 -2
- package/dist/utils/readiness.d.ts.map +1 -1
- package/dist/utils/readiness.js +63 -32
- 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/uninstall-scrubbers.js +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/dist/utils/workflow-dir.d.ts +1 -1
- package/dist/utils/workflow-dir.d.ts.map +1 -1
- package/dist/utils/workflow-dir.js +1 -1
- package/dist/utils/workflow-dir.js.map +1 -1
- package/package.json +63 -47
- package/CHANGELOG.md +0 -602
- package/bin/compat-warning.js +0 -11
- package/bin/cstl.js +0 -6
- package/bin/pactile.js +0 -3
- package/bin/smart-search.js +0 -38
- 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/migrations/manifests/0.1.0.json +0 -9
- package/dist/migrations/manifests/0.1.1.json +0 -9
- package/dist/migrations/manifests/0.1.2.json +0 -9
- package/dist/migrations/manifests/0.1.3.json +0 -9
- package/dist/migrations/manifests/0.1.4.json +0 -9
- package/dist/migrations/manifests/0.2.1.json +0 -9
- package/dist/migrations/manifests/0.2.10.json +0 -374
- package/dist/migrations/manifests/0.2.2.json +0 -9
- package/dist/migrations/manifests/0.2.3.json +0 -9
- package/dist/migrations/manifests/0.2.4.json +0 -9
- package/dist/migrations/manifests/0.2.5.json +0 -9
- package/dist/migrations/manifests/0.2.6.json +0 -9
- package/dist/migrations/manifests/0.2.7.json +0 -9
- package/dist/migrations/manifests/0.2.8.json +0 -9
- package/dist/migrations/manifests/0.2.9.json +0 -9
- package/dist/migrations/manifests/0.3.0.json +0 -89
- package/dist/migrations/manifests/0.3.1.json +0 -32
- package/dist/migrations/manifests/0.3.2.json +0 -16
- package/dist/migrations/manifests/0.3.3.json +0 -9
- package/dist/migrations/manifests/0.3.4.json +0 -9
- package/dist/migrations/manifests/0.3.5.json +0 -9
- package/dist/migrations/manifests/0.3.6.json +0 -9
- package/dist/migrations/manifests/0.4.0.json +0 -9
- package/dist/migrations/manifests/0.4.1.json +0 -9
- package/dist/migrations/manifests/0.4.2.json +0 -9
- package/dist/migrations/manifests/0.4.3.json +0 -9
- package/dist/migrations/manifests/0.5.0-beta.0.json +0 -9
- package/dist/migrations/manifests/0.5.0-beta.1.json +0 -9
- package/dist/migrations/manifests/0.5.0-beta.2.json +0 -9
- package/dist/migrations/manifests/0.5.0-beta.3.json +0 -9
- package/dist/migrations/manifests/0.5.0-beta.4.json +0 -9
- package/dist/migrations/manifests/0.5.0-beta.5.json +0 -9
- 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/pactile/compat/retired-alternate-client.d.ts +0 -42
- package/dist/pactile/compat/retired-alternate-client.d.ts.map +0 -1
- package/dist/pactile/compat/retired-alternate-client.js +0 -153
- package/dist/pactile/compat/retired-alternate-client.js.map +0 -1
- package/dist/pactile/compat/update-residue.d.ts +0 -4
- package/dist/pactile/compat/update-residue.d.ts.map +0 -1
- package/dist/pactile/compat/update-residue.js +0 -55
- package/dist/pactile/compat/update-residue.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/cursor-retrieval-env.d.ts +0 -17
- package/dist/utils/cursor-retrieval-env.d.ts.map +0 -1
- package/dist/utils/cursor-retrieval-env.js +0 -19
- package/dist/utils/cursor-retrieval-env.js.map +0 -1
- 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/proxy.d.ts +0 -25
- package/dist/utils/proxy.d.ts.map +0 -1
- package/dist/utils/proxy.js +0 -60
- package/dist/utils/proxy.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
- package/scripts/postinstall.js +0 -6
|
@@ -0,0 +1,2215 @@
|
|
|
1
|
+
import { execFileSync, execSync } from "node:child_process";
|
|
2
|
+
import fs from "node:fs";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { addTaskDependency, applyKernelArchive, applyKernelPatch, applyKernelRecordGate, applyKernelStart, assertFullQualityForPhase, buildAcEvidenceLedger, checkTaskClose, closeTaskKernel, createTaskKernel, emptyTaskRecord, fingerprintTaskValue, isTaskDeliveryLevel, listTaskKernelSnapshots, parseAcceptanceItems, qualityFingerprint, readDependencyGraph, readKernel, readTaskKernel, readTopology, recordTaskReview, recordTaskRunResult, resolveRequiredControls, startTaskRun, taskRecordSchema, unmetRequires, } from "../core/task/index.js";
|
|
5
|
+
import { createTaskCandidateEntry, isRunCandidateObservationEntry, observeTaskRunCandidate, } from "../core/task/task-candidate-observer.js";
|
|
6
|
+
import { addContextEntry, CONTEXT_FILES, readContextEntries, validateContextFile, } from "../pactile/task/context.js";
|
|
7
|
+
import * as piBridge from "../pactile/pi/bridge.js";
|
|
8
|
+
import { approvedExecuteTask } from "../pactile/task/authorization.js";
|
|
9
|
+
import { createTaskWithArtifacts } from "../pactile/task/creation.js";
|
|
10
|
+
import { readPactileConfig } from "../pactile/task/config.js";
|
|
11
|
+
import { resumeTaskRunWithCoordinationBarrier } from "../pactile/coordination/index.js";
|
|
12
|
+
import { runTaskScheduleCli, runTaskScheduleCliAsync, runTaskScheduleDispatchCli, } from "./task-schedule.js";
|
|
13
|
+
import { checkArchive, checkStartExecution, dependencyStatus, } from "../pactile/task/guards.js";
|
|
14
|
+
import { exitTask, resolveSelectedTask, resolveTaskDir, selectTask, } from "../pactile/task/session.js";
|
|
15
|
+
import { artifactFingerprint, contractFingerprint, currentGateErrors, readStrategyContract, requiredGates, } from "../pactile/task/strategy.js";
|
|
16
|
+
import { CHILD_STATES, childStateErrors, ensureTaskMap, readTaskMap, writeTaskMap, } from "../pactile/task/task-map.js";
|
|
17
|
+
import { readDeveloper } from "../utils/developer.js";
|
|
18
|
+
import { sameGitRoot } from "../utils/git-root.js";
|
|
19
|
+
import { localDate } from "../utils/local-date.js";
|
|
20
|
+
import { getAllTaskTemplates } from "../templates/pactile/index.js";
|
|
21
|
+
import { learningScaffold, prepareArchiveEvidence, } from "../pactile/task/scaffold.js";
|
|
22
|
+
import { listLegacyTaskImportRecords, readLegacyTaskImportRecord, } from "../core/task/legacy-task-migration-reader.js";
|
|
23
|
+
import { TASK_ARTIFACT_STAGES_V1, projectTaskArtifactsForAgentV1, projectTaskArtifactsForHumanV1, projectTaskKernelArtifactsV1, readSelectedTaskArtifactDocumentSectionsV1, readSelectedTaskArtifactDocumentsV1, readSelectedTaskArtifactSourcesV1, readTaskArtifactDocumentIndexV1, renderTaskPrdScaffoldV1, } from "../pactile/artifacts/index.js";
|
|
24
|
+
function option(args, name) {
|
|
25
|
+
const index = args.indexOf(name);
|
|
26
|
+
return index >= 0 ? args[index + 1] : undefined;
|
|
27
|
+
}
|
|
28
|
+
function options(args, name) {
|
|
29
|
+
const values = [];
|
|
30
|
+
for (let index = 0; index < args.length; index++) {
|
|
31
|
+
if (args[index] !== name)
|
|
32
|
+
continue;
|
|
33
|
+
const value = args[index + 1];
|
|
34
|
+
if (!value || value.startsWith("--"))
|
|
35
|
+
throw new Error(`${name} requires a value`);
|
|
36
|
+
values.push(value);
|
|
37
|
+
index++;
|
|
38
|
+
}
|
|
39
|
+
return values;
|
|
40
|
+
}
|
|
41
|
+
function requireArgument(value, label) {
|
|
42
|
+
if (!value || value.startsWith("--"))
|
|
43
|
+
throw new Error(`${label} is required`);
|
|
44
|
+
return value;
|
|
45
|
+
}
|
|
46
|
+
function requireLast(values, label) {
|
|
47
|
+
const value = values.at(-1);
|
|
48
|
+
if (value === undefined)
|
|
49
|
+
throw new Error(`${label} was not recorded`);
|
|
50
|
+
return value;
|
|
51
|
+
}
|
|
52
|
+
function taskDir(root, reference) {
|
|
53
|
+
const dir = resolveTaskDir(root, reference);
|
|
54
|
+
if (!fs.statSync(dir, { throwIfNoEntry: false })?.isDirectory())
|
|
55
|
+
throw new Error(`Task not found: ${reference}`);
|
|
56
|
+
return dir;
|
|
57
|
+
}
|
|
58
|
+
function taskRecord(dir) {
|
|
59
|
+
try {
|
|
60
|
+
const value = JSON.parse(fs.readFileSync(path.join(dir, "task.json"), "utf8"));
|
|
61
|
+
const parsed = taskRecordSchema.safeParse(value);
|
|
62
|
+
// Keep the validated source object intact. Legacy task.json files may carry
|
|
63
|
+
// fields outside the current schema; stripping them here changes V1
|
|
64
|
+
// dependency/quality behavior when subsequent commands patch the record.
|
|
65
|
+
return parsed.success ? value : null;
|
|
66
|
+
}
|
|
67
|
+
catch {
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
function runTaskHooks(root, event, taskJson) {
|
|
72
|
+
const hooks = readPactileConfig(root).hooks;
|
|
73
|
+
const entries = hooks && typeof hooks === "object" && !Array.isArray(hooks)
|
|
74
|
+
? hooks[event]
|
|
75
|
+
: undefined;
|
|
76
|
+
if (!Array.isArray(entries))
|
|
77
|
+
return;
|
|
78
|
+
for (const command of entries) {
|
|
79
|
+
if (typeof command !== "string" || !command.trim())
|
|
80
|
+
continue;
|
|
81
|
+
try {
|
|
82
|
+
execSync(command, {
|
|
83
|
+
cwd: root,
|
|
84
|
+
env: { ...process.env, TASK_JSON_PATH: taskJson },
|
|
85
|
+
encoding: "utf8",
|
|
86
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
87
|
+
timeout: 60_000,
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
catch (error) {
|
|
91
|
+
console.warn(`[WARN] Hook failed (${event}): ${command} — ${error instanceof Error ? error.message : String(error)}`);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
function patchTask(root, reference, change, operation, extras) {
|
|
96
|
+
const dir = taskDir(root, reference);
|
|
97
|
+
if (!taskRecord(dir))
|
|
98
|
+
throw new Error(`task.json not found at ${dir}`);
|
|
99
|
+
const revision = readKernel({ taskDir: dir, cwd: root }).kernel.revision;
|
|
100
|
+
applyKernelPatch({
|
|
101
|
+
taskDir: dir,
|
|
102
|
+
cwd: root,
|
|
103
|
+
expectedRevision: revision,
|
|
104
|
+
actor: `pactile task ${operation}`,
|
|
105
|
+
idempotencyKey: `patch:${operation}:${path.basename(dir)}:r${revision}`,
|
|
106
|
+
evidence: Object.keys(change).join(",") || operation,
|
|
107
|
+
record: change,
|
|
108
|
+
extras,
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
function activeTasks(root) {
|
|
112
|
+
const tasks = path.join(root, ".pactile", "tasks");
|
|
113
|
+
if (!fs.existsSync(tasks))
|
|
114
|
+
return [];
|
|
115
|
+
return fs
|
|
116
|
+
.readdirSync(tasks, { withFileTypes: true })
|
|
117
|
+
.filter((entry) => entry.isDirectory() &&
|
|
118
|
+
entry.name !== "archive" &&
|
|
119
|
+
entry.name !== "locale" &&
|
|
120
|
+
entry.name !== "templates")
|
|
121
|
+
.map((entry) => ({
|
|
122
|
+
dir: entry.name,
|
|
123
|
+
record: taskRecord(path.join(tasks, entry.name)),
|
|
124
|
+
}))
|
|
125
|
+
.filter((item) => item.record !== null)
|
|
126
|
+
.sort((left, right) => left.dir.localeCompare(right.dir));
|
|
127
|
+
}
|
|
128
|
+
function locale(root) {
|
|
129
|
+
try {
|
|
130
|
+
const config = fs.readFileSync(path.join(root, ".pactile", "config.yaml"), "utf8");
|
|
131
|
+
return /^artifact_locale:\s*en\s*$/m.test(config) ? "en" : "zh";
|
|
132
|
+
}
|
|
133
|
+
catch {
|
|
134
|
+
return "zh";
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
function verifySeed(taskLocale) {
|
|
138
|
+
return taskLocale === "zh"
|
|
139
|
+
? "# 验证证据\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"
|
|
140
|
+
: "# 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";
|
|
141
|
+
}
|
|
142
|
+
function parseAcceptanceCriteria(args) {
|
|
143
|
+
const raw = options(args, "--accept");
|
|
144
|
+
if (!raw.length)
|
|
145
|
+
throw new Error("at least one --accept <criterion> is required");
|
|
146
|
+
const parsed = raw.map((value, index) => {
|
|
147
|
+
const separator = value.indexOf("=");
|
|
148
|
+
if (separator > 0)
|
|
149
|
+
return {
|
|
150
|
+
id: value.slice(0, separator).trim(),
|
|
151
|
+
description: value.slice(separator + 1).trim(),
|
|
152
|
+
};
|
|
153
|
+
return { id: `AC-${index + 1}`, description: value.trim() };
|
|
154
|
+
});
|
|
155
|
+
if (parsed.some((item) => !item.id || !item.description))
|
|
156
|
+
throw new Error("--accept must be <criterion> or <id>=<criterion>");
|
|
157
|
+
return parsed;
|
|
158
|
+
}
|
|
159
|
+
function taskV2(root, reference) {
|
|
160
|
+
const dir = taskDir(root, reference);
|
|
161
|
+
const result = readTaskKernel({ root, taskDir: dir, cwd: root });
|
|
162
|
+
if (result.kind !== "task-kernel-v2")
|
|
163
|
+
throw new Error(`Task ${reference} uses legacy Kernel v1. It remains readable; automatic migration is reserved for P36.`);
|
|
164
|
+
return { dir, kernel: result.kernel };
|
|
165
|
+
}
|
|
166
|
+
function parseTaskArtifactDocumentSelection(value) {
|
|
167
|
+
const separator = value.lastIndexOf("@");
|
|
168
|
+
if (separator <= 0 || separator === value.length - 1) {
|
|
169
|
+
throw new Error("--document must be <document-id>@<sha256-fingerprint|absent> copied from a current artifact index");
|
|
170
|
+
}
|
|
171
|
+
const id = value.slice(0, separator);
|
|
172
|
+
const expectedFingerprint = value.slice(separator + 1);
|
|
173
|
+
if (expectedFingerprint !== "absent" &&
|
|
174
|
+
!/^sha256:[a-f0-9]{64}$/u.test(expectedFingerprint)) {
|
|
175
|
+
throw new Error("--document fingerprint must be a lowercase sha256 digest or absent");
|
|
176
|
+
}
|
|
177
|
+
return { id, expectedFingerprint };
|
|
178
|
+
}
|
|
179
|
+
function parseTaskArtifactSectionSelection(value) {
|
|
180
|
+
const separator = value.lastIndexOf("@");
|
|
181
|
+
if (separator <= 0 || separator === value.length - 1) {
|
|
182
|
+
throw new Error("--section must be <section-id>@<sha256-fingerprint> copied from a current artifact index");
|
|
183
|
+
}
|
|
184
|
+
const id = value.slice(0, separator);
|
|
185
|
+
const expectedFingerprint = value.slice(separator + 1);
|
|
186
|
+
if (!id.startsWith("section:") ||
|
|
187
|
+
!/^sha256:[a-f0-9]{64}$/u.test(expectedFingerprint)) {
|
|
188
|
+
throw new Error("--section requires a stable section ID and lowercase sha256 fingerprint");
|
|
189
|
+
}
|
|
190
|
+
return { id, expectedFingerprint };
|
|
191
|
+
}
|
|
192
|
+
function taskArtifacts(root, args) {
|
|
193
|
+
const reference = requireArgument(args[0], "task");
|
|
194
|
+
const { dir, kernel } = taskV2(root, reference);
|
|
195
|
+
const requestedStages = [...new Set(options(args, "--stage"))].map((value) => {
|
|
196
|
+
if (!TASK_ARTIFACT_STAGES_V1.includes(value)) {
|
|
197
|
+
throw new Error(`--stage must be one of: ${TASK_ARTIFACT_STAGES_V1.join(", ")}`);
|
|
198
|
+
}
|
|
199
|
+
return value;
|
|
200
|
+
});
|
|
201
|
+
const envelope = projectTaskKernelArtifactsV1(kernel);
|
|
202
|
+
const documents = readTaskArtifactDocumentIndexV1(dir, kernel.identity.taskId);
|
|
203
|
+
const projectionOptions = {
|
|
204
|
+
...(requestedStages.length ? { stages: requestedStages } : {}),
|
|
205
|
+
documents,
|
|
206
|
+
};
|
|
207
|
+
const requestedFactRefs = options(args, "--fact");
|
|
208
|
+
const selectedFactIds = requestedFactRefs.map((reference) => {
|
|
209
|
+
const fact = envelope.facts.find((candidate) => candidate.id === reference ||
|
|
210
|
+
`${candidate.ref.uri}#${candidate.ref.selector}` === reference);
|
|
211
|
+
if (!fact) {
|
|
212
|
+
throw new Error(`Unknown task artifact fact ID or locator: ${reference}`);
|
|
213
|
+
}
|
|
214
|
+
return fact.id;
|
|
215
|
+
});
|
|
216
|
+
const selectedDocuments = options(args, "--document").map(parseTaskArtifactDocumentSelection);
|
|
217
|
+
const selectedSections = options(args, "--section").map(parseTaskArtifactSectionSelection);
|
|
218
|
+
const agent = args.includes("--agent");
|
|
219
|
+
if (selectedDocuments.length) {
|
|
220
|
+
const visibleDocumentIds = new Set(requestedStages.length
|
|
221
|
+
? documents
|
|
222
|
+
.filter((document) => requestedStages.includes(document.stage))
|
|
223
|
+
.map(({ id }) => id)
|
|
224
|
+
: documents.map(({ id }) => id));
|
|
225
|
+
const outsideStage = selectedDocuments.find(({ id }) => !visibleDocumentIds.has(id));
|
|
226
|
+
if (outsideStage) {
|
|
227
|
+
throw new Error(`Task artifact document '${outsideStage.id}' is not present in the requested stage view`);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
const selectedDocumentContents = selectedDocuments.length
|
|
231
|
+
? readSelectedTaskArtifactDocumentsV1(dir, kernel.identity.taskId, selectedDocuments)
|
|
232
|
+
: undefined;
|
|
233
|
+
if (selectedSections.length) {
|
|
234
|
+
const visibleSectionIds = new Set(documents
|
|
235
|
+
.filter((document) => !requestedStages.length || requestedStages.includes(document.stage))
|
|
236
|
+
.flatMap((document) => (document.sections ?? []).map(({ id }) => id)));
|
|
237
|
+
const outsideStage = selectedSections.find(({ id }) => !visibleSectionIds.has(id));
|
|
238
|
+
if (outsideStage) {
|
|
239
|
+
throw new Error(`Task artifact document section '${outsideStage.id}' is not present in the requested stage view`);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
const selectedSectionContents = selectedSections.length
|
|
243
|
+
? readSelectedTaskArtifactDocumentSectionsV1(dir, kernel.identity.taskId, selectedSections)
|
|
244
|
+
: undefined;
|
|
245
|
+
if (selectedFactIds.length) {
|
|
246
|
+
const visibleFactIds = new Set(requestedStages.length
|
|
247
|
+
? requestedStages.flatMap((stage) => envelope.stageRefs[stage] ?? [])
|
|
248
|
+
: envelope.facts.map((fact) => fact.id));
|
|
249
|
+
const outsideStage = selectedFactIds.find((id) => !visibleFactIds.has(id));
|
|
250
|
+
if (outsideStage) {
|
|
251
|
+
throw new Error(`Task artifact fact '${outsideStage}' is not present in the requested stage view`);
|
|
252
|
+
}
|
|
253
|
+
const selectedSources = readSelectedTaskArtifactSourcesV1(kernel, envelope, selectedFactIds);
|
|
254
|
+
if (agent) {
|
|
255
|
+
console.log(JSON.stringify({
|
|
256
|
+
index: projectTaskArtifactsForAgentV1(envelope, projectionOptions),
|
|
257
|
+
selectedSources,
|
|
258
|
+
...(selectedDocumentContents
|
|
259
|
+
? { selectedDocuments: selectedDocumentContents }
|
|
260
|
+
: {}),
|
|
261
|
+
...(selectedSectionContents
|
|
262
|
+
? { selectedSections: selectedSectionContents }
|
|
263
|
+
: {}),
|
|
264
|
+
}, null, 2));
|
|
265
|
+
}
|
|
266
|
+
else {
|
|
267
|
+
console.log(JSON.stringify({
|
|
268
|
+
taskId: kernel.identity.taskId,
|
|
269
|
+
selectedSources,
|
|
270
|
+
...(selectedDocumentContents
|
|
271
|
+
? { selectedDocuments: selectedDocumentContents }
|
|
272
|
+
: {}),
|
|
273
|
+
...(selectedSectionContents
|
|
274
|
+
? { selectedSections: selectedSectionContents }
|
|
275
|
+
: {}),
|
|
276
|
+
}, null, 2));
|
|
277
|
+
}
|
|
278
|
+
return 0;
|
|
279
|
+
}
|
|
280
|
+
if (selectedDocumentContents || selectedSectionContents) {
|
|
281
|
+
console.log(JSON.stringify({
|
|
282
|
+
...(agent
|
|
283
|
+
? {
|
|
284
|
+
index: projectTaskArtifactsForAgentV1(envelope, projectionOptions),
|
|
285
|
+
}
|
|
286
|
+
: { taskId: kernel.identity.taskId }),
|
|
287
|
+
...(selectedDocumentContents
|
|
288
|
+
? { selectedDocuments: selectedDocumentContents }
|
|
289
|
+
: {}),
|
|
290
|
+
...(selectedSectionContents
|
|
291
|
+
? { selectedSections: selectedSectionContents }
|
|
292
|
+
: {}),
|
|
293
|
+
}, null, 2));
|
|
294
|
+
return 0;
|
|
295
|
+
}
|
|
296
|
+
if (agent) {
|
|
297
|
+
console.log(JSON.stringify(projectTaskArtifactsForAgentV1(envelope, projectionOptions), null, 2));
|
|
298
|
+
}
|
|
299
|
+
else {
|
|
300
|
+
console.log(projectTaskArtifactsForHumanV1(envelope, projectionOptions));
|
|
301
|
+
}
|
|
302
|
+
return 0;
|
|
303
|
+
}
|
|
304
|
+
function actor(root, args) {
|
|
305
|
+
return option(args, "--actor") ?? readDeveloper(root) ?? "user";
|
|
306
|
+
}
|
|
307
|
+
function createTask(args, root) {
|
|
308
|
+
if (args.includes("--legacy")) {
|
|
309
|
+
createLegacyTask(args.filter((value) => value !== "--legacy"), root);
|
|
310
|
+
return;
|
|
311
|
+
}
|
|
312
|
+
if (args.includes("--rigor") || args.includes("--parent")) {
|
|
313
|
+
throw new Error("--rigor and --parent are legacy task presets. Use `pactile task legacy-create --legacy` for existing 0.5.x workflows, or create a Task with --deliverable, --delivery-level, and --accept.");
|
|
314
|
+
}
|
|
315
|
+
const title = requireArgument(args[0], "title");
|
|
316
|
+
const slug = option(args, "--slug") ??
|
|
317
|
+
title
|
|
318
|
+
.toLowerCase()
|
|
319
|
+
.replace(/[^a-z0-9]+/g, "-")
|
|
320
|
+
.replace(/^-|-$/g, "");
|
|
321
|
+
if (!/^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(slug))
|
|
322
|
+
throw new Error("slug must contain lowercase letters, digits and hyphens");
|
|
323
|
+
const deliverable = requireArgument(option(args, "--deliverable"), "--deliverable");
|
|
324
|
+
const deliveryLevel = option(args, "--delivery-level");
|
|
325
|
+
if (!isTaskDeliveryLevel(deliveryLevel))
|
|
326
|
+
throw new Error("--delivery-level must be local-result, pull-request, merged-result, or documentation");
|
|
327
|
+
const dependencies = [...new Set(options(args, "--depends-on"))];
|
|
328
|
+
const directoryName = `${localDate(new Date()).slice(5)}-${slug}`;
|
|
329
|
+
const dir = path.resolve(root, ".pactile", "tasks", directoryName);
|
|
330
|
+
const result = createTaskKernel({
|
|
331
|
+
root,
|
|
332
|
+
taskDir: dir,
|
|
333
|
+
actor: actor(root, args),
|
|
334
|
+
idempotencyKey: option(args, "--idempotency-key") ?? `task-create:${slug}`,
|
|
335
|
+
definition: {
|
|
336
|
+
taskId: slug,
|
|
337
|
+
title,
|
|
338
|
+
description: option(args, "--description") ?? "",
|
|
339
|
+
deliverable,
|
|
340
|
+
deliveryLevel,
|
|
341
|
+
acceptanceCriteria: parseAcceptanceCriteria(args),
|
|
342
|
+
dependencies,
|
|
343
|
+
},
|
|
344
|
+
});
|
|
345
|
+
if (!result.idempotent) {
|
|
346
|
+
const prdPath = path.join(dir, "prd.md");
|
|
347
|
+
if (!fs.existsSync(prdPath)) {
|
|
348
|
+
try {
|
|
349
|
+
fs.writeFileSync(prdPath, renderTaskPrdScaffoldV1(result.kernel), {
|
|
350
|
+
encoding: "utf8",
|
|
351
|
+
flag: "wx",
|
|
352
|
+
});
|
|
353
|
+
}
|
|
354
|
+
catch (error) {
|
|
355
|
+
if (!(error instanceof Error) ||
|
|
356
|
+
!("code" in error) ||
|
|
357
|
+
error.code !== "EEXIST")
|
|
358
|
+
throw error;
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
console.log(`${path.relative(root, dir).replaceAll("\\", "/")}\nTask Kernel schema: ${result.kernel.schemaVersion}\nTask ID: ${result.kernel.identity.taskId}\nPRD: ${path.relative(root, path.join(dir, "prd.md")).replaceAll("\\", "/")}\nLive fact view: pactile task artifacts ${result.kernel.identity.taskId}`);
|
|
363
|
+
}
|
|
364
|
+
function runStartTask(root, args) {
|
|
365
|
+
const reference = requireArgument(args[0], "task");
|
|
366
|
+
const { dir, kernel } = taskV2(root, reference);
|
|
367
|
+
const authorization = {
|
|
368
|
+
approvedBy: requireArgument(option(args, "--approved-by"), "--approved-by"),
|
|
369
|
+
approvedAt: option(args, "--approved-at") ?? new Date().toISOString(),
|
|
370
|
+
scope: requireArgument(option(args, "--authorization-scope"), "--authorization-scope"),
|
|
371
|
+
evidenceRef: requireArgument(option(args, "--authorization-evidence"), "--authorization-evidence"),
|
|
372
|
+
};
|
|
373
|
+
const workspaceInputs = ["--workspace-path", "--branch", "--base-sha"].some((flag) => args.includes(flag));
|
|
374
|
+
const taskActor = actor(root, args);
|
|
375
|
+
let workspace;
|
|
376
|
+
if (workspaceInputs) {
|
|
377
|
+
workspace = {
|
|
378
|
+
canonicalPath: requireArgument(option(args, "--workspace-path"), "--workspace-path"),
|
|
379
|
+
branch: requireArgument(option(args, "--branch"), "--branch"),
|
|
380
|
+
baseSha: requireArgument(option(args, "--base-sha"), "--base-sha"),
|
|
381
|
+
writeSet: options(args, "--write-set"),
|
|
382
|
+
integrationState: "not-integrated",
|
|
383
|
+
reclamationState: "not-requested",
|
|
384
|
+
};
|
|
385
|
+
}
|
|
386
|
+
const hostInputs = [
|
|
387
|
+
"--host",
|
|
388
|
+
"--role",
|
|
389
|
+
"--session-id",
|
|
390
|
+
"--thread-id",
|
|
391
|
+
"--request-ref",
|
|
392
|
+
"--event-ref",
|
|
393
|
+
"--result-ref",
|
|
394
|
+
"--assurance-source",
|
|
395
|
+
].some((flag) => args.includes(flag));
|
|
396
|
+
let host;
|
|
397
|
+
if (hostInputs) {
|
|
398
|
+
host = {
|
|
399
|
+
host: requireArgument(option(args, "--host"), "--host"),
|
|
400
|
+
role: requireArgument(option(args, "--role"), "--role"),
|
|
401
|
+
sessionId: option(args, "--session-id") ?? null,
|
|
402
|
+
threadId: option(args, "--thread-id") ?? null,
|
|
403
|
+
requestRefs: options(args, "--request-ref"),
|
|
404
|
+
eventRefs: options(args, "--event-ref"),
|
|
405
|
+
resultRefs: options(args, "--result-ref"),
|
|
406
|
+
assuranceSource: option(args, "--assurance-source") ?? null,
|
|
407
|
+
};
|
|
408
|
+
}
|
|
409
|
+
const durationOption = (name) => {
|
|
410
|
+
const value = option(args, name);
|
|
411
|
+
if (value === undefined)
|
|
412
|
+
return null;
|
|
413
|
+
const parsed = Number(value);
|
|
414
|
+
if (!Number.isSafeInteger(parsed) || parsed < 0)
|
|
415
|
+
throw new Error(`${name} must be a non-negative integer`);
|
|
416
|
+
return parsed;
|
|
417
|
+
};
|
|
418
|
+
const input = {
|
|
419
|
+
summary: requireArgument(option(args, "--input-summary"), "--input-summary"),
|
|
420
|
+
references: options(args, "--input-ref"),
|
|
421
|
+
};
|
|
422
|
+
const initialState = args.includes("--wait")
|
|
423
|
+
? "waiting"
|
|
424
|
+
: "running";
|
|
425
|
+
const writeSetSnapshot = args.includes("--write-set-snapshot")
|
|
426
|
+
? options(args, "--write-set-snapshot")
|
|
427
|
+
: options(args, "--write-set");
|
|
428
|
+
const estimatedDurations = {
|
|
429
|
+
executionMs: durationOption("--estimate-execution-ms"),
|
|
430
|
+
waitingMs: durationOption("--estimate-waiting-ms"),
|
|
431
|
+
reviewMs: durationOption("--estimate-review-ms"),
|
|
432
|
+
};
|
|
433
|
+
const requestFingerprint = fingerprintTaskValue({
|
|
434
|
+
actor: taskActor,
|
|
435
|
+
input,
|
|
436
|
+
authorization: {
|
|
437
|
+
approvedBy: authorization.approvedBy,
|
|
438
|
+
scope: authorization.scope,
|
|
439
|
+
evidenceRef: authorization.evidenceRef,
|
|
440
|
+
},
|
|
441
|
+
initialState,
|
|
442
|
+
writeSetSnapshot,
|
|
443
|
+
estimatedDurations,
|
|
444
|
+
workspace: workspace ?? null,
|
|
445
|
+
host: host ?? null,
|
|
446
|
+
});
|
|
447
|
+
const activeRun = kernel.runs.find((run) => run.state === "running" || run.state === "waiting");
|
|
448
|
+
const attempt = activeRun?.attempt ?? kernel.runs.length + 1;
|
|
449
|
+
const idempotencyKey = option(args, "--idempotency-key") ??
|
|
450
|
+
`run-start:${kernel.identity.taskId}:${attempt}:${requestFingerprint}`;
|
|
451
|
+
const priorStart = kernel.events.find((event) => event.idempotencyKey === idempotencyKey &&
|
|
452
|
+
(event.type === "run.started" || event.type === "run.queued"));
|
|
453
|
+
const priorRun = priorStart
|
|
454
|
+
? kernel.runs.find((run) => run.id === priorStart.entityId)
|
|
455
|
+
: undefined;
|
|
456
|
+
if (!option(args, "--approved-at") && priorRun)
|
|
457
|
+
authorization.approvedAt = priorRun.authorization.approvedAt;
|
|
458
|
+
const result = startTaskRun({
|
|
459
|
+
root,
|
|
460
|
+
taskDir: dir,
|
|
461
|
+
expectedRevision: kernel.revision,
|
|
462
|
+
actor: taskActor,
|
|
463
|
+
idempotencyKey,
|
|
464
|
+
input,
|
|
465
|
+
initialState,
|
|
466
|
+
writeSetSnapshot,
|
|
467
|
+
estimatedDurations,
|
|
468
|
+
authorization,
|
|
469
|
+
...(workspace ? { workspace } : {}),
|
|
470
|
+
...(host ? { host } : {}),
|
|
471
|
+
});
|
|
472
|
+
const run = requireLast(result.kernel.runs, "Run");
|
|
473
|
+
console.log(`Run ${run.state === "waiting" ? "queued" : "started"}: ${run.id}\nTask: ${run.taskId}\nAttempt: ${run.attempt}\nKernel revision: ${result.kernel.revision}`);
|
|
474
|
+
return 0;
|
|
475
|
+
}
|
|
476
|
+
function resumeTask(root, args) {
|
|
477
|
+
const reference = requireArgument(args[0], "task");
|
|
478
|
+
const runId = requireArgument(args[1], "run ID");
|
|
479
|
+
const { dir, kernel } = taskV2(root, reference);
|
|
480
|
+
const result = resumeTaskRunWithCoordinationBarrier({
|
|
481
|
+
root,
|
|
482
|
+
taskDir: dir,
|
|
483
|
+
expectedRevision: kernel.revision,
|
|
484
|
+
runId,
|
|
485
|
+
actor: actor(root, args),
|
|
486
|
+
idempotencyKey: option(args, "--idempotency-key") ?? `run-resume:${runId}`,
|
|
487
|
+
});
|
|
488
|
+
console.log(`Run resumed: ${runId}\nKernel revision: ${result.kernel.revision}`);
|
|
489
|
+
return 0;
|
|
490
|
+
}
|
|
491
|
+
function parseCandidateEntries(args) {
|
|
492
|
+
return options(args, "--candidate").map((value) => {
|
|
493
|
+
const separator = value.lastIndexOf("=");
|
|
494
|
+
if (separator <= 0)
|
|
495
|
+
throw new Error("--candidate must be <reference>=<sha256-fingerprint>");
|
|
496
|
+
return {
|
|
497
|
+
ref: value.slice(0, separator),
|
|
498
|
+
fingerprint: value.slice(separator + 1),
|
|
499
|
+
};
|
|
500
|
+
});
|
|
501
|
+
}
|
|
502
|
+
function runResultTask(root, args) {
|
|
503
|
+
const reference = requireArgument(args[0], "task");
|
|
504
|
+
const runId = requireArgument(args[1], "run ID");
|
|
505
|
+
const { dir, kernel } = taskV2(root, reference);
|
|
506
|
+
const outcome = requireArgument(option(args, "--outcome"), "--outcome");
|
|
507
|
+
if (outcome !== "completed" && outcome !== "failed" && outcome !== "blocked")
|
|
508
|
+
throw new Error("--outcome must be completed, failed, or blocked");
|
|
509
|
+
const failure = outcome === "completed"
|
|
510
|
+
? undefined
|
|
511
|
+
: {
|
|
512
|
+
category: requireArgument(option(args, "--failure-category"), "--failure-category"),
|
|
513
|
+
message: requireArgument(option(args, "--failure-message"), "--failure-message"),
|
|
514
|
+
...(option(args, "--failure-evidence")
|
|
515
|
+
? { evidenceRef: option(args, "--failure-evidence") }
|
|
516
|
+
: {}),
|
|
517
|
+
};
|
|
518
|
+
let candidateEntries = [];
|
|
519
|
+
let evidenceRefs = options(args, "--evidence");
|
|
520
|
+
let executionMeasurementRef = option(args, "--execution-measurement-ref");
|
|
521
|
+
if (outcome === "completed") {
|
|
522
|
+
const run = kernel.runs.find((item) => item.id === runId);
|
|
523
|
+
if (!run)
|
|
524
|
+
throw new Error(`Run ${runId} does not exist on Task ${kernel.identity.taskId}`);
|
|
525
|
+
const candidateInputs = parseCandidateEntries(args);
|
|
526
|
+
if (candidateInputs.some((entry) => isRunCandidateObservationEntry(entry.ref))) {
|
|
527
|
+
throw new Error("--candidate cannot set a reserved P41 machine-observation reference");
|
|
528
|
+
}
|
|
529
|
+
const piBound = run.host?.host === "pi";
|
|
530
|
+
const hostEvidenceRefs = run.host
|
|
531
|
+
? [
|
|
532
|
+
...run.host.requestRefs,
|
|
533
|
+
...run.host.eventRefs,
|
|
534
|
+
...run.host.resultRefs,
|
|
535
|
+
]
|
|
536
|
+
: [];
|
|
537
|
+
if (!piBound &&
|
|
538
|
+
hostEvidenceRefs.some((reference) => reference.replaceAll("\\", "/").startsWith("pi-bridge/"))) {
|
|
539
|
+
throw new Error("Pi evidence references cannot complete a Run bound to another host");
|
|
540
|
+
}
|
|
541
|
+
let piEvidence = null;
|
|
542
|
+
if (piBound) {
|
|
543
|
+
if (run.host?.role !== "implement" ||
|
|
544
|
+
run.host.assuranceSource !== "manager-owned-child-exit") {
|
|
545
|
+
throw new Error("Pi Run completion requires implement role and manager-owned-child-exit assurance");
|
|
546
|
+
}
|
|
547
|
+
piEvidence = piBridge.readPiTaskRunEvidence(root, dir, runId);
|
|
548
|
+
if (!piEvidence) {
|
|
549
|
+
throw new Error("Pi Run has no valid settled host-stop and persisted result receipt; it cannot be recorded completed");
|
|
550
|
+
}
|
|
551
|
+
if (piEvidence.taskRunId !== run.id ||
|
|
552
|
+
piEvidence.taskId !== run.taskId ||
|
|
553
|
+
piEvidence.outcome !== "settled" ||
|
|
554
|
+
piEvidence.assurance !== "manager-owned-child-exit") {
|
|
555
|
+
throw new Error("Pi success evidence does not match the selected Task Run binding");
|
|
556
|
+
}
|
|
557
|
+
const suppliedMeasurement = executionMeasurementRef;
|
|
558
|
+
if (suppliedMeasurement &&
|
|
559
|
+
suppliedMeasurement !== piEvidence.executionMeasurementRef) {
|
|
560
|
+
throw new Error("--execution-measurement-ref conflicts with the verified Pi Run receipt");
|
|
561
|
+
}
|
|
562
|
+
executionMeasurementRef = piEvidence.executionMeasurementRef;
|
|
563
|
+
evidenceRefs = [
|
|
564
|
+
...new Set([...evidenceRefs, ...piEvidence.evidenceRefs]),
|
|
565
|
+
];
|
|
566
|
+
}
|
|
567
|
+
const runObservation = observeTaskRunCandidate({
|
|
568
|
+
run,
|
|
569
|
+
...(run.workspace === null ? { repositoryRoot: root } : {}),
|
|
570
|
+
});
|
|
571
|
+
candidateEntries = [
|
|
572
|
+
...candidateInputs,
|
|
573
|
+
createTaskCandidateEntry(runObservation),
|
|
574
|
+
];
|
|
575
|
+
}
|
|
576
|
+
const result = recordTaskRunResult({
|
|
577
|
+
root,
|
|
578
|
+
taskDir: dir,
|
|
579
|
+
expectedRevision: kernel.revision,
|
|
580
|
+
runId,
|
|
581
|
+
outcome,
|
|
582
|
+
...(option(args, "--summary")
|
|
583
|
+
? { summary: option(args, "--summary") }
|
|
584
|
+
: {}),
|
|
585
|
+
evidenceRefs,
|
|
586
|
+
candidateEntries,
|
|
587
|
+
failure,
|
|
588
|
+
measurementRefs: {
|
|
589
|
+
...(executionMeasurementRef
|
|
590
|
+
? { execution: executionMeasurementRef }
|
|
591
|
+
: {}),
|
|
592
|
+
...(option(args, "--waiting-measurement-ref")
|
|
593
|
+
? { waiting: option(args, "--waiting-measurement-ref") }
|
|
594
|
+
: {}),
|
|
595
|
+
},
|
|
596
|
+
actor: actor(root, args),
|
|
597
|
+
idempotencyKey: option(args, "--idempotency-key") ?? `run-result:${runId}`,
|
|
598
|
+
});
|
|
599
|
+
console.log(`Run ${runId}: ${outcome}\nTask phase: ${result.kernel.phase}\nKernel revision: ${result.kernel.revision}`);
|
|
600
|
+
return 0;
|
|
601
|
+
}
|
|
602
|
+
function parseAcceptanceEvidenceArgs(args) {
|
|
603
|
+
const result = {};
|
|
604
|
+
for (const item of options(args, "--criterion")) {
|
|
605
|
+
const separator = item.indexOf("=");
|
|
606
|
+
if (separator <= 0 || separator === item.length - 1)
|
|
607
|
+
throw new Error("--criterion must be <criterion-id>=<evidence-reference>");
|
|
608
|
+
const id = item.slice(0, separator);
|
|
609
|
+
if (Object.prototype.hasOwnProperty.call(result, id))
|
|
610
|
+
result[id]?.push(item.slice(separator + 1));
|
|
611
|
+
else
|
|
612
|
+
Object.defineProperty(result, id, {
|
|
613
|
+
value: [item.slice(separator + 1)],
|
|
614
|
+
enumerable: true,
|
|
615
|
+
writable: true,
|
|
616
|
+
configurable: true,
|
|
617
|
+
});
|
|
618
|
+
}
|
|
619
|
+
return result;
|
|
620
|
+
}
|
|
621
|
+
function reviewTask(root, args) {
|
|
622
|
+
const reference = requireArgument(args[0], "task");
|
|
623
|
+
const { dir, kernel } = taskV2(root, reference);
|
|
624
|
+
const runId = requireArgument(option(args, "--run"), "--run");
|
|
625
|
+
const decision = requireArgument(option(args, "--decision"), "--decision");
|
|
626
|
+
if (decision !== "pass" &&
|
|
627
|
+
decision !== "fail" &&
|
|
628
|
+
decision !== "needs-changes")
|
|
629
|
+
throw new Error("--decision must be pass, fail, or needs-changes");
|
|
630
|
+
const candidateSnapshotId = requireArgument(option(args, "--candidate-id"), "--candidate-id");
|
|
631
|
+
const candidateFingerprint = requireArgument(option(args, "--candidate-fingerprint"), "--candidate-fingerprint");
|
|
632
|
+
const reviewer = requireArgument(option(args, "--reviewer"), "--reviewer");
|
|
633
|
+
const evidenceRefs = options(args, "--evidence");
|
|
634
|
+
const acceptanceEvidence = parseAcceptanceEvidenceArgs(args);
|
|
635
|
+
const unresolvedBlockers = options(args, "--blocker");
|
|
636
|
+
const measurementRef = option(args, "--review-measurement-ref");
|
|
637
|
+
const taskActor = actor(root, args);
|
|
638
|
+
const idempotencyKey = option(args, "--idempotency-key") ??
|
|
639
|
+
`review:${runId}:${fingerprintTaskValue({
|
|
640
|
+
actor: taskActor,
|
|
641
|
+
runId,
|
|
642
|
+
candidateSnapshotId,
|
|
643
|
+
candidateFingerprint,
|
|
644
|
+
reviewer,
|
|
645
|
+
decision,
|
|
646
|
+
evidenceRefs,
|
|
647
|
+
acceptanceEvidence,
|
|
648
|
+
unresolvedBlockers,
|
|
649
|
+
measurementRef: measurementRef ?? null,
|
|
650
|
+
})}`;
|
|
651
|
+
const result = recordTaskReview({
|
|
652
|
+
root,
|
|
653
|
+
taskDir: dir,
|
|
654
|
+
expectedRevision: kernel.revision,
|
|
655
|
+
runId,
|
|
656
|
+
candidateSnapshotId,
|
|
657
|
+
candidateFingerprint,
|
|
658
|
+
reviewer,
|
|
659
|
+
decision,
|
|
660
|
+
evidenceRefs,
|
|
661
|
+
acceptanceEvidence,
|
|
662
|
+
unresolvedBlockers,
|
|
663
|
+
measurementRef,
|
|
664
|
+
actor: taskActor,
|
|
665
|
+
idempotencyKey,
|
|
666
|
+
});
|
|
667
|
+
const review = requireLast(result.kernel.reviews, "Review");
|
|
668
|
+
console.log(`Review recorded: ${review.id}\nDecision: ${review.decision}\nCandidate: ${review.candidateFingerprint}`);
|
|
669
|
+
return 0;
|
|
670
|
+
}
|
|
671
|
+
function closeTask(root, args) {
|
|
672
|
+
const reference = requireArgument(args[0], "task");
|
|
673
|
+
const { dir, kernel } = taskV2(root, reference);
|
|
674
|
+
const runId = requireArgument(option(args, "--run"), "--run");
|
|
675
|
+
const reviewId = requireArgument(option(args, "--review"), "--review");
|
|
676
|
+
const deliveryEvidence = {
|
|
677
|
+
level: option(args, "--delivery-level"),
|
|
678
|
+
reference: requireArgument(option(args, "--delivery-ref"), "--delivery-ref"),
|
|
679
|
+
summary: requireArgument(option(args, "--delivery-summary"), "--delivery-summary"),
|
|
680
|
+
...(option(args, "--delivery-path")
|
|
681
|
+
? { path: option(args, "--delivery-path") }
|
|
682
|
+
: {}),
|
|
683
|
+
...(option(args, "--target-branch")
|
|
684
|
+
? { targetBranch: option(args, "--target-branch") }
|
|
685
|
+
: {}),
|
|
686
|
+
};
|
|
687
|
+
if (!isTaskDeliveryLevel(deliveryEvidence.level))
|
|
688
|
+
throw new Error("--delivery-level must be local-result, pull-request, merged-result, or documentation");
|
|
689
|
+
const candidateObservation = {
|
|
690
|
+
snapshotId: requireArgument(option(args, "--candidate-id"), "--candidate-id"),
|
|
691
|
+
fingerprint: requireArgument(option(args, "--candidate-fingerprint"), "--candidate-fingerprint"),
|
|
692
|
+
observedBy: requireArgument(option(args, "--candidate-observed-by"), "--candidate-observed-by"),
|
|
693
|
+
observedAt: option(args, "--candidate-observed-at") ?? new Date().toISOString(),
|
|
694
|
+
source: requireArgument(option(args, "--candidate-observation-source"), "--candidate-observation-source"),
|
|
695
|
+
evidenceRef: requireArgument(option(args, "--candidate-observation-ref"), "--candidate-observation-ref"),
|
|
696
|
+
};
|
|
697
|
+
if (args.includes("--check")) {
|
|
698
|
+
const errors = checkTaskClose({
|
|
699
|
+
root,
|
|
700
|
+
taskDir: dir,
|
|
701
|
+
expectedRevision: kernel.revision,
|
|
702
|
+
runId,
|
|
703
|
+
reviewId,
|
|
704
|
+
candidateObservation,
|
|
705
|
+
deliveryEvidence,
|
|
706
|
+
});
|
|
707
|
+
console.log(`Task Close check: ${errors.length ? "FAIL" : "PASS"}${errors.length ? `\n${errors.map((error) => ` - ${error}`).join("\n")}` : ""}`);
|
|
708
|
+
console.log("Candidate freshness: Close re-observes current project state against the frozen Run candidate.");
|
|
709
|
+
return errors.length ? 1 : 0;
|
|
710
|
+
}
|
|
711
|
+
const result = closeTaskKernel({
|
|
712
|
+
root,
|
|
713
|
+
taskDir: dir,
|
|
714
|
+
expectedRevision: kernel.revision,
|
|
715
|
+
runId,
|
|
716
|
+
reviewId,
|
|
717
|
+
candidateObservation,
|
|
718
|
+
deliveryEvidence,
|
|
719
|
+
actor: actor(root, args),
|
|
720
|
+
idempotencyKey: option(args, "--idempotency-key") ??
|
|
721
|
+
`task-close:${kernel.identity.taskId}`,
|
|
722
|
+
});
|
|
723
|
+
console.log(`Task closed: ${result.kernel.identity.taskId}\nDelivery level: ${deliveryEvidence.level}\nCandidate freshness: current project state re-observed\nDelivery evidence: machine-observed\nKernel revision: ${result.kernel.revision}`);
|
|
724
|
+
return 0;
|
|
725
|
+
}
|
|
726
|
+
function createLegacyTask(args, root) {
|
|
727
|
+
const title = requireArgument(args[0], "title");
|
|
728
|
+
const slug = option(args, "--slug") ??
|
|
729
|
+
title
|
|
730
|
+
.toLowerCase()
|
|
731
|
+
.replace(/[^a-z0-9]+/g, "-")
|
|
732
|
+
.replace(/^-|-$/g, "");
|
|
733
|
+
if (!/^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(slug))
|
|
734
|
+
throw new Error("slug must contain lowercase letters, digits and hyphens");
|
|
735
|
+
const parentRef = option(args, "--parent");
|
|
736
|
+
if (parentRef) {
|
|
737
|
+
const parent = taskRecord(taskDir(root, parentRef));
|
|
738
|
+
if (parent?.status !== "planning")
|
|
739
|
+
throw new Error("create --parent requires a planning Parent task");
|
|
740
|
+
}
|
|
741
|
+
const developer = readDeveloper(root);
|
|
742
|
+
const assignee = option(args, "--assignee") ?? developer;
|
|
743
|
+
if (!assignee)
|
|
744
|
+
throw new Error("No developer set. Run pactile init --user <name> or pass --assignee");
|
|
745
|
+
const now = new Date();
|
|
746
|
+
const today = localDate(now);
|
|
747
|
+
const prefix = today.slice(5);
|
|
748
|
+
const dirName = `${prefix}-${slug}`;
|
|
749
|
+
const tasks = path.join(root, ".pactile", "tasks");
|
|
750
|
+
const dir = path.join(tasks, dirName);
|
|
751
|
+
if (fs.existsSync(path.join(dir, "task.json")))
|
|
752
|
+
throw new Error(`Task already exists: ${dirName}`);
|
|
753
|
+
const archive = path.join(tasks, "archive");
|
|
754
|
+
if (fs.existsSync(archive) &&
|
|
755
|
+
fs
|
|
756
|
+
.readdirSync(archive, { withFileTypes: true })
|
|
757
|
+
.some((month) => month.isDirectory() &&
|
|
758
|
+
fs.existsSync(path.join(archive, month.name, dirName)))) {
|
|
759
|
+
throw new Error(`Task already archived: ${dirName}`);
|
|
760
|
+
}
|
|
761
|
+
const taskLocale = locale(root);
|
|
762
|
+
const templatePath = path.join(tasks, "locale", taskLocale, "default-prd.md");
|
|
763
|
+
const prdTemplate = fs.existsSync(templatePath)
|
|
764
|
+
? fs.readFileSync(templatePath, "utf8")
|
|
765
|
+
: getAllTaskTemplates().get(`tasks/locale/${taskLocale}/default-prd.md`);
|
|
766
|
+
if (!prdTemplate)
|
|
767
|
+
throw new Error(`Task PRD template not found for locale ${taskLocale}`);
|
|
768
|
+
const contextSeeds = fs.existsSync(path.join(root, ".codex"))
|
|
769
|
+
? [
|
|
770
|
+
".pactile/spec/guides/index.md",
|
|
771
|
+
".pactile/framework/verification-strength-guide.md",
|
|
772
|
+
".pactile/framework/injection-budget-guide.md",
|
|
773
|
+
].filter((entry) => fs.existsSync(path.join(root, entry)))
|
|
774
|
+
: [];
|
|
775
|
+
if (fs.existsSync(path.join(root, ".codex")) && contextSeeds.length < 2) {
|
|
776
|
+
throw new Error("task create requires at least two existing spec guide paths for JSONL seed");
|
|
777
|
+
}
|
|
778
|
+
let baseBranch = "main";
|
|
779
|
+
try {
|
|
780
|
+
baseBranch =
|
|
781
|
+
execFileSync("git", ["branch", "--show-current"], {
|
|
782
|
+
cwd: root,
|
|
783
|
+
encoding: "utf8",
|
|
784
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
785
|
+
}).trim() || "main";
|
|
786
|
+
}
|
|
787
|
+
catch {
|
|
788
|
+
/* A non-Git project still has a valid default base branch. */
|
|
789
|
+
}
|
|
790
|
+
const description = option(args, "--description") ?? "";
|
|
791
|
+
const record = emptyTaskRecord({
|
|
792
|
+
id: slug,
|
|
793
|
+
name: slug,
|
|
794
|
+
title,
|
|
795
|
+
description,
|
|
796
|
+
priority: option(args, "--priority") ?? "P2",
|
|
797
|
+
package: option(args, "--package") ?? null,
|
|
798
|
+
creator: developer ?? assignee,
|
|
799
|
+
assignee,
|
|
800
|
+
createdAt: today,
|
|
801
|
+
base_branch: baseBranch,
|
|
802
|
+
});
|
|
803
|
+
const rigor = option(args, "--rigor") ?? "lite";
|
|
804
|
+
if (rigor !== "lite" && rigor !== "full")
|
|
805
|
+
throw new Error("--rigor must be lite or full");
|
|
806
|
+
const artifacts = new Map([
|
|
807
|
+
[
|
|
808
|
+
"prd.md",
|
|
809
|
+
prdTemplate
|
|
810
|
+
.replaceAll("{title}", title)
|
|
811
|
+
.replaceAll("{goal}", description || (taskLocale === "zh" ? "待补充。" : "TBD.")),
|
|
812
|
+
],
|
|
813
|
+
["verify.md", verifySeed(taskLocale)],
|
|
814
|
+
]);
|
|
815
|
+
if (fs.existsSync(path.join(root, ".codex"))) {
|
|
816
|
+
for (const name of CONTEXT_FILES) {
|
|
817
|
+
artifacts.set(name, `${contextSeeds.map((entry) => JSON.stringify({ file: entry, reason: "default spec seed — curate entries for this task" })).join("\n")}\n`);
|
|
818
|
+
}
|
|
819
|
+
}
|
|
820
|
+
createTaskWithArtifacts({
|
|
821
|
+
root,
|
|
822
|
+
dirName,
|
|
823
|
+
record,
|
|
824
|
+
artifacts,
|
|
825
|
+
actor: "pactile task create",
|
|
826
|
+
idempotencyKey: `create:${slug}`,
|
|
827
|
+
evidence: "pactile task create",
|
|
828
|
+
ifExists: "error",
|
|
829
|
+
extras: { required_controls: resolveRequiredControls({ rigor }) },
|
|
830
|
+
});
|
|
831
|
+
if (parentRef)
|
|
832
|
+
linkChild(root, parentRef, dirName);
|
|
833
|
+
runTaskHooks(root, "after_create", path.join(dir, "task.json"));
|
|
834
|
+
console.log(path.relative(root, dir).replaceAll("\\", "/"));
|
|
835
|
+
}
|
|
836
|
+
function linkChild(root, parentRef, childRef) {
|
|
837
|
+
const parentDir = taskDir(root, parentRef);
|
|
838
|
+
const childDir = taskDir(root, childRef);
|
|
839
|
+
if (parentDir === childDir)
|
|
840
|
+
throw new Error("a task cannot be its own parent");
|
|
841
|
+
const parent = taskRecord(parentDir);
|
|
842
|
+
const child = taskRecord(childDir);
|
|
843
|
+
if (!parent || !child)
|
|
844
|
+
throw new Error("parent and child need task.json");
|
|
845
|
+
if (child.parent && child.parent !== path.basename(parentDir))
|
|
846
|
+
throw new Error(`single-parent tree: child already belongs to ${child.parent}`);
|
|
847
|
+
if (parent.parent === path.basename(childDir) ||
|
|
848
|
+
child.children.includes(path.basename(parentDir)))
|
|
849
|
+
throw new Error("parent-child cycle rejected");
|
|
850
|
+
if (parent.status !== "planning" || child.status !== "planning")
|
|
851
|
+
throw new Error("link children while both tasks are planning");
|
|
852
|
+
if (parent.children.includes(path.basename(childDir)) &&
|
|
853
|
+
child.parent === path.basename(parentDir))
|
|
854
|
+
return;
|
|
855
|
+
const nextChildren = [
|
|
856
|
+
...new Set([...parent.children, path.basename(childDir)]),
|
|
857
|
+
];
|
|
858
|
+
patchTask(root, path.basename(parentDir), { children: nextChildren }, "add-subtask");
|
|
859
|
+
try {
|
|
860
|
+
patchTask(root, path.basename(childDir), { parent: path.basename(parentDir) }, "add-subtask");
|
|
861
|
+
}
|
|
862
|
+
catch (error) {
|
|
863
|
+
patchTask(root, path.basename(parentDir), { children: parent.children }, "add-subtask-rollback", {
|
|
864
|
+
topology: {
|
|
865
|
+
...readTopology(readKernel({ taskDir: parentDir, cwd: root }).kernel.projection
|
|
866
|
+
?.extras ?? {}),
|
|
867
|
+
children: parent.children,
|
|
868
|
+
},
|
|
869
|
+
});
|
|
870
|
+
throw error;
|
|
871
|
+
}
|
|
872
|
+
const nextParent = taskRecord(parentDir);
|
|
873
|
+
if (!nextParent)
|
|
874
|
+
throw new Error("parent projection vanished after link");
|
|
875
|
+
ensureTaskMap(parentDir, nextParent, `Linked Child ${path.basename(childDir)}.`);
|
|
876
|
+
}
|
|
877
|
+
function unlinkChild(root, parentRef, childRef) {
|
|
878
|
+
const parentDir = taskDir(root, parentRef);
|
|
879
|
+
const childDir = taskDir(root, childRef);
|
|
880
|
+
const parent = taskRecord(parentDir);
|
|
881
|
+
const child = taskRecord(childDir);
|
|
882
|
+
if (!parent || !child)
|
|
883
|
+
throw new Error("parent and child need task.json");
|
|
884
|
+
if (!parent.children.includes(path.basename(childDir)) ||
|
|
885
|
+
child.parent !== path.basename(parentDir))
|
|
886
|
+
throw new Error("parent-child link not found");
|
|
887
|
+
const map = readTaskMap(parentDir).data;
|
|
888
|
+
const entry = map?.children.find((item) => item.id === path.basename(childDir));
|
|
889
|
+
if (parent.status !== "planning" ||
|
|
890
|
+
child.status !== "planning" ||
|
|
891
|
+
(entry && entry.state !== "open"))
|
|
892
|
+
throw new Error("unlink only an open Child while both tasks are planning");
|
|
893
|
+
const nextChildren = parent.children.filter((id) => id !== path.basename(childDir));
|
|
894
|
+
const parentTopology = readTopology(readKernel({ taskDir: parentDir, cwd: root }).kernel.projection?.extras ??
|
|
895
|
+
{});
|
|
896
|
+
const childTopology = readTopology(readKernel({ taskDir: childDir, cwd: root }).kernel.projection?.extras ??
|
|
897
|
+
{});
|
|
898
|
+
patchTask(root, path.basename(childDir), { parent: null }, "remove-subtask", {
|
|
899
|
+
topology: { ...childTopology, parent_id: null },
|
|
900
|
+
});
|
|
901
|
+
patchTask(root, path.basename(parentDir), { children: nextChildren }, "remove-subtask", { topology: { ...parentTopology, children: nextChildren } });
|
|
902
|
+
const nextParent = taskRecord(parentDir);
|
|
903
|
+
if (nextParent)
|
|
904
|
+
ensureTaskMap(parentDir, nextParent, `Unlinked Child ${path.basename(childDir)}.`);
|
|
905
|
+
}
|
|
906
|
+
function prepareChildWorktree(root, args) {
|
|
907
|
+
const parentDir = taskDir(root, requireArgument(args[0], "parent task"));
|
|
908
|
+
const childDir = taskDir(root, requireArgument(args[1], "child task"));
|
|
909
|
+
const branch = requireArgument(option(args, "--branch"), "--branch");
|
|
910
|
+
const parent = taskRecord(parentDir);
|
|
911
|
+
const child = taskRecord(childDir);
|
|
912
|
+
if (!parent || !child)
|
|
913
|
+
throw new Error("Parent and Child need task.json");
|
|
914
|
+
if (child.parent !== path.basename(parentDir) ||
|
|
915
|
+
!parent.children.includes(path.basename(childDir)))
|
|
916
|
+
throw new Error("Child must be linked to the Parent");
|
|
917
|
+
const map = readTaskMap(parentDir);
|
|
918
|
+
if (!map.data?.children.some((entry) => entry.id === path.basename(childDir)))
|
|
919
|
+
throw new Error("Child missing from Parent task-map.md");
|
|
920
|
+
const base = option(args, "--base") ?? child.base_branch ?? parent.base_branch ?? "HEAD";
|
|
921
|
+
const worktreeRoot = path.resolve(root, ".pactile", "worktrees");
|
|
922
|
+
const destination = path.resolve(root, option(args, "--path") ?? path.join(worktreeRoot, path.basename(childDir)));
|
|
923
|
+
const relative = path.relative(worktreeRoot, destination);
|
|
924
|
+
const errors = [];
|
|
925
|
+
if (!relative ||
|
|
926
|
+
relative === ".." ||
|
|
927
|
+
relative.startsWith(`..${path.sep}`) ||
|
|
928
|
+
path.isAbsolute(relative))
|
|
929
|
+
errors.push("worktree path must stay under .pactile/worktrees");
|
|
930
|
+
if (fs
|
|
931
|
+
.lstatSync(path.join(root, ".pactile"), { throwIfNoEntry: false })
|
|
932
|
+
?.isSymbolicLink())
|
|
933
|
+
errors.push(".pactile must not be a symlink");
|
|
934
|
+
if (fs.lstatSync(worktreeRoot, { throwIfNoEntry: false })?.isSymbolicLink())
|
|
935
|
+
errors.push(".pactile/worktrees must not be a symlink");
|
|
936
|
+
let ancestor = worktreeRoot;
|
|
937
|
+
for (const segment of relative.split(path.sep).slice(0, -1)) {
|
|
938
|
+
ancestor = path.join(ancestor, segment);
|
|
939
|
+
if (fs.lstatSync(ancestor, { throwIfNoEntry: false })?.isSymbolicLink())
|
|
940
|
+
errors.push(`worktree path crosses a symlink: ${ancestor}`);
|
|
941
|
+
}
|
|
942
|
+
if (fs.existsSync(destination))
|
|
943
|
+
errors.push(`worktree path already exists: ${destination}`);
|
|
944
|
+
if (branch.startsWith("-") || /[\r\n]/.test(branch))
|
|
945
|
+
errors.push("invalid branch name");
|
|
946
|
+
if (typeof base !== "string" || base.startsWith("-") || /[\r\n]/.test(base))
|
|
947
|
+
errors.push("invalid base ref");
|
|
948
|
+
const git = (...gitArgs) => execFileSync("git", gitArgs, {
|
|
949
|
+
cwd: root,
|
|
950
|
+
encoding: "utf8",
|
|
951
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
952
|
+
}).trim();
|
|
953
|
+
try {
|
|
954
|
+
if (!sameGitRoot(git("rev-parse", "--show-toplevel"), root))
|
|
955
|
+
errors.push("prepare-child-worktree requires the project Git root");
|
|
956
|
+
git("check-ref-format", "--branch", branch);
|
|
957
|
+
if (typeof base === "string" && !base.startsWith("-"))
|
|
958
|
+
git("rev-parse", "--verify", `${base}^{commit}`);
|
|
959
|
+
}
|
|
960
|
+
catch {
|
|
961
|
+
errors.push("Git repository, branch, or base ref validation failed");
|
|
962
|
+
}
|
|
963
|
+
if (errors.length) {
|
|
964
|
+
console.error(errors.map((error) => ` - ${error}`).join("\n"));
|
|
965
|
+
return 1;
|
|
966
|
+
}
|
|
967
|
+
const worktreePath = path.relative(root, destination).replaceAll("\\", "/");
|
|
968
|
+
if (args.includes("--check")) {
|
|
969
|
+
console.log(`Prepare-child-worktree check: PASS\nBranch: ${branch}\nBase: ${base}\nPath: ${worktreePath}\nNo files changed.`);
|
|
970
|
+
return 0;
|
|
971
|
+
}
|
|
972
|
+
fs.mkdirSync(path.dirname(destination), { recursive: true });
|
|
973
|
+
let branchExists = false;
|
|
974
|
+
try {
|
|
975
|
+
git("rev-parse", "--verify", `refs/heads/${branch}`);
|
|
976
|
+
branchExists = true;
|
|
977
|
+
}
|
|
978
|
+
catch {
|
|
979
|
+
/* New local branch. */
|
|
980
|
+
}
|
|
981
|
+
try {
|
|
982
|
+
git("worktree", "add", ...(branchExists ? [] : ["-b", branch]), destination, ...(branchExists ? [branch] : [base]));
|
|
983
|
+
}
|
|
984
|
+
catch (error) {
|
|
985
|
+
console.error(`git worktree add failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
986
|
+
return 1;
|
|
987
|
+
}
|
|
988
|
+
patchTask(root, path.basename(childDir), { branch, worktree_path: worktreePath }, "prepare-child-worktree");
|
|
989
|
+
const entry = map.data?.children.find((item) => item.id === path.basename(childDir));
|
|
990
|
+
if (!map.data || !entry)
|
|
991
|
+
throw new Error("Child vanished from Parent task-map.md after worktree creation");
|
|
992
|
+
Object.assign(entry, {
|
|
993
|
+
isolation: "git-worktree",
|
|
994
|
+
branch,
|
|
995
|
+
worktree_path: worktreePath,
|
|
996
|
+
base_ref: base,
|
|
997
|
+
ref: `refs/heads/${branch}`,
|
|
998
|
+
});
|
|
999
|
+
writeTaskMap(parentDir, map.data, map.body, `Prepared Child ${entry.id} git worktree at ${worktreePath} from ${base}.`);
|
|
1000
|
+
console.log(`Child worktree prepared: ${entry.id}\nBranch: ${branch}\nPath: ${worktreePath}`);
|
|
1001
|
+
return 0;
|
|
1002
|
+
}
|
|
1003
|
+
function updateChildState(root, args, integrated) {
|
|
1004
|
+
const parentDir = taskDir(root, requireArgument(args[0], "parent task"));
|
|
1005
|
+
const childDir = taskDir(root, requireArgument(args[1], "child task"));
|
|
1006
|
+
const state = requireArgument(args[2], "state");
|
|
1007
|
+
if (!CHILD_STATES.includes(state))
|
|
1008
|
+
throw new Error(`unknown child state: ${state}`);
|
|
1009
|
+
if (integrated !==
|
|
1010
|
+
["changes", "accepted", "integrating", "integrated", "cancelled"].includes(state))
|
|
1011
|
+
throw new Error(integrated
|
|
1012
|
+
? "use a Parent-controlled integration state"
|
|
1013
|
+
: "use integrate-child for Parent-controlled states");
|
|
1014
|
+
const parent = taskRecord(parentDir);
|
|
1015
|
+
const child = taskRecord(childDir);
|
|
1016
|
+
if (!parent || !child)
|
|
1017
|
+
throw new Error("parent and child need task.json");
|
|
1018
|
+
if (child.parent !== path.basename(parentDir))
|
|
1019
|
+
throw new Error("child is not linked to parent");
|
|
1020
|
+
const evidence = requireArgument(option(args, "--evidence"), "--evidence");
|
|
1021
|
+
const ref = option(args, "--ref");
|
|
1022
|
+
const reason = option(args, "--reason");
|
|
1023
|
+
const errors = childStateErrors(parentDir, parent, childDir, state, evidence, { ref, reason });
|
|
1024
|
+
if (integrated && ["accepted", "integrating", "integrated"].includes(state)) {
|
|
1025
|
+
const extras = readKernel({ taskDir: childDir, cwd: root }).kernel.projection?.extras ??
|
|
1026
|
+
{};
|
|
1027
|
+
if (extras.required_controls
|
|
1028
|
+
?.rigor === "full") {
|
|
1029
|
+
const parsed = readStrategyContract(childDir);
|
|
1030
|
+
errors.push(...parsed.errors);
|
|
1031
|
+
if (parsed.contract)
|
|
1032
|
+
errors.push(...currentGateErrors(childDir, child, "child-review", requiredGates("child-review", parsed.contract), parsed.contract, readKernel({ taskDir: childDir, cwd: root }).kernel
|
|
1033
|
+
.gates));
|
|
1034
|
+
try {
|
|
1035
|
+
assertFullQualityForPhase(childDir, extras, "archive");
|
|
1036
|
+
}
|
|
1037
|
+
catch (error) {
|
|
1038
|
+
errors.push(error instanceof Error ? error.message : String(error));
|
|
1039
|
+
}
|
|
1040
|
+
}
|
|
1041
|
+
}
|
|
1042
|
+
const executeMerge = args.includes("--execute-merge");
|
|
1043
|
+
if (executeMerge) {
|
|
1044
|
+
if (!integrated || state !== "integrated")
|
|
1045
|
+
errors.push("--execute-merge is only valid with integrate-child ... integrated");
|
|
1046
|
+
if (!ref || ref.startsWith("-") || /[\r\n]/.test(ref))
|
|
1047
|
+
errors.push("--execute-merge requires a valid --ref");
|
|
1048
|
+
const git = (...gitArgs) => execFileSync("git", gitArgs, {
|
|
1049
|
+
cwd: root,
|
|
1050
|
+
encoding: "utf8",
|
|
1051
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
1052
|
+
}).trim();
|
|
1053
|
+
try {
|
|
1054
|
+
if (!sameGitRoot(git("rev-parse", "--show-toplevel"), root))
|
|
1055
|
+
errors.push("merge execution requires the project Git root");
|
|
1056
|
+
if (ref)
|
|
1057
|
+
git("rev-parse", "--verify", `${ref}^{commit}`);
|
|
1058
|
+
}
|
|
1059
|
+
catch {
|
|
1060
|
+
errors.push(`merge ref does not resolve to a commit: ${ref ?? "(missing)"}`);
|
|
1061
|
+
}
|
|
1062
|
+
try {
|
|
1063
|
+
const dirty = git("status", "--porcelain", "--untracked-files=all")
|
|
1064
|
+
.split(/\r?\n/)
|
|
1065
|
+
.filter(Boolean)
|
|
1066
|
+
.map((line) => line.slice(3).trim().replaceAll("\\", "/").replace(/^"|"$/g, ""))
|
|
1067
|
+
.filter((file) => file !== ".pactile" && !file.startsWith(".pactile/"));
|
|
1068
|
+
if (dirty.length)
|
|
1069
|
+
errors.push(`non-Pactile working tree changes block merge execution: ${dirty.slice(0, 8).join(", ")}`);
|
|
1070
|
+
}
|
|
1071
|
+
catch {
|
|
1072
|
+
errors.push("git status failed during merge preflight");
|
|
1073
|
+
}
|
|
1074
|
+
}
|
|
1075
|
+
if (errors.length) {
|
|
1076
|
+
console.error(errors.map((error) => ` - ${error}`).join("\n"));
|
|
1077
|
+
return 1;
|
|
1078
|
+
}
|
|
1079
|
+
if (args.includes("--check")) {
|
|
1080
|
+
console.log(`Child state check: PASS (${state})`);
|
|
1081
|
+
return 0;
|
|
1082
|
+
}
|
|
1083
|
+
if (executeMerge) {
|
|
1084
|
+
try {
|
|
1085
|
+
execFileSync("git", ["merge", "--no-ff", "--no-commit", ref], {
|
|
1086
|
+
cwd: root,
|
|
1087
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
1088
|
+
});
|
|
1089
|
+
}
|
|
1090
|
+
catch (error) {
|
|
1091
|
+
console.error(`git merge failed; Parent task-map was not advanced to integrated: ${error instanceof Error ? error.message : String(error)}`);
|
|
1092
|
+
return 1;
|
|
1093
|
+
}
|
|
1094
|
+
}
|
|
1095
|
+
const { data, body } = readTaskMap(parentDir);
|
|
1096
|
+
if (!data)
|
|
1097
|
+
throw new Error("task-map.md missing");
|
|
1098
|
+
const entry = data.children.find((item) => item.id === path.basename(childDir));
|
|
1099
|
+
if (!entry)
|
|
1100
|
+
throw new Error("child missing from task-map.md");
|
|
1101
|
+
entry.state = state;
|
|
1102
|
+
entry.evidence = evidence;
|
|
1103
|
+
if (ref)
|
|
1104
|
+
entry.ref = ref;
|
|
1105
|
+
if (reason)
|
|
1106
|
+
entry.reason = reason;
|
|
1107
|
+
if (state === "integrating" && !data.integration_queue.includes(entry.id))
|
|
1108
|
+
data.integration_queue.push(entry.id);
|
|
1109
|
+
else if (state !== "integrating")
|
|
1110
|
+
data.integration_queue = data.integration_queue.filter((id) => id !== entry.id);
|
|
1111
|
+
const previous = readKernel({ taskDir: parentDir, cwd: root }).kernel.projection?.extras ??
|
|
1112
|
+
{};
|
|
1113
|
+
const states = previous.task_map_states && typeof previous.task_map_states === "object"
|
|
1114
|
+
? previous.task_map_states
|
|
1115
|
+
: {};
|
|
1116
|
+
patchTask(root, path.basename(parentDir), {}, integrated ? "integrate-child" : "set-child-state", {
|
|
1117
|
+
task_map_states: { ...states, [entry.id]: state },
|
|
1118
|
+
...(integrated
|
|
1119
|
+
? { integration_action: "integrate-child", integration_actor: "parent" }
|
|
1120
|
+
: {}),
|
|
1121
|
+
});
|
|
1122
|
+
writeTaskMap(parentDir, data, body, `${integrated ? "Parent integrated" : "Child reported"} ${entry.id} as ${state}. Evidence: ${evidence}.`);
|
|
1123
|
+
console.log(`${entry.id}: ${state}`);
|
|
1124
|
+
return 0;
|
|
1125
|
+
}
|
|
1126
|
+
function reviewChild(root, args) {
|
|
1127
|
+
const parentDir = taskDir(root, requireArgument(args[0], "parent task"));
|
|
1128
|
+
const childDir = taskDir(root, requireArgument(args[1], "child task"));
|
|
1129
|
+
const parent = taskRecord(parentDir);
|
|
1130
|
+
const child = taskRecord(childDir);
|
|
1131
|
+
if (child?.parent !== path.basename(parentDir) ||
|
|
1132
|
+
!parent?.children.includes(path.basename(childDir)))
|
|
1133
|
+
throw new Error("linked Parent and Child task.json are required");
|
|
1134
|
+
const map = readTaskMap(parentDir).data;
|
|
1135
|
+
const entry = map?.children.find((item) => item.id === path.basename(childDir));
|
|
1136
|
+
if (!entry)
|
|
1137
|
+
throw new Error("Child missing from Parent task-map.md");
|
|
1138
|
+
const decision = option(args, "--decision");
|
|
1139
|
+
if (decision &&
|
|
1140
|
+
!["accept", "changes", "cancel", "integrate-through"].includes(decision))
|
|
1141
|
+
throw new Error("--decision must be accept, changes, cancel, or integrate-through");
|
|
1142
|
+
const check = args.includes("--check") || !decision;
|
|
1143
|
+
const ref = option(args, "--ref");
|
|
1144
|
+
const reason = option(args, "--reason");
|
|
1145
|
+
const notes = option(args, "--notes");
|
|
1146
|
+
const verifyFile = path.join(childDir, "verify.md");
|
|
1147
|
+
const handoffFile = path.join(childDir, "handoff.md");
|
|
1148
|
+
const verify = fs.existsSync(verifyFile)
|
|
1149
|
+
? fs.readFileSync(verifyFile, "utf8")
|
|
1150
|
+
: "";
|
|
1151
|
+
const handoff = fs.existsSync(handoffFile)
|
|
1152
|
+
? fs.readFileSync(handoffFile, "utf8")
|
|
1153
|
+
: "";
|
|
1154
|
+
const excerpt = (content) => content
|
|
1155
|
+
.slice(0, 800)
|
|
1156
|
+
.trim()
|
|
1157
|
+
.split(/\r?\n/)
|
|
1158
|
+
.map((line) => `> ${line}`)
|
|
1159
|
+
.join("\n") || "> (empty)";
|
|
1160
|
+
const report = [
|
|
1161
|
+
`# Parent review — \`${path.basename(childDir)}\``,
|
|
1162
|
+
"",
|
|
1163
|
+
`- Timestamp: ${new Date().toISOString()}`,
|
|
1164
|
+
`- Current integration state: \`${entry.state}\``,
|
|
1165
|
+
`- Decision: \`${check ? "check-only" : decision}\``,
|
|
1166
|
+
"",
|
|
1167
|
+
"## Handoff artifacts",
|
|
1168
|
+
"",
|
|
1169
|
+
`- verify.md: ${verify.trim() ? "present" : "missing"}`,
|
|
1170
|
+
`- handoff.md: ${handoff.trim() ? "present" : "missing"}`,
|
|
1171
|
+
`- validation signal: ${/^\s*(?:[-*]\s*)?validation(?:\s+(?:commands?|results?|evidence))?\s*:\s*\S.{2,}$/im.test(verify)}`,
|
|
1172
|
+
`- acceptance signal: ${/^\s*(?:[-*]\s*)?(?:(?:final|user)\s+)?acceptance(?:\s+evidence)?\s*:\s*\S.{2,}$/im.test(verify)}`,
|
|
1173
|
+
`- durable learning decision signal: ${/durable learning decision\s*:/i.test(verify)}`,
|
|
1174
|
+
"",
|
|
1175
|
+
...(notes ? ["## Parent notes", "", excerpt(notes), ""] : []),
|
|
1176
|
+
"## verify.md excerpt",
|
|
1177
|
+
"",
|
|
1178
|
+
excerpt(verify),
|
|
1179
|
+
"",
|
|
1180
|
+
"## handoff.md excerpt",
|
|
1181
|
+
"",
|
|
1182
|
+
excerpt(handoff),
|
|
1183
|
+
"",
|
|
1184
|
+
].join("\n");
|
|
1185
|
+
if (check) {
|
|
1186
|
+
const errors = [
|
|
1187
|
+
...(entry.state !== "review"
|
|
1188
|
+
? [`Child must be in review state, got ${entry.state}`]
|
|
1189
|
+
: []),
|
|
1190
|
+
...(!verify.trim() ? ["verify.md missing"] : []),
|
|
1191
|
+
...(!handoff.trim() ? ["handoff.md missing"] : []),
|
|
1192
|
+
];
|
|
1193
|
+
console.log(`Review-child check: ${errors.length ? "FAIL" : "PASS"}\n${errors.map((error) => ` - ${error}`).join("\n")}\n\n${report}`);
|
|
1194
|
+
return errors.length ? 1 : 0;
|
|
1195
|
+
}
|
|
1196
|
+
const state = decision === "accept" || decision === "integrate-through"
|
|
1197
|
+
? "accepted"
|
|
1198
|
+
: decision === "changes"
|
|
1199
|
+
? "changes"
|
|
1200
|
+
: "cancelled";
|
|
1201
|
+
const transition = (target, evidence) => updateChildState(root, [
|
|
1202
|
+
path.basename(parentDir),
|
|
1203
|
+
path.basename(childDir),
|
|
1204
|
+
target,
|
|
1205
|
+
"--evidence",
|
|
1206
|
+
evidence,
|
|
1207
|
+
...(ref ? ["--ref", ref] : []),
|
|
1208
|
+
...(reason ? ["--reason", reason] : []),
|
|
1209
|
+
], true);
|
|
1210
|
+
// Validate the first transition before writing any review artifact or Parent evidence.
|
|
1211
|
+
const firstCheck = updateChildState(root, [
|
|
1212
|
+
path.basename(parentDir),
|
|
1213
|
+
path.basename(childDir),
|
|
1214
|
+
state,
|
|
1215
|
+
"--evidence",
|
|
1216
|
+
"handoff.md",
|
|
1217
|
+
...(ref ? ["--ref", ref] : []),
|
|
1218
|
+
...(reason ? ["--reason", reason] : []),
|
|
1219
|
+
"--check",
|
|
1220
|
+
], true);
|
|
1221
|
+
if (firstCheck !== 0)
|
|
1222
|
+
return firstCheck;
|
|
1223
|
+
if (transition(state, "handoff.md") !== 0)
|
|
1224
|
+
return 1;
|
|
1225
|
+
if (decision === "integrate-through") {
|
|
1226
|
+
if (transition("integrating", "task-map.md") !== 0 ||
|
|
1227
|
+
transition("integrated", "task-map.md") !== 0)
|
|
1228
|
+
return 1;
|
|
1229
|
+
}
|
|
1230
|
+
const reviewFile = path.join(parentDir, `review-${path.basename(childDir)}.md`);
|
|
1231
|
+
if (args.includes("--write-artifact"))
|
|
1232
|
+
fs.writeFileSync(reviewFile, `${report}\n`, "utf8");
|
|
1233
|
+
if (!args.includes("--no-append-parent-verify")) {
|
|
1234
|
+
const parentVerify = path.join(parentDir, "verify.md");
|
|
1235
|
+
const current = fs.existsSync(parentVerify)
|
|
1236
|
+
? fs.readFileSync(parentVerify, "utf8")
|
|
1237
|
+
: "# Verification Evidence\n";
|
|
1238
|
+
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`;
|
|
1239
|
+
fs.writeFileSync(parentVerify, `${current.trimEnd()}\n\n${note}`, "utf8");
|
|
1240
|
+
}
|
|
1241
|
+
console.log(report);
|
|
1242
|
+
return 0;
|
|
1243
|
+
}
|
|
1244
|
+
function showTask(root, args) {
|
|
1245
|
+
const reference = requireArgument(args[0], "task");
|
|
1246
|
+
const dir = taskDir(root, reference);
|
|
1247
|
+
const migration = readLegacyTaskImportRecord(root, dir);
|
|
1248
|
+
if (migration && migration.status !== "imported") {
|
|
1249
|
+
const status = migration.status;
|
|
1250
|
+
const details = {
|
|
1251
|
+
status,
|
|
1252
|
+
taskId: migration.legacyTaskId,
|
|
1253
|
+
missingDefinitionFields: migration.missingDefinitionFields,
|
|
1254
|
+
coordinationReasons: migration.coordinationReasons,
|
|
1255
|
+
hardDependencies: migration.dependencyFacts.hardDependencies,
|
|
1256
|
+
sourceFingerprint: migration.sourceFingerprint,
|
|
1257
|
+
};
|
|
1258
|
+
if (args.includes("--json"))
|
|
1259
|
+
console.log(JSON.stringify(details, null, 2));
|
|
1260
|
+
else
|
|
1261
|
+
console.log([
|
|
1262
|
+
`${migration.legacyTaskId} (legacy migration: ${status})`,
|
|
1263
|
+
migration.missingDefinitionFields.length
|
|
1264
|
+
? `Definition fields to supply: ${migration.missingDefinitionFields.join(", ")}`
|
|
1265
|
+
: null,
|
|
1266
|
+
migration.coordinationReasons.length
|
|
1267
|
+
? `Dependency coordination: ${migration.coordinationReasons.join(", ")}`
|
|
1268
|
+
: null,
|
|
1269
|
+
"No runnable V2 Task Kernel was created; original Task, Kernel, and documents remain preserved.",
|
|
1270
|
+
]
|
|
1271
|
+
.filter((line) => line !== null)
|
|
1272
|
+
.join("\n"));
|
|
1273
|
+
return 0;
|
|
1274
|
+
}
|
|
1275
|
+
if (!fs.existsSync(path.join(dir, "kernel.json")) && !migration) {
|
|
1276
|
+
const record = taskRecord(dir);
|
|
1277
|
+
if (!record)
|
|
1278
|
+
throw new Error(`No readable legacy task record exists at ${dir}`);
|
|
1279
|
+
console.log(args.includes("--json")
|
|
1280
|
+
? JSON.stringify({ schemaVersion: 0, task: record }, null, 2)
|
|
1281
|
+
: `${record.title || record.name} (${record.id})\nLegacy task.json record without Kernel\nStatus: ${record.status}\nAutomatic migration: reserved for P36.`);
|
|
1282
|
+
return 0;
|
|
1283
|
+
}
|
|
1284
|
+
const read = readTaskKernel({ root, taskDir: dir, cwd: root });
|
|
1285
|
+
if (args.includes("--json")) {
|
|
1286
|
+
console.log(JSON.stringify(read.kind === "task-kernel-v2"
|
|
1287
|
+
? read.kernel
|
|
1288
|
+
: { ...read.kernel, task: taskRecord(dir) }, null, 2));
|
|
1289
|
+
return 0;
|
|
1290
|
+
}
|
|
1291
|
+
if (read.kind === "task-kernel-v2") {
|
|
1292
|
+
const { definition, runs, reviews, phase, condition, revision } = read.kernel;
|
|
1293
|
+
console.log([
|
|
1294
|
+
`${definition.title} (${definition.taskId})`,
|
|
1295
|
+
`Kernel: v2 @ revision ${revision}`,
|
|
1296
|
+
`Phase: ${phase} | condition: ${condition}`,
|
|
1297
|
+
`Deliverable: ${definition.deliverable}`,
|
|
1298
|
+
`Delivery level: ${definition.deliveryLevel}`,
|
|
1299
|
+
`Dependencies: ${definition.dependencies.length ? definition.dependencies.join(", ") : "none"}`,
|
|
1300
|
+
"Acceptance criteria:",
|
|
1301
|
+
...definition.acceptanceCriteria.map((criterion) => ` - ${criterion.id}: ${criterion.description}`),
|
|
1302
|
+
`Runs: ${runs.length} | Reviews: ${reviews.length}`,
|
|
1303
|
+
].join("\n"));
|
|
1304
|
+
return 0;
|
|
1305
|
+
}
|
|
1306
|
+
const record = taskRecord(dir);
|
|
1307
|
+
console.log(`${record?.title ?? record?.id ?? path.basename(dir)} (legacy Kernel v1)\nPhase: ${read.kernel.kernel.phase}\nStatus: ${record?.status ?? "unknown"}\nAutomatic migration: reserved for P36.`);
|
|
1308
|
+
return 0;
|
|
1309
|
+
}
|
|
1310
|
+
function activeV2Tasks(root) {
|
|
1311
|
+
const archivePrefix = `${path.resolve(root, ".pactile", "tasks", "archive")}${path.sep}`.toLowerCase();
|
|
1312
|
+
return listTaskKernelSnapshots(root)
|
|
1313
|
+
.filter(({ taskDir: dir }) => !path.resolve(dir).toLowerCase().startsWith(archivePrefix))
|
|
1314
|
+
.map(({ taskDir: dir, kernel }) => ({ dir: path.basename(dir), kernel }));
|
|
1315
|
+
}
|
|
1316
|
+
function v2DisplayStatus(kernel) {
|
|
1317
|
+
return kernel.phase === "close" ? "closed" : kernel.phase;
|
|
1318
|
+
}
|
|
1319
|
+
function listTasks(args, root) {
|
|
1320
|
+
const developer = readDeveloper(root);
|
|
1321
|
+
const mine = args.includes("--mine") || args.includes("-m");
|
|
1322
|
+
if (mine && !developer)
|
|
1323
|
+
throw new Error("No developer set. Run pactile init --user <name>");
|
|
1324
|
+
const assignee = option(args, "--assignee") ?? (mine ? developer : undefined);
|
|
1325
|
+
const status = option(args, "--status") ?? option(args, "-s");
|
|
1326
|
+
const selected = resolveSelectedTask(root).taskPath;
|
|
1327
|
+
const phaseForStatus = {
|
|
1328
|
+
planning: "define",
|
|
1329
|
+
in_progress: "execute",
|
|
1330
|
+
review: "verify",
|
|
1331
|
+
completed: "close",
|
|
1332
|
+
closed: "close",
|
|
1333
|
+
};
|
|
1334
|
+
const requiredPhase = status ? (phaseForStatus[status] ?? status) : undefined;
|
|
1335
|
+
const migrationRecords = listLegacyTaskImportRecords(root);
|
|
1336
|
+
const restoredSourcePaths = new Set(migrationRecords.flatMap(({ record }) => {
|
|
1337
|
+
if (record.status !== "imported")
|
|
1338
|
+
return [];
|
|
1339
|
+
const taskJsonPath = record.legacySourceMetadata?.fileReferences.taskJson?.path;
|
|
1340
|
+
if (!taskJsonPath?.startsWith(".pactile/tasks/") ||
|
|
1341
|
+
!taskJsonPath.endsWith("/task.json"))
|
|
1342
|
+
return [];
|
|
1343
|
+
const sourceTaskPath = taskJsonPath.slice(0, -"/task.json".length);
|
|
1344
|
+
return sourceTaskPath === record.taskPath
|
|
1345
|
+
? []
|
|
1346
|
+
: [sourceTaskPath.slice(".pactile/tasks/".length)];
|
|
1347
|
+
}));
|
|
1348
|
+
const migrationByDirectory = new Map(migrationRecords.map((item) => [path.resolve(item.taskDir), item.record]));
|
|
1349
|
+
const tasks = activeTasks(root).filter(({ dir, record }) => !migrationByDirectory.has(path.resolve(root, ".pactile", "tasks", dir)) &&
|
|
1350
|
+
(!assignee || record.assignee === assignee) &&
|
|
1351
|
+
(!status || record.status === status));
|
|
1352
|
+
const pendingImports = migrationRecords.filter(({ taskDir, record }) => {
|
|
1353
|
+
if (record.status === "imported" ||
|
|
1354
|
+
record.status === "archived-historical-only" ||
|
|
1355
|
+
restoredSourcePaths.has(path
|
|
1356
|
+
.relative(path.join(root, ".pactile", "tasks"), taskDir)
|
|
1357
|
+
.replaceAll("\\", "/")))
|
|
1358
|
+
return false;
|
|
1359
|
+
const raw = taskRecord(taskDir);
|
|
1360
|
+
return ((!assignee || raw?.assignee === assignee) &&
|
|
1361
|
+
(!status || raw?.status === status));
|
|
1362
|
+
});
|
|
1363
|
+
const v2Tasks = activeV2Tasks(root).filter(({ kernel }) => (!assignee || kernel.definition.createdBy === assignee) &&
|
|
1364
|
+
(!requiredPhase || kernel.phase === requiredPhase));
|
|
1365
|
+
console.log(assignee ? `Tasks (assignee: ${assignee}):` : "All active tasks:");
|
|
1366
|
+
console.log();
|
|
1367
|
+
for (const { dir, record } of tasks) {
|
|
1368
|
+
const marker = `.pactile/tasks/${dir}` === selected ? " <- selected" : "";
|
|
1369
|
+
console.log(` - ${dir}/ (${record.status})${record.package ? ` @${record.package}` : ""} [${record.assignee || "-"}]${marker}`);
|
|
1370
|
+
}
|
|
1371
|
+
for (const { dir, kernel } of v2Tasks) {
|
|
1372
|
+
const marker = `.pactile/tasks/${dir}` === selected ? " <- selected" : "";
|
|
1373
|
+
console.log(` - ${dir}/ (${v2DisplayStatus(kernel)}; Kernel v2) [${kernel.definition.createdBy}]${marker}`);
|
|
1374
|
+
}
|
|
1375
|
+
for (const { taskDir: importedDir, record } of pendingImports) {
|
|
1376
|
+
const dir = path
|
|
1377
|
+
.relative(path.join(root, ".pactile", "tasks"), importedDir)
|
|
1378
|
+
.replaceAll("\\", "/");
|
|
1379
|
+
const marker = `.pactile/tasks/${dir}` === selected ? " <- selected" : "";
|
|
1380
|
+
const detail = record.status === "needs-definition"
|
|
1381
|
+
? `needs definition: ${record.missingDefinitionFields.join(", ")}`
|
|
1382
|
+
: `needs dependency coordination: ${record.coordinationReasons.join(", ")}`;
|
|
1383
|
+
console.log(` - ${dir}/ (${detail}; not runnable)${marker}`);
|
|
1384
|
+
}
|
|
1385
|
+
if (!tasks.length && !v2Tasks.length && !pendingImports.length)
|
|
1386
|
+
console.log(" (no active tasks)");
|
|
1387
|
+
console.log(`\nTotal: ${tasks.length + v2Tasks.length + pendingImports.length} task(s)`);
|
|
1388
|
+
}
|
|
1389
|
+
function listArchive(root, month) {
|
|
1390
|
+
if (month && !/^\d{4}-(?:0[1-9]|1[0-2])$/.test(month))
|
|
1391
|
+
throw new Error("archive month must be YYYY-MM");
|
|
1392
|
+
const archive = path.join(root, ".pactile", "tasks", "archive");
|
|
1393
|
+
console.log("Archived tasks:\n");
|
|
1394
|
+
if (!fs.existsSync(archive))
|
|
1395
|
+
return;
|
|
1396
|
+
const months = month
|
|
1397
|
+
? [month]
|
|
1398
|
+
: fs
|
|
1399
|
+
.readdirSync(archive, { withFileTypes: true })
|
|
1400
|
+
.filter((entry) => entry.isDirectory())
|
|
1401
|
+
.map((entry) => entry.name)
|
|
1402
|
+
.sort();
|
|
1403
|
+
for (const name of months) {
|
|
1404
|
+
const monthDir = path.join(archive, name);
|
|
1405
|
+
if (!fs.statSync(monthDir, { throwIfNoEntry: false })?.isDirectory()) {
|
|
1406
|
+
console.log(` No archives for ${name}`);
|
|
1407
|
+
continue;
|
|
1408
|
+
}
|
|
1409
|
+
const tasks = fs
|
|
1410
|
+
.readdirSync(monthDir, { withFileTypes: true })
|
|
1411
|
+
.filter((entry) => entry.isDirectory())
|
|
1412
|
+
.map((entry) => entry.name)
|
|
1413
|
+
.sort();
|
|
1414
|
+
console.log(`[${name}]${month ? "" : ` - ${tasks.length} task(s)`}`);
|
|
1415
|
+
if (month)
|
|
1416
|
+
for (const task of tasks)
|
|
1417
|
+
console.log(` - ${task}/`);
|
|
1418
|
+
}
|
|
1419
|
+
}
|
|
1420
|
+
function dashboard(root) {
|
|
1421
|
+
const selected = resolveSelectedTask(root);
|
|
1422
|
+
console.log("Task Dashboard\nPactile framework: active");
|
|
1423
|
+
console.log(`Selected task: ${selected.taskPath ?? "none"}${selected.taskPath ? ` (${selected.source})` : ""}\n`);
|
|
1424
|
+
const tasks = activeTasks(root);
|
|
1425
|
+
const v2Tasks = activeV2Tasks(root);
|
|
1426
|
+
if (!tasks.length)
|
|
1427
|
+
console.log("Tasks: none");
|
|
1428
|
+
for (const [status, heading] of [
|
|
1429
|
+
["planning", "Define"],
|
|
1430
|
+
["in_progress", "Execute"],
|
|
1431
|
+
["review", "Verify"],
|
|
1432
|
+
]) {
|
|
1433
|
+
const matching = tasks.filter(({ record }) => record.status === status);
|
|
1434
|
+
if (!matching.length)
|
|
1435
|
+
continue;
|
|
1436
|
+
console.log(`${heading}:`);
|
|
1437
|
+
for (const { dir, record } of matching)
|
|
1438
|
+
console.log(` - .pactile/tasks/${dir} (${heading}) [${record.assignee || "-"}]`);
|
|
1439
|
+
console.log();
|
|
1440
|
+
}
|
|
1441
|
+
if (v2Tasks.length) {
|
|
1442
|
+
console.log("Task Kernel v2:");
|
|
1443
|
+
for (const { dir, kernel } of v2Tasks)
|
|
1444
|
+
console.log(` - .pactile/tasks/${dir} (${v2DisplayStatus(kernel)}) [${kernel.definition.deliveryLevel}]`);
|
|
1445
|
+
console.log();
|
|
1446
|
+
}
|
|
1447
|
+
console.log('Suggested actions:\n - Select a task: pactile task select <task>\n - Create a deliverable Task: pactile task create "<title>" --slug <slug> --deliverable <text> --delivery-level <level> --accept <criterion>\n - Inspect tasks: pactile task list | pactile task show <task>');
|
|
1448
|
+
}
|
|
1449
|
+
function startExecution(root, args) {
|
|
1450
|
+
const dir = taskDir(root, requireArgument(args[0], "task"));
|
|
1451
|
+
const migration = readLegacyTaskImportRecord(root, dir);
|
|
1452
|
+
if (migration) {
|
|
1453
|
+
throw new Error(`Task ${migration.legacyTaskId} has an active V2 migration record (${migration.status}); use the Task Kernel Run command. Legacy --ignore-deps and execution approvals do not carry over.`);
|
|
1454
|
+
}
|
|
1455
|
+
const record = taskRecord(dir);
|
|
1456
|
+
if (!record)
|
|
1457
|
+
throw new Error(`task.json not found at ${dir}`);
|
|
1458
|
+
const check = args.includes("--check");
|
|
1459
|
+
const approved = args.includes("--approved");
|
|
1460
|
+
if (check === approved)
|
|
1461
|
+
throw new Error("choose --check or --approved");
|
|
1462
|
+
const existing = readKernel({ taskDir: dir, cwd: root }).kernel;
|
|
1463
|
+
if (approved &&
|
|
1464
|
+
existing.phase === "execute" &&
|
|
1465
|
+
existing.projection?.status === "in_progress") {
|
|
1466
|
+
approvedExecuteTask(root, path.basename(dir));
|
|
1467
|
+
console.log(`Execution already approved for: ${path.relative(root, dir).replaceAll("\\", "/")}\nStatus: in_progress`);
|
|
1468
|
+
return 0;
|
|
1469
|
+
}
|
|
1470
|
+
const guard = checkStartExecution(root, dir, record, approved, args.includes("--ignore-deps"));
|
|
1471
|
+
for (const warning of guard.warnings)
|
|
1472
|
+
console.error(`[dependencies] WARN: ${warning}`);
|
|
1473
|
+
if (!guard.ok) {
|
|
1474
|
+
console.error(`Start-execution check: FAIL\n${guard.errors.map((error) => ` - ${error}`).join("\n")}`);
|
|
1475
|
+
return 1;
|
|
1476
|
+
}
|
|
1477
|
+
if (check) {
|
|
1478
|
+
console.log(`Start-execution check: PASS\nContract fingerprint: ${guard.contractFingerprint}\nArtifact fingerprint: ${guard.artifactFingerprint}`);
|
|
1479
|
+
console.log("Artifact gates are ready. Ask the user for explicit execution approval before running --approved.");
|
|
1480
|
+
return 0;
|
|
1481
|
+
}
|
|
1482
|
+
const prior = record;
|
|
1483
|
+
const checkedAt = new Date().toISOString().replace(/\.\d{3}Z$/, "Z");
|
|
1484
|
+
const baseline = {
|
|
1485
|
+
schema_version: 1,
|
|
1486
|
+
transition: "start-execution",
|
|
1487
|
+
gate: "baseline-check",
|
|
1488
|
+
result: "PASS",
|
|
1489
|
+
reviewer: "pactile-cli",
|
|
1490
|
+
evidence: "task.json",
|
|
1491
|
+
checked_at: checkedAt,
|
|
1492
|
+
contract_fingerprint: guard.contractFingerprint,
|
|
1493
|
+
artifact_fingerprint: guard.artifactFingerprint,
|
|
1494
|
+
issue_fingerprint: null,
|
|
1495
|
+
consecutive_failures: 0,
|
|
1496
|
+
approved_skip: null,
|
|
1497
|
+
};
|
|
1498
|
+
const existingQgr = prior.quality_gate_results && typeof prior.quality_gate_results === "object"
|
|
1499
|
+
? prior.quality_gate_results
|
|
1500
|
+
: {};
|
|
1501
|
+
const transitions = existingQgr.transitions && typeof existingQgr.transitions === "object"
|
|
1502
|
+
? existingQgr.transitions
|
|
1503
|
+
: {};
|
|
1504
|
+
const qualityGateResults = {
|
|
1505
|
+
...existingQgr,
|
|
1506
|
+
schema_version: 1,
|
|
1507
|
+
contract_fingerprint: guard.contractFingerprint,
|
|
1508
|
+
artifact_fingerprint: guard.artifactFingerprint,
|
|
1509
|
+
transitions: {
|
|
1510
|
+
...transitions,
|
|
1511
|
+
"start-execution": {
|
|
1512
|
+
...(transitions["start-execution"] ?? {}),
|
|
1513
|
+
"baseline-check": baseline,
|
|
1514
|
+
},
|
|
1515
|
+
},
|
|
1516
|
+
};
|
|
1517
|
+
const approval = {
|
|
1518
|
+
schema_version: 1,
|
|
1519
|
+
transition: "start-execution",
|
|
1520
|
+
approved_at: checkedAt,
|
|
1521
|
+
approved_by: "user",
|
|
1522
|
+
task_id: record.id,
|
|
1523
|
+
assurance: "caller-asserted",
|
|
1524
|
+
approval_source: "pactile task start-execution --approved",
|
|
1525
|
+
contract_fingerprint: guard.contractFingerprint,
|
|
1526
|
+
artifact_fingerprint: guard.artifactFingerprint,
|
|
1527
|
+
};
|
|
1528
|
+
const extras = {
|
|
1529
|
+
quality_gate_results: qualityGateResults,
|
|
1530
|
+
execution_approval: approval,
|
|
1531
|
+
};
|
|
1532
|
+
const dependencyFacts = dependencyStatus(root, dir, record);
|
|
1533
|
+
const priorExtras = readKernel({ taskDir: dir, cwd: root }).kernel.projection?.extras ?? {};
|
|
1534
|
+
extras.dependency_satisfied = dependencyFacts.satisfied;
|
|
1535
|
+
if (args.includes("--ignore-deps")) {
|
|
1536
|
+
extras.dependency_override = {
|
|
1537
|
+
schema_version: 1,
|
|
1538
|
+
approved_by: "user",
|
|
1539
|
+
transition: "start-execution",
|
|
1540
|
+
dependencies: unmetRequires(readDependencyGraph(priorExtras), extras.dependency_satisfied, record.id),
|
|
1541
|
+
source: "pactile task start-execution --approved --ignore-deps",
|
|
1542
|
+
at: checkedAt,
|
|
1543
|
+
};
|
|
1544
|
+
}
|
|
1545
|
+
const revision = readKernel({ taskDir: dir, cwd: root }).kernel.revision;
|
|
1546
|
+
applyKernelStart({
|
|
1547
|
+
taskDir: dir,
|
|
1548
|
+
cwd: root,
|
|
1549
|
+
expectedRevision: revision,
|
|
1550
|
+
actor: "pactile task start-execution --approved",
|
|
1551
|
+
idempotencyKey: `start:${record.id || path.basename(dir)}:${checkedAt}`,
|
|
1552
|
+
evidence: "pactile task start-execution --approved",
|
|
1553
|
+
record: { ...record, status: "in_progress" },
|
|
1554
|
+
extras,
|
|
1555
|
+
});
|
|
1556
|
+
runTaskHooks(root, "after_start", path.join(dir, "task.json"));
|
|
1557
|
+
console.log(`Execution approved for: ${path.relative(root, dir).replaceAll("\\", "/")}\nStatus: in_progress`);
|
|
1558
|
+
return 0;
|
|
1559
|
+
}
|
|
1560
|
+
function recordGate(root, args) {
|
|
1561
|
+
const dir = taskDir(root, requireArgument(args[0], "task"));
|
|
1562
|
+
const task = taskRecord(dir);
|
|
1563
|
+
if (!task)
|
|
1564
|
+
throw new Error(`task.json not found at ${dir}`);
|
|
1565
|
+
const transition = requireArgument(option(args, "--transition"), "--transition");
|
|
1566
|
+
const gate = requireArgument(option(args, "--gate"), "--gate");
|
|
1567
|
+
const result = requireArgument(option(args, "--result"), "--result").toUpperCase();
|
|
1568
|
+
const reviewer = requireArgument(option(args, "--reviewer"), "--reviewer");
|
|
1569
|
+
const evidence = requireArgument(option(args, "--evidence"), "--evidence");
|
|
1570
|
+
if (!["PASS", "FAIL", "SKIPPED"].includes(result))
|
|
1571
|
+
throw new Error("--result must be PASS, FAIL, or SKIPPED");
|
|
1572
|
+
const allowed = {
|
|
1573
|
+
"start-execution": ["requirements-review", "architecture-review"],
|
|
1574
|
+
"full-task-complete": [
|
|
1575
|
+
"code-review",
|
|
1576
|
+
"architecture-review",
|
|
1577
|
+
"architecture-deep-review",
|
|
1578
|
+
],
|
|
1579
|
+
"child-review": [
|
|
1580
|
+
"code-review",
|
|
1581
|
+
"architecture-review",
|
|
1582
|
+
"architecture-deep-review",
|
|
1583
|
+
],
|
|
1584
|
+
"parent-integrated": ["integration-review"],
|
|
1585
|
+
};
|
|
1586
|
+
if (!allowed[transition]?.includes(gate))
|
|
1587
|
+
throw new Error(`unsupported transition/gate pair: ${transition}/${gate}`);
|
|
1588
|
+
if (!/^[A-Za-z0-9_.:@/-]+$/.test(reviewer))
|
|
1589
|
+
throw new Error("--reviewer must be a short identifier");
|
|
1590
|
+
if (!evidence.trim() || evidence.length > 240 || /[\r\n]/.test(evidence))
|
|
1591
|
+
throw new Error("--evidence must be a short single-line reference");
|
|
1592
|
+
if (result === "FAIL" &&
|
|
1593
|
+
(!option(args, "--issue-fingerprint") || !option(args, "--root-cause")))
|
|
1594
|
+
throw new Error("FAIL requires --issue-fingerprint and --root-cause");
|
|
1595
|
+
if (result === "FAIL" &&
|
|
1596
|
+
![
|
|
1597
|
+
"implementation-defect",
|
|
1598
|
+
"contract-changing-defect",
|
|
1599
|
+
"validation-environment-blocker",
|
|
1600
|
+
].includes(option(args, "--root-cause") ?? ""))
|
|
1601
|
+
throw new Error("--root-cause is not a known failure route");
|
|
1602
|
+
if (result === "SKIPPED" &&
|
|
1603
|
+
(option(args, "--skip-approved-by") !== "user" ||
|
|
1604
|
+
!option(args, "--skip-reason")))
|
|
1605
|
+
throw new Error("SKIPPED requires --skip-approved-by user and --skip-reason");
|
|
1606
|
+
const parsed = fs.existsSync(path.join(dir, "implement.md"))
|
|
1607
|
+
? readStrategyContract(dir)
|
|
1608
|
+
: { contract: null, errors: [] };
|
|
1609
|
+
if (parsed.errors.length && transition !== "parent-integrated")
|
|
1610
|
+
throw new Error(parsed.errors.join("; "));
|
|
1611
|
+
const currentContract = contractFingerprint(dir, task, parsed.contract);
|
|
1612
|
+
const currentArtifact = artifactFingerprint(dir, task, transition, gate);
|
|
1613
|
+
if (option(args, "--contract-fingerprint") &&
|
|
1614
|
+
option(args, "--contract-fingerprint") !== currentContract)
|
|
1615
|
+
throw new Error("contract fingerprint assertion is stale");
|
|
1616
|
+
if (option(args, "--artifact-fingerprint") &&
|
|
1617
|
+
option(args, "--artifact-fingerprint") !== currentArtifact)
|
|
1618
|
+
throw new Error("artifact fingerprint assertion is stale");
|
|
1619
|
+
const record = {
|
|
1620
|
+
schema_version: 1,
|
|
1621
|
+
transition,
|
|
1622
|
+
gate,
|
|
1623
|
+
result,
|
|
1624
|
+
reviewer,
|
|
1625
|
+
evidence,
|
|
1626
|
+
checked_at: new Date().toISOString(),
|
|
1627
|
+
contract_fingerprint: currentContract,
|
|
1628
|
+
artifact_fingerprint: currentArtifact,
|
|
1629
|
+
issue_fingerprint: result === "FAIL" ? option(args, "--issue-fingerprint") : null,
|
|
1630
|
+
root_cause: result === "FAIL" ? option(args, "--root-cause") : null,
|
|
1631
|
+
issue_summary: result === "FAIL" ? (option(args, "--issue-summary") ?? null) : null,
|
|
1632
|
+
consecutive_failures: result === "FAIL" ? 1 : 0,
|
|
1633
|
+
approved_skip: result === "SKIPPED"
|
|
1634
|
+
? { approved_by: "user", reason: option(args, "--skip-reason") }
|
|
1635
|
+
: null,
|
|
1636
|
+
};
|
|
1637
|
+
const revision = readKernel({ taskDir: dir, cwd: root }).kernel.revision;
|
|
1638
|
+
applyKernelRecordGate({
|
|
1639
|
+
taskDir: dir,
|
|
1640
|
+
cwd: root,
|
|
1641
|
+
expectedRevision: revision,
|
|
1642
|
+
actor: `pactile task record-gate ${reviewer}`,
|
|
1643
|
+
idempotencyKey: `record-gate:${task.id}:${transition}:${gate}:r${revision}`,
|
|
1644
|
+
transition,
|
|
1645
|
+
gateName: gate,
|
|
1646
|
+
record,
|
|
1647
|
+
evidence,
|
|
1648
|
+
});
|
|
1649
|
+
console.log(`${transition}/${gate}: ${result}`);
|
|
1650
|
+
return 0;
|
|
1651
|
+
}
|
|
1652
|
+
function recordAcEvidence(root, args) {
|
|
1653
|
+
const reference = requireArgument(args[0], "task");
|
|
1654
|
+
const dir = taskDir(root, reference);
|
|
1655
|
+
const prd = fs.readFileSync(path.join(dir, "prd.md"), "utf8");
|
|
1656
|
+
const verify = fs.readFileSync(path.join(dir, "verify.md"), "utf8");
|
|
1657
|
+
const mappings = [];
|
|
1658
|
+
for (let index = 1; index < args.length; index += 1) {
|
|
1659
|
+
if (args[index] !== "--map")
|
|
1660
|
+
continue;
|
|
1661
|
+
const assignment = requireArgument(args[index + 1], "--map AC-N=reference");
|
|
1662
|
+
const equal = assignment.indexOf("=");
|
|
1663
|
+
if (equal < 0)
|
|
1664
|
+
throw new Error("--map must be AC-N=reference");
|
|
1665
|
+
mappings.push({
|
|
1666
|
+
ac_id: assignment.slice(0, equal),
|
|
1667
|
+
evidence_ref: assignment.slice(equal + 1),
|
|
1668
|
+
});
|
|
1669
|
+
index += 1;
|
|
1670
|
+
}
|
|
1671
|
+
if (!mappings.length)
|
|
1672
|
+
throw new Error("at least one --map AC-N=reference is required");
|
|
1673
|
+
const codeRef = requireArgument(option(args, "--code-ref"), "--code-ref");
|
|
1674
|
+
const ledger = buildAcEvidenceLedger({
|
|
1675
|
+
acceptanceItems: parseAcceptanceItems(prd),
|
|
1676
|
+
mappings,
|
|
1677
|
+
sourceFingerprint: qualityFingerprint(prd),
|
|
1678
|
+
evidenceFingerprint: qualityFingerprint(verify),
|
|
1679
|
+
testedCodeFingerprint: codeRef,
|
|
1680
|
+
});
|
|
1681
|
+
patchTask(root, reference, {}, "record-ac-evidence", {
|
|
1682
|
+
ac_evidence_ledger: ledger,
|
|
1683
|
+
});
|
|
1684
|
+
console.log(`AC evidence ledger recorded: ${ledger.items.length} mapped criteria`);
|
|
1685
|
+
return 0;
|
|
1686
|
+
}
|
|
1687
|
+
function recordIndependentCheck(root, args) {
|
|
1688
|
+
const reference = requireArgument(args[0], "task");
|
|
1689
|
+
const mode = requireArgument(option(args, "--mode"), "--mode");
|
|
1690
|
+
const result = requireArgument(option(args, "--result"), "--result").toUpperCase();
|
|
1691
|
+
const evidence = requireArgument(option(args, "--evidence"), "--evidence");
|
|
1692
|
+
const codeRef = requireArgument(option(args, "--code-ref"), "--code-ref");
|
|
1693
|
+
if (mode !== "self-review" && mode !== "true-independent")
|
|
1694
|
+
throw new Error("--mode must be self-review or true-independent");
|
|
1695
|
+
if (!["PASS", "FAIL", "BLOCKED"].includes(result))
|
|
1696
|
+
throw new Error("--result must be PASS, FAIL, or BLOCKED");
|
|
1697
|
+
const independentWorker = args.includes("--independent-worker");
|
|
1698
|
+
if (mode === "true-independent" && result === "PASS" && !independentWorker)
|
|
1699
|
+
throw new Error("true-independent PASS requires --independent-worker");
|
|
1700
|
+
const reviewer = option(args, "--reviewer");
|
|
1701
|
+
if (mode === "true-independent" && result === "PASS" && !reviewer)
|
|
1702
|
+
throw new Error("true-independent PASS requires --reviewer");
|
|
1703
|
+
const verdict = {
|
|
1704
|
+
schema_version: 1,
|
|
1705
|
+
mode,
|
|
1706
|
+
readonly: true,
|
|
1707
|
+
result,
|
|
1708
|
+
evidence,
|
|
1709
|
+
independent_worker: independentWorker,
|
|
1710
|
+
reviewer: reviewer ?? null,
|
|
1711
|
+
code_fingerprint: codeRef,
|
|
1712
|
+
checked_at: new Date().toISOString(),
|
|
1713
|
+
};
|
|
1714
|
+
patchTask(root, reference, {}, "record-independent-check", {
|
|
1715
|
+
independent_check: verdict,
|
|
1716
|
+
});
|
|
1717
|
+
console.log(`Independent check: ${result} (${mode})`);
|
|
1718
|
+
return 0;
|
|
1719
|
+
}
|
|
1720
|
+
function archiveTask(root, args) {
|
|
1721
|
+
const dir = taskDir(root, requireArgument(args[0], "task"));
|
|
1722
|
+
const record = taskRecord(dir);
|
|
1723
|
+
if (!record)
|
|
1724
|
+
throw new Error(`task.json not found at ${dir}`);
|
|
1725
|
+
const guard = checkArchive(dir, record);
|
|
1726
|
+
const activeChildren = record.children
|
|
1727
|
+
.map((id) => path.join(root, ".pactile", "tasks", id))
|
|
1728
|
+
.filter((candidate) => fs.existsSync(candidate));
|
|
1729
|
+
if (activeChildren.length && !args.includes("--archive-integrated-children"))
|
|
1730
|
+
guard.errors.push(`active children remain: ${activeChildren.map((candidate) => path.basename(candidate)).join(", ")}; use --archive-integrated-children after preflight`);
|
|
1731
|
+
if (activeChildren.length && args.includes("--archive-integrated-children")) {
|
|
1732
|
+
for (const childDir of activeChildren) {
|
|
1733
|
+
const child = taskRecord(childDir);
|
|
1734
|
+
if (!child) {
|
|
1735
|
+
guard.errors.push(`child task.json missing: ${path.basename(childDir)}`);
|
|
1736
|
+
continue;
|
|
1737
|
+
}
|
|
1738
|
+
guard.errors.push(...checkArchive(childDir, child).errors.map((message) => `${path.basename(childDir)}: ${message}`));
|
|
1739
|
+
}
|
|
1740
|
+
}
|
|
1741
|
+
guard.ok = guard.errors.length === 0;
|
|
1742
|
+
if (!guard.ok) {
|
|
1743
|
+
console.error(`Archive check: FAIL\n${guard.errors.map((error) => ` - ${error}`).join("\n")}`);
|
|
1744
|
+
return 1;
|
|
1745
|
+
}
|
|
1746
|
+
if (args.includes("--check")) {
|
|
1747
|
+
console.log("Archive check: PASS");
|
|
1748
|
+
return 0;
|
|
1749
|
+
}
|
|
1750
|
+
if (activeChildren.length) {
|
|
1751
|
+
for (const childDir of activeChildren) {
|
|
1752
|
+
const childArgs = [path.basename(childDir), "--no-commit"];
|
|
1753
|
+
if (archiveTask(root, childArgs) !== 0)
|
|
1754
|
+
throw new Error(`child archive failed: ${path.basename(childDir)}`);
|
|
1755
|
+
}
|
|
1756
|
+
}
|
|
1757
|
+
const now = new Date();
|
|
1758
|
+
const completedAt = localDate(now);
|
|
1759
|
+
const month = completedAt.slice(0, 7);
|
|
1760
|
+
const destination = path.join(root, ".pactile", "tasks", "archive", month, path.basename(dir));
|
|
1761
|
+
if (fs.existsSync(destination))
|
|
1762
|
+
throw new Error(`Archive destination already exists: ${destination}`);
|
|
1763
|
+
const revision = readKernel({ taskDir: dir, cwd: root }).kernel.revision;
|
|
1764
|
+
const archivedRelative = path
|
|
1765
|
+
.relative(root, destination)
|
|
1766
|
+
.replaceAll("\\", "/");
|
|
1767
|
+
const verifyText = fs.readFileSync(path.join(dir, "verify.md"), "utf8");
|
|
1768
|
+
const acceptance = verifyText
|
|
1769
|
+
.match(/^\s*(?:[-*]\s*)?(?:(?:final|user)\s+)?acceptance(?:\s+evidence)?\s*:\s*(\S[^\r\n]*)$/im)?.[1]
|
|
1770
|
+
?.trim();
|
|
1771
|
+
const points = acceptance
|
|
1772
|
+
? [{ text: acceptance, source: "verify.md", confidence: "low" }]
|
|
1773
|
+
: [];
|
|
1774
|
+
const notesProjection = {
|
|
1775
|
+
schema_version: 1,
|
|
1776
|
+
summary: points
|
|
1777
|
+
.map((point) => point.text)
|
|
1778
|
+
.join("; ")
|
|
1779
|
+
.split(/\s+/)
|
|
1780
|
+
.slice(0, 150)
|
|
1781
|
+
.join(" "),
|
|
1782
|
+
pointers: [archivedRelative, `${archivedRelative}/verify.md`],
|
|
1783
|
+
source: "cmd_archive",
|
|
1784
|
+
points,
|
|
1785
|
+
};
|
|
1786
|
+
applyKernelArchive({
|
|
1787
|
+
taskDir: dir,
|
|
1788
|
+
cwd: root,
|
|
1789
|
+
expectedRevision: revision,
|
|
1790
|
+
actor: "pactile task archive",
|
|
1791
|
+
idempotencyKey: `archive:${path.basename(dir)}:${completedAt}`,
|
|
1792
|
+
evidence: "pactile task archive",
|
|
1793
|
+
record: { ...record, status: "completed", completedAt },
|
|
1794
|
+
extras: { notes_projection: notesProjection },
|
|
1795
|
+
});
|
|
1796
|
+
fs.mkdirSync(path.dirname(destination), { recursive: true });
|
|
1797
|
+
fs.renameSync(dir, destination);
|
|
1798
|
+
runTaskHooks(root, "after_archive", path.join(destination, "task.json"));
|
|
1799
|
+
const selected = resolveSelectedTask(root);
|
|
1800
|
+
if (selected.taskPath === `.pactile/tasks/${path.basename(dir)}`)
|
|
1801
|
+
exitTask(root);
|
|
1802
|
+
if (!args.includes("--no-commit") &&
|
|
1803
|
+
readPactileConfig(root).session_auto_commit !== "false") {
|
|
1804
|
+
const relativeSource = path.relative(root, dir).replaceAll("\\", "/");
|
|
1805
|
+
const relativeDestination = path
|
|
1806
|
+
.relative(root, destination)
|
|
1807
|
+
.replaceAll("\\", "/");
|
|
1808
|
+
let isRepo = false;
|
|
1809
|
+
try {
|
|
1810
|
+
isRepo =
|
|
1811
|
+
execFileSync("git", ["rev-parse", "--is-inside-work-tree"], {
|
|
1812
|
+
cwd: root,
|
|
1813
|
+
encoding: "utf8",
|
|
1814
|
+
stdio: ["ignore", "pipe", "ignore"],
|
|
1815
|
+
}).trim() === "true";
|
|
1816
|
+
}
|
|
1817
|
+
catch {
|
|
1818
|
+
/* Archive remains valid in a non-Git project. */
|
|
1819
|
+
}
|
|
1820
|
+
try {
|
|
1821
|
+
if (isRepo) {
|
|
1822
|
+
let ignored = false;
|
|
1823
|
+
try {
|
|
1824
|
+
execFileSync("git", ["check-ignore", "-q", "--", relativeDestination], { cwd: root, stdio: ["ignore", "pipe", "ignore"] });
|
|
1825
|
+
ignored = true;
|
|
1826
|
+
}
|
|
1827
|
+
catch {
|
|
1828
|
+
/* The archive path is not ignored. */
|
|
1829
|
+
}
|
|
1830
|
+
if (!ignored) {
|
|
1831
|
+
execFileSync("git", ["add", "-A", "--", relativeSource, relativeDestination], { cwd: root, stdio: ["ignore", "pipe", "pipe"] });
|
|
1832
|
+
const message = `chore(task): archive ${path.basename(dir)}`;
|
|
1833
|
+
execFileSync("git", [
|
|
1834
|
+
"commit",
|
|
1835
|
+
"--only",
|
|
1836
|
+
"-m",
|
|
1837
|
+
message,
|
|
1838
|
+
"--",
|
|
1839
|
+
relativeSource,
|
|
1840
|
+
relativeDestination,
|
|
1841
|
+
], { cwd: root, stdio: ["ignore", "pipe", "pipe"] });
|
|
1842
|
+
}
|
|
1843
|
+
}
|
|
1844
|
+
}
|
|
1845
|
+
catch (error) {
|
|
1846
|
+
console.warn(`Archive state is complete, but scoped git auto-commit failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
1847
|
+
}
|
|
1848
|
+
}
|
|
1849
|
+
console.log(path.relative(root, destination).replaceAll("\\", "/"));
|
|
1850
|
+
return 0;
|
|
1851
|
+
}
|
|
1852
|
+
/** Node entry for the existing task command vocabulary. */
|
|
1853
|
+
export function runTaskCli(argv, root = process.cwd()) {
|
|
1854
|
+
const [command, ...args] = argv;
|
|
1855
|
+
try {
|
|
1856
|
+
switch (command) {
|
|
1857
|
+
case "schedule":
|
|
1858
|
+
return runTaskScheduleCli(args, root);
|
|
1859
|
+
case "create":
|
|
1860
|
+
createTask(args, root);
|
|
1861
|
+
return 0;
|
|
1862
|
+
case "legacy-create":
|
|
1863
|
+
createLegacyTask(args, root);
|
|
1864
|
+
return 0;
|
|
1865
|
+
case "show":
|
|
1866
|
+
return showTask(root, args);
|
|
1867
|
+
case "artifacts":
|
|
1868
|
+
return taskArtifacts(root, args);
|
|
1869
|
+
case "add-dependency": {
|
|
1870
|
+
const reference = requireArgument(args[0], "task");
|
|
1871
|
+
const dependencyId = requireArgument(args[1], "dependency task ID");
|
|
1872
|
+
const { dir, kernel } = taskV2(root, reference);
|
|
1873
|
+
const result = addTaskDependency({
|
|
1874
|
+
root,
|
|
1875
|
+
taskDir: dir,
|
|
1876
|
+
expectedRevision: kernel.revision,
|
|
1877
|
+
dependencyId,
|
|
1878
|
+
actor: actor(root, args),
|
|
1879
|
+
idempotencyKey: option(args, "--idempotency-key") ??
|
|
1880
|
+
`dependency:${kernel.identity.taskId}:${dependencyId}`,
|
|
1881
|
+
});
|
|
1882
|
+
console.log(`Hard dependency added: ${result.kernel.identity.taskId} -> ${dependencyId}\nKernel revision: ${result.kernel.revision}`);
|
|
1883
|
+
return 0;
|
|
1884
|
+
}
|
|
1885
|
+
case "run-start":
|
|
1886
|
+
return runStartTask(root, args);
|
|
1887
|
+
case "run-resume":
|
|
1888
|
+
return resumeTask(root, args);
|
|
1889
|
+
case "run-result":
|
|
1890
|
+
return runResultTask(root, args);
|
|
1891
|
+
case "review":
|
|
1892
|
+
return reviewTask(root, args);
|
|
1893
|
+
case "close":
|
|
1894
|
+
return closeTask(root, args);
|
|
1895
|
+
case "start-execution":
|
|
1896
|
+
return startExecution(root, args);
|
|
1897
|
+
case "record-gate":
|
|
1898
|
+
return recordGate(root, args);
|
|
1899
|
+
case "record-ac-evidence":
|
|
1900
|
+
return recordAcEvidence(root, args);
|
|
1901
|
+
case "record-independent-check":
|
|
1902
|
+
return recordIndependentCheck(root, args);
|
|
1903
|
+
case "add-subtask":
|
|
1904
|
+
linkChild(root, requireArgument(args[0], "parent task"), requireArgument(args[1], "child task"));
|
|
1905
|
+
return 0;
|
|
1906
|
+
case "remove-subtask":
|
|
1907
|
+
unlinkChild(root, requireArgument(args[0], "parent task"), requireArgument(args[1], "child task"));
|
|
1908
|
+
return 0;
|
|
1909
|
+
case "prepare-child-worktree":
|
|
1910
|
+
return prepareChildWorktree(root, args);
|
|
1911
|
+
case "set-child-state":
|
|
1912
|
+
return updateChildState(root, args, false);
|
|
1913
|
+
case "integrate-child":
|
|
1914
|
+
return updateChildState(root, args, true);
|
|
1915
|
+
case "review-child":
|
|
1916
|
+
return reviewChild(root, args);
|
|
1917
|
+
case "parent-status": {
|
|
1918
|
+
const dir = taskDir(root, requireArgument(args[0], "parent task"));
|
|
1919
|
+
const snapshot = readTaskMap(dir).data;
|
|
1920
|
+
if (!snapshot)
|
|
1921
|
+
throw new Error("task-map.md missing");
|
|
1922
|
+
console.log(args.includes("--json")
|
|
1923
|
+
? JSON.stringify(snapshot, null, 2)
|
|
1924
|
+
: snapshot.children
|
|
1925
|
+
.map((child) => `${child.id}: ${child.state}`)
|
|
1926
|
+
.join("\n"));
|
|
1927
|
+
return 0;
|
|
1928
|
+
}
|
|
1929
|
+
case "archive":
|
|
1930
|
+
return archiveTask(root, args);
|
|
1931
|
+
case "prepare-archive-evidence": {
|
|
1932
|
+
const dir = taskDir(root, requireArgument(args[0], "task"));
|
|
1933
|
+
const record = taskRecord(dir);
|
|
1934
|
+
if (!record)
|
|
1935
|
+
throw new Error(`task.json not found at ${dir}`);
|
|
1936
|
+
for (const line of prepareArchiveEvidence(dir, record, args.includes("--dry-run")))
|
|
1937
|
+
console.log(line);
|
|
1938
|
+
return 0;
|
|
1939
|
+
}
|
|
1940
|
+
case "prepare-learning-scaffold": {
|
|
1941
|
+
const dir = taskDir(root, requireArgument(args[0], "task"));
|
|
1942
|
+
const record = taskRecord(dir);
|
|
1943
|
+
if (!record)
|
|
1944
|
+
throw new Error(`task.json not found at ${dir}`);
|
|
1945
|
+
console.log(learningScaffold(root, dir, record, option(args, "--trigger")));
|
|
1946
|
+
return 0;
|
|
1947
|
+
}
|
|
1948
|
+
case "dashboard":
|
|
1949
|
+
dashboard(root);
|
|
1950
|
+
return 0;
|
|
1951
|
+
case "list":
|
|
1952
|
+
listTasks(args, root);
|
|
1953
|
+
return 0;
|
|
1954
|
+
case "list-archive":
|
|
1955
|
+
listArchive(root, args[0]);
|
|
1956
|
+
return 0;
|
|
1957
|
+
case "select": {
|
|
1958
|
+
const chosen = selectTask(root, requireArgument(args[0], "task"));
|
|
1959
|
+
console.log(`Selected task: ${chosen.taskPath}\nSource: ${chosen.source}\nTask status unchanged.`);
|
|
1960
|
+
return 0;
|
|
1961
|
+
}
|
|
1962
|
+
case "selected": {
|
|
1963
|
+
const chosen = resolveSelectedTask(root);
|
|
1964
|
+
if (args.includes("--json")) {
|
|
1965
|
+
if (!chosen.taskPath || chosen.stale) {
|
|
1966
|
+
console.log(JSON.stringify({
|
|
1967
|
+
selectedTask: chosen.taskPath,
|
|
1968
|
+
source: chosen.source,
|
|
1969
|
+
stale: chosen.stale,
|
|
1970
|
+
}, null, 2));
|
|
1971
|
+
return chosen.taskPath ? 0 : 1;
|
|
1972
|
+
}
|
|
1973
|
+
const dir = resolveTaskDir(root, chosen.taskPath);
|
|
1974
|
+
const imported = readLegacyTaskImportRecord(root, dir);
|
|
1975
|
+
if (imported && imported.status !== "imported") {
|
|
1976
|
+
console.log(JSON.stringify({
|
|
1977
|
+
taskPath: chosen.taskPath,
|
|
1978
|
+
source: chosen.source,
|
|
1979
|
+
taskId: imported.legacyTaskId,
|
|
1980
|
+
migrationStatus: imported.status,
|
|
1981
|
+
runnable: false,
|
|
1982
|
+
missingDefinitionFields: imported.missingDefinitionFields,
|
|
1983
|
+
coordinationReasons: imported.coordinationReasons,
|
|
1984
|
+
kernelVersion: null,
|
|
1985
|
+
}, null, 2));
|
|
1986
|
+
return 0;
|
|
1987
|
+
}
|
|
1988
|
+
if (!fs.existsSync(path.join(dir, "kernel.json")) && !imported) {
|
|
1989
|
+
const record = taskRecord(dir);
|
|
1990
|
+
console.log(JSON.stringify({
|
|
1991
|
+
taskPath: chosen.taskPath,
|
|
1992
|
+
source: chosen.source,
|
|
1993
|
+
taskId: record?.id ?? null,
|
|
1994
|
+
title: record?.title ?? record?.name ?? null,
|
|
1995
|
+
status: record?.status ?? null,
|
|
1996
|
+
kernelVersion: 0,
|
|
1997
|
+
}, null, 2));
|
|
1998
|
+
return 0;
|
|
1999
|
+
}
|
|
2000
|
+
const read = readTaskKernel({ root, taskDir: dir, cwd: root });
|
|
2001
|
+
const summary = read.kind === "task-kernel-v2"
|
|
2002
|
+
? {
|
|
2003
|
+
taskId: read.kernel.identity.taskId,
|
|
2004
|
+
title: read.kernel.definition.title,
|
|
2005
|
+
phase: read.kernel.phase,
|
|
2006
|
+
condition: read.kernel.condition,
|
|
2007
|
+
revision: read.kernel.revision,
|
|
2008
|
+
kernelVersion: 2,
|
|
2009
|
+
}
|
|
2010
|
+
: {
|
|
2011
|
+
taskId: read.kernel.kernel.identity.taskId,
|
|
2012
|
+
phase: read.kernel.kernel.phase,
|
|
2013
|
+
condition: read.kernel.kernel.condition,
|
|
2014
|
+
revision: read.kernel.kernel.revision,
|
|
2015
|
+
kernelVersion: 1,
|
|
2016
|
+
};
|
|
2017
|
+
console.log(JSON.stringify({ taskPath: chosen.taskPath, source: chosen.source, ...summary }, null, 2));
|
|
2018
|
+
return 0;
|
|
2019
|
+
}
|
|
2020
|
+
if (args.includes("--source")) {
|
|
2021
|
+
console.log(`Selected task: ${chosen.taskPath ?? "(none)"}\nSource: ${chosen.source}`);
|
|
2022
|
+
if (chosen.stale)
|
|
2023
|
+
console.log("State: stale");
|
|
2024
|
+
else if (chosen.taskPath) {
|
|
2025
|
+
const dir = resolveTaskDir(root, chosen.taskPath);
|
|
2026
|
+
const imported = readLegacyTaskImportRecord(root, dir);
|
|
2027
|
+
if (imported && imported.status !== "imported") {
|
|
2028
|
+
console.log(`Migration: ${imported.status}; Run unavailable`);
|
|
2029
|
+
}
|
|
2030
|
+
else if (fs.existsSync(path.join(dir, "kernel.json")) ||
|
|
2031
|
+
imported) {
|
|
2032
|
+
const read = readTaskKernel({ root, taskDir: dir, cwd: root });
|
|
2033
|
+
const kernel = read.kind === "task-kernel-v2"
|
|
2034
|
+
? read.kernel
|
|
2035
|
+
: read.kernel.kernel;
|
|
2036
|
+
console.log(`Kernel: ${read.kind === "task-kernel-v2" ? "v2" : "v1"}\nPhase: ${kernel.phase}\nKernel revision: ${kernel.revision}`);
|
|
2037
|
+
}
|
|
2038
|
+
else
|
|
2039
|
+
console.log("Kernel: unavailable (legacy task.json only)");
|
|
2040
|
+
}
|
|
2041
|
+
}
|
|
2042
|
+
else if (chosen.taskPath)
|
|
2043
|
+
console.log(chosen.taskPath);
|
|
2044
|
+
else
|
|
2045
|
+
console.error("No task selected for this live session.");
|
|
2046
|
+
return chosen.taskPath ? 0 : 1;
|
|
2047
|
+
}
|
|
2048
|
+
case "exit": {
|
|
2049
|
+
const previous = exitTask(root);
|
|
2050
|
+
console.log(previous.taskPath
|
|
2051
|
+
? `Cleared selected task (was: ${previous.taskPath})\nTask status unchanged.`
|
|
2052
|
+
: "No selected task set");
|
|
2053
|
+
return 0;
|
|
2054
|
+
}
|
|
2055
|
+
case "add-context": {
|
|
2056
|
+
const dir = taskDir(root, requireArgument(args[0], "task"));
|
|
2057
|
+
const name = requireArgument(args[1], "manifest");
|
|
2058
|
+
const reference = requireArgument(args[2], "path");
|
|
2059
|
+
const added = addContextEntry(root, dir, name, reference, args[3]);
|
|
2060
|
+
console.log(added ? `Added: ${reference}` : `Entry already exists: ${reference}`);
|
|
2061
|
+
return 0;
|
|
2062
|
+
}
|
|
2063
|
+
case "set-branch":
|
|
2064
|
+
case "set-base-branch":
|
|
2065
|
+
case "set-scope": {
|
|
2066
|
+
const reference = requireArgument(args[0], "task");
|
|
2067
|
+
const value = requireArgument(args[1], command === "set-scope" ? "scope" : "branch");
|
|
2068
|
+
const key = command === "set-branch"
|
|
2069
|
+
? "branch"
|
|
2070
|
+
: command === "set-base-branch"
|
|
2071
|
+
? "base_branch"
|
|
2072
|
+
: "scope";
|
|
2073
|
+
patchTask(root, reference, { [key]: value }, command);
|
|
2074
|
+
console.log(`${key} set to: ${value}`);
|
|
2075
|
+
return 0;
|
|
2076
|
+
}
|
|
2077
|
+
case "set-deps": {
|
|
2078
|
+
const reference = requireArgument(args[0], "task");
|
|
2079
|
+
const dependencies = [
|
|
2080
|
+
...new Set(args.slice(1).filter((item) => item.trim())),
|
|
2081
|
+
];
|
|
2082
|
+
const dir = taskDir(root, reference);
|
|
2083
|
+
const record = taskRecord(dir);
|
|
2084
|
+
if (!record)
|
|
2085
|
+
throw new Error(`task.json not found at ${dir}`);
|
|
2086
|
+
const projection = readKernel({ taskDir: dir, cwd: root }).kernel.projection?.extras ??
|
|
2087
|
+
{};
|
|
2088
|
+
const rawDeps = record
|
|
2089
|
+
.depends_on;
|
|
2090
|
+
const oldDeps = Array.isArray(rawDeps)
|
|
2091
|
+
? rawDeps.filter((item) => typeof item === "string")
|
|
2092
|
+
: [];
|
|
2093
|
+
const graph = readDependencyGraph(projection);
|
|
2094
|
+
const edges = graph.edges.filter((edge) => !(edge.from === record.id &&
|
|
2095
|
+
edge.type === "requires" &&
|
|
2096
|
+
oldDeps.includes(edge.to)));
|
|
2097
|
+
const satisfied = Array.isArray(projection.dependency_satisfied)
|
|
2098
|
+
? projection.dependency_satisfied.filter((item) => typeof item === "string" && !oldDeps.includes(item))
|
|
2099
|
+
: [];
|
|
2100
|
+
patchTask(root, reference, {}, command, {
|
|
2101
|
+
depends_on: dependencies,
|
|
2102
|
+
dependency_graph: { ...graph, edges },
|
|
2103
|
+
dependency_satisfied: satisfied,
|
|
2104
|
+
});
|
|
2105
|
+
console.log(dependencies.length
|
|
2106
|
+
? `depends_on set: ${dependencies.join(", ")}`
|
|
2107
|
+
: "depends_on cleared to []");
|
|
2108
|
+
return 0;
|
|
2109
|
+
}
|
|
2110
|
+
case "set-depends-mode": {
|
|
2111
|
+
const reference = requireArgument(args[0], "task");
|
|
2112
|
+
const mode = requireArgument(args[1], "mode");
|
|
2113
|
+
if (mode !== "block")
|
|
2114
|
+
throw new Error("Node Kernel uses hard requires for all depends_on; only block is supported");
|
|
2115
|
+
const record = taskRecord(taskDir(root, reference));
|
|
2116
|
+
if (!record)
|
|
2117
|
+
throw new Error(`task.json not found for ${reference}`);
|
|
2118
|
+
patchTask(root, reference, { meta: { ...record.meta, depends_mode: mode } }, command);
|
|
2119
|
+
console.log(`depends_mode: ${mode}`);
|
|
2120
|
+
return 0;
|
|
2121
|
+
}
|
|
2122
|
+
case "artifact-locale": {
|
|
2123
|
+
const operation = requireArgument(args[0], "artifact-locale operation");
|
|
2124
|
+
const reference = option(args, "--task");
|
|
2125
|
+
if (operation === "get") {
|
|
2126
|
+
const task = reference ? taskRecord(taskDir(root, reference)) : null;
|
|
2127
|
+
const taskLocale = task?.meta && typeof task.meta === "object"
|
|
2128
|
+
? task.meta.artifact_locale
|
|
2129
|
+
: undefined;
|
|
2130
|
+
console.log(taskLocale === "en" || taskLocale === "zh"
|
|
2131
|
+
? taskLocale
|
|
2132
|
+
: locale(root));
|
|
2133
|
+
return 0;
|
|
2134
|
+
}
|
|
2135
|
+
if (operation !== "set")
|
|
2136
|
+
throw new Error("use artifact-locale get|set");
|
|
2137
|
+
const value = requireArgument(args[1], "locale");
|
|
2138
|
+
if (value !== "zh" && value !== "en")
|
|
2139
|
+
throw new Error("artifact_locale must be zh or en");
|
|
2140
|
+
if (reference) {
|
|
2141
|
+
const record = taskRecord(taskDir(root, reference));
|
|
2142
|
+
if (!record)
|
|
2143
|
+
throw new Error(`task.json not found for ${reference}`);
|
|
2144
|
+
patchTask(root, reference, { meta: { ...record.meta, artifact_locale: value } }, command);
|
|
2145
|
+
console.log(`artifact_locale set to ${value} (task ${path.basename(taskDir(root, reference))})`);
|
|
2146
|
+
return 0;
|
|
2147
|
+
}
|
|
2148
|
+
const configFile = path.join(root, ".pactile", "config.yaml");
|
|
2149
|
+
const content = fs.existsSync(configFile)
|
|
2150
|
+
? fs.readFileSync(configFile, "utf8")
|
|
2151
|
+
: "# Pactile Configuration\n";
|
|
2152
|
+
const replacement = `artifact_locale: ${value}`;
|
|
2153
|
+
fs.mkdirSync(path.dirname(configFile), { recursive: true });
|
|
2154
|
+
fs.writeFileSync(configFile, /^\s*artifact_locale:\s*[^\r\n]*/m.test(content)
|
|
2155
|
+
? content.replace(/^\s*artifact_locale:\s*[^\r\n]*/m, replacement)
|
|
2156
|
+
: `${content.trimEnd()}\n\n${replacement}\n`, "utf8");
|
|
2157
|
+
console.log(`artifact_locale set to ${value} (workspace)`);
|
|
2158
|
+
return 0;
|
|
2159
|
+
}
|
|
2160
|
+
case "validate": {
|
|
2161
|
+
const dir = taskDir(root, requireArgument(args[0], "task"));
|
|
2162
|
+
const results = CONTEXT_FILES.map((name) => validateContextFile(root, dir, name));
|
|
2163
|
+
for (const result of results) {
|
|
2164
|
+
console.log(`${result.file}: ${result.errors.length ? "FAIL" : "PASS"} (${result.entries} entries)`);
|
|
2165
|
+
for (const message of [...result.errors, ...result.warnings])
|
|
2166
|
+
console.log(` - ${message}`);
|
|
2167
|
+
}
|
|
2168
|
+
return results.some((result) => result.errors.length) ? 1 : 0;
|
|
2169
|
+
}
|
|
2170
|
+
case "list-context": {
|
|
2171
|
+
const dir = taskDir(root, requireArgument(args[0], "task"));
|
|
2172
|
+
for (const name of CONTEXT_FILES) {
|
|
2173
|
+
console.log(`[${name}]`);
|
|
2174
|
+
const entries = readContextEntries(dir, name);
|
|
2175
|
+
for (const [index, entry] of entries.entries())
|
|
2176
|
+
console.log(` ${index + 1}. ${entry.file} — ${entry.reason ?? "-"}`);
|
|
2177
|
+
if (!entries.length)
|
|
2178
|
+
console.log(" (no curated entries)");
|
|
2179
|
+
}
|
|
2180
|
+
return 0;
|
|
2181
|
+
}
|
|
2182
|
+
default:
|
|
2183
|
+
console.error("Usage: pactile task <create|legacy-create|show|artifacts|schedule|add-dependency|run-start|run-resume|run-result|review|close|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> ...");
|
|
2184
|
+
return 1;
|
|
2185
|
+
}
|
|
2186
|
+
}
|
|
2187
|
+
catch (err) {
|
|
2188
|
+
console.error(`Error: ${err instanceof Error ? err.message : String(err)}`);
|
|
2189
|
+
return 1;
|
|
2190
|
+
}
|
|
2191
|
+
}
|
|
2192
|
+
/** Promise-aware task entry for the existing CLI wrapper's async operations. */
|
|
2193
|
+
export async function runTaskCliAsync(argv, root = process.cwd(), scheduleDispatchOptions = {}) {
|
|
2194
|
+
const [command, operation, ...args] = argv;
|
|
2195
|
+
if (command === "schedule" && operation === "dispatch") {
|
|
2196
|
+
try {
|
|
2197
|
+
return await runTaskScheduleDispatchCli(args, root, scheduleDispatchOptions);
|
|
2198
|
+
}
|
|
2199
|
+
catch (error) {
|
|
2200
|
+
console.error(`Error: ${error instanceof Error ? error.message : String(error)}`);
|
|
2201
|
+
return 1;
|
|
2202
|
+
}
|
|
2203
|
+
}
|
|
2204
|
+
if (command === "schedule") {
|
|
2205
|
+
try {
|
|
2206
|
+
return await runTaskScheduleCliAsync([operation ?? "", ...args], root);
|
|
2207
|
+
}
|
|
2208
|
+
catch (error) {
|
|
2209
|
+
console.error(`Error: ${error instanceof Error ? error.message : String(error)}`);
|
|
2210
|
+
return 1;
|
|
2211
|
+
}
|
|
2212
|
+
}
|
|
2213
|
+
return runTaskCli(argv, root);
|
|
2214
|
+
}
|
|
2215
|
+
//# sourceMappingURL=task.js.map
|