@swmansion/argent 0.33.1-next.9 → 0.34.1-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/Argent.tracetemplate +0 -0
- package/bin/argent-android-devtools-0.4.0.apk +0 -0
- package/bin/darwin/argent-macos-helper +0 -0
- package/bin/darwin/ax-service +0 -0
- package/bin/darwin/tvos-ax-service +0 -0
- package/bin/darwin/tvos-hid-daemon +0 -0
- package/bin/network-inspector/network-inspector.jar +0 -0
- package/bin/tcp/ax-service +0 -0
- package/dist/cli-cmds.mjs +380 -123
- package/dist/client.js +256 -56
- package/dist/flow-script-runner.mjs +148 -5
- package/dist/installer.mjs +40 -24
- package/dist/ios-device-runner/ArgentRunner/ArgentRunnerUITests/ArgentRunnerSession+Snapshot.swift +110 -4
- package/dist/mcp-server.mjs +330 -68
- package/dist/tool-args.generated.d.ts +22 -20
- package/dist/tool-server.cjs +3763 -2146
- package/dylibs/libArgentInjectionBootstrap.dylib +0 -0
- package/dylibs/libKeyboardPatch.dylib +0 -0
- package/dylibs/libNativeDevtoolsIos.dylib +0 -0
- package/dylibs/macos/libArgentInjectionBootstrap.dylib +0 -0
- package/dylibs/macos/libNativeDevtoolsMacos.dylib +0 -0
- package/dylibs/tcp/libArgentInjectionBootstrap.dylib +0 -0
- package/dylibs/tcp/libKeyboardPatch.dylib +0 -0
- package/dylibs/tcp/libNativeDevtoolsIos.dylib +0 -0
- package/dylibs/tvos/libArgentInjectionBootstrap.dylib +0 -0
- package/dylibs/tvos/libKeyboardPatch.dylib +0 -0
- package/dylibs/tvos/libNativeDevtoolsIos.dylib +0 -0
- package/package.json +2 -3
- package/rules/argent.md +1 -1
- package/skills/argent-create-e2e/references/e2e-yaml.md +11 -1
- package/skills/argent-create-e2e/references/reliability-and-recovery.md +1 -1
- package/skills/argent-device-interact/SKILL.md +2 -2
- package/skills/argent-device-interact/references/harmonyos.md +1 -1
- package/skills/argent-macos-app-interact/SKILL.md +5 -1
- package/skills/argent-native-profiler/SKILL.md +14 -5
- package/skills/argent-react-native-profiler/SKILL.md +7 -0
- package/skills/argent-test-ui-flow/SKILL.md +1 -1
- package/assets/trace-processor/SHA256SUMS +0 -4
- package/assets/trace-processor/engine.mjs +0 -42423
package/dist/cli-cmds.mjs
CHANGED
|
@@ -8794,9 +8794,9 @@ var require_picocolors = __commonJS({
|
|
|
8794
8794
|
var argv = p.argv || [];
|
|
8795
8795
|
var env = p.env || {};
|
|
8796
8796
|
var isColorSupported = !(!!env.NO_COLOR || argv.includes("--no-color")) && (!!env.FORCE_COLOR || argv.includes("--color") || p.platform === "win32" || (p.stdout || {}).isTTY && env.TERM !== "dumb" || !!env.CI);
|
|
8797
|
-
var formatter = (
|
|
8798
|
-
let string4 = "" + input2, index = string4.indexOf(close,
|
|
8799
|
-
return ~index ?
|
|
8797
|
+
var formatter = (open3, close, replace = open3) => (input2) => {
|
|
8798
|
+
let string4 = "" + input2, index = string4.indexOf(close, open3.length);
|
|
8799
|
+
return ~index ? open3 + replaceClose(string4, close, replace, index) + close : open3 + string4 + close;
|
|
8800
8800
|
};
|
|
8801
8801
|
var replaceClose = (string4, close, replace, index) => {
|
|
8802
8802
|
let result = "", cursor3 = 0;
|
|
@@ -9093,7 +9093,7 @@ function spawnToolsServer(paths, port, options = {}) {
|
|
|
9093
9093
|
"error",
|
|
9094
9094
|
(err) => reject(
|
|
9095
9095
|
new Error(
|
|
9096
|
-
err.code === "ENOENT" && nodeBin === "node" ? "Could not start the argent tool-server: `node` was not found on PATH. Install Node.js
|
|
9096
|
+
err.code === "ENOENT" && nodeBin === "node" ? "Could not start the argent tool-server: `node` was not found on PATH. Install Node.js 22.18+ or add it to PATH." : `Could not start the argent tool-server: ${err.message}`
|
|
9097
9097
|
)
|
|
9098
9098
|
)
|
|
9099
9099
|
);
|
|
@@ -10204,7 +10204,10 @@ import { basename, extname } from "node:path";
|
|
|
10204
10204
|
var FLOW_NAME_CHARSET = "[A-Za-z0-9_-]+";
|
|
10205
10205
|
var FLOW_NAME_PATTERN = new RegExp(`^${FLOW_NAME_CHARSET}$`);
|
|
10206
10206
|
var FLOW_FILE_NAME_PATTERN = new RegExp(`^${FLOW_NAME_CHARSET}\\.yaml$`);
|
|
10207
|
-
var
|
|
10207
|
+
var SCRIPT_FILE_EXTENSIONS = [".mjs", ".mts", ".js", ".ts"];
|
|
10208
|
+
var SCRIPT_FILE_NAME_PATTERN = new RegExp(
|
|
10209
|
+
`^${FLOW_NAME_CHARSET}(?:${SCRIPT_FILE_EXTENSIONS.map((ext) => `\\${ext}`).join("|")})$`
|
|
10210
|
+
);
|
|
10208
10211
|
function interpolateFileInputPath(template, args) {
|
|
10209
10212
|
let missing = false;
|
|
10210
10213
|
const out = template.replace(/\$\{([A-Za-z0-9_]+)\}/g, (_m, name) => {
|
|
@@ -10698,6 +10701,9 @@ var FAILURE_CODES = {
|
|
|
10698
10701
|
NATIVE_PROFILER_SESSION_TORN_DOWN: "NATIVE_PROFILER_SESSION_TORN_DOWN",
|
|
10699
10702
|
NATIVE_PROFILER_APP_PROCESS_NOT_FOUND: "NATIVE_PROFILER_APP_PROCESS_NOT_FOUND",
|
|
10700
10703
|
NATIVE_PROFILER_NO_EXPORTED_TRACE: "NATIVE_PROFILER_NO_EXPORTED_TRACE",
|
|
10704
|
+
NATIVE_PROFILER_APP_NOT_DEBUGGABLE: "NATIVE_PROFILER_APP_NOT_DEBUGGABLE",
|
|
10705
|
+
NATIVE_PROFILER_APP_HAS_WEBKIT_HEAP: "NATIVE_PROFILER_APP_HAS_WEBKIT_HEAP",
|
|
10706
|
+
NATIVE_PROFILER_APP_HEAP_CHECK_FAILED: "NATIVE_PROFILER_APP_HEAP_CHECK_FAILED",
|
|
10701
10707
|
// Android perfetto start failures, mirroring the iOS xctrace set above.
|
|
10702
10708
|
NATIVE_PROFILER_PERFETTO_PROCESS_ERROR: "NATIVE_PROFILER_PERFETTO_PROCESS_ERROR",
|
|
10703
10709
|
NATIVE_PROFILER_PERFETTO_READY_TIMEOUT: "NATIVE_PROFILER_PERFETTO_READY_TIMEOUT",
|
|
@@ -10727,6 +10733,8 @@ var FAILURE_CODES = {
|
|
|
10727
10733
|
FLOW_DEVICE_RESOLUTION: "FLOW_DEVICE_RESOLUTION",
|
|
10728
10734
|
// The target does not satisfy the test's `requires:` block; a directory run skips it.
|
|
10729
10735
|
FLOW_REQUIREMENTS_UNMET: "FLOW_REQUIREMENTS_UNMET",
|
|
10736
|
+
// The tool-server's Node.js cannot run a TypeScript `script:` step the test holds.
|
|
10737
|
+
FLOW_SCRIPT_TYPESCRIPT_UNSUPPORTED: "FLOW_SCRIPT_TYPESCRIPT_UNSUPPORTED",
|
|
10730
10738
|
PROFILER_QUERY_MODE_INVALID: "PROFILER_QUERY_MODE_INVALID",
|
|
10731
10739
|
PROFILER_QUERY_REQUIRED_PARAM_MISSING: "PROFILER_QUERY_REQUIRED_PARAM_MISSING",
|
|
10732
10740
|
PROFILER_DATA_NOT_LOADED: "PROFILER_DATA_NOT_LOADED",
|
|
@@ -14899,7 +14907,7 @@ function handleIntersectionResults(result, left, right) {
|
|
|
14899
14907
|
const unrecKeys = /* @__PURE__ */ new Map();
|
|
14900
14908
|
let unrecIssue;
|
|
14901
14909
|
const keyIssues = /* @__PURE__ */ new Map();
|
|
14902
|
-
const
|
|
14910
|
+
const collect2 = (iss, side) => {
|
|
14903
14911
|
let keys;
|
|
14904
14912
|
if (iss.code === "unrecognized_keys" && !iss.path?.length) {
|
|
14905
14913
|
unrecIssue ?? (unrecIssue = iss);
|
|
@@ -14920,11 +14928,11 @@ function handleIntersectionResults(result, left, right) {
|
|
|
14920
14928
|
return true;
|
|
14921
14929
|
};
|
|
14922
14930
|
for (const iss of left.issues) {
|
|
14923
|
-
if (!
|
|
14931
|
+
if (!collect2(iss, "l"))
|
|
14924
14932
|
result.issues.push(iss);
|
|
14925
14933
|
}
|
|
14926
14934
|
for (const iss of right.issues) {
|
|
14927
|
-
if (!
|
|
14935
|
+
if (!collect2(iss, "r"))
|
|
14928
14936
|
result.issues.push(iss);
|
|
14929
14937
|
}
|
|
14930
14938
|
const bothKeys = [...unrecKeys].filter(([, f]) => f.l && f.r).map(([k]) => k);
|
|
@@ -30770,7 +30778,7 @@ function parseLinkTarget(input2) {
|
|
|
30770
30778
|
|
|
30771
30779
|
// ../argent-tools-client/src/file-inputs.ts
|
|
30772
30780
|
import { createHash as createHash2, randomUUID as randomUUID4 } from "node:crypto";
|
|
30773
|
-
import { createReadStream, rmSync as rmSync2 } from "node:fs";
|
|
30781
|
+
import { createReadStream as createReadStream2, rmSync as rmSync2 } from "node:fs";
|
|
30774
30782
|
import {
|
|
30775
30783
|
chmod as chmod3,
|
|
30776
30784
|
lstat,
|
|
@@ -30786,50 +30794,234 @@ import { constants, tmpdir } from "node:os";
|
|
|
30786
30794
|
import * as path10 from "node:path";
|
|
30787
30795
|
|
|
30788
30796
|
// ../archive/src/index.ts
|
|
30789
|
-
import {
|
|
30790
|
-
import {
|
|
30791
|
-
import {
|
|
30792
|
-
import {
|
|
30793
|
-
|
|
30797
|
+
import { spawn as spawn2 } from "node:child_process";
|
|
30798
|
+
import { once } from "node:events";
|
|
30799
|
+
import { createReadStream, createWriteStream } from "node:fs";
|
|
30800
|
+
import { open as open2, rm, readdir as readdir3 } from "node:fs/promises";
|
|
30801
|
+
import { basename as basename4, dirname as dirname5, join as join9, resolve as resolve6, sep as sep2 } from "node:path";
|
|
30802
|
+
import { Writable } from "node:stream";
|
|
30803
|
+
import { pipeline } from "node:stream/promises";
|
|
30804
|
+
import zlib from "node:zlib";
|
|
30794
30805
|
var ArchiveError = class extends Error {
|
|
30795
30806
|
};
|
|
30796
|
-
function
|
|
30797
|
-
|
|
30807
|
+
var ARCHIVE_FORMATS = typeof zlib.createZstdCompress === "function" ? ["zstd", "gzip"] : ["gzip"];
|
|
30808
|
+
var ARCHIVE_CONTENT_TYPES = {
|
|
30809
|
+
zstd: "application/zstd",
|
|
30810
|
+
gzip: "application/gzip"
|
|
30811
|
+
};
|
|
30812
|
+
function pickArchiveFormat(peerFormats) {
|
|
30813
|
+
return ARCHIVE_FORMATS.find((f) => peerFormats?.includes(f)) ?? "gzip";
|
|
30814
|
+
}
|
|
30815
|
+
var CHUNK_BYTES = 1 << 20;
|
|
30816
|
+
function createCompressor(format) {
|
|
30817
|
+
return format === "zstd" ? zlib.createZstdCompress({
|
|
30818
|
+
chunkSize: CHUNK_BYTES,
|
|
30819
|
+
// Lets the decoder detect corruption.
|
|
30820
|
+
params: { [zlib.constants.ZSTD_c_checksumFlag]: 1 }
|
|
30821
|
+
}) : zlib.createGzip({ chunkSize: CHUNK_BYTES });
|
|
30822
|
+
}
|
|
30823
|
+
function createTarArgs(sourcePath) {
|
|
30824
|
+
const name = basename4(sourcePath);
|
|
30825
|
+
return ["-cf", "-", "-C", dirname5(sourcePath), /^[-@]/.test(name) ? `./${name}` : name];
|
|
30826
|
+
}
|
|
30827
|
+
var MAX_LISTING_BYTES = 32 << 20;
|
|
30828
|
+
var MAX_LISTING_LINES = 1 << 18;
|
|
30829
|
+
var MAX_STDERR_BYTES = 16 << 10;
|
|
30830
|
+
var MAX_UNREAD_BYTES = 16 << 20;
|
|
30831
|
+
function collect(stream, maxBytes, { maxLines = Infinity, onOverflow } = {}) {
|
|
30832
|
+
const chunks = [];
|
|
30833
|
+
let bytes = 0;
|
|
30834
|
+
let lines = 0;
|
|
30835
|
+
let overflowed = false;
|
|
30836
|
+
stream?.on("data", (chunk) => {
|
|
30837
|
+
if (overflowed) return;
|
|
30838
|
+
chunks.push(chunk.subarray(0, maxBytes - bytes));
|
|
30839
|
+
bytes += chunk.length;
|
|
30840
|
+
for (let i2 = chunk.indexOf(10); i2 !== -1 && lines <= maxLines; i2 = chunk.indexOf(10, i2 + 1)) {
|
|
30841
|
+
lines++;
|
|
30842
|
+
}
|
|
30843
|
+
if (bytes > maxBytes || lines > maxLines) {
|
|
30844
|
+
overflowed = true;
|
|
30845
|
+
onOverflow?.();
|
|
30846
|
+
}
|
|
30847
|
+
});
|
|
30848
|
+
return {
|
|
30849
|
+
overflowed: () => overflowed,
|
|
30850
|
+
text: () => Buffer.concat(chunks).toString("utf8") + (overflowed ? "\u2026" : "")
|
|
30851
|
+
};
|
|
30798
30852
|
}
|
|
30799
|
-
async function
|
|
30853
|
+
async function createArchiveFile(sourcePath, archivePath, format, signal) {
|
|
30854
|
+
const out = createWriteStream(archivePath);
|
|
30855
|
+
await once(out, "ready");
|
|
30800
30856
|
try {
|
|
30801
|
-
await
|
|
30857
|
+
await archiveInto(out, sourcePath, format, signal);
|
|
30802
30858
|
} catch (err) {
|
|
30803
|
-
|
|
30859
|
+
out.destroy();
|
|
30860
|
+
await rm(archivePath, { force: true }).catch(() => {
|
|
30804
30861
|
});
|
|
30862
|
+
signal?.throwIfAborted();
|
|
30805
30863
|
throw err;
|
|
30806
30864
|
}
|
|
30807
30865
|
}
|
|
30866
|
+
async function archiveInto(out, sourcePath, format, signal) {
|
|
30867
|
+
const child = spawn2("tar", createTarArgs(sourcePath), {
|
|
30868
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
30869
|
+
signal
|
|
30870
|
+
});
|
|
30871
|
+
const exited = new Promise((res, rej) => {
|
|
30872
|
+
child.on("error", rej);
|
|
30873
|
+
child.on("close", res);
|
|
30874
|
+
});
|
|
30875
|
+
const stderr = collect(child.stderr, MAX_STDERR_BYTES);
|
|
30876
|
+
const [written, closed] = await Promise.allSettled([
|
|
30877
|
+
pipeline(child.stdout, createCompressor(format), out),
|
|
30878
|
+
exited
|
|
30879
|
+
]);
|
|
30880
|
+
if (closed.status === "rejected") throw closed.reason;
|
|
30881
|
+
if (written.status === "rejected") throw written.reason;
|
|
30882
|
+
if (closed.value !== 0) {
|
|
30883
|
+
throw new Error(`tar exited with code ${closed.value}: ${stderr.text().trim()}`);
|
|
30884
|
+
}
|
|
30885
|
+
}
|
|
30886
|
+
async function sniffFormat(archivePath) {
|
|
30887
|
+
const fh = await open2(archivePath, "r");
|
|
30888
|
+
try {
|
|
30889
|
+
const { buffer, bytesRead } = await fh.read(Buffer.alloc(4), 0, 4, 0);
|
|
30890
|
+
const magic = buffer.subarray(0, bytesRead).toString("hex");
|
|
30891
|
+
if (magic.startsWith("1f8b")) return "gzip";
|
|
30892
|
+
if (magic === "28b52ffd" && ARCHIVE_FORMATS.includes("zstd")) return "zstd";
|
|
30893
|
+
throw new ArchiveError("unrecognized compression");
|
|
30894
|
+
} finally {
|
|
30895
|
+
await fh.close();
|
|
30896
|
+
}
|
|
30897
|
+
}
|
|
30898
|
+
var ZSTD_FRAME_MAGIC = 4247762216;
|
|
30899
|
+
async function assertSingleCompleteZstdFrame(archivePath) {
|
|
30900
|
+
const fh = await open2(archivePath, "r");
|
|
30901
|
+
try {
|
|
30902
|
+
const { size } = await fh.stat();
|
|
30903
|
+
const window2 = Buffer.alloc(4096);
|
|
30904
|
+
let windowStart = 0;
|
|
30905
|
+
let windowEnd = 0;
|
|
30906
|
+
let pos = 0;
|
|
30907
|
+
const read = async (n3) => {
|
|
30908
|
+
if (pos < windowStart || pos + n3 > windowEnd) {
|
|
30909
|
+
const { bytesRead } = await fh.read(window2, 0, window2.length, pos);
|
|
30910
|
+
windowStart = pos;
|
|
30911
|
+
windowEnd = pos + bytesRead;
|
|
30912
|
+
if (bytesRead < n3) throw new ArchiveError("truncated zstd frame");
|
|
30913
|
+
}
|
|
30914
|
+
return window2.subarray(pos - windowStart, pos - windowStart + n3);
|
|
30915
|
+
};
|
|
30916
|
+
for (let frame = 0; pos < size; frame++) {
|
|
30917
|
+
const header = await read(5);
|
|
30918
|
+
if (header.readUInt32LE(0) !== ZSTD_FRAME_MAGIC) throw new ArchiveError("bad zstd frame");
|
|
30919
|
+
const descriptor = header[4];
|
|
30920
|
+
const singleSegment = descriptor >> 5 & 1;
|
|
30921
|
+
pos += 5 + (singleSegment ? 0 : 1) + // window descriptor
|
|
30922
|
+
[0, 1, 2, 4][descriptor & 3] + // dictionary id
|
|
30923
|
+
[singleSegment, 2, 4, 8][descriptor >> 6];
|
|
30924
|
+
let hasData = false;
|
|
30925
|
+
for (let last = 0; !last; ) {
|
|
30926
|
+
const block2 = (await read(3)).readUIntLE(0, 3);
|
|
30927
|
+
last = block2 & 1;
|
|
30928
|
+
const type = block2 >> 1 & 3;
|
|
30929
|
+
const blockSize = block2 >> 3;
|
|
30930
|
+
if (blockSize > 0) hasData = true;
|
|
30931
|
+
pos += 3 + (type === 1 ? 1 : blockSize);
|
|
30932
|
+
}
|
|
30933
|
+
if (descriptor >> 2 & 1) pos += 4;
|
|
30934
|
+
if (hasData && frame > 0) throw new ArchiveError("multi-frame zstd");
|
|
30935
|
+
}
|
|
30936
|
+
if (pos !== size) throw new ArchiveError("truncated zstd frame");
|
|
30937
|
+
} finally {
|
|
30938
|
+
await fh.close();
|
|
30939
|
+
}
|
|
30940
|
+
}
|
|
30941
|
+
var TAR_LOCALE = process.platform === "darwin" ? "en_US.UTF-8" : "C.UTF-8";
|
|
30942
|
+
function tarEnv(env) {
|
|
30943
|
+
const characterType = env.LC_ALL || env.LC_CTYPE || env.LANG || "";
|
|
30944
|
+
return /utf-?8/i.test(characterType) ? env : { ...env, LC_ALL: TAR_LOCALE };
|
|
30945
|
+
}
|
|
30946
|
+
async function runTar(archive, args) {
|
|
30947
|
+
const child = spawn2("tar", [...args, "-f", "-"], {
|
|
30948
|
+
env: tarEnv(process.env)
|
|
30949
|
+
});
|
|
30950
|
+
const exited = new Promise((res, rej) => {
|
|
30951
|
+
child.on("error", rej);
|
|
30952
|
+
child.on("close", res);
|
|
30953
|
+
});
|
|
30954
|
+
const stdout2 = collect(child.stdout, MAX_LISTING_BYTES, {
|
|
30955
|
+
maxLines: MAX_LISTING_LINES,
|
|
30956
|
+
onOverflow: () => child.kill()
|
|
30957
|
+
});
|
|
30958
|
+
const stderr = collect(child.stderr, MAX_STDERR_BYTES);
|
|
30959
|
+
child.stdin?.on("error", () => {
|
|
30960
|
+
});
|
|
30961
|
+
const unreadLimit = new Error("unread limit");
|
|
30962
|
+
let unread = 0;
|
|
30963
|
+
const fed = pipeline(
|
|
30964
|
+
createReadStream(archive.path, { highWaterMark: CHUNK_BYTES }),
|
|
30965
|
+
archive.format === "zstd" ? zlib.createZstdDecompress({ chunkSize: CHUNK_BYTES }) : zlib.createGunzip({ chunkSize: CHUNK_BYTES }),
|
|
30966
|
+
new Writable({
|
|
30967
|
+
write(chunk, _encoding, done) {
|
|
30968
|
+
if (child.stdin?.writable) return void child.stdin.write(chunk, () => done());
|
|
30969
|
+
unread += chunk.length;
|
|
30970
|
+
done(unread > MAX_UNREAD_BYTES ? unreadLimit : null);
|
|
30971
|
+
},
|
|
30972
|
+
final(done) {
|
|
30973
|
+
child.stdin?.end();
|
|
30974
|
+
done();
|
|
30975
|
+
},
|
|
30976
|
+
destroy(err, done) {
|
|
30977
|
+
if (err) child.stdin?.destroy();
|
|
30978
|
+
done(err);
|
|
30979
|
+
}
|
|
30980
|
+
})
|
|
30981
|
+
).then(
|
|
30982
|
+
() => null,
|
|
30983
|
+
(err) => err
|
|
30984
|
+
);
|
|
30985
|
+
const [code, feedError] = await Promise.all([exited, fed]);
|
|
30986
|
+
if (stdout2.overflowed()) {
|
|
30987
|
+
throw new Error(
|
|
30988
|
+
`tar ${args.join(" ")} listed more than ${MAX_LISTING_LINES} members or ${MAX_LISTING_BYTES >> 20} MiB`
|
|
30989
|
+
);
|
|
30990
|
+
}
|
|
30991
|
+
if (feedError && feedError !== unreadLimit) throw feedError;
|
|
30992
|
+
if (code !== 0)
|
|
30993
|
+
throw new Error(`tar ${args.join(" ")} exited with code ${code}: ${stderr.text().trim()}`);
|
|
30994
|
+
return stdout2.text();
|
|
30995
|
+
}
|
|
30808
30996
|
function normalizeTarMemberPath(memberPath) {
|
|
30809
30997
|
return memberPath.replace(/^\.\//, "").replace(/\\/g, "/");
|
|
30810
30998
|
}
|
|
30999
|
+
function isContainedPath(path25, windows = process.platform === "win32") {
|
|
31000
|
+
const slashed = path25.replace(/\\/g, "/");
|
|
31001
|
+
const drive = windows ? /^[A-Za-z]:/ : /^[A-Za-z]:\//;
|
|
31002
|
+
return !slashed.startsWith("/") && !drive.test(slashed) && !slashed.split("/").includes("..");
|
|
31003
|
+
}
|
|
30811
31004
|
function isSafeTarMember(memberPath, destDir) {
|
|
30812
31005
|
const normalized = normalizeTarMemberPath(memberPath);
|
|
30813
|
-
if (!normalized
|
|
30814
|
-
if (normalized.startsWith("/") || /^[A-Za-z]:[\\/]/.test(normalized)) return false;
|
|
30815
|
-
const relative3 = posix2.normalize(normalized);
|
|
30816
|
-
if (relative3 === ".." || relative3.startsWith("../") || relative3.split("/").includes("..")) {
|
|
30817
|
-
return false;
|
|
30818
|
-
}
|
|
31006
|
+
if (!isContainedPath(normalized)) return false;
|
|
30819
31007
|
const root = resolve6(destDir);
|
|
30820
|
-
|
|
30821
|
-
return resolved === root || resolved.startsWith(root + sep2);
|
|
31008
|
+
return resolve6(destDir, normalized).startsWith(root + sep2);
|
|
30822
31009
|
}
|
|
30823
|
-
async function
|
|
30824
|
-
|
|
30825
|
-
|
|
31010
|
+
async function readListing(archive, args) {
|
|
31011
|
+
try {
|
|
31012
|
+
return await runTar(archive, args);
|
|
31013
|
+
} catch (err) {
|
|
31014
|
+
throw new ArchiveError(
|
|
31015
|
+
`Could not read archive: ${err instanceof Error ? err.message : String(err)}`
|
|
31016
|
+
);
|
|
31017
|
+
}
|
|
30826
31018
|
}
|
|
30827
|
-
function
|
|
30828
|
-
|
|
30829
|
-
return
|
|
31019
|
+
async function listTarMembers(archive) {
|
|
31020
|
+
const stdout2 = await readListing(archive, ["-t"]);
|
|
31021
|
+
return stdout2.split("\n").map((line) => line.trim()).filter((line) => line.length > 0);
|
|
30830
31022
|
}
|
|
30831
|
-
async function assertSafeMemberTypes(
|
|
30832
|
-
const
|
|
31023
|
+
async function assertSafeMemberTypes(archive) {
|
|
31024
|
+
const stdout2 = await readListing(archive, ["-tv"]);
|
|
30833
31025
|
for (const line of stdout2.split("\n")) {
|
|
30834
31026
|
if (!line.trim()) continue;
|
|
30835
31027
|
const type = line[0];
|
|
@@ -30837,7 +31029,7 @@ async function assertSafeMemberTypes(tarPath) {
|
|
|
30837
31029
|
if (type === "l") {
|
|
30838
31030
|
const parts = line.split(" -> ");
|
|
30839
31031
|
const target = parts.length === 2 ? parts[1].trim() : "";
|
|
30840
|
-
if (parts.length !== 2 || !target ||
|
|
31032
|
+
if (parts.length !== 2 || !target || !isContainedPath(target)) {
|
|
30841
31033
|
throw new ArchiveError(
|
|
30842
31034
|
`Archive contains a symlink whose target could not be confirmed safe: "${line.trim()}".`
|
|
30843
31035
|
);
|
|
@@ -30849,15 +31041,8 @@ async function assertSafeMemberTypes(tarPath) {
|
|
|
30849
31041
|
);
|
|
30850
31042
|
}
|
|
30851
31043
|
}
|
|
30852
|
-
async function assertSafeArchive(
|
|
30853
|
-
|
|
30854
|
-
try {
|
|
30855
|
-
members2 = await listTarMembers(tarPath);
|
|
30856
|
-
} catch (err) {
|
|
30857
|
-
throw new ArchiveError(
|
|
30858
|
-
`Could not read archive: ${err instanceof Error ? err.message : String(err)}`
|
|
30859
|
-
);
|
|
30860
|
-
}
|
|
31044
|
+
async function assertSafeArchive(archive, destDir) {
|
|
31045
|
+
const members2 = await listTarMembers(archive);
|
|
30861
31046
|
if (members2.length === 0) {
|
|
30862
31047
|
throw new ArchiveError("Archive is empty.");
|
|
30863
31048
|
}
|
|
@@ -30866,7 +31051,7 @@ async function assertSafeArchive(tarPath, destDir) {
|
|
|
30866
31051
|
throw new ArchiveError(`Archive contains an unsafe path "${member}" \u2014 refusing extraction.`);
|
|
30867
31052
|
}
|
|
30868
31053
|
}
|
|
30869
|
-
await assertSafeMemberTypes(
|
|
31054
|
+
await assertSafeMemberTypes(archive);
|
|
30870
31055
|
}
|
|
30871
31056
|
async function resolveMember(destDir, expectedName) {
|
|
30872
31057
|
const entries = await readdir3(destDir);
|
|
@@ -30881,9 +31066,18 @@ async function resolveMember(destDir, expectedName) {
|
|
|
30881
31066
|
}
|
|
30882
31067
|
return join9(destDir, real[0]);
|
|
30883
31068
|
}
|
|
30884
|
-
async function
|
|
30885
|
-
|
|
30886
|
-
|
|
31069
|
+
async function safeExtractArchive(archivePath, destDir, expectedName) {
|
|
31070
|
+
let archive;
|
|
31071
|
+
try {
|
|
31072
|
+
archive = { path: archivePath, format: await sniffFormat(archivePath) };
|
|
31073
|
+
if (archive.format === "zstd") await assertSingleCompleteZstdFrame(archivePath);
|
|
31074
|
+
} catch (err) {
|
|
31075
|
+
throw new ArchiveError(
|
|
31076
|
+
`Could not read archive: ${err instanceof Error ? err.message : String(err)}`
|
|
31077
|
+
);
|
|
31078
|
+
}
|
|
31079
|
+
await assertSafeArchive(archive, destDir);
|
|
31080
|
+
await runTar(archive, ["-x", "-C", destDir]);
|
|
30887
31081
|
return resolveMember(destDir, expectedName);
|
|
30888
31082
|
}
|
|
30889
31083
|
|
|
@@ -30964,7 +31158,7 @@ function untrackArchive(archive) {
|
|
|
30964
31158
|
function sha256File(filePath) {
|
|
30965
31159
|
return new Promise((resolve13, reject) => {
|
|
30966
31160
|
const hash2 = createHash2("sha256");
|
|
30967
|
-
|
|
31161
|
+
createReadStream2(filePath).on("data", (chunk) => hash2.update(chunk)).on("end", () => resolve13(hash2.digest("hex"))).on("error", reject);
|
|
30968
31162
|
});
|
|
30969
31163
|
}
|
|
30970
31164
|
function toolServerError(text2) {
|
|
@@ -30990,15 +31184,15 @@ function uploadFailure(url2, res, text2, bytes) {
|
|
|
30990
31184
|
errorKind: "validation"
|
|
30991
31185
|
});
|
|
30992
31186
|
}
|
|
30993
|
-
async function uploadTar(tarPath, endpoint, signal) {
|
|
31187
|
+
async function uploadTar(tarPath, format, endpoint, signal) {
|
|
30994
31188
|
const { size } = await stat3(tarPath);
|
|
30995
31189
|
const init2 = {
|
|
30996
31190
|
method: "POST",
|
|
30997
31191
|
headers: {
|
|
30998
|
-
"content-type":
|
|
31192
|
+
"content-type": ARCHIVE_CONTENT_TYPES[format],
|
|
30999
31193
|
...endpoint.token ? { Authorization: `Bearer ${endpoint.token}` } : {}
|
|
31000
31194
|
},
|
|
31001
|
-
body:
|
|
31195
|
+
body: createReadStream2(tarPath),
|
|
31002
31196
|
duplex: "half",
|
|
31003
31197
|
signal
|
|
31004
31198
|
};
|
|
@@ -31015,12 +31209,13 @@ async function uploadTar(tarPath, endpoint, signal) {
|
|
|
31015
31209
|
return json2.uploadId;
|
|
31016
31210
|
}
|
|
31017
31211
|
async function uploadFile(sourcePath, endpoint, signal) {
|
|
31212
|
+
const format = pickArchiveFormat(endpoint.formats);
|
|
31018
31213
|
const tarPath = path10.join(tmpdir(), `argent-upload-${randomUUID4()}.tar.gz`);
|
|
31019
31214
|
trackArchive(tarPath);
|
|
31020
31215
|
try {
|
|
31021
|
-
await
|
|
31216
|
+
await createArchiveFile(await realpath2(sourcePath), tarPath, format, signal);
|
|
31022
31217
|
const contentHash = await sha256File(tarPath);
|
|
31023
|
-
return { uploadId: await uploadTar(tarPath, endpoint, signal), contentHash };
|
|
31218
|
+
return { uploadId: await uploadTar(tarPath, format, endpoint, signal), contentHash };
|
|
31024
31219
|
} finally {
|
|
31025
31220
|
untrackArchive(tarPath);
|
|
31026
31221
|
await rm2(tarPath, { force: true }).catch(() => {
|
|
@@ -31875,7 +32070,7 @@ function createToolsClient(options = {}) {
|
|
|
31875
32070
|
const { url: url2, token } = await route();
|
|
31876
32071
|
return { url: url2, token };
|
|
31877
32072
|
}
|
|
31878
|
-
async function
|
|
32073
|
+
async function fetchToolList(opts) {
|
|
31879
32074
|
opts?.signal?.throwIfAborted();
|
|
31880
32075
|
const { url: url2, token } = await baseUrl();
|
|
31881
32076
|
const res = await doFetch(
|
|
@@ -31884,8 +32079,10 @@ function createToolsClient(options = {}) {
|
|
|
31884
32079
|
{ longRunning: false, carriesUpload: false }
|
|
31885
32080
|
);
|
|
31886
32081
|
if (!res.ok) throw new Error(`GET /tools failed: ${res.status} ${res.statusText}`);
|
|
31887
|
-
|
|
31888
|
-
|
|
32082
|
+
return await res.json();
|
|
32083
|
+
}
|
|
32084
|
+
async function fetchTools(opts) {
|
|
32085
|
+
return (await fetchToolList(opts)).tools;
|
|
31889
32086
|
}
|
|
31890
32087
|
async function fetchTool(name, opts) {
|
|
31891
32088
|
return findTool(await fetchTools(opts), name);
|
|
@@ -31894,7 +32091,7 @@ function createToolsClient(options = {}) {
|
|
|
31894
32091
|
opts?.signal?.throwIfAborted();
|
|
31895
32092
|
const { url: url2, token, remote } = await route();
|
|
31896
32093
|
let finalArgs = canonicalToolArgs(name, args);
|
|
31897
|
-
const tools2 = await
|
|
32094
|
+
const { tools: tools2, uploadFormats } = await fetchToolList({ signal: opts?.signal });
|
|
31898
32095
|
const meta3 = findTool(tools2, name);
|
|
31899
32096
|
const olderServer = meta3 !== null && !tools2.some((t2) => t2.name === canonicalToolId(meta3.name));
|
|
31900
32097
|
if (meta3) {
|
|
@@ -31911,7 +32108,7 @@ function createToolsClient(options = {}) {
|
|
|
31911
32108
|
if (remote) assertRequiredPresent(meta3, finalArgs);
|
|
31912
32109
|
finalArgs = await prepareFileInputs(meta3.fileInputs, finalArgs ?? {}, {
|
|
31913
32110
|
includeContent: remote,
|
|
31914
|
-
uploadEndpoint: remote ? { url: url2, token } : void 0,
|
|
32111
|
+
uploadEndpoint: remote ? { url: url2, token, formats: uploadFormats } : void 0,
|
|
31915
32112
|
log: diagnose,
|
|
31916
32113
|
baselineDirs,
|
|
31917
32114
|
collectMembers: collectFlowMembers,
|
|
@@ -32208,7 +32405,7 @@ async function downloadAndExtractArchive(handle, data, dir) {
|
|
|
32208
32405
|
const tarball = join13(dir, `${sanitizeSegment(handle.filename)}.tar.gz`);
|
|
32209
32406
|
try {
|
|
32210
32407
|
await writeFile4(tarball, data);
|
|
32211
|
-
return await
|
|
32408
|
+
return await safeExtractArchive(tarball, dir, handle.filename);
|
|
32212
32409
|
} catch {
|
|
32213
32410
|
return null;
|
|
32214
32411
|
} finally {
|
|
@@ -32287,7 +32484,10 @@ async function materializeArtifacts(result, ctx) {
|
|
|
32287
32484
|
}
|
|
32288
32485
|
try {
|
|
32289
32486
|
const res = await fetchFn(`${ctx.toolsUrl}/artifacts/${value.id}`, {
|
|
32290
|
-
headers:
|
|
32487
|
+
headers: value.archive ? {
|
|
32488
|
+
...authHeaders3,
|
|
32489
|
+
Accept: ARCHIVE_FORMATS.map((f) => ARCHIVE_CONTENT_TYPES[f]).join(", ")
|
|
32490
|
+
} : authHeaders3,
|
|
32291
32491
|
signal: ctx.signal
|
|
32292
32492
|
});
|
|
32293
32493
|
if (!res.ok) return null;
|
|
@@ -34437,7 +34637,7 @@ function getNodeHttpConfigurationDefaults(requiredHeaders, signalResourcePath) {
|
|
|
34437
34637
|
}
|
|
34438
34638
|
|
|
34439
34639
|
// ../../node_modules/@opentelemetry/otlp-exporter-base/build/esm/transport/http-transport-utils.js
|
|
34440
|
-
import * as
|
|
34640
|
+
import * as zlib2 from "zlib";
|
|
34441
34641
|
import { Readable } from "stream";
|
|
34442
34642
|
|
|
34443
34643
|
// ../../node_modules/@opentelemetry/otlp-exporter-base/build/esm/is-export-retryable.js
|
|
@@ -34558,7 +34758,7 @@ function compressAndSend(req, compression, data, onError) {
|
|
|
34558
34758
|
let dataStream = readableFromUint8Array(data);
|
|
34559
34759
|
if (compression === "gzip") {
|
|
34560
34760
|
req.setHeader("Content-Encoding", "gzip");
|
|
34561
|
-
dataStream = dataStream.on("error", onError).pipe(
|
|
34761
|
+
dataStream = dataStream.on("error", onError).pipe(zlib2.createGzip()).on("error", onError);
|
|
34562
34762
|
}
|
|
34563
34763
|
dataStream.pipe(req).on("error", onError);
|
|
34564
34764
|
}
|
|
@@ -35872,7 +36072,7 @@ var _CI_VENDOR_COUNT_FOR_TEST = vendors_default.length;
|
|
|
35872
36072
|
var SESSION_ID2 = randomUUID5();
|
|
35873
36073
|
function readCliVersion() {
|
|
35874
36074
|
if (true) {
|
|
35875
|
-
return "0.
|
|
36075
|
+
return "0.34.1-next.0";
|
|
35876
36076
|
}
|
|
35877
36077
|
return "0.0.0";
|
|
35878
36078
|
}
|
|
@@ -36127,7 +36327,7 @@ function tryReadId(filePath) {
|
|
|
36127
36327
|
}
|
|
36128
36328
|
|
|
36129
36329
|
// ../telemetry/src/fingerprint.ts
|
|
36130
|
-
import { execFileSync as execFileSync2, spawn as
|
|
36330
|
+
import { execFileSync as execFileSync2, spawn as spawn3 } from "node:child_process";
|
|
36131
36331
|
|
|
36132
36332
|
// ../native-devtools-ios/src/index.ts
|
|
36133
36333
|
import * as path16 from "node:path";
|
|
@@ -36205,7 +36405,7 @@ function resolveHostFingerprintAsync() {
|
|
|
36205
36405
|
const watchdog = setTimeout(() => finish(null), FINGERPRINT_TIMEOUT_MS);
|
|
36206
36406
|
watchdog.unref?.();
|
|
36207
36407
|
try {
|
|
36208
|
-
child =
|
|
36408
|
+
child = spawn3(binary, ["fingerprint"], { stdio: ["ignore", "pipe", "ignore"] });
|
|
36209
36409
|
} catch {
|
|
36210
36410
|
finish(null);
|
|
36211
36411
|
return;
|
|
@@ -36947,11 +37147,12 @@ A directory run prints only the steps that need attention (each failure, each
|
|
|
36947
37147
|
warning, and each script step's output), then its outcome. After the last test
|
|
36948
37148
|
it lists every failed test with its reason and a command that re-runs that test
|
|
36949
37149
|
alone, then a final summary; --recursive walks subdirectories too
|
|
36950
|
-
(dot-directories
|
|
36951
|
-
keeps the batch running, as does one the
|
|
36952
|
-
file, or a device it cannot resolve. A
|
|
36953
|
-
does not mark as validation, or a
|
|
36954
|
-
counts the remaining tests
|
|
37150
|
+
(__baselines__, node_modules and dot-directories other than .argent are
|
|
37151
|
+
skipped). A test that fails its steps keeps the batch running, as does one the
|
|
37152
|
+
server rejects up front \u2014 an invalid file, or a device it cannot resolve. A
|
|
37153
|
+
transport failure, a rejection the server does not mark as validation, or a
|
|
37154
|
+
reply that is not a report stops the batch and counts the remaining tests
|
|
37155
|
+
skipped.
|
|
36955
37156
|
|
|
36956
37157
|
A test can declare a \`requires:\` block (platform, runtimeKind) that names the
|
|
36957
37158
|
targets it supports. A directory run skips each test whose requirements the
|
|
@@ -36983,8 +37184,12 @@ Subcommands:
|
|
|
36983
37184
|
run <test|test.yaml|dir> Run a saved e2e test by name, a YAML file by path,
|
|
36984
37185
|
or every test in a directory, and report pass/fail
|
|
36985
37186
|
(exit reflects result)
|
|
36986
|
-
list
|
|
36987
|
-
|
|
37187
|
+
list [dir] [-r] [--json] List runnable YAML paths in dir (-r: also in its
|
|
37188
|
+
subdirectories), or in .argent/e2e and
|
|
37189
|
+
.argent/flows (legacy) with notes on stderr.
|
|
37190
|
+
--json prints { "e2eTests": [...] } instead, with
|
|
37191
|
+
path per entry, plus name, legacy and shadowedBy
|
|
37192
|
+
when no dir is given
|
|
36988
37193
|
|
|
36989
37194
|
Options (run):
|
|
36990
37195
|
--device <id> Device id to run against (auto-detected when omitted)
|
|
@@ -37026,6 +37231,10 @@ var RUN_OPTIONS = {
|
|
|
37026
37231
|
"platform": { kind: "value" },
|
|
37027
37232
|
"output": { kind: "value" }
|
|
37028
37233
|
};
|
|
37234
|
+
var LIST_OPTIONS = {
|
|
37235
|
+
json: { kind: "boolean" },
|
|
37236
|
+
recursive: { kind: "boolean", alias: "r" }
|
|
37237
|
+
};
|
|
37029
37238
|
function parseRunArgs(argv) {
|
|
37030
37239
|
let parsed;
|
|
37031
37240
|
try {
|
|
@@ -37180,8 +37389,11 @@ function shellQuoteArg(arg) {
|
|
|
37180
37389
|
if (SHELL_SAFE_ARG.test(arg)) return arg;
|
|
37181
37390
|
return `'${arg.replaceAll("'", "'\\''")}'`;
|
|
37182
37391
|
}
|
|
37392
|
+
function optionSafePath(p) {
|
|
37393
|
+
return p.startsWith("-") ? `.${path17.sep}${p}` : p;
|
|
37394
|
+
}
|
|
37183
37395
|
function rerunCommand(flowPath, rel, projectRoot, args) {
|
|
37184
|
-
const pathArg = (p) => shellQuoteArg(
|
|
37396
|
+
const pathArg = (p) => shellQuoteArg(optionSafePath(p));
|
|
37185
37397
|
const fromCwd = path17.relative(projectRoot, flowPath);
|
|
37186
37398
|
const shown = path17.isAbsolute(fromCwd) || fromCwd.split(/[\\/]+/).includes("..") ? flowPath : fromCwd;
|
|
37187
37399
|
const parts = ["argent e2e run", pathArg(shown)];
|
|
@@ -37378,24 +37590,6 @@ async function isRunnableFlowFile(filePath) {
|
|
|
37378
37590
|
return false;
|
|
37379
37591
|
}
|
|
37380
37592
|
}
|
|
37381
|
-
async function collectRunnableFlowPaths(dir, relDir = "") {
|
|
37382
|
-
const found = [];
|
|
37383
|
-
const entries = await fsp.readdir(dir, { withFileTypes: true });
|
|
37384
|
-
for (const entry of entries) {
|
|
37385
|
-
const rel = relDir ? path17.join(relDir, entry.name) : entry.name;
|
|
37386
|
-
if (entry.isDirectory()) {
|
|
37387
|
-
if (entry.name === "__baselines__") continue;
|
|
37388
|
-
found.push(
|
|
37389
|
-
...await collectRunnableFlowPaths(path17.join(dir, entry.name), rel).catch(() => [])
|
|
37390
|
-
);
|
|
37391
|
-
continue;
|
|
37392
|
-
}
|
|
37393
|
-
if (!entry.name.endsWith(".yaml")) continue;
|
|
37394
|
-
if (!SAFE_FLOW_NAME.test(path17.basename(entry.name, ".yaml"))) continue;
|
|
37395
|
-
if (await isRunnableFlowFile(path17.join(dir, entry.name))) found.push(rel);
|
|
37396
|
-
}
|
|
37397
|
-
return found;
|
|
37398
|
-
}
|
|
37399
37593
|
async function resolveFlowRef(ref, projectRoot) {
|
|
37400
37594
|
if (!SAFE_FLOW_NAME.test(ref)) return { suppliedPath: ref, fromName: false };
|
|
37401
37595
|
const picked = await resolveE2eFile(projectRoot, ref);
|
|
@@ -37431,7 +37625,7 @@ async function collectFlowFiles(dir, recursive2) {
|
|
|
37431
37625
|
for (const entry of await fsp.readdir(current, { withFileTypes: true })) {
|
|
37432
37626
|
const entryRel = rel ? path17.join(rel, entry.name) : entry.name;
|
|
37433
37627
|
if (entry.isDirectory()) {
|
|
37434
|
-
if (recursive2 &&
|
|
37628
|
+
if (recursive2 && entry.name !== "__baselines__" && entry.name !== "node_modules" && (entry.name === ".argent" || !entry.name.startsWith("."))) {
|
|
37435
37629
|
await walk(path17.join(current, entry.name), entryRel).catch(() => {
|
|
37436
37630
|
});
|
|
37437
37631
|
}
|
|
@@ -37698,43 +37892,107 @@ async function e2e(argv, options) {
|
|
|
37698
37892
|
await printHelp();
|
|
37699
37893
|
return;
|
|
37700
37894
|
}
|
|
37895
|
+
const flagGiven = (flag) => rest.some((tok) => tok === flag || tok.startsWith(`${flag}=`));
|
|
37701
37896
|
if (sub === "list") {
|
|
37702
|
-
|
|
37703
|
-
|
|
37704
|
-
|
|
37897
|
+
if (rest.includes("--help") || rest.includes("-h")) {
|
|
37898
|
+
await printHelp();
|
|
37899
|
+
return;
|
|
37900
|
+
}
|
|
37901
|
+
let json3;
|
|
37902
|
+
let listDir;
|
|
37903
|
+
let recursive2;
|
|
37904
|
+
try {
|
|
37905
|
+
const parsed = parseCommandArgs(rest, LIST_OPTIONS);
|
|
37906
|
+
if (parsed.positionals.length > 1) {
|
|
37907
|
+
throw new UsageError(
|
|
37908
|
+
`unexpected argument ${JSON.stringify(parsed.positionals[1])}; e2e list takes at most one directory path`
|
|
37909
|
+
);
|
|
37910
|
+
}
|
|
37911
|
+
json3 = parsed.options.json === true;
|
|
37912
|
+
listDir = parsed.positionals[0];
|
|
37913
|
+
if (listDir === "") throw new UsageError("e2e list requires a non-empty directory path");
|
|
37914
|
+
recursive2 = parsed.options.recursive === true;
|
|
37915
|
+
if (recursive2 && listDir === void 0) {
|
|
37916
|
+
throw new UsageError("e2e list --recursive requires a directory path");
|
|
37917
|
+
}
|
|
37918
|
+
} catch (err) {
|
|
37919
|
+
if (!(err instanceof UsageError)) throw err;
|
|
37920
|
+
console.error(
|
|
37921
|
+
flagGiven("--json") ? JSON.stringify(errorRecord(err.message)) : `Error: ${err.message}
|
|
37922
|
+
Run \`argent e2e --help\`.`
|
|
37923
|
+
);
|
|
37924
|
+
return exitAfterFlush(2);
|
|
37925
|
+
}
|
|
37926
|
+
const listFail = (message) => {
|
|
37927
|
+
console.error(json3 ? JSON.stringify(errorRecord(message)) : message);
|
|
37928
|
+
return exitAfterFlush(2);
|
|
37929
|
+
};
|
|
37930
|
+
if (listDir?.split(/[\\/]+/).includes("..")) {
|
|
37931
|
+
return listFail(
|
|
37932
|
+
`E2E test directory must not contain ".." segments - they are collapsed without following symlinks, so the path can name a different directory than the one your shell opens: ${listDir}
|
|
37933
|
+
Pass the fully resolved path to the directory.`
|
|
37934
|
+
);
|
|
37935
|
+
}
|
|
37936
|
+
const entries = [];
|
|
37705
37937
|
const byName = /* @__PURE__ */ new Map();
|
|
37706
37938
|
let anyDir = false;
|
|
37707
|
-
|
|
37939
|
+
const dirs = listDir === void 0 ? E2E_DIRS : [listDir];
|
|
37940
|
+
for (const dir of dirs) {
|
|
37708
37941
|
let rels;
|
|
37709
37942
|
try {
|
|
37710
|
-
rels =
|
|
37711
|
-
} catch {
|
|
37712
|
-
|
|
37943
|
+
rels = await collectFlowFiles(path17.resolve(dir), listDir === void 0 || recursive2);
|
|
37944
|
+
} catch (err) {
|
|
37945
|
+
const code = err.code;
|
|
37946
|
+
if (listDir === void 0 && (code === "ENOENT" || code === "ENOTDIR")) continue;
|
|
37947
|
+
return listFail(
|
|
37948
|
+
code === "ENOENT" ? `E2E test directory not found: ${dir}` : code === "ENOTDIR" ? `E2E test path is not a directory: ${dir}` : `Could not read e2e test directory: ${dir}`
|
|
37949
|
+
);
|
|
37713
37950
|
}
|
|
37714
37951
|
anyDir = true;
|
|
37715
37952
|
for (const rel of rels) {
|
|
37716
37953
|
const shown = path17.join(dir, rel);
|
|
37954
|
+
if (listDir !== void 0) {
|
|
37955
|
+
entries.push({ path: optionSafePath(shown) });
|
|
37956
|
+
continue;
|
|
37957
|
+
}
|
|
37717
37958
|
const name = path17.dirname(rel) === "." ? path17.basename(rel, ".yaml") : void 0;
|
|
37718
|
-
const
|
|
37719
|
-
if (name !== void 0 &&
|
|
37720
|
-
|
|
37721
|
-
|
|
37722
|
-
|
|
37723
|
-
|
|
37724
|
-
|
|
37725
|
-
|
|
37726
|
-
|
|
37727
|
-
|
|
37728
|
-
|
|
37729
|
-
|
|
37730
|
-
);
|
|
37959
|
+
const shadowedBy = name === void 0 ? void 0 : byName.get(name);
|
|
37960
|
+
if (name !== void 0 && shadowedBy === void 0) byName.set(name, shown);
|
|
37961
|
+
entries.push({
|
|
37962
|
+
path: shown,
|
|
37963
|
+
...name !== void 0 && { name },
|
|
37964
|
+
legacy: dir !== E2E_DIR,
|
|
37965
|
+
...shadowedBy !== void 0 && { shadowedBy }
|
|
37966
|
+
});
|
|
37967
|
+
}
|
|
37968
|
+
}
|
|
37969
|
+
if (json3) {
|
|
37970
|
+
const doc = { e2eTests: entries, ...!anyDir && { warning: "no-e2e-directory" } };
|
|
37971
|
+
console.log(JSON.stringify(doc, null, 2));
|
|
37972
|
+
return;
|
|
37731
37973
|
}
|
|
37732
37974
|
if (!anyDir) {
|
|
37733
|
-
console.
|
|
37734
|
-
|
|
37735
|
-
|
|
37736
|
-
|
|
37737
|
-
|
|
37975
|
+
console.error(
|
|
37976
|
+
`warning: no ${E2E_DIRS.join(" or ")} directory in the current working directory`
|
|
37977
|
+
);
|
|
37978
|
+
} else if (entries.length === 0) {
|
|
37979
|
+
console.error(
|
|
37980
|
+
`No e2e tests found in ${listDir ?? E2E_DIRS.join(" or ")}` + (listDir === void 0 || recursive2 ? "" : "\nPass -r/--recursive to include subdirectories.")
|
|
37981
|
+
);
|
|
37982
|
+
} else {
|
|
37983
|
+
console.log(entries.map((entry) => entry.path).join("\n"));
|
|
37984
|
+
for (const entry of entries) {
|
|
37985
|
+
if (entry.shadowedBy !== void 0)
|
|
37986
|
+
console.error(
|
|
37987
|
+
`warning: ${entry.path} is shadowed by ${entry.shadowedBy} when run by name`
|
|
37988
|
+
);
|
|
37989
|
+
}
|
|
37990
|
+
const legacyCount = entries.filter((entry) => entry.legacy).length;
|
|
37991
|
+
if (legacyCount > 0) {
|
|
37992
|
+
console.error(
|
|
37993
|
+
`note: ${legacyCount} test${legacyCount === 1 ? "" : "s"} listed from .argent/flows (legacy); move ${legacyCount === 1 ? "it" : "them"} to .argent/e2e`
|
|
37994
|
+
);
|
|
37995
|
+
}
|
|
37738
37996
|
}
|
|
37739
37997
|
return;
|
|
37740
37998
|
}
|
|
@@ -37742,7 +38000,6 @@ async function e2e(argv, options) {
|
|
|
37742
38000
|
console.error(`Unknown e2e subcommand "${sub}". Run \`argent e2e --help\`.`);
|
|
37743
38001
|
return exitAfterFlush(2);
|
|
37744
38002
|
}
|
|
37745
|
-
const flagGiven = (flag) => rest.some((tok) => tok === flag || tok.startsWith(`${flag}=`));
|
|
37746
38003
|
const jsonStream = flagGiven("--json-stream");
|
|
37747
38004
|
const json2 = !jsonStream && flagGiven("--json");
|
|
37748
38005
|
if (rest.includes("--help") || rest.includes("-h")) {
|
|
@@ -38365,7 +38622,7 @@ Listing tools contacts the argent tool-server, starting one if none is running.
|
|
|
38365
38622
|
import * as fs13 from "node:fs";
|
|
38366
38623
|
import * as path19 from "node:path";
|
|
38367
38624
|
import { constants as constants2, homedir as homedir5, networkInterfaces } from "node:os";
|
|
38368
|
-
import { spawn as
|
|
38625
|
+
import { spawn as spawn4 } from "node:child_process";
|
|
38369
38626
|
var STATE_DIR2 = path19.join(homedir5(), ".argent");
|
|
38370
38627
|
var LOG_FILE2 = path19.join(STATE_DIR2, "tool-server.log");
|
|
38371
38628
|
async function describeForeignServers(ownBundlePath) {
|
|
@@ -38439,7 +38696,7 @@ function logsCmd(follow) {
|
|
|
38439
38696
|
process.stdout.write(fs13.readFileSync(LOG_FILE2, "utf8"));
|
|
38440
38697
|
return;
|
|
38441
38698
|
}
|
|
38442
|
-
const child =
|
|
38699
|
+
const child = spawn4("tail", ["-f", LOG_FILE2], { stdio: "inherit" });
|
|
38443
38700
|
child.on(
|
|
38444
38701
|
"exit",
|
|
38445
38702
|
(code, signal) => process.exit(code ?? (signal ? 128 + (signalNumber(signal) ?? 0) : 0))
|
|
@@ -38663,7 +38920,7 @@ async function runForeground(paths, port, host, idleTimeoutMinutes, token) {
|
|
|
38663
38920
|
idleTimeoutMinutes,
|
|
38664
38921
|
token
|
|
38665
38922
|
});
|
|
38666
|
-
const child =
|
|
38923
|
+
const child = spawn4("node", [paths.bundlePath, "start"], {
|
|
38667
38924
|
stdio: "inherit",
|
|
38668
38925
|
env
|
|
38669
38926
|
});
|