lua-cli 3.17.2 → 3.17.4
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/index.js +397 -531
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/template/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5075,11 +5075,11 @@ var init_mcp_server_plugin = __esm({
|
|
|
5075
5075
|
// ../shared-source-sync/dist/index.mjs
|
|
5076
5076
|
import { createHash } from "crypto";
|
|
5077
5077
|
import { extname } from "path";
|
|
5078
|
-
import { readdirSync as readdirSync2, readFileSync as
|
|
5078
|
+
import { readdirSync as readdirSync2, readFileSync as readFileSync6, statSync as statSync2 } from "fs";
|
|
5079
5079
|
import { join as join4, sep } from "path";
|
|
5080
5080
|
import { gunzipSync, gzipSync } from "zlib";
|
|
5081
|
-
import { existsSync as existsSync5, mkdirSync as
|
|
5082
|
-
import { dirname as
|
|
5081
|
+
import { existsSync as existsSync5, mkdirSync as mkdirSync5, readFileSync as readFileSync22, statSync as statSync22, writeFileSync as writeFileSync5 } from "fs";
|
|
5082
|
+
import { dirname as dirname3, join as join22, resolve, sep as sep2 } from "path";
|
|
5083
5083
|
import { mkdirSync as mkdirSync22, readdirSync as readdirSync22, readFileSync as readFileSync32, statSync as statSync3, writeFileSync as writeFileSync22 } from "fs";
|
|
5084
5084
|
import { dirname as dirname22, join as join32, sep as sep3 } from "path";
|
|
5085
5085
|
import { gunzipSync as gunzipSync2, gzipSync as gzipSync2 } from "zlib";
|
|
@@ -5139,7 +5139,7 @@ function walkWorkspace(rootDir, opts = {}) {
|
|
|
5139
5139
|
if (stats.size > maxBytes) continue;
|
|
5140
5140
|
let content;
|
|
5141
5141
|
try {
|
|
5142
|
-
content =
|
|
5142
|
+
content = readFileSync6(abs);
|
|
5143
5143
|
} catch {
|
|
5144
5144
|
continue;
|
|
5145
5145
|
}
|
|
@@ -5256,10 +5256,10 @@ function restoreFromBlobs(manifest, blobs, targetDir, opts = {}) {
|
|
|
5256
5256
|
continue;
|
|
5257
5257
|
}
|
|
5258
5258
|
}
|
|
5259
|
-
|
|
5259
|
+
mkdirSync5(dirname3(targetPath), {
|
|
5260
5260
|
recursive: true
|
|
5261
5261
|
});
|
|
5262
|
-
|
|
5262
|
+
writeFileSync5(targetPath, content);
|
|
5263
5263
|
filesWritten++;
|
|
5264
5264
|
}
|
|
5265
5265
|
return {
|
|
@@ -5454,12 +5454,12 @@ var init_dist2 = __esm({
|
|
|
5454
5454
|
this.options = options;
|
|
5455
5455
|
this.fetchFn = options.fetch ?? fetch;
|
|
5456
5456
|
}
|
|
5457
|
-
url(
|
|
5457
|
+
url(path18) {
|
|
5458
5458
|
const base = this.options.baseUrl.replace(/\/$/, "");
|
|
5459
|
-
return `${base}/developer/agents/${encodeURIComponent(this.options.agentId)}${
|
|
5459
|
+
return `${base}/developer/agents/${encodeURIComponent(this.options.agentId)}${path18}`;
|
|
5460
5460
|
}
|
|
5461
|
-
async json(method,
|
|
5462
|
-
const endpoint = this.url(
|
|
5461
|
+
async json(method, path18, body) {
|
|
5462
|
+
const endpoint = this.url(path18);
|
|
5463
5463
|
const res = await this.fetchFn(endpoint, {
|
|
5464
5464
|
method,
|
|
5465
5465
|
headers: {
|
|
@@ -5478,7 +5478,7 @@ var init_dist2 = __esm({
|
|
|
5478
5478
|
} catch {
|
|
5479
5479
|
text2 = void 0;
|
|
5480
5480
|
}
|
|
5481
|
-
throw new BackupHttpError(`Backup request failed: ${method} ${
|
|
5481
|
+
throw new BackupHttpError(`Backup request failed: ${method} ${path18} \u2192 ${res.status} ${res.statusText}`, res.status, endpoint, text2);
|
|
5482
5482
|
}
|
|
5483
5483
|
const text = await res.text();
|
|
5484
5484
|
if (!text) return void 0;
|
|
@@ -5545,16 +5545,16 @@ var init_dist2 = __esm({
|
|
|
5545
5545
|
});
|
|
5546
5546
|
|
|
5547
5547
|
// src/compiler/utils/common.ts
|
|
5548
|
-
import
|
|
5548
|
+
import path3 from "path";
|
|
5549
5549
|
function hashContent(content) {
|
|
5550
5550
|
return hashContentTruncated(content);
|
|
5551
5551
|
}
|
|
5552
5552
|
function isInside(child, parent) {
|
|
5553
|
-
const resolvedChild =
|
|
5554
|
-
const resolvedParent =
|
|
5553
|
+
const resolvedChild = path3.resolve(child);
|
|
5554
|
+
const resolvedParent = path3.resolve(parent);
|
|
5555
5555
|
if (resolvedChild === resolvedParent) return true;
|
|
5556
|
-
const rel =
|
|
5557
|
-
return !!rel && !rel.startsWith("..") && !
|
|
5556
|
+
const rel = path3.relative(resolvedParent, resolvedChild);
|
|
5557
|
+
return !!rel && !rel.startsWith("..") && !path3.isAbsolute(rel);
|
|
5558
5558
|
}
|
|
5559
5559
|
function classifyProjectFile(name) {
|
|
5560
5560
|
if (name.endsWith(".ts") || name.endsWith(".tsx") || name.endsWith(".js")) {
|
|
@@ -5583,20 +5583,20 @@ var init_common = __esm({
|
|
|
5583
5583
|
});
|
|
5584
5584
|
|
|
5585
5585
|
// src/compiler/utils/path-resolver.ts
|
|
5586
|
-
import * as
|
|
5587
|
-
import * as
|
|
5586
|
+
import * as fs3 from "fs";
|
|
5587
|
+
import * as path4 from "path";
|
|
5588
5588
|
function getTsConfigPathMappings(rootDir) {
|
|
5589
|
-
const resolvedRoot =
|
|
5589
|
+
const resolvedRoot = path4.resolve(rootDir);
|
|
5590
5590
|
if (mappingsCache.has(resolvedRoot)) {
|
|
5591
5591
|
return mappingsCache.get(resolvedRoot) ?? null;
|
|
5592
5592
|
}
|
|
5593
|
-
const tsconfigPath =
|
|
5594
|
-
if (!
|
|
5593
|
+
const tsconfigPath = path4.join(resolvedRoot, "tsconfig.json");
|
|
5594
|
+
if (!fs3.existsSync(tsconfigPath)) {
|
|
5595
5595
|
mappingsCache.set(resolvedRoot, null);
|
|
5596
5596
|
return null;
|
|
5597
5597
|
}
|
|
5598
5598
|
try {
|
|
5599
|
-
const tsconfigContent =
|
|
5599
|
+
const tsconfigContent = fs3.readFileSync(tsconfigPath, "utf-8");
|
|
5600
5600
|
const tsconfig = JSON.parse(tsconfigContent);
|
|
5601
5601
|
const compilerOptions = tsconfig.compilerOptions || {};
|
|
5602
5602
|
if (compilerOptions.paths) {
|
|
@@ -5623,7 +5623,7 @@ function resolvePathAlias(specifier, rootDir) {
|
|
|
5623
5623
|
if (match) {
|
|
5624
5624
|
const captured = match[1] || "";
|
|
5625
5625
|
const targetPath = targets[0].replace("*", captured);
|
|
5626
|
-
return
|
|
5626
|
+
return path4.join(mappings.rootDir, mappings.baseUrl, targetPath);
|
|
5627
5627
|
}
|
|
5628
5628
|
}
|
|
5629
5629
|
return null;
|
|
@@ -5635,20 +5635,20 @@ function resolveModuleSpecifier(specifier, fromFile, rootDir) {
|
|
|
5635
5635
|
return tryExtensions(aliasResolved);
|
|
5636
5636
|
}
|
|
5637
5637
|
if (normalized.startsWith("./") || normalized.startsWith("../")) {
|
|
5638
|
-
const basePath =
|
|
5638
|
+
const basePath = path4.resolve(path4.dirname(fromFile), normalized);
|
|
5639
5639
|
return tryExtensions(basePath);
|
|
5640
5640
|
}
|
|
5641
5641
|
return void 0;
|
|
5642
5642
|
}
|
|
5643
5643
|
function tryExtensions(basePath) {
|
|
5644
5644
|
for (const ext of MODULE_EXTENSIONS) {
|
|
5645
|
-
const full = ext.startsWith("/") ?
|
|
5646
|
-
if (
|
|
5645
|
+
const full = ext.startsWith("/") ? path4.join(basePath, ext) : basePath + ext;
|
|
5646
|
+
if (fs3.existsSync(full)) return full;
|
|
5647
5647
|
}
|
|
5648
5648
|
return void 0;
|
|
5649
5649
|
}
|
|
5650
5650
|
function registerProjectRootDir(project, rootDir) {
|
|
5651
|
-
projectRootDirs.set(project,
|
|
5651
|
+
projectRootDirs.set(project, path4.resolve(rootDir));
|
|
5652
5652
|
}
|
|
5653
5653
|
function getProjectRootDir(project) {
|
|
5654
5654
|
return projectRootDirs.get(project);
|
|
@@ -6248,7 +6248,7 @@ var init_reference_resolver = __esm({
|
|
|
6248
6248
|
});
|
|
6249
6249
|
|
|
6250
6250
|
// src/compiler/plugins/skill.plugin.ts
|
|
6251
|
-
import
|
|
6251
|
+
import fs4 from "fs/promises";
|
|
6252
6252
|
import { Node as Node11 } from "ts-morph";
|
|
6253
6253
|
function findEnclosingVariableDeclaration(config) {
|
|
6254
6254
|
let current = config.getParent();
|
|
@@ -6581,7 +6581,7 @@ var init_skill_plugin = __esm({
|
|
|
6581
6581
|
description: metadata.description,
|
|
6582
6582
|
metadata: this.sanitizeForPersistence(metadata.metadata)
|
|
6583
6583
|
}, null, 2);
|
|
6584
|
-
const originalSource = await
|
|
6584
|
+
const originalSource = await fs4.readFile(metadata.sourcePath, "utf-8");
|
|
6585
6585
|
return {
|
|
6586
6586
|
code,
|
|
6587
6587
|
sourceMap: "",
|
|
@@ -7380,10 +7380,10 @@ var init_device_trigger_plugin = __esm({
|
|
|
7380
7380
|
});
|
|
7381
7381
|
|
|
7382
7382
|
// src/compiler/utils/primitive-rewrite.ts
|
|
7383
|
-
import { readFileSync as
|
|
7383
|
+
import { readFileSync as readFileSync8 } from "fs";
|
|
7384
7384
|
import { Node as Node14, Project, ts as ts3 } from "ts-morph";
|
|
7385
7385
|
function rewritePrimitiveSource(metadata, opts) {
|
|
7386
|
-
const sourceCode =
|
|
7386
|
+
const sourceCode = readFileSync8(metadata.sourcePath, "utf-8");
|
|
7387
7387
|
const localProject = new Project({
|
|
7388
7388
|
useInMemoryFileSystem: true,
|
|
7389
7389
|
compilerOptions: {
|
|
@@ -7722,7 +7722,7 @@ var init_cross_file_specs = __esm({
|
|
|
7722
7722
|
});
|
|
7723
7723
|
|
|
7724
7724
|
// src/compiler/plugins/voice.plugin.ts
|
|
7725
|
-
import
|
|
7725
|
+
import fs5 from "fs/promises";
|
|
7726
7726
|
import { Node as Node15 } from "ts-morph";
|
|
7727
7727
|
function astObjectToPlain(obj) {
|
|
7728
7728
|
const result = {};
|
|
@@ -8266,8 +8266,8 @@ var init_voice_plugin = __esm({
|
|
|
8266
8266
|
}, "isMissingTopLevelRequired");
|
|
8267
8267
|
for (const issue of parsed.error.issues) {
|
|
8268
8268
|
if (isMissingTopLevelRequired(issue)) continue;
|
|
8269
|
-
const
|
|
8270
|
-
errors.push(validationError(`Voice config invalid at \`${
|
|
8269
|
+
const path18 = issue.path.length > 0 ? issue.path.join(".") : "<root>";
|
|
8270
|
+
errors.push(validationError(`Voice config invalid at \`${path18}\`: ${issue.message}`, {
|
|
8271
8271
|
line
|
|
8272
8272
|
}));
|
|
8273
8273
|
}
|
|
@@ -8348,7 +8348,7 @@ var init_voice_plugin = __esm({
|
|
|
8348
8348
|
description: metadata.description,
|
|
8349
8349
|
metadata: sanitized
|
|
8350
8350
|
}, null, 2);
|
|
8351
|
-
const originalSource = await
|
|
8351
|
+
const originalSource = await fs5.readFile(metadata.sourcePath, "utf-8");
|
|
8352
8352
|
return {
|
|
8353
8353
|
code,
|
|
8354
8354
|
sourceMap: "",
|
|
@@ -8502,8 +8502,8 @@ var init_registry = __esm({
|
|
|
8502
8502
|
});
|
|
8503
8503
|
|
|
8504
8504
|
// src/compiler/bundler.ts
|
|
8505
|
-
import
|
|
8506
|
-
import
|
|
8505
|
+
import fs6 from "fs/promises";
|
|
8506
|
+
import path5 from "path";
|
|
8507
8507
|
import crypto4 from "crypto";
|
|
8508
8508
|
import { build } from "esbuild";
|
|
8509
8509
|
var Bundler;
|
|
@@ -8572,9 +8572,9 @@ var init_bundler = __esm({
|
|
|
8572
8572
|
* Bundle a primitive's entry point using esbuild.
|
|
8573
8573
|
*/
|
|
8574
8574
|
async bundle(metadata, entryPointCode) {
|
|
8575
|
-
const tempDir =
|
|
8576
|
-
const outfile =
|
|
8577
|
-
const sourceDir =
|
|
8575
|
+
const tempDir = path5.join(this.options.outDir, ".temp");
|
|
8576
|
+
const outfile = path5.join(tempDir, `${metadata.kind}-${metadata.name}.bundle.js`);
|
|
8577
|
+
const sourceDir = path5.dirname(metadata.sourcePath);
|
|
8578
8578
|
if (this.options.debug) {
|
|
8579
8579
|
this.verbose(` Source: ${metadata.sourcePath}`);
|
|
8580
8580
|
this.verbose(` Output: ${outfile}`);
|
|
@@ -8604,15 +8604,15 @@ var init_bundler = __esm({
|
|
|
8604
8604
|
],
|
|
8605
8605
|
logLevel: this.options.debug ? "debug" : "silent"
|
|
8606
8606
|
});
|
|
8607
|
-
const code = await
|
|
8607
|
+
const code = await fs6.readFile(outfile, "utf-8");
|
|
8608
8608
|
let sourceMap = "";
|
|
8609
8609
|
try {
|
|
8610
|
-
sourceMap = await
|
|
8610
|
+
sourceMap = await fs6.readFile(outfile + ".map", "utf-8");
|
|
8611
8611
|
} catch {
|
|
8612
8612
|
}
|
|
8613
|
-
const originalSource = await
|
|
8613
|
+
const originalSource = await fs6.readFile(metadata.sourcePath, "utf-8");
|
|
8614
8614
|
const hash = crypto4.createHash("sha256").update(code).digest("hex").slice(0, 16);
|
|
8615
|
-
const stats = await
|
|
8615
|
+
const stats = await fs6.stat(outfile);
|
|
8616
8616
|
return {
|
|
8617
8617
|
code,
|
|
8618
8618
|
sourceMap,
|
|
@@ -8629,14 +8629,14 @@ var init_bundler = __esm({
|
|
|
8629
8629
|
const bundler = this;
|
|
8630
8630
|
const sourcePath = metadata.sourcePath;
|
|
8631
8631
|
const exportName = metadata.exportName;
|
|
8632
|
-
const sourceDir =
|
|
8632
|
+
const sourceDir = path5.dirname(sourcePath);
|
|
8633
8633
|
return {
|
|
8634
8634
|
name: "lua-virtual-source",
|
|
8635
8635
|
setup(build2) {
|
|
8636
8636
|
build2.onResolve({
|
|
8637
8637
|
filter: /.*/
|
|
8638
8638
|
}, (args2) => {
|
|
8639
|
-
const resolved = args2.path.startsWith(".") ?
|
|
8639
|
+
const resolved = args2.path.startsWith(".") ? path5.resolve(args2.resolveDir, args2.path) : args2.path;
|
|
8640
8640
|
const normalizedResolved = resolved.replace(/\.(ts|tsx|js|jsx)$/, "");
|
|
8641
8641
|
const normalizedSource = sourcePath.replace(/\.(ts|tsx|js|jsx)$/, "");
|
|
8642
8642
|
if (normalizedResolved === normalizedSource) {
|
|
@@ -8652,8 +8652,8 @@ var init_bundler = __esm({
|
|
|
8652
8652
|
namespace: "lua-virtual-source"
|
|
8653
8653
|
}, async () => {
|
|
8654
8654
|
const sourceFile = bundler.project.getSourceFile(sourcePath);
|
|
8655
|
-
let content = sourceFile?.getText() ?? await
|
|
8656
|
-
content = bundler.stripLuaCliImportsAST(content,
|
|
8655
|
+
let content = sourceFile?.getText() ?? await fs6.readFile(sourcePath, "utf-8");
|
|
8656
|
+
content = bundler.stripLuaCliImportsAST(content, path5.basename(sourcePath));
|
|
8657
8657
|
const virtualContent = metadata.isDefaultExport ? content : `${content}
|
|
8658
8658
|
export { ${exportName} as __lua_target__ };
|
|
8659
8659
|
`;
|
|
@@ -8681,17 +8681,17 @@ export { ${exportName} as __lua_target__ };
|
|
|
8681
8681
|
namespace: "file"
|
|
8682
8682
|
}, async (args2) => {
|
|
8683
8683
|
if (args2.path.includes("node_modules")) return null;
|
|
8684
|
-
const contents = await
|
|
8684
|
+
const contents = await fs6.readFile(args2.path, "utf-8");
|
|
8685
8685
|
if (!contents.includes("lua-cli") && !contents.includes("api-exports")) {
|
|
8686
8686
|
return null;
|
|
8687
8687
|
}
|
|
8688
8688
|
try {
|
|
8689
|
-
const modifiedContents = stripImports(contents,
|
|
8689
|
+
const modifiedContents = stripImports(contents, path5.basename(args2.path));
|
|
8690
8690
|
if (modifiedContents !== contents) {
|
|
8691
8691
|
return {
|
|
8692
8692
|
contents: modifiedContents,
|
|
8693
8693
|
loader: args2.path.endsWith(".ts") || args2.path.endsWith(".tsx") ? "ts" : "js",
|
|
8694
|
-
resolveDir:
|
|
8694
|
+
resolveDir: path5.dirname(args2.path)
|
|
8695
8695
|
};
|
|
8696
8696
|
}
|
|
8697
8697
|
return null;
|
|
@@ -8728,8 +8728,8 @@ export { ${exportName} as __lua_target__ };
|
|
|
8728
8728
|
|
|
8729
8729
|
// src/compiler/agent-traverser.ts
|
|
8730
8730
|
import { Project as Project2, Node as Node16 } from "ts-morph";
|
|
8731
|
-
import
|
|
8732
|
-
import
|
|
8731
|
+
import path6 from "path";
|
|
8732
|
+
import fs7 from "fs";
|
|
8733
8733
|
var PRIMITIVE_TYPES, AgentTraverser;
|
|
8734
8734
|
var init_agent_traverser = __esm({
|
|
8735
8735
|
"src/compiler/agent-traverser.ts"() {
|
|
@@ -8802,7 +8802,7 @@ var init_agent_traverser = __esm({
|
|
|
8802
8802
|
this.rootDir = rootDir;
|
|
8803
8803
|
this.debug = debug;
|
|
8804
8804
|
this.project = new Project2({
|
|
8805
|
-
tsConfigFilePath:
|
|
8805
|
+
tsConfigFilePath: path6.join(rootDir, "tsconfig.json"),
|
|
8806
8806
|
skipAddingFilesFromTsConfig: true
|
|
8807
8807
|
});
|
|
8808
8808
|
registerProjectRootDir(this.project, this.rootDir);
|
|
@@ -8886,15 +8886,15 @@ var init_agent_traverser = __esm({
|
|
|
8886
8886
|
*/
|
|
8887
8887
|
detectAgent() {
|
|
8888
8888
|
const priorityFiles = [
|
|
8889
|
-
|
|
8890
|
-
|
|
8891
|
-
|
|
8892
|
-
|
|
8893
|
-
|
|
8894
|
-
|
|
8889
|
+
path6.join(this.rootDir, "index.ts"),
|
|
8890
|
+
path6.join(this.rootDir, "src", "index.ts"),
|
|
8891
|
+
path6.join(this.rootDir, "agent.ts"),
|
|
8892
|
+
path6.join(this.rootDir, "src", "agent.ts"),
|
|
8893
|
+
path6.join(this.rootDir, "main.ts"),
|
|
8894
|
+
path6.join(this.rootDir, "src", "main.ts")
|
|
8895
8895
|
];
|
|
8896
8896
|
for (const filePath of priorityFiles) {
|
|
8897
|
-
if (
|
|
8897
|
+
if (fs7.existsSync(filePath)) {
|
|
8898
8898
|
try {
|
|
8899
8899
|
const sourceFile = this.project.addSourceFileAtPath(filePath);
|
|
8900
8900
|
const agent = this.detectAgentInFile(sourceFile);
|
|
@@ -9046,7 +9046,7 @@ var init_agent_traverser = __esm({
|
|
|
9046
9046
|
console.warn(formatSarifWarning({
|
|
9047
9047
|
ruleId: "lua/missing-primitive-declaration",
|
|
9048
9048
|
filePath: sourcePath,
|
|
9049
|
-
message: `agent references ${kind} "${refName}" but ${
|
|
9049
|
+
message: `agent references ${kind} "${refName}" but ${path6.basename(sourcePath)} does not define a matching primitive`,
|
|
9050
9050
|
hint: `export a named ${plugin.displayName.toLowerCase()} declaration as "${refName}", or adjust the import so it points to the file that does`
|
|
9051
9051
|
}));
|
|
9052
9052
|
return null;
|
|
@@ -9066,20 +9066,20 @@ var init_agent_traverser = __esm({
|
|
|
9066
9066
|
});
|
|
9067
9067
|
|
|
9068
9068
|
// src/compiler/utils/workspace.ts
|
|
9069
|
-
import
|
|
9070
|
-
import
|
|
9069
|
+
import fs8 from "fs";
|
|
9070
|
+
import path7 from "path";
|
|
9071
9071
|
function findWorkspaceRoot(rootDir) {
|
|
9072
|
-
const resolvedInput =
|
|
9072
|
+
const resolvedInput = path7.resolve(rootDir);
|
|
9073
9073
|
const cached = workspaceRootCache.get(resolvedInput);
|
|
9074
9074
|
if (cached !== void 0) return cached;
|
|
9075
9075
|
let current = resolvedInput;
|
|
9076
|
-
const { root } =
|
|
9076
|
+
const { root } = path7.parse(current);
|
|
9077
9077
|
while (true) {
|
|
9078
9078
|
if (isWorkspaceRoot(current)) {
|
|
9079
9079
|
workspaceRootCache.set(resolvedInput, current);
|
|
9080
9080
|
return current;
|
|
9081
9081
|
}
|
|
9082
|
-
const parent =
|
|
9082
|
+
const parent = path7.dirname(current);
|
|
9083
9083
|
if (parent === current || current === root) break;
|
|
9084
9084
|
current = parent;
|
|
9085
9085
|
}
|
|
@@ -9087,22 +9087,22 @@ function findWorkspaceRoot(rootDir) {
|
|
|
9087
9087
|
return resolvedInput;
|
|
9088
9088
|
}
|
|
9089
9089
|
function isWorkspaceRoot(dir) {
|
|
9090
|
-
if (fileExists(
|
|
9091
|
-
if (fileExists(
|
|
9092
|
-
if (packageJsonHasWorkspaces(
|
|
9093
|
-
if (dirExists(
|
|
9090
|
+
if (fileExists(path7.join(dir, "pnpm-workspace.yaml"))) return true;
|
|
9091
|
+
if (fileExists(path7.join(dir, "lerna.json"))) return true;
|
|
9092
|
+
if (packageJsonHasWorkspaces(path7.join(dir, "package.json"))) return true;
|
|
9093
|
+
if (dirExists(path7.join(dir, ".git"))) return true;
|
|
9094
9094
|
return false;
|
|
9095
9095
|
}
|
|
9096
9096
|
function fileExists(p) {
|
|
9097
9097
|
try {
|
|
9098
|
-
return
|
|
9098
|
+
return fs8.statSync(p).isFile();
|
|
9099
9099
|
} catch {
|
|
9100
9100
|
return false;
|
|
9101
9101
|
}
|
|
9102
9102
|
}
|
|
9103
9103
|
function dirExists(p) {
|
|
9104
9104
|
try {
|
|
9105
|
-
return
|
|
9105
|
+
return fs8.statSync(p).isDirectory();
|
|
9106
9106
|
} catch {
|
|
9107
9107
|
return false;
|
|
9108
9108
|
}
|
|
@@ -9110,7 +9110,7 @@ function dirExists(p) {
|
|
|
9110
9110
|
function packageJsonHasWorkspaces(pkgPath) {
|
|
9111
9111
|
if (!fileExists(pkgPath)) return false;
|
|
9112
9112
|
try {
|
|
9113
|
-
const raw =
|
|
9113
|
+
const raw = fs8.readFileSync(pkgPath, "utf-8");
|
|
9114
9114
|
const json = JSON.parse(raw);
|
|
9115
9115
|
if (!json.workspaces) return false;
|
|
9116
9116
|
return Array.isArray(json.workspaces) || typeof json.workspaces === "object";
|
|
@@ -9132,8 +9132,8 @@ var init_workspace = __esm({
|
|
|
9132
9132
|
});
|
|
9133
9133
|
|
|
9134
9134
|
// src/compiler/compiler.ts
|
|
9135
|
-
import
|
|
9136
|
-
import
|
|
9135
|
+
import fs9 from "fs/promises";
|
|
9136
|
+
import path8 from "path";
|
|
9137
9137
|
import { Project as Project3 } from "ts-morph";
|
|
9138
9138
|
async function compile(options) {
|
|
9139
9139
|
const compiler = new Compiler(options);
|
|
@@ -9186,7 +9186,7 @@ var init_compiler = __esm({
|
|
|
9186
9186
|
...options
|
|
9187
9187
|
};
|
|
9188
9188
|
this.project = new Project3({
|
|
9189
|
-
tsConfigFilePath:
|
|
9189
|
+
tsConfigFilePath: path8.join(options.rootDir, "tsconfig.json")
|
|
9190
9190
|
});
|
|
9191
9191
|
registerProjectRootDir(this.project, this.options.rootDir);
|
|
9192
9192
|
this.bundler = new Bundler({
|
|
@@ -9263,10 +9263,10 @@ var init_compiler = __esm({
|
|
|
9263
9263
|
return await this.createResult(false, [], errors, warnings, startTime);
|
|
9264
9264
|
}
|
|
9265
9265
|
this.verbose("\u{1F4E6} Bundling primitives...");
|
|
9266
|
-
await
|
|
9266
|
+
await fs9.mkdir(this.options.outDir, {
|
|
9267
9267
|
recursive: true
|
|
9268
9268
|
});
|
|
9269
|
-
await
|
|
9269
|
+
await fs9.mkdir(path8.join(this.options.outDir, ".temp"), {
|
|
9270
9270
|
recursive: true
|
|
9271
9271
|
});
|
|
9272
9272
|
const CONCURRENCY = 4;
|
|
@@ -9286,7 +9286,7 @@ var init_compiler = __esm({
|
|
|
9286
9286
|
this.verbose("\u{1F4BE} Writing artifacts...");
|
|
9287
9287
|
await this.writeArtifacts(compiledPrimitives);
|
|
9288
9288
|
if (!this.options.debug) {
|
|
9289
|
-
await
|
|
9289
|
+
await fs9.rm(path8.join(this.options.outDir, ".temp"), {
|
|
9290
9290
|
recursive: true,
|
|
9291
9291
|
force: true
|
|
9292
9292
|
});
|
|
@@ -9329,7 +9329,7 @@ var init_compiler = __esm({
|
|
|
9329
9329
|
*/
|
|
9330
9330
|
getWorkspaceRoot() {
|
|
9331
9331
|
if (this._workspaceRoot === void 0) {
|
|
9332
|
-
this._workspaceRoot = findWorkspaceRoot(
|
|
9332
|
+
this._workspaceRoot = findWorkspaceRoot(path8.resolve(this.options.rootDir));
|
|
9333
9333
|
}
|
|
9334
9334
|
return this._workspaceRoot;
|
|
9335
9335
|
}
|
|
@@ -9343,18 +9343,18 @@ var init_compiler = __esm({
|
|
|
9343
9343
|
* - Files outside the detected workspace root (not our code)
|
|
9344
9344
|
*/
|
|
9345
9345
|
collectExternalWorkspaceFiles(traverser) {
|
|
9346
|
-
const rootDir =
|
|
9346
|
+
const rootDir = path8.resolve(this.options.rootDir);
|
|
9347
9347
|
const workspaceRoot = this.getWorkspaceRoot();
|
|
9348
9348
|
if (workspaceRoot === rootDir) return [];
|
|
9349
9349
|
const loaded = traverser.getAllLoadedSourceFilePaths();
|
|
9350
9350
|
const result = [];
|
|
9351
9351
|
const seen = /* @__PURE__ */ new Set();
|
|
9352
9352
|
for (const raw of loaded) {
|
|
9353
|
-
const abs =
|
|
9353
|
+
const abs = path8.resolve(raw);
|
|
9354
9354
|
if (seen.has(abs)) continue;
|
|
9355
9355
|
seen.add(abs);
|
|
9356
9356
|
if (isInside(abs, rootDir)) continue;
|
|
9357
|
-
if (abs.includes(`${
|
|
9357
|
+
if (abs.includes(`${path8.sep}node_modules${path8.sep}`)) continue;
|
|
9358
9358
|
if (!isInside(abs, workspaceRoot)) continue;
|
|
9359
9359
|
result.push(abs);
|
|
9360
9360
|
}
|
|
@@ -9487,9 +9487,9 @@ var init_compiler = __esm({
|
|
|
9487
9487
|
* @param primitives - All compiled primitives to write
|
|
9488
9488
|
*/
|
|
9489
9489
|
async writeArtifacts(primitives) {
|
|
9490
|
-
const artifactsDir =
|
|
9491
|
-
const sourcesDir =
|
|
9492
|
-
await
|
|
9490
|
+
const artifactsDir = path8.join(this.options.outDir, "artifacts");
|
|
9491
|
+
const sourcesDir = path8.join(this.options.outDir, "sources");
|
|
9492
|
+
await fs9.mkdir(sourcesDir, {
|
|
9493
9493
|
recursive: true
|
|
9494
9494
|
});
|
|
9495
9495
|
const writtenSources = /* @__PURE__ */ new Map();
|
|
@@ -9497,7 +9497,7 @@ var init_compiler = __esm({
|
|
|
9497
9497
|
this.verbose(" \u{1F4C2} Collecting project files...");
|
|
9498
9498
|
const projectFiles = await this.storeProjectFiles(sourcesDir, writtenSources);
|
|
9499
9499
|
const manifest = await this.createManifest(primitives, projectFiles);
|
|
9500
|
-
await
|
|
9500
|
+
await fs9.writeFile(path8.join(this.options.outDir, "manifest.json"), JSON.stringify(manifest, null, 2));
|
|
9501
9501
|
this.verbose(` \u{1F4E6} Total files stored: ${writtenSources.size} (deduplicated)`);
|
|
9502
9502
|
this.verbose(` \u{1F4C1} Project files: ${projectFiles.length}`);
|
|
9503
9503
|
if (this.options.verbose || this.options.debug) {
|
|
@@ -9509,25 +9509,25 @@ var init_compiler = __esm({
|
|
|
9509
9509
|
*/
|
|
9510
9510
|
async writePrimitiveArtifacts(primitives, artifactsDir, sourcesDir, writtenSources) {
|
|
9511
9511
|
for (const primitive of primitives) {
|
|
9512
|
-
const primitiveDir =
|
|
9513
|
-
await
|
|
9512
|
+
const primitiveDir = path8.join(artifactsDir, primitive.kind);
|
|
9513
|
+
await fs9.mkdir(primitiveDir, {
|
|
9514
9514
|
recursive: true
|
|
9515
9515
|
});
|
|
9516
9516
|
const baseName = primitive.name;
|
|
9517
|
-
await
|
|
9517
|
+
await fs9.writeFile(path8.join(primitiveDir, `${baseName}.js`), primitive.artifact.code);
|
|
9518
9518
|
if (primitive.artifact.sourceMap) {
|
|
9519
|
-
await
|
|
9519
|
+
await fs9.writeFile(path8.join(primitiveDir, `${baseName}.js.map`), primitive.artifact.sourceMap);
|
|
9520
9520
|
}
|
|
9521
9521
|
const sourceHash = hashContent(primitive.artifact.originalSource);
|
|
9522
9522
|
if (!writtenSources.has(sourceHash)) {
|
|
9523
9523
|
const ext = primitive.sourcePath.endsWith(".tsx") ? ".tsx" : ".ts";
|
|
9524
|
-
await
|
|
9525
|
-
const relativePath =
|
|
9524
|
+
await fs9.writeFile(path8.join(sourcesDir, `${sourceHash}${ext}`), primitive.artifact.originalSource);
|
|
9525
|
+
const relativePath = path8.relative(this.options.rootDir, primitive.sourcePath);
|
|
9526
9526
|
writtenSources.set(sourceHash, relativePath);
|
|
9527
9527
|
}
|
|
9528
9528
|
const sidecarPlugin = pluginRegistry.get(primitive.kind);
|
|
9529
9529
|
const sidecarMetadata = sidecarPlugin?.sanitizeForPersistence ? sidecarPlugin.sanitizeForPersistence(primitive.metadata) : primitive.metadata;
|
|
9530
|
-
await
|
|
9530
|
+
await fs9.writeFile(path8.join(primitiveDir, `${baseName}.json`), JSON.stringify({
|
|
9531
9531
|
kind: primitive.kind,
|
|
9532
9532
|
name: primitive.name,
|
|
9533
9533
|
description: primitive.description,
|
|
@@ -9549,12 +9549,12 @@ var init_compiler = __esm({
|
|
|
9549
9549
|
const allFiles = await this.collectProjectFiles();
|
|
9550
9550
|
const workspaceRoot = this.getWorkspaceRoot();
|
|
9551
9551
|
for (const file of allFiles) {
|
|
9552
|
-
const absPath = file.external ?
|
|
9553
|
-
const content = await
|
|
9552
|
+
const absPath = file.external ? path8.join(workspaceRoot, file.relativePath) : path8.join(this.options.rootDir, file.relativePath);
|
|
9553
|
+
const content = await fs9.readFile(absPath, "utf-8");
|
|
9554
9554
|
const hash = hashContent(content);
|
|
9555
9555
|
if (!writtenSources.has(hash)) {
|
|
9556
|
-
const ext =
|
|
9557
|
-
await
|
|
9556
|
+
const ext = path8.extname(file.relativePath) || ".txt";
|
|
9557
|
+
await fs9.writeFile(path8.join(sourcesDir, `${hash}${ext}`), content);
|
|
9558
9558
|
writtenSources.set(hash, file.relativePath);
|
|
9559
9559
|
}
|
|
9560
9560
|
projectFiles.push({
|
|
@@ -9630,12 +9630,12 @@ var init_compiler = __esm({
|
|
|
9630
9630
|
async collectProjectFiles() {
|
|
9631
9631
|
const files = [];
|
|
9632
9632
|
const scanDir = /* @__PURE__ */ __name(async (dir, relativeBase = "") => {
|
|
9633
|
-
const entries = await
|
|
9633
|
+
const entries = await fs9.readdir(dir, {
|
|
9634
9634
|
withFileTypes: true
|
|
9635
9635
|
});
|
|
9636
9636
|
for (const entry of entries) {
|
|
9637
9637
|
const relativePath = relativeBase ? `${relativeBase}/${entry.name}` : entry.name;
|
|
9638
|
-
const fullPath =
|
|
9638
|
+
const fullPath = path8.join(dir, entry.name);
|
|
9639
9639
|
if (entry.isDirectory()) {
|
|
9640
9640
|
if (shouldSkipDirectory(entry.name)) continue;
|
|
9641
9641
|
await scanDir(fullPath, relativePath);
|
|
@@ -9652,10 +9652,10 @@ var init_compiler = __esm({
|
|
|
9652
9652
|
const workspaceRoot = this.getWorkspaceRoot();
|
|
9653
9653
|
const externalSeen = /* @__PURE__ */ new Set();
|
|
9654
9654
|
for (const abs of this.externalWorkspaceFiles) {
|
|
9655
|
-
const rel =
|
|
9655
|
+
const rel = path8.relative(workspaceRoot, abs).split(path8.sep).join("/");
|
|
9656
9656
|
if (!rel || rel.startsWith("..")) continue;
|
|
9657
9657
|
if (externalSeen.has(rel)) continue;
|
|
9658
|
-
const name =
|
|
9658
|
+
const name = path8.basename(abs);
|
|
9659
9659
|
if (shouldSkipFile(rel) || shouldSkipFile(name)) continue;
|
|
9660
9660
|
externalSeen.add(rel);
|
|
9661
9661
|
files.push({
|
|
@@ -9756,13 +9756,13 @@ var init_compiler = __esm({
|
|
|
9756
9756
|
});
|
|
9757
9757
|
|
|
9758
9758
|
// src/compiler/utils/file-discovery.ts
|
|
9759
|
-
import
|
|
9760
|
-
import
|
|
9759
|
+
import path9 from "path";
|
|
9760
|
+
import fs10 from "fs";
|
|
9761
9761
|
function findEntryPoint(projectDir) {
|
|
9762
9762
|
const baseDir = projectDir || process.cwd();
|
|
9763
9763
|
for (const relativePath of ENTRY_POINT_PRIORITY) {
|
|
9764
|
-
const fullPath =
|
|
9765
|
-
if (
|
|
9764
|
+
const fullPath = path9.join(baseDir, relativePath);
|
|
9765
|
+
if (fs10.existsSync(fullPath)) {
|
|
9766
9766
|
return fullPath;
|
|
9767
9767
|
}
|
|
9768
9768
|
}
|
|
@@ -9799,8 +9799,8 @@ var init_file_discovery = __esm({
|
|
|
9799
9799
|
|
|
9800
9800
|
// src/compiler/source-writer.ts
|
|
9801
9801
|
import { Project as Project4, Node as Node17 } from "ts-morph";
|
|
9802
|
-
import
|
|
9803
|
-
import
|
|
9802
|
+
import fs11 from "fs";
|
|
9803
|
+
import path10 from "path";
|
|
9804
9804
|
function resolveEntryPath(options) {
|
|
9805
9805
|
let indexPath;
|
|
9806
9806
|
try {
|
|
@@ -9812,14 +9812,14 @@ function resolveEntryPath(options) {
|
|
|
9812
9812
|
indexPath = entryPoint;
|
|
9813
9813
|
} else {
|
|
9814
9814
|
const baseDir = options?.projectDir || process.cwd();
|
|
9815
|
-
indexPath =
|
|
9815
|
+
indexPath = path10.join(baseDir, "src", "index.ts");
|
|
9816
9816
|
}
|
|
9817
9817
|
}
|
|
9818
9818
|
} catch {
|
|
9819
9819
|
const baseDir = options?.projectDir || process.cwd();
|
|
9820
|
-
indexPath =
|
|
9820
|
+
indexPath = path10.join(baseDir, "src", "index.ts");
|
|
9821
9821
|
}
|
|
9822
|
-
if (!
|
|
9822
|
+
if (!fs11.existsSync(indexPath)) {
|
|
9823
9823
|
console.warn(`Warning: Entry file not found at ${indexPath}`);
|
|
9824
9824
|
return null;
|
|
9825
9825
|
}
|
|
@@ -13809,164 +13809,6 @@ __name(promptAuthMethod, "promptAuthMethod");
|
|
|
13809
13809
|
|
|
13810
13810
|
// src/commands/configure.ts
|
|
13811
13811
|
init_analytics();
|
|
13812
|
-
|
|
13813
|
-
// src/utils/versioning-mode-cache.ts
|
|
13814
|
-
import * as fs3 from "fs";
|
|
13815
|
-
import * as path3 from "path";
|
|
13816
|
-
|
|
13817
|
-
// src/api/agent-version.api.service.ts
|
|
13818
|
-
init_http_client();
|
|
13819
|
-
var AgentVersionApi = class extends HttpClient {
|
|
13820
|
-
static {
|
|
13821
|
-
__name(this, "AgentVersionApi");
|
|
13822
|
-
}
|
|
13823
|
-
apiKey;
|
|
13824
|
-
agentId;
|
|
13825
|
-
constructor(baseUrl, apiKey, agentId) {
|
|
13826
|
-
super(baseUrl);
|
|
13827
|
-
this.apiKey = apiKey;
|
|
13828
|
-
this.agentId = agentId;
|
|
13829
|
-
}
|
|
13830
|
-
get basePath() {
|
|
13831
|
-
return `/developer/agents/${encodeURIComponent(this.agentId)}`;
|
|
13832
|
-
}
|
|
13833
|
-
get authHeader() {
|
|
13834
|
-
return {
|
|
13835
|
-
Authorization: `Bearer ${this.apiKey}`
|
|
13836
|
-
};
|
|
13837
|
-
}
|
|
13838
|
-
// ---------------------------------------------------------------------------
|
|
13839
|
-
// Versioning mode
|
|
13840
|
-
// ---------------------------------------------------------------------------
|
|
13841
|
-
async getVersioningMode() {
|
|
13842
|
-
return this.httpGet(`${this.basePath}/versioning/mode`, this.authHeader);
|
|
13843
|
-
}
|
|
13844
|
-
// ---------------------------------------------------------------------------
|
|
13845
|
-
// Version CRUD
|
|
13846
|
-
// ---------------------------------------------------------------------------
|
|
13847
|
-
async createVersion(body) {
|
|
13848
|
-
return this.httpPost(`${this.basePath}/versions`, body, this.authHeader);
|
|
13849
|
-
}
|
|
13850
|
-
async listVersions(query) {
|
|
13851
|
-
const params = new URLSearchParams();
|
|
13852
|
-
if (query?.all !== void 0) params.append("all", String(query.all));
|
|
13853
|
-
if (query?.limit !== void 0) params.append("limit", String(query.limit));
|
|
13854
|
-
if (query?.status !== void 0) params.append("status", query.status);
|
|
13855
|
-
const qs = params.toString();
|
|
13856
|
-
const url = qs ? `${this.basePath}/versions?${qs}` : `${this.basePath}/versions`;
|
|
13857
|
-
return this.httpGet(url, this.authHeader);
|
|
13858
|
-
}
|
|
13859
|
-
async getVersion(version) {
|
|
13860
|
-
return this.httpGet(`${this.basePath}/versions/${version}`, this.authHeader);
|
|
13861
|
-
}
|
|
13862
|
-
async deleteVersion(version) {
|
|
13863
|
-
return this.httpDelete(`${this.basePath}/versions/${version}`, this.authHeader);
|
|
13864
|
-
}
|
|
13865
|
-
// ---------------------------------------------------------------------------
|
|
13866
|
-
// Diff
|
|
13867
|
-
// ---------------------------------------------------------------------------
|
|
13868
|
-
async diffVersions(from, to) {
|
|
13869
|
-
const url = `${this.basePath}/versions/diff?from=${from}&to=${to}`;
|
|
13870
|
-
return this.httpGet(url, this.authHeader);
|
|
13871
|
-
}
|
|
13872
|
-
// ---------------------------------------------------------------------------
|
|
13873
|
-
// Promote
|
|
13874
|
-
// ---------------------------------------------------------------------------
|
|
13875
|
-
async promoteVersion(version) {
|
|
13876
|
-
return this.httpPost(`${this.basePath}/versions/${version}/promote`, {}, this.authHeader);
|
|
13877
|
-
}
|
|
13878
|
-
// ---------------------------------------------------------------------------
|
|
13879
|
-
// Patch commit hash — called by `lua version create` after a successful git
|
|
13880
|
-
// commit + tag to propagate the SHA to the backend AgentVersion record.
|
|
13881
|
-
// Failure is non-fatal; the version snapshot is valid whether or not this
|
|
13882
|
-
// PATCH lands.
|
|
13883
|
-
// ---------------------------------------------------------------------------
|
|
13884
|
-
async patchCommitHash(version, commitHash) {
|
|
13885
|
-
return this.httpPatch(`${this.basePath}/versions/${version}/commit-hash`, {
|
|
13886
|
-
commitHash
|
|
13887
|
-
}, this.authHeader);
|
|
13888
|
-
}
|
|
13889
|
-
};
|
|
13890
|
-
|
|
13891
|
-
// src/utils/versioning-mode-cache.ts
|
|
13892
|
-
init_constants();
|
|
13893
|
-
init_auth_error();
|
|
13894
|
-
init_constants();
|
|
13895
|
-
var CACHE_TTL_MS = 60 * 60 * 1e3;
|
|
13896
|
-
function readCacheFile() {
|
|
13897
|
-
try {
|
|
13898
|
-
const raw = fs3.readFileSync(CLI_CACHE_FILE, "utf-8");
|
|
13899
|
-
return JSON.parse(raw);
|
|
13900
|
-
} catch {
|
|
13901
|
-
return {};
|
|
13902
|
-
}
|
|
13903
|
-
}
|
|
13904
|
-
__name(readCacheFile, "readCacheFile");
|
|
13905
|
-
function writeCacheFile(data) {
|
|
13906
|
-
try {
|
|
13907
|
-
fs3.mkdirSync(path3.dirname(CLI_CACHE_FILE), {
|
|
13908
|
-
recursive: true
|
|
13909
|
-
});
|
|
13910
|
-
fs3.writeFileSync(CLI_CACHE_FILE, JSON.stringify(data, null, 2));
|
|
13911
|
-
} catch {
|
|
13912
|
-
}
|
|
13913
|
-
}
|
|
13914
|
-
__name(writeCacheFile, "writeCacheFile");
|
|
13915
|
-
function isFresh(entry) {
|
|
13916
|
-
const age = Date.now() - new Date(entry.cachedAt).getTime();
|
|
13917
|
-
return age >= 0 && age < CACHE_TTL_MS;
|
|
13918
|
-
}
|
|
13919
|
-
__name(isFresh, "isFresh");
|
|
13920
|
-
async function getVersioningModeCached(apiKey, agentId) {
|
|
13921
|
-
const file = readCacheFile();
|
|
13922
|
-
const existing = file.versioningMode?.[agentId];
|
|
13923
|
-
if (existing && isFresh(existing)) {
|
|
13924
|
-
return {
|
|
13925
|
-
enabled: existing.enabled
|
|
13926
|
-
};
|
|
13927
|
-
}
|
|
13928
|
-
try {
|
|
13929
|
-
const api = new AgentVersionApi(BASE_URLS.API, apiKey, agentId);
|
|
13930
|
-
const response = await api.getVersioningMode();
|
|
13931
|
-
if (!response.success || !response.data) {
|
|
13932
|
-
if (existing) return {
|
|
13933
|
-
enabled: existing.enabled
|
|
13934
|
-
};
|
|
13935
|
-
return {
|
|
13936
|
-
enabled: false
|
|
13937
|
-
};
|
|
13938
|
-
}
|
|
13939
|
-
const enabled = response.data.enabled === true;
|
|
13940
|
-
file.versioningMode = file.versioningMode ?? {};
|
|
13941
|
-
file.versioningMode[agentId] = {
|
|
13942
|
-
enabled,
|
|
13943
|
-
cachedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
13944
|
-
};
|
|
13945
|
-
writeCacheFile(file);
|
|
13946
|
-
return {
|
|
13947
|
-
enabled
|
|
13948
|
-
};
|
|
13949
|
-
} catch (err) {
|
|
13950
|
-
if (err instanceof AuthenticationError) throw err;
|
|
13951
|
-
if (err instanceof Error && /access denied|forbidden|403|401/i.test(err.message)) throw err;
|
|
13952
|
-
if (existing) return {
|
|
13953
|
-
enabled: existing.enabled
|
|
13954
|
-
};
|
|
13955
|
-
return {
|
|
13956
|
-
enabled: false
|
|
13957
|
-
};
|
|
13958
|
-
}
|
|
13959
|
-
}
|
|
13960
|
-
__name(getVersioningModeCached, "getVersioningModeCached");
|
|
13961
|
-
function invalidateVersioningModeCache() {
|
|
13962
|
-
const file = readCacheFile();
|
|
13963
|
-
if (!file.versioningMode) return;
|
|
13964
|
-
delete file.versioningMode;
|
|
13965
|
-
writeCacheFile(file);
|
|
13966
|
-
}
|
|
13967
|
-
__name(invalidateVersioningModeCache, "invalidateVersioningModeCache");
|
|
13968
|
-
|
|
13969
|
-
// src/commands/configure.ts
|
|
13970
13812
|
async function configureCommand(options = {}) {
|
|
13971
13813
|
return withErrorHandling(async () => {
|
|
13972
13814
|
const { apiKey, email, otp } = options;
|
|
@@ -13976,13 +13818,11 @@ async function configureCommand(options = {}) {
|
|
|
13976
13818
|
authMethod = "api-key";
|
|
13977
13819
|
nonInteractive = true;
|
|
13978
13820
|
await handleApiKeyAuthNonInteractive(apiKey);
|
|
13979
|
-
invalidateVersioningModeCache();
|
|
13980
13821
|
} else if (email) {
|
|
13981
13822
|
authMethod = "email";
|
|
13982
13823
|
nonInteractive = true;
|
|
13983
13824
|
if (otp) {
|
|
13984
13825
|
await handleEmailOtpVerify(email, otp);
|
|
13985
|
-
invalidateVersioningModeCache();
|
|
13986
13826
|
} else {
|
|
13987
13827
|
await handleEmailOtpRequest(email);
|
|
13988
13828
|
}
|
|
@@ -13991,10 +13831,8 @@ async function configureCommand(options = {}) {
|
|
|
13991
13831
|
clearPromptLines(2);
|
|
13992
13832
|
if (authMethod === "api-key") {
|
|
13993
13833
|
await handleApiKeyAuth();
|
|
13994
|
-
invalidateVersioningModeCache();
|
|
13995
13834
|
} else if (authMethod === "email") {
|
|
13996
13835
|
await handleEmailAuth();
|
|
13997
|
-
invalidateVersioningModeCache();
|
|
13998
13836
|
}
|
|
13999
13837
|
}
|
|
14000
13838
|
trackEvent("cli_auth_completed", {
|
|
@@ -14666,8 +14504,8 @@ init_compile_constants();
|
|
|
14666
14504
|
init_artifact_loader();
|
|
14667
14505
|
init_backup_api_service();
|
|
14668
14506
|
init_constants();
|
|
14669
|
-
import
|
|
14670
|
-
import
|
|
14507
|
+
import fs12 from "fs";
|
|
14508
|
+
import path11 from "path";
|
|
14671
14509
|
var BACKUP_CACHE_FILENAME = "backup-manifest.json";
|
|
14672
14510
|
function calculateProjectHash(projectFiles) {
|
|
14673
14511
|
return combineFileHashes(projectFiles);
|
|
@@ -14680,11 +14518,11 @@ function getCurrentProjectHash(projectPath = process.cwd()) {
|
|
|
14680
14518
|
}
|
|
14681
14519
|
__name(getCurrentProjectHash, "getCurrentProjectHash");
|
|
14682
14520
|
function loadSourceByHash(hash, relativePath, projectPath = process.cwd()) {
|
|
14683
|
-
const sourcesDir =
|
|
14684
|
-
const ext =
|
|
14685
|
-
const sourcePath =
|
|
14686
|
-
if (
|
|
14687
|
-
return
|
|
14521
|
+
const sourcesDir = path11.join(projectPath, COMPILE_DIRS.DIST_V2, "sources");
|
|
14522
|
+
const ext = path11.extname(relativePath) || ".txt";
|
|
14523
|
+
const sourcePath = path11.join(sourcesDir, `${hash}${ext}`);
|
|
14524
|
+
if (fs12.existsSync(sourcePath)) {
|
|
14525
|
+
return fs12.readFileSync(sourcePath, "utf-8");
|
|
14688
14526
|
}
|
|
14689
14527
|
return null;
|
|
14690
14528
|
}
|
|
@@ -14703,30 +14541,30 @@ function prepareFileRefs(projectPath = process.cwd()) {
|
|
|
14703
14541
|
}
|
|
14704
14542
|
__name(prepareFileRefs, "prepareFileRefs");
|
|
14705
14543
|
function reconcileManifestWithDisk(projectPath = process.cwd()) {
|
|
14706
|
-
const manifestPath =
|
|
14707
|
-
if (!
|
|
14544
|
+
const manifestPath = path11.join(projectPath, COMPILE_DIRS.DIST_V2, "manifest.json");
|
|
14545
|
+
if (!fs12.existsSync(manifestPath)) return;
|
|
14708
14546
|
const manifest = loadManifest(projectPath);
|
|
14709
|
-
const sourcesDir =
|
|
14710
|
-
|
|
14547
|
+
const sourcesDir = path11.join(projectPath, COMPILE_DIRS.DIST_V2, "sources");
|
|
14548
|
+
fs12.mkdirSync(sourcesDir, {
|
|
14711
14549
|
recursive: true
|
|
14712
14550
|
});
|
|
14713
14551
|
let changed = false;
|
|
14714
14552
|
for (const file of manifest.projectFiles) {
|
|
14715
14553
|
if (file.external) continue;
|
|
14716
|
-
const absPath =
|
|
14717
|
-
if (!
|
|
14554
|
+
const absPath = path11.join(projectPath, file.relativePath);
|
|
14555
|
+
if (!fs12.existsSync(absPath)) continue;
|
|
14718
14556
|
let content;
|
|
14719
14557
|
try {
|
|
14720
|
-
content =
|
|
14558
|
+
content = fs12.readFileSync(absPath, "utf-8");
|
|
14721
14559
|
} catch {
|
|
14722
14560
|
continue;
|
|
14723
14561
|
}
|
|
14724
14562
|
const freshHash = hashContent(content);
|
|
14725
14563
|
if (freshHash === file.hash) continue;
|
|
14726
|
-
const ext =
|
|
14727
|
-
const sourceTargetPath =
|
|
14564
|
+
const ext = path11.extname(file.relativePath) || ".txt";
|
|
14565
|
+
const sourceTargetPath = path11.join(sourcesDir, `${freshHash}${ext}`);
|
|
14728
14566
|
try {
|
|
14729
|
-
|
|
14567
|
+
fs12.writeFileSync(sourceTargetPath, content, "utf-8");
|
|
14730
14568
|
} catch {
|
|
14731
14569
|
continue;
|
|
14732
14570
|
}
|
|
@@ -14735,7 +14573,7 @@ function reconcileManifestWithDisk(projectPath = process.cwd()) {
|
|
|
14735
14573
|
changed = true;
|
|
14736
14574
|
}
|
|
14737
14575
|
if (changed) {
|
|
14738
|
-
|
|
14576
|
+
fs12.writeFileSync(manifestPath, JSON.stringify(manifest, null, 2), "utf-8");
|
|
14739
14577
|
}
|
|
14740
14578
|
}
|
|
14741
14579
|
__name(reconcileManifestWithDisk, "reconcileManifestWithDisk");
|
|
@@ -14808,7 +14646,7 @@ function checkRestoreConflicts(manifest, targetDir) {
|
|
|
14808
14646
|
const existingFiles = [];
|
|
14809
14647
|
for (const file of manifest.files) {
|
|
14810
14648
|
const filePath = resolveBackupFileTarget2(file, targetDir);
|
|
14811
|
-
if (
|
|
14649
|
+
if (fs12.existsSync(filePath)) {
|
|
14812
14650
|
existingFiles.push(file.relativePath);
|
|
14813
14651
|
} else {
|
|
14814
14652
|
newFiles.push(file.relativePath);
|
|
@@ -14834,16 +14672,16 @@ function createBackupTracking(projectHash) {
|
|
|
14834
14672
|
}
|
|
14835
14673
|
__name(createBackupTracking, "createBackupTracking");
|
|
14836
14674
|
function getBackupCachePath(projectPath = process.cwd()) {
|
|
14837
|
-
return
|
|
14675
|
+
return path11.join(projectPath, ".lua", BACKUP_CACHE_FILENAME);
|
|
14838
14676
|
}
|
|
14839
14677
|
__name(getBackupCachePath, "getBackupCachePath");
|
|
14840
14678
|
function writeBackupManifestCache(cache, projectPath = process.cwd()) {
|
|
14841
14679
|
const cachePath = getBackupCachePath(projectPath);
|
|
14842
14680
|
try {
|
|
14843
|
-
|
|
14681
|
+
fs12.mkdirSync(path11.dirname(cachePath), {
|
|
14844
14682
|
recursive: true
|
|
14845
14683
|
});
|
|
14846
|
-
|
|
14684
|
+
fs12.writeFileSync(cachePath, JSON.stringify(cache, null, 2), "utf-8");
|
|
14847
14685
|
} catch (error) {
|
|
14848
14686
|
const message = error instanceof Error ? error.message : String(error);
|
|
14849
14687
|
console.warn(`Could not write backup manifest cache: ${message}`);
|
|
@@ -14852,9 +14690,9 @@ function writeBackupManifestCache(cache, projectPath = process.cwd()) {
|
|
|
14852
14690
|
__name(writeBackupManifestCache, "writeBackupManifestCache");
|
|
14853
14691
|
function readBackupManifestCache(projectPath = process.cwd()) {
|
|
14854
14692
|
const cachePath = getBackupCachePath(projectPath);
|
|
14855
|
-
if (!
|
|
14693
|
+
if (!fs12.existsSync(cachePath)) return null;
|
|
14856
14694
|
try {
|
|
14857
|
-
const raw =
|
|
14695
|
+
const raw = fs12.readFileSync(cachePath, "utf-8");
|
|
14858
14696
|
const parsed = JSON.parse(raw);
|
|
14859
14697
|
if (typeof parsed.lastHash !== "string" || typeof parsed.lastPushedAt !== "string" || !Array.isArray(parsed.files) || !parsed.files.every((f) => f && typeof f.relativePath === "string" && typeof f.hash === "string")) {
|
|
14860
14698
|
return null;
|
|
@@ -14881,18 +14719,18 @@ function detectLocalConflictsForPull(incomingFiles, projectPath = process.cwd())
|
|
|
14881
14719
|
f.hash
|
|
14882
14720
|
]));
|
|
14883
14721
|
const conflicts = /* @__PURE__ */ new Set();
|
|
14884
|
-
const projectRoot =
|
|
14722
|
+
const projectRoot = path11.resolve(projectPath);
|
|
14885
14723
|
for (const incoming of incomingFiles) {
|
|
14886
14724
|
if (COMPILE_MANAGED_FILES.has(incoming.relativePath)) continue;
|
|
14887
14725
|
if (incoming.external) continue;
|
|
14888
|
-
const absPath =
|
|
14889
|
-
if (absPath !== projectRoot && !absPath.startsWith(projectRoot +
|
|
14726
|
+
const absPath = path11.resolve(projectRoot, incoming.relativePath);
|
|
14727
|
+
if (absPath !== projectRoot && !absPath.startsWith(projectRoot + path11.sep)) {
|
|
14890
14728
|
continue;
|
|
14891
14729
|
}
|
|
14892
|
-
if (!
|
|
14730
|
+
if (!fs12.existsSync(absPath)) continue;
|
|
14893
14731
|
let diskHash;
|
|
14894
14732
|
try {
|
|
14895
|
-
const bytes =
|
|
14733
|
+
const bytes = fs12.readFileSync(absPath, "utf-8");
|
|
14896
14734
|
diskHash = hashContent(bytes);
|
|
14897
14735
|
} catch {
|
|
14898
14736
|
conflicts.add(incoming.relativePath);
|
|
@@ -15071,17 +14909,17 @@ function writeBackupFilesWithByteCompare(manifest, blobs, targetDir) {
|
|
|
15071
14909
|
}
|
|
15072
14910
|
restoredContents.set(makeRestoredContentsKey(file), content);
|
|
15073
14911
|
const filePath = resolveBackupFileTarget2(file, targetDir);
|
|
15074
|
-
if (
|
|
15075
|
-
const existing =
|
|
14912
|
+
if (fs12.existsSync(filePath)) {
|
|
14913
|
+
const existing = fs12.readFileSync(filePath);
|
|
15076
14914
|
if (existing.equals(content)) {
|
|
15077
14915
|
filesUnchanged++;
|
|
15078
14916
|
continue;
|
|
15079
14917
|
}
|
|
15080
14918
|
}
|
|
15081
|
-
|
|
14919
|
+
fs12.mkdirSync(path11.dirname(filePath), {
|
|
15082
14920
|
recursive: true
|
|
15083
14921
|
});
|
|
15084
|
-
|
|
14922
|
+
fs12.writeFileSync(filePath, content);
|
|
15085
14923
|
filesWritten++;
|
|
15086
14924
|
}
|
|
15087
14925
|
return {
|
|
@@ -16895,7 +16733,6 @@ async function destroyCommand(options) {
|
|
|
16895
16733
|
if (options?.force) {
|
|
16896
16734
|
const deleted2 = deleteApiKey();
|
|
16897
16735
|
if (deleted2) {
|
|
16898
|
-
invalidateVersioningModeCache();
|
|
16899
16736
|
writeSuccess("\u2705 API key deleted successfully.");
|
|
16900
16737
|
} else {
|
|
16901
16738
|
writeProgress("\u274C Failed to delete API key.");
|
|
@@ -16921,7 +16758,6 @@ async function destroyCommand(options) {
|
|
|
16921
16758
|
if (confirm) {
|
|
16922
16759
|
deleted = deleteApiKey();
|
|
16923
16760
|
if (deleted) {
|
|
16924
|
-
invalidateVersioningModeCache();
|
|
16925
16761
|
writeSuccess("\u2705 API key deleted successfully.");
|
|
16926
16762
|
} else {
|
|
16927
16763
|
writeProgress("\u274C Failed to delete API key.");
|
|
@@ -16992,13 +16828,13 @@ __name(apiKeyCommand, "apiKeyCommand");
|
|
|
16992
16828
|
init_cli();
|
|
16993
16829
|
init_files();
|
|
16994
16830
|
init_auth();
|
|
16995
|
-
import
|
|
16831
|
+
import path13 from "path";
|
|
16996
16832
|
|
|
16997
16833
|
// src/commands/sync.ts
|
|
16998
16834
|
init_dist();
|
|
16999
16835
|
init_cli();
|
|
17000
|
-
import
|
|
17001
|
-
import
|
|
16836
|
+
import fs13 from "fs";
|
|
16837
|
+
import path12 from "path";
|
|
17002
16838
|
|
|
17003
16839
|
// src/utils/prompt-handler.ts
|
|
17004
16840
|
init_cli();
|
|
@@ -17221,8 +17057,8 @@ init_mcp_server_handler();
|
|
|
17221
17057
|
async function syncCommand(options) {
|
|
17222
17058
|
return withErrorHandling(async () => {
|
|
17223
17059
|
const preCompileYaml = readYamlConfig();
|
|
17224
|
-
const yamlPath =
|
|
17225
|
-
const preCompileYamlBytes =
|
|
17060
|
+
const yamlPath = path12.resolve(process.cwd(), "lua.skill.yaml");
|
|
17061
|
+
const preCompileYamlBytes = fs13.existsSync(yamlPath) ? fs13.readFileSync(yamlPath, "utf-8") : null;
|
|
17226
17062
|
let syncCompletedSuccessfully = false;
|
|
17227
17063
|
try {
|
|
17228
17064
|
writeProgress("\u{1F504} Compiling to get latest local state...");
|
|
@@ -17283,7 +17119,7 @@ async function syncCommand(options) {
|
|
|
17283
17119
|
} finally {
|
|
17284
17120
|
if (!syncCompletedSuccessfully && preCompileYamlBytes !== null) {
|
|
17285
17121
|
try {
|
|
17286
|
-
|
|
17122
|
+
fs13.writeFileSync(yamlPath, preCompileYamlBytes, "utf-8");
|
|
17287
17123
|
} catch {
|
|
17288
17124
|
}
|
|
17289
17125
|
}
|
|
@@ -18841,7 +18677,7 @@ async function compileCommand(options) {
|
|
|
18841
18677
|
}
|
|
18842
18678
|
writeProgress("\u{1F528} Compiling...");
|
|
18843
18679
|
const rootDir = process.cwd();
|
|
18844
|
-
const outDir =
|
|
18680
|
+
const outDir = path13.join(rootDir, "dist-v2");
|
|
18845
18681
|
const result = await compile({
|
|
18846
18682
|
rootDir,
|
|
18847
18683
|
outDir,
|
|
@@ -19005,12 +18841,12 @@ init_command_utils();
|
|
|
19005
18841
|
|
|
19006
18842
|
// src/utils/sandbox.ts
|
|
19007
18843
|
import vm3 from "vm";
|
|
19008
|
-
import
|
|
18844
|
+
import path16 from "path";
|
|
19009
18845
|
|
|
19010
18846
|
// ../shared-sandbox/dist/index.mjs
|
|
19011
18847
|
import vm from "vm";
|
|
19012
18848
|
import { createRequire } from "module";
|
|
19013
|
-
import
|
|
18849
|
+
import path14 from "path";
|
|
19014
18850
|
import dns from "dns";
|
|
19015
18851
|
import net from "net";
|
|
19016
18852
|
import { promisify } from "util";
|
|
@@ -19180,7 +19016,7 @@ var REQUIRE_BLOCKLIST = /* @__PURE__ */ new Set([
|
|
|
19180
19016
|
var SANDBOX_FAKE_DIRNAME = "/";
|
|
19181
19017
|
var SANDBOX_FAKE_FILENAME = "/index.ts";
|
|
19182
19018
|
function buildSandboxRequire(opts) {
|
|
19183
|
-
const realRequire = createRequire(
|
|
19019
|
+
const realRequire = createRequire(path14.join(opts.cwd, "package.json"));
|
|
19184
19020
|
const wrapped = /* @__PURE__ */ __name4((id) => {
|
|
19185
19021
|
if (REQUIRE_BLOCKLIST.has(id)) {
|
|
19186
19022
|
const evt = {
|
|
@@ -19850,14 +19686,14 @@ __name(runBundleInContext, "runBundleInContext");
|
|
|
19850
19686
|
__name4(runBundleInContext, "runBundleInContext");
|
|
19851
19687
|
|
|
19852
19688
|
// src/utils/env-loader.utils.ts
|
|
19853
|
-
import
|
|
19854
|
-
import
|
|
19689
|
+
import path15 from "path";
|
|
19690
|
+
import fs14 from "fs";
|
|
19855
19691
|
function parseEnvFile(filePath) {
|
|
19856
|
-
if (!
|
|
19692
|
+
if (!fs14.existsSync(filePath)) {
|
|
19857
19693
|
return {};
|
|
19858
19694
|
}
|
|
19859
19695
|
try {
|
|
19860
|
-
const content =
|
|
19696
|
+
const content = fs14.readFileSync(filePath, "utf8");
|
|
19861
19697
|
if (!content.trim()) return {};
|
|
19862
19698
|
const envVars = {};
|
|
19863
19699
|
content.split("\n").map((line) => line.trim()).filter((line) => line && !line.startsWith("#")).forEach((line) => {
|
|
@@ -19883,7 +19719,7 @@ async function loadEnvironmentVariables(context) {
|
|
|
19883
19719
|
}
|
|
19884
19720
|
__name(loadEnvironmentVariables, "loadEnvironmentVariables");
|
|
19885
19721
|
function loadSandboxEnvVariables() {
|
|
19886
|
-
const envFilePath =
|
|
19722
|
+
const envFilePath = path15.join(process.cwd(), ".env");
|
|
19887
19723
|
const envMap = parseEnvFile(envFilePath);
|
|
19888
19724
|
return Object.entries(envMap).map(([key, value]) => ({
|
|
19889
19725
|
key,
|
|
@@ -19978,7 +19814,7 @@ function loadEnvironmentVariables2() {
|
|
|
19978
19814
|
envVars[key] = value;
|
|
19979
19815
|
}
|
|
19980
19816
|
}
|
|
19981
|
-
const envFilePath =
|
|
19817
|
+
const envFilePath = path16.join(process.cwd(), ".env");
|
|
19982
19818
|
const fileEnvVars = parseEnvFile(envFilePath);
|
|
19983
19819
|
Object.assign(envVars, fileEnvVars);
|
|
19984
19820
|
return envVars;
|
|
@@ -21864,7 +21700,6 @@ init_dist();
|
|
|
21864
21700
|
init_files();
|
|
21865
21701
|
init_cli();
|
|
21866
21702
|
init_command_utils();
|
|
21867
|
-
init_auth();
|
|
21868
21703
|
init_semver();
|
|
21869
21704
|
init_auth_error();
|
|
21870
21705
|
init_constants();
|
|
@@ -21992,8 +21827,8 @@ async function runBackupPush(opts) {
|
|
|
21992
21827
|
}
|
|
21993
21828
|
__name(runBackupPush, "runBackupPush");
|
|
21994
21829
|
async function uploadBlobsFromDisk(uploadUrls, files, projectPath, concurrency = 10) {
|
|
21995
|
-
const
|
|
21996
|
-
const
|
|
21830
|
+
const fs16 = await import("fs");
|
|
21831
|
+
const path18 = await import("path");
|
|
21997
21832
|
const zlib2 = await import("zlib");
|
|
21998
21833
|
const hashToPath = /* @__PURE__ */ new Map();
|
|
21999
21834
|
for (const f of files) {
|
|
@@ -22007,8 +21842,8 @@ async function uploadBlobsFromDisk(uploadUrls, files, projectPath, concurrency =
|
|
|
22007
21842
|
if (!rel) {
|
|
22008
21843
|
throw new Error(`No file found for hash: ${hash}`);
|
|
22009
21844
|
}
|
|
22010
|
-
const abs =
|
|
22011
|
-
const content =
|
|
21845
|
+
const abs = path18.join(projectPath, rel);
|
|
21846
|
+
const content = fs16.readFileSync(abs);
|
|
22012
21847
|
const compressed = zlib2.gzipSync(content);
|
|
22013
21848
|
const response = await fetch(uploadUrls[hash], {
|
|
22014
21849
|
method: "PUT",
|
|
@@ -22266,11 +22101,11 @@ init_cli();
|
|
|
22266
22101
|
|
|
22267
22102
|
// src/utils/git-auth-store.ts
|
|
22268
22103
|
init_constants();
|
|
22269
|
-
import { mkdirSync as
|
|
22270
|
-
import { dirname as
|
|
22104
|
+
import { mkdirSync as mkdirSync6, readFileSync as readFileSync9, writeFileSync as writeFileSync6 } from "fs";
|
|
22105
|
+
import { dirname as dirname5 } from "path";
|
|
22271
22106
|
function readStore() {
|
|
22272
22107
|
try {
|
|
22273
|
-
const raw =
|
|
22108
|
+
const raw = readFileSync9(AUTH_STORAGE_FILE, "utf8");
|
|
22274
22109
|
const parsed = JSON.parse(raw);
|
|
22275
22110
|
return {
|
|
22276
22111
|
providers: parsed.providers ?? {}
|
|
@@ -22283,10 +22118,10 @@ function readStore() {
|
|
|
22283
22118
|
}
|
|
22284
22119
|
__name(readStore, "readStore");
|
|
22285
22120
|
function writeStore(store) {
|
|
22286
|
-
|
|
22121
|
+
mkdirSync6(dirname5(AUTH_STORAGE_FILE), {
|
|
22287
22122
|
recursive: true
|
|
22288
22123
|
});
|
|
22289
|
-
|
|
22124
|
+
writeFileSync6(AUTH_STORAGE_FILE, JSON.stringify(store, null, 2), {
|
|
22290
22125
|
mode: 384
|
|
22291
22126
|
});
|
|
22292
22127
|
}
|
|
@@ -22399,12 +22234,18 @@ var GitHubProvider = class {
|
|
|
22399
22234
|
async push(opts) {
|
|
22400
22235
|
const parsed = parseGitHubHttpsUrl(opts.remoteUrl);
|
|
22401
22236
|
const authedUrl = `https://x-access-token:${opts.token}@github.com/${parsed.owner}/${parsed.repo}`;
|
|
22237
|
+
const refspecs = opts.tag ? [
|
|
22238
|
+
opts.branch,
|
|
22239
|
+
opts.tag
|
|
22240
|
+
] : [
|
|
22241
|
+
opts.branch
|
|
22242
|
+
];
|
|
22402
22243
|
let result;
|
|
22403
22244
|
try {
|
|
22404
22245
|
result = await runGit([
|
|
22405
22246
|
"push",
|
|
22406
22247
|
authedUrl,
|
|
22407
|
-
|
|
22248
|
+
...refspecs
|
|
22408
22249
|
], {
|
|
22409
22250
|
cwd: opts.cwd,
|
|
22410
22251
|
timeout: PUSH_TIMEOUT_MS
|
|
@@ -22559,9 +22400,11 @@ async function tryGitAutoPush(ctx) {
|
|
|
22559
22400
|
token,
|
|
22560
22401
|
remoteUrl: remote,
|
|
22561
22402
|
branch,
|
|
22403
|
+
tag: ctx.tag,
|
|
22562
22404
|
cwd: ctx.cwd ?? process.cwd()
|
|
22563
22405
|
});
|
|
22564
|
-
|
|
22406
|
+
const tagSuffix = ctx.tag ? ` +${ctx.tag}` : "";
|
|
22407
|
+
writeInfo(`\u2713 Pushed ${ctx.commitSha?.slice(0, 7) ?? ""}${tagSuffix} to ${remote} (${branch})`);
|
|
22565
22408
|
trackEvent("cli_auto_push_succeeded", {
|
|
22566
22409
|
action: ctx.action
|
|
22567
22410
|
});
|
|
@@ -22666,6 +22509,8 @@ async function tryGitCommit(opts) {
|
|
|
22666
22509
|
if (opts.tag) {
|
|
22667
22510
|
try {
|
|
22668
22511
|
const tagResult = await runGit([
|
|
22512
|
+
"-c",
|
|
22513
|
+
"tag.gpgsign=false",
|
|
22669
22514
|
"tag",
|
|
22670
22515
|
opts.tag
|
|
22671
22516
|
], runOpts);
|
|
@@ -22691,6 +22536,9 @@ async function tryGitCommit(opts) {
|
|
|
22691
22536
|
config,
|
|
22692
22537
|
cwd: opts.cwd,
|
|
22693
22538
|
commitSha: sha,
|
|
22539
|
+
// Only forward a tag that actually landed — auto-push pushes it as an
|
|
22540
|
+
// explicit refspec, so pushing a non-existent tag would just error.
|
|
22541
|
+
tag: tagged ? opts.tag : void 0,
|
|
22694
22542
|
action: opts.action
|
|
22695
22543
|
});
|
|
22696
22544
|
return {
|
|
@@ -23037,15 +22885,9 @@ async function pushCommand(type, cmdObj) {
|
|
|
23037
22885
|
allowAll: true
|
|
23038
22886
|
});
|
|
23039
22887
|
}
|
|
23040
|
-
const
|
|
23041
|
-
const
|
|
23042
|
-
const
|
|
23043
|
-
const versioning = earlyApiKey && earlyAgentId ? await getVersioningModeCached(earlyApiKey, earlyAgentId) : {
|
|
23044
|
-
enabled: false
|
|
23045
|
-
};
|
|
23046
|
-
const isStageAll = !type && versioning.enabled;
|
|
23047
|
-
const isGranular = Boolean(type && type !== "all" && versioning.enabled);
|
|
23048
|
-
const isAutoDeployNoOp = versioning.enabled && (type === "all" || !type) && Boolean(options.autoDeploy);
|
|
22888
|
+
const isStageAll = !type;
|
|
22889
|
+
const isGranular = Boolean(type && type !== "all");
|
|
22890
|
+
const isAutoDeployNoOp = (type === "all" || !type) && Boolean(options.autoDeploy);
|
|
23049
22891
|
if (isAutoDeployNoOp) {
|
|
23050
22892
|
writeInfo("\u26A0\uFE0F --auto-deploy is ignored when agent versioning is on. Use `lua version promote <version>` after `lua version create`.");
|
|
23051
22893
|
options.autoDeploy = false;
|
|
@@ -23077,64 +22919,7 @@ async function pushCommand(type, cmdObj) {
|
|
|
23077
22919
|
autoDeployNoopWarned: isAutoDeployNoOp
|
|
23078
22920
|
});
|
|
23079
22921
|
}
|
|
23080
|
-
|
|
23081
|
-
selectedType = type;
|
|
23082
|
-
} else {
|
|
23083
|
-
const typeAnswer = await safePrompt([
|
|
23084
|
-
{
|
|
23085
|
-
type: "list",
|
|
23086
|
-
name: "type",
|
|
23087
|
-
message: "What would you like to push?",
|
|
23088
|
-
choices: [
|
|
23089
|
-
{
|
|
23090
|
-
name: "\u{1F6E0}\uFE0F Skill",
|
|
23091
|
-
value: "skill"
|
|
23092
|
-
},
|
|
23093
|
-
{
|
|
23094
|
-
name: "\u{1FA9D} Webhook",
|
|
23095
|
-
value: "webhook"
|
|
23096
|
-
},
|
|
23097
|
-
{
|
|
23098
|
-
name: "\u23F0 Job",
|
|
23099
|
-
value: "job"
|
|
23100
|
-
},
|
|
23101
|
-
{
|
|
23102
|
-
name: "\u{1F4E5} PreProcessor",
|
|
23103
|
-
value: "preprocessor"
|
|
23104
|
-
},
|
|
23105
|
-
{
|
|
23106
|
-
name: "\u{1F4E4} PostProcessor",
|
|
23107
|
-
value: "postprocessor"
|
|
23108
|
-
},
|
|
23109
|
-
{
|
|
23110
|
-
name: "\u{1F50C} MCP Server",
|
|
23111
|
-
value: "mcp"
|
|
23112
|
-
},
|
|
23113
|
-
{
|
|
23114
|
-
name: "\u{1F4E1} Device",
|
|
23115
|
-
value: "device"
|
|
23116
|
-
},
|
|
23117
|
-
{
|
|
23118
|
-
name: "\u{1F4E1} Device Trigger",
|
|
23119
|
-
value: "device-trigger"
|
|
23120
|
-
},
|
|
23121
|
-
{
|
|
23122
|
-
name: "\u{1F916} Agent (persona, model)",
|
|
23123
|
-
value: "agent"
|
|
23124
|
-
},
|
|
23125
|
-
{
|
|
23126
|
-
name: "\u{1F4BE} Backup (source files)",
|
|
23127
|
-
value: "backup"
|
|
23128
|
-
}
|
|
23129
|
-
]
|
|
23130
|
-
}
|
|
23131
|
-
]);
|
|
23132
|
-
if (!typeAnswer) {
|
|
23133
|
-
console.log("Push cancelled.");
|
|
23134
|
-
return;
|
|
23135
|
-
}
|
|
23136
|
-
selectedType = typeAnswer.type;
|
|
23137
|
-
}
|
|
22922
|
+
selectedType = type;
|
|
23138
22923
|
if (selectedType === "skill") {
|
|
23139
22924
|
versionedPushDeployResult = await pushVersionedPrimitive(skillHandler, options);
|
|
23140
22925
|
} else if (selectedType === "webhook") {
|
|
@@ -23224,7 +23009,7 @@ Until the backup catches up, \`lua init\` for this agent will restore an older s
|
|
|
23224
23009
|
include_source_attached: trackedIncludeSource?.attached ?? 0,
|
|
23225
23010
|
include_source_failed: trackedIncludeSource?.failed ?? 0,
|
|
23226
23011
|
// Agent-versioning telemetry. Driven by isStageAll / isGranular.
|
|
23227
|
-
versioning_mode:
|
|
23012
|
+
versioning_mode: isGranular ? "granular" : "all",
|
|
23228
23013
|
granular_deprecation_warned: isGranular,
|
|
23229
23014
|
auto_deploy_noop_warned: isAutoDeployNoOp
|
|
23230
23015
|
});
|
|
@@ -23519,7 +23304,6 @@ async function pushAllCommand(options) {
|
|
|
23519
23304
|
}
|
|
23520
23305
|
const apiKey = await requireAuthOrExit(false);
|
|
23521
23306
|
const agentId = config.agent.agentId;
|
|
23522
|
-
const pushAllVersioning = await getVersioningModeCached(apiKey, agentId);
|
|
23523
23307
|
let manifest;
|
|
23524
23308
|
try {
|
|
23525
23309
|
manifest = loadManifest();
|
|
@@ -23825,7 +23609,7 @@ Until the backup catches up, \`lua init\` for this agent will restore an older s
|
|
|
23825
23609
|
include_source_attached: includeSourceStats?.attached ?? 0,
|
|
23826
23610
|
include_source_failed: includeSourceStats?.failed ?? 0,
|
|
23827
23611
|
// Agent-versioning telemetry.
|
|
23828
|
-
versioning_mode:
|
|
23612
|
+
versioning_mode: "stage-all",
|
|
23829
23613
|
granular_deprecation_warned: false,
|
|
23830
23614
|
auto_deploy_noop_warned: options.autoDeployNoopWarned || false
|
|
23831
23615
|
});
|
|
@@ -23843,42 +23627,8 @@ Until the backup catches up, \`lua init\` for this agent will restore an older s
|
|
|
23843
23627
|
});
|
|
23844
23628
|
if (variant === "success") {
|
|
23845
23629
|
console.log("");
|
|
23846
|
-
if (
|
|
23847
|
-
|
|
23848
|
-
writeInfo(`Run \`lua version create [-m "<message>"]\` to snapshot the staged state into a named version, then \`lua version promote <version>\` to deploy.`);
|
|
23849
|
-
}
|
|
23850
|
-
} else if (options.autoDeploy) {
|
|
23851
|
-
writeHintBlock({
|
|
23852
|
-
headline: "All deployed. Generate test traffic first, then inspect:",
|
|
23853
|
-
lines: [
|
|
23854
|
-
{
|
|
23855
|
-
label: "Test:",
|
|
23856
|
-
command: 'lua chat -e production -m "your test message"'
|
|
23857
|
-
},
|
|
23858
|
-
{
|
|
23859
|
-
label: "Inspect:",
|
|
23860
|
-
command: buildLogsCommand({
|
|
23861
|
-
limit: 10
|
|
23862
|
-
})
|
|
23863
|
-
}
|
|
23864
|
-
],
|
|
23865
|
-
when: "success"
|
|
23866
|
-
});
|
|
23867
|
-
} else {
|
|
23868
|
-
writeHintBlock({
|
|
23869
|
-
headline: "Code staged but NOT live. Make it active:",
|
|
23870
|
-
lines: [
|
|
23871
|
-
{
|
|
23872
|
-
label: "Deploy all:",
|
|
23873
|
-
command: "lua deploy all --force"
|
|
23874
|
-
},
|
|
23875
|
-
{
|
|
23876
|
-
label: "Or re-push:",
|
|
23877
|
-
command: "lua push all --force --auto-deploy"
|
|
23878
|
-
}
|
|
23879
|
-
],
|
|
23880
|
-
when: "success"
|
|
23881
|
-
});
|
|
23630
|
+
if (!options.suppressVersionCreateHint) {
|
|
23631
|
+
writeInfo(`Run \`lua version create [-m "<message>"]\` to snapshot the staged state into a named version, then \`lua version promote <version>\` to deploy.`);
|
|
23882
23632
|
}
|
|
23883
23633
|
} else if (variant === "partial") {
|
|
23884
23634
|
console.log("");
|
|
@@ -24115,10 +23865,7 @@ async function deployCommand(type, cmdObj) {
|
|
|
24115
23865
|
selectedType = answer.type;
|
|
24116
23866
|
}
|
|
24117
23867
|
const apiKey = await requireAuthOrExit();
|
|
24118
|
-
|
|
24119
|
-
if (versioning.enabled) {
|
|
24120
|
-
writeInfo("\u26A0\uFE0F `lua deploy` is deprecated when agent versioning is on. Use `lua version promote <version>` for instant, atomic promotion.");
|
|
24121
|
-
}
|
|
23868
|
+
writeInfo("\u26A0\uFE0F `lua deploy` is deprecated when agent versioning is on. Use `lua version promote <version>` for instant, atomic promotion.");
|
|
24122
23869
|
let personaDeployed = false;
|
|
24123
23870
|
let versionedOutcome = null;
|
|
24124
23871
|
if (selectedType === "persona") {
|
|
@@ -24132,7 +23879,7 @@ async function deployCommand(type, cmdObj) {
|
|
|
24132
23879
|
force_mode: options.force || false,
|
|
24133
23880
|
entity_selected_by_name: !!options.name,
|
|
24134
23881
|
version_selected_by_flag: !!options.version,
|
|
24135
|
-
granular_deprecation_warned:
|
|
23882
|
+
granular_deprecation_warned: true
|
|
24136
23883
|
});
|
|
24137
23884
|
const deployed = selectedType === "persona" ? personaDeployed : versionedOutcome?.deployed ?? false;
|
|
24138
23885
|
const hintPrintedAlready = selectedType !== "persona" && !!versionedOutcome?.hintPrinted;
|
|
@@ -24626,11 +24373,11 @@ init_cli();
|
|
|
24626
24373
|
|
|
24627
24374
|
// src/utils/sandbox-storage.ts
|
|
24628
24375
|
init_constants();
|
|
24629
|
-
import { readFileSync as
|
|
24630
|
-
import { dirname as
|
|
24376
|
+
import { readFileSync as readFileSync10, writeFileSync as writeFileSync7, mkdirSync as mkdirSync7 } from "fs";
|
|
24377
|
+
import { dirname as dirname6 } from "path";
|
|
24631
24378
|
function readStore2() {
|
|
24632
24379
|
try {
|
|
24633
|
-
const raw =
|
|
24380
|
+
const raw = readFileSync10(SANDBOX_STORAGE_FILE, "utf8");
|
|
24634
24381
|
const parsed = JSON.parse(raw);
|
|
24635
24382
|
return {
|
|
24636
24383
|
skills: parsed.skills ?? {},
|
|
@@ -24650,10 +24397,10 @@ function readStore2() {
|
|
|
24650
24397
|
__name(readStore2, "readStore");
|
|
24651
24398
|
function writeStore2(store) {
|
|
24652
24399
|
try {
|
|
24653
|
-
|
|
24400
|
+
mkdirSync7(dirname6(SANDBOX_STORAGE_FILE), {
|
|
24654
24401
|
recursive: true
|
|
24655
24402
|
});
|
|
24656
|
-
|
|
24403
|
+
writeFileSync7(SANDBOX_STORAGE_FILE, JSON.stringify(store, null, 2), "utf8");
|
|
24657
24404
|
} catch {
|
|
24658
24405
|
}
|
|
24659
24406
|
}
|
|
@@ -25975,8 +25722,8 @@ init_cli();
|
|
|
25975
25722
|
init_constants();
|
|
25976
25723
|
init_command_utils();
|
|
25977
25724
|
init_developer_api_service();
|
|
25978
|
-
import
|
|
25979
|
-
import
|
|
25725
|
+
import fs15 from "fs";
|
|
25726
|
+
import path17 from "path";
|
|
25980
25727
|
import inquirer10 from "inquirer";
|
|
25981
25728
|
init_analytics();
|
|
25982
25729
|
function resolveEnvironment(env, hasNonInteractiveFlags) {
|
|
@@ -26335,10 +26082,10 @@ function variablesToEnvContent(variables) {
|
|
|
26335
26082
|
}
|
|
26336
26083
|
__name(variablesToEnvContent, "variablesToEnvContent");
|
|
26337
26084
|
function saveSandboxEnvVariables(variables) {
|
|
26338
|
-
const envFilePath =
|
|
26085
|
+
const envFilePath = path17.join(process.cwd(), ".env");
|
|
26339
26086
|
try {
|
|
26340
26087
|
const content = variablesToEnvContent(variables);
|
|
26341
|
-
|
|
26088
|
+
fs15.writeFileSync(envFilePath, content, "utf8");
|
|
26342
26089
|
return true;
|
|
26343
26090
|
} catch (error) {
|
|
26344
26091
|
console.error("\u274C Error saving .env file:", error);
|
|
@@ -30150,6 +29897,35 @@ init_cli();
|
|
|
30150
29897
|
init_files();
|
|
30151
29898
|
init_constants();
|
|
30152
29899
|
init_command_utils();
|
|
29900
|
+
|
|
29901
|
+
// src/utils/primitive-version-display.ts
|
|
29902
|
+
var PRIMITIVE_VERSION_HISTORY_NOTE = "\u2139\uFE0F Primitive versions are managed by agent versioning. Run `lua version list` to view agent versions.";
|
|
29903
|
+
async function shouldHidePrimitiveVersions(_apiKey, _agentId) {
|
|
29904
|
+
return true;
|
|
29905
|
+
}
|
|
29906
|
+
__name(shouldHidePrimitiveVersions, "shouldHidePrimitiveVersions");
|
|
29907
|
+
var DIVIDER = "=".repeat(60);
|
|
29908
|
+
function primitiveVersionHistoryView(label) {
|
|
29909
|
+
return [
|
|
29910
|
+
"\n" + DIVIDER,
|
|
29911
|
+
`\u{1F4DC} Versions for ${label}`,
|
|
29912
|
+
DIVIDER + "\n",
|
|
29913
|
+
PRIMITIVE_VERSION_HISTORY_NOTE,
|
|
29914
|
+
"\n" + DIVIDER
|
|
29915
|
+
];
|
|
29916
|
+
}
|
|
29917
|
+
__name(primitiveVersionHistoryView, "primitiveVersionHistoryView");
|
|
29918
|
+
function deployedVersionLine(version, hide) {
|
|
29919
|
+
if (version == null) return hide ? " Not deployed" : " Deployed Version: Not deployed";
|
|
29920
|
+
return hide ? " Deployed \u2B50" : ` Deployed Version: ${version} \u2B50`;
|
|
29921
|
+
}
|
|
29922
|
+
__name(deployedVersionLine, "deployedVersionLine");
|
|
29923
|
+
function localVersionLine(version, hide) {
|
|
29924
|
+
return hide ? null : ` Version: ${version}`;
|
|
29925
|
+
}
|
|
29926
|
+
__name(localVersionLine, "localVersionLine");
|
|
29927
|
+
|
|
29928
|
+
// src/commands/skills.ts
|
|
30153
29929
|
init_skills_api_service();
|
|
30154
29930
|
init_skill_handler();
|
|
30155
29931
|
init_analytics();
|
|
@@ -30160,6 +29936,7 @@ async function skillsCommand(actionOrEnv, actionArg, cmdObj) {
|
|
|
30160
29936
|
skillVersion: cmdObj?.skillVersion || null
|
|
30161
29937
|
};
|
|
30162
29938
|
const { config, agentId, apiKey } = await initializeCommand();
|
|
29939
|
+
const hideVersions = await shouldHidePrimitiveVersions(apiKey, agentId);
|
|
30163
29940
|
if (actionOrEnv) {
|
|
30164
29941
|
const normalized = validateOrSuggest("skills.actionOrEnv", actionOrEnv);
|
|
30165
29942
|
const envSet = /* @__PURE__ */ new Set([
|
|
@@ -30171,7 +29948,8 @@ async function skillsCommand(actionOrEnv, actionArg, cmdObj) {
|
|
|
30171
29948
|
const context3 = {
|
|
30172
29949
|
environment: selectedEnvironment,
|
|
30173
29950
|
agentId,
|
|
30174
|
-
apiKey
|
|
29951
|
+
apiKey,
|
|
29952
|
+
hideVersions
|
|
30175
29953
|
};
|
|
30176
29954
|
let resolvedAction = actionArg;
|
|
30177
29955
|
if (resolvedAction) {
|
|
@@ -30184,7 +29962,8 @@ async function skillsCommand(actionOrEnv, actionArg, cmdObj) {
|
|
|
30184
29962
|
console.log("\u2139\uFE0F No skills found in configuration.");
|
|
30185
29963
|
} else {
|
|
30186
29964
|
for (const skill of skills) {
|
|
30187
|
-
|
|
29965
|
+
const ver = context3.hideVersions ? "" : ` v${skill.version}`;
|
|
29966
|
+
console.log(`\u{1F4E6} ${skill.name}${ver} (${skill.skillId})`);
|
|
30188
29967
|
}
|
|
30189
29968
|
}
|
|
30190
29969
|
return;
|
|
@@ -30203,7 +29982,8 @@ async function skillsCommand(actionOrEnv, actionArg, cmdObj) {
|
|
|
30203
29982
|
const context2 = {
|
|
30204
29983
|
environment: "production",
|
|
30205
29984
|
agentId,
|
|
30206
|
-
apiKey
|
|
29985
|
+
apiKey,
|
|
29986
|
+
hideVersions
|
|
30207
29987
|
};
|
|
30208
29988
|
await executeNonInteractive4(context2, config, normalized, options);
|
|
30209
29989
|
trackEvent("cli_skills_action", {
|
|
@@ -30235,7 +30015,8 @@ async function skillsCommand(actionOrEnv, actionArg, cmdObj) {
|
|
|
30235
30015
|
const context = {
|
|
30236
30016
|
environment: envAnswer.environment,
|
|
30237
30017
|
agentId,
|
|
30238
|
-
apiKey
|
|
30018
|
+
apiKey,
|
|
30019
|
+
hideVersions
|
|
30239
30020
|
};
|
|
30240
30021
|
if (context.environment === "sandbox") {
|
|
30241
30022
|
await manageSandboxSkillsInteractive(context, config);
|
|
@@ -30264,13 +30045,15 @@ async function displaySkillsCore2(context, skills) {
|
|
|
30264
30045
|
console.log(`\u{1F4E6} ${skill.name}`);
|
|
30265
30046
|
console.log(` Skill ID: ${skill.skillId}`);
|
|
30266
30047
|
if (activeVersion) {
|
|
30267
|
-
console.log(
|
|
30048
|
+
console.log(deployedVersionLine(activeVersion.version, context.hideVersions));
|
|
30268
30049
|
const dateStr = activeVersion.createdDate ? new Date(activeVersion.createdDate).toLocaleString() : "Unknown";
|
|
30269
30050
|
console.log(` Deployed: ${dateStr}`);
|
|
30270
30051
|
} else {
|
|
30271
|
-
console.log(
|
|
30052
|
+
console.log(deployedVersionLine(null, context.hideVersions));
|
|
30053
|
+
}
|
|
30054
|
+
if (!context.hideVersions) {
|
|
30055
|
+
console.log(` Total Versions: ${versions.length}`);
|
|
30272
30056
|
}
|
|
30273
|
-
console.log(` Total Versions: ${versions.length}`);
|
|
30274
30057
|
console.log();
|
|
30275
30058
|
} else {
|
|
30276
30059
|
displaySkillError(skill, "Unable to fetch version info");
|
|
@@ -30303,7 +30086,11 @@ async function fetchVersionsCore2(context, skill) {
|
|
|
30303
30086
|
};
|
|
30304
30087
|
}
|
|
30305
30088
|
__name(fetchVersionsCore2, "fetchVersionsCore");
|
|
30306
|
-
function displayVersionsCore2(skill, versions, activeVersionId) {
|
|
30089
|
+
function displayVersionsCore2(skill, versions, activeVersionId, hideVersions) {
|
|
30090
|
+
if (hideVersions) {
|
|
30091
|
+
primitiveVersionHistoryView(skill.name).forEach((line) => console.log(line));
|
|
30092
|
+
return;
|
|
30093
|
+
}
|
|
30307
30094
|
console.log("\n" + "=".repeat(60));
|
|
30308
30095
|
console.log(`\u{1F4DC} Versions for ${skill.name}`);
|
|
30309
30096
|
console.log("=".repeat(60) + "\n");
|
|
@@ -30456,12 +30243,12 @@ Usage: lua skills ${action} --skill-name <name>`);
|
|
|
30456
30243
|
case "versions": {
|
|
30457
30244
|
const data = await fetchVersionsCore2(context, selectedSkill);
|
|
30458
30245
|
if (!data) throw new Error("Failed to fetch skill versions");
|
|
30459
|
-
if (data.versions.length === 0) {
|
|
30246
|
+
if (!context.hideVersions && data.versions.length === 0) {
|
|
30460
30247
|
console.log(`\u2139\uFE0F No versions found for ${selectedSkill.name}.`);
|
|
30461
30248
|
console.log("\u{1F4A1} Push a version first using 'lua push skill'.");
|
|
30462
30249
|
return;
|
|
30463
30250
|
}
|
|
30464
|
-
displayVersionsCore2(selectedSkill, data.versions, data.activeVersionId);
|
|
30251
|
+
displayVersionsCore2(selectedSkill, data.versions, data.activeVersionId, context.hideVersions);
|
|
30465
30252
|
break;
|
|
30466
30253
|
}
|
|
30467
30254
|
case "deploy": {
|
|
@@ -30506,7 +30293,8 @@ async function manageSandboxSkillsInteractive(context, config) {
|
|
|
30506
30293
|
console.log("Local skills in lua.skill.yaml:\n");
|
|
30507
30294
|
skills.forEach((skill, index) => {
|
|
30508
30295
|
console.log(`${index + 1}. \u{1F4E6} ${skill.name}`);
|
|
30509
|
-
|
|
30296
|
+
const vline = localVersionLine(skill.version, context.hideVersions);
|
|
30297
|
+
if (vline) console.log(vline);
|
|
30510
30298
|
console.log(` Skill ID: ${skill.skillId}`);
|
|
30511
30299
|
console.log();
|
|
30512
30300
|
});
|
|
@@ -30676,13 +30464,13 @@ async function viewVersionsInteractive(context, config) {
|
|
|
30676
30464
|
]);
|
|
30677
30465
|
return;
|
|
30678
30466
|
}
|
|
30679
|
-
if (data.versions.length === 0) {
|
|
30467
|
+
if (!context.hideVersions && data.versions.length === 0) {
|
|
30680
30468
|
console.log(`
|
|
30681
30469
|
\u2139\uFE0F No versions found for ${selectedSkill.name}.
|
|
30682
30470
|
`);
|
|
30683
30471
|
console.log("\u{1F4A1} Push a version first using 'lua push skill'.\n");
|
|
30684
30472
|
} else {
|
|
30685
|
-
displayVersionsCore2(selectedSkill, data.versions, data.activeVersionId);
|
|
30473
|
+
displayVersionsCore2(selectedSkill, data.versions, data.activeVersionId, context.hideVersions);
|
|
30686
30474
|
console.log();
|
|
30687
30475
|
}
|
|
30688
30476
|
await safePrompt([
|
|
@@ -30830,7 +30618,7 @@ init_auth();
|
|
|
30830
30618
|
init_auth_api_service();
|
|
30831
30619
|
init_files();
|
|
30832
30620
|
init_artifact_loader();
|
|
30833
|
-
import { existsSync as existsSync7, readFileSync as
|
|
30621
|
+
import { existsSync as existsSync7, readFileSync as readFileSync11 } from "fs";
|
|
30834
30622
|
import { join as join6 } from "path";
|
|
30835
30623
|
import { performance } from "perf_hooks";
|
|
30836
30624
|
import * as os from "os";
|
|
@@ -31181,7 +30969,7 @@ function gatherTelemetry() {
|
|
|
31181
30969
|
} else {
|
|
31182
30970
|
try {
|
|
31183
30971
|
if (existsSync7(TELEMETRY_FILE)) {
|
|
31184
|
-
const raw =
|
|
30972
|
+
const raw = readFileSync11(TELEMETRY_FILE, "utf8");
|
|
31185
30973
|
const cfg = JSON.parse(raw);
|
|
31186
30974
|
if (typeof cfg.enabled === "boolean") enabled = cfg.enabled;
|
|
31187
30975
|
}
|
|
@@ -31514,10 +31302,12 @@ async function webhooksCommand(action, cmdObj) {
|
|
|
31514
31302
|
event: cmdObj?.event || null
|
|
31515
31303
|
};
|
|
31516
31304
|
const { config, agentId, apiKey } = await initializeCommand();
|
|
31305
|
+
const hideVersions = await shouldHidePrimitiveVersions(apiKey, agentId);
|
|
31517
31306
|
const context = {
|
|
31518
31307
|
environment: "production",
|
|
31519
31308
|
agentId,
|
|
31520
|
-
apiKey
|
|
31309
|
+
apiKey,
|
|
31310
|
+
hideVersions
|
|
31521
31311
|
};
|
|
31522
31312
|
if (action) {
|
|
31523
31313
|
await executeNonInteractive5(context, config, action, options);
|
|
@@ -31547,12 +31337,14 @@ async function displayWebhooksCore(context, webhooks) {
|
|
|
31547
31337
|
console.log(`\u{1FA9D} ${webhook.name}`);
|
|
31548
31338
|
console.log(` Webhook ID: ${webhook.webhookId}`);
|
|
31549
31339
|
if (activeVersion) {
|
|
31550
|
-
console.log(
|
|
31340
|
+
console.log(deployedVersionLine(activeVersion.version, context.hideVersions));
|
|
31551
31341
|
console.log(` Deployed: ${new Date(activeVersion.createdAt).toLocaleString()}`);
|
|
31552
31342
|
} else {
|
|
31553
|
-
console.log(
|
|
31343
|
+
console.log(deployedVersionLine(null, context.hideVersions));
|
|
31344
|
+
}
|
|
31345
|
+
if (!context.hideVersions) {
|
|
31346
|
+
console.log(` Total Versions: ${versions.length}`);
|
|
31554
31347
|
}
|
|
31555
|
-
console.log(` Total Versions: ${versions.length}`);
|
|
31556
31348
|
console.log();
|
|
31557
31349
|
} else {
|
|
31558
31350
|
displayWebhookError(webhook, "Unable to fetch version info");
|
|
@@ -31585,7 +31377,11 @@ async function fetchVersionsCore3(context, webhook) {
|
|
|
31585
31377
|
};
|
|
31586
31378
|
}
|
|
31587
31379
|
__name(fetchVersionsCore3, "fetchVersionsCore");
|
|
31588
|
-
function displayVersionsCore3(webhook, versions, activeVersionId) {
|
|
31380
|
+
function displayVersionsCore3(webhook, versions, activeVersionId, hideVersions) {
|
|
31381
|
+
if (hideVersions) {
|
|
31382
|
+
primitiveVersionHistoryView(webhook.name).forEach((line) => console.log(line));
|
|
31383
|
+
return;
|
|
31384
|
+
}
|
|
31589
31385
|
console.log("\n" + "=".repeat(60));
|
|
31590
31386
|
console.log(`\u{1F4DC} Versions for ${webhook.name}`);
|
|
31591
31387
|
console.log("=".repeat(60) + "\n");
|
|
@@ -31859,12 +31655,12 @@ Usage: lua webhooks ${normalizedAction} --webhook-name <name>`);
|
|
|
31859
31655
|
case "versions": {
|
|
31860
31656
|
const data = await fetchVersionsCore3(context, selectedWebhook);
|
|
31861
31657
|
if (!data) throw new Error("Failed to fetch webhook versions");
|
|
31862
|
-
if (data.versions.length === 0) {
|
|
31658
|
+
if (!context.hideVersions && data.versions.length === 0) {
|
|
31863
31659
|
console.log(`\u2139\uFE0F No versions found for ${selectedWebhook.name}.`);
|
|
31864
31660
|
console.log("\u{1F4A1} Push a version first using 'lua push webhook'.");
|
|
31865
31661
|
return;
|
|
31866
31662
|
}
|
|
31867
|
-
displayVersionsCore3(selectedWebhook, data.versions, data.activeVersionId);
|
|
31663
|
+
displayVersionsCore3(selectedWebhook, data.versions, data.activeVersionId, context.hideVersions);
|
|
31868
31664
|
break;
|
|
31869
31665
|
}
|
|
31870
31666
|
case "deploy": {
|
|
@@ -32044,13 +31840,13 @@ async function viewVersionsInteractive2(context, config) {
|
|
|
32044
31840
|
]);
|
|
32045
31841
|
return;
|
|
32046
31842
|
}
|
|
32047
|
-
if (data.versions.length === 0) {
|
|
31843
|
+
if (!context.hideVersions && data.versions.length === 0) {
|
|
32048
31844
|
console.log(`
|
|
32049
31845
|
\u2139\uFE0F No versions found for ${selectedWebhook.name}.
|
|
32050
31846
|
`);
|
|
32051
31847
|
console.log("\u{1F4A1} Push a version first using 'lua push webhook'.\n");
|
|
32052
31848
|
} else {
|
|
32053
|
-
displayVersionsCore3(selectedWebhook, data.versions, data.activeVersionId);
|
|
31849
|
+
displayVersionsCore3(selectedWebhook, data.versions, data.activeVersionId, context.hideVersions);
|
|
32054
31850
|
console.log();
|
|
32055
31851
|
}
|
|
32056
31852
|
await safePrompt([
|
|
@@ -32548,10 +32344,12 @@ async function jobsCommand(action, cmdObj) {
|
|
|
32548
32344
|
jobVersion: cmdObj?.jobVersion || null
|
|
32549
32345
|
};
|
|
32550
32346
|
const { config, agentId, apiKey } = await initializeCommand();
|
|
32347
|
+
const hideVersions = await shouldHidePrimitiveVersions(apiKey, agentId);
|
|
32551
32348
|
const context = {
|
|
32552
32349
|
environment: "production",
|
|
32553
32350
|
agentId,
|
|
32554
|
-
apiKey
|
|
32351
|
+
apiKey,
|
|
32352
|
+
hideVersions
|
|
32555
32353
|
};
|
|
32556
32354
|
if (action) {
|
|
32557
32355
|
await executeNonInteractive6(context, config, action, options);
|
|
@@ -32620,7 +32418,11 @@ async function fetchVersionsCore4(context, job) {
|
|
|
32620
32418
|
};
|
|
32621
32419
|
}
|
|
32622
32420
|
__name(fetchVersionsCore4, "fetchVersionsCore");
|
|
32623
|
-
function displayVersionsCore4(job, versions, activeVersionId) {
|
|
32421
|
+
function displayVersionsCore4(job, versions, activeVersionId, hideVersions) {
|
|
32422
|
+
if (hideVersions) {
|
|
32423
|
+
primitiveVersionHistoryView(job.name).forEach((line) => console.log(line));
|
|
32424
|
+
return;
|
|
32425
|
+
}
|
|
32624
32426
|
console.log("\n" + "=".repeat(60));
|
|
32625
32427
|
console.log(`\u{1F4DC} Versions for ${job.name}`);
|
|
32626
32428
|
console.log("=".repeat(60) + "\n");
|
|
@@ -32891,12 +32693,12 @@ Usage: lua jobs ${normalizedAction} --job-name <name>`);
|
|
|
32891
32693
|
case "versions": {
|
|
32892
32694
|
const vData = await fetchVersionsCore4(context, selectedJob);
|
|
32893
32695
|
if (!vData) throw new Error("Failed to fetch job versions");
|
|
32894
|
-
if (vData.versions.length === 0) {
|
|
32696
|
+
if (!context.hideVersions && vData.versions.length === 0) {
|
|
32895
32697
|
console.log(`\u2139\uFE0F No versions found for ${selectedJob.name}.`);
|
|
32896
32698
|
console.log("\u{1F4A1} Push a version first using 'lua push job'.");
|
|
32897
32699
|
return;
|
|
32898
32700
|
}
|
|
32899
|
-
displayVersionsCore4(selectedJob, vData.versions, vData.activeVersionId);
|
|
32701
|
+
displayVersionsCore4(selectedJob, vData.versions, vData.activeVersionId, context.hideVersions);
|
|
32900
32702
|
break;
|
|
32901
32703
|
}
|
|
32902
32704
|
case "deploy": {
|
|
@@ -33078,13 +32880,13 @@ async function viewJobVersionsInteractive(context, config) {
|
|
|
33078
32880
|
]);
|
|
33079
32881
|
return;
|
|
33080
32882
|
}
|
|
33081
|
-
if (viewData.versions.length === 0) {
|
|
32883
|
+
if (!context.hideVersions && viewData.versions.length === 0) {
|
|
33082
32884
|
console.log(`
|
|
33083
32885
|
\u2139\uFE0F No versions found for ${selectedJob.name}.
|
|
33084
32886
|
`);
|
|
33085
32887
|
console.log("\u{1F4A1} Push a version first using 'lua push job'.\n");
|
|
33086
32888
|
} else {
|
|
33087
|
-
displayVersionsCore4(selectedJob, viewData.versions, viewData.activeVersionId);
|
|
32889
|
+
displayVersionsCore4(selectedJob, viewData.versions, viewData.activeVersionId, context.hideVersions);
|
|
33088
32890
|
console.log();
|
|
33089
32891
|
}
|
|
33090
32892
|
await safePrompt([
|
|
@@ -33797,9 +33599,11 @@ async function preprocessorsCommand(action, cmdObj) {
|
|
|
33797
33599
|
preprocessorVersion: cmdObj?.preprocessorVersion || null
|
|
33798
33600
|
};
|
|
33799
33601
|
const { config, agentId, apiKey } = await initializeCommand();
|
|
33602
|
+
const hideVersions = await shouldHidePrimitiveVersions(apiKey, agentId);
|
|
33800
33603
|
const context = {
|
|
33801
33604
|
agentId,
|
|
33802
|
-
apiKey
|
|
33605
|
+
apiKey,
|
|
33606
|
+
hideVersions
|
|
33803
33607
|
};
|
|
33804
33608
|
if (action) {
|
|
33805
33609
|
await executeNonInteractive8(context, config, action, options);
|
|
@@ -33829,12 +33633,14 @@ async function displayPreProcessorsCore(context, preprocessors) {
|
|
|
33829
33633
|
console.log(`\u{1F4E5} ${preprocessor.name}`);
|
|
33830
33634
|
console.log(` PreProcessor ID: ${preprocessor.preprocessorId}`);
|
|
33831
33635
|
if (activeVersion) {
|
|
33832
|
-
console.log(
|
|
33636
|
+
console.log(deployedVersionLine(activeVersion.version, context.hideVersions));
|
|
33833
33637
|
console.log(` Deployed: ${new Date(activeVersion.createdAt).toLocaleString()}`);
|
|
33834
33638
|
} else {
|
|
33835
|
-
console.log(
|
|
33639
|
+
console.log(deployedVersionLine(null, context.hideVersions));
|
|
33640
|
+
}
|
|
33641
|
+
if (!context.hideVersions) {
|
|
33642
|
+
console.log(` Total Versions: ${versions.length}`);
|
|
33836
33643
|
}
|
|
33837
|
-
console.log(` Total Versions: ${versions.length}`);
|
|
33838
33644
|
console.log();
|
|
33839
33645
|
} else {
|
|
33840
33646
|
displayPreProcessorError(preprocessor, "Unable to fetch version info");
|
|
@@ -33867,7 +33673,11 @@ async function fetchVersionsCore5(context, preprocessor) {
|
|
|
33867
33673
|
};
|
|
33868
33674
|
}
|
|
33869
33675
|
__name(fetchVersionsCore5, "fetchVersionsCore");
|
|
33870
|
-
function displayVersionsCore5(preprocessor, versions, activeVersionId) {
|
|
33676
|
+
function displayVersionsCore5(preprocessor, versions, activeVersionId, hideVersions) {
|
|
33677
|
+
if (hideVersions) {
|
|
33678
|
+
primitiveVersionHistoryView(preprocessor.name).forEach((line) => console.log(line));
|
|
33679
|
+
return;
|
|
33680
|
+
}
|
|
33871
33681
|
console.log("\n" + "=".repeat(60));
|
|
33872
33682
|
console.log(`\u{1F4DC} Versions for ${preprocessor.name}`);
|
|
33873
33683
|
console.log("=".repeat(60) + "\n");
|
|
@@ -34041,12 +33851,12 @@ Usage: lua preprocessors ${normalizedAction} --preprocessor-name <name>`);
|
|
|
34041
33851
|
case "versions": {
|
|
34042
33852
|
const data = await fetchVersionsCore5(context, selected);
|
|
34043
33853
|
if (!data) throw new Error("Failed to fetch preprocessor versions");
|
|
34044
|
-
if (data.versions.length === 0) {
|
|
33854
|
+
if (!context.hideVersions && data.versions.length === 0) {
|
|
34045
33855
|
console.log(`\u2139\uFE0F No versions found for ${selected.name}.`);
|
|
34046
33856
|
console.log("\u{1F4A1} Push a version first using 'lua push preprocessor'.");
|
|
34047
33857
|
return;
|
|
34048
33858
|
}
|
|
34049
|
-
displayVersionsCore5(selected, data.versions, data.activeVersionId);
|
|
33859
|
+
displayVersionsCore5(selected, data.versions, data.activeVersionId, context.hideVersions);
|
|
34050
33860
|
break;
|
|
34051
33861
|
}
|
|
34052
33862
|
case "deploy": {
|
|
@@ -34204,13 +34014,13 @@ async function viewVersionsInteractive3(context, config) {
|
|
|
34204
34014
|
]);
|
|
34205
34015
|
return;
|
|
34206
34016
|
}
|
|
34207
|
-
if (data.versions.length === 0) {
|
|
34017
|
+
if (!context.hideVersions && data.versions.length === 0) {
|
|
34208
34018
|
console.log(`
|
|
34209
34019
|
\u2139\uFE0F No versions found for ${selected.name}.
|
|
34210
34020
|
`);
|
|
34211
34021
|
console.log("\u{1F4A1} Push a version first using 'lua push preprocessor'.\n");
|
|
34212
34022
|
} else {
|
|
34213
|
-
displayVersionsCore5(selected, data.versions, data.activeVersionId);
|
|
34023
|
+
displayVersionsCore5(selected, data.versions, data.activeVersionId, context.hideVersions);
|
|
34214
34024
|
console.log();
|
|
34215
34025
|
}
|
|
34216
34026
|
await safePrompt([
|
|
@@ -34376,9 +34186,11 @@ async function postprocessorsCommand(action, cmdObj) {
|
|
|
34376
34186
|
postprocessorVersion: cmdObj?.postprocessorVersion || null
|
|
34377
34187
|
};
|
|
34378
34188
|
const { config, agentId, apiKey } = await initializeCommand();
|
|
34189
|
+
const hideVersions = await shouldHidePrimitiveVersions(apiKey, agentId);
|
|
34379
34190
|
const context = {
|
|
34380
34191
|
agentId,
|
|
34381
|
-
apiKey
|
|
34192
|
+
apiKey,
|
|
34193
|
+
hideVersions
|
|
34382
34194
|
};
|
|
34383
34195
|
if (action) {
|
|
34384
34196
|
await executeNonInteractive9(context, config, action, options);
|
|
@@ -34408,12 +34220,14 @@ async function displayPostProcessorsCore(context, postprocessors) {
|
|
|
34408
34220
|
console.log(`\u{1F4E4} ${postprocessor.name}`);
|
|
34409
34221
|
console.log(` PostProcessor ID: ${postprocessor.postprocessorId}`);
|
|
34410
34222
|
if (activeVersion) {
|
|
34411
|
-
console.log(
|
|
34223
|
+
console.log(deployedVersionLine(activeVersion.version, context.hideVersions));
|
|
34412
34224
|
console.log(` Deployed: ${new Date(activeVersion.createdAt).toLocaleString()}`);
|
|
34413
34225
|
} else {
|
|
34414
|
-
console.log(
|
|
34226
|
+
console.log(deployedVersionLine(null, context.hideVersions));
|
|
34227
|
+
}
|
|
34228
|
+
if (!context.hideVersions) {
|
|
34229
|
+
console.log(` Total Versions: ${versions.length}`);
|
|
34415
34230
|
}
|
|
34416
|
-
console.log(` Total Versions: ${versions.length}`);
|
|
34417
34231
|
console.log();
|
|
34418
34232
|
} else {
|
|
34419
34233
|
displayPostProcessorError(postprocessor, "Unable to fetch version info");
|
|
@@ -34446,7 +34260,11 @@ async function fetchVersionsCore6(context, postprocessor) {
|
|
|
34446
34260
|
};
|
|
34447
34261
|
}
|
|
34448
34262
|
__name(fetchVersionsCore6, "fetchVersionsCore");
|
|
34449
|
-
function displayVersionsCore6(postprocessor, versions, activeVersionId) {
|
|
34263
|
+
function displayVersionsCore6(postprocessor, versions, activeVersionId, hideVersions) {
|
|
34264
|
+
if (hideVersions) {
|
|
34265
|
+
primitiveVersionHistoryView(postprocessor.name).forEach((line) => console.log(line));
|
|
34266
|
+
return;
|
|
34267
|
+
}
|
|
34450
34268
|
console.log("\n" + "=".repeat(60));
|
|
34451
34269
|
console.log(`\u{1F4DC} Versions for ${postprocessor.name}`);
|
|
34452
34270
|
console.log("=".repeat(60) + "\n");
|
|
@@ -34620,12 +34438,12 @@ Usage: lua postprocessors ${normalizedAction} --postprocessor-name <name>`);
|
|
|
34620
34438
|
case "versions": {
|
|
34621
34439
|
const data = await fetchVersionsCore6(context, selected);
|
|
34622
34440
|
if (!data) throw new Error("Failed to fetch postprocessor versions");
|
|
34623
|
-
if (data.versions.length === 0) {
|
|
34441
|
+
if (!context.hideVersions && data.versions.length === 0) {
|
|
34624
34442
|
console.log(`\u2139\uFE0F No versions found for ${selected.name}.`);
|
|
34625
34443
|
console.log("\u{1F4A1} Push a version first using 'lua push postprocessor'.");
|
|
34626
34444
|
return;
|
|
34627
34445
|
}
|
|
34628
|
-
displayVersionsCore6(selected, data.versions, data.activeVersionId);
|
|
34446
|
+
displayVersionsCore6(selected, data.versions, data.activeVersionId, context.hideVersions);
|
|
34629
34447
|
break;
|
|
34630
34448
|
}
|
|
34631
34449
|
case "deploy": {
|
|
@@ -34783,13 +34601,13 @@ async function viewVersionsInteractive4(context, config) {
|
|
|
34783
34601
|
]);
|
|
34784
34602
|
return;
|
|
34785
34603
|
}
|
|
34786
|
-
if (data.versions.length === 0) {
|
|
34604
|
+
if (!context.hideVersions && data.versions.length === 0) {
|
|
34787
34605
|
console.log(`
|
|
34788
34606
|
\u2139\uFE0F No versions found for ${selected.name}.
|
|
34789
34607
|
`);
|
|
34790
34608
|
console.log("\u{1F4A1} Push a version first using 'lua push postprocessor'.\n");
|
|
34791
34609
|
} else {
|
|
34792
|
-
displayVersionsCore6(selected, data.versions, data.activeVersionId);
|
|
34610
|
+
displayVersionsCore6(selected, data.versions, data.activeVersionId, context.hideVersions);
|
|
34793
34611
|
console.log();
|
|
34794
34612
|
}
|
|
34795
34613
|
await safePrompt([
|
|
@@ -40362,7 +40180,7 @@ __name(telemetryCommand, "telemetryCommand");
|
|
|
40362
40180
|
init_cli();
|
|
40363
40181
|
init_command_utils();
|
|
40364
40182
|
init_analytics();
|
|
40365
|
-
import { writeFileSync as
|
|
40183
|
+
import { writeFileSync as writeFileSync8, existsSync as existsSync8, unlinkSync as unlinkSync2 } from "fs";
|
|
40366
40184
|
import { resolve as resolve4, join as join7 } from "path";
|
|
40367
40185
|
init_artifact_loader();
|
|
40368
40186
|
init_types();
|
|
@@ -40523,7 +40341,7 @@ async function governanceCommand(action) {
|
|
|
40523
40341
|
}
|
|
40524
40342
|
}
|
|
40525
40343
|
const content = generateFile(setup);
|
|
40526
|
-
|
|
40344
|
+
writeFileSync8(filePath, content, "utf-8");
|
|
40527
40345
|
const relativePath = filePath.replace(process.cwd() + "/", "");
|
|
40528
40346
|
writeSuccess(`Created ${relativePath}`);
|
|
40529
40347
|
console.log("");
|
|
@@ -41812,10 +41630,7 @@ async function sourceRollbackCommand(opts) {
|
|
|
41812
41630
|
const agentId = config?.agent?.agentId;
|
|
41813
41631
|
if (!agentId) throw new Error("No agentId in lua.skill.yaml. Run `lua init` first.");
|
|
41814
41632
|
if (!opts.silent) {
|
|
41815
|
-
|
|
41816
|
-
if (versioning.enabled) {
|
|
41817
|
-
writeInfo("\u26A0\uFE0F `lua source rollback` is deprecated when agent versioning is on. Use `lua version promote <version>` \u2014 instant, no re-upload required.");
|
|
41818
|
-
}
|
|
41633
|
+
writeInfo("\u26A0\uFE0F `lua source rollback` is deprecated when agent versioning is on. Use `lua version promote <version>` \u2014 instant, no re-upload required.");
|
|
41819
41634
|
}
|
|
41820
41635
|
const fetchM = opts.fetchManifest ?? defaultFetchManifest;
|
|
41821
41636
|
const fetchU = opts.fetchUrls ?? defaultFetchUrls;
|
|
@@ -41891,6 +41706,76 @@ __name(defaultRestore, "defaultRestore");
|
|
|
41891
41706
|
init_cli();
|
|
41892
41707
|
init_command_utils();
|
|
41893
41708
|
init_analytics();
|
|
41709
|
+
|
|
41710
|
+
// src/api/agent-version.api.service.ts
|
|
41711
|
+
init_http_client();
|
|
41712
|
+
var AgentVersionApi = class extends HttpClient {
|
|
41713
|
+
static {
|
|
41714
|
+
__name(this, "AgentVersionApi");
|
|
41715
|
+
}
|
|
41716
|
+
apiKey;
|
|
41717
|
+
agentId;
|
|
41718
|
+
constructor(baseUrl, apiKey, agentId) {
|
|
41719
|
+
super(baseUrl);
|
|
41720
|
+
this.apiKey = apiKey;
|
|
41721
|
+
this.agentId = agentId;
|
|
41722
|
+
}
|
|
41723
|
+
get basePath() {
|
|
41724
|
+
return `/developer/agents/${encodeURIComponent(this.agentId)}`;
|
|
41725
|
+
}
|
|
41726
|
+
get authHeader() {
|
|
41727
|
+
return {
|
|
41728
|
+
Authorization: `Bearer ${this.apiKey}`
|
|
41729
|
+
};
|
|
41730
|
+
}
|
|
41731
|
+
// ---------------------------------------------------------------------------
|
|
41732
|
+
// Version CRUD
|
|
41733
|
+
// ---------------------------------------------------------------------------
|
|
41734
|
+
async createVersion(body) {
|
|
41735
|
+
return this.httpPost(`${this.basePath}/versions`, body, this.authHeader);
|
|
41736
|
+
}
|
|
41737
|
+
async listVersions(query) {
|
|
41738
|
+
const params = new URLSearchParams();
|
|
41739
|
+
if (query?.all !== void 0) params.append("all", String(query.all));
|
|
41740
|
+
if (query?.limit !== void 0) params.append("limit", String(query.limit));
|
|
41741
|
+
if (query?.status !== void 0) params.append("status", query.status);
|
|
41742
|
+
const qs = params.toString();
|
|
41743
|
+
const url = qs ? `${this.basePath}/versions?${qs}` : `${this.basePath}/versions`;
|
|
41744
|
+
return this.httpGet(url, this.authHeader);
|
|
41745
|
+
}
|
|
41746
|
+
async getVersion(version) {
|
|
41747
|
+
return this.httpGet(`${this.basePath}/versions/${version}`, this.authHeader);
|
|
41748
|
+
}
|
|
41749
|
+
async deleteVersion(version) {
|
|
41750
|
+
return this.httpDelete(`${this.basePath}/versions/${version}`, this.authHeader);
|
|
41751
|
+
}
|
|
41752
|
+
// ---------------------------------------------------------------------------
|
|
41753
|
+
// Diff
|
|
41754
|
+
// ---------------------------------------------------------------------------
|
|
41755
|
+
async diffVersions(from, to) {
|
|
41756
|
+
const url = `${this.basePath}/versions/diff?from=${from}&to=${to}`;
|
|
41757
|
+
return this.httpGet(url, this.authHeader);
|
|
41758
|
+
}
|
|
41759
|
+
// ---------------------------------------------------------------------------
|
|
41760
|
+
// Promote
|
|
41761
|
+
// ---------------------------------------------------------------------------
|
|
41762
|
+
async promoteVersion(version) {
|
|
41763
|
+
return this.httpPost(`${this.basePath}/versions/${version}/promote`, {}, this.authHeader);
|
|
41764
|
+
}
|
|
41765
|
+
// ---------------------------------------------------------------------------
|
|
41766
|
+
// Patch commit hash — called by `lua version create` after a successful git
|
|
41767
|
+
// commit + tag to propagate the SHA to the backend AgentVersion record.
|
|
41768
|
+
// Failure is non-fatal; the version snapshot is valid whether or not this
|
|
41769
|
+
// PATCH lands.
|
|
41770
|
+
// ---------------------------------------------------------------------------
|
|
41771
|
+
async patchCommitHash(version, commitHash) {
|
|
41772
|
+
return this.httpPatch(`${this.basePath}/versions/${version}/commit-hash`, {
|
|
41773
|
+
commitHash
|
|
41774
|
+
}, this.authHeader);
|
|
41775
|
+
}
|
|
41776
|
+
};
|
|
41777
|
+
|
|
41778
|
+
// src/commands/version.ts
|
|
41894
41779
|
init_files();
|
|
41895
41780
|
init_constants();
|
|
41896
41781
|
|
|
@@ -41907,17 +41792,9 @@ function parseVersion2(arg) {
|
|
|
41907
41792
|
__name(parseVersion2, "parseVersion");
|
|
41908
41793
|
|
|
41909
41794
|
// src/commands/version.ts
|
|
41910
|
-
async function assertVersioningEnabled(apiKey, agentId) {
|
|
41911
|
-
const { enabled } = await getVersioningModeCached(apiKey, agentId);
|
|
41912
|
-
if (!enabled) {
|
|
41913
|
-
throw new Error("Agent versioning is not enabled for your organization. Contact your admin to enable it, or use `lua push <primitive>` for the legacy flow.");
|
|
41914
|
-
}
|
|
41915
|
-
}
|
|
41916
|
-
__name(assertVersioningEnabled, "assertVersioningEnabled");
|
|
41917
41795
|
async function versionCreateCommand(options = {}) {
|
|
41918
41796
|
return withErrorHandling(async () => {
|
|
41919
41797
|
const { apiKey, agentId } = await initializeCommand();
|
|
41920
|
-
await assertVersioningEnabled(apiKey, agentId);
|
|
41921
41798
|
let config = readYamlConfig();
|
|
41922
41799
|
let backupVersion = config?.backup?.activeVersion;
|
|
41923
41800
|
if (options.autoPush) {
|
|
@@ -41981,7 +41858,6 @@ __name(versionCreateCommand, "versionCreateCommand");
|
|
|
41981
41858
|
async function versionListCommand(options = {}) {
|
|
41982
41859
|
return withErrorHandling(async () => {
|
|
41983
41860
|
const { apiKey, agentId } = await initializeCommand();
|
|
41984
|
-
await assertVersioningEnabled(apiKey, agentId);
|
|
41985
41861
|
const query = {};
|
|
41986
41862
|
if (options.all) query.all = true;
|
|
41987
41863
|
if (options.limit != null) query.limit = options.limit;
|
|
@@ -42017,7 +41893,6 @@ __name(versionListCommand, "versionListCommand");
|
|
|
42017
41893
|
async function versionShowCommand(versionArg, options = {}) {
|
|
42018
41894
|
return withErrorHandling(async () => {
|
|
42019
41895
|
const { apiKey, agentId } = await initializeCommand();
|
|
42020
|
-
await assertVersioningEnabled(apiKey, agentId);
|
|
42021
41896
|
const version = parseVersion2(versionArg);
|
|
42022
41897
|
const api = new AgentVersionApi(BASE_URLS.API, apiKey, agentId);
|
|
42023
41898
|
const response = await api.getVersion(version);
|
|
@@ -42052,7 +41927,6 @@ __name(versionShowCommand, "versionShowCommand");
|
|
|
42052
41927
|
async function versionDiffCommand(fromArg, toArg, options = {}) {
|
|
42053
41928
|
return withErrorHandling(async () => {
|
|
42054
41929
|
const { apiKey, agentId } = await initializeCommand();
|
|
42055
|
-
await assertVersioningEnabled(apiKey, agentId);
|
|
42056
41930
|
const from = parseVersion2(fromArg);
|
|
42057
41931
|
const to = parseVersion2(toArg);
|
|
42058
41932
|
const api = new AgentVersionApi(BASE_URLS.API, apiKey, agentId);
|
|
@@ -42130,7 +42004,6 @@ __name(versionDiffCommand, "versionDiffCommand");
|
|
|
42130
42004
|
async function versionPromoteCommand(versionArg) {
|
|
42131
42005
|
return withErrorHandling(async () => {
|
|
42132
42006
|
const { apiKey, agentId } = await initializeCommand();
|
|
42133
|
-
await assertVersioningEnabled(apiKey, agentId);
|
|
42134
42007
|
const version = parseVersion2(versionArg);
|
|
42135
42008
|
const api = new AgentVersionApi(BASE_URLS.API, apiKey, agentId);
|
|
42136
42009
|
const response = await api.promoteVersion(version);
|
|
@@ -42171,7 +42044,6 @@ __name(versionPromoteCommand, "versionPromoteCommand");
|
|
|
42171
42044
|
async function versionDeleteCommand(versionArg, options = {}) {
|
|
42172
42045
|
return withErrorHandling(async () => {
|
|
42173
42046
|
const { apiKey, agentId } = await initializeCommand();
|
|
42174
|
-
await assertVersioningEnabled(apiKey, agentId);
|
|
42175
42047
|
if (versionArg === "current" || versionArg === "active") {
|
|
42176
42048
|
throw new Error(`Cannot delete the active version directly. Use \`lua version promote <other>\` to roll back first, then delete.`);
|
|
42177
42049
|
}
|
|
@@ -42477,7 +42349,6 @@ async function pullCommand(options = {}) {
|
|
|
42477
42349
|
const { apiKey, agentId } = await initializeCommand();
|
|
42478
42350
|
const force = Boolean(options.force);
|
|
42479
42351
|
if (options.version) {
|
|
42480
|
-
await assertVersioningEnabled(apiKey, agentId);
|
|
42481
42352
|
const version = parseVersion2(options.version);
|
|
42482
42353
|
const api = new AgentVersionApi(BASE_URLS.API, apiKey, agentId);
|
|
42483
42354
|
const response = await api.getVersion(version);
|
|
@@ -43160,12 +43031,7 @@ Examples:
|
|
|
43160
43031
|
$ lua voice test --runner vitest Force vitest
|
|
43161
43032
|
`).action(voiceTestCommand);
|
|
43162
43033
|
voice.command("list").description("List LuaVoice primitives in the compiled manifest").option("--json", "Output as JSON").action(voiceListCommand);
|
|
43163
|
-
const versionGroup = program2.command("version").description("\u{1F3F7}\uFE0F Manage agent versions \u2014 atomic snapshots
|
|
43164
|
-
Note:
|
|
43165
|
-
All \`lua version\` subcommands require the \`agentVersioningEnabled\`
|
|
43166
|
-
feature flag for your org. If a subcommand errors with "Agent versioning
|
|
43167
|
-
is not enabled," contact your admin to enable it.
|
|
43168
|
-
`);
|
|
43034
|
+
const versionGroup = program2.command("version").description("\u{1F3F7}\uFE0F Manage agent versions \u2014 atomic snapshots of agent state");
|
|
43169
43035
|
versionGroup.command("create").description("Snapshot current staged state into a new version").option("-m, --message <message>", "Optional description for this version").option("--auto-push", "Push first if local changes are not yet staged").option("--commit-hash <hash>", "Optional git commit hash to associate with this version").addHelpText("after", `
|
|
43170
43036
|
Examples:
|
|
43171
43037
|
$ lua version create Snapshot current state
|