@bonesofspring/ai-rules 0.2.64 → 0.2.65

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 (293) hide show
  1. package/CHANGELOG.md +46 -11
  2. package/README.md +6 -6
  3. package/bin/lib/engine-scripts.js +14 -5
  4. package/bin/lib/seed-ai-local-team.js +7 -0
  5. package/docs/PRESET-CONTRIBUTION.md +41 -0
  6. package/docs/TEAM-DB.md +193 -52
  7. package/docs/openapi/team-db.v1.json +1238 -377
  8. package/mcp/defectdojo-mcp.mjs +7 -5
  9. package/mcp/lib/defectdojo.mjs +26 -14
  10. package/package.json +26 -20
  11. package/presets/_shared/ai-local/scripts/process-lease.mjs +576 -0
  12. package/presets/_shared/ai-local/scripts/processes.mjs +1618 -0
  13. package/presets/_shared/ai-local/scripts/run.mjs +5 -5
  14. package/presets/_shared/ai-local/scripts/team-db-api.mjs +465 -152
  15. package/presets/_shared/ai-local/scripts/team-db-dashboard.mjs +235 -10
  16. package/presets/_shared/ai-local/scripts/team-db-openapi.mjs +416 -176
  17. package/presets/_shared/ai-local/scripts/team-db-project.mjs +171 -62
  18. package/presets/_shared/ai-local/scripts/team-db-scheduler.mjs +4 -0
  19. package/presets/_shared/ai-local/scripts/team-db-schema.mjs +143 -5
  20. package/presets/_shared/ai-local/scripts/team-db-task-runner.mjs +567 -0
  21. package/presets/_shared/ai-local/scripts/{team-db-backlog.mjs → team-db-tracker.mjs} +900 -197
  22. package/presets/_shared/ai-local/scripts/team-db-ui.mjs +750 -0
  23. package/presets/_shared/ai-local/scripts/team-db.mjs +104 -23
  24. package/presets/_shared/core/agent-team/agent-team-orchestrator.md +1 -1
  25. package/presets/_shared/hooks/chain-team-phases.sh.tmpl +105 -17
  26. package/presets/_shared/hooks/guard-shell-command.mjs.tmpl +40 -2
  27. package/presets/claude/android-kotlin/hooks/chain-team-phases.sh +105 -17
  28. package/presets/claude/android-kotlin/hooks/guard-shell-command.mjs +41 -2
  29. package/presets/claude/android-kotlin/rules/tooling-and-review/agent-team-orchestrator.md +1 -1
  30. package/presets/claude/android-kotlin/settings.json +6 -1
  31. package/presets/claude/go/hooks/chain-team-phases.sh +105 -17
  32. package/presets/claude/go/hooks/guard-shell-command.mjs +41 -2
  33. package/presets/claude/go/rules/tooling-and-review/agent-team-orchestrator.md +1 -1
  34. package/presets/claude/go/settings.json +6 -1
  35. package/presets/claude/ios-swift/hooks/chain-team-phases.sh +105 -17
  36. package/presets/claude/ios-swift/hooks/guard-shell-command.mjs +41 -2
  37. package/presets/claude/ios-swift/rules/tooling-and-review/agent-team-orchestrator.md +1 -1
  38. package/presets/claude/ios-swift/settings.json +6 -1
  39. package/presets/claude/java/hooks/chain-team-phases.sh +105 -17
  40. package/presets/claude/java/hooks/guard-shell-command.mjs +41 -2
  41. package/presets/claude/java/rules/tooling-and-review/agent-team-orchestrator.md +1 -1
  42. package/presets/claude/java/settings.json +6 -1
  43. package/presets/claude/mcp-ts/hooks/chain-team-phases.sh +105 -17
  44. package/presets/claude/mcp-ts/hooks/guard-shell-command.mjs +41 -2
  45. package/presets/claude/mcp-ts/rules/tooling-and-review/agent-team-orchestrator.md +1 -1
  46. package/presets/claude/mcp-ts/settings.json +6 -1
  47. package/presets/claude/mol/hooks/chain-team-phases.sh +105 -17
  48. package/presets/claude/mol/hooks/guard-shell-command.mjs +41 -2
  49. package/presets/claude/mol/rules/tooling-and-review/agent-team-orchestrator.md +1 -1
  50. package/presets/claude/mol/settings.json +6 -1
  51. package/presets/claude/next/MCP.md +2 -0
  52. package/presets/claude/next/REPO_AGENTS.md +2 -0
  53. package/presets/claude/next/agents/build-verifier.md +1 -1
  54. package/presets/claude/next/agents/ci-investigator.md +3 -0
  55. package/presets/claude/next/agents/debugger.md +3 -0
  56. package/presets/claude/next/agents/feature-developer.md +3 -0
  57. package/presets/claude/next/agents/mockup-reviewer.md +2 -0
  58. package/presets/claude/next/agents/performance-auditor.md +2 -0
  59. package/presets/claude/next/agents/playwright-test-generator.md +3 -0
  60. package/presets/claude/next/agents/playwright-test-healer.md +3 -0
  61. package/presets/claude/next/agents/playwright-test-planner.md +3 -0
  62. package/presets/claude/next/agents/qa-tester.md +3 -0
  63. package/presets/claude/next/commands/README.md +6 -0
  64. package/presets/claude/next/commands/ui-start.md +78 -0
  65. package/presets/claude/next/commands/ui-stop.md +71 -0
  66. package/presets/claude/next/hooks/chain-team-phases.sh +105 -17
  67. package/presets/claude/next/hooks/guard-shell-command.mjs +41 -2
  68. package/presets/claude/next/rules/README.md +2 -1
  69. package/presets/claude/next/rules/stack/next-app-core.md +1 -0
  70. package/presets/claude/next/rules/tooling-and-review/agent-team-orchestrator.md +1 -1
  71. package/presets/claude/next/rules/tooling-and-review/dev-process-lifecycle.md +43 -0
  72. package/presets/claude/next/settings.json +6 -1
  73. package/presets/claude/nuxt/hooks/chain-team-phases.sh +105 -17
  74. package/presets/claude/nuxt/hooks/guard-shell-command.mjs +41 -2
  75. package/presets/claude/nuxt/rules/tooling-and-review/agent-team-orchestrator.md +1 -1
  76. package/presets/claude/nuxt/settings.json +6 -1
  77. package/presets/claude/php-hexagonal/hooks/chain-team-phases.sh +105 -17
  78. package/presets/claude/php-hexagonal/hooks/guard-shell-command.mjs +41 -2
  79. package/presets/claude/php-hexagonal/rules/tooling-and-review/agent-team-orchestrator.md +1 -1
  80. package/presets/claude/php-hexagonal/settings.json +6 -1
  81. package/presets/claude/php-laravel/hooks/chain-team-phases.sh +106 -18
  82. package/presets/claude/php-laravel/hooks/guard-shell-command.mjs +41 -2
  83. package/presets/claude/php-laravel/rules/tooling-and-review/agent-team-orchestrator.md +1 -1
  84. package/presets/claude/php-laravel/settings.json +6 -1
  85. package/presets/claude/svelte/hooks/chain-team-phases.sh +105 -17
  86. package/presets/claude/svelte/hooks/guard-shell-command.mjs +41 -2
  87. package/presets/claude/svelte/rules/tooling-and-review/agent-team-orchestrator.md +1 -1
  88. package/presets/claude/svelte/settings.json +6 -1
  89. package/presets/cursor/android-kotlin/hooks/chain-team-phases.sh +105 -17
  90. package/presets/cursor/android-kotlin/hooks/guard-shell-command.mjs +41 -2
  91. package/presets/cursor/go/hooks/chain-team-phases.sh +105 -17
  92. package/presets/cursor/go/hooks/guard-shell-command.mjs +41 -2
  93. package/presets/cursor/ios-swift/hooks/chain-team-phases.sh +105 -17
  94. package/presets/cursor/ios-swift/hooks/guard-shell-command.mjs +41 -2
  95. package/presets/cursor/java/hooks/chain-team-phases.sh +105 -17
  96. package/presets/cursor/java/hooks/guard-shell-command.mjs +41 -2
  97. package/presets/cursor/mcp-ts/hooks/chain-team-phases.sh +105 -17
  98. package/presets/cursor/mcp-ts/hooks/guard-shell-command.mjs +41 -2
  99. package/presets/cursor/mol/hooks/chain-team-phases.sh +105 -17
  100. package/presets/cursor/mol/hooks/guard-shell-command.mjs +41 -2
  101. package/presets/cursor/next/MCP.md +2 -0
  102. package/presets/cursor/next/REPO_AGENTS.md +2 -0
  103. package/presets/cursor/next/agents/build-verifier.md +1 -1
  104. package/presets/cursor/next/agents/ci-investigator.md +2 -0
  105. package/presets/cursor/next/agents/debugger.md +2 -0
  106. package/presets/cursor/next/agents/feature-developer.md +2 -0
  107. package/presets/cursor/next/agents/mockup-reviewer.md +2 -0
  108. package/presets/cursor/next/agents/performance-auditor.md +2 -0
  109. package/presets/cursor/next/agents/playwright-test-generator.md +2 -0
  110. package/presets/cursor/next/agents/playwright-test-healer.md +2 -0
  111. package/presets/cursor/next/agents/playwright-test-planner.md +2 -0
  112. package/presets/cursor/next/agents/qa-tester.md +2 -0
  113. package/presets/cursor/next/ai-local/rules-library/storybook-dev-compare-figma.md +1 -1
  114. package/presets/cursor/next/commands/README.md +6 -0
  115. package/presets/cursor/next/commands/ui-start.md +78 -0
  116. package/presets/cursor/next/commands/ui-stop.md +71 -0
  117. package/presets/cursor/next/hooks/chain-team-phases.sh +105 -17
  118. package/presets/cursor/next/hooks/guard-shell-command.mjs +41 -2
  119. package/presets/cursor/next/rules/README.md +2 -1
  120. package/presets/cursor/next/rules/dev-process-lifecycle.mdc +43 -0
  121. package/presets/cursor/next/rules/next-app-core.mdc +1 -0
  122. package/presets/cursor/nuxt/hooks/chain-team-phases.sh +105 -17
  123. package/presets/cursor/nuxt/hooks/guard-shell-command.mjs +41 -2
  124. package/presets/cursor/php-hexagonal/hooks/chain-team-phases.sh +105 -17
  125. package/presets/cursor/php-hexagonal/hooks/guard-shell-command.mjs +41 -2
  126. package/presets/cursor/php-laravel/hooks/chain-team-phases.sh +106 -18
  127. package/presets/cursor/php-laravel/hooks/guard-shell-command.mjs +41 -2
  128. package/presets/cursor/svelte/hooks/chain-team-phases.sh +105 -17
  129. package/presets/cursor/svelte/hooks/guard-shell-command.mjs +41 -2
  130. package/presets/mavis/android-kotlin/adapter-map.json +1 -1
  131. package/presets/mavis/android-kotlin/hooks/chain-team-phases.sh +105 -17
  132. package/presets/mavis/android-kotlin/rules/agent-team-orchestrator.md +1 -1
  133. package/presets/mavis/go/adapter-map.json +1 -1
  134. package/presets/mavis/go/hooks/chain-team-phases.sh +105 -17
  135. package/presets/mavis/go/rules/agent-team-orchestrator.md +1 -1
  136. package/presets/mavis/ios-swift/adapter-map.json +1 -1
  137. package/presets/mavis/ios-swift/hooks/chain-team-phases.sh +105 -17
  138. package/presets/mavis/ios-swift/rules/agent-team-orchestrator.md +1 -1
  139. package/presets/mavis/java/adapter-map.json +1 -1
  140. package/presets/mavis/java/hooks/chain-team-phases.sh +105 -17
  141. package/presets/mavis/java/rules/agent-team-orchestrator.md +1 -1
  142. package/presets/mavis/mcp-ts/adapter-map.json +1 -1
  143. package/presets/mavis/mcp-ts/hooks/chain-team-phases.sh +105 -17
  144. package/presets/mavis/mcp-ts/rules/agent-team-orchestrator.md +1 -1
  145. package/presets/mavis/mol/adapter-map.json +1 -1
  146. package/presets/mavis/mol/hooks/chain-team-phases.sh +105 -17
  147. package/presets/mavis/mol/rules/agent-team-orchestrator.md +1 -1
  148. package/presets/mavis/next/MCP.md +2 -0
  149. package/presets/mavis/next/REPO_AGENTS.md +2 -0
  150. package/presets/mavis/next/adapter-map.json +25 -1
  151. package/presets/mavis/next/agents/build-verifier.md +1 -1
  152. package/presets/mavis/next/agents/ci-investigator.md +3 -0
  153. package/presets/mavis/next/agents/debugger.md +3 -0
  154. package/presets/mavis/next/agents/feature-developer.md +3 -0
  155. package/presets/mavis/next/agents/mockup-reviewer.md +2 -0
  156. package/presets/mavis/next/agents/performance-auditor.md +2 -0
  157. package/presets/mavis/next/agents/playwright-test-generator.md +3 -0
  158. package/presets/mavis/next/agents/playwright-test-healer.md +3 -0
  159. package/presets/mavis/next/agents/playwright-test-planner.md +3 -0
  160. package/presets/mavis/next/agents/qa-tester.md +3 -0
  161. package/presets/mavis/next/ai-local/rules-library/storybook-dev-compare-figma.md +1 -1
  162. package/presets/mavis/next/commands/README.md +6 -0
  163. package/presets/mavis/next/commands/ui-start.md +73 -0
  164. package/presets/mavis/next/commands/ui-stop.md +66 -0
  165. package/presets/mavis/next/hooks/chain-team-phases.sh +105 -17
  166. package/presets/mavis/next/rules/agent-team-orchestrator.md +1 -1
  167. package/presets/mavis/next/rules/dev-process-lifecycle.md +38 -0
  168. package/presets/mavis/next/rules/next-app-core.md +1 -0
  169. package/presets/mavis/nuxt/adapter-map.json +1 -1
  170. package/presets/mavis/nuxt/hooks/chain-team-phases.sh +105 -17
  171. package/presets/mavis/nuxt/rules/agent-team-orchestrator.md +1 -1
  172. package/presets/mavis/php-hexagonal/adapter-map.json +1 -1
  173. package/presets/mavis/php-hexagonal/hooks/chain-team-phases.sh +105 -17
  174. package/presets/mavis/php-hexagonal/rules/agent-team-orchestrator.md +1 -1
  175. package/presets/mavis/php-laravel/adapter-map.json +1 -1
  176. package/presets/mavis/php-laravel/hooks/chain-team-phases.sh +106 -18
  177. package/presets/mavis/php-laravel/rules/agent-team-orchestrator.md +1 -1
  178. package/presets/mavis/svelte/adapter-map.json +1 -1
  179. package/presets/mavis/svelte/hooks/chain-team-phases.sh +105 -17
  180. package/presets/mavis/svelte/rules/agent-team-orchestrator.md +1 -1
  181. package/presets/opencode/android-kotlin/adapter-map.json +1 -1
  182. package/presets/opencode/android-kotlin/hooks/chain-team-phases.sh +105 -17
  183. package/presets/opencode/android-kotlin/opencode.json +5 -1
  184. package/presets/opencode/android-kotlin/rules/agent-team-orchestrator.md +1 -1
  185. package/presets/opencode/go/adapter-map.json +1 -1
  186. package/presets/opencode/go/hooks/chain-team-phases.sh +105 -17
  187. package/presets/opencode/go/opencode.json +5 -1
  188. package/presets/opencode/go/rules/agent-team-orchestrator.md +1 -1
  189. package/presets/opencode/ios-swift/adapter-map.json +1 -1
  190. package/presets/opencode/ios-swift/hooks/chain-team-phases.sh +105 -17
  191. package/presets/opencode/ios-swift/opencode.json +5 -1
  192. package/presets/opencode/ios-swift/rules/agent-team-orchestrator.md +1 -1
  193. package/presets/opencode/java/adapter-map.json +1 -1
  194. package/presets/opencode/java/hooks/chain-team-phases.sh +105 -17
  195. package/presets/opencode/java/opencode.json +5 -1
  196. package/presets/opencode/java/rules/agent-team-orchestrator.md +1 -1
  197. package/presets/opencode/mcp-ts/adapter-map.json +1 -1
  198. package/presets/opencode/mcp-ts/hooks/chain-team-phases.sh +105 -17
  199. package/presets/opencode/mcp-ts/opencode.json +5 -1
  200. package/presets/opencode/mcp-ts/rules/agent-team-orchestrator.md +1 -1
  201. package/presets/opencode/mol/adapter-map.json +1 -1
  202. package/presets/opencode/mol/hooks/chain-team-phases.sh +105 -17
  203. package/presets/opencode/mol/opencode.json +4 -0
  204. package/presets/opencode/mol/rules/agent-team-orchestrator.md +1 -1
  205. package/presets/opencode/next/MCP.md +2 -0
  206. package/presets/opencode/next/REPO_AGENTS.md +2 -0
  207. package/presets/opencode/next/adapter-map.json +25 -1
  208. package/presets/opencode/next/agents/build-verifier.md +1 -1
  209. package/presets/opencode/next/agents/ci-investigator.md +3 -0
  210. package/presets/opencode/next/agents/debugger.md +3 -0
  211. package/presets/opencode/next/agents/feature-developer.md +3 -0
  212. package/presets/opencode/next/agents/mockup-reviewer.md +2 -0
  213. package/presets/opencode/next/agents/performance-auditor.md +2 -0
  214. package/presets/opencode/next/agents/playwright-test-generator.md +3 -0
  215. package/presets/opencode/next/agents/playwright-test-healer.md +3 -0
  216. package/presets/opencode/next/agents/playwright-test-planner.md +3 -0
  217. package/presets/opencode/next/agents/qa-tester.md +3 -0
  218. package/presets/opencode/next/ai-local/rules-library/storybook-dev-compare-figma.md +1 -1
  219. package/presets/opencode/next/commands/README.md +6 -0
  220. package/presets/opencode/next/commands/ui-start.md +81 -0
  221. package/presets/opencode/next/commands/ui-stop.md +74 -0
  222. package/presets/opencode/next/hooks/chain-team-phases.sh +105 -17
  223. package/presets/opencode/next/opencode.json +4 -0
  224. package/presets/opencode/next/rules/agent-team-orchestrator.md +1 -1
  225. package/presets/opencode/next/rules/dev-process-lifecycle.md +38 -0
  226. package/presets/opencode/next/rules/next-app-core.md +1 -0
  227. package/presets/opencode/nuxt/adapter-map.json +1 -1
  228. package/presets/opencode/nuxt/hooks/chain-team-phases.sh +105 -17
  229. package/presets/opencode/nuxt/opencode.json +4 -0
  230. package/presets/opencode/nuxt/rules/agent-team-orchestrator.md +1 -1
  231. package/presets/opencode/php-hexagonal/adapter-map.json +1 -1
  232. package/presets/opencode/php-hexagonal/hooks/chain-team-phases.sh +105 -17
  233. package/presets/opencode/php-hexagonal/opencode.json +5 -1
  234. package/presets/opencode/php-hexagonal/rules/agent-team-orchestrator.md +1 -1
  235. package/presets/opencode/php-laravel/adapter-map.json +1 -1
  236. package/presets/opencode/php-laravel/hooks/chain-team-phases.sh +106 -18
  237. package/presets/opencode/php-laravel/opencode.json +5 -1
  238. package/presets/opencode/php-laravel/rules/agent-team-orchestrator.md +1 -1
  239. package/presets/opencode/svelte/adapter-map.json +1 -1
  240. package/presets/opencode/svelte/hooks/chain-team-phases.sh +105 -17
  241. package/presets/opencode/svelte/opencode.json +4 -0
  242. package/presets/opencode/svelte/rules/agent-team-orchestrator.md +1 -1
  243. package/presets/zcode/android-kotlin/adapter-map.json +1 -1
  244. package/presets/zcode/android-kotlin/hooks/chain-team-phases.sh +105 -17
  245. package/presets/zcode/android-kotlin/rules/agent-team-orchestrator.md +1 -1
  246. package/presets/zcode/go/adapter-map.json +1 -1
  247. package/presets/zcode/go/hooks/chain-team-phases.sh +105 -17
  248. package/presets/zcode/go/rules/agent-team-orchestrator.md +1 -1
  249. package/presets/zcode/ios-swift/adapter-map.json +1 -1
  250. package/presets/zcode/ios-swift/hooks/chain-team-phases.sh +105 -17
  251. package/presets/zcode/ios-swift/rules/agent-team-orchestrator.md +1 -1
  252. package/presets/zcode/java/adapter-map.json +1 -1
  253. package/presets/zcode/java/hooks/chain-team-phases.sh +105 -17
  254. package/presets/zcode/java/rules/agent-team-orchestrator.md +1 -1
  255. package/presets/zcode/mcp-ts/adapter-map.json +1 -1
  256. package/presets/zcode/mcp-ts/hooks/chain-team-phases.sh +105 -17
  257. package/presets/zcode/mcp-ts/rules/agent-team-orchestrator.md +1 -1
  258. package/presets/zcode/mol/adapter-map.json +1 -1
  259. package/presets/zcode/mol/hooks/chain-team-phases.sh +105 -17
  260. package/presets/zcode/mol/rules/agent-team-orchestrator.md +1 -1
  261. package/presets/zcode/next/MCP.md +2 -0
  262. package/presets/zcode/next/REPO_AGENTS.md +2 -0
  263. package/presets/zcode/next/adapter-map.json +25 -1
  264. package/presets/zcode/next/agents/build-verifier.md +1 -1
  265. package/presets/zcode/next/agents/ci-investigator.md +3 -0
  266. package/presets/zcode/next/agents/debugger.md +3 -0
  267. package/presets/zcode/next/agents/feature-developer.md +3 -0
  268. package/presets/zcode/next/agents/mockup-reviewer.md +2 -0
  269. package/presets/zcode/next/agents/performance-auditor.md +2 -0
  270. package/presets/zcode/next/agents/playwright-test-generator.md +3 -0
  271. package/presets/zcode/next/agents/playwright-test-healer.md +3 -0
  272. package/presets/zcode/next/agents/playwright-test-planner.md +3 -0
  273. package/presets/zcode/next/agents/qa-tester.md +3 -0
  274. package/presets/zcode/next/ai-local/rules-library/storybook-dev-compare-figma.md +1 -1
  275. package/presets/zcode/next/commands/README.md +6 -0
  276. package/presets/zcode/next/commands/ui-start.md +81 -0
  277. package/presets/zcode/next/commands/ui-stop.md +74 -0
  278. package/presets/zcode/next/hooks/chain-team-phases.sh +105 -17
  279. package/presets/zcode/next/rules/agent-team-orchestrator.md +1 -1
  280. package/presets/zcode/next/rules/dev-process-lifecycle.md +38 -0
  281. package/presets/zcode/next/rules/next-app-core.md +1 -0
  282. package/presets/zcode/nuxt/adapter-map.json +1 -1
  283. package/presets/zcode/nuxt/hooks/chain-team-phases.sh +105 -17
  284. package/presets/zcode/nuxt/rules/agent-team-orchestrator.md +1 -1
  285. package/presets/zcode/php-hexagonal/adapter-map.json +1 -1
  286. package/presets/zcode/php-hexagonal/hooks/chain-team-phases.sh +105 -17
  287. package/presets/zcode/php-hexagonal/rules/agent-team-orchestrator.md +1 -1
  288. package/presets/zcode/php-laravel/adapter-map.json +1 -1
  289. package/presets/zcode/php-laravel/hooks/chain-team-phases.sh +106 -18
  290. package/presets/zcode/php-laravel/rules/agent-team-orchestrator.md +1 -1
  291. package/presets/zcode/svelte/adapter-map.json +1 -1
  292. package/presets/zcode/svelte/hooks/chain-team-phases.sh +105 -17
  293. package/presets/zcode/svelte/rules/agent-team-orchestrator.md +1 -1
@@ -8,15 +8,15 @@
8
8
  * `.env.defectdojo`; the token is never written by this package.
9
9
  */
10
10
  import { readFileSync } from 'node:fs';
11
- import { basename, resolve } from 'node:path';
11
+ import { basename } from 'node:path';
12
12
  import { createInterface } from 'node:readline';
13
13
  import {
14
14
  ApiError,
15
15
  ConfigError,
16
- isAllowedImportPath,
17
16
  isAllowedPath,
18
17
  loadDefectDojoConfig,
19
18
  request,
19
+ resolveImportPath,
20
20
  } from './lib/defectdojo.mjs';
21
21
 
22
22
  const PROTOCOL_VERSION = '2025-06-18';
@@ -208,14 +208,16 @@ function requireInteger(value, name) {
208
208
  }
209
209
 
210
210
  function readFileForImport(root, file) {
211
- if (!isAllowedImportPath(root, file)) {
211
+ // Read the resolved path, never re-resolve the raw argument: the validated
212
+ // object and the uploaded object must be the same filesystem entry.
213
+ const absolute = resolveImportPath(root, file);
214
+
215
+ if (absolute === null) {
212
216
  throw new ConfigError(
213
217
  'file must be a repo-relative path inside the project root; absolute paths, ".." traversal and symlink escapes are refused',
214
218
  );
215
219
  }
216
220
 
217
- const absolute = resolve(root, file);
218
-
219
221
  return { buffer: readFileSync(absolute), name: basename(absolute) };
220
222
  }
221
223
 
@@ -166,40 +166,52 @@ export function isAllowedPath(path, baseUrl) {
166
166
  * under the *real* project root: a symlink that leaves the root is an escape,
167
167
  * not a read. Deny closed: an unreadable, unresolvable, or malformed-encoding
168
168
  * path is a refusal, never a best-effort read.
169
+ *
170
+ * Returns the real path the caller must read. Resolving the name once is
171
+ * deliberate: a validator that trims and a reader that resolves the raw input
172
+ * can approve one filesystem object and read another (a whitespace-padded
173
+ * symlink alias is a distinct directory entry on POSIX). Padded names are
174
+ * refused, never trimmed, for the same reason.
169
175
  */
170
- export function isAllowedImportPath(root, input) {
171
- if (typeof root !== 'string' || root === '' || typeof input !== 'string' || input.trim() === '') {
172
- return false;
176
+ export function resolveImportPath(root, input) {
177
+ if (typeof root !== 'string' || root === '' || typeof input !== 'string' || input === '') {
178
+ return null;
179
+ }
180
+ if (input.trim() === '' || input !== input.trim()) {
181
+ return null;
173
182
  }
174
183
 
175
- const trimmed = input.trim();
176
-
177
- if (isAbsolute(trimmed) || /^[a-zA-Z]:[/\\]/.test(trimmed) || trimmed.startsWith('\\\\')) {
178
- return false;
184
+ if (isAbsolute(input) || /^[a-zA-Z]:[/\\]/.test(input) || input.startsWith('\\\\')) {
185
+ return null;
179
186
  }
180
187
 
181
- const forms = [trimmed];
188
+ const forms = [input];
182
189
  try {
183
- forms.push(decodeURIComponent(trimmed));
190
+ forms.push(decodeURIComponent(input));
184
191
  } catch {
185
- return false;
192
+ return null;
186
193
  }
187
194
 
188
195
  for (const form of forms) {
189
196
  if (form.split(/[\\/]/).includes('..')) {
190
- return false;
197
+ return null;
191
198
  }
192
199
  }
193
200
 
194
201
  try {
195
202
  const realRoot = realpathSync(root);
196
- const realFile = realpathSync(resolve(root, trimmed));
197
- return realFile === realRoot || realFile.startsWith(realRoot + sep);
203
+ const realFile = realpathSync(resolve(root, input));
204
+ return realFile === realRoot || realFile.startsWith(realRoot + sep) ? realFile : null;
198
205
  } catch {
199
- return false;
206
+ return null;
200
207
  }
201
208
  }
202
209
 
210
+ /** Boolean form of {@link resolveImportPath} for callers that only gate. */
211
+ export function isAllowedImportPath(root, input) {
212
+ return resolveImportPath(root, input) !== null;
213
+ }
214
+
203
215
  export function buildUrl(baseUrl, path, query = {}) {
204
216
  const url = /^https?:\/\//.test(path) ? new URL(path) : new URL(`${baseUrl}/${apiPath(path)}`);
205
217
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bonesofspring/ai-rules",
3
- "version": "0.2.64",
3
+ "version": "0.2.65",
4
4
  "description": "Presets of Cursor, Claude, Mavis, OpenCode, and ZCode rules/commands for Revy Ross personal use",
5
5
  "license": "MIT",
6
6
  "author": "Revy Ross",
@@ -37,7 +37,7 @@
37
37
  "scripts": {
38
38
  "check:fast": "bash scripts/check-preset-fast.sh",
39
39
  "check:changed": "node scripts/check-preset-delta.mjs --base HEAD",
40
- "test:hooks": "node scripts/test-chain-team-phases-coverage.mjs && node scripts/test-agent-task-metrics-hooks.mjs",
40
+ "test:hooks": "node scripts/test-chain-team-phases-coverage.mjs && node scripts/test-agent-task-metrics-hooks.mjs && node scripts/test-chain-team-phases-dev-cleanup.mjs",
41
41
  "check:preset-structure": "bash scripts/check-preset-structure.sh",
42
42
  "release:gate": "bash scripts/release-gate.sh",
43
43
  "check:platform-scripts": "node scripts/check-platform-scripts.mjs",
@@ -49,27 +49,27 @@
49
49
  "check:claude-agent-blocks": "node scripts/check-claude-agent-blocks.mjs",
50
50
  "check:claude-agent-parity": "node scripts/check-claude-agent-parity.mjs",
51
51
  "test:claude-agent-parity": "node scripts/test-claude-agent-parity.mjs",
52
- "check:consumer-links": "node scripts/check-consumer-links.mjs",
52
+ "check:consumer-links": "node scripts/run-locked.mjs --label check:consumer-links -- node scripts/check-consumer-links.mjs",
53
53
  "test:consumer-links": "node scripts/test-consumer-links.mjs",
54
- "check:preset-twin-map": "bash scripts/check-preset-twin-map.sh",
55
- "check:preset-twin-drift": "node scripts/check-preset-twin-drift.mjs",
54
+ "check:preset-twin-map": "node scripts/run-locked.mjs --label check:preset-twin-map -- bash scripts/check-preset-twin-map.sh",
55
+ "check:preset-twin-drift": "node scripts/run-locked.mjs --label check:preset-twin-drift -- node scripts/check-preset-twin-drift.mjs",
56
56
  "test:twin-drift-fixtures": "node scripts/test-preset-twin-drift.mjs",
57
- "check:preset-token-budget": "bash scripts/check-preset-token-budget.sh",
58
- "check:preset-leakage": "bash scripts/check-preset-leakage.sh",
57
+ "check:preset-token-budget": "node scripts/run-locked.mjs --label check:preset-token-budget -- bash scripts/check-preset-token-budget.sh",
58
+ "check:preset-leakage": "node scripts/run-locked.mjs --label check:preset-leakage -- bash scripts/check-preset-leakage.sh",
59
59
  "check:figma-contract": "bash scripts/check-figma-contract-presence.sh",
60
60
  "check:hook-only-lifecycle": "bash scripts/check-hook-only-lifecycle.sh",
61
- "check:preset-reachability": "bash scripts/check-preset-reachability.sh",
61
+ "check:preset-reachability": "node scripts/run-locked.mjs --label check:preset-reachability -- bash scripts/check-preset-reachability.sh",
62
62
  "check:local-overlay": "bash scripts/check-local-overlay.sh",
63
- "check:preset-i18n": "AI_RULES_I18N_FAIL=1 AI_RULES_I18N_SOFT=0 bash scripts/check-preset-i18n.sh",
64
- "check:frontmatter": "node scripts/check-frontmatter.mjs",
65
- "check:shared-core-drift": "bash scripts/check-shared-core-drift.sh",
63
+ "check:preset-i18n": "node scripts/run-locked.mjs --label check:preset-i18n -- env AI_RULES_I18N_FAIL=1 AI_RULES_I18N_SOFT=0 bash scripts/check-preset-i18n.sh",
64
+ "check:frontmatter": "node scripts/run-locked.mjs --label check:frontmatter -- node scripts/check-frontmatter.mjs",
65
+ "check:shared-core-drift": "node scripts/run-locked.mjs --label check:shared-core-drift -- bash scripts/check-shared-core-drift.sh",
66
66
  "check:product-specs": "bash scripts/check-product-specs.sh",
67
67
  "check:product-specs:self-test": "bash scripts/check-product-specs.sh --self-test",
68
68
  "check:product-specs:dogfood": "bash scripts/check-product-specs.sh ../../dogfood/mcp-ts-sample",
69
69
  "check:rule-eval": "node scripts/check-rule-eval.mjs",
70
70
  "check:next-attached-budget": "node scripts/check-next-attached-budget.mjs",
71
71
  "check:release-consistency": "node scripts/check-release-consistency.mjs",
72
- "check:generated-drift": "node scripts/check-generated-drift.mjs",
72
+ "check:generated-drift": "node scripts/run-locked.mjs --label check:generated-drift -- node scripts/check-generated-drift.mjs",
73
73
  "check:hook-body-parity": "node scripts/check-hook-body-parity.mjs",
74
74
  "test:hook-body-parity-fixtures": "node scripts/test-hook-body-parity-fixtures.mjs",
75
75
  "test:shared-core-drift-lineage-fixtures": "node scripts/test-shared-core-drift-lineage-fixtures.mjs",
@@ -77,8 +77,10 @@
77
77
  "test:generate-claude-fixtures": "node scripts/test-generate-claude-fixtures.mjs",
78
78
  "test:generated-drift-claude-fixtures": "node scripts/test-generated-drift-claude-fixtures.mjs",
79
79
  "test:rule-improver": "node scripts/test-rule-improver-ledger.mjs",
80
+ "test:guard-shell-command": "node scripts/test-guard-shell-command.mjs",
81
+ "check:processes": "node scripts/test-process-lease.mjs && node scripts/test-process-adapters.mjs && node scripts/test-process-scan.mjs",
80
82
  "test:cli-mcp-merge": "node scripts/test-cli-mcp-merge.mjs",
81
- "test:cli-init-clean": "node scripts/test-cli-init-clean.mjs",
83
+ "test:cli-init-clean": "node scripts/run-locked.mjs --label test:cli-init-clean -- node scripts/test-cli-init-clean.mjs",
82
84
  "test:cli-update": "node scripts/test-cli-update.mjs",
83
85
  "test:cli-install-doctor": "node scripts/test-install-doctor.mjs",
84
86
  "test:engine-upgrade": "node scripts/test-engine-upgrade.mjs",
@@ -95,15 +97,17 @@
95
97
  "test:team-db:api": "node scripts/test-team-db-api.mjs",
96
98
  "test:team-db:security": "node scripts/test-team-db-security.mjs",
97
99
  "test:team-db:dashboard": "node scripts/test-team-db-dashboard.mjs",
100
+ "test:team-db:ui": "node scripts/test-team-db-ui.mjs",
98
101
  "test:team-db:concurrency": "node scripts/test-team-db-concurrency.mjs",
99
- "test:team-db:backlog": "node scripts/test-team-db-backlog.mjs",
100
- "test:team-db:backlog-order": "node scripts/test-team-db-backlog-order.mjs",
101
- "test:team-db:backlog-project": "node scripts/test-team-db-backlog-project.mjs",
102
- "test:team-db:backlog-queue": "node scripts/test-team-db-backlog-queue.mjs",
103
- "test:team-db:backlog-import": "node scripts/test-team-db-backlog-import.mjs",
102
+ "test:team-db:tracker": "node scripts/test-team-db-tracker.mjs",
103
+ "test:team-db:tracker-order": "node scripts/test-team-db-tracker-order.mjs",
104
+ "test:team-db:tracker-project": "node scripts/test-team-db-tracker-project.mjs",
105
+ "test:team-db:tracker-queue": "node scripts/test-team-db-tracker-queue.mjs",
106
+ "test:team-db:tracker-import": "node scripts/test-team-db-tracker-import.mjs",
107
+ "test:team-db:task-runner": "node scripts/test-team-db-task-runner.mjs",
104
108
  "test:team-db:scheduler": "node scripts/test-team-db-scheduler.mjs",
105
109
  "test:team-db:fixtures": "node scripts/test-team-db-fixtures.mjs",
106
- "test:team-db": "node scripts/test-team-db-schema.mjs && node scripts/test-team-db-project.mjs && node scripts/test-team-db-migrate-tasks.mjs && node scripts/test-team-db-dualwrite.mjs && node scripts/check-team-db-contract.mjs && node scripts/test-team-db-api.mjs && node scripts/test-team-db-security.mjs && node scripts/test-team-db-dashboard.mjs && node scripts/test-team-db-concurrency.mjs && node scripts/test-team-db-backlog.mjs && node scripts/test-team-db-backlog-order.mjs && node scripts/test-team-db-backlog-project.mjs && node scripts/test-team-db-backlog-queue.mjs && node scripts/test-team-db-backlog-import.mjs && node scripts/test-team-db-scheduler.mjs && node scripts/test-team-db-fixtures.mjs",
110
+ "test:team-db": "node scripts/test-team-db-schema.mjs && node scripts/test-team-db-project.mjs && node scripts/test-team-db-migrate-tasks.mjs && node scripts/test-team-db-dualwrite.mjs && node scripts/check-team-db-contract.mjs && node scripts/test-team-db-api.mjs && node scripts/test-team-db-security.mjs && node scripts/test-team-db-dashboard.mjs && node scripts/test-team-db-ui.mjs && node scripts/test-team-db-concurrency.mjs && node scripts/test-team-db-tracker.mjs && node scripts/test-team-db-tracker-order.mjs && node scripts/test-team-db-tracker-project.mjs && node scripts/test-team-db-tracker-queue.mjs && node scripts/test-team-db-tracker-import.mjs && node scripts/test-team-db-task-runner.mjs && node scripts/test-team-db-scheduler.mjs && node scripts/test-team-db-fixtures.mjs",
107
111
  "check:team-db-contract": "node scripts/check-team-db-contract.mjs",
108
112
  "check:mavis-platform-contract": "node scripts/check-mavis-platform-contract.mjs --self-test",
109
113
  "check:mavis-adapter-map": "node scripts/check-mavis-adapter-map.mjs --self-test",
@@ -121,11 +125,13 @@
121
125
  "check:zcode-local-overlay": "node scripts/check-zcode-local-overlay.mjs",
122
126
  "test:opencode-context-budget": "node scripts/test-opencode-context-budget.mjs",
123
127
  "test:probe-mavis-capabilities": "node scripts/test-probe-mavis-capabilities.mjs",
128
+ "preset:loop": "yarn fix:generated && yarn check:changed && yarn check:fast",
124
129
  "fix:generated": "node scripts/fix-generated.mjs",
125
130
  "generate:claude": "node scripts/generate-claude.mjs",
126
131
  "generate:mavis": "node scripts/generate-mavis.mjs",
127
132
  "generate:opencode": "node scripts/generate-opencode.mjs",
128
- "generate:zcode": "node scripts/generate-zcode.mjs"
133
+ "generate:zcode": "node scripts/generate-zcode.mjs",
134
+ "test:dev-processes": "node scripts/test-dev-processes.mjs"
129
135
  },
130
136
  "engines": {
131
137
  "node": ">=20"