@build-astron-co/nimbus 0.2.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 (313) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +628 -0
  3. package/bin/nimbus +38 -0
  4. package/package.json +80 -0
  5. package/src/__tests__/app.test.ts +76 -0
  6. package/src/__tests__/audit.test.ts +877 -0
  7. package/src/__tests__/circuit-breaker.test.ts +116 -0
  8. package/src/__tests__/cli-run.test.ts +115 -0
  9. package/src/__tests__/context-manager.test.ts +502 -0
  10. package/src/__tests__/context.test.ts +242 -0
  11. package/src/__tests__/enterprise.test.ts +401 -0
  12. package/src/__tests__/generator.test.ts +433 -0
  13. package/src/__tests__/hooks.test.ts +582 -0
  14. package/src/__tests__/init.test.ts +436 -0
  15. package/src/__tests__/intent-parser.test.ts +229 -0
  16. package/src/__tests__/llm-router.test.ts +209 -0
  17. package/src/__tests__/lsp.test.ts +293 -0
  18. package/src/__tests__/modes.test.ts +336 -0
  19. package/src/__tests__/permissions.test.ts +338 -0
  20. package/src/__tests__/serve.test.ts +275 -0
  21. package/src/__tests__/sessions.test.ts +227 -0
  22. package/src/__tests__/sharing.test.ts +288 -0
  23. package/src/__tests__/snapshots.test.ts +581 -0
  24. package/src/__tests__/state-db.test.ts +334 -0
  25. package/src/__tests__/stream-with-tools.test.ts +732 -0
  26. package/src/__tests__/subagents.test.ts +176 -0
  27. package/src/__tests__/system-prompt.test.ts +169 -0
  28. package/src/__tests__/tool-converter.test.ts +256 -0
  29. package/src/__tests__/tool-schemas.test.ts +397 -0
  30. package/src/__tests__/tools.test.ts +143 -0
  31. package/src/__tests__/version.test.ts +49 -0
  32. package/src/agent/compaction-agent.ts +227 -0
  33. package/src/agent/context-manager.ts +435 -0
  34. package/src/agent/context.ts +427 -0
  35. package/src/agent/deploy-preview.ts +426 -0
  36. package/src/agent/index.ts +68 -0
  37. package/src/agent/loop.ts +717 -0
  38. package/src/agent/modes.ts +429 -0
  39. package/src/agent/permissions.ts +466 -0
  40. package/src/agent/subagents/base.ts +116 -0
  41. package/src/agent/subagents/cost.ts +51 -0
  42. package/src/agent/subagents/explore.ts +42 -0
  43. package/src/agent/subagents/general.ts +54 -0
  44. package/src/agent/subagents/index.ts +102 -0
  45. package/src/agent/subagents/infra.ts +59 -0
  46. package/src/agent/subagents/security.ts +69 -0
  47. package/src/agent/system-prompt.ts +436 -0
  48. package/src/app.ts +122 -0
  49. package/src/audit/activity-log.ts +290 -0
  50. package/src/audit/compliance-checker.ts +540 -0
  51. package/src/audit/cost-tracker.ts +318 -0
  52. package/src/audit/index.ts +23 -0
  53. package/src/audit/security-scanner.ts +596 -0
  54. package/src/auth/guard.ts +75 -0
  55. package/src/auth/index.ts +56 -0
  56. package/src/auth/oauth.ts +455 -0
  57. package/src/auth/providers.ts +470 -0
  58. package/src/auth/sso.ts +113 -0
  59. package/src/auth/store.ts +505 -0
  60. package/src/auth/types.ts +187 -0
  61. package/src/build.ts +141 -0
  62. package/src/cli/index.ts +16 -0
  63. package/src/cli/init.ts +854 -0
  64. package/src/cli/openapi-spec.ts +356 -0
  65. package/src/cli/run.ts +237 -0
  66. package/src/cli/serve-auth.ts +80 -0
  67. package/src/cli/serve.ts +462 -0
  68. package/src/cli/web.ts +67 -0
  69. package/src/cli.ts +1417 -0
  70. package/src/clients/core-engine-client.ts +227 -0
  71. package/src/clients/enterprise-client.ts +334 -0
  72. package/src/clients/generator-client.ts +351 -0
  73. package/src/clients/git-client.ts +627 -0
  74. package/src/clients/github-client.ts +410 -0
  75. package/src/clients/helm-client.ts +504 -0
  76. package/src/clients/index.ts +80 -0
  77. package/src/clients/k8s-client.ts +497 -0
  78. package/src/clients/llm-client.ts +161 -0
  79. package/src/clients/rest-client.ts +130 -0
  80. package/src/clients/service-discovery.ts +33 -0
  81. package/src/clients/terraform-client.ts +482 -0
  82. package/src/clients/tools-client.ts +1843 -0
  83. package/src/clients/ws-client.ts +115 -0
  84. package/src/commands/analyze/index.ts +352 -0
  85. package/src/commands/apply/helm.ts +473 -0
  86. package/src/commands/apply/index.ts +213 -0
  87. package/src/commands/apply/k8s.ts +454 -0
  88. package/src/commands/apply/terraform.ts +582 -0
  89. package/src/commands/ask.ts +167 -0
  90. package/src/commands/audit/index.ts +238 -0
  91. package/src/commands/auth-cloud.ts +294 -0
  92. package/src/commands/auth-list.ts +134 -0
  93. package/src/commands/auth-profile.ts +121 -0
  94. package/src/commands/auth-status.ts +141 -0
  95. package/src/commands/aws/ec2.ts +501 -0
  96. package/src/commands/aws/iam.ts +397 -0
  97. package/src/commands/aws/index.ts +133 -0
  98. package/src/commands/aws/lambda.ts +396 -0
  99. package/src/commands/aws/rds.ts +439 -0
  100. package/src/commands/aws/s3.ts +439 -0
  101. package/src/commands/aws/vpc.ts +393 -0
  102. package/src/commands/aws-discover.ts +649 -0
  103. package/src/commands/aws-terraform.ts +805 -0
  104. package/src/commands/azure/aks.ts +376 -0
  105. package/src/commands/azure/functions.ts +253 -0
  106. package/src/commands/azure/index.ts +116 -0
  107. package/src/commands/azure/storage.ts +478 -0
  108. package/src/commands/azure/vm.ts +355 -0
  109. package/src/commands/billing/index.ts +256 -0
  110. package/src/commands/chat.ts +314 -0
  111. package/src/commands/config.ts +346 -0
  112. package/src/commands/cost/cloud-cost-estimator.ts +266 -0
  113. package/src/commands/cost/estimator.ts +79 -0
  114. package/src/commands/cost/index.ts +594 -0
  115. package/src/commands/cost/parsers/terraform.ts +273 -0
  116. package/src/commands/cost/parsers/types.ts +25 -0
  117. package/src/commands/cost/pricing/aws.ts +544 -0
  118. package/src/commands/cost/pricing/azure.ts +499 -0
  119. package/src/commands/cost/pricing/gcp.ts +396 -0
  120. package/src/commands/cost/pricing/index.ts +40 -0
  121. package/src/commands/demo.ts +250 -0
  122. package/src/commands/doctor.ts +794 -0
  123. package/src/commands/drift/index.ts +439 -0
  124. package/src/commands/explain.ts +277 -0
  125. package/src/commands/feedback.ts +389 -0
  126. package/src/commands/fix.ts +324 -0
  127. package/src/commands/fs/index.ts +402 -0
  128. package/src/commands/gcp/compute.ts +325 -0
  129. package/src/commands/gcp/functions.ts +271 -0
  130. package/src/commands/gcp/gke.ts +438 -0
  131. package/src/commands/gcp/iam.ts +344 -0
  132. package/src/commands/gcp/index.ts +129 -0
  133. package/src/commands/gcp/storage.ts +284 -0
  134. package/src/commands/generate-helm.ts +1249 -0
  135. package/src/commands/generate-k8s.ts +1560 -0
  136. package/src/commands/generate-terraform.ts +1460 -0
  137. package/src/commands/gh/index.ts +863 -0
  138. package/src/commands/git/index.ts +1343 -0
  139. package/src/commands/helm/index.ts +1126 -0
  140. package/src/commands/help.ts +539 -0
  141. package/src/commands/history.ts +142 -0
  142. package/src/commands/import.ts +868 -0
  143. package/src/commands/index.ts +367 -0
  144. package/src/commands/init.ts +1046 -0
  145. package/src/commands/k8s/index.ts +1137 -0
  146. package/src/commands/login.ts +631 -0
  147. package/src/commands/logout.ts +83 -0
  148. package/src/commands/onboarding.ts +228 -0
  149. package/src/commands/plan/display.ts +279 -0
  150. package/src/commands/plan/index.ts +599 -0
  151. package/src/commands/preview.ts +452 -0
  152. package/src/commands/questionnaire.ts +1270 -0
  153. package/src/commands/resume.ts +55 -0
  154. package/src/commands/team/index.ts +346 -0
  155. package/src/commands/template.ts +232 -0
  156. package/src/commands/tf/index.ts +1034 -0
  157. package/src/commands/upgrade.ts +550 -0
  158. package/src/commands/usage/index.ts +134 -0
  159. package/src/commands/version.ts +170 -0
  160. package/src/compat/index.ts +2 -0
  161. package/src/compat/runtime.ts +12 -0
  162. package/src/compat/sqlite.ts +107 -0
  163. package/src/config/index.ts +17 -0
  164. package/src/config/manager.ts +530 -0
  165. package/src/config/safety-policy.ts +358 -0
  166. package/src/config/schema.ts +125 -0
  167. package/src/config/types.ts +527 -0
  168. package/src/context/context-db.ts +199 -0
  169. package/src/demo/index.ts +349 -0
  170. package/src/demo/scenarios/full-journey.ts +229 -0
  171. package/src/demo/scenarios/getting-started.ts +127 -0
  172. package/src/demo/scenarios/helm-release.ts +341 -0
  173. package/src/demo/scenarios/k8s-deployment.ts +194 -0
  174. package/src/demo/scenarios/terraform-vpc.ts +170 -0
  175. package/src/demo/types.ts +92 -0
  176. package/src/engine/cost-estimator.ts +438 -0
  177. package/src/engine/diagram-generator.ts +256 -0
  178. package/src/engine/drift-detector.ts +902 -0
  179. package/src/engine/executor.ts +1035 -0
  180. package/src/engine/index.ts +76 -0
  181. package/src/engine/orchestrator.ts +636 -0
  182. package/src/engine/planner.ts +720 -0
  183. package/src/engine/safety.ts +743 -0
  184. package/src/engine/verifier.ts +770 -0
  185. package/src/enterprise/audit.ts +348 -0
  186. package/src/enterprise/auth.ts +270 -0
  187. package/src/enterprise/billing.ts +822 -0
  188. package/src/enterprise/index.ts +17 -0
  189. package/src/enterprise/teams.ts +443 -0
  190. package/src/generator/best-practices.ts +1608 -0
  191. package/src/generator/helm.ts +630 -0
  192. package/src/generator/index.ts +37 -0
  193. package/src/generator/intent-parser.ts +514 -0
  194. package/src/generator/kubernetes.ts +976 -0
  195. package/src/generator/terraform.ts +1867 -0
  196. package/src/history/index.ts +8 -0
  197. package/src/history/manager.ts +322 -0
  198. package/src/history/types.ts +34 -0
  199. package/src/hooks/config.ts +432 -0
  200. package/src/hooks/engine.ts +391 -0
  201. package/src/hooks/index.ts +4 -0
  202. package/src/llm/auth-bridge.ts +198 -0
  203. package/src/llm/circuit-breaker.ts +140 -0
  204. package/src/llm/config-loader.ts +201 -0
  205. package/src/llm/cost-calculator.ts +171 -0
  206. package/src/llm/index.ts +8 -0
  207. package/src/llm/model-aliases.ts +115 -0
  208. package/src/llm/provider-registry.ts +63 -0
  209. package/src/llm/providers/anthropic.ts +433 -0
  210. package/src/llm/providers/bedrock.ts +477 -0
  211. package/src/llm/providers/google.ts +405 -0
  212. package/src/llm/providers/ollama.ts +767 -0
  213. package/src/llm/providers/openai-compatible.ts +340 -0
  214. package/src/llm/providers/openai.ts +328 -0
  215. package/src/llm/providers/openrouter.ts +338 -0
  216. package/src/llm/router.ts +1035 -0
  217. package/src/llm/types.ts +232 -0
  218. package/src/lsp/client.ts +298 -0
  219. package/src/lsp/languages.ts +116 -0
  220. package/src/lsp/manager.ts +278 -0
  221. package/src/mcp/client.ts +402 -0
  222. package/src/mcp/index.ts +5 -0
  223. package/src/mcp/manager.ts +133 -0
  224. package/src/nimbus.ts +214 -0
  225. package/src/plugins/index.ts +27 -0
  226. package/src/plugins/loader.ts +334 -0
  227. package/src/plugins/manager.ts +376 -0
  228. package/src/plugins/types.ts +284 -0
  229. package/src/scanners/cicd-scanner.ts +258 -0
  230. package/src/scanners/cloud-scanner.ts +466 -0
  231. package/src/scanners/framework-scanner.ts +469 -0
  232. package/src/scanners/iac-scanner.ts +388 -0
  233. package/src/scanners/index.ts +539 -0
  234. package/src/scanners/language-scanner.ts +276 -0
  235. package/src/scanners/package-manager-scanner.ts +277 -0
  236. package/src/scanners/types.ts +172 -0
  237. package/src/sessions/manager.ts +365 -0
  238. package/src/sessions/types.ts +44 -0
  239. package/src/sharing/sync.ts +296 -0
  240. package/src/sharing/viewer.ts +97 -0
  241. package/src/snapshots/index.ts +2 -0
  242. package/src/snapshots/manager.ts +530 -0
  243. package/src/state/artifacts.ts +147 -0
  244. package/src/state/audit.ts +137 -0
  245. package/src/state/billing.ts +240 -0
  246. package/src/state/checkpoints.ts +117 -0
  247. package/src/state/config.ts +67 -0
  248. package/src/state/conversations.ts +14 -0
  249. package/src/state/credentials.ts +154 -0
  250. package/src/state/db.ts +58 -0
  251. package/src/state/index.ts +26 -0
  252. package/src/state/messages.ts +115 -0
  253. package/src/state/projects.ts +123 -0
  254. package/src/state/schema.ts +236 -0
  255. package/src/state/sessions.ts +147 -0
  256. package/src/state/teams.ts +200 -0
  257. package/src/telemetry.ts +108 -0
  258. package/src/tools/aws-ops.ts +952 -0
  259. package/src/tools/azure-ops.ts +579 -0
  260. package/src/tools/file-ops.ts +593 -0
  261. package/src/tools/gcp-ops.ts +625 -0
  262. package/src/tools/git-ops.ts +773 -0
  263. package/src/tools/github-ops.ts +799 -0
  264. package/src/tools/helm-ops.ts +943 -0
  265. package/src/tools/index.ts +17 -0
  266. package/src/tools/k8s-ops.ts +819 -0
  267. package/src/tools/schemas/converter.ts +184 -0
  268. package/src/tools/schemas/devops.ts +612 -0
  269. package/src/tools/schemas/index.ts +73 -0
  270. package/src/tools/schemas/standard.ts +1144 -0
  271. package/src/tools/schemas/types.ts +705 -0
  272. package/src/tools/terraform-ops.ts +862 -0
  273. package/src/types/ambient.d.ts +193 -0
  274. package/src/types/config.ts +83 -0
  275. package/src/types/drift.ts +116 -0
  276. package/src/types/enterprise.ts +335 -0
  277. package/src/types/index.ts +20 -0
  278. package/src/types/plan.ts +44 -0
  279. package/src/types/request.ts +65 -0
  280. package/src/types/response.ts +54 -0
  281. package/src/types/service.ts +51 -0
  282. package/src/ui/App.tsx +997 -0
  283. package/src/ui/DeployPreview.tsx +169 -0
  284. package/src/ui/Header.tsx +68 -0
  285. package/src/ui/InputBox.tsx +350 -0
  286. package/src/ui/MessageList.tsx +585 -0
  287. package/src/ui/PermissionPrompt.tsx +151 -0
  288. package/src/ui/StatusBar.tsx +158 -0
  289. package/src/ui/ToolCallDisplay.tsx +409 -0
  290. package/src/ui/chat-ui.ts +853 -0
  291. package/src/ui/index.ts +33 -0
  292. package/src/ui/ink/index.ts +711 -0
  293. package/src/ui/streaming.ts +176 -0
  294. package/src/ui/types.ts +57 -0
  295. package/src/utils/analytics.ts +72 -0
  296. package/src/utils/cost-warning.ts +27 -0
  297. package/src/utils/env.ts +46 -0
  298. package/src/utils/errors.ts +69 -0
  299. package/src/utils/event-bus.ts +38 -0
  300. package/src/utils/index.ts +24 -0
  301. package/src/utils/logger.ts +171 -0
  302. package/src/utils/rate-limiter.ts +121 -0
  303. package/src/utils/service-auth.ts +49 -0
  304. package/src/utils/validation.ts +53 -0
  305. package/src/version.ts +4 -0
  306. package/src/watcher/index.ts +163 -0
  307. package/src/wizard/approval.ts +383 -0
  308. package/src/wizard/index.ts +25 -0
  309. package/src/wizard/prompts.ts +338 -0
  310. package/src/wizard/types.ts +171 -0
  311. package/src/wizard/ui.ts +556 -0
  312. package/src/wizard/wizard.ts +304 -0
  313. package/tsconfig.json +24 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 The AI Project Co.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,628 @@
