@ai-atomic-framework/cli 0.1.0-beta.4 → 0.1.0-beta.5
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/dist/{atm.mjs → npm-runtime/atm.mjs} +1 -1
- package/dist/npm-runtime/index.d.ts +10 -0
- package/dist/npm-runtime/index.js +1 -0
- package/dist/{_vendor → npm-runtime/layout/_vendor}/integrations-core/templates/skills/atm-dispatch.skill.md +17 -0
- package/dist/npm-runtime/layout/schemas/atomic-spec.schema.json +460 -0
- package/dist/npm-runtime/layout/templates/atom.spec.template.json +55 -0
- package/dist/npm-runtime/layout/templates/atom.test.template.ts +16 -0
- package/dist/npm-runtime/manifest.json +465 -0
- package/dist/npm-runtime/runtime.mjs +481 -0
- package/package.json +12 -33
- package/dist/_vendor/agent-pack-claude-code/dist/index.js +0 -40
- package/dist/_vendor/agent-pack-copilot/dist/index.js +0 -30
- package/dist/_vendor/agent-pack-cursor/dist/index.js +0 -30
- package/dist/_vendor/agent-pack-gemini/dist/index.js +0 -30
- package/dist/_vendor/agent-pack-sdk/dist/experimental/index.js +0 -54
- package/dist/_vendor/agent-pack-sdk/dist/index.js +0 -40
- package/dist/_vendor/agent-pack-sdk/dist/install-manifest.js +0 -49
- package/dist/_vendor/agent-pack-windsurf/dist/index.js +0 -54
- package/dist/_vendor/atm-markdown-task-source/dist/index.js +0 -87
- package/dist/_vendor/atm-markdown-task-source/dist/task-card-parser.js +0 -1
- package/dist/_vendor/atm-markdown-task-source/dist/templates.js +0 -48
- package/dist/_vendor/core/dist/agent-execute/execute-agent-task.js +0 -295
- package/dist/_vendor/core/dist/agent-execute/execution-constants.js +0 -16
- package/dist/_vendor/core/dist/agent-execute/execution-documents.js +0 -83
- package/dist/_vendor/core/dist/agent-execute/execution-validation.js +0 -97
- package/dist/_vendor/core/dist/agent-prompt/build-agent-prompt.js +0 -191
- package/dist/_vendor/core/dist/architecture/index.js +0 -1
- package/dist/_vendor/core/dist/architecture/module-boundary.js +0 -167
- package/dist/_vendor/core/dist/batch/plan-run-journal.js +0 -181
- package/dist/_vendor/core/dist/broker/adapters/atom-map.js +0 -205
- package/dist/_vendor/core/dist/broker/adapters/batch-planner.js +0 -121
- package/dist/_vendor/core/dist/broker/adapters/cas.js +0 -26
- package/dist/_vendor/core/dist/broker/adapters/fallback-file-lock.js +0 -64
- package/dist/_vendor/core/dist/broker/adapters/index.js +0 -8
- package/dist/_vendor/core/dist/broker/adapters/json-record.js +0 -170
- package/dist/_vendor/core/dist/broker/adapters/numeric-scalar.js +0 -155
- package/dist/_vendor/core/dist/broker/adapters/registry.js +0 -79
- package/dist/_vendor/core/dist/broker/adapters/text-range.js +0 -143
- package/dist/_vendor/core/dist/broker/admission/contracts.js +0 -1
- package/dist/_vendor/core/dist/broker/admission/evaluate-broker-admission.js +0 -127
- package/dist/_vendor/core/dist/broker/agr.js +0 -22
- package/dist/_vendor/core/dist/broker/apply-evidence.js +0 -32
- package/dist/_vendor/core/dist/broker/atm-core-scope.js +0 -139
- package/dist/_vendor/core/dist/broker/boundaries/content-anchor.js +0 -60
- package/dist/_vendor/core/dist/broker/boundaries/index.js +0 -2
- package/dist/_vendor/core/dist/broker/boundaries/resolver.js +0 -76
- package/dist/_vendor/core/dist/broker/candidate-bridge.js +0 -76
- package/dist/_vendor/core/dist/broker/census/index.js +0 -40
- package/dist/_vendor/core/dist/broker/compose.js +0 -187
- package/dist/_vendor/core/dist/broker/conflict-key-overlap.js +0 -59
- package/dist/_vendor/core/dist/broker/conflict-matrix.js +0 -350
- package/dist/_vendor/core/dist/broker/cross-task-mutation-guard.js +0 -507
- package/dist/_vendor/core/dist/broker/decision/admission.js +0 -58
- package/dist/_vendor/core/dist/broker/decision/decomposition.js +0 -188
- package/dist/_vendor/core/dist/broker/decision/failure.js +0 -5
- package/dist/_vendor/core/dist/broker/decision/physical-overlap.js +0 -78
- package/dist/_vendor/core/dist/broker/decision/proposal-overlap.js +0 -173
- package/dist/_vendor/core/dist/broker/decision/surfaces.js +0 -12
- package/dist/_vendor/core/dist/broker/decision.js +0 -213
- package/dist/_vendor/core/dist/broker/failure-reason.js +0 -79
- package/dist/_vendor/core/dist/broker/foreign-generated-residue-disposition.js +0 -66
- package/dist/_vendor/core/dist/broker/freeze.js +0 -126
- package/dist/_vendor/core/dist/broker/generated-projection-steward.js +0 -213
- package/dist/_vendor/core/dist/broker/global-resource-projection.js +0 -116
- package/dist/_vendor/core/dist/broker/historical-work-admission-attestation.js +0 -173
- package/dist/_vendor/core/dist/broker/index.js +0 -44
- package/dist/_vendor/core/dist/broker/intent-enrichment.js +0 -10
- package/dist/_vendor/core/dist/broker/lifecycle/index.js +0 -149
- package/dist/_vendor/core/dist/broker/lifecycle.js +0 -242
- package/dist/_vendor/core/dist/broker/merge-plan.js +0 -83
- package/dist/_vendor/core/dist/broker/orphan-cleanup.js +0 -108
- package/dist/_vendor/core/dist/broker/parallel-admission-policy.js +0 -229
- package/dist/_vendor/core/dist/broker/patch-candidate-materializer.js +0 -126
- package/dist/_vendor/core/dist/broker/patch-envelope-atm-core.js +0 -45
- package/dist/_vendor/core/dist/broker/patch-envelope.js +0 -97
- package/dist/_vendor/core/dist/broker/policy.js +0 -89
- package/dist/_vendor/core/dist/broker/post-compose-semantic-validation-policy.js +0 -199
- package/dist/_vendor/core/dist/broker/projections/atomic-broker-projection.js +0 -142
- package/dist/_vendor/core/dist/broker/proposal.js +0 -203
- package/dist/_vendor/core/dist/broker/reconcile/broker-projection-reconcile.js +0 -57
- package/dist/_vendor/core/dist/broker/recovery.js +0 -182
- package/dist/_vendor/core/dist/broker/registry-store.js +0 -176
- package/dist/_vendor/core/dist/broker/registry.js +0 -365
- package/dist/_vendor/core/dist/broker/related-task-batching.js +0 -34
- package/dist/_vendor/core/dist/broker/replay/dashboard.js +0 -130
- package/dist/_vendor/core/dist/broker/replay/index.js +0 -164
- package/dist/_vendor/core/dist/broker/replay/lifecycle-receipt-observability.js +0 -133
- package/dist/_vendor/core/dist/broker/replay/lifecycle-receipt-types.js +0 -47
- package/dist/_vendor/core/dist/broker/replay/lifecycle-receipt-validation.js +0 -13
- package/dist/_vendor/core/dist/broker/replay/lifecycle-receipts.js +0 -261
- package/dist/_vendor/core/dist/broker/replay/runner-discrimination.js +0 -311
- package/dist/_vendor/core/dist/broker/resource-overlap.js +0 -203
- package/dist/_vendor/core/dist/broker/runner-bootstrap.js +0 -65
- package/dist/_vendor/core/dist/broker/runner-build-output-inventory.js +0 -359
- package/dist/_vendor/core/dist/broker/runner-execution-attestation.js +0 -24
- package/dist/_vendor/core/dist/broker/runner-ref-store.js +0 -65
- package/dist/_vendor/core/dist/broker/runner-registry-snapshot.js +0 -58
- package/dist/_vendor/core/dist/broker/runner-selection-verification-ports.js +0 -1
- package/dist/_vendor/core/dist/broker/runner-shadow-feedback-sink.js +0 -12
- package/dist/_vendor/core/dist/broker/runner-submit-pipeline.js +0 -67
- package/dist/_vendor/core/dist/broker/runner-sync-session.js +0 -302
- package/dist/_vendor/core/dist/broker/runner-sync-steward-queue.js +0 -436
- package/dist/_vendor/core/dist/broker/runner-version-contract.js +0 -188
- package/dist/_vendor/core/dist/broker/runner-version-registry.js +0 -163
- package/dist/_vendor/core/dist/broker/runner-version-selection-verifier.js +0 -182
- package/dist/_vendor/core/dist/broker/runner-version-state.js +0 -63
- package/dist/_vendor/core/dist/broker/semantic-adjudication/index.js +0 -1
- package/dist/_vendor/core/dist/broker/semantic-adjudication/policy.js +0 -122
- package/dist/_vendor/core/dist/broker/semantic-contract.js +0 -1
- package/dist/_vendor/core/dist/broker/shared-delivery-commit.js +0 -177
- package/dist/_vendor/core/dist/broker/shared-delivery-saga.js +0 -187
- package/dist/_vendor/core/dist/broker/shared-surface-queue.js +0 -185
- package/dist/_vendor/core/dist/broker/shared-write-provenance-policy.js +0 -252
- package/dist/_vendor/core/dist/broker/steward-transactional-apply.js +0 -369
- package/dist/_vendor/core/dist/broker/steward.js +0 -464
- package/dist/_vendor/core/dist/broker/team-lane/support.js +0 -186
- package/dist/_vendor/core/dist/broker/team-lane.js +0 -357
- package/dist/_vendor/core/dist/broker/team-wave-admission.js +0 -111
- package/dist/_vendor/core/dist/broker/team-wave-checkpoint.js +0 -52
- package/dist/_vendor/core/dist/broker/team-wave-envelope.js +0 -59
- package/dist/_vendor/core/dist/broker/team-wave-evidence.js +0 -56
- package/dist/_vendor/core/dist/broker/team-wave-planner.js +0 -142
- package/dist/_vendor/core/dist/broker/team-worker-report.js +0 -63
- package/dist/_vendor/core/dist/broker/terminal-history-entitlement.js +0 -79
- package/dist/_vendor/core/dist/broker/test-case-contribution.js +0 -142
- package/dist/_vendor/core/dist/broker/ticket-authority/index.js +0 -114
- package/dist/_vendor/core/dist/broker/ticket-policy.js +0 -65
- package/dist/_vendor/core/dist/broker/ticket-state.js +0 -106
- package/dist/_vendor/core/dist/broker/ticket-store.js +0 -476
- package/dist/_vendor/core/dist/broker/transaction-authority.js +0 -125
- package/dist/_vendor/core/dist/broker/transactional-composer.js +0 -205
- package/dist/_vendor/core/dist/broker/types.js +0 -27
- package/dist/_vendor/core/dist/broker/unified-patch.js +0 -116
- package/dist/_vendor/core/dist/broker/wave-broker-scheduler.js +0 -190
- package/dist/_vendor/core/dist/broker/wave-generated-executor.js +0 -194
- package/dist/_vendor/core/dist/broker/wave-manifest.js +0 -138
- package/dist/_vendor/core/dist/broker/work-admission-ticket.js +0 -301
- package/dist/_vendor/core/dist/broker/workspace-topology-policy.js +0 -46
- package/dist/_vendor/core/dist/broker/write-scope-policy.js +0 -220
- package/dist/_vendor/core/dist/broker/write-ticket.js +0 -61
- package/dist/_vendor/core/dist/cache/guide-cache.js +0 -234
- package/dist/_vendor/core/dist/commit-attribution/sealed-commit-bundle.js +0 -209
- package/dist/_vendor/core/dist/commit-candidate/commit-candidate-store.js +0 -96
- package/dist/_vendor/core/dist/commit-candidate/commit-candidate.js +0 -134
- package/dist/_vendor/core/dist/daemon/daemon-config.js +0 -143
- package/dist/_vendor/core/dist/daemon/daemon-watcher.js +0 -150
- package/dist/_vendor/core/dist/equivalence/run-map-equivalence.js +0 -358
- package/dist/_vendor/core/dist/error-code-registry.generated.js +0 -3
- package/dist/_vendor/core/dist/evidence/acceptance-predicate.js +0 -109
- package/dist/_vendor/core/dist/evidence/acceptance-spec-mutation.js +0 -22
- package/dist/_vendor/core/dist/evidence/adapter-parity.js +0 -91
- package/dist/_vendor/core/dist/evidence/anti-gaming-control.js +0 -20
- package/dist/_vendor/core/dist/evidence/causal-neighborhood.js +0 -17
- package/dist/_vendor/core/dist/evidence/closure-assurance-machine.js +0 -248
- package/dist/_vendor/core/dist/evidence/complexity-interface-size.js +0 -17
- package/dist/_vendor/core/dist/evidence/concurrency-fuzz-generators.js +0 -22
- package/dist/_vendor/core/dist/evidence/concurrency-schedule-obligations.js +0 -67
- package/dist/_vendor/core/dist/evidence/constraint-solver.js +0 -137
- package/dist/_vendor/core/dist/evidence/coverage-certificate.js +0 -24
- package/dist/_vendor/core/dist/evidence/coverage-ratchet-baseline.js +0 -47
- package/dist/_vendor/core/dist/evidence/coverage-semantics.js +0 -94
- package/dist/_vendor/core/dist/evidence/coverage-universe-compiler.js +0 -204
- package/dist/_vendor/core/dist/evidence/dependency-graph-bypass-gate.js +0 -98
- package/dist/_vendor/core/dist/evidence/diagnostic-loop.js +0 -145
- package/dist/_vendor/core/dist/evidence/diff-evidence.js +0 -200
- package/dist/_vendor/core/dist/evidence/evidence-freshness-certificate.js +0 -39
- package/dist/_vendor/core/dist/evidence/evidence-ledger.js +0 -49
- package/dist/_vendor/core/dist/evidence/example-branch-generators.js +0 -27
- package/dist/_vendor/core/dist/evidence/fault-fingerprint.js +0 -56
- package/dist/_vendor/core/dist/evidence/four-plan-independent-certificate.js +0 -291
- package/dist/_vendor/core/dist/evidence/gap-planning.js +0 -105
- package/dist/_vendor/core/dist/evidence/git-boundary-evidence.js +0 -61
- package/dist/_vendor/core/dist/evidence/governance-model-adapters.js +0 -43
- package/dist/_vendor/core/dist/evidence/hostile-dogfood.js +0 -136
- package/dist/_vendor/core/dist/evidence/index.js +0 -50
- package/dist/_vendor/core/dist/evidence/legal-recovery-checkpoints.js +0 -46
- package/dist/_vendor/core/dist/evidence/mutation-lineage.js +0 -321
- package/dist/_vendor/core/dist/evidence/obligation-inventory.js +0 -144
- package/dist/_vendor/core/dist/evidence/observed-source-adapters.js +0 -9
- package/dist/_vendor/core/dist/evidence/observed-source.js +0 -68
- package/dist/_vendor/core/dist/evidence/oracle-adjudication.js +0 -18
- package/dist/_vendor/core/dist/evidence/performance-resilience-ratchet.js +0 -62
- package/dist/_vendor/core/dist/evidence/phase-suite.js +0 -128
- package/dist/_vendor/core/dist/evidence/plan-closeout-dashboard.js +0 -124
- package/dist/_vendor/core/dist/evidence/property-metamorphic-generators.js +0 -103
- package/dist/_vendor/core/dist/evidence/quality-authority.js +0 -16
- package/dist/_vendor/core/dist/evidence/quality-gauntlet.js +0 -162
- package/dist/_vendor/core/dist/evidence/quality-vector.js +0 -12
- package/dist/_vendor/core/dist/evidence/realness.js +0 -116
- package/dist/_vendor/core/dist/evidence/regression-family.js +0 -69
- package/dist/_vendor/core/dist/evidence/sandboxed-test-patch.js +0 -65
- package/dist/_vendor/core/dist/evidence/security-quality-receipts.js +0 -53
- package/dist/_vendor/core/dist/evidence/shadow-comparison.js +0 -147
- package/dist/_vendor/core/dist/evidence/state-replay.js +0 -109
- package/dist/_vendor/core/dist/evidence/structural-coverage.js +0 -106
- package/dist/_vendor/core/dist/evidence/tdd-cycle.js +0 -285
- package/dist/_vendor/core/dist/evidence/test-case-catalog.js +0 -427
- package/dist/_vendor/core/dist/evidence/validation-contract.js +0 -350
- package/dist/_vendor/core/dist/evidence/validation-receipt.js +0 -315
- package/dist/_vendor/core/dist/evidence/validator-catalog-selection.js +0 -221
- package/dist/_vendor/core/dist/evidence/validator-lifecycle.js +0 -160
- package/dist/_vendor/core/dist/evidence/wave-exit-observer-input-digest.js +0 -107
- package/dist/_vendor/core/dist/evidence/wave-exit-observer-receipt-writer.js +0 -288
- package/dist/_vendor/core/dist/evidence/wave-exit-observer-receipt.js +0 -445
- package/dist/_vendor/core/dist/git/admission.js +0 -376
- package/dist/_vendor/core/dist/git/diff-mutation-request.js +0 -161
- package/dist/_vendor/core/dist/git/format-adapter-bridge.js +0 -370
- package/dist/_vendor/core/dist/git/index.js +0 -4
- package/dist/_vendor/core/dist/git/publication-delivery-slice.js +0 -180
- package/dist/_vendor/core/dist/governance/operation-cleanup-contract.js +0 -47
- package/dist/_vendor/core/dist/governance/scope-lock.js +0 -284
- package/dist/_vendor/core/dist/guidance/first-layer-command-contracts.js +0 -172
- package/dist/_vendor/core/dist/guidance/guidance-packet.js +0 -73
- package/dist/_vendor/core/dist/guidance/index.js +0 -8
- package/dist/_vendor/core/dist/guidance/intent-classifier.js +0 -495
- package/dist/_vendor/core/dist/guidance/legacy-route-plan.js +0 -317
- package/dist/_vendor/core/dist/guidance/mutation-gate.js +0 -120
- package/dist/_vendor/core/dist/guidance/project-probe.js +0 -370
- package/dist/_vendor/core/dist/guidance/route-engine.js +0 -253
- package/dist/_vendor/core/dist/guidance/session-store.js +0 -104
- package/dist/_vendor/core/dist/hash-lock/hash-lock.js +0 -89
- package/dist/_vendor/core/dist/index.js +0 -26
- package/dist/_vendor/core/dist/lane/lane-capability-provider.js +0 -242
- package/dist/_vendor/core/dist/lane/lifecycle.js +0 -62
- package/dist/_vendor/core/dist/lane/wip-ownership-transition.js +0 -134
- package/dist/_vendor/core/dist/manager/atom-generator.js +0 -455
- package/dist/_vendor/core/dist/manager/atom-space.js +0 -41
- package/dist/_vendor/core/dist/manager/id-allocator.js +0 -80
- package/dist/_vendor/core/dist/manager/map-generator/errors.js +0 -15
- package/dist/_vendor/core/dist/manager/map-generator/normalize-fields.js +0 -70
- package/dist/_vendor/core/dist/manager/map-generator/normalize-lineage.js +0 -76
- package/dist/_vendor/core/dist/manager/map-generator/runtime-support.js +0 -194
- package/dist/_vendor/core/dist/manager/map-generator/spec-support.js +0 -164
- package/dist/_vendor/core/dist/manager/map-generator/types.js +0 -1
- package/dist/_vendor/core/dist/manager/map-generator.js +0 -151
- package/dist/_vendor/core/dist/manager/map-id-allocator.js +0 -68
- package/dist/_vendor/core/dist/manager/scaffold.js +0 -144
- package/dist/_vendor/core/dist/manager/test-runner/report-support.js +0 -212
- package/dist/_vendor/core/dist/manager/test-runner.js +0 -417
- package/dist/_vendor/core/dist/maps/atom-memo-cache.js +0 -102
- package/dist/_vendor/core/dist/maps/edge-contract-runner.js +0 -133
- package/dist/_vendor/core/dist/maps/fingerprint-checker.js +0 -81
- package/dist/_vendor/core/dist/maps/map-health-report.js +0 -137
- package/dist/_vendor/core/dist/maps/mermaid-gen.js +0 -55
- package/dist/_vendor/core/dist/maps/shadow-comparator.js +0 -127
- package/dist/_vendor/core/dist/police/constants.js +0 -2
- package/dist/_vendor/core/dist/police/dependency-graph.js +0 -109
- package/dist/_vendor/core/dist/police/family.js +0 -295
- package/dist/_vendor/core/dist/police/forbidden-import-scanner.js +0 -72
- package/dist/_vendor/core/dist/police/index.js +0 -41
- package/dist/_vendor/core/dist/police/layer-boundary.js +0 -94
- package/dist/_vendor/core/dist/police/registry-consistency.js +0 -52
- package/dist/_vendor/core/dist/police/regression-compare.js +0 -197
- package/dist/_vendor/core/dist/police/rescue-family.js +0 -299
- package/dist/_vendor/core/dist/police/role-registry.js +0 -29
- package/dist/_vendor/core/dist/police/roles/adopter-neutrality.js +0 -44
- package/dist/_vendor/core/dist/police/roles/atomization.js +0 -81
- package/dist/_vendor/core/dist/police/roles/decomposition.js +0 -115
- package/dist/_vendor/core/dist/police/roles/dedup.js +0 -84
- package/dist/_vendor/core/dist/police/roles/demand.js +0 -40
- package/dist/_vendor/core/dist/police/roles/evidence-integrity.js +0 -107
- package/dist/_vendor/core/dist/police/roles/evolution.js +0 -115
- package/dist/_vendor/core/dist/police/roles/map-integration.js +0 -77
- package/dist/_vendor/core/dist/police/roles/noise-control.js +0 -45
- package/dist/_vendor/core/dist/police/roles/polymorph.js +0 -143
- package/dist/_vendor/core/dist/police/roles/quality.js +0 -85
- package/dist/_vendor/core/dist/police/roles/reversibility.js +0 -48
- package/dist/_vendor/core/dist/police/roles/rollback.js +0 -98
- package/dist/_vendor/core/dist/police/schema-validator.js +0 -84
- package/dist/_vendor/core/dist/police/shared.js +0 -103
- package/dist/_vendor/core/dist/police/suppression-keys.js +0 -22
- package/dist/_vendor/core/dist/police/types.js +0 -1
- package/dist/_vendor/core/dist/polymorph/dimension-detector.js +0 -41
- package/dist/_vendor/core/dist/polymorph/impact.js +0 -226
- package/dist/_vendor/core/dist/polymorph/template.js +0 -60
- package/dist/_vendor/core/dist/registry/atom-capsule.js +0 -147
- package/dist/_vendor/core/dist/registry/atom-ref-readability/callsites.js +0 -131
- package/dist/_vendor/core/dist/registry/atom-ref-readability/catalog.js +0 -201
- package/dist/_vendor/core/dist/registry/atom-ref-readability/files.js +0 -51
- package/dist/_vendor/core/dist/registry/atom-ref-readability/render.js +0 -84
- package/dist/_vendor/core/dist/registry/atom-ref-readability/reports.js +0 -46
- package/dist/_vendor/core/dist/registry/atom-ref-readability/types.js +0 -32
- package/dist/_vendor/core/dist/registry/atom-ref-readability.js +0 -95
- package/dist/_vendor/core/dist/registry/atom-runtime.generated.js +0 -48
- package/dist/_vendor/core/dist/registry/atom-runtime.js +0 -42
- package/dist/_vendor/core/dist/registry/capsule-registry.js +0 -119
- package/dist/_vendor/core/dist/registry/catalog-category-deriver.js +0 -60
- package/dist/_vendor/core/dist/registry/decomposition-plan.js +0 -332
- package/dist/_vendor/core/dist/registry/diff.js +0 -275
- package/dist/_vendor/core/dist/registry/map-capsule-registry.js +0 -75
- package/dist/_vendor/core/dist/registry/map-capsule.js +0 -116
- package/dist/_vendor/core/dist/registry/map-hash.js +0 -53
- package/dist/_vendor/core/dist/registry/map-registry.js +0 -81
- package/dist/_vendor/core/dist/registry/progression-policy.js +0 -229
- package/dist/_vendor/core/dist/registry/registry/document.js +0 -53
- package/dist/_vendor/core/dist/registry/registry/drift.js +0 -61
- package/dist/_vendor/core/dist/registry/registry/entry.js +0 -150
- package/dist/_vendor/core/dist/registry/registry/paths.js +0 -67
- package/dist/_vendor/core/dist/registry/registry/types.js +0 -1
- package/dist/_vendor/core/dist/registry/registry/validation.js +0 -400
- package/dist/_vendor/core/dist/registry/registry-catalog.js +0 -171
- package/dist/_vendor/core/dist/registry/registry-index.js +0 -183
- package/dist/_vendor/core/dist/registry/registry-migration.js +0 -71
- package/dist/_vendor/core/dist/registry/registry.js +0 -6
- package/dist/_vendor/core/dist/registry/replacement-lane/constants.js +0 -20
- package/dist/_vendor/core/dist/registry/replacement-lane/evidence.js +0 -162
- package/dist/_vendor/core/dist/registry/replacement-lane/support.js +0 -88
- package/dist/_vendor/core/dist/registry/replacement-lane/target.js +0 -62
- package/dist/_vendor/core/dist/registry/replacement-lane/transition.js +0 -102
- package/dist/_vendor/core/dist/registry/replacement-lane/types.js +0 -5
- package/dist/_vendor/core/dist/registry/replacement-lane/validation.js +0 -128
- package/dist/_vendor/core/dist/registry/replacement-lane.js +0 -2
- package/dist/_vendor/core/dist/registry/retirement-proof.js +0 -71
- package/dist/_vendor/core/dist/registry/rollback-map.js +0 -91
- package/dist/_vendor/core/dist/registry/rollback-proof.js +0 -66
- package/dist/_vendor/core/dist/registry/rollback-registry-helpers.js +0 -18
- package/dist/_vendor/core/dist/registry/rollback-types.js +0 -6
- package/dist/_vendor/core/dist/registry/rollback.js +0 -156
- package/dist/_vendor/core/dist/registry/semantic-fingerprint.js +0 -93
- package/dist/_vendor/core/dist/registry/status-machine.js +0 -293
- package/dist/_vendor/core/dist/registry/status-migration.js +0 -33
- package/dist/_vendor/core/dist/registry/urn.js +0 -179
- package/dist/_vendor/core/dist/rescue/atom-reloader.js +0 -96
- package/dist/_vendor/core/dist/rescue/disaster-recovery.js +0 -156
- package/dist/_vendor/core/dist/rescue/lineage-replayer.js +0 -81
- package/dist/_vendor/core/dist/rescue/registry-rebuilder.js +0 -176
- package/dist/_vendor/core/dist/routing/index.js +0 -1
- package/dist/_vendor/core/dist/routing/route-context.js +0 -150
- package/dist/_vendor/core/dist/schemas/broker-ticket.js +0 -1
- package/dist/_vendor/core/dist/schemas/command-manifest.js +0 -1
- package/dist/_vendor/core/dist/schemas/linked-surface-closure.js +0 -1
- package/dist/_vendor/core/dist/schemas/parallel-replay-scenario.js +0 -1
- package/dist/_vendor/core/dist/scope/linked-surface/index.js +0 -125
- package/dist/_vendor/core/dist/skills/engineering-change-method.js +0 -106
- package/dist/_vendor/core/dist/skills/incident-learning-candidate.js +0 -150
- package/dist/_vendor/core/dist/skills/index.js +0 -2
- package/dist/_vendor/core/dist/source-inventory/source-inventory.js +0 -64
- package/dist/_vendor/core/dist/spec/parse-spec/types.js +0 -1
- package/dist/_vendor/core/dist/spec/parse-spec.js +0 -416
- package/dist/_vendor/core/dist/team-agents/index.js +0 -1
- package/dist/_vendor/core/dist/team-agents/restricted-execution-gateway.js +0 -413
- package/dist/_vendor/core/dist/team-agents/worker-executor.js +0 -158
- package/dist/_vendor/core/dist/team-runtime/context-manifest.js +0 -27
- package/dist/_vendor/core/dist/team-runtime/contribution-manifest.js +0 -31
- package/dist/_vendor/core/dist/team-runtime/execution-orchestrator.js +0 -55
- package/dist/_vendor/core/dist/team-runtime/handoff-ledger.js +0 -153
- package/dist/_vendor/core/dist/team-runtime/nodejs-worker-adapter.js +0 -78
- package/dist/_vendor/core/dist/team-runtime/observability.js +0 -148
- package/dist/_vendor/core/dist/team-runtime/permission-broker.js +0 -247
- package/dist/_vendor/core/dist/team-runtime/pricing/cost-accounting.js +0 -97
- package/dist/_vendor/core/dist/team-runtime/provider-contract.js +0 -59
- package/dist/_vendor/core/dist/team-runtime/provider-registry.js +0 -48
- package/dist/_vendor/core/dist/team-runtime/provider-selection.js +0 -122
- package/dist/_vendor/core/dist/team-runtime/providers/anthropic.js +0 -184
- package/dist/_vendor/core/dist/team-runtime/providers/azure-openai.js +0 -235
- package/dist/_vendor/core/dist/team-runtime/providers/claude-code.js +0 -307
- package/dist/_vendor/core/dist/team-runtime/providers/gemini-direct.js +0 -107
- package/dist/_vendor/core/dist/team-runtime/providers/gemini.js +0 -154
- package/dist/_vendor/core/dist/team-runtime/providers/microsoft-foundry.js +0 -254
- package/dist/_vendor/core/dist/team-runtime/providers/openai.js +0 -394
- package/dist/_vendor/core/dist/telemetry/broker/decision-outcome.js +0 -350
- package/dist/_vendor/core/dist/telemetry/broker/index.js +0 -1
- package/dist/_vendor/core/dist/telemetry/compact-receipts.js +0 -105
- package/dist/_vendor/core/dist/telemetry/index.js +0 -353
- package/dist/_vendor/core/dist/telemetry/observation.js +0 -123
- package/dist/_vendor/core/dist/telemetry/parallel-replay/index.js +0 -61
- package/dist/_vendor/core/dist/telemetry/shared-write-coverage.js +0 -52
- package/dist/_vendor/core/dist/test-runner/map-integration.js +0 -197
- package/dist/_vendor/core/dist/test-runner/metrics-collector.js +0 -33
- package/dist/_vendor/core/dist/test-runner/propagation.js +0 -217
- package/dist/_vendor/core/dist/upgrade/behaviors/reshape.js +0 -248
- package/dist/_vendor/core/dist/upgrade/behaviors/retire.js +0 -170
- package/dist/_vendor/core/dist/upgrade/decomposition-decision.js +0 -54
- package/dist/_vendor/core/dist/upgrade/evolution-draft.js +0 -208
- package/dist/_vendor/core/dist/upgrade/map-curator/types.js +0 -1
- package/dist/_vendor/core/dist/upgrade/map-curator.js +0 -458
- package/dist/_vendor/core/dist/upgrade/map-propose.js +0 -94
- package/dist/_vendor/core/dist/upgrade/metrics-to-proposal.js +0 -126
- package/dist/_vendor/core/dist/upgrade/propose/failure-reason.js +0 -33
- package/dist/_vendor/core/dist/upgrade/propose/gates.js +0 -392
- package/dist/_vendor/core/dist/upgrade/propose/normalize-input.js +0 -183
- package/dist/_vendor/core/dist/upgrade/propose.js +0 -363
- package/dist/_vendor/core/dist/validation/ajv-factory.js +0 -38
- package/dist/_vendor/integration-claude-code/dist/index.js +0 -20
- package/dist/_vendor/integration-codex/dist/index.js +0 -20
- package/dist/_vendor/integration-copilot/dist/index.js +0 -20
- package/dist/_vendor/integration-cursor/dist/index.js +0 -20
- package/dist/_vendor/integration-gemini/dist/index.js +0 -96
- package/dist/_vendor/integrations-core/dist/compiler/charter-block.js +0 -138
- package/dist/_vendor/integrations-core/dist/compiler/compile.js +0 -285
- package/dist/_vendor/integrations-core/dist/compiler/skill-projection-parity.js +0 -148
- package/dist/_vendor/integrations-core/dist/compiler/skill-source-universe.js +0 -104
- package/dist/_vendor/integrations-core/dist/compiler/skill-templates.js +0 -354
- package/dist/_vendor/integrations-core/dist/distribution/editor-global-overlay.js +0 -230
- package/dist/_vendor/integrations-core/dist/distribution/external-skill-catalog.js +0 -332
- package/dist/_vendor/integrations-core/dist/distribution/install-profile.js +0 -71
- package/dist/_vendor/integrations-core/dist/distribution/skill-catalog.js +0 -39
- package/dist/_vendor/integrations-core/dist/distribution/skill-distribution-manager.js +0 -102
- package/dist/_vendor/integrations-core/dist/index.js +0 -30
- package/dist/_vendor/integrations-core/dist/manifest/construct.js +0 -157
- package/dist/_vendor/integrations-core/dist/manifest/schema.js +0 -43
- package/dist/_vendor/integrations-core/dist/manifest/types.js +0 -1
- package/dist/_vendor/integrations-core/dist/verify/types.js +0 -9
- package/dist/_vendor/integrations-core/dist/verify/uninstall-safety.js +0 -63
- package/dist/_vendor/integrations-core/dist/verify/verify-installed.js +0 -45
- package/dist/_vendor/language-csharp/dist/index.js +0 -16
- package/dist/_vendor/language-csharp/dist/language-csharp-adapter.js +0 -240
- package/dist/_vendor/language-js/dist/index.js +0 -16
- package/dist/_vendor/language-js/dist/language-js-adapter.js +0 -423
- package/dist/_vendor/language-python/dist/index.js +0 -19
- package/dist/_vendor/language-python/dist/language-python-adapter/planning.js +0 -197
- package/dist/_vendor/language-python/dist/language-python-adapter/profile.js +0 -199
- package/dist/_vendor/language-python/dist/language-python-adapter/scanner.js +0 -77
- package/dist/_vendor/language-python/dist/language-python-adapter/shared.js +0 -37
- package/dist/_vendor/language-python/dist/language-python-adapter/validation.js +0 -42
- package/dist/_vendor/language-python/dist/language-python-adapter.js +0 -37
- package/dist/_vendor/plugin-experience-loop/dist/index.js +0 -411
- package/dist/_vendor/plugin-governance-local/dist/bootstrap/bootstrap/bootstrap-support.js +0 -462
- package/dist/_vendor/plugin-governance-local/dist/bootstrap/bootstrap/implementation.js +0 -483
- package/dist/_vendor/plugin-governance-local/dist/bootstrap/bootstrap/root-entry-patching.js +0 -129
- package/dist/_vendor/plugin-governance-local/dist/bootstrap/bootstrap.js +0 -1
- package/dist/_vendor/plugin-governance-local/dist/bootstrap/budget.js +0 -75
- package/dist/_vendor/plugin-governance-local/dist/bootstrap/prompt.js +0 -101
- package/dist/_vendor/plugin-governance-local/dist/bootstrap/types.js +0 -1
- package/dist/_vendor/plugin-governance-local/dist/default-guards.js +0 -51
- package/dist/_vendor/plugin-governance-local/dist/index.js +0 -23
- package/dist/_vendor/plugin-governance-local/dist/layout.js +0 -22
- package/dist/_vendor/plugin-governance-local/dist/stores/helpers.js +0 -293
- package/dist/_vendor/plugin-governance-local/dist/stores.js +0 -484
- package/dist/_vendor/plugin-governance-local/dist/versioning.js +0 -68
- package/dist/_vendor/plugin-human-review/dist/decision-log.js +0 -130
- package/dist/_vendor/plugin-human-review/dist/index.js +0 -8
- package/dist/_vendor/plugin-human-review/dist/map-curator-bridge.js +0 -67
- package/dist/_vendor/plugin-human-review/dist/queue.js +0 -196
- package/dist/_vendor/plugin-review-advisory/dist/conversation-machine-findings.js +0 -191
- package/dist/_vendor/plugin-review-advisory/dist/deep-module-provider.js +0 -99
- package/dist/_vendor/plugin-review-advisory/dist/index.js +0 -306
- package/dist/_vendor/plugin-review-advisory/dist/promotion-gates.js +0 -145
- package/dist/_vendor/plugin-rule-guard/dist/index.js +0 -8
- package/dist/_vendor/plugin-rule-guard/dist/lifecycle-police.js +0 -116
- package/dist/_vendor/plugin-rule-guard/dist/neutrality-scanner.js +0 -188
- package/dist/_vendor/plugin-rule-guard/dist/rule-justification.js +0 -27
- package/dist/_vendor/plugin-sdk/dist/atomization-planning.js +0 -157
- package/dist/_vendor/plugin-sdk/dist/behavior-registry.js +0 -145
- package/dist/_vendor/plugin-sdk/dist/behavior.js +0 -6
- package/dist/_vendor/plugin-sdk/dist/capability.js +0 -1
- package/dist/_vendor/plugin-sdk/dist/conversation/conversation-evidence-extractor.js +0 -130
- package/dist/_vendor/plugin-sdk/dist/conversation/conversation-feedback-loop.js +0 -178
- package/dist/_vendor/plugin-sdk/dist/conversation/conversation-patch-draft-bridge.js +0 -246
- package/dist/_vendor/plugin-sdk/dist/conversation/conversation-review-finding.js +0 -6
- package/dist/_vendor/plugin-sdk/dist/conversation/conversation-transcript-reviewer.js +0 -177
- package/dist/_vendor/plugin-sdk/dist/conversation/index.js +0 -5
- package/dist/_vendor/plugin-sdk/dist/detector/evidence-pattern-detector.js +0 -184
- package/dist/_vendor/plugin-sdk/dist/detector/index.js +0 -1
- package/dist/_vendor/plugin-sdk/dist/effect-node.js +0 -1
- package/dist/_vendor/plugin-sdk/dist/external-task-source.js +0 -1
- package/dist/_vendor/plugin-sdk/dist/governance/index.js +0 -1
- package/dist/_vendor/plugin-sdk/dist/governance/layout.js +0 -17
- package/dist/_vendor/plugin-sdk/dist/governance/stores.js +0 -1
- package/dist/_vendor/plugin-sdk/dist/index.js +0 -12
- package/dist/_vendor/plugin-sdk/dist/injector-plugin.js +0 -1
- package/dist/_vendor/plugin-sdk/dist/language-adapter.js +0 -1
- package/dist/_vendor/plugin-sdk/dist/lifecycle.js +0 -5
- package/dist/_vendor/plugin-sdk/dist/police.js +0 -1
- package/dist/_vendor/plugin-sdk/dist/project-adapter.js +0 -1
- package/dist/_vendor/plugin-sdk/dist/test-runner.js +0 -1
- package/dist/atm.js +0 -328
- package/dist/commands/actor-registry.js +0 -359
- package/dist/commands/actor-session.js +0 -214
- package/dist/commands/actor.js +0 -342
- package/dist/commands/agent-confidence.js +0 -137
- package/dist/commands/agent-pack.js +0 -327
- package/dist/commands/atm-chart/compatibility.js +0 -287
- package/dist/commands/atm-chart/constants.js +0 -60
- package/dist/commands/atm-chart/render-verify.js +0 -276
- package/dist/commands/atm-chart/semver.js +0 -62
- package/dist/commands/atm-chart/types.js +0 -1
- package/dist/commands/atm-chart.js +0 -49
- package/dist/commands/atom-capsule.js +0 -265
- package/dist/commands/atom-ref.js +0 -71
- package/dist/commands/atomize.js +0 -338
- package/dist/commands/baseline.js +0 -285
- package/dist/commands/batch/checkpoint-commit-window-policy.js +0 -22
- package/dist/commands/batch/deliver-and-close-forwarding.js +0 -60
- package/dist/commands/batch/implementation.js +0 -861
- package/dist/commands/batch/plan-executor.js +0 -314
- package/dist/commands/batch/runner-recovery-forwarding.js +0 -47
- package/dist/commands/batch.js +0 -1
- package/dist/commands/bootstrap-entry.js +0 -32
- package/dist/commands/bootstrap.js +0 -8
- package/dist/commands/broker/batch-execute-actions.js +0 -506
- package/dist/commands/broker/broker-decision-observation.js +0 -1
- package/dist/commands/broker/census/index.js +0 -4
- package/dist/commands/broker/implementation.js +0 -59
- package/dist/commands/broker/migrate/implementation.js +0 -114
- package/dist/commands/broker/mutation-helpers.js +0 -105
- package/dist/commands/broker/parallel-admission/closure-observation.js +0 -92
- package/dist/commands/broker/parallel-admission/final-verdict.js +0 -168
- package/dist/commands/broker/parser.js +0 -495
- package/dist/commands/broker/persistence.js +0 -73
- package/dist/commands/broker/plan-batch-action.js +0 -178
- package/dist/commands/broker/policy-actions.js +0 -64
- package/dist/commands/broker/post-compose-semantic-validation.js +0 -143
- package/dist/commands/broker/proposal-actions.js +0 -149
- package/dist/commands/broker/publication-takeover-admission.js +0 -36
- package/dist/commands/broker/reconcile/implementation.js +0 -35
- package/dist/commands/broker/registry-actions.js +0 -309
- package/dist/commands/broker/replay/closure-policy.js +0 -332
- package/dist/commands/broker/replay/command-backed-matrix.js +0 -59
- package/dist/commands/broker/replay/dashboard-lifecycle-observations.js +0 -90
- package/dist/commands/broker/replay/dashboard-ticket-observations.js +0 -41
- package/dist/commands/broker/replay/dashboard-view-model.js +0 -203
- package/dist/commands/broker/replay/dashboard.js +0 -31
- package/dist/commands/broker/replay/dogfood-orchestrator.js +0 -117
- package/dist/commands/broker/replay/final-closure-reader.js +0 -181
- package/dist/commands/broker/replay/implementation.js +0 -264
- package/dist/commands/broker/replay/run-manifest.js +0 -26
- package/dist/commands/broker/replay-actions.js +0 -198
- package/dist/commands/broker/runner-sync-supersession.js +0 -6
- package/dist/commands/broker/shared-delivery-commit-transaction.js +0 -155
- package/dist/commands/broker/shared-surface.js +0 -260
- package/dist/commands/broker/steward-queues.js +0 -542
- package/dist/commands/broker/steward-runtime-actions.js +0 -295
- package/dist/commands/broker/types.js +0 -1
- package/dist/commands/broker/wave-scheduler-actions.js +0 -73
- package/dist/commands/broker-conflict-resolution.js +0 -66
- package/dist/commands/broker.js +0 -1
- package/dist/commands/budget.js +0 -108
- package/dist/commands/build-release-hygiene.js +0 -94
- package/dist/commands/cache.js +0 -235
- package/dist/commands/candidates.js +0 -509
- package/dist/commands/cleanup/index.js +0 -1
- package/dist/commands/cleanup/run.js +0 -38
- package/dist/commands/command-specs/_common.js +0 -24
- package/dist/commands/command-specs/actor.spec.js +0 -33
- package/dist/commands/command-specs/agent-pack.spec.js +0 -24
- package/dist/commands/command-specs/atm-chart.spec.js +0 -21
- package/dist/commands/command-specs/atom-capsule.spec.js +0 -30
- package/dist/commands/command-specs/atom-ref.spec.js +0 -20
- package/dist/commands/command-specs/atomize.spec.js +0 -40
- package/dist/commands/command-specs/baseline.spec.js +0 -25
- package/dist/commands/command-specs/batch.spec.js +0 -59
- package/dist/commands/command-specs/bootstrap.spec.js +0 -19
- package/dist/commands/command-specs/broker.spec.js +0 -95
- package/dist/commands/command-specs/budget.spec.js +0 -23
- package/dist/commands/command-specs/cache.spec.js +0 -24
- package/dist/commands/command-specs/candidates.spec.js +0 -24
- package/dist/commands/command-specs/cleanup.spec.js +0 -21
- package/dist/commands/command-specs/create-map.spec.js +0 -25
- package/dist/commands/command-specs/create.spec.js +0 -20
- package/dist/commands/command-specs/daemon.spec.js +0 -22
- package/dist/commands/command-specs/doctor.spec.js +0 -18
- package/dist/commands/command-specs/emergency.spec.js +0 -34
- package/dist/commands/command-specs/evidence.spec.js +0 -104
- package/dist/commands/command-specs/experience.spec.js +0 -26
- package/dist/commands/command-specs/explain.spec.js +0 -18
- package/dist/commands/command-specs/framework-mode.spec.js +0 -28
- package/dist/commands/command-specs/git-hooks.spec.js +0 -21
- package/dist/commands/command-specs/git.spec.js +0 -84
- package/dist/commands/command-specs/guard.spec.js +0 -30
- package/dist/commands/command-specs/guide.spec.js +0 -34
- package/dist/commands/command-specs/handoff.spec.js +0 -19
- package/dist/commands/command-specs/health-report.spec.js +0 -16
- package/dist/commands/command-specs/hook.spec.js +0 -22
- package/dist/commands/command-specs/identity.spec.js +0 -34
- package/dist/commands/command-specs/init.spec.js +0 -21
- package/dist/commands/command-specs/integration.spec.js +0 -43
- package/dist/commands/command-specs/internal-release.spec.js +0 -30
- package/dist/commands/command-specs/lane.spec.js +0 -32
- package/dist/commands/command-specs/lock.spec.js +0 -21
- package/dist/commands/command-specs/map-capsule.spec.js +0 -27
- package/dist/commands/command-specs/migrate.spec.js +0 -23
- package/dist/commands/command-specs/next.spec.js +0 -68
- package/dist/commands/command-specs/orient.spec.js +0 -15
- package/dist/commands/command-specs/plan.spec.js +0 -58
- package/dist/commands/command-specs/police.spec.js +0 -22
- package/dist/commands/command-specs/quickfix.spec.js +0 -21
- package/dist/commands/command-specs/registry-diff.spec.js +0 -21
- package/dist/commands/command-specs/registry.spec.js +0 -35
- package/dist/commands/command-specs/replacement-lane.spec.js +0 -25
- package/dist/commands/command-specs/rescue.spec.js +0 -29
- package/dist/commands/command-specs/residue.spec.js +0 -37
- package/dist/commands/command-specs/review-advisory.spec.js +0 -27
- package/dist/commands/command-specs/review.spec.js +0 -28
- package/dist/commands/command-specs/rollback.spec.js +0 -29
- package/dist/commands/command-specs/route.spec.js +0 -43
- package/dist/commands/command-specs/self-host-alpha.spec.js +0 -18
- package/dist/commands/command-specs/spec.spec.js +0 -17
- package/dist/commands/command-specs/start.spec.js +0 -22
- package/dist/commands/command-specs/status.spec.js +0 -16
- package/dist/commands/command-specs/task-view.spec.js +0 -18
- package/dist/commands/command-specs/taskflow.spec.js +0 -77
- package/dist/commands/command-specs/tasks.spec.js +0 -157
- package/dist/commands/command-specs/team.spec.js +0 -159
- package/dist/commands/command-specs/telemetry.spec.js +0 -55
- package/dist/commands/command-specs/test.spec.js +0 -39
- package/dist/commands/command-specs/upgrade.spec.js +0 -62
- package/dist/commands/command-specs/validate.spec.js +0 -28
- package/dist/commands/command-specs/verify.spec.js +0 -20
- package/dist/commands/command-specs/welcome.spec.js +0 -18
- package/dist/commands/command-specs/write-ticket.spec.js +0 -34
- package/dist/commands/command-specs.js +0 -150
- package/dist/commands/create-map.js +0 -285
- package/dist/commands/create.js +0 -106
- package/dist/commands/daemon.js +0 -268
- package/dist/commands/doctor/constants.js +0 -76
- package/dist/commands/doctor/lifecycle.js +0 -123
- package/dist/commands/doctor/policy.js +0 -114
- package/dist/commands/doctor/readiness.js +0 -114
- package/dist/commands/doctor/run-doctor.js +0 -356
- package/dist/commands/doctor/types.js +0 -1
- package/dist/commands/doctor/utilities.js +0 -120
- package/dist/commands/doctor.js +0 -1
- package/dist/commands/emergency/context.js +0 -21
- package/dist/commands/emergency/gate.js +0 -103
- package/dist/commands/emergency/leases.js +0 -154
- package/dist/commands/emergency/protected-override-audit.js +0 -122
- package/dist/commands/emergency/registry.js +0 -176
- package/dist/commands/emergency.js +0 -219
- package/dist/commands/evidence/bundle-io/implementation.js +0 -896
- package/dist/commands/evidence/bundle-io.js +0 -1
- package/dist/commands/evidence/command-runs.js +0 -280
- package/dist/commands/evidence/evidence-store.js +0 -94
- package/dist/commands/evidence/historical-batch-finalize.js +0 -1
- package/dist/commands/evidence/historical-batch.js +0 -1
- package/dist/commands/evidence/missing-report.js +0 -380
- package/dist/commands/evidence/observed-source-loader.js +0 -54
- package/dist/commands/evidence/shared-utils.js +0 -18
- package/dist/commands/evidence/validator-classification.js +0 -182
- package/dist/commands/evidence/verbs/add.js +0 -1
- package/dist/commands/evidence/verbs/diagnose.js +0 -190
- package/dist/commands/evidence/verbs/diff.js +0 -1
- package/dist/commands/evidence/verbs/git-head-backfill.js +0 -1
- package/dist/commands/evidence/verbs/missing.js +0 -1
- package/dist/commands/evidence/verbs/run.js +0 -287
- package/dist/commands/evidence/verbs/validators.js +0 -1
- package/dist/commands/evidence/verbs/verify.js +0 -1
- package/dist/commands/evidence/verbs/wave-exit-observer.js +0 -212
- package/dist/commands/evidence.js +0 -39
- package/dist/commands/experience.js +0 -242
- package/dist/commands/explain.js +0 -49
- package/dist/commands/first-use-notice.js +0 -54
- package/dist/commands/framework-development/build-release-hygiene-hints.js +0 -7
- package/dist/commands/framework-development/closure-packet/diagnostics.js +0 -24
- package/dist/commands/framework-development/closure-packet/schema-fragments.js +0 -1
- package/dist/commands/framework-development/closure-packet/validator-contract.js +0 -1
- package/dist/commands/framework-development/closure-packet-schema/implementation.js +0 -1134
- package/dist/commands/framework-development/closure-packet-schema.js +0 -3
- package/dist/commands/framework-development/critical-path-gate.js +0 -1
- package/dist/commands/framework-development/framework-lock-context.js +0 -35
- package/dist/commands/framework-development/framework-temp-lock-projection.js +0 -81
- package/dist/commands/framework-development/framework-temp-publication-capability.js +0 -277
- package/dist/commands/framework-development/historical-delivery-provenance.js +0 -12
- package/dist/commands/framework-development/path-classification.js +0 -34
- package/dist/commands/framework-development/runner-publication-close-handoff.js +0 -86
- package/dist/commands/framework-development/runner-publication-lifecycle.js +0 -434
- package/dist/commands/framework-development/runner-publication-receipt.js +0 -29
- package/dist/commands/framework-development/runner-sync-admission.js +0 -337
- package/dist/commands/framework-development/runner-sync-lease-health.js +0 -36
- package/dist/commands/framework-development/runner-sync-queue-ownership.js +0 -202
- package/dist/commands/framework-development/sha256-normalization.js +0 -1
- package/dist/commands/framework-development/temp-claim.js +0 -1
- package/dist/commands/framework-development.js +0 -7
- package/dist/commands/git/record-commit.js +0 -2
- package/dist/commands/git-governance/branch-commit-coordinator.js +0 -119
- package/dist/commands/git-governance/commit-bundle-filter.js +0 -37
- package/dist/commands/git-governance/commit-scope-policy.js +0 -182
- package/dist/commands/git-governance/governance-residue-policy.js +0 -18
- package/dist/commands/git-governance/implementation/admission-command.js +0 -231
- package/dist/commands/git-governance/implementation/branch-commit-window.js +0 -204
- package/dist/commands/git-governance/implementation/broker-hook-bypass-preflight.js +0 -227
- package/dist/commands/git-governance/implementation/command-router.js +0 -199
- package/dist/commands/git-governance/implementation/commit-attempt-boundary.js +0 -84
- package/dist/commands/git-governance/implementation/commit-authority-scopes.js +0 -75
- package/dist/commands/git-governance/implementation/commit-bundle-resolution.js +0 -502
- package/dist/commands/git-governance/implementation/commit-bundle-selection.js +0 -9
- package/dist/commands/git-governance/implementation/commit-candidate-preparation.js +0 -68
- package/dist/commands/git-governance/implementation/commit-command.js +0 -209
- package/dist/commands/git-governance/implementation/commit-execution.js +0 -400
- package/dist/commands/git-governance/implementation/commit-framework-branch.js +0 -105
- package/dist/commands/git-governance/implementation/commit-task-scoped-branch.js +0 -161
- package/dist/commands/git-governance/implementation/dry-run-purity.js +0 -54
- package/dist/commands/git-governance/implementation/framework-commit-claim-guard.js +0 -21
- package/dist/commands/git-governance/implementation/framework-hook-identity.js +0 -12
- package/dist/commands/git-governance/implementation/git-command-options.js +0 -258
- package/dist/commands/git-governance/implementation/git-config-port.js +0 -25
- package/dist/commands/git-governance/implementation/git-head-evidence-transaction.js +0 -275
- package/dist/commands/git-governance/implementation/git-index-lock-recovery.js +0 -41
- package/dist/commands/git-governance/implementation/git-index-transaction.js +0 -415
- package/dist/commands/git-governance/implementation/git-process-port.js +0 -261
- package/dist/commands/git-governance/implementation/hook-bypass-commit-boundary.js +0 -20
- package/dist/commands/git-governance/implementation/hook-failure-diagnostics.js +0 -59
- package/dist/commands/git-governance/implementation/identity-check-command.js +0 -403
- package/dist/commands/git-governance/implementation/index-restoration.js +0 -80
- package/dist/commands/git-governance/implementation/lease-command.js +0 -112
- package/dist/commands/git-governance/implementation/live-index-drain.js +0 -124
- package/dist/commands/git-governance/implementation/live-index-lock-retry.js +0 -72
- package/dist/commands/git-governance/implementation/live-index-reconciliation.js +0 -420
- package/dist/commands/git-governance/implementation/pathspec-argv-batching.js +0 -124
- package/dist/commands/git-governance/implementation/push-command.js +0 -485
- package/dist/commands/git-governance/implementation/record-bundle-inspection.js +0 -244
- package/dist/commands/git-governance/implementation/record-commit-command.js +0 -262
- package/dist/commands/git-governance/implementation/sealed-commit-attribution.js +0 -429
- package/dist/commands/git-governance/implementation/task-scope-staging.js +0 -395
- package/dist/commands/git-governance/implementation.js +0 -11
- package/dist/commands/git-governance/protected-governance-state.js +0 -136
- package/dist/commands/git-governance/record-commit-payload-assertion.js +0 -48
- package/dist/commands/git-governance/record-only-block-lifecycle-bridge.js +0 -227
- package/dist/commands/git-governance/task-scoped-commit-transaction.js +0 -42
- package/dist/commands/git-governance/validate-atom-file-size.js +0 -54
- package/dist/commands/git-governance/work-admission-check.js +0 -230
- package/dist/commands/git-governance.js +0 -338
- package/dist/commands/git-head-evidence.js +0 -354
- package/dist/commands/git-index-ownership.js +0 -411
- package/dist/commands/git-worktree-readiness.js +0 -127
- package/dist/commands/git.js +0 -169
- package/dist/commands/glossary-data.js +0 -52
- package/dist/commands/governance-runtime.js +0 -198
- package/dist/commands/guard.js +0 -338
- package/dist/commands/guide.js +0 -486
- package/dist/commands/handoff.js +0 -107
- package/dist/commands/hash-placeholder-audit.js +0 -57
- package/dist/commands/health-report.js +0 -30
- package/dist/commands/help.js +0 -69
- package/dist/commands/hook/commit-range-guard/args.js +0 -48
- package/dist/commands/hook/commit-range-guard/baseline.js +0 -43
- package/dist/commands/hook/commit-range-guard/implementation.js +0 -514
- package/dist/commands/hook/commit-range-guard/support.js +0 -6
- package/dist/commands/hook/commit-range-guard.js +0 -4
- package/dist/commands/hook/context-map-advisor.js +0 -210
- package/dist/commands/hook/git-hooks-installer.js +0 -156
- package/dist/commands/hook/git-index-diagnostics.js +0 -81
- package/dist/commands/hook/pre-commit/close-transaction-receipt.js +0 -110
- package/dist/commands/hook/pre-commit/committed-task-context.js +0 -37
- package/dist/commands/hook/pre-commit/cross-file-consistency.js +0 -423
- package/dist/commands/hook/pre-commit/cross-task-admission.js +0 -135
- package/dist/commands/hook/pre-commit/failure-envelope.js +0 -340
- package/dist/commands/hook/pre-commit/framework-lock-context.js +0 -9
- package/dist/commands/hook/pre-commit/framework-temp-claim-attribution.js +0 -29
- package/dist/commands/hook/pre-commit/implementation.js +0 -433
- package/dist/commands/hook/pre-commit/input-state.js +0 -208
- package/dist/commands/hook/pre-commit/residue-candidates.js +0 -15
- package/dist/commands/hook/pre-commit/scope-ownership.js +0 -380
- package/dist/commands/hook/pre-commit/support.js +0 -985
- package/dist/commands/hook/pre-commit/team-gate-findings.js +0 -19
- package/dist/commands/hook/pre-commit.js +0 -2
- package/dist/commands/hook/pre-push.js +0 -447
- package/dist/commands/hook.js +0 -65
- package/dist/commands/identity.js +0 -244
- package/dist/commands/init.js +0 -201
- package/dist/commands/integration/adapter-parity.js +0 -74
- package/dist/commands/integration/adapters.js +0 -127
- package/dist/commands/integration/bootstrap.js +0 -109
- package/dist/commands/integration/health.js +0 -253
- package/dist/commands/integration/install.js +0 -46
- package/dist/commands/integration/list.js +0 -16
- package/dist/commands/integration/run.js +0 -208
- package/dist/commands/integration/types.js +0 -1
- package/dist/commands/integration-hooks/implementation.js +0 -807
- package/dist/commands/integration-hooks.js +0 -1
- package/dist/commands/integration.js +0 -5
- package/dist/commands/internal-release/command.js +0 -113
- package/dist/commands/internal-release/constants.js +0 -5
- package/dist/commands/internal-release/options.js +0 -79
- package/dist/commands/internal-release/publication.js +0 -104
- package/dist/commands/internal-release/scratch.js +0 -72
- package/dist/commands/internal-release/support.js +0 -79
- package/dist/commands/internal-release/target-sync.js +0 -122
- package/dist/commands/internal-release/types.js +0 -1
- package/dist/commands/internal-release.js +0 -2
- package/dist/commands/lane-session/adopt-rebind.js +0 -113
- package/dist/commands/lane-session/capability-authority.js +0 -223
- package/dist/commands/lane-session/events.js +0 -102
- package/dist/commands/lane-session/mutation-authority-adapter.js +0 -96
- package/dist/commands/lane-session/mutation-status-command.js +0 -61
- package/dist/commands/lane-session/proxy-receipt.js +0 -219
- package/dist/commands/lane-session/redaction.js +0 -66
- package/dist/commands/lane-session/resolve.js +0 -114
- package/dist/commands/lane-session/store.js +0 -336
- package/dist/commands/lane.js +0 -550
- package/dist/commands/lock.js +0 -132
- package/dist/commands/map-capsule.js +0 -194
- package/dist/commands/migrate.js +0 -193
- package/dist/commands/next/active-work-summary.js +0 -88
- package/dist/commands/next/broker-queue-admission.js +0 -95
- package/dist/commands/next/channel-strategy.js +0 -172
- package/dist/commands/next/claim-admission.js +0 -254
- package/dist/commands/next/claim-cleanup.js +0 -24
- package/dist/commands/next/claim-conflict-log.js +0 -122
- package/dist/commands/next/claim-delivery-admission.js +0 -35
- package/dist/commands/next/claim-early-results.js +0 -120
- package/dist/commands/next/claim-helpers.js +0 -81
- package/dist/commands/next/claim-lane-session.js +0 -38
- package/dist/commands/next/claim-orchestration.js +0 -579
- package/dist/commands/next/claim-parallel-preflight.js +0 -368
- package/dist/commands/next/claim-readiness.js +0 -158
- package/dist/commands/next/claim-scope-expansion-admission.js +0 -22
- package/dist/commands/next/cross-repo-framework-result.js +0 -40
- package/dist/commands/next/foreign-dirty-wip-admission.js +0 -162
- package/dist/commands/next/governance-readiness.js +0 -149
- package/dist/commands/next/intent-normalizers.js +0 -212
- package/dist/commands/next/match-and-sort.js +0 -183
- package/dist/commands/next/next-action-assembly.js +0 -118
- package/dist/commands/next/oversized-extraction-admission.js +0 -79
- package/dist/commands/next/plan-scoped-preflight.js +0 -145
- package/dist/commands/next/planning-root-preference.js +0 -264
- package/dist/commands/next/playbook-projection/active-work-summary.js +0 -380
- package/dist/commands/next/playbook-projection/channel-playbook.js +0 -198
- package/dist/commands/next/playbook-projection/governance-readiness.js +0 -67
- package/dist/commands/next/playbook-projection/legacy-guidance.js +0 -151
- package/dist/commands/next/playbook-projection/message-assembly.js +0 -120
- package/dist/commands/next/playbook-projection/task-reservation-projection.js +0 -126
- package/dist/commands/next/playbook-projection/task-routing.js +0 -275
- package/dist/commands/next/playbook-projection.js +0 -7
- package/dist/commands/next/profiler.js +0 -22
- package/dist/commands/next/prompt-guidance-result.js +0 -177
- package/dist/commands/next/prompt-result-contracts.js +0 -273
- package/dist/commands/next/prompt-results.js +0 -505
- package/dist/commands/next/prompt-scope-resolution.js +0 -12
- package/dist/commands/next/proposal-lane.js +0 -122
- package/dist/commands/next/result-compaction.js +0 -120
- package/dist/commands/next/route-predicates.js +0 -112
- package/dist/commands/next/route-resolution/artifact-scope.js +0 -215
- package/dist/commands/next/route-resolution/intent.js +0 -163
- package/dist/commands/next/route-resolution/matching.js +0 -446
- package/dist/commands/next/route-resolution/pending-worktree.js +0 -257
- package/dist/commands/next/route-resolution/queue-inspection.js +0 -391
- package/dist/commands/next/route-resolution/runtime.js +0 -111
- package/dist/commands/next/route-resolution/task-card-discovery.js +0 -190
- package/dist/commands/next/route-resolution.js +0 -7
- package/dist/commands/next/runner-mode.js +0 -98
- package/dist/commands/next/runner-recovery-claim-authorization.js +0 -30
- package/dist/commands/next/task-scoped-claim-command.js +0 -24
- package/dist/commands/next/view-projections.js +0 -51
- package/dist/commands/next/worktree-hints.js +0 -11
- package/dist/commands/next-active-batch.js +0 -39
- package/dist/commands/next.js +0 -257
- package/dist/commands/orient.js +0 -22
- package/dist/commands/output-projection.js +0 -37
- package/dist/commands/plan.js +0 -458
- package/dist/commands/planning-repo-root.js +0 -312
- package/dist/commands/planning-root-resolution-cache.js +0 -0
- package/dist/commands/police.js +0 -166
- package/dist/commands/quickfix.js +0 -76
- package/dist/commands/registry/lineage-normalization.js +0 -125
- package/dist/commands/registry-diff.js +0 -145
- package/dist/commands/registry-shared.js +0 -153
- package/dist/commands/registry.js +0 -533
- package/dist/commands/replacement-lane.js +0 -82
- package/dist/commands/rescue.js +0 -306
- package/dist/commands/residue.js +0 -483
- package/dist/commands/review-advisory.js +0 -480
- package/dist/commands/review.js +0 -514
- package/dist/commands/rollback.js +0 -271
- package/dist/commands/route/files.js +0 -42
- package/dist/commands/route/freeze-patch.js +0 -141
- package/dist/commands/route/lifecycle.js +0 -206
- package/dist/commands/route/main.js +0 -10
- package/dist/commands/route/parser.js +0 -177
- package/dist/commands/route/takeover.js +0 -152
- package/dist/commands/route/types.js +0 -2
- package/dist/commands/route/validation.js +0 -77
- package/dist/commands/route.js +0 -1
- package/dist/commands/runner-sync.js +0 -2
- package/dist/commands/runtime-adapter-readiness.js +0 -150
- package/dist/commands/self-host-alpha.js +0 -293
- package/dist/commands/shared/command-manifest.js +0 -104
- package/dist/commands/shared/command-spec-output.js +0 -304
- package/dist/commands/shared/identity-normalization.js +0 -208
- package/dist/commands/shared/option-and-file-tools.js +0 -451
- package/dist/commands/shared/result-core.js +0 -315
- package/dist/commands/shared.js +0 -3
- package/dist/commands/spec-shared.js +0 -108
- package/dist/commands/spec.js +0 -13
- package/dist/commands/start.js +0 -115
- package/dist/commands/status.js +0 -214
- package/dist/commands/task-direction/active-locks.js +0 -98
- package/dist/commands/task-direction/scope-policy.js +0 -104
- package/dist/commands/task-direction/support.js +0 -204
- package/dist/commands/task-direction.js +0 -305
- package/dist/commands/task-intent.js +0 -163
- package/dist/commands/task-ledger.js +0 -149
- package/dist/commands/task-view.js +0 -146
- package/dist/commands/taskflow/auto-evidence-mapper.js +0 -147
- package/dist/commands/taskflow/branch-commit-queue-gate.js +0 -127
- package/dist/commands/taskflow/broker-gate.js +0 -253
- package/dist/commands/taskflow/close-orchestration.js +0 -511
- package/dist/commands/taskflow/close-owned-delivery-dirty-admission.js +0 -70
- package/dist/commands/taskflow/close-preflight.js +0 -403
- package/dist/commands/taskflow/close-side-effect-reconcile.js +0 -51
- package/dist/commands/taskflow/close-transaction-hook-receipt.js +0 -36
- package/dist/commands/taskflow/close-transaction-mutex.js +0 -108
- package/dist/commands/taskflow/closeback-orchestration.js +0 -204
- package/dist/commands/taskflow/commit-bundle-assembly.js +0 -613
- package/dist/commands/taskflow/commit-messages.js +0 -9
- package/dist/commands/taskflow/cross-authority-closeback.js +0 -308
- package/dist/commands/taskflow/current-task-close-evidence.js +0 -51
- package/dist/commands/taskflow/dirty-blockers.js +0 -46
- package/dist/commands/taskflow/governance-dirty-deferral.js +0 -21
- package/dist/commands/taskflow/historical-close-preflight.js +0 -426
- package/dist/commands/taskflow/host-opener-policy.js +0 -229
- package/dist/commands/taskflow/implementation.js +0 -722
- package/dist/commands/taskflow/markdown-paths.js +0 -7
- package/dist/commands/taskflow/profile-loader.js +0 -280
- package/dist/commands/taskflow/runner-publication-close-queue.js +0 -31
- package/dist/commands/taskflow/runner-recovery-forwarding.js +0 -55
- package/dist/commands/taskflow/runner-selection-evidence.js +0 -26
- package/dist/commands/taskflow/task-scope.js +0 -84
- package/dist/commands/taskflow/transaction-status.js +0 -3
- package/dist/commands/taskflow/write-readiness.js +0 -337
- package/dist/commands/taskflow.js +0 -1
- package/dist/commands/tasks/acceptance-evidence-import.js +0 -119
- package/dist/commands/tasks/canonical-task-id-boundary.js +0 -23
- package/dist/commands/tasks/claim-intent.js +0 -110
- package/dist/commands/tasks/claim-orchestrator.js +0 -559
- package/dist/commands/tasks/claim-ownership.js +0 -145
- package/dist/commands/tasks/claim-preparation.js +0 -251
- package/dist/commands/tasks/claim-repair-diagnostics.js +0 -466
- package/dist/commands/tasks/claim-work-admission.js +0 -290
- package/dist/commands/tasks/close-governance.js +0 -173
- package/dist/commands/tasks/close-helpers/broker-admission-explanation.js +0 -75
- package/dist/commands/tasks/close-helpers/close-artifact-staging.js +0 -257
- package/dist/commands/tasks/close-helpers/close-window-diagnostics.js +0 -172
- package/dist/commands/tasks/close-helpers/task-transition-writer.js +0 -108
- package/dist/commands/tasks/close-orchestrator/acceptance-evidence-gate.js +0 -84
- package/dist/commands/tasks/close-orchestrator/close-result.js +0 -35
- package/dist/commands/tasks/close-orchestrator/close-write.js +0 -200
- package/dist/commands/tasks/close-orchestrator/closure-packet.js +0 -109
- package/dist/commands/tasks/close-orchestrator/historical-context.js +0 -48
- package/dist/commands/tasks/close-orchestrator/runner-recovery.js +0 -30
- package/dist/commands/tasks/close-orchestrator.js +0 -535
- package/dist/commands/tasks/close-window-lock.js +0 -420
- package/dist/commands/tasks/close-window-residue-classification.js +0 -137
- package/dist/commands/tasks/close-window-staged-index-admission.js +0 -20
- package/dist/commands/tasks/closeout-provenance.js +0 -126
- package/dist/commands/tasks/closeout-signaling.js +0 -1
- package/dist/commands/tasks/command-dispatch.js +0 -86
- package/dist/commands/tasks/contract-import-recovery.js +0 -17
- package/dist/commands/tasks/deliver-close-orchestrator.js +0 -251
- package/dist/commands/tasks/dependency-gate.js +0 -429
- package/dist/commands/tasks/dependency-gates.js +0 -1
- package/dist/commands/tasks/generated-residue-policy.js +0 -121
- package/dist/commands/tasks/historical-delivery.js +0 -411
- package/dist/commands/tasks/import-card-contract-validation.js +0 -124
- package/dist/commands/tasks/import-orchestrator.js +0 -497
- package/dist/commands/tasks/import-planning-authority.js +0 -1
- package/dist/commands/tasks/import-task.js +0 -150
- package/dist/commands/tasks/import-validation.js +0 -70
- package/dist/commands/tasks/import-verify.js +0 -195
- package/dist/commands/tasks/is-frontmatter-scalar-helper.js +0 -9
- package/dist/commands/tasks/legacy/compat-command-map.js +0 -4
- package/dist/commands/tasks/legacy/implementation.js +0 -1176
- package/dist/commands/tasks/legacy/repair-reconcile-lane.js +0 -3
- package/dist/commands/tasks/legacy/transition-compat.js +0 -3
- package/dist/commands/tasks/legacy-impl.js +0 -2
- package/dist/commands/tasks/lifecycle-state.js +0 -151
- package/dist/commands/tasks/normalize-string-value-helper.js +0 -6
- package/dist/commands/tasks/normalize-task-document-id-helper.js +0 -7
- package/dist/commands/tasks/plan-import-boundary.js +0 -58
- package/dist/commands/tasks/planning-mirror-close-diagnostics.js +0 -95
- package/dist/commands/tasks/planning-mirror-reconcile.js +0 -82
- package/dist/commands/tasks/planning-root-authorship.js +0 -153
- package/dist/commands/tasks/planning-source-seal-policy.js +0 -125
- package/dist/commands/tasks/public-surface.js +0 -11
- package/dist/commands/tasks/read-projection.js +0 -213
- package/dist/commands/tasks/realign-plan-source.js +0 -437
- package/dist/commands/tasks/reconcile-orchestrator.js +0 -353
- package/dist/commands/tasks/release-wip-transaction.js +0 -59
- package/dist/commands/tasks/repair-claim-orchestrator.js +0 -174
- package/dist/commands/tasks/repairclose-orchestrator.js +0 -232
- package/dist/commands/tasks/residue-diagnostics.js +0 -175
- package/dist/commands/tasks/result-contracts.js +0 -43
- package/dist/commands/tasks/scope-amendment/implementation.js +0 -137
- package/dist/commands/tasks/scope-lock-diagnostics.js +0 -234
- package/dist/commands/tasks/scope-preflight/implementation.js +0 -24
- package/dist/commands/tasks/scope-queue.js +0 -13
- package/dist/commands/tasks/seal-plan-source.js +0 -98
- package/dist/commands/tasks/sha256-helper.js +0 -7
- package/dist/commands/tasks/status-triangulation.js +0 -284
- package/dist/commands/tasks/surface-invariants.js +0 -84
- package/dist/commands/tasks/takeover-evidence.js +0 -29
- package/dist/commands/tasks/task-atomization-policy-import.js +0 -139
- package/dist/commands/tasks/task-card-contract-import.js +0 -336
- package/dist/commands/tasks/task-card-writer.js +0 -13
- package/dist/commands/tasks/task-file-io-helpers.js +0 -62
- package/dist/commands/tasks/task-frontmatter-fidelity.js +0 -269
- package/dist/commands/tasks/task-git-helpers.js +0 -40
- package/dist/commands/tasks/task-import-diagnostics.js +0 -45
- package/dist/commands/tasks/task-import-status-normalization.js +0 -20
- package/dist/commands/tasks/task-import-validators.js +0 -442
- package/dist/commands/tasks/task-ledger-readers.js +0 -102
- package/dist/commands/tasks/task-markdown-helpers.js +0 -358
- package/dist/commands/tasks/task-option-parsers/close-delivery-options.js +0 -156
- package/dist/commands/tasks/task-option-parsers/create-close-options.js +0 -233
- package/dist/commands/tasks/task-option-parsers/helpers.js +0 -37
- package/dist/commands/tasks/task-option-parsers/misc-claim-options.js +0 -350
- package/dist/commands/tasks/task-option-parsers/scope-options.js +0 -211
- package/dist/commands/tasks/task-option-parsers/status-options.js +0 -43
- package/dist/commands/tasks/task-option-parsers.js +0 -6
- package/dist/commands/tasks/task-transition-helpers.js +0 -166
- package/dist/commands/tasks/task-work-admission-import.js +0 -54
- package/dist/commands/tasks/verify-orchestrator.js +0 -160
- package/dist/commands/tasks.js +0 -5
- package/dist/commands/team/admission-command.js +0 -7
- package/dist/commands/team/admission.js +0 -141
- package/dist/commands/team/command-registry.js +0 -26
- package/dist/commands/team/composer.js +0 -78
- package/dist/commands/team/cost-command.js +0 -27
- package/dist/commands/team/efficiency-controller.js +0 -198
- package/dist/commands/team/execute-command.js +0 -6
- package/dist/commands/team/growth-contract.js +0 -128
- package/dist/commands/team/legacy/broker-observability.js +0 -366
- package/dist/commands/team/legacy/command-runner.js +0 -348
- package/dist/commands/team/legacy/crew-decision-policy.js +0 -418
- package/dist/commands/team/legacy/handoff-handler.js +0 -60
- package/dist/commands/team/legacy/implementer-selector-policy.js +0 -209
- package/dist/commands/team/legacy/lifecycle-handler.js +0 -163
- package/dist/commands/team/legacy/patrol-contracts.js +0 -212
- package/dist/commands/team/legacy/patrol-handler.js +0 -213
- package/dist/commands/team/legacy/permission-lease-policy.js +0 -386
- package/dist/commands/team/legacy/plan-orchestration.js +0 -360
- package/dist/commands/team/legacy/planning-context.js +0 -314
- package/dist/commands/team/legacy/provider-execution.js +0 -337
- package/dist/commands/team/legacy/runtime-contracts.js +0 -241
- package/dist/commands/team/legacy/runtime-governance.js +0 -419
- package/dist/commands/team/legacy/team-run-runtime.js +0 -186
- package/dist/commands/team/legacy/team-run-store.js +0 -160
- package/dist/commands/team/legacy/team-utils.js +0 -102
- package/dist/commands/team/legacy/types.js +0 -150
- package/dist/commands/team/plan-command.js +0 -4
- package/dist/commands/team/proposal-workspace.js +0 -139
- package/dist/commands/team/provider-preflight.js +0 -57
- package/dist/commands/team/report-command.js +0 -14
- package/dist/commands/team/role-provider-resolution.js +0 -46
- package/dist/commands/team/role-skill-packs.js +0 -238
- package/dist/commands/team/runtime-bridges.js +0 -81
- package/dist/commands/team/runtime-tier-contract.js +0 -32
- package/dist/commands/team/scheduler.js +0 -165
- package/dist/commands/team/shadow-plan.js +0 -77
- package/dist/commands/team/shadow-workspace.js +0 -1
- package/dist/commands/team/start-command.js +0 -4
- package/dist/commands/team/status-command.js +0 -4
- package/dist/commands/team/team-execution-lane.js +0 -66
- package/dist/commands/team/team-route-map.js +0 -55
- package/dist/commands/team-knowledge/actions.js +0 -210
- package/dist/commands/team-knowledge/main.js +0 -36
- package/dist/commands/team-knowledge/metadata.js +0 -120
- package/dist/commands/team-knowledge/permission.js +0 -34
- package/dist/commands/team-knowledge/ranking.js +0 -186
- package/dist/commands/team-knowledge/runtime-utils.js +0 -105
- package/dist/commands/team-knowledge/spec.js +0 -30
- package/dist/commands/team-knowledge/summary.js +0 -55
- package/dist/commands/team-knowledge/text-utils.js +0 -29
- package/dist/commands/team-knowledge/types.js +0 -1
- package/dist/commands/team-knowledge.js +0 -2
- package/dist/commands/team-legacy.js +0 -101
- package/dist/commands/team-runtime-cleanup.js +0 -56
- package/dist/commands/team-runtime-gates.js +0 -198
- package/dist/commands/team-wave.js +0 -387
- package/dist/commands/team.js +0 -2
- package/dist/commands/telemetry.js +0 -149
- package/dist/commands/test-catalog.js +0 -354
- package/dist/commands/test.js +0 -301
- package/dist/commands/upgrade/canary.js +0 -45
- package/dist/commands/upgrade/experimental.js +0 -97
- package/dist/commands/upgrade/next-action-hint.js +0 -56
- package/dist/commands/upgrade/path-helpers.js +0 -66
- package/dist/commands/upgrade/proposal/context-budget.js +0 -187
- package/dist/commands/upgrade/proposal/guided-legacy.js +0 -90
- package/dist/commands/upgrade/proposal/inputs.js +0 -86
- package/dist/commands/upgrade/proposal/parse.js +0 -221
- package/dist/commands/upgrade/proposal/types.js +0 -1
- package/dist/commands/upgrade/proposal.js +0 -4
- package/dist/commands/upgrade/safe-upgrade.js +0 -339
- package/dist/commands/upgrade/scan.js +0 -76
- package/dist/commands/upgrade-map-propose.js +0 -64
- package/dist/commands/upgrade.js +0 -106
- package/dist/commands/validate.js +0 -429
- package/dist/commands/validation-obligations.js +0 -142
- package/dist/commands/verify.js +0 -151
- package/dist/commands/welcome.js +0 -180
- package/dist/commands/work-channels.js +0 -493
- package/dist/commands/write-ticket.js +0 -226
- package/dist/config/env-registry.js +0 -88
- package/dist/index.js +0 -350
- package/dist/migration/codemod-registry.js +0 -82
- package/dist/plugin-registry.js +0 -49
- package/dist/startup-integrity.js +0 -88
- package/dist/startup-known-bad.js +0 -218
- package/dist/telemetry/index.js +0 -78
- package/dist/temp-workspace.js +0 -49
- /package/dist/{_vendor → npm-runtime/layout/_vendor}/agent-pack-claude-code/templates/atm-bootstrap.md.tmpl +0 -0
- /package/dist/{_vendor → npm-runtime/layout/_vendor}/agent-pack-claude-code/templates/atm-evidence.md.tmpl +0 -0
- /package/dist/{_vendor → npm-runtime/layout/_vendor}/agent-pack-claude-code/templates/atm-handoff.md.tmpl +0 -0
- /package/dist/{_vendor → npm-runtime/layout/_vendor}/agent-pack-claude-code/templates/atm-lock.md.tmpl +0 -0
- /package/dist/{_vendor → npm-runtime/layout/_vendor}/agent-pack-claude-code/templates/atm-next.md.tmpl +0 -0
- /package/dist/{_vendor → npm-runtime/layout/_vendor}/agent-pack-claude-code/templates/atm-verify.md.tmpl +0 -0
- /package/dist/{_vendor → npm-runtime/layout/_vendor}/atm-markdown-task-source/templates/aao-l2-split-template.md +0 -0
- /package/dist/{_vendor → npm-runtime/layout/_vendor}/integrations-core/templates/skills/atm-atom-map-refactor.skill.md +0 -0
- /package/dist/{_vendor → npm-runtime/layout/_vendor}/integrations-core/templates/skills/atm-bug-backlog.skill.md +0 -0
- /package/dist/{_vendor → npm-runtime/layout/_vendor}/integrations-core/templates/skills/atm-create.skill.md +0 -0
- /package/dist/{_vendor → npm-runtime/layout/_vendor}/integrations-core/templates/skills/atm-deep-module-refactor.files/references/deepening.md +0 -0
- /package/dist/{_vendor → npm-runtime/layout/_vendor}/integrations-core/templates/skills/atm-deep-module-refactor.files/references/design-it-twice.md +0 -0
- /package/dist/{_vendor → npm-runtime/layout/_vendor}/integrations-core/templates/skills/atm-deep-module-refactor.skill.md +0 -0
- /package/dist/{_vendor → npm-runtime/layout/_vendor}/integrations-core/templates/skills/atm-diagnostic-loop.skill.md +0 -0
- /package/dist/{_vendor → npm-runtime/layout/_vendor}/integrations-core/templates/skills/atm-error-code-resolver.skill.md +0 -0
- /package/dist/{_vendor → npm-runtime/layout/_vendor}/integrations-core/templates/skills/atm-evidence.skill.md +0 -0
- /package/dist/{_vendor → npm-runtime/layout/_vendor}/integrations-core/templates/skills/atm-framework-quickfix.skill.md +0 -0
- /package/dist/{_vendor → npm-runtime/layout/_vendor}/integrations-core/templates/skills/atm-framework-temp-claim.skill.md +0 -0
- /package/dist/{_vendor → npm-runtime/layout/_vendor}/integrations-core/templates/skills/atm-git-pathspec-emergency-commit.skill.md +0 -0
- /package/dist/{_vendor → npm-runtime/layout/_vendor}/integrations-core/templates/skills/atm-governance-router.files/references/boundary-confusion.md +0 -0
- /package/dist/{_vendor → npm-runtime/layout/_vendor}/integrations-core/templates/skills/atm-governance-router.files/references/entry-friction.md +0 -0
- /package/dist/{_vendor → npm-runtime/layout/_vendor}/integrations-core/templates/skills/atm-governance-router.files/references/fallback-design.md +0 -0
- /package/dist/{_vendor → npm-runtime/layout/_vendor}/integrations-core/templates/skills/atm-governance-router.files/references/index.md +0 -0
- /package/dist/{_vendor → npm-runtime/layout/_vendor}/integrations-core/templates/skills/atm-governance-router.files/references/learning-loop.md +0 -0
- /package/dist/{_vendor → npm-runtime/layout/_vendor}/integrations-core/templates/skills/atm-governance-router.files/references/route-interpretation.md +0 -0
- /package/dist/{_vendor → npm-runtime/layout/_vendor}/integrations-core/templates/skills/atm-governance-router.files/references/tooling-mismatch.md +0 -0
- /package/dist/{_vendor → npm-runtime/layout/_vendor}/integrations-core/templates/skills/atm-governance-router.skill.md +0 -0
- /package/dist/{_vendor → npm-runtime/layout/_vendor}/integrations-core/templates/skills/atm-handoff.skill.md +0 -0
- /package/dist/{_vendor → npm-runtime/layout/_vendor}/integrations-core/templates/skills/atm-internal-build-sync.skill.md +0 -0
- /package/dist/{_vendor → npm-runtime/layout/_vendor}/integrations-core/templates/skills/atm-lock.skill.md +0 -0
- /package/dist/{_vendor → npm-runtime/layout/_vendor}/integrations-core/templates/skills/atm-memory-consolidate.skill.md +0 -0
- /package/dist/{_vendor → npm-runtime/layout/_vendor}/integrations-core/templates/skills/atm-minimal-patch-rebuilder.skill.md +0 -0
- /package/dist/{_vendor → npm-runtime/layout/_vendor}/integrations-core/templates/skills/atm-next.skill.md +0 -0
- /package/dist/{_vendor → npm-runtime/layout/_vendor}/integrations-core/templates/skills/atm-orient.skill.md +0 -0
- /package/dist/{_vendor → npm-runtime/layout/_vendor}/integrations-core/templates/skills/atm-plan-authoring.skill.md +0 -0
- /package/dist/{_vendor → npm-runtime/layout/_vendor}/integrations-core/templates/skills/atm-residue-cleanup.skill.md +0 -0
- /package/dist/{_vendor → npm-runtime/layout/_vendor}/integrations-core/templates/skills/atm-task-card-authoring.skill.md +0 -0
- /package/dist/{_vendor → npm-runtime/layout/_vendor}/integrations-core/templates/skills/atm-task-intent-resolver.skill.md +0 -0
- /package/dist/{_vendor → npm-runtime/layout/_vendor}/integrations-core/templates/skills/atm-upgrade-scan.skill.md +0 -0
- /package/dist/{_vendor → npm-runtime/layout/_vendor}/integrations-core/templates/skills/mailbox-worker-execution.skill.md +0 -0
- /package/dist/{_vendor → npm-runtime/layout/_vendor}/integrations-core/templates/skills/skill.schema.json +0 -0
- /package/dist/{_vendor → npm-runtime/layout/_vendor}/plugin-experience-loop/schemas/memory-nudge.schema.json +0 -0
- /package/dist/{_vendor → npm-runtime/layout/_vendor}/plugin-experience-loop/schemas/skill-amendment.schema.json +0 -0
- /package/dist/{_vendor → npm-runtime/layout/_vendor}/plugin-experience-loop/schemas/skill-candidate.schema.json +0 -0
- /package/dist/{migration → npm-runtime/layout/migration}/migration-index.json +0 -0
- /package/dist/{templates → npm-runtime/layout/templates}/root-drop/.atm/charter/atm-first-principles.template.md +0 -0
- /package/dist/{templates → npm-runtime/layout/templates}/root-drop/.atm/charter/atomic-charter.template.md +0 -0
- /package/dist/{templates → npm-runtime/layout/templates}/root-drop/.atm/charter/charter-invariants.template.json +0 -0
- /package/dist/{templates → npm-runtime/layout/templates}/root-drop/.atm/context/INITIAL_SUMMARY.md +0 -0
- /package/dist/{templates → npm-runtime/layout/templates}/root-drop/.atm/profile/default.md +0 -0
- /package/dist/{templates → npm-runtime/layout/templates}/root-drop/.atm/scripts/WRAPPER_DEDUP_PLAN.md +0 -0
- /package/dist/{templates → npm-runtime/layout/templates}/root-drop/.atm/scripts/ps/atm-create.ps1 +0 -0
- /package/dist/{templates → npm-runtime/layout/templates}/root-drop/.atm/scripts/ps/atm-evidence.ps1 +0 -0
- /package/dist/{templates → npm-runtime/layout/templates}/root-drop/.atm/scripts/ps/atm-handoff.ps1 +0 -0
- /package/dist/{templates → npm-runtime/layout/templates}/root-drop/.atm/scripts/ps/atm-lock.ps1 +0 -0
- /package/dist/{templates → npm-runtime/layout/templates}/root-drop/.atm/scripts/ps/atm-next.ps1 +0 -0
- /package/dist/{templates → npm-runtime/layout/templates}/root-drop/.atm/scripts/ps/atm-orient.ps1 +0 -0
- /package/dist/{templates → npm-runtime/layout/templates}/root-drop/.atm/scripts/ps/atm-upgrade-scan.ps1 +0 -0
- /package/dist/{templates → npm-runtime/layout/templates}/root-drop/.atm/scripts/sh/atm-create.sh +0 -0
- /package/dist/{templates → npm-runtime/layout/templates}/root-drop/.atm/scripts/sh/atm-evidence.sh +0 -0
- /package/dist/{templates → npm-runtime/layout/templates}/root-drop/.atm/scripts/sh/atm-handoff.sh +0 -0
- /package/dist/{templates → npm-runtime/layout/templates}/root-drop/.atm/scripts/sh/atm-lock.sh +0 -0
- /package/dist/{templates → npm-runtime/layout/templates}/root-drop/.atm/scripts/sh/atm-next.sh +0 -0
- /package/dist/{templates → npm-runtime/layout/templates}/root-drop/.atm/scripts/sh/atm-orient.sh +0 -0
- /package/dist/{templates → npm-runtime/layout/templates}/root-drop/.atm/scripts/sh/atm-upgrade-scan.sh +0 -0
- /package/dist/{templates → npm-runtime/layout/templates}/root-drop/.atm/scripts/wrappers.json +0 -0
- /package/dist/{templates → npm-runtime/layout/templates}/root-drop/AGENTS.md +0 -0
|
@@ -1,1176 +0,0 @@
|
|
|
1
|
-
import { applyAtomicScopeAmendment } from '../scope-amendment/implementation.js';
|
|
2
|
-
import { resealWorkAdmissionTicketForRenewal } from '../claim-work-admission.js';
|
|
3
|
-
import { createHash } from 'node:crypto';
|
|
4
|
-
import { execFileSync } from 'node:child_process';
|
|
5
|
-
import { existsSync, mkdirSync, readFileSync, readdirSync, rmSync, statSync, writeFileSync } from 'node:fs';
|
|
6
|
-
import path from 'node:path';
|
|
7
|
-
import { createLocalGovernanceAdapter } from '../../../_vendor/plugin-governance-local/dist/index.js';
|
|
8
|
-
import { resolveActorId } from '../../actor-registry.js';
|
|
9
|
-
import { auditTasks, assertRunnerFreshForWriteAction, isRunnerSyncRequired, runnerStaleWarningMessage } from '../../framework-development.js';
|
|
10
|
-
import { CliError, makeResult, message, parseOptions, parseArgsForCommand, relativePathFrom, resolveValue } from '../../shared.js';
|
|
11
|
-
import { toStoredPlanningPath, resolvePlanAbsoluteFromStored } from '../../planning-repo-root.js';
|
|
12
|
-
import { appendTaskTransitionEvent, createTaskTransitionId, defaultMirrorTaskId, readTaskLedgerPolicy } from '../../task-ledger.js';
|
|
13
|
-
import { readPluginRegistry } from '../../../plugin-registry.js';
|
|
14
|
-
import { abandonTaskQueue, findActiveTaskQueue, sanitizeTaskDirectionAllowedFiles } from '../../task-direction.js';
|
|
15
|
-
import { isPathAllowedByScope } from '../../work-channels.js';
|
|
16
|
-
import { evaluateTaskResetAdmission } from '../lifecycle-state.js';
|
|
17
|
-
import { buildResidueDiagnosisEvidenceFromTriangulation } from '../residue-diagnostics.js';
|
|
18
|
-
import { runTasksClose } from '../close-orchestrator.js';
|
|
19
|
-
import { runTasksImport } from '../import-orchestrator.js';
|
|
20
|
-
import { runTasksVerify } from '../verify-orchestrator.js';
|
|
21
|
-
import { runTasksClaimLifecycle as delegatedRunTasksClaimLifecycle } from '../claim-orchestrator.js';
|
|
22
|
-
import { runTasksRepairClaim } from '../repair-claim-orchestrator.js';
|
|
23
|
-
import { prepareTaskForClaim as delegatedPrepareTaskForClaim } from '../claim-preparation.js';
|
|
24
|
-
import { runTasksRepairClosure } from '../repairclose-orchestrator.js';
|
|
25
|
-
import { runTasksReconcile } from '../reconcile-orchestrator.js';
|
|
26
|
-
import { runTasksDeliverAndClose as delegatedRunTasksDeliverAndClose } from '../deliver-close-orchestrator.js';
|
|
27
|
-
export { runTasksClose, runTasksImport, runTasksVerify };
|
|
28
|
-
export { runTasksClaimLifecycle } from '../claim-orchestrator.js';
|
|
29
|
-
import { classifyResetOpenImport } from '../import-verify.js';
|
|
30
|
-
import { assertEmergencyApproval } from '../../emergency/gate.js';
|
|
31
|
-
import { parseClaimRecord, isClaimExpired, listRuntimeLockTaskIds } from '../task-ledger-readers.js';
|
|
32
|
-
import { isFrontmatterScalar as delegatedIsFrontmatterScalar } from '../is-frontmatter-scalar-helper.js';
|
|
33
|
-
import { normalizeStringValue as delegatedNormalizeStringValue } from '../normalize-string-value-helper.js';
|
|
34
|
-
import { normalizeTaskDocumentId as delegatedNormalizeTaskDocumentId } from '../normalize-task-document-id-helper.js';
|
|
35
|
-
import { sha256 as delegatedSha256 } from '../sha256-helper.js';
|
|
36
|
-
import { assertLocalTaskLedgerEnabled as delegatedAssertLocalTaskLedgerEnabled, buildTaskTransitionCommand as delegatedBuildTaskTransitionCommand, buildScopeAmendmentCommand as delegatedBuildScopeAmendmentCommand, createClosureTransitionMetadata as delegatedCreateClosureTransitionMetadata, normalizeWorkItemStatus as delegatedNormalizeWorkItemStatus, inspectTaskVerifyStatus as delegatedInspectTaskVerifyStatus } from '../task-transition-helpers.js';
|
|
37
|
-
import { readGitScalar as delegatedReadGitScalar, listCommittedFilesSinceClaim as delegatedListCommittedFilesSinceClaim } from '../task-git-helpers.js';
|
|
38
|
-
import { readDeferredForeignStagedFilesForActiveCloseWindow as delegatedReadDeferredForeignStagedFilesForActiveCloseWindow, evaluateFrameworkDeliveryWindow as delegatedEvaluateFrameworkDeliveryWindow, loadHistoricalBatchCloseSlice as delegatedLoadHistoricalBatchCloseSlice } from '../close-helpers/close-window-diagnostics.js';
|
|
39
|
-
import { buildBrokerAdmissionExplanation as delegatedBuildBrokerAdmissionExplanation, explainBrokerAdapterForPath as delegatedExplainBrokerAdapterForPath, hasUnexplainedSharedProjection as delegatedHasUnexplainedSharedProjection } from '../close-helpers/broker-admission-explanation.js';
|
|
40
|
-
import { extractTaskCloseDeclaredFiles as delegatedExtractTaskCloseDeclaredFiles, extractTaskDeliverableFiles as delegatedExtractTaskDeliverableFiles, taskDeliveryPrincipleText as delegatedTaskDeliveryPrincipleText, evaluateTaskDeliverableGate as delegatedEvaluateTaskDeliverableGate, stageTaskCloseArtifacts as delegatedStageTaskCloseArtifacts, existingTaskCloseArtifacts as delegatedExistingTaskCloseArtifacts } from '../close-helpers/close-artifact-staging.js';
|
|
41
|
-
import { writeTaskDocumentWithTransition as delegatedWriteTaskDocumentWithTransition } from '../close-helpers/task-transition-writer.js';
|
|
42
|
-
import { collectKeyValue as delegatedCollectKeyValue, collectKeyValueFromLines as delegatedCollectKeyValueFromLines, createTaskFromTableMetadata as delegatedCreateTaskFromTableMetadata, parseDispatchMetadataFromPlanText } from '../task-markdown-helpers.js';
|
|
43
|
-
import { safeTaskFileReadDir, safeTaskFileStat, readJsonRecord, taskPathFor, collectTaskFileValues, normalizeRelativePath, legacyTaskRequiresBaseline } from '../task-file-io-helpers.js';
|
|
44
|
-
import { coerceStatus, extractFrontMatter, hashSection, normalizeOptionalString, normalizeYamlScalar, normalizeTaskId, parseMarkdownTableCells, parseYamlList, validateDeliverablesList, parseContextMap } from '../task-import-validators.js';
|
|
45
|
-
import { parseCreateOptions, parseMirrorOptions, parseStatusOptions, parseFinalizeDiagnoseOptions, parseResetOptions, parseLockCleanupOptions, parseMetadataRepairDeliverablesOptions, parseScopeAddOptions, parseScopeRepairOptions, parseQueueOptions, parseAuditOptions, parseLegacyLedgerMigrationOptions, parseAllowStaleRunnerFlag } from '../task-option-parsers.js';
|
|
46
|
-
import { buildTaskStatusTriangulation as buildTaskStatusTriangulationDelegated, readScopeAmendmentEvents as readScopeAmendmentEventsDelegated, readLastTransitionEventRecord as readLastTransitionEventRecordDelegated, resolvePlanningCardPath as resolvePlanningCardPathDelegated } from '../status-triangulation.js';
|
|
47
|
-
import { recordStaleRunnerOverride as recordStaleRunnerOverrideDelegated, recordFailedEmergencyUseAttempt as recordFailedEmergencyUseAttemptDelegated, isCliErrorWithCode as isCliErrorWithCodeDelegated } from '../close-governance.js';
|
|
48
|
-
import { runTasksCompatCommandMap } from '../legacy/compat-command-map.js';
|
|
49
|
-
import { runTasksRealignPlanSource } from '../realign-plan-source.js';
|
|
50
|
-
import { createRepairReconcileLane } from '../legacy/repair-reconcile-lane.js';
|
|
51
|
-
import { createTransitionCompatLane } from '../legacy/transition-compat.js';
|
|
52
|
-
export const validStatuses = new Set(['planned', 'open', 'in_progress', 'reserved', 'ready', 'running', 'review', 'blocked', 'abandoned', 'done']);
|
|
53
|
-
const acceptanceHeaders = ['acceptance criteria', 'acceptance', 'acceptance tests', 'criteria', '驗收', '驗收條件'];
|
|
54
|
-
const deliverablesHeaders = ['deliverables', 'outputs', 'outcomes', '交付物', '產物', '輸出'];
|
|
55
|
-
const dependenciesHeaders = ['dependencies', 'depends on', 'blocked by', '依賴', '相依', '前置'];
|
|
56
|
-
const notesHeaders = ['notes', 'implementation notes', 'background', '備註', '說明'];
|
|
57
|
-
const tagsHeaders = ['tags', 'labels', '標籤'];
|
|
58
|
-
const taskIdPattern = /^(?:TASK-)?[A-Z][A-Z0-9-]*-\d{2,}/;
|
|
59
|
-
const taskIdAnywherePattern = /(?:TASK-)?[A-Z][A-Z0-9-]*-\d{2,}/;
|
|
60
|
-
function isCanonicalDeliverableCandidate(value) { const normalized = normalizeRelativePath(value); if (!normalized)
|
|
61
|
-
return false; if (normalized.startsWith('.atm/'))
|
|
62
|
-
return false; if (/[\\/]$/.test(normalized))
|
|
63
|
-
return false; return true; }
|
|
64
|
-
function inferLegacyDeliverablesFromScope(scopePaths) { if (scopePaths.length === 0)
|
|
65
|
-
return []; const normalized = uniqueStrings(scopePaths.map(normalizeRelativePath).filter(Boolean)); if (normalized.length === 0)
|
|
66
|
-
return []; const inferred = normalized.filter(isCanonicalDeliverableCandidate); return inferred; }
|
|
67
|
-
export async function runTasks(argv) { const repairReconcileLane = createRepairReconcileLane({ reconcile: runTasksReconcile, repairClosure: runTasksRepairClosure, repairClaim: runTasksRepairClaim }); const transitionCompatLane = createTransitionCompatLane({ claimLifecycle: runTasksClaimLifecycle, deliverAndClose: runTasksDeliverAndClose }); return runTasksCompatCommandMap(argv, { close: runTasksClose, reset: runTasksReset, create: runTasksCreate, mirror: runTasksMirror, audit: runTasksAudit, queue: runTasksQueue, parallel: runTasksParallel, lock: runTasksLock, migrateLegacyLedger: runTasksMigrateLegacyLedger, claimLifecycle: transitionCompatLane.claimLifecycle, reconcile: repairReconcileLane.reconcile, repairClosure: repairReconcileLane.repairClosure, repairClaim: repairReconcileLane.repairClaim, show: runTasksShow, status: runTasksStatus, finalize: runTasksFinalize, deliverAndClose: transitionCompatLane.deliverAndClose, roster: runTasksRoster, newTask: runTasksNew, importTask: runTasksImport, verify: runTasksVerify, scope: runTasksScope, realignPlanSource: runTasksRealignPlanSource }); }
|
|
68
|
-
async function runTasksShow(argv) { const { options } = parseOptions(argv, 'tasks'); const taskId = options.task; if (!taskId) {
|
|
69
|
-
throw new CliError('ATM_CLI_USAGE', 'tasks show requires --task <id>', { exitCode: 2 });
|
|
70
|
-
} const taskPath = taskPathFor(options.cwd, taskId); if (!existsSync(taskPath)) {
|
|
71
|
-
throw new CliError('ATM_TASK_NOT_FOUND', `Task file not found for ${taskId}.`, { exitCode: 2, details: { taskPath: relativePathFrom(options.cwd, taskPath), taskId } });
|
|
72
|
-
} const taskDocument = JSON.parse(readFileSync(taskPath, 'utf8')); const messages = [message('info', 'ATM_TASK_SHOW_SUCCESS', `Task details for ${taskId}`)]; if (isRunnerSyncRequired(options.cwd)) {
|
|
73
|
-
messages.push(message('warn', 'ATM_RUNNER_SYNC_REQUIRED', runnerStaleWarningMessage()));
|
|
74
|
-
} return makeResult({ ok: true, command: 'tasks show', cwd: options.cwd, messages, evidence: { taskId, ...taskDocument } }); }
|
|
75
|
-
const resolvePlanningCardPath = resolvePlanningCardPathDelegated;
|
|
76
|
-
const readLastTransitionEventRecord = readLastTransitionEventRecordDelegated;
|
|
77
|
-
const readScopeAmendmentEvents = readScopeAmendmentEventsDelegated;
|
|
78
|
-
const buildTaskStatusTriangulation = buildTaskStatusTriangulationDelegated;
|
|
79
|
-
export const recordStaleRunnerOverride = recordStaleRunnerOverrideDelegated;
|
|
80
|
-
export const isCliErrorWithCode = isCliErrorWithCodeDelegated;
|
|
81
|
-
export const recordFailedEmergencyUseAttempt = recordFailedEmergencyUseAttemptDelegated;
|
|
82
|
-
export function loadTaskDocumentOrThrow(cwd, taskId) { const taskPath = taskPathFor(cwd, taskId); if (!existsSync(taskPath)) {
|
|
83
|
-
throw new CliError('ATM_TASK_NOT_FOUND', `Task file not found for ${taskId}.`, { exitCode: 2, details: { taskPath: relativePathFrom(cwd, taskPath), taskId } });
|
|
84
|
-
} return { taskPath, taskDocument: JSON.parse(readFileSync(taskPath, 'utf8')) }; }
|
|
85
|
-
export function buildResidueDiagnosisEvidence(cwd, taskId, taskDocument) { const triangulation = buildTaskStatusTriangulation(cwd, taskId, taskDocument); return buildResidueDiagnosisEvidenceFromTriangulation({ taskId, triangulation }); }
|
|
86
|
-
async function runTasksStatus(argv) { const options = parseStatusOptions(argv); const { taskDocument } = loadTaskDocumentOrThrow(options.cwd, options.taskId); const triangulation = buildTaskStatusTriangulation(options.cwd, options.taskId, taskDocument); const messages = [message(options.residueOnly ? 'info' : 'info', options.residueOnly ? 'ATM_TASK_RESIDUE_DIAGNOSED' : 'ATM_TASK_STATUS_TRIANGULATED', options.residueOnly ? `Residue diagnosis for ${options.taskId}: ${triangulation.residueClassification.bucket}.` : `Task status triangulation for ${options.taskId}.`, triangulation)]; if (isRunnerSyncRequired(options.cwd)) {
|
|
87
|
-
messages.push(message('warn', 'ATM_RUNNER_SYNC_REQUIRED', runnerStaleWarningMessage()));
|
|
88
|
-
} return makeResult({ ok: true, command: 'tasks status', cwd: options.cwd, messages, evidence: options.residueOnly ? buildResidueDiagnosisEvidence(options.cwd, options.taskId, taskDocument) : { taskId: options.taskId, ...triangulation } }); }
|
|
89
|
-
async function runTasksFinalize(argv) { const subAction = (argv[0] ?? '').toLowerCase(); if (subAction !== 'diagnose') {
|
|
90
|
-
throw new CliError('ATM_CLI_USAGE', 'tasks finalize requires diagnose.', { exitCode: 2 });
|
|
91
|
-
} return runTasksFinalizeDiagnose(argv.slice(1)); }
|
|
92
|
-
async function runTasksFinalizeDiagnose(argv) { const options = parseFinalizeDiagnoseOptions(argv); const { taskDocument } = loadTaskDocumentOrThrow(options.cwd, options.taskId); const evidence = buildResidueDiagnosisEvidence(options.cwd, options.taskId, taskDocument); const messages = [message(evidence.bucket === 'ambiguous-manual-review' ? 'warn' : 'info', 'ATM_TASK_FINALIZE_DIAGNOSED', `Residue bucket ${evidence.bucket} for ${options.taskId}.`, { truth: evidence.truth, residue: evidence.residue, nextCommand: evidence.nextCommand })]; if (isRunnerSyncRequired(options.cwd)) {
|
|
93
|
-
messages.push(message('warn', 'ATM_RUNNER_SYNC_REQUIRED', runnerStaleWarningMessage()));
|
|
94
|
-
} return makeResult({ ok: true, command: 'tasks finalize diagnose', cwd: options.cwd, messages, evidence }); }
|
|
95
|
-
async function runTasksDeliverAndClose(argv) { return delegatedRunTasksDeliverAndClose(argv, { runTasks }); }
|
|
96
|
-
async function runTasksCreate(argv) { const options = parseCreateOptions(argv); assertRunnerFreshForWriteAction({ cwd: options.cwd, action: 'tasks-create', allowStaleRunner: false }); assertLocalTaskLedgerEnabled(options.cwd, 'create'); const resolvedActor = resolveActorId(options.actorId ?? undefined, options.cwd); if (!resolvedActor) {
|
|
97
|
-
throw new CliError('ATM_ACTOR_ID_MISSING', 'tasks create requires --actor or ATM_ACTOR_ID (legacy alias: AGENT_IDENTITY).', { exitCode: 2 });
|
|
98
|
-
} const actorId = resolvedActor.actorId; const taskPath = taskPathFor(options.cwd, options.taskId); if (existsSync(taskPath) && !options.force) {
|
|
99
|
-
throw new CliError('ATM_TASK_EXISTS', `Task ${options.taskId} already exists.`, { exitCode: 1, details: { taskId: options.taskId, taskPath: relativePathFrom(options.cwd, taskPath) } });
|
|
100
|
-
} const createdAt = new Date().toISOString(); const taskDocument = { schemaVersion: 'atm.workItem.v0.2', workItemId: options.taskId, title: options.title ?? options.taskId, status: 'planned', owner: actorId, dependencies: [], acceptance: [], deliverables: [], tags: [], createdAt, createdByActor: actorId }; const transitionPath = writeTaskDocumentWithTransition({ cwd: options.cwd, taskPath, taskId: options.taskId, taskDocument, action: 'create', actorId, previousStatus: null }); return makeResult({ ok: true, command: 'tasks', cwd: options.cwd, messages: [message('info', 'ATM_TASKS_CREATED', `Task ${options.taskId} created.`, { taskId: options.taskId, actorId, status: taskDocument.status })], evidence: { action: 'create', taskId: options.taskId, actorId, status: taskDocument.status, taskPath: relativePathFrom(options.cwd, taskPath), transitionPath } }); }
|
|
101
|
-
async function runTasksMirror(argv) { const options = parseMirrorOptions(argv); assertRunnerFreshForWriteAction({ cwd: options.cwd, action: 'tasks-mirror', allowStaleRunner: false }); assertLocalTaskLedgerEnabled(options.cwd, 'mirror'); const resolvedActor = resolveActorId(options.actorId ?? undefined, options.cwd); if (!resolvedActor) {
|
|
102
|
-
throw new CliError('ATM_ACTOR_ID_MISSING', 'tasks mirror requires --actor or ATM_ACTOR_ID (legacy alias: AGENT_IDENTITY).', { exitCode: 2 });
|
|
103
|
-
} const actorId = resolvedActor.actorId; const taskId = options.taskId ?? defaultMirrorTaskId(options.provider, options.originTaskId); const taskPath = taskPathFor(options.cwd, taskId); const existing = existsSync(taskPath) ? JSON.parse(readFileSync(taskPath, 'utf8')) : null; const previousStatus = existing ? normalizeWorkItemStatus(existing.status) : null; const mirroredAt = typeof existing?.mirroredAt === 'string' ? existing.mirroredAt : new Date().toISOString(); const taskDocument = { ...(existing ?? {}), schemaVersion: 'atm.workItem.v0.2', workItemId: taskId, title: options.title ?? String(existing?.title ?? `${options.provider} ${options.originTaskId}`), status: options.status, owner: actorId, originProvider: options.provider, originTaskId: options.originTaskId, originUrl: options.originUrl, syncStatus: options.syncStatus, taskLedgerMode: 'external-provider', mirroredAt, mirrorUpdatedAt: new Date().toISOString() }; const transitionPath = writeTaskDocumentWithTransition({ cwd: options.cwd, taskPath, taskId, taskDocument, action: 'mirror', actorId, previousStatus }); return makeResult({ ok: true, command: 'tasks', cwd: options.cwd, messages: [message('info', 'ATM_TASKS_MIRRORED', `External task ${options.provider}:${options.originTaskId} mirrored as ${taskId}.`, { taskId, provider: options.provider, originTaskId: options.originTaskId })], evidence: { action: 'mirror', taskId, actorId, taskPath: relativePathFrom(options.cwd, taskPath), originProvider: options.provider, originTaskId: options.originTaskId, transitionPath } }); }
|
|
104
|
-
export function prepareTaskForClaim(input) { return delegatedPrepareTaskForClaim({ ...input, parseSingleCard, writeTaskFiles, writeImportEvidence }); }
|
|
105
|
-
export { verifyCloseoutProvenance } from '../closeout-provenance.js';
|
|
106
|
-
export { findTaskClaimDependencyBlockers } from '../dependency-gates.js';
|
|
107
|
-
async function runTasksReset(argv) { const options = parseResetOptions(argv); const resolvedActor = resolveActorId(options.actorId ?? undefined, options.cwd); if (!resolvedActor) {
|
|
108
|
-
throw new CliError('ATM_ACTOR_ID_MISSING', 'tasks reset requires --actor or ATM_ACTOR_ID (legacy alias: AGENT_IDENTITY).', { exitCode: 2 });
|
|
109
|
-
} const actorId = resolvedActor.actorId; assertEmergencyApproval({ cwd: options.cwd, surface: 'tasks reset', permission: 'backend.tasks.reset', taskId: options.taskId, actorId, emergencyApproval: options.emergencyApproval, flags: [], reason: options.reason ?? 'Direct lifecycle reset backend mutation.', command: `node atm.mjs tasks reset --task ${options.taskId} --actor ${actorId} --to ${options.to} --json` }); const taskPath = taskPathFor(options.cwd, options.taskId); if (!existsSync(taskPath)) {
|
|
110
|
-
throw new CliError('ATM_TASK_NOT_FOUND', `Task file not found for ${options.taskId}.`, { exitCode: 2, details: { taskPath: relativePathFrom(options.cwd, taskPath), taskId: options.taskId } });
|
|
111
|
-
} const taskDocument = JSON.parse(readFileSync(taskPath, 'utf8')); const previousStatus = normalizeTaskStatus(taskDocument.status); const resetAdmission = evaluateTaskResetAdmission({ taskId: options.taskId, fromStatus: previousStatus, toStatus: options.to }); if (!resetAdmission.ok) {
|
|
112
|
-
throw new CliError(resetAdmission.code, resetAdmission.message, { exitCode: resetAdmission.code === 'ATM_CLI_USAGE' ? 2 : 1, details: resetAdmission.details });
|
|
113
|
-
} const currentClaim = parseClaimRecord(taskDocument.claim); if (currentClaim && currentClaim.state === 'active' && currentClaim.actorId !== actorId) {
|
|
114
|
-
throw new CliError('ATM_TASK_CLAIM_OWNER_MISMATCH', `Task ${options.taskId} is claimed by ${currentClaim.actorId}, not ${actorId}.`, { exitCode: 1, details: { taskId: options.taskId, currentActor: currentClaim.actorId, actorId } });
|
|
115
|
-
} if (currentClaim && currentClaim.actorId === actorId) {
|
|
116
|
-
const adapter = createLocalGovernanceAdapter({ repositoryRoot: options.cwd });
|
|
117
|
-
await resolveValue(adapter.stores.lockStore.releaseLock(options.taskId, actorId));
|
|
118
|
-
taskDocument.claim = { ...currentClaim, heartbeatAt: new Date().toISOString(), state: 'released', reason: options.reason ?? 'reset' };
|
|
119
|
-
} taskDocument.status = 'open'; taskDocument.owner = actorId; if (options.reason)
|
|
120
|
-
taskDocument.resetReason = options.reason; delete taskDocument.closedAt; delete taskDocument.closedByActor; delete taskDocument.closurePacket; const transitionPath = writeTaskDocumentWithTransition({ cwd: options.cwd, taskPath, taskId: options.taskId, taskDocument, action: 'reset', actorId, previousStatus }); return makeResult({ ok: true, command: 'tasks', cwd: options.cwd, messages: [message('info', 'ATM_TASKS_RESET', `Task ${options.taskId} reset to open.`, { taskId: options.taskId, actorId, previousStatus, status: 'open' })], evidence: { action: 'reset', taskId: options.taskId, actorId, previousStatus, status: 'open', transitionPath } }); }
|
|
121
|
-
export function readDeferredForeignStagedFilesForActiveCloseWindow(cwd, taskId) { return delegatedReadDeferredForeignStagedFilesForActiveCloseWindow(cwd, taskId); }
|
|
122
|
-
function runTasksAudit(argv) { const options = parseAuditOptions(argv); const report = auditTasks(options.cwd); const activeFindings = report.findings.filter((finding) => !finding.acknowledged); const activeWarnings = activeFindings.filter((finding) => finding.level === 'warning'); const errorFindings = report.findings.filter((finding) => finding.level === 'error'); return makeResult({ ok: report.ok, command: 'tasks', cwd: options.cwd, messages: [!report.ok ? message('error', 'ATM_TASKS_AUDIT_FAILED', 'Task audit found invalid task closure evidence.', { findingCount: report.findings.length, errorCount: errorFindings.length, activeFindingCount: activeFindings.length, acknowledgedFindingCount: report.acknowledgedFindingCount ?? 0 }) : activeWarnings.length > 0 ? message('warn', 'ATM_TASKS_AUDIT_WARNINGS', `Task audit passed with ${activeWarnings.length} active warning(s); ${report.acknowledgedFindingCount ?? 0} baseline warning(s) were acknowledged.`, { inspectedTaskCount: report.inspectedTaskCount, inspectedEvidenceCount: report.inspectedEvidenceCount, warningCount: activeWarnings.length, acknowledgedWarningCount: report.acknowledgedFindingCount ?? 0, warningCodes: Array.from(new Set(activeWarnings.map((finding) => finding.code))), activeFindings: activeWarnings, findings: report.findings }) : message('info', 'ATM_TASKS_AUDIT_OK', 'Task audit passed.', { inspectedTaskCount: report.inspectedTaskCount, inspectedEvidenceCount: report.inspectedEvidenceCount, acknowledgedWarningCount: report.acknowledgedFindingCount ?? 0 })], evidence: { action: 'audit', staged: options.staged, report } }); }
|
|
123
|
-
async function runTasksLock(argv) { const action = (argv[0] ?? '').toLowerCase(); if (action !== 'cleanup') {
|
|
124
|
-
throw new CliError('ATM_CLI_USAGE', 'tasks lock supports only: cleanup', { exitCode: 2 });
|
|
125
|
-
} return await runTasksLockCleanup(argv.slice(1)); }
|
|
126
|
-
async function runTasksScope(argv) { const subAction = (argv[0] ?? '').toLowerCase(); if (subAction === 'add') {
|
|
127
|
-
return runTasksScopeAdd(argv.slice(1));
|
|
128
|
-
} if (subAction === 'repair') {
|
|
129
|
-
return runTasksScopeRepair(argv.slice(1));
|
|
130
|
-
} if (subAction === 'repair-deliverables') {
|
|
131
|
-
return runTasksMetadataRepairDeliverables(argv.slice(1));
|
|
132
|
-
} if (subAction === 'remove') {
|
|
133
|
-
return runTasksScopeRemove(argv.slice(1));
|
|
134
|
-
} if (!subAction) {
|
|
135
|
-
throw new CliError('ATM_CLI_USAGE', 'tasks scope requires a sub-action: add | remove | repair | repair-deliverables', { exitCode: 2 });
|
|
136
|
-
} throw new CliError('ATM_CLI_USAGE', `tasks scope does not support sub-action ${subAction}. Supported: add, remove, repair, repair-deliverables`, { exitCode: 2 }); }
|
|
137
|
-
function buildMetadataRepairNoClaimMessage(precondition) { return [`tasks scope repair-deliverables requires an active claim held by ${precondition.actorId}.`, `Current claimState=${precondition.claimState}; claimActorId=${precondition.claimActorId ?? '<none>'}; leaseState=${precondition.leaseState}.`, `Claim the task first, then rerun: node atm.mjs tasks scope repair-deliverables --task ${precondition.taskId} --actor ${precondition.actorId} --set <paths> --reason "<why the card metadata changed>" --json`].join('\n'); }
|
|
138
|
-
async function runTasksMetadataRepairDeliverables(argv) { const options = parseMetadataRepairDeliverablesOptions(argv); assertRunnerFreshForWriteAction({ cwd: options.cwd, action: 'tasks-scope-repair-deliverables', allowStaleRunner: false }); const resolvedActor = resolveActorId(options.actorId ?? undefined, options.cwd); if (!resolvedActor) {
|
|
139
|
-
throw new CliError('ATM_ACTOR_ID_MISSING', 'tasks metadata repair-deliverables requires --actor or ATM_ACTOR_ID.', { exitCode: 2 });
|
|
140
|
-
} const actorId = resolvedActor.actorId; const precondition = inspectScopeAmendmentPreconditions(options.cwd, options.taskId, actorId); if (precondition.claimState !== 'active' || precondition.claimActorId !== actorId || precondition.leaseState !== 'active') {
|
|
141
|
-
throw new CliError('ATM_TASK_METADATA_REPAIR_ACTIVE_CLAIM_REQUIRED', buildMetadataRepairNoClaimMessage(precondition), { exitCode: 1, details: precondition });
|
|
142
|
-
} const rawDeliverables = options.setPaths.map((entry) => entry.trim()).filter(Boolean); const rawDeliverableViolations = validateDeliverablesList(rawDeliverables, true); const candidateDeliverables = sanitizeTaskDirectionAllowedFiles(rawDeliverables); if (rawDeliverableViolations.length > 0 || candidateDeliverables.length !== rawDeliverables.length) {
|
|
143
|
-
const droppedEntries = rawDeliverables.filter((entry) => !candidateDeliverables.includes(normalizeRelativePath(entry)));
|
|
144
|
-
const violations = rawDeliverableViolations.length > 0 ? rawDeliverableViolations : droppedEntries.map((entry) => ({ entry, reason: 'not-path-shaped', severity: 'error' }));
|
|
145
|
-
throw new CliError('ATM_TASK_METADATA_REPAIR_DELIVERABLE_PATH_INVALID', `tasks scope repair-deliverables rejected non-path deliverables for ${options.taskId}: ${violations.map((entry) => entry.entry).join(', ')}`, { exitCode: 1, details: { taskId: options.taskId, violations } });
|
|
146
|
-
} const taskPath = taskPathFor(options.cwd, options.taskId); const taskDocument = readJsonRecord(taskPath); const previousDeliverables = sanitizeTaskDirectionAllowedFiles(Array.isArray(taskDocument.deliverables) ? taskDocument.deliverables : []); taskDocument.deliverables = [...candidateDeliverables]; const lockPath = path.join(options.cwd, '.atm', 'runtime', 'locks', `${options.taskId}.lock.json`); let allowedFiles = []; if (existsSync(lockPath)) {
|
|
147
|
-
const outerLock = JSON.parse(readFileSync(lockPath, 'utf8'));
|
|
148
|
-
const embeddedLock = outerLock.taskDirectionLock;
|
|
149
|
-
if (embeddedLock && typeof embeddedLock === 'object' && !Array.isArray(embeddedLock)) {
|
|
150
|
-
const embeddedLockRecord = embeddedLock;
|
|
151
|
-
const existingAllowed = sanitizeTaskDirectionAllowedFiles(Array.isArray(embeddedLockRecord.allowedFiles) ? embeddedLockRecord.allowedFiles : []);
|
|
152
|
-
const mergedAllowed = sanitizeTaskDirectionAllowedFiles([...existingAllowed, ...candidateDeliverables]);
|
|
153
|
-
syncScopeAmendmentRuntimeLock({ outerLock, embeddedLockRecord, mergedAllowed });
|
|
154
|
-
writeFileSync(lockPath, `${JSON.stringify(outerLock, null, 2)}\n`, 'utf8');
|
|
155
|
-
allowedFiles = mergedAllowed;
|
|
156
|
-
}
|
|
157
|
-
} const createdAt = new Date().toISOString(); const transitionSeedDocument = { ...taskDocument, lastTransitionId: 'pending-metadata-repair', lastTransitionAt: createdAt }; const transitionId = createTaskTransitionId({ createdAt, taskId: options.taskId, action: 'metadata-repair', taskDocument: transitionSeedDocument }); taskDocument.lastTransitionId = transitionId; taskDocument.lastTransitionAt = createdAt; taskDocument.ledgerContractVersion = 'task-ledger/v1'; appendTaskTransitionEvent({ cwd: options.cwd, taskId: options.taskId, action: 'metadata-repair', actorId, fromStatus: String(taskDocument.status ?? 'running'), toStatus: String(taskDocument.status ?? 'running'), taskPath, taskDocument, command: `node atm.mjs tasks scope repair-deliverables --task ${options.taskId} --actor ${actorId} --set ${candidateDeliverables.join(',')} --reason "${options.reason}" --json`, createdAt, transitionId, amendmentMetadata: { amendmentClass: 'task-metadata', amendmentPhase: 'during-implementation', amendmentMode: 'normal', reason: options.reason } }); writeTaskDocument(taskPath, taskDocument); return makeResult({ ok: true, command: 'tasks metadata repair-deliverables', cwd: options.cwd, messages: [message('info', 'ATM_TASK_METADATA_REPAIR_DELIVERABLES_APPLIED', `Deliverable metadata repaired for ${options.taskId}: ${candidateDeliverables.length} path(s).`, { taskId: options.taskId, actorId, previousDeliverables, deliverables: candidateDeliverables, allowedFiles, transitionId })], evidence: { action: 'metadata-repair', metadataField: 'deliverables', taskId: options.taskId, actorId, previousDeliverables, deliverables: candidateDeliverables, allowedFiles, transitionId } }); }
|
|
158
|
-
function inspectScopeAmendmentPreconditions(cwd, taskId, actorId) { const taskPath = taskPathFor(cwd, taskId); const taskDocument = existsSync(taskPath) ? readJsonRecord(taskPath) : {}; const claim = parseClaimRecord(taskDocument.claim); const nowIso = new Date().toISOString(); const lockPath = path.join(cwd, '.atm', 'runtime', 'locks', `${taskId}.lock.json`); let lockState = 'missing'; if (existsSync(lockPath)) {
|
|
159
|
-
try {
|
|
160
|
-
const outerLock = JSON.parse(readFileSync(lockPath, 'utf8'));
|
|
161
|
-
lockState = outerLock.released === true || outerLock.status === 'released' ? 'released' : 'active';
|
|
162
|
-
}
|
|
163
|
-
catch {
|
|
164
|
-
lockState = 'unreadable';
|
|
165
|
-
}
|
|
166
|
-
} return { taskId, actorId, lockState, claimState: claim?.state ?? 'none', leaseState: claim?.leaseId ? (isClaimExpired(claim, nowIso) ? 'expired' : 'active') : 'none', claimActorId: claim?.actorId ?? null, leaseId: claim?.leaseId ?? null, resolvedBy: 'none', claimCommand: `node atm.mjs next --claim --task ${taskId} --actor ${actorId} --auto-intent --json`, claimFirstScopeAddCommand: `node atm.mjs tasks scope add --task ${taskId} --actor ${actorId} --claim-first --add <paths> --json` }; }
|
|
167
|
-
function buildScopeAmendmentNoClaimMessage(input) { return [`Scope amendment for ${input.taskId} requires an active claim, not a bare lock or renewed lease.`, `Current state: lock=${input.lockState}, claim=${input.claimState}, lease=${input.leaseState}.`, 'Run one of:', ` - ${input.claimFirstScopeAddCommand} (recommended when claim and scope expansion are blocking each other)`, ` - ${input.claimCommand} (claim first when no scope expansion is needed)`, ` - node atm.mjs tasks renew --task ${input.taskId} --actor ${input.actorId} --json (if lease only)`, 'Then retry the scope amendment.'].join('\n'); }
|
|
168
|
-
async function resolveScopeAmendmentClaimFirst(input) { const precondition = inspectScopeAmendmentPreconditions(input.cwd, input.taskId, input.actorId); if (precondition.claimState === 'active' && precondition.claimActorId === input.actorId) {
|
|
169
|
-
return precondition;
|
|
170
|
-
} const taskDocument = readJsonRecord(taskPathFor(input.cwd, input.taskId)); prepareTaskForClaim({ cwd: input.cwd, taskId: input.taskId, actorId: input.actorId, status: taskDocument.status, title: typeof taskDocument.title === 'string' ? taskDocument.title : input.taskId, transitionCommand: `node atm.mjs next --claim --task ${input.taskId} --actor ${input.actorId} --auto-intent --json` }); const files = extractTaskCloseDeclaredFiles(taskDocument, input.cwd, input.taskId); await runTasksClaimLifecycle('claim', ['--cwd', input.cwd, '--task', input.taskId, '--actor', input.actorId, '--auto-intent', '--files', files.join(','), '--json']); return { ...inspectScopeAmendmentPreconditions(input.cwd, input.taskId, input.actorId), resolvedBy: 'claim-first' }; }
|
|
171
|
-
async function runTasksScopeAdd(argv) { const options = parseScopeAddOptions(argv); assertRunnerFreshForWriteAction({ cwd: options.cwd, action: 'tasks-scope-add', allowStaleRunner: false }); const resolvedActor = resolveActorId(options.actorId ?? undefined, options.cwd); if (!resolvedActor) {
|
|
172
|
-
throw new CliError('ATM_ACTOR_ID_MISSING', 'tasks scope add requires --actor or ATM_ACTOR_ID.', { exitCode: 2 });
|
|
173
|
-
} const actorId = resolvedActor.actorId; let preconditionResolution = inspectScopeAmendmentPreconditions(options.cwd, options.taskId, actorId); if (options.claimFirst) {
|
|
174
|
-
preconditionResolution = await resolveScopeAmendmentClaimFirst({ cwd: options.cwd, taskId: options.taskId, actorId });
|
|
175
|
-
} const lockPath = path.join(options.cwd, '.atm', 'runtime', 'locks', `${options.taskId}.lock.json`); if (!existsSync(lockPath)) {
|
|
176
|
-
throw new CliError('ATM_SCOPE_AMENDMENT_NO_ACTIVE_LOCK', buildScopeAmendmentNoClaimMessage(preconditionResolution), { exitCode: 1, details: { ...preconditionResolution, taskId: options.taskId, requiredCommand: preconditionResolution.claimFirstScopeAddCommand, claimCommand: preconditionResolution.claimCommand } });
|
|
177
|
-
} let outerLock; try {
|
|
178
|
-
outerLock = JSON.parse(readFileSync(lockPath, 'utf8'));
|
|
179
|
-
}
|
|
180
|
-
catch {
|
|
181
|
-
throw new CliError('ATM_SCOPE_AMENDMENT_NO_ACTIVE_LOCK', `Could not read direction lock for task ${options.taskId}.`, { exitCode: 1, details: { ...preconditionResolution, taskId: options.taskId, requiredCommand: preconditionResolution.claimFirstScopeAddCommand, claimCommand: preconditionResolution.claimCommand } });
|
|
182
|
-
} if (outerLock.released === true || outerLock.status === 'released') {
|
|
183
|
-
throw new CliError('ATM_SCOPE_AMENDMENT_LOCK_RELEASED', `Task ${options.taskId} direction lock is released; use tasks scope add --claim-first when claim and scope expansion are blocking each other.`, { exitCode: 1, details: { ...preconditionResolution, taskId: options.taskId, requiredCommand: preconditionResolution.claimFirstScopeAddCommand, claimCommand: preconditionResolution.claimCommand } });
|
|
184
|
-
} const embeddedLock = outerLock.taskDirectionLock; if (!embeddedLock || typeof embeddedLock !== 'object' || Array.isArray(embeddedLock)) {
|
|
185
|
-
throw new CliError('ATM_SCOPE_AMENDMENT_NO_ACTIVE_LOCK', `Lock file for ${options.taskId} does not contain an embedded taskDirectionLock.`, { exitCode: 1, details: { ...preconditionResolution, taskId: options.taskId, requiredCommand: preconditionResolution.claimFirstScopeAddCommand, claimCommand: preconditionResolution.claimCommand } });
|
|
186
|
-
} const embeddedLockRecord = embeddedLock; const existingAllowed = sanitizeTaskDirectionAllowedFiles(Array.isArray(embeddedLockRecord.allowedFiles) ? embeddedLockRecord.allowedFiles : []); const requestedPaths = sanitizeTaskDirectionAllowedFiles(options.addPaths); const addedPaths = requestedPaths.filter((p) => !existingAllowed.includes(p)); const alreadyPresent = requestedPaths.filter((p) => existingAllowed.includes(p)); const mergedAllowed = sanitizeTaskDirectionAllowedFiles([...existingAllowed, ...requestedPaths]); const taskPath = taskPathFor(options.cwd, options.taskId); const amendmentMetadata = { amendmentClass: options.amendmentClass ?? 'linked-surface', amendmentPhase: options.amendmentPhase ?? 'during-implementation', amendmentMode: 'normal', ...(options.reason ? { reason: options.reason } : {}) }; if (existsSync(taskPath)) {
|
|
187
|
-
const taskDocument = readJsonRecord(taskPath);
|
|
188
|
-
if (preconditionResolution.resolvedBy === 'claim-first') {
|
|
189
|
-
appendTaskTransitionEvent({ cwd: options.cwd, taskId: options.taskId, action: 'scope-amendment.claim-first-resolved', actorId, fromStatus: String(taskDocument.status ?? 'running'), toStatus: String(taskDocument.status ?? 'running'), taskPath, taskDocument, command: preconditionResolution.claimCommand });
|
|
190
|
-
}
|
|
191
|
-
const commandLine = buildScopeAmendmentCommand({ mode: 'normal', taskId: options.taskId, actorId, addPaths: options.addPaths, amendmentClass: options.amendmentClass, amendmentPhase: options.amendmentPhase, reason: options.reason });
|
|
192
|
-
applyAtomicScopeAmendment({ taskDocument, outerLock, embeddedLockRecord, mergedAllowed, taskId: options.taskId, actorId, ports: { resealTicket: (document) => { const claim = document.claim; if (!claim || typeof claim !== 'object' || Array.isArray(claim))
|
|
193
|
-
return; resealWorkAdmissionTicketForRenewal({ cwd: options.cwd, taskId: options.taskId, actorId, taskDocument: document, claim: claim, nowIso: new Date().toISOString() }); }, writeLock: (lock) => { writeFileSync(lockPath, `${JSON.stringify(lock, null, 2)}\n`, 'utf8'); }, persistLedger: (document) => { persistScopeAmendmentTransition({ cwd: options.cwd, taskId: options.taskId, actorId, taskPath, taskDocument: document, command: commandLine, amendmentMetadata }); } } });
|
|
194
|
-
}
|
|
195
|
-
else {
|
|
196
|
-
syncScopeAmendmentRuntimeLock({ outerLock, embeddedLockRecord, mergedAllowed });
|
|
197
|
-
writeFileSync(lockPath, `${JSON.stringify(outerLock, null, 2)}\n`, 'utf8');
|
|
198
|
-
} return makeResult({ ok: true, command: 'tasks', cwd: options.cwd, messages: [message('info', 'ATM_SCOPE_AMENDMENT_APPLIED', addedPaths.length > 0 ? `Scope amendment applied for ${options.taskId}: ${addedPaths.length} path(s) added to allowedFiles.` : `Scope amendment for ${options.taskId}: all requested paths were already in allowedFiles.`, { taskId: options.taskId, actorId, addedPaths, alreadyPresent, allowedFiles: mergedAllowed, preconditionResolution, amendmentMetadata, requiredCommand: `node atm.mjs tasks scope add --task ${options.taskId} --actor ${actorId} --add <paths> --json` })], evidence: { action: 'scope-amendment', amendmentMode: 'normal', taskId: options.taskId, actorId, addedPaths, alreadyPresent, allowedFiles: mergedAllowed, preconditionResolution, amendmentMetadata } }); }
|
|
199
|
-
async function runTasksScopeRemove(argv) { const options = parseScopeAddOptions(argv.map((value) => value === '--remove' ? '--add' : value)); const resolvedActor = resolveActorId(options.actorId ?? undefined, options.cwd); if (!resolvedActor)
|
|
200
|
-
throw new CliError('ATM_ACTOR_ID_MISSING', 'tasks scope remove requires --actor or ATM_ACTOR_ID.', { exitCode: 2 }); const actorId = resolvedActor.actorId; const precondition = inspectScopeAmendmentPreconditions(options.cwd, options.taskId, actorId); if (precondition.claimState !== 'active' || precondition.claimActorId !== actorId) {
|
|
201
|
-
throw new CliError('ATM_SCOPE_SHRINK_ACTIVE_CLAIM_REQUIRED', buildScopeAmendmentNoClaimMessage(precondition), { exitCode: 1, details: precondition });
|
|
202
|
-
} const taskPath = taskPathFor(options.cwd, options.taskId); const taskDocument = readJsonRecord(taskPath); const requested = sanitizeTaskDirectionAllowedFiles(options.addPaths); const deliverables = sanitizeTaskDirectionAllowedFiles(Array.isArray(taskDocument.deliverables) ? taskDocument.deliverables : []); const protectedPaths = requested.filter((file) => deliverables.includes(file)); if (protectedPaths.length > 0) {
|
|
203
|
-
throw new CliError('ATM_SCOPE_SHRINK_DELIVERABLE_FORBIDDEN', `tasks scope remove cannot remove declared deliverables: ${protectedPaths.join(', ')}`, { exitCode: 1, details: { taskId: options.taskId, protectedPaths } });
|
|
204
|
-
} const lockPath = path.join(options.cwd, '.atm', 'runtime', 'locks', `${options.taskId}.lock.json`); if (!existsSync(lockPath))
|
|
205
|
-
throw new CliError('ATM_SCOPE_AMENDMENT_NO_ACTIVE_LOCK', buildScopeAmendmentNoClaimMessage(precondition), { exitCode: 1, details: precondition }); const outerLock = JSON.parse(readFileSync(lockPath, 'utf8')); const embeddedLockRecord = outerLock.taskDirectionLock; if (!embeddedLockRecord || Array.isArray(embeddedLockRecord))
|
|
206
|
-
throw new CliError('ATM_SCOPE_AMENDMENT_NO_ACTIVE_LOCK', `Lock file for ${options.taskId} does not contain an embedded taskDirectionLock.`, { exitCode: 1 }); const existingAllowed = sanitizeTaskDirectionAllowedFiles(Array.isArray(embeddedLockRecord.allowedFiles) ? embeddedLockRecord.allowedFiles : []); const removedPaths = requested.filter((file) => existingAllowed.includes(file)); const mergedAllowed = existingAllowed.filter((file) => !removedPaths.includes(file)); syncScopeAmendmentState({ taskDocument, outerLock, embeddedLockRecord, mergedAllowed }); writeFileSync(lockPath, `${JSON.stringify(outerLock, null, 2)}\n`, 'utf8'); persistScopeAmendmentTransition({ cwd: options.cwd, taskId: options.taskId, actorId, taskPath, taskDocument, command: `node atm.mjs tasks scope remove --task ${options.taskId} --actor ${actorId} --remove ${requested.join(',')} --json`, amendmentMetadata: { amendmentClass: 'scope-shrink', amendmentPhase: 'during-implementation', amendmentMode: 'normal', reason: options.reason ?? 'Remove an incorrect non-deliverable shared scope path.' } }); return makeResult({ ok: true, command: 'tasks', cwd: options.cwd, messages: [message('info', 'ATM_SCOPE_SHRINK_APPLIED', `Scope shrink applied for ${options.taskId}: ${removedPaths.length} path(s) removed.`, { taskId: options.taskId, actorId, removedPaths, allowedFiles: mergedAllowed })], evidence: { action: 'scope-shrink', taskId: options.taskId, actorId, removedPaths, allowedFiles: mergedAllowed } }); }
|
|
207
|
-
function runTasksScopeRepair(argv) { const options = parseScopeRepairOptions(argv); const resolvedActor = resolveActorId(options.actorId ?? undefined, options.cwd); if (!resolvedActor) {
|
|
208
|
-
throw new CliError('ATM_ACTOR_ID_MISSING', 'tasks scope repair requires --actor or ATM_ACTOR_ID.', { exitCode: 2 });
|
|
209
|
-
} const actorId = resolvedActor.actorId; assertEmergencyApproval({ cwd: options.cwd, surface: 'tasks scope repair', permission: 'backend.tasks.scopeAmend', taskId: options.taskId, actorId, emergencyApproval: options.emergencyApproval, flags: ['--add', '--reason'], reason: options.reason, command: `node atm.mjs tasks scope repair --task ${options.taskId} --actor ${actorId} --add ${options.addPaths.join(',')} --reason "${options.reason}" --emergency-approval ${options.emergencyApproval} --json` }); const lockPath = path.join(options.cwd, '.atm', 'runtime', 'locks', `${options.taskId}.lock.json`); if (!existsSync(lockPath)) {
|
|
210
|
-
throw new CliError('ATM_SCOPE_AMENDMENT_NO_ACTIVE_LOCK', `No active direction lock found for task ${options.taskId}. The task must be claimed before repairing its scope.`, { exitCode: 1, details: { taskId: options.taskId } });
|
|
211
|
-
} let outerLock; try {
|
|
212
|
-
outerLock = JSON.parse(readFileSync(lockPath, 'utf8'));
|
|
213
|
-
}
|
|
214
|
-
catch {
|
|
215
|
-
throw new CliError('ATM_SCOPE_AMENDMENT_NO_ACTIVE_LOCK', `Could not read direction lock for task ${options.taskId}.`, { exitCode: 1, details: { taskId: options.taskId } });
|
|
216
|
-
} if (outerLock.released === true || outerLock.status === 'released') {
|
|
217
|
-
throw new CliError('ATM_SCOPE_AMENDMENT_LOCK_RELEASED', `Task ${options.taskId} direction lock is released; claim the task first.`, { exitCode: 1, details: { taskId: options.taskId } });
|
|
218
|
-
} const embeddedLock = outerLock.taskDirectionLock; if (!embeddedLock || typeof embeddedLock !== 'object' || Array.isArray(embeddedLock)) {
|
|
219
|
-
throw new CliError('ATM_SCOPE_AMENDMENT_NO_ACTIVE_LOCK', `Lock file for ${options.taskId} does not contain an embedded taskDirectionLock.`, { exitCode: 1, details: { taskId: options.taskId } });
|
|
220
|
-
} const embeddedLockRecord = embeddedLock; const existingAllowed = sanitizeTaskDirectionAllowedFiles(Array.isArray(embeddedLockRecord.allowedFiles) ? embeddedLockRecord.allowedFiles : []); const requestedPaths = sanitizeTaskDirectionAllowedFiles(options.addPaths); const addedPaths = requestedPaths.filter((p) => !existingAllowed.includes(p)); const alreadyPresent = requestedPaths.filter((p) => existingAllowed.includes(p)); const mergedAllowed = sanitizeTaskDirectionAllowedFiles([...existingAllowed, ...requestedPaths]); const taskPath = taskPathFor(options.cwd, options.taskId); const amendmentMetadata = { amendmentClass: 'linked-surface', amendmentPhase: 'during-implementation', amendmentMode: 'repair', reason: options.reason }; if (existsSync(taskPath)) {
|
|
221
|
-
const taskDocument = readJsonRecord(taskPath);
|
|
222
|
-
const commandLine = buildScopeAmendmentCommand({ mode: 'repair', taskId: options.taskId, actorId, addPaths: options.addPaths, reason: options.reason, emergencyApproval: options.emergencyApproval });
|
|
223
|
-
applyAtomicScopeAmendment({ taskDocument, outerLock, embeddedLockRecord, mergedAllowed, taskId: options.taskId, actorId, ports: { resealTicket: (document) => { const claim = document.claim; if (!claim || typeof claim !== 'object' || Array.isArray(claim))
|
|
224
|
-
return; resealWorkAdmissionTicketForRenewal({ cwd: options.cwd, taskId: options.taskId, actorId, taskDocument: document, claim: claim, nowIso: new Date().toISOString() }); }, writeLock: (lock) => { writeFileSync(lockPath, `${JSON.stringify(lock, null, 2)}\n`, 'utf8'); }, persistLedger: (document) => { persistScopeAmendmentTransition({ cwd: options.cwd, taskId: options.taskId, actorId, taskPath, taskDocument: document, command: commandLine, amendmentMetadata }); } } });
|
|
225
|
-
}
|
|
226
|
-
else {
|
|
227
|
-
syncScopeAmendmentRuntimeLock({ outerLock, embeddedLockRecord, mergedAllowed });
|
|
228
|
-
writeFileSync(lockPath, `${JSON.stringify(outerLock, null, 2)}\n`, 'utf8');
|
|
229
|
-
} return makeResult({ ok: true, command: 'tasks', cwd: options.cwd, messages: [message('info', 'ATM_SCOPE_REPAIR_APPLIED', addedPaths.length > 0 ? `Scope repair applied for ${options.taskId}: ${addedPaths.length} path(s) added to allowedFiles (maintenance lane).` : `Scope repair for ${options.taskId}: all requested paths were already in allowedFiles.`, { taskId: options.taskId, actorId, addedPaths, alreadyPresent, allowedFiles: mergedAllowed, amendmentMetadata, requiredCommand: `node atm.mjs tasks scope repair --task ${options.taskId} --actor ${actorId} --add <paths> --reason "<reason>" --emergency-approval <leaseId> --json` })], evidence: { action: 'scope-amendment', amendmentMode: 'repair', taskId: options.taskId, actorId, addedPaths, alreadyPresent, allowedFiles: mergedAllowed, amendmentMetadata } }); }
|
|
230
|
-
async function runTasksLockCleanup(argv) { const options = parseLockCleanupOptions(argv); const resolvedActor = resolveActorId(options.actorId ?? undefined, options.cwd); if (!resolvedActor) {
|
|
231
|
-
throw new CliError('ATM_ACTOR_ID_MISSING', 'tasks lock cleanup requires --actor or ATM_ACTOR_ID (legacy alias: AGENT_IDENTITY).', { exitCode: 2 });
|
|
232
|
-
} const actorId = resolvedActor.actorId; if (options.allStale) {
|
|
233
|
-
assertEmergencyApproval({ cwd: options.cwd, surface: 'tasks lock cleanup --all-stale', permission: 'backend.tasks.lockCleanupGlobal', taskId: null, actorId, emergencyApproval: options.emergencyApproval, flags: ['--all-stale'], reason: options.reason ?? 'Global stale lock cleanup.', command: `node atm.mjs tasks lock cleanup --all-stale --actor ${actorId} --json` });
|
|
234
|
-
const taskIds = listRuntimeLockTaskIds(options.cwd);
|
|
235
|
-
const cleaned = [];
|
|
236
|
-
const skipped = [];
|
|
237
|
-
for (const taskId of taskIds) {
|
|
238
|
-
try {
|
|
239
|
-
cleaned.push(await cleanupTaskLock({ cwd: options.cwd, taskId, actorId, reason: options.reason }));
|
|
240
|
-
}
|
|
241
|
-
catch (error) {
|
|
242
|
-
if (error.code === 'ATM_TASK_LOCK_CLEANUP_NOT_ALLOWED') {
|
|
243
|
-
skipped.push({ taskId, reason: 'not-stale' });
|
|
244
|
-
continue;
|
|
245
|
-
}
|
|
246
|
-
throw error;
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
return makeResult({ ok: true, command: 'tasks', cwd: options.cwd, messages: [message('info', 'ATM_TASK_LOCK_CLEANUP_ALL_STALE_OK', `Cleaned ${cleaned.length} stale task lock(s).`, { cleanedCount: cleaned.length, skippedCount: skipped.length })], evidence: { action: 'lock-cleanup', allStale: true, actorId, cleaned, skipped } });
|
|
250
|
-
} const report = await cleanupTaskLock({ cwd: options.cwd, taskId: options.taskId, actorId, reason: options.reason }); return makeResult({ ok: true, command: 'tasks', cwd: options.cwd, messages: [message('info', 'ATM_TASK_LOCK_CLEANUP_OK', `Cleaned stale lock state for ${options.taskId}.`, { taskId: options.taskId, actorId, staleReasons: report.staleReasons, cleanupActions: report.cleanupActions })], evidence: report }); }
|
|
251
|
-
async function cleanupTaskLock(input) { const { cwd, taskId, actorId } = input; const nowIso = new Date().toISOString(); const taskPath = taskPathFor(cwd, taskId); let taskDocument = existsSync(taskPath) ? JSON.parse(readFileSync(taskPath, 'utf8')) : null; const currentStatus = normalizeTaskStatus(taskDocument?.status); const currentClaim = parseClaimRecord(taskDocument?.claim); const lockPath = path.join(cwd, '.atm', 'runtime', 'locks', `${taskId}.lock.json`); const sidecarPath = path.join(cwd, '.atm', 'runtime', 'task-direction-locks', `${taskId}.json`); const governanceLock = existsSync(lockPath) ? JSON.parse(readFileSync(lockPath, 'utf8')) : null; const releasedLock = governanceLock?.released === true || governanceLock?.status === 'released'; const staleReasons = []; if (releasedLock)
|
|
252
|
-
staleReasons.push('released-lock'); if (!taskDocument)
|
|
253
|
-
staleReasons.push('missing-task'); if (currentStatus === 'done' || currentStatus === 'abandoned' || currentStatus === 'blocked') {
|
|
254
|
-
staleReasons.push(`terminal-task:${currentStatus}`);
|
|
255
|
-
} if (currentClaim && isClaimExpired(currentClaim, nowIso))
|
|
256
|
-
staleReasons.push('expired-claim'); if (!governanceLock && existsSync(sidecarPath))
|
|
257
|
-
staleReasons.push('orphaned-sidecar'); if (governanceLock && !releasedLock && !currentClaim && existsSync(sidecarPath))
|
|
258
|
-
staleReasons.push('lock-without-claim'); if (staleReasons.length === 0) {
|
|
259
|
-
throw new CliError('ATM_TASK_LOCK_CLEANUP_NOT_ALLOWED', `Task ${taskId} does not have a stale cleanup candidate.`, { exitCode: 1, details: { taskId, lockPath: existsSync(lockPath) ? relativePathFrom(cwd, lockPath) : null, sidecarPath: existsSync(sidecarPath) ? relativePathFrom(cwd, sidecarPath) : null, status: currentStatus, claimState: currentClaim?.state ?? null } });
|
|
260
|
-
} const adapter = createLocalGovernanceAdapter({ repositoryRoot: cwd }); const cleanupActions = []; if (governanceLock && !releasedLock) {
|
|
261
|
-
await resolveValue(adapter.stores.lockStore.releaseLock(taskId, actorId));
|
|
262
|
-
cleanupActions.push('released-governance-lock');
|
|
263
|
-
} const lockRecordAfterRelease = existsSync(lockPath) ? JSON.parse(readFileSync(lockPath, 'utf8')) : governanceLock; if (lockRecordAfterRelease && releaseEmbeddedDirectionLock({ lockPath, lockRecord: lockRecordAfterRelease, actorId, nowIso })) {
|
|
264
|
-
cleanupActions.push('released-embedded-direction-lock');
|
|
265
|
-
} let taskLedgerTransitionPath = null; if (taskDocument) {
|
|
266
|
-
let taskLedgerMutated = false;
|
|
267
|
-
if (currentClaim && currentClaim.state === 'active' && (currentStatus === 'done' || currentStatus === 'abandoned' || currentStatus === 'blocked')) {
|
|
268
|
-
taskDocument.claim = { ...currentClaim, heartbeatAt: nowIso, state: 'released', reason: input.reason ?? 'lock-cleanup' };
|
|
269
|
-
taskLedgerMutated = true;
|
|
270
|
-
cleanupActions.push('released-terminal-active-claim');
|
|
271
|
-
}
|
|
272
|
-
if (applyCanonicalDirectionLockRelease({ taskDocument, actorId, nowIso })) {
|
|
273
|
-
taskLedgerMutated = true;
|
|
274
|
-
cleanupActions.push('released-canonical-direction-lock');
|
|
275
|
-
}
|
|
276
|
-
if (taskLedgerMutated) {
|
|
277
|
-
const previousStatus = typeof taskDocument.status === 'string' ? taskDocument.status : null;
|
|
278
|
-
taskLedgerTransitionPath = writeTaskDocumentWithTransition({ cwd, taskPath, taskId, taskDocument, action: 'lock-cleanup', actorId, previousStatus, command: `node atm.mjs tasks lock cleanup --task ${taskId} --actor ${actorId} --json` });
|
|
279
|
-
cleanupActions.push(`transition:${relativePathFrom(cwd, taskLedgerTransitionPath)}`);
|
|
280
|
-
try {
|
|
281
|
-
execFileSync('git', ['add', '--', relativePathFrom(cwd, taskPath), taskLedgerTransitionPath], { cwd, stdio: 'ignore' });
|
|
282
|
-
}
|
|
283
|
-
catch { }
|
|
284
|
-
}
|
|
285
|
-
} if (existsSync(sidecarPath)) {
|
|
286
|
-
rmSync(sidecarPath, { force: true });
|
|
287
|
-
cleanupActions.push('removed-direction-sidecar');
|
|
288
|
-
} let terminalBrokerCleanupResult = null; if (currentStatus === 'done' || currentStatus === 'abandoned' || currentStatus === 'blocked') {
|
|
289
|
-
try {
|
|
290
|
-
terminalBrokerCleanupResult = await cleanupTerminalBrokerIntents({ cwd, taskId, actorId });
|
|
291
|
-
cleanupActions.push('released-terminal-broker-intents');
|
|
292
|
-
}
|
|
293
|
-
catch (error) {
|
|
294
|
-
terminalBrokerCleanupResult = { ok: false, code: error?.code ?? null, message: error instanceof Error ? error.message : String(error) };
|
|
295
|
-
cleanupActions.push('terminal-broker-intent-cleanup-failed');
|
|
296
|
-
}
|
|
297
|
-
} const reportPath = writeLockCleanupReport({ cwd, taskId, actorId, staleReasons, cleanupActions, reason: input.reason }); return { action: 'lock-cleanup', taskId, actorId, staleReasons, cleanupActions, reportPath, transitionPath: taskLedgerTransitionPath, terminalBrokerCleanupResult }; }
|
|
298
|
-
async function cleanupTerminalBrokerIntents(input) { const { runBroker } = await import('../../broker/implementation.js'); return await runBroker(['release', '--cwd', input.cwd, '--task', input.taskId, '--actor', input.actorId]); }
|
|
299
|
-
function runTasksQueue(argv) { const action = (argv[0] ?? 'status').toLowerCase(); const options = parseQueueOptions(argv.slice(action === 'status' || action === 'abandon' ? 1 : 0)); if (action === 'status') {
|
|
300
|
-
const activeQueue = findActiveTaskQueue(options.cwd);
|
|
301
|
-
return makeResult({ ok: true, command: 'tasks', cwd: options.cwd, messages: [message('info', activeQueue ? 'ATM_TASK_QUEUE_ACTIVE' : 'ATM_TASK_QUEUE_EMPTY', activeQueue ? `Active task queue ${activeQueue.queueId} is at index ${activeQueue.currentIndex}.` : 'No active task queue is recorded.', { queueId: activeQueue?.queueId ?? null, queueHeadTaskId: activeQueue ? activeQueue.taskIds[activeQueue.currentIndex] ?? null : null })], evidence: { action: 'queue status', activeQueue } });
|
|
302
|
-
} if (action === 'abandon') {
|
|
303
|
-
const resolvedActor = resolveActorId(options.actorId ?? undefined, options.cwd);
|
|
304
|
-
if (!resolvedActor) {
|
|
305
|
-
throw new CliError('ATM_ACTOR_ID_MISSING', 'tasks queue abandon requires --actor or ATM_ACTOR_ID (legacy alias: AGENT_IDENTITY).', { exitCode: 2 });
|
|
306
|
-
}
|
|
307
|
-
if (!options.queueId) {
|
|
308
|
-
throw new CliError('ATM_CLI_USAGE', 'tasks queue abandon requires --queue <queueId>.', { exitCode: 2 });
|
|
309
|
-
}
|
|
310
|
-
const queue = abandonTaskQueue({ cwd: options.cwd, queueId: options.queueId, actorId: resolvedActor.actorId, reason: options.reason });
|
|
311
|
-
return makeResult({ ok: true, command: 'tasks', cwd: options.cwd, messages: [message('info', 'ATM_TASK_QUEUE_ABANDONED', `Task queue ${queue.queueId} was abandoned.`, { queueId: queue.queueId, actorId: resolvedActor.actorId })], evidence: { action: 'queue abandon', queue } });
|
|
312
|
-
} throw new CliError('ATM_CLI_USAGE', 'tasks queue supports only: status, abandon.', { exitCode: 2 }); }
|
|
313
|
-
function runTasksParallel(argv) { const parsed = parseTasksParallelArgs(argv); if (parsed.mode === 'pair') {
|
|
314
|
-
const left = readParallelAdvisorTask(parsed.cwd, parsed.taskId);
|
|
315
|
-
const right = readParallelAdvisorTask(parsed.cwd, parsed.withTaskId);
|
|
316
|
-
const finding = analyzeParallelPair(left, right);
|
|
317
|
-
return makeResult({ ok: true, command: 'tasks', cwd: parsed.cwd, messages: [message('info', 'ATM_TASKS_PARALLEL_ANALYZED', `Parallel advisor analyzed ${left.taskId} with ${right.taskId}.`, { verdict: finding.verdict, taskId: left.taskId, withTaskId: right.taskId })], evidence: { action: 'parallel pair', task: left, withTask: right, finding } });
|
|
318
|
-
} if (parsed.mode === 'queue-for-task') {
|
|
319
|
-
const anchor = readParallelAdvisorTask(parsed.cwd, parsed.taskId);
|
|
320
|
-
const candidates = listParallelAdvisorTasks(parsed.cwd).filter((task) => task.taskId !== anchor.taskId);
|
|
321
|
-
const analyses = candidates.map((candidate) => ({ taskId: candidate.taskId, title: candidate.title, status: candidate.status, activeClaimActorId: candidate.activeClaimActorId, activeClaimIntent: candidate.activeClaimIntent, finding: analyzeParallelPair(anchor, candidate) }));
|
|
322
|
-
return makeResult({ ok: true, command: 'tasks', cwd: parsed.cwd, messages: [message('info', 'ATM_TASKS_PARALLEL_QUEUE_ANALYZED', `Parallel advisor compared ${anchor.taskId} against ${analyses.length} queue candidate(s).`, { taskId: anchor.taskId, candidateCount: analyses.length })], evidence: { action: 'parallel queue', task: anchor, candidates: analyses } });
|
|
323
|
-
} const tasks = listParallelAdvisorTasks(parsed.cwd); const hotspot = buildParallelHotspotReport(tasks); return makeResult({ ok: true, command: 'tasks', cwd: parsed.cwd, messages: [message('info', 'ATM_TASKS_PARALLEL_REPORT_READY', `Parallel advisor generated a queue hotspot report for ${tasks.length} task(s).`, { taskCount: tasks.length })], evidence: { action: 'parallel queue report', taskCount: tasks.length, hotspot } }); }
|
|
324
|
-
function parseTasksParallelArgs(argv) { let cwd = process.cwd(); let taskId = null; let withTaskId = null; let queueFlag = false; let reportFlag = false; for (let index = 0; index < argv.length; index += 1) {
|
|
325
|
-
const arg = argv[index];
|
|
326
|
-
if (arg === '--cwd') {
|
|
327
|
-
cwd = requireValue(argv, index, '--cwd');
|
|
328
|
-
index += 1;
|
|
329
|
-
continue;
|
|
330
|
-
}
|
|
331
|
-
if (arg === '--task') {
|
|
332
|
-
taskId = requireValue(argv, index, '--task');
|
|
333
|
-
index += 1;
|
|
334
|
-
continue;
|
|
335
|
-
}
|
|
336
|
-
if (arg === '--with') {
|
|
337
|
-
withTaskId = requireValue(argv, index, '--with');
|
|
338
|
-
index += 1;
|
|
339
|
-
continue;
|
|
340
|
-
}
|
|
341
|
-
if (arg === '--queue') {
|
|
342
|
-
queueFlag = true;
|
|
343
|
-
continue;
|
|
344
|
-
}
|
|
345
|
-
if (arg === '--report') {
|
|
346
|
-
reportFlag = true;
|
|
347
|
-
continue;
|
|
348
|
-
}
|
|
349
|
-
if (arg === '--json' || arg === '--pretty' || arg === '--summary') {
|
|
350
|
-
continue;
|
|
351
|
-
}
|
|
352
|
-
if (arg === '--fields' || arg === '--output-json') {
|
|
353
|
-
index += 1;
|
|
354
|
-
continue;
|
|
355
|
-
}
|
|
356
|
-
throw new CliError('ATM_CLI_USAGE', `tasks parallel does not support option ${arg}.`, { exitCode: 2 });
|
|
357
|
-
} if (taskId && withTaskId) {
|
|
358
|
-
return { cwd, mode: 'pair', taskId: normalizeTaskId(taskId), withTaskId: normalizeTaskId(withTaskId) };
|
|
359
|
-
} if (taskId && queueFlag) {
|
|
360
|
-
return { cwd, mode: 'queue-for-task', taskId: normalizeTaskId(taskId) };
|
|
361
|
-
} if (queueFlag && reportFlag) {
|
|
362
|
-
return { cwd, mode: 'queue-report' };
|
|
363
|
-
} throw new CliError('ATM_CLI_USAGE', 'tasks parallel requires either --task <id> --with <id>, --task <id> --queue, or --queue --report.', { exitCode: 2, details: { invalidFlags: [], missingRequired: [], allowedFlags: ['--cwd', '--task', '--with', '--queue', '--report', '--json', '--pretty', '--output-json', '--summary', '--fields'] } }); }
|
|
364
|
-
function listParallelAdvisorTasks(cwd) { const taskLedger = readTaskLedgerPolicy(cwd); const taskRoot = path.join(cwd, taskLedger.taskRoot); const entries = readdirSync(taskRoot, { withFileTypes: true }); const tasks = []; for (const entry of entries) {
|
|
365
|
-
if (!entry.isFile() || !entry.name.endsWith('.json'))
|
|
366
|
-
continue;
|
|
367
|
-
const fullPath = path.join(taskRoot, entry.name);
|
|
368
|
-
const doc = readJsonRecord(fullPath);
|
|
369
|
-
const status = normalizeTaskStatus(doc.status);
|
|
370
|
-
if (!['open', 'running', 'ready', 'in_progress', 'review', 'blocked', 'reserved'].includes(status))
|
|
371
|
-
continue;
|
|
372
|
-
tasks.push(taskDocumentToParallelAdvisorTask(cwd, doc));
|
|
373
|
-
} return tasks; }
|
|
374
|
-
function readParallelAdvisorTask(cwd, taskId) { const taskPath = taskPathFor(cwd, taskId); if (!existsSync(taskPath)) {
|
|
375
|
-
throw new CliError('ATM_TASK_NOT_FOUND', `Task file not found for ${taskId}.`, { exitCode: 2, details: { taskId, taskPath: relativePathFrom(cwd, taskPath) } });
|
|
376
|
-
} return taskDocumentToParallelAdvisorTask(cwd, readJsonRecord(taskPath)); }
|
|
377
|
-
function taskDocumentToParallelAdvisorTask(cwd, taskDocument) { const taskId = normalizeTaskDocumentId(taskDocument, 'TASK-UNKNOWN-0000'); const title = normalizeOptionalString(taskDocument.title) ?? taskId; const status = normalizeTaskStatus(taskDocument.status); const collectedFiles = collectParallelAdvisorTaskFiles(taskDocument); const allowedFiles = uniqueStrings(Array.from(collectedFiles).map((value) => normalizeParallelAdvisorPath(cwd, value)).filter((value) => Boolean(value))); const validators = uniqueStrings(parseYamlList(taskDocument.validators).map((entry) => entry.trim()).filter(Boolean)); const atomIds = uniqueStrings(allowedFiles.flatMap((entry) => findAtomIdsForPath(cwd, entry))); const claimRecord = taskDocument.claim && typeof taskDocument.claim === 'object' && !Array.isArray(taskDocument.claim) ? taskDocument.claim : null; const claimState = normalizeOptionalString(claimRecord?.state); const activeClaimActorId = claimState === 'active' ? normalizeOptionalString(claimRecord?.actorId) : null; const activeClaimIntent = claimState === 'active' ? (normalizeOptionalString(claimRecord?.intent) ?? 'write') : null; return { taskId, title, status, allowedFiles, validators, atomIds, activeClaimActorId, activeClaimIntent }; }
|
|
378
|
-
function collectParallelAdvisorTaskFiles(taskDocument) { const files = new Set(); const taskDirectionLock = taskDocument.taskDirectionLock; const claim = taskDocument.claim; const legacyImportAliases = taskDocument.legacyImportAliases; const targetWork = taskDocument.targetWork; collectTaskFileValues(taskDocument.scopePaths, files); collectTaskFileValues(taskDocument.deliverables, files); collectTaskFileValues(taskDocument.targetAllowedFiles, files); collectTaskFileValues(taskDocument.planningMirrorPaths, files); if (claim && typeof claim === 'object' && !Array.isArray(claim)) {
|
|
379
|
-
collectTaskFileValues(claim.files, files);
|
|
380
|
-
} if (taskDirectionLock && typeof taskDirectionLock === 'object' && !Array.isArray(taskDirectionLock)) {
|
|
381
|
-
collectTaskFileValues(taskDirectionLock.allowedFiles, files);
|
|
382
|
-
} if (legacyImportAliases && typeof legacyImportAliases === 'object' && !Array.isArray(legacyImportAliases)) {
|
|
383
|
-
collectTaskFileValues(legacyImportAliases.allowed_files, files);
|
|
384
|
-
} if (targetWork && typeof targetWork === 'object' && !Array.isArray(targetWork)) {
|
|
385
|
-
collectTaskFileValues(targetWork.allowedFiles, files);
|
|
386
|
-
} return files; }
|
|
387
|
-
function normalizeParallelAdvisorPath(cwd, value) { const trimmed = value.trim(); if (!trimmed)
|
|
388
|
-
return null; const normalized = trimmed.replace(/\\/g, '/'); if (/^[A-Za-z]:\//.test(normalized)) {
|
|
389
|
-
return relativePathFrom(cwd, normalized).replace(/\\/g, '/');
|
|
390
|
-
} return normalized.replace(/^\.\/+/, ''); }
|
|
391
|
-
function loadPathToAtomMappings(cwd) { const mapPath = path.join(cwd, 'atomic_workbench', 'atomization-coverage', 'path-to-atom-map.json'); const payload = readJsonRecord(mapPath); return (payload.mappings ?? []).flatMap((entry) => { const pathPattern = normalizeOptionalString(entry.path_pattern); const atomId = normalizeOptionalString(entry.atom_id); const capability = normalizeOptionalString(entry.capability) ?? ''; if (!pathPattern || !atomId)
|
|
392
|
-
return []; return [{ pathPattern, atomId, capability }]; }); }
|
|
393
|
-
function findAtomIdsForPath(cwd, relativePath) { const normalized = relativePath.replace(/\\/g, '/'); return loadPathToAtomMappings(cwd).filter((mapping) => globLikeMatch(normalized, mapping.pathPattern)).map((mapping) => mapping.atomId); }
|
|
394
|
-
function analyzeParallelPair(left, right) { const overlappingFiles = intersect(left.allowedFiles, right.allowedFiles); const overlappingAtomIds = intersect(left.atomIds, right.atomIds); const sharedValidators = intersect(left.validators, right.validators); const sharedGenerators = overlappingFiles.filter((entry) => /generator|build|manifest/i.test(entry)); const sharedProjections = overlappingFiles.filter((entry) => /projection|map|registry|index/i.test(entry)); const sharedArtifacts = overlappingFiles.filter((entry) => /artifact|report|jsonl/i.test(entry)); const activeLeaseConflicts = overlappingFiles.filter((entry) => /\.atm\/history\//i.test(entry)); const brokerAdmission = buildBrokerAdmissionExplanation({ overlappingFiles, overlappingAtomIds, sharedProjections }); let verdict = 'parallel-safe'; if (brokerAdmission.confirmedConflict) {
|
|
395
|
-
verdict = 'blocked-cid-conflict';
|
|
396
|
-
}
|
|
397
|
-
else if (activeLeaseConflicts.length > 0) {
|
|
398
|
-
verdict = 'blocked-active-lease';
|
|
399
|
-
}
|
|
400
|
-
else if (sharedGenerators.length > 0 || sharedArtifacts.length > 0 || hasUnexplainedSharedProjection(sharedProjections, brokerAdmission)) {
|
|
401
|
-
verdict = 'blocked-shared-surface';
|
|
402
|
-
}
|
|
403
|
-
else if (overlappingAtomIds.length > 0 || brokerAdmission.mutationIntentStatus === 'missing') {
|
|
404
|
-
verdict = 'insufficient-mutation-intent';
|
|
405
|
-
}
|
|
406
|
-
else if (overlappingFiles.length > 0) {
|
|
407
|
-
verdict = 'needs-physical-split';
|
|
408
|
-
}
|
|
409
|
-
else if (left.allowedFiles.length === 0 || right.allowedFiles.length === 0) {
|
|
410
|
-
verdict = 'insufficient-atom-map';
|
|
411
|
-
} return { verdict, overlappingFiles, overlappingAtomIds, sharedValidators, sharedGenerators, sharedProjections, sharedArtifacts, activeLeaseConflicts, brokerAdmission }; }
|
|
412
|
-
const buildBrokerAdmissionExplanation = delegatedBuildBrokerAdmissionExplanation;
|
|
413
|
-
const explainBrokerAdapterForPath = delegatedExplainBrokerAdapterForPath;
|
|
414
|
-
const hasUnexplainedSharedProjection = delegatedHasUnexplainedSharedProjection;
|
|
415
|
-
function buildParallelHotspotReport(tasks) { const fileCounts = new Map(); const atomCounts = new Map(); const validatorCounts = new Map(); for (let leftIndex = 0; leftIndex < tasks.length; leftIndex += 1) {
|
|
416
|
-
for (let rightIndex = leftIndex + 1; rightIndex < tasks.length; rightIndex += 1) {
|
|
417
|
-
const finding = analyzeParallelPair(tasks[leftIndex], tasks[rightIndex]);
|
|
418
|
-
for (const file of finding.overlappingFiles)
|
|
419
|
-
incrementMap(fileCounts, file);
|
|
420
|
-
for (const atomId of finding.overlappingAtomIds)
|
|
421
|
-
incrementMap(atomCounts, atomId);
|
|
422
|
-
for (const validator of finding.sharedValidators)
|
|
423
|
-
incrementMap(validatorCounts, validator);
|
|
424
|
-
}
|
|
425
|
-
} return { topOverlappingFiles: sortMapEntries(fileCounts), topOverlappingAtomIds: sortMapEntries(atomCounts), topSharedValidators: sortMapEntries(validatorCounts) }; }
|
|
426
|
-
function intersect(left, right) { const rightSet = new Set(right); return left.filter((value) => rightSet.has(value)); }
|
|
427
|
-
function incrementMap(target, key) { target.set(key, (target.get(key) ?? 0) + 1); }
|
|
428
|
-
function sortMapEntries(target) { return Array.from(target.entries()).sort((left, right) => right[1] - left[1] || left[0].localeCompare(right[0])).map(([value, count]) => ({ value, count })); }
|
|
429
|
-
function globLikeMatch(value, pattern) { const normalizedPattern = pattern.replace(/\\/g, '/'); const escaped = normalizedPattern.replace(/[.+^${}()|[\]\\]/g, '\\$&'); const regexSource = `^${escaped.replace(/\*\*/g, '::DOUBLE_STAR::').replace(/\*/g, '[^/]*').replace(/::DOUBLE_STAR::/g, '.*')}$`; return new RegExp(regexSource).test(value); }
|
|
430
|
-
async function runTasksMigrateLegacyLedger(argv) { const options = parseLegacyLedgerMigrationOptions(argv); assertLocalTaskLedgerEnabled(options.cwd, 'migrate-legacy-ledger'); const resolvedActor = resolveActorId(options.actorId ?? undefined, options.cwd); if (!resolvedActor) {
|
|
431
|
-
throw new CliError('ATM_ACTOR_ID_MISSING', 'tasks migrate-legacy-ledger requires --actor or ATM_ACTOR_ID (legacy alias: AGENT_IDENTITY).', { exitCode: 2 });
|
|
432
|
-
} const actorId = resolvedActor.actorId; const taskLedger = readTaskLedgerPolicy(options.cwd); const tasks = readLegacyLedgerTaskFiles(options.cwd); const migratedTasks = []; const skippedTasks = []; for (const task of tasks) {
|
|
433
|
-
if (!legacyTaskRequiresBaseline(options.cwd, task)) {
|
|
434
|
-
skippedTasks.push({ taskId: task.taskId, taskPath: task.relativePath, taskFormat: task.format, reason: 'already-has-transition-evidence-or-not-required' });
|
|
435
|
-
continue;
|
|
436
|
-
}
|
|
437
|
-
const migrationReason = normalizeStringValue(task.document.lastTransitionId ?? task.document.last_transition_id) ? 'missing-transition-event' : 'missing-transition-id';
|
|
438
|
-
const reportEntry = { taskId: task.taskId, taskPath: task.relativePath, taskFormat: task.format, status: task.status, reason: migrationReason, transitionPath: null };
|
|
439
|
-
if (options.apply) {
|
|
440
|
-
const transitionPath = writeLegacyBaselineTransition({ cwd: options.cwd, task, actorId, reason: options.reason });
|
|
441
|
-
migratedTasks.push({ ...reportEntry, transitionPath });
|
|
442
|
-
}
|
|
443
|
-
else {
|
|
444
|
-
migratedTasks.push(reportEntry);
|
|
445
|
-
}
|
|
446
|
-
} const report = { schemaId: 'atm.taskLegacyLedgerMigrationReport', specVersion: '0.1.0', generatedAt: new Date().toISOString(), mode: options.apply ? 'apply' : 'dry-run', taskRoot: taskLedger.taskRoot, eventRoot: taskLedger.eventRoot, inspectedTaskCount: tasks.length, migratableTaskCount: migratedTasks.length, migratedTaskCount: options.apply ? migratedTasks.length : 0, skippedTaskCount: skippedTasks.length, migratedTasks, skippedTasks }; return makeResult({ ok: true, command: 'tasks', cwd: options.cwd, messages: [message('info', 'ATM_TASKS_LEGACY_LEDGER_MIGRATION', options.apply ? `Backfilled baseline transition evidence for ${migratedTasks.length} legacy task(s).` : `Legacy ledger migration dry-run found ${migratedTasks.length} task(s) to backfill.`, { mode: report.mode, inspectedTaskCount: report.inspectedTaskCount, migratableTaskCount: report.migratableTaskCount, migratedTaskCount: report.migratedTaskCount })], evidence: { action: 'migrate-legacy-ledger', actorId, report } }); }
|
|
447
|
-
async function runTasksClaimLifecycle(action, argv) { return delegatedRunTasksClaimLifecycle(action, argv); }
|
|
448
|
-
export const evaluateFrameworkDeliveryWindow = delegatedEvaluateFrameworkDeliveryWindow;
|
|
449
|
-
export const evaluateTaskDeliverableGate = delegatedEvaluateTaskDeliverableGate;
|
|
450
|
-
export const taskDeliveryPrincipleText = delegatedTaskDeliveryPrincipleText;
|
|
451
|
-
export const loadHistoricalBatchCloseSlice = delegatedLoadHistoricalBatchCloseSlice;
|
|
452
|
-
export const extractTaskCloseDeclaredFiles = delegatedExtractTaskCloseDeclaredFiles;
|
|
453
|
-
function extractStringList(value) { return Array.isArray(value) ? value.map((entry) => typeof entry === 'string' ? entry.trim() : '').filter(Boolean) : []; }
|
|
454
|
-
export const extractTaskDeliverableFiles = delegatedExtractTaskDeliverableFiles;
|
|
455
|
-
function normalizeTaskScopePaths(cwd, values) { return sanitizeTaskDirectionAllowedFiles(values.map((entry) => { const normalized = normalizeRelativePath(entry); if (!normalized)
|
|
456
|
-
return ''; return path.isAbsolute(normalized) ? normalizeRelativePath(relativePathFrom(cwd, normalized)) : normalized; })); }
|
|
457
|
-
function listCommittedFilesSinceClaim(cwd, claim) { return delegatedListCommittedFilesSinceClaim(cwd, claim); }
|
|
458
|
-
function readGitScalar(cwd, args) { return delegatedReadGitScalar(cwd, args); }
|
|
459
|
-
function writeLockCleanupReport(input) { const directory = path.join(input.cwd, '.atm', 'history', 'reports', 'lock-cleanup'); mkdirSync(directory, { recursive: true }); const timestamp = new Date().toISOString(); const filePath = path.join(directory, `${timestamp.replace(/[:.]/g, '-')}-${input.taskId}.json`); writeFileSync(filePath, `${JSON.stringify({ schemaId: 'atm.lockCleanupReport.v1', generatedAt: timestamp, taskId: input.taskId, actorId: input.actorId, staleReasons: input.staleReasons, cleanupActions: input.cleanupActions, reason: input.reason }, null, 2)}\n`, 'utf8'); return relativePathFrom(input.cwd, filePath); }
|
|
460
|
-
function writeTaskDocument(taskPath, document) { mkdirSync(path.dirname(taskPath), { recursive: true }); writeFileSync(taskPath, `${JSON.stringify(document, null, 2)}\n`, 'utf8'); }
|
|
461
|
-
function syncScopeAmendmentState(input) { syncScopeAmendmentRuntimeLock(input); input.taskDocument.taskDirectionLock = { ...input.embeddedLockRecord, allowedFiles: [...input.mergedAllowed] }; const claim = input.taskDocument.claim; if (claim && typeof claim === 'object' && !Array.isArray(claim)) {
|
|
462
|
-
const claimRecord = claim;
|
|
463
|
-
claimRecord.files = [...input.mergedAllowed];
|
|
464
|
-
input.taskDocument.claim = claimRecord;
|
|
465
|
-
} syncScopeAmendmentScopePaths(input); }
|
|
466
|
-
/**
|
|
467
|
-
* ATM-GOV-0364 / ATM-BUG-2026-08-13-007. A task has two views of its own scope:
|
|
468
|
-
* the direction lock, which decides what may be edited, and the ledger's
|
|
469
|
-
* scopePaths, from which the governed delivery bundle is resolved. An amendment
|
|
470
|
-
* that reaches only the first authorises an edit that can never be delivered,
|
|
471
|
-
* and says nothing about it. Union, never replace: an amendment adds reach, it
|
|
472
|
-
* does not redefine what the card already declared.
|
|
473
|
-
*/
|
|
474
|
-
export function syncScopeAmendmentScopePaths(input) { const existing = Array.isArray(input.taskDocument.scopePaths) ? input.taskDocument.scopePaths.map((entry) => String(entry ?? '').replace(/\\/g, '/').trim()).filter((entry) => entry.length > 0) : []; const known = new Set(existing); const additions = input.mergedAllowed.map((entry) => String(entry ?? '').replace(/\\/g, '/').trim()).filter((entry) => entry.length > 0 && !known.has(entry)); if (additions.length === 0)
|
|
475
|
-
return; input.taskDocument.scopePaths = [...existing, ...additions]; }
|
|
476
|
-
function syncScopeAmendmentRuntimeLock(input) { input.outerLock.taskDirectionLock = { ...input.embeddedLockRecord, allowedFiles: [...input.mergedAllowed] }; input.outerLock.files = [...input.mergedAllowed]; }
|
|
477
|
-
function persistScopeAmendmentTransition(input) { const createdAt = new Date().toISOString(); const transitionSeedDocument = { ...input.taskDocument, lastTransitionId: 'pending-scope-amendment', lastTransitionAt: createdAt }; const transitionId = createTaskTransitionId({ createdAt, taskId: input.taskId, action: 'scope-amendment', taskDocument: transitionSeedDocument }); input.taskDocument.lastTransitionId = transitionId; input.taskDocument.lastTransitionAt = createdAt; input.taskDocument.ledgerContractVersion = 'task-ledger/v1'; appendTaskTransitionEvent({ cwd: input.cwd, taskId: input.taskId, action: 'scope-amendment', actorId: input.actorId, fromStatus: String(input.taskDocument.status ?? 'running'), toStatus: String(input.taskDocument.status ?? 'running'), taskPath: input.taskPath, taskDocument: input.taskDocument, command: input.command, createdAt, transitionId, amendmentMetadata: input.amendmentMetadata }); writeTaskDocument(input.taskPath, input.taskDocument); }
|
|
478
|
-
function readLegacyLedgerTaskFiles(cwd) { const root = path.resolve(cwd); const taskLedger = readTaskLedgerPolicy(root); const jsonTasks = listTaskFiles(path.join(root, taskLedger.taskRoot), (filePath) => filePath.endsWith('.json')).map((absolutePath) => { const document = readJsonRecord(absolutePath); const taskId = normalizeTaskDocumentId(document, path.basename(absolutePath, '.json')); return { absolutePath, relativePath: relativePathFrom(root, absolutePath), taskId, status: normalizeTaskStatus(document.status), format: 'json', document }; }); const markdownTasks = listTaskFiles(root, (filePath) => filePath.endsWith('.task.md')).map((absolutePath) => { const rawText = readFileSync(absolutePath, 'utf8'); const document = parseTaskMarkdownFrontmatter(rawText); const taskId = normalizeTaskDocumentId(document, path.basename(absolutePath).replace(/\.task\.md$/, '')); return { absolutePath, relativePath: relativePathFrom(root, absolutePath), taskId, status: normalizeTaskStatus(document.status), format: 'markdown', document, rawText }; }); return [...jsonTasks, ...markdownTasks].sort((left, right) => left.relativePath.localeCompare(right.relativePath)); }
|
|
479
|
-
function writeLegacyBaselineTransition(input) { const createdAt = new Date().toISOString(); const updatedDocument = { ...input.task.document, ledgerContractVersion: 'task-ledger/v1', ledgerBaselineKind: 'legacy-transition-backfill', ledgerBaselineByActor: input.actorId, ledgerBaselineReason: input.reason, ledgerBaselineSourceSha256: sha256(input.task.rawText ?? `${JSON.stringify(input.task.document, null, 2)}\n`) }; const transitionId = createTaskTransitionId({ createdAt, taskId: input.task.taskId, action: 'migrate-legacy-ledger', taskDocument: updatedDocument }); updatedDocument.lastTransitionId = transitionId; updatedDocument.lastTransitionAt = createdAt; updatedDocument.ledgerBaselineAt = createdAt; if (input.task.format === 'json') {
|
|
480
|
-
updatedDocument.legacyLedgerBaseline = { schemaId: 'atm.legacyTaskLedgerBaseline.v1', migratedAt: createdAt, migratedByActor: input.actorId, previousStatus: input.task.status || null, reason: input.reason, sourceTaskSha256: updatedDocument.ledgerBaselineSourceSha256, transitionId };
|
|
481
|
-
} const transition = appendTaskTransitionEvent({ cwd: input.cwd, taskId: input.task.taskId, action: 'migrate-legacy-ledger', actorId: input.actorId, fromStatus: input.task.status || null, toStatus: input.task.status || null, taskPath: input.task.absolutePath, taskDocument: updatedDocument, command: 'node atm.mjs tasks migrate-legacy-ledger', createdAt, transitionId }); if (input.task.format === 'json') {
|
|
482
|
-
writeTaskDocument(input.task.absolutePath, updatedDocument);
|
|
483
|
-
}
|
|
484
|
-
else {
|
|
485
|
-
writeTaskMarkdownFrontmatter(input.task.absolutePath, input.task.rawText ?? '', updatedDocument);
|
|
486
|
-
} return transition.eventPath; }
|
|
487
|
-
function listTaskFiles(directoryPath, predicate) { if (!existsSync(directoryPath))
|
|
488
|
-
return []; const stats = safeTaskFileStat(directoryPath); if (!stats)
|
|
489
|
-
return []; if (stats.isFile())
|
|
490
|
-
return predicate(directoryPath) ? [directoryPath] : []; const output = []; for (const entry of safeTaskFileReadDir(directoryPath)) {
|
|
491
|
-
const absolutePath = path.join(directoryPath, entry.name);
|
|
492
|
-
if (entry.isDirectory() && shouldSkipTaskFileDiscoveryDirectory(absolutePath))
|
|
493
|
-
continue;
|
|
494
|
-
if (entry.isDirectory()) {
|
|
495
|
-
output.push(...listTaskFiles(absolutePath, predicate));
|
|
496
|
-
}
|
|
497
|
-
else if (entry.isFile() && predicate(absolutePath)) {
|
|
498
|
-
output.push(absolutePath);
|
|
499
|
-
}
|
|
500
|
-
} return output; }
|
|
501
|
-
function shouldSkipTaskFileDiscoveryDirectory(directoryPath) { const normalized = directoryPath.replace(/\\/g, '/'); const segments = normalized.split('/').filter(Boolean); const basename = segments[segments.length - 1] ?? ''; const ignoredSegmentNames = new Set(['.git', 'node_modules', 'dist', 'build', 'release', '.atm-temp', 'scratch', 'tmp', 'temp', 'library', 'coverage', '.next', '.turbo']); if (ignoredSegmentNames.has(basename))
|
|
502
|
-
return true; return segments.some((segment, index) => segment === 'local' && (segments[index + 1] === 'tmp' || segments[index + 1] === 'temp')); }
|
|
503
|
-
function parseTaskMarkdownFrontmatter(text) { const match = text.match(/^---\r?\n([\s\S]*?)\r?\n---/); if (!match)
|
|
504
|
-
return {}; const result = {}; for (const rawLine of match[1].split(/\r?\n/)) {
|
|
505
|
-
const separatorIndex = rawLine.indexOf(':');
|
|
506
|
-
if (separatorIndex === -1)
|
|
507
|
-
continue;
|
|
508
|
-
const key = rawLine.slice(0, separatorIndex).trim();
|
|
509
|
-
const value = rawLine.slice(separatorIndex + 1).trim().replace(/^"(.*)"$/, '$1');
|
|
510
|
-
if (key)
|
|
511
|
-
result[key] = value;
|
|
512
|
-
} return result; }
|
|
513
|
-
function writeTaskMarkdownFrontmatter(filePath, text, document) { const upsertKeys = ['lastTransitionId', 'lastTransitionAt', 'ledgerContractVersion', 'ledgerBaselineKind', 'ledgerBaselineByActor', 'ledgerBaselineAt', 'ledgerBaselineReason', 'ledgerBaselineSourceSha256']; const match = text.match(/^---\r?\n([\s\S]*?)\r?\n---(\r?\n)?/); const frontmatterLines = match ? match[1].split(/\r?\n/) : []; const body = match ? text.slice(match[0].length) : text; const seenKeys = new Set(); const rewritten = frontmatterLines.map((line) => { const separatorIndex = line.indexOf(':'); if (separatorIndex === -1)
|
|
514
|
-
return line; const key = line.slice(0, separatorIndex).trim(); if (!upsertKeys.includes(key))
|
|
515
|
-
return line; seenKeys.add(key); return `${key}: ${formatFrontmatterValue(document[key])}`; }); for (const key of upsertKeys) {
|
|
516
|
-
if (!seenKeys.has(key) && document[key] !== undefined && isFrontmatterScalar(document[key])) {
|
|
517
|
-
rewritten.push(`${key}: ${formatFrontmatterValue(document[key])}`);
|
|
518
|
-
}
|
|
519
|
-
} writeFileSync(filePath, `---\n${rewritten.join('\n')}\n---\n${body}`, 'utf8'); }
|
|
520
|
-
function isFrontmatterScalar(value) { return delegatedIsFrontmatterScalar(value); }
|
|
521
|
-
function formatFrontmatterValue(value) { if (typeof value === 'string')
|
|
522
|
-
return value.replace(/\r?\n/g, ' ').trim(); if (typeof value === 'number' || typeof value === 'boolean')
|
|
523
|
-
return String(value); return ''; }
|
|
524
|
-
function normalizeTaskDocumentId(document, fallback) { return delegatedNormalizeTaskDocumentId(document, fallback); }
|
|
525
|
-
function normalizeTaskStatus(value) { return String(value ?? '').trim().toLowerCase().replace(/-/g, '_'); }
|
|
526
|
-
function normalizeStringValue(value) { return delegatedNormalizeStringValue(value); }
|
|
527
|
-
function sha256(value) { return delegatedSha256(value); }
|
|
528
|
-
export function assertLocalTaskLedgerEnabled(cwd, action) { return delegatedAssertLocalTaskLedgerEnabled(cwd, action); }
|
|
529
|
-
export function buildTaskTransitionCommand(input) { return delegatedBuildTaskTransitionCommand(input); }
|
|
530
|
-
function buildScopeAmendmentCommand(input) { return delegatedBuildScopeAmendmentCommand(input); }
|
|
531
|
-
function quoteCommandValue(value) { return /^[A-Za-z0-9._:/\\-]+$/.test(value) ? value : `"${value.replace(/\\/g, '\\\\').replace(/"/g, '\\"')}"`; }
|
|
532
|
-
export const writeTaskDocumentWithTransition = delegatedWriteTaskDocumentWithTransition;
|
|
533
|
-
export const stageTaskCloseArtifacts = delegatedStageTaskCloseArtifacts;
|
|
534
|
-
export const existingTaskCloseArtifacts = delegatedExistingTaskCloseArtifacts;
|
|
535
|
-
export function createClosureTransitionMetadata(closurePacketPath, closurePacket, batchId = null, sessionId = null) { return delegatedCreateClosureTransitionMetadata(closurePacketPath, closurePacket, batchId, sessionId); }
|
|
536
|
-
function normalizeWorkItemStatus(value) { return delegatedNormalizeWorkItemStatus(value); }
|
|
537
|
-
export function inspectTaskVerifyStatus(value) { return delegatedInspectTaskVerifyStatus(value); }
|
|
538
|
-
export function inspectTaskSourceTrace(document, statusInspection) { const source = document.source; const planPath = source && typeof source.planPath === 'string' ? source.planPath.trim() : ''; const sectionTitle = source && typeof source.sectionTitle === 'string' ? source.sectionTitle.trim() : ''; const hash = source && typeof source.hash === 'string' ? source.hash.trim() : ''; if (planPath && sectionTitle && hash) {
|
|
539
|
-
return null;
|
|
540
|
-
} const legacyHistoricalTask = isLegacyHistoricalTaskDocument(document, statusInspection); if (legacyHistoricalTask && planPath && sectionTitle) {
|
|
541
|
-
return { level: 'warning', code: 'ATM_TASKS_VERIFY_LEGACY_SOURCE_TRACE', text: 'declared a legacy source trace without hash metadata; ATM will keep it as historical reference only.' };
|
|
542
|
-
} return { level: 'error', code: 'ATM_TASKS_VERIFY_BAD_SOURCE_TRACE', text: 'declared a malformed source trace (planPath, sectionTitle, and hash are required).' }; }
|
|
543
|
-
function isLegacyHistoricalTaskDocument(document, statusInspection) { if (statusInspection.warningCode === 'ATM_TASKS_VERIFY_LEGACY_STATUS_ALIAS') {
|
|
544
|
-
return true;
|
|
545
|
-
} const importedAt = normalizeStringValue(document.importedAt ?? document.imported_at); const evidencePath = normalizeStringValue(document.evidencePath ?? document.evidence_path); const lastTransitionId = normalizeStringValue(document.lastTransitionId ?? document.last_transition_id); return !importedAt && Boolean(evidencePath) && !lastTransitionId; }
|
|
546
|
-
export function classifyResetOpenImportForOptions(options) { try {
|
|
547
|
-
const planAbsolute = resolvePlanAbsoluteFromStored(options.cwd, options.from);
|
|
548
|
-
let planningStatus = null;
|
|
549
|
-
if (existsSync(planAbsolute) && statSync(planAbsolute).isFile()) {
|
|
550
|
-
const planText = readFileSync(planAbsolute, 'utf8');
|
|
551
|
-
const match = planText.match(/^status\s*:\s*([A-Za-z0-9_\-]+)/m);
|
|
552
|
-
if (match)
|
|
553
|
-
planningStatus = match[1].trim();
|
|
554
|
-
}
|
|
555
|
-
const taskId = options.from.match(/TASK-[A-Z]+-\d+/i)?.[0] ?? null;
|
|
556
|
-
let runtimeLedgerStatus = null;
|
|
557
|
-
let runtimeActiveClaimActorId = null;
|
|
558
|
-
if (taskId) {
|
|
559
|
-
const ledgerPath = path.join(options.cwd, '.atm', 'history', 'tasks', `${taskId}.json`);
|
|
560
|
-
if (existsSync(ledgerPath)) {
|
|
561
|
-
try {
|
|
562
|
-
const raw = JSON.parse(readFileSync(ledgerPath, 'utf8'));
|
|
563
|
-
if (raw && typeof raw === 'object') {
|
|
564
|
-
const record = raw;
|
|
565
|
-
if (typeof record.status === 'string')
|
|
566
|
-
runtimeLedgerStatus = record.status;
|
|
567
|
-
const claim = record.claim;
|
|
568
|
-
if (claim && typeof claim === 'object' && !Array.isArray(claim)) {
|
|
569
|
-
const actor = claim.actorId;
|
|
570
|
-
const claimState = claim.state;
|
|
571
|
-
if (typeof actor === 'string' && actor.trim().length > 0 && claimState !== 'released') {
|
|
572
|
-
runtimeActiveClaimActorId = actor;
|
|
573
|
-
}
|
|
574
|
-
}
|
|
575
|
-
}
|
|
576
|
-
}
|
|
577
|
-
catch {
|
|
578
|
-
return { state: 'drift-with-active-claim', resetOpenEmergencyRequired: true, reason: 'Runtime ledger JSON is unreadable; emergency lease required to override safely.' };
|
|
579
|
-
}
|
|
580
|
-
}
|
|
581
|
-
}
|
|
582
|
-
return classifyResetOpenImport({ planningStatus, runtimeLedgerStatus, runtimeActiveClaimActorId });
|
|
583
|
-
}
|
|
584
|
-
catch {
|
|
585
|
-
return { state: 'drift-with-active-claim', resetOpenEmergencyRequired: true, reason: 'Reset-open classification peek failed; falling back to emergency-gated behavior.' };
|
|
586
|
-
} }
|
|
587
|
-
export function parseImportOptions(argv) { const options = { cwd: process.cwd(), from: '', dryRun: false, write: false, force: false, forceOverwriteClaims: false, resetOpen: false, reopen: false, reconcileMirror: false, strictPaths: false, emergencyApproval: null, allowStaleRunner: parseAllowStaleRunnerFlag(argv), waivePlanningRoot: false, reason: null }; for (let index = 0; index < argv.length; index += 1) {
|
|
588
|
-
const arg = argv[index];
|
|
589
|
-
if (arg === '--cwd') {
|
|
590
|
-
options.cwd = requireValue(argv, index, '--cwd');
|
|
591
|
-
index += 1;
|
|
592
|
-
continue;
|
|
593
|
-
}
|
|
594
|
-
if (arg === '--from') {
|
|
595
|
-
options.from = requireValue(argv, index, '--from');
|
|
596
|
-
index += 1;
|
|
597
|
-
continue;
|
|
598
|
-
}
|
|
599
|
-
if (arg === '--dry-run') {
|
|
600
|
-
options.dryRun = true;
|
|
601
|
-
continue;
|
|
602
|
-
}
|
|
603
|
-
if (arg === '--write') {
|
|
604
|
-
options.write = true;
|
|
605
|
-
continue;
|
|
606
|
-
}
|
|
607
|
-
if (arg === '--force') {
|
|
608
|
-
options.force = true;
|
|
609
|
-
continue;
|
|
610
|
-
}
|
|
611
|
-
if (arg === '--force-overwrite-claims') {
|
|
612
|
-
options.forceOverwriteClaims = true;
|
|
613
|
-
continue;
|
|
614
|
-
}
|
|
615
|
-
if (arg === '--reset-open') {
|
|
616
|
-
options.resetOpen = true;
|
|
617
|
-
continue;
|
|
618
|
-
}
|
|
619
|
-
if (arg === '--reopen') {
|
|
620
|
-
options.reopen = true;
|
|
621
|
-
continue;
|
|
622
|
-
}
|
|
623
|
-
if (arg === '--reconcile-mirror') {
|
|
624
|
-
options.reconcileMirror = true;
|
|
625
|
-
continue;
|
|
626
|
-
}
|
|
627
|
-
if (arg === '--strict-paths') {
|
|
628
|
-
options.strictPaths = true;
|
|
629
|
-
continue;
|
|
630
|
-
}
|
|
631
|
-
if (arg === '--waive-planning-root') {
|
|
632
|
-
options.waivePlanningRoot = true;
|
|
633
|
-
continue;
|
|
634
|
-
}
|
|
635
|
-
if (arg === '--reason') {
|
|
636
|
-
options.reason = requireValue(argv, index, '--reason');
|
|
637
|
-
index += 1;
|
|
638
|
-
continue;
|
|
639
|
-
}
|
|
640
|
-
if (arg === '--emergency-approval') {
|
|
641
|
-
options.emergencyApproval = requireValue(argv, index, '--emergency-approval');
|
|
642
|
-
index += 1;
|
|
643
|
-
continue;
|
|
644
|
-
}
|
|
645
|
-
if (arg === '--json' || arg === '--pretty' || arg === '--allow-stale-runner') {
|
|
646
|
-
continue;
|
|
647
|
-
}
|
|
648
|
-
throw new CliError('ATM_CLI_USAGE', `tasks import does not support option ${arg}`, { exitCode: 2 });
|
|
649
|
-
} if (options.waivePlanningRoot && !options.reason?.trim()) {
|
|
650
|
-
throw new CliError('ATM_CLI_USAGE', 'tasks import --waive-planning-root requires --reason "<why target-only .atm/task-plans import is allowed>".', { exitCode: 2 });
|
|
651
|
-
} return { ...options, cwd: path.resolve(options.cwd) }; }
|
|
652
|
-
export function parseVerifyOptions(argv) { const options = { cwd: process.cwd() }; for (let index = 0; index < argv.length; index += 1) {
|
|
653
|
-
const arg = argv[index];
|
|
654
|
-
if (arg === '--cwd') {
|
|
655
|
-
options.cwd = requireValue(argv, index, '--cwd');
|
|
656
|
-
index += 1;
|
|
657
|
-
continue;
|
|
658
|
-
}
|
|
659
|
-
if (arg === '--json' || arg === '--pretty')
|
|
660
|
-
continue;
|
|
661
|
-
throw new CliError('ATM_CLI_USAGE', `tasks verify does not support option ${arg}`, { exitCode: 2 });
|
|
662
|
-
} return { ...options, cwd: path.resolve(options.cwd) }; }
|
|
663
|
-
function requireValue(argv, index, flag) { const value = argv[index + 1]; if (!value || value.startsWith('--')) {
|
|
664
|
-
throw new CliError('ATM_CLI_USAGE', `tasks requires a value for ${flag}`, { exitCode: 2 });
|
|
665
|
-
} return value; }
|
|
666
|
-
export function parsePlanMarkdown(input) { const { planText, planRelativePath, importedAt } = input; const lines = planText.split(/\r?\n/); const tasks = []; const diagnostics = []; const seenIds = new Set(); const tableMetadata = parseTaskTableMetadata(lines); const singleCard = parseSingleCard({ planText, planRelativePath, importedAt }); if (singleCard) {
|
|
667
|
-
if (seenIds.has(singleCard.workItemId)) {
|
|
668
|
-
diagnostics.push({ level: 'error', code: 'ATM_TASKS_DUPLICATE_ID', text: `Duplicate task id ${singleCard.workItemId} in plan.`, workItemId: singleCard.workItemId });
|
|
669
|
-
}
|
|
670
|
-
else {
|
|
671
|
-
tasks.push(singleCard);
|
|
672
|
-
seenIds.add(singleCard.workItemId);
|
|
673
|
-
}
|
|
674
|
-
return { tasks, diagnostics };
|
|
675
|
-
} const sections = splitPlanIntoTaskSections(lines); for (const section of sections) {
|
|
676
|
-
const record = parseTaskSection({ section, planRelativePath, importedAt, tableMetadata: tableMetadata.get(section.workItemId) ?? null });
|
|
677
|
-
if (!record)
|
|
678
|
-
continue;
|
|
679
|
-
if (seenIds.has(record.task.workItemId)) {
|
|
680
|
-
diagnostics.push({ level: 'error', code: 'ATM_TASKS_DUPLICATE_ID', text: `Duplicate task id ${record.task.workItemId} at line ${section.headingLine}.`, workItemId: record.task.workItemId, sourceLine: section.headingLine });
|
|
681
|
-
continue;
|
|
682
|
-
}
|
|
683
|
-
seenIds.add(record.task.workItemId);
|
|
684
|
-
tasks.push(record.task);
|
|
685
|
-
diagnostics.push(...record.diagnostics);
|
|
686
|
-
} for (const record of parseChineseLabeledTaskBlocks({ lines, planRelativePath, importedAt })) {
|
|
687
|
-
if (seenIds.has(record.workItemId))
|
|
688
|
-
continue;
|
|
689
|
-
seenIds.add(record.workItemId);
|
|
690
|
-
tasks.push(record);
|
|
691
|
-
} for (const [workItemId, metadata] of tableMetadata.entries()) {
|
|
692
|
-
if (seenIds.has(workItemId))
|
|
693
|
-
continue;
|
|
694
|
-
seenIds.add(workItemId);
|
|
695
|
-
tasks.push(createTaskFromTableMetadata({ metadata, planRelativePath, importedAt }));
|
|
696
|
-
} return { tasks, diagnostics }; }
|
|
697
|
-
function parseChineseLabeledTaskBlocks(input) { const records = []; for (let index = 0; index < input.lines.length; index += 1) {
|
|
698
|
-
const idMatch = /^\s*(?:[-*]\s*)?(?:任務\s*ID|任務ID|任務|Task\s*ID)\s*[::]\s*(`?[^`\s]+`?)/i.exec(input.lines[index]);
|
|
699
|
-
if (!idMatch)
|
|
700
|
-
continue;
|
|
701
|
-
const taskIdMatch = taskIdAnywherePattern.exec(idMatch[1]);
|
|
702
|
-
if (!taskIdMatch)
|
|
703
|
-
continue;
|
|
704
|
-
const workItemId = normalizeTaskId(taskIdMatch[0]);
|
|
705
|
-
const bodyLines = [];
|
|
706
|
-
let cursor = index + 1;
|
|
707
|
-
while (cursor < input.lines.length) {
|
|
708
|
-
const line = input.lines[cursor];
|
|
709
|
-
if (/^\s*(?:[-*]\s*)?(?:任務\s*ID|任務ID|Task\s*ID)\s*[::]/i.test(line))
|
|
710
|
-
break;
|
|
711
|
-
if (/^#{1,3}\s+/.test(line) && taskIdAnywherePattern.test(line))
|
|
712
|
-
break;
|
|
713
|
-
bodyLines.push(line);
|
|
714
|
-
cursor += 1;
|
|
715
|
-
}
|
|
716
|
-
const title = collectChineseLabeledValue(bodyLines, ['標題', '名稱', 'title']) ?? workItemId;
|
|
717
|
-
const milestone = collectChineseLabeledValue(bodyLines, ['里程碑', '階段', 'milestone']) ?? null;
|
|
718
|
-
const status = coerceStatus(collectChineseLabeledValue(bodyLines, ['狀態', 'status', 'state']) ?? 'open');
|
|
719
|
-
const dependencies = parseDependencyList(collectChineseLabeledValue(bodyLines, ['依賴', '相依', '前置', 'depends on']) ?? '', workItemId);
|
|
720
|
-
const acceptance = collectChineseLabeledList(bodyLines, ['驗收', '驗收條件', 'acceptance']);
|
|
721
|
-
const deliverables = collectChineseLabeledList(bodyLines, ['交付物', '產物', '輸出', 'deliverables']);
|
|
722
|
-
const notes = collectChineseLabeledValue(bodyLines, ['備註', '說明', 'notes']);
|
|
723
|
-
records.push({ schemaVersion: 'atm.workItem.v0.2', workItemId, title, status, milestone, dependencies, acceptance, deliverables, tags: [], notes, source: { planPath: input.planRelativePath, sectionTitle: title, headingLine: index + 1, hash: hashSection(`${workItemId}\n${bodyLines.join('\n')}`) }, importedAt: input.importedAt });
|
|
724
|
-
index = cursor - 1;
|
|
725
|
-
} return records; }
|
|
726
|
-
function collectChineseLabeledValue(lines, labels) { const labelPattern = labels.map(escapeRegExp).join('|'); const regex = new RegExp(`^\\s*(?:[-*]\\s*)?(?:${labelPattern})\\s*[::]\\s*(.+?)\\s*$`, 'i'); for (const line of lines) {
|
|
727
|
-
const match = regex.exec(line);
|
|
728
|
-
if (match?.[1]?.trim())
|
|
729
|
-
return match[1].trim();
|
|
730
|
-
} return null; }
|
|
731
|
-
function collectChineseLabeledList(lines, labels) { const first = collectChineseLabeledValue(lines, labels); if (!first)
|
|
732
|
-
return []; return first.split(/[、,,;]/).map((entry) => entry.trim()).filter(Boolean); }
|
|
733
|
-
export function detectPlanHeadings(planText) { return planText.split(/\r?\n/).flatMap((line, index) => { const match = /^#{1,6}\s+(.+?)\s*$/.exec(line); return match ? [{ line: index + 1, text: match[1] }] : []; }); }
|
|
734
|
-
function parseTaskTableMetadata(lines) { const entries = new Map(); for (let index = 0; index < lines.length - 1; index += 1) {
|
|
735
|
-
const headerLine = lines[index].trim();
|
|
736
|
-
const separatorLine = lines[index + 1].trim();
|
|
737
|
-
if (!isMarkdownTableRow(headerLine) || !isMarkdownTableSeparator(separatorLine)) {
|
|
738
|
-
continue;
|
|
739
|
-
}
|
|
740
|
-
const headerCells = parseMarkdownTableCells(headerLine).map((cell) => normalizeTableHeader(cell));
|
|
741
|
-
const taskIdIndex = findTableColumnIndex(headerCells, ['task id', 'task', 'work item id', 'workitemid', 'id', '任務', '任務id', '任務 id']);
|
|
742
|
-
if (taskIdIndex < 0) {
|
|
743
|
-
continue;
|
|
744
|
-
}
|
|
745
|
-
const titleIndex = findTableColumnIndex(headerCells, ['title', 'name', '標題', '名稱']);
|
|
746
|
-
const milestoneIndex = findTableColumnIndex(headerCells, ['milestone', 'phase', '里程碑', '階段']);
|
|
747
|
-
const statusIndex = findTableColumnIndex(headerCells, ['status', 'state', '狀態']);
|
|
748
|
-
const dependenciesIndex = findTableColumnIndex(headerCells, ['blocked by', 'depends on', 'dependencies', '依賴', '相依', '前置']);
|
|
749
|
-
const deliverablesIndex = findTableColumnIndex(headerCells, ['deliverables', 'outputs', 'outcomes', '交付物', '產物', '輸出']);
|
|
750
|
-
let rowIndex = index + 2;
|
|
751
|
-
while (rowIndex < lines.length) {
|
|
752
|
-
const rawLine = lines[rowIndex];
|
|
753
|
-
const trimmed = rawLine.trim();
|
|
754
|
-
if (!isMarkdownTableRow(trimmed) || isMarkdownTableSeparator(trimmed)) {
|
|
755
|
-
break;
|
|
756
|
-
}
|
|
757
|
-
const cells = parseMarkdownTableCells(trimmed);
|
|
758
|
-
const idCell = cellAt(cells, taskIdIndex);
|
|
759
|
-
const idMatch = taskIdPattern.exec(idCell);
|
|
760
|
-
if (idMatch) {
|
|
761
|
-
const workItemId = normalizeTaskId(idMatch[0]);
|
|
762
|
-
const deliverableCell = cellAt(cells, deliverablesIndex);
|
|
763
|
-
entries.set(workItemId, { workItemId, title: cellAt(cells, titleIndex) || workItemId, milestone: cellAt(cells, milestoneIndex) || null, status: coerceStatus(cellAt(cells, statusIndex) || 'planned'), dependencies: parseDependencyList(cellAt(cells, dependenciesIndex), workItemId), deliverables: deliverableCell ? [deliverableCell] : [], headingLine: rowIndex + 1, rowText: rawLine });
|
|
764
|
-
}
|
|
765
|
-
rowIndex += 1;
|
|
766
|
-
}
|
|
767
|
-
index = rowIndex - 1;
|
|
768
|
-
} return entries; }
|
|
769
|
-
function splitPlanIntoTaskSections(lines) { const sections = []; let current = null; for (let index = 0; index < lines.length; index += 1) {
|
|
770
|
-
const line = lines[index];
|
|
771
|
-
const headingMatch = /^#{1,3}\s+(.+?)\s*$/.exec(line);
|
|
772
|
-
if (headingMatch) {
|
|
773
|
-
const candidate = headingMatch[1];
|
|
774
|
-
const idMatch = taskIdPattern.exec(candidate);
|
|
775
|
-
if (idMatch) {
|
|
776
|
-
if (current)
|
|
777
|
-
sections.push(current);
|
|
778
|
-
const workItemId = normalizeTaskId(idMatch[0]);
|
|
779
|
-
current = { headingLine: index + 1, title: candidate.replace(taskIdPattern, '').replace(/^[\s::.\-—–]+/u, '').trim() || workItemId, workItemId, bodyLines: [] };
|
|
780
|
-
continue;
|
|
781
|
-
}
|
|
782
|
-
}
|
|
783
|
-
if (current) {
|
|
784
|
-
current.bodyLines.push(line);
|
|
785
|
-
}
|
|
786
|
-
} if (current)
|
|
787
|
-
sections.push(current); return sections; }
|
|
788
|
-
function parseSingleCard(input) { const frontMatter = extractFrontMatter(input.planText); if (!frontMatter || typeof frontMatter.data.task_id !== 'string')
|
|
789
|
-
return null; const workItemId = normalizeTaskId(frontMatter.data.task_id); const title = normalizeOptionalString(frontMatter.data.title) ?? workItemId; const status = coerceStatus(typeof frontMatter.data.status === 'string' ? frontMatter.data.status : 'planned'); const milestone = normalizeOptionalString(frontMatter.data.milestone); const dependencies = parseYamlList(frontMatter.data.depends_on ?? frontMatter.data.blocked_by ?? frontMatter.data.dependencies); const tags = parseYamlList(frontMatter.data.tags); const scopePaths = parseYamlList(frontMatter.data.scopePaths ?? frontMatter.data.scope_paths ?? frontMatter.data.allowed_files ?? frontMatter.data.allowedFiles ?? frontMatter.data.scope); const validators = parseYamlList(frontMatter.data.validators); const testPlan = normalizeTaskTestPlan(frontMatter.data.testPlan ?? frontMatter.data.test_plan); const planningMirrorPaths = parseYamlList(frontMatter.data.planningMirrorPaths ?? frontMatter.data.planning_mirror_paths); const planningReadOnlyPaths = parseYamlList(frontMatter.data.planningReadOnlyPaths ?? frontMatter.data.planning_read_only_paths); const planningArtifacts = parseYamlList(frontMatter.data.planningArtifacts ?? frontMatter.data.planning_artifacts); const outOfScope = parseYamlList(frontMatter.data.outOfScope ?? frontMatter.data.out_of_scope ?? frontMatter.data.forbidden_files); const nonGoals = parseYamlList(frontMatter.data.nonGoals ?? frontMatter.data.non_goals); const rawAtomizationImpact = frontMatter.data.atomizationImpact ?? frontMatter.data.atomization_impact; const atomizationImpactFrontMatter = rawAtomizationImpact && typeof rawAtomizationImpact === 'object' && !Array.isArray(rawAtomizationImpact) ? rawAtomizationImpact : {}; const mapUpdates = parseYamlList(frontMatter.data.mapUpdates ?? frontMatter.data.map_updates ?? atomizationImpactFrontMatter.mapUpdates ?? atomizationImpactFrontMatter.map_updates); const proposalAdmission = parseTaskProposalAdmission(frontMatter.data.proposalAdmission ?? frontMatter.data.brokerProposalAdmission); const body = input.planText.slice(frontMatter.endIndex); const sections = sliceBodyByHeadings(body); const acceptance = collectBulletList(sections, acceptanceHeaders); const frontMatterScopePaths = parseYamlList(frontMatter.data.scopePaths ?? frontMatter.data.scope_paths ?? frontMatter.data.allowed_files ?? frontMatter.data.allowedFiles ?? frontMatter.data.scope); const frontMatterDeliverables = parseYamlList(frontMatter.data.deliverables); const bodyDeliverables = collectBulletList(sections, deliverablesHeaders); let deliverables; const cardImportDiagnostics = []; if (frontMatterDeliverables.length > 0 && bodyDeliverables.length > 0) {
|
|
790
|
-
deliverables = uniqueStrings(frontMatterDeliverables.map(normalizeYamlScalar));
|
|
791
|
-
cardImportDiagnostics.push({ code: 'IMPORT_BODY_SECTION_IGNORED', severity: 'warning', message: 'Front-matter `deliverables` key is present; body section deliverables were ignored in favour of front-matter values.', field: 'deliverables' });
|
|
792
|
-
}
|
|
793
|
-
else if (frontMatterDeliverables.length > 0) {
|
|
794
|
-
deliverables = uniqueStrings(frontMatterDeliverables.map(normalizeYamlScalar));
|
|
795
|
-
}
|
|
796
|
-
else {
|
|
797
|
-
deliverables = uniqueStrings(bodyDeliverables.map(normalizeYamlScalar));
|
|
798
|
-
} const inferredLegacyDeliverables = deliverables.length === 0 ? inferLegacyDeliverablesFromScope(frontMatterScopePaths.map(normalizeYamlScalar)) : []; if (deliverables.length === 0 && inferredLegacyDeliverables.length > 0) {
|
|
799
|
-
deliverables = inferredLegacyDeliverables;
|
|
800
|
-
cardImportDiagnostics.push({ code: 'ATM_TASK_IMPORT_LEGACY_SCOPE_DELIVERABLES_INFERRED', severity: 'warning', message: 'No explicit deliverables were declared; ATM inferred deliverables from legacy scopePaths/allowed_files because every entry was file-shaped.', field: 'deliverables' });
|
|
801
|
-
} const notes = collectText(sections, notesHeaders) ?? null; const evidenceFrontMatter = frontMatter.data.evidence && typeof frontMatter.data.evidence === 'object' && !Array.isArray(frontMatter.data.evidence) ? frontMatter.data.evidence : {}; const rollbackFrontMatter = frontMatter.data.rollback && typeof frontMatter.data.rollback === 'object' && !Array.isArray(frontMatter.data.rollback) ? frontMatter.data.rollback : {}; const evidenceRequired = normalizeOptionalString(frontMatter.data.evidenceRequired ?? frontMatter.data.evidence_required ?? frontMatter.data.required ?? evidenceFrontMatter.required ?? evidenceFrontMatter.kind); const rollbackStrategy = normalizeOptionalString(frontMatter.data.rollbackStrategy ?? frontMatter.data.rollback_strategy ?? frontMatter.data.strategy ?? rollbackFrontMatter.strategy); const rollbackNotes = normalizeOptionalString(frontMatter.data.rollbackNotes ?? frontMatter.data.rollback_notes ?? rollbackFrontMatter.notes); const contextMap = parseContextMap(frontMatter.data.contextMap); let dispatchMetadata = {}; try {
|
|
802
|
-
dispatchMetadata = parseDispatchMetadataFromPlanText(input.planText);
|
|
803
|
-
}
|
|
804
|
-
catch (error) {
|
|
805
|
-
cardImportDiagnostics.push({ code: 'ATM_TASK_IMPORT_DISPATCH_METADATA_TOO_LARGE', severity: 'error', message: error instanceof Error ? error.message : String(error), field: 'dispatchPattern' });
|
|
806
|
-
} const importDiagnostics = [...cardImportDiagnostics]; if (frontMatter.data.allowed_files !== undefined && frontMatter.data.scopePaths === undefined && frontMatter.data.scope_paths === undefined) {
|
|
807
|
-
importDiagnostics.push({ code: 'ATM_TASK_IMPORT_LEGACY_ALIAS', severity: 'warning', message: 'Front-matter uses legacy alias `allowed_files`; ATM imports the value as `scopePaths` to preserve target-repo scope. Prefer `scopePaths` in new task cards.', field: 'scopePaths', alias: 'allowed_files', canonical: 'scopePaths' });
|
|
808
|
-
if (deliverables.length === 0) {
|
|
809
|
-
importDiagnostics.push({ code: 'ATM_TASK_IMPORT_LEGACY_SCOPE_DELIVERABLES_REQUIRED', severity: 'warning', message: 'Legacy allowed_files card did not expose a file-only deliverable boundary; add explicit deliverables for future historical closeback.', field: 'deliverables' });
|
|
810
|
-
}
|
|
811
|
-
} if (frontMatter.data.blocked_by !== undefined && frontMatter.data.depends_on === undefined && frontMatter.data.dependencies === undefined) {
|
|
812
|
-
importDiagnostics.push({ code: 'ATM_TASK_IMPORT_LEGACY_ALIAS', severity: 'warning', message: 'Front-matter uses legacy alias `blocked_by`; ATM imports the value as `dependencies`. Prefer `depends_on` or `dependencies`.', field: 'dependencies', alias: 'blocked_by', canonical: 'depends_on' });
|
|
813
|
-
} if (frontMatter.data.upstream_repo !== undefined && frontMatter.data.target_repo === undefined && frontMatter.data.targetRepo === undefined) {
|
|
814
|
-
importDiagnostics.push({ code: 'ATM_TASK_IMPORT_LEGACY_ALIAS', severity: 'warning', message: 'Front-matter uses legacy alias `upstream_repo`; ATM imports the value as `targetRepo`. Prefer `target_repo`.', field: 'targetRepo', alias: 'upstream_repo', canonical: 'target_repo' });
|
|
815
|
-
} if (scopePaths.length > 0 && outOfScope.length > 0) {
|
|
816
|
-
const intersections = scopePaths.filter((p) => isPathAllowedByScope(p, outOfScope));
|
|
817
|
-
if (intersections.length > 0) {
|
|
818
|
-
importDiagnostics.push({ code: 'ATM_TASK_SCOPE_OUT_OF_SCOPE_INTERSECTION', severity: 'warning', message: `Task scope paths intersect with outOfScope: ${intersections.join(', ')}. These files will be subtracted from targetAllowedFiles.`, field: 'scopePaths' });
|
|
819
|
-
}
|
|
820
|
-
} importDiagnostics.push(...buildMechanicalSplitScopeDiagnostics({ title, body, scopePaths, deliverables, mapUpdates, ownerAtomOrMap: normalizeOptionalString(frontMatter.data.ownerAtomOrMap ?? frontMatter.data.owner_atom_or_map ?? atomizationImpactFrontMatter.ownerAtomOrMap ?? atomizationImpactFrontMatter.owner_atom_or_map) })); const ownerAtomOrMap = normalizeOptionalString(frontMatter.data.ownerAtomOrMap ?? frontMatter.data.owner_atom_or_map ?? atomizationImpactFrontMatter.ownerAtomOrMap ?? atomizationImpactFrontMatter.owner_atom_or_map); return { schemaVersion: 'atm.workItem.v0.2', workItemId, title, status, milestone, dependencies, acceptance, deliverables, scopePaths, validators, ...(testPlan ? { testPlan } : {}), planningRepo: normalizeOptionalString(frontMatter.data.planning_repo ?? frontMatter.data.planningRepo), targetRepo: normalizeOptionalString(frontMatter.data.target_repo ?? frontMatter.data.targetRepo ?? frontMatter.data.upstream_repo ?? frontMatter.data.upstreamRepo), closureAuthority: normalizeOptionalString(frontMatter.data.closure_authority ?? frontMatter.data.closureAuthority), planningReadOnlyPaths, planningMirrorPaths, planningArtifacts, outOfScope, nonGoals, evidenceRequired, rollbackStrategy, rollbackNotes, contextMap, ...(dispatchMetadata.dispatchPattern ? { dispatchPattern: dispatchMetadata.dispatchPattern } : {}), ...(dispatchMetadata.conditionReview && dispatchMetadata.conditionReview.length > 0 ? { conditionReview: dispatchMetadata.conditionReview } : {}), ...(dispatchMetadata.mailboxAssignee ? { mailboxAssignee: dispatchMetadata.mailboxAssignee } : {}), atomizationImpact: { ownerAtomOrMap, atomCid: normalizeOptionalString(frontMatter.data.atomCid ?? frontMatter.data.atom_cid ?? atomizationImpactFrontMatter.atomCid ?? atomizationImpactFrontMatter.atom_cid), mapUpdates, ...(parseExtractionCandidates(atomizationImpactFrontMatter.extractionCandidates ?? atomizationImpactFrontMatter.extraction_candidates) ?? {}) }, ...(proposalAdmission ? { proposalAdmission } : {}), legacyImportAliases: { ...(frontMatter.data.allowed_files ? { allowed_files: parseYamlList(frontMatter.data.allowed_files) } : {}), ...(frontMatter.data.blocked_by ? { blocked_by: parseYamlList(frontMatter.data.blocked_by) } : {}), ...(frontMatter.data.upstream_repo ? { upstream_repo: normalizeOptionalString(frontMatter.data.upstream_repo) ?? '' } : {}) }, importDiagnostics, tags, notes, source: { planPath: input.planRelativePath, sectionTitle: workItemId, headingLine: frontMatter.headingLine, hash: hashSection(input.planText) }, importedAt: input.importedAt }; }
|
|
821
|
-
function parseExtractionCandidates(value) { if (!Array.isArray(value))
|
|
822
|
-
return null; const entries = value.filter((entry) => Boolean(entry) && typeof entry === 'object' && !Array.isArray(entry)).map((entry) => ({ ...(typeof entry.atom === 'string' ? { atom: entry.atom.trim() } : {}), ...(typeof entry.pattern === 'string' ? { pattern: entry.pattern.trim() } : {}), ...(typeof entry.source === 'string' ? { source: entry.source.trim() } : {}), ...(typeof entry.disposition === 'string' ? { disposition: entry.disposition.trim() } : {}), inlineReason: typeof entry.inlineReason === 'string' ? entry.inlineReason : null })); return entries.length > 0 ? { extractionCandidates: entries } : null; }
|
|
823
|
-
function buildMechanicalSplitScopeDiagnostics(input) { const haystack = [input.title, input.body, input.ownerAtomOrMap ?? '', ...input.mapUpdates].join('\n').toLowerCase(); if (!/(split|mechanical|extract|facade|module|atom[-_\s]?map|atomization|拆分|切分|抽出|門面|模組)/i.test(haystack)) {
|
|
824
|
-
return [];
|
|
825
|
-
} const declared = uniqueStrings([...input.scopePaths, ...input.deliverables].map(normalizeYamlScalar).filter(Boolean)); const fileLike = declared.filter((entry) => /\.[A-Za-z0-9]+$/.test(entry) && !/[*/{}]/.test(entry)); const broadPatterns = declared.filter((entry) => /[*]|\*\*|\/$/.test(entry)); if (fileLike.length > 1 || broadPatterns.length > 0)
|
|
826
|
-
return []; const candidates = uniqueStrings([...declared, ...input.mapUpdates.map(normalizeYamlScalar).filter(Boolean)]); return [{ code: 'ATM_TASK_IMPORT_MECHANICAL_SPLIT_SCOPE_CHECKLIST', severity: 'warning', field: 'scopePaths', message: 'Mechanical split/facade/module task appears to declare a narrow file boundary. Before the first delivery commit, review sibling files such as types.ts, shared.ts, constants.ts, registry files, and lane modules; add all expected paths once with `node atm.mjs tasks scope add --task <id> --paths <paths> --json`.', candidates }]; }
|
|
827
|
-
function normalizeTaskTestPlan(value) { if (!value || typeof value !== 'object' || Array.isArray(value)) {
|
|
828
|
-
return undefined;
|
|
829
|
-
} const record = value; return { schemaId: typeof record.schemaId === 'string' ? record.schemaId : 'atm.taskTestPlan.v1', selectionMode: typeof record.selectionMode === 'string' ? record.selectionMode : 'task-scoped', ...record }; }
|
|
830
|
-
export function enrichParsedTasksFromSiblingTaskCards(input) { const taskCardRoot = path.join(path.dirname(input.planAbsolute), 'tasks'); if (!existsSync(taskCardRoot))
|
|
831
|
-
return input.parsed; let entries; try {
|
|
832
|
-
entries = readdirSync(taskCardRoot, { withFileTypes: true });
|
|
833
|
-
}
|
|
834
|
-
catch {
|
|
835
|
-
return input.parsed;
|
|
836
|
-
} const cardByTaskId = new Map(); for (const entry of entries) {
|
|
837
|
-
if (!entry.isFile() || !entry.name.endsWith('.task.md'))
|
|
838
|
-
continue;
|
|
839
|
-
const taskIdMatch = taskIdPattern.exec(entry.name);
|
|
840
|
-
if (!taskIdMatch)
|
|
841
|
-
continue;
|
|
842
|
-
const cardPath = path.join(taskCardRoot, entry.name);
|
|
843
|
-
const cardText = readFileSync(cardPath, 'utf8');
|
|
844
|
-
const card = parseSingleCard({ planText: cardText, planRelativePath: toStoredPlanningPath(input.cwd, cardPath), importedAt: input.importedAt });
|
|
845
|
-
if (card)
|
|
846
|
-
cardByTaskId.set(card.workItemId, card);
|
|
847
|
-
} if (cardByTaskId.size === 0)
|
|
848
|
-
return input.parsed; const tasks = input.parsed.tasks.map((task) => { const card = cardByTaskId.get(task.workItemId); if (!card)
|
|
849
|
-
return task; return { ...task, ...card, source: card.source, importedAt: task.importedAt }; }); const diagnostics = [...input.parsed.diagnostics]; const enrichedCount = tasks.filter((task) => cardByTaskId.has(task.workItemId)).length; if (enrichedCount > 0) {
|
|
850
|
-
diagnostics.push({ level: 'info', code: 'ATM_TASKS_IMPORT_CARD_CONTRACT_MERGED', text: `Merged machine-readable frontmatter from ${enrichedCount} sibling task card(s).` });
|
|
851
|
-
} return { tasks, diagnostics }; }
|
|
852
|
-
function parseTaskSection(input) { const { section } = input; const diagnostics = []; const sectionText = section.bodyLines.join('\n'); const sectionsByHeading = sliceBodyByHeadings(sectionText); const acceptance = [...collectBulletList(sectionsByHeading, acceptanceHeaders), ...collectLabeledText(section.bodyLines, ['acceptance criteria', 'acceptance', '驗收'])]; const deliverables = uniqueStrings([...collectBulletList(sectionsByHeading, deliverablesHeaders), ...collectLabeledText(section.bodyLines, ['deliverables', 'outputs', 'outcomes', 'evidence', 'validation', '輸出', '驗證']), ...(input.tableMetadata?.deliverables ?? [])]); const sectionDependencies = collectBulletList(sectionsByHeading, dependenciesHeaders).flatMap((entry) => parseDependencyList(entry, section.workItemId)); const dependencies = uniqueStrings(sectionDependencies.length > 0 ? sectionDependencies : input.tableMetadata?.dependencies ?? []); const tags = collectBulletList(sectionsByHeading, tagsHeaders); const notes = collectText(sectionsByHeading, notesHeaders) ?? null; const statusRaw = collectKeyValue(sectionsByHeading, 'status') ?? collectKeyValue(sectionsByHeading, 'state') ?? collectKeyValueFromLines(section.bodyLines, 'status') ?? collectKeyValueFromLines(section.bodyLines, 'state') ?? input.tableMetadata?.status ?? 'planned'; const milestone = collectKeyValue(sectionsByHeading, 'milestone') ?? collectKeyValueFromLines(section.bodyLines, 'milestone') ?? input.tableMetadata?.milestone ?? null; const status = coerceStatus(statusRaw); const hash = hashSection(`${section.workItemId}\n${sectionText}`); if (!validStatuses.has(status)) {
|
|
853
|
-
diagnostics.push({ level: 'warning', code: 'ATM_TASKS_STATUS_UNKNOWN', text: `Task ${section.workItemId} declared unknown status ${statusRaw}; defaulted to planned.`, workItemId: section.workItemId, sourceLine: section.headingLine });
|
|
854
|
-
} const task = { schemaVersion: 'atm.workItem.v0.2', workItemId: section.workItemId, title: section.title || input.tableMetadata?.title || section.workItemId, status, milestone: milestone ?? null, dependencies, acceptance, deliverables, tags, notes, source: { planPath: input.planRelativePath, sectionTitle: section.title || section.workItemId, headingLine: section.headingLine, hash }, importedAt: input.importedAt }; return { task, diagnostics }; }
|
|
855
|
-
function createTaskFromTableMetadata(input) { return delegatedCreateTaskFromTableMetadata({ ...input, hashSection }); }
|
|
856
|
-
function hasProtectedActiveClaim(document) { if (!document)
|
|
857
|
-
return false; const claim = parseClaimRecord(document.claim); return Boolean(claim && (claim.state === 'active' || claim.state === 'handoff')); } /**
|
|
858
|
-
* ATM-GOV-0364 / ATM-BUG-2026-08-13-008. Claim preservation across a forced
|
|
859
|
-
* re-import used to depend on parseClaimRecord returning a fully-formed record,
|
|
860
|
-
* so a claim that was live but missing an optional field was read as no claim at
|
|
861
|
-
* all and silently dropped, leaving an orphaned runtime lock behind it. Whether
|
|
862
|
-
* a claim parses cleanly is a question about the record's shape; whether it is
|
|
863
|
-
* someone's live hold on the task is a question about its state. Only the second
|
|
864
|
-
* one may decide whether --force is allowed to discard it.
|
|
865
|
-
*/
|
|
866
|
-
export function hasPreservableClaimState(document) { if (!document)
|
|
867
|
-
return false; if (hasProtectedActiveClaim(document))
|
|
868
|
-
return true; const claim = document.claim; if (!claim || typeof claim !== 'object' || Array.isArray(claim))
|
|
869
|
-
return false; const state = String(claim.state ?? '').trim(); return state.length > 0 && state !== 'released'; }
|
|
870
|
-
function isCreatePlaceholderLedger(document) { if (normalizeTaskStatus(document.status) !== 'planned')
|
|
871
|
-
return false; const source = document.source; const sourceHash = source && typeof source === 'object' && !Array.isArray(source) ? String(source.hash ?? '').trim() : ''; const legacyHash = typeof document.hash === 'string' ? document.hash.trim() : ''; if (sourceHash.length > 0 || legacyHash.length > 0)
|
|
872
|
-
return false; if (typeof document.importedAt === 'string' && document.importedAt.trim().length > 0)
|
|
873
|
-
return false; return true; }
|
|
874
|
-
function releaseEmbeddedDirectionLock(input) { const embeddedLock = input.lockRecord.taskDirectionLock; if (!embeddedLock || typeof embeddedLock !== 'object' || Array.isArray(embeddedLock))
|
|
875
|
-
return false; const embedded = embeddedLock; if (embedded.status === 'released')
|
|
876
|
-
return false; writeFileSync(input.lockPath, `${JSON.stringify({ ...input.lockRecord, taskDirectionLock: { ...embedded, status: 'released', released: true, releasedAt: input.nowIso, releasedBy: input.actorId } }, null, 2)}\n`, 'utf8'); return true; }
|
|
877
|
-
function applyCanonicalDirectionLockRelease(input) { const canonicalDirectionLock = input.taskDocument.taskDirectionLock; if (!canonicalDirectionLock || typeof canonicalDirectionLock !== 'object' || Array.isArray(canonicalDirectionLock)) {
|
|
878
|
-
return false;
|
|
879
|
-
} const directionLock = canonicalDirectionLock; if (directionLock.status === 'released')
|
|
880
|
-
return false; input.taskDocument.taskDirectionLock = { ...directionLock, status: 'released', released: true, releasedAt: input.nowIso, releasedBy: input.actorId }; return true; }
|
|
881
|
-
function importWouldOverwriteTask(input) { const currentHash = input.current.source?.hash ?? input.current.hash ?? ''; if (input.resetOpen || input.reopen)
|
|
882
|
-
return true; if (input.force)
|
|
883
|
-
return currentHash !== input.task.source.hash; return currentHash !== input.task.source.hash; }
|
|
884
|
-
function shouldSkipImportForActiveClaim(options) { if (!options.wouldOverwrite || options.forceOverwriteClaims || options.force || options.resetOpen || options.reopen || options.reconcileMirror) {
|
|
885
|
-
return false;
|
|
886
|
-
} return true; }
|
|
887
|
-
export function collectActiveClaimImportSkips(cwd, tasks, options) { const diagnostics = []; const taskLedger = readTaskLedgerPolicy(cwd); const taskStoreDirectory = path.join(cwd, taskLedger.taskRoot); for (const task of tasks) {
|
|
888
|
-
const filePath = path.join(taskStoreDirectory, `${task.workItemId}.json`);
|
|
889
|
-
if (!existsSync(filePath))
|
|
890
|
-
continue;
|
|
891
|
-
try {
|
|
892
|
-
const existingDocument = JSON.parse(readFileSync(filePath, 'utf8'));
|
|
893
|
-
if (!hasProtectedActiveClaim(existingDocument))
|
|
894
|
-
continue;
|
|
895
|
-
const wouldOverwrite = importWouldOverwriteTask({ current: existingDocument, task, force: options.force, resetOpen: options.resetOpen, reopen: options.reopen });
|
|
896
|
-
if (!shouldSkipImportForActiveClaim({ ...options, wouldOverwrite }))
|
|
897
|
-
continue;
|
|
898
|
-
diagnostics.push({ level: 'warning', code: 'IMPORT_SKIPPED_ACTIVE_CLAIM', text: `Task ${task.workItemId} has an active claim; import skipped to avoid overwriting claim state.`, workItemId: task.workItemId });
|
|
899
|
-
}
|
|
900
|
-
catch { }
|
|
901
|
-
} return diagnostics; }
|
|
902
|
-
export function writeTaskFiles(input) { const writtenPaths = []; const diagnostics = []; const reconcileMirror = input.reconcileMirror === true; const taskLedger = readTaskLedgerPolicy(input.cwd); const taskStoreDirectory = path.join(input.cwd, taskLedger.taskRoot); mkdirSync(taskStoreDirectory, { recursive: true }); for (const task of input.tasks) {
|
|
903
|
-
const filePath = path.join(taskStoreDirectory, `${task.workItemId}.json`);
|
|
904
|
-
if (existsSync(filePath) && !input.force) {
|
|
905
|
-
try {
|
|
906
|
-
const current = JSON.parse(readFileSync(filePath, 'utf8'));
|
|
907
|
-
const currentHash = current.source?.hash ?? current.hash ?? '';
|
|
908
|
-
const currentStatus = normalizeTaskStatus(current.status);
|
|
909
|
-
if (currentStatus === 'done' && reconcileMirror) {
|
|
910
|
-
diagnostics.push({ level: 'info', code: 'ATM_TASKS_IMPORT_RECONCILE_MIRROR_READY', text: `Task ${task.workItemId} is done; planning mirror metadata will be reconciled without reopening delivery state.`, workItemId: task.workItemId });
|
|
911
|
-
continue;
|
|
912
|
-
}
|
|
913
|
-
if (currentHash === task.source.hash && !input.resetOpen && !input.reopen) {
|
|
914
|
-
diagnostics.push({ level: 'info', code: 'ATM_TASKS_IMPORT_UNCHANGED', text: `Task ${task.workItemId} is unchanged; left existing file in place.`, workItemId: task.workItemId });
|
|
915
|
-
continue;
|
|
916
|
-
}
|
|
917
|
-
if (currentStatus === 'done' && !input.reopen && !input.resetOpen) {
|
|
918
|
-
diagnostics.push({ level: 'error', code: 'ATM_TASKS_IMPORT_DONE_REQUIRES_REOPEN', text: `Task ${task.workItemId} is done; use --reopen or --reset-open before overwriting it.`, workItemId: task.workItemId });
|
|
919
|
-
continue;
|
|
920
|
-
}
|
|
921
|
-
if (input.force) {
|
|
922
|
-
const currentSource = current.source;
|
|
923
|
-
const sameSource = currentSource?.planPath === task.source.planPath || currentHash === task.source.hash;
|
|
924
|
-
if (!sameSource) {
|
|
925
|
-
diagnostics.push({ level: 'error', code: 'ATM_TASKS_IMPORT_FORCE_SOURCE_MISMATCH', text: `Task ${task.workItemId} exists from a different source; refusing --force overwrite.`, workItemId: task.workItemId });
|
|
926
|
-
continue;
|
|
927
|
-
}
|
|
928
|
-
}
|
|
929
|
-
const existingDocument = current;
|
|
930
|
-
const wouldOverwrite = importWouldOverwriteTask({ current: existingDocument, task, force: input.force, resetOpen: input.resetOpen, reopen: input.reopen });
|
|
931
|
-
if (hasProtectedActiveClaim(existingDocument) && shouldSkipImportForActiveClaim({ force: input.force, forceOverwriteClaims: input.forceOverwriteClaims, resetOpen: input.resetOpen, reopen: input.reopen, reconcileMirror, wouldOverwrite })) {
|
|
932
|
-
diagnostics.push({ level: 'warning', code: 'IMPORT_SKIPPED_ACTIVE_CLAIM', text: `Task ${task.workItemId} has an active claim; import skipped to avoid overwriting claim state.`, workItemId: task.workItemId });
|
|
933
|
-
continue;
|
|
934
|
-
}
|
|
935
|
-
if (input.resetOpen || input.reopen) {
|
|
936
|
-
continue;
|
|
937
|
-
}
|
|
938
|
-
if (isCreatePlaceholderLedger(existingDocument) && !hasProtectedActiveClaim(existingDocument)) {
|
|
939
|
-
continue;
|
|
940
|
-
}
|
|
941
|
-
diagnostics.push({ level: 'error', code: 'ATM_TASKS_IMPORT_DRIFT', text: `Task ${task.workItemId} exists with a different hash; rerun with --force to overwrite.`, workItemId: task.workItemId });
|
|
942
|
-
continue;
|
|
943
|
-
}
|
|
944
|
-
catch {
|
|
945
|
-
diagnostics.push({ level: 'error', code: 'ATM_TASKS_IMPORT_UNREADABLE_EXISTING', text: `Task ${task.workItemId} file exists but is unreadable; rerun with --force to overwrite.`, workItemId: task.workItemId });
|
|
946
|
-
continue;
|
|
947
|
-
}
|
|
948
|
-
}
|
|
949
|
-
} if (diagnostics.some((entry) => entry.level === 'error')) {
|
|
950
|
-
return { writtenPaths, diagnostics };
|
|
951
|
-
} for (const task of input.tasks) {
|
|
952
|
-
const filePath = path.join(taskStoreDirectory, `${task.workItemId}.json`);
|
|
953
|
-
let existingDocument = null;
|
|
954
|
-
if (existsSync(filePath)) {
|
|
955
|
-
try {
|
|
956
|
-
existingDocument = JSON.parse(readFileSync(filePath, 'utf8'));
|
|
957
|
-
}
|
|
958
|
-
catch { }
|
|
959
|
-
}
|
|
960
|
-
const placeholderOverwrite = existingDocument ? isCreatePlaceholderLedger(existingDocument) && !hasProtectedActiveClaim(existingDocument) : false;
|
|
961
|
-
if (existsSync(filePath) && !input.force && !reconcileMirror && !input.resetOpen && !input.reopen && !placeholderOverwrite) {
|
|
962
|
-
continue;
|
|
963
|
-
}
|
|
964
|
-
const wouldOverwrite = existingDocument ? importWouldOverwriteTask({ current: existingDocument, task, force: input.force, resetOpen: input.resetOpen, reopen: input.reopen }) : true;
|
|
965
|
-
if (existingDocument && hasProtectedActiveClaim(existingDocument) && shouldSkipImportForActiveClaim({ force: input.force, forceOverwriteClaims: input.forceOverwriteClaims, resetOpen: input.resetOpen, reopen: input.reopen, reconcileMirror, wouldOverwrite })) {
|
|
966
|
-
diagnostics.push({ level: 'warning', code: 'IMPORT_SKIPPED_ACTIVE_CLAIM', text: `Task ${task.workItemId} has an active claim; import skipped to avoid overwriting claim state.`, workItemId: task.workItemId });
|
|
967
|
-
continue;
|
|
968
|
-
}
|
|
969
|
-
const displacedClaim = existingDocument && input.forceOverwriteClaims && hasProtectedActiveClaim(existingDocument) ? parseClaimRecord(existingDocument.claim) : null;
|
|
970
|
-
const taskDocument = { ...task, ...(input.resetOpen ? { status: 'open' } : {}), ...(input.reopen ? { status: 'open', reopenedAt: new Date().toISOString() } : {}) };
|
|
971
|
-
if (existingDocument && reconcileMirror && normalizeTaskStatus(existingDocument.status) === 'done') {
|
|
972
|
-
Object.assign(taskDocument, reconcileMirrorOnlyTaskDocument(existingDocument, task));
|
|
973
|
-
}
|
|
974
|
-
else if (input.resetOpen || input.reopen) {
|
|
975
|
-
delete taskDocument.claim;
|
|
976
|
-
delete taskDocument.closedAt;
|
|
977
|
-
delete taskDocument.closedByActor;
|
|
978
|
-
delete taskDocument.closurePacket;
|
|
979
|
-
delete taskDocument.closeReason;
|
|
980
|
-
}
|
|
981
|
-
else if (existingDocument && hasPreservableClaimState(existingDocument) && input.force && !input.forceOverwriteClaims) {
|
|
982
|
-
taskDocument.claim = existingDocument.claim;
|
|
983
|
-
if (existingDocument.status)
|
|
984
|
-
taskDocument.status = existingDocument.status;
|
|
985
|
-
if (existingDocument.owner)
|
|
986
|
-
taskDocument.owner = existingDocument.owner;
|
|
987
|
-
if (existingDocument.startedAt)
|
|
988
|
-
taskDocument.startedAt = existingDocument.startedAt;
|
|
989
|
-
if (existingDocument.startedBySessionId)
|
|
990
|
-
taskDocument.startedBySessionId = existingDocument.startedBySessionId;
|
|
991
|
-
if (existingDocument.taskDirectionLock) {
|
|
992
|
-
taskDocument.taskDirectionLock = existingDocument.taskDirectionLock;
|
|
993
|
-
}
|
|
994
|
-
}
|
|
995
|
-
const previousStatus = typeof existingDocument?.status === 'string' ? existingDocument.status : null;
|
|
996
|
-
const transitionPath = writeTaskDocumentWithTransition({ cwd: input.cwd, taskPath: filePath, taskId: task.workItemId, taskDocument, action: existingDocument && reconcileMirror && normalizeTaskStatus(existingDocument.status) === 'done' ? 'planning-mirror-reconcile' : 'import', actorId: null, previousStatus });
|
|
997
|
-
if (displacedClaim) {
|
|
998
|
-
const displacedAt = new Date().toISOString();
|
|
999
|
-
appendTaskTransitionEvent({ cwd: input.cwd, taskId: task.workItemId, action: 'claim-displaced-by-import', actorId: null, sessionId: null, fromStatus: previousStatus, toStatus: typeof taskDocument.status === 'string' ? taskDocument.status : null, taskPath: filePath, taskDocument: { ...taskDocument, displacedClaim: { actorId: displacedClaim.actorId, leaseId: displacedClaim.leaseId, state: displacedClaim.state, reason: 'import overwrite with --force-overwrite-claims', importTransitionPath: transitionPath } }, command: 'node atm.mjs tasks import --write --force-overwrite-claims', createdAt: displacedAt });
|
|
1000
|
-
}
|
|
1001
|
-
writtenPaths.push(relativePathFrom(input.cwd, filePath));
|
|
1002
|
-
} return { writtenPaths, diagnostics }; }
|
|
1003
|
-
function reconcileMirrorOnlyTaskDocument(existingDocument, task) { const merged = { ...existingDocument, source: task.source, importedAt: task.importedAt, planningRepo: task.planningRepo ?? existingDocument.planningRepo ?? null, targetRepo: task.targetRepo ?? existingDocument.targetRepo ?? null, closureAuthority: task.closureAuthority ?? existingDocument.closureAuthority ?? null, planningReadOnlyPaths: task.planningReadOnlyPaths ?? existingDocument.planningReadOnlyPaths, planningMirrorPaths: task.planningMirrorPaths ?? existingDocument.planningMirrorPaths, importDiagnostics: task.importDiagnostics ?? existingDocument.importDiagnostics, legacyImportAliases: task.legacyImportAliases ?? existingDocument.legacyImportAliases }; if (typeof existingDocument.status === 'string')
|
|
1004
|
-
merged.status = existingDocument.status; if ('claim' in existingDocument)
|
|
1005
|
-
merged.claim = existingDocument.claim; if ('closedAt' in existingDocument)
|
|
1006
|
-
merged.closedAt = existingDocument.closedAt; if ('closedByActor' in existingDocument)
|
|
1007
|
-
merged.closedByActor = existingDocument.closedByActor; if ('closurePacket' in existingDocument)
|
|
1008
|
-
merged.closurePacket = existingDocument.closurePacket; if ('closeReason' in existingDocument)
|
|
1009
|
-
merged.closeReason = existingDocument.closeReason; if ('lastTransitionId' in existingDocument)
|
|
1010
|
-
merged.lastTransitionId = existingDocument.lastTransitionId; return merged; }
|
|
1011
|
-
export function writeImportEvidence(input) { const evidenceDirectory = path.join(input.cwd, '.atm', 'history', 'reports', 'task-import'); mkdirSync(evidenceDirectory, { recursive: true }); const evidenceFile = `${input.generatedAt.replace(/[:.]/g, '-')}.json`; const evidencePath = path.join(evidenceDirectory, evidenceFile); const payload = { schemaId: 'atm.taskImportEvidence', specVersion: '0.1.0', generatedAt: input.generatedAt, planPath: input.planPath, taskCount: input.tasks.length, writtenPaths: input.writtenPaths, taskIds: input.tasks.map((task) => task.workItemId), sourceTraces: input.tasks.map((task) => ({ workItemId: task.workItemId, planPath: task.source.planPath, sectionTitle: task.source.sectionTitle, headingLine: task.source.headingLine, hash: task.source.hash })) }; writeFileSync(evidencePath, `${JSON.stringify(payload, null, 2)}\n`, 'utf8'); return relativePathFrom(input.cwd, evidencePath); }
|
|
1012
|
-
function sliceBodyByHeadings(text) { const lines = text.split(/\r?\n/); const sections = []; let current = null; for (const line of lines) {
|
|
1013
|
-
const headingMatch = /^#{2,4}\s+(.+?)\s*$/.exec(line);
|
|
1014
|
-
if (headingMatch) {
|
|
1015
|
-
if (current)
|
|
1016
|
-
sections.push(current);
|
|
1017
|
-
current = { heading: headingMatch[1].toLowerCase().trim(), lines: [] };
|
|
1018
|
-
continue;
|
|
1019
|
-
}
|
|
1020
|
-
if (current) {
|
|
1021
|
-
current.lines.push(line);
|
|
1022
|
-
}
|
|
1023
|
-
} if (current)
|
|
1024
|
-
sections.push(current); return sections; }
|
|
1025
|
-
function collectBulletList(sections, headingNames) { const target = sections.find((section) => headingNames.some((name) => section.heading.includes(name))); if (!target)
|
|
1026
|
-
return []; const items = []; for (const line of target.lines) {
|
|
1027
|
-
const match = /^\s*[-*]\s+\[\s*[ xX]\s*\]\s+(.+)|^\s*[-*]\s+(.+)/.exec(line);
|
|
1028
|
-
if (match) {
|
|
1029
|
-
const value = (match[1] ?? match[2] ?? '').trim();
|
|
1030
|
-
if (value)
|
|
1031
|
-
items.push(value);
|
|
1032
|
-
continue;
|
|
1033
|
-
}
|
|
1034
|
-
const continuation = /^\s{2,}(\S.*)$/.exec(line);
|
|
1035
|
-
if (continuation && items.length > 0) {
|
|
1036
|
-
items[items.length - 1] = `${items[items.length - 1]} ${continuation[1].trim()}`;
|
|
1037
|
-
}
|
|
1038
|
-
} return items; }
|
|
1039
|
-
function collectText(sections, headingNames) { const target = sections.find((section) => headingNames.some((name) => section.heading.includes(name))); if (!target)
|
|
1040
|
-
return null; const text = target.lines.join('\n').trim(); return text || null; }
|
|
1041
|
-
function collectKeyValue(sections, key) { return delegatedCollectKeyValue(sections, key); }
|
|
1042
|
-
function collectKeyValueFromLines(lines, key) { return delegatedCollectKeyValueFromLines(lines, key); }
|
|
1043
|
-
function extractTaskReference(value) { const match = taskIdAnywherePattern.exec(value); return match ? normalizeTaskId(match[0]) : null; }
|
|
1044
|
-
function parseDependencyList(value, baseWorkItemId) { const trimmed = cleanCellText(value); if (!trimmed || /^(none|n\/a|na|null|無|--|-|\?)$/i.test(trimmed))
|
|
1045
|
-
return []; const prefix = baseWorkItemId.replace(/-\d+$/, ''); const values = trimmed.split(/[,/、,\s]+/).map((entry) => entry.trim()).filter(Boolean).flatMap((entry) => { const fullMatch = taskIdAnywherePattern.exec(entry); if (fullMatch)
|
|
1046
|
-
return [normalizeTaskId(fullMatch[0])]; if (/^\d{2,}$/.test(entry) && prefix !== baseWorkItemId)
|
|
1047
|
-
return [`${prefix}-${entry}`]; return []; }); return uniqueStrings(values); }
|
|
1048
|
-
function collectLabeledText(lines, labels) { const normalizedLabels = labels.map((label) => label.toLowerCase()); const values = []; for (const line of lines) {
|
|
1049
|
-
const match = /^\s*\*\*(.+?)\*\*\s*[::]\s*(.+?)\s*$/.exec(line);
|
|
1050
|
-
if (!match)
|
|
1051
|
-
continue;
|
|
1052
|
-
const label = match[1].trim().toLowerCase();
|
|
1053
|
-
if (!normalizedLabels.some((candidate) => label.includes(candidate)))
|
|
1054
|
-
continue;
|
|
1055
|
-
const value = match[2].trim();
|
|
1056
|
-
if (value)
|
|
1057
|
-
values.push(value);
|
|
1058
|
-
} return values; }
|
|
1059
|
-
function cleanCellText(value) { return value.replace(/`/g, '').replace(/<br\s*\/?>/gi, ', ').trim(); }
|
|
1060
|
-
function isMarkdownTableRow(value) { return value.startsWith('|') && value.endsWith('|'); }
|
|
1061
|
-
function isMarkdownTableSeparator(value) { return /^[-|\s:]+$/.test(value.replace(/\|/g, '')); }
|
|
1062
|
-
function normalizeTableHeader(value) { return cleanCellText(value).toLowerCase().replace(/\s+/g, ' ').trim(); }
|
|
1063
|
-
function findTableColumnIndex(headers, candidates) { return headers.findIndex((header) => candidates.some((candidate) => header === candidate || header.includes(candidate))); }
|
|
1064
|
-
function cellAt(cells, index) { return index >= 0 && index < cells.length ? cells[index] : ''; }
|
|
1065
|
-
export function uniqueStrings(values) { return Array.from(new Set(values.map((value) => value.trim()).filter(Boolean))); }
|
|
1066
|
-
function escapeRegExp(value) { return value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); }
|
|
1067
|
-
export function parseSingleCardFromPlugin(parsed, importedAt) { const frontData = parsed.frontmatter; const workItemId = normalizeTaskId(parsed.taskId); const title = normalizeOptionalString(frontData.title) ?? workItemId; const status = coerceStatus(typeof frontData.status === 'string' ? frontData.status : 'planned'); const milestone = normalizeOptionalString(frontData.milestone); const dependencies = parseYamlList(frontData.depends_on ?? frontData.blocked_by ?? frontData.dependencies); const tags = parseYamlList(frontData.tags); const scopePaths = parseYamlList(frontData.scopePaths ?? frontData.scope_paths ?? frontData.allowed_files ?? frontData.allowedFiles ?? frontData.scope); const validators = parseYamlList(frontData.validators); const testPlan = normalizeTaskTestPlan(frontData.testPlan ?? frontData.test_plan); const planningMirrorPaths = parseYamlList(frontData.planningMirrorPaths ?? frontData.planning_mirror_paths); const planningReadOnlyPaths = parseYamlList(frontData.planningReadOnlyPaths ?? frontData.planning_read_only_paths); const planningArtifacts = parseYamlList(frontData.planningArtifacts ?? frontData.planning_artifacts); const outOfScope = parseYamlList(frontData.outOfScope ?? frontData.out_of_scope ?? frontData.forbidden_files); const nonGoals = parseYamlList(frontData.nonGoals ?? frontData.non_goals); const rawAtomizationImpact = frontData.atomizationImpact ?? frontData.atomization_impact; const atomizationImpactFrontMatter = rawAtomizationImpact && typeof rawAtomizationImpact === 'object' && !Array.isArray(rawAtomizationImpact) ? rawAtomizationImpact : {}; const mapUpdates = parseYamlList(frontData.mapUpdates ?? frontData.map_updates ?? atomizationImpactFrontMatter.mapUpdates ?? atomizationImpactFrontMatter.map_updates); const proposalAdmission = parseTaskProposalAdmission(frontData.proposalAdmission ?? frontData.brokerProposalAdmission); const body = parsed.body || ''; const sections = sliceBodyByHeadings(body); const acceptance = collectBulletList(sections, acceptanceHeaders); const frontMatterDeliverables = parseYamlList(frontData.deliverables); const bodyDeliverables = collectBulletList(sections, deliverablesHeaders); let deliverables; if (frontMatterDeliverables.length > 0) {
|
|
1068
|
-
deliverables = uniqueStrings(frontMatterDeliverables.map(normalizeYamlScalar));
|
|
1069
|
-
}
|
|
1070
|
-
else {
|
|
1071
|
-
deliverables = uniqueStrings(bodyDeliverables.map(normalizeYamlScalar));
|
|
1072
|
-
} if (deliverables.length === 0) {
|
|
1073
|
-
deliverables = inferLegacyDeliverablesFromScope(scopePaths.map(normalizeYamlScalar));
|
|
1074
|
-
} const notes = collectText(sections, notesHeaders) ?? null; const evidenceFrontMatter = frontData.evidence && typeof frontData.evidence === 'object' && !Array.isArray(frontData.evidence) ? frontData.evidence : {}; const rollbackFrontMatter = frontData.rollback && typeof frontData.rollback === 'object' && !Array.isArray(frontData.rollback) ? frontData.rollback : {}; const evidenceRequired = normalizeOptionalString(frontData.evidenceRequired ?? frontData.evidence_required ?? frontData.required ?? evidenceFrontMatter.required ?? evidenceFrontMatter.kind); const rollbackStrategy = normalizeOptionalString(frontData.rollbackStrategy ?? rollbackFrontMatter.strategy); const rollbackNotes = normalizeOptionalString(frontData.rollbackNotes ?? rollbackFrontMatter.notes); const contextMap = parseContextMap(frontData.contextMap); return { schemaVersion: 'atm.workItem.v0.2', workItemId, title, status, milestone, dependencies, acceptance, deliverables, scopePaths, validators, ...(testPlan ? { testPlan } : {}), planningRepo: normalizeOptionalString(frontData.planning_repo ?? frontData.planningRepo), targetRepo: normalizeOptionalString(frontData.target_repo ?? frontData.targetRepo ?? frontData.upstream_repo ?? frontData.upstreamRepo), closureAuthority: normalizeOptionalString(frontData.closure_authority ?? frontData.closureAuthority), planningReadOnlyPaths, planningMirrorPaths, planningArtifacts, outOfScope, nonGoals, evidenceRequired, rollbackStrategy, rollbackNotes, contextMap, atomizationImpact: { ownerAtomOrMap: normalizeOptionalString(frontData.ownerAtomOrMap ?? frontData.owner_atom_or_map ?? atomizationImpactFrontMatter.ownerAtomOrMap ?? atomizationImpactFrontMatter.owner_atom_or_map), atomCid: normalizeOptionalString(frontData.atomCid ?? frontData.atom_cid ?? atomizationImpactFrontMatter.atomCid ?? atomizationImpactFrontMatter.atom_cid), mapUpdates, ...(parseExtractionCandidates(atomizationImpactFrontMatter.extractionCandidates ?? atomizationImpactFrontMatter.extraction_candidates) ?? {}) }, ...(proposalAdmission ? { proposalAdmission } : {}), legacyImportAliases: { ...(frontData.allowed_files ? { allowed_files: parseYamlList(frontData.allowed_files) } : {}), ...(frontData.blocked_by ? { blocked_by: parseYamlList(frontData.blocked_by) } : {}), ...(frontData.upstream_repo ? { upstream_repo: normalizeOptionalString(frontData.upstream_repo) ?? '' } : {}) }, importDiagnostics: [], tags, notes, source: { planPath: parsed.sourcePath, sectionTitle: workItemId, headingLine: 1, hash: hashSection(body) }, importedAt }; }
|
|
1075
|
-
function parseTaskProposalAdmission(value) { if (!value || typeof value !== 'object' || Array.isArray(value)) {
|
|
1076
|
-
return undefined;
|
|
1077
|
-
} const record = value; const trigger = normalizeOptionalString(record.trigger); const normalizedTrigger = trigger === 'not-required' || trigger === 'hot-file' || trigger === 'same-file-overlap-risk' || trigger === 'shared-surface-risk' || trigger === 'manual-review-surface' ? trigger : null; if (!normalizedTrigger) {
|
|
1078
|
-
return undefined;
|
|
1079
|
-
} const boundedRegions = parseProposalAdmissionBoundedRegions(record.boundedRegions); const hotFiles = parseYamlList(record.hotFiles ?? record.hot_files); const summarySubmitted = record.summarySubmitted === true || record.summary_submitted === true || String(record.summarySubmitted ?? record.summary_submitted ?? '').trim().toLowerCase() === 'true'; return { trigger: normalizedTrigger, summarySubmitted, ...(boundedRegions.length > 0 ? { boundedRegions } : {}), ...(hotFiles.length > 0 ? { hotFiles } : {}), ...(normalizeOptionalString(record.notes) ? { notes: normalizeOptionalString(record.notes) } : {}) }; }
|
|
1080
|
-
function parseProposalAdmissionBoundedRegions(value) { const source = Array.isArray(value) ? value : Array.isArray(value?.boundedRegions) ? value.boundedRegions : Array.isArray(value?.bounded_regions) ? value.bounded_regions : null; if (!source) {
|
|
1081
|
-
return [];
|
|
1082
|
-
} const output = []; for (const entry of source) {
|
|
1083
|
-
if (!entry || typeof entry !== 'object' || Array.isArray(entry)) {
|
|
1084
|
-
continue;
|
|
1085
|
-
}
|
|
1086
|
-
const record = entry;
|
|
1087
|
-
const filePath = normalizeOptionalString(record.filePath)?.replace(/\\/g, '/');
|
|
1088
|
-
const lineStart = typeof record.lineStart === 'number' ? record.lineStart : Number.parseInt(String(record.lineStart ?? ''), 10);
|
|
1089
|
-
const lineEnd = typeof record.lineEnd === 'number' ? record.lineEnd : Number.parseInt(String(record.lineEnd ?? ''), 10);
|
|
1090
|
-
if (!filePath || !Number.isInteger(lineStart) || !Number.isInteger(lineEnd) || lineStart <= 0 || lineEnd < lineStart) {
|
|
1091
|
-
continue;
|
|
1092
|
-
}
|
|
1093
|
-
output.push({ filePath, lineStart, lineEnd });
|
|
1094
|
-
} return output; }
|
|
1095
|
-
function formatRosterDepends(depends) { if (depends.length === 0)
|
|
1096
|
-
return 'none'; return depends.map((entry) => `\`${entry}\``).join(', '); }
|
|
1097
|
-
function formatRosterMultiline(values) { if (values.length === 0)
|
|
1098
|
-
return ''; return values.join('<br>'); }
|
|
1099
|
-
function extractTaskIdFromRosterCell(cell) { const linkMatch = /\[([A-Z][A-Z0-9-]+)\]/i.exec(cell); if (linkMatch)
|
|
1100
|
-
return normalizeTaskId(linkMatch[1]); const plainMatch = /(TASK|ATM)-[A-Z0-9]+-\d{4,5}/i.exec(cell); return plainMatch ? normalizeTaskId(plainMatch[0]) : null; }
|
|
1101
|
-
function findRosterRowLocation(lines, taskId) { const normalizedTaskId = normalizeTaskId(taskId); for (let index = 0; index < lines.length - 1; index += 1) {
|
|
1102
|
-
const headerLine = lines[index].trim();
|
|
1103
|
-
const separatorLine = lines[index + 1].trim();
|
|
1104
|
-
if (!isMarkdownTableRow(headerLine) || !isMarkdownTableSeparator(separatorLine)) {
|
|
1105
|
-
continue;
|
|
1106
|
-
}
|
|
1107
|
-
const headers = parseMarkdownTableCells(headerLine).map((cell) => normalizeTableHeader(cell));
|
|
1108
|
-
const taskIdIndex = findTableColumnIndex(headers, ['task id', 'task', 'work item id', 'id']);
|
|
1109
|
-
if (taskIdIndex < 0) {
|
|
1110
|
-
continue;
|
|
1111
|
-
}
|
|
1112
|
-
let rowIndex = index + 2;
|
|
1113
|
-
while (rowIndex < lines.length) {
|
|
1114
|
-
const rawLine = lines[rowIndex];
|
|
1115
|
-
const trimmed = rawLine.trim();
|
|
1116
|
-
if (!isMarkdownTableRow(trimmed) || isMarkdownTableSeparator(trimmed)) {
|
|
1117
|
-
break;
|
|
1118
|
-
}
|
|
1119
|
-
const cells = parseMarkdownTableCells(trimmed);
|
|
1120
|
-
const rowTaskId = extractTaskIdFromRosterCell(cellAt(cells, taskIdIndex));
|
|
1121
|
-
if (rowTaskId === normalizedTaskId) {
|
|
1122
|
-
return { headerLineIndex: index, rowLineIndex: rowIndex, headers };
|
|
1123
|
-
}
|
|
1124
|
-
rowIndex += 1;
|
|
1125
|
-
}
|
|
1126
|
-
} return null; }
|
|
1127
|
-
function buildRosterRowFromFrontmatter(input) { const existingCells = parseMarkdownTableCells(input.existingRow); const title = normalizeOptionalString(input.frontmatter.title) ?? input.taskId; const status = coerceStatus(typeof input.frontmatter.status === 'string' ? input.frontmatter.status : 'open'); const depends = parseYamlList(input.frontmatter.depends_on ?? input.frontmatter.blocked_by ?? input.frontmatter.dependencies); const scopePaths = parseYamlList(input.frontmatter.scopePaths ?? input.frontmatter.scope_paths ?? input.frontmatter.allowed_files); const validators = parseYamlList(input.frontmatter.validators); const cells = [...existingCells]; const setCell = (candidates, value) => { const index = findTableColumnIndex(input.headers, candidates); if (index >= 0) {
|
|
1128
|
-
cells[index] = value;
|
|
1129
|
-
} }; const taskIdIndex = findTableColumnIndex(input.headers, ['task id', 'task', 'work item id', 'id']); if (taskIdIndex >= 0) {
|
|
1130
|
-
cells[taskIdIndex] = `[${input.taskId}](${input.taskFileRelativeLink})`;
|
|
1131
|
-
} setCell(['title', 'name'], title); setCell(['status', 'state'], status); setCell(['depends', 'blocked by', 'depends on', 'dependencies'], formatRosterDepends(depends)); setCell(['target surface', 'scopepaths', 'scope paths', 'scope'], formatRosterMultiline(scopePaths)); setCell(['primary validators', 'validators'], formatRosterMultiline(validators)); return `| ${cells.join(' | ')} |`; }
|
|
1132
|
-
export async function runTasksRosterUpdate(argv) { let cwd = process.cwd(); let indexPath = ''; let fromPath = ''; let dryRun = false; for (let index = 0; index < argv.length; index += 1) {
|
|
1133
|
-
const arg = argv[index];
|
|
1134
|
-
if ((arg === '--cwd' || arg === '--repo') && argv[index + 1]) {
|
|
1135
|
-
cwd = path.resolve(argv[++index]);
|
|
1136
|
-
}
|
|
1137
|
-
else if (arg === '--index' && argv[index + 1]) {
|
|
1138
|
-
indexPath = argv[++index];
|
|
1139
|
-
}
|
|
1140
|
-
else if (arg === '--from' && argv[index + 1]) {
|
|
1141
|
-
fromPath = argv[++index];
|
|
1142
|
-
}
|
|
1143
|
-
else if (arg === '--dry-run') {
|
|
1144
|
-
dryRun = true;
|
|
1145
|
-
}
|
|
1146
|
-
else if (arg === '--help' || arg === '-h') {
|
|
1147
|
-
throw new CliError('ATM_CLI_USAGE', 'tasks roster update requires --index <readme-path> --from <task-file> [--dry-run] --json', { exitCode: 2 });
|
|
1148
|
-
}
|
|
1149
|
-
} if (!indexPath || !fromPath) {
|
|
1150
|
-
throw new CliError('ATM_CLI_USAGE', 'tasks roster update requires --index <readme-path> --from <task-file>.', { exitCode: 2 });
|
|
1151
|
-
} const indexAbsolute = path.resolve(cwd, indexPath); const fromAbsolute = path.resolve(cwd, fromPath); if (!existsSync(indexAbsolute)) {
|
|
1152
|
-
throw new CliError('ATM_TASK_ROSTER_INDEX_NOT_FOUND', `Roster index not found: ${indexPath}`, { exitCode: 2 });
|
|
1153
|
-
} if (!existsSync(fromAbsolute)) {
|
|
1154
|
-
throw new CliError('ATM_TASK_ROSTER_SOURCE_NOT_FOUND', `Task file not found: ${fromPath}`, { exitCode: 2 });
|
|
1155
|
-
} const taskText = readFileSync(fromAbsolute, 'utf8'); const frontMatter = extractFrontMatter(taskText); const rawTaskId = typeof frontMatter?.data.task_id === 'string' ? frontMatter.data.task_id : typeof frontMatter?.data.id === 'string' ? frontMatter.data.id : null; if (!frontMatter || !rawTaskId) {
|
|
1156
|
-
throw new CliError('ATM_TASK_ROSTER_SOURCE_INVALID', `Task file ${fromPath} is missing task_id frontmatter.`, { exitCode: 2 });
|
|
1157
|
-
} const taskId = normalizeTaskId(rawTaskId); const original = readFileSync(indexAbsolute, 'utf8'); const originalHash = createHash('sha256').update(original).digest('hex'); const lines = original.split(/\r?\n/); const location = findRosterRowLocation(lines, taskId); if (!location) {
|
|
1158
|
-
return makeResult({ ok: false, command: 'tasks roster update', cwd, messages: [message('error', 'ATM_TASK_ROSTER_ROW_NOT_FOUND', `Task id ${taskId} was not found in roster index ${indexPath}.`)], evidence: { taskId, indexPath, fromPath, dryRun } });
|
|
1159
|
-
} const taskFileRelativeLink = path.relative(path.dirname(indexAbsolute), fromAbsolute).replace(/\\/g, '/'); const existingRow = lines[location.rowLineIndex]; const updatedRow = buildRosterRowFromFrontmatter({ taskId, frontmatter: frontMatter.data, existingRow, headers: location.headers, taskFileRelativeLink: taskFileRelativeLink.startsWith('.') ? taskFileRelativeLink : `./${taskFileRelativeLink}` }); const updatedLines = [...lines]; updatedLines[location.rowLineIndex] = updatedRow; const updated = updatedLines.join('\n'); if (dryRun) {
|
|
1160
|
-
const afterHash = createHash('sha256').update(updated).digest('hex');
|
|
1161
|
-
return makeResult({ ok: true, command: 'tasks roster update', cwd, mode: 'dry-run', messages: [message('info', 'ATM_TASK_ROSTER_UPDATE_DRY_RUN', `Roster row diff prepared for ${taskId}.`)], evidence: { taskId, indexPath, fromPath, dryRun: true, beforeHash: `sha256:${originalHash}`, afterHash: `sha256:${afterHash}`, unchanged: existingRow === updatedRow, diff: { before: existingRow, after: updatedRow } } });
|
|
1162
|
-
} writeFileSync(indexAbsolute, updated, 'utf8'); return makeResult({ ok: true, command: 'tasks roster update', cwd, mode: 'write', messages: [message('info', 'ATM_TASK_ROSTER_UPDATE_WRITTEN', `Roster row updated for ${taskId} in ${indexPath}.`)], evidence: { taskId, indexPath, fromPath, dryRun: false, beforeHash: `sha256:${originalHash}`, afterHash: `sha256:${createHash('sha256').update(updated).digest('hex')}`, diff: { before: existingRow, after: updatedRow } } }); }
|
|
1163
|
-
async function runTasksRoster(argv) { const subAction = (argv[0] ?? '').toLowerCase(); if (subAction !== 'update') {
|
|
1164
|
-
throw new CliError('ATM_CLI_USAGE', 'tasks roster requires update.', { exitCode: 2 });
|
|
1165
|
-
} return runTasksRosterUpdate(argv.slice(1)); }
|
|
1166
|
-
export async function generateTaskCard(input) { const template = input.templateKey || 'aao-l2-split'; const intent = { cwd: input.cwd, templateKey: template, fields: { task_id: input.taskId, title: input.title || 'New Task', depends_on_yaml: input.dependsOn?.trim() ? ` - ${input.dependsOn.trim()}` : '[]', scope_path: input.scopePath || 'src/main.ts', test_path: input.testPath || 'tests/main.test.ts', atom_id: input.atomId || 'atm.unowned', capability: input.capability || 'Implementation details', goal: input.goal || 'Goal description placeholder', sourcePath: input.outputPath } }; const plugins = await readPluginRegistry(input.cwd); const generatorPlugin = plugins.find(p => p.mode !== 'disabled' && typeof p.plugin.generate === 'function'); const resultCard = generatorPlugin ? await generatorPlugin.plugin.generate(intent) : await (await import('../../../_vendor/atm-markdown-task-source/dist/index.js')).default.generate(intent); return { taskId: resultCard.taskId, content: resultCard.content, sourcePath: input.outputPath, templateUsed: template }; }
|
|
1167
|
-
function assertTaskCardOutputPathIsNested(cwd, outputPath) { const absoluteCwd = path.resolve(cwd); const absoluteOutput = path.resolve(absoluteCwd, outputPath); const relativeOutput = path.relative(absoluteCwd, absoluteOutput).replace(/\\/g, '/'); if (relativeOutput === '..' || relativeOutput.startsWith('../')) {
|
|
1168
|
-
throw new CliError('ATM_CLI_USAGE', 'tasks new must write task cards inside the repository; use docs/tasks/<name>.task.md or another nested task directory.', { exitCode: 2, details: { outputPath } });
|
|
1169
|
-
} if (path.posix.dirname(relativeOutput) === '.' && relativeOutput.endsWith('.task.md')) {
|
|
1170
|
-
throw new CliError('ATM_CLI_USAGE', 'tasks new must not write task cards at the repository root; use docs/tasks/<name>.task.md or another nested task directory.', { exitCode: 2, details: { outputPath } });
|
|
1171
|
-
} }
|
|
1172
|
-
async function runTasksNew(argv) { const spec = (await import('../../command-specs/tasks.spec.js')).default; const parsed = parseArgsForCommand(spec, ['new', ...argv]); const options = parsed.options; const cwd = options.cwd || process.cwd(); const template = options.template || 'aao-l2-split'; const taskId = options.taskId || options.task || 'TASK-UNKNOWN-0000'; const title = options.title || 'New Task'; const outPath = options.output; if (!outPath) {
|
|
1173
|
-
throw new CliError('ATM_CLI_USAGE', 'tasks new requires --output <path>', { exitCode: 2 });
|
|
1174
|
-
} assertTaskCardOutputPathIsNested(cwd, outPath); const resultCard = await generateTaskCard({ cwd, templateKey: template, taskId, title, outputPath: outPath, dependsOn: options.dependsOn, scopePath: options.scopePath, testPath: options.testPath, atomId: options.atomId, capability: options.capability, goal: options.goal }); const targetAbsolute = path.resolve(cwd, outPath); const targetDir = path.dirname(targetAbsolute); mkdirSync(targetDir, { recursive: true }); writeFileSync(targetAbsolute, resultCard.content, 'utf8'); return makeResult({ ok: true, command: 'tasks', cwd, messages: [message('info', 'ATM_TASKS_NEW_GENERATED', `Generated new task card template at ${outPath}`)], evidence: { ok: true, sourcePath: outPath, taskId: resultCard.taskId, templateUsed: template, generatorSurface: 'tasks-new' } }); }
|
|
1175
|
-
export { parseReconcileOptions, parseDeliverAndCloseOptions, parseCreateOptions, parseMirrorOptions, parseCloseOptions, parseStatusOptions, parseFinalizeDiagnoseOptions, parseResetOptions, parseLockCleanupOptions, parseClaimLifecycleOptions, parseHistoricalDeliveryRefs, parseScopeAddOptions, parseScopeRepairOptions, parseQueueOptions, parseAuditOptions, parseLegacyLedgerMigrationOptions, parseAllowStaleRunnerFlag } from '../task-option-parsers.js';
|
|
1176
|
-
export { safeTaskFileReadDir, safeTaskFileStat, readJsonRecord, taskPathFor, collectTaskFileValues, normalizeRelativePath, legacyTaskRequiresBaseline };
|