@ontrails/warden 1.0.0-beta.15 → 1.0.0-beta.16

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 (486) hide show
  1. package/CHANGELOG.md +132 -1
  2. package/README.md +64 -30
  3. package/bin/warden.ts +22 -0
  4. package/package.json +25 -8
  5. package/src/ast.ts +28 -0
  6. package/src/cli.ts +740 -46
  7. package/src/command.ts +927 -0
  8. package/src/config.ts +184 -0
  9. package/src/drift.ts +76 -34
  10. package/src/formatters.ts +54 -7
  11. package/src/guide.ts +234 -0
  12. package/src/index.ts +109 -14
  13. package/src/project-context.ts +163 -0
  14. package/src/resolve.ts +530 -0
  15. package/src/rules/activation-orphan.ts +97 -0
  16. package/src/rules/ast.ts +233 -31
  17. package/src/rules/draft-visible-debt.ts +2 -2
  18. package/src/rules/error-mapping-completeness.ts +24 -9
  19. package/src/rules/fires-declarations.ts +201 -52
  20. package/src/rules/incomplete-accessor-for-standard-op.ts +8 -51
  21. package/src/rules/incomplete-crud.ts +8 -7
  22. package/src/rules/index.ts +67 -3
  23. package/src/rules/intent-propagation.ts +6 -21
  24. package/src/rules/layer-field-name-drift.ts +96 -0
  25. package/src/rules/metadata.ts +508 -0
  26. package/src/rules/missing-visibility.ts +1 -1
  27. package/src/rules/no-dev-permit-in-source.ts +99 -0
  28. package/src/rules/no-legacy-layer-imports.ts +193 -0
  29. package/src/rules/no-native-error-result.ts +111 -0
  30. package/src/rules/no-sync-result-assumption.ts +5 -8
  31. package/src/rules/orphaned-signal.ts +1 -1
  32. package/src/rules/owner-projection-parity.ts +146 -0
  33. package/src/rules/public-internal-deep-imports.ts +517 -0
  34. package/src/rules/public-output-schema.ts +29 -0
  35. package/src/rules/public-union-output-discriminants.ts +150 -0
  36. package/src/rules/read-intent-fires.ts +187 -0
  37. package/src/rules/registry-names.ts +32 -2
  38. package/src/rules/resolved-import-boundary.ts +146 -0
  39. package/src/rules/scan.ts +0 -26
  40. package/src/rules/scheduled-destroy-intent.ts +44 -0
  41. package/src/rules/signal-graph-coaching.ts +191 -0
  42. package/src/rules/static-resource-accessor-preference.ts +657 -0
  43. package/src/rules/types.ts +132 -5
  44. package/src/rules/unmaterialized-activation-source.ts +84 -0
  45. package/src/rules/unreachable-detour-shadowing.ts +2 -33
  46. package/src/rules/webhook-route-collision.ts +243 -0
  47. package/src/trails/activation-orphan.trail.ts +81 -0
  48. package/src/trails/error-mapping-completeness.trail.ts +4 -4
  49. package/src/trails/fires-declarations.trail.ts +4 -3
  50. package/src/trails/index.ts +16 -1
  51. package/src/trails/layer-field-name-drift.trail.ts +39 -0
  52. package/src/trails/no-dev-permit-in-source.trail.ts +16 -0
  53. package/src/trails/no-legacy-layer-imports.trail.ts +35 -0
  54. package/src/trails/no-native-error-result.trail.ts +18 -0
  55. package/src/trails/orphaned-signal.trail.ts +1 -1
  56. package/src/trails/owner-projection-parity.trail.ts +26 -0
  57. package/src/trails/public-internal-deep-imports.trail.ts +94 -0
  58. package/src/trails/public-output-schema.trail.ts +55 -0
  59. package/src/trails/public-union-output-discriminants.trail.ts +33 -0
  60. package/src/trails/read-intent-fires.trail.ts +20 -0
  61. package/src/trails/resolved-import-boundary.trail.ts +109 -0
  62. package/src/trails/run.ts +14 -2
  63. package/src/trails/scheduled-destroy-intent.trail.ts +56 -0
  64. package/src/trails/schema.ts +57 -1
  65. package/src/trails/signal-graph-coaching.trail.ts +74 -0
  66. package/src/trails/static-resource-accessor-preference.trail.ts +25 -0
  67. package/src/trails/unmaterialized-activation-source.trail.ts +69 -0
  68. package/src/trails/webhook-route-collision.trail.ts +50 -0
  69. package/src/trails/wrap-rule.ts +30 -3
  70. package/src/workspaces.ts +238 -0
  71. package/.turbo/turbo-build.log +0 -1
  72. package/.turbo/turbo-lint.log +0 -3
  73. package/.turbo/turbo-typecheck.log +0 -1
  74. package/dist/cli.d.ts +0 -63
  75. package/dist/cli.d.ts.map +0 -1
  76. package/dist/cli.js +0 -436
  77. package/dist/cli.js.map +0 -1
  78. package/dist/draft.d.ts +0 -5
  79. package/dist/draft.d.ts.map +0 -1
  80. package/dist/draft.js +0 -16
  81. package/dist/draft.js.map +0 -1
  82. package/dist/drift.d.ts +0 -29
  83. package/dist/drift.d.ts.map +0 -1
  84. package/dist/drift.js +0 -61
  85. package/dist/drift.js.map +0 -1
  86. package/dist/formatters.d.ts +0 -30
  87. package/dist/formatters.d.ts.map +0 -1
  88. package/dist/formatters.js +0 -98
  89. package/dist/formatters.js.map +0 -1
  90. package/dist/index.d.ts +0 -24
  91. package/dist/index.d.ts.map +0 -1
  92. package/dist/index.js +0 -25
  93. package/dist/index.js.map +0 -1
  94. package/dist/rules/ast.d.ts +0 -480
  95. package/dist/rules/ast.d.ts.map +0 -1
  96. package/dist/rules/ast.js +0 -2086
  97. package/dist/rules/ast.js.map +0 -1
  98. package/dist/rules/circular-refs.d.ts +0 -6
  99. package/dist/rules/circular-refs.d.ts.map +0 -1
  100. package/dist/rules/circular-refs.js +0 -83
  101. package/dist/rules/circular-refs.js.map +0 -1
  102. package/dist/rules/context-no-surface-types.d.ts +0 -12
  103. package/dist/rules/context-no-surface-types.d.ts.map +0 -1
  104. package/dist/rules/context-no-surface-types.js +0 -152
  105. package/dist/rules/context-no-surface-types.js.map +0 -1
  106. package/dist/rules/context-no-trailhead-types.d.ts +0 -12
  107. package/dist/rules/context-no-trailhead-types.d.ts.map +0 -1
  108. package/dist/rules/context-no-trailhead-types.js +0 -96
  109. package/dist/rules/context-no-trailhead-types.js.map +0 -1
  110. package/dist/rules/contour-exists.d.ts +0 -7
  111. package/dist/rules/contour-exists.d.ts.map +0 -1
  112. package/dist/rules/contour-exists.js +0 -113
  113. package/dist/rules/contour-exists.js.map +0 -1
  114. package/dist/rules/contour-ids.d.ts +0 -10
  115. package/dist/rules/contour-ids.d.ts.map +0 -1
  116. package/dist/rules/contour-ids.js +0 -12
  117. package/dist/rules/contour-ids.js.map +0 -1
  118. package/dist/rules/cross-declarations.d.ts +0 -13
  119. package/dist/rules/cross-declarations.d.ts.map +0 -1
  120. package/dist/rules/cross-declarations.js +0 -378
  121. package/dist/rules/cross-declarations.js.map +0 -1
  122. package/dist/rules/dead-internal-trail.d.ts +0 -3
  123. package/dist/rules/dead-internal-trail.d.ts.map +0 -1
  124. package/dist/rules/dead-internal-trail.js +0 -80
  125. package/dist/rules/dead-internal-trail.js.map +0 -1
  126. package/dist/rules/draft-file-marking.d.ts +0 -6
  127. package/dist/rules/draft-file-marking.d.ts.map +0 -1
  128. package/dist/rules/draft-file-marking.js +0 -87
  129. package/dist/rules/draft-file-marking.js.map +0 -1
  130. package/dist/rules/draft-visible-debt.d.ts +0 -12
  131. package/dist/rules/draft-visible-debt.d.ts.map +0 -1
  132. package/dist/rules/draft-visible-debt.js +0 -50
  133. package/dist/rules/draft-visible-debt.js.map +0 -1
  134. package/dist/rules/error-mapping-completeness.d.ts +0 -13
  135. package/dist/rules/error-mapping-completeness.d.ts.map +0 -1
  136. package/dist/rules/error-mapping-completeness.js +0 -160
  137. package/dist/rules/error-mapping-completeness.js.map +0 -1
  138. package/dist/rules/example-valid.d.ts +0 -6
  139. package/dist/rules/example-valid.d.ts.map +0 -1
  140. package/dist/rules/example-valid.js +0 -203
  141. package/dist/rules/example-valid.js.map +0 -1
  142. package/dist/rules/fires-declarations.d.ts +0 -16
  143. package/dist/rules/fires-declarations.d.ts.map +0 -1
  144. package/dist/rules/fires-declarations.js +0 -444
  145. package/dist/rules/fires-declarations.js.map +0 -1
  146. package/dist/rules/implementation-returns-result.d.ts +0 -22
  147. package/dist/rules/implementation-returns-result.d.ts.map +0 -1
  148. package/dist/rules/implementation-returns-result.js +0 -839
  149. package/dist/rules/implementation-returns-result.js.map +0 -1
  150. package/dist/rules/incomplete-accessor-for-standard-op.d.ts +0 -30
  151. package/dist/rules/incomplete-accessor-for-standard-op.d.ts.map +0 -1
  152. package/dist/rules/incomplete-accessor-for-standard-op.js +0 -226
  153. package/dist/rules/incomplete-accessor-for-standard-op.js.map +0 -1
  154. package/dist/rules/incomplete-crud.d.ts +0 -21
  155. package/dist/rules/incomplete-crud.d.ts.map +0 -1
  156. package/dist/rules/incomplete-crud.js +0 -368
  157. package/dist/rules/incomplete-crud.js.map +0 -1
  158. package/dist/rules/index.d.ts +0 -51
  159. package/dist/rules/index.d.ts.map +0 -1
  160. package/dist/rules/index.js +0 -119
  161. package/dist/rules/index.js.map +0 -1
  162. package/dist/rules/intent-propagation.d.ts +0 -3
  163. package/dist/rules/intent-propagation.d.ts.map +0 -1
  164. package/dist/rules/intent-propagation.js +0 -57
  165. package/dist/rules/intent-propagation.js.map +0 -1
  166. package/dist/rules/missing-reconcile.d.ts +0 -3
  167. package/dist/rules/missing-reconcile.d.ts.map +0 -1
  168. package/dist/rules/missing-reconcile.js +0 -44
  169. package/dist/rules/missing-reconcile.js.map +0 -1
  170. package/dist/rules/missing-visibility.d.ts +0 -3
  171. package/dist/rules/missing-visibility.d.ts.map +0 -1
  172. package/dist/rules/missing-visibility.js +0 -63
  173. package/dist/rules/missing-visibility.js.map +0 -1
  174. package/dist/rules/no-direct-impl-in-route.d.ts +0 -12
  175. package/dist/rules/no-direct-impl-in-route.d.ts.map +0 -1
  176. package/dist/rules/no-direct-impl-in-route.js +0 -44
  177. package/dist/rules/no-direct-impl-in-route.js.map +0 -1
  178. package/dist/rules/no-direct-implementation-call.d.ts +0 -12
  179. package/dist/rules/no-direct-implementation-call.d.ts.map +0 -1
  180. package/dist/rules/no-direct-implementation-call.js +0 -39
  181. package/dist/rules/no-direct-implementation-call.js.map +0 -1
  182. package/dist/rules/no-sync-result-assumption.d.ts +0 -6
  183. package/dist/rules/no-sync-result-assumption.d.ts.map +0 -1
  184. package/dist/rules/no-sync-result-assumption.js +0 -907
  185. package/dist/rules/no-sync-result-assumption.js.map +0 -1
  186. package/dist/rules/no-throw-in-detour-recover.d.ts +0 -3
  187. package/dist/rules/no-throw-in-detour-recover.d.ts.map +0 -1
  188. package/dist/rules/no-throw-in-detour-recover.js +0 -147
  189. package/dist/rules/no-throw-in-detour-recover.js.map +0 -1
  190. package/dist/rules/no-throw-in-detour-target.d.ts +0 -15
  191. package/dist/rules/no-throw-in-detour-target.d.ts.map +0 -1
  192. package/dist/rules/no-throw-in-detour-target.js +0 -90
  193. package/dist/rules/no-throw-in-detour-target.js.map +0 -1
  194. package/dist/rules/no-throw-in-implementation.d.ts +0 -11
  195. package/dist/rules/no-throw-in-implementation.d.ts.map +0 -1
  196. package/dist/rules/no-throw-in-implementation.js +0 -36
  197. package/dist/rules/no-throw-in-implementation.js.map +0 -1
  198. package/dist/rules/on-references-exist.d.ts +0 -14
  199. package/dist/rules/on-references-exist.d.ts.map +0 -1
  200. package/dist/rules/on-references-exist.js +0 -109
  201. package/dist/rules/on-references-exist.js.map +0 -1
  202. package/dist/rules/orphaned-signal.d.ts +0 -3
  203. package/dist/rules/orphaned-signal.d.ts.map +0 -1
  204. package/dist/rules/orphaned-signal.js +0 -67
  205. package/dist/rules/orphaned-signal.js.map +0 -1
  206. package/dist/rules/permit-governance.d.ts +0 -3
  207. package/dist/rules/permit-governance.d.ts.map +0 -1
  208. package/dist/rules/permit-governance.js +0 -15
  209. package/dist/rules/permit-governance.js.map +0 -1
  210. package/dist/rules/prefer-schema-inference.d.ts +0 -7
  211. package/dist/rules/prefer-schema-inference.d.ts.map +0 -1
  212. package/dist/rules/prefer-schema-inference.js +0 -86
  213. package/dist/rules/prefer-schema-inference.js.map +0 -1
  214. package/dist/rules/reference-exists.d.ts +0 -6
  215. package/dist/rules/reference-exists.d.ts.map +0 -1
  216. package/dist/rules/reference-exists.js +0 -47
  217. package/dist/rules/reference-exists.js.map +0 -1
  218. package/dist/rules/registry-names.d.ts +0 -8
  219. package/dist/rules/registry-names.d.ts.map +0 -1
  220. package/dist/rules/registry-names.js +0 -83
  221. package/dist/rules/registry-names.js.map +0 -1
  222. package/dist/rules/resource-declarations.d.ts +0 -14
  223. package/dist/rules/resource-declarations.d.ts.map +0 -1
  224. package/dist/rules/resource-declarations.js +0 -413
  225. package/dist/rules/resource-declarations.js.map +0 -1
  226. package/dist/rules/resource-exists.d.ts +0 -6
  227. package/dist/rules/resource-exists.d.ts.map +0 -1
  228. package/dist/rules/resource-exists.js +0 -90
  229. package/dist/rules/resource-exists.js.map +0 -1
  230. package/dist/rules/resource-id-grammar.d.ts +0 -3
  231. package/dist/rules/resource-id-grammar.d.ts.map +0 -1
  232. package/dist/rules/resource-id-grammar.js +0 -39
  233. package/dist/rules/resource-id-grammar.js.map +0 -1
  234. package/dist/rules/scan.d.ts +0 -8
  235. package/dist/rules/scan.d.ts.map +0 -1
  236. package/dist/rules/scan.js +0 -32
  237. package/dist/rules/scan.js.map +0 -1
  238. package/dist/rules/specs.d.ts +0 -29
  239. package/dist/rules/specs.d.ts.map +0 -1
  240. package/dist/rules/specs.js +0 -196
  241. package/dist/rules/specs.js.map +0 -1
  242. package/dist/rules/structure.d.ts +0 -13
  243. package/dist/rules/structure.d.ts.map +0 -1
  244. package/dist/rules/structure.js +0 -142
  245. package/dist/rules/structure.js.map +0 -1
  246. package/dist/rules/types.d.ts +0 -103
  247. package/dist/rules/types.d.ts.map +0 -1
  248. package/dist/rules/types.js +0 -2
  249. package/dist/rules/types.js.map +0 -1
  250. package/dist/rules/unreachable-detour-shadowing.d.ts +0 -3
  251. package/dist/rules/unreachable-detour-shadowing.d.ts.map +0 -1
  252. package/dist/rules/unreachable-detour-shadowing.js +0 -202
  253. package/dist/rules/unreachable-detour-shadowing.js.map +0 -1
  254. package/dist/rules/valid-describe-refs.d.ts +0 -7
  255. package/dist/rules/valid-describe-refs.d.ts.map +0 -1
  256. package/dist/rules/valid-describe-refs.js +0 -167
  257. package/dist/rules/valid-describe-refs.js.map +0 -1
  258. package/dist/rules/valid-detour-contract.d.ts +0 -3
  259. package/dist/rules/valid-detour-contract.d.ts.map +0 -1
  260. package/dist/rules/valid-detour-contract.js +0 -47
  261. package/dist/rules/valid-detour-contract.js.map +0 -1
  262. package/dist/rules/valid-detour-refs.d.ts +0 -6
  263. package/dist/rules/valid-detour-refs.d.ts.map +0 -1
  264. package/dist/rules/valid-detour-refs.js +0 -107
  265. package/dist/rules/valid-detour-refs.js.map +0 -1
  266. package/dist/rules/warden-export-symmetry.d.ts +0 -7
  267. package/dist/rules/warden-export-symmetry.d.ts.map +0 -1
  268. package/dist/rules/warden-export-symmetry.js +0 -352
  269. package/dist/rules/warden-export-symmetry.js.map +0 -1
  270. package/dist/rules/warden-rules-use-ast.d.ts +0 -17
  271. package/dist/rules/warden-rules-use-ast.d.ts.map +0 -1
  272. package/dist/rules/warden-rules-use-ast.js +0 -778
  273. package/dist/rules/warden-rules-use-ast.js.map +0 -1
  274. package/dist/trails/circular-refs.trail.d.ts +0 -24
  275. package/dist/trails/circular-refs.trail.d.ts.map +0 -1
  276. package/dist/trails/circular-refs.trail.js +0 -29
  277. package/dist/trails/circular-refs.trail.js.map +0 -1
  278. package/dist/trails/context-no-surface-types.trail.d.ts +0 -13
  279. package/dist/trails/context-no-surface-types.trail.d.ts.map +0 -1
  280. package/dist/trails/context-no-surface-types.trail.js +0 -21
  281. package/dist/trails/context-no-surface-types.trail.js.map +0 -1
  282. package/dist/trails/context-no-trailhead-types.trail.d.ts +0 -13
  283. package/dist/trails/context-no-trailhead-types.trail.d.ts.map +0 -1
  284. package/dist/trails/context-no-trailhead-types.trail.js +0 -21
  285. package/dist/trails/context-no-trailhead-types.trail.js.map +0 -1
  286. package/dist/trails/contour-exists.trail.d.ts +0 -24
  287. package/dist/trails/contour-exists.trail.d.ts.map +0 -1
  288. package/dist/trails/contour-exists.trail.js +0 -21
  289. package/dist/trails/contour-exists.trail.js.map +0 -1
  290. package/dist/trails/cross-declarations.trail.d.ts +0 -13
  291. package/dist/trails/cross-declarations.trail.d.ts.map +0 -1
  292. package/dist/trails/cross-declarations.trail.js +0 -22
  293. package/dist/trails/cross-declarations.trail.js.map +0 -1
  294. package/dist/trails/dead-internal-trail.trail.d.ts +0 -24
  295. package/dist/trails/dead-internal-trail.trail.d.ts.map +0 -1
  296. package/dist/trails/dead-internal-trail.trail.js +0 -26
  297. package/dist/trails/dead-internal-trail.trail.js.map +0 -1
  298. package/dist/trails/draft-file-marking.trail.d.ts +0 -13
  299. package/dist/trails/draft-file-marking.trail.d.ts.map +0 -1
  300. package/dist/trails/draft-file-marking.trail.js +0 -16
  301. package/dist/trails/draft-file-marking.trail.js.map +0 -1
  302. package/dist/trails/draft-visible-debt.trail.d.ts +0 -13
  303. package/dist/trails/draft-visible-debt.trail.d.ts.map +0 -1
  304. package/dist/trails/draft-visible-debt.trail.js +0 -16
  305. package/dist/trails/draft-visible-debt.trail.js.map +0 -1
  306. package/dist/trails/error-mapping-completeness.trail.d.ts +0 -13
  307. package/dist/trails/error-mapping-completeness.trail.d.ts.map +0 -1
  308. package/dist/trails/error-mapping-completeness.trail.js +0 -29
  309. package/dist/trails/error-mapping-completeness.trail.js.map +0 -1
  310. package/dist/trails/example-valid.trail.d.ts +0 -13
  311. package/dist/trails/example-valid.trail.d.ts.map +0 -1
  312. package/dist/trails/example-valid.trail.js +0 -25
  313. package/dist/trails/example-valid.trail.js.map +0 -1
  314. package/dist/trails/fires-declarations.trail.d.ts +0 -13
  315. package/dist/trails/fires-declarations.trail.d.ts.map +0 -1
  316. package/dist/trails/fires-declarations.trail.js +0 -22
  317. package/dist/trails/fires-declarations.trail.js.map +0 -1
  318. package/dist/trails/implementation-returns-result.trail.d.ts +0 -13
  319. package/dist/trails/implementation-returns-result.trail.d.ts.map +0 -1
  320. package/dist/trails/implementation-returns-result.trail.js +0 -20
  321. package/dist/trails/implementation-returns-result.trail.js.map +0 -1
  322. package/dist/trails/incomplete-accessor-for-standard-op.trail.d.ts +0 -12
  323. package/dist/trails/incomplete-accessor-for-standard-op.trail.d.ts.map +0 -1
  324. package/dist/trails/incomplete-accessor-for-standard-op.trail.js +0 -60
  325. package/dist/trails/incomplete-accessor-for-standard-op.trail.js.map +0 -1
  326. package/dist/trails/incomplete-crud.trail.d.ts +0 -24
  327. package/dist/trails/incomplete-crud.trail.d.ts.map +0 -1
  328. package/dist/trails/incomplete-crud.trail.js +0 -39
  329. package/dist/trails/incomplete-crud.trail.js.map +0 -1
  330. package/dist/trails/index.d.ts +0 -38
  331. package/dist/trails/index.d.ts.map +0 -1
  332. package/dist/trails/index.js +0 -37
  333. package/dist/trails/index.js.map +0 -1
  334. package/dist/trails/intent-propagation.trail.d.ts +0 -24
  335. package/dist/trails/intent-propagation.trail.d.ts.map +0 -1
  336. package/dist/trails/intent-propagation.trail.js +0 -30
  337. package/dist/trails/intent-propagation.trail.js.map +0 -1
  338. package/dist/trails/missing-reconcile.trail.d.ts +0 -24
  339. package/dist/trails/missing-reconcile.trail.d.ts.map +0 -1
  340. package/dist/trails/missing-reconcile.trail.js +0 -33
  341. package/dist/trails/missing-reconcile.trail.js.map +0 -1
  342. package/dist/trails/missing-visibility.trail.d.ts +0 -24
  343. package/dist/trails/missing-visibility.trail.d.ts.map +0 -1
  344. package/dist/trails/missing-visibility.trail.js +0 -22
  345. package/dist/trails/missing-visibility.trail.js.map +0 -1
  346. package/dist/trails/no-direct-impl-in-route.trail.d.ts +0 -13
  347. package/dist/trails/no-direct-impl-in-route.trail.d.ts.map +0 -1
  348. package/dist/trails/no-direct-impl-in-route.trail.js +0 -22
  349. package/dist/trails/no-direct-impl-in-route.trail.js.map +0 -1
  350. package/dist/trails/no-direct-implementation-call.trail.d.ts +0 -13
  351. package/dist/trails/no-direct-implementation-call.trail.d.ts.map +0 -1
  352. package/dist/trails/no-direct-implementation-call.trail.js +0 -16
  353. package/dist/trails/no-direct-implementation-call.trail.js.map +0 -1
  354. package/dist/trails/no-sync-result-assumption.trail.d.ts +0 -13
  355. package/dist/trails/no-sync-result-assumption.trail.d.ts.map +0 -1
  356. package/dist/trails/no-sync-result-assumption.trail.js +0 -19
  357. package/dist/trails/no-sync-result-assumption.trail.js.map +0 -1
  358. package/dist/trails/no-throw-in-detour-recover.trail.d.ts +0 -13
  359. package/dist/trails/no-throw-in-detour-recover.trail.d.ts.map +0 -1
  360. package/dist/trails/no-throw-in-detour-recover.trail.js +0 -24
  361. package/dist/trails/no-throw-in-detour-recover.trail.js.map +0 -1
  362. package/dist/trails/no-throw-in-detour-target.trail.d.ts +0 -25
  363. package/dist/trails/no-throw-in-detour-target.trail.d.ts.map +0 -1
  364. package/dist/trails/no-throw-in-detour-target.trail.js +0 -20
  365. package/dist/trails/no-throw-in-detour-target.trail.js.map +0 -1
  366. package/dist/trails/no-throw-in-implementation.trail.d.ts +0 -13
  367. package/dist/trails/no-throw-in-implementation.trail.d.ts.map +0 -1
  368. package/dist/trails/no-throw-in-implementation.trail.js +0 -20
  369. package/dist/trails/no-throw-in-implementation.trail.js.map +0 -1
  370. package/dist/trails/on-references-exist.trail.d.ts +0 -24
  371. package/dist/trails/on-references-exist.trail.d.ts.map +0 -1
  372. package/dist/trails/on-references-exist.trail.js +0 -21
  373. package/dist/trails/on-references-exist.trail.js.map +0 -1
  374. package/dist/trails/orphaned-signal.trail.d.ts +0 -24
  375. package/dist/trails/orphaned-signal.trail.d.ts.map +0 -1
  376. package/dist/trails/orphaned-signal.trail.js +0 -36
  377. package/dist/trails/orphaned-signal.trail.js.map +0 -1
  378. package/dist/trails/permit-governance.trail.d.ts +0 -12
  379. package/dist/trails/permit-governance.trail.d.ts.map +0 -1
  380. package/dist/trails/permit-governance.trail.js +0 -47
  381. package/dist/trails/permit-governance.trail.js.map +0 -1
  382. package/dist/trails/prefer-schema-inference.trail.d.ts +0 -13
  383. package/dist/trails/prefer-schema-inference.trail.d.ts.map +0 -1
  384. package/dist/trails/prefer-schema-inference.trail.js +0 -21
  385. package/dist/trails/prefer-schema-inference.trail.js.map +0 -1
  386. package/dist/trails/reference-exists.trail.d.ts +0 -24
  387. package/dist/trails/reference-exists.trail.d.ts.map +0 -1
  388. package/dist/trails/reference-exists.trail.js +0 -25
  389. package/dist/trails/reference-exists.trail.js.map +0 -1
  390. package/dist/trails/resource-declarations.trail.d.ts +0 -13
  391. package/dist/trails/resource-declarations.trail.d.ts.map +0 -1
  392. package/dist/trails/resource-declarations.trail.js +0 -25
  393. package/dist/trails/resource-declarations.trail.js.map +0 -1
  394. package/dist/trails/resource-exists.trail.d.ts +0 -24
  395. package/dist/trails/resource-exists.trail.d.ts.map +0 -1
  396. package/dist/trails/resource-exists.trail.js +0 -27
  397. package/dist/trails/resource-exists.trail.js.map +0 -1
  398. package/dist/trails/resource-id-grammar.trail.d.ts +0 -13
  399. package/dist/trails/resource-id-grammar.trail.d.ts.map +0 -1
  400. package/dist/trails/resource-id-grammar.trail.js +0 -38
  401. package/dist/trails/resource-id-grammar.trail.js.map +0 -1
  402. package/dist/trails/run.d.ts +0 -33
  403. package/dist/trails/run.d.ts.map +0 -1
  404. package/dist/trails/run.js +0 -83
  405. package/dist/trails/run.js.map +0 -1
  406. package/dist/trails/schema.d.ts +0 -78
  407. package/dist/trails/schema.d.ts.map +0 -1
  408. package/dist/trails/schema.js +0 -95
  409. package/dist/trails/schema.js.map +0 -1
  410. package/dist/trails/topo.d.ts +0 -3
  411. package/dist/trails/topo.d.ts.map +0 -1
  412. package/dist/trails/topo.js +0 -5
  413. package/dist/trails/topo.js.map +0 -1
  414. package/dist/trails/unreachable-detour-shadowing.trail.d.ts +0 -13
  415. package/dist/trails/unreachable-detour-shadowing.trail.d.ts.map +0 -1
  416. package/dist/trails/unreachable-detour-shadowing.trail.js +0 -44
  417. package/dist/trails/unreachable-detour-shadowing.trail.js.map +0 -1
  418. package/dist/trails/valid-describe-refs.trail.d.ts +0 -24
  419. package/dist/trails/valid-describe-refs.trail.d.ts.map +0 -1
  420. package/dist/trails/valid-describe-refs.trail.js +0 -18
  421. package/dist/trails/valid-describe-refs.trail.js.map +0 -1
  422. package/dist/trails/valid-detour-contract.trail.d.ts +0 -12
  423. package/dist/trails/valid-detour-contract.trail.d.ts.map +0 -1
  424. package/dist/trails/valid-detour-contract.trail.js +0 -66
  425. package/dist/trails/valid-detour-contract.trail.js.map +0 -1
  426. package/dist/trails/valid-detour-refs.trail.d.ts +0 -25
  427. package/dist/trails/valid-detour-refs.trail.d.ts.map +0 -1
  428. package/dist/trails/valid-detour-refs.trail.js +0 -24
  429. package/dist/trails/valid-detour-refs.trail.js.map +0 -1
  430. package/dist/trails/warden-export-symmetry.trail.d.ts +0 -13
  431. package/dist/trails/warden-export-symmetry.trail.d.ts.map +0 -1
  432. package/dist/trails/warden-export-symmetry.trail.js +0 -16
  433. package/dist/trails/warden-export-symmetry.trail.js.map +0 -1
  434. package/dist/trails/warden-rules-use-ast.trail.d.ts +0 -13
  435. package/dist/trails/warden-rules-use-ast.trail.d.ts.map +0 -1
  436. package/dist/trails/warden-rules-use-ast.trail.js +0 -41
  437. package/dist/trails/warden-rules-use-ast.trail.js.map +0 -1
  438. package/dist/trails/wrap-rule.d.ts +0 -43
  439. package/dist/trails/wrap-rule.d.ts.map +0 -1
  440. package/dist/trails/wrap-rule.js +0 -107
  441. package/dist/trails/wrap-rule.js.map +0 -1
  442. package/src/__tests__/ast.test.ts +0 -613
  443. package/src/__tests__/circular-refs.test.ts +0 -121
  444. package/src/__tests__/cli.test.ts +0 -526
  445. package/src/__tests__/contour-exists.test.ts +0 -203
  446. package/src/__tests__/cross-declarations.test.ts +0 -548
  447. package/src/__tests__/dead-internal-trail.test.ts +0 -81
  448. package/src/__tests__/draft-rules-context.test.ts +0 -150
  449. package/src/__tests__/drift.test.ts +0 -144
  450. package/src/__tests__/error-mapping-completeness.test.ts +0 -56
  451. package/src/__tests__/example-valid.test.ts +0 -101
  452. package/src/__tests__/fires-declarations-param-destructure.test.ts +0 -54
  453. package/src/__tests__/fires-declarations.test.ts +0 -652
  454. package/src/__tests__/formatters.test.ts +0 -157
  455. package/src/__tests__/implementation-returns-result.test.ts +0 -1143
  456. package/src/__tests__/incomplete-accessor-for-standard-op.test.ts +0 -337
  457. package/src/__tests__/incomplete-crud.test.ts +0 -498
  458. package/src/__tests__/intent-propagation.test.ts +0 -116
  459. package/src/__tests__/missing-reconcile.test.ts +0 -154
  460. package/src/__tests__/missing-visibility.test.ts +0 -108
  461. package/src/__tests__/no-direct-implementation-call.test.ts +0 -83
  462. package/src/__tests__/no-sync-result-assumption.test.ts +0 -916
  463. package/src/__tests__/no-throw-in-detour-recover.test.ts +0 -93
  464. package/src/__tests__/no-throw-in-implementation.test.ts +0 -88
  465. package/src/__tests__/on-references-exist.test.ts +0 -151
  466. package/src/__tests__/orphaned-signal.test.ts +0 -137
  467. package/src/__tests__/permit-governance.test.ts +0 -66
  468. package/src/__tests__/prefer-schema-inference.test.ts +0 -84
  469. package/src/__tests__/reference-exists.test.ts +0 -281
  470. package/src/__tests__/resource-declarations.test.ts +0 -448
  471. package/src/__tests__/resource-exists.test.ts +0 -122
  472. package/src/__tests__/resource-id-grammar.test.ts +0 -50
  473. package/src/__tests__/rules.test.ts +0 -167
  474. package/src/__tests__/topo-aware-rule.test.ts +0 -257
  475. package/src/__tests__/trails.test.ts +0 -19
  476. package/src/__tests__/unreachable-detour-shadowing.test.ts +0 -128
  477. package/src/__tests__/valid-describe-refs.test.ts +0 -243
  478. package/src/__tests__/valid-detour-contract.test.ts +0 -86
  479. package/src/__tests__/warden-export-symmetry.test.ts +0 -251
  480. package/src/__tests__/warden-rules-use-ast.test.ts +0 -468
  481. package/src/__tests__/wrap-rule.test.ts +0 -41
  482. package/src/rules/no-direct-impl-in-route.ts +0 -77
  483. package/src/trails/no-direct-impl-in-route.trail.ts +0 -22
  484. package/tsconfig.json +0 -9
  485. package/tsconfig.tests.json +0 -10
  486. package/tsconfig.tsbuildinfo +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,136 @@