1
+ # Nimbus
2
+
3
+ [![npm version](https://img.shields.io/npm/v/@build-astron-co/nimbus.svg)](https://www.npmjs.com/package/@build-astron-co/nimbus)
4
+ [![license](https://img.shields.io/github/license/the-ai-project-co/nimbus)](https://github.com/the-ai-project-co/nimbus/blob/main/LICENSE)
5
+ [![GitHub release](https://img.shields.io/github/v/release/the-ai-project-co/nimbus)](https://github.com/the-ai-project-co/nimbus/releases)
6
+ [![CI](https://github.com/the-ai-project-co/nimbus/actions/workflows/ci.yml/badge.svg)](https://github.com/the-ai-project-co/nimbus/actions)
7
+ [![TypeScript](https://img.shields.io/badge/TypeScript-5.3-blue.svg)](https://www.typescriptlang.org/)
8
+ [![Bun](https://img.shields.io/badge/Bun-%E2%89%A51.0-f472b6.svg)](https://bun.sh/)
9
+ [![Tests](https://img.shields.io/badge/tests-693%20passing-brightgreen.svg)](https://github.com/the-ai-project-co/nimbus/actions)
10
+
11
+ > AI-powered cloud engineering agent for your terminal
12
+
13
+ Nimbus is an intelligent command-line agent that brings the power of large
14
+ language models to DevOps and cloud engineering workflows. Think of it as an AI
15
+ pair-programmer that understands Terraform, Kubernetes, Helm, and cloud
16
+ providers natively. It ships as a single self-contained binary with an
17
+ interactive terminal UI, 20 built-in tools, support for 11+ LLM providers, and a
18
+ three-mode safety system that separates reading, building, and deploying.
19
+
20
+ ---
21
+
22
+ ## Table of Contents
23
+
24
+ - [Features](#features)
25
+ - [Quick Start](#quick-start)
26
+ - [Installation](#installation)
27
+ - [Getting Started](#getting-started)
28
+ - [Commands](#commands)
29
+ - [Modes](#modes)
30
+ - [LLM Providers](#llm-providers)
31
+ - [MCP Support](#mcp-support)
32
+ - [Project Configuration (NIMBUS.md)](#project-configuration-nimbusmd)
33
+ - [Keyboard Shortcuts (TUI)](#keyboard-shortcuts-tui)
34
+ - [Development](#development)
35
+ - [Architecture](#architecture)
36
+ - [License](#license)
37
+
38
+ ---
39
+
40
+ ## Features
41
+
42
+ - **Interactive TUI** -- Rich terminal interface built with Ink and React,
43
+ featuring syntax highlighting, markdown rendering, code blocks, and a status
44
+ bar with mode indicators.
45
+ - **20 Built-in Tools** -- File operations (read, write, edit, glob, grep), git,
46
+ bash, terraform, kubectl, helm, AWS/GCP/Azure cloud discovery, web search,
47
+ cost estimation, drift detection, deploy preview, and subagent task spawning.
48
+ - **11+ LLM Providers** -- Anthropic, OpenAI, Google, AWS Bedrock, Azure OpenAI,
49
+ Ollama, Groq, DeepSeek, OpenRouter, Together AI, Fireworks AI, and Perplexity.
50
+ Any OpenAI-compatible endpoint can be added.
51
+ - **Three Modes** -- Plan (read-only), Build (edit/create), and Deploy (full
52
+ infra access). Each mode progressively expands tool availability and resets
53
+ permissions on switch.
54
+ - **Session Persistence** -- Conversations are stored in SQLite and can be
55
+ resumed, branched, or shared. Multi-session support with file conflict
56
+ detection.
57
+ - **MCP Server Support** -- Connect to Model Context Protocol servers to extend
58
+ Nimbus with external tools via JSON-RPC over stdio or HTTP.
59
+ - **Subagent System** -- Spawn parallel sub-tasks (explore, infra, security,
60
+ cost, general) with isolated context and independent model selection.
61
+ - **Context Management** -- Auto-compaction at 85% context window usage.
62
+ Preserves first message, last 5 messages, summaries, and active tool state.
63
+ - **Snapshot / Undo / Redo** -- Uses `git write-tree` for git projects (or
64
+ filesystem copy for non-git) to checkpoint and roll back changes.
65
+ - **Infrastructure Generation** -- Generate Terraform configurations, Kubernetes
66
+ manifests, and Helm charts from natural language descriptions with
67
+ best-practice templates.
68
+ - **Cost Estimation and Drift Detection** -- Estimate infrastructure costs
69
+ before deploying and detect configuration drift across your environments.
70
+ - **Enterprise Features** -- Teams, billing, audit logs, usage tracking,
71
+ security scanning, and compliance checking (SOC2, HIPAA, PCI-DSS, GDPR, ISO
72
+ 27001).
73
+ - **Web UI** -- Browser-based interface via `nimbus web`, backed by an Elysia
74
+ HTTP API with SSE streaming.
75
+ - **Human-in-the-Loop Safety** -- 4-tier permission engine (auto_allow,
76
+ ask_once, always_ask, blocked) with action-specific escalation for destructive
77
+ operations.
78
+
79
+ ---
80
+
81
+ ## Quick Start
82
+
83
+ ```bash
84
+ # Install
85
+ npm install -g @build-astron-co/nimbus
86
+ # or
87
+ bun install -g @build-astron-co/nimbus
88
+ # or via Homebrew
89
+ brew tap the-ai-project-co/tap
90
+ brew install nimbus
91
+
92
+ # Set up authentication
93
+ nimbus login
94
+
95
+ # Start the interactive AI agent
96
+ nimbus
97
+ ```
98
+
99
+ On first run, Nimbus launches an onboarding flow that walks you through provider
100
+ selection and API key configuration. After that, running `nimbus` drops you into
101
+ the interactive chat.
102
+
103
+ ---
104
+
105
+ ## Installation
106
+
107
+ ### Bun (recommended -- fastest, native SQLite)
108
+
109
+ ```bash
110
+ bun install -g @build-astron-co/nimbus
111
+ ```
112
+
113
+ Bun provides the best experience: native `bun:sqlite` for state management,
114
+ faster startup, and the full Ink TUI out of the box.
115
+
116
+ ### npm
117
+
118
+ ```bash
119
+ npm install -g @build-astron-co/nimbus
120
+ ```
121
+
122
+ Works with Node.js >= 18. Uses `better-sqlite3` as the SQLite backend when
123
+ running under Node.
124
+
125
+ ### Homebrew (macOS / Linux)
126
+
127
+ ```bash
128
+ brew tap the-ai-project-co/tap
129
+ brew install nimbus
130
+ ```
131
+
132
+ ### Shell script (auto-detects best method)
133
+
134
+ ```bash
135
+ curl -fsSL https://raw.githubusercontent.com/the-ai-project-co/nimbus/main/scripts/install.sh | bash
136
+ ```
137
+
138
+ ### Compiled binary (direct download)
139
+
140
+ Pre-built standalone binaries for macOS, Linux, and Windows are available on the
141
+ [GitHub Releases](https://github.com/the-ai-project-co/nimbus/releases) page.
142
+ Standalone binaries bundle the Bun runtime (~68 MB), so no extra dependencies
143
+ are needed.
144
+
145
+ > Note: compiled binaries use the readline chat interface. Install via Bun or
146
+ > npm for the full Ink TUI.
147
+
148
+ ---
149
+
150
+ ## Getting Started
151
+
152
+ ### First run / onboarding
153
+
154
+ ```bash
155
+ nimbus
156
+ ```
157
+
158
+ The first time you run Nimbus, it launches an interactive onboarding that helps
159
+ you select an LLM provider and configure your API key. Credentials are stored in
160
+ `~/.nimbus/auth.json`.
161
+
162
+ ### Setting up providers
163
+
164
+ You can configure providers through onboarding or by setting environment
165
+ variables directly:
166
+
167
+ ```bash
168
+ export ANTHROPIC_API_KEY="sk-ant-..."
169
+ ```
170
+
171
+ Or log in interactively:
172
+
173
+ ```bash
174
+ nimbus login
175
+ ```
176
+
177
+ ### Initialize a project
178
+
179
+ ```bash
180
+ nimbus init
181
+ ```
182
+
183
+ This detects your project type (TypeScript, Go, Python, Rust, Java, JavaScript),
184
+ infrastructure tooling (Terraform, Kubernetes, Helm, Docker, CI/CD), and cloud
185
+ providers (AWS, GCP, Azure), then generates a `NIMBUS.md` file with project
186
+ context that Nimbus uses to tailor its responses.
187
+
188
+ ### Interactive chat
189
+
190
+ ```bash
191
+ nimbus chat
192
+ ```
193
+
194
+ Or just `nimbus` -- it launches the Ink TUI with the full agent loop, tool
195
+ execution, and streaming responses.
196
+
197
+ ### Non-interactive mode
198
+
199
+ ```bash
200
+ nimbus run "Create a Terraform module for an S3 bucket with versioning and encryption"
201
+ nimbus run "Fix the failing test in src/__tests__/router.test.ts" --auto-approve
202
+ nimbus run "Explain the architecture of this project" --format json
203
+ ```
204
+
205
+ ### One-off questions
206
+
207
+ ```bash
208
+ nimbus ask "How do I set up an S3 bucket with versioning?"
209
+ ```
210
+
211
+ ### Check your environment
212
+
213
+ ```bash
214
+ nimbus doctor
215
+ ```
216
+
217
+ Verifies that required tools (git, terraform, kubectl, helm, cloud CLIs) are
218
+ available and that provider credentials are configured.
219
+
220
+ ---
221
+
222
+ ## Commands
223
+
224
+ ### Chat and AI
225
+
226
+ | Command | Description |
227
+ | ----------------------- | ----------------------------------------- |
228
+ | `nimbus` | Launch interactive chat (default) |
229
+ | `nimbus chat` | Interactive AI chat session |
230
+ | `nimbus run "prompt"` | Non-interactive mode with a single prompt |
231
+ | `nimbus ask "question"` | Ask a one-off question |
232
+ | `nimbus explain <file>` | Explain a file or code snippet |
233
+ | `nimbus fix <file>` | Analyze and fix issues in a file |
234
+ | `nimbus analyze` | Analyze the current project |
235
+
236
+ ### Configuration
237
+
238
+ | Command | Description |
239
+ | ---------------- | ------------------------------------------------------ |
240
+ | `nimbus init` | Initialize a project (detect type, generate NIMBUS.md) |
241
+ | `nimbus config` | View or set configuration |
242
+ | `nimbus login` | Authenticate with an LLM provider |
243
+ | `nimbus logout` | Remove stored credentials |
244
+ | `nimbus auth` | Manage authentication |
245
+ | `nimbus doctor` | Check environment and provider status |
246
+ | `nimbus upgrade` | Self-update to the latest version |
247
+
248
+ ### Infrastructure Generation
249
+
250
+ | Command | Description |
251
+ | --------------------------- | ------------------------------------------------------- |
252
+ | `nimbus generate terraform` | Generate Terraform configurations from natural language |
253
+ | `nimbus generate k8s` | Generate Kubernetes manifests |
254
+ | `nimbus generate helm` | Generate Helm charts |
255
+
256
+ ### Cloud Providers
257
+
258
+ | Command | Description |
259
+ | ------------------------ | -------------------------------------- |
260
+ | `nimbus aws <service>` | AWS operations (S3, EC2, Lambda, etc.) |
261
+ | `nimbus gcp <service>` | Google Cloud operations |
262
+ | `nimbus azure <service>` | Azure operations |
263
+
264
+ ### Infrastructure Management
265
+
266
+ | Command | Description |
267
+ | ----------------------------------------------------- | -------------------------------------- |
268
+ | `nimbus tf init/plan/apply/validate/destroy/fmt` | Terraform operations |
269
+ | `nimbus k8s get/apply/delete/logs/scale/exec` | Kubernetes operations |
270
+ | `nimbus helm list/install/upgrade/uninstall/rollback` | Helm operations |
271
+ | `nimbus cost estimate/history` | Cost estimation and tracking |
272
+ | `nimbus drift detect/fix` | Configuration drift detection |
273
+ | `nimbus preview` | Deploy preview (blast radius analysis) |
274
+
275
+ ### Git and Files
276
+
277
+ | Command | Description |
278
+ | ----------------------------------------------- | ---------------------- |
279
+ | `nimbus git status/add/commit/push/merge/stash` | Git operations |
280
+ | `nimbus fs read/write/list/search` | File system operations |
281
+
282
+ ### GitHub
283
+
284
+ | Command | Description |
285
+ | ---------------------------------------- | ----------------------- |
286
+ | `nimbus gh pr list/create/view/merge` | Pull request operations |
287
+ | `nimbus gh issue list/create/view/close` | Issue operations |
288
+ | `nimbus gh repo view/clone` | Repository operations |
289
+
290
+ ### Enterprise
291
+
292
+ | Command | Description |
293
+ | ---------------- | ----------------------------------- |
294
+ | `nimbus team` | Team management |
295
+ | `nimbus billing` | Billing and subscription management |
296
+ | `nimbus usage` | Usage statistics and token tracking |
297
+ | `nimbus audit` | Audit logs and compliance reports |
298
+
299
+ ### Server
300
+
301
+ | Command | Description |
302
+ | -------------- | -------------------------------------------------- |
303
+ | `nimbus serve` | Start the HTTP API server (Elysia, SSE streaming) |
304
+ | `nimbus web` | Start the API server and open the browser-based UI |
305
+
306
+ ### Utilities
307
+
308
+ | Command | Description |
309
+ | ----------------------- | ----------------------------------- |
310
+ | `nimbus version` | Print version and build date |
311
+ | `nimbus help` | Show help for all commands |
312
+ | `nimbus help <command>` | Show help for a specific command |
313
+ | `nimbus doctor` | Verify environment and dependencies |
314
+ | `nimbus upgrade` | Update Nimbus to the latest version |
315
+
316
+ Run `nimbus help` for the full command list, or `nimbus help <command>` for
317
+ details on any command.
318
+
319
+ ---
320
+
321
+ ## Modes
322
+
323
+ Nimbus uses a three-mode system that controls which tools are available,
324
+ enforcing a progressive trust model. Switching modes resets the permission
325
+ session so that previously approved tools require re-approval.
326
+
327
+ ### Plan mode
328
+
329
+ Read-only exploration and analysis. The agent can read files, search codebases,
330
+ estimate costs, detect drift, and propose changes -- but it cannot modify
331
+ anything.
332
+
333
+ **Available tools:** `read_file`, `glob`, `grep`, `list_dir`, `webfetch`,
334
+ `cost_estimate`, `drift_detect`, `todo_read`, `todo_write`, `cloud_discover`
335
+
336
+ ### Build mode (default)
337
+
338
+ Everything in Plan, plus file editing, shell access, git operations, and
339
+ non-destructive DevOps commands. The agent can generate Terraform configs, write
340
+ Kubernetes manifests, and validate them, but it cannot apply changes to live
341
+ infrastructure.
342
+
343
+ **Additional tools:** `edit_file`, `multi_edit`, `write_file`, `bash`, `git`,
344
+ `task`, `deploy_preview`, `terraform` (validate/fmt/plan only), `kubectl`
345
+ (get/describe only), `helm` (list/status/template only)
346
+
347
+ ### Deploy mode
348
+
349
+ Full access to all 20 tools, including infrastructure-mutating operations.
350
+ Destructive actions still go through the permission engine and require explicit
351
+ user approval.
352
+
353
+ **Additional tools:** All terraform subcommands (apply, destroy), all kubectl
354
+ subcommands (apply, delete), all helm subcommands (install, upgrade, uninstall)
355
+
356
+ Switch modes in the TUI by pressing **Tab**, or use the `/mode` slash command.
357
+
358
+ ---
359
+
360
+ ## LLM Providers
361
+
362
+ Nimbus routes requests through an intelligent LLM router with automatic
363
+ fallback, cost optimization, circuit breaking, and retry with exponential
364
+ backoff.
365
+
366
+ | Provider | Environment Variable(s) | Notes |
367
+ | ------------ | ------------------------------ | ------------------------------------------------------ |
368
+ | Anthropic | `ANTHROPIC_API_KEY` | Claude models (Sonnet, Opus, Haiku). Default provider. |
369
+ | OpenAI | `OPENAI_API_KEY` | GPT-4o, GPT-4, GPT-3.5 |
370
+ | Google | `GOOGLE_API_KEY` | Gemini models |
371
+ | AWS Bedrock | `AWS_REGION` + IAM credentials | Claude, Llama, and others via AWS |
372
+ | Ollama | `OLLAMA_BASE_URL` (optional) | Local models, no API key needed |
373
+ | Groq | `GROQ_API_KEY` | Fast inference (Llama, Mixtral) |
374
+ | DeepSeek | `DEEPSEEK_API_KEY` | DeepSeek models |
375
+ | OpenRouter | `OPENROUTER_API_KEY` | Multi-model proxy, access 100+ models |
376
+ | Together AI | `TOGETHER_API_KEY` | Llama, Mixtral, and more |
377
+ | Fireworks AI | `FIREWORKS_API_KEY` | Fast open-source model inference |
378
+ | Perplexity | `PERPLEXITY_API_KEY` | Online search-augmented models |
379
+
380
+ Any OpenAI-compatible endpoint can be added via the `OpenAICompatibleProvider`
381
+ class.
382
+
383
+ You can also configure providers through `nimbus login`, which stores
384
+ credentials in `~/.nimbus/auth.json`. The router checks `auth.json` first, then
385
+ falls back to environment variables.
386
+
387
+ ### Model aliases
388
+
389
+ Nimbus supports short aliases for common models:
390
+
391
+ ```bash
392
+ nimbus chat --model sonnet # resolves to claude-sonnet-4-20250514
393
+ nimbus chat --model opus # resolves to claude-opus-4-20250514
394
+ nimbus chat --model gpt4o # resolves to gpt-4o
395
+ nimbus chat --model gemini # resolves to gemini-pro
396
+ ```
397
+
398
+ ### Cost optimization
399
+
400
+ When enabled (`ENABLE_COST_OPTIMIZATION=true`), the router automatically selects
401
+ cheaper models for simple tasks (summarization, classification) and more capable
402
+ models for complex tasks (code generation, planning).
403
+
404
+ ---
405
+
406
+ ## MCP Support
407
+
408
+ Nimbus supports the [Model Context Protocol](https://modelcontextprotocol.io/)
409
+ for extending the agent with external tools. Configure MCP servers in
410
+ `.nimbus/mcp.json` (project-level) or `~/.nimbus/mcp.json` (global):
411
+
412
+ ```json
413
+ {
414
+ "mcpServers": {
415
+ "filesystem": {
416
+ "command": "npx",
417
+ "args": ["-y", "@modelcontextprotocol/server-filesystem", "/path/to/dir"]
418
+ },
419
+ "github": {
420
+ "command": "npx",
421
+ "args": ["-y", "@modelcontextprotocol/server-github"],
422
+ "env": {
423
+ "GITHUB_PERSONAL_ACCESS_TOKEN": "ghp_..."
424
+ }
425
+ },
426
+ "remote-server": {
427
+ "type": "http",
428
+ "url": "https://mcp.example.com",
429
+ "token": "your-auth-token"
430
+ }
431
+ }
432
+ }
433
+ ```
434
+
435
+ MCP servers are discovered from three locations, searched in order:
436
+
437
+ 1. `.nimbus/mcp.json` (project directory)
438
+ 2. `nimbus.json` (project directory)
439
+ 3. `~/.nimbus/mcp.json` (global)
440
+
441
+ Servers support two transport modes: **command** (JSON-RPC over stdio) and
442
+ **http** (JSON-RPC over HTTP). Tools from connected servers are automatically
443
+ registered into the Nimbus tool registry and become available to the agent.
444
+
445
+ ---
446
+
447
+ ## Project Configuration (NIMBUS.md)
448
+
449
+ Running `nimbus init` in your project directory generates a `NIMBUS.md` file
450
+ that provides project-specific context to the AI agent. Nimbus auto-detects:
451
+
452
+ - **Project type** -- TypeScript, JavaScript, Go, Python, Rust, Java
453
+ - **Infrastructure tools** -- Terraform, Kubernetes, Helm, Docker, CI/CD
454
+ pipelines
455
+ - **Cloud providers** -- AWS, GCP, Azure (from config files and Terraform
456
+ providers)
457
+ - **Package manager** -- npm, yarn, pnpm, bun
458
+ - **Test framework** -- jest, vitest, mocha, pytest, go test, cargo test
459
+ - **Git repository status**
460
+
461
+ The generated `NIMBUS.md` file is included in the system prompt so the agent
462
+ understands your project's technology stack, conventions, and infrastructure
463
+ setup.
464
+
465
+ ```bash
466
+ nimbus init # auto-detect and generate
467
+ nimbus init --force # overwrite existing NIMBUS.md
468
+ nimbus init --quiet # suppress console output
469
+ ```
470
+
471
+ ---
472
+
473
+ ## Keyboard Shortcuts (TUI)
474
+
475
+ | Shortcut | Action |
476
+ | ------------- | --------------------------------------------- |
477
+ | **Tab** | Cycle modes (Plan -> Build -> Deploy -> Plan) |
478
+ | **Ctrl+C** | Interrupt current operation or exit |
479
+ | **Escape** | Cancel current operation |
480
+ | **Up / Down** | Browse input history |
481
+ | **Enter** | Send message |
482
+ | `/mode` | Switch mode via slash command |
483
+ | `/clear` | Clear the conversation |
484
+ | `/compact` | Manually trigger context compaction |
485
+ | `/help` | Show available slash commands |
486
+
487
+ ---
488
+
489
+ ## Development
490
+
491
+ ### Prerequisites
492
+
493
+ - [Bun](https://bun.sh/) v1.0 or higher
494
+ - Git
495
+
496
+ ### Setup
497
+
498
+ ```bash
499
+ git clone https://github.com/the-ai-project-co/nimbus.git
500
+ cd nimbus
501
+ bun install
502
+ ```
503
+
504
+ ### Run from source
505
+
506
+ ```bash
507
+ # Run directly
508
+ bun src/nimbus.ts
509
+
510
+ # Run with arguments
511
+ bun src/nimbus.ts --help
512
+ bun src/nimbus.ts chat
513
+ bun src/nimbus.ts ask "explain this project"
514
+
515
+ # Or use the npm script
516
+ bun run nimbus -- --help
517
+ ```
518
+
519
+ ### Test
520
+
521
+ ```bash
522
+ # Run all tests (693 tests)
523
+ bun test src/__tests__/
524
+
525
+ # Run with coverage
526
+ bun test src/__tests__/ --coverage
527
+
528
+ # Watch mode
529
+ bun test src/__tests__/ --watch
530
+ ```
531
+
532
+ ### Lint and format
533
+
534
+ ```bash
535
+ bun run lint
536
+ bun run format
537
+ bun run type-check
538
+ ```
539
+
540
+ ### Build
541
+
542
+ ```bash
543
+ # Build standalone binary for current platform
544
+ bun src/build.ts
545
+
546
+ # Build for all platforms
547
+ bun src/build.ts --all
548
+
549
+ # Or use the shell script
550
+ ./scripts/build-binary.sh
551
+ ```
552
+
553
+ The binary is output to `dist/nimbus` (~68 MB, bundles the Bun runtime).
554
+
555
+ ---
556
+
557
+ ## Architecture
558
+
559
+ Nimbus is a single embedded binary built with [Bun](https://bun.sh/). All
560
+ functionality runs in-process -- there are no HTTP microservices, no Docker
561
+ containers, and no external orchestrators. The entire application is a single
562
+ TypeScript process that manages LLM routing, tool execution, state persistence,
563
+ and the TUI.
564
+
565
+ ```
566
+ src/
567
+ nimbus.ts Entry point (shebang: #!/usr/bin/env bun)
568
+ cli.ts CLI command router
569
+ app.ts App lifecycle (lazy DB + LLM router init)
570
+ version.ts Version and build date constants
571
+
572
+ agent/ Agent loop, system prompt, permissions, modes, subagents
573
+ llm/ LLM router, 11+ providers, model aliases, cost calculator
574
+ tools/ Tool implementations and schemas (11 standard + 9 DevOps)
575
+ state/ SQLite WAL database (16 tables at ~/.nimbus/nimbus.db)
576
+ ui/ Ink/React TUI components (8 components)
577
+ commands/ CLI command implementations
578
+
579
+ engine/ Planner, executor, orchestrator, verifier, safety, drift, cost
580
+ generator/ Terraform, Kubernetes, Helm generators with best practices
581
+ enterprise/ Auth, teams, billing, audit
582
+ auth/ Authentication (OAuth, SSO, credential store)
583
+ hooks/ Pre/post tool-use hooks (YAML config)
584
+ snapshots/ Git write-tree undo/redo
585
+ audit/ Security scanner, compliance checker, cost tracker, activity log
586
+ lsp/ Language server protocol (6 languages: TS, Go, Python, HCL, YAML, Docker)
587
+ sessions/ Multi-session management with conflict detection
588
+ sharing/ Session sharing (URL-safe IDs, 30-day TTL)
589
+ mcp/ MCP client (JSON-RPC over stdio/HTTP)
590
+ cli/ Non-interactive run, serve, web, init commands
591
+ compat/ Runtime compatibility layer (Bun / Node.js)
592
+ context/ Context database for long-term memory
593
+ watcher/ Filesystem watcher for live file tracking
594
+
595
+ build.ts Binary build script
596
+ __tests__/ 693 tests
597
+ ```
598
+
599
+ ### Key design decisions
600
+
601
+ - **Single process** -- No IPC overhead. LLM calls, tool execution, and state
602
+ writes all happen in the same event loop.
603
+ - **SQLite with WAL** -- All state (sessions, usage, audit, config, sharing) is
604
+ stored in a single SQLite database at `~/.nimbus/nimbus.db` using WAL mode for
605
+ concurrent read/write.
606
+ - **Streaming-first** -- The agent loop streams LLM responses token-by-token
607
+ through the TUI. Tool calls appear inline as they execute.
608
+ - **Progressive trust** -- The three-mode system (Plan/Build/Deploy) combined
609
+ with the 4-tier permission engine ensures that destructive operations always
610
+ require explicit approval.
611
+ - **Provider fallback** -- The LLM router tries providers in order with circuit
612
+ breakers, exponential backoff, and automatic failover.
613
+
614
+ ---
615
+
616
+ ## License
617
+
618
+ [MIT](LICENSE)
619
+
620
+ ---
621
+
622
+ ## Links
623
+
624
+ - [npm Package](https://www.npmjs.com/package/@build-astron-co/nimbus)
625
+ - [GitHub](https://github.com/the-ai-project-co/nimbus)
626
+ - [Issues](https://github.com/the-ai-project-co/nimbus/issues)
627
+ - [Releases](https://github.com/the-ai-project-co/nimbus/releases)
628
+ - [Homebrew Tap](https://github.com/the-ai-project-co/homebrew-tap)
package/bin/nimbus ADDED
@@ -0,0 +1,38 @@
1
+ #!/usr/bin/env sh
2
+ # Nimbus CLI launcher — prefers Bun, falls back to Node.js (>=18).
3
+ set -e
4
+
5
+ SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
6
+ ENTRY="$SCRIPT_DIR/../src/nimbus.ts"
7
+
8
+ # Prefer Bun for best performance (native bun:sqlite, fast startup)
9
+ if command -v bun >/dev/null 2>&1; then
10
+ exec bun "$ENTRY" "$@"
11
+ fi
12
+
13
+ # Fallback: Node.js with tsx for TypeScript execution
14
+ if command -v node >/dev/null 2>&1; then
15
+ NODE_VERSION=$(node -e "console.log(process.versions.node.split('.')[0])")
16
+ if [ "$NODE_VERSION" -ge 18 ] 2>/dev/null; then
17
+ # Use tsx (TypeScript eXecute) for Node.js — handles TS natively
18
+ TSX_BIN="$SCRIPT_DIR/../node_modules/.bin/tsx"
19
+ if [ -x "$TSX_BIN" ]; then
20
+ exec "$TSX_BIN" "$ENTRY" "$@"
21
+ fi
22
+ # Try global tsx
23
+ if command -v tsx >/dev/null 2>&1; then
24
+ exec tsx "$ENTRY" "$@"
25
+ fi
26
+ # Last resort: use Node.js --import tsx (Node >= 18.19)
27
+ exec node --import tsx "$ENTRY" "$@"
28
+ fi
29
+ fi
30
+
31
+ echo "Error: Nimbus requires Bun (recommended) or Node.js >= 18." >&2
32
+ echo "" >&2
33
+ echo "Install Bun (recommended):" >&2
34
+ echo " curl -fsSL https://bun.sh/install | bash" >&2
35
+ echo "" >&2
36
+ echo "Or ensure Node.js >= 18 is installed:" >&2
37
+ echo " https://nodejs.org/" >&2
38
+ exit 1