@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.
- package/LICENSE +21 -0
- package/README.md +628 -0
- package/bin/nimbus +38 -0
- package/package.json +80 -0
- package/src/__tests__/app.test.ts +76 -0
- package/src/__tests__/audit.test.ts +877 -0
- package/src/__tests__/circuit-breaker.test.ts +116 -0
- package/src/__tests__/cli-run.test.ts +115 -0
- package/src/__tests__/context-manager.test.ts +502 -0
- package/src/__tests__/context.test.ts +242 -0
- package/src/__tests__/enterprise.test.ts +401 -0
- package/src/__tests__/generator.test.ts +433 -0
- package/src/__tests__/hooks.test.ts +582 -0
- package/src/__tests__/init.test.ts +436 -0
- package/src/__tests__/intent-parser.test.ts +229 -0
- package/src/__tests__/llm-router.test.ts +209 -0
- package/src/__tests__/lsp.test.ts +293 -0
- package/src/__tests__/modes.test.ts +336 -0
- package/src/__tests__/permissions.test.ts +338 -0
- package/src/__tests__/serve.test.ts +275 -0
- package/src/__tests__/sessions.test.ts +227 -0
- package/src/__tests__/sharing.test.ts +288 -0
- package/src/__tests__/snapshots.test.ts +581 -0
- package/src/__tests__/state-db.test.ts +334 -0
- package/src/__tests__/stream-with-tools.test.ts +732 -0
- package/src/__tests__/subagents.test.ts +176 -0
- package/src/__tests__/system-prompt.test.ts +169 -0
- package/src/__tests__/tool-converter.test.ts +256 -0
- package/src/__tests__/tool-schemas.test.ts +397 -0
- package/src/__tests__/tools.test.ts +143 -0
- package/src/__tests__/version.test.ts +49 -0
- package/src/agent/compaction-agent.ts +227 -0
- package/src/agent/context-manager.ts +435 -0
- package/src/agent/context.ts +427 -0
- package/src/agent/deploy-preview.ts +426 -0
- package/src/agent/index.ts +68 -0
- package/src/agent/loop.ts +717 -0
- package/src/agent/modes.ts +429 -0
- package/src/agent/permissions.ts +466 -0
- package/src/agent/subagents/base.ts +116 -0
- package/src/agent/subagents/cost.ts +51 -0
- package/src/agent/subagents/explore.ts +42 -0
- package/src/agent/subagents/general.ts +54 -0
- package/src/agent/subagents/index.ts +102 -0
- package/src/agent/subagents/infra.ts +59 -0
- package/src/agent/subagents/security.ts +69 -0
- package/src/agent/system-prompt.ts +436 -0
- package/src/app.ts +122 -0
- package/src/audit/activity-log.ts +290 -0
- package/src/audit/compliance-checker.ts +540 -0
- package/src/audit/cost-tracker.ts +318 -0
- package/src/audit/index.ts +23 -0
- package/src/audit/security-scanner.ts +596 -0
- package/src/auth/guard.ts +75 -0
- package/src/auth/index.ts +56 -0
- package/src/auth/oauth.ts +455 -0
- package/src/auth/providers.ts +470 -0
- package/src/auth/sso.ts +113 -0
- package/src/auth/store.ts +505 -0
- package/src/auth/types.ts +187 -0
- package/src/build.ts +141 -0
- package/src/cli/index.ts +16 -0
- package/src/cli/init.ts +854 -0
- package/src/cli/openapi-spec.ts +356 -0
- package/src/cli/run.ts +237 -0
- package/src/cli/serve-auth.ts +80 -0
- package/src/cli/serve.ts +462 -0
- package/src/cli/web.ts +67 -0
- package/src/cli.ts +1417 -0
- package/src/clients/core-engine-client.ts +227 -0
- package/src/clients/enterprise-client.ts +334 -0
- package/src/clients/generator-client.ts +351 -0
- package/src/clients/git-client.ts +627 -0
- package/src/clients/github-client.ts +410 -0
- package/src/clients/helm-client.ts +504 -0
- package/src/clients/index.ts +80 -0
- package/src/clients/k8s-client.ts +497 -0
- package/src/clients/llm-client.ts +161 -0
- package/src/clients/rest-client.ts +130 -0
- package/src/clients/service-discovery.ts +33 -0
- package/src/clients/terraform-client.ts +482 -0
- package/src/clients/tools-client.ts +1843 -0
- package/src/clients/ws-client.ts +115 -0
- package/src/commands/analyze/index.ts +352 -0
- package/src/commands/apply/helm.ts +473 -0
- package/src/commands/apply/index.ts +213 -0
- package/src/commands/apply/k8s.ts +454 -0
- package/src/commands/apply/terraform.ts +582 -0
- package/src/commands/ask.ts +167 -0
- package/src/commands/audit/index.ts +238 -0
- package/src/commands/auth-cloud.ts +294 -0
- package/src/commands/auth-list.ts +134 -0
- package/src/commands/auth-profile.ts +121 -0
- package/src/commands/auth-status.ts +141 -0
- package/src/commands/aws/ec2.ts +501 -0
- package/src/commands/aws/iam.ts +397 -0
- package/src/commands/aws/index.ts +133 -0
- package/src/commands/aws/lambda.ts +396 -0
- package/src/commands/aws/rds.ts +439 -0
- package/src/commands/aws/s3.ts +439 -0
- package/src/commands/aws/vpc.ts +393 -0
- package/src/commands/aws-discover.ts +649 -0
- package/src/commands/aws-terraform.ts +805 -0
- package/src/commands/azure/aks.ts +376 -0
- package/src/commands/azure/functions.ts +253 -0
- package/src/commands/azure/index.ts +116 -0
- package/src/commands/azure/storage.ts +478 -0
- package/src/commands/azure/vm.ts +355 -0
- package/src/commands/billing/index.ts +256 -0
- package/src/commands/chat.ts +314 -0
- package/src/commands/config.ts +346 -0
- package/src/commands/cost/cloud-cost-estimator.ts +266 -0
- package/src/commands/cost/estimator.ts +79 -0
- package/src/commands/cost/index.ts +594 -0
- package/src/commands/cost/parsers/terraform.ts +273 -0
- package/src/commands/cost/parsers/types.ts +25 -0
- package/src/commands/cost/pricing/aws.ts +544 -0
- package/src/commands/cost/pricing/azure.ts +499 -0
- package/src/commands/cost/pricing/gcp.ts +396 -0
- package/src/commands/cost/pricing/index.ts +40 -0
- package/src/commands/demo.ts +250 -0
- package/src/commands/doctor.ts +794 -0
- package/src/commands/drift/index.ts +439 -0
- package/src/commands/explain.ts +277 -0
- package/src/commands/feedback.ts +389 -0
- package/src/commands/fix.ts +324 -0
- package/src/commands/fs/index.ts +402 -0
- package/src/commands/gcp/compute.ts +325 -0
- package/src/commands/gcp/functions.ts +271 -0
- package/src/commands/gcp/gke.ts +438 -0
- package/src/commands/gcp/iam.ts +344 -0
- package/src/commands/gcp/index.ts +129 -0
- package/src/commands/gcp/storage.ts +284 -0
- package/src/commands/generate-helm.ts +1249 -0
- package/src/commands/generate-k8s.ts +1560 -0
- package/src/commands/generate-terraform.ts +1460 -0
- package/src/commands/gh/index.ts +863 -0
- package/src/commands/git/index.ts +1343 -0
- package/src/commands/helm/index.ts +1126 -0
- package/src/commands/help.ts +539 -0
- package/src/commands/history.ts +142 -0
- package/src/commands/import.ts +868 -0
- package/src/commands/index.ts +367 -0
- package/src/commands/init.ts +1046 -0
- package/src/commands/k8s/index.ts +1137 -0
- package/src/commands/login.ts +631 -0
- package/src/commands/logout.ts +83 -0
- package/src/commands/onboarding.ts +228 -0
- package/src/commands/plan/display.ts +279 -0
- package/src/commands/plan/index.ts +599 -0
- package/src/commands/preview.ts +452 -0
- package/src/commands/questionnaire.ts +1270 -0
- package/src/commands/resume.ts +55 -0
- package/src/commands/team/index.ts +346 -0
- package/src/commands/template.ts +232 -0
- package/src/commands/tf/index.ts +1034 -0
- package/src/commands/upgrade.ts +550 -0
- package/src/commands/usage/index.ts +134 -0
- package/src/commands/version.ts +170 -0
- package/src/compat/index.ts +2 -0
- package/src/compat/runtime.ts +12 -0
- package/src/compat/sqlite.ts +107 -0
- package/src/config/index.ts +17 -0
- package/src/config/manager.ts +530 -0
- package/src/config/safety-policy.ts +358 -0
- package/src/config/schema.ts +125 -0
- package/src/config/types.ts +527 -0
- package/src/context/context-db.ts +199 -0
- package/src/demo/index.ts +349 -0
- package/src/demo/scenarios/full-journey.ts +229 -0
- package/src/demo/scenarios/getting-started.ts +127 -0
- package/src/demo/scenarios/helm-release.ts +341 -0
- package/src/demo/scenarios/k8s-deployment.ts +194 -0
- package/src/demo/scenarios/terraform-vpc.ts +170 -0
- package/src/demo/types.ts +92 -0
- package/src/engine/cost-estimator.ts +438 -0
- package/src/engine/diagram-generator.ts +256 -0
- package/src/engine/drift-detector.ts +902 -0
- package/src/engine/executor.ts +1035 -0
- package/src/engine/index.ts +76 -0
- package/src/engine/orchestrator.ts +636 -0
- package/src/engine/planner.ts +720 -0
- package/src/engine/safety.ts +743 -0
- package/src/engine/verifier.ts +770 -0
- package/src/enterprise/audit.ts +348 -0
- package/src/enterprise/auth.ts +270 -0
- package/src/enterprise/billing.ts +822 -0
- package/src/enterprise/index.ts +17 -0
- package/src/enterprise/teams.ts +443 -0
- package/src/generator/best-practices.ts +1608 -0
- package/src/generator/helm.ts +630 -0
- package/src/generator/index.ts +37 -0
- package/src/generator/intent-parser.ts +514 -0
- package/src/generator/kubernetes.ts +976 -0
- package/src/generator/terraform.ts +1867 -0
- package/src/history/index.ts +8 -0
- package/src/history/manager.ts +322 -0
- package/src/history/types.ts +34 -0
- package/src/hooks/config.ts +432 -0
- package/src/hooks/engine.ts +391 -0
- package/src/hooks/index.ts +4 -0
- package/src/llm/auth-bridge.ts +198 -0
- package/src/llm/circuit-breaker.ts +140 -0
- package/src/llm/config-loader.ts +201 -0
- package/src/llm/cost-calculator.ts +171 -0
- package/src/llm/index.ts +8 -0
- package/src/llm/model-aliases.ts +115 -0
- package/src/llm/provider-registry.ts +63 -0
- package/src/llm/providers/anthropic.ts +433 -0
- package/src/llm/providers/bedrock.ts +477 -0
- package/src/llm/providers/google.ts +405 -0
- package/src/llm/providers/ollama.ts +767 -0
- package/src/llm/providers/openai-compatible.ts +340 -0
- package/src/llm/providers/openai.ts +328 -0
- package/src/llm/providers/openrouter.ts +338 -0
- package/src/llm/router.ts +1035 -0
- package/src/llm/types.ts +232 -0
- package/src/lsp/client.ts +298 -0
- package/src/lsp/languages.ts +116 -0
- package/src/lsp/manager.ts +278 -0
- package/src/mcp/client.ts +402 -0
- package/src/mcp/index.ts +5 -0
- package/src/mcp/manager.ts +133 -0
- package/src/nimbus.ts +214 -0
- package/src/plugins/index.ts +27 -0
- package/src/plugins/loader.ts +334 -0
- package/src/plugins/manager.ts +376 -0
- package/src/plugins/types.ts +284 -0
- package/src/scanners/cicd-scanner.ts +258 -0
- package/src/scanners/cloud-scanner.ts +466 -0
- package/src/scanners/framework-scanner.ts +469 -0
- package/src/scanners/iac-scanner.ts +388 -0
- package/src/scanners/index.ts +539 -0
- package/src/scanners/language-scanner.ts +276 -0
- package/src/scanners/package-manager-scanner.ts +277 -0
- package/src/scanners/types.ts +172 -0
- package/src/sessions/manager.ts +365 -0
- package/src/sessions/types.ts +44 -0
- package/src/sharing/sync.ts +296 -0
- package/src/sharing/viewer.ts +97 -0
- package/src/snapshots/index.ts +2 -0
- package/src/snapshots/manager.ts +530 -0
- package/src/state/artifacts.ts +147 -0
- package/src/state/audit.ts +137 -0
- package/src/state/billing.ts +240 -0
- package/src/state/checkpoints.ts +117 -0
- package/src/state/config.ts +67 -0
- package/src/state/conversations.ts +14 -0
- package/src/state/credentials.ts +154 -0
- package/src/state/db.ts +58 -0
- package/src/state/index.ts +26 -0
- package/src/state/messages.ts +115 -0
- package/src/state/projects.ts +123 -0
- package/src/state/schema.ts +236 -0
- package/src/state/sessions.ts +147 -0
- package/src/state/teams.ts +200 -0
- package/src/telemetry.ts +108 -0
- package/src/tools/aws-ops.ts +952 -0
- package/src/tools/azure-ops.ts +579 -0
- package/src/tools/file-ops.ts +593 -0
- package/src/tools/gcp-ops.ts +625 -0
- package/src/tools/git-ops.ts +773 -0
- package/src/tools/github-ops.ts +799 -0
- package/src/tools/helm-ops.ts +943 -0
- package/src/tools/index.ts +17 -0
- package/src/tools/k8s-ops.ts +819 -0
- package/src/tools/schemas/converter.ts +184 -0
- package/src/tools/schemas/devops.ts +612 -0
- package/src/tools/schemas/index.ts +73 -0
- package/src/tools/schemas/standard.ts +1144 -0
- package/src/tools/schemas/types.ts +705 -0
- package/src/tools/terraform-ops.ts +862 -0
- package/src/types/ambient.d.ts +193 -0
- package/src/types/config.ts +83 -0
- package/src/types/drift.ts +116 -0
- package/src/types/enterprise.ts +335 -0
- package/src/types/index.ts +20 -0
- package/src/types/plan.ts +44 -0
- package/src/types/request.ts +65 -0
- package/src/types/response.ts +54 -0
- package/src/types/service.ts +51 -0
- package/src/ui/App.tsx +997 -0
- package/src/ui/DeployPreview.tsx +169 -0
- package/src/ui/Header.tsx +68 -0
- package/src/ui/InputBox.tsx +350 -0
- package/src/ui/MessageList.tsx +585 -0
- package/src/ui/PermissionPrompt.tsx +151 -0
- package/src/ui/StatusBar.tsx +158 -0
- package/src/ui/ToolCallDisplay.tsx +409 -0
- package/src/ui/chat-ui.ts +853 -0
- package/src/ui/index.ts +33 -0
- package/src/ui/ink/index.ts +711 -0
- package/src/ui/streaming.ts +176 -0
- package/src/ui/types.ts +57 -0
- package/src/utils/analytics.ts +72 -0
- package/src/utils/cost-warning.ts +27 -0
- package/src/utils/env.ts +46 -0
- package/src/utils/errors.ts +69 -0
- package/src/utils/event-bus.ts +38 -0
- package/src/utils/index.ts +24 -0
- package/src/utils/logger.ts +171 -0
- package/src/utils/rate-limiter.ts +121 -0
- package/src/utils/service-auth.ts +49 -0
- package/src/utils/validation.ts +53 -0
- package/src/version.ts +4 -0
- package/src/watcher/index.ts +163 -0
- package/src/wizard/approval.ts +383 -0
- package/src/wizard/index.ts +25 -0
- package/src/wizard/prompts.ts +338 -0
- package/src/wizard/types.ts +171 -0
- package/src/wizard/ui.ts +556 -0
- package/src/wizard/wizard.ts +304 -0
- package/tsconfig.json +24 -0
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Chat Command
|
|
3
|
+
*
|
|
4
|
+
* Interactive chat mode with LLM streaming and infrastructure generation
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { startChat, type ChatUIOptions } from '../ui';
|
|
8
|
+
import { AuthStore } from '../auth/store';
|
|
9
|
+
import { ui } from '../wizard/ui';
|
|
10
|
+
import { historyManager } from '../history';
|
|
11
|
+
|
|
12
|
+
export interface ChatOptions {
|
|
13
|
+
/** LLM model to use */
|
|
14
|
+
model?: string;
|
|
15
|
+
/** Initial system prompt */
|
|
16
|
+
systemPrompt?: string;
|
|
17
|
+
/** Show token count after responses */
|
|
18
|
+
showTokenCount?: boolean;
|
|
19
|
+
/** Non-interactive mode (for API usage) */
|
|
20
|
+
nonInteractive?: boolean;
|
|
21
|
+
/** Single message to send (non-interactive) */
|
|
22
|
+
message?: string;
|
|
23
|
+
/** Enable infrastructure generation mode */
|
|
24
|
+
generateMode?: boolean;
|
|
25
|
+
/** Persona mode */
|
|
26
|
+
persona?: 'professional' | 'assistant' | 'expert';
|
|
27
|
+
/** Verbosity level */
|
|
28
|
+
verbosity?: 'minimal' | 'normal' | 'detailed';
|
|
29
|
+
/** UI mode (defaults to 'ink' for rich TUI, 'readline' for simple) */
|
|
30
|
+
ui?: 'ink' | 'readline';
|
|
31
|
+
/** Resume the most recent chat session */
|
|
32
|
+
continue?: boolean;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Chat command handler
|
|
37
|
+
*
|
|
38
|
+
* Usage:
|
|
39
|
+
* nimbus chat - Start interactive chat (Ink TUI)
|
|
40
|
+
* nimbus chat --model gpt-4o - Use specific model
|
|
41
|
+
* nimbus chat -m "Hello" - Send single message (non-interactive)
|
|
42
|
+
* nimbus chat --ui=readline - Use simple readline interface (no React/Ink)
|
|
43
|
+
*/
|
|
44
|
+
export async function chatCommand(options: ChatOptions = {}): Promise<void> {
|
|
45
|
+
// Check for NIMBUS.md and suggest init if missing (non-blocking)
|
|
46
|
+
if (!options.nonInteractive && !options.message) {
|
|
47
|
+
try {
|
|
48
|
+
const fs = await import('node:fs');
|
|
49
|
+
const path = await import('node:path');
|
|
50
|
+
const nimbusPath = path.default.join(process.cwd(), 'NIMBUS.md');
|
|
51
|
+
if (!fs.default.existsSync(nimbusPath)) {
|
|
52
|
+
ui.print(
|
|
53
|
+
ui.dim(
|
|
54
|
+
'Tip: No NIMBUS.md found. Run `nimbus init` to set up project context for better results.'
|
|
55
|
+
)
|
|
56
|
+
);
|
|
57
|
+
ui.newLine();
|
|
58
|
+
}
|
|
59
|
+
} catch {
|
|
60
|
+
// Non-critical, ignore
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// Pre-flight: verify at least one LLM provider is available
|
|
65
|
+
try {
|
|
66
|
+
const { getAppContext } = await import('../app');
|
|
67
|
+
const ctx = getAppContext();
|
|
68
|
+
if (ctx?.router && ctx.router.getAvailableProviders().length === 0) {
|
|
69
|
+
ui.newLine();
|
|
70
|
+
ui.error('No LLM provider configured.');
|
|
71
|
+
ui.newLine();
|
|
72
|
+
ui.print('Set up a provider using one of these methods:');
|
|
73
|
+
ui.print(` ${ui.bold('nimbus login')} — interactive setup wizard`);
|
|
74
|
+
ui.print(` ${ui.bold('export ANTHROPIC_API_KEY=sk-ant-...')} — environment variable`);
|
|
75
|
+
ui.print(` ${ui.bold('export OPENAI_API_KEY=sk-...')} — environment variable`);
|
|
76
|
+
ui.newLine();
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
} catch {
|
|
80
|
+
// Pre-flight is non-critical — let it fail later with a real error
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// Resolve --continue: look up the most recent session ID
|
|
84
|
+
let resumeSessionId: string | undefined;
|
|
85
|
+
if (options.continue) {
|
|
86
|
+
try {
|
|
87
|
+
const { SessionManager } = await import('../sessions/manager');
|
|
88
|
+
const sessionManager = SessionManager.getInstance();
|
|
89
|
+
const recent = sessionManager.list();
|
|
90
|
+
if (recent.length > 0) {
|
|
91
|
+
resumeSessionId = recent[0].id;
|
|
92
|
+
} else {
|
|
93
|
+
ui.print(ui.dim('No previous session found. Starting a new session.'));
|
|
94
|
+
ui.newLine();
|
|
95
|
+
}
|
|
96
|
+
} catch {
|
|
97
|
+
// Session lookup is non-critical — fall through to a fresh session
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// Default to Ink TUI, fall back to readline if unavailable or explicitly requested.
|
|
102
|
+
// If stdin is not a TTY (piped input), skip Ink and use readline mode.
|
|
103
|
+
if (options.ui !== 'readline' && process.stdin.isTTY) {
|
|
104
|
+
try {
|
|
105
|
+
const { startInkChat } = await import('../ui/ink/index');
|
|
106
|
+
await startInkChat({
|
|
107
|
+
model: options.model,
|
|
108
|
+
systemPrompt: options.systemPrompt,
|
|
109
|
+
showTokenCount: options.showTokenCount,
|
|
110
|
+
resumeSessionId,
|
|
111
|
+
});
|
|
112
|
+
return;
|
|
113
|
+
} catch {
|
|
114
|
+
// Ink TUI unavailable (compiled binary without React/Ink) — fall back to readline
|
|
115
|
+
ui.print(
|
|
116
|
+
ui.dim(
|
|
117
|
+
'Using readline mode (same features, simpler UI). For the rich TUI, run: bun src/nimbus.ts'
|
|
118
|
+
)
|
|
119
|
+
);
|
|
120
|
+
ui.newLine();
|
|
121
|
+
}
|
|
122
|
+
} else if (!process.stdin.isTTY && options.ui !== 'readline') {
|
|
123
|
+
// Piped stdin detected — inform user
|
|
124
|
+
ui.print(ui.dim('Non-interactive terminal detected, using readline mode.'));
|
|
125
|
+
ui.newLine();
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
const startTime = Date.now();
|
|
129
|
+
const entry = historyManager.addEntry('chat', [], {
|
|
130
|
+
model: options.model,
|
|
131
|
+
persona: options.persona,
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
try {
|
|
135
|
+
// Get default model from auth store if not specified
|
|
136
|
+
if (!options.model) {
|
|
137
|
+
const authStore = new AuthStore();
|
|
138
|
+
const status = authStore.getStatus();
|
|
139
|
+
// Find the default provider's model
|
|
140
|
+
const defaultProviderInfo = status.providers.find(p => p.name === status.defaultProvider);
|
|
141
|
+
options.model = defaultProviderInfo?.model;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
// Read persona from config if not specified
|
|
145
|
+
if (!options.persona || !options.verbosity) {
|
|
146
|
+
try {
|
|
147
|
+
const { configManager } = await import('../config/manager');
|
|
148
|
+
if (!options.persona) {
|
|
149
|
+
const mode = configManager.get('persona.mode');
|
|
150
|
+
if (mode) {
|
|
151
|
+
options.persona = mode;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
if (!options.verbosity) {
|
|
155
|
+
const verbosity = configManager.get('persona.verbosity');
|
|
156
|
+
if (verbosity) {
|
|
157
|
+
options.verbosity = verbosity;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
} catch {
|
|
161
|
+
// Config read failure is non-critical
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
const persona = options.persona || 'assistant';
|
|
165
|
+
const verbosity = options.verbosity || 'normal';
|
|
166
|
+
|
|
167
|
+
// Non-interactive mode: send single message
|
|
168
|
+
if (options.nonInteractive || options.message) {
|
|
169
|
+
if (!options.message) {
|
|
170
|
+
ui.error('Message is required in non-interactive mode. Use --message or -m.');
|
|
171
|
+
process.exit(1);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
await sendSingleMessage(options.message, options, persona, verbosity);
|
|
175
|
+
historyManager.completeEntry(entry.id, 'success', Date.now() - startTime);
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
// Interactive mode: start chat UI
|
|
180
|
+
const chatOptions: ChatUIOptions = {
|
|
181
|
+
model: options.model,
|
|
182
|
+
systemPrompt: options.systemPrompt || getPersonaSystemPrompt(persona, verbosity),
|
|
183
|
+
showTokenCount: options.showTokenCount ?? false,
|
|
184
|
+
resumeSessionId,
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
await startChat(chatOptions);
|
|
188
|
+
historyManager.completeEntry(entry.id, 'success', Date.now() - startTime);
|
|
189
|
+
} catch (error: any) {
|
|
190
|
+
historyManager.completeEntry(entry.id, 'failure', Date.now() - startTime, {
|
|
191
|
+
error: error.message,
|
|
192
|
+
});
|
|
193
|
+
|
|
194
|
+
// Detect auth/API key errors and suggest re-onboarding
|
|
195
|
+
const errMsg = error.message || String(error);
|
|
196
|
+
if (/auth|api.?key|unauthorized|forbidden|401|403|invalid.*key/i.test(errMsg)) {
|
|
197
|
+
ui.newLine();
|
|
198
|
+
ui.error('LLM authentication failed. Your API key may be invalid or expired.');
|
|
199
|
+
ui.newLine();
|
|
200
|
+
ui.print('To reconfigure:');
|
|
201
|
+
ui.print(` ${ui.bold('nimbus login')} — re-run the setup wizard`);
|
|
202
|
+
ui.print(` ${ui.bold('export ANTHROPIC_API_KEY=sk-ant-...')} — set a new key`);
|
|
203
|
+
ui.newLine();
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
throw error;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Send a single message and display the response (non-interactive mode)
|
|
213
|
+
*
|
|
214
|
+
* Uses the full agent loop so that tool-calling is available even in
|
|
215
|
+
* non-interactive / single-message mode (`nimbus chat -m "..."`).
|
|
216
|
+
*/
|
|
217
|
+
async function sendSingleMessage(
|
|
218
|
+
message: string,
|
|
219
|
+
options: ChatOptions,
|
|
220
|
+
_persona: 'professional' | 'assistant' | 'expert',
|
|
221
|
+
_verbosity: 'minimal' | 'normal' | 'detailed'
|
|
222
|
+
): Promise<void> {
|
|
223
|
+
const { getAppContext } = await import('../app');
|
|
224
|
+
const { runAgentLoop } = await import('../agent/loop');
|
|
225
|
+
const { defaultToolRegistry } = await import('../tools/schemas/types');
|
|
226
|
+
|
|
227
|
+
const ctx = getAppContext();
|
|
228
|
+
if (!ctx) {
|
|
229
|
+
ui.error('App not initialised. Cannot send message.');
|
|
230
|
+
process.exit(1);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
const outputParts: string[] = [];
|
|
234
|
+
|
|
235
|
+
try {
|
|
236
|
+
const result = await runAgentLoop(message, [], {
|
|
237
|
+
router: ctx.router,
|
|
238
|
+
toolRegistry: defaultToolRegistry,
|
|
239
|
+
mode: 'build',
|
|
240
|
+
model: options.model,
|
|
241
|
+
cwd: process.cwd(),
|
|
242
|
+
|
|
243
|
+
onText: text => {
|
|
244
|
+
process.stdout.write(text);
|
|
245
|
+
outputParts.push(text);
|
|
246
|
+
},
|
|
247
|
+
|
|
248
|
+
onToolCallStart: toolCall => {
|
|
249
|
+
process.stderr.write(`\n[Tool: ${toolCall.name}]\n`);
|
|
250
|
+
},
|
|
251
|
+
|
|
252
|
+
onToolCallEnd: (_toolCall, toolResult) => {
|
|
253
|
+
if (toolResult.isError) {
|
|
254
|
+
process.stderr.write(`[Error: ${toolResult.error}]\n`);
|
|
255
|
+
}
|
|
256
|
+
},
|
|
257
|
+
});
|
|
258
|
+
|
|
259
|
+
// Final newline
|
|
260
|
+
if (outputParts.length > 0) {
|
|
261
|
+
console.log('');
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
if (result.interrupted) {
|
|
265
|
+
ui.info('Operation interrupted.');
|
|
266
|
+
}
|
|
267
|
+
} catch (error: any) {
|
|
268
|
+
ui.error(error.message || 'Failed to get response');
|
|
269
|
+
process.exit(1);
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
* Build a persona-aware system prompt for Nimbus chat.
|
|
275
|
+
*
|
|
276
|
+
* @param persona - The persona mode that controls tone and style
|
|
277
|
+
* @param verbosity - The verbosity level that controls response length
|
|
278
|
+
* @returns A complete system prompt string
|
|
279
|
+
*/
|
|
280
|
+
function getPersonaSystemPrompt(
|
|
281
|
+
persona: 'professional' | 'assistant' | 'expert',
|
|
282
|
+
verbosity: 'minimal' | 'normal' | 'detailed'
|
|
283
|
+
): string {
|
|
284
|
+
// Base identity shared across all personas
|
|
285
|
+
const baseIdentity = `You are Nimbus, an AI-powered cloud engineering assistant. You help users with:
|
|
286
|
+
|
|
287
|
+
- Infrastructure as Code (Terraform, CloudFormation, Pulumi)
|
|
288
|
+
- Kubernetes operations and configurations
|
|
289
|
+
- Cloud provider operations (AWS, GCP, Azure)
|
|
290
|
+
- DevOps best practices and CI/CD pipelines
|
|
291
|
+
- Troubleshooting infrastructure issues`;
|
|
292
|
+
|
|
293
|
+
// Persona-specific instructions
|
|
294
|
+
const personaInstructions: Record<typeof persona, string> = {
|
|
295
|
+
professional: `Maintain a formal, structured, and enterprise-focused tone at all times. Use bullet points and numbered lists to organize information clearly. Prefer formal language and avoid colloquialisms. Frame recommendations in terms of business impact, compliance, and operational excellence. When proposing changes, present them as structured plans with clear rationale, risk assessment, and rollback considerations.`,
|
|
296
|
+
assistant: `Be friendly and conversational while remaining helpful and accurate. Explain concepts in an approachable way, breaking down complex topics so they are easy to understand. When suggesting infrastructure code, walk through the reasoning behind each decision. If you need more information to provide accurate help, ask clarifying questions. Offer encouragement and context to help users learn as they go.`,
|
|
297
|
+
expert: `Be technical and concise. Assume the user has deep knowledge of cloud infrastructure, networking, and DevOps practices. Skip introductory explanations and get straight to the solution. Include advanced patterns, edge cases, and performance considerations where relevant. Reference specific API versions, provider documentation, and known gotchas. Prefer code-first responses with terse inline comments over lengthy prose.`,
|
|
298
|
+
};
|
|
299
|
+
|
|
300
|
+
// Verbosity-level instructions
|
|
301
|
+
const verbosityInstructions: Record<typeof verbosity, string> = {
|
|
302
|
+
minimal: `Keep responses brief and to the point. Omit preamble and unnecessary context. Provide the shortest correct answer, using code blocks or bullet points when possible. Avoid repeating the question or restating what the user already knows.`,
|
|
303
|
+
normal: `Provide balanced responses that include enough context to be useful without being verbose. Include a brief explanation alongside code or commands. Mention important caveats or prerequisites when relevant, but do not over-explain.`,
|
|
304
|
+
detailed: `Provide comprehensive responses with thorough explanations. Include code examples, usage patterns, and alternative approaches. Explain trade-offs, link to relevant best practices, and suggest next steps. Where applicable, show before-and-after comparisons and provide context on why a particular approach is preferred.`,
|
|
305
|
+
};
|
|
306
|
+
|
|
307
|
+
return [
|
|
308
|
+
baseIdentity,
|
|
309
|
+
'',
|
|
310
|
+
personaInstructions[persona],
|
|
311
|
+
'',
|
|
312
|
+
verbosityInstructions[verbosity],
|
|
313
|
+
].join('\n');
|
|
314
|
+
}
|
|
@@ -0,0 +1,346 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Config Command
|
|
3
|
+
*
|
|
4
|
+
* Manage Nimbus configuration
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { ui } from '../wizard/ui';
|
|
8
|
+
import { select, input, confirm } from '../wizard/prompts';
|
|
9
|
+
import { ConfigManager, CONFIG_KEYS } from '../config';
|
|
10
|
+
|
|
11
|
+
export interface ConfigOptions {
|
|
12
|
+
/** Non-interactive mode */
|
|
13
|
+
nonInteractive?: boolean;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface ConfigSetOptions extends ConfigOptions {
|
|
17
|
+
/** Key to set */
|
|
18
|
+
key?: string;
|
|
19
|
+
/** Value to set */
|
|
20
|
+
value?: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface ConfigGetOptions extends ConfigOptions {
|
|
24
|
+
/** Key to get */
|
|
25
|
+
key?: string;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface ConfigListOptions extends ConfigOptions {
|
|
29
|
+
/** Output as JSON */
|
|
30
|
+
json?: boolean;
|
|
31
|
+
/** Show only keys with non-default values */
|
|
32
|
+
changed?: boolean;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface ConfigInitOptions extends ConfigOptions {
|
|
36
|
+
/** Force overwrite existing config */
|
|
37
|
+
force?: boolean;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Config set command
|
|
42
|
+
*/
|
|
43
|
+
export async function configSetCommand(options: ConfigSetOptions): Promise<void> {
|
|
44
|
+
const configManager = new ConfigManager();
|
|
45
|
+
|
|
46
|
+
let key = options.key;
|
|
47
|
+
let value = options.value;
|
|
48
|
+
|
|
49
|
+
// Interactive mode - select key if not provided
|
|
50
|
+
if (!key && !options.nonInteractive) {
|
|
51
|
+
const keyOptions = CONFIG_KEYS.map(k => ({
|
|
52
|
+
label: k.key,
|
|
53
|
+
value: k.key,
|
|
54
|
+
description: k.description,
|
|
55
|
+
}));
|
|
56
|
+
|
|
57
|
+
key = (await select({
|
|
58
|
+
message: 'Select configuration key to set:',
|
|
59
|
+
options: keyOptions,
|
|
60
|
+
})) as string;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if (!key) {
|
|
64
|
+
ui.error('Configuration key is required.');
|
|
65
|
+
process.exit(1);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// Validate key
|
|
69
|
+
const keyInfo = configManager.getKeyInfo(key);
|
|
70
|
+
if (!keyInfo) {
|
|
71
|
+
ui.warning(`Unknown configuration key: ${key}`);
|
|
72
|
+
ui.info('Use "nimbus config list" to see available keys.');
|
|
73
|
+
|
|
74
|
+
if (!options.nonInteractive) {
|
|
75
|
+
const proceed = await confirm({
|
|
76
|
+
message: 'Set this key anyway?',
|
|
77
|
+
defaultValue: false,
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
if (!proceed) {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// Get value if not provided
|
|
87
|
+
if (value === undefined && !options.nonInteractive) {
|
|
88
|
+
const currentValue = configManager.get(key);
|
|
89
|
+
const defaultValue = keyInfo?.defaultValue;
|
|
90
|
+
|
|
91
|
+
let placeholder = '';
|
|
92
|
+
if (currentValue !== undefined) {
|
|
93
|
+
placeholder = String(currentValue);
|
|
94
|
+
} else if (defaultValue !== undefined) {
|
|
95
|
+
placeholder = `default: ${defaultValue}`;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
if (keyInfo?.type === 'boolean') {
|
|
99
|
+
const boolValue = await confirm({
|
|
100
|
+
message: `Set ${key}:`,
|
|
101
|
+
defaultValue: currentValue ?? defaultValue ?? false,
|
|
102
|
+
});
|
|
103
|
+
value = String(boolValue);
|
|
104
|
+
} else {
|
|
105
|
+
value = await input({
|
|
106
|
+
message: `Enter value for ${key}:`,
|
|
107
|
+
defaultValue: currentValue !== undefined ? String(currentValue) : undefined,
|
|
108
|
+
placeholder,
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
if (value === undefined) {
|
|
114
|
+
ui.error('Configuration value is required.');
|
|
115
|
+
process.exit(1);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// Parse and set value
|
|
119
|
+
const parsedValue = configManager.parseValue(key, value);
|
|
120
|
+
configManager.set(key, parsedValue);
|
|
121
|
+
|
|
122
|
+
ui.success(`Configuration updated: ${key} = ${parsedValue}`);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Config get command
|
|
127
|
+
*/
|
|
128
|
+
export async function configGetCommand(options: ConfigGetOptions): Promise<void> {
|
|
129
|
+
const configManager = new ConfigManager();
|
|
130
|
+
|
|
131
|
+
let key = options.key;
|
|
132
|
+
|
|
133
|
+
// Interactive mode - select key if not provided
|
|
134
|
+
if (!key && !options.nonInteractive) {
|
|
135
|
+
const keyOptions = CONFIG_KEYS.map(k => ({
|
|
136
|
+
label: k.key,
|
|
137
|
+
value: k.key,
|
|
138
|
+
description: k.description,
|
|
139
|
+
}));
|
|
140
|
+
|
|
141
|
+
key = (await select({
|
|
142
|
+
message: 'Select configuration key to view:',
|
|
143
|
+
options: keyOptions,
|
|
144
|
+
})) as string;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
if (!key) {
|
|
148
|
+
ui.error('Configuration key is required.');
|
|
149
|
+
process.exit(1);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
const value = configManager.get(key);
|
|
153
|
+
|
|
154
|
+
if (value === undefined) {
|
|
155
|
+
const keyInfo = configManager.getKeyInfo(key);
|
|
156
|
+
if (keyInfo?.defaultValue !== undefined) {
|
|
157
|
+
ui.print(`${ui.color(key, 'cyan')}: ${keyInfo.defaultValue} ${ui.dim('(default)')}`);
|
|
158
|
+
} else {
|
|
159
|
+
ui.print(`${ui.color(key, 'cyan')}: ${ui.dim('(not set)')}`);
|
|
160
|
+
}
|
|
161
|
+
} else {
|
|
162
|
+
ui.print(`${ui.color(key, 'cyan')}: ${value}`);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Config list command
|
|
168
|
+
*/
|
|
169
|
+
export async function configListCommand(options: ConfigListOptions): Promise<void> {
|
|
170
|
+
const configManager = new ConfigManager();
|
|
171
|
+
const allConfig = configManager.getAllFlat();
|
|
172
|
+
|
|
173
|
+
if (options.json) {
|
|
174
|
+
console.log(JSON.stringify(allConfig, null, 2));
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
ui.newLine();
|
|
179
|
+
ui.header('Nimbus Configuration', configManager.getConfigPath());
|
|
180
|
+
|
|
181
|
+
// Group by section
|
|
182
|
+
const sections: Record<
|
|
183
|
+
string,
|
|
184
|
+
Array<{ key: string; value: any; info?: (typeof CONFIG_KEYS)[number] }>
|
|
185
|
+
> = {};
|
|
186
|
+
|
|
187
|
+
for (const keyInfo of CONFIG_KEYS) {
|
|
188
|
+
const [section] = keyInfo.key.split('.');
|
|
189
|
+
if (!sections[section]) {
|
|
190
|
+
sections[section] = [];
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
const value = allConfig[keyInfo.key];
|
|
194
|
+
const isDefault = value === undefined || value === keyInfo.defaultValue;
|
|
195
|
+
|
|
196
|
+
if (options.changed && isDefault) {
|
|
197
|
+
continue;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
sections[section].push({
|
|
201
|
+
key: keyInfo.key,
|
|
202
|
+
value: value !== undefined ? value : keyInfo.defaultValue,
|
|
203
|
+
info: keyInfo,
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
for (const [section, items] of Object.entries(sections)) {
|
|
208
|
+
if (items.length === 0) {
|
|
209
|
+
continue;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
ui.section(section.charAt(0).toUpperCase() + section.slice(1));
|
|
213
|
+
|
|
214
|
+
for (const item of items) {
|
|
215
|
+
const isDefault = item.value === item.info?.defaultValue;
|
|
216
|
+
const valueStr = item.value !== undefined ? String(item.value) : ui.dim('(not set)');
|
|
217
|
+
const defaultMarker = isDefault ? ui.dim(' (default)') : '';
|
|
218
|
+
|
|
219
|
+
ui.print(` ${ui.color(item.key, 'cyan')}: ${valueStr}${defaultMarker}`);
|
|
220
|
+
|
|
221
|
+
if (item.info?.description) {
|
|
222
|
+
ui.print(` ${ui.dim(item.info.description)}`);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
ui.newLine();
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* Config init command
|
|
232
|
+
*/
|
|
233
|
+
export async function configInitCommand(options: ConfigInitOptions): Promise<void> {
|
|
234
|
+
const configManager = new ConfigManager();
|
|
235
|
+
|
|
236
|
+
if (configManager.exists() && !options.force) {
|
|
237
|
+
ui.warning(`Configuration file already exists at: ${configManager.getConfigPath()}`);
|
|
238
|
+
|
|
239
|
+
if (!options.nonInteractive) {
|
|
240
|
+
const overwrite = await confirm({
|
|
241
|
+
message: 'Overwrite existing configuration?',
|
|
242
|
+
defaultValue: false,
|
|
243
|
+
});
|
|
244
|
+
|
|
245
|
+
if (!overwrite) {
|
|
246
|
+
ui.info('Configuration unchanged.');
|
|
247
|
+
return;
|
|
248
|
+
}
|
|
249
|
+
} else {
|
|
250
|
+
ui.info('Use --force to overwrite.');
|
|
251
|
+
return;
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
// Interactive configuration setup
|
|
256
|
+
if (!options.nonInteractive) {
|
|
257
|
+
ui.newLine();
|
|
258
|
+
ui.header('Nimbus Configuration Setup', "Let's configure your Nimbus CLI");
|
|
259
|
+
|
|
260
|
+
// Workspace settings
|
|
261
|
+
ui.section('Workspace');
|
|
262
|
+
|
|
263
|
+
const defaultProvider = await select({
|
|
264
|
+
message: 'Default cloud provider:',
|
|
265
|
+
options: [
|
|
266
|
+
{ label: 'AWS', value: 'aws', description: 'Amazon Web Services' },
|
|
267
|
+
{ label: 'GCP', value: 'gcp', description: 'Google Cloud Platform' },
|
|
268
|
+
{ label: 'Azure', value: 'azure', description: 'Microsoft Azure' },
|
|
269
|
+
],
|
|
270
|
+
});
|
|
271
|
+
|
|
272
|
+
const outputDir = await input({
|
|
273
|
+
message: 'Default output directory for generated code:',
|
|
274
|
+
defaultValue: './infrastructure',
|
|
275
|
+
});
|
|
276
|
+
|
|
277
|
+
// LLM settings
|
|
278
|
+
ui.section('LLM');
|
|
279
|
+
|
|
280
|
+
const temperature = await input({
|
|
281
|
+
message: 'LLM temperature (0-1):',
|
|
282
|
+
defaultValue: '0.7',
|
|
283
|
+
validate: val => {
|
|
284
|
+
const num = Number(val);
|
|
285
|
+
if (isNaN(num) || num < 0 || num > 1) {
|
|
286
|
+
return 'Temperature must be a number between 0 and 1';
|
|
287
|
+
}
|
|
288
|
+
return true;
|
|
289
|
+
},
|
|
290
|
+
});
|
|
291
|
+
|
|
292
|
+
// Safety settings
|
|
293
|
+
ui.section('Safety');
|
|
294
|
+
|
|
295
|
+
const requireConfirmation = await confirm({
|
|
296
|
+
message: 'Require confirmation for destructive operations?',
|
|
297
|
+
defaultValue: true,
|
|
298
|
+
});
|
|
299
|
+
|
|
300
|
+
// Save configuration
|
|
301
|
+
configManager.set('workspace.defaultProvider', defaultProvider);
|
|
302
|
+
configManager.set('workspace.outputDirectory', outputDir);
|
|
303
|
+
configManager.set('llm.temperature', Number(temperature));
|
|
304
|
+
configManager.set('safety.requireConfirmation', requireConfirmation);
|
|
305
|
+
|
|
306
|
+
ui.newLine();
|
|
307
|
+
ui.success(`Configuration saved to: ${configManager.getConfigPath()}`);
|
|
308
|
+
} else {
|
|
309
|
+
// Non-interactive - just create default config
|
|
310
|
+
configManager.reset();
|
|
311
|
+
ui.success(`Default configuration created at: ${configManager.getConfigPath()}`);
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
/**
|
|
316
|
+
* Config reset command
|
|
317
|
+
*/
|
|
318
|
+
export async function configResetCommand(options: ConfigOptions): Promise<void> {
|
|
319
|
+
const configManager = new ConfigManager();
|
|
320
|
+
|
|
321
|
+
if (!options.nonInteractive) {
|
|
322
|
+
const confirm_reset = await confirm({
|
|
323
|
+
message: 'Reset all configuration to defaults?',
|
|
324
|
+
defaultValue: false,
|
|
325
|
+
});
|
|
326
|
+
|
|
327
|
+
if (!confirm_reset) {
|
|
328
|
+
ui.info('Configuration unchanged.');
|
|
329
|
+
return;
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
configManager.reset();
|
|
334
|
+
ui.success('Configuration reset to defaults.');
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
/**
|
|
338
|
+
* Main config command dispatcher
|
|
339
|
+
*/
|
|
340
|
+
export const configCommand = {
|
|
341
|
+
set: configSetCommand,
|
|
342
|
+
get: configGetCommand,
|
|
343
|
+
list: configListCommand,
|
|
344
|
+
init: configInitCommand,
|
|
345
|
+
reset: configResetCommand,
|
|
346
|
+
};
|