@kodycodes/cli 3.12.0 → 3.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +34 -8
- package/dist/api-token.d.ts +3 -0
- package/dist/{auth-YYGBFLBJ.js → auth-W53UWFO3.js} +5 -4
- package/dist/bin.js +7 -6
- package/dist/bin.js.map +1 -1
- package/dist/{chunk-GY3OE2RC.js → chunk-6N43NCYD.js} +4 -4
- package/dist/{chunk-T2UI7XR3.js → chunk-CBP66P66.js} +6 -4
- package/dist/chunk-CBP66P66.js.map +6 -0
- package/dist/{chunk-TVDOUKXV.js → chunk-DINK4SRI.js} +3 -3
- package/dist/{chunk-LD6ND6Z3.js → chunk-EGN6A45D.js} +3 -3
- package/dist/{chunk-HTMEGJAJ.js → chunk-GZPPVADA.js} +21 -7
- package/dist/chunk-GZPPVADA.js.map +6 -0
- package/dist/{chunk-6XTF3YD5.js → chunk-J6BPLVAC.js} +6 -6
- package/dist/{chunk-NN3I7FJQ.js → chunk-LH4LA7K7.js} +111 -158
- package/dist/chunk-LH4LA7K7.js.map +6 -0
- package/dist/{chunk-7YASVU4K.js → chunk-QIYYQNTG.js} +32 -2
- package/dist/chunk-QIYYQNTG.js.map +6 -0
- package/dist/{chunk-AZ6UXLP6.js → chunk-SUR4SJXS.js} +31 -125
- package/dist/chunk-SUR4SJXS.js.map +6 -0
- package/dist/chunk-UHBPB4VH.js +255 -0
- package/dist/chunk-UHBPB4VH.js.map +6 -0
- package/dist/{chunk-PMHSFJLB.js → chunk-VUUVCVAG.js} +2 -2
- package/dist/{chunk-VZ5Q5FIR.js → chunk-XWJYP4UC.js} +3 -3
- package/dist/cli-credential.d.ts +86 -0
- package/dist/cli.d.ts +3 -23
- package/dist/cli.js +9 -8
- package/dist/{commands-LSLLUXHL.js → commands-PVXABMWK.js} +5 -4
- package/dist/commands-PVXABMWK.js.map +6 -0
- package/dist/{dev-command-W4EXL7SE.js → dev-command-LD3K6Z5M.js} +8 -7
- package/dist/dev-command-LD3K6Z5M.js.map +6 -0
- package/dist/{git-credential-M4RC3D5E.js → git-credential-B6Y4S66U.js} +6 -5
- package/dist/git-credential-B6Y4S66U.js.map +6 -0
- package/dist/{local-execute-ALYHHP6M.js → local-execute-NLJGGADH.js} +6 -5
- package/dist/{local-package-graph-GREJNPV5.js → local-package-graph-M7U7DQ2N.js} +4 -3
- package/dist/{local-package-run-LMJ5XYA5.js → local-package-run-7WA3AHDY.js} +8 -7
- package/dist/{mock-dep-resolve-ZSTZP6F7.js → mock-dep-resolve-7Y2L5VY4.js} +6 -5
- package/dist/mock-dep-resolve-7Y2L5VY4.js.map +6 -0
- package/dist/{mock-local-deps-WZDGHV7Z.js → mock-local-deps-CNFLGJSA.js} +5 -4
- package/dist/{open-api-client-CFFUM66I.js → open-api-client-5OCZAEJT.js} +4 -3
- package/dist/{remote-execute-3VJIHSVF.js → remote-execute-TDTE7T5U.js} +4 -3
- package/dist/remote-execute-TDTE7T5U.js.map +6 -0
- package/dist/{run-executor-7CL5RXNG.js → run-executor-RHSAGN2Z.js} +7 -6
- package/dist/run-executor-RHSAGN2Z.js.map +6 -0
- package/dist/{setup-git-RAWSZAB2.js → setup-git-IRNDXYSM.js} +5 -4
- package/dist/whoami-GETVNLDP.js +114 -0
- package/dist/whoami-GETVNLDP.js.map +6 -0
- package/dist/whoami.d.ts +22 -0
- package/package.json +1 -1
- package/dist/chunk-7YASVU4K.js.map +0 -6
- package/dist/chunk-AZ6UXLP6.js.map +0 -6
- package/dist/chunk-HTMEGJAJ.js.map +0 -6
- package/dist/chunk-NN3I7FJQ.js.map +0 -6
- package/dist/chunk-T2UI7XR3.js.map +0 -6
- package/dist/commands-LSLLUXHL.js.map +0 -6
- package/dist/dev-command-W4EXL7SE.js.map +0 -6
- package/dist/git-credential-M4RC3D5E.js.map +0 -6
- package/dist/mock-dep-resolve-ZSTZP6F7.js.map +0 -6
- package/dist/remote-execute-3VJIHSVF.js.map +0 -6
- package/dist/run-executor-7CL5RXNG.js.map +0 -6
- /package/dist/{auth-YYGBFLBJ.js.map → auth-W53UWFO3.js.map} +0 -0
- /package/dist/{chunk-GY3OE2RC.js.map → chunk-6N43NCYD.js.map} +0 -0
- /package/dist/{chunk-TVDOUKXV.js.map → chunk-DINK4SRI.js.map} +0 -0
- /package/dist/{chunk-LD6ND6Z3.js.map → chunk-EGN6A45D.js.map} +0 -0
- /package/dist/{chunk-6XTF3YD5.js.map → chunk-J6BPLVAC.js.map} +0 -0
- /package/dist/{chunk-PMHSFJLB.js.map → chunk-VUUVCVAG.js.map} +0 -0
- /package/dist/{chunk-VZ5Q5FIR.js.map → chunk-XWJYP4UC.js.map} +0 -0
- /package/dist/{local-execute-ALYHHP6M.js.map → local-execute-NLJGGADH.js.map} +0 -0
- /package/dist/{local-package-graph-GREJNPV5.js.map → local-package-graph-M7U7DQ2N.js.map} +0 -0
- /package/dist/{local-package-run-LMJ5XYA5.js.map → local-package-run-7WA3AHDY.js.map} +0 -0
- /package/dist/{mock-local-deps-WZDGHV7Z.js.map → mock-local-deps-CNFLGJSA.js.map} +0 -0
- /package/dist/{open-api-client-CFFUM66I.js.map → open-api-client-5OCZAEJT.js.map} +0 -0
- /package/dist/{setup-git-RAWSZAB2.js.map → setup-git-IRNDXYSM.js.map} +0 -0
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
} from "./chunk-SLNAWWQK.js";
|
|
18
18
|
import {
|
|
19
19
|
resolveLocalExecuteBearer
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-GZPPVADA.js";
|
|
21
21
|
import {
|
|
22
22
|
assertLocalExecuteNodeEngine
|
|
23
23
|
} from "./chunk-2XPH7L2P.js";
|
|
@@ -30,7 +30,7 @@ import {
|
|
|
30
30
|
parseCliScopesFlag,
|
|
31
31
|
refreshGitCredentialHelperPinIfNeeded,
|
|
32
32
|
resolveCliTokenLifetime
|
|
33
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-CBP66P66.js";
|
|
34
34
|
import {
|
|
35
35
|
orgEnvVar,
|
|
36
36
|
orgSlugFromFlag
|
|
@@ -43,14 +43,18 @@ import {
|
|
|
43
43
|
} from "./chunk-46IJPEID.js";
|
|
44
44
|
import {
|
|
45
45
|
cliBootstrapMintCall,
|
|
46
|
+
parseCredentialFlags,
|
|
47
|
+
readPackageVersion
|
|
48
|
+
} from "./chunk-SUR4SJXS.js";
|
|
49
|
+
import {
|
|
46
50
|
deleteStoredApiToken,
|
|
47
|
-
|
|
51
|
+
describeCliCredential,
|
|
48
52
|
loadStoredApiToken,
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
} from "./chunk-
|
|
53
|
+
noteActiveLoginCredential,
|
|
54
|
+
replaceStoredTokenCommand,
|
|
55
|
+
resetActiveCliCredential,
|
|
56
|
+
resolveCliCredential
|
|
57
|
+
} from "./chunk-UHBPB4VH.js";
|
|
54
58
|
import {
|
|
55
59
|
deleteCredentials,
|
|
56
60
|
listStoredOrgs,
|
|
@@ -151,6 +155,13 @@ Usage:
|
|
|
151
155
|
Turn it on at https://kody.codes/account/experiments (guide:
|
|
152
156
|
https://kody.codes/docs/execution-contexts).
|
|
153
157
|
|
|
158
|
+
Profiles (scoped identities for your agents and sub-agents) are an
|
|
159
|
+
experiment too: turn it on at https://kody.codes/account/experiments, then
|
|
160
|
+
\`kody execute\` a module that calls \`profileCreate\`, \`profileList\`, or
|
|
161
|
+
\`profileRevoke\`, and share a package with one through
|
|
162
|
+
\`packageCollaboratorSet\` with \`profile_id\` (guide:
|
|
163
|
+
https://kody.codes/docs/profiles).
|
|
164
|
+
|
|
154
165
|
kody install configures running local MCP clients (Cursor, Claude Desktop,
|
|
155
166
|
VS Code, Goose, and others). For web-based clients (ChatGPT, Claude.ai, Grok),
|
|
156
167
|
see ${onboardingUrl(defaultMcpUrl)}
|
|
@@ -300,12 +311,15 @@ ${orgBlock}
|
|
|
300
311
|
with \`--json\`.
|
|
301
312
|
|
|
302
313
|
--token / ${apiTokenEnvVar}
|
|
303
|
-
Scoped API token (preferred via env).
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
314
|
+
Scoped API token (preferred via env). One resolver picks the
|
|
315
|
+
credential, and \`kody whoami\` reports that pick:
|
|
316
|
+
whoami, api, package, execute --local, context, daemon, dev:
|
|
317
|
+
--token, ${apiTokenEnvVar}, stored API token, kody login.
|
|
318
|
+
search and cloud execute: --token, kody login (MCP),
|
|
319
|
+
${apiTokenEnvVar}, stored API token.
|
|
320
|
+
\`kody login\` does not replace a stored API token; replace it
|
|
321
|
+
with \`kody auth bootstrap --lifetime short --scopes <list>\`
|
|
322
|
+
or clear it with \`kody logout\`.
|
|
309
323
|
Prefer \`cliCredentialBootstrap\` then \`auth bootstrap\`
|
|
310
324
|
(\`--lifetime short|long\`). CI/headless: \`tokenCreate\` with
|
|
311
325
|
\`org:execute\` plus the capability scopes you need.
|
|
@@ -901,6 +915,7 @@ async function runCli(argv = process.argv.slice(2), io = {}) {
|
|
|
901
915
|
});
|
|
902
916
|
}
|
|
903
917
|
const jsonFlag = argvIncludesJsonFlag(argv);
|
|
918
|
+
resetActiveCliCredential();
|
|
904
919
|
try {
|
|
905
920
|
const parsed = resolveCommand(argv);
|
|
906
921
|
const helpMcpUrl = mcpUrlFrom({
|
|
@@ -1010,7 +1025,7 @@ async function dispatch(parsed, write, writeErr) {
|
|
|
1010
1025
|
const apiUrl = apiUrlFrom({
|
|
1011
1026
|
apiUrl: typeof parsed.values["api-url"] === "string" ? parsed.values["api-url"] : void 0
|
|
1012
1027
|
});
|
|
1013
|
-
const { runExecutionContextCommand } = await import("./commands-
|
|
1028
|
+
const { runExecutionContextCommand } = await import("./commands-PVXABMWK.js");
|
|
1014
1029
|
return await runExecutionContextCommand({
|
|
1015
1030
|
command: parsed.command,
|
|
1016
1031
|
positionals: parsed.positionals,
|
|
@@ -1040,7 +1055,7 @@ async function dispatch(parsed, write, writeErr) {
|
|
|
1040
1055
|
});
|
|
1041
1056
|
}
|
|
1042
1057
|
case "login": {
|
|
1043
|
-
const { login, loginWithDevice } = await import("./auth-
|
|
1058
|
+
const { login, loginWithDevice } = await import("./auth-W53UWFO3.js");
|
|
1044
1059
|
const openBrowser = parsed.values["no-browser"] !== true;
|
|
1045
1060
|
const lifetimeOption = typeof parsed.values.lifetime === "string" ? {
|
|
1046
1061
|
lifetime: parsed.values.lifetime === "short" ? "short" : "long"
|
|
@@ -1057,6 +1072,7 @@ async function dispatch(parsed, write, writeErr) {
|
|
|
1057
1072
|
onDeviceCode: (prompt) => write(formatDeviceLoginNotice(prompt))
|
|
1058
1073
|
});
|
|
1059
1074
|
write(formatLoginSuccess(result2));
|
|
1075
|
+
write(storedApiTokenAfterLoginNotice(loginApiUrl));
|
|
1060
1076
|
return 0;
|
|
1061
1077
|
}
|
|
1062
1078
|
const headlessReason = openBrowser ? detectHeadlessLoginReason() : null;
|
|
@@ -1075,6 +1091,7 @@ async function dispatch(parsed, write, writeErr) {
|
|
|
1075
1091
|
}
|
|
1076
1092
|
});
|
|
1077
1093
|
write(formatLoginSuccess(result));
|
|
1094
|
+
write(storedApiTokenAfterLoginNotice(loginApiUrl));
|
|
1078
1095
|
return 0;
|
|
1079
1096
|
}
|
|
1080
1097
|
case "logout": {
|
|
@@ -1176,6 +1193,12 @@ async function dispatch(parsed, write, writeErr) {
|
|
|
1176
1193
|
} else {
|
|
1177
1194
|
lines.push(`api: ${apiUrl}`, `stored API token: no`);
|
|
1178
1195
|
}
|
|
1196
|
+
const inUse = resolveCliCredential({ mcpUrl, apiUrl });
|
|
1197
|
+
if (inUse) {
|
|
1198
|
+
lines.push(
|
|
1199
|
+
`credential in use (api, whoami, package): ${describeCliCredential(inUse)}`
|
|
1200
|
+
);
|
|
1201
|
+
}
|
|
1179
1202
|
lines.push("");
|
|
1180
1203
|
write(lines.join("\n"));
|
|
1181
1204
|
return 0;
|
|
@@ -1270,7 +1293,7 @@ async function dispatch(parsed, write, writeErr) {
|
|
|
1270
1293
|
parseGitCredentialAction,
|
|
1271
1294
|
parseGitCredentialInput,
|
|
1272
1295
|
readGitCredentialStdin
|
|
1273
|
-
} = await import("./git-credential-
|
|
1296
|
+
} = await import("./git-credential-B6Y4S66U.js");
|
|
1274
1297
|
const action = parseGitCredentialAction(parsed.positionals);
|
|
1275
1298
|
const raw = await readGitCredentialStdin(process.stdin);
|
|
1276
1299
|
const output = await handleGitCredential({
|
|
@@ -1330,79 +1353,15 @@ async function dispatch(parsed, write, writeErr) {
|
|
|
1330
1353
|
if (mock.started) await mock.server.close();
|
|
1331
1354
|
}
|
|
1332
1355
|
}
|
|
1333
|
-
|
|
1356
|
+
const { runWhoami } = await import("./whoami-GETVNLDP.js");
|
|
1357
|
+
return await runWhoami({
|
|
1334
1358
|
tokenValues,
|
|
1335
1359
|
mcpUrl,
|
|
1336
1360
|
apiUrl,
|
|
1337
|
-
|
|
1361
|
+
json,
|
|
1362
|
+
write,
|
|
1338
1363
|
...org ? { org } : {}
|
|
1339
|
-
})) {
|
|
1340
|
-
const { whoamiWithApiToken: whoamiWithApiToken2 } = await import("./open-api-client-CFFUM66I.js");
|
|
1341
|
-
const identity2 = await whoamiWithApiToken2({
|
|
1342
|
-
token: requireApiToken(tokenValues, process.env, "whoami", {
|
|
1343
|
-
apiUrl
|
|
1344
|
-
}),
|
|
1345
|
-
apiUrl,
|
|
1346
|
-
...org ? { org } : {}
|
|
1347
|
-
});
|
|
1348
|
-
if (json) {
|
|
1349
|
-
write(`${JSON.stringify(identity2, null, 2)}
|
|
1350
|
-
`);
|
|
1351
|
-
return 0;
|
|
1352
|
-
}
|
|
1353
|
-
const scopeLine = identity2.token.scopes.join(", ") || "(none)";
|
|
1354
|
-
const userLine2 = identity2.user ? `${identity2.user.displayName} <${identity2.user.email}>` : "(account:read not on this token)";
|
|
1355
|
-
write(
|
|
1356
|
-
[
|
|
1357
|
-
`api: ${identity2.apiUrl}`,
|
|
1358
|
-
`auth: API token (${identity2.token.id})`,
|
|
1359
|
-
`user: ${userLine2}`,
|
|
1360
|
-
`scopes: ${scopeLine}`,
|
|
1361
|
-
`expires: ${identity2.token.expiresAt ?? "unknown"}`,
|
|
1362
|
-
""
|
|
1363
|
-
].join("\n")
|
|
1364
|
-
);
|
|
1365
|
-
return 0;
|
|
1366
|
-
}
|
|
1367
|
-
const { ensureOpenApiCredentials } = await import("./auth-YYGBFLBJ.js");
|
|
1368
|
-
const credentials = await ensureOpenApiCredentials({
|
|
1369
|
-
mcpUrl,
|
|
1370
|
-
org,
|
|
1371
|
-
apiUrl
|
|
1372
1364
|
});
|
|
1373
|
-
const { whoamiWithApiToken } = await import("./open-api-client-CFFUM66I.js");
|
|
1374
|
-
const identity = await whoamiWithApiToken({
|
|
1375
|
-
token: credentials.accessToken,
|
|
1376
|
-
apiUrl,
|
|
1377
|
-
...org ? { org } : {}
|
|
1378
|
-
});
|
|
1379
|
-
if (json) {
|
|
1380
|
-
write(
|
|
1381
|
-
`${JSON.stringify(
|
|
1382
|
-
{
|
|
1383
|
-
apiUrl: identity.apiUrl,
|
|
1384
|
-
org: credentials.org ?? null,
|
|
1385
|
-
scope: identity.token.scopes,
|
|
1386
|
-
token: identity.token,
|
|
1387
|
-
user: identity.user
|
|
1388
|
-
},
|
|
1389
|
-
null,
|
|
1390
|
-
2
|
|
1391
|
-
)}
|
|
1392
|
-
`
|
|
1393
|
-
);
|
|
1394
|
-
return 0;
|
|
1395
|
-
}
|
|
1396
|
-
const orgLine = credentials.org ? `
|
|
1397
|
-
org: ${credentials.org}` : "";
|
|
1398
|
-
const userLine = identity.user ? `${identity.user.displayName} <${identity.user.email}>` : "(no profile)";
|
|
1399
|
-
write(
|
|
1400
|
-
`Logged in at ${identity.apiUrl}${orgLine}
|
|
1401
|
-
user: ${userLine}
|
|
1402
|
-
scopes: ${identity.token.scopes.join(", ") || "(none)"}
|
|
1403
|
-
`
|
|
1404
|
-
);
|
|
1405
|
-
return 0;
|
|
1406
1365
|
}
|
|
1407
1366
|
case "search": {
|
|
1408
1367
|
const { resolveTarget } = await import("./target-UQBEV64U.js");
|
|
@@ -1424,7 +1383,7 @@ scopes: ${identity.token.scopes.join(", ") || "(none)"}
|
|
|
1424
1383
|
});
|
|
1425
1384
|
apiUrl = mock.apiUrl;
|
|
1426
1385
|
closeMock = mock.started ? () => mock.server.close() : void 0;
|
|
1427
|
-
const { searchWithApiToken: searchWithApiToken2 } = await import("./open-api-client-
|
|
1386
|
+
const { searchWithApiToken: searchWithApiToken2 } = await import("./open-api-client-5OCZAEJT.js");
|
|
1428
1387
|
const result2 = await searchWithApiToken2({
|
|
1429
1388
|
token: mock.token,
|
|
1430
1389
|
apiUrl,
|
|
@@ -1436,18 +1395,17 @@ scopes: ${identity.token.scopes.join(", ") || "(none)"}
|
|
|
1436
1395
|
write(formatToolResult(result2, json));
|
|
1437
1396
|
return result2.isError ? 1 : 0;
|
|
1438
1397
|
}
|
|
1439
|
-
|
|
1398
|
+
const searchCredential = resolveCliCredential({
|
|
1440
1399
|
tokenValues,
|
|
1441
1400
|
mcpUrl,
|
|
1442
1401
|
apiUrl,
|
|
1443
|
-
|
|
1402
|
+
purpose: "session",
|
|
1444
1403
|
...org ? { org } : {}
|
|
1445
|
-
})
|
|
1446
|
-
|
|
1404
|
+
});
|
|
1405
|
+
if (searchCredential?.token) {
|
|
1406
|
+
const { searchWithApiToken: searchWithApiToken2 } = await import("./open-api-client-5OCZAEJT.js");
|
|
1447
1407
|
const result2 = await searchWithApiToken2({
|
|
1448
|
-
token:
|
|
1449
|
-
apiUrl
|
|
1450
|
-
}),
|
|
1408
|
+
token: searchCredential.token,
|
|
1451
1409
|
apiUrl,
|
|
1452
1410
|
...org ? { org } : {},
|
|
1453
1411
|
query: query || void 0,
|
|
@@ -1458,13 +1416,14 @@ scopes: ${identity.token.scopes.join(", ") || "(none)"}
|
|
|
1458
1416
|
write(formatToolResult(result2, json));
|
|
1459
1417
|
return result2.isError ? 1 : 0;
|
|
1460
1418
|
}
|
|
1461
|
-
const { ensureOpenApiCredentials } = await import("./auth-
|
|
1419
|
+
const { ensureOpenApiCredentials } = await import("./auth-W53UWFO3.js");
|
|
1462
1420
|
const credentials = await ensureOpenApiCredentials({
|
|
1463
1421
|
mcpUrl,
|
|
1464
1422
|
org,
|
|
1465
1423
|
apiUrl
|
|
1466
1424
|
});
|
|
1467
|
-
|
|
1425
|
+
noteActiveLoginCredential({ login: credentials, purpose: "session" });
|
|
1426
|
+
const { searchWithApiToken } = await import("./open-api-client-5OCZAEJT.js");
|
|
1468
1427
|
const result = await searchWithApiToken({
|
|
1469
1428
|
token: credentials.accessToken,
|
|
1470
1429
|
apiUrl,
|
|
@@ -1522,7 +1481,7 @@ scopes: ${identity.token.scopes.join(", ") || "(none)"}
|
|
|
1522
1481
|
(value) => typeof value === "string"
|
|
1523
1482
|
) : typeof parsed.values.credential === "string" ? [parsed.values.credential] : void 0
|
|
1524
1483
|
);
|
|
1525
|
-
const executeRouting = (await import("./remote-execute-
|
|
1484
|
+
const executeRouting = (await import("./remote-execute-TDTE7T5U.js")).executeRoutingFromFlags(parsed.values);
|
|
1526
1485
|
if (executeRouting && local) {
|
|
1527
1486
|
writeErr(
|
|
1528
1487
|
"--context, --fallback, --requires, and --chain route cloud execute; drop --local.\n"
|
|
@@ -1578,7 +1537,7 @@ scopes: ${identity.token.scopes.join(", ") || "(none)"}
|
|
|
1578
1537
|
apiUrl = mock.apiUrl;
|
|
1579
1538
|
mockToken = mock.token;
|
|
1580
1539
|
closeMock = mock.started ? () => mock.server.close() : void 0;
|
|
1581
|
-
const { tryResolveMockDepResolve } = await import("./mock-dep-resolve-
|
|
1540
|
+
const { tryResolveMockDepResolve } = await import("./mock-dep-resolve-7Y2L5VY4.js");
|
|
1582
1541
|
mockDepResolve = await tryResolveMockDepResolve({
|
|
1583
1542
|
tokenValues,
|
|
1584
1543
|
apiUrl: prodApiUrl,
|
|
@@ -1587,7 +1546,7 @@ scopes: ${identity.token.scopes.join(", ") || "(none)"}
|
|
|
1587
1546
|
});
|
|
1588
1547
|
}
|
|
1589
1548
|
if (localPackageRun) {
|
|
1590
|
-
const { buildLocalPackageContext, runLocalPackageModule } = await import("./local-package-run-
|
|
1549
|
+
const { buildLocalPackageContext, runLocalPackageModule } = await import("./local-package-run-7WA3AHDY.js");
|
|
1591
1550
|
const result2 = await runLocalPackageModule({
|
|
1592
1551
|
modulePath: localPackageRun.modulePath,
|
|
1593
1552
|
params: args.params,
|
|
@@ -1615,13 +1574,14 @@ scopes: ${identity.token.scopes.join(", ") || "(none)"}
|
|
|
1615
1574
|
write(formatToolResult(result2, json));
|
|
1616
1575
|
return result2.isError ? 1 : 0;
|
|
1617
1576
|
}
|
|
1618
|
-
const
|
|
1577
|
+
const cloudCredential = local ? null : resolveCliCredential({
|
|
1619
1578
|
tokenValues,
|
|
1620
1579
|
mcpUrl,
|
|
1621
1580
|
apiUrl,
|
|
1622
|
-
|
|
1581
|
+
purpose: "session",
|
|
1623
1582
|
...org ? { org } : {}
|
|
1624
1583
|
});
|
|
1584
|
+
const cloudToken = cloudCredential?.token ?? null;
|
|
1625
1585
|
let packageRootForMocks;
|
|
1626
1586
|
if (target === "mock") {
|
|
1627
1587
|
try {
|
|
@@ -1631,7 +1591,7 @@ scopes: ${identity.token.scopes.join(", ") || "(none)"}
|
|
|
1631
1591
|
packageRootForMocks = void 0;
|
|
1632
1592
|
}
|
|
1633
1593
|
}
|
|
1634
|
-
const result = local ? await (await import("./local-execute-
|
|
1594
|
+
const result = local ? await (await import("./local-execute-NLJGGADH.js")).runLocalExecute({
|
|
1635
1595
|
code: args.code,
|
|
1636
1596
|
...modulePath !== void 0 ? { modulePath } : {},
|
|
1637
1597
|
params: args.params,
|
|
@@ -1653,28 +1613,27 @@ scopes: ${identity.token.scopes.join(", ") || "(none)"}
|
|
|
1653
1613
|
allowPrivateNetwork: parsed.values["allow-private-network"] === true,
|
|
1654
1614
|
onStatus: (message) => writeErr(`${message}
|
|
1655
1615
|
`)
|
|
1656
|
-
}) :
|
|
1616
|
+
}) : cloudToken ? await (await import("./remote-execute-TDTE7T5U.js")).runRemoteExecuteWithToken({
|
|
1657
1617
|
code: typeof args.code === "string" ? args.code : void 0,
|
|
1658
1618
|
params: args.params,
|
|
1659
1619
|
conversationId: args.conversationId,
|
|
1660
1620
|
...credentials !== void 0 ? { credentials } : {},
|
|
1661
1621
|
...executeRouting ? { routing: executeRouting } : {},
|
|
1662
|
-
token:
|
|
1663
|
-
tokenValues,
|
|
1664
|
-
process.env,
|
|
1665
|
-
"execute with an API token",
|
|
1666
|
-
{ apiUrl }
|
|
1667
|
-
),
|
|
1622
|
+
token: cloudToken,
|
|
1668
1623
|
apiUrl,
|
|
1669
1624
|
...org ? { org } : {}
|
|
1670
1625
|
}) : await (async () => {
|
|
1671
|
-
const { ensureOpenApiCredentials } = await import("./auth-
|
|
1626
|
+
const { ensureOpenApiCredentials } = await import("./auth-W53UWFO3.js");
|
|
1672
1627
|
const session = await ensureOpenApiCredentials({
|
|
1673
1628
|
mcpUrl,
|
|
1674
1629
|
org,
|
|
1675
1630
|
apiUrl
|
|
1676
1631
|
});
|
|
1677
|
-
|
|
1632
|
+
noteActiveLoginCredential({
|
|
1633
|
+
login: session,
|
|
1634
|
+
purpose: "session"
|
|
1635
|
+
});
|
|
1636
|
+
return (await import("./remote-execute-TDTE7T5U.js")).runRemoteExecuteWithToken({
|
|
1678
1637
|
code: typeof args.code === "string" ? args.code : void 0,
|
|
1679
1638
|
params: args.params,
|
|
1680
1639
|
conversationId: args.conversationId,
|
|
@@ -1689,7 +1648,7 @@ scopes: ${identity.token.scopes.join(", ") || "(none)"}
|
|
|
1689
1648
|
return result.isError ? 1 : 0;
|
|
1690
1649
|
} catch (error) {
|
|
1691
1650
|
if (json && local) {
|
|
1692
|
-
const { LocalPackageGraphError, packageGraphErrorToolResult } = await import("./local-package-graph-
|
|
1651
|
+
const { LocalPackageGraphError, packageGraphErrorToolResult } = await import("./local-package-graph-M7U7DQ2N.js");
|
|
1693
1652
|
if (error instanceof LocalPackageGraphError) {
|
|
1694
1653
|
const redacted = redactError(error).message;
|
|
1695
1654
|
const result = packageGraphErrorToolResult(error);
|
|
@@ -1719,7 +1678,7 @@ scopes: ${identity.token.scopes.join(", ") || "(none)"}
|
|
|
1719
1678
|
runDevServe,
|
|
1720
1679
|
runDevWebhook,
|
|
1721
1680
|
tryAttachedDevFetch
|
|
1722
|
-
} = await import("./dev-command-
|
|
1681
|
+
} = await import("./dev-command-LD3K6Z5M.js");
|
|
1723
1682
|
const target = resolveTarget({
|
|
1724
1683
|
command: "dev",
|
|
1725
1684
|
flag: typeof parsed.values.target === "string" ? parsed.values.target : void 0
|
|
@@ -1745,8 +1704,8 @@ scopes: ${identity.token.scopes.join(", ") || "(none)"}
|
|
|
1745
1704
|
{ callOpenApiOperation, formatOpenApiHttpDebugLine },
|
|
1746
1705
|
{ parsePackageCheckResult, PublishChecksAuthError }
|
|
1747
1706
|
] = await Promise.all([
|
|
1748
|
-
import("./open-api-client-
|
|
1749
|
-
import("./dev-command-
|
|
1707
|
+
import("./open-api-client-5OCZAEJT.js"),
|
|
1708
|
+
import("./dev-command-LD3K6Z5M.js")
|
|
1750
1709
|
]);
|
|
1751
1710
|
let token2;
|
|
1752
1711
|
try {
|
|
@@ -1860,7 +1819,7 @@ scopes: ${identity.token.scopes.join(", ") || "(none)"}
|
|
|
1860
1819
|
purpose: "kody dev",
|
|
1861
1820
|
...org ? { org } : {}
|
|
1862
1821
|
}) : "mock";
|
|
1863
|
-
const mockDepResolve = target === "mock" ? await (await import("./mock-dep-resolve-
|
|
1822
|
+
const mockDepResolve = target === "mock" ? await (await import("./mock-dep-resolve-7Y2L5VY4.js")).tryResolveMockDepResolve({
|
|
1864
1823
|
tokenValues,
|
|
1865
1824
|
apiUrl: prodApiUrl,
|
|
1866
1825
|
mcpUrl,
|
|
@@ -2001,7 +1960,7 @@ scopes: ${identity.token.scopes.join(", ") || "(none)"}
|
|
|
2001
1960
|
const params = parseApiParamsJson(
|
|
2002
1961
|
typeof parsed.values.params === "string" ? parsed.values.params : void 0
|
|
2003
1962
|
);
|
|
2004
|
-
const { callOpenApiOperation } = await import("./open-api-client-
|
|
1963
|
+
const { callOpenApiOperation } = await import("./open-api-client-5OCZAEJT.js");
|
|
2005
1964
|
const result = await callOpenApiOperation({
|
|
2006
1965
|
operationId,
|
|
2007
1966
|
params,
|
|
@@ -2036,7 +1995,7 @@ scopes: ${identity.token.scopes.join(", ") || "(none)"}
|
|
|
2036
1995
|
mcpUrl,
|
|
2037
1996
|
org
|
|
2038
1997
|
});
|
|
2039
|
-
const { callOpenApiOperation: callOpenApiOperation2 } = await import("./open-api-client-
|
|
1998
|
+
const { callOpenApiOperation: callOpenApiOperation2 } = await import("./open-api-client-5OCZAEJT.js");
|
|
2040
1999
|
write(
|
|
2041
2000
|
await runPackageCollaboratorPlan({
|
|
2042
2001
|
plan,
|
|
@@ -2062,7 +2021,7 @@ ${packageCollaboratorUsage}`
|
|
|
2062
2021
|
positional: parsed.positionals[1],
|
|
2063
2022
|
paramsJson: typeof parsed.values.params === "string" ? parsed.values.params : void 0
|
|
2064
2023
|
});
|
|
2065
|
-
const { callOpenApiOperation } = await import("./open-api-client-
|
|
2024
|
+
const { callOpenApiOperation } = await import("./open-api-client-5OCZAEJT.js");
|
|
2066
2025
|
const publishToken = await accessTokenForOpenApi({
|
|
2067
2026
|
tokenValues,
|
|
2068
2027
|
apiUrl,
|
|
@@ -2203,7 +2162,7 @@ function attachExecuteCommonArgs(args, input) {
|
|
|
2203
2162
|
return args;
|
|
2204
2163
|
}
|
|
2205
2164
|
async function runAuthSetupGit(input) {
|
|
2206
|
-
const { authSetupGit, setupGitDefaultScopes } = await import("./setup-git-
|
|
2165
|
+
const { authSetupGit, setupGitDefaultScopes } = await import("./setup-git-IRNDXYSM.js");
|
|
2207
2166
|
const apiUrl = apiUrlFrom({
|
|
2208
2167
|
apiUrl: typeof input.values["api-url"] === "string" ? input.values["api-url"] : void 0
|
|
2209
2168
|
});
|
|
@@ -2260,7 +2219,7 @@ async function runAuthSetupGit(input) {
|
|
|
2260
2219
|
return 0;
|
|
2261
2220
|
}
|
|
2262
2221
|
async function runAuthRemoveGit(input) {
|
|
2263
|
-
const { authRemoveGit, formatAuthRemoveGitReport } = await import("./setup-git-
|
|
2222
|
+
const { authRemoveGit, formatAuthRemoveGitReport } = await import("./setup-git-IRNDXYSM.js");
|
|
2264
2223
|
const apiUrl = apiUrlFrom({
|
|
2265
2224
|
apiUrl: typeof input.values["api-url"] === "string" ? input.values["api-url"] : void 0
|
|
2266
2225
|
});
|
|
@@ -2273,22 +2232,16 @@ async function runAuthRemoveGit(input) {
|
|
|
2273
2232
|
}
|
|
2274
2233
|
function bootstrapMinter(input) {
|
|
2275
2234
|
return async (params) => {
|
|
2276
|
-
|
|
2235
|
+
const minter = resolveCliCredential({
|
|
2277
2236
|
tokenValues: input.tokenValues,
|
|
2278
2237
|
mcpUrl: input.mcpUrl,
|
|
2279
2238
|
apiUrl: input.apiUrl,
|
|
2280
|
-
|
|
2239
|
+
purpose: "mint",
|
|
2281
2240
|
...input.org ? { org: input.org } : {}
|
|
2282
|
-
})
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
"auth bootstrap --scopes",
|
|
2287
|
-
{
|
|
2288
|
-
apiUrl: input.apiUrl
|
|
2289
|
-
}
|
|
2290
|
-
);
|
|
2291
|
-
const { callOpenApiOperation } = await import("./open-api-client-CFFUM66I.js");
|
|
2241
|
+
});
|
|
2242
|
+
if (minter?.token) {
|
|
2243
|
+
const token = minter.token;
|
|
2244
|
+
const { callOpenApiOperation } = await import("./open-api-client-5OCZAEJT.js");
|
|
2292
2245
|
try {
|
|
2293
2246
|
return await callOpenApiOperation({
|
|
2294
2247
|
token,
|
|
@@ -2306,16 +2259,14 @@ function bootstrapMinter(input) {
|
|
|
2306
2259
|
throw error;
|
|
2307
2260
|
}
|
|
2308
2261
|
}
|
|
2309
|
-
if (
|
|
2310
|
-
|
|
2311
|
-
})) {
|
|
2312
|
-
const { ensureOpenApiCredentials } = await import("./auth-YYGBFLBJ.js");
|
|
2262
|
+
if (minter) {
|
|
2263
|
+
const { ensureOpenApiCredentials } = await import("./auth-W53UWFO3.js");
|
|
2313
2264
|
const session = await ensureOpenApiCredentials({
|
|
2314
2265
|
mcpUrl: input.mcpUrl,
|
|
2315
2266
|
apiUrl: input.apiUrl,
|
|
2316
2267
|
...input.org ? { org: input.org } : {}
|
|
2317
2268
|
});
|
|
2318
|
-
const { callOpenApiOperation } = await import("./open-api-client-
|
|
2269
|
+
const { callOpenApiOperation } = await import("./open-api-client-5OCZAEJT.js");
|
|
2319
2270
|
return callOpenApiOperation({
|
|
2320
2271
|
operationId: cliCredentialBootstrapOperationId,
|
|
2321
2272
|
params,
|
|
@@ -2335,18 +2286,20 @@ function tokenFlagValues(values) {
|
|
|
2335
2286
|
};
|
|
2336
2287
|
}
|
|
2337
2288
|
async function accessTokenForOpenApi(input) {
|
|
2338
|
-
const
|
|
2289
|
+
const credential = resolveCliCredential({
|
|
2339
2290
|
tokenValues: input.tokenValues,
|
|
2340
|
-
|
|
2341
|
-
|
|
2291
|
+
apiUrl: input.apiUrl,
|
|
2292
|
+
mcpUrl: input.mcpUrl,
|
|
2293
|
+
...input.org ? { org: input.org } : {}
|
|
2342
2294
|
});
|
|
2343
|
-
if (
|
|
2344
|
-
const { ensureOpenApiCredentials } = await import("./auth-
|
|
2295
|
+
if (credential?.token) return credential.token;
|
|
2296
|
+
const { ensureOpenApiCredentials } = await import("./auth-W53UWFO3.js");
|
|
2345
2297
|
const session = await ensureOpenApiCredentials({
|
|
2346
2298
|
mcpUrl: input.mcpUrl,
|
|
2347
2299
|
apiUrl: input.apiUrl,
|
|
2348
2300
|
...input.org ? { org: input.org } : {}
|
|
2349
2301
|
});
|
|
2302
|
+
noteActiveLoginCredential({ login: session });
|
|
2350
2303
|
return session.accessToken;
|
|
2351
2304
|
}
|
|
2352
2305
|
function parseApiParamsJson(paramsJson) {
|
|
@@ -2394,21 +2347,21 @@ async function resolvePackagePublishTarget(params, call) {
|
|
|
2394
2347
|
const { kody_id: _name, ...rest } = params;
|
|
2395
2348
|
return { ...rest, package_id: matches[0].package_id };
|
|
2396
2349
|
}
|
|
2397
|
-
function
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
apiUrl: input.apiUrl,
|
|
2404
|
-
loadApiToken: input.loadApiToken
|
|
2405
|
-
})) {
|
|
2406
|
-
return false;
|
|
2350
|
+
function storedApiTokenAfterLoginNotice(apiUrl, loadApiToken = loadStoredApiToken) {
|
|
2351
|
+
let stored;
|
|
2352
|
+
try {
|
|
2353
|
+
stored = loadApiToken(apiUrl);
|
|
2354
|
+
} catch {
|
|
2355
|
+
return "";
|
|
2407
2356
|
}
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2357
|
+
if (!stored) return "";
|
|
2358
|
+
const label = describeCliCredential({
|
|
2359
|
+
source: "stored-api-token",
|
|
2360
|
+
token: stored.token,
|
|
2361
|
+
stored
|
|
2362
|
+
});
|
|
2363
|
+
return `Note: a ${label} is still stored and \`kody login\` does not replace it. api, package, execute --local, context, daemon, and dev keep using it (scopes: ${stored.scopes?.join(", ") || "unknown"}). To change its scopes run \`${replaceStoredTokenCommand(stored.scopes)}\`, or \`kody logout\` to clear it. Check with \`kody whoami\`.
|
|
2364
|
+
`;
|
|
2412
2365
|
}
|
|
2413
2366
|
|
|
2414
2367
|
export {
|
|
@@ -2424,6 +2377,6 @@ export {
|
|
|
2424
2377
|
parseApiParamsJson,
|
|
2425
2378
|
packagePublishParams,
|
|
2426
2379
|
resolvePackagePublishTarget,
|
|
2427
|
-
|
|
2380
|
+
storedApiTokenAfterLoginNotice
|
|
2428
2381
|
};
|
|
2429
|
-
//# sourceMappingURL=chunk-
|
|
2382
|
+
//# sourceMappingURL=chunk-LH4LA7K7.js.map
|