1
1
  # @ontrails/warden
2
2
 
3
+ ## 1.0.0-beta.16
4
+
5
+ ### Minor Changes
6
+
7
+ - e991a5b: Add generic enum value aliases for CLI flags and migrate Warden command aliases onto the shared alias model.
8
+ - 2e05e27: Add `--dev-permit` for local-development synthetic full-access. New `devPermitPreset()` exposes a boolean flag; when set, the CLI synthesizes a `BasePermit` (`id: 'dev-permit'`, scopes enumerated from every declared scope across the topo) and overlays it on `ctx.permit`. Mutually exclusive with `--permit` and `--token` — any combination fails with `ValidationError` listing the conflicting flags. New Warden rule `no-dev-permit-in-source` flags any committed source file containing `--dev-permit` as an error, with a tight allow-list (`packages/cli/src/flags.ts`, `packages/cli/src/build.ts`, the rule itself). The Warden runner still scans test TypeScript files for this literal while keeping unrelated source rules filtered out of tests. Apps that import `authResource`/`authLayer` are unaffected.
9
+ - ad553a6: Add one warden rule coaching against the removed legacy layer API. `no-legacy-layer-imports` (error) flags any source-string reference to `authLayer`, `autoIterateLayer`, or `dateShortcutsLayer` and points the developer at the migration paths (CLI surface derivation for pagination/date-shortcuts; intrinsic permit enforcement for auth). Allow-list covers the migration notes in `packages/cli/src/{pagination,date-shortcuts}.ts` and the rule's own files. The rule is classified `lifecycle: temporary` with a `retireWhen` string tying it to the legacy layer migration window. Trail count bumps 45 → 46.
10
+ - 802fdfc: Rename Warden guide manifest rule grouping from `category` to `concern` so the
11
+ public JSON contract matches the source metadata field.
12
+ - 22c6c06: Accept ADR-0041 Unified Observability and ship the first activation and
13
+ observability primitives it depends on: activation trace records, topo-level
14
+ observe configuration, webhook activation materialization, signal/webhook
15
+ warden coaching, the `@ontrails/observe` package, sink composition, and
16
+ zero-dependency observe sinks.
17
+ - 767eb41: Ship the default `warden` bin from `@ontrails/warden` and migrate the old private `apps/ci` runner into the package-local CLI surface.
18
+
19
+ The new bin supports `--ci`, `--pre-push`, `--depth`, `--fail-on`, `--strict`, `--format`, `--lock`, `--drafts`, `--apps`, and the Sprint 1 standalone aliases. CI output now uses the package Warden formatters directly, so GitHub annotations and JSON payloads follow the `@ontrails/warden` report shape instead of the retired `apps/ci` wrapper shape.
20
+
21
+ - 82019a7: Export `wardenConfigSchema` for composing Warden options into `trails.config.ts`.
22
+ - f6fdc62: Add structured Warden remediation guidance to rule metadata, diagnostics, report output, and the `trails warden` result schema.
23
+ - a10ffa4: Add a Warden guide manifest projection and expose it through `trails warden guide` in markdown, agent-json, and manifest formats.
24
+ - 7085f01: Add a Warden topo-aware rule that requires public MCP/HTTP surface-eligible trails to declare output schemas.
25
+ - 8ddf5ff: Extend `runWarden` into the shared Warden orchestration entrypoint with effective config resolution, depth/fail thresholds, rule facets, and multi-topo report metadata.
26
+
27
+ Adapt the built-in `trails warden` wrapper to consume the readonly Warden report diagnostics contract without weakening its output schema.
28
+
29
+ - f5b6112: Add an advisory Warden rule that prefers static resource helpers over dynamic context resource lookups when the resource definition is already in scope.
30
+
31
+ ### Patch Changes
32
+
33
+ - c3fc5c3: Move previously root-exported helper contracts out of `src/internal/*` to stable core module homes, document their public boundary, and guard the public barrel against future internal re-exports.
34
+ - e898cc4: Add repo-level Knip dead-code detection and remove stale internal exports and unused package dependencies surfaced by the new check.
35
+ - 3395234: Move store adapter-binding helpers to `@ontrails/store/adapter-support` and topographer direct database/admin helpers to `@ontrails/topographer/backend-support`, keeping root exports focused on contract-level APIs.
36
+ - d40430d: Remove the retired `@ontrails/logging` workspace from the prerelease package set. Use `@ontrails/observe` for log and trace sink contracts and `@ontrails/logtape` for LogTape forwarding.
37
+ - de30d6c: Introduce `topo.compile` as the canonical trail for writing `.trails` lockfile
38
+ and surface artifacts, remove the `survey --generate` mode, and update drift
39
+ guidance to point at the compile command.
40
+ - 331e3a9: Relocate the topo-store public API from `@ontrails/core` to `@ontrails/topographer` per ADR-0042. Generic `trails-db` helpers (`openReadTrailsDb`, `openWriteTrailsDb`, `ensureSubsystemSchema`, `deriveTrailsDbPath`, `deriveTrailsDir`) stay in core because tracing and other subsystems share them.
41
+
42
+ Breaking pre-1.0 beta change. Update consumer imports:
43
+
44
+ ```diff
45
+ - import { topoStore, createTopoStore, createMockTopoStore, createTopoSnapshot, listTopoSnapshots, pinTopoSnapshot, unpinTopoSnapshot, createStoredTopoSnapshot, getStoredTopoExport, countTopoSnapshots, countPinnedSnapshots, countPrunableSnapshots, pruneUnpinnedSnapshots } from '@ontrails/core';
46
+ + import { topoStore, createTopoStore, createMockTopoStore, createTopoSnapshot, listTopoSnapshots, pinTopoSnapshot, unpinTopoSnapshot } from '@ontrails/topographer';
47
+ + import { createStoredTopoSnapshot, getStoredTopoExport, countTopoSnapshots, countPinnedSnapshots, countPrunableSnapshots, pruneUnpinnedSnapshots } from '@ontrails/topographer/backend-support';
48
+ ```
49
+
50
+ The same root move applies to types `ReadOnlyTopoStore`, `MockTopoStoreSeed`, `TopoSnapshot`, `TopoStoreRef`, `TopoStoreExportRecord`, `TopoStoreResourceRecord`, `TopoStoreTrailRecord`, `TopoStoreTrailDetailRecord`, `CreateTopoSnapshotInput`, and `ListTopoSnapshotsOptions`. The direct DB helper type `StoredTopoExport` moves to `@ontrails/topographer/backend-support`.
51
+
52
+ Core newly exports `activationSourceKey`, `projectActivationSourceDeclaration`, `activationSourceDeclarationSignature`, and the `ActivationSourceProjection` type — these were already used internally and are now part of the public surface so `@ontrails/topographer` (the only consumer that needs them) can import them through normal package channels.
53
+
54
+ - 4399fdb: Renamed `@ontrails/schema` to `@ontrails/topographer`. Mechanical rename only — no API changes. Update import sites from `@ontrails/schema` to `@ontrails/topographer`. See ADR-0042 for the durable graph substrate doctrine.
55
+ - 2dd9cda: Promote ADR-0043 (Layer Evolution) from draft to accepted, amend it on 2026-05-04 to remove the briefly proposed `Middleware` split, and publish the Layer Evolution Migration Guide at `docs/migration/layer-evolution.md`.
56
+
57
+ Documentation-only change capturing the post-implementation state of the layer-evolution work shipped across TRL-471 through TRL-476: typed `Layer` primitive with optional `input` schema, three attachment scopes (trail, surface, topo), CLI/MCP/HTTP surface projection of layer inputs, removal of `authLayer`, `autoIterateLayer`, and `dateShortcutsLayer`, and warden coaching via `no-legacy-layer-imports` (error). The migration guide is the durable countermeasure to the vocabulary churn flagged in ADR-0043's tradeoffs.
58
+
59
+ - fb10112: Polish Warden guidance projection by preserving labels in plain-text doc links
60
+ and reusing the shared diagnostic schema from the Trails CLI wrapper.
61
+ - bfabe09: Suppress static resource accessor warnings when a string lookup resolves to a
62
+ resource variable name shadowed inside `blaze`.
63
+ - 7a1d4a9: Rename the public resolved graph API from `SurfaceMap` to `TopoGraph`, including
64
+ the derive, hash, diff, and current graph artifact I/O helpers.
65
+ - 84f595a: Add lock v3 manifest and `topo.lock` I/O. `trails.lock` now reads as a compact v3 manifest that points at the serialized TopoGraph artifact, and legacy v2/hash-only lock inputs fail with a regenerate instruction.
66
+ - d2cb9ba: Rename topo-store export artifacts from surface-era names to TopoGraph names. The `topo_exports` table now stores `topo_graph`, `topo_graph_hash`, and `lock_manifest`, and backend-support export records expose `topoGraphJson`, `topoGraphHash`, and `lockManifestJson`.
67
+ - 2cc05da: Harden Warden drift checks for lock v3 manifests. Malformed legacy lock files and manifests without the `topo.lock` artifact now report blocked drift with a regenerate instruction instead of throwing or silently passing.
68
+ - df9a7d0: Add project-aware public export-map governance for @ontrails workspace docs,
69
+ imports, root barrels, and bin-only package surfaces.
70
+ - 30a2c7e: Add the resolver-backed `resolved-import-boundary` Warden rule for cross-package import boundary enforcement.
71
+ - 81bffec: Add Warden import-resolution substrate backed by `oxc-resolver`.
72
+ - d675a53: Omit `topoNames` from Warden reports when no topo targets were governed, matching the optional report contract.
73
+ - Updated dependencies [73622ae]
74
+ - Updated dependencies [e991a5b]
75
+ - Updated dependencies [25f3c5c]
76
+ - Updated dependencies [6300f70]
77
+ - Updated dependencies [d172013]
78
+ - Updated dependencies [c3fc5c3]
79
+ - Updated dependencies [20d7a5c]
80
+ - Updated dependencies [be5fb46]
81
+ - Updated dependencies [199304e]
82
+ - Updated dependencies [e898cc4]
83
+ - Updated dependencies [2bf239e]
84
+ - Updated dependencies [200bece]
85
+ - Updated dependencies [e4beec9]
86
+ - Updated dependencies [3395234]
87
+ - Updated dependencies [bcdc484]
88
+ - Updated dependencies [6300f70]
89
+ - Updated dependencies [3f678d4]
90
+ - Updated dependencies [ed171d5]
91
+ - Updated dependencies [49c2e7d]
92
+ - Updated dependencies [de30d6c]
93
+ - Updated dependencies [331e3a9]
94
+ - Updated dependencies [c40865a]
95
+ - Updated dependencies [4399fdb]
96
+ - Updated dependencies [4b8d13b]
97
+ - Updated dependencies [4b8d13b]
98
+ - Updated dependencies [4b8d13b]
99
+ - Updated dependencies [fbd42fc]
100
+ - Updated dependencies [63d1aef]
101
+ - Updated dependencies [6be2e95]
102
+ - Updated dependencies [819de09]
103
+ - Updated dependencies [be08686]
104
+ - Updated dependencies [112b9f2]
105
+ - Updated dependencies [893025e]
106
+ - Updated dependencies [ed888e2]
107
+ - Updated dependencies [2e05e27]
108
+ - Updated dependencies [c8caa5e]
109
+ - Updated dependencies [f4b90c9]
110
+ - Updated dependencies [eec5e9d]
111
+ - Updated dependencies [4e75129]
112
+ - Updated dependencies [47505fe]
113
+ - Updated dependencies [ebd4434]
114
+ - Updated dependencies [863d473]
115
+ - Updated dependencies [344f2f7]
116
+ - Updated dependencies [26f9ffd]
117
+ - Updated dependencies [66056ac]
118
+ - Updated dependencies [b12e19b]
119
+ - Updated dependencies [ed7f6f6]
120
+ - Updated dependencies [0bad534]
121
+ - Updated dependencies [7a1d4a9]
122
+ - Updated dependencies [84f595a]
123
+ - Updated dependencies [d2cb9ba]
124
+ - Updated dependencies [10eae9a]
125
+ - Updated dependencies [bbb1ea4]
126
+ - Updated dependencies [22c6c06]
127
+ - Updated dependencies [df9a7d0]
128
+ - @ontrails/core@1.0.0-beta.16
129
+ - @ontrails/cli@1.0.0-beta.16
130
+ - @ontrails/permits@1.0.0-beta.16
131
+ - @ontrails/store@1.0.0-beta.16
132
+ - @ontrails/topographer@1.0.0-beta.16
133
+
3
134
  ## 1.0.0-beta.15
