@botconnector/bccli 0.4.0-beta.41 → 0.4.0-beta.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{acp-SZWZ5EE4.js → acp-U25MNDND.js} +2 -2
- package/dist/{args-4SMOHFN5.js → args-MFTMBNRN.js} +4 -4
- package/dist/{chunk-LN32JIZR.js → chunk-25DSN3Y3.js} +4 -4
- package/dist/{chunk-JROUQ5YS.js → chunk-2ON3WIDP.js} +4 -4
- package/dist/{chunk-3HCOAJEQ.js → chunk-7F3IWBPQ.js} +1 -0
- package/dist/{chunk-VM7HYAJS.js → chunk-BQHKN7JI.js} +1 -1
- package/dist/{chunk-AS7VV7D3.js → chunk-CYTRCZXI.js} +27 -8
- package/dist/{chunk-EQQTTE2K.js → chunk-DUSVS3XK.js} +1 -1
- package/dist/{chunk-M7LLJQ7M.js → chunk-GIGWZFCY.js} +64 -24
- package/dist/{chunk-ISCT3PN3.js → chunk-I7GXIJCY.js} +2 -2
- package/dist/{chunk-HE33XAPZ.js → chunk-NVRNFR4S.js} +1 -1
- package/dist/{chunk-DBHDZ5EP.js → chunk-PSRNKKGA.js} +13 -3
- package/dist/{chunk-AVB6M4JE.js → chunk-PZC2Q6MJ.js} +2 -2
- package/dist/{chunk-M23QBX3V.js → chunk-QHNWI3OT.js} +80 -3
- package/dist/{chunk-GGNXHJL6.js → chunk-RMDW3OQ6.js} +2 -2
- package/dist/{chunk-BUHWQU3V.js → chunk-TW5HZOTB.js} +3 -3
- package/dist/chunk-U6PCNS4B.js +20 -0
- package/dist/{chunk-SESBH44L.js → chunk-VO6MF6JJ.js} +1 -1
- package/dist/chunk-Y3QKYORR.js +145 -0
- package/dist/{chunk-M4IYXI3V.js → chunk-ZGH4B7OU.js} +27 -33
- package/dist/{chunk-NI5JZUZ3.js → chunk-ZKMSTD6G.js} +1 -1
- package/dist/cli.js +78 -37
- package/dist/completion-6K4AXKK2.js +125 -0
- package/dist/config-LCY27K3L.js +30 -0
- package/dist/{config-C4KLLDC6.js → config-Z4HSA435.js} +3 -3
- package/dist/ghBotCli-TJMKJU3E.js +677 -0
- package/dist/{integrationCli-HR7CDUSI.js → integrationCli-33KU6GIK.js} +2 -2
- package/dist/login-LNF7ZV2S.js +16 -0
- package/dist/{mcpCli-5QTXH7XJ.js → mcpCli-TXFS3AOJ.js} +6 -6
- package/dist/{modelsCli-DKTT3UZD.js → modelsCli-IZSMIYVB.js} +6 -6
- package/dist/npmRunner-LU43GM3W.js +46 -0
- package/dist/oauthLogin-QGDYTOW7.js +210 -0
- package/dist/pluginsCli-RD4QW3DX.js +284 -0
- package/dist/prCli-NR3ZQMST.js +73 -0
- package/dist/providerCli-AA3CHCGV.js +15 -0
- package/dist/sdk.js +160 -57
- package/dist/{serve-KQ35P4W3.js → serve-F7BYQ7X6.js} +19 -18
- package/dist/{serve-I2VQUTHR.js → serve-YNKE332Z.js} +3 -3
- package/dist/session-KRV2UP5C.js +12 -0
- package/dist/setup-L4OPF3XW.js +24 -0
- package/dist/statsCli-RPCIMT5R.js +109 -0
- package/dist/transferCli-RQBB6RVY.js +71 -0
- package/dist/{ui-S4QFJJIB.js → ui-4ZTUMTYM.js} +13 -13
- package/dist/{update-VBDEHHMR.js → update-7SSREI2O.js} +2 -2
- package/package.json +1 -1
- package/dist/chunk-DSFHN5CH.js +0 -52
- package/dist/login-T5S6SPZA.js +0 -9
- package/dist/providerCli-DDH4ZZUY.js +0 -15
- package/dist/session-H2YL5RSB.js +0 -12
- package/dist/setup-45WQXUBK.js +0 -23
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
defaultOpen
|
|
4
|
+
} from "./chunk-7F3IWBPQ.js";
|
|
5
|
+
import {
|
|
6
|
+
removeCredential,
|
|
7
|
+
saveCredential
|
|
8
|
+
} from "./chunk-GIGWZFCY.js";
|
|
9
|
+
import {
|
|
10
|
+
t
|
|
11
|
+
} from "./chunk-QHNWI3OT.js";
|
|
12
|
+
|
|
13
|
+
// src/login.ts
|
|
14
|
+
function readSecret(prompt) {
|
|
15
|
+
return new Promise((resolve) => {
|
|
16
|
+
process.stdout.write(prompt);
|
|
17
|
+
const stdin = process.stdin;
|
|
18
|
+
if (!stdin.isTTY) {
|
|
19
|
+
let data = "";
|
|
20
|
+
stdin.on("data", (d) => {
|
|
21
|
+
data += d;
|
|
22
|
+
});
|
|
23
|
+
stdin.on("end", () => resolve(data.trim()));
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
let value = "";
|
|
27
|
+
stdin.setRawMode(true);
|
|
28
|
+
stdin.resume();
|
|
29
|
+
const onData = (buffer) => {
|
|
30
|
+
for (const ch of buffer.toString()) {
|
|
31
|
+
if (ch === "\r" || ch === "\n") {
|
|
32
|
+
stdin.setRawMode(false);
|
|
33
|
+
stdin.pause();
|
|
34
|
+
stdin.off("data", onData);
|
|
35
|
+
process.stdout.write("\n");
|
|
36
|
+
resolve(value.trim());
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
if (ch === "") process.exit(130);
|
|
40
|
+
if (ch === "\x7F" || ch === "\b") value = value.slice(0, -1);
|
|
41
|
+
else value += ch;
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
stdin.on("data", onData);
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
function readLine(prompt) {
|
|
48
|
+
return new Promise((resolve) => {
|
|
49
|
+
process.stdout.write(prompt);
|
|
50
|
+
const stdin = process.stdin;
|
|
51
|
+
if (!stdin.isTTY) {
|
|
52
|
+
let data = "";
|
|
53
|
+
stdin.on("data", (d) => {
|
|
54
|
+
data += d;
|
|
55
|
+
});
|
|
56
|
+
stdin.on("end", () => resolve(data.trim()));
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
let value = "";
|
|
60
|
+
stdin.setRawMode(true);
|
|
61
|
+
stdin.resume();
|
|
62
|
+
const onData = (buffer) => {
|
|
63
|
+
for (const ch of buffer.toString()) {
|
|
64
|
+
const code = ch.charCodeAt(0);
|
|
65
|
+
if (code === 13 || code === 10) {
|
|
66
|
+
stdin.setRawMode(false);
|
|
67
|
+
stdin.pause();
|
|
68
|
+
stdin.off("data", onData);
|
|
69
|
+
process.stdout.write("\n");
|
|
70
|
+
resolve(value.trim());
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
if (code === 3) process.exit(130);
|
|
74
|
+
if (code === 127 || code === 8) value = value.slice(0, -1);
|
|
75
|
+
else value += ch;
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
stdin.on("data", onData);
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
function defaultLoginDeps() {
|
|
82
|
+
return {
|
|
83
|
+
out: (s) => console.log(s),
|
|
84
|
+
err: (s) => console.error(s),
|
|
85
|
+
env: process.env,
|
|
86
|
+
isTTY: process.stdin.isTTY ?? false,
|
|
87
|
+
open: (url) => defaultOpen(new URL(url)),
|
|
88
|
+
readLine,
|
|
89
|
+
saveCredential: (id, key) => saveCredential(id, key, process.env),
|
|
90
|
+
removeCredential: (id) => removeCredential(id, process.env),
|
|
91
|
+
fetch: globalThis.fetch,
|
|
92
|
+
// Wiring NYATA jalur lama: persis runLogin lama (provider add + prompt key).
|
|
93
|
+
legacyAdd: async (providerId, targetCwd) => {
|
|
94
|
+
const { runProviderCommand } = await import("./providerCli-AA3CHCGV.js");
|
|
95
|
+
const { parseCliArgs: parse } = await import("./args-MFTMBNRN.js");
|
|
96
|
+
return runProviderCommand(parse(["provider", "add", providerId]), {
|
|
97
|
+
env: process.env,
|
|
98
|
+
cwd: targetCwd,
|
|
99
|
+
out: (s) => console.log(s),
|
|
100
|
+
err: (s) => console.error(s),
|
|
101
|
+
readSecret
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
async function runLogin(providerId, cwd, args, deps) {
|
|
107
|
+
if (args.key && args.logout) {
|
|
108
|
+
deps.err(t("Use either --key or --logout, not both."));
|
|
109
|
+
return 1;
|
|
110
|
+
}
|
|
111
|
+
if (args.logout) {
|
|
112
|
+
if (providerId !== "openrouter") {
|
|
113
|
+
deps.err(
|
|
114
|
+
t("Logout is not supported for {id}; use bccli provider remove {id} to delete its stored key and config.", {
|
|
115
|
+
id: providerId
|
|
116
|
+
})
|
|
117
|
+
);
|
|
118
|
+
return 1;
|
|
119
|
+
}
|
|
120
|
+
const { runOauthLogout } = await import("./oauthLogin-QGDYTOW7.js");
|
|
121
|
+
return runOauthLogout({ out: deps.out, err: deps.err, env: deps.env, removeCredential: deps.removeCredential });
|
|
122
|
+
}
|
|
123
|
+
if (args.key) return deps.legacyAdd(providerId, cwd);
|
|
124
|
+
if (providerId === "openrouter") {
|
|
125
|
+
const { runOauthLogin } = await import("./oauthLogin-QGDYTOW7.js");
|
|
126
|
+
return runOauthLogin({
|
|
127
|
+
out: deps.out,
|
|
128
|
+
err: deps.err,
|
|
129
|
+
env: deps.env,
|
|
130
|
+
isTTY: deps.isTTY,
|
|
131
|
+
open: deps.open,
|
|
132
|
+
readLine: deps.readLine,
|
|
133
|
+
saveCredential: deps.saveCredential,
|
|
134
|
+
fetch: deps.fetch
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
return deps.legacyAdd(providerId, cwd);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export {
|
|
141
|
+
readSecret,
|
|
142
|
+
readLine,
|
|
143
|
+
defaultLoginDeps,
|
|
144
|
+
runLogin
|
|
145
|
+
};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
estimateMessages,
|
|
4
|
+
estimateTokens,
|
|
5
|
+
trimToFit
|
|
6
|
+
} from "./chunk-U6PCNS4B.js";
|
|
6
7
|
import {
|
|
7
8
|
BUILTIN_AGENTS,
|
|
8
9
|
appendMemory,
|
|
@@ -17,47 +18,51 @@ import {
|
|
|
17
18
|
parseFrontmatter,
|
|
18
19
|
runHooks,
|
|
19
20
|
validateGlobPattern
|
|
20
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-PSRNKKGA.js";
|
|
22
|
+
import {
|
|
23
|
+
createWebSearchTool,
|
|
24
|
+
fetchTool
|
|
25
|
+
} from "./chunk-NVRNFR4S.js";
|
|
26
|
+
import {
|
|
27
|
+
defineTool
|
|
28
|
+
} from "./chunk-PSO7R5AD.js";
|
|
21
29
|
import {
|
|
22
30
|
Permissions
|
|
23
31
|
} from "./chunk-GAFJEQTJ.js";
|
|
24
32
|
import {
|
|
25
33
|
addProviderKey
|
|
26
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-2ON3WIDP.js";
|
|
27
35
|
import {
|
|
28
36
|
listAllModels
|
|
29
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-25DSN3Y3.js";
|
|
30
38
|
import {
|
|
31
39
|
providerName
|
|
32
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-VO6MF6JJ.js";
|
|
41
|
+
import {
|
|
42
|
+
FileOAuthProvider,
|
|
43
|
+
hasStoredTokens
|
|
44
|
+
} from "./chunk-7F3IWBPQ.js";
|
|
33
45
|
import {
|
|
34
46
|
Session
|
|
35
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-BQHKN7JI.js";
|
|
36
48
|
import {
|
|
37
49
|
completionAssistantMessage,
|
|
38
50
|
createProvider,
|
|
39
51
|
hasPendingProgrammaticReplay,
|
|
40
52
|
imageUserMessage
|
|
41
|
-
} from "./chunk-
|
|
53
|
+
} from "./chunk-RMDW3OQ6.js";
|
|
42
54
|
import {
|
|
43
55
|
expandEnvVars
|
|
44
|
-
} from "./chunk-
|
|
45
|
-
import {
|
|
46
|
-
createWebSearchTool,
|
|
47
|
-
fetchTool
|
|
48
|
-
} from "./chunk-HE33XAPZ.js";
|
|
49
|
-
import {
|
|
50
|
-
defineTool
|
|
51
|
-
} from "./chunk-PSO7R5AD.js";
|
|
56
|
+
} from "./chunk-PZC2Q6MJ.js";
|
|
52
57
|
import {
|
|
53
58
|
ConfigError,
|
|
54
59
|
bccliHome,
|
|
55
60
|
loadConfig,
|
|
56
61
|
resolveModel
|
|
57
|
-
} from "./chunk-
|
|
62
|
+
} from "./chunk-GIGWZFCY.js";
|
|
58
63
|
import {
|
|
59
64
|
t
|
|
60
|
-
} from "./chunk-
|
|
65
|
+
} from "./chunk-QHNWI3OT.js";
|
|
61
66
|
|
|
62
67
|
// src/textToolCalls.ts
|
|
63
68
|
var PAIR = /(?:<arg_key>\s*|`)?([A-Za-z_]\w*)(?:\s*<\/arg_key>)?`?\s*(?:=\s*`|<arg_value>)([\s\S]*?)<\/arg_value>/g;
|
|
@@ -661,19 +666,6 @@ function budgetStatus(usage, cap, model) {
|
|
|
661
666
|
return void 0;
|
|
662
667
|
}
|
|
663
668
|
|
|
664
|
-
// src/tokenBudget.ts
|
|
665
|
-
var estimateTokens = (text) => Math.ceil(text.length / 4);
|
|
666
|
-
var estimateMessages = (messages) => estimateTokens(JSON.stringify(messages));
|
|
667
|
-
function trimToFit(messages, maxTokens) {
|
|
668
|
-
let out = messages;
|
|
669
|
-
while (estimateMessages(out) > maxTokens) {
|
|
670
|
-
const boundary = out.findIndex((m, i) => i > 0 && m.role === "user");
|
|
671
|
-
if (boundary === -1) return out;
|
|
672
|
-
out = out.slice(boundary);
|
|
673
|
-
}
|
|
674
|
-
return out;
|
|
675
|
-
}
|
|
676
|
-
|
|
677
669
|
// src/agent.ts
|
|
678
670
|
var CANCELLED = "Cancelled by the user.";
|
|
679
671
|
var COMPACT_PROMPT = "Summarize the conversation so far for yourself so you can continue the work with no other context. Include: the user goals, decisions made, files touched and their current state, commands run and results, the task in progress and the next step. Be concise but complete.";
|
|
@@ -1909,6 +1901,8 @@ function createRuntime(opts) {
|
|
|
1909
1901
|
apiKey: resolved.apiKey,
|
|
1910
1902
|
model: resolved.model,
|
|
1911
1903
|
providerId: resolved.providerId,
|
|
1904
|
+
fetch: opts.fetch,
|
|
1905
|
+
// diteruskan penuh (spec gh-bot §6.6 — juga memperbaiki sdk fetch-injection)
|
|
1912
1906
|
enableProgrammaticToolCalling: lunaPtcAutoEnabled(env)
|
|
1913
1907
|
});
|
|
1914
1908
|
};
|
|
@@ -1993,7 +1987,7 @@ function createRuntime(opts) {
|
|
|
1993
1987
|
cwd: opts.cwd,
|
|
1994
1988
|
history,
|
|
1995
1989
|
reasoning,
|
|
1996
|
-
maxSteps: config.maxSteps,
|
|
1990
|
+
maxSteps: opts.maxSteps ?? config.maxSteps,
|
|
1997
1991
|
hooks: config.hooks,
|
|
1998
1992
|
pluginEmit,
|
|
1999
1993
|
env,
|
package/dist/cli.js
CHANGED
|
@@ -1,46 +1,48 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
VERSION
|
|
4
|
-
} from "./chunk-EQQTTE2K.js";
|
|
5
2
|
import {
|
|
6
3
|
resolveWorktree,
|
|
7
4
|
runPrint
|
|
8
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-TW5HZOTB.js";
|
|
9
6
|
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
createRuntime
|
|
8
|
+
} from "./chunk-ZGH4B7OU.js";
|
|
9
|
+
import "./chunk-U6PCNS4B.js";
|
|
10
|
+
import "./chunk-PSRNKKGA.js";
|
|
11
|
+
import "./chunk-NVRNFR4S.js";
|
|
12
|
+
import "./chunk-PSO7R5AD.js";
|
|
13
13
|
import {
|
|
14
|
-
|
|
15
|
-
} from "./chunk-
|
|
14
|
+
VERSION
|
|
15
|
+
} from "./chunk-DUSVS3XK.js";
|
|
16
16
|
import {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
import "./chunk-DBHDZ5EP.js";
|
|
17
|
+
helpText,
|
|
18
|
+
parseCliArgs
|
|
19
|
+
} from "./chunk-CYTRCZXI.js";
|
|
21
20
|
import "./chunk-GAFJEQTJ.js";
|
|
22
|
-
import "./chunk-
|
|
23
|
-
import "./chunk-
|
|
21
|
+
import "./chunk-2ON3WIDP.js";
|
|
22
|
+
import "./chunk-25DSN3Y3.js";
|
|
24
23
|
import {
|
|
25
24
|
readGlobalConfigFile
|
|
26
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-VO6MF6JJ.js";
|
|
26
|
+
import {
|
|
27
|
+
defaultLoginDeps,
|
|
28
|
+
runLogin
|
|
29
|
+
} from "./chunk-Y3QKYORR.js";
|
|
30
|
+
import "./chunk-7F3IWBPQ.js";
|
|
27
31
|
import {
|
|
28
32
|
pruneSessions
|
|
29
|
-
} from "./chunk-
|
|
30
|
-
import "./chunk-
|
|
31
|
-
import "./chunk-
|
|
32
|
-
import "./chunk-
|
|
33
|
-
import "./chunk-HE33XAPZ.js";
|
|
34
|
-
import "./chunk-PSO7R5AD.js";
|
|
33
|
+
} from "./chunk-BQHKN7JI.js";
|
|
34
|
+
import "./chunk-RMDW3OQ6.js";
|
|
35
|
+
import "./chunk-ZKMSTD6G.js";
|
|
36
|
+
import "./chunk-PZC2Q6MJ.js";
|
|
35
37
|
import {
|
|
36
38
|
ConfigError,
|
|
37
39
|
setTheme
|
|
38
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-GIGWZFCY.js";
|
|
39
41
|
import {
|
|
40
42
|
resolveLanguage,
|
|
41
43
|
setLanguage,
|
|
42
44
|
t
|
|
43
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-QHNWI3OT.js";
|
|
44
46
|
|
|
45
47
|
// src/cli.ts
|
|
46
48
|
function chooseLanguage(argv) {
|
|
@@ -64,19 +66,19 @@ async function main() {
|
|
|
64
66
|
}
|
|
65
67
|
let cwd = process.cwd();
|
|
66
68
|
if (args.worktree) cwd = (await resolveWorktree(cwd, args.worktree)).path;
|
|
67
|
-
if (args.command === "login") return runLogin(args.loginProvider ?? "bc-cloud", cwd);
|
|
69
|
+
if (args.command === "login") return runLogin(args.loginProvider ?? "bc-cloud", cwd, args, defaultLoginDeps());
|
|
68
70
|
if (args.command === "mcp") {
|
|
69
|
-
const { runMcpCommand } = await import("./mcpCli-
|
|
70
|
-
const { readSecret } = await import("./login-
|
|
71
|
+
const { runMcpCommand } = await import("./mcpCli-TXFS3AOJ.js");
|
|
72
|
+
const { readSecret } = await import("./login-LNF7ZV2S.js");
|
|
71
73
|
return runMcpCommand(args, { env: process.env, cwd, out: (s) => console.log(s), err: (s) => console.error(s), readSecret });
|
|
72
74
|
}
|
|
73
75
|
if (args.command === "provider") {
|
|
74
|
-
const { runProviderCommand } = await import("./providerCli-
|
|
75
|
-
const { readSecret } = await import("./login-
|
|
76
|
+
const { runProviderCommand } = await import("./providerCli-AA3CHCGV.js");
|
|
77
|
+
const { readSecret } = await import("./login-LNF7ZV2S.js");
|
|
76
78
|
return runProviderCommand(args, { env: process.env, cwd, out: (s) => console.log(s), err: (s) => console.error(s), readSecret });
|
|
77
79
|
}
|
|
78
80
|
if (args.command === "connect" || args.command === "disconnect" || args.command === "integrations") {
|
|
79
|
-
const { runIntegrationCommand } = await import("./integrationCli-
|
|
81
|
+
const { runIntegrationCommand } = await import("./integrationCli-33KU6GIK.js");
|
|
80
82
|
return runIntegrationCommand(args, {
|
|
81
83
|
env: process.env,
|
|
82
84
|
cwd,
|
|
@@ -86,20 +88,20 @@ async function main() {
|
|
|
86
88
|
});
|
|
87
89
|
}
|
|
88
90
|
if (args.command === "models") {
|
|
89
|
-
const { runModelsCommand } = await import("./modelsCli-
|
|
91
|
+
const { runModelsCommand } = await import("./modelsCli-IZSMIYVB.js");
|
|
90
92
|
return runModelsCommand(args, { env: process.env, cwd, out: (s) => console.log(s), err: (s) => console.error(s), fetch: globalThis.fetch });
|
|
91
93
|
}
|
|
92
94
|
if (args.command === "update") {
|
|
93
|
-
const { runUpdateCommand } = await import("./update-
|
|
95
|
+
const { runUpdateCommand } = await import("./update-7SSREI2O.js");
|
|
94
96
|
return runUpdateCommand({ env: process.env });
|
|
95
97
|
}
|
|
96
98
|
if (args.command === "acp") {
|
|
97
|
-
const { runtimeAgent, runAcp } = await import("./acp-
|
|
99
|
+
const { runtimeAgent, runAcp } = await import("./acp-U25MNDND.js");
|
|
98
100
|
await runAcp(process.stdin, process.stdout, { cwd, newAgent: (c) => runtimeAgent(c) });
|
|
99
101
|
return 0;
|
|
100
102
|
}
|
|
101
103
|
if (args.command === "serve") {
|
|
102
|
-
const { startServe } = await import("./serve-
|
|
104
|
+
const { startServe } = await import("./serve-F7BYQ7X6.js");
|
|
103
105
|
const handle = await startServe({ port: args.port, host: args.host, token: args.token, cwd, env: process.env });
|
|
104
106
|
process.stderr.write(`bccli serve ${handle.url} \u2014 Authorization: Bearer ${handle.token}
|
|
105
107
|
`);
|
|
@@ -112,6 +114,45 @@ async function main() {
|
|
|
112
114
|
});
|
|
113
115
|
return 0;
|
|
114
116
|
}
|
|
117
|
+
if (args.command === "plugins") {
|
|
118
|
+
const { runPluginsCommand } = await import("./pluginsCli-RD4QW3DX.js");
|
|
119
|
+
const { readGlobalPlugins, updateGlobalConfig } = await import("./config-LCY27K3L.js");
|
|
120
|
+
const { runNpmSync } = await import("./npmRunner-LU43GM3W.js");
|
|
121
|
+
return runPluginsCommand(args, {
|
|
122
|
+
out: (s) => console.log(s),
|
|
123
|
+
err: (s) => console.error(s),
|
|
124
|
+
env: process.env,
|
|
125
|
+
runNpm: async (prefix, argv) => runNpmSync(prefix, argv),
|
|
126
|
+
readPlugins: () => readGlobalPlugins(process.env),
|
|
127
|
+
savePlugins: (entries) => updateGlobalConfig(process.env, (cfg) => {
|
|
128
|
+
cfg.plugins = entries;
|
|
129
|
+
})
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
if (args.command === "gh-bot") {
|
|
133
|
+
const { runGhBotCommand } = await import("./ghBotCli-TJMKJU3E.js");
|
|
134
|
+
return runGhBotCommand(args, { env: process.env, cwd, out: (s) => console.log(s), err: (s) => console.error(s) });
|
|
135
|
+
}
|
|
136
|
+
if (args.command === "completion") {
|
|
137
|
+
const { runCompletionCommand } = await import("./completion-6K4AXKK2.js");
|
|
138
|
+
return runCompletionCommand(args, { out: (s) => console.log(s), err: (s) => console.error(s) });
|
|
139
|
+
}
|
|
140
|
+
if (args.command === "stats") {
|
|
141
|
+
const { runStatsCommand } = await import("./statsCli-RPCIMT5R.js");
|
|
142
|
+
const { bccliHome } = await import("./config-LCY27K3L.js");
|
|
143
|
+
return runStatsCommand({ subArgs: args.subArgs, home: bccliHome(process.env) }, { out: (s) => console.log(s), err: (s) => console.error(s) });
|
|
144
|
+
}
|
|
145
|
+
if (args.command === "export" || args.command === "import") {
|
|
146
|
+
const { runExportCommand, runImportCommand } = await import("./transferCli-RQBB6RVY.js");
|
|
147
|
+
const { bccliHome } = await import("./config-LCY27K3L.js");
|
|
148
|
+
const deps = { subArgs: args.subArgs, home: bccliHome(process.env), cwd };
|
|
149
|
+
const io = { out: (s) => console.log(s), err: (s) => console.error(s) };
|
|
150
|
+
return args.command === "export" ? runExportCommand(deps, io) : runImportCommand(deps, io);
|
|
151
|
+
}
|
|
152
|
+
if (args.command === "pr") {
|
|
153
|
+
const { runPrCommand } = await import("./prCli-NR3ZQMST.js");
|
|
154
|
+
return runPrCommand({ subArgs: args.subArgs, cwd }, { out: (s) => console.log(s), err: (s) => console.error(s) });
|
|
155
|
+
}
|
|
115
156
|
const rt = createRuntime({ cwd, args });
|
|
116
157
|
setTheme(rt.config.theme);
|
|
117
158
|
try {
|
|
@@ -120,7 +161,7 @@ async function main() {
|
|
|
120
161
|
}
|
|
121
162
|
if (args.print) {
|
|
122
163
|
if (!args.prompt) throw new ConfigError(t('-p mode needs a task, e.g. bccli -p "explain this repo"'));
|
|
123
|
-
const { serversToStart } = await import("./config-
|
|
164
|
+
const { serversToStart } = await import("./config-Z4HSA435.js");
|
|
124
165
|
const plan = serversToStart(rt.home, cwd);
|
|
125
166
|
for (const s of plan.needTrust) {
|
|
126
167
|
console.error(t('Project MCP server "{name}" skipped (not approved yet; run interactive bccli once to approve it).', { name: s.name }));
|
|
@@ -135,13 +176,13 @@ async function main() {
|
|
|
135
176
|
if (!process.stdin.isTTY) throw new ConfigError(t('Interactive mode needs a terminal. For scripts/CI use: bccli -p "task"'));
|
|
136
177
|
if (rt.config.updateCheck !== "off" && !process.env.BCCLI_NO_UPDATE_CHECK) {
|
|
137
178
|
try {
|
|
138
|
-
const { checkForUpdate } = await import("./update-
|
|
179
|
+
const { checkForUpdate } = await import("./update-7SSREI2O.js");
|
|
139
180
|
const update = await checkForUpdate({ home: rt.home, fetch: globalThis.fetch, now: /* @__PURE__ */ new Date() });
|
|
140
181
|
if (update) console.error(update);
|
|
141
182
|
} catch {
|
|
142
183
|
}
|
|
143
184
|
}
|
|
144
|
-
const { startInteractive } = await import("./ui-
|
|
185
|
+
const { startInteractive } = await import("./ui-4ZTUMTYM.js");
|
|
145
186
|
return startInteractive(rt, { initialPrompt: args.prompt, resume: args.resume, version: VERSION });
|
|
146
187
|
}
|
|
147
188
|
main().then(
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
t
|
|
4
|
+
} from "./chunk-QHNWI3OT.js";
|
|
5
|
+
|
|
6
|
+
// src/completion.ts
|
|
7
|
+
var SHELLS = ["bash", "zsh", "fish", "powershell"];
|
|
8
|
+
function isCompletionShell(value) {
|
|
9
|
+
return SHELLS.includes(value);
|
|
10
|
+
}
|
|
11
|
+
var COMMANDS = [
|
|
12
|
+
"completion",
|
|
13
|
+
"stats",
|
|
14
|
+
"export",
|
|
15
|
+
"import",
|
|
16
|
+
"pr",
|
|
17
|
+
"login",
|
|
18
|
+
"models",
|
|
19
|
+
"update",
|
|
20
|
+
"acp",
|
|
21
|
+
"serve",
|
|
22
|
+
"plugins",
|
|
23
|
+
"gh-bot",
|
|
24
|
+
"provider",
|
|
25
|
+
"mcp",
|
|
26
|
+
"connect",
|
|
27
|
+
"disconnect",
|
|
28
|
+
"integrations"
|
|
29
|
+
];
|
|
30
|
+
var FLAGS = [
|
|
31
|
+
"-p",
|
|
32
|
+
"--print",
|
|
33
|
+
"-m",
|
|
34
|
+
"--model",
|
|
35
|
+
"--reasoning",
|
|
36
|
+
"-c",
|
|
37
|
+
"--continue",
|
|
38
|
+
"-r",
|
|
39
|
+
"--resume",
|
|
40
|
+
"--allow-all",
|
|
41
|
+
"--allowed-tools",
|
|
42
|
+
"-w",
|
|
43
|
+
"--worktree",
|
|
44
|
+
"--output-format",
|
|
45
|
+
"--permission-mode",
|
|
46
|
+
"--lang",
|
|
47
|
+
"-v",
|
|
48
|
+
"--version",
|
|
49
|
+
"-h",
|
|
50
|
+
"--help"
|
|
51
|
+
];
|
|
52
|
+
var WORDS = [...COMMANDS, ...FLAGS].join(" ");
|
|
53
|
+
function bashScript() {
|
|
54
|
+
return `# bccli bash completion \u2014 add to your shell rc:
|
|
55
|
+
# bccli completion bash > ~/.local/share/bash-completion/completions/bccli
|
|
56
|
+
_bccli_complete() {
|
|
57
|
+
local cur
|
|
58
|
+
cur="\${COMP_WORDS[COMP_CWORD]}"
|
|
59
|
+
COMPREPLY=( $(compgen -W "${WORDS}" -- "$cur") )
|
|
60
|
+
}
|
|
61
|
+
complete -F _bccli_complete bccli
|
|
62
|
+
`;
|
|
63
|
+
}
|
|
64
|
+
function zshScript() {
|
|
65
|
+
return `# bccli zsh completion \u2014 add to your shell rc:
|
|
66
|
+
# bccli completion zsh > "\${fpath[1]}/_bccli"
|
|
67
|
+
#compdef bccli
|
|
68
|
+
_bccli() {
|
|
69
|
+
local -a words_list
|
|
70
|
+
words_list=(${WORDS})
|
|
71
|
+
_describe 'command' words_list
|
|
72
|
+
}
|
|
73
|
+
compdef _bccli bccli
|
|
74
|
+
`;
|
|
75
|
+
}
|
|
76
|
+
function fishScript() {
|
|
77
|
+
const lines = [
|
|
78
|
+
"# bccli fish completion \u2014 add to your config:",
|
|
79
|
+
"# bccli completion fish > ~/.config/fish/completions/bccli.fish",
|
|
80
|
+
`# flags: ${FLAGS.join(" ")}`
|
|
81
|
+
];
|
|
82
|
+
for (const w of COMMANDS) lines.push(`complete -c bccli -f -a '${w}'`);
|
|
83
|
+
for (const f of FLAGS) lines.push(`complete -c bccli -l '${f.replace(/^-+/, "")}'`);
|
|
84
|
+
return `${lines.join("\n")}
|
|
85
|
+
`;
|
|
86
|
+
}
|
|
87
|
+
function powershellScript() {
|
|
88
|
+
return `# bccli powershell completion \u2014 add to your profile:
|
|
89
|
+
# bccli completion powershell >> $PROFILE
|
|
90
|
+
Register-ArgumentCompleter -Native -CommandName bccli -ScriptBlock {
|
|
91
|
+
param($wordToComplete, $commandAst, $cursorPosition)
|
|
92
|
+
$words = '${WORDS}' -split ' '
|
|
93
|
+
$words | Where-Object { $_ -like "$wordToComplete*" } | ForEach-Object {
|
|
94
|
+
[System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_)
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
`;
|
|
98
|
+
}
|
|
99
|
+
function completionScript(shell) {
|
|
100
|
+
switch (shell) {
|
|
101
|
+
case "bash":
|
|
102
|
+
return bashScript();
|
|
103
|
+
case "zsh":
|
|
104
|
+
return zshScript();
|
|
105
|
+
case "fish":
|
|
106
|
+
return fishScript();
|
|
107
|
+
case "powershell":
|
|
108
|
+
return powershellScript();
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
function runCompletionCommand(args, deps) {
|
|
112
|
+
const shell = (args.subArgs[0] ?? "").trim();
|
|
113
|
+
if (!shell || !isCompletionShell(shell)) {
|
|
114
|
+
deps.err?.(t("usage: bccli completion <{shells}>", { shells: SHELLS.join(", ") }));
|
|
115
|
+
return 1;
|
|
116
|
+
}
|
|
117
|
+
for (const line of completionScript(shell).split("\n")) deps.out(line);
|
|
118
|
+
return 0;
|
|
119
|
+
}
|
|
120
|
+
export {
|
|
121
|
+
SHELLS,
|
|
122
|
+
completionScript,
|
|
123
|
+
isCompletionShell,
|
|
124
|
+
runCompletionCommand
|
|
125
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
ConfigError,
|
|
4
|
+
DEFAULT_MAX_STEPS,
|
|
5
|
+
bccliHome,
|
|
6
|
+
globalConfigPath,
|
|
7
|
+
loadConfig,
|
|
8
|
+
readCredentials,
|
|
9
|
+
readGlobalPlugins,
|
|
10
|
+
readJsonConfig,
|
|
11
|
+
removeCredential,
|
|
12
|
+
resolveModel,
|
|
13
|
+
saveCredential,
|
|
14
|
+
updateGlobalConfig
|
|
15
|
+
} from "./chunk-GIGWZFCY.js";
|
|
16
|
+
import "./chunk-QHNWI3OT.js";
|
|
17
|
+
export {
|
|
18
|
+
ConfigError,
|
|
19
|
+
DEFAULT_MAX_STEPS,
|
|
20
|
+
bccliHome,
|
|
21
|
+
globalConfigPath,
|
|
22
|
+
loadConfig,
|
|
23
|
+
readCredentials,
|
|
24
|
+
readGlobalPlugins,
|
|
25
|
+
readJsonConfig,
|
|
26
|
+
removeCredential,
|
|
27
|
+
resolveModel,
|
|
28
|
+
saveCredential,
|
|
29
|
+
updateGlobalConfig
|
|
30
|
+
};
|
|
@@ -9,9 +9,9 @@ import {
|
|
|
9
9
|
removeGlobalServer,
|
|
10
10
|
serversToStart,
|
|
11
11
|
setProjectTrust
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import "./chunk-
|
|
14
|
-
import "./chunk-
|
|
12
|
+
} from "./chunk-PZC2Q6MJ.js";
|
|
13
|
+
import "./chunk-GIGWZFCY.js";
|
|
14
|
+
import "./chunk-QHNWI3OT.js";
|
|
15
15
|
export {
|
|
16
16
|
addGlobalServer,
|
|
17
17
|
expandEnvVars,
|