@webpieces/ai-hook-rules 0.4.838 → 0.4.840
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -140
- package/package.json +7 -15
- package/src/adapters/hook-app-fixtures.d.ts +1 -1
- package/src/adapters/hook-app-fixtures.js +0 -8
- package/src/adapters/hook-app-fixtures.js.map +1 -1
- package/src/adapters/hook-core.d.ts +1 -21
- package/src/adapters/hook-core.js +22 -341
- package/src/adapters/hook-core.js.map +1 -1
- package/src/core/load-rules.d.ts +4 -39
- package/src/core/load-rules.js +15 -127
- package/src/core/load-rules.js.map +1 -1
- package/src/core/rules/catch-error-pattern.d.ts +3 -3
- package/src/core/rules/catch-error-pattern.js +13 -13
- package/src/core/rules/catch-error-pattern.js.map +1 -1
- package/src/core/rules/index.d.ts +1 -14
- package/src/core/rules/index.js +1 -17
- package/src/core/rules/index.js.map +1 -1
- package/src/core/rules/match-rule.d.ts +3 -3
- package/src/core/rules/match-rule.js +6 -6
- package/src/core/rules/match-rule.js.map +1 -1
- package/src/core/rules/max-file-lines.d.ts +3 -3
- package/src/core/rules/max-file-lines.js +7 -7
- package/src/core/rules/max-file-lines.js.map +1 -1
- package/src/core/rules/no-any-unknown.d.ts +3 -3
- package/src/core/rules/no-any-unknown.js +6 -6
- package/src/core/rules/no-any-unknown.js.map +1 -1
- package/src/core/rules/no-custom-css.d.ts +3 -3
- package/src/core/rules/no-custom-css.js +7 -7
- package/src/core/rules/no-custom-css.js.map +1 -1
- package/src/core/rules/no-destructure.d.ts +3 -3
- package/src/core/rules/no-destructure.js +7 -7
- package/src/core/rules/no-destructure.js.map +1 -1
- package/src/core/rules/no-implicit-any.d.ts +3 -3
- package/src/core/rules/no-implicit-any.js +6 -6
- package/src/core/rules/no-implicit-any.js.map +1 -1
- package/src/core/rules/no-js-files.d.ts +3 -3
- package/src/core/rules/no-js-files.js +6 -6
- package/src/core/rules/no-js-files.js.map +1 -1
- package/src/core/rules/no-process-exit-outside-main.d.ts +3 -3
- package/src/core/rules/no-process-exit-outside-main.js +7 -7
- package/src/core/rules/no-process-exit-outside-main.js.map +1 -1
- package/src/core/rules/no-symbol-di-tokens.d.ts +3 -3
- package/src/core/rules/no-symbol-di-tokens.js +7 -7
- package/src/core/rules/no-symbol-di-tokens.js.map +1 -1
- package/src/core/rules/no-unmanaged-exceptions.d.ts +3 -3
- package/src/core/rules/no-unmanaged-exceptions.js +9 -9
- package/src/core/rules/no-unmanaged-exceptions.js.map +1 -1
- package/src/core/rules/require-return-type.d.ts +3 -3
- package/src/core/rules/require-return-type.js +6 -6
- package/src/core/rules/require-return-type.js.map +1 -1
- package/src/core/rules/throw-cause-required.d.ts +3 -3
- package/src/core/rules/throw-cause-required.js +9 -9
- package/src/core/rules/throw-cause-required.js.map +1 -1
- package/src/core/rules/validate-ts-in-src.d.ts +3 -3
- package/src/core/rules/validate-ts-in-src.js +7 -7
- package/src/core/rules/validate-ts-in-src.js.map +1 -1
- package/src/core/runner.d.ts +10 -19
- package/src/core/runner.js +24 -622
- package/src/core/runner.js.map +1 -1
- package/src/index.d.ts +2 -15
- package/src/index.js +4 -54
- package/src/index.js.map +1 -1
- package/openclaw.plugin.json +0 -15
- package/src/adapters/agent-adapters.d.ts +0 -13
- package/src/adapters/agent-adapters.js +0 -23
- package/src/adapters/agent-adapters.js.map +0 -1
- package/src/adapters/agent-payload.d.ts +0 -48
- package/src/adapters/agent-payload.js +0 -30
- package/src/adapters/agent-payload.js.map +0 -1
- package/src/adapters/agent-response.d.ts +0 -5
- package/src/adapters/agent-response.js +0 -86
- package/src/adapters/agent-response.js.map +0 -1
- package/src/adapters/claude-code-adapter.d.ts +0 -26
- package/src/adapters/claude-code-adapter.js +0 -69
- package/src/adapters/claude-code-adapter.js.map +0 -1
- package/src/adapters/codex-adapter.d.ts +0 -19
- package/src/adapters/codex-adapter.js +0 -48
- package/src/adapters/codex-adapter.js.map +0 -1
- package/src/adapters/codex-subagent-guard.d.ts +0 -45
- package/src/adapters/codex-subagent-guard.js +0 -88
- package/src/adapters/codex-subagent-guard.js.map +0 -1
- package/src/adapters/detect-ai.d.ts +0 -70
- package/src/adapters/detect-ai.js +0 -82
- package/src/adapters/detect-ai.js.map +0 -1
- package/src/adapters/guards-hook.d.ts +0 -3
- package/src/adapters/guards-hook.js +0 -30
- package/src/adapters/guards-hook.js.map +0 -1
- package/src/adapters/openclaw-plugin.d.ts +0 -14
- package/src/adapters/openclaw-plugin.js +0 -87
- package/src/adapters/openclaw-plugin.js.map +0 -1
- package/src/adapters/review-identity-stamper.d.ts +0 -20
- package/src/adapters/review-identity-stamper.js +0 -34
- package/src/adapters/review-identity-stamper.js.map +0 -1
- package/src/bin/codex-trust.d.ts +0 -105
- package/src/bin/codex-trust.js +0 -205
- package/src/bin/codex-trust.js.map +0 -1
- package/src/bin/dev-hook-install.d.ts +0 -1
- package/src/bin/dev-hook-install.js +0 -82
- package/src/bin/dev-hook-install.js.map +0 -1
- package/src/bin/dev-hook-uninstall.d.ts +0 -1
- package/src/bin/dev-hook-uninstall.js +0 -45
- package/src/bin/dev-hook-uninstall.js.map +0 -1
- package/src/bin/hook-registration.d.ts +0 -429
- package/src/bin/hook-registration.js +0 -661
- package/src/bin/hook-registration.js.map +0 -1
- package/src/bin/install-entry.d.ts +0 -19
- package/src/bin/install-entry.js +0 -128
- package/src/bin/install-entry.js.map +0 -1
- package/src/bin/l0-allowlist.d.ts +0 -49
- package/src/bin/l0-allowlist.js +0 -528
- package/src/bin/l0-allowlist.js.map +0 -1
- package/src/bin/l0-codex-read.d.ts +0 -21
- package/src/bin/l0-codex-read.js +0 -109
- package/src/bin/l0-codex-read.js.map +0 -1
- package/src/bin/l0-decide.d.ts +0 -50
- package/src/bin/l0-decide.js +0 -103
- package/src/bin/l0-decide.js.map +0 -1
- package/src/bin/l0-entry.d.ts +0 -103
- package/src/bin/l0-entry.js +0 -98
- package/src/bin/l0-entry.js.map +0 -1
- package/src/bin/l0-ignored-tools.d.ts +0 -38
- package/src/bin/l0-ignored-tools.js +0 -44
- package/src/bin/l0-ignored-tools.js.map +0 -1
- package/src/bin/managed-env.d.ts +0 -46
- package/src/bin/managed-env.js +0 -50
- package/src/bin/managed-env.js.map +0 -1
- package/src/bin/neighbour-hooks.d.ts +0 -42
- package/src/bin/neighbour-hooks.js +0 -177
- package/src/bin/neighbour-hooks.js.map +0 -1
- package/src/bin/reviewer-agent.d.ts +0 -19
- package/src/bin/reviewer-agent.js +0 -135
- package/src/bin/reviewer-agent.js.map +0 -1
- package/src/bin/settings-shape.d.ts +0 -37
- package/src/bin/settings-shape.js +0 -17
- package/src/bin/settings-shape.js.map +0 -1
- package/src/bin/setup-config.d.ts +0 -19
- package/src/bin/setup-config.js +0 -370
- package/src/bin/setup-config.js.map +0 -1
- package/src/bin/setup.d.ts +0 -78
- package/src/bin/setup.js +0 -400
- package/src/bin/setup.js.map +0 -1
- package/src/bin/shim-audit-log.d.ts +0 -119
- package/src/bin/shim-audit-log.js +0 -286
- package/src/bin/shim-audit-log.js.map +0 -1
- package/src/bin/shim-deny-reason.d.ts +0 -1
- package/src/bin/shim-deny-reason.js +0 -244
- package/src/bin/shim-deny-reason.js.map +0 -1
- package/src/bin/shim-drift-fix.d.ts +0 -1
- package/src/bin/shim-drift-fix.js +0 -72
- package/src/bin/shim-drift-fix.js.map +0 -1
- package/src/bin/shim-testkit.d.ts +0 -107
- package/src/bin/shim-testkit.js +0 -197
- package/src/bin/shim-testkit.js.map +0 -1
- package/src/bin/shim-version-drift.d.ts +0 -1
- package/src/bin/shim-version-drift.js +0 -164
- package/src/bin/shim-version-drift.js.map +0 -1
- package/src/bin/shim.d.ts +0 -16
- package/src/bin/shim.js +0 -636
- package/src/bin/shim.js.map +0 -1
- package/src/bin/upgrade-shim.d.ts +0 -18
- package/src/bin/upgrade-shim.js +0 -283
- package/src/bin/upgrade-shim.js.map +0 -1
- package/src/core/ai-type-context.d.ts +0 -36
- package/src/core/ai-type-context.js +0 -45
- package/src/core/ai-type-context.js.map +0 -1
- package/src/core/apply-patch-parse.d.ts +0 -36
- package/src/core/apply-patch-parse.js +0 -154
- package/src/core/apply-patch-parse.js.map +0 -1
- package/src/core/build-context.d.ts +0 -10
- package/src/core/build-context.js +0 -66
- package/src/core/build-context.js.map +0 -1
- package/src/core/command-scan.d.ts +0 -122
- package/src/core/command-scan.js +0 -282
- package/src/core/command-scan.js.map +0 -1
- package/src/core/custom-rule-adapter.d.ts +0 -22
- package/src/core/custom-rule-adapter.js +0 -50
- package/src/core/custom-rule-adapter.js.map +0 -1
- package/src/core/decision-log.d.ts +0 -190
- package/src/core/decision-log.js +0 -406
- package/src/core/decision-log.js.map +0 -1
- package/src/core/delete-scoped-rules.d.ts +0 -8
- package/src/core/delete-scoped-rules.js +0 -31
- package/src/core/delete-scoped-rules.js.map +0 -1
- package/src/core/disable-directives.d.ts +0 -8
- package/src/core/disable-directives.js +0 -80
- package/src/core/disable-directives.js.map +0 -1
- package/src/core/effective-tree.d.ts +0 -204
- package/src/core/effective-tree.js +0 -277
- package/src/core/effective-tree.js.map +0 -1
- package/src/core/excluded-path-escape.d.ts +0 -101
- package/src/core/excluded-path-escape.js +0 -236
- package/src/core/excluded-path-escape.js.map +0 -1
- package/src/core/excluded-paths.d.ts +0 -23
- package/src/core/excluded-paths.js +0 -54
- package/src/core/excluded-paths.js.map +0 -1
- package/src/core/fix-hint.d.ts +0 -40
- package/src/core/fix-hint.js +0 -53
- package/src/core/fix-hint.js.map +0 -1
- package/src/core/force-to-root.d.ts +0 -32
- package/src/core/force-to-root.js +0 -60
- package/src/core/force-to-root.js.map +0 -1
- package/src/core/guard-index-doc.d.ts +0 -63
- package/src/core/guard-index-doc.js +0 -172
- package/src/core/guard-index-doc.js.map +0 -1
- package/src/core/instruct-ai-writer.d.ts +0 -1
- package/src/core/instruct-ai-writer.js +0 -6
- package/src/core/instruct-ai-writer.js.map +0 -1
- package/src/core/l0-fault-codes.d.ts +0 -85
- package/src/core/l0-fault-codes.js +0 -121
- package/src/core/l0-fault-codes.js.map +0 -1
- package/src/core/l0-matrix.d.ts +0 -114
- package/src/core/l0-matrix.js +0 -416
- package/src/core/l0-matrix.js.map +0 -1
- package/src/core/l0-tooling-doc.d.ts +0 -45
- package/src/core/l0-tooling-doc.js +0 -258
- package/src/core/l0-tooling-doc.js.map +0 -1
- package/src/core/l1-doc.d.ts +0 -7
- package/src/core/l1-doc.js +0 -340
- package/src/core/l1-doc.js.map +0 -1
- package/src/core/l1-matrix-doc.d.ts +0 -31
- package/src/core/l1-matrix-doc.js +0 -111
- package/src/core/l1-matrix-doc.js.map +0 -1
- package/src/core/l1-rows.d.ts +0 -167
- package/src/core/l1-rows.js +0 -262
- package/src/core/l1-rows.js.map +0 -1
- package/src/core/l2-doc.d.ts +0 -7
- package/src/core/l2-doc.js +0 -385
- package/src/core/l2-doc.js.map +0 -1
- package/src/core/l2-matrix-doc.d.ts +0 -23
- package/src/core/l2-matrix-doc.js +0 -72
- package/src/core/l2-matrix-doc.js.map +0 -1
- package/src/core/l2-row.d.ts +0 -54
- package/src/core/l2-row.js +0 -75
- package/src/core/l2-row.js.map +0 -1
- package/src/core/l2-rows.d.ts +0 -56
- package/src/core/l2-rows.js +0 -272
- package/src/core/l2-rows.js.map +0 -1
- package/src/core/load-config.d.ts +0 -1
- package/src/core/load-config.js +0 -9
- package/src/core/load-config.js.map +0 -1
- package/src/core/log-stream.d.ts +0 -117
- package/src/core/log-stream.js +0 -156
- package/src/core/log-stream.js.map +0 -1
- package/src/core/log-streams.d.ts +0 -48
- package/src/core/log-streams.js +0 -55
- package/src/core/log-streams.js.map +0 -1
- package/src/core/log-target.d.ts +0 -21
- package/src/core/log-target.js +0 -29
- package/src/core/log-target.js.map +0 -1
- package/src/core/main-sync-log.d.ts +0 -16
- package/src/core/main-sync-log.js +0 -105
- package/src/core/main-sync-log.js.map +0 -1
- package/src/core/main-sync-refresh.d.ts +0 -39
- package/src/core/main-sync-refresh.js +0 -96
- package/src/core/main-sync-refresh.js.map +0 -1
- package/src/core/main-sync-timeout.d.ts +0 -32
- package/src/core/main-sync-timeout.js +0 -94
- package/src/core/main-sync-timeout.js.map +0 -1
- package/src/core/matrix-cures.d.ts +0 -12
- package/src/core/matrix-cures.js +0 -56
- package/src/core/matrix-cures.js.map +0 -1
- package/src/core/missing-directory.d.ts +0 -38
- package/src/core/missing-directory.js +0 -66
- package/src/core/missing-directory.js.map +0 -1
- package/src/core/read-only-inspection.d.ts +0 -34
- package/src/core/read-only-inspection.js +0 -88
- package/src/core/read-only-inspection.js.map +0 -1
- package/src/core/rejection-log.d.ts +0 -9
- package/src/core/rejection-log.js +0 -258
- package/src/core/rejection-log.js.map +0 -1
- package/src/core/report.d.ts +0 -21
- package/src/core/report.js +0 -73
- package/src/core/report.js.map +0 -1
- package/src/core/rule-base.d.ts +0 -39
- package/src/core/rule-base.js +0 -36
- package/src/core/rule-base.js.map +0 -1
- package/src/core/rules/branch-creation-guard.d.ts +0 -113
- package/src/core/rules/branch-creation-guard.js +0 -422
- package/src/core/rules/branch-creation-guard.js.map +0 -1
- package/src/core/rules/branch-switch-scan.d.ts +0 -43
- package/src/core/rules/branch-switch-scan.js +0 -132
- package/src/core/rules/branch-switch-scan.js.map +0 -1
- package/src/core/rules/build-output-pipe-guard.d.ts +0 -56
- package/src/core/rules/build-output-pipe-guard.js +0 -120
- package/src/core/rules/build-output-pipe-guard.js.map +0 -1
- package/src/core/rules/build-output-pipe-scan.d.ts +0 -47
- package/src/core/rules/build-output-pipe-scan.js +0 -84
- package/src/core/rules/build-output-pipe-scan.js.map +0 -1
- package/src/core/rules/cap-remedies.d.ts +0 -39
- package/src/core/rules/cap-remedies.js +0 -59
- package/src/core/rules/cap-remedies.js.map +0 -1
- package/src/core/rules/commit-message-substitution-guard.d.ts +0 -72
- package/src/core/rules/commit-message-substitution-guard.js +0 -134
- package/src/core/rules/commit-message-substitution-guard.js.map +0 -1
- package/src/core/rules/commit-message-substitution-scan.d.ts +0 -42
- package/src/core/rules/commit-message-substitution-scan.js +0 -145
- package/src/core/rules/commit-message-substitution-scan.js.map +0 -1
- package/src/core/rules/content-read-scan.d.ts +0 -76
- package/src/core/rules/content-read-scan.js +0 -176
- package/src/core/rules/content-read-scan.js.map +0 -1
- package/src/core/rules/cure-prefix-scan.d.ts +0 -64
- package/src/core/rules/cure-prefix-scan.js +0 -133
- package/src/core/rules/cure-prefix-scan.js.map +0 -1
- package/src/core/rules/feature-branch-guard.d.ts +0 -121
- package/src/core/rules/feature-branch-guard.js +0 -326
- package/src/core/rules/feature-branch-guard.js.map +0 -1
- package/src/core/rules/judged-tree.d.ts +0 -66
- package/src/core/rules/judged-tree.js +0 -97
- package/src/core/rules/judged-tree.js.map +0 -1
- package/src/core/rules/main-freshness.d.ts +0 -37
- package/src/core/rules/main-freshness.js +0 -61
- package/src/core/rules/main-freshness.js.map +0 -1
- package/src/core/rules/merge-in-progress-guard.d.ts +0 -17
- package/src/core/rules/merge-in-progress-guard.js +0 -122
- package/src/core/rules/merge-in-progress-guard.js.map +0 -1
- package/src/core/rules/merged-branch-bash-guard.d.ts +0 -62
- package/src/core/rules/merged-branch-bash-guard.js +0 -170
- package/src/core/rules/merged-branch-bash-guard.js.map +0 -1
- package/src/core/rules/merged-branch-message.d.ts +0 -59
- package/src/core/rules/merged-branch-message.js +0 -137
- package/src/core/rules/merged-branch-message.js.map +0 -1
- package/src/core/rules/pr-creation-or-push-guard.d.ts +0 -26
- package/src/core/rules/pr-creation-or-push-guard.js +0 -146
- package/src/core/rules/pr-creation-or-push-guard.js.map +0 -1
- package/src/core/rules/pr-merge-guard.d.ts +0 -36
- package/src/core/rules/pr-merge-guard.js +0 -86
- package/src/core/rules/pr-merge-guard.js.map +0 -1
- package/src/core/rules/read-stale-guard.d.ts +0 -136
- package/src/core/rules/read-stale-guard.js +0 -326
- package/src/core/rules/read-stale-guard.js.map +0 -1
- package/src/core/rules/recovery-allowlist.d.ts +0 -49
- package/src/core/rules/recovery-allowlist.js +0 -187
- package/src/core/rules/recovery-allowlist.js.map +0 -1
- package/src/core/rules/redirect-how-to-merge-main.d.ts +0 -16
- package/src/core/rules/redirect-how-to-merge-main.js +0 -157
- package/src/core/rules/redirect-how-to-merge-main.js.map +0 -1
- package/src/core/rules/shell-segment-scan.d.ts +0 -64
- package/src/core/rules/shell-segment-scan.js +0 -88
- package/src/core/rules/shell-segment-scan.js.map +0 -1
- package/src/core/rules/stale-main-bash-guard.d.ts +0 -198
- package/src/core/rules/stale-main-bash-guard.js +0 -361
- package/src/core/rules/stale-main-bash-guard.js.map +0 -1
- package/src/core/rules/stale-main-message.d.ts +0 -62
- package/src/core/rules/stale-main-message.js +0 -102
- package/src/core/rules/stale-main-message.js.map +0 -1
- package/src/core/rules/tree-recovery.d.ts +0 -92
- package/src/core/rules/tree-recovery.js +0 -165
- package/src/core/rules/tree-recovery.js.map +0 -1
- package/src/core/rules/wait-spin-guard.d.ts +0 -128
- package/src/core/rules/wait-spin-guard.js +0 -211
- package/src/core/rules/wait-spin-guard.js.map +0 -1
- package/src/core/rules/wait-spin-scan.d.ts +0 -118
- package/src/core/rules/wait-spin-scan.js +0 -203
- package/src/core/rules/wait-spin-scan.js.map +0 -1
- package/src/core/rules/whole-repo-build-guard.d.ts +0 -125
- package/src/core/rules/whole-repo-build-guard.js +0 -257
- package/src/core/rules/whole-repo-build-guard.js.map +0 -1
- package/src/core/rules/whole-repo-build-scan.d.ts +0 -28
- package/src/core/rules/whole-repo-build-scan.js +0 -198
- package/src/core/rules/whole-repo-build-scan.js.map +0 -1
- package/src/core/session-call-history.d.ts +0 -44
- package/src/core/session-call-history.js +0 -79
- package/src/core/session-call-history.js.map +0 -1
- package/src/core/shell-read-parity.d.ts +0 -56
- package/src/core/shell-read-parity.js +0 -155
- package/src/core/shell-read-parity.js.map +0 -1
- package/src/core/strip-ts-noise.d.ts +0 -1
- package/src/core/strip-ts-noise.js +0 -185
- package/src/core/strip-ts-noise.js.map +0 -1
- package/src/core/sync-main.d.ts +0 -46
- package/src/core/sync-main.js +0 -175
- package/src/core/sync-main.js.map +0 -1
- package/src/core/target-tree.d.ts +0 -84
- package/src/core/target-tree.js +0 -148
- package/src/core/target-tree.js.map +0 -1
- package/src/core/to-error.d.ts +0 -5
- package/src/core/to-error.js +0 -37
- package/src/core/to-error.js.map +0 -1
- package/src/core/types.d.ts +0 -152
- package/src/core/types.js +0 -200
- package/src/core/types.js.map +0 -1
- package/src/core/version-sync.d.ts +0 -219
- package/src/core/version-sync.js +0 -558
- package/src/core/version-sync.js.map +0 -1
- package/src/core/webpieces-versions.d.ts +0 -98
- package/src/core/webpieces-versions.js +0 -206
- package/src/core/webpieces-versions.js.map +0 -1
- package/templates/ai-hook.sh +0 -497
- package/templates/claude-settings-hook.json +0 -28
- package/templates/webpieces-reviewer.md +0 -60
package/src/core/l1-rows.d.ts
DELETED
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
import type { TreeKind } from './effective-tree';
|
|
2
|
-
/**
|
|
3
|
-
* The K dimension as a CLASSIFICATION carries — one concrete tree, never the `pw` union.
|
|
4
|
-
*
|
|
5
|
-
* `p` and `w` are the same PROJECT and every rule-scoped guard treats them alike; the doc writes the
|
|
6
|
-
* pair as `pw` in the row's MATCHER (below), which is a different vocabulary on purpose.
|
|
7
|
-
*/
|
|
8
|
-
export type L1Kind = 'f' | 'm' | 'o' | 'p' | 'w';
|
|
9
|
-
/** The K value a ROW matches on. `pw` matches both `p` and `w`; `-` is the wildcard. */
|
|
10
|
-
export type L1KindMatch = 'f' | 'm' | 'o' | 'w' | 'pw' | '-';
|
|
11
|
-
/** R and G are yes/no, written `y`/`n` in the doc, with `-` for "does not matter". */
|
|
12
|
-
export type L1Flag = 'y' | 'n' | '-';
|
|
13
|
-
/**
|
|
14
|
-
* V is the same one boolean wearing the doc's own letters: `n` the webpieces versions do NOT agree
|
|
15
|
-
* between this worktree and the main tree, `y` they do.
|
|
16
|
-
*
|
|
17
|
-
* This dimension used to be A (`c` coordinator / `s` subagent). It was replaced rather than removed
|
|
18
|
-
* because agent identity was measured untrustworthy as a proxy for "which tree am I in" — a
|
|
19
|
-
* worktree-isolated agent auto-reaped at a turn boundary silently resumes on the primary clone. A
|
|
20
|
-
* version read off the PATH being acted on cannot lie in that way.
|
|
21
|
-
*/
|
|
22
|
-
export type L1VersionSync = 'y' | 'n' | '-';
|
|
23
|
-
/** What L1 does with a row. The labels are the doc's own action codebook (see GUARD_MATRIX.md). */
|
|
24
|
-
export type L1ActionKind = 'exempt' | 'down' | 'block';
|
|
25
|
-
/**
|
|
26
|
-
* WHICH structural block a blocking row dispatches to. This is the field that makes the array
|
|
27
|
-
* load-bearing rather than decorative: runner.l1LocationBlock looks the row up and switches on it,
|
|
28
|
-
* so deleting a row from the array removes the block.
|
|
29
|
-
*/
|
|
30
|
-
export type L1BlockId = 'trinary-version-skew' | 'force-to-root' | 'missing-directory';
|
|
31
|
-
/**
|
|
32
|
-
* The row number for L1's PRE-STAGE — `misplacedCdBlock`, which decides from command TEXT before a
|
|
33
|
-
* tree has been resolved, and therefore cannot be classified over the five dimensions rows 1-6 use
|
|
34
|
-
* (asking L1_ROWS to classify it would need the very resolution its answer determines).
|
|
35
|
-
*
|
|
36
|
-
* ZERO rather than a seventh row, deliberately. It has to appear in the table — an L1 block the
|
|
37
|
-
* generated doc did not describe is precisely the drift the table exists to prevent, and it was
|
|
38
|
-
* carrying a `KNOWN GAP` comment saying so. But numbering it 7 would assert it sits in the same
|
|
39
|
-
* first-match scan as the others, which is the one thing that is not true about it. Row 0 says
|
|
40
|
-
* "decided before the scan" in the number itself. `renderL1Doc()` PRINTS this row above the six, so
|
|
41
|
-
* `row=0` in the L1 log joins to a line the reader can actually find.
|
|
42
|
-
*/
|
|
43
|
-
export declare const L1_PRESTAGE_ROW = "0";
|
|
44
|
-
/**
|
|
45
|
-
* One point in the five-dimensional space L1 classifies over. Data-only → a class, per CLAUDE.md.
|
|
46
|
-
*
|
|
47
|
-
* The dimensions are exactly the doc's legend: K (tree kind of the resolved target), V (webpieces versions in sync or
|
|
48
|
-
* subagent), R (provably read-only inspection), G (invokes git/gh), P (root or subdirectory).
|
|
49
|
-
*/
|
|
50
|
-
export declare class L1Classification {
|
|
51
|
-
readonly kind: L1Kind;
|
|
52
|
-
readonly versionsSkewed: boolean;
|
|
53
|
-
readonly readOnly: boolean;
|
|
54
|
-
readonly git: boolean;
|
|
55
|
-
readonly atRoot: boolean;
|
|
56
|
-
constructor(kind: L1Kind, versionsSkewed: boolean, readOnly: boolean, git: boolean, atRoot: boolean);
|
|
57
|
-
/**
|
|
58
|
-
* The classification the RUNNER enforces on, built from the resolved tree and the caller.
|
|
59
|
-
*
|
|
60
|
-
* `'outside'` maps to `p`, and that is not a typo. TreeKind `'outside'` is produced by
|
|
61
|
-
* effective-tree.ts (git has no answer for the directory) and consumed NOWHERE, so a command in no git repo is
|
|
62
|
-
* judged against the governed repo exactly as if it stood in it. Row 2 (`o` → L2) describes what
|
|
63
|
-
* SHOULD happen and is deliberately unreachable from here until the "Not done" fix in
|
|
64
|
-
* guards/L1-location.md lands — exempting `o` alone opens a `cd /tmp &&` bypass of every L2 guard,
|
|
65
|
-
* so the two ship together or neither does. Mapping it to `p` here is what preserves today's
|
|
66
|
-
* behaviour (a `git` command from /tmp is still force-to-root blocked); it is not an endorsement.
|
|
67
|
-
*/
|
|
68
|
-
static forEnforcement(treeKind: TreeKind, versionsSkewed: boolean, readOnly: boolean, git: boolean, atRoot: boolean): L1Classification;
|
|
69
|
-
}
|
|
70
|
-
/** The `act` cell of a row: the doc's literal label, plus the machine-readable kind behind it. */
|
|
71
|
-
export declare class L1Action {
|
|
72
|
-
readonly label: string;
|
|
73
|
-
readonly kind: L1ActionKind;
|
|
74
|
-
constructor(label: string, kind: L1ActionKind);
|
|
75
|
-
}
|
|
76
|
-
export declare const ACT_EXEMPT: L1Action;
|
|
77
|
-
export declare const ACT_DOWN: L1Action;
|
|
78
|
-
export declare const ACT_BLOCK: L1Action;
|
|
79
|
-
/**
|
|
80
|
-
* The CURE a blocking row prescribes.
|
|
81
|
-
*
|
|
82
|
-
* `runnable` is the axis that matters to the tests: a cure that is a command must, once applied,
|
|
83
|
-
* actually stop the row from matching (cure reachability). Row 3's cure is an INSTRUCTION — "spawn a
|
|
84
|
-
* subagent bound to the worktree" — which no allowlist can accept and no reclassification can model,
|
|
85
|
-
* so it declares `runnable: false` and is asserted only on the deny text.
|
|
86
|
-
*/
|
|
87
|
-
export declare class L1Cure {
|
|
88
|
-
/** How the doc's `why` column spells it. */
|
|
89
|
-
readonly summary: string;
|
|
90
|
-
/** A substring that MUST appear in the deny text the guard emits for this row. */
|
|
91
|
-
readonly denyMention: string;
|
|
92
|
-
readonly runnable: boolean;
|
|
93
|
-
constructor(
|
|
94
|
-
/** How the doc's `why` column spells it. */
|
|
95
|
-
summary: string,
|
|
96
|
-
/** A substring that MUST appear in the deny text the guard emits for this row. */
|
|
97
|
-
denyMention: string, runnable: boolean);
|
|
98
|
-
}
|
|
99
|
-
/**
|
|
100
|
-
* One row of the "L1 use cases" table: what you SEE, the state it puts you in, the verdict, the fix.
|
|
101
|
-
*
|
|
102
|
-
* The four text fields are rendered VERBATIM into the doc. `classification` is the same case expressed
|
|
103
|
-
* in the matrix's own vocabulary so the tests can run it through the matcher — it is test/enforcement
|
|
104
|
-
* data, never rendered, which is why a use case that exercises the FILTER or the L0 allowlist (neither
|
|
105
|
-
* of which is a row) can carry `null` there.
|
|
106
|
-
*/
|
|
107
|
-
export declare class L1UseCase {
|
|
108
|
-
readonly num: number;
|
|
109
|
-
readonly symptom: string;
|
|
110
|
-
readonly state: string;
|
|
111
|
-
readonly verdict: string;
|
|
112
|
-
readonly fix: string;
|
|
113
|
-
readonly classification: L1Classification | null;
|
|
114
|
-
constructor(num: number, symptom: string, state: string, verdict: string, fix: string, classification?: L1Classification | null);
|
|
115
|
-
}
|
|
116
|
-
/** One row of L1's decision table. Data-only → a class, per CLAUDE.md. */
|
|
117
|
-
export declare class L1Row {
|
|
118
|
-
readonly num: number;
|
|
119
|
-
readonly k: L1KindMatch;
|
|
120
|
-
readonly a: L1VersionSync;
|
|
121
|
-
readonly r: L1Flag;
|
|
122
|
-
readonly g: L1Flag;
|
|
123
|
-
readonly p: 'root' | 'sub' | '-';
|
|
124
|
-
readonly action: L1Action;
|
|
125
|
-
/** The `why` cell, verbatim. */
|
|
126
|
-
readonly why: string;
|
|
127
|
-
readonly cure: L1Cure | null;
|
|
128
|
-
readonly blockId: L1BlockId | null;
|
|
129
|
-
readonly useCases: readonly L1UseCase[];
|
|
130
|
-
constructor(num: number, k: L1KindMatch, a: L1VersionSync, r: L1Flag, g: L1Flag, p: 'root' | 'sub' | '-', action: L1Action,
|
|
131
|
-
/** The `why` cell, verbatim. */
|
|
132
|
-
why: string, cure: L1Cure | null, blockId: L1BlockId | null, useCases: readonly L1UseCase[]);
|
|
133
|
-
matches(c: L1Classification): boolean;
|
|
134
|
-
private kindMatches;
|
|
135
|
-
}
|
|
136
|
-
/**
|
|
137
|
-
* THE seven L1 rows, in first-match-wins order.
|
|
138
|
-
*
|
|
139
|
-
* Rows 3, 5 and 7 are the structural blocks and they run as ONE step (runner.l1LocationBlock) so they
|
|
140
|
-
* can never be reordered by accident. Every other row is a hand-down or an exemption, i.e. "L1 has no
|
|
141
|
-
* objection" — which is why only those three carry a blockId.
|
|
142
|
-
*
|
|
143
|
-
* Row 7 (`m`, the vanished directory) sits LAST only because row numbers are stable across releases —
|
|
144
|
-
* they are printed in the doc and logged as `row=`, so renumbering rows 1-6 to slot it in front would
|
|
145
|
-
* silently invalidate every existing reference. Position costs nothing here: `m` is matched by no other
|
|
146
|
-
* row, so first-match reaches it wherever it sits.
|
|
147
|
-
*/
|
|
148
|
-
export declare const L1_ROWS: readonly L1Row[];
|
|
149
|
-
/**
|
|
150
|
-
* The use cases that exercise something that is NOT a row: the excludePaths FILTER (2, 3, 4, 20) and the
|
|
151
|
-
* L0 allowlist that runs ahead of L1 (15).
|
|
152
|
-
*
|
|
153
|
-
* They are use cases of L1 all the same — "exempt" is what emerges when the filter empties the rule
|
|
154
|
-
* list, and case 15 is the invariant that a cure stays reachable from every tree — so they stay in the
|
|
155
|
-
* doc's one numbered table. They carry no classification because no row classifies them.
|
|
156
|
-
*/
|
|
157
|
-
export declare const L1_UNROWED_USE_CASES: readonly L1UseCase[];
|
|
158
|
-
/** Every use case, in the doc's numbering — the order the table is rendered and read in. */
|
|
159
|
-
export declare function allL1UseCases(): readonly L1UseCase[];
|
|
160
|
-
/**
|
|
161
|
-
* FIRST MATCH WINS — the one lookup the guard and the tests share.
|
|
162
|
-
*
|
|
163
|
-
* Never null: rows 1, 2 and 4/5/6 between them cover every kind, and rows 4/5/6 partition G × P, so a
|
|
164
|
-
* classification that matched nothing would be a hole in the matrix. The totality test asserts exactly
|
|
165
|
-
* that, which is why this returns L1Row rather than L1Row | null.
|
|
166
|
-
*/
|
|
167
|
-
export declare function firstMatchingL1Row(c: L1Classification): L1Row;
|
package/src/core/l1-rows.js
DELETED
|
@@ -1,262 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.L1_UNROWED_USE_CASES = exports.L1_ROWS = exports.L1Row = exports.L1UseCase = exports.L1Cure = exports.ACT_BLOCK = exports.ACT_DOWN = exports.ACT_EXEMPT = exports.L1Action = exports.L1Classification = exports.L1_PRESTAGE_ROW = void 0;
|
|
4
|
-
exports.allL1UseCases = allL1UseCases;
|
|
5
|
-
exports.firstMatchingL1Row = firstMatchingL1Row;
|
|
6
|
-
/**
|
|
7
|
-
* The row number for L1's PRE-STAGE — `misplacedCdBlock`, which decides from command TEXT before a
|
|
8
|
-
* tree has been resolved, and therefore cannot be classified over the five dimensions rows 1-6 use
|
|
9
|
-
* (asking L1_ROWS to classify it would need the very resolution its answer determines).
|
|
10
|
-
*
|
|
11
|
-
* ZERO rather than a seventh row, deliberately. It has to appear in the table — an L1 block the
|
|
12
|
-
* generated doc did not describe is precisely the drift the table exists to prevent, and it was
|
|
13
|
-
* carrying a `KNOWN GAP` comment saying so. But numbering it 7 would assert it sits in the same
|
|
14
|
-
* first-match scan as the others, which is the one thing that is not true about it. Row 0 says
|
|
15
|
-
* "decided before the scan" in the number itself. `renderL1Doc()` PRINTS this row above the six, so
|
|
16
|
-
* `row=0` in the L1 log joins to a line the reader can actually find.
|
|
17
|
-
*/
|
|
18
|
-
exports.L1_PRESTAGE_ROW = '0';
|
|
19
|
-
/**
|
|
20
|
-
* One point in the five-dimensional space L1 classifies over. Data-only → a class, per CLAUDE.md.
|
|
21
|
-
*
|
|
22
|
-
* The dimensions are exactly the doc's legend: K (tree kind of the resolved target), V (webpieces versions in sync or
|
|
23
|
-
* subagent), R (provably read-only inspection), G (invokes git/gh), P (root or subdirectory).
|
|
24
|
-
*/
|
|
25
|
-
class L1Classification {
|
|
26
|
-
kind;
|
|
27
|
-
versionsSkewed;
|
|
28
|
-
readOnly;
|
|
29
|
-
git;
|
|
30
|
-
atRoot;
|
|
31
|
-
// eslint-disable-next-line @typescript-eslint/max-params -- five dimensions is the matrix's shape
|
|
32
|
-
constructor(kind, versionsSkewed, readOnly, git, atRoot) {
|
|
33
|
-
this.kind = kind;
|
|
34
|
-
this.versionsSkewed = versionsSkewed;
|
|
35
|
-
this.readOnly = readOnly;
|
|
36
|
-
this.git = git;
|
|
37
|
-
this.atRoot = atRoot;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* The classification the RUNNER enforces on, built from the resolved tree and the caller.
|
|
41
|
-
*
|
|
42
|
-
* `'outside'` maps to `p`, and that is not a typo. TreeKind `'outside'` is produced by
|
|
43
|
-
* effective-tree.ts (git has no answer for the directory) and consumed NOWHERE, so a command in no git repo is
|
|
44
|
-
* judged against the governed repo exactly as if it stood in it. Row 2 (`o` → L2) describes what
|
|
45
|
-
* SHOULD happen and is deliberately unreachable from here until the "Not done" fix in
|
|
46
|
-
* guards/L1-location.md lands — exempting `o` alone opens a `cd /tmp &&` bypass of every L2 guard,
|
|
47
|
-
* so the two ship together or neither does. Mapping it to `p` here is what preserves today's
|
|
48
|
-
* behaviour (a `git` command from /tmp is still force-to-root blocked); it is not an endorsement.
|
|
49
|
-
*/
|
|
50
|
-
// eslint-disable-next-line @typescript-eslint/max-params -- mirrors the constructor it delegates to
|
|
51
|
-
// webpieces-disable no-function-outside-class -- a named constructor for this data class, not a service: it takes the runner's TreeKind and returns the same class, so there is nothing to inject
|
|
52
|
-
static forEnforcement(treeKind, versionsSkewed, readOnly, git, atRoot) {
|
|
53
|
-
const kind = treeKind === 'foreign' ? 'f'
|
|
54
|
-
: treeKind === 'missing' ? 'm'
|
|
55
|
-
: treeKind === 'worktree' ? 'w' : 'p';
|
|
56
|
-
return new L1Classification(kind, versionsSkewed, readOnly, git, atRoot);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
exports.L1Classification = L1Classification;
|
|
60
|
-
/** The `act` cell of a row: the doc's literal label, plus the machine-readable kind behind it. */
|
|
61
|
-
class L1Action {
|
|
62
|
-
label;
|
|
63
|
-
kind;
|
|
64
|
-
constructor(label, kind) {
|
|
65
|
-
this.label = label;
|
|
66
|
-
this.kind = kind;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
exports.L1Action = L1Action;
|
|
70
|
-
exports.ACT_EXEMPT = new L1Action('2 exempt', 'exempt');
|
|
71
|
-
exports.ACT_DOWN = new L1Action('→ L2', 'down');
|
|
72
|
-
exports.ACT_BLOCK = new L1Action('4 block', 'block');
|
|
73
|
-
/**
|
|
74
|
-
* The CURE a blocking row prescribes.
|
|
75
|
-
*
|
|
76
|
-
* `runnable` is the axis that matters to the tests: a cure that is a command must, once applied,
|
|
77
|
-
* actually stop the row from matching (cure reachability). Row 3's cure is an INSTRUCTION — "spawn a
|
|
78
|
-
* subagent bound to the worktree" — which no allowlist can accept and no reclassification can model,
|
|
79
|
-
* so it declares `runnable: false` and is asserted only on the deny text.
|
|
80
|
-
*/
|
|
81
|
-
class L1Cure {
|
|
82
|
-
summary;
|
|
83
|
-
denyMention;
|
|
84
|
-
runnable;
|
|
85
|
-
constructor(
|
|
86
|
-
/** How the doc's `why` column spells it. */
|
|
87
|
-
summary,
|
|
88
|
-
/** A substring that MUST appear in the deny text the guard emits for this row. */
|
|
89
|
-
denyMention, runnable) {
|
|
90
|
-
this.summary = summary;
|
|
91
|
-
this.denyMention = denyMention;
|
|
92
|
-
this.runnable = runnable;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
exports.L1Cure = L1Cure;
|
|
96
|
-
/**
|
|
97
|
-
* One row of the "L1 use cases" table: what you SEE, the state it puts you in, the verdict, the fix.
|
|
98
|
-
*
|
|
99
|
-
* The four text fields are rendered VERBATIM into the doc. `classification` is the same case expressed
|
|
100
|
-
* in the matrix's own vocabulary so the tests can run it through the matcher — it is test/enforcement
|
|
101
|
-
* data, never rendered, which is why a use case that exercises the FILTER or the L0 allowlist (neither
|
|
102
|
-
* of which is a row) can carry `null` there.
|
|
103
|
-
*/
|
|
104
|
-
class L1UseCase {
|
|
105
|
-
num;
|
|
106
|
-
symptom;
|
|
107
|
-
state;
|
|
108
|
-
verdict;
|
|
109
|
-
fix;
|
|
110
|
-
classification;
|
|
111
|
-
// eslint-disable-next-line @typescript-eslint/max-params -- four verbatim doc cells plus the classification behind them
|
|
112
|
-
constructor(num, symptom, state, verdict, fix, classification = null) {
|
|
113
|
-
this.num = num;
|
|
114
|
-
this.symptom = symptom;
|
|
115
|
-
this.state = state;
|
|
116
|
-
this.verdict = verdict;
|
|
117
|
-
this.fix = fix;
|
|
118
|
-
this.classification = classification;
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
exports.L1UseCase = L1UseCase;
|
|
122
|
-
/** One row of L1's decision table. Data-only → a class, per CLAUDE.md. */
|
|
123
|
-
class L1Row {
|
|
124
|
-
num;
|
|
125
|
-
k;
|
|
126
|
-
a;
|
|
127
|
-
r;
|
|
128
|
-
g;
|
|
129
|
-
p;
|
|
130
|
-
action;
|
|
131
|
-
why;
|
|
132
|
-
cure;
|
|
133
|
-
blockId;
|
|
134
|
-
useCases;
|
|
135
|
-
// eslint-disable-next-line @typescript-eslint/max-params -- five dimension cells plus act/why/cure/blockId/useCases
|
|
136
|
-
constructor(num, k, a, r, g, p, action,
|
|
137
|
-
/** The `why` cell, verbatim. */
|
|
138
|
-
why, cure, blockId, useCases) {
|
|
139
|
-
this.num = num;
|
|
140
|
-
this.k = k;
|
|
141
|
-
this.a = a;
|
|
142
|
-
this.r = r;
|
|
143
|
-
this.g = g;
|
|
144
|
-
this.p = p;
|
|
145
|
-
this.action = action;
|
|
146
|
-
this.why = why;
|
|
147
|
-
this.cure = cure;
|
|
148
|
-
this.blockId = blockId;
|
|
149
|
-
this.useCases = useCases;
|
|
150
|
-
}
|
|
151
|
-
matches(c) {
|
|
152
|
-
if (!this.kindMatches(c.kind))
|
|
153
|
-
return false;
|
|
154
|
-
if (this.a !== '-' && (this.a === 'n') !== c.versionsSkewed)
|
|
155
|
-
return false;
|
|
156
|
-
if (!flagMatches(this.r, c.readOnly))
|
|
157
|
-
return false;
|
|
158
|
-
if (!flagMatches(this.g, c.git))
|
|
159
|
-
return false;
|
|
160
|
-
return this.p === '-' || this.p === (c.atRoot ? 'root' : 'sub');
|
|
161
|
-
}
|
|
162
|
-
kindMatches(kind) {
|
|
163
|
-
if (this.k === '-')
|
|
164
|
-
return true;
|
|
165
|
-
if (this.k === 'pw')
|
|
166
|
-
return kind === 'p' || kind === 'w';
|
|
167
|
-
return this.k === kind;
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
exports.L1Row = L1Row;
|
|
171
|
-
// R and G are one boolean each behind a `y`/`n`/`-` cell, so one helper answers for both. (A is the
|
|
172
|
-
// same shape but spelled `c`/`s`, and is matched inline above so the row literals read like the doc.)
|
|
173
|
-
// webpieces-disable no-function-outside-class -- pure predicate for L1Row.matches above, in this data module
|
|
174
|
-
function flagMatches(cell, value) {
|
|
175
|
-
if (cell === '-')
|
|
176
|
-
return true;
|
|
177
|
-
return (cell === 'y') === value;
|
|
178
|
-
}
|
|
179
|
-
/**
|
|
180
|
-
* THE seven L1 rows, in first-match-wins order.
|
|
181
|
-
*
|
|
182
|
-
* Rows 3, 5 and 7 are the structural blocks and they run as ONE step (runner.l1LocationBlock) so they
|
|
183
|
-
* can never be reordered by accident. Every other row is a hand-down or an exemption, i.e. "L1 has no
|
|
184
|
-
* objection" — which is why only those three carry a blockId.
|
|
185
|
-
*
|
|
186
|
-
* Row 7 (`m`, the vanished directory) sits LAST only because row numbers are stable across releases —
|
|
187
|
-
* they are printed in the doc and logged as `row=`, so renumbering rows 1-6 to slot it in front would
|
|
188
|
-
* silently invalidate every existing reference. Position costs nothing here: `m` is matched by no other
|
|
189
|
-
* row, so first-match reaches it wherever it sits.
|
|
190
|
-
*/
|
|
191
|
-
exports.L1_ROWS = [
|
|
192
|
-
new L1Row(1, 'f', '-', '-', '-', '-', exports.ACT_EXEMPT, 'different git repo — hands off', null, null, [
|
|
193
|
-
new L1UseCase(1, '`cd repositories/vendored && git commit` goes through untouched', '`f` / `y` / - — row 1', 'ALLOW_EXEMPT', 'none needed — jurisdiction is judged on the RESOLVED target, after the `cd`; a different git repo is hands-off', new L1Classification('f', false, false, true, false)),
|
|
194
|
-
]),
|
|
195
|
-
new L1Row(2, 'o', '-', '-', '-', '-', exports.ACT_DOWN, 'see "Not done" below', null, null, []),
|
|
196
|
-
// ROW 3 IS RETIRED — it was coordinator-in-worktree, deleted with CoordinatorWorktreeGuard when the
|
|
197
|
-
// guard hooks went ABSOLUTE (one governor, so the filesystem/governance split it policed became
|
|
198
|
-
// unconstructible). The NUMBER is never reused: row numbers are identity here — they are printed in
|
|
199
|
-
// denies, logged as `row=`, and cited in guards/L1-location.md — so renumbering would silently
|
|
200
|
-
// re-point every historical reference. Its replacement is row 8.
|
|
201
|
-
new L1Row(8, 'w', 'n', 'n', '-', '-', exports.ACT_BLOCK, 'this worktree pins a DIFFERENT @webpieces than the main tree that governs it', new L1Cure('align the pins (same git hash -> same tracked pin -> install in each tree), work in the main tree, or use a separate clone', '@webpieces version SKEW', false), 'trinary-version-skew', [
|
|
202
|
-
new L1UseCase(12, 'a worktree on an older branch pins `0.4.612` while the main tree runs `0.4.616`, and `cd <wt> && pnpm build` is blocked', '`w` / `n` / `n` — row 8', 'BLOCK_AI_CURE', 'Option 1 (preferred): the MAIN tree is AHEAD, so this is YOURS and it is a one-line edit — raise THIS tree\'s catalog pin in `pnpm-workspace.yaml` to what main already runs, then `pnpm install` here if this tree has a node_modules. That edit is on the L0 allowlist, so it is typable while the block is up, and nothing has to move in the main tree<br>Option 2: do the work in the main tree, which this guard never blocks<br>Option 3: if the tree genuinely needs a DIFFERENT version, use a separate CLONE — a clone gets its own governance. That is the answer to "I need a different version", never to "I need to install here": a worktree MAY have its own node_modules (nx, vitest and the eslint plugin all load from it), it just may not hold a different @webpieces version<br>Do NOT: lower the MAIN tree\'s pin to match — that downgrades every tree, including this session\'s own governor. And do NOT reach for `pnpm install` BEFORE the edit: this tree\'s pin is the stale side, so installing first materializes the OLD release', new L1Classification('w', true, false, false, false)),
|
|
203
|
-
new L1UseCase(16, 'a SUBAGENT hits the same block inside `.claude/worktrees/agent-XXXX`', '`w` / `n` / `n` — row 8; in-repo placement is still `w`', 'BLOCK_AI_CURE', 'READ THE DIRECTION FIRST — the deny prints it. If the MAIN tree is AHEAD (the common case) a subagent fixes this ITSELF, here, by raising this tree\'s pin to what main already runs; there is nothing to escalate and the deny prints no escalation. Only when main is BEHIND, or when this branch bumped the pin on purpose, is the subagent stuck — the main tree is outside its tree, and a worktree-isolated agent may not even still be in the tree it was launched in (measured: auto-reaped at a turn boundary, resumed on the primary). Then, and only then, forward the deny\'s verbatim ask to the coordinator, and do NOT retry the blocked call — it re-fires the identical deny and buries the ask<br>Do NOT: expect exemption because it sits under the repo — K is git\'s `--git-common-dir` answer, not a path test', new L1Classification('w', true, false, false, false)),
|
|
204
|
-
]),
|
|
205
|
-
new L1Row(4, 'pw', '-', '-', 'n', '-', exports.ACT_DOWN, 'force-to-root has no jurisdiction', null, null, [
|
|
206
|
-
new L1UseCase(5, '`ls` from `packages/http/` runs normally', '`pw` / `n` / - — row 4', 'ALLOW (handed to L2)', 'none — force-to-root has no jurisdiction over non-git commands', new L1Classification('p', false, true, false, false)),
|
|
207
|
-
new L1UseCase(6, '`pnpm test` from `packages/http/` runs normally', '`pw` / `n` / - — row 4', 'ALLOW (handed to L2)', 'none — deliberately untouched, so package-local test runs stay natural', new L1Classification('p', false, false, false, false)),
|
|
208
|
-
new L1UseCase(10, '`echo "cd sub && git push"` passes', '`pw` / `n` / `root` — row 4', 'ALLOW (handed to L2)', 'none — the `cd` is inside quotes, so `ShellSegmentScan` never treats it as a scope escape', new L1Classification('p', false, false, false, true)),
|
|
209
|
-
new L1UseCase(13, 'the same command from a **subagent** runs normally', '`w` / `y` — row 8 does not match', 'ALLOW (handed to L2)', 'none — a subagent pinned to a worktree is the correct pattern', new L1Classification('w', false, false, false, false)),
|
|
210
|
-
new L1UseCase(14, 'inspection inside a SKEWED worktree still runs — `cd <worktree> && ls`/`cat`/`grep`', '`w` / `n` / `y` — row 8 does not match', 'ALLOW (handed to L2)', 'none — inspection is always open; so are the `Read` tool, `git -C <dir INSIDE this tree> …` and `git show <branch>:<file>`, none of which move you. `git -C <ANOTHER tree>` is a different matter: the harness refuses cross-tree git to a subagent, so it is never the cure for a skew — tell the MAIN agent instead', new L1Classification('w', true, true, false, false)),
|
|
211
|
-
]),
|
|
212
|
-
new L1Row(5, 'pw', '-', '-', 'y', 'sub', exports.ACT_BLOCK, '`cd <root> && <original>`', new L1Cure('`cd <root> && <original>`', 'Run git/gh commands from the repo root', true), 'force-to-root', [
|
|
213
|
-
new L1UseCase(7, '`git status` from `packages/http/` is blocked', '`pw` / `y` / `sub` — row 5', 'BLOCK_AI_CURE', 'Option 1 (preferred): `cd <root> && git status`', new L1Classification('p', false, false, true, false)),
|
|
214
|
-
new L1UseCase(8, '`cd packages/http && git status` **typed from the root** is blocked', '`pw` / `y` / `sub` — row 5', 'BLOCK_AI_CURE', 'Option 1 (preferred): `cd <root> && git status`<br>Do NOT: assume it is allowed because you started at the root — the predicate is `effectiveCwd === root`, i.e. the DESTINATION', new L1Classification('p', false, false, true, false)),
|
|
215
|
-
new L1UseCase(11, '`cd <subdir> && git push` blocked with the force-to-root message, NOT the gated-flow one', '`pw` / `y` / `sub` — row 5; force-to-root runs first', 'BLOCK_AI_CURE', 'Option 1 (preferred): `cd <root> && git push`, which then gets the push guard\'s real answer ← costs one extra turn by design; still blocked', new L1Classification('p', false, false, true, false)),
|
|
216
|
-
new L1UseCase(17, 'the printed cure REPLACES your `cd`, it does not stack in front of it', '`pw` / `y` / `sub` — row 5, on the cure itself', 'BLOCK_AI_CURE', 'Option 1 (preferred): run the printed line VERBATIM — `cd <root> && <the work>`, with your own leading `cd` dropped<br>Do NOT: paste `cd <root> && cd <subdir> && <work>`; `effectiveCwd` resolves the leading `cd`s left to right, so that lands in `<subdir>` again and re-fires this exact block', new L1Classification('p', false, false, true, false)),
|
|
217
|
-
]),
|
|
218
|
-
new L1Row(6, 'pw', '-', '-', 'y', 'root', exports.ACT_DOWN, '', null, null, [
|
|
219
|
-
new L1UseCase(9, '`cd <root> && git status` passes from anywhere', '`pw` / `y` / `root` — row 6', 'ALLOW (handed to L2)', 'none — this IS the prescribed cure', new L1Classification('p', false, false, true, true)),
|
|
220
|
-
]),
|
|
221
|
-
new L1Row(7, 'm', '-', '-', '-', '-', exports.ACT_BLOCK, 'the directory is GONE — nothing can run there', new L1Cure('`cd <root> && <the work>`, never back through the dead path', 'no longer exists', true), 'missing-directory', [
|
|
222
|
-
new L1UseCase(18, 'every command from a worktree another agent REAPED mid-session is blocked', '`m` — row 7', 'BLOCK_AI_CURE', 'Option 1 (preferred): run the printed `cd <root> && <the work>` line — it does NOT route back through the dead path<br>Do NOT: re-`cd` into the worktree, or `git worktree add` it back expecting your uncommitted work; that work is gone', new L1Classification('m', false, false, true, false)),
|
|
223
|
-
new L1UseCase(19, 'the same block for a NON-git command there — `m` does not care about G', '`m` — row 7; K alone decides it', 'BLOCK_AI_CURE', 'Option 1 (preferred): the same printed line. A vanished cwd is not a git question — nothing at all can run in a directory that does not exist', new L1Classification('m', false, false, false, false)),
|
|
224
|
-
]),
|
|
225
|
-
];
|
|
226
|
-
/**
|
|
227
|
-
* The use cases that exercise something that is NOT a row: the excludePaths FILTER (2, 3, 4, 20) and the
|
|
228
|
-
* L0 allowlist that runs ahead of L1 (15).
|
|
229
|
-
*
|
|
230
|
-
* They are use cases of L1 all the same — "exempt" is what emerges when the filter empties the rule
|
|
231
|
-
* list, and case 15 is the invariant that a cure stays reachable from every tree — so they stay in the
|
|
232
|
-
* doc's one numbered table. They carry no classification because no row classifies them.
|
|
233
|
-
*/
|
|
234
|
-
exports.L1_UNROWED_USE_CASES = [
|
|
235
|
-
new L1UseCase(2, 'Edit `repositories/vendored/foo.ts` allowed even on stale main', 'filter — the path is in `excludePaths`', 'ALLOW_EXEMPT', 'none needed'),
|
|
236
|
-
new L1UseCase(3, 'Edit `packages/http/foo.ts` blocked on stale main', 'filter keeps the rules → L2 fires', 'BLOCK (at L2)', 'that is L2\'s write-on-main verdict, not L1\'s — follow the L2 message'),
|
|
237
|
-
new L1UseCase(4, 'Edit `packages/http/foo.ts` judged even though the shell is in `/tmp`', 'filter, on the TARGET path', '→ L2', 'none — for file tools the cwd is irrelevant; do NOT `cd` anywhere to "fix" it'),
|
|
238
|
-
new L1UseCase(20, 'Write `.webpieces/worktrees/agent-*/pr-review/…/review-*.json` allowed on main, with `excludePaths` empty', 'filter — `.webpieces/` is HARD-CODED exempt (`isWebpiecesStateDir`), ahead of the config list', 'ALLOW_EXEMPT', 'none needed — the dir is gitignored, so no config can put it back under governance'),
|
|
239
|
-
new L1UseCase(21, 'Write a reviewer verdict into a WORKTREE\'s own state dir — the `.webpieces` under `.claude/worktrees/agent-*`, not the primary\'s', 'filter — the state-dir skip is asked about the path relative to the tree that OWNS it, not the governed root', 'ALLOW_EXEMPT', 'none — it was NOT exempt before (governed-root-relative that path begins `.claude`), and `wp-review-upsert-pr` requires the file before a PR can be opened'),
|
|
240
|
-
new L1UseCase(15, '`cd <worktree> && pnpm install` still runs while row 8 is live — it is the CURE', 'L0 allowlist, ahead of L1', 'ALLOW', 'none — a cure must stay reachable from every tree'),
|
|
241
|
-
];
|
|
242
|
-
/** Every use case, in the doc's numbering — the order the table is rendered and read in. */
|
|
243
|
-
// webpieces-disable no-function-outside-class -- pure accessor over the two arrays above, beside them in this data module
|
|
244
|
-
function allL1UseCases() {
|
|
245
|
-
const all = [...exports.L1_ROWS.flatMap((row) => row.useCases), ...exports.L1_UNROWED_USE_CASES];
|
|
246
|
-
return all.sort((a, b) => a.num - b.num);
|
|
247
|
-
}
|
|
248
|
-
/**
|
|
249
|
-
* FIRST MATCH WINS — the one lookup the guard and the tests share.
|
|
250
|
-
*
|
|
251
|
-
* Never null: rows 1, 2 and 4/5/6 between them cover every kind, and rows 4/5/6 partition G × P, so a
|
|
252
|
-
* classification that matched nothing would be a hole in the matrix. The totality test asserts exactly
|
|
253
|
-
* that, which is why this returns L1Row rather than L1Row | null.
|
|
254
|
-
*/
|
|
255
|
-
// webpieces-disable no-function-outside-class -- the matcher over L1_ROWS, beside the array it reads
|
|
256
|
-
function firstMatchingL1Row(c) {
|
|
257
|
-
const row = exports.L1_ROWS.find((r) => r.matches(c));
|
|
258
|
-
if (row === undefined)
|
|
259
|
-
throw new Error(`L1 matrix has a hole: no row matches ${JSON.stringify(c)}`);
|
|
260
|
-
return row;
|
|
261
|
-
}
|
|
262
|
-
//# sourceMappingURL=l1-rows.js.map
|
package/src/core/l1-rows.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"l1-rows.js","sourceRoot":"","sources":["../../../../../../packages/tooling/ai-hook-rules/src/core/l1-rows.ts"],"names":[],"mappings":";;;AAqXA,sCAGC;AAUD,gDAIC;AAjVD;;;;;;;;;;;GAWG;AACU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AAG,CAAC,CAAC;AAC3E,CAAC;AAED;;;;;;GAMG;AACH,qGAAqG;AACrG,SAAgB,kBAAkB,CAAC,CAAmB;IAClD,MAAM,GAAG,GAAG,eAAO,CAAC,IAAI,CAAC,CAAC,CAAQ,EAAW,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;IAC9D,IAAI,GAAG,KAAK,SAAS;QAAE,MAAM,IAAI,KAAK,CAAC,wCAAwC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IACpG,OAAO,GAAG,CAAC;AACf,CAAC","sourcesContent":["import type { TreeKind } from './effective-tree';\n\n// ---------------------------------------------------------------------------\n// L1 — the LOCATION layer, as data.\n//\n// L1 answers four questions: do we govern this call at all, does the directory still EXIST, is the\n// WRONG AGENT standing here, and is the agent stranded away from the root? Drawn as a decision matrix\n// that is SEVEN ordered rows over five dimensions (K/A/R/G/P), first match wins.\n//\n// This module holds those rows, and l1-doc.ts renders them into guards/L1-location.md — the doc a human\n// reads on GitHub. A unit test locks that file byte-identical to the renderer, and the guard itself\n// CONSULTS L1_ROWS to decide which structural block fires (see runner.l1LocationBlock). Doc and code\n// come from the SAME array, so they cannot drift.\n//\n// This module is deliberately import-free at runtime (only a type-only import above), so\n// `pnpm guards:generate` can load it without the package's transitive dependencies.\n// ---------------------------------------------------------------------------\n\n/**\n * The K dimension as a CLASSIFICATION carries — one concrete tree, never the `pw` union.\n *\n * `p` and `w` are the same PROJECT and every rule-scoped guard treats them alike; the doc writes the\n * pair as `pw` in the row's MATCHER (below), which is a different vocabulary on purpose.\n */\nexport type L1Kind = 'f' | 'm' | 'o' | 'p' | 'w';\n\n/** The K value a ROW matches on. `pw` matches both `p` and `w`; `-` is the wildcard. */\nexport type L1KindMatch = 'f' | 'm' | 'o' | 'w' | 'pw' | '-';\n\n/** R and G are yes/no, written `y`/`n` in the doc, with `-` for \"does not matter\". */\nexport type L1Flag = 'y' | 'n' | '-';\n\n/**\n * V is the same one boolean wearing the doc's own letters: `n` the webpieces versions do NOT agree\n * between this worktree and the main tree, `y` they do.\n *\n * This dimension used to be A (`c` coordinator / `s` subagent). It was replaced rather than removed\n * because agent identity was measured untrustworthy as a proxy for \"which tree am I in\" — a\n * worktree-isolated agent auto-reaped at a turn boundary silently resumes on the primary clone. A\n * version read off the PATH being acted on cannot lie in that way.\n */\nexport type L1VersionSync = 'y' | 'n' | '-';\n\n/** What L1 does with a row. The labels are the doc's own action codebook (see GUARD_MATRIX.md). */\nexport type L1ActionKind = 'exempt' | 'down' | 'block';\n\n/**\n * WHICH structural block a blocking row dispatches to. This is the field that makes the array\n * load-bearing rather than decorative: runner.l1LocationBlock looks the row up and switches on it,\n * so deleting a row from the array removes the block.\n */\nexport type L1BlockId = 'trinary-version-skew' | 'force-to-root' | 'missing-directory';\n\n/**\n * The row number for L1's PRE-STAGE — `misplacedCdBlock`, which decides from command TEXT before a\n * tree has been resolved, and therefore cannot be classified over the five dimensions rows 1-6 use\n * (asking L1_ROWS to classify it would need the very resolution its answer determines).\n *\n * ZERO rather than a seventh row, deliberately. It has to appear in the table — an L1 block the\n * generated doc did not describe is precisely the drift the table exists to prevent, and it was\n * carrying a `KNOWN GAP` comment saying so. But numbering it 7 would assert it sits in the same\n * first-match scan as the others, which is the one thing that is not true about it. Row 0 says\n * \"decided before the scan\" in the number itself. `renderL1Doc()` PRINTS this row above the six, so\n * `row=0` in the L1 log joins to a line the reader can actually find.\n */\nexport const L1_PRESTAGE_ROW = '0';\n\n/**\n * One point in the five-dimensional space L1 classifies over. Data-only → a class, per CLAUDE.md.\n *\n * The dimensions are exactly the doc's legend: K (tree kind of the resolved target), V (webpieces versions in sync or\n * subagent), R (provably read-only inspection), G (invokes git/gh), P (root or subdirectory).\n */\nexport class L1Classification {\n // eslint-disable-next-line @typescript-eslint/max-params -- five dimensions is the matrix's shape\n constructor(\n readonly kind: L1Kind,\n readonly versionsSkewed: boolean,\n readonly readOnly: boolean,\n readonly git: boolean,\n readonly atRoot: boolean,\n ) {}\n\n /**\n * The classification the RUNNER enforces on, built from the resolved tree and the caller.\n *\n * `'outside'` maps to `p`, and that is not a typo. TreeKind `'outside'` is produced by\n * effective-tree.ts (git has no answer for the directory) and consumed NOWHERE, so a command in no git repo is\n * judged against the governed repo exactly as if it stood in it. Row 2 (`o` → L2) describes what\n * SHOULD happen and is deliberately unreachable from here until the \"Not done\" fix in\n * guards/L1-location.md lands — exempting `o` alone opens a `cd /tmp &&` bypass of every L2 guard,\n * so the two ship together or neither does. Mapping it to `p` here is what preserves today's\n * behaviour (a `git` command from /tmp is still force-to-root blocked); it is not an endorsement.\n */\n // eslint-disable-next-line @typescript-eslint/max-params -- mirrors the constructor it delegates to\n // webpieces-disable no-function-outside-class -- a named constructor for this data class, not a service: it takes the runner's TreeKind and returns the same class, so there is nothing to inject\n static forEnforcement(\n treeKind: TreeKind,\n versionsSkewed: boolean,\n readOnly: boolean,\n git: boolean,\n atRoot: boolean,\n ): L1Classification {\n const kind: L1Kind = treeKind === 'foreign' ? 'f'\n : treeKind === 'missing' ? 'm'\n : treeKind === 'worktree' ? 'w' : 'p';\n return new L1Classification(kind, versionsSkewed, readOnly, git, atRoot);\n }\n}\n\n/** The `act` cell of a row: the doc's literal label, plus the machine-readable kind behind it. */\nexport class L1Action {\n constructor(readonly label: string, readonly kind: L1ActionKind) {}\n}\n\nexport const ACT_EXEMPT = new L1Action('2 exempt', 'exempt');\nexport const ACT_DOWN = new L1Action('→ L2', 'down');\nexport const ACT_BLOCK = new L1Action('4 block', 'block');\n\n/**\n * The CURE a blocking row prescribes.\n *\n * `runnable` is the axis that matters to the tests: a cure that is a command must, once applied,\n * actually stop the row from matching (cure reachability). Row 3's cure is an INSTRUCTION — \"spawn a\n * subagent bound to the worktree\" — which no allowlist can accept and no reclassification can model,\n * so it declares `runnable: false` and is asserted only on the deny text.\n */\nexport class L1Cure {\n constructor(\n /** How the doc's `why` column spells it. */\n readonly summary: string,\n /** A substring that MUST appear in the deny text the guard emits for this row. */\n readonly denyMention: string,\n readonly runnable: boolean,\n ) {}\n}\n\n/**\n * One row of the \"L1 use cases\" table: what you SEE, the state it puts you in, the verdict, the fix.\n *\n * The four text fields are rendered VERBATIM into the doc. `classification` is the same case expressed\n * in the matrix's own vocabulary so the tests can run it through the matcher — it is test/enforcement\n * data, never rendered, which is why a use case that exercises the FILTER or the L0 allowlist (neither\n * of which is a row) can carry `null` there.\n */\nexport class L1UseCase {\n // eslint-disable-next-line @typescript-eslint/max-params -- four verbatim doc cells plus the classification behind them\n constructor(\n readonly num: number,\n readonly symptom: string,\n readonly state: string,\n readonly verdict: string,\n readonly fix: string,\n readonly classification: L1Classification | null = null,\n ) {}\n}\n\n/** One row of L1's decision table. Data-only → a class, per CLAUDE.md. */\nexport class L1Row {\n // eslint-disable-next-line @typescript-eslint/max-params -- five dimension cells plus act/why/cure/blockId/useCases\n constructor(\n readonly num: number,\n readonly k: L1KindMatch,\n readonly a: L1VersionSync,\n readonly r: L1Flag,\n readonly g: L1Flag,\n readonly p: 'root' | 'sub' | '-',\n readonly action: L1Action,\n /** The `why` cell, verbatim. */\n readonly why: string,\n readonly cure: L1Cure | null,\n readonly blockId: L1BlockId | null,\n readonly useCases: readonly L1UseCase[],\n ) {}\n\n matches(c: L1Classification): boolean {\n if (!this.kindMatches(c.kind)) return false;\n if (this.a !== '-' && (this.a === 'n') !== c.versionsSkewed) return false;\n if (!flagMatches(this.r, c.readOnly)) return false;\n if (!flagMatches(this.g, c.git)) return false;\n return this.p === '-' || this.p === (c.atRoot ? 'root' : 'sub');\n }\n\n private kindMatches(kind: L1Kind): boolean {\n if (this.k === '-') return true;\n if (this.k === 'pw') return kind === 'p' || kind === 'w';\n return this.k === kind;\n }\n}\n\n// R and G are one boolean each behind a `y`/`n`/`-` cell, so one helper answers for both. (A is the\n// same shape but spelled `c`/`s`, and is matched inline above so the row literals read like the doc.)\n// webpieces-disable no-function-outside-class -- pure predicate for L1Row.matches above, in this data module\nfunction flagMatches(cell: L1Flag, value: boolean): boolean {\n if (cell === '-') return true;\n return (cell === 'y') === value;\n}\n\n/**\n * THE seven L1 rows, in first-match-wins order.\n *\n * Rows 3, 5 and 7 are the structural blocks and they run as ONE step (runner.l1LocationBlock) so they\n * can never be reordered by accident. Every other row is a hand-down or an exemption, i.e. \"L1 has no\n * objection\" — which is why only those three carry a blockId.\n *\n * Row 7 (`m`, the vanished directory) sits LAST only because row numbers are stable across releases —\n * they are printed in the doc and logged as `row=`, so renumbering rows 1-6 to slot it in front would\n * silently invalidate every existing reference. Position costs nothing here: `m` is matched by no other\n * row, so first-match reaches it wherever it sits.\n */\nexport const L1_ROWS: readonly L1Row[] = [\n new L1Row(1, 'f', '-', '-', '-', '-', ACT_EXEMPT, 'different git repo — hands off', null, null, [\n new L1UseCase(1,\n '`cd repositories/vendored && git commit` goes through untouched',\n '`f` / `y` / - — row 1',\n 'ALLOW_EXEMPT',\n 'none needed — jurisdiction is judged on the RESOLVED target, after the `cd`; a different git repo is hands-off',\n new L1Classification('f', false, false, true, false)),\n ]),\n new L1Row(2, 'o', '-', '-', '-', '-', ACT_DOWN, 'see \"Not done\" below', null, null, []),\n // ROW 3 IS RETIRED — it was coordinator-in-worktree, deleted with CoordinatorWorktreeGuard when the\n // guard hooks went ABSOLUTE (one governor, so the filesystem/governance split it policed became\n // unconstructible). The NUMBER is never reused: row numbers are identity here — they are printed in\n // denies, logged as `row=`, and cited in guards/L1-location.md — so renumbering would silently\n // re-point every historical reference. Its replacement is row 8.\n new L1Row(8, 'w', 'n', 'n', '-', '-', ACT_BLOCK,\n 'this worktree pins a DIFFERENT @webpieces than the main tree that governs it',\n new L1Cure('align the pins (same git hash -> same tracked pin -> install in each tree), work in the main tree, or use a separate clone',\n '@webpieces version SKEW', false),\n 'trinary-version-skew', [\n new L1UseCase(12,\n 'a worktree on an older branch pins `0.4.612` while the main tree runs `0.4.616`, and `cd <wt> && pnpm build` is blocked',\n '`w` / `n` / `n` — row 8',\n 'BLOCK_AI_CURE',\n 'Option 1 (preferred): the MAIN tree is AHEAD, so this is YOURS and it is a one-line edit — raise THIS tree\\'s catalog pin in `pnpm-workspace.yaml` to what main already runs, then `pnpm install` here if this tree has a node_modules. That edit is on the L0 allowlist, so it is typable while the block is up, and nothing has to move in the main tree<br>Option 2: do the work in the main tree, which this guard never blocks<br>Option 3: if the tree genuinely needs a DIFFERENT version, use a separate CLONE — a clone gets its own governance. That is the answer to \"I need a different version\", never to \"I need to install here\": a worktree MAY have its own node_modules (nx, vitest and the eslint plugin all load from it), it just may not hold a different @webpieces version<br>Do NOT: lower the MAIN tree\\'s pin to match — that downgrades every tree, including this session\\'s own governor. And do NOT reach for `pnpm install` BEFORE the edit: this tree\\'s pin is the stale side, so installing first materializes the OLD release',\n new L1Classification('w', true, false, false, false)),\n new L1UseCase(16,\n 'a SUBAGENT hits the same block inside `.claude/worktrees/agent-XXXX`',\n '`w` / `n` / `n` — row 8; in-repo placement is still `w`',\n 'BLOCK_AI_CURE',\n 'READ THE DIRECTION FIRST — the deny prints it. If the MAIN tree is AHEAD (the common case) a subagent fixes this ITSELF, here, by raising this tree\\'s pin to what main already runs; there is nothing to escalate and the deny prints no escalation. Only when main is BEHIND, or when this branch bumped the pin on purpose, is the subagent stuck — the main tree is outside its tree, and a worktree-isolated agent may not even still be in the tree it was launched in (measured: auto-reaped at a turn boundary, resumed on the primary). Then, and only then, forward the deny\\'s verbatim ask to the coordinator, and do NOT retry the blocked call — it re-fires the identical deny and buries the ask<br>Do NOT: expect exemption because it sits under the repo — K is git\\'s `--git-common-dir` answer, not a path test',\n new L1Classification('w', true, false, false, false)),\n ]),\n new L1Row(4, 'pw', '-', '-', 'n', '-', ACT_DOWN, 'force-to-root has no jurisdiction', null, null, [\n new L1UseCase(5,\n '`ls` from `packages/http/` runs normally',\n '`pw` / `n` / - — row 4',\n 'ALLOW (handed to L2)',\n 'none — force-to-root has no jurisdiction over non-git commands',\n new L1Classification('p', false, true, false, false)),\n new L1UseCase(6,\n '`pnpm test` from `packages/http/` runs normally',\n '`pw` / `n` / - — row 4',\n 'ALLOW (handed to L2)',\n 'none — deliberately untouched, so package-local test runs stay natural',\n new L1Classification('p', false, false, false, false)),\n new L1UseCase(10,\n '`echo \"cd sub && git push\"` passes',\n '`pw` / `n` / `root` — row 4',\n 'ALLOW (handed to L2)',\n 'none — the `cd` is inside quotes, so `ShellSegmentScan` never treats it as a scope escape',\n new L1Classification('p', false, false, false, true)),\n new L1UseCase(13,\n 'the same command from a **subagent** runs normally',\n '`w` / `y` — row 8 does not match',\n 'ALLOW (handed to L2)',\n 'none — a subagent pinned to a worktree is the correct pattern',\n new L1Classification('w', false, false, false, false)),\n new L1UseCase(14,\n 'inspection inside a SKEWED worktree still runs — `cd <worktree> && ls`/`cat`/`grep`',\n '`w` / `n` / `y` — row 8 does not match',\n 'ALLOW (handed to L2)',\n 'none — inspection is always open; so are the `Read` tool, `git -C <dir INSIDE this tree> …` and `git show <branch>:<file>`, none of which move you. `git -C <ANOTHER tree>` is a different matter: the harness refuses cross-tree git to a subagent, so it is never the cure for a skew — tell the MAIN agent instead',\n new L1Classification('w', true, true, false, false)),\n ]),\n new L1Row(5, 'pw', '-', '-', 'y', 'sub', ACT_BLOCK, '`cd <root> && <original>`',\n new L1Cure('`cd <root> && <original>`', 'Run git/gh commands from the repo root', true),\n 'force-to-root', [\n new L1UseCase(7,\n '`git status` from `packages/http/` is blocked',\n '`pw` / `y` / `sub` — row 5',\n 'BLOCK_AI_CURE',\n 'Option 1 (preferred): `cd <root> && git status`',\n new L1Classification('p', false, false, true, false)),\n new L1UseCase(8,\n '`cd packages/http && git status` **typed from the root** is blocked',\n '`pw` / `y` / `sub` — row 5',\n 'BLOCK_AI_CURE',\n 'Option 1 (preferred): `cd <root> && git status`<br>Do NOT: assume it is allowed because you started at the root — the predicate is `effectiveCwd === root`, i.e. the DESTINATION',\n new L1Classification('p', false, false, true, false)),\n new L1UseCase(11,\n '`cd <subdir> && git push` blocked with the force-to-root message, NOT the gated-flow one',\n '`pw` / `y` / `sub` — row 5; force-to-root runs first',\n 'BLOCK_AI_CURE',\n 'Option 1 (preferred): `cd <root> && git push`, which then gets the push guard\\'s real answer ← costs one extra turn by design; still blocked',\n new L1Classification('p', false, false, true, false)),\n new L1UseCase(17,\n 'the printed cure REPLACES your `cd`, it does not stack in front of it',\n '`pw` / `y` / `sub` — row 5, on the cure itself',\n 'BLOCK_AI_CURE',\n 'Option 1 (preferred): run the printed line VERBATIM — `cd <root> && <the work>`, with your own leading `cd` dropped<br>Do NOT: paste `cd <root> && cd <subdir> && <work>`; `effectiveCwd` resolves the leading `cd`s left to right, so that lands in `<subdir>` again and re-fires this exact block',\n new L1Classification('p', false, false, true, false)),\n ]),\n new L1Row(6, 'pw', '-', '-', 'y', 'root', ACT_DOWN, '', null, null, [\n new L1UseCase(9,\n '`cd <root> && git status` passes from anywhere',\n '`pw` / `y` / `root` — row 6',\n 'ALLOW (handed to L2)',\n 'none — this IS the prescribed cure',\n new L1Classification('p', false, false, true, true)),\n ]),\n new L1Row(7, 'm', '-', '-', '-', '-', ACT_BLOCK, 'the directory is GONE — nothing can run there',\n new L1Cure('`cd <root> && <the work>`, never back through the dead path',\n 'no longer exists', true),\n 'missing-directory', [\n new L1UseCase(18,\n 'every command from a worktree another agent REAPED mid-session is blocked',\n '`m` — row 7',\n 'BLOCK_AI_CURE',\n 'Option 1 (preferred): run the printed `cd <root> && <the work>` line — it does NOT route back through the dead path<br>Do NOT: re-`cd` into the worktree, or `git worktree add` it back expecting your uncommitted work; that work is gone',\n new L1Classification('m', false, false, true, false)),\n new L1UseCase(19,\n 'the same block for a NON-git command there — `m` does not care about G',\n '`m` — row 7; K alone decides it',\n 'BLOCK_AI_CURE',\n 'Option 1 (preferred): the same printed line. A vanished cwd is not a git question — nothing at all can run in a directory that does not exist',\n new L1Classification('m', false, false, false, false)),\n ]),\n];\n\n/**\n * The use cases that exercise something that is NOT a row: the excludePaths FILTER (2, 3, 4, 20) and the\n * L0 allowlist that runs ahead of L1 (15).\n *\n * They are use cases of L1 all the same — \"exempt\" is what emerges when the filter empties the rule\n * list, and case 15 is the invariant that a cure stays reachable from every tree — so they stay in the\n * doc's one numbered table. They carry no classification because no row classifies them.\n */\nexport const L1_UNROWED_USE_CASES: readonly L1UseCase[] = [\n new L1UseCase(2,\n 'Edit `repositories/vendored/foo.ts` allowed even on stale main',\n 'filter — the path is in `excludePaths`',\n 'ALLOW_EXEMPT',\n 'none needed'),\n new L1UseCase(3,\n 'Edit `packages/http/foo.ts` blocked on stale main',\n 'filter keeps the rules → L2 fires',\n 'BLOCK (at L2)',\n 'that is L2\\'s write-on-main verdict, not L1\\'s — follow the L2 message'),\n new L1UseCase(4,\n 'Edit `packages/http/foo.ts` judged even though the shell is in `/tmp`',\n 'filter, on the TARGET path',\n '→ L2',\n 'none — for file tools the cwd is irrelevant; do NOT `cd` anywhere to \"fix\" it'),\n new L1UseCase(20,\n 'Write `.webpieces/worktrees/agent-*/pr-review/…/review-*.json` allowed on main, with `excludePaths` empty',\n 'filter — `.webpieces/` is HARD-CODED exempt (`isWebpiecesStateDir`), ahead of the config list',\n 'ALLOW_EXEMPT',\n 'none needed — the dir is gitignored, so no config can put it back under governance'),\n new L1UseCase(21,\n 'Write a reviewer verdict into a WORKTREE\\'s own state dir — the `.webpieces` under `.claude/worktrees/agent-*`, not the primary\\'s',\n 'filter — the state-dir skip is asked about the path relative to the tree that OWNS it, not the governed root',\n 'ALLOW_EXEMPT',\n 'none — it was NOT exempt before (governed-root-relative that path begins `.claude`), and `wp-review-upsert-pr` requires the file before a PR can be opened'),\n new L1UseCase(15,\n '`cd <worktree> && pnpm install` still runs while row 8 is live — it is the CURE',\n 'L0 allowlist, ahead of L1',\n 'ALLOW',\n 'none — a cure must stay reachable from every tree'),\n];\n\n/** Every use case, in the doc's numbering — the order the table is rendered and read in. */\n// webpieces-disable no-function-outside-class -- pure accessor over the two arrays above, beside them in this data module\nexport function allL1UseCases(): readonly L1UseCase[] {\n const all = [...L1_ROWS.flatMap((row: L1Row): readonly L1UseCase[] => row.useCases), ...L1_UNROWED_USE_CASES];\n return all.sort((a: L1UseCase, b: L1UseCase): number => a.num - b.num);\n}\n\n/**\n * FIRST MATCH WINS — the one lookup the guard and the tests share.\n *\n * Never null: rows 1, 2 and 4/5/6 between them cover every kind, and rows 4/5/6 partition G × P, so a\n * classification that matched nothing would be a hole in the matrix. The totality test asserts exactly\n * that, which is why this returns L1Row rather than L1Row | null.\n */\n// webpieces-disable no-function-outside-class -- the matcher over L1_ROWS, beside the array it reads\nexport function firstMatchingL1Row(c: L1Classification): L1Row {\n const row = L1_ROWS.find((r: L1Row): boolean => r.matches(c));\n if (row === undefined) throw new Error(`L1 matrix has a hole: no row matches ${JSON.stringify(c)}`);\n return row;\n}\n"]}
|
package/src/core/l2-doc.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Render guards/L2-branch-state.md.
|
|
3
|
-
*
|
|
4
|
-
* Split into sections purely to stay inside the method-line budget — the join order is what makes them
|
|
5
|
-
* one file, so keep them adjacent and keep the byte-lock test as the arbiter.
|
|
6
|
-
*/
|
|
7
|
-
export declare function renderL2Doc(): string;
|