4
135
 
5
136
  ### Minor Changes
@@ -16,7 +147,7 @@
16
147
  - Updated dependencies [4ad6b25]
17
148
  - @ontrails/core@1.0.0-beta.15
18
149
  - @ontrails/permits@1.0.0-beta.15
19
- - @ontrails/schema@1.0.0-beta.15
150
+ - @ontrails/topographer@1.0.0-beta.15
20
151
 
21
152
  ## 1.0.0-beta.14
22
153
 
package/README.md CHANGED
@@ -1,18 +1,23 @@
1
1
  # @ontrails/warden
2
2
 
3
- AST-based code convention rules for Trails. Built-in lint rules catch contract violations at development time, alongside lock drift detection and CI formatters.
3
+ AST-based code convention rules for Trails. Built-in lint rules catch contract
4
+ violations at development time, alongside lock drift detection and CI
5
+ formatters.
4
6
 
5
- Structural checks (cross target existence, declared resource existence, recursive crossing, example schema validation) live in `validateTopo()` from `@ontrails/core`. Warden handles the code-level rules that need AST analysis.
7
+ Structural checks (cross target existence, declared resource existence,
8
+ recursive crossing, example schema validation) live in `validateTopo()` from
9
+ `@ontrails/core`. Warden handles the code-level rules that need AST analysis.
10
+
11
+ For rule-home boundaries and authoring doctrine, see the
12
+ [Warden guide](../../docs/warden.md) and
13
+ [Rule Design](../../docs/rule-design.md).
6
14
 
