@paths.design/caws-cli 10.2.0 → 11.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +125 -374
- package/dist/index.js +43 -785
- package/dist/shell/binding/resolve-binding.d.ts +4 -0
- package/dist/shell/binding/resolve-binding.d.ts.map +1 -0
- package/dist/shell/binding/resolve-binding.js +228 -0
- package/dist/shell/binding/resolve-binding.js.map +1 -0
- package/dist/shell/binding/types.d.ts +42 -0
- package/dist/shell/binding/types.d.ts.map +1 -0
- package/dist/shell/binding/types.js +21 -0
- package/dist/shell/binding/types.js.map +1 -0
- package/dist/shell/commands/claim.d.ts +14 -0
- package/dist/shell/commands/claim.d.ts.map +1 -0
- package/dist/shell/commands/claim.js +197 -0
- package/dist/shell/commands/claim.js.map +1 -0
- package/dist/shell/commands/doctor.d.ts +13 -0
- package/dist/shell/commands/doctor.d.ts.map +1 -0
- package/dist/shell/commands/doctor.js +97 -0
- package/dist/shell/commands/doctor.js.map +1 -0
- package/dist/shell/commands/evidence.d.ts +28 -0
- package/dist/shell/commands/evidence.d.ts.map +1 -0
- package/dist/shell/commands/evidence.js +166 -0
- package/dist/shell/commands/evidence.js.map +1 -0
- package/dist/shell/commands/gates.d.ts +19 -0
- package/dist/shell/commands/gates.d.ts.map +1 -0
- package/dist/shell/commands/gates.js +181 -0
- package/dist/shell/commands/gates.js.map +1 -0
- package/dist/shell/commands/init.d.ts +8 -0
- package/dist/shell/commands/init.d.ts.map +1 -0
- package/dist/shell/commands/init.js +64 -0
- package/dist/shell/commands/init.js.map +1 -0
- package/dist/shell/commands/scope.d.ts +11 -0
- package/dist/shell/commands/scope.d.ts.map +1 -0
- package/dist/shell/commands/scope.js +92 -0
- package/dist/shell/commands/scope.js.map +1 -0
- package/dist/shell/commands/status.d.ts +15 -0
- package/dist/shell/commands/status.d.ts.map +1 -0
- package/dist/shell/commands/status.js +106 -0
- package/dist/shell/commands/status.js.map +1 -0
- package/dist/shell/commands/waiver.d.ts +38 -0
- package/dist/shell/commands/waiver.d.ts.map +1 -0
- package/dist/shell/commands/waiver.js +240 -0
- package/dist/shell/commands/waiver.js.map +1 -0
- package/dist/shell/gates/disposition.d.ts +23 -0
- package/dist/shell/gates/disposition.d.ts.map +1 -0
- package/dist/shell/gates/disposition.js +87 -0
- package/dist/shell/gates/disposition.js.map +1 -0
- package/dist/shell/gates/gate-result-contract.d.ts +39 -0
- package/dist/shell/gates/gate-result-contract.d.ts.map +1 -0
- package/dist/shell/gates/gate-result-contract.js +150 -0
- package/dist/shell/gates/gate-result-contract.js.map +1 -0
- package/dist/shell/gates/quality-gates-adapter.d.ts +55 -0
- package/dist/shell/gates/quality-gates-adapter.d.ts.map +1 -0
- package/dist/shell/gates/quality-gates-adapter.js +161 -0
- package/dist/shell/gates/quality-gates-adapter.js.map +1 -0
- package/dist/shell/gates/waiver-filter.d.ts +58 -0
- package/dist/shell/gates/waiver-filter.d.ts.map +1 -0
- package/dist/shell/gates/waiver-filter.js +119 -0
- package/dist/shell/gates/waiver-filter.js.map +1 -0
- package/dist/shell/index.d.ts +50 -0
- package/dist/shell/index.d.ts.map +1 -0
- package/dist/shell/index.js +73 -0
- package/dist/shell/index.js.map +1 -0
- package/dist/shell/register.d.ts +11 -0
- package/dist/shell/register.d.ts.map +1 -0
- package/dist/shell/register.js +274 -0
- package/dist/shell/register.js.map +1 -0
- package/dist/shell/render/claim.d.ts +22 -0
- package/dist/shell/render/claim.d.ts.map +1 -0
- package/dist/shell/render/claim.js +75 -0
- package/dist/shell/render/claim.js.map +1 -0
- package/dist/shell/render/decision.d.ts +15 -0
- package/dist/shell/render/decision.d.ts.map +1 -0
- package/dist/shell/render/decision.js +66 -0
- package/dist/shell/render/decision.js.map +1 -0
- package/dist/shell/render/diagnostic.d.ts +19 -0
- package/dist/shell/render/diagnostic.d.ts.map +1 -0
- package/dist/shell/render/diagnostic.js +76 -0
- package/dist/shell/render/diagnostic.js.map +1 -0
- package/dist/shell/render/finding.d.ts +15 -0
- package/dist/shell/render/finding.d.ts.map +1 -0
- package/dist/shell/render/finding.js +57 -0
- package/dist/shell/render/finding.js.map +1 -0
- package/dist/shell/render/gates.d.ts +3 -0
- package/dist/shell/render/gates.d.ts.map +1 -0
- package/dist/shell/render/gates.js +56 -0
- package/dist/shell/render/gates.js.map +1 -0
- package/dist/shell/render/init.d.ts +11 -0
- package/dist/shell/render/init.d.ts.map +1 -0
- package/dist/shell/render/init.js +32 -0
- package/dist/shell/render/init.js.map +1 -0
- package/dist/shell/render/status.d.ts +26 -0
- package/dist/shell/render/status.d.ts.map +1 -0
- package/dist/shell/render/status.js +143 -0
- package/dist/shell/render/status.js.map +1 -0
- package/dist/shell/render/waiver.d.ts +21 -0
- package/dist/shell/render/waiver.d.ts.map +1 -0
- package/dist/shell/render/waiver.js +94 -0
- package/dist/shell/render/waiver.js.map +1 -0
- package/dist/shell/rules.d.ts +37 -0
- package/dist/shell/rules.d.ts.map +1 -0
- package/dist/shell/rules.js +51 -0
- package/dist/shell/rules.js.map +1 -0
- package/dist/shell/session/actor.d.ts +14 -0
- package/dist/shell/session/actor.d.ts.map +1 -0
- package/dist/shell/session/actor.js +34 -0
- package/dist/shell/session/actor.js.map +1 -0
- package/dist/shell/session/resolve-session.d.ts +5 -0
- package/dist/shell/session/resolve-session.d.ts.map +1 -0
- package/dist/shell/session/resolve-session.js +239 -0
- package/dist/shell/session/resolve-session.js.map +1 -0
- package/dist/shell/session/types.d.ts +56 -0
- package/dist/shell/session/types.d.ts.map +1 -0
- package/dist/shell/session/types.js +15 -0
- package/dist/shell/session/types.js.map +1 -0
- package/dist/store/agents-store.d.ts +3 -0
- package/dist/store/agents-store.d.ts.map +1 -0
- package/dist/store/agents-store.js +63 -0
- package/dist/store/agents-store.js.map +1 -0
- package/dist/store/apply-patch.d.ts +16 -0
- package/dist/store/apply-patch.d.ts.map +1 -0
- package/dist/store/apply-patch.js +191 -0
- package/dist/store/apply-patch.js.map +1 -0
- package/dist/store/atomic-write.d.ts +16 -0
- package/dist/store/atomic-write.d.ts.map +1 -0
- package/dist/store/atomic-write.js +132 -0
- package/dist/store/atomic-write.js.map +1 -0
- package/dist/store/doctor-snapshot.d.ts +20 -0
- package/dist/store/doctor-snapshot.d.ts.map +1 -0
- package/dist/store/doctor-snapshot.js +176 -0
- package/dist/store/doctor-snapshot.js.map +1 -0
- package/dist/store/events-store.d.ts +33 -0
- package/dist/store/events-store.d.ts.map +1 -0
- package/dist/store/events-store.js +297 -0
- package/dist/store/events-store.js.map +1 -0
- package/dist/store/index.d.ts +21 -0
- package/dist/store/index.d.ts.map +1 -0
- package/dist/store/index.js +47 -0
- package/dist/store/index.js.map +1 -0
- package/dist/store/init-store.d.ts +21 -0
- package/dist/store/init-store.d.ts.map +1 -0
- package/dist/store/init-store.js +295 -0
- package/dist/store/init-store.js.map +1 -0
- package/dist/store/json-store.d.ts +3 -0
- package/dist/store/json-store.d.ts.map +1 -0
- package/dist/store/json-store.js +65 -0
- package/dist/store/json-store.js.map +1 -0
- package/dist/store/policy-store.d.ts +3 -0
- package/dist/store/policy-store.d.ts.map +1 -0
- package/dist/store/policy-store.js +65 -0
- package/dist/store/policy-store.js.map +1 -0
- package/dist/store/repo-root.d.ts +46 -0
- package/dist/store/repo-root.d.ts.map +1 -0
- package/dist/store/repo-root.js +145 -0
- package/dist/store/repo-root.js.map +1 -0
- package/dist/store/rules.d.ts +53 -0
- package/dist/store/rules.d.ts.map +1 -0
- package/dist/store/rules.js +78 -0
- package/dist/store/rules.js.map +1 -0
- package/dist/store/specs-store.d.ts +3 -0
- package/dist/store/specs-store.d.ts.map +1 -0
- package/dist/store/specs-store.js +131 -0
- package/dist/store/specs-store.js.map +1 -0
- package/dist/store/types.d.ts +84 -0
- package/dist/store/types.d.ts.map +1 -0
- package/dist/store/types.js +14 -0
- package/dist/store/types.js.map +1 -0
- package/dist/store/waivers-store.d.ts +25 -0
- package/dist/store/waivers-store.d.ts.map +1 -0
- package/dist/store/waivers-store.js +232 -0
- package/dist/store/waivers-store.js.map +1 -0
- package/dist/store/worktrees-store.d.ts +3 -0
- package/dist/store/worktrees-store.d.ts.map +1 -0
- package/dist/store/worktrees-store.js +62 -0
- package/dist/store/worktrees-store.js.map +1 -0
- package/dist/store/yaml-store.d.ts +9 -0
- package/dist/store/yaml-store.d.ts.map +1 -0
- package/dist/store/yaml-store.js +121 -0
- package/dist/store/yaml-store.js.map +1 -0
- package/package.json +15 -13
- package/dist/budget-derivation.js +0 -751
- package/dist/cicd-optimizer.js +0 -504
- package/dist/commands/agents.js +0 -124
- package/dist/commands/archive.js +0 -500
- package/dist/commands/burnup.js +0 -198
- package/dist/commands/diagnose.js +0 -525
- package/dist/commands/evaluate.js +0 -314
- package/dist/commands/gates.js +0 -149
- package/dist/commands/init.js +0 -857
- package/dist/commands/iterate.js +0 -417
- package/dist/commands/mode.js +0 -269
- package/dist/commands/parallel.js +0 -242
- package/dist/commands/plan.js +0 -438
- package/dist/commands/provenance.js +0 -1143
- package/dist/commands/quality-monitor.js +0 -284
- package/dist/commands/scope.js +0 -264
- package/dist/commands/session.js +0 -312
- package/dist/commands/sidecar.js +0 -74
- package/dist/commands/specs.js +0 -1656
- package/dist/commands/status.js +0 -1172
- package/dist/commands/templates.js +0 -237
- package/dist/commands/tool.js +0 -136
- package/dist/commands/tutorial.js +0 -480
- package/dist/commands/validate.js +0 -357
- package/dist/commands/verify-acs.js +0 -443
- package/dist/commands/waivers.js +0 -599
- package/dist/commands/workflow.js +0 -243
- package/dist/commands/worktree.js +0 -502
- package/dist/config/lite-scope.js +0 -158
- package/dist/config/modes.js +0 -347
- package/dist/constants/spec-types.js +0 -65
- package/dist/gates/budget-limit.js +0 -121
- package/dist/gates/feedback.js +0 -260
- package/dist/gates/format.js +0 -179
- package/dist/gates/god-object.js +0 -117
- package/dist/gates/pipeline.js +0 -167
- package/dist/gates/scope-boundary.js +0 -112
- package/dist/gates/spec-completeness.js +0 -109
- package/dist/gates/todo-detection.js +0 -205
- package/dist/generators/jest-config-generator.js +0 -242
- package/dist/generators/working-spec.js +0 -237
- package/dist/minimal-cli.js +0 -88
- package/dist/parallel/parallel-manager.js +0 -433
- package/dist/policy/PolicyManager.js +0 -470
- package/dist/scaffold/claude-hooks.js +0 -443
- package/dist/scaffold/cursor-hooks.js +0 -177
- package/dist/scaffold/git-hooks.js +0 -928
- package/dist/scaffold/index.js +0 -794
- package/dist/session/session-manager.js +0 -653
- package/dist/sidecars/index.js +0 -33
- package/dist/sidecars/listeners.js +0 -40
- package/dist/sidecars/provenance-summary.js +0 -238
- package/dist/sidecars/quality-gaps.js +0 -258
- package/dist/sidecars/schema.js +0 -149
- package/dist/sidecars/spec-drift.js +0 -151
- package/dist/sidecars/waiver-draft.js +0 -176
- package/dist/spec/SpecFileManager.js +0 -419
- package/dist/templates/.caws/schemas/policy.schema.json +0 -117
- package/dist/templates/.caws/schemas/scope.schema.json +0 -52
- package/dist/templates/.caws/schemas/waivers.schema.json +0 -106
- package/dist/templates/.caws/schemas/working-spec.schema.json +0 -340
- package/dist/templates/.caws/schemas/worktrees.schema.json +0 -38
- package/dist/templates/.caws/templates/working-spec.template.yml +0 -80
- package/dist/templates/.caws/tools/README.md +0 -18
- package/dist/templates/.caws/tools/scope-guard.js +0 -203
- package/dist/templates/.caws/tools-allow.json +0 -331
- package/dist/templates/.caws/waivers.yml +0 -19
- package/dist/templates/.claude/README.md +0 -190
- package/dist/templates/.claude/hooks/audit.sh +0 -121
- package/dist/templates/.claude/hooks/block-dangerous.sh +0 -203
- package/dist/templates/.claude/hooks/classify_command.py +0 -592
- package/dist/templates/.claude/hooks/doc-frontmatter-check.sh +0 -173
- package/dist/templates/.claude/hooks/lite-sprawl-check.sh +0 -145
- package/dist/templates/.claude/hooks/naming-check.sh +0 -100
- package/dist/templates/.claude/hooks/protected-paths.sh +0 -39
- package/dist/templates/.claude/hooks/quality-check.sh +0 -81
- package/dist/templates/.claude/hooks/scan-secrets.sh +0 -85
- package/dist/templates/.claude/hooks/scope-guard.sh +0 -381
- package/dist/templates/.claude/hooks/session-caws-status.sh +0 -117
- package/dist/templates/.claude/hooks/session-log.sh +0 -634
- package/dist/templates/.claude/hooks/simplification-guard.sh +0 -92
- package/dist/templates/.claude/hooks/stop-worktree-check.sh +0 -46
- package/dist/templates/.claude/hooks/test_classify_command.py +0 -370
- package/dist/templates/.claude/hooks/test_wrapper_smoke.sh +0 -96
- package/dist/templates/.claude/hooks/validate-spec.sh +0 -76
- package/dist/templates/.claude/hooks/worktree-guard.sh +0 -220
- package/dist/templates/.claude/hooks/worktree-write-guard.sh +0 -190
- package/dist/templates/.claude/rules/git-safety.md +0 -26
- package/dist/templates/.claude/rules/worktree-isolation.md +0 -101
- package/dist/templates/.claude/settings.json +0 -141
- package/dist/templates/.cursor/README.md +0 -299
- package/dist/templates/.cursor/hooks/audit.sh +0 -55
- package/dist/templates/.cursor/hooks/block-dangerous.sh +0 -84
- package/dist/templates/.cursor/hooks/caws-quality-check.sh +0 -52
- package/dist/templates/.cursor/hooks/caws-scope-guard.sh +0 -130
- package/dist/templates/.cursor/hooks/format.sh +0 -38
- package/dist/templates/.cursor/hooks/naming-check.sh +0 -64
- package/dist/templates/.cursor/hooks/scan-secrets.sh +0 -51
- package/dist/templates/.cursor/hooks/scope-guard.sh +0 -52
- package/dist/templates/.cursor/hooks/session-log.sh +0 -924
- package/dist/templates/.cursor/hooks/validate-spec.sh +0 -83
- package/dist/templates/.cursor/hooks.json +0 -76
- package/dist/templates/.cursor/rules/00-claims-verification.mdc +0 -144
- package/dist/templates/.cursor/rules/01-working-style.mdc +0 -50
- package/dist/templates/.cursor/rules/02-quality-gates.mdc +0 -368
- package/dist/templates/.cursor/rules/03-naming-and-refactor.mdc +0 -33
- package/dist/templates/.cursor/rules/04-logging-language-style.mdc +0 -23
- package/dist/templates/.cursor/rules/05-safe-defaults-guards.mdc +0 -23
- package/dist/templates/.cursor/rules/06-typescript-conventions.mdc +0 -36
- package/dist/templates/.cursor/rules/07-process-ops.mdc +0 -20
- package/dist/templates/.cursor/rules/08-solid-and-architecture.mdc +0 -16
- package/dist/templates/.cursor/rules/09-docstrings.mdc +0 -89
- package/dist/templates/.cursor/rules/10-documentation-quality-standards.mdc +0 -385
- package/dist/templates/.cursor/rules/11-scope-management-waivers.mdc +0 -381
- package/dist/templates/.cursor/rules/12-implementation-completeness.mdc +0 -516
- package/dist/templates/.cursor/rules/13-language-agnostic-standards.mdc +0 -578
- package/dist/templates/.cursor/rules/README.md +0 -148
- package/dist/templates/.github/copilot-instructions.md +0 -82
- package/dist/templates/.idea/runConfigurations/CAWS_Evaluate.xml +0 -5
- package/dist/templates/.idea/runConfigurations/CAWS_Validate.xml +0 -5
- package/dist/templates/.junie/guidelines.md +0 -73
- package/dist/templates/.vscode/launch.json +0 -17
- package/dist/templates/.vscode/settings.json +0 -95
- package/dist/templates/.windsurf/rules/caws-quality-standards.md +0 -54
- package/dist/templates/.windsurf/workflows/caws-guided-development.md +0 -92
- package/dist/templates/CLAUDE.md +0 -196
- package/dist/templates/COMMIT_CONVENTIONS.md +0 -86
- package/dist/templates/OIDC_SETUP.md +0 -300
- package/dist/templates/agents.md +0 -171
- package/dist/templates/codemod/README.md +0 -1
- package/dist/templates/codemod/test.js +0 -93
- package/dist/templates/docs/README.md +0 -151
- package/dist/templates/scripts/new_feature.sh +0 -80
- package/dist/templates/scripts/quality-gates/check-god-objects.js +0 -146
- package/dist/templates/scripts/quality-gates/run-quality-gates.js +0 -50
- package/dist/templates/scripts/v3/analysis/todo_analyzer.py +0 -1997
- package/dist/test-analysis.js +0 -786
- package/dist/tool-interface.js +0 -314
- package/dist/tool-loader.js +0 -303
- package/dist/tool-validator.js +0 -393
- package/dist/utils/agent-display.js +0 -210
- package/dist/utils/agent-session.js +0 -344
- package/dist/utils/async-utils.js +0 -188
- package/dist/utils/command-wrapper.js +0 -200
- package/dist/utils/event-log.js +0 -584
- package/dist/utils/event-renderer.js +0 -521
- package/dist/utils/finalization.js +0 -230
- package/dist/utils/git-lock.js +0 -119
- package/dist/utils/gitignore-updater.js +0 -158
- package/dist/utils/ide-detection.js +0 -133
- package/dist/utils/lifecycle-events.js +0 -94
- package/dist/utils/project-analysis.js +0 -367
- package/dist/utils/promise-utils.js +0 -72
- package/dist/utils/quality-gates-errors.js +0 -520
- package/dist/utils/quality-gates-utils.js +0 -387
- package/dist/utils/schema-validator.js +0 -50
- package/dist/utils/spec-resolver.js +0 -711
- package/dist/utils/typescript-detector.js +0 -369
- package/dist/utils/working-state.js +0 -530
- package/dist/utils/yaml-validation.js +0 -156
- package/dist/validation/spec-validation.js +0 -924
- package/dist/waivers-manager.js +0 -732
- package/dist/worktree/worktree-manager.js +0 -1735
- package/templates/.caws/schemas/policy.schema.json +0 -117
- package/templates/.caws/schemas/scope.schema.json +0 -52
- package/templates/.caws/schemas/waivers.schema.json +0 -106
- package/templates/.caws/schemas/working-spec.schema.json +0 -340
- package/templates/.caws/schemas/worktrees.schema.json +0 -38
- package/templates/.caws/templates/working-spec.template.yml +0 -80
- package/templates/.caws/tools/README.md +0 -18
- package/templates/.caws/tools/scope-guard.js +0 -203
- package/templates/.caws/tools-allow.json +0 -331
- package/templates/.caws/waivers.yml +0 -19
- package/templates/.claude/README.md +0 -190
- package/templates/.claude/hooks/audit.sh +0 -121
- package/templates/.claude/hooks/block-dangerous.sh +0 -203
- package/templates/.claude/hooks/classify_command.py +0 -592
- package/templates/.claude/hooks/doc-frontmatter-check.sh +0 -173
- package/templates/.claude/hooks/lite-sprawl-check.sh +0 -145
- package/templates/.claude/hooks/naming-check.sh +0 -100
- package/templates/.claude/hooks/protected-paths.sh +0 -39
- package/templates/.claude/hooks/quality-check.sh +0 -81
- package/templates/.claude/hooks/scan-secrets.sh +0 -85
- package/templates/.claude/hooks/scope-guard.sh +0 -381
- package/templates/.claude/hooks/session-caws-status.sh +0 -117
- package/templates/.claude/hooks/session-log.sh +0 -634
- package/templates/.claude/hooks/simplification-guard.sh +0 -92
- package/templates/.claude/hooks/stop-worktree-check.sh +0 -46
- package/templates/.claude/hooks/test_classify_command.py +0 -370
- package/templates/.claude/hooks/test_wrapper_smoke.sh +0 -96
- package/templates/.claude/hooks/validate-spec.sh +0 -76
- package/templates/.claude/hooks/worktree-guard.sh +0 -220
- package/templates/.claude/hooks/worktree-write-guard.sh +0 -190
- package/templates/.claude/rules/git-safety.md +0 -26
- package/templates/.claude/rules/worktree-isolation.md +0 -101
- package/templates/.claude/settings.json +0 -141
- package/templates/.cursor/README.md +0 -299
- package/templates/.cursor/hooks/audit.sh +0 -55
- package/templates/.cursor/hooks/block-dangerous.sh +0 -84
- package/templates/.cursor/hooks/caws-quality-check.sh +0 -52
- package/templates/.cursor/hooks/caws-scope-guard.sh +0 -130
- package/templates/.cursor/hooks/format.sh +0 -38
- package/templates/.cursor/hooks/naming-check.sh +0 -64
- package/templates/.cursor/hooks/scan-secrets.sh +0 -51
- package/templates/.cursor/hooks/scope-guard.sh +0 -52
- package/templates/.cursor/hooks/session-log.sh +0 -924
- package/templates/.cursor/hooks/validate-spec.sh +0 -83
- package/templates/.cursor/hooks.json +0 -76
- package/templates/.cursor/rules/00-claims-verification.mdc +0 -144
- package/templates/.cursor/rules/01-working-style.mdc +0 -50
- package/templates/.cursor/rules/02-quality-gates.mdc +0 -368
- package/templates/.cursor/rules/03-naming-and-refactor.mdc +0 -33
- package/templates/.cursor/rules/04-logging-language-style.mdc +0 -23
- package/templates/.cursor/rules/05-safe-defaults-guards.mdc +0 -23
- package/templates/.cursor/rules/06-typescript-conventions.mdc +0 -36
- package/templates/.cursor/rules/07-process-ops.mdc +0 -20
- package/templates/.cursor/rules/08-solid-and-architecture.mdc +0 -16
- package/templates/.cursor/rules/09-docstrings.mdc +0 -89
- package/templates/.cursor/rules/10-documentation-quality-standards.mdc +0 -385
- package/templates/.cursor/rules/11-scope-management-waivers.mdc +0 -381
- package/templates/.cursor/rules/12-implementation-completeness.mdc +0 -516
- package/templates/.cursor/rules/13-language-agnostic-standards.mdc +0 -578
- package/templates/.cursor/rules/README.md +0 -148
- package/templates/.github/copilot-instructions.md +0 -82
- package/templates/.idea/runConfigurations/CAWS_Evaluate.xml +0 -5
- package/templates/.idea/runConfigurations/CAWS_Validate.xml +0 -5
- package/templates/.junie/guidelines.md +0 -73
- package/templates/.vscode/launch.json +0 -17
- package/templates/.vscode/settings.json +0 -95
- package/templates/.windsurf/rules/caws-quality-standards.md +0 -54
- package/templates/.windsurf/workflows/caws-guided-development.md +0 -92
- package/templates/CLAUDE.md +0 -196
- package/templates/COMMIT_CONVENTIONS.md +0 -86
- package/templates/OIDC_SETUP.md +0 -300
- package/templates/agents.md +0 -171
- package/templates/codemod/README.md +0 -1
- package/templates/codemod/test.js +0 -93
- package/templates/docs/README.md +0 -151
- package/templates/scripts/new_feature.sh +0 -80
- package/templates/scripts/quality-gates/check-god-objects.js +0 -146
- package/templates/scripts/quality-gates/run-quality-gates.js +0 -50
- package/templates/scripts/v3/analysis/todo_analyzer.py +0 -1997
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { GitWorktreeEntry, ResolveBindingInput, ResolvedBinding } from './types';
|
|
2
|
+
export declare function parseWorktreePorcelain(text: string): readonly GitWorktreeEntry[];
|
|
3
|
+
export declare function resolveBinding(input: ResolveBindingInput): ResolvedBinding;
|
|
4
|
+
//# sourceMappingURL=resolve-binding.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve-binding.d.ts","sourceRoot":"","sources":["../../../src/shell/binding/resolve-binding.ts"],"names":[],"mappings":"AA6BA,OAAO,KAAK,EACV,gBAAgB,EAChB,mBAAmB,EACnB,eAAe,EAChB,MAAM,SAAS,CAAC;AA0BjB,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,gBAAgB,EAAE,CAqChF;AA6BD,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,GAAG,eAAe,CA2F1E"}
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// resolve-binding — turn (repoRoot, cwd, registry, specsBySpecId) into a
|
|
3
|
+
// `BindingState` plus a worktree-name resolution provenance.
|
|
4
|
+
//
|
|
5
|
+
// Algorithm:
|
|
6
|
+
//
|
|
7
|
+
// 1. Real-resolve repoRoot and cwd. macOS /tmp ↔ /private/tmp matters.
|
|
8
|
+
// 2. If cwd is the repoRoot (or a descendant that is NOT inside any
|
|
9
|
+
// worktree path), we are NOT in a tracked worktree → `unbound`.
|
|
10
|
+
// 3. Walk worktrees.json entries with a recorded `path`. Pick the entry
|
|
11
|
+
// whose realpath(path) is cwd or an ancestor of cwd. (Multiple matches
|
|
12
|
+
// would be a registry conflict; we take the deepest match, with a
|
|
13
|
+
// stable tiebreak by name.)
|
|
14
|
+
// 4. If no registry entry matches, fall back to `git worktree list
|
|
15
|
+
// --porcelain` to find the worktree path containing cwd, then look up
|
|
16
|
+
// that path in the registry. If still no match: `unbound`.
|
|
17
|
+
// 5. With a worktree name in hand, look up the bound spec by following
|
|
18
|
+
// registry.specId → spec. If the spec exists, hand the Spec +
|
|
19
|
+
// registry + name to kernel `deriveBindingState`. If not, synthesize
|
|
20
|
+
// an `unbound` (and emit a one-sided shape if the registry has a
|
|
21
|
+
// specId pointing at something that didn't load).
|
|
22
|
+
//
|
|
23
|
+
// The shell NEVER uses `basename(cwd)` to invent a worktree name.
|
|
24
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
25
|
+
if (k2 === undefined) k2 = k;
|
|
26
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
27
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
28
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
29
|
+
}
|
|
30
|
+
Object.defineProperty(o, k2, desc);
|
|
31
|
+
}) : (function(o, m, k, k2) {
|
|
32
|
+
if (k2 === undefined) k2 = k;
|
|
33
|
+
o[k2] = m[k];
|
|
34
|
+
}));
|
|
35
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
36
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
37
|
+
}) : function(o, v) {
|
|
38
|
+
o["default"] = v;
|
|
39
|
+
});
|
|
40
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
41
|
+
var ownKeys = function(o) {
|
|
42
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
43
|
+
var ar = [];
|
|
44
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
45
|
+
return ar;
|
|
46
|
+
};
|
|
47
|
+
return ownKeys(o);
|
|
48
|
+
};
|
|
49
|
+
return function (mod) {
|
|
50
|
+
if (mod && mod.__esModule) return mod;
|
|
51
|
+
var result = {};
|
|
52
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
53
|
+
__setModuleDefault(result, mod);
|
|
54
|
+
return result;
|
|
55
|
+
};
|
|
56
|
+
})();
|
|
57
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
58
|
+
exports.parseWorktreePorcelain = parseWorktreePorcelain;
|
|
59
|
+
exports.resolveBinding = resolveBinding;
|
|
60
|
+
const fs = __importStar(require("node:fs"));
|
|
61
|
+
const path = __importStar(require("node:path"));
|
|
62
|
+
const node_child_process_1 = require("node:child_process");
|
|
63
|
+
const caws_kernel_1 = require("@paths.design/caws-kernel");
|
|
64
|
+
function safeRealpath(p) {
|
|
65
|
+
try {
|
|
66
|
+
return fs.realpathSync(p);
|
|
67
|
+
}
|
|
68
|
+
catch {
|
|
69
|
+
return p;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
function isAncestorOrEqual(maybeAncestor, descendant) {
|
|
73
|
+
if (maybeAncestor === descendant)
|
|
74
|
+
return true;
|
|
75
|
+
const withSep = maybeAncestor.endsWith(path.sep)
|
|
76
|
+
? maybeAncestor
|
|
77
|
+
: maybeAncestor + path.sep;
|
|
78
|
+
return descendant.startsWith(withSep);
|
|
79
|
+
}
|
|
80
|
+
function defaultGitWorktreeList(repoRoot) {
|
|
81
|
+
const r = (0, node_child_process_1.spawnSync)('git', ['-C', repoRoot, 'worktree', 'list', '--porcelain'], {
|
|
82
|
+
encoding: 'utf8',
|
|
83
|
+
});
|
|
84
|
+
if (r.status !== 0 || typeof r.stdout !== 'string')
|
|
85
|
+
return [];
|
|
86
|
+
return parseWorktreePorcelain(r.stdout);
|
|
87
|
+
}
|
|
88
|
+
function parseWorktreePorcelain(text) {
|
|
89
|
+
const out = [];
|
|
90
|
+
let currentPath;
|
|
91
|
+
let currentBranch;
|
|
92
|
+
for (const line of text.split('\n')) {
|
|
93
|
+
if (line.startsWith('worktree ')) {
|
|
94
|
+
if (currentPath !== undefined) {
|
|
95
|
+
const entry = currentBranch !== undefined
|
|
96
|
+
? { path: currentPath, branch: currentBranch }
|
|
97
|
+
: { path: currentPath };
|
|
98
|
+
out.push(entry);
|
|
99
|
+
}
|
|
100
|
+
currentPath = line.slice('worktree '.length);
|
|
101
|
+
currentBranch = undefined;
|
|
102
|
+
}
|
|
103
|
+
else if (line.startsWith('branch ')) {
|
|
104
|
+
currentBranch = line.slice('branch '.length);
|
|
105
|
+
}
|
|
106
|
+
else if (line === '') {
|
|
107
|
+
if (currentPath !== undefined) {
|
|
108
|
+
const entry = currentBranch !== undefined
|
|
109
|
+
? { path: currentPath, branch: currentBranch }
|
|
110
|
+
: { path: currentPath };
|
|
111
|
+
out.push(entry);
|
|
112
|
+
currentPath = undefined;
|
|
113
|
+
currentBranch = undefined;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
if (currentPath !== undefined) {
|
|
118
|
+
const entry = currentBranch !== undefined
|
|
119
|
+
? { path: currentPath, branch: currentBranch }
|
|
120
|
+
: { path: currentPath };
|
|
121
|
+
out.push(entry);
|
|
122
|
+
}
|
|
123
|
+
return out;
|
|
124
|
+
}
|
|
125
|
+
function findRegistryMatch(cwdReal, registry) {
|
|
126
|
+
let best = null;
|
|
127
|
+
let bestDepth = -1;
|
|
128
|
+
for (const [name, record] of Object.entries(registry)) {
|
|
129
|
+
if (typeof record?.path !== 'string')
|
|
130
|
+
continue;
|
|
131
|
+
const recordReal = safeRealpath(record.path);
|
|
132
|
+
if (!isAncestorOrEqual(recordReal, cwdReal))
|
|
133
|
+
continue;
|
|
134
|
+
const depth = recordReal.split(path.sep).length;
|
|
135
|
+
if (depth > bestDepth ||
|
|
136
|
+
(depth === bestDepth && best !== null && name < best.name)) {
|
|
137
|
+
best = { name, path: recordReal };
|
|
138
|
+
bestDepth = depth;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
return best;
|
|
142
|
+
}
|
|
143
|
+
function resolveBinding(input) {
|
|
144
|
+
const cwdReal = safeRealpath(input.cwd);
|
|
145
|
+
const repoRootReal = safeRealpath(input.repoRoot);
|
|
146
|
+
// If cwd is exactly the repo root, we are in the main checkout. Walk the
|
|
147
|
+
// registry anyway in case a worktree was created at the repo root (rare,
|
|
148
|
+
// would imply specId === <main> binding). Otherwise this returns null.
|
|
149
|
+
let candidate = findRegistryMatch(cwdReal, input.registry);
|
|
150
|
+
let source = 'registry_path_match';
|
|
151
|
+
if (candidate === null) {
|
|
152
|
+
// Fallback: git porcelain. Find the worktree path containing cwd,
|
|
153
|
+
// then match that path against the registry.
|
|
154
|
+
const lister = input.gitWorktreeList ?? defaultGitWorktreeList;
|
|
155
|
+
const wts = lister(input.repoRoot);
|
|
156
|
+
let porcelainMatch = null;
|
|
157
|
+
let porcelainDepth = -1;
|
|
158
|
+
for (const wt of wts) {
|
|
159
|
+
const wtReal = safeRealpath(wt.path);
|
|
160
|
+
if (!isAncestorOrEqual(wtReal, cwdReal))
|
|
161
|
+
continue;
|
|
162
|
+
const depth = wtReal.split(path.sep).length;
|
|
163
|
+
if (depth > porcelainDepth) {
|
|
164
|
+
porcelainMatch = wt;
|
|
165
|
+
porcelainDepth = depth;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
if (porcelainMatch !== null) {
|
|
169
|
+
const porcelainReal = safeRealpath(porcelainMatch.path);
|
|
170
|
+
// Skip if porcelain match is the main checkout (no worktree binding).
|
|
171
|
+
if (porcelainReal !== repoRootReal) {
|
|
172
|
+
// Look up registry entry by path equality.
|
|
173
|
+
for (const [name, record] of Object.entries(input.registry)) {
|
|
174
|
+
if (typeof record?.path === 'string' &&
|
|
175
|
+
safeRealpath(record.path) === porcelainReal) {
|
|
176
|
+
candidate = { name, path: porcelainReal };
|
|
177
|
+
source = 'git_porcelain_match';
|
|
178
|
+
break;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
if (candidate === null) {
|
|
185
|
+
return { binding: { kind: 'unbound' }, source: 'none' };
|
|
186
|
+
}
|
|
187
|
+
// We have a worktree name. Now find the bound spec for kernel evaluation.
|
|
188
|
+
const record = input.registry[candidate.name];
|
|
189
|
+
const registrySpecId = record?.specId;
|
|
190
|
+
if (typeof registrySpecId !== 'string' || registrySpecId.length === 0) {
|
|
191
|
+
// Registry knows the worktree but no spec is linked. Neither side
|
|
192
|
+
// points at the other, so this is `unbound`, NOT `one_sided`.
|
|
193
|
+
// The repair is "bind this worktree to a spec", not "repair corrupt
|
|
194
|
+
// asymmetric binding". The downstream renderer keys off the
|
|
195
|
+
// worktreeName being set to distinguish "tracked worktree without
|
|
196
|
+
// spec" from "cwd outside any worktree".
|
|
197
|
+
return {
|
|
198
|
+
binding: { kind: 'unbound' },
|
|
199
|
+
worktreeName: candidate.name,
|
|
200
|
+
source,
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
// We have registrySpecId. Find the bound spec in the loaded specs list.
|
|
204
|
+
const boundSpec = input.specs.find((s) => s.id === registrySpecId);
|
|
205
|
+
if (boundSpec === undefined) {
|
|
206
|
+
// Registry points at a spec id that didn't load. From the kernel's
|
|
207
|
+
// perspective this is one-sided (registry has specId, spec missing).
|
|
208
|
+
return {
|
|
209
|
+
binding: {
|
|
210
|
+
kind: 'one_sided',
|
|
211
|
+
detail: {
|
|
212
|
+
specHasWorktree: false,
|
|
213
|
+
registryHasSpecId: true,
|
|
214
|
+
registrySpecId,
|
|
215
|
+
worktreeName: candidate.name,
|
|
216
|
+
},
|
|
217
|
+
},
|
|
218
|
+
worktreeName: candidate.name,
|
|
219
|
+
source,
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
return {
|
|
223
|
+
binding: (0, caws_kernel_1.deriveBindingState)(boundSpec, input.registry, candidate.name),
|
|
224
|
+
worktreeName: candidate.name,
|
|
225
|
+
source,
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
//# sourceMappingURL=resolve-binding.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve-binding.js","sourceRoot":"","sources":["../../../src/shell/binding/resolve-binding.ts"],"names":[],"mappings":";AAAA,yEAAyE;AACzE,6DAA6D;AAC7D,EAAE;AACF,aAAa;AACb,EAAE;AACF,yEAAyE;AACzE,sEAAsE;AACtE,qEAAqE;AACrE,0EAA0E;AAC1E,4EAA4E;AAC5E,uEAAuE;AACvE,iCAAiC;AACjC,qEAAqE;AACrE,2EAA2E;AAC3E,gEAAgE;AAChE,yEAAyE;AACzE,mEAAmE;AACnE,0EAA0E;AAC1E,sEAAsE;AACtE,uDAAuD;AACvD,EAAE;AACF,kEAAkE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsClE,wDAqCC;AA6BD,wCA2FC;AAjMD,4CAA8B;AAC9B,gDAAkC;AAClC,2DAA+C;AAE/C,2DAA+D;AAQ/D,SAAS,YAAY,CAAC,CAAS;IAC7B,IAAI,CAAC;QACH,OAAO,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;IAC5B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,CAAC,CAAC;IACX,C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MAAM,CAAC;IACtC,IAAI,OAAO,cAAc,KAAK,QAAQ,IAAI,cAAc,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACtE,kEAAkE;QAClE,8DAA8D;QAC9D,oEAAoE;QACpE,4DAA4D;QAC5D,kEAAkE;QAClE,yCAAyC;QACzC,OAAO;YACL,OAAO,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;YAC5B,YAAY,EAAE,SAAS,CAAC,IAAI;YAC5B,MAAM;SACP,CAAC;IACJ,CAAC;IAED,wEAAwE;IACxE,MAAM,SAAS,GAAG,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,cAAc,CAAC,CAAC;IACnE,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;QAC5B,mEAAmE;QACnE,qEAAqE;QACrE,OAAO;YACL,OAAO,EAAE;gBACP,IAAI,EAAE,WAAW;gBACjB,MAAM,EAAE;oBACN,eAAe,EAAE,KAAK;oBACtB,iBAAiB,EAAE,IAAI;oBACvB,cAAc;oBACd,YAAY,EAAE,SAAS,CAAC,IAAI;iBAC7B;aACF;YACD,YAAY,EAAE,SAAS,CAAC,IAAI;YAC5B,MAAM;SACP,CAAC;IACJ,CAAC;IAED,OAAO;QACL,OAAO,EAAE,IAAA,gCAAkB,EAAC,SAAS,EAAE,KAAK,CAAC,QAAQ,EAAE,SAAS,CAAC,IAAI,CAAC;QACtE,YAAY,EAAE,SAAS,CAAC,IAAI;QAC5B,MAAM;KACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { BindingState, Spec, WorktreeRegistry } from '@paths.design/caws-kernel';
|
|
2
|
+
export interface ResolveBindingInput {
|
|
3
|
+
/** Repo root (from store/repo-root.ts, --git-common-dir based). */
|
|
4
|
+
readonly repoRoot: string;
|
|
5
|
+
/** Current working directory the command was invoked from. */
|
|
6
|
+
readonly cwd: string;
|
|
7
|
+
/** Loaded `.caws/worktrees.json`. */
|
|
8
|
+
readonly registry: WorktreeRegistry;
|
|
9
|
+
/**
|
|
10
|
+
* Loaded valid specs. The resolver looks up the spec referenced by the
|
|
11
|
+
* registry entry's `specId`. If the spec is missing, the binding is
|
|
12
|
+
* reported as `one_sided`.
|
|
13
|
+
*/
|
|
14
|
+
readonly specs: readonly Spec[];
|
|
15
|
+
/**
|
|
16
|
+
* Optional pluggable git-worktree lookup, for tests. Receives `repoRoot`
|
|
17
|
+
* and returns a list of `{ name?, path }` entries OR `null` when git
|
|
18
|
+
* cannot be invoked. Production injects a real git runner.
|
|
19
|
+
*/
|
|
20
|
+
readonly gitWorktreeList?: (repoRoot: string) => readonly GitWorktreeEntry[];
|
|
21
|
+
}
|
|
22
|
+
export interface GitWorktreeEntry {
|
|
23
|
+
/** Absolute path of the worktree on disk. */
|
|
24
|
+
readonly path: string;
|
|
25
|
+
/** Branch name (may be `(detached)` or `refs/heads/<x>`). */
|
|
26
|
+
readonly branch?: string;
|
|
27
|
+
}
|
|
28
|
+
export interface ResolvedBinding {
|
|
29
|
+
/** The kernel's `BindingState`. */
|
|
30
|
+
readonly binding: BindingState;
|
|
31
|
+
/**
|
|
32
|
+
* The resolved worktree name, if any. `undefined` when cwd is in the main
|
|
33
|
+
* checkout (no worktree).
|
|
34
|
+
*/
|
|
35
|
+
readonly worktreeName?: string;
|
|
36
|
+
/**
|
|
37
|
+
* Where the worktree-name resolution came from. Helps explain `bound`
|
|
38
|
+
* vs `one_sided` decisions to the user.
|
|
39
|
+
*/
|
|
40
|
+
readonly source: 'registry_path_match' | 'git_porcelain_match' | 'none';
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/shell/binding/types.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EACV,YAAY,EACZ,IAAI,EACJ,gBAAgB,EACjB,MAAM,2BAA2B,CAAC;AAEnC,MAAM,WAAW,mBAAmB;IAClC,mEAAmE;IACnE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,8DAA8D;IAC9D,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,qCAAqC;IACrC,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,CAAC;IACpC;;;;OAIG;IACH,QAAQ,CAAC,KAAK,EAAE,SAAS,IAAI,EAAE,CAAC;IAChC;;;;OAIG;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,SAAS,gBAAgB,EAAE,CAAC;CAC9E;AAED,MAAM,WAAW,gBAAgB;IAC/B,6CAA6C;IAC7C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,6DAA6D;IAC7D,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,eAAe;IAC9B,mCAAmC;IACnC,QAAQ,CAAC,OAAO,EAAE,YAAY,CAAC;IAC/B;;;OAGG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B;;;OAGG;IACH,QAAQ,CAAC,MAAM,EAAE,qBAAqB,GAAG,qBAAqB,GAAG,MAAM,CAAC;CACzE"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Types for cwd → worktree binding resolution.
|
|
3
|
+
//
|
|
4
|
+
// The shell turns a `(repoRoot, cwd, worktreesRegistry, specs)` tuple into
|
|
5
|
+
// one of three terminal states:
|
|
6
|
+
//
|
|
7
|
+
// - `bound`: cwd is inside a worktree that is bidirectionally bound
|
|
8
|
+
// to a spec (registry.specId === spec.worktree === name).
|
|
9
|
+
// - `one_sided`: cwd is inside a worktree whose binding is partial. The
|
|
10
|
+
// shell reports this verbatim from the kernel; it is NOT
|
|
11
|
+
// authority.
|
|
12
|
+
// - `unbound`: cwd is not inside a CAWS-tracked worktree (or is inside
|
|
13
|
+
// the main checkout). Hooks treat this as no-authority
|
|
14
|
+
// for write-class operations.
|
|
15
|
+
//
|
|
16
|
+
// The shell never derives worktree name from `basename(cwd)`. Authority
|
|
17
|
+
// flows from the registry's recorded `path` field (or a git-worktree
|
|
18
|
+
// porcelain lookup as a deterministic fallback), never from the
|
|
19
|
+
// filesystem layout alone.
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/shell/binding/types.ts"],"names":[],"mappings":";AAAA,+CAA+C;AAC/C,EAAE;AACF,2EAA2E;AAC3E,gCAAgC;AAChC,EAAE;AACF,2EAA2E;AAC3E,4EAA4E;AAC5E,2EAA2E;AAC3E,2EAA2E;AAC3E,+BAA+B;AAC/B,4EAA4E;AAC5E,yEAAyE;AACzE,gDAAgD;AAChD,EAAE;AACF,wEAAwE;AACxE,qEAAqE;AACrE,gEAAgE;AAChE,2BAA2B"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface ClaimCommandOptions {
|
|
2
|
+
readonly takeover?: boolean;
|
|
3
|
+
readonly cwd?: string;
|
|
4
|
+
readonly now?: () => Date;
|
|
5
|
+
readonly env?: NodeJS.ProcessEnv;
|
|
6
|
+
readonly out?: (line: string) => void;
|
|
7
|
+
readonly err?: (line: string) => void;
|
|
8
|
+
/** Heartbeat-stale TTL in ms; display only. Default 24h. */
|
|
9
|
+
readonly staleTtlMs?: number;
|
|
10
|
+
/** Show optional `data` block on rendered diagnostics. */
|
|
11
|
+
readonly showData?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export declare function runClaimCommand(opts?: ClaimCommandOptions): number;
|
|
14
|
+
//# sourceMappingURL=claim.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claim.d.ts","sourceRoot":"","sources":["../../../src/shell/commands/claim.ts"],"names":[],"mappings":"AAwDA,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IACjC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,4DAA4D;IAC5D,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,0DAA0D;IAC1D,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED,wBAAgB,eAAe,CAAC,IAAI,GAAE,mBAAwB,GAAG,MAAM,CA0KtE"}
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// `caws claim [--takeover]` — surface and (optionally) acquire ownership
|
|
3
|
+
// of the current worktree.
|
|
4
|
+
//
|
|
5
|
+
// Pipeline:
|
|
6
|
+
// 1. resolveRepoRoot(cwd)
|
|
7
|
+
// 2. composeStoreSnapshot (worktrees + agents + specs)
|
|
8
|
+
// 3. resolveSession({ allowMint: true }) — write op, mints if needed
|
|
9
|
+
// 4. resolveBinding(cwd, registry, specs) — identify the worktree
|
|
10
|
+
// 5. kernel.assertOwnership(registry, name, session, { takeover }, now)
|
|
11
|
+
// → Ok(null) — same-session, no patch
|
|
12
|
+
// → Ok(takeover_claim) — foreign + --takeover; prior_owners audit
|
|
13
|
+
// → Err — foreign without --takeover, OR unowned
|
|
14
|
+
// (unowned is a soft block; caller must use
|
|
15
|
+
// `caws worktree create`/`bind` to mint)
|
|
16
|
+
// 6. If a patch was returned, applyRegistryPatch (atomic write to
|
|
17
|
+
// worktrees.json). prior_owners is append-only.
|
|
18
|
+
// 7. ALWAYS refresh agents.json freshness for the current session
|
|
19
|
+
// via kernel.refreshAgentClaim → applyRegistryPatch.
|
|
20
|
+
// 8. Render the Claim panel.
|
|
21
|
+
//
|
|
22
|
+
// Exit codes:
|
|
23
|
+
// 0 = ownership is established for the current session (same-session
|
|
24
|
+
// Ok or successful takeover)
|
|
25
|
+
// 1 = foreign owner without --takeover, or unowned worktree, or kernel
|
|
26
|
+
// refused for any reason
|
|
27
|
+
// 2 = repo-root / session / store composition failure, or cwd is not
|
|
28
|
+
// inside a tracked worktree
|
|
29
|
+
//
|
|
30
|
+
// Authority discipline (load-bearing):
|
|
31
|
+
// - worktrees.json[name].owner is the SOLE ownership authority.
|
|
32
|
+
// - agents.json last-active is freshness/display only.
|
|
33
|
+
// - Stale heartbeat is NOT abandonment.
|
|
34
|
+
// - prior_owners is unbounded, append-only on takeover.
|
|
35
|
+
//
|
|
36
|
+
// Event emission is OUT OF SCOPE for 6a. The `claim_taken_over` event
|
|
37
|
+
// type exists in the kernel schema, but emitting it requires deciding
|
|
38
|
+
// the exact payload shape, and that decision belongs with the broader
|
|
39
|
+
// claim/worktree event work in a later slice. Same-session refresh
|
|
40
|
+
// emits nothing.
|
|
41
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
+
exports.runClaimCommand = runClaimCommand;
|
|
43
|
+
const caws_kernel_1 = require("@paths.design/caws-kernel");
|
|
44
|
+
const store_1 = require("../../store");
|
|
45
|
+
const resolve_binding_1 = require("../binding/resolve-binding");
|
|
46
|
+
const claim_1 = require("../render/claim");
|
|
47
|
+
const diagnostic_1 = require("../render/diagnostic");
|
|
48
|
+
const resolve_session_1 = require("../session/resolve-session");
|
|
49
|
+
function runClaimCommand(opts = {}) {
|
|
50
|
+
const cwd = opts.cwd ?? process.cwd();
|
|
51
|
+
const nowFn = opts.now ?? (() => new Date());
|
|
52
|
+
const env = opts.env ?? process.env;
|
|
53
|
+
const out = opts.out ?? ((s) => process.stdout.write(s + '\n'));
|
|
54
|
+
const err = opts.err ?? ((s) => process.stderr.write(s + '\n'));
|
|
55
|
+
const showData = opts.showData === true;
|
|
56
|
+
const wantsTakeover = opts.takeover === true;
|
|
57
|
+
// 1. Repo root.
|
|
58
|
+
const repoRootResult = (0, store_1.resolveRepoRoot)(cwd);
|
|
59
|
+
if (!repoRootResult.ok) {
|
|
60
|
+
err('caws claim: failed to resolve repo root.');
|
|
61
|
+
err((0, diagnostic_1.renderDiagnostics)(repoRootResult.errors, { showData }));
|
|
62
|
+
return 2;
|
|
63
|
+
}
|
|
64
|
+
const { repoRoot, cawsDir } = repoRootResult.value;
|
|
65
|
+
// 2. Snapshot (we want both worktrees AND agents).
|
|
66
|
+
let snapshot;
|
|
67
|
+
try {
|
|
68
|
+
snapshot = (0, store_1.composeStoreSnapshot)({ repoRoot, cawsDir });
|
|
69
|
+
}
|
|
70
|
+
catch (e) {
|
|
71
|
+
err(`caws claim: store composition failed: ${e.message}`);
|
|
72
|
+
return 2;
|
|
73
|
+
}
|
|
74
|
+
// 3. Session (write op → mint if missing).
|
|
75
|
+
const sessionResult = (0, resolve_session_1.resolveSession)({
|
|
76
|
+
cawsDir,
|
|
77
|
+
worktreeRoot: cwd,
|
|
78
|
+
env,
|
|
79
|
+
now: nowFn,
|
|
80
|
+
allowMint: true,
|
|
81
|
+
});
|
|
82
|
+
if (!sessionResult.ok) {
|
|
83
|
+
err('caws claim: failed to resolve session identity.');
|
|
84
|
+
err((0, diagnostic_1.renderDiagnostics)(sessionResult.errors, { showData }));
|
|
85
|
+
return 2;
|
|
86
|
+
}
|
|
87
|
+
const session = sessionResult.value.identity;
|
|
88
|
+
// 4. Binding from cwd.
|
|
89
|
+
const bound = (0, resolve_binding_1.resolveBinding)({
|
|
90
|
+
repoRoot,
|
|
91
|
+
cwd,
|
|
92
|
+
registry: snapshot.worktrees,
|
|
93
|
+
specs: snapshot.specs,
|
|
94
|
+
});
|
|
95
|
+
if (bound.worktreeName === undefined) {
|
|
96
|
+
err('caws claim: cwd is not inside a CAWS-tracked worktree. ' +
|
|
97
|
+
'v11.0.0 does not ship worktree lifecycle commands; create the ' +
|
|
98
|
+
'worktree externally (git worktree add) and register it via ' +
|
|
99
|
+
'a future `caws worktree` command (planned for v11.1). To use ' +
|
|
100
|
+
'lifecycle commands today, pin to caws-cli@^10.2.x.');
|
|
101
|
+
return 2;
|
|
102
|
+
}
|
|
103
|
+
const worktreeName = bound.worktreeName;
|
|
104
|
+
const record = snapshot.worktrees[worktreeName];
|
|
105
|
+
if (record === undefined) {
|
|
106
|
+
// This should not happen if resolveBinding said we are in a tracked
|
|
107
|
+
// worktree — but be defensive: if the registry lost the entry
|
|
108
|
+
// between the bound resolution and now, treat as a composition error.
|
|
109
|
+
err(`caws claim: worktree '${worktreeName}' not in worktrees.json (registry race).`);
|
|
110
|
+
return 2;
|
|
111
|
+
}
|
|
112
|
+
// 5. Kernel ownership decision.
|
|
113
|
+
const now = nowFn();
|
|
114
|
+
const ownershipResult = (0, caws_kernel_1.assertOwnership)(snapshot.worktrees, worktreeName, session, { takeover: wantsTakeover }, now);
|
|
115
|
+
// 6. Apply takeover patch if the kernel emitted one. assertOwnership
|
|
116
|
+
// never silently mints unowned-→-owned; if the kernel refused, we
|
|
117
|
+
// surface that as exit 1.
|
|
118
|
+
if (!ownershipResult.ok) {
|
|
119
|
+
err('caws claim: ownership refused.');
|
|
120
|
+
err((0, diagnostic_1.renderDiagnostics)(ownershipResult.errors, { showData }));
|
|
121
|
+
// Show the current claim panel so the caller can see who holds it.
|
|
122
|
+
const ownerLine = (0, claim_1.renderClaimPanel)({
|
|
123
|
+
worktreeName,
|
|
124
|
+
worktreeRecord: record,
|
|
125
|
+
...(record.owner !== undefined && snapshot.agents[record.owner.session_id] !== undefined
|
|
126
|
+
? { agentRecord: snapshot.agents[record.owner.session_id] }
|
|
127
|
+
: {}),
|
|
128
|
+
currentSession: session,
|
|
129
|
+
now,
|
|
130
|
+
...(opts.staleTtlMs !== undefined ? { staleTtlMs: opts.staleTtlMs } : {}),
|
|
131
|
+
});
|
|
132
|
+
err('');
|
|
133
|
+
err(ownerLine);
|
|
134
|
+
return 1;
|
|
135
|
+
}
|
|
136
|
+
const patch = ownershipResult.value;
|
|
137
|
+
if (patch !== null) {
|
|
138
|
+
// Patch must be a takeover_claim (the kernel only emits null or a
|
|
139
|
+
// takeover_claim from assertOwnership). Apply it.
|
|
140
|
+
const applyResult = (0, store_1.applyRegistryPatch)(cawsDir, patch);
|
|
141
|
+
if (!applyResult.ok) {
|
|
142
|
+
err('caws claim: failed to apply takeover patch.');
|
|
143
|
+
err((0, diagnostic_1.renderDiagnostics)(applyResult.errors, { showData }));
|
|
144
|
+
return 2;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
// 7. Refresh agents.json — even when ownership was already ours.
|
|
148
|
+
// Visible references to lifecycle verbs refresh agents.json so
|
|
149
|
+
// freshness display stays current independent of IDE hooks.
|
|
150
|
+
// refreshAgentClaim only fails on a malformed session shape; we
|
|
151
|
+
// just validated this session via resolveSession, so Err here
|
|
152
|
+
// would be a real bug. Treat it as exit 2.
|
|
153
|
+
const refreshResult = (0, caws_kernel_1.refreshAgentClaim)(snapshot.agents, session, now, {
|
|
154
|
+
bound_worktree: worktreeName,
|
|
155
|
+
...(record.specId !== undefined ? { bound_spec_id: record.specId } : {}),
|
|
156
|
+
});
|
|
157
|
+
if (!refreshResult.ok) {
|
|
158
|
+
err('caws claim: internal — refreshAgentClaim returned Err with a validated session.');
|
|
159
|
+
err((0, diagnostic_1.renderDiagnostics)(refreshResult.errors, { showData }));
|
|
160
|
+
return 2;
|
|
161
|
+
}
|
|
162
|
+
const refreshApply = (0, store_1.applyRegistryPatch)(cawsDir, refreshResult.value);
|
|
163
|
+
if (!refreshApply.ok) {
|
|
164
|
+
// Apply failure is a hygiene problem (disk I/O on agents.json),
|
|
165
|
+
// not an authority problem. Ownership is already secured; surface
|
|
166
|
+
// a warning but continue.
|
|
167
|
+
err('caws claim: warning — agents.json refresh failed (display only).');
|
|
168
|
+
err((0, diagnostic_1.renderDiagnostics)(refreshApply.errors, { showData }));
|
|
169
|
+
}
|
|
170
|
+
// 8. Render the Claim panel — re-read the worktree record so it shows
|
|
171
|
+
// the new owner / prior_owners count after the patch.
|
|
172
|
+
// We don't re-compose the snapshot because the apply functions already
|
|
173
|
+
// wrote to disk; reading the in-memory `record` (pre-patch) would lie.
|
|
174
|
+
// For determinism: reconstruct what the post-patch record looks like
|
|
175
|
+
// from the patch we just applied.
|
|
176
|
+
const renderedRecord = patch !== null && patch.kind === 'takeover_claim'
|
|
177
|
+
? {
|
|
178
|
+
...record,
|
|
179
|
+
owner: patch.owner,
|
|
180
|
+
last_heartbeat: patch.when,
|
|
181
|
+
prior_owners: [...(record.prior_owners ?? []), patch.prior_owner],
|
|
182
|
+
}
|
|
183
|
+
: record;
|
|
184
|
+
const newRel = (0, claim_1.classifyOwnership)(renderedRecord, session);
|
|
185
|
+
out((0, claim_1.renderClaimPanel)({
|
|
186
|
+
worktreeName,
|
|
187
|
+
worktreeRecord: renderedRecord,
|
|
188
|
+
currentSession: session,
|
|
189
|
+
now,
|
|
190
|
+
...(opts.staleTtlMs !== undefined ? { staleTtlMs: opts.staleTtlMs } : {}),
|
|
191
|
+
}));
|
|
192
|
+
// Same-session OR successful takeover both count as "claim established".
|
|
193
|
+
// The only Ok-but-not-yours case is impossible here: assertOwnership
|
|
194
|
+
// never returns Ok with a foreign owner intact.
|
|
195
|
+
return newRel === 'you' ? 0 : 1;
|
|
196
|
+
}
|
|
197
|
+
//# sourceMappingURL=claim.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claim.js","sourceRoot":"","sources":["../../../src/shell/commands/claim.ts"],"names":[],"mappings":";AAAA,yEAAyE;AACzE,2BAA2B;AAC3B,EAAE;AACF,YAAY;AACZ,4BAA4B;AAC5B,yDAAyD;AACzD,8EAA8E;AAC9E,2EAA2E;AA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AE,CAAC,CAAC,CAAC,EAAE,CAAC;KAC1E,CAAC,CACH,CAAC;IAEF,yEAAyE;IACzE,qEAAqE;IACrE,gDAAgD;IAChD,OAAO,MAAM,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAClC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface DoctorCommandOptions {
|
|
2
|
+
readonly cwd?: string;
|
|
3
|
+
readonly now?: Date;
|
|
4
|
+
readonly out?: (line: string) => void;
|
|
5
|
+
readonly err?: (line: string) => void;
|
|
6
|
+
/**
|
|
7
|
+
* Show the optional `data` block for each diagnostic/finding. Default
|
|
8
|
+
* false to keep output tight.
|
|
9
|
+
*/
|
|
10
|
+
readonly showData?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare function runDoctorCommand(opts?: DoctorCommandOptions): number;
|
|
13
|
+
//# sourceMappingURL=doctor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../../../src/shell/commands/doctor.ts"],"names":[],"mappings":"AAyCA,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC;IACpB,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC;;;OAGG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED,wBAAgB,gBAAgB,CAAC,IAAI,GAAE,oBAAyB,GAAG,MAAM,CAsExE"}
|