@askrjs/cli 0.0.2 → 0.0.4

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 (310) hide show
  1. package/README.md +46 -7
  2. package/dist/add.d.ts +16 -0
  3. package/dist/add.js +558 -1
  4. package/dist/cli.d.ts +5 -0
  5. package/dist/cli.js +43 -16
  6. package/dist/create.d.ts +5 -0
  7. package/dist/create.js +104 -26
  8. package/dist/directory-swap-DWoHtx7C.js +35 -0
  9. package/dist/discovery-Difb7Y4G.js +323 -0
  10. package/dist/generate.d.ts +5 -0
  11. package/dist/generate.js +461 -0
  12. package/dist/is-direct-execution-Cdlr-ZUl.js +0 -2
  13. package/dist/openapi.d.ts +25 -0
  14. package/dist/openapi.js +49 -16
  15. package/dist/planner-VAj7qlxr.js +285 -0
  16. package/dist/range-YUs9eimn.js +125 -0
  17. package/dist/registry-CyrRHRG5.js +209 -0
  18. package/dist/skills/askr-dashboard-charts/SKILL.md +61 -44
  19. package/dist/skills/askr-dashboard-charts/agents/openai.yaml +2 -2
  20. package/dist/skills/askr-ssr-ssg/SKILL.md +3 -1
  21. package/dist/{skills-Bh0mEhIx.js → skills-B7CbWur9.js} +89 -26
  22. package/dist/skills.d.ts +18 -0
  23. package/dist/skills.js +1 -1
  24. package/dist/specification-DXnDOC-0.js +49 -0
  25. package/dist/ssg-config.d.ts +41 -0
  26. package/dist/ssg-config.js +1 -0
  27. package/dist/ssg.d.ts +61 -0
  28. package/dist/ssg.js +360 -24
  29. package/dist/templates/full-stack/AGENTS.md +0 -1
  30. package/dist/templates/full-stack/README.md +0 -1
  31. package/dist/templates/full-stack/index.html +0 -1
  32. package/dist/templates/full-stack/package.json +5 -3
  33. package/dist/templates/full-stack/server.ts +5 -9
  34. package/dist/templates/full-stack/src/action-authorizations.ts +2 -2
  35. package/dist/templates/full-stack/src/actions/create-message.ts +5 -5
  36. package/dist/templates/full-stack/src/i18n.ts +4 -4
  37. package/dist/templates/full-stack/src/main.tsx +4 -5
  38. package/dist/templates/full-stack/src/pages/home.tsx +5 -5
  39. package/dist/templates/full-stack/src/pages/layout.tsx +15 -5
  40. package/dist/templates/full-stack/src/pages/not-found.tsx +5 -2
  41. package/dist/templates/full-stack/src/routes.tsx +11 -12
  42. package/dist/templates/full-stack/src/schemas.ts +1 -2
  43. package/dist/templates/full-stack/src/server/action-registry.ts +5 -10
  44. package/dist/templates/full-stack/src/server/actions/create-message.ts +4 -4
  45. package/dist/templates/full-stack/src/server/app.ts +67 -57
  46. package/dist/templates/full-stack/src/server/dependencies.ts +10 -10
  47. package/dist/templates/full-stack/src/server/entry-server.ts +3 -3
  48. package/dist/templates/full-stack/src/telemetry.ts +1 -2
  49. package/dist/templates/full-stack/tests/actions/create-message.test.ts +7 -8
  50. package/dist/templates/full-stack/tsconfig.json +1 -2
  51. package/dist/templates/full-stack/vite.config.ts +5 -6
  52. package/dist/templates/spa/AGENTS.md +1 -1
  53. package/dist/templates/spa/package.json +3 -4
  54. package/dist/templates/spa/src/adapters/operations-client.ts +7 -2
  55. package/dist/templates/spa/src/pages/app/_routes.tsx +2 -0
  56. package/dist/templates/spa/src/pages/app/admin-home.tsx +21 -3
  57. package/dist/templates/spa/src/pages/public/_routes.tsx +2 -0
  58. package/dist/templates/spa/src/styles.css +1 -1
  59. package/dist/templates/spa/tsconfig.json +2 -1
  60. package/dist/templates/spa/vitest.config.ts +0 -4
  61. package/dist/templates/ssg/README.md +1 -1
  62. package/dist/templates/ssg/package.json +1 -1
  63. package/dist/templates/ssg/ssg.config.ts +7 -0
  64. package/dist/templates/ssg/tests/ssg-config.test.ts +5 -3
  65. package/dist/templates/ssg/tsconfig.json +2 -1
  66. package/dist/templates/ssg/vitest.config.ts +0 -4
  67. package/dist/templates/ssr/package.json +2 -2
  68. package/dist/templates/ssr/server.ts +4 -10
  69. package/dist/templates/ssr/src/entry-server.tsx +6 -4
  70. package/dist/templates/startkit/package.json +2 -2
  71. package/dist/templates/startkit/src/lib/mock-data.ts +17 -39
  72. package/dist/templates/startkit/tsconfig.json +2 -1
  73. package/dist/update.d.ts +41 -0
  74. package/dist/update.js +282 -2
  75. package/dist/writer-D8qe_7ud.js +226 -0
  76. package/package.json +23 -22
  77. package/dist/add-DqhqRzBQ.js +0 -555
  78. package/dist/add-DqhqRzBQ.js.map +0 -1
  79. package/dist/cli.js.map +0 -1
  80. package/dist/create.js.map +0 -1
  81. package/dist/is-direct-execution-Cdlr-ZUl.js.map +0 -1
  82. package/dist/openapi.js.map +0 -1
  83. package/dist/skills-Bh0mEhIx.js.map +0 -1
  84. package/dist/ssg.js.map +0 -1
  85. package/dist/templates/full-stack/src/vite-server.d.ts +0 -6
  86. package/dist/templates/spa/src/styles.d.ts +0 -1
  87. package/dist/templates/ssg/src/vite-env.d.ts +0 -5
  88. package/dist/templates/ssr/src/vite-server.d.ts +0 -7
  89. package/dist/templates/startkit/src/vite-env.d.ts +0 -5
  90. package/dist/update-DyW1na5V.js +0 -1140
  91. package/dist/update-DyW1na5V.js.map +0 -1
  92. package/skills/askr-accessibility/SKILL.md +0 -68
  93. package/skills/askr-accessibility/agents/openai.yaml +0 -4
  94. package/skills/askr-agent-execution/SKILL.md +0 -85
  95. package/skills/askr-agent-execution/agents/openai.yaml +0 -4
  96. package/skills/askr-agent-workflows/SKILL.md +0 -57
  97. package/skills/askr-agent-workflows/agents/openai.yaml +0 -4
  98. package/skills/askr-api-integration/SKILL.md +0 -79
  99. package/skills/askr-api-integration/agents/openai.yaml +0 -4
  100. package/skills/askr-app-builder/SKILL.md +0 -99
  101. package/skills/askr-app-builder/agents/openai.yaml +0 -4
  102. package/skills/askr-auth-access/SKILL.md +0 -74
  103. package/skills/askr-auth-access/agents/openai.yaml +0 -4
  104. package/skills/askr-cli-vite/SKILL.md +0 -76
  105. package/skills/askr-cli-vite/agents/openai.yaml +0 -4
  106. package/skills/askr-dashboard-charts/SKILL.md +0 -82
  107. package/skills/askr-dashboard-charts/agents/openai.yaml +0 -4
  108. package/skills/askr-design-system/SKILL.md +0 -86
  109. package/skills/askr-design-system/agents/openai.yaml +0 -4
  110. package/skills/askr-env-config/SKILL.md +0 -74
  111. package/skills/askr-env-config/agents/openai.yaml +0 -4
  112. package/skills/askr-error-loading-empty/SKILL.md +0 -89
  113. package/skills/askr-error-loading-empty/agents/openai.yaml +0 -4
  114. package/skills/askr-file-upload-artifacts/SKILL.md +0 -77
  115. package/skills/askr-file-upload-artifacts/agents/openai.yaml +0 -4
  116. package/skills/askr-forms-tables-crud/SKILL.md +0 -98
  117. package/skills/askr-forms-tables-crud/agents/openai.yaml +0 -4
  118. package/skills/askr-mental-model/SKILL.md +0 -109
  119. package/skills/askr-mental-model/agents/openai.yaml +0 -4
  120. package/skills/askr-migration-react/SKILL.md +0 -81
  121. package/skills/askr-migration-react/agents/openai.yaml +0 -4
  122. package/skills/askr-observability-debugging/SKILL.md +0 -83
  123. package/skills/askr-observability-debugging/agents/openai.yaml +0 -4
  124. package/skills/askr-project-structure/SKILL.md +0 -79
  125. package/skills/askr-project-structure/agents/openai.yaml +0 -4
  126. package/skills/askr-query-mutation/SKILL.md +0 -115
  127. package/skills/askr-query-mutation/agents/openai.yaml +0 -4
  128. package/skills/askr-realtime-streaming/SKILL.md +0 -76
  129. package/skills/askr-realtime-streaming/agents/openai.yaml +0 -4
  130. package/skills/askr-resources-data/SKILL.md +0 -100
  131. package/skills/askr-resources-data/agents/openai.yaml +0 -4
  132. package/skills/askr-routing-layouts/SKILL.md +0 -107
  133. package/skills/askr-routing-layouts/agents/openai.yaml +0 -4
  134. package/skills/askr-runtime-reactivity/SKILL.md +0 -92
  135. package/skills/askr-runtime-reactivity/agents/openai.yaml +0 -4
  136. package/skills/askr-ssr-ssg/SKILL.md +0 -76
  137. package/skills/askr-ssr-ssg/agents/openai.yaml +0 -4
  138. package/skills/askr-testing-determinism/SKILL.md +0 -75
  139. package/skills/askr-testing-determinism/agents/openai.yaml +0 -4
  140. package/skills/askr-theming/SKILL.md +0 -86
  141. package/skills/askr-theming/agents/openai.yaml +0 -4
  142. package/skills/askr-ui-composition/SKILL.md +0 -92
  143. package/skills/askr-ui-composition/agents/openai.yaml +0 -4
  144. package/templates/full-stack/AGENTS.md +0 -12
  145. package/templates/full-stack/README.md +0 -18
  146. package/templates/full-stack/gitignore.template +0 -4
  147. package/templates/full-stack/index.html +0 -14
  148. package/templates/full-stack/package.json +0 -37
  149. package/templates/full-stack/server.ts +0 -13
  150. package/templates/full-stack/src/action-authorizations.ts +0 -10
  151. package/templates/full-stack/src/actions/create-message.ts +0 -10
  152. package/templates/full-stack/src/i18n.ts +0 -8
  153. package/templates/full-stack/src/main.tsx +0 -12
  154. package/templates/full-stack/src/pages/home.tsx +0 -25
  155. package/templates/full-stack/src/pages/layout.tsx +0 -33
  156. package/templates/full-stack/src/pages/not-found.tsx +0 -4
  157. package/templates/full-stack/src/routes.tsx +0 -20
  158. package/templates/full-stack/src/schemas.ts +0 -11
  159. package/templates/full-stack/src/server/action-registry.ts +0 -12
  160. package/templates/full-stack/src/server/actions/create-message.ts +0 -14
  161. package/templates/full-stack/src/server/app.ts +0 -66
  162. package/templates/full-stack/src/server/dependencies.ts +0 -55
  163. package/templates/full-stack/src/server/entry-server.ts +0 -8
  164. package/templates/full-stack/src/telemetry.ts +0 -4
  165. package/templates/full-stack/src/vite-server.d.ts +0 -6
  166. package/templates/full-stack/tests/actions/create-message.test.ts +0 -13
  167. package/templates/full-stack/tsconfig.json +0 -16
  168. package/templates/full-stack/vite.config.ts +0 -11
  169. package/templates/spa/AGENTS.md +0 -60
  170. package/templates/spa/README.md +0 -96
  171. package/templates/spa/gitignore.template +0 -16
  172. package/templates/spa/index.html +0 -13
  173. package/templates/spa/package.json +0 -35
  174. package/templates/spa/src/adapters/operations-client.ts +0 -90
  175. package/templates/spa/src/components/shared/metric-card.tsx +0 -27
  176. package/templates/spa/src/components/shared/status-badge.tsx +0 -24
  177. package/templates/spa/src/features/operations/operations.query.ts +0 -9
  178. package/templates/spa/src/main.tsx +0 -10
  179. package/templates/spa/src/pages/_layout.tsx +0 -9
  180. package/templates/spa/src/pages/_routes.tsx +0 -27
  181. package/templates/spa/src/pages/app/_layout.tsx +0 -94
  182. package/templates/spa/src/pages/app/_routes.tsx +0 -10
  183. package/templates/spa/src/pages/app/admin-home.tsx +0 -152
  184. package/templates/spa/src/pages/app/agent-runs.tsx +0 -93
  185. package/templates/spa/src/pages/app/settings.tsx +0 -91
  186. package/templates/spa/src/pages/auth/_layout.tsx +0 -38
  187. package/templates/spa/src/pages/auth/_routes.tsx +0 -6
  188. package/templates/spa/src/pages/auth/login.tsx +0 -63
  189. package/templates/spa/src/pages/not-found.tsx +0 -22
  190. package/templates/spa/src/pages/public/_layout.tsx +0 -47
  191. package/templates/spa/src/pages/public/_routes.tsx +0 -6
  192. package/templates/spa/src/pages/public/home.tsx +0 -143
  193. package/templates/spa/src/shared/format.ts +0 -12
  194. package/templates/spa/src/shared/navigation.ts +0 -15
  195. package/templates/spa/src/styles/components.css +0 -49
  196. package/templates/spa/src/styles/layout.css +0 -192
  197. package/templates/spa/src/styles/reset.css +0 -44
  198. package/templates/spa/src/styles/theme.css +0 -57
  199. package/templates/spa/src/styles/tokens.css +0 -20
  200. package/templates/spa/src/styles.css +0 -7
  201. package/templates/spa/src/styles.d.ts +0 -1
  202. package/templates/spa/tests/app.test.tsx +0 -37
  203. package/templates/spa/tests/components/shared.test.tsx +0 -12
  204. package/templates/spa/tests/resources.test.ts +0 -22
  205. package/templates/spa/tsconfig.json +0 -20
  206. package/templates/spa/tsconfig.node.json +0 -10
  207. package/templates/spa/vite.config.ts +0 -24
  208. package/templates/spa/vitest.config.ts +0 -17
  209. package/templates/ssg/AGENTS.md +0 -55
  210. package/templates/ssg/README.md +0 -39
  211. package/templates/ssg/gitignore.template +0 -17
  212. package/templates/ssg/index.html +0 -13
  213. package/templates/ssg/package.json +0 -35
  214. package/templates/ssg/src/app.tsx +0 -14
  215. package/templates/ssg/src/components/badge.tsx +0 -3
  216. package/templates/ssg/src/components/counter.tsx +0 -30
  217. package/templates/ssg/src/components/site-shell.tsx +0 -111
  218. package/templates/ssg/src/jsx.d.ts +0 -23
  219. package/templates/ssg/src/main.tsx +0 -8
  220. package/templates/ssg/src/pages/about.tsx +0 -82
  221. package/templates/ssg/src/pages/content.tsx +0 -63
  222. package/templates/ssg/src/pages/example.tsx +0 -97
  223. package/templates/ssg/src/pages/home.tsx +0 -51
  224. package/templates/ssg/src/resources/user.ts +0 -15
  225. package/templates/ssg/src/routes.tsx +0 -15
  226. package/templates/ssg/src/styles.css +0 -89
  227. package/templates/ssg/src/vite-env.d.ts +0 -5
  228. package/templates/ssg/ssg.config.ts +0 -34
  229. package/templates/ssg/tests/app.test.tsx +0 -19
  230. package/templates/ssg/tests/components/counter.test.tsx +0 -18
  231. package/templates/ssg/tests/resources.test.ts +0 -11
  232. package/templates/ssg/tests/ssg-config.test.ts +0 -11
  233. package/templates/ssg/tsconfig.json +0 -20
  234. package/templates/ssg/tsconfig.node.json +0 -10
  235. package/templates/ssg/vite.config.ts +0 -24
  236. package/templates/ssg/vitest.config.ts +0 -17
  237. package/templates/ssr/AGENTS.md +0 -28
  238. package/templates/ssr/README.md +0 -38
  239. package/templates/ssr/gitignore.template +0 -16
  240. package/templates/ssr/index.html +0 -13
  241. package/templates/ssr/package.json +0 -34
  242. package/templates/ssr/server.ts +0 -16
  243. package/templates/ssr/src/app.tsx +0 -21
  244. package/templates/ssr/src/components/counter.tsx +0 -26
  245. package/templates/ssr/src/entry-server.tsx +0 -10
  246. package/templates/ssr/src/main.tsx +0 -11
  247. package/templates/ssr/src/pages/about.tsx +0 -75
  248. package/templates/ssr/src/pages/example.tsx +0 -113
  249. package/templates/ssr/src/pages/home.tsx +0 -56
  250. package/templates/ssr/src/resources/user.ts +0 -15
  251. package/templates/ssr/src/routes.tsx +0 -13
  252. package/templates/ssr/src/styles.css +0 -148
  253. package/templates/ssr/src/vite-server.d.ts +0 -7
  254. package/templates/ssr/tests/app.test.tsx +0 -24
  255. package/templates/ssr/tests/components/counter.test.tsx +0 -13
  256. package/templates/ssr/tests/resources.test.ts +0 -11
  257. package/templates/ssr/tsconfig.json +0 -22
  258. package/templates/ssr/tsconfig.node.json +0 -10
  259. package/templates/ssr/tsconfig.server.json +0 -15
  260. package/templates/ssr/vite.config.ts +0 -25
  261. package/templates/ssr/vitest.config.ts +0 -13
  262. package/templates/startkit/AGENTS.md +0 -77
  263. package/templates/startkit/README.md +0 -192
  264. package/templates/startkit/gitignore.template +0 -16
  265. package/templates/startkit/index.html +0 -13
  266. package/templates/startkit/package.json +0 -35
  267. package/templates/startkit/src/components/app-header.tsx +0 -93
  268. package/templates/startkit/src/components/app-sidebar.tsx +0 -95
  269. package/templates/startkit/src/components/data-table.tsx +0 -80
  270. package/templates/startkit/src/components/empty-state.tsx +0 -13
  271. package/templates/startkit/src/components/page-header.tsx +0 -23
  272. package/templates/startkit/src/components/stat-card.tsx +0 -24
  273. package/templates/startkit/src/features/accounts/account-filters.tsx +0 -61
  274. package/templates/startkit/src/features/accounts/account-table.tsx +0 -79
  275. package/templates/startkit/src/lib/format.ts +0 -31
  276. package/templates/startkit/src/lib/mock-data.ts +0 -441
  277. package/templates/startkit/src/lib/routes.ts +0 -116
  278. package/templates/startkit/src/main.tsx +0 -12
  279. package/templates/startkit/src/pages/_layout.tsx +0 -56
  280. package/templates/startkit/src/pages/auth/_layout.tsx +0 -7
  281. package/templates/startkit/src/pages/auth/login.tsx +0 -129
  282. package/templates/startkit/src/pages/home.tsx +0 -83
  283. package/templates/startkit/src/pages/not-found.tsx +0 -24
  284. package/templates/startkit/src/pages/workspace/_layout.tsx +0 -17
  285. package/templates/startkit/src/pages/workspace/accounts/index.tsx +0 -217
  286. package/templates/startkit/src/pages/workspace/dashboard.tsx +0 -118
  287. package/templates/startkit/src/pages/workspace/settings.tsx +0 -218
  288. package/templates/startkit/src/router.tsx +0 -7
  289. package/templates/startkit/src/routes/auth-config.ts +0 -38
  290. package/templates/startkit/src/routes/auth.ts +0 -8
  291. package/templates/startkit/src/routes/index.ts +0 -28
  292. package/templates/startkit/src/routes/public.ts +0 -8
  293. package/templates/startkit/src/routes/workspace/accounts.ts +0 -8
  294. package/templates/startkit/src/routes/workspace/index.ts +0 -14
  295. package/templates/startkit/src/styles/components.css +0 -396
  296. package/templates/startkit/src/styles/layout.css +0 -192
  297. package/templates/startkit/src/styles/reset.css +0 -38
  298. package/templates/startkit/src/styles/theme.css +0 -76
  299. package/templates/startkit/src/styles/tokens.css +0 -67
  300. package/templates/startkit/src/styles.css +0 -7
  301. package/templates/startkit/src/toast.ts +0 -55
  302. package/templates/startkit/src/utils/join-classes.ts +0 -4
  303. package/templates/startkit/src/vite-env.d.ts +0 -5
  304. package/templates/startkit/tests/app.test.tsx +0 -32
  305. package/templates/startkit/tests/preferences.test.ts +0 -43
  306. package/templates/startkit/tests/resources.test.ts +0 -82
  307. package/templates/startkit/tsconfig.json +0 -20
  308. package/templates/startkit/tsconfig.node.json +0 -10
  309. package/templates/startkit/vite.config.ts +0 -32
  310. package/templates/startkit/vitest.config.ts +0 -13
