@moxxy/cli 0.0.12 → 0.1.1
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 +278 -112
- package/bin/moxxy +10 -0
- package/package.json +36 -53
- package/src/api-client.js +286 -0
- package/src/cli.js +349 -0
- package/src/commands/agent.js +413 -0
- package/src/commands/auth.js +326 -0
- package/src/commands/channel.js +285 -0
- package/src/commands/doctor.js +261 -0
- package/src/commands/events.js +80 -0
- package/src/commands/gateway.js +428 -0
- package/src/commands/heartbeat.js +145 -0
- package/src/commands/init.js +954 -0
- package/src/commands/mcp.js +278 -0
- package/src/commands/plugin.js +583 -0
- package/src/commands/provider.js +1934 -0
- package/src/commands/settings.js +224 -0
- package/src/commands/skill.js +125 -0
- package/src/commands/template.js +237 -0
- package/src/commands/uninstall.js +196 -0
- package/src/commands/update.js +406 -0
- package/src/commands/vault.js +219 -0
- package/src/help.js +392 -0
- package/src/lib/plugin-registry.js +98 -0
- package/src/platform.js +40 -0
- package/src/sse-client.js +79 -0
- package/src/tui/action-wizards.js +130 -0
- package/src/tui/app.jsx +859 -0
- package/src/tui/components/action-picker.jsx +86 -0
- package/src/tui/components/chat-panel.jsx +120 -0
- package/src/tui/components/footer.jsx +13 -0
- package/src/tui/components/header.jsx +45 -0
- package/src/tui/components/input-area.jsx +384 -0
- package/src/tui/components/messages/ask-message.jsx +13 -0
- package/src/tui/components/messages/assistant-message.jsx +165 -0
- package/src/tui/components/messages/channel-message.jsx +18 -0
- package/src/tui/components/messages/event-message.jsx +22 -0
- package/src/tui/components/messages/hive-status.jsx +34 -0
- package/src/tui/components/messages/skill-message.jsx +31 -0
- package/src/tui/components/messages/system-message.jsx +12 -0
- package/src/tui/components/messages/thinking.jsx +25 -0
- package/src/tui/components/messages/tool-group.jsx +62 -0
- package/src/tui/components/messages/tool-message.jsx +66 -0
- package/src/tui/components/messages/user-message.jsx +12 -0
- package/src/tui/components/model-picker.jsx +138 -0
- package/src/tui/components/multiline-input.jsx +72 -0
- package/src/tui/events-handler.js +730 -0
- package/src/tui/helpers.js +59 -0
- package/src/tui/hooks/use-command-handler.js +451 -0
- package/src/tui/index.jsx +55 -0
- package/src/tui/input-utils.js +26 -0
- package/src/tui/markdown-renderer.js +66 -0
- package/src/tui/mcp-wizard.js +136 -0
- package/src/tui/model-picker.js +174 -0
- package/src/tui/slash-commands.js +26 -0
- package/src/tui/store.js +12 -0
- package/src/tui/theme.js +17 -0
- package/src/ui.js +109 -0
- package/bin/moxxy.js +0 -2
- package/dist/chunk-23LZYKQ6.mjs +0 -1131
- package/dist/chunk-2FZEA3NG.mjs +0 -457
- package/dist/chunk-3KDPLS22.mjs +0 -1131
- package/dist/chunk-3QRJTRBT.mjs +0 -1102
- package/dist/chunk-6DZX6EAA.mjs +0 -37
- package/dist/chunk-A4WRDUNY.mjs +0 -1242
- package/dist/chunk-C46NSEKG.mjs +0 -211
- package/dist/chunk-CAUXONEF.mjs +0 -1131
- package/dist/chunk-CPL5V56X.mjs +0 -1131
- package/dist/chunk-CTBVTTBG.mjs +0 -440
- package/dist/chunk-FHHLXTEZ.mjs +0 -1121
- package/dist/chunk-FXY3GPVA.mjs +0 -1126
- package/dist/chunk-GSNMMI3H.mjs +0 -530
- package/dist/chunk-HHOAOGUS.mjs +0 -1242
- package/dist/chunk-ITBO7BKI.mjs +0 -1243
- package/dist/chunk-J33O35WX.mjs +0 -532
- package/dist/chunk-N5JTPB6U.mjs +0 -820
- package/dist/chunk-NGVL4Q5C.mjs +0 -1102
- package/dist/chunk-Q2OCMNYI.mjs +0 -1131
- package/dist/chunk-QDVRLN6D.mjs +0 -1121
- package/dist/chunk-QO2JONHP.mjs +0 -1131
- package/dist/chunk-RVAPILHA.mjs +0 -1242
- package/dist/chunk-S7YBOV7E.mjs +0 -1131
- package/dist/chunk-SHIG6Y5L.mjs +0 -1074
- package/dist/chunk-SOFST2PV.mjs +0 -1242
- package/dist/chunk-SUNUYS6G.mjs +0 -1243
- package/dist/chunk-TMZWETMH.mjs +0 -1242
- package/dist/chunk-TYD7NMMI.mjs +0 -581
- package/dist/chunk-TYQ3YS42.mjs +0 -1068
- package/dist/chunk-UALWCJ7F.mjs +0 -1131
- package/dist/chunk-UQZKODNW.mjs +0 -1124
- package/dist/chunk-USC6R2ON.mjs +0 -1242
- package/dist/chunk-W32EQCVC.mjs +0 -823
- package/dist/chunk-WMB5ENMC.mjs +0 -1242
- package/dist/chunk-WNHA5JAP.mjs +0 -1242
- package/dist/cli-2AIWTL6F.mjs +0 -8
- package/dist/cli-2QKJ5UUL.mjs +0 -8
- package/dist/cli-4RIS6DQX.mjs +0 -8
- package/dist/cli-5RH4VBBL.mjs +0 -7
- package/dist/cli-7MK4YGOP.mjs +0 -7
- package/dist/cli-B4KH6MZI.mjs +0 -8
- package/dist/cli-CGO2LZ6Z.mjs +0 -8
- package/dist/cli-CVP26EL2.mjs +0 -8
- package/dist/cli-DDRVVNAV.mjs +0 -8
- package/dist/cli-E7U56QVQ.mjs +0 -8
- package/dist/cli-EQNRMLL3.mjs +0 -8
- package/dist/cli-F5RUHHH4.mjs +0 -8
- package/dist/cli-LX6FFSEF.mjs +0 -8
- package/dist/cli-LY74GWKR.mjs +0 -6
- package/dist/cli-MAT3ZJHI.mjs +0 -8
- package/dist/cli-NJXXTQYF.mjs +0 -8
- package/dist/cli-O4ZGFAZG.mjs +0 -8
- package/dist/cli-ORVLI3UQ.mjs +0 -8
- package/dist/cli-PV43ZVKA.mjs +0 -8
- package/dist/cli-REVD6ISM.mjs +0 -8
- package/dist/cli-TBX76KQX.mjs +0 -8
- package/dist/cli-THCGF7SQ.mjs +0 -8
- package/dist/cli-TLX5ENVM.mjs +0 -8
- package/dist/cli-TMNI5ZYE.mjs +0 -8
- package/dist/cli-TNJHCBQA.mjs +0 -6
- package/dist/cli-TUX22CZP.mjs +0 -8
- package/dist/cli-XJVH7EEP.mjs +0 -8
- package/dist/cli-XXOW4VXJ.mjs +0 -8
- package/dist/cli-XZ5RESNB.mjs +0 -6
- package/dist/cli-YCBYZ76Q.mjs +0 -8
- package/dist/cli-ZLMQCU7X.mjs +0 -8
- package/dist/dist-2VGKJRBH.mjs +0 -6820
- package/dist/dist-37BNX4QG.mjs +0 -7081
- package/dist/dist-7LTHRYKA.mjs +0 -11569
- package/dist/dist-7XJPQW5C.mjs +0 -6950
- package/dist/dist-AYMVOW7T.mjs +0 -7123
- package/dist/dist-BHUWCDRS.mjs +0 -7132
- package/dist/dist-FAXRJMEN.mjs +0 -6812
- package/dist/dist-HQGANM3P.mjs +0 -6976
- package/dist/dist-KATLOZQV.mjs +0 -7054
- package/dist/dist-KLSB6YHV.mjs +0 -6964
- package/dist/dist-LKIOZQ42.mjs +0 -17
- package/dist/dist-UYA4RJUH.mjs +0 -2792
- package/dist/dist-ZYHCBILM.mjs +0 -6993
- package/dist/index.d.mts +0 -23
- package/dist/index.d.ts +0 -23
- package/dist/index.js +0 -25531
- package/dist/index.mjs +0 -18
- package/dist/src-APP5P3UD.mjs +0 -1386
- package/dist/src-D5HMDDVE.mjs +0 -1324
- package/dist/src-EK3WD4AU.mjs +0 -1327
- package/dist/src-LSZFLMFN.mjs +0 -1400
- package/dist/src-T77DFTFP.mjs +0 -1407
- package/dist/src-WIOCZRAC.mjs +0 -1397
- package/dist/src-YK6CHCMW.mjs +0 -1400
package/src/platform.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Platform-aware helpers for shell profile instructions.
|
|
3
|
+
*/
|
|
4
|
+
import { platform } from 'node:os';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Returns a shell instruction to export an environment variable.
|
|
8
|
+
* - Unix: `export NAME="value"`
|
|
9
|
+
* - Windows: `[Environment]::SetEnvironmentVariable("NAME", "value", "User")`
|
|
10
|
+
*/
|
|
11
|
+
export function shellExportInstruction(name, value) {
|
|
12
|
+
if (platform() === 'win32') {
|
|
13
|
+
return `[Environment]::SetEnvironmentVariable("${name}", "${value}", "User")`;
|
|
14
|
+
}
|
|
15
|
+
return `export ${name}="${value}"`;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Returns a shell instruction to unset an environment variable.
|
|
20
|
+
* - Unix: `unset NAME`
|
|
21
|
+
* - Windows: `[Environment]::SetEnvironmentVariable("NAME", $null, "User")`
|
|
22
|
+
*/
|
|
23
|
+
export function shellUnsetInstruction(name) {
|
|
24
|
+
if (platform() === 'win32') {
|
|
25
|
+
return `[Environment]::SetEnvironmentVariable("${name}", $null, "User")`;
|
|
26
|
+
}
|
|
27
|
+
return `unset ${name}`;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Returns the name of the shell profile file for the current platform.
|
|
32
|
+
* - Unix: `~/.zshrc or ~/.bashrc`
|
|
33
|
+
* - Windows: `PowerShell $PROFILE`
|
|
34
|
+
*/
|
|
35
|
+
export function shellProfileName() {
|
|
36
|
+
if (platform() === 'win32') {
|
|
37
|
+
return 'PowerShell $PROFILE';
|
|
38
|
+
}
|
|
39
|
+
return '~/.zshrc or ~/.bashrc';
|
|
40
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SSE stream reader for event tailing.
|
|
3
|
+
* Uses native fetch with streaming reader.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export function buildSseUrl(baseUrl, filters) {
|
|
7
|
+
const url = new URL('/v1/events/stream', baseUrl);
|
|
8
|
+
for (const [k, v] of Object.entries(filters)) {
|
|
9
|
+
if (v) url.searchParams.set(k, v);
|
|
10
|
+
}
|
|
11
|
+
return url.toString();
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function parseSseEvent(line) {
|
|
15
|
+
if (line.startsWith('data: ')) {
|
|
16
|
+
return JSON.parse(line.slice(6));
|
|
17
|
+
}
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function createSseClient(baseUrl, token, filters) {
|
|
22
|
+
const url = buildSseUrl(baseUrl, filters);
|
|
23
|
+
let controller = null;
|
|
24
|
+
|
|
25
|
+
return {
|
|
26
|
+
url,
|
|
27
|
+
token,
|
|
28
|
+
|
|
29
|
+
reconnect() {
|
|
30
|
+
if (controller) {
|
|
31
|
+
controller.abort();
|
|
32
|
+
}
|
|
33
|
+
controller = new AbortController();
|
|
34
|
+
return controller;
|
|
35
|
+
},
|
|
36
|
+
|
|
37
|
+
async *stream() {
|
|
38
|
+
controller = new AbortController();
|
|
39
|
+
const headers = {};
|
|
40
|
+
if (token) {
|
|
41
|
+
headers['authorization'] = `Bearer ${token}`;
|
|
42
|
+
}
|
|
43
|
+
const resp = await fetch(url, {
|
|
44
|
+
headers,
|
|
45
|
+
signal: controller.signal,
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
if (!resp.ok) {
|
|
49
|
+
throw new Error(`SSE connection failed: HTTP ${resp.status}`);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const reader = resp.body.getReader();
|
|
53
|
+
const decoder = new TextDecoder();
|
|
54
|
+
let buffer = '';
|
|
55
|
+
|
|
56
|
+
try {
|
|
57
|
+
while (true) {
|
|
58
|
+
const { done, value } = await reader.read();
|
|
59
|
+
if (done) break;
|
|
60
|
+
|
|
61
|
+
buffer += decoder.decode(value, { stream: true });
|
|
62
|
+
const lines = buffer.split('\n');
|
|
63
|
+
buffer = lines.pop() || '';
|
|
64
|
+
|
|
65
|
+
for (const line of lines) {
|
|
66
|
+
const event = parseSseEvent(line);
|
|
67
|
+
if (event) yield event;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
} finally {
|
|
71
|
+
reader.releaseLock();
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
|
|
75
|
+
disconnect() {
|
|
76
|
+
controller?.abort();
|
|
77
|
+
},
|
|
78
|
+
};
|
|
79
|
+
}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
export function createVaultSetWizard() {
|
|
2
|
+
return {
|
|
3
|
+
flow: 'vault-set',
|
|
4
|
+
step: 'key',
|
|
5
|
+
values: {},
|
|
6
|
+
};
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function createVaultRemoveWizard() {
|
|
10
|
+
return {
|
|
11
|
+
flow: 'vault-remove',
|
|
12
|
+
step: 'key',
|
|
13
|
+
values: {},
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function buildVaultRemovePickerItems(secrets) {
|
|
18
|
+
return (Array.isArray(secrets) ? secrets : []).map(secret => ({
|
|
19
|
+
label: secret.key_name || secret.backend_key || secret.id || 'unknown',
|
|
20
|
+
description: [
|
|
21
|
+
secret.backend_key ? `backend=${secret.backend_key}` : null,
|
|
22
|
+
secret.policy_label ? `[${secret.policy_label}]` : null,
|
|
23
|
+
].filter(Boolean).join(' '),
|
|
24
|
+
command: `/vault remove ${secret.key_name}`,
|
|
25
|
+
}));
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function createTemplateAssignWizard() {
|
|
29
|
+
return {
|
|
30
|
+
flow: 'template-assign',
|
|
31
|
+
step: 'slug',
|
|
32
|
+
values: {},
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export function getActionWizardPrompt(wizard) {
|
|
37
|
+
switch (wizard.flow) {
|
|
38
|
+
case 'vault-set':
|
|
39
|
+
return wizard.step === 'key'
|
|
40
|
+
? {
|
|
41
|
+
title: 'Set Vault Secret',
|
|
42
|
+
label: 'Secret Key',
|
|
43
|
+
placeholder: 'OPENAI_API_KEY',
|
|
44
|
+
}
|
|
45
|
+
: {
|
|
46
|
+
title: 'Set Vault Secret',
|
|
47
|
+
label: 'Secret Value',
|
|
48
|
+
placeholder: 'sk-...',
|
|
49
|
+
};
|
|
50
|
+
case 'vault-remove':
|
|
51
|
+
return {
|
|
52
|
+
title: 'Remove Vault Secret',
|
|
53
|
+
label: 'Secret Key',
|
|
54
|
+
placeholder: 'OPENAI_API_KEY',
|
|
55
|
+
};
|
|
56
|
+
case 'template-assign':
|
|
57
|
+
return {
|
|
58
|
+
title: 'Assign Template',
|
|
59
|
+
label: 'Template Slug',
|
|
60
|
+
placeholder: 'builder',
|
|
61
|
+
};
|
|
62
|
+
default:
|
|
63
|
+
return {
|
|
64
|
+
title: 'Input',
|
|
65
|
+
label: 'Value',
|
|
66
|
+
placeholder: '',
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export function submitActionWizardValue(wizard, rawValue) {
|
|
72
|
+
const value = String(rawValue || '').trim();
|
|
73
|
+
if (!value) {
|
|
74
|
+
return {
|
|
75
|
+
done: false,
|
|
76
|
+
wizard,
|
|
77
|
+
error: 'Value cannot be empty.',
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
if (wizard.flow === 'vault-set' && wizard.step === 'key') {
|
|
82
|
+
return {
|
|
83
|
+
done: false,
|
|
84
|
+
wizard: {
|
|
85
|
+
...wizard,
|
|
86
|
+
step: 'value',
|
|
87
|
+
values: { ...wizard.values, key_name: value },
|
|
88
|
+
},
|
|
89
|
+
error: null,
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
if (wizard.flow === 'vault-set' && wizard.step === 'value') {
|
|
94
|
+
return {
|
|
95
|
+
done: true,
|
|
96
|
+
payload: {
|
|
97
|
+
key_name: wizard.values.key_name,
|
|
98
|
+
backend_key: wizard.values.key_name,
|
|
99
|
+
value,
|
|
100
|
+
},
|
|
101
|
+
error: null,
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
if (wizard.flow === 'vault-remove') {
|
|
106
|
+
return {
|
|
107
|
+
done: true,
|
|
108
|
+
payload: {
|
|
109
|
+
key_name: value,
|
|
110
|
+
},
|
|
111
|
+
error: null,
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
if (wizard.flow === 'template-assign') {
|
|
116
|
+
return {
|
|
117
|
+
done: true,
|
|
118
|
+
payload: {
|
|
119
|
+
slug: value,
|
|
120
|
+
},
|
|
121
|
+
error: null,
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
return {
|
|
126
|
+
done: false,
|
|
127
|
+
wizard,
|
|
128
|
+
error: 'Unsupported wizard flow.',
|
|
129
|
+
};
|
|
130
|
+
}
|