@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
package/dist/hook-dispatch.d.ts
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { type HookEvent, type HookHost, type HookPayloadContext } from "@deftai/directive-core/hooks";
|
|
3
|
-
interface ParsedArgs {
|
|
4
|
-
host?: HookHost;
|
|
5
|
-
event?: HookEvent;
|
|
6
|
-
projectRoot?: string;
|
|
7
|
-
error?: string;
|
|
8
|
-
}
|
|
9
|
-
export interface HookDispatchCliSeams {
|
|
10
|
-
readonly readStdin?: () => string;
|
|
11
|
-
readonly writeOut?: (text: string) => void;
|
|
12
|
-
readonly writeErr?: (text: string) => void;
|
|
13
|
-
readonly cwd?: () => string;
|
|
14
|
-
/**
|
|
15
|
-
* Sleep between empty-stdin retry polls (#2864). Injected in tests so delayed
|
|
16
|
-
* payloads can be simulated without real wall-clock waits.
|
|
17
|
-
*/
|
|
18
|
-
readonly sleepMs?: (ms: number) => void;
|
|
19
|
-
/**
|
|
20
|
-
* Empty-stdin retry budget in ms (default {@link DEFAULT_STDIN_EMPTY_RETRY_MS}).
|
|
21
|
-
* Set `0` to disable retries (single read). Tests for true-empty paths often
|
|
22
|
-
* set this to 0 for speed; delayed-payload tests set a positive budget.
|
|
23
|
-
*/
|
|
24
|
-
readonly stdinEmptyRetryMs?: number;
|
|
25
|
-
/** Clock for empty-stdin deadline; defaults to `Date.now` (tests inject synthetic clocks). */
|
|
26
|
-
readonly nowMs?: () => number;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* How long to re-poll stdin after an empty first read before concluding the host
|
|
30
|
-
* sent nothing (#2864). Keeps well under Cursor's deposited `timeout: 5` while
|
|
31
|
-
* covering short non-blocking delivery races (reporter matrix rows K/L).
|
|
32
|
-
*/
|
|
33
|
-
export declare const DEFAULT_STDIN_EMPTY_RETRY_MS = 250;
|
|
34
|
-
/** Interval between empty-stdin re-polls while the retry budget remains. */
|
|
35
|
-
export declare const STDIN_EMPTY_RETRY_INTERVAL_MS = 25;
|
|
36
|
-
/**
|
|
37
|
-
* Read hook stdin with a short empty-read retry budget (#2864).
|
|
38
|
-
*
|
|
39
|
-
* A single `readFileSync(0)` on a non-blocking descriptor can return zero bytes
|
|
40
|
-
* before the host has attached a writer. That is indistinguishable from a true
|
|
41
|
-
* empty payload if we never re-poll. We re-read for up to `emptyRetryMs`; true
|
|
42
|
-
* empty (every poll empty through the budget) still yields empty for the deny
|
|
43
|
-
* path. Delayed payloads that arrive within the budget are accepted.
|
|
44
|
-
*/
|
|
45
|
-
export declare function readStdinHardened(readOnce: () => string, options?: {
|
|
46
|
-
emptyRetryMs?: number;
|
|
47
|
-
sleepMs?: (ms: number) => void;
|
|
48
|
-
nowMs?: () => number;
|
|
49
|
-
}): string;
|
|
50
|
-
export declare function parseArgs(argv: readonly string[]): ParsedArgs;
|
|
51
|
-
/** @deprecated Prefer ParsedHookPayload from @deftai/directive-core/hooks (#2950). */
|
|
52
|
-
export interface ParsedPayload {
|
|
53
|
-
readonly payload: unknown;
|
|
54
|
-
readonly context: HookPayloadContext;
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Parse host hook stdin into payload + context.
|
|
58
|
-
* Pure implementation lives in core classify (`parseHookStdin`); CLI re-exports
|
|
59
|
-
* for backward-compatible imports in tests (#2734 / #2738 / #2950).
|
|
60
|
-
*/
|
|
61
|
-
export declare function parsePayload(raw: string): ParsedPayload;
|
|
62
|
-
/**
|
|
63
|
-
* Provider-neutral hook dispatch CLI entry (`deft hook:dispatch` / `deft-hook`).
|
|
64
|
-
*
|
|
65
|
-
* ## Exit-code contract (#2864)
|
|
66
|
-
*
|
|
67
|
-
* | Exit | Meaning |
|
|
68
|
-
* |------|---------|
|
|
69
|
-
* | `0` | A host decision was rendered to stdout (allow **or** deny). Hosts must parse stdout; exit status does **not** encode the verdict. |
|
|
70
|
-
* | `2` | Argv / configuration error (unsupported host/event, missing flags, unrecognized args). |
|
|
71
|
-
*
|
|
72
|
-
* This process never returns `1` for a rendered verdict. Cursor `failClosed`
|
|
73
|
-
* deposits that report "exit code 1" are therefore process-level failures
|
|
74
|
-
* (crash, signal kill under host timeout, spawn environment), not `run()` deny
|
|
75
|
-
* paths. Empty-stdin denies still exit `0` with a Cursor JSON body carrying
|
|
76
|
-
* `code: "stdin-empty"`.
|
|
77
|
-
*/
|
|
78
|
-
export declare function run(argv: string[], seams?: HookDispatchCliSeams): number;
|
|
79
|
-
export {};
|
|
80
|
-
//# sourceMappingURL=hook-dispatch.d.ts.map
|
package/dist/hook-dispatch.js
DELETED
|
@@ -1,186 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { readFileSync } from "node:fs";
|
|
3
|
-
import { resolve } from "node:path";
|
|
4
|
-
import { fileURLToPath } from "node:url";
|
|
5
|
-
import { decideHook, hookPayloadTopLevelKeys, isHookEvent, isHookHost, mergeHookDispatchEnviron, normalizeHookProjectRoot, parseHookStdin, projectRootFromHookPayload, renderHostDecision, } from "@deftai/directive-core/hooks";
|
|
6
|
-
/**
|
|
7
|
-
* How long to re-poll stdin after an empty first read before concluding the host
|
|
8
|
-
* sent nothing (#2864). Keeps well under Cursor's deposited `timeout: 5` while
|
|
9
|
-
* covering short non-blocking delivery races (reporter matrix rows K/L).
|
|
10
|
-
*/
|
|
11
|
-
export const DEFAULT_STDIN_EMPTY_RETRY_MS = 250;
|
|
12
|
-
/** Interval between empty-stdin re-polls while the retry budget remains. */
|
|
13
|
-
export const STDIN_EMPTY_RETRY_INTERVAL_MS = 25;
|
|
14
|
-
function defaultSleepMs(ms) {
|
|
15
|
-
if (ms <= 0)
|
|
16
|
-
return;
|
|
17
|
-
try {
|
|
18
|
-
Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, ms);
|
|
19
|
-
}
|
|
20
|
-
catch {
|
|
21
|
-
const end = Date.now() + ms;
|
|
22
|
-
while (Date.now() < end) {
|
|
23
|
-
/* spin — last-resort fallback when Atomics.wait is unavailable */
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Read hook stdin with a short empty-read retry budget (#2864).
|
|
29
|
-
*
|
|
30
|
-
* A single `readFileSync(0)` on a non-blocking descriptor can return zero bytes
|
|
31
|
-
* before the host has attached a writer. That is indistinguishable from a true
|
|
32
|
-
* empty payload if we never re-poll. We re-read for up to `emptyRetryMs`; true
|
|
33
|
-
* empty (every poll empty through the budget) still yields empty for the deny
|
|
34
|
-
* path. Delayed payloads that arrive within the budget are accepted.
|
|
35
|
-
*/
|
|
36
|
-
export function readStdinHardened(readOnce, options = {}) {
|
|
37
|
-
const emptyRetryMs = options.emptyRetryMs ?? DEFAULT_STDIN_EMPTY_RETRY_MS;
|
|
38
|
-
const sleepMs = options.sleepMs ?? defaultSleepMs;
|
|
39
|
-
const nowMs = options.nowMs ?? (() => Date.now());
|
|
40
|
-
let raw = readOnce();
|
|
41
|
-
if (raw.trim().length > 0 || emptyRetryMs <= 0)
|
|
42
|
-
return raw;
|
|
43
|
-
const deadline = nowMs() + emptyRetryMs;
|
|
44
|
-
while (nowMs() < deadline) {
|
|
45
|
-
sleepMs(STDIN_EMPTY_RETRY_INTERVAL_MS);
|
|
46
|
-
raw = readOnce();
|
|
47
|
-
if (raw.trim().length > 0)
|
|
48
|
-
return raw;
|
|
49
|
-
}
|
|
50
|
-
return raw;
|
|
51
|
-
}
|
|
52
|
-
function takeValue(argv, index, flag) {
|
|
53
|
-
const token = argv[index];
|
|
54
|
-
const prefix = `${flag}=`;
|
|
55
|
-
if (token?.startsWith(prefix))
|
|
56
|
-
return { value: token.slice(prefix.length), next: index };
|
|
57
|
-
const value = argv[index + 1];
|
|
58
|
-
if (value === undefined)
|
|
59
|
-
return { next: index, error: `argument ${flag}: expected one argument` };
|
|
60
|
-
return { value, next: index + 1 };
|
|
61
|
-
}
|
|
62
|
-
export function parseArgs(argv) {
|
|
63
|
-
const parsed = {};
|
|
64
|
-
for (let i = 0; i < argv.length; i += 1) {
|
|
65
|
-
const token = argv[i];
|
|
66
|
-
if (token === "--host" || token?.startsWith("--host=")) {
|
|
67
|
-
const taken = takeValue(argv, i, "--host");
|
|
68
|
-
if (taken.error)
|
|
69
|
-
return { error: taken.error };
|
|
70
|
-
const value = taken.value ?? "";
|
|
71
|
-
if (!isHookHost(value)) {
|
|
72
|
-
return { error: `unsupported host: ${JSON.stringify(taken.value)}` };
|
|
73
|
-
}
|
|
74
|
-
parsed.host = value;
|
|
75
|
-
i = taken.next;
|
|
76
|
-
continue;
|
|
77
|
-
}
|
|
78
|
-
if (token === "--event" || token?.startsWith("--event=")) {
|
|
79
|
-
const taken = takeValue(argv, i, "--event");
|
|
80
|
-
if (taken.error)
|
|
81
|
-
return { error: taken.error };
|
|
82
|
-
const value = taken.value ?? "";
|
|
83
|
-
if (!isHookEvent(value)) {
|
|
84
|
-
return { error: `unsupported event: ${JSON.stringify(taken.value)}` };
|
|
85
|
-
}
|
|
86
|
-
parsed.event = value;
|
|
87
|
-
i = taken.next;
|
|
88
|
-
continue;
|
|
89
|
-
}
|
|
90
|
-
if (token === "--project-root" || token?.startsWith("--project-root=")) {
|
|
91
|
-
const taken = takeValue(argv, i, "--project-root");
|
|
92
|
-
if (taken.error)
|
|
93
|
-
return { error: taken.error };
|
|
94
|
-
parsed.projectRoot = taken.value;
|
|
95
|
-
i = taken.next;
|
|
96
|
-
continue;
|
|
97
|
-
}
|
|
98
|
-
return { error: `unrecognized argument: ${token}` };
|
|
99
|
-
}
|
|
100
|
-
if (parsed.host === undefined)
|
|
101
|
-
return { error: "--host is required" };
|
|
102
|
-
if (parsed.event === undefined)
|
|
103
|
-
return { error: "--event is required" };
|
|
104
|
-
return parsed;
|
|
105
|
-
}
|
|
106
|
-
/**
|
|
107
|
-
* Parse host hook stdin into payload + context.
|
|
108
|
-
* Pure implementation lives in core classify (`parseHookStdin`); CLI re-exports
|
|
109
|
-
* for backward-compatible imports in tests (#2734 / #2738 / #2950).
|
|
110
|
-
*/
|
|
111
|
-
export function parsePayload(raw) {
|
|
112
|
-
return parseHookStdin(raw);
|
|
113
|
-
}
|
|
114
|
-
/**
|
|
115
|
-
* Provider-neutral hook dispatch CLI entry (`deft hook:dispatch` / `deft-hook`).
|
|
116
|
-
*
|
|
117
|
-
* ## Exit-code contract (#2864)
|
|
118
|
-
*
|
|
119
|
-
* | Exit | Meaning |
|
|
120
|
-
* |------|---------|
|
|
121
|
-
* | `0` | A host decision was rendered to stdout (allow **or** deny). Hosts must parse stdout; exit status does **not** encode the verdict. |
|
|
122
|
-
* | `2` | Argv / configuration error (unsupported host/event, missing flags, unrecognized args). |
|
|
123
|
-
*
|
|
124
|
-
* This process never returns `1` for a rendered verdict. Cursor `failClosed`
|
|
125
|
-
* deposits that report "exit code 1" are therefore process-level failures
|
|
126
|
-
* (crash, signal kill under host timeout, spawn environment), not `run()` deny
|
|
127
|
-
* paths. Empty-stdin denies still exit `0` with a Cursor JSON body carrying
|
|
128
|
-
* `code: "stdin-empty"`.
|
|
129
|
-
*/
|
|
130
|
-
export function run(argv, seams = {}) {
|
|
131
|
-
const args = parseArgs(argv);
|
|
132
|
-
const writeOut = seams.writeOut ?? ((text) => process.stdout.write(text));
|
|
133
|
-
const writeErr = seams.writeErr ?? ((text) => process.stderr.write(text));
|
|
134
|
-
if (args.error !== undefined || args.host === undefined || args.event === undefined) {
|
|
135
|
-
writeErr(`${args.error ?? "invalid hook-dispatch arguments"}\n`);
|
|
136
|
-
return 2;
|
|
137
|
-
}
|
|
138
|
-
const readOnce = seams.readStdin ?? (() => readFileSync(0, "utf8"));
|
|
139
|
-
const rawStdin = readStdinHardened(readOnce, {
|
|
140
|
-
emptyRetryMs: seams.stdinEmptyRetryMs,
|
|
141
|
-
sleepMs: seams.sleepMs,
|
|
142
|
-
nowMs: seams.nowMs,
|
|
143
|
-
});
|
|
144
|
-
const cwd = (seams.cwd ?? process.cwd)();
|
|
145
|
-
const { payload, context: payloadContext } = parsePayload(rawStdin);
|
|
146
|
-
const projectRoot = normalizeHookProjectRoot(args.projectRoot ? resolve(args.projectRoot) : projectRootFromHookPayload(payload, cwd));
|
|
147
|
-
const environ = mergeHookDispatchEnviron(payload);
|
|
148
|
-
const decision = decideHook({
|
|
149
|
-
host: args.host,
|
|
150
|
-
event: args.event,
|
|
151
|
-
projectRoot,
|
|
152
|
-
payload,
|
|
153
|
-
payloadContext,
|
|
154
|
-
...(environ !== undefined ? { environ } : {}),
|
|
155
|
-
});
|
|
156
|
-
const rendered = renderHostDecision(args.host, decision);
|
|
157
|
-
if (rendered.length > 0)
|
|
158
|
-
writeOut(`${rendered}\n`);
|
|
159
|
-
// Force-kill allow must print the non-empty reason even when host allow wire is empty (#5281).
|
|
160
|
-
if (decision.code === "kill-force-ready" && decision.message.trim().length > 0) {
|
|
161
|
-
writeErr(`${decision.message}\n`);
|
|
162
|
-
}
|
|
163
|
-
if ((decision.code === "invalid-input" || decision.code === "stdin-empty") &&
|
|
164
|
-
args.host === "cursor") {
|
|
165
|
-
// Keys are already embedded in decision.message; stderr helps operators tailing logs.
|
|
166
|
-
const keys = hookPayloadTopLevelKeys(payload);
|
|
167
|
-
if (keys.length > 0) {
|
|
168
|
-
writeErr(`Directive hook diagnostic: payload top-level keys: ${keys.join(", ")}\n`);
|
|
169
|
-
}
|
|
170
|
-
else if (decision.code === "stdin-empty") {
|
|
171
|
-
writeErr("Directive hook diagnostic: stdin was empty after empty-read retry budget\n");
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
if (decision.code === "session-start-degraded")
|
|
175
|
-
writeErr(`${decision.message}\n`);
|
|
176
|
-
if (decision.code === "session-compact-rearm" ||
|
|
177
|
-
decision.code === "session-compact-rearm-degraded" ||
|
|
178
|
-
decision.code === "session-compact-noop") {
|
|
179
|
-
writeErr(`${decision.message}\n`);
|
|
180
|
-
}
|
|
181
|
-
return 0;
|
|
182
|
-
}
|
|
183
|
-
if (process.argv[1] !== undefined && fileURLToPath(import.meta.url) === process.argv[1]) {
|
|
184
|
-
process.exit(run(process.argv.slice(2)));
|
|
185
|
-
}
|
|
186
|
-
//# sourceMappingURL=hook-dispatch.js.map
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Env markers that indicate an agent/host/CI shell even when stdin reports a TTY
|
|
3
|
-
* (pseudo-terminal residual; #3110 Greptile). Presence refuses mint.
|
|
4
|
-
* Expanded for dogfood conf 5/5 — markers are fail-closed (any non-empty value).
|
|
5
|
-
*/
|
|
6
|
-
export declare const AUTHZ_AGENT_SHELL_ENV_MARKERS: readonly ["CLAUDECODE", "CLAUDE_CODE", "CLAUDE_CODE_ENTRYPOINT", "CURSOR_AGENT", "CURSOR_TRACE_ID", "CURSOR_SESSION_ID", "AIDER", "CONTINUE_CLI", "CODEX_SANDBOX", "CODEX_CI", "OPENAI_CODEX", "OPENCLAW", "OPENCLAW_STATE_DIR", "DEFT_PROBE_OPENCLAW", "DEFT_HOOK_HOST", "DEFT_AGENT_SHELL", "DEFT_AGENT_RUNTIME", "WARP_SESSION_ID", "WARP_HARNESS", "WARP_RUN_ID", "GEMINI_CLI", "AMP_CLI", "SWARM_AGENT", "AI_AGENT", "CI", "CONTINUOUS_INTEGRATION", "GITHUB_ACTIONS", "GITLAB_CI", "CIRCLECI", "BUILDKITE", "TRAVIS", "JENKINS_URL", "TEAMCITY_VERSION", "TF_BUILD", "APPVEYOR", "BITBUCKET_BUILD_NUMBER", "CODEBUILD_BUILD_ID"];
|
|
7
|
-
/** Phrase an operator must type on the controlling TTY after --confirm (#3110). */
|
|
8
|
-
export declare const AUTHZ_INTERACTIVE_CONFIRM_PHRASE = "mint";
|
|
9
|
-
/** Testable seams for TTY / agent-shell detection (#3110 / #3384). */
|
|
10
|
-
export interface HumanPresenceMintSeams {
|
|
11
|
-
/**
|
|
12
|
-
* When true, interactive human TTY is present.
|
|
13
|
-
* Default: both stdin and stdout report isTTY (pseudo-TTY residual; #3110).
|
|
14
|
-
*/
|
|
15
|
-
readonly isTty?: () => boolean;
|
|
16
|
-
/** Environ for agent-shell marker detection (default: process.env). */
|
|
17
|
-
readonly environ?: NodeJS.ProcessEnv;
|
|
18
|
-
/**
|
|
19
|
-
* True when a controlling terminal device is available (`/dev/tty` or `\\.\CONIN$`).
|
|
20
|
-
* Default: open/close the platform controlling terminal (fail-closed on error).
|
|
21
|
-
*/
|
|
22
|
-
readonly hasControllingTerminal?: () => boolean;
|
|
23
|
-
/**
|
|
24
|
-
* Read one interactive confirmation line from the operator (trimmed).
|
|
25
|
-
* Default: one line from the controlling terminal. Tests inject a fixed phrase.
|
|
26
|
-
*/
|
|
27
|
-
readonly readInteractiveConfirm?: () => string | null;
|
|
28
|
-
}
|
|
29
|
-
export declare function looksLikeAgentShell(environ: NodeJS.ProcessEnv): boolean;
|
|
30
|
-
/** Platform controlling-terminal path (`\\.\CONIN$` on win32, `/dev/tty` elsewhere). */
|
|
31
|
-
export declare function controllingTerminalPath(platform?: NodeJS.Platform): string;
|
|
32
|
-
/**
|
|
33
|
-
* Open flag for the platform controlling-terminal device (#3596 leftover).
|
|
34
|
-
*
|
|
35
|
-
* Win32 stays `r+` so the probe and phrase-read share one flag. The leftover
|
|
36
|
-
* path is the Windows device-namespace CONIN$ string, not bare CONIN$.
|
|
37
|
-
*/
|
|
38
|
-
export declare function controllingTerminalOpenFlag(platform?: NodeJS.Platform): "r" | "r+";
|
|
39
|
-
export declare function resolveHumanPresenceMintSeams(seams?: HumanPresenceMintSeams): Required<HumanPresenceMintSeams>;
|
|
40
|
-
/** Active UAT campaign id, or null when no lease is active. */
|
|
41
|
-
export declare function activeUatCampaignId(projectRoot: string): string | null;
|
|
42
|
-
/**
|
|
43
|
-
* While any UAT lease is active, refuse mint (#3110 / #3384).
|
|
44
|
-
*
|
|
45
|
-
* No multi-factor escape: TTY, `--confirm`, and typed phrase never authorize.
|
|
46
|
-
* Returns an exit code when blocked, or null when mint may continue.
|
|
47
|
-
*/
|
|
48
|
-
export declare function refuseMintWhileUatActive(verb: string, projectRoot: string): number | null;
|
|
49
|
-
/**
|
|
50
|
-
* Refuse non-interactive / agent-shell mint outside UAT (#3110 / #3384).
|
|
51
|
-
*
|
|
52
|
-
* Multi-factor human-presence gate (applies only when UAT lease is inactive):
|
|
53
|
-
* 1. No known agent/CI env markers
|
|
54
|
-
* 2. Interactive TTY (stdin + stdout isTTY)
|
|
55
|
-
* 3. Controlling terminal device present (`/dev/tty` / `\\.\CONIN$`)
|
|
56
|
-
* 4. Explicit argv `--confirm` (flag alone never enough)
|
|
57
|
-
* 5. Interactive typed phrase `mint` (argv --confirm alone never enough even on PTY)
|
|
58
|
-
*
|
|
59
|
-
* Fail-closed: if a real human interactive path cannot be proven, refuse mint.
|
|
60
|
-
* Returns an exit code when blocked, or null when the mutation may proceed.
|
|
61
|
-
*/
|
|
62
|
-
export declare function refuseNonInteractiveMint(input: {
|
|
63
|
-
readonly verb: string;
|
|
64
|
-
readonly confirm: boolean;
|
|
65
|
-
readonly isTty: () => boolean;
|
|
66
|
-
readonly environ: NodeJS.ProcessEnv;
|
|
67
|
-
readonly hasControllingTerminal: () => boolean;
|
|
68
|
-
readonly readInteractiveConfirm: () => string | null;
|
|
69
|
-
}): number | null;
|
|
70
|
-
//# sourceMappingURL=human-presence-mint.d.ts.map
|
|
@@ -1,204 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared #3110 human-presence mint gate (#3384).
|
|
3
|
-
*
|
|
4
|
-
* Used by `authz` mutating verbs and `scope:record-approved-scope`. Multi-factor
|
|
5
|
-
* human presence: interactive TTY + controlling terminal + `--confirm` + typed
|
|
6
|
-
* phrase `mint`. Agent/CI env markers refuse fail-closed. `--actor` is never
|
|
7
|
-
* an input here — display only at the caller.
|
|
8
|
-
*/
|
|
9
|
-
import { closeSync, openSync, readSync } from "node:fs";
|
|
10
|
-
import { loadAuthzState } from "@deftai/directive-core/authz";
|
|
11
|
-
/**
|
|
12
|
-
* Env markers that indicate an agent/host/CI shell even when stdin reports a TTY
|
|
13
|
-
* (pseudo-terminal residual; #3110 Greptile). Presence refuses mint.
|
|
14
|
-
* Expanded for dogfood conf 5/5 — markers are fail-closed (any non-empty value).
|
|
15
|
-
*/
|
|
16
|
-
export const AUTHZ_AGENT_SHELL_ENV_MARKERS = [
|
|
17
|
-
// Coding agents / IDEs
|
|
18
|
-
"CLAUDECODE",
|
|
19
|
-
"CLAUDE_CODE",
|
|
20
|
-
"CLAUDE_CODE_ENTRYPOINT",
|
|
21
|
-
"CURSOR_AGENT",
|
|
22
|
-
"CURSOR_TRACE_ID",
|
|
23
|
-
"CURSOR_SESSION_ID",
|
|
24
|
-
"AIDER",
|
|
25
|
-
"CONTINUE_CLI",
|
|
26
|
-
"CODEX_SANDBOX",
|
|
27
|
-
"CODEX_CI",
|
|
28
|
-
"OPENAI_CODEX",
|
|
29
|
-
"OPENCLAW",
|
|
30
|
-
"OPENCLAW_STATE_DIR",
|
|
31
|
-
"DEFT_PROBE_OPENCLAW",
|
|
32
|
-
"DEFT_HOOK_HOST",
|
|
33
|
-
"DEFT_AGENT_SHELL",
|
|
34
|
-
"DEFT_AGENT_RUNTIME",
|
|
35
|
-
"WARP_SESSION_ID",
|
|
36
|
-
"WARP_HARNESS",
|
|
37
|
-
"WARP_RUN_ID",
|
|
38
|
-
"GEMINI_CLI",
|
|
39
|
-
"AMP_CLI",
|
|
40
|
-
"SWARM_AGENT",
|
|
41
|
-
"AI_AGENT",
|
|
42
|
-
// CI / automation (never a human interactive operator mint)
|
|
43
|
-
"CI",
|
|
44
|
-
"CONTINUOUS_INTEGRATION",
|
|
45
|
-
"GITHUB_ACTIONS",
|
|
46
|
-
"GITLAB_CI",
|
|
47
|
-
"CIRCLECI",
|
|
48
|
-
"BUILDKITE",
|
|
49
|
-
"TRAVIS",
|
|
50
|
-
"JENKINS_URL",
|
|
51
|
-
"TEAMCITY_VERSION",
|
|
52
|
-
"TF_BUILD",
|
|
53
|
-
"APPVEYOR",
|
|
54
|
-
"BITBUCKET_BUILD_NUMBER",
|
|
55
|
-
"CODEBUILD_BUILD_ID",
|
|
56
|
-
];
|
|
57
|
-
/** Phrase an operator must type on the controlling TTY after --confirm (#3110). */
|
|
58
|
-
export const AUTHZ_INTERACTIVE_CONFIRM_PHRASE = "mint";
|
|
59
|
-
export function looksLikeAgentShell(environ) {
|
|
60
|
-
for (const key of AUTHZ_AGENT_SHELL_ENV_MARKERS) {
|
|
61
|
-
const v = environ[key];
|
|
62
|
-
if (v !== undefined && String(v).trim().length > 0)
|
|
63
|
-
return true;
|
|
64
|
-
}
|
|
65
|
-
return false;
|
|
66
|
-
}
|
|
67
|
-
function defaultIsTty() {
|
|
68
|
-
return process.stdin.isTTY === true && process.stdout.isTTY === true;
|
|
69
|
-
}
|
|
70
|
-
/** Platform controlling-terminal path (`\\.\CONIN$` on win32, `/dev/tty` elsewhere). */
|
|
71
|
-
export function controllingTerminalPath(platform = process.platform) {
|
|
72
|
-
// Real-console diagnostic on #3596: bare CONIN$ and CON ENOENT; device-namespace path opens.
|
|
73
|
-
return platform === "win32" ? "\\\\.\\CONIN$" : "/dev/tty";
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* Open flag for the platform controlling-terminal device (#3596 leftover).
|
|
77
|
-
*
|
|
78
|
-
* Win32 stays `r+` so the probe and phrase-read share one flag. The leftover
|
|
79
|
-
* path is the Windows device-namespace CONIN$ string, not bare CONIN$.
|
|
80
|
-
*/
|
|
81
|
-
export function controllingTerminalOpenFlag(platform = process.platform) {
|
|
82
|
-
return platform === "win32" ? "r+" : "r";
|
|
83
|
-
}
|
|
84
|
-
function defaultHasControllingTerminal() {
|
|
85
|
-
try {
|
|
86
|
-
const fd = openSync(controllingTerminalPath(), controllingTerminalOpenFlag());
|
|
87
|
-
closeSync(fd);
|
|
88
|
-
return true;
|
|
89
|
-
}
|
|
90
|
-
catch {
|
|
91
|
-
return false;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
function defaultReadInteractiveConfirm() {
|
|
95
|
-
// Read from the controlling terminal device — not redirected/piped stdin —
|
|
96
|
-
// so agent-controlled stdin alone cannot supply the confirm phrase (#3110).
|
|
97
|
-
let fd = null;
|
|
98
|
-
try {
|
|
99
|
-
fd = openSync(controllingTerminalPath(), controllingTerminalOpenFlag());
|
|
100
|
-
const buf = Buffer.alloc(256);
|
|
101
|
-
const n = readSync(fd, buf, 0, buf.length, null);
|
|
102
|
-
if (n <= 0)
|
|
103
|
-
return null;
|
|
104
|
-
return buf.subarray(0, n).toString("utf8").trim();
|
|
105
|
-
}
|
|
106
|
-
catch {
|
|
107
|
-
return null;
|
|
108
|
-
}
|
|
109
|
-
finally {
|
|
110
|
-
if (fd !== null) {
|
|
111
|
-
try {
|
|
112
|
-
closeSync(fd);
|
|
113
|
-
}
|
|
114
|
-
catch {
|
|
115
|
-
/* ignore */
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
export function resolveHumanPresenceMintSeams(seams = {}) {
|
|
121
|
-
return {
|
|
122
|
-
isTty: seams.isTty ?? defaultIsTty,
|
|
123
|
-
environ: seams.environ ?? process.env,
|
|
124
|
-
hasControllingTerminal: seams.hasControllingTerminal ?? defaultHasControllingTerminal,
|
|
125
|
-
readInteractiveConfirm: seams.readInteractiveConfirm ?? defaultReadInteractiveConfirm,
|
|
126
|
-
};
|
|
127
|
-
}
|
|
128
|
-
/** Active UAT campaign id, or null when no lease is active. */
|
|
129
|
-
export function activeUatCampaignId(projectRoot) {
|
|
130
|
-
const state = loadAuthzState(projectRoot);
|
|
131
|
-
if (state.uat === null || !state.uat.active)
|
|
132
|
-
return null;
|
|
133
|
-
return state.uat.campaignId;
|
|
134
|
-
}
|
|
135
|
-
/**
|
|
136
|
-
* While any UAT lease is active, refuse mint (#3110 / #3384).
|
|
137
|
-
*
|
|
138
|
-
* No multi-factor escape: TTY, `--confirm`, and typed phrase never authorize.
|
|
139
|
-
* Returns an exit code when blocked, or null when mint may continue.
|
|
140
|
-
*/
|
|
141
|
-
export function refuseMintWhileUatActive(verb, projectRoot) {
|
|
142
|
-
const campaignId = activeUatCampaignId(projectRoot);
|
|
143
|
-
if (campaignId === null)
|
|
144
|
-
return null;
|
|
145
|
-
process.stderr.write(`${verb}: refusing mint while UAT lease is ACTIVE (campaign=${campaignId}). ` +
|
|
146
|
-
"Under active UAT, mint is hard-refused — no TTY, --confirm, or phrase path " +
|
|
147
|
-
"authorizes remint (#3110 / #3384). Mint before uat-start; clear the lease " +
|
|
148
|
-
"out-of-band to end UAT.\n");
|
|
149
|
-
return 2;
|
|
150
|
-
}
|
|
151
|
-
/**
|
|
152
|
-
* Refuse non-interactive / agent-shell mint outside UAT (#3110 / #3384).
|
|
153
|
-
*
|
|
154
|
-
* Multi-factor human-presence gate (applies only when UAT lease is inactive):
|
|
155
|
-
* 1. No known agent/CI env markers
|
|
156
|
-
* 2. Interactive TTY (stdin + stdout isTTY)
|
|
157
|
-
* 3. Controlling terminal device present (`/dev/tty` / `\\.\CONIN$`)
|
|
158
|
-
* 4. Explicit argv `--confirm` (flag alone never enough)
|
|
159
|
-
* 5. Interactive typed phrase `mint` (argv --confirm alone never enough even on PTY)
|
|
160
|
-
*
|
|
161
|
-
* Fail-closed: if a real human interactive path cannot be proven, refuse mint.
|
|
162
|
-
* Returns an exit code when blocked, or null when the mutation may proceed.
|
|
163
|
-
*/
|
|
164
|
-
export function refuseNonInteractiveMint(input) {
|
|
165
|
-
const { verb, confirm } = input;
|
|
166
|
-
if (looksLikeAgentShell(input.environ)) {
|
|
167
|
-
process.stderr.write(`${verb}: refusing operator-cli stamp from an agent/host/CI shell ` +
|
|
168
|
-
`(detected agent or CI env marker). Mint requires a human interactive ` +
|
|
169
|
-
"TTY without agent-shell markers, plus --confirm and typed phrase (#3110).\n");
|
|
170
|
-
return 2;
|
|
171
|
-
}
|
|
172
|
-
const tty = input.isTty();
|
|
173
|
-
if (!tty && !confirm) {
|
|
174
|
-
process.stderr.write(`${verb}: refusing non-interactive operator-cli stamp. ` +
|
|
175
|
-
"Mint requires interactive TTY, --confirm, and typed phrase " +
|
|
176
|
-
`'${AUTHZ_INTERACTIVE_CONFIRM_PHRASE}' (#3110).\n`);
|
|
177
|
-
return 2;
|
|
178
|
-
}
|
|
179
|
-
if (!tty) {
|
|
180
|
-
process.stderr.write(`${verb}: refusing non-TTY operator-cli stamp. ` +
|
|
181
|
-
"--confirm alone never authorizes mint — interactive TTY is required (#3110).\n");
|
|
182
|
-
return 2;
|
|
183
|
-
}
|
|
184
|
-
if (!confirm) {
|
|
185
|
-
process.stderr.write(`${verb}: refusing operator-cli stamp without --confirm. ` +
|
|
186
|
-
"Interactive TTY alone never authorizes mint — pass --confirm explicitly (#3110).\n");
|
|
187
|
-
return 2;
|
|
188
|
-
}
|
|
189
|
-
if (!input.hasControllingTerminal()) {
|
|
190
|
-
process.stderr.write(`${verb}: refusing operator-cli stamp without a controlling terminal. ` +
|
|
191
|
-
"Open a real interactive console (not a headless/agent pipe) to mint (#3110).\n");
|
|
192
|
-
return 2;
|
|
193
|
-
}
|
|
194
|
-
process.stderr.write(`${verb}: type '${AUTHZ_INTERACTIVE_CONFIRM_PHRASE}' and press Enter to confirm operator mint: `);
|
|
195
|
-
const line = input.readInteractiveConfirm();
|
|
196
|
-
const phrase = (line ?? "").trim().toLowerCase();
|
|
197
|
-
if (phrase !== AUTHZ_INTERACTIVE_CONFIRM_PHRASE) {
|
|
198
|
-
process.stderr.write(`\n${verb}: interactive confirm phrase mismatch (got ${JSON.stringify(line ?? "")}). ` +
|
|
199
|
-
`Type exactly '${AUTHZ_INTERACTIVE_CONFIRM_PHRASE}' on the controlling TTY (#3110).\n`);
|
|
200
|
-
return 2;
|
|
201
|
-
}
|
|
202
|
-
return null;
|
|
203
|
-
}
|
|
204
|
-
//# sourceMappingURL=human-presence-mint.js.map
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export declare const CLI_PACKAGE: "@deftai/directive";
|
|
2
|
-
export interface IdentityBannerParts {
|
|
3
|
-
readonly cliVersion: string;
|
|
4
|
-
readonly engineName: string;
|
|
5
|
-
readonly engineVersion: string;
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* Display-both identity line. Engine semver is first so parseVersionFromOutput
|
|
9
|
-
* in active-cli.ts and classify.ts still treat --version as the engine.
|
|
10
|
-
*/
|
|
11
|
-
export declare function formatIdentityBanner(parts: IdentityBannerParts): string;
|
|
12
|
-
export declare function identityBanner(): string;
|
|
13
|
-
//# sourceMappingURL=identity-banner.d.ts.map
|
package/dist/identity-banner.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { engineInfo } from "@deftai/directive-core";
|
|
2
|
-
import { readCliPackageVersion } from "./cli-package-version.js";
|
|
3
|
-
export const CLI_PACKAGE = "@deftai/directive";
|
|
4
|
-
/**
|
|
5
|
-
* Display-both identity line. Engine semver is first so parseVersionFromOutput
|
|
6
|
-
* in active-cli.ts and classify.ts still treat --version as the engine.
|
|
7
|
-
*/
|
|
8
|
-
export function formatIdentityBanner(parts) {
|
|
9
|
-
return `${CLI_PACKAGE} (engine: ${parts.engineName}@${parts.engineVersion}; package: ${CLI_PACKAGE}@${parts.cliVersion})`;
|
|
10
|
-
}
|
|
11
|
-
export function identityBanner() {
|
|
12
|
-
const info = engineInfo();
|
|
13
|
-
return formatIdentityBanner({
|
|
14
|
-
cliVersion: readCliPackageVersion(),
|
|
15
|
-
engineName: info.name,
|
|
16
|
-
engineVersion: info.version,
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
//# sourceMappingURL=identity-banner.js.map
|
package/dist/index.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `@deftai/directive` — entrypoint for the deft directive TypeScript engine.
|
|
3
|
-
*
|
|
4
|
-
* Wave-1 skeleton (#1717): `banner()` spans the full dependency chain
|
|
5
|
-
* (cli → core → types), proving the project-reference graph builds and
|
|
6
|
-
* resolves end-to-end. Real commands land in later migration waves.
|
|
7
|
-
*/
|
|
8
|
-
export { CLI_PACKAGE } from "./identity-banner.js";
|
|
9
|
-
/** Renders CLI package and engine identity. First semver is the engine (#4766). */
|
|
10
|
-
export declare function banner(): string;
|
|
11
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { identityBanner } from "./identity-banner.js";
|
|
2
|
-
/**
|
|
3
|
-
* `@deftai/directive` — entrypoint for the deft directive TypeScript engine.
|
|
4
|
-
*
|
|
5
|
-
* Wave-1 skeleton (#1717): `banner()` spans the full dependency chain
|
|
6
|
-
* (cli → core → types), proving the project-reference graph builds and
|
|
7
|
-
* resolves end-to-end. Real commands land in later migration waves.
|
|
8
|
-
*/
|
|
9
|
-
export { CLI_PACKAGE } from "./identity-banner.js";
|
|
10
|
-
/** Renders CLI package and engine identity. First semver is the engine (#4766). */
|
|
11
|
-
export function banner() {
|
|
12
|
-
return identityBanner();
|
|
13
|
-
}
|
|
14
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/** Canonical headless install argv (#1339 / #1409 / getting-started.md). */
|
|
2
|
-
export declare const CANONICAL_INIT_ARGV: readonly ["--yes", "--repo-root", ".", "--json"];
|
|
3
|
-
/** Canonical headless upgrade argv (#1339 / #1409). */
|
|
4
|
-
export declare const CANONICAL_UPDATE_ARGV: readonly ["--yes", "--upgrade", "--repo-root", ".", "--json"];
|
|
5
|
-
/**
|
|
6
|
-
* Flags that make `directive update` classify + print its plan without executing
|
|
7
|
-
* the refresh (#2266). Recognised in the USER argv (never part of the canonical
|
|
8
|
-
* always-applied argv above, which must stay a real refresh).
|
|
9
|
-
*/
|
|
10
|
-
export declare const UPDATE_DRY_RUN_FLAGS: readonly ["--dry-run", "--plan"];
|
|
11
|
-
/**
|
|
12
|
-
* Flags that make `directive init` classify + print the dispatch plan without
|
|
13
|
-
* executing any deposit/refresh/migrate (#2265). Mirrors {@link UPDATE_DRY_RUN_FLAGS};
|
|
14
|
-
* recognised in the USER argv, never part of the canonical always-applied argv
|
|
15
|
-
* above (which must stay a real adoption dispatch).
|
|
16
|
-
*/
|
|
17
|
-
export declare const INIT_DRY_RUN_FLAGS: readonly ["--dry-run", "--plan"];
|
|
18
|
-
/**
|
|
19
|
-
* Flags that switch `directive init` into headless manifest-emit mode (#2268):
|
|
20
|
-
* serialise the merged keystone `plan()` into a `{ version, files }` manifest
|
|
21
|
-
* with ALL execution side effects suppressed. Recognised in the USER argv; NOT
|
|
22
|
-
* part of the canonical always-applied argv above (which must stay a real,
|
|
23
|
-
* executing adoption dispatch — a headless flag there would silently suppress
|
|
24
|
-
* every install's side effects).
|
|
25
|
-
*/
|
|
26
|
-
export declare const INIT_HEADLESS_FLAGS: readonly ["--headless", "/headless"];
|
|
27
|
-
/**
|
|
28
|
-
* Flag naming the manifest output target for `--headless` (#2268). Accepts the
|
|
29
|
-
* `--output=<path>` and `--output <path>` forms; when absent the manifest is
|
|
30
|
-
* written to stdout. Writing this file is the ONLY filesystem side effect the
|
|
31
|
-
* headless path is permitted to perform.
|
|
32
|
-
*/
|
|
33
|
-
export declare const INIT_OUTPUT_FLAGS: readonly ["--output", "/output"];
|
|
34
|
-
/** Canonical migrate argv: defaults to cwd, human-readable unless --json (#1941). */
|
|
35
|
-
export declare const CANONICAL_MIGRATE_ARGV: readonly ["--repo-root", "."];
|
|
36
|
-
/**
|
|
37
|
-
* Subcommand flag selecting the vendored→hybrid `.deft/core` un-commit (#2269).
|
|
38
|
-
* `migrate --untrack-core` dispatches to the destructive un-track path; bare
|
|
39
|
-
* `migrate` keeps its non-destructive provenance-stamp behavior.
|
|
40
|
-
*/
|
|
41
|
-
export declare const MIGRATE_UNTRACK_CORE_FLAG = "--untrack-core";
|
|
42
|
-
//# sourceMappingURL=constants.d.ts.map
|