@build-astron-co/nimbus 0.4.1 → 0.4.3

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 (435) hide show
  1. package/CHANGELOG.md +268 -89
  2. package/README.md +26 -567
  3. package/dist/src/agent/compaction-agent.js +24 -12
  4. package/dist/src/agent/context-manager.js +2 -1
  5. package/dist/src/agent/expand-files.js +2 -1
  6. package/dist/src/agent/loop.js +71 -33
  7. package/dist/src/agent/permissions.js +4 -2
  8. package/dist/src/agent/system-prompt.js +34 -17
  9. package/dist/src/app.js +1 -1
  10. package/dist/src/auth/keychain.js +8 -4
  11. package/dist/src/auth/store.js +70 -107
  12. package/dist/src/cli/init.js +35 -19
  13. package/dist/src/cli/run.js +18 -10
  14. package/dist/src/cli/serve.js +4 -2
  15. package/dist/src/cli.js +52 -11
  16. package/dist/src/commands/alias.js +5 -3
  17. package/dist/src/commands/audit/index.js +2 -1
  18. package/dist/src/commands/aws-terraform.js +36 -18
  19. package/dist/src/commands/completions.js +1 -1
  20. package/dist/src/commands/config.js +3 -2
  21. package/dist/src/commands/connect-github.js +92 -0
  22. package/dist/src/commands/cost/index.js +3 -2
  23. package/dist/src/commands/deploy.js +15 -10
  24. package/dist/src/commands/doctor.js +9 -6
  25. package/dist/src/commands/drift/index.js +2 -1
  26. package/dist/src/commands/export.js +5 -3
  27. package/dist/src/commands/generate-terraform.js +110 -2
  28. package/dist/src/commands/import.js +3 -3
  29. package/dist/src/commands/incident.js +10 -5
  30. package/dist/src/commands/login.js +8 -93
  31. package/dist/src/commands/logs.js +16 -8
  32. package/dist/src/commands/onboarding.js +6 -4
  33. package/dist/src/commands/pipeline.js +6 -3
  34. package/dist/src/commands/plugin.js +3 -2
  35. package/dist/src/commands/profile.js +27 -14
  36. package/dist/src/commands/questionnaire.js +1 -1
  37. package/dist/src/commands/rollback.js +3 -2
  38. package/dist/src/commands/rollout.js +5 -3
  39. package/dist/src/commands/runbook.js +17 -10
  40. package/dist/src/commands/schedule.js +10 -5
  41. package/dist/src/commands/status.js +2 -1
  42. package/dist/src/commands/team-context.js +12 -7
  43. package/dist/src/commands/template.js +1 -1
  44. package/dist/src/commands/tf/index.js +6 -3
  45. package/dist/src/commands/upgrade.js +5 -3
  46. package/dist/src/commands/version.js +6 -3
  47. package/dist/src/commands/watch.js +6 -3
  48. package/dist/src/compat/sqlite.js +5 -3
  49. package/dist/src/config/mode-store.js +2 -1
  50. package/dist/src/config/profiles.js +4 -2
  51. package/dist/src/config/types.js +2 -1
  52. package/dist/src/engine/executor.js +8 -4
  53. package/dist/src/engine/planner.js +9 -5
  54. package/dist/src/llm/providers/anthropic.js +6 -3
  55. package/dist/src/llm/providers/ollama.js +1 -1
  56. package/dist/src/llm/router.js +22 -7
  57. package/dist/src/nimbus.js +1 -0
  58. package/dist/src/sessions/manager.js +6 -3
  59. package/dist/src/sharing/viewer.js +2 -1
  60. package/dist/src/tools/file-ops.js +1 -2
  61. package/dist/src/tools/schemas/devops.js +197 -108
  62. package/dist/src/tools/schemas/standard.js +1 -1
  63. package/dist/src/ui/App.js +25 -13
  64. package/dist/src/ui/FileDiffModal.js +22 -11
  65. package/dist/src/ui/HelpModal.js +2 -1
  66. package/dist/src/ui/InputBox.js +6 -3
  67. package/dist/src/ui/MessageList.js +40 -20
  68. package/dist/src/ui/TerminalPane.js +2 -1
  69. package/dist/src/ui/ToolCallDisplay.js +12 -6
  70. package/dist/src/ui/TreePane.js +2 -1
  71. package/dist/src/ui/ink/index.js +37 -21
  72. package/dist/src/version.js +1 -1
  73. package/dist/src/watcher/index.js +8 -4
  74. package/package.json +3 -5
  75. package/src/__tests__/alias.test.ts +0 -133
  76. package/src/__tests__/app.test.ts +0 -76
  77. package/src/__tests__/audit.test.ts +0 -877
  78. package/src/__tests__/circuit-breaker.test.ts +0 -116
  79. package/src/__tests__/cli-run.test.ts +0 -351
  80. package/src/__tests__/compat-sqlite.test.ts +0 -68
  81. package/src/__tests__/context-manager.test.ts +0 -632
  82. package/src/__tests__/context.test.ts +0 -242
  83. package/src/__tests__/devops-terminal-gaps.test.ts +0 -718
  84. package/src/__tests__/doctor.test.ts +0 -48
  85. package/src/__tests__/enterprise.test.ts +0 -401
  86. package/src/__tests__/export.test.ts +0 -236
  87. package/src/__tests__/gap-11-18-20.test.ts +0 -958
  88. package/src/__tests__/generator.test.ts +0 -433
  89. package/src/__tests__/helm-streaming.test.ts +0 -127
  90. package/src/__tests__/hooks.test.ts +0 -582
  91. package/src/__tests__/incident.test.ts +0 -179
  92. package/src/__tests__/init.test.ts +0 -487
  93. package/src/__tests__/intent-parser.test.ts +0 -229
  94. package/src/__tests__/llm-router.test.ts +0 -209
  95. package/src/__tests__/logs.test.ts +0 -107
  96. package/src/__tests__/loop-errors.test.ts +0 -244
  97. package/src/__tests__/lsp.test.ts +0 -293
  98. package/src/__tests__/modes.test.ts +0 -336
  99. package/src/__tests__/perf-optimizations.test.ts +0 -847
  100. package/src/__tests__/permissions.test.ts +0 -338
  101. package/src/__tests__/pipeline.test.ts +0 -50
  102. package/src/__tests__/polish-phase3.test.ts +0 -340
  103. package/src/__tests__/profile.test.ts +0 -237
  104. package/src/__tests__/rollback.test.ts +0 -83
  105. package/src/__tests__/runbook.test.ts +0 -219
  106. package/src/__tests__/schedule.test.ts +0 -206
  107. package/src/__tests__/serve.test.ts +0 -275
  108. package/src/__tests__/sessions.test.ts +0 -322
  109. package/src/__tests__/sharing.test.ts +0 -340
  110. package/src/__tests__/snapshots.test.ts +0 -581
  111. package/src/__tests__/standalone-migration.test.ts +0 -199
  112. package/src/__tests__/state-db.test.ts +0 -334
  113. package/src/__tests__/status.test.ts +0 -158
  114. package/src/__tests__/stream-with-tools.test.ts +0 -778
  115. package/src/__tests__/subagents.test.ts +0 -176
  116. package/src/__tests__/system-prompt.test.ts +0 -248
  117. package/src/__tests__/terminal-gap-v2.test.ts +0 -395
  118. package/src/__tests__/terminal-parity.test.ts +0 -393
  119. package/src/__tests__/tf-apply.test.ts +0 -187
  120. package/src/__tests__/tool-converter.test.ts +0 -256
  121. package/src/__tests__/tool-schemas.test.ts +0 -602
  122. package/src/__tests__/tools.test.ts +0 -144
  123. package/src/__tests__/version-json.test.ts +0 -184
  124. package/src/__tests__/version.test.ts +0 -49
  125. package/src/__tests__/watch.test.ts +0 -129
  126. package/src/agent/compaction-agent.ts +0 -266
  127. package/src/agent/context-manager.ts +0 -499
  128. package/src/agent/context.ts +0 -427
  129. package/src/agent/deploy-preview.ts +0 -487
  130. package/src/agent/expand-files.ts +0 -108
  131. package/src/agent/index.ts +0 -68
  132. package/src/agent/loop.ts +0 -1998
  133. package/src/agent/modes.ts +0 -429
  134. package/src/agent/permissions.ts +0 -513
  135. package/src/agent/subagents/base.ts +0 -116
  136. package/src/agent/subagents/cost.ts +0 -51
  137. package/src/agent/subagents/explore.ts +0 -42
  138. package/src/agent/subagents/general.ts +0 -54
  139. package/src/agent/subagents/index.ts +0 -102
  140. package/src/agent/subagents/infra.ts +0 -59
  141. package/src/agent/subagents/security.ts +0 -69
  142. package/src/agent/system-prompt.ts +0 -990
  143. package/src/app.ts +0 -180
  144. package/src/audit/activity-log.ts +0 -290
  145. package/src/audit/compliance-checker.ts +0 -540
  146. package/src/audit/cost-tracker.ts +0 -318
  147. package/src/audit/index.ts +0 -23
  148. package/src/audit/security-scanner.ts +0 -641
  149. package/src/auth/guard.ts +0 -75
  150. package/src/auth/index.ts +0 -56
  151. package/src/auth/keychain.ts +0 -82
  152. package/src/auth/oauth.ts +0 -465
  153. package/src/auth/providers.ts +0 -470
  154. package/src/auth/sso.ts +0 -113
  155. package/src/auth/store.ts +0 -505
  156. package/src/auth/types.ts +0 -187
  157. package/src/build.ts +0 -141
  158. package/src/cli/index.ts +0 -16
  159. package/src/cli/init.ts +0 -1227
  160. package/src/cli/openapi-spec.ts +0 -356
  161. package/src/cli/run.ts +0 -628
  162. package/src/cli/serve-auth.ts +0 -80
  163. package/src/cli/serve.ts +0 -539
  164. package/src/cli/web.ts +0 -71
  165. package/src/cli.ts +0 -1728
  166. package/src/clients/core-engine-client.ts +0 -227
  167. package/src/clients/enterprise-client.ts +0 -334
  168. package/src/clients/generator-client.ts +0 -351
  169. package/src/clients/git-client.ts +0 -627
  170. package/src/clients/github-client.ts +0 -410
  171. package/src/clients/helm-client.ts +0 -504
  172. package/src/clients/index.ts +0 -80
  173. package/src/clients/k8s-client.ts +0 -497
  174. package/src/clients/llm-client.ts +0 -161
  175. package/src/clients/rest-client.ts +0 -130
  176. package/src/clients/service-discovery.ts +0 -38
  177. package/src/clients/terraform-client.ts +0 -482
  178. package/src/clients/tools-client.ts +0 -1843
  179. package/src/clients/ws-client.ts +0 -115
  180. package/src/commands/alias.ts +0 -100
  181. package/src/commands/analyze/index.ts +0 -352
  182. package/src/commands/apply/helm.ts +0 -473
  183. package/src/commands/apply/index.ts +0 -213
  184. package/src/commands/apply/k8s.ts +0 -454
  185. package/src/commands/apply/terraform.ts +0 -582
  186. package/src/commands/ask.ts +0 -167
  187. package/src/commands/audit/index.ts +0 -357
  188. package/src/commands/auth-cloud.ts +0 -407
  189. package/src/commands/auth-list.ts +0 -134
  190. package/src/commands/auth-profile.ts +0 -121
  191. package/src/commands/auth-refresh.ts +0 -187
  192. package/src/commands/auth-status.ts +0 -141
  193. package/src/commands/aws/ec2.ts +0 -501
  194. package/src/commands/aws/iam.ts +0 -397
  195. package/src/commands/aws/index.ts +0 -133
  196. package/src/commands/aws/lambda.ts +0 -396
  197. package/src/commands/aws/rds.ts +0 -439
  198. package/src/commands/aws/s3.ts +0 -439
  199. package/src/commands/aws/vpc.ts +0 -393
  200. package/src/commands/aws-discover.ts +0 -542
  201. package/src/commands/aws-terraform.ts +0 -755
  202. package/src/commands/azure/aks.ts +0 -376
  203. package/src/commands/azure/functions.ts +0 -253
  204. package/src/commands/azure/index.ts +0 -116
  205. package/src/commands/azure/storage.ts +0 -478
  206. package/src/commands/azure/vm.ts +0 -355
  207. package/src/commands/billing/index.ts +0 -256
  208. package/src/commands/chat.ts +0 -320
  209. package/src/commands/completions.ts +0 -268
  210. package/src/commands/config.ts +0 -372
  211. package/src/commands/cost/cloud-cost-estimator.ts +0 -266
  212. package/src/commands/cost/estimator.ts +0 -79
  213. package/src/commands/cost/index.ts +0 -810
  214. package/src/commands/cost/parsers/terraform.ts +0 -273
  215. package/src/commands/cost/parsers/types.ts +0 -25
  216. package/src/commands/cost/pricing/aws.ts +0 -544
  217. package/src/commands/cost/pricing/azure.ts +0 -499
  218. package/src/commands/cost/pricing/gcp.ts +0 -396
  219. package/src/commands/cost/pricing/index.ts +0 -40
  220. package/src/commands/demo.ts +0 -250
  221. package/src/commands/deploy.ts +0 -260
  222. package/src/commands/doctor.ts +0 -1386
  223. package/src/commands/drift/index.ts +0 -787
  224. package/src/commands/explain.ts +0 -277
  225. package/src/commands/export.ts +0 -146
  226. package/src/commands/feedback.ts +0 -389
  227. package/src/commands/fix.ts +0 -324
  228. package/src/commands/fs/index.ts +0 -402
  229. package/src/commands/gcp/compute.ts +0 -325
  230. package/src/commands/gcp/functions.ts +0 -271
  231. package/src/commands/gcp/gke.ts +0 -438
  232. package/src/commands/gcp/iam.ts +0 -344
  233. package/src/commands/gcp/index.ts +0 -129
  234. package/src/commands/gcp/storage.ts +0 -284
  235. package/src/commands/generate-helm.ts +0 -1249
  236. package/src/commands/generate-k8s.ts +0 -1508
  237. package/src/commands/generate-terraform.ts +0 -1202
  238. package/src/commands/gh/index.ts +0 -863
  239. package/src/commands/git/index.ts +0 -1343
  240. package/src/commands/helm/index.ts +0 -1126
  241. package/src/commands/help.ts +0 -715
  242. package/src/commands/history.ts +0 -149
  243. package/src/commands/import.ts +0 -868
  244. package/src/commands/incident.ts +0 -166
  245. package/src/commands/index.ts +0 -367
  246. package/src/commands/init.ts +0 -1051
  247. package/src/commands/k8s/index.ts +0 -1137
  248. package/src/commands/login.ts +0 -716
  249. package/src/commands/logout.ts +0 -83
  250. package/src/commands/logs.ts +0 -167
  251. package/src/commands/onboarding.ts +0 -405
  252. package/src/commands/pipeline.ts +0 -186
  253. package/src/commands/plan/display.ts +0 -279
  254. package/src/commands/plan/index.ts +0 -599
  255. package/src/commands/plugin.ts +0 -398
  256. package/src/commands/preview.ts +0 -452
  257. package/src/commands/profile.ts +0 -342
  258. package/src/commands/questionnaire.ts +0 -1172
  259. package/src/commands/resume.ts +0 -47
  260. package/src/commands/rollback.ts +0 -315
  261. package/src/commands/rollout.ts +0 -88
  262. package/src/commands/runbook.ts +0 -346
  263. package/src/commands/schedule.ts +0 -236
  264. package/src/commands/status.ts +0 -252
  265. package/src/commands/team/index.ts +0 -346
  266. package/src/commands/team-context.ts +0 -220
  267. package/src/commands/template.ts +0 -233
  268. package/src/commands/tf/index.ts +0 -1093
  269. package/src/commands/upgrade.ts +0 -607
  270. package/src/commands/usage/index.ts +0 -134
  271. package/src/commands/version.ts +0 -174
  272. package/src/commands/watch.ts +0 -153
  273. package/src/compat/index.ts +0 -2
  274. package/src/compat/runtime.ts +0 -12
  275. package/src/compat/sqlite.ts +0 -177
  276. package/src/config/index.ts +0 -17
  277. package/src/config/manager.ts +0 -530
  278. package/src/config/mode-store.ts +0 -62
  279. package/src/config/profiles.ts +0 -84
  280. package/src/config/safety-policy.ts +0 -358
  281. package/src/config/schema.ts +0 -125
  282. package/src/config/types.ts +0 -609
  283. package/src/config/workspace-state.ts +0 -53
  284. package/src/context/context-db.ts +0 -199
  285. package/src/demo/index.ts +0 -349
  286. package/src/demo/scenarios/full-journey.ts +0 -229
  287. package/src/demo/scenarios/getting-started.ts +0 -127
  288. package/src/demo/scenarios/helm-release.ts +0 -341
  289. package/src/demo/scenarios/k8s-deployment.ts +0 -194
  290. package/src/demo/scenarios/terraform-vpc.ts +0 -170
  291. package/src/demo/types.ts +0 -92
  292. package/src/engine/cost-estimator.ts +0 -480
  293. package/src/engine/diagram-generator.ts +0 -256
  294. package/src/engine/drift-detector.ts +0 -902
  295. package/src/engine/executor.ts +0 -1066
  296. package/src/engine/index.ts +0 -76
  297. package/src/engine/orchestrator.ts +0 -636
  298. package/src/engine/planner.ts +0 -787
  299. package/src/engine/safety.ts +0 -743
  300. package/src/engine/verifier.ts +0 -770
  301. package/src/enterprise/audit.ts +0 -348
  302. package/src/enterprise/auth.ts +0 -270
  303. package/src/enterprise/billing.ts +0 -822
  304. package/src/enterprise/index.ts +0 -17
  305. package/src/enterprise/teams.ts +0 -443
  306. package/src/generator/best-practices.ts +0 -1608
  307. package/src/generator/helm.ts +0 -630
  308. package/src/generator/index.ts +0 -37
  309. package/src/generator/intent-parser.ts +0 -514
  310. package/src/generator/kubernetes.ts +0 -976
  311. package/src/generator/terraform.ts +0 -1875
  312. package/src/history/index.ts +0 -8
  313. package/src/history/manager.ts +0 -250
  314. package/src/history/types.ts +0 -34
  315. package/src/hooks/config.ts +0 -432
  316. package/src/hooks/engine.ts +0 -392
  317. package/src/hooks/index.ts +0 -4
  318. package/src/llm/auth-bridge.ts +0 -198
  319. package/src/llm/circuit-breaker.ts +0 -140
  320. package/src/llm/config-loader.ts +0 -201
  321. package/src/llm/cost-calculator.ts +0 -171
  322. package/src/llm/index.ts +0 -8
  323. package/src/llm/model-aliases.ts +0 -115
  324. package/src/llm/provider-registry.ts +0 -63
  325. package/src/llm/providers/anthropic.ts +0 -462
  326. package/src/llm/providers/bedrock.ts +0 -477
  327. package/src/llm/providers/google.ts +0 -405
  328. package/src/llm/providers/ollama.ts +0 -767
  329. package/src/llm/providers/openai-compatible.ts +0 -340
  330. package/src/llm/providers/openai.ts +0 -328
  331. package/src/llm/providers/openrouter.ts +0 -338
  332. package/src/llm/router.ts +0 -1104
  333. package/src/llm/types.ts +0 -232
  334. package/src/lsp/client.ts +0 -298
  335. package/src/lsp/languages.ts +0 -119
  336. package/src/lsp/manager.ts +0 -294
  337. package/src/mcp/client.ts +0 -402
  338. package/src/mcp/index.ts +0 -5
  339. package/src/mcp/manager.ts +0 -133
  340. package/src/nimbus.ts +0 -233
  341. package/src/plugins/index.ts +0 -27
  342. package/src/plugins/loader.ts +0 -334
  343. package/src/plugins/manager.ts +0 -376
  344. package/src/plugins/types.ts +0 -284
  345. package/src/scanners/cicd-scanner.ts +0 -258
  346. package/src/scanners/cloud-scanner.ts +0 -466
  347. package/src/scanners/framework-scanner.ts +0 -469
  348. package/src/scanners/iac-scanner.ts +0 -388
  349. package/src/scanners/index.ts +0 -539
  350. package/src/scanners/language-scanner.ts +0 -276
  351. package/src/scanners/package-manager-scanner.ts +0 -277
  352. package/src/scanners/types.ts +0 -172
  353. package/src/sessions/manager.ts +0 -472
  354. package/src/sessions/types.ts +0 -44
  355. package/src/sharing/sync.ts +0 -300
  356. package/src/sharing/viewer.ts +0 -163
  357. package/src/snapshots/index.ts +0 -2
  358. package/src/snapshots/manager.ts +0 -530
  359. package/src/state/artifacts.ts +0 -147
  360. package/src/state/audit.ts +0 -137
  361. package/src/state/billing.ts +0 -240
  362. package/src/state/checkpoints.ts +0 -117
  363. package/src/state/config.ts +0 -67
  364. package/src/state/conversations.ts +0 -14
  365. package/src/state/credentials.ts +0 -154
  366. package/src/state/db.ts +0 -58
  367. package/src/state/index.ts +0 -26
  368. package/src/state/messages.ts +0 -115
  369. package/src/state/projects.ts +0 -123
  370. package/src/state/schema.ts +0 -236
  371. package/src/state/sessions.ts +0 -147
  372. package/src/state/teams.ts +0 -200
  373. package/src/telemetry.ts +0 -108
  374. package/src/tools/aws-ops.ts +0 -952
  375. package/src/tools/azure-ops.ts +0 -579
  376. package/src/tools/file-ops.ts +0 -615
  377. package/src/tools/gcp-ops.ts +0 -625
  378. package/src/tools/git-ops.ts +0 -773
  379. package/src/tools/github-ops.ts +0 -799
  380. package/src/tools/helm-ops.ts +0 -943
  381. package/src/tools/index.ts +0 -17
  382. package/src/tools/k8s-ops.ts +0 -819
  383. package/src/tools/schemas/converter.ts +0 -184
  384. package/src/tools/schemas/devops.ts +0 -3502
  385. package/src/tools/schemas/index.ts +0 -73
  386. package/src/tools/schemas/standard.ts +0 -1148
  387. package/src/tools/schemas/types.ts +0 -735
  388. package/src/tools/spawn-exec.ts +0 -148
  389. package/src/tools/terraform-ops.ts +0 -862
  390. package/src/types/ambient.d.ts +0 -193
  391. package/src/types/config.ts +0 -83
  392. package/src/types/drift.ts +0 -116
  393. package/src/types/enterprise.ts +0 -335
  394. package/src/types/index.ts +0 -20
  395. package/src/types/plan.ts +0 -44
  396. package/src/types/request.ts +0 -65
  397. package/src/types/response.ts +0 -54
  398. package/src/types/service.ts +0 -51
  399. package/src/ui/App.tsx +0 -2114
  400. package/src/ui/DeployPreview.tsx +0 -174
  401. package/src/ui/FileDiffModal.tsx +0 -162
  402. package/src/ui/Header.tsx +0 -131
  403. package/src/ui/HelpModal.tsx +0 -57
  404. package/src/ui/InputBox.tsx +0 -503
  405. package/src/ui/MessageList.tsx +0 -1032
  406. package/src/ui/PermissionPrompt.tsx +0 -163
  407. package/src/ui/StatusBar.tsx +0 -277
  408. package/src/ui/TerminalPane.tsx +0 -84
  409. package/src/ui/ToolCallDisplay.tsx +0 -643
  410. package/src/ui/TreePane.tsx +0 -132
  411. package/src/ui/chat-ui.ts +0 -850
  412. package/src/ui/index.ts +0 -33
  413. package/src/ui/ink/index.ts +0 -1444
  414. package/src/ui/streaming.ts +0 -176
  415. package/src/ui/theme.ts +0 -104
  416. package/src/ui/types.ts +0 -75
  417. package/src/utils/analytics.ts +0 -72
  418. package/src/utils/cost-warning.ts +0 -27
  419. package/src/utils/env.ts +0 -46
  420. package/src/utils/errors.ts +0 -69
  421. package/src/utils/event-bus.ts +0 -38
  422. package/src/utils/index.ts +0 -24
  423. package/src/utils/logger.ts +0 -171
  424. package/src/utils/rate-limiter.ts +0 -121
  425. package/src/utils/service-auth.ts +0 -49
  426. package/src/utils/validation.ts +0 -53
  427. package/src/version.ts +0 -4
  428. package/src/watcher/index.ts +0 -214
  429. package/src/wizard/approval.ts +0 -383
  430. package/src/wizard/index.ts +0 -25
  431. package/src/wizard/prompts.ts +0 -338
  432. package/src/wizard/types.ts +0 -172
  433. package/src/wizard/ui.ts +0 -556
  434. package/src/wizard/wizard.ts +0 -304
  435. package/tsconfig.json +0 -24