7
15
  ## Usage
8
16
 
9
17
  From the Trails CLI:
10
18
 
11
19
  ```bash
12
- trails warden # Run all checks
13
- trails warden --exit-code # Non-zero exit on errors or drift
14
- trails warden --lint-only # Skip drift detection
15
- trails warden --drift-only # Skip lint rules
20
+ bunx trails warden # Run all checks
16
21
  ```
17
22
 
18
23
  Or programmatically:
@@ -26,35 +31,33 @@ console.log(formatWardenReport(report));
26
31
 
27
32
  ## Rules
28
33
 
29
- | Rule | Severity | What it catches |
30
- | --- | --- | --- |
31
- | `no-throw-in-implementation` | error | `throw` inside blaze bodies |
32
- | `implementation-returns-result` | error | Blaze functions returning raw values instead of `Result` |
33
- | `context-no-surface-types` | error | Surface type imports (`Request`, `McpSession`) in trail files |
34
- | `no-sync-result-assumption` | error | Missing `await` on `.blaze()` results |
35
- | `valid-detour-contract` | error | Detours with non-constructor `on` values or non-callable `recover` values |
36
- | `no-throw-in-detour-recover` | error | `throw` inside detour `recover` functions |
37
- | `unreachable-detour-shadowing` | error | Later detours made unreachable by earlier same-or-broader `on:` error types |
38
- | `no-direct-implementation-call` | warn | Direct `.blaze()` calls bypassing `ctx.cross()` |
39
- | `no-direct-impl-in-route` | warn | Direct `.blaze()` calls inside trail bodies with `crosses` |
40
- | `prefer-schema-inference` | warn | Redundant field overrides already derivable from the schema |
41
- | `cross-declarations` | error/warn | `ctx.cross()` calls that drift from declared `crosses: [...]` |
42
- | `resource-declarations` | error/warn | `resource.from(ctx)` / `ctx.resource()` usage that drifts from declared `resources: [...]` |
43
- | `resource-exists` | error | Declared or referenced resource IDs that do not resolve in project context |
44
- | `valid-describe-refs` | warn | `@see` refs in `.describe()` that do not resolve |
45
- | `draft-file-marking` | error | Draft-bearing files missing `_draft.*` or `*.draft.*` filename markers |
46
- | `draft-visible-debt` | warn | Draft IDs remaining in source files that need promotion or removal |
34
+ Built-in rules are registered in `wardenRules` and `wardenTopoRules`; use those
35
+ registries or `wardenTopo.ids()` for the current rule list instead of copying a
36
+ static table into docs.
37
+
38
+ Rules cover several families:
39
+
40
+ - blaze and `Result` contract checks
41
+ - cross, fire, resource, and detour declaration drift
42
+ - draft-state containment
43
+ - source-static guardrails such as surface-type leakage
44
+ - topo-aware checks that need the resolved graph or resource mock shape
45
+
46
+ When adding or auditing rules, follow [Rule Design](../../docs/rule-design.md):
47
+ name the invariant, import owner-held framework data, choose the narrowest
48
+ Warden tier, and collapse families only when the data model, traversal, and
49
+ diagnostic shape are shared.
47
50
 
