aemeathcli 1.0.9 → 1.0.11
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/LICENSE +21 -0
- package/README.md +609 -608
- package/dist/App-YAHJUWCX.js +4274 -0
- package/dist/App-YAHJUWCX.js.map +1 -0
- package/dist/agent-store/architect.md +32 -0
- package/dist/agent-store/debugger.md +32 -0
- package/dist/agent-store/developer.md +29 -0
- package/dist/agent-store/documenter.md +30 -0
- package/dist/agent-store/researcher.md +31 -0
- package/dist/agent-store/reviewer.md +28 -0
- package/dist/agent-store/supervisor.md +37 -0
- package/dist/agent-store/tester.md +30 -0
- package/dist/api-key-fallback-UN3TJEOO.js +11 -0
- package/dist/{api-key-fallback-YQQBOQIL.js.map → api-key-fallback-UN3TJEOO.js.map} +1 -1
- package/dist/auth-status-EIM5A5KL.js +13 -0
- package/dist/auth-status-EIM5A5KL.js.map +1 -0
- package/dist/{chunk-UY2SYSEZ.js → chunk-25UNNEHN.js} +32 -103
- package/dist/chunk-25UNNEHN.js.map +1 -0
- package/dist/{chunk-CYQNBB25.js → chunk-2GKOK6T7.js} +28 -5
- package/dist/chunk-2GKOK6T7.js.map +1 -0
- package/dist/{chunk-MFBHNWGV.js → chunk-2LF7ALGR.js} +12 -20
- package/dist/chunk-2LF7ALGR.js.map +1 -0
- package/dist/{chunk-H66O5Z2V.js → chunk-2NWNIKBK.js} +42 -7
- package/dist/chunk-2NWNIKBK.js.map +1 -0
- package/dist/chunk-3TSPZRGM.js +26 -0
- package/dist/chunk-3TSPZRGM.js.map +1 -0
- package/dist/{chunk-ZGOHARPV.js → chunk-473JN6M5.js} +2 -2
- package/dist/chunk-473JN6M5.js.map +1 -0
- package/dist/{chunk-IYW62KKR.js → chunk-5XFSV6PF.js} +66 -23
- package/dist/chunk-5XFSV6PF.js.map +1 -0
- package/dist/{chunk-HCIHOHLX.js → chunk-62HSGYQD.js} +2 -2
- package/dist/chunk-62HSGYQD.js.map +1 -0
- package/dist/{chunk-I5PZ4JTS.js → chunk-6GUD7QIM.js} +4 -4
- package/dist/chunk-6GUD7QIM.js.map +1 -0
- package/dist/{chunk-4IJD72YB.js → chunk-AQ23TYSQ.js} +7 -7
- package/dist/chunk-AQ23TYSQ.js.map +1 -0
- package/dist/{chunk-NBR3GHMT.js → chunk-BY4DAKUU.js} +39 -7
- package/dist/chunk-BY4DAKUU.js.map +1 -0
- package/dist/chunk-CC7MGWYY.js +12 -0
- package/dist/chunk-CC7MGWYY.js.map +1 -0
- package/dist/chunk-CTFZTARK.js +155 -0
- package/dist/chunk-CTFZTARK.js.map +1 -0
- package/dist/chunk-FIC7AK4Q.js +232 -0
- package/dist/chunk-FIC7AK4Q.js.map +1 -0
- package/dist/chunk-GU33WKPG.js +140 -0
- package/dist/chunk-GU33WKPG.js.map +1 -0
- package/dist/{chunk-VUG4IZ7J.js → chunk-H2SYKIMI.js} +10 -10
- package/dist/chunk-H2SYKIMI.js.map +1 -0
- package/dist/{chunk-JAXXTYID.js → chunk-HEKFAKVH.js} +2 -2
- package/dist/chunk-HEKFAKVH.js.map +1 -0
- package/dist/chunk-IARA5XYP.js +186 -0
- package/dist/chunk-IARA5XYP.js.map +1 -0
- package/dist/{chunk-HMJRPNPZ.js → chunk-LCYH4T6N.js} +95 -23
- package/dist/chunk-LCYH4T6N.js.map +1 -0
- package/dist/{chunk-CARHU3DO.js → chunk-LDVY5ELP.js} +66 -18
- package/dist/chunk-LDVY5ELP.js.map +1 -0
- package/dist/chunk-OCJPQFOR.js +88 -0
- package/dist/chunk-OCJPQFOR.js.map +1 -0
- package/dist/chunk-ODBY7S4X.js +141 -0
- package/dist/chunk-ODBY7S4X.js.map +1 -0
- package/dist/{chunk-DAHGLHNR.js → chunk-ONQ4WCUI.js} +7 -142
- package/dist/chunk-ONQ4WCUI.js.map +1 -0
- package/dist/{chunk-WPP3PEDE.js → chunk-P5TKZM3T.js} +32 -107
- package/dist/chunk-P5TKZM3T.js.map +1 -0
- package/dist/{chunk-ASGRGXYK.js → chunk-P66WDACW.js} +23 -22
- package/dist/chunk-P66WDACW.js.map +1 -0
- package/dist/{chunk-LSOYPSAT.js → chunk-QCRK4QEL.js} +4 -4
- package/dist/chunk-QCRK4QEL.js.map +1 -0
- package/dist/{chunk-YL5XFHR3.js → chunk-ROJPFPJ7.js} +2 -2
- package/dist/chunk-ROJPFPJ7.js.map +1 -0
- package/dist/chunk-RP2TAL3J.js +71 -0
- package/dist/chunk-RP2TAL3J.js.map +1 -0
- package/dist/{chunk-6PDJ45T4.js → chunk-RYOB3TLZ.js} +51 -26
- package/dist/chunk-RYOB3TLZ.js.map +1 -0
- package/dist/{chunk-Y5XVD2CD.js → chunk-SOQFMNQC.js} +110 -83
- package/dist/chunk-SOQFMNQC.js.map +1 -0
- package/dist/{chunk-TEVZS4FA.js → chunk-TDFTX32B.js} +16 -9
- package/dist/chunk-TDFTX32B.js.map +1 -0
- package/dist/chunk-VBLLDY4R.js +38 -0
- package/dist/chunk-VBLLDY4R.js.map +1 -0
- package/dist/{chunk-CGEV3ARR.js → chunk-VJNQJALF.js} +4 -4
- package/dist/chunk-VJNQJALF.js.map +1 -0
- package/dist/chunk-WAYSJMPS.js +26 -0
- package/dist/chunk-WAYSJMPS.js.map +1 -0
- package/dist/chunk-WC72BRHR.js +241 -0
- package/dist/chunk-WC72BRHR.js.map +1 -0
- package/dist/{chunk-MXZSI3AY.js → chunk-YPFOE2QJ.js} +43 -11
- package/dist/chunk-YPFOE2QJ.js.map +1 -0
- package/dist/claude-adapter-6P4SJH7P.js +7 -0
- package/dist/{claude-adapter-QMLFMSP3.js.map → claude-adapter-6P4SJH7P.js.map} +1 -1
- package/dist/{claude-login-5WELXPKT.js → claude-login-IS5WTBMP.js} +10 -10
- package/dist/claude-login-IS5WTBMP.js.map +1 -0
- package/dist/cli.js +371 -172
- package/dist/cli.js.map +1 -1
- package/dist/{codex-login-DDJBCT43.js → codex-login-GMPF64MR.js} +18 -17
- package/dist/codex-login-GMPF64MR.js.map +1 -0
- package/dist/config-store-POB6I37G.js +7 -0
- package/dist/{config-store-W6FBCQAQ.js.map → config-store-POB6I37G.js.map} +1 -1
- package/dist/conversation-store-PRBHWQMJ.js +4 -0
- package/dist/conversation-store-PRBHWQMJ.js.map +1 -0
- package/dist/detect-providers-C4SVQHFF.js +4 -0
- package/dist/detect-providers-C4SVQHFF.js.map +1 -0
- package/dist/executor-RUX7VK3T.js +4 -0
- package/dist/{executor-6RIKIGXK.js.map → executor-RUX7VK3T.js.map} +1 -1
- package/dist/first-run-GDEVRFPO.js +230 -0
- package/dist/first-run-GDEVRFPO.js.map +1 -0
- package/dist/gemini-adapter-MV3U4QFH.js +7 -0
- package/dist/{gemini-adapter-6JIHZ7WI.js.map → gemini-adapter-MV3U4QFH.js.map} +1 -1
- package/dist/{gemini-login-YEPK6GGW.js → gemini-login-KE224MSW.js} +13 -14
- package/dist/gemini-login-KE224MSW.js.map +1 -0
- package/dist/index.d.ts +47 -17
- package/dist/index.js +86 -471
- package/dist/index.js.map +1 -1
- package/dist/input-history-MIOO3FIW.js +57 -0
- package/dist/input-history-MIOO3FIW.js.map +1 -0
- package/dist/kimi-adapter-UODMNX6K.js +6 -0
- package/dist/{kimi-adapter-JN4HFFHU.js.map → kimi-adapter-UODMNX6K.js.map} +1 -1
- package/dist/{kimi-login-ZR74MIY4.js → kimi-login-DNT5YBKX.js} +18 -17
- package/dist/kimi-login-DNT5YBKX.js.map +1 -0
- package/dist/logger-PLPDWACQ.js +3 -0
- package/dist/logger-PLPDWACQ.js.map +1 -0
- package/dist/model-discovery-O64ZWPX5.js +6 -0
- package/dist/model-discovery-O64ZWPX5.js.map +1 -0
- package/dist/native-cli-adapters-JMZX2C2C.js +8 -0
- package/dist/{native-cli-adapters-OLW3XX57.js.map → native-cli-adapters-JMZX2C2C.js.map} +1 -1
- package/dist/ollama-adapter-GE67BNSS.js +5 -0
- package/dist/{ollama-adapter-OJQ3FKWK.js.map → ollama-adapter-GE67BNSS.js.map} +1 -1
- package/dist/openai-adapter-SHPLK77L.js +7 -0
- package/dist/{openai-adapter-XU46EN7B.js.map → openai-adapter-SHPLK77L.js.map} +1 -1
- package/dist/pathResolver-A6IXQQFE.js +3 -0
- package/dist/pathResolver-A6IXQQFE.js.map +1 -0
- package/dist/profile-loader-TNAXBLDX.js +162 -0
- package/dist/profile-loader-TNAXBLDX.js.map +1 -0
- package/dist/registry-3NHVCXCZ.js +6 -0
- package/dist/{registry-H7B3AHPQ.js.map → registry-3NHVCXCZ.js.map} +1 -1
- package/dist/registry-7CQ3NCAD.js +5 -0
- package/dist/{registry-OYWYT7WL.js.map → registry-7CQ3NCAD.js.map} +1 -1
- package/dist/server-manager-DES23IBQ.js +5 -0
- package/dist/{server-manager-PTGBHCLS.js.map → server-manager-DES23IBQ.js.map} +1 -1
- package/dist/session-manager-EHD7GWM2.js +12 -0
- package/dist/{session-manager-NYB2RKMS.js.map → session-manager-EHD7GWM2.js.map} +1 -1
- package/dist/skills/built-in/code-review/SKILL.md +85 -0
- package/dist/skills/built-in/commit/SKILL.md +83 -0
- package/dist/skills/built-in/debug/SKILL.md +119 -0
- package/dist/skills/built-in/plan/SKILL.md +123 -0
- package/dist/skills/built-in/refactor/SKILL.md +132 -0
- package/dist/skills/built-in/test/SKILL.md +128 -0
- package/dist/sqlite-store-7ZIVOUNI.js +5 -0
- package/dist/sqlite-store-7ZIVOUNI.js.map +1 -0
- package/dist/team-manager-6DCNLGTC.js +11 -0
- package/dist/{team-manager-HC4XGCFY.js.map → team-manager-6DCNLGTC.js.map} +1 -1
- package/dist/team-state-R2D7DT5M.js +3 -0
- package/dist/team-state-R2D7DT5M.js.map +1 -0
- package/dist/tmux-manager-WBKHUHDT.js +6 -0
- package/dist/{tmux-manager-GPYZ3WQH.js.map → tmux-manager-WBKHUHDT.js.map} +1 -1
- package/dist/tools-I6XCTEZY.js +6 -0
- package/dist/{tools-TSMXMHIF.js.map → tools-I6XCTEZY.js.map} +1 -1
- package/package.json +93 -89
- package/dist/App-TE3JJKOW.js +0 -2789
- package/dist/App-TE3JJKOW.js.map +0 -1
- package/dist/api-key-fallback-YQQBOQIL.js +0 -11
- package/dist/chunk-4IJD72YB.js.map +0 -1
- package/dist/chunk-6PDJ45T4.js.map +0 -1
- package/dist/chunk-ASGRGXYK.js.map +0 -1
- package/dist/chunk-CARHU3DO.js.map +0 -1
- package/dist/chunk-CGEV3ARR.js.map +0 -1
- package/dist/chunk-CS5X3BWX.js +0 -27
- package/dist/chunk-CS5X3BWX.js.map +0 -1
- package/dist/chunk-CYQNBB25.js.map +0 -1
- package/dist/chunk-DAHGLHNR.js.map +0 -1
- package/dist/chunk-H66O5Z2V.js.map +0 -1
- package/dist/chunk-HCIHOHLX.js.map +0 -1
- package/dist/chunk-HMJRPNPZ.js.map +0 -1
- package/dist/chunk-I5PZ4JTS.js.map +0 -1
- package/dist/chunk-IYW62KKR.js.map +0 -1
- package/dist/chunk-JAXXTYID.js.map +0 -1
- package/dist/chunk-LSOYPSAT.js.map +0 -1
- package/dist/chunk-MFBHNWGV.js.map +0 -1
- package/dist/chunk-MXZSI3AY.js.map +0 -1
- package/dist/chunk-NBR3GHMT.js.map +0 -1
- package/dist/chunk-TEVZS4FA.js.map +0 -1
- package/dist/chunk-UY2SYSEZ.js.map +0 -1
- package/dist/chunk-VUG4IZ7J.js.map +0 -1
- package/dist/chunk-WAHVZH7V.js +0 -260
- package/dist/chunk-WAHVZH7V.js.map +0 -1
- package/dist/chunk-WPP3PEDE.js.map +0 -1
- package/dist/chunk-Y5XVD2CD.js.map +0 -1
- package/dist/chunk-YL5XFHR3.js.map +0 -1
- package/dist/chunk-ZGOHARPV.js.map +0 -1
- package/dist/claude-adapter-QMLFMSP3.js +0 -6
- package/dist/claude-login-5WELXPKT.js.map +0 -1
- package/dist/codex-login-DDJBCT43.js.map +0 -1
- package/dist/config-store-W6FBCQAQ.js +0 -6
- package/dist/executor-6RIKIGXK.js +0 -4
- package/dist/gemini-adapter-6JIHZ7WI.js +0 -6
- package/dist/gemini-login-YEPK6GGW.js.map +0 -1
- package/dist/kimi-adapter-JN4HFFHU.js +0 -6
- package/dist/kimi-login-ZR74MIY4.js.map +0 -1
- package/dist/native-cli-adapters-OLW3XX57.js +0 -6
- package/dist/ollama-adapter-OJQ3FKWK.js +0 -6
- package/dist/openai-adapter-XU46EN7B.js +0 -6
- package/dist/registry-H7B3AHPQ.js +0 -5
- package/dist/registry-OYWYT7WL.js +0 -6
- package/dist/server-manager-PTGBHCLS.js +0 -5
- package/dist/session-manager-NYB2RKMS.js +0 -12
- package/dist/team-manager-HC4XGCFY.js +0 -11
- package/dist/tmux-manager-GPYZ3WQH.js +0 -6
- package/dist/tools-TSMXMHIF.js +0 -6
package/dist/cli.js
CHANGED
|
@@ -1,73 +1,184 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import './chunk-
|
|
3
|
-
import './chunk-
|
|
4
|
-
import {
|
|
5
|
-
import './chunk-
|
|
6
|
-
import './chunk-
|
|
7
|
-
import './chunk-
|
|
8
|
-
import
|
|
2
|
+
import { LOGIN_PROVIDERS, getAuthStatusRecord, formatDetailedAuthStatusLine } from './chunk-OCJPQFOR.js';
|
|
3
|
+
import { createModelRouter } from './chunk-GU33WKPG.js';
|
|
4
|
+
import { createDefaultRegistry } from './chunk-P66WDACW.js';
|
|
5
|
+
import { ConfigStore } from './chunk-5XFSV6PF.js';
|
|
6
|
+
import './chunk-CC7MGWYY.js';
|
|
7
|
+
import './chunk-H2SYKIMI.js';
|
|
8
|
+
import './chunk-6GUD7QIM.js';
|
|
9
|
+
import './chunk-AQ23TYSQ.js';
|
|
10
|
+
import './chunk-VJNQJALF.js';
|
|
11
|
+
import './chunk-VBLLDY4R.js';
|
|
12
|
+
import { PACKAGE_VERSION } from './chunk-2GKOK6T7.js';
|
|
13
|
+
import './chunk-473JN6M5.js';
|
|
14
|
+
import './chunk-62HSGYQD.js';
|
|
15
|
+
import './chunk-HEKFAKVH.js';
|
|
16
|
+
import './chunk-BY4DAKUU.js';
|
|
9
17
|
import { Command } from 'commander';
|
|
10
18
|
import pc2 from 'picocolors';
|
|
11
19
|
import { randomUUID } from 'crypto';
|
|
12
|
-
import { select } from '@inquirer/prompts';
|
|
13
20
|
|
|
21
|
+
var VALID_ROLES = [
|
|
22
|
+
"planning",
|
|
23
|
+
"coding",
|
|
24
|
+
"review",
|
|
25
|
+
"testing",
|
|
26
|
+
"bugfix",
|
|
27
|
+
"documentation"
|
|
28
|
+
];
|
|
29
|
+
function isInteractiveTerminal() {
|
|
30
|
+
return process.stdin.isTTY && process.stdout.isTTY;
|
|
31
|
+
}
|
|
32
|
+
function normalizeMessage(message) {
|
|
33
|
+
const trimmed = message?.trim();
|
|
34
|
+
return trimmed && trimmed.length > 0 ? trimmed : void 0;
|
|
35
|
+
}
|
|
36
|
+
function parseRole(role) {
|
|
37
|
+
if (role === void 0) {
|
|
38
|
+
return void 0;
|
|
39
|
+
}
|
|
40
|
+
if (VALID_ROLES.includes(role)) {
|
|
41
|
+
return role;
|
|
42
|
+
}
|
|
43
|
+
throw new Error(`Unknown role "${role}". Valid roles: ${VALID_ROLES.join(", ")}`);
|
|
44
|
+
}
|
|
45
|
+
async function ensureInteractiveConfig() {
|
|
46
|
+
const { ensureDefaultConfig, hasGlobalConfig } = await import('./first-run-GDEVRFPO.js');
|
|
47
|
+
if (!hasGlobalConfig()) {
|
|
48
|
+
ensureDefaultConfig();
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
async function startInteractiveChat(options) {
|
|
52
|
+
await ensureInteractiveConfig();
|
|
53
|
+
const { startChatSession } = await import('./App-YAHJUWCX.js');
|
|
54
|
+
await startChatSession({
|
|
55
|
+
...options.initialMessage !== void 0 ? { initialMessage: options.initialMessage } : {},
|
|
56
|
+
...options.model !== void 0 ? { model: options.model } : {},
|
|
57
|
+
...options.role !== void 0 ? { role: options.role } : {},
|
|
58
|
+
...options.systemPrompt !== void 0 ? { systemPrompt: options.systemPrompt } : {},
|
|
59
|
+
...options.isAgentPane ? { isAgentPane: true } : {},
|
|
60
|
+
streaming: options.streaming !== false
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
async function runPlainChat(options, message) {
|
|
64
|
+
const config = new ConfigStore().loadGlobal();
|
|
65
|
+
const modelRouter = createModelRouter(config);
|
|
66
|
+
const role = parseRole(options.role);
|
|
67
|
+
if (options.model !== void 0) {
|
|
68
|
+
modelRouter.setUserOverride(options.model);
|
|
69
|
+
}
|
|
70
|
+
const resolution = modelRouter.resolve(role);
|
|
71
|
+
const registry = await createDefaultRegistry();
|
|
72
|
+
if (!registry.hasModel(resolution.modelId)) {
|
|
73
|
+
throw new Error(
|
|
74
|
+
`No provider is available for model "${resolution.modelId}". Run \`aemeathcli auth status\` or \`aemeathcli auth set-key <provider>\`.`
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
const provider = registry.getForModel(resolution.modelId);
|
|
78
|
+
const messages = [
|
|
79
|
+
{
|
|
80
|
+
id: randomUUID(),
|
|
81
|
+
role: "user",
|
|
82
|
+
content: message,
|
|
83
|
+
createdAt: /* @__PURE__ */ new Date()
|
|
84
|
+
}
|
|
85
|
+
];
|
|
86
|
+
if (options.streaming === false) {
|
|
87
|
+
const response = await provider.chat({
|
|
88
|
+
model: resolution.modelId,
|
|
89
|
+
messages,
|
|
90
|
+
...options.systemPrompt !== void 0 ? { system: options.systemPrompt } : {}
|
|
91
|
+
});
|
|
92
|
+
process.stdout.write(`${response.message.content}
|
|
93
|
+
`);
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
let wroteOutput = false;
|
|
97
|
+
for await (const chunk of provider.stream({
|
|
98
|
+
model: resolution.modelId,
|
|
99
|
+
messages,
|
|
100
|
+
...options.systemPrompt !== void 0 ? { system: options.systemPrompt } : {}
|
|
101
|
+
})) {
|
|
102
|
+
if (chunk.type === "text" && chunk.content) {
|
|
103
|
+
process.stdout.write(chunk.content);
|
|
104
|
+
wroteOutput = true;
|
|
105
|
+
continue;
|
|
106
|
+
}
|
|
107
|
+
if (chunk.type === "tool_call") {
|
|
108
|
+
throw new Error(
|
|
109
|
+
"Tool-calling output is not supported in plain mode. Use the interactive TUI (`aemeathcli`) and switch into swarm mode with Shift+Tab."
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
if (chunk.type === "error" && chunk.error) {
|
|
113
|
+
throw new Error(chunk.error);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
if (wroteOutput) {
|
|
117
|
+
process.stdout.write("\n");
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
async function runChatCommand(options) {
|
|
121
|
+
const message = normalizeMessage(options.initialMessage);
|
|
122
|
+
const interactive = isInteractiveTerminal();
|
|
123
|
+
if (!options.print && interactive && message === void 0) {
|
|
124
|
+
await startInteractiveChat(options);
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
if (message === void 0) {
|
|
128
|
+
throw new Error(
|
|
129
|
+
"Interactive mode requires a TTY. Provide a prompt for one-shot mode or run the command in a terminal."
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
await runPlainChat(options, message);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// src/cli/commands/chat.ts
|
|
14
136
|
function createChatCommand() {
|
|
15
|
-
const chat = new Command("chat").description("Start interactive chat mode (default)").argument("[message...]", "Initial message to send").option("-m, --model <model>", "Override model for this session").option("-r, --role <role>", "Set the task role (planning, coding, review, testing, bugfix)").option("--system <prompt>", "Custom system prompt").option("--no-stream", "Disable streaming output").action(async (messageParts, options) => {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
...initialMessage !== void 0 ? { initialMessage } : {},
|
|
24
|
-
...model !== void 0 ? { model } : {},
|
|
25
|
-
...role !== void 0 ? { role } : {},
|
|
26
|
-
...systemPrompt !== void 0 ? { systemPrompt } : {},
|
|
27
|
-
streaming: options["stream"] !== false
|
|
137
|
+
const chat = new Command("chat").description("Start interactive chat mode (default)").argument("[message...]", "Initial message to send").option("-m, --model <model>", "Override model for this session").option("-r, --role <role>", "Set the task role (planning, coding, review, testing, bugfix)").option("--system <prompt>", "Custom system prompt").option("--print", "Print a single response and exit").option("--no-stream", "Disable streaming output").action(async (messageParts, options) => {
|
|
138
|
+
await runChatCommand({
|
|
139
|
+
initialMessage: messageParts.join(" ") || void 0,
|
|
140
|
+
model: options["model"],
|
|
141
|
+
role: options["role"],
|
|
142
|
+
systemPrompt: options["system"],
|
|
143
|
+
streaming: options["stream"] !== false,
|
|
144
|
+
print: options["print"] === true
|
|
28
145
|
});
|
|
29
146
|
});
|
|
30
147
|
return chat;
|
|
31
148
|
}
|
|
32
149
|
function createPlanCommand() {
|
|
33
|
-
const plan = new Command("plan").description("Enter planning mode with a high-reasoning model").argument("[message...]", "Planning prompt").option("-m, --model <model>", "Override model (default: planning role)").action(async (messageParts, options) => {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
const initialMessage = message || void 0;
|
|
38
|
-
await startChatSession({
|
|
39
|
-
...initialMessage !== void 0 ? { initialMessage } : {},
|
|
40
|
-
...model !== void 0 ? { model } : {},
|
|
150
|
+
const plan = new Command("plan").description("Enter planning mode with a high-reasoning model").argument("[message...]", "Planning prompt").option("-m, --model <model>", "Override model (default: planning role)").option("--print", "Print a single response and exit").action(async (messageParts, options) => {
|
|
151
|
+
await runChatCommand({
|
|
152
|
+
initialMessage: messageParts.join(" ") || void 0,
|
|
153
|
+
model: options["model"],
|
|
41
154
|
role: "planning",
|
|
42
|
-
streaming: true
|
|
155
|
+
streaming: true,
|
|
156
|
+
print: options["print"] === true
|
|
43
157
|
});
|
|
44
158
|
});
|
|
45
159
|
return plan;
|
|
46
160
|
}
|
|
47
161
|
function createReviewCommand() {
|
|
48
|
-
const review = new Command("review").description("Code review mode with a thorough model").argument("[files...]", "Files to review").option("-m, --model <model>", "Override model (default: review role)").action(async (files, options) => {
|
|
162
|
+
const review = new Command("review").description("Code review mode with a thorough model").argument("[files...]", "Files to review").option("-m, --model <model>", "Override model (default: review role)").option("--print", "Print a single response and exit").action(async (files, options) => {
|
|
49
163
|
const message = files.length > 0 ? `Review these files: ${files.join(", ")}` : "Review the recent changes";
|
|
50
|
-
|
|
51
|
-
const model = options["model"];
|
|
52
|
-
await startChatSession({
|
|
164
|
+
await runChatCommand({
|
|
53
165
|
initialMessage: message,
|
|
54
|
-
|
|
166
|
+
model: options["model"],
|
|
55
167
|
role: "review",
|
|
56
|
-
streaming: true
|
|
168
|
+
streaming: true,
|
|
169
|
+
print: options["print"] === true
|
|
57
170
|
});
|
|
58
171
|
});
|
|
59
172
|
return review;
|
|
60
173
|
}
|
|
61
174
|
function createTestCommand() {
|
|
62
|
-
const test = new Command("test").description("Testing mode with a cost-efficient model").argument("[message...]", "Testing prompt").option("-m, --model <model>", "Override model (default: testing role)").action(async (messageParts, options) => {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
await startChatSession({
|
|
67
|
-
initialMessage: message || "Generate tests for the recent changes",
|
|
68
|
-
...model !== void 0 ? { model } : {},
|
|
175
|
+
const test = new Command("test").description("Testing mode with a cost-efficient model").argument("[message...]", "Testing prompt").option("-m, --model <model>", "Override model (default: testing role)").option("--print", "Print a single response and exit").action(async (messageParts, options) => {
|
|
176
|
+
await runChatCommand({
|
|
177
|
+
initialMessage: messageParts.join(" ") || "Generate tests for the recent changes",
|
|
178
|
+
model: options["model"],
|
|
69
179
|
role: "testing",
|
|
70
|
-
streaming: true
|
|
180
|
+
streaming: true,
|
|
181
|
+
print: options["print"] === true
|
|
71
182
|
});
|
|
72
183
|
});
|
|
73
184
|
return test;
|
|
@@ -76,9 +187,9 @@ function createConfigCommand() {
|
|
|
76
187
|
const config = new Command("config").description("Configuration management");
|
|
77
188
|
config.command("get [key]").description("Get configuration value (or all if no key)").action(async (key) => {
|
|
78
189
|
try {
|
|
79
|
-
const { ConfigStore } = await import('./config-store-
|
|
80
|
-
const store = new
|
|
81
|
-
const cfg =
|
|
190
|
+
const { ConfigStore: ConfigStore2 } = await import('./config-store-POB6I37G.js');
|
|
191
|
+
const store = new ConfigStore2();
|
|
192
|
+
const cfg = store.loadGlobal();
|
|
82
193
|
if (key) {
|
|
83
194
|
const value = getNestedValue(cfg, key);
|
|
84
195
|
if (value === void 0) {
|
|
@@ -101,9 +212,9 @@ function createConfigCommand() {
|
|
|
101
212
|
});
|
|
102
213
|
config.command("set <key> <value>").description("Set a configuration value").action(async (key, value) => {
|
|
103
214
|
try {
|
|
104
|
-
const { ConfigStore } = await import('./config-store-
|
|
105
|
-
const store = new
|
|
106
|
-
const cfg =
|
|
215
|
+
const { ConfigStore: ConfigStore2 } = await import('./config-store-POB6I37G.js');
|
|
216
|
+
const store = new ConfigStore2();
|
|
217
|
+
const cfg = store.loadGlobal();
|
|
107
218
|
let parsedValue;
|
|
108
219
|
try {
|
|
109
220
|
parsedValue = JSON.parse(value);
|
|
@@ -111,7 +222,7 @@ function createConfigCommand() {
|
|
|
111
222
|
parsedValue = value;
|
|
112
223
|
}
|
|
113
224
|
setNestedValue(cfg, key, parsedValue);
|
|
114
|
-
|
|
225
|
+
store.saveGlobal(cfg);
|
|
115
226
|
process.stdout.write(pc2.green(`Set ${key} = ${JSON.stringify(parsedValue)}
|
|
116
227
|
`));
|
|
117
228
|
} catch (error) {
|
|
@@ -121,10 +232,13 @@ function createConfigCommand() {
|
|
|
121
232
|
process.exitCode = 3;
|
|
122
233
|
}
|
|
123
234
|
});
|
|
124
|
-
config.command("init").description("Initialize configuration with interactive setup").action(async () => {
|
|
235
|
+
config.command("init").description("Initialize configuration with interactive setup").option("--defaults", "Write default configuration without interactive prompts").option("--force", "Overwrite or recreate the global configuration").action(async (options) => {
|
|
125
236
|
try {
|
|
126
|
-
const { runFirstRunSetup } = await import('./
|
|
127
|
-
await runFirstRunSetup(
|
|
237
|
+
const { runFirstRunSetup } = await import('./first-run-GDEVRFPO.js');
|
|
238
|
+
await runFirstRunSetup({
|
|
239
|
+
...options.defaults !== void 0 ? { defaults: options.defaults } : {},
|
|
240
|
+
...options.force !== void 0 ? { force: options.force } : {}
|
|
241
|
+
});
|
|
128
242
|
} catch (error) {
|
|
129
243
|
const message = error instanceof Error ? error.message : String(error);
|
|
130
244
|
process.stderr.write(pc2.red(`Setup failed: ${message}
|
|
@@ -132,6 +246,11 @@ function createConfigCommand() {
|
|
|
132
246
|
process.exitCode = 3;
|
|
133
247
|
}
|
|
134
248
|
});
|
|
249
|
+
config.command("path").description("Show the active global configuration path").action(async () => {
|
|
250
|
+
const { getConfigPath } = await import('./pathResolver-A6IXQQFE.js');
|
|
251
|
+
process.stdout.write(`${getConfigPath()}
|
|
252
|
+
`);
|
|
253
|
+
});
|
|
135
254
|
return config;
|
|
136
255
|
}
|
|
137
256
|
function getNestedValue(obj, path) {
|
|
@@ -161,10 +280,66 @@ function setNestedValue(obj, path, value) {
|
|
|
161
280
|
current[lastKey] = value;
|
|
162
281
|
}
|
|
163
282
|
}
|
|
164
|
-
var VALID_PROVIDERS =
|
|
283
|
+
var VALID_PROVIDERS = LOGIN_PROVIDERS;
|
|
165
284
|
function isValidProvider(value) {
|
|
166
285
|
return VALID_PROVIDERS.includes(value);
|
|
167
286
|
}
|
|
287
|
+
function isInteractiveTerminal2() {
|
|
288
|
+
return process.stdin.isTTY && process.stdout.isTTY;
|
|
289
|
+
}
|
|
290
|
+
function validProvidersMessage() {
|
|
291
|
+
return VALID_PROVIDERS.join(", ");
|
|
292
|
+
}
|
|
293
|
+
async function promptForProvider() {
|
|
294
|
+
const { select } = await import('@inquirer/prompts');
|
|
295
|
+
return select({
|
|
296
|
+
message: "Select a provider to log in to:",
|
|
297
|
+
choices: [
|
|
298
|
+
{ name: "Claude (Anthropic)", value: "claude" },
|
|
299
|
+
{ name: "Codex (OpenAI)", value: "codex" },
|
|
300
|
+
{ name: "Gemini (Google)", value: "gemini" },
|
|
301
|
+
{ name: "Kimi (Moonshot)", value: "kimi" }
|
|
302
|
+
]
|
|
303
|
+
});
|
|
304
|
+
}
|
|
305
|
+
async function readSecretFromStdin() {
|
|
306
|
+
const chunks = [];
|
|
307
|
+
for await (const chunk of process.stdin) {
|
|
308
|
+
chunks.push(String(chunk));
|
|
309
|
+
}
|
|
310
|
+
return chunks.join("").trim();
|
|
311
|
+
}
|
|
312
|
+
async function resolveLoginProvider(providerArg) {
|
|
313
|
+
if (providerArg !== void 0) {
|
|
314
|
+
if (!isValidProvider(providerArg)) {
|
|
315
|
+
process.stderr.write(
|
|
316
|
+
pc2.red(`Unknown provider: "${providerArg}". Valid: ${validProvidersMessage()}
|
|
317
|
+
`)
|
|
318
|
+
);
|
|
319
|
+
process.exitCode = 2;
|
|
320
|
+
return void 0;
|
|
321
|
+
}
|
|
322
|
+
return providerArg;
|
|
323
|
+
}
|
|
324
|
+
if (!isInteractiveTerminal2()) {
|
|
325
|
+
process.stderr.write(
|
|
326
|
+
pc2.red(
|
|
327
|
+
"Interactive provider selection requires a TTY. Use `aemeathcli auth login <provider>` or `aemeathcli auth set-key <provider> --stdin`.\n"
|
|
328
|
+
)
|
|
329
|
+
);
|
|
330
|
+
process.exitCode = 2;
|
|
331
|
+
return void 0;
|
|
332
|
+
}
|
|
333
|
+
return promptForProvider();
|
|
334
|
+
}
|
|
335
|
+
async function runLoginFlow(provider) {
|
|
336
|
+
process.stdout.write(pc2.cyan(`Logging in to ${provider}...
|
|
337
|
+
`));
|
|
338
|
+
const loginModule = await loadLoginModule(provider);
|
|
339
|
+
await loginModule.login();
|
|
340
|
+
process.stdout.write(pc2.green(`Successfully logged in to ${provider}
|
|
341
|
+
`));
|
|
342
|
+
}
|
|
168
343
|
var PROVIDER_MODEL_SWITCH = {
|
|
169
344
|
claude: { provider: "anthropic", model: "claude-sonnet-4-6" },
|
|
170
345
|
codex: { provider: "openai", model: "gpt-5.2" },
|
|
@@ -173,36 +348,12 @@ var PROVIDER_MODEL_SWITCH = {
|
|
|
173
348
|
};
|
|
174
349
|
function createLoginCommand() {
|
|
175
350
|
return new Command("login").description("Log in to a provider (interactive)").argument("[provider]", "Provider to log in to (claude, codex, gemini, kimi)").action(async (providerArg) => {
|
|
176
|
-
|
|
177
|
-
if (
|
|
178
|
-
|
|
179
|
-
process.stderr.write(
|
|
180
|
-
pc2.red(`Unknown provider: "${providerArg}". Valid: ${VALID_PROVIDERS.join(", ")}
|
|
181
|
-
`)
|
|
182
|
-
);
|
|
183
|
-
process.exitCode = 2;
|
|
184
|
-
return;
|
|
185
|
-
}
|
|
186
|
-
provider = providerArg;
|
|
187
|
-
} else {
|
|
188
|
-
provider = await select({
|
|
189
|
-
message: "Select a provider to log in to:",
|
|
190
|
-
choices: [
|
|
191
|
-
{ name: "Claude (Anthropic)", value: "claude" },
|
|
192
|
-
{ name: "Codex (OpenAI)", value: "codex" },
|
|
193
|
-
{ name: "Gemini (Google)", value: "gemini" },
|
|
194
|
-
{ name: "Kimi (Moonshot)", value: "kimi" }
|
|
195
|
-
]
|
|
196
|
-
});
|
|
351
|
+
const provider = await resolveLoginProvider(providerArg);
|
|
352
|
+
if (provider === void 0) {
|
|
353
|
+
return;
|
|
197
354
|
}
|
|
198
|
-
process.stdout.write(pc2.cyan(`
|
|
199
|
-
Logging in to ${provider}...
|
|
200
|
-
`));
|
|
201
355
|
try {
|
|
202
|
-
|
|
203
|
-
await loginModule.login();
|
|
204
|
-
process.stdout.write(pc2.green(`Successfully logged in to ${provider}
|
|
205
|
-
`));
|
|
356
|
+
await runLoginFlow(provider);
|
|
206
357
|
} catch (error) {
|
|
207
358
|
const message = error instanceof Error ? error.message : String(error);
|
|
208
359
|
process.stderr.write(pc2.red(`Login failed: ${message}
|
|
@@ -213,22 +364,13 @@ Logging in to ${provider}...
|
|
|
213
364
|
}
|
|
214
365
|
function createAuthCommand() {
|
|
215
366
|
const auth = new Command("auth").description("Authentication & account management");
|
|
216
|
-
auth.command("login
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
pc2.red(`Unknown provider: "${provider}". Valid: ${VALID_PROVIDERS.join(", ")}
|
|
220
|
-
`)
|
|
221
|
-
);
|
|
222
|
-
process.exitCode = 2;
|
|
367
|
+
auth.command("login [provider]").description("Log in to a provider (claude, codex, gemini, kimi)").action(async (providerArg) => {
|
|
368
|
+
const provider = await resolveLoginProvider(providerArg);
|
|
369
|
+
if (provider === void 0) {
|
|
223
370
|
return;
|
|
224
371
|
}
|
|
225
|
-
process.stdout.write(pc2.cyan(`Logging in to ${provider}...
|
|
226
|
-
`));
|
|
227
372
|
try {
|
|
228
|
-
|
|
229
|
-
await loginModule.login();
|
|
230
|
-
process.stdout.write(pc2.green(`Successfully logged in to ${provider}
|
|
231
|
-
`));
|
|
373
|
+
await runLoginFlow(provider);
|
|
232
374
|
} catch (error) {
|
|
233
375
|
const message = error instanceof Error ? error.message : String(error);
|
|
234
376
|
process.stderr.write(pc2.red(`Login failed: ${message}
|
|
@@ -269,50 +411,36 @@ function createAuthCommand() {
|
|
|
269
411
|
process.exitCode = 3;
|
|
270
412
|
}
|
|
271
413
|
});
|
|
272
|
-
auth.command("status").description("Show login status for all providers").action(async () => {
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
process.stdout.write(
|
|
279
|
-
pc2.green(` \u2713 ${provider}`) + ` \u2014 Logged in as ${status.email ?? "unknown"} (${status.plan ?? "unknown plan"})
|
|
280
|
-
`
|
|
281
|
-
);
|
|
282
|
-
} else {
|
|
283
|
-
process.stdout.write(pc2.red(` \u2717 ${provider}`) + " \u2014 Not logged in\n");
|
|
284
|
-
}
|
|
285
|
-
} catch {
|
|
286
|
-
process.stdout.write(pc2.red(` \u2717 ${provider}`) + " \u2014 Not configured\n");
|
|
287
|
-
}
|
|
414
|
+
auth.command("status").description("Show login status for all providers").option("--json", "Output machine-readable JSON").action(async (options) => {
|
|
415
|
+
const records = await Promise.all(VALID_PROVIDERS.map(async (provider) => getAuthStatusRecord(provider)));
|
|
416
|
+
if (options.json) {
|
|
417
|
+
process.stdout.write(`${JSON.stringify({ providers: records }, null, 2)}
|
|
418
|
+
`);
|
|
419
|
+
return;
|
|
288
420
|
}
|
|
289
|
-
|
|
290
|
-
const
|
|
291
|
-
|
|
292
|
-
const apiKeyStatus = [
|
|
293
|
-
{ label: "Claude", provider: "anthropic" },
|
|
294
|
-
{ label: "OpenAI", provider: "openai" },
|
|
295
|
-
{ label: "Google", provider: "google" },
|
|
296
|
-
{ label: "Kimi", provider: "kimi" }
|
|
297
|
-
];
|
|
298
|
-
process.stdout.write("\nFallback API keys:\n");
|
|
299
|
-
for (const item of apiKeyStatus) {
|
|
300
|
-
const hasKey = await fallback.hasKey(item.provider);
|
|
301
|
-
process.stdout.write(` ${item.label}: ${hasKey ? "set" : "not set"}
|
|
421
|
+
for (const record of records) {
|
|
422
|
+
const line = formatDetailedAuthStatusLine(record);
|
|
423
|
+
process.stdout.write(`${record.loggedIn ? pc2.green(line) : pc2.red(line)}
|
|
302
424
|
`);
|
|
303
|
-
}
|
|
304
|
-
} catch {
|
|
305
425
|
}
|
|
306
426
|
});
|
|
307
|
-
auth.command("set-key <provider>
|
|
427
|
+
auth.command("set-key <provider> [key]").description("Set an API key for a provider (fallback for CI/headless)").option("--stdin", "Read the API key from stdin").action(async (provider, key, options) => {
|
|
308
428
|
if (!isValidProvider(provider) && provider !== "openai" && provider !== "google") {
|
|
309
429
|
process.stderr.write(pc2.red(`Unknown provider: "${provider}"
|
|
310
430
|
`));
|
|
311
431
|
process.exitCode = 2;
|
|
312
432
|
return;
|
|
313
433
|
}
|
|
434
|
+
const resolvedKey = options.stdin ? await readSecretFromStdin() : key;
|
|
435
|
+
if (!resolvedKey) {
|
|
436
|
+
process.stderr.write(
|
|
437
|
+
pc2.red("Provide an API key argument or use --stdin to read it from standard input.\n")
|
|
438
|
+
);
|
|
439
|
+
process.exitCode = 2;
|
|
440
|
+
return;
|
|
441
|
+
}
|
|
314
442
|
try {
|
|
315
|
-
const { ApiKeyFallback } = await import('./api-key-fallback-
|
|
443
|
+
const { ApiKeyFallback } = await import('./api-key-fallback-UN3TJEOO.js');
|
|
316
444
|
const fallback = new ApiKeyFallback();
|
|
317
445
|
const providerMap = {
|
|
318
446
|
claude: "anthropic",
|
|
@@ -324,7 +452,7 @@ function createAuthCommand() {
|
|
|
324
452
|
};
|
|
325
453
|
const mappedProvider = providerMap[provider];
|
|
326
454
|
if (mappedProvider) {
|
|
327
|
-
await fallback.setKey(mappedProvider,
|
|
455
|
+
await fallback.setKey(mappedProvider, resolvedKey);
|
|
328
456
|
process.stdout.write(pc2.green(`API key set for ${provider}
|
|
329
457
|
`));
|
|
330
458
|
}
|
|
@@ -346,8 +474,8 @@ function createAuthCommand() {
|
|
|
346
474
|
}
|
|
347
475
|
try {
|
|
348
476
|
const target = PROVIDER_MODEL_SWITCH[provider];
|
|
349
|
-
const { ConfigStore } = await import('./config-store-
|
|
350
|
-
const store = new
|
|
477
|
+
const { ConfigStore: ConfigStore2 } = await import('./config-store-POB6I37G.js');
|
|
478
|
+
const store = new ConfigStore2();
|
|
351
479
|
const cfg = store.loadGlobal();
|
|
352
480
|
const nextConfig = {
|
|
353
481
|
...cfg,
|
|
@@ -377,26 +505,58 @@ function createAuthCommand() {
|
|
|
377
505
|
async function loadLoginModule(provider) {
|
|
378
506
|
switch (provider) {
|
|
379
507
|
case "claude": {
|
|
380
|
-
const mod = await import('./claude-login-
|
|
508
|
+
const mod = await import('./claude-login-IS5WTBMP.js');
|
|
381
509
|
return new mod.ClaudeLogin();
|
|
382
510
|
}
|
|
383
511
|
case "codex": {
|
|
384
|
-
const mod = await import('./codex-login-
|
|
512
|
+
const mod = await import('./codex-login-GMPF64MR.js');
|
|
385
513
|
return new mod.CodexLogin();
|
|
386
514
|
}
|
|
387
515
|
case "gemini": {
|
|
388
|
-
const mod = await import('./gemini-login-
|
|
516
|
+
const mod = await import('./gemini-login-KE224MSW.js');
|
|
389
517
|
return new mod.GeminiLogin();
|
|
390
518
|
}
|
|
391
519
|
case "kimi": {
|
|
392
|
-
const mod = await import('./kimi-login-
|
|
520
|
+
const mod = await import('./kimi-login-DNT5YBKX.js');
|
|
393
521
|
return new mod.KimiLogin();
|
|
394
522
|
}
|
|
395
523
|
}
|
|
396
524
|
}
|
|
525
|
+
function createInstallCommand() {
|
|
526
|
+
return new Command("install").description("Install an agent profile from a file or URL").argument("<source>", "Path to .md profile file or URL").action(async (source) => {
|
|
527
|
+
try {
|
|
528
|
+
const { ProfileLoader } = await import('./profile-loader-TNAXBLDX.js');
|
|
529
|
+
const loader = new ProfileLoader();
|
|
530
|
+
const name = await loader.install(source);
|
|
531
|
+
process.stdout.write(`${pc2.green(`Profile "${name}" installed successfully.`)}
|
|
532
|
+
`);
|
|
533
|
+
process.stdout.write(
|
|
534
|
+
`${pc2.dim("Stored in the agent profile library for swarm orchestration and advanced profile-driven workflows.")}
|
|
535
|
+
`
|
|
536
|
+
);
|
|
537
|
+
} catch (error) {
|
|
538
|
+
const msg = error instanceof Error ? error.message : String(error);
|
|
539
|
+
process.stderr.write(`${pc2.red(`Install failed: ${msg}`)}
|
|
540
|
+
`);
|
|
541
|
+
process.exitCode = 1;
|
|
542
|
+
}
|
|
543
|
+
});
|
|
544
|
+
}
|
|
545
|
+
function createTeamCommand() {
|
|
546
|
+
return new Command("team").description("Legacy team namespace").argument("[legacy...]", "Legacy team arguments").action((legacyArgs) => {
|
|
547
|
+
const attempted = legacyArgs.length > 0 ? `team ${legacyArgs.join(" ")}` : "team";
|
|
548
|
+
process.stderr.write(
|
|
549
|
+
pc2.yellow(
|
|
550
|
+
`The top-level \`${attempted}\` command is deprecated.
|
|
551
|
+
Start \`aemeathcli\` (or \`ac\`), press Shift+Tab for swarm mode, or use \`/team\` inside the interactive session.
|
|
552
|
+
`
|
|
553
|
+
)
|
|
554
|
+
);
|
|
555
|
+
process.exitCode = 2;
|
|
556
|
+
});
|
|
557
|
+
}
|
|
397
558
|
|
|
398
559
|
// src/cli/cli.ts
|
|
399
|
-
var VERSION = "1.0.0";
|
|
400
560
|
function getFlagValue(args, flag) {
|
|
401
561
|
const index = args.indexOf(flag);
|
|
402
562
|
if (index === -1) {
|
|
@@ -422,6 +582,36 @@ function sendAgentIPC(method, params) {
|
|
|
422
582
|
process.send(message);
|
|
423
583
|
}
|
|
424
584
|
}
|
|
585
|
+
function isPermissionMode(value) {
|
|
586
|
+
return value === "strict" || value === "standard" || value === "permissive";
|
|
587
|
+
}
|
|
588
|
+
function parseStringArrayEnv(value) {
|
|
589
|
+
if (!value) {
|
|
590
|
+
return void 0;
|
|
591
|
+
}
|
|
592
|
+
try {
|
|
593
|
+
const parsed = JSON.parse(value);
|
|
594
|
+
if (Array.isArray(parsed) && parsed.every((item) => typeof item === "string")) {
|
|
595
|
+
return [...parsed];
|
|
596
|
+
}
|
|
597
|
+
} catch {
|
|
598
|
+
}
|
|
599
|
+
return void 0;
|
|
600
|
+
}
|
|
601
|
+
function getAgentToolContext() {
|
|
602
|
+
const projectRoot = process.env["AEMEATHCLI_TOOL_PROJECT_ROOT"] ?? process.cwd();
|
|
603
|
+
const workingDirectory = process.env["AEMEATHCLI_TOOL_WORKING_DIRECTORY"] ?? projectRoot;
|
|
604
|
+
const allowedPaths = parseStringArrayEnv(process.env["AEMEATHCLI_TOOL_ALLOWED_PATHS"]) ?? [projectRoot];
|
|
605
|
+
const blockedCommands = parseStringArrayEnv(process.env["AEMEATHCLI_TOOL_BLOCKED_COMMANDS"]) ?? [];
|
|
606
|
+
const permissionMode = isPermissionMode(process.env["AEMEATHCLI_TOOL_PERMISSION_MODE"]) ? process.env["AEMEATHCLI_TOOL_PERMISSION_MODE"] : "standard";
|
|
607
|
+
return {
|
|
608
|
+
projectRoot,
|
|
609
|
+
workingDirectory,
|
|
610
|
+
permissionMode,
|
|
611
|
+
allowedPaths,
|
|
612
|
+
blockedCommands
|
|
613
|
+
};
|
|
614
|
+
}
|
|
425
615
|
async function maybeRunAgentMode(args) {
|
|
426
616
|
if (!args.includes("--agent") && process.env["AEMEATHCLI_AGENT_MODE"] !== "1") {
|
|
427
617
|
return false;
|
|
@@ -431,11 +621,12 @@ async function maybeRunAgentMode(args) {
|
|
|
431
621
|
const model = getFlagValue(args, "--model") ?? "claude-sonnet-4-6";
|
|
432
622
|
const role = getFlagValue(args, "--role") ?? "coding";
|
|
433
623
|
const agentId = process.env["AEMEATHCLI_AGENT_ID"] ?? randomUUID();
|
|
624
|
+
const toolContext = getAgentToolContext();
|
|
434
625
|
let registryPromise;
|
|
435
626
|
function getRegistry() {
|
|
436
627
|
if (!registryPromise) {
|
|
437
|
-
registryPromise = import('./registry-
|
|
438
|
-
({ createDefaultRegistry }) =>
|
|
628
|
+
registryPromise = import('./registry-3NHVCXCZ.js').then(
|
|
629
|
+
({ createDefaultRegistry: createDefaultRegistry2 }) => createDefaultRegistry2({ preferSdk: true })
|
|
439
630
|
);
|
|
440
631
|
}
|
|
441
632
|
return registryPromise;
|
|
@@ -443,14 +634,8 @@ async function maybeRunAgentMode(args) {
|
|
|
443
634
|
let toolRegistryPromise;
|
|
444
635
|
function getToolRegistry() {
|
|
445
636
|
if (!toolRegistryPromise) {
|
|
446
|
-
toolRegistryPromise = import('./tools-
|
|
447
|
-
({ createDefaultRegistry: createToolReg }) => createToolReg(
|
|
448
|
-
projectRoot: process.cwd(),
|
|
449
|
-
workingDirectory: process.cwd(),
|
|
450
|
-
permissionMode: "permissive",
|
|
451
|
-
allowedPaths: [process.cwd()],
|
|
452
|
-
blockedCommands: []
|
|
453
|
-
})
|
|
637
|
+
toolRegistryPromise = import('./tools-I6XCTEZY.js').then(
|
|
638
|
+
({ createDefaultRegistry: createToolReg }) => createToolReg(toolContext)
|
|
454
639
|
);
|
|
455
640
|
}
|
|
456
641
|
return toolRegistryPromise;
|
|
@@ -535,13 +720,6 @@ Error: No provider available for model "${model}". Check authentication with 'ae
|
|
|
535
720
|
content: `${toolDefs.length} tools loaded. Sending request to ${model}...
|
|
536
721
|
`
|
|
537
722
|
});
|
|
538
|
-
const toolContext = {
|
|
539
|
-
projectRoot: process.cwd(),
|
|
540
|
-
workingDirectory: process.cwd(),
|
|
541
|
-
permissionMode: "permissive",
|
|
542
|
-
allowedPaths: [process.cwd()],
|
|
543
|
-
blockedCommands: []
|
|
544
|
-
};
|
|
545
723
|
const systemPrompt = `You are ${agentName}, an AI agent in team "${teamName}" with the role of ${role}. You have access to tools for reading files, writing files, editing code, searching, and executing shell commands. Use these tools to complete the assigned task thoroughly. Focus only on your specific role.`;
|
|
546
724
|
const messages = [{
|
|
547
725
|
id: randomUUID(),
|
|
@@ -671,13 +849,29 @@ Error: ${msg}
|
|
|
671
849
|
return true;
|
|
672
850
|
}
|
|
673
851
|
async function main() {
|
|
674
|
-
|
|
852
|
+
const rawArgs = [...process.argv.slice(2)];
|
|
853
|
+
if (process.argv.includes("--no-color")) {
|
|
854
|
+
process.env["NO_COLOR"] = "1";
|
|
855
|
+
}
|
|
856
|
+
if (process.argv.includes("--verbose")) {
|
|
857
|
+
process.env["AEMEATHCLI_LOG_LEVEL"] = process.env["AEMEATHCLI_LOG_LEVEL"] ?? "debug";
|
|
858
|
+
}
|
|
859
|
+
if (await maybeRunAgentMode(rawArgs)) {
|
|
675
860
|
return;
|
|
676
861
|
}
|
|
677
|
-
initializeDirectories();
|
|
678
862
|
const program = new Command().name("aemeathcli").description(
|
|
679
|
-
"
|
|
680
|
-
).version(
|
|
863
|
+
"Multi-model coding CLI with chat, orchestration, and provider-aware automation workflows"
|
|
864
|
+
).version(PACKAGE_VERSION, "-v, --version").argument("[message...]", "Initial prompt to send").option("-m, --model <model>", "Override model for this session").option("-r, --role <role>", "Set the task role").option("--verbose", "Enable verbose output").option("--no-color", "Disable colored output").showSuggestionAfterError().showHelpAfterError().addHelpText(
|
|
865
|
+
"after",
|
|
866
|
+
[
|
|
867
|
+
"",
|
|
868
|
+
"Examples:",
|
|
869
|
+
" aemeathcli",
|
|
870
|
+
' aemeathcli "explain this repository"',
|
|
871
|
+
' aemeathcli chat --print "summarize the latest diff"',
|
|
872
|
+
" aemeathcli # use Shift+Tab inside the TUI to switch into swarm mode"
|
|
873
|
+
].join("\n")
|
|
874
|
+
);
|
|
681
875
|
program.addCommand(createChatCommand());
|
|
682
876
|
program.addCommand(createPlanCommand());
|
|
683
877
|
program.addCommand(createReviewCommand());
|
|
@@ -685,9 +879,10 @@ async function main() {
|
|
|
685
879
|
program.addCommand(createConfigCommand());
|
|
686
880
|
program.addCommand(createAuthCommand());
|
|
687
881
|
program.addCommand(createLoginCommand());
|
|
688
|
-
program.
|
|
689
|
-
|
|
690
|
-
|
|
882
|
+
program.addCommand(createTeamCommand());
|
|
883
|
+
program.addCommand(createInstallCommand());
|
|
884
|
+
program.action(async (messageParts, options) => {
|
|
885
|
+
let message = messageParts.join(" ") || void 0;
|
|
691
886
|
let isAgentPane = false;
|
|
692
887
|
if (message === void 0) {
|
|
693
888
|
const promptFilePath = process.env["AEMEATHCLI_PROMPT_FILE"];
|
|
@@ -700,33 +895,37 @@ async function main() {
|
|
|
700
895
|
}
|
|
701
896
|
}
|
|
702
897
|
}
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
...model !== void 0 ? { model } : {},
|
|
709
|
-
...role !== void 0 ? { role } : {},
|
|
710
|
-
...isAgentPane ? { isAgentPane: true } : {},
|
|
898
|
+
await runChatCommand({
|
|
899
|
+
initialMessage: message,
|
|
900
|
+
model: options["model"],
|
|
901
|
+
role: options["role"],
|
|
902
|
+
isAgentPane,
|
|
711
903
|
streaming: true
|
|
712
904
|
});
|
|
713
905
|
});
|
|
714
|
-
|
|
906
|
+
if (shouldCheckForUpdates(process.argv.slice(2))) {
|
|
907
|
+
checkForUpdates();
|
|
908
|
+
}
|
|
715
909
|
try {
|
|
716
910
|
await program.parseAsync(process.argv);
|
|
717
911
|
} catch (error) {
|
|
718
912
|
if (error instanceof Error) {
|
|
719
|
-
logger.error({ error: error.message }, "CLI error");
|
|
720
913
|
process.stderr.write(pc2.red(`Error: ${error.message}
|
|
721
914
|
`));
|
|
722
915
|
}
|
|
723
916
|
process.exitCode = 1;
|
|
724
917
|
}
|
|
725
918
|
}
|
|
919
|
+
function shouldCheckForUpdates(args) {
|
|
920
|
+
if (!process.stdin.isTTY || !process.stdout.isTTY) {
|
|
921
|
+
return false;
|
|
922
|
+
}
|
|
923
|
+
return !args.some((arg) => ["--help", "-h", "--version", "-v"].includes(arg));
|
|
924
|
+
}
|
|
726
925
|
function checkForUpdates() {
|
|
727
926
|
import('update-notifier').then(({ default: updateNotifier }) => {
|
|
728
927
|
const notifier = updateNotifier({
|
|
729
|
-
pkg: { name: "aemeathcli", version:
|
|
928
|
+
pkg: { name: "aemeathcli", version: PACKAGE_VERSION },
|
|
730
929
|
updateCheckInterval: 1e3 * 60 * 60 * 24
|
|
731
930
|
// 24 hours
|
|
732
931
|
});
|