@deftai/directive 0.126.2 → 0.128.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/bin/deft-hook +14 -0
- package/bin/deft-hook.cmd +14 -0
- package/dist/bin.js +4319 -3
- package/package.json +11 -21
- package/dist/agents-refresh.d.ts +0 -11
- package/dist/agents-refresh.js +0 -90
- package/dist/authz.d.ts +0 -7
- package/dist/authz.js +0 -732
- package/dist/bin.d.ts +0 -3
- package/dist/branch-fixtures.d.ts +0 -45
- package/dist/branch-fixtures.js +0 -156
- package/dist/cache.d.ts +0 -4
- package/dist/cache.js +0 -10
- package/dist/capacity-backfill.d.ts +0 -3
- package/dist/capacity-backfill.js +0 -9
- package/dist/capacity-show.d.ts +0 -3
- package/dist/capacity-show.js +0 -9
- package/dist/change-init.d.ts +0 -3
- package/dist/change-init.js +0 -59
- package/dist/changelog-check.d.ts +0 -3
- package/dist/changelog-check.js +0 -52
- package/dist/check.d.ts +0 -15
- package/dist/check.js +0 -150
- package/dist/cli-package-version.d.ts +0 -3
- package/dist/cli-package-version.js +0 -23
- package/dist/cli-router/index.d.ts +0 -8
- package/dist/cli-router/index.js +0 -44
- package/dist/cli-router/route-argv.d.ts +0 -40
- package/dist/cli-router/route-argv.js +0 -371
- package/dist/codebase-default-extractor.d.ts +0 -3
- package/dist/codebase-default-extractor.js +0 -9
- package/dist/codebase-map-fresh.d.ts +0 -3
- package/dist/codebase-map-fresh.js +0 -9
- package/dist/codebase-map.d.ts +0 -3
- package/dist/codebase-map.js +0 -9
- package/dist/codebase-projection-registry.d.ts +0 -3
- package/dist/codebase-projection-registry.js +0 -9
- package/dist/codebase-provider.d.ts +0 -3
- package/dist/codebase-provider.js +0 -9
- package/dist/commit-lint.d.ts +0 -3
- package/dist/commit-lint.js +0 -44
- package/dist/content-validate-cli/validate-links.d.ts +0 -11
- package/dist/content-validate-cli/validate-links.js +0 -37
- package/dist/content-validate-cli/validate-strategy-output.d.ts +0 -13
- package/dist/content-validate-cli/validate-strategy-output.js +0 -56
- package/dist/content-validate-cli/verify-capacity.d.ts +0 -12
- package/dist/content-validate-cli/verify-capacity.js +0 -54
- package/dist/coverage-hotspots.d.ts +0 -21
- package/dist/coverage-hotspots.js +0 -198
- package/dist/design-critique-spend-resolve.d.ts +0 -18
- package/dist/design-critique-spend-resolve.js +0 -191
- package/dist/directive-finish-loop.d.ts +0 -3
- package/dist/directive-finish-loop.js +0 -10
- package/dist/dispatch.d.ts +0 -193
- package/dist/dispatch.js +0 -3091
- package/dist/doctor.d.ts +0 -19
- package/dist/doctor.js +0 -155
- package/dist/entrypoint.d.ts +0 -6
- package/dist/entrypoint.js +0 -19
- package/dist/escalation-cli.d.ts +0 -4
- package/dist/escalation-cli.js +0 -301
- package/dist/eval-health.d.ts +0 -13
- package/dist/eval-health.js +0 -63
- package/dist/eval-report.d.ts +0 -15
- package/dist/eval-report.js +0 -97
- package/dist/eval-run.d.ts +0 -17
- package/dist/eval-run.js +0 -122
- package/dist/eval-triggers.d.ts +0 -12
- package/dist/eval-triggers.js +0 -56
- package/dist/framework-check-updates.d.ts +0 -10
- package/dist/framework-check-updates.js +0 -68
- package/dist/gates-cli/_helpers.d.ts +0 -24
- package/dist/gates-cli/_helpers.js +0 -115
- package/dist/gates-cli/verify-bridge-drift.d.ts +0 -11
- package/dist/gates-cli/verify-bridge-drift.js +0 -47
- package/dist/gates-cli/verify-go-freeze.d.ts +0 -11
- package/dist/gates-cli/verify-go-freeze.js +0 -48
- package/dist/hook-bin.d.ts +0 -3
- package/dist/hook-bin.js +0 -11
- package/dist/hook-dispatch.d.ts +0 -80
- package/dist/hook-dispatch.js +0 -186
- package/dist/human-presence-mint.d.ts +0 -70
- package/dist/human-presence-mint.js +0 -204
- package/dist/identity-banner.d.ts +0 -13
- package/dist/identity-banner.js +0 -19
- package/dist/index.d.ts +0 -11
- package/dist/index.js +0 -14
- package/dist/init-cli/constants.d.ts +0 -42
- package/dist/init-cli/constants.js +0 -42
- package/dist/init-cli/help.d.ts +0 -9
- package/dist/init-cli/help.js +0 -43
- package/dist/init-cli/init.d.ts +0 -26
- package/dist/init-cli/init.js +0 -80
- package/dist/init-cli/migrate.d.ts +0 -3
- package/dist/init-cli/migrate.js +0 -51
- package/dist/init-cli/resolve-binary.d.ts +0 -34
- package/dist/init-cli/resolve-binary.js +0 -78
- package/dist/init-cli/run-deft-install.d.ts +0 -23
- package/dist/init-cli/run-deft-install.js +0 -71
- package/dist/init-cli/update.d.ts +0 -5
- package/dist/init-cli/update.js +0 -38
- package/dist/install-cli/coverage-map.d.ts +0 -14
- package/dist/install-cli/coverage-map.js +0 -113
- package/dist/install-uninstall.d.ts +0 -3
- package/dist/install-uninstall.js +0 -44
- package/dist/install-upgrade.d.ts +0 -41
- package/dist/install-upgrade.js +0 -86
- package/dist/lifecycle-cli/coverage-map.d.ts +0 -16
- package/dist/lifecycle-cli/coverage-map.js +0 -254
- package/dist/lifecycle-cli/helpers.d.ts +0 -8
- package/dist/lifecycle-cli/helpers.js +0 -20
- package/dist/lifecycle-event.d.ts +0 -11
- package/dist/lifecycle-event.js +0 -45
- package/dist/lifecycle-stats.d.ts +0 -12
- package/dist/lifecycle-stats.js +0 -100
- package/dist/migrate-category-b.d.ts +0 -9
- package/dist/migrate-category-b.js +0 -52
- package/dist/migrate-preflight.d.ts +0 -10
- package/dist/migrate-preflight.js +0 -85
- package/dist/migrate-xbrief.d.ts +0 -11
- package/dist/migrate-xbrief.js +0 -88
- package/dist/occupancy-grant.d.ts +0 -18
- package/dist/occupancy-grant.js +0 -121
- package/dist/occupancy-heartbeat.d.ts +0 -8
- package/dist/occupancy-heartbeat.js +0 -63
- package/dist/occupancy-release.d.ts +0 -23
- package/dist/occupancy-release.js +0 -102
- package/dist/occupancy-steal.d.ts +0 -10
- package/dist/occupancy-steal.js +0 -83
- package/dist/occupancy-unrecognized.d.ts +0 -3
- package/dist/occupancy-unrecognized.js +0 -5
- package/dist/orchestration-cli/coverage-map.d.ts +0 -21
- package/dist/orchestration-cli/coverage-map.js +0 -225
- package/dist/orchestration-cli/helpers.d.ts +0 -11
- package/dist/orchestration-cli/helpers.js +0 -35
- package/dist/ownership-doctor.d.ts +0 -10
- package/dist/ownership-doctor.js +0 -96
- package/dist/ownership-fix.d.ts +0 -10
- package/dist/ownership-fix.js +0 -93
- package/dist/plan-sequence.d.ts +0 -14
- package/dist/plan-sequence.js +0 -258
- package/dist/policy-fixtures.d.ts +0 -33
- package/dist/policy-fixtures.js +0 -118
- package/dist/policy.d.ts +0 -37
- package/dist/policy.js +0 -744
- package/dist/pr-closing-keywords.d.ts +0 -3
- package/dist/pr-closing-keywords.js +0 -10
- package/dist/pr-finish-loop.d.ts +0 -3
- package/dist/pr-finish-loop.js +0 -10
- package/dist/pr-merge-readiness.d.ts +0 -3
- package/dist/pr-merge-readiness.js +0 -10
- package/dist/pr-monitor.d.ts +0 -3
- package/dist/pr-monitor.js +0 -10
- package/dist/pr-protected-issues.d.ts +0 -3
- package/dist/pr-protected-issues.js +0 -10
- package/dist/pr-wait-mergeable.d.ts +0 -3
- package/dist/pr-wait-mergeable.js +0 -10
- package/dist/pr-watch.d.ts +0 -3
- package/dist/pr-watch.js +0 -10
- package/dist/pre-pr-run.d.ts +0 -39
- package/dist/pre-pr-run.js +0 -514
- package/dist/preflight-cache.d.ts +0 -18
- package/dist/preflight-cache.js +0 -113
- package/dist/preflight-gh.d.ts +0 -15
- package/dist/preflight-gh.js +0 -143
- package/dist/probe-session.d.ts +0 -3
- package/dist/probe-session.js +0 -10
- package/dist/release-e2e-fixtures.d.ts +0 -29
- package/dist/release-e2e-fixtures.js +0 -38
- package/dist/release-e2e.d.ts +0 -3
- package/dist/release-e2e.js +0 -10
- package/dist/release-publish.d.ts +0 -3
- package/dist/release-publish.js +0 -10
- package/dist/release-rollback.d.ts +0 -3
- package/dist/release-rollback.js +0 -10
- package/dist/release-wait-npm.d.ts +0 -3
- package/dist/release-wait-npm.js +0 -10
- package/dist/release.d.ts +0 -3
- package/dist/release.js +0 -10
- package/dist/render-cli/deft-ts-runner.d.ts +0 -17
- package/dist/render-cli/deft-ts-runner.js +0 -19
- package/dist/render-cli/export-spec-cli.d.ts +0 -2
- package/dist/render-cli/export-spec-cli.js +0 -6
- package/dist/render-cli/prd-render-cli.d.ts +0 -2
- package/dist/render-cli/prd-render-cli.js +0 -37
- package/dist/render-cli/project-render-cli.d.ts +0 -2
- package/dist/render-cli/project-render-cli.js +0 -6
- package/dist/render-cli/rule-map-cli.d.ts +0 -2
- package/dist/render-cli/rule-map-cli.js +0 -5
- package/dist/render-cli/spec-reconstruct-cli.d.ts +0 -3
- package/dist/render-cli/spec-reconstruct-cli.js +0 -15
- package/dist/render-cli/spec-render-cli.d.ts +0 -2
- package/dist/render-cli/spec-render-cli.js +0 -39
- package/dist/render-cli/spec-validate-cli.d.ts +0 -2
- package/dist/render-cli/spec-validate-cli.js +0 -38
- package/dist/review-monitor-register.d.ts +0 -19
- package/dist/review-monitor-register.js +0 -183
- package/dist/review-monitor-release.d.ts +0 -14
- package/dist/review-monitor-release.js +0 -123
- package/dist/scm-sync-default.d.ts +0 -34
- package/dist/scm-sync-default.js +0 -210
- package/dist/scope-lifecycle.d.ts +0 -4
- package/dist/scope-lifecycle.js +0 -34
- package/dist/scope-record-approved-scope.d.ts +0 -29
- package/dist/scope-record-approved-scope.js +0 -319
- package/dist/scope-record-intent-constraint.d.ts +0 -16
- package/dist/scope-record-intent-constraint.js +0 -202
- package/dist/scope-record-observable-scope.d.ts +0 -16
- package/dist/scope-record-observable-scope.js +0 -204
- package/dist/session-ready.d.ts +0 -15
- package/dist/session-ready.js +0 -144
- package/dist/session-start.d.ts +0 -56
- package/dist/session-start.js +0 -581
- package/dist/slice.d.ts +0 -4
- package/dist/slice.js +0 -34
- package/dist/story-ready-fixtures.d.ts +0 -47
- package/dist/story-ready-fixtures.js +0 -137
- package/dist/subagent-monitor.d.ts +0 -3
- package/dist/subagent-monitor.js +0 -10
- package/dist/subagent-pre-cancel.d.ts +0 -21
- package/dist/subagent-pre-cancel.js +0 -240
- package/dist/subagent-steer-write.d.ts +0 -41
- package/dist/subagent-steer-write.js +0 -333
- package/dist/toolchain-check.d.ts +0 -8
- package/dist/toolchain-check.js +0 -54
- package/dist/triage-actions.d.ts +0 -23
- package/dist/triage-actions.js +0 -233
- package/dist/triage-aux-a-fixtures.d.ts +0 -33
- package/dist/triage-aux-a-fixtures.js +0 -107
- package/dist/triage-aux-b-fixtures.d.ts +0 -30
- package/dist/triage-aux-b-fixtures.js +0 -167
- package/dist/triage-bootstrap-fixtures.d.ts +0 -42
- package/dist/triage-bootstrap-fixtures.js +0 -139
- package/dist/triage-bootstrap.d.ts +0 -24
- package/dist/triage-bootstrap.js +0 -175
- package/dist/triage-bulk.d.ts +0 -17
- package/dist/triage-bulk.js +0 -154
- package/dist/triage-classify-fixtures.d.ts +0 -38
- package/dist/triage-classify-fixtures.js +0 -137
- package/dist/triage-classify.d.ts +0 -45
- package/dist/triage-classify.js +0 -287
- package/dist/triage-evaluate.d.ts +0 -14
- package/dist/triage-evaluate.js +0 -153
- package/dist/triage-help.d.ts +0 -3
- package/dist/triage-help.js +0 -10
- package/dist/triage-queue-fixtures.d.ts +0 -59
- package/dist/triage-queue-fixtures.js +0 -284
- package/dist/triage-queue.d.ts +0 -38
- package/dist/triage-queue.js +0 -391
- package/dist/triage-reconcile.d.ts +0 -11
- package/dist/triage-reconcile.js +0 -76
- package/dist/triage-refresh.d.ts +0 -7
- package/dist/triage-refresh.js +0 -37
- package/dist/triage-scope-drift.d.ts +0 -12
- package/dist/triage-scope-drift.js +0 -117
- package/dist/triage-scope-fixtures.d.ts +0 -32
- package/dist/triage-scope-fixtures.js +0 -131
- package/dist/triage-scope.d.ts +0 -4
- package/dist/triage-scope.js +0 -34
- package/dist/triage-smoketest.d.ts +0 -3
- package/dist/triage-smoketest.js +0 -43
- package/dist/triage-strip-withdrawn.d.ts +0 -21
- package/dist/triage-strip-withdrawn.js +0 -102
- package/dist/triage-subscribe.d.ts +0 -15
- package/dist/triage-subscribe.js +0 -157
- package/dist/triage-summary.d.ts +0 -14
- package/dist/triage-summary.js +0 -83
- package/dist/triage-welcome.d.ts +0 -14
- package/dist/triage-welcome.js +0 -121
- package/dist/ts-check-lane.d.ts +0 -9
- package/dist/ts-check-lane.js +0 -49
- package/dist/umbrella-current-shape.d.ts +0 -9
- package/dist/umbrella-current-shape.js +0 -56
- package/dist/vbrief-activate.d.ts +0 -3
- package/dist/vbrief-activate.js +0 -7
- package/dist/vbrief-build.d.ts +0 -3
- package/dist/vbrief-build.js +0 -8
- package/dist/vbrief-preflight-fixtures.d.ts +0 -32
- package/dist/vbrief-preflight-fixtures.js +0 -79
- package/dist/vbrief-preflight.d.ts +0 -13
- package/dist/vbrief-preflight.js +0 -141
- package/dist/vbrief-reconcile.d.ts +0 -3
- package/dist/vbrief-reconcile.js +0 -7
- package/dist/vbrief-validate.d.ts +0 -3
- package/dist/vbrief-validate.js +0 -8
- package/dist/vbrief-validation.d.ts +0 -3
- package/dist/vbrief-validation.js +0 -8
- package/dist/verify-ac.d.ts +0 -28
- package/dist/verify-ac.js +0 -439
- package/dist/verify-agents-md-advisory.d.ts +0 -19
- package/dist/verify-agents-md-advisory.js +0 -65
- package/dist/verify-agents-md-budget.d.ts +0 -12
- package/dist/verify-agents-md-budget.js +0 -71
- package/dist/verify-branch.d.ts +0 -14
- package/dist/verify-branch.js +0 -81
- package/dist/verify-class-checks.d.ts +0 -11
- package/dist/verify-class-checks.js +0 -71
- package/dist/verify-cohort-review-monitors.d.ts +0 -5
- package/dist/verify-cohort-review-monitors.js +0 -11
- package/dist/verify-completed-tracked.d.ts +0 -19
- package/dist/verify-completed-tracked.js +0 -202
- package/dist/verify-completed-write-guard.d.ts +0 -13
- package/dist/verify-completed-write-guard.js +0 -84
- package/dist/verify-consumer-check-contract.d.ts +0 -12
- package/dist/verify-consumer-check-contract.js +0 -70
- package/dist/verify-consumer-header-placeholder.d.ts +0 -12
- package/dist/verify-consumer-header-placeholder.js +0 -73
- package/dist/verify-consumer-test-lane.d.ts +0 -12
- package/dist/verify-consumer-test-lane.js +0 -57
- package/dist/verify-durable-effect-acquisition.d.ts +0 -13
- package/dist/verify-durable-effect-acquisition.js +0 -70
- package/dist/verify-encoding.d.ts +0 -15
- package/dist/verify-encoding.js +0 -83
- package/dist/verify-eval-health-relocation.d.ts +0 -16
- package/dist/verify-eval-health-relocation.js +0 -93
- package/dist/verify-eval-triggers-relocation.d.ts +0 -14
- package/dist/verify-eval-triggers-relocation.js +0 -74
- package/dist/verify-evaluator-surface.d.ts +0 -15
- package/dist/verify-evaluator-surface.js +0 -87
- package/dist/verify-forward-coverage.d.ts +0 -19
- package/dist/verify-forward-coverage.js +0 -144
- package/dist/verify-hooks-installed.d.ts +0 -24
- package/dist/verify-hooks-installed.js +0 -140
- package/dist/verify-intent-constraint.d.ts +0 -17
- package/dist/verify-intent-constraint.js +0 -110
- package/dist/verify-investigation.d.ts +0 -3
- package/dist/verify-investigation.js +0 -10
- package/dist/verify-judgment-gates.d.ts +0 -3
- package/dist/verify-judgment-gates.js +0 -10
- package/dist/verify-l4-owner.d.ts +0 -15
- package/dist/verify-l4-owner.js +0 -132
- package/dist/verify-lifecycle-visible.d.ts +0 -13
- package/dist/verify-lifecycle-visible.js +0 -68
- package/dist/verify-literal-ac.d.ts +0 -14
- package/dist/verify-literal-ac.js +0 -168
- package/dist/verify-no-task-runtime.d.ts +0 -3
- package/dist/verify-no-task-runtime.js +0 -16
- package/dist/verify-observable-scope.d.ts +0 -17
- package/dist/verify-observable-scope.js +0 -110
- package/dist/verify-operator-scope-limit.d.ts +0 -17
- package/dist/verify-operator-scope-limit.js +0 -285
- package/dist/verify-orphan-active.d.ts +0 -17
- package/dist/verify-orphan-active.js +0 -135
- package/dist/verify-ownership.d.ts +0 -10
- package/dist/verify-ownership.js +0 -90
- package/dist/verify-persisted-planning-narratives.d.ts +0 -12
- package/dist/verify-persisted-planning-narratives.js +0 -82
- package/dist/verify-plan-sequence.d.ts +0 -14
- package/dist/verify-plan-sequence.js +0 -138
- package/dist/verify-pr-closeout-attestable.d.ts +0 -15
- package/dist/verify-pr-closeout-attestable.js +0 -114
- package/dist/verify-presentation-ceiling.d.ts +0 -11
- package/dist/verify-presentation-ceiling.js +0 -71
- package/dist/verify-presentation-coverage.d.ts +0 -14
- package/dist/verify-presentation-coverage.js +0 -90
- package/dist/verify-review-monitor.d.ts +0 -32
- package/dist/verify-review-monitor.js +0 -362
- package/dist/verify-scope-provenance.d.ts +0 -16
- package/dist/verify-scope-provenance.js +0 -91
- package/dist/verify-session-ritual.d.ts +0 -23
- package/dist/verify-session-ritual.js +0 -144
- package/dist/verify-source-cli/rule-ownership-lint.d.ts +0 -12
- package/dist/verify-source-cli/rule-ownership-lint.js +0 -61
- package/dist/verify-source-cli/verify-biome-config.d.ts +0 -11
- package/dist/verify-source-cli/verify-biome-config.js +0 -46
- package/dist/verify-source-cli/verify-closing-keywords.d.ts +0 -35
- package/dist/verify-source-cli/verify-closing-keywords.js +0 -139
- package/dist/verify-source-cli/verify-consumer-hard-stops.d.ts +0 -16
- package/dist/verify-source-cli/verify-consumer-hard-stops.js +0 -99
- package/dist/verify-source-cli/verify-contained-writes.d.ts +0 -13
- package/dist/verify-source-cli/verify-contained-writes.js +0 -67
- package/dist/verify-source-cli/verify-content-manifest.d.ts +0 -12
- package/dist/verify-source-cli/verify-content-manifest.js +0 -61
- package/dist/verify-source-cli/verify-contract-drift.d.ts +0 -11
- package/dist/verify-source-cli/verify-contract-drift.js +0 -47
- package/dist/verify-source-cli/verify-cursor-tier1.d.ts +0 -12
- package/dist/verify-source-cli/verify-cursor-tier1.js +0 -51
- package/dist/verify-source-cli/verify-deposit-closure.d.ts +0 -12
- package/dist/verify-source-cli/verify-deposit-closure.js +0 -52
- package/dist/verify-source-cli/verify-openclaw-tier1.d.ts +0 -12
- package/dist/verify-source-cli/verify-openclaw-tier1.js +0 -51
- package/dist/verify-source-cli/verify-scm-boundary.d.ts +0 -13
- package/dist/verify-source-cli/verify-scm-boundary.js +0 -66
- package/dist/verify-source-cli/verify-semantic-single-source.d.ts +0 -11
- package/dist/verify-source-cli/verify-semantic-single-source.js +0 -49
- package/dist/verify-source-cli/verify-skill-external-fetch-gate.d.ts +0 -11
- package/dist/verify-source-cli/verify-skill-external-fetch-gate.js +0 -46
- package/dist/verify-source-cli/verify-spec-drift.d.ts +0 -3
- package/dist/verify-source-cli/verify-spec-drift.js +0 -15
- package/dist/verify-source-cli/verify-spec-prd-fresh.d.ts +0 -3
- package/dist/verify-source-cli/verify-spec-prd-fresh.js +0 -15
- package/dist/verify-source-cli/verify-stubs.d.ts +0 -11
- package/dist/verify-source-cli/verify-stubs.js +0 -27
- package/dist/verify-source-cli/verify-telemetry-coverage.d.ts +0 -13
- package/dist/verify-source-cli/verify-telemetry-coverage.js +0 -67
- package/dist/verify-source-cli/verify-xbrief-drift.d.ts +0 -15
- package/dist/verify-source-cli/verify-xbrief-drift.js +0 -80
- package/dist/verify-story-ready.d.ts +0 -18
- package/dist/verify-story-ready.js +0 -190
- package/dist/verify-subagent-alive.d.ts +0 -21
- package/dist/verify-subagent-alive.js +0 -219
- package/dist/verify-subagent-steer.d.ts +0 -19
- package/dist/verify-subagent-steer.js +0 -136
- package/dist/verify-test-boundary.d.ts +0 -12
- package/dist/verify-test-boundary.js +0 -80
- package/dist/verify-tools.d.ts +0 -13
- package/dist/verify-tools.js +0 -67
- package/dist/verify-wip-cap.d.ts +0 -13
- package/dist/verify-wip-cap.js +0 -62
- package/dist/windows-bin-ps1.d.ts +0 -39
- package/dist/windows-bin-ps1.js +0 -226
- package/dist/wip-cap-fixtures.d.ts +0 -37
- package/dist/wip-cap-fixtures.js +0 -122
- package/dist/wsl-ownership-guard.d.ts +0 -2
- package/dist/wsl-ownership-guard.js +0 -15
- package/dist/xbrief-create.d.ts +0 -3
- package/dist/xbrief-create.js +0 -9
- package/dist/xbrief-verify.d.ts +0 -3
- package/dist/xbrief-verify.js +0 -9
- package/scripts/remove-windows-ps1-shims.mjs +0 -26
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { type HumanPresenceMintSeams } from "./human-presence-mint.js";
|
|
3
|
-
/** True when `candidate` is the same as or a descendant of `root` after realpath. */
|
|
4
|
-
export declare function isPathInsideRoot(root: string, candidate: string): boolean;
|
|
5
|
-
export interface ParsedArgs {
|
|
6
|
-
projectRoot: string;
|
|
7
|
-
xbriefPath: string;
|
|
8
|
-
actor: string;
|
|
9
|
-
kind: string;
|
|
10
|
-
/** Optional override for recorded xbriefRelPath (defaults: pending→active map). */
|
|
11
|
-
xbriefRelPath: string;
|
|
12
|
-
quiet: boolean;
|
|
13
|
-
/** Explicit operator confirm for the #3110 human-presence mint (#3384). */
|
|
14
|
-
confirm: boolean;
|
|
15
|
-
/** Optional owner/name seed for preimage approvedRepos (#3385 R5). */
|
|
16
|
-
repo: string;
|
|
17
|
-
/** Typed `--help` / `-h` (#4203); run() prints usage on stdout and exits 0. */
|
|
18
|
-
help?: boolean;
|
|
19
|
-
error?: string;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Map pending/ → active/ for path-bound approval records.
|
|
23
|
-
* Returns null when the source cannot be expressed as a repo-relative path under projectRoot
|
|
24
|
-
* (absolute outside-root paths must not be stamped into xbriefRelPath — #3205 Greptile).
|
|
25
|
-
*/
|
|
26
|
-
export declare function resolveApprovalXbriefRelPath(sourceRelOrAbs: string, projectRoot: string, override?: string): string | null;
|
|
27
|
-
export declare function parseArgs(argv: string[]): ParsedArgs;
|
|
28
|
-
export declare function run(argv: string[], seams?: HumanPresenceMintSeams): number;
|
|
29
|
-
//# sourceMappingURL=scope-record-approved-scope.d.ts.map
|
|
@@ -1,319 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* CLI for scope:record-approved-scope (#3205).
|
|
4
|
-
*
|
|
5
|
-
* Deposits a human-origin approved-scope digest under
|
|
6
|
-
* `.deft/approved-scope/<plan-id>.json` so verify:scope-provenance can
|
|
7
|
-
* authorize pending→active and operator-approved expansion without same-PR
|
|
8
|
-
* self-authorization.
|
|
9
|
-
*/
|
|
10
|
-
import { existsSync, lstatSync, readFileSync, realpathSync } from "node:fs";
|
|
11
|
-
import { basename, join, relative, resolve, sep } from "node:path";
|
|
12
|
-
import { scopeProvenance, slice } from "@deftai/directive-core";
|
|
13
|
-
import { isDirectEntrypoint } from "./entrypoint.js";
|
|
14
|
-
import { refuseMintWhileUatActive, refuseNonInteractiveMint, resolveHumanPresenceMintSeams, } from "./human-presence-mint.js";
|
|
15
|
-
/** True when `candidate` is the same as or a descendant of `root` after realpath. */
|
|
16
|
-
export function isPathInsideRoot(root, candidate) {
|
|
17
|
-
let rootReal;
|
|
18
|
-
let candReal;
|
|
19
|
-
try {
|
|
20
|
-
rootReal = realpathSync(root);
|
|
21
|
-
// realpathSync fails if path does not exist; fall back to resolve for missing targets
|
|
22
|
-
candReal = existsSync(candidate) ? realpathSync(candidate) : resolve(candidate);
|
|
23
|
-
}
|
|
24
|
-
catch {
|
|
25
|
-
return false;
|
|
26
|
-
}
|
|
27
|
-
const rel = relative(rootReal, candReal);
|
|
28
|
-
if (rel === "")
|
|
29
|
-
return true;
|
|
30
|
-
if (rel.startsWith(`..${sep}`) ||
|
|
31
|
-
rel === ".." ||
|
|
32
|
-
rel.startsWith("../") ||
|
|
33
|
-
rel.startsWith("..\\")) {
|
|
34
|
-
return false;
|
|
35
|
-
}
|
|
36
|
-
// Absolute relative() means different drive/root (win32)
|
|
37
|
-
if (resolve(rel) === rel && rel.includes(":"))
|
|
38
|
-
return false;
|
|
39
|
-
return !rel.startsWith("..");
|
|
40
|
-
}
|
|
41
|
-
const { isHumanApprovalStamp, mintApprovedScopeArtifacts } = scopeProvenance;
|
|
42
|
-
function usage() {
|
|
43
|
-
return ("usage: scope:record-approved-scope -- <xbrief-path> --actor <name> --confirm " +
|
|
44
|
-
"[--kind operator] [--project-root <dir>] [--xbrief-rel-path <posix>] [--repo owner/name] [--quiet]\n" +
|
|
45
|
-
" Writes .deft/approved-scope/<plan-id>.json and <plan-id>.intent.json (#3205 / #3384 / #3385).\n" +
|
|
46
|
-
" --actor is display only and never authorizes mint. Mint requires a real TTY, " +
|
|
47
|
-
"controlling terminal, --confirm, and typed phrase mint (#3110). Agent/CI shells refuse.");
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Map pending/ → active/ for path-bound approval records.
|
|
51
|
-
* Returns null when the source cannot be expressed as a repo-relative path under projectRoot
|
|
52
|
-
* (absolute outside-root paths must not be stamped into xbriefRelPath — #3205 Greptile).
|
|
53
|
-
*/
|
|
54
|
-
export function resolveApprovalXbriefRelPath(sourceRelOrAbs, projectRoot, override) {
|
|
55
|
-
if (override !== undefined && override.trim().length > 0) {
|
|
56
|
-
const o = override.replace(/\\/g, "/").replace(/^\.\//, "");
|
|
57
|
-
if (o.startsWith("/") || /^[A-Za-z]:\//.test(o))
|
|
58
|
-
return null;
|
|
59
|
-
return o;
|
|
60
|
-
}
|
|
61
|
-
const root = resolve(projectRoot);
|
|
62
|
-
const abs = resolve(sourceRelOrAbs.includes(":") ||
|
|
63
|
-
sourceRelOrAbs.startsWith("/") ||
|
|
64
|
-
sourceRelOrAbs.startsWith("\\")
|
|
65
|
-
? sourceRelOrAbs
|
|
66
|
-
: join(root, sourceRelOrAbs));
|
|
67
|
-
// Lexical + realpath containment (symlink to outside root must fail closed — #3205 Greptile).
|
|
68
|
-
if (!isPathInsideRoot(root, abs)) {
|
|
69
|
-
return null;
|
|
70
|
-
}
|
|
71
|
-
let rel = relative(root, abs).replace(/\\/g, "/");
|
|
72
|
-
if (rel.length === 0 || rel.startsWith("../") || rel === "..") {
|
|
73
|
-
return null;
|
|
74
|
-
}
|
|
75
|
-
try {
|
|
76
|
-
if (existsSync(abs) && lstatSync(abs).isSymbolicLink() && !isPathInsideRoot(root, abs)) {
|
|
77
|
-
return null;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
catch {
|
|
81
|
-
return null;
|
|
82
|
-
}
|
|
83
|
-
// Normalize pending → active for future-active binding (issue #3205 multi-PR).
|
|
84
|
-
if (rel.startsWith("xbrief/pending/")) {
|
|
85
|
-
rel = `xbrief/active/${basename(rel)}`;
|
|
86
|
-
}
|
|
87
|
-
else if (rel.startsWith("vbrief/pending/")) {
|
|
88
|
-
rel = `vbrief/active/${basename(rel)}`;
|
|
89
|
-
}
|
|
90
|
-
return rel;
|
|
91
|
-
}
|
|
92
|
-
export function parseArgs(argv) {
|
|
93
|
-
const parsed = {
|
|
94
|
-
projectRoot: ".",
|
|
95
|
-
xbriefPath: "",
|
|
96
|
-
actor: "",
|
|
97
|
-
kind: "operator",
|
|
98
|
-
xbriefRelPath: "",
|
|
99
|
-
quiet: false,
|
|
100
|
-
confirm: false,
|
|
101
|
-
repo: "",
|
|
102
|
-
};
|
|
103
|
-
const positionals = [];
|
|
104
|
-
for (let i = 0; i < argv.length; i += 1) {
|
|
105
|
-
const arg = argv[i];
|
|
106
|
-
if (arg === "--") {
|
|
107
|
-
continue;
|
|
108
|
-
}
|
|
109
|
-
if (arg === "--help" || arg === "-h") {
|
|
110
|
-
return { ...parsed, help: true };
|
|
111
|
-
}
|
|
112
|
-
if (arg === "--quiet") {
|
|
113
|
-
parsed.quiet = true;
|
|
114
|
-
}
|
|
115
|
-
else if (arg === "--confirm") {
|
|
116
|
-
parsed.confirm = true;
|
|
117
|
-
}
|
|
118
|
-
else if (arg === "--project-root") {
|
|
119
|
-
const value = argv[i + 1];
|
|
120
|
-
if (value === undefined || value === "--") {
|
|
121
|
-
return { ...parsed, error: "argument --project-root: expected one argument" };
|
|
122
|
-
}
|
|
123
|
-
parsed.projectRoot = value;
|
|
124
|
-
i += 1;
|
|
125
|
-
}
|
|
126
|
-
else if (arg?.startsWith("--project-root=")) {
|
|
127
|
-
parsed.projectRoot = arg.slice("--project-root=".length);
|
|
128
|
-
}
|
|
129
|
-
else if (arg === "--actor") {
|
|
130
|
-
const value = argv[i + 1];
|
|
131
|
-
if (value === undefined || value === "--") {
|
|
132
|
-
return { ...parsed, error: "argument --actor: expected one argument" };
|
|
133
|
-
}
|
|
134
|
-
parsed.actor = value;
|
|
135
|
-
i += 1;
|
|
136
|
-
}
|
|
137
|
-
else if (arg?.startsWith("--actor=")) {
|
|
138
|
-
const value = arg.slice("--actor=".length);
|
|
139
|
-
if (value.length === 0 || value === "--") {
|
|
140
|
-
return { ...parsed, error: "argument --actor: expected one argument" };
|
|
141
|
-
}
|
|
142
|
-
parsed.actor = value;
|
|
143
|
-
}
|
|
144
|
-
else if (arg === "--kind") {
|
|
145
|
-
const value = argv[i + 1];
|
|
146
|
-
if (value === undefined || value === "--") {
|
|
147
|
-
return { ...parsed, error: "argument --kind: expected one argument" };
|
|
148
|
-
}
|
|
149
|
-
parsed.kind = value;
|
|
150
|
-
i += 1;
|
|
151
|
-
}
|
|
152
|
-
else if (arg?.startsWith("--kind=")) {
|
|
153
|
-
const value = arg.slice("--kind=".length);
|
|
154
|
-
if (value.length === 0 || value === "--") {
|
|
155
|
-
return { ...parsed, error: "argument --kind: expected one argument" };
|
|
156
|
-
}
|
|
157
|
-
parsed.kind = value;
|
|
158
|
-
}
|
|
159
|
-
else if (arg === "--xbrief-rel-path") {
|
|
160
|
-
const value = argv[i + 1];
|
|
161
|
-
if (value === undefined || value === "--") {
|
|
162
|
-
return { ...parsed, error: "argument --xbrief-rel-path: expected one argument" };
|
|
163
|
-
}
|
|
164
|
-
parsed.xbriefRelPath = value;
|
|
165
|
-
i += 1;
|
|
166
|
-
}
|
|
167
|
-
else if (arg?.startsWith("--xbrief-rel-path=")) {
|
|
168
|
-
parsed.xbriefRelPath = arg.slice("--xbrief-rel-path=".length);
|
|
169
|
-
}
|
|
170
|
-
else if (arg === "--repo") {
|
|
171
|
-
const value = argv[i + 1];
|
|
172
|
-
if (value === undefined || value === "--") {
|
|
173
|
-
return { ...parsed, error: "argument --repo: expected one argument" };
|
|
174
|
-
}
|
|
175
|
-
parsed.repo = value;
|
|
176
|
-
i += 1;
|
|
177
|
-
}
|
|
178
|
-
else if (arg?.startsWith("--repo=")) {
|
|
179
|
-
parsed.repo = arg.slice("--repo=".length);
|
|
180
|
-
}
|
|
181
|
-
else if (arg?.startsWith("-")) {
|
|
182
|
-
return { ...parsed, error: `unrecognized argument: ${arg}` };
|
|
183
|
-
}
|
|
184
|
-
else if (arg !== undefined) {
|
|
185
|
-
positionals.push(arg);
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
if (parsed.help) {
|
|
189
|
-
return parsed;
|
|
190
|
-
}
|
|
191
|
-
if (positionals.length === 0) {
|
|
192
|
-
return { ...parsed, error: `missing xBRIEF path\n${usage()}` };
|
|
193
|
-
}
|
|
194
|
-
if (positionals.length > 1) {
|
|
195
|
-
return { ...parsed, error: `unexpected extra args: ${positionals.slice(1).join(" ")}` };
|
|
196
|
-
}
|
|
197
|
-
parsed.xbriefPath = positionals[0] ?? "";
|
|
198
|
-
if (parsed.actor.trim().length === 0) {
|
|
199
|
-
return {
|
|
200
|
-
...parsed,
|
|
201
|
-
error: `argument --actor is required (human operator identity)\n${usage()}`,
|
|
202
|
-
};
|
|
203
|
-
}
|
|
204
|
-
return parsed;
|
|
205
|
-
}
|
|
206
|
-
export function run(argv, seams = {}) {
|
|
207
|
-
const args = parseArgs(argv);
|
|
208
|
-
if (args.help) {
|
|
209
|
-
process.stdout.write(`${usage()}\n`);
|
|
210
|
-
return 0;
|
|
211
|
-
}
|
|
212
|
-
if (args.error !== undefined) {
|
|
213
|
-
process.stderr.write(`scope_record_approved_scope: ${args.error}\n`);
|
|
214
|
-
return 2;
|
|
215
|
-
}
|
|
216
|
-
const projectRoot = resolve(args.projectRoot);
|
|
217
|
-
const xbriefAbs = resolve(projectRoot, args.xbriefPath);
|
|
218
|
-
if (!existsSync(xbriefAbs)) {
|
|
219
|
-
// Also try absolute path as given
|
|
220
|
-
const alt = resolve(args.xbriefPath);
|
|
221
|
-
if (!existsSync(alt)) {
|
|
222
|
-
process.stderr.write(`scope_record_approved_scope: xBRIEF not found: ${args.xbriefPath}\n`);
|
|
223
|
-
return 2;
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
const fullPath = existsSync(xbriefAbs) ? xbriefAbs : resolve(args.xbriefPath);
|
|
227
|
-
if (!isPathInsideRoot(projectRoot, fullPath)) {
|
|
228
|
-
process.stderr.write("scope_record_approved_scope: xBRIEF path escapes --project-root " +
|
|
229
|
-
"(symlink or absolute outside-root targets refused) (#3205).\n");
|
|
230
|
-
return 2;
|
|
231
|
-
}
|
|
232
|
-
let raw;
|
|
233
|
-
try {
|
|
234
|
-
raw = readFileSync(fullPath, "utf8");
|
|
235
|
-
}
|
|
236
|
-
catch (err) {
|
|
237
|
-
process.stderr.write(`scope_record_approved_scope: failed to read xBRIEF: ${String(err)}\n`);
|
|
238
|
-
return 2;
|
|
239
|
-
}
|
|
240
|
-
const parsed = scopeProvenance.parseJsonRejectingDuplicateKeys(raw);
|
|
241
|
-
if (!parsed.ok) {
|
|
242
|
-
process.stderr.write(`scope_record_approved_scope: ${parsed.error}\n`);
|
|
243
|
-
return 2;
|
|
244
|
-
}
|
|
245
|
-
const payload = parsed.value;
|
|
246
|
-
const verb = "scope:record-approved-scope";
|
|
247
|
-
const uatBlocked = refuseMintWhileUatActive(verb, projectRoot);
|
|
248
|
-
if (uatBlocked !== null)
|
|
249
|
-
return uatBlocked;
|
|
250
|
-
const resolved = resolveHumanPresenceMintSeams(seams);
|
|
251
|
-
const mintBlocked = refuseNonInteractiveMint({
|
|
252
|
-
verb,
|
|
253
|
-
confirm: args.confirm,
|
|
254
|
-
isTty: resolved.isTty,
|
|
255
|
-
environ: resolved.environ,
|
|
256
|
-
hasControllingTerminal: resolved.hasControllingTerminal,
|
|
257
|
-
readInteractiveConfirm: resolved.readInteractiveConfirm,
|
|
258
|
-
});
|
|
259
|
-
if (mintBlocked !== null)
|
|
260
|
-
return mintBlocked;
|
|
261
|
-
const stamp = {
|
|
262
|
-
kind: args.kind.trim(),
|
|
263
|
-
actor: args.actor.trim(),
|
|
264
|
-
mintedAt: new Date().toISOString().replace(/\.\d{3}Z$/, "Z"),
|
|
265
|
-
mintedVia: "scope:record-approved-scope",
|
|
266
|
-
};
|
|
267
|
-
if (!isHumanApprovalStamp(stamp)) {
|
|
268
|
-
process.stderr.write("scope_record_approved_scope: refused agent/non-human stamp " +
|
|
269
|
-
`(kind=${stamp.kind}, actor=${stamp.actor}). Use a human operator actor ` +
|
|
270
|
-
"and kind in {operator,human,user,cli,github-user,interactive,renewed-approval} (#3205).\n");
|
|
271
|
-
return 1;
|
|
272
|
-
}
|
|
273
|
-
const xbriefRelPath = resolveApprovalXbriefRelPath(fullPath, projectRoot, args.xbriefRelPath.length > 0 ? args.xbriefRelPath : undefined);
|
|
274
|
-
if (xbriefRelPath === null) {
|
|
275
|
-
process.stderr.write("scope_record_approved_scope: xBRIEF path must resolve under --project-root " +
|
|
276
|
-
"(repo-relative path required for approval binding) (#3205).\n");
|
|
277
|
-
return 2;
|
|
278
|
-
}
|
|
279
|
-
const repoSeed = slice.resolveProjectRepo(args.repo.trim().length > 0 ? args.repo.trim() : undefined, projectRoot);
|
|
280
|
-
// Mint writes record + preimage as one fail-closed pair. A dest-write
|
|
281
|
-
// failure restores the prior pair or leaves neither dest (#3385 residual).
|
|
282
|
-
let minted;
|
|
283
|
-
try {
|
|
284
|
-
minted = mintApprovedScopeArtifacts({
|
|
285
|
-
xbriefRelPath,
|
|
286
|
-
payload,
|
|
287
|
-
rawText: raw,
|
|
288
|
-
projectRoot,
|
|
289
|
-
humanApproval: stamp,
|
|
290
|
-
extract: {
|
|
291
|
-
projectRoot,
|
|
292
|
-
approvedReposSeed: repoSeed !== null ? [repoSeed] : [],
|
|
293
|
-
},
|
|
294
|
-
});
|
|
295
|
-
}
|
|
296
|
-
catch (err) {
|
|
297
|
-
process.stderr.write(`scope_record_approved_scope: ${String(err)}\n`);
|
|
298
|
-
return 1;
|
|
299
|
-
}
|
|
300
|
-
const { record, recordPath, intentPath } = minted;
|
|
301
|
-
if (!args.quiet) {
|
|
302
|
-
process.stdout.write(`scope_record_approved_scope: wrote ${recordPath}\n` +
|
|
303
|
-
` preimage: ${intentPath}\n` +
|
|
304
|
-
` planId: ${record.planId}\n` +
|
|
305
|
-
` xbriefRelPath: ${record.xbriefRelPath}\n` +
|
|
306
|
-
` fileScopeDigest: ${record.fileScopeDigest}\n` +
|
|
307
|
-
` intentDigest: ${record.intentDigest ?? ""}\n` +
|
|
308
|
-
` paths: ${record.fileScope.length}\n` +
|
|
309
|
-
` humanApproval: ${stamp.kind}/${stamp.actor}\n` +
|
|
310
|
-
" Read the preimage before you commit. That file is the approved intent (#3385).\n" +
|
|
311
|
-
" Next: commit record + preimage on the merge base (or a prior PR) before " +
|
|
312
|
-
"activation/expansion in the implementation change set (#3205 / #3385).\n");
|
|
313
|
-
}
|
|
314
|
-
return 0;
|
|
315
|
-
}
|
|
316
|
-
if (isDirectEntrypoint(import.meta.url)) {
|
|
317
|
-
process.exit(run(process.argv.slice(2)));
|
|
318
|
-
}
|
|
319
|
-
//# sourceMappingURL=scope-record-approved-scope.js.map
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { type HumanPresenceMintSeams } from "./human-presence-mint.js";
|
|
3
|
-
export interface ParsedArgs {
|
|
4
|
-
projectRoot: string;
|
|
5
|
-
xbriefPath: string;
|
|
6
|
-
actor: string;
|
|
7
|
-
kind: string;
|
|
8
|
-
mintedVia: string;
|
|
9
|
-
quiet: boolean;
|
|
10
|
-
confirm: boolean;
|
|
11
|
-
help?: boolean;
|
|
12
|
-
error?: string;
|
|
13
|
-
}
|
|
14
|
-
export declare function parseArgs(argv: string[]): ParsedArgs;
|
|
15
|
-
export declare function run(argv: string[], seams?: HumanPresenceMintSeams): number;
|
|
16
|
-
//# sourceMappingURL=scope-record-intent-constraint.d.ts.map
|
|
@@ -1,202 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* CLI for scope:record-intent-constraint (#4541).
|
|
4
|
-
*
|
|
5
|
-
* Human-presence mint of `.deft/intent-constraint/<plan-id>.json` from
|
|
6
|
-
* `plan["x-directive/intentConstraint"]`. --actor is display-only.
|
|
7
|
-
*/
|
|
8
|
-
import { existsSync, readFileSync } from "node:fs";
|
|
9
|
-
import { basename, relative, resolve } from "node:path";
|
|
10
|
-
import { buildIntentConstraintRecord, extractIntentConstraintFromPlan, parseIntentConstraintContract, writeIntentConstraintRecord, } from "@deftai/directive-core/intent-constraint";
|
|
11
|
-
import { isDirectEntrypoint } from "./entrypoint.js";
|
|
12
|
-
import { refuseMintWhileUatActive, refuseNonInteractiveMint, resolveHumanPresenceMintSeams, } from "./human-presence-mint.js";
|
|
13
|
-
import { isPathInsideRoot } from "./scope-record-approved-scope.js";
|
|
14
|
-
const DEFAULT_MINTED_VIA = "scope:record-intent-constraint";
|
|
15
|
-
const ALLOWED_MINTED_VIA = new Set([DEFAULT_MINTED_VIA, "in-harness-ask"]);
|
|
16
|
-
function usage() {
|
|
17
|
-
return ("usage: scope:record-intent-constraint -- <xbrief-path> --actor <name> --confirm " +
|
|
18
|
-
"[--kind operator] [--minted-via in-harness-ask|scope:record-intent-constraint] " +
|
|
19
|
-
"[--project-root <dir>] [--quiet]\n" +
|
|
20
|
-
' Writes .deft/intent-constraint/<plan-id>.json from plan["x-directive/intentConstraint"].\n' +
|
|
21
|
-
" Attended mid-build (#5010): ask in parent chat; on yes the human runs this verb on a real TTY " +
|
|
22
|
-
"with --minted-via=in-harness-ask (attestation is not an agent-shell bypass). Commit the record on " +
|
|
23
|
-
"the delivery-branch merge base, then rebase the implementation branch — same-PR working-tree-only " +
|
|
24
|
-
"records are not authoritative. Unattended/C1: rewrite or park. --actor is display only. Mint still " +
|
|
25
|
-
"requires a real TTY, controlling terminal, --confirm, and typed phrase mint (#3110). Agent/CI shells refuse.");
|
|
26
|
-
}
|
|
27
|
-
function extractPlanId(payload) {
|
|
28
|
-
if (payload === null || typeof payload !== "object" || Array.isArray(payload))
|
|
29
|
-
return null;
|
|
30
|
-
const plan = payload.plan;
|
|
31
|
-
if (plan === null || typeof plan !== "object" || Array.isArray(plan))
|
|
32
|
-
return null;
|
|
33
|
-
const id = plan.id;
|
|
34
|
-
return typeof id === "string" && id.trim().length > 0 ? id.trim() : null;
|
|
35
|
-
}
|
|
36
|
-
export function parseArgs(argv) {
|
|
37
|
-
const parsed = {
|
|
38
|
-
projectRoot: ".",
|
|
39
|
-
xbriefPath: "",
|
|
40
|
-
actor: "",
|
|
41
|
-
kind: "operator",
|
|
42
|
-
mintedVia: DEFAULT_MINTED_VIA,
|
|
43
|
-
quiet: false,
|
|
44
|
-
confirm: false,
|
|
45
|
-
};
|
|
46
|
-
const positionals = [];
|
|
47
|
-
for (let i = 0; i < argv.length; i += 1) {
|
|
48
|
-
const arg = argv[i];
|
|
49
|
-
if (arg === "--")
|
|
50
|
-
continue;
|
|
51
|
-
if (arg === "--help" || arg === "-h")
|
|
52
|
-
return { ...parsed, help: true };
|
|
53
|
-
if (arg === "--quiet")
|
|
54
|
-
parsed.quiet = true;
|
|
55
|
-
else if (arg === "--confirm")
|
|
56
|
-
parsed.confirm = true;
|
|
57
|
-
else if (arg === "--project-root") {
|
|
58
|
-
const value = argv[i + 1];
|
|
59
|
-
if (value === undefined)
|
|
60
|
-
return { ...parsed, error: "argument --project-root: expected one argument" };
|
|
61
|
-
parsed.projectRoot = value;
|
|
62
|
-
i += 1;
|
|
63
|
-
}
|
|
64
|
-
else if (arg?.startsWith("--project-root=")) {
|
|
65
|
-
parsed.projectRoot = arg.slice("--project-root=".length);
|
|
66
|
-
}
|
|
67
|
-
else if (arg === "--actor") {
|
|
68
|
-
const value = argv[i + 1];
|
|
69
|
-
if (value === undefined)
|
|
70
|
-
return { ...parsed, error: "argument --actor: expected one argument" };
|
|
71
|
-
parsed.actor = value;
|
|
72
|
-
i += 1;
|
|
73
|
-
}
|
|
74
|
-
else if (arg?.startsWith("--actor=")) {
|
|
75
|
-
parsed.actor = arg.slice("--actor=".length);
|
|
76
|
-
}
|
|
77
|
-
else if (arg === "--kind") {
|
|
78
|
-
const value = argv[i + 1];
|
|
79
|
-
if (value === undefined)
|
|
80
|
-
return { ...parsed, error: "argument --kind: expected one argument" };
|
|
81
|
-
parsed.kind = value;
|
|
82
|
-
i += 1;
|
|
83
|
-
}
|
|
84
|
-
else if (arg?.startsWith("--kind=")) {
|
|
85
|
-
parsed.kind = arg.slice("--kind=".length);
|
|
86
|
-
}
|
|
87
|
-
else if (arg === "--minted-via") {
|
|
88
|
-
const value = argv[i + 1];
|
|
89
|
-
if (value === undefined)
|
|
90
|
-
return { ...parsed, error: "argument --minted-via: expected one argument" };
|
|
91
|
-
parsed.mintedVia = value;
|
|
92
|
-
i += 1;
|
|
93
|
-
}
|
|
94
|
-
else if (arg?.startsWith("--minted-via=")) {
|
|
95
|
-
parsed.mintedVia = arg.slice("--minted-via=".length);
|
|
96
|
-
}
|
|
97
|
-
else if (arg?.startsWith("-")) {
|
|
98
|
-
return { ...parsed, error: `unrecognized argument: ${arg}` };
|
|
99
|
-
}
|
|
100
|
-
else if (arg !== undefined) {
|
|
101
|
-
positionals.push(arg);
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
if (parsed.help)
|
|
105
|
-
return parsed;
|
|
106
|
-
if (positionals.length === 0)
|
|
107
|
-
return { ...parsed, error: `missing xBRIEF path\n${usage()}` };
|
|
108
|
-
if (positionals.length > 1) {
|
|
109
|
-
return { ...parsed, error: `unexpected extra args: ${positionals.slice(1).join(" ")}` };
|
|
110
|
-
}
|
|
111
|
-
parsed.xbriefPath = positionals[0] ?? "";
|
|
112
|
-
if (parsed.actor.trim().length === 0) {
|
|
113
|
-
return {
|
|
114
|
-
...parsed,
|
|
115
|
-
error: `argument --actor is required (human operator identity)\n${usage()}`,
|
|
116
|
-
};
|
|
117
|
-
}
|
|
118
|
-
if (!ALLOWED_MINTED_VIA.has(parsed.mintedVia.trim())) {
|
|
119
|
-
return {
|
|
120
|
-
...parsed,
|
|
121
|
-
error: `argument --minted-via must be one of: ${[...ALLOWED_MINTED_VIA].join(", ")}\n${usage()}`,
|
|
122
|
-
};
|
|
123
|
-
}
|
|
124
|
-
parsed.mintedVia = parsed.mintedVia.trim();
|
|
125
|
-
return parsed;
|
|
126
|
-
}
|
|
127
|
-
export function run(argv, seams = {}) {
|
|
128
|
-
const args = parseArgs(argv);
|
|
129
|
-
if (args.help) {
|
|
130
|
-
process.stdout.write(`${usage()}\n`);
|
|
131
|
-
return 0;
|
|
132
|
-
}
|
|
133
|
-
if (args.error !== undefined) {
|
|
134
|
-
process.stderr.write(`scope_record_intent_constraint: ${args.error}\n`);
|
|
135
|
-
return 2;
|
|
136
|
-
}
|
|
137
|
-
const projectRoot = resolve(args.projectRoot);
|
|
138
|
-
const uat = refuseMintWhileUatActive("scope:record-intent-constraint", projectRoot);
|
|
139
|
-
if (uat !== null)
|
|
140
|
-
return uat;
|
|
141
|
-
const resolved = resolveHumanPresenceMintSeams(seams);
|
|
142
|
-
const refused = refuseNonInteractiveMint({
|
|
143
|
-
verb: "scope:record-intent-constraint",
|
|
144
|
-
confirm: args.confirm,
|
|
145
|
-
isTty: resolved.isTty,
|
|
146
|
-
environ: resolved.environ,
|
|
147
|
-
hasControllingTerminal: resolved.hasControllingTerminal,
|
|
148
|
-
readInteractiveConfirm: resolved.readInteractiveConfirm,
|
|
149
|
-
});
|
|
150
|
-
if (refused !== null)
|
|
151
|
-
return refused;
|
|
152
|
-
const xbriefAbs = resolve(projectRoot, args.xbriefPath);
|
|
153
|
-
const fullPath = existsSync(xbriefAbs) ? xbriefAbs : resolve(args.xbriefPath);
|
|
154
|
-
if (!existsSync(fullPath)) {
|
|
155
|
-
process.stderr.write(`scope_record_intent_constraint: xBRIEF not found: ${args.xbriefPath}\n`);
|
|
156
|
-
return 2;
|
|
157
|
-
}
|
|
158
|
-
if (!isPathInsideRoot(projectRoot, fullPath)) {
|
|
159
|
-
process.stderr.write("scope_record_intent_constraint: xBRIEF path escapes --project-root.\n");
|
|
160
|
-
return 2;
|
|
161
|
-
}
|
|
162
|
-
let payload;
|
|
163
|
-
const rawText = readFileSync(fullPath, "utf8");
|
|
164
|
-
try {
|
|
165
|
-
payload = JSON.parse(rawText);
|
|
166
|
-
}
|
|
167
|
-
catch (err) {
|
|
168
|
-
process.stderr.write(`scope_record_intent_constraint: invalid JSON: ${String(err)}\n`);
|
|
169
|
-
return 2;
|
|
170
|
-
}
|
|
171
|
-
const planId = extractPlanId(payload) ?? basename(fullPath, ".xbrief.json");
|
|
172
|
-
const contract = parseIntentConstraintContract(extractIntentConstraintFromPlan(payload));
|
|
173
|
-
if ("error" in contract) {
|
|
174
|
-
process.stderr.write(`scope_record_intent_constraint: ${contract.error}\n`);
|
|
175
|
-
return 2;
|
|
176
|
-
}
|
|
177
|
-
const rel = relative(projectRoot, fullPath).replace(/\\/g, "/");
|
|
178
|
-
const rec = buildIntentConstraintRecord({
|
|
179
|
-
planId,
|
|
180
|
-
xbriefRelPath: rel.startsWith("xbrief/pending/") ? `xbrief/active/${basename(rel)}` : rel,
|
|
181
|
-
constraints: contract.constraints,
|
|
182
|
-
humanApproval: {
|
|
183
|
-
kind: args.kind,
|
|
184
|
-
actor: args.actor,
|
|
185
|
-
mintedAt: new Date().toISOString().replace(/\.\d{3}Z$/, "Z"),
|
|
186
|
-
mintedVia: args.mintedVia,
|
|
187
|
-
},
|
|
188
|
-
});
|
|
189
|
-
if ("error" in rec) {
|
|
190
|
-
process.stderr.write(`scope_record_intent_constraint: ${rec.error}\n`);
|
|
191
|
-
return 2;
|
|
192
|
-
}
|
|
193
|
-
const path = writeIntentConstraintRecord(projectRoot, rec);
|
|
194
|
-
if (!args.quiet) {
|
|
195
|
-
process.stdout.write(`Wrote ${path}\nCommit this record on the merge base before the implementation change PR.\n`);
|
|
196
|
-
}
|
|
197
|
-
return 0;
|
|
198
|
-
}
|
|
199
|
-
if (isDirectEntrypoint(import.meta.url)) {
|
|
200
|
-
process.exit(run(process.argv.slice(2)));
|
|
201
|
-
}
|
|
202
|
-
//# sourceMappingURL=scope-record-intent-constraint.js.map
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { type HumanPresenceMintSeams } from "./human-presence-mint.js";
|
|
3
|
-
export interface ParsedArgs {
|
|
4
|
-
projectRoot: string;
|
|
5
|
-
xbriefPath: string;
|
|
6
|
-
actor: string;
|
|
7
|
-
kind: string;
|
|
8
|
-
mintedVia: string;
|
|
9
|
-
quiet: boolean;
|
|
10
|
-
confirm: boolean;
|
|
11
|
-
help?: boolean;
|
|
12
|
-
error?: string;
|
|
13
|
-
}
|
|
14
|
-
export declare function parseArgs(argv: string[]): ParsedArgs;
|
|
15
|
-
export declare function run(argv: string[], seams?: HumanPresenceMintSeams): number;
|
|
16
|
-
//# sourceMappingURL=scope-record-observable-scope.d.ts.map
|