thevoidforge 21.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 (328) hide show
  1. package/dist/scripts/vault-read.d.ts +11 -0
  2. package/dist/scripts/vault-read.js +89 -0
  3. package/dist/scripts/voidforge.d.ts +20 -0
  4. package/dist/scripts/voidforge.js +404 -0
  5. package/dist/tsconfig.tsbuildinfo +1 -0
  6. package/dist/wizard/api/auth.d.ts +5 -0
  7. package/dist/wizard/api/auth.js +133 -0
  8. package/dist/wizard/api/blueprint.d.ts +45 -0
  9. package/dist/wizard/api/blueprint.js +184 -0
  10. package/dist/wizard/api/cloud-providers.d.ts +16 -0
  11. package/dist/wizard/api/cloud-providers.js +363 -0
  12. package/dist/wizard/api/credentials.d.ts +1 -0
  13. package/dist/wizard/api/credentials.js +258 -0
  14. package/dist/wizard/api/danger-room.d.ts +18 -0
  15. package/dist/wizard/api/danger-room.js +401 -0
  16. package/dist/wizard/api/deploy.d.ts +4 -0
  17. package/dist/wizard/api/deploy.js +164 -0
  18. package/dist/wizard/api/prd.d.ts +1 -0
  19. package/dist/wizard/api/prd.js +363 -0
  20. package/dist/wizard/api/project.d.ts +1 -0
  21. package/dist/wizard/api/project.js +239 -0
  22. package/dist/wizard/api/projects.d.ts +6 -0
  23. package/dist/wizard/api/projects.js +648 -0
  24. package/dist/wizard/api/provision.d.ts +4 -0
  25. package/dist/wizard/api/provision.js +535 -0
  26. package/dist/wizard/api/terminal.d.ts +25 -0
  27. package/dist/wizard/api/terminal.js +241 -0
  28. package/dist/wizard/api/users.d.ts +6 -0
  29. package/dist/wizard/api/users.js +244 -0
  30. package/dist/wizard/api/war-room.d.ts +14 -0
  31. package/dist/wizard/api/war-room.js +45 -0
  32. package/dist/wizard/lib/ad-platform-core.d.ts +6 -0
  33. package/dist/wizard/lib/ad-platform-core.js +1 -0
  34. package/dist/wizard/lib/adapters/index.d.ts +52 -0
  35. package/dist/wizard/lib/adapters/index.js +38 -0
  36. package/dist/wizard/lib/adapters/sandbox-bank.d.ts +17 -0
  37. package/dist/wizard/lib/adapters/sandbox-bank.js +77 -0
  38. package/dist/wizard/lib/adapters/sandbox.d.ts +39 -0
  39. package/dist/wizard/lib/adapters/sandbox.js +174 -0
  40. package/dist/wizard/lib/adapters/stripe.d.ts +19 -0
  41. package/dist/wizard/lib/adapters/stripe.js +143 -0
  42. package/dist/wizard/lib/adapters/types.d.ts +9 -0
  43. package/dist/wizard/lib/adapters/types.js +10 -0
  44. package/dist/wizard/lib/agent-memory.d.ts +36 -0
  45. package/dist/wizard/lib/agent-memory.js +114 -0
  46. package/dist/wizard/lib/anomaly-detection.d.ts +59 -0
  47. package/dist/wizard/lib/anomaly-detection.js +122 -0
  48. package/dist/wizard/lib/anthropic.d.ts +21 -0
  49. package/dist/wizard/lib/anthropic.js +105 -0
  50. package/dist/wizard/lib/asset-scanner.d.ts +23 -0
  51. package/dist/wizard/lib/asset-scanner.js +107 -0
  52. package/dist/wizard/lib/audit-log.d.ts +23 -0
  53. package/dist/wizard/lib/audit-log.js +70 -0
  54. package/dist/wizard/lib/autonomy-controller.d.ts +76 -0
  55. package/dist/wizard/lib/autonomy-controller.js +183 -0
  56. package/dist/wizard/lib/body-parser.d.ts +2 -0
  57. package/dist/wizard/lib/body-parser.js +36 -0
  58. package/dist/wizard/lib/build-analytics.d.ts +39 -0
  59. package/dist/wizard/lib/build-analytics.js +91 -0
  60. package/dist/wizard/lib/build-step.d.ts +21 -0
  61. package/dist/wizard/lib/build-step.js +104 -0
  62. package/dist/wizard/lib/campaign-proposer.d.ts +39 -0
  63. package/dist/wizard/lib/campaign-proposer.js +180 -0
  64. package/dist/wizard/lib/campaign-state-machine.d.ts +63 -0
  65. package/dist/wizard/lib/campaign-state-machine.js +114 -0
  66. package/dist/wizard/lib/ci-generator.d.ts +14 -0
  67. package/dist/wizard/lib/ci-generator.js +187 -0
  68. package/dist/wizard/lib/claude-merge.d.ts +38 -0
  69. package/dist/wizard/lib/claude-merge.js +115 -0
  70. package/dist/wizard/lib/codegen/erd-gen.d.ts +16 -0
  71. package/dist/wizard/lib/codegen/erd-gen.js +98 -0
  72. package/dist/wizard/lib/codegen/integrations.d.ts +18 -0
  73. package/dist/wizard/lib/codegen/integrations.js +189 -0
  74. package/dist/wizard/lib/codegen/openapi-gen.d.ts +15 -0
  75. package/dist/wizard/lib/codegen/openapi-gen.js +79 -0
  76. package/dist/wizard/lib/codegen/prisma-types.d.ts +15 -0
  77. package/dist/wizard/lib/codegen/prisma-types.js +44 -0
  78. package/dist/wizard/lib/codegen/seed-gen.d.ts +16 -0
  79. package/dist/wizard/lib/codegen/seed-gen.js +128 -0
  80. package/dist/wizard/lib/compliance.d.ts +51 -0
  81. package/dist/wizard/lib/compliance.js +112 -0
  82. package/dist/wizard/lib/correlation-engine.d.ts +59 -0
  83. package/dist/wizard/lib/correlation-engine.js +151 -0
  84. package/dist/wizard/lib/cost-estimator.d.ts +22 -0
  85. package/dist/wizard/lib/cost-estimator.js +72 -0
  86. package/dist/wizard/lib/cost-tracker.d.ts +27 -0
  87. package/dist/wizard/lib/cost-tracker.js +37 -0
  88. package/dist/wizard/lib/daemon-aggregator.d.ts +71 -0
  89. package/dist/wizard/lib/daemon-aggregator.js +204 -0
  90. package/dist/wizard/lib/daemon-core.d.ts +6 -0
  91. package/dist/wizard/lib/daemon-core.js +5 -0
  92. package/dist/wizard/lib/dashboard-data.d.ts +132 -0
  93. package/dist/wizard/lib/dashboard-data.js +336 -0
  94. package/dist/wizard/lib/dashboard-ws.d.ts +25 -0
  95. package/dist/wizard/lib/dashboard-ws.js +91 -0
  96. package/dist/wizard/lib/deep-current.d.ts +77 -0
  97. package/dist/wizard/lib/deep-current.js +234 -0
  98. package/dist/wizard/lib/deploy-coordinator.d.ts +40 -0
  99. package/dist/wizard/lib/deploy-coordinator.js +86 -0
  100. package/dist/wizard/lib/deploy-log.d.ts +28 -0
  101. package/dist/wizard/lib/deploy-log.js +52 -0
  102. package/dist/wizard/lib/desktop-notify.d.ts +27 -0
  103. package/dist/wizard/lib/desktop-notify.js +98 -0
  104. package/dist/wizard/lib/dns/cloudflare-dns.d.ts +35 -0
  105. package/dist/wizard/lib/dns/cloudflare-dns.js +216 -0
  106. package/dist/wizard/lib/dns/cloudflare-registrar.d.ts +31 -0
  107. package/dist/wizard/lib/dns/cloudflare-registrar.js +148 -0
  108. package/dist/wizard/lib/dns/types.d.ts +22 -0
  109. package/dist/wizard/lib/dns/types.js +4 -0
  110. package/dist/wizard/lib/document-discovery.d.ts +33 -0
  111. package/dist/wizard/lib/document-discovery.js +145 -0
  112. package/dist/wizard/lib/env-validator.d.ts +14 -0
  113. package/dist/wizard/lib/env-validator.js +205 -0
  114. package/dist/wizard/lib/env-writer.d.ts +13 -0
  115. package/dist/wizard/lib/env-writer.js +26 -0
  116. package/dist/wizard/lib/exec.d.ts +30 -0
  117. package/dist/wizard/lib/exec.js +52 -0
  118. package/dist/wizard/lib/experiment.d.ts +70 -0
  119. package/dist/wizard/lib/experiment.js +169 -0
  120. package/dist/wizard/lib/extensions.d.ts +20 -0
  121. package/dist/wizard/lib/extensions.js +183 -0
  122. package/dist/wizard/lib/financial/adapter-factory.d.ts +47 -0
  123. package/dist/wizard/lib/financial/adapter-factory.js +225 -0
  124. package/dist/wizard/lib/financial/billing/base.d.ts +6 -0
  125. package/dist/wizard/lib/financial/billing/base.js +1 -0
  126. package/dist/wizard/lib/financial/billing/google-billing.d.ts +56 -0
  127. package/dist/wizard/lib/financial/billing/google-billing.js +298 -0
  128. package/dist/wizard/lib/financial/billing/meta-billing.d.ts +54 -0
  129. package/dist/wizard/lib/financial/billing/meta-billing.js +243 -0
  130. package/dist/wizard/lib/financial/billing/tiktok-billing.d.ts +54 -0
  131. package/dist/wizard/lib/financial/billing/tiktok-billing.js +260 -0
  132. package/dist/wizard/lib/financial/campaign/base.d.ts +13 -0
  133. package/dist/wizard/lib/financial/campaign/base.js +1 -0
  134. package/dist/wizard/lib/financial/campaign/google-campaign.d.ts +42 -0
  135. package/dist/wizard/lib/financial/campaign/google-campaign.js +388 -0
  136. package/dist/wizard/lib/financial/campaign/meta-campaign.d.ts +41 -0
  137. package/dist/wizard/lib/financial/campaign/meta-campaign.js +311 -0
  138. package/dist/wizard/lib/financial/campaign/sandbox-campaign.d.ts +45 -0
  139. package/dist/wizard/lib/financial/campaign/sandbox-campaign.js +261 -0
  140. package/dist/wizard/lib/financial/campaign/tiktok-campaign.d.ts +40 -0
  141. package/dist/wizard/lib/financial/campaign/tiktok-campaign.js +350 -0
  142. package/dist/wizard/lib/financial/funding-auto.d.ts +44 -0
  143. package/dist/wizard/lib/financial/funding-auto.js +52 -0
  144. package/dist/wizard/lib/financial/funding-policy.d.ts +60 -0
  145. package/dist/wizard/lib/financial/funding-policy.js +179 -0
  146. package/dist/wizard/lib/financial/platform-planner.d.ts +47 -0
  147. package/dist/wizard/lib/financial/platform-planner.js +134 -0
  148. package/dist/wizard/lib/financial/reconciliation-engine.d.ts +78 -0
  149. package/dist/wizard/lib/financial/reconciliation-engine.js +193 -0
  150. package/dist/wizard/lib/financial/registry.d.ts +22 -0
  151. package/dist/wizard/lib/financial/registry.js +26 -0
  152. package/dist/wizard/lib/financial/reporting.d.ts +96 -0
  153. package/dist/wizard/lib/financial/reporting.js +198 -0
  154. package/dist/wizard/lib/financial/stablecoin/base.d.ts +6 -0
  155. package/dist/wizard/lib/financial/stablecoin/base.js +1 -0
  156. package/dist/wizard/lib/financial/stablecoin/circle.d.ts +54 -0
  157. package/dist/wizard/lib/financial/stablecoin/circle.js +367 -0
  158. package/dist/wizard/lib/financial/stablecoin/mercury.d.ts +24 -0
  159. package/dist/wizard/lib/financial/stablecoin/mercury.js +171 -0
  160. package/dist/wizard/lib/financial/stablecoin/sandbox-stablecoin.d.ts +47 -0
  161. package/dist/wizard/lib/financial/stablecoin/sandbox-stablecoin.js +202 -0
  162. package/dist/wizard/lib/financial/treasury-planner.d.ts +52 -0
  163. package/dist/wizard/lib/financial/treasury-planner.js +128 -0
  164. package/dist/wizard/lib/financial-core.d.ts +6 -0
  165. package/dist/wizard/lib/financial-core.js +5 -0
  166. package/dist/wizard/lib/financial-vault.d.ts +34 -0
  167. package/dist/wizard/lib/financial-vault.js +199 -0
  168. package/dist/wizard/lib/frontmatter.d.ts +30 -0
  169. package/dist/wizard/lib/frontmatter.js +96 -0
  170. package/dist/wizard/lib/gap-analysis.d.ts +37 -0
  171. package/dist/wizard/lib/gap-analysis.js +218 -0
  172. package/dist/wizard/lib/github.d.ts +22 -0
  173. package/dist/wizard/lib/github.js +261 -0
  174. package/dist/wizard/lib/headless-deploy.d.ts +14 -0
  175. package/dist/wizard/lib/headless-deploy.js +452 -0
  176. package/dist/wizard/lib/health-monitor.d.ts +15 -0
  177. package/dist/wizard/lib/health-monitor.js +91 -0
  178. package/dist/wizard/lib/health-poller.d.ts +9 -0
  179. package/dist/wizard/lib/health-poller.js +123 -0
  180. package/dist/wizard/lib/heartbeat.d.ts +15 -0
  181. package/dist/wizard/lib/heartbeat.js +827 -0
  182. package/dist/wizard/lib/http-helpers.d.ts +9 -0
  183. package/dist/wizard/lib/http-helpers.js +24 -0
  184. package/dist/wizard/lib/image-gen.d.ts +56 -0
  185. package/dist/wizard/lib/image-gen.js +159 -0
  186. package/dist/wizard/lib/instance-sizing.d.ts +26 -0
  187. package/dist/wizard/lib/instance-sizing.js +51 -0
  188. package/dist/wizard/lib/kongo/analytics.d.ts +29 -0
  189. package/dist/wizard/lib/kongo/analytics.js +179 -0
  190. package/dist/wizard/lib/kongo/campaigns.d.ts +52 -0
  191. package/dist/wizard/lib/kongo/campaigns.js +91 -0
  192. package/dist/wizard/lib/kongo/client.d.ts +58 -0
  193. package/dist/wizard/lib/kongo/client.js +221 -0
  194. package/dist/wizard/lib/kongo/jobs.d.ts +57 -0
  195. package/dist/wizard/lib/kongo/jobs.js +122 -0
  196. package/dist/wizard/lib/kongo/pages.d.ts +60 -0
  197. package/dist/wizard/lib/kongo/pages.js +150 -0
  198. package/dist/wizard/lib/kongo/provisioner.d.ts +64 -0
  199. package/dist/wizard/lib/kongo/provisioner.js +116 -0
  200. package/dist/wizard/lib/kongo/seed.d.ts +49 -0
  201. package/dist/wizard/lib/kongo/seed.js +237 -0
  202. package/dist/wizard/lib/kongo/types.d.ts +323 -0
  203. package/dist/wizard/lib/kongo/types.js +11 -0
  204. package/dist/wizard/lib/kongo/variants.d.ts +57 -0
  205. package/dist/wizard/lib/kongo/variants.js +88 -0
  206. package/dist/wizard/lib/kongo/webhooks.d.ts +41 -0
  207. package/dist/wizard/lib/kongo/webhooks.js +112 -0
  208. package/dist/wizard/lib/marker.d.ts +28 -0
  209. package/dist/wizard/lib/marker.js +79 -0
  210. package/dist/wizard/lib/migrator.d.ts +35 -0
  211. package/dist/wizard/lib/migrator.js +190 -0
  212. package/dist/wizard/lib/natural-language-deploy.d.ts +30 -0
  213. package/dist/wizard/lib/natural-language-deploy.js +186 -0
  214. package/dist/wizard/lib/network.d.ts +22 -0
  215. package/dist/wizard/lib/network.js +72 -0
  216. package/dist/wizard/lib/oauth-core.d.ts +6 -0
  217. package/dist/wizard/lib/oauth-core.js +5 -0
  218. package/dist/wizard/lib/open-browser.d.ts +1 -0
  219. package/dist/wizard/lib/open-browser.js +26 -0
  220. package/dist/wizard/lib/patterns/ad-billing-adapter.d.ts +209 -0
  221. package/dist/wizard/lib/patterns/ad-billing-adapter.js +269 -0
  222. package/dist/wizard/lib/patterns/ad-platform-adapter.d.ts +200 -0
  223. package/dist/wizard/lib/patterns/ad-platform-adapter.js +212 -0
  224. package/dist/wizard/lib/patterns/daemon-process.d.ts +88 -0
  225. package/dist/wizard/lib/patterns/daemon-process.js +271 -0
  226. package/dist/wizard/lib/patterns/financial-transaction.d.ts +161 -0
  227. package/dist/wizard/lib/patterns/financial-transaction.js +132 -0
  228. package/dist/wizard/lib/patterns/funding-plan.d.ts +136 -0
  229. package/dist/wizard/lib/patterns/funding-plan.js +200 -0
  230. package/dist/wizard/lib/patterns/oauth-token-lifecycle.d.ts +94 -0
  231. package/dist/wizard/lib/patterns/oauth-token-lifecycle.js +139 -0
  232. package/dist/wizard/lib/patterns/outbound-rate-limiter.d.ts +67 -0
  233. package/dist/wizard/lib/patterns/outbound-rate-limiter.js +216 -0
  234. package/dist/wizard/lib/patterns/revenue-source-adapter.d.ts +96 -0
  235. package/dist/wizard/lib/patterns/revenue-source-adapter.js +182 -0
  236. package/dist/wizard/lib/patterns/stablecoin-adapter.d.ts +218 -0
  237. package/dist/wizard/lib/patterns/stablecoin-adapter.js +264 -0
  238. package/dist/wizard/lib/prd-validator.d.ts +39 -0
  239. package/dist/wizard/lib/prd-validator.js +137 -0
  240. package/dist/wizard/lib/project-init.d.ts +24 -0
  241. package/dist/wizard/lib/project-init.js +193 -0
  242. package/dist/wizard/lib/project-registry.d.ts +86 -0
  243. package/dist/wizard/lib/project-registry.js +359 -0
  244. package/dist/wizard/lib/provision-manifest.d.ts +44 -0
  245. package/dist/wizard/lib/provision-manifest.js +164 -0
  246. package/dist/wizard/lib/provisioner-registry.d.ts +15 -0
  247. package/dist/wizard/lib/provisioner-registry.js +34 -0
  248. package/dist/wizard/lib/provisioners/aws-vps.d.ts +6 -0
  249. package/dist/wizard/lib/provisioners/aws-vps.js +643 -0
  250. package/dist/wizard/lib/provisioners/cloudflare.d.ts +6 -0
  251. package/dist/wizard/lib/provisioners/cloudflare.js +300 -0
  252. package/dist/wizard/lib/provisioners/docker.d.ts +6 -0
  253. package/dist/wizard/lib/provisioners/docker.js +75 -0
  254. package/dist/wizard/lib/provisioners/http-client.d.ts +20 -0
  255. package/dist/wizard/lib/provisioners/http-client.js +79 -0
  256. package/dist/wizard/lib/provisioners/railway.d.ts +6 -0
  257. package/dist/wizard/lib/provisioners/railway.js +413 -0
  258. package/dist/wizard/lib/provisioners/scripts/caddyfile.d.ts +10 -0
  259. package/dist/wizard/lib/provisioners/scripts/caddyfile.js +54 -0
  260. package/dist/wizard/lib/provisioners/scripts/deploy-vps.d.ts +10 -0
  261. package/dist/wizard/lib/provisioners/scripts/deploy-vps.js +112 -0
  262. package/dist/wizard/lib/provisioners/scripts/docker-compose.d.ts +11 -0
  263. package/dist/wizard/lib/provisioners/scripts/docker-compose.js +91 -0
  264. package/dist/wizard/lib/provisioners/scripts/dockerfile.d.ts +5 -0
  265. package/dist/wizard/lib/provisioners/scripts/dockerfile.js +185 -0
  266. package/dist/wizard/lib/provisioners/scripts/ecosystem-config.d.ts +10 -0
  267. package/dist/wizard/lib/provisioners/scripts/ecosystem-config.js +36 -0
  268. package/dist/wizard/lib/provisioners/scripts/provision-vps.d.ts +14 -0
  269. package/dist/wizard/lib/provisioners/scripts/provision-vps.js +202 -0
  270. package/dist/wizard/lib/provisioners/scripts/rollback-vps.d.ts +10 -0
  271. package/dist/wizard/lib/provisioners/scripts/rollback-vps.js +67 -0
  272. package/dist/wizard/lib/provisioners/self-deploy.d.ts +41 -0
  273. package/dist/wizard/lib/provisioners/self-deploy.js +185 -0
  274. package/dist/wizard/lib/provisioners/static-s3.d.ts +6 -0
  275. package/dist/wizard/lib/provisioners/static-s3.js +235 -0
  276. package/dist/wizard/lib/provisioners/types.d.ts +40 -0
  277. package/dist/wizard/lib/provisioners/types.js +4 -0
  278. package/dist/wizard/lib/provisioners/vercel.d.ts +6 -0
  279. package/dist/wizard/lib/provisioners/vercel.js +287 -0
  280. package/dist/wizard/lib/pty-manager.d.ts +42 -0
  281. package/dist/wizard/lib/pty-manager.js +231 -0
  282. package/dist/wizard/lib/rate-limiter-core.d.ts +5 -0
  283. package/dist/wizard/lib/rate-limiter-core.js +5 -0
  284. package/dist/wizard/lib/reconciliation.d.ts +43 -0
  285. package/dist/wizard/lib/reconciliation.js +173 -0
  286. package/dist/wizard/lib/revenue-types.d.ts +5 -0
  287. package/dist/wizard/lib/revenue-types.js +1 -0
  288. package/dist/wizard/lib/route-optimizer.d.ts +28 -0
  289. package/dist/wizard/lib/route-optimizer.js +93 -0
  290. package/dist/wizard/lib/s3-deploy.d.ts +19 -0
  291. package/dist/wizard/lib/s3-deploy.js +156 -0
  292. package/dist/wizard/lib/safety-tiers.d.ts +76 -0
  293. package/dist/wizard/lib/safety-tiers.js +134 -0
  294. package/dist/wizard/lib/sentry-generator.d.ts +15 -0
  295. package/dist/wizard/lib/sentry-generator.js +116 -0
  296. package/dist/wizard/lib/server-config.d.ts +13 -0
  297. package/dist/wizard/lib/server-config.js +23 -0
  298. package/dist/wizard/lib/service-install.d.ts +18 -0
  299. package/dist/wizard/lib/service-install.js +182 -0
  300. package/dist/wizard/lib/site-scanner.d.ts +80 -0
  301. package/dist/wizard/lib/site-scanner.js +262 -0
  302. package/dist/wizard/lib/ssh-deploy.d.ts +25 -0
  303. package/dist/wizard/lib/ssh-deploy.js +225 -0
  304. package/dist/wizard/lib/templates.d.ts +24 -0
  305. package/dist/wizard/lib/templates.js +219 -0
  306. package/dist/wizard/lib/totp.d.ts +35 -0
  307. package/dist/wizard/lib/totp.js +276 -0
  308. package/dist/wizard/lib/tower-auth.d.ts +43 -0
  309. package/dist/wizard/lib/tower-auth.js +352 -0
  310. package/dist/wizard/lib/tower-rate-limit.d.ts +14 -0
  311. package/dist/wizard/lib/tower-rate-limit.js +61 -0
  312. package/dist/wizard/lib/tower-session.d.ts +28 -0
  313. package/dist/wizard/lib/tower-session.js +119 -0
  314. package/dist/wizard/lib/treasury-backup.d.ts +23 -0
  315. package/dist/wizard/lib/treasury-backup.js +126 -0
  316. package/dist/wizard/lib/treasury-heartbeat.d.ts +82 -0
  317. package/dist/wizard/lib/treasury-heartbeat.js +1104 -0
  318. package/dist/wizard/lib/updater.d.ts +29 -0
  319. package/dist/wizard/lib/updater.js +190 -0
  320. package/dist/wizard/lib/user-manager.d.ts +39 -0
  321. package/dist/wizard/lib/user-manager.js +182 -0
  322. package/dist/wizard/lib/vault.d.ts +26 -0
  323. package/dist/wizard/lib/vault.js +161 -0
  324. package/dist/wizard/router.d.ts +5 -0
  325. package/dist/wizard/router.js +15 -0
  326. package/dist/wizard/server.d.ts +18 -0
  327. package/dist/wizard/server.js +436 -0
  328. package/package.json +59 -0