48
51
  ## Drift detection
49
52
 
50
- Warden integrates with `@ontrails/schema` to detect when the topo has changed without updating the lock file:
53
+ Warden integrates with `@ontrails/topographer` to detect when the topo has changed without updating the lock file:
51
54
 
52
55
  ```typescript
53
56
  import { checkDrift } from '@ontrails/warden';
54
57
 
55
58
  const drift = await checkDrift(process.cwd(), graph);
56
59
  if (drift.stale) {
57
- console.log('lock file is stale -- regenerate with `trails topo export`');
60
+ console.log('lock file is stale -- regenerate with `trails topo compile`');
58
61
  }
59
62
  ```
60
63
 
@@ -66,19 +69,31 @@ Add to lefthook for pre-push enforcement:
66
69
  pre-push:
67
70
  commands:
68
71
  warden:
69
- run: trails warden --exit-code
72
+ run: bunx trails warden
70
73
  tags: governance
71
74
  ```
72
75
 
73
76
  CI formatters for structured output:
74
77
 
75
78
  ```typescript
76
- import { formatGitHubAnnotations, formatJson, formatSummary } from '@ontrails/warden';
79
+ import {
80
+ formatGitHubAnnotations,
81
+ formatJson,
82
+ formatSummary,
83
+ } from '@ontrails/warden';
84
+ ```
85
+
86
+ Parser helpers for rule authoring and repo-local tooling live on the dedicated
87
+ AST entrypoint:
88
+
89
+ ```typescript
90
+ import { findStringLiterals, parse, walk } from '@ontrails/warden/ast';
77
91
  ```
78
92
 
79
93
  ## Trail-based API
80
94
 
81
- Every built-in warden rule is also available as a composable trail. This makes rules queryable, testable, and invocable through any Trails surface.
95
+ Every built-in warden rule is also available as a composable trail. This makes
96
+ rules queryable, testable, and invocable through any Trails surface.
82
97
 
83
98
  ```typescript
