@vybestack/llxprt-code 0.1.15 → 0.1.16-nightly.250805.82080ee4
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 +37 -2
- package/dist/package.json +3 -3
- package/dist/src/config/config.d.ts +4 -1
- package/dist/src/config/config.js +151 -54
- package/dist/src/config/config.js.map +1 -1
- package/dist/src/config/settings.d.ts +11 -2
- package/dist/src/config/settings.js +84 -23
- package/dist/src/config/settings.js.map +1 -1
- package/dist/src/gemini.d.ts +2 -0
- package/dist/src/gemini.js +177 -21
- package/dist/src/gemini.js.map +1 -1
- package/dist/src/generated/git-commit.d.ts +1 -1
- package/dist/src/generated/git-commit.js +1 -1
- package/dist/src/generated/git-commit.js.map +1 -1
- package/dist/src/integration-tests/GITHUB_ACTIONS_README.md +41 -0
- package/dist/src/integration-tests/test-utils.d.ts +68 -0
- package/dist/src/integration-tests/test-utils.js +167 -0
- package/dist/src/integration-tests/test-utils.js.map +1 -0
- package/dist/src/nonInteractiveCli.js +24 -66
- package/dist/src/nonInteractiveCli.js.map +1 -1
- package/dist/src/providers/IFileSystem.d.ts +42 -0
- package/dist/src/providers/IFileSystem.js +46 -0
- package/dist/src/providers/IFileSystem.js.map +1 -0
- package/dist/src/providers/providerConfigUtils.d.ts +0 -4
- package/dist/src/providers/providerConfigUtils.js +21 -52
- package/dist/src/providers/providerConfigUtils.js.map +1 -1
- package/dist/src/providers/providerManagerInstance.d.ts +6 -1
- package/dist/src/providers/providerManagerInstance.js +117 -82
- package/dist/src/providers/providerManagerInstance.js.map +1 -1
- package/dist/src/services/BuiltinCommandLoader.js +11 -0
- package/dist/src/services/BuiltinCommandLoader.js.map +1 -1
- package/dist/src/ui/App.js +61 -48
- package/dist/src/ui/App.js.map +1 -1
- package/dist/src/ui/commands/aboutCommand.js +2 -5
- package/dist/src/ui/commands/aboutCommand.js.map +1 -1
- package/dist/src/ui/commands/baseurlCommand.js +54 -9
- package/dist/src/ui/commands/baseurlCommand.js.map +1 -1
- package/dist/src/ui/commands/diagnosticsCommand.d.ts +10 -0
- package/dist/src/ui/commands/diagnosticsCommand.js +122 -0
- package/dist/src/ui/commands/diagnosticsCommand.js.map +1 -0
- package/dist/src/ui/commands/directoryCommand.d.ts +8 -0
- package/dist/src/ui/commands/directoryCommand.js +116 -0
- package/dist/src/ui/commands/directoryCommand.js.map +1 -0
- package/dist/src/ui/commands/ideCommand.js +101 -105
- package/dist/src/ui/commands/ideCommand.js.map +1 -1
- package/dist/src/ui/commands/initCommand.js +63 -31
- package/dist/src/ui/commands/initCommand.js.map +1 -1
- package/dist/src/ui/commands/keyCommand.js +75 -11
- package/dist/src/ui/commands/keyCommand.js.map +1 -1
- package/dist/src/ui/commands/keyfileCommand.js +54 -13
- package/dist/src/ui/commands/keyfileCommand.js.map +1 -1
- package/dist/src/ui/commands/memoryCommand.js +2 -1
- package/dist/src/ui/commands/memoryCommand.js.map +1 -1
- package/dist/src/ui/commands/modelCommand.js +2 -5
- package/dist/src/ui/commands/modelCommand.js.map +1 -1
- package/dist/src/ui/commands/profileCommand.d.ts +10 -0
- package/dist/src/ui/commands/profileCommand.js +592 -0
- package/dist/src/ui/commands/profileCommand.js.map +1 -0
- package/dist/src/ui/commands/providerCommand.js +46 -3
- package/dist/src/ui/commands/providerCommand.js.map +1 -1
- package/dist/src/ui/commands/setCommand.d.ts +7 -0
- package/dist/src/ui/commands/setCommand.js +431 -0
- package/dist/src/ui/commands/setCommand.js.map +1 -0
- package/dist/src/ui/commands/setupGithubCommand.d.ts +7 -0
- package/dist/src/ui/commands/setupGithubCommand.js +49 -0
- package/dist/src/ui/commands/setupGithubCommand.js.map +1 -0
- package/dist/src/ui/commands/types.d.ts +1 -1
- package/dist/src/ui/commands/types.js.map +1 -1
- package/dist/src/ui/components/DebugProfiler.d.ts +6 -0
- package/dist/src/ui/components/DebugProfiler.js +26 -0
- package/dist/src/ui/components/DebugProfiler.js.map +1 -0
- package/dist/src/ui/components/Footer.d.ts +1 -0
- package/dist/src/ui/components/Footer.js +5 -4
- package/dist/src/ui/components/Footer.js.map +1 -1
- package/dist/src/ui/components/IDEContextDetailDisplay.d.ts +2 -1
- package/dist/src/ui/components/IDEContextDetailDisplay.js +3 -3
- package/dist/src/ui/components/IDEContextDetailDisplay.js.map +1 -1
- package/dist/src/ui/components/InputPrompt.js +123 -12
- package/dist/src/ui/components/InputPrompt.js.map +1 -1
- package/dist/src/ui/components/LoadProfileDialog.d.ts +13 -0
- package/dist/src/ui/components/LoadProfileDialog.js +57 -0
- package/dist/src/ui/components/LoadProfileDialog.js.map +1 -0
- package/dist/src/ui/components/PrepareLabel.d.ts +15 -0
- package/dist/src/ui/components/PrepareLabel.js +16 -0
- package/dist/src/ui/components/PrepareLabel.js.map +1 -0
- package/dist/src/ui/components/ProviderModelDialog.js +75 -28
- package/dist/src/ui/components/ProviderModelDialog.js.map +1 -1
- package/dist/src/ui/components/SecureKeyInput.d.ts +15 -0
- package/dist/src/ui/components/SecureKeyInput.js +58 -0
- package/dist/src/ui/components/SecureKeyInput.js.map +1 -0
- package/dist/src/ui/components/SuggestionsDisplay.d.ts +1 -0
- package/dist/src/ui/components/SuggestionsDisplay.js +3 -3
- package/dist/src/ui/components/SuggestionsDisplay.js.map +1 -1
- package/dist/src/ui/components/messages/ToolConfirmationMessage.js +15 -4
- package/dist/src/ui/components/messages/ToolConfirmationMessage.js.map +1 -1
- package/dist/src/ui/components/messages/UserMessage.js +4 -1
- package/dist/src/ui/components/messages/UserMessage.js.map +1 -1
- package/dist/src/ui/components/shared/text-buffer.js +9 -14
- package/dist/src/ui/components/shared/text-buffer.js.map +1 -1
- package/dist/src/ui/containers/SessionController.js +14 -15
- package/dist/src/ui/containers/SessionController.js.map +1 -1
- package/dist/src/ui/editors/editorSettingsManager.js +2 -0
- package/dist/src/ui/editors/editorSettingsManager.js.map +1 -1
- package/dist/src/ui/hooks/atCommandProcessor.js +56 -48
- package/dist/src/ui/hooks/atCommandProcessor.js.map +1 -1
- package/dist/src/ui/hooks/slashCommandProcessor.d.ts +1 -1
- package/dist/src/ui/hooks/slashCommandProcessor.js +13 -3
- package/dist/src/ui/hooks/slashCommandProcessor.js.map +1 -1
- package/dist/src/ui/hooks/useAuthCommand.js +9 -0
- package/dist/src/ui/hooks/useAuthCommand.js.map +1 -1
- package/dist/src/ui/hooks/useCompletion.d.ts +5 -5
- package/dist/src/ui/hooks/useCompletion.js +7 -407
- package/dist/src/ui/hooks/useCompletion.js.map +1 -1
- package/dist/src/ui/hooks/useGeminiStream.js +61 -10
- package/dist/src/ui/hooks/useGeminiStream.js.map +1 -1
- package/dist/src/ui/hooks/useLoadProfileDialog.d.ts +27 -0
- package/dist/src/ui/hooks/useLoadProfileDialog.js +138 -0
- package/dist/src/ui/hooks/useLoadProfileDialog.js.map +1 -0
- package/dist/src/ui/hooks/useReverseSearchCompletion.d.ts +19 -0
- package/dist/src/ui/hooks/useReverseSearchCompletion.js +54 -0
- package/dist/src/ui/hooks/useReverseSearchCompletion.js.map +1 -0
- package/dist/src/ui/hooks/useShellHistory.d.ts +1 -0
- package/dist/src/ui/hooks/useShellHistory.js +30 -7
- package/dist/src/ui/hooks/useShellHistory.js.map +1 -1
- package/dist/src/ui/hooks/useSlashCompletion.d.ts +24 -0
- package/dist/src/ui/hooks/useSlashCompletion.js +451 -0
- package/dist/src/ui/hooks/useSlashCompletion.js.map +1 -0
- package/dist/src/ui/reducers/appReducer.d.ts +3 -2
- package/dist/src/ui/reducers/appReducer.js +1 -0
- package/dist/src/ui/reducers/appReducer.js.map +1 -1
- package/dist/src/ui/utils/renderLoopDetector.js +3 -3
- package/dist/src/ui/utils/renderLoopDetector.js.map +1 -1
- package/dist/src/ui/utils/secureInputHandler.d.ts +46 -0
- package/dist/src/ui/utils/secureInputHandler.js +128 -0
- package/dist/src/ui/utils/secureInputHandler.js.map +1 -0
- package/dist/src/ui/utils/updateCheck.js +57 -12
- package/dist/src/ui/utils/updateCheck.js.map +1 -1
- package/dist/src/utils/gitUtils.d.ts +10 -0
- package/dist/src/utils/gitUtils.js +24 -0
- package/dist/src/utils/gitUtils.js.map +1 -0
- package/dist/src/utils/handleAutoUpdate.d.ts +2 -1
- package/dist/src/utils/handleAutoUpdate.js +8 -4
- package/dist/src/utils/handleAutoUpdate.js.map +1 -1
- package/dist/src/utils/sandbox-macos-permissive-closed.sb +6 -0
- package/dist/src/utils/sandbox-macos-permissive-open.sb +6 -0
- package/dist/src/utils/sandbox-macos-permissive-proxied.sb +6 -0
- package/dist/src/utils/sandbox-macos-restrictive-closed.sb +6 -0
- package/dist/src/utils/sandbox-macos-restrictive-open.sb +6 -0
- package/dist/src/utils/sandbox-macos-restrictive-proxied.sb +6 -0
- package/dist/src/utils/sandbox.d.ts +2 -2
- package/dist/src/utils/sandbox.js +35 -11
- package/dist/src/utils/sandbox.js.map +1 -1
- package/dist/src/utils/spawnWrapper.d.ts +7 -0
- package/dist/src/utils/spawnWrapper.js +8 -0
- package/dist/src/utils/spawnWrapper.js.map +1 -0
- package/dist/src/validateNonInterActiveAuth.d.ts +2 -1
- package/dist/src/validateNonInterActiveAuth.js +31 -5
- package/dist/src/validateNonInterActiveAuth.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/dist/src/providers/enhanceConfigWithProviders.d.ts +0 -12
- package/dist/src/providers/enhanceConfigWithProviders.js +0 -16
- package/dist/src/providers/enhanceConfigWithProviders.js.map +0 -1
@@ -0,0 +1,122 @@
|
|
1
|
+
/**
|
2
|
+
* @license
|
3
|
+
* Copyright 2025 Vybestack LLC
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
5
|
+
*/
|
6
|
+
import { CommandKind, } from './types.js';
|
7
|
+
/**
|
8
|
+
* Masks sensitive information like API keys
|
9
|
+
*/
|
10
|
+
function maskSensitive(value) {
|
11
|
+
if (value.length < 8) {
|
12
|
+
return '*'.repeat(value.length);
|
13
|
+
}
|
14
|
+
return (value.substring(0, 4) +
|
15
|
+
'*'.repeat(value.length - 8) +
|
16
|
+
value.substring(value.length - 4));
|
17
|
+
}
|
18
|
+
/**
|
19
|
+
* Implementation for the /diagnostics command that shows current configuration and state
|
20
|
+
*/
|
21
|
+
export const diagnosticsCommand = {
|
22
|
+
name: 'diagnostics',
|
23
|
+
description: 'show current configuration and diagnostic information',
|
24
|
+
kind: CommandKind.BUILT_IN,
|
25
|
+
action: async (context) => {
|
26
|
+
try {
|
27
|
+
const config = context.services.config;
|
28
|
+
const settings = context.services.settings;
|
29
|
+
if (!config) {
|
30
|
+
return {
|
31
|
+
type: 'message',
|
32
|
+
messageType: 'error',
|
33
|
+
content: 'Configuration not available',
|
34
|
+
};
|
35
|
+
}
|
36
|
+
const diagnostics = ['# LLxprt Diagnostics\n'];
|
37
|
+
// Provider information
|
38
|
+
const providerManager = config.getProviderManager();
|
39
|
+
const activeProvider = providerManager?.getActiveProvider();
|
40
|
+
diagnostics.push('## Provider Information');
|
41
|
+
diagnostics.push(`- Active Provider: ${activeProvider?.name || 'none'}`);
|
42
|
+
diagnostics.push(`- Current Model: ${config.getModel()}`);
|
43
|
+
// Check for API key
|
44
|
+
if (activeProvider &&
|
45
|
+
'hasApiKey' in activeProvider &&
|
46
|
+
typeof activeProvider.hasApiKey === 'function') {
|
47
|
+
diagnostics.push(`- API Key: ${activeProvider.hasApiKey() ? 'Set' : 'Not set'}`);
|
48
|
+
}
|
49
|
+
// Ephemeral settings
|
50
|
+
const ephemeralSettings = config.getEphemeralSettings();
|
51
|
+
diagnostics.push('\n## Ephemeral Settings');
|
52
|
+
if (Object.keys(ephemeralSettings).length === 0) {
|
53
|
+
diagnostics.push('- No ephemeral settings configured');
|
54
|
+
}
|
55
|
+
else {
|
56
|
+
for (const [key, value] of Object.entries(ephemeralSettings)) {
|
57
|
+
if (key === 'auth-key' && typeof value === 'string') {
|
58
|
+
diagnostics.push(`- ${key}: ${maskSensitive(value)}`);
|
59
|
+
}
|
60
|
+
else if (key === 'auth-keyfile' && typeof value === 'string') {
|
61
|
+
diagnostics.push(`- ${key}: ${value}`);
|
62
|
+
}
|
63
|
+
else {
|
64
|
+
diagnostics.push(`- ${key}: ${JSON.stringify(value)}`);
|
65
|
+
}
|
66
|
+
}
|
67
|
+
}
|
68
|
+
// Model parameters
|
69
|
+
diagnostics.push('\n## Model Parameters');
|
70
|
+
if (activeProvider &&
|
71
|
+
'getModelParams' in activeProvider &&
|
72
|
+
typeof activeProvider.getModelParams === 'function') {
|
73
|
+
const modelParams = activeProvider.getModelParams();
|
74
|
+
if (modelParams && Object.keys(modelParams).length > 0) {
|
75
|
+
for (const [key, value] of Object.entries(modelParams)) {
|
76
|
+
diagnostics.push(`- ${key}: ${JSON.stringify(value)}`);
|
77
|
+
}
|
78
|
+
}
|
79
|
+
else {
|
80
|
+
diagnostics.push('- No model parameters configured');
|
81
|
+
}
|
82
|
+
}
|
83
|
+
else {
|
84
|
+
diagnostics.push('- Model parameters not available for this provider');
|
85
|
+
}
|
86
|
+
// System information
|
87
|
+
diagnostics.push('\n## System Information');
|
88
|
+
diagnostics.push(`- Platform: ${process.platform}`);
|
89
|
+
diagnostics.push(`- Node Version: ${process.version}`);
|
90
|
+
diagnostics.push(`- Working Directory: ${process.cwd()}`);
|
91
|
+
diagnostics.push(`- Debug Mode: ${config.getDebugMode() ? 'Enabled' : 'Disabled'}`);
|
92
|
+
// Settings
|
93
|
+
diagnostics.push('\n## Settings');
|
94
|
+
const merged = settings.merged || {};
|
95
|
+
diagnostics.push(`- Theme: ${merged.theme || 'default'}`);
|
96
|
+
diagnostics.push(`- Selected Auth Type: ${merged.selectedAuthType || 'none'}`);
|
97
|
+
diagnostics.push(`- Default Profile: ${merged.defaultProfile || 'none'}`);
|
98
|
+
diagnostics.push(`- Sandbox: ${merged.sandbox || 'disabled'}`);
|
99
|
+
// Memory/Context
|
100
|
+
diagnostics.push('\n## Memory/Context');
|
101
|
+
const userMemory = config.getUserMemory();
|
102
|
+
diagnostics.push(`- User Memory: ${userMemory ? `${userMemory.length} characters` : 'Not loaded'}`);
|
103
|
+
diagnostics.push(`- Context Files: ${config.getLlxprtMdFileCount() || 0} files`);
|
104
|
+
// Telemetry
|
105
|
+
diagnostics.push('\n## Telemetry');
|
106
|
+
diagnostics.push(`- Usage Statistics: ${merged.usageStatisticsEnabled ? 'Enabled' : 'Disabled'}`);
|
107
|
+
return {
|
108
|
+
type: 'message',
|
109
|
+
messageType: 'info',
|
110
|
+
content: diagnostics.join('\n'),
|
111
|
+
};
|
112
|
+
}
|
113
|
+
catch (error) {
|
114
|
+
return {
|
115
|
+
type: 'message',
|
116
|
+
messageType: 'error',
|
117
|
+
content: `Failed to generate diagnostics: ${error instanceof Error ? error.message : String(error)}`,
|
118
|
+
};
|
119
|
+
}
|
120
|
+
},
|
121
|
+
};
|
122
|
+
//# sourceMappingURL=diagnosticsCommand.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"diagnosticsCommand.js","sourceRoot":"","sources":["../../../../src/ui/commands/diagnosticsCommand.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAIL,WAAW,GACZ,MAAM,YAAY,CAAC;AAEpB;;GAEG;AACH,SAAS,aAAa,CAAC,KAAa;IAClC,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACrB,OAAO,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAClC,CAAC;IACD,OAAO,CACL,KAAK,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC;QACrB,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;QAC5B,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAClC,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAiB;IAC9C,IAAI,EAAE,aAAa;IACnB,WAAW,EAAE,uDAAuD;IACpE,IAAI,EAAE,WAAW,CAAC,QAAQ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,CAAC,CAAC,CAAC,YAAY,EAAE,CAClF,CAAC;YACF,WAAW,CAAC,IAAI,CACd,oBAAoB,MAAM,CAAC,oBAAoB,EAAE,IAAI,CAAC,QAAQ,CAC/D,CAAC;YAEF,YAAY;YACZ,WAAW,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;YACnC,WAAW,CAAC,IAAI,CACd,uBAAuB,MAAM,CAAC,sBAAsB,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU,EAAE,CAChF,CAAC;YAEF,OAAO;gBACL,IAAI,EAAE,SAAS;gBACf,WAAW,EAAE,MAAM;gBACnB,OAAO,EAAE,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC;aAChC,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO;gBACL,IAAI,EAAE,SAAS;gBACf,WAAW,EAAE,OAAO;gBACpB,OAAO,EAAE,mCAAmC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;aACrG,CAAC;QACJ,CAAC;IACH,CAAC;CACF,CAAC"}
|
@@ -0,0 +1,116 @@
|
|
1
|
+
/**
|
2
|
+
* @license
|
3
|
+
* Copyright 2025 Google LLC
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
5
|
+
*/
|
6
|
+
import { CommandKind } from './types.js';
|
7
|
+
import { MessageType } from '../types.js';
|
8
|
+
import * as os from 'os';
|
9
|
+
import * as path from 'path';
|
10
|
+
export function expandHomeDir(p) {
|
11
|
+
if (!p) {
|
12
|
+
return '';
|
13
|
+
}
|
14
|
+
let expandedPath = p;
|
15
|
+
if (p.toLowerCase().startsWith('%userprofile%')) {
|
16
|
+
expandedPath = os.homedir() + p.substring('%userprofile%'.length);
|
17
|
+
}
|
18
|
+
else if (p.startsWith('~')) {
|
19
|
+
expandedPath = os.homedir() + p.substring(1);
|
20
|
+
}
|
21
|
+
return path.normalize(expandedPath);
|
22
|
+
}
|
23
|
+
export const directoryCommand = {
|
24
|
+
name: 'directory',
|
25
|
+
altNames: ['dir'],
|
26
|
+
description: 'Manage workspace directories',
|
27
|
+
kind: CommandKind.BUILT_IN,
|
28
|
+
subCommands: [
|
29
|
+
{
|
30
|
+
name: 'add',
|
31
|
+
description: 'Add directories to the workspace. Use comma to separate multiple paths',
|
32
|
+
kind: CommandKind.BUILT_IN,
|
33
|
+
action: async (context, args) => {
|
34
|
+
const { ui: { addItem }, services: { config }, } = context;
|
35
|
+
const [...rest] = args.split(' ');
|
36
|
+
if (!config) {
|
37
|
+
addItem({
|
38
|
+
type: MessageType.ERROR,
|
39
|
+
text: 'Configuration is not available.',
|
40
|
+
}, Date.now());
|
41
|
+
return;
|
42
|
+
}
|
43
|
+
const workspaceContext = config.getWorkspaceContext();
|
44
|
+
const pathsToAdd = rest
|
45
|
+
.join(' ')
|
46
|
+
.split(',')
|
47
|
+
.filter((p) => p);
|
48
|
+
if (pathsToAdd.length === 0) {
|
49
|
+
addItem({
|
50
|
+
type: MessageType.ERROR,
|
51
|
+
text: 'Please provide at least one path to add.',
|
52
|
+
}, Date.now());
|
53
|
+
return;
|
54
|
+
}
|
55
|
+
if (config.isRestrictiveSandbox()) {
|
56
|
+
return {
|
57
|
+
type: 'message',
|
58
|
+
messageType: 'error',
|
59
|
+
content: 'The /directory add command is not supported in restrictive sandbox profiles. Please use --include-directories when starting the session instead.',
|
60
|
+
};
|
61
|
+
}
|
62
|
+
const added = [];
|
63
|
+
const errors = [];
|
64
|
+
for (const pathToAdd of pathsToAdd) {
|
65
|
+
try {
|
66
|
+
workspaceContext.addDirectory(expandHomeDir(pathToAdd.trim()));
|
67
|
+
added.push(pathToAdd.trim());
|
68
|
+
}
|
69
|
+
catch (e) {
|
70
|
+
const error = e;
|
71
|
+
errors.push(`Error adding '${pathToAdd.trim()}': ${error.message}`);
|
72
|
+
}
|
73
|
+
}
|
74
|
+
if (added.length > 0) {
|
75
|
+
const gemini = config.getGeminiClient();
|
76
|
+
if (gemini) {
|
77
|
+
await gemini.addDirectoryContext();
|
78
|
+
}
|
79
|
+
addItem({
|
80
|
+
type: MessageType.INFO,
|
81
|
+
text: `Successfully added directories:\n- ${added.join('\n- ')}`,
|
82
|
+
}, Date.now());
|
83
|
+
}
|
84
|
+
if (errors.length > 0) {
|
85
|
+
addItem({
|
86
|
+
type: MessageType.ERROR,
|
87
|
+
text: errors.join('\n'),
|
88
|
+
}, Date.now());
|
89
|
+
}
|
90
|
+
},
|
91
|
+
},
|
92
|
+
{
|
93
|
+
name: 'show',
|
94
|
+
description: 'Show all directories in the workspace',
|
95
|
+
kind: CommandKind.BUILT_IN,
|
96
|
+
action: async (context) => {
|
97
|
+
const { ui: { addItem }, services: { config }, } = context;
|
98
|
+
if (!config) {
|
99
|
+
addItem({
|
100
|
+
type: MessageType.ERROR,
|
101
|
+
text: 'Configuration is not available.',
|
102
|
+
}, Date.now());
|
103
|
+
return;
|
104
|
+
}
|
105
|
+
const workspaceContext = config.getWorkspaceContext();
|
106
|
+
const directories = workspaceContext.getDirectories();
|
107
|
+
const directoryList = directories.map((dir) => `- ${dir}`).join('\n');
|
108
|
+
addItem({
|
109
|
+
type: MessageType.INFO,
|
110
|
+
text: `Current workspace directories:\n${directoryList}`,
|
111
|
+
}, Date.now());
|
112
|
+
},
|
113
|
+
},
|
114
|
+
],
|
115
|
+
};
|
116
|
+
//# sourceMappingURL=directoryCommand.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"directoryCommand.js","sourceRoot":"","sources":["../../../../src/ui/commands/directoryCommand.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAgC,WAAW,EAAE,MAAM,YAAY,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAE7B,MAAM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CAAC,CAAC;gBACtE,OAAO,CACL;oBACE,IAAI,EAAE,WAAW,CAAC,IAAI;oBACtB,IAAI,EAAE,mCAAmC,aAAa,EAAE;iBACzD,EACD,IAAI,CAAC,GAAG,EAAE,CACX,CAAC;YACJ,CAAC;SACF;KACF;CACF,CAAC"}
|
@@ -3,119 +3,115 @@
|
|
3
3
|
* Copyright 2025 Google LLC
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
5
5
|
*/
|
6
|
-
import {
|
7
|
-
import { IDEConnectionStatus } from '@vybestack/llxprt-code-core';
|
6
|
+
import { IDEConnectionStatus, getIdeDisplayName, getIdeInstaller, } from '@vybestack/llxprt-code-core';
|
8
7
|
import { CommandKind, } from './types.js';
|
9
|
-
import
|
10
|
-
import * as process from 'process';
|
11
|
-
import { glob } from 'glob';
|
12
|
-
import * as path from 'path';
|
13
|
-
const VSCODE_COMMAND = process.platform === 'win32' ? 'code.cmd' : 'code';
|
14
|
-
const VSCODE_COMPANION_EXTENSION_FOLDER = 'vscode-ide-companion';
|
15
|
-
function isVSCodeInstalled() {
|
16
|
-
try {
|
17
|
-
child_process.execSync(process.platform === 'win32'
|
18
|
-
? `where.exe ${VSCODE_COMMAND}`
|
19
|
-
: `command -v ${VSCODE_COMMAND}`, { stdio: 'ignore' });
|
20
|
-
return true;
|
21
|
-
}
|
22
|
-
catch {
|
23
|
-
return false;
|
24
|
-
}
|
25
|
-
}
|
8
|
+
import { SettingScope } from '../../config/settings.js';
|
26
9
|
export const ideCommand = (config) => {
|
27
|
-
if (!config?.
|
10
|
+
if (!config?.getIdeModeFeature()) {
|
28
11
|
return null;
|
29
12
|
}
|
30
|
-
|
13
|
+
const currentIDE = config.getIdeClient()?.getCurrentIde();
|
14
|
+
if (!currentIDE) {
|
15
|
+
return null;
|
16
|
+
}
|
17
|
+
const ideSlashCommand = {
|
31
18
|
name: 'ide',
|
32
19
|
description: 'manage IDE integration',
|
33
20
|
kind: CommandKind.BUILT_IN,
|
34
|
-
subCommands: [
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
return {
|
60
|
-
type: 'message',
|
61
|
-
messageType: 'error',
|
62
|
-
content,
|
63
|
-
};
|
64
|
-
}
|
65
|
-
}
|
66
|
-
},
|
67
|
-
},
|
68
|
-
{
|
69
|
-
name: 'install',
|
70
|
-
description: 'install required VS Code companion extension',
|
71
|
-
kind: CommandKind.BUILT_IN,
|
72
|
-
action: async (context) => {
|
73
|
-
if (!isVSCodeInstalled()) {
|
74
|
-
context.ui.addItem({
|
75
|
-
type: 'error',
|
76
|
-
text: `VS Code command-line tool "${VSCODE_COMMAND}" not found in your PATH.`,
|
77
|
-
}, Date.now());
|
78
|
-
return;
|
79
|
-
}
|
80
|
-
const bundleDir = path.dirname(fileURLToPath(import.meta.url));
|
81
|
-
// The VSIX file is copied to the bundle directory as part of the build.
|
82
|
-
let vsixFiles = glob.sync(path.join(bundleDir, '*.vsix'));
|
83
|
-
if (vsixFiles.length === 0) {
|
84
|
-
// If the VSIX file is not in the bundle, it might be a dev
|
85
|
-
// environment running with `npm start`. Look for it in the original
|
86
|
-
// package location, relative to the bundle dir.
|
87
|
-
const devPath = path.join(bundleDir, '..', '..', '..', '..', '..', VSCODE_COMPANION_EXTENSION_FOLDER, '*.vsix');
|
88
|
-
vsixFiles = glob.sync(devPath);
|
89
|
-
}
|
90
|
-
if (vsixFiles.length === 0) {
|
91
|
-
context.ui.addItem({
|
92
|
-
type: 'error',
|
93
|
-
text: 'Could not find the required VS Code companion extension. Please file a bug via /bug.',
|
94
|
-
}, Date.now());
|
95
|
-
return;
|
96
|
-
}
|
97
|
-
const vsixPath = vsixFiles[0];
|
98
|
-
const command = `${VSCODE_COMMAND} --install-extension ${vsixPath} --force`;
|
99
|
-
context.ui.addItem({
|
100
|
-
type: 'info',
|
101
|
-
text: `Installing VS Code companion extension...`,
|
102
|
-
}, Date.now());
|
103
|
-
try {
|
104
|
-
child_process.execSync(command, { stdio: 'pipe' });
|
105
|
-
context.ui.addItem({
|
106
|
-
type: 'info',
|
107
|
-
text: 'VS Code companion extension installed successfully. Restart llxprt in a fresh terminal window.',
|
108
|
-
}, Date.now());
|
109
|
-
}
|
110
|
-
catch (_error) {
|
111
|
-
context.ui.addItem({
|
112
|
-
type: 'error',
|
113
|
-
text: `Failed to install VS Code companion extension.`,
|
114
|
-
}, Date.now());
|
21
|
+
subCommands: [],
|
22
|
+
};
|
23
|
+
const statusCommand = {
|
24
|
+
name: 'status',
|
25
|
+
description: 'check status of IDE integration',
|
26
|
+
kind: CommandKind.BUILT_IN,
|
27
|
+
action: (_context) => {
|
28
|
+
const connection = config.getIdeClient()?.getConnectionStatus();
|
29
|
+
switch (connection?.status) {
|
30
|
+
case IDEConnectionStatus.Connected:
|
31
|
+
return {
|
32
|
+
type: 'message',
|
33
|
+
messageType: 'info',
|
34
|
+
content: `🟢 Connected`,
|
35
|
+
};
|
36
|
+
case IDEConnectionStatus.Connecting:
|
37
|
+
return {
|
38
|
+
type: 'message',
|
39
|
+
messageType: 'info',
|
40
|
+
content: `🟡 Connecting...`,
|
41
|
+
};
|
42
|
+
default: {
|
43
|
+
let content = `🔴 Disconnected`;
|
44
|
+
if (connection?.details) {
|
45
|
+
content += `: ${connection.details}`;
|
115
46
|
}
|
116
|
-
|
117
|
-
|
118
|
-
|
47
|
+
return {
|
48
|
+
type: 'message',
|
49
|
+
messageType: 'error',
|
50
|
+
content,
|
51
|
+
};
|
52
|
+
}
|
53
|
+
}
|
54
|
+
},
|
55
|
+
};
|
56
|
+
const installCommand = {
|
57
|
+
name: 'install',
|
58
|
+
description: `install required IDE companion ${getIdeDisplayName(currentIDE)} extension `,
|
59
|
+
kind: CommandKind.BUILT_IN,
|
60
|
+
action: async (context) => {
|
61
|
+
const installer = getIdeInstaller(currentIDE);
|
62
|
+
if (!installer) {
|
63
|
+
context.ui.addItem({
|
64
|
+
type: 'error',
|
65
|
+
text: 'No installer available for your configured IDE.',
|
66
|
+
}, Date.now());
|
67
|
+
return;
|
68
|
+
}
|
69
|
+
context.ui.addItem({
|
70
|
+
type: 'info',
|
71
|
+
text: `Installing IDE companion extension...`,
|
72
|
+
}, Date.now());
|
73
|
+
const result = await installer.install();
|
74
|
+
context.ui.addItem({
|
75
|
+
type: result.success ? 'info' : 'error',
|
76
|
+
text: result.message,
|
77
|
+
}, Date.now());
|
78
|
+
},
|
79
|
+
};
|
80
|
+
const enableCommand = {
|
81
|
+
name: 'enable',
|
82
|
+
description: 'enable IDE integration',
|
83
|
+
kind: CommandKind.BUILT_IN,
|
84
|
+
action: async (context) => {
|
85
|
+
context.services.settings.setValue(SettingScope.User, 'ideMode', true);
|
86
|
+
config.setIdeMode(true);
|
87
|
+
config.setIdeClientConnected();
|
88
|
+
},
|
119
89
|
};
|
90
|
+
const disableCommand = {
|
91
|
+
name: 'disable',
|
92
|
+
description: 'disable IDE integration',
|
93
|
+
kind: CommandKind.BUILT_IN,
|
94
|
+
action: async (context) => {
|
95
|
+
context.services.settings.setValue(SettingScope.User, 'ideMode', false);
|
96
|
+
config.setIdeMode(false);
|
97
|
+
config.setIdeClientDisconnected();
|
98
|
+
},
|
99
|
+
};
|
100
|
+
const ideModeEnabled = config.getIdeMode();
|
101
|
+
if (ideModeEnabled) {
|
102
|
+
ideSlashCommand.subCommands = [
|
103
|
+
disableCommand,
|
104
|
+
statusCommand,
|
105
|
+
installCommand,
|
106
|
+
];
|
107
|
+
}
|
108
|
+
else {
|
109
|
+
ideSlashCommand.subCommands = [
|
110
|
+
enableCommand,
|
111
|
+
statusCommand,
|
112
|
+
installCommand,
|
113
|
+
];
|
114
|
+
}
|
115
|
+
return ideSlashCommand;
|
120
116
|
};
|
121
117
|
//# sourceMappingURL=ideCommand.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ideCommand.js","sourceRoot":"","sources":["../../../../src/ui/commands/ideCommand.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,
|
1
|
+
{"version":3,"file":"ideCommand.js","sourceRoot":"","sources":["../../../../src/ui/commands/ideCommand.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAEL,mBAAmB,EACnB,iBAAiB,EACjB,eAAe,GAChB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAIL,WAAW,GACZ,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAExD,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,MAAqB,EAAuB,EAAE;IACvE,IAAI,CAAC,MAAM,EAAE,iBAAiB,EAAE,EAAE,CAAC;QACjC,OAAO,IAAI,CAAC;IACd,CAAC;IACD,MAAM,UAAU,GAAG,MAAM,CAAC,YAAY,EAAE,EAAE,aAAa,EAAE,CAAC;IAC1D,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,eAAe,GAAiB;QACpC,IAAI,EAAE,KAAK;QACX,WAAW,EAAE,wBAAwB;QACrC,IAAI,EAAE,WAAW,CAAC,QAAQ;QAC1B,WAAW,EAAE,EAAE;KAChB,CAAC;IAEF,MAAM,aAAa,GAAiB;QAClC,IAAI,EAAE,QAAQ;QACd,WAAW,EAAE,iCAAiC;QAC9C,IAAI,EAAE,WAAW,CAAC,QAAQ;QAC1B,MAAM,EAAE,CAAC,QAAwB,EAA4B,EAAE;YAC7D,MAAM,UAAU,GAAG,MAAM,CAAC,YAAY,EAAE,EAAE,mBAAmB,EAAE,CAAC;YAChE,QAAQ,UAAU,EAAE,MAAM,EAAE,CAAC;gBAC3B,KAAK,mBAAmB,CAAC,SAAS;oBAChC,OAAO;wBACL,IAAI,EAAE,SAAS;wB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"}
|
@@ -5,38 +5,39 @@
|
|
5
5
|
*/
|
6
6
|
import * as fs from 'fs';
|
7
7
|
import * as path from 'path';
|
8
|
+
import * as os from 'os';
|
8
9
|
import { CommandKind, } from './types.js';
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
10
|
+
import { PromptService } from '@vybestack/llxprt-code-core';
|
11
|
+
/**
|
12
|
+
* Get the init command prompt from the prompt service
|
13
|
+
*/
|
14
|
+
async function getInitCommandPrompt() {
|
15
|
+
try {
|
16
|
+
const baseDir = process.env.LLXPRT_PROMPTS_DIR ||
|
17
|
+
path.join(os.homedir(), '.llxprt', 'prompts');
|
18
|
+
const promptService = new PromptService({
|
19
|
+
baseDir,
|
20
|
+
debugMode: process.env.DEBUG === 'true',
|
21
|
+
});
|
22
|
+
await promptService.initialize();
|
23
|
+
try {
|
24
|
+
return await promptService.loadPrompt('commands/init-command.md');
|
20
25
|
}
|
21
|
-
|
22
|
-
|
23
|
-
if (fs.existsSync(llxprtMdPath)) {
|
24
|
-
return {
|
25
|
-
type: 'message',
|
26
|
-
messageType: 'info',
|
27
|
-
content: 'A LLXPRT.md file already exists in this directory. No changes were made.',
|
28
|
-
};
|
26
|
+
catch (error) {
|
27
|
+
console.warn('Failed to load init command prompt from file, using fallback:', error);
|
29
28
|
}
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
29
|
+
}
|
30
|
+
catch (error) {
|
31
|
+
console.warn('Failed to initialize prompt service, using fallback:', error);
|
32
|
+
}
|
33
|
+
// Fallback to hardcoded prompt
|
34
|
+
return getFallbackInitCommandPrompt();
|
35
|
+
}
|
36
|
+
/**
|
37
|
+
* Fallback prompt if the prompt service is not available
|
38
|
+
*/
|
39
|
+
function getFallbackInitCommandPrompt() {
|
40
|
+
return `You are an AI agent that brings the power of multiple LLM providers directly into the terminal. Your task is to analyze the current directory and generate a comprehensive LLXPRT.md file to be used as instructional context for future interactions.
|
40
41
|
|
41
42
|
**Analysis Process:**
|
42
43
|
|
@@ -68,8 +69,39 @@ You are an AI agent that brings the power of multiple LLM providers directly int
|
|
68
69
|
|
69
70
|
**Final Output:**
|
70
71
|
|
71
|
-
Write the complete content to the \`LLXPRT.md\` file. The output must be well-formatted Markdown
|
72
|
-
|
72
|
+
Write the complete content to the \`LLXPRT.md\` file. The output must be well-formatted Markdown.`;
|
73
|
+
}
|
74
|
+
export const initCommand = {
|
75
|
+
name: 'init',
|
76
|
+
description: 'Analyzes the project and creates a tailored LLXPRT.md file.',
|
77
|
+
kind: CommandKind.BUILT_IN,
|
78
|
+
action: async (context, _args) => {
|
79
|
+
if (!context.services.config) {
|
80
|
+
return {
|
81
|
+
type: 'message',
|
82
|
+
messageType: 'error',
|
83
|
+
content: 'Configuration not available.',
|
84
|
+
};
|
85
|
+
}
|
86
|
+
const targetDir = context.services.config.getTargetDir();
|
87
|
+
const llxprtMdPath = path.join(targetDir, 'LLXPRT.md');
|
88
|
+
if (fs.existsSync(llxprtMdPath)) {
|
89
|
+
return {
|
90
|
+
type: 'message',
|
91
|
+
messageType: 'info',
|
92
|
+
content: 'A LLXPRT.md file already exists in this directory. No changes were made.',
|
93
|
+
};
|
94
|
+
}
|
95
|
+
// Create an empty LLXPRT.md file
|
96
|
+
fs.writeFileSync(llxprtMdPath, '', 'utf8');
|
97
|
+
context.ui.addItem({
|
98
|
+
type: 'info',
|
99
|
+
text: 'Empty LLXPRT.md created. Now analyzing the project to populate it.',
|
100
|
+
}, Date.now());
|
101
|
+
const initPrompt = await getInitCommandPrompt();
|
102
|
+
return {
|
103
|
+
type: 'submit_prompt',
|
104
|
+
content: initPrompt,
|
73
105
|
};
|
74
106
|
},
|
75
107
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"initCommand.js","sourceRoot":"","sources":["../../../../src/ui/commands/initCommand.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAIL,WAAW,GACZ,MAAM,YAAY,CAAC;
|
1
|
+
{"version":3,"file":"initCommand.js","sourceRoot":"","sources":["../../../../src/ui/commands/initCommand.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,EAIL,WAAW,GACZ,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAE5D;;GAEG;AACH,KAAK,UAAU,oBAAoB;IACjC,IAAI,CAAC;QACH,MAAM,OAAO,GACX,OAAO,CAAC,GAAG,CAAC,kBAAkB;YAC9B,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;QAChD,MAAM,aAAa,GAAG,IAAI,aAAa,CAAC;YACtC,OAAO;YACP,SAAS,EAAE,OAAO,CAAC,GAAG,CAAC,KAAK,KAAK,MAAM;SACxC,CAAC,CAAC;QACH,MAAM,aAAa,CAAC,UAAU,EAAE,CAAC;QAEjC,IAAI,CAAC;YACH,OAAO,MAAM,aAAa,CAAC,UAAU,CAAC,0BAA0B,CAAC,CAAC;QACpE,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,IAAI,CACV,+DAA+D,EAC/D,KAAK,CACN,CAAC;QACJ,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,IAAI,CAAC,sDAAsD,EAAE,KAAK,CAAC,CAAC;IAC9E,CAAC;IAED,+BAA+B;IAC/B,OAAO,4BAA4B,EAAE,CAAC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