@@ -1 +0,0 @@
1
- {"version":3,"file":"add-DqhqRzBQ.js","names":[],"sources":["../src/file-changes.ts","../src/bin/add.ts"],"sourcesContent":["import fs from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { randomUUID } from \"node:crypto\";\n\nexport interface FileChange {\n readonly filePath: string;\n readonly content: string;\n}\n\ninterface StagedChange extends FileChange {\n readonly original: Buffer | null;\n readonly mode: number;\n readonly temporaryPath: string;\n}\n\nexport interface FileChangeWriterOptions {\n readonly replace?: (temporaryPath: string, filePath: string) => Promise<void>;\n}\n\nasync function remove(paths: readonly string[]): Promise<void> {\n await Promise.all(\n paths.map((filePath) => fs.rm(filePath, { force: true }).catch(() => undefined)),\n );\n}\n\nasync function restore(changes: readonly StagedChange[]): Promise<boolean> {\n let complete = true;\n for (const change of [...changes].reverse()) {\n try {\n if (change.original === null) {\n await fs.rm(change.filePath, { force: true });\n continue;\n }\n const rollbackPath = path.join(\n path.dirname(change.filePath),\n `.${path.basename(change.filePath)}.askr-rollback-${randomUUID()}`,\n );\n await fs.writeFile(rollbackPath, change.original, { flag: \"wx\", mode: change.mode });\n await fs.rename(rollbackPath, change.filePath);\n } catch {\n complete = false;\n }\n }\n return complete;\n}\n\nexport async function writeFileChanges(\n changes: readonly FileChange[],\n options: FileChangeWriterOptions = {},\n): Promise<void> {\n const ordered = [...changes].sort((left, right) => left.filePath.localeCompare(right.filePath));\n if (new Set(ordered.map((change) => change.filePath)).size !== ordered.length) {\n throw new Error(\"File changes contain duplicate target paths.\");\n }\n const replace = options.replace ?? fs.rename;\n const staged: StagedChange[] = [];\n try {\n for (const change of ordered) {\n await fs.mkdir(path.dirname(change.filePath), { recursive: true });\n const stat = await fs.stat(change.filePath).catch(() => null);\n const original = stat ? await fs.readFile(change.filePath) : null;\n const temporaryPath = path.join(\n path.dirname(change.filePath),\n `.${path.basename(change.filePath)}.askr-change-${randomUUID()}`,\n );\n const mode = stat?.mode ?? 0o644;\n await fs.writeFile(temporaryPath, change.content, { flag: \"wx\", mode });\n staged.push({ ...change, original, mode, temporaryPath });\n }\n } catch (error) {\n await remove(staged.map((change) => change.temporaryPath));\n throw error;\n }\n\n const replaced: StagedChange[] = [];\n try {\n for (const change of staged) {\n await replace(change.temporaryPath, change.filePath);\n replaced.push(change);\n }\n } catch {\n const complete = await restore(replaced);\n await remove(staged.map((change) => change.temporaryPath));\n throw new Error(\n complete\n ? \"File replacement failed; completed changes were rolled back.\"\n : \"File replacement failed and rollback was incomplete.\",\n );\n }\n}\n","#!/usr/bin/env node\n\nimport fs from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { isDirectExecution } from \"./is-direct-execution\";\nimport { writeFileChanges } from \"../file-changes\";\n\ntype CliIo = Pick<Console, \"error\" | \"log\">;\n\nconst BRANCH_CONFIG = {\n app: {\n badge: \"app route\",\n pagesDir: [\"src\", \"pages\", \"app\"],\n routesFile: [\"src\", \"pages\", \"app\", \"_routes.tsx\"],\n },\n public: {\n badge: \"public route\",\n pagesDir: [\"src\", \"pages\", \"public\"],\n routesFile: [\"src\", \"pages\", \"public\", \"_routes.tsx\"],\n },\n} as const;\n\ntype BranchName = keyof typeof BRANCH_CONFIG;\n\ninterface ParsedArgs {\n branch: string;\n cwd: string;\n force: boolean;\n help: boolean;\n routePath: string;\n title: string;\n errors: string[];\n command: string;\n name: string;\n}\n\nfunction helpText(): string {\n return [\n \"askr add - Generate code into an existing Askr project\",\n \"\",\n \"Usage:\",\n \" askr add page <name> [--branch app|public] [--cwd <dir>] [--title <title>] [--route <path>] [--force]\",\n \" askr add action <name> --route <path> [--cwd <dir>] [--force]\",\n \"\",\n \"Commands:\",\n \" page Scaffold a route page and register it in a route-first SPA branch\",\n \" action Scaffold a browser descriptor, server handler, registration, authorization, and test\",\n \"\",\n \"Options:\",\n \" --branch <name> Route branch to target (default: app)\",\n \" --cwd <dir> Project directory (default: current directory)\",\n \" --title <text> Override the generated page title\",\n \" --route <path> Override the generated route path\",\n \" --force Overwrite an existing page file\",\n \" --help Show this help message\",\n \"\",\n \"Examples:\",\n \" askr add page audit-log\",\n \" askr add page ops/audit-log --branch public\",\n ' askr add page approvals --title \"Human approvals\" --route /app/approvals',\n \" askr add action approve-request --route /requests/{id}\",\n \"\",\n \"Notes:\",\n \" Page generation supports route-first SPA projects created from `askr create spa`.\",\n \" Action generation supports projects created from `askr create full-stack`.\",\n ].join(\"\\n\");\n}\n\nfunction parseArgs(args: string[]): ParsedArgs {\n const positional: string[] = [];\n const parsed = {\n branch: \"app\",\n cwd: process.cwd(),\n force: false,\n help: false,\n routePath: \"\",\n title: \"\",\n errors: [] as string[],\n };\n\n for (let index = 0; index < args.length; index += 1) {\n const arg = args[index];\n\n if (arg === \"--help\" || arg === \"-h\") {\n parsed.help = true;\n } else if (arg === \"--force\") {\n parsed.force = true;\n } else if (arg === \"--branch\") {\n if (index + 1 >= args.length) {\n parsed.errors.push(\"Missing value for --branch\");\n } else {\n parsed.branch = args[index + 1];\n index += 1;\n }\n } else if (arg === \"--cwd\") {\n if (index + 1 >= args.length) {\n parsed.errors.push(\"Missing value for --cwd\");\n } else {\n parsed.cwd = args[index + 1];\n index += 1;\n }\n } else if (arg === \"--title\") {\n if (index + 1 >= args.length) {\n parsed.errors.push(\"Missing value for --title\");\n } else {\n parsed.title = args[index + 1].trim();\n index += 1;\n }\n } else if (arg === \"--route\") {\n if (index + 1 >= args.length) {\n parsed.errors.push(\"Missing value for --route\");\n } else {\n parsed.routePath = args[index + 1].trim();\n index += 1;\n }\n } else {\n positional.push(arg);\n }\n }\n\n return {\n ...parsed,\n command: positional[0] || \"\",\n name: positional[1] || \"\",\n };\n}\n\nasync function pathExists(filePath: string): Promise<boolean> {\n return Boolean(await fs.stat(filePath).catch(() => null));\n}\n\nfunction slugifySegment(value: string): string {\n return value\n .replace(/([a-z0-9])([A-Z])/g, \"$1-$2\")\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, \"-\")\n .replace(/^-+|-+$/g, \"\");\n}\n\nfunction normalizePageSegments(input: string): string[] {\n const segments = input\n .replace(/^\\/+|\\/+$/g, \"\")\n .split(\"/\")\n .map((segment) => slugifySegment(segment.trim()))\n .filter(Boolean);\n\n if (segments.length === 0 || segments.some((segment) => segment.startsWith(\"_\"))) {\n return [];\n }\n\n return segments;\n}\n\nfunction toWords(segments: string[]): string[] {\n return segments.flatMap((segment) => segment.split(\"-\").filter(Boolean));\n}\n\nfunction toTitleCase(words: string[]): string {\n return words.map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(\" \");\n}\n\nfunction buildComponentName(segments: string[]): string {\n return `${toWords(segments)\n .map((word) => word.charAt(0).toUpperCase() + word.slice(1))\n .join(\"\")}Page`;\n}\n\nfunction buildIdentifier(segments: string[]): string {\n const [first = \"action\", ...rest] = toWords(segments);\n return [first.toLowerCase(), ...rest.map((word) => word.charAt(0).toUpperCase() + word.slice(1))]\n .join(\"\")\n .replace(/^[^a-z_$]/i, \"action\");\n}\n\ninterface DeclaredAction {\n readonly slug: string;\n readonly descriptorName: string;\n readonly handlerName: string;\n readonly routePath: string;\n}\n\nfunction renderAuthorizationRegistry(actions: readonly DeclaredAction[]): string {\n const imports = actions.map(\n (action) => `import { ${action.descriptorName} } from './actions/${action.slug}.js';`,\n );\n const routes = new Map<string, DeclaredAction[]>();\n for (const action of actions) {\n const entries = routes.get(action.routePath) ?? [];\n entries.push(action);\n routes.set(action.routePath, entries);\n }\n const routeLines = [...routes]\n .sort(([left], [right]) => left.localeCompare(right))\n .map(\n ([routePath, entries]) =>\n ` ${JSON.stringify(routePath)}: [${entries.map((entry) => entry.descriptorName).join(\", \")}],`,\n );\n return [\n \"import type { ActionDescriptor } from '@askrjs/askr/actions';\",\n ...imports,\n \"\",\n \"const actionsByRoute: Readonly<Record<string, readonly ActionDescriptor[]>> = Object.freeze({\",\n ...routeLines,\n \"});\",\n \"\",\n \"export function actionsFor(path: string): readonly ActionDescriptor[] {\",\n \" return actionsByRoute[path] ?? [];\",\n \"}\",\n \"\",\n ].join(\"\\n\");\n}\n\nfunction renderServerActionRegistry(actions: readonly DeclaredAction[]): string {\n return [\n \"import { createActionRegistry } from '@askrjs/server/askr';\",\n ...actions.map(\n (action) => `import { ${action.descriptorName} } from '../actions/${action.slug}.js';`,\n ),\n ...actions.map(\n (action) => `import { ${action.handlerName} } from './actions/${action.slug}.js';`,\n ),\n \"import type { AppDependencies } from './dependencies.js';\",\n \"\",\n \"export function createActions(deps: AppDependencies) {\",\n \" const registry = createActionRegistry(deps, {\",\n \" csrf: { secret: process.env.CSRF_SECRET ?? 'development-only-secret' },\",\n \" });\",\n ...actions.map(\n (action) => ` registry.register(${action.descriptorName}, ${action.handlerName});`,\n ),\n \" return registry;\",\n \"}\",\n \"\",\n ].join(\"\\n\");\n}\n\nasync function discoverDeclaredActions(\n projectRoot: string,\n replacement: { readonly filePath: string; readonly content: string },\n): Promise<DeclaredAction[]> {\n const actionsDir = path.join(projectRoot, \"src\", \"actions\");\n const names = await fs.readdir(actionsDir).catch(() => []);\n const files = new Set(\n names.filter((name) => name.endsWith(\".ts\")).map((name) => path.join(actionsDir, name)),\n );\n files.add(replacement.filePath);\n const actions: DeclaredAction[] = [];\n for (const filePath of [...files].sort()) {\n const content =\n filePath === replacement.filePath ? replacement.content : await fs.readFile(filePath, \"utf8\");\n const descriptor = /export const (\\w+Action) = defineAction\\(/.exec(content)?.[1];\n if (!descriptor) continue;\n const routeName = `${descriptor}Route`;\n const routeMatch = new RegExp(`export const ${routeName} = (['\"])(.*?)\\\\1;`).exec(content);\n if (!routeMatch)\n throw new Error(`Action descriptor ${path.basename(filePath)} must declare ${routeName}.`);\n const slug = path.basename(filePath, \".ts\");\n actions.push({\n slug,\n descriptorName: descriptor,\n handlerName: buildIdentifier([slug]),\n routePath: routeMatch[2]!,\n });\n }\n return actions.sort((left, right) => left.slug.localeCompare(right.slug));\n}\n\nfunction renderActionDescriptor(options: {\n descriptorName: string;\n routePath: string;\n slug: string;\n}): string {\n return [\n \"import { defineAction } from '@askrjs/askr/actions';\",\n \"import { schema } from '@askrjs/schema';\",\n \"\",\n `export const ${options.descriptorName}Route = ${JSON.stringify(options.routePath)};`,\n \"\",\n `export const ${options.descriptorName} = defineAction({`,\n ` id: '${options.slug}',`,\n \" input: schema.object({ value: schema.string({ minLength: 1 }) }),\",\n \" invalidates: [],\",\n \"});\",\n \"\",\n ].join(\"\\n\");\n}\n\nfunction renderActionHandler(options: {\n descriptorName: string;\n handlerName: string;\n slug: string;\n}): string {\n return [\n \"import type { InferSchema } from '@askrjs/schema';\",\n `import { ${options.descriptorName} } from '../../actions/${options.slug}.js';`,\n \"import type { AppDependencies } from '../dependencies.js';\",\n \"\",\n `type Input = InferSchema<typeof ${options.descriptorName}.input>;`,\n \"\",\n `export async function ${options.handlerName}(`,\n \" _context: unknown,\",\n \" input: Input,\",\n \" deps: Pick<AppDependencies, 'actions'>,\",\n \") {\",\n \" await deps.actions.record({ action: \" +\n JSON.stringify(options.slug) +\n \", value: input.value });\",\n \" return { result: { accepted: true } };\",\n \"}\",\n \"\",\n ].join(\"\\n\");\n}\n\nfunction renderActionTest(options: { descriptorName: string; slug: string }): string {\n return [\n \"import { describe, expect, it } from 'vitest';\",\n `import { ${options.descriptorName} } from '../../src/actions/${options.slug}.js';`,\n \"\",\n `describe('${options.slug} action', () => {`,\n \" it('should expose a browser-safe executable input contract', () => {\",\n ` expect(${options.descriptorName}.id).toBe('${options.slug}');`,\n ` expect(${options.descriptorName}.input.safeParse({ value: 'example' }).success).toBe(true);`,\n ` expect(${options.descriptorName}.input.safeParse({ value: '' }).success).toBe(false);`,\n \" });\",\n \"});\",\n \"\",\n ].join(\"\\n\");\n}\n\nfunction buildRoutePath(branch: BranchName, segments: string[], overridePath = \"\"): string {\n if (!overridePath) {\n const suffix = segments.join(\"/\");\n return branch === \"app\" ? `/app/${suffix}` : `/${suffix}`;\n }\n\n const normalized = overridePath.startsWith(\"/\") ? overridePath : `/${overridePath}`;\n if (branch === \"app\") {\n return normalized === \"/app\" || normalized.startsWith(\"/app/\")\n ? normalized\n : `/app${normalized}`;\n }\n\n if (normalized === \"/app\" || normalized.startsWith(\"/app/\")) {\n throw new Error(\"Public branch routes cannot live under /app.\");\n }\n\n return normalized;\n}\n\nfunction toImportSpecifier(fromFile: string, toFile: string): string {\n const relativePath = path.relative(path.dirname(fromFile), toFile).replace(/\\\\/g, \"/\");\n const withoutExtension = relativePath.replace(/\\.tsx$/i, \"\");\n return withoutExtension.startsWith(\".\") ? withoutExtension : `./${withoutExtension}`;\n}\n\nfunction createUpdatedRouteFile(\n routeFileContent: string,\n options: { componentName: string; importSpecifier: string; routePath: string },\n): string {\n const normalized = routeFileContent.replace(/\\r\\n/g, \"\\n\");\n const lines = normalized.split(\"\\n\");\n const lastImportIndex = lines.reduce(\n (currentIndex, line, index) => (line.startsWith(\"import \") ? index : currentIndex),\n -1,\n );\n\n if (lastImportIndex === -1) {\n throw new Error(\"Unsupported route file: could not find import block.\");\n }\n\n const importLine = `import ${options.componentName} from '${options.importSpecifier}';`;\n if (\n normalized.includes(importLine) ||\n normalized.includes(`route('${options.routePath}',`) ||\n normalized.includes(`route(\"${options.routePath}\",`)\n ) {\n throw new Error(`Route '${options.routePath}' is already registered.`);\n }\n\n lines.splice(lastImportIndex + 1, 0, importLine);\n\n const closingIndex = lines.map((line) => line.trim()).lastIndexOf(\"}\");\n if (closingIndex === -1) {\n throw new Error(\"Unsupported route file: could not find registration function body.\");\n }\n\n lines.splice(closingIndex, 0, ` route('${options.routePath}', ${options.componentName});`);\n return `${lines.join(\"\\n\")}\\n`;\n}\n\nfunction renderPageFile(options: {\n badge: string;\n componentName: string;\n routePath: string;\n title: string;\n}): string {\n return [\n \"import {\",\n \" Badge,\",\n \" Card,\",\n \" CardContent,\",\n \" CardDescription,\",\n \" CardHeader,\",\n \" CardTitle,\",\n \"} from '@askrjs/themes/components';\",\n \"import { Stack } from '@askrjs/themes/components';\",\n \"\",\n `export default function ${options.componentName}() {`,\n \" return (\",\n ' <Stack gap=\"5\">',\n ' <section class=\"page-heading\">',\n ' <Stack gap=\"2\">',\n ` <Badge>${options.badge}</Badge>`,\n ` <h1>${options.title}</h1>`,\n ' <p class=\"lead\">',\n ` Route-first scaffold for ${options.routePath}. Keep adapters, queries, and mutations outside the page as this surface grows.`,\n \" </p>\",\n \" </Stack>\",\n \" </section>\",\n \"\",\n \" <Card>\",\n \" <CardHeader>\",\n \" <CardTitle>Next step</CardTitle>\",\n \" <CardDescription>\",\n \" Move view logic into feature folders and keep loading, empty, error, and success states explicit.\",\n \" </CardDescription>\",\n \" </CardHeader>\",\n \" <CardContent>\",\n ' <Stack gap=\"3\">',\n \" <p>Start with a focused feature boundary instead of inline data fetching.</p>\",\n \" <p>Prefer resource(), derive(), and For once the page takes on real state.</p>\",\n \" </Stack>\",\n \" </CardContent>\",\n \" </Card>\",\n \" </Stack>\",\n \" );\",\n \"}\",\n \"\",\n ].join(\"\\n\");\n}\n\nasync function addPage(parsed: ParsedArgs, io: CliIo): Promise<number> {\n if (!parsed.name) {\n io.error(\"Page name is required.\");\n return 1;\n }\n\n const branch = parsed.branch.toLowerCase() as BranchName;\n const branchConfig = BRANCH_CONFIG[branch];\n if (!branchConfig) {\n io.error(`Unsupported branch '${parsed.branch}'. Use app or public.`);\n return 1;\n }\n\n const segments = normalizePageSegments(parsed.name);\n if (segments.length === 0) {\n io.error(\"Page name must contain at least one non-empty path segment.\");\n return 1;\n }\n\n const projectRoot = path.resolve(parsed.cwd);\n const routesFile = path.join(projectRoot, ...branchConfig.routesFile);\n if (!(await pathExists(routesFile))) {\n io.error(`Unsupported project layout. Expected route file: ${routesFile}`);\n io.error(\n \"askr add page currently supports route-first SPA projects created by `askr create spa`.\",\n );\n return 1;\n }\n\n const pageFile = path.join(projectRoot, ...branchConfig.pagesDir, ...segments).concat(\".tsx\");\n if ((await pathExists(pageFile)) && !parsed.force) {\n io.error(`Page file already exists: ${pageFile}`);\n io.error(\"Pass --force to overwrite the existing file.\");\n return 1;\n }\n\n const title = parsed.title || toTitleCase(toWords(segments));\n const componentName = buildComponentName(segments);\n let routePath = \"\";\n try {\n routePath = buildRoutePath(branch, segments, parsed.routePath);\n } catch (error) {\n io.error(error instanceof Error ? error.message : String(error));\n return 1;\n }\n\n const importSpecifier = toImportSpecifier(routesFile, pageFile);\n let updatedRoutes = \"\";\n try {\n const routeFileContent = await fs.readFile(routesFile, \"utf8\");\n updatedRoutes = createUpdatedRouteFile(routeFileContent, {\n componentName,\n importSpecifier,\n routePath,\n });\n } catch (error) {\n io.error(error instanceof Error ? error.message : String(error));\n return 1;\n }\n\n try {\n await fs.mkdir(path.dirname(pageFile), { recursive: true });\n await fs.writeFile(\n pageFile,\n renderPageFile({\n badge: branchConfig.badge,\n componentName,\n routePath,\n title,\n }),\n \"utf8\",\n );\n await fs.writeFile(routesFile, updatedRoutes, \"utf8\");\n } catch (error) {\n io.error(\"Failed to write generated page artifacts.\");\n io.error(error instanceof Error ? error.message : String(error));\n return 1;\n }\n\n io.log(`Added ${branch} page '${title}'.`);\n io.log(` File: ${path.relative(projectRoot, pageFile).replace(/\\\\/g, \"/\")}`);\n io.log(` Route: ${routePath}`);\n io.log(` Router: ${path.relative(projectRoot, routesFile).replace(/\\\\/g, \"/\")}`);\n return 0;\n}\n\nasync function addAction(parsed: ParsedArgs, io: CliIo): Promise<number> {\n if (!parsed.name) {\n io.error(\"Action name is required.\");\n return 1;\n }\n if (!parsed.routePath || !parsed.routePath.startsWith(\"/\")) {\n io.error(\"Action generation requires an absolute --route path.\");\n return 1;\n }\n\n const segments = normalizePageSegments(parsed.name);\n if (segments.length === 0) {\n io.error(\"Action name must contain at least one non-empty path segment.\");\n return 1;\n }\n\n const projectRoot = path.resolve(parsed.cwd);\n const slug = segments.join(\"-\");\n const handlerName = buildIdentifier(segments);\n const descriptorName = `${handlerName}Action`;\n const descriptorFile = path.join(projectRoot, \"src\", \"actions\", `${slug}.ts`);\n const handlerFile = path.join(projectRoot, \"src\", \"server\", \"actions\", `${slug}.ts`);\n const registryFile = path.join(projectRoot, \"src\", \"server\", \"action-registry.ts\");\n const authorizationFile = path.join(projectRoot, \"src\", \"action-authorizations.ts\");\n const testFile = path.join(projectRoot, \"tests\", \"actions\", `${slug}.test.ts`);\n\n if (!(await pathExists(registryFile)) || !(await pathExists(authorizationFile))) {\n io.error(\"Unsupported project layout. Expected an `askr create full-stack` project.\");\n return 1;\n }\n if (!parsed.force && ((await pathExists(descriptorFile)) || (await pathExists(handlerFile)))) {\n io.error(`Action '${slug}' already exists. Pass --force to replace its generated files.`);\n return 1;\n }\n\n try {\n const descriptor = renderActionDescriptor({\n descriptorName,\n routePath: parsed.routePath,\n slug,\n });\n const actions = await discoverDeclaredActions(projectRoot, {\n filePath: descriptorFile,\n content: descriptor,\n });\n await writeFileChanges([\n { filePath: descriptorFile, content: descriptor },\n {\n filePath: handlerFile,\n content: renderActionHandler({ descriptorName, handlerName, slug }),\n },\n { filePath: testFile, content: renderActionTest({ descriptorName, slug }) },\n { filePath: registryFile, content: renderServerActionRegistry(actions) },\n { filePath: authorizationFile, content: renderAuthorizationRegistry(actions) },\n ]);\n } catch (error) {\n io.error(\"Failed to write generated action artifacts.\");\n io.error(error instanceof Error ? error.message : String(error));\n return 1;\n }\n\n io.log(`Added action '${slug}' for ${parsed.routePath}.`);\n io.log(` Descriptor: ${path.relative(projectRoot, descriptorFile).replace(/\\\\/g, \"/\")}`);\n io.log(` Handler: ${path.relative(projectRoot, handlerFile).replace(/\\\\/g, \"/\")}`);\n io.log(` Test: ${path.relative(projectRoot, testFile).replace(/\\\\/g, \"/\")}`);\n return 0;\n}\n\nexport async function runAddCli(\n args: string[] = process.argv.slice(2),\n io: CliIo = console,\n): Promise<number> {\n const parsed = parseArgs(args);\n\n if (parsed.errors.length > 0) {\n for (const message of parsed.errors) {\n io.error(message);\n }\n return 1;\n }\n\n if (!parsed.command || parsed.help) {\n io.log(helpText());\n return 0;\n }\n\n if (parsed.command === \"page\") {\n return addPage(parsed, io);\n }\n\n if (parsed.command === \"action\") {\n return addAction(parsed, io);\n }\n\n io.error(`Unknown add command: ${parsed.command}`);\n io.error(\"Run `askr add --help` to see available commands.\");\n return 1;\n}\n\nasync function main(): Promise<void> {\n const code = await runAddCli(process.argv.slice(2));\n process.exit(code);\n}\n\nif (isDirectExecution(import.meta.url)) {\n void main();\n}\n"],"mappings":";;;;;AAmBA,eAAe,OAAO,OAAyC;CAC7D,MAAM,QAAQ,IACZ,MAAM,KAAK,aAAa,GAAG,GAAG,UAAU,EAAE,OAAO,KAAK,CAAC,CAAC,CAAC,YAAY,KAAA,CAAS,CAAC,CACjF;AACF;AAEA,eAAe,QAAQ,SAAoD;CACzE,IAAI,WAAW;CACf,KAAK,MAAM,UAAU,CAAC,GAAG,OAAO,CAAC,CAAC,QAAQ,GACxC,IAAI;EACF,IAAI,OAAO,aAAa,MAAM;GAC5B,MAAM,GAAG,GAAG,OAAO,UAAU,EAAE,OAAO,KAAK,CAAC;GAC5C;EACF;EACA,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,6CAA6C;EACtD,GAAG,MAAM,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,CAAC;EAC/D,OAAO;CACT;CAEA,GAAG,IAAI,iBAAiB,KAAK,QAAQ,OAAO,UAAU,EAAE;CACxD,GAAG,IAAI,iBAAiB,KAAK,SAAS,aAAa,cAAc,CAAC,CAAC,QAAQ,OAAO,GAAG,GAAG;CACxF,GAAG,IAAI,cAAc,KAAK,SAAS,aAAa,WAAW,CAAC,CAAC,QAAQ,OAAO,GAAG,GAAG;CAClF,GAAG,IAAI,WAAW,KAAK,SAAS,aAAa,QAAQ,CAAC,CAAC,QAAQ,OAAO,GAAG,GAAG;CAC5E,OAAO;AACT;AAEA,eAAsB,UACpB,OAAiB,QAAQ,KAAK,MAAM,CAAC,GACrC,KAAY,SACK;CACjB,MAAM,SAAS,UAAU,IAAI;CAE7B,IAAI,OAAO,OAAO,SAAS,GAAG;EAC5B,KAAK,MAAM,WAAW,OAAO,QAC3B,GAAG,MAAM,OAAO;EAElB,OAAO;CACT;CAEA,IAAI,CAAC,OAAO,WAAW,OAAO,MAAM;EAClC,GAAG,IAAI,SAAS,CAAC;EACjB,OAAO;CACT;CAEA,IAAI,OAAO,YAAY,QACrB,OAAO,QAAQ,QAAQ,EAAE;CAG3B,IAAI,OAAO,YAAY,UACrB,OAAO,UAAU,QAAQ,EAAE;CAG7B,GAAG,MAAM,wBAAwB,OAAO,SAAS;CACjD,GAAG,MAAM,kDAAkD;CAC3D,OAAO;AACT;AAEA,eAAe,OAAsB;CACnC,MAAM,OAAO,MAAM,UAAU,QAAQ,KAAK,MAAM,CAAC,CAAC;CAClD,QAAQ,KAAK,IAAI;AACnB;AAEA,IAAI,kBAAkB,OAAO,KAAK,GAAG,GACnC,KAAU"}
package/dist/cli.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"cli.js","names":[],"sources":["../src/bin/package-version.ts","../src/bin/cli.ts"],"sourcesContent":["import { readFileSync } from \"node:fs\";\nimport path from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\n\nlet cachedVersion: string | null = null;\n\nexport function getCliVersion(): string {\n if (cachedVersion) {\n return cachedVersion;\n }\n\n let currentDir = path.dirname(fileURLToPath(import.meta.url));\n\n while (true) {\n const packageJsonPath = path.join(currentDir, \"package.json\");\n\n try {\n const parsed = JSON.parse(readFileSync(packageJsonPath, \"utf8\")) as {\n name?: string;\n version?: string;\n };\n\n if (parsed.name === \"@askrjs/cli\" && typeof parsed.version === \"string\") {\n cachedVersion = parsed.version;\n return cachedVersion;\n }\n } catch {\n // Keep walking upward until we find the package root.\n }\n\n const parentDir = path.dirname(currentDir);\n if (parentDir === currentDir) {\n break;\n }\n currentDir = parentDir;\n }\n\n throw new Error(\"Could not determine @askrjs/cli package version.\");\n}\n","#!/usr/bin/env node\n\nimport { runAddCli } from \"./add\";\nimport { runCreateCli } from \"./create\";\nimport { isDirectExecution } from \"./is-direct-execution\";\nimport { getCliVersion } from \"./package-version\";\nimport { runOpenApiCli } from \"./openapi\";\nimport { runSkillsCli } from \"./skills\";\nimport { runSsgCli } from \"./ssg\";\nimport { runUpdateCli } from \"./update\";\n\ntype CliIo = Pick<Console, \"error\" | \"log\">;\n\nfunction printHelp(io: CliIo = console): void {\n io.log(\"askr - Unified CLI for the Askr platform\");\n io.log(\"\");\n io.log(\"Usage:\");\n io.log(\" askr <command> [args]\");\n io.log(\"\");\n io.log(\"Commands:\");\n io.log(\" add Generate pages or declared actions into an Askr project\");\n io.log(\" create Create a new Askr app from a template or product prompt\");\n io.log(\" openapi Generate or check an OpenAPI YAML artifact\");\n io.log(\" skills Install or sync Askr agent skills\");\n io.log(\" ssg Run static-site generation\");\n io.log(\" update Plan or apply dependency manifest updates\");\n io.log(\"\");\n io.log(\"Options:\");\n io.log(\" --help, -h Show help\");\n io.log(\" --version, -v Print CLI version\");\n io.log(\"\");\n io.log(\"Examples:\");\n io.log(\" askr create startkit my-app\");\n io.log(' askr create --prompt \"Agent workflow console with approvals\"');\n io.log(\" askr add page audit-log\");\n io.log(\" askr add action approve-request --route /requests/{id}\");\n io.log(\" askr skills install\");\n io.log(\" askr openapi --check\");\n io.log(\" askr skills review foundation --cwd ./candidate-app\");\n io.log(\" askr ssg --config ./ssg.config.ts --output ./dist/static\");\n io.log(\" askr update -u\");\n}\n\nexport async function runCli(\n args: string[] = process.argv.slice(2),\n io: CliIo = console,\n): Promise<number> {\n const command = args[0];\n\n if (command === \"--version\" || command === \"-v\") {\n io.log(getCliVersion());\n return 0;\n }\n\n if (!command || command === \"--help\" || command === \"-h\") {\n printHelp(io);\n return 0;\n }\n\n if (command === \"create\") {\n return runCreateCli(args.slice(1), io);\n }\n\n if (command === \"add\") {\n return runAddCli(args.slice(1), io);\n }\n\n if (command === \"ssg\") {\n return runSsgCli(args.slice(1), undefined, io);\n }\n\n if (command === \"openapi\") {\n return runOpenApiCli(args.slice(1), io);\n }\n\n if (command === \"skills\") {\n return runSkillsCli(args.slice(1), io);\n }\n\n if (command === \"update\") {\n return runUpdateCli(args.slice(1), io);\n }\n\n io.error(`Unknown command: ${command}`);\n io.error(\"Run `askr --help` to see available commands.\");\n return 1;\n}\n\nasync function main(): Promise<void> {\n const code = await runCli(process.argv.slice(2));\n process.exit(code);\n}\n\nif (isDirectExecution(import.meta.url)) {\n void main();\n}\n"],"mappings":";;;;;;;;;;;;AAIA,IAAI,gBAA+B;AAEnC,SAAgB,gBAAwB;CACtC,IAAI,eACF,OAAO;CAGT,IAAI,aAAa,KAAK,QAAQ,cAAc,OAAO,KAAK,GAAG,CAAC;CAE5D,OAAO,MAAM;EACX,MAAM,kBAAkB,KAAK,KAAK,YAAY,cAAc;EAE5D,IAAI;GACF,MAAM,SAAS,KAAK,MAAM,aAAa,iBAAiB,MAAM,CAAC;GAK/D,IAAI,OAAO,SAAS,iBAAiB,OAAO,OAAO,YAAY,UAAU;IACvE,gBAAgB,OAAO;IACvB,OAAO;GACT;EACF,QAAQ,CAER;EAEA,MAAM,YAAY,KAAK,QAAQ,UAAU;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ACd,OAAO,UAAU,KAAK,MAAM,CAAC,GAAG,KAAA,GAAW,EAAE;CAG/C,IAAI,YAAY,WACd,OAAO,cAAc,KAAK,MAAM,CAAC,GAAG,EAAE;CAGxC,IAAI,YAAY,UACd,OAAO,aAAa,KAAK,MAAM,CAAC,GAAG,EAAE;CAGvC,IAAI,YAAY,UACd,OAAO,aAAa,KAAK,MAAM,CAAC,GAAG,EAAE;CAGvC,GAAG,MAAM,oBAAoB,SAAS;CACtC,GAAG,MAAM,8CAA8C;CACvD,OAAO;AACT;AAEA,eAAe,OAAsB;CACnC,MAAM,OAAO,MAAM,OAAO,QAAQ,KAAK,MAAM,CAAC,CAAC;CAC/C,QAAQ,KAAK,IAAI;AACnB;AAEA,IAAI,kBAAkB,OAAO,KAAK,GAAG,GACnC,KAAU"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"create.js","names":[],"sources":["../src/bin/create.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport { spawnSync } from \"node:child_process\";\nimport fs from \"node:fs/promises\";\nimport path from \"node:path\";\nimport readline from \"node:readline\";\nimport { fileURLToPath } from \"node:url\";\nimport { isDirectExecution } from \"./is-direct-execution\";\nimport { installBundledSkills } from \"./skills\";\n\ntype CliIo = Pick<Console, \"error\" | \"log\">;\ntype PackageManager = \"npm\" | \"yarn\";\n\nconst TEMPLATE_LABELS = {\n \"full-stack\": \"Full-stack\",\n spa: \"SPA\",\n ssr: \"SSR\",\n ssg: \"SSG\",\n startkit: \"StartKit\",\n} as const;\n\ntype TemplateType = keyof typeof TEMPLATE_LABELS;\n\ntype Capability =\n | \"agent-workflows\"\n | \"api-integration\"\n | \"auth-access\"\n | \"dashboard-charts\"\n | \"design-system\"\n | \"file-upload-artifacts\"\n | \"forms-tables-crud\"\n | \"query-mutation\"\n | \"realtime-streaming\"\n | \"routing-layouts\"\n | \"ssr-ssg\";\n\ntype TemplateSelectionMode = \"default\" | \"explicit\" | \"interactive\" | \"prompt\";\n\ninterface ParsedArgs {\n positional: string[];\n install: boolean;\n help: boolean;\n promptText: string;\n skills: boolean;\n errors: string[];\n}\n\ninterface TemplateSelection {\n mode: TemplateSelectionMode;\n reason: string;\n matchedTerms?: string[];\n}\n\ninterface Blueprint {\n schemaVersion: number;\n appName: string;\n template: TemplateType;\n sourcePrompt: string | null;\n templateSelection: TemplateSelection;\n capabilities: Capability[];\n recommendedSkills: string[];\n guardrails: string[];\n}\n\nconst TEMPLATE_TYPES = new Set<TemplateType>([\"startkit\", \"spa\", \"ssr\", \"ssg\", \"full-stack\"]);\nconst TEMPLATE_ORDER: TemplateType[] = [\"startkit\", \"spa\", \"ssr\", \"ssg\", \"full-stack\"];\nconst PROMPT_STOP_WORDS = new Set([\n \"a\",\n \"an\",\n \"and\",\n \"app\",\n \"application\",\n \"build\",\n \"create\",\n \"for\",\n \"from\",\n \"in\",\n \"into\",\n \"me\",\n \"of\",\n \"or\",\n \"platform\",\n \"product\",\n \"that\",\n \"the\",\n \"to\",\n \"with\",\n]);\nconst TEMPLATE_DEFAULT_CAPABILITIES: Record<TemplateType, Capability[]> = {\n \"full-stack\": [\n \"routing-layouts\",\n \"ssr-ssg\",\n \"api-integration\",\n \"auth-access\",\n \"forms-tables-crud\",\n \"query-mutation\",\n \"design-system\",\n ],\n spa: [\"routing-layouts\", \"dashboard-charts\", \"agent-workflows\", \"design-system\"],\n ssr: [\"routing-layouts\", \"ssr-ssg\", \"query-mutation\", \"design-system\"],\n ssg: [\"routing-layouts\", \"ssr-ssg\", \"design-system\"],\n startkit: [\"routing-layouts\", \"auth-access\", \"forms-tables-crud\", \"design-system\"],\n};\nconst TEMPLATE_PROMPT_RULES: Array<{\n template: TemplateType;\n reason: string;\n terms: string[];\n weight: number;\n}> = [\n {\n template: \"full-stack\",\n reason: \"Prompt requires server APIs, authenticated actions, and request-time rendering.\",\n terms: [\n \"api and ssr\",\n \"authenticated api\",\n \"backend and frontend\",\n \"full stack\",\n \"full-stack\",\n \"server action\",\n ],\n weight: 6,\n },\n {\n template: \"ssg\",\n reason: \"Prompt emphasizes static content or documentation publishing.\",\n terms: [\n \"blog\",\n \"content\",\n \"docs\",\n \"documentation\",\n \"knowledge base\",\n \"landing page\",\n \"marketing\",\n \"static\",\n ],\n weight: 4,\n },\n {\n template: \"ssr\",\n reason: \"Prompt emphasizes server rendering or request-time HTML.\",\n terms: [\n \"edge render\",\n \"personalized seo\",\n \"request-time\",\n \"server render\",\n \"server rendered\",\n \"server-rendered\",\n \"ssr\",\n ],\n weight: 4,\n },\n {\n template: \"spa\",\n reason: \"Prompt emphasizes interactive workflows, control planes, or agent operations.\",\n terms: [\n \"agent\",\n \"approval\",\n \"assistant\",\n \"console\",\n \"control plane\",\n \"dashboard\",\n \"operations\",\n \"realtime\",\n \"stream\",\n \"workflow\",\n ],\n weight: 3,\n },\n {\n template: \"startkit\",\n reason: \"Prompt emphasizes auth, workspace, or back-office product surfaces.\",\n terms: [\n \"account\",\n \"admin\",\n \"auth\",\n \"billing\",\n \"login\",\n \"portal\",\n \"settings\",\n \"tenant\",\n \"workspace\",\n ],\n weight: 3,\n },\n];\nconst CAPABILITY_RULES: Array<{ capability: Capability; terms: string[] }> = [\n {\n capability: \"agent-workflows\",\n terms: [\"agent\", \"approval\", \"artifact\", \"assistant\", \"prompt\", \"run\", \"tool\", \"workflow\"],\n },\n { capability: \"api-integration\", terms: [\"api\", \"backend\", \"graphql\", \"rest\", \"sdk\", \"webhook\"] },\n {\n capability: \"auth-access\",\n terms: [\"access\", \"auth\", \"login\", \"permission\", \"role\", \"session\", \"tenant\", \"workspace\"],\n },\n {\n capability: \"dashboard-charts\",\n terms: [\"analytics\", \"chart\", \"dashboard\", \"kpi\", \"metric\", \"report\"],\n },\n {\n capability: \"file-upload-artifacts\",\n terms: [\"artifact\", \"attachment\", \"document\", \"file\", \"upload\"],\n },\n { capability: \"forms-tables-crud\", terms: [\"crud\", \"edit\", \"form\", \"record\", \"table\"] },\n {\n capability: \"query-mutation\",\n terms: [\"cache\", \"data\", \"mutation\", \"query\", \"resource\", \"sync\"],\n },\n {\n capability: \"realtime-streaming\",\n terms: [\"event\", \"live\", \"realtime\", \"stream\", \"subscription\", \"websocket\"],\n },\n {\n capability: \"ssr-ssg\",\n terms: [\"content\", \"docs\", \"seo\", \"server render\", \"ssg\", \"ssr\", \"static\"],\n },\n];\nconst CAPABILITY_LABELS: Record<Capability, string> = {\n \"agent-workflows\": \"Agent workflows\",\n \"api-integration\": \"API integration\",\n \"auth-access\": \"Authentication and access\",\n \"dashboard-charts\": \"Dashboards and charts\",\n \"design-system\": \"Design system and theming\",\n \"file-upload-artifacts\": \"Files and artifacts\",\n \"forms-tables-crud\": \"Forms, tables, and CRUD\",\n \"query-mutation\": \"Queries and mutations\",\n \"realtime-streaming\": \"Realtime and streaming\",\n \"routing-layouts\": \"Routing and layouts\",\n \"ssr-ssg\": \"SSR or SSG\",\n};\nconst CORE_RECOMMENDED_SKILLS = [\n \"askr-agent-execution\",\n \"askr-mental-model\",\n \"askr-project-structure\",\n \"askr-routing-layouts\",\n \"askr-runtime-reactivity\",\n \"askr-testing-determinism\",\n];\nconst CAPABILITY_SKILL_MAP: Record<Capability, string[]> = {\n \"agent-workflows\": [\"askr-agent-workflows\", \"askr-error-loading-empty\"],\n \"api-integration\": [\"askr-api-integration\", \"askr-env-config\"],\n \"auth-access\": [\"askr-auth-access\"],\n \"dashboard-charts\": [\"askr-dashboard-charts\"],\n \"design-system\": [\"askr-theming\"],\n \"file-upload-artifacts\": [\"askr-file-upload-artifacts\"],\n \"forms-tables-crud\": [\"askr-forms-tables-crud\", \"askr-error-loading-empty\"],\n \"query-mutation\": [\"askr-resources-data\", \"askr-query-mutation\", \"askr-error-loading-empty\"],\n \"realtime-streaming\": [\"askr-realtime-streaming\"],\n \"routing-layouts\": [\"askr-routing-layouts\"],\n \"ssr-ssg\": [\"askr-ssr-ssg\"],\n};\nconst FOUNDATION_SKILL_SEQUENCE = [\n \"askr-agent-execution\",\n \"askr-mental-model\",\n \"askr-project-structure\",\n \"askr-routing-layouts\",\n \"askr-runtime-reactivity\",\n];\nconst VALIDATION_SKILLS = [\"askr-testing-determinism\"];\nconst BROAD_PLANNING_SKILLS = [\"askr-app-builder\"];\nconst SKILL_SEQUENCE = [\n ...FOUNDATION_SKILL_SEQUENCE,\n \"askr-resources-data\",\n \"askr-query-mutation\",\n \"askr-error-loading-empty\",\n \"askr-forms-tables-crud\",\n \"askr-auth-access\",\n \"askr-agent-workflows\",\n \"askr-dashboard-charts\",\n \"askr-api-integration\",\n \"askr-env-config\",\n \"askr-file-upload-artifacts\",\n \"askr-realtime-streaming\",\n \"askr-ssr-ssg\",\n \"askr-theming\",\n \"askr-ui-composition\",\n \"askr-design-system\",\n \"askr-accessibility\",\n \"askr-observability-debugging\",\n ...VALIDATION_SKILLS,\n ...BROAD_PLANNING_SKILLS,\n];\nconst SKILL_SUMMARIES: Record<string, string> = {\n \"askr-accessibility\": \"Review keyboard, focus, announcements, and semantic coverage.\",\n \"askr-agent-execution\": \"Read the repo in the right order and validate narrowly.\",\n \"askr-agent-workflows\": \"Model runs, approvals, timelines, and audit-friendly states.\",\n \"askr-api-integration\": \"Keep DTO mapping, retries, and transport boundaries out of pages.\",\n \"askr-app-builder\": \"Use only when a task spans multiple app surfaces and needs a broad plan.\",\n \"askr-auth-access\": \"Keep access rules in route metadata and auth workflows, not pages.\",\n \"askr-dashboard-charts\": \"Add charts without bypassing route, state, or theming conventions.\",\n \"askr-design-system\": \"Use only when shaping reusable product patterns beyond one screen.\",\n \"askr-env-config\": \"Keep environment-specific configuration and secrets handling outside UI.\",\n \"askr-error-loading-empty\":\n \"Represent loading, empty, stale, retry, and pending-write truthfully.\",\n \"askr-file-upload-artifacts\":\n \"Add uploads and artifact flows without breaking ownership boundaries.\",\n \"askr-forms-tables-crud\":\n \"Build forms, tables, filters, and destructive actions with stable ownership.\",\n \"askr-mental-model\": \"Choose native Askr primitives and reject React-shaped defaults.\",\n \"askr-observability-debugging\": \"Preserve correlation IDs and diagnosable failure context.\",\n \"askr-project-structure\": \"Place routes, features, shared helpers, and adapters predictably.\",\n \"askr-query-mutation\": \"Use shared keyed reads and mutations with explicit invalidation.\",\n \"askr-realtime-streaming\": \"Handle reconnects, cursors, and bounded live lists.\",\n \"askr-resources-data\": \"Own route-scoped async reads with resource() and cancellation.\",\n \"askr-routing-layouts\": \"Keep one obvious route tree, shell boundary, and navigation path.\",\n \"askr-runtime-reactivity\": \"Apply state(), derive(), selector(), and For with stable call order.\",\n \"askr-ssr-ssg\": \"Keep routes deterministic and render paths hydration-safe.\",\n \"askr-testing-determinism\":\n \"Finish with the narrowest executable check for the changed contract.\",\n \"askr-theming\": \"Apply the theme layer, tokens, and shell primitives before custom styling.\",\n \"askr-ui-composition\": \"Use askr-ui behavior primitives before inventing local components.\",\n};\nconst TEMPLATE_INSPECT_PATHS: Record<TemplateType, string[]> = {\n \"full-stack\": [\n \"AGENTS.md\",\n \"src/routes.tsx\",\n \"src/actions/create-message.ts\",\n \"src/schemas.ts\",\n \"src/server/app.ts\",\n \"src/server/action-registry.ts\",\n \"src/server/dependencies.ts\",\n \"src/server/entry-server.ts\",\n \"server.ts\",\n ],\n spa: [\n \"AGENTS.md\",\n \"src/main.tsx\",\n \"src/pages/_layout.tsx\",\n \"src/pages/_routes.tsx\",\n \"src/pages/public/_layout.tsx\",\n \"src/pages/public/_routes.tsx\",\n \"src/pages/public/home.tsx\",\n \"src/pages/auth/_layout.tsx\",\n \"src/pages/auth/_routes.tsx\",\n \"src/pages/auth/login.tsx\",\n \"src/pages/app/_layout.tsx\",\n \"src/pages/app/_routes.tsx\",\n \"src/pages/app/admin-home.tsx\",\n \"src/styles.css\",\n \"src/styles/reset.css\",\n \"src/styles/tokens.css\",\n \"src/styles/theme.css\",\n \"src/styles/layout.css\",\n \"src/styles/components.css\",\n ],\n ssr: [\"AGENTS.md\", \"src/main.tsx\", \"src/server-entry.tsx\", \"src/pages/_routes.tsx\", \"server.ts\"],\n ssg: [\n \"AGENTS.md\",\n \"src/main.tsx\",\n \"src/routes.tsx\",\n \"src/components/site-shell.tsx\",\n \"src/pages/home.tsx\",\n \"ssg.config.ts\",\n ],\n startkit: [\n \"AGENTS.md\",\n \"src/main.tsx\",\n \"src/router.tsx\",\n \"src/routes/index.ts\",\n \"src/pages/workspace/_layout.tsx\",\n ],\n};\nconst TEMPLATE_GOLDEN_EXAMPLES: Record<TemplateType, string[]> = {\n \"full-stack\": [\n \"src/routes.tsx\",\n \"src/pages/home.tsx\",\n \"src/actions/create-message.ts\",\n \"src/server/action-registry.ts\",\n \"src/server/app.ts\",\n ],\n spa: [\n \"src/pages/public/home.tsx\",\n \"src/pages/auth/login.tsx\",\n \"src/pages/app/admin-home.tsx\",\n \"src/features/operations/operations.query.ts\",\n ],\n ssr: [\"src/main.tsx\", \"src/pages/_routes.tsx\", \"server.ts\"],\n ssg: [\"src/main.tsx\", \"src/routes.tsx\", \"src/components/site-shell.tsx\", \"ssg.config.ts\"],\n startkit: [\n \"src/routes/index.ts\",\n \"src/pages/workspace/accounts/index.tsx\",\n \"src/features/accounts/account-table.tsx\",\n ],\n};\nconst BLUEPRINT_GUARDRAILS = [\n \"Keep the route-first file structure so new features land where builders expect them.\",\n \"Use state(), derive(), resource(), and selector() for reactive state and derived views.\",\n \"Use For for keyed or dynamic list rendering instead of ad hoc array mapping.\",\n \"Keep adapters, queries, and mutations outside page files so data boundaries stay deterministic.\",\n \"Model loading, empty, error, and success states explicitly and keep them testable.\",\n];\n\nfunction isTemplateType(value: string): value is TemplateType {\n return TEMPLATE_TYPES.has(value as TemplateType);\n}\n\nfunction helpText(): string {\n return [\n \"askr create - Project scaffolding for Askr\",\n \"\",\n \"Usage:\",\n \" askr create [template] <name> [--prompt <text>] [--no-install] [--no-skills]\",\n \" askr create --prompt <text> [name] [--no-install] [--no-skills]\",\n \"\",\n \"Templates:\",\n \" startkit, spa, ssr, ssg, full-stack\",\n \"\",\n \"Options:\",\n \" --prompt <text> Infer the best template from a product prompt and emit a builder blueprint\",\n \" --no-install Skip dependency installation\",\n \" --no-skills Skip bundled Askr skill installation into skills/\",\n \" --help, -h Show help\",\n \"\",\n \"Examples:\",\n \" askr create startkit my-app\",\n \" askr create full-stack my-app\",\n \" askr create startkit acme-dashboard\",\n ' askr create --prompt \"Agent workflow console with approvals and analytics\"',\n ].join(\"\\n\");\n}\n\nasync function prompt(question: string): Promise<string> {\n const rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout,\n });\n\n return new Promise((resolveAnswer) => {\n rl.question(question, (answer) => {\n rl.close();\n resolveAnswer(answer);\n });\n });\n}\n\nfunction detectPm(): PackageManager {\n const ua = process.env.npm_config_user_agent || \"\";\n if (ua.startsWith(\"yarn\")) return \"yarn\";\n if (ua.startsWith(\"npm\")) return \"npm\";\n\n return \"npm\";\n}\n\nconst TEMPLATE_COPY_EXCLUDES = new Set([\n \"node_modules\",\n \"dist\",\n \".vite\",\n \"coverage\",\n \"package-lock.json\",\n \"pnpm-lock.yaml\",\n \"yarn.lock\",\n \"bun.lock\",\n \"bun.lockb\",\n]);\n\nasync function copyDir(\n src: string,\n dest: string,\n replacements: { appName: string },\n): Promise<void> {\n const entries = await fs.readdir(src, { withFileTypes: true });\n await fs.mkdir(dest, { recursive: true });\n\n for (const entry of entries) {\n if (TEMPLATE_COPY_EXCLUDES.has(entry.name)) {\n continue;\n }\n\n const srcPath = path.join(src, entry.name);\n const sourceName = entry.name === \"gitignore.template\" ? \".gitignore\" : entry.name;\n const outputName = sourceName.replace(/\\{\\{\\s*appName\\s*\\}\\}/g, replacements.appName);\n const destPath = path.join(dest, outputName);\n\n if (entry.isDirectory()) {\n await copyDir(srcPath, destPath, replacements);\n continue;\n }\n\n const buffer = await fs.readFile(srcPath);\n const content = buffer.toString(\"utf8\");\n const replaced = content\n .replace(/\\{\\{\\s*appName\\s*\\}\\}/g, replacements.appName)\n .replace(/\\{\\{appName\\}\\}/g, replacements.appName);\n\n await fs.writeFile(destPath, replaced, \"utf8\");\n }\n}\n\nasync function pathExists(filePath: string): Promise<boolean> {\n return Boolean(await fs.stat(filePath).catch(() => null));\n}\n\nfunction cliDir(): string {\n return path.dirname(fileURLToPath(import.meta.url));\n}\n\nasync function findTemplateDir(templateType: TemplateType): Promise<string> {\n const base = cliDir();\n const candidates = [\n path.resolve(base, \"..\", \"..\", \"templates\", templateType),\n path.resolve(base, \"..\", \"templates\", templateType),\n path.resolve(base, \"templates\", templateType),\n ];\n\n for (const candidate of candidates) {\n if (await pathExists(candidate)) {\n return candidate;\n }\n }\n\n return candidates[0];\n}\n\nfunction parseArgs(args: string[]): ParsedArgs {\n const positional: string[] = [];\n let install = true;\n let help = false;\n let promptText = \"\";\n let skills = true;\n const errors: string[] = [];\n\n for (let i = 0; i < args.length; i += 1) {\n const arg = args[i];\n if (arg === \"--no-install\") {\n install = false;\n } else if (arg === \"--no-skills\") {\n skills = false;\n } else if (arg === \"--prompt\") {\n if (i + 1 >= args.length) {\n errors.push(\"Missing value for --prompt\");\n } else {\n promptText = normalizePromptText(args[i + 1]);\n i += 1;\n }\n } else if (arg === \"--help\" || arg === \"-h\") {\n help = true;\n } else {\n positional.push(arg);\n }\n }\n\n return { positional, install, help, promptText, skills, errors };\n}\n\nfunction normalizePromptText(promptText: string): string {\n return promptText.trim().replace(/\\s+/g, \" \");\n}\n\nfunction normalizeSearchText(value: string): string {\n return ` ${value\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, \" \")\n .trim()} `;\n}\n\nfunction scoreTerms(text: string, terms: string[]): string[] {\n const normalizedText = normalizeSearchText(text);\n\n return terms.filter((term) => {\n const normalizedTerm = normalizeSearchText(term).trim();\n if (!normalizedTerm) {\n return false;\n }\n\n return (\n normalizedText.includes(` ${normalizedTerm} `) ||\n normalizedText.includes(` ${normalizedTerm}s `) ||\n normalizedText.includes(` ${normalizedTerm}es `)\n );\n });\n}\n\nfunction inferTemplateFromPrompt(promptText: string): {\n matchedTerms: string[];\n reason: string;\n templateType: TemplateType;\n} {\n const normalizedPrompt = promptText.toLowerCase();\n const templateScores: Record<TemplateType, number> = {\n \"full-stack\": 0,\n startkit: 1,\n spa: 0,\n ssr: 0,\n ssg: 0,\n };\n const templateMatches: Record<TemplateType, string[]> = {\n \"full-stack\": [],\n startkit: [],\n spa: [],\n ssr: [],\n ssg: [],\n };\n const templateReasons: Record<TemplateType, string> = {\n \"full-stack\": \"Prompt requires server APIs, authenticated actions, and request-time rendering.\",\n startkit:\n \"No stronger prompt signal was detected, so the CLI defaulted to the full app startkit.\",\n spa: \"Prompt emphasizes interactive workflows, control planes, or agent operations.\",\n ssr: \"Prompt emphasizes server rendering or request-time HTML.\",\n ssg: \"Prompt emphasizes static content or documentation publishing.\",\n };\n\n for (const rule of TEMPLATE_PROMPT_RULES) {\n const matches = scoreTerms(normalizedPrompt, rule.terms);\n if (matches.length === 0) {\n continue;\n }\n\n templateScores[rule.template] += matches.length * rule.weight;\n templateMatches[rule.template].push(...matches);\n templateReasons[rule.template] = rule.reason;\n }\n\n let selectedTemplate = TEMPLATE_ORDER[0];\n for (const templateType of TEMPLATE_ORDER.slice(1)) {\n if (templateScores[templateType] > templateScores[selectedTemplate]) {\n selectedTemplate = templateType;\n }\n }\n\n return {\n matchedTerms: [...new Set(templateMatches[selectedTemplate])],\n reason: templateReasons[selectedTemplate],\n templateType: selectedTemplate,\n };\n}\n\nfunction deriveAppNameFromPrompt(promptText: string): string {\n const tokens = promptText\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, \" \")\n .split(/\\s+/)\n .map((token) => token.trim())\n .filter(Boolean)\n .filter((token) => !PROMPT_STOP_WORDS.has(token))\n .filter((token) => token.length > 2);\n\n const nameParts: string[] = [];\n for (const token of tokens) {\n if (!nameParts.includes(token)) {\n nameParts.push(token);\n }\n\n if (nameParts.length === 3) {\n break;\n }\n }\n\n return nameParts.join(\"-\") || \"askr-app\";\n}\n\nfunction buildCapabilities(templateType: TemplateType, promptText: string): Capability[] {\n const capabilities = new Set<Capability>(TEMPLATE_DEFAULT_CAPABILITIES[templateType] || []);\n\n if (promptText) {\n const normalizedPrompt = promptText.toLowerCase();\n for (const rule of CAPABILITY_RULES) {\n if (scoreTerms(normalizedPrompt, rule.terms).length > 0) {\n capabilities.add(rule.capability);\n }\n }\n }\n\n return (Object.keys(CAPABILITY_LABELS) as Capability[]).filter((capability) =>\n capabilities.has(capability),\n );\n}\n\nfunction buildRecommendedSkills(options: {\n capabilities: Capability[];\n promptText: string;\n}): string[] {\n const { capabilities, promptText } = options;\n const recommendedSkills = new Set<string>(CORE_RECOMMENDED_SKILLS);\n\n for (const capability of capabilities) {\n for (const skill of CAPABILITY_SKILL_MAP[capability] || []) {\n recommendedSkills.add(skill);\n }\n }\n\n if (promptText.trim().length > 0) {\n recommendedSkills.add(\"askr-app-builder\");\n }\n\n const orderedSkills = SKILL_SEQUENCE.filter((skill) => recommendedSkills.has(skill));\n const remainingSkills = [...recommendedSkills]\n .filter((skill) => !SKILL_SEQUENCE.includes(skill))\n .sort();\n\n return [...orderedSkills, ...remainingSkills];\n}\n\nfunction renderSkillBullets(skills: string[]): string[] {\n return skills.map((skill) => {\n const summary = SKILL_SUMMARIES[skill];\n return summary ? `- ${skill} - ${summary}` : `- ${skill}`;\n });\n}\n\nfunction pickSkills(source: string[], allowed: string[]): string[] {\n const allowedSet = new Set(allowed);\n return source.filter((skill) => allowedSet.has(skill));\n}\n\nfunction pickWorkflowSkills(skills: string[]): string[] {\n const excluded = new Set([\n ...FOUNDATION_SKILL_SEQUENCE,\n ...VALIDATION_SKILLS,\n ...BROAD_PLANNING_SKILLS,\n ]);\n return skills.filter((skill) => !excluded.has(skill));\n}\n\nfunction renderListSection(title: string, items: string[]): string[] {\n if (items.length === 0) {\n return [];\n }\n\n return [title, ...items, \"\"];\n}\n\nfunction buildFollowUpPrompts(capabilities: Capability[]): string[] {\n const suggestions: string[] = [];\n\n if (capabilities.includes(\"agent-workflows\")) {\n suggestions.push(\n \"Add an agent run detail screen with prompt, timeline, approvals, and artifact history.\",\n );\n }\n\n if (capabilities.includes(\"dashboard-charts\")) {\n suggestions.push(\n \"Connect dashboard metrics through adapters and queries while preserving loading, empty, and error states.\",\n );\n }\n\n if (capabilities.includes(\"auth-access\")) {\n suggestions.push(\n \"Wire route access and session state without moving auth logic into page components.\",\n );\n }\n\n if (capabilities.includes(\"forms-tables-crud\")) {\n suggestions.push(\n \"Add a CRUD feature using feature-scoped forms, tables, and deterministic tests.\",\n );\n }\n\n if (capabilities.includes(\"ssr-ssg\")) {\n suggestions.push(\n \"Extend SSR or SSG routes while keeping route registration deterministic and environment-safe.\",\n );\n }\n\n suggestions.push(\n \"Use the bundled Askr skills before adding new features so generated code stays idiomatic.\",\n );\n return suggestions.slice(0, 4);\n}\n\nfunction buildBlueprint(options: {\n appName: string;\n promptText: string;\n templateSelection: TemplateSelection;\n templateType: TemplateType;\n}): Blueprint {\n const capabilities = buildCapabilities(options.templateType, options.promptText);\n return {\n schemaVersion: 1,\n appName: options.appName,\n template: options.templateType,\n sourcePrompt: options.promptText || null,\n templateSelection: options.templateSelection,\n capabilities,\n recommendedSkills: buildRecommendedSkills({ capabilities, promptText: options.promptText }),\n guardrails: BLUEPRINT_GUARDRAILS,\n };\n}\n\nfunction renderPromptBlock(promptText: string | null): string {\n if (!promptText) {\n return \"No app prompt was provided. This project was scaffolded from explicit CLI arguments.\";\n }\n\n return promptText\n .split(/\\r?\\n/)\n .filter(Boolean)\n .map((line) => `> ${line}`)\n .join(\"\\n\");\n}\n\nfunction renderBuilderBrief(blueprint: Blueprint): string {\n const foundationSkills = pickSkills(blueprint.recommendedSkills, FOUNDATION_SKILL_SEQUENCE);\n const workflowSkills = pickWorkflowSkills(blueprint.recommendedSkills);\n const validationSkills = pickSkills(blueprint.recommendedSkills, VALIDATION_SKILLS);\n const planningSkills = pickSkills(blueprint.recommendedSkills, BROAD_PLANNING_SKILLS);\n\n return [\n \"# Askr Builder Brief\",\n \"\",\n `- App name: ${blueprint.appName}`,\n `- Template: ${blueprint.template}`,\n `- Selection mode: ${blueprint.templateSelection.mode}`,\n `- Selection reason: ${blueprint.templateSelection.reason}`,\n \"\",\n \"## Prompt\",\n renderPromptBlock(blueprint.sourcePrompt),\n \"\",\n \"## Capabilities\",\n ...blueprint.capabilities.map((capability) => `- ${CAPABILITY_LABELS[capability]}`),\n \"\",\n \"## Inspect First In This Scaffold\",\n ...TEMPLATE_INSPECT_PATHS[blueprint.template].map((item) => `- ${item}`),\n \"\",\n \"## Skill Execution Order\",\n ...renderListSection(\"### Start here\", renderSkillBullets(foundationSkills)),\n ...renderListSection(\n \"### Pull in next when the task needs it\",\n renderSkillBullets(workflowSkills),\n ),\n ...renderListSection(\"### Finish with validation\", renderSkillBullets(validationSkills)),\n ...renderListSection(\n \"### Use only for broad multi-surface planning\",\n renderSkillBullets(planningSkills),\n ),\n \"## All Recommended Skills\",\n ...blueprint.recommendedSkills.map((skill) => `- ${skill}`),\n \"\",\n \"## Golden Examples In This Scaffold\",\n ...TEMPLATE_GOLDEN_EXAMPLES[blueprint.template].map((item) => `- ${item}`),\n \"\",\n \"## Guardrails\",\n ...blueprint.guardrails.map((guardrail) => `- ${guardrail}`),\n \"\",\n \"## Suggested builder prompts\",\n ...buildFollowUpPrompts(blueprint.capabilities).map((item) => `- ${item}`),\n \"\",\n ].join(\"\\n\");\n}\n\nasync function writeBlueprintFiles(target: string, blueprint: Blueprint): Promise<void> {\n const blueprintRoot = path.join(target, \".askr\");\n await fs.mkdir(blueprintRoot, { recursive: true });\n await fs.writeFile(\n path.join(blueprintRoot, \"blueprint.json\"),\n `${JSON.stringify(blueprint, null, 2)}\\n`,\n \"utf8\",\n );\n await fs.writeFile(\n path.join(blueprintRoot, \"builder-brief.md\"),\n renderBuilderBrief(blueprint),\n \"utf8\",\n );\n}\n\nexport async function runCreateCli(\n args: string[] = process.argv.slice(2),\n io: CliIo = console,\n): Promise<number> {\n const parsed = parseArgs(args);\n\n if (parsed.errors.length > 0) {\n for (const message of parsed.errors) {\n io.error(message);\n }\n return 1;\n }\n\n if (parsed.help) {\n io.log(helpText());\n return 0;\n }\n\n let templateType: TemplateType = \"startkit\";\n let name = \"\";\n let templateSelection: TemplateSelection = {\n mode: \"default\",\n reason:\n \"No stronger prompt signal was detected, so the CLI defaulted to the full app startkit.\",\n };\n const explicitTemplate = parsed.positional.length > 0 && isTemplateType(parsed.positional[0]);\n\n if (parsed.positional.length > 0) {\n const first = parsed.positional[0];\n if (isTemplateType(first)) {\n templateType = first;\n name = parsed.positional[1] || \"\";\n templateSelection = {\n mode: \"explicit\",\n reason: `Template '${first}' was provided explicitly on the command line.`,\n };\n } else {\n name = first;\n }\n }\n\n if (!explicitTemplate && parsed.promptText) {\n const inferredTemplate = inferTemplateFromPrompt(parsed.promptText);\n templateType = inferredTemplate.templateType;\n templateSelection = {\n mode: \"prompt\",\n reason: inferredTemplate.reason,\n matchedTerms: inferredTemplate.matchedTerms,\n };\n }\n\n if (!name && parsed.promptText) {\n name = deriveAppNameFromPrompt(parsed.promptText);\n }\n\n if (!name) {\n if (!explicitTemplate) {\n io.log(\"Available templates: startkit, spa, ssr, ssg, full-stack\");\n io.log(\"\");\n\n const selectedTemplate =\n (await prompt(\"Template type (startkit/spa/ssr/ssg/full-stack) [startkit]: \")).trim() ||\n \"startkit\";\n if (!isTemplateType(selectedTemplate)) {\n io.error(\"Invalid template type\");\n return 1;\n }\n\n templateType = selectedTemplate;\n templateSelection = {\n mode: \"interactive\",\n reason: `Template '${selectedTemplate}' was chosen interactively.`,\n };\n }\n\n name = (await prompt(\"App name: \")).trim();\n }\n\n if (!name) {\n io.error(\"App name is required\");\n return 1;\n }\n\n const target = path.resolve(process.cwd(), name);\n const templateDir = await findTemplateDir(templateType);\n\n try {\n await fs.access(templateDir);\n } catch {\n io.error(`Template '${templateType}' not found at ${templateDir}`);\n return 1;\n }\n\n try {\n const stat = await fs.stat(target).catch(() => null);\n if (stat) {\n const files = await fs.readdir(target).catch(() => [] as string[]);\n if (files.length > 0) {\n io.error(`Directory ${target} already exists and is not empty.`);\n return 1;\n }\n }\n } catch (error) {\n io.error(\"Failed to access target directory\");\n io.error(error instanceof Error ? error.message : String(error));\n return 1;\n }\n\n const blueprint = buildBlueprint({\n appName: name,\n promptText: parsed.promptText,\n templateSelection,\n templateType,\n });\n\n if (parsed.promptText) {\n io.log(`Prompt profile selected ${TEMPLATE_LABELS[templateType]} for ${name}.`);\n io.log(`Reason: ${templateSelection.reason}`);\n if (\n Array.isArray(templateSelection.matchedTerms) &&\n templateSelection.matchedTerms.length > 0\n ) {\n io.log(`Matched prompt terms: ${templateSelection.matchedTerms.join(\", \")}`);\n }\n io.log(\"\");\n }\n\n io.log(`Creating ${TEMPLATE_LABELS[templateType]} project: ${name}...`);\n io.log(\"\");\n\n try {\n await copyDir(templateDir, target, { appName: name });\n } catch (error) {\n io.error(\"Failed to copy template\");\n io.error(error instanceof Error ? error.message : String(error));\n return 1;\n }\n\n try {\n await writeBlueprintFiles(target, blueprint);\n } catch (error) {\n io.error(\"Failed to write project blueprint\");\n io.error(error instanceof Error ? error.message : String(error));\n return 1;\n }\n\n if (parsed.skills) {\n try {\n const { bundledNames, targetSkillsDir } = await installBundledSkills({\n cwd: target,\n force: true,\n });\n io.log(\n `Installed ${bundledNames.length} bundled Askr skills into ${path.basename(targetSkillsDir)}/`,\n );\n io.log(\"\");\n } catch (error) {\n io.error(\"Failed to install bundled Askr skills\");\n io.error(error instanceof Error ? error.message : String(error));\n return 1;\n }\n } else {\n io.log(\"Skipping bundled Askr skill installation (--no-skills)\");\n io.log(\"\");\n }\n\n if (!parsed.install) {\n io.log(\"Skipping dependency installation (--no-install)\");\n io.log(\"\");\n io.log(\"Next steps:\");\n io.log(` cd ${name}`);\n io.log(\" review .askr/builder-brief.md\");\n if (!parsed.skills) {\n io.log(\" askr skills install\");\n }\n io.log(\" npm install\");\n io.log(\" npm run dev\");\n return 0;\n }\n\n const pm = detectPm();\n io.log(`Installing dependencies with ${pm}...`);\n io.log(\"\");\n\n const result = spawnSync(pm, [\"install\"], {\n cwd: target,\n stdio: \"inherit\",\n shell: process.platform === \"win32\",\n });\n\n io.log(\"\");\n io.log(`Success! Created ${name}`);\n io.log(\"\");\n\n if (result.status !== 0) {\n io.log(\"Dependency installation failed. Please run manually:\");\n io.log(` cd ${name}`);\n io.log(\" review .askr/builder-brief.md\");\n if (!parsed.skills) {\n io.log(\" askr skills install\");\n }\n io.log(` ${pm} install`);\n io.log(` ${pm} run dev`);\n return 1;\n }\n\n io.log(\"Next steps:\");\n io.log(` cd ${name}`);\n io.log(\" review .askr/builder-brief.md\");\n if (!parsed.skills) {\n io.log(\" askr skills install\");\n }\n io.log(` ${pm} run dev`);\n return 0;\n}\n\nasync function main(): Promise<void> {\n const code = await runCreateCli(process.argv.slice(2));\n process.exit(code);\n}\n\nif (isDirectExecution(import.meta.url)) {\n void main();\n}\n"],"mappings":";;;;;;;;;AAaA,MAAM,kBAAkB;CACtB,cAAc;CACd,KAAK;CACL,KAAK;CACL,KAAK;CACL,UAAU;AACZ;AA6CA,MAAM,iCAAiB,IAAI,IAAkB;CAAC;CAAY;CAAO;CAAO;CAAO;AAAY,CAAC;AAC5F,MAAM,iBAAiC;CAAC;CAAY;CAAO;CAAO;CAAO;AAAY;AACrF,MAAM,oCAAoB,IAAI,IAAI;CAChC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;AACD,MAAM,gCAAoE;CACxE,cAAc;EACZ;EACA;EACA;EACA;EACA;EACA;EACA;CACF;CACA,KAAK;EAAC;EAAmB;EAAoB;EAAmB;CAAe;CAC/E,KAAK;EAAC;EAAmB;EAAW;EAAkB;CAAe;CACrE,KAAK;EAAC;EAAmB;EAAW;CAAe;CACnD,UAAU;EAAC;EAAmB;EAAe;EAAqB;CAAe;AACnF;AACA,MAAM,wBAKD;CACH;EACE,UAAU;EACV,QAAQ;EACR,OAAO;GACL;GACA;GACA;GACA;GACA;GACA;EACF;EACA,QAAQ;CACV;CACA;EACE,UA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CACF;CACA,KAAK;EACH;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF;CACA,KAAK;EAAC;EAAa;EAAgB;EAAwB;EAAyB;CAAW;CAC/F,KAAK;EACH;EACA;EACA;EACA;EACA;EACA;CACF;CACA,UAAU;EACR;EACA;EACA;EACA;EACA;CACF;AACF;AACA,MAAM,2BAA2D;CAC/D,cAAc;EACZ;EACA;EACA;EACA;EACA;CACF;CACA,KAAK;EACH;EACA;EACA;EACA;CACF;CACA,KAAK;EAAC;EAAgB;EAAyB;CAAW;CAC1D,KAAK;EAAC;EAAgB;EAAkB;EAAiC;CAAe;CACxF,UAAU;EACR;EACA;EACA;CACF;AACF;AACA,MAAM,uBAAuB;CAC3B;CACA;CACA;CACA;CACA;AACF;AAEA,SAAS,eAAe,OAAsC;CAC5D,OAAO,eAAe,IAAI,KAAqB;AACjD;AAEA,SAAS,WAAmB;CAC1B,OAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CAAC,CAAC,KAAK,IAAI;AACb;AAEA,eAAe,OAAO,UAAmC;CACvD,MAAM,KAAK,SAAS,gBAAgB;EAClC,OAAO,QAAQ;EACf,QAAQ,QAAQ;CAClB,CAAC;CAED,OAAO,IAAI,SAAS,kBAAkB;EACpC,GAAG,SAAS,WAAW,WAAW;GAChC,GAAG,MAAM;GACT,cAAc,MAAM;EACtB,CAAC;CACH,CAAC;AACH;AAEA,SAAS,WAA2B;CAClC,MAAM,KAAK,QAAQ,IAAI,yBAAyB;CAChD,IAAI,GAAG,WAAW,MAAM,GAAG,OAAO;CAClC,IAAI,GAAG,WAAW,KAAK,GAAG,OAAO;CAEjC,OAAO;AACT;AAEA,MAAM,yCAAyB,IAAI,IAAI;CACrC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;AA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B,GAAG,IAAI,QAAQ,MAAM;CACrB,GAAG,IAAI,iCAAiC;CACxC,IAAI,CAAC,OAAO,QACV,GAAG,IAAI,uBAAuB;CAEhC,GAAG,IAAI,KAAK,GAAG,SAAS;CACxB,OAAO;AACT;AAEA,eAAe,OAAsB;CACnC,MAAM,OAAO,MAAM,aAAa,QAAQ,KAAK,MAAM,CAAC,CAAC;CACrD,QAAQ,KAAK,IAAI;AACnB;AAEA,IAAI,kBAAkB,OAAO,KAAK,GAAG,GACnC,KAAU"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"is-direct-execution-Cdlr-ZUl.js","names":[],"sources":["../src/bin/is-direct-execution.ts"],"sourcesContent":["import { realpathSync } from \"node:fs\";\nimport { resolve } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\n\nfunction normalizePath(filePath: string): string {\n const resolvedPath = resolve(filePath);\n\n try {\n return typeof realpathSync.native === \"function\"\n ? realpathSync.native(resolvedPath)\n : realpathSync(resolvedPath);\n } catch {\n return resolvedPath;\n }\n}\n\nexport function isDirectExecution(\n moduleUrl: string,\n argvPath: string | undefined = process.argv[1],\n): boolean {\n if (!argvPath) {\n return false;\n }\n\n return normalizePath(argvPath) === normalizePath(fileURLToPath(moduleUrl));\n}\n"],"mappings":";;;;AAIA,SAAS,cAAc,UAA0B;CAC/C,MAAM,eAAe,QAAQ,QAAQ;CAErC,IAAI;EACF,OAAO,OAAO,aAAa,WAAW,aAClC,aAAa,OAAO,YAAY,IAChC,aAAa,YAAY;CAC/B,QAAQ;EACN,OAAO;CACT;AACF;AAEA,SAAgB,kBACd,WACA,WAA+B,QAAQ,KAAK,IACnC;CACT,IAAI,CAAC,UACH,OAAO;CAGT,OAAO,cAAc,QAAQ,MAAM,cAAc,cAAc,SAAS,CAAC;AAC3E"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"openapi.js","names":[],"sources":["../src/bin/openapi.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport fs from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { pathToFileURL } from \"node:url\";\nimport { tsImport } from \"tsx/esm/api\";\nimport { stringify } from \"yaml\";\nimport { isDirectExecution } from \"./is-direct-execution\";\n\ntype CliIo = Pick<Console, \"error\" | \"log\">;\n\ninterface ParsedArgs {\n entry: string;\n output: string;\n check: boolean;\n help: boolean;\n}\n\ninterface DocumentExporter {\n toOpenApiDocument(): unknown;\n}\n\ninterface OpenApiDeps {\n cwd(): string;\n importModule(filePath: string): Promise<unknown>;\n readFile(filePath: string): Promise<string>;\n mkdir(directory: string): Promise<void>;\n writeFile(filePath: string, contents: string): Promise<void>;\n rename(from: string, to: string): Promise<void>;\n rm(filePath: string): Promise<void>;\n temporarySuffix(): string;\n}\n\nconst helpText = `askr openapi - Generate an OpenAPI YAML artifact\n\nUsage:\n askr openapi [--entry <path>] [--output <path>] [--check]\n\nOptions:\n --entry <path> TypeScript API module (default: ./src/api.ts)\n --output <path> YAML artifact (default: ./openapi.yml)\n --check Fail when the artifact is missing or byte-stale; never write\n --help, -h Show help\n`;\n\nconst defaultDeps: OpenApiDeps = {\n cwd: () => process.cwd(),\n importModule: (filePath) => tsImport(pathToFileURL(filePath).href, import.meta.url),\n readFile: (filePath) => fs.readFile(filePath, \"utf8\"),\n mkdir: (directory) => fs.mkdir(directory, { recursive: true }).then(() => undefined),\n writeFile: (filePath, contents) => fs.writeFile(filePath, contents, \"utf8\"),\n rename: (from, to) => fs.rename(from, to),\n rm: (filePath) => fs.rm(filePath, { force: true }),\n temporarySuffix: () => `${process.pid}.${Date.now()}`,\n};\n\nexport function parseOpenApiArgs(args: readonly string[]): ParsedArgs {\n const parsed: ParsedArgs = {\n entry: \"./src/api.ts\",\n output: \"./openapi.yml\",\n check: false,\n help: false,\n };\n for (let index = 0; index < args.length; index += 1) {\n const value = args[index];\n if (value === \"--entry\" || value === \"--output\") {\n const next = args[index + 1];\n if (!next) throw new Error(`${value} requires a path`);\n if (value === \"--entry\") parsed.entry = next;\n else parsed.output = next;\n index += 1;\n } else if (value === \"--check\") parsed.check = true;\n else if (value === \"--help\" || value === \"-h\") parsed.help = true;\n else throw new Error(`Unknown option: ${value}`);\n }\n return parsed;\n}\n\nfunction exporterFrom(moduleValue: unknown): DocumentExporter {\n if (!moduleValue || typeof moduleValue !== \"object\") {\n throw new Error(\"API module must have a default export with toOpenApiDocument()\");\n }\n let exported = (moduleValue as { default?: unknown }).default;\n for (\n let depth = 0;\n depth < 3 &&\n exported &&\n typeof exported === \"object\" &&\n typeof (exported as Partial<DocumentExporter>).toOpenApiDocument !== \"function\" &&\n \"default\" in exported;\n depth += 1\n ) {\n exported = (exported as { default?: unknown }).default;\n }\n if (\n !exported ||\n typeof exported !== \"object\" ||\n typeof (exported as Partial<DocumentExporter>).toOpenApiDocument !== \"function\"\n ) {\n throw new Error(\"API module must have a default export with toOpenApiDocument()\");\n }\n return exported as DocumentExporter;\n}\n\nexport function serializeOpenApi(document: unknown): string {\n const yaml = stringify(document, { aliasDuplicateObjects: false, lineWidth: 0 });\n return `${yaml.replace(/\\n+$/, \"\")}\\n`;\n}\n\nasync function generate(entry: string, deps: OpenApiDeps): Promise<string> {\n const moduleValue = await deps.importModule(entry);\n const document = exporterFrom(moduleValue).toOpenApiDocument();\n if (!document || typeof document !== \"object\" || Array.isArray(document)) {\n throw new Error(\"toOpenApiDocument() must return an OpenAPI document object\");\n }\n return serializeOpenApi(document);\n}\n\nasync function atomicWrite(output: string, contents: string, deps: OpenApiDeps): Promise<void> {\n await deps.mkdir(path.dirname(output));\n const temporary = `${output}.${deps.temporarySuffix()}.tmp`;\n try {\n await deps.writeFile(temporary, contents);\n await deps.rename(temporary, output);\n } catch (error) {\n await deps.rm(temporary);\n throw error;\n }\n}\n\nexport async function runOpenApiCli(\n args: string[] = process.argv.slice(2),\n io: CliIo = console,\n overrides: Partial<OpenApiDeps> = {},\n): Promise<number> {\n const deps = { ...defaultDeps, ...overrides };\n try {\n const parsed = parseOpenApiArgs(args);\n if (parsed.help) {\n io.log(helpText.trimEnd());\n return 0;\n }\n const entry = path.resolve(deps.cwd(), parsed.entry);\n const output = path.resolve(deps.cwd(), parsed.output);\n const expected = await generate(entry, deps);\n if (parsed.check) {\n let actual: string;\n try {\n actual = await deps.readFile(output);\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code === \"ENOENT\") {\n io.error(`OpenAPI artifact is missing: ${output}`);\n return 1;\n }\n throw error;\n }\n if (actual !== expected) {\n io.error(`OpenAPI artifact is stale: ${output}`);\n return 1;\n }\n io.log(`OpenAPI artifact is current: ${output}`);\n return 0;\n }\n await atomicWrite(output, expected, deps);\n io.log(`Generated OpenAPI artifact: ${output}`);\n return 0;\n } catch (error) {\n io.error(error instanceof Error ? error.message : String(error));\n return 1;\n }\n}\n\nasync function main(): Promise<void> {\n process.exit(await runOpenApiCli(process.argv.slice(2)));\n}\n\nif (isDirectExecution(import.meta.url)) void main();\n"],"mappings":";;;;;;;;AAiCA,MAAM,WAAW;;;;;;;;;;;AAYjB,MAAM,cAA2B;CAC/B,WAAW,QAAQ,IAAI;CACvB,eAAe,aAAa,SAAS,cAAc,QAAQ,CAAC,CAAC,MAAM,OAAO,KAAK,GAAG;CAClF,WAAW,aAAa,GAAG,SAAS,UAAU,MAAM;CACpD,QAAQ,cAAc,GAAG,MAAM,WAAW,EAAE,WAAW,KAAK,CAAC,CAAC,CAAC,WAAW,KAAA,CAAS;CACnF,YAAY,UAAU,aAAa,GAAG,UAAU,UAAU,UAAU,MAAM;CAC1E,SAAS,MAAM,OAAO,GAAG,OAAO,MAAM,EAAE;CACxC,KAAK,aAAa,GAAG,GAAG,UAAU,EAAE,OAAO,KAAK,CAAC;CACjD,uBAAuB,GAAG,QAAQ,IAAI,GAAG,KAAK,IAAI;AACpD;AAEA,SAAgB,iBAAiB,MAAqC;CACpE,MAAM,SAAqB;EACzB,OAAO;EACP,QAAQ;EACR,OAAO;EACP,MAAM;CACR;CACA,KAAK,IAAI,QAAQ,GAAG,QAAQ,KAAK,QAAQ,SAAS,GAAG;EAC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OAAO,KAAK,GAAG,GAAG,KAAU"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"skills-Bh0mEhIx.js","names":["pathExists"],"sources":["../src/bin/skill-review.ts","../src/bin/skills.ts"],"sourcesContent":["import fs from \"node:fs/promises\";\nimport path from \"node:path\";\n\ninterface ReviewPattern {\n label: string;\n regex: RegExp;\n}\n\ninterface ReviewAssertion {\n description: string;\n mode: \"forbid\" | \"require\";\n match: \"all\" | \"any\";\n patterns: ReviewPattern[];\n}\n\ninterface ReviewPromptDefinition {\n id: string;\n title: string;\n relatedSkills: string[];\n repairFocus: string;\n prompt: string;\n assertions: ReviewAssertion[];\n}\n\ninterface ReviewFile {\n path: string;\n content: string;\n}\n\ninterface ReviewAssertionResult {\n description: string;\n passed: boolean;\n matchedFiles: string[];\n matchedPatterns: string[];\n missingPatterns: string[];\n mode: ReviewAssertion[\"mode\"];\n}\n\nexport interface SkillReviewResult {\n filesScanned: number;\n passedChecks: number;\n prompt: string;\n promptId: string;\n repairFocus: string;\n relatedSkills: string[];\n score: number;\n status: \"fail\" | \"pass\";\n targetPath: string;\n title: string;\n totalChecks: number;\n checks: ReviewAssertionResult[];\n}\n\nconst TEXT_FILE_EXTENSIONS = new Set([\n \".cjs\",\n \".css\",\n \".cts\",\n \".html\",\n \".js\",\n \".json\",\n \".jsx\",\n \".md\",\n \".mdx\",\n \".mjs\",\n \".mts\",\n \".scss\",\n \".ts\",\n \".tsx\",\n \".txt\",\n \".yaml\",\n \".yml\",\n]);\n\nconst IGNORED_DIRECTORIES = new Set([\n \".askr\",\n \".git\",\n \".skills\",\n \"skills\",\n \".vite\",\n \"coverage\",\n \"dist\",\n \"node_modules\",\n]);\n\nfunction re(label: string, source: string, flags = \"m\"): ReviewPattern {\n return {\n label,\n regex: new RegExp(source, flags),\n };\n}\n\nfunction requireAny(description: string, patterns: ReviewPattern[]): ReviewAssertion {\n return {\n description,\n mode: \"require\",\n match: \"any\",\n patterns,\n };\n}\n\nfunction requireAll(description: string, patterns: ReviewPattern[]): ReviewAssertion {\n return {\n description,\n mode: \"require\",\n match: \"all\",\n patterns,\n };\n}\n\nfunction forbid(description: string, patterns: ReviewPattern[]): ReviewAssertion {\n return {\n description,\n mode: \"forbid\",\n match: \"any\",\n patterns,\n };\n}\n\nconst REVIEW_PROMPTS: ReviewPromptDefinition[] = [\n {\n id: \"foundation\",\n title: \"Foundation\",\n relatedSkills: [\"askr-mental-model\", \"askr-runtime-reactivity\"],\n repairFocus:\n \"Replace React-shaped state and list rendering with state(), derive(), selector(), and For based on local ownership.\",\n prompt:\n \"Build a small Askr page that lets the user switch between queued, running, and completed jobs. Use the right Askr primitives for local state and keyed list rendering.\",\n assertions: [\n requireAny(\"Uses state() for local UI state.\", [re(\"state()\", String.raw`\\bstate\\s*\\(`)]),\n requireAny(\"Uses For for keyed or dynamic list rendering.\", [\n re(\"<For>\", String.raw`<For\\b`),\n re(\"For()\", String.raw`\\bFor\\s*\\(`),\n ]),\n forbid(\"Does not import React or React hooks.\", [\n re(\"React import\", String.raw`from\\s+[\"']react[\"']`),\n re(\"useState\", String.raw`\\buseState\\s*\\(`),\n re(\"useEffect\", String.raw`\\buseEffect\\s*\\(`),\n ]),\n ],\n },\n {\n id: \"routing-layouts\",\n title: \"Routing And Layouts\",\n relatedSkills: [\"askr-project-structure\", \"askr-routing-layouts\"],\n repairFocus:\n \"Move route ownership into the registered route tree and keep layout, auth requirements, and fallback policy in route declarations.\",\n prompt:\n \"Add a protected /app/workspaces/{workspaceId}/settings route with a nested layout, an index page, and a not-found fallback. Keep routing idiomatic to Askr.\",\n assertions: [\n requireAll(\"Uses Askr route composition helpers.\", [\n re(\"group()\", String.raw`\\bgroup\\s*\\(`),\n re(\"fallback()\", String.raw`\\bfallback\\s*\\(`),\n re(\"index()\", String.raw`\\bindex\\s*\\(`),\n ]),\n requireAny(\"Registers routes with page() or route().\", [\n re(\"page()\", String.raw`\\bpage\\s*\\(`),\n re(\"route()\", String.raw`\\broute\\s*\\(`),\n ]),\n requireAny(\"Keeps auth or permission policy in route requirements.\", [\n re(\"auth requirement\", String.raw`\\bauth\\s*:\\s*require[A-Z][A-Za-z]*\\s*\\(`),\n re(\"auth policy\", String.raw`\\bpolicies\\s*:`),\n ]),\n forbid(\"Rejects obsolete boolean and guest-string auth declarations.\", [\n re(\"boolean auth\", String.raw`\\bauth\\s*:\\s*(?:true|false)\\b`),\n re(\"guest auth\", String.raw`\\bauth\\s*:\\s*[\"']guest[\"']`),\n re(\"permission metadata\", String.raw`\\bpermissions?\\s*:`),\n ]),\n ],\n },\n {\n id: \"auth-authorization\",\n title: \"Auth And Authorization\",\n relatedSkills: [\"askr-auth-access\", \"askr-routing-layouts\"],\n repairFocus:\n \"Keep auth and permission policy in function requirements or auth workflow boundaries, then render an explicit forbidden state.\",\n prompt:\n \"Add a billing admin screen that is only available to authenticated users with the billing.manage permission. Show a signed-in forbidden state when the user lacks access.\",\n assertions: [\n requireAny(\"Uses an auth requirement or session workflow.\", [\n re(\"auth requirement\", String.raw`\\brequire(?:User|Anonymous|Permission|Role|Scope)\\s*\\(`),\n re(\"session gate\", String.raw`\\bsignedIn\\b|\\bsession\\b`),\n ]),\n requireAny(\"Preserves permission policy in code or route requirements.\", [\n re(\"billing.manage\", String.raw`billing\\.manage`),\n re(\"permission requirement\", String.raw`\\brequirePermission\\s*\\(`),\n ]),\n forbid(\"Rejects obsolete boolean and guest-string auth declarations.\", [\n re(\"boolean auth\", String.raw`\\bauth\\s*:\\s*(?:true|false)\\b`),\n re(\"guest auth\", String.raw`\\bauth\\s*:\\s*[\"']guest[\"']`),\n re(\"permission metadata\", String.raw`\\bpermissions?\\s*:`),\n ]),\n requireAny(\"Renders a forbidden or access-denied state.\", [\n re(\"forbidden\", String.raw`forbidden`, \"mi\"),\n re(\"access denied\", String.raw`access denied`, \"mi\"),\n ]),\n ],\n },\n {\n id: \"crud-forms\",\n title: \"CRUD And Forms\",\n relatedSkills: [\"askr-forms-tables-crud\", \"askr-error-loading-empty\"],\n repairFocus:\n \"Keep form state local, mutation state feature-owned, and surface field or form errors instead of toast-only failure handling.\",\n prompt:\n \"Build an accounts edit form with field validation, submit pending state, server validation errors, and a keyboard-accessible destructive archive action.\",\n assertions: [\n requireAny(\"Keeps local form state explicit.\", [re(\"state()\", String.raw`\\bstate\\s*\\(`)]),\n requireAny(\"Includes pending or disabled submit handling.\", [\n re(\"pending\", String.raw`\\bpending\\b`),\n re(\"disabled\", String.raw`\\bdisabled\\b`),\n ]),\n requireAny(\"Surfaces field or form validation errors.\", [\n re(\"validation\", String.raw`validation`, \"mi\"),\n re(\"field error\", String.raw`field error`, \"mi\"),\n re(\"error message\", String.raw`error`, \"mi\"),\n ]),\n ],\n },\n {\n id: \"shared-data-consistency\",\n title: \"Shared Data And Consistency\",\n relatedSkills: [\"askr-query-mutation\", \"askr-resources-data\", \"askr-error-loading-empty\"],\n repairFocus:\n \"Use createQuery() and createMutation() with narrow invalidation, preserve consistency metadata, and show truthful syncing state.\",\n prompt:\n \"Build a shared accounts query with an update mutation that preserves stale data while the projection catches up. Show a truthful syncing state after save.\",\n assertions: [\n requireAny(\"Uses createQuery() for shared reads.\", [\n re(\"createQuery()\", String.raw`\\bcreateQuery\\s*\\(`),\n ]),\n requireAny(\"Uses createMutation() for writes.\", [\n re(\"createMutation()\", String.raw`\\bcreateMutation\\s*\\(`),\n ]),\n requireAny(\"Represents truthful syncing or stale states.\", [\n re(\"syncing\", String.raw`syncing`, \"mi\"),\n re(\"pending-write\", String.raw`pending-write`, \"mi\"),\n re(\"stale\", String.raw`stale`, \"mi\"),\n ]),\n ],\n },\n {\n id: \"realtime\",\n title: \"Realtime\",\n relatedSkills: [\"askr-realtime-streaming\", \"askr-query-mutation\"],\n repairFocus:\n \"Preserve cursor or event identity, bound long-running lists, and expose reconnecting or stale state explicitly.\",\n prompt:\n \"Build a live operator timeline that reconnects from a cursor, handles duplicate events safely, and keeps DOM churn bounded on long-running sessions.\",\n assertions: [\n requireAny(\"Preserves stream cursor or event identity.\", [\n re(\"cursor\", String.raw`\\bcursor\\b`),\n re(\"eventId\", String.raw`\\beventId\\b`),\n re(\"lastEventId\", String.raw`\\blastEventId\\b`),\n ]),\n requireAny(\"Handles reconnect or retry explicitly.\", [\n re(\"reconnect\", String.raw`reconnect`, \"mi\"),\n re(\"retry\", String.raw`retry`, \"mi\"),\n ]),\n requireAny(\"Bounds long-running lists or buffers.\", [\n re(\"slice()\", String.raw`\\.slice\\s*\\(`),\n re(\"max events\", String.raw`\\bMAX_[A-Z_]+\\b`),\n re(\"limit\", String.raw`\\blimit\\b`, \"mi\"),\n ]),\n ],\n },\n {\n id: \"theming-ui\",\n title: \"Theming And UI\",\n relatedSkills: [\"askr-theming\", \"askr-ui-composition\", \"askr-accessibility\"],\n repairFocus:\n \"Use askr-themes and askr-ui primitives before custom components, and keep styling token-based and accessibility-safe.\",\n prompt:\n \"Add a themed settings panel using solved Askr theme primitives, preserve dark mode, and avoid inventing app-local replacements for common controls and surfaces.\",\n assertions: [\n requireAny(\"Uses askr-ui or askr-themes primitives.\", [\n re(\"@askrjs/ui\", String.raw`@askrjs\\/ui`),\n re(\"@askrjs/themes\", String.raw`@askrjs\\/themes`),\n ]),\n requireAny(\"Uses tokens or theme-oriented hooks in styles.\", [\n re(\"CSS var token\", String.raw`var\\(--`),\n re(\"data-slot\", String.raw`data-slot`),\n ]),\n requireAny(\"Preserves theme mode behavior.\", [\n re(\"dark mode\", String.raw`dark`, \"mi\"),\n re(\"theme toggle\", String.raw`theme`, \"mi\"),\n ]),\n ],\n },\n {\n id: \"ssr-ssg\",\n title: \"SSR And SSG\",\n relatedSkills: [\"askr-ssr-ssg\", \"askr-routing-layouts\"],\n repairFocus:\n \"Keep routes deterministic, render paths environment-safe, and remove browser-only globals from server or static render code.\",\n prompt:\n \"Add a parameterized docs route that works in SSG and stays hydration-safe when rendered in the browser.\",\n assertions: [\n requireAny(\"Includes route registration for the generated path.\", [\n re(\"page()\", String.raw`\\bpage\\s*\\(`),\n re(\"route()\", String.raw`\\broute\\s*\\(`),\n ]),\n requireAny(\"Includes SSG-oriented code or config.\", [\n re(\"SSG\", String.raw`\\bSSG\\b`),\n re(\"static\", String.raw`static`, \"mi\"),\n re(\"manifest\", String.raw`manifest`, \"mi\"),\n ]),\n forbid(\"Avoids browser-only globals in render paths.\", [\n re(\"window\", String.raw`\\bwindow\\.`),\n re(\"document\", String.raw`\\bdocument\\.`),\n ]),\n ],\n },\n {\n id: \"agent-workflow-ui\",\n title: \"Agent Workflow UI\",\n relatedSkills: [\"askr-agent-workflows\", \"askr-error-loading-empty\"],\n repairFocus:\n \"Model the screen as a run lifecycle with approvals, audit history, retries, and explicit multi-state UI.\",\n prompt:\n \"Build an agent run screen with draft, queued, running, requires-action, failed, and succeeded states, plus an audit-friendly timeline and approval card.\",\n assertions: [\n requireAll(\"Represents multiple run lifecycle states.\", [\n re(\"queued\", String.raw`queued`, \"mi\"),\n re(\"running\", String.raw`running`, \"mi\"),\n re(\"failed\", String.raw`failed`, \"mi\"),\n ]),\n requireAny(\"Surfaces approval or requires-action UI.\", [\n re(\"approval\", String.raw`approval`, \"mi\"),\n re(\"requires-action\", String.raw`requires-action`, \"mi\"),\n ]),\n requireAny(\"Includes a timeline, log, or audit trail.\", [\n re(\"timeline\", String.raw`timeline`, \"mi\"),\n re(\"audit\", String.raw`audit`, \"mi\"),\n re(\"event\", String.raw`event`, \"mi\"),\n ]),\n ],\n },\n {\n id: \"reject-react-query\",\n title: \"Negative Prompt: Reject React And TanStack Query\",\n relatedSkills: [\"askr-mental-model\", \"askr-agent-execution\"],\n repairFocus:\n \"Replace React hooks and TanStack Query with state(), resource(), createQuery(), or createMutation() based on ownership.\",\n prompt: \"Build this screen with React hooks and TanStack Query.\",\n assertions: [\n forbid(\"Does not import React hooks or React itself.\", [\n re(\"React import\", String.raw`from\\s+[\"']react[\"']`),\n re(\"useState\", String.raw`\\buseState\\s*\\(`),\n re(\"useEffect\", String.raw`\\buseEffect\\s*\\(`),\n ]),\n forbid(\"Does not import TanStack Query.\", [\n re(\"TanStack Query\", String.raw`@tanstack\\/react-query`),\n re(\"useQuery\", String.raw`\\buseQuery\\s*\\(`),\n re(\"QueryClient\", String.raw`\\bQueryClient\\b`),\n ]),\n requireAny(\"Uses Askr-native reactivity or data primitives instead.\", [\n re(\"state()\", String.raw`\\bstate\\s*\\(`),\n re(\"resource()\", String.raw`\\bresource\\s*\\(`),\n re(\"createQuery()\", String.raw`\\bcreateQuery\\s*\\(`),\n ]),\n ],\n },\n {\n id: \"reject-custom-primitives\",\n title: \"Negative Prompt: Reject App-Local Primitive Clones\",\n relatedSkills: [\"askr-ui-composition\", \"askr-theming\"],\n repairFocus:\n \"Import askr-ui or askr-themes primitives before creating local Button, Card, or Sidebar wrappers.\",\n prompt:\n \"Create a custom app-local Card, Sidebar, and Button system before using the framework components.\",\n assertions: [\n forbid(\"Does not define local Button, Card, or Sidebar primitives by default.\", [\n re(\"local Button\", String.raw`export\\s+(?:default\\s+)?function\\s+Button\\b`),\n re(\"local Card\", String.raw`export\\s+(?:default\\s+)?function\\s+Card\\b`),\n re(\"local Sidebar\", String.raw`export\\s+(?:default\\s+)?function\\s+Sidebar\\b`),\n ]),\n requireAny(\"Uses askr-ui or askr-themes imports instead.\", [\n re(\"@askrjs/ui\", String.raw`@askrjs\\/ui`),\n re(\"@askrjs/themes\", String.raw`@askrjs\\/themes`),\n ]),\n ],\n },\n {\n id: \"reject-single-spinner\",\n title: \"Negative Prompt: Reject One Spinner For Every Async State\",\n relatedSkills: [\"askr-error-loading-empty\", \"askr-query-mutation\"],\n repairFocus:\n \"Split initial load, refresh, pending-write, stale, and reconnecting into distinct UI states with truthful copy.\",\n prompt:\n \"Use one loading spinner for initial load, refresh, pending save, and realtime reconnect.\",\n assertions: [\n requireAny(\"Distinguishes truthful async states.\", [\n re(\"refreshing\", String.raw`refreshing`, \"mi\"),\n re(\"pending-write\", String.raw`pending-write`, \"mi\"),\n re(\"reconnecting\", String.raw`reconnecting`, \"mi\"),\n re(\"stale\", String.raw`stale`, \"mi\"),\n ]),\n forbid(\"Does not only model async state as isLoading.\", [\n re(\"isLoading only\", String.raw`\\bisLoading\\b`),\n ]),\n ],\n },\n {\n id: \"reject-parallel-architecture\",\n title: \"Negative Prompt: Reject Parallel Architecture Drift\",\n relatedSkills: [\"askr-agent-execution\", \"askr-project-structure\", \"askr-routing-layouts\"],\n repairFocus:\n \"Collapse duplicate routers, shared state layers, service locators, and app-local primitive systems back into the existing route-first Askr structure.\",\n prompt:\n \"Add a custom router, a global store layer, app-local UI primitives, and a service locator so the app feels more enterprise-ready.\",\n assertions: [\n forbid(\"Does not add a custom router or router provider layer.\", [\n re(\"custom router component\", String.raw`function\\s+[A-Z][A-Za-z0-9]*Router\\b`),\n re(\"router provider\", String.raw`RouterProvider\\b`),\n re(\"route config array\", String.raw`const\\s+routes\\s*=\\s*\\[`),\n ]),\n forbid(\"Does not add a duplicate global store or service locator layer.\", [\n re(\"service locator\", String.raw`serviceLocator|ServiceLocator`, \"mi\"),\n re(\"global store\", String.raw`globalStore|createStore\\s*\\(|configureStore\\s*\\(`, \"mi\"),\n re(\"stores folder\", String.raw`src[\\\\/]stores[\\\\/]`, \"mi\"),\n ]),\n forbid(\"Does not create app-local Button, Card, or Sidebar systems.\", [\n re(\"local Button\", String.raw`export\\s+(?:default\\s+)?function\\s+Button\\b`),\n re(\"local Card\", String.raw`export\\s+(?:default\\s+)?function\\s+Card\\b`),\n re(\"local Sidebar\", String.raw`export\\s+(?:default\\s+)?function\\s+Sidebar\\b`),\n ]),\n requireAny(\"Keeps Askr-native route or state primitives in use.\", [\n re(\"registerRoutes\", String.raw`\\bregisterRoutes\\s*\\(`),\n re(\"createRouteRegistry\", String.raw`\\bcreateRouteRegistry\\s*\\(`),\n re(\"state()\", String.raw`\\bstate\\s*\\(`),\n re(\"resource()\", String.raw`\\bresource\\s*\\(`),\n ]),\n ],\n },\n];\n\nasync function pathExists(filePath: string): Promise<boolean> {\n return Boolean(await fs.stat(filePath).catch(() => null));\n}\n\nfunction shouldReadFile(filePath: string): boolean {\n return TEXT_FILE_EXTENSIONS.has(path.extname(filePath).toLowerCase());\n}\n\nasync function collectReviewFiles(targetPath: string, files: string[]): Promise<void> {\n const stat = await fs.lstat(targetPath);\n\n if (stat.isSymbolicLink()) {\n return;\n }\n\n if (stat.isDirectory()) {\n const entries = await fs.readdir(targetPath, { withFileTypes: true });\n\n for (const entry of entries) {\n if (entry.isDirectory() && IGNORED_DIRECTORIES.has(entry.name)) {\n continue;\n }\n\n await collectReviewFiles(path.join(targetPath, entry.name), files);\n }\n\n return;\n }\n\n if (stat.isFile() && shouldReadFile(targetPath)) {\n files.push(targetPath);\n }\n}\n\nasync function loadReviewFiles(\n targetPath: string,\n): Promise<{ files: ReviewFile[]; targetPath: string }> {\n const resolvedTarget = path.resolve(targetPath);\n if (!(await pathExists(resolvedTarget))) {\n throw new Error(`Review target not found: ${resolvedTarget}`);\n }\n\n const stat = await fs.stat(resolvedTarget);\n const baseDirectory = stat.isDirectory() ? resolvedTarget : path.dirname(resolvedTarget);\n const absoluteFiles: string[] = [];\n\n await collectReviewFiles(resolvedTarget, absoluteFiles);\n\n const files = await Promise.all(\n absoluteFiles.map(async (filePath) => ({\n path: path.relative(baseDirectory, filePath) || path.basename(filePath),\n content: await fs.readFile(filePath, \"utf8\"),\n })),\n );\n\n if (files.length === 0) {\n throw new Error(`No reviewable text files found under ${resolvedTarget}`);\n }\n\n return {\n files,\n targetPath: resolvedTarget,\n };\n}\n\nfunction getReviewPrompt(promptId: string): ReviewPromptDefinition | null {\n return REVIEW_PROMPTS.find((prompt) => prompt.id === promptId) ?? null;\n}\n\nfunction uniquePaths(paths: string[]): string[] {\n return [...new Set(paths)].sort();\n}\n\nfunction findPatternMatches(files: ReviewFile[], pattern: ReviewPattern): string[] {\n const matchedFiles: string[] = [];\n\n for (const file of files) {\n pattern.regex.lastIndex = 0;\n if (pattern.regex.test(file.content)) {\n matchedFiles.push(file.path);\n }\n }\n\n return matchedFiles;\n}\n\nfunction evaluateAssertion(assertion: ReviewAssertion, files: ReviewFile[]): ReviewAssertionResult {\n const patterns = assertion.patterns.map((pattern) => ({\n label: pattern.label,\n matches: findPatternMatches(files, pattern),\n }));\n\n if (assertion.mode === \"forbid\") {\n const offendingPatterns = patterns.filter((pattern) => pattern.matches.length > 0);\n\n return {\n description: assertion.description,\n passed: offendingPatterns.length === 0,\n matchedFiles: uniquePaths(offendingPatterns.flatMap((pattern) => pattern.matches)),\n matchedPatterns: offendingPatterns.map((pattern) => pattern.label),\n missingPatterns: [],\n mode: assertion.mode,\n };\n }\n\n const matchedPatterns = patterns.filter((pattern) => pattern.matches.length > 0);\n const passed =\n assertion.match === \"all\"\n ? matchedPatterns.length === patterns.length\n : matchedPatterns.length > 0;\n\n return {\n description: assertion.description,\n passed,\n matchedFiles: uniquePaths(matchedPatterns.flatMap((pattern) => pattern.matches)),\n matchedPatterns: matchedPatterns.map((pattern) => pattern.label),\n missingPatterns: patterns\n .filter((pattern) => pattern.matches.length === 0)\n .map((pattern) => pattern.label),\n mode: assertion.mode,\n };\n}\n\nexport function listSkillReviewPrompts(): Array<{\n id: string;\n prompt: string;\n title: string;\n relatedSkills: string[];\n}> {\n return REVIEW_PROMPTS.map(({ id, prompt, title, relatedSkills }) => ({\n id,\n prompt,\n title,\n relatedSkills,\n }));\n}\n\nexport async function runSkillReview(\n promptId: string,\n options: { cwd?: string } = {},\n): Promise<SkillReviewResult> {\n const prompt = getReviewPrompt(promptId);\n if (!prompt) {\n const error = new Error(`Unknown review prompt: ${promptId}`) as Error & { code?: string };\n error.code = \"UNKNOWN_REVIEW_PROMPT\";\n throw error;\n }\n\n const { files, targetPath } = await loadReviewFiles(options.cwd ?? process.cwd());\n const checks = prompt.assertions.map((assertion) => evaluateAssertion(assertion, files));\n const passedChecks = checks.filter((check) => check.passed).length;\n const totalChecks = checks.length;\n\n return {\n filesScanned: files.length,\n passedChecks,\n prompt: prompt.prompt,\n promptId: prompt.id,\n repairFocus: prompt.repairFocus,\n relatedSkills: prompt.relatedSkills,\n score: totalChecks === 0 ? 1 : passedChecks / totalChecks,\n status: passedChecks === totalChecks ? \"pass\" : \"fail\",\n targetPath,\n title: prompt.title,\n totalChecks,\n checks,\n };\n}\n\nexport function formatSkillReviewReport(result: SkillReviewResult): string {\n const lines = [\n `Skill review: ${result.promptId} - ${result.title}`,\n `Target: ${result.targetPath}`,\n `Files scanned: ${result.filesScanned}`,\n `Related skills: ${result.relatedSkills.join(\", \")}`,\n `Repair focus: ${result.repairFocus}`,\n `Score: ${result.passedChecks}/${result.totalChecks} checks passed (${Math.round(result.score * 100)}%)`,\n \"\",\n ];\n\n for (const check of result.checks) {\n lines.push(`${check.passed ? \"PASS\" : \"FAIL\"} ${check.description}`);\n\n if (check.mode === \"require\") {\n if (check.matchedPatterns.length > 0) {\n lines.push(` matched: ${check.matchedPatterns.join(\", \")}`);\n }\n\n if (check.missingPatterns.length > 0) {\n lines.push(` missing: ${check.missingPatterns.join(\", \")}`);\n }\n } else if (check.matchedPatterns.length > 0) {\n lines.push(` offending patterns: ${check.matchedPatterns.join(\", \")}`);\n }\n\n if (check.matchedFiles.length > 0) {\n lines.push(` files: ${check.matchedFiles.join(\", \")}`);\n }\n }\n\n return lines.join(\"\\n\");\n}\n","#!/usr/bin/env node\n\nimport fs from \"node:fs/promises\";\nimport type { Dirent } from \"node:fs\";\nimport path from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport { formatSkillReviewReport, listSkillReviewPrompts, runSkillReview } from \"./skill-review\";\nimport { isDirectExecution } from \"./is-direct-execution\";\n\ntype CliIo = Pick<Console, \"error\" | \"log\">;\n\ninterface ParsedArgs {\n cwd: string;\n force: boolean;\n help: boolean;\n json: boolean;\n command: string;\n positionals: string[];\n reviewPrompt: string;\n}\n\nconst MANAGED_PREFIX = \"askr-\";\nconst PROJECT_SKILLS_DIR = \"skills\";\n\nfunction helpText(): string {\n return [\n \"askr skills - Install Askr agent skills\",\n \"\",\n \"Usage:\",\n \" askr skills list\",\n \" askr skills review list\",\n \" askr skills review <prompt-id> [--cwd <dir>] [--json]\",\n \" askr skills install [--cwd <dir>] [--force]\",\n \" askr skills sync [--cwd <dir>] [--force]\",\n \"\",\n \"Commands:\",\n \" list Print bundled Askr skill names\",\n \" review Evaluate generated output against deterministic Askr prompt rubrics\",\n ` install Copy bundled skills into ${PROJECT_SKILLS_DIR}/; refuses non-empty targets unless --force`,\n ` sync Update bundled skills in ${PROJECT_SKILLS_DIR}/ and remove obsolete askr-* skill folders`,\n \"\",\n \"Options:\",\n ` --cwd <dir> Project directory to receive ${PROJECT_SKILLS_DIR}/ (default: current directory)`,\n ` --force Allow install to write into an existing non-empty ${PROJECT_SKILLS_DIR} directory`,\n \" --json Print review results as JSON\",\n \" --help Show this help message\",\n \"\",\n \"Examples:\",\n \" askr skills install\",\n \" askr skills review foundation --cwd ./candidate-app\",\n \" askr skills sync --cwd ./my-app\",\n ].join(\"\\n\");\n}\n\nfunction reviewHelpText(): string {\n return [\n \"askr skills review - Evaluate generated output against deterministic prompt rubrics\",\n \"\",\n \"Usage:\",\n \" askr skills review list\",\n \" askr skills review <prompt-id> [--cwd <dir>] [--json]\",\n \"\",\n \"Options:\",\n \" --cwd <dir> File or directory to review (default: current directory)\",\n \" --json Print machine-readable JSON output\",\n \" --help Show this help message\",\n \"\",\n \"Examples:\",\n \" askr skills review foundation --cwd ./candidate-app\",\n \" askr skills review reject-react-query --cwd ./scratch-output\",\n ].join(\"\\n\");\n}\n\nfunction parseArgs(args: string[]): ParsedArgs {\n const positional: string[] = [];\n const parsed = {\n cwd: process.cwd(),\n force: false,\n help: false,\n json: false,\n };\n\n for (let i = 0; i < args.length; i += 1) {\n const arg = args[i];\n if (arg === \"--help\" || arg === \"-h\") {\n parsed.help = true;\n } else if (arg === \"--json\") {\n parsed.json = true;\n } else if (arg === \"--force\") {\n parsed.force = true;\n } else if (arg === \"--cwd\" && i + 1 < args.length) {\n parsed.cwd = args[i + 1];\n i += 1;\n } else {\n positional.push(arg);\n }\n }\n\n return {\n ...parsed,\n command: positional[0] || \"\",\n positionals: positional,\n reviewPrompt: positional[1] || \"\",\n };\n}\n\nfunction cliDir(): string {\n return path.dirname(fileURLToPath(import.meta.url));\n}\n\nasync function findBundledSkillsDir(): Promise<string> {\n const base = cliDir();\n const candidates = [\n path.resolve(base, \"..\", \"..\", \"skills\"),\n path.resolve(base, \"..\", \"skills\"),\n path.resolve(base, \"skills\"),\n ];\n\n for (const candidate of candidates) {\n if (await pathExists(candidate)) {\n return candidate;\n }\n }\n\n return candidates[0];\n}\n\nasync function pathExists(filePath: string): Promise<boolean> {\n return Boolean(await fs.stat(filePath).catch(() => null));\n}\n\nasync function listBundledSkills(): Promise<string[]> {\n const source = await findBundledSkillsDir();\n const entries = await fs.readdir(source, { withFileTypes: true });\n return entries\n .filter((entry) => entry.isDirectory())\n .map((entry) => entry.name)\n .sort();\n}\n\nasync function copyDir(src: string, dest: string): Promise<void> {\n const entries = await fs.readdir(src, { withFileTypes: true });\n await fs.mkdir(dest, { recursive: true });\n\n for (const entry of entries) {\n const srcPath = path.join(src, entry.name);\n const destPath = path.join(dest, entry.name);\n\n if (entry.isDirectory()) {\n await copyDir(srcPath, destPath);\n continue;\n }\n\n await fs.copyFile(srcPath, destPath);\n }\n}\n\nasync function removeManagedSkillArtifacts(\n targetSkillsDir: string,\n bundledNames: string[],\n): Promise<void> {\n const entries = await fs\n .readdir(targetSkillsDir, { withFileTypes: true })\n .catch(() => [] as Dirent[]);\n const bundled = new Set(bundledNames);\n\n for (const entry of entries) {\n if (!entry.name.startsWith(MANAGED_PREFIX)) {\n continue;\n }\n\n const isBundledDirectory = entry.isDirectory() && bundled.has(entry.name);\n if (!isBundledDirectory) {\n await fs.rm(path.join(targetSkillsDir, entry.name), { recursive: true, force: true });\n }\n }\n}\n\nasync function copyBundledSkills(targetSkillsDir: string, bundledNames: string[]): Promise<void> {\n const source = await findBundledSkillsDir();\n await fs.mkdir(targetSkillsDir, { recursive: true });\n\n for (const name of bundledNames) {\n const src = path.join(source, name);\n const dest = path.join(targetSkillsDir, name);\n await fs.rm(dest, { recursive: true, force: true });\n await copyDir(src, dest);\n }\n}\n\nexport async function installBundledSkills(\n options: { cwd?: string; force?: boolean } = {},\n): Promise<{ bundledNames: string[]; targetSkillsDir: string }> {\n const targetRoot = path.resolve(options.cwd ?? process.cwd());\n const targetSkillsDir = path.join(targetRoot, PROJECT_SKILLS_DIR);\n const bundledNames = await listBundledSkills();\n const existingEntries = await fs.readdir(targetSkillsDir).catch(() => [] as string[]);\n\n if (existingEntries.length > 0 && !options.force) {\n throw new Error(`Refusing to install into non-empty ${targetSkillsDir}.`);\n }\n\n if (options.force) {\n await fs.mkdir(targetSkillsDir, { recursive: true });\n await removeManagedSkillArtifacts(targetSkillsDir, bundledNames);\n }\n\n await copyBundledSkills(targetSkillsDir, bundledNames);\n\n return {\n bundledNames,\n targetSkillsDir,\n };\n}\n\nexport async function syncBundledSkills(\n options: { cwd?: string } = {},\n): Promise<{ bundledNames: string[]; targetSkillsDir: string }> {\n const targetRoot = path.resolve(options.cwd ?? process.cwd());\n const targetSkillsDir = path.join(targetRoot, PROJECT_SKILLS_DIR);\n const bundledNames = await listBundledSkills();\n\n await fs.mkdir(targetSkillsDir, { recursive: true });\n await removeManagedSkillArtifacts(targetSkillsDir, bundledNames);\n await copyBundledSkills(targetSkillsDir, bundledNames);\n\n return {\n bundledNames,\n targetSkillsDir,\n };\n}\n\nasync function installSkills(parsed: ParsedArgs, io: CliIo): Promise<number> {\n try {\n const { bundledNames, targetSkillsDir } = await installBundledSkills({\n cwd: parsed.cwd,\n force: parsed.force,\n });\n io.log(`Installed ${bundledNames.length} Askr skills to ${targetSkillsDir}`);\n return 0;\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n io.error(message);\n io.error(\"Run `askr skills sync` to update Askr skills, or pass --force.\");\n return 1;\n }\n}\n\nasync function syncSkills(parsed: ParsedArgs, io: CliIo): Promise<number> {\n const { bundledNames, targetSkillsDir } = await syncBundledSkills({ cwd: parsed.cwd });\n io.log(`Synced ${bundledNames.length} Askr skills to ${targetSkillsDir}`);\n return 0;\n}\n\nasync function reviewSkills(parsed: ParsedArgs, io: CliIo): Promise<number> {\n if (parsed.help && parsed.command === \"review\") {\n io.log(reviewHelpText());\n return 0;\n }\n\n if (!parsed.reviewPrompt) {\n io.log(reviewHelpText());\n return 0;\n }\n\n if (parsed.reviewPrompt === \"list\") {\n const prompts = listSkillReviewPrompts();\n for (const prompt of prompts) {\n io.log(`${prompt.id}\\t${prompt.title}`);\n }\n return 0;\n }\n\n try {\n const result = await runSkillReview(parsed.reviewPrompt, { cwd: parsed.cwd });\n io.log(parsed.json ? JSON.stringify(result, null, 2) : formatSkillReviewReport(result));\n return result.status === \"pass\" ? 0 : 1;\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n io.error(message);\n const errorCode =\n typeof error === \"object\" && error && \"code\" in error\n ? String((error as { code?: string }).code)\n : \"\";\n if (errorCode === \"UNKNOWN_REVIEW_PROMPT\") {\n io.error(\"Run `askr skills review list` to see available prompt ids.\");\n }\n return 1;\n }\n}\n\nexport async function runSkillsCli(\n args: string[] = process.argv.slice(2),\n io: CliIo = console,\n): Promise<number> {\n const parsed = parseArgs(args);\n\n if (parsed.command === \"review\" && parsed.help) {\n io.log(reviewHelpText());\n return 0;\n }\n\n if (!parsed.command || parsed.help) {\n io.log(helpText());\n return 0;\n }\n\n const source = await findBundledSkillsDir();\n if (!(await pathExists(source))) {\n io.error(`Bundled skills directory not found: ${source}`);\n return 1;\n }\n\n if (parsed.command === \"list\") {\n const names = await listBundledSkills();\n for (const name of names) {\n io.log(name);\n }\n return 0;\n }\n\n if (parsed.command === \"install\") {\n return installSkills(parsed, io);\n }\n\n if (parsed.command === \"sync\") {\n return syncSkills(parsed, io);\n }\n\n if (parsed.command === \"review\") {\n return reviewSkills(parsed, io);\n }\n\n io.error(`Unknown skills command: ${parsed.command}`);\n io.error(\"Run `askr skills --help` to see available commands.\");\n return 1;\n}\n\nasync function main(): Promise<void> {\n const code = await runSkillsCli(process.argv.slice(2));\n process.exit(code);\n}\n\nif (isDirectExecution(import.meta.url)) {\n void main();\n}\n"],"mappings":";;;;;AAqDA,MAAM,uCAAuB,IAAI,IAAI;CACnC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;AAED,MAAM,sCAAsB,IAAI,IAAI;CAClC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;AAED,SAAS,GAAG,OAAe,QAAgB,QAAQ,KAAoB;CACrE,OAAO;EACL;EACA,OAAO,IAAI,OAAO,QAAQ,KAAK;CACjC;AACF;AAEA,SAAS,WAAW,aAAqB,UAA4C;CACnF,OAAO;EACL;EACA,MAAM;EACN,OAAO;EACP;CACF;AACF;AAEA,SAAS,WAAW,aAAqB,UAA4C;CACnF,OAAO;EACL;EACA,MAAM;EACN,OAAO;EACP;CACF;AACF;AAEA,SAAS,OAAO,aAAqB,UAA4C;CAC/E,OAAO;EACL;EACA,MAAM;EACN,OAAO;EACP;CACF;AACF;AAEA,MAAM,iBAA2C;CAC/C;EACE,IAAI;EACJ,OAAO;EACP,eAAe,CAAC,qBAAqB,yBAAyB;EAC9D,aACE;EACF,QACE;EACF,YAAY;GACV,WAAW,oCAAoC,CAAC,GAAG,WAAW,OAAO,GAAG,cAAc,CAAC,CAAC;GACxF,WAAW,iDAAiD,CAC1D,GAAG,SAAS,OAAO,GAAG,QAAQ,GAC9B,GAAG,SAAS,OAAO,GAAG,YAAY,CACpC,CAAC;GACD,OAAO,yCAAyC;IAC9C,GAAG,gBAAgB,OAAO,GAAG,sBAAsB;IACnD,GAAG,YAAY,OAAO,GAAG,iBAAiB;IAC1C,GAAG,aAAa,OAAO,GAAG,kBAAkB;GAC9C,CAAC;EACH;CACF;CACA;EACE,IAAI;EACJ,OAAO;EACP,eAAe,CAAC,0BAA0B,sBAAsB;EAChE,a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C9D,OAAO;AACT;AAEA,eAAe,OAAsB;CACnC,MAAM,OAAO,MAAM,aAAa,QAAQ,KAAK,MAAM,CAAC,CAAC;CACrD,QAAQ,KAAK,IAAI;AACnB;AAEA,IAAI,kBAAkB,OAAO,KAAK,GAAG,GACnC,KAAU"}
package/dist/ssg.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"ssg.js","names":[],"sources":["../src/bin/ssg.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport { existsSync } from \"node:fs\";\nimport { dirname, resolve } from \"node:path\";\nimport { pathToFileURL } from \"node:url\";\nimport { register } from \"tsx/esm/api\";\nimport { isDirectExecution } from \"./is-direct-execution\";\n\ntype CliIo = Pick<Console, \"error\" | \"log\">;\n\ninterface ParsedSsgArgs {\n configPath: string;\n outputDir: string;\n workers: number | \"auto\";\n incremental: boolean;\n changedKeys: string[];\n changedRoutes: string[];\n forceFull: boolean;\n help: boolean;\n}\n\ninterface LoadedConfig {\n routes?: unknown[];\n registry?: unknown;\n seed?: unknown;\n dataOverrides?: unknown;\n concurrency?: number;\n document?: unknown;\n assets?: unknown[];\n}\n\ninterface RouteResult {\n path: string;\n status: string;\n error?: string;\n}\n\ninterface GenerateResult {\n mode: string;\n successful: number;\n totalRoutes: number;\n failed: number;\n rebuilt: number;\n skipped: number;\n removed: number;\n cacheHits: number;\n routes: RouteResult[];\n}\n\ninterface StaticGen {\n generate(options: ReturnType<typeof toGenerateOptions>): Promise<GenerateResult>;\n}\n\ninterface SsgDeps {\n cwd?: () => string;\n now?: () => number;\n existsSync?: typeof existsSync;\n importConfig?: (filePath: string) => Promise<unknown>;\n createStaticGen?: (options: {\n routes?: unknown[];\n registry?: unknown;\n outputDir: string;\n seed?: unknown;\n dataOverrides?: unknown;\n concurrency?: number;\n parallelism: number | \"auto\";\n document?: unknown;\n assets?: unknown[];\n }) => StaticGen;\n}\n\nconst helpText = `\naskr ssg - Static Site Generation for Askr\n\nUsage:\n askr ssg --config <path> --output <dir> [--incremental]\n\nOptions:\n --config <path> Path to SSG config file (TypeScript module)\n --output <dir> Output directory for generated HTML\n --workers <n|auto> Preferred render worker count for SSG throughput\n --incremental Use incremental generation if a manifest exists\n --changed-key <key> Mark an invalidation key as changed (repeatable)\n --changed-route <path> Mark a concrete route path as changed (repeatable)\n --force-full Force a full rebuild even with incremental flags\n --help Show this help message\n\nExamples:\n askr ssg --config ./ssg.config.ts --output ./dist/static\n askr ssg --config ./ssg.config.ts --output ./dist/static --incremental\n`;\n\nconst defaultDeps: Required<Pick<SsgDeps, \"cwd\" | \"existsSync\" | \"now\">> = {\n cwd: () => process.cwd(),\n now: () => Date.now(),\n existsSync,\n};\n\nasync function importProjectConfig(filePath: string): Promise<{\n module: unknown;\n unregister: () => Promise<void>;\n}> {\n const tsconfig = resolve(dirname(filePath), \"tsconfig.json\");\n const unregister = register(existsSync(tsconfig) ? { tsconfig } : undefined);\n\n try {\n return {\n module: await import(pathToFileURL(filePath).href),\n unregister,\n };\n } catch (error) {\n await unregister();\n throw error;\n }\n}\n\nasync function loadCreateStaticGen(): Promise<NonNullable<SsgDeps[\"createStaticGen\"]>> {\n const mod = (await import(\"@askrjs/askr/ssg\")) as {\n createStaticGen?: SsgDeps[\"createStaticGen\"];\n };\n if (typeof mod.createStaticGen !== \"function\") {\n throw new Error(\"Failed to load createStaticGen from @askrjs/askr/ssg\");\n }\n return mod.createStaticGen;\n}\n\nexport function parseCliArgs(args: string[]): ParsedSsgArgs {\n const parsed: ParsedSsgArgs = {\n configPath: \"\",\n outputDir: \"\",\n workers: 1,\n incremental: false,\n changedKeys: [],\n changedRoutes: [],\n forceFull: false,\n help: false,\n };\n\n for (let i = 0; i < args.length; i += 1) {\n if (args[i] === \"--config\" && i + 1 < args.length) {\n parsed.configPath = args[i + 1];\n i += 1;\n } else if (args[i] === \"--output\" && i + 1 < args.length) {\n parsed.outputDir = args[i + 1];\n i += 1;\n } else if (args[i] === \"--workers\" && i + 1 < args.length) {\n parsed.workers = args[i + 1] === \"auto\" ? \"auto\" : Number(args[i + 1]);\n i += 1;\n } else if (args[i] === \"--changed-key\" && i + 1 < args.length) {\n parsed.changedKeys.push(args[i + 1]);\n i += 1;\n } else if (args[i] === \"--changed-route\" && i + 1 < args.length) {\n parsed.changedRoutes.push(args[i + 1]);\n i += 1;\n } else if (args[i] === \"--incremental\") {\n parsed.incremental = true;\n } else if (args[i] === \"--force-full\") {\n parsed.forceFull = true;\n } else if (args[i] === \"--help\" || args[i] === \"-h\") {\n parsed.help = true;\n }\n }\n\n return parsed;\n}\n\nfunction toGenerateOptions(args: ParsedSsgArgs) {\n return {\n mode: args.incremental ? \"incremental\" : \"full\",\n changedKeys: args.changedKeys,\n changedRoutes: args.changedRoutes,\n forceFull: args.forceFull,\n };\n}\n\nfunction printSummary(\n io: CliIo,\n outputDir: string,\n durationSeconds: string,\n result: GenerateResult,\n): void {\n io.log(\"\");\n io.log(`Generation complete in ${durationSeconds}s`);\n io.log(` Mode: ${result.mode}`);\n io.log(` Generated: ${result.successful}/${result.totalRoutes} routes`);\n io.log(` Failed: ${result.failed} routes`);\n io.log(` Rebuilt: ${result.rebuilt} routes`);\n io.log(` Skipped: ${result.skipped} routes`);\n io.log(` Removed: ${result.removed} routes`);\n io.log(` CacheHit: ${result.cacheHits} routes`);\n io.log(` Output: ${outputDir}`);\n io.log(` Metadata: ${outputDir}/metadata.json`);\n io.log(\"\");\n}\n\nexport async function runSsgCli(\n args: string[] = process.argv.slice(2),\n deps: SsgDeps = {},\n io: CliIo = console,\n): Promise<number> {\n const parsed = parseCliArgs(args);\n if (parsed.help) {\n io.log(helpText);\n return 0;\n }\n\n if (!parsed.configPath) {\n io.error(\"Error: --config argument is required\");\n return 1;\n }\n\n if (!parsed.configPath.endsWith(\".ts\")) {\n io.error(\"Error: --config must point to a TypeScript file (.ts)\");\n return 1;\n }\n\n if (!parsed.outputDir) {\n io.error(\"Error: --output argument is required\");\n return 1;\n }\n\n const resolvedDeps = { ...defaultDeps, ...deps };\n const resolvedConfigPath = resolve(resolvedDeps.cwd(), parsed.configPath);\n const resolvedOutputDir = resolve(resolvedDeps.cwd(), parsed.outputDir);\n\n if (!resolvedDeps.existsSync(resolvedConfigPath)) {\n io.error(`Error: Config file not found: ${resolvedConfigPath}`);\n return 1;\n }\n\n let unregisterProjectLoader: (() => Promise<void>) | undefined;\n try {\n io.log(`Loading config: ${resolvedConfigPath}`);\n\n let imported: unknown;\n if (deps.importConfig) {\n imported = await deps.importConfig(resolvedConfigPath);\n } else {\n const loaded = await importProjectConfig(resolvedConfigPath);\n imported = loaded.module;\n unregisterProjectLoader = loaded.unregister;\n }\n const configModule = imported as {\n default?: LoadedConfig;\n staticConfig?: LoadedConfig;\n routes?: unknown[];\n registry?: unknown;\n seed?: unknown;\n dataOverrides?: unknown;\n concurrency?: number;\n document?: unknown;\n assets?: unknown[];\n };\n const candidate = configModule.default ?? configModule.staticConfig ?? configModule;\n const hasRoutes = Array.isArray(candidate.routes);\n const hasRegistry = candidate.registry !== undefined;\n\n if (hasRoutes === hasRegistry) {\n io.error(\"Error: Config must provide exactly one route source: routes or registry\");\n return 1;\n }\n const config = candidate as LoadedConfig;\n\n io.log(\n hasRoutes\n ? `Generating ${config.routes?.length ?? 0} routes...`\n : \"Generating registered routes...\",\n );\n\n const createStaticGen =\n typeof resolvedDeps.createStaticGen === \"function\"\n ? resolvedDeps.createStaticGen\n : await loadCreateStaticGen();\n\n const ssg = createStaticGen({\n ...(hasRoutes ? { routes: config.routes } : { registry: config.registry }),\n outputDir: resolvedOutputDir,\n seed: config.seed,\n dataOverrides: config.dataOverrides,\n concurrency: config.concurrency,\n parallelism: parsed.workers,\n document: config.document,\n assets: config.assets,\n });\n\n const startTime = resolvedDeps.now();\n const result = await ssg.generate(toGenerateOptions(parsed));\n const duration = ((resolvedDeps.now() - startTime) / 1000).toFixed(2);\n\n printSummary(io, resolvedOutputDir, duration, result);\n\n if (result.failed > 0) {\n io.log(\"Errors encountered:\");\n for (const route of result.routes) {\n if (route.status === \"error\") {\n io.log(` ${route.path}: ${route.error}`);\n }\n }\n io.log(\"\");\n return 1;\n }\n\n return 0;\n } catch (error) {\n io.error(\"Generation failed:\");\n io.error(error instanceof Error ? error.message : String(error));\n if (error instanceof Error && error.stack) {\n io.error(error.stack);\n }\n return 1;\n } finally {\n await unregisterProjectLoader?.();\n }\n}\n\nasync function main(): Promise<void> {\n const code = await runSsgCli(process.argv.slice(2));\n process.exit(code);\n}\n\nif (isDirectExecution(import.meta.url)) {\n void main();\n}\n"],"mappings":";;;;;;;AAuEA,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;AAqBjB,MAAM,cAAqE;CACzE,WAAW,QAAQ,IAAI;CACvB,WAAW,KAAK,IAAI;CACpB;AACF;AAEA,eAAe,oBAAoB,UAGhC;CACD,MAAM,WAAW,QAAQ,QAAQ,QAAQ,GAAG,eAAe;CAC3D,MAAM,aAAa,SAAS,WAAW,QAAQ,IAAI,EAAE,SAAS,IAAI,KAAA,CAAS;CAE3E,IAAI;EACF,OAAO;GACL,QAAQ,MAAM,OAAO,cAAc,QAAQ,CAAC,CAAC;GAC7C;EACF;CACF,SAAS,OAAO;EACd,MAAM,WAAW;EACjB,MAAM;CACR;AACF;AAEA,eAAe,sBAAwE;CACrF,MAAM,MAAO,MAAM,OAAO;CAG1B,IAAI,OAAO,IAAI,oBAAoB,YACjC,MAAM,IAAI,MAAM,sDAAsD;CAExE,OAAO,IAAI;AACb;AAEA,SAAgB,aAAa,MAA+B;CAC1D,MAAM,SAAwB;EAC5B,YAAY;EACZ,WAAW;EACX,SAAS;EACT,aAAa;EACb,aAAa,CAAC;EACd,eAAe,CAAC;EAChB,WAAW;EACX,MAAM;CACR;CAEA,KAAK,IAAI,IAAI,GAAG,IAAI,KAAK,QAAQ,KAAK,GACpC,IAAI,KAAK,OAAO,cAAc,IAAI,IAAI,KAAK,QAAQ;EACjD,OAAO,aAAa,KAAK,IAAI;EAC7B,KAAK;CACP,OAAO,IAAI,KAAK,OAAO,cAAc,IA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zC,iCACN;EAOA,MAAM,OAJJ,OAAO,aAAa,oBAAoB,aACpC,aAAa,kBACb,MAAM,oBAAoB,EAAA,CAEJ;GAC1B,GAAI,YAAY,EAAE,QAAQ,OAAO,OAAO,IAAI,EAAE,UAAU,OAAO,SAAS;GACxE,WAAW;GACX,MAAM,OAAO;GACb,eAAe,OAAO;GACtB,aAAa,OAAO;GACpB,aAAa,OAAO;GACpB,UAAU,OAAO;GACjB,QAAQ,OAAO;EACjB,CAAC;EAED,MAAM,YAAY,aAAa,IAAI;EACnC,MAAM,SAAS,MAAM,IAAI,SAAS,kBAAkB,MAAM,CAAC;EAG3D,aAAa,IAAI,qBAFE,aAAa,IAAI,IAAI,aAAa,IAAA,CAAM,QAAQ,CAExB,GAAG,MAAM;EAEpD,IAAI,OAAO,SAAS,GAAG;GACrB,GAAG,IAAI,qBAAqB;GAC5B,KAAK,MAAM,SAAS,OAAO,QACzB,IAAI,MAAM,WAAW,SACnB,GAAG,IAAI,MAAM,MAAM,KAAK,IAAI,MAAM,OAAO;GAG7C,GAAG,IAAI,EAAE;GACT,OAAO;EACT;EAEA,OAAO;CACT,SAAS,OAAO;EACd,GAAG,MAAM,oBAAoB;EAC7B,GAAG,MAAM,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,CAAC;EAC/D,IAAI,iBAAiB,SAAS,MAAM,OAClC,GAAG,MAAM,MAAM,KAAK;EAEtB,OAAO;CACT,UAAU;EACR,MAAM,0BAA0B;CAClC;AACF;AAEA,eAAe,OAAsB;CACnC,MAAM,OAAO,MAAM,UAAU,QAAQ,KAAK,MAAM,CAAC,CAAC;CAClD,QAAQ,KAAK,IAAI;AACnB;AAEA,IAAI,kBAAkB,OAAO,KAAK,GAAG,GACnC,KAAU"}
@@ -1,6 +0,0 @@
1
- declare module 'virtual:askr-server' {
2
- import type { ServerApp } from '@askrjs/server';
3
- const app: ServerApp;
4
- export default app;
5
- }
6
-
@@ -1 +0,0 @@
1
- declare module '*.css';
@@ -1,5 +0,0 @@
1
- declare module '*.css' {
2
- const css: string;
3
-
4
- export default css;
5
- }
@@ -1,7 +0,0 @@
1
- declare module 'virtual:askr-server' {
2
- import type { ServerApp } from '@askrjs/server';
3
-
4
- const app: ServerApp;
5
- export { app };
6
- export default app;
7
- }
@@ -1,5 +0,0 @@
1
- declare module '*.css' {
2
- const css: string;
3
-
4
- export default css;
5
- }