@moxt-ai/cli 0.12.1 → 0.12.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +42 -14
- package/dist/index.cjs.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -9335,6 +9335,18 @@ var require_ignore = __commonJS({
|
|
|
9335
9335
|
});
|
|
9336
9336
|
|
|
9337
9337
|
// ../machine-connector/dist/runtime/local-codex-runtime/local-file-source.js
|
|
9338
|
+
function unignoreDirectory(rules, rootPath) {
|
|
9339
|
+
for (const rule of rules) {
|
|
9340
|
+
const localPath = relativePortable(rule.base, rootPath);
|
|
9341
|
+
if (localPath === void 0 || localPath === ".")
|
|
9342
|
+
continue;
|
|
9343
|
+
const localSegments = localPath.split("/");
|
|
9344
|
+
for (let index2 = 0; index2 < localSegments.length; index2 += 1) {
|
|
9345
|
+
const directory = localSegments.slice(0, index2 + 1).join("/");
|
|
9346
|
+
rule.matcher.add(`!/${directory}/`);
|
|
9347
|
+
}
|
|
9348
|
+
}
|
|
9349
|
+
}
|
|
9338
9350
|
function resolveWithin(root, input) {
|
|
9339
9351
|
if (input.length === 0 || input.includes("\0") || (0, import_node_path9.isAbsolute)(input) || import_node_path9.win32.isAbsolute(input) || /^[A-Za-z]:/.test(input) || input.split(/[\\/]/).includes("..")) {
|
|
9340
9352
|
throw new Error("Local file path escapes its root");
|
|
@@ -9423,8 +9435,8 @@ var init_local_file_source = __esm({
|
|
|
9423
9435
|
}
|
|
9424
9436
|
async list(relativeDirectory = ".", cursor, requestedLimit = defaultPageSize) {
|
|
9425
9437
|
const limit = clampLimit(requestedLimit);
|
|
9426
|
-
const directory = await this.resolveDirectory(relativeDirectory);
|
|
9427
|
-
const matcher = await this.ignoreMatcher(directory);
|
|
9438
|
+
const directory = await this.resolveDirectory(relativeDirectory, "browsable");
|
|
9439
|
+
const matcher = await this.ignoreMatcher(directory, directory);
|
|
9428
9440
|
const candidates2 = await Promise.all((await (0, import_promises12.readdir)(directory, { withFileTypes: true })).map(async (entry) => {
|
|
9429
9441
|
if (entry.name.includes("\\"))
|
|
9430
9442
|
return void 0;
|
|
@@ -9515,7 +9527,7 @@ var init_local_file_source = __esm({
|
|
|
9515
9527
|
detectSupportedImageType(await (0, import_promises12.readFile)(target));
|
|
9516
9528
|
return entry;
|
|
9517
9529
|
}
|
|
9518
|
-
async resolveDirectory(path4) {
|
|
9530
|
+
async resolveDirectory(path4, visibility = "visible") {
|
|
9519
9531
|
const absolute = resolveWithin(this.workingDirectory, path4);
|
|
9520
9532
|
const directStat = await (0, import_promises12.lstat)(absolute);
|
|
9521
9533
|
if (directStat.isSymbolicLink() || !directStat.isDirectory()) {
|
|
@@ -9523,7 +9535,9 @@ var init_local_file_source = __esm({
|
|
|
9523
9535
|
}
|
|
9524
9536
|
const canonical = await (0, import_promises12.realpath)(absolute);
|
|
9525
9537
|
assertContained(this.workingDirectory, canonical);
|
|
9526
|
-
|
|
9538
|
+
if (visibility === "visible" || isGitPath(portable((0, import_node_path9.relative)(this.pairedRoot, canonical)))) {
|
|
9539
|
+
await this.assertVisible(canonical, "directory");
|
|
9540
|
+
}
|
|
9527
9541
|
return canonical;
|
|
9528
9542
|
}
|
|
9529
9543
|
async resolveFile(path4) {
|
|
@@ -9533,21 +9547,23 @@ var init_local_file_source = __esm({
|
|
|
9533
9547
|
throw new Error("Local file path is not a regular file");
|
|
9534
9548
|
const canonical = await (0, import_promises12.realpath)(absolute);
|
|
9535
9549
|
assertContained(this.workingDirectory, canonical);
|
|
9536
|
-
await this.assertVisible(canonical);
|
|
9550
|
+
await this.assertVisible(canonical, "file");
|
|
9537
9551
|
return canonical;
|
|
9538
9552
|
}
|
|
9539
|
-
async assertVisible(absolute) {
|
|
9553
|
+
async assertVisible(absolute, kind) {
|
|
9540
9554
|
const rootPath = portable((0, import_node_path9.relative)(this.pairedRoot, absolute));
|
|
9541
9555
|
if (rootPath === ".")
|
|
9542
9556
|
return;
|
|
9543
|
-
|
|
9557
|
+
const explicitDirectory = kind === "directory" ? absolute : (0, import_node_path9.dirname)(absolute);
|
|
9558
|
+
if (isGitPath(rootPath) || (await this.ignoreMatcher((0, import_node_path9.dirname)(absolute), explicitDirectory)).ignores(rootPath)) {
|
|
9544
9559
|
throw new Error("Local file path is ignored");
|
|
9545
9560
|
}
|
|
9546
9561
|
}
|
|
9547
|
-
async ignoreMatcher(throughDirectory) {
|
|
9562
|
+
async ignoreMatcher(throughDirectory, explicitDirectory) {
|
|
9548
9563
|
const matchers = [{ base: "", matcher: (0, import_ignore.default)().add(".git/").add(".git/**") }];
|
|
9549
9564
|
const relativeThrough = (0, import_node_path9.relative)(this.pairedRoot, throughDirectory);
|
|
9550
9565
|
const segments = relativeThrough === "" ? [] : relativeThrough.split(import_node_path9.sep);
|
|
9566
|
+
const workingDirectoryRootPath = portable((0, import_node_path9.relative)(this.pairedRoot, this.workingDirectory));
|
|
9551
9567
|
let directory = this.pairedRoot;
|
|
9552
9568
|
for (let index2 = 0; index2 <= segments.length; index2 += 1) {
|
|
9553
9569
|
const matcher = (0, import_ignore.default)();
|
|
@@ -9565,6 +9581,15 @@ var init_local_file_source = __esm({
|
|
|
9565
9581
|
if (segment !== void 0)
|
|
9566
9582
|
directory = (0, import_node_path9.join)(directory, segment);
|
|
9567
9583
|
}
|
|
9584
|
+
const explicitDirectories = [workingDirectoryRootPath];
|
|
9585
|
+
if (explicitDirectory !== void 0) {
|
|
9586
|
+
explicitDirectories.push(portable((0, import_node_path9.relative)(this.pairedRoot, explicitDirectory)));
|
|
9587
|
+
}
|
|
9588
|
+
for (const candidate of new Set(explicitDirectories)) {
|
|
9589
|
+
if (candidate === ".")
|
|
9590
|
+
continue;
|
|
9591
|
+
unignoreDirectory(matchers, candidate);
|
|
9592
|
+
}
|
|
9568
9593
|
return new ScopedIgnoreMatcher(matchers);
|
|
9569
9594
|
}
|
|
9570
9595
|
};
|
|
@@ -9574,6 +9599,9 @@ var init_local_file_source = __esm({
|
|
|
9574
9599
|
this.rules = rules;
|
|
9575
9600
|
}
|
|
9576
9601
|
ignores(rootPath) {
|
|
9602
|
+
return this.evaluate(rootPath);
|
|
9603
|
+
}
|
|
9604
|
+
evaluate(rootPath) {
|
|
9577
9605
|
let ignored = false;
|
|
9578
9606
|
for (const rule of this.rules) {
|
|
9579
9607
|
const localPath = relativePortable(rule.base, rootPath);
|
|
@@ -16607,7 +16635,7 @@ function getApiKeyOrUndefined() {
|
|
|
16607
16635
|
|
|
16608
16636
|
// src/utils/http.ts
|
|
16609
16637
|
function getUserAgent() {
|
|
16610
|
-
return `moxt-cli/${"0.12.
|
|
16638
|
+
return `moxt-cli/${"0.12.3"} (${(0, import_os.platform)()}/${(0, import_os.arch)()}) node/${process.versions.node}`;
|
|
16611
16639
|
}
|
|
16612
16640
|
async function sendRequest(method, path4, init) {
|
|
16613
16641
|
return await fetch(`${getApiBaseUrl()}${path4}`, {
|
|
@@ -31193,7 +31221,7 @@ var FLUSH_TIMEOUT_MS = 3e3;
|
|
|
31193
31221
|
var MAX_BATCH_SIZE = 100;
|
|
31194
31222
|
function commonLabels() {
|
|
31195
31223
|
return {
|
|
31196
|
-
cli_version: "0.12.
|
|
31224
|
+
cli_version: "0.12.3",
|
|
31197
31225
|
node_version: process.versions.node,
|
|
31198
31226
|
os: (0, import_node_os11.platform)(),
|
|
31199
31227
|
arch: (0, import_node_os11.arch)(),
|
|
@@ -31239,7 +31267,7 @@ async function flush() {
|
|
|
31239
31267
|
}
|
|
31240
31268
|
const batch = buffer.splice(0, MAX_BATCH_SIZE);
|
|
31241
31269
|
const payload = {
|
|
31242
|
-
release_id: "0.12.
|
|
31270
|
+
release_id: "0.12.3",
|
|
31243
31271
|
client_type: "cli",
|
|
31244
31272
|
metric_data_list: batch.map((m) => ({
|
|
31245
31273
|
profile: "cli",
|
|
@@ -31622,9 +31650,9 @@ function commandPath3(command) {
|
|
|
31622
31650
|
}
|
|
31623
31651
|
|
|
31624
31652
|
// src/index.ts
|
|
31625
|
-
var program2 = createProgram("0.12.
|
|
31626
|
-
installDaemonReconcileHook(program2, "0.12.
|
|
31627
|
-
installUpdateHook(program2, "0.12.
|
|
31653
|
+
var program2 = createProgram("0.12.3");
|
|
31654
|
+
installDaemonReconcileHook(program2, "0.12.3");
|
|
31655
|
+
installUpdateHook(program2, "0.12.3");
|
|
31628
31656
|
instrumentProgram(program2);
|
|
31629
31657
|
installExitHandler();
|
|
31630
31658
|
program2.parseAsync(process.argv).then(async () => {
|