@webpieces/agent-workflow-rules 0.0.0-stage → 0.0.1

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.
Files changed (299) hide show
  1. package/README.md +23 -2
  2. package/package.json +45 -4
  3. package/src/adapters/agent-response.d.ts +5 -0
  4. package/src/adapters/agent-response.js +86 -0
  5. package/src/adapters/agent-response.js.map +1 -0
  6. package/src/adapters/codex-subagent-guard.d.ts +45 -0
  7. package/src/adapters/codex-subagent-guard.js +88 -0
  8. package/src/adapters/codex-subagent-guard.js.map +1 -0
  9. package/src/adapters/guards-hook.d.ts +3 -0
  10. package/src/adapters/guards-hook.js +30 -0
  11. package/src/adapters/guards-hook.js.map +1 -0
  12. package/src/adapters/hook-app-fixtures.d.ts +68 -0
  13. package/src/adapters/hook-app-fixtures.js +170 -0
  14. package/src/adapters/hook-app-fixtures.js.map +1 -0
  15. package/src/adapters/hook-core.d.ts +22 -0
  16. package/src/adapters/hook-core.js +359 -0
  17. package/src/adapters/hook-core.js.map +1 -0
  18. package/src/adapters/hook-pipeline-evaluator.d.ts +5 -0
  19. package/src/adapters/hook-pipeline-evaluator.js +18 -0
  20. package/src/adapters/hook-pipeline-evaluator.js.map +1 -0
  21. package/src/adapters/review-identity-stamper.d.ts +20 -0
  22. package/src/adapters/review-identity-stamper.js +34 -0
  23. package/src/adapters/review-identity-stamper.js.map +1 -0
  24. package/src/bin/codex-trust.d.ts +105 -0
  25. package/src/bin/codex-trust.js +205 -0
  26. package/src/bin/codex-trust.js.map +1 -0
  27. package/src/bin/dev-hook-install.d.ts +1 -0
  28. package/src/bin/dev-hook-install.js +80 -0
  29. package/src/bin/dev-hook-install.js.map +1 -0
  30. package/src/bin/dev-hook-uninstall.d.ts +1 -0
  31. package/src/bin/dev-hook-uninstall.js +45 -0
  32. package/src/bin/dev-hook-uninstall.js.map +1 -0
  33. package/src/bin/hook-registration.d.ts +429 -0
  34. package/src/bin/hook-registration.js +661 -0
  35. package/src/bin/hook-registration.js.map +1 -0
  36. package/src/bin/install-entry.d.ts +19 -0
  37. package/src/bin/install-entry.js +128 -0
  38. package/src/bin/install-entry.js.map +1 -0
  39. package/src/bin/l0-allowlist.d.ts +46 -0
  40. package/src/bin/l0-allowlist.js +527 -0
  41. package/src/bin/l0-allowlist.js.map +1 -0
  42. package/src/bin/l0-codex-read.d.ts +20 -0
  43. package/src/bin/l0-codex-read.js +108 -0
  44. package/src/bin/l0-codex-read.js.map +1 -0
  45. package/src/bin/l0-decide.d.ts +49 -0
  46. package/src/bin/l0-decide.js +90 -0
  47. package/src/bin/l0-decide.js.map +1 -0
  48. package/src/bin/l0-entry.d.ts +103 -0
  49. package/src/bin/l0-entry.js +98 -0
  50. package/src/bin/l0-entry.js.map +1 -0
  51. package/src/bin/l0-ignored-tools.d.ts +38 -0
  52. package/src/bin/l0-ignored-tools.js +44 -0
  53. package/src/bin/l0-ignored-tools.js.map +1 -0
  54. package/src/bin/managed-env.d.ts +46 -0
  55. package/src/bin/managed-env.js +50 -0
  56. package/src/bin/managed-env.js.map +1 -0
  57. package/src/bin/neighbour-hooks.d.ts +42 -0
  58. package/src/bin/neighbour-hooks.js +177 -0
  59. package/src/bin/neighbour-hooks.js.map +1 -0
  60. package/src/bin/reviewer-agent.d.ts +19 -0
  61. package/src/bin/reviewer-agent.js +135 -0
  62. package/src/bin/reviewer-agent.js.map +1 -0
  63. package/src/bin/settings-shape.d.ts +37 -0
  64. package/src/bin/settings-shape.js +17 -0
  65. package/src/bin/settings-shape.js.map +1 -0
  66. package/src/bin/setup-config.d.ts +20 -0
  67. package/src/bin/setup-config.js +371 -0
  68. package/src/bin/setup-config.js.map +1 -0
  69. package/src/bin/setup.d.ts +78 -0
  70. package/src/bin/setup.js +411 -0
  71. package/src/bin/setup.js.map +1 -0
  72. package/src/bin/shim-audit-log.d.ts +119 -0
  73. package/src/bin/shim-audit-log.js +286 -0
  74. package/src/bin/shim-audit-log.js.map +1 -0
  75. package/src/bin/shim-deny-reason.d.ts +1 -0
  76. package/src/bin/shim-deny-reason.js +244 -0
  77. package/src/bin/shim-deny-reason.js.map +1 -0
  78. package/src/bin/shim-drift-fix.d.ts +1 -0
  79. package/src/bin/shim-drift-fix.js +73 -0
  80. package/src/bin/shim-drift-fix.js.map +1 -0
  81. package/src/bin/shim-testkit.d.ts +107 -0
  82. package/src/bin/shim-testkit.js +197 -0
  83. package/src/bin/shim-testkit.js.map +1 -0
  84. package/src/bin/shim-version-drift.d.ts +1 -0
  85. package/src/bin/shim-version-drift.js +164 -0
  86. package/src/bin/shim-version-drift.js.map +1 -0
  87. package/src/bin/shim.d.ts +16 -0
  88. package/src/bin/shim.js +641 -0
  89. package/src/bin/shim.js.map +1 -0
  90. package/src/bin/upgrade-shim.d.ts +18 -0
  91. package/src/bin/upgrade-shim.js +283 -0
  92. package/src/bin/upgrade-shim.js.map +1 -0
  93. package/src/configs/main-sync-guard-configs.d.ts +38 -0
  94. package/src/configs/main-sync-guard-configs.js +54 -0
  95. package/src/configs/main-sync-guard-configs.js.map +1 -0
  96. package/src/configs/rule-configs.d.ts +47 -0
  97. package/src/configs/rule-configs.js +96 -0
  98. package/src/configs/rule-configs.js.map +1 -0
  99. package/src/core/ai-type-context.d.ts +36 -0
  100. package/src/core/ai-type-context.js +45 -0
  101. package/src/core/ai-type-context.js.map +1 -0
  102. package/src/core/decision-log.d.ts +190 -0
  103. package/src/core/decision-log.js +409 -0
  104. package/src/core/decision-log.js.map +1 -0
  105. package/src/core/excluded-path-escape.d.ts +101 -0
  106. package/src/core/excluded-path-escape.js +236 -0
  107. package/src/core/excluded-path-escape.js.map +1 -0
  108. package/src/core/force-to-root.d.ts +32 -0
  109. package/src/core/force-to-root.js +60 -0
  110. package/src/core/force-to-root.js.map +1 -0
  111. package/src/core/guard-index-doc.d.ts +63 -0
  112. package/src/core/guard-index-doc.js +172 -0
  113. package/src/core/guard-index-doc.js.map +1 -0
  114. package/src/core/instruct-ai-writer.d.ts +1 -0
  115. package/src/core/instruct-ai-writer.js +6 -0
  116. package/src/core/instruct-ai-writer.js.map +1 -0
  117. package/src/core/l0-matrix.d.ts +102 -0
  118. package/src/core/l0-matrix.js +357 -0
  119. package/src/core/l0-matrix.js.map +1 -0
  120. package/src/core/l0-tooling-doc.d.ts +45 -0
  121. package/src/core/l0-tooling-doc.js +258 -0
  122. package/src/core/l0-tooling-doc.js.map +1 -0
  123. package/src/core/l1-doc.d.ts +7 -0
  124. package/src/core/l1-doc.js +340 -0
  125. package/src/core/l1-doc.js.map +1 -0
  126. package/src/core/l1-matrix-doc.d.ts +31 -0
  127. package/src/core/l1-matrix-doc.js +111 -0
  128. package/src/core/l1-matrix-doc.js.map +1 -0
  129. package/src/core/l1-rows.d.ts +167 -0
  130. package/src/core/l1-rows.js +262 -0
  131. package/src/core/l1-rows.js.map +1 -0
  132. package/src/core/l2-doc.d.ts +7 -0
  133. package/src/core/l2-doc.js +385 -0
  134. package/src/core/l2-doc.js.map +1 -0
  135. package/src/core/l2-matrix-doc.d.ts +23 -0
  136. package/src/core/l2-matrix-doc.js +72 -0
  137. package/src/core/l2-matrix-doc.js.map +1 -0
  138. package/src/core/l2-row.d.ts +54 -0
  139. package/src/core/l2-row.js +75 -0
  140. package/src/core/l2-row.js.map +1 -0
  141. package/src/core/l2-rows.d.ts +56 -0
  142. package/src/core/l2-rows.js +272 -0
  143. package/src/core/l2-rows.js.map +1 -0
  144. package/src/core/load-rules.d.ts +9 -0
  145. package/src/core/load-rules.js +65 -0
  146. package/src/core/load-rules.js.map +1 -0
  147. package/src/core/log-stream.d.ts +117 -0
  148. package/src/core/log-stream.js +156 -0
  149. package/src/core/log-stream.js.map +1 -0
  150. package/src/core/log-streams.d.ts +48 -0
  151. package/src/core/log-streams.js +55 -0
  152. package/src/core/log-streams.js.map +1 -0
  153. package/src/core/log-target.d.ts +21 -0
  154. package/src/core/log-target.js +29 -0
  155. package/src/core/log-target.js.map +1 -0
  156. package/src/core/main-sync-log.d.ts +16 -0
  157. package/src/core/main-sync-log.js +108 -0
  158. package/src/core/main-sync-log.js.map +1 -0
  159. package/src/core/main-sync-refresh.d.ts +39 -0
  160. package/src/core/main-sync-refresh.js +96 -0
  161. package/src/core/main-sync-refresh.js.map +1 -0
  162. package/src/core/main-sync-timeout.d.ts +33 -0
  163. package/src/core/main-sync-timeout.js +95 -0
  164. package/src/core/main-sync-timeout.js.map +1 -0
  165. package/src/core/matrix-cures.d.ts +12 -0
  166. package/src/core/matrix-cures.js +56 -0
  167. package/src/core/matrix-cures.js.map +1 -0
  168. package/src/core/missing-directory.d.ts +38 -0
  169. package/src/core/missing-directory.js +66 -0
  170. package/src/core/missing-directory.js.map +1 -0
  171. package/src/core/read-only-inspection.d.ts +34 -0
  172. package/src/core/read-only-inspection.js +88 -0
  173. package/src/core/read-only-inspection.js.map +1 -0
  174. package/src/core/rejection-log.d.ts +9 -0
  175. package/src/core/rejection-log.js +262 -0
  176. package/src/core/rejection-log.js.map +1 -0
  177. package/src/core/rules/branch-creation-guard.d.ts +113 -0
  178. package/src/core/rules/branch-creation-guard.js +425 -0
  179. package/src/core/rules/branch-creation-guard.js.map +1 -0
  180. package/src/core/rules/branch-switch-scan.d.ts +43 -0
  181. package/src/core/rules/branch-switch-scan.js +132 -0
  182. package/src/core/rules/branch-switch-scan.js.map +1 -0
  183. package/src/core/rules/build-output-pipe-guard.d.ts +56 -0
  184. package/src/core/rules/build-output-pipe-guard.js +120 -0
  185. package/src/core/rules/build-output-pipe-guard.js.map +1 -0
  186. package/src/core/rules/build-output-pipe-scan.d.ts +47 -0
  187. package/src/core/rules/build-output-pipe-scan.js +84 -0
  188. package/src/core/rules/build-output-pipe-scan.js.map +1 -0
  189. package/src/core/rules/cap-remedies.d.ts +39 -0
  190. package/src/core/rules/cap-remedies.js +59 -0
  191. package/src/core/rules/cap-remedies.js.map +1 -0
  192. package/src/core/rules/commit-message-substitution-guard.d.ts +72 -0
  193. package/src/core/rules/commit-message-substitution-guard.js +134 -0
  194. package/src/core/rules/commit-message-substitution-guard.js.map +1 -0
  195. package/src/core/rules/commit-message-substitution-scan.d.ts +42 -0
  196. package/src/core/rules/commit-message-substitution-scan.js +145 -0
  197. package/src/core/rules/commit-message-substitution-scan.js.map +1 -0
  198. package/src/core/rules/content-read-scan.d.ts +76 -0
  199. package/src/core/rules/content-read-scan.js +176 -0
  200. package/src/core/rules/content-read-scan.js.map +1 -0
  201. package/src/core/rules/cure-prefix-scan.d.ts +64 -0
  202. package/src/core/rules/cure-prefix-scan.js +133 -0
  203. package/src/core/rules/cure-prefix-scan.js.map +1 -0
  204. package/src/core/rules/feature-branch-guard.d.ts +121 -0
  205. package/src/core/rules/feature-branch-guard.js +327 -0
  206. package/src/core/rules/feature-branch-guard.js.map +1 -0
  207. package/src/core/rules/index.d.ts +1 -0
  208. package/src/core/rules/index.js +5 -0
  209. package/src/core/rules/index.js.map +1 -0
  210. package/src/core/rules/judged-tree.d.ts +66 -0
  211. package/src/core/rules/judged-tree.js +97 -0
  212. package/src/core/rules/judged-tree.js.map +1 -0
  213. package/src/core/rules/main-freshness.d.ts +37 -0
  214. package/src/core/rules/main-freshness.js +61 -0
  215. package/src/core/rules/main-freshness.js.map +1 -0
  216. package/src/core/rules/merge-in-progress-guard.d.ts +17 -0
  217. package/src/core/rules/merge-in-progress-guard.js +124 -0
  218. package/src/core/rules/merge-in-progress-guard.js.map +1 -0
  219. package/src/core/rules/merged-branch-bash-guard.d.ts +62 -0
  220. package/src/core/rules/merged-branch-bash-guard.js +171 -0
  221. package/src/core/rules/merged-branch-bash-guard.js.map +1 -0
  222. package/src/core/rules/merged-branch-message.d.ts +59 -0
  223. package/src/core/rules/merged-branch-message.js +137 -0
  224. package/src/core/rules/merged-branch-message.js.map +1 -0
  225. package/src/core/rules/pr-creation-or-push-guard.d.ts +26 -0
  226. package/src/core/rules/pr-creation-or-push-guard.js +150 -0
  227. package/src/core/rules/pr-creation-or-push-guard.js.map +1 -0
  228. package/src/core/rules/pr-merge-guard.d.ts +36 -0
  229. package/src/core/rules/pr-merge-guard.js +87 -0
  230. package/src/core/rules/pr-merge-guard.js.map +1 -0
  231. package/src/core/rules/read-stale-guard.d.ts +136 -0
  232. package/src/core/rules/read-stale-guard.js +328 -0
  233. package/src/core/rules/read-stale-guard.js.map +1 -0
  234. package/src/core/rules/recovery-allowlist.d.ts +49 -0
  235. package/src/core/rules/recovery-allowlist.js +187 -0
  236. package/src/core/rules/recovery-allowlist.js.map +1 -0
  237. package/src/core/rules/redirect-how-to-merge-main.d.ts +16 -0
  238. package/src/core/rules/redirect-how-to-merge-main.js +159 -0
  239. package/src/core/rules/redirect-how-to-merge-main.js.map +1 -0
  240. package/src/core/rules/stale-main-bash-guard.d.ts +198 -0
  241. package/src/core/rules/stale-main-bash-guard.js +363 -0
  242. package/src/core/rules/stale-main-bash-guard.js.map +1 -0
  243. package/src/core/rules/stale-main-message.d.ts +62 -0
  244. package/src/core/rules/stale-main-message.js +102 -0
  245. package/src/core/rules/stale-main-message.js.map +1 -0
  246. package/src/core/rules/tree-recovery.d.ts +92 -0
  247. package/src/core/rules/tree-recovery.js +165 -0
  248. package/src/core/rules/tree-recovery.js.map +1 -0
  249. package/src/core/rules/wait-spin-guard.d.ts +128 -0
  250. package/src/core/rules/wait-spin-guard.js +211 -0
  251. package/src/core/rules/wait-spin-guard.js.map +1 -0
  252. package/src/core/rules/wait-spin-scan.d.ts +118 -0
  253. package/src/core/rules/wait-spin-scan.js +203 -0
  254. package/src/core/rules/wait-spin-scan.js.map +1 -0
  255. package/src/core/rules/whole-repo-build-guard.d.ts +125 -0
  256. package/src/core/rules/whole-repo-build-guard.js +257 -0
  257. package/src/core/rules/whole-repo-build-guard.js.map +1 -0
  258. package/src/core/rules/whole-repo-build-scan.d.ts +28 -0
  259. package/src/core/rules/whole-repo-build-scan.js +198 -0
  260. package/src/core/rules/whole-repo-build-scan.js.map +1 -0
  261. package/src/core/runner.d.ts +19 -0
  262. package/src/core/runner.js +482 -0
  263. package/src/core/runner.js.map +1 -0
  264. package/src/core/session-call-history.d.ts +44 -0
  265. package/src/core/session-call-history.js +79 -0
  266. package/src/core/session-call-history.js.map +1 -0
  267. package/src/core/sync-main.d.ts +46 -0
  268. package/src/core/sync-main.js +176 -0
  269. package/src/core/sync-main.js.map +1 -0
  270. package/src/core/version-sync.d.ts +219 -0
  271. package/src/core/version-sync.js +558 -0
  272. package/src/core/version-sync.js.map +1 -0
  273. package/src/core/webpieces-versions.d.ts +98 -0
  274. package/src/core/webpieces-versions.js +206 -0
  275. package/src/core/webpieces-versions.js.map +1 -0
  276. package/src/core/workflow-hook-rules.d.ts +5 -0
  277. package/src/core/workflow-hook-rules.js +15 -0
  278. package/src/core/workflow-hook-rules.js.map +1 -0
  279. package/src/index.d.ts +11 -0
  280. package/src/index.js +28 -0
  281. package/src/index.js.map +1 -0
  282. package/src/policy-keys.d.ts +2 -0
  283. package/src/policy-keys.js +6 -0
  284. package/src/policy-keys.js.map +1 -0
  285. package/src/rule-migrations.d.ts +3 -0
  286. package/src/rule-migrations.js +22 -0
  287. package/src/rule-migrations.js.map +1 -0
  288. package/src/rule-pack.d.ts +2 -0
  289. package/src/rule-pack.js +20 -0
  290. package/src/rule-pack.js.map +1 -0
  291. package/src/rule-settings.d.ts +5 -0
  292. package/src/rule-settings.js +31 -0
  293. package/src/rule-settings.js.map +1 -0
  294. package/src/safeguard-catalog.d.ts +3 -0
  295. package/src/safeguard-catalog.js +16 -0
  296. package/src/safeguard-catalog.js.map +1 -0
  297. package/templates/ai-hook.sh +497 -0
  298. package/templates/claude-settings-hook.json +28 -0
  299. package/templates/webpieces-reviewer.md +60 -0
