@aarwitz/tapp 0.17.27 → 0.18.1
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/.claude-plugin/plugin.json +2 -2
- package/AGENTS.md +43 -44
- package/README.md +32 -42
- package/bin/tapp.js +178 -103
- package/browser/app.css +220 -208
- package/browser/app.js +173 -20
- package/browser/index.html +118 -57
- package/browser/tokens.css +33 -25
- package/docs/BROWSER-PRODUCT.md +16 -8
- package/docs/BUSINESS-WORKFLOWS.md +134 -0
- package/docs/PRODUCT-ENGINE.md +5 -0
- package/mcp-server/src/browser-product.js +15 -3
- package/mcp-server/src/business-observation.d.ts +2 -0
- package/mcp-server/src/business-observation.js +25 -0
- package/mcp-server/src/business-workflow-files.js +36 -0
- package/mcp-server/src/business-workflow-runtime.js +47 -0
- package/mcp-server/src/business-workflows.d.ts +50 -0
- package/mcp-server/src/business-workflows.js +169 -0
- package/mcp-server/src/environment-capabilities.d.ts +16 -0
- package/mcp-server/src/environment-capabilities.js +78 -0
- package/mcp-server/src/index.js +612 -814
- package/mcp-server/src/product-operations.js +3 -1
- package/mcp-server/src/public-network.js +65 -0
- package/mcp-server/src/web-audit.js +77 -17
- package/mcp-server/src/web-explorer.js +11 -1
- package/mcp-server/src/web-flow.js +17 -4
- package/package.json +10 -4
- package/scripts/quick-capture.sh +17 -5
- package/scripts/run-flow.sh +3 -1
- package/scripts/run-web-flow.js +4 -0
- package/skills/tapp/SKILL.md +14 -13
- package/skills/tapp/references/commands.md +73 -57
package/bin/tapp.js
CHANGED
|
@@ -128,6 +128,79 @@ function parseVerbArgs(argv) {
|
|
|
128
128
|
return { flags, positionals };
|
|
129
129
|
}
|
|
130
130
|
|
|
131
|
+
// ADR-0007: twelve public verbs, one engine. The resolver maps the public surface onto the
|
|
132
|
+
// internal case labels below (which keep their original argument shapes), and keeps every older
|
|
133
|
+
// verb working as a hidden alias that names its new form once on stderr.
|
|
134
|
+
function artifactKind(file) {
|
|
135
|
+
if (!file) return "flow";
|
|
136
|
+
if (/\.ts$/.test(file)) return "contract";
|
|
137
|
+
try {
|
|
138
|
+
const head = fs.readFileSync(path.resolve(file), "utf8").slice(0, 4000);
|
|
139
|
+
const kind = head.match(/^kind:\s*"?([a-z]+)/m)?.[1] || head.match(/"kind"\s*:\s*"([a-z]+)"/)?.[1];
|
|
140
|
+
if (kind === "task" || kind === "scenario" || kind === "contract") return kind;
|
|
141
|
+
if (/^actors:/m.test(head) && /^lifecycle:|^services:/m.test(head)) return "scenario";
|
|
142
|
+
} catch { /* missing file: the flow runner reports it */ }
|
|
143
|
+
return "flow";
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
function resolveCommand(command, rest) {
|
|
147
|
+
const without = (flag, count = 1) => { const i = rest.indexOf(flag); return i < 0 ? [...rest] : [...rest.slice(0, i), ...rest.slice(i + count)]; };
|
|
148
|
+
const has = (flag) => rest.includes(flag);
|
|
149
|
+
const legacy = (from, to) => `ℹ️ 'tapp ${from}' is now 'tapp ${to}' — the old form still works for now.`;
|
|
150
|
+
const sub = rest[0];
|
|
151
|
+
switch (command) {
|
|
152
|
+
// Public verbs → internal dispatch.
|
|
153
|
+
case "explore": {
|
|
154
|
+
if (has("--read-only")) return { command: "audit", rest: without("--read-only") };
|
|
155
|
+
const goal = rest.indexOf("--goal");
|
|
156
|
+
if (goal >= 0 && rest[goal + 1] !== undefined) return { command: "focus", rest: [rest[goal + 1], ...rest.slice(0, goal), ...rest.slice(goal + 2)] };
|
|
157
|
+
return { command, rest };
|
|
158
|
+
}
|
|
159
|
+
case "look":
|
|
160
|
+
if (has("--sim")) return { command: "shot", rest: without("--sim") };
|
|
161
|
+
if (has("--tree")) return { command: "tree", rest: without("--tree") };
|
|
162
|
+
return { command: "open", rest };
|
|
163
|
+
case "run":
|
|
164
|
+
return { command: artifactKind(rest.find((a) => !a.startsWith("--"))), rest: ["run", ...rest] };
|
|
165
|
+
case "validate": {
|
|
166
|
+
if (has("--example")) return { command: "flow", rest: ["example"] };
|
|
167
|
+
const file = rest.find((a) => !a.startsWith("--"));
|
|
168
|
+
const kind = artifactKind(file);
|
|
169
|
+
const compile = has("--compile") && (kind === "task" || kind === "contract");
|
|
170
|
+
return { command: kind, rest: [compile ? "compile" : "validate", ...without("--compile")] };
|
|
171
|
+
}
|
|
172
|
+
case "plan":
|
|
173
|
+
if (sub === "pr") return { command: "pr", rest: ["plan", ...rest.slice(1)] };
|
|
174
|
+
if (sub === "adopt") return { command: "pr", rest };
|
|
175
|
+
if (sub === "map" || sub === "workflows" || sub === "actor") return { command: sub, rest: rest.slice(1) };
|
|
176
|
+
return { command, rest };
|
|
177
|
+
case "ci":
|
|
178
|
+
if (sub === "baseline") return { command: "baseline", rest: ["create", ...rest.slice(1)] };
|
|
179
|
+
return { command, rest };
|
|
180
|
+
case "doctor":
|
|
181
|
+
if (has("--install")) return { command: "install", rest: without("--install") };
|
|
182
|
+
return { command, rest };
|
|
183
|
+
// Hidden aliases → internal dispatch, with the note.
|
|
184
|
+
case "qa": return { command: "explore", rest, note: legacy("qa", "explore") };
|
|
185
|
+
case "audit": return { command, rest, note: legacy("audit <url>", "explore <url> --read-only") };
|
|
186
|
+
case "focus": return { command, rest, note: legacy('focus "goal"', 'explore --goal "goal"') };
|
|
187
|
+
case "open": return { command, rest, note: legacy("open", "look") };
|
|
188
|
+
case "tree": return { command, rest, note: legacy("tree", "look --tree") };
|
|
189
|
+
case "shot": case "screenshot": return { command: "shot", rest, note: legacy(command, "look --sim") };
|
|
190
|
+
case "flow": case "task": case "contract": case "scenario": {
|
|
191
|
+
const verb = sub || (command === "flow" || command === "scenario" ? "run" : "validate");
|
|
192
|
+
const to = verb === "run" ? "run FILE" : verb === "example" ? "validate --example" : verb === "compile" ? "validate FILE --compile" : verb === "validate" ? "validate FILE" : "";
|
|
193
|
+
return { command, rest, ...(to ? { note: legacy(`${command} ${verb}`, to) } : {}) };
|
|
194
|
+
}
|
|
195
|
+
case "pr": return { command, rest, note: legacy(`pr ${sub || "plan"}`, `plan ${sub || "pr"}`.replace("plan plan", "plan pr")) };
|
|
196
|
+
case "map": case "workflows": case "actor": return { command, rest, note: legacy(command, `plan ${command}`) };
|
|
197
|
+
case "baseline": return { command, rest, note: legacy("baseline create", "ci baseline") };
|
|
198
|
+
case "install": return { command, rest, note: legacy("install", "doctor --install") };
|
|
199
|
+
case "studio": return { command: "app", rest, note: legacy("studio", "app") };
|
|
200
|
+
default: return { command, rest };
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
|
|
131
204
|
function repeatedFlagValues(argv, name) {
|
|
132
205
|
const values = [];
|
|
133
206
|
for (let index = 0; index < argv.length; index += 1) {
|
|
@@ -266,30 +339,31 @@ async function resolveTargetOrExit(engine, input, { inspect = false } = {}) {
|
|
|
266
339
|
|
|
267
340
|
function safeCommandUsage(verb) {
|
|
268
341
|
const usage = {
|
|
269
|
-
|
|
270
|
-
|
|
342
|
+
workflows: "tapp plan workflows [repo] [--save FILE --confirm] [--workflow ID] [--json]",
|
|
343
|
+
explore: "tapp explore [target] [--platform ios|android|web] [--actions N] [--timeout SEC] [--email VALUE] [--password VALUE] [--baseline FILE] [--json FILE]\n --read-only <url>...: never clicks (dead controls, broken links/assets, failed requests, JS exceptions, mixed content, overflow) [--pages N] [--urls FILE] [--json [FILE]]\n --goal \"SCREEN OR CONTROL\": source-locate a screen/control and take the shortest observed route [--project-dir REPO] [--target NAME|PATH] [--map FILE] [--out FILE]\n Web: [--watch] opens Tapp's controlled browser and shows its actions; [--device \"iPhone 13\"] [--viewport 390x844] render at a device profile or explicit size\n iOS: [--device \"iPhone 16\"|UDID] chooses the simulator (required when more than one is booted; TAPP_UDID is the default)\n iOS launch configuration: [--launch-arg VALUE ...] [--launch-env '{\"KEY\":\"VALUE\"}']\n Android: [--app-id ID] [--apk FILE] [--serial ID] [--keep-data]",
|
|
344
|
+
focus: "tapp explore --goal \"SCREEN OR CONTROL\" [target] [--platform ios|android|web] [--project-dir REPO] [--target NAME|PATH] [--map FILE] [--out FILE]",
|
|
271
345
|
init: "tapp init [repo] [--explore] [--refresh] [--platform PLATFORM] [--target NAME] [--url URL] [--watch] [--dry-run]",
|
|
272
|
-
open: "tapp
|
|
273
|
-
tree: "tapp tree [target] [--platform ios|android|web] [--json] [--tap TEXT] [--wait-for TEXT]\n iOS: inspects an installed app; never builds or installs
|
|
274
|
-
shot: "tapp
|
|
346
|
+
open: "tapp look [target] [--platform ios|android|web] [--out FILE] [--tap TEXT] [--wait-for TEXT]\n --tree: accessibility tree of the current screen (--json for every element)\n --sim: screenshot the booted simulator only (never builds or installs)\n iOS: [--device \"iPhone 16\"|UDID] chooses the simulator (required when more than one is booted)\n Web: [--device \"iPhone 13\"] [--viewport 390x844] [--full-page]",
|
|
347
|
+
tree: "tapp look --tree [target] [--platform ios|android|web] [--json] [--tap TEXT] [--wait-for TEXT]\n iOS: inspects an installed app; never builds or installs.\n Web: [--device \"iPhone 13\"] [--viewport 390x844]",
|
|
348
|
+
shot: "tapp look --sim [--out FILE]",
|
|
275
349
|
apps: "tapp apps",
|
|
276
350
|
build: "tapp build [repo] [--scheme NAME] [--configuration NAME]",
|
|
277
|
-
flow: "tapp
|
|
278
|
-
task: "tapp
|
|
279
|
-
contract: "tapp
|
|
280
|
-
scenario: "tapp
|
|
281
|
-
map: "tapp map build MARKERS [--platform PLATFORM] [--out FILE] [--replace]\ntapp map inspect [FILE]\ntapp map diff BEFORE AFTER [--comparable]",
|
|
282
|
-
pr: "tapp pr
|
|
283
|
-
plan: "tapp plan show [FILE]\ntapp plan review [FILE] --approve NAME[,NAME] --reject NAME[,NAME] --defer NAME[,NAME]\ntapp plan generate|validate|promote [FILE] [options]",
|
|
284
|
-
baseline: "tapp baseline
|
|
285
|
-
ci: "tapp ci ...\ntapp ci install [repo] [--out FILE] [--manifest FILE] [--dry-run] [--replace]",
|
|
286
|
-
actor: "tapp actor set NAME --email-env ENV --password-env ENV [--replace] [--project-dir DIR]\ntapp actor list [repo]",
|
|
351
|
+
flow: "tapp run FLOW.yml [--actor NAME] [--email VALUE] [--password VALUE] [--device \"iPhone 13\"] [--viewport 390x844]\n iOS: [--device \"iPhone 16\"|UDID] chooses the simulator (required when more than one is booted; TAPP_UDID is the default) [--launch-arg ARG] [--launch-env JSON]\ntapp validate FLOW.yml [--platform PLATFORM] [--map FILE]\ntapp validate --example print a complete starter Flow YAML\n Exit codes: 0 replay passed · 1 replay failed · 2 infrastructure/usage error",
|
|
352
|
+
task: "tapp validate TASK.yml [--platform PLATFORM] [--map FILE]\ntapp validate TASK.yml --compile --platform PLATFORM [--inputs JSON] [--out FILE]\ntapp run TASK.yml --platform PLATFORM [--url URL|--bundle-id ID|--app-id ID] [--inputs JSON]",
|
|
353
|
+
contract: "tapp validate FILE.contract.ts [--platform PLATFORM] [--map FILE]\ntapp validate FILE.contract.ts --compile --platform PLATFORM [--out FILE]\ntapp run FILE.contract.ts --platform PLATFORM [--url URL|--bundle-id ID|--app-id ID]\n Exit codes: 0 contract held · 1 contract failed · 2 infrastructure/usage error",
|
|
354
|
+
scenario: "tapp validate SCENARIO.yml [--project-dir DIR]\ntapp run SCENARIO.yml --platform web --url URL [--project-dir DIR]\n Exit codes: 0 scenario passed · 1 scenario failed · 2 infrastructure/usage error",
|
|
355
|
+
map: "tapp plan map build MARKERS [--platform PLATFORM] [--out FILE] [--replace]\ntapp plan map inspect [FILE]\ntapp plan map diff BEFORE AFTER [--comparable]",
|
|
356
|
+
pr: "tapp plan pr [--base REF|--changed-files FILE] [--head REF] [--platform PLATFORM] [--out FILE]\ntapp plan adopt PLAN --item ID [--project-dir DIR]",
|
|
357
|
+
plan: "tapp plan show [FILE]\ntapp plan review [FILE] --approve NAME[,NAME] --reject NAME[,NAME] --defer NAME[,NAME]\ntapp plan generate|validate|promote [FILE] [options]\ntapp plan pr --base REF · tapp plan adopt PLAN --item ID · tapp plan workflows [repo] · tapp plan map inspect|diff|build · tapp plan actor set|list",
|
|
358
|
+
baseline: "tapp ci baseline [repo] [--platform PLATFORM] [--target NAME] [--from GATE.json] [--replace]",
|
|
359
|
+
ci: "tapp ci ...\ntapp ci install [repo] [--out FILE] [--manifest FILE] [--dry-run] [--replace]\ntapp ci baseline [repo] [--platform PLATFORM] [--target NAME] [--from GATE.json] [--replace]",
|
|
360
|
+
actor: "tapp plan actor set NAME --email-env ENV --password-env ENV [--replace] [--project-dir DIR]\ntapp plan actor list [repo]",
|
|
287
361
|
app: "tapp app [repo] [--no-open] [--port PORT]",
|
|
288
362
|
report: "tapp report [captureId|latest]",
|
|
289
363
|
feedback: "tapp feedback \"short title\" [--body TEXT|--body-file FILE] [--type bug|idea|question] [--capture ID|latest|none] [--as human] [--submit] [--json]\n Drafts a public GitHub issue on aarwitz/tapp about tapp itself; --submit files it with the authenticated gh CLI.\n Exit codes: 0 drafted or filed · 1 gh submission failed · 2 usage error",
|
|
290
|
-
audit: "tapp
|
|
291
|
-
doctor: "tapp doctor [--json]\n Exit codes: 0 environment healthy · 1 blocked (fix ❌ items)",
|
|
292
|
-
install: "tapp install",
|
|
364
|
+
audit: "tapp explore --read-only <url> [<url>...] [--urls FILE] [--pages N] [--delay MS] [--links N] [--json [FILE]] [--no-capture] [--device NAME] [--viewport WxH]\n Read-only: renders each page and reads it, never clicks — safe to point at production or a site you do not own.\n Finds dead controls, broken images/assets/links, 5xx/failed requests, JS exceptions, mixed content, horizontal overflow.\n --pages N crawls same-origin links (robots.txt honoured, --delay between pages). Writes a capture with screenshots, evidence and report.html.\n Exit codes: 0 nothing broken · 1 defects found · 2 usage/infrastructure",
|
|
365
|
+
doctor: "tapp doctor [--json] [--install]\n --install prebuilds the iOS exploration harness (~2 min; otherwise it builds on first use)\n Exit codes: 0 environment healthy · 1 blocked (fix ❌ items)",
|
|
366
|
+
install: "tapp doctor --install",
|
|
293
367
|
mcp: "tapp mcp",
|
|
294
368
|
};
|
|
295
369
|
return usage[verb] || `tapp ${verb}`;
|
|
@@ -305,15 +379,26 @@ if (["--help", "-h"].includes(command)) {
|
|
|
305
379
|
rest = [];
|
|
306
380
|
}
|
|
307
381
|
const knownCommands = new Set([
|
|
308
|
-
"help", "version", "--version", "-v",
|
|
309
|
-
|
|
310
|
-
"
|
|
382
|
+
"help", "version", "--version", "-v",
|
|
383
|
+
// The twelve public verbs (ADR-0007).
|
|
384
|
+
"explore", "look", "run", "validate", "init", "plan", "ci", "app", "report", "doctor", "mcp", "feedback",
|
|
385
|
+
// Hidden aliases: still resolve, print their new form once.
|
|
386
|
+
"qa", "focus", "audit", "open", "tree", "shot", "screenshot", "flow", "task", "contract", "scenario",
|
|
387
|
+
"pr", "map", "workflows", "actor", "baseline", "install", "studio", "build", "apps",
|
|
311
388
|
]);
|
|
312
389
|
if (!knownCommands.has(command)) {
|
|
313
390
|
console.error(`❌ Unknown command: ${command}`);
|
|
314
391
|
console.error("Run `npx -y @aarwitz/tapp@latest --help` for the command reference.");
|
|
315
392
|
process.exit(2);
|
|
316
393
|
}
|
|
394
|
+
{
|
|
395
|
+
const helpRequested = rest.includes("--help") || rest.includes("-h");
|
|
396
|
+
const resolved = resolveCommand(command, rest);
|
|
397
|
+
if (resolved.note && !helpRequested) console.error(resolved.note);
|
|
398
|
+
command = resolved.command;
|
|
399
|
+
// The resolver may rebuild the argument list; the safe-help guarantee must survive it.
|
|
400
|
+
rest = helpRequested && !resolved.rest.includes("--help") && !resolved.rest.includes("-h") ? [...resolved.rest, "--help"] : resolved.rest;
|
|
401
|
+
}
|
|
317
402
|
const safeHelpRequested = (rest.includes("--help") || rest.includes("-h"))
|
|
318
403
|
&& !["help", "version", "--version", "-v"].includes(command)
|
|
319
404
|
&& (command !== "ci" || rest[0] === "install");
|
|
@@ -328,6 +413,26 @@ if (!["help", "version", "--version", "-v"].includes(command)) {
|
|
|
328
413
|
}
|
|
329
414
|
|
|
330
415
|
switch (command) {
|
|
416
|
+
case "workflows": {
|
|
417
|
+
const {flags,positionals}=parseVerbArgs(rest);
|
|
418
|
+
const projectDir=path.resolve(positionals[0] || process.cwd());
|
|
419
|
+
const {readBusinessWorkflowProject,saveBusinessWorkflowProject}=await import("../mcp-server/src/business-workflow-files.js");
|
|
420
|
+
try {
|
|
421
|
+
if(flags.save) {
|
|
422
|
+
if(typeof flags.save!=="string")throw new Error("--save requires a workflow JSON file");
|
|
423
|
+
const document=JSON.parse(fs.readFileSync(path.resolve(flags.save),"utf8"));
|
|
424
|
+
console.log(JSON.stringify(saveBusinessWorkflowProject({projectDir,document,confirm:flags.confirm===true}),null,2));
|
|
425
|
+
} else {
|
|
426
|
+
const view=readBusinessWorkflowProject({projectDir});
|
|
427
|
+
if(flags.workflow) {
|
|
428
|
+
const plan=view.plans.find(plan=>plan.workflowId===flags.workflow);
|
|
429
|
+
if(!plan)throw new Error("Workflow not found in the saved map");
|
|
430
|
+
console.log(JSON.stringify(plan,null,2));
|
|
431
|
+
} else console.log(JSON.stringify(view,null,2));
|
|
432
|
+
}
|
|
433
|
+
} catch(error) {console.error(error.message);process.exitCode=2;}
|
|
434
|
+
break;
|
|
435
|
+
}
|
|
331
436
|
case "mcp": {
|
|
332
437
|
// Agents spawn `tapp mcp`; the engine module is import-safe, so start explicitly.
|
|
333
438
|
const { startMcpServer } = await engineImport();
|
|
@@ -559,7 +664,7 @@ switch (command) {
|
|
|
559
664
|
const { flags, positionals } = parseVerbArgs(rest);
|
|
560
665
|
const query = positionals[0] || "";
|
|
561
666
|
if (!query) {
|
|
562
|
-
console.error('usage: tapp
|
|
667
|
+
console.error('usage: tapp explore --goal "SCREEN OR CONTROL" [target] [--platform ios|android|web] [--project-dir REPO] [--target NAME|PATH] [--map FILE] [--out FILE]');
|
|
563
668
|
process.exit(2);
|
|
564
669
|
}
|
|
565
670
|
let projectDir;
|
|
@@ -692,11 +797,7 @@ switch (command) {
|
|
|
692
797
|
break;
|
|
693
798
|
}
|
|
694
799
|
|
|
695
|
-
case "explore":
|
|
696
|
-
case "qa": {
|
|
697
|
-
// `explore` is the canonical verb (ADR-0005: exploration observes; the gate judges). `qa` is a
|
|
698
|
-
// hidden deprecated alias.
|
|
699
|
-
if (command === "qa") console.error("note: 'qa' is now 'explore' — 'qa' still works for now.\n");
|
|
800
|
+
case "explore": {
|
|
700
801
|
const { flags, positionals } = parseVerbArgs(rest);
|
|
701
802
|
const launchOptions = iosLaunchOptions(flags, rest);
|
|
702
803
|
let target = positionals[0] || "";
|
|
@@ -816,6 +917,7 @@ switch (command) {
|
|
|
816
917
|
maxActions: flags.actions,
|
|
817
918
|
timeout: flags.timeout,
|
|
818
919
|
args: { testEmail: flags.email, testPassword: flags.password, baselineFindings, ...launchOptions },
|
|
920
|
+
device: typeof flags.device === "string" ? flags.device : "",
|
|
819
921
|
surface: "cli",
|
|
820
922
|
onProgress,
|
|
821
923
|
});
|
|
@@ -901,7 +1003,7 @@ switch (command) {
|
|
|
901
1003
|
}
|
|
902
1004
|
if (sim.autoBooted) console.error(`📱 Booted ${sim.booted.name}`);
|
|
903
1005
|
const bundleId = await resolveTargetOrExit(engine, positionals[0]);
|
|
904
|
-
const r = await engine.openApp(bundleId, {}, 1000);
|
|
1006
|
+
const r = await engine.openApp(bundleId, {}, 1000, { device: typeof flags.device === "string" ? flags.device : "" });
|
|
905
1007
|
if (r.error) {
|
|
906
1008
|
console.error(`❌ ${r.error}`);
|
|
907
1009
|
process.exit(1);
|
|
@@ -1068,7 +1170,7 @@ switch (command) {
|
|
|
1068
1170
|
const verb = positionals[0] || "validate";
|
|
1069
1171
|
const taskPath = positionals[1] ? path.resolve(positionals[1]) : "";
|
|
1070
1172
|
if (!["validate", "compile", "run"].includes(verb) || !taskPath) {
|
|
1071
|
-
console.error("usage: tapp
|
|
1173
|
+
console.error("usage: tapp validate <task.yml> [--platform ios|android|web] [--map .tapp/ui-map.json]\n tapp validate <task.yml> --compile --platform PLATFORM [--inputs '{\"name\":\"value\"}'] [--out compiled.json]\n tapp run <task.yml> --platform PLATFORM [--url URL|--bundle-id ID|--app-id ID] [--inputs JSON]");
|
|
1072
1174
|
process.exit(2);
|
|
1073
1175
|
}
|
|
1074
1176
|
if (!fs.existsSync(taskPath)) { console.error(`❌ Task not found: ${taskPath}`); process.exit(2); }
|
|
@@ -1155,7 +1257,7 @@ switch (command) {
|
|
|
1155
1257
|
break;
|
|
1156
1258
|
}
|
|
1157
1259
|
if (!["run", "validate"].includes(verb) || !flowPath) {
|
|
1158
|
-
console.error("usage: tapp
|
|
1260
|
+
console.error("usage: tapp validate --example\n tapp flow steps [--json]\n tapp run <flow.yml|glob> [...more] [--platform ios|android|web] [--actor NAME] [--email VALUE] [--password VALUE] [--url URL] [--app-id ID] [--apk FILE] [--serial ID]\n tapp validate <flow.yml|glob> [...more]\n Several Flows (or a glob) run in sequence and print one line per Flow; exit 1 if any failed.");
|
|
1159
1261
|
process.exit(2);
|
|
1160
1262
|
}
|
|
1161
1263
|
// Several Flows in one command (field issue #9): the shell usually expands the glob, but a
|
|
@@ -1242,10 +1344,15 @@ switch (command) {
|
|
|
1242
1344
|
const launch = iosLaunchOptions(flags, rest);
|
|
1243
1345
|
if (launch.appLaunchArgs) env.OCQA_APP_LAUNCH_ARGS_JSON = JSON.stringify(launch.appLaunchArgs);
|
|
1244
1346
|
if (launch.appLaunchEnv) env.OCQA_APP_LAUNCH_ENV_JSON = JSON.stringify(launch.appLaunchEnv);
|
|
1347
|
+
// --device is a simulator name or UDID here (issue #31); the runner gets the UDID, and with
|
|
1348
|
+
// several simulators booted and none chosen the run refuses rather than guess.
|
|
1349
|
+
const sim = await (await engineImport()).ensureBootedSim({ device: typeof flags.device === "string" ? flags.device : "" });
|
|
1350
|
+
if (sim.error) { console.error(`❌ ${sim.error}`); process.exit(2); }
|
|
1351
|
+
env.TAPP_UDID = sim.booted.udid;
|
|
1245
1352
|
}
|
|
1246
1353
|
if (typeof flags.email === "string") env.OCQA_TEST_EMAIL = flags.email;
|
|
1247
1354
|
if (typeof flags.password === "string") env.OCQA_TEST_PASSWORD = flags.password;
|
|
1248
|
-
if (typeof flags.device === "string") env.TAPP_WEB_DEVICE = flags.device;
|
|
1355
|
+
if (typeof flags.device === "string" && platform === "web") env.TAPP_WEB_DEVICE = flags.device;
|
|
1249
1356
|
if (typeof flags.viewport === "string") env.TAPP_WEB_VIEWPORT = flags.viewport;
|
|
1250
1357
|
if (typeof flags.actor === "string" && flags.actor) {
|
|
1251
1358
|
const { readProjectConfig } = await import(path.join(packageRoot, "mcp-server", "src", "project-config.js"));
|
|
@@ -1293,7 +1400,7 @@ switch (command) {
|
|
|
1293
1400
|
const verb = positionals[0] || "validate";
|
|
1294
1401
|
const contractPath = positionals[1] ? path.resolve(positionals[1]) : "";
|
|
1295
1402
|
if (!["validate", "compile", "run"].includes(verb) || !contractPath) {
|
|
1296
|
-
console.error("usage: tapp
|
|
1403
|
+
console.error("usage: tapp validate <name.contract.ts> [--platform ios|android|web] [--map .tapp/ui-map.json]\n tapp validate <name.contract.ts> --compile --platform PLATFORM [--out compiled.json]\n tapp run <name.contract.ts> --platform PLATFORM [--url URL|--bundle-id ID|--app-id ID]");
|
|
1297
1404
|
process.exit(2);
|
|
1298
1405
|
}
|
|
1299
1406
|
const {
|
|
@@ -1351,14 +1458,14 @@ switch (command) {
|
|
|
1351
1458
|
const { flags, positionals } = parseVerbArgs(rest);
|
|
1352
1459
|
const verb = positionals[0] || "plan";
|
|
1353
1460
|
if (!['plan', 'adopt'].includes(verb)) {
|
|
1354
|
-
console.error("usage: tapp pr
|
|
1461
|
+
console.error("usage: tapp plan pr --base BASE [--head HEAD] [--project-dir DIR] [--platform PLATFORM] [--map PATH] [--json-out PATH]\n tapp plan pr --changed-files 'src/a.ts,src/b.ts' [options]\n tapp plan pr --changed-files-file /path/to/files.json [options]\n tapp plan adopt <executed-pr-plan.json> --item ID [--project-dir DIR]");
|
|
1355
1462
|
process.exit(2);
|
|
1356
1463
|
}
|
|
1357
1464
|
const projectDir = path.resolve(typeof flags["project-dir"] === "string" ? flags["project-dir"] : process.cwd());
|
|
1358
1465
|
if (verb === "adopt") {
|
|
1359
1466
|
const prPlanPath = positionals[1];
|
|
1360
1467
|
if (!prPlanPath || typeof flags.item !== "string") {
|
|
1361
|
-
console.error("usage: tapp
|
|
1468
|
+
console.error("usage: tapp plan adopt <executed-pr-plan.json> --item ID [--project-dir DIR] [--release-plan PATH]");
|
|
1362
1469
|
process.exit(2);
|
|
1363
1470
|
}
|
|
1364
1471
|
const { adoptPrCoverageProposal } = await import(path.join(packageRoot, "mcp-server", "src", "pr-selection.js"));
|
|
@@ -1421,7 +1528,7 @@ switch (command) {
|
|
|
1421
1528
|
const verb = positionals[0] || "run";
|
|
1422
1529
|
const scenarioPath = positionals[1] || "";
|
|
1423
1530
|
if (!["run", "validate"].includes(verb) || !scenarioPath) {
|
|
1424
|
-
console.error("usage: tapp
|
|
1531
|
+
console.error("usage: tapp run <scenario.yml> [--url URL]\n tapp validate <scenario.yml>");
|
|
1425
1532
|
process.exit(2);
|
|
1426
1533
|
}
|
|
1427
1534
|
const absolute = path.resolve(scenarioPath);
|
|
@@ -1506,7 +1613,7 @@ switch (command) {
|
|
|
1506
1613
|
const beforePath = positionals[1] ? path.resolve(positionals[1]) : "";
|
|
1507
1614
|
const afterPath = positionals[2] ? path.resolve(positionals[2]) : "";
|
|
1508
1615
|
if (!beforePath || !afterPath || !fs.existsSync(beforePath) || !fs.existsSync(afterPath)) {
|
|
1509
|
-
console.error("usage: tapp map diff <before.json> <after.json> [--comparable] [--json out.json]");
|
|
1616
|
+
console.error("usage: tapp plan map diff <before.json> <after.json> [--comparable] [--json out.json]");
|
|
1510
1617
|
process.exit(2);
|
|
1511
1618
|
}
|
|
1512
1619
|
const diff = diffUiMaps(JSON.parse(fs.readFileSync(beforePath, "utf8")), JSON.parse(fs.readFileSync(afterPath, "utf8")), { comparableFullSweep: flags.comparable === true });
|
|
@@ -1515,7 +1622,7 @@ switch (command) {
|
|
|
1515
1622
|
if (!diff.comparableFullSweep && (diff.notObservedNodes.length || diff.notObservedEdges.length)) console.log("ℹ️ Absence is not labeled a regression because the runs were not declared comparable full sweeps.");
|
|
1516
1623
|
process.exit(diff.lostReachability.length || diff.lostTransitions.length ? 1 : 0);
|
|
1517
1624
|
}
|
|
1518
|
-
console.error("usage: tapp map build <ocqa-markers.txt> [--platform ios|android|web] [--out .tapp/ui-map.json]\n tapp map inspect [ui-map.json]\n tapp map diff <before.json> <after.json> [--comparable]");
|
|
1625
|
+
console.error("usage: tapp plan map build <ocqa-markers.txt> [--platform ios|android|web] [--out .tapp/ui-map.json]\n tapp plan map inspect [ui-map.json]\n tapp plan map diff <before.json> <after.json> [--comparable]");
|
|
1519
1626
|
process.exit(2);
|
|
1520
1627
|
}
|
|
1521
1628
|
|
|
@@ -1604,8 +1711,8 @@ switch (command) {
|
|
|
1604
1711
|
let healthy = true;
|
|
1605
1712
|
|
|
1606
1713
|
const major = Number(process.versions.node.split(".")[0]);
|
|
1607
|
-
report.node = { ok: major >=
|
|
1608
|
-
major >=
|
|
1714
|
+
report.node = { ok: major >= 20, version: process.versions.node };
|
|
1715
|
+
major >= 20 ? sayOk("Node", `v${process.versions.node}`) : (sayBad("Node", `v${process.versions.node} (need >= 20; Node 18 reached end of life in April 2025)`), (healthy = false));
|
|
1609
1716
|
|
|
1610
1717
|
const python = run("python3", ["--version"]);
|
|
1611
1718
|
report.python3 = { ok: python.code === 0, version: python.code === 0 ? python.stdout : null };
|
|
@@ -1732,7 +1839,7 @@ switch (command) {
|
|
|
1732
1839
|
const { flags, positionals } = parseVerbArgs(rest);
|
|
1733
1840
|
const verb = positionals[0] || "list";
|
|
1734
1841
|
if (!["list", "set"].includes(verb)) {
|
|
1735
|
-
console.error("usage: tapp actor list [repo] [--json]\n tapp actor set NAME [repo] [--role ROLE] [--session default|isolated] [--provisioning existing|seeded|api|unknown] [--credential name=ENV_NAME] [--email-env ENV_NAME] [--password-env ENV_NAME] [--replace]");
|
|
1842
|
+
console.error("usage: tapp plan actor list [repo] [--json]\n tapp plan actor set NAME [repo] [--role ROLE] [--session default|isolated] [--provisioning existing|seeded|api|unknown] [--credential name=ENV_NAME] [--email-env ENV_NAME] [--password-env ENV_NAME] [--replace]");
|
|
1736
1843
|
process.exit(2);
|
|
1737
1844
|
}
|
|
1738
1845
|
const projectValue = verb === "set" ? positionals[2] : positionals[1];
|
|
@@ -1797,7 +1904,7 @@ switch (command) {
|
|
|
1797
1904
|
const { flags, positionals } = parseVerbArgs(rest);
|
|
1798
1905
|
const verb = positionals[0] || "create";
|
|
1799
1906
|
if (verb !== "create") {
|
|
1800
|
-
console.error("usage: tapp baseline
|
|
1907
|
+
console.error("usage: tapp ci baseline [repo] [--platform ios|android|web] [--target ID|NAME|PATH] [--from gate-report.json] [--replace]\n Without --from, Tapp builds/starts the selected target, runs the full portable gate, and saves only a successful conclusive report.");
|
|
1801
1908
|
process.exit(2);
|
|
1802
1909
|
}
|
|
1803
1910
|
const projectDir = fs.realpathSync(path.resolve(positionals[1] || (typeof flags["project-dir"] === "string" ? flags["project-dir"] : process.cwd())));
|
|
@@ -2087,64 +2194,34 @@ switch (command) {
|
|
|
2087
2194
|
default: {
|
|
2088
2195
|
console.log(`tapp v${pkg.version} — agent-driven app testing for iOS, Android, and web.
|
|
2089
2196
|
|
|
2090
|
-
|
|
2091
|
-
tapp explore [target] Autonomous exploration → findings
|
|
2092
|
-
release decision —
|
|
2093
|
-
(
|
|
2094
|
-
|
|
2095
|
-
tapp
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2197
|
+
Observe — look at the real app (no Tapp account or server required):
|
|
2198
|
+
tapp explore [target] Autonomous exploration → findings, UI map, evidence. An observation, NOT a
|
|
2199
|
+
release decision — 'tapp ci' gates a merge.
|
|
2200
|
+
(--read-only <url>: never clicks, safe on production · --goal "screen": go
|
|
2201
|
+
straight to a named screen · web: --watch · --platform ios|android|web · --actions N)
|
|
2202
|
+
tapp look [target] One screen: summary + screenshot (--tree adds the accessibility tree,
|
|
2203
|
+
--sim screenshots the booted simulator · web: --tap TEXT · --wait-for TEXT)
|
|
2204
|
+
|
|
2205
|
+
Replay — deterministic, keyless:
|
|
2206
|
+
tapp run FILE Replay a committed Flow, Task, release contract, or Scenario
|
|
2207
|
+
(the kind comes from the file; exit 1 when it fails)
|
|
2208
|
+
tapp validate FILE Check a Flow/Task/contract/Scenario without launching anything
|
|
2209
|
+
(--compile shows the executor form · --example prints a starter Flow)
|
|
2210
|
+
|
|
2211
|
+
Release — from model to merge gate:
|
|
2212
|
+
tapp init [repo] Detect targets and write the application model + a reviewable release plan
|
|
2213
|
+
(--explore grounds it on the real app)
|
|
2214
|
+
tapp plan … The release-plan lifecycle: show · review · generate · validate · promote ·
|
|
2215
|
+
pr --base REF · adopt PLAN --item ID · workflows · map inspect|diff · actor set|list
|
|
2216
|
+
tapp ci … Merge-blocking gate: explore + suites + baseline → pass/fail/inconclusive
|
|
2217
|
+
(ci install writes the GitHub workflow · ci baseline saves a conclusive run · see: tapp ci --help)
|
|
2218
|
+
tapp report [capture] Open the HTML evidence page for a run (default: latest)
|
|
2219
|
+
|
|
2220
|
+
Workspace:
|
|
2221
|
+
tapp app [repo] The local Studio: connect a repo, watch it explore, review, gate (loopback-only)
|
|
2222
|
+
tapp doctor Check Xcode / simulators / toolchain (--install prebuilds the iOS harness)
|
|
2223
|
+
tapp mcp Start the MCP server on stdio (inline screenshots + interactive sessions)
|
|
2114
2224
|
tapp feedback "title" Send a bug, idea, or question to the tapp maintainers as a GitHub issue
|
|
2115
|
-
(drafts by default · --submit files it · issues are public)
|
|
2116
|
-
tapp ci install [repo] Generate a reviewable target-aware GitHub workflow + CI manifest
|
|
2117
|
-
tapp actor set NAME Configure an actor using environment-variable names only (never values)
|
|
2118
|
-
tapp actor list [repo] Inspect named actors, sessions, provisioning, and secret env bindings
|
|
2119
|
-
|
|
2120
|
-
Advanced — deterministic suites, lifecycle & compilers:
|
|
2121
|
-
tapp flow example Print a complete starter Flow YAML (no target or MCP required)
|
|
2122
|
-
tapp flow run FILE Replay a committed deterministic Flow (no AI/API key)
|
|
2123
|
-
tapp flow validate FILE Validate a Flow without launching a target
|
|
2124
|
-
tapp task validate FILE Validate a reusable deterministic Task (+ optional UI Map grounding)
|
|
2125
|
-
tapp task compile FILE Compile one Task to the shared keyless Flow execution contract
|
|
2126
|
-
tapp task run FILE Replay a Task directly on iOS, Android, or web
|
|
2127
|
-
tapp contract validate FILE Validate a business-level TypeScript release contract
|
|
2128
|
-
tapp contract compile FILE Compile a contract to the shared deterministic executor
|
|
2129
|
-
tapp scenario run FILE Replay an isolated multi-actor system Scenario (web)
|
|
2130
|
-
tapp scenario validate FILE Validate actors, lifecycle, and deterministic steps
|
|
2131
|
-
tapp pr plan --base REF Select critical + diff-relevant contracts and report uncovered changes
|
|
2132
|
-
tapp pr adopt PLAN --item ID Explicitly add an observed PR coverage proposal to the release plan
|
|
2133
|
-
tapp plan show [FILE] Inspect the proposed/accepted release-contract plan
|
|
2134
|
-
tapp plan review [FILE] Explicitly approve, reject, or defer proposed plan items
|
|
2135
|
-
tapp plan generate [FILE] Generate compile-checked, untrusted contract drafts from approved Tasks
|
|
2136
|
-
tapp plan validate [FILE] Replay drafts on a real target; trust only after all platforms pass
|
|
2137
|
-
tapp plan promote [FILE] Move fully validated drafts into reviewed Tasks/contracts + map coverage
|
|
2138
|
-
tapp map build MARKERS Build/merge the persistent platform-neutral UI Map
|
|
2139
|
-
tapp map inspect [FILE] Inspect states, controls, platforms, and map validity
|
|
2140
|
-
tapp map diff A B Diff observed UI structure without false reachability claims
|
|
2141
|
-
|
|
2142
|
-
Simulator & workspace:
|
|
2143
|
-
tapp shot Screenshot the booted simulator → file path (--out file.jpg)
|
|
2144
|
-
tapp build [dir] Build the iOS app in a repo for the simulator + install it (--scheme S)
|
|
2145
|
-
tapp apps List apps installed on the booted simulator (with bundle ids)
|
|
2146
|
-
tapp app [repo] Optional local browser workspace for repository onboarding and review
|
|
2147
|
-
(loopback-only; --no-open · --port PORT)
|
|
2148
2225
|
|
|
2149
2226
|
[target] is whatever you have — nothing (in an initialized repo, bare 'tapp explore' drives the
|
|
2150
2227
|
application model's default target from source: managed web is built/started/stopped, iOS is
|
|
@@ -2153,11 +2230,6 @@ Simulator & workspace:
|
|
|
2153
2230
|
path/to/App.app, a bundle id, an Android app id/APK (--platform android --app-id ...), or an
|
|
2154
2231
|
http(s) URL. For iOS you never need to know a bundle id up front.
|
|
2155
2232
|
|
|
2156
|
-
Setup:
|
|
2157
|
-
tapp install Prebuild the exploration harness (~2 min; otherwise builds on first use)
|
|
2158
|
-
tapp doctor Check Xcode / simulators / toolchain
|
|
2159
|
-
tapp mcp Start the MCP server on stdio (adds inline screenshots + interactive sessions)
|
|
2160
|
-
|
|
2161
2233
|
Agent Skill (recommended — so a short “Use Tapp to test this app” prompt is enough):
|
|
2162
2234
|
Any supported agent: npx -y skills add aarwitz/tapp --skill tapp
|
|
2163
2235
|
Claude skill + MCP: claude plugin marketplace add aarwitz/tapp
|
|
@@ -2173,6 +2245,9 @@ Then ask your agent things like:
|
|
|
2173
2245
|
"Open the settings screen and show me the screenshot"
|
|
2174
2246
|
"Drive the login flow and record it as a replayable test"
|
|
2175
2247
|
|
|
2248
|
+
Older verbs (audit, focus, open, tree, flow, task, contract, scenario, pr, map, baseline,
|
|
2249
|
+
workflows, actor, install, shot, build, apps) still work and print their new form.
|
|
2250
|
+
|
|
2176
2251
|
Docs: ${pkg.homepage}`);
|
|
2177
2252
|
break;
|
|
2178
2253
|
}
|