@build-astron-co/nimbus 0.2.0 → 0.4.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.
- package/bin/nimbus +26 -10
- package/bin/nimbus.cmd +41 -0
- package/bin/nimbus.mjs +70 -0
- package/completions/nimbus.bash +38 -0
- package/completions/nimbus.fish +48 -0
- package/completions/nimbus.zsh +81 -0
- package/dist/src/agent/compaction-agent.js +215 -0
- package/dist/src/agent/context-manager.js +385 -0
- package/dist/src/agent/context.js +322 -0
- package/dist/src/agent/deploy-preview.js +395 -0
- package/dist/src/agent/expand-files.js +95 -0
- package/dist/src/agent/index.js +18 -0
- package/dist/src/agent/loop.js +1535 -0
- package/dist/src/agent/modes.js +347 -0
- package/dist/src/agent/permissions.js +396 -0
- package/dist/src/agent/subagents/base.js +67 -0
- package/dist/src/agent/subagents/cost.js +45 -0
- package/dist/src/agent/subagents/explore.js +36 -0
- package/dist/src/agent/subagents/general.js +41 -0
- package/dist/src/agent/subagents/index.js +88 -0
- package/dist/src/agent/subagents/infra.js +52 -0
- package/dist/src/agent/subagents/security.js +60 -0
- package/dist/src/agent/system-prompt.js +860 -0
- package/dist/src/app.js +152 -0
- package/dist/src/audit/activity-log.js +209 -0
- package/dist/src/audit/compliance-checker.js +419 -0
- package/dist/src/audit/cost-tracker.js +231 -0
- package/dist/src/audit/index.js +10 -0
- package/dist/src/audit/security-scanner.js +490 -0
- package/dist/src/auth/guard.js +64 -0
- package/dist/src/auth/index.js +19 -0
- package/dist/src/auth/keychain.js +79 -0
- package/dist/src/auth/oauth.js +389 -0
- package/dist/src/auth/providers.js +415 -0
- package/dist/src/auth/sso.js +87 -0
- package/dist/src/auth/store.js +424 -0
- package/dist/src/auth/types.js +5 -0
- package/dist/src/cli/index.js +8 -0
- package/dist/src/cli/init.js +1048 -0
- package/dist/src/cli/openapi-spec.js +346 -0
- package/dist/src/cli/run.js +505 -0
- package/dist/src/cli/serve-auth.js +56 -0
- package/dist/src/cli/serve.js +432 -0
- package/dist/src/cli/web.js +50 -0
- package/dist/src/cli.js +1574 -0
- package/dist/src/clients/core-engine-client.js +156 -0
- package/dist/src/clients/enterprise-client.js +246 -0
- package/dist/src/clients/generator-client.js +219 -0
- package/dist/src/clients/git-client.js +367 -0
- package/dist/src/clients/github-client.js +229 -0
- package/dist/src/clients/helm-client.js +299 -0
- package/dist/src/clients/index.js +18 -0
- package/dist/src/clients/k8s-client.js +270 -0
- package/dist/src/clients/llm-client.js +119 -0
- package/dist/src/clients/rest-client.js +104 -0
- package/dist/src/clients/service-discovery.js +35 -0
- package/dist/src/clients/terraform-client.js +302 -0
- package/dist/src/clients/tools-client.js +1227 -0
- package/dist/src/clients/ws-client.js +93 -0
- package/dist/src/commands/alias.js +91 -0
- package/dist/src/commands/analyze/index.js +313 -0
- package/dist/src/commands/apply/helm.js +375 -0
- package/dist/src/commands/apply/index.js +176 -0
- package/dist/src/commands/apply/k8s.js +350 -0
- package/dist/src/commands/apply/terraform.js +465 -0
- package/dist/src/commands/ask.js +137 -0
- package/dist/src/commands/audit/index.js +322 -0
- package/dist/src/commands/auth-cloud.js +345 -0
- package/dist/src/commands/auth-list.js +112 -0
- package/dist/src/commands/auth-profile.js +104 -0
- package/dist/src/commands/auth-refresh.js +161 -0
- package/dist/src/commands/auth-status.js +122 -0
- package/dist/src/commands/aws/ec2.js +402 -0
- package/dist/src/commands/aws/iam.js +304 -0
- package/dist/src/commands/aws/index.js +108 -0
- package/dist/src/commands/aws/lambda.js +317 -0
- package/dist/src/commands/aws/rds.js +345 -0
- package/dist/src/commands/aws/s3.js +346 -0
- package/dist/src/commands/aws/vpc.js +302 -0
- package/dist/src/commands/aws-discover.js +413 -0
- package/dist/src/commands/aws-terraform.js +618 -0
- package/dist/src/commands/azure/aks.js +305 -0
- package/dist/src/commands/azure/functions.js +200 -0
- package/dist/src/commands/azure/index.js +93 -0
- package/dist/src/commands/azure/storage.js +378 -0
- package/dist/src/commands/azure/vm.js +291 -0
- package/dist/src/commands/billing/index.js +224 -0
- package/dist/src/commands/chat.js +259 -0
- package/dist/src/commands/completions.js +255 -0
- package/dist/src/commands/config.js +291 -0
- package/dist/src/commands/cost/cloud-cost-estimator.js +211 -0
- package/dist/src/commands/cost/estimator.js +73 -0
- package/dist/src/commands/cost/index.js +625 -0
- package/dist/src/commands/cost/parsers/terraform.js +234 -0
- package/dist/src/commands/cost/parsers/types.js +4 -0
- package/dist/src/commands/cost/pricing/aws.js +501 -0
- package/dist/src/commands/cost/pricing/azure.js +462 -0
- package/dist/src/commands/cost/pricing/gcp.js +359 -0
- package/dist/src/commands/cost/pricing/index.js +24 -0
- package/dist/src/commands/demo.js +196 -0
- package/dist/src/commands/deploy.js +215 -0
- package/dist/src/commands/doctor.js +1291 -0
- package/dist/src/commands/drift/index.js +674 -0
- package/dist/src/commands/explain.js +235 -0
- package/dist/src/commands/export.js +120 -0
- package/dist/src/commands/feedback.js +319 -0
- package/dist/src/commands/fix.js +263 -0
- package/dist/src/commands/fs/index.js +338 -0
- package/dist/src/commands/gcp/compute.js +266 -0
- package/dist/src/commands/gcp/functions.js +221 -0
- package/dist/src/commands/gcp/gke.js +357 -0
- package/dist/src/commands/gcp/iam.js +295 -0
- package/dist/src/commands/gcp/index.js +105 -0
- package/dist/src/commands/gcp/storage.js +232 -0
- package/dist/src/commands/generate-helm.js +1026 -0
- package/dist/src/commands/generate-k8s.js +1263 -0
- package/dist/src/commands/generate-terraform.js +1058 -0
- package/dist/src/commands/gh/index.js +663 -0
- package/dist/src/commands/git/index.js +1208 -0
- package/dist/src/commands/helm/index.js +985 -0
- package/dist/src/commands/help.js +639 -0
- package/dist/src/commands/history.js +120 -0
- package/dist/src/commands/import.js +782 -0
- package/dist/src/commands/incident.js +144 -0
- package/dist/src/commands/index.js +109 -0
- package/dist/src/commands/init.js +955 -0
- package/dist/src/commands/k8s/index.js +979 -0
- package/dist/src/commands/login.js +588 -0
- package/dist/src/commands/logout.js +61 -0
- package/dist/src/commands/logs.js +160 -0
- package/dist/src/commands/onboarding.js +382 -0
- package/dist/src/commands/pipeline.js +153 -0
- package/dist/src/commands/plan/display.js +216 -0
- package/dist/src/commands/plan/index.js +525 -0
- package/dist/src/commands/plugin.js +325 -0
- package/dist/src/commands/preview.js +356 -0
- package/dist/src/commands/profile.js +297 -0
- package/dist/src/commands/questionnaire.js +1021 -0
- package/dist/src/commands/resume.js +35 -0
- package/dist/src/commands/rollback.js +259 -0
- package/dist/src/commands/rollout.js +74 -0
- package/dist/src/commands/runbook.js +307 -0
- package/dist/src/commands/schedule.js +202 -0
- package/dist/src/commands/status.js +213 -0
- package/dist/src/commands/team/index.js +309 -0
- package/dist/src/commands/team-context.js +200 -0
- package/dist/src/commands/template.js +204 -0
- package/dist/src/commands/tf/index.js +989 -0
- package/dist/src/commands/upgrade.js +515 -0
- package/dist/src/commands/usage/index.js +118 -0
- package/dist/src/commands/version.js +145 -0
- package/dist/src/commands/watch.js +127 -0
- package/dist/src/compat/index.js +2 -0
- package/dist/src/compat/runtime.js +10 -0
- package/dist/src/compat/sqlite.js +144 -0
- package/dist/src/config/index.js +6 -0
- package/dist/src/config/manager.js +469 -0
- package/dist/src/config/mode-store.js +57 -0
- package/dist/src/config/profiles.js +66 -0
- package/dist/src/config/safety-policy.js +251 -0
- package/dist/src/config/schema.js +107 -0
- package/dist/src/config/types.js +311 -0
- package/dist/src/config/workspace-state.js +38 -0
- package/dist/src/context/context-db.js +138 -0
- package/dist/src/demo/index.js +295 -0
- package/dist/src/demo/scenarios/full-journey.js +226 -0
- package/dist/src/demo/scenarios/getting-started.js +124 -0
- package/dist/src/demo/scenarios/helm-release.js +334 -0
- package/dist/src/demo/scenarios/k8s-deployment.js +190 -0
- package/dist/src/demo/scenarios/terraform-vpc.js +167 -0
- package/dist/src/demo/types.js +6 -0
- package/dist/src/engine/cost-estimator.js +334 -0
- package/dist/src/engine/diagram-generator.js +192 -0
- package/dist/src/engine/drift-detector.js +688 -0
- package/dist/src/engine/executor.js +832 -0
- package/dist/src/engine/index.js +39 -0
- package/dist/src/engine/orchestrator.js +436 -0
- package/dist/src/engine/planner.js +616 -0
- package/dist/src/engine/safety.js +609 -0
- package/dist/src/engine/verifier.js +664 -0
- package/dist/src/enterprise/audit.js +241 -0
- package/dist/src/enterprise/auth.js +189 -0
- package/dist/src/enterprise/billing.js +512 -0
- package/dist/src/enterprise/index.js +16 -0
- package/dist/src/enterprise/teams.js +315 -0
- package/dist/src/generator/best-practices.js +1375 -0
- package/dist/src/generator/helm.js +495 -0
- package/dist/src/generator/index.js +11 -0
- package/dist/src/generator/intent-parser.js +420 -0
- package/dist/src/generator/kubernetes.js +773 -0
- package/dist/src/generator/terraform.js +1472 -0
- package/dist/src/history/index.js +6 -0
- package/dist/src/history/manager.js +199 -0
- package/dist/src/history/types.js +6 -0
- package/dist/src/hooks/config.js +318 -0
- package/dist/src/hooks/engine.js +317 -0
- package/dist/src/hooks/index.js +2 -0
- package/dist/src/llm/auth-bridge.js +157 -0
- package/dist/src/llm/circuit-breaker.js +116 -0
- package/dist/src/llm/config-loader.js +172 -0
- package/dist/src/llm/cost-calculator.js +137 -0
- package/dist/src/llm/index.js +7 -0
- package/dist/src/llm/model-aliases.js +99 -0
- package/dist/src/llm/provider-registry.js +57 -0
- package/dist/src/llm/providers/anthropic.js +430 -0
- package/dist/src/llm/providers/bedrock.js +409 -0
- package/dist/src/llm/providers/google.js +344 -0
- package/dist/src/llm/providers/ollama.js +661 -0
- package/dist/src/llm/providers/openai-compatible.js +289 -0
- package/dist/src/llm/providers/openai.js +284 -0
- package/dist/src/llm/providers/openrouter.js +293 -0
- package/dist/src/llm/router.js +844 -0
- package/dist/src/llm/types.js +69 -0
- package/dist/src/lsp/client.js +239 -0
- package/dist/src/lsp/languages.js +95 -0
- package/dist/src/lsp/manager.js +243 -0
- package/dist/src/mcp/client.js +289 -0
- package/dist/src/mcp/index.js +5 -0
- package/dist/src/mcp/manager.js +113 -0
- package/dist/src/nimbus.js +212 -0
- package/dist/src/plugins/index.js +13 -0
- package/dist/src/plugins/loader.js +280 -0
- package/dist/src/plugins/manager.js +282 -0
- package/dist/src/plugins/types.js +23 -0
- package/dist/src/scanners/cicd-scanner.js +230 -0
- package/dist/src/scanners/cloud-scanner.js +415 -0
- package/dist/src/scanners/framework-scanner.js +430 -0
- package/dist/src/scanners/iac-scanner.js +350 -0
- package/dist/src/scanners/index.js +454 -0
- package/dist/src/scanners/language-scanner.js +258 -0
- package/dist/src/scanners/package-manager-scanner.js +252 -0
- package/dist/src/scanners/types.js +6 -0
- package/dist/src/sessions/manager.js +395 -0
- package/dist/src/sessions/types.js +4 -0
- package/dist/src/sharing/sync.js +238 -0
- package/dist/src/sharing/viewer.js +131 -0
- package/dist/src/snapshots/index.js +1 -0
- package/dist/src/snapshots/manager.js +432 -0
- package/dist/src/state/artifacts.js +94 -0
- package/dist/src/state/audit.js +73 -0
- package/dist/src/state/billing.js +126 -0
- package/dist/src/state/checkpoints.js +81 -0
- package/dist/src/state/config.js +58 -0
- package/dist/src/state/conversations.js +7 -0
- package/dist/src/state/credentials.js +96 -0
- package/dist/src/state/db.js +53 -0
- package/dist/src/state/index.js +23 -0
- package/dist/src/state/messages.js +76 -0
- package/dist/src/state/projects.js +92 -0
- package/dist/src/state/schema.js +233 -0
- package/dist/src/state/sessions.js +79 -0
- package/dist/src/state/teams.js +131 -0
- package/dist/src/telemetry.js +91 -0
- package/dist/src/tools/aws-ops.js +747 -0
- package/dist/src/tools/azure-ops.js +491 -0
- package/dist/src/tools/file-ops.js +451 -0
- package/dist/src/tools/gcp-ops.js +559 -0
- package/dist/src/tools/git-ops.js +557 -0
- package/dist/src/tools/github-ops.js +460 -0
- package/dist/src/tools/helm-ops.js +634 -0
- package/dist/src/tools/index.js +16 -0
- package/dist/src/tools/k8s-ops.js +579 -0
- package/dist/src/tools/schemas/converter.js +129 -0
- package/dist/src/tools/schemas/devops.js +3319 -0
- package/dist/src/tools/schemas/index.js +19 -0
- package/dist/src/tools/schemas/standard.js +966 -0
- package/dist/src/tools/schemas/types.js +409 -0
- package/dist/src/tools/spawn-exec.js +109 -0
- package/dist/src/tools/terraform-ops.js +627 -0
- package/dist/src/types/config.js +1 -0
- package/dist/src/types/drift.js +4 -0
- package/dist/src/types/enterprise.js +5 -0
- package/dist/src/types/index.js +14 -0
- package/dist/src/types/plan.js +1 -0
- package/dist/src/types/request.js +1 -0
- package/dist/src/types/response.js +1 -0
- package/dist/src/types/service.js +1 -0
- package/dist/src/ui/App.js +1672 -0
- package/dist/src/ui/DeployPreview.js +60 -0
- package/dist/src/ui/FileDiffModal.js +108 -0
- package/dist/src/ui/Header.js +46 -0
- package/dist/src/ui/HelpModal.js +9 -0
- package/dist/src/ui/InputBox.js +408 -0
- package/dist/src/ui/MessageList.js +795 -0
- package/dist/src/ui/PermissionPrompt.js +72 -0
- package/dist/src/ui/StatusBar.js +109 -0
- package/dist/src/ui/TerminalPane.js +31 -0
- package/dist/src/ui/ToolCallDisplay.js +303 -0
- package/dist/src/ui/TreePane.js +83 -0
- package/dist/src/ui/chat-ui.js +721 -0
- package/dist/src/ui/index.js +11 -0
- package/dist/src/ui/ink/index.js +1325 -0
- package/dist/src/ui/streaming.js +137 -0
- package/dist/src/ui/theme.js +78 -0
- package/dist/src/ui/types.js +7 -0
- package/dist/src/utils/analytics.js +61 -0
- package/dist/src/utils/cost-warning.js +25 -0
- package/dist/src/utils/env.js +42 -0
- package/dist/src/utils/errors.js +54 -0
- package/dist/src/utils/event-bus.js +22 -0
- package/dist/src/utils/index.js +16 -0
- package/dist/src/utils/logger.js +150 -0
- package/dist/src/utils/rate-limiter.js +90 -0
- package/dist/src/utils/service-auth.js +36 -0
- package/dist/src/utils/validation.js +39 -0
- package/dist/src/version.js +3 -0
- package/dist/src/watcher/index.js +192 -0
- package/dist/src/wizard/approval.js +275 -0
- package/dist/src/wizard/index.js +13 -0
- package/dist/src/wizard/prompts.js +273 -0
- package/dist/src/wizard/types.js +4 -0
- package/dist/src/wizard/ui.js +453 -0
- package/dist/src/wizard/wizard.js +227 -0
- package/package.json +31 -23
- package/src/__tests__/alias.test.ts +133 -0
- package/src/__tests__/app.test.ts +1 -1
- package/src/__tests__/audit.test.ts +1 -1
- package/src/__tests__/circuit-breaker.test.ts +1 -1
- package/src/__tests__/cli-run.test.ts +237 -1
- package/src/__tests__/compat-sqlite.test.ts +68 -0
- package/src/__tests__/context-manager.test.ts +131 -1
- package/src/__tests__/context.test.ts +1 -1
- package/src/__tests__/devops-terminal-gaps.test.ts +718 -0
- package/src/__tests__/doctor.test.ts +48 -0
- package/src/__tests__/enterprise.test.ts +1 -1
- package/src/__tests__/export.test.ts +236 -0
- package/src/__tests__/gap-11-18-20.test.ts +958 -0
- package/src/__tests__/generator.test.ts +1 -1
- package/src/__tests__/helm-streaming.test.ts +127 -0
- package/src/__tests__/hooks.test.ts +1 -1
- package/src/__tests__/incident.test.ts +179 -0
- package/src/__tests__/init.test.ts +55 -4
- package/src/__tests__/intent-parser.test.ts +1 -1
- package/src/__tests__/llm-router.test.ts +1 -1
- package/src/__tests__/logs.test.ts +107 -0
- package/src/__tests__/loop-errors.test.ts +244 -0
- package/src/__tests__/lsp.test.ts +1 -1
- package/src/__tests__/modes.test.ts +1 -1
- package/src/__tests__/perf-optimizations.test.ts +847 -0
- package/src/__tests__/permissions.test.ts +1 -1
- package/src/__tests__/pipeline.test.ts +50 -0
- package/src/__tests__/polish-phase3.test.ts +340 -0
- package/src/__tests__/profile.test.ts +237 -0
- package/src/__tests__/rollback.test.ts +83 -0
- package/src/__tests__/runbook.test.ts +219 -0
- package/src/__tests__/schedule.test.ts +206 -0
- package/src/__tests__/serve.test.ts +1 -1
- package/src/__tests__/sessions.test.ts +96 -1
- package/src/__tests__/sharing.test.ts +53 -1
- package/src/__tests__/snapshots.test.ts +1 -1
- package/src/__tests__/standalone-migration.test.ts +199 -0
- package/src/__tests__/state-db.test.ts +1 -1
- package/src/__tests__/status.test.ts +158 -0
- package/src/__tests__/stream-with-tools.test.ts +71 -25
- package/src/__tests__/subagents.test.ts +1 -1
- package/src/__tests__/system-prompt.test.ts +82 -3
- package/src/__tests__/terminal-gap-v2.test.ts +395 -0
- package/src/__tests__/terminal-parity.test.ts +393 -0
- package/src/__tests__/tf-apply.test.ts +187 -0
- package/src/__tests__/tool-converter.test.ts +1 -1
- package/src/__tests__/tool-schemas.test.ts +209 -4
- package/src/__tests__/tools.test.ts +4 -3
- package/src/__tests__/version-json.test.ts +184 -0
- package/src/__tests__/version.test.ts +1 -1
- package/src/__tests__/watch.test.ts +129 -0
- package/src/agent/compaction-agent.ts +40 -1
- package/src/agent/context-manager.ts +67 -3
- package/src/agent/deploy-preview.ts +62 -1
- package/src/agent/expand-files.ts +108 -0
- package/src/agent/loop.ts +1312 -31
- package/src/agent/permissions.ts +51 -4
- package/src/agent/system-prompt.ts +573 -19
- package/src/app.ts +58 -0
- package/src/audit/security-scanner.ts +45 -0
- package/src/auth/keychain.ts +82 -0
- package/src/auth/oauth.ts +15 -5
- package/src/cli/init.ts +378 -5
- package/src/cli/run.ts +407 -16
- package/src/cli/serve.ts +78 -1
- package/src/cli/web.ts +10 -6
- package/src/cli.ts +312 -1
- package/src/clients/service-discovery.ts +30 -25
- package/src/commands/alias.ts +100 -0
- package/src/commands/audit/index.ts +121 -2
- package/src/commands/auth-cloud.ts +113 -0
- package/src/commands/auth-refresh.ts +187 -0
- package/src/commands/aws-discover.ts +144 -251
- package/src/commands/aws-terraform.ts +68 -118
- package/src/commands/chat.ts +9 -3
- package/src/commands/completions.ts +268 -0
- package/src/commands/config.ts +26 -0
- package/src/commands/cost/index.ts +218 -2
- package/src/commands/deploy.ts +260 -0
- package/src/commands/doctor.ts +744 -152
- package/src/commands/drift/index.ts +371 -23
- package/src/commands/export.ts +146 -0
- package/src/commands/generate-k8s.ts +9 -61
- package/src/commands/generate-terraform.ts +191 -449
- package/src/commands/help.ts +212 -36
- package/src/commands/history.ts +8 -1
- package/src/commands/incident.ts +166 -0
- package/src/commands/init.ts +5 -0
- package/src/commands/login.ts +86 -1
- package/src/commands/logs.ts +167 -0
- package/src/commands/onboarding.ts +211 -34
- package/src/commands/pipeline.ts +186 -0
- package/src/commands/plugin.ts +398 -0
- package/src/commands/profile.ts +342 -0
- package/src/commands/questionnaire.ts +0 -98
- package/src/commands/resume.ts +26 -34
- package/src/commands/rollback.ts +315 -0
- package/src/commands/rollout.ts +88 -0
- package/src/commands/runbook.ts +346 -0
- package/src/commands/schedule.ts +236 -0
- package/src/commands/status.ts +252 -0
- package/src/commands/team-context.ts +220 -0
- package/src/commands/template.ts +58 -57
- package/src/commands/tf/index.ts +70 -11
- package/src/commands/upgrade.ts +57 -0
- package/src/commands/version.ts +54 -50
- package/src/commands/watch.ts +153 -0
- package/src/compat/runtime.ts +1 -1
- package/src/compat/sqlite.ts +75 -5
- package/src/config/mode-store.ts +62 -0
- package/src/config/profiles.ts +84 -0
- package/src/config/types.ts +83 -1
- package/src/config/workspace-state.ts +53 -0
- package/src/engine/cost-estimator.ts +52 -10
- package/src/engine/executor.ts +33 -2
- package/src/engine/planner.ts +68 -1
- package/src/generator/terraform.ts +8 -0
- package/src/history/manager.ts +2 -74
- package/src/hooks/engine.ts +5 -4
- package/src/llm/cost-calculator.ts +2 -2
- package/src/llm/providers/anthropic.ts +50 -21
- package/src/llm/router.ts +76 -7
- package/src/lsp/languages.ts +3 -0
- package/src/lsp/manager.ts +21 -5
- package/src/nimbus.ts +37 -18
- package/src/sessions/manager.ts +108 -1
- package/src/sharing/sync.ts +4 -0
- package/src/sharing/viewer.ts +66 -0
- package/src/tools/file-ops.ts +22 -0
- package/src/tools/schemas/devops.ts +3007 -117
- package/src/tools/schemas/standard.ts +5 -1
- package/src/tools/schemas/types.ts +31 -1
- package/src/tools/spawn-exec.ts +148 -0
- package/src/ui/App.tsx +1183 -66
- package/src/ui/DeployPreview.tsx +62 -57
- package/src/ui/FileDiffModal.tsx +162 -0
- package/src/ui/Header.tsx +87 -24
- package/src/ui/HelpModal.tsx +57 -0
- package/src/ui/InputBox.tsx +163 -10
- package/src/ui/MessageList.tsx +487 -40
- package/src/ui/PermissionPrompt.tsx +17 -5
- package/src/ui/StatusBar.tsx +122 -3
- package/src/ui/TerminalPane.tsx +84 -0
- package/src/ui/ToolCallDisplay.tsx +252 -18
- package/src/ui/TreePane.tsx +132 -0
- package/src/ui/chat-ui.ts +41 -44
- package/src/ui/ink/index.ts +771 -38
- package/src/ui/streaming.ts +1 -1
- package/src/ui/theme.ts +104 -0
- package/src/ui/types.ts +18 -0
- package/src/version.ts +1 -1
- package/src/watcher/index.ts +66 -15
- package/src/wizard/types.ts +1 -0
- package/src/wizard/ui.ts +1 -1
- package/tsconfig.json +2 -2
|
@@ -0,0 +1,1021 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Questionnaire Command
|
|
3
|
+
*
|
|
4
|
+
* Interactive questionnaire flow for generating infrastructure code
|
|
5
|
+
*
|
|
6
|
+
* Usage:
|
|
7
|
+
* nimbus questionnaire terraform
|
|
8
|
+
* nimbus questionnaire kubernetes
|
|
9
|
+
* nimbus questionnaire helm
|
|
10
|
+
* nimbus generate terraform --interactive
|
|
11
|
+
*/
|
|
12
|
+
import { logger } from '../utils';
|
|
13
|
+
import { ui } from '../wizard/ui';
|
|
14
|
+
import { select, input, confirm, multiSelect } from '../wizard/prompts';
|
|
15
|
+
/**
|
|
16
|
+
* Run questionnaire command
|
|
17
|
+
*/
|
|
18
|
+
export async function questionnaireCommand(options) {
|
|
19
|
+
logger.info('Starting questionnaire', { type: options.type });
|
|
20
|
+
ui.newLine();
|
|
21
|
+
ui.header(`${capitalize(options.type)} Configuration Wizard`);
|
|
22
|
+
await runLocal(options);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Run questionnaire locally
|
|
26
|
+
*/
|
|
27
|
+
async function runLocal(options) {
|
|
28
|
+
ui.info('Starting local questionnaire...');
|
|
29
|
+
ui.newLine();
|
|
30
|
+
const answers = {};
|
|
31
|
+
// Get questionnaire steps based on type
|
|
32
|
+
const steps = getLocalQuestionnaireSteps(options.type);
|
|
33
|
+
for (let i = 0; i < steps.length; i++) {
|
|
34
|
+
const step = steps[i];
|
|
35
|
+
// Check step condition
|
|
36
|
+
if (step.condition && !step.condition(answers)) {
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
39
|
+
// Display step header
|
|
40
|
+
ui.print(ui.bold(`Step ${i + 1}/${steps.length}: ${step.title}`));
|
|
41
|
+
if (step.description) {
|
|
42
|
+
ui.print(ui.dim(step.description));
|
|
43
|
+
}
|
|
44
|
+
ui.newLine();
|
|
45
|
+
// Process questions
|
|
46
|
+
for (const question of step.questions) {
|
|
47
|
+
// Check question dependency
|
|
48
|
+
if (question.dependsOn) {
|
|
49
|
+
const depValue = answers[question.dependsOn.questionId];
|
|
50
|
+
if (depValue !== question.dependsOn.value) {
|
|
51
|
+
continue;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
const answer = await askQuestion(question, answers);
|
|
55
|
+
answers[question.id] = answer;
|
|
56
|
+
}
|
|
57
|
+
// Show progress
|
|
58
|
+
displayProgress({
|
|
59
|
+
current: i + 1,
|
|
60
|
+
total: steps.length,
|
|
61
|
+
percentage: Math.round(((i + 1) / steps.length) * 100),
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
ui.newLine();
|
|
65
|
+
ui.success('Questionnaire completed!');
|
|
66
|
+
if (!options.dryRun) {
|
|
67
|
+
// Generate code from answers
|
|
68
|
+
await generateFromAnswers(answers, options.type, options);
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
ui.newLine();
|
|
72
|
+
ui.print(ui.bold('Collected answers:'));
|
|
73
|
+
ui.print(JSON.stringify(answers, null, 2));
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Ask a single question and return the answer
|
|
78
|
+
*/
|
|
79
|
+
async function askQuestion(question, currentAnswers) {
|
|
80
|
+
// Substitute variables in label and description
|
|
81
|
+
const label = substituteVariables(question.label, currentAnswers);
|
|
82
|
+
const _description = question.description
|
|
83
|
+
? substituteVariables(question.description, currentAnswers)
|
|
84
|
+
: undefined;
|
|
85
|
+
switch (question.type) {
|
|
86
|
+
case 'select':
|
|
87
|
+
return select({
|
|
88
|
+
message: label,
|
|
89
|
+
options: question.options || [],
|
|
90
|
+
});
|
|
91
|
+
case 'multiselect':
|
|
92
|
+
return multiSelect({
|
|
93
|
+
message: label,
|
|
94
|
+
options: question.options || [],
|
|
95
|
+
});
|
|
96
|
+
case 'text':
|
|
97
|
+
return input({
|
|
98
|
+
message: label,
|
|
99
|
+
defaultValue: question.default,
|
|
100
|
+
});
|
|
101
|
+
case 'number': {
|
|
102
|
+
const numStr = await input({
|
|
103
|
+
message: label,
|
|
104
|
+
defaultValue: String(question.default ?? ''),
|
|
105
|
+
});
|
|
106
|
+
return parseInt(numStr, 10);
|
|
107
|
+
}
|
|
108
|
+
case 'confirm':
|
|
109
|
+
return confirm({
|
|
110
|
+
message: label,
|
|
111
|
+
defaultValue: question.default,
|
|
112
|
+
});
|
|
113
|
+
default:
|
|
114
|
+
return input({
|
|
115
|
+
message: label,
|
|
116
|
+
defaultValue: question.default,
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Substitute variables in text ({{variable}} format)
|
|
122
|
+
*/
|
|
123
|
+
function substituteVariables(text, answers) {
|
|
124
|
+
return text.replace(/\{\{(\w+)\}\}/g, (_, key) => {
|
|
125
|
+
const value = answers[key];
|
|
126
|
+
return value !== undefined ? String(value) : `{{${key}}}`;
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Display progress bar
|
|
131
|
+
*/
|
|
132
|
+
function displayProgress(progress) {
|
|
133
|
+
const barWidth = 30;
|
|
134
|
+
const filled = Math.round((progress.current / progress.total) * barWidth);
|
|
135
|
+
const empty = barWidth - filled;
|
|
136
|
+
const bar = ui.color('█'.repeat(filled), 'green') + ui.dim('░'.repeat(empty));
|
|
137
|
+
ui.newLine();
|
|
138
|
+
ui.print(` Progress: ${bar} ${progress.percentage}%`);
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Generate code from answers
|
|
142
|
+
*/
|
|
143
|
+
async function generateFromAnswers(answers, type, options) {
|
|
144
|
+
ui.newLine();
|
|
145
|
+
ui.startSpinner({ message: 'Generating code...' });
|
|
146
|
+
try {
|
|
147
|
+
const outputDir = options.outputDir || `./${type}`;
|
|
148
|
+
const fs = await import('fs/promises');
|
|
149
|
+
const path = await import('path');
|
|
150
|
+
// Ensure output directory exists
|
|
151
|
+
await fs.mkdir(outputDir, { recursive: true });
|
|
152
|
+
// Generate code based on type
|
|
153
|
+
let files = [];
|
|
154
|
+
if (type === 'terraform') {
|
|
155
|
+
files = await generateTerraformCode(answers, outputDir, fs, path);
|
|
156
|
+
}
|
|
157
|
+
else if (type === 'kubernetes') {
|
|
158
|
+
files = await generateKubernetesCode(answers, outputDir, fs, path);
|
|
159
|
+
}
|
|
160
|
+
else if (type === 'helm') {
|
|
161
|
+
files = await generateHelmCode(answers, outputDir, fs, path);
|
|
162
|
+
}
|
|
163
|
+
ui.stopSpinnerSuccess('Code generated successfully');
|
|
164
|
+
// Display generated files
|
|
165
|
+
ui.newLine();
|
|
166
|
+
ui.print(ui.bold('Generated files:'));
|
|
167
|
+
for (const file of files) {
|
|
168
|
+
ui.print(` ${ui.color('●', 'green')} ${file}`);
|
|
169
|
+
}
|
|
170
|
+
ui.newLine();
|
|
171
|
+
ui.print(`Output directory: ${outputDir}`);
|
|
172
|
+
// Run post-generation validation for Terraform
|
|
173
|
+
if (type === 'terraform') {
|
|
174
|
+
await runPostGenerationValidation(outputDir);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
catch (error) {
|
|
178
|
+
ui.stopSpinnerFail('Code generation failed');
|
|
179
|
+
ui.error(error.message);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Generate Terraform code from answers
|
|
184
|
+
*/
|
|
185
|
+
async function generateTerraformCode(answers, outputDir, fs, path) {
|
|
186
|
+
const files = [];
|
|
187
|
+
// Generate main.tf
|
|
188
|
+
const mainContent = generateTerraformMain(answers);
|
|
189
|
+
const mainPath = path.join(outputDir, 'main.tf');
|
|
190
|
+
await fs.writeFile(mainPath, mainContent);
|
|
191
|
+
files.push('main.tf');
|
|
192
|
+
// Generate variables.tf
|
|
193
|
+
const varsContent = generateTerraformVariables(answers);
|
|
194
|
+
const varsPath = path.join(outputDir, 'variables.tf');
|
|
195
|
+
await fs.writeFile(varsPath, varsContent);
|
|
196
|
+
files.push('variables.tf');
|
|
197
|
+
// Generate outputs.tf
|
|
198
|
+
const outputsContent = generateTerraformOutputs(answers);
|
|
199
|
+
const outputsPath = path.join(outputDir, 'outputs.tf');
|
|
200
|
+
await fs.writeFile(outputsPath, outputsContent);
|
|
201
|
+
files.push('outputs.tf');
|
|
202
|
+
// Generate environment directories if environments were selected
|
|
203
|
+
const environments = answers.environments;
|
|
204
|
+
if (environments && environments.length > 0) {
|
|
205
|
+
const envFiles = await generateEnvironmentDirs(answers, outputDir, fs, path);
|
|
206
|
+
files.push(...envFiles);
|
|
207
|
+
}
|
|
208
|
+
return files;
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Generate Terraform main.tf content
|
|
212
|
+
*/
|
|
213
|
+
function generateTerraformMain(answers) {
|
|
214
|
+
const provider = answers.provider || 'aws';
|
|
215
|
+
const _region = answers.region || 'us-east-1';
|
|
216
|
+
let content = `# Generated by Nimbus CLI
|
|
217
|
+
|
|
218
|
+
terraform {
|
|
219
|
+
required_version = ">= 1.0.0"
|
|
220
|
+
|
|
221
|
+
required_providers {
|
|
222
|
+
${provider} = {
|
|
223
|
+
source = "hashicorp/${provider}"
|
|
224
|
+
version = "~> 5.0"
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
provider "${provider}" {
|
|
230
|
+
region = var.region
|
|
231
|
+
}
|
|
232
|
+
`;
|
|
233
|
+
// Add VPC if selected
|
|
234
|
+
const components = answers.components || [];
|
|
235
|
+
if (components.includes('vpc')) {
|
|
236
|
+
const vpcCidr = answers.vpc_cidr || '10.0.0.0/16';
|
|
237
|
+
content += `
|
|
238
|
+
# VPC
|
|
239
|
+
module "vpc" {
|
|
240
|
+
source = "terraform-aws-modules/vpc/aws"
|
|
241
|
+
version = "~> 5.0"
|
|
242
|
+
|
|
243
|
+
name = var.project_name
|
|
244
|
+
cidr = "${vpcCidr}"
|
|
245
|
+
|
|
246
|
+
azs = var.availability_zones
|
|
247
|
+
private_subnets = var.private_subnets
|
|
248
|
+
public_subnets = var.public_subnets
|
|
249
|
+
|
|
250
|
+
enable_nat_gateway = true
|
|
251
|
+
single_nat_gateway = true
|
|
252
|
+
|
|
253
|
+
tags = var.tags
|
|
254
|
+
}
|
|
255
|
+
`;
|
|
256
|
+
}
|
|
257
|
+
return content;
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* Generate Terraform variables.tf content
|
|
261
|
+
*/
|
|
262
|
+
function generateTerraformVariables(answers) {
|
|
263
|
+
const projectName = answers.project_name || 'my-project';
|
|
264
|
+
return `# Generated by Nimbus CLI
|
|
265
|
+
|
|
266
|
+
variable "region" {
|
|
267
|
+
description = "AWS region"
|
|
268
|
+
type = string
|
|
269
|
+
default = "us-east-1"
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
variable "project_name" {
|
|
273
|
+
description = "Project name"
|
|
274
|
+
type = string
|
|
275
|
+
default = "${projectName}"
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
variable "environment" {
|
|
279
|
+
description = "Environment (dev, staging, prod)"
|
|
280
|
+
type = string
|
|
281
|
+
default = "dev"
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
variable "availability_zones" {
|
|
285
|
+
description = "List of availability zones"
|
|
286
|
+
type = list(string)
|
|
287
|
+
default = ["us-east-1a", "us-east-1b", "us-east-1c"]
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
variable "private_subnets" {
|
|
291
|
+
description = "Private subnet CIDRs"
|
|
292
|
+
type = list(string)
|
|
293
|
+
default = ["10.0.1.0/24", "10.0.2.0/24", "10.0.3.0/24"]
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
variable "public_subnets" {
|
|
297
|
+
description = "Public subnet CIDRs"
|
|
298
|
+
type = list(string)
|
|
299
|
+
default = ["10.0.101.0/24", "10.0.102.0/24", "10.0.103.0/24"]
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
variable "tags" {
|
|
303
|
+
description = "Tags to apply to resources"
|
|
304
|
+
type = map(string)
|
|
305
|
+
default = {}
|
|
306
|
+
}
|
|
307
|
+
`;
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* Generate Terraform outputs.tf content
|
|
311
|
+
*/
|
|
312
|
+
function generateTerraformOutputs(answers) {
|
|
313
|
+
const components = answers.components || [];
|
|
314
|
+
let content = `# Generated by Nimbus CLI
|
|
315
|
+
`;
|
|
316
|
+
if (components.includes('vpc')) {
|
|
317
|
+
content += `
|
|
318
|
+
output "vpc_id" {
|
|
319
|
+
description = "VPC ID"
|
|
320
|
+
value = module.vpc.vpc_id
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
output "private_subnets" {
|
|
324
|
+
description = "Private subnet IDs"
|
|
325
|
+
value = module.vpc.private_subnets
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
output "public_subnets" {
|
|
329
|
+
description = "Public subnet IDs"
|
|
330
|
+
value = module.vpc.public_subnets
|
|
331
|
+
}
|
|
332
|
+
`;
|
|
333
|
+
}
|
|
334
|
+
return content;
|
|
335
|
+
}
|
|
336
|
+
/**
|
|
337
|
+
* Generate Kubernetes code from answers
|
|
338
|
+
*/
|
|
339
|
+
async function generateKubernetesCode(answers, outputDir, fs, path) {
|
|
340
|
+
const files = [];
|
|
341
|
+
const appName = answers.app_name || 'my-app';
|
|
342
|
+
// Generate deployment.yaml
|
|
343
|
+
const deploymentContent = `# Generated by Nimbus CLI
|
|
344
|
+
apiVersion: apps/v1
|
|
345
|
+
kind: Deployment
|
|
346
|
+
metadata:
|
|
347
|
+
name: ${appName}
|
|
348
|
+
labels:
|
|
349
|
+
app: ${appName}
|
|
350
|
+
spec:
|
|
351
|
+
replicas: ${answers.replicas || 2}
|
|
352
|
+
selector:
|
|
353
|
+
matchLabels:
|
|
354
|
+
app: ${appName}
|
|
355
|
+
template:
|
|
356
|
+
metadata:
|
|
357
|
+
labels:
|
|
358
|
+
app: ${appName}
|
|
359
|
+
spec:
|
|
360
|
+
containers:
|
|
361
|
+
- name: ${appName}
|
|
362
|
+
image: ${answers.image || 'nginx:latest'}
|
|
363
|
+
ports:
|
|
364
|
+
- containerPort: ${answers.port || 80}
|
|
365
|
+
resources:
|
|
366
|
+
requests:
|
|
367
|
+
cpu: ${answers.cpu_request || '100m'}
|
|
368
|
+
memory: ${answers.memory_request || '128Mi'}
|
|
369
|
+
limits:
|
|
370
|
+
cpu: ${answers.cpu_limit || '500m'}
|
|
371
|
+
memory: ${answers.memory_limit || '512Mi'}
|
|
372
|
+
`;
|
|
373
|
+
const deploymentPath = path.join(outputDir, 'deployment.yaml');
|
|
374
|
+
await fs.writeFile(deploymentPath, deploymentContent);
|
|
375
|
+
files.push('deployment.yaml');
|
|
376
|
+
// Generate service.yaml if enabled
|
|
377
|
+
if (answers.create_service !== false) {
|
|
378
|
+
const serviceContent = `# Generated by Nimbus CLI
|
|
379
|
+
apiVersion: v1
|
|
380
|
+
kind: Service
|
|
381
|
+
metadata:
|
|
382
|
+
name: ${appName}
|
|
383
|
+
spec:
|
|
384
|
+
selector:
|
|
385
|
+
app: ${appName}
|
|
386
|
+
ports:
|
|
387
|
+
- protocol: TCP
|
|
388
|
+
port: ${answers.service_port || 80}
|
|
389
|
+
targetPort: ${answers.port || 80}
|
|
390
|
+
type: ${answers.service_type || 'ClusterIP'}
|
|
391
|
+
`;
|
|
392
|
+
const servicePath = path.join(outputDir, 'service.yaml');
|
|
393
|
+
await fs.writeFile(servicePath, serviceContent);
|
|
394
|
+
files.push('service.yaml');
|
|
395
|
+
}
|
|
396
|
+
return files;
|
|
397
|
+
}
|
|
398
|
+
/**
|
|
399
|
+
* Generate Helm chart code from answers
|
|
400
|
+
*/
|
|
401
|
+
async function generateHelmCode(answers, outputDir, fs, path) {
|
|
402
|
+
const files = [];
|
|
403
|
+
const chartName = answers.chart_name || 'my-chart';
|
|
404
|
+
// Create templates directory
|
|
405
|
+
const templatesDir = path.join(outputDir, 'templates');
|
|
406
|
+
await fs.mkdir(templatesDir, { recursive: true });
|
|
407
|
+
// Generate Chart.yaml
|
|
408
|
+
const chartContent = `# Generated by Nimbus CLI
|
|
409
|
+
apiVersion: v2
|
|
410
|
+
name: ${chartName}
|
|
411
|
+
description: ${answers.description || 'A Helm chart for Kubernetes'}
|
|
412
|
+
type: application
|
|
413
|
+
version: ${answers.version || '0.1.0'}
|
|
414
|
+
appVersion: "${answers.app_version || '1.0.0'}"
|
|
415
|
+
`;
|
|
416
|
+
const chartPath = path.join(outputDir, 'Chart.yaml');
|
|
417
|
+
await fs.writeFile(chartPath, chartContent);
|
|
418
|
+
files.push('Chart.yaml');
|
|
419
|
+
// Generate values.yaml
|
|
420
|
+
const valuesContent = `# Generated by Nimbus CLI
|
|
421
|
+
# Default values for ${chartName}
|
|
422
|
+
|
|
423
|
+
replicaCount: ${answers.replicas || 1}
|
|
424
|
+
|
|
425
|
+
image:
|
|
426
|
+
repository: ${answers.image_repository || 'nginx'}
|
|
427
|
+
tag: ${answers.image_tag || 'latest'}
|
|
428
|
+
pullPolicy: IfNotPresent
|
|
429
|
+
|
|
430
|
+
service:
|
|
431
|
+
type: ${answers.service_type || 'ClusterIP'}
|
|
432
|
+
port: ${answers.service_port || 80}
|
|
433
|
+
|
|
434
|
+
resources:
|
|
435
|
+
requests:
|
|
436
|
+
cpu: ${answers.cpu_request || '100m'}
|
|
437
|
+
memory: ${answers.memory_request || '128Mi'}
|
|
438
|
+
limits:
|
|
439
|
+
cpu: ${answers.cpu_limit || '500m'}
|
|
440
|
+
memory: ${answers.memory_limit || '512Mi'}
|
|
441
|
+
`;
|
|
442
|
+
const valuesPath = path.join(outputDir, 'values.yaml');
|
|
443
|
+
await fs.writeFile(valuesPath, valuesContent);
|
|
444
|
+
files.push('values.yaml');
|
|
445
|
+
return files;
|
|
446
|
+
}
|
|
447
|
+
/**
|
|
448
|
+
* Generate per-environment directories with module references
|
|
449
|
+
*/
|
|
450
|
+
async function generateEnvironmentDirs(answers, outputDir, fs, path) {
|
|
451
|
+
const environments = answers.environments;
|
|
452
|
+
const projectName = answers.project_name || 'my-project';
|
|
453
|
+
const _provider = answers.cloud || answers.provider || 'aws';
|
|
454
|
+
const region = answers.region || 'us-east-1';
|
|
455
|
+
const useRemoteState = answers.use_remote_state;
|
|
456
|
+
const files = [];
|
|
457
|
+
const envsDir = path.join(outputDir, 'environments');
|
|
458
|
+
await fs.mkdir(envsDir, { recursive: true });
|
|
459
|
+
for (const env of environments) {
|
|
460
|
+
const envDir = path.join(envsDir, env);
|
|
461
|
+
await fs.mkdir(envDir, { recursive: true });
|
|
462
|
+
// main.tf — module source pointing to root
|
|
463
|
+
const mainContent = `# ${env.charAt(0).toUpperCase() + env.slice(1)} Environment
|
|
464
|
+
# Generated by Nimbus CLI
|
|
465
|
+
|
|
466
|
+
module "infrastructure" {
|
|
467
|
+
source = "../../"
|
|
468
|
+
|
|
469
|
+
project_name = "${projectName}"
|
|
470
|
+
environment = "${env}"
|
|
471
|
+
region = var.region
|
|
472
|
+
|
|
473
|
+
tags = merge(var.tags, {
|
|
474
|
+
Environment = "${env}"
|
|
475
|
+
})
|
|
476
|
+
}
|
|
477
|
+
`;
|
|
478
|
+
await fs.writeFile(path.join(envDir, 'main.tf'), mainContent);
|
|
479
|
+
files.push(`environments/${env}/main.tf`);
|
|
480
|
+
// terraform.tfvars
|
|
481
|
+
const _instanceSize = env === 'prod' ? 't3.large' : env === 'staging' ? 't3.medium' : 't3.small';
|
|
482
|
+
const tfvarsContent = `# ${env.charAt(0).toUpperCase() + env.slice(1)} environment variables
|
|
483
|
+
# Generated by Nimbus CLI
|
|
484
|
+
|
|
485
|
+
region = "${region}"
|
|
486
|
+
|
|
487
|
+
tags = {
|
|
488
|
+
Environment = "${env}"
|
|
489
|
+
Project = "${projectName}"
|
|
490
|
+
ManagedBy = "terraform"
|
|
491
|
+
}
|
|
492
|
+
`;
|
|
493
|
+
await fs.writeFile(path.join(envDir, 'terraform.tfvars'), tfvarsContent);
|
|
494
|
+
files.push(`environments/${env}/terraform.tfvars`);
|
|
495
|
+
// backend.tf — remote state if selected
|
|
496
|
+
if (useRemoteState) {
|
|
497
|
+
const backendContent = `# Remote state configuration for ${env}
|
|
498
|
+
# Generated by Nimbus CLI
|
|
499
|
+
|
|
500
|
+
terraform {
|
|
501
|
+
backend "s3" {
|
|
502
|
+
bucket = "${projectName}-tfstate"
|
|
503
|
+
key = "${env}/terraform.tfstate"
|
|
504
|
+
region = "${region}"
|
|
505
|
+
encrypt = true
|
|
506
|
+
dynamodb_table = "${projectName}-tflock"
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
`;
|
|
510
|
+
await fs.writeFile(path.join(envDir, 'backend.tf'), backendContent);
|
|
511
|
+
files.push(`environments/${env}/backend.tf`);
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
return files;
|
|
515
|
+
}
|
|
516
|
+
/**
|
|
517
|
+
* Run post-generation validation on Terraform files
|
|
518
|
+
*/
|
|
519
|
+
async function runPostGenerationValidation(outputDir) {
|
|
520
|
+
const { execFile } = await import('child_process');
|
|
521
|
+
const { promisify } = await import('util');
|
|
522
|
+
const execFileAsync = promisify(execFile);
|
|
523
|
+
ui.newLine();
|
|
524
|
+
ui.section('Post-Generation Validation');
|
|
525
|
+
// Check if terraform CLI is available
|
|
526
|
+
let _hasTerraform = false;
|
|
527
|
+
try {
|
|
528
|
+
await execFileAsync('terraform', ['version'], { timeout: 5000 });
|
|
529
|
+
_hasTerraform = true;
|
|
530
|
+
}
|
|
531
|
+
catch {
|
|
532
|
+
ui.info('Terraform CLI not found - skipping validation');
|
|
533
|
+
ui.print(ui.dim(' Install terraform for automatic validation'));
|
|
534
|
+
return;
|
|
535
|
+
}
|
|
536
|
+
// Run terraform fmt -check
|
|
537
|
+
try {
|
|
538
|
+
ui.startSpinner({ message: 'Running terraform fmt...' });
|
|
539
|
+
await execFileAsync('terraform', ['fmt', '-check', '-diff'], {
|
|
540
|
+
cwd: outputDir,
|
|
541
|
+
timeout: 15000,
|
|
542
|
+
});
|
|
543
|
+
ui.stopSpinnerSuccess('Code formatting valid');
|
|
544
|
+
}
|
|
545
|
+
catch (error) {
|
|
546
|
+
ui.stopSpinnerFail('Formatting issues found');
|
|
547
|
+
// Try to auto-fix
|
|
548
|
+
try {
|
|
549
|
+
await execFileAsync('terraform', ['fmt'], { cwd: outputDir, timeout: 15000 });
|
|
550
|
+
ui.success('Auto-formatted Terraform files');
|
|
551
|
+
}
|
|
552
|
+
catch {
|
|
553
|
+
ui.warning('Could not auto-format files');
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
// Run terraform init -backend=false for validation
|
|
557
|
+
try {
|
|
558
|
+
ui.startSpinner({ message: 'Running terraform validate...' });
|
|
559
|
+
await execFileAsync('terraform', ['init', '-backend=false', '-no-color'], {
|
|
560
|
+
cwd: outputDir,
|
|
561
|
+
timeout: 30000,
|
|
562
|
+
});
|
|
563
|
+
const { stdout } = await execFileAsync('terraform', ['validate', '-no-color'], {
|
|
564
|
+
cwd: outputDir,
|
|
565
|
+
timeout: 15000,
|
|
566
|
+
});
|
|
567
|
+
ui.stopSpinnerSuccess('Terraform validation passed');
|
|
568
|
+
if (stdout.includes('Success')) {
|
|
569
|
+
ui.print(ui.dim(` ${stdout.trim()}`));
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
catch (error) {
|
|
573
|
+
ui.stopSpinnerFail('Terraform validation failed');
|
|
574
|
+
const output = error.stdout || error.stderr || error.message;
|
|
575
|
+
ui.print(ui.dim(` ${output}`));
|
|
576
|
+
}
|
|
577
|
+
// Check if tflint is available
|
|
578
|
+
try {
|
|
579
|
+
await execFileAsync('tflint', ['--version'], { timeout: 5000 });
|
|
580
|
+
ui.startSpinner({ message: 'Running tflint...' });
|
|
581
|
+
const { stdout } = await execFileAsync('tflint', ['--no-color'], {
|
|
582
|
+
cwd: outputDir,
|
|
583
|
+
timeout: 15000,
|
|
584
|
+
});
|
|
585
|
+
ui.stopSpinnerSuccess('tflint check passed');
|
|
586
|
+
if (stdout) {
|
|
587
|
+
ui.print(ui.dim(` ${stdout.trim()}`));
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
catch (error) {
|
|
591
|
+
if (error.code === 'ENOENT') {
|
|
592
|
+
ui.info('tflint not found - skipping lint check');
|
|
593
|
+
ui.print(ui.dim(' Install tflint for additional validation'));
|
|
594
|
+
}
|
|
595
|
+
else {
|
|
596
|
+
ui.warning('tflint found issues');
|
|
597
|
+
const output = error.stdout || error.stderr || error.message;
|
|
598
|
+
ui.print(ui.dim(` ${output}`));
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
// Check if checkov is available for security scanning
|
|
602
|
+
try {
|
|
603
|
+
await execFileAsync('checkov', ['--version'], { timeout: 5000 });
|
|
604
|
+
ui.startSpinner({ message: 'Running checkov security scan...' });
|
|
605
|
+
const { stdout } = await execFileAsync('checkov', ['-d', outputDir, '--framework', 'terraform', '--compact', '--quiet'], { timeout: 60000 });
|
|
606
|
+
ui.stopSpinnerSuccess('checkov security scan passed');
|
|
607
|
+
// Parse passed/failed from output
|
|
608
|
+
const passedMatch = stdout.match(/Passed checks: (\d+)/);
|
|
609
|
+
const failedMatch = stdout.match(/Failed checks: (\d+)/);
|
|
610
|
+
if (passedMatch || failedMatch) {
|
|
611
|
+
const passed = passedMatch ? passedMatch[1] : '0';
|
|
612
|
+
const failed = failedMatch ? failedMatch[1] : '0';
|
|
613
|
+
ui.print(ui.dim(` Passed: ${passed}, Failed: ${failed}`));
|
|
614
|
+
}
|
|
615
|
+
else if (stdout.trim()) {
|
|
616
|
+
ui.print(ui.dim(` ${stdout.trim()}`));
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
catch (error) {
|
|
620
|
+
if (error.code === 'ENOENT') {
|
|
621
|
+
ui.info('Security scanning available with checkov. Install: pip install checkov');
|
|
622
|
+
}
|
|
623
|
+
else {
|
|
624
|
+
ui.warning('checkov found security issues');
|
|
625
|
+
const output = error.stdout || error.stderr || error.message;
|
|
626
|
+
// Parse passed/failed from output even on non-zero exit
|
|
627
|
+
const passedMatch = output.match(/Passed checks: (\d+)/);
|
|
628
|
+
const failedMatch = output.match(/Failed checks: (\d+)/);
|
|
629
|
+
if (passedMatch || failedMatch) {
|
|
630
|
+
const passed = passedMatch ? passedMatch[1] : '0';
|
|
631
|
+
const failed = failedMatch ? failedMatch[1] : '0';
|
|
632
|
+
ui.print(ui.dim(` Passed: ${passed}, Failed: ${failed}`));
|
|
633
|
+
}
|
|
634
|
+
else {
|
|
635
|
+
ui.print(ui.dim(` ${output}`));
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
}
|
|
639
|
+
}
|
|
640
|
+
/**
|
|
641
|
+
* Get local questionnaire steps based on type
|
|
642
|
+
*/
|
|
643
|
+
function getLocalQuestionnaireSteps(type) {
|
|
644
|
+
switch (type) {
|
|
645
|
+
case 'terraform':
|
|
646
|
+
return getTerraformSteps();
|
|
647
|
+
case 'kubernetes':
|
|
648
|
+
return getKubernetesSteps();
|
|
649
|
+
case 'helm':
|
|
650
|
+
return getHelmSteps();
|
|
651
|
+
default:
|
|
652
|
+
return [];
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
/**
|
|
656
|
+
* Terraform questionnaire steps (local fallback)
|
|
657
|
+
*/
|
|
658
|
+
function getTerraformSteps() {
|
|
659
|
+
return [
|
|
660
|
+
{
|
|
661
|
+
id: 'provider',
|
|
662
|
+
title: 'Cloud Provider',
|
|
663
|
+
description: 'Select your cloud provider and region',
|
|
664
|
+
questions: [
|
|
665
|
+
{
|
|
666
|
+
id: 'cloud',
|
|
667
|
+
type: 'select',
|
|
668
|
+
label: 'Which cloud provider?',
|
|
669
|
+
options: [
|
|
670
|
+
{ value: 'aws', label: 'AWS', description: 'Amazon Web Services' },
|
|
671
|
+
{ value: 'gcp', label: 'GCP', description: 'Google Cloud Platform' },
|
|
672
|
+
{ value: 'azure', label: 'Azure', description: 'Microsoft Azure' },
|
|
673
|
+
],
|
|
674
|
+
default: 'aws',
|
|
675
|
+
},
|
|
676
|
+
{
|
|
677
|
+
id: 'region',
|
|
678
|
+
type: 'select',
|
|
679
|
+
label: 'Which region?',
|
|
680
|
+
options: [
|
|
681
|
+
{ value: 'us-east-1', label: 'US East (N. Virginia)' },
|
|
682
|
+
{ value: 'us-west-2', label: 'US West (Oregon)' },
|
|
683
|
+
{ value: 'eu-west-1', label: 'EU (Ireland)' },
|
|
684
|
+
{ value: 'ap-southeast-1', label: 'Asia Pacific (Singapore)' },
|
|
685
|
+
],
|
|
686
|
+
default: 'us-east-1',
|
|
687
|
+
dependsOn: { questionId: 'cloud', value: 'aws' },
|
|
688
|
+
},
|
|
689
|
+
{
|
|
690
|
+
id: 'project_name',
|
|
691
|
+
type: 'text',
|
|
692
|
+
label: 'Project name',
|
|
693
|
+
default: 'my-project',
|
|
694
|
+
},
|
|
695
|
+
{
|
|
696
|
+
id: 'environment',
|
|
697
|
+
type: 'select',
|
|
698
|
+
label: 'Environment',
|
|
699
|
+
options: [
|
|
700
|
+
{ value: 'dev', label: 'Development' },
|
|
701
|
+
{ value: 'staging', label: 'Staging' },
|
|
702
|
+
{ value: 'prod', label: 'Production' },
|
|
703
|
+
],
|
|
704
|
+
default: 'dev',
|
|
705
|
+
},
|
|
706
|
+
],
|
|
707
|
+
},
|
|
708
|
+
{
|
|
709
|
+
id: 'components',
|
|
710
|
+
title: 'Infrastructure Components',
|
|
711
|
+
description: 'Select the components you need',
|
|
712
|
+
questions: [
|
|
713
|
+
{
|
|
714
|
+
id: 'components',
|
|
715
|
+
type: 'multiselect',
|
|
716
|
+
label: 'What components do you need?',
|
|
717
|
+
options: [
|
|
718
|
+
{ value: 'vpc', label: 'VPC / Network' },
|
|
719
|
+
{ value: 'eks', label: 'Kubernetes (EKS)' },
|
|
720
|
+
{ value: 'rds', label: 'Database (RDS)' },
|
|
721
|
+
{ value: 's3', label: 'Object Storage (S3)' },
|
|
722
|
+
{ value: 'ecs', label: 'Container Service (ECS)' },
|
|
723
|
+
],
|
|
724
|
+
default: ['vpc'],
|
|
725
|
+
},
|
|
726
|
+
],
|
|
727
|
+
},
|
|
728
|
+
{
|
|
729
|
+
id: 'environments',
|
|
730
|
+
title: 'Environment Separation',
|
|
731
|
+
description: 'Configure environment-specific deployments',
|
|
732
|
+
questions: [
|
|
733
|
+
{
|
|
734
|
+
id: 'environments',
|
|
735
|
+
type: 'multiselect',
|
|
736
|
+
label: 'Which environments do you need?',
|
|
737
|
+
options: [
|
|
738
|
+
{ value: 'dev', label: 'Development' },
|
|
739
|
+
{ value: 'staging', label: 'Staging' },
|
|
740
|
+
{ value: 'prod', label: 'Production' },
|
|
741
|
+
],
|
|
742
|
+
default: ['dev'],
|
|
743
|
+
},
|
|
744
|
+
{
|
|
745
|
+
id: 'use_remote_state',
|
|
746
|
+
type: 'confirm',
|
|
747
|
+
label: 'Use remote state backend (S3)?',
|
|
748
|
+
default: true,
|
|
749
|
+
},
|
|
750
|
+
],
|
|
751
|
+
},
|
|
752
|
+
{
|
|
753
|
+
id: 'vpc_config',
|
|
754
|
+
title: 'VPC Configuration',
|
|
755
|
+
condition: (answers) => {
|
|
756
|
+
const components = answers.components;
|
|
757
|
+
return components && components.includes('vpc');
|
|
758
|
+
},
|
|
759
|
+
questions: [
|
|
760
|
+
{
|
|
761
|
+
id: 'vpc_cidr',
|
|
762
|
+
type: 'text',
|
|
763
|
+
label: 'VPC CIDR block',
|
|
764
|
+
default: '10.0.0.0/16',
|
|
765
|
+
},
|
|
766
|
+
{
|
|
767
|
+
id: 'availability_zones',
|
|
768
|
+
type: 'number',
|
|
769
|
+
label: 'Number of availability zones',
|
|
770
|
+
default: 3,
|
|
771
|
+
},
|
|
772
|
+
{
|
|
773
|
+
id: 'nat_gateway',
|
|
774
|
+
type: 'select',
|
|
775
|
+
label: 'NAT Gateway configuration',
|
|
776
|
+
options: [
|
|
777
|
+
{ value: 'single', label: 'Single NAT (~$32/month)' },
|
|
778
|
+
{ value: 'ha', label: 'HA NAT (one per AZ)' },
|
|
779
|
+
{ value: 'none', label: 'No NAT Gateway' },
|
|
780
|
+
],
|
|
781
|
+
default: 'single',
|
|
782
|
+
},
|
|
783
|
+
],
|
|
784
|
+
},
|
|
785
|
+
];
|
|
786
|
+
}
|
|
787
|
+
/**
|
|
788
|
+
* Kubernetes questionnaire steps (local fallback)
|
|
789
|
+
*/
|
|
790
|
+
function getKubernetesSteps() {
|
|
791
|
+
return [
|
|
792
|
+
{
|
|
793
|
+
id: 'workload',
|
|
794
|
+
title: 'Workload Type',
|
|
795
|
+
description: 'Configure your Kubernetes workload',
|
|
796
|
+
questions: [
|
|
797
|
+
{
|
|
798
|
+
id: 'workload_type',
|
|
799
|
+
type: 'select',
|
|
800
|
+
label: 'What type of workload?',
|
|
801
|
+
options: [
|
|
802
|
+
{
|
|
803
|
+
value: 'deployment',
|
|
804
|
+
label: 'Deployment',
|
|
805
|
+
description: 'Standard stateless workload',
|
|
806
|
+
},
|
|
807
|
+
{
|
|
808
|
+
value: 'statefulset',
|
|
809
|
+
label: 'StatefulSet',
|
|
810
|
+
description: 'Stateful workload with persistent storage',
|
|
811
|
+
},
|
|
812
|
+
{ value: 'daemonset', label: 'DaemonSet', description: 'Run on every node' },
|
|
813
|
+
{ value: 'cronjob', label: 'CronJob', description: 'Scheduled job' },
|
|
814
|
+
],
|
|
815
|
+
default: 'deployment',
|
|
816
|
+
},
|
|
817
|
+
{
|
|
818
|
+
id: 'name',
|
|
819
|
+
type: 'text',
|
|
820
|
+
label: 'Workload name',
|
|
821
|
+
default: 'my-app',
|
|
822
|
+
},
|
|
823
|
+
{
|
|
824
|
+
id: 'namespace',
|
|
825
|
+
type: 'text',
|
|
826
|
+
label: 'Namespace',
|
|
827
|
+
default: 'default',
|
|
828
|
+
},
|
|
829
|
+
],
|
|
830
|
+
},
|
|
831
|
+
{
|
|
832
|
+
id: 'container',
|
|
833
|
+
title: 'Container Configuration',
|
|
834
|
+
questions: [
|
|
835
|
+
{
|
|
836
|
+
id: 'image',
|
|
837
|
+
type: 'text',
|
|
838
|
+
label: 'Container image',
|
|
839
|
+
default: 'nginx:latest',
|
|
840
|
+
},
|
|
841
|
+
{
|
|
842
|
+
id: 'replicas',
|
|
843
|
+
type: 'number',
|
|
844
|
+
label: 'Number of replicas',
|
|
845
|
+
default: 3,
|
|
846
|
+
},
|
|
847
|
+
{
|
|
848
|
+
id: 'port',
|
|
849
|
+
type: 'number',
|
|
850
|
+
label: 'Container port',
|
|
851
|
+
default: 80,
|
|
852
|
+
},
|
|
853
|
+
],
|
|
854
|
+
},
|
|
855
|
+
{
|
|
856
|
+
id: 'service',
|
|
857
|
+
title: 'Service Configuration',
|
|
858
|
+
questions: [
|
|
859
|
+
{
|
|
860
|
+
id: 'service_type',
|
|
861
|
+
type: 'select',
|
|
862
|
+
label: 'Service type',
|
|
863
|
+
options: [
|
|
864
|
+
{ value: 'ClusterIP', label: 'ClusterIP', description: 'Internal only' },
|
|
865
|
+
{ value: 'NodePort', label: 'NodePort', description: 'External via node port' },
|
|
866
|
+
{ value: 'LoadBalancer', label: 'LoadBalancer', description: 'External load balancer' },
|
|
867
|
+
],
|
|
868
|
+
default: 'ClusterIP',
|
|
869
|
+
},
|
|
870
|
+
{
|
|
871
|
+
id: 'create_ingress',
|
|
872
|
+
type: 'confirm',
|
|
873
|
+
label: 'Create Ingress?',
|
|
874
|
+
default: false,
|
|
875
|
+
},
|
|
876
|
+
],
|
|
877
|
+
},
|
|
878
|
+
{
|
|
879
|
+
id: 'resources',
|
|
880
|
+
title: 'Resource Limits',
|
|
881
|
+
questions: [
|
|
882
|
+
{
|
|
883
|
+
id: 'cpu_request',
|
|
884
|
+
type: 'text',
|
|
885
|
+
label: 'CPU request',
|
|
886
|
+
default: '100m',
|
|
887
|
+
},
|
|
888
|
+
{
|
|
889
|
+
id: 'cpu_limit',
|
|
890
|
+
type: 'text',
|
|
891
|
+
label: 'CPU limit',
|
|
892
|
+
default: '500m',
|
|
893
|
+
},
|
|
894
|
+
{
|
|
895
|
+
id: 'memory_request',
|
|
896
|
+
type: 'text',
|
|
897
|
+
label: 'Memory request',
|
|
898
|
+
default: '128Mi',
|
|
899
|
+
},
|
|
900
|
+
{
|
|
901
|
+
id: 'memory_limit',
|
|
902
|
+
type: 'text',
|
|
903
|
+
label: 'Memory limit',
|
|
904
|
+
default: '512Mi',
|
|
905
|
+
},
|
|
906
|
+
],
|
|
907
|
+
},
|
|
908
|
+
];
|
|
909
|
+
}
|
|
910
|
+
/**
|
|
911
|
+
* Helm questionnaire steps (local fallback)
|
|
912
|
+
*/
|
|
913
|
+
function getHelmSteps() {
|
|
914
|
+
return [
|
|
915
|
+
{
|
|
916
|
+
id: 'chart',
|
|
917
|
+
title: 'Chart Information',
|
|
918
|
+
description: 'Basic Helm chart configuration',
|
|
919
|
+
questions: [
|
|
920
|
+
{
|
|
921
|
+
id: 'chart_name',
|
|
922
|
+
type: 'text',
|
|
923
|
+
label: 'Chart name',
|
|
924
|
+
default: 'my-chart',
|
|
925
|
+
},
|
|
926
|
+
{
|
|
927
|
+
id: 'chart_version',
|
|
928
|
+
type: 'text',
|
|
929
|
+
label: 'Chart version',
|
|
930
|
+
default: '0.1.0',
|
|
931
|
+
},
|
|
932
|
+
{
|
|
933
|
+
id: 'app_version',
|
|
934
|
+
type: 'text',
|
|
935
|
+
label: 'Application version',
|
|
936
|
+
default: '1.0.0',
|
|
937
|
+
},
|
|
938
|
+
{
|
|
939
|
+
id: 'description',
|
|
940
|
+
type: 'text',
|
|
941
|
+
label: 'Chart description',
|
|
942
|
+
default: 'A Helm chart for my application',
|
|
943
|
+
},
|
|
944
|
+
],
|
|
945
|
+
},
|
|
946
|
+
{
|
|
947
|
+
id: 'deployment',
|
|
948
|
+
title: 'Deployment Configuration',
|
|
949
|
+
questions: [
|
|
950
|
+
{
|
|
951
|
+
id: 'image_repository',
|
|
952
|
+
type: 'text',
|
|
953
|
+
label: 'Image repository',
|
|
954
|
+
default: 'nginx',
|
|
955
|
+
},
|
|
956
|
+
{
|
|
957
|
+
id: 'image_tag',
|
|
958
|
+
type: 'text',
|
|
959
|
+
label: 'Image tag',
|
|
960
|
+
default: 'latest',
|
|
961
|
+
},
|
|
962
|
+
{
|
|
963
|
+
id: 'replica_count',
|
|
964
|
+
type: 'number',
|
|
965
|
+
label: 'Replica count',
|
|
966
|
+
default: 1,
|
|
967
|
+
},
|
|
968
|
+
],
|
|
969
|
+
},
|
|
970
|
+
{
|
|
971
|
+
id: 'service',
|
|
972
|
+
title: 'Service Configuration',
|
|
973
|
+
questions: [
|
|
974
|
+
{
|
|
975
|
+
id: 'service_type',
|
|
976
|
+
type: 'select',
|
|
977
|
+
label: 'Service type',
|
|
978
|
+
options: [
|
|
979
|
+
{ value: 'ClusterIP', label: 'ClusterIP' },
|
|
980
|
+
{ value: 'NodePort', label: 'NodePort' },
|
|
981
|
+
{ value: 'LoadBalancer', label: 'LoadBalancer' },
|
|
982
|
+
],
|
|
983
|
+
default: 'ClusterIP',
|
|
984
|
+
},
|
|
985
|
+
{
|
|
986
|
+
id: 'service_port',
|
|
987
|
+
type: 'number',
|
|
988
|
+
label: 'Service port',
|
|
989
|
+
default: 80,
|
|
990
|
+
},
|
|
991
|
+
],
|
|
992
|
+
},
|
|
993
|
+
{
|
|
994
|
+
id: 'ingress',
|
|
995
|
+
title: 'Ingress Configuration',
|
|
996
|
+
questions: [
|
|
997
|
+
{
|
|
998
|
+
id: 'ingress_enabled',
|
|
999
|
+
type: 'confirm',
|
|
1000
|
+
label: 'Enable Ingress?',
|
|
1001
|
+
default: false,
|
|
1002
|
+
},
|
|
1003
|
+
{
|
|
1004
|
+
id: 'ingress_host',
|
|
1005
|
+
type: 'text',
|
|
1006
|
+
label: 'Ingress hostname',
|
|
1007
|
+
default: 'chart.local',
|
|
1008
|
+
dependsOn: { questionId: 'ingress_enabled', value: true },
|
|
1009
|
+
},
|
|
1010
|
+
],
|
|
1011
|
+
},
|
|
1012
|
+
];
|
|
1013
|
+
}
|
|
1014
|
+
/**
|
|
1015
|
+
* Capitalize first letter
|
|
1016
|
+
*/
|
|
1017
|
+
function capitalize(str) {
|
|
1018
|
+
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
1019
|
+
}
|
|
1020
|
+
// Export as default
|
|
1021
|
+
export default questionnaireCommand;
|