lua-cli 3.17.1 → 3.17.3
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/api-exports.d.ts +8 -8
- package/dist/api-exports.js.map +1 -1
- package/dist/index.js +213 -241
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/template/lua.skill.yaml +10 -4
- package/template/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -22224,6 +22224,23 @@ async function gitUserConfigured(cwd) {
|
|
|
22224
22224
|
};
|
|
22225
22225
|
}
|
|
22226
22226
|
__name(gitUserConfigured, "gitUserConfigured");
|
|
22227
|
+
async function getRemoteOriginUrl(cwd) {
|
|
22228
|
+
try {
|
|
22229
|
+
const { stdout, code } = await runGit([
|
|
22230
|
+
"config",
|
|
22231
|
+
"--get",
|
|
22232
|
+
"remote.origin.url"
|
|
22233
|
+
], {
|
|
22234
|
+
cwd
|
|
22235
|
+
});
|
|
22236
|
+
if (code !== 0) return null;
|
|
22237
|
+
const trimmed = stdout.trim();
|
|
22238
|
+
return trimmed.length > 0 ? trimmed : null;
|
|
22239
|
+
} catch {
|
|
22240
|
+
return null;
|
|
22241
|
+
}
|
|
22242
|
+
}
|
|
22243
|
+
__name(getRemoteOriginUrl, "getRemoteOriginUrl");
|
|
22227
22244
|
async function getCommitSha(cwd) {
|
|
22228
22245
|
try {
|
|
22229
22246
|
const { stdout, code } = await runGit([
|
|
@@ -22305,39 +22322,17 @@ async function clearAuth(provider) {
|
|
|
22305
22322
|
__name(clearAuth, "clearAuth");
|
|
22306
22323
|
|
|
22307
22324
|
// src/utils/git-providers/github-provider.ts
|
|
22308
|
-
import { createServer } from "http";
|
|
22309
|
-
import { randomBytes as randomBytes2 } from "crypto";
|
|
22310
22325
|
import { request } from "undici";
|
|
22311
|
-
import open from "open";
|
|
22312
22326
|
|
|
22313
22327
|
// src/config/git-providers.constants.ts
|
|
22314
22328
|
var GITHUB_CLIENT_ID = "Ov23lipe1jgBlCsoi9OO";
|
|
22315
22329
|
var GITHUB_OAUTH_BASE_URL = "https://github.com";
|
|
22316
22330
|
var GITHUB_API_BASE_URL = "https://api.github.com";
|
|
22317
22331
|
var GITHUB_OAUTH_SCOPE = "repo";
|
|
22318
|
-
var LOOPBACK_PORT_MIN = 49152;
|
|
22319
|
-
var LOOPBACK_PORT_MAX = 65535;
|
|
22320
|
-
var LOOPBACK_PORT_ATTEMPTS = 3;
|
|
22321
|
-
var LOOPBACK_TIMEOUT_MS = 5 * 60 * 1e3;
|
|
22322
22332
|
var DEVICE_FLOW_DEFAULT_INTERVAL_MS = 5e3;
|
|
22323
22333
|
var DEVICE_FLOW_SLOW_DOWN_INCREMENT_MS = 5e3;
|
|
22324
22334
|
var PUSH_TIMEOUT_MS = 2 * 60 * 1e3;
|
|
22325
22335
|
|
|
22326
|
-
// src/utils/pkce.ts
|
|
22327
|
-
import { createHash as createHash2, randomBytes } from "crypto";
|
|
22328
|
-
function generateCodeVerifier() {
|
|
22329
|
-
return base64url(randomBytes(64));
|
|
22330
|
-
}
|
|
22331
|
-
__name(generateCodeVerifier, "generateCodeVerifier");
|
|
22332
|
-
function computeCodeChallenge(verifier) {
|
|
22333
|
-
return base64url(createHash2("sha256").update(verifier).digest());
|
|
22334
|
-
}
|
|
22335
|
-
__name(computeCodeChallenge, "computeCodeChallenge");
|
|
22336
|
-
function base64url(buf) {
|
|
22337
|
-
return buf.toString("base64").replace(/=+$/, "").replace(/\+/g, "-").replace(/\//g, "_");
|
|
22338
|
-
}
|
|
22339
|
-
__name(base64url, "base64url");
|
|
22340
|
-
|
|
22341
22336
|
// src/interfaces/git-providers.ts
|
|
22342
22337
|
var GitPushError = class extends Error {
|
|
22343
22338
|
static {
|
|
@@ -22362,18 +22357,26 @@ function scrubToken(s, token) {
|
|
|
22362
22357
|
__name(scrubToken, "scrubToken");
|
|
22363
22358
|
|
|
22364
22359
|
// src/utils/git-providers/github-provider.ts
|
|
22365
|
-
var SUCCESS_HTML = `<!doctype html><meta charset="utf-8"><title>Lua CLI</title>
|
|
22366
|
-
<body style="font-family: system-ui; padding: 4rem; text-align: center;">
|
|
22367
|
-
<h1>✓ Connected</h1>
|
|
22368
|
-
<p>You can close this tab and return to the terminal.</p>
|
|
22369
|
-
</body>`;
|
|
22370
22360
|
var GitHubProvider = class {
|
|
22371
22361
|
static {
|
|
22372
22362
|
__name(this, "GitHubProvider");
|
|
22373
22363
|
}
|
|
22374
22364
|
name = "github";
|
|
22375
|
-
|
|
22376
|
-
|
|
22365
|
+
/**
|
|
22366
|
+
* GitHub is authenticated via the OAuth **device flow** only.
|
|
22367
|
+
*
|
|
22368
|
+
* The browser/loopback authorization-code flow is intentionally NOT used:
|
|
22369
|
+
* GitHub requires a `client_secret` to exchange the code (PKCE does not
|
|
22370
|
+
* replace it — the secretless exchange returns `incorrect_client_credentials`),
|
|
22371
|
+
* and a CLI published to npm cannot safely embed a secret. The device flow
|
|
22372
|
+
* needs no secret, which is why it is the only viable flow for a public
|
|
22373
|
+
* client (the same reason GitHub's own `gh` CLI defaults to it).
|
|
22374
|
+
*
|
|
22375
|
+
* `opts.device` is accepted for backwards compatibility but is now a no-op:
|
|
22376
|
+
* the device flow is always used.
|
|
22377
|
+
*/
|
|
22378
|
+
async login(_opts) {
|
|
22379
|
+
const token = await this.deviceFlow();
|
|
22377
22380
|
const username = await this.fetchUsername(token);
|
|
22378
22381
|
await saveAuth(this.name, {
|
|
22379
22382
|
token,
|
|
@@ -22396,12 +22399,18 @@ var GitHubProvider = class {
|
|
|
22396
22399
|
async push(opts) {
|
|
22397
22400
|
const parsed = parseGitHubHttpsUrl(opts.remoteUrl);
|
|
22398
22401
|
const authedUrl = `https://x-access-token:${opts.token}@github.com/${parsed.owner}/${parsed.repo}`;
|
|
22402
|
+
const refspecs = opts.tag ? [
|
|
22403
|
+
opts.branch,
|
|
22404
|
+
opts.tag
|
|
22405
|
+
] : [
|
|
22406
|
+
opts.branch
|
|
22407
|
+
];
|
|
22399
22408
|
let result;
|
|
22400
22409
|
try {
|
|
22401
22410
|
result = await runGit([
|
|
22402
22411
|
"push",
|
|
22403
22412
|
authedUrl,
|
|
22404
|
-
|
|
22413
|
+
...refspecs
|
|
22405
22414
|
], {
|
|
22406
22415
|
cwd: opts.cwd,
|
|
22407
22416
|
timeout: PUSH_TIMEOUT_MS
|
|
@@ -22416,126 +22425,6 @@ var GitHubProvider = class {
|
|
|
22416
22425
|
const status = matchPushStatus(scrubbed);
|
|
22417
22426
|
throw new GitPushError(status === 401 ? "GitHub authentication failed (token revoked or insufficient scope)." : status === 403 ? "GitHub rejected the push (403 \u2014 possible SSO enforcement or missing scope)." : "git push failed.", status, scrubbed);
|
|
22418
22427
|
}
|
|
22419
|
-
async loopbackFlow() {
|
|
22420
|
-
const verifier = generateCodeVerifier();
|
|
22421
|
-
const challenge = computeCodeChallenge(verifier);
|
|
22422
|
-
const state = randomBytes2(16).toString("hex");
|
|
22423
|
-
const { code, redirectUri } = await this.captureLoopbackCode({
|
|
22424
|
-
state,
|
|
22425
|
-
challenge
|
|
22426
|
-
});
|
|
22427
|
-
return this.exchangeCodeForToken({
|
|
22428
|
-
code,
|
|
22429
|
-
verifier,
|
|
22430
|
-
redirectUri
|
|
22431
|
-
});
|
|
22432
|
-
}
|
|
22433
|
-
async captureLoopbackCode(args2) {
|
|
22434
|
-
let lastErr;
|
|
22435
|
-
for (let i = 0; i < LOOPBACK_PORT_ATTEMPTS; i++) {
|
|
22436
|
-
const port = randomPort();
|
|
22437
|
-
try {
|
|
22438
|
-
return await this.runLoopbackServer(port, args2.state, args2.challenge);
|
|
22439
|
-
} catch (err) {
|
|
22440
|
-
lastErr = err;
|
|
22441
|
-
if (!isPortInUse(err)) throw err;
|
|
22442
|
-
}
|
|
22443
|
-
}
|
|
22444
|
-
throw new Error(`Could not bind a loopback port after ${LOOPBACK_PORT_ATTEMPTS} attempts. Try \`lua git auth github --device\` instead.${lastErr ? ` (${lastErr instanceof Error ? lastErr.message : String(lastErr)})` : ""}`);
|
|
22445
|
-
}
|
|
22446
|
-
runLoopbackServer(port, state, challenge) {
|
|
22447
|
-
return new Promise((resolveOuter, rejectOuter) => {
|
|
22448
|
-
let settled = false;
|
|
22449
|
-
const settle = /* @__PURE__ */ __name((fn) => {
|
|
22450
|
-
if (settled) return;
|
|
22451
|
-
settled = true;
|
|
22452
|
-
fn();
|
|
22453
|
-
}, "settle");
|
|
22454
|
-
const server = createServer((req, res) => {
|
|
22455
|
-
const url = new URL(req.url ?? "/", `http://127.0.0.1:${port}`);
|
|
22456
|
-
if (url.pathname !== "/callback") {
|
|
22457
|
-
res.writeHead(404).end();
|
|
22458
|
-
return;
|
|
22459
|
-
}
|
|
22460
|
-
const code = url.searchParams.get("code");
|
|
22461
|
-
const gotState = url.searchParams.get("state");
|
|
22462
|
-
if (!code || gotState !== state) {
|
|
22463
|
-
res.writeHead(400, {
|
|
22464
|
-
"content-type": "text/plain"
|
|
22465
|
-
}).end("State mismatch.");
|
|
22466
|
-
server.close();
|
|
22467
|
-
settle(() => {
|
|
22468
|
-
clearTimeout(timeout);
|
|
22469
|
-
rejectOuter(new Error("OAuth callback state mismatch (possible CSRF). Re-run the command."));
|
|
22470
|
-
});
|
|
22471
|
-
return;
|
|
22472
|
-
}
|
|
22473
|
-
res.writeHead(200, {
|
|
22474
|
-
"content-type": "text/html"
|
|
22475
|
-
}).end(SUCCESS_HTML);
|
|
22476
|
-
server.close();
|
|
22477
|
-
settle(() => {
|
|
22478
|
-
clearTimeout(timeout);
|
|
22479
|
-
resolveOuter({
|
|
22480
|
-
code,
|
|
22481
|
-
redirectUri
|
|
22482
|
-
});
|
|
22483
|
-
});
|
|
22484
|
-
});
|
|
22485
|
-
const timeout = setTimeout(() => {
|
|
22486
|
-
server.close();
|
|
22487
|
-
settle(() => rejectOuter(new Error("OAuth flow timed out (5 min). Re-run `lua git auth github`.")));
|
|
22488
|
-
}, LOOPBACK_TIMEOUT_MS);
|
|
22489
|
-
timeout.unref();
|
|
22490
|
-
server.on("error", (err) => {
|
|
22491
|
-
server.close();
|
|
22492
|
-
settle(() => {
|
|
22493
|
-
clearTimeout(timeout);
|
|
22494
|
-
rejectOuter(err);
|
|
22495
|
-
});
|
|
22496
|
-
});
|
|
22497
|
-
let redirectUri = "";
|
|
22498
|
-
server.listen(port, "127.0.0.1", () => {
|
|
22499
|
-
const actualPort = server.address().port;
|
|
22500
|
-
redirectUri = `http://127.0.0.1:${actualPort}/callback`;
|
|
22501
|
-
const authUrl = new URL(`${GITHUB_OAUTH_BASE_URL}/login/oauth/authorize`);
|
|
22502
|
-
authUrl.searchParams.set("client_id", GITHUB_CLIENT_ID);
|
|
22503
|
-
authUrl.searchParams.set("redirect_uri", redirectUri);
|
|
22504
|
-
authUrl.searchParams.set("scope", GITHUB_OAUTH_SCOPE);
|
|
22505
|
-
authUrl.searchParams.set("code_challenge", challenge);
|
|
22506
|
-
authUrl.searchParams.set("code_challenge_method", "S256");
|
|
22507
|
-
authUrl.searchParams.set("state", state);
|
|
22508
|
-
open(authUrl.toString()).catch(() => {
|
|
22509
|
-
server.close();
|
|
22510
|
-
settle(() => {
|
|
22511
|
-
clearTimeout(timeout);
|
|
22512
|
-
rejectOuter(new Error("Couldn't open a browser \u2014 try `lua git auth github --device` for the device flow."));
|
|
22513
|
-
});
|
|
22514
|
-
});
|
|
22515
|
-
});
|
|
22516
|
-
});
|
|
22517
|
-
}
|
|
22518
|
-
async exchangeCodeForToken(args2) {
|
|
22519
|
-
const res = await request(`${GITHUB_OAUTH_BASE_URL}/login/oauth/access_token`, {
|
|
22520
|
-
method: "POST",
|
|
22521
|
-
headers: {
|
|
22522
|
-
accept: "application/json",
|
|
22523
|
-
"content-type": "application/json"
|
|
22524
|
-
},
|
|
22525
|
-
body: JSON.stringify({
|
|
22526
|
-
client_id: GITHUB_CLIENT_ID,
|
|
22527
|
-
code: args2.code,
|
|
22528
|
-
code_verifier: args2.verifier,
|
|
22529
|
-
redirect_uri: args2.redirectUri,
|
|
22530
|
-
grant_type: "authorization_code"
|
|
22531
|
-
})
|
|
22532
|
-
});
|
|
22533
|
-
const body = await res.body.json();
|
|
22534
|
-
if (!body.access_token) {
|
|
22535
|
-
throw new Error(`GitHub rejected the token exchange: ${body.error ?? "unknown error"}`);
|
|
22536
|
-
}
|
|
22537
|
-
return body.access_token;
|
|
22538
|
-
}
|
|
22539
22428
|
async fetchUsername(token) {
|
|
22540
22429
|
const res = await request(`${GITHUB_API_BASE_URL}/user`, {
|
|
22541
22430
|
method: "GET",
|
|
@@ -22598,15 +22487,6 @@ var GitHubProvider = class {
|
|
|
22598
22487
|
throw new Error("Device flow timed out. Re-run `lua git auth github --device`.");
|
|
22599
22488
|
}
|
|
22600
22489
|
};
|
|
22601
|
-
function randomPort() {
|
|
22602
|
-
const span = LOOPBACK_PORT_MAX - LOOPBACK_PORT_MIN + 1;
|
|
22603
|
-
return LOOPBACK_PORT_MIN + Math.floor(Math.random() * span);
|
|
22604
|
-
}
|
|
22605
|
-
__name(randomPort, "randomPort");
|
|
22606
|
-
function isPortInUse(err) {
|
|
22607
|
-
return !!err && typeof err === "object" && "code" in err && err.code === "EADDRINUSE";
|
|
22608
|
-
}
|
|
22609
|
-
__name(isPortInUse, "isPortInUse");
|
|
22610
22490
|
function sleep(ms) {
|
|
22611
22491
|
return new Promise((r) => setTimeout(r, ms));
|
|
22612
22492
|
}
|
|
@@ -22665,7 +22545,7 @@ async function tryGitAutoPush(ctx) {
|
|
|
22665
22545
|
warnOnce("missing-github-token", "git.autoPush is enabled but no GitHub auth \u2014 run `lua git auth github`.");
|
|
22666
22546
|
return;
|
|
22667
22547
|
}
|
|
22668
|
-
const remote = await
|
|
22548
|
+
const remote = await getRemoteOriginUrl(ctx.cwd);
|
|
22669
22549
|
if (!remote) {
|
|
22670
22550
|
warnOnce("missing-github-remote", "git.autoPush is enabled but no `remote.origin.url` is set. Skipping push.");
|
|
22671
22551
|
return;
|
|
@@ -22685,9 +22565,11 @@ async function tryGitAutoPush(ctx) {
|
|
|
22685
22565
|
token,
|
|
22686
22566
|
remoteUrl: remote,
|
|
22687
22567
|
branch,
|
|
22568
|
+
tag: ctx.tag,
|
|
22688
22569
|
cwd: ctx.cwd ?? process.cwd()
|
|
22689
22570
|
});
|
|
22690
|
-
|
|
22571
|
+
const tagSuffix = ctx.tag ? ` +${ctx.tag}` : "";
|
|
22572
|
+
writeInfo(`\u2713 Pushed ${ctx.commitSha?.slice(0, 7) ?? ""}${tagSuffix} to ${remote} (${branch})`);
|
|
22691
22573
|
trackEvent("cli_auto_push_succeeded", {
|
|
22692
22574
|
action: ctx.action
|
|
22693
22575
|
});
|
|
@@ -22715,19 +22597,6 @@ async function tryGitAutoPush(ctx) {
|
|
|
22715
22597
|
}
|
|
22716
22598
|
}
|
|
22717
22599
|
__name(tryGitAutoPush, "tryGitAutoPush");
|
|
22718
|
-
async function readRemoteOriginUrl(cwd) {
|
|
22719
|
-
const res = await runGit([
|
|
22720
|
-
"config",
|
|
22721
|
-
"--get",
|
|
22722
|
-
"remote.origin.url"
|
|
22723
|
-
], {
|
|
22724
|
-
cwd
|
|
22725
|
-
});
|
|
22726
|
-
if (res.code !== 0) return null;
|
|
22727
|
-
const trimmed = res.stdout.trim();
|
|
22728
|
-
return trimmed.length > 0 ? trimmed : null;
|
|
22729
|
-
}
|
|
22730
|
-
__name(readRemoteOriginUrl, "readRemoteOriginUrl");
|
|
22731
22600
|
async function readCurrentBranch(cwd) {
|
|
22732
22601
|
const res = await runGit([
|
|
22733
22602
|
"rev-parse",
|
|
@@ -22805,6 +22674,8 @@ async function tryGitCommit(opts) {
|
|
|
22805
22674
|
if (opts.tag) {
|
|
22806
22675
|
try {
|
|
22807
22676
|
const tagResult = await runGit([
|
|
22677
|
+
"-c",
|
|
22678
|
+
"tag.gpgsign=false",
|
|
22808
22679
|
"tag",
|
|
22809
22680
|
opts.tag
|
|
22810
22681
|
], runOpts);
|
|
@@ -22830,6 +22701,9 @@ async function tryGitCommit(opts) {
|
|
|
22830
22701
|
config,
|
|
22831
22702
|
cwd: opts.cwd,
|
|
22832
22703
|
commitSha: sha,
|
|
22704
|
+
// Only forward a tag that actually landed — auto-push pushes it as an
|
|
22705
|
+
// explicit refspec, so pushing a non-existent tag would just error.
|
|
22706
|
+
tag: tagged ? opts.tag : void 0,
|
|
22833
22707
|
action: opts.action
|
|
22834
22708
|
});
|
|
22835
22709
|
return {
|
|
@@ -28204,7 +28078,7 @@ __name(viewResourceInteractive, "viewResourceInteractive");
|
|
|
28204
28078
|
init_cli();
|
|
28205
28079
|
init_command_utils();
|
|
28206
28080
|
init_analytics();
|
|
28207
|
-
import
|
|
28081
|
+
import open from "open";
|
|
28208
28082
|
async function adminCommand() {
|
|
28209
28083
|
return withErrorHandling(async () => {
|
|
28210
28084
|
writeProgress("Opening Lua Admin Dashboard...");
|
|
@@ -28212,7 +28086,7 @@ async function adminCommand() {
|
|
|
28212
28086
|
showProgress: false
|
|
28213
28087
|
});
|
|
28214
28088
|
const adminUrl = `https://admin.heylua.ai/validate-token/${apiKey}?redirect=/admin/usage?&agentId=${agentId}&orgId=${orgId}`;
|
|
28215
|
-
await
|
|
28089
|
+
await open(adminUrl);
|
|
28216
28090
|
writeSuccess("Lua Admin Dashboard opened in your browser");
|
|
28217
28091
|
console.log(`
|
|
28218
28092
|
Dashboard URL: https://admin.heylua.ai`);
|
|
@@ -28228,7 +28102,7 @@ __name(adminCommand, "adminCommand");
|
|
|
28228
28102
|
init_cli();
|
|
28229
28103
|
init_command_utils();
|
|
28230
28104
|
init_analytics();
|
|
28231
|
-
import
|
|
28105
|
+
import open2 from "open";
|
|
28232
28106
|
async function evalsCommand() {
|
|
28233
28107
|
return withErrorHandling(async () => {
|
|
28234
28108
|
writeProgress("Opening Lua Evaluations Dashboard...");
|
|
@@ -28236,7 +28110,7 @@ async function evalsCommand() {
|
|
|
28236
28110
|
showProgress: false
|
|
28237
28111
|
});
|
|
28238
28112
|
const evalsUrl = `https://evals.heylua.ai?apiKey=${apiKey}&agentID=${agentId}`;
|
|
28239
|
-
await
|
|
28113
|
+
await open2(evalsUrl);
|
|
28240
28114
|
writeSuccess("Lua Evaluations Dashboard opened in your browser");
|
|
28241
28115
|
console.log(`
|
|
28242
28116
|
Dashboard URL: https://evals.heylua.ai`);
|
|
@@ -28250,12 +28124,12 @@ __name(evalsCommand, "evalsCommand");
|
|
|
28250
28124
|
// src/commands/docs.ts
|
|
28251
28125
|
init_cli();
|
|
28252
28126
|
init_analytics();
|
|
28253
|
-
import
|
|
28127
|
+
import open3 from "open";
|
|
28254
28128
|
async function docsCommand() {
|
|
28255
28129
|
return withErrorHandling(async () => {
|
|
28256
28130
|
writeProgress("Opening Lua Documentation...");
|
|
28257
28131
|
const docsUrl = "https://docs.heylua.ai";
|
|
28258
|
-
await
|
|
28132
|
+
await open3(docsUrl);
|
|
28259
28133
|
writeSuccess("Lua Documentation opened in your browser");
|
|
28260
28134
|
console.log(`
|
|
28261
28135
|
Documentation: ${docsUrl}
|
|
@@ -28269,7 +28143,7 @@ __name(docsCommand, "docsCommand");
|
|
|
28269
28143
|
init_cli();
|
|
28270
28144
|
init_command_utils();
|
|
28271
28145
|
import inquirer12 from "inquirer";
|
|
28272
|
-
import
|
|
28146
|
+
import open4 from "open";
|
|
28273
28147
|
|
|
28274
28148
|
// src/api/channels.api.service.ts
|
|
28275
28149
|
init_http_client();
|
|
@@ -28838,7 +28712,7 @@ async function openAdminDashboard(apiKey, config) {
|
|
|
28838
28712
|
throw new Error("No orgId found in lua.skill.yaml. Please ensure your configuration is valid.");
|
|
28839
28713
|
}
|
|
28840
28714
|
const adminUrl = `https://admin.heylua.ai/validate-token/${apiKey}?redirect=/admin/usage?&agentId=${agentId}&orgId=${orgId}`;
|
|
28841
|
-
await
|
|
28715
|
+
await open4(adminUrl);
|
|
28842
28716
|
writeSuccess("\u2705 Lua Admin Dashboard opened in your browser");
|
|
28843
28717
|
console.log(`
|
|
28844
28718
|
Dashboard URL: https://admin.heylua.ai`);
|
|
@@ -30289,6 +30163,40 @@ init_cli();
|
|
|
30289
30163
|
init_files();
|
|
30290
30164
|
init_constants();
|
|
30291
30165
|
init_command_utils();
|
|
30166
|
+
|
|
30167
|
+
// src/utils/primitive-version-display.ts
|
|
30168
|
+
var PRIMITIVE_VERSION_HISTORY_NOTE = "\u2139\uFE0F Primitive versions are managed by agent versioning. Run `lua version list` to view agent versions.";
|
|
30169
|
+
async function shouldHidePrimitiveVersions(apiKey, agentId) {
|
|
30170
|
+
try {
|
|
30171
|
+
const { enabled } = await getVersioningModeCached(apiKey, agentId);
|
|
30172
|
+
return enabled;
|
|
30173
|
+
} catch {
|
|
30174
|
+
return false;
|
|
30175
|
+
}
|
|
30176
|
+
}
|
|
30177
|
+
__name(shouldHidePrimitiveVersions, "shouldHidePrimitiveVersions");
|
|
30178
|
+
var DIVIDER = "=".repeat(60);
|
|
30179
|
+
function primitiveVersionHistoryView(label) {
|
|
30180
|
+
return [
|
|
30181
|
+
"\n" + DIVIDER,
|
|
30182
|
+
`\u{1F4DC} Versions for ${label}`,
|
|
30183
|
+
DIVIDER + "\n",
|
|
30184
|
+
PRIMITIVE_VERSION_HISTORY_NOTE,
|
|
30185
|
+
"\n" + DIVIDER
|
|
30186
|
+
];
|
|
30187
|
+
}
|
|
30188
|
+
__name(primitiveVersionHistoryView, "primitiveVersionHistoryView");
|
|
30189
|
+
function deployedVersionLine(version, hide) {
|
|
30190
|
+
if (version == null) return hide ? " Not deployed" : " Deployed Version: Not deployed";
|
|
30191
|
+
return hide ? " Deployed \u2B50" : ` Deployed Version: ${version} \u2B50`;
|
|
30192
|
+
}
|
|
30193
|
+
__name(deployedVersionLine, "deployedVersionLine");
|
|
30194
|
+
function localVersionLine(version, hide) {
|
|
30195
|
+
return hide ? null : ` Version: ${version}`;
|
|
30196
|
+
}
|
|
30197
|
+
__name(localVersionLine, "localVersionLine");
|
|
30198
|
+
|
|
30199
|
+
// src/commands/skills.ts
|
|
30292
30200
|
init_skills_api_service();
|
|
30293
30201
|
init_skill_handler();
|
|
30294
30202
|
init_analytics();
|
|
@@ -30299,6 +30207,7 @@ async function skillsCommand(actionOrEnv, actionArg, cmdObj) {
|
|
|
30299
30207
|
skillVersion: cmdObj?.skillVersion || null
|
|
30300
30208
|
};
|
|
30301
30209
|
const { config, agentId, apiKey } = await initializeCommand();
|
|
30210
|
+
const hideVersions = await shouldHidePrimitiveVersions(apiKey, agentId);
|
|
30302
30211
|
if (actionOrEnv) {
|
|
30303
30212
|
const normalized = validateOrSuggest("skills.actionOrEnv", actionOrEnv);
|
|
30304
30213
|
const envSet = /* @__PURE__ */ new Set([
|
|
@@ -30310,7 +30219,8 @@ async function skillsCommand(actionOrEnv, actionArg, cmdObj) {
|
|
|
30310
30219
|
const context3 = {
|
|
30311
30220
|
environment: selectedEnvironment,
|
|
30312
30221
|
agentId,
|
|
30313
|
-
apiKey
|
|
30222
|
+
apiKey,
|
|
30223
|
+
hideVersions
|
|
30314
30224
|
};
|
|
30315
30225
|
let resolvedAction = actionArg;
|
|
30316
30226
|
if (resolvedAction) {
|
|
@@ -30323,7 +30233,8 @@ async function skillsCommand(actionOrEnv, actionArg, cmdObj) {
|
|
|
30323
30233
|
console.log("\u2139\uFE0F No skills found in configuration.");
|
|
30324
30234
|
} else {
|
|
30325
30235
|
for (const skill of skills) {
|
|
30326
|
-
|
|
30236
|
+
const ver = context3.hideVersions ? "" : ` v${skill.version}`;
|
|
30237
|
+
console.log(`\u{1F4E6} ${skill.name}${ver} (${skill.skillId})`);
|
|
30327
30238
|
}
|
|
30328
30239
|
}
|
|
30329
30240
|
return;
|
|
@@ -30342,7 +30253,8 @@ async function skillsCommand(actionOrEnv, actionArg, cmdObj) {
|
|
|
30342
30253
|
const context2 = {
|
|
30343
30254
|
environment: "production",
|
|
30344
30255
|
agentId,
|
|
30345
|
-
apiKey
|
|
30256
|
+
apiKey,
|
|
30257
|
+
hideVersions
|
|
30346
30258
|
};
|
|
30347
30259
|
await executeNonInteractive4(context2, config, normalized, options);
|
|
30348
30260
|
trackEvent("cli_skills_action", {
|
|
@@ -30374,7 +30286,8 @@ async function skillsCommand(actionOrEnv, actionArg, cmdObj) {
|
|
|
30374
30286
|
const context = {
|
|
30375
30287
|
environment: envAnswer.environment,
|
|
30376
30288
|
agentId,
|
|
30377
|
-
apiKey
|
|
30289
|
+
apiKey,
|
|
30290
|
+
hideVersions
|
|
30378
30291
|
};
|
|
30379
30292
|
if (context.environment === "sandbox") {
|
|
30380
30293
|
await manageSandboxSkillsInteractive(context, config);
|
|
@@ -30403,13 +30316,15 @@ async function displaySkillsCore2(context, skills) {
|
|
|
30403
30316
|
console.log(`\u{1F4E6} ${skill.name}`);
|
|
30404
30317
|
console.log(` Skill ID: ${skill.skillId}`);
|
|
30405
30318
|
if (activeVersion) {
|
|
30406
|
-
console.log(
|
|
30319
|
+
console.log(deployedVersionLine(activeVersion.version, context.hideVersions));
|
|
30407
30320
|
const dateStr = activeVersion.createdDate ? new Date(activeVersion.createdDate).toLocaleString() : "Unknown";
|
|
30408
30321
|
console.log(` Deployed: ${dateStr}`);
|
|
30409
30322
|
} else {
|
|
30410
|
-
console.log(
|
|
30323
|
+
console.log(deployedVersionLine(null, context.hideVersions));
|
|
30324
|
+
}
|
|
30325
|
+
if (!context.hideVersions) {
|
|
30326
|
+
console.log(` Total Versions: ${versions.length}`);
|
|
30411
30327
|
}
|
|
30412
|
-
console.log(` Total Versions: ${versions.length}`);
|
|
30413
30328
|
console.log();
|
|
30414
30329
|
} else {
|
|
30415
30330
|
displaySkillError(skill, "Unable to fetch version info");
|
|
@@ -30442,7 +30357,11 @@ async function fetchVersionsCore2(context, skill) {
|
|
|
30442
30357
|
};
|
|
30443
30358
|
}
|
|
30444
30359
|
__name(fetchVersionsCore2, "fetchVersionsCore");
|
|
30445
|
-
function displayVersionsCore2(skill, versions, activeVersionId) {
|
|
30360
|
+
function displayVersionsCore2(skill, versions, activeVersionId, hideVersions) {
|
|
30361
|
+
if (hideVersions) {
|
|
30362
|
+
primitiveVersionHistoryView(skill.name).forEach((line) => console.log(line));
|
|
30363
|
+
return;
|
|
30364
|
+
}
|
|
30446
30365
|
console.log("\n" + "=".repeat(60));
|
|
30447
30366
|
console.log(`\u{1F4DC} Versions for ${skill.name}`);
|
|
30448
30367
|
console.log("=".repeat(60) + "\n");
|
|
@@ -30595,12 +30514,12 @@ Usage: lua skills ${action} --skill-name <name>`);
|
|
|
30595
30514
|
case "versions": {
|
|
30596
30515
|
const data = await fetchVersionsCore2(context, selectedSkill);
|
|
30597
30516
|
if (!data) throw new Error("Failed to fetch skill versions");
|
|
30598
|
-
if (data.versions.length === 0) {
|
|
30517
|
+
if (!context.hideVersions && data.versions.length === 0) {
|
|
30599
30518
|
console.log(`\u2139\uFE0F No versions found for ${selectedSkill.name}.`);
|
|
30600
30519
|
console.log("\u{1F4A1} Push a version first using 'lua push skill'.");
|
|
30601
30520
|
return;
|
|
30602
30521
|
}
|
|
30603
|
-
displayVersionsCore2(selectedSkill, data.versions, data.activeVersionId);
|
|
30522
|
+
displayVersionsCore2(selectedSkill, data.versions, data.activeVersionId, context.hideVersions);
|
|
30604
30523
|
break;
|
|
30605
30524
|
}
|
|
30606
30525
|
case "deploy": {
|
|
@@ -30645,7 +30564,8 @@ async function manageSandboxSkillsInteractive(context, config) {
|
|
|
30645
30564
|
console.log("Local skills in lua.skill.yaml:\n");
|
|
30646
30565
|
skills.forEach((skill, index) => {
|
|
30647
30566
|
console.log(`${index + 1}. \u{1F4E6} ${skill.name}`);
|
|
30648
|
-
|
|
30567
|
+
const vline = localVersionLine(skill.version, context.hideVersions);
|
|
30568
|
+
if (vline) console.log(vline);
|
|
30649
30569
|
console.log(` Skill ID: ${skill.skillId}`);
|
|
30650
30570
|
console.log();
|
|
30651
30571
|
});
|
|
@@ -30815,13 +30735,13 @@ async function viewVersionsInteractive(context, config) {
|
|
|
30815
30735
|
]);
|
|
30816
30736
|
return;
|
|
30817
30737
|
}
|
|
30818
|
-
if (data.versions.length === 0) {
|
|
30738
|
+
if (!context.hideVersions && data.versions.length === 0) {
|
|
30819
30739
|
console.log(`
|
|
30820
30740
|
\u2139\uFE0F No versions found for ${selectedSkill.name}.
|
|
30821
30741
|
`);
|
|
30822
30742
|
console.log("\u{1F4A1} Push a version first using 'lua push skill'.\n");
|
|
30823
30743
|
} else {
|
|
30824
|
-
displayVersionsCore2(selectedSkill, data.versions, data.activeVersionId);
|
|
30744
|
+
displayVersionsCore2(selectedSkill, data.versions, data.activeVersionId, context.hideVersions);
|
|
30825
30745
|
console.log();
|
|
30826
30746
|
}
|
|
30827
30747
|
await safePrompt([
|
|
@@ -31653,10 +31573,12 @@ async function webhooksCommand(action, cmdObj) {
|
|
|
31653
31573
|
event: cmdObj?.event || null
|
|
31654
31574
|
};
|
|
31655
31575
|
const { config, agentId, apiKey } = await initializeCommand();
|
|
31576
|
+
const hideVersions = await shouldHidePrimitiveVersions(apiKey, agentId);
|
|
31656
31577
|
const context = {
|
|
31657
31578
|
environment: "production",
|
|
31658
31579
|
agentId,
|
|
31659
|
-
apiKey
|
|
31580
|
+
apiKey,
|
|
31581
|
+
hideVersions
|
|
31660
31582
|
};
|
|
31661
31583
|
if (action) {
|
|
31662
31584
|
await executeNonInteractive5(context, config, action, options);
|
|
@@ -31686,12 +31608,14 @@ async function displayWebhooksCore(context, webhooks) {
|
|
|
31686
31608
|
console.log(`\u{1FA9D} ${webhook.name}`);
|
|
31687
31609
|
console.log(` Webhook ID: ${webhook.webhookId}`);
|
|
31688
31610
|
if (activeVersion) {
|
|
31689
|
-
console.log(
|
|
31611
|
+
console.log(deployedVersionLine(activeVersion.version, context.hideVersions));
|
|
31690
31612
|
console.log(` Deployed: ${new Date(activeVersion.createdAt).toLocaleString()}`);
|
|
31691
31613
|
} else {
|
|
31692
|
-
console.log(
|
|
31614
|
+
console.log(deployedVersionLine(null, context.hideVersions));
|
|
31615
|
+
}
|
|
31616
|
+
if (!context.hideVersions) {
|
|
31617
|
+
console.log(` Total Versions: ${versions.length}`);
|
|
31693
31618
|
}
|
|
31694
|
-
console.log(` Total Versions: ${versions.length}`);
|
|
31695
31619
|
console.log();
|
|
31696
31620
|
} else {
|
|
31697
31621
|
displayWebhookError(webhook, "Unable to fetch version info");
|
|
@@ -31724,7 +31648,11 @@ async function fetchVersionsCore3(context, webhook) {
|
|
|
31724
31648
|
};
|
|
31725
31649
|
}
|
|
31726
31650
|
__name(fetchVersionsCore3, "fetchVersionsCore");
|
|
31727
|
-
function displayVersionsCore3(webhook, versions, activeVersionId) {
|
|
31651
|
+
function displayVersionsCore3(webhook, versions, activeVersionId, hideVersions) {
|
|
31652
|
+
if (hideVersions) {
|
|
31653
|
+
primitiveVersionHistoryView(webhook.name).forEach((line) => console.log(line));
|
|
31654
|
+
return;
|
|
31655
|
+
}
|
|
31728
31656
|
console.log("\n" + "=".repeat(60));
|
|
31729
31657
|
console.log(`\u{1F4DC} Versions for ${webhook.name}`);
|
|
31730
31658
|
console.log("=".repeat(60) + "\n");
|
|
@@ -31998,12 +31926,12 @@ Usage: lua webhooks ${normalizedAction} --webhook-name <name>`);
|
|
|
31998
31926
|
case "versions": {
|
|
31999
31927
|
const data = await fetchVersionsCore3(context, selectedWebhook);
|
|
32000
31928
|
if (!data) throw new Error("Failed to fetch webhook versions");
|
|
32001
|
-
if (data.versions.length === 0) {
|
|
31929
|
+
if (!context.hideVersions && data.versions.length === 0) {
|
|
32002
31930
|
console.log(`\u2139\uFE0F No versions found for ${selectedWebhook.name}.`);
|
|
32003
31931
|
console.log("\u{1F4A1} Push a version first using 'lua push webhook'.");
|
|
32004
31932
|
return;
|
|
32005
31933
|
}
|
|
32006
|
-
displayVersionsCore3(selectedWebhook, data.versions, data.activeVersionId);
|
|
31934
|
+
displayVersionsCore3(selectedWebhook, data.versions, data.activeVersionId, context.hideVersions);
|
|
32007
31935
|
break;
|
|
32008
31936
|
}
|
|
32009
31937
|
case "deploy": {
|
|
@@ -32183,13 +32111,13 @@ async function viewVersionsInteractive2(context, config) {
|
|
|
32183
32111
|
]);
|
|
32184
32112
|
return;
|
|
32185
32113
|
}
|
|
32186
|
-
if (data.versions.length === 0) {
|
|
32114
|
+
if (!context.hideVersions && data.versions.length === 0) {
|
|
32187
32115
|
console.log(`
|
|
32188
32116
|
\u2139\uFE0F No versions found for ${selectedWebhook.name}.
|
|
32189
32117
|
`);
|
|
32190
32118
|
console.log("\u{1F4A1} Push a version first using 'lua push webhook'.\n");
|
|
32191
32119
|
} else {
|
|
32192
|
-
displayVersionsCore3(selectedWebhook, data.versions, data.activeVersionId);
|
|
32120
|
+
displayVersionsCore3(selectedWebhook, data.versions, data.activeVersionId, context.hideVersions);
|
|
32193
32121
|
console.log();
|
|
32194
32122
|
}
|
|
32195
32123
|
await safePrompt([
|
|
@@ -32687,10 +32615,12 @@ async function jobsCommand(action, cmdObj) {
|
|
|
32687
32615
|
jobVersion: cmdObj?.jobVersion || null
|
|
32688
32616
|
};
|
|
32689
32617
|
const { config, agentId, apiKey } = await initializeCommand();
|
|
32618
|
+
const hideVersions = await shouldHidePrimitiveVersions(apiKey, agentId);
|
|
32690
32619
|
const context = {
|
|
32691
32620
|
environment: "production",
|
|
32692
32621
|
agentId,
|
|
32693
|
-
apiKey
|
|
32622
|
+
apiKey,
|
|
32623
|
+
hideVersions
|
|
32694
32624
|
};
|
|
32695
32625
|
if (action) {
|
|
32696
32626
|
await executeNonInteractive6(context, config, action, options);
|
|
@@ -32759,7 +32689,11 @@ async function fetchVersionsCore4(context, job) {
|
|
|
32759
32689
|
};
|
|
32760
32690
|
}
|
|
32761
32691
|
__name(fetchVersionsCore4, "fetchVersionsCore");
|
|
32762
|
-
function displayVersionsCore4(job, versions, activeVersionId) {
|
|
32692
|
+
function displayVersionsCore4(job, versions, activeVersionId, hideVersions) {
|
|
32693
|
+
if (hideVersions) {
|
|
32694
|
+
primitiveVersionHistoryView(job.name).forEach((line) => console.log(line));
|
|
32695
|
+
return;
|
|
32696
|
+
}
|
|
32763
32697
|
console.log("\n" + "=".repeat(60));
|
|
32764
32698
|
console.log(`\u{1F4DC} Versions for ${job.name}`);
|
|
32765
32699
|
console.log("=".repeat(60) + "\n");
|
|
@@ -33030,12 +32964,12 @@ Usage: lua jobs ${normalizedAction} --job-name <name>`);
|
|
|
33030
32964
|
case "versions": {
|
|
33031
32965
|
const vData = await fetchVersionsCore4(context, selectedJob);
|
|
33032
32966
|
if (!vData) throw new Error("Failed to fetch job versions");
|
|
33033
|
-
if (vData.versions.length === 0) {
|
|
32967
|
+
if (!context.hideVersions && vData.versions.length === 0) {
|
|
33034
32968
|
console.log(`\u2139\uFE0F No versions found for ${selectedJob.name}.`);
|
|
33035
32969
|
console.log("\u{1F4A1} Push a version first using 'lua push job'.");
|
|
33036
32970
|
return;
|
|
33037
32971
|
}
|
|
33038
|
-
displayVersionsCore4(selectedJob, vData.versions, vData.activeVersionId);
|
|
32972
|
+
displayVersionsCore4(selectedJob, vData.versions, vData.activeVersionId, context.hideVersions);
|
|
33039
32973
|
break;
|
|
33040
32974
|
}
|
|
33041
32975
|
case "deploy": {
|
|
@@ -33217,13 +33151,13 @@ async function viewJobVersionsInteractive(context, config) {
|
|
|
33217
33151
|
]);
|
|
33218
33152
|
return;
|
|
33219
33153
|
}
|
|
33220
|
-
if (viewData.versions.length === 0) {
|
|
33154
|
+
if (!context.hideVersions && viewData.versions.length === 0) {
|
|
33221
33155
|
console.log(`
|
|
33222
33156
|
\u2139\uFE0F No versions found for ${selectedJob.name}.
|
|
33223
33157
|
`);
|
|
33224
33158
|
console.log("\u{1F4A1} Push a version first using 'lua push job'.\n");
|
|
33225
33159
|
} else {
|
|
33226
|
-
displayVersionsCore4(selectedJob, viewData.versions, viewData.activeVersionId);
|
|
33160
|
+
displayVersionsCore4(selectedJob, viewData.versions, viewData.activeVersionId, context.hideVersions);
|
|
33227
33161
|
console.log();
|
|
33228
33162
|
}
|
|
33229
33163
|
await safePrompt([
|
|
@@ -33936,9 +33870,11 @@ async function preprocessorsCommand(action, cmdObj) {
|
|
|
33936
33870
|
preprocessorVersion: cmdObj?.preprocessorVersion || null
|
|
33937
33871
|
};
|
|
33938
33872
|
const { config, agentId, apiKey } = await initializeCommand();
|
|
33873
|
+
const hideVersions = await shouldHidePrimitiveVersions(apiKey, agentId);
|
|
33939
33874
|
const context = {
|
|
33940
33875
|
agentId,
|
|
33941
|
-
apiKey
|
|
33876
|
+
apiKey,
|
|
33877
|
+
hideVersions
|
|
33942
33878
|
};
|
|
33943
33879
|
if (action) {
|
|
33944
33880
|
await executeNonInteractive8(context, config, action, options);
|
|
@@ -33968,12 +33904,14 @@ async function displayPreProcessorsCore(context, preprocessors) {
|
|
|
33968
33904
|
console.log(`\u{1F4E5} ${preprocessor.name}`);
|
|
33969
33905
|
console.log(` PreProcessor ID: ${preprocessor.preprocessorId}`);
|
|
33970
33906
|
if (activeVersion) {
|
|
33971
|
-
console.log(
|
|
33907
|
+
console.log(deployedVersionLine(activeVersion.version, context.hideVersions));
|
|
33972
33908
|
console.log(` Deployed: ${new Date(activeVersion.createdAt).toLocaleString()}`);
|
|
33973
33909
|
} else {
|
|
33974
|
-
console.log(
|
|
33910
|
+
console.log(deployedVersionLine(null, context.hideVersions));
|
|
33911
|
+
}
|
|
33912
|
+
if (!context.hideVersions) {
|
|
33913
|
+
console.log(` Total Versions: ${versions.length}`);
|
|
33975
33914
|
}
|
|
33976
|
-
console.log(` Total Versions: ${versions.length}`);
|
|
33977
33915
|
console.log();
|
|
33978
33916
|
} else {
|
|
33979
33917
|
displayPreProcessorError(preprocessor, "Unable to fetch version info");
|
|
@@ -34006,7 +33944,11 @@ async function fetchVersionsCore5(context, preprocessor) {
|
|
|
34006
33944
|
};
|
|
34007
33945
|
}
|
|
34008
33946
|
__name(fetchVersionsCore5, "fetchVersionsCore");
|
|
34009
|
-
function displayVersionsCore5(preprocessor, versions, activeVersionId) {
|
|
33947
|
+
function displayVersionsCore5(preprocessor, versions, activeVersionId, hideVersions) {
|
|
33948
|
+
if (hideVersions) {
|
|
33949
|
+
primitiveVersionHistoryView(preprocessor.name).forEach((line) => console.log(line));
|
|
33950
|
+
return;
|
|
33951
|
+
}
|
|
34010
33952
|
console.log("\n" + "=".repeat(60));
|
|
34011
33953
|
console.log(`\u{1F4DC} Versions for ${preprocessor.name}`);
|
|
34012
33954
|
console.log("=".repeat(60) + "\n");
|
|
@@ -34180,12 +34122,12 @@ Usage: lua preprocessors ${normalizedAction} --preprocessor-name <name>`);
|
|
|
34180
34122
|
case "versions": {
|
|
34181
34123
|
const data = await fetchVersionsCore5(context, selected);
|
|
34182
34124
|
if (!data) throw new Error("Failed to fetch preprocessor versions");
|
|
34183
|
-
if (data.versions.length === 0) {
|
|
34125
|
+
if (!context.hideVersions && data.versions.length === 0) {
|
|
34184
34126
|
console.log(`\u2139\uFE0F No versions found for ${selected.name}.`);
|
|
34185
34127
|
console.log("\u{1F4A1} Push a version first using 'lua push preprocessor'.");
|
|
34186
34128
|
return;
|
|
34187
34129
|
}
|
|
34188
|
-
displayVersionsCore5(selected, data.versions, data.activeVersionId);
|
|
34130
|
+
displayVersionsCore5(selected, data.versions, data.activeVersionId, context.hideVersions);
|
|
34189
34131
|
break;
|
|
34190
34132
|
}
|
|
34191
34133
|
case "deploy": {
|
|
@@ -34343,13 +34285,13 @@ async function viewVersionsInteractive3(context, config) {
|
|
|
34343
34285
|
]);
|
|
34344
34286
|
return;
|
|
34345
34287
|
}
|
|
34346
|
-
if (data.versions.length === 0) {
|
|
34288
|
+
if (!context.hideVersions && data.versions.length === 0) {
|
|
34347
34289
|
console.log(`
|
|
34348
34290
|
\u2139\uFE0F No versions found for ${selected.name}.
|
|
34349
34291
|
`);
|
|
34350
34292
|
console.log("\u{1F4A1} Push a version first using 'lua push preprocessor'.\n");
|
|
34351
34293
|
} else {
|
|
34352
|
-
displayVersionsCore5(selected, data.versions, data.activeVersionId);
|
|
34294
|
+
displayVersionsCore5(selected, data.versions, data.activeVersionId, context.hideVersions);
|
|
34353
34295
|
console.log();
|
|
34354
34296
|
}
|
|
34355
34297
|
await safePrompt([
|
|
@@ -34515,9 +34457,11 @@ async function postprocessorsCommand(action, cmdObj) {
|
|
|
34515
34457
|
postprocessorVersion: cmdObj?.postprocessorVersion || null
|
|
34516
34458
|
};
|
|
34517
34459
|
const { config, agentId, apiKey } = await initializeCommand();
|
|
34460
|
+
const hideVersions = await shouldHidePrimitiveVersions(apiKey, agentId);
|
|
34518
34461
|
const context = {
|
|
34519
34462
|
agentId,
|
|
34520
|
-
apiKey
|
|
34463
|
+
apiKey,
|
|
34464
|
+
hideVersions
|
|
34521
34465
|
};
|
|
34522
34466
|
if (action) {
|
|
34523
34467
|
await executeNonInteractive9(context, config, action, options);
|
|
@@ -34547,12 +34491,14 @@ async function displayPostProcessorsCore(context, postprocessors) {
|
|
|
34547
34491
|
console.log(`\u{1F4E4} ${postprocessor.name}`);
|
|
34548
34492
|
console.log(` PostProcessor ID: ${postprocessor.postprocessorId}`);
|
|
34549
34493
|
if (activeVersion) {
|
|
34550
|
-
console.log(
|
|
34494
|
+
console.log(deployedVersionLine(activeVersion.version, context.hideVersions));
|
|
34551
34495
|
console.log(` Deployed: ${new Date(activeVersion.createdAt).toLocaleString()}`);
|
|
34552
34496
|
} else {
|
|
34553
|
-
console.log(
|
|
34497
|
+
console.log(deployedVersionLine(null, context.hideVersions));
|
|
34498
|
+
}
|
|
34499
|
+
if (!context.hideVersions) {
|
|
34500
|
+
console.log(` Total Versions: ${versions.length}`);
|
|
34554
34501
|
}
|
|
34555
|
-
console.log(` Total Versions: ${versions.length}`);
|
|
34556
34502
|
console.log();
|
|
34557
34503
|
} else {
|
|
34558
34504
|
displayPostProcessorError(postprocessor, "Unable to fetch version info");
|
|
@@ -34585,7 +34531,11 @@ async function fetchVersionsCore6(context, postprocessor) {
|
|
|
34585
34531
|
};
|
|
34586
34532
|
}
|
|
34587
34533
|
__name(fetchVersionsCore6, "fetchVersionsCore");
|
|
34588
|
-
function displayVersionsCore6(postprocessor, versions, activeVersionId) {
|
|
34534
|
+
function displayVersionsCore6(postprocessor, versions, activeVersionId, hideVersions) {
|
|
34535
|
+
if (hideVersions) {
|
|
34536
|
+
primitiveVersionHistoryView(postprocessor.name).forEach((line) => console.log(line));
|
|
34537
|
+
return;
|
|
34538
|
+
}
|
|
34589
34539
|
console.log("\n" + "=".repeat(60));
|
|
34590
34540
|
console.log(`\u{1F4DC} Versions for ${postprocessor.name}`);
|
|
34591
34541
|
console.log("=".repeat(60) + "\n");
|
|
@@ -34759,12 +34709,12 @@ Usage: lua postprocessors ${normalizedAction} --postprocessor-name <name>`);
|
|
|
34759
34709
|
case "versions": {
|
|
34760
34710
|
const data = await fetchVersionsCore6(context, selected);
|
|
34761
34711
|
if (!data) throw new Error("Failed to fetch postprocessor versions");
|
|
34762
|
-
if (data.versions.length === 0) {
|
|
34712
|
+
if (!context.hideVersions && data.versions.length === 0) {
|
|
34763
34713
|
console.log(`\u2139\uFE0F No versions found for ${selected.name}.`);
|
|
34764
34714
|
console.log("\u{1F4A1} Push a version first using 'lua push postprocessor'.");
|
|
34765
34715
|
return;
|
|
34766
34716
|
}
|
|
34767
|
-
displayVersionsCore6(selected, data.versions, data.activeVersionId);
|
|
34717
|
+
displayVersionsCore6(selected, data.versions, data.activeVersionId, context.hideVersions);
|
|
34768
34718
|
break;
|
|
34769
34719
|
}
|
|
34770
34720
|
case "deploy": {
|
|
@@ -34922,13 +34872,13 @@ async function viewVersionsInteractive4(context, config) {
|
|
|
34922
34872
|
]);
|
|
34923
34873
|
return;
|
|
34924
34874
|
}
|
|
34925
|
-
if (data.versions.length === 0) {
|
|
34875
|
+
if (!context.hideVersions && data.versions.length === 0) {
|
|
34926
34876
|
console.log(`
|
|
34927
34877
|
\u2139\uFE0F No versions found for ${selected.name}.
|
|
34928
34878
|
`);
|
|
34929
34879
|
console.log("\u{1F4A1} Push a version first using 'lua push postprocessor'.\n");
|
|
34930
34880
|
} else {
|
|
34931
|
-
displayVersionsCore6(selected, data.versions, data.activeVersionId);
|
|
34881
|
+
displayVersionsCore6(selected, data.versions, data.activeVersionId, context.hideVersions);
|
|
34932
34882
|
console.log();
|
|
34933
34883
|
}
|
|
34934
34884
|
await safePrompt([
|
|
@@ -37622,7 +37572,7 @@ init_cli();
|
|
|
37622
37572
|
init_constants();
|
|
37623
37573
|
import http from "http";
|
|
37624
37574
|
import { URL as URL2 } from "url";
|
|
37625
|
-
import
|
|
37575
|
+
import open5 from "open";
|
|
37626
37576
|
init_command_utils();
|
|
37627
37577
|
init_developer_api_service();
|
|
37628
37578
|
|
|
@@ -38645,7 +38595,7 @@ Integration: ${selectedIntegration.name}`);
|
|
|
38645
38595
|
`);
|
|
38646
38596
|
const callbackPromise = startCallbackServer(3e5);
|
|
38647
38597
|
try {
|
|
38648
|
-
await
|
|
38598
|
+
await open5(authUrl);
|
|
38649
38599
|
writeInfo("\u{1F310} Browser opened - please complete the authorization");
|
|
38650
38600
|
} catch (error) {
|
|
38651
38601
|
writeInfo("\u{1F4A1} Could not open browser automatically. Please open the URL above manually.");
|
|
@@ -39076,7 +39026,7 @@ Available scopes for ${selectedIntegration.name}:`);
|
|
|
39076
39026
|
`);
|
|
39077
39027
|
const callbackPromise = startCallbackServer(3e5);
|
|
39078
39028
|
try {
|
|
39079
|
-
await
|
|
39029
|
+
await open5(authUrl);
|
|
39080
39030
|
writeInfo("\u{1F310} Browser opened - please complete the authorization");
|
|
39081
39031
|
} catch (error) {
|
|
39082
39032
|
writeInfo("\u{1F4A1} Could not open browser automatically. Please open the URL above manually.");
|
|
@@ -41289,7 +41239,7 @@ __name(pumpRemoteAudioToSpeaker, "pumpRemoteAudioToSpeaker");
|
|
|
41289
41239
|
// src/commands/voice-browser.ts
|
|
41290
41240
|
init_cli();
|
|
41291
41241
|
import http2 from "http";
|
|
41292
|
-
import
|
|
41242
|
+
import open6 from "open";
|
|
41293
41243
|
var SAFETY_TIMEOUT_MS = 60 * 60 * 1e3;
|
|
41294
41244
|
async function runBrowserMode(joinUrl) {
|
|
41295
41245
|
const { wsUrl, token } = parseJoinUrl(joinUrl);
|
|
@@ -41321,7 +41271,7 @@ async function runBrowserMode(joinUrl) {
|
|
|
41321
41271
|
const localUrl = `http://localhost:${port}/`;
|
|
41322
41272
|
writeSuccess(`Voice room ready (opening browser)`);
|
|
41323
41273
|
console.log(` ${localUrl}`);
|
|
41324
|
-
await
|
|
41274
|
+
await open6(localUrl);
|
|
41325
41275
|
await new Promise((resolve6) => {
|
|
41326
41276
|
const safety = setTimeout(() => {
|
|
41327
41277
|
try {
|
|
@@ -42374,7 +42324,7 @@ function failConnect(status, banner, errorMessage) {
|
|
|
42374
42324
|
throw new Error(errorMessage);
|
|
42375
42325
|
}
|
|
42376
42326
|
__name(failConnect, "failConnect");
|
|
42377
|
-
async function gitConnectCommand() {
|
|
42327
|
+
async function gitConnectCommand(opts = {}) {
|
|
42378
42328
|
return withErrorHandling(async () => {
|
|
42379
42329
|
const config = readYamlConfig();
|
|
42380
42330
|
if (!config) {
|
|
@@ -42413,15 +42363,35 @@ async function gitConnectCommand() {
|
|
|
42413
42363
|
user_configured: false
|
|
42414
42364
|
}, '\u2717 Git user.name is not configured.\n Fix: git config --global user.name "Your Name"', "git user.name is not configured");
|
|
42415
42365
|
}
|
|
42366
|
+
const passedStatus = {
|
|
42367
|
+
git_available: true,
|
|
42368
|
+
in_repo: true,
|
|
42369
|
+
user_configured: true
|
|
42370
|
+
};
|
|
42371
|
+
if (opts.autoPush) {
|
|
42372
|
+
const token = await getToken2("github");
|
|
42373
|
+
if (!token) {
|
|
42374
|
+
failConnect(passedStatus, "\u2717 --auto-push needs a linked GitHub account.\n Fix: run `lua git auth github` to link your GitHub account, then re-run `lua git connect --auto-push`.", "no GitHub account linked");
|
|
42375
|
+
}
|
|
42376
|
+
const remote = await getRemoteOriginUrl();
|
|
42377
|
+
if (!remote) {
|
|
42378
|
+
failConnect(passedStatus, "\u2717 --auto-push needs a GitHub remote, but `remote.origin.url` is not set.\n Fix: git remote add origin https://github.com/<owner>/<repo>.git", "no origin remote configured");
|
|
42379
|
+
}
|
|
42380
|
+
if (!isGitHubUrl(remote)) {
|
|
42381
|
+
failConnect(passedStatus, `\u2717 --auto-push only supports GitHub HTTPS remotes, but origin is ${remote}.
|
|
42382
|
+
Fix: git remote set-url origin https://github.com/<owner>/<repo>.git`, "origin is not a GitHub HTTPS remote");
|
|
42383
|
+
}
|
|
42384
|
+
}
|
|
42416
42385
|
config.git = {
|
|
42386
|
+
...config.git,
|
|
42417
42387
|
enabled: true
|
|
42418
42388
|
};
|
|
42389
|
+
if (opts.autoPush) config.git.autoPush = true;
|
|
42419
42390
|
writeYamlConfig(config);
|
|
42420
|
-
writeSuccess("\u2713 Git integration enabled. Future `lua push`, `lua version *`, and `lua pull` runs will auto-commit.");
|
|
42391
|
+
writeSuccess(opts.autoPush ? "\u2713 Git integration enabled with auto-push. Future `lua push`, `lua version *`, and `lua pull` runs will auto-commit and push to GitHub." : "\u2713 Git integration enabled. Future `lua push`, `lua version *`, and `lua pull` runs will auto-commit.");
|
|
42421
42392
|
trackEvent("cli_git_connect_completed", {
|
|
42422
|
-
|
|
42423
|
-
|
|
42424
|
-
user_configured: true,
|
|
42393
|
+
...passedStatus,
|
|
42394
|
+
auto_push: Boolean(opts.autoPush),
|
|
42425
42395
|
succeeded: true
|
|
42426
42396
|
});
|
|
42427
42397
|
}, "git connect");
|
|
@@ -42535,7 +42505,7 @@ function gitAuthGithubCommand(opts) {
|
|
|
42535
42505
|
writeSuccess(`Logged in to GitHub as @${result.username}.`);
|
|
42536
42506
|
trackEvent("cli_git_auth_succeeded", {
|
|
42537
42507
|
provider: "github",
|
|
42538
|
-
flow:
|
|
42508
|
+
flow: "device"
|
|
42539
42509
|
});
|
|
42540
42510
|
}, "git-auth-github");
|
|
42541
42511
|
}
|
|
@@ -43319,11 +43289,13 @@ Examples:
|
|
|
43319
43289
|
$ lua version delete v3 --force Skip confirmation
|
|
43320
43290
|
`).action((version, opts) => versionDeleteCommand(version, opts));
|
|
43321
43291
|
const gitGroup = program2.command("git").description("Manage opt-in git auto-commits for this project");
|
|
43322
|
-
gitGroup.command("connect").description("Enable git auto-commits (runs sanity checks, writes git.enabled: true)").action(() => gitConnectCommand(
|
|
43292
|
+
gitGroup.command("connect").description("Enable git auto-commits (runs sanity checks, writes git.enabled: true)").option("--auto-push", "Also enable post-commit auto-push (requires `lua git auth github` + a GitHub HTTPS origin remote)").action((opts) => gitConnectCommand({
|
|
43293
|
+
autoPush: opts.autoPush
|
|
43294
|
+
}));
|
|
43323
43295
|
gitGroup.command("disconnect").description("Disable git auto-commits (existing commits/tags untouched)").action(() => gitDisconnectCommand());
|
|
43324
43296
|
gitGroup.command("status").description("Show git integration config + last lua-issued commit/tag").action(() => gitStatusCommand());
|
|
43325
43297
|
const gitAuthGroup = gitGroup.command("auth").description("Manage git remote provider authentication");
|
|
43326
|
-
gitAuthGroup.command("github").description("Link a GitHub account").option("--device", "
|
|
43298
|
+
gitAuthGroup.command("github").description("Link a GitHub account (OAuth device flow)").option("--device", "(deprecated; device flow is always used \u2014 flag kept for compatibility)").option("--force", "Overwrite an existing link without prompting").action((opts) => gitAuthGithubCommand(opts));
|
|
43327
43299
|
gitAuthGroup.command("status").description("Show the current git auth status").action(() => gitAuthStatusCommand());
|
|
43328
43300
|
gitAuthGroup.command("disconnect [provider]").description("Disconnect a git provider (default: github)").action((provider) => gitAuthDisconnectCommand(provider));
|
|
43329
43301
|
program2.command("pull").description("\u{1F4E5} Pull the agent's source code locally").option("--version <version>", "Pull source linked to a specific agent version (requires versioning)").option("--force", "Skip confirmation prompt").addHelpText("after", `
|