vibecode-anything 0.3.0 → 0.4.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/README.md +239 -67
- package/dist/cli.js +2140 -73
- package/dist/core/adapters.d.ts +26 -3
- package/dist/core/adapters.js +411 -25
- package/dist/core/agent-adapter.d.ts +67 -0
- package/dist/core/agent-adapter.js +312 -0
- package/dist/core/anti-cheat.d.ts +6 -0
- package/dist/core/anti-cheat.js +372 -0
- package/dist/core/badge.d.ts +18 -0
- package/dist/core/badge.js +360 -0
- package/dist/core/cache.d.ts +47 -0
- package/dist/core/cache.js +403 -0
- package/dist/core/ci-export.d.ts +35 -0
- package/dist/core/ci-export.js +796 -0
- package/dist/core/ci-formats.d.ts +21 -0
- package/dist/core/ci-formats.js +388 -0
- package/dist/core/client-codegen.d.ts +36 -0
- package/dist/core/client-codegen.js +2538 -0
- package/dist/core/compose.d.ts +71 -0
- package/dist/core/compose.js +1088 -0
- package/dist/core/docs-export.d.ts +37 -0
- package/dist/core/docs-export.js +2706 -0
- package/dist/core/doctor.d.ts +21 -1
- package/dist/core/doctor.js +234 -21
- package/dist/core/exec.d.ts +26 -2
- package/dist/core/exec.js +235 -8
- package/dist/core/fixtures.d.ts +153 -0
- package/dist/core/fixtures.js +2245 -0
- package/dist/core/format.d.ts +77 -0
- package/dist/core/format.js +632 -0
- package/dist/core/fs-snapshot.d.ts +37 -0
- package/dist/core/fs-snapshot.js +216 -0
- package/dist/core/graphql-export.d.ts +34 -0
- package/dist/core/graphql-export.js +2482 -0
- package/dist/core/har-export.d.ts +29 -0
- package/dist/core/har-export.js +988 -0
- package/dist/core/html-report.d.ts +27 -0
- package/dist/core/html-report.js +1535 -0
- package/dist/core/http-export.d.ts +31 -0
- package/dist/core/http-export.js +726 -0
- package/dist/core/impact.d.ts +80 -0
- package/dist/core/impact.js +1412 -0
- package/dist/core/lint.d.ts +38 -0
- package/dist/core/lint.js +1111 -0
- package/dist/core/load-export.d.ts +37 -0
- package/dist/core/load-export.js +1813 -0
- package/dist/core/mcp-export.d.ts +35 -0
- package/dist/core/mcp-export.js +1736 -0
- package/dist/core/mock-server.d.ts +47 -0
- package/dist/core/mock-server.js +1722 -0
- package/dist/core/openapi-export.d.ts +44 -0
- package/dist/core/openapi-export.js +1074 -0
- package/dist/core/parity.d.ts +6 -1
- package/dist/core/parity.js +36 -1
- package/dist/core/playwright-exporter.d.ts +23 -0
- package/dist/core/playwright-exporter.js +1343 -0
- package/dist/core/png.js +45 -9
- package/dist/core/regression.d.ts +54 -0
- package/dist/core/regression.js +529 -0
- package/dist/core/responsive.d.ts +86 -0
- package/dist/core/responsive.js +606 -0
- package/dist/core/run.d.ts +74 -0
- package/dist/core/run.js +696 -0
- package/dist/core/scheduler.d.ts +24 -0
- package/dist/core/scheduler.js +162 -0
- package/dist/core/schema-export.d.ts +29 -0
- package/dist/core/schema-export.js +2215 -0
- package/dist/core/schema.d.ts +3 -2
- package/dist/core/schema.js +460 -17
- package/dist/core/security.d.ts +233 -0
- package/dist/core/security.js +1839 -0
- package/dist/core/server-export.d.ts +38 -0
- package/dist/core/server-export.js +3198 -0
- package/dist/core/spec-writer.d.ts +9 -0
- package/dist/core/spec-writer.js +1202 -0
- package/dist/core/store.d.ts +11 -2
- package/dist/core/store.js +128 -8
- package/dist/core/target-map.d.ts +34 -0
- package/dist/core/target-map.js +262 -0
- package/dist/core/test-exporter.d.ts +25 -0
- package/dist/core/test-exporter.js +1918 -0
- package/dist/core/types.d.ts +182 -14
- package/dist/core/visual-semantic.d.ts +67 -0
- package/dist/core/visual-semantic.js +673 -0
- package/dist/core/visual.js +65 -16
- package/dist/core/watch.d.ts +28 -3
- package/dist/core/watch.js +222 -12
- package/dist/core/yaml.d.ts +5 -0
- package/dist/core/yaml.js +1009 -0
- package/dist/diagnostics/diagnose.d.ts +53 -0
- package/dist/diagnostics/diagnose.js +1083 -0
- package/dist/diagnostics/flake.d.ts +71 -0
- package/dist/diagnostics/flake.js +608 -0
- package/dist/diagnostics/mutation-audit.d.ts +69 -0
- package/dist/diagnostics/mutation-audit.js +769 -0
- package/dist/diagnostics/spatial.d.ts +42 -0
- package/dist/diagnostics/spatial.js +346 -0
- package/dist/diagnostics/trends.d.ts +122 -0
- package/dist/diagnostics/trends.js +1190 -0
- package/dist/discovery/discover.d.ts +111 -0
- package/dist/discovery/discover.js +2017 -0
- package/dist/discovery/lock.d.ts +116 -0
- package/dist/discovery/lock.js +1505 -0
- package/dist/discovery/routes.d.ts +36 -0
- package/dist/discovery/routes.js +1494 -0
- package/dist/discovery/test-importer.d.ts +92 -0
- package/dist/discovery/test-importer.js +4952 -0
- package/dist/index.d.ts +123 -0
- package/dist/index.js +99 -0
- package/dist/ingestors/api-collections.d.ts +28 -0
- package/dist/ingestors/api-collections.js +2335 -0
- package/dist/ingestors/api-repo.d.ts +2 -1
- package/dist/ingestors/api-repo.js +483 -85
- package/dist/ingestors/asyncapi.d.ts +26 -0
- package/dist/ingestors/asyncapi.js +2105 -0
- package/dist/ingestors/bridges.d.ts +2 -0
- package/dist/ingestors/bridges.js +702 -0
- package/dist/ingestors/cli.d.ts +2 -1
- package/dist/ingestors/cli.js +234 -46
- package/dist/ingestors/curl.d.ts +14 -0
- package/dist/ingestors/curl.js +1024 -0
- package/dist/ingestors/graphql.d.ts +56 -0
- package/dist/ingestors/graphql.js +1852 -0
- package/dist/ingestors/http-file.d.ts +20 -0
- package/dist/ingestors/http-file.js +923 -0
- package/dist/ingestors/index.js +486 -6
- package/dist/ingestors/openrpc.d.ts +29 -0
- package/dist/ingestors/openrpc.js +1807 -0
- package/dist/ingestors/proto.d.ts +47 -0
- package/dist/ingestors/proto.js +2690 -0
- package/dist/ingestors/trace.d.ts +10 -0
- package/dist/ingestors/trace.js +599 -0
- package/dist/ingestors/video.d.ts +4 -1
- package/dist/ingestors/video.js +86 -36
- package/dist/ingestors/web.d.ts +16 -1
- package/dist/ingestors/web.js +474 -32
- package/dist/mcp/server.js +3532 -67
- package/dist/oracles/api-repo.js +102 -30
- package/dist/oracles/cli.js +65 -17
- package/dist/oracles/http-workflow.d.ts +68 -0
- package/dist/oracles/http-workflow.js +828 -0
- package/dist/oracles/image.js +178 -28
- package/dist/oracles/index.d.ts +3 -1
- package/dist/oracles/index.js +243 -14
- package/dist/oracles/perf-budget.d.ts +90 -0
- package/dist/oracles/perf-budget.js +1329 -0
- package/dist/oracles/stream.d.ts +94 -0
- package/dist/oracles/stream.js +1268 -0
- package/dist/oracles/ui-states.d.ts +49 -0
- package/dist/oracles/ui-states.js +894 -0
- package/dist/oracles/video.d.ts +1 -1
- package/dist/oracles/video.js +232 -16
- package/dist/oracles/web.js +464 -73
- package/dist/plugins/builtins.d.ts +12 -0
- package/dist/plugins/builtins.js +1052 -0
- package/dist/plugins/registry.d.ts +86 -0
- package/dist/plugins/registry.js +554 -0
- package/dist/setup/index.js +145 -33
- package/package.json +56 -47
- package/skills/vibecode-anything/SKILL.md +75 -52
package/dist/ingestors/cli.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { IngestDeps, IngestOptions, IngestResult, JsonSchema } from "../core/types.js";
|
|
2
2
|
declare function parseHelpSubcommands(stdout: unknown): string[];
|
|
3
3
|
declare function synthesizeSchema(value: unknown): JsonSchema;
|
|
4
|
+
declare function extractValueFlags(helpText: string): string[];
|
|
4
5
|
/**
|
|
5
6
|
* Safe sandboxed CLI auto-prober.
|
|
6
7
|
* Runs every probe inside a temporary directory — never the user's workspace.
|
|
7
8
|
*/
|
|
8
9
|
export declare function ingest(options?: IngestOptions, deps?: IngestDeps): Promise<IngestResult>;
|
|
9
|
-
export { parseHelpSubcommands, synthesizeSchema };
|
|
10
|
+
export { parseHelpSubcommands, synthesizeSchema, extractValueFlags };
|
package/dist/ingestors/cli.js
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
2
|
import os from "node:os";
|
|
3
3
|
import path from "node:path";
|
|
4
|
-
import { splitCommand
|
|
4
|
+
import { splitCommand } from "../core/exec.js";
|
|
5
|
+
import { DETERMINISTIC_CLI_ENV, diffFsSnapshots, resolveCommandForSandbox, runSandboxedCommand, takeFsSnapshot } from "../core/fs-snapshot.js";
|
|
5
6
|
import { VibecodeError, errorMessage } from "../core/errors.js";
|
|
6
7
|
const DEFAULT_TIMEOUT = 5000;
|
|
7
8
|
const MAX_SUBCOMMANDS = 12;
|
|
9
|
+
const MAX_HOLDOUT_PROBES = 8;
|
|
10
|
+
const MAX_VALUE_FLAG_PROBES = 4;
|
|
11
|
+
const MAX_STDIN_TARGETS = 3;
|
|
12
|
+
const VALUE_FLAG_RE = /(?<![a-zA-Z0-9_-])(--[a-zA-Z][a-zA-Z0-9_-]*)(?:[ \t]+(?:<[a-zA-Z0-9_|-]+>|\[[a-zA-Z0-9_|-]+\]|[A-Z][A-Z0-9_]+(?=\s|$|[,;.)\]]))|[ \t]*=[ \t]*(?:<[a-zA-Z0-9_|-]+>|\[[a-zA-Z0-9_|-]+\]|[a-zA-Z0-9_|-]+))/g;
|
|
13
|
+
const STDIN_HELP_RE = /\bstdin\b|\bstandard input\b|\bpipe\b/i;
|
|
8
14
|
function parseHelpSubcommands(stdout) {
|
|
9
15
|
const lines = String(stdout || "").split(/\r?\n/);
|
|
10
16
|
const cmds = new Set();
|
|
@@ -57,22 +63,31 @@ function slug(args) {
|
|
|
57
63
|
function probeKey(args, stdin, env) {
|
|
58
64
|
return JSON.stringify({ args, stdin: stdin ?? null, env: env ?? null });
|
|
59
65
|
}
|
|
60
|
-
function
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
if (
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
66
|
+
function extractValueFlags(helpText) {
|
|
67
|
+
const flags = [];
|
|
68
|
+
for (const match of helpText.matchAll(VALUE_FLAG_RE)) {
|
|
69
|
+
if (match[1])
|
|
70
|
+
flags.push(match[1]);
|
|
71
|
+
}
|
|
72
|
+
return flags;
|
|
73
|
+
}
|
|
74
|
+
function firstNonEmptyLine(text, maxLen = 64) {
|
|
75
|
+
const line = String(text || "")
|
|
76
|
+
.split(/\r?\n/)
|
|
77
|
+
.map((l) => l.trim())
|
|
78
|
+
.find((l) => l.length > 0);
|
|
79
|
+
return line ? line.slice(0, maxLen) : "";
|
|
80
|
+
}
|
|
81
|
+
function allocateId(baseId, usedIds) {
|
|
82
|
+
let id = baseId;
|
|
83
|
+
if (usedIds.has(id)) {
|
|
84
|
+
let n = 2;
|
|
85
|
+
while (usedIds.has(`${baseId}-${n}`))
|
|
86
|
+
n++;
|
|
87
|
+
id = `${baseId}-${n}`;
|
|
88
|
+
}
|
|
89
|
+
usedIds.add(id);
|
|
90
|
+
return id;
|
|
76
91
|
}
|
|
77
92
|
/** Build expected assertions from observed probe output. */
|
|
78
93
|
function buildExpected({ args, run, subcommands, explicit = false }) {
|
|
@@ -141,8 +156,21 @@ export async function ingest(options = {}, deps = {}) {
|
|
|
141
156
|
const tokens = splitCommand(source);
|
|
142
157
|
if (tokens.length === 0)
|
|
143
158
|
throw new VibecodeError("TARGET_MISSING", "CLI source command is empty");
|
|
144
|
-
const resolvedTokens =
|
|
159
|
+
const resolvedTokens = resolveCommandForSandbox(tokens, options.cwd);
|
|
145
160
|
const [target, ...baseArgs] = resolvedTokens;
|
|
161
|
+
const fsDiffEnabled = options.fsDiff === true;
|
|
162
|
+
const timeoutMs = deps.timeoutMs || DEFAULT_TIMEOUT;
|
|
163
|
+
const buildPersistedEnv = (probeEnv) => ({
|
|
164
|
+
NO_COLOR: "1",
|
|
165
|
+
...(options.env || {}),
|
|
166
|
+
...(probeEnv || {})
|
|
167
|
+
});
|
|
168
|
+
const buildExecEnv = (probeEnv) => ({
|
|
169
|
+
...DETERMINISTIC_CLI_ENV,
|
|
170
|
+
NO_COLOR: "1",
|
|
171
|
+
...(options.env || {}),
|
|
172
|
+
...(probeEnv || {})
|
|
173
|
+
});
|
|
146
174
|
const sandbox = deps.tmpDir || fs.mkdtempSync(path.join(os.tmpdir(), "vibecode-probe-"));
|
|
147
175
|
const ownsSandbox = !deps.tmpDir;
|
|
148
176
|
const warnings = [];
|
|
@@ -170,35 +198,99 @@ export async function ingest(options = {}, deps = {}) {
|
|
|
170
198
|
addProbe(p.args, { name: p.name || "custom", stdin: p.stdin, env: p.env, expected: p.expected, explicit: true });
|
|
171
199
|
}
|
|
172
200
|
}
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
201
|
+
const runProbe = async (probeArgs, stdin, probeEnv) => {
|
|
202
|
+
if (!fsDiffEnabled) {
|
|
203
|
+
const run = await runSandboxedCommand(target, [...baseArgs, ...probeArgs], {
|
|
204
|
+
stdin,
|
|
205
|
+
cwd: sandbox,
|
|
206
|
+
timeoutMs,
|
|
207
|
+
env: buildExecEnv(probeEnv)
|
|
208
|
+
});
|
|
209
|
+
return { run };
|
|
210
|
+
}
|
|
211
|
+
const probeDir = fs.mkdtempSync(path.join(os.tmpdir(), "vibecode-cli-fs-"));
|
|
212
|
+
try {
|
|
213
|
+
const before = takeFsSnapshot(probeDir);
|
|
214
|
+
const run = await runSandboxedCommand(target, [...baseArgs, ...probeArgs], {
|
|
215
|
+
stdin,
|
|
216
|
+
cwd: probeDir,
|
|
217
|
+
timeoutMs,
|
|
218
|
+
env: buildExecEnv(probeEnv)
|
|
219
|
+
});
|
|
220
|
+
const after = takeFsSnapshot(probeDir);
|
|
221
|
+
return { run, fsEffects: diffFsSnapshots(before, after) };
|
|
222
|
+
}
|
|
223
|
+
finally {
|
|
224
|
+
fs.rmSync(probeDir, { recursive: true, force: true, maxRetries: 3, retryDelay: 50 });
|
|
225
|
+
}
|
|
226
|
+
};
|
|
192
227
|
const invariants = [];
|
|
193
228
|
const usedIds = new Set();
|
|
229
|
+
const subcommandHelp = new Map();
|
|
230
|
+
let helpStderr = "";
|
|
231
|
+
let rootHelpText = "";
|
|
232
|
+
let subcommands = [];
|
|
233
|
+
let holdoutCount = 0;
|
|
234
|
+
const emitHoldoutProbe = async ({ args, stdin, baseId, description, holdoutHint, tags }) => {
|
|
235
|
+
if (holdoutCount >= MAX_HOLDOUT_PROBES)
|
|
236
|
+
return;
|
|
237
|
+
const { run, fsEffects } = await runProbe(args, stdin);
|
|
238
|
+
if (run.timedOut || (run.error && run.exitCode === null) || run.exitCode === null || run.exitCode === 0) {
|
|
239
|
+
return;
|
|
240
|
+
}
|
|
241
|
+
const firstErrLine = firstNonEmptyLine(run.stderr, 64);
|
|
242
|
+
const expected = {
|
|
243
|
+
exitCode: run.exitCode,
|
|
244
|
+
...(firstErrLine ? { stderrContains: [firstErrLine] } : {}),
|
|
245
|
+
...(fsDiffEnabled && fsEffects !== undefined ? { fsEffects } : {})
|
|
246
|
+
};
|
|
247
|
+
const id = allocateId(baseId, usedIds);
|
|
248
|
+
invariants.push({
|
|
249
|
+
id,
|
|
250
|
+
domain: "cli",
|
|
251
|
+
type: "command",
|
|
252
|
+
severity: "hard",
|
|
253
|
+
description,
|
|
254
|
+
tags,
|
|
255
|
+
sourceId: "src-1",
|
|
256
|
+
holdout: true,
|
|
257
|
+
holdoutHint,
|
|
258
|
+
input: {
|
|
259
|
+
args,
|
|
260
|
+
stdin,
|
|
261
|
+
env: buildPersistedEnv(),
|
|
262
|
+
cwd: ".",
|
|
263
|
+
timeoutMs,
|
|
264
|
+
...(fsDiffEnabled ? { fsDiff: true } : {})
|
|
265
|
+
},
|
|
266
|
+
expected,
|
|
267
|
+
tolerance: {}
|
|
268
|
+
});
|
|
269
|
+
holdoutCount++;
|
|
270
|
+
};
|
|
194
271
|
try {
|
|
195
|
-
|
|
196
|
-
const
|
|
197
|
-
stdin:
|
|
272
|
+
try {
|
|
273
|
+
const helpRun = await runSandboxedCommand(target, [...baseArgs, "--help"], {
|
|
274
|
+
stdin: "",
|
|
198
275
|
cwd: sandbox,
|
|
199
|
-
timeoutMs
|
|
200
|
-
env:
|
|
276
|
+
timeoutMs,
|
|
277
|
+
env: buildExecEnv()
|
|
201
278
|
});
|
|
279
|
+
helpStderr = helpRun.stderr || "";
|
|
280
|
+
if (!helpRun.timedOut && !(helpRun.error && helpRun.exitCode === null)) {
|
|
281
|
+
rootHelpText = `${helpRun.stdout || ""}\n${helpRun.stderr || ""}`;
|
|
282
|
+
}
|
|
283
|
+
subcommands = parseHelpSubcommands(helpRun.stdout);
|
|
284
|
+
if (subcommands.length === 0)
|
|
285
|
+
subcommands = parseHelpSubcommands(helpRun.stderr);
|
|
286
|
+
for (const cmd of subcommands)
|
|
287
|
+
addProbe([cmd, "--help"], { name: `cmd-${cmd}`, subcommand: true });
|
|
288
|
+
}
|
|
289
|
+
catch (err) {
|
|
290
|
+
warnings.push({ code: "EXEC_ERROR", message: `Help probe failed: ${errorMessage(err)}` });
|
|
291
|
+
}
|
|
292
|
+
for (const probe of probes) {
|
|
293
|
+
const { run, fsEffects } = await runProbe(probe.args, probe.stdin !== undefined ? probe.stdin : "", probe.env);
|
|
202
294
|
if (run.timedOut) {
|
|
203
295
|
warnings.push({ code: "EXEC_TIMEOUT", message: `Probe ${probe.args.join(" ")} timed out; skipped` });
|
|
204
296
|
continue;
|
|
@@ -207,9 +299,18 @@ export async function ingest(options = {}, deps = {}) {
|
|
|
207
299
|
warnings.push({ code: "EXEC_ERROR", message: `Probe ${probe.args.join(" ")} failed: ${run.error.message}` });
|
|
208
300
|
continue;
|
|
209
301
|
}
|
|
302
|
+
if (probe.args.length === 2 &&
|
|
303
|
+
probe.args[1] === "--help" &&
|
|
304
|
+
subcommands.includes(probe.args[0]) &&
|
|
305
|
+
!subcommandHelp.has(probe.args[0])) {
|
|
306
|
+
subcommandHelp.set(probe.args[0], `${run.stdout || ""}\n${run.stderr || ""}`);
|
|
307
|
+
}
|
|
210
308
|
const expected = probe.expected
|
|
211
309
|
? { ...probe.expected }
|
|
212
310
|
: buildExpected({ args: probe.args, run, subcommands, explicit: Boolean(probe.explicit) });
|
|
311
|
+
if (fsDiffEnabled && fsEffects !== undefined && expected.fsEffects === undefined) {
|
|
312
|
+
expected.fsEffects = fsEffects;
|
|
313
|
+
}
|
|
213
314
|
let id = `inv-cli-${slug(probe.args)}`;
|
|
214
315
|
if (usedIds.has(id)) {
|
|
215
316
|
const named = probe.name ? `inv-cli-${slug([slug(probe.args), probe.name])}` : "";
|
|
@@ -234,18 +335,105 @@ export async function ingest(options = {}, deps = {}) {
|
|
|
234
335
|
input: {
|
|
235
336
|
args: probe.args,
|
|
236
337
|
stdin: probe.stdin !== undefined ? probe.stdin : null,
|
|
237
|
-
env:
|
|
338
|
+
env: buildPersistedEnv(probe.env),
|
|
238
339
|
cwd: ".",
|
|
239
|
-
timeoutMs
|
|
340
|
+
timeoutMs,
|
|
341
|
+
...(fsDiffEnabled ? { fsDiff: true } : {})
|
|
240
342
|
},
|
|
241
343
|
expected,
|
|
242
344
|
tolerance: {}
|
|
243
345
|
});
|
|
244
346
|
}
|
|
347
|
+
// 1. Value-flag missing-value holdout probes (max 4 flags, deduped by flag name)
|
|
348
|
+
const seenFlags = new Set();
|
|
349
|
+
const flagCandidates = [];
|
|
350
|
+
const collectFlagsFrom = (helpText, prefixArgs) => {
|
|
351
|
+
for (const flag of extractValueFlags(helpText)) {
|
|
352
|
+
const norm = flag.toLowerCase();
|
|
353
|
+
if (norm === "--help" || norm === "--version" || seenFlags.has(norm))
|
|
354
|
+
continue;
|
|
355
|
+
seenFlags.add(norm);
|
|
356
|
+
flagCandidates.push({ args: [...prefixArgs, flag], flag });
|
|
357
|
+
if (flagCandidates.length >= MAX_VALUE_FLAG_PROBES)
|
|
358
|
+
break;
|
|
359
|
+
}
|
|
360
|
+
};
|
|
361
|
+
for (const cmd of subcommands) {
|
|
362
|
+
if (flagCandidates.length >= MAX_VALUE_FLAG_PROBES)
|
|
363
|
+
break;
|
|
364
|
+
collectFlagsFrom(subcommandHelp.get(cmd) || "", [cmd]);
|
|
365
|
+
}
|
|
366
|
+
if (flagCandidates.length < MAX_VALUE_FLAG_PROBES) {
|
|
367
|
+
collectFlagsFrom(rootHelpText, []);
|
|
368
|
+
}
|
|
369
|
+
for (const candidate of flagCandidates) {
|
|
370
|
+
if (holdoutCount >= MAX_HOLDOUT_PROBES)
|
|
371
|
+
break;
|
|
372
|
+
await emitHoldoutProbe({
|
|
373
|
+
args: candidate.args,
|
|
374
|
+
stdin: "",
|
|
375
|
+
baseId: `inv-cli-holdout-missing-${slug(candidate.args)}`,
|
|
376
|
+
description: `Holdout CLI probe: ${candidate.args.join(" ")} (missing flag value)`,
|
|
377
|
+
holdoutHint: `Missing value handling for ${candidate.flag}`,
|
|
378
|
+
tags: ["cli", "holdout", "negative", "flag"]
|
|
379
|
+
});
|
|
380
|
+
}
|
|
381
|
+
// 2. Stdin-accepting command holdout probes (max 3 command targets)
|
|
382
|
+
const stdinTargets = [];
|
|
383
|
+
for (const cmd of subcommands) {
|
|
384
|
+
if (stdinTargets.length >= MAX_STDIN_TARGETS)
|
|
385
|
+
break;
|
|
386
|
+
if (STDIN_HELP_RE.test(subcommandHelp.get(cmd) || "")) {
|
|
387
|
+
stdinTargets.push({ args: [cmd], label: cmd });
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
if (stdinTargets.length < MAX_STDIN_TARGETS && STDIN_HELP_RE.test(rootHelpText)) {
|
|
391
|
+
stdinTargets.push({ args: [], label: "" });
|
|
392
|
+
}
|
|
393
|
+
for (const targetCmd of stdinTargets) {
|
|
394
|
+
if (holdoutCount >= MAX_HOLDOUT_PROBES)
|
|
395
|
+
break;
|
|
396
|
+
const hint = `Invalid or empty stdin handling${targetCmd.label ? ` for ${targetCmd.label}` : ""}`;
|
|
397
|
+
const emptyAlreadyProbed = seen.has(probeKey(targetCmd.args, "", undefined)) ||
|
|
398
|
+
seen.has(probeKey(targetCmd.args, undefined, undefined));
|
|
399
|
+
if (!emptyAlreadyProbed) {
|
|
400
|
+
await emitHoldoutProbe({
|
|
401
|
+
args: targetCmd.args,
|
|
402
|
+
stdin: "",
|
|
403
|
+
baseId: `inv-cli-holdout-stdin-${slug([...targetCmd.args, "empty"])}`,
|
|
404
|
+
description: `Holdout CLI probe: ${targetCmd.args.join(" ") || "(no args)"} (empty stdin)`,
|
|
405
|
+
holdoutHint: hint,
|
|
406
|
+
tags: ["cli", "holdout", "negative", "stdin"]
|
|
407
|
+
});
|
|
408
|
+
}
|
|
409
|
+
if (holdoutCount >= MAX_HOLDOUT_PROBES)
|
|
410
|
+
break;
|
|
411
|
+
if (!seen.has(probeKey(targetCmd.args, "{bad-json", undefined))) {
|
|
412
|
+
await emitHoldoutProbe({
|
|
413
|
+
args: targetCmd.args,
|
|
414
|
+
stdin: "{bad-json",
|
|
415
|
+
baseId: `inv-cli-holdout-stdin-${slug([...targetCmd.args, "bad-json"])}`,
|
|
416
|
+
description: `Holdout CLI probe: ${targetCmd.args.join(" ") || "(no args)"} (bad-json stdin)`,
|
|
417
|
+
holdoutHint: hint,
|
|
418
|
+
tags: ["cli", "holdout", "negative", "stdin"]
|
|
419
|
+
});
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
// 3. Unknown subcommand holdout probe
|
|
423
|
+
if (holdoutCount < MAX_HOLDOUT_PROBES) {
|
|
424
|
+
await emitHoldoutProbe({
|
|
425
|
+
args: ["__vibecode_unknown_cmd__"],
|
|
426
|
+
stdin: "",
|
|
427
|
+
baseId: "inv-cli-holdout-unknown-cmd",
|
|
428
|
+
description: "Holdout CLI probe: __vibecode_unknown_cmd__ (unknown subcommand)",
|
|
429
|
+
holdoutHint: "Unknown subcommand rejection",
|
|
430
|
+
tags: ["cli", "holdout", "negative", "subcommand"]
|
|
431
|
+
});
|
|
432
|
+
}
|
|
245
433
|
}
|
|
246
434
|
finally {
|
|
247
435
|
if (ownsSandbox)
|
|
248
|
-
fs.rmSync(sandbox, { recursive: true, force: true });
|
|
436
|
+
fs.rmSync(sandbox, { recursive: true, force: true, maxRetries: 3, retryDelay: 50 });
|
|
249
437
|
}
|
|
250
438
|
if (invariants.length > 0 && invariants.every((i) => i.expected.exitCode !== 0) && /Cannot find module|MODULE_NOT_FOUND|No such file/i.test(helpStderr)) {
|
|
251
439
|
warnings.push({ code: "EXEC_ERROR", message: `Every probe exited non-zero (${helpStderr.trim().split(/\r?\n/)[0]}). Check --source path.` });
|
|
@@ -263,4 +451,4 @@ export async function ingest(options = {}, deps = {}) {
|
|
|
263
451
|
warnings
|
|
264
452
|
};
|
|
265
453
|
}
|
|
266
|
-
export { parseHelpSubcommands, synthesizeSchema };
|
|
454
|
+
export { parseHelpSubcommands, synthesizeSchema, extractValueFlags };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { IngestDeps, IngestOptions, IngestResult } from "../core/types.js";
|
|
2
|
+
export interface ParsedCurlRequest {
|
|
3
|
+
method: string;
|
|
4
|
+
url: string;
|
|
5
|
+
origin: string;
|
|
6
|
+
pathname: string;
|
|
7
|
+
query: Record<string, string>;
|
|
8
|
+
headers: Record<string, string>;
|
|
9
|
+
body: unknown;
|
|
10
|
+
redactedSecrets: boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare function isCurlCommandText(text: unknown): boolean;
|
|
13
|
+
export declare function parseCurlCommands(text: string): ParsedCurlRequest[];
|
|
14
|
+
export declare function ingestCurl(options?: IngestOptions, deps?: IngestDeps): Promise<IngestResult>;
|