@@ -0,0 +1,180 @@
1
+ /**
2
+ * Tuvok's Campaign Proposer — generates data-driven campaign proposals (v12.1).
3
+ *
4
+ * Takes the situation model (with Seven's gap analysis) and generates a
5
+ * complete campaign proposal: name, missions, predicted impact, risk, alternatives.
6
+ *
7
+ * PRD Reference: ROADMAP v12.1, DEEP_CURRENT.md PROPOSE step
8
+ */
9
+ import { mkdir, writeFile as writeFileAsync } from 'node:fs/promises';
10
+ import { join } from 'node:path';
11
+ import { randomUUID } from 'node:crypto';
12
+ import { PROPOSALS_DIR } from './deep-current.js';
13
+ import { findWeakestDimension } from './gap-analysis.js';
14
+ // ── Proposal Templates Per Dimension ──────────────────
15
+ function proposeForFeatureCompleteness(model) {
16
+ const weakest = findWeakestDimension(model);
17
+ return {
18
+ id: randomUUID(),
19
+ name: 'Feature Sprint',
20
+ generatedAt: new Date().toISOString(),
21
+ trigger: `Feature completeness score ${weakest.score}/100 is the lowest dimension`,
22
+ dimension: 'featureCompleteness',
23
+ dimensionScore: weakest.score,
24
+ theCase: `The project has significant PRD requirements that are not yet implemented. ${weakest.gaps.join('. ')}. Building core features will increase the product's value proposition and move toward a shippable state.`,
25
+ missions: [
26
+ { number: 1, name: 'Core Feature Build', objective: 'Implement the highest-priority unbuilt PRD features', estimatedFiles: 15 },
27
+ { number: 2, name: 'Supporting Features', objective: 'Build supporting features that depend on core', estimatedFiles: 10 },
28
+ { number: 3, name: 'Integration Wiring', objective: 'Connect new features to existing infrastructure', estimatedFiles: 5 },
29
+ ],
30
+ expectedImpact: `Feature completeness +${Math.min(30, 100 - weakest.score)} points. PRD coverage from ${weakest.score}% to ~${Math.min(100, weakest.score + 30)}%.`,
31
+ riskAssessment: 'New features may introduce bugs. Victory Gauntlet will catch them.',
32
+ alternativesConsidered: ['Focus on quality first (gauntlet findings)', 'Focus on growth (marketing before features)'],
33
+ autonomyRecommendation: 1, // Feature builds need human judgment
34
+ estimatedSessions: 2,
35
+ };
36
+ }
37
+ function proposeForQuality(model) {
38
+ const dim = model.dimensions.quality;
39
+ return {
40
+ id: randomUUID(),
41
+ name: 'Quality Hardening',
42
+ generatedAt: new Date().toISOString(),
43
+ trigger: `Quality score ${dim.score}/100 is the lowest dimension`,
44
+ dimension: 'quality',
45
+ dimensionScore: dim.score,
46
+ theCase: `The project has quality gaps that risk user trust and developer velocity. ${dim.gaps.join('. ')}. Investing in testing, fixing gauntlet findings, and establishing quality baselines will pay dividends in every future campaign.`,
47
+ missions: [
48
+ { number: 1, name: 'Test Coverage', objective: 'Write missing unit and integration tests', estimatedFiles: 20 },
49
+ { number: 2, name: 'Finding Resolution', objective: 'Fix outstanding gauntlet and review findings', estimatedFiles: 10 },
50
+ { number: 3, name: 'Quality Gates', objective: 'Establish CI/CD quality checks', estimatedFiles: 5 },
51
+ ],
52
+ expectedImpact: `Quality score +${Math.min(25, 100 - dim.score)} points. Test coverage increase. Gauntlet findings resolved.`,
53
+ riskAssessment: 'Quality campaigns have low risk. Tests protect against regressions.',
54
+ alternativesConsidered: ['Ship features first, quality later (technical debt risk)', 'Focus on performance instead'],
55
+ autonomyRecommendation: 2, // Quality campaigns are safe to auto-execute
56
+ estimatedSessions: 2,
57
+ };
58
+ }
59
+ function proposeForPerformance(model) {
60
+ const dim = model.dimensions.performance;
61
+ const scan = model.lastSiteScan;
62
+ return {
63
+ id: randomUUID(),
64
+ name: 'Performance Optimization',
65
+ generatedAt: new Date().toISOString(),
66
+ trigger: `Performance score ${dim.score}/100 is the lowest dimension`,
67
+ dimension: 'performance',
68
+ dimensionScore: dim.score,
69
+ theCase: `The deployed site has performance issues that affect user experience and SEO rankings. ${dim.gaps.join('. ')}. ${scan?.performance.ttfbMs ? `TTFB is ${scan.performance.ttfbMs}ms.` : ''} Improving Core Web Vitals will increase search rankings and reduce bounce rates.`,
70
+ missions: [
71
+ { number: 1, name: 'Core Web Vitals', objective: 'Fix LCP, CLS, and FID issues', estimatedFiles: 10 },
72
+ { number: 2, name: 'Asset Optimization', objective: 'Compression, caching, image optimization', estimatedFiles: 5 },
73
+ ],
74
+ expectedImpact: `Performance score +${Math.min(30, 100 - dim.score)} points. Estimated +10-20% search visibility from CWV improvements.`,
75
+ riskAssessment: 'Performance changes can break layouts. Visual regression testing recommended.',
76
+ alternativesConsidered: ['Focus on growth instead (marketing over performance)', 'Focus on features'],
77
+ autonomyRecommendation: 2, // Performance fixes are usually safe
78
+ estimatedSessions: 1,
79
+ };
80
+ }
81
+ function proposeForGrowthReadiness(model) {
82
+ const dim = model.dimensions.growthReadiness;
83
+ return {
84
+ id: randomUUID(),
85
+ name: 'Growth Foundation',
86
+ generatedAt: new Date().toISOString(),
87
+ trigger: `Growth readiness score ${dim.score}/100 is the lowest dimension`,
88
+ dimension: 'growthReadiness',
89
+ dimensionScore: dim.score,
90
+ theCase: `The project lacks growth infrastructure. ${dim.gaps.join('. ')}. Without analytics, SEO, and conversion paths, no amount of traffic will translate to results. This is the foundation that all growth campaigns build on.`,
91
+ missions: [
92
+ { number: 1, name: 'Analytics + SEO Foundation', objective: 'Install analytics, meta tags, sitemap, JSON-LD', estimatedFiles: 8 },
93
+ { number: 2, name: 'Conversion Paths', objective: 'Email capture, CTAs, social proof', estimatedFiles: 6 },
94
+ { number: 3, name: 'Content Foundation', objective: 'Blog setup, landing page optimization', estimatedFiles: 10 },
95
+ ],
96
+ expectedImpact: `Growth readiness +${Math.min(35, 100 - dim.score)} points. Analytics baseline established. Organic traffic pipeline started.`,
97
+ riskAssessment: 'Low risk. Growth foundation is additive — no existing features are modified.',
98
+ alternativesConsidered: ['Run /grow directly (requires deployed site)', 'Focus on revenue first'],
99
+ autonomyRecommendation: 1, // Growth strategy needs human input
100
+ estimatedSessions: 2,
101
+ };
102
+ }
103
+ function proposeForRevenuePotential(model) {
104
+ const dim = model.dimensions.revenuePotential;
105
+ return {
106
+ id: randomUUID(),
107
+ name: 'Revenue Infrastructure',
108
+ generatedAt: new Date().toISOString(),
109
+ trigger: `Revenue potential score ${dim.score}/100 is the lowest dimension`,
110
+ dimension: 'revenuePotential',
111
+ dimensionScore: dim.score,
112
+ theCase: `The project has limited revenue infrastructure. ${dim.gaps.join('. ')}. Connecting payment processing, setting up pricing pages, and establishing revenue tracking will enable monetization.`,
113
+ missions: [
114
+ { number: 1, name: 'Payment Integration', objective: 'Stripe/Paddle setup, checkout flow', estimatedFiles: 12 },
115
+ { number: 2, name: 'Pricing + Plans', objective: 'Pricing page, plan tiers, billing management', estimatedFiles: 8 },
116
+ { number: 3, name: 'Treasury Setup', objective: 'Revenue tracking, reconciliation, /treasury connection', estimatedFiles: 5 },
117
+ ],
118
+ expectedImpact: `Revenue potential +${Math.min(30, 100 - dim.score)} points. Payment pipeline established. Revenue tracking active.`,
119
+ riskAssessment: 'Payment integration involves real money. Requires thorough testing and security review.',
120
+ alternativesConsidered: ['Focus on growth first (users before revenue)', 'Focus on features'],
121
+ autonomyRecommendation: 1, // Revenue/payment changes need human oversight
122
+ estimatedSessions: 2,
123
+ };
124
+ }
125
+ // ── Main Proposal Generator ───────────────────────────
126
+ const DIMENSION_PROPOSERS = {
127
+ 'Feature Completeness': proposeForFeatureCompleteness,
128
+ 'Quality': proposeForQuality,
129
+ 'Performance': proposeForPerformance,
130
+ 'Growth Readiness': proposeForGrowthReadiness,
131
+ 'Revenue Potential': proposeForRevenuePotential,
132
+ };
133
+ /**
134
+ * Generate a campaign proposal targeting the weakest dimension.
135
+ */
136
+ export function generateProposal(model) {
137
+ const weakest = findWeakestDimension(model);
138
+ const proposer = DIMENSION_PROPOSERS[weakest.name];
139
+ if (!proposer)
140
+ return proposeForFeatureCompleteness(model); // fallback
141
+ return proposer(model);
142
+ }
143
+ /**
144
+ * Save a proposal to disk as markdown.
145
+ */
146
+ export async function saveProposal(proposal) {
147
+ await mkdir(PROPOSALS_DIR, { recursive: true });
148
+ const date = new Date().toISOString().split('T')[0];
149
+ const slug = proposal.name.toLowerCase().replace(/\s+/g, '-');
150
+ const filename = `${date}-${slug}.md`;
151
+ const filepath = join(PROPOSALS_DIR, filename);
152
+ const content = `# Campaign Proposal — ${proposal.name}
153
+ ## Generated by: The Deep Current (Tuvok)
154
+ ## Date: ${proposal.generatedAt}
155
+ ## Trigger: ${proposal.trigger}
156
+
157
+ ### The Case
158
+ ${proposal.theCase}
159
+
160
+ ### Missions
161
+ ${proposal.missions.map(m => `${m.number}. **${m.name}** — ${m.objective} (~${m.estimatedFiles} files)`).join('\n')}
162
+
163
+ ### Expected Impact
164
+ ${proposal.expectedImpact}
165
+
166
+ ### Risk Assessment
167
+ ${proposal.riskAssessment}
168
+
169
+ ### Alternatives Considered
170
+ ${proposal.alternativesConsidered.map(a => `- ${a}`).join('\n')}
171
+
172
+ ### Autonomy Recommendation
173
+ Tier ${proposal.autonomyRecommendation} — ${proposal.autonomyRecommendation === 1 ? 'Human approval required' : proposal.autonomyRecommendation === 2 ? 'Supervised autonomy (24h delay)' : 'Full autonomy'}
174
+
175
+ ### Estimated Effort
176
+ ${proposal.estimatedSessions} session(s)
177
+ `;
178
+ await writeFileAsync(filepath, content);
179
+ return filepath;
180
+ }
@@ -0,0 +1,63 @@
1
+ /**
2
+ * Campaign State Machine — Event-sourced transitions with validation (§9.17).
3
+ *
4
+ * 10 states, validated transitions, event-sourced history.
5
+ * Only valid transitions are allowed. Invalid transitions throw.
6
+ * Each transition is logged as an event with source, reason, and optional ruleId.
7
+ *
8
+ * PRD Reference: §9.9 (GrowthCampaign), §9.17 (state machine), §9.19.11 (agent source)
9
+ */
10
+ type CampaignStatus = 'draft' | 'pending_approval' | 'creating' | 'active' | 'paused' | 'completed' | 'error' | 'suspended' | 'deleting' | 'freeze_pending';
11
+ type CampaignEventSource = 'cli' | 'daemon' | 'platform' | 'agent';
12
+ interface CampaignStateEvent {
13
+ timestamp: string;
14
+ source: CampaignEventSource;
15
+ oldStatus: CampaignStatus;
16
+ newStatus: CampaignStatus;
17
+ reason: string;
18
+ ruleId?: string;
19
+ }
20
+ declare const VALID_TRANSITIONS: Record<CampaignStatus, CampaignStatus[]>;
21
+ declare const AGENT_ALLOWED_TRANSITIONS: Array<{
22
+ from: CampaignStatus;
23
+ to: CampaignStatus;
24
+ }>;
25
+ declare const AGENT_ALLOWED_REASONS: string[];
26
+ declare function isValidTransition(from: CampaignStatus, to: CampaignStatus): boolean;
27
+ declare function isAgentAllowed(from: CampaignStatus, to: CampaignStatus, reason: string): boolean;
28
+ declare function transition(currentStatus: CampaignStatus, newStatus: CampaignStatus, source: CampaignEventSource, reason: string, ruleId?: string): CampaignStateEvent;
29
+ interface SpendIntent {
30
+ intentId: string;
31
+ platform: string;
32
+ campaignConfig: unknown;
33
+ budgetLocked: boolean;
34
+ status: 'pending' | 'executing' | 'completed' | 'failed' | 'stale';
35
+ createdAt: string;
36
+ completedAt?: string;
37
+ error?: string;
38
+ }
39
+ /**
40
+ * Create a spend intent (WAL entry) before executing a platform API call.
41
+ * The intent ID serves as the idempotency key for the platform (ADR-3).
42
+ */
43
+ declare function createSpendIntent(intentId: string, platform: string, campaignConfig: unknown): SpendIntent;
44
+ /**
45
+ * Lock the budget for a spend intent.
46
+ * Verifies the daily budget has room for this campaign.
47
+ * Returns false if budget is exhausted.
48
+ */
49
+ declare function lockBudget(intent: SpendIntent, dailyBudgetCents: number, currentDailySpendCents: number, hardStopCents: number): boolean;
50
+ /**
51
+ * Execute the spend intent: WAL → platform API → spend log → campaign record.
52
+ * Each step is logged. On failure, the intent is marked failed and can be retried.
53
+ */
54
+ declare function executeSpendIntent(intent: SpendIntent, platformCall: () => Promise<{
55
+ externalId: string;
56
+ }>, logSpend: (intentId: string, externalId: string) => Promise<void>): Promise<{
57
+ success: boolean;
58
+ externalId?: string;
59
+ error?: string;
60
+ }>;
61
+ type PauseReason = 'budget_exhausted' | 'user_paused' | 'compliance' | 'underperforming' | 'freeze' | 'token_expired' | 'platform_suspended' | 'approval_timeout' | 'killed_by_agent' | 'killed_by_user' | 'ab_test_loser';
62
+ export type { CampaignStatus, CampaignEventSource, CampaignStateEvent, SpendIntent, PauseReason };
63
+ export { VALID_TRANSITIONS, AGENT_ALLOWED_TRANSITIONS, AGENT_ALLOWED_REASONS, isValidTransition, isAgentAllowed, transition, createSpendIntent, lockBudget, executeSpendIntent, };
@@ -0,0 +1,114 @@
1
+ /**
2
+ * Campaign State Machine — Event-sourced transitions with validation (§9.17).
3
+ *
4
+ * 10 states, validated transitions, event-sourced history.
5
+ * Only valid transitions are allowed. Invalid transitions throw.
6
+ * Each transition is logged as an event with source, reason, and optional ruleId.
7
+ *
8
+ * PRD Reference: §9.9 (GrowthCampaign), §9.17 (state machine), §9.19.11 (agent source)
9
+ */
10
+ // ── Valid Transitions ─────────────────────────────────
11
+ const VALID_TRANSITIONS = {
12
+ draft: ['pending_approval', 'deleting'],
13
+ pending_approval: ['creating', 'draft', 'deleting'], // approve → creating, reject → draft
14
+ creating: ['active', 'error', 'deleting'], // success → active, fail → error
15
+ active: ['paused', 'completed', 'error', 'suspended', 'deleting', 'freeze_pending'],
16
+ paused: ['active', 'deleting', 'completed'], // resume, delete, or mark done
17
+ completed: [], // terminal
18
+ error: ['creating', 'deleting', 'draft'], // retry → creating, abandon → deleting
19
+ suspended: ['active', 'paused', 'deleting'], // platform reinstates, or we give up
20
+ deleting: ['completed'], // deletion confirmed → terminal
21
+ freeze_pending: ['paused', 'active'], // freeze succeeds → paused, freeze fails → active
22
+ };
23
+ // ── Agent-Allowed Transitions (§9.19.11) ──────────────
24
+ // Daemon Tier 1 rules can ONLY perform these transitions
25
+ const AGENT_ALLOWED_TRANSITIONS = [
26
+ { from: 'active', to: 'paused' }, // kill underperformer, A/B test loser
27
+ ];
28
+ const AGENT_ALLOWED_REASONS = [
29
+ 'killed_by_agent',
30
+ 'underperforming',
31
+ 'budget_exhausted',
32
+ 'ab_test_loser',
33
+ ];
34
+ // ── State Machine ─────────────────────────────────────
35
+ function isValidTransition(from, to) {
36
+ return VALID_TRANSITIONS[from]?.includes(to) ?? false;
37
+ }
38
+ function isAgentAllowed(from, to, reason) {
39
+ const transitionOk = AGENT_ALLOWED_TRANSITIONS.some(t => t.from === from && t.to === to);
40
+ const reasonOk = AGENT_ALLOWED_REASONS.includes(reason);
41
+ return transitionOk && reasonOk;
42
+ }
43
+ function transition(currentStatus, newStatus, source, reason, ruleId) {
44
+ // Validate transition is valid
45
+ if (!isValidTransition(currentStatus, newStatus)) {
46
+ throw new Error(`Invalid campaign transition: ${currentStatus} → ${newStatus}. ` +
47
+ `Valid targets from ${currentStatus}: [${VALID_TRANSITIONS[currentStatus].join(', ')}]`);
48
+ }
49
+ // If source is 'agent', validate it's in the allowed set
50
+ if (source === 'agent' && !isAgentAllowed(currentStatus, newStatus, reason)) {
51
+ throw new Error(`Agent-initiated transition ${currentStatus} → ${newStatus} (reason: ${reason}) is not authorized. ` +
52
+ `Agents can only: active → paused with reasons: ${AGENT_ALLOWED_REASONS.join(', ')}`);
53
+ }
54
+ return {
55
+ timestamp: new Date().toISOString(),
56
+ source,
57
+ oldStatus: currentStatus,
58
+ newStatus,
59
+ reason,
60
+ ruleId,
61
+ };
62
+ }
63
+ /**
64
+ * Create a spend intent (WAL entry) before executing a platform API call.
65
+ * The intent ID serves as the idempotency key for the platform (ADR-3).
66
+ */
67
+ function createSpendIntent(intentId, platform, campaignConfig) {
68
+ return {
69
+ intentId,
70
+ platform,
71
+ campaignConfig,
72
+ budgetLocked: false,
73
+ status: 'pending',
74
+ createdAt: new Date().toISOString(),
75
+ };
76
+ }
77
+ /**
78
+ * Lock the budget for a spend intent.
79
+ * Verifies the daily budget has room for this campaign.
80
+ * Returns false if budget is exhausted.
81
+ */
82
+ function lockBudget(intent, dailyBudgetCents, currentDailySpendCents, hardStopCents) {
83
+ if (currentDailySpendCents + dailyBudgetCents >= hardStopCents) {
84
+ return false; // Would exceed hard stop
85
+ }
86
+ intent.budgetLocked = true;
87
+ return true;
88
+ }
89
+ /**
90
+ * Execute the spend intent: WAL → platform API → spend log → campaign record.
91
+ * Each step is logged. On failure, the intent is marked failed and can be retried.
92
+ */
93
+ async function executeSpendIntent(intent, platformCall, logSpend) {
94
+ if (!intent.budgetLocked) {
95
+ return { success: false, error: 'Budget not locked — call lockBudget() first' };
96
+ }
97
+ intent.status = 'executing';
98
+ try {
99
+ // Step 1: Call platform API with idempotency key
100
+ const result = await platformCall();
101
+ // Step 2: Log to spend log
102
+ await logSpend(intent.intentId, result.externalId);
103
+ // Step 3: Mark complete
104
+ intent.status = 'completed';
105
+ intent.completedAt = new Date().toISOString();
106
+ return { success: true, externalId: result.externalId };
107
+ }
108
+ catch (err) {
109
+ intent.status = 'failed';
110
+ intent.error = String(err);
111
+ return { success: false, error: String(err) };
112
+ }
113
+ }
114
+ export { VALID_TRANSITIONS, AGENT_ALLOWED_TRANSITIONS, AGENT_ALLOWED_REASONS, isValidTransition, isAgentAllowed, transition, createSpendIntent, lockBudget, executeSpendIntent, };
@@ -0,0 +1,14 @@
1
+ /**
2
+ * GitHub Actions CI/CD workflow generator (ADR-017).
3
+ * Generates ci.yml (test + lint on PR) and deploy.yml (deploy on merge to main).
4
+ * Framework-aware: Node → npm test, Django → pytest, Rails → rspec.
5
+ */
6
+ export interface CIGeneratorResult {
7
+ success: boolean;
8
+ files: string[];
9
+ error?: string;
10
+ }
11
+ /**
12
+ * Generate CI/CD workflow files in the project's .github/workflows/ directory.
13
+ */
14
+ export declare function generateCIWorkflows(projectDir: string, framework: string, deployTarget: string): Promise<CIGeneratorResult>;
@@ -0,0 +1,187 @@
1
+ /**
2
+ * GitHub Actions CI/CD workflow generator (ADR-017).
3
+ * Generates ci.yml (test + lint on PR) and deploy.yml (deploy on merge to main).
4
+ * Framework-aware: Node → npm test, Django → pytest, Rails → rspec.
5
+ */
6
+ import { mkdir, writeFile } from 'node:fs/promises';
7
+ import { join } from 'node:path';
8
+ import { getBuildOutputDir } from './build-step.js';
9
+ const FRAMEWORK_CI = {
10
+ 'next.js': { runtime: 'node', buildCommand: 'npm run build', testCommand: 'npm run test --if-present', lintCommand: 'npm run lint --if-present' },
11
+ 'express': { runtime: 'node', buildCommand: 'npm run build', testCommand: 'npm run test --if-present', lintCommand: 'npm run lint --if-present' },
12
+ 'vite': { runtime: 'node', buildCommand: 'npm run build', testCommand: 'npm run test --if-present', lintCommand: 'npm run lint --if-present' },
13
+ 'nuxt': { runtime: 'node', buildCommand: 'npm run build', testCommand: 'npm run test --if-present', lintCommand: 'npm run lint --if-present' },
14
+ 'remix': { runtime: 'node', buildCommand: 'npm run build', testCommand: 'npm run test --if-present', lintCommand: 'npm run lint --if-present' },
15
+ 'svelte': { runtime: 'node', buildCommand: 'npm run build', testCommand: 'npm run test --if-present', lintCommand: 'npm run lint --if-present' },
16
+ 'sveltekit': { runtime: 'node', buildCommand: 'npm run build', testCommand: 'npm run test --if-present', lintCommand: 'npm run lint --if-present' },
17
+ 'astro': { runtime: 'node', buildCommand: 'npm run build', testCommand: 'npm run test --if-present', lintCommand: 'npm run lint --if-present' },
18
+ 'gatsby': { runtime: 'node', buildCommand: 'npm run build', testCommand: 'npm run test --if-present', lintCommand: 'npm run lint --if-present' },
19
+ 'django': { runtime: 'python', installCommand: 'pip install -r requirements.txt', buildCommand: 'python manage.py collectstatic --noinput', testCommand: 'pytest', lintCommand: 'flake8 --max-line-length=120 || true' },
20
+ 'flask': { runtime: 'python', installCommand: 'pip install -r requirements.txt', testCommand: 'pytest', lintCommand: 'flake8 --max-line-length=120 || true' },
21
+ 'rails': { runtime: 'ruby', installCommand: 'bundle install', buildCommand: 'bundle exec rails assets:precompile', testCommand: 'bundle exec rspec', lintCommand: 'bundle exec rubocop --format simple || true' },
22
+ };
23
+ /** Check if a framework has an explicit build command (not a default fallback). */
24
+ function hasBuildCommand(framework) {
25
+ return !!(FRAMEWORK_CI[framework]?.buildCommand);
26
+ }
27
+ function resolveConfig(framework) {
28
+ const partial = FRAMEWORK_CI[framework] || {};
29
+ return {
30
+ runtime: partial.runtime || 'node',
31
+ nodeVersion: '20',
32
+ pythonVersion: '3.12',
33
+ rubyVersion: '3.3',
34
+ installCommand: partial.installCommand || 'npm ci',
35
+ buildCommand: partial.buildCommand || 'npm run build',
36
+ testCommand: partial.testCommand || 'npm run test --if-present',
37
+ lintCommand: partial.lintCommand || 'npm run lint --if-present',
38
+ };
39
+ }
40
+ function generateSetupSteps(config) {
41
+ switch (config.runtime) {
42
+ case 'python':
43
+ return ` - uses: actions/setup-python@v5
44
+ with:
45
+ python-version: '${config.pythonVersion}'
46
+ - run: ${config.installCommand}`;
47
+ case 'ruby':
48
+ return ` - uses: ruby/setup-ruby@v1
49
+ with:
50
+ ruby-version: '${config.rubyVersion}'
51
+ bundler-cache: true`;
52
+ default:
53
+ return ` - uses: actions/setup-node@v4
54
+ with:
55
+ node-version: '${config.nodeVersion}'
56
+ cache: 'npm'
57
+ - run: npm ci`;
58
+ }
59
+ }
60
+ function generateCIWorkflow(framework) {
61
+ const config = resolveConfig(framework);
62
+ const setup = generateSetupSteps(config);
63
+ return `# CI — test + lint on pull request
64
+ # Generated by VoidForge (ADR-017)
65
+ name: CI
66
+
67
+ on:
68
+ pull_request:
69
+ branches: [main]
70
+
71
+ jobs:
72
+ test:
73
+ runs-on: ubuntu-latest
74
+ steps:
75
+ - uses: actions/checkout@v4
76
+ ${setup}
77
+ - run: ${config.testCommand}
78
+
79
+ lint:
80
+ runs-on: ubuntu-latest
81
+ steps:
82
+ - uses: actions/checkout@v4
83
+ ${setup}
84
+ - run: ${config.lintCommand}
85
+ `;
86
+ }
87
+ /** Map deploy targets to their required GitHub secrets for documentation. */
88
+ const DEPLOY_SECRETS = {
89
+ vercel: ['VERCEL_TOKEN', 'VERCEL_ORG_ID', 'VERCEL_PROJECT_ID'],
90
+ cloudflare: ['CLOUDFLARE_API_TOKEN', 'CF_PROJECT_NAME'],
91
+ railway: [],
92
+ vps: ['SSH_PRIVATE_KEY', 'SSH_USER', 'SSH_HOST'],
93
+ static: ['AWS_ACCESS_KEY_ID', 'AWS_SECRET_ACCESS_KEY', 'AWS_REGION', 'S3_BUCKET'],
94
+ };
95
+ function generateDeployWorkflow(framework, deployTarget) {
96
+ const config = resolveConfig(framework);
97
+ const setup = generateSetupSteps(config);
98
+ let deployStep;
99
+ switch (deployTarget) {
100
+ case 'vercel':
101
+ deployStep = ` - uses: amondnet/vercel-action@v25
102
+ with:
103
+ vercel-token: \${{ secrets.VERCEL_TOKEN }}
104
+ vercel-org-id: \${{ secrets.VERCEL_ORG_ID }}
105
+ vercel-project-id: \${{ secrets.VERCEL_PROJECT_ID }}
106
+ vercel-args: '--prod'`;
107
+ break;
108
+ case 'cloudflare': {
109
+ const cfOutputDir = getBuildOutputDir(framework);
110
+ deployStep = ` - uses: cloudflare/wrangler-action@v3
111
+ with:
112
+ apiToken: \${{ secrets.CLOUDFLARE_API_TOKEN }}
113
+ command: pages deploy ./${cfOutputDir} --project-name=\${{ secrets.CF_PROJECT_NAME }}`;
114
+ break;
115
+ }
116
+ case 'railway':
117
+ deployStep = ` # Railway auto-deploys on push — this job just verifies the build
118
+ - run: echo "Railway auto-deploy triggered by push to main"`;
119
+ break;
120
+ case 'vps': {
121
+ const vpsBuild = config.runtime === 'python'
122
+ ? 'pip install -r requirements.txt && python manage.py collectstatic --noinput && sudo systemctl restart gunicorn'
123
+ : config.runtime === 'ruby'
124
+ ? 'bundle install && bundle exec rails assets:precompile && sudo systemctl restart puma'
125
+ : 'npm ci && npm run build && pm2 restart all';
126
+ deployStep = ` - run: |
127
+ mkdir -p ~/.ssh
128
+ echo "\${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/deploy-key.pem
129
+ chmod 600 ~/.ssh/deploy-key.pem
130
+ ssh -i ~/.ssh/deploy-key.pem -o StrictHostKeyChecking=accept-new \${{ secrets.SSH_USER }}@\${{ secrets.SSH_HOST }} "cd /opt/app/current && git pull && ${vpsBuild}"
131
+ rm -f ~/.ssh/deploy-key.pem`;
132
+ break;
133
+ }
134
+ case 'static': {
135
+ const s3OutputDir = getBuildOutputDir(framework);
136
+ deployStep = ` - uses: aws-actions/configure-aws-credentials@v4
137
+ with:
138
+ aws-access-key-id: \${{ secrets.AWS_ACCESS_KEY_ID }}
139
+ aws-secret-access-key: \${{ secrets.AWS_SECRET_ACCESS_KEY }}
140
+ aws-region: \${{ secrets.AWS_REGION }}
141
+ - run: aws s3 sync ./${s3OutputDir} s3://\${{ secrets.S3_BUCKET }} --delete`;
142
+ break;
143
+ }
144
+ default:
145
+ deployStep = ` - run: echo "Deploy step not configured for target: ${deployTarget}"`;
146
+ }
147
+ const secrets = DEPLOY_SECRETS[deployTarget] || [];
148
+ const secretsDoc = secrets.length > 0
149
+ ? `# Required secrets (set in GitHub repo > Settings > Secrets and variables > Actions):\n${secrets.map(s => `# - ${s}`).join('\n')}\n`
150
+ : '';
151
+ return `# Deploy — build and deploy on merge to main
152
+ # Generated by VoidForge (ADR-017)
153
+ ${secretsDoc}name: Deploy
154
+
155
+ on:
156
+ push:
157
+ branches: [main]
158
+
159
+ jobs:
160
+ deploy:
161
+ runs-on: ubuntu-latest
162
+ steps:
163
+ - uses: actions/checkout@v4
164
+ ${setup}
165
+ ${hasBuildCommand(framework) ? ` - run: ${config.buildCommand}\n` : ''}${deployStep}
166
+ `;
167
+ }
168
+ /**
169
+ * Generate CI/CD workflow files in the project's .github/workflows/ directory.
170
+ */
171
+ export async function generateCIWorkflows(projectDir, framework, deployTarget) {
172
+ const workflowDir = join(projectDir, '.github', 'workflows');
173
+ const files = [];
174
+ try {
175
+ await mkdir(workflowDir, { recursive: true });
176
+ const ciContent = generateCIWorkflow(framework);
177
+ await writeFile(join(workflowDir, 'ci.yml'), ciContent, 'utf-8');
178
+ files.push('.github/workflows/ci.yml');
179
+ const deployContent = generateDeployWorkflow(framework, deployTarget);
180
+ await writeFile(join(workflowDir, 'deploy.yml'), deployContent, 'utf-8');
181
+ files.push('.github/workflows/deploy.yml');
182
+ return { success: true, files };
183
+ }
184
+ catch (err) {
185
+ return { success: false, files, error: err.message };
186
+ }
187
+ }
@@ -0,0 +1,38 @@
1
+ /**
2
+ * CLAUDE.md Merge Utility — Safe append of project directives.
3
+ *
4
+ * Merges project-specific directives into VoidForge's CLAUDE.md by
5
+ * appending them under a clearly marked section. Never replaces the
6
+ * methodology content. Idempotent — won't duplicate if run multiple times.
7
+ *
8
+ * PRD Reference: RFC-blueprint-path.md
9
+ */
10
+ export interface MergeResult {
11
+ merged: boolean;
12
+ reason: string;
13
+ claudeMdPath: string;
14
+ directivesPath: string;
15
+ }
16
+ /**
17
+ * Append project directives to CLAUDE.md.
18
+ *
19
+ * Rules:
20
+ * - VoidForge's CLAUDE.md content is NEVER replaced
21
+ * - Project directives are appended under a clear marker section
22
+ * - Idempotent: if the marker already exists, the merge is skipped
23
+ * - The source directive file path is recorded in the merged section
24
+ *
25
+ * @param projectRoot - The project's root directory
26
+ * @param directivesRelativePath - Relative path to the directives file (e.g., 'docs/PROJECT-DIRECTIVES.md')
27
+ * @returns MergeResult describing what happened
28
+ */
29
+ export declare function mergeProjectDirectives(projectRoot: string, directivesRelativePath: string): Promise<MergeResult>;
30
+ /**
31
+ * Check if project directives have already been merged into CLAUDE.md.
32
+ */
33
+ export declare function isAlreadyMerged(projectRoot: string): Promise<boolean>;
34
+ /**
35
+ * Remove previously merged project directives from CLAUDE.md.
36
+ * Useful for re-merging with updated directives.
37
+ */
38
+ export declare function unmergeProjectDirectives(projectRoot: string): Promise<boolean>;