ripplo 0.9.1 → 0.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-UMSBDSRS.js → chunk-3FF33GCX.js} +1 -1
- package/dist/chunk-3LYVTLBJ.js +4 -0
- package/dist/{chunk-MMCOPC4L.js → chunk-4KOWK5QE.js} +1 -1
- package/dist/{chunk-CDPYJKK7.js → chunk-5E62BCS7.js} +2 -2
- package/dist/{chunk-YODZBLYM.js → chunk-BMRZGLUF.js} +5 -5
- package/dist/{chunk-MG43RZXH.js → chunk-IGPHRN4A.js} +3 -3
- package/dist/{chunk-NEPJCCQS.js → chunk-IL452KDO.js} +1 -1
- package/dist/{chunk-SFWAAS5H.js → chunk-KYMYKILH.js} +1 -1
- package/dist/{chunk-TY5K3P4F.js → chunk-SI42TC5O.js} +1 -1
- package/dist/{chunk-RWFS5SCW.js → chunk-SWYJTSC3.js} +1 -1
- package/dist/{chunk-4XC5TAOG.js → chunk-UDQKJVLD.js} +1 -1
- package/dist/{chunk-6BQADUAX.js → chunk-VE6PPIKX.js} +1 -1
- package/dist/{chunk-A7SHHSB3.js → chunk-ZNUC2RLT.js} +1 -1
- package/dist/compile-write-SRW6FWD2.js +4 -0
- package/dist/{daemon-MZWLJO75.js → daemon-42BG4EKR.js} +1 -1
- package/dist/{daemon-YPXZGJAB.js → daemon-4W6BN73Z.js} +1 -1
- package/dist/hook.js +1 -1
- package/dist/index.js +202 -178
- package/dist/{plan-reminder-45PSVOVW.js → plan-reminder-2GIRATWH.js} +1 -1
- package/dist/{post-edit-JHJT2QTK.js → post-edit-T5C6I6ZI.js} +1 -1
- package/dist/{post-edit-analyze-PPFHKIYQ.js → post-edit-analyze-326U7L26.js} +1 -1
- package/dist/{post-edit-flag-stubs-Q3UKDZ2W.js → post-edit-flag-stubs-EBDTZMDS.js} +1 -1
- package/dist/{prompt-submit-ZCDG6T4Y.js → prompt-submit-3SSUX3S2.js} +1 -1
- package/dist/status-WZG6MDCY.js +4 -0
- package/dist/{stop-enforce-Q4JNBYQU.js → stop-enforce-TYUSBDHO.js} +1 -1
- package/dist/{tasks-reminder-LKSUZUFD.js → tasks-reminder-VKRJRDNC.js} +1 -1
- package/package.json +5 -5
- package/dist/chunk-INO3L4WS.js +0 -4
- package/dist/compile-write-4ZAIPQMG.js +0 -4
- package/dist/status-66XIDYSP.js +0 -4
package/dist/index.js
CHANGED
|
@@ -1,37 +1,37 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __ripploCreateRequire } from "node:module";
|
|
3
3
|
const require = globalThis.require ?? __ripploCreateRequire(import.meta.url);
|
|
4
|
-
import{a as cn,c as pn,d as mn,e as fn,f as gn,g as
|
|
4
|
+
import{a as cn,c as pn,d as mn,e as fn,f as gn,g as pe}from"./chunk-BMRZGLUF.js";import{a as Nn,b as On,d as Fn,e as _n,f as Wn,g as Dn,h as Un,i as Bn,j as qn,k as Vn,l as Hn,m as Kn,n as Gn}from"./chunk-5E62BCS7.js";import{a as jn}from"./chunk-UDQKJVLD.js";import{b as an,c as ln,d as dn,f as un}from"./chunk-4H7EIC6W.js";import{A as V,C as Pn,G as In,H as An,K as Tn,L as We,N as Mn,O as Ln,a as en,b as rn,c as nn,d as tn,e as Ne,f as on,g as hn,h as kn,j as wn,k as bn,l as vn,m as xn,n as Sn,o as Cn,q as Rn,w as _e,y as $n,z as En}from"./chunk-VE6PPIKX.js";import{b as sn,c as q}from"./chunk-WZBLSDNV.js";import{a as Xr}from"./chunk-MOI4L3EX.js";import{a as de,b as Yr,c as ce,d as Zr}from"./chunk-SI42TC5O.js";import{a as R}from"./chunk-OQ6KNYPG.js";import{b as Z}from"./chunk-ZUPS6XVH.js";import{a as C,b as Nr,c as h}from"./chunk-LEFXRK53.js";import{a as Or}from"./chunk-7WZ3VIUU.js";import{e as Oe}from"./chunk-4W6WIT7T.js";import{a as br,b as zn,c as Jn}from"./chunk-3FF33GCX.js";import{a as b}from"./chunk-R4ZTRVDQ.js";import{b as vr,c as X,d as xr,e as Sr}from"./chunk-FEHVIHVA.js";import"./chunk-KOKEEAEF.js";import{a as Lr,b as v}from"./chunk-Q6IYTHMP.js";import{a as U,b as Tr,c as Me,d as Mr}from"./chunk-XZ2TPZLD.js";import{a as S}from"./chunk-MHNGR6M7.js";import{e as Jr,g as ue,j as Qr}from"./chunk-3LYVTLBJ.js";import{b as Ar,e as Y,h as D,j as jr,k as se}from"./chunk-EVVF662P.js";import"./chunk-DBIXYJRB.js";import{a as cr,b as pr,c as mr,d as l,f as _,h as fr,j as P,k as gr,l as yr,m as Te,n as hr,o as kr,p as wr}from"./chunk-PE5WVWI5.js";import{a as ie}from"./chunk-CJUKILIO.js";import{k as Fe,l as yn}from"./chunk-SWYJTSC3.js";import{F as qr,K as Le,O as Vr,P as ae,S as Hr,W as Kr,Z as le,_ as Gr,ba as zr,e as B,i as Fr,j as _r,l as Wr,m as Dr,w as c,x as Ur,y as Br}from"./chunk-IGPHRN4A.js";import{E as Rr,F as L,L as A,M as $r,R as Er,W as Pr,X as Ir,i as Cr,n as M,o as W}from"./chunk-4F67XQYS.js";import"./chunk-NNH3YVVO.js";import"./chunk-KMZ3L5YA.js";import{availableParallelism as Ac}from"os";import{existsSync as Qn}from"fs";function Xn(){let e=new URL("solve-worker.js",import.meta.url);if(Qn(e))return e;let r=new URL("../dist/solve-worker.js",import.meta.url);if(Qn(r))return r;throw new Error("solve worker missing \u2014 run `pnpm --filter ripplo build` first (Z3 solves run in the built worker, even when the CLI runs from source)")}import jc from"update-notifier";import Tc from"yargs";import{hideBin as Mc}from"yargs/helpers";function me({current:e,latest:r}){return r==null?`ripplo v${e} (latest: unknown)`:r===e?`ripplo v${e} (latest)`:`ripplo v${e} (latest: v${r} \u2014 run \`npx ripplo update\`)`}function Yn(){return"Update available {currentVersion} \u2192 {latestVersion}\nRun `npx ripplo update`"}import{graphql as vs}from"gql.tada";import{exec as ps}from"child_process";import{createAuthClient as us}from"better-auth/client";import{deviceAuthorizationClient as cs}from"better-auth/client/plugins";function Zn({baseURL:e}){return us({baseURL:e,fetchOptions:{headers:{"User-Agent":"Ripplo CLI"}},plugins:[cs()]})}import{err as et,ok as ms}from"neverthrow";var fs=5e3,rt="ripplo-cli";async function nt({onDeviceCode:e,url:r}){let n=r??Nr().RIPPLO_SERVER_URL,t=Zn({baseURL:n}),o=await t.device.code({client_id:rt});if(o.error!=null)return et({description:o.error.error_description,kind:"oauth-device-code-failed"});let{device_code:i,user_code:s,verification_uri_complete:a}=o.data;return e({userCode:s,verificationUrl:a}),bs(a),(await gs({authClient:t,deviceCode:i})).map(u=>(gr({serverUrl:n,token:u}),u))}async function gs({authClient:e,deviceCode:r}){for(;;){await ks(fs);let n=await e.device.token({client_id:rt,device_code:r,grant_type:"urn:ietf:params:oauth:grant-type:device_code"});if(n.data?.access_token!=null)return ms(n.data.access_token);if(n.error==null)continue;if(!hs(n.error.error))return et({code:n.error.error,description:n.error.error_description,kind:"oauth-authorization-failed"})}}var ys=new Set(["authorization_pending","slow_down"]);function hs(e){return ys.has(e)}function ks(e){return new Promise(r=>{setTimeout(r,e)})}function ws(){return process.platform==="darwin"?"open":process.platform==="win32"?"start":"xdg-open"}function bs(e){let r=ws();ps(`${r} "${e}"`,()=>{})}function j({serverUrl:e,token:r}){return{appUrl:"",cwd:process.cwd(),engineUrl:"",projectId:"",ripploServerUrl:e,token:r,webhookSecret:""}}var xs=vs(`
|
|
5
5
|
query AuthViewer {
|
|
6
6
|
currentUser {
|
|
7
7
|
name
|
|
8
8
|
email
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
|
-
`);async function tt(){let e=
|
|
11
|
+
`);async function tt(){let e=C(),r=P(e);if(r!=null&&await Ss(e,r))return;let t=(await nt({url:e,onDeviceCode:a=>{process.stdout.write(`Opening your browser to finish sign-in.
|
|
12
12
|
`),process.stdout.write(`If it didn't open, visit: ${a.verificationUrl}
|
|
13
13
|
`),process.stdout.write(`Verification code: ${a.userCode}
|
|
14
14
|
|
|
15
15
|
`),process.stdout.write(`Waiting for approval...
|
|
16
|
-
`)}})).match(a=>a,a=>{process.stderr.write(`${
|
|
17
|
-
`),process.exit(1)}),o=await
|
|
18
|
-
`),process.stdout.write(o.kind==="ok"?`${s}, ${
|
|
16
|
+
`)}})).match(a=>a,a=>{process.stderr.write(`${v(a)}
|
|
17
|
+
`),process.exit(1)}),o=await De({serverUrl:e,token:t}),i=Or(process.cwd()),s=i?"Welcome back":"Welcome to Ripplo";process.stdout.write(`
|
|
18
|
+
`),process.stdout.write(o.kind==="ok"?`${s}, ${Cs(o.viewer)}.
|
|
19
19
|
`:`${s}.
|
|
20
|
-
`),process.stdout.write(`Session saved to ${
|
|
21
|
-
`),i||(process.stdout.write("\nNext: run `npx ripplo setup` to wire Ripplo into this project,\n"),process.stdout.write("or `npx ripplo init` to set it up by hand.\n"))}async function
|
|
20
|
+
`),process.stdout.write(`Session saved to ${Te(e)}.
|
|
21
|
+
`),i||(process.stdout.write("\nNext: run `npx ripplo setup` to wire Ripplo into this project,\n"),process.stdout.write("or `npx ripplo init` to set it up by hand.\n"))}async function Ss(e,r){let n=await De({serverUrl:e,token:r});return n.kind==="ok"?(process.stdout.write(`Already signed in as ${n.viewer.email}. Run \`npx ripplo auth logout\` to switch accounts.
|
|
22
22
|
`),!0):(n.kind==="unreachable"&&(process.stdout.write(`Could not reach the Ripplo server at ${e} (${n.message}). Your saved session may still be valid \u2014 fix connectivity and retry.
|
|
23
23
|
`),process.exit(1)),process.stdout.write(`Your session expired \u2014 signing you back in.
|
|
24
24
|
|
|
25
|
-
`),!1)}async function ot(){let e=
|
|
25
|
+
`),!1)}async function ot(){let e=C(),r=P(e);r==null&&(process.stdout.write("Not signed in. Run `npx ripplo auth login`.\n"),process.exit(1));let n=await De({serverUrl:e,token:r});n.kind==="unreachable"&&(process.stdout.write(`Could not reach the Ripplo server at ${e} (${n.message}). The token may still be valid \u2014 check the server / network and retry.
|
|
26
26
|
`),process.exit(1)),n.kind==="rejected"&&(process.stdout.write("Token rejected by the server. Run `npx ripplo auth login` to sign in again.\n"),process.stdout.write(`(Claude Code: run it yourself in the background \u2014 the user just approves in the browser.)
|
|
27
27
|
`),process.exit(1)),process.stdout.write(`Signed in as ${n.viewer.name} <${n.viewer.email}> (${e})
|
|
28
|
-
`)}function it(){let e=
|
|
29
|
-
`);return}process.stdout.write(`Signed out. Removed ${
|
|
30
|
-
`)}async function
|
|
31
|
-
`),process.exit(1)}async function
|
|
32
|
-
`)}function
|
|
28
|
+
`)}function it(){let e=C();if(!yr(e)){process.stdout.write(`Already signed out.
|
|
29
|
+
`);return}process.stdout.write(`Signed out. Removed ${Te(e)}.
|
|
30
|
+
`)}async function De({serverUrl:e,token:r}){try{let t=(await l({config:j({serverUrl:e,token:r}),document:xs,variables:void 0})).currentUser;return t==null?{kind:"rejected"}:{kind:"ok",viewer:{email:t.email,name:t.name}}}catch(n){return mr(n)==="UNAUTHENTICATED"?{kind:"rejected"}:{kind:"unreachable",message:n instanceof Error?n.message:String(n)}}}function Cs(e){let r=e.name.trim().split(/\s+/)[0];return r!=null&&r.length>0?r:e.email}import{readFile as Rs,writeFile as $s}from"fs/promises";import Es from"path";async function st(e){let r=process.cwd(),n=await se(r);n.isErr()&&fe(U(n.error));let t=n.value,[o,i]=await Promise.all([de({cwd:r,lockfile:t}),ue(r,t)]);o.length>0&&fe(ce(o));let s=Rr(A,i),a=Es.join(r,D);if(e.check){await Ps(a,i);return}await $s(a,s),As(i)}function fe(e){process.stderr.write(`${e}
|
|
31
|
+
`),process.exit(1)}async function Ps(e,r){let n=await Rs(e,"utf8").catch(()=>null);n==null&&fe(Me("missing")),Is(n,r)||fe(Me("stale")),process.stdout.write(`${Tr()}
|
|
32
|
+
`)}function Is(e,r){try{let n=L(A,e);return n.checks==null?!1:Ar(n,r)}catch{return!1}}function As(e){let r=Xr(e),n=e.workflows.reduce((o,i)=>o+i.tests.length,0),t=[Mr(),...r.length>0?[Zr(r)]:[],Yr(n)];process.stdout.write(`${t.join(`
|
|
33
33
|
`)}
|
|
34
|
-
`)}import{graphql as at}from"gql.tada";function
|
|
34
|
+
`)}import{graphql as at}from"gql.tada";function Ue(e){return e==null?"Max local concurrent runs: unknown (not signed in?)":`Max local concurrent runs: ${String(e)} (the daemon applies changes live)`}import{graphql as js}from"gql.tada";var Ts=js(`
|
|
35
35
|
query DevSessionCheckPreflight($projectId: String!, $cwd: String!) {
|
|
36
36
|
project(id: $projectId) {
|
|
37
37
|
id
|
|
@@ -40,62 +40,62 @@ import{a as cn,c as pn,d as mn,e as fn,f as gn,g as ce}from"./chunk-YODZBLYM.js"
|
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
|
-
`);function g(){return
|
|
44
|
-
`),process.stderr.write(`${
|
|
45
|
-
`),process.exit(1)})}async function
|
|
46
|
-
`),process.exit(1))}var
|
|
43
|
+
`);function g(){return h(process.cwd()).match(e=>e,e=>{process.stderr.write(`${v(e)}
|
|
44
|
+
`),process.stderr.write(`${S("setup")}
|
|
45
|
+
`),process.exit(1)})}async function x(e){(await l({config:e,document:Ts,variables:{cwd:e.cwd,projectId:e.projectId}})).project?.devSession==null&&(process.stderr.write("No active dev session. Start `npx ripplo daemon` as a background process (your app's dev server must also be running), then retry. Or run `/ripplo:start` in Claude Code.\n"),process.stderr.write(`${S("setup")}
|
|
46
|
+
`),process.exit(1))}var Ms=at(`
|
|
47
47
|
mutation CliUpdateMaxLocalConcurrentRuns($value: Int!) {
|
|
48
48
|
updateMaxLocalConcurrentRuns(value: $value) {
|
|
49
49
|
id
|
|
50
50
|
maxLocalConcurrentRuns
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
|
-
`),
|
|
53
|
+
`),Ls=at(`
|
|
54
54
|
query CliMaxLocalConcurrentRuns {
|
|
55
55
|
currentUser {
|
|
56
56
|
id
|
|
57
57
|
maxLocalConcurrentRuns
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
|
-
`);async function lt({value:e}){let r=g();if(e==null){let t=await
|
|
61
|
-
`);return}let n=await
|
|
62
|
-
`)}function dt(e){switch(e.type){case"settings":return
|
|
60
|
+
`);async function lt({value:e}){let r=g();if(e==null){let t=await l({config:r,document:Ls,variables:{}});process.stdout.write(`${Ue(t.currentUser?.maxLocalConcurrentRuns)}
|
|
61
|
+
`);return}let n=await l({config:r,document:Ms,variables:{value:e}});process.stdout.write(`${Ue(n.updateMaxLocalConcurrentRuns?.maxLocalConcurrentRuns)}
|
|
62
|
+
`)}function dt(e){switch(e.type){case"settings":return Ns(e);case"env-files":return Os(e);case"token":return Fs(e);case"dev-server":return _s(e);case"dev-session":return rn(e);case"entities":return Ws(e);case"webhook-verification":return Ds(e);case"entities-validation":return Us(e);case"workflows":return Bs(e);case"browser":return Vs(e);case"engine-endpoint":return e.reachable?`\u2713 Engine endpoint: ${e.url} is reachable`:`\u2717 Engine endpoint: ${e.url} is not reachable`;case"adapter-enabled":return Hs(e);case"lockfile":return Ks(e);case"pre-commit-hook":return Gs(e);case"plugin-version":return zs(e);case"stale-build":return Js(e)}}function Ns(e){return e.valid?"\u2713 Settings: project configured":`\u2717 Settings: missing fields: ${e.missingFields.join(", ")}`}function Os(e){return e.missing.length===0?"\u2713 Env files: declared files present":`\u2717 Env files: declared in .ripplo/project.json but missing:
|
|
63
63
|
${e.missing.map(n=>` ${n}`).join(`
|
|
64
64
|
`)}
|
|
65
|
-
In a git worktree? Copy the env file from the main checkout, or symlink to a shared file outside the working tree.`}function
|
|
65
|
+
In a git worktree? Copy the env file from the main checkout, or symlink to a shared file outside the working tree.`}function Fs(e){switch(e.status){case"valid":return`\u2713 Auth: signed in as ${e.email??"unknown"}`;case"missing":return"\u2717 Auth: not signed in. Run `npx ripplo auth login`.\n (Claude Code: run it yourself in the background \u2014 the user just approves in the browser.)";case"invalid":return"\u2717 Auth: saved token rejected by the server. Run `npx ripplo auth login` to sign in again.\n (Claude Code: run it yourself in the background \u2014 the user just approves in the browser.)";case"unreachable":return`! Auth: could not reach ${C()} to validate the token.`}}function _s(e){return e.reachable?`\u2713 Dev server: ${e.appUrl} is reachable`:`\u2717 Dev server: ${e.appUrl} is not responding. Start your dev server.`}function Ws(e){return e.count===0?"! Entities: none defined":e.configured?e.endpointReachable===void 0?`! Entities: ${String(e.count)} defined (could not verify engine endpoint)`:`\u2713 Entities: ${String(e.count)} defined, engine configured`:`\u2717 Entities: ${String(e.count)} defined but RIPPLO_ENGINE_URL is not set in your env file`}function Ds(e){return e.rejectsUnsigned?"\u2713 Webhook verification: unsigned requests rejected":"\u2717 Webhook verification: endpoint accepted an unsigned request \u2014 signature verification may be missing or misconfigured."}function Us(e){if(!e.found)return"\u2717 Model: DSL failed to compile";if(e.valid)return"\u2713 Model: valid";let r=e.errors.map(n=>` - ${n.path===""?"":n.path+": "}${n.message}`);return`\u2717 Model: ${String(e.errorCount)} validation error${e.errorCount===1?"":"s"}
|
|
66
66
|
${r.join(`
|
|
67
|
-
`)}`}function
|
|
67
|
+
`)}`}function Bs(e){if(e.total===0)return"! Tests: none defined";if(e.invalidNames.length===0)return`\u2713 Tests: ${String(e.total)} valid`;let r=e.invalidWorkflows.map(n=>qs(n));return`\u2717 Tests: ${String(e.invalidNames.length)} invalid
|
|
68
68
|
${r.join(`
|
|
69
|
-
`)}`}function
|
|
69
|
+
`)}`}function qs(e){let r=e.errors.map(n=>" - "+(n.path===""?"":n.path+": ")+n.message);return" "+e.name+`:
|
|
70
70
|
`+r.join(`
|
|
71
|
-
`)}function
|
|
71
|
+
`)}function Vs(e){return e.installed?"\u2713 Browser: Chromium installed":"\u2717 Browser: Chromium not installed. Run `npx playwright install chromium`."}function Hs(e){switch(e.status){case"enabled":return`\u2713 Adapter: enabled at ${e.url}`;case"disabled":return"\u2717 Adapter: disabled (handler returned 404). Set ENABLE_RIPPLO_TESTING=true in your app's env (e.g. apps/<app>/.env.local for Next.js) and restart the dev server.";case"bad-secret":return"\u2717 Adapter: webhook signature rejected. RIPPLO_WEBHOOK_SECRET seen by your dev server does not match the one in your env file.";case"unreachable":return`\u2717 Adapter: ${e.url} could not be reached for signed probe.`;case"no-secret":return"\u2717 Adapter: RIPPLO_WEBHOOK_SECRET is not set in your env file (declared in .ripplo/project.json)."}}function Ks(e){switch(e.status){case"match":return`\u2713 Lockfile: ${D} is up to date`;case"missing":return`\u2717 Lockfile: ${D} is missing \u2014 run \`npx ripplo compile\` and commit it`;case"stale":return`\u2717 Lockfile: ${D} is out of date \u2014 run \`npx ripplo compile\` and commit it`}}function Gs(e){return e.installed?"\u2713 Pre-commit hook: .git/hooks/pre-commit runs `ripplo compile --check`":"! Pre-commit hook: .git/hooks/pre-commit does not run `ripplo compile --check` \u2014 see the setup skill for the snippet"}function zs(e){return e.installed===e.cliVersion?`\u2713 Claude plugin: v${e.installed} matches CLI`:`! Claude plugin: installed v${e.installed}, CLI v${e.cliVersion} \u2014 run \`npx ripplo update\` (or /plugin in Claude Code)`}function Js(e){return e.freshness.kind==="foreign-binary"?"! Build: running a ripplo binary from outside this workspace \u2014 its bundle may not match your source. Run `npx ripplo` from this workspace after `pnpm build`.":e.freshness.kind==="stale"?`! Build: source is newer than the built bundles (${e.freshness.packages.join(", ")}) \u2014 the daemon and engine may be serving stale code. Run \`pnpm build\`, then \`npx ripplo daemon stop\` and start it again.`:"\u2713 Build: bundles up to date"}import ee from"fs";import ea from"os";import mt from"path";import{z as N}from"zod";import Qs from"latest-version";import ut from"semver";async function ge(e){try{return await Promise.race([Qs("ripplo"),new Promise(r=>setTimeout(()=>{r(void 0)},e))])}catch{return}}function ct(e){return e.filter(r=>ut.valid(r)!=null).toSorted(ut.rcompare)[0]}import{graphql as Xs}from"gql.tada";var Ys=Xs(`
|
|
72
72
|
query DoctorAuthViewer {
|
|
73
73
|
currentUser {
|
|
74
74
|
name
|
|
75
75
|
email
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
|
-
`),
|
|
78
|
+
`),Zs="Failed to connect to Ripplo server";async function pt({serverUrl:e,token:r}){try{let n=await l({config:j({serverUrl:e,token:r}),document:Ys,variables:void 0});return n.currentUser==null?{kind:"invalid"}:{email:n.currentUser.email,kind:"valid"}}catch(n){return(n instanceof Error?n.message:String(n)).startsWith(Zs)?{kind:"unreachable"}:{kind:"invalid"}}}function ft(e){switch(e.type){case"settings":return!e.valid;case"env-files":return e.missing.length>0;case"token":return e.status==="missing"||e.status==="invalid";case"dev-server":return!e.reachable;case"dev-session":return e.status!=="active";case"entities":return e.count>0&&!e.configured;case"engine-endpoint":return!e.reachable;case"adapter-enabled":return e.status!=="enabled";case"webhook-verification":return!e.rejectsUnsigned;case"entities-validation":return!e.valid;case"workflows":return e.invalidNames.length>0;case"browser":return!e.installed;case"lockfile":return e.status!=="match";case"pre-commit-hook":return!e.installed;case"plugin-version":return!1;case"stale-build":return!1}}async function gt(e){let r=await oa(e),n={missing:Sr(e),type:"env-files"},t=await ia(),o=await sa(),i=await se(e),s=await aa(e,i),a=la(i),d=await da(e,i),u=ua(e),w=ta(e),f=ra(),p=await ca(r,i);return[r,n,t,...p,s,a,d,u,o,...w==null?[]:[w],...f==null?[]:[f]]}function ra(){let e=q();return e.kind==="fresh"?null:{freshness:e,type:"stale-build"}}var na=N.object({plugins:N.record(N.string(),N.array(N.object({projectPath:N.string().optional(),scope:N.string().optional(),version:N.string()})))});function ta(e){let r=mt.join(ea.homedir(),".claude","plugins","installed_plugins.json"),n=ee.existsSync(r)?ee.readFileSync(r,"utf8"):null;if(n==null)return null;let t=na.safeParse(JSON.parse(n));if(!t.success)return null;let o=Object.entries(t.data.plugins).filter(([s])=>s.startsWith("ripplo@")).flatMap(([,s])=>s).filter(s=>s.scope==="user"||s.projectPath===e).map(s=>s.version),i=ct(o);return i==null?null:{cliVersion:b(),installed:i,type:"plugin-version"}}async function oa(e){let r=await tn(e);return r.valid?{missingFields:[],type:"settings",valid:!0}:{missingFields:r.errors.map(t=>t.path).filter(t=>t.length>0),type:"settings",valid:!1}}async function ia(){let e=C(),r=P(e);if(r==null||r.length===0)return{email:void 0,status:"missing",type:"token"};let n=await pt({serverUrl:e,token:r});return n.kind==="valid"?{email:n.email,status:"valid",type:"token"}:{email:void 0,status:n.kind,type:"token"}}async function sa(){let{chromium:e}=await import("playwright"),r=e.executablePath();return{installed:ee.existsSync(r),type:"browser"}}async function aa(e,r){if(r.isErr())return{errorCount:1,errors:[{message:U(r.error),path:".ripplo/"}],found:!1,type:"entities-validation",valid:!1};let n=await de({cwd:e,lockfile:r.value});return{errorCount:n.length,errors:n.length===0?[]:[{message:ce(n),path:""}],found:!0,type:"entities-validation",valid:n.length===0}}function la(e){if(e.isErr())return{invalidNames:[],invalidWorkflows:[],total:0,type:"workflows",valid:0};let r=e.value.workflows.length;return{invalidNames:[],invalidWorkflows:[],total:r,type:"workflows",valid:r}}async function da(e,r){return r.isErr()?{status:"missing",type:"lockfile"}:{status:await Qr(e,r.value),type:"lockfile"}}function ua(e){let r=mt.join(e,".git","hooks","pre-commit");return ee.existsSync(r)?{installed:ee.readFileSync(r,"utf8").includes("ripplo compile --check"),type:"pre-commit-hook"}:{installed:!1,type:"pre-commit-hook"}}async function ca(e,r){let n=xr().map(s=>({appUrl:s.appUrl,engineUrl:s.engineUrl,webhookSecret:s.webhookSecret})).unwrapOr(void 0);if(n==null)return[];let t=[],o=await Ne(n.appUrl)==null;t.push({appUrl:n.appUrl,reachable:o,type:"dev-server"});let i=await nn(process.cwd());if(t.push(i),e.valid&&r.isOk()){let s=await pa(n,r);t.push(...s)}return t}async function pa(e,r){let n=r.isOk()?r.value.entities.length:0,t=e.engineUrl.length>0,o={configured:t,count:n,endpointReachable:void 0,type:"entities"};if(n===0||!t)return[o];let i=fa(e.appUrl,e.engineUrl);if(i==null)return[o];let s=await Ne(i)==null,a=[];if(a.push({configured:!0,count:n,endpointReachable:s,type:"entities"}),yt(e.engineUrl)&&a.push({reachable:s,type:"engine-endpoint",url:i}),!s)return a;let d=await on({appUrl:e.appUrl,engineUrl:e.engineUrl});a.push({rejectsUnsigned:d==null,type:"webhook-verification"});let u=await ma({engineUrl:i,webhookSecret:e.webhookSecret});return a.push({status:u,type:"adapter-enabled",url:i}),a}async function ma({engineUrl:e,webhookSecret:r}){if(r.length===0)return"no-secret";let n=JSON.stringify({});try{let t=await fetch(`${e}/setup`,{body:n,headers:{"Content-Type":"application/json",...kr({body:n,secret:r})},method:"PUT",signal:AbortSignal.timeout(5e3)});return t.status===404?"disabled":t.status===401||t.status===403?"bad-secret":"enabled"}catch{return"unreachable"}}function yt(e){return e.startsWith("http://")||e.startsWith("https://")}function fa(e,r){return yt(r)?r:`${e}${r}`}var ga=3e3;async function ht(){let e=process.cwd(),[r,n]=await Promise.all([ge(ga),gt(e)]);process.stdout.write(`${me({current:b(),latest:r})}
|
|
79
79
|
`);let t=n.map(i=>dt(i));process.stdout.write(t.join(`
|
|
80
80
|
`)+`
|
|
81
|
-
`);let o=n.some(i=>
|
|
81
|
+
`);let o=n.some(i=>ft(i));process.exit(o?1:0)}import ye from"fs";import{graphql as ya}from"gql.tada";var ha=ya(`
|
|
82
82
|
mutation CliSetHooksPaused($projectId: String!, $paused: Boolean!) {
|
|
83
83
|
setHooksPaused(projectId: $projectId, paused: $paused) {
|
|
84
84
|
id
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
|
-
`);async function
|
|
88
|
-
`);return}
|
|
89
|
-
`)}async function
|
|
90
|
-
`)})}import
|
|
91
|
-
`)[0]??n.message:String(n);return _.warn("Install failed (%s): %s",r,t),{cmd:r,ok:!1,reason:t}}}async function
|
|
87
|
+
`);async function kt(){let e=process.cwd();fr(e);let r=Oe(e);if(ye.existsSync(r)){process.stdout.write("Hooks already paused. Run `npx ripplo hooks resume` to re-enable.\n");return}ye.writeFileSync(r,""),await bt(e,!0),process.stdout.write("Hooks paused. Pre-edit gates and stop enforcement are off until you run `npx ripplo hooks resume`.\n")}async function wt(){let e=process.cwd(),r=Oe(e);if(!ye.existsSync(r)){process.stdout.write(`Hooks already active.
|
|
88
|
+
`);return}ye.unlinkSync(r),await bt(e,!1),process.stdout.write(`Hooks resumed.
|
|
89
|
+
`)}async function bt(e,r){let n=h(e).unwrapOr(void 0);n!=null&&await l({config:n,document:ha,variables:{paused:r,projectId:n.projectId}}).catch(t=>{process.stderr.write(`Warning: could not push hook-pause state to the server (${t instanceof Error?t.message:String(t)}) \u2014 the dashboard may show stale hook status.
|
|
90
|
+
`)})}import H from"fs";import K from"path";import{input as Et,select as Pt}from"@inquirer/prompts";import{graphql as Qa}from"gql.tada";import{exec as ka,execFile as wa}from"child_process";import{err as ba,ok as vt}from"neverthrow";import m from"fs";import{createRequire as va}from"module";import k from"path";import{promisify as St}from"util";var xa=["ripplo","@ripplo/testing","@ripplo/instrument"],xt=".ripplo/ripplo.lock linguist-generated=true",Sa=[".ripplo/debug/",".ripplo/.local/"],Ca=St(ka),Ra=St(wa);async function Ct({cwd:e,onStep:r}){r("Scaffolding project files..."),Oa({cwd:e}),r("Updating .gitignore..."),_a(e),r("Marking ripplo.lock as generated..."),Ia(e),r("Installing dependencies...");let n=await Ea(e),t=[];if(n.ok||t.push({manualCommand:n.cmd,message:`Couldn't auto-install dev dependencies (${n.reason}). Run the command below, then run \`npx ripplo compile\` to build the lockfile.`}),n.ok){r("Compiling initial lockfile...");let i=await Pa(e);i!=null&&t.push({manualCommand:void 0,message:i})}return r("Setting up browser..."),(await $a()).map(()=>t)}async function $a(){let{chromium:e}=await import("playwright"),r=e.executablePath();if(m.existsSync(r))return vt(void 0);_.info("Chromium not found. Installing via Playwright...");let n=va(import.meta.url),t=k.dirname(n.resolve("playwright/package.json")),o=k.join(t,"cli.js");return await Ra(process.execPath,[o,"install","chromium"]),m.existsSync(r)?vt(void 0):ba({kind:"playwright-install-failed"})}async function Ea(e){let r=Aa({cwd:e,pm:Na(e)});_.info("Installing dependencies: %s",r);try{return await Ca(r,{cwd:e}),{ok:!0}}catch(n){let t=n instanceof Error?n.message.split(`
|
|
91
|
+
`)[0]??n.message:String(n);return _.warn("Install failed (%s): %s",r,t),{cmd:r,ok:!1,reason:t}}}async function Pa(e){try{await Jr(e);return}catch(r){return`Couldn't compile initial lockfile: ${r instanceof Error?r.message:String(r)}.`}}function Ia(e){let r=k.join(e,".gitattributes"),n=m.existsSync(r)?m.readFileSync(r,"utf8"):"";if(n.includes(xt))return;let t=n.length===0||n.endsWith(`
|
|
92
92
|
`)?"":`
|
|
93
|
-
`;m.writeFileSync(r,`${n}${t}${
|
|
94
|
-
`)}function
|
|
93
|
+
`;m.writeFileSync(r,`${n}${t}${xt}
|
|
94
|
+
`)}function Aa({cwd:e,pm:r}){let n=xa.join(" ");return r==="pnpm"?ja(e)?`pnpm add -wD ${n}`:`pnpm add -D ${n}`:r==="yarn"?Ta({cwd:e,deps:n}):r==="bun"?`bun add -d ${n}`:`npm install -D ${n}`}function ja(e){return m.existsSync(k.join(e,"pnpm-workspace.yaml"))||m.existsSync(k.join(e,"pnpm-workspace.yml"))}function Ta({cwd:e,deps:r}){return Ma(e)?`yarn add -D ${r}`:La(e)?`yarn add -WD ${r}`:`yarn add -D ${r}`}function Ma(e){if(m.existsSync(k.join(e,".yarnrc.yml"))||m.existsSync(k.join(e,".pnp.cjs"))||m.existsSync(k.join(e,".pnp.js")))return!0;let r=k.join(e,"package.json");if(!m.existsSync(r))return!1;try{let n=JSON.parse(m.readFileSync(r,"utf8"));if(n==null||typeof n!="object"||!("packageManager"in n))return!1;let t=n.packageManager;if(typeof t!="string")return!1;let o=/^yarn@(\d+)/.exec(t);return o!=null&&Number(o[1])>=2}catch{return!1}}function La(e){let r=k.join(e,"package.json");if(!m.existsSync(r))return!1;try{let n=JSON.parse(m.readFileSync(r,"utf8"));if(n==null||typeof n!="object"||!("workspaces"in n))return!1;let t=n.workspaces;return Array.isArray(t)||t!=null&&typeof t=="object"}catch{return!1}}function Na(e){return m.existsSync(k.join(e,"pnpm-lock.yaml"))?"pnpm":m.existsSync(k.join(e,"yarn.lock"))?"yarn":m.existsSync(k.join(e,"bun.lockb"))||m.existsSync(k.join(e,"bun.lock"))?"bun":"npm"}function Oa({cwd:e}){let r=k.join(e,".ripplo");Ga.forEach(({content:n,relPath:t})=>{let o=k.join(r,t);m.mkdirSync(k.dirname(o),{recursive:!0}),Fa(o,n)})}function Fa(e,r){m.existsSync(e)||m.writeFileSync(e,r)}function _a(e){let r=k.join(e,".gitignore");if(!m.existsSync(r))return;let n=m.readFileSync(r,"utf8"),t=Sa.filter(i=>!n.includes(i));if(t.length===0)return;let o=n.endsWith(`
|
|
95
95
|
`)?"":`
|
|
96
96
|
`;m.writeFileSync(r,n+o+t.join(`
|
|
97
97
|
`)+`
|
|
98
|
-
`)}var
|
|
98
|
+
`)}var Wa=`import { createRipplo } from "@ripplo/testing";
|
|
99
99
|
import { entities } from "./entities/index";
|
|
100
100
|
import { singletons } from "./singletons/index";
|
|
101
101
|
import { workflows } from "./workflows/index";
|
|
@@ -108,7 +108,7 @@ export default createRipplo({
|
|
|
108
108
|
facts,
|
|
109
109
|
viewports: ["desktop", "mobile"],
|
|
110
110
|
});
|
|
111
|
-
`,
|
|
111
|
+
`,Da=`// Model the app's state as entities. Each entity gets a \`seed\`/\`read\` impl in your
|
|
112
112
|
// app's engine funnel (createEngine). See /ripplo:create "Adding an entity".
|
|
113
113
|
//
|
|
114
114
|
// Example:
|
|
@@ -123,7 +123,7 @@ export default createRipplo({
|
|
|
123
123
|
// export const entities = [Project] as const;
|
|
124
124
|
|
|
125
125
|
export const entities = [] as const;
|
|
126
|
-
`,
|
|
126
|
+
`,Ua=`// Client/global state (e.g. localStorage flags) modeled as singletons.
|
|
127
127
|
//
|
|
128
128
|
// Example:
|
|
129
129
|
// //
|
|
@@ -137,7 +137,7 @@ export const entities = [] as const;
|
|
|
137
137
|
// export const singletons = [onboardingDismissed];
|
|
138
138
|
|
|
139
139
|
export const singletons = [];
|
|
140
|
-
`,
|
|
140
|
+
`,Ba=`// App-wide rules enforced everywhere, independent of any workflow \u2014 invariants and
|
|
141
141
|
// permission boundaries. See /ripplo:create "Declared facts".
|
|
142
142
|
//
|
|
143
143
|
// Example:
|
|
@@ -150,7 +150,7 @@ export const singletons = [];
|
|
|
150
150
|
// export const facts = [noCrashScreen] as const;
|
|
151
151
|
|
|
152
152
|
export const facts = [] as const;
|
|
153
|
-
`,
|
|
153
|
+
`,qa=`// Pure builder functions, each returning one entity handle (or a tight cluster) \u2014 the
|
|
154
154
|
// starting state workflows compose. Parents come in as arguments, foreign keys wire from
|
|
155
155
|
// their handles. See /ripplo:create "Givens".
|
|
156
156
|
//
|
|
@@ -161,7 +161,7 @@ export const facts = [] as const;
|
|
|
161
161
|
// export const user = () => User.of({ email: arbitrary(User.field.email) });
|
|
162
162
|
// export const ownedProject = (me: ReturnType<typeof user>) =>
|
|
163
163
|
// Project.of({ name: arbitrary(Project.field.name), ownerId: me.id });
|
|
164
|
-
`,
|
|
164
|
+
`,Va=`// Each file under ./workflows exports a workflow. Import them here and add to the
|
|
165
165
|
// \`workflows\` array \u2014 that's what createRipplo({ ..., workflows }) receives. Stub with
|
|
166
166
|
// \`workflow("Intent")\` (no body); implement later with \`workflow("Intent", () => ({ given, steps }))\`.
|
|
167
167
|
//
|
|
@@ -170,7 +170,7 @@ export const facts = [] as const;
|
|
|
170
170
|
// export const workflows = [createProject] as const;
|
|
171
171
|
|
|
172
172
|
export const workflows = [] as const;
|
|
173
|
-
`,
|
|
173
|
+
`,Ha=`{
|
|
174
174
|
"compilerOptions": {
|
|
175
175
|
"strict": true,
|
|
176
176
|
"noUncheckedIndexedAccess": true,
|
|
@@ -186,7 +186,7 @@ export const workflows = [] as const;
|
|
|
186
186
|
"include": ["*.ts", "entities/**/*.ts", "singletons/**/*.ts", "workflows/**/*.ts"],
|
|
187
187
|
"exclude": ["node_modules"]
|
|
188
188
|
}
|
|
189
|
-
`,
|
|
189
|
+
`,Ka=`// Guards spec files against shadowing DSL imports \u2014 \`const url = ...\` next to the
|
|
190
190
|
// imported \`url\` locator silently breaks specs. Requires typescript-eslint (and
|
|
191
191
|
// ESLint's per-directory config lookup). Delete this file if your lint setup differs.
|
|
192
192
|
import tseslint from "typescript-eslint";
|
|
@@ -200,47 +200,47 @@ export default tseslint.config({
|
|
|
200
200
|
},
|
|
201
201
|
plugins: { "@typescript-eslint": tseslint.plugin },
|
|
202
202
|
});
|
|
203
|
-
`,
|
|
204
|
-
`),"written"}function
|
|
203
|
+
`,Ga=[{content:Wa,relPath:"index.ts"},{content:Da,relPath:"entities/index.ts"},{content:Ua,relPath:"singletons/index.ts"},{content:Ba,relPath:"facts.ts"},{content:qa,relPath:"givens.ts"},{content:Va,relPath:"workflows/index.ts"},{content:Ha,relPath:"tsconfig.json"},{content:Ka,relPath:"eslint.config.js"}];import he from"fs";import Rt from"path";import{z as Be}from"zod";var za={autoUpdate:!0,source:{repo:"ripplo/claude-plugin",source:"github"}},$t=Be.record(Be.string(),Be.unknown());function ke(e){let r=Rt.join(e,".claude","settings.json"),n=Ja(r);if(n==null)return"unparseable";let t=$t.safeParse(n.extraKnownMarketplaces??{});if(!t.success)return"unparseable";if(t.data.ripplo!=null)return"already-present";let o={...n,extraKnownMarketplaces:{...t.data,ripplo:za}};return he.mkdirSync(Rt.dirname(r),{recursive:!0}),he.writeFileSync(r,`${JSON.stringify(o,null,2)}
|
|
204
|
+
`),"written"}function Ja(e){if(!he.existsSync(e))return{};try{let r=$t.safeParse(JSON.parse(he.readFileSync(e,"utf8")));return r.success?r.data:void 0}catch{return}}function we(e){switch(e){case"written":return" registered ripplo plugin marketplace in .claude/settings.json (autoUpdate: true \u2014 Claude Code keeps the plugin current)";case"already-present":return" ripplo plugin marketplace already registered in .claude/settings.json";case"unparseable":return" ! .claude/settings.json could not be parsed \u2014 add the ripplo marketplace to extraKnownMarketplaces manually"}}var Xa=Qa(`
|
|
205
205
|
query InitProjects {
|
|
206
206
|
projects {
|
|
207
207
|
id
|
|
208
208
|
name
|
|
209
209
|
}
|
|
210
210
|
}
|
|
211
|
-
`),
|
|
212
|
-
`),process.exit(1));let o=await
|
|
213
|
-
`);let f=(await
|
|
214
|
-
`)}})).match(
|
|
211
|
+
`),qe=["../.env.local","../.env"];async function It(e=el()){let r=process.cwd(),n=C(),t=P(n);t==null&&(process.stdout.write("Not signed in. Run `npx ripplo auth login` first.\n"),process.exit(1)),Ya(r)&&(process.stdout.write(`\`.ripplo/index.ts\` already exists at ${r}. To re-init, delete it first.
|
|
212
|
+
`),process.exit(1));let o=await Za({serverUrl:n,token:t});o.length===0&&(process.stdout.write("No projects found. Run `npx ripplo projects create <name>` first, then re-run `npx ripplo init`.\n"),process.exit(1));let i=await nl(o,e.projectId),s=await tl(r,e.envFile),a=await il(e.appUrl),d=rl(a,e.engineUrl),u=K.resolve(K.join(r,".ripplo"),s);vr({cwd:r,envFiles:[s],projectId:i}),al({appUrl:a,engineUrl:d,filePath:u}),process.stdout.write(`${we(ke(r))}
|
|
213
|
+
`);let f=(await Ct({cwd:r,onStep:p=>{process.stdout.write(` ${p}
|
|
214
|
+
`)}})).match(p=>p,p=>{process.stderr.write(`${v(p)}
|
|
215
215
|
`),process.exit(1)});if(f.length>0){process.stdout.write(`Done with warnings:
|
|
216
|
-
`),f.forEach(
|
|
217
|
-
`),
|
|
218
|
-
`)});return}process.stdout.write("Ready. Start `npx ripplo daemon` as a background process (or run `/ripplo:start` in Claude Code), then write workflows in `.ripplo/workflows/`.\n")}function
|
|
219
|
-
`),process.exit(1)}return r}return`${e.replace(/\/$/,"")}/ripplo`}async function
|
|
216
|
+
`),f.forEach(p=>{process.stdout.write(` - ${p.message}
|
|
217
|
+
`),p.manualCommand!=null&&process.stdout.write(` run: ${p.manualCommand}
|
|
218
|
+
`)});return}process.stdout.write("Ready. Start `npx ripplo daemon` as a background process (or run `/ripplo:start` in Claude Code), then write workflows in `.ripplo/workflows/`.\n")}function Ya(e){return H.existsSync(K.join(e,".ripplo","index.ts"))}async function Za({serverUrl:e,token:r}){return((await l({config:j({serverUrl:e,token:r}),document:Xa,variables:void 0})).projects??[]).map(t=>({id:t.id,name:t.name}))}function el(){return{appUrl:void 0,engineUrl:void 0,envFile:void 0,projectId:void 0}}function rl(e,r){if(r!=null){try{new URL(r)}catch{process.stdout.write(`--engine-url is not a valid URL: ${r}
|
|
219
|
+
`),process.exit(1)}return r}return`${e.replace(/\/$/,"")}/ripplo`}async function nl(e,r){if(r!=null){let n=e.find(t=>t.id===r);return n==null&&(process.stdout.write(`Unknown project id: ${r}
|
|
220
220
|
`),process.exit(1)),process.stdout.write(`Using project: ${n.name} (${n.id})
|
|
221
221
|
`),n.id}if(e.length===1){let n=e[0];if(n==null)throw new Error("unreachable");return process.stdout.write(`Using project: ${n.name} (${n.id})
|
|
222
|
-
`),n.id}return
|
|
223
|
-
`),process.exit(1)),r):
|
|
224
|
-
`),process.exit(1)}return e}return
|
|
222
|
+
`),n.id}return Pt({choices:e.map(n=>({name:n.name,value:n.id})),message:"Select a project"})}async function tl(e,r){return r!=null?(r.trim().length===0&&(process.stdout.write(`--env must not be empty
|
|
223
|
+
`),process.exit(1)),r):ol(e)}async function ol(e){let r=K.join(e,".ripplo"),n=qe.find(o=>H.existsSync(K.resolve(r,o))),t=await Pt({choices:[...qe.map(o=>({name:n===o?`${o} (detected)`:o,value:o})),{name:"custom path",value:"__custom__"}],default:n??qe[0],message:"Which env file should ripplo write RIPPLO_APP_URL, RIPPLO_ENGINE_URL, RIPPLO_WEBHOOK_SECRET, and ENABLE_RIPPLO_TESTING to?"});return t!=="__custom__"?t:Et({message:"Path to env file (relative to .ripplo/, e.g. ../apps/server/.env)",validate:o=>o.trim().length>0?!0:"required"})}async function il(e){if(e!=null){try{new URL(e)}catch{process.stdout.write(`--app-url is not a valid URL: ${e}
|
|
224
|
+
`),process.exit(1)}return e}return sl()}async function sl(){return Et({default:"http://localhost:3000",message:"Where does your dev server run? (RIPPLO_APP_URL)",validate:e=>{try{return new URL(e),!0}catch{return"must be a valid URL"}}})}function al({appUrl:e,engineUrl:r,filePath:n}){H.mkdirSync(K.dirname(n),{recursive:!0});let t=H.existsSync(n)?H.readFileSync(n,"utf8"):"",o=[];if(/^RIPPLO_APP_URL=/m.test(t)||o.push(`RIPPLO_APP_URL=${e}`),/^RIPPLO_ENGINE_URL=/m.test(t)||o.push(`RIPPLO_ENGINE_URL=${r}`),/^RIPPLO_WEBHOOK_SECRET=/m.test(t)||o.push(`RIPPLO_WEBHOOK_SECRET=${wr()}`),/^ENABLE_RIPPLO_TESTING=/m.test(t)||o.push("ENABLE_RIPPLO_TESTING=true"),o.length===0)return;let i=t.length===0||t.endsWith(`
|
|
225
225
|
`)?"":`
|
|
226
|
-
`;
|
|
226
|
+
`;H.writeFileSync(n,`${t}${i}${o.join(`
|
|
227
227
|
`)}
|
|
228
|
-
`)}import{graphql as Ke}from"gql.tada";function Ve(){return"Not signed in. Run `npx ripplo auth login` first."}function
|
|
229
|
-
`)}function He(e){return`Could not create the project \u2014 ${e}`}var
|
|
228
|
+
`)}import{graphql as Ke}from"gql.tada";function Ve(){return"Not signed in. Run `npx ripplo auth login` first."}function At(){return"No organization found for your account. Sign in to the dashboard once, then retry."}function jt(e){return["You belong to multiple organizations \u2014 pass `--org <id>`:",...e.map(n=>` ${n.id} ${n.name}`)].join(`
|
|
229
|
+
`)}function He(e){return`Could not create the project \u2014 ${e}`}var ll=Ke(`
|
|
230
230
|
query ProjectsList {
|
|
231
231
|
projects {
|
|
232
232
|
id
|
|
233
233
|
name
|
|
234
234
|
}
|
|
235
235
|
}
|
|
236
|
-
`),
|
|
236
|
+
`),dl=Ke(`
|
|
237
237
|
query OrganizationsList {
|
|
238
238
|
organizations {
|
|
239
239
|
id
|
|
240
240
|
name
|
|
241
241
|
}
|
|
242
242
|
}
|
|
243
|
-
`),
|
|
243
|
+
`),ul=Ke(`
|
|
244
244
|
mutation CliCreateProject($name: String!, $organizationId: String!) {
|
|
245
245
|
createProject(cloudBaseUrl: "", name: $name, organizationId: $organizationId) {
|
|
246
246
|
__typename
|
|
@@ -256,17 +256,17 @@ export default tseslint.config({
|
|
|
256
256
|
}
|
|
257
257
|
}
|
|
258
258
|
}
|
|
259
|
-
`);async function
|
|
260
|
-
`),process.exit(1));let t=((await
|
|
261
|
-
`)}async function
|
|
262
|
-
`),process.exit(1));let o=
|
|
263
|
-
`),process.exit(1)),
|
|
259
|
+
`);async function Tt(){let e=C(),r=P(e);r==null&&(process.stderr.write(`${Ve()}
|
|
260
|
+
`),process.exit(1));let t=((await l({config:j({serverUrl:e,token:r}),document:ll,variables:void 0})).projects??[]).map(o=>({id:o.id,name:o.name}));process.stdout.write(`${JSON.stringify({projects:t},null,2)}
|
|
261
|
+
`)}async function Mt({name:e,orgId:r}){let n=C(),t=P(n);t==null&&(process.stderr.write(`${Ve()}
|
|
262
|
+
`),process.exit(1));let o=j({serverUrl:n,token:t}),i=r??await cl(o),a=(await l({config:o,document:ul,variables:{name:e,organizationId:i}}).catch(d=>{throw d instanceof pr&&(process.stderr.write(`${He(d.message)}
|
|
263
|
+
`),process.exit(1)),d})).createProject;if(a?.__typename!=="Project"){let d=a?.message??"unknown error";process.stderr.write(`${He(d)}
|
|
264
264
|
`),process.exit(1)}process.stdout.write(`${JSON.stringify({project:{id:a.id,name:a.name}},null,2)}
|
|
265
|
-
`)}async function
|
|
266
|
-
`),process.exit(1)}import{spawnSync as
|
|
267
|
-
${e.detail}`:""}`}function
|
|
268
|
-
`);let e=
|
|
269
|
-
`),process.exit(1)),process.exit(e.exitCode)}import{graphql as
|
|
265
|
+
`)}async function cl(e){let n=((await l({config:e,document:dl,variables:void 0})).organizations??[]).map(o=>({id:o.id,name:o.name})),t=n.length===1?n[0]:void 0;if(t!=null)return t.id;process.stderr.write(`${n.length===0?At():jt(n)}
|
|
266
|
+
`),process.exit(1)}import{spawnSync as be}from"child_process";function Lt(){if(be("claude",["--version"],{stdio:"ignore"}).error!=null)return{kind:"claude-missing"};be("claude",["plugin","marketplace","add","ripplo/claude-plugin"],{stdio:"ignore"});let r=be("claude",["plugin","install","ripplo@ripplo"],{encoding:"utf8",stdio:["ignore","pipe","pipe"]}),n=/already installed/i.test(`${r.stdout}${r.stderr}`);return r.status!==0&&!n?{detail:r.stderr.trim(),kind:"plugin-install-failed"}:{exitCode:be("claude",["/ripplo:setup"],{stdio:"inherit"}).status??0,kind:"launched"}}function Nt(){return"Installing the Ripplo plugin for Claude Code, then handing off to a guided setup session."}function Ot(e){return e.kind==="claude-missing"?"Claude Code not found on your PATH. Install it, then re-run `npx ripplo setup`.":`Could not install the Ripplo plugin for Claude Code.${e.detail.length>0?`
|
|
267
|
+
${e.detail}`:""}`}function Ft(){process.stdout.write(`${Nt()}
|
|
268
|
+
`);let e=Lt();e.kind!=="launched"&&(process.stderr.write(`${Ot(e)}
|
|
269
|
+
`),process.exit(1)),process.exit(e.exitCode)}import{graphql as pl}from"gql.tada";function _t({id:e,kind:r,title:n}){return`Caught bug reported (${r}): "${n}" [${e}]`}var ml=pl(`
|
|
270
270
|
mutation ReportCaughtBug(
|
|
271
271
|
$projectId: String!
|
|
272
272
|
$kind: CaughtBugKind!
|
|
@@ -294,48 +294,72 @@ ${e.detail}`:""}`}function Ot(){process.stdout.write(`${Lt()}
|
|
|
294
294
|
}
|
|
295
295
|
}
|
|
296
296
|
}
|
|
297
|
-
`);async function
|
|
297
|
+
`);async function Wt(e){let r=g(),t=(await l({config:r,document:ml,variables:{kind:e.kind,projectId:r.projectId,rootCause:e.rootCause,runId:e.runId,surfacedBy:e.surfacedBy,title:e.title}})).reportCaughtBug;if(t?.__typename!=="CaughtBug"){let o=t?.__typename==="RunNotFoundError"?t.message:null;process.stderr.write(`${o??"reportCaughtBug failed"}
|
|
298
298
|
`),process.exit(1)}process.stdout.write(`${_t({id:t.id,kind:e.kind,title:e.title})}
|
|
299
|
-
`)}import
|
|
300
|
-
`);let
|
|
301
|
-
`)}})).match(
|
|
302
|
-
`),r.failed>0&&process.exit(1),process.exit(r.notRun>0?2:0)}function
|
|
303
|
-
`),process.exit(1)}function
|
|
304
|
-
`),sn(e.workspaceRoot)||
|
|
299
|
+
`)}import fl from"path";import{CancellationTokenSource as gl}from"vscode-jsonrpc/node";function Dt(e){return`ripplo: workspace build is stale (${e.join(", ")}) \u2014 rebuilding`}function Ut(){return"ripplo: workspace build failed \u2014 fix the build, then rerun"}function ve(e){return e.kind==="stale"?`! workspace build is stale (${e.packages.join(", ")}) \u2014 run pnpm build, then npx ripplo daemon restart`:e.kind==="foreign-binary"?"! this is the ripplo workspace but you're running the published CLI \u2014 use node_modules/.bin/ripplo so local changes apply":null}async function Bt({all:e,headed:r,ids:n}){let t=process.cwd(),o=process.argv[1];o==null&&O(pe({kind:"spawn-failed",message:"process.argv[1] missing"})),hl();let i=await cn(t);i!=null&&O(fn(i));let a=(await an({cliEntry:o,cwd:t})).match(p=>p,p=>O(pe(p)));a.versionNote?.kind==="stale-busy"&&O(Fe(a.versionNote)),a.versionNote!=null&&process.stderr.write(`${Fe(a.versionNote)}
|
|
300
|
+
`);let d=new gl;process.once("SIGINT",()=>{d.cancel(),a.socket.destroy(),process.exit(130)});let u=fl.join(t,".ripplo","debug"),f=(await ln({connection:a,request:{all:e,headed:r,tests:[...n]},token:d.token,onEvent:p=>{let y=mn({debugDir:u,event:p});y!=null&&process.stdout.write(`${y}
|
|
301
|
+
`)}})).match(p=>p,p=>O(pe(p)));await yl({connection:a,result:f})}async function yl({connection:e,result:r}){await new Promise(n=>{e.socket.end(n)}),r.kind==="daemon-error"&&O(gn(r.error)),process.stdout.write(`${pn(r)}
|
|
302
|
+
`),r.failed>0&&process.exit(1),process.exit(r.notRun>0?2:0)}function O(e){process.stderr.write(`${e}
|
|
303
|
+
`),process.exit(1)}function hl(){let e=q();if(e.kind==="fresh")return;if(e.kind==="foreign-binary"){let n=ve(e);O(n??"foreign binary in the ripplo workspace")}process.stderr.write(`${Dt(e.packages)}
|
|
304
|
+
`),sn(e.workspaceRoot)||O(Ut())}import F from"path";import xl from"os";import{mkdtempSync as Sl,rmSync as Cl}from"fs";import{err as Ce,ok as Je}from"neverthrow";import{z as qt}from"zod";import{readdir as kl,rm as wl,stat as bl}from"fs/promises";import{existsSync as vl}from"fs";import Ge from"path";async function ze(e,r){let t=(await kl(e,{withFileTypes:!0}).catch(()=>[])).filter(s=>s.isDirectory()).map(s=>s.name).filter(s=>s.startsWith("replay-")||s.startsWith("explore-")||vl(Ge.join(e,s,En)));if(t.length<=r)return;let i=(await Promise.all(t.map(async s=>({mtime:(await bl(Ge.join(e,s)).catch(()=>null))?.mtimeMs??0,name:s})))).toSorted((s,a)=>a.mtime-s.mtime).slice(r);await Promise.all(i.map(s=>wl(Ge.join(e,s.name),{force:!0,recursive:!0}).catch(()=>{})))}var Vt=50,Rl=15e3;async function Ht(){ie(b());let e=process.cwd(),r=_.child({worker:process.pid}),n=Rn(),t=Sl(F.join(xl.tmpdir(),"ripplo-browser-cache-")),o=le({cacheDir:t,clientVersion:b(),debugDir:F.join(e,".ripplo","debug"),headed:!1,writeOtlpPortFile:!1}),i=new Set,s=d=>{i.add(d),d.finally(()=>i.delete(d))},a=d=>{setTimeout(()=>{process.exit(d)},Rl).unref(),El(i).then(()=>o.close().catch(()=>{})).then(()=>{Cl(t,{force:!0,recursive:!0}),process.exit(d)})};process.on("disconnect",()=>{a(1)}),process.on("unhandledRejection",d=>{r.error({err:d},"worker unhandled rejection")}),process.on("uncaughtException",d=>{r.error({err:d},"worker uncaught exception"),a(1)}),n.onRequest(bn,async(d,u)=>{let w=hn.safeParse(d);if(!w.success)return xe("bad-run-assign");let f=w.data;X(e);let p=h(e).match($=>$,$=>$.kind);if(typeof p=="string")return xe(`config:${p}`);let y=await Kt(n);if(y.isErr())return xe(`lockfile-unavailable:${y.error}`);let Q=y.value,E=B(Q).find($=>$.ref===f.testRef);if(E==null)return xe(`no-test:${f.testRef}`);try{let{outcome:$,persisted:je}=await Pn({config:p,cwd:e,errorSettle:"settle",fixturesDir:F.join(e,Y),headed:f.headed,lockfile:Q,onPhase:void 0,runId:f.runId,session:o,signal:_e(u),test:E.test}),ur=F.join(e,".ripplo","debug");return s(Promise.allSettled([je]).then(()=>V({config:p,debugDir:ur,runId:f.runId})).then(()=>ze(ur,Vt)).catch(()=>{})),{outcome:yn($),serverNotified:!0}}catch($){let je=F.join(e,".ripplo","debug");if(s(V({config:p,debugDir:je,runId:f.runId}).catch(()=>{})),$ instanceof cr)return{outcome:{detail:$.message,kind:"infra-error"},serverNotified:!1};throw $}}),n.onRequest(xn,(d,u)=>Il({connection:n,cwd:e,raw:d,session:o,token:u,track:s})),n.onNotification(Sn,d=>{let u=kn.safeParse(d);u.success&&o.injectSpan(u.data.runId,u.data.span)}),n.onNotification(Cn,()=>{a(0)}),n.sendNotification(wn),await new Promise(()=>{})}function xe(e){return{outcome:{detail:e,kind:"error"},serverNotified:!1}}var $l=5e3;async function El(e){e.size!==0&&await Promise.race([Promise.allSettled(e),new Promise(r=>{setTimeout(r,$l)})])}var Pl=qt.object({assign:Vr,devSessionId:qt.string().nullable()});async function Il({connection:e,cwd:r,raw:n,session:t,token:o,track:i}){let s=Pl.safeParse(n);if(!s.success)return{error:{source:"bad-assign"},kind:"error"};let{assign:a,devSessionId:d}=s.data;X(r);let u=h(r).match(E=>E,E=>E.kind);if(typeof u=="string")return{error:{detail:u,source:"config"},kind:"error"};let w=await Kt(e);if(w.isErr())return{error:{source:"lockfile-stale"},kind:"error"};let f=w.value,p=F.join(u.cwd,".ripplo","debug"),y=await In({assign:a,config:u,debugDir:p,devSessionId:d??void 0,fixturesDir:F.join(u.cwd,Y),headed:!1,lockfile:f,report:!0,session:t,signal:_e(o)}),Q=y.kind==="finding"&&y.runId!=null?V({config:u,debugDir:p,runId:y.runId}):Promise.resolve();return i(Q.then(()=>ze(p,Vt)).catch(()=>{})),y}async function Kt(e){return(await Al(e)).andThen(n=>n.unavailable!=null?Ce(n.unavailable):n.lockfileJson==null?Ce("empty-reply"):jl(n.lockfileJson))}async function Al(e){try{return Je(await e.sendRequest(vn))}catch(r){return Ce(`transport:${r instanceof Error?r.message:"unknown"}`)}}var Se;function jl(e){if(Se!==void 0&&Se.json===e)return Je(Se.lockfile);try{let r=$r(L(A,e));return Se={json:e,lockfile:r},Je(r)}catch(r){return Ce(`worker-decode-failed:${r instanceof Error?r.message.slice(0,200):"unknown"}`)}}async function Gt(){await Ht()}import{existsSync as Ul}from"fs";import Bl from"path";import{ok as ql}from"neverthrow";import{gunzipSync as Tl}from"zlib";import{mkdir as Ml,writeFile as Ll}from"fs/promises";import zt from"path";import{graphql as Nl}from"gql.tada";import{err as re,ok as Ol}from"neverthrow";var Fl=31,_l=139;async function Re(e,r){let n=h(e).match(s=>s,s=>s.kind);if(typeof n=="string")return re({detail:n,kind:"config"});let t=await l({config:n,document:Wl,variables:{id:r}}).catch(()=>null);if(t==null)return re({kind:"request-failed"});if(t.run==null)return re({kind:"not-found"});if(t.run.behaviorUrl==null)return re({kind:"not-uploaded"});let o=await fetch(t.run.behaviorUrl);if(!o.ok)return re({kind:"download-failed",status:o.status});let i=zt.join(e,".ripplo","debug",r,"behavior.jsonl");return await Ml(zt.dirname(i),{recursive:!0}),await Ll(i,Dl(Buffer.from(await o.arrayBuffer()))),Ol({path:i,runId:r})}var Wl=Nl(`
|
|
305
305
|
query RunBehaviorUrl($id: String!) {
|
|
306
306
|
run(id: $id) {
|
|
307
307
|
id
|
|
308
308
|
behaviorUrl
|
|
309
309
|
}
|
|
310
310
|
}
|
|
311
|
-
`);function
|
|
312
|
-
`).filter(s=>s.trim().length>0).flatMap(s=>{let a=
|
|
313
|
-
`)
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
311
|
+
`);function Dl(e){return e[0]===Fl&&e[1]===_l?Tl(e):e}async function G(e,r){let n=Bl.join(e,".ripplo","debug",r,"behavior.jsonl");return Ul(n)?ql(void 0):(await Re(e,r)).map(()=>{})}import{existsSync as Qt,readFileSync as Xt}from"fs";import Yt from"path";import{err as Vl,ok as Hl}from"neverthrow";import{z as Qe}from"zod";var Zt=" \u203A ",Kl=4e3,Gl=5,eo="fact ",ro="step ",zl="data rule ";async function no(e,r){let n=Yt.join(e,".ripplo","debug",r,"behavior.jsonl");if(!Qt(n))return Vl({kind:"run-not-found",runId:r});let t=Jl(Xt(n,"utf8")),o=fd(e),i=o==null?[]:await _r(o),s=[...t.assertions.filter(a=>a.outcome!=="passed").map(a=>od({assertion:a,facts:i,lockfile:o,run:t})),...t.findings.map(a=>ed({event:a,facts:i,lockfile:o,run:t}))];return Hl({durationMs:Math.max(0,t.lastTs-t.firstTs),failures:s,lockfileLoaded:o!=null,runId:r,viewport:t.viewport})}function Jl(e){let r=e.split(`
|
|
312
|
+
`).filter(s=>s.trim().length>0).flatMap(s=>{let a=M(s);return a==null?[]:[a]}),n=r.filter(s=>s.kind==="assertion"),t=r.filter(s=>s.kind==="finding"),o=r.flatMap(s=>Yl(s)),i=r.map(s=>W(s.timeNanos));return{assertions:n,causes:o,findings:t,firstTs:i.length===0?0:Math.min(...i),lastTs:i.length===0?0:Math.max(...i),viewport:Xl(r)}}var Ql=Qe.object({height:Qe.number(),width:Qe.number()});function Xl(e){return e.flatMap(r=>{if(r.kind!=="rrweb"||r.event.type!==4)return[];let n=Ql.safeParse(r.event.data);return n.success?[n.data]:[]})[0]}function Yl(e){let r=Zl(e);return r==null?[]:[{detail:r,timestamp:W(e.timeNanos)}]}function Zl(e){return e.kind==="network"?{kind:"network",method:e.method,status:e.status,traceId:e.traceId,url:e.url}:e.kind==="console"?e.level==="error"||e.level==="warning"?{kind:"console",level:e.level,text:e.text}:null:e.kind==="error"?{kind:"error",message:e.message}:e.kind==="span"?{durationMs:e.durationMs,kind:"span",name:e.name,statusCode:e.status.code,traceId:e.traceId}:null}function ed({event:e,facts:r,lockfile:n,run:t}){let o=W(e.timeNanos),i=e.payload,s=i.kind==="mismatch"?"fact":"unknown",a=i.kind==="mismatch"||i.kind==="pendingCheck";return{browserMismatch:void 0,causes:so(t.causes,o),label:nd(i),outcome:"failed",pending:i.kind==="mismatch"?i.pending:void 0,ruleKind:s,rules:io({check:to(i),facts:r,lockfile:n,ruleKind:s,subjectKey:rd(i)}),runWorkflow:e.step.split(Zt)[0]??e.step,snapshotAt:o,step:e.step,wait:a?i.wait:void 0,waitMs:a?i.waitMs:void 0}}function rd(e){return e.kind==="mismatch"&&e.mismatch.kind==="scalarMismatch"?e.mismatch.subjectKey:void 0}function to(e){return e.kind==="mismatch"?oo(e.mismatch):e.kind==="unrunnable"?e.reason:e.kind==="impossibleAction"?e.action:e.kind==="driverError"?e.errorKind:e.subject}function oo(e){return e.kind==="scalarMismatch"?e.subject:e.kind==="missingRow"||e.kind==="unexpectedRow"?`${e.entity} [${e.key}]`:`${e.entity}.${e.field} [${e.key}]`}function nd(e){return e.kind==="mismatch"?td(e.mismatch):e.kind==="pendingCheck"&&e.expected!=null?`${e.kind} ${e.subject}: expected ${e.expected}`:e.kind==="unrunnable"&&e.unmet!=null?`${e.kind} ${e.reason}: ${e.unmet}`:`${e.kind} ${to(e)}`}function td(e){let r=oo(e);return e.kind==="missingRow"||e.kind==="unexpectedRow"?`${e.kind} ${r}`:`${e.kind} ${r}: expected ${e.expected}, got ${e.actual}`}function od({assertion:e,facts:r,lockfile:n,run:t}){let o=id(e.label),i=W(e.timeNanos);return{browserMismatch:void 0,causes:so(t.causes,i),label:e.label,outcome:e.outcome==="error"?"error":"failed",pending:void 0,ruleKind:o,rules:io({check:sd(e.label,o),facts:r,lockfile:n,ruleKind:o,subjectKey:void 0}),runWorkflow:e.step.split(Zt)[0]??e.step,snapshotAt:i,step:e.step,wait:e.wait,waitMs:e.waitMs}}function id(e){return e.startsWith(eo)?"fact":e.startsWith(zl)?"data-rule":e.startsWith(ro)?"step":"unknown"}function sd(e,r){return r==="fact"?e.slice(eo.length):r==="step"?e.slice(ro.length):e}function io({check:e,facts:r,lockfile:n,ruleKind:t,subjectKey:o}){return t!=="fact"||n==null?[]:r.filter(i=>ad({check:e,rule:i,subjectKey:o})).map(i=>({consequence:Le(i.consequence),origins:ld(i.origin,n),provenance:cd(i.origin),url:Ur(i.when),when:Br(i.when)}))}function ad({check:e,rule:r,subjectKey:n}){return n!=null?Wr(r)===n:Le(r.consequence)===e}function ld(e,r){let n=B(r),t=dd(e).flatMap(o=>{let i=n.find(s=>s.ref===o);return i==null?[]:[{intent:i.workflow.intent,sourcePath:i.workflow.sourcePath}]});return ud(t)}function dd(e){return e==null?[]:e.kind==="declared"?[]:e.kind==="generalized"?Dr(e):[e.test]}function ud(e){return[...new Map(e.map(r=>[r.intent,r])).values()]}function cd(e){return e!=null&&e.kind==="generalized"?"learned":"inferred"}function so(e,r){let n=e.filter(t=>t.timestamp<=r&&t.timestamp>=r-Kl).toSorted((t,o)=>o.timestamp-t.timestamp);return pd(n).toSorted((t,o)=>Number(Jt(o.detail))-Number(Jt(t.detail))).slice(0,Gl).map(t=>({deltaMs:r-t.timestamp,detail:t.detail}))}function pd(e){return e.reduce((r,n)=>{let t=md(n.detail);return r.keys.has(t)?r:{keys:new Set([...r.keys,t]),out:[...r.out,n]}},{keys:new Set,out:[]}).out}function md(e){return e.kind==="network"?`net ${e.method} ${String(e.status)} ${e.url.split("?")[0]??""}`:e.kind==="console"?`console ${e.text}`:e.kind==="error"?`err ${e.message}`:`span ${e.name} ${e.statusCode}`}function Jt(e){return e.kind==="network"?e.status>=400:e.kind==="span"?e.statusCode==="error":!0}function fd(e){let r=Yt.join(e,".ripplo","ripplo.lock");if(!Qt(r))return null;try{return L(A,Xt(r,"utf8"))}catch{return null}}import{existsSync as ao,readFileSync as lo}from"fs";import uo from"path";import{graphql as gd}from"gql.tada";async function co(e,r,n){let t=hd(e),o=t==null?void 0:await kd(n,r,t);return{timeline:yd(Cd(e,r)),world:o}}function yd(e){let r=e.filter(n=>n.kind==="finding");return e.filter(n=>n.kind==="step").toSorted((n,t)=>n.stepIndex-t.stepIndex).map(n=>vd(n,r.filter(t=>t.stepIndex===n.stepIndex)))}function hd(e){let r=uo.join(e,".ripplo","ripplo.lock");return ao(r)?L(A,lo(r,"utf8")):null}async function kd(e,r,n){let t=await l({config:e,document:Rd,variables:{id:r}}).catch(()=>null);if(t?.run==null)return;let o=wd(t.run);return o!=null?B(n).find(i=>i.ref===o)?.test:bd(n,t.run.reproJson)}function wd(e){let r=e.workflow?.slug,n=e.test?.slug;return r==null||n==null?void 0:`${r}/${n}`}function bd(e,r){if(r==null)return;let n=ae.parse(JSON.parse(r));return Hr(e,{sweep:!0}).find(t=>t.name===n.baseStateRef)?.test}function vd(e,r){return{changes:[...e.stateRows.flatMap(n=>xd(n)),...e.stateSingletons.flatMap(n=>Sd(n))],checksHeld:e.annotations.filter(n=>n.outcome==="passed").length,failures:r.map(n=>n.payload),index:e.stepIndex,title:e.title,url:e.pageUrl,workflow:e.sourceTest}}function xd(e){return e.status==="present"?[]:[`${e.status} ${e.entity} ${e.key}`]}function Sd(e){return e.changed?[`${e.name} = ${e.value??"\u2205"}`]:[]}function Cd(e,r){let n=uo.join(e,".ripplo","debug",r,"behavior.jsonl");return ao(n)?lo(n,"utf8").split(`
|
|
313
|
+
`).filter(t=>t.trim().length>0).flatMap(t=>{let o=M(t);return o==null?[]:[o]}):[]}var Rd=gd(`
|
|
314
|
+
query ExplainRunTest($id: String!) {
|
|
315
|
+
run(id: $id) {
|
|
316
|
+
id
|
|
317
|
+
reproJson
|
|
318
|
+
test {
|
|
319
|
+
id
|
|
320
|
+
slug
|
|
321
|
+
}
|
|
322
|
+
workflow {
|
|
323
|
+
id
|
|
324
|
+
slug
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
`);var po=" \u203A ",$d=["fact ","data rule ","step "];function go(e){if(e.failures.length===0)return`${c.good("ok")} \u2014 ${e.runId}: no failing checks.`;let r=e.viewport==null?"":` (viewport ${String(e.viewport.width)}\xD7${String(e.viewport.height)})`,n=`${e.runId} \u2014 ${R(e.failures.length,"failing check")}${r}`,t=e.lockfileLoaded?[]:[c.dim("(no lockfile \u2014 provenance unavailable)")],o=Ed(e.failures).map(i=>Pd(i,e.runId));return[n,...t,"",...o,S("tasks")].join(`
|
|
329
|
+
`)}function yo(e){return`${c.bad("fail")} \u2014 no artifacts for ${e.runId}. Run \`npx ripplo pull ${e.runId}\` first.`}function Ed(e){return[...new Set(e.map(n=>n.step))].map(n=>({failures:e.filter(t=>t.step===n),step:n}))}function Pd(e,r){let n=e.failures[0];if(n==null)return"";let t=Id(e,r);if(t!=null)return t;let o=[...new Set(e.failures.map(s=>ko(s.label)))].join(", "),i=c.dim(`(${n.runWorkflow})`);return[`${c.bad("\u2717")} ${jd(e.step)} ${i}`,` ${c.dim("failed")} ${o}`,...Td(e),...Fd(n),..._d(n.causes),` ${c.dim("frame")} npx ripplo snapshot ${r} --at ${String(n.snapshotAt)}`,""].join(`
|
|
330
|
+
`)}function Id(e,r){let n=e.failures[0],t=e.failures.flatMap(u=>u.browserMismatch==null?[]:[u.browserMismatch])[0],o=ho(e.failures.flatMap(u=>u.rules));if(n==null||t==null||o.length===0)return null;let i=ko(e.failures.find(u=>u.rules.length>0)?.label??n.label),s=[...new Set(o.map(u=>u.url))].join(", "),a=c.dim(`(${n.runWorkflow})`);return[`${c.bad("\u2717")} ${i} ${c.warn("(wrong page)")} ${a}`,` ${c.dim("rule learned for url")} ${s}`,` ${c.dim("browser was actually at")} ${t.actual}`,` ${c.warn("\u21B3 declare the navigation: add url.path`...` to the step that caused it")}`,` ${c.dim("frame")} npx ripplo snapshot ${r} --at ${String(n.snapshotAt)}`,""].join(`
|
|
331
|
+
`)}function ho(e){let r=e.map(n=>[Ad(n),n]);return[...new Map(r).values()]}function Ad(e){return`${e.url}|${e.when}|${e.origins.map(r=>r.intent).join(",")}`}function ko(e){let r=$d.find(n=>e.startsWith(n));return r==null?e:e.slice(r.length)}function jd(e){let r=e.split(po);return r.length<2?e:r.slice(1).join(po)}function Td(e){let r=ho(e.failures.flatMap(n=>n.rules));return r.length===0?[]:[...r.flatMap(n=>Md(n)),...Od(e,r)]}function Md(e){let r=e.origins.length===0?c.dim("origin not in lockfile"):e.origins.map(n=>Ld(n)).join(", ");return[` ${c.dim(Nd(e.provenance))}`,` ${c.dim("from")} ${r}`,` ${c.dim("at")} ${e.url} ${c.dim("\u2014 holds only when")} ${e.when}`]}function Ld(e){if(e.sourcePath==null)return e.intent;let r=c.dim(`(${e.sourcePath})`);return`${e.intent} ${r}`}function Nd(e){return e==="learned"?"learned \u2014 kept only the conditions these flows share":"inferred \u2014 from a flow that reaches this state"}function Od(e,r){let n=new Set(r.flatMap(o=>o.origins.map(i=>i.intent)));return e.failures.some(o=>n.has(o.runWorkflow))||n.size===0?[]:[` ${c.warn("\u21B3 learned from another flow \u2014 likely a fact scoped too broadly")}`]}function Fd(e){if(e.waitMs==null||e.wait==null)return[];let r=`${String(Math.round(e.waitMs/1e3))}s`,n=e.pending===!0?" \u2014 value never changed (write may be slow or dropped)":"";return[` ${c.dim("waited")} up to ${r} (wait: ${e.wait})${n}`]}function _d(e){if(e.length===0)return[];let r=Wd(e),n=e.flatMap(t=>Dd(t,r));return n.length===0?[]:[` ${c.dim("nearby")} ${n.join(" \xB7 ")}`]}function Wd(e){let r=e.flatMap(n=>n.detail.kind==="span"&&n.detail.traceId!=null?[[n.detail.traceId,n.detail]]:[]);return new Map(r)}function Dd(e,r){let n=e.detail;if(n.kind==="span"&&n.traceId!=null&&r.has(n.traceId))return[];if(n.kind==="network"&&n.traceId!=null){let t=r.get(n.traceId),o=t==null?"":` \u21B9 ${Xe(t)}`;return[fo(n,`${Xe(n)}${o}`)]}return[fo(n,Xe(n))]}function Xe(e){return e.kind==="network"?`${e.method} ${String(e.status)} ${Ud(e.url)}`:e.kind==="console"?`console.${e.level} ${mo(e.text)}`:e.kind==="error"?`error ${mo(e.message)}`:`span ${e.name} ${e.statusCode} ${String(Math.round(e.durationMs))}ms`}function Ud(e){let r=e.split("?")[0]??e;return r.length>60?`\u2026${r.slice(-57)}`:r}function mo(e){let r=e.replaceAll(/\s+/g," ").trim();return r.length>100?`${r.slice(0,97)}\u2026`:r}function fo(e,r){return Bd(e)?c.bad(r):r}function Bd(e){return e.kind==="network"?e.status>=400:e.kind==="console"?e.level==="error":e.kind==="error"||e.statusCode==="error"}function wo(e){return[qd(e.world),"",Gd(e.factOrigins),zd(e.timeline,e.factOrigins)].filter(r=>r.length>0).join(`
|
|
332
|
+
`)}function qd(e){return e==null?c.dim("world (couldn't resolve the run's test \u2014 offline, or it left the model)"):["world the model set up",...[...e.world.map(n=>` - ${Vd(n)}`),...e.absent.map(n=>` - ${Hd(n)}`),...Object.entries(e.singletons).map(([n,t])=>` - ${n} = ${vo(t)}`),` - actor: ${Kd(e)}`]].join(`
|
|
333
|
+
`)}function Vd(e){return`${e.entity} as ${e.as} ${c.dim(bo(e.set))}`}function bo(e){return`{ ${Object.entries(e).map(([n,t])=>`${n}: ${vo(t)}`).join(", ")} }`}function vo(e){return e==null?"\u2205":typeof e=="object"?"ref"in e?`\u2192${e.ref}`:JSON.stringify(e):String(e)}function Hd(e){return`no ${e.entity} where ${c.dim(bo(e.where))}`}function Kd(e){return e.actor.kind==="user"?`signed in as ${e.actor.alias}`:"signed out"}function Gd(e){return e.length===0?"":["facts checked here were declared in",...e.map(n=>` - ${n}`),""].join(`
|
|
334
|
+
`)}function zd(e,r){return e.length===0?c.dim("timeline (no steps captured)"):["what happened, step by step",...e.map(t=>Jd(t,r))].join(`
|
|
335
|
+
`)}function Jd(e,r){let n=` ${String(e.index+1)}. ${e.title}${Qd(e.workflow)}${Xd(e.url)}`,t=e.changes.length===0?[]:[` \u0394 ${e.changes.join(", ")}`],o=e.failures.map(s=>` ${c.bad("\u2717")} ${Yd(s,r)}`),i=e.checksHeld===0?[]:[c.dim(` ${String(e.checksHeld)} checks held`)];return[n,...t,...o,...i].join(`
|
|
336
|
+
`)}function Qd(e){if(e==null)return"";let r=`(${e})`;return` ${c.dim(r)}`}function Xd(e){if(e==null)return"";let r=`@ ${e}`;return` ${c.dim(r)}`}function Yd(e,r){switch(e.kind){case"mismatch":return Zd(e.mismatch,e.pending,e.waitMs);case"pendingCheck":return ru(e,r);case"unrunnable":{let n=e.unmet==null?"":`: needs ${e.unmet}`;return`couldn't run \u2014 ${e.reason}${n}`}case"impossibleAction":return`impossible action: ${e.action} on ${e.subject}`;case"liftVisibility":{let n=String(e.visibleIndex+1),t=String(e.declaredIndex+1);return`${e.subject} visible by step ${n} but declared at step ${t}`}case"driverError":{let n=e.message==null?"":`: ${e.message}`;return`driver error (${e.errorKind})${n}`}}}function Zd(e,r,n){let t=r?` (never settled in ${String(n)}ms)`:"";return`${eu(e)}${t}`}function eu(e){switch(e.kind){case"scalarMismatch":return`${e.subject}: expected ${e.expected}, got ${e.actual}`;case"wrongValue":return`${e.entity}.${e.field} [${e.key}]: expected ${e.expected}, got ${e.actual}`;case"expectedChange":return`${e.entity}.${e.field} [${e.key}] never changed \u2014 stayed ${e.actual}, expected ${e.expected}`;case"missingRow":return`missing ${e.entity} row "${e.key}"`;case"unexpectedRow":return`unexpected ${e.entity} row "${e.key}"`}}function ru(e,r){let n=e.negated?"not ":"",t=e.expected==null?"":` = ${e.expected}`,o=e.checkKind??"check",i=nu(e.source,r);return`${n}${o} ${e.subject}${t} never held in ${String(e.waitMs)}ms (${e.source})${i}`}function nu(e,r){return e==="step"||r.length===0?"":` \u2014 declared in ${r.join("; ")}`}function xo(e){return`Saved behavior.jsonl to ${e.path}`}function z(e){switch(e.kind){case"config":return`Can't read project config (${e.detail}). Run this from your project root.`;case"request-failed":return"Couldn't reach the server. Check you're signed in with `npx ripplo auth`.";case"not-found":return"No run with that id.";case"not-uploaded":return"This run has no uploaded artifacts yet \u2014 it may still be running, or predates artifact upload.";case"download-failed":return`Download failed (HTTP ${String(e.status)}). The link may have expired \u2014 try again.`}}async function So({full:e,json:r,runId:n}){let t=process.cwd(),o=await G(t,n);o.isErr()&&(process.stderr.write(`${z(o.error)}
|
|
337
|
+
`),process.exit(1));let i=await no(t,n);i.isErr()&&(process.stderr.write(`${yo(i.error)}
|
|
338
|
+
`),process.exit(1));let s=i.value;process.stdout.write(`${r?JSON.stringify(s,null,2):go(s)}
|
|
339
|
+
`),e&&!r&&await tu(t,n,ou(s))}async function tu(e,r,n){let t=h(e).unwrapOr(void 0);if(t==null)return;let o=await co(e,r,t);process.stdout.write(`
|
|
340
|
+
${wo({...o,factOrigins:n})}
|
|
341
|
+
`)}function ou(e){let r=e.failures.filter(n=>n.ruleKind==="fact").flatMap(n=>n.rules).flatMap(n=>n.origins).map(n=>n.sourcePath==null?n.intent:`${n.intent} (${n.sourcePath})`);return[...new Set(r)]}async function Co({runId:e}){(await Re(process.cwd(),e)).match(n=>{process.stdout.write(`${xo(n)}
|
|
342
|
+
`)},n=>{process.stderr.write(`${z(n)}
|
|
343
|
+
`),process.exit(1)})}import{randomUUID as iu}from"crypto";import{existsSync as su,readFileSync as au}from"fs";import Ye from"path";import{graphql as $o}from"gql.tada";import{err as J,ok as Ro}from"neverthrow";async function Eo(e,r,n){let t=h(e).match(y=>y,y=>y.kind);if(typeof t=="string")return J({detail:t,kind:"config"});let o=await jr(e);if(o.result.isErr())return J({kind:"compile-failed"});let i=await l({config:t,document:uu,variables:{id:r}}).catch(()=>null);if(i==null)return J({kind:"request-failed"});if(i.run==null)return J({kind:"not-found"});let s=i.run.reproJson;if(s==null)return J({kind:"no-repro"});let a=ae.parse(JSON.parse(s)),d=await ue(e,o.result.value),u=`replay-${iu()}`,w=Ye.join(e,".ripplo","debug"),f=[],p=le({cacheDir:void 0,clientVersion:b(),debugDir:w,headed:!1,writeOtlpPortFile:!1});try{let y=await zr({capture:!0,lockfile:d,options:{baseUrl:t.appUrl,engineUrl:t.engineUrl,fixturesDir:Ye.join(e,Y),generate:Cr,headed:!1,secret:t.webhookSecret},repro:a,runId:u,session:p,signal:n,onEvent:E=>{f.push(E)}});return(await lu({config:t,debugDir:w,events:f,outcome:y,replayRunId:u,reproJson:s,stepSources:a.steps.map(E=>E.test)})).map(()=>({outcome:y,recordingCaptured:du(w,u),replayRunId:u}))}finally{await p.close()}}async function lu({config:e,debugDir:r,events:n,outcome:t,replayRunId:o,reproJson:i,stepSources:s}){if(t.kind!=="resolved"&&t.kind!=="still-fails")return Ro(void 0);try{return await l({config:e,document:cu,variables:{projectId:e.projectId,reproJson:i,runId:o}}),await $n({config:e,debugDir:r,events:n,recordingOptional:!0,runId:o,stepSources:s}),await V({config:e,debugDir:r,runId:o}),Ro(void 0)}catch{return J({kind:"report-failed"})}}function du(e,r){let n=Ye.join(e,r,"behavior.jsonl");return su(n)?au(n,"utf8").split(`
|
|
344
|
+
`).some(t=>t.includes('"kind":"rrweb"')):!1}var uu=$o(`
|
|
322
345
|
query RunRepro($id: String!) {
|
|
323
346
|
run(id: $id) {
|
|
324
347
|
id
|
|
325
348
|
reproJson
|
|
326
349
|
}
|
|
327
350
|
}
|
|
328
|
-
`),
|
|
351
|
+
`),cu=$o(`
|
|
329
352
|
mutation CreateReplayRun($projectId: String!, $runId: String!, $reproJson: String) {
|
|
330
353
|
createExploreRun(projectId: $projectId, runId: $runId, reproJson: $reproJson) {
|
|
331
354
|
id
|
|
332
355
|
}
|
|
333
356
|
}
|
|
334
|
-
`);function
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
`),process.exit(1)}
|
|
338
|
-
`)
|
|
357
|
+
`);function Po({outcome:e,recordingCaptured:r,replayRunId:n}){let t=pu(e);if(e.kind!=="resolved"&&e.kind!=="still-fails")return t;let o=r?"":"\n! No page recording was captured \u2014 the page may never have loaded. Treat this verdict with suspicion and confirm with `npx ripplo run`.",i=e.kind==="resolved"?`
|
|
358
|
+
! A clean replay confirms the fix but doesn't explain the original failure. Classify the root cause \u2014 app bug or model gap \u2014 before you resolve. Don't file it as flake unless you know why it flaked.`:"";return`${t}${o}${i}
|
|
359
|
+
Replay run ${n} \u2014 snapshot it, or cite it as resolve proof: \`npx ripplo tasks resolve <id> --run ${n}\`.`}function pu(e){switch(e.kind){case"resolved":return"\u2713 Resolved \u2014 the finding's trail ran clean.";case"still-fails":return`\u2717 Still failing \u2014 ${R(e.findings.length,"check")} still mismatch.`;case"unplannable":return"! Model changed \u2014 this trail's base state or actions no longer exist. Use `npx ripplo compile` and `npx ripplo run`.";case"state-unavailable":return`! Couldn't run the trail (${e.reason}).`;case"aborted":return"Replay aborted."}}function Io(e){switch(e.kind){case"config":return`Can't read project config (${e.detail}). Run from your project root.`;case"compile-failed":return"Couldn't compile the local `.ripplo/` model. Run `npx ripplo compile` first.";case"request-failed":return"Couldn't reach the server. Check you're signed in with `npx ripplo auth`.";case"not-found":return"No run with that id.";case"no-repro":return"This run has no replayable trail \u2014 predates repro capture, or isn't an explore finding.";case"report-failed":return"The replay finished but couldn't be registered with the server, so its id won't work as resolve proof. Check you're signed in, then rerun `npx ripplo replay`."}}function Ao(e){return e.kind==="resolved"}async function jo({runId:e}){(await Eo(process.cwd(),e,new AbortController().signal)).match(n=>{process.stdout.write(`${Po(n)}
|
|
360
|
+
`),process.exit(Ao(n.outcome)?0:1)},n=>{process.stderr.write(`${Io(n)}
|
|
361
|
+
`),process.exit(1)})}import qo from"path";import{existsSync as xu}from"fs";import{writeFile as Do}from"fs/promises";import Uo from"path";import{err as te,ok as Su}from"neverthrow";import{createRequire as mu}from"module";import{readFile as Mo}from"fs/promises";import{fileURLToPath as fu}from"url";import{z as ne}from"zod";var gu={height:800,width:1280};async function Lo(e){let r=await Mo(e,"utf8");return yu(r).flatMap(n=>n.kind==="rrweb"?[n.event]:[])}function yu(e){return e.split(`
|
|
362
|
+
`).filter(r=>r.length>0).flatMap(r=>{let n=M(r);return n==null?[]:[n]})}var hu=ne.object({data:ne.looseObject({height:ne.number(),width:ne.number()}),type:ne.literal(4)});function Ze(e){let r=e.flatMap(n=>{let t=hu.safeParse(n);return t.success?[t.data]:[]})[0];return r==null?gu:{height:r.data.height,width:r.data.width}}var ku='<svg xmlns="http://www.w3.org/2000/svg" width="17" height="22" viewBox="0 0 17 22"><path d="M1 1 L1 17 L5.4 12.8 L8.5 20 L11 19 L8 11.8 L14 11.8 Z" fill="black" stroke="white" stroke-width="1.3"/></svg>',wu=`.replayer-mouse-tail { display: none; }
|
|
339
363
|
.replayer-mouse {
|
|
340
364
|
position: absolute;
|
|
341
365
|
width: 17px;
|
|
@@ -343,28 +367,28 @@ Replay run ${n} \u2014 snapshot it, or cite it as resolve proof: \`npx ripplo ta
|
|
|
343
367
|
z-index: 9999;
|
|
344
368
|
background-repeat: no-repeat;
|
|
345
369
|
background-size: contain;
|
|
346
|
-
background-image: url('data:image/svg+xml;utf8,${
|
|
347
|
-
}`,
|
|
370
|
+
background-image: url('data:image/svg+xml;utf8,${ku}');
|
|
371
|
+
}`,bu=".replayer-mouse, .replayer-mouse-tail { display: none; }";function No(e){return`<!doctype html><html><head><style>
|
|
348
372
|
html, body { margin: 0; padding: 0; }
|
|
349
373
|
.replayer-wrapper { position: relative; }
|
|
350
|
-
${e?
|
|
374
|
+
${e?wu:bu}
|
|
351
375
|
iframe { border: none; }
|
|
352
|
-
</style></head><body></body></html>`}var
|
|
376
|
+
</style></head><body></body></html>`}var Oo="*, *::before, *::after { animation-duration: 0s !important; animation-delay: 0s !important; transition-duration: 0s !important; transition-delay: 0s !important; }";function Fo(){return`(async () => {
|
|
353
377
|
const doc = document.querySelector(".replayer-wrapper iframe")?.contentDocument;
|
|
354
378
|
if (doc?.fonts != null) {
|
|
355
379
|
await doc.fonts.ready;
|
|
356
380
|
}
|
|
357
381
|
await new Promise((resolve) => requestAnimationFrame(() => requestAnimationFrame(resolve)));
|
|
358
|
-
})()`}function
|
|
382
|
+
})()`}function _o(){return import("playwright").then(({chromium:e})=>e.launch({args:["--no-sandbox"],headless:!0})).catch(()=>null)}var To;function Wo(){return To??=Mo(vu(),"utf8"),To}function vu(){let e=mu(import.meta.url);try{return e.resolve("@ripplo/rrweb-bundle/replay")}catch{return fu(new URL("assets/rrweb-replay.js",import.meta.url))}}async function Bo({jsonlPath:e,moment:r,outDir:n,runId:t}){if(!xu(e))return te({kind:"run-not-found",runId:t});let o=await Lo(e),i=o[0],s=o.at(-1);if(i==null||s==null)return te({kind:"no-rrweb-events",runId:t});let a=s.timestamp-i.timestamp,d=r.kind==="offset"?r.offsetMs:r.at-i.timestamp;if(d<0)return te({durationMs:a,firstTimestamp:i.timestamp,kind:"moment-out-of-range",lastTimestamp:s.timestamp,moment:r});let u=Math.min(d,a),w=String(Math.round(u)),f=Uo.join(n,`snapshot-${w}ms.png`),p=Uo.join(n,`snapshot-${w}ms.html`);return(await Cu({events:o,htmlPath:p,offsetMs:u,pngPath:f})).map(()=>({durationMs:a,htmlPath:p,offsetMs:u,pngPath:f,viewport:Ze(o)}))}async function Cu({events:e,htmlPath:r,offsetMs:n,pngPath:t}){let o=await _o();if(o==null)return te({detail:"chromium launch",kind:"browser-failed"});try{let{html:i,png:s}=await Ru({browser:o,events:e,offsetMs:n});return await Do(t,s),await Do(r,i,"utf8"),Su(void 0)}catch(i){return te({detail:i instanceof Error?i.message:String(i),kind:"browser-failed"})}finally{await o.close()}}async function Ru({browser:e,events:r,offsetMs:n}){let t=Ze(r),o=await e.newPage({viewport:t});await o.setContent(No(!1)),await o.addScriptTag({content:await Wo()}),await o.evaluate($u({events:r,offsetMs:n})),await o.evaluate(Fo());let i=o.locator(".replayer-wrapper iframe").first(),a=await(await i.count()>0?i:o).screenshot({type:"png"});return{html:await o.evaluate(Eu()),png:a}}function $u({events:e,offsetMs:r}){return`(() => {
|
|
359
383
|
const replayer = new globalThis.__RipploReplayer(${JSON.stringify(e)}, {
|
|
360
|
-
insertStyleRules: [${JSON.stringify(
|
|
384
|
+
insertStyleRules: [${JSON.stringify(Oo)}],
|
|
361
385
|
mouseTail: false,
|
|
362
386
|
root: document.body,
|
|
363
387
|
showWarning: false,
|
|
364
388
|
});
|
|
365
389
|
replayer.pause(${String(r+.5)});
|
|
366
390
|
globalThis.__ripploSnapshotReplayer = replayer;
|
|
367
|
-
})()`}function
|
|
391
|
+
})()`}function Eu(){return`(() => {
|
|
368
392
|
const replayer = globalThis.__ripploSnapshotReplayer;
|
|
369
393
|
if (replayer == null) {
|
|
370
394
|
return "";
|
|
@@ -382,43 +406,43 @@ iframe { border: none; }
|
|
|
382
406
|
}
|
|
383
407
|
});
|
|
384
408
|
return "<!doctype html>\\n" + doc.documentElement.outerHTML;
|
|
385
|
-
})()`}function
|
|
386
|
-
`)}function
|
|
387
|
-
`),process.exit(1));let o=await
|
|
388
|
-
`),process.exit(1)),(await
|
|
389
|
-
`)},s=>{process.stderr.write(`${
|
|
390
|
-
`),process.exit(1)})}function
|
|
409
|
+
})()`}function Vo({cwd:e,moment:r,runId:n}){let t=qo.join(e,".ripplo","debug",n);return Bo({jsonlPath:qo.join(t,"behavior.jsonl"),moment:r,outDir:t,runId:n})}function Ho(e){return[`${c.good("ok")} \u2014 rendered the page at ${String(Math.round(e.offsetMs))}ms into the recording (duration ${String(Math.round(e.durationMs))}ms, viewport ${String(e.viewport.width)}\xD7${String(e.viewport.height)})`,e.pngPath,"Read the PNG above to see the page state. Layout and text are faithful \u2014 URL-referenced images may be blank if the dev server is down.",e.htmlPath,"The HTML is the same frame with every element tagged `data-rrweb-id`. Grep it for your element's class or text to get the id for `tasks comment --element`."].join(`
|
|
410
|
+
`)}function Ko(e){return`${c.bad("fail")} \u2014 ${Pu(e)}`}function Go(){return`${c.bad("fail")} \u2014 pass exactly one of --at <epoch-ms from behavior.jsonl> or --offset <ms from the start of the recording>.`}function Pu(e){switch(e.kind){case"run-not-found":return`no debug artifacts for run ${e.runId} (.ripplo/debug/${e.runId}/behavior.jsonl missing). ${S("run")}`;case"no-rrweb-events":return`run ${e.runId} has a behavior.jsonl but no rrweb events \u2014 nothing to replay.`;case"moment-out-of-range":return`${e.moment.kind==="offset"?"--offset":"--at"} is outside the recording, which spans ${String(e.firstTimestamp)}\u2013${String(e.lastTimestamp)} (duration ${String(e.durationMs)}ms). Pass --at <epoch-ms from behavior.jsonl> or --offset <0\u2013${String(e.durationMs)}>.`;case"browser-failed":return`replay browser failed (${e.detail}). Is chromium installed? Try \`npx playwright install chromium\`.`}}async function zo({at:e,offset:r,runId:n}){let t=Iu({at:e,offset:r});t==null&&(process.stderr.write(`${Go()}
|
|
411
|
+
`),process.exit(1));let o=await G(process.cwd(),n);o.isErr()&&(process.stderr.write(`${z(o.error)}
|
|
412
|
+
`),process.exit(1)),(await Vo({cwd:process.cwd(),moment:t,runId:n})).match(s=>{process.stdout.write(`${Ho(s)}
|
|
413
|
+
`)},s=>{process.stderr.write(`${Ko(s)}
|
|
414
|
+
`),process.exit(1)})}function Iu({at:e,offset:r}){if(e!=null&&r==null)return{at:e,kind:"absolute"};if(r!=null&&e==null)return{kind:"offset",offsetMs:r}}function Jo(e,r){switch(e.kind){case"config-failed":return v(e.failure);case"compile-failed":return U(e.error);case"no-test":return`test "${e.ref}" not found \u2014 run npx ripplo compile to see available tests`;case"unplannable":return"the recorded walk no longer matches the model \u2014 run npx ripplo compile, then re-run";case"run-failed":return`teleport failed before reaching the step: ${Fr(e.error)}`;case"done":return Au(e.result,r)}}function Qo(e){return e.kind==="done"&&e.result.kind==="handed-over"}function Xo(e,r){return`landed at step ${String(e)} of ${r} \u2014 close the window to tear down`}function Au(e,r){return e.kind==="failed"?`couldn't reach the step \u2014 the run failed first.
|
|
391
415
|
|
|
392
|
-
${e.findings.map(t=>
|
|
416
|
+
${e.findings.map(t=>qr({evidencePath:void 0,finding:t})).join(`
|
|
393
417
|
|
|
394
|
-
`)}`:`torn down \u2014 teleport session for ${r} ended`}async function
|
|
395
|
-
`)},o=await An({cwd:process.cwd(),onReady:t,signal:n.signal,step:r,target:{kind:"test",ref:e}});process.stdout.write(`${
|
|
396
|
-
`),process.exit(
|
|
397
|
-
`)}async function
|
|
398
|
-
`),process.exit(
|
|
399
|
-
`)}import{existsSync as
|
|
400
|
-
`)}function
|
|
401
|
-
`),process.exit(
|
|
418
|
+
`)}`:`torn down \u2014 teleport session for ${r} ended`}async function Yo({ref:e,step:r}){let n=new AbortController;process.once("SIGINT",()=>{n.abort()});let t=()=>{process.stdout.write(`${Xo(r,e)}
|
|
419
|
+
`)},o=await An({cwd:process.cwd(),onReady:t,signal:n.signal,step:r,target:{kind:"test",ref:e}});process.stdout.write(`${Jo(o,e)}
|
|
420
|
+
`),process.exit(Qo(o)?0:1)}import Zo from"path";import{randomUUID as ju}from"crypto";async function ei({cwd:e,onReady:r,signal:n}){let t=h(e).match(s=>s,s=>s.kind);if(typeof t=="string")return{detail:t,kind:"config-failed"};let o=`capture-${ju()}`;return(await Kr({clientVersion:b(),debugDir:Zo.join(t.cwd,".ripplo","debug"),onReady:r,profileDir:Zo.join(t.cwd,".ripplo",".local","capture-profile"),runId:o,startUrl:t.appUrl},n)).match(s=>({behaviorPath:s.behaviorPath,kind:"done",runId:o}),s=>({error:s,kind:"run-failed"}))}function ri(){return"Capturing. Sign in if needed, click through your flow, then press Ctrl-C here to finish. Your login is remembered for next time."}function ni(e){return e.kind==="config-failed"?`Could not read project config: ${e.detail}`:e.kind==="run-failed"?"Capture failed to start. Could not launch the browser.":Tu(e.behaviorPath,e.runId)}function ti(e){return e.kind==="done"}function Tu(e,r){return[`Capture saved to ${e}`,"","Paste this to Claude Code to turn it into a workflow:",""," Reconstruct a real user session into a Ripplo workflow under .ripplo/workflows/.","",` 1. Run \`npx ripplo clickpath ${r}\` \u2014 the resolved, ordered list of user actions (clicks and inputs, each already mapped to its element with role, name, and testId). This is the exact action sequence. Encode every action as a workflow step in order, using a role+name or testId locator.`,` 2. Read ${e} for the network requests (with bodies) and backend spans. Model every entity and state the session reads or writes: declare entities in .ripplo/entities, build the starting state in given, and assert the resulting state in expect. The spans and request/response bodies are the source of truth for what state existed and what changed.`," 3. Run npx ripplo compile. Flag any action, entity, or state you cannot express in the DSL \u2014 those are gaps in the model worth reporting."].join(`
|
|
421
|
+
`)}async function oi(){let e=new AbortController;process.once("SIGINT",()=>{e.abort()});let r=await ei({cwd:process.cwd(),onReady:Mu,signal:e.signal});process.stdout.write(`${ni(r)}
|
|
422
|
+
`),process.exit(ti(r)?0:1)}function Mu(){process.stdout.write(`${ri()}
|
|
423
|
+
`)}import{existsSync as Lu,readFileSync as Nu}from"fs";import Ou from"path";function ii(e,r){let n=Ou.join(e,".ripplo","debug",r,"behavior.jsonl");return Lu(n)?{actions:Gr(Nu(n,{encoding:"utf8"})),kind:"ok"}:{kind:"not-found",runId:r}}function si(e){return e.kind==="not-found"?`No capture found for run ${e.runId}. Run npx ripplo capture first.`:e.actions.length===0?"No user actions found in this capture.":e.actions.map((r,n)=>Fu(r,n)).join(`
|
|
424
|
+
`)}function ai(e){return e.kind==="ok"}function Fu(e,r){let n=e.element,t=n?.role??n?.tag??"?",o=n?.ariaLabel??n?.text;return[`${String(r+1)}.`,e.kind.padEnd(6),t.padEnd(10),o==null?"":`name=${JSON.stringify(o)}`,n?.testId==null?"":`testId=${n.testId}`,e.value==null?"":`value=${JSON.stringify(e.value)}`].filter(s=>s.length>0).join(" ")}function li({runId:e}){let r=ii(process.cwd(),e);process.stdout.write(`${si(r)}
|
|
425
|
+
`),process.exit(ai(r)?0:1)}async function di(){let e=g();try{let n=(await Z(e.cwd,e)).match(i=>i,i=>{process.stderr.write(`${v(i)}
|
|
402
426
|
`),process.exit(1)}),t=n.lockfile.workflows.length,o=n.lockfile.entities.length;process.stdout.write(`Synced ${R(t,"workflow")} and ${R(o,"entity","entities")} to dev session ${n.devSessionId}
|
|
403
427
|
`)}catch(r){let n=r instanceof Error?r.message:String(r);process.stderr.write(`ripplo sync failed: ${n}
|
|
404
|
-
`),process.stderr.write(`${
|
|
405
|
-
`),process.exit(1)}}import{spawnSync as
|
|
406
|
-
`),n==null&&(process.stderr.write(`${
|
|
407
|
-
`),process.exit(1)),
|
|
428
|
+
`),process.stderr.write(`${S("setup","verify auth + server reachability")}
|
|
429
|
+
`),process.exit(1)}}import{spawnSync as Du}from"child_process";import Uu from"fs";import Bu from"path";import qu from"semver";import $e from"fs";import _u from"os";import oe from"path";function ui(e){return e.split(oe.sep).includes("_npx")?"npx":e.includes(oe.join("packages","cli"))?"workspace":"global"}function ci(){let e=oe.join(_u.homedir(),".npm","_npx");return $e.existsSync(e)?$e.readdirSync(e).map(r=>oe.join(e,r)).filter(r=>$e.existsSync(oe.join(r,"node_modules","ripplo"))).map(r=>($e.rmSync(r,{force:!0,recursive:!0}),r)):[]}import{spawnSync as pi}from"child_process";var Wu=["user","project","local"];function er(){return pi("claude",["--version"],{stdio:"ignore"}).error!=null?"claude-missing":Wu.find(n=>pi("claude",["plugin","update","ripplo","--scope",n],{stdio:"ignore"}).status===0)==null?"not-installed":"updated"}function mi(e){return`ripplo v${e} is already the latest version.`}function fi(e){return`ripplo v${e}: could not reach the npm registry to check for updates.`}function rr({evicted:e,latest:r,mode:n}){return n==="npx"?`ripplo: ${e===0?"npx cache had no stale copy":`cleared ${R(e,"stale npx cache entry","stale npx cache entries")}`} \u2014 the next \`npx ripplo\` command runs v${r}.`:`ripplo: updated global install to v${r}.`}function gi(){return"ripplo: this is a workspace build (packages/cli/dist) \u2014 update via git pull + `pnpm --filter ripplo build`."}function yi(e){return`ripplo: \`npm install -g ripplo@latest\` failed: ${e}`}function nr(e){switch(e){case"updated":return"ripplo: Claude plugin updated \u2014 restart Claude Code (or /reload-plugins) to apply.";case"not-installed":return"ripplo: Claude plugin not installed in this project \u2014 skipped.";case"claude-missing":return"ripplo: claude binary not found \u2014 skipped plugin update."}}function hi(e){return e?"ripplo: idle daemon stopped \u2014 the next `npx ripplo run` restarts it on the new version.":"ripplo: daemon is busy \u2014 it picks up the new version once idle (the next `npx ripplo run` handles it)."}var Vu=1e4;async function ki(){let e=b(),r=process.argv[1];Hu(process.cwd());let n=await ge(Vu);process.stdout.write(`${me({current:e,latest:n})}
|
|
430
|
+
`),n==null&&(process.stderr.write(`${fi(e)}
|
|
431
|
+
`),process.exit(1)),qu.gt(n,e)||(process.stdout.write(`${mi(e)}
|
|
408
432
|
`),process.stdout.write(`${nr(er())}
|
|
409
|
-
`),process.exit(0));let t=r==null?"global":
|
|
410
|
-
`),await
|
|
411
|
-
`)}function
|
|
412
|
-
`),process.exit(0)),r==="npx"){let n=
|
|
413
|
-
`);return}
|
|
433
|
+
`),process.exit(0));let t=r==null?"global":ui(r);Ku({latest:n,mode:t}),process.stdout.write(`${nr(er())}
|
|
434
|
+
`),await zu(process.cwd()),process.exit(0)}function Hu(e){if(!Uu.existsSync(Bu.join(e,".ripplo")))return;let r=ke(e);r==="written"&&process.stdout.write(`${we(r).trim()}
|
|
435
|
+
`)}function Ku({latest:e,mode:r}){if(r==="workspace"&&(process.stdout.write(`${gi()}
|
|
436
|
+
`),process.exit(0)),r==="npx"){let n=ci();process.stdout.write(`${rr({evicted:n.length,latest:e,mode:r})}
|
|
437
|
+
`);return}Gu(e)}function Gu(e){let r=`ripplo@${e}`,n=Du("npm",["install","-g",r],{stdio:"inherit"});if(n.status!==0){let t=`exit ${String(n.status)}`;process.stderr.write(`${yi(t)}
|
|
414
438
|
`),process.exit(1)}process.stdout.write(`${rr({evicted:0,latest:e,mode:"global"})}
|
|
415
|
-
`)}async function
|
|
416
|
-
`)}async function
|
|
417
|
-
`),n.kind!=="timeout"}function
|
|
418
|
-
`)}function
|
|
419
|
-
`),process.exit(1)});(e==null?await Mn(r):await Ln(r,e)).match(t=>{process.stdout.write(`${e==null?
|
|
420
|
-
`)},t=>{process.stderr.write(`${
|
|
421
|
-
`),process.exit(1)})}import{graphql as
|
|
439
|
+
`)}async function zu(e){if((await un(e)).kind==="not-running")return;let n=await dn(e);process.stdout.write(`${hi(n)}
|
|
440
|
+
`)}async function wi({action:e}){if(e==="status"){let{statusCommand:n}=await import("./status-WZG6MDCY.js");await n({format:"summary"});return}if(e==="stop"||e==="restart"){let n=await Ju();(e==="stop"||!n)&&process.exit(n?0:1)}Qu();let{runDaemon:r}=await import("./daemon-4W6BN73Z.js");await r()}async function Ju(){let{stopDevDaemon:e}=await import("./daemon-lock-LTQMLU4Q.js"),{renderDaemonStopResult:r}=await import("./daemon-42BG4EKR.js"),n=await e(process.cwd());return process.stdout.write(`${r(n)}
|
|
441
|
+
`),n.kind!=="timeout"}function Qu(){let e=ve(q());e!=null&&process.stderr.write(`${e}
|
|
442
|
+
`)}function bi(e){return`executor: ${e}`}function vi(e){return e==="cloud"?"executor set to cloud \u2014 the daemon is bringing the tunnel up, the next run dispatches to the cloud fleet":"executor set to local \u2014 the next run executes on this machine"}function xi(e){switch(e.kind){case"no-session":return"No active dev session for this directory. Start `npx ripplo daemon` first.";case"starting":return"Dev session is still syncing \u2014 the daemon just started. Retry in a moment.";case"session-ended":return"The dev session ended before the switch landed. Check `npx ripplo daemon status` and try again.";case"empty-response":return"The server returned no result for the switch. Try again."}}async function Si({mode:e}){let r=h(process.cwd()).match(t=>t,t=>{process.stderr.write(`${v(t)}
|
|
443
|
+
`),process.exit(1)});(e==null?await Mn(r):await Ln(r,e)).match(t=>{process.stdout.write(`${e==null?bi(t):vi(t)}
|
|
444
|
+
`)},t=>{process.stderr.write(`${xi(t)}
|
|
445
|
+
`),process.exit(1)})}import{graphql as Ci}from"gql.tada";import{err as tr,ok as or}from"neverthrow";var Xu=Ci(`
|
|
422
446
|
query ExploreState($devSessionId: String!) {
|
|
423
447
|
exploration(devSessionId: $devSessionId) {
|
|
424
448
|
active
|
|
@@ -427,7 +451,7 @@ ${e.findings.map(t=>Br({evidencePath:void 0,finding:t})).join(`
|
|
|
427
451
|
maxTrailLength
|
|
428
452
|
}
|
|
429
453
|
}
|
|
430
|
-
`),
|
|
454
|
+
`),Yu=Ci(`
|
|
431
455
|
mutation SetExploration(
|
|
432
456
|
$devSessionId: String!
|
|
433
457
|
$active: Boolean!
|
|
@@ -448,11 +472,11 @@ ${e.findings.map(t=>Br({evidencePath:void 0,finding:t})).join(`
|
|
|
448
472
|
maxTrailLength
|
|
449
473
|
}
|
|
450
474
|
}
|
|
451
|
-
`);async function
|
|
452
|
-
`),process.exit(1)});(e==null?await
|
|
453
|
-
`)},i=>{process.stderr.write(`${
|
|
454
|
-
`),process.exit(1)})}import{graphql as
|
|
455
|
-
`)}import{graphql as
|
|
475
|
+
`);async function Ri(e){let r=await Ei(e);if(r.isErr())return tr(r.error);let n=await Pi(e,r.value.id);return or(Ii(r.value.executor,n))}async function $i(e,r){let n=await Ei(e);if(n.isErr())return tr(n.error);let t=await Pi(e,n.value.id),o=Zu(n.value.executor,t,r),i=await l({config:e,document:Yu,variables:{devSessionId:n.value.id,...o}});return or(Ii(n.value.executor,i.setExploration))}async function Ei(e){let r=await en(e);return r.kind==="active"?or({executor:r.executor,id:r.id}):tr({kind:r.kind==="starting"?"starting":"no-session"})}async function Pi(e,r){return(await l({config:e,document:Xu,variables:{devSessionId:r}})).exploration??null}function Ii(e,r){let n=e==="local";return{active:r?.active??!1,executor:e,maxTrailLength:r?.maxTrailLength??We,workers:(n?r?.localWorkers:r?.cloudWorkers)??0}}function Zu(e,r,n){let t=e==="local",o=(t?r?.localWorkers:r?.cloudWorkers)??0,i=(t?r?.cloudWorkers:r?.localWorkers)??0,s=ec(n,o);return{active:n.active,cloudWorkers:t?i:s,localWorkers:t?s:i,maxTrailLength:n.trail??r?.maxTrailLength??We}}function ec(e,r){return e.active?e.workers!=null?e.workers:r>0?r:Tn:r}function Ai(e){return e.active?`explorer: on | ${String(e.workers)} workers | trail ${String(e.maxTrailLength)} | ${e.executor}`:"explorer: off"}function ji(e){return e.active?`explorer on \u2014 walking ${String(e.workers)} background paths, trail ${String(e.maxTrailLength)}, on the ${e.executor} executor. Findings land as tasks \u2014 triage with /ripplo:tasks`:"explorer off \u2014 background exploration stopped"}function Ti(e){return e.kind==="starting"?"Dev session is still syncing \u2014 the daemon just started. Retry in a moment.":"No active dev session for this directory. Start `npx ripplo daemon` first."}async function Mi({state:e,trail:r,workers:n}){let t=h(process.cwd()).match(i=>i,i=>{process.stderr.write(`${v(i)}
|
|
476
|
+
`),process.exit(1)});(e==null?await Ri(t):await $i(t,{active:e==="on",trail:r,workers:n})).match(i=>{process.stdout.write(`${e==null?Ai(i):ji(i)}
|
|
477
|
+
`)},i=>{process.stderr.write(`${Ti(i)}
|
|
478
|
+
`),process.exit(1)})}import{graphql as Ee}from"gql.tada";function Li(){return"No scope items added \u2014 matched tests already in scope (`npx ripplo scope status`)."}function Ni(e){return[`No test found for: ${e.join(", ")}`,"Pass a test id (kebab-case slug) or the exact intent string. List tests with `npx ripplo status`.",S("create")].join(`
|
|
479
|
+
`)}import{graphql as rc}from"gql.tada";var Oi=rc(`
|
|
456
480
|
query ScopeStatus($projectId: String!, $cwd: String!) {
|
|
457
481
|
project(id: $projectId) {
|
|
458
482
|
id
|
|
@@ -472,7 +496,7 @@ ${e.findings.map(t=>Br({evidencePath:void 0,finding:t})).join(`
|
|
|
472
496
|
}
|
|
473
497
|
}
|
|
474
498
|
}
|
|
475
|
-
`);var
|
|
499
|
+
`);var nc=Ee(`
|
|
476
500
|
query ScopeWorkflowBySlug($projectId: String!, $cwd: String!, $slug: String!) {
|
|
477
501
|
project(id: $projectId) {
|
|
478
502
|
id
|
|
@@ -485,7 +509,7 @@ ${e.findings.map(t=>Br({evidencePath:void 0,finding:t})).join(`
|
|
|
485
509
|
}
|
|
486
510
|
}
|
|
487
511
|
}
|
|
488
|
-
`),
|
|
512
|
+
`),tc=Ee(`
|
|
489
513
|
mutation ScopeAddDirtyTests($projectId: String!, $cwd: String!, $workflowSlugs: [String!]!) {
|
|
490
514
|
addDirtyTestsToScope(projectId: $projectId, cwd: $cwd, workflowSlugs: $workflowSlugs) {
|
|
491
515
|
__typename
|
|
@@ -507,31 +531,31 @@ ${e.findings.map(t=>Br({evidencePath:void 0,finding:t})).join(`
|
|
|
507
531
|
}
|
|
508
532
|
}
|
|
509
533
|
}
|
|
510
|
-
`),
|
|
534
|
+
`),oc=Ee(`
|
|
511
535
|
mutation ScopeLink($id: ID!, $workflowId: String!) {
|
|
512
536
|
linkScopeItem(id: $id, workflowId: $workflowId) {
|
|
513
537
|
id
|
|
514
538
|
}
|
|
515
539
|
}
|
|
516
|
-
`),
|
|
540
|
+
`),ic=Ee(`
|
|
517
541
|
mutation ScopeRemoveMany($ids: [ID!]!) {
|
|
518
542
|
removeScopeItems(ids: $ids)
|
|
519
543
|
}
|
|
520
|
-
`);async function
|
|
544
|
+
`);async function Fi(e){let r=g();await x(r);let t=(await l({config:r,document:Oi,variables:{cwd:r.cwd,projectId:r.projectId}})).project?.devSession?.scopeItems??[];if(e.format==="json"){process.stdout.write(`${JSON.stringify(t,null,2)}
|
|
521
545
|
`);return}if(t.length===0){process.stdout.write("No scope items. Add some with `npx ripplo scope add <test-ids..>` or from the dashboard.\n");return}t.forEach(o=>{let i=o.workflow;if(i==null){process.stdout.write(` [intent] (${o.id}) ${o.label??""}
|
|
522
546
|
`);return}let s=i.spec==null?"stub":"implemented";process.stdout.write(` [${s}] (${o.id}) ${i.slug} \u2014 ${i.name}
|
|
523
|
-
`)})}async function
|
|
524
|
-
`),process.exit(1)});let o=(await
|
|
525
|
-
`),process.exit(1)),o?.__typename==="UnknownWorkflowSlugsError"&&(process.stderr.write(`${
|
|
526
|
-
`),process.exit(1));let i=o?.__typename==="MutationAddDirtyTestsToScopeSuccess"?o.data:[];if(i.length===0){process.stdout.write(`${
|
|
547
|
+
`)})}async function _i({testIds:e}){let r=g();await x(r),(await Z(r.cwd,r)).match(()=>{},a=>{process.stderr.write(`${v(a)}
|
|
548
|
+
`),process.exit(1)});let o=(await l({config:r,document:tc,variables:{cwd:r.cwd,projectId:r.projectId,workflowSlugs:e.map(a=>Er(a))}})).addDirtyTestsToScope;o?.__typename==="NoActiveDevSessionError"&&(process.stderr.write(`${o.message}
|
|
549
|
+
`),process.exit(1)),o?.__typename==="UnknownWorkflowSlugsError"&&(process.stderr.write(`${Ni(o.slugs)}
|
|
550
|
+
`),process.exit(1));let i=o?.__typename==="MutationAddDirtyTestsToScopeSuccess"?o.data:[];if(i.length===0){process.stdout.write(`${Li()}
|
|
527
551
|
`);return}let s=i.map(a=>a.workflow?.slug??"?").join(", ");process.stdout.write(`Added ${R(i.length,"scope item")}: ${s}
|
|
528
|
-
`)}async function
|
|
529
|
-
`),process.exit(1)});let o=await
|
|
530
|
-
`)}async function
|
|
531
|
-
`)}async function
|
|
532
|
-
`),process.stderr.write(`${
|
|
533
|
-
`),process.exit(1)),t.id}import{graphql as
|
|
534
|
-
`).reduce((t,o)=>t!=null||o.length===0?t:
|
|
552
|
+
`)}async function Wi({id:e,testId:r}){let n=g();await x(n),(await Z(n.cwd,n)).match(()=>{},i=>{process.stderr.write(`${v(i)}
|
|
553
|
+
`),process.exit(1)});let o=await sc({cfg:n,slug:r});await l({config:n,document:oc,variables:{id:e,workflowId:o}}),process.stdout.write(`Linked scope item ${e} to ${r}
|
|
554
|
+
`)}async function Di({ids:e}){let r=g();await x(r);let t=(await l({config:r,document:ic,variables:{ids:[...e]}})).removeScopeItems??0;process.stdout.write(`Removed ${R(t,"scope item")}
|
|
555
|
+
`)}async function sc({cfg:e,slug:r}){let t=(await l({config:e,document:nc,variables:{cwd:e.cwd,projectId:e.projectId,slug:r}})).project?.devSession?.workflows?.[0];return t==null&&(process.stderr.write(`No workflow found with id "${r}". Create a stub first via the testing DSL.
|
|
556
|
+
`),process.stderr.write(`${S("create")}
|
|
557
|
+
`),process.exit(1)),t.id}import{graphql as T}from"gql.tada";import{print as Xi}from"graphql";import{createClient as Yi}from"graphql-sse";import ir from"fs";import ac from"path";import{err as Pe,ok as lc}from"neverthrow";function Bi({cwd:e,rrwebId:r,runId:n}){let t=Vi(e,n);if(!ir.existsSync(t))return Pe({kind:"no-behavior"});let o=zi(Gi(t,r));if(o==null)return Pe({kind:"not-found"});let i=ar(o.node.type);return i===3?Pe({kind:"text-node",parentId:ar(o.parent?.id)}):i!==2?Pe({kind:"non-element",nodeType:i??-1}):lc({tagName:I(o.node.tagName)})}function qi({cwd:e,rrwebId:r,runId:n}){let t=Gi(Vi(e,n),r);if(t==null)return null;let o=zi(t);return o==null||ar(o.node.type)!==2?null:dc(t)}function Vi(e,r){return ac.join(e,".ripplo","debug",r,"behavior.jsonl")}function dc(e){let r=e.at(-1)??{},n=lr(r.attributes)??{},t=I(r.tagName);return{ariaName:I(n["aria-label"]),role:I(n.role),selector:cc(e),tagName:t==null?null:t.toLowerCase(),testId:I(n["data-testid"]),text:yc(gc(r))}}var uc=6;function cc(e){let r=Hi(e,e.length-1,uc);return r.length===0?null:r.join(" > ")}function Hi(e,r,n){let t=e[r];if(t==null||n<=0)return[];let o=pc(t);if(o!=null)return[o];let i=mc(t,e[r-1]);return r===0||n===1?[i]:[...Hi(e,r-1,n-1),i]}function pc(e){let r=lr(e.attributes)??{},n=I(r["data-testid"]);if(n!=null)return`[data-testid="${n}"]`;let t=I(r.id);return t!=null&&t.length>0?`#${t}`:null}function mc(e,r){let n=(I(e.tagName)??"*").toLowerCase(),t=Ki(r).filter(i=>(I(i.tagName)??"*").toLowerCase()===n);if(t.length<=1)return n;let o=t.findIndex(i=>i.id===e.id);return o===-1?n:`${n}:nth-of-type(${String(o+1)})`}function Ki(e){let r=e?.childNodes;return Array.isArray(r)?r.filter(n=>Ie(n)):[]}function Gi(e,r){return ir.existsSync(e)?ir.readFileSync(e,"utf8").split(`
|
|
558
|
+
`).reduce((t,o)=>t!=null||o.length===0?t:fc(o,r),null):null}function fc(e,r){let n=M(e);if(n?.kind!=="rrweb")return null;let t=lr(n.event.data),o=sr(t?.node,r);if(o!=null)return o;let i=t?.adds;return Array.isArray(i)?i.reduce((s,a)=>s??(Ie(a)?sr(a.node,r):null),null):null}function sr(e,r){if(!Ie(e))return null;if(e.id===r)return[e];let n=e.childNodes;if(!Array.isArray(n))return null;let t=n.reduce((o,i)=>o??sr(i,r),null);return t==null?null:[e,...t]}function zi(e){let r=e?.at(-1);return r==null?null:{node:r,parent:e?.at(-2)}}var Ui=80;function gc(e){let r=Ki(e).filter(n=>n.type===3).map(n=>I(n.textContent)).filter(n=>n!=null);return r.length===0?null:r.join(" ")}function I(e){return typeof e=="string"?e:null}function yc(e){let r=e==null?"":e.replaceAll(/\s+/g," ").trim();return r.length===0?null:r.length>Ui?`${r.slice(0,Ui)}\u2026`:r}function lr(e){return Ie(e)?e:void 0}function Ie(e){return typeof e=="object"&&e!=null}function ar(e){return typeof e=="number"?e:null}function dr(e,r){let n=r.flatMap(o=>hc(e,o)),t=new Map(r.map(o=>[o.id,o.fingerprint]));return{changes:n,seen:t}}function hc(e,r){let n=e.get(r.id);return n==null?r.kind==="finding"||r.lastMessageAuthor==="agent"?[]:[{task:r,type:r.latestMessageKind==="reopen"?"reopened":"new"}]:n!==r.fingerprint&&r.lastMessageAuthor==="user"?[{task:r,type:"reply"}]:[]}var kc=T(`
|
|
535
559
|
query WorkList($projectId: String!, $cwd: String!) {
|
|
536
560
|
project(id: $projectId) {
|
|
537
561
|
id
|
|
@@ -549,7 +573,7 @@ ${e.findings.map(t=>Br({evidencePath:void 0,finding:t})).join(`
|
|
|
549
573
|
}
|
|
550
574
|
}
|
|
551
575
|
}
|
|
552
|
-
`),
|
|
576
|
+
`),wc=T(`
|
|
553
577
|
query WatchSeed($projectId: String!, $cwd: String!) {
|
|
554
578
|
project(id: $projectId) {
|
|
555
579
|
id
|
|
@@ -569,7 +593,7 @@ ${e.findings.map(t=>Br({evidencePath:void 0,finding:t})).join(`
|
|
|
569
593
|
}
|
|
570
594
|
}
|
|
571
595
|
}
|
|
572
|
-
`),
|
|
596
|
+
`),Zi=T(`
|
|
573
597
|
subscription WatchTasks($devSessionId: String!) {
|
|
574
598
|
tasksChanged(devSessionId: $devSessionId) {
|
|
575
599
|
devSession {
|
|
@@ -588,7 +612,7 @@ ${e.findings.map(t=>Br({evidencePath:void 0,finding:t})).join(`
|
|
|
588
612
|
}
|
|
589
613
|
}
|
|
590
614
|
}
|
|
591
|
-
`),
|
|
615
|
+
`),bc=T(`
|
|
592
616
|
query WorkShow($id: String!) {
|
|
593
617
|
task(id: $id) {
|
|
594
618
|
id
|
|
@@ -605,7 +629,7 @@ ${e.findings.map(t=>Br({evidencePath:void 0,finding:t})).join(`
|
|
|
605
629
|
}
|
|
606
630
|
}
|
|
607
631
|
}
|
|
608
|
-
`),
|
|
632
|
+
`),vc=T(`
|
|
609
633
|
mutation WorkComment(
|
|
610
634
|
$taskId: String!
|
|
611
635
|
$body: String!
|
|
@@ -631,7 +655,7 @@ ${e.findings.map(t=>Br({evidencePath:void 0,finding:t})).join(`
|
|
|
631
655
|
}
|
|
632
656
|
}
|
|
633
657
|
}
|
|
634
|
-
`),
|
|
658
|
+
`),xc=T(`
|
|
635
659
|
mutation WorkResolve($taskId: String!, $runId: String!, $note: String, $authorName: String) {
|
|
636
660
|
agentResolveTask(taskId: $taskId, runId: $runId, note: $note, authorName: $authorName) {
|
|
637
661
|
__typename
|
|
@@ -643,7 +667,7 @@ ${e.findings.map(t=>Br({evidencePath:void 0,finding:t})).join(`
|
|
|
643
667
|
}
|
|
644
668
|
}
|
|
645
669
|
}
|
|
646
|
-
`),
|
|
670
|
+
`),Sc=T(`
|
|
647
671
|
mutation WorkStart($taskId: String!) {
|
|
648
672
|
agentStartTask(taskId: $taskId) {
|
|
649
673
|
__typename
|
|
@@ -656,7 +680,7 @@ ${e.findings.map(t=>Br({evidencePath:void 0,finding:t})).join(`
|
|
|
656
680
|
}
|
|
657
681
|
}
|
|
658
682
|
}
|
|
659
|
-
`),
|
|
683
|
+
`),Cc=T(`
|
|
660
684
|
mutation WorkClarify($taskId: String!, $body: String!, $authorName: String) {
|
|
661
685
|
agentSetNeedsClarification(taskId: $taskId, body: $body, authorName: $authorName) {
|
|
662
686
|
__typename
|
|
@@ -668,7 +692,7 @@ ${e.findings.map(t=>Br({evidencePath:void 0,finding:t})).join(`
|
|
|
668
692
|
}
|
|
669
693
|
}
|
|
670
694
|
}
|
|
671
|
-
`),
|
|
695
|
+
`),Rc=T(`
|
|
672
696
|
mutation WorkDismiss($taskId: String!, $note: String, $authorName: String) {
|
|
673
697
|
agentDismissTask(taskId: $taskId, note: $note, authorName: $authorName) {
|
|
674
698
|
__typename
|
|
@@ -683,21 +707,21 @@ ${e.findings.map(t=>Br({evidencePath:void 0,finding:t})).join(`
|
|
|
683
707
|
}
|
|
684
708
|
}
|
|
685
709
|
}
|
|
686
|
-
`)
|
|
710
|
+
`),$c=18e4;async function es(e){let r=g();await x(r);let n=await Ji(r),t=n.items.some(o=>o.kind==="finding");if(e.wait&&!t&&n.devSessionId!=null){await Ec({cfg:r,devSessionId:n.devSessionId});let o=await Ji(r);Qi(o.items,e.format);return}Qi(n.items,e.format)}async function Ji(e){let n=(await l({config:e,document:kc,variables:{cwd:e.cwd,projectId:e.projectId}})).project?.devSession;return{devSessionId:n?.id??null,items:n?.tasks??[]}}function Qi(e,r){if(r==="json"){process.stdout.write(`${JSON.stringify(e,null,2)}
|
|
687
711
|
`);return}let n=e.map(t=>({id:t.id,kind:t.kind,lastMessage:(t.messages??[]).at(-1)?.body??null,status:t.status,title:t.title}));process.stdout.write(`${Nn(n)}
|
|
688
|
-
`)}function
|
|
689
|
-
`)},next:o=>{let i=o.data?.tasksChanged?.devSession?.tasks??[],s=dr(t,
|
|
690
|
-
`)}),t=s.seen}})}async function
|
|
712
|
+
`)}function Ec({cfg:e,devSessionId:r}){let n=Yi({headers:{Authorization:`Bearer ${e.token}`},retryAttempts:1/0,url:`${e.ripploServerUrl}/graphql`});return new Promise(t=>{let o={settled:!1,timer:null,dispose:()=>{}},i=()=>{o.settled||(o.settled=!0,o.timer!=null&&clearTimeout(o.timer),o.dispose(),t())};o.timer=setTimeout(i,$c),o.dispose=n.subscribe({query:Xi(Zi),variables:{devSessionId:r}},{complete:i,error:()=>{i()},next:s=>{(s.data?.tasksChanged?.devSession?.tasks??[]).some(d=>d.kind==="finding")&&i()}})})}async function rs(){let e=g();await x(e);let n=(await l({config:e,document:wc,variables:{cwd:e.cwd,projectId:e.projectId}})).project?.devSession;if(n==null)throw new Error("dev session vanished between preflight and seed");let t=dr(new Map,ts(n.tasks??[])),o=Yi({headers:{Authorization:`Bearer ${e.token}`},retryAttempts:1/0,url:`${e.ripploServerUrl}/graphql`});Pc({devSessionId:n.id,seen:t.seen,sseClient:o}),await new Promise(()=>{})}function Pc({devSessionId:e,seen:r,sseClient:n}){let t=r;n.subscribe({query:Xi(Zi),variables:{devSessionId:e}},{complete:()=>{},error:o=>{process.stderr.write(`task watch error: ${String(o)}
|
|
713
|
+
`)},next:o=>{let i=o.data?.tasksChanged?.devSession?.tasks??[],s=dr(t,ts(i));s.changes.forEach(a=>{process.stdout.write(`${Fn(a)}
|
|
714
|
+
`)}),t=s.seen}})}async function ns(e){let r=g();await x(r);let t=(await l({config:r,document:bc,variables:{id:e.id}})).task;if(t==null&&(process.stderr.write(`${_n(e.id)}
|
|
691
715
|
`),process.exit(1)),e.format==="json"){process.stdout.write(`${JSON.stringify(t,null,2)}
|
|
692
|
-
`);return}let o=[...new Set((t.messages??[]).flatMap(s=>s.runId==null?[]:[s.runId]))];await Promise.all(o.map(s=>
|
|
693
|
-
`)}function
|
|
694
|
-
`),process.exit(1))}let n=await
|
|
695
|
-
`)}async function
|
|
696
|
-
`)}async function
|
|
697
|
-
`)}async function
|
|
698
|
-
`),process.exit(1));let r=g();await
|
|
699
|
-
`)}async function
|
|
716
|
+
`);return}let o=[...new Set((t.messages??[]).flatMap(s=>s.runId==null?[]:[s.runId]))];await Promise.all(o.map(s=>G(r.cwd,s).then(a=>a.isErr())));let i={id:t.id,kind:t.kind,lastMessage:(t.messages??[]).at(-1)?.body??null,messages:(t.messages??[]).map(s=>({author:s.author,authorName:s.authorName,body:s.body,element:s.runId==null||s.rrwebId==null?null:qi({cwd:r.cwd,rrwebId:s.rrwebId,runId:s.runId}),frameMs:s.frameMs,rrwebId:s.rrwebId,runId:s.runId})),status:t.status,title:t.title};process.stdout.write(`${On(i)}
|
|
717
|
+
`)}function ts(e){return e.map(r=>({fingerprint:`${r.id}:${String(r.updatedAt)}`,id:r.id,kind:r.kind,lastMessageAuthor:r.lastMessageAuthor,latestMessage:(r.messages??[]).at(-1)?.body??null,latestMessageKind:(r.messages??[]).at(-1)?.kind??null,title:r.title}))}async function os(e){let r=g();if(await x(r),e.elementId!=null&&e.runId!=null){let t=Bi({cwd:r.cwd,rrwebId:e.elementId,runId:e.runId}).match(()=>null,o=>o);t!=null&&t.kind!=="no-behavior"&&(process.stderr.write(`${Ic(t,e.elementId,e.runId)}
|
|
718
|
+
`),process.exit(1))}let n=await l({config:r,document:vc,variables:{authorName:e.authorName??null,body:e.body,frameMs:e.offsetMs??null,rrwebId:e.elementId??null,runId:e.runId??null,taskId:e.id}});Ae(n.agentCommentOnTask),process.stdout.write(`${Wn(e.id)}
|
|
719
|
+
`)}async function is(e){let r=g();await x(r);let n=await l({config:r,document:xc,variables:{authorName:e.authorName??null,note:e.note??null,runId:e.runId,taskId:e.id}});Ae(n.agentResolveTask),process.stdout.write(`${Vn(e.id)}
|
|
720
|
+
`)}async function ss(e){let r=g();await x(r);let n=await l({config:r,document:Sc,variables:{taskId:e.id}});Ae(n.agentStartTask),process.stdout.write(`${Hn(e.id)}
|
|
721
|
+
`)}async function as(e){e.body.trim().length===0&&(process.stderr.write(`${Dn()}
|
|
722
|
+
`),process.exit(1));let r=g();await x(r);let n=await l({config:r,document:Cc,variables:{authorName:e.authorName??null,body:e.body,taskId:e.id}});Ae(n.agentSetNeedsClarification),process.stdout.write(`${Kn(e.id)}
|
|
723
|
+
`)}async function ls(e){let r=g();await x(r);let t=(await l({config:r,document:Rc,variables:{authorName:e.authorName??null,note:e.note??null,taskId:e.id}})).agentDismissTask;(t?.__typename==="FindingNotDismissableError"||t?.__typename==="NoActiveDevSessionError")&&(process.stderr.write(`${t.message}
|
|
700
724
|
`),process.exit(1)),process.stdout.write(`${Gn(e.id)}
|
|
701
|
-
`)}function
|
|
702
|
-
`),process.exit(1))}function
|
|
703
|
-
`),process.exit(1)});function
|
|
725
|
+
`)}function Ae(e){e?.__typename==="NoActiveDevSessionError"&&(process.stderr.write(`${e.message}
|
|
726
|
+
`),process.exit(1))}function Ic(e,r,n){return e.kind==="text-node"?Un(r,e.parentId):e.kind==="not-found"?Bn(r,n):qn(r)}function ds(e){return e.command("list","List open tasks for this dev session",r=>r.option("format",{choices:["json","text"],default:"text",describe:"Output format"}).option("wait",{default:!1,describe:"Block until the first explorer finding lands (or a timeout)",type:"boolean"}),r=>es({format:r.format,wait:r.wait})).command("watch","Stream new tasks and user replies as they arrive (arm via Monitor from /ripplo:start)",r=>r,()=>rs()).command("show <id>","Show a task with its full message thread",r=>r.positional("id",{demandOption:!0,describe:"Task id",type:"string"}).option("format",{choices:["json","text"],default:"text",describe:"Output format"}),r=>ns({format:r.format,id:r.id})).command("comment <id> <body>","Comment on a task, optionally anchored to a run frame and element. For visual fixes, anchor to the proof run's frame and element, both read from .ripplo/debug/<runId>/behavior.jsonl: --element takes the rrweb id of an ELEMENT node (a text node has no box and cannot be highlighted \u2014 use its parentId), and --offset takes the frame offset in ms (from recording start, same as `snapshot --offset`) where that element is present. Call once per comment.",r=>r.positional("id",{demandOption:!0,describe:"Task id",type:"string"}).positional("body",{demandOption:!0,describe:"Comment body",type:"string"}).option("run",{describe:"Run id to anchor the comment to",type:"string"}).option("offset",{describe:"Frame offset in ms from recording start",type:"number"}).option("element",{describe:"rrweb id of an element node to highlight (not a text node)",type:"number"}).option("as",{describe:"Agent display name shown on the comment",type:"string"}),r=>os({authorName:r.as,body:r.body,elementId:r.element,id:r.id,offsetMs:r.offset,runId:r.run})).command("start <id>","Mark a task as picked up \u2014 flags it in progress until resolved, dismissed, or clarified",r=>r.positional("id",{demandOption:!0,describe:"Task id",type:"string"}),r=>ss({id:r.id})).command("resolve <id>","Resolve a task with a proof run",r=>r.positional("id",{demandOption:!0,describe:"Task id",type:"string"}).option("run",{demandOption:!0,describe:"Proof run id",type:"string"}).option("note",{describe:"Optional resolution note",type:"string"}).option("as",{describe:"Agent display name shown on the message",type:"string"}),r=>is({authorName:r.as,id:r.id,note:r.note,runId:r.run})).command("clarify <id> <body>","Mark a task as needing clarification from the user",r=>r.positional("id",{demandOption:!0,describe:"Task id",type:"string"}).positional("body",{demandOption:!0,describe:"What you need clarified",type:"string"}).option("as",{describe:"Agent display name shown on the message",type:"string"}),r=>as({authorName:r.as,body:r.body,id:r.id})).command("dismiss <id>","Dismiss a task as not actionable",r=>r.positional("id",{demandOption:!0,describe:"Task id",type:"string"}).option("note",{describe:"Optional reason",type:"string"}).option("as",{describe:"Agent display name shown on the message",type:"string"}),r=>ls({authorName:r.as,id:r.id,note:r.note})).demandCommand(1)}br();X(process.cwd());hr();async function Lc(){ie(b()),Pr({size:Math.max(1,Math.min(10,Ac()-2)),workerUrl:Xn()}),jc({pkg:{name:"ripplo",version:b()}}).notify({message:Yn()}),await Tc(Mc(process.argv)).scriptName("ripplo").version(b()).command(Oc()).command(Fc()).command(_c()).command(Kc()).command("auth <subcommand>","Manage authentication",Yc).command("projects <subcommand>","List or create Ripplo projects",Xc).command("hooks <subcommand>","Pause or resume Ripplo hooks",Qc).command(Uc()).command("init","Scaffold .ripplo/ in this project",e=>e.option("project",{type:"string"}).option("env",{type:"string"}).option("app-url",{type:"string"}).option("engine-url",{type:"string"}),e=>It({appUrl:e["app-url"],engineUrl:e["engine-url"],envFile:e.env,projectId:e.project})).command("run [ids..]","Run tests locally via the daemon (start it first with `npx ripplo daemon`)",zc,e=>Bt({all:e.all,headed:e.headed,ids:e.ids})).command(qc()).command(Gc()).command(Vc()).command(Hc()).command(Nc()).command(Bc()).command(Wc()).command(Dc()).command("sync","Push the compiled .ripplo/ resources to the server (no run)",()=>{},()=>di()).command("compile","Compile the DSL, run static model analysis, and write .ripplo/ripplo.lock",e=>e.option("check",{default:!1,describe:"Exit non-zero if the lockfile is missing or stale (does not write)",type:"boolean"}),e=>st({check:e.check})).command("update","Update ripplo to the latest published version (and hand the daemon off to it)",()=>{},()=>ki()).command("doctor","Check project health",()=>{},()=>ht()).command("status","Report stub tests and daemon status",e=>e.option("format",{choices:["json","summary"],default:"json",describe:"Output format"}),e=>jn({format:e.format})).command("scope <subcommand>","Manage testing scope",Jc).command("tasks <subcommand>","Manage tasks for this dev session",ds).command("run-worker",!1,()=>{},()=>Gt()).command("hook <name>","Internal: run a Claude Code plugin hook",e=>e.positional("name",{choices:Object.keys(zn),demandOption:!0,type:"string"}),e=>Jn(e.name)).strict().help().parse(),Ir()}Lc().catch(e=>{process.stderr.write(`${Lr(e)}
|
|
727
|
+
`),process.exit(1)});function Nc(){return{command:"report-bug",describe:"Report a critical application bug caught while building or testing",builder:e=>e.option("kind",{choices:["new_feature_bug","regression","latent_bug"],demandOption:!0,describe:"new_feature_bug: broke the new thing being built; regression: broke previously working behavior; latent_bug: pre-existing bug exposed by new test coverage"}).option("title",{demandOption:!0,describe:"Short bug name",type:"string"}).option("root-cause",{demandOption:!0,describe:"What was actually wrong",type:"string"}).option("surfaced-by",{demandOption:!0,describe:"How the test/run exposed it (cite evidence)",type:"string"}).option("run",{demandOption:!0,describe:"Run id where it surfaced \u2014 links the bug to its replay. For an exploration finding, pass the explore-\u2026 run id from the finding",type:"string"}),handler:e=>Wt({kind:e.kind,rootCause:e["root-cause"],runId:e.run,surfacedBy:e["surfaced-by"],title:e.title})}}function Oc(){return{command:"daemon [action]",describe:"Run the long-lived local executor (IPC socket + run subscription)",builder:e=>e.positional("action",{choices:["start","stop","restart","status"],default:"start",describe:"Lifecycle action for this project's daemon"}),handler:e=>wi({action:e.action})}}function Fc(){return{command:"executor [mode]",describe:"Show or switch the run executor for the active dev session",builder:e=>e.positional("mode",{choices:["local","cloud"],describe:"Executor to switch to (omit to show the current one)"}),handler:e=>Si({mode:e.mode})}}function _c(){return{command:"explore [state]",describe:"Show or toggle the background explorer for the active dev session",builder:e=>e.positional("state",{choices:["on","off"],describe:"Turn the explorer on or off (omit to show current state)"}).option("trail",{describe:"Max steps per explored path",type:"number"}).option("workers",{describe:"Concurrent explorer workers",type:"number"}),handler:e=>Mi({state:e.state,trail:e.trail,workers:e.workers})}}function Wc(){return{command:"explain <runId>",describe:"Explain a run's failing checks \u2014 what failed, where it came from, and what happened around it",builder:e=>e.positional("runId",{demandOption:!0,type:"string"}).option("json",{default:!1,describe:"Machine-readable output",type:"boolean"}).option("full",{default:!1,describe:"Also dump the world the model set up and a step-by-step timeline of the run",type:"boolean"}),handler:e=>So({full:e.full,json:e.json,runId:e.runId})}}function Dc(){return{command:"replay <runId>",describe:"Re-run an explore finding's trail to confirm it's resolved",builder:e=>e.positional("runId",{demandOption:!0,type:"string"}),handler:e=>jo({runId:e.runId})}}function Uc(){return{command:"setup",describe:"Install the Ripplo plugin for Claude Code and start a guided setup session",builder:e=>e,handler:()=>{Ft()}}}function Bc(){return{command:"pull <runId>",describe:"Download a run's behavior.jsonl from the server",builder:e=>e.positional("runId",{demandOption:!0,type:"string"}),handler:e=>Co({runId:e.runId})}}function qc(){return{command:"snapshot <runId>",describe:"Render a PNG of the page at a point in a run's rrweb recording",builder:e=>e.positional("runId",{demandOption:!0,type:"string"}).option("at",{describe:"Moment to render: epoch-ms timestamp exactly as found in behavior.jsonl",type:"number"}).option("offset",{describe:"Moment to render: ms from the start of the recording (alternative to --at)",type:"number"}).conflicts("at","offset"),handler:e=>zo({at:e.at,offset:e.offset,runId:e.runId})}}function Vc(){return{command:"capture",describe:"Open your signed-in browser, record a flow, and hand the log to Claude",builder:e=>e,handler:()=>oi()}}function Hc(){return{command:"clickpath <runId>",describe:"Print the resolved, ordered user actions from a capture",builder:e=>e.positional("runId",{demandOption:!0,describe:"Capture run id (the capture-... folder under .ripplo/debug)",type:"string"}),handler:e=>{li({runId:e.runId})}}}function Kc(){return{command:"concurrency [value]",describe:"Show or set max local concurrent runs (daemon applies live)",builder:e=>e.positional("value",{type:"number"}),handler:e=>lt({value:e.value})}}function Gc(){return{command:"teleport <ref>",describe:"Open a live browser at a step in a test, seeded with the run up to that point",builder:e=>e.positional("ref",{demandOption:!0,describe:"Test ref: <workflow-slug>/<test-slug>",type:"string"}).option("step",{demandOption:!0,describe:"Step to land on \u2014 runs the test up to and including this step, then hands over",type:"number"}),handler:e=>Yo({ref:e.ref,step:e.step})}}function zc(e){let r=[];return e.positional("ids",{array:!0,default:r,describe:"Test ids to run",type:"string"}).option("all",{default:!1,describe:"Run every test in the suite (expensive)",type:"boolean"}).option("headed",{default:!1,describe:"Run with a visible browser window",type:"boolean"})}function Jc(e){return e.command("status","Print the current scope",r=>r.option("format",{choices:["json","text"],default:"text",describe:"Output format"}),r=>Fi({format:r.format})).command("add <test-ids..>","Bind one or more existing tests (stubs or implemented) to scope as agent intent",r=>{let n=[];return r.positional("test-ids",{array:!0,default:n,demandOption:!0,describe:"Slugs of existing workflows",type:"string"})},r=>_i({testIds:r["test-ids"]})).command("link <id> <test-id>","Link an existing scope item to a test",r=>r.positional("id",{demandOption:!0,describe:"Scope item id",type:"string"}).positional("test-id",{demandOption:!0,describe:"Slug of the workflow to link",type:"string"}),r=>Wi({id:r.id,testId:r["test-id"]})).command("remove <ids..>","Remove one or more scope items by id",r=>{let n=[];return r.positional("ids",{array:!0,default:n,demandOption:!0,describe:"Scope item ids",type:"string"})},r=>Di({ids:r.ids})).demandCommand(1)}function Qc(e){return e.command("pause","Disable all Ripplo pre-edit gates and stop enforcement until resumed",()=>{},()=>kt()).command("resume","Re-enable Ripplo hooks paused via `ripplo hooks pause`",()=>{},()=>wt()).demandCommand(1)}function Xc(e){return e.command("list","List projects you have access to (JSON)",()=>{},()=>Tt()).command("create <name>","Create a project (JSON)",r=>r.positional("name",{demandOption:!0,type:"string"}).option("org",{describe:"Organization id",type:"string"}),r=>Mt({name:r.name,orgId:r.org})).demandCommand(1)}function Yc(e){return e.command("login","Authenticate via device flow",()=>{},()=>tt()).command("status","Show authentication status",()=>{},()=>ot()).command("logout","Remove the saved token",()=>{},()=>{it()}).demandCommand(1)}export{Lc as main};
|