@redplanethq/corebrain 2.0.0 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/browser/close.d.ts +1 -1
- package/dist/commands/browser/close.d.ts.map +1 -1
- package/dist/commands/browser/close.js +39 -50
- package/dist/commands/browser/close.js.map +1 -1
- package/dist/commands/browser/command.d.ts +1 -1
- package/dist/commands/browser/command.d.ts.map +1 -1
- package/dist/commands/browser/command.js +46 -56
- package/dist/commands/browser/command.js.map +1 -1
- package/dist/commands/browser/create-profile.d.ts +1 -1
- package/dist/commands/browser/create-profile.d.ts.map +1 -1
- package/dist/commands/browser/create-profile.js +27 -21
- package/dist/commands/browser/create-profile.js.map +1 -1
- package/dist/commands/browser/delete-profile.d.ts +1 -1
- package/dist/commands/browser/delete-profile.d.ts.map +1 -1
- package/dist/commands/browser/delete-profile.js +26 -19
- package/dist/commands/browser/delete-profile.js.map +1 -1
- package/dist/commands/browser/install.d.ts +1 -1
- package/dist/commands/browser/install.d.ts.map +1 -1
- package/dist/commands/browser/install.js +31 -42
- package/dist/commands/browser/install.js.map +1 -1
- package/dist/commands/browser/open.d.ts +1 -1
- package/dist/commands/browser/open.d.ts.map +1 -1
- package/dist/commands/browser/open.js +40 -52
- package/dist/commands/browser/open.js.map +1 -1
- package/dist/commands/browser/status.d.ts +1 -1
- package/dist/commands/browser/status.d.ts.map +1 -1
- package/dist/commands/browser/status.js +36 -41
- package/dist/commands/browser/status.js.map +1 -1
- package/dist/commands/coding/config.d.ts +1 -1
- package/dist/commands/coding/config.d.ts.map +1 -1
- package/dist/commands/coding/config.js +95 -98
- package/dist/commands/coding/config.js.map +1 -1
- package/dist/commands/coding/remove.d.ts +1 -1
- package/dist/commands/coding/remove.d.ts.map +1 -1
- package/dist/commands/coding/remove.js +26 -28
- package/dist/commands/coding/remove.js.map +1 -1
- package/dist/commands/coding/setup.d.ts +1 -1
- package/dist/commands/coding/setup.d.ts.map +1 -1
- package/dist/commands/coding/setup.js +56 -71
- package/dist/commands/coding/setup.js.map +1 -1
- package/dist/commands/exec/config.d.ts +1 -1
- package/dist/commands/exec/config.d.ts.map +1 -1
- package/dist/commands/exec/config.js +71 -66
- package/dist/commands/exec/config.js.map +1 -1
- package/dist/commands/gateway/config.d.ts +10 -2
- package/dist/commands/gateway/config.d.ts.map +1 -1
- package/dist/commands/gateway/config.js +427 -156
- package/dist/commands/gateway/config.js.map +1 -1
- package/dist/commands/gateway/off.d.ts +1 -1
- package/dist/commands/gateway/off.d.ts.map +1 -1
- package/dist/commands/gateway/off.js +53 -63
- package/dist/commands/gateway/off.js.map +1 -1
- package/dist/commands/gateway/on.d.ts +1 -1
- package/dist/commands/gateway/on.d.ts.map +1 -1
- package/dist/commands/gateway/on.js +88 -117
- package/dist/commands/gateway/on.js.map +1 -1
- package/dist/commands/gateway/restart.d.ts +1 -1
- package/dist/commands/gateway/restart.d.ts.map +1 -1
- package/dist/commands/gateway/restart.js +49 -63
- package/dist/commands/gateway/restart.js.map +1 -1
- package/dist/commands/gateway/status.d.ts +1 -1
- package/dist/commands/gateway/status.d.ts.map +1 -1
- package/dist/commands/gateway/status.js +62 -76
- package/dist/commands/gateway/status.js.map +1 -1
- package/dist/commands/gateway/uninstall.d.ts +1 -1
- package/dist/commands/gateway/uninstall.d.ts.map +1 -1
- package/dist/commands/gateway/uninstall.js +60 -72
- package/dist/commands/gateway/uninstall.js.map +1 -1
- package/dist/commands/login.d.ts +1 -1
- package/dist/commands/login.d.ts.map +1 -1
- package/dist/commands/login.js +87 -107
- package/dist/commands/login.js.map +1 -1
- package/dist/commands/logout.d.ts +1 -1
- package/dist/commands/logout.d.ts.map +1 -1
- package/dist/commands/logout.js +24 -45
- package/dist/commands/logout.js.map +1 -1
- package/dist/commands/me.d.ts +1 -1
- package/dist/commands/me.d.ts.map +1 -1
- package/dist/commands/me.js +40 -50
- package/dist/commands/me.js.map +1 -1
- package/dist/commands/token.d.ts +1 -1
- package/dist/commands/token.d.ts.map +1 -1
- package/dist/commands/token.js +19 -24
- package/dist/commands/token.js.map +1 -1
- package/dist/components/error-message.js +0 -1
- package/dist/components/error-message.js.map +1 -1
- package/dist/components/warning-message.js +0 -1
- package/dist/components/warning-message.js.map +1 -1
- package/dist/server/gateway-client.d.ts +9 -0
- package/dist/server/gateway-client.d.ts.map +1 -1
- package/dist/server/gateway-client.js +74 -19
- package/dist/server/gateway-client.js.map +1 -1
- package/dist/server/gateway-entry.js +28 -3
- package/dist/server/gateway-entry.js.map +1 -1
- package/dist/server/tools/exec-tools.d.ts.map +1 -1
- package/dist/server/tools/exec-tools.js +9 -0
- package/dist/server/tools/exec-tools.js.map +1 -1
- package/dist/types/config.d.ts +15 -0
- package/dist/types/config.d.ts.map +1 -1
- package/package.json +6 -3
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
import { useApp } from 'ink';
|
|
3
|
+
import * as p from '@clack/prompts';
|
|
4
|
+
import chalk from 'chalk';
|
|
4
5
|
import zod from 'zod';
|
|
5
|
-
import { ThemeContext } from '../../hooks/useTheme.js';
|
|
6
|
-
import { themeContextValue } from '../../config/themes.js';
|
|
7
|
-
import SuccessMessage from '../../components/success-message.js';
|
|
8
|
-
import ErrorMessage from '../../components/error-message.js';
|
|
9
6
|
import { isAgentBrowserInstalled, browserOpen, canCreateSession, getSession } from '../../utils/agent-browser.js';
|
|
10
7
|
export const args = zod.tuple([
|
|
11
8
|
zod.string().describe('Session name'),
|
|
@@ -14,52 +11,43 @@ export const args = zod.tuple([
|
|
|
14
11
|
export const options = zod.object({
|
|
15
12
|
profile: zod.string().optional().default('corebrain').describe('Browser profile to use (default: corebrain)'),
|
|
16
13
|
});
|
|
14
|
+
async function runBrowserOpen(sessionName, url, profile) {
|
|
15
|
+
const spinner = p.spinner();
|
|
16
|
+
spinner.start('Checking agent-browser...');
|
|
17
|
+
const installed = await isAgentBrowserInstalled();
|
|
18
|
+
if (!installed) {
|
|
19
|
+
spinner.stop(chalk.red('Not installed'));
|
|
20
|
+
p.log.error('agent-browser is not installed. Run `corebrain browser install` first.');
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
// Check session limit
|
|
24
|
+
const { allowed, count } = canCreateSession();
|
|
25
|
+
const existingSession = getSession(sessionName);
|
|
26
|
+
if (!existingSession && !allowed) {
|
|
27
|
+
spinner.stop(chalk.red('Session limit reached'));
|
|
28
|
+
p.log.error(`Maximum 3 sessions allowed. Currently running: ${count}. Close a session first.`);
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
spinner.message(`Opening ${url} in session "${sessionName}"...`);
|
|
32
|
+
const result = await browserOpen(sessionName, url, profile);
|
|
33
|
+
if (result.code !== 0) {
|
|
34
|
+
spinner.stop(chalk.red('Failed to open URL'));
|
|
35
|
+
p.log.error(result.stderr || 'Failed to open URL');
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
spinner.stop(chalk.green(`Opened ${url} in session "${sessionName}" (profile: ${profile})`));
|
|
39
|
+
}
|
|
17
40
|
export default function BrowserOpen({ args: [sessionName, url], options }) {
|
|
18
|
-
const
|
|
19
|
-
const [error, setError] = useState('');
|
|
41
|
+
const { exit } = useApp();
|
|
20
42
|
useEffect(() => {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
31
|
-
// Check session limit
|
|
32
|
-
const { allowed, count } = canCreateSession();
|
|
33
|
-
const existingSession = getSession(sessionName);
|
|
34
|
-
if (!existingSession && !allowed) {
|
|
35
|
-
if (!cancelled) {
|
|
36
|
-
setError(`Maximum 3 sessions allowed. Currently running: ${count}. Close a session first.`);
|
|
37
|
-
setStatus('error');
|
|
38
|
-
}
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
if (!cancelled) {
|
|
42
|
-
setStatus('opening');
|
|
43
|
-
}
|
|
44
|
-
const result = await browserOpen(sessionName, url, options.profile);
|
|
45
|
-
if (result.code !== 0) {
|
|
46
|
-
throw new Error(result.stderr || 'Failed to open URL');
|
|
47
|
-
}
|
|
48
|
-
if (!cancelled) {
|
|
49
|
-
setStatus('success');
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
catch (err) {
|
|
53
|
-
if (!cancelled) {
|
|
54
|
-
setError(err instanceof Error ? err.message : 'Unknown error');
|
|
55
|
-
setStatus('error');
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
})();
|
|
59
|
-
return () => {
|
|
60
|
-
cancelled = true;
|
|
61
|
-
};
|
|
62
|
-
}, [sessionName, url, options.profile]);
|
|
63
|
-
return (_jsx(ThemeContext.Provider, { value: themeContextValue, children: status === 'checking' ? (_jsx(Text, { dimColor: true, children: "Checking agent-browser..." })) : status === 'not-installed' ? (_jsx(ErrorMessage, { message: "agent-browser is not installed. Run `corebrain browser install` first." })) : status === 'opening' ? (_jsxs(Text, { dimColor: true, children: ["Opening ", url, " in session \"", sessionName, "\"..."] })) : status === 'success' ? (_jsx(SuccessMessage, { message: `Opened ${url} in session "${sessionName}" (profile: ${options.profile})`, hideTitle: true })) : status === 'error' ? (_jsx(ErrorMessage, { message: `Failed to open URL: ${error}` })) : null }));
|
|
43
|
+
runBrowserOpen(sessionName, url, options.profile)
|
|
44
|
+
.catch((err) => {
|
|
45
|
+
p.log.error(`Failed to open URL: ${err instanceof Error ? err.message : 'Unknown error'}`);
|
|
46
|
+
})
|
|
47
|
+
.finally(() => {
|
|
48
|
+
setTimeout(() => exit(), 100);
|
|
49
|
+
});
|
|
50
|
+
}, [sessionName, url, options.profile, exit]);
|
|
51
|
+
return null;
|
|
64
52
|
}
|
|
65
53
|
//# sourceMappingURL=open.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"open.js","sourceRoot":"","sources":["../../../src/commands/browser/open.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AG,CAAC,KAAK,CAAC,uBAAuB,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,EAAE,CAAC,CAAC;QAC5F,CAAC,CAAC;aACD,OAAO,CAAC,GAAG,EAAE;YACb,UAAU,CAAC,GAAG,EAAE,CAAC,IAAI,EAAE,EAAE,GAAG,CAAC,CAAC;QAC/B,CAAC,CAAC,CAAC;IACL,CAAC,EAAE,CAAC,WAAW,EAAE,GAAG,EAAE,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC;IAE9C,OAAO,IAAI,CAAC;AACb,CAAC"}
|
|
@@ -3,6 +3,6 @@ export declare const options: zod.ZodObject<{}, zod.core.$strip>;
|
|
|
3
3
|
type Props = {
|
|
4
4
|
options: zod.infer<typeof options>;
|
|
5
5
|
};
|
|
6
|
-
export default function BrowserStatus(_props: Props):
|
|
6
|
+
export default function BrowserStatus(_props: Props): null;
|
|
7
7
|
export {};
|
|
8
8
|
//# sourceMappingURL=status.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/status.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/status.tsx"],"names":[],"mappings":"AAIA,OAAO,GAAG,MAAM,KAAK,CAAC;AAGtB,eAAO,MAAM,OAAO,oCAAiB,CAAC;AAEtC,KAAK,KAAK,GAAG;IACZ,OAAO,EAAE,GAAG,CAAC,KAAK,CAAC,OAAO,OAAO,CAAC,CAAC;CACnC,CAAC;AAgCF,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,MAAM,EAAE,KAAK,QAclD"}
|
|
@@ -1,48 +1,43 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
import { useApp } from 'ink';
|
|
3
|
+
import * as p from '@clack/prompts';
|
|
4
|
+
import chalk from 'chalk';
|
|
4
5
|
import zod from 'zod';
|
|
5
|
-
import { ThemeContext } from '../../hooks/useTheme.js';
|
|
6
|
-
import { themeContextValue } from '../../config/themes.js';
|
|
7
|
-
import ErrorMessage from '../../components/error-message.js';
|
|
8
6
|
import { isAgentBrowserInstalled, browserListSessions, browserGetProfiles } from '../../utils/agent-browser.js';
|
|
9
7
|
export const options = zod.object({});
|
|
10
|
-
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
catch (err) {
|
|
27
|
-
if (!cancelled) {
|
|
28
|
-
setError(err instanceof Error ? err.message : 'Unknown error');
|
|
29
|
-
setStatus('error');
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
})();
|
|
33
|
-
return () => {
|
|
34
|
-
cancelled = true;
|
|
35
|
-
};
|
|
36
|
-
}, []);
|
|
37
|
-
if (status === 'checking') {
|
|
38
|
-
return (_jsx(ThemeContext.Provider, { value: themeContextValue, children: _jsx(Text, { dimColor: true, children: "Checking browser status..." }) }));
|
|
39
|
-
}
|
|
40
|
-
if (status === 'error') {
|
|
41
|
-
return (_jsx(ThemeContext.Provider, { value: themeContextValue, children: _jsx(ErrorMessage, { message: error }) }));
|
|
8
|
+
async function runBrowserStatus() {
|
|
9
|
+
const spinner = p.spinner();
|
|
10
|
+
spinner.start('Checking browser status...');
|
|
11
|
+
const installed = await isAgentBrowserInstalled();
|
|
12
|
+
const sessions = browserListSessions();
|
|
13
|
+
const profiles = browserGetProfiles();
|
|
14
|
+
spinner.stop(chalk.green('Status retrieved'));
|
|
15
|
+
const lines = [
|
|
16
|
+
`${chalk.bold('agent-browser:')} ${installed ? chalk.green('installed') : chalk.red('not installed')}`,
|
|
17
|
+
`${chalk.bold(`Sessions (${sessions.length}/3):`)} ${sessions.length > 0 ? chalk.green(`${sessions.length} active`) : chalk.dim('none')}`,
|
|
18
|
+
];
|
|
19
|
+
if (sessions.length > 0) {
|
|
20
|
+
for (const session of sessions) {
|
|
21
|
+
lines.push(` ${chalk.dim('•')} ${chalk.cyan(session.sessionName)} ${chalk.dim('→')} ${session.url} ${chalk.dim(`(profile: ${session.profile})`)}`);
|
|
22
|
+
}
|
|
42
23
|
}
|
|
43
|
-
|
|
44
|
-
|
|
24
|
+
lines.push(`${chalk.bold('Profiles:')} ${profiles.length > 0 ? profiles.join(', ') : chalk.dim('none')}`);
|
|
25
|
+
p.note(lines.join('\n'), 'Browser Status');
|
|
26
|
+
if (!installed) {
|
|
27
|
+
p.log.info('Run `corebrain browser install` to install agent-browser');
|
|
45
28
|
}
|
|
46
|
-
|
|
29
|
+
}
|
|
30
|
+
export default function BrowserStatus(_props) {
|
|
31
|
+
const { exit } = useApp();
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
runBrowserStatus()
|
|
34
|
+
.catch((err) => {
|
|
35
|
+
p.log.error(err instanceof Error ? err.message : 'Unknown error');
|
|
36
|
+
})
|
|
37
|
+
.finally(() => {
|
|
38
|
+
setTimeout(() => exit(), 100);
|
|
39
|
+
});
|
|
40
|
+
}, [exit]);
|
|
41
|
+
return null;
|
|
47
42
|
}
|
|
48
43
|
//# sourceMappingURL=status.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"status.js","sourceRoot":"","sources":["../../../src/commands/browser/status.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"status.js","sourceRoot":"","sources":["../../../src/commands/browser/status.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,KAAK,CAAC,MAAM,gBAAgB,CAAC;AACpC,OAAO,KAAK,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 +18,6 @@ export declare const options: zod.ZodObject<{
|
|
|
18
18
|
type Props = {
|
|
19
19
|
options: zod.infer<typeof options>;
|
|
20
20
|
};
|
|
21
|
-
export default function CodingAgentConfig({ options: opts }: Props):
|
|
21
|
+
export default function CodingAgentConfig({ options: opts }: Props): null;
|
|
22
22
|
export {};
|
|
23
23
|
//# sourceMappingURL=config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/commands/coding/config.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/commands/coding/config.tsx"],"names":[],"mappings":"AAIA,OAAO,GAAG,MAAM,KAAK,CAAC;AAItB,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;mBAWlB,CAAC;AAEH,KAAK,KAAK,GAAG;IACZ,OAAO,EAAE,GAAG,CAAC,KAAK,CAAC,OAAO,OAAO,CAAC,CAAC;CACnC,CAAC;AA4FF,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,KAAK,QAcjE"}
|
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
import { useApp } from 'ink';
|
|
3
|
+
import * as p from '@clack/prompts';
|
|
4
|
+
import chalk from 'chalk';
|
|
4
5
|
import zod from 'zod';
|
|
5
6
|
import { getPreferences, updatePreferences } from '../../config/preferences.js';
|
|
6
|
-
import SuccessMessage from '../../components/success-message.js';
|
|
7
|
-
import ErrorMessage from '../../components/error-message.js';
|
|
8
|
-
import InfoMessage from '../../components/info-message.js';
|
|
9
|
-
import { ThemeContext } from '../../hooks/useTheme.js';
|
|
10
|
-
import { themeContextValue } from '../../config/themes.js';
|
|
11
7
|
export const options = zod.object({
|
|
12
8
|
agent: zod.string().describe('Agent name (e.g., claude-code)'),
|
|
13
9
|
command: zod.string().optional().describe('CLI command path'),
|
|
@@ -20,97 +16,98 @@ export const options = zod.object({
|
|
|
20
16
|
modelArg: zod.string().optional().describe('Model argument flag'),
|
|
21
17
|
show: zod.boolean().optional().describe('Show current config'),
|
|
22
18
|
});
|
|
23
|
-
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
19
|
+
function formatConfig(cfg) {
|
|
20
|
+
const lines = [
|
|
21
|
+
`${chalk.bold('command:')} ${cfg.command}`,
|
|
22
|
+
`${chalk.bold('args:')} ${cfg.args?.join(' ') || chalk.dim('(none)')}`,
|
|
23
|
+
`${chalk.bold('resumeArgs:')} ${cfg.resumeArgs?.join(' ') || chalk.dim('(none)')}`,
|
|
24
|
+
`${chalk.bold('sessionArg:')} ${cfg.sessionArg || chalk.dim('(not set)')}`,
|
|
25
|
+
`${chalk.bold('sessionMode:')} ${cfg.sessionMode || chalk.dim('(not set)')}`,
|
|
26
|
+
`${chalk.bold('allowedTools:')} ${cfg.allowedTools?.join(', ') || chalk.dim('(none)')}`,
|
|
27
|
+
`${chalk.bold('disallowedTools:')} ${cfg.disallowedTools?.join(', ') || chalk.dim('(none)')}`,
|
|
28
|
+
`${chalk.bold('modelArg:')} ${cfg.modelArg || chalk.dim('(not set)')}`,
|
|
29
|
+
];
|
|
30
|
+
return lines.join('\n');
|
|
31
|
+
}
|
|
32
|
+
async function runCodingConfig(opts) {
|
|
27
33
|
const agentName = opts.agent;
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
setConfig(existingConfig);
|
|
49
|
-
setStatus('show');
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
// Build new config
|
|
53
|
-
const newConfig = existingConfig || { command: agentName };
|
|
54
|
-
if (opts.command !== undefined) {
|
|
55
|
-
newConfig.command = opts.command;
|
|
56
|
-
}
|
|
57
|
-
if (opts.args !== undefined) {
|
|
58
|
-
newConfig.args = opts.args
|
|
59
|
-
.split(',')
|
|
60
|
-
.map((a) => a.trim())
|
|
61
|
-
.filter(Boolean);
|
|
62
|
-
}
|
|
63
|
-
if (opts.resumeArgs !== undefined) {
|
|
64
|
-
newConfig.resumeArgs = opts.resumeArgs
|
|
65
|
-
.split(',')
|
|
66
|
-
.map((a) => a.trim())
|
|
67
|
-
.filter(Boolean);
|
|
68
|
-
}
|
|
69
|
-
if (opts.sessionArg !== undefined) {
|
|
70
|
-
newConfig.sessionArg = opts.sessionArg;
|
|
71
|
-
}
|
|
72
|
-
if (opts.sessionMode !== undefined) {
|
|
73
|
-
newConfig.sessionMode = opts.sessionMode;
|
|
74
|
-
}
|
|
75
|
-
if (opts.allowedTools !== undefined) {
|
|
76
|
-
newConfig.allowedTools = opts.allowedTools
|
|
77
|
-
.split(',')
|
|
78
|
-
.map((t) => t.trim())
|
|
79
|
-
.filter(Boolean);
|
|
80
|
-
}
|
|
81
|
-
if (opts.disallowedTools !== undefined) {
|
|
82
|
-
newConfig.disallowedTools = opts.disallowedTools
|
|
83
|
-
.split(',')
|
|
84
|
-
.map((t) => t.trim())
|
|
85
|
-
.filter(Boolean);
|
|
86
|
-
}
|
|
87
|
-
if (opts.modelArg !== undefined) {
|
|
88
|
-
newConfig.modelArg = opts.modelArg;
|
|
89
|
-
}
|
|
90
|
-
// Save config
|
|
91
|
-
coding[agentName] = newConfig;
|
|
92
|
-
updatePreferences({ coding });
|
|
93
|
-
setConfig(newConfig);
|
|
94
|
-
setStatus('updated');
|
|
95
|
-
}
|
|
96
|
-
catch (err) {
|
|
97
|
-
setError(err instanceof Error ? err.message : 'Unknown error');
|
|
98
|
-
setStatus('error');
|
|
34
|
+
const prefs = getPreferences();
|
|
35
|
+
const coding = (prefs.coding || {});
|
|
36
|
+
const existingConfig = coding[agentName];
|
|
37
|
+
// Check if any config options were provided
|
|
38
|
+
const hasConfigOptions = opts.command !== undefined ||
|
|
39
|
+
opts.args !== undefined ||
|
|
40
|
+
opts.resumeArgs !== undefined ||
|
|
41
|
+
opts.sessionArg !== undefined ||
|
|
42
|
+
opts.sessionMode !== undefined ||
|
|
43
|
+
opts.allowedTools !== undefined ||
|
|
44
|
+
opts.disallowedTools !== undefined ||
|
|
45
|
+
opts.modelArg !== undefined;
|
|
46
|
+
// If just showing config (no options provided or --show)
|
|
47
|
+
if (opts.show || !hasConfigOptions) {
|
|
48
|
+
if (!existingConfig) {
|
|
49
|
+
p.log.warning(`Agent "${agentName}" not configured.`);
|
|
50
|
+
p.log.info(`Run 'corebrain coding setup' to auto-detect\nor configure with:\n corebrain coding config --agent ${agentName} --command /path/to/cli`);
|
|
51
|
+
return;
|
|
99
52
|
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
}
|
|
114
|
-
|
|
53
|
+
p.note(formatConfig(existingConfig), `${agentName} Configuration`);
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
// Build new config
|
|
57
|
+
const newConfig = existingConfig || { command: agentName };
|
|
58
|
+
if (opts.command !== undefined) {
|
|
59
|
+
newConfig.command = opts.command;
|
|
60
|
+
}
|
|
61
|
+
if (opts.args !== undefined) {
|
|
62
|
+
newConfig.args = opts.args
|
|
63
|
+
.split(',')
|
|
64
|
+
.map((a) => a.trim())
|
|
65
|
+
.filter(Boolean);
|
|
66
|
+
}
|
|
67
|
+
if (opts.resumeArgs !== undefined) {
|
|
68
|
+
newConfig.resumeArgs = opts.resumeArgs
|
|
69
|
+
.split(',')
|
|
70
|
+
.map((a) => a.trim())
|
|
71
|
+
.filter(Boolean);
|
|
72
|
+
}
|
|
73
|
+
if (opts.sessionArg !== undefined) {
|
|
74
|
+
newConfig.sessionArg = opts.sessionArg;
|
|
75
|
+
}
|
|
76
|
+
if (opts.sessionMode !== undefined) {
|
|
77
|
+
newConfig.sessionMode = opts.sessionMode;
|
|
78
|
+
}
|
|
79
|
+
if (opts.allowedTools !== undefined) {
|
|
80
|
+
newConfig.allowedTools = opts.allowedTools
|
|
81
|
+
.split(',')
|
|
82
|
+
.map((t) => t.trim())
|
|
83
|
+
.filter(Boolean);
|
|
84
|
+
}
|
|
85
|
+
if (opts.disallowedTools !== undefined) {
|
|
86
|
+
newConfig.disallowedTools = opts.disallowedTools
|
|
87
|
+
.split(',')
|
|
88
|
+
.map((t) => t.trim())
|
|
89
|
+
.filter(Boolean);
|
|
90
|
+
}
|
|
91
|
+
if (opts.modelArg !== undefined) {
|
|
92
|
+
newConfig.modelArg = opts.modelArg;
|
|
93
|
+
}
|
|
94
|
+
// Save config
|
|
95
|
+
coding[agentName] = newConfig;
|
|
96
|
+
updatePreferences({ coding });
|
|
97
|
+
p.log.success(chalk.green(`Updated ${agentName} configuration`));
|
|
98
|
+
p.note(formatConfig(newConfig), 'New Configuration');
|
|
99
|
+
}
|
|
100
|
+
export default function CodingAgentConfig({ options: opts }) {
|
|
101
|
+
const { exit } = useApp();
|
|
102
|
+
useEffect(() => {
|
|
103
|
+
runCodingConfig(opts)
|
|
104
|
+
.catch((err) => {
|
|
105
|
+
p.log.error(`Config error: ${err instanceof Error ? err.message : 'Unknown error'}`);
|
|
106
|
+
})
|
|
107
|
+
.finally(() => {
|
|
108
|
+
setTimeout(() => exit(), 100);
|
|
109
|
+
});
|
|
110
|
+
}, [opts, exit]);
|
|
111
|
+
return null;
|
|
115
112
|
}
|
|
116
113
|
//# sourceMappingURL=config.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/commands/coding/config.tsx"],"names":[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,6 @@ export declare const options: zod.ZodObject<{
|
|
|
5
5
|
type Props = {
|
|
6
6
|
options: zod.infer<typeof options>;
|
|
7
7
|
};
|
|
8
|
-
export default function CodingRemove({ options: opts }: Props):
|
|
8
|
+
export default function CodingRemove({ options: opts }: Props): null;
|
|
9
9
|
export {};
|
|
10
10
|
//# sourceMappingURL=remove.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remove.d.ts","sourceRoot":"","sources":["../../../src/commands/coding/remove.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"remove.d.ts","sourceRoot":"","sources":["../../../src/commands/coding/remove.tsx"],"names":[],"mappings":"AAIA,OAAO,GAAG,MAAM,KAAK,CAAC;AAItB,eAAO,MAAM,OAAO;;mBAElB,CAAC;AAEH,KAAK,KAAK,GAAG;IACZ,OAAO,EAAE,GAAG,CAAC,KAAK,CAAC,OAAO,OAAO,CAAC,CAAC;CACnC,CAAC;AAkBF,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,KAAK,QAc5D"}
|
|
@@ -1,37 +1,35 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
import { useApp } from 'ink';
|
|
3
|
+
import * as p from '@clack/prompts';
|
|
4
|
+
import chalk from 'chalk';
|
|
4
5
|
import zod from 'zod';
|
|
5
6
|
import { getPreferences, updatePreferences } from '../../config/preferences.js';
|
|
6
|
-
import SuccessMessage from '../../components/success-message.js';
|
|
7
|
-
import ErrorMessage from '../../components/error-message.js';
|
|
8
|
-
import { ThemeContext } from '../../hooks/useTheme.js';
|
|
9
|
-
import { themeContextValue } from '../../config/themes.js';
|
|
10
7
|
export const options = zod.object({
|
|
11
8
|
agent: zod.string().describe('Agent name to remove'),
|
|
12
9
|
});
|
|
10
|
+
async function runCodingRemove(agentName) {
|
|
11
|
+
const prefs = getPreferences();
|
|
12
|
+
const coding = (prefs.coding || {});
|
|
13
|
+
if (!coding[agentName]) {
|
|
14
|
+
p.log.warning(`Agent "${agentName}" not found.`);
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
// Remove the agent
|
|
18
|
+
delete coding[agentName];
|
|
19
|
+
updatePreferences({ coding });
|
|
20
|
+
p.log.success(chalk.green(`Removed "${agentName}" configuration.`));
|
|
21
|
+
}
|
|
13
22
|
export default function CodingRemove({ options: opts }) {
|
|
14
|
-
const
|
|
15
|
-
const [error, setError] = useState('');
|
|
16
|
-
const agentName = opts.agent;
|
|
23
|
+
const { exit } = useApp();
|
|
17
24
|
useEffect(() => {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
updatePreferences({ coding });
|
|
28
|
-
setStatus('removed');
|
|
29
|
-
}
|
|
30
|
-
catch (err) {
|
|
31
|
-
setError(err instanceof Error ? err.message : 'Unknown error');
|
|
32
|
-
setStatus('error');
|
|
33
|
-
}
|
|
34
|
-
}, [agentName]);
|
|
35
|
-
return (_jsx(ThemeContext.Provider, { value: themeContextValue, children: status === 'loading' ? (_jsx(Text, { dimColor: true, children: "Removing agent configuration..." })) : status === 'error' ? (_jsx(ErrorMessage, { message: `Error: ${error}` })) : status === 'not-found' ? (_jsx(ErrorMessage, { message: `Agent "${agentName}" not found.`, hideTitle: true })) : status === 'removed' ? (_jsx(SuccessMessage, { message: `Removed "${agentName}" configuration.` })) : null }));
|
|
25
|
+
runCodingRemove(opts.agent)
|
|
26
|
+
.catch((err) => {
|
|
27
|
+
p.log.error(`Error: ${err instanceof Error ? err.message : 'Unknown error'}`);
|
|
28
|
+
})
|
|
29
|
+
.finally(() => {
|
|
30
|
+
setTimeout(() => exit(), 100);
|
|
31
|
+
});
|
|
32
|
+
}, [opts.agent, exit]);
|
|
33
|
+
return null;
|
|
36
34
|
}
|
|
37
35
|
//# sourceMappingURL=remove.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remove.js","sourceRoot":"","sources":["../../../src/commands/coding/remove.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"remove.js","sourceRoot":"","sources":["../../../src/commands/coding/remove.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,KAAK,CAAC,MAAM,gBAAgB,CAAC;AACpC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAGzE,MAAM,CAAC,MAAM,OAAO,GAAG,GAAG,CAAC,MAAM,CAAC;IACjC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,sBAAsB,CAAC;CACpD,CAAC,CAAC;AAMH,KAAK,UAAU,eAAe,CAAC,SAAiB;IAC/C,MAAM,KAAK,GAAG,cAAc,EAAE,CAAC;IAC/B,MAAM,MAAM,GAAG,CAAC,KAAK,CAAC,MAAM,IAAI,EAAE,CAAqC,CAAC;IAExE,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,CAAC;QACxB,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,UAAU,SAAS,cAAc,CAAC,CAAC;QACjD,OAAO;IACR,CAAC;IAED,mBAAmB;IACnB,OAAO,MAAM,CAAC,SAAS,CAAC,CAAC;IACzB,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC;IAE9B,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,YAAY,SAAS,kBAAkB,CAAC,CAAC,CAAC;AACrE,CAAC;AAED,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,EAAE,OAAO,E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