create-hq 6.0.0 → 10.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (336) hide show
  1. package/dist/__tests__/deps.test.d.ts +2 -0
  2. package/dist/__tests__/deps.test.d.ts.map +1 -0
  3. package/dist/__tests__/deps.test.js +176 -0
  4. package/dist/__tests__/deps.test.js.map +1 -0
  5. package/dist/__tests__/platform.test.d.ts +2 -0
  6. package/dist/__tests__/platform.test.d.ts.map +1 -0
  7. package/dist/__tests__/platform.test.js +127 -0
  8. package/dist/__tests__/platform.test.js.map +1 -0
  9. package/dist/__tests__/scaffold.test.d.ts +2 -0
  10. package/dist/__tests__/scaffold.test.d.ts.map +1 -0
  11. package/dist/__tests__/scaffold.test.js +150 -0
  12. package/dist/__tests__/scaffold.test.js.map +1 -0
  13. package/dist/auth.d.ts +32 -0
  14. package/dist/auth.d.ts.map +1 -0
  15. package/dist/auth.js +156 -0
  16. package/dist/auth.js.map +1 -0
  17. package/dist/cloud-sync.d.ts +11 -0
  18. package/dist/cloud-sync.d.ts.map +1 -0
  19. package/dist/cloud-sync.js +25 -0
  20. package/dist/cloud-sync.js.map +1 -0
  21. package/dist/deps.d.ts +32 -2
  22. package/dist/deps.d.ts.map +1 -1
  23. package/dist/deps.js +182 -7
  24. package/dist/deps.js.map +1 -1
  25. package/dist/fetch-template.d.ts +14 -0
  26. package/dist/fetch-template.d.ts.map +1 -0
  27. package/dist/fetch-template.js +136 -0
  28. package/dist/fetch-template.js.map +1 -0
  29. package/dist/index.js +9 -7
  30. package/dist/index.js.map +1 -1
  31. package/dist/packages.d.ts +71 -0
  32. package/dist/packages.d.ts.map +1 -0
  33. package/dist/packages.js +332 -0
  34. package/dist/packages.js.map +1 -0
  35. package/dist/platform.d.ts +9 -0
  36. package/dist/platform.d.ts.map +1 -0
  37. package/dist/platform.js +69 -0
  38. package/dist/platform.js.map +1 -0
  39. package/dist/scaffold.d.ts +3 -2
  40. package/dist/scaffold.d.ts.map +1 -1
  41. package/dist/scaffold.js +109 -290
  42. package/dist/scaffold.js.map +1 -1
  43. package/dist/ui.d.ts +2 -3
  44. package/dist/ui.d.ts.map +1 -1
  45. package/dist/ui.js +90 -44
  46. package/dist/ui.js.map +1 -1
  47. package/package.json +49 -40
  48. package/template/.claude/CLAUDE.md +0 -202
  49. package/template/.claude/commands/checkpoint.md +0 -127
  50. package/template/.claude/commands/cleanup.md +0 -307
  51. package/template/.claude/commands/execute-task.md +0 -440
  52. package/template/.claude/commands/exit-plan.md +0 -41
  53. package/template/.claude/commands/handoff.md +0 -97
  54. package/template/.claude/commands/learn.md +0 -218
  55. package/template/.claude/commands/metrics.md +0 -118
  56. package/template/.claude/commands/newworker.md +0 -162
  57. package/template/.claude/commands/nexttask.md +0 -67
  58. package/template/.claude/commands/prd.md +0 -238
  59. package/template/.claude/commands/reanchor.md +0 -51
  60. package/template/.claude/commands/remember.md +0 -126
  61. package/template/.claude/commands/run-project.md +0 -348
  62. package/template/.claude/commands/run.md +0 -110
  63. package/template/.claude/commands/search-reindex.md +0 -62
  64. package/template/.claude/commands/search.md +0 -100
  65. package/template/.claude/commands/setup.md +0 -381
  66. package/template/.claude/scripts/pure-ralph-loop.ps1 +0 -312
  67. package/template/.claude/scripts/pure-ralph-loop.sh +0 -859
  68. package/template/CHANGELOG.md +0 -220
  69. package/template/LICENSE +0 -21
  70. package/template/MIGRATION.md +0 -259
  71. package/template/README.md +0 -368
  72. package/template/data/journal/.gitkeep +0 -0
  73. package/template/docs/images/ascii-banner-options.md +0 -122
  74. package/template/docs/images/hq-banner.svg +0 -105
  75. package/template/knowledge/Ralph/01-overview.md +0 -71
  76. package/template/knowledge/Ralph/02-core-concepts.md +0 -114
  77. package/template/knowledge/Ralph/03-how-ralph-works.md +0 -184
  78. package/template/knowledge/Ralph/04-back-pressure.md +0 -222
  79. package/template/knowledge/Ralph/05-specifications.md +0 -210
  80. package/template/knowledge/Ralph/06-agents-md.md +0 -222
  81. package/template/knowledge/Ralph/07-implementation.md +0 -316
  82. package/template/knowledge/Ralph/08-economics.md +0 -182
  83. package/template/knowledge/Ralph/09-resources.md +0 -145
  84. package/template/knowledge/Ralph/10-claude-code-workflow.md +0 -212
  85. package/template/knowledge/Ralph/11-team-training-guide.md +0 -383
  86. package/template/knowledge/Ralph/README.md +0 -40
  87. package/template/knowledge/ai-security-framework/CONTRIBUTING.md +0 -139
  88. package/template/knowledge/ai-security-framework/GLOSSARY.md +0 -176
  89. package/template/knowledge/ai-security-framework/LICENSE +0 -21
  90. package/template/knowledge/ai-security-framework/QUICK-START.md +0 -172
  91. package/template/knowledge/ai-security-framework/README.md +0 -232
  92. package/template/knowledge/ai-security-framework/checklists/browser-security.md +0 -301
  93. package/template/knowledge/ai-security-framework/checklists/credential-isolation.md +0 -322
  94. package/template/knowledge/ai-security-framework/checklists/incident-response.md +0 -288
  95. package/template/knowledge/ai-security-framework/checklists/pre-flight.md +0 -249
  96. package/template/knowledge/ai-security-framework/checklists/weekly-audit.md +0 -159
  97. package/template/knowledge/ai-security-framework/configs/audit-logging.md +0 -372
  98. package/template/knowledge/ai-security-framework/configs/kill-switches.md +0 -354
  99. package/template/knowledge/ai-security-framework/docs/01-core-principles.md +0 -256
  100. package/template/knowledge/ai-security-framework/docs/02-threat-landscape.md +0 -326
  101. package/template/knowledge/ai-security-framework/docs/03-security-posture.md +0 -250
  102. package/template/knowledge/ai-security-framework/templates/agents-security.md +0 -233
  103. package/template/knowledge/design-styles/README.md +0 -42
  104. package/template/knowledge/design-styles/american-industrial.md +0 -136
  105. package/template/knowledge/design-styles/ethereal-abstract.md +0 -133
  106. package/template/knowledge/design-styles/liminal-portal.md +0 -111
  107. package/template/knowledge/design-styles/swipes/american-industrial/G-3m4YPW0AADdu2.jpeg +0 -0
  108. package/template/knowledge/design-styles/swipes/american-industrial/G-JJlt5WwAABK3K.png +0 -0
  109. package/template/knowledge/design-styles/swipes/american-industrial/G-JJmj5W0AEbJ-7.png +0 -0
  110. package/template/knowledge/design-styles/swipes/american-industrial/G59fgNuXkAAKLJQ (1).jpeg +0 -0
  111. package/template/knowledge/design-styles/swipes/american-industrial/G59fgNuXkAAKLJQ.jpeg +0 -0
  112. package/template/knowledge/design-styles/swipes/american-industrial/G7fVkn3WEAAM-ST.jpeg +0 -0
  113. package/template/knowledge/design-styles/swipes/american-industrial/G8ECO5JWEAIksyn.png +0 -0
  114. package/template/knowledge/design-styles/swipes/american-industrial/G9-3GQSWoAA8eqZ.png +0 -0
  115. package/template/knowledge/design-styles/swipes/american-industrial/G9xEOqrXkAEZRcs.png +0 -0
  116. package/template/knowledge/design-styles/swipes/american-industrial/G_MVeJrXQAA8sx4.jpeg +0 -0
  117. package/template/knowledge/design-styles/swipes/american-industrial/G_RSkmGXkAAgAVZ.png +0 -0
  118. package/template/knowledge/design-styles/swipes/american-industrial/README.md +0 -31
  119. package/template/knowledge/design-styles/swipes/american-industrial/qyqtg7Dq.png +0 -0
  120. package/template/knowledge/dev-team/README.md +0 -35
  121. package/template/knowledge/dev-team/patterns/README.md +0 -34
  122. package/template/knowledge/dev-team/patterns/frontend/react-best-practices.md +0 -178
  123. package/template/knowledge/dev-team/troubleshooting/README.md +0 -31
  124. package/template/knowledge/dev-team/workflows/README.md +0 -49
  125. package/template/knowledge/hq/checkpoint-schema.json +0 -51
  126. package/template/knowledge/hq/index-md-spec.md +0 -74
  127. package/template/knowledge/hq/thread-schema.md +0 -153
  128. package/template/knowledge/hq-core/checkpoint-schema.json +0 -51
  129. package/template/knowledge/hq-core/index-md-spec.md +0 -74
  130. package/template/knowledge/hq-core/thread-schema.md +0 -153
  131. package/template/knowledge/loom/README.md +0 -51
  132. package/template/knowledge/loom/architecture.md +0 -125
  133. package/template/knowledge/loom/code-style.md +0 -169
  134. package/template/knowledge/loom/llm-proxy.md +0 -132
  135. package/template/knowledge/loom/state-machine.md +0 -131
  136. package/template/knowledge/loom/thread-system.md +0 -117
  137. package/template/knowledge/loom/tools.md +0 -94
  138. package/template/knowledge/loom/weaver.md +0 -96
  139. package/template/knowledge/loom/web-frontend.md +0 -131
  140. package/template/knowledge/projects/README.md +0 -72
  141. package/template/knowledge/projects/templates/README.template.md +0 -28
  142. package/template/knowledge/workers/README.md +0 -195
  143. package/template/knowledge/workers/ralph-loop-pattern.md +0 -157
  144. package/template/knowledge/workers/skill-schema.md +0 -182
  145. package/template/knowledge/workers/state-machine.md +0 -102
  146. package/template/knowledge/workers/templates/base-worker.yaml +0 -73
  147. package/template/knowledge/workers/templates/code-worker.yaml +0 -85
  148. package/template/knowledge/workers/templates/skill.yaml +0 -49
  149. package/template/knowledge/workers/templates/social-worker.yaml +0 -70
  150. package/template/modules/examples/full-manifest.yaml +0 -92
  151. package/template/modules/examples/minimal.yaml +0 -14
  152. package/template/modules/modules.yaml +0 -59
  153. package/template/projects/.gitkeep +0 -0
  154. package/template/projects/incorporate-workers-into-pure-ralph/prd.json +0 -88
  155. package/template/projects/pure-ralph-branch-isolation/README.md +0 -114
  156. package/template/projects/pure-ralph-branch-isolation/prd.json +0 -123
  157. package/template/projects/purist-ralph-loop/README.md +0 -148
  158. package/template/projects/purist-ralph-loop/prd.json +0 -135
  159. package/template/projects/ralph-test/prd.json +0 -50
  160. package/template/prompts/pure-ralph-base.md +0 -551
  161. package/template/settings/.gitkeep +0 -0
  162. package/template/settings/pure-ralph.json +0 -42
  163. package/template/social-content/drafts/INDEX.md +0 -21
  164. package/template/social-content/drafts/linkedin/.gitkeep +0 -1
  165. package/template/social-content/drafts/x/.gitkeep +0 -1
  166. package/template/social-content/images/.gitkeep +0 -1
  167. package/template/starter-projects/code-worker/README.md +0 -97
  168. package/template/starter-projects/code-worker/prd.json +0 -45
  169. package/template/starter-projects/personal-assistant/README.md +0 -42
  170. package/template/starter-projects/personal-assistant/prd.json +0 -43
  171. package/template/starter-projects/social-media/README.md +0 -60
  172. package/template/starter-projects/social-media/prd.json +0 -43
  173. package/template/workers/content-brand/README.md +0 -59
  174. package/template/workers/content-brand/skills/messaging-alignment.md +0 -91
  175. package/template/workers/content-brand/skills/tone-check.md +0 -76
  176. package/template/workers/content-brand/skills/voice-analysis.md +0 -68
  177. package/template/workers/content-brand/worker.yaml +0 -81
  178. package/template/workers/content-legal/README.md +0 -80
  179. package/template/workers/content-legal/skills/claim-substantiation.md +0 -150
  180. package/template/workers/content-legal/skills/compliance-scan.md +0 -123
  181. package/template/workers/content-legal/skills/disclaimer-check.md +0 -146
  182. package/template/workers/content-legal/worker.yaml +0 -118
  183. package/template/workers/content-product/README.md +0 -77
  184. package/template/workers/content-product/skills/claim-verification.md +0 -96
  185. package/template/workers/content-product/skills/feature-accuracy.md +0 -117
  186. package/template/workers/content-product/skills/stats-check.md +0 -128
  187. package/template/workers/content-product/worker.yaml +0 -97
  188. package/template/workers/content-sales/README.md +0 -70
  189. package/template/workers/content-sales/skills/conversion-analysis.md +0 -96
  190. package/template/workers/content-sales/skills/cta-audit.md +0 -107
  191. package/template/workers/content-sales/skills/value-prop-check.md +0 -114
  192. package/template/workers/content-sales/worker.yaml +0 -93
  193. package/template/workers/content-shared/cli.ts +0 -242
  194. package/template/workers/content-shared/index.ts +0 -234
  195. package/template/workers/content-shared/lib/accuracy-analyzer.ts +0 -661
  196. package/template/workers/content-shared/lib/analyze.ts +0 -370
  197. package/template/workers/content-shared/lib/brand-analyzer.ts +0 -526
  198. package/template/workers/content-shared/lib/cms-integration.ts +0 -446
  199. package/template/workers/content-shared/lib/compliance-analyzer.ts +0 -655
  200. package/template/workers/content-shared/lib/conversion-analyzer.ts +0 -555
  201. package/template/workers/content-shared/lib/github-integration.ts +0 -582
  202. package/template/workers/content-shared/lib/output.ts +0 -373
  203. package/template/workers/content-shared/lib/parser.ts +0 -771
  204. package/template/workers/content-shared/lib/priority.ts +0 -439
  205. package/template/workers/content-shared/lib/recommendations.ts +0 -512
  206. package/template/workers/content-shared/lib/reporter.ts +0 -749
  207. package/template/workers/content-shared/lib/restructure.ts +0 -664
  208. package/template/workers/content-shared/lib/scorer.ts +0 -140
  209. package/template/workers/content-shared/lib/types.ts +0 -227
  210. package/template/workers/content-shared/lib/variants.ts +0 -595
  211. package/template/workers/content-shared/package.json +0 -51
  212. package/template/workers/content-shared/pnpm-lock.yaml +0 -39
  213. package/template/workers/content-shared/test/sample-page.json +0 -115
  214. package/template/workers/content-shared/tsconfig.json +0 -20
  215. package/template/workers/dev-team/README.md +0 -166
  216. package/template/workers/dev-team/_template.yaml +0 -70
  217. package/template/workers/dev-team/architect/package.json +0 -27
  218. package/template/workers/dev-team/architect/skills/api-design.md +0 -89
  219. package/template/workers/dev-team/architect/skills/refactor-plan.md +0 -96
  220. package/template/workers/dev-team/architect/skills/system-design.md +0 -100
  221. package/template/workers/dev-team/architect/src/index.ts +0 -49
  222. package/template/workers/dev-team/architect/src/mcp-server.ts +0 -122
  223. package/template/workers/dev-team/architect/src/skills/api-design.ts +0 -316
  224. package/template/workers/dev-team/architect/src/skills/refactor-plan.ts +0 -264
  225. package/template/workers/dev-team/architect/src/skills/system-design.ts +0 -212
  226. package/template/workers/dev-team/architect/tsconfig.json +0 -19
  227. package/template/workers/dev-team/architect/worker.yaml +0 -128
  228. package/template/workers/dev-team/backend-dev/package-lock.json +0 -1252
  229. package/template/workers/dev-team/backend-dev/package.json +0 -27
  230. package/template/workers/dev-team/backend-dev/skills/implement-endpoint.md +0 -70
  231. package/template/workers/dev-team/backend-dev/skills/implement-service.md +0 -62
  232. package/template/workers/dev-team/backend-dev/src/index.ts +0 -51
  233. package/template/workers/dev-team/backend-dev/src/mcp-server.ts +0 -109
  234. package/template/workers/dev-team/backend-dev/src/skills/implement-endpoint.ts +0 -122
  235. package/template/workers/dev-team/backend-dev/src/skills/implement-service.ts +0 -126
  236. package/template/workers/dev-team/backend-dev/tsconfig.json +0 -19
  237. package/template/workers/dev-team/backend-dev/worker.yaml +0 -128
  238. package/template/workers/dev-team/code-reviewer/package-lock.json +0 -1080
  239. package/template/workers/dev-team/code-reviewer/package.json +0 -24
  240. package/template/workers/dev-team/code-reviewer/skills/merge-to-production.md +0 -61
  241. package/template/workers/dev-team/code-reviewer/skills/merge-to-staging.md +0 -54
  242. package/template/workers/dev-team/code-reviewer/skills/request-changes.md +0 -63
  243. package/template/workers/dev-team/code-reviewer/skills/review-pr.md +0 -77
  244. package/template/workers/dev-team/code-reviewer/src/index.ts +0 -56
  245. package/template/workers/dev-team/code-reviewer/src/mcp-server.ts +0 -101
  246. package/template/workers/dev-team/code-reviewer/tsconfig.json +0 -19
  247. package/template/workers/dev-team/code-reviewer/worker.yaml +0 -90
  248. package/template/workers/dev-team/database-dev/package.json +0 -22
  249. package/template/workers/dev-team/database-dev/skills/create-schema.md +0 -48
  250. package/template/workers/dev-team/database-dev/src/index.ts +0 -50
  251. package/template/workers/dev-team/database-dev/src/mcp-server.ts +0 -76
  252. package/template/workers/dev-team/database-dev/tsconfig.json +0 -18
  253. package/template/workers/dev-team/database-dev/worker.yaml +0 -90
  254. package/template/workers/dev-team/frontend-dev/package.json +0 -22
  255. package/template/workers/dev-team/frontend-dev/skills/create-component.md +0 -26
  256. package/template/workers/dev-team/frontend-dev/src/index.ts +0 -50
  257. package/template/workers/dev-team/frontend-dev/src/mcp-server.ts +0 -77
  258. package/template/workers/dev-team/frontend-dev/tsconfig.json +0 -18
  259. package/template/workers/dev-team/frontend-dev/worker.yaml +0 -132
  260. package/template/workers/dev-team/infra-dev/package.json +0 -24
  261. package/template/workers/dev-team/infra-dev/skills/add-monitoring.md +0 -73
  262. package/template/workers/dev-team/infra-dev/skills/configure-deployment.md +0 -80
  263. package/template/workers/dev-team/infra-dev/skills/create-dockerfile.md +0 -62
  264. package/template/workers/dev-team/infra-dev/skills/setup-cicd.md +0 -63
  265. package/template/workers/dev-team/infra-dev/src/index.ts +0 -55
  266. package/template/workers/dev-team/infra-dev/src/mcp-server.ts +0 -82
  267. package/template/workers/dev-team/infra-dev/tsconfig.json +0 -19
  268. package/template/workers/dev-team/infra-dev/worker.yaml +0 -92
  269. package/template/workers/dev-team/knowledge-curator/package.json +0 -24
  270. package/template/workers/dev-team/knowledge-curator/skills/curate-troubleshooting.md +0 -63
  271. package/template/workers/dev-team/knowledge-curator/skills/process-learnings.md +0 -61
  272. package/template/workers/dev-team/knowledge-curator/skills/sync-documentation.md +0 -76
  273. package/template/workers/dev-team/knowledge-curator/skills/update-patterns.md +0 -63
  274. package/template/workers/dev-team/knowledge-curator/src/index.ts +0 -53
  275. package/template/workers/dev-team/knowledge-curator/src/mcp-server.ts +0 -92
  276. package/template/workers/dev-team/knowledge-curator/tsconfig.json +0 -19
  277. package/template/workers/dev-team/knowledge-curator/worker.yaml +0 -80
  278. package/template/workers/dev-team/motion-designer/package.json +0 -22
  279. package/template/workers/dev-team/motion-designer/skills/add-animation.md +0 -25
  280. package/template/workers/dev-team/motion-designer/skills/generate-image.md +0 -36
  281. package/template/workers/dev-team/motion-designer/src/index.ts +0 -63
  282. package/template/workers/dev-team/motion-designer/src/mcp-server.ts +0 -79
  283. package/template/workers/dev-team/motion-designer/tsconfig.json +0 -18
  284. package/template/workers/dev-team/motion-designer/worker.yaml +0 -84
  285. package/template/workers/dev-team/product-planner/queue.json +0 -4
  286. package/template/workers/dev-team/product-planner/worker.yaml +0 -220
  287. package/template/workers/dev-team/project-manager/package-lock.json +0 -1252
  288. package/template/workers/dev-team/project-manager/package.json +0 -27
  289. package/template/workers/dev-team/project-manager/skills/create-prd.md +0 -66
  290. package/template/workers/dev-team/project-manager/skills/next-issue.md +0 -51
  291. package/template/workers/dev-team/project-manager/skills/project-status.md +0 -59
  292. package/template/workers/dev-team/project-manager/skills/update-learnings.md +0 -65
  293. package/template/workers/dev-team/project-manager/src/index.ts +0 -54
  294. package/template/workers/dev-team/project-manager/src/mcp-server.ts +0 -207
  295. package/template/workers/dev-team/project-manager/src/skills/create-prd.ts +0 -86
  296. package/template/workers/dev-team/project-manager/src/skills/next-issue.ts +0 -137
  297. package/template/workers/dev-team/project-manager/src/skills/project-status.ts +0 -131
  298. package/template/workers/dev-team/project-manager/src/skills/update-learnings.ts +0 -94
  299. package/template/workers/dev-team/project-manager/tsconfig.json +0 -19
  300. package/template/workers/dev-team/project-manager/worker.yaml +0 -96
  301. package/template/workers/dev-team/qa-tester/package.json +0 -24
  302. package/template/workers/dev-team/qa-tester/skills/create-demo-account.md +0 -36
  303. package/template/workers/dev-team/qa-tester/skills/run-tests.md +0 -36
  304. package/template/workers/dev-team/qa-tester/skills/write-test.md +0 -27
  305. package/template/workers/dev-team/qa-tester/src/index.ts +0 -61
  306. package/template/workers/dev-team/qa-tester/src/mcp-server.ts +0 -88
  307. package/template/workers/dev-team/qa-tester/tsconfig.json +0 -18
  308. package/template/workers/dev-team/qa-tester/worker.yaml +0 -116
  309. package/template/workers/dev-team/task-executor/package-lock.json +0 -1252
  310. package/template/workers/dev-team/task-executor/package.json +0 -27
  311. package/template/workers/dev-team/task-executor/skills/analyze-issue.md +0 -101
  312. package/template/workers/dev-team/task-executor/skills/execute.md +0 -133
  313. package/template/workers/dev-team/task-executor/skills/report-learnings.md +0 -106
  314. package/template/workers/dev-team/task-executor/skills/validate-completion.md +0 -121
  315. package/template/workers/dev-team/task-executor/src/index.ts +0 -54
  316. package/template/workers/dev-team/task-executor/src/mcp-server.ts +0 -139
  317. package/template/workers/dev-team/task-executor/src/skills/analyze-issue.ts +0 -219
  318. package/template/workers/dev-team/task-executor/src/skills/execute.ts +0 -132
  319. package/template/workers/dev-team/task-executor/src/skills/report-learnings.ts +0 -119
  320. package/template/workers/dev-team/task-executor/src/skills/validate-completion.ts +0 -142
  321. package/template/workers/dev-team/task-executor/tsconfig.json +0 -19
  322. package/template/workers/dev-team/task-executor/worker.yaml +0 -110
  323. package/template/workers/registry.yaml +0 -171
  324. package/template/workers/security-scanner/README.md +0 -73
  325. package/template/workers/security-scanner/skills/pre-deploy-check.md +0 -205
  326. package/template/workers/security-scanner/worker.yaml +0 -26
  327. package/template/workspace/checkpoints/.gitkeep +0 -0
  328. package/template/workspace/content-ideas/inbox.jsonl +0 -0
  329. package/template/workspace/drafts/.gitkeep +0 -0
  330. package/template/workspace/learnings/.gitkeep +0 -3
  331. package/template/workspace/orchestrator/.gitkeep +0 -0
  332. package/template/workspace/ralph-test/COMPLETE.md +0 -18
  333. package/template/workspace/ralph-test/hello.txt +0 -2
  334. package/template/workspace/reports/.gitkeep +0 -0
  335. package/template/workspace/scratch/.gitkeep +0 -0
  336. package/template/workspace/threads/.gitkeep +0 -3
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=deps.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deps.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/deps.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,176 @@
1
+ import { describe, it, expect } from "vitest";
2
+ import { getInstallCommand } from "../deps.js";
3
+ // ─── Test Fixtures ──────────────────────────────────────────────────────────
4
+ function makeDep(overrides = {}) {
5
+ return {
6
+ name: "test-dep",
7
+ command: "test --version",
8
+ required: true,
9
+ installHint: "brew install test",
10
+ autoInstallable: true,
11
+ installCommands: {},
12
+ ...overrides,
13
+ };
14
+ }
15
+ function makePlatform(overrides = {}) {
16
+ return {
17
+ os: "macos",
18
+ packageManager: "brew",
19
+ npmAvailable: true,
20
+ ...overrides,
21
+ };
22
+ }
23
+ const yqDep = makeDep({
24
+ name: "yq",
25
+ command: "yq --version",
26
+ installHint: "brew install yq",
27
+ installCommands: {
28
+ brew: "brew install yq",
29
+ apt: "sudo snap install yq",
30
+ dnf: "sudo dnf install yq",
31
+ pacman: "sudo pacman -S yq",
32
+ },
33
+ });
34
+ const ghDep = makeDep({
35
+ name: "gh CLI",
36
+ command: "gh --version",
37
+ required: false,
38
+ installHint: "brew install gh",
39
+ installCommands: {
40
+ brew: "brew install gh",
41
+ apt: "sudo apt install gh",
42
+ dnf: "sudo dnf install gh",
43
+ pacman: "sudo pacman -S github-cli",
44
+ },
45
+ });
46
+ const claudeCodeDep = makeDep({
47
+ name: "Claude Code CLI",
48
+ command: "claude --version",
49
+ installHint: "npm install -g @anthropic-ai/claude-code",
50
+ installCommands: {
51
+ npm: "npm install -g @anthropic-ai/claude-code",
52
+ },
53
+ });
54
+ const qmdDep = makeDep({
55
+ name: "qmd (search)",
56
+ command: "qmd --version",
57
+ installHint: "npm install -g @tobilu/qmd",
58
+ installCommands: {
59
+ npm: "npm install -g @tobilu/qmd",
60
+ },
61
+ });
62
+ const vercelDep = makeDep({
63
+ name: "Vercel CLI",
64
+ command: "vercel --version",
65
+ required: false,
66
+ installHint: "npm install -g vercel",
67
+ installCommands: {
68
+ npm: "npm install -g vercel",
69
+ },
70
+ });
71
+ const hqCliDep = makeDep({
72
+ name: "hq-cli",
73
+ command: "hq --version",
74
+ required: false,
75
+ installHint: "npm install -g @indigoai-us/hq-cli",
76
+ installCommands: {
77
+ npm: "npm install -g @indigoai-us/hq-cli",
78
+ },
79
+ });
80
+ const nodeDep = makeDep({
81
+ name: "Node.js",
82
+ command: "node --version",
83
+ required: true,
84
+ installHint: "https://nodejs.org",
85
+ autoInstallable: false,
86
+ installCommands: {},
87
+ });
88
+ // ─── Platforms ──────────────────────────────────────────────────────────────
89
+ const macBrew = makePlatform({ os: "macos", packageManager: "brew", npmAvailable: true });
90
+ const linuxApt = makePlatform({ os: "linux-debian", packageManager: "apt", npmAvailable: true });
91
+ const linuxDnf = makePlatform({ os: "linux-fedora", packageManager: "dnf", npmAvailable: true });
92
+ const linuxPacman = makePlatform({ os: "linux-arch", packageManager: "pacman", npmAvailable: true });
93
+ const linuxYum = makePlatform({ os: "linux-fedora", packageManager: "yum", npmAvailable: true });
94
+ const noPmNoNpm = makePlatform({ os: "unix", packageManager: null, npmAvailable: false });
95
+ const noPmWithNpm = makePlatform({ os: "unix", packageManager: null, npmAvailable: true });
96
+ // ─── Tests ──────────────────────────────────────────────────────────────────
97
+ describe("getInstallCommand", () => {
98
+ describe("macOS + brew", () => {
99
+ it("returns brew command for yq", () => {
100
+ expect(getInstallCommand(yqDep, macBrew)).toBe("brew install yq");
101
+ });
102
+ it("returns brew command for gh CLI", () => {
103
+ expect(getInstallCommand(ghDep, macBrew)).toBe("brew install gh");
104
+ });
105
+ it("returns npm command for npm-only deps (prefers system PM, falls back to npm)", () => {
106
+ // Claude Code only has npm install command, no brew
107
+ expect(getInstallCommand(claudeCodeDep, macBrew)).toBe("npm install -g @anthropic-ai/claude-code");
108
+ });
109
+ });
110
+ describe("Linux + apt", () => {
111
+ it("returns apt command for yq", () => {
112
+ expect(getInstallCommand(yqDep, linuxApt)).toBe("sudo snap install yq");
113
+ });
114
+ it("returns apt command for gh CLI", () => {
115
+ expect(getInstallCommand(ghDep, linuxApt)).toBe("sudo apt install gh");
116
+ });
117
+ });
118
+ describe("Linux + dnf", () => {
119
+ it("returns dnf command for yq", () => {
120
+ expect(getInstallCommand(yqDep, linuxDnf)).toBe("sudo dnf install yq");
121
+ });
122
+ });
123
+ describe("Linux + pacman", () => {
124
+ it("returns pacman command for gh CLI", () => {
125
+ expect(getInstallCommand(ghDep, linuxPacman)).toBe("sudo pacman -S github-cli");
126
+ });
127
+ });
128
+ describe("yum → dnf fallback", () => {
129
+ it("maps yum to dnf commands", () => {
130
+ expect(getInstallCommand(yqDep, linuxYum)).toBe("sudo dnf install yq");
131
+ });
132
+ });
133
+ describe("npm-only deps", () => {
134
+ it("returns npm command for Claude Code when npm available", () => {
135
+ expect(getInstallCommand(claudeCodeDep, noPmWithNpm)).toBe("npm install -g @anthropic-ai/claude-code");
136
+ });
137
+ it("returns npm command for qmd when npm available", () => {
138
+ expect(getInstallCommand(qmdDep, noPmWithNpm)).toBe("npm install -g @tobilu/qmd");
139
+ });
140
+ it("returns npm command for Vercel CLI when npm available", () => {
141
+ expect(getInstallCommand(vercelDep, noPmWithNpm)).toBe("npm install -g vercel");
142
+ });
143
+ it("returns npm command for hq-cli when npm available", () => {
144
+ expect(getInstallCommand(hqCliDep, noPmWithNpm)).toBe("npm install -g @indigoai-us/hq-cli");
145
+ });
146
+ it("returns null for npm-only deps when npm not available", () => {
147
+ expect(getInstallCommand(claudeCodeDep, noPmNoNpm)).toBeNull();
148
+ });
149
+ });
150
+ describe("Node.js dep (no install path)", () => {
151
+ it("returns null — empty installCommands", () => {
152
+ expect(getInstallCommand(nodeDep, macBrew)).toBeNull();
153
+ });
154
+ it("returns null even with npm available", () => {
155
+ expect(getInstallCommand(nodeDep, noPmWithNpm)).toBeNull();
156
+ });
157
+ it("has autoInstallable set to false", () => {
158
+ expect(nodeDep.autoInstallable).toBe(false);
159
+ });
160
+ });
161
+ describe("no matching package manager and no npm", () => {
162
+ it("returns null for system deps when no PM and no npm", () => {
163
+ expect(getInstallCommand(yqDep, noPmNoNpm)).toBeNull();
164
+ });
165
+ it("returns null for gh CLI when no PM and no npm", () => {
166
+ expect(getInstallCommand(ghDep, noPmNoNpm)).toBeNull();
167
+ });
168
+ });
169
+ describe("npm fallback for system deps", () => {
170
+ it("falls back to npm when no system PM but npm available (for deps with npm command)", () => {
171
+ // yq has no npm command, so should return null
172
+ expect(getInstallCommand(yqDep, noPmWithNpm)).toBeNull();
173
+ });
174
+ });
175
+ });
176
+ //# sourceMappingURL=deps.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deps.test.js","sourceRoot":"","sources":["../../src/__tests__/deps.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAI/C,+EAA+E;AAE/E,SAAS,OAAO,CAAC,YAA0B,EAAE;IAC3C,OAAO;QACL,IAAI,EAAE,UAAU;QAChB,OAAO,EAAE,gBAAgB;QACzB,QAAQ,EAAE,IAAI;QACd,WAAW,EAAE,mBAAmB;QAChC,eAAe,EAAE,IAAI;QACrB,eAAe,EAAE,EAAE;QACnB,GAAG,SAAS;KACb,CAAC;AACJ,CAAC;AAED,SAAS,YAAY,CAAC,YAAmC,EAAE;IACzD,OAAO;QACL,EAAE,EAA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,GAAG,EAAE;QAC5C,EAAE,CAAC,mFAAmF,EAAE,GAAG,EAAE;YAC3F,+CAA+C;YAC/C,MAAM,CAAC,iBAAiB,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;QAC3D,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=platform.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"platform.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/platform.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,127 @@
1
+ import { describe, it, expect, vi, beforeEach, afterEach } from "vitest";
2
+ // We need to mock child_process before importing the module
3
+ const mockExecSync = vi.fn();
4
+ vi.mock("child_process", () => ({
5
+ execSync: (...args) => mockExecSync(...args),
6
+ }));
7
+ // Dynamic import so mocks are in place
8
+ const { detectPlatform } = await import("../platform.js");
9
+ describe("detectPlatform", () => {
10
+ const validOsTypes = [
11
+ "macos",
12
+ "linux-debian",
13
+ "linux-fedora",
14
+ "linux-arch",
15
+ "linux",
16
+ "unix",
17
+ ];
18
+ const validPackageManagers = [
19
+ "brew",
20
+ "apt",
21
+ "dnf",
22
+ "yum",
23
+ "pacman",
24
+ null,
25
+ ];
26
+ beforeEach(() => {
27
+ mockExecSync.mockReset();
28
+ });
29
+ afterEach(() => {
30
+ vi.restoreAllMocks();
31
+ });
32
+ it("returns a PlatformInfo object with valid os field matching process.platform", () => {
33
+ // Let hasBin calls succeed for common tools
34
+ mockExecSync.mockImplementation((cmd) => {
35
+ if (cmd === "which brew")
36
+ return Buffer.from("/opt/homebrew/bin/brew");
37
+ if (cmd === "which npm")
38
+ return Buffer.from("/usr/local/bin/npm");
39
+ throw new Error("not found");
40
+ });
41
+ const result = detectPlatform();
42
+ expect(result).toHaveProperty("os");
43
+ expect(result).toHaveProperty("packageManager");
44
+ expect(result).toHaveProperty("npmAvailable");
45
+ expect(validOsTypes).toContain(result.os);
46
+ // On macOS CI/local, process.platform is "darwin" → os should be "macos"
47
+ if (process.platform === "darwin") {
48
+ expect(result.os).toBe("macos");
49
+ }
50
+ else if (process.platform === "linux") {
51
+ expect(result.os).toMatch(/^linux/);
52
+ }
53
+ });
54
+ it("npmAvailable is a boolean", () => {
55
+ mockExecSync.mockImplementation((cmd) => {
56
+ if (cmd === "which npm")
57
+ return Buffer.from("/usr/local/bin/npm");
58
+ throw new Error("not found");
59
+ });
60
+ const result = detectPlatform();
61
+ expect(typeof result.npmAvailable).toBe("boolean");
62
+ });
63
+ it("packageManager is a valid value or null", () => {
64
+ mockExecSync.mockImplementation(() => {
65
+ throw new Error("not found");
66
+ });
67
+ const result = detectPlatform();
68
+ expect(validPackageManagers).toContain(result.packageManager);
69
+ });
70
+ it("detects brew on macOS when brew is available", () => {
71
+ // Mock process.platform to darwin
72
+ const originalPlatform = process.platform;
73
+ Object.defineProperty(process, "platform", { value: "darwin", writable: true });
74
+ mockExecSync.mockImplementation((cmd) => {
75
+ if (cmd === "which brew")
76
+ return Buffer.from("/opt/homebrew/bin/brew");
77
+ if (cmd === "which npm")
78
+ return Buffer.from("/usr/local/bin/npm");
79
+ throw new Error("not found");
80
+ });
81
+ const result = detectPlatform();
82
+ expect(result.os).toBe("macos");
83
+ expect(result.packageManager).toBe("brew");
84
+ expect(result.npmAvailable).toBe(true);
85
+ Object.defineProperty(process, "platform", { value: originalPlatform, writable: true });
86
+ });
87
+ it("returns null packageManager on macOS when brew is not available", () => {
88
+ const originalPlatform = process.platform;
89
+ Object.defineProperty(process, "platform", { value: "darwin", writable: true });
90
+ mockExecSync.mockImplementation(() => {
91
+ throw new Error("not found");
92
+ });
93
+ const result = detectPlatform();
94
+ expect(result.os).toBe("macos");
95
+ expect(result.packageManager).toBeNull();
96
+ Object.defineProperty(process, "platform", { value: originalPlatform, writable: true });
97
+ });
98
+ it("detects apt on linux-debian", () => {
99
+ const originalPlatform = process.platform;
100
+ Object.defineProperty(process, "platform", { value: "linux", writable: true });
101
+ mockExecSync.mockImplementation((cmd) => {
102
+ if (cmd === "cat /etc/os-release") {
103
+ return Buffer.from('ID=ubuntu\nID_LIKE=debian\nVERSION_ID="22.04"');
104
+ }
105
+ if (cmd === "which apt")
106
+ return Buffer.from("/usr/bin/apt");
107
+ if (cmd === "which npm")
108
+ return Buffer.from("/usr/bin/npm");
109
+ throw new Error("not found");
110
+ });
111
+ const result = detectPlatform();
112
+ expect(result.os).toBe("linux-debian");
113
+ expect(result.packageManager).toBe("apt");
114
+ Object.defineProperty(process, "platform", { value: originalPlatform, writable: true });
115
+ });
116
+ it("returns 'unix' for non-darwin non-linux platforms", () => {
117
+ const originalPlatform = process.platform;
118
+ Object.defineProperty(process, "platform", { value: "freebsd", writable: true });
119
+ mockExecSync.mockImplementation(() => {
120
+ throw new Error("not found");
121
+ });
122
+ const result = detectPlatform();
123
+ expect(result.os).toBe("unix");
124
+ Object.defineProperty(process, "platform", { value: originalPlatform, writable: true });
125
+ });
126
+ });
127
+ //# sourceMappingURL=platform.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"platform.test.js","sourceRoot":"","sources":["../../src/__tests__/platform.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAGzE,4DAA4D;AAC5D,MAAM,YAAY,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC;AAC7B,EAAE,CAAC,IAAI,CAAC,eAAe,EAAE,GAAG,EAAE,CAAC,CAAC;IAC9B,QAAQ,EAAE,CAAC,GAAG,IAAe,EAAE,EAAE,CAAC,YAAY,CAAC,GAAG,IAAI,CAAC;CACxD,CAAC,CAAC,CAAC;AAEJ,uCAAuC;AACvC,MAAM,EAAE,cAAc,EAAE,GAAG,MAAM,MAAM,CAAC,gBAAgB,CAAC,CAAC;AAE1D,QAAQ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CAAC,OAAO,EAAE,UAAU,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;QAEjF,YAAY,CAAC,kBAAkB,CAAC,GAAG,EAAE;YACnC,MAAM,IAAI,KAAK,CAAC,WAAW,CAAC,CAAC;QAC/B,CAAC,CAAC,CAAC;QAEH,MAAM,MAAM,GAAG,cAAc,EAAE,CAAC;QAChC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAE/B,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,UAAU,EAAE,EAAE,KAAK,EAAE,gBAAgB,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;IAC1F,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=scaffold.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scaffold.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/scaffold.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,150 @@
1
+ import { describe, it, expect, beforeAll, afterAll } from "vitest";
2
+ import fs from "fs-extra";
3
+ import * as path from "path";
4
+ import * as os from "os";
5
+ import { execSync } from "child_process";
6
+ import { fetchTemplate } from "../fetch-template.js";
7
+ /**
8
+ * Paths within the scaffolded HQ that intentionally contain user-configurable
9
+ * placeholder strings like {your-username}. These are template variables meant
10
+ * to be replaced by users after scaffolding — not scaffold bugs.
11
+ */
12
+ const PLACEHOLDER_EXEMPT_PATHS = [
13
+ "knowledge",
14
+ "starter-projects",
15
+ ".claude/policies",
16
+ ".claude/commands",
17
+ "modules/modules.yaml",
18
+ "README.md",
19
+ "workers",
20
+ ];
21
+ function isExemptFromPlaceholderCheck(relPath) {
22
+ return PLACEHOLDER_EXEMPT_PATHS.some((exempt) => relPath.startsWith(exempt));
23
+ }
24
+ describe("scaffold integration", () => {
25
+ let tmpDir;
26
+ let fetchResult;
27
+ beforeAll(async () => {
28
+ tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), "create-hq-test-"));
29
+ fetchResult = await fetchTemplate(tmpDir);
30
+ }, 60000); // 60s timeout for network fetch
31
+ afterAll(() => {
32
+ if (tmpDir)
33
+ fs.removeSync(tmpDir);
34
+ });
35
+ it("creates expected top-level directories", () => {
36
+ const expected = [".claude", "workers", "companies", "workspace", "knowledge", "scripts"];
37
+ for (const dir of expected) {
38
+ expect(fs.existsSync(path.join(tmpDir, dir)), `Expected directory "${dir}" to exist in scaffolded HQ`).toBe(true);
39
+ }
40
+ });
41
+ it("creates .claude/CLAUDE.md that is non-empty", () => {
42
+ const claudeMd = path.join(tmpDir, ".claude", "CLAUDE.md");
43
+ expect(fs.existsSync(claudeMd), ".claude/CLAUDE.md must exist").toBe(true);
44
+ expect(fs.statSync(claudeMd).size, ".claude/CLAUDE.md must be non-empty").toBeGreaterThan(0);
45
+ });
46
+ it("creates core.yaml with valid YAML and has rules.locked array", () => {
47
+ const coreYaml = path.join(tmpDir, "core.yaml");
48
+ expect(fs.existsSync(coreYaml), "core.yaml must exist").toBe(true);
49
+ const content = fs.readFileSync(coreYaml, "utf-8");
50
+ expect(content.length, "core.yaml must be non-empty").toBeGreaterThan(0);
51
+ expect(content, "core.yaml must contain 'locked' key").toContain("locked");
52
+ });
53
+ it("creates executable scripts/core-integrity.sh", () => {
54
+ const script = path.join(tmpDir, "scripts", "core-integrity.sh");
55
+ expect(fs.existsSync(script), "scripts/core-integrity.sh must exist").toBe(true);
56
+ const stat = fs.statSync(script);
57
+ // Check any executable bit (owner/group/other)
58
+ expect(stat.mode & 0o111, "core-integrity.sh must be executable").toBeTruthy();
59
+ });
60
+ it("core-integrity.sh passes (exit code 0)", () => {
61
+ const script = path.join(tmpDir, "scripts", "core-integrity.sh");
62
+ if (!fs.existsSync(script)) {
63
+ // No governance script in this template version — skip gracefully
64
+ return;
65
+ }
66
+ // Run compute-checksums first so integrity check has fresh checksums
67
+ const computeScript = path.join(tmpDir, "scripts", "compute-checksums.sh");
68
+ if (fs.existsSync(computeScript)) {
69
+ execSync(`bash "${computeScript}"`, { cwd: tmpDir, stdio: "pipe" });
70
+ }
71
+ // execSync throws on non-zero exit code, so reaching next line means success
72
+ execSync(`bash "${script}"`, { cwd: tmpDir, stdio: "pipe" });
73
+ expect(true).toBe(true);
74
+ });
75
+ it("no {your-username} or {your-name} placeholder strings in core operational files", () => {
76
+ /**
77
+ * Checks that scaffolded core files (core.yaml, .claude/CLAUDE.md, scripts/, settings/)
78
+ * do not contain placeholder strings. User-configurable template locations such as
79
+ * knowledge/, starter-projects/, .claude/policies/, .claude/commands/, modules/modules.yaml,
80
+ * workers/, and README.md are intentionally exempt — they ship with placeholder values
81
+ * that users fill in after setup.
82
+ */
83
+ const violations = [];
84
+ const checkDir = (dir) => {
85
+ let entries;
86
+ try {
87
+ entries = fs.readdirSync(dir, { withFileTypes: true });
88
+ }
89
+ catch {
90
+ return;
91
+ }
92
+ for (const entry of entries) {
93
+ const fullPath = path.join(dir, entry.name);
94
+ const relPath = path.relative(tmpDir, fullPath);
95
+ if (entry.isDirectory() &&
96
+ !entry.name.startsWith(".git") &&
97
+ entry.name !== "node_modules") {
98
+ // Skip exempt directories entirely
99
+ if (!PLACEHOLDER_EXEMPT_PATHS.some((e) => relPath.startsWith(e) || e.startsWith(relPath))) {
100
+ checkDir(fullPath);
101
+ }
102
+ else if (!isExemptFromPlaceholderCheck(relPath)) {
103
+ checkDir(fullPath);
104
+ }
105
+ }
106
+ else if (entry.isFile() && !isExemptFromPlaceholderCheck(relPath)) {
107
+ try {
108
+ const content = fs.readFileSync(fullPath, "utf-8");
109
+ if (content.includes("{your-username}")) {
110
+ violations.push(`${relPath}: contains {your-username}`);
111
+ }
112
+ if (content.includes("{your-name}")) {
113
+ violations.push(`${relPath}: contains {your-name}`);
114
+ }
115
+ }
116
+ catch {
117
+ // Binary file or unreadable — skip
118
+ }
119
+ }
120
+ }
121
+ };
122
+ checkDir(tmpDir);
123
+ expect(violations, `Placeholder strings in core files:\n${violations.join("\n")}`).toHaveLength(0);
124
+ });
125
+ it("fetched version is a non-empty string", () => {
126
+ /**
127
+ * Verifies fetchTemplate returns a version string. When a GitHub release exists,
128
+ * this will be a semver tag (e.g. "v9.0.0"). When falling back to gh CLI without
129
+ * a release, it returns "latest". Either way, the string must be non-empty.
130
+ */
131
+ expect(fetchResult.version, "fetchTemplate must return a non-empty version string").toBeTruthy();
132
+ expect(typeof fetchResult.version).toBe("string");
133
+ expect(fetchResult.version.length).toBeGreaterThan(0);
134
+ });
135
+ it("fetched version matches latest release tag when a release exists", async () => {
136
+ /**
137
+ * When the GitHub repo has published releases, verifies the returned version
138
+ * matches the semver format of the latest release tag. Skips if no releases exist.
139
+ */
140
+ const response = await fetch("https://api.github.com/repos/indigoai-us/hq/releases/latest", { headers: { Accept: "application/vnd.github+json" } });
141
+ if (!response.ok) {
142
+ // No releases published yet — version format check not applicable
143
+ console.log(` Skipping release tag format check (GitHub API returned ${response.status})`);
144
+ return;
145
+ }
146
+ const release = (await response.json());
147
+ expect(fetchResult.version, `Fetched version "${fetchResult.version}" should match latest release tag "${release.tag_name}"`).toBe(release.tag_name);
148
+ });
149
+ });
150
+ //# sourceMappingURL=scaffold.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scaffold.test.js","sourceRoot":"","sources":["../../src/__tests__/scaffold.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AACnE,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1B,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAErD;;;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th utilities for create-hq — OAuth PKCE flow for Clerk (US-008)
3
+ *
4
+ * Reuses the same patterns as hq-cli/src/utils/auth.ts and
5
+ * hq-cli/src/utils/token-store.ts but bundled inline so create-hq
6
+ * has no dependency on @indigoai-us/hq-cli.
7
+ *
8
+ * Token values are NEVER written to stdout or logs.
9
+ */
10
+ export interface AuthToken {
11
+ clerk_session_token: string;
12
+ user_id: string;
13
+ email: string;
14
+ expires_at: string;
15
+ }
16
+ /** Save auth token to ~/.hq/auth.json with 0600 permissions. */
17
+ export declare function saveToken(token: AuthToken): void;
18
+ /** Load auth token from ~/.hq/auth.json. Returns null if missing/invalid. */
19
+ export declare function loadToken(): AuthToken | null;
20
+ /** Check if a token is expired or within 5 minutes of expiry. */
21
+ export declare function isTokenExpired(token: AuthToken): boolean;
22
+ /**
23
+ * Start the OAuth PKCE auth flow:
24
+ * 1. Generate PKCE code_verifier + code_challenge
25
+ * 2. Start local HTTP server on a random port for the callback
26
+ * 3. Open browser to Clerk auth URL
27
+ * 4. Wait for callback with auth code
28
+ * 5. Exchange code for token via registry /auth/token endpoint
29
+ * 6. Save token and return AuthToken
30
+ */
31
+ export declare function startAuthFlow(registryUrl: string): Promise<AuthToken>;
32
+ //# sourceMappingURL=auth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAWH,MAAM,WAAW,SAAS;IACxB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;CACpB;AAaD,gEAAgE;AAChE,wBAAgB,SAAS,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI,CAIhD;AAED,6EAA6E;AAC7E,wBAAgB,SAAS,IAAI,SAAS,GAAG,IAAI,CAqB5C;AAED,iEAAiE;AACjE,wBAAgB,cAAc,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO,CAIxD;AA0BD;;;;;;;;GAQG;AACH,wBAAsB,aAAa,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAkG3E"}