dexto 1.5.5 → 1.5.7
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/README.md +13 -0
- package/dist/agents/agent-template.yml +1 -1
- package/dist/agents/coding-agent/coding-agent.yml +17 -2
- package/dist/agents/coding-agent/skills/code-review.md +46 -0
- package/dist/agents/explore-agent/explore-agent.yml +2 -0
- package/dist/agents/podcast-agent/podcast-agent.yml +1 -1
- package/dist/analytics/events.d.ts +1 -1
- package/dist/analytics/events.d.ts.map +1 -1
- package/dist/api/server-hono.d.ts.map +1 -1
- package/dist/api/server-hono.js +55 -10
- package/dist/cli/assets/dexto-logo.svg +31 -0
- package/dist/cli/auth/api-client.d.ts +49 -0
- package/dist/cli/auth/api-client.d.ts.map +1 -0
- package/dist/cli/auth/api-client.js +127 -0
- package/dist/cli/auth/constants.d.ts +23 -0
- package/dist/cli/auth/constants.d.ts.map +1 -0
- package/dist/cli/auth/constants.js +24 -0
- package/dist/cli/auth/index.d.ts +5 -0
- package/dist/cli/auth/index.d.ts.map +1 -0
- package/dist/cli/auth/index.js +6 -0
- package/dist/cli/auth/oauth.d.ts +26 -0
- package/dist/cli/auth/oauth.d.ts.map +1 -0
- package/dist/cli/auth/oauth.js +327 -0
- package/dist/cli/auth/service.d.ts +20 -0
- package/dist/cli/auth/service.d.ts.map +1 -0
- package/dist/cli/auth/service.js +147 -0
- package/dist/cli/commands/auth/index.d.ts +4 -0
- package/dist/cli/commands/auth/index.d.ts.map +1 -0
- package/dist/cli/commands/auth/index.js +4 -0
- package/dist/cli/commands/auth/login.d.ts +9 -0
- package/dist/cli/commands/auth/login.d.ts.map +1 -0
- package/dist/cli/commands/auth/login.js +255 -0
- package/dist/cli/commands/auth/logout.d.ts +5 -0
- package/dist/cli/commands/auth/logout.d.ts.map +1 -0
- package/dist/cli/commands/auth/logout.js +51 -0
- package/dist/cli/commands/auth/status.d.ts +2 -0
- package/dist/cli/commands/auth/status.d.ts.map +1 -0
- package/dist/cli/commands/auth/status.js +22 -0
- package/dist/cli/commands/billing/index.d.ts +2 -0
- package/dist/cli/commands/billing/index.d.ts.map +1 -0
- package/dist/cli/commands/billing/index.js +2 -0
- package/dist/cli/commands/billing/status.d.ts +6 -0
- package/dist/cli/commands/billing/status.d.ts.map +1 -0
- package/dist/cli/commands/billing/status.js +60 -0
- package/dist/cli/commands/index.d.ts +4 -0
- package/dist/cli/commands/index.d.ts.map +1 -1
- package/dist/cli/commands/index.js +9 -0
- package/dist/cli/commands/interactive-commands/auth/index.d.ts +12 -0
- package/dist/cli/commands/interactive-commands/auth/index.d.ts.map +1 -0
- package/dist/cli/commands/interactive-commands/auth/index.js +20 -0
- package/dist/cli/commands/interactive-commands/command-parser.d.ts +5 -0
- package/dist/cli/commands/interactive-commands/command-parser.d.ts.map +1 -1
- package/dist/cli/commands/interactive-commands/command-parser.js +6 -0
- package/dist/cli/commands/interactive-commands/commands.d.ts +1 -0
- package/dist/cli/commands/interactive-commands/commands.d.ts.map +1 -1
- package/dist/cli/commands/interactive-commands/commands.js +10 -0
- package/dist/cli/commands/interactive-commands/export/index.d.ts +13 -0
- package/dist/cli/commands/interactive-commands/export/index.d.ts.map +1 -0
- package/dist/cli/commands/interactive-commands/export/index.js +21 -0
- package/dist/cli/commands/interactive-commands/general-commands.d.ts.map +1 -1
- package/dist/cli/commands/interactive-commands/general-commands.js +1 -0
- package/dist/cli/commands/interactive-commands/mcp/index.d.ts +2 -2
- package/dist/cli/commands/interactive-commands/mcp/index.d.ts.map +1 -1
- package/dist/cli/commands/interactive-commands/mcp/index.js +4 -7
- package/dist/cli/commands/interactive-commands/model/index.d.ts +2 -2
- package/dist/cli/commands/interactive-commands/model/index.d.ts.map +1 -1
- package/dist/cli/commands/interactive-commands/model/index.js +4 -7
- package/dist/cli/commands/interactive-commands/plugin/index.d.ts +13 -0
- package/dist/cli/commands/interactive-commands/plugin/index.d.ts.map +1 -0
- package/dist/cli/commands/interactive-commands/plugin/index.js +18 -0
- package/dist/cli/commands/interactive-commands/prompt-commands.d.ts +3 -1
- package/dist/cli/commands/interactive-commands/prompt-commands.d.ts.map +1 -1
- package/dist/cli/commands/interactive-commands/prompt-commands.js +72 -36
- package/dist/cli/commands/interactive-commands/system/system-commands.d.ts.map +1 -1
- package/dist/cli/commands/interactive-commands/system/system-commands.js +2 -3
- package/dist/cli/commands/plugin.d.ts +161 -0
- package/dist/cli/commands/plugin.d.ts.map +1 -0
- package/dist/cli/commands/plugin.js +376 -0
- package/dist/cli/commands/setup.d.ts +9 -9
- package/dist/cli/commands/setup.d.ts.map +1 -1
- package/dist/cli/commands/setup.js +325 -37
- package/dist/cli/commands/sync-agents.d.ts +44 -0
- package/dist/cli/commands/sync-agents.d.ts.map +1 -0
- package/dist/cli/commands/sync-agents.js +483 -0
- package/dist/cli/ink-cli/InkCLIRefactored.d.ts +14 -1
- package/dist/cli/ink-cli/InkCLIRefactored.d.ts.map +1 -1
- package/dist/cli/ink-cli/InkCLIRefactored.js +8 -2
- package/dist/cli/ink-cli/components/ApprovalPrompt.d.ts +1 -1
- package/dist/cli/ink-cli/components/ApprovalPrompt.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/ApprovalPrompt.js +80 -12
- package/dist/cli/ink-cli/components/Footer.d.ts +2 -1
- package/dist/cli/ink-cli/components/Footer.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/Footer.js +6 -2
- package/dist/cli/ink-cli/components/SlashCommandAutocomplete.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/SlashCommandAutocomplete.js +15 -7
- package/dist/cli/ink-cli/components/StatusBar.d.ts +9 -1
- package/dist/cli/ink-cli/components/StatusBar.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/StatusBar.js +17 -5
- package/dist/cli/ink-cli/components/TodoPanel.d.ts +11 -8
- package/dist/cli/ink-cli/components/TodoPanel.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/TodoPanel.js +38 -36
- package/dist/cli/ink-cli/components/chat/Header.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/chat/Header.js +1 -1
- package/dist/cli/ink-cli/components/chat/MessageItem.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/chat/MessageItem.js +14 -1
- package/dist/cli/ink-cli/components/chat/styled-boxes/LogConfigBox.js +1 -1
- package/dist/cli/ink-cli/components/modes/AlternateBufferCLI.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/modes/AlternateBufferCLI.js +16 -4
- package/dist/cli/ink-cli/components/modes/StaticCLI.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/modes/StaticCLI.js +4 -1
- package/dist/cli/ink-cli/components/overlays/ExportWizard.d.ts +22 -0
- package/dist/cli/ink-cli/components/overlays/ExportWizard.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/ExportWizard.js +308 -0
- package/dist/cli/ink-cli/components/overlays/LogLevelSelector.d.ts +1 -0
- package/dist/cli/ink-cli/components/overlays/LogLevelSelector.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/overlays/LogLevelSelector.js +31 -20
- package/dist/cli/ink-cli/components/overlays/MarketplaceAddPrompt.d.ts +20 -0
- package/dist/cli/ink-cli/components/overlays/MarketplaceAddPrompt.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/MarketplaceAddPrompt.js +81 -0
- package/dist/cli/ink-cli/components/overlays/MarketplaceBrowser.d.ts +31 -0
- package/dist/cli/ink-cli/components/overlays/MarketplaceBrowser.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/MarketplaceBrowser.js +297 -0
- package/dist/cli/ink-cli/components/overlays/McpRemoveSelector.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/overlays/McpRemoveSelector.js +7 -1
- package/dist/cli/ink-cli/components/overlays/McpServerActions.d.ts +1 -1
- package/dist/cli/ink-cli/components/overlays/McpServerActions.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/overlays/McpServerActions.js +9 -0
- package/dist/cli/ink-cli/components/overlays/McpServerList.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/overlays/McpServerList.js +9 -2
- package/dist/cli/ink-cli/components/overlays/ModelSelectorRefactored.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/overlays/ModelSelectorRefactored.js +15 -2
- package/dist/cli/ink-cli/components/overlays/PluginActions.d.ts +27 -0
- package/dist/cli/ink-cli/components/overlays/PluginActions.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/PluginActions.js +66 -0
- package/dist/cli/ink-cli/components/overlays/PluginList.d.ts +21 -0
- package/dist/cli/ink-cli/components/overlays/PluginList.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/PluginList.js +70 -0
- package/dist/cli/ink-cli/components/overlays/PluginManager.d.ts +21 -0
- package/dist/cli/ink-cli/components/overlays/PluginManager.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/PluginManager.js +63 -0
- package/dist/cli/ink-cli/components/overlays/PromptList.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/overlays/PromptList.js +4 -1
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/provider-config.d.ts +2 -1
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/provider-config.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/provider-config.js +61 -2
- package/dist/cli/ink-cli/components/renderers/FilePreviewRenderer.d.ts +4 -2
- package/dist/cli/ink-cli/components/renderers/FilePreviewRenderer.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/renderers/FilePreviewRenderer.js +4 -4
- package/dist/cli/ink-cli/constants/tips.js +2 -2
- package/dist/cli/ink-cli/containers/InputContainer.d.ts.map +1 -1
- package/dist/cli/ink-cli/containers/InputContainer.js +31 -3
- package/dist/cli/ink-cli/containers/OverlayContainer.d.ts.map +1 -1
- package/dist/cli/ink-cli/containers/OverlayContainer.js +260 -11
- package/dist/cli/ink-cli/hooks/index.d.ts +1 -0
- package/dist/cli/ink-cli/hooks/index.d.ts.map +1 -1
- package/dist/cli/ink-cli/hooks/index.js +1 -0
- package/dist/cli/ink-cli/hooks/useCLIState.d.ts.map +1 -1
- package/dist/cli/ink-cli/hooks/useCLIState.js +3 -0
- package/dist/cli/ink-cli/hooks/useGitBranch.d.ts +13 -0
- package/dist/cli/ink-cli/hooks/useGitBranch.d.ts.map +1 -0
- package/dist/cli/ink-cli/hooks/useGitBranch.js +35 -0
- package/dist/cli/ink-cli/hooks/useInputOrchestrator.d.ts.map +1 -1
- package/dist/cli/ink-cli/hooks/useInputOrchestrator.js +50 -6
- package/dist/cli/ink-cli/services/processStream.d.ts.map +1 -1
- package/dist/cli/ink-cli/services/processStream.js +42 -10
- package/dist/cli/ink-cli/state/initialState.d.ts.map +1 -1
- package/dist/cli/ink-cli/state/initialState.js +3 -0
- package/dist/cli/ink-cli/state/types.d.ts +16 -1
- package/dist/cli/ink-cli/state/types.d.ts.map +1 -1
- package/dist/cli/ink-cli/utils/commandOverlays.d.ts.map +1 -1
- package/dist/cli/ink-cli/utils/commandOverlays.js +2 -0
- package/dist/cli/ink-cli/utils/messageFormatting.d.ts +14 -1
- package/dist/cli/ink-cli/utils/messageFormatting.d.ts.map +1 -1
- package/dist/cli/ink-cli/utils/messageFormatting.js +68 -8
- package/dist/cli/ink-cli/utils/toolUtils.d.ts +11 -0
- package/dist/cli/ink-cli/utils/toolUtils.d.ts.map +1 -1
- package/dist/cli/ink-cli/utils/toolUtils.js +17 -0
- package/dist/cli/mcp/index.d.ts +8 -0
- package/dist/cli/mcp/index.d.ts.map +1 -0
- package/dist/cli/mcp/index.js +7 -0
- package/dist/cli/mcp/oauth-factory.d.ts +6 -0
- package/dist/cli/mcp/oauth-factory.d.ts.map +1 -0
- package/dist/cli/mcp/oauth-factory.js +25 -0
- package/dist/cli/mcp/oauth-provider.d.ts +10 -0
- package/dist/cli/mcp/oauth-provider.d.ts.map +1 -0
- package/dist/cli/mcp/oauth-provider.js +77 -0
- package/dist/cli/mcp/oauth-redirect.d.ts +3 -0
- package/dist/cli/mcp/oauth-redirect.d.ts.map +1 -0
- package/dist/cli/mcp/oauth-redirect.js +4 -0
- package/dist/cli/mcp/oauth-server.d.ts +2 -0
- package/dist/cli/mcp/oauth-server.d.ts.map +1 -0
- package/dist/cli/mcp/oauth-server.js +70 -0
- package/dist/cli/mcp/oauth-store.d.ts +10 -0
- package/dist/cli/mcp/oauth-store.d.ts.map +1 -0
- package/dist/cli/mcp/oauth-store.js +27 -0
- package/dist/cli/mcp/oauth-ui.d.ts +2 -0
- package/dist/cli/mcp/oauth-ui.d.ts.map +1 -0
- package/dist/cli/mcp/oauth-ui.js +12 -0
- package/dist/cli/mcp/oauth-utils.d.ts +2 -0
- package/dist/cli/mcp/oauth-utils.d.ts.map +1 -0
- package/dist/cli/mcp/oauth-utils.js +17 -0
- package/dist/cli/utils/api-key-setup.d.ts.map +1 -1
- package/dist/cli/utils/api-key-setup.js +13 -90
- package/dist/cli/utils/api-key-verification.d.ts.map +1 -1
- package/dist/cli/utils/api-key-verification.js +36 -0
- package/dist/cli/utils/config-validation.d.ts +3 -1
- package/dist/cli/utils/config-validation.d.ts.map +1 -1
- package/dist/cli/utils/config-validation.js +42 -19
- package/dist/cli/utils/dexto-auth-check.d.ts +53 -0
- package/dist/cli/utils/dexto-auth-check.d.ts.map +1 -0
- package/dist/cli/utils/dexto-auth-check.js +104 -0
- package/dist/cli/utils/dexto-setup.d.ts +8 -0
- package/dist/cli/utils/dexto-setup.d.ts.map +1 -0
- package/dist/cli/utils/dexto-setup.js +17 -0
- package/dist/cli/utils/options.d.ts.map +1 -1
- package/dist/cli/utils/options.js +5 -1
- package/dist/cli/utils/provider-setup.d.ts +4 -0
- package/dist/cli/utils/provider-setup.d.ts.map +1 -1
- package/dist/cli/utils/provider-setup.js +20 -0
- package/dist/cli/utils/version-check.d.ts +45 -0
- package/dist/cli/utils/version-check.d.ts.map +1 -0
- package/dist/cli/utils/version-check.js +195 -0
- package/dist/config/cli-overrides.d.ts +17 -8
- package/dist/config/cli-overrides.d.ts.map +1 -1
- package/dist/config/cli-overrides.js +36 -22
- package/dist/config/effective-llm.d.ts +123 -0
- package/dist/config/effective-llm.d.ts.map +1 -0
- package/dist/config/effective-llm.js +171 -0
- package/dist/index.js +451 -126
- package/dist/webui/assets/index-C9JXwpvo.css +1 -0
- package/dist/webui/assets/{index-DVQWNLpT.js → index-Dl3mj53P.js} +217 -217
- package/dist/webui/index.html +2 -2
- package/package.json +9 -8
- package/dist/webui/assets/index-BglIVTSG.css +0 -1
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
// packages/cli/src/cli/commands/auth/login.ts
|
|
2
|
+
import chalk from 'chalk';
|
|
3
|
+
import * as p from '@clack/prompts';
|
|
4
|
+
import { isAuthenticated, loadAuth, storeAuth, getDextoApiClient, SUPABASE_URL, SUPABASE_ANON_KEY, } from '../../auth/index.js';
|
|
5
|
+
import { logger } from '@dexto/core';
|
|
6
|
+
/**
|
|
7
|
+
* Handle login command - multiple methods supported
|
|
8
|
+
*/
|
|
9
|
+
export async function handleLoginCommand(options = {}) {
|
|
10
|
+
try {
|
|
11
|
+
if (await isAuthenticated()) {
|
|
12
|
+
const auth = await loadAuth();
|
|
13
|
+
const userInfo = auth?.email || auth?.userId || 'user';
|
|
14
|
+
console.log(chalk.green(`✅ Already logged in as: ${userInfo}`));
|
|
15
|
+
// In non-interactive mode, already authenticated = success (idempotent)
|
|
16
|
+
if (options.interactive === false) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
const shouldContinue = await p.confirm({
|
|
20
|
+
message: 'Do you want to login with a different account?',
|
|
21
|
+
initialValue: false,
|
|
22
|
+
});
|
|
23
|
+
if (p.isCancel(shouldContinue) || !shouldContinue) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
if (options.apiKey) {
|
|
28
|
+
// Validate the Dexto API key before storing
|
|
29
|
+
const client = getDextoApiClient();
|
|
30
|
+
const isValid = await client.validateDextoApiKey(options.apiKey);
|
|
31
|
+
if (!isValid) {
|
|
32
|
+
throw new Error('Invalid API key provided - validation failed');
|
|
33
|
+
}
|
|
34
|
+
await storeAuth({ dextoApiKey: options.apiKey, createdAt: Date.now() });
|
|
35
|
+
console.log(chalk.green('✅ Dexto API key saved'));
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
if (options.interactive === false) {
|
|
39
|
+
throw new Error('--api-key is required when --no-interactive is used');
|
|
40
|
+
}
|
|
41
|
+
p.intro(chalk.inverse(' Login to Dexto '));
|
|
42
|
+
console.log(chalk.dim('This will open your browser for authentication.'));
|
|
43
|
+
const shouldUseOAuth = await p.confirm({
|
|
44
|
+
message: 'Continue with browser authentication?',
|
|
45
|
+
initialValue: true,
|
|
46
|
+
});
|
|
47
|
+
if (p.isCancel(shouldUseOAuth)) {
|
|
48
|
+
p.cancel('Login cancelled');
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
if (shouldUseOAuth) {
|
|
52
|
+
await handleBrowserLogin();
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
console.log(chalk.dim('\nAlternatively, you can enter a token manually:'));
|
|
56
|
+
await handleTokenLogin();
|
|
57
|
+
}
|
|
58
|
+
p.outro(chalk.green('🎉 Login successful!'));
|
|
59
|
+
}
|
|
60
|
+
catch (error) {
|
|
61
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
62
|
+
p.outro(chalk.red(`❌ Login failed: ${errorMessage}`));
|
|
63
|
+
// Re-throw to let CLI wrapper handle exit and analytics tracking
|
|
64
|
+
throw error;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
export async function handleBrowserLogin() {
|
|
68
|
+
const { performOAuthLogin, DEFAULT_OAUTH_CONFIG } = await import('../../auth/oauth.js');
|
|
69
|
+
try {
|
|
70
|
+
const result = await performOAuthLogin(DEFAULT_OAUTH_CONFIG);
|
|
71
|
+
const expiresAt = result.expiresIn ? Date.now() + result.expiresIn * 1000 : undefined;
|
|
72
|
+
await storeAuth({
|
|
73
|
+
token: result.accessToken,
|
|
74
|
+
refreshToken: result.refreshToken,
|
|
75
|
+
userId: result.user?.id,
|
|
76
|
+
email: result.user?.email,
|
|
77
|
+
createdAt: Date.now(),
|
|
78
|
+
expiresAt,
|
|
79
|
+
});
|
|
80
|
+
if (result.user?.email) {
|
|
81
|
+
console.log(chalk.dim(`\nWelcome back, ${result.user.email}`));
|
|
82
|
+
}
|
|
83
|
+
await provisionKeys(result.accessToken, result.user?.email);
|
|
84
|
+
}
|
|
85
|
+
catch (error) {
|
|
86
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
87
|
+
if (errorMessage.includes('timed out')) {
|
|
88
|
+
throw new Error('Login timed out. Please try again.');
|
|
89
|
+
}
|
|
90
|
+
else if (errorMessage.includes('user denied')) {
|
|
91
|
+
throw new Error('Login was cancelled.');
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
throw new Error(`Login failed: ${errorMessage}`);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
async function handleTokenLogin() {
|
|
99
|
+
const token = await p.password({
|
|
100
|
+
message: 'Enter your API token:',
|
|
101
|
+
validate: (value) => {
|
|
102
|
+
if (!value)
|
|
103
|
+
return 'Token is required';
|
|
104
|
+
if (value.length < 10)
|
|
105
|
+
return 'Token seems too short';
|
|
106
|
+
return undefined;
|
|
107
|
+
},
|
|
108
|
+
});
|
|
109
|
+
if (p.isCancel(token)) {
|
|
110
|
+
p.cancel('Token entry cancelled');
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
const spinner = p.spinner();
|
|
114
|
+
spinner.start('Verifying token...');
|
|
115
|
+
try {
|
|
116
|
+
const isValid = await verifyToken(token);
|
|
117
|
+
if (!isValid) {
|
|
118
|
+
spinner.stop('Invalid token');
|
|
119
|
+
throw new Error('Token verification failed');
|
|
120
|
+
}
|
|
121
|
+
spinner.stop('Token verified!');
|
|
122
|
+
await storeAuth({
|
|
123
|
+
token: token,
|
|
124
|
+
createdAt: Date.now(),
|
|
125
|
+
});
|
|
126
|
+
// Provision Dexto API key for gateway access
|
|
127
|
+
await provisionKeys(token);
|
|
128
|
+
}
|
|
129
|
+
catch (error) {
|
|
130
|
+
spinner.stop('Verification failed');
|
|
131
|
+
throw error;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
async function verifyToken(token) {
|
|
135
|
+
try {
|
|
136
|
+
const response = await fetch(`${SUPABASE_URL}/auth/v1/user`, {
|
|
137
|
+
headers: {
|
|
138
|
+
Authorization: `Bearer ${token}`,
|
|
139
|
+
apikey: SUPABASE_ANON_KEY,
|
|
140
|
+
'User-Agent': 'dexto-cli/1.0.0',
|
|
141
|
+
},
|
|
142
|
+
signal: AbortSignal.timeout(10_000),
|
|
143
|
+
});
|
|
144
|
+
if (response.ok) {
|
|
145
|
+
const userData = await response.json();
|
|
146
|
+
return !!userData.id;
|
|
147
|
+
}
|
|
148
|
+
return false;
|
|
149
|
+
}
|
|
150
|
+
catch (error) {
|
|
151
|
+
logger.debug(`Token verification failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
152
|
+
return false;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Helper to save Dexto API key to ~/.dexto/.env
|
|
157
|
+
* This ensures the key is available for the layered env loading at startup.
|
|
158
|
+
*/
|
|
159
|
+
async function saveDextoApiKey(apiKey) {
|
|
160
|
+
const { getDextoEnvPath, ensureDextoGlobalDirectory } = await import('@dexto/core');
|
|
161
|
+
const path = await import('path');
|
|
162
|
+
const fs = await import('fs/promises');
|
|
163
|
+
const envVar = 'DEXTO_API_KEY';
|
|
164
|
+
const targetEnvPath = getDextoEnvPath();
|
|
165
|
+
// Ensure directory exists
|
|
166
|
+
await ensureDextoGlobalDirectory();
|
|
167
|
+
await fs.mkdir(path.dirname(targetEnvPath), { recursive: true });
|
|
168
|
+
// Read existing .env or create empty
|
|
169
|
+
let envContent = '';
|
|
170
|
+
try {
|
|
171
|
+
envContent = await fs.readFile(targetEnvPath, 'utf-8');
|
|
172
|
+
}
|
|
173
|
+
catch {
|
|
174
|
+
// File doesn't exist, start fresh
|
|
175
|
+
}
|
|
176
|
+
// Update or add the key
|
|
177
|
+
const lines = envContent.split('\n');
|
|
178
|
+
const keyPattern = new RegExp(`^${envVar}=`);
|
|
179
|
+
const keyIndex = lines.findIndex((line) => keyPattern.test(line));
|
|
180
|
+
if (keyIndex >= 0) {
|
|
181
|
+
lines[keyIndex] = `${envVar}=${apiKey}`;
|
|
182
|
+
}
|
|
183
|
+
else {
|
|
184
|
+
lines.push(`${envVar}=${apiKey}`);
|
|
185
|
+
}
|
|
186
|
+
// Write back
|
|
187
|
+
await fs.writeFile(targetEnvPath, lines.filter(Boolean).join('\n') + '\n', 'utf-8');
|
|
188
|
+
// Make available in current process immediately
|
|
189
|
+
process.env[envVar] = apiKey;
|
|
190
|
+
}
|
|
191
|
+
async function provisionKeys(authToken, _userEmail) {
|
|
192
|
+
try {
|
|
193
|
+
const apiClient = await getDextoApiClient();
|
|
194
|
+
const auth = await loadAuth();
|
|
195
|
+
// 1. Check if we already have a local key
|
|
196
|
+
if (auth?.dextoApiKey) {
|
|
197
|
+
console.log(chalk.cyan('🔍 Validating existing API key...'));
|
|
198
|
+
try {
|
|
199
|
+
const isValid = await apiClient.validateDextoApiKey(auth.dextoApiKey);
|
|
200
|
+
if (isValid) {
|
|
201
|
+
console.log(chalk.green('✅ Existing key is valid'));
|
|
202
|
+
// Ensure .env is in sync
|
|
203
|
+
await saveDextoApiKey(auth.dextoApiKey);
|
|
204
|
+
return; // All good, we're done
|
|
205
|
+
}
|
|
206
|
+
// Key is invalid - need new one
|
|
207
|
+
console.log(chalk.yellow('⚠️ Existing key is invalid, provisioning new one...'));
|
|
208
|
+
const provisionResult = await apiClient.provisionDextoApiKey(authToken);
|
|
209
|
+
if (!provisionResult.dextoApiKey) {
|
|
210
|
+
throw new Error('Failed to get new API key');
|
|
211
|
+
}
|
|
212
|
+
await storeAuth({
|
|
213
|
+
...auth,
|
|
214
|
+
dextoApiKey: provisionResult.dextoApiKey,
|
|
215
|
+
dextoKeyId: provisionResult.keyId,
|
|
216
|
+
});
|
|
217
|
+
await saveDextoApiKey(provisionResult.dextoApiKey);
|
|
218
|
+
console.log(chalk.green('✅ New key provisioned'));
|
|
219
|
+
console.log(chalk.dim(` Key ID: ${provisionResult.keyId}`));
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
222
|
+
catch (error) {
|
|
223
|
+
// Validation or rotation failed - this is a critical error
|
|
224
|
+
logger.warn(`Key validation/rotation failed: ${error}`);
|
|
225
|
+
throw new Error(`Failed to validate or rotate key: ${error instanceof Error ? error.message : String(error)}`);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
// 2. No local key - provision one
|
|
229
|
+
console.log(chalk.cyan('🔑 Provisioning Dexto API key...'));
|
|
230
|
+
let provisionResult = await apiClient.provisionDextoApiKey(authToken);
|
|
231
|
+
if (!auth) {
|
|
232
|
+
throw new Error('Authentication state not found');
|
|
233
|
+
}
|
|
234
|
+
// If key already exists server-side but we don't have it locally, regenerate it
|
|
235
|
+
if (!provisionResult.isNewKey) {
|
|
236
|
+
console.log(chalk.yellow('⚠️ CLI key exists on server but not locally, regenerating...'));
|
|
237
|
+
provisionResult = await apiClient.provisionDextoApiKey(authToken, 'Dexto CLI Key', true);
|
|
238
|
+
}
|
|
239
|
+
await storeAuth({
|
|
240
|
+
...auth,
|
|
241
|
+
dextoApiKey: provisionResult.dextoApiKey,
|
|
242
|
+
dextoKeyId: provisionResult.keyId,
|
|
243
|
+
});
|
|
244
|
+
await saveDextoApiKey(provisionResult.dextoApiKey);
|
|
245
|
+
console.log(chalk.green('✅ Dexto API key provisioned!'));
|
|
246
|
+
console.log(chalk.dim(` Key ID: ${provisionResult.keyId}`));
|
|
247
|
+
}
|
|
248
|
+
catch (error) {
|
|
249
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
250
|
+
console.log(chalk.red(`❌ Failed to provision Dexto API key: ${errorMessage}`));
|
|
251
|
+
console.log(chalk.dim(' You can still use Dexto with your own API keys'));
|
|
252
|
+
logger.warn(`Provisioning failed: ${errorMessage}`);
|
|
253
|
+
// Don't throw - login should still succeed even if key provisioning fails
|
|
254
|
+
}
|
|
255
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logout.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/auth/logout.ts"],"names":[],"mappings":"AAQA,wBAAsB,mBAAmB,CACrC,OAAO,GAAE;IACL,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,WAAW,CAAC,EAAE,OAAO,CAAC;CACpB,GACP,OAAO,CAAC,IAAI,CAAC,CA2Df"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
// packages/cli/src/cli/commands/auth/logout.ts
|
|
2
|
+
import chalk from 'chalk';
|
|
3
|
+
import * as p from '@clack/prompts';
|
|
4
|
+
import { isAuthenticated, removeAuth } from '../../auth/index.js';
|
|
5
|
+
import { isUsingDextoCredits } from '../../../config/effective-llm.js';
|
|
6
|
+
import { logger } from '@dexto/core';
|
|
7
|
+
export async function handleLogoutCommand(options = {}) {
|
|
8
|
+
try {
|
|
9
|
+
if (!(await isAuthenticated())) {
|
|
10
|
+
console.log(chalk.yellow('ℹ️ Not currently logged in'));
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
// Check if user is configured to use Dexto credits
|
|
14
|
+
// Uses getEffectiveLLMConfig() to check all config layers
|
|
15
|
+
const usingDextoCredits = await isUsingDextoCredits();
|
|
16
|
+
if (options.interactive !== false && !options.force) {
|
|
17
|
+
p.intro(chalk.inverse(' Logout '));
|
|
18
|
+
// Warn if using Dexto credits
|
|
19
|
+
if (usingDextoCredits) {
|
|
20
|
+
console.log(chalk.yellow('\n⚠️ You are currently configured to use Dexto credits (provider: dexto)'));
|
|
21
|
+
console.log(chalk.dim(' After logout, you will need to run `dexto setup` to configure'));
|
|
22
|
+
console.log(chalk.dim(' a different provider, or `dexto login` to log back in.\n'));
|
|
23
|
+
}
|
|
24
|
+
const shouldLogout = await p.confirm({
|
|
25
|
+
message: usingDextoCredits
|
|
26
|
+
? 'Logout will disable Dexto credits. Continue?'
|
|
27
|
+
: 'Are you sure you want to logout?',
|
|
28
|
+
initialValue: false,
|
|
29
|
+
});
|
|
30
|
+
if (p.isCancel(shouldLogout) || !shouldLogout) {
|
|
31
|
+
p.cancel('Logout cancelled');
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
await removeAuth();
|
|
36
|
+
console.log(chalk.green('✅ Successfully logged out'));
|
|
37
|
+
if (usingDextoCredits) {
|
|
38
|
+
console.log();
|
|
39
|
+
console.log(chalk.cyan('Next steps:'));
|
|
40
|
+
console.log(chalk.dim(' • Run `dexto login` to log back in'));
|
|
41
|
+
console.log(chalk.dim(' • Or run `dexto setup` to configure a different provider'));
|
|
42
|
+
}
|
|
43
|
+
logger.info('User logged out');
|
|
44
|
+
}
|
|
45
|
+
catch (error) {
|
|
46
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
47
|
+
console.error(chalk.red(`❌ Logout failed: ${errorMessage}`));
|
|
48
|
+
// Re-throw to let CLI wrapper handle exit and analytics tracking
|
|
49
|
+
throw error;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/auth/status.ts"],"names":[],"mappings":"AAKA,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC,CAuBzD"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// packages/cli/src/cli/commands/auth/status.ts
|
|
2
|
+
import chalk from 'chalk';
|
|
3
|
+
import { loadAuth } from '../../auth/index.js';
|
|
4
|
+
export async function handleStatusCommand() {
|
|
5
|
+
const auth = await loadAuth();
|
|
6
|
+
if (!auth) {
|
|
7
|
+
console.log(chalk.yellow('❌ Not logged in'));
|
|
8
|
+
console.log(chalk.dim('Run `dexto login` to authenticate'));
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
console.log(chalk.green('✅ Logged in'));
|
|
12
|
+
if (auth.email) {
|
|
13
|
+
console.log(chalk.dim(`Email: ${auth.email}`));
|
|
14
|
+
}
|
|
15
|
+
if (auth.userId) {
|
|
16
|
+
console.log(chalk.dim(`User ID: ${auth.userId}`));
|
|
17
|
+
}
|
|
18
|
+
if (auth.expiresAt) {
|
|
19
|
+
const expiresDate = new Date(auth.expiresAt);
|
|
20
|
+
console.log(chalk.dim(`Expires: ${expiresDate.toLocaleDateString()}`));
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/billing/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,0BAA0B,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/billing/status.ts"],"names":[],"mappings":"AAKA;;;GAGG;AACH,wBAAsB,0BAA0B,IAAI,OAAO,CAAC,IAAI,CAAC,CAiEhE"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// packages/cli/src/cli/commands/billing/status.ts
|
|
2
|
+
import chalk from 'chalk';
|
|
3
|
+
import { loadAuth, getDextoApiClient } from '../../auth/index.js';
|
|
4
|
+
/**
|
|
5
|
+
* Handle the `dexto billing` command.
|
|
6
|
+
* Shows Dexto account billing information including balance and usage.
|
|
7
|
+
*/
|
|
8
|
+
export async function handleBillingStatusCommand() {
|
|
9
|
+
const auth = await loadAuth();
|
|
10
|
+
if (!auth) {
|
|
11
|
+
console.log(chalk.yellow('❌ Not logged in to Dexto'));
|
|
12
|
+
console.log(chalk.dim('Run `dexto login` to authenticate'));
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
if (!auth.dextoApiKey) {
|
|
16
|
+
console.log(chalk.yellow('❌ No Dexto API key found'));
|
|
17
|
+
console.log(chalk.dim('Run `dexto login` to provision an API key'));
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
console.log(chalk.green('✅ Logged in to Dexto'));
|
|
21
|
+
if (auth.email) {
|
|
22
|
+
console.log(chalk.dim(`Account: ${auth.email}`));
|
|
23
|
+
}
|
|
24
|
+
console.log();
|
|
25
|
+
try {
|
|
26
|
+
const apiClient = getDextoApiClient();
|
|
27
|
+
const usage = await apiClient.getUsageSummary(auth.dextoApiKey);
|
|
28
|
+
// Display balance
|
|
29
|
+
console.log(chalk.cyan('💰 Balance'));
|
|
30
|
+
console.log(` ${chalk.bold('$' + usage.credits_usd.toFixed(2))} remaining`);
|
|
31
|
+
console.log();
|
|
32
|
+
// Display month-to-date usage
|
|
33
|
+
console.log(chalk.cyan('📊 This Month'));
|
|
34
|
+
console.log(` Spent: ${chalk.yellow('$' + usage.mtd_usage.total_cost_usd.toFixed(4))}`);
|
|
35
|
+
console.log(` Requests: ${chalk.yellow(usage.mtd_usage.total_requests.toString())}`);
|
|
36
|
+
// Show usage by model if there's any
|
|
37
|
+
const modelEntries = Object.entries(usage.mtd_usage.by_model);
|
|
38
|
+
if (modelEntries.length > 0) {
|
|
39
|
+
console.log();
|
|
40
|
+
console.log(chalk.cyan('📈 Usage by Model'));
|
|
41
|
+
for (const [model, stats] of modelEntries) {
|
|
42
|
+
console.log(` ${chalk.dim(model)}: $${stats.cost_usd.toFixed(4)} (${stats.requests} requests)`);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
// Show recent usage if any
|
|
46
|
+
if (usage.recent.length > 0) {
|
|
47
|
+
console.log();
|
|
48
|
+
console.log(chalk.cyan('🕐 Recent Activity'));
|
|
49
|
+
for (const entry of usage.recent.slice(0, 5)) {
|
|
50
|
+
const date = new Date(entry.timestamp).toLocaleString();
|
|
51
|
+
console.log(` ${chalk.dim(date)} - ${entry.model}: $${entry.cost_usd.toFixed(4)}`);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
catch (error) {
|
|
56
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
57
|
+
console.log(chalk.red(`❌ Failed to fetch billing info: ${errorMessage}`));
|
|
58
|
+
console.log(chalk.dim('Your API key may be invalid. Try `dexto login` to refresh.'));
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -6,4 +6,8 @@ export { handleInstallCommand, type InstallCommandOptions } from './install.js';
|
|
|
6
6
|
export { handleUninstallCommand, type UninstallCommandOptions } from './uninstall.js';
|
|
7
7
|
export { handleListAgentsCommand, type ListAgentsCommandOptions, type ListAgentsCommandOptionsInput, } from './list-agents.js';
|
|
8
8
|
export { handleWhichCommand, type WhichCommandOptions } from './which.js';
|
|
9
|
+
export { handleSyncAgentsCommand, shouldPromptForSync, markSyncDismissed, clearSyncDismissed, type SyncAgentsCommandOptions, } from './sync-agents.js';
|
|
10
|
+
export { handleLoginCommand, handleLogoutCommand, handleStatusCommand } from './auth/index.js';
|
|
11
|
+
export { handleBillingStatusCommand } from './billing/index.js';
|
|
12
|
+
export { handlePluginListCommand, handlePluginInstallCommand, handlePluginUninstallCommand, handlePluginValidateCommand, handleMarketplaceAddCommand, handleMarketplaceRemoveCommand, handleMarketplaceUpdateCommand, handleMarketplaceListCommand, handleMarketplacePluginsCommand, handleMarketplaceInstallCommand, type PluginListCommandOptions, type PluginListCommandOptionsInput, type PluginInstallCommandOptions, type PluginInstallCommandOptionsInput, type PluginUninstallCommandOptions, type PluginUninstallCommandOptionsInput, type PluginValidateCommandOptions, type PluginValidateCommandOptionsInput, type MarketplaceAddCommandOptionsInput, type MarketplaceRemoveCommandOptionsInput, type MarketplaceUpdateCommandOptionsInput, type MarketplaceListCommandOptionsInput, type MarketplaceInstallCommandOptionsInput, } from './plugin.js';
|
|
9
13
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,kBAAkB,EAAE,KAAK,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAE5E,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,0BAA0B,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAErF,OAAO,EAAE,kBAAkB,EAAE,KAAK,eAAe,EAAE,KAAK,oBAAoB,EAAE,MAAM,YAAY,CAAC;AACjG,OAAO,EAAE,oBAAoB,EAAE,KAAK,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAChF,OAAO,EAAE,sBAAsB,EAAE,KAAK,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AACtF,OAAO,EACH,uBAAuB,EACvB,KAAK,wBAAwB,EAC7B,KAAK,6BAA6B,GACrC,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,kBAAkB,EAAE,KAAK,mBAAmB,EAAE,MAAM,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,kBAAkB,EAAE,KAAK,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAE5E,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,0BAA0B,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAErF,OAAO,EAAE,kBAAkB,EAAE,KAAK,eAAe,EAAE,KAAK,oBAAoB,EAAE,MAAM,YAAY,CAAC;AACjG,OAAO,EAAE,oBAAoB,EAAE,KAAK,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAChF,OAAO,EAAE,sBAAsB,EAAE,KAAK,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AACtF,OAAO,EACH,uBAAuB,EACvB,KAAK,wBAAwB,EAC7B,KAAK,6BAA6B,GACrC,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,kBAAkB,EAAE,KAAK,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAC1E,OAAO,EACH,uBAAuB,EACvB,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,EAClB,KAAK,wBAAwB,GAChC,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAG/F,OAAO,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AAGhE,OAAO,EACH,uBAAuB,EACvB,0BAA0B,EAC1B,4BAA4B,EAC5B,2BAA2B,EAE3B,2BAA2B,EAC3B,8BAA8B,EAC9B,8BAA8B,EAC9B,4BAA4B,EAC5B,+BAA+B,EAC/B,+BAA+B,EAC/B,KAAK,wBAAwB,EAC7B,KAAK,6BAA6B,EAClC,KAAK,2BAA2B,EAChC,KAAK,gCAAgC,EACrC,KAAK,6BAA6B,EAClC,KAAK,kCAAkC,EACvC,KAAK,4BAA4B,EACjC,KAAK,iCAAiC,EAEtC,KAAK,iCAAiC,EACtC,KAAK,oCAAoC,EACzC,KAAK,oCAAoC,EACzC,KAAK,kCAAkC,EACvC,KAAK,qCAAqC,GAC7C,MAAM,aAAa,CAAC"}
|
|
@@ -8,3 +8,12 @@ export { handleInstallCommand } from './install.js';
|
|
|
8
8
|
export { handleUninstallCommand } from './uninstall.js';
|
|
9
9
|
export { handleListAgentsCommand, } from './list-agents.js';
|
|
10
10
|
export { handleWhichCommand } from './which.js';
|
|
11
|
+
export { handleSyncAgentsCommand, shouldPromptForSync, markSyncDismissed, clearSyncDismissed, } from './sync-agents.js';
|
|
12
|
+
// Auth commands
|
|
13
|
+
export { handleLoginCommand, handleLogoutCommand, handleStatusCommand } from './auth/index.js';
|
|
14
|
+
// Billing commands
|
|
15
|
+
export { handleBillingStatusCommand } from './billing/index.js';
|
|
16
|
+
// Plugin commands
|
|
17
|
+
export { handlePluginListCommand, handlePluginInstallCommand, handlePluginUninstallCommand, handlePluginValidateCommand,
|
|
18
|
+
// Marketplace handlers
|
|
19
|
+
handleMarketplaceAddCommand, handleMarketplaceRemoveCommand, handleMarketplaceUpdateCommand, handleMarketplaceListCommand, handleMarketplacePluginsCommand, handleMarketplaceInstallCommand, } from './plugin.js';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Auth Commands Module
|
|
3
|
+
*
|
|
4
|
+
* Authentication commands for interactive CLI.
|
|
5
|
+
*/
|
|
6
|
+
import type { CommandDefinition } from '../command-parser.js';
|
|
7
|
+
/**
|
|
8
|
+
* Login command - triggers OAuth flow for Dexto authentication
|
|
9
|
+
* Only available when DEXTO_FEATURE_AUTH=true
|
|
10
|
+
*/
|
|
11
|
+
export declare const loginCommand: CommandDefinition;
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/cli/commands/interactive-commands/auth/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAG9D;;;GAGG;AACH,eAAO,MAAM,YAAY,EAAE,iBAS1B,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Auth Commands Module
|
|
3
|
+
*
|
|
4
|
+
* Authentication commands for interactive CLI.
|
|
5
|
+
*/
|
|
6
|
+
import { handleLoginCommand } from '../../auth/login.js';
|
|
7
|
+
/**
|
|
8
|
+
* Login command - triggers OAuth flow for Dexto authentication
|
|
9
|
+
* Only available when DEXTO_FEATURE_AUTH=true
|
|
10
|
+
*/
|
|
11
|
+
export const loginCommand = {
|
|
12
|
+
name: 'login',
|
|
13
|
+
description: 'Login to Dexto',
|
|
14
|
+
usage: '/login',
|
|
15
|
+
category: 'General',
|
|
16
|
+
handler: async () => {
|
|
17
|
+
await handleLoginCommand({ interactive: true });
|
|
18
|
+
return true;
|
|
19
|
+
},
|
|
20
|
+
};
|
|
@@ -30,6 +30,11 @@ export interface CommandDefinition {
|
|
|
30
30
|
subcommands?: CommandDefinition[];
|
|
31
31
|
handler: (args: string[], agent: DextoAgent, ctx: CommandContext) => Promise<CommandHandlerResult>;
|
|
32
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* No-op handler for overlay-only commands.
|
|
35
|
+
* Used by commands in ALWAYS_OVERLAY that are handled entirely by the overlay system.
|
|
36
|
+
*/
|
|
37
|
+
export declare const overlayOnlyHandler: () => Promise<CommandHandlerResult>;
|
|
33
38
|
/**
|
|
34
39
|
* Parses user input to determine if it's a slash command, shell command, or regular prompt
|
|
35
40
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-parser.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/interactive-commands/command-parser.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,0CAA0C,CAAC;AAEhG,MAAM,WAAW,aAAa;IAC1B,IAAI,EAAE,SAAS,GAAG,QAAQ,CAAC;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;GAMG;AACH,MAAM,MAAM,oBAAoB,GAAG,OAAO,GAAG,MAAM,GAAG,YAAY,GAAG,iBAAiB,CAAC;AAEvF;;GAEG;AACH,MAAM,WAAW,cAAc;IAC3B,uDAAuD;IACvD,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B;AAED,MAAM,WAAW,iBAAiB;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,WAAW,CAAC,EAAE,iBAAiB,EAAE,CAAC;IAClC,OAAO,EAAE,CACL,IAAI,EAAE,MAAM,EAAE,EACd,KAAK,EAAE,UAAU,EACjB,GAAG,EAAE,cAAc,KAClB,OAAO,CAAC,oBAAoB,CAAC,CAAC;CACtC;
|
|
1
|
+
{"version":3,"file":"command-parser.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/interactive-commands/command-parser.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,0CAA0C,CAAC;AAEhG,MAAM,WAAW,aAAa;IAC1B,IAAI,EAAE,SAAS,GAAG,QAAQ,CAAC;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;GAMG;AACH,MAAM,MAAM,oBAAoB,GAAG,OAAO,GAAG,MAAM,GAAG,YAAY,GAAG,iBAAiB,CAAC;AAEvF;;GAEG;AACH,MAAM,WAAW,cAAc;IAC3B,uDAAuD;IACvD,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B;AAED,MAAM,WAAW,iBAAiB;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,WAAW,CAAC,EAAE,iBAAiB,EAAE,CAAC;IAClC,OAAO,EAAE,CACL,IAAI,EAAE,MAAM,EAAE,EACd,KAAK,EAAE,UAAU,EACjB,GAAG,EAAE,cAAc,KAClB,OAAO,CAAC,oBAAoB,CAAC,CAAC;CACtC;AAED;;;GAGG;AACH,eAAO,MAAM,kBAAkB,QAAa,OAAO,CAAC,oBAAoB,CAAS,CAAC;AA4ClF;;GAEG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,aAAa,CAiCvD;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,iBAAiB,EAAE,GAAG,MAAM,EAAE,CAoB9F;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,iBAAiB,EAAE,QAAQ,GAAE,OAAe,GAAG,MAAM,CAmB3F;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,iBAAiB,EAAE,GAAG,IAAI,CAwDtE"}
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import chalk from 'chalk';
|
|
2
|
+
/**
|
|
3
|
+
* No-op handler for overlay-only commands.
|
|
4
|
+
* Used by commands in ALWAYS_OVERLAY that are handled entirely by the overlay system.
|
|
5
|
+
*/
|
|
6
|
+
export const overlayOnlyHandler = async () => true;
|
|
2
7
|
/**
|
|
3
8
|
* Parse arguments respecting quotes and escape sequences
|
|
4
9
|
*/
|
|
@@ -124,6 +129,7 @@ export function displayAllCommands(commands) {
|
|
|
124
129
|
'Session Management',
|
|
125
130
|
'Model Management',
|
|
126
131
|
'MCP Management',
|
|
132
|
+
'Plugin Management',
|
|
127
133
|
'Tool Management',
|
|
128
134
|
'Prompt Management',
|
|
129
135
|
'System',
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
* - Conversation Commands: Session management, history, and search
|
|
11
11
|
* - Model Commands: Model switching and configuration
|
|
12
12
|
* - MCP Commands: MCP server management
|
|
13
|
+
* - Plugin Commands: Claude Code plugin management
|
|
13
14
|
* - System Commands: Configuration, logging, and statistics
|
|
14
15
|
* - Tool Commands: Tool listing and management
|
|
15
16
|
* - Prompt Commands: System prompt management
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/interactive-commands/commands.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/interactive-commands/commands.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,KAAK,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAgBnF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,YAAY,EAAE,iBAAiB,EAAO,CAAC;AA6CpD;;;;;GAKG;AACH,wBAAsB,cAAc,CAChC,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EAAE,EACd,KAAK,EAAE,UAAU,EACjB,SAAS,CAAC,EAAE,MAAM,GACnB,OAAO,CAAC,oBAAoB,CAAC,CAyD/B;AAED;;;GAGG;AACH,wBAAgB,cAAc,IAAI,iBAAiB,EAAE,CAEpD"}
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
* - Conversation Commands: Session management, history, and search
|
|
11
11
|
* - Model Commands: Model switching and configuration
|
|
12
12
|
* - MCP Commands: MCP server management
|
|
13
|
+
* - Plugin Commands: Claude Code plugin management
|
|
13
14
|
* - System Commands: Configuration, logging, and statistics
|
|
14
15
|
* - Tool Commands: Tool listing and management
|
|
15
16
|
* - Prompt Commands: System prompt management
|
|
@@ -18,15 +19,19 @@
|
|
|
18
19
|
* This file serves as the integration layer that combines all modular commands
|
|
19
20
|
* into a single CLI_COMMANDS array for the command execution system.
|
|
20
21
|
*/
|
|
22
|
+
import { isDextoAuthEnabled } from '@dexto/agent-management';
|
|
21
23
|
// Import modular command definitions
|
|
22
24
|
import { generalCommands, createHelpCommand } from './general-commands.js';
|
|
23
25
|
import { searchCommand, resumeCommand, renameCommand } from './session/index.js';
|
|
26
|
+
import { exportCommand } from './export/index.js';
|
|
24
27
|
import { modelCommands } from './model/index.js';
|
|
25
28
|
import { mcpCommands } from './mcp/index.js';
|
|
29
|
+
import { pluginCommands } from './plugin/index.js';
|
|
26
30
|
import { systemCommands } from './system/index.js';
|
|
27
31
|
import { toolCommands } from './tool-commands.js';
|
|
28
32
|
import { promptCommands } from './prompt-commands.js';
|
|
29
33
|
import { documentationCommands } from './documentation-commands.js';
|
|
34
|
+
import { loginCommand } from './auth/index.js';
|
|
30
35
|
/**
|
|
31
36
|
* Complete list of all available CLI commands.
|
|
32
37
|
* This array combines commands from all extracted modules to maintain
|
|
@@ -52,10 +57,13 @@ const baseCommands = [
|
|
|
52
57
|
searchCommand, // /search - opens search overlay
|
|
53
58
|
resumeCommand, // /resume - opens session selector overlay
|
|
54
59
|
renameCommand, // /rename <title> - rename current session
|
|
60
|
+
exportCommand, // /export - opens export wizard overlay
|
|
55
61
|
// Model management
|
|
56
62
|
modelCommands, // /model - opens model selector overlay
|
|
57
63
|
// MCP server management
|
|
58
64
|
mcpCommands, // /mcp - opens MCP server list overlay
|
|
65
|
+
// Plugin management
|
|
66
|
+
pluginCommands, // /plugin - manage Claude Code compatible plugins
|
|
59
67
|
// Tool management commands
|
|
60
68
|
...toolCommands,
|
|
61
69
|
// Prompt management commands
|
|
@@ -64,6 +72,8 @@ const baseCommands = [
|
|
|
64
72
|
...systemCommands,
|
|
65
73
|
// Documentation commands
|
|
66
74
|
...documentationCommands,
|
|
75
|
+
// Auth commands (feature-flagged)
|
|
76
|
+
...(isDextoAuthEnabled() ? [loginCommand] : []),
|
|
67
77
|
];
|
|
68
78
|
// Add help command that can see all commands
|
|
69
79
|
CLI_COMMANDS.push(createHelpCommand(() => CLI_COMMANDS));
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Export Command Module
|
|
3
|
+
*
|
|
4
|
+
* Provides the /export command for exporting conversation history.
|
|
5
|
+
* Always shows the interactive export wizard overlay.
|
|
6
|
+
*/
|
|
7
|
+
import type { CommandDefinition } from '../command-parser.js';
|
|
8
|
+
/**
|
|
9
|
+
* Export command definition
|
|
10
|
+
* Always shows the interactive export wizard overlay (handled by ALWAYS_OVERLAY)
|
|
11
|
+
*/
|
|
12
|
+
export declare const exportCommand: CommandDefinition;
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/cli/commands/interactive-commands/export/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAwC,MAAM,sBAAsB,CAAC;AAGpG;;;GAGG;AACH,eAAO,MAAM,aAAa,EAAE,iBAc3B,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Export Command Module
|
|
3
|
+
*
|
|
4
|
+
* Provides the /export command for exporting conversation history.
|
|
5
|
+
* Always shows the interactive export wizard overlay.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Export command definition
|
|
9
|
+
* Always shows the interactive export wizard overlay (handled by ALWAYS_OVERLAY)
|
|
10
|
+
*/
|
|
11
|
+
export const exportCommand = {
|
|
12
|
+
name: 'export',
|
|
13
|
+
description: 'Export conversation to markdown or JSON',
|
|
14
|
+
usage: '/export',
|
|
15
|
+
category: 'Session',
|
|
16
|
+
handler: async (_args, _agent, _ctx) => {
|
|
17
|
+
// This handler is never called - export is in ALWAYS_OVERLAY
|
|
18
|
+
// which intercepts and shows the export wizard overlay instead
|
|
19
|
+
return true;
|
|
20
|
+
},
|
|
21
|
+
};
|