package/src/cli/init.ts DELETED
@@ -1,1227 +0,0 @@
1
- /**
2
- * Project Initialization & Auto-Detection
3
- *
4
- * Scaffolds a new Nimbus project by detecting the existing project type,
5
- * infrastructure tooling, cloud providers, and development conventions.
6
- * Generates a NIMBUS.md file and .nimbus/ configuration directory.
7
- *
8
- * Usage:
9
- * nimbus init
10
- * nimbus init --force # overwrite existing NIMBUS.md
11
- * nimbus init --quiet # suppress console output
12
- */
13
-
14
- import * as fs from 'node:fs';
15
- import * as path from 'node:path';
16
- import { exec } from 'node:child_process';
17
- import { promisify } from 'node:util';
18
-
19
- const _execAsync = promisify(exec);
20
-
21
- // ---------------------------------------------------------------------------
22
- // Types
23
- // ---------------------------------------------------------------------------
24
-
25
- /** Detected language / runtime of the project */
26
- export type ProjectType =
27
- | 'typescript'
28
- | 'javascript'
29
- | 'go'
30
- | 'python'
31
- | 'rust'
32
- | 'java'
33
- | 'unknown';
34
-
35
- /** Infrastructure tool category */
36
- export type InfraType = 'terraform' | 'kubernetes' | 'helm' | 'docker' | 'cicd';
37
-
38
- /** Cloud provider identifier */
39
- export type CloudProvider = 'aws' | 'gcp' | 'azure';
40
-
41
- /** Complete detection result for a project directory */
42
- export interface ProjectDetection {
43
- /** Inferred project name (directory basename) */
44
- projectName: string;
45
- /** Primary language / runtime */
46
- projectType: ProjectType;
47
- /** Infrastructure tools found */
48
- infraTypes: InfraType[];
49
- /** Cloud providers detected from config or Terraform */
50
- cloudProviders: CloudProvider[];
51
- /** Whether the directory is a git repository */
52
- hasGit: boolean;
53
- /** Node.js package manager, if applicable */
54
- packageManager?: 'npm' | 'yarn' | 'pnpm' | 'bun';
55
- /** Test framework name, if detected */
56
- testFramework?: string;
57
- /** Linter name, if detected */
58
- linter?: string;
59
- /** Formatter name, if detected */
60
- formatter?: string;
61
- }
62
-
63
- /** Options accepted by {@link runInit} */
64
- export interface InitOptions {
65
- /** Working directory (defaults to `process.cwd()`) */
66
- cwd?: string;
67
- /** Overwrite an existing NIMBUS.md without prompting */
68
- force?: boolean;
69
- /** Suppress all console output */
70
- quiet?: boolean;
71
- /**
72
- * Merge mode (M2): append a ## Local Overrides section to an existing
73
- * NIMBUS.md and create .nimbus/local.md instead of overwriting the file.
74
- */
75
- merge?: boolean;
76
- }
77
-
78
- /** Value returned by {@link runInit} on success */
79
- export interface InitResult {
80
- /** Full detection results */
81
- detection: ProjectDetection;
82
- /** Absolute paths of files created during init */
83
- filesCreated: string[];
84
- /** Absolute path to the generated NIMBUS.md */
85
- nimbusmdPath: string;
86
- }
87
-
88
- // ---------------------------------------------------------------------------
89
- // Internal helpers
90
- // ---------------------------------------------------------------------------
91
-
92
- /**
93
- * Check whether a file or directory exists at `filePath`.
94
- * Swallows all errors and returns `false` on failure.
95
- */
96
- function exists(filePath: string): boolean {
97
- try {
98
- return fs.existsSync(filePath);
99
- } catch {
100
- return false;
101
- }
102
- }
103
-
104
- /**
105
- * List immediate children of `dir`, returning an empty array when the
106
- * directory does not exist or is unreadable.
107
- */
108
- function listDir(dir: string): string[] {
109
- try {
110
- return fs.readdirSync(dir);
111
- } catch {
112
- return [];
113
- }
114
- }
115
-
116
- /**
117
- * Read a file as UTF-8 text. Returns an empty string on failure.
118
- */
119
- function readText(filePath: string): string {
120
- try {
121
- return fs.readFileSync(filePath, 'utf-8');
122
- } catch {
123
- return '';
124
- }
125
- }
126
-
127
- /**
128
- * Recursively collect file names matching a predicate.
129
- * Searches at most `maxDepth` levels deep and stops after `limit` matches.
130
- */
131
- function findFiles(
132
- dir: string,
133
- predicate: (name: string) => boolean,
134
- maxDepth = 3,
135
- limit = 50
136
- ): string[] {
137
- const results: string[] = [];
138
-
139
- function walk(current: string, depth: number): void {
140
- if (depth > maxDepth || results.length >= limit) {
141
- return;
142
- }
143
-
144
- for (const entry of listDir(current)) {
145
- if (results.length >= limit) {
146
- return;
147
- }
148
-
149
- // Skip heavy directories that would slow detection
150
- if (entry === 'node_modules' || entry === '.git' || entry === 'dist' || entry === 'vendor') {
151
- continue;
152
- }
153
-
154
- const full = path.join(current, entry);
155
-
156
- try {
157
- const stat = fs.statSync(full);
158
- if (stat.isDirectory()) {
159
- walk(full, depth + 1);
160
- } else if (predicate(entry)) {
161
- results.push(full);
162
- }
163
- } catch {
164
- // Permission or broken symlink -- skip
165
- }
166
- }
167
- }
168
-
169
- walk(dir, 0);
170
- return results;
171
- }
172
-
173
- // ---------------------------------------------------------------------------
174
- // Detection functions
175
- // ---------------------------------------------------------------------------
176
-
177
- /**
178
- * Detect the primary project type from marker files in `dir`.
179
- *
180
- * Priority order: TypeScript > JavaScript > Go > Python > Rust > Java > unknown
181
- */
182
- export function detectProjectType(dir: string): ProjectType {
183
- try {
184
- if (exists(path.join(dir, 'tsconfig.json'))) {
185
- return 'typescript';
186
- }
187
- if (exists(path.join(dir, 'package.json'))) {
188
- return 'javascript';
189
- }
190
- if (exists(path.join(dir, 'go.mod'))) {
191
- return 'go';
192
- }
193
- if (
194
- exists(path.join(dir, 'pyproject.toml')) ||
195
- exists(path.join(dir, 'setup.py')) ||
196
- exists(path.join(dir, 'requirements.txt'))
197
- ) {
198
- return 'python';
199
- }
200
- if (exists(path.join(dir, 'Cargo.toml'))) {
201
- return 'rust';
202
- }
203
- if (
204
- exists(path.join(dir, 'pom.xml')) ||
205
- exists(path.join(dir, 'build.gradle')) ||
206
- exists(path.join(dir, 'build.gradle.kts'))
207
- ) {
208
- return 'java';
209
- }
210
- } catch {
211
- // Fall through to unknown
212
- }
213
-
214
- return 'unknown';
215
- }
216
-
217
- /**
218
- * Detect which infrastructure tools are present in `dir`.
219
- *
220
- * Scans for Terraform files, Kubernetes manifests, Helm charts,
221
- * Docker files, and CI/CD configuration.
222
- */
223
- export function detectInfrastructure(dir: string): InfraType[] {
224
- const found: Set<InfraType> = new Set();
225
-
226
- try {
227
- // Terraform -- look for any .tf files
228
- const tfFiles = findFiles(dir, name => name.endsWith('.tf'), 3, 5);
229
- if (tfFiles.length > 0) {
230
- found.add('terraform');
231
- }
232
-
233
- // Kubernetes -- look for YAML files containing common K8s markers
234
- const yamlFiles = findFiles(
235
- dir,
236
- name => name.endsWith('.yaml') || name.endsWith('.yml'),
237
- 3,
238
- 30
239
- );
240
- for (const yamlFile of yamlFiles) {
241
- const content = readText(yamlFile);
242
- if (
243
- content.includes('kind: Deployment') ||
244
- content.includes('kind: Service') ||
245
- content.includes('apiVersion:')
246
- ) {
247
- found.add('kubernetes');
248
- break;
249
- }
250
- }
251
-
252
- // Helm
253
- if (findFiles(dir, name => name === 'Chart.yaml', 3, 1).length > 0) {
254
- found.add('helm');
255
- }
256
-
257
- // Docker
258
- const entries = listDir(dir);
259
- if (
260
- entries.some(
261
- e => e === 'Dockerfile' || e === 'docker-compose.yml' || e === 'docker-compose.yaml'
262
- )
263
- ) {
264
- found.add('docker');
265
- }
266
- // Also check for a docker/ directory with Dockerfiles
267
- if (exists(path.join(dir, 'docker'))) {
268
- const dockerDir = listDir(path.join(dir, 'docker'));
269
- if (
270
- dockerDir.some(e => e.startsWith('Dockerfile') || e.endsWith('.yml') || e.endsWith('.yaml'))
271
- ) {
272
- found.add('docker');
273
- }
274
- }
275
-
276
- // CI/CD
277
- if (
278
- exists(path.join(dir, '.github', 'workflows')) ||
279
- exists(path.join(dir, '.gitlab-ci.yml')) ||
280
- exists(path.join(dir, 'Jenkinsfile')) ||
281
- exists(path.join(dir, '.circleci'))
282
- ) {
283
- found.add('cicd');
284
- }
285
- } catch {
286
- // Return whatever we collected so far
287
- }
288
-
289
- return Array.from(found);
290
- }
291
-
292
- /**
293
- * Detect cloud providers referenced in Terraform files or local credentials.
294
- *
295
- * Checks both `.tf` file contents and well-known credential locations
296
- * or environment variables.
297
- */
298
- export function detectCloudProviders(dir: string): CloudProvider[] {
299
- const found: Set<CloudProvider> = new Set();
300
-
301
- try {
302
- // --- Scan Terraform files for provider blocks ---
303
- const tfFiles = findFiles(dir, name => name.endsWith('.tf'), 3, 20);
304
-
305
- for (const tfFile of tfFiles) {
306
- const content = readText(tfFile);
307
-
308
- if (content.includes('provider "aws"') || content.includes("provider 'aws'")) {
309
- found.add('aws');
310
- }
311
- if (content.includes('provider "google"') || content.includes("provider 'google'")) {
312
- found.add('gcp');
313
- }
314
- if (content.includes('provider "azurerm"') || content.includes("provider 'azurerm'")) {
315
- found.add('azure');
316
- }
317
- }
318
-
319
- // --- Check environment variables ---
320
- if (process.env['AWS_ACCESS_KEY_ID'] || process.env['AWS_PROFILE']) {
321
- found.add('aws');
322
- }
323
- if (process.env['GOOGLE_APPLICATION_CREDENTIALS'] || process.env['GCLOUD_PROJECT']) {
324
- found.add('gcp');
325
- }
326
- if (process.env['AZURE_SUBSCRIPTION_ID'] || process.env['ARM_SUBSCRIPTION_ID']) {
327
- found.add('azure');
328
- }
329
-
330
- // --- Check local credential files ---
331
- const home = process.env['HOME'] ?? process.env['USERPROFILE'] ?? '';
332
- if (home) {
333
- if (
334
- exists(path.join(home, '.aws', 'credentials')) ||
335
- exists(path.join(home, '.aws', 'config'))
336
- ) {
337
- found.add('aws');
338
- }
339
- if (exists(path.join(home, '.config', 'gcloud'))) {
340
- found.add('gcp');
341
- }
342
- if (exists(path.join(home, '.azure'))) {
343
- found.add('azure');
344
- }
345
- }
346
- } catch {
347
- // Return whatever we collected
348
- }
349
-
350
- return Array.from(found);
351
- }
352
-
353
- /** Live infrastructure context gathered by querying actual CLI tools */
354
- export interface InfraContext {
355
- terraformWorkspace?: string;
356
- terraformBackend?: string;
357
- kubectlContext?: string;
358
- kubectlClusters?: string[];
359
- helmReleases?: string[];
360
- awsAccount?: string;
361
- awsRegion?: string;
362
- /** G13: Named AWS profiles from ~/.aws/config (max 10) */
363
- awsProfiles?: Array<{ profile: string; account?: string; region?: string }>;
364
- gcpProject?: string;
365
- /** G16: Number of Kubernetes namespaces in the current cluster */
366
- k8sNamespaceCount?: number;
367
- /** G16: Number of Kubernetes deployments across all namespaces */
368
- k8sDeploymentCount?: number;
369
- /** CI/CD pipeline system detected in the project directory (G9). */
370
- cicdPipeline?: string;
371
- }
372
-
373
- /**
374
- * Discover live infrastructure context by querying CLI tools.
375
- * All queries are best-effort with short timeouts.
376
- */
377
- export async function discoverInfraContext(dir: string): Promise<InfraContext> {
378
- const { execFileSync } = await import('node:child_process');
379
- const ctx: InfraContext = {};
380
-
381
- // Terraform workspace (only if .terraform exists)
382
- if (exists(path.join(dir, '.terraform'))) {
383
- try {
384
- ctx.terraformWorkspace = execFileSync('terraform', ['workspace', 'show'], {
385
- cwd: dir, encoding: 'utf-8', timeout: 5000, stdio: ['pipe', 'pipe', 'pipe'],
386
- }).trim();
387
- } catch { /* ignore */ }
388
- }
389
-
390
- // kubectl context
391
- try {
392
- ctx.kubectlContext = execFileSync('kubectl', ['config', 'current-context'], {
393
- encoding: 'utf-8', timeout: 3000, stdio: ['pipe', 'pipe', 'pipe'],
394
- }).trim();
395
- const clustersOut = execFileSync('kubectl', ['config', 'get-clusters'], {
396
- encoding: 'utf-8', timeout: 3000, stdio: ['pipe', 'pipe', 'pipe'],
397
- });
398
- ctx.kubectlClusters = clustersOut.split('\n').slice(1).map(s => s.trim()).filter(Boolean);
399
- } catch { /* ignore */ }
400
-
401
- // Helm releases
402
- try {
403
- const helmOut = execFileSync('helm', ['list', '-A', '--output=json'], {
404
- encoding: 'utf-8', timeout: 10000, stdio: ['pipe', 'pipe', 'pipe'],
405
- });
406
- const releases = JSON.parse(helmOut || '[]') as Array<{ name: string; namespace: string }>;
407
- ctx.helmReleases = releases.map(r => `${r.name} (${r.namespace})`);
408
- } catch { /* ignore */ }
409
-
410
- // AWS account + region
411
- try {
412
- const awsIdOut = execFileSync('aws', ['sts', 'get-caller-identity', '--output=json'], {
413
- encoding: 'utf-8', timeout: 8000, stdio: ['pipe', 'pipe', 'pipe'],
414
- });
415
- const awsId = JSON.parse(awsIdOut);
416
- ctx.awsAccount = awsId.Account;
417
- } catch { /* ignore */ }
418
-
419
- try {
420
- ctx.awsRegion = execFileSync('aws', ['configure', 'get', 'region'], {
421
- encoding: 'utf-8', timeout: 3000, stdio: ['pipe', 'pipe', 'pipe'],
422
- }).trim() || process.env.AWS_DEFAULT_REGION;
423
- } catch {
424
- ctx.awsRegion = process.env.AWS_DEFAULT_REGION;
425
- }
426
-
427
- // G13: Discover all AWS profiles from ~/.aws/config
428
- try {
429
- const { readFileSync } = await import('node:fs');
430
- const { homedir } = await import('node:os');
431
- const awsConfigPath = path.join(homedir(), '.aws', 'config');
432
- if (exists(awsConfigPath)) {
433
- const awsConfig = readFileSync(awsConfigPath, 'utf-8');
434
- const profiles: Array<{ profile: string; account?: string; region?: string }> = [];
435
- const profileRegex = /^\[(?:profile\s+)?(\S+)\]/gm;
436
- let match;
437
- while ((match = profileRegex.exec(awsConfig)) !== null) {
438
- const profileName = match[1];
439
- if (profileName === 'default') continue; // handled separately
440
- // Extract region from the profile block
441
- const blockStart = match.index + match[0].length;
442
- const nextBlock = awsConfig.indexOf('\n[', blockStart);
443
- const block = awsConfig.slice(blockStart, nextBlock === -1 ? undefined : nextBlock);
444
- const regionMatch = block.match(/^\s*region\s*=\s*(.+)$/m);
445
- profiles.push({ profile: profileName, region: regionMatch?.[1]?.trim() });
446
- }
447
- if (profiles.length > 0) ctx.awsProfiles = profiles.slice(0, 10); // max 10 profiles
448
- }
449
- } catch { /* ignore */ }
450
-
451
- // GCP project
452
- try {
453
- const proj = execFileSync('gcloud', ['config', 'get-value', 'project'], {
454
- encoding: 'utf-8', timeout: 3000, stdio: ['pipe', 'pipe', 'pipe'],
455
- }).trim();
456
- if (proj && proj !== '(unset)') ctx.gcpProject = proj;
457
- } catch { /* ignore */ }
458
-
459
- // G16: Count K8s namespaces and deployments
460
- if (ctx.kubectlContext) {
461
- try {
462
- const nsOut = execFileSync('kubectl', ['get', 'namespaces', '--no-headers'], {
463
- encoding: 'utf-8', timeout: 3000, stdio: ['pipe', 'pipe', 'pipe'],
464
- });
465
- const nsCount = nsOut.trim().split('\n').filter(Boolean).length;
466
- ctx.k8sNamespaceCount = nsCount;
467
- } catch { /* ignore */ }
468
- try {
469
- const deplOut = execFileSync('kubectl', ['get', 'deployments', '-A', '--no-headers'], {
470
- encoding: 'utf-8', timeout: 3000, stdio: ['pipe', 'pipe', 'pipe'],
471
- });
472
- const deplCount = deplOut.trim().split('\n').filter(Boolean).length;
473
- ctx.k8sDeploymentCount = deplCount;
474
- } catch { /* ignore */ }
475
- }
476
-
477
- // CI/CD pipeline detection (G9)
478
- const cicdFiles: Array<[string, string]> = [
479
- ['.github/workflows', 'GitHub Actions'],
480
- ['.gitlab-ci.yml', 'GitLab CI'],
481
- ['.circleci', 'CircleCI'],
482
- ['Jenkinsfile', 'Jenkins'],
483
- ['.buildkite', 'Buildkite'],
484
- ['azure-pipelines.yml', 'Azure Pipelines'],
485
- ];
486
- for (const [file, name] of cicdFiles) {
487
- if (exists(path.join(dir, file))) {
488
- ctx.cicdPipeline = name;
489
- break;
490
- }
491
- }
492
-
493
- return ctx;
494
- }
495
-
496
- /**
497
- * Format an InfraContext into a compact single-line summary for injection
498
- * into agent messages (Gaps 7 & 10).
499
- */
500
- export function formatInfraContext(ctx: InfraContext): string {
501
- const parts: string[] = [];
502
- if (ctx.terraformWorkspace) parts.push(`tf-workspace: ${ctx.terraformWorkspace}`);
503
- if (ctx.kubectlContext) parts.push(`k8s-context: ${ctx.kubectlContext}`);
504
- if (ctx.helmReleases && ctx.helmReleases.length > 0) {
505
- parts.push(`helm-releases: ${ctx.helmReleases.slice(0, 3).join(', ')}${ctx.helmReleases.length > 3 ? ` +${ctx.helmReleases.length - 3} more` : ''}`);
506
- }
507
- if (ctx.awsAccount) parts.push(`aws-account: ${ctx.awsAccount}`);
508
- if (ctx.awsRegion) parts.push(`aws-region: ${ctx.awsRegion}`);
509
- if (ctx.gcpProject) parts.push(`gcp-project: ${ctx.gcpProject}`);
510
- if (ctx.cicdPipeline) parts.push(`cicd: ${ctx.cicdPipeline}`);
511
- return parts.length > 0 ? parts.join(' | ') : 'no infra context detected';
512
- }
513
-
514
- /**
515
- * Detect which Node.js package manager is used in `dir`.
516
- *
517
- * Lock-file priority: bun > yarn > pnpm > npm.
518
- * Returns `undefined` when no lock file is found.
519
- */
520
- export function detectPackageManager(dir: string): 'npm' | 'yarn' | 'pnpm' | 'bun' | undefined {
521
- try {
522
- if (exists(path.join(dir, 'bun.lock')) || exists(path.join(dir, 'bun.lockb'))) {
523
- return 'bun';
524
- }
525
- if (exists(path.join(dir, 'yarn.lock'))) {
526
- return 'yarn';
527
- }
528
- if (exists(path.join(dir, 'pnpm-lock.yaml'))) {
529
- return 'pnpm';
530
- }
531
- if (exists(path.join(dir, 'package-lock.json'))) {
532
- return 'npm';
533
- }
534
- } catch {
535
- // fall through
536
- }
537
- return undefined;
538
- }
539
-
540
- /**
541
- * Detect the test framework from `package.json` dependencies or
542
- * lock-file presence.
543
- *
544
- * Returns the framework name as a human-readable string, or `undefined`
545
- * if none is detected.
546
- */
547
- export function detectTestFramework(dir: string): string | undefined {
548
- try {
549
- const pkgPath = path.join(dir, 'package.json');
550
- if (!exists(pkgPath)) {
551
- return undefined;
552
- }
553
-
554
- const pkg = JSON.parse(readText(pkgPath)) as Record<string, unknown>;
555
- const allDeps = {
556
- ...(pkg['dependencies'] as Record<string, string> | undefined),
557
- ...(pkg['devDependencies'] as Record<string, string> | undefined),
558
- };
559
-
560
- if ('vitest' in allDeps) {
561
- return 'vitest';
562
- }
563
- if ('jest' in allDeps) {
564
- return 'jest';
565
- }
566
- if ('mocha' in allDeps) {
567
- return 'mocha';
568
- }
569
- if ('@playwright/test' in allDeps) {
570
- return 'playwright';
571
- }
572
-
573
- // Bun ships its own test runner -- detect via lock file
574
- if (exists(path.join(dir, 'bun.lock')) || exists(path.join(dir, 'bun.lockb'))) {
575
- return 'bun:test';
576
- }
577
- } catch {
578
- // fall through
579
- }
580
-
581
- // Non-JS projects
582
- if (exists(path.join(dir, 'go.mod'))) {
583
- return 'go test';
584
- }
585
- if (exists(path.join(dir, 'Cargo.toml'))) {
586
- return 'cargo test';
587
- }
588
- if (exists(path.join(dir, 'pyproject.toml')) || exists(path.join(dir, 'setup.py'))) {
589
- const pyproject = readText(path.join(dir, 'pyproject.toml'));
590
- if (pyproject.includes('pytest')) {
591
- return 'pytest';
592
- }
593
- if (exists(path.join(dir, 'pytest.ini')) || exists(path.join(dir, 'setup.cfg'))) {
594
- return 'pytest';
595
- }
596
- return 'unittest';
597
- }
598
-
599
- return undefined;
600
- }
601
-
602
- /**
603
- * Detect the linter used in the project.
604
- *
605
- * Checks for ESLint, Biome, golangci-lint, Ruff, and Clippy configuration.
606
- */
607
- export function detectLinter(dir: string): string | undefined {
608
- try {
609
- const entries = listDir(dir);
610
-
611
- // ESLint (various config formats)
612
- if (entries.some(e => e.startsWith('.eslintrc') || e.startsWith('eslint.config'))) {
613
- return 'eslint';
614
- }
615
-
616
- // Biome
617
- if (entries.includes('biome.json') || entries.includes('biome.jsonc')) {
618
- return 'biome';
619
- }
620
-
621
- // Go -- golangci-lint
622
- if (entries.includes('.golangci.yml') || entries.includes('.golangci.yaml')) {
623
- return 'golangci-lint';
624
- }
625
-
626
- // Python -- ruff
627
- if (entries.includes('ruff.toml') || entries.includes('.ruff.toml')) {
628
- return 'ruff';
629
- }
630
-
631
- // Check pyproject.toml for ruff or flake8
632
- if (exists(path.join(dir, 'pyproject.toml'))) {
633
- const pyproject = readText(path.join(dir, 'pyproject.toml'));
634
- if (pyproject.includes('[tool.ruff]')) {
635
- return 'ruff';
636
- }
637
- if (pyproject.includes('[tool.flake8]')) {
638
- return 'flake8';
639
- }
640
- }
641
-
642
- // Rust -- clippy is part of the toolchain, detect via Cargo.toml
643
- if (exists(path.join(dir, 'Cargo.toml'))) {
644
- return 'clippy';
645
- }
646
- } catch {
647
- // fall through
648
- }
649
- return undefined;
650
- }
651
-
652
- /**
653
- * Detect the code formatter used in the project.
654
- *
655
- * Checks for Prettier, Biome, gofmt, rustfmt, and Black configuration.
656
- */
657
- export function detectFormatter(dir: string): string | undefined {
658
- try {
659
- const entries = listDir(dir);
660
-
661
- // Prettier
662
- if (entries.some(e => e.startsWith('.prettierrc') || e.startsWith('prettier.config'))) {
663
- return 'prettier';
664
- }
665
-
666
- // Biome doubles as formatter
667
- if (entries.includes('biome.json') || entries.includes('biome.jsonc')) {
668
- return 'biome';
669
- }
670
-
671
- // Go -- gofmt is built-in
672
- if (exists(path.join(dir, 'go.mod'))) {
673
- return 'gofmt';
674
- }
675
-
676
- // Rust -- rustfmt
677
- if (exists(path.join(dir, 'rustfmt.toml')) || exists(path.join(dir, '.rustfmt.toml'))) {
678
- return 'rustfmt';
679
- }
680
- if (exists(path.join(dir, 'Cargo.toml'))) {
681
- return 'rustfmt';
682
- }
683
-
684
- // Python -- black / ruff format
685
- if (exists(path.join(dir, 'pyproject.toml'))) {
686
- const pyproject = readText(path.join(dir, 'pyproject.toml'));
687
- if (pyproject.includes('[tool.black]')) {
688
- return 'black';
689
- }
690
- if (pyproject.includes('[tool.ruff]')) {
691
- return 'ruff';
692
- }
693
- }
694
- } catch {
695
- // fall through
696
- }
697
- return undefined;
698
- }
699
-
700
- /**
701
- * Run the full project detection pipeline on `dir`.
702
- *
703
- * Aggregates results from all individual detection functions into a
704
- * single {@link ProjectDetection} object.
705
- */
706
- export function detectProject(dir: string): ProjectDetection {
707
- const resolvedDir = path.resolve(dir);
708
-
709
- return {
710
- projectName: path.basename(resolvedDir),
711
- projectType: detectProjectType(resolvedDir),
712
- infraTypes: detectInfrastructure(resolvedDir),
713
- cloudProviders: detectCloudProviders(resolvedDir),
714
- hasGit: exists(path.join(resolvedDir, '.git')),
715
- packageManager: detectPackageManager(resolvedDir),
716
- testFramework: detectTestFramework(resolvedDir),
717
- linter: detectLinter(resolvedDir),
718
- formatter: detectFormatter(resolvedDir),
719
- };
720
- }
721
-
722
- // ---------------------------------------------------------------------------
723
- // Generation
724
- // ---------------------------------------------------------------------------
725
-
726
- /**
727
- * Produce the contents of a `NIMBUS.md` file from detection results.
728
- *
729
- * The generated markdown serves as both human-readable documentation
730
- * and machine-readable project metadata for the Nimbus agent.
731
- */
732
- export function generateNimbusMd(detection: ProjectDetection, _dir: string, infraCtx?: InfraContext): string {
733
- const lines: string[] = [];
734
-
735
- // --- Header ---
736
- lines.push(`# ${detection.projectName}`);
737
- lines.push('');
738
- lines.push('> Auto-generated by `nimbus init`. Edit freely to refine agent behaviour.');
739
- lines.push('');
740
-
741
- // --- Project Overview ---
742
- lines.push('## Project Overview');
743
- lines.push('');
744
- lines.push(`- **Type:** ${detection.projectType}`);
745
- if (detection.packageManager) {
746
- lines.push(`- **Package Manager:** ${detection.packageManager}`);
747
- }
748
- if (detection.testFramework) {
749
- lines.push(`- **Test Framework:** ${detection.testFramework}`);
750
- }
751
- if (detection.hasGit) {
752
- lines.push('- **Version Control:** git');
753
- }
754
- lines.push('');
755
-
756
- // --- Infrastructure ---
757
- if (detection.infraTypes.length > 0 || detection.cloudProviders.length > 0) {
758
- lines.push('## Infrastructure');
759
- lines.push('');
760
- if (detection.infraTypes.length > 0) {
761
- lines.push(`- **Tools:** ${detection.infraTypes.join(', ')}`);
762
- }
763
- if (detection.cloudProviders.length > 0) {
764
- lines.push(`- **Cloud Providers:** ${detection.cloudProviders.join(', ')}`);
765
- }
766
- if (infraCtx) {
767
- if (infraCtx.terraformWorkspace) {
768
- lines.push(`- **Terraform Workspace:** ${infraCtx.terraformWorkspace}`);
769
- }
770
- if (infraCtx.kubectlContext) {
771
- lines.push(`- **Kubernetes Context:** ${infraCtx.kubectlContext}`);
772
- }
773
- if (infraCtx.kubectlClusters && infraCtx.kubectlClusters.length > 0) {
774
- lines.push(`- **Kubernetes Clusters:** ${infraCtx.kubectlClusters.join(', ')}`);
775
- }
776
- if (infraCtx.helmReleases && infraCtx.helmReleases.length > 0) {
777
- lines.push(`- **Helm Releases:** ${infraCtx.helmReleases.slice(0, 5).join(', ')}${infraCtx.helmReleases.length > 5 ? ` (+${infraCtx.helmReleases.length - 5} more)` : ''}`);
778
- }
779
- if (infraCtx.awsAccount) {
780
- lines.push(`- **AWS Account:** ${infraCtx.awsAccount}${infraCtx.awsRegion ? ` (${infraCtx.awsRegion})` : ''}`);
781
- }
782
- // G13: List named AWS profiles
783
- if (infraCtx.awsProfiles && infraCtx.awsProfiles.length > 0) {
784
- lines.push(`- **AWS Profiles:** ${infraCtx.awsProfiles.map(p => p.profile).join(', ')}`);
785
- }
786
- if (infraCtx.gcpProject) {
787
- lines.push(`- **GCP Project:** ${infraCtx.gcpProject}`);
788
- }
789
- // G16: K8s namespace and deployment counts
790
- if (infraCtx.k8sNamespaceCount !== undefined) {
791
- lines.push(`- **K8s Namespaces:** ${infraCtx.k8sNamespaceCount}`);
792
- }
793
- if (infraCtx.k8sDeploymentCount !== undefined) {
794
- lines.push(`- **K8s Deployments:** ${infraCtx.k8sDeploymentCount}`);
795
- }
796
- // G9: CI/CD pipeline
797
- if (infraCtx.cicdPipeline) {
798
- lines.push(`- **CI/CD:** ${infraCtx.cicdPipeline}`);
799
- }
800
- }
801
- lines.push('');
802
- }
803
-
804
- // --- CI/CD (M4) ---
805
- if (infraCtx?.cicdPipeline) {
806
- lines.push('## CI/CD');
807
- lines.push('');
808
- const pipelineDir: Record<string, string> = {
809
- 'GitHub Actions': '.github/workflows/',
810
- 'GitLab CI': '.gitlab-ci.yml',
811
- 'CircleCI': '.circleci/',
812
- 'Jenkins': 'Jenkinsfile',
813
- };
814
- const pipelinePath = pipelineDir[infraCtx.cicdPipeline] ?? '';
815
- lines.push(`Pipeline: ${infraCtx.cicdPipeline}${pipelinePath ? ` (${pipelinePath})` : ''}`);
816
- lines.push('Convention: Always run `terraform plan` in CI before apply. Apply only on main branch merge.');
817
- lines.push('');
818
- }
819
-
820
- // --- Conventions ---
821
- if (detection.linter || detection.formatter) {
822
- lines.push('## Conventions');
823
- lines.push('');
824
- if (detection.linter) {
825
- lines.push(`- **Linter:** ${detection.linter}`);
826
- }
827
- if (detection.formatter) {
828
- lines.push(`- **Formatter:** ${detection.formatter}`);
829
- }
830
- lines.push('');
831
- }
832
-
833
- // --- Environments (GAP-22) ---
834
- lines.push('## Environments');
835
- lines.push('');
836
- lines.push('| Name | Terraform Workspace | Kubernetes Context | Protected |');
837
- lines.push('|------|--------------------|--------------------|-----------|');
838
- lines.push('| dev | dev | | false |');
839
- lines.push('| staging | staging | | false |');
840
- lines.push('| prod | prod | | true |');
841
- lines.push('');
842
-
843
- // --- Safety Rules ---
844
- lines.push('## Safety Rules');
845
- lines.push('');
846
- lines.push('- Protected branches: `main`, `master`');
847
- lines.push('- Protected Kubernetes namespaces: `production`, `kube-system`');
848
- lines.push('- Always preview before `terraform apply`');
849
- lines.push('- Run tests before committing');
850
- lines.push('- Never store secrets in source control');
851
- lines.push('');
852
-
853
- // --- Guardrails (G5): DevOps-specific rules when infra is detected ---
854
- const hasInfra = detection.infraTypes.length > 0 || detection.cloudProviders.length > 0;
855
- if (hasInfra) {
856
- lines.push('## Guardrails');
857
- lines.push('');
858
- lines.push('- Never run `terraform destroy` without explicit confirmation');
859
- lines.push('- Protected Kubernetes namespaces: `production`, `kube-system`, `monitoring`');
860
- lines.push('- Always show terraform plan before apply');
861
- lines.push('- Confirm target cloud account and region before resource creation');
862
- lines.push('- Protected environments: any workspace/namespace containing `prod`, `prd`, `production`');
863
- lines.push('');
864
- }
865
-
866
- // --- Forbidden placeholder (G5) ---
867
- lines.push('## Forbidden');
868
- lines.push('');
869
- lines.push('<!-- List operations Nimbus must never perform in this project -->');
870
- lines.push('<!-- Example: - Never destroy the production database -->');
871
- lines.push('');
872
-
873
- // --- Custom Instructions ---
874
- lines.push('## Custom Instructions');
875
- lines.push('');
876
- lines.push('<!-- Add project-specific instructions for the Nimbus agent here -->');
877
- lines.push('');
878
-
879
- // --- G18: Runbooks ---
880
- const runbookDirs = ['docs/runbooks', 'runbooks', '.github/runbooks', '.nimbus/runbooks'];
881
- const foundRunbooks: string[] = [];
882
- for (const dir of runbookDirs) {
883
- const fullPath = path.join(_dir, dir);
884
- if (fs.existsSync(fullPath)) {
885
- try {
886
- const files = fs.readdirSync(fullPath).filter(f => /\.(md|yaml|yml)$/.test(f));
887
- foundRunbooks.push(...files.map(f => `- ${dir}/${f}`));
888
- } catch { /* non-critical */ }
889
- }
890
- }
891
- const runbookSection = foundRunbooks.length > 0
892
- ? foundRunbooks.join('\n') + '\n\nRefer to these runbooks for incident response and operational procedures.'
893
- : '<!-- Add runbook references, e.g.:\n- docs/runbooks/cert-rotation.md -->';
894
- lines.push('## Runbooks');
895
- lines.push('');
896
- lines.push(runbookSection);
897
- lines.push('');
898
-
899
- return lines.join('\n');
900
- }
901
-
902
- /**
903
- * Generate the contents of `.nimbus/config.yaml`.
904
- *
905
- * Produces a valid YAML string without requiring an external YAML library.
906
- */
907
- function generateConfigYaml(detection: ProjectDetection): string {
908
- const lines: string[] = [];
909
-
910
- lines.push('# Nimbus project configuration');
911
- lines.push('# See https://nimbus.dev/docs/config for all options');
912
- lines.push('');
913
- lines.push('# Default LLM model for agent interactions');
914
- lines.push('default_model: anthropic/claude-sonnet-4');
915
- lines.push('');
916
- lines.push('# Default agent mode: build | plan | debug | review');
917
- lines.push('default_mode: build');
918
- lines.push('');
919
- lines.push('# Project metadata');
920
- lines.push('project:');
921
- lines.push(` name: ${detection.projectName}`);
922
- lines.push(` type: ${detection.projectType}`);
923
- if (detection.packageManager) {
924
- lines.push(` package_manager: ${detection.packageManager}`);
925
- }
926
- lines.push('');
927
-
928
- // Permissions
929
- lines.push('# Permission rules control what the agent can do without asking');
930
- lines.push('permissions:');
931
- lines.push(' # File operations');
932
- lines.push(' file_read: allow');
933
- lines.push(' file_write: ask');
934
- lines.push(' file_delete: deny');
935
- lines.push('');
936
- lines.push(' # Shell commands');
937
- lines.push(' shell_read: allow # non-destructive commands (ls, cat, git status)');
938
- lines.push(' shell_write: ask # potentially destructive commands');
939
- lines.push('');
940
- lines.push(' # Git operations');
941
- lines.push(' git_read: allow');
942
- lines.push(' git_write: ask');
943
- lines.push('');
944
- lines.push(' # Infrastructure operations');
945
- lines.push(' terraform_plan: allow');
946
- lines.push(' terraform_apply: deny');
947
- lines.push(' kubectl_read: allow');
948
- lines.push(' kubectl_write: deny');
949
- lines.push('');
950
-
951
- // Safety
952
- lines.push('# Safety settings');
953
- lines.push('safety:');
954
- lines.push(' protected_branches:');
955
- lines.push(' - main');
956
- lines.push(' - master');
957
- lines.push(' protected_k8s_namespaces:');
958
- lines.push(' - production');
959
- lines.push(' - kube-system');
960
- lines.push(' require_plan_before_apply: true');
961
- lines.push(' require_tests_before_commit: true');
962
- lines.push('');
963
-
964
- return lines.join('\n');
965
- }
966
-
967
- // ---------------------------------------------------------------------------
968
- // Main init
969
- // ---------------------------------------------------------------------------
970
-
971
- /**
972
- * Initialize a Nimbus project in the given directory.
973
- *
974
- * Creates the `.nimbus/` directory structure and a `NIMBUS.md` file
975
- * populated with auto-detected project metadata.
976
- *
977
- * @param options - Configuration for the init process
978
- * @returns The detection results and list of created files
979
- *
980
- * @example
981
- * ```ts
982
- * const result = await runInit({ cwd: '/path/to/project' });
983
- * console.log(result.detection.projectType); // 'typescript'
984
- * console.log(result.filesCreated); // ['.nimbus/config.yaml', ...]
985
- * ```
986
- */
987
- export async function runInit(options?: InitOptions): Promise<InitResult> {
988
- const dir = path.resolve(options?.cwd ?? process.cwd());
989
- const force = options?.force ?? false;
990
- const quiet = options?.quiet ?? false;
991
- const merge = options?.merge ?? false;
992
-
993
- const log = (msg: string): void => {
994
- if (!quiet) {
995
- console.log(msg);
996
- }
997
- };
998
-
999
- // ---- M2: --merge mode — append Local Overrides section, don't overwrite ----
1000
- const nimbusmdPathEarly = path.join(dir, 'NIMBUS.md');
1001
- if (merge && exists(nimbusmdPathEarly)) {
1002
- const content = fs.readFileSync(nimbusmdPathEarly, 'utf-8');
1003
- const filesCreated: string[] = [];
1004
-
1005
- if (!content.includes('## Local Overrides')) {
1006
- fs.appendFileSync(nimbusmdPathEarly, '\n\n## Local Overrides\n\n<!-- Personal additions -->\n', 'utf-8');
1007
- log(' Appended ## Local Overrides section to NIMBUS.md');
1008
- } else {
1009
- log(' NIMBUS.md already has a ## Local Overrides section');
1010
- }
1011
-
1012
- const localMdPath = path.join(dir, '.nimbus', 'local.md');
1013
- if (!exists(localMdPath)) {
1014
- fs.mkdirSync(path.join(dir, '.nimbus'), { recursive: true });
1015
- fs.writeFileSync(localMdPath, '# Local Overrides\n\n<!-- Personal notes and overrides that are not committed -->\n', 'utf-8');
1016
- log(' Created .nimbus/local.md for personal overrides');
1017
- filesCreated.push(localMdPath);
1018
- }
1019
-
1020
- const detection = detectProject(dir);
1021
- return { detection, filesCreated, nimbusmdPath: nimbusmdPathEarly };
1022
- }
1023
-
1024
- // ---- Step 1: Detect project characteristics ----
1025
- log('Detecting project...');
1026
- const detection = detectProject(dir);
1027
-
1028
- log(` Project type: ${detection.projectType}`);
1029
- if (detection.packageManager) {
1030
- log(` Package manager: ${detection.packageManager}`);
1031
- }
1032
- if (detection.infraTypes.length > 0) {
1033
- log(` Infrastructure: ${detection.infraTypes.join(', ')}`);
1034
- }
1035
- if (detection.cloudProviders.length > 0) {
1036
- log(` Cloud providers: ${detection.cloudProviders.join(', ')}`);
1037
- }
1038
- if (detection.testFramework) {
1039
- log(` Test framework: ${detection.testFramework}`);
1040
- }
1041
-
1042
- // ---- Step 2: Check for existing NIMBUS.md and show diff (L8) ----
1043
- const nimbusmdPath = path.join(dir, 'NIMBUS.md');
1044
- if (exists(nimbusmdPath) && !force && !quiet) {
1045
- // Generate the new content first for diffing
1046
- const infraCtxForDiff = await discoverInfraContext(dir).catch(() => undefined);
1047
- const newContent = generateNimbusMd(detection, dir, infraCtxForDiff);
1048
- const existingContent = readText(nimbusmdPath);
1049
-
1050
- if (newContent === existingContent) {
1051
- log('NIMBUS.md is already up to date.');
1052
- return { detection, filesCreated: [], nimbusmdPath };
1053
- }
1054
-
1055
- // Show line-level diff
1056
- const oldLines = existingContent.split('\n');
1057
- const newLines = newContent.split('\n');
1058
- const diffLines: string[] = [];
1059
- const maxLen = Math.max(oldLines.length, newLines.length);
1060
- for (let idx = 0; idx < maxLen; idx++) {
1061
- const o = oldLines[idx];
1062
- const n = newLines[idx];
1063
- if (o === undefined) diffLines.push(`+ ${n}`);
1064
- else if (n === undefined) diffLines.push(`- ${o}`);
1065
- else if (o !== n) { diffLines.push(`- ${o}`); diffLines.push(`+ ${n}`); }
1066
- }
1067
-
1068
- if (diffLines.length > 0) {
1069
- log('\nNIMBUS.md changes:');
1070
- for (const dl of diffLines.slice(0, 50)) {
1071
- if (dl.startsWith('+')) log(` \x1b[32m${dl}\x1b[0m`);
1072
- else if (dl.startsWith('-')) log(` \x1b[31m${dl}\x1b[0m`);
1073
- else log(` ${dl}`);
1074
- }
1075
- if (diffLines.length > 50) log(` ... and ${diffLines.length - 50} more changes`);
1076
- log('');
1077
- log('Apply these changes? [y/N]');
1078
-
1079
- // Synchronous readline for non-quiet mode
1080
- const answer = await new Promise<string>(resolve => {
1081
- const { createInterface } = require('readline') as typeof import('readline');
1082
- const rl = createInterface({ input: process.stdin, output: process.stdout });
1083
- rl.question('', (ans: string) => { rl.close(); resolve(ans.trim()); });
1084
- });
1085
-
1086
- if (answer.toLowerCase() !== 'y') {
1087
- log('Aborted — NIMBUS.md not changed.');
1088
- return { detection, filesCreated: [], nimbusmdPath };
1089
- }
1090
-
1091
- fs.writeFileSync(nimbusmdPath, newContent, 'utf-8');
1092
- log(' Updated NIMBUS.md');
1093
- return { detection, filesCreated: [nimbusmdPath], nimbusmdPath };
1094
- }
1095
- } else if (exists(nimbusmdPath) && !force) {
1096
- // quiet mode — skip without prompting
1097
- return { detection, filesCreated: [], nimbusmdPath };
1098
- }
1099
-
1100
- // ---- Step 3: Create .nimbus/ directory structure ----
1101
- const filesCreated: string[] = [];
1102
- const nimbusDirPath = path.join(dir, '.nimbus');
1103
- const hooksDirPath = path.join(nimbusDirPath, 'hooks');
1104
- const agentsDirPath = path.join(nimbusDirPath, 'agents');
1105
-
1106
- if (!exists(nimbusDirPath)) {
1107
- fs.mkdirSync(nimbusDirPath, { recursive: true });
1108
- }
1109
- if (!exists(hooksDirPath)) {
1110
- fs.mkdirSync(hooksDirPath, { recursive: true });
1111
- }
1112
- if (!exists(agentsDirPath)) {
1113
- fs.mkdirSync(agentsDirPath, { recursive: true });
1114
- }
1115
-
1116
- // ---- Step 4: Create .nimbus/config.yaml ----
1117
- const configPath = path.join(nimbusDirPath, 'config.yaml');
1118
- if (!exists(configPath) || force) {
1119
- const configContent = generateConfigYaml(detection);
1120
- fs.writeFileSync(configPath, configContent, 'utf-8');
1121
- filesCreated.push(configPath);
1122
- log(' Created .nimbus/config.yaml');
1123
- }
1124
-
1125
- // ---- Step 5: Create placeholder hook files ----
1126
- const preCommitHookPath = path.join(hooksDirPath, 'pre-commit.ts');
1127
- if (!exists(preCommitHookPath) || force) {
1128
- const preCommitContent = [
1129
- '/**',
1130
- ' * Nimbus pre-commit hook',
1131
- ' *',
1132
- ' * Runs automatically before each commit when enabled.',
1133
- ' * Add custom validation logic here.',
1134
- ' */',
1135
- '',
1136
- 'export default async function preCommit(): Promise<void> {',
1137
- ' // Example: ensure tests pass before committing',
1138
- ' // await $`bun test`;',
1139
- '}',
1140
- '',
1141
- ].join('\n');
1142
- fs.writeFileSync(preCommitHookPath, preCommitContent, 'utf-8');
1143
- filesCreated.push(preCommitHookPath);
1144
- log(' Created .nimbus/hooks/pre-commit.ts');
1145
- }
1146
-
1147
- // ---- Step 6: Create placeholder agent config ----
1148
- const defaultAgentPath = path.join(agentsDirPath, 'default.yaml');
1149
- if (!exists(defaultAgentPath) || force) {
1150
- const agentContent = [
1151
- '# Default agent profile',
1152
- '# Customize the system prompt and tool access for this agent',
1153
- '',
1154
- 'name: default',
1155
- 'description: General-purpose Nimbus agent',
1156
- '',
1157
- 'tools:',
1158
- ' - file_read',
1159
- ' - file_write',
1160
- ' - shell',
1161
- ' - git',
1162
- '',
1163
- 'system_prompt: |',
1164
- ` You are working on the ${detection.projectName} project.`,
1165
- ` It is a ${detection.projectType} project.`,
1166
- ' Follow the safety rules in NIMBUS.md.',
1167
- '',
1168
- ].join('\n');
1169
- fs.writeFileSync(defaultAgentPath, agentContent, 'utf-8');
1170
- filesCreated.push(defaultAgentPath);
1171
- log(' Created .nimbus/agents/default.yaml');
1172
- }
1173
-
1174
- // ---- Step 7: Generate and write NIMBUS.md ----
1175
- // L8: Monorepo detection — scan immediate subdirs for terraform roots
1176
- let monorepoSection = '';
1177
- try {
1178
- const subdirs = fs.readdirSync(dir, { withFileTypes: true })
1179
- .filter(e => e.isDirectory() && !e.name.startsWith('.') && !['node_modules', '.git'].includes(e.name))
1180
- .map(e => e.name);
1181
- const tfRoots: string[] = [];
1182
- for (const sub of subdirs.slice(0, 20)) {
1183
- const subPath = path.join(dir, sub);
1184
- const hasTf = fs.readdirSync(subPath).some(f => f.endsWith('.tf'));
1185
- if (hasTf) tfRoots.push(sub);
1186
- }
1187
- if (tfRoots.length > 1) {
1188
- monorepoSection = `\n## Terraform Modules (Monorepo)\n\nThis is a monorepo with multiple Terraform roots:\n${tfRoots.map(r => `- \`./${r}/\``).join('\n')}\n\nTo target a specific root, \`cd\` into the directory or specify the path.\n`;
1189
- log(` Detected ${tfRoots.length} Terraform roots (monorepo)`);
1190
- }
1191
- } catch { /* non-critical */ }
1192
-
1193
- const nimbusmdContent = generateNimbusMd(detection, dir) + monorepoSection;
1194
- fs.writeFileSync(nimbusmdPath, nimbusmdContent, 'utf-8');
1195
- filesCreated.push(nimbusmdPath);
1196
- log(' Created NIMBUS.md');
1197
-
1198
- // ---- Step 8: Append .nimbus/ to .gitignore if not already present ----
1199
- const gitignorePath = path.join(dir, '.gitignore');
1200
- if (exists(gitignorePath)) {
1201
- const gitignore = readText(gitignorePath);
1202
- if (!gitignore.includes('.nimbus/')) {
1203
- fs.appendFileSync(gitignorePath, '\n# Nimbus local config\n.nimbus/\n', 'utf-8');
1204
- log(' Updated .gitignore');
1205
- }
1206
- }
1207
-
1208
- log('');
1209
- log('Nimbus project initialized successfully.');
1210
- log('Edit NIMBUS.md to customise agent behaviour.');
1211
-
1212
- // M5: Print next steps after generating NIMBUS.md
1213
- if (!quiet) {
1214
- log('');
1215
- log('\x1b[36mNext steps:\x1b[0m');
1216
- log(' nimbus plan Preview infrastructure changes');
1217
- log(' nimbus doctor Check your DevOps toolchain');
1218
- log(' nimbus status Live infrastructure health dashboard');
1219
- log(' nimbus Open the interactive DevOps agent');
1220
- }
1221
-
1222
- return {
1223
- detection,
1224
- filesCreated,
1225
- nimbusmdPath,
1226
- };
1227
- }