84
99
  import {
@@ -100,7 +115,14 @@ const diagnostics = await runWardenTrails(filePath, sourceCode, {
100
115
  const topoDiagnostics = await runTopoAwareWardenTrails(myApp);
101
116
  ```
102
117
 
103
- To wrap a custom rule as a trail, use `wrapRule` (imported from `@ontrails/warden/trails/wrap-rule`). This is the same factory used internally to build all built-in rule trails.
118
+ To wrap a custom rule as a trail, import `wrapRule` from the root package
119
+ entrypoint:
120
+
121
+ ```typescript
122
+ import { wrapRule } from '@ontrails/warden';
123
+ ```
124
+
125
+ This is the same factory used internally to build all built-in rule trails.
104
126
 
105
127
  ## API
106
128
 
@@ -110,12 +132,24 @@ To wrap a custom rule as a trail, use `wrapRule` (imported from `@ontrails/warde
110
132
  | `formatWardenReport(report)` | Human-readable report |
111
133
  | `checkDrift(rootDir, topo?)` | Check if the lock file matches the current topo |
112
134
  | `wardenRules` | Registry of all built-in rules |
135
+ | `builtinWardenRuleMetadata` | Tier, scope, lifecycle, and invariant metadata for built-in rules |
136
+ | `getWardenRuleMetadata(ruleOrName)` | Resolve inline or built-in metadata for a Warden rule |
137
+ | `listWardenRuleMetadata()` | List built-in rule metadata entries |
113
138
  | `wardenTopo` | `Topo` of all built-in rule trails (one per rule) |
114
139
  | `runWardenTrails(filePath, sourceCode, options?)` | Dispatch file-scoped rule trails for a file, collect diagnostics |
115
140
  | `runTopoAwareWardenTrails(topo)` | Dispatch built-in topo-aware rule trails once for a resolved topo |
116
141
  | `formatGitHubAnnotations(report)` | GitHub Actions annotation format |
117
142
  | `formatJson(report)` | Machine-readable JSON |
118
143
  | `formatSummary(report)` | Compact summary line |
144
+ | `wrapRule(rule)` | Wrap a custom rule as a trail (same factory used for all built-in rule trails) |
145
+
146
+ AST parser helpers are exported from `@ontrails/warden/ast`, not the root
147
+ runtime barrel. The stable authoring surface includes `parse`, `walk`,
148
+ `walkScope`, `offsetToLine`, `findTrailDefinitions`, `findBlazeBodies`,
149
+ `findContourDefinitions`, `isBlazeCall`, and string-literal helpers.
150
+
151
+ `runWarden({ tier })` can narrow a run to `source-static`, `project-static`,
152
+ `topo-aware`, `drift`, or `advisory`. Omit `tier` for the default full run.
119
153
 
120
154
  See the [API Reference](../../docs/api-reference.md) for the full list.
121
155
 
package/bin/warden.ts ADDED
@@ -0,0 +1,22 @@
1
+ #!/usr/bin/env bun
2
+ /* oxlint-disable eslint-plugin-jest/require-hook -- CLI bin entrypoints execute at module scope */
3
+
4
+ import { runWardenCommand } from '../src/command.js';
5
+
6
+ const env = { ...process.env } as Record<string, string | undefined>;
7
+ const result = await runWardenCommand({
8
+ args: Bun.argv.slice(2),
9
+ cwd: process.cwd(),
10
+ env,
11
+ });
12
+
13
+ if (result.output.length > 0) {
14
+ console.log(result.output);
15
+ }
16
+
17
+ const summaryPath = env['GITHUB_STEP_SUMMARY'];
18
+ if (result.writeStepSummary && summaryPath !== undefined) {
19
+ await Bun.write(summaryPath, result.summary);
20
+ }
21
+
22
+ process.exit(result.exitCode);
package/package.json CHANGED
@@ -1,9 +1,23 @@
1
1
  {
2
2
  "name": "@ontrails/warden",
3
- "version": "1.0.0-beta.15",
3
+ "version": "1.0.0-beta.16",
4
+ "bin": {
5
+ "warden": "./bin/warden.ts"
6
+ },
7
+ "files": [
8
+ "bin/**/*.ts",
9
+ "src/**/*.ts",
10
+ "!src/**/__tests__/**",
11
+ "!src/**/*.test.ts",
12
+ "!src/**/*.test-d.ts",
13
+ "README.md",
14
+ "CHANGELOG.md"
15
+ ],
4
16
  "type": "module",
5
17
  "exports": {
6
18
  ".": "./src/index.ts",
19
+ "./ast": "./src/ast.ts",
20
+ "./resolve": "./src/resolve.ts",
7
21
  "./package.json": "./package.json"
8
22
  },
9
23
  "scripts": {
@@ -14,16 +28,19 @@
14
28
  "clean": "rm -rf dist *.tsbuildinfo"
15
29
  },
16
30
  "dependencies": {
17
- "@ontrails/permits": "^1.0.0-beta.14"
18
- },
19
- "devDependencies": {
20
- "@ontrails/testing": "^1.0.0-beta.14",
21
- "@oxc-project/types": "^0.122.0",
31
+ "@ontrails/cli": "^1.0.0-beta.15",
32
+ "@ontrails/permits": "^1.0.0-beta.15",
33
+ "@ontrails/store": "^1.0.0-beta.15",
22
34
  "oxc-parser": "^0.121.0",
35
+ "oxc-resolver": "11.19.1",
23
36
  "zod": "^4.3.5"
24
37
  },
38
+ "devDependencies": {
39
+ "@ontrails/config": "^1.0.0-beta.15",
40
+ "@ontrails/testing": "^1.0.0-beta.15"
41
+ },
25
42
  "peerDependencies": {
26
- "@ontrails/core": "^1.0.0-beta.14",
27
- "@ontrails/schema": "^1.0.0-beta.14"
43
+ "@ontrails/core": "^1.0.0-beta.15",
44
+ "@ontrails/topographer": "^1.0.0-beta.15"
28
45
  }
29
46
  }
package/src/ast.ts ADDED
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Public Warden AST helper surface.
3
+ *
4
+ * These helpers are the supported parser primitives for repo-local tooling and
5
+ * rule authoring. Broader Trails-aware discovery helpers stay internal to the
6
+ * built-in rule implementation until they have a stable public contract.
7
+ */
8
+ export {
9
+ findBlazeBodies,
10
+ findContourDefinitions,
11
+ findStringLiterals,
12
+ findTrailDefinitions,
13
+ getStringValue,
14
+ isBlazeCall,
15
+ isStringLiteral,
16
+ offsetToLine,
17
+ parse,
18
+ walk,
19
+ walkScope,
20
+ } from './rules/ast.js';
21
+ export type {
22
+ AstNode,
23
+ ContourDefinition,
24
+ FindContourDefinitionsOptions,
25
+ FrameworkNamespaceContext,
26
+ StringLiteralMatch,
27
+ TrailDefinition,
28
+ } from './rules/ast.js';