@@ -0,0 +1,340 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.renderL1Doc = renderL1Doc;
4
+ const l1_rows_1 = require("./l1-rows");
5
+ // ---------------------------------------------------------------------------
6
+ // guards/L1-location.md, rendered from L1_ROWS.
7
+ //
8
+ // Same arrangement as l0-matrix.renderGuardMatrixDoc(): one join('\n') of literal markdown lines with
9
+ // the ROW DATA interpolated from the array the guard consults. Everything that is not row data — every
10
+ // prose section — is a literal line here, because that is the half a generator cannot own.
11
+ //
12
+ // A unit test (l1-matrix.spec.ts) locks guards/L1-location.md byte-identical to renderL1Doc(), and
13
+ // `pnpm guards:generate` rewrites the file. So the table in the doc IS the array, not a description of
14
+ // it. This module, like l1-rows.ts, has no runtime imports outside this pair so the generator can load
15
+ // it without the package's transitive dependencies.
16
+ // ---------------------------------------------------------------------------
17
+ /** A dimension cell: the wildcard renders bare, every value renders as code. */
18
+ // webpieces-disable no-function-outside-class -- pure cell formatter for renderL1Doc below, in this render module
19
+ function cell(value) {
20
+ return value === '-' ? '-' : `\`${value}\``;
21
+ }
22
+ // webpieces-disable no-function-outside-class -- pure row formatter for renderL1Doc below, in this render module
23
+ function tableRow(row) {
24
+ const dims = [row.k, row.a, row.r, row.g, row.p].map(cell).join(' | ');
25
+ // Row 6 has no `why` — an EMPTY cell is `| |`, not `| |`. Two spaces would render the same in a
26
+ // browser and fail the byte-lock, which is the whole point of locking bytes rather than markdown.
27
+ const why = row.why === '' ? ' ' : ` ${row.why} `;
28
+ // The CURE column exists so a reader who arrived here from a `row=` in a log gets the remedy on the
29
+ // same line as the verdict, the way L2's matrix does. Only blocking rows have one; a row that hands
30
+ // down to L2 or exempts has nothing to cure, and says so rather than leaving the cell blank.
31
+ const cure = row.cure === null ? 'n/a — not a block' : row.cure.summary;
32
+ return `| ${row.num} | ${dims} | ${row.action.label} |${why}| ${cure} |`;
33
+ }
34
+ // webpieces-disable no-function-outside-class -- pure row formatter for renderL1Doc below, in this render module
35
+ function useCaseRow(useCase) {
36
+ return `| ${useCase.num} | ${useCase.symptom} | ${useCase.state} | ${useCase.verdict} | ${useCase.fix} |`;
37
+ }
38
+ /**
39
+ * Render guards/L1-location.md.
40
+ *
41
+ * Split into three consecutive halves purely to stay inside the method-line budget — the join order is
42
+ * what makes them one file, so keep them adjacent and keep the byte-lock test as the arbiter.
43
+ */
44
+ // webpieces-disable no-function-outside-class -- pure string builder over L1_ROWS, beside the array it reads
45
+ function renderL1Doc() {
46
+ return [
47
+ ...renderHead(),
48
+ ...renderTable(),
49
+ ...renderLogJoin(),
50
+ ...renderUseCases(),
51
+ ...renderTail(),
52
+ ].join('\n');
53
+ }
54
+ // How a `row=` in the L1 log joins back to the table above — the section this doc existed without for
55
+ // 1,457 logged decisions across nine repos, none of which an agent could look up, because the DELIVERED
56
+ // copy of this page did not exist either. L2's doc has carried the same section since its own delivery.
57
+ // webpieces-disable no-function-outside-class -- prose section of renderL1Doc's string, beside it in this module
58
+ function renderLogJoin() {
59
+ return [
60
+ '## How a log line joins to a row',
61
+ '',
62
+ 'Every L1 decision is written to `.webpieces/logs/L1-location/<writer>.log` with `layer=L1` and',
63
+ '`row=<n>`, where `<n>` is a row number from the table above. So `row=6` means "this call was judged',
64
+ 'by row 6" and you read the dimensions, the verdict, the reason and the cure straight off that line. Row `0` is',
65
+ 'the pre-stage; it is in the table for exactly this reason.',
66
+ '',
67
+ '**The join is by DISPATCH, and that is the difference from L2.** L1 takes the FIRST matching row in',
68
+ '`L1_ROWS` and switches on it, so a row and a behaviour are the same object — delete the row and you',
69
+ 'delete the block. L2\'s four guard classes each own their own ladder and join to their rows by REASON',
70
+ 'instead (see `webpieces.branch-state-matrix.md`). A totality test walks all 80 classifications and',
71
+ 'asserts each lands on exactly one row, so there is no verdict this page cannot explain.',
72
+ '',
73
+ 'Row numbers are IDENTITY and are never reused: row 3 is retired (coordinator-in-worktree) and row 8',
74
+ 'was added in its place rather than renumbering 4-7, because every `row=` already written to a log',
75
+ 'would otherwise re-point.',
76
+ '',
77
+ ];
78
+ }
79
+ // The three questions L1 answers, the preamble and the filter — all prose, none of it row data.
80
+ // webpieces-disable no-function-outside-class -- first section of renderL1Doc's string, beside it in this module
81
+ function renderHead() {
82
+ return [
83
+ '# L1 — location',
84
+ '',
85
+ '**Goal: is this call ours to judge, is this tree governed by the release it asks for, and is git being run from the root?**',
86
+ '',
87
+ '**Config key: none, and none is proposed.** Force-to-root and trinary-version-skew have **no config',
88
+ 'key** and cannot be disabled; `excludePaths` is a top-level block, not a `hookGuards` entry. A',
89
+ '`location-guard` key was once proposed here — it never existed, and `hookGuards` has just gone from',
90
+ 'nine keys to three, so adding a tenth-turned-fourth for a layer nobody has asked to switch off would',
91
+ 'run against the whole point. L0 has no key for the stronger version of the same reason: a layer that',
92
+ 'decides whether the tooling can be trusted cannot be configured by the file it has not validated yet.',
93
+ '',
94
+ '',
95
+ '**Code:** `packages/tooling/hook-runtime/src/core/effective-tree.ts` (`EffectiveTreeResolver`,',
96
+ '`TreeKind`) · `packages/tooling/hook-runtime/src/core/target-tree.ts` (`TargetTreeResolver`,',
97
+ '`GovernedPath` — the same question asked about a FILE) ·',
98
+ '`packages/tooling/agent-workflow-rules/src/core/runner.ts` (`l1LocationBlock`, the `foreign` check) ·',
99
+ '`packages/tooling/hook-runtime/src/core/excluded-paths.ts` (`filterByExcludedPaths`) ·',
100
+ '`.../force-to-root.ts` (`ForceToRootGuard`) ·',
101
+ '`packages/tooling/agent-workflow-rules/src/core/missing-directory.ts` (`MissingDirectoryGuard`) ·',
102
+ '`packages/tooling/agent-workflow-rules/src/core/version-sync.ts` (`VersionSyncGuard`,',
103
+ '`WebpiecesVersions`).',
104
+ '',
105
+ 'L1 answers four questions, and they are genuinely separate:',
106
+ '',
107
+ '1. **Do we govern this at all?** — the escape hatches, for other repos and non-governed paths.',
108
+ ' Answered by asking GIT (`--git-common-dir`), never by path math: see the legend under **K**.',
109
+ '2. **Does the directory still EXIST?** — row 7. A worktree reaped out from under a live shell leaves',
110
+ ' a cwd that names nothing, and that state needs its own name and its own message, because the',
111
+ ' remedy for "you are in a subdirectory" is a `cd` back into the very directory that is gone.',
112
+ '3. **Is this tree governed by a release it did not ask for?** — row 8. A worktree MAY have its own',
113
+ ' `node_modules` (nx, vitest and the eslint plugin all execute there and load from it), and when it',
114
+ ' has none the shim\'s upward walk runs the main tree\'s binary. Either way the rule is the same and',
115
+ ' holds whichever registration form — absolute or relative — is live in the consumer: the two trees',
116
+ ' must PIN the same `@webpieces`, or the worktree is linted, validated and built by a release its',
117
+ ' own manifest does not ask for. Asked of the PATH acted on, never of who is asking —',
118
+ ' agent identity was measured untrustworthy for tree detection (a worktree-isolated agent whose tree',
119
+ ' is auto-reaped at a turn boundary silently resumes on the primary clone).',
120
+ '4. **Is the agent stranded away from the root?** — force-to-root, git/gh only. Agents forget where',
121
+ ' they are constantly, and `cd` gives them two different ways to be wrong: a `cd` that stays INSIDE',
122
+ ' the workspace PERSISTS to later calls (so the shell can be parked in a subdirectory left by an',
123
+ ' unrelated command turns earlier), while a `cd` that LEAVES it is reset by the harness, which says',
124
+ ' so — `Shell cwd was reset to <root>`. Neither can be assumed, which is why every remedy names the',
125
+ ' root explicitly instead of telling the agent to `cd` first.',
126
+ '',
127
+ '## Preamble — resolve the target first (Bash only)',
128
+ '',
129
+ '`EffectiveTreeResolver.resolve()` computes `effectiveCwd`: the directory the command actually runs in,',
130
+ 'which is the shell\'s cwd unless the command leads with `cd <dir> &&`. **K is classified from',
131
+ '`effectiveCwd`, not from the shell\'s cwd** — so "a foreign repo that `cd`s into ours" is not a cell,',
132
+ 'it is simply `pw` after resolution.',
133
+ '',
134
+ 'That holds because K is resolved by ASKING GIT about `effectiveCwd`, not by testing whether the path',
135
+ 'is lexically under the governed root. It has to be said that way round: the resolver used to do the',
136
+ 'path test, and a linked worktree under `.claude/worktrees/**` therefore resolved `f` — every bash',
137
+ 'guard exempt in the one sandbox agents are told to work in. A sentence in this file asserted the',
138
+ 'opposite as fact for several releases, which is how it went unnoticed.',
139
+ '',
140
+ 'Only a LEADING run of `cd`/`pushd` counts. A *trailing* `… && cd <exempt-tree>` must never',
141
+ 'retroactively pull a command out of scope — that would smuggle a root-level `git push` past the',
142
+ 'guards. Quoting is handled by `ShellSegmentScan`, so `echo "cd sub && git push"` is one opaque',
143
+ 'segment and its quoted `cd` is never picked up.',
144
+ '',
145
+ ...renderFilterSection(),
146
+ ];
147
+ }
148
+ // `excludePaths` — a FILTER over the rule list, not a dimension of the table. Its own function because
149
+ // renderHead is at the 70-line method cap, and because this section is one self-contained argument.
150
+ // webpieces-disable no-function-outside-class -- prose section of renderL1Doc's string, beside it in this module
151
+ function renderFilterSection() {
152
+ return [
153
+ '## Filter — not a dimension (all tools)',
154
+ '',
155
+ '`filterByExcludedPaths` drops every rule excluded for this path: the **target path** for',
156
+ 'Read/Write/Edit, `effectiveCwd` for Bash. An empty rule list means allow. This is a filter, not a row:',
157
+ '"exempt" is what emerges when the list empties.',
158
+ '',
159
+ 'ONE path is filtered out BEFORE the list is consulted and cannot be put back: **`.webpieces/`**,',
160
+ 'the tooling\'s own state dir (`isWebpiecesStateDir`). It is gitignored in every consumer, so nothing',
161
+ 'under it can reach a branch, be reviewed or be reverted — every reason L2 prints for protecting',
162
+ '`main` is vacuous there. It was config-only once, which made the exemption optional on exactly the',
163
+ 'directory webpieces itself writes to: `wp-review-upsert-pr` hands a reviewer subagent a',
164
+ '`<primary>/.webpieces/worktrees/agent-<id>/pr-review/…` path, that write resolves to the PRIMARY',
165
+ 'clone, and L2 judged the primary\'s live branch — so the reviewer was denied "You should not be',
166
+ 'working on main" whenever an unrelated session had left the primary there. There is deliberately',
167
+ 'NO companion `".webpieces/**"` glob seeded into `excludePaths`: a config entry that changes',
168
+ 'nothing is a second and WEAKER spelling — the matcher below misses the bare directory that the',
169
+ 'predicate matches — and it invites a consumer to delete it and believe the exemption went too.',
170
+ '',
171
+ // The SUBJECT of this paragraph is which SPELLING of the state dir is exempt, so the two
172
+ // spellings have to appear literally — computing them from a resolver would print one path and
173
+ // destroy the contrast that is the whole point. This is exactly the case the rule's own escape
174
+ // is for, and it is scoped to the three lines below rather than the file.
175
+ '<!-- webpieces-disable no-state-paths-in-templates -- this paragraph\'s subject IS the two spellings of the state dir; a computed path would print one of them and lose the contrast -->',
176
+ 'The skip is asked about the path relative to the tree that **OWNS** the file, not to the governed',
177
+ 'root, and the two differ in exactly one place: a linked worktree. `<primary>/.webpieces/…` was',
178
+ 'exempt while `<primary>/.claude/worktrees/agent-<id>/.webpieces/pr-review/…/summary.json` — the same',
179
+ 'kind of file, in a worktree\'s own state dir — was not, because governed-root-relative it begins',
180
+ '`.claude`. That is the file `wp-review-upsert-pr` REQUIRES before `wp-finish-upsert-pr` will open a',
181
+ 'PR, so the guard could forbid a file the gate demands (issue #851). `GovernedPath` carries both',
182
+ 'spellings together so a caller cannot reach for the wrong one.',
183
+ '',
184
+ '`excludePaths` is **ONE glob list** (canonical: `"excludePaths": ["repositories/**"]`). The',
185
+ '`{ rules: [...], guards: [...] }` object is **retired and rejected**, with the union it must become',
186
+ 'named in the error. `wp-install-ai-hooks` migrates it in place.',
187
+ '',
188
+ 'This used to be a tolerated fallback, justified here by "rejecting it would block every Bash/Edit',
189
+ 'including the edit that would fix it." **That was never true**, and the fallback it licensed is why',
190
+ 'consumer configs — this repo\'s own included — sat on the dead shape for releases. A Write/Edit whose',
191
+ 'target is `webpieces.config.json` is an unconditional **PASS** (see the L0 table above), and',
192
+ '`pnpm install` has an installer bypass, so an invalid config can always be repaired from inside the',
193
+ 'block. Config rejection is self-recoverable by construction; see `retired-config-keys.ts` for the',
194
+ 'policy and the reasoning.',
195
+ '',
196
+ ];
197
+ }
198
+ // The legend, the table itself (ROW DATA), and the note on the two structural blocks.
199
+ // webpieces-disable no-function-outside-class -- second section of renderL1Doc's string, beside it in this module
200
+ function renderTable() {
201
+ return [
202
+ '## Legend',
203
+ '',
204
+ '| col | dimension | values |',
205
+ '|---|---|---|',
206
+ '| **K** | tree kind of the resolved target, from git\'s own dirs | `f` foreign repo (a DIFFERENT `--git-common-dir`) · `m` the directory does not exist · `o` outside any repo · `w` a LINKED worktree of ours (`--git-dir` ≠ `--git-common-dir`), wherever it sits on disk · `pw` ours (primary **or** worktree) |',
207
+ '| **V** | do the `@webpieces` versions agree between this worktree and the MAIN tree | `n` skewed · `y` in sync |',
208
+ '| **R** | command is provably read-only inspection | `n` · `y` |',
209
+ '| **G** | command invokes git/gh | `n` · `y` |',
210
+ '| **P** | position of the resolved target | `root` · `sub` |',
211
+ '',
212
+ 'All of them are **Bash only**. Read/Write/Edit resolve their own target (`input.filePath`) and have no',
213
+ 'dimensions — the filter is all that applies to them. **The Read tool is never blocked by L1.**',
214
+ '',
215
+ 'A linked worktree is deliberately **not** foreign: it is the same project, so the guards run against',
216
+ 'THAT tree\'s branch and cache. Every rule-scoped guard treats `p` and `w` alike, hence `pw`; row 8 below',
217
+ 'is the ONE place they separate, and it turns on **V** — the versions, read off the tree itself.',
218
+ '',
219
+ 'PLACEMENT IS NOT IDENTITY. A worktree checked out INSIDE the repo — `<repo>/.claude/worktrees/agent-XXXX`,',
220
+ 'which is where Claude Code puts every agent worktree — is `w` exactly like a sibling `../feature-dir` one.',
221
+ 'K comes from git\'s own dirs (`--git-common-dir` is identical for every checkout of one repo,',
222
+ '`--git-dir` differs only in a linked worktree), never from whether the path sits under the governed root.',
223
+ 'It used to short-circuit on that path test, so an in-repo worktree read as `f` — every bash guard exempt,',
224
+ 'and row 8 unreachable, for the only layout the harness actually produces. A nested clone under',
225
+ '`repositories/**` still reads `f`, because its shared git dir is its own.',
226
+ '',
227
+ '`V` comes from reading manifests off disk — the MAIN tree\'s `pnpm-workspace.yaml` catalog pin, its',
228
+ 'installed `node_modules` version, this worktree\'s pin, and this worktree\'s own installed version when',
229
+ 'it has one (which it does the moment anyone runs `pnpm add` there). Three always, a fourth when',
230
+ 'present. Anything unreadable is NO OPINION, never skew: a guard that cannot measure must not block.',
231
+ 'It is deliberately NOT read from `agent_id`/`agent_type` — the dimension this replaced was, and a',
232
+ 'worktree-isolated agent was measured resuming on the primary clone after its tree was reaped, so who',
233
+ 'is asking cannot be trusted to say which tree is being acted on.',
234
+ '',
235
+ '`R` is `ReadOnlyInspectionScan` — the same paranoid "provably inert" test the unloadable-config escape',
236
+ 'hatch uses (allowlisted viewers/searchers only, no redirects, no `sed -i`).',
237
+ '',
238
+ '## Table',
239
+ '',
240
+ '| # | K | V | R | G | P | act | why | cure |',
241
+ '|---|---|---|---|---|---|---|---|---|',
242
+ // Row 0 is the PRE-STAGE (`misplacedCdBlock`). It decides from command TEXT before a tree is
243
+ // resolved, so it cannot be classified over the five dimensions rows 1-6 share — but it IS an
244
+ // L1 block, and an L1 block the table did not describe is exactly the drift this table exists
245
+ // to prevent. It is numbered 0, not 7, because it does not sit in the first-match scan; and it
246
+ // is PRINTED because `row=0` in the L1 log has to join to something.
247
+ `| ${l1_rows_1.L1_PRESTAGE_ROW} | – | – | – | – | – | 4 block | a \`cd\` that is not leading + literal, judged before any tree is resolved | \`cd <literal abs path> && <the rest>\` — ONE leading \`cd\`, or drop it |`,
248
+ ...l1_rows_1.L1_ROWS.map(tableRow),
249
+ '',
250
+ 'Rows 3, 5 and 7 are the structural blocks, and they run as ONE step (`l1LocationBlock` in `runner.ts`)',
251
+ 'so they can never be reordered by accident — row 7 (the directory is gone) first, then row 8, then',
252
+ 'force-to-root. Row 7 is printed LAST above only because row numbers are stable across releases and',
253
+ 'renumbering 1-6 would invalidate every `row=` in the logs; `m` matches no other row, so its position',
254
+ 'in the scan is immaterial. All three sit after the L0',
255
+ 'allowlist, after the `f` check, and after the `excludePaths` filter and the config-sync check. So a',
256
+ 'cure (`cd <worktree> && pnpm install`) still reaches any tree: that is L0\'s invariant, and row 8 does',
257
+ 'not weaken it.',
258
+ '',
259
+ ];
260
+ }
261
+ // The use-case table (ROW DATA, in the doc's own numbering) and the two notes that follow it.
262
+ // webpieces-disable no-function-outside-class -- third section of renderL1Doc's string, beside it in this module
263
+ function renderUseCases() {
264
+ return [
265
+ '## L1 use cases',
266
+ '',
267
+ 'Same row shape as L0: the **Fix** is literal or it is not a fix. `<root>` is the absolute workspace',
268
+ 'root — the messages name it explicitly rather than telling you to `cd` first, for the reason in the',
269
+ 'section head (neither the shell\'s cwd nor a `cd`\'s persistence can be assumed).',
270
+ '',
271
+ '| # | what you SEE (exact symptom) | state | verdict | Fix |',
272
+ '|---|---|---|---|---|',
273
+ ...(0, l1_rows_1.allL1UseCases)().map(useCaseRow),
274
+ '',
275
+ 'Row 8 is the one that changed. It used to be ALLOWED, because the predicate was',
276
+ '`shellAtRoot || cdsToRoot` — two variables OR\'d, so the same destination got opposite verdicts',
277
+ 'depending on where the shell happened to start. It is now one variable, `effectiveCwd === root`.',
278
+ '',
279
+ 'Row 12 is the incident that produced table row 8, and it is a VERSION SKEW incident — which is why',
280
+ 'the row that replaced it measures versions rather than agent identity. The coordinator ran',
281
+ '`git worktree add`, `cd`\'d in,',
282
+ 'and worked there. An L0 version-drift fault then fired against the PRIMARY (pin `0.4.545` vs',
283
+ '`node_modules` `0.4.526`) and prescribed `pnpm install` — which ran in the WORKTREE, internally',
284
+ 'consistent at `0.4.526`/`0.4.526`, so it succeeded, changed nothing in the measured tree, and the guard',
285
+ 're-denied. Five identical installs later the agent had invented a theory about the harness stripping',
286
+ 'its `cd` and handed the problem to the human. Note what row 15 says: the fix is NOT to deny that',
287
+ 'install. It is to make the split state unreachable, so the wrong-tree install is never plausible.',
288
+ '',
289
+ ];
290
+ }
291
+ // The known gap and the code anchors — prose, and the one section that must never be summarised away:
292
+ // three code comments point at it.
293
+ // webpieces-disable no-function-outside-class -- last section of renderL1Doc's string, beside it in this module
294
+ function renderTail() {
295
+ return [
296
+ '## Not done — `o` is not exempt yet',
297
+ '',
298
+ 'Row 2 hands `\'outside\'` down to L2 rather than exempting it. `\'outside\'` is produced at',
299
+ '`effective-tree.ts` (git has no answer for the directory) carrying `governedRoot`, and **no code branches on it**, so a',
300
+ 'command in no git repo is judged against the governed repo\'s branch and staleness state. That is a',
301
+ 'wrong verdict, and `exempt` is the right action.',
302
+ '',
303
+ '**It must not ship alone.** Jurisdiction comes from the shell cwd, not from what the command touches,',
304
+ 'so exempting `o` opens a bypass an agent reaches by typing `cd /tmp &&`:',
305
+ '',
306
+ '| command | today | with `o → exempt` alone |',
307
+ '|---|---|---|',
308
+ '| `cd /tmp && ls` | judged against the repo | exempt — **correct** |',
309
+ '| `cd /tmp && git -C $REPO commit` | L2 guards fire | exempt — **every L2 guard bypassed** |',
310
+ '| `cd /tmp && rm -rf $REPO/packages/http/src` | judged | exempt — **unguarded** |',
311
+ '',
312
+ 'The two cases only separate once jurisdiction is judged on **what the command touches** (explicit',
313
+ '`git -C` / `--work-tree`, then path arguments, then the `cd`, then the shell cwd), with the fail-safe',
314
+ 'rule that **any** resolved target inside `governedRoot` means `pw`. Ship the two together, or neither.',
315
+ '',
316
+ 'Tracked in `backlog/bug-bash-guards-judge-the-shell-cwd-not-the-paths-the-command-touches.md` and',
317
+ '`backlog/bug-outside-tree-kind-is-never-consumed-so-a-non-git-dir-is-judged-against-the-governed-repo.md`.',
318
+ 'That resolver has three consumers — L1\'s K, L2\'s scope dimension, and `excludePaths` on the Bash path',
319
+ '— which is why the backlog says **fix once**.',
320
+ '',
321
+ '---',
322
+ '',
323
+ '',
324
+ '## Code anchors',
325
+ '',
326
+ '| section | file | symbol |',
327
+ '|---|---|---|',
328
+ '| resolver, K | `hook-runtime/src/core/effective-tree.ts` | `EffectiveTreeResolver`, `TreeKind` |',
329
+ '| the two structural blocks, in order | `agent-workflow-rules/src/core/runner.ts` | `l1LocationBlock` |',
330
+ '| trinary-version-skew (row 8), V, R | `agent-workflow-rules/src/core/version-sync.ts` | `VersionSyncGuard`, `WebpiecesVersions` |',
331
+ '| force-to-root (row 5) | `agent-workflow-rules/src/core/force-to-root.ts` | `ForceToRootGuard` |',
332
+ '| the directory is gone (row 7) | `agent-workflow-rules/src/core/missing-directory.ts` | `MissingDirectoryGuard` |',
333
+ '| the filter | `hook-runtime/src/core/excluded-paths.ts` | `filterByExcludedPaths` |',
334
+ '| which tree owns a TARGET PATH | `hook-runtime/src/core/target-tree.ts` | `TargetTreeResolver`, `GovernedPath` |',
335
+ '| `excludePaths` shape | `rules-config/src/exclude-hook-paths.ts`, `validate-config.ts`, `retired-config-keys.ts` | `ExcludePaths`, `validateExcludePaths` |',
336
+ '| the `.webpieces/` skip | `rules-config/src/exclude-hook-paths.ts` | `isWebpiecesStateDir` |',
337
+ '',
338
+ ];
339
+ }
340
+ //# sourceMappingURL=l1-doc.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"l1-doc.js","sourceRoot":"","sources":["../../../../../../packages/tooling/agent-workflow-rules/src/core/l1-doc.ts"],"names":[],"mappings":"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","sourcesContent":["import { L1Row, L1UseCase, L1_ROWS, L1_PRESTAGE_ROW, allL1UseCases } from './l1-rows';\n\n// ---------------------------------------------------------------------------\n// guards/L1-location.md, rendered from L1_ROWS.\n//\n// Same arrangement as l0-matrix.renderGuardMatrixDoc(): one join('\\n') of literal markdown lines with\n// the ROW DATA interpolated from the array the guard consults. Everything that is not row data — every\n// prose section — is a literal line here, because that is the half a generator cannot own.\n//\n// A unit test (l1-matrix.spec.ts) locks guards/L1-location.md byte-identical to renderL1Doc(), and\n// `pnpm guards:generate` rewrites the file. So the table in the doc IS the array, not a description of\n// it. This module, like l1-rows.ts, has no runtime imports outside this pair so the generator can load\n// it without the package's transitive dependencies.\n// ---------------------------------------------------------------------------\n\n/** A dimension cell: the wildcard renders bare, every value renders as code. */\n// webpieces-disable no-function-outside-class -- pure cell formatter for renderL1Doc below, in this render module\nfunction cell(value: string): string {\n return value === '-' ? '-' : `\\`${value}\\``;\n}\n\n// webpieces-disable no-function-outside-class -- pure row formatter for renderL1Doc below, in this render module\nfunction tableRow(row: L1Row): string {\n const dims = [row.k, row.a, row.r, row.g, row.p].map(cell).join(' | ');\n // Row 6 has no `why` — an EMPTY cell is `| |`, not `| |`. Two spaces would render the same in a\n // browser and fail the byte-lock, which is the whole point of locking bytes rather than markdown.\n const why = row.why === '' ? ' ' : ` ${row.why} `;\n // The CURE column exists so a reader who arrived here from a `row=` in a log gets the remedy on the\n // same line as the verdict, the way L2's matrix does. Only blocking rows have one; a row that hands\n // down to L2 or exempts has nothing to cure, and says so rather than leaving the cell blank.\n const cure = row.cure === null ? 'n/a — not a block' : row.cure.summary;\n return `| ${row.num} | ${dims} | ${row.action.label} |${why}| ${cure} |`;\n}\n\n// webpieces-disable no-function-outside-class -- pure row formatter for renderL1Doc below, in this render module\nfunction useCaseRow(useCase: L1UseCase): string {\n return `| ${useCase.num} | ${useCase.symptom} | ${useCase.state} | ${useCase.verdict} | ${useCase.fix} |`;\n}\n\n/**\n * Render guards/L1-location.md.\n *\n * Split into three consecutive halves purely to stay inside the method-line budget — the join order is\n * what makes them one file, so keep them adjacent and keep the byte-lock test as the arbiter.\n */\n// webpieces-disable no-function-outside-class -- pure string builder over L1_ROWS, beside the array it reads\nexport function renderL1Doc(): string {\n return [\n ...renderHead(),\n ...renderTable(),\n ...renderLogJoin(),\n ...renderUseCases(),\n ...renderTail(),\n ].join('\\n');\n}\n\n// How a `row=` in the L1 log joins back to the table above — the section this doc existed without for\n// 1,457 logged decisions across nine repos, none of which an agent could look up, because the DELIVERED\n// copy of this page did not exist either. L2's doc has carried the same section since its own delivery.\n// webpieces-disable no-function-outside-class -- prose section of renderL1Doc's string, beside it in this module\nfunction renderLogJoin(): string[] {\n return [\n '## How a log line joins to a row',\n '',\n 'Every L1 decision is written to `.webpieces/logs/L1-location/<writer>.log` with `layer=L1` and',\n '`row=<n>`, where `<n>` is a row number from the table above. So `row=6` means \"this call was judged',\n 'by row 6\" and you read the dimensions, the verdict, the reason and the cure straight off that line. Row `0` is',\n 'the pre-stage; it is in the table for exactly this reason.',\n '',\n '**The join is by DISPATCH, and that is the difference from L2.** L1 takes the FIRST matching row in',\n '`L1_ROWS` and switches on it, so a row and a behaviour are the same object — delete the row and you',\n 'delete the block. L2\\'s four guard classes each own their own ladder and join to their rows by REASON',\n 'instead (see `webpieces.branch-state-matrix.md`). A totality test walks all 80 classifications and',\n 'asserts each lands on exactly one row, so there is no verdict this page cannot explain.',\n '',\n 'Row numbers are IDENTITY and are never reused: row 3 is retired (coordinator-in-worktree) and row 8',\n 'was added in its place rather than renumbering 4-7, because every `row=` already written to a log',\n 'would otherwise re-point.',\n '',\n ];\n}\n\n\n// The three questions L1 answers, the preamble and the filter — all prose, none of it row data.\n// webpieces-disable no-function-outside-class -- first section of renderL1Doc's string, beside it in this module\nfunction renderHead(): string[] {\n return [\n '# L1 — location',\n '',\n '**Goal: is this call ours to judge, is this tree governed by the release it asks for, and is git being run from the root?**',\n '',\n '**Config key: none, and none is proposed.** Force-to-root and trinary-version-skew have **no config',\n 'key** and cannot be disabled; `excludePaths` is a top-level block, not a `hookGuards` entry. A',\n '`location-guard` key was once proposed here — it never existed, and `hookGuards` has just gone from',\n 'nine keys to three, so adding a tenth-turned-fourth for a layer nobody has asked to switch off would',\n 'run against the whole point. L0 has no key for the stronger version of the same reason: a layer that',\n 'decides whether the tooling can be trusted cannot be configured by the file it has not validated yet.',\n '',\n '',\n '**Code:** `packages/tooling/hook-runtime/src/core/effective-tree.ts` (`EffectiveTreeResolver`,',\n '`TreeKind`) · `packages/tooling/hook-runtime/src/core/target-tree.ts` (`TargetTreeResolver`,',\n '`GovernedPath` — the same question asked about a FILE) ·',\n '`packages/tooling/agent-workflow-rules/src/core/runner.ts` (`l1LocationBlock`, the `foreign` check) ·',\n '`packages/tooling/hook-runtime/src/core/excluded-paths.ts` (`filterByExcludedPaths`) ·',\n '`.../force-to-root.ts` (`ForceToRootGuard`) ·',\n '`packages/tooling/agent-workflow-rules/src/core/missing-directory.ts` (`MissingDirectoryGuard`) ·',\n '`packages/tooling/agent-workflow-rules/src/core/version-sync.ts` (`VersionSyncGuard`,',\n '`WebpiecesVersions`).',\n '',\n 'L1 answers four questions, and they are genuinely separate:',\n '',\n '1. **Do we govern this at all?** — the escape hatches, for other repos and non-governed paths.',\n ' Answered by asking GIT (`--git-common-dir`), never by path math: see the legend under **K**.',\n '2. **Does the directory still EXIST?** — row 7. A worktree reaped out from under a live shell leaves',\n ' a cwd that names nothing, and that state needs its own name and its own message, because the',\n ' remedy for \"you are in a subdirectory\" is a `cd` back into the very directory that is gone.',\n '3. **Is this tree governed by a release it did not ask for?** — row 8. A worktree MAY have its own',\n ' `node_modules` (nx, vitest and the eslint plugin all execute there and load from it), and when it',\n ' has none the shim\\'s upward walk runs the main tree\\'s binary. Either way the rule is the same and',\n ' holds whichever registration form — absolute or relative — is live in the consumer: the two trees',\n ' must PIN the same `@webpieces`, or the worktree is linted, validated and built by a release its',\n ' own manifest does not ask for. Asked of the PATH acted on, never of who is asking —',\n ' agent identity was measured untrustworthy for tree detection (a worktree-isolated agent whose tree',\n ' is auto-reaped at a turn boundary silently resumes on the primary clone).',\n '4. **Is the agent stranded away from the root?** — force-to-root, git/gh only. Agents forget where',\n ' they are constantly, and `cd` gives them two different ways to be wrong: a `cd` that stays INSIDE',\n ' the workspace PERSISTS to later calls (so the shell can be parked in a subdirectory left by an',\n ' unrelated command turns earlier), while a `cd` that LEAVES it is reset by the harness, which says',\n ' so — `Shell cwd was reset to <root>`. Neither can be assumed, which is why every remedy names the',\n ' root explicitly instead of telling the agent to `cd` first.',\n '',\n '## Preamble — resolve the target first (Bash only)',\n '',\n '`EffectiveTreeResolver.resolve()` computes `effectiveCwd`: the directory the command actually runs in,',\n 'which is the shell\\'s cwd unless the command leads with `cd <dir> &&`. **K is classified from',\n '`effectiveCwd`, not from the shell\\'s cwd** — so \"a foreign repo that `cd`s into ours\" is not a cell,',\n 'it is simply `pw` after resolution.',\n '',\n 'That holds because K is resolved by ASKING GIT about `effectiveCwd`, not by testing whether the path',\n 'is lexically under the governed root. It has to be said that way round: the resolver used to do the',\n 'path test, and a linked worktree under `.claude/worktrees/**` therefore resolved `f` — every bash',\n 'guard exempt in the one sandbox agents are told to work in. A sentence in this file asserted the',\n 'opposite as fact for several releases, which is how it went unnoticed.',\n '',\n 'Only a LEADING run of `cd`/`pushd` counts. A *trailing* `… && cd <exempt-tree>` must never',\n 'retroactively pull a command out of scope — that would smuggle a root-level `git push` past the',\n 'guards. Quoting is handled by `ShellSegmentScan`, so `echo \"cd sub && git push\"` is one opaque',\n 'segment and its quoted `cd` is never picked up.',\n '',\n ...renderFilterSection(),\n ];\n}\n\n// `excludePaths` — a FILTER over the rule list, not a dimension of the table. Its own function because\n// renderHead is at the 70-line method cap, and because this section is one self-contained argument.\n// webpieces-disable no-function-outside-class -- prose section of renderL1Doc's string, beside it in this module\nfunction renderFilterSection(): string[] {\n return [\n '## Filter — not a dimension (all tools)',\n '',\n '`filterByExcludedPaths` drops every rule excluded for this path: the **target path** for',\n 'Read/Write/Edit, `effectiveCwd` for Bash. An empty rule list means allow. This is a filter, not a row:',\n '\"exempt\" is what emerges when the list empties.',\n '',\n 'ONE path is filtered out BEFORE the list is consulted and cannot be put back: **`.webpieces/`**,',\n 'the tooling\\'s own state dir (`isWebpiecesStateDir`). It is gitignored in every consumer, so nothing',\n 'under it can reach a branch, be reviewed or be reverted — every reason L2 prints for protecting',\n '`main` is vacuous there. It was config-only once, which made the exemption optional on exactly the',\n 'directory webpieces itself writes to: `wp-review-upsert-pr` hands a reviewer subagent a',\n '`<primary>/.webpieces/worktrees/agent-<id>/pr-review/…` path, that write resolves to the PRIMARY',\n 'clone, and L2 judged the primary\\'s live branch — so the reviewer was denied \"You should not be',\n 'working on main\" whenever an unrelated session had left the primary there. There is deliberately',\n 'NO companion `\".webpieces/**\"` glob seeded into `excludePaths`: a config entry that changes',\n 'nothing is a second and WEAKER spelling — the matcher below misses the bare directory that the',\n 'predicate matches — and it invites a consumer to delete it and believe the exemption went too.',\n '',\n // The SUBJECT of this paragraph is which SPELLING of the state dir is exempt, so the two\n // spellings have to appear literally — computing them from a resolver would print one path and\n // destroy the contrast that is the whole point. This is exactly the case the rule's own escape\n // is for, and it is scoped to the three lines below rather than the file.\n '<!-- webpieces-disable no-state-paths-in-templates -- this paragraph\\'s subject IS the two spellings of the state dir; a computed path would print one of them and lose the contrast -->',\n 'The skip is asked about the path relative to the tree that **OWNS** the file, not to the governed',\n 'root, and the two differ in exactly one place: a linked worktree. `<primary>/.webpieces/…` was',\n 'exempt while `<primary>/.claude/worktrees/agent-<id>/.webpieces/pr-review/…/summary.json` — the same',\n 'kind of file, in a worktree\\'s own state dir — was not, because governed-root-relative it begins',\n '`.claude`. That is the file `wp-review-upsert-pr` REQUIRES before `wp-finish-upsert-pr` will open a',\n 'PR, so the guard could forbid a file the gate demands (issue #851). `GovernedPath` carries both',\n 'spellings together so a caller cannot reach for the wrong one.',\n '',\n '`excludePaths` is **ONE glob list** (canonical: `\"excludePaths\": [\"repositories/**\"]`). The',\n '`{ rules: [...], guards: [...] }` object is **retired and rejected**, with the union it must become',\n 'named in the error. `wp-install-ai-hooks` migrates it in place.',\n '',\n 'This used to be a tolerated fallback, justified here by \"rejecting it would block every Bash/Edit',\n 'including the edit that would fix it.\" **That was never true**, and the fallback it licensed is why',\n 'consumer configs — this repo\\'s own included — sat on the dead shape for releases. A Write/Edit whose',\n 'target is `webpieces.config.json` is an unconditional **PASS** (see the L0 table above), and',\n '`pnpm install` has an installer bypass, so an invalid config can always be repaired from inside the',\n 'block. Config rejection is self-recoverable by construction; see `retired-config-keys.ts` for the',\n 'policy and the reasoning.',\n '',\n ];\n}\n\n// The legend, the table itself (ROW DATA), and the note on the two structural blocks.\n// webpieces-disable no-function-outside-class -- second section of renderL1Doc's string, beside it in this module\nfunction renderTable(): string[] {\n return [\n '## Legend',\n '',\n '| col | dimension | values |',\n '|---|---|---|',\n '| **K** | tree kind of the resolved target, from git\\'s own dirs | `f` foreign repo (a DIFFERENT `--git-common-dir`) · `m` the directory does not exist · `o` outside any repo · `w` a LINKED worktree of ours (`--git-dir` ≠ `--git-common-dir`), wherever it sits on disk · `pw` ours (primary **or** worktree) |',\n '| **V** | do the `@webpieces` versions agree between this worktree and the MAIN tree | `n` skewed · `y` in sync |',\n '| **R** | command is provably read-only inspection | `n` · `y` |',\n '| **G** | command invokes git/gh | `n` · `y` |',\n '| **P** | position of the resolved target | `root` · `sub` |',\n '',\n 'All of them are **Bash only**. Read/Write/Edit resolve their own target (`input.filePath`) and have no',\n 'dimensions — the filter is all that applies to them. **The Read tool is never blocked by L1.**',\n '',\n 'A linked worktree is deliberately **not** foreign: it is the same project, so the guards run against',\n 'THAT tree\\'s branch and cache. Every rule-scoped guard treats `p` and `w` alike, hence `pw`; row 8 below',\n 'is the ONE place they separate, and it turns on **V** — the versions, read off the tree itself.',\n '',\n 'PLACEMENT IS NOT IDENTITY. A worktree checked out INSIDE the repo — `<repo>/.claude/worktrees/agent-XXXX`,',\n 'which is where Claude Code puts every agent worktree — is `w` exactly like a sibling `../feature-dir` one.',\n 'K comes from git\\'s own dirs (`--git-common-dir` is identical for every checkout of one repo,',\n '`--git-dir` differs only in a linked worktree), never from whether the path sits under the governed root.',\n 'It used to short-circuit on that path test, so an in-repo worktree read as `f` — every bash guard exempt,',\n 'and row 8 unreachable, for the only layout the harness actually produces. A nested clone under',\n '`repositories/**` still reads `f`, because its shared git dir is its own.',\n '',\n '`V` comes from reading manifests off disk — the MAIN tree\\'s `pnpm-workspace.yaml` catalog pin, its',\n 'installed `node_modules` version, this worktree\\'s pin, and this worktree\\'s own installed version when',\n 'it has one (which it does the moment anyone runs `pnpm add` there). Three always, a fourth when',\n 'present. Anything unreadable is NO OPINION, never skew: a guard that cannot measure must not block.',\n 'It is deliberately NOT read from `agent_id`/`agent_type` — the dimension this replaced was, and a',\n 'worktree-isolated agent was measured resuming on the primary clone after its tree was reaped, so who',\n 'is asking cannot be trusted to say which tree is being acted on.',\n '',\n '`R` is `ReadOnlyInspectionScan` — the same paranoid \"provably inert\" test the unloadable-config escape',\n 'hatch uses (allowlisted viewers/searchers only, no redirects, no `sed -i`).',\n '',\n '## Table',\n '',\n '| # | K | V | R | G | P | act | why | cure |',\n '|---|---|---|---|---|---|---|---|---|',\n // Row 0 is the PRE-STAGE (`misplacedCdBlock`). It decides from command TEXT before a tree is\n // resolved, so it cannot be classified over the five dimensions rows 1-6 share — but it IS an\n // L1 block, and an L1 block the table did not describe is exactly the drift this table exists\n // to prevent. It is numbered 0, not 7, because it does not sit in the first-match scan; and it\n // is PRINTED because `row=0` in the L1 log has to join to something.\n `| ${L1_PRESTAGE_ROW} | – | – | – | – | – | 4 block | a \\`cd\\` that is not leading + literal, judged before any tree is resolved | \\`cd <literal abs path> && <the rest>\\` — ONE leading \\`cd\\`, or drop it |`,\n ...L1_ROWS.map(tableRow),\n '',\n 'Rows 3, 5 and 7 are the structural blocks, and they run as ONE step (`l1LocationBlock` in `runner.ts`)',\n 'so they can never be reordered by accident — row 7 (the directory is gone) first, then row 8, then',\n 'force-to-root. Row 7 is printed LAST above only because row numbers are stable across releases and',\n 'renumbering 1-6 would invalidate every `row=` in the logs; `m` matches no other row, so its position',\n 'in the scan is immaterial. All three sit after the L0',\n 'allowlist, after the `f` check, and after the `excludePaths` filter and the config-sync check. So a',\n 'cure (`cd <worktree> && pnpm install`) still reaches any tree: that is L0\\'s invariant, and row 8 does',\n 'not weaken it.',\n '',\n ];\n}\n\n// The use-case table (ROW DATA, in the doc's own numbering) and the two notes that follow it.\n// webpieces-disable no-function-outside-class -- third section of renderL1Doc's string, beside it in this module\nfunction renderUseCases(): string[] {\n return [\n '## L1 use cases',\n '',\n 'Same row shape as L0: the **Fix** is literal or it is not a fix. `<root>` is the absolute workspace',\n 'root — the messages name it explicitly rather than telling you to `cd` first, for the reason in the',\n 'section head (neither the shell\\'s cwd nor a `cd`\\'s persistence can be assumed).',\n '',\n '| # | what you SEE (exact symptom) | state | verdict | Fix |',\n '|---|---|---|---|---|',\n ...allL1UseCases().map(useCaseRow),\n '',\n 'Row 8 is the one that changed. It used to be ALLOWED, because the predicate was',\n '`shellAtRoot || cdsToRoot` — two variables OR\\'d, so the same destination got opposite verdicts',\n 'depending on where the shell happened to start. It is now one variable, `effectiveCwd === root`.',\n '',\n 'Row 12 is the incident that produced table row 8, and it is a VERSION SKEW incident — which is why',\n 'the row that replaced it measures versions rather than agent identity. The coordinator ran',\n '`git worktree add`, `cd`\\'d in,',\n 'and worked there. An L0 version-drift fault then fired against the PRIMARY (pin `0.4.545` vs',\n '`node_modules` `0.4.526`) and prescribed `pnpm install` — which ran in the WORKTREE, internally',\n 'consistent at `0.4.526`/`0.4.526`, so it succeeded, changed nothing in the measured tree, and the guard',\n 're-denied. Five identical installs later the agent had invented a theory about the harness stripping',\n 'its `cd` and handed the problem to the human. Note what row 15 says: the fix is NOT to deny that',\n 'install. It is to make the split state unreachable, so the wrong-tree install is never plausible.',\n '',\n ];\n}\n\n// The known gap and the code anchors — prose, and the one section that must never be summarised away:\n// three code comments point at it.\n// webpieces-disable no-function-outside-class -- last section of renderL1Doc's string, beside it in this module\nfunction renderTail(): string[] {\n return [\n '## Not done — `o` is not exempt yet',\n '',\n 'Row 2 hands `\\'outside\\'` down to L2 rather than exempting it. `\\'outside\\'` is produced at',\n '`effective-tree.ts` (git has no answer for the directory) carrying `governedRoot`, and **no code branches on it**, so a',\n 'command in no git repo is judged against the governed repo\\'s branch and staleness state. That is a',\n 'wrong verdict, and `exempt` is the right action.',\n '',\n '**It must not ship alone.** Jurisdiction comes from the shell cwd, not from what the command touches,',\n 'so exempting `o` opens a bypass an agent reaches by typing `cd /tmp &&`:',\n '',\n '| command | today | with `o → exempt` alone |',\n '|---|---|---|',\n '| `cd /tmp && ls` | judged against the repo | exempt — **correct** |',\n '| `cd /tmp && git -C $REPO commit` | L2 guards fire | exempt — **every L2 guard bypassed** |',\n '| `cd /tmp && rm -rf $REPO/packages/http/src` | judged | exempt — **unguarded** |',\n '',\n 'The two cases only separate once jurisdiction is judged on **what the command touches** (explicit',\n '`git -C` / `--work-tree`, then path arguments, then the `cd`, then the shell cwd), with the fail-safe',\n 'rule that **any** resolved target inside `governedRoot` means `pw`. Ship the two together, or neither.',\n '',\n 'Tracked in `backlog/bug-bash-guards-judge-the-shell-cwd-not-the-paths-the-command-touches.md` and',\n '`backlog/bug-outside-tree-kind-is-never-consumed-so-a-non-git-dir-is-judged-against-the-governed-repo.md`.',\n 'That resolver has three consumers — L1\\'s K, L2\\'s scope dimension, and `excludePaths` on the Bash path',\n '— which is why the backlog says **fix once**.',\n '',\n '---',\n '',\n '',\n '## Code anchors',\n '',\n '| section | file | symbol |',\n '|---|---|---|',\n '| resolver, K | `hook-runtime/src/core/effective-tree.ts` | `EffectiveTreeResolver`, `TreeKind` |',\n '| the two structural blocks, in order | `agent-workflow-rules/src/core/runner.ts` | `l1LocationBlock` |',\n '| trinary-version-skew (row 8), V, R | `agent-workflow-rules/src/core/version-sync.ts` | `VersionSyncGuard`, `WebpiecesVersions` |',\n '| force-to-root (row 5) | `agent-workflow-rules/src/core/force-to-root.ts` | `ForceToRootGuard` |',\n '| the directory is gone (row 7) | `agent-workflow-rules/src/core/missing-directory.ts` | `MissingDirectoryGuard` |',\n '| the filter | `hook-runtime/src/core/excluded-paths.ts` | `filterByExcludedPaths` |',\n '| which tree owns a TARGET PATH | `hook-runtime/src/core/target-tree.ts` | `TargetTreeResolver`, `GovernedPath` |',\n '| `excludePaths` shape | `rules-config/src/exclude-hook-paths.ts`, `validate-config.ts`, `retired-config-keys.ts` | `ExcludePaths`, `validateExcludePaths` |',\n '| the `.webpieces/` skip | `rules-config/src/exclude-hook-paths.ts` | `isWebpiecesStateDir` |',\n '',\n ];\n}\n"]}
@@ -0,0 +1,31 @@
1
+ import { BlockedResult } from '@webpieces/hook-runtime';
2
+ /** The delivered copy of `guards/L1-location.md`, as a rules-config template name. */
3
+ export declare const LOCATION_MATRIX_DOC = "webpieces.location-matrix.md";
4
+ /**
5
+ * The pointer appended to an L1 deny, or '' when the doc could not be written.
6
+ *
7
+ * Opens with a NEWLINE and carries no quotes or backslashes, for the same two reasons L0's and L2's
8
+ * do: the deny renders in the house format (a header, a `[guard-name]` block, `Fix Option N:` lines)
9
+ * so a pointer glued onto the last line is the one place that shape breaks; and the text is
10
+ * interpolated into a JSON payload, where a quote would corrupt the decision rather than merely the
11
+ * prose.
12
+ *
13
+ * It names the ROW as well as the path — including the pre-stage `0`, which is a real row in the
14
+ * delivered table precisely so this pointer can name it. A bare "read this doc" is a page; a row
15
+ * number is the two lines that explain this exact verdict, and the L1-decisions log line for this
16
+ * same call carries the same `row=`.
17
+ */
18
+ export declare function locationMatrixPointer(docPath: string, row: string): string;
19
+ /**
20
+ * The write and the pointer, applied to one L1 deny — the whole delivery mechanism in one call.
21
+ *
22
+ * `runner.l1LocationBlock` uses this on EVERY branch, which is the point: that is the single scope
23
+ * every L1 deny funnels through and the same scope that logs `row=`, so the deny and the trail cannot
24
+ * name different rows, and no L1 block path added later can silently skip the pointer. The three report
25
+ * builders keep owning their own deny prose — none of them learns about the doc, which is what keeps
26
+ * this from becoming three near-identical stanzas that drift apart.
27
+ *
28
+ * `null` in, `null` out: the tree-based builders own a predicate of their own and can still decline
29
+ * (see `versionSkewBlock`). No deny, no write, no pointer.
30
+ */
31
+ export declare function withLocationMatrixPointer(block: BlockedResult | null, root: string, row: string): BlockedResult | null;
@@ -0,0 +1,111 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LOCATION_MATRIX_DOC = void 0;
4
+ exports.locationMatrixPointer = locationMatrixPointer;
5
+ exports.withLocationMatrixPointer = withLocationMatrixPointer;
6
+ const rules_config_1 = require("@webpieces/rules-config");
7
+ const to_error_1 = require("@webpieces/tooling-common/to-error");
8
+ const hook_runtime_1 = require("@webpieces/hook-runtime");
9
+ // ---------------------------------------------------------------------------
10
+ // The L1 matrix, DELIVERED — the same treatment L0 and L2 already had.
11
+ //
12
+ // THE GAP THIS CLOSES. L1 stamps `layer=L1 row=<n>` on every decision it makes: a fleet audit counted
13
+ // 1,457 of them across nine repos, with rows 0, 1, 4, 5, 6 and 7 all in active use. `.webpieces/instruct-ai/`
14
+ // shipped a matrix for L2 (`webpieces.branch-state-matrix.md`) and one for L0 (`webpieces.guard-matrix.md`)
15
+ // — and NOTHING for L1. An agent told "L1 row 6" had nowhere to look it up.
16
+ //
17
+ // The table itself was never missing; `guards/L1-location.md` has been generated from `L1_ROWS` for
18
+ // releases. What was missing is DELIVERY: `guards/` is a path in webpieces' own repo, not something a
19
+ // consumer repo has. So this names the delivered copy, `generate-guard-docs.ts` writes it from the same
20
+ // `renderL1Doc()` that writes `guards/L1-location.md`, and `l1-matrix.spec.ts` byte-locks the two
21
+ // together — the delivered page cannot describe a table the guards no longer have.
22
+ // ---------------------------------------------------------------------------
23
+ /** The delivered copy of `guards/L1-location.md`, as a rules-config template name. */
24
+ exports.LOCATION_MATRIX_DOC = 'webpieces.location-matrix.md';
25
+ // ---------------------------------------------------------------------------
26
+ // THE POINTER — the half that makes the delivered copy reachable AT THE MOMENT OF THE DENY.
27
+ //
28
+ // Shipping `webpieces.location-matrix.md` fixed the record; it did not fix the experience. An agent
29
+ // told `layer=L1 row=6` while it is BLOCKED reads exactly one thing: the deny text. If that text does
30
+ // not name the table, the table may as well not exist — the doc only helps at the moment of the deny.
31
+ // L0 (`guardMatrixPointer`) and L2 (`branchStateMatrixPointer`) both name theirs; L1 did not, which is
32
+ // the gap PR #696 shipped the doc for and flagged as still open.
33
+ //
34
+ // So this is the same three-piece mechanism l2-matrix-doc.ts documents in full, applied to L1:
35
+ // the DOC LOCATION_MATRIX_DOC above, byte-locked to renderL1Doc() by l1-matrix.spec.ts.
36
+ // the WRITE lazy and best-effort, ONLY on a block — an agent that is not blocked does not need
37
+ // it, and a failed write must cost the reader a pointer, never turn their deny into a
38
+ // stack trace.
39
+ // the POINTER an ABSOLUTE path, opening with a NEWLINE and carrying no quotes or backslashes.
40
+ //
41
+ // It is appended in ONE place — `runner.l1LocationBlock`, the single scope every L1 deny funnels
42
+ // through, holding the matched row and the resolved tree at once. That is deliberately the same scope
43
+ // that already logs `row=`, so the pointer and the log line cannot name different rows.
44
+ // ---------------------------------------------------------------------------
45
+ /**
46
+ * Drop the L1 matrix where the AI can read it, and return its absolute path ('' if it could not be
47
+ * written).
48
+ *
49
+ * Best-effort by design, exactly as `writeGuardMatrixDoc` and `writeBranchStateMatrixDoc` are: this
50
+ * runs on a path that is already denying the call, and a missing template (a `@webpieces/rules-config`
51
+ * older than this package) must cost the reader a pointer, never a stack trace.
52
+ *
53
+ * MODULE-PRIVATE, unlike L0's and L2's, and that is the difference worth keeping: those two export the
54
+ * write and the pointer separately because several rule files compose them by hand. L1 composes them in
55
+ * exactly one place — `withLocationMatrixPointer` below — so exporting this as well would be a second
56
+ * spelling of the same delivery, and callers could reach for the half that emits no pointer.
57
+ */
58
+ // webpieces-disable no-function-outside-class -- sibling of locationMatrixPointer, the shape L0's writeGuardMatrixDoc already established
59
+ function writeLocationMatrixDoc(workspaceRoot) {
60
+ // eslint-disable-next-line @webpieces/no-unmanaged-exceptions
61
+ try {
62
+ return (0, rules_config_1.writeTemplate)(workspaceRoot, exports.LOCATION_MATRIX_DOC);
63
+ }
64
+ catch (err) {
65
+ const error = (0, to_error_1.toError)(err);
66
+ void error; // best-effort: no doc → the deny simply omits the pointer
67
+ return '';
68
+ }
69
+ }
70
+ /**
71
+ * The pointer appended to an L1 deny, or '' when the doc could not be written.
72
+ *
73
+ * Opens with a NEWLINE and carries no quotes or backslashes, for the same two reasons L0's and L2's
74
+ * do: the deny renders in the house format (a header, a `[guard-name]` block, `Fix Option N:` lines)
75
+ * so a pointer glued onto the last line is the one place that shape breaks; and the text is
76
+ * interpolated into a JSON payload, where a quote would corrupt the decision rather than merely the
77
+ * prose.
78
+ *
79
+ * It names the ROW as well as the path — including the pre-stage `0`, which is a real row in the
80
+ * delivered table precisely so this pointer can name it. A bare "read this doc" is a page; a row
81
+ * number is the two lines that explain this exact verdict, and the L1-decisions log line for this
82
+ * same call carries the same `row=`.
83
+ */
84
+ // webpieces-disable no-function-outside-class -- sibling of writeLocationMatrixDoc, mirroring l0-matrix.ts and l2-matrix-doc.ts
85
+ function locationMatrixPointer(docPath, row) {
86
+ if (docPath === '')
87
+ return '';
88
+ return `\nThe full L1 location matrix - every row, its cure, and the observed use cases it covers - is at ${docPath}; this call was judged by ROW ${row}, and the L1-decisions log line for it carries the same row=. READ that row if you are unsure why this call was blocked.`;
89
+ }
90
+ /**
91
+ * The write and the pointer, applied to one L1 deny — the whole delivery mechanism in one call.
92
+ *
93
+ * `runner.l1LocationBlock` uses this on EVERY branch, which is the point: that is the single scope
94
+ * every L1 deny funnels through and the same scope that logs `row=`, so the deny and the trail cannot
95
+ * name different rows, and no L1 block path added later can silently skip the pointer. The three report
96
+ * builders keep owning their own deny prose — none of them learns about the doc, which is what keeps
97
+ * this from becoming three near-identical stanzas that drift apart.
98
+ *
99
+ * `null` in, `null` out: the tree-based builders own a predicate of their own and can still decline
100
+ * (see `versionSkewBlock`). No deny, no write, no pointer.
101
+ */
102
+ // webpieces-disable no-function-outside-class -- sibling of the two functions above; this module is the L1 doc's delivery, and a lone class would break its shape
103
+ function withLocationMatrixPointer(block, root, row) {
104
+ if (block === null)
105
+ return null;
106
+ const pointer = locationMatrixPointer(writeLocationMatrixDoc(root), row);
107
+ if (pointer === '')
108
+ return block;
109
+ return new hook_runtime_1.BlockedResult(block.report + pointer, block.fault);
110
+ }
111
+ //# sourceMappingURL=l1-matrix-doc.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"l1-matrix-doc.js","sourceRoot":"","sources":["../../../../../../packages/tooling/agent-workflow-rules/src/core/l1-matrix-doc.ts"],"names":[],"mappings":";;;AAoFA,sDAGC;AAeD,8DAKC;AA3GD,0DAAwD;AAExD,iEAA6D;AAC7D,0DAAwD;AAExD,8EAA8E;AAC9E,uEAAuE;AACvE,EAAE;AACF,sGAAsG;AACtG,8GAA8G;AAC9G,4GAA4G;AAC5G,4EAA4E;AAC5E,EAAE;AACF,oGAAoG;AACpG,sGAAsG;AACtG,wGAAwG;AACxG,kGAAkG;AAClG,mFAAmF;AACnF,8EAA8E;AAE9E,sFAAsF;AACzE,QAAA,mBAAmB,GAAG,8BAA8B,CAAC;AAElE,8EAA8E;AAC9E,4FAA4F;AAC5F,EAAE;AACF,oGAAoG;AACpG,sGAAsG;AACtG,sGAAsG;AACtG,uGAAuG;AACvG,iEAAiE;AACjE,EAAE;AACF,+FAA+F;AAC/F,+FAA+F;AAC/F,oGAAoG;AACpG,qGAAqG;AACrG,8BAA8B;AAC9B,iGAAiG;AACjG,EAAE;AACF,iGAAiG;AACjG,sGAAsG;AACtG,wFAAwF;AACxF,8EAA8E;AAE9E;;;;;;;;;;;;GAYG;AACH,0IAA0I;AAC1I,SAAS,sBAAsB,CAAC,aAAqB;IACjD,8DAA8D;IAC9D,IAAI,CAAC;QACD,OAAO,IAAA,4BAAa,EAAC,aAAa,EAAE,2BAAmB,CAAC,CAAC;IAC7D,CAAC;IAAC,OAAO,GAAY,EAAE,CAAC;QACpB,MAAM,KAAK,GAAG,IAAA,kBAAO,EAAC,GAAG,CAAC,CAAC;QAC3B,KAAK,KAAK,CAAC,CAAC,0DAA0D;QACtE,OAAO,EAAE,CAAC;IACd,CAAC;AACL,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,gIAAgI;AAChI,SAAgB,qBAAqB,CAAC,OAAe,EAAE,GAAW;IAC9D,IAAI,OAAO,KAAK,EAAE;QAAE,OAAO,EAAE,CAAC;IAC9B,OAAO,qGAAqG,OAAO,iCAAiC,GAAG,0HAA0H,CAAC;AACtR,CAAC;AAED;;;;;;;;;;;GAWG;AACH,kKAAkK;AAClK,SAAgB,yBAAyB,CAAC,KAA2B,EAAE,IAAY,EAAE,GAAW;IAC5F,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IAChC,MAAM,OAAO,GAAG,qBAAqB,CAAC,sBAAsB,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC;IACzE,IAAI,OAAO,KAAK,EAAE;QAAE,OAAO,KAAK,CAAC;IACjC,OAAO,IAAI,4BAAa,CAAC,KAAK,CAAC,MAAM,GAAG,OAAO,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;AAClE,CAAC","sourcesContent":["import { writeTemplate } from '@webpieces/rules-config';\n\nimport { toError } from '@webpieces/tooling-common/to-error';\nimport { BlockedResult } from '@webpieces/hook-runtime';\n\n// ---------------------------------------------------------------------------\n// The L1 matrix, DELIVERED — the same treatment L0 and L2 already had.\n//\n// THE GAP THIS CLOSES. L1 stamps `layer=L1 row=<n>` on every decision it makes: a fleet audit counted\n// 1,457 of them across nine repos, with rows 0, 1, 4, 5, 6 and 7 all in active use. `.webpieces/instruct-ai/`\n// shipped a matrix for L2 (`webpieces.branch-state-matrix.md`) and one for L0 (`webpieces.guard-matrix.md`)\n// — and NOTHING for L1. An agent told \"L1 row 6\" had nowhere to look it up.\n//\n// The table itself was never missing; `guards/L1-location.md` has been generated from `L1_ROWS` for\n// releases. What was missing is DELIVERY: `guards/` is a path in webpieces' own repo, not something a\n// consumer repo has. So this names the delivered copy, `generate-guard-docs.ts` writes it from the same\n// `renderL1Doc()` that writes `guards/L1-location.md`, and `l1-matrix.spec.ts` byte-locks the two\n// together — the delivered page cannot describe a table the guards no longer have.\n// ---------------------------------------------------------------------------\n\n/** The delivered copy of `guards/L1-location.md`, as a rules-config template name. */\nexport const LOCATION_MATRIX_DOC = 'webpieces.location-matrix.md';\n\n// ---------------------------------------------------------------------------\n// THE POINTER — the half that makes the delivered copy reachable AT THE MOMENT OF THE DENY.\n//\n// Shipping `webpieces.location-matrix.md` fixed the record; it did not fix the experience. An agent\n// told `layer=L1 row=6` while it is BLOCKED reads exactly one thing: the deny text. If that text does\n// not name the table, the table may as well not exist — the doc only helps at the moment of the deny.\n// L0 (`guardMatrixPointer`) and L2 (`branchStateMatrixPointer`) both name theirs; L1 did not, which is\n// the gap PR #696 shipped the doc for and flagged as still open.\n//\n// So this is the same three-piece mechanism l2-matrix-doc.ts documents in full, applied to L1:\n// the DOC LOCATION_MATRIX_DOC above, byte-locked to renderL1Doc() by l1-matrix.spec.ts.\n// the WRITE lazy and best-effort, ONLY on a block — an agent that is not blocked does not need\n// it, and a failed write must cost the reader a pointer, never turn their deny into a\n// stack trace.\n// the POINTER an ABSOLUTE path, opening with a NEWLINE and carrying no quotes or backslashes.\n//\n// It is appended in ONE place — `runner.l1LocationBlock`, the single scope every L1 deny funnels\n// through, holding the matched row and the resolved tree at once. That is deliberately the same scope\n// that already logs `row=`, so the pointer and the log line cannot name different rows.\n// ---------------------------------------------------------------------------\n\n/**\n * Drop the L1 matrix where the AI can read it, and return its absolute path ('' if it could not be\n * written).\n *\n * Best-effort by design, exactly as `writeGuardMatrixDoc` and `writeBranchStateMatrixDoc` are: this\n * runs on a path that is already denying the call, and a missing template (a `@webpieces/rules-config`\n * older than this package) must cost the reader a pointer, never a stack trace.\n *\n * MODULE-PRIVATE, unlike L0's and L2's, and that is the difference worth keeping: those two export the\n * write and the pointer separately because several rule files compose them by hand. L1 composes them in\n * exactly one place — `withLocationMatrixPointer` below — so exporting this as well would be a second\n * spelling of the same delivery, and callers could reach for the half that emits no pointer.\n */\n// webpieces-disable no-function-outside-class -- sibling of locationMatrixPointer, the shape L0's writeGuardMatrixDoc already established\nfunction writeLocationMatrixDoc(workspaceRoot: string): string {\n // eslint-disable-next-line @webpieces/no-unmanaged-exceptions\n try {\n return writeTemplate(workspaceRoot, LOCATION_MATRIX_DOC);\n } catch (err: unknown) {\n const error = toError(err);\n void error; // best-effort: no doc → the deny simply omits the pointer\n return '';\n }\n}\n\n/**\n * The pointer appended to an L1 deny, or '' when the doc could not be written.\n *\n * Opens with a NEWLINE and carries no quotes or backslashes, for the same two reasons L0's and L2's\n * do: the deny renders in the house format (a header, a `[guard-name]` block, `Fix Option N:` lines)\n * so a pointer glued onto the last line is the one place that shape breaks; and the text is\n * interpolated into a JSON payload, where a quote would corrupt the decision rather than merely the\n * prose.\n *\n * It names the ROW as well as the path — including the pre-stage `0`, which is a real row in the\n * delivered table precisely so this pointer can name it. A bare \"read this doc\" is a page; a row\n * number is the two lines that explain this exact verdict, and the L1-decisions log line for this\n * same call carries the same `row=`.\n */\n// webpieces-disable no-function-outside-class -- sibling of writeLocationMatrixDoc, mirroring l0-matrix.ts and l2-matrix-doc.ts\nexport function locationMatrixPointer(docPath: string, row: string): string {\n if (docPath === '') return '';\n return `\\nThe full L1 location matrix - every row, its cure, and the observed use cases it covers - is at ${docPath}; this call was judged by ROW ${row}, and the L1-decisions log line for it carries the same row=. READ that row if you are unsure why this call was blocked.`;\n}\n\n/**\n * The write and the pointer, applied to one L1 deny — the whole delivery mechanism in one call.\n *\n * `runner.l1LocationBlock` uses this on EVERY branch, which is the point: that is the single scope\n * every L1 deny funnels through and the same scope that logs `row=`, so the deny and the trail cannot\n * name different rows, and no L1 block path added later can silently skip the pointer. The three report\n * builders keep owning their own deny prose — none of them learns about the doc, which is what keeps\n * this from becoming three near-identical stanzas that drift apart.\n *\n * `null` in, `null` out: the tree-based builders own a predicate of their own and can still decline\n * (see `versionSkewBlock`). No deny, no write, no pointer.\n */\n// webpieces-disable no-function-outside-class -- sibling of the two functions above; this module is the L1 doc's delivery, and a lone class would break its shape\nexport function withLocationMatrixPointer(block: BlockedResult | null, root: string, row: string): BlockedResult | null {\n if (block === null) return null;\n const pointer = locationMatrixPointer(writeLocationMatrixDoc(root), row);\n if (pointer === '') return block;\n return new BlockedResult(block.report + pointer, block.fault);\n}\n"]}