lua-cli 3.17.3 → 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 +267 -490
- 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
|
}
|
|
@@ -23050,15 +22885,9 @@ async function pushCommand(type, cmdObj) {
|
|
|
23050
22885
|
allowAll: true
|
|
23051
22886
|
});
|
|
23052
22887
|
}
|
|
23053
|
-
const
|
|
23054
|
-
const
|
|
23055
|
-
const
|
|
23056
|
-
const versioning = earlyApiKey && earlyAgentId ? await getVersioningModeCached(earlyApiKey, earlyAgentId) : {
|
|
23057
|
-
enabled: false
|
|
23058
|
-
};
|
|
23059
|
-
const isStageAll = !type && versioning.enabled;
|
|
23060
|
-
const isGranular = Boolean(type && type !== "all" && versioning.enabled);
|
|
23061
|
-
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);
|
|
23062
22891
|
if (isAutoDeployNoOp) {
|
|
23063
22892
|
writeInfo("\u26A0\uFE0F --auto-deploy is ignored when agent versioning is on. Use `lua version promote <version>` after `lua version create`.");
|
|
23064
22893
|
options.autoDeploy = false;
|
|
@@ -23090,64 +22919,7 @@ async function pushCommand(type, cmdObj) {
|
|
|
23090
22919
|
autoDeployNoopWarned: isAutoDeployNoOp
|
|
23091
22920
|
});
|
|
23092
22921
|
}
|
|
23093
|
-
|
|
23094
|
-
selectedType = type;
|
|
23095
|
-
} else {
|
|
23096
|
-
const typeAnswer = await safePrompt([
|
|
23097
|
-
{
|
|
23098
|
-
type: "list",
|
|
23099
|
-
name: "type",
|
|
23100
|
-
message: "What would you like to push?",
|
|
23101
|
-
choices: [
|
|
23102
|
-
{
|
|
23103
|
-
name: "\u{1F6E0}\uFE0F Skill",
|
|
23104
|
-
value: "skill"
|
|
23105
|
-
},
|
|
23106
|
-
{
|
|
23107
|
-
name: "\u{1FA9D} Webhook",
|
|
23108
|
-
value: "webhook"
|
|
23109
|
-
},
|
|
23110
|
-
{
|
|
23111
|
-
name: "\u23F0 Job",
|
|
23112
|
-
value: "job"
|
|
23113
|
-
},
|
|
23114
|
-
{
|
|
23115
|
-
name: "\u{1F4E5} PreProcessor",
|
|
23116
|
-
value: "preprocessor"
|
|
23117
|
-
},
|
|
23118
|
-
{
|
|
23119
|
-
name: "\u{1F4E4} PostProcessor",
|
|
23120
|
-
value: "postprocessor"
|
|
23121
|
-
},
|
|
23122
|
-
{
|
|
23123
|
-
name: "\u{1F50C} MCP Server",
|
|
23124
|
-
value: "mcp"
|
|
23125
|
-
},
|
|
23126
|
-
{
|
|
23127
|
-
name: "\u{1F4E1} Device",
|
|
23128
|
-
value: "device"
|
|
23129
|
-
},
|
|
23130
|
-
{
|
|
23131
|
-
name: "\u{1F4E1} Device Trigger",
|
|
23132
|
-
value: "device-trigger"
|
|
23133
|
-
},
|
|
23134
|
-
{
|
|
23135
|
-
name: "\u{1F916} Agent (persona, model)",
|
|
23136
|
-
value: "agent"
|
|
23137
|
-
},
|
|
23138
|
-
{
|
|
23139
|
-
name: "\u{1F4BE} Backup (source files)",
|
|
23140
|
-
value: "backup"
|
|
23141
|
-
}
|
|
23142
|
-
]
|
|
23143
|
-
}
|
|
23144
|
-
]);
|
|
23145
|
-
if (!typeAnswer) {
|
|
23146
|
-
console.log("Push cancelled.");
|
|
23147
|
-
return;
|
|
23148
|
-
}
|
|
23149
|
-
selectedType = typeAnswer.type;
|
|
23150
|
-
}
|
|
22922
|
+
selectedType = type;
|
|
23151
22923
|
if (selectedType === "skill") {
|
|
23152
22924
|
versionedPushDeployResult = await pushVersionedPrimitive(skillHandler, options);
|
|
23153
22925
|
} else if (selectedType === "webhook") {
|
|
@@ -23237,7 +23009,7 @@ Until the backup catches up, \`lua init\` for this agent will restore an older s
|
|
|
23237
23009
|
include_source_attached: trackedIncludeSource?.attached ?? 0,
|
|
23238
23010
|
include_source_failed: trackedIncludeSource?.failed ?? 0,
|
|
23239
23011
|
// Agent-versioning telemetry. Driven by isStageAll / isGranular.
|
|
23240
|
-
versioning_mode:
|
|
23012
|
+
versioning_mode: isGranular ? "granular" : "all",
|
|
23241
23013
|
granular_deprecation_warned: isGranular,
|
|
23242
23014
|
auto_deploy_noop_warned: isAutoDeployNoOp
|
|
23243
23015
|
});
|
|
@@ -23532,7 +23304,6 @@ async function pushAllCommand(options) {
|
|
|
23532
23304
|
}
|
|
23533
23305
|
const apiKey = await requireAuthOrExit(false);
|
|
23534
23306
|
const agentId = config.agent.agentId;
|
|
23535
|
-
const pushAllVersioning = await getVersioningModeCached(apiKey, agentId);
|
|
23536
23307
|
let manifest;
|
|
23537
23308
|
try {
|
|
23538
23309
|
manifest = loadManifest();
|
|
@@ -23838,7 +23609,7 @@ Until the backup catches up, \`lua init\` for this agent will restore an older s
|
|
|
23838
23609
|
include_source_attached: includeSourceStats?.attached ?? 0,
|
|
23839
23610
|
include_source_failed: includeSourceStats?.failed ?? 0,
|
|
23840
23611
|
// Agent-versioning telemetry.
|
|
23841
|
-
versioning_mode:
|
|
23612
|
+
versioning_mode: "stage-all",
|
|
23842
23613
|
granular_deprecation_warned: false,
|
|
23843
23614
|
auto_deploy_noop_warned: options.autoDeployNoopWarned || false
|
|
23844
23615
|
});
|
|
@@ -23856,42 +23627,8 @@ Until the backup catches up, \`lua init\` for this agent will restore an older s
|
|
|
23856
23627
|
});
|
|
23857
23628
|
if (variant === "success") {
|
|
23858
23629
|
console.log("");
|
|
23859
|
-
if (
|
|
23860
|
-
|
|
23861
|
-
writeInfo(`Run \`lua version create [-m "<message>"]\` to snapshot the staged state into a named version, then \`lua version promote <version>\` to deploy.`);
|
|
23862
|
-
}
|
|
23863
|
-
} else if (options.autoDeploy) {
|
|
23864
|
-
writeHintBlock({
|
|
23865
|
-
headline: "All deployed. Generate test traffic first, then inspect:",
|
|
23866
|
-
lines: [
|
|
23867
|
-
{
|
|
23868
|
-
label: "Test:",
|
|
23869
|
-
command: 'lua chat -e production -m "your test message"'
|
|
23870
|
-
},
|
|
23871
|
-
{
|
|
23872
|
-
label: "Inspect:",
|
|
23873
|
-
command: buildLogsCommand({
|
|
23874
|
-
limit: 10
|
|
23875
|
-
})
|
|
23876
|
-
}
|
|
23877
|
-
],
|
|
23878
|
-
when: "success"
|
|
23879
|
-
});
|
|
23880
|
-
} else {
|
|
23881
|
-
writeHintBlock({
|
|
23882
|
-
headline: "Code staged but NOT live. Make it active:",
|
|
23883
|
-
lines: [
|
|
23884
|
-
{
|
|
23885
|
-
label: "Deploy all:",
|
|
23886
|
-
command: "lua deploy all --force"
|
|
23887
|
-
},
|
|
23888
|
-
{
|
|
23889
|
-
label: "Or re-push:",
|
|
23890
|
-
command: "lua push all --force --auto-deploy"
|
|
23891
|
-
}
|
|
23892
|
-
],
|
|
23893
|
-
when: "success"
|
|
23894
|
-
});
|
|
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.`);
|
|
23895
23632
|
}
|
|
23896
23633
|
} else if (variant === "partial") {
|
|
23897
23634
|
console.log("");
|
|
@@ -24128,10 +23865,7 @@ async function deployCommand(type, cmdObj) {
|
|
|
24128
23865
|
selectedType = answer.type;
|
|
24129
23866
|
}
|
|
24130
23867
|
const apiKey = await requireAuthOrExit();
|
|
24131
|
-
|
|
24132
|
-
if (versioning.enabled) {
|
|
24133
|
-
writeInfo("\u26A0\uFE0F `lua deploy` is deprecated when agent versioning is on. Use `lua version promote <version>` for instant, atomic promotion.");
|
|
24134
|
-
}
|
|
23868
|
+
writeInfo("\u26A0\uFE0F `lua deploy` is deprecated when agent versioning is on. Use `lua version promote <version>` for instant, atomic promotion.");
|
|
24135
23869
|
let personaDeployed = false;
|
|
24136
23870
|
let versionedOutcome = null;
|
|
24137
23871
|
if (selectedType === "persona") {
|
|
@@ -24145,7 +23879,7 @@ async function deployCommand(type, cmdObj) {
|
|
|
24145
23879
|
force_mode: options.force || false,
|
|
24146
23880
|
entity_selected_by_name: !!options.name,
|
|
24147
23881
|
version_selected_by_flag: !!options.version,
|
|
24148
|
-
granular_deprecation_warned:
|
|
23882
|
+
granular_deprecation_warned: true
|
|
24149
23883
|
});
|
|
24150
23884
|
const deployed = selectedType === "persona" ? personaDeployed : versionedOutcome?.deployed ?? false;
|
|
24151
23885
|
const hintPrintedAlready = selectedType !== "persona" && !!versionedOutcome?.hintPrinted;
|
|
@@ -24639,11 +24373,11 @@ init_cli();
|
|
|
24639
24373
|
|
|
24640
24374
|
// src/utils/sandbox-storage.ts
|
|
24641
24375
|
init_constants();
|
|
24642
|
-
import { readFileSync as
|
|
24643
|
-
import { dirname as
|
|
24376
|
+
import { readFileSync as readFileSync10, writeFileSync as writeFileSync7, mkdirSync as mkdirSync7 } from "fs";
|
|
24377
|
+
import { dirname as dirname6 } from "path";
|
|
24644
24378
|
function readStore2() {
|
|
24645
24379
|
try {
|
|
24646
|
-
const raw =
|
|
24380
|
+
const raw = readFileSync10(SANDBOX_STORAGE_FILE, "utf8");
|
|
24647
24381
|
const parsed = JSON.parse(raw);
|
|
24648
24382
|
return {
|
|
24649
24383
|
skills: parsed.skills ?? {},
|
|
@@ -24663,10 +24397,10 @@ function readStore2() {
|
|
|
24663
24397
|
__name(readStore2, "readStore");
|
|
24664
24398
|
function writeStore2(store) {
|
|
24665
24399
|
try {
|
|
24666
|
-
|
|
24400
|
+
mkdirSync7(dirname6(SANDBOX_STORAGE_FILE), {
|
|
24667
24401
|
recursive: true
|
|
24668
24402
|
});
|
|
24669
|
-
|
|
24403
|
+
writeFileSync7(SANDBOX_STORAGE_FILE, JSON.stringify(store, null, 2), "utf8");
|
|
24670
24404
|
} catch {
|
|
24671
24405
|
}
|
|
24672
24406
|
}
|
|
@@ -25988,8 +25722,8 @@ init_cli();
|
|
|
25988
25722
|
init_constants();
|
|
25989
25723
|
init_command_utils();
|
|
25990
25724
|
init_developer_api_service();
|
|
25991
|
-
import
|
|
25992
|
-
import
|
|
25725
|
+
import fs15 from "fs";
|
|
25726
|
+
import path17 from "path";
|
|
25993
25727
|
import inquirer10 from "inquirer";
|
|
25994
25728
|
init_analytics();
|
|
25995
25729
|
function resolveEnvironment(env, hasNonInteractiveFlags) {
|
|
@@ -26348,10 +26082,10 @@ function variablesToEnvContent(variables) {
|
|
|
26348
26082
|
}
|
|
26349
26083
|
__name(variablesToEnvContent, "variablesToEnvContent");
|
|
26350
26084
|
function saveSandboxEnvVariables(variables) {
|
|
26351
|
-
const envFilePath =
|
|
26085
|
+
const envFilePath = path17.join(process.cwd(), ".env");
|
|
26352
26086
|
try {
|
|
26353
26087
|
const content = variablesToEnvContent(variables);
|
|
26354
|
-
|
|
26088
|
+
fs15.writeFileSync(envFilePath, content, "utf8");
|
|
26355
26089
|
return true;
|
|
26356
26090
|
} catch (error) {
|
|
26357
26091
|
console.error("\u274C Error saving .env file:", error);
|
|
@@ -30166,13 +29900,8 @@ init_command_utils();
|
|
|
30166
29900
|
|
|
30167
29901
|
// src/utils/primitive-version-display.ts
|
|
30168
29902
|
var PRIMITIVE_VERSION_HISTORY_NOTE = "\u2139\uFE0F Primitive versions are managed by agent versioning. Run `lua version list` to view agent versions.";
|
|
30169
|
-
async function shouldHidePrimitiveVersions(
|
|
30170
|
-
|
|
30171
|
-
const { enabled } = await getVersioningModeCached(apiKey, agentId);
|
|
30172
|
-
return enabled;
|
|
30173
|
-
} catch {
|
|
30174
|
-
return false;
|
|
30175
|
-
}
|
|
29903
|
+
async function shouldHidePrimitiveVersions(_apiKey, _agentId) {
|
|
29904
|
+
return true;
|
|
30176
29905
|
}
|
|
30177
29906
|
__name(shouldHidePrimitiveVersions, "shouldHidePrimitiveVersions");
|
|
30178
29907
|
var DIVIDER = "=".repeat(60);
|
|
@@ -30889,7 +30618,7 @@ init_auth();
|
|
|
30889
30618
|
init_auth_api_service();
|
|
30890
30619
|
init_files();
|
|
30891
30620
|
init_artifact_loader();
|
|
30892
|
-
import { existsSync as existsSync7, readFileSync as
|
|
30621
|
+
import { existsSync as existsSync7, readFileSync as readFileSync11 } from "fs";
|
|
30893
30622
|
import { join as join6 } from "path";
|
|
30894
30623
|
import { performance } from "perf_hooks";
|
|
30895
30624
|
import * as os from "os";
|
|
@@ -31240,7 +30969,7 @@ function gatherTelemetry() {
|
|
|
31240
30969
|
} else {
|
|
31241
30970
|
try {
|
|
31242
30971
|
if (existsSync7(TELEMETRY_FILE)) {
|
|
31243
|
-
const raw =
|
|
30972
|
+
const raw = readFileSync11(TELEMETRY_FILE, "utf8");
|
|
31244
30973
|
const cfg = JSON.parse(raw);
|
|
31245
30974
|
if (typeof cfg.enabled === "boolean") enabled = cfg.enabled;
|
|
31246
30975
|
}
|
|
@@ -40451,7 +40180,7 @@ __name(telemetryCommand, "telemetryCommand");
|
|
|
40451
40180
|
init_cli();
|
|
40452
40181
|
init_command_utils();
|
|
40453
40182
|
init_analytics();
|
|
40454
|
-
import { writeFileSync as
|
|
40183
|
+
import { writeFileSync as writeFileSync8, existsSync as existsSync8, unlinkSync as unlinkSync2 } from "fs";
|
|
40455
40184
|
import { resolve as resolve4, join as join7 } from "path";
|
|
40456
40185
|
init_artifact_loader();
|
|
40457
40186
|
init_types();
|
|
@@ -40612,7 +40341,7 @@ async function governanceCommand(action) {
|
|
|
40612
40341
|
}
|
|
40613
40342
|
}
|
|
40614
40343
|
const content = generateFile(setup);
|
|
40615
|
-
|
|
40344
|
+
writeFileSync8(filePath, content, "utf-8");
|
|
40616
40345
|
const relativePath = filePath.replace(process.cwd() + "/", "");
|
|
40617
40346
|
writeSuccess(`Created ${relativePath}`);
|
|
40618
40347
|
console.log("");
|
|
@@ -41901,10 +41630,7 @@ async function sourceRollbackCommand(opts) {
|
|
|
41901
41630
|
const agentId = config?.agent?.agentId;
|
|
41902
41631
|
if (!agentId) throw new Error("No agentId in lua.skill.yaml. Run `lua init` first.");
|
|
41903
41632
|
if (!opts.silent) {
|
|
41904
|
-
|
|
41905
|
-
if (versioning.enabled) {
|
|
41906
|
-
writeInfo("\u26A0\uFE0F `lua source rollback` is deprecated when agent versioning is on. Use `lua version promote <version>` \u2014 instant, no re-upload required.");
|
|
41907
|
-
}
|
|
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.");
|
|
41908
41634
|
}
|
|
41909
41635
|
const fetchM = opts.fetchManifest ?? defaultFetchManifest;
|
|
41910
41636
|
const fetchU = opts.fetchUrls ?? defaultFetchUrls;
|
|
@@ -41980,6 +41706,76 @@ __name(defaultRestore, "defaultRestore");
|
|
|
41980
41706
|
init_cli();
|
|
41981
41707
|
init_command_utils();
|
|
41982
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
|
|
41983
41779
|
init_files();
|
|
41984
41780
|
init_constants();
|
|
41985
41781
|
|
|
@@ -41996,17 +41792,9 @@ function parseVersion2(arg) {
|
|
|
41996
41792
|
__name(parseVersion2, "parseVersion");
|
|
41997
41793
|
|
|
41998
41794
|
// src/commands/version.ts
|
|
41999
|
-
async function assertVersioningEnabled(apiKey, agentId) {
|
|
42000
|
-
const { enabled } = await getVersioningModeCached(apiKey, agentId);
|
|
42001
|
-
if (!enabled) {
|
|
42002
|
-
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.");
|
|
42003
|
-
}
|
|
42004
|
-
}
|
|
42005
|
-
__name(assertVersioningEnabled, "assertVersioningEnabled");
|
|
42006
41795
|
async function versionCreateCommand(options = {}) {
|
|
42007
41796
|
return withErrorHandling(async () => {
|
|
42008
41797
|
const { apiKey, agentId } = await initializeCommand();
|
|
42009
|
-
await assertVersioningEnabled(apiKey, agentId);
|
|
42010
41798
|
let config = readYamlConfig();
|
|
42011
41799
|
let backupVersion = config?.backup?.activeVersion;
|
|
42012
41800
|
if (options.autoPush) {
|
|
@@ -42070,7 +41858,6 @@ __name(versionCreateCommand, "versionCreateCommand");
|
|
|
42070
41858
|
async function versionListCommand(options = {}) {
|
|
42071
41859
|
return withErrorHandling(async () => {
|
|
42072
41860
|
const { apiKey, agentId } = await initializeCommand();
|
|
42073
|
-
await assertVersioningEnabled(apiKey, agentId);
|
|
42074
41861
|
const query = {};
|
|
42075
41862
|
if (options.all) query.all = true;
|
|
42076
41863
|
if (options.limit != null) query.limit = options.limit;
|
|
@@ -42106,7 +41893,6 @@ __name(versionListCommand, "versionListCommand");
|
|
|
42106
41893
|
async function versionShowCommand(versionArg, options = {}) {
|
|
42107
41894
|
return withErrorHandling(async () => {
|
|
42108
41895
|
const { apiKey, agentId } = await initializeCommand();
|
|
42109
|
-
await assertVersioningEnabled(apiKey, agentId);
|
|
42110
41896
|
const version = parseVersion2(versionArg);
|
|
42111
41897
|
const api = new AgentVersionApi(BASE_URLS.API, apiKey, agentId);
|
|
42112
41898
|
const response = await api.getVersion(version);
|
|
@@ -42141,7 +41927,6 @@ __name(versionShowCommand, "versionShowCommand");
|
|
|
42141
41927
|
async function versionDiffCommand(fromArg, toArg, options = {}) {
|
|
42142
41928
|
return withErrorHandling(async () => {
|
|
42143
41929
|
const { apiKey, agentId } = await initializeCommand();
|
|
42144
|
-
await assertVersioningEnabled(apiKey, agentId);
|
|
42145
41930
|
const from = parseVersion2(fromArg);
|
|
42146
41931
|
const to = parseVersion2(toArg);
|
|
42147
41932
|
const api = new AgentVersionApi(BASE_URLS.API, apiKey, agentId);
|
|
@@ -42219,7 +42004,6 @@ __name(versionDiffCommand, "versionDiffCommand");
|
|
|
42219
42004
|
async function versionPromoteCommand(versionArg) {
|
|
42220
42005
|
return withErrorHandling(async () => {
|
|
42221
42006
|
const { apiKey, agentId } = await initializeCommand();
|
|
42222
|
-
await assertVersioningEnabled(apiKey, agentId);
|
|
42223
42007
|
const version = parseVersion2(versionArg);
|
|
42224
42008
|
const api = new AgentVersionApi(BASE_URLS.API, apiKey, agentId);
|
|
42225
42009
|
const response = await api.promoteVersion(version);
|
|
@@ -42260,7 +42044,6 @@ __name(versionPromoteCommand, "versionPromoteCommand");
|
|
|
42260
42044
|
async function versionDeleteCommand(versionArg, options = {}) {
|
|
42261
42045
|
return withErrorHandling(async () => {
|
|
42262
42046
|
const { apiKey, agentId } = await initializeCommand();
|
|
42263
|
-
await assertVersioningEnabled(apiKey, agentId);
|
|
42264
42047
|
if (versionArg === "current" || versionArg === "active") {
|
|
42265
42048
|
throw new Error(`Cannot delete the active version directly. Use \`lua version promote <other>\` to roll back first, then delete.`);
|
|
42266
42049
|
}
|
|
@@ -42566,7 +42349,6 @@ async function pullCommand(options = {}) {
|
|
|
42566
42349
|
const { apiKey, agentId } = await initializeCommand();
|
|
42567
42350
|
const force = Boolean(options.force);
|
|
42568
42351
|
if (options.version) {
|
|
42569
|
-
await assertVersioningEnabled(apiKey, agentId);
|
|
42570
42352
|
const version = parseVersion2(options.version);
|
|
42571
42353
|
const api = new AgentVersionApi(BASE_URLS.API, apiKey, agentId);
|
|
42572
42354
|
const response = await api.getVersion(version);
|
|
@@ -43249,12 +43031,7 @@ Examples:
|
|
|
43249
43031
|
$ lua voice test --runner vitest Force vitest
|
|
43250
43032
|
`).action(voiceTestCommand);
|
|
43251
43033
|
voice.command("list").description("List LuaVoice primitives in the compiled manifest").option("--json", "Output as JSON").action(voiceListCommand);
|
|
43252
|
-
const versionGroup = program2.command("version").description("\u{1F3F7}\uFE0F Manage agent versions \u2014 atomic snapshots
|
|
43253
|
-
Note:
|
|
43254
|
-
All \`lua version\` subcommands require the \`agentVersioningEnabled\`
|
|
43255
|
-
feature flag for your org. If a subcommand errors with "Agent versioning
|
|
43256
|
-
is not enabled," contact your admin to enable it.
|
|
43257
|
-
`);
|
|
43034
|
+
const versionGroup = program2.command("version").description("\u{1F3F7}\uFE0F Manage agent versions \u2014 atomic snapshots of agent state");
|
|
43258
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", `
|
|
43259
43036
|
Examples:
|
|
43260
43037
|
$ lua version create Snapshot current state
|