@runa-ai/runa-cli 0.5.72 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (528) hide show
  1. package/dist/build-V66FAQXB.js +1719 -0
  2. package/dist/cache-N7WNPEYF.js +111 -0
  3. package/dist/check-LOMVIRHX.js +12 -0
  4. package/dist/chunk-2APB25TT.js +442 -0
  5. package/dist/chunk-3FDQW524.js +544 -0
  6. package/dist/chunk-3WDV32GA.js +33 -0
  7. package/dist/chunk-5FT3F36G.js +59 -0
  8. package/dist/chunk-5NKWR4FF.js +254 -0
  9. package/dist/chunk-644FVGIQ.js +194 -0
  10. package/dist/chunk-6AALH2ED.js +121 -0
  11. package/dist/chunk-6FAU4IGR.js +63 -0
  12. package/dist/chunk-6Y3LAUGL.js +35 -0
  13. package/dist/chunk-7B5C6U2K.js +274 -0
  14. package/dist/chunk-AAIE4F2U.js +140 -0
  15. package/dist/chunk-AIP6MR42.js +12 -0
  16. package/dist/chunk-CCKG5R4Y.js +59 -0
  17. package/dist/chunk-DRSUEMAK.js +123 -0
  18. package/dist/chunk-FHG3ILE4.js +2011 -0
  19. package/dist/chunk-H2AHNI75.js +31 -0
  20. package/dist/chunk-HD74F6W2.js +460 -0
  21. package/dist/chunk-HKUWEGUX.js +36 -0
  22. package/dist/chunk-IBVVGH6X.js +33 -0
  23. package/dist/chunk-II7VYQEM.js +179 -0
  24. package/dist/chunk-JMJP4A47.js +204 -0
  25. package/dist/chunk-JQXOVCOP.js +574 -0
  26. package/dist/chunk-KE6QJBZG.js +41 -0
  27. package/dist/chunk-KWX3JHCY.js +85 -0
  28. package/dist/chunk-MXRWBNIY.js +74 -0
  29. package/dist/chunk-NPSRD26F.js +149 -0
  30. package/dist/chunk-QDF7QXBL.js +67 -0
  31. package/dist/chunk-QM53IQHM.js +209 -0
  32. package/dist/chunk-RZLYEO4U.js +219 -0
  33. package/dist/chunk-SGJG3BKD.js +351 -0
  34. package/dist/chunk-TYIAD6SB.js +74 -0
  35. package/dist/chunk-UWWSAPDR.js +31 -0
  36. package/dist/chunk-VM3IWOT5.js +458 -0
  37. package/dist/chunk-VRXHCR5K.js +42 -0
  38. package/dist/chunk-WJXC4MVY.js +75 -0
  39. package/dist/chunk-XDCHRVE3.js +215 -0
  40. package/dist/chunk-Z4Z5DNW4.js +1196 -0
  41. package/dist/chunk-ZZOXM6Q4.js +8 -0
  42. package/dist/ci-ZWRVWNFX.js +9298 -0
  43. package/dist/cli/contract-output.d.ts +1 -0
  44. package/dist/cli/index.d.ts +7 -1
  45. package/dist/cli/requested-command.d.ts +8 -0
  46. package/dist/cli-2JNBJUBB.js +704 -0
  47. package/dist/commands/build/actors/db-sync.d.ts +2 -0
  48. package/dist/commands/build/actors/static-checks.d.ts +7 -6
  49. package/dist/commands/build/actors/validate.d.ts +2 -0
  50. package/dist/commands/build/contract.d.ts +30 -30
  51. package/dist/commands/build/machine-dry-run.d.ts +3 -0
  52. package/dist/commands/build/machine-e2e-meta.d.ts +120 -0
  53. package/dist/commands/build/machine.d.ts +22 -22
  54. package/dist/commands/build/types.d.ts +2 -4
  55. package/dist/commands/check/commands/check.d.ts +8 -3
  56. package/dist/commands/ci/machine/actors/db/collect-schema-stats.d.ts +9 -6
  57. package/dist/commands/ci/machine/actors/db/schema-canonical-diff.d.ts +55 -0
  58. package/dist/commands/ci/machine/actors/db/schema-stats.d.ts +11 -0
  59. package/dist/commands/ci/machine/actors/db/sync-schema.d.ts +9 -1
  60. package/dist/commands/ci/machine/contract.d.ts +26 -26
  61. package/dist/commands/ci/machine/formatters/sections/final-comment.d.ts +1 -5
  62. package/dist/commands/ci/machine/formatters/sections/format-helpers.d.ts +5 -0
  63. package/dist/commands/ci/machine/formatters/sections/index.d.ts +2 -2
  64. package/dist/commands/ci/machine/formatters/sections/schema-matrix.d.ts +3 -3
  65. package/dist/commands/ci/machine/machine-execution-helpers.d.ts +40 -0
  66. package/dist/commands/ci/machine/machine-state-helpers.d.ts +14 -0
  67. package/dist/commands/ci/machine/machine.d.ts +12 -12
  68. package/dist/commands/ci/machine/types.d.ts +2 -5
  69. package/dist/commands/ci/utils/ci-summary.d.ts +15 -15
  70. package/dist/commands/ci/utils/execa-helpers.d.ts +2 -0
  71. package/dist/commands/db/apply/actors/idempotent-actors.d.ts +34 -0
  72. package/dist/commands/db/apply/actors/lock-actors.d.ts +16 -0
  73. package/dist/commands/db/apply/actors/pg-schema-diff-actors.d.ts +31 -0
  74. package/dist/commands/db/apply/actors/seed-actors.d.ts +11 -0
  75. package/dist/commands/db/apply/actors/shared.d.ts +9 -0
  76. package/dist/commands/db/apply/actors.d.ts +16 -65
  77. package/dist/commands/db/apply/contract.d.ts +8 -1
  78. package/dist/commands/db/apply/helpers/data-compatibility-checker.d.ts +3 -4
  79. package/dist/commands/db/apply/helpers/data-integrity-verifier.d.ts +37 -0
  80. package/dist/commands/db/apply/helpers/fresh-db-handler.d.ts +34 -0
  81. package/dist/commands/db/apply/helpers/hazard-handler.d.ts +60 -0
  82. package/dist/commands/db/apply/helpers/idempotent-object-registry.d.ts +96 -0
  83. package/dist/commands/db/apply/helpers/idempotent-transaction.d.ts +20 -0
  84. package/dist/commands/db/apply/helpers/index.d.ts +6 -0
  85. package/dist/commands/db/apply/helpers/partition-validator.d.ts +2 -15
  86. package/dist/commands/db/apply/helpers/pg-schema-diff-helpers.d.ts +18 -162
  87. package/dist/commands/db/apply/helpers/pg-schema-diff-patterns.d.ts +55 -0
  88. package/dist/commands/db/apply/helpers/pg-schema-diff-version.d.ts +50 -0
  89. package/dist/commands/db/apply/helpers/plan-validator.d.ts +4 -10
  90. package/dist/commands/db/apply/helpers/rbac-password-manager.d.ts +34 -0
  91. package/dist/commands/db/apply/helpers/retry-logic.d.ts +16 -2
  92. package/dist/commands/db/apply/helpers/shadow-db-manager.d.ts +1 -1
  93. package/dist/commands/db/apply/helpers/sql-utils.d.ts +26 -0
  94. package/dist/commands/db/apply/machine.d.ts +52 -1
  95. package/dist/commands/db/commands/db-apply.d.ts +18 -0
  96. package/dist/commands/db/commands/db-sync/boundary-classifier.d.ts +21 -0
  97. package/dist/commands/db/commands/db-sync/error-classifier.d.ts +9 -0
  98. package/dist/commands/db/commands/db-sync/plan-hazard-analyzer.d.ts +13 -0
  99. package/dist/commands/db/commands/db-sync/risk-reporter.d.ts +19 -0
  100. package/dist/commands/db/commands/db-sync/sql-parser.d.ts +25 -0
  101. package/dist/commands/db/commands/db-sync/types.d.ts +47 -0
  102. package/dist/commands/db/commands/db-sync.d.ts +14 -0
  103. package/dist/commands/db/sync/contract.d.ts +6 -2
  104. package/dist/commands/db/sync/machine.d.ts +2 -1
  105. package/dist/commands/db/types.d.ts +2 -0
  106. package/dist/commands/db/utils/boundary-policy/rule-compiler.d.ts +11 -0
  107. package/dist/commands/db/utils/boundary-policy/types.d.ts +105 -0
  108. package/dist/commands/db/utils/boundary-policy/validation.d.ts +20 -0
  109. package/dist/commands/db/utils/boundary-policy-runtime.d.ts +28 -0
  110. package/dist/commands/db/utils/boundary-policy.d.ts +5 -0
  111. package/dist/commands/db/utils/idempotent-risk-context.d.ts +29 -0
  112. package/dist/commands/db/utils/preflight-check.d.ts +14 -0
  113. package/dist/commands/db/utils/preflight-checks/domain-naming-checks.d.ts +106 -0
  114. package/dist/commands/db/utils/preflight-checks/orphan-checks.d.ts +36 -0
  115. package/dist/commands/db/utils/preflight-checks/schema-risk-checks.d.ts +22 -0
  116. package/dist/commands/db/utils/preflight-checks/supabase-checks.d.ts +55 -0
  117. package/dist/commands/db/utils/risk-detector-loader.d.ts +8 -0
  118. package/dist/commands/db/utils/schema-precheck-budget.d.ts +17 -0
  119. package/dist/commands/db/utils/sql-boundary-parser.d.ts +12 -0
  120. package/dist/commands/db/utils/sql-file-collector.d.ts +8 -0
  121. package/dist/commands/db/utils/sql-filename-parser.d.ts +20 -0
  122. package/dist/commands/db/utils/sql-table-extractor-ast.d.ts +19 -0
  123. package/dist/commands/db/utils/sql-table-extractor-regex.d.ts +50 -0
  124. package/dist/commands/db/utils/sql-table-extractor-rls.d.ts +13 -0
  125. package/dist/commands/db/utils/sql-table-extractor.d.ts +79 -1
  126. package/dist/commands/db/utils/table-registry-introspection.d.ts +68 -0
  127. package/dist/commands/db/utils/table-registry.d.ts +3 -38
  128. package/dist/commands/dev/actors/app-lifecycle.d.ts +18 -0
  129. package/dist/commands/dev/actors/index.d.ts +12 -2
  130. package/dist/commands/dev/actors/process-check.d.ts +12 -0
  131. package/dist/commands/dev/actors/shared.d.ts +15 -0
  132. package/dist/commands/dev/actors/tables-manifest.d.ts +16 -0
  133. package/dist/commands/dev/contract.d.ts +3 -3
  134. package/dist/commands/dev/guards.d.ts +24 -0
  135. package/dist/commands/dev/machine.d.ts +27 -32
  136. package/dist/commands/dev/types.d.ts +2 -0
  137. package/dist/commands/doctor.d.ts +9 -0
  138. package/dist/commands/env/commands/env-pull/auth.d.ts +13 -0
  139. package/dist/commands/env/commands/env-pull/dotenv-files.d.ts +14 -0
  140. package/dist/commands/env/commands/env-pull/security.d.ts +12 -0
  141. package/dist/commands/env/commands/env-pull/service.d.ts +8 -0
  142. package/dist/commands/env/commands/env-pull/shared.d.ts +79 -0
  143. package/dist/commands/env/commands/setup/types.d.ts +1 -1
  144. package/dist/commands/env/constants/local-supabase.d.ts +2 -0
  145. package/dist/commands/inject-test-attrs/defaults.d.ts +9 -0
  146. package/dist/commands/template-check/contract.d.ts +6 -6
  147. package/dist/commands/template-check/machine.d.ts +2 -2
  148. package/dist/commands/template-check/types.d.ts +0 -4
  149. package/dist/commands/template-check/utils/diff-analyzer.d.ts +0 -4
  150. package/dist/commands/utils/machine-state-logging.d.ts +20 -0
  151. package/dist/commands/utils/repo-root.d.ts +2 -0
  152. package/dist/config/env.d.ts +4 -4
  153. package/dist/config-loader-GT3HAQ7U.js +7 -0
  154. package/dist/db-XULCILOU.js +14137 -0
  155. package/dist/dev-5YXNPTCJ.js +992 -0
  156. package/dist/doctor-MZLOA53G.js +44 -0
  157. package/dist/env-HMMRSYCI.js +7 -0
  158. package/dist/env-SS66PZ4B.js +2623 -0
  159. package/dist/env-files-2UIUYLLR.js +8 -0
  160. package/dist/error-handler-HEXBRNVV.js +460 -0
  161. package/dist/hotfix-YA3DGLOM.js +1477 -0
  162. package/dist/index.d.ts +5 -1
  163. package/dist/index.js +48 -42995
  164. package/dist/init-ZIL6LRFO.js +631 -0
  165. package/dist/inject-test-attrs-P44BVTQS.js +23 -0
  166. package/dist/internal/machines/snapshot-helpers.d.ts +6 -0
  167. package/dist/lib/sql-comment-utils.d.ts +25 -0
  168. package/dist/license-OB7GVJQ2.js +468 -0
  169. package/dist/link-VSNDVZZD.js +59 -0
  170. package/dist/manifest-TMFLESHW.js +19 -0
  171. package/dist/prepare-32DOVHTE.js +250 -0
  172. package/dist/risk-detector-4U6ZJ2G5.js +6 -0
  173. package/dist/risk-detector-core-TK4OAI3N.js +166 -0
  174. package/dist/risk-detector-plpgsql-HWKS4OLR.js +1886 -0
  175. package/dist/sdk-XK6HQU7S.js +348 -0
  176. package/dist/services-7VK5KZTO.js +177 -0
  177. package/dist/session-SFW5QSXZ.js +142 -0
  178. package/dist/signal-handler-DO3OANW5.js +6 -0
  179. package/dist/status-UTKS63AB.js +94 -0
  180. package/dist/telemetry-P56UBLZ2.js +93 -0
  181. package/dist/template-check-3P4HZXVY.js +1944 -0
  182. package/dist/test-V4KQL574.js +650 -0
  183. package/dist/test-gen-FS4CEY3P.js +88 -0
  184. package/dist/ui-RJAMCWUI.js +331 -0
  185. package/dist/upgrade-NUK3ZBCL.js +637 -0
  186. package/dist/utils/config-loader.d.ts +0 -3
  187. package/dist/validate-CAAW4Y44.js +54 -0
  188. package/dist/validators/risk-detector-content-risks.d.ts +13 -0
  189. package/dist/validators/risk-detector-core.d.ts +25 -0
  190. package/dist/validators/risk-detector-patterns.d.ts +15 -0
  191. package/dist/validators/risk-detector-plpgsql-expression-resolver.d.ts +22 -0
  192. package/dist/validators/risk-detector-plpgsql-parser.d.ts +5 -0
  193. package/dist/validators/risk-detector-plpgsql-tokenizer.d.ts +18 -0
  194. package/dist/validators/risk-detector-plpgsql.d.ts +9 -0
  195. package/dist/validators/risk-detector-text-utils.d.ts +6 -0
  196. package/dist/validators/risk-detector-types.d.ts +16 -0
  197. package/dist/validators/risk-detector.d.ts +7 -26
  198. package/dist/vuln-check-2W7N5TA2.js +121 -0
  199. package/dist/vuln-checker-IQJ56RUV.js +3223 -0
  200. package/dist/watch-PNTKZYFB.js +911 -0
  201. package/dist/workflow-H75N4BXX.js +897 -0
  202. package/package.json +5 -2
  203. package/dist/cli/contract-mode.d.ts.map +0 -1
  204. package/dist/cli/contract-output.d.ts.map +0 -1
  205. package/dist/cli/early-flags.d.ts.map +0 -1
  206. package/dist/cli/error-handler.d.ts.map +0 -1
  207. package/dist/cli/exec.d.ts.map +0 -1
  208. package/dist/cli/index.d.ts.map +0 -1
  209. package/dist/cli/json-output.d.ts.map +0 -1
  210. package/dist/cli/non-interactive.d.ts.map +0 -1
  211. package/dist/cli/output-format.d.ts.map +0 -1
  212. package/dist/cli/signal-handler.d.ts.map +0 -1
  213. package/dist/commands/build/actors/build.d.ts.map +0 -1
  214. package/dist/commands/build/actors/clean.d.ts.map +0 -1
  215. package/dist/commands/build/actors/db-sync.d.ts.map +0 -1
  216. package/dist/commands/build/actors/index.d.ts.map +0 -1
  217. package/dist/commands/build/actors/manifest.d.ts.map +0 -1
  218. package/dist/commands/build/actors/setup.d.ts.map +0 -1
  219. package/dist/commands/build/actors/static-checks.d.ts.map +0 -1
  220. package/dist/commands/build/actors/validate.d.ts.map +0 -1
  221. package/dist/commands/build/commands/build.d.ts.map +0 -1
  222. package/dist/commands/build/contract.d.ts.map +0 -1
  223. package/dist/commands/build/guards.d.ts.map +0 -1
  224. package/dist/commands/build/index.d.ts.map +0 -1
  225. package/dist/commands/build/machine.d.ts.map +0 -1
  226. package/dist/commands/build/types.d.ts.map +0 -1
  227. package/dist/commands/cache.d.ts.map +0 -1
  228. package/dist/commands/check/commands/check.d.ts.map +0 -1
  229. package/dist/commands/check/index.d.ts.map +0 -1
  230. package/dist/commands/ci/commands/ci-checks.d.ts.map +0 -1
  231. package/dist/commands/ci/commands/ci-layer-content.d.ts.map +0 -1
  232. package/dist/commands/ci/commands/ci-pr-capabilities.d.ts.map +0 -1
  233. package/dist/commands/ci/commands/ci-prod-apply.d.ts.map +0 -1
  234. package/dist/commands/ci/commands/ci-prod-db-operations.d.ts.map +0 -1
  235. package/dist/commands/ci/commands/ci-prod-github.d.ts.map +0 -1
  236. package/dist/commands/ci/commands/ci-prod-types.d.ts.map +0 -1
  237. package/dist/commands/ci/commands/ci-prod-utils.d.ts.map +0 -1
  238. package/dist/commands/ci/commands/ci-prod-workflow.d.ts.map +0 -1
  239. package/dist/commands/ci/commands/ci-resolvers.d.ts.map +0 -1
  240. package/dist/commands/ci/commands/ci-static.d.ts.map +0 -1
  241. package/dist/commands/ci/commands/ci-supabase-local.d.ts.map +0 -1
  242. package/dist/commands/ci/index.d.ts.map +0 -1
  243. package/dist/commands/ci/machine/actors/build/app-build.d.ts.map +0 -1
  244. package/dist/commands/ci/machine/actors/build/app-start.d.ts.map +0 -1
  245. package/dist/commands/ci/machine/actors/build/build-and-playwright.d.ts.map +0 -1
  246. package/dist/commands/ci/machine/actors/build/index.d.ts.map +0 -1
  247. package/dist/commands/ci/machine/actors/build/playwright-install.d.ts.map +0 -1
  248. package/dist/commands/ci/machine/actors/build/static-checks.d.ts.map +0 -1
  249. package/dist/commands/ci/machine/actors/db/apply-seeds.d.ts.map +0 -1
  250. package/dist/commands/ci/machine/actors/db/collect-schema-stats.d.ts.map +0 -1
  251. package/dist/commands/ci/machine/actors/db/index.d.ts.map +0 -1
  252. package/dist/commands/ci/machine/actors/db/pgtap-install.d.ts.map +0 -1
  253. package/dist/commands/ci/machine/actors/db/production-preview.d.ts.map +0 -1
  254. package/dist/commands/ci/machine/actors/db/pull-production.d.ts.map +0 -1
  255. package/dist/commands/ci/machine/actors/db/reset.d.ts.map +0 -1
  256. package/dist/commands/ci/machine/actors/db/schema-stats.d.ts.map +0 -1
  257. package/dist/commands/ci/machine/actors/db/setup-roles.d.ts.map +0 -1
  258. package/dist/commands/ci/machine/actors/db/sync-schema.d.ts.map +0 -1
  259. package/dist/commands/ci/machine/actors/finalize/github.d.ts.map +0 -1
  260. package/dist/commands/ci/machine/actors/finalize/index.d.ts.map +0 -1
  261. package/dist/commands/ci/machine/actors/finalize/summary.d.ts.map +0 -1
  262. package/dist/commands/ci/machine/actors/index.d.ts.map +0 -1
  263. package/dist/commands/ci/machine/actors/setup/index.d.ts.map +0 -1
  264. package/dist/commands/ci/machine/actors/setup/local.d.ts.map +0 -1
  265. package/dist/commands/ci/machine/actors/setup/pr-common.d.ts.map +0 -1
  266. package/dist/commands/ci/machine/actors/setup/pr-local.d.ts.map +0 -1
  267. package/dist/commands/ci/machine/actors/test/capabilities.d.ts.map +0 -1
  268. package/dist/commands/ci/machine/actors/test/index.d.ts.map +0 -1
  269. package/dist/commands/ci/machine/actors/test/run-layers.d.ts.map +0 -1
  270. package/dist/commands/ci/machine/commands/ci-local.d.ts.map +0 -1
  271. package/dist/commands/ci/machine/commands/ci-pr.d.ts.map +0 -1
  272. package/dist/commands/ci/machine/commands/index.d.ts.map +0 -1
  273. package/dist/commands/ci/machine/commands/machine-runner.d.ts.map +0 -1
  274. package/dist/commands/ci/machine/commands/runtime-env.d.ts.map +0 -1
  275. package/dist/commands/ci/machine/contract.d.ts.map +0 -1
  276. package/dist/commands/ci/machine/formatters/github-comment-types.d.ts.map +0 -1
  277. package/dist/commands/ci/machine/formatters/github-comment.d.ts.map +0 -1
  278. package/dist/commands/ci/machine/formatters/index.d.ts.map +0 -1
  279. package/dist/commands/ci/machine/formatters/sections/final-comment.d.ts.map +0 -1
  280. package/dist/commands/ci/machine/formatters/sections/format-helpers.d.ts.map +0 -1
  281. package/dist/commands/ci/machine/formatters/sections/index.d.ts.map +0 -1
  282. package/dist/commands/ci/machine/formatters/sections/progress-comment.d.ts.map +0 -1
  283. package/dist/commands/ci/machine/formatters/sections/schema-matrix.d.ts.map +0 -1
  284. package/dist/commands/ci/machine/formatters/summary.d.ts.map +0 -1
  285. package/dist/commands/ci/machine/guards.d.ts.map +0 -1
  286. package/dist/commands/ci/machine/helpers.d.ts.map +0 -1
  287. package/dist/commands/ci/machine/index.d.ts.map +0 -1
  288. package/dist/commands/ci/machine/machine.d.ts.map +0 -1
  289. package/dist/commands/ci/machine/types.d.ts.map +0 -1
  290. package/dist/commands/ci/utils/ai-report.d.ts.map +0 -1
  291. package/dist/commands/ci/utils/app-process.d.ts.map +0 -1
  292. package/dist/commands/ci/utils/app-runtime.d.ts.map +0 -1
  293. package/dist/commands/ci/utils/ci-config.d.ts.map +0 -1
  294. package/dist/commands/ci/utils/ci-env-schema.d.ts.map +0 -1
  295. package/dist/commands/ci/utils/ci-logging.d.ts.map +0 -1
  296. package/dist/commands/ci/utils/ci-summary.d.ts.map +0 -1
  297. package/dist/commands/ci/utils/config-readers.d.ts.map +0 -1
  298. package/dist/commands/ci/utils/db-url-utils.d.ts.map +0 -1
  299. package/dist/commands/ci/utils/e2e-auth-setup.d.ts.map +0 -1
  300. package/dist/commands/ci/utils/env-security.d.ts.map +0 -1
  301. package/dist/commands/ci/utils/execa-helpers.d.ts.map +0 -1
  302. package/dist/commands/ci/utils/exit-code-computation.d.ts.map +0 -1
  303. package/dist/commands/ci/utils/github-api.d.ts.map +0 -1
  304. package/dist/commands/ci/utils/github.d.ts.map +0 -1
  305. package/dist/commands/ci/utils/index.d.ts.map +0 -1
  306. package/dist/commands/ci/utils/pgtap-installer.d.ts.map +0 -1
  307. package/dist/commands/ci/utils/rls-verification.d.ts.map +0 -1
  308. package/dist/commands/ci/utils/schema-operations.d.ts.map +0 -1
  309. package/dist/commands/ci/utils/seed-operations.d.ts.map +0 -1
  310. package/dist/commands/ci/utils/test-parallel.d.ts.map +0 -1
  311. package/dist/commands/ci/utils/timestamp-invariants.d.ts.map +0 -1
  312. package/dist/commands/ci/utils/workflow-idempotency.d.ts.map +0 -1
  313. package/dist/commands/db/apply/actors.d.ts.map +0 -1
  314. package/dist/commands/db/apply/contract.d.ts.map +0 -1
  315. package/dist/commands/db/apply/helpers/advisory-lock.d.ts.map +0 -1
  316. package/dist/commands/db/apply/helpers/data-compatibility-checker.d.ts.map +0 -1
  317. package/dist/commands/db/apply/helpers/index.d.ts.map +0 -1
  318. package/dist/commands/db/apply/helpers/partition-acl-cleaner.d.ts.map +0 -1
  319. package/dist/commands/db/apply/helpers/partition-prefilter.d.ts.map +0 -1
  320. package/dist/commands/db/apply/helpers/partition-validator.d.ts.map +0 -1
  321. package/dist/commands/db/apply/helpers/pg-schema-diff-helpers.d.ts.map +0 -1
  322. package/dist/commands/db/apply/helpers/plan-validator.d.ts.map +0 -1
  323. package/dist/commands/db/apply/helpers/retry-logic.d.ts.map +0 -1
  324. package/dist/commands/db/apply/helpers/shadow-db-manager.d.ts.map +0 -1
  325. package/dist/commands/db/apply/index.d.ts.map +0 -1
  326. package/dist/commands/db/apply/machine.d.ts.map +0 -1
  327. package/dist/commands/db/commands/db-apply.d.ts.map +0 -1
  328. package/dist/commands/db/commands/db-audit.d.ts.map +0 -1
  329. package/dist/commands/db/commands/db-backup.d.ts.map +0 -1
  330. package/dist/commands/db/commands/db-cleanup.d.ts.map +0 -1
  331. package/dist/commands/db/commands/db-derive-role-passwords.d.ts.map +0 -1
  332. package/dist/commands/db/commands/db-derive-urls.d.ts.map +0 -1
  333. package/dist/commands/db/commands/db-diagram.d.ts.map +0 -1
  334. package/dist/commands/db/commands/db-drizzle.d.ts.map +0 -1
  335. package/dist/commands/db/commands/db-extension.d.ts.map +0 -1
  336. package/dist/commands/db/commands/db-generate-password.d.ts.map +0 -1
  337. package/dist/commands/db/commands/db-lifecycle.d.ts.map +0 -1
  338. package/dist/commands/db/commands/db-rollback.d.ts.map +0 -1
  339. package/dist/commands/db/commands/db-schema.d.ts.map +0 -1
  340. package/dist/commands/db/commands/db-seed-metadata.d.ts.map +0 -1
  341. package/dist/commands/db/commands/db-seed-verify.d.ts.map +0 -1
  342. package/dist/commands/db/commands/db-seed.d.ts.map +0 -1
  343. package/dist/commands/db/commands/db-snapshot.d.ts.map +0 -1
  344. package/dist/commands/db/commands/db-stack.d.ts.map +0 -1
  345. package/dist/commands/db/commands/db-stats.d.ts.map +0 -1
  346. package/dist/commands/db/commands/db-sync.d.ts.map +0 -1
  347. package/dist/commands/db/commands/db-test.d.ts.map +0 -1
  348. package/dist/commands/db/constants.d.ts.map +0 -1
  349. package/dist/commands/db/extension-registry.d.ts.map +0 -1
  350. package/dist/commands/db/index.d.ts.map +0 -1
  351. package/dist/commands/db/preflight/actors.d.ts.map +0 -1
  352. package/dist/commands/db/preflight/contract.d.ts.map +0 -1
  353. package/dist/commands/db/preflight/index.d.ts.map +0 -1
  354. package/dist/commands/db/sync/actors.d.ts.map +0 -1
  355. package/dist/commands/db/sync/contract.d.ts.map +0 -1
  356. package/dist/commands/db/sync/index.d.ts.map +0 -1
  357. package/dist/commands/db/sync/machine.d.ts.map +0 -1
  358. package/dist/commands/db/types.d.ts.map +0 -1
  359. package/dist/commands/db/utils/db-target.d.ts.map +0 -1
  360. package/dist/commands/db/utils/db-url-builder.d.ts.map +0 -1
  361. package/dist/commands/db/utils/error-handlers.d.ts.map +0 -1
  362. package/dist/commands/db/utils/import-impact-analyzer.d.ts.map +0 -1
  363. package/dist/commands/db/utils/preflight-check.d.ts.map +0 -1
  364. package/dist/commands/db/utils/psql.d.ts.map +0 -1
  365. package/dist/commands/db/utils/schema-detector.d.ts.map +0 -1
  366. package/dist/commands/db/utils/schema-sync.d.ts.map +0 -1
  367. package/dist/commands/db/utils/script-runner.d.ts.map +0 -1
  368. package/dist/commands/db/utils/seed-manager.d.ts.map +0 -1
  369. package/dist/commands/db/utils/semantic-mapper.d.ts.map +0 -1
  370. package/dist/commands/db/utils/sql-table-extractor.d.ts.map +0 -1
  371. package/dist/commands/db/utils/stack-detector.d.ts.map +0 -1
  372. package/dist/commands/db/utils/table-registry.d.ts.map +0 -1
  373. package/dist/commands/db/utils/table-source-classifier.d.ts.map +0 -1
  374. package/dist/commands/dev/actors/index.d.ts.map +0 -1
  375. package/dist/commands/dev/commands/dev.d.ts.map +0 -1
  376. package/dist/commands/dev/contract.d.ts.map +0 -1
  377. package/dist/commands/dev/guards.d.ts.map +0 -1
  378. package/dist/commands/dev/helpers/stale-process-detector.d.ts.map +0 -1
  379. package/dist/commands/dev/machine.d.ts.map +0 -1
  380. package/dist/commands/dev/types.d.ts.map +0 -1
  381. package/dist/commands/env/commands/env-check.d.ts.map +0 -1
  382. package/dist/commands/env/commands/env-encrypt.d.ts.map +0 -1
  383. package/dist/commands/env/commands/env-pull.d.ts.map +0 -1
  384. package/dist/commands/env/commands/env-setup.d.ts.map +0 -1
  385. package/dist/commands/env/commands/env-sync.d.ts.map +0 -1
  386. package/dist/commands/env/commands/setup/action.d.ts.map +0 -1
  387. package/dist/commands/env/commands/setup/auth.d.ts.map +0 -1
  388. package/dist/commands/env/commands/setup/file-export.d.ts.map +0 -1
  389. package/dist/commands/env/commands/setup/github-api.d.ts.map +0 -1
  390. package/dist/commands/env/commands/setup/helpers.d.ts.map +0 -1
  391. package/dist/commands/env/commands/setup/index.d.ts.map +0 -1
  392. package/dist/commands/env/commands/setup/parsers.d.ts.map +0 -1
  393. package/dist/commands/env/commands/setup/prompts.d.ts.map +0 -1
  394. package/dist/commands/env/commands/setup/supabase-api.d.ts.map +0 -1
  395. package/dist/commands/env/commands/setup/types.d.ts.map +0 -1
  396. package/dist/commands/env/commands/setup/vercel-api.d.ts.map +0 -1
  397. package/dist/commands/env/constants/local-supabase.d.ts.map +0 -1
  398. package/dist/commands/env/index.d.ts.map +0 -1
  399. package/dist/commands/hotfix/actors.d.ts.map +0 -1
  400. package/dist/commands/hotfix/commands/hotfix-complete.d.ts.map +0 -1
  401. package/dist/commands/hotfix/commands/hotfix-create.d.ts.map +0 -1
  402. package/dist/commands/hotfix/commands/hotfix-deploy.d.ts.map +0 -1
  403. package/dist/commands/hotfix/commands/hotfix-status.d.ts.map +0 -1
  404. package/dist/commands/hotfix/contract.d.ts.map +0 -1
  405. package/dist/commands/hotfix/index.d.ts.map +0 -1
  406. package/dist/commands/hotfix/machine.d.ts.map +0 -1
  407. package/dist/commands/hotfix/metadata.d.ts.map +0 -1
  408. package/dist/commands/hotfix/utils/hotfix-machine-helper.d.ts.map +0 -1
  409. package/dist/commands/init.d.ts.map +0 -1
  410. package/dist/commands/inject-test-attrs/action.d.ts.map +0 -1
  411. package/dist/commands/inject-test-attrs/commands/inject-test-attrs.d.ts.map +0 -1
  412. package/dist/commands/inject-test-attrs/contract.d.ts.map +0 -1
  413. package/dist/commands/inject-test-attrs/detection-diagnostics.d.ts.map +0 -1
  414. package/dist/commands/inject-test-attrs/formatter.d.ts.map +0 -1
  415. package/dist/commands/inject-test-attrs/index.d.ts.map +0 -1
  416. package/dist/commands/inject-test-attrs/manifest-generator.d.ts.map +0 -1
  417. package/dist/commands/inject-test-attrs/processor-utils.d.ts.map +0 -1
  418. package/dist/commands/inject-test-attrs/processor.d.ts.map +0 -1
  419. package/dist/commands/inject-test-attrs/types.d.ts.map +0 -1
  420. package/dist/commands/link.d.ts.map +0 -1
  421. package/dist/commands/manifest/index.d.ts.map +0 -1
  422. package/dist/commands/prepare/commands/prepare.d.ts.map +0 -1
  423. package/dist/commands/prepare/index.d.ts.map +0 -1
  424. package/dist/commands/sdk/commands/publish.d.ts.map +0 -1
  425. package/dist/commands/sdk/index.d.ts.map +0 -1
  426. package/dist/commands/services/index.d.ts.map +0 -1
  427. package/dist/commands/session/index.d.ts.map +0 -1
  428. package/dist/commands/status.d.ts.map +0 -1
  429. package/dist/commands/telemetry.d.ts.map +0 -1
  430. package/dist/commands/template-check/actors/compare.d.ts.map +0 -1
  431. package/dist/commands/template-check/actors/discover.d.ts.map +0 -1
  432. package/dist/commands/template-check/actors/index.d.ts.map +0 -1
  433. package/dist/commands/template-check/actors/report.d.ts.map +0 -1
  434. package/dist/commands/template-check/commands/template-check.d.ts.map +0 -1
  435. package/dist/commands/template-check/config.d.ts.map +0 -1
  436. package/dist/commands/template-check/contract.d.ts.map +0 -1
  437. package/dist/commands/template-check/index.d.ts.map +0 -1
  438. package/dist/commands/template-check/machine.d.ts.map +0 -1
  439. package/dist/commands/template-check/types.d.ts.map +0 -1
  440. package/dist/commands/template-check/utils/diff-analyzer.d.ts.map +0 -1
  441. package/dist/commands/template-check/utils/normalizer.d.ts.map +0 -1
  442. package/dist/commands/template-check/utils/path-mapping.d.ts.map +0 -1
  443. package/dist/commands/test/commands/test-db.d.ts.map +0 -1
  444. package/dist/commands/test/commands/test-e2e.d.ts.map +0 -1
  445. package/dist/commands/test/commands/test-fast.d.ts.map +0 -1
  446. package/dist/commands/test/commands/test-integration.d.ts.map +0 -1
  447. package/dist/commands/test/commands/test-layer.d.ts.map +0 -1
  448. package/dist/commands/test/commands/test-owasp-generate.d.ts.map +0 -1
  449. package/dist/commands/test/commands/test-service.d.ts.map +0 -1
  450. package/dist/commands/test/commands/test-static.d.ts.map +0 -1
  451. package/dist/commands/test/commands/test.d.ts.map +0 -1
  452. package/dist/commands/test/index.d.ts.map +0 -1
  453. package/dist/commands/test-gen.d.ts.map +0 -1
  454. package/dist/commands/ui.d.ts.map +0 -1
  455. package/dist/commands/upgrade.d.ts.map +0 -1
  456. package/dist/commands/validate.d.ts.map +0 -1
  457. package/dist/commands/vuln-check.d.ts.map +0 -1
  458. package/dist/commands/watch.d.ts.map +0 -1
  459. package/dist/commands/workflow/commands/deploy-production.d.ts.map +0 -1
  460. package/dist/commands/workflow/commands/final-status.d.ts.map +0 -1
  461. package/dist/commands/workflow/commands/log.d.ts.map +0 -1
  462. package/dist/commands/workflow/commands/notify.d.ts.map +0 -1
  463. package/dist/commands/workflow/commands/paths.d.ts.map +0 -1
  464. package/dist/commands/workflow/commands/sync.d.ts.map +0 -1
  465. package/dist/commands/workflow/commands/validate.d.ts.map +0 -1
  466. package/dist/commands/workflow/commands/verify-credentials.d.ts.map +0 -1
  467. package/dist/commands/workflow/index.d.ts.map +0 -1
  468. package/dist/commands/workflow/types.d.ts.map +0 -1
  469. package/dist/config/env-files.d.ts.map +0 -1
  470. package/dist/config/env.d.ts.map +0 -1
  471. package/dist/constants/versions.d.ts.map +0 -1
  472. package/dist/contracts/envelope.d.ts.map +0 -1
  473. package/dist/errors/catalog.d.ts.map +0 -1
  474. package/dist/errors/exit-codes.d.ts.map +0 -1
  475. package/dist/errors/index.d.ts.map +0 -1
  476. package/dist/incremental/affected-tests.d.ts.map +0 -1
  477. package/dist/index.d.ts.map +0 -1
  478. package/dist/internal/machines/index.d.ts.map +0 -1
  479. package/dist/internal/machines/machine-runner.d.ts.map +0 -1
  480. package/dist/internal/machines/snapshot-helpers.d.ts.map +0 -1
  481. package/dist/internal/machines/types.d.ts.map +0 -1
  482. package/dist/internal/vuln-checker/analyzers/dependency-analyzer.d.ts.map +0 -1
  483. package/dist/internal/vuln-checker/analyzers/rls-analyzer.d.ts.map +0 -1
  484. package/dist/internal/vuln-checker/analyzers/secret-analyzer.d.ts.map +0 -1
  485. package/dist/internal/vuln-checker/analyzers/typescript-analyzer.d.ts.map +0 -1
  486. package/dist/internal/vuln-checker/config/loader.d.ts.map +0 -1
  487. package/dist/internal/vuln-checker/constants.d.ts.map +0 -1
  488. package/dist/internal/vuln-checker/ignore/matcher.d.ts.map +0 -1
  489. package/dist/internal/vuln-checker/index.d.ts.map +0 -1
  490. package/dist/internal/vuln-checker/reporters/console-reporter.d.ts.map +0 -1
  491. package/dist/internal/vuln-checker/reporters/json-reporter.d.ts.map +0 -1
  492. package/dist/internal/vuln-checker/reporters/markdown-reporter.d.ts.map +0 -1
  493. package/dist/internal/vuln-checker/reporters/sarif-reporter.d.ts.map +0 -1
  494. package/dist/internal/vuln-checker/security/path-validation.d.ts.map +0 -1
  495. package/dist/internal/vuln-checker/types.d.ts.map +0 -1
  496. package/dist/notifiers/desktop-notifier.d.ts.map +0 -1
  497. package/dist/ui/components/db-panel.d.ts.map +0 -1
  498. package/dist/ui/components/status-bar.d.ts.map +0 -1
  499. package/dist/ui/components/test-panel.d.ts.map +0 -1
  500. package/dist/ui/dashboard.d.ts.map +0 -1
  501. package/dist/ui/index.d.ts.map +0 -1
  502. package/dist/utils/config-loader.d.ts.map +0 -1
  503. package/dist/utils/config-updater.d.ts.map +0 -1
  504. package/dist/utils/diagnostics.d.ts.map +0 -1
  505. package/dist/utils/dotenvx.d.ts.map +0 -1
  506. package/dist/utils/env-local-bridge.d.ts.map +0 -1
  507. package/dist/utils/execution-plan.d.ts.map +0 -1
  508. package/dist/utils/github-output-security.d.ts.map +0 -1
  509. package/dist/utils/help-system.d.ts.map +0 -1
  510. package/dist/utils/license/admin-auth.d.ts.map +0 -1
  511. package/dist/utils/license/allowlist-checker.d.ts.map +0 -1
  512. package/dist/utils/license/ci-detector.d.ts.map +0 -1
  513. package/dist/utils/license/index.d.ts.map +0 -1
  514. package/dist/utils/license/owner-resolver.d.ts.map +0 -1
  515. package/dist/utils/license/types.d.ts.map +0 -1
  516. package/dist/utils/license/validate-owner.d.ts.map +0 -1
  517. package/dist/utils/path-security.d.ts.map +0 -1
  518. package/dist/utils/port-allocator.d.ts.map +0 -1
  519. package/dist/utils/secure-exec.d.ts.map +0 -1
  520. package/dist/utils/template-fetcher.d.ts.map +0 -1
  521. package/dist/utils/type-guards.d.ts.map +0 -1
  522. package/dist/utils/vercel-project.d.ts.map +0 -1
  523. package/dist/utils/workspace-detector.d.ts.map +0 -1
  524. package/dist/validators/risk-detector.d.ts.map +0 -1
  525. package/dist/validators/schema-validator.d.ts.map +0 -1
  526. package/dist/version.d.ts.map +0 -1
  527. package/dist/watchers/schema-watcher.d.ts.map +0 -1
  528. package/dist/watchers/test-watcher.d.ts.map +0 -1
@@ -0,0 +1,1944 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire } from 'module';
3
+ import { getErrorMessage } from './chunk-IBVVGH6X.js';
4
+ import { findRepoRoot } from './chunk-3WDV32GA.js';
5
+ import { createMachineStateChangeLogger } from './chunk-5FT3F36G.js';
6
+ import { getOutputFormatFromEnv } from './chunk-HKUWEGUX.js';
7
+ import { __export, __esm, init_esm_shims, __require, __toCommonJS } from './chunk-VRXHCR5K.js';
8
+ import { createCLILogger, CLIError } from '@runa-ai/runa';
9
+ import { Command } from 'commander';
10
+ import { fromPromise, setup, assign, createActor } from 'xstate';
11
+ import * as fs2 from 'fs';
12
+ import * as path2 from 'path';
13
+
14
+ createRequire(import.meta.url);
15
+
16
+ // src/commands/template-check/types.ts
17
+ var types_exports = {};
18
+ __export(types_exports, {
19
+ calculateSummary: () => calculateSummary,
20
+ createInitialContext: () => createInitialContext,
21
+ createOutput: () => createOutput
22
+ });
23
+ function createInitialContext(input, repoRoot) {
24
+ return {
25
+ input,
26
+ repoRoot,
27
+ templateDir: `${repoRoot}/packages/runa-templates/templates`,
28
+ inventory: null,
29
+ results: [],
30
+ startTime: Date.now(),
31
+ error: null
32
+ };
33
+ }
34
+ function calculateSummary(results) {
35
+ const total = results.length;
36
+ const identical = results.filter(
37
+ (r) => r.status === "identical" || r.status === "renamed" || r.status === "intentionally-different"
38
+ ).length;
39
+ const diff = results.filter((r) => r.status === "diff").length;
40
+ const runaOnly = results.filter((r) => r.status === "runa-only").length;
41
+ const templateOnly = results.filter((r) => r.status === "template-only").length;
42
+ const expectedOnly = results.filter(
43
+ (r) => r.status === "expected-runa-only" || r.status === "expected-template-only"
44
+ ).length;
45
+ return {
46
+ total,
47
+ identical,
48
+ diff,
49
+ runaOnly,
50
+ templateOnly,
51
+ expectedOnly,
52
+ identicalPercent: total > 0 ? Math.round(identical / total * 1e3) / 10 : 100
53
+ };
54
+ }
55
+ function createOutput(context) {
56
+ const durationMs = Date.now() - context.startTime;
57
+ const summary = calculateSummary(context.results);
58
+ const hasUnexpectedDiffs = summary.diff > 0 || summary.runaOnly > 0 || summary.templateOnly > 0;
59
+ return {
60
+ success: !context.error && !hasUnexpectedDiffs,
61
+ exitCode: context.error ? 2 : hasUnexpectedDiffs ? 1 : 0,
62
+ results: context.results,
63
+ summary,
64
+ error: context.error ?? void 0,
65
+ durationMs
66
+ };
67
+ }
68
+ var init_types = __esm({
69
+ "src/commands/template-check/types.ts"() {
70
+ init_esm_shims();
71
+ }
72
+ });
73
+
74
+ // src/commands/template-check/index.ts
75
+ init_esm_shims();
76
+
77
+ // src/commands/template-check/commands/template-check.ts
78
+ init_esm_shims();
79
+
80
+ // src/commands/template-check/machine.ts
81
+ init_esm_shims();
82
+
83
+ // src/commands/template-check/actors/index.ts
84
+ init_esm_shims();
85
+
86
+ // src/commands/template-check/actors/compare.ts
87
+ init_esm_shims();
88
+
89
+ // src/commands/template-check/utils/diff-analyzer.ts
90
+ init_esm_shims();
91
+
92
+ // src/commands/template-check/utils/normalizer.ts
93
+ init_esm_shims();
94
+
95
+ // src/commands/template-check/config.ts
96
+ init_esm_shims();
97
+ var CODE_EXTENSIONS = [".ts", ".tsx", ".yml", ".yaml"];
98
+ var RUNA_ONLY_FILES = [
99
+ // === Root Config ===
100
+ "runa.config.ts",
101
+ // runa-repo dogfooding config
102
+ // === Documentation ===
103
+ ".claude/rules/dogfooding.md",
104
+ // SDK development philosophy
105
+ // === runa-repo Domain Schemas (runa-specific business logic) ===
106
+ "supabase/schemas/declarative/10_accounts.sql",
107
+ "supabase/schemas/declarative/20_repos.sql",
108
+ "supabase/schemas/declarative/30_pipelines.sql",
109
+ "supabase/schemas/declarative/40_projects.sql",
110
+ "supabase/schemas/declarative/80_analytics.sql",
111
+ "supabase/schemas/declarative/90_test_execution.sql",
112
+ "supabase/schemas/idempotent/20_security_hardening.sql",
113
+ // === runa-repo Workflows (SDK release & internal) ===
114
+ ".github/workflows/auto-changeset.yml",
115
+ ".github/workflows/changesets.yml",
116
+ ".github/workflows/license-check.yml",
117
+ // SDK license compatibility check
118
+ ".github/workflows/package-test.yml",
119
+ ".github/workflows/publish-packages.yml",
120
+ ".github/workflows/publish-templates.yml",
121
+ ".github/workflows/publish-github-packages.yml",
122
+ // SDK package publishing
123
+ ".github/workflows/publish-npmjs.yml",
124
+ // SDK package publishing (npmjs)
125
+ ".github/workflows/runa-templates.yml",
126
+ // Template validation (pj-repos don't have templates)
127
+ // === runa-repo Specific Scripts ===
128
+ "packages/database/scripts/db-sync-partition.ts",
129
+ // Partition defense (TODO: add to template)
130
+ "packages/database/scripts/db-sync-partition.test.ts",
131
+ // Partition defense tests
132
+ "packages/database/scripts/check-plpgsql.ts",
133
+ "packages/database/scripts/db-sync-apply-steps.test.ts",
134
+ "packages/database/scripts/db-sync-codegen-runtime.test.ts",
135
+ "packages/database/scripts/db-sync-db-state.test.ts",
136
+ "packages/database/scripts/db-sync-local-url.test.ts",
137
+ "packages/database/scripts/db-sync-pg-schema-diff.test.ts",
138
+ "packages/database/scripts/db-sync-schema-discovery.test.ts",
139
+ "packages/database/scripts/db-sync-schema-sort.ts",
140
+ "packages/database/scripts/db-sync-seeds-runtime.test.ts",
141
+ "packages/database/scripts/seed-writer.test.ts",
142
+ "packages/database/scripts/run-splinter.ts",
143
+ "packages/database/scripts/seed-generators/index.ts",
144
+ "packages/database/scripts/seed-generators/loader.ts",
145
+ "packages/database/scripts/seed-generators/types.ts",
146
+ "packages/database/scripts/seed-plugins/supabase-auth.ts",
147
+ "packages/database/scripts/seed-data-sources/api-source.ts",
148
+ "packages/database/scripts/seed-data-sources/csv-source.ts",
149
+ "packages/database/scripts/seed-data-sources/index.ts",
150
+ "packages/database/scripts/seed-data-sources/json-source.ts",
151
+ "packages/database/scripts/seed-data-sources/types.ts",
152
+ "packages/database/scripts/seed-hooks/index.ts",
153
+ "packages/database/scripts/seed-hooks/types.ts",
154
+ "packages/database/scripts/seed-utils/index.ts",
155
+ "packages/database/scripts/seed-utils/security.ts",
156
+ // === runa-repo Specific Tests ===
157
+ "packages/database/tests/00_system-schemas.sql",
158
+ "packages/database/tests/01_table-helpers.sql",
159
+ "packages/database/tests/02_constraint-helpers.sql",
160
+ "packages/database/tests/03_rls-helpers.sql",
161
+ "packages/database/tests/04_behavior-tests.sql",
162
+ "packages/database/tests/05_supabase-compat.sql",
163
+ "packages/database/tests/10_behavior_tests.sql",
164
+ "supabase/tests/00_system-schemas.sql",
165
+ "supabase/tests/01_table-helpers.sql",
166
+ "supabase/tests/02_constraint-helpers.sql",
167
+ "supabase/tests/03_rls-helpers.sql",
168
+ "supabase/tests/04_behavior-tests.sql",
169
+ "supabase/tests/05_supabase-compat.sql",
170
+ // === runa-repo Vitest Configs ===
171
+ "config/vitest/vitest.config.cli.ts",
172
+ "config/vitest/vitest.config.e2e.ts",
173
+ "config/vitest/vitest.config.runa.ts",
174
+ "config/vitest/layer3-global-setup.ts",
175
+ // === runa-repo Database Extension Types ===
176
+ // Note: schema.ts, relations.ts, entities.ts moved to INTENTIONALLY_DIFFERENT_FILES
177
+ // (templates have stub versions, runa-repo has actual generated code)
178
+ "packages/database/src/types/extensions/index.ts",
179
+ "packages/database/src/types/extensions/pgvector.ts",
180
+ "packages/database/src/types/extensions/postgis.ts"
181
+ ];
182
+ var TEMPLATE_ONLY_FILES = [
183
+ // === Documentation & Setup ===
184
+ ".claude/rules/sdk/setup.md",
185
+ // pj-repo setup guide
186
+ ".claude/rules/local/README.md",
187
+ // Local rules customization guide
188
+ ".claude/commands/local/README.md",
189
+ // Local commands guide
190
+ ".claude/skills/local/README.md",
191
+ // Local skills guide
192
+ // === pj-repo Starter Files ===
193
+ ".env.example",
194
+ // Environment template
195
+ ".runa/ci.config.json",
196
+ // CI configuration
197
+ "scripts/load-env.ts",
198
+ // Environment loader
199
+ "global-setup.ts",
200
+ // Root global setup (runa-repo uses config/playwright/global-setup.ts)
201
+ // === apps/web/ (pj-repo starter app) ===
202
+ // Note: runa-repo uses apps/dashboard/, templates provide apps/web/ starter
203
+ "apps/web/package.json",
204
+ "apps/web/tsconfig.json",
205
+ "apps/web/next.config.ts",
206
+ "apps/web/proxy.ts",
207
+ // Next.js 16+ proxy (replaces middleware.ts)
208
+ "apps/web/app/layout.tsx",
209
+ "apps/web/app/page.tsx",
210
+ "apps/web/app/(protected)/layout.tsx",
211
+ // Auth guard layout
212
+ "apps/web/app/(protected)/dashboard/page.tsx",
213
+ // Protected dashboard
214
+ "apps/web/app/(public)/login/page.tsx",
215
+ // Public login page
216
+ "apps/web/app/auth/callback/route.ts",
217
+ // OAuth callback handler
218
+ "apps/web/lib/supabase/index.ts",
219
+ // Supabase client exports
220
+ "apps/web/lib/supabase/client.ts",
221
+ // Browser client
222
+ "apps/web/lib/supabase/server.ts",
223
+ // Server client
224
+ "apps/web/lib/supabase/env.ts",
225
+ // Environment resolution
226
+ // === packages/api-client (pj-repo starter) ===
227
+ "packages/api-client/package.json",
228
+ "packages/api-client/tsconfig.json",
229
+ "packages/api-client/index.ts",
230
+ "packages/api-client/mutations/example.ts",
231
+ "packages/api-client/queries/example.ts",
232
+ "packages/api-client/tests/queries.test.tsx",
233
+ // === Optional Database Extensions ===
234
+ "packages/database/extensions/pgvector.sql",
235
+ "packages/database/extensions/postgis.sql",
236
+ // === pj-repo Universal Tests ===
237
+ "packages/database/tests/10_universal_constraints.test.sql",
238
+ "packages/database/tests/40_universal_security_rls.test.sql",
239
+ "packages/database/tests/50_universal_data_integrity.test.sql",
240
+ "packages/database/tests/90_behavior_patterns.test.sql",
241
+ "packages/database/scripts/run-pgtap-tests.ts",
242
+ // === pj-repo Seed Helpers ===
243
+ "supabase/migrations/00000000000000_extensions.sql",
244
+ "supabase/seeds/data/00_auth_users.sql",
245
+ "supabase/seeds/helpers/00_seed_helpers.sql",
246
+ "supabase/seeds/helpers/99_sequences.sql",
247
+ // Note: local.sql, preview.sql, production.sql are NOT allowed (ci.sql only)
248
+ "supabase/tests/00_test-helpers.sql"
249
+ ];
250
+ var PLACEHOLDER_PATTERNS = {
251
+ // === Package & Import References ===
252
+ // Package references: @runa-ai/runa, @runa-ai/runa-cli, etc.
253
+ PACKAGE_REF: {
254
+ pattern: /@runa-ai\/runa(-\w+)?/g,
255
+ replacement: "{{PACKAGE_REF}}"
256
+ },
257
+ // Internal SDK paths (runa-repo uses direct paths, pj-repo uses package imports)
258
+ // Example: ../../packages/sdk/src/test/runtime/config/runa-config.js
259
+ INTERNAL_SDK_PATH: {
260
+ pattern: /['"]\.\.\/+packages\/sdk\/src\/[^'"]+['"]/g,
261
+ replacement: "'{{SDK_IMPORT}}'"
262
+ },
263
+ // Path aliases: @/database, @/machines, etc.
264
+ PATH_ALIAS: {
265
+ pattern: /@\/(\w+)/g,
266
+ replacement: "{{PATH_ALIAS}}/$1"
267
+ },
268
+ // === Schema & Database References ===
269
+ // Schema.table references
270
+ SCHEMA_TABLE: {
271
+ pattern: /\b(accounts|repos|pipelines|identity|products|orders)\.(clients|repositories|webhooks|users|tenants|items|purchases)\b/g,
272
+ replacement: "{{SCHEMA}}.{{TABLE}}"
273
+ },
274
+ // Drizzle table names
275
+ DRIZZLE_TABLE: {
276
+ pattern: /\b(clients|repositories|webhooks|users|tenants|items)In(Accounts|Repos|Pipelines|Identity|Products|Orders)\b/g,
277
+ replacement: "{{DRIZZLE_TABLE}}"
278
+ },
279
+ // Scope column names
280
+ SCOPE_COLUMN: {
281
+ pattern: /\b(client_id|tenant_id|scope_id|org_id|organization_id|workspace_id)\b/g,
282
+ replacement: "{{SCOPE_COLUMN}}"
283
+ },
284
+ // === Comment Differences ===
285
+ // Workspace type: "runa workspace" vs "pj-repo workspace"
286
+ WORKSPACE_TYPE: {
287
+ pattern: /\b(runa|pj-repo|the)\s+workspace\b/gi,
288
+ replacement: "{{REPO_TYPE}} workspace"
289
+ },
290
+ // Config purpose: Dogfooding vs Generated
291
+ CONFIG_PURPOSE: {
292
+ pattern: /\(Dogfooding\)|\(Generated by:.*?\)/g,
293
+ replacement: "({{CONFIG_TYPE}})"
294
+ },
295
+ // File path comments (normalize path styles)
296
+ // e.g., "config/vitest/env" vs "./config/vitest/env"
297
+ RELATIVE_PATH_PREFIX: {
298
+ pattern: /(?:path\.resolve\(__dirname,\s*)?['"]\.\/([^'"]+)['"]\)?|['"]([^'"]+)['"]/g,
299
+ replacement: "'{{PATH}}'"
300
+ },
301
+ // === Metadata ===
302
+ // Version numbers
303
+ VERSION: {
304
+ pattern: /Version:\s*[\d.]+/gi,
305
+ replacement: "Version: {{VERSION}}"
306
+ },
307
+ // Timestamps in docs
308
+ DATE: {
309
+ pattern: /\*\*(Created|Updated)\*\*:\s*\d{4}-\d{2}-\d{2}/g,
310
+ replacement: "**$1**: {{DATE}}"
311
+ }
312
+ };
313
+ var INTENTIONALLY_DIFFERENT_FILES = [
314
+ // === Config Files ===
315
+ "pnpm-workspace.yaml",
316
+ // runa-repo has "admin" workspace (internal)
317
+ "runa.config.ts",
318
+ // Dogfooding vs Generated comments
319
+ "vitest.config.ts",
320
+ // Internal paths vs package imports
321
+ "vitest.global-setup.ts",
322
+ // Vercel pull vs generic setup
323
+ "playwright.config.ts",
324
+ // Internal paths + ESM/CJS fallback in template
325
+ "config/vitest/layer3-global-setup.ts",
326
+ // Dogfooding layer 3 setup differs
327
+ "config/vitest/vitest.config.layer1.ts",
328
+ // Dogfooding layer 1 test patterns differ
329
+ "config/vitest/vitest.config.layer3.ts",
330
+ // Internal SDK path vs package import
331
+ // === Workflow Files ===
332
+ // runa-repo uses hardcoded organization URLs, templates use secrets
333
+ ".github/workflows/runa.yml",
334
+ // r06-corp/runa vs ${{ secrets.* }}
335
+ ".github/workflows/deploy-db.yml",
336
+ // github-token parameter differences
337
+ // === GitHub Actions ===
338
+ ".github/actions/setup-playwright-deps/action.yml",
339
+ // Comment: "runa-repo and pj-repos" vs "pj-repos"
340
+ ".github/actions/setup-node-pnpm/action.yml",
341
+ // Comment: SSOT note vs DRY principle
342
+ ".github/actions/setup-runa-cli/action.yml",
343
+ // Comment: Zero-PAT description differences
344
+ // === Database Auto-Generated vs Stub Files ===
345
+ // runa-repo has actual drizzle-kit generated code, templates have stub files
346
+ // Stub files are placeholders that get replaced by `runa db sync`
347
+ "packages/database/src/schema/schema.ts",
348
+ // Generated vs stub
349
+ "packages/database/src/schema/relations.ts",
350
+ // Generated vs stub
351
+ "packages/database/src/types/entities.ts",
352
+ // Generated vs stub
353
+ "packages/database/scripts/db-sync.ts",
354
+ // Template has formatGeneratedCode(), runa-repo doesn't
355
+ // === Database Scripts ===
356
+ // runa-repo has domain-specific tables (accounts.clients, repos.repositories, etc.)
357
+ // while templates use generic examples
358
+ "packages/database/drizzle.config.ts",
359
+ // Different schema paths
360
+ "packages/database/src/index.ts",
361
+ // Different schema exports
362
+ "packages/database/src/schema/index.ts",
363
+ // Different table exports
364
+ "packages/database/scripts/db-sync-codegen-runtime.ts",
365
+ // Dogfooding codegen runtime differs
366
+ "packages/database/scripts/db-sync-codegen.ts",
367
+ // PostGIS cleanup differs
368
+ "packages/database/scripts/db-sync-local-url.ts",
369
+ // Local DB discovery differs
370
+ "packages/database/scripts/db-sync-pg-schema-diff.ts",
371
+ // Direct apply helpers differ
372
+ "packages/database/scripts/db-sync-schema-discovery.ts",
373
+ // Schema cache behavior differs
374
+ "packages/database/scripts/db-sync-seeds-runtime.ts",
375
+ // Seed runtime orchestration differs
376
+ "packages/database/scripts/generate-seeds.ts",
377
+ // runa-specific seed logic
378
+ "packages/database/scripts/validate-schema-consistency.ts",
379
+ // runa-specific validation
380
+ "packages/database/scripts/seed-requirements.ts",
381
+ // runa-specific seed requirements
382
+ "packages/database/scripts/seed-semantic-rules.ts",
383
+ // runa-specific semantic rules
384
+ "packages/database/scripts/seed-writer.ts",
385
+ // runa-specific seed writer
386
+ "packages/database/scripts/seed-media/index.ts",
387
+ // runa-specific media seeds
388
+ "packages/database/scripts/seed-engines/auto-seed-generator.ts",
389
+ // Dogfooding seed generation differs
390
+ "packages/database/scripts/seed-engines/auto-seed-generator.test.ts",
391
+ // runa-specific tests
392
+ "packages/database/scripts/seed-engines/constants.test.ts",
393
+ // runa-specific tests
394
+ "packages/database/scripts/seed-engines/db-schema-analyzer.ts",
395
+ // Re-export order differences
396
+ "packages/database/scripts/seed-engines/generators/locale.ts",
397
+ // Import style differences
398
+ "packages/database/scripts/seed-utils.ts",
399
+ // Dogfooding seed utils differ
400
+ "packages/database/scripts/setup-db-roles.ts",
401
+ // Role setup variations
402
+ "packages/database/src/zod/index.ts",
403
+ // Auto-generated, schema-specific exports
404
+ // === Skills/Prompts ===
405
+ // Minor wording differences in CLI vs SDK references
406
+ "docs/prompts/AUDIT-GEN.yml",
407
+ // "Official CLI + runa" vs "Official CLI priority"
408
+ "docs/prompts/SPEC-PATTERNS.yml",
409
+ // Spec pattern differences
410
+ ".claude/skills/audit/templates/AUDIT-GEN.yml",
411
+ // Same as above
412
+ // === apps/api vs packages/api path differences ===
413
+ // runa-repo uses apps/api (internal), templates use packages/api (standard pj-repo pattern)
414
+ "docs/prompts/REFACTOR-GEN.yml",
415
+ // apps/api vs packages/api
416
+ "docs/prompts/REFACTOR-PATTERNS.yml",
417
+ // apps/api vs packages/api
418
+ "docs/prompts/SPEC-TEMPLATE-PRD.yml",
419
+ // apps/api vs packages/api
420
+ "docs/prompts/SPEC-TEMPLATE-MACHINE.yml",
421
+ // apps/api vs packages/api
422
+ ".claude/skills/refactor/templates/REFACTOR-GEN.yml",
423
+ // apps/api vs packages/api
424
+ ".claude/skills/refactor/templates/REFACTOR-PATTERNS.yml",
425
+ // apps/api vs packages/api
426
+ ".claude/skills/spec/templates/RESEARCH-CHECKLIST.yml"
427
+ // apps/api vs packages/api
428
+ ];
429
+
430
+ // src/commands/template-check/utils/normalizer.ts
431
+ function normalizeContent(content) {
432
+ let normalized = content;
433
+ for (const [_key, { pattern, replacement }] of Object.entries(PLACEHOLDER_PATTERNS)) {
434
+ normalized = normalized.replace(pattern, replacement);
435
+ }
436
+ normalized = normalized.replace(/[ \t]+$/gm, "");
437
+ normalized = normalized.replace(/\n{3,}/g, "\n\n");
438
+ if (!normalized.endsWith("\n")) {
439
+ normalized += "\n";
440
+ }
441
+ return normalized;
442
+ }
443
+ function isExpectedRunaOnly(runaPath) {
444
+ return RUNA_ONLY_FILES.includes(runaPath);
445
+ }
446
+ function isExpectedTemplateOnly(templatePath) {
447
+ return TEMPLATE_ONLY_FILES.includes(templatePath);
448
+ }
449
+ function isIntentionallyDifferent(filePath) {
450
+ return INTENTIONALLY_DIFFERENT_FILES.includes(filePath);
451
+ }
452
+ function isCodeFile(filePath) {
453
+ const ext = filePath.slice(filePath.lastIndexOf("."));
454
+ return CODE_EXTENSIONS.includes(ext);
455
+ }
456
+ function countLines(content) {
457
+ return content.split("\n").length;
458
+ }
459
+
460
+ // src/commands/template-check/utils/diff-analyzer.ts
461
+ function compareFiles(runaContent, templateContent) {
462
+ const normalizedRuna = normalizeContent(runaContent);
463
+ const normalizedTemplate = normalizeContent(templateContent);
464
+ if (normalizedRuna === normalizedTemplate) {
465
+ return {
466
+ identical: true,
467
+ ahead: "equal",
468
+ lineDiff: "\xB10",
469
+ addedLines: 0,
470
+ removedLines: 0
471
+ };
472
+ }
473
+ const runaLines = countLines(normalizedRuna);
474
+ const templateLines = countLines(normalizedTemplate);
475
+ const lineDiff = runaLines - templateLines;
476
+ const ahead = determineAhead(normalizedRuna, normalizedTemplate, runaLines, templateLines);
477
+ return {
478
+ identical: false,
479
+ ahead,
480
+ lineDiff: formatLineDiff(lineDiff),
481
+ addedLines: Math.max(0, lineDiff),
482
+ removedLines: Math.max(0, -lineDiff)
483
+ };
484
+ }
485
+ function determineAhead(runaContent, templateContent, runaLines, templateLines) {
486
+ const runaVersion = extractVersion(runaContent);
487
+ const templateVersion = extractVersion(templateContent);
488
+ if (runaVersion && templateVersion && runaVersion !== templateVersion) {
489
+ return runaVersion > templateVersion ? "runa" : "template";
490
+ }
491
+ const lineDiff = Math.abs(runaLines - templateLines);
492
+ if (lineDiff > 10) {
493
+ return runaLines > templateLines ? "runa" : "template";
494
+ }
495
+ const runaDate = extractUpdateDate(runaContent);
496
+ const templateDate = extractUpdateDate(templateContent);
497
+ if (runaDate && templateDate && runaDate !== templateDate) {
498
+ return runaDate > templateDate ? "runa" : "template";
499
+ }
500
+ return "diverged";
501
+ }
502
+ function buildDiffHunkMeta(change, contextSize, runaLineCount) {
503
+ const contextStart = Math.max(0, change.currentStart - contextSize);
504
+ const hasContextBefore = contextStart < change.currentStart;
505
+ const runaStart = hasContextBefore ? contextStart : change.currentStart;
506
+ const runaCount = change.currentEnd - runaStart + contextSize;
507
+ const templateCount = change.templateEnd - change.templateStart + (hasContextBefore ? contextSize : 0);
508
+ return {
509
+ header: `@@ -${runaStart + 1},${runaCount} +${change.templateStart + 1},${templateCount} @@`,
510
+ contextStart,
511
+ contextEnd: Math.min(runaLineCount, change.currentEnd + contextSize)
512
+ };
513
+ }
514
+ function appendPrefixedLines(diffLines, sourceLines, start, end, prefix, totalLines, maxLines) {
515
+ for (let index = start; index < end && totalLines < maxLines; index++) {
516
+ diffLines.push(`${prefix}${sourceLines[index] ?? ""}`);
517
+ totalLines++;
518
+ }
519
+ return totalLines;
520
+ }
521
+ function generateUnifiedDiff(runaContent, templateContent, options = {}) {
522
+ const maxLines = options.maxLines ?? 50;
523
+ const runaLabel = options.runaLabel ?? "runa";
524
+ const templateLabel = options.templateLabel ?? "template";
525
+ const runaLines = runaContent.split("\n");
526
+ const templateLines = templateContent.split("\n");
527
+ const contextSize = 2;
528
+ const changes = findDiffChanges(runaLines, templateLines);
529
+ if (changes.length === 0) return "";
530
+ const diffLines = [`--- ${runaLabel}`, `+++ ${templateLabel}`];
531
+ let totalLines = 0;
532
+ for (let idx = 0; idx < changes.length; idx++) {
533
+ if (totalLines >= maxLines) {
534
+ diffLines.push(`... (${changes.length - idx} more change(s) truncated)`);
535
+ break;
536
+ }
537
+ const change = changes[idx];
538
+ const hunkMeta = buildDiffHunkMeta(change, contextSize, runaLines.length);
539
+ diffLines.push(hunkMeta.header);
540
+ totalLines = appendPrefixedLines(
541
+ diffLines,
542
+ runaLines,
543
+ hunkMeta.contextStart,
544
+ change.currentStart,
545
+ " ",
546
+ totalLines,
547
+ maxLines
548
+ );
549
+ totalLines = appendPrefixedLines(
550
+ diffLines,
551
+ runaLines,
552
+ change.currentStart,
553
+ change.currentEnd,
554
+ "-",
555
+ totalLines,
556
+ maxLines
557
+ );
558
+ totalLines = appendPrefixedLines(
559
+ diffLines,
560
+ templateLines,
561
+ change.templateStart,
562
+ change.templateEnd,
563
+ "+",
564
+ totalLines,
565
+ maxLines
566
+ );
567
+ totalLines = appendPrefixedLines(
568
+ diffLines,
569
+ runaLines,
570
+ change.currentEnd,
571
+ hunkMeta.contextEnd,
572
+ " ",
573
+ totalLines,
574
+ maxLines
575
+ );
576
+ }
577
+ return diffLines.join("\n");
578
+ }
579
+ function findDiffChanges(currentLines, templateLines) {
580
+ const changes = [];
581
+ let i = 0;
582
+ let j = 0;
583
+ while (i < currentLines.length || j < templateLines.length) {
584
+ if (i < currentLines.length && j < templateLines.length && currentLines[i] === templateLines[j]) {
585
+ i++;
586
+ j++;
587
+ continue;
588
+ }
589
+ const changeStart = { current: i, template: j };
590
+ while (i < currentLines.length && j < templateLines.length && currentLines[i] !== templateLines[j]) {
591
+ const sync = tryResync(currentLines, templateLines, i, j);
592
+ i += sync.iOffset;
593
+ j += sync.jOffset;
594
+ }
595
+ if (i >= currentLines.length && j < templateLines.length) {
596
+ j = templateLines.length;
597
+ } else if (j >= templateLines.length && i < currentLines.length) {
598
+ i = currentLines.length;
599
+ }
600
+ changes.push({
601
+ currentStart: changeStart.current,
602
+ currentEnd: i,
603
+ templateStart: changeStart.template,
604
+ templateEnd: j
605
+ });
606
+ }
607
+ return changes;
608
+ }
609
+ function tryResync(currentLines, templateLines, i, j) {
610
+ const maxLookahead = 5;
611
+ for (let lookahead = 1; lookahead <= maxLookahead && i + lookahead < currentLines.length; lookahead++) {
612
+ if (currentLines[i + lookahead] === templateLines[j]) {
613
+ return { found: true, iOffset: lookahead, jOffset: 0 };
614
+ }
615
+ }
616
+ for (let lookahead = 1; lookahead <= maxLookahead && j + lookahead < templateLines.length; lookahead++) {
617
+ if (currentLines[i] === templateLines[j + lookahead]) {
618
+ return { found: true, iOffset: 0, jOffset: lookahead };
619
+ }
620
+ }
621
+ return { found: false, iOffset: 1, jOffset: 1 };
622
+ }
623
+ function extractVersion(content) {
624
+ const match = content.match(/(?:Version|version|v)[\s:]*(\d+(?:\.\d+)*)/i);
625
+ return match ? match[1] : null;
626
+ }
627
+ function extractUpdateDate(content) {
628
+ const match = content.match(/\*\*Updated\*\*:\s*(\d{4}-\d{2}-\d{2})/);
629
+ return match ? match[1] : null;
630
+ }
631
+ function formatLineDiff(diff) {
632
+ if (diff > 0) {
633
+ return `+${diff}`;
634
+ }
635
+ if (diff < 0) {
636
+ return String(diff);
637
+ }
638
+ return "\xB10";
639
+ }
640
+
641
+ // src/commands/template-check/actors/compare.ts
642
+ function compareBothFiles(runaRelPath, templateRelPath, runaAbsPath, templateAbsPath, category, includeDiff) {
643
+ const runaContent = fs2.readFileSync(runaAbsPath, "utf-8");
644
+ const templateContent = fs2.readFileSync(templateAbsPath, "utf-8");
645
+ const comparison = compareFiles(runaContent, templateContent);
646
+ let status;
647
+ if (comparison.identical) {
648
+ status = runaRelPath !== templateRelPath ? "renamed" : "identical";
649
+ } else if (isIntentionallyDifferent(runaRelPath)) {
650
+ status = "intentionally-different";
651
+ } else {
652
+ status = "diff";
653
+ }
654
+ const result = {
655
+ runaPath: runaRelPath,
656
+ templatePath: templateRelPath,
657
+ category,
658
+ status,
659
+ ahead: comparison.identical ? void 0 : comparison.ahead,
660
+ lineDiff: comparison.identical ? void 0 : comparison.lineDiff
661
+ };
662
+ if (includeDiff && !comparison.identical) {
663
+ result.diffOutput = generateUnifiedDiff(runaContent, templateContent, {
664
+ maxLines: 30,
665
+ runaLabel: runaRelPath,
666
+ templateLabel: templateRelPath
667
+ });
668
+ }
669
+ return result;
670
+ }
671
+ function createRunaOnlyResult(runaRelPath, category) {
672
+ return {
673
+ runaPath: runaRelPath,
674
+ templatePath: null,
675
+ category,
676
+ status: isExpectedRunaOnly(runaRelPath) ? "expected-runa-only" : "runa-only"
677
+ };
678
+ }
679
+ function createTemplateOnlyResult(templateRelPath, category) {
680
+ return {
681
+ runaPath: null,
682
+ templatePath: templateRelPath,
683
+ category,
684
+ status: isExpectedTemplateOnly(templateRelPath) ? "expected-template-only" : "template-only"
685
+ };
686
+ }
687
+ function sortResults(results) {
688
+ results.sort((a, b) => {
689
+ if (a.category !== b.category) {
690
+ return a.category.localeCompare(b.category);
691
+ }
692
+ const pathA = a.runaPath ?? a.templatePath ?? "";
693
+ const pathB = b.runaPath ?? b.templatePath ?? "";
694
+ return pathA.localeCompare(pathB);
695
+ });
696
+ }
697
+ function filterResults(results, category) {
698
+ let filtered = results.filter((r) => {
699
+ const filePath = r.runaPath ?? r.templatePath ?? "";
700
+ return isCodeFile(filePath);
701
+ });
702
+ if (category) {
703
+ filtered = filtered.filter((r) => r.category === category);
704
+ }
705
+ return filtered;
706
+ }
707
+ var compareActor = fromPromise(async ({ input }) => {
708
+ const { inventory, repoRoot, templateDir, options } = input;
709
+ const results = [];
710
+ const processedKeys = /* @__PURE__ */ new Set();
711
+ for (const [key, runaRelPath] of inventory.runaByKey) {
712
+ processedKeys.add(key);
713
+ const runaFile = inventory.runaFiles.get(runaRelPath);
714
+ if (!runaFile) continue;
715
+ const templateRelPath = inventory.templateByKey.get(key);
716
+ if (templateRelPath) {
717
+ const templateFile = inventory.templateFiles.get(templateRelPath);
718
+ if (!templateFile) continue;
719
+ const result = compareBothFiles(
720
+ runaRelPath,
721
+ templateRelPath,
722
+ path2.join(repoRoot, runaRelPath),
723
+ path2.join(templateDir, templateRelPath),
724
+ runaFile.category,
725
+ options.diff ?? false
726
+ );
727
+ results.push(result);
728
+ } else {
729
+ results.push(createRunaOnlyResult(runaRelPath, runaFile.category));
730
+ }
731
+ }
732
+ for (const [key, templateRelPath] of inventory.templateByKey) {
733
+ if (processedKeys.has(key)) continue;
734
+ const templateFile = inventory.templateFiles.get(templateRelPath);
735
+ if (!templateFile) continue;
736
+ results.push(createTemplateOnlyResult(templateRelPath, templateFile.category));
737
+ }
738
+ sortResults(results);
739
+ return { results: filterResults(results, options.category) };
740
+ });
741
+
742
+ // src/commands/template-check/actors/discover.ts
743
+ init_esm_shims();
744
+
745
+ // src/commands/template-check/utils/path-mapping.ts
746
+ init_esm_shims();
747
+ var PATH_MAPPING_RULES = [
748
+ // ============================================================
749
+ // ROOT CONFIG FILES (HIGH PRIORITY)
750
+ // ============================================================
751
+ {
752
+ runa: "package.json",
753
+ template: "package.json",
754
+ category: "config"
755
+ },
756
+ {
757
+ runa: "turbo.json",
758
+ template: "turbo.json",
759
+ category: "config"
760
+ },
761
+ {
762
+ runa: "runa.config.ts",
763
+ template: "runa.config.ts",
764
+ category: "config"
765
+ },
766
+ {
767
+ runa: "tsconfig.json",
768
+ template: "tsconfig.json",
769
+ category: "config"
770
+ },
771
+ {
772
+ runa: "vitest.config.ts",
773
+ template: "vitest.config.ts",
774
+ category: "config"
775
+ },
776
+ {
777
+ runa: "vitest.global-setup.ts",
778
+ template: "vitest.global-setup.ts",
779
+ category: "config"
780
+ },
781
+ {
782
+ runa: "global-setup.ts",
783
+ template: "global-setup.ts",
784
+ category: "config"
785
+ },
786
+ {
787
+ runa: "playwright.config.ts",
788
+ template: "playwright.config.ts",
789
+ category: "config"
790
+ },
791
+ {
792
+ runa: "pnpm-workspace.yaml",
793
+ template: "pnpm-workspace.yaml",
794
+ category: "config"
795
+ },
796
+ {
797
+ runa: ".gitignore",
798
+ template: ".gitignore",
799
+ category: "config"
800
+ },
801
+ {
802
+ runa: ".squawk.toml",
803
+ template: ".squawk.toml",
804
+ category: "config"
805
+ },
806
+ {
807
+ runa: ".npmrc",
808
+ template: ".npmrc",
809
+ category: "config"
810
+ },
811
+ {
812
+ runa: ".env.example",
813
+ template: ".env.example",
814
+ category: "config"
815
+ },
816
+ // config/vitest/
817
+ {
818
+ runa: "config/vitest/*.ts",
819
+ template: "config/vitest/*.ts",
820
+ category: "config"
821
+ },
822
+ // scripts/
823
+ {
824
+ runa: "scripts/*.ts",
825
+ template: "scripts/*.ts",
826
+ category: "config"
827
+ },
828
+ // .runa/
829
+ {
830
+ runa: ".runa/*.json",
831
+ template: ".runa/*.json",
832
+ category: "config"
833
+ },
834
+ // ============================================================
835
+ // APPS/WEB (HIGH PRIORITY - FRONTEND CODE)
836
+ // ============================================================
837
+ {
838
+ runa: "apps/web/package.json",
839
+ template: "apps/web/package.json",
840
+ category: "config"
841
+ },
842
+ {
843
+ runa: "apps/web/tsconfig.json",
844
+ template: "apps/web/tsconfig.json",
845
+ category: "config"
846
+ },
847
+ {
848
+ runa: "apps/web/next.config.ts",
849
+ template: "apps/web/next.config.ts",
850
+ category: "config"
851
+ },
852
+ {
853
+ runa: "apps/web/app/**/*.tsx",
854
+ template: "apps/web/app/**/*.tsx",
855
+ category: "other"
856
+ },
857
+ {
858
+ runa: "apps/web/app/**/*.ts",
859
+ template: "apps/web/app/**/*.ts",
860
+ category: "other"
861
+ },
862
+ // ============================================================
863
+ // PACKAGES/DATABASE (HIGH PRIORITY - CODE)
864
+ // ============================================================
865
+ {
866
+ runa: "packages/database/package.json",
867
+ template: "packages/database/package.json",
868
+ category: "database"
869
+ },
870
+ {
871
+ runa: "packages/database/tsconfig.json",
872
+ template: "packages/database/tsconfig.json",
873
+ category: "database"
874
+ },
875
+ {
876
+ runa: "packages/database/biome.json",
877
+ template: "packages/database/biome.json",
878
+ category: "database"
879
+ },
880
+ {
881
+ runa: "packages/database/drizzle.config.ts",
882
+ template: "packages/database/drizzle.config.ts",
883
+ category: "database"
884
+ },
885
+ {
886
+ runa: "packages/database/src/*.ts",
887
+ template: "packages/database/src/*.ts",
888
+ category: "database"
889
+ },
890
+ {
891
+ runa: "packages/database/src/**/*.ts",
892
+ template: "packages/database/src/**/*.ts",
893
+ category: "database"
894
+ },
895
+ {
896
+ runa: "packages/database/scripts/**/*.ts",
897
+ template: "packages/database/scripts/**/*.ts",
898
+ category: "database"
899
+ },
900
+ {
901
+ runa: "packages/database/extensions/*.sql",
902
+ template: "packages/database/extensions/*.sql",
903
+ category: "database"
904
+ },
905
+ {
906
+ runa: "packages/database/tests/*.sql",
907
+ template: "packages/database/tests/*.sql",
908
+ category: "database"
909
+ },
910
+ // ============================================================
911
+ // SUPABASE (HIGH PRIORITY - SQL)
912
+ // ============================================================
913
+ {
914
+ runa: "supabase/config.toml",
915
+ template: "supabase/config.toml",
916
+ category: "database"
917
+ },
918
+ {
919
+ runa: "supabase/schemas/**/*.sql",
920
+ template: "supabase/schemas/**/*.sql",
921
+ category: "database"
922
+ },
923
+ {
924
+ runa: "supabase/seeds/*.sql",
925
+ template: "supabase/seeds/*.sql",
926
+ category: "database"
927
+ },
928
+ {
929
+ runa: "supabase/seeds/**/*.sql",
930
+ template: "supabase/seeds/**/*.sql",
931
+ category: "database"
932
+ },
933
+ {
934
+ runa: "supabase/migrations/*.sql",
935
+ template: "supabase/migrations/*.sql",
936
+ category: "database"
937
+ },
938
+ {
939
+ runa: "supabase/tests/*.sql",
940
+ template: "supabase/tests/*.sql",
941
+ category: "database"
942
+ },
943
+ // ============================================================
944
+ // GITHUB ACTIONS & WORKFLOWS (HIGH PRIORITY)
945
+ // ============================================================
946
+ {
947
+ runa: ".github/workflows/*.yml",
948
+ template: ".github/workflows/*.yml",
949
+ category: "workflows"
950
+ },
951
+ {
952
+ runa: ".github/actions/**/action.yml",
953
+ template: ".github/actions/**/action.yml",
954
+ category: "workflows"
955
+ },
956
+ // ============================================================
957
+ // HUSKY (GIT HOOKS)
958
+ // ============================================================
959
+ {
960
+ runa: ".husky/pre-commit",
961
+ template: ".husky/pre-commit",
962
+ category: "config"
963
+ },
964
+ {
965
+ runa: ".husky/pre-push",
966
+ template: ".husky/pre-push",
967
+ category: "config"
968
+ },
969
+ {
970
+ runa: ".husky/_common.sh",
971
+ template: ".husky/_common.sh",
972
+ category: "config"
973
+ },
974
+ // ============================================================
975
+ // PACKAGES/API-CLIENT (CODE)
976
+ // ============================================================
977
+ {
978
+ runa: "packages/api-client/package.json",
979
+ template: "packages/api-client/package.json",
980
+ category: "other"
981
+ },
982
+ {
983
+ runa: "packages/api-client/tsconfig.json",
984
+ template: "packages/api-client/tsconfig.json",
985
+ category: "other"
986
+ },
987
+ {
988
+ runa: "packages/api-client/**/*.ts",
989
+ template: "packages/api-client/**/*.ts",
990
+ category: "other"
991
+ },
992
+ {
993
+ runa: "packages/api-client/**/*.tsx",
994
+ template: "packages/api-client/**/*.tsx",
995
+ category: "other"
996
+ },
997
+ // ============================================================
998
+ // .CLAUDE DIRECTORY (LOWER PRIORITY)
999
+ // Note: Templates use _claude/ to avoid Claude Code detection in runa-repo.
1000
+ // At runa init/upgrade time, _claude/ is renamed to .claude/.
1001
+ // ============================================================
1002
+ {
1003
+ runa: ".claude/settings.json",
1004
+ template: "_claude/settings.json",
1005
+ category: "config"
1006
+ },
1007
+ {
1008
+ runa: ".claude/rules/*.md",
1009
+ template: "_claude/rules/sdk/*.md",
1010
+ category: "rules",
1011
+ rename: {
1012
+ "code-quality.md": "quality.md",
1013
+ "core-philosophy.md": "core.md",
1014
+ "pj-repo-compatibility.md": "pj-repo-compat.md"
1015
+ }
1016
+ },
1017
+ {
1018
+ runa: ".claude/agents/*.md",
1019
+ template: "_claude/agents/sdk/*.md",
1020
+ category: "agents"
1021
+ },
1022
+ // Skills with SKILL.md (explicit paths instead of ** wildcard for reliable matching)
1023
+ {
1024
+ runa: ".claude/skills/audit/SKILL.md",
1025
+ template: "_claude/skills/sdk/audit/SKILL.md",
1026
+ category: "skills"
1027
+ },
1028
+ {
1029
+ runa: ".claude/skills/refactor/SKILL.md",
1030
+ template: "_claude/skills/sdk/refactor/SKILL.md",
1031
+ category: "skills"
1032
+ },
1033
+ {
1034
+ runa: ".claude/skills/spec/SKILL.md",
1035
+ template: "_claude/skills/sdk/spec/SKILL.md",
1036
+ category: "skills"
1037
+ },
1038
+ // Skills with templates/*.yml
1039
+ {
1040
+ runa: ".claude/skills/audit/templates/*.yml",
1041
+ template: "_claude/skills/sdk/audit/templates/*.yml",
1042
+ category: "skills"
1043
+ },
1044
+ {
1045
+ runa: ".claude/skills/refactor/templates/*.yml",
1046
+ template: "_claude/skills/sdk/refactor/templates/*.yml",
1047
+ category: "skills"
1048
+ },
1049
+ {
1050
+ runa: ".claude/skills/spec/templates/*.yml",
1051
+ template: "_claude/skills/sdk/spec/templates/*.yml",
1052
+ category: "skills"
1053
+ },
1054
+ {
1055
+ runa: ".claude/commands/*.md",
1056
+ template: "_claude/commands/sdk/*.md",
1057
+ category: "commands"
1058
+ },
1059
+ {
1060
+ runa: ".claude/maps/*.md",
1061
+ template: "_claude/maps/*.md",
1062
+ category: "other"
1063
+ },
1064
+ // ============================================================
1065
+ // .CODEX DIRECTORY (mirrors .claude policies for Codex)
1066
+ // ============================================================
1067
+ {
1068
+ runa: ".codex/README.md",
1069
+ template: "_codex/README.md",
1070
+ category: "config"
1071
+ },
1072
+ {
1073
+ runa: ".codex/AGENTS.md",
1074
+ template: "_codex/AGENTS.md",
1075
+ category: "config"
1076
+ },
1077
+ {
1078
+ runa: ".codex/CODEX.md",
1079
+ template: "_codex/CODEX.md",
1080
+ category: "config"
1081
+ },
1082
+ {
1083
+ runa: ".codex/config.toml",
1084
+ template: "_codex/config.toml",
1085
+ category: "config"
1086
+ },
1087
+ {
1088
+ runa: ".codex/rules/devops.md",
1089
+ template: "_codex/rules/devops.md",
1090
+ category: "rules"
1091
+ },
1092
+ {
1093
+ runa: ".codex/rules/permissions.toml",
1094
+ template: "_codex/rules/permissions.toml",
1095
+ category: "rules"
1096
+ },
1097
+ // ============================================================
1098
+ // ROOT DOCUMENTATION (LOWEST PRIORITY)
1099
+ // ============================================================
1100
+ {
1101
+ runa: "AGENTS.md",
1102
+ template: "AGENTS.md",
1103
+ category: "root-docs"
1104
+ },
1105
+ {
1106
+ runa: "CLAUDE.md",
1107
+ template: "CLAUDE.md",
1108
+ category: "root-docs"
1109
+ },
1110
+ {
1111
+ runa: "docs/prompts/*.md",
1112
+ template: "docs/prompts/*.md",
1113
+ category: "prompts"
1114
+ },
1115
+ {
1116
+ runa: "docs/prompts/*.yml",
1117
+ template: "docs/prompts/*.yml",
1118
+ category: "prompts"
1119
+ }
1120
+ ];
1121
+ function getCategoryForPath(path3) {
1122
+ for (const rule of PATH_MAPPING_RULES) {
1123
+ if (matchGlobPattern(path3, rule.runa) || matchGlobPattern(path3, rule.template)) {
1124
+ return rule.category;
1125
+ }
1126
+ }
1127
+ return "other";
1128
+ }
1129
+ function normalizeTemplatePath(templatePath) {
1130
+ return templatePath.replace(/^_claude\//, ".claude/").replace(".claude/rules/sdk/", ".claude/rules/").replace(".claude/agents/sdk/", ".claude/agents/").replace(".claude/skills/sdk/", ".claude/skills/").replace(".claude/commands/sdk/", ".claude/commands/");
1131
+ }
1132
+ function applyReverseRename(normalized, rule, isTemplate) {
1133
+ if (!rule.rename) return normalized;
1134
+ const ruleBasePath = rule.runa.replace("/*.md", "/").replace("/**/*.md", "/");
1135
+ if (!normalized.startsWith(ruleBasePath)) return normalized;
1136
+ for (const [runaName, templateName] of Object.entries(rule.rename)) {
1137
+ if (isTemplate && normalized.endsWith(templateName)) {
1138
+ return normalized.replace(templateName, runaName);
1139
+ }
1140
+ }
1141
+ return normalized;
1142
+ }
1143
+ function generateComparisonKey(path3, isTemplate) {
1144
+ let normalized = isTemplate ? normalizeTemplatePath(path3) : path3;
1145
+ for (const rule of PATH_MAPPING_RULES) {
1146
+ normalized = applyReverseRename(normalized, rule, isTemplate);
1147
+ }
1148
+ return normalized;
1149
+ }
1150
+ function matchGlobPattern(path3, pattern) {
1151
+ const regexPattern = pattern.replace(/[.+^${}()|[\]\\]/g, "\\$&").replace(/\*\*/g, "<<DOUBLE_STAR>>").replace(/\*/g, "([^/]*)").replace(/<<DOUBLE_STAR>>/g, "(.*)");
1152
+ const regex = new RegExp(`^${regexPattern}$`);
1153
+ const match = path3.match(regex);
1154
+ if (match) {
1155
+ const subPath = match[1] ?? "";
1156
+ return { matched: true, subPath };
1157
+ }
1158
+ return null;
1159
+ }
1160
+
1161
+ // src/commands/template-check/actors/discover.ts
1162
+ var discoverActor = fromPromise(async ({ input }) => {
1163
+ const { repoRoot, templateDir } = input;
1164
+ const inventory = {
1165
+ runaFiles: /* @__PURE__ */ new Map(),
1166
+ templateFiles: /* @__PURE__ */ new Map(),
1167
+ runaByKey: /* @__PURE__ */ new Map(),
1168
+ templateByKey: /* @__PURE__ */ new Map()
1169
+ };
1170
+ for (const rule of PATH_MAPPING_RULES) {
1171
+ const runaPattern = rule.runa;
1172
+ const runaFiles = await globFiles(repoRoot, runaPattern);
1173
+ for (const file of runaFiles) {
1174
+ const relativePath = path2.relative(repoRoot, file.absolutePath);
1175
+ const key = generateComparisonKey(relativePath, false);
1176
+ inventory.runaFiles.set(relativePath, {
1177
+ ...file,
1178
+ relativePath,
1179
+ category: rule.category
1180
+ });
1181
+ inventory.runaByKey.set(key, relativePath);
1182
+ }
1183
+ }
1184
+ for (const rule of PATH_MAPPING_RULES) {
1185
+ const templatePattern = rule.template;
1186
+ const templateFiles = await globFiles(templateDir, templatePattern);
1187
+ for (const file of templateFiles) {
1188
+ const relativePath = path2.relative(templateDir, file.absolutePath);
1189
+ const key = generateComparisonKey(relativePath, true);
1190
+ inventory.templateFiles.set(relativePath, {
1191
+ ...file,
1192
+ relativePath,
1193
+ category: rule.category
1194
+ });
1195
+ inventory.templateByKey.set(key, relativePath);
1196
+ }
1197
+ }
1198
+ return {
1199
+ inventory,
1200
+ runaCount: inventory.runaFiles.size,
1201
+ templateCount: inventory.templateFiles.size
1202
+ };
1203
+ });
1204
+ async function globFiles(baseDir, pattern) {
1205
+ const results = [];
1206
+ const parts = pattern.split("/");
1207
+ await walkAndMatch({
1208
+ currentDir: baseDir,
1209
+ patternParts: parts,
1210
+ partIndex: 0,
1211
+ results,
1212
+ fullPattern: pattern
1213
+ });
1214
+ return results;
1215
+ }
1216
+ function addFileResult(entryPath, fullPattern, results) {
1217
+ const stats = fs2.statSync(entryPath);
1218
+ results.push({
1219
+ absolutePath: entryPath,
1220
+ size: stats.size,
1221
+ category: getCategoryForPath(fullPattern)
1222
+ });
1223
+ }
1224
+ async function processEntry(ctx, entryPath, isFile, isDirectory, isLastPart) {
1225
+ if (isLastPart && isFile) {
1226
+ addFileResult(entryPath, ctx.fullPattern, ctx.results);
1227
+ return;
1228
+ }
1229
+ if (!isLastPart && isDirectory) {
1230
+ await walkAndMatch({ ...ctx, currentDir: entryPath, partIndex: ctx.partIndex + 1 });
1231
+ }
1232
+ }
1233
+ async function matchDoubleWildcard(ctx, entries) {
1234
+ await walkAndMatch({ ...ctx, partIndex: ctx.partIndex + 1 });
1235
+ for (const entry of entries) {
1236
+ if (entry.isDirectory()) {
1237
+ const subDir = path2.join(ctx.currentDir, entry.name);
1238
+ await walkAndMatch({ ...ctx, currentDir: subDir });
1239
+ }
1240
+ }
1241
+ }
1242
+ async function matchSingleWildcard(ctx, entries, pattern, isLastPart) {
1243
+ const regex = patternToRegex(pattern);
1244
+ for (const entry of entries) {
1245
+ if (regex.test(entry.name)) {
1246
+ const entryPath = path2.join(ctx.currentDir, entry.name);
1247
+ await processEntry(ctx, entryPath, entry.isFile(), entry.isDirectory(), isLastPart);
1248
+ }
1249
+ }
1250
+ }
1251
+ async function matchBraceExpansion(ctx, entries, pattern, isLastPart) {
1252
+ const options = extractBraceOptions(pattern);
1253
+ for (const option of options) {
1254
+ for (const entry of entries) {
1255
+ if (entry.name === option) {
1256
+ const entryPath = path2.join(ctx.currentDir, entry.name);
1257
+ await processEntry(ctx, entryPath, entry.isFile(), entry.isDirectory(), isLastPart);
1258
+ }
1259
+ }
1260
+ }
1261
+ }
1262
+ async function matchLiteral(ctx, pattern, isLastPart) {
1263
+ const entryPath = path2.join(ctx.currentDir, pattern);
1264
+ if (!fs2.existsSync(entryPath)) return;
1265
+ const stats = fs2.statSync(entryPath);
1266
+ await processEntry(ctx, entryPath, stats.isFile(), stats.isDirectory(), isLastPart);
1267
+ }
1268
+ async function walkAndMatch(ctx) {
1269
+ if (ctx.partIndex >= ctx.patternParts.length) return;
1270
+ if (!fs2.existsSync(ctx.currentDir)) return;
1271
+ const currentPattern = ctx.patternParts[ctx.partIndex];
1272
+ const isLastPart = ctx.partIndex === ctx.patternParts.length - 1;
1273
+ const entries = fs2.readdirSync(ctx.currentDir, { withFileTypes: true });
1274
+ if (currentPattern === "**") {
1275
+ await matchDoubleWildcard(ctx, entries);
1276
+ } else if (currentPattern.includes("*")) {
1277
+ await matchSingleWildcard(ctx, entries, currentPattern, isLastPart);
1278
+ } else if (currentPattern.includes("{")) {
1279
+ await matchBraceExpansion(ctx, entries, currentPattern, isLastPart);
1280
+ } else {
1281
+ await matchLiteral(ctx, currentPattern, isLastPart);
1282
+ }
1283
+ }
1284
+ function patternToRegex(pattern) {
1285
+ const escaped = pattern.replace(/[.+^${}()|[\]\\]/g, "\\$&").replace(/\*/g, ".*");
1286
+ return new RegExp(`^${escaped}$`);
1287
+ }
1288
+ function extractBraceOptions(pattern) {
1289
+ const match = pattern.match(/\{([^}]+)\}/);
1290
+ if (!match) return [pattern];
1291
+ const options = match[1].split(",");
1292
+ const prefix = pattern.slice(0, match.index);
1293
+ const suffix = pattern.slice((match.index ?? 0) + match[0].length);
1294
+ return options.map((opt) => prefix + opt.trim() + suffix);
1295
+ }
1296
+
1297
+ // src/commands/template-check/actors/report.ts
1298
+ init_esm_shims();
1299
+ init_types();
1300
+ var CATEGORY_DISPLAY_NAMES = {
1301
+ rules: "Rules (.claude/rules/)",
1302
+ agents: "Agents (.claude/agents/)",
1303
+ skills: "Skills (.claude/skills/)",
1304
+ commands: "Commands (.claude/commands/)",
1305
+ prompts: "Prompts (docs/prompts/)",
1306
+ database: "Database (packages/database/scripts/)",
1307
+ workflows: "Workflows (.github/workflows/)",
1308
+ "root-docs": "Root Documentation",
1309
+ config: "Configuration",
1310
+ other: "Other"
1311
+ };
1312
+ var reportActor = fromPromise(async ({ input }) => {
1313
+ const { results, options, durationMs } = input;
1314
+ const summary = calculateSummary(results);
1315
+ const byCategory = groupByCategory(results);
1316
+ const actionsNeeded = collectActionsNeeded(results);
1317
+ let jsonString;
1318
+ if (options.json) {
1319
+ jsonString = JSON.stringify(
1320
+ {
1321
+ success: summary.diff === 0 && summary.runaOnly === 0 && summary.templateOnly === 0,
1322
+ summary,
1323
+ results,
1324
+ actionsNeeded,
1325
+ durationMs
1326
+ },
1327
+ null,
1328
+ 2
1329
+ );
1330
+ }
1331
+ return {
1332
+ byCategory,
1333
+ summary,
1334
+ actionsNeeded,
1335
+ jsonOutput: options.json,
1336
+ jsonString
1337
+ };
1338
+ });
1339
+ function groupByCategory(results) {
1340
+ const categoryMap = /* @__PURE__ */ new Map();
1341
+ for (const result of results) {
1342
+ const existing = categoryMap.get(result.category) ?? [];
1343
+ existing.push(result);
1344
+ categoryMap.set(result.category, existing);
1345
+ }
1346
+ const reports = [];
1347
+ for (const [category, categoryResults] of categoryMap) {
1348
+ const identical = categoryResults.filter(
1349
+ (r) => r.status === "identical" || r.status === "renamed" || r.status === "intentionally-different"
1350
+ ).length;
1351
+ const diff = categoryResults.filter((r) => r.status === "diff").length;
1352
+ const runaOnly = categoryResults.filter((r) => r.status === "runa-only").length;
1353
+ const templateOnly = categoryResults.filter((r) => r.status === "template-only").length;
1354
+ const expectedOnly = categoryResults.filter(
1355
+ (r) => r.status === "expected-runa-only" || r.status === "expected-template-only"
1356
+ ).length;
1357
+ reports.push({
1358
+ category,
1359
+ displayName: CATEGORY_DISPLAY_NAMES[category],
1360
+ results: categoryResults,
1361
+ identical,
1362
+ diff,
1363
+ runaOnly,
1364
+ templateOnly,
1365
+ expectedOnly
1366
+ });
1367
+ }
1368
+ const categoryOrder = [
1369
+ "rules",
1370
+ "agents",
1371
+ "skills",
1372
+ "commands",
1373
+ "prompts",
1374
+ "database",
1375
+ "workflows",
1376
+ "root-docs",
1377
+ "config",
1378
+ "other"
1379
+ ];
1380
+ reports.sort((a, b) => {
1381
+ return categoryOrder.indexOf(a.category) - categoryOrder.indexOf(b.category);
1382
+ });
1383
+ return reports;
1384
+ }
1385
+ function collectActionsNeeded(results) {
1386
+ const actions = [];
1387
+ for (const result of results) {
1388
+ if (result.status === "diff" || result.status === "runa-only" || result.status === "template-only") {
1389
+ actions.push({
1390
+ path: result.runaPath ?? result.templatePath ?? "",
1391
+ targetPath: result.runaPath && result.templatePath ? result.templatePath : null,
1392
+ status: result.status,
1393
+ ahead: result.ahead ?? null,
1394
+ lineDiff: result.lineDiff ?? null,
1395
+ diffOutput: result.diffOutput
1396
+ });
1397
+ }
1398
+ }
1399
+ return actions;
1400
+ }
1401
+
1402
+ // src/commands/template-check/machine.ts
1403
+ init_types();
1404
+ var e2eMeta = {
1405
+ idle: {
1406
+ description: "Waiting for START event to begin template check",
1407
+ severity: "non-critical",
1408
+ observables: {
1409
+ log: "Template Check"
1410
+ },
1411
+ assertions: ["expect(log).toContain('Template Check')", "expect(state).toBe('idle')"],
1412
+ nextStates: ["discover"]
1413
+ },
1414
+ discover: {
1415
+ description: "Scan runa-repo and pj-repo for template files",
1416
+ severity: "blocking",
1417
+ observables: {
1418
+ log: "Discovering files",
1419
+ fs: "packages/runa-templates/templates/ scanned"
1420
+ },
1421
+ assertions: [
1422
+ "expect(log).toContain('Discovering files')",
1423
+ "expect(ctx.inventory).toBeDefined()"
1424
+ ],
1425
+ nextStates: ["compare", "failed"]
1426
+ },
1427
+ compare: {
1428
+ description: "Normalize content and compare template files",
1429
+ severity: "blocking",
1430
+ observables: {
1431
+ log: "Comparing files"
1432
+ },
1433
+ assertions: ["expect(log).toContain('Comparing files')", "expect(ctx.results).toBeArray()"],
1434
+ nextStates: ["report", "failed"]
1435
+ },
1436
+ report: {
1437
+ description: "Generate comparison report and summary",
1438
+ severity: "blocking",
1439
+ observables: {
1440
+ log: "Summary"
1441
+ },
1442
+ assertions: ["expect(log).toContain('Summary')"],
1443
+ nextStates: ["done", "failed"]
1444
+ },
1445
+ done: {
1446
+ description: "Template check completed",
1447
+ severity: "final",
1448
+ observables: {
1449
+ log: "Summary",
1450
+ exit: "0 (all identical) or 1 (differences found)"
1451
+ },
1452
+ assertions: ["expect(log).toContain('Summary')", "expect(exitCode).toBe(0).or.toBe(1)"],
1453
+ nextStates: []
1454
+ },
1455
+ failed: {
1456
+ description: "Template check failed with error",
1457
+ severity: "final",
1458
+ observables: {
1459
+ log: "failed",
1460
+ exit: 2
1461
+ },
1462
+ assertions: ["expect(log).toContain('failed')", "expect(exitCode).toBe(2)"],
1463
+ nextStates: []
1464
+ }
1465
+ };
1466
+ var syncCheckMachine = setup({
1467
+ types: {},
1468
+ actors: {
1469
+ discover: discoverActor,
1470
+ compare: compareActor,
1471
+ report: reportActor
1472
+ }
1473
+ }).createMachine({
1474
+ id: "templateCheck",
1475
+ initial: "idle",
1476
+ context: ({ input }) => ({
1477
+ input: input.input,
1478
+ repoRoot: input.repoRoot,
1479
+ templateDir: `${input.repoRoot}/packages/runa-templates/templates`,
1480
+ inventory: null,
1481
+ results: [],
1482
+ startTime: Date.now(),
1483
+ error: null
1484
+ }),
1485
+ states: {
1486
+ // ============================================================
1487
+ // Idle State
1488
+ // ============================================================
1489
+ idle: {
1490
+ meta: { e2e: e2eMeta.idle },
1491
+ on: {
1492
+ START: { target: "discover" }
1493
+ }
1494
+ },
1495
+ // ============================================================
1496
+ // Discover Phase
1497
+ // ============================================================
1498
+ discover: {
1499
+ meta: { e2e: e2eMeta.discover },
1500
+ invoke: {
1501
+ src: "discover",
1502
+ input: ({ context }) => ({
1503
+ repoRoot: context.repoRoot,
1504
+ templateDir: context.templateDir
1505
+ }),
1506
+ onDone: {
1507
+ target: "compare",
1508
+ actions: assign({
1509
+ inventory: ({ event }) => event.output.inventory
1510
+ })
1511
+ },
1512
+ onError: {
1513
+ target: "failed",
1514
+ actions: assign({
1515
+ error: ({ event }) => `Discovery failed: ${getErrorMessage(event.error)}`
1516
+ })
1517
+ }
1518
+ }
1519
+ },
1520
+ // ============================================================
1521
+ // Compare Phase
1522
+ // ============================================================
1523
+ compare: {
1524
+ meta: { e2e: e2eMeta.compare },
1525
+ invoke: {
1526
+ src: "compare",
1527
+ input: ({ context }) => ({
1528
+ inventory: context.inventory,
1529
+ repoRoot: context.repoRoot,
1530
+ templateDir: context.templateDir,
1531
+ options: context.input
1532
+ }),
1533
+ onDone: {
1534
+ target: "report",
1535
+ actions: assign({
1536
+ results: ({ event }) => event.output.results
1537
+ })
1538
+ },
1539
+ onError: {
1540
+ target: "failed",
1541
+ actions: assign({
1542
+ error: ({ event }) => `Comparison failed: ${getErrorMessage(event.error)}`
1543
+ })
1544
+ }
1545
+ }
1546
+ },
1547
+ // ============================================================
1548
+ // Report Phase
1549
+ // ============================================================
1550
+ report: {
1551
+ meta: { e2e: e2eMeta.report },
1552
+ invoke: {
1553
+ src: "report",
1554
+ input: ({ context }) => ({
1555
+ results: context.results,
1556
+ options: context.input,
1557
+ durationMs: Date.now() - context.startTime
1558
+ }),
1559
+ onDone: {
1560
+ target: "done"
1561
+ // Report output is used for rendering, not stored in context
1562
+ },
1563
+ onError: {
1564
+ target: "failed",
1565
+ actions: assign({
1566
+ error: ({ event }) => `Report generation failed: ${getErrorMessage(event.error)}`
1567
+ })
1568
+ }
1569
+ }
1570
+ },
1571
+ // ============================================================
1572
+ // Final States
1573
+ // ============================================================
1574
+ done: {
1575
+ meta: { e2e: e2eMeta.done },
1576
+ type: "final"
1577
+ },
1578
+ failed: {
1579
+ meta: { e2e: e2eMeta.failed },
1580
+ type: "final"
1581
+ }
1582
+ },
1583
+ output: ({ context }) => createOutput(context)
1584
+ });
1585
+ function getStateName(snapshot) {
1586
+ return typeof snapshot.value === "string" ? snapshot.value : "unknown";
1587
+ }
1588
+ function isComplete(snapshot) {
1589
+ return snapshot.status === "done";
1590
+ }
1591
+
1592
+ // src/commands/template-check/commands/template-check.ts
1593
+ var stateLogHandlers = {
1594
+ idle: (logger) => {
1595
+ logger.section("Template Check");
1596
+ logger.info("Comparing runa-repo with pj-repo templates...");
1597
+ },
1598
+ discover: (logger) => {
1599
+ logger.info("Discovering files...");
1600
+ },
1601
+ compare: (logger) => {
1602
+ logger.info("Comparing files...");
1603
+ },
1604
+ report: (_logger) => {
1605
+ }
1606
+ };
1607
+ var logStateChange = createMachineStateChangeLogger({
1608
+ getState: getStateName,
1609
+ getContext: (snapshot) => snapshot.context,
1610
+ handlers: stateLogHandlers,
1611
+ shouldSkipState: (_state, _prevState, _context, extra) => {
1612
+ return extra?.jsonMode === true || extra?.quietMode === true;
1613
+ }
1614
+ });
1615
+ function handleStateChange(snapshot, prevState, logger, jsonMode, quietMode) {
1616
+ logStateChange(snapshot, prevState, logger, { jsonMode, quietMode });
1617
+ }
1618
+ var CATEGORY_DISPLAY_NAMES2 = {
1619
+ rules: "Rules (.claude/rules/)",
1620
+ agents: "Agents (.claude/agents/)",
1621
+ skills: "Skills (.claude/skills/)",
1622
+ commands: "Commands (.claude/commands/)",
1623
+ prompts: "Prompts (docs/prompts/)",
1624
+ database: "Database (packages/database/scripts/)",
1625
+ workflows: "Workflows (.github/workflows/)",
1626
+ "root-docs": "Root Documentation",
1627
+ config: "Configuration",
1628
+ other: "Other"
1629
+ };
1630
+ var STATUS_ICONS = {
1631
+ identical: "\u2705",
1632
+ renamed: "\u{1F504}",
1633
+ diff: "\u26A0\uFE0F",
1634
+ "runa-only": "\u{1F535}",
1635
+ "template-only": "\u{1F7E0}",
1636
+ "expected-runa-only": "\u23ED\uFE0F",
1637
+ "expected-template-only": "\u23ED\uFE0F",
1638
+ "intentionally-different": "\u{1F4CC}"
1639
+ // Expected to differ (dogfooding vs pj-repo)
1640
+ };
1641
+ var AHEAD_LABELS = {
1642
+ runa: "runa ahead",
1643
+ template: "template ahead",
1644
+ diverged: "diverged",
1645
+ equal: ""
1646
+ };
1647
+ var STATUS_SUFFIXES = {
1648
+ "runa-only": "(unexpected - missing in template)",
1649
+ "template-only": "(unexpected - missing in runa-repo)",
1650
+ "expected-runa-only": "(expected - runa-repo only)",
1651
+ "expected-template-only": "(expected - pj-repo only)",
1652
+ renamed: "(file renamed, content identical)"
1653
+ };
1654
+ function getStatusSuffix(result) {
1655
+ if (result.status === "diff") {
1656
+ let suffix = result.lineDiff ?? "";
1657
+ if (result.ahead && AHEAD_LABELS[result.ahead]) {
1658
+ suffix += ` (${AHEAD_LABELS[result.ahead]})`;
1659
+ }
1660
+ return suffix;
1661
+ }
1662
+ if (result.status === "intentionally-different") {
1663
+ return `${result.lineDiff ?? ""} (expected - dogfooding vs pj-repo)`;
1664
+ }
1665
+ return STATUS_SUFFIXES[result.status] ?? "";
1666
+ }
1667
+ function getPathDisplay(result) {
1668
+ const runaPath = result.runaPath ?? "(none)";
1669
+ const templatePath = result.templatePath ?? "(none)";
1670
+ if (result.runaPath && result.templatePath && result.runaPath !== result.templatePath) {
1671
+ return `${runaPath} \u2192 ${templatePath.split("/").pop()}`;
1672
+ }
1673
+ return runaPath !== "(none)" ? runaPath : templatePath;
1674
+ }
1675
+ function printDiffOutput(logger, diffOutput) {
1676
+ logger.info("");
1677
+ for (const line of diffOutput.split("\n")) {
1678
+ if (line.startsWith("+") && !line.startsWith("+++")) {
1679
+ logger.success(` ${line}`);
1680
+ } else if (line.startsWith("-") && !line.startsWith("---")) {
1681
+ logger.error(` ${line}`);
1682
+ } else {
1683
+ logger.info(` ${line}`);
1684
+ }
1685
+ }
1686
+ logger.info("");
1687
+ }
1688
+ function printResult(logger, result, verbose) {
1689
+ const icon = STATUS_ICONS[result.status] ?? "\u2753";
1690
+ const pathDisplay = getPathDisplay(result);
1691
+ const suffix = getStatusSuffix(result);
1692
+ const statusLine = suffix ? ` ${icon} ${pathDisplay} ${suffix}` : ` ${icon} ${pathDisplay}`;
1693
+ if (verbose || result.status !== "identical") {
1694
+ logger.info(statusLine);
1695
+ }
1696
+ if (result.diffOutput) {
1697
+ printDiffOutput(logger, result.diffOutput);
1698
+ }
1699
+ }
1700
+ function printCategoryReport(logger, category, verbose) {
1701
+ logger.info("");
1702
+ logger.info(`\u2501\u2501\u2501 ${category.displayName} \u2501\u2501\u2501`);
1703
+ for (const result of category.results) {
1704
+ printResult(logger, result, verbose);
1705
+ }
1706
+ }
1707
+ function printSummary(logger, summary, _durationMs) {
1708
+ const needsAction = summary.diff + summary.runaOnly + summary.templateOnly;
1709
+ logger.info("");
1710
+ logger.info("\u2501\u2501\u2501 Summary (code files only) \u2501\u2501\u2501");
1711
+ logger.info(
1712
+ ` Total: ${summary.total} | In sync: ${summary.identical} | Needs action: ${needsAction}`
1713
+ );
1714
+ if (needsAction === 0) {
1715
+ logger.success(" \u2705 Template is up to date!");
1716
+ } else {
1717
+ logger.warn(` \u26A0\uFE0F ${needsAction} file(s) need attention`);
1718
+ }
1719
+ }
1720
+ function printActionGroup(logger, actions, header, isWarning, formatter) {
1721
+ if (actions.length === 0) return;
1722
+ logger.info("");
1723
+ if (isWarning) {
1724
+ logger.warn(header);
1725
+ } else {
1726
+ logger.info(header);
1727
+ }
1728
+ for (const action of actions) {
1729
+ for (const line of formatter(action)) {
1730
+ logger.info(line);
1731
+ }
1732
+ }
1733
+ }
1734
+ function printActionsNeeded(logger, actions) {
1735
+ if (actions.length === 0) {
1736
+ logger.info("");
1737
+ logger.success("\u2705 All code files are in sync! No action needed.");
1738
+ return;
1739
+ }
1740
+ const updateTemplate = actions.filter((a) => a.ahead === "runa");
1741
+ const checkRuna = actions.filter((a) => a.ahead === "template");
1742
+ const manualMerge = actions.filter((a) => a.ahead === "diverged");
1743
+ const missingInTemplate = actions.filter((a) => a.status === "runa-only");
1744
+ const missingInRuna = actions.filter((a) => a.status === "template-only");
1745
+ logger.info("");
1746
+ logger.info("\u2501\u2501\u2501 Actions Required \u2501\u2501\u2501");
1747
+ printActionGroup(
1748
+ logger,
1749
+ updateTemplate,
1750
+ "\u{1F4E4} UPDATE TEMPLATE (runa-repo has newer code):",
1751
+ false,
1752
+ (action) => {
1753
+ const templatePath = action.targetPath ?? action.path.replace(/^\.claude\//, ".claude/sdk/");
1754
+ return [` cp ${action.path} packages/runa-templates/templates/${templatePath}`];
1755
+ }
1756
+ );
1757
+ printActionGroup(
1758
+ logger,
1759
+ checkRuna,
1760
+ "\u26A0\uFE0F CHECK RUNA-REPO (template is ahead - unusual):",
1761
+ true,
1762
+ (action) => [
1763
+ ` ${action.path}`,
1764
+ ` \u2192 Template was updated but runa-repo wasn't. Intentional?`
1765
+ ]
1766
+ );
1767
+ printActionGroup(
1768
+ logger,
1769
+ manualMerge,
1770
+ "\u{1F500} MANUAL MERGE NEEDED (both sides changed):",
1771
+ true,
1772
+ (action) => [` ${action.path}`, " \u2192 Run: runa template-check --diff to see differences"]
1773
+ );
1774
+ printActionGroup(
1775
+ logger,
1776
+ missingInTemplate,
1777
+ "\u2795 ADD TO TEMPLATE (or mark as runa-only in normalizer.ts):",
1778
+ false,
1779
+ (action) => [` ${action.path}`]
1780
+ );
1781
+ printActionGroup(
1782
+ logger,
1783
+ missingInRuna,
1784
+ "\u2753 MISSING IN RUNA-REPO (template has code that runa-repo doesn't):",
1785
+ true,
1786
+ (action) => [` ${action.path}`]
1787
+ );
1788
+ }
1789
+ function groupResultsByCategory(results) {
1790
+ const categoryMap = /* @__PURE__ */ new Map();
1791
+ for (const result of results) {
1792
+ const existing = categoryMap.get(result.category) ?? [];
1793
+ existing.push(result);
1794
+ categoryMap.set(result.category, existing);
1795
+ }
1796
+ const byCategory = [];
1797
+ for (const [category, categoryResults] of categoryMap) {
1798
+ byCategory.push({
1799
+ category,
1800
+ displayName: CATEGORY_DISPLAY_NAMES2[category] ?? category,
1801
+ results: categoryResults,
1802
+ // Count identical, renamed, and intentionally-different as "in sync"
1803
+ identical: categoryResults.filter(
1804
+ (r) => r.status === "identical" || r.status === "renamed" || r.status === "intentionally-different"
1805
+ ).length,
1806
+ diff: categoryResults.filter((r) => r.status === "diff").length,
1807
+ runaOnly: categoryResults.filter((r) => r.status === "runa-only").length,
1808
+ templateOnly: categoryResults.filter((r) => r.status === "template-only").length,
1809
+ expectedOnly: categoryResults.filter(
1810
+ (r) => r.status === "expected-runa-only" || r.status === "expected-template-only"
1811
+ ).length
1812
+ });
1813
+ }
1814
+ return byCategory;
1815
+ }
1816
+ function collectActionsNeeded2(results) {
1817
+ return results.filter((r) => r.status === "diff" || r.status === "runa-only" || r.status === "template-only").map((r) => ({
1818
+ path: r.runaPath ?? r.templatePath ?? "",
1819
+ targetPath: r.runaPath && r.templatePath ? r.templatePath : null,
1820
+ status: r.status,
1821
+ ahead: r.ahead ?? null,
1822
+ lineDiff: r.lineDiff ?? null,
1823
+ diffOutput: r.diffOutput
1824
+ }));
1825
+ }
1826
+ function generateReportOutput(output, isJsonMode) {
1827
+ const { calculateSummary: calculateSummary2 } = (init_types(), __toCommonJS(types_exports));
1828
+ const summary = calculateSummary2(output.results);
1829
+ const byCategory = groupResultsByCategory(output.results);
1830
+ const actionsNeeded = collectActionsNeeded2(output.results);
1831
+ return {
1832
+ byCategory,
1833
+ summary,
1834
+ actionsNeeded,
1835
+ jsonOutput: isJsonMode,
1836
+ jsonString: isJsonMode ? JSON.stringify(
1837
+ { success: output.success, summary, results: output.results, actionsNeeded },
1838
+ null,
1839
+ 2
1840
+ ) : void 0
1841
+ };
1842
+ }
1843
+ function validateRunaRepo(repoRoot) {
1844
+ const { existsSync: existsSync2 } = __require("fs");
1845
+ const { join: join3 } = __require("path");
1846
+ const templateDir = join3(repoRoot, "packages/runa-templates/templates");
1847
+ if (!existsSync2(templateDir)) {
1848
+ throw new CLIError("template-check is a runa-repo only command", "NOT_RUNA_REPO", [
1849
+ "This command compares runa-repo with pj-repo templates",
1850
+ "It should only be run in the runa repository",
1851
+ `Expected: ${templateDir}`
1852
+ ]);
1853
+ }
1854
+ }
1855
+ async function runTemplateCheckMachine(input, logger) {
1856
+ const repoRoot = input.targetDir ?? findRepoRoot(process.cwd());
1857
+ validateRunaRepo(repoRoot);
1858
+ return new Promise((resolve, reject) => {
1859
+ const actor = createActor(syncCheckMachine, {
1860
+ input: { input, repoRoot }
1861
+ });
1862
+ let previousState = "";
1863
+ const isJsonMode = getOutputFormatFromEnv() === "json";
1864
+ const isQuietMode = input.quiet ?? false;
1865
+ actor.subscribe((snapshot) => {
1866
+ const currentState = getStateName(snapshot);
1867
+ if (currentState !== previousState) {
1868
+ handleStateChange(snapshot, previousState, logger, isJsonMode, isQuietMode);
1869
+ previousState = currentState;
1870
+ }
1871
+ if (isComplete(snapshot)) {
1872
+ const output = snapshot.output;
1873
+ if (output) {
1874
+ const reportOutput = generateReportOutput(output, isJsonMode);
1875
+ resolve({ output, reportOutput });
1876
+ }
1877
+ }
1878
+ });
1879
+ actor.subscribe({
1880
+ error: (error) => {
1881
+ reject(error);
1882
+ actor.stop();
1883
+ }
1884
+ });
1885
+ actor.start();
1886
+ actor.send({ type: "START" });
1887
+ });
1888
+ }
1889
+ function printReportOutput(logger, reportOutput, durationMs, options) {
1890
+ if (!options.quiet) {
1891
+ for (const category of reportOutput.byCategory) {
1892
+ printCategoryReport(logger, category, options.verbose);
1893
+ }
1894
+ }
1895
+ printSummary(logger, reportOutput.summary);
1896
+ printActionsNeeded(logger, reportOutput.actionsNeeded);
1897
+ }
1898
+ function wrapError(error) {
1899
+ if (error instanceof CLIError) {
1900
+ return error;
1901
+ }
1902
+ return new CLIError(
1903
+ error instanceof Error ? error.message : String(error),
1904
+ "TEMPLATE_CHECK_ERROR",
1905
+ ["Check file paths and permissions"],
1906
+ error instanceof Error ? error : void 0
1907
+ );
1908
+ }
1909
+ async function runTemplateCheckAction(options) {
1910
+ const logger = createCLILogger("template-check");
1911
+ try {
1912
+ const { output, reportOutput } = await runTemplateCheckMachine(options, logger);
1913
+ const isJsonMode = getOutputFormatFromEnv() === "json";
1914
+ if (isJsonMode && reportOutput?.jsonString) {
1915
+ console.log(reportOutput.jsonString);
1916
+ process.exit(output.exitCode);
1917
+ return;
1918
+ }
1919
+ if (reportOutput) {
1920
+ printReportOutput(logger, reportOutput, output.durationMs, options);
1921
+ }
1922
+ if (output.error) {
1923
+ throw new CLIError(output.error, "SYNC_CHECK_ERROR");
1924
+ }
1925
+ process.exit(output.exitCode);
1926
+ } catch (error) {
1927
+ throw wrapError(error);
1928
+ }
1929
+ }
1930
+ var templateCheckCommand = new Command("template-check").description(
1931
+ "Compare runa-repo with SDK templates (runa-repo only)\n\n Exit codes:\n 0 = All files in sync\n 1 = Differences detected (action needed)\n 2 = Error occurred"
1932
+ ).option("--verbose", "Show all files including identical ones").option("--diff", "Show unified diff for differences").option("--category <name>", "Filter by category (rules, agents, skills, etc.)").option("--json", "Output as JSON (for CI integration)").option("--quiet", "Only show summary and actions (for pre-commit hooks)").option("--target-dir <path>", "Target directory (defaults to repo root)").action(async (options) => {
1933
+ const input = {
1934
+ verbose: options.verbose ?? false,
1935
+ diff: options.diff ?? false,
1936
+ category: options.category,
1937
+ json: options.json ?? false,
1938
+ quiet: options.quiet ?? false,
1939
+ targetDir: options.targetDir
1940
+ };
1941
+ await runTemplateCheckAction(input);
1942
+ });
1943
+
1944
+ export { templateCheckCommand };