@aarwitz/tapp 0.18.3 → 0.19.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/.claude-plugin/plugin.json +2 -2
- package/AGENTS.md +5 -0
- package/bin/tapp.js +113 -6
- package/browser/app.css +5 -3
- package/browser/app.js +102 -7
- package/browser/index.html +11 -11
- package/browser/view-model.js +4 -2
- package/mcp-server/src/browser-product.js +209 -14
- package/mcp-server/src/capture-frames.js +189 -0
- package/mcp-server/src/index.js +73 -2
- package/mcp-server/src/web-audit.js +6 -1
- package/mcp-server/src/web-explorer.js +7 -2
- package/mcp-server/src/web-flow.js +10 -0
- package/package.json +2 -2
- package/skills/tapp/SKILL.md +1 -0
- package/skills/tapp/references/commands.md +7 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tapp",
|
|
3
3
|
"description": "Give Claude hands and eyes on iOS, Android, and web apps, with exploration, replayable flows, evidence, and deterministic CI gates.",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.19.0",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Aaron Horowitz",
|
|
7
7
|
"url": "https://github.com/aarwitz"
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"command": "npx",
|
|
25
25
|
"args": [
|
|
26
26
|
"-y",
|
|
27
|
-
"@aarwitz/tapp@0.
|
|
27
|
+
"@aarwitz/tapp@0.19.0",
|
|
28
28
|
"mcp"
|
|
29
29
|
],
|
|
30
30
|
"cwd": "${CLAUDE_PROJECT_DIR}"
|
package/AGENTS.md
CHANGED
|
@@ -17,6 +17,9 @@ npx -y @aarwitz/tapp@latest explore --goal "SCREEN OR CONTROL" [target] # source
|
|
|
17
17
|
npx -y @aarwitz/tapp@latest explore https://your-app.example --watch # web: visibly follow the same exploration
|
|
18
18
|
npx -y @aarwitz/tapp@latest explore --read-only https://example.com --pages 5 # never clicks: production or a site you do not own
|
|
19
19
|
npx -y @aarwitz/tapp@latest look [target] # launch + screen summary + screenshot saved to a file (≈ tapp_look)
|
|
20
|
+
npx -y @aarwitz/tapp@latest look latest # a finished run: its screens, each with its moment in the recording
|
|
21
|
+
npx -y @aarwitz/tapp@latest look latest --at 6 # one screen's frame, seeked (not scanned) out of the video
|
|
22
|
+
npx -y @aarwitz/tapp@latest look latest --frames # contact sheets — many frames per image, to scan a run cheaply
|
|
20
23
|
npx -y @aarwitz/tapp@latest look [target] --tree # + the accessibility tree, --json for every element
|
|
21
24
|
npx -y @aarwitz/tapp@latest look # no target on iOS: the booted sim as it is → file path
|
|
22
25
|
npx -y @aarwitz/tapp@latest explore app.apk --platform android --app-id com.acme.app
|
|
@@ -70,6 +73,8 @@ installs, returns the bundle id) → `tapp_explore {appBundleId}`.
|
|
|
70
73
|
| "Is this live site / production / a prospect's site broken?" | `tapp_explore {readOnly:true}` (CLI `tapp explore --read-only <url> --pages N`) — read-only: dead controls, broken images/links/assets, failed requests, JS errors, mixed content, overflow; writes a capture with evidence | `tapp_explore` (it clicks, types and submits) |
|
|
71
74
|
| "Make this flow a repeatable test" | drive it in a session, then `tapp_session {action:"save_flow"}`; replay with `tapp_run` | re-driving it by hand every time |
|
|
72
75
|
| "What's on screen right now?" | `tapp_look` | relaunching the app |
|
|
76
|
+
| "What happened during that run?" / "show me the frame where X" | `tapp_look {capture:"latest", at:"<n\|screen>"}` | re-running the app to reproduce something already recorded |
|
|
77
|
+
| "Scan a recording for something odd" | `tapp_look {capture:"latest", frames:true}` (contact sheets) | pulling frames one at a time, or sampling a handful and calling it a look |
|
|
73
78
|
|
|
74
79
|
## Session driving (the Playwright loop)
|
|
75
80
|
|
package/bin/tapp.js
CHANGED
|
@@ -131,6 +131,17 @@ function parseVerbArgs(argv) {
|
|
|
131
131
|
// ADR-0007: twelve public verbs, one engine. The resolver maps the public surface onto the
|
|
132
132
|
// internal case labels below (which keep their original argument shapes), and keeps every older
|
|
133
133
|
// verb working as a hidden alias that names its new form once on stderr.
|
|
134
|
+
// Is this target a finished run rather than something to launch? A capture is a directory with
|
|
135
|
+
// the markers a run writes, addressed by id, by path, or as "latest". Deliberately narrow: a
|
|
136
|
+
// bundle id, a URL, a repo dir and an .apk must all still mean what they meant before.
|
|
137
|
+
function looksLikeCapture(value) {
|
|
138
|
+
const raw = String(value || "").trim();
|
|
139
|
+
if (!raw || raw.startsWith("-") || /^https?:\/\//i.test(raw)) return false;
|
|
140
|
+
if (raw === "latest") return true;
|
|
141
|
+
const marked = (dir) => { try { return fs.existsSync(path.join(dir, "ocqa-markers.txt")); } catch { return false; } };
|
|
142
|
+
return marked(path.resolve(raw)) || marked(path.join(tappHome, "captures", raw));
|
|
143
|
+
}
|
|
144
|
+
|
|
134
145
|
function artifactKind(file) {
|
|
135
146
|
if (!file) return "flow";
|
|
136
147
|
if (/\.ts$/.test(file)) return "contract";
|
|
@@ -156,10 +167,16 @@ function resolveCommand(command, rest) {
|
|
|
156
167
|
if (goal >= 0 && rest[goal + 1] !== undefined) return { command: "focus", rest: [rest[goal + 1], ...rest.slice(0, goal), ...rest.slice(goal + 2)] };
|
|
157
168
|
return { command, rest };
|
|
158
169
|
}
|
|
159
|
-
case "look":
|
|
170
|
+
case "look": {
|
|
171
|
+
// A capture is a target like any other (`report [capture]` already takes one), so looking
|
|
172
|
+
// at a finished run is the same verb as looking at a running app — only the screen is
|
|
173
|
+
// recorded rather than live. See the 2026-10-21 amendment to ADR-0007.
|
|
174
|
+
const subject = rest.find((a) => !a.startsWith("--"));
|
|
175
|
+
if (looksLikeCapture(subject) || has("--frames") || has("--at")) return { command: "frames", rest };
|
|
160
176
|
if (has("--sim")) return { command: "shot", rest: without("--sim") };
|
|
161
177
|
if (has("--tree")) return { command: "tree", rest: without("--tree") };
|
|
162
178
|
return { command: "open", rest };
|
|
179
|
+
}
|
|
163
180
|
case "run":
|
|
164
181
|
return { command: artifactKind(rest.find((a) => !a.startsWith("--"))), rest: ["run", ...rest] };
|
|
165
182
|
case "validate": {
|
|
@@ -343,7 +360,7 @@ function safeCommandUsage(verb) {
|
|
|
343
360
|
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
361
|
focus: "tapp explore --goal \"SCREEN OR CONTROL\" [target] [--platform ios|android|web] [--project-dir REPO] [--target NAME|PATH] [--map FILE] [--out FILE]",
|
|
345
362
|
init: "tapp init [repo] [--explore] [--refresh] [--platform PLATFORM] [--target NAME] [--url URL] [--watch] [--dry-run]",
|
|
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]",
|
|
363
|
+
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 <capture>|latest: the screens of a finished run — [--at N|\"screen\"] one frame, [--frames] contact sheets for scanning, [--json] the index\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
364
|
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
365
|
shot: "tapp look --sim [--out FILE]",
|
|
349
366
|
apps: "tapp apps",
|
|
@@ -2082,11 +2099,37 @@ switch (command) {
|
|
|
2082
2099
|
}
|
|
2083
2100
|
const port = flags.port === undefined ? 0 : Number(flags.port);
|
|
2084
2101
|
if (!Number.isInteger(port) || port < 0 || port > 65535) { console.error("❌ --port must be 0..65535"); process.exit(2); }
|
|
2102
|
+
// --public serves the Studio to anyone who can reach it: no account, a read-only website
|
|
2103
|
+
// audit each, evidence scoped per visitor, and every browser connection forced through the
|
|
2104
|
+
// public-egress proxy. Repositories, live sessions and the gate stay unavailable, because
|
|
2105
|
+
// there is no way to offer them safely to an anonymous visitor on a shared machine.
|
|
2106
|
+
const publicAccess = flags.public === true;
|
|
2107
|
+
const publicOrigin = typeof flags.origin === "string" ? flags.origin : "";
|
|
2108
|
+
// https for anything real; plain http on loopback so the public mode can be dry-run locally
|
|
2109
|
+
// before a tunnel or TLS terminator is in front of it.
|
|
2110
|
+
const localOrigin = /^http:\/\/(?:127\.0\.0\.1|localhost|\[::1\])(?::\d{1,5})?$/.test(publicOrigin);
|
|
2111
|
+
if (publicAccess && !localOrigin && !/^https:\/\/[^\s/]+$/.test(publicOrigin)) {
|
|
2112
|
+
console.error("❌ --public needs --origin https://your.domain (or an http://127.0.0.1:PORT origin to try it locally)");
|
|
2113
|
+
process.exit(2);
|
|
2114
|
+
}
|
|
2115
|
+
if (publicAccess && flags.port === undefined) { console.error("❌ --public needs an explicit --port"); process.exit(2); }
|
|
2085
2116
|
const { startBrowserProduct } = await import(path.join(packageRoot, "mcp-server", "src", "browser-product.js"));
|
|
2086
|
-
const product = await startBrowserProduct({
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2117
|
+
const product = await startBrowserProduct({
|
|
2118
|
+
projectDir, port,
|
|
2119
|
+
launch: !publicAccess && flags.open !== false && flags["no-open"] !== true,
|
|
2120
|
+
...(publicAccess ? { publicAccess: true, publicOrigin } : {}),
|
|
2121
|
+
});
|
|
2122
|
+
if (publicAccess) {
|
|
2123
|
+
console.log(`Tapp · public Studio for ${publicOrigin}`);
|
|
2124
|
+
console.log(`Listening on ${product.origin} — put a TLS terminator or tunnel in front of it.`);
|
|
2125
|
+
console.log("Anonymous visitors may audit a public website read-only. Repositories, live");
|
|
2126
|
+
console.log("sessions and the release gate require an authenticated local session.");
|
|
2127
|
+
console.log("Browser egress is pinned to public addresses; private ranges are refused.");
|
|
2128
|
+
} else {
|
|
2129
|
+
console.log(`Tapp · ${product.root || "choose a local folder or GitHub repository in the browser"}`);
|
|
2130
|
+
console.log(`Open: ${product.launchUrl}`);
|
|
2131
|
+
console.log("Local-only session; press Ctrl-C to stop.");
|
|
2132
|
+
}
|
|
2090
2133
|
const shutdown = async () => { try { await product.close(); } finally { process.exit(0); } };
|
|
2091
2134
|
process.once("SIGINT", shutdown);
|
|
2092
2135
|
process.once("SIGTERM", shutdown);
|
|
@@ -2094,6 +2137,67 @@ switch (command) {
|
|
|
2094
2137
|
break;
|
|
2095
2138
|
}
|
|
2096
2139
|
|
|
2140
|
+
// `tapp look <capture>` — the screens of a finished run. Same verb as looking at a live app;
|
|
2141
|
+
// the screen is recorded rather than in front of us (ADR-0007, amended 2026-10-21).
|
|
2142
|
+
case "frames": {
|
|
2143
|
+
const { flags, positionals } = parseVerbArgs(rest);
|
|
2144
|
+
const { resolveCapture, captureIndex, selectState, extractFrame, contactSheets, writePlayableCopy } =
|
|
2145
|
+
await import(path.join(packageRoot, "mcp-server", "src", "capture-frames.js"));
|
|
2146
|
+
|
|
2147
|
+
const dir = resolveCapture(positionals[0] || "latest");
|
|
2148
|
+
if (!dir) { console.error(`❌ No capture found for ${positionals[0] || "latest"}`); process.exit(2); }
|
|
2149
|
+
const index = captureIndex(dir);
|
|
2150
|
+
|
|
2151
|
+
if (flags.json !== undefined) {
|
|
2152
|
+
const out = typeof flags.json === "string" ? flags.json : "";
|
|
2153
|
+
const payload = JSON.stringify(index, null, 2);
|
|
2154
|
+
if (out) { fs.writeFileSync(out, payload); console.log(`Wrote ${out}`); } else console.log(payload);
|
|
2155
|
+
break;
|
|
2156
|
+
}
|
|
2157
|
+
|
|
2158
|
+
console.log(`📼 ${index.capture} — ${index.states.length} screen(s), ${index.actions} action(s), ${index.findings} finding(s)`);
|
|
2159
|
+
if (index.recording) {
|
|
2160
|
+
console.log(` recording: ${index.recording.file}${index.recording.indexed ? "" : " (no frame index — re-run to seek by screen)"}`);
|
|
2161
|
+
const playable = await writePlayableCopy(index.recording.path).catch(() => null);
|
|
2162
|
+
if (playable) console.log(` playable: ${path.basename(playable)}`);
|
|
2163
|
+
} else {
|
|
2164
|
+
console.log(" recording: none — screenshots only");
|
|
2165
|
+
}
|
|
2166
|
+
|
|
2167
|
+
if (flags.at !== undefined) {
|
|
2168
|
+
const state = selectState(index, flags.at);
|
|
2169
|
+
if (!state) { console.error(`❌ No screen matching '${flags.at}'. Screens: ${index.states.map((x) => `${x.index}:${x.screen}`).join(", ")}`); process.exit(2); }
|
|
2170
|
+
const out = typeof flags.out === "string" ? flags.out : path.join(dir, `frame_${state.index}.png`);
|
|
2171
|
+
const got = await extractFrame(index, state, out);
|
|
2172
|
+
if (!got) { console.error("❌ No frame or screenshot exists for that screen"); process.exit(1); }
|
|
2173
|
+
console.log(`\n${state.index}. ${state.screen}${state.url ? ` ${state.url}` : ""}`);
|
|
2174
|
+
console.log(` ${got.from === "recording" ? `frame at ${(got.atMs / 1000).toFixed(1)}s` : "screenshot"} → ${got.file}`);
|
|
2175
|
+
if (state.findings.length) for (const f of state.findings) console.log(` • ${f.severity} ${f.title}`);
|
|
2176
|
+
break;
|
|
2177
|
+
}
|
|
2178
|
+
|
|
2179
|
+
if (flags.frames) {
|
|
2180
|
+
const out = typeof flags.frames === "string" ? flags.frames : path.join(dir, "frames");
|
|
2181
|
+
const sheets = await contactSheets(index, out);
|
|
2182
|
+
if (!sheets.length) { console.error("❌ Nothing to tile — the run recorded no video and no screenshots"); process.exit(1); }
|
|
2183
|
+
console.log(`\n${sheets.length} contact sheet(s) — many frames per image, for scanning:`);
|
|
2184
|
+
for (const sheet of sheets) console.log(` ${sheet}`);
|
|
2185
|
+
break;
|
|
2186
|
+
}
|
|
2187
|
+
|
|
2188
|
+
// Default: the screens, with where each one is in the recording.
|
|
2189
|
+
console.log("");
|
|
2190
|
+
for (const state of index.states) {
|
|
2191
|
+
const when = state.videoAtMs != null ? `${(state.videoAtMs / 1000).toFixed(1)}s` : state.t != null ? `${(state.t / 1000).toFixed(1)}s` : "—";
|
|
2192
|
+
console.log(`${String(state.index).padStart(2)}. ${when.padStart(7)} ${state.screen}${state.url ? ` ${state.url}` : ""}`);
|
|
2193
|
+
if (state.screenshot) console.log(` ${state.screenshot}`);
|
|
2194
|
+
for (const f of state.findings) console.log(` • ${f.severity} ${f.title}`);
|
|
2195
|
+
}
|
|
2196
|
+
console.log(`\nOne screen: tapp look ${index.capture} --at <n|"screen">`);
|
|
2197
|
+
console.log(`Scan them: tapp look ${index.capture} --frames`);
|
|
2198
|
+
break;
|
|
2199
|
+
}
|
|
2200
|
+
|
|
2097
2201
|
case "report": {
|
|
2098
2202
|
// Regenerate + open the HTML evidence page for a capture (default: the latest).
|
|
2099
2203
|
const capturesDir = path.join(tappHome, "captures");
|
|
@@ -2201,6 +2305,9 @@ Observe — look at the real app (no Tapp account or server required):
|
|
|
2201
2305
|
straight to a named screen · web: --watch · --platform ios|android|web · --actions N)
|
|
2202
2306
|
tapp look [target] One screen: summary + screenshot (--tree adds the accessibility tree,
|
|
2203
2307
|
--sim screenshots the booted simulator · web: --tap TEXT · --wait-for TEXT)
|
|
2308
|
+
A capture id, a capture path, or 'latest' reads a finished run instead:
|
|
2309
|
+
its screens with the moment each was reached (--at N|"screen" pulls one
|
|
2310
|
+
frame · --frames tiles many frames per image for scanning · --json)
|
|
2204
2311
|
|
|
2205
2312
|
Replay — deterministic, keyless:
|
|
2206
2313
|
tapp run FILE Replay a committed Flow, Task, release contract, or Scenario
|
package/browser/app.css
CHANGED
|
@@ -485,15 +485,17 @@ dialog::backdrop { background:rgba(0,0,0,.6); }
|
|
|
485
485
|
.command-actions { display:flex; align-items:center; gap:10px; }
|
|
486
486
|
.idle-badges { display:flex; gap:6px; } .idle-badges span { padding:4px 9px; border-radius:999px; border:1px solid var(--tapp-border); color:var(--tapp-text-soft); font-size:11.5px; white-space:nowrap; } .idle-badges span b { color:var(--tapp-text); font-weight:600; }
|
|
487
487
|
.stage { position:relative; height:calc(100vh - 150px); min-height:460px; display:grid; place-items:center; margin:0 0 18px; border-radius:var(--tapp-radius-xl); background:radial-gradient(ellipse at 50% 40%, rgba(31,121,255,.08), transparent 60%), var(--tapp-bg-deep, var(--tapp-bg)); border:1px solid var(--tapp-border); overflow:hidden; }
|
|
488
|
-
.device-stage { height:100%; width:100%; display:grid; grid-template-rows:1fr auto; place-items:center; padding:18px 18px 10px; box-sizing:border-box; }
|
|
488
|
+
.device-stage { height:100%; width:100%; display:grid; grid-template-rows:minmax(0,1fr) auto; place-items:center; padding:18px 18px 10px; box-sizing:border-box; }
|
|
489
|
+
.device-stage > .device-frame { min-height:0; }
|
|
489
490
|
.device-frame { position:relative; max-height:100%; max-width:100%; height:100%; aspect-ratio:9/19.3; border-radius:40px; background:#0b1118; border:1px solid var(--tapp-border-strong); box-shadow:var(--tapp-shadow); padding:12px; box-sizing:border-box; }
|
|
490
|
-
.device-frame .notch {
|
|
491
|
+
.device-frame .notch { display:none; }
|
|
491
492
|
.device-frame .device-screen { position:relative; width:100%; height:100%; border-radius:28px; overflow:hidden; background:#000; }
|
|
492
493
|
.device-frame.android { aspect-ratio:9/19; border-radius:30px; } .device-frame.android .device-screen { border-radius:20px; } .device-frame.android .notch { width:12px; height:12px; border-radius:50%; top:14px; }
|
|
493
494
|
.device-frame.web { aspect-ratio:16/11; height:100%; width:auto; max-width:100%; border-radius:14px; padding:26px 6px 6px; } .device-frame.web .device-screen { border-radius:8px; background:#f4f7f9; }
|
|
494
495
|
.device-frame.web .notch { width:auto; height:auto; left:12px; top:8px; transform:none; background:none; } .device-frame.web .notch::before { content:""; display:block; width:38px; height:10px; border-radius:5px; background:repeating-linear-gradient(90deg, #ff5f57 0 10px, transparent 10px 14px, #febc2e 14px 24px, transparent 24px 28px, #28c840 28px 38px); }
|
|
495
496
|
.stage.web .device-stage { align-content:center; }
|
|
496
|
-
|
|
497
|
+
/* Absolute, so the frame's size comes from the stage height and the aspect ratio, never from the image's pixels. */
|
|
498
|
+
.device-screen img { position:absolute; inset:0; display:block; width:100%; height:100%; object-fit:contain; object-position:top center; background:#000; }
|
|
497
499
|
.device-screen #live-frame-loading, .device-placeholder { position:absolute; inset:0; display:grid; place-items:center; padding:24px; text-align:center; color:var(--tapp-text-soft); font-size:12.5px; background:var(--tapp-panel-2); }
|
|
498
500
|
.device-placeholder strong { display:block; margin-bottom:4px; color:var(--tapp-text); font-size:13px; }
|
|
499
501
|
.device-meta { display:flex; gap:14px; color:var(--tapp-text-faint); font-size:11.5px; padding-top:8px; } .device-meta span:first-child { color:var(--tapp-text-soft); font-weight:600; }
|
package/browser/app.js
CHANGED
|
@@ -59,7 +59,8 @@ function reportLink(report, label) { return evidenceLink(captureId(report), labe
|
|
|
59
59
|
|
|
60
60
|
function currentTarget() { return (state.project?.targets || []).find((target) => target.id === state.selectedTargetId) || null; }
|
|
61
61
|
function targetStorageKey() { return `tapp:selected-target:${state.project?.repository?.id || "none"}`; }
|
|
62
|
-
|
|
62
|
+
// A run started from the prompt is on its own platform, whatever repository happens to be open.
|
|
63
|
+
function currentPlatform() { return state.live?.active ? state.live.platform : (state.promptRun && state.promptPlatform) || currentTarget()?.platform || state.promptPlatform || ""; }
|
|
63
64
|
|
|
64
65
|
function chooseDefaultTarget() {
|
|
65
66
|
const targets = state.project?.targets || [];
|
|
@@ -87,6 +88,29 @@ function activateView(view) {
|
|
|
87
88
|
window.scrollTo({ top:0, behavior:"instant" });
|
|
88
89
|
}
|
|
89
90
|
|
|
91
|
+
// A hosted Studio has no Mac, no simulator and no access to the visitor's disk, so folders,
|
|
92
|
+
// bundle ids and builds cannot work there however the prompt is worded. Offer only what this
|
|
93
|
+
// deployment can actually do, and say where the rest runs, rather than failing after the ask.
|
|
94
|
+
function applyAccessMode() {
|
|
95
|
+
const session = state.session || {};
|
|
96
|
+
if (session.access !== "anonymous") return;
|
|
97
|
+
const accepts = new Set(session.accepts || ["url"]);
|
|
98
|
+
for (const button of document.querySelectorAll("[data-kind]")) {
|
|
99
|
+
const kind = button.dataset.kind;
|
|
100
|
+
const usable = kind === "url" ? accepts.has("url") : accepts.has(kind);
|
|
101
|
+
button.closest("li")?.classList.toggle("hidden", !usable);
|
|
102
|
+
}
|
|
103
|
+
const input = $("#prompt-input");
|
|
104
|
+
if (input) input.placeholder = "A website URL…";
|
|
105
|
+
// Everything that only means something against a source repository: a target to build, a
|
|
106
|
+
// runner, a release gate, a decision. A hosted visitor auditing a URL has none of them, and
|
|
107
|
+
// showing the empty frames makes a working run look like a broken one.
|
|
108
|
+
for (const node of document.querySelectorAll("[data-repo-only]")) node.classList.add("hidden");
|
|
109
|
+
setHeading("tapp", "Give it a public website and it will audit the pages read-only.");
|
|
110
|
+
const note = $("#privacy-note-detail");
|
|
111
|
+
if (note) note.textContent = "Websites are audited read-only in the cloud; nothing is clicked. iOS, Android and folders on your own machine need tapp there: npx -y @aarwitz/tapp@latest app";
|
|
112
|
+
}
|
|
113
|
+
|
|
90
114
|
function showPrompt() {
|
|
91
115
|
$("#source-onboarding").classList.remove("hidden");
|
|
92
116
|
$("#product-shell").classList.add("hidden");
|
|
@@ -159,7 +183,7 @@ function renderDeviceChrome() {
|
|
|
159
183
|
$("#device-frame").className = `device-frame ${platform || "ios"}`;
|
|
160
184
|
$("#stage").className = `stage ${platform || "ios"}`;
|
|
161
185
|
$("#device-feed-label").textContent = platform === "android" ? "Android" : platform === "web" ? "Chromium" : "iPhone";
|
|
162
|
-
$("#device-meta-device").textContent = platform === "ios" ? (target?.runtime?.surface || "iOS Simulator")
|
|
186
|
+
$("#device-meta-device").textContent = platform === "ios" ? ((!state.promptRun && target?.runtime?.surface) || "iOS Simulator")
|
|
163
187
|
: platform === "android" ? (target?.runtime?.serial || "Android emulator / device")
|
|
164
188
|
: platform === "web" ? "Local Chromium" : "—";
|
|
165
189
|
}
|
|
@@ -369,7 +393,8 @@ function syncTranscriptFromJob(name, job) {
|
|
|
369
393
|
}
|
|
370
394
|
|
|
371
395
|
function startLine(name, job) {
|
|
372
|
-
const
|
|
396
|
+
const raw = job.input || "";
|
|
397
|
+
const input = /\.(app|apk)$/i.test(raw) ? raw.split("/").filter(Boolean).at(-1) : raw;
|
|
373
398
|
return { initialize: "Starting a release check — build, launch and explore the real app", gate: "Running the release gate", audit: `Opening ${input} read-only — nothing will be clicked`, "explore-build": `Exploring ${input} on the booted device`, open: `Opening ${input}`, "session-start": "Opening a live session", "session-act": "Acting in the live session", "session-save-flow": "Saving the journey as a Flow", "session-end": "Ending the live session" }[name] || `${pretty(name)} started`;
|
|
374
399
|
}
|
|
375
400
|
|
|
@@ -384,7 +409,17 @@ async function finishTranscript(name, job) {
|
|
|
384
409
|
if (id) {
|
|
385
410
|
try {
|
|
386
411
|
const files = await api(`/api/captures/${encodeURIComponent(id)}/files`);
|
|
387
|
-
if (files.shots?.length)
|
|
412
|
+
if (files.shots?.length) {
|
|
413
|
+
pushLine({ kind: "shots", shots: files.shots.slice(0, 3).map((shot) => ({ src: captureUrl(id, shot.src), href: captureUrl(id, shot.src), caption: shot.caption })) });
|
|
414
|
+
// The stage keeps the run's final screen until something newer replaces it.
|
|
415
|
+
if (!state.live?.active) {
|
|
416
|
+
const last = files.shots.at(-1);
|
|
417
|
+
const image = $("#live-frame-image");
|
|
418
|
+
image.onload = () => { $("#live-frame-loading").classList.add("hidden"); $("#device-placeholder").classList.add("hidden"); };
|
|
419
|
+
image.src = captureUrl(id, last.src);
|
|
420
|
+
$("#live-screen-title").textContent = last.caption || "";
|
|
421
|
+
}
|
|
422
|
+
}
|
|
388
423
|
const items = [];
|
|
389
424
|
if (files.recording) items.push({ icon: "🎬", label: files.recording, href: captureUrl(id, files.recording) });
|
|
390
425
|
if (files.report) items.push({ icon: "📄", label: "report.html", href: captureUrl(id, files.report) });
|
|
@@ -460,9 +495,21 @@ async function refreshSession() {
|
|
|
460
495
|
$("#mode-pill").textContent = local ? "Self-host · this machine" : "Cloud · outbound runner";
|
|
461
496
|
$("#onboarding-mode-pill").textContent = local ? "Self-host · this machine" : "Cloud";
|
|
462
497
|
$("#privacy-note-detail").textContent = local ? "Everything runs on this machine. Exploration, replay and merge decisions are deterministic and need no API key." : "Your repository stays in your private Tapp workspace.";
|
|
498
|
+
applyAccessMode();
|
|
463
499
|
}
|
|
464
500
|
|
|
465
501
|
async function refresh() {
|
|
502
|
+
// A public visitor has no project and no live session, and asking for them would only earn a
|
|
503
|
+
// 401 on every poll.
|
|
504
|
+
if (state.session?.access === "anonymous") {
|
|
505
|
+
const runs = await api("/api/audits").catch(() => ({ audits: [], explores: [] }));
|
|
506
|
+
state.project = { connected:false };
|
|
507
|
+
state.live = { active:false };
|
|
508
|
+
state.audits = runs.audits || [];
|
|
509
|
+
state.explores = runs.explores || [];
|
|
510
|
+
renderProject();
|
|
511
|
+
return;
|
|
512
|
+
}
|
|
466
513
|
const [project, live, runs] = await Promise.all([api("/api/project"), api("/api/live-session"), api("/api/audits").catch(() => ({ audits: [], explores: [] }))]);
|
|
467
514
|
state.project = project;
|
|
468
515
|
state.live = live;
|
|
@@ -522,12 +569,37 @@ async function runOperation(name, body = {}, { input = "" } = {}) {
|
|
|
522
569
|
|
|
523
570
|
// "What should tapp test?" — route by what was typed. The server classifies again and refuses
|
|
524
571
|
// what the mode cannot do (a hosted Studio cannot open a path on your machine).
|
|
572
|
+
function setHeading(title, summary) {
|
|
573
|
+
const heading = $("#app-name");
|
|
574
|
+
if (heading) heading.textContent = title;
|
|
575
|
+
const note = $("#app-summary");
|
|
576
|
+
if (note) note.textContent = summary;
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
// Some targets simply cannot run where this Studio is running — a folder on someone's disk, a
|
|
580
|
+
// simulator build, a repository that needs a toolchain. The engine answers with where they do
|
|
581
|
+
// run; show that answer where it stays put, not in a toast that disappears in six seconds.
|
|
582
|
+
function answerSelfHost(answer) {
|
|
583
|
+
setHeading("Run this on your machine", "The cloud Studio audits websites; this target needs your toolchain.");
|
|
584
|
+
document.querySelector(".summary-panel")?.classList.add("hidden");
|
|
585
|
+
document.querySelector(".device-stage")?.classList.add("hidden");
|
|
586
|
+
state.transcript = [];
|
|
587
|
+
pushLine({ kind: "step", icon: "🖥️", text: answer.message });
|
|
588
|
+
if (answer.command) pushLine({ kind: "step", icon: "⌨️", text: answer.command });
|
|
589
|
+
renderChat();
|
|
590
|
+
setChatCollapsed(false);
|
|
591
|
+
toast(answer.message, true);
|
|
592
|
+
}
|
|
593
|
+
|
|
525
594
|
async function startFromPrompt(raw) {
|
|
526
595
|
const prompt = classifyPrompt(raw);
|
|
527
596
|
if (prompt.kind === "empty") return;
|
|
528
597
|
if (prompt.kind === "url") {
|
|
529
598
|
state.promptRun = true; state.promptPlatform = "web";
|
|
530
599
|
showProduct(); activateView("overview"); renderDeviceChrome(); renderChat();
|
|
600
|
+
document.querySelector(".device-stage")?.classList.remove("hidden");
|
|
601
|
+
document.querySelector(".summary-panel")?.classList.remove("hidden");
|
|
602
|
+
if (state.session?.access === "anonymous") setHeading("Website audit", "Read-only. Nothing on the page is clicked.");
|
|
531
603
|
const result = await runOperation("audit", { url: prompt.value }, { input: prompt.value });
|
|
532
604
|
state.selectedRunId = result?.capture?.id || state.selectedRunId;
|
|
533
605
|
return;
|
|
@@ -536,11 +608,14 @@ async function startFromPrompt(raw) {
|
|
|
536
608
|
state.promptRun = true; state.promptPlatform = prompt.kind === "apk" ? "android" : "ios";
|
|
537
609
|
showProduct(); activateView("overview"); renderDeviceChrome(); renderChat();
|
|
538
610
|
const result = await runOperation("explore-build", { input: prompt.value }, { input: prompt.value });
|
|
611
|
+
if (result?.kind === "self-host") { answerSelfHost(result); return; }
|
|
539
612
|
state.selectedRunId = result?.capture?.id || state.selectedRunId;
|
|
540
613
|
return;
|
|
541
614
|
}
|
|
615
|
+
showProduct(); activateView("overview"); renderChat();
|
|
542
616
|
const answer = await runOperation("open", { input: prompt.value }, { input: prompt.value });
|
|
543
|
-
if (answer?.kind === "
|
|
617
|
+
if (answer?.kind === "self-host") { answerSelfHost(answer); return; }
|
|
618
|
+
if (answer?.kind === "business") { answerSelfHost({ message: answer.message }); return; }
|
|
544
619
|
await refreshSession();
|
|
545
620
|
await refresh();
|
|
546
621
|
state.selectedTargetId = "";
|
|
@@ -587,14 +662,14 @@ document.addEventListener("submit", (event) => {
|
|
|
587
662
|
});
|
|
588
663
|
|
|
589
664
|
$$("[data-brand-home]").forEach((button) => button.addEventListener("click", () => state.project?.connected ? (showProduct(), activateView("overview")) : showPrompt()));
|
|
590
|
-
$("#command-run").addEventListener("click", () => runOperation("initialize", operationPayload({ explore:true })).catch((error) => toast(error.message, true)));
|
|
665
|
+
$("#command-run").addEventListener("click", () => { state.promptRun = false; runOperation("initialize", operationPayload({ explore:true })).catch((error) => toast(error.message, true)); });
|
|
591
666
|
$("#refresh-project").addEventListener("click", () => refresh().catch((error) => toast(error.message, true)));
|
|
592
667
|
$("#change-source").addEventListener("click", showPrompt);
|
|
593
668
|
$("#chat-toggle").addEventListener("click", () => setChatCollapsed(!state.chatCollapsed));
|
|
594
669
|
$("#repository-switcher").addEventListener("change", async (event) => {
|
|
595
670
|
try { await api("/api/repositories/select", { method:"POST", body:JSON.stringify({ id:event.target.value }) }); state.selectedTargetId = ""; await refreshSession(); await refresh(); } catch (error) { toast(error.message, true); }
|
|
596
671
|
});
|
|
597
|
-
$("#explore").addEventListener("click", () => runOperation("initialize", operationPayload({ explore:true })).catch((error) => toast(error.message, true)));
|
|
672
|
+
$("#explore").addEventListener("click", () => { state.promptRun = false; runOperation("initialize", operationPayload({ explore:true })).catch((error) => toast(error.message, true)); });
|
|
598
673
|
$("#start-session").addEventListener("click", () => runOperation("session-start", operationPayload()).catch((error) => toast(error.message, true)));
|
|
599
674
|
$("#refresh-live-session").addEventListener("click", () => runOperation("session-act", { action:"tree" }).catch((error) => toast(error.message, true)));
|
|
600
675
|
$("#end-session").addEventListener("click", () => runOperation("session-end").catch((error) => toast(error.message, true)));
|
|
@@ -605,9 +680,29 @@ $("#live-back").addEventListener("click", () => runOperation("session-act", { ac
|
|
|
605
680
|
$("#live-swipe").addEventListener("click", () => runOperation("session-act", { action:"swipe", direction:"up" }).catch((error) => toast(error.message, true)));
|
|
606
681
|
$("#run-gate").addEventListener("click", () => runOperation("gate", operationPayload()).catch((error) => toast(error.message, true)));
|
|
607
682
|
|
|
683
|
+
// runtapp.com's hero is the same prompt as this screen, so it hands the target over as
|
|
684
|
+
// ?target=... Prefill it and start the run, so arriving here does not mean retyping what was
|
|
685
|
+
// already typed on the landing page. The URL is cleaned up either way so a refresh does not
|
|
686
|
+
// silently re-run it.
|
|
687
|
+
function handoffTarget() {
|
|
688
|
+
let target = "";
|
|
689
|
+
try { target = new URLSearchParams(window.location.search).get("target") || ""; } catch { return ""; }
|
|
690
|
+
target = target.trim().slice(0, 512);
|
|
691
|
+
if (!target) return "";
|
|
692
|
+
try { window.history.replaceState({}, "", window.location.pathname); } catch { /* history may be unavailable */ }
|
|
693
|
+
return target;
|
|
694
|
+
}
|
|
695
|
+
|
|
608
696
|
try {
|
|
609
697
|
try { setChatCollapsed(localStorage.getItem("tapp:chat-collapsed") === "1"); } catch { /* storage may be unavailable */ }
|
|
610
698
|
await refreshSession();
|
|
611
699
|
await refresh();
|
|
612
700
|
if (state.project?.connected && !state.project?.state?.inspected) await runOperation("initialize", { write:true });
|
|
701
|
+
|
|
702
|
+
const handoff = handoffTarget();
|
|
703
|
+
if (handoff) {
|
|
704
|
+
const input = $("#prompt-input");
|
|
705
|
+
if (input) input.value = handoff;
|
|
706
|
+
await startFromPrompt(handoff);
|
|
707
|
+
}
|
|
613
708
|
} catch (error) { toast(error.message, true); }
|
package/browser/index.html
CHANGED
|
@@ -56,10 +56,10 @@
|
|
|
56
56
|
<button class="primary prompt-go" type="submit" id="prompt-start" aria-label="Start">→</button>
|
|
57
57
|
</form>
|
|
58
58
|
<ul class="prompt-suggestions" aria-label="Examples">
|
|
59
|
-
<li><button type="button" data-prompt="https://example.com"><span>⌁</span><b>https://example.com</b><small>audit a website read-only — safe on production, nothing is clicked</small></button></li>
|
|
60
|
-
<li><button type="button" data-prompt="~/code/my-app"><span>⌘</span><b>~/code/my-app</b><small>open a repo folder on this Mac — detects iOS, Android and web targets, builds locally</small></button></li>
|
|
61
|
-
<li><button type="button" data-prompt="owner/repo"><span>🐙</span><b>owner/repo</b><small>clone from GitHub into an isolated workspace, then the same</small></button></li>
|
|
62
|
-
<li><button type="button" data-prompt="com.company.app"><span>📱</span><b>com.company.app</b><small>explore a build already on the booted simulator (or give a .app / .apk)</small></button></li>
|
|
59
|
+
<li><button type="button" data-kind="url" data-prompt="https://example.com"><span>⌁</span><b>https://example.com</b><small>audit a website read-only — safe on production, nothing is clicked</small></button></li>
|
|
60
|
+
<li><button type="button" data-kind="path" data-prompt="~/code/my-app"><span>⌘</span><b>~/code/my-app</b><small>open a repo folder on this Mac — detects iOS, Android and web targets, builds locally</small></button></li>
|
|
61
|
+
<li><button type="button" data-kind="github" data-prompt="owner/repo"><span>🐙</span><b>owner/repo</b><small>clone from GitHub into an isolated workspace, then the same</small></button></li>
|
|
62
|
+
<li><button type="button" data-kind="build" data-prompt="com.company.app"><span>📱</span><b>com.company.app</b><small>explore a build already on the booted simulator (or give a .app / .apk)</small></button></li>
|
|
63
63
|
</ul>
|
|
64
64
|
<p class="prompt-note" id="privacy-note-detail">Everything runs on this machine. Exploration, replay and merge decisions are deterministic and need no API key.</p>
|
|
65
65
|
<span class="sr-only" id="privacy-note-title">Your code stays on this machine.</span>
|
|
@@ -80,9 +80,9 @@
|
|
|
80
80
|
<div class="sidebar-project">
|
|
81
81
|
<p class="eyebrow">Project</p>
|
|
82
82
|
<div class="row"><span><svg><use href="#i-folder"/></svg></span><span><strong id="sidebar-project-name">Product</strong></span></div>
|
|
83
|
-
<div class="row"><span><svg><use href="#i-branch"/></svg></span><span id="sidebar-project-source">Repository</span></div>
|
|
84
|
-
<div class="row"><span><svg><use href="#i-target"/></svg></span><span id="sidebar-target">Select a target</span></div>
|
|
85
|
-
<div class="row"><span><svg><use href="#i-server"/></svg></span><span id="sidebar-runner">Runner not checked</span></div>
|
|
83
|
+
<div class="row" data-repo-only><span><svg><use href="#i-branch"/></svg></span><span id="sidebar-project-source">Repository</span></div>
|
|
84
|
+
<div class="row" data-repo-only><span><svg><use href="#i-target"/></svg></span><span id="sidebar-target">Select a target</span></div>
|
|
85
|
+
<div class="row" data-repo-only><span><svg><use href="#i-server"/></svg></span><span id="sidebar-runner">Runner not checked</span></div>
|
|
86
86
|
<div class="row hidden" id="sidebar-app-row"><span><svg><use href="#i-app"/></svg></span><span><code id="sidebar-app-id"></code></span></div>
|
|
87
87
|
<span class="mode-pill" id="mode-pill">Self-host · this machine</span>
|
|
88
88
|
</div>
|
|
@@ -99,7 +99,7 @@
|
|
|
99
99
|
<div class="command-actions">
|
|
100
100
|
<span class="phase-pill hidden" id="phase-pill"><span class="spinner"></span><span id="phase-pill-text">Working…</span></span>
|
|
101
101
|
<div class="idle-badges" id="idle-badges"></div>
|
|
102
|
-
<button class="primary" id="command-run">Run release check</button>
|
|
102
|
+
<button class="primary" id="command-run" data-repo-only>Run release check</button>
|
|
103
103
|
</div>
|
|
104
104
|
</div>
|
|
105
105
|
<div class="run-progress hidden" id="run-progress"><span class="progress-track"><span id="run-progress-bar"></span></span><span id="run-progress-text">Starting…</span></div>
|
|
@@ -127,7 +127,7 @@
|
|
|
127
127
|
</aside>
|
|
128
128
|
</section>
|
|
129
129
|
|
|
130
|
-
<section class="panel section" id="target-stage">
|
|
130
|
+
<section class="panel section" id="target-stage" data-repo-only>
|
|
131
131
|
<div class="section-heading"><div><p class="eyebrow">Build & run</p><h2>Choose the product target</h2><p>Tapp detected these targets from source. With more than one, you choose; nothing builds until you do.</p></div><span class="status-chip" id="target-status">No target selected</span></div>
|
|
132
132
|
<div class="target-choice-callout hidden" id="target-choice-callout"><span>1</span><div><strong>Choose what Tapp should test</strong><small>Nothing will build until you select a target. Tapp never guesses when a repository contains multiple applications.</small></div></div>
|
|
133
133
|
<div id="targets" class="target-grid"><div class="empty">Inspecting the repository for iOS, Android and web targets…</div></div>
|
|
@@ -147,12 +147,12 @@
|
|
|
147
147
|
</section>
|
|
148
148
|
|
|
149
149
|
<section class="overview-grid">
|
|
150
|
-
<article class="panel summary-panel"><div class="section-heading compact"><div><p class="eyebrow">Latest evidence</p><h2>What the last run proved</h2></div><button class="quiet" data-view="runs">All runs</button></div><div class="decision-card neutral" id="decision-card"><span class="decision-label">CURRENT DECISION</span><strong id="decision-title">Not evaluated</strong><span id="decision-detail">Run a conclusive release gate to establish evidence.</span></div><div id="overview-evidence"><div class="empty">No run yet.</div></div></article>
|
|
150
|
+
<article class="panel summary-panel"><div data-repo-only-marker></div><div class="section-heading compact"><div><p class="eyebrow">Latest evidence</p><h2>What the last run proved</h2></div><button class="quiet" data-view="runs">All runs</button></div><div class="decision-card neutral" id="decision-card" data-repo-only><span class="decision-label">CURRENT DECISION</span><strong id="decision-title">Not evaluated</strong><span id="decision-detail">Run a conclusive release gate to establish evidence.</span></div><div id="overview-evidence"><div class="empty">No run yet.</div></div></article>
|
|
151
151
|
</section>
|
|
152
152
|
</section>
|
|
153
153
|
|
|
154
154
|
<section class="workspace-view" data-view-panel="runs">
|
|
155
|
-
<div class="view-heading simple"><div><p class="eyebrow">Runs</p><h1>Every run, with its evidence</h1><p>Release checks, explorations and read-only website audits. Each opens the report page the engine wrote.</p></div><button class="primary" id="run-gate">Run release gate</button></div>
|
|
155
|
+
<div class="view-heading simple"><div><p class="eyebrow">Runs</p><h1>Every run, with its evidence</h1><p>Release checks, explorations and read-only website audits. Each opens the report page the engine wrote.</p></div><button class="primary" id="run-gate" data-repo-only>Run release gate</button></div>
|
|
156
156
|
<section class="panel section audit-panel">
|
|
157
157
|
<div class="section-heading compact"><div><p class="eyebrow">Website</p><h2>Audit a website — read-only</h2><p>Up to six pages, nothing clicked. Safe on production or a site you do not own; no release verdict without source.</p></div></div>
|
|
158
158
|
<form class="audit-form" id="runs-audit-form">
|
package/browser/view-model.js
CHANGED
|
@@ -41,8 +41,10 @@ const RULES = [
|
|
|
41
41
|
[/^(?:Reached|Navigated to|Now on) /i, "🧭"],
|
|
42
42
|
[/^(?:Tapped|Tap(?:ping)?|Clicked|Pressed) /i, "👆"],
|
|
43
43
|
[/^(?:Typed|Filled|Entered|Type) /i, "⌨️"],
|
|
44
|
-
[/^(?:Swiped|Scrolled)/i, "↕️"],
|
|
45
|
-
[/^(?:Went back|Back)/i, "◀️"],
|
|
44
|
+
[/^(?:Swiped|Swiping|Edge-swiping|Scrolled|Scrolling)/i, "↕️"],
|
|
45
|
+
[/^(?:Went back|Back|Finished with .* going back|Going back)/i, "◀️"],
|
|
46
|
+
[/^(?:Probing|Looking for|Checking)/i, "🔎"],
|
|
47
|
+
[/^(?:Switching to|Switched to)/i, "🗂️"],
|
|
46
48
|
[/sign(?:ed|ing)? in|login|logged in|credentials/i, "🔐"],
|
|
47
49
|
[/screenshot|captured frame|snapshot/i, "📸"],
|
|
48
50
|
[/^(?:Building|Compiling|Build )/i, "🔨"],
|