ripplo 0.8.3 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-5SM4TCSW.js → chunk-4F67XQYS.js} +19 -19
- package/dist/{chunk-EGETJKAQ.js → chunk-4H7EIC6W.js} +1 -1
- package/dist/{chunk-4FKGHWCC.js → chunk-AYDIXOW2.js} +1 -1
- package/dist/chunk-BR7W4UBJ.js +83 -0
- package/dist/{chunk-7Z7RVHEL.js → chunk-EA62LNKT.js} +2 -2
- package/dist/chunk-EVVF662P.js +6 -0
- package/dist/{chunk-XBD3OTIW.js → chunk-FR4ENKCT.js} +1 -1
- package/dist/{chunk-N2B5GZPU.js → chunk-IRTBARRY.js} +1 -1
- package/dist/{chunk-PXZV5X3C.js → chunk-JXGIARTE.js} +1 -1
- package/dist/chunk-PRD7P6EF.js +6 -0
- package/dist/{chunk-2MT2MZJW.js → chunk-Q6IYTHMP.js} +1 -1
- package/dist/{chunk-7TYUZIUO.js → chunk-QQ7NFPJQ.js} +1 -1
- package/dist/chunk-U27IDW6O.js +229 -0
- package/dist/{chunk-SWOTFHBR.js → chunk-V4IQQT44.js} +1 -1
- package/dist/chunk-WZBLSDNV.js +4 -0
- package/dist/chunk-XVMIPWJQ.js +4 -0
- package/dist/{chunk-AVBP7Q2M.js → chunk-XZ2TPZLD.js} +1 -1
- package/dist/{chunk-LKYTQXPR.js → chunk-ZDA3E2AS.js} +1 -1
- package/dist/{chunk-UVYCSHOJ.js → chunk-ZUPS6XVH.js} +1 -1
- package/dist/{cli-error-SLG6JHK2.js → cli-error-J33JDZET.js} +1 -1
- package/dist/{compile-write-7AV66JUA.js → compile-write-H2GLCECO.js} +1 -1
- package/dist/{daemon-LFFCR3TB.js → daemon-3J3K4BOD.js} +1 -1
- package/dist/daemon-AS6IHTHD.js +152 -0
- package/dist/{dsl-loader-H25XGSHJ.js → dsl-loader-5Z2JRKY3.js} +1 -1
- package/dist/hook.js +1 -1
- package/dist/index.js +177 -177
- package/dist/{plan-reminder-VMBDQTAP.js → plan-reminder-E6AXT6OB.js} +1 -1
- package/dist/post-edit-LUPA46ZO.js +4 -0
- package/dist/post-edit-analyze-XY6C7ZFP.js +4 -0
- package/dist/post-edit-flag-stubs-ZMKN4DJZ.js +4 -0
- package/dist/{pre-edit-Q4U5LSWG.js → pre-edit-EJO3TUNQ.js} +1 -1
- package/dist/{pre-edit-watch-gate-EUZGEH2J.js → pre-edit-watch-gate-DZHQCMEI.js} +1 -1
- package/dist/{prompt-submit-MPRVCWOI.js → prompt-submit-U3QOU47D.js} +1 -1
- package/dist/solve-worker.js +1 -1
- package/dist/status-247DEYFK.js +4 -0
- package/dist/{stop-enforce-UXBQRTFP.js → stop-enforce-ZLQKGMSF.js} +1 -1
- package/package.json +7 -6
- package/dist/chunk-AQ3DMGAY.js +0 -6
- package/dist/chunk-EK6TENV6.js +0 -4
- package/dist/chunk-ESOXRGIY.js +0 -83
- package/dist/chunk-GD63CZVP.js +0 -242
- package/dist/chunk-M7VQD4VO.js +0 -6
- package/dist/chunk-OY6HNCAZ.js +0 -4
- package/dist/daemon-EGU25OUV.js +0 -139
- package/dist/post-edit-2VFE6QND.js +0 -4
- package/dist/post-edit-analyze-VETPP5Z4.js +0 -4
- package/dist/post-edit-flag-stubs-J3MCGLXI.js +0 -4
- package/dist/status-UBUNHH5O.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
|
|
4
|
+
import{a as ln,c as dn,d as un,e as cn,f as pn,g as ue}from"./chunk-ZDA3E2AS.js";import{a as jn,b as Tn,d as Mn,e as Ln,f as Nn,g as On,h as _n,i as Fn,j as Wn,k as Dn,l as Un,m as qn,n as Bn}from"./chunk-CDPYJKK7.js";import{a as En}from"./chunk-FR4ENKCT.js";import{b as tn,c as on,d as sn,f as an}from"./chunk-4H7EIC6W.js";import{B as Sn,F as Rn,G as Pn,J as $n,K as Fe,M as In,N as An,a as Xr,b as Yr,c as Zr,d as en,e as Le,f as rn,g as fn,h as gn,j as yn,k as hn,l as kn,m as wn,n as bn,o as vn,q as xn,w as _e,y as Cn,z as ce}from"./chunk-U27IDW6O.js";import{b as nn,c as de}from"./chunk-WZBLSDNV.js";import{a as zr}from"./chunk-MOI4L3EX.js";import{a as se,b as Jr,c as le,d as Qr}from"./chunk-JXGIARTE.js";import{a as R}from"./chunk-OQ6KNYPG.js";import{b as J}from"./chunk-ZUPS6XVH.js";import{a as C,b as Tr,c as b}from"./chunk-LEFXRK53.js";import{a as Mr}from"./chunk-7WZ3VIUU.js";import{e as Ne}from"./chunk-4W6WIT7T.js";import{a as hr,b as Vn,c as Hn}from"./chunk-EA62LNKT.js";import{a as k}from"./chunk-R4ZTRVDQ.js";import{b as kr,c as G,d as wr,e as br}from"./chunk-FEHVIHVA.js";import"./chunk-KOKEEAEF.js";import{a as jr,b as w}from"./chunk-Q6IYTHMP.js";import{a as U,b as Ir,c as Te,d as Ar}from"./chunk-XZ2TPZLD.js";import{a as x}from"./chunk-MHNGR6M7.js";import{e as Kr,g as ae,h as Gr}from"./chunk-XVMIPWJQ.js";import{b as Er,e as z,h as j,j as $r,k as te}from"./chunk-EVVF662P.js";import"./chunk-DBIXYJRB.js";import{a as lr,b as dr,c as ur,d as u,f as _,h as cr,j as E,k as pr,l as mr,m as je,n as fr,o as gr,p as yr}from"./chunk-PE5WVWI5.js";import{a as ne}from"./chunk-CJUKILIO.js";import{k as Oe,l as mn}from"./chunk-PRD7P6EF.js";import{F as Dr,K as Me,O as Ur,P as qr,V as Br,Y as ie,Z as Vr,aa as Hr,e as oe,i as Lr,j as Nr,l as Or,m as _r,w as p,x as Fr,y as Wr}from"./chunk-BR7W4UBJ.js";import{E as xr,F as D,L,M as Cr,R as Sr,W as Rr,X as Pr,i as vr,n as F,o as W}from"./chunk-4F67XQYS.js";import"./chunk-NNH3YVVO.js";import"./chunk-KMZ3L5YA.js";import{availableParallelism as Fu}from"os";import{existsSync as Kn}from"fs";function Gn(){let e=new URL("solve-worker.js",import.meta.url);if(Kn(e))return e;let r=new URL("../dist/solve-worker.js",import.meta.url);if(Kn(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 Wu from"update-notifier";import Du from"yargs";import{hideBin as Uu}from"yargs/helpers";function pe({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 zn(){return"Update available {currentVersion} \u2192 {latestVersion}\nRun `npx ripplo update`"}import{graphql as ds}from"gql.tada";import{exec as es}from"child_process";import{createAuthClient as Yi}from"better-auth/client";import{deviceAuthorizationClient as Zi}from"better-auth/client/plugins";function Jn({baseURL:e}){return Yi({baseURL:e,fetchOptions:{headers:{"User-Agent":"Ripplo CLI"}},plugins:[Zi()]})}import{err as Qn,ok as rs}from"neverthrow";var ns=5e3,Xn="ripplo-cli";async function Yn({onDeviceCode:e,url:r}){let n=r??Tr().RIPPLO_SERVER_URL,t=Jn({baseURL:n}),o=await t.device.code({client_id:Xn});if(o.error!=null)return Qn({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}),ls(a),(await ts({authClient:t,deviceCode:i})).map(d=>(pr({serverUrl:n,token:d}),d))}async function ts({authClient:e,deviceCode:r}){for(;;){await ss(ns);let n=await e.device.token({client_id:Xn,device_code:r,grant_type:"urn:ietf:params:oauth:grant-type:device_code"});if(n.data?.access_token!=null)return rs(n.data.access_token);if(n.error==null)continue;if(!is(n.error.error))return Qn({code:n.error.error,description:n.error.error_description,kind:"oauth-authorization-failed"})}}var os=new Set(["authorization_pending","slow_down"]);function is(e){return os.has(e)}function ss(e){return new Promise(r=>{setTimeout(r,e)})}function as(){return process.platform==="darwin"?"open":process.platform==="win32"?"start":"xdg-open"}function ls(e){let r=as();es(`${r} "${e}"`,()=>{})}function I({serverUrl:e,token:r}){return{appUrl:"",cwd:process.cwd(),engineUrl:"",projectId:"",ripploServerUrl:e,token:r,webhookSecret:""}}var us=ds(`
|
|
5
5
|
query AuthViewer {
|
|
6
6
|
currentUser {
|
|
7
7
|
name
|
|
8
8
|
email
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
|
-
`);async function
|
|
11
|
+
`);async function Zn(){let e=C(),r=E(e);if(r!=null&&await cs(e,r))return;let t=(await Yn({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
16
|
`)}})).match(a=>a,a=>{process.stderr.write(`${w(a)}
|
|
17
|
-
`),process.exit(1)}),o=await
|
|
18
|
-
`),process.stdout.write(o.kind==="ok"?`${s}, ${
|
|
17
|
+
`),process.exit(1)}),o=await We({serverUrl:e,token:t}),i=Mr(process.cwd()),s=i?"Welcome back":"Welcome to Ripplo";process.stdout.write(`
|
|
18
|
+
`),process.stdout.write(o.kind==="ok"?`${s}, ${ps(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 ${je(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 cs(e,r){let n=await We({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
|
|
25
|
+
`),!1)}async function et(){let e=C(),r=E(e);r==null&&(process.stdout.write("Not signed in. Run `npx ripplo auth login`.\n"),process.exit(1));let n=await We({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
|
|
29
|
-
`);return}process.stdout.write(`Signed out. Removed ${
|
|
30
|
-
`)}async function
|
|
31
|
-
`),process.exit(1)}async function
|
|
32
|
-
`)}function
|
|
28
|
+
`)}function rt(){let e=C();if(!mr(e)){process.stdout.write(`Already signed out.
|
|
29
|
+
`);return}process.stdout.write(`Signed out. Removed ${je(e)}.
|
|
30
|
+
`)}async function We({serverUrl:e,token:r}){try{let t=(await u({config:I({serverUrl:e,token:r}),document:us,variables:void 0})).currentUser;return t==null?{kind:"rejected"}:{kind:"ok",viewer:{email:t.email,name:t.name}}}catch(n){return ur(n)==="UNAUTHENTICATED"?{kind:"rejected"}:{kind:"unreachable",message:n instanceof Error?n.message:String(n)}}}function ps(e){let r=e.name.trim().split(/\s+/)[0];return r!=null&&r.length>0?r:e.email}import{readFile as ms,writeFile as fs}from"fs/promises";import gs from"path";async function nt(e){let r=process.cwd(),n=await te(r);n.isErr()&&me(U(n.error));let t=n.value,[o,i]=await Promise.all([se({cwd:r,lockfile:t}),ae(r,t)]);o.length>0&&me(le(o));let s=xr(L,i),a=gs.join(r,j);if(e.check){await ys(a,i);return}await fs(a,s),ks(i)}function me(e){process.stderr.write(`${e}
|
|
31
|
+
`),process.exit(1)}async function ys(e,r){let n=await ms(e,"utf8").catch(()=>null);n==null&&me(Te("missing")),hs(n,r)||me(Te("stale")),process.stdout.write(`${Ir()}
|
|
32
|
+
`)}function hs(e,r){try{let n=D(L,e);return n.checks==null?!1:Er(n,r)}catch{return!1}}function ks(e){let r=zr(e),n=e.workflows.reduce((o,i)=>o+i.tests.length,0),t=[Ar(),...r.length>0?[Qr(r)]:[],Jr(n)];process.stdout.write(`${t.join(`
|
|
33
33
|
`)}
|
|
34
|
-
`)}import{graphql as
|
|
34
|
+
`)}import{graphql as tt}from"gql.tada";function De(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 ws}from"gql.tada";var bs=ws(`
|
|
35
35
|
query DevSessionCheckPreflight($projectId: String!, $cwd: String!) {
|
|
36
36
|
project(id: $projectId) {
|
|
37
37
|
id
|
|
@@ -40,62 +40,62 @@ import{a as sn,c as an,d as ln,e as dn,f as un,g as ue}from"./chunk-LKYTQXPR.js"
|
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
|
-
`);function
|
|
44
|
-
`),process.stderr.write(`${
|
|
45
|
-
`),process.exit(1)})}async function v(e){(await u({config:e,document:
|
|
46
|
-
`),process.exit(1))}var
|
|
43
|
+
`);function f(){return b(process.cwd()).match(e=>e,e=>{process.stderr.write(`${w(e)}
|
|
44
|
+
`),process.stderr.write(`${x("setup")}
|
|
45
|
+
`),process.exit(1)})}async function v(e){(await u({config:e,document:bs,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(`${x("setup")}
|
|
46
|
+
`),process.exit(1))}var vs=tt(`
|
|
47
47
|
mutation CliUpdateMaxLocalConcurrentRuns($value: Int!) {
|
|
48
48
|
updateMaxLocalConcurrentRuns(value: $value) {
|
|
49
49
|
id
|
|
50
50
|
maxLocalConcurrentRuns
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
|
-
`),
|
|
53
|
+
`),xs=tt(`
|
|
54
54
|
query CliMaxLocalConcurrentRuns {
|
|
55
55
|
currentUser {
|
|
56
56
|
id
|
|
57
57
|
maxLocalConcurrentRuns
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
|
-
`);async function
|
|
61
|
-
`);return}let n=await u({config:r,document:
|
|
62
|
-
`)}function
|
|
60
|
+
`);async function ot({value:e}){let r=f();if(e==null){let t=await u({config:r,document:xs,variables:{}});process.stdout.write(`${De(t.currentUser?.maxLocalConcurrentRuns)}
|
|
61
|
+
`);return}let n=await u({config:r,document:vs,variables:{value:e}});process.stdout.write(`${De(n.updateMaxLocalConcurrentRuns?.maxLocalConcurrentRuns)}
|
|
62
|
+
`)}function it(e){switch(e.type){case"settings":return Cs(e);case"env-files":return Ss(e);case"token":return Rs(e);case"dev-server":return Ps(e);case"dev-session":return Yr(e);case"entities":return Es(e);case"webhook-verification":return $s(e);case"entities-validation":return Is(e);case"workflows":return As(e);case"browser":return Ts(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 Ms(e);case"lockfile":return Ls(e);case"pre-commit-hook":return Ns(e);case"plugin-version":return Os(e)}}function Cs(e){return e.valid?"\u2713 Settings: project configured":`\u2717 Settings: missing fields: ${e.missingFields.join(", ")}`}function Ss(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 Rs(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 Ps(e){return e.reachable?`\u2713 Dev server: ${e.appUrl} is reachable`:`\u2717 Dev server: ${e.appUrl} is not responding. Start your dev server.`}function Es(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 $s(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 Is(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 As(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=>js(n));return`\u2717 Tests: ${String(e.invalidNames.length)} invalid
|
|
68
68
|
${r.join(`
|
|
69
|
-
`)}`}function
|
|
69
|
+
`)}`}function js(e){let r=e.errors.map(n=>" - "+(n.path===""?"":n.path+": ")+n.message);return" "+e.name+`:
|
|
70
70
|
`+r.join(`
|
|
71
|
-
`)}function
|
|
71
|
+
`)}function Ts(e){return e.installed?"\u2713 Browser: Chromium installed":"\u2717 Browser: Chromium not installed. Run `npx playwright install chromium`."}function Ms(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 Ls(e){switch(e.status){case"match":return`\u2713 Lockfile: ${j} is up to date`;case"missing":return`\u2717 Lockfile: ${j} is missing \u2014 run \`npx ripplo compile\` and commit it`;case"stale":return`\u2717 Lockfile: ${j} is out of date \u2014 run \`npx ripplo compile\` and commit it`}}function Ns(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 Os(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)`}import q from"fs";import Us from"os";import Ue from"path";import{z as T}from"zod";import _s from"latest-version";import st from"semver";async function fe(e){try{return await Promise.race([_s("ripplo"),new Promise(r=>setTimeout(()=>{r(void 0)},e))])}catch{return}}function at(e){return e.filter(r=>st.valid(r)!=null).toSorted(st.rcompare)[0]}import{graphql as Fs}from"gql.tada";var Ws=Fs(`
|
|
72
72
|
query DoctorAuthViewer {
|
|
73
73
|
currentUser {
|
|
74
74
|
name
|
|
75
75
|
email
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
|
-
`),
|
|
79
|
-
`);let t=n.map(i=>
|
|
78
|
+
`),Ds="Failed to connect to Ripplo server";async function lt({serverUrl:e,token:r}){try{let n=await u({config:I({serverUrl:e,token:r}),document:Ws,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(Ds)?{kind:"unreachable"}:{kind:"invalid"}}}function dt(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}}async function ut(e){let r=await Vs(e),n={missing:br(e),type:"env-files"},t=await Hs(),o=await Ks(),i=await te(e),s=await Gs(e,i),a=zs(i),l=await Js(e,i),d=Qs(e),g=Bs(e),y=await Xs(r,i);return[r,n,t,...y,s,a,l,d,o,...g==null?[]:[g]]}var qs=T.object({plugins:T.record(T.string(),T.array(T.object({projectPath:T.string().optional(),scope:T.string().optional(),version:T.string()})))});function Bs(e){let r=Ue.join(Us.homedir(),".claude","plugins","installed_plugins.json"),n=q.existsSync(r)?q.readFileSync(r,"utf8"):null;if(n==null)return null;let t=qs.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=at(o);return i==null?null:{cliVersion:k(),installed:i,type:"plugin-version"}}async function Vs(e){let r=await en(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 Hs(){let e=C(),r=E(e);if(r==null||r.length===0)return{email:void 0,status:"missing",type:"token"};let n=await lt({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 Ks(){let{chromium:e}=await import("playwright"),r=e.executablePath();return{installed:q.existsSync(r),type:"browser"}}async function Gs(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 se({cwd:e,lockfile:r.value});return{errorCount:n.length,errors:n.length===0?[]:[{message:le(n),path:""}],found:!0,type:"entities-validation",valid:n.length===0}}function zs(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 Js(e,r){return r.isErr()?{status:"missing",type:"lockfile"}:(await Gr(e,r.value)).isOk()?{status:"match",type:"lockfile"}:{status:await q.promises.readFile(Ue.join(e,j),"utf8").catch(()=>null)==null?"missing":"stale",type:"lockfile"}}function Qs(e){let r=Ue.join(e,".git","hooks","pre-commit");return q.existsSync(r)?{installed:q.readFileSync(r,"utf8").includes("ripplo compile --check"),type:"pre-commit-hook"}:{installed:!1,type:"pre-commit-hook"}}async function Xs(e,r){let n=wr().map(s=>({appUrl:s.appUrl,engineUrl:s.engineUrl,webhookSecret:s.webhookSecret})).unwrapOr(void 0);if(n==null)return[];let t=[],o=await Le(n.appUrl)==null;t.push({appUrl:n.appUrl,reachable:o,type:"dev-server"});let i=await Zr(process.cwd());if(t.push(i),e.valid&&r.isOk()){let s=await Ys(n,r);t.push(...s)}return t}async function Ys(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=ea(e.appUrl,e.engineUrl);if(i==null)return[o];let s=await Le(i)==null,a=[];if(a.push({configured:!0,count:n,endpointReachable:s,type:"entities"}),ct(e.engineUrl)&&a.push({reachable:s,type:"engine-endpoint",url:i}),!s)return a;let l=await rn({appUrl:e.appUrl,engineUrl:e.engineUrl});a.push({rejectsUnsigned:l==null,type:"webhook-verification"});let d=await Zs({engineUrl:i,webhookSecret:e.webhookSecret});return a.push({status:d,type:"adapter-enabled",url:i}),a}async function Zs({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",...gr({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 ct(e){return e.startsWith("http://")||e.startsWith("https://")}function ea(e,r){return ct(r)?r:`${e}${r}`}var ra=3e3;async function pt(){let e=process.cwd(),[r,n]=await Promise.all([fe(ra),ut(e)]);process.stdout.write(`${pe({current:k(),latest:r})}
|
|
79
|
+
`);let t=n.map(i=>it(i));process.stdout.write(t.join(`
|
|
80
80
|
`)+`
|
|
81
|
-
`);let o=n.some(i=>
|
|
81
|
+
`);let o=n.some(i=>dt(i));process.exit(o?1:0)}import ge from"fs";import{graphql as na}from"gql.tada";var ta=na(`
|
|
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
|
|
87
|
+
`);async function mt(){let e=process.cwd();cr(e);let r=Ne(e);if(ge.existsSync(r)){process.stdout.write("Hooks already paused. Run `npx ripplo hooks resume` to re-enable.\n");return}ge.writeFileSync(r,""),await gt(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 ft(){let e=process.cwd(),r=Ne(e);if(!ge.existsSync(r)){process.stdout.write(`Hooks already active.
|
|
88
|
+
`);return}ge.unlinkSync(r),await gt(e,!1),process.stdout.write(`Hooks resumed.
|
|
89
|
+
`)}async function gt(e,r){let n=b(e).unwrapOr(void 0);n!=null&&await u({config:n,document:ta,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 B from"fs";import V from"path";import{input as xt,select as Ct}from"@inquirer/prompts";import{graphql as Oa}from"gql.tada";import{exec as oa,execFile as ia}from"child_process";import{err as sa,ok as yt}from"neverthrow";import m from"fs";import{createRequire as aa}from"module";import h from"path";import{promisify as kt}from"util";var la=["ripplo","@ripplo/testing","@ripplo/instrument"],ht=".ripplo/ripplo.lock linguist-generated=true",da=[".ripplo/debug/",".ripplo/.local/"],ua=kt(oa),ca=kt(ia);async function wt({cwd:e,onStep:r}){r("Scaffolding project files..."),xa({cwd:e}),r("Updating .gitignore..."),Sa(e),r("Marking ripplo.lock as generated..."),ga(e),r("Installing dependencies...");let n=await ma(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 fa(e);i!=null&&t.push({manualCommand:void 0,message:i})}return r("Setting up browser..."),(await pa()).map(()=>t)}async function pa(){let{chromium:e}=await import("playwright"),r=e.executablePath();if(m.existsSync(r))return yt(void 0);_.info("Chromium not found. Installing via Playwright...");let n=aa(import.meta.url),t=h.dirname(n.resolve("playwright/package.json")),o=h.join(t,"cli.js");return await ca(process.execPath,[o,"install","chromium"]),m.existsSync(r)?yt(void 0):sa({kind:"playwright-install-failed"})}async function ma(e){let r=ya({cwd:e,pm:va(e)});_.info("Installing dependencies: %s",r);try{return await ua(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 fa(e){try{await Kr(e);return}catch(r){return`Couldn't compile initial lockfile: ${r instanceof Error?r.message:String(r)}.`}}function ga(e){let r=h.join(e,".gitattributes"),n=m.existsSync(r)?m.readFileSync(r,"utf8"):"";if(n.includes(ht))return;let t=n.length===0||n.endsWith(`
|
|
92
92
|
`)?"":`
|
|
93
|
-
`;m.writeFileSync(r,`${n}${t}${
|
|
94
|
-
`)}function
|
|
93
|
+
`;m.writeFileSync(r,`${n}${t}${ht}
|
|
94
|
+
`)}function ya({cwd:e,pm:r}){let n=la.join(" ");return r==="pnpm"?ha(e)?`pnpm add -wD ${n}`:`pnpm add -D ${n}`:r==="yarn"?ka({cwd:e,deps:n}):r==="bun"?`bun add -d ${n}`:`npm install -D ${n}`}function ha(e){return m.existsSync(h.join(e,"pnpm-workspace.yaml"))||m.existsSync(h.join(e,"pnpm-workspace.yml"))}function ka({cwd:e,deps:r}){return wa(e)?`yarn add -D ${r}`:ba(e)?`yarn add -WD ${r}`:`yarn add -D ${r}`}function wa(e){if(m.existsSync(h.join(e,".yarnrc.yml"))||m.existsSync(h.join(e,".pnp.cjs"))||m.existsSync(h.join(e,".pnp.js")))return!0;let r=h.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 ba(e){let r=h.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 va(e){return m.existsSync(h.join(e,"pnpm-lock.yaml"))?"pnpm":m.existsSync(h.join(e,"yarn.lock"))?"yarn":m.existsSync(h.join(e,"bun.lockb"))||m.existsSync(h.join(e,"bun.lock"))?"bun":"npm"}function xa({cwd:e}){let r=h.join(e,".ripplo");Ma.forEach(({content:n,relPath:t})=>{let o=h.join(r,t);m.mkdirSync(h.dirname(o),{recursive:!0}),Ca(o,n)})}function Ca(e,r){m.existsSync(e)||m.writeFileSync(e,r)}function Sa(e){let r=h.join(e,".gitignore");if(!m.existsSync(r))return;let n=m.readFileSync(r,"utf8"),t=da.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 Ra=`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
|
+
`,Pa=`// 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
|
+
`,Ea=`// 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
|
+
`,$a=`// 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
|
+
`,Ia=`// 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
|
+
`,Aa=`// 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
|
+
`,ja=`{
|
|
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
|
+
`,Ta=`// 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
|
+
`,Ma=[{content:Ra,relPath:"index.ts"},{content:Pa,relPath:"entities/index.ts"},{content:Ea,relPath:"singletons/index.ts"},{content:$a,relPath:"facts.ts"},{content:Ia,relPath:"givens.ts"},{content:Aa,relPath:"workflows/index.ts"},{content:ja,relPath:"tsconfig.json"},{content:Ta,relPath:"eslint.config.js"}];import ye from"fs";import bt from"path";import{z as qe}from"zod";var La={autoUpdate:!0,source:{repo:"ripplo/claude-plugin",source:"github"}},vt=qe.record(qe.string(),qe.unknown());function he(e){let r=bt.join(e,".claude","settings.json"),n=Na(r);if(n==null)return"unparseable";let t=vt.safeParse(n.extraKnownMarketplaces??{});if(!t.success)return"unparseable";if(t.data.ripplo!=null)return"already-present";let o={...n,extraKnownMarketplaces:{...t.data,ripplo:La}};return ye.mkdirSync(bt.dirname(r),{recursive:!0}),ye.writeFileSync(r,`${JSON.stringify(o,null,2)}
|
|
204
|
+
`),"written"}function Na(e){if(!ye.existsSync(e))return{};try{let r=vt.safeParse(JSON.parse(ye.readFileSync(e,"utf8")));return r.success?r.data:void 0}catch{return}}function ke(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 _a=Oa(`
|
|
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 y=(await
|
|
211
|
+
`),Be=["../.env.local","../.env"];async function St(e=Da()){let r=process.cwd(),n=C(),t=E(n);t==null&&(process.stdout.write("Not signed in. Run `npx ripplo auth login` first.\n"),process.exit(1)),Fa(r)&&(process.stdout.write(`\`.ripplo/index.ts\` already exists at ${r}. To re-init, delete it first.
|
|
212
|
+
`),process.exit(1));let o=await Wa({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 qa(o,e.projectId),s=await Ba(r,e.envFile),a=await Ha(e.appUrl),l=Ua(a,e.engineUrl),d=V.resolve(V.join(r,".ripplo"),s);kr({cwd:r,envFiles:[s],projectId:i}),Ga({appUrl:a,engineUrl:l,filePath:d}),process.stdout.write(`${ke(he(r))}
|
|
213
|
+
`);let y=(await wt({cwd:r,onStep:c=>{process.stdout.write(` ${c}
|
|
214
214
|
`)}})).match(c=>c,c=>{process.stderr.write(`${w(c)}
|
|
215
215
|
`),process.exit(1)});if(y.length>0){process.stdout.write(`Done with warnings:
|
|
216
216
|
`),y.forEach(c=>{process.stdout.write(` - ${c.message}
|
|
217
217
|
`),c.manualCommand!=null&&process.stdout.write(` run: ${c.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
|
|
219
|
-
`),process.exit(1)}return r}return`${e.replace(/\/$/,"")}/ripplo`}async function
|
|
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 Fa(e){return B.existsSync(V.join(e,".ripplo","index.ts"))}async function Wa({serverUrl:e,token:r}){return((await u({config:I({serverUrl:e,token:r}),document:_a,variables:void 0})).projects??[]).map(t=>({id:t.id,name:t.name}))}function Da(){return{appUrl:void 0,engineUrl:void 0,envFile:void 0,projectId:void 0}}function Ua(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 qa(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 Ct({choices:e.map(n=>({name:n.name,value:n.id})),message:"Select a project"})}async function Ba(e,r){return r!=null?(r.trim().length===0&&(process.stdout.write(`--env must not be empty
|
|
223
|
+
`),process.exit(1)),r):Va(e)}async function Va(e){let r=V.join(e,".ripplo"),n=Be.find(o=>B.existsSync(V.resolve(r,o))),t=await Ct({choices:[...Be.map(o=>({name:n===o?`${o} (detected)`:o,value:o})),{name:"custom path",value:"__custom__"}],default:n??Be[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:xt({message:"Path to env file (relative to .ripplo/, e.g. ../apps/server/.env)",validate:o=>o.trim().length>0?!0:"required"})}async function Ha(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 Ka()}async function Ka(){return xt({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 Ga({appUrl:e,engineUrl:r,filePath:n}){B.mkdirSync(V.dirname(n),{recursive:!0});let t=B.existsSync(n)?B.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=${yr()}`),/^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
|
+
`;B.writeFileSync(n,`${t}${i}${o.join(`
|
|
227
227
|
`)}
|
|
228
|
-
`)}import{graphql as
|
|
229
|
-
`)}function
|
|
228
|
+
`)}import{graphql as Ke}from"gql.tada";function Ve(){return"Not signed in. Run `npx ripplo auth login` first."}function Rt(){return"No organization found for your account. Sign in to the dashboard once, then retry."}function Pt(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 za=Ke(`
|
|
230
230
|
query ProjectsList {
|
|
231
231
|
projects {
|
|
232
232
|
id
|
|
233
233
|
name
|
|
234
234
|
}
|
|
235
235
|
}
|
|
236
|
-
`),
|
|
236
|
+
`),Ja=Ke(`
|
|
237
237
|
query OrganizationsList {
|
|
238
238
|
organizations {
|
|
239
239
|
id
|
|
240
240
|
name
|
|
241
241
|
}
|
|
242
242
|
}
|
|
243
|
-
`),
|
|
243
|
+
`),Qa=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 u({config:I({serverUrl:e,token:r}),document:
|
|
261
|
-
`)}async function
|
|
262
|
-
`),process.exit(1));let o=I({serverUrl:n,token:t}),i=r??await
|
|
263
|
-
`),process.exit(1)),l})).createProject;if(a?.__typename!=="Project"){let l=a?.message??"unknown error";process.stderr.write(`${
|
|
259
|
+
`);async function Et(){let e=C(),r=E(e);r==null&&(process.stderr.write(`${Ve()}
|
|
260
|
+
`),process.exit(1));let t=((await u({config:I({serverUrl:e,token:r}),document:za,variables:void 0})).projects??[]).map(o=>({id:o.id,name:o.name}));process.stdout.write(`${JSON.stringify({projects:t},null,2)}
|
|
261
|
+
`)}async function $t({name:e,orgId:r}){let n=C(),t=E(n);t==null&&(process.stderr.write(`${Ve()}
|
|
262
|
+
`),process.exit(1));let o=I({serverUrl:n,token:t}),i=r??await Xa(o),a=(await u({config:o,document:Qa,variables:{name:e,organizationId:i}}).catch(l=>{throw l instanceof dr&&(process.stderr.write(`${He(l.message)}
|
|
263
|
+
`),process.exit(1)),l})).createProject;if(a?.__typename!=="Project"){let l=a?.message??"unknown error";process.stderr.write(`${He(l)}
|
|
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 Xa(e){let n=((await u({config:e,document:Ja,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?Rt():Pt(n)}
|
|
266
|
+
`),process.exit(1)}import{spawnSync as we}from"child_process";function It(){if(we("claude",["--version"],{stdio:"ignore"}).error!=null)return{kind:"claude-missing"};we("claude",["plugin","marketplace","add","ripplo/claude-plugin"],{stdio:"ignore"});let r=we("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:we("claude",["/ripplo:setup"],{stdio:"inherit"}).status??0,kind:"launched"}}function At(){return"Installing the Ripplo plugin for Claude Code, then handing off to a guided setup session."}function jt(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 Tt(){process.stdout.write(`${At()}
|
|
268
|
+
`);let e=It();e.kind!=="launched"&&(process.stderr.write(`${jt(e)}
|
|
269
|
+
`),process.exit(1)),process.exit(e.exitCode)}import{graphql as Ya}from"gql.tada";function Mt({id:e,kind:r,title:n}){return`Caught bug reported (${r}): "${n}" [${e}]`}var Za=Ya(`
|
|
270
270
|
mutation ReportCaughtBug(
|
|
271
271
|
$projectId: String!
|
|
272
272
|
$kind: CaughtBugKind!
|
|
@@ -294,41 +294,41 @@ ${e.detail}`:""}`}function It(){process.stdout.write(`${$t()}
|
|
|
294
294
|
}
|
|
295
295
|
}
|
|
296
296
|
}
|
|
297
|
-
`);async function
|
|
298
|
-
`),process.exit(1)}process.stdout.write(`${
|
|
299
|
-
`)}import
|
|
300
|
-
`);let l=new
|
|
301
|
-
`)}})).match(c=>c,c=>M(ue(c)));await
|
|
297
|
+
`);async function Lt(e){let r=f(),t=(await u({config:r,document:Za,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
|
+
`),process.exit(1)}process.stdout.write(`${Mt({id:t.id,kind:e.kind,title:e.title})}
|
|
299
|
+
`)}import el from"path";import{CancellationTokenSource as rl}from"vscode-jsonrpc/node";function Nt(e){return`ripplo: workspace build is stale (${e.join(", ")}) \u2014 rebuilding`}function Ot(){return"ripplo: workspace build failed \u2014 fix the build, then rerun"}function be(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 _t({all:e,headed:r,ids:n}){let t=process.cwd(),o=process.argv[1];o==null&&M(ue({kind:"spawn-failed",message:"process.argv[1] missing"})),tl();let i=await ln(t);i!=null&&M(cn(i));let a=(await tn({cliEntry:o,cwd:t})).match(c=>c,c=>M(ue(c)));a.versionNote?.kind==="stale-busy"&&M(Oe(a.versionNote)),a.versionNote!=null&&process.stderr.write(`${Oe(a.versionNote)}
|
|
300
|
+
`);let l=new rl;process.once("SIGINT",()=>{l.cancel(),a.socket.destroy(),process.exit(130)});let d=el.join(t,".ripplo","debug"),y=(await on({connection:a,request:{all:e,headed:r,tests:[...n]},token:l.token,onEvent:c=>{let S=un({debugDir:d,event:c});S!=null&&process.stdout.write(`${S}
|
|
301
|
+
`)}})).match(c=>c,c=>M(ue(c)));await nl({connection:a,result:y})}async function nl({connection:e,result:r}){await new Promise(n=>{e.socket.end(n)}),r.kind==="daemon-error"&&M(pn(r.error)),process.stdout.write(`${dn(r)}
|
|
302
302
|
`),r.failed>0&&process.exit(1),process.exit(r.notRun>0?2:0)}function M(e){process.stderr.write(`${e}
|
|
303
|
-
`),process.exit(1)}function
|
|
304
|
-
`),
|
|
303
|
+
`),process.exit(1)}function tl(){let e=de();if(e.kind==="fresh")return;if(e.kind==="foreign-binary"){let n=be(e);M(n??"foreign binary in the ripplo workspace")}process.stderr.write(`${Nt(e.packages)}
|
|
304
|
+
`),nn(e.workspaceRoot)||M(Ot())}import N from"path";import ll from"os";import{mkdtempSync as dl,rmSync as ul}from"fs";import{err as Ce,ok as Je}from"neverthrow";import{z as Ft}from"zod";import{readdir as ol,rm as il,stat as sl}from"fs/promises";import{existsSync as al}from"fs";import Ge from"path";async function ze(e,r){let t=(await ol(e,{withFileTypes:!0}).catch(()=>[])).filter(s=>s.isDirectory()).map(s=>s.name).filter(s=>s.startsWith("replay-")||s.startsWith("explore-")||al(Ge.join(e,s,Cn)));if(t.length<=r)return;let i=(await Promise.all(t.map(async s=>({mtime:(await sl(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=>il(Ge.join(e,s.name),{force:!0,recursive:!0}).catch(()=>{})))}var Wt=50,cl=15e3;async function Dt(){ne(k());let e=process.cwd(),r=_.child({worker:process.pid}),n=xn(),t=dl(N.join(ll.tmpdir(),"ripplo-browser-cache-")),o=ie({cacheDir:t,clientVersion:k(),debugDir:N.join(e,".ripplo","debug"),headed:!1,writeOtlpPortFile:!1}),i=new Set,s=l=>{i.add(l),l.finally(()=>i.delete(l))},a=l=>{setTimeout(()=>{process.exit(l)},cl).unref(),ml(i).then(()=>o.close().catch(()=>{})).then(()=>{ul(t,{force:!0,recursive:!0}),process.exit(l)})};process.on("disconnect",()=>{a(1)}),process.on("unhandledRejection",l=>{r.error({err:l},"worker unhandled rejection")}),process.on("uncaughtException",l=>{r.error({err:l},"worker uncaught exception"),a(1)}),n.onRequest(hn,async(l,d)=>{let g=fn.safeParse(l);if(!g.success)return ve("bad-run-assign");let y=g.data;G(e);let c=b(e).match(P=>P,P=>P.kind);if(typeof c=="string")return ve(`config:${c}`);let S=await Ut(n);if(S.isErr())return ve(`lockfile-unavailable:${S.error}`);let re=S.value,O=oe(re).find(P=>P.ref===y.testRef);if(O==null)return ve(`no-test:${y.testRef}`);try{let{outcome:P,persisted:Ae}=await Sn({config:c,cwd:e,errorSettle:"settle",fixturesDir:N.join(e,z),headed:y.headed,lockfile:re,onPhase:void 0,runId:y.runId,session:o,signal:_e(d),test:O.test}),ar=N.join(e,".ripplo","debug");return s(Promise.allSettled([Ae]).then(()=>ce({config:c,debugDir:ar,runId:y.runId})).then(()=>ze(ar,Wt)).catch(()=>{})),{outcome:mn(P),serverNotified:!0}}catch(P){let Ae=N.join(e,".ripplo","debug");if(s(ce({config:c,debugDir:Ae,runId:y.runId}).catch(()=>{})),P instanceof lr)return{outcome:{detail:P.message,kind:"infra-error"},serverNotified:!1};throw P}}),n.onRequest(wn,(l,d)=>gl({connection:n,cwd:e,raw:l,session:o,token:d,track:s})),n.onNotification(bn,l=>{let d=gn.safeParse(l);d.success&&o.injectSpan(d.data.runId,d.data.span)}),n.onNotification(vn,()=>{a(0)}),n.sendNotification(yn),await new Promise(()=>{})}function ve(e){return{outcome:{detail:e,kind:"error"},serverNotified:!1}}var pl=5e3;async function ml(e){e.size!==0&&await Promise.race([Promise.allSettled(e),new Promise(r=>{setTimeout(r,pl)})])}var fl=Ft.object({assign:Ur,devSessionId:Ft.string().nullable()});async function gl({connection:e,cwd:r,raw:n,session:t,token:o,track:i}){let s=fl.safeParse(n);if(!s.success)return{error:{source:"bad-assign"},kind:"error"};let{assign:a,devSessionId:l}=s.data;G(r);let d=b(r).match(O=>O,O=>O.kind);if(typeof d=="string")return{error:{detail:d,source:"config"},kind:"error"};let g=await Ut(e);if(g.isErr())return{error:{source:"lockfile-stale"},kind:"error"};let y=g.value,c=N.join(d.cwd,".ripplo","debug"),S=await Rn({assign:a,config:d,debugDir:c,devSessionId:l??void 0,fixturesDir:N.join(d.cwd,z),headed:!1,lockfile:y,report:!0,session:t,signal:_e(o)}),re=S.kind==="finding"&&S.runId!=null?ce({config:d,debugDir:c,runId:S.runId}):Promise.resolve();return i(re.then(()=>ze(c,Wt)).catch(()=>{})),S}async function Ut(e){return(await yl(e)).andThen(n=>n.unavailable!=null?Ce(n.unavailable):n.lockfileJson==null?Ce("empty-reply"):hl(n.lockfileJson))}async function yl(e){try{return Je(await e.sendRequest(kn))}catch(r){return Ce(`transport:${r instanceof Error?r.message:"unknown"}`)}}var xe;function hl(e){if(xe!==void 0&&xe.json===e)return Je(xe.lockfile);try{let r=Cr(D(L,e));return xe={json:e,lockfile:r},Je(r)}catch(r){return Ce(`worker-decode-failed:${r instanceof Error?r.message.slice(0,200):"unknown"}`)}}async function qt(){await Dt()}import{existsSync as El}from"fs";import $l from"path";import{ok as Il}from"neverthrow";import{gunzipSync as kl}from"zlib";import{mkdir as wl,writeFile as bl}from"fs/promises";import Bt from"path";import{graphql as vl}from"gql.tada";import{err as Q,ok as xl}from"neverthrow";var Cl=31,Sl=139;async function Se(e,r){let n=b(e).match(s=>s,s=>s.kind);if(typeof n=="string")return Q({detail:n,kind:"config"});let t=await u({config:n,document:Rl,variables:{id:r}}).catch(()=>null);if(t==null)return Q({kind:"request-failed"});if(t.run==null)return Q({kind:"not-found"});if(t.run.behaviorUrl==null)return Q({kind:"not-uploaded"});let o=await fetch(t.run.behaviorUrl);if(!o.ok)return Q({kind:"download-failed",status:o.status});let i=Bt.join(e,".ripplo","debug",r,"behavior.jsonl");return await wl(Bt.dirname(i),{recursive:!0}),await bl(i,Pl(Buffer.from(await o.arrayBuffer()))),xl({path:i,runId:r})}var Rl=vl(`
|
|
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
|
-
`)}function
|
|
314
|
-
`)}function
|
|
315
|
-
`)}function
|
|
316
|
-
`),process.exit(1)),(await
|
|
317
|
-
`)},o=>{process.stderr.write(`${
|
|
318
|
-
`),process.exit(1)})}async function
|
|
319
|
-
`)},n=>{process.stderr.write(`${
|
|
320
|
-
`),process.exit(1)})}import{randomUUID as
|
|
311
|
+
`);function Pl(e){return e[0]===Cl&&e[1]===Sl?kl(e):e}async function H(e,r){let n=$l.join(e,".ripplo","debug",r,"behavior.jsonl");return El(n)?Il(void 0):(await Se(e,r)).map(()=>{})}import{existsSync as Ht,readFileSync as Kt}from"fs";import Gt from"path";import{err as Al,ok as jl}from"neverthrow";var zt=" \u203A ",Tl=4e3,Ml=5,Jt="fact ",Qt="step ",Ll="data rule ";async function Xt(e,r){let n=Gt.join(e,".ripplo","debug",r,"behavior.jsonl");if(!Ht(n))return Al({kind:"run-not-found",runId:r});let t=Nl(Kt(n,"utf8")),o=Yl(e),i=o==null?[]:await Nr(o),s=[...t.assertions.filter(a=>a.outcome!=="passed").map(a=>ql({assertion:a,facts:i,lockfile:o,run:t})),...t.findings.map(a=>Fl({event:a,facts:i,lockfile:o,run:t}))];return jl({durationMs:Math.max(0,t.lastTs-t.firstTs),failures:s,lockfileLoaded:o!=null,runId:r})}function Nl(e){let r=e.split(`
|
|
312
|
+
`).filter(s=>s.trim().length>0).flatMap(s=>{let a=F(s);return a==null?[]:[a]}),n=r.filter(s=>s.kind==="assertion"),t=r.filter(s=>s.kind==="finding"),o=r.flatMap(s=>Ol(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)}}function Ol(e){let r=_l(e);return r==null?[]:[{detail:r,timestamp:W(e.timeNanos)}]}function _l(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 Fl({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:ro(t.causes,o),label:Dl(i),outcome:"failed",pending:i.kind==="mismatch"?i.pending:void 0,ruleKind:s,rules:eo({check:Yt(i),facts:r,lockfile:n,ruleKind:s,subjectKey:Wl(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 Wl(e){return e.kind==="mismatch"&&e.mismatch.kind==="scalarMismatch"?e.mismatch.subjectKey:void 0}function Yt(e){return e.kind==="mismatch"?Zt(e.mismatch):e.kind==="unrunnable"?e.reason:e.kind==="impossibleAction"?e.action:e.kind==="driverError"?e.errorKind:e.subject}function Zt(e){return e.kind==="scalarMismatch"?e.subject:e.kind==="missingRow"||e.kind==="unexpectedRow"?`${e.entity} [${e.key}]`:`${e.entity}.${e.field} [${e.key}]`}function Dl(e){return e.kind==="mismatch"?Ul(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} ${Yt(e)}`}function Ul(e){let r=Zt(e);return e.kind==="missingRow"||e.kind==="unexpectedRow"?`${e.kind} ${r}`:`${e.kind} ${r}: expected ${e.expected}, got ${e.actual}`}function ql({assertion:e,facts:r,lockfile:n,run:t}){let o=Bl(e.label),i=W(e.timeNanos);return{browserMismatch:void 0,causes:ro(t.causes,i),label:e.label,outcome:e.outcome==="error"?"error":"failed",pending:void 0,ruleKind:o,rules:eo({check:Vl(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 Bl(e){return e.startsWith(Jt)?"fact":e.startsWith(Ll)?"data-rule":e.startsWith(Qt)?"step":"unknown"}function Vl(e,r){return r==="fact"?e.slice(Jt.length):r==="step"?e.slice(Qt.length):e}function eo({check:e,facts:r,lockfile:n,ruleKind:t,subjectKey:o}){return t!=="fact"||n==null?[]:r.filter(i=>Hl({check:e,rule:i,subjectKey:o})).map(i=>({consequence:Me(i.consequence),origins:Kl(i.origin,n),provenance:Jl(i.origin),url:Fr(i.when),when:Wr(i.when)}))}function Hl({check:e,rule:r,subjectKey:n}){return n!=null?Or(r)===n:Me(r.consequence)===e}function Kl(e,r){let n=oe(r),t=Gl(e).flatMap(o=>{let i=n.find(s=>s.ref===o);return i==null?[]:[{intent:i.workflow.intent,sourcePath:i.workflow.sourcePath}]});return zl(t)}function Gl(e){return e==null?[]:e.kind==="declared"?[]:e.kind==="generalized"?_r(e):[e.test]}function zl(e){return[...new Map(e.map(r=>[r.intent,r])).values()]}function Jl(e){return e!=null&&e.kind==="generalized"?"learned":"inferred"}function ro(e,r){let n=e.filter(t=>t.timestamp<=r&&t.timestamp>=r-Tl).toSorted((t,o)=>o.timestamp-t.timestamp);return Ql(n).toSorted((t,o)=>Number(Vt(o.detail))-Number(Vt(t.detail))).slice(0,Ml).map(t=>({deltaMs:r-t.timestamp,detail:t.detail}))}function Ql(e){return e.reduce((r,n)=>{let t=Xl(n.detail);return r.keys.has(t)?r:{keys:new Set([...r.keys,t]),out:[...r.out,n]}},{keys:new Set,out:[]}).out}function Xl(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 Vt(e){return e.kind==="network"?e.status>=400:e.kind==="span"?e.statusCode==="error":!0}function Yl(e){let r=Gt.join(e,".ripplo","ripplo.lock");if(!Ht(r))return null;try{return D(L,Kt(r,"utf8"))}catch{return null}}var no=" \u203A ",Zl=["fact ","data rule ","step "];function io(e){if(e.failures.length===0)return`${p.good("ok")} \u2014 ${e.runId}: no failing checks.`;let r=`${e.runId} \u2014 ${R(e.failures.length,"failing check")}`,n=e.lockfileLoaded?[]:[p.dim("(no lockfile \u2014 provenance unavailable)")],t=ed(e.failures).map(o=>rd(o,e.runId));return[r,...n,"",...t,x("tasks")].join(`
|
|
313
|
+
`)}function so(e){return`${p.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 rd(e,r){let n=e.failures[0];if(n==null)return"";let t=nd(e,r);if(t!=null)return t;let o=[...new Set(e.failures.map(s=>lo(s.label)))].join(", "),i=p.dim(`(${n.runWorkflow})`);return[`${p.bad("\u2717")} ${od(e.step)} ${i}`,` ${p.dim("failed")} ${o}`,...id(e),...ud(n),...cd(n.causes),` ${p.dim("frame")} npx ripplo snapshot ${r} --at ${String(n.snapshotAt)}`,""].join(`
|
|
314
|
+
`)}function nd(e,r){let n=e.failures[0],t=e.failures.flatMap(d=>d.browserMismatch==null?[]:[d.browserMismatch])[0],o=ao(e.failures.flatMap(d=>d.rules));if(n==null||t==null||o.length===0)return null;let i=lo(e.failures.find(d=>d.rules.length>0)?.label??n.label),s=[...new Set(o.map(d=>d.url))].join(", "),a=p.dim(`(${n.runWorkflow})`);return[`${p.bad("\u2717")} ${i} ${p.warn("(wrong page)")} ${a}`,` ${p.dim("rule learned for url")} ${s}`,` ${p.dim("browser was actually at")} ${t.actual}`,` ${p.warn("\u21B3 declare the navigation: add url.path`...` to the step that caused it")}`,` ${p.dim("frame")} npx ripplo snapshot ${r} --at ${String(n.snapshotAt)}`,""].join(`
|
|
315
|
+
`)}function ao(e){let r=e.map(n=>[td(n),n]);return[...new Map(r).values()]}function td(e){return`${e.url}|${e.when}|${e.origins.map(r=>r.intent).join(",")}`}function lo(e){let r=Zl.find(n=>e.startsWith(n));return r==null?e:e.slice(r.length)}function od(e){let r=e.split(no);return r.length<2?e:r.slice(1).join(no)}function id(e){let r=ao(e.failures.flatMap(n=>n.rules));return r.length===0?[]:[...r.flatMap(n=>sd(n)),...dd(e,r)]}function sd(e){let r=e.origins.length===0?p.dim("origin not in lockfile"):e.origins.map(n=>ad(n)).join(", ");return[` ${p.dim(ld(e.provenance))}`,` ${p.dim("from")} ${r}`,` ${p.dim("at")} ${e.url} ${p.dim("\u2014 holds only when")} ${e.when}`]}function ad(e){if(e.sourcePath==null)return e.intent;let r=p.dim(`(${e.sourcePath})`);return`${e.intent} ${r}`}function ld(e){return e==="learned"?"learned \u2014 kept only the conditions these flows share":"inferred \u2014 from a flow that reaches this state"}function dd(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?[]:[` ${p.warn("\u21B3 learned from another flow \u2014 likely a fact scoped too broadly")}`]}function ud(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[` ${p.dim("waited")} up to ${r} (wait: ${e.wait})${n}`]}function cd(e){if(e.length===0)return[];let r=pd(e),n=e.flatMap(t=>md(t,r));return n.length===0?[]:[` ${p.dim("nearby")} ${n.join(" \xB7 ")}`]}function pd(e){let r=e.flatMap(n=>n.detail.kind==="span"&&n.detail.traceId!=null?[[n.detail.traceId,n.detail]]:[]);return new Map(r)}function md(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 ${Qe(t)}`;return[oo(n,`${Qe(n)}${o}`)]}return[oo(n,Qe(n))]}function Qe(e){return e.kind==="network"?`${e.method} ${String(e.status)} ${fd(e.url)}`:e.kind==="console"?`console.${e.level} ${to(e.text)}`:e.kind==="error"?`error ${to(e.message)}`:`span ${e.name} ${e.statusCode} ${String(Math.round(e.durationMs))}ms`}function fd(e){let r=e.split("?")[0]??e;return r.length>60?`\u2026${r.slice(-57)}`:r}function to(e){let r=e.replaceAll(/\s+/g," ").trim();return r.length>100?`${r.slice(0,97)}\u2026`:r}function oo(e,r){return gd(e)?p.bad(r):r}function gd(e){return e.kind==="network"?e.status>=400:e.kind==="console"?e.level==="error":e.kind==="error"||e.statusCode==="error"}function uo(e){return`Saved behavior.jsonl to ${e.path}`}function K(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 co({json:e,runId:r}){let n=await H(process.cwd(),r);n.isErr()&&(process.stderr.write(`${K(n.error)}
|
|
316
|
+
`),process.exit(1)),(await Xt(process.cwd(),r)).match(o=>{let i=e?JSON.stringify(o,null,2):io(o);process.stdout.write(`${i}
|
|
317
|
+
`)},o=>{process.stderr.write(`${so(o)}
|
|
318
|
+
`),process.exit(1)})}async function po({runId:e}){(await Se(process.cwd(),e)).match(n=>{process.stdout.write(`${uo(n)}
|
|
319
|
+
`)},n=>{process.stderr.write(`${K(n)}
|
|
320
|
+
`),process.exit(1)})}import{randomUUID as yd}from"crypto";import mo from"path";import{graphql as hd}from"gql.tada";import{err as X,ok as kd}from"neverthrow";async function fo(e,r,n){let t=b(e).match(g=>g,g=>g.kind);if(typeof t=="string")return X({detail:t,kind:"config"});let o=await $r(e);if(o.result.isErr())return X({kind:"compile-failed"});let i=await u({config:t,document:wd,variables:{id:r}}).catch(()=>null);if(i==null)return X({kind:"request-failed"});if(i.run==null)return X({kind:"not-found"});if(i.run.reproJson==null)return X({kind:"no-repro"});let s=qr.parse(JSON.parse(i.run.reproJson)),a=await ae(e,o.result.value),l=`replay-${yd()}`,d=ie({cacheDir:void 0,clientVersion:k(),debugDir:mo.join(e,".ripplo","debug"),headed:!1,writeOtlpPortFile:!1});try{let g=await Hr({capture:!0,lockfile:a,options:{baseUrl:t.appUrl,engineUrl:t.engineUrl,fixturesDir:mo.join(e,z),generate:vr,headed:!1,secret:t.webhookSecret},repro:s,runId:l,session:d,signal:n});return kd({outcome:g,replayRunId:l})}finally{await d.close()}}var wd=hd(`
|
|
321
321
|
query RunRepro($id: String!) {
|
|
322
322
|
run(id: $id) {
|
|
323
323
|
id
|
|
324
324
|
reproJson
|
|
325
325
|
}
|
|
326
326
|
}
|
|
327
|
-
`);function
|
|
328
|
-
Replay run ${r} \u2014 snapshot it, e.g. \`npx ripplo snapshot ${r} --offset <ms>\`.`}function
|
|
329
|
-
`),process.exit(
|
|
330
|
-
`),process.exit(1)})}import
|
|
331
|
-
`).filter(r=>r.length>0).flatMap(r=>{let n=
|
|
327
|
+
`);function go({outcome:e,replayRunId:r}){let n=bd(e);return e.kind!=="resolved"&&e.kind!=="still-fails"?n:`${n}
|
|
328
|
+
Replay run ${r} \u2014 snapshot it, e.g. \`npx ripplo snapshot ${r} --offset <ms>\`.`}function bd(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 yo(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."}}function ho(e){return e.kind==="resolved"}async function ko({runId:e}){(await fo(process.cwd(),e,new AbortController().signal)).match(n=>{process.stdout.write(`${go(n)}
|
|
329
|
+
`),process.exit(ho(n.outcome)?0:1)},n=>{process.stderr.write(`${yo(n)}
|
|
330
|
+
`),process.exit(1)})}import jo from"path";import{existsSync as Ad}from"fs";import{writeFile as $o}from"fs/promises";import Io from"path";import{err as Z,ok as jd}from"neverthrow";import{createRequire as vd}from"module";import{readFile as bo}from"fs/promises";import{fileURLToPath as xd}from"url";import{z as Y}from"zod";var Cd={height:800,width:1280};async function vo(e){let r=await bo(e,"utf8");return Sd(r).flatMap(n=>n.kind==="rrweb"?[n.event]:[])}function Sd(e){return e.split(`
|
|
331
|
+
`).filter(r=>r.length>0).flatMap(r=>{let n=F(r);return n==null?[]:[n]})}var Rd=Y.object({data:Y.looseObject({height:Y.number(),width:Y.number()}),type:Y.literal(4)});function xo(e){let r=e.flatMap(n=>{let t=Rd.safeParse(n);return t.success?[t.data]:[]})[0];return r==null?Cd:{height:r.data.height,width:r.data.width}}var Pd='<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>',Ed=`.replayer-mouse-tail { display: none; }
|
|
332
332
|
.replayer-mouse {
|
|
333
333
|
position: absolute;
|
|
334
334
|
width: 17px;
|
|
@@ -336,28 +336,28 @@ Replay run ${r} \u2014 snapshot it, e.g. \`npx ripplo snapshot ${r} --offset <ms
|
|
|
336
336
|
z-index: 9999;
|
|
337
337
|
background-repeat: no-repeat;
|
|
338
338
|
background-size: contain;
|
|
339
|
-
background-image: url('data:image/svg+xml;utf8,${
|
|
340
|
-
}
|
|
339
|
+
background-image: url('data:image/svg+xml;utf8,${Pd}');
|
|
340
|
+
}`,$d=".replayer-mouse, .replayer-mouse-tail { display: none; }";function Co(e){return`<!doctype html><html><head><style>
|
|
341
341
|
html, body { margin: 0; padding: 0; }
|
|
342
342
|
.replayer-wrapper { position: relative; }
|
|
343
|
-
${e?
|
|
343
|
+
${e?Ed:$d}
|
|
344
344
|
iframe { border: none; }
|
|
345
|
-
</style></head><body></body></html>`}var
|
|
345
|
+
</style></head><body></body></html>`}var So="*, *::before, *::after { animation-duration: 0s !important; animation-delay: 0s !important; transition-duration: 0s !important; transition-delay: 0s !important; }";function Ro(){return`(async () => {
|
|
346
346
|
const doc = document.querySelector(".replayer-wrapper iframe")?.contentDocument;
|
|
347
347
|
if (doc?.fonts != null) {
|
|
348
348
|
await doc.fonts.ready;
|
|
349
349
|
}
|
|
350
350
|
await new Promise((resolve) => requestAnimationFrame(() => requestAnimationFrame(resolve)));
|
|
351
|
-
})()`}function
|
|
351
|
+
})()`}function Po(){return import("playwright").then(({chromium:e})=>e.launch({args:["--no-sandbox"],headless:!0})).catch(()=>null)}var wo;function Eo(){return wo??=bo(Id(),"utf8"),wo}function Id(){let e=vd(import.meta.url);try{return e.resolve("@ripplo/rrweb-bundle/replay")}catch{return xd(new URL("assets/rrweb-replay.js",import.meta.url))}}async function Ao({jsonlPath:e,moment:r,outDir:n,runId:t}){if(!Ad(e))return Z({kind:"run-not-found",runId:t});let o=await vo(e),i=o[0],s=o.at(-1);if(i==null||s==null)return Z({kind:"no-rrweb-events",runId:t});let a=s.timestamp-i.timestamp,l=r.kind==="offset"?r.offsetMs:r.at-i.timestamp;if(l<0)return Z({durationMs:a,firstTimestamp:i.timestamp,kind:"moment-out-of-range",lastTimestamp:s.timestamp,moment:r});let d=Math.min(l,a),g=String(Math.round(d)),y=Io.join(n,`snapshot-${g}ms.png`),c=Io.join(n,`snapshot-${g}ms.html`);return(await Td({events:o,htmlPath:c,offsetMs:d,pngPath:y})).map(()=>({durationMs:a,htmlPath:c,offsetMs:d,pngPath:y}))}async function Td({events:e,htmlPath:r,offsetMs:n,pngPath:t}){let o=await Po();if(o==null)return Z({detail:"chromium launch",kind:"browser-failed"});try{let{html:i,png:s}=await Md({browser:o,events:e,offsetMs:n});return await $o(t,s),await $o(r,i,"utf8"),jd(void 0)}catch(i){return Z({detail:i instanceof Error?i.message:String(i),kind:"browser-failed"})}finally{await o.close()}}async function Md({browser:e,events:r,offsetMs:n}){let t=xo(r),o=await e.newPage({viewport:t});await o.setContent(Co(!1)),await o.addScriptTag({content:await Eo()}),await o.evaluate(Ld({events:r,offsetMs:n})),await o.evaluate(Ro());let i=o.locator(".replayer-wrapper iframe").first(),a=await(await i.count()>0?i:o).screenshot({type:"png"});return{html:await o.evaluate(Nd()),png:a}}function Ld({events:e,offsetMs:r}){return`(() => {
|
|
352
352
|
const replayer = new globalThis.__RipploReplayer(${JSON.stringify(e)}, {
|
|
353
|
-
insertStyleRules: [${JSON.stringify(
|
|
353
|
+
insertStyleRules: [${JSON.stringify(So)}],
|
|
354
354
|
mouseTail: false,
|
|
355
355
|
root: document.body,
|
|
356
356
|
showWarning: false,
|
|
357
357
|
});
|
|
358
358
|
replayer.pause(${String(r+.5)});
|
|
359
359
|
globalThis.__ripploSnapshotReplayer = replayer;
|
|
360
|
-
})()`}function
|
|
360
|
+
})()`}function Nd(){return`(() => {
|
|
361
361
|
const replayer = globalThis.__ripploSnapshotReplayer;
|
|
362
362
|
if (replayer == null) {
|
|
363
363
|
return "";
|
|
@@ -375,43 +375,43 @@ iframe { border: none; }
|
|
|
375
375
|
}
|
|
376
376
|
});
|
|
377
377
|
return "<!doctype html>\\n" + doc.documentElement.outerHTML;
|
|
378
|
-
})()`}function
|
|
379
|
-
`)}function
|
|
380
|
-
`),process.exit(1));let o=await
|
|
381
|
-
`),process.exit(1)),(await
|
|
382
|
-
`)},s=>{process.stderr.write(`${
|
|
383
|
-
`),process.exit(1)})}function
|
|
378
|
+
})()`}function To({cwd:e,moment:r,runId:n}){let t=jo.join(e,".ripplo","debug",n);return Ao({jsonlPath:jo.join(t,"behavior.jsonl"),moment:r,outDir:t,runId:n})}function Mo(e){return[`${p.good("ok")} \u2014 rendered the page at ${String(Math.round(e.offsetMs))}ms into the recording (duration ${String(Math.round(e.durationMs))}ms)`,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(`
|
|
379
|
+
`)}function Lo(e){return`${p.bad("fail")} \u2014 ${Od(e)}`}function No(){return`${p.bad("fail")} \u2014 pass exactly one of --at <epoch-ms from behavior.jsonl> or --offset <ms from the start of the recording>.`}function Od(e){switch(e.kind){case"run-not-found":return`no debug artifacts for run ${e.runId} (.ripplo/debug/${e.runId}/behavior.jsonl missing). ${x("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 Oo({at:e,offset:r,runId:n}){let t=_d({at:e,offset:r});t==null&&(process.stderr.write(`${No()}
|
|
380
|
+
`),process.exit(1));let o=await H(process.cwd(),n);o.isErr()&&(process.stderr.write(`${K(o.error)}
|
|
381
|
+
`),process.exit(1)),(await To({cwd:process.cwd(),moment:t,runId:n})).match(s=>{process.stdout.write(`${Mo(s)}
|
|
382
|
+
`)},s=>{process.stderr.write(`${Lo(s)}
|
|
383
|
+
`),process.exit(1)})}function _d({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 _o(e,r){switch(e.kind){case"config-failed":return w(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: ${Lr(e.error)}`;case"done":return Fd(e.result,r)}}function Fo(e){return e.kind==="done"&&e.result.kind==="handed-over"}function Wo(e,r){return`landed at step ${String(e)} of ${r} \u2014 close the window to tear down`}function Fd(e,r){return e.kind==="failed"?`couldn't reach the step \u2014 the run failed first.
|
|
384
384
|
|
|
385
|
-
${e.findings.map(t=>
|
|
385
|
+
${e.findings.map(t=>Dr({evidencePath:void 0,finding:t})).join(`
|
|
386
386
|
|
|
387
|
-
`)}`:`torn down \u2014 teleport session for ${r} ended`}async function
|
|
388
|
-
`)},o=await
|
|
389
|
-
`),process.exit(
|
|
390
|
-
`)}async function
|
|
391
|
-
`),process.exit(
|
|
392
|
-
`)}import{existsSync as
|
|
393
|
-
`)}function
|
|
394
|
-
`),process.exit(
|
|
387
|
+
`)}`:`torn down \u2014 teleport session for ${r} ended`}async function Do({ref:e,step:r}){let n=new AbortController;process.once("SIGINT",()=>{n.abort()});let t=()=>{process.stdout.write(`${Wo(r,e)}
|
|
388
|
+
`)},o=await Pn({cwd:process.cwd(),onReady:t,signal:n.signal,step:r,target:{kind:"test",ref:e}});process.stdout.write(`${_o(o,e)}
|
|
389
|
+
`),process.exit(Fo(o)?0:1)}import Uo from"path";import{randomUUID as Wd}from"crypto";async function qo({cwd:e,onReady:r,signal:n}){let t=b(e).match(s=>s,s=>s.kind);if(typeof t=="string")return{detail:t,kind:"config-failed"};let o=`capture-${Wd()}`;return(await Br({clientVersion:k(),debugDir:Uo.join(t.cwd,".ripplo","debug"),onReady:r,profileDir:Uo.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 Bo(){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 Vo(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.":Dd(e.behaviorPath,e.runId)}function Ho(e){return e.kind==="done"}function Dd(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(`
|
|
390
|
+
`)}async function Ko(){let e=new AbortController;process.once("SIGINT",()=>{e.abort()});let r=await qo({cwd:process.cwd(),onReady:Ud,signal:e.signal});process.stdout.write(`${Vo(r)}
|
|
391
|
+
`),process.exit(Ho(r)?0:1)}function Ud(){process.stdout.write(`${Bo()}
|
|
392
|
+
`)}import{existsSync as qd,readFileSync as Bd}from"fs";import Vd from"path";function Go(e,r){let n=Vd.join(e,".ripplo","debug",r,"behavior.jsonl");return qd(n)?{actions:Vr(Bd(n,{encoding:"utf8"})),kind:"ok"}:{kind:"not-found",runId:r}}function zo(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)=>Hd(r,n)).join(`
|
|
393
|
+
`)}function Jo(e){return e.kind==="ok"}function Hd(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 Qo({runId:e}){let r=Go(process.cwd(),e);process.stdout.write(`${zo(r)}
|
|
394
|
+
`),process.exit(Jo(r)?0:1)}async function Xo(){let e=f();try{let n=(await J(e.cwd,e)).match(i=>i,i=>{process.stderr.write(`${w(i)}
|
|
395
395
|
`),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}
|
|
396
396
|
`)}catch(r){let n=r instanceof Error?r.message:String(r);process.stderr.write(`ripplo sync failed: ${n}
|
|
397
|
-
`),process.stderr.write(`${
|
|
398
|
-
`),process.exit(1)}}import{spawnSync as
|
|
399
|
-
`),n==null&&(process.stderr.write(`${
|
|
400
|
-
`),process.exit(1)),
|
|
401
|
-
`),process.stdout.write(`${Xe(
|
|
402
|
-
`),process.exit(0));let t=r==null?"global":
|
|
403
|
-
`),await
|
|
404
|
-
`)}function
|
|
405
|
-
`),process.exit(0)),r==="npx"){let n=
|
|
406
|
-
`);return}
|
|
407
|
-
`),process.exit(1)}process.stdout.write(`${
|
|
408
|
-
`)}async function
|
|
409
|
-
`)}async function
|
|
410
|
-
`),n.kind!=="timeout"}function
|
|
411
|
-
`)}function
|
|
412
|
-
`),process.exit(1)});(e==null?await
|
|
413
|
-
`)},t=>{process.stderr.write(`${
|
|
414
|
-
`),process.exit(1)})}import{graphql as
|
|
397
|
+
`),process.stderr.write(`${x("setup","verify auth + server reachability")}
|
|
398
|
+
`),process.exit(1)}}import{spawnSync as zd}from"child_process";import Jd from"fs";import Qd from"path";import Xd from"semver";import Re from"fs";import Kd from"os";import ee from"path";function Yo(e){return e.split(ee.sep).includes("_npx")?"npx":e.includes(ee.join("packages","cli"))?"workspace":"global"}function Zo(){let e=ee.join(Kd.homedir(),".npm","_npx");return Re.existsSync(e)?Re.readdirSync(e).map(r=>ee.join(e,r)).filter(r=>Re.existsSync(ee.join(r,"node_modules","ripplo"))).map(r=>(Re.rmSync(r,{force:!0,recursive:!0}),r)):[]}import{spawnSync as ei}from"child_process";var Gd=["user","project","local"];function Xe(){return ei("claude",["--version"],{stdio:"ignore"}).error!=null?"claude-missing":Gd.find(n=>ei("claude",["plugin","update","ripplo","--scope",n],{stdio:"ignore"}).status===0)==null?"not-installed":"updated"}function ri(e){return`ripplo v${e} is already the latest version.`}function ni(e){return`ripplo v${e}: could not reach the npm registry to check for updates.`}function Ye({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 ti(){return"ripplo: this is a workspace build (packages/cli/dist) \u2014 update via git pull + `pnpm --filter ripplo build`."}function oi(e){return`ripplo: \`npm install -g ripplo@latest\` failed: ${e}`}function Ze(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 ii(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 Yd=1e4;async function si(){let e=k(),r=process.argv[1];Zd(process.cwd());let n=await fe(Yd);process.stdout.write(`${pe({current:e,latest:n})}
|
|
399
|
+
`),n==null&&(process.stderr.write(`${ni(e)}
|
|
400
|
+
`),process.exit(1)),Xd.gt(n,e)||(process.stdout.write(`${ri(e)}
|
|
401
|
+
`),process.stdout.write(`${Ze(Xe())}
|
|
402
|
+
`),process.exit(0));let t=r==null?"global":Yo(r);eu({latest:n,mode:t}),process.stdout.write(`${Ze(Xe())}
|
|
403
|
+
`),await nu(process.cwd()),process.exit(0)}function Zd(e){if(!Jd.existsSync(Qd.join(e,".ripplo")))return;let r=he(e);r==="written"&&process.stdout.write(`${ke(r).trim()}
|
|
404
|
+
`)}function eu({latest:e,mode:r}){if(r==="workspace"&&(process.stdout.write(`${ti()}
|
|
405
|
+
`),process.exit(0)),r==="npx"){let n=Zo();process.stdout.write(`${Ye({evicted:n.length,latest:e,mode:r})}
|
|
406
|
+
`);return}ru(e)}function ru(e){let r=`ripplo@${e}`,n=zd("npm",["install","-g",r],{stdio:"inherit"});if(n.status!==0){let t=`exit ${String(n.status)}`;process.stderr.write(`${oi(t)}
|
|
407
|
+
`),process.exit(1)}process.stdout.write(`${Ye({evicted:0,latest:e,mode:"global"})}
|
|
408
|
+
`)}async function nu(e){if((await an(e)).kind==="not-running")return;let n=await sn(e);process.stdout.write(`${ii(n)}
|
|
409
|
+
`)}async function ai({action:e}){if(e==="status"){let{statusCommand:n}=await import("./status-247DEYFK.js");await n({format:"summary"});return}if(e==="stop"||e==="restart"){let n=await tu();(e==="stop"||!n)&&process.exit(n?0:1)}ou();let{runDaemon:r}=await import("./daemon-AS6IHTHD.js");await r()}async function tu(){let{stopDevDaemon:e}=await import("./daemon-lock-LTQMLU4Q.js"),{renderDaemonStopResult:r}=await import("./daemon-3J3K4BOD.js"),n=await e(process.cwd());return process.stdout.write(`${r(n)}
|
|
410
|
+
`),n.kind!=="timeout"}function ou(){let e=be(de());e!=null&&process.stderr.write(`${e}
|
|
411
|
+
`)}function li(e){return`executor: ${e}`}function di(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 ui(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 ci({mode:e}){let r=b(process.cwd()).match(t=>t,t=>{process.stderr.write(`${w(t)}
|
|
412
|
+
`),process.exit(1)});(e==null?await In(r):await An(r,e)).match(t=>{process.stdout.write(`${e==null?li(t):di(t)}
|
|
413
|
+
`)},t=>{process.stderr.write(`${ui(t)}
|
|
414
|
+
`),process.exit(1)})}import{graphql as pi}from"gql.tada";import{err as er,ok as rr}from"neverthrow";var iu=pi(`
|
|
415
415
|
query ExploreState($devSessionId: String!) {
|
|
416
416
|
exploration(devSessionId: $devSessionId) {
|
|
417
417
|
active
|
|
@@ -420,7 +420,7 @@ ${e.findings.map(t=>Fr({evidencePath:void 0,finding:t})).join(`
|
|
|
420
420
|
maxTrailLength
|
|
421
421
|
}
|
|
422
422
|
}
|
|
423
|
-
`),
|
|
423
|
+
`),su=pi(`
|
|
424
424
|
mutation SetExploration(
|
|
425
425
|
$devSessionId: String!
|
|
426
426
|
$active: Boolean!
|
|
@@ -441,11 +441,11 @@ ${e.findings.map(t=>Fr({evidencePath:void 0,finding:t})).join(`
|
|
|
441
441
|
maxTrailLength
|
|
442
442
|
}
|
|
443
443
|
}
|
|
444
|
-
`);async function
|
|
445
|
-
`),process.exit(1)});(e==null?await
|
|
446
|
-
`)},i=>{process.stderr.write(`${
|
|
447
|
-
`),process.exit(1)})}import{graphql as
|
|
448
|
-
`)}import{graphql as
|
|
444
|
+
`);async function mi(e){let r=await gi(e);if(r.isErr())return er(r.error);let n=await yi(e,r.value.id);return rr(hi(r.value.executor,n))}async function fi(e,r){let n=await gi(e);if(n.isErr())return er(n.error);let t=await yi(e,n.value.id),o=au(n.value.executor,t,r),i=await u({config:e,document:su,variables:{devSessionId:n.value.id,...o}});return rr(hi(n.value.executor,i.setExploration))}async function gi(e){let r=await Xr(e);return r.kind==="active"?rr({executor:r.executor,id:r.id}):er({kind:r.kind==="starting"?"starting":"no-session"})}async function yi(e,r){return(await u({config:e,document:iu,variables:{devSessionId:r}})).exploration??null}function hi(e,r){let n=e==="local";return{active:r?.active??!1,executor:e,maxTrailLength:r?.maxTrailLength??Fe,workers:(n?r?.localWorkers:r?.cloudWorkers)??0}}function au(e,r,n){let t=e==="local",o=(t?r?.localWorkers:r?.cloudWorkers)??0,i=(t?r?.cloudWorkers:r?.localWorkers)??0,s=lu(n,o);return{active:n.active,cloudWorkers:t?i:s,localWorkers:t?s:i,maxTrailLength:n.trail??r?.maxTrailLength??Fe}}function lu(e,r){return e.active?e.workers!=null?e.workers:r>0?r:$n:r}function ki(e){return e.active?`explorer: on | ${String(e.workers)} workers | trail ${String(e.maxTrailLength)} | ${e.executor}`:"explorer: off"}function wi(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 bi(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 vi({state:e,trail:r,workers:n}){let t=b(process.cwd()).match(i=>i,i=>{process.stderr.write(`${w(i)}
|
|
445
|
+
`),process.exit(1)});(e==null?await mi(t):await fi(t,{active:e==="on",trail:r,workers:n})).match(i=>{process.stdout.write(`${e==null?ki(i):wi(i)}
|
|
446
|
+
`)},i=>{process.stderr.write(`${bi(i)}
|
|
447
|
+
`),process.exit(1)})}import{graphql as Pe}from"gql.tada";function xi(){return"No scope items added \u2014 matched tests already in scope (`npx ripplo scope status`)."}function Ci(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`.",x("create")].join(`
|
|
448
|
+
`)}import{graphql as du}from"gql.tada";var Si=du(`
|
|
449
449
|
query ScopeStatus($projectId: String!, $cwd: String!) {
|
|
450
450
|
project(id: $projectId) {
|
|
451
451
|
id
|
|
@@ -465,7 +465,7 @@ ${e.findings.map(t=>Fr({evidencePath:void 0,finding:t})).join(`
|
|
|
465
465
|
}
|
|
466
466
|
}
|
|
467
467
|
}
|
|
468
|
-
`);var
|
|
468
|
+
`);var uu=Pe(`
|
|
469
469
|
query ScopeWorkflowBySlug($projectId: String!, $cwd: String!, $slug: String!) {
|
|
470
470
|
project(id: $projectId) {
|
|
471
471
|
id
|
|
@@ -478,7 +478,7 @@ ${e.findings.map(t=>Fr({evidencePath:void 0,finding:t})).join(`
|
|
|
478
478
|
}
|
|
479
479
|
}
|
|
480
480
|
}
|
|
481
|
-
`),
|
|
481
|
+
`),cu=Pe(`
|
|
482
482
|
mutation ScopeAddDirtyTests($projectId: String!, $cwd: String!, $workflowSlugs: [String!]!) {
|
|
483
483
|
addDirtyTestsToScope(projectId: $projectId, cwd: $cwd, workflowSlugs: $workflowSlugs) {
|
|
484
484
|
__typename
|
|
@@ -500,31 +500,31 @@ ${e.findings.map(t=>Fr({evidencePath:void 0,finding:t})).join(`
|
|
|
500
500
|
}
|
|
501
501
|
}
|
|
502
502
|
}
|
|
503
|
-
`),
|
|
503
|
+
`),pu=Pe(`
|
|
504
504
|
mutation ScopeLink($id: ID!, $workflowId: String!) {
|
|
505
505
|
linkScopeItem(id: $id, workflowId: $workflowId) {
|
|
506
506
|
id
|
|
507
507
|
}
|
|
508
508
|
}
|
|
509
|
-
`),
|
|
509
|
+
`),mu=Pe(`
|
|
510
510
|
mutation ScopeRemoveMany($ids: [ID!]!) {
|
|
511
511
|
removeScopeItems(ids: $ids)
|
|
512
512
|
}
|
|
513
|
-
`);async function
|
|
513
|
+
`);async function Ri(e){let r=f();await v(r);let t=(await u({config:r,document:Si,variables:{cwd:r.cwd,projectId:r.projectId}})).project?.devSession?.scopeItems??[];if(e.format==="json"){process.stdout.write(`${JSON.stringify(t,null,2)}
|
|
514
514
|
`);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??""}
|
|
515
515
|
`);return}let s=i.spec==null?"stub":"implemented";process.stdout.write(` [${s}] (${o.id}) ${i.slug} \u2014 ${i.name}
|
|
516
|
-
`)})}async function
|
|
517
|
-
`),process.exit(1)});let o=(await u({config:r,document:
|
|
518
|
-
`),process.exit(1)),o?.__typename==="UnknownWorkflowSlugsError"&&(process.stderr.write(`${
|
|
519
|
-
`),process.exit(1));let i=o?.__typename==="MutationAddDirtyTestsToScopeSuccess"?o.data:[];if(i.length===0){process.stdout.write(`${
|
|
516
|
+
`)})}async function Pi({testIds:e}){let r=f();await v(r),(await J(r.cwd,r)).match(()=>{},a=>{process.stderr.write(`${w(a)}
|
|
517
|
+
`),process.exit(1)});let o=(await u({config:r,document:cu,variables:{cwd:r.cwd,projectId:r.projectId,workflowSlugs:e.map(a=>Sr(a))}})).addDirtyTestsToScope;o?.__typename==="NoActiveDevSessionError"&&(process.stderr.write(`${o.message}
|
|
518
|
+
`),process.exit(1)),o?.__typename==="UnknownWorkflowSlugsError"&&(process.stderr.write(`${Ci(o.slugs)}
|
|
519
|
+
`),process.exit(1));let i=o?.__typename==="MutationAddDirtyTestsToScopeSuccess"?o.data:[];if(i.length===0){process.stdout.write(`${xi()}
|
|
520
520
|
`);return}let s=i.map(a=>a.workflow?.slug??"?").join(", ");process.stdout.write(`Added ${R(i.length,"scope item")}: ${s}
|
|
521
|
-
`)}async function
|
|
522
|
-
`),process.exit(1)});let o=await
|
|
523
|
-
`)}async function
|
|
524
|
-
`)}async function
|
|
525
|
-
`),process.stderr.write(`${
|
|
526
|
-
`),process.exit(1)),t.id}import{graphql as A}from"gql.tada";import{print as
|
|
527
|
-
`).reduce((t,o)=>t!=null||o.length===0?t:
|
|
521
|
+
`)}async function Ei({id:e,testId:r}){let n=f();await v(n),(await J(n.cwd,n)).match(()=>{},i=>{process.stderr.write(`${w(i)}
|
|
522
|
+
`),process.exit(1)});let o=await fu({cfg:n,slug:r});await u({config:n,document:pu,variables:{id:e,workflowId:o}}),process.stdout.write(`Linked scope item ${e} to ${r}
|
|
523
|
+
`)}async function $i({ids:e}){let r=f();await v(r);let t=(await u({config:r,document:mu,variables:{ids:[...e]}})).removeScopeItems??0;process.stdout.write(`Removed ${R(t,"scope item")}
|
|
524
|
+
`)}async function fu({cfg:e,slug:r}){let t=(await u({config:e,document:uu,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.
|
|
525
|
+
`),process.stderr.write(`${x("create")}
|
|
526
|
+
`),process.exit(1)),t.id}import{graphql as A}from"gql.tada";import{print as Wi}from"graphql";import{createClient as Di}from"graphql-sse";import nr from"fs";import gu from"path";import{err as Ee,ok as yu}from"neverthrow";function Ai({cwd:e,rrwebId:r,runId:n}){let t=Ti(e,n);if(!nr.existsSync(t))return Ee({kind:"no-behavior"});let o=Oi(Ni(t,r));if(o==null)return Ee({kind:"not-found"});let i=or(o.node.type);return i===3?Ee({kind:"text-node",parentId:or(o.parent?.id)}):i!==2?Ee({kind:"non-element",nodeType:i??-1}):yu({tagName:$(o.node.tagName)})}function ji({cwd:e,rrwebId:r,runId:n}){let t=Ni(Ti(e,n),r);if(t==null)return null;let o=Oi(t);return o==null||or(o.node.type)!==2?null:hu(t)}function Ti(e,r){return gu.join(e,".ripplo","debug",r,"behavior.jsonl")}function hu(e){let r=e.at(-1)??{},n=ir(r.attributes)??{},t=$(r.tagName);return{ariaName:$(n["aria-label"]),role:$(n.role),selector:wu(e),tagName:t==null?null:t.toLowerCase(),testId:$(n["data-testid"]),text:Su(Cu(r))}}var ku=6;function wu(e){let r=Mi(e,e.length-1,ku);return r.length===0?null:r.join(" > ")}function Mi(e,r,n){let t=e[r];if(t==null||n<=0)return[];let o=bu(t);if(o!=null)return[o];let i=vu(t,e[r-1]);return r===0||n===1?[i]:[...Mi(e,r-1,n-1),i]}function bu(e){let r=ir(e.attributes)??{},n=$(r["data-testid"]);if(n!=null)return`[data-testid="${n}"]`;let t=$(r.id);return t!=null&&t.length>0?`#${t}`:null}function vu(e,r){let n=($(e.tagName)??"*").toLowerCase(),t=Li(r).filter(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 Li(e){let r=e?.childNodes;return Array.isArray(r)?r.filter(n=>$e(n)):[]}function Ni(e,r){return nr.existsSync(e)?nr.readFileSync(e,"utf8").split(`
|
|
527
|
+
`).reduce((t,o)=>t!=null||o.length===0?t:xu(o,r),null):null}function xu(e,r){let n=F(e);if(n?.kind!=="rrweb")return null;let t=ir(n.event.data),o=tr(t?.node,r);if(o!=null)return o;let i=t?.adds;return Array.isArray(i)?i.reduce((s,a)=>s??($e(a)?tr(a.node,r):null),null):null}function tr(e,r){if(!$e(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??tr(i,r),null);return t==null?null:[e,...t]}function Oi(e){let r=e?.at(-1);return r==null?null:{node:r,parent:e?.at(-2)}}var Ii=80;function Cu(e){let r=Li(e).filter(n=>n.type===3).map(n=>$(n.textContent)).filter(n=>n!=null);return r.length===0?null:r.join(" ")}function $(e){return typeof e=="string"?e:null}function Su(e){let r=e==null?"":e.replaceAll(/\s+/g," ").trim();return r.length===0?null:r.length>Ii?`${r.slice(0,Ii)}\u2026`:r}function ir(e){return $e(e)?e:void 0}function $e(e){return typeof e=="object"&&e!=null}function or(e){return typeof e=="number"?e:null}function sr(e,r){let n=r.flatMap(o=>Ru(e,o)),t=new Map(r.map(o=>[o.id,o.fingerprint]));return{changes:n,seen:t}}function Ru(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 Pu=A(`
|
|
528
528
|
query WorkList($projectId: String!, $cwd: String!) {
|
|
529
529
|
project(id: $projectId) {
|
|
530
530
|
id
|
|
@@ -542,7 +542,7 @@ ${e.findings.map(t=>Fr({evidencePath:void 0,finding:t})).join(`
|
|
|
542
542
|
}
|
|
543
543
|
}
|
|
544
544
|
}
|
|
545
|
-
`),
|
|
545
|
+
`),Eu=A(`
|
|
546
546
|
query WatchSeed($projectId: String!, $cwd: String!) {
|
|
547
547
|
project(id: $projectId) {
|
|
548
548
|
id
|
|
@@ -562,7 +562,7 @@ ${e.findings.map(t=>Fr({evidencePath:void 0,finding:t})).join(`
|
|
|
562
562
|
}
|
|
563
563
|
}
|
|
564
564
|
}
|
|
565
|
-
`),
|
|
565
|
+
`),Ui=A(`
|
|
566
566
|
subscription WatchTasks($devSessionId: String!) {
|
|
567
567
|
tasksChanged(devSessionId: $devSessionId) {
|
|
568
568
|
devSession {
|
|
@@ -581,7 +581,7 @@ ${e.findings.map(t=>Fr({evidencePath:void 0,finding:t})).join(`
|
|
|
581
581
|
}
|
|
582
582
|
}
|
|
583
583
|
}
|
|
584
|
-
`)
|
|
584
|
+
`),$u=A(`
|
|
585
585
|
query WorkShow($id: String!) {
|
|
586
586
|
task(id: $id) {
|
|
587
587
|
id
|
|
@@ -598,7 +598,7 @@ ${e.findings.map(t=>Fr({evidencePath:void 0,finding:t})).join(`
|
|
|
598
598
|
}
|
|
599
599
|
}
|
|
600
600
|
}
|
|
601
|
-
`)
|
|
601
|
+
`),Iu=A(`
|
|
602
602
|
mutation WorkComment(
|
|
603
603
|
$taskId: String!
|
|
604
604
|
$body: String!
|
|
@@ -624,7 +624,7 @@ ${e.findings.map(t=>Fr({evidencePath:void 0,finding:t})).join(`
|
|
|
624
624
|
}
|
|
625
625
|
}
|
|
626
626
|
}
|
|
627
|
-
`),
|
|
627
|
+
`),Au=A(`
|
|
628
628
|
mutation WorkResolve($taskId: String!, $runId: String!, $note: String, $authorName: String) {
|
|
629
629
|
agentResolveTask(taskId: $taskId, runId: $runId, note: $note, authorName: $authorName) {
|
|
630
630
|
__typename
|
|
@@ -636,7 +636,7 @@ ${e.findings.map(t=>Fr({evidencePath:void 0,finding:t})).join(`
|
|
|
636
636
|
}
|
|
637
637
|
}
|
|
638
638
|
}
|
|
639
|
-
`),
|
|
639
|
+
`),ju=A(`
|
|
640
640
|
mutation WorkStart($taskId: String!) {
|
|
641
641
|
agentStartTask(taskId: $taskId) {
|
|
642
642
|
__typename
|
|
@@ -649,7 +649,7 @@ ${e.findings.map(t=>Fr({evidencePath:void 0,finding:t})).join(`
|
|
|
649
649
|
}
|
|
650
650
|
}
|
|
651
651
|
}
|
|
652
|
-
`),
|
|
652
|
+
`),Tu=A(`
|
|
653
653
|
mutation WorkClarify($taskId: String!, $body: String!, $authorName: String) {
|
|
654
654
|
agentSetNeedsClarification(taskId: $taskId, body: $body, authorName: $authorName) {
|
|
655
655
|
__typename
|
|
@@ -661,7 +661,7 @@ ${e.findings.map(t=>Fr({evidencePath:void 0,finding:t})).join(`
|
|
|
661
661
|
}
|
|
662
662
|
}
|
|
663
663
|
}
|
|
664
|
-
`),
|
|
664
|
+
`),Mu=A(`
|
|
665
665
|
mutation WorkDismiss($taskId: String!, $note: String, $authorName: String) {
|
|
666
666
|
agentDismissTask(taskId: $taskId, note: $note, authorName: $authorName) {
|
|
667
667
|
__typename
|
|
@@ -676,21 +676,21 @@ ${e.findings.map(t=>Fr({evidencePath:void 0,finding:t})).join(`
|
|
|
676
676
|
}
|
|
677
677
|
}
|
|
678
678
|
}
|
|
679
|
-
`),
|
|
680
|
-
`);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(`${
|
|
681
|
-
`)}function
|
|
682
|
-
`)},next:o=>{let i=o.data?.tasksChanged?.devSession?.tasks??[],s=
|
|
683
|
-
`)}),t=s.seen}})}async function
|
|
679
|
+
`),Lu=18e4;async function qi(e){let r=f();await v(r);let n=await _i(r),t=n.items.some(o=>o.kind==="finding");if(e.wait&&!t&&n.devSessionId!=null){await Nu({cfg:r,devSessionId:n.devSessionId});let o=await _i(r);Fi(o.items,e.format);return}Fi(n.items,e.format)}async function _i(e){let n=(await u({config:e,document:Pu,variables:{cwd:e.cwd,projectId:e.projectId}})).project?.devSession;return{devSessionId:n?.id??null,items:n?.tasks??[]}}function Fi(e,r){if(r==="json"){process.stdout.write(`${JSON.stringify(e,null,2)}
|
|
680
|
+
`);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(`${jn(n)}
|
|
681
|
+
`)}function Nu({cfg:e,devSessionId:r}){let n=Di({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,Lu),o.dispose=n.subscribe({query:Wi(Ui),variables:{devSessionId:r}},{complete:i,error:()=>{i()},next:s=>{(s.data?.tasksChanged?.devSession?.tasks??[]).some(l=>l.kind==="finding")&&i()}})})}async function Bi(){let e=f();await v(e);let n=(await u({config:e,document:Eu,variables:{cwd:e.cwd,projectId:e.projectId}})).project?.devSession;if(n==null)throw new Error("dev session vanished between preflight and seed");let t=sr(new Map,Hi(n.tasks??[])),o=Di({headers:{Authorization:`Bearer ${e.token}`},retryAttempts:1/0,url:`${e.ripploServerUrl}/graphql`});Ou({devSessionId:n.id,seen:t.seen,sseClient:o}),await new Promise(()=>{})}function Ou({devSessionId:e,seen:r,sseClient:n}){let t=r;n.subscribe({query:Wi(Ui),variables:{devSessionId:e}},{complete:()=>{},error:o=>{process.stderr.write(`task watch error: ${String(o)}
|
|
682
|
+
`)},next:o=>{let i=o.data?.tasksChanged?.devSession?.tasks??[],s=sr(t,Hi(i));s.changes.forEach(a=>{process.stdout.write(`${Mn(a)}
|
|
683
|
+
`)}),t=s.seen}})}async function Vi(e){let r=f();await v(r);let t=(await u({config:r,document:$u,variables:{id:e.id}})).task;if(t==null&&(process.stderr.write(`${Ln(e.id)}
|
|
684
684
|
`),process.exit(1)),e.format==="json"){process.stdout.write(`${JSON.stringify(t,null,2)}
|
|
685
|
-
`);return}let o=[...new Set((t.messages??[]).flatMap(s=>s.runId==null?[]:[s.runId]))];await Promise.all(o.map(s=>
|
|
686
|
-
`)}function
|
|
687
|
-
`),process.exit(1))}let n=await u({config:r,document
|
|
688
|
-
`)}async function
|
|
689
|
-
`)}async function
|
|
690
|
-
`)}async function
|
|
691
|
-
`),process.exit(1));let r=
|
|
692
|
-
`)}async function
|
|
693
|
-
`),process.exit(1)),process.stdout.write(`${
|
|
694
|
-
`)}function
|
|
695
|
-
`),process.exit(1))}function
|
|
696
|
-
`),process.exit(1)});function
|
|
685
|
+
`);return}let o=[...new Set((t.messages??[]).flatMap(s=>s.runId==null?[]:[s.runId]))];await Promise.all(o.map(s=>H(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:ji({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(`${Tn(i)}
|
|
686
|
+
`)}function Hi(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 Ki(e){let r=f();if(await v(r),e.elementId!=null&&e.runId!=null){let t=Ai({cwd:r.cwd,rrwebId:e.elementId,runId:e.runId}).match(()=>null,o=>o);t!=null&&t.kind!=="no-behavior"&&(process.stderr.write(`${_u(t,e.elementId,e.runId)}
|
|
687
|
+
`),process.exit(1))}let n=await u({config:r,document:Iu,variables:{authorName:e.authorName??null,body:e.body,frameMs:e.offsetMs??null,rrwebId:e.elementId??null,runId:e.runId??null,taskId:e.id}});Ie(n.agentCommentOnTask),process.stdout.write(`${Nn(e.id)}
|
|
688
|
+
`)}async function Gi(e){let r=f();await v(r);let n=await u({config:r,document:Au,variables:{authorName:e.authorName??null,note:e.note??null,runId:e.runId,taskId:e.id}});Ie(n.agentResolveTask),process.stdout.write(`${Dn(e.id)}
|
|
689
|
+
`)}async function zi(e){let r=f();await v(r);let n=await u({config:r,document:ju,variables:{taskId:e.id}});Ie(n.agentStartTask),process.stdout.write(`${Un(e.id)}
|
|
690
|
+
`)}async function Ji(e){e.body.trim().length===0&&(process.stderr.write(`${On()}
|
|
691
|
+
`),process.exit(1));let r=f();await v(r);let n=await u({config:r,document:Tu,variables:{authorName:e.authorName??null,body:e.body,taskId:e.id}});Ie(n.agentSetNeedsClarification),process.stdout.write(`${qn(e.id)}
|
|
692
|
+
`)}async function Qi(e){let r=f();await v(r);let t=(await u({config:r,document:Mu,variables:{authorName:e.authorName??null,note:e.note??null,taskId:e.id}})).agentDismissTask;(t?.__typename==="FindingNotDismissableError"||t?.__typename==="NoActiveDevSessionError")&&(process.stderr.write(`${t.message}
|
|
693
|
+
`),process.exit(1)),process.stdout.write(`${Bn(e.id)}
|
|
694
|
+
`)}function Ie(e){e?.__typename==="NoActiveDevSessionError"&&(process.stderr.write(`${e.message}
|
|
695
|
+
`),process.exit(1))}function _u(e,r,n){return e.kind==="text-node"?_n(r,e.parentId):e.kind==="not-found"?Fn(r,n):Wn(r)}function Xi(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=>qi({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,()=>Bi()).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=>Vi({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=>Ki({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=>zi({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=>Gi({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=>Ji({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=>Qi({authorName:r.as,id:r.id,note:r.note})).demandCommand(1)}hr();G(process.cwd());fr();async function qu(){ne(k()),Rr({size:Math.max(1,Math.min(10,Fu()-2)),workerUrl:Gn()}),Wu({pkg:{name:"ripplo",version:k()}}).notify({message:zn()}),await Du(Uu(process.argv)).scriptName("ripplo").version(k()).command(Vu()).command(Hu()).command(Ku()).command(ec()).command("auth <subcommand>","Manage authentication",sc).command("projects <subcommand>","List or create Ripplo projects",ic).command("hooks <subcommand>","Pause or resume Ripplo hooks",oc).command(Ju()).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=>St({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`)",nc,e=>_t({all:e.all,headed:e.headed,ids:e.ids})).command(Xu()).command(rc()).command(Yu()).command(Zu()).command(Bu()).command(Qu()).command(Gu()).command(zu()).command("sync","Push the compiled .ripplo/ resources to the server (no run)",()=>{},()=>Xo()).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=>nt({check:e.check})).command("update","Update ripplo to the latest published version (and hand the daemon off to it)",()=>{},()=>si()).command("doctor","Check project health",()=>{},()=>pt()).command("status","Report stub tests and daemon status",e=>e.option("format",{choices:["json","summary"],default:"json",describe:"Output format"}),e=>En({format:e.format})).command("scope <subcommand>","Manage testing scope",tc).command("tasks <subcommand>","Manage tasks for this dev session",Xi).command("run-worker",!1,()=>{},()=>qt()).command("hook <name>","Internal: run a Claude Code plugin hook",e=>e.positional("name",{choices:Object.keys(Vn),demandOption:!0,type:"string"}),e=>Hn(e.name)).strict().help().parse(),Pr()}qu().catch(e=>{process.stderr.write(`${jr(e)}
|
|
696
|
+
`),process.exit(1)});function Bu(){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=>Lt({kind:e.kind,rootCause:e["root-cause"],runId:e.run,surfacedBy:e["surfaced-by"],title:e.title})}}function Vu(){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=>ai({action:e.action})}}function Hu(){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=>ci({mode:e.mode})}}function Ku(){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=>vi({state:e.state,trail:e.trail,workers:e.workers})}}function Gu(){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"}),handler:e=>co({json:e.json,runId:e.runId})}}function zu(){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=>ko({runId:e.runId})}}function Ju(){return{command:"setup",describe:"Install the Ripplo plugin for Claude Code and start a guided setup session",builder:e=>e,handler:()=>{Tt()}}}function Qu(){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=>po({runId:e.runId})}}function Xu(){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=>Oo({at:e.at,offset:e.offset,runId:e.runId})}}function Yu(){return{command:"capture",describe:"Open your signed-in browser, record a flow, and hand the log to Claude",builder:e=>e,handler:()=>Ko()}}function Zu(){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=>{Qo({runId:e.runId})}}}function ec(){return{command:"concurrency [value]",describe:"Show or set max local concurrent runs (daemon applies live)",builder:e=>e.positional("value",{type:"number"}),handler:e=>ot({value:e.value})}}function rc(){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=>Do({ref:e.ref,step:e.step})}}function nc(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 tc(e){return e.command("status","Print the current scope",r=>r.option("format",{choices:["json","text"],default:"text",describe:"Output format"}),r=>Ri({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=>Pi({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=>Ei({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=>$i({ids:r.ids})).demandCommand(1)}function oc(e){return e.command("pause","Disable all Ripplo pre-edit gates and stop enforcement until resumed",()=>{},()=>mt()).command("resume","Re-enable Ripplo hooks paused via `ripplo hooks pause`",()=>{},()=>ft()).demandCommand(1)}function ic(e){return e.command("list","List projects you have access to (JSON)",()=>{},()=>Et()).command("create <name>","Create a project (JSON)",r=>r.positional("name",{demandOption:!0,type:"string"}).option("org",{describe:"Organization id",type:"string"}),r=>$t({name:r.name,orgId:r.org})).demandCommand(1)}function sc(e){return e.command("login","Authenticate via device flow",()=>{},()=>Zn()).command("status","Show authentication status",()=>{},()=>et()).command("logout","Remove the saved token",()=>{},()=>{rt()}).demandCommand(1)}export{qu as main};
|