@mohanscodex/spectra-code 0.4.6 → 0.4.8
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/dist/package.json +1 -1
- package/dist/src/agents/definitions.d.ts +2 -2
- package/dist/src/agents/definitions.d.ts.map +1 -1
- package/dist/src/agents/definitions.js +18 -18
- package/dist/src/agents/definitions.js.map +1 -1
- package/dist/src/agents/registry.d.ts +1 -1
- package/dist/src/agents/registry.d.ts.map +1 -1
- package/dist/src/agents/registry.js.map +1 -1
- package/dist/src/cli.js +117 -115
- package/dist/src/cli.js.map +1 -1
- package/dist/src/commands/agent.d.ts +1 -1
- package/dist/src/commands/agent.d.ts.map +1 -1
- package/dist/src/commands/agent.js +14 -14
- package/dist/src/commands/agent.js.map +1 -1
- package/dist/src/commands/db.d.ts +1 -1
- package/dist/src/commands/db.d.ts.map +1 -1
- package/dist/src/commands/db.js +11 -11
- package/dist/src/commands/db.js.map +1 -1
- package/dist/src/commands/doctor.d.ts.map +1 -1
- package/dist/src/commands/doctor.js +33 -30
- package/dist/src/commands/doctor.js.map +1 -1
- package/dist/src/commands/mcp.d.ts +1 -1
- package/dist/src/commands/mcp.d.ts.map +1 -1
- package/dist/src/commands/mcp.js +39 -39
- package/dist/src/commands/mcp.js.map +1 -1
- package/dist/src/commands/plugin.d.ts +1 -1
- package/dist/src/commands/plugin.d.ts.map +1 -1
- package/dist/src/commands/plugin.js +13 -13
- package/dist/src/commands/plugin.js.map +1 -1
- package/dist/src/commands/session.d.ts +1 -1
- package/dist/src/commands/session.d.ts.map +1 -1
- package/dist/src/commands/session.js +12 -12
- package/dist/src/commands/session.js.map +1 -1
- package/dist/src/index.d.ts +18 -18
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +16 -16
- package/dist/src/index.js.map +1 -1
- package/dist/src/integrations/acp/index.d.ts +1 -1
- package/dist/src/integrations/acp/index.js +1 -1
- package/dist/src/integrations/acp/server.d.ts.map +1 -1
- package/dist/src/integrations/acp/server.js +89 -79
- package/dist/src/integrations/acp/server.js.map +1 -1
- package/dist/src/integrations/custom-tools/index.d.ts +2 -2
- package/dist/src/integrations/custom-tools/index.js +1 -1
- package/dist/src/integrations/custom-tools/loader.d.ts +2 -2
- package/dist/src/integrations/custom-tools/loader.d.ts.map +1 -1
- package/dist/src/integrations/custom-tools/loader.js +19 -18
- package/dist/src/integrations/custom-tools/loader.js.map +1 -1
- package/dist/src/integrations/mcp/client.d.ts +5 -5
- package/dist/src/integrations/mcp/client.d.ts.map +1 -1
- package/dist/src/integrations/mcp/client.js +7 -7
- package/dist/src/integrations/mcp/client.js.map +1 -1
- package/dist/src/integrations/mcp/index.d.ts +2 -2
- package/dist/src/integrations/mcp/index.d.ts.map +1 -1
- package/dist/src/integrations/mcp/index.js +1 -1
- package/dist/src/integrations/mcp/index.js.map +1 -1
- package/dist/src/security/doom-loop.d.ts +1 -1
- package/dist/src/security/doom-loop.d.ts.map +1 -1
- package/dist/src/security/doom-loop.js +4 -4
- package/dist/src/security/doom-loop.js.map +1 -1
- package/dist/src/security/index.d.ts +10 -10
- package/dist/src/security/index.d.ts.map +1 -1
- package/dist/src/security/index.js +116 -69
- package/dist/src/security/index.js.map +1 -1
- package/dist/src/security/path-safety.d.ts +1 -1
- package/dist/src/security/path-safety.d.ts.map +1 -1
- package/dist/src/security/path-safety.js +19 -19
- package/dist/src/security/path-safety.js.map +1 -1
- package/dist/src/security/permissions.d.ts +1 -1
- package/dist/src/security/permissions.d.ts.map +1 -1
- package/dist/src/security/permissions.js +12 -10
- package/dist/src/security/permissions.js.map +1 -1
- package/dist/src/security/read-tracker.d.ts +2 -2
- package/dist/src/security/read-tracker.d.ts.map +1 -1
- package/dist/src/security/read-tracker.js +15 -13
- package/dist/src/security/read-tracker.js.map +1 -1
- package/dist/src/security/ssrf-guard.d.ts +1 -1
- package/dist/src/security/ssrf-guard.d.ts.map +1 -1
- package/dist/src/security/ssrf-guard.js +11 -11
- package/dist/src/security/ssrf-guard.js.map +1 -1
- package/dist/src/security/types.d.ts +4 -4
- package/dist/src/security/types.d.ts.map +1 -1
- package/dist/src/security/wildcard.d.ts.map +1 -1
- package/dist/src/security/wildcard.js +14 -16
- package/dist/src/security/wildcard.js.map +1 -1
- package/dist/src/services/auth-store.d.ts +3 -3
- package/dist/src/services/auth-store.d.ts.map +1 -1
- package/dist/src/services/auth-store.js +7 -7
- package/dist/src/services/auth-store.js.map +1 -1
- package/dist/src/services/config.d.ts +3 -3
- package/dist/src/services/config.d.ts.map +1 -1
- package/dist/src/services/config.js +17 -21
- package/dist/src/services/config.js.map +1 -1
- package/dist/src/services/context.d.ts.map +1 -1
- package/dist/src/services/context.js +5 -8
- package/dist/src/services/context.js.map +1 -1
- package/dist/src/services/custom-providers.d.ts +2 -2
- package/dist/src/services/custom-providers.d.ts.map +1 -1
- package/dist/src/services/custom-providers.js +108 -49
- package/dist/src/services/custom-providers.js.map +1 -1
- package/dist/src/services/session-store.d.ts +1 -1
- package/dist/src/services/session-store.d.ts.map +1 -1
- package/dist/src/services/session-store.js +32 -24
- package/dist/src/services/session-store.js.map +1 -1
- package/dist/src/services/snapshot-manager.d.ts.map +1 -1
- package/dist/src/services/snapshot-manager.js +14 -15
- package/dist/src/services/snapshot-manager.js.map +1 -1
- package/dist/src/tools/edit.d.ts +1 -1
- package/dist/src/tools/edit.js +18 -16
- package/dist/src/tools/edit.js.map +1 -1
- package/dist/src/tools/glob.d.ts +1 -1
- package/dist/src/tools/glob.d.ts.map +1 -1
- package/dist/src/tools/glob.js +20 -16
- package/dist/src/tools/glob.js.map +1 -1
- package/dist/src/tools/grep.d.ts +1 -1
- package/dist/src/tools/grep.d.ts.map +1 -1
- package/dist/src/tools/grep.js +18 -18
- package/dist/src/tools/grep.js.map +1 -1
- package/dist/src/tools/index.d.ts +4 -4
- package/dist/src/tools/index.d.ts.map +1 -1
- package/dist/src/tools/index.js +40 -32
- package/dist/src/tools/index.js.map +1 -1
- package/dist/src/tools/mcp-tool.d.ts +2 -2
- package/dist/src/tools/mcp-tool.d.ts.map +1 -1
- package/dist/src/tools/mcp-tool.js +28 -25
- package/dist/src/tools/mcp-tool.js.map +1 -1
- package/dist/src/tools/read.d.ts +1 -1
- package/dist/src/tools/read.d.ts.map +1 -1
- package/dist/src/tools/read.js +15 -13
- package/dist/src/tools/read.js.map +1 -1
- package/dist/src/tools/shell.d.ts +1 -1
- package/dist/src/tools/shell.d.ts.map +1 -1
- package/dist/src/tools/shell.js +75 -66
- package/dist/src/tools/shell.js.map +1 -1
- package/dist/src/tools/task.d.ts +1 -1
- package/dist/src/tools/task.js +22 -22
- package/dist/src/tools/task.js.map +1 -1
- package/dist/src/tools/types.d.ts +3 -3
- package/dist/src/tools/types.d.ts.map +1 -1
- package/dist/src/tools/utils.d.ts +1 -1
- package/dist/src/tools/utils.js +2 -2
- package/dist/src/tools/utils.js.map +1 -1
- package/dist/src/tools/web-fetch.d.ts +1 -1
- package/dist/src/tools/web-fetch.js +31 -31
- package/dist/src/tools/web-fetch.js.map +1 -1
- package/dist/src/tools/write.d.ts +1 -1
- package/dist/src/tools/write.js +9 -9
- package/dist/src/tools/write.js.map +1 -1
- package/dist/src/tui/app-constants.d.ts.map +1 -1
- package/dist/src/tui/app-constants.js +11 -2
- package/dist/src/tui/app-constants.js.map +1 -1
- package/dist/src/tui/app.d.ts +1 -1
- package/dist/src/tui/app.d.ts.map +1 -1
- package/dist/src/tui/app.js +314 -121
- package/dist/src/tui/app.js.map +1 -1
- package/dist/src/tui/commands.d.ts +14 -14
- package/dist/src/tui/commands.d.ts.map +1 -1
- package/dist/src/tui/commands.js +242 -49
- package/dist/src/tui/commands.js.map +1 -1
- package/dist/src/tui/components/chat-area.d.ts +2 -2
- package/dist/src/tui/components/chat-area.d.ts.map +1 -1
- package/dist/src/tui/components/chat-area.js +5 -5
- package/dist/src/tui/components/chat-area.js.map +1 -1
- package/dist/src/tui/components/command-palette.d.ts.map +1 -1
- package/dist/src/tui/components/command-palette.js +7 -5
- package/dist/src/tui/components/command-palette.js.map +1 -1
- package/dist/src/tui/components/message.d.ts +2 -2
- package/dist/src/tui/components/message.d.ts.map +1 -1
- package/dist/src/tui/components/message.js +63 -52
- package/dist/src/tui/components/message.js.map +1 -1
- package/dist/src/tui/components/slash-autocomplete.d.ts +2 -2
- package/dist/src/tui/components/slash-autocomplete.d.ts.map +1 -1
- package/dist/src/tui/components/slash-autocomplete.js +6 -8
- package/dist/src/tui/components/slash-autocomplete.js.map +1 -1
- package/dist/src/tui/components/toast.d.ts +2 -2
- package/dist/src/tui/components/toast.d.ts.map +1 -1
- package/dist/src/tui/components/toast.js +11 -6
- package/dist/src/tui/components/toast.js.map +1 -1
- package/dist/src/tui/hooks/use-agent.d.ts +3 -3
- package/dist/src/tui/hooks/use-agent.d.ts.map +1 -1
- package/dist/src/tui/hooks/use-agent.js +22 -29
- package/dist/src/tui/hooks/use-agent.js.map +1 -1
- package/dist/src/tui/hooks/use-app-keyboard.d.ts +3 -3
- package/dist/src/tui/hooks/use-app-keyboard.d.ts.map +1 -1
- package/dist/src/tui/hooks/use-app-keyboard.js +28 -29
- package/dist/src/tui/hooks/use-app-keyboard.js.map +1 -1
- package/dist/src/tui/hooks/use-chat-submit.d.ts +6 -6
- package/dist/src/tui/hooks/use-chat-submit.d.ts.map +1 -1
- package/dist/src/tui/hooks/use-chat-submit.js +115 -54
- package/dist/src/tui/hooks/use-chat-submit.js.map +1 -1
- package/dist/src/tui/hooks/use-permission-queue.d.ts +2 -2
- package/dist/src/tui/hooks/use-permission-queue.d.ts.map +1 -1
- package/dist/src/tui/hooks/use-permission-queue.js +1 -1
- package/dist/src/tui/hooks/use-permission-queue.js.map +1 -1
- package/dist/src/tui/hooks/use-revert.d.ts +4 -4
- package/dist/src/tui/hooks/use-revert.d.ts.map +1 -1
- package/dist/src/tui/hooks/use-revert.js +22 -13
- package/dist/src/tui/hooks/use-revert.js.map +1 -1
- package/dist/src/tui/index.d.ts.map +1 -1
- package/dist/src/tui/index.js +11 -11
- package/dist/src/tui/index.js.map +1 -1
- package/dist/src/tui/prompt-bar.d.ts +1 -1
- package/dist/src/tui/prompt-bar.d.ts.map +1 -1
- package/dist/src/tui/prompt-bar.js +45 -16
- package/dist/src/tui/prompt-bar.js.map +1 -1
- package/dist/src/tui/slash-commands.d.ts +2 -2
- package/dist/src/tui/slash-commands.d.ts.map +1 -1
- package/dist/src/tui/slash-commands.js +9 -9
- package/dist/src/tui/slash-commands.js.map +1 -1
- package/dist/src/tui/theme.d.ts +1 -1
- package/dist/src/tui/theme.d.ts.map +1 -1
- package/dist/src/tui/theme.js +46 -38
- package/dist/src/tui/theme.js.map +1 -1
- package/dist/src/tui/tips.d.ts.map +1 -1
- package/dist/src/tui/tips.js +14 -14
- package/dist/src/tui/tips.js.map +1 -1
- package/dist/src/tui/types.d.ts +5 -5
- package/dist/src/tui/types.d.ts.map +1 -1
- package/dist/src/tui/ui/about-dialog.d.ts.map +1 -1
- package/dist/src/tui/ui/about-dialog.js +5 -5
- package/dist/src/tui/ui/about-dialog.js.map +1 -1
- package/dist/src/tui/ui/agent-switcher.d.ts.map +1 -1
- package/dist/src/tui/ui/agent-switcher.js +16 -14
- package/dist/src/tui/ui/agent-switcher.js.map +1 -1
- package/dist/src/tui/ui/debug-dialog.d.ts +1 -1
- package/dist/src/tui/ui/debug-dialog.d.ts.map +1 -1
- package/dist/src/tui/ui/debug-dialog.js +26 -26
- package/dist/src/tui/ui/debug-dialog.js.map +1 -1
- package/dist/src/tui/ui/doctor-dialog.d.ts +2 -2
- package/dist/src/tui/ui/doctor-dialog.d.ts.map +1 -1
- package/dist/src/tui/ui/doctor-dialog.js +10 -8
- package/dist/src/tui/ui/doctor-dialog.js.map +1 -1
- package/dist/src/tui/ui/manage-providers-dialog.d.ts +1 -1
- package/dist/src/tui/ui/manage-providers-dialog.d.ts.map +1 -1
- package/dist/src/tui/ui/manage-providers-dialog.js +102 -86
- package/dist/src/tui/ui/manage-providers-dialog.js.map +1 -1
- package/dist/src/tui/ui/mcp-toggle-dialog.d.ts.map +1 -1
- package/dist/src/tui/ui/mcp-toggle-dialog.js +17 -14
- package/dist/src/tui/ui/mcp-toggle-dialog.js.map +1 -1
- package/dist/src/tui/ui/message-controls.d.ts +1 -1
- package/dist/src/tui/ui/message-controls.d.ts.map +1 -1
- package/dist/src/tui/ui/message-controls.js +40 -28
- package/dist/src/tui/ui/message-controls.js.map +1 -1
- package/dist/src/tui/ui/model-switcher.d.ts.map +1 -1
- package/dist/src/tui/ui/model-switcher.js +40 -25
- package/dist/src/tui/ui/model-switcher.js.map +1 -1
- package/dist/src/tui/ui/permission-dialog.d.ts +1 -1
- package/dist/src/tui/ui/permission-dialog.d.ts.map +1 -1
- package/dist/src/tui/ui/permission-dialog.js +11 -11
- package/dist/src/tui/ui/permission-dialog.js.map +1 -1
- package/dist/src/tui/ui/provider-dialog.d.ts.map +1 -1
- package/dist/src/tui/ui/provider-dialog.js +75 -64
- package/dist/src/tui/ui/provider-dialog.js.map +1 -1
- package/dist/src/tui/ui/session-list.d.ts +3 -3
- package/dist/src/tui/ui/session-list.d.ts.map +1 -1
- package/dist/src/tui/ui/session-list.js +44 -32
- package/dist/src/tui/ui/session-list.js.map +1 -1
- package/dist/src/tui/ui/thinking-effort-dialog.d.ts.map +1 -1
- package/dist/src/tui/ui/thinking-effort-dialog.js +19 -19
- package/dist/src/tui/ui/thinking-effort-dialog.js.map +1 -1
- package/dist/src/tui/ui/update-dialog.d.ts +11 -0
- package/dist/src/tui/ui/update-dialog.d.ts.map +1 -0
- package/dist/src/tui/ui/update-dialog.js +23 -0
- package/dist/src/tui/ui/update-dialog.js.map +1 -0
- package/dist/src/tui/utils/model-config.d.ts.map +1 -1
- package/dist/src/tui/utils/model-config.js +13 -13
- package/dist/src/tui/utils/model-config.js.map +1 -1
- package/dist/src/tui/utils/session-messages.d.ts +2 -2
- package/dist/src/tui/utils/session-messages.d.ts.map +1 -1
- package/dist/src/tui/utils/session-messages.js +35 -22
- package/dist/src/tui/utils/session-messages.js.map +1 -1
- package/dist/src/tui/utils/update-check.d.ts +2 -0
- package/dist/src/tui/utils/update-check.d.ts.map +1 -0
- package/dist/src/tui/utils/update-check.js +65 -0
- package/dist/src/tui/utils/update-check.js.map +1 -0
- package/dist/src/tui/utils/version.d.ts.map +1 -1
- package/dist/src/tui/utils/version.js +7 -7
- package/dist/src/tui/utils/version.js.map +1 -1
- package/dist/src/tui/utils.d.ts +2 -2
- package/dist/src/tui/utils.d.ts.map +1 -1
- package/dist/src/tui/utils.js +7 -7
- package/dist/src/tui/utils.js.map +1 -1
- package/dist/src/tui/variant-cycle.d.ts.map +1 -1
- package/dist/src/tui/variant-cycle.js +23 -23
- package/dist/src/tui/variant-cycle.js.map +1 -1
- package/dist/src/utils/paths.d.ts.map +1 -1
- package/dist/src/utils/paths.js +25 -25
- package/dist/src/utils/paths.js.map +1 -1
- package/dist/src/utils/platform.d.ts.map +1 -1
- package/dist/src/utils/platform.js +15 -17
- package/dist/src/utils/platform.js.map +1 -1
- package/package.json +3 -3
package/dist/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { AgentTool } from
|
|
1
|
+
import type { AgentTool } from '@mohanscodex/spectra-agent';
|
|
2
2
|
export interface AgentDefinition {
|
|
3
3
|
name: string;
|
|
4
|
-
mode:
|
|
4
|
+
mode: 'primary' | 'subagent';
|
|
5
5
|
description: string;
|
|
6
6
|
tools: string[];
|
|
7
7
|
maxTurns: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definitions.d.ts","sourceRoot":"","sources":["../../../src/agents/definitions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,4BAA4B,
|
|
1
|
+
{"version":3,"file":"definitions.d.ts","sourceRoot":"","sources":["../../../src/agents/definitions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAE5D,MAAM,WAAW,eAAe;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,SAAS,GAAG,UAAU,CAAC;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;CACf;AAED,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CA2I7D,CAAC;AAEF,eAAO,MAAM,cAAc,UAEP,CAAC;AAErB,eAAO,MAAM,SAAS,UAEF,CAAC;AAErB,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,CAGhE;AAED,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,SAAS,EAAE,EAAE,SAAS,EAAE,MAAM,GAAG,SAAS,EAAE,CAGxF"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export const AGENT_DEFINITIONS = {
|
|
2
2
|
build: {
|
|
3
|
-
name:
|
|
4
|
-
mode:
|
|
5
|
-
description:
|
|
6
|
-
tools: [
|
|
3
|
+
name: 'build',
|
|
4
|
+
mode: 'primary',
|
|
5
|
+
description: 'Full development agent with all tools enabled. Use for implementation, editing, and running commands.',
|
|
6
|
+
tools: ['read', 'write', 'edit', 'bash', 'glob', 'grep', 'web_fetch', 'task'],
|
|
7
7
|
maxTurns: 30,
|
|
8
8
|
temperature: 0,
|
|
9
9
|
prompt: `## Mode: Build
|
|
@@ -35,10 +35,10 @@ You are in build mode — full development access. All tools are available.
|
|
|
35
35
|
- Be direct and concise — no conversational filler.`,
|
|
36
36
|
},
|
|
37
37
|
plan: {
|
|
38
|
-
name:
|
|
39
|
-
mode:
|
|
40
|
-
description:
|
|
41
|
-
tools: [
|
|
38
|
+
name: 'plan',
|
|
39
|
+
mode: 'primary',
|
|
40
|
+
description: 'Read-only planning and analysis. Cannot edit files or run commands. Use for designing approaches and understanding code.',
|
|
41
|
+
tools: ['read', 'glob', 'grep', 'web_fetch', 'task'],
|
|
42
42
|
maxTurns: 15,
|
|
43
43
|
temperature: 0,
|
|
44
44
|
prompt: `## Mode: Plan
|
|
@@ -68,10 +68,10 @@ You are in plan mode — read-only analysis and design. You CANNOT edit files, w
|
|
|
68
68
|
- Be thorough but structured. Avoid tangential exploration.`,
|
|
69
69
|
},
|
|
70
70
|
debug: {
|
|
71
|
-
name:
|
|
72
|
-
mode:
|
|
73
|
-
description:
|
|
74
|
-
tools: [
|
|
71
|
+
name: 'debug',
|
|
72
|
+
mode: 'primary',
|
|
73
|
+
description: 'Investigation and debugging. Can read files and run safe commands but cannot edit. Use for diagnosing issues.',
|
|
74
|
+
tools: ['read', 'bash', 'grep', 'glob'],
|
|
75
75
|
maxTurns: 20,
|
|
76
76
|
temperature: 0,
|
|
77
77
|
prompt: `## Mode: Debug
|
|
@@ -102,10 +102,10 @@ You are in debug mode — investigation and diagnosis. You can read files and ru
|
|
|
102
102
|
- Safe diagnostic commands are allowed (reading state, running tests). Destructive commands are not.`,
|
|
103
103
|
},
|
|
104
104
|
explore: {
|
|
105
|
-
name:
|
|
106
|
-
mode:
|
|
107
|
-
description:
|
|
108
|
-
tools: [
|
|
105
|
+
name: 'explore',
|
|
106
|
+
mode: 'subagent',
|
|
107
|
+
description: 'Fast, read-only codebase explorer. Use for file search, code navigation, and answering questions about the codebase.',
|
|
108
|
+
tools: ['read', 'glob', 'grep', 'web_fetch'],
|
|
109
109
|
maxTurns: 5,
|
|
110
110
|
temperature: 0,
|
|
111
111
|
prompt: `## Mode: Explore
|
|
@@ -132,10 +132,10 @@ You are a codebase exploration specialist — fast, thorough, read-only. Your jo
|
|
|
132
132
|
},
|
|
133
133
|
};
|
|
134
134
|
export const PRIMARY_AGENTS = Object.values(AGENT_DEFINITIONS)
|
|
135
|
-
.filter((d) => d.mode ===
|
|
135
|
+
.filter((d) => d.mode === 'primary')
|
|
136
136
|
.map((d) => d.name);
|
|
137
137
|
export const SUBAGENTS = Object.values(AGENT_DEFINITIONS)
|
|
138
|
-
.filter((d) => d.mode ===
|
|
138
|
+
.filter((d) => d.mode === 'subagent')
|
|
139
139
|
.map((d) => d.name);
|
|
140
140
|
export function getToolNamesForAgent(agentName) {
|
|
141
141
|
const def = AGENT_DEFINITIONS[agentName];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../../src/agents/definitions.ts"],"names":[],"mappings":"AAYA,MAAM,CAAC,MAAM,iBAAiB,GAAoC;
|
|
1
|
+
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../../src/agents/definitions.ts"],"names":[],"mappings":"AAYA,MAAM,CAAC,MAAM,iBAAiB,GAAoC;IACjE,KAAK,EAAE;QACN,IAAI,EAAE,OAAO;QACb,IAAI,EAAE,SAAS;QACf,WAAW,EACV,uGAAuG;QACxG,KAAK,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,CAAC;QAC7E,QAAQ,EAAE,EAAE;QACZ,WAAW,EAAE,CAAC;QACd,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;oDA0B0C;KAClD;IAED,IAAI,EAAE;QACL,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,SAAS;QACf,WAAW,EACV,0HAA0H;QAC3H,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,CAAC;QACpD,QAAQ,EAAE,EAAE;QACZ,WAAW,EAAE,CAAC;QACd,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;;;;;4DAwBkD;KAC1D;IAED,KAAK,EAAE;QACN,IAAI,EAAE,OAAO;QACb,IAAI,EAAE,SAAS;QACf,WAAW,EACV,+GAA+G;QAChH,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;QACvC,QAAQ,EAAE,EAAE;QACZ,WAAW,EAAE,CAAC;QACd,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;qGAyB2F;KACnG;IAED,OAAO,EAAE;QACR,IAAI,EAAE,SAAS;QACf,IAAI,EAAE,UAAU;QAChB,WAAW,EACV,sHAAsH;QACvH,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,CAAC;QAC5C,QAAQ,EAAE,CAAC;QACX,WAAW,EAAE,CAAC;QACd,MAAM,EAAE;;;;;;;;;;;;;;;;;;;qDAmB2C,CAAC;4EACsB;KAC1E;CACD,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,CAAC,iBAAiB,CAAC;KAC5D,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,SAAS,CAAC;KACnC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;AAErB,MAAM,CAAC,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,iBAAiB,CAAC;KACvD,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,UAAU,CAAC;KACpC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;AAErB,MAAM,UAAU,oBAAoB,CAAC,SAAiB;IACrD,MAAM,GAAG,GAAG,iBAAiB,CAAC,SAAS,CAAC,CAAC;IACzC,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AAClC,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,QAAqB,EAAE,SAAiB;IAC1E,MAAM,OAAO,GAAG,oBAAoB,CAAC,SAAS,CAAC,CAAC;IAChD,OAAO,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;AACzD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../src/agents/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,yBAAyB,
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../src/agents/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAErD,MAAM,WAAW,mBAAmB;IACnC,KAAK,EAAE,KAAK,CAAC;IACb,SAAS,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,GAAG,MAAM,GAAG,SAAS,CAAC;CACnF;AAID,eAAO,MAAM,aAAa;sBACP,mBAAmB;iBAGxB,mBAAmB,GAAG,IAAI;;CAMvC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../../src/agents/registry.ts"],"names":[],"mappings":"AAOA,IAAI,aAAa,GAA+B,IAAI,
|
|
1
|
+
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../../src/agents/registry.ts"],"names":[],"mappings":"AAOA,IAAI,aAAa,GAA+B,IAAI,CAAC;AAErD,MAAM,CAAC,MAAM,aAAa,GAAG;IAC5B,SAAS,CAAC,MAA2B;QACpC,aAAa,GAAG,MAAM,CAAC;IACxB,CAAC;IACD,SAAS;QACR,OAAO,aAAa,CAAC;IACtB,CAAC;IACD,KAAK;QACJ,aAAa,GAAG,IAAI,CAAC;IACtB,CAAC;CACD,CAAC"}
|
package/dist/src/cli.js
CHANGED
|
@@ -1,48 +1,48 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
|
-
import yargs from
|
|
3
|
-
import { hideBin } from
|
|
4
|
-
import { spinner, text, confirm, select, outro, isCancel, cancel } from
|
|
5
|
-
import chalk from
|
|
6
|
-
import { SessionStore } from
|
|
7
|
-
import { loadConfig, saveConfig } from
|
|
8
|
-
import { connectServer, disconnectServer, listConnectedServers, listServerTools } from
|
|
2
|
+
import yargs from 'yargs';
|
|
3
|
+
import { hideBin } from 'yargs/helpers';
|
|
4
|
+
import { spinner, text, confirm, select, outro, isCancel, cancel } from '@clack/prompts';
|
|
5
|
+
import chalk from 'chalk';
|
|
6
|
+
import { SessionStore } from './services/session-store.js';
|
|
7
|
+
import { loadConfig, saveConfig } from './services/config.js';
|
|
8
|
+
import { connectServer, disconnectServer, listConnectedServers, listServerTools } from './integrations/mcp/index.js';
|
|
9
9
|
async function main() {
|
|
10
|
-
const pkg = await import(
|
|
10
|
+
const pkg = await import('../package.json', { with: { type: 'json' } });
|
|
11
11
|
const version = pkg.default.version;
|
|
12
12
|
const cli = yargs(hideBin(process.argv))
|
|
13
|
-
.scriptName(
|
|
13
|
+
.scriptName('spectra')
|
|
14
14
|
.version(version)
|
|
15
15
|
.help()
|
|
16
|
-
.alias(
|
|
17
|
-
.alias(
|
|
18
|
-
.locale(
|
|
16
|
+
.alias('h', 'help')
|
|
17
|
+
.alias('v', 'version')
|
|
18
|
+
.locale('en')
|
|
19
19
|
.wrap(Math.min(100, process.stdout.columns || 100))
|
|
20
|
-
.epilogue(chalk.dim(
|
|
20
|
+
.epilogue(chalk.dim('Spectra Code — AI coding agent in your terminal'));
|
|
21
21
|
// Default: launch TUI
|
|
22
|
-
cli.command(
|
|
23
|
-
const { launchTui } = await import(
|
|
22
|
+
cli.command('$0', false, () => { }, async () => {
|
|
23
|
+
const { launchTui } = await import('./tui/index.js');
|
|
24
24
|
await launchTui({});
|
|
25
25
|
});
|
|
26
26
|
// Session commands
|
|
27
|
-
cli.command(
|
|
28
|
-
.positional(
|
|
29
|
-
describe:
|
|
30
|
-
choices: [
|
|
27
|
+
cli.command('session <action>', 'Manage sessions', (y) => y
|
|
28
|
+
.positional('action', {
|
|
29
|
+
describe: 'Action to perform',
|
|
30
|
+
choices: ['list', 'delete'],
|
|
31
31
|
demandOption: true,
|
|
32
32
|
})
|
|
33
|
-
.option(
|
|
34
|
-
describe:
|
|
35
|
-
type:
|
|
33
|
+
.option('id', {
|
|
34
|
+
describe: 'Session ID (for delete)',
|
|
35
|
+
type: 'string',
|
|
36
36
|
}), async (argv) => {
|
|
37
37
|
const store = new SessionStore();
|
|
38
38
|
const action = argv.action;
|
|
39
|
-
if (action ===
|
|
39
|
+
if (action === 'list') {
|
|
40
40
|
const sessions = store.list();
|
|
41
41
|
if (!sessions.length) {
|
|
42
|
-
outro(chalk.yellow(
|
|
42
|
+
outro(chalk.yellow('No sessions found.'));
|
|
43
43
|
return;
|
|
44
44
|
}
|
|
45
|
-
console.log(chalk.bold(
|
|
45
|
+
console.log(chalk.bold('\n Sessions\n'));
|
|
46
46
|
for (const s of sessions) {
|
|
47
47
|
const date = new Date(s.updated).toLocaleString();
|
|
48
48
|
console.log(` ${chalk.cyan(s.id.slice(0, 12))} ${chalk.white(s.title.slice(0, 50))} ${chalk.dim(date)}`);
|
|
@@ -51,23 +51,23 @@ async function main() {
|
|
|
51
51
|
outro(chalk.dim(`${sessions.length} session(s)`));
|
|
52
52
|
return;
|
|
53
53
|
}
|
|
54
|
-
if (action ===
|
|
54
|
+
if (action === 'delete') {
|
|
55
55
|
const id = argv.id;
|
|
56
56
|
if (!id) {
|
|
57
57
|
const selected = await select({
|
|
58
|
-
message:
|
|
58
|
+
message: 'Select session to delete',
|
|
59
59
|
options: store.list().map((s) => ({
|
|
60
60
|
value: s.id,
|
|
61
61
|
label: `${s.id.slice(0, 12)} ${s.title.slice(0, 50)}`,
|
|
62
62
|
})),
|
|
63
63
|
});
|
|
64
64
|
if (isCancel(selected)) {
|
|
65
|
-
cancel(
|
|
65
|
+
cancel('Cancelled.');
|
|
66
66
|
process.exit(0);
|
|
67
67
|
}
|
|
68
|
-
const ok = await confirm({ message:
|
|
68
|
+
const ok = await confirm({ message: 'Are you sure?' });
|
|
69
69
|
if (!ok) {
|
|
70
|
-
cancel(
|
|
70
|
+
cancel('Cancelled.');
|
|
71
71
|
process.exit(0);
|
|
72
72
|
}
|
|
73
73
|
store.delete(selected);
|
|
@@ -86,19 +86,19 @@ async function main() {
|
|
|
86
86
|
}
|
|
87
87
|
});
|
|
88
88
|
// Agent commands
|
|
89
|
-
cli.command(
|
|
90
|
-
describe:
|
|
91
|
-
choices: [
|
|
89
|
+
cli.command('agent <action>', 'Manage agents', (y) => y.positional('action', {
|
|
90
|
+
describe: 'Action to perform',
|
|
91
|
+
choices: ['list'],
|
|
92
92
|
demandOption: true,
|
|
93
93
|
}), async (argv) => {
|
|
94
|
-
if (argv.action ===
|
|
94
|
+
if (argv.action === 'list') {
|
|
95
95
|
const agents = [
|
|
96
|
-
{ name:
|
|
97
|
-
{ name:
|
|
98
|
-
{ name:
|
|
99
|
-
{ name:
|
|
96
|
+
{ name: 'build', desc: 'Default agent (full tools)' },
|
|
97
|
+
{ name: 'plan', desc: 'Planning mode' },
|
|
98
|
+
{ name: 'explore', desc: 'Codebase exploration' },
|
|
99
|
+
{ name: 'debug', desc: 'Investigation' },
|
|
100
100
|
];
|
|
101
|
-
console.log(chalk.bold(
|
|
101
|
+
console.log(chalk.bold('\n Agents\n'));
|
|
102
102
|
for (const a of agents) {
|
|
103
103
|
console.log(` ${chalk.cyan(a.name.padEnd(10))} ${chalk.dim(a.desc)}`);
|
|
104
104
|
}
|
|
@@ -107,26 +107,26 @@ async function main() {
|
|
|
107
107
|
}
|
|
108
108
|
});
|
|
109
109
|
// Plugin commands
|
|
110
|
-
cli.command(
|
|
111
|
-
.positional(
|
|
112
|
-
describe:
|
|
113
|
-
choices: [
|
|
110
|
+
cli.command('plugin <action>', 'Manage plugins', (y) => y
|
|
111
|
+
.positional('action', {
|
|
112
|
+
describe: 'Action to perform',
|
|
113
|
+
choices: ['list', 'install'],
|
|
114
114
|
demandOption: true,
|
|
115
115
|
})
|
|
116
|
-
.option(
|
|
117
|
-
describe:
|
|
118
|
-
type:
|
|
116
|
+
.option('name', {
|
|
117
|
+
describe: 'Plugin name (for install)',
|
|
118
|
+
type: 'string',
|
|
119
119
|
}), async (argv) => {
|
|
120
|
-
if (argv.action ===
|
|
121
|
-
outro(chalk.yellow(
|
|
120
|
+
if (argv.action === 'list') {
|
|
121
|
+
outro(chalk.yellow('No plugins installed.'));
|
|
122
122
|
return;
|
|
123
123
|
}
|
|
124
|
-
if (argv.action ===
|
|
124
|
+
if (argv.action === 'install') {
|
|
125
125
|
const name = argv.name;
|
|
126
126
|
if (!name) {
|
|
127
|
-
const input = await text({ message:
|
|
127
|
+
const input = await text({ message: 'Plugin name to install' });
|
|
128
128
|
if (isCancel(input)) {
|
|
129
|
-
cancel(
|
|
129
|
+
cancel('Cancelled.');
|
|
130
130
|
process.exit(0);
|
|
131
131
|
}
|
|
132
132
|
outro(chalk.yellow(`Install "${input}" — not yet implemented`));
|
|
@@ -137,38 +137,38 @@ async function main() {
|
|
|
137
137
|
}
|
|
138
138
|
});
|
|
139
139
|
// MCP commands
|
|
140
|
-
cli.command(
|
|
141
|
-
.positional(
|
|
142
|
-
describe:
|
|
143
|
-
choices: [
|
|
140
|
+
cli.command('mcp <action>', 'Manage MCP servers', (y) => y
|
|
141
|
+
.positional('action', {
|
|
142
|
+
describe: 'Action to perform',
|
|
143
|
+
choices: ['list', 'add', 'remove', 'connect', 'disconnect', 'tools'],
|
|
144
144
|
demandOption: true,
|
|
145
145
|
})
|
|
146
|
-
.option(
|
|
147
|
-
.option(
|
|
148
|
-
.option(
|
|
149
|
-
.option(
|
|
150
|
-
.option(
|
|
151
|
-
.option(
|
|
146
|
+
.option('name', { describe: 'Server name', type: 'string' })
|
|
147
|
+
.option('url', { describe: 'Remote server URL', type: 'string' })
|
|
148
|
+
.option('env', { describe: 'Environment variables (KEY=VALUE, comma-separated)', type: 'string' })
|
|
149
|
+
.option('header', { describe: 'HTTP headers (KEY=VALUE, comma-separated)', type: 'string' })
|
|
150
|
+
.option('command', { describe: 'Command to run (for local servers)', type: 'string' })
|
|
151
|
+
.option('server', { describe: 'Server name (for tools command)', type: 'string' }), async (argv) => {
|
|
152
152
|
const action = argv.action;
|
|
153
153
|
const config = loadConfig();
|
|
154
|
-
if (action ===
|
|
154
|
+
if (action === 'list') {
|
|
155
155
|
const servers = config.mcp ?? [];
|
|
156
156
|
const connected = listConnectedServers().map((s) => s.name);
|
|
157
157
|
if (!servers.length) {
|
|
158
|
-
outro(chalk.yellow(
|
|
158
|
+
outro(chalk.yellow('No MCP servers configured.'));
|
|
159
159
|
console.log(chalk.dim(` Use "spectra mcp add <name> --command ..." to add one.\n`));
|
|
160
160
|
return;
|
|
161
161
|
}
|
|
162
|
-
console.log(chalk.bold(
|
|
162
|
+
console.log(chalk.bold('\n MCP Servers\n'));
|
|
163
163
|
for (const s of servers) {
|
|
164
164
|
const isConnected = connected.includes(s.name);
|
|
165
165
|
const statusColor = s.enabled === false ? chalk.red : isConnected ? chalk.green : chalk.yellow;
|
|
166
|
-
const status = s.enabled === false ?
|
|
166
|
+
const status = s.enabled === false ? 'disabled' : isConnected ? 'connected' : 'disconnected';
|
|
167
167
|
const target = s.command
|
|
168
|
-
? `stdio: ${chalk.dim([s.command, ...(s.args ?? [])].join(
|
|
168
|
+
? `stdio: ${chalk.dim([s.command, ...(s.args ?? [])].join(' '))}`
|
|
169
169
|
: s.url
|
|
170
170
|
? `http: ${chalk.dim(s.url)}`
|
|
171
|
-
: chalk.dim(
|
|
171
|
+
: chalk.dim('(no target)');
|
|
172
172
|
console.log(` ${chalk.cyan(s.name)} ${statusColor(`[${status}]`)}`);
|
|
173
173
|
console.log(` ${target}`);
|
|
174
174
|
if (isConnected) {
|
|
@@ -181,12 +181,12 @@ async function main() {
|
|
|
181
181
|
outro(`${servers.length} server(s) configured`);
|
|
182
182
|
return;
|
|
183
183
|
}
|
|
184
|
-
if (action ===
|
|
184
|
+
if (action === 'add') {
|
|
185
185
|
let serverName = argv.name;
|
|
186
186
|
if (!serverName) {
|
|
187
|
-
const input = await text({ message:
|
|
187
|
+
const input = await text({ message: 'Server name' });
|
|
188
188
|
if (isCancel(input)) {
|
|
189
|
-
cancel(
|
|
189
|
+
cancel('Cancelled.');
|
|
190
190
|
process.exit(0);
|
|
191
191
|
}
|
|
192
192
|
serverName = input;
|
|
@@ -200,28 +200,30 @@ async function main() {
|
|
|
200
200
|
let url = argv.url;
|
|
201
201
|
if (!command && !url) {
|
|
202
202
|
const choice = await select({
|
|
203
|
-
message:
|
|
203
|
+
message: 'Server type',
|
|
204
204
|
options: [
|
|
205
|
-
{ value:
|
|
206
|
-
{ value:
|
|
205
|
+
{ value: 'local', label: 'Local (stdio)' },
|
|
206
|
+
{ value: 'remote', label: 'Remote (HTTP)' },
|
|
207
207
|
],
|
|
208
208
|
});
|
|
209
209
|
if (isCancel(choice)) {
|
|
210
|
-
cancel(
|
|
210
|
+
cancel('Cancelled.');
|
|
211
211
|
process.exit(0);
|
|
212
212
|
}
|
|
213
|
-
if (choice ===
|
|
214
|
-
const cmdInput = await text({
|
|
213
|
+
if (choice === 'local') {
|
|
214
|
+
const cmdInput = await text({
|
|
215
|
+
message: 'Command (e.g. npx -y @modelcontextprotocol/server-filesystem /path)',
|
|
216
|
+
});
|
|
215
217
|
if (isCancel(cmdInput)) {
|
|
216
|
-
cancel(
|
|
218
|
+
cancel('Cancelled.');
|
|
217
219
|
process.exit(0);
|
|
218
220
|
}
|
|
219
221
|
command = cmdInput;
|
|
220
222
|
}
|
|
221
223
|
else {
|
|
222
|
-
const urlInput = await text({ message:
|
|
224
|
+
const urlInput = await text({ message: 'Server URL' });
|
|
223
225
|
if (isCancel(urlInput)) {
|
|
224
|
-
cancel(
|
|
226
|
+
cancel('Cancelled.');
|
|
225
227
|
process.exit(0);
|
|
226
228
|
}
|
|
227
229
|
url = urlInput;
|
|
@@ -232,25 +234,25 @@ async function main() {
|
|
|
232
234
|
entry.url = url;
|
|
233
235
|
if (argv.header) {
|
|
234
236
|
const headers = {};
|
|
235
|
-
argv.header.split(
|
|
236
|
-
const [key, ...rest] = pair.split(
|
|
237
|
+
argv.header.split(',').forEach((pair) => {
|
|
238
|
+
const [key, ...rest] = pair.split('=');
|
|
237
239
|
if (key && rest.length > 0)
|
|
238
|
-
headers[key.trim()] = rest.join(
|
|
240
|
+
headers[key.trim()] = rest.join('=').trim();
|
|
239
241
|
});
|
|
240
242
|
entry.headers = headers;
|
|
241
243
|
}
|
|
242
244
|
}
|
|
243
245
|
else if (command) {
|
|
244
|
-
const parts = command.split(
|
|
246
|
+
const parts = command.split(' ');
|
|
245
247
|
entry.command = parts[0];
|
|
246
248
|
entry.args = parts.slice(1);
|
|
247
249
|
}
|
|
248
250
|
if (argv.env) {
|
|
249
251
|
const env = {};
|
|
250
|
-
argv.env.split(
|
|
251
|
-
const [key, ...rest] = pair.split(
|
|
252
|
+
argv.env.split(',').forEach((pair) => {
|
|
253
|
+
const [key, ...rest] = pair.split('=');
|
|
252
254
|
if (key && rest.length > 0)
|
|
253
|
-
env[key.trim()] = rest.join(
|
|
255
|
+
env[key.trim()] = rest.join('=').trim();
|
|
254
256
|
});
|
|
255
257
|
entry.env = env;
|
|
256
258
|
}
|
|
@@ -261,12 +263,12 @@ async function main() {
|
|
|
261
263
|
outro(chalk.green(`Added MCP server "${serverName}".`));
|
|
262
264
|
return;
|
|
263
265
|
}
|
|
264
|
-
if (action ===
|
|
266
|
+
if (action === 'remove') {
|
|
265
267
|
const name = argv.name;
|
|
266
268
|
if (!name) {
|
|
267
|
-
const input = await text({ message:
|
|
269
|
+
const input = await text({ message: 'Server name to remove' });
|
|
268
270
|
if (isCancel(input)) {
|
|
269
|
-
cancel(
|
|
271
|
+
cancel('Cancelled.');
|
|
270
272
|
process.exit(0);
|
|
271
273
|
}
|
|
272
274
|
argv.name = input;
|
|
@@ -283,23 +285,23 @@ async function main() {
|
|
|
283
285
|
outro(chalk.green(`Removed MCP server "${serverName}".`));
|
|
284
286
|
return;
|
|
285
287
|
}
|
|
286
|
-
if (action ===
|
|
288
|
+
if (action === 'connect') {
|
|
287
289
|
let serverName = argv.name;
|
|
288
290
|
if (!serverName) {
|
|
289
291
|
const servers = (config.mcp ?? []).filter((s) => s.enabled !== false);
|
|
290
292
|
if (!servers.length) {
|
|
291
|
-
outro(chalk.yellow(
|
|
293
|
+
outro(chalk.yellow('No servers to connect.'));
|
|
292
294
|
return;
|
|
293
295
|
}
|
|
294
296
|
const selected = await select({
|
|
295
|
-
message:
|
|
297
|
+
message: 'Select server to connect',
|
|
296
298
|
options: servers.map((s) => ({
|
|
297
299
|
value: s.name,
|
|
298
|
-
label: `${s.name} (${s.command ?
|
|
300
|
+
label: `${s.name} (${s.command ? 'stdio' : 'http'})`,
|
|
299
301
|
})),
|
|
300
302
|
});
|
|
301
303
|
if (isCancel(selected)) {
|
|
302
|
-
cancel(
|
|
304
|
+
cancel('Cancelled.');
|
|
303
305
|
process.exit(0);
|
|
304
306
|
}
|
|
305
307
|
serverName = selected;
|
|
@@ -330,20 +332,20 @@ async function main() {
|
|
|
330
332
|
}
|
|
331
333
|
return;
|
|
332
334
|
}
|
|
333
|
-
if (action ===
|
|
335
|
+
if (action === 'disconnect') {
|
|
334
336
|
let serverName = argv.name;
|
|
335
337
|
if (!serverName) {
|
|
336
338
|
const connected = listConnectedServers();
|
|
337
339
|
if (!connected.length) {
|
|
338
|
-
outro(chalk.yellow(
|
|
340
|
+
outro(chalk.yellow('No servers connected.'));
|
|
339
341
|
return;
|
|
340
342
|
}
|
|
341
343
|
const selected = await select({
|
|
342
|
-
message:
|
|
344
|
+
message: 'Select server to disconnect',
|
|
343
345
|
options: connected.map((s) => ({ value: s.name, label: s.name })),
|
|
344
346
|
});
|
|
345
347
|
if (isCancel(selected)) {
|
|
346
|
-
cancel(
|
|
348
|
+
cancel('Cancelled.');
|
|
347
349
|
process.exit(0);
|
|
348
350
|
}
|
|
349
351
|
serverName = selected;
|
|
@@ -358,20 +360,20 @@ async function main() {
|
|
|
358
360
|
}
|
|
359
361
|
return;
|
|
360
362
|
}
|
|
361
|
-
if (action ===
|
|
363
|
+
if (action === 'tools') {
|
|
362
364
|
let serverName = (argv.server || argv.name);
|
|
363
365
|
if (!serverName) {
|
|
364
366
|
const connected = listConnectedServers();
|
|
365
367
|
if (!connected.length) {
|
|
366
|
-
outro(chalk.yellow(
|
|
368
|
+
outro(chalk.yellow('No servers connected.'));
|
|
367
369
|
return;
|
|
368
370
|
}
|
|
369
371
|
const selected = await select({
|
|
370
|
-
message:
|
|
372
|
+
message: 'Select server',
|
|
371
373
|
options: connected.map((s) => ({ value: s.name, label: `${s.name} (${s.tools.length} tools)` })),
|
|
372
374
|
});
|
|
373
375
|
if (isCancel(selected)) {
|
|
374
|
-
cancel(
|
|
376
|
+
cancel('Cancelled.');
|
|
375
377
|
process.exit(0);
|
|
376
378
|
}
|
|
377
379
|
serverName = selected;
|
|
@@ -399,38 +401,38 @@ async function main() {
|
|
|
399
401
|
}
|
|
400
402
|
});
|
|
401
403
|
// Doctor command
|
|
402
|
-
cli.command(
|
|
403
|
-
const { runDoctor } = await import(
|
|
404
|
+
cli.command('doctor', 'Run system health check', () => { }, async () => {
|
|
405
|
+
const { runDoctor } = await import('./commands/doctor.js');
|
|
404
406
|
const result = await runDoctor();
|
|
405
|
-
process.stdout.write(
|
|
407
|
+
process.stdout.write('Spectra Code — System Health Check\n\n');
|
|
406
408
|
for (const check of result.checks) {
|
|
407
|
-
process.stdout.write(`${check.passed ?
|
|
409
|
+
process.stdout.write(`${check.passed ? '✓' : '✗'} [${check.section}] ${check.name}\n`);
|
|
408
410
|
process.stdout.write(` ${check.detail}\n`);
|
|
409
411
|
}
|
|
410
|
-
process.stdout.write(`\n${result.allPassed ?
|
|
412
|
+
process.stdout.write(`\n${result.allPassed ? '✓ All checks passed.' : '✗ Some checks failed — review the items above.'}\n`);
|
|
411
413
|
process.exit(result.allPassed ? 0 : 1);
|
|
412
414
|
});
|
|
413
415
|
// ACP command
|
|
414
|
-
cli.command(
|
|
415
|
-
const { ACPAdapter } = await import(
|
|
416
|
+
cli.command('acp', 'Run as ACP-compatible agent (Agent Client Protocol over stdio)', () => { }, async () => {
|
|
417
|
+
const { ACPAdapter } = await import('./integrations/acp/index.js');
|
|
416
418
|
const adapter = new ACPAdapter();
|
|
417
419
|
adapter.start();
|
|
418
420
|
});
|
|
419
421
|
// DB command
|
|
420
|
-
cli.command(
|
|
421
|
-
describe:
|
|
422
|
-
choices: [
|
|
422
|
+
cli.command('db <action>', 'Database utilities', (y) => y.positional('action', {
|
|
423
|
+
describe: 'Action',
|
|
424
|
+
choices: ['path'],
|
|
423
425
|
demandOption: true,
|
|
424
426
|
}), async (argv) => {
|
|
425
|
-
if (argv.action ===
|
|
426
|
-
const { getGlobalDataDir } = await import(
|
|
427
|
+
if (argv.action === 'path') {
|
|
428
|
+
const { getGlobalDataDir } = await import('./utils/paths.js');
|
|
427
429
|
console.log(`${getGlobalDataDir()}/spectra.db`);
|
|
428
430
|
}
|
|
429
431
|
});
|
|
430
432
|
await cli.parse();
|
|
431
433
|
}
|
|
432
434
|
main().catch((err) => {
|
|
433
|
-
console.error(chalk.red(
|
|
435
|
+
console.error(chalk.red('Fatal:'), err);
|
|
434
436
|
process.exit(1);
|
|
435
437
|
});
|
|
436
438
|
//# sourceMappingURL=cli.js.map
|