@codemieai/code 0.0.36 → 0.0.38
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 +33 -0
- package/dist/agents/codemie-code/tools/assistant-invocation.d.ts.map +1 -1
- package/dist/agents/codemie-code/tools/assistant-invocation.js +2 -2
- package/dist/agents/codemie-code/tools/assistant-invocation.js.map +1 -1
- package/dist/agents/core/BaseAgentAdapter.d.ts.map +1 -1
- package/dist/agents/core/BaseAgentAdapter.js +23 -9
- package/dist/agents/core/BaseAgentAdapter.js.map +1 -1
- package/dist/agents/core/extension/BaseExtensionInstaller.d.ts.map +1 -1
- package/dist/agents/core/extension/BaseExtensionInstaller.js +11 -4
- package/dist/agents/core/extension/BaseExtensionInstaller.js.map +1 -1
- package/dist/agents/core/session/BaseProcessor.d.ts +22 -1
- package/dist/agents/core/session/BaseProcessor.d.ts.map +1 -1
- package/dist/agents/plugins/claude/claude-acp.plugin.d.ts +5 -0
- package/dist/agents/plugins/claude/claude-acp.plugin.d.ts.map +1 -1
- package/dist/agents/plugins/claude/claude-acp.plugin.js +12 -2
- package/dist/agents/plugins/claude/claude-acp.plugin.js.map +1 -1
- package/dist/agents/plugins/claude/claude.plugin.d.ts +11 -0
- package/dist/agents/plugins/claude/claude.plugin.d.ts.map +1 -1
- package/dist/agents/plugins/claude/claude.plugin.js +59 -2
- package/dist/agents/plugins/claude/claude.plugin.js.map +1 -1
- package/dist/agents/plugins/claude/claude.session.d.ts +5 -0
- package/dist/agents/plugins/claude/claude.session.d.ts.map +1 -1
- package/dist/agents/plugins/claude/claude.session.js +101 -2
- package/dist/agents/plugins/claude/claude.session.js.map +1 -1
- package/dist/agents/plugins/claude/plugin/.claude-plugin/plugin.json +1 -1
- package/dist/agents/plugins/claude/plugin/commands/README.md +103 -22
- package/dist/agents/plugins/claude/plugin/commands/memory-refresh.md +329 -18
- package/dist/agents/plugins/claude/session/processors/claude.conversations-processor.d.ts +0 -1
- package/dist/agents/plugins/claude/session/processors/claude.conversations-processor.d.ts.map +1 -1
- package/dist/agents/plugins/claude/session/processors/claude.conversations-processor.js +13 -19
- package/dist/agents/plugins/claude/session/processors/claude.conversations-processor.js.map +1 -1
- package/dist/agents/plugins/claude/session/processors/claude.metrics-processor.d.ts.map +1 -1
- package/dist/agents/plugins/claude/session/processors/claude.metrics-processor.js +29 -4
- package/dist/agents/plugins/claude/session/processors/claude.metrics-processor.js.map +1 -1
- package/dist/cli/commands/assistants/chat.js +9 -6
- package/dist/cli/commands/assistants/chat.js.map +1 -1
- package/dist/cli/commands/assistants/constants.d.ts +2 -6
- package/dist/cli/commands/assistants/constants.d.ts.map +1 -1
- package/dist/cli/commands/assistants/constants.js +2 -5
- package/dist/cli/commands/assistants/constants.js.map +1 -1
- package/dist/cli/commands/assistants/index.d.ts.map +1 -1
- package/dist/cli/commands/assistants/index.js +1 -11
- package/dist/cli/commands/assistants/index.js.map +1 -1
- package/dist/cli/commands/assistants/setup/configuration/actions.d.ts +30 -0
- package/dist/cli/commands/assistants/setup/configuration/actions.d.ts.map +1 -0
- package/dist/cli/commands/assistants/setup/configuration/actions.js +63 -0
- package/dist/cli/commands/assistants/setup/configuration/actions.js.map +1 -0
- package/dist/cli/commands/assistants/setup/configuration/constants.d.ts +49 -0
- package/dist/cli/commands/assistants/setup/configuration/constants.d.ts.map +1 -0
- package/dist/cli/commands/assistants/setup/configuration/constants.js +56 -0
- package/dist/cli/commands/assistants/setup/configuration/constants.js.map +1 -0
- package/dist/cli/commands/assistants/setup/configuration/index.d.ts +9 -0
- package/dist/cli/commands/assistants/setup/configuration/index.d.ts.map +1 -0
- package/dist/cli/commands/assistants/setup/configuration/index.js +8 -0
- package/dist/cli/commands/assistants/setup/configuration/index.js.map +1 -0
- package/dist/cli/commands/assistants/setup/configuration/selection.d.ts +12 -0
- package/dist/cli/commands/assistants/setup/configuration/selection.d.ts.map +1 -0
- package/dist/cli/commands/assistants/setup/configuration/selection.js +94 -0
- package/dist/cli/commands/assistants/setup/configuration/selection.js.map +1 -0
- package/dist/cli/commands/assistants/setup/configuration/types.d.ts +22 -0
- package/dist/cli/commands/assistants/setup/configuration/types.d.ts.map +1 -0
- package/dist/cli/commands/assistants/setup/configuration/types.js +2 -0
- package/dist/cli/commands/assistants/setup/configuration/types.js.map +1 -0
- package/dist/cli/commands/assistants/setup/configuration/ui.d.ts +9 -0
- package/dist/cli/commands/assistants/setup/configuration/ui.d.ts.map +1 -0
- package/dist/cli/commands/assistants/setup/configuration/ui.js +86 -0
- package/dist/cli/commands/assistants/setup/configuration/ui.js.map +1 -0
- package/dist/cli/commands/assistants/setup/constants.d.ts +26 -0
- package/dist/cli/commands/assistants/setup/constants.d.ts.map +1 -0
- package/dist/cli/commands/assistants/setup/constants.js +21 -0
- package/dist/cli/commands/assistants/setup/constants.js.map +1 -0
- package/dist/cli/commands/assistants/setup/data.d.ts +30 -0
- package/dist/cli/commands/assistants/setup/data.d.ts.map +1 -0
- package/dist/cli/commands/assistants/setup/data.js +125 -0
- package/dist/cli/commands/assistants/setup/data.js.map +1 -0
- package/dist/cli/commands/assistants/setup/generators/claude-agent-generator.d.ts.map +1 -0
- package/dist/cli/commands/assistants/{generators → setup/generators}/claude-agent-generator.js +6 -2
- package/dist/cli/commands/assistants/setup/generators/claude-agent-generator.js.map +1 -0
- package/dist/cli/commands/assistants/setup/generators/claude-skill-generator.d.ts +12 -0
- package/dist/cli/commands/assistants/setup/generators/claude-skill-generator.d.ts.map +1 -0
- package/dist/cli/commands/assistants/setup/generators/claude-skill-generator.js +94 -0
- package/dist/cli/commands/assistants/setup/generators/claude-skill-generator.js.map +1 -0
- package/dist/cli/commands/assistants/setup/helpers.d.ts +27 -0
- package/dist/cli/commands/assistants/setup/helpers.d.ts.map +1 -0
- package/dist/cli/commands/assistants/setup/helpers.js +94 -0
- package/dist/cli/commands/assistants/setup/helpers.js.map +1 -0
- package/dist/cli/commands/assistants/setup/index.d.ts +17 -0
- package/dist/cli/commands/assistants/setup/index.d.ts.map +1 -0
- package/dist/cli/commands/assistants/setup/index.js +193 -0
- package/dist/cli/commands/assistants/setup/index.js.map +1 -0
- package/dist/cli/commands/assistants/setup/manualConfiguration/actions.d.ts +47 -0
- package/dist/cli/commands/assistants/setup/manualConfiguration/actions.d.ts.map +1 -0
- package/dist/cli/commands/assistants/setup/manualConfiguration/actions.js +140 -0
- package/dist/cli/commands/assistants/setup/manualConfiguration/actions.js.map +1 -0
- package/dist/cli/commands/assistants/setup/manualConfiguration/constants.d.ts +56 -0
- package/dist/cli/commands/assistants/setup/manualConfiguration/constants.d.ts.map +1 -0
- package/dist/cli/commands/assistants/setup/manualConfiguration/constants.js +61 -0
- package/dist/cli/commands/assistants/setup/manualConfiguration/constants.js.map +1 -0
- package/dist/cli/commands/assistants/setup/manualConfiguration/index.d.ts +12 -0
- package/dist/cli/commands/assistants/setup/manualConfiguration/index.d.ts.map +1 -0
- package/dist/cli/commands/assistants/setup/manualConfiguration/index.js +48 -0
- package/dist/cli/commands/assistants/setup/manualConfiguration/index.js.map +1 -0
- package/dist/cli/commands/assistants/setup/manualConfiguration/interactive-prompt.d.ts +6 -0
- package/dist/cli/commands/assistants/setup/manualConfiguration/interactive-prompt.d.ts.map +1 -0
- package/dist/cli/commands/assistants/setup/manualConfiguration/interactive-prompt.js +90 -0
- package/dist/cli/commands/assistants/setup/manualConfiguration/interactive-prompt.js.map +1 -0
- package/dist/cli/commands/assistants/setup/manualConfiguration/types.d.ts +37 -0
- package/dist/cli/commands/assistants/setup/manualConfiguration/types.d.ts.map +1 -0
- package/dist/cli/commands/assistants/setup/manualConfiguration/types.js +2 -0
- package/dist/cli/commands/assistants/setup/manualConfiguration/types.js.map +1 -0
- package/dist/cli/commands/assistants/setup/manualConfiguration/ui.d.ts +6 -0
- package/dist/cli/commands/assistants/setup/manualConfiguration/ui.d.ts.map +1 -0
- package/dist/cli/commands/assistants/setup/manualConfiguration/ui.js +103 -0
- package/dist/cli/commands/assistants/setup/manualConfiguration/ui.js.map +1 -0
- package/dist/cli/commands/assistants/setup/selection/actions.d.ts +31 -0
- package/dist/cli/commands/assistants/setup/selection/actions.d.ts.map +1 -0
- package/dist/cli/commands/assistants/setup/selection/actions.js +321 -0
- package/dist/cli/commands/assistants/setup/selection/actions.js.map +1 -0
- package/dist/cli/commands/assistants/setup/selection/constants.d.ts +79 -0
- package/dist/cli/commands/assistants/setup/selection/constants.d.ts.map +1 -0
- package/dist/cli/commands/assistants/setup/selection/constants.js +90 -0
- package/dist/cli/commands/assistants/setup/selection/constants.js.map +1 -0
- package/dist/cli/commands/assistants/setup/selection/index.d.ts +25 -0
- package/dist/cli/commands/assistants/setup/selection/index.d.ts.map +1 -0
- package/dist/cli/commands/assistants/setup/selection/index.js +127 -0
- package/dist/cli/commands/assistants/setup/selection/index.js.map +1 -0
- package/dist/cli/commands/assistants/setup/selection/interactive-prompt.d.ts +20 -0
- package/dist/cli/commands/assistants/setup/selection/interactive-prompt.d.ts.map +1 -0
- package/dist/cli/commands/assistants/setup/selection/interactive-prompt.js +328 -0
- package/dist/cli/commands/assistants/setup/selection/interactive-prompt.js.map +1 -0
- package/dist/cli/commands/assistants/setup/selection/types.d.ts +27 -0
- package/dist/cli/commands/assistants/setup/selection/types.d.ts.map +1 -0
- package/dist/cli/commands/assistants/setup/selection/types.js +2 -0
- package/dist/cli/commands/assistants/setup/selection/types.js.map +1 -0
- package/dist/cli/commands/assistants/setup/selection/ui.d.ts +11 -0
- package/dist/cli/commands/assistants/setup/selection/ui.d.ts.map +1 -0
- package/dist/cli/commands/assistants/setup/selection/ui.js +189 -0
- package/dist/cli/commands/assistants/setup/selection/ui.js.map +1 -0
- package/dist/cli/commands/assistants/setup/selection/utils.d.ts +36 -0
- package/dist/cli/commands/assistants/setup/selection/utils.d.ts.map +1 -0
- package/dist/cli/commands/assistants/setup/selection/utils.js +55 -0
- package/dist/cli/commands/assistants/setup/selection/utils.js.map +1 -0
- package/dist/cli/commands/assistants/setup/summary/index.d.ts +16 -0
- package/dist/cli/commands/assistants/setup/summary/index.d.ts.map +1 -0
- package/dist/cli/commands/assistants/setup/summary/index.js +48 -0
- package/dist/cli/commands/assistants/setup/summary/index.js.map +1 -0
- package/dist/cli/commands/hook.d.ts +72 -0
- package/dist/cli/commands/hook.d.ts.map +1 -1
- package/dist/cli/commands/hook.js +290 -110
- package/dist/cli/commands/hook.js.map +1 -1
- package/dist/cli/commands/log/cleaner.d.ts +37 -0
- package/dist/cli/commands/log/cleaner.d.ts.map +1 -0
- package/dist/cli/commands/log/cleaner.js +218 -0
- package/dist/cli/commands/log/cleaner.js.map +1 -0
- package/dist/cli/commands/log/filter.d.ts +55 -0
- package/dist/cli/commands/log/filter.d.ts.map +1 -0
- package/dist/cli/commands/log/filter.js +128 -0
- package/dist/cli/commands/log/filter.js.map +1 -0
- package/dist/cli/commands/log/follower.d.ts +36 -0
- package/dist/cli/commands/log/follower.d.ts.map +1 -0
- package/dist/cli/commands/log/follower.js +151 -0
- package/dist/cli/commands/log/follower.js.map +1 -0
- package/dist/cli/commands/log/formatter.d.ts +76 -0
- package/dist/cli/commands/log/formatter.d.ts.map +1 -0
- package/dist/cli/commands/log/formatter.js +261 -0
- package/dist/cli/commands/log/formatter.js.map +1 -0
- package/dist/cli/commands/log/index.d.ts +6 -0
- package/dist/cli/commands/log/index.d.ts.map +1 -0
- package/dist/cli/commands/log/index.js +400 -0
- package/dist/cli/commands/log/index.js.map +1 -0
- package/dist/cli/commands/log/parser.d.ts +20 -0
- package/dist/cli/commands/log/parser.d.ts.map +1 -0
- package/dist/cli/commands/log/parser.js +111 -0
- package/dist/cli/commands/log/parser.js.map +1 -0
- package/dist/cli/commands/log/reader.d.ts +66 -0
- package/dist/cli/commands/log/reader.d.ts.map +1 -0
- package/dist/cli/commands/log/reader.js +364 -0
- package/dist/cli/commands/log/reader.js.map +1 -0
- package/dist/cli/commands/log/types.d.ts +100 -0
- package/dist/cli/commands/log/types.d.ts.map +1 -0
- package/dist/cli/commands/log/types.js +5 -0
- package/dist/cli/commands/log/types.js.map +1 -0
- package/dist/cli/commands/profile/display.d.ts +1 -0
- package/dist/cli/commands/profile/display.d.ts.map +1 -1
- package/dist/cli/commands/profile/display.js +10 -2
- package/dist/cli/commands/profile/display.js.map +1 -1
- package/dist/cli/commands/profile/index.js +58 -22
- package/dist/cli/commands/profile/index.js.map +1 -1
- package/dist/cli/commands/setup.d.ts.map +1 -1
- package/dist/cli/commands/setup.js +143 -24
- package/dist/cli/commands/setup.js.map +1 -1
- package/dist/cli/index.js +2 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/env/types.d.ts +10 -1
- package/dist/env/types.d.ts.map +1 -1
- package/dist/env/types.js.map +1 -1
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -1
- package/dist/providers/plugins/sso/session/SessionSyncer.d.ts +5 -0
- package/dist/providers/plugins/sso/session/SessionSyncer.d.ts.map +1 -1
- package/dist/providers/plugins/sso/session/SessionSyncer.js +102 -3
- package/dist/providers/plugins/sso/session/SessionSyncer.js.map +1 -1
- package/dist/providers/plugins/sso/session/processors/conversations/conversation-sync-processor.d.ts +0 -1
- package/dist/providers/plugins/sso/session/processors/conversations/conversation-sync-processor.d.ts.map +1 -1
- package/dist/providers/plugins/sso/session/processors/conversations/conversation-sync-processor.js +25 -48
- package/dist/providers/plugins/sso/session/processors/conversations/conversation-sync-processor.js.map +1 -1
- package/dist/providers/plugins/sso/session/processors/metrics/metrics-sync-processor.d.ts.map +1 -1
- package/dist/providers/plugins/sso/session/processors/metrics/metrics-sync-processor.js +8 -34
- package/dist/providers/plugins/sso/session/processors/metrics/metrics-sync-processor.js.map +1 -1
- package/dist/utils/config.d.ts +35 -8
- package/dist/utils/config.d.ts.map +1 -1
- package/dist/utils/config.js +243 -33
- package/dist/utils/config.js.map +1 -1
- package/dist/utils/logger.d.ts +8 -0
- package/dist/utils/logger.d.ts.map +1 -1
- package/dist/utils/logger.js +42 -0
- package/dist/utils/logger.js.map +1 -1
- package/dist/utils/native-installer.d.ts +1 -0
- package/dist/utils/native-installer.d.ts.map +1 -1
- package/dist/utils/native-installer.js +21 -7
- package/dist/utils/native-installer.js.map +1 -1
- package/package.json +2 -2
- package/dist/agents/plugins/claude/plugin/commands/memory-add.md +0 -325
- package/dist/agents/plugins/claude/plugin/commands/memory-init.md +0 -18
- package/dist/cli/commands/assistants/generators/claude-agent-generator.d.ts.map +0 -1
- package/dist/cli/commands/assistants/generators/claude-agent-generator.js.map +0 -1
- package/dist/cli/commands/assistants/list.d.ts +0 -11
- package/dist/cli/commands/assistants/list.d.ts.map +0 -1
- package/dist/cli/commands/assistants/list.js +0 -323
- package/dist/cli/commands/assistants/list.js.map +0 -1
- /package/dist/cli/commands/assistants/{generators → setup/generators}/claude-agent-generator.d.ts +0 -0
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mode Selection Prompt
|
|
3
|
+
*
|
|
4
|
+
* First screen - user chooses between Subagents, Skills, or Manual configuration
|
|
5
|
+
*/
|
|
6
|
+
import { ANSI, KEY, KEEP_ALIVE_INTERVAL, CONFIGURATION_CHOICE } from './constants.js';
|
|
7
|
+
import { renderModeSelectionUI } from './ui.js';
|
|
8
|
+
import { createModeSelectionActions } from './actions.js';
|
|
9
|
+
/**
|
|
10
|
+
* Initialize mode selection state
|
|
11
|
+
* Default selection is 'subagents'
|
|
12
|
+
*/
|
|
13
|
+
function initializeModeSelectionState() {
|
|
14
|
+
return {
|
|
15
|
+
selectedChoice: CONFIGURATION_CHOICE.SUBAGENTS, // Default to Subagents
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Prompt user to select configuration mode
|
|
20
|
+
* Returns the selected choice and whether it was cancelled
|
|
21
|
+
*/
|
|
22
|
+
export async function promptModeSelection() {
|
|
23
|
+
const state = initializeModeSelectionState();
|
|
24
|
+
return new Promise((resolve) => {
|
|
25
|
+
let keepAliveTimer = null;
|
|
26
|
+
/**
|
|
27
|
+
* Render UI to stdout
|
|
28
|
+
*/
|
|
29
|
+
function render() {
|
|
30
|
+
const output = ANSI.CLEAR_SCREEN + ANSI.HIDE_CURSOR + renderModeSelectionUI(state);
|
|
31
|
+
process.stdout.write(output);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Cleanup and restore terminal
|
|
35
|
+
*/
|
|
36
|
+
function cleanup() {
|
|
37
|
+
if (keepAliveTimer) {
|
|
38
|
+
clearInterval(keepAliveTimer);
|
|
39
|
+
keepAliveTimer = null;
|
|
40
|
+
}
|
|
41
|
+
process.stdin.setRawMode(false);
|
|
42
|
+
process.stdin.pause();
|
|
43
|
+
process.stdin.removeAllListeners('data');
|
|
44
|
+
process.stdout.write(ANSI.SHOW_CURSOR + ANSI.CLEAR_SCREEN);
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Resolve promise and cleanup
|
|
48
|
+
*/
|
|
49
|
+
function stop(cancelled, back = false) {
|
|
50
|
+
cleanup();
|
|
51
|
+
resolve({
|
|
52
|
+
choice: state.selectedChoice,
|
|
53
|
+
cancelled,
|
|
54
|
+
back,
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Start interactive mode
|
|
59
|
+
*/
|
|
60
|
+
function start() {
|
|
61
|
+
const actions = createModeSelectionActions(state, render, stop);
|
|
62
|
+
process.stdin.setRawMode(true);
|
|
63
|
+
process.stdin.resume();
|
|
64
|
+
process.stdin.setEncoding('utf8');
|
|
65
|
+
process.stdin.on('data', (key) => {
|
|
66
|
+
switch (key) {
|
|
67
|
+
case KEY.UP:
|
|
68
|
+
actions.handleArrowUp();
|
|
69
|
+
break;
|
|
70
|
+
case KEY.DOWN:
|
|
71
|
+
actions.handleArrowDown();
|
|
72
|
+
break;
|
|
73
|
+
case KEY.ENTER:
|
|
74
|
+
actions.handleEnter();
|
|
75
|
+
break;
|
|
76
|
+
case KEY.ESC:
|
|
77
|
+
actions.handleBack();
|
|
78
|
+
break;
|
|
79
|
+
case KEY.CTRL_C:
|
|
80
|
+
actions.handleCancel();
|
|
81
|
+
break;
|
|
82
|
+
default:
|
|
83
|
+
// Ignore other keys
|
|
84
|
+
break;
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
// Keep-alive timer to prevent process from exiting
|
|
88
|
+
keepAliveTimer = setInterval(() => { }, KEEP_ALIVE_INTERVAL);
|
|
89
|
+
render();
|
|
90
|
+
}
|
|
91
|
+
start();
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=selection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selection.js","sourceRoot":"","sources":["../../../../../../src/cli/commands/assistants/setup/configuration/selection.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACtF,OAAO,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAC;AAE1D;;;GAGG;AACH,SAAS,4BAA4B;IACpC,OAAO;QACN,cAAc,EAAE,oBAAoB,CAAC,SAAS,EAAE,uBAAuB;KACvE,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB;IACxC,MAAM,KAAK,GAAG,4BAA4B,EAAE,CAAC;IAE7C,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC9B,IAAI,cAAc,GAA0B,IAAI,CAAC;QAEjD;;WAEG;QACH,SAAS,MAAM;YACd,MAAM,MAAM,GAAG,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,WAAW,GAAG,qBAAqB,CAAC,KAAK,CAAC,CAAC;YACnF,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QAC9B,CAAC;QAED;;WAEG;QACH,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P,KAAK,GAAG,CAAC,GAAG;wBACX,OAAO,CAAC,UAAU,EAAE,CAAC;wBACrB,MAAM;oBACP,KAAK,GAAG,CAAC,MAAM;wBACd,OAAO,CAAC,YAAY,EAAE,CAAC;wBACvB,MAAM;oBACP;wBACC,oBAAoB;wBACpB,MAAM;gBACR,CAAC;YACF,CAAC,CAAC,CAAC;YAEH,mDAAmD;YACnD,cAAc,GAAG,WAAW,CAAC,GAAG,EAAE,GAAE,CAAC,EAAE,mBAAmB,CAAC,CAAC;YAE5D,MAAM,EAAE,CAAC;QACV,CAAC;QAED,KAAK,EAAE,CAAC;IACT,CAAC,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration choice - determines flow
|
|
3
|
+
* - subagents: Bulk register all as agents
|
|
4
|
+
* - skills: Bulk register all as skills
|
|
5
|
+
* - manual: Individual configuration for each assistant
|
|
6
|
+
*/
|
|
7
|
+
export type ConfigurationChoice = 'subagents' | 'skills' | 'manual';
|
|
8
|
+
/**
|
|
9
|
+
* State for the mode selection UI
|
|
10
|
+
*/
|
|
11
|
+
export interface ModeSelectionState {
|
|
12
|
+
selectedChoice: ConfigurationChoice;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Result returned from the mode selection UI
|
|
16
|
+
*/
|
|
17
|
+
export interface ModeSelectionResult {
|
|
18
|
+
choice: ConfigurationChoice;
|
|
19
|
+
cancelled: boolean;
|
|
20
|
+
back: boolean;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../src/cli/commands/assistants/setup/configuration/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,MAAM,mBAAmB,GAAG,WAAW,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAEpE;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAClC,cAAc,EAAE,mBAAmB,CAAC;CACpC;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IACnC,MAAM,EAAE,mBAAmB,CAAC;IAC5B,SAAS,EAAE,OAAO,CAAC;IACnB,IAAI,EAAE,OAAO,CAAC;CACd"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../src/cli/commands/assistants/setup/configuration/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ui.d.ts","sourceRoot":"","sources":["../../../../../../src/cli/commands/assistants/setup/configuration/ui.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EAAE,kBAAkB,EAAuB,MAAM,YAAY,CAAC;AAiF1E;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,kBAAkB,GAAG,MAAM,CAevE"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* UI Rendering for Mode Selection
|
|
3
|
+
*/
|
|
4
|
+
import chalk from 'chalk';
|
|
5
|
+
import { CONFIGURATION_CHOICE, CONFIGURATION_CHOICE_LABELS, CONFIGURATION_CHOICE_DESCRIPTIONS, UI_TEXT } from './constants.js';
|
|
6
|
+
import { COLOR } from '../constants.js';
|
|
7
|
+
/**
|
|
8
|
+
* Build top line (purple separator)
|
|
9
|
+
*/
|
|
10
|
+
function buildTopLine() {
|
|
11
|
+
const width = 70;
|
|
12
|
+
return chalk.rgb(COLOR.PURPLE.r, COLOR.PURPLE.g, COLOR.PURPLE.b)('─'.repeat(width));
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Build title section
|
|
16
|
+
*/
|
|
17
|
+
function buildTitle() {
|
|
18
|
+
return chalk.rgb(COLOR.PURPLE.r, COLOR.PURPLE.g, COLOR.PURPLE.b).bold(UI_TEXT.TITLE);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Build subtitle section
|
|
22
|
+
*/
|
|
23
|
+
function buildSubtitle() {
|
|
24
|
+
return chalk.dim(UI_TEXT.SUBTITLE);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Build single choice option
|
|
28
|
+
*/
|
|
29
|
+
function buildChoiceOption(choice, isSelected, isCursor) {
|
|
30
|
+
const label = CONFIGURATION_CHOICE_LABELS[choice];
|
|
31
|
+
const description = CONFIGURATION_CHOICE_DESCRIPTIONS[choice];
|
|
32
|
+
// Radio button indicator
|
|
33
|
+
const radio = isSelected
|
|
34
|
+
? chalk.rgb(COLOR.PURPLE.r, COLOR.PURPLE.g, COLOR.PURPLE.b)('●')
|
|
35
|
+
: '○';
|
|
36
|
+
// Cursor indicator
|
|
37
|
+
const cursor = isCursor
|
|
38
|
+
? chalk.rgb(COLOR.PURPLE.r, COLOR.PURPLE.g, COLOR.PURPLE.b)('› ')
|
|
39
|
+
: ' ';
|
|
40
|
+
// Label formatting
|
|
41
|
+
const formattedLabel = isCursor
|
|
42
|
+
? chalk.rgb(COLOR.PURPLE.r, COLOR.PURPLE.g, COLOR.PURPLE.b).bold(label)
|
|
43
|
+
: chalk.white(label);
|
|
44
|
+
return `${cursor}${radio} ${formattedLabel}\n ${chalk.dim(description)}`;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Build choices list
|
|
48
|
+
*/
|
|
49
|
+
function buildChoicesList(state) {
|
|
50
|
+
const choices = [
|
|
51
|
+
CONFIGURATION_CHOICE.SUBAGENTS,
|
|
52
|
+
CONFIGURATION_CHOICE.SKILLS,
|
|
53
|
+
CONFIGURATION_CHOICE.MANUAL,
|
|
54
|
+
];
|
|
55
|
+
const lines = choices.map((choice) => {
|
|
56
|
+
const isCursor = state.selectedChoice === choice;
|
|
57
|
+
const isSelected = state.selectedChoice === choice;
|
|
58
|
+
return buildChoiceOption(choice, isSelected, isCursor);
|
|
59
|
+
});
|
|
60
|
+
return lines.join('\n\n');
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Build instructions line
|
|
64
|
+
*/
|
|
65
|
+
function buildInstructions() {
|
|
66
|
+
return chalk.dim(UI_TEXT.INSTRUCTIONS);
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Render full UI
|
|
70
|
+
*/
|
|
71
|
+
export function renderModeSelectionUI(state) {
|
|
72
|
+
const parts = [
|
|
73
|
+
buildTopLine(),
|
|
74
|
+
buildTitle(),
|
|
75
|
+
'',
|
|
76
|
+
buildSubtitle(),
|
|
77
|
+
'',
|
|
78
|
+
buildChoicesList(state),
|
|
79
|
+
'',
|
|
80
|
+
buildTopLine(),
|
|
81
|
+
'',
|
|
82
|
+
buildInstructions(),
|
|
83
|
+
];
|
|
84
|
+
return parts.join('\n');
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=ui.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ui.js","sourceRoot":"","sources":["../../../../../../src/cli/commands/assistants/setup/configuration/ui.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,oBAAoB,EAAE,2BAA2B,EAAE,iCAAiC,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAC/H,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAExC;;GAEG;AACH,SAAS,YAAY;IACpB,MAAM,KAAK,GAAG,EAAE,CAAC;IACjB,OAAO,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;AACrF,CAAC;AAED;;GAEG;AACH,SAAS,UAAU;IAClB,OAAO,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,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,KAAK,IAAI,cAAc,OAAO,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE,CAAC;AAC3E,CAAC;AAED;;GAEG;AACH,SAAS,gBAAgB,CAAC,KAAyB;IAClD,MAAM,OAAO,GAA0B;QACtC,oBAAoB,CAAC,SAAS;QAC9B,oBAAoB,CAAC,MAAM;QAC3B,oBAAoB,CAAC,MAAM;KAC3B,CAAC;IAEF,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE;QACpC,MAAM,QAAQ,GAAG,KAAK,CAAC,cAAc,KAAK,MAAM,CAAC;QACjD,MAAM,UAAU,GAAG,KAAK,CAAC,cAAc,KAAK,MAAM,CAAC;QACnD,OAAO,iBAAiB,CAAC,MAAM,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC;IACxD,CAAC,CAAC,CAAC;IAEH,OAAO,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AAC3B,CAAC;AAED;;GAEG;AACH,SAAS,iBAAiB;IACzB,OAAO,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;AACxC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,qBAAqB,CAAC,KAAyB;IAC9D,MAAM,KAAK,GAAG;QACb,YAAY,EAAE;QACd,UAAU,EAAE;QACZ,EAAE;QACF,aAAa,EAAE;QACf,EAAE;QACF,gBAAgB,CAAC,KAAK,CAAC;QACvB,EAAE;QACF,YAAY,EAAE;QACd,EAAE;QACF,iBAAiB,EAAE;KACnB,CAAC;IAEF,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACzB,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared constants for setup command
|
|
3
|
+
*
|
|
4
|
+
* Constants used across selection, configuration, and summary modules
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Color palette used across all setup UI components
|
|
8
|
+
*/
|
|
9
|
+
export declare const COLOR: {
|
|
10
|
+
readonly PURPLE: {
|
|
11
|
+
readonly r: 177;
|
|
12
|
+
readonly g: 185;
|
|
13
|
+
readonly b: 249;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Action types for user interactions
|
|
18
|
+
*/
|
|
19
|
+
export declare const ACTION_TYPE: {
|
|
20
|
+
readonly CANCEL: "cancel";
|
|
21
|
+
readonly APPLY: "apply";
|
|
22
|
+
readonly UPDATE: "update";
|
|
23
|
+
readonly BACK: "back";
|
|
24
|
+
};
|
|
25
|
+
export type ActionType = typeof ACTION_TYPE[keyof typeof ACTION_TYPE];
|
|
26
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../src/cli/commands/assistants/setup/constants.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,eAAO,MAAM,KAAK;;;;;;CAER,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,WAAW;;;;;CAKd,CAAC;AAEX,MAAM,MAAM,UAAU,GAAG,OAAO,WAAW,CAAC,MAAM,OAAO,WAAW,CAAC,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared constants for setup command
|
|
3
|
+
*
|
|
4
|
+
* Constants used across selection, configuration, and summary modules
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Color palette used across all setup UI components
|
|
8
|
+
*/
|
|
9
|
+
export const COLOR = {
|
|
10
|
+
PURPLE: { r: 177, g: 185, b: 249 },
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Action types for user interactions
|
|
14
|
+
*/
|
|
15
|
+
export const ACTION_TYPE = {
|
|
16
|
+
CANCEL: 'cancel',
|
|
17
|
+
APPLY: 'apply',
|
|
18
|
+
UPDATE: 'update',
|
|
19
|
+
BACK: 'back',
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../src/cli/commands/assistants/setup/constants.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG;IACpB,MAAM,EAAE,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAW;CAClC,CAAC;AAEX;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG;IAC1B,MAAM,EAAE,QAAQ;IAChB,KAAK,EAAE,OAAO;IACd,MAAM,EAAE,QAAQ;IAChB,IAAI,EAAE,MAAM;CACH,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Data Layer
|
|
3
|
+
*
|
|
4
|
+
* Handles all data fetching for assistant selection
|
|
5
|
+
*/
|
|
6
|
+
import type { Assistant, AssistantBase, CodeMieClient } from 'codemie-sdk';
|
|
7
|
+
import type { ProviderProfile } from '../../../../env/types.js';
|
|
8
|
+
import type { SetupCommandOptions } from './index.js';
|
|
9
|
+
import { type PanelId } from './selection/constants.js';
|
|
10
|
+
export interface DataFetcherDependencies {
|
|
11
|
+
config: ProviderProfile;
|
|
12
|
+
client: CodeMieClient;
|
|
13
|
+
options: SetupCommandOptions;
|
|
14
|
+
}
|
|
15
|
+
export interface FetchAssistantsParams {
|
|
16
|
+
scope: PanelId;
|
|
17
|
+
searchQuery?: string;
|
|
18
|
+
page?: number;
|
|
19
|
+
}
|
|
20
|
+
export interface FetchAssistantsResult {
|
|
21
|
+
data: (Assistant | AssistantBase)[];
|
|
22
|
+
total: number;
|
|
23
|
+
pages: number;
|
|
24
|
+
}
|
|
25
|
+
export interface DataFetcher {
|
|
26
|
+
fetchAssistants: (params: FetchAssistantsParams) => Promise<FetchAssistantsResult>;
|
|
27
|
+
fetchAssistantsByIds: (selectedIds: string[], existingAssistants: (Assistant | AssistantBase)[]) => Promise<(Assistant | AssistantBase)[]>;
|
|
28
|
+
}
|
|
29
|
+
export declare function createDataFetcher(deps: DataFetcherDependencies): DataFetcher;
|
|
30
|
+
//# sourceMappingURL=data.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../../../../../src/cli/commands/assistants/setup/data.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAuB,aAAa,EAAE,MAAM,aAAa,CAAC;AAChG,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,EAA+B,KAAK,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAGrF,MAAM,WAAW,uBAAuB;IACtC,MAAM,EAAE,eAAe,CAAC;IACxB,MAAM,EAAE,aAAa,CAAC;IACtB,OAAO,EAAE,mBAAmB,CAAC;CAC9B;AAED,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE,OAAO,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,CAAC,SAAS,GAAG,aAAa,CAAC,EAAE,CAAC;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,WAAW;IAC1B,eAAe,EAAE,CAAC,MAAM,EAAE,qBAAqB,KAAK,OAAO,CAAC,qBAAqB,CAAC,CAAC;IACnF,oBAAoB,EAAE,CACpB,WAAW,EAAE,MAAM,EAAE,EACrB,kBAAkB,EAAE,CAAC,SAAS,GAAG,aAAa,CAAC,EAAE,KAC9C,OAAO,CAAC,CAAC,SAAS,GAAG,aAAa,CAAC,EAAE,CAAC,CAAC;CAC7C;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,uBAAuB,GAAG,WAAW,CA8I5E"}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Data Layer
|
|
3
|
+
*
|
|
4
|
+
* Handles all data fetching for assistant selection
|
|
5
|
+
*/
|
|
6
|
+
import { PANEL_ID, API_SCOPE, CONFIG } from './selection/constants.js';
|
|
7
|
+
import { logger } from '../../../../utils/logger.js';
|
|
8
|
+
export function createDataFetcher(deps) {
|
|
9
|
+
async function fetchAssistants(params) {
|
|
10
|
+
const { scope, searchQuery = '', page = 0 } = params;
|
|
11
|
+
logger.debug('[AssistantSelection] Fetching assistants', { scope, searchQuery, page });
|
|
12
|
+
if (scope === PANEL_ID.REGISTERED) {
|
|
13
|
+
const allData = fetchRegisteredFromConfig(searchQuery);
|
|
14
|
+
const total = allData.length;
|
|
15
|
+
const pages = Math.ceil(total / CONFIG.ITEMS_PER_PAGE);
|
|
16
|
+
const startIndex = page * CONFIG.ITEMS_PER_PAGE;
|
|
17
|
+
const endIndex = startIndex + CONFIG.ITEMS_PER_PAGE;
|
|
18
|
+
const data = allData.slice(startIndex, endIndex);
|
|
19
|
+
logger.debug('[AssistantSelection] Fetched registered assistants', { count: data.length, total, pages });
|
|
20
|
+
return { data, total, pages };
|
|
21
|
+
}
|
|
22
|
+
try {
|
|
23
|
+
const filters = {
|
|
24
|
+
search: searchQuery.trim(),
|
|
25
|
+
};
|
|
26
|
+
if (scope === PANEL_ID.MARKETPLACE) {
|
|
27
|
+
filters.marketplace = null;
|
|
28
|
+
}
|
|
29
|
+
const apiParams = {
|
|
30
|
+
page,
|
|
31
|
+
per_page: CONFIG.ITEMS_PER_PAGE,
|
|
32
|
+
minimal_response: false,
|
|
33
|
+
...(scope === PANEL_ID.PROJECT && { scope: API_SCOPE.VISIBLE_TO_USER }),
|
|
34
|
+
...(scope === PANEL_ID.MARKETPLACE && { scope: API_SCOPE.MARKETPLACE }),
|
|
35
|
+
filters
|
|
36
|
+
};
|
|
37
|
+
logger.debug('[AssistantSelection] Full API request params', {
|
|
38
|
+
scope,
|
|
39
|
+
apiParams: JSON.stringify(apiParams, null, 2)
|
|
40
|
+
});
|
|
41
|
+
const response = await deps.client.assistants.listPaginated(apiParams);
|
|
42
|
+
logger.debug('[AssistantSelection] Full raw API response', {
|
|
43
|
+
scope,
|
|
44
|
+
response: JSON.stringify(response, null, 2)
|
|
45
|
+
});
|
|
46
|
+
logger.debug('[AssistantSelection] Processed response', {
|
|
47
|
+
dataCount: response.data.length,
|
|
48
|
+
paginationTotal: response.pagination.total,
|
|
49
|
+
paginationPages: response.pagination.pages,
|
|
50
|
+
scope
|
|
51
|
+
});
|
|
52
|
+
return {
|
|
53
|
+
data: response.data,
|
|
54
|
+
total: response.pagination.total,
|
|
55
|
+
pages: response.pagination.pages
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
catch (error) {
|
|
59
|
+
throw error instanceof Error ? error : new Error(`Failed to fetch ${scope} assistants: ${error}`);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
function fetchRegisteredFromConfig(searchQuery) {
|
|
63
|
+
const registered = deps.config.codemieAssistants || [];
|
|
64
|
+
let assistants = registered.map(asst => ({
|
|
65
|
+
id: asst.id,
|
|
66
|
+
name: asst.name,
|
|
67
|
+
description: asst.description || '',
|
|
68
|
+
slug: asst.slug,
|
|
69
|
+
project: asst.project || ''
|
|
70
|
+
}));
|
|
71
|
+
if (searchQuery.trim()) {
|
|
72
|
+
const lowerQuery = searchQuery.toLowerCase();
|
|
73
|
+
assistants = assistants.filter(assistant => {
|
|
74
|
+
const project = ('project' in assistant ? assistant.project : '');
|
|
75
|
+
const slug = ('slug' in assistant ? assistant.slug : '');
|
|
76
|
+
return (assistant.name.toLowerCase().includes(lowerQuery) ||
|
|
77
|
+
assistant.description?.toLowerCase().includes(lowerQuery) ||
|
|
78
|
+
project.toLowerCase().includes(lowerQuery) ||
|
|
79
|
+
slug.toLowerCase().includes(lowerQuery));
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
return assistants;
|
|
83
|
+
}
|
|
84
|
+
async function fetchAssistantsByIds(selectedIds, existingAssistants) {
|
|
85
|
+
const existingMap = new Map(existingAssistants.map(a => [a.id, a]));
|
|
86
|
+
const idsToFetch = [];
|
|
87
|
+
// Identify which IDs need to be fetched
|
|
88
|
+
for (const id of selectedIds) {
|
|
89
|
+
if (!existingMap.has(id)) {
|
|
90
|
+
idsToFetch.push(id);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
// Fetch missing assistants
|
|
94
|
+
if (idsToFetch.length > 0) {
|
|
95
|
+
logger.debug('[AssistantSetup] Fetching missing assistant details', {
|
|
96
|
+
count: idsToFetch.length,
|
|
97
|
+
ids: idsToFetch
|
|
98
|
+
});
|
|
99
|
+
for (const id of idsToFetch) {
|
|
100
|
+
try {
|
|
101
|
+
const assistant = await deps.client.assistants.get(id);
|
|
102
|
+
existingMap.set(id, assistant);
|
|
103
|
+
logger.debug('[AssistantSetup] Fetched assistant', { id, name: assistant.name });
|
|
104
|
+
}
|
|
105
|
+
catch (error) {
|
|
106
|
+
logger.error('[AssistantSetup] Failed to fetch assistant', { id, error });
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
// Build result in requested order
|
|
111
|
+
const result = [];
|
|
112
|
+
for (const id of selectedIds) {
|
|
113
|
+
const assistant = existingMap.get(id);
|
|
114
|
+
if (assistant) {
|
|
115
|
+
result.push(assistant);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
return result;
|
|
119
|
+
}
|
|
120
|
+
return {
|
|
121
|
+
fetchAssistants,
|
|
122
|
+
fetchAssistantsByIds
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
//# sourceMappingURL=data.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data.js","sourceRoot":"","sources":["../../../../../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E,EAAE,KAAK,EAAE,CAAC,CAAC;gBAC5E,CAAC;YACH,CAAC;QACH,CAAC;QAED,kCAAkC;QAClC,MAAM,MAAM,GAAkC,EAAE,CAAC;QACjD,KAAK,MAAM,EAAE,IAAI,WAAW,EAAE,CAAC;YAC7B,MAAM,SAAS,GAAG,WAAW,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;YACtC,IAAI,SAAS,EAAE,CAAC;gBACd,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YACzB,CAAC;QACH,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,OAAO;QACL,eAAe;QACf,oBAAoB;KACrB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude-agent-generator.d.ts","sourceRoot":"","sources":["../../../../../../src/cli/commands/assistants/setup/generators/claude-agent-generator.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAG7C;;GAEG;AACH,wBAAgB,4BAA4B,CAAC,SAAS,EAAE,SAAS,GAAG,MAAM,CAezE;AAED;;GAEG;AACH,wBAAgB,2BAA2B,CAAC,SAAS,EAAE,SAAS,GAAG,MAAM,CAmCxE;AAWD;;;GAGG;AACH,wBAAsB,sBAAsB,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAsBhF;AAED;;;GAGG;AACH,wBAAsB,wBAAwB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAe1E"}
|
package/dist/cli/commands/assistants/{generators → setup/generators}/claude-agent-generator.js
RENAMED
|
@@ -8,16 +8,20 @@ import { promises as fs } from 'node:fs';
|
|
|
8
8
|
import path from 'node:path';
|
|
9
9
|
import os from 'node:os';
|
|
10
10
|
import dedent from 'dedent';
|
|
11
|
-
import { logger } from '
|
|
11
|
+
import { logger } from '../../../../../utils/logger.js';
|
|
12
12
|
/**
|
|
13
13
|
* Create Claude subagent metadata for frontmatter
|
|
14
14
|
*/
|
|
15
15
|
export function createClaudeSubagentMetadata(assistant) {
|
|
16
16
|
const description = assistant.description || `Interact with ${assistant.name}`;
|
|
17
|
+
const sanitizedDescription = description
|
|
18
|
+
.replace(/\n/g, ' ')
|
|
19
|
+
.replace(/"/g, '\\"')
|
|
20
|
+
.trim();
|
|
17
21
|
return dedent(`
|
|
18
22
|
---
|
|
19
23
|
name: ${assistant.slug}
|
|
20
|
-
description: ${
|
|
24
|
+
description: "${sanitizedDescription}"
|
|
21
25
|
tools: Read, Bash
|
|
22
26
|
model: inherit
|
|
23
27
|
---
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude-agent-generator.js","sourceRoot":"","sources":["../../../../../../src/cli/commands/assistants/setup/generators/claude-agent-generator.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAE3C;;GAEG;AACH,MAAM,UAAU,4BAA4B,CAAC,SAAoB;IAC/D,MAAM,WAAW,GAAG,SAAS,CAAC,WAAW,IAAI,iBAAiB,SAAS,CAAC,IAAI,EAAE,CAAC;IAC/E,MAAM,oBAAoB,GAAG,WAAW;SACrC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC;SACnB,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC;SACpB,IAAI,EAAE,CAAC;IAEV,OAAO,MAAM,CAAC;;YAEJ,SAAS,CAAC,IAAI;oBACN,oBAAoB;;;;GAIrC,CAAC,CAAC;AACL,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,2BAA2B,CAAC,SAAoB;IAC9D,MAA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AC,CAAC;IAEnD,MAAM,CAAC,KAAK,CAAC,4BAA4B,EAAE;QACzC,IAAI,EAAE,SAAS,CAAC,IAAI;QACpB,YAAY;KACb,CAAC,CAAC;AACL,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAAC,IAAY;IACzD,MAAM,YAAY,GAAG,mBAAmB,CAAC,IAAI,CAAC,CAAC;IAE/C,IAAI,CAAC;QACH,MAAM,EAAE,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;QAC9B,MAAM,CAAC,KAAK,CAAC,8BAA8B,EAAE;YAC3C,IAAI;YACJ,YAAY;SACb,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,CAAC,KAAK,CAAC,gDAAgD,EAAE;YAC7D,IAAI;YACJ,KAAK;SACN,CAAC,CAAC;IACL,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Assistant } from 'codemie-sdk';
|
|
2
|
+
/**
|
|
3
|
+
* Register an assistant as a Claude Code skill
|
|
4
|
+
* Creates: ~/.claude/skills/{slug}/SKILL.md
|
|
5
|
+
*/
|
|
6
|
+
export declare function registerClaudeSkill(assistant: Assistant): Promise<void>;
|
|
7
|
+
/**
|
|
8
|
+
* Unregister a Claude Code skill
|
|
9
|
+
* Removes: ~/.claude/skills/{slug}/
|
|
10
|
+
*/
|
|
11
|
+
export declare function unregisterClaudeSkill(slug: string): Promise<void>;
|
|
12
|
+
//# sourceMappingURL=claude-skill-generator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude-skill-generator.d.ts","sourceRoot":"","sources":["../../../../../../src/cli/commands/assistants/setup/generators/claude-skill-generator.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAoD7C;;;GAGG;AACH,wBAAsB,mBAAmB,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAiB7E;AAED;;;GAGG;AACH,wBAAsB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAkBvE"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import fs from 'fs/promises';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import os from 'os';
|
|
4
|
+
import dedent from 'dedent';
|
|
5
|
+
import { logger } from '../../../../../utils/logger.js';
|
|
6
|
+
/**
|
|
7
|
+
* Get the skills directory path for Claude Code
|
|
8
|
+
*/
|
|
9
|
+
function getSkillsDir() {
|
|
10
|
+
const homeDir = os.homedir();
|
|
11
|
+
return path.join(homeDir, '.claude', 'skills');
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Create YAML frontmatter for Claude Code skill file
|
|
15
|
+
*/
|
|
16
|
+
function createSkillMetadata(assistant) {
|
|
17
|
+
const slug = assistant.slug || assistant.id.toLowerCase().replace(/[^a-z0-9]+/g, '-');
|
|
18
|
+
return dedent `
|
|
19
|
+
---
|
|
20
|
+
name: ${slug}
|
|
21
|
+
description: ${assistant.description || assistant.name}
|
|
22
|
+
---
|
|
23
|
+
`;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Create full SKILL.md content for Claude Code
|
|
27
|
+
*/
|
|
28
|
+
function createSkillContent(assistant) {
|
|
29
|
+
const metadata = createSkillMetadata(assistant);
|
|
30
|
+
const name = assistant.name;
|
|
31
|
+
const description = assistant.description || assistant.name;
|
|
32
|
+
const assistantId = assistant.id;
|
|
33
|
+
return dedent `
|
|
34
|
+
${metadata}
|
|
35
|
+
|
|
36
|
+
# ${name}
|
|
37
|
+
|
|
38
|
+
${description}
|
|
39
|
+
|
|
40
|
+
## Instructions
|
|
41
|
+
|
|
42
|
+
Send the user's message to the ${name} assistant:
|
|
43
|
+
|
|
44
|
+
\`\`\`bash
|
|
45
|
+
codemie assistants chat "${assistantId}" "$ARGUMENTS"
|
|
46
|
+
\`\`\`
|
|
47
|
+
|
|
48
|
+
The assistant will process the request and return a response.
|
|
49
|
+
`;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Register an assistant as a Claude Code skill
|
|
53
|
+
* Creates: ~/.claude/skills/{slug}/SKILL.md
|
|
54
|
+
*/
|
|
55
|
+
export async function registerClaudeSkill(assistant) {
|
|
56
|
+
const slug = assistant.slug || assistant.id.toLowerCase().replace(/[^a-z0-9]+/g, '-');
|
|
57
|
+
const skillsDir = getSkillsDir();
|
|
58
|
+
const skillDir = path.join(skillsDir, slug);
|
|
59
|
+
const skillFile = path.join(skillDir, 'SKILL.md');
|
|
60
|
+
try {
|
|
61
|
+
await fs.mkdir(skillDir, { recursive: true });
|
|
62
|
+
const content = createSkillContent(assistant);
|
|
63
|
+
await fs.writeFile(skillFile, content, 'utf-8');
|
|
64
|
+
logger.debug(`Registered Claude skill: ${skillFile}`);
|
|
65
|
+
}
|
|
66
|
+
catch (error) {
|
|
67
|
+
logger.error(`Failed to register Claude skill for ${assistant.name}`, { error });
|
|
68
|
+
throw error;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Unregister a Claude Code skill
|
|
73
|
+
* Removes: ~/.claude/skills/{slug}/
|
|
74
|
+
*/
|
|
75
|
+
export async function unregisterClaudeSkill(slug) {
|
|
76
|
+
const skillsDir = getSkillsDir();
|
|
77
|
+
const skillDir = path.join(skillsDir, slug);
|
|
78
|
+
try {
|
|
79
|
+
try {
|
|
80
|
+
await fs.access(skillDir);
|
|
81
|
+
}
|
|
82
|
+
catch {
|
|
83
|
+
logger.debug(`Skill directory not found: ${skillDir}`);
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
await fs.rm(skillDir, { recursive: true, force: true });
|
|
87
|
+
logger.debug(`Unregistered Claude skill: ${skillDir}`);
|
|
88
|
+
}
|
|
89
|
+
catch (error) {
|
|
90
|
+
logger.error(`Failed to unregister Claude skill ${slug}`, { error });
|
|
91
|
+
throw error;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=claude-skill-generator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude-skill-generator.js","sourceRoot":"","sources":["../../../../../../src/cli/commands/assistants/setup/generators/claude-skill-generator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,aAAa,CAAC;AAC7B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAG3C;;GAEG;AACH,SAAS,YAAY;IACpB,MAAM,OAAO,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC;IAC7B,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;AAChD,CAAC;AAED;;GAEG;AACH,SAAS,mBAAmB,CAAC,SAAoB;IAChD,MAAM,IAAI,GAAG,SAAS,CAAC,IAAI,IAAI,SAAS,CAAC,EAAE,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,aAAa,EAAE,GAAG,CAAC,CAAC;IAEtF,OAAO,MAAM,CAAA;;UAEJ,IAAI;iBACG,SAAS,CAAC,WAAW,IAAI,SAAS,CAAC,IAAI;;EAEtD,CAAC;AACH,CAAC;AAED;;GAEG;AACH,SAAS,kBAAkB,CAAC,SAAoB;IAC/C,MAAM,QAAQ,GAAG,mBAAmB,CAAC,SAAS,CAAC,CAAC;IAChD,MAAM,IAAI,GAAG,SAAS,CAAC,IAAI,CAAC;IAC5B,MAAM,WAAW,GAAG,SAAS,CAAC,WAAW,IAAI,SAAS,CAAC,IAAI,CAAC;IAC5D,MAAM,WAAW,GAAG,SAAS,CAAC,EAAE,CAAC;IAEjC,OAAO,MAAM,CAAA;IACV,QAAQ;;MAEN,IAAI;;IAEN,WAAW;;;;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C3B,CAAC;QAAC,MAAM,CAAC;YACR,MAAM,CAAC,KAAK,CAAC,8BAA8B,QAAQ,EAAE,CAAC,CAAC;YACvD,OAAO;QACR,CAAC;QAED,MAAM,EAAE,CAAC,EAAE,CAAC,QAAQ,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;QACxD,MAAM,CAAC,KAAK,CAAC,8BAA8B,QAAQ,EAAE,CAAC,CAAC;IACxD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,MAAM,CAAC,KAAK,CAAC,qCAAqC,IAAI,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;QACrE,MAAM,KAAK,CAAC;IACb,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Registration Operations Module
|
|
3
|
+
*
|
|
4
|
+
* Handles registration/unregistration business logic
|
|
5
|
+
*/
|
|
6
|
+
import type { Assistant, AssistantBase } from 'codemie-sdk';
|
|
7
|
+
import type { CodemieAssistant } from '../../../../env/types.js';
|
|
8
|
+
import type { RegistrationMode } from '../../../../cli/commands/assistants/setup/manualConfiguration/types.js';
|
|
9
|
+
export interface RegistrationChanges {
|
|
10
|
+
toRegister: Assistant[];
|
|
11
|
+
toUnregister: CodemieAssistant[];
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Determine which assistants to register and unregister
|
|
15
|
+
*/
|
|
16
|
+
export declare function determineChanges(selectedIds: string[], allAssistants: (Assistant | AssistantBase)[], registeredAssistants: CodemieAssistant[]): RegistrationChanges;
|
|
17
|
+
/**
|
|
18
|
+
* Unregister an assistant
|
|
19
|
+
* Removes both Claude agent and skill files
|
|
20
|
+
*/
|
|
21
|
+
export declare function unregisterAssistant(assistant: CodemieAssistant): Promise<void>;
|
|
22
|
+
/**
|
|
23
|
+
* Register an assistant with specified registration mode
|
|
24
|
+
* @param mode - 'agent' (Claude agent only) or 'skill' (Claude skill only)
|
|
25
|
+
*/
|
|
26
|
+
export declare function registerAssistant(assistant: Assistant, mode?: RegistrationMode): Promise<CodemieAssistant | null>;
|
|
27
|
+
//# sourceMappingURL=helpers.d.ts.map
|