ripplo 0.15.1 → 0.15.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-XPOOWIRL.js → chunk-3BPQWAUL.js} +1 -1
- package/dist/{chunk-BTIQ5H3K.js → chunk-5RKZ44OU.js} +1 -1
- package/dist/{chunk-IRT6UHD3.js → chunk-BFAWQ5U2.js} +1 -1
- package/dist/chunk-BIB4JJKD.js +84 -0
- package/dist/chunk-HN55QF5N.js +405 -0
- package/dist/{chunk-ANAQCK5G.js → chunk-JQ2CRYVX.js} +1 -1
- package/dist/{chunk-QQ6VKZ6A.js → chunk-LCCJPRT5.js} +1 -1
- package/dist/{chunk-O4A5UISQ.js → chunk-Q2TF5WLS.js} +1 -1
- package/dist/{chunk-NUBMOTH6.js → chunk-QEE4CNMY.js} +1 -1
- package/dist/{chunk-5JXP37ET.js → chunk-RLB66SU3.js} +1 -1
- package/dist/{chunk-KL6TIUNF.js → chunk-TZPYILZK.js} +1 -1
- package/dist/{chunk-RXLDAR2J.js → chunk-VHFITVRX.js} +1 -1
- package/dist/{chunk-JPXTGKSB.js → chunk-W3CXPVVB.js} +2 -2
- package/dist/{chunk-EYILCSW6.js → chunk-WB3HHOCG.js} +1 -1
- package/dist/{chunk-QSKOYBDO.js → chunk-XA6BMQTW.js} +1 -1
- package/dist/{chunk-AUXGLJ3J.js → chunk-Y52M43LO.js} +1 -1
- package/dist/{chunk-EVEITUJH.js → chunk-YD4VBOBY.js} +1 -1
- package/dist/{chunk-5PICILBD.js → chunk-YRU6BOIP.js} +1 -1
- package/dist/{chunk-KOZTQJBB.js → chunk-ZSD6QDYB.js} +18 -18
- package/dist/{cli-error-7LCAN3Z5.js → cli-error-UYWIDE4L.js} +1 -1
- package/dist/{compile-write-Y5III4OM.js → compile-write-QNV2EA5B.js} +1 -1
- package/dist/daemon-D4UCHMHS.js +175 -0
- package/dist/{daemon-EITBDEP7.js → daemon-LZTY7W4M.js} +1 -1
- package/dist/{dsl-loader-ASNZDV7E.js → dsl-loader-G2CRA252.js} +1 -1
- package/dist/hook.js +1 -1
- package/dist/index.js +213 -192
- package/dist/{plan-reminder-6VWOS6HD.js → plan-reminder-EDDIUY43.js} +1 -1
- package/dist/{post-edit-A5Y26UH5.js → post-edit-4CM5P2G2.js} +1 -1
- package/dist/post-edit-analyze-HKOTNA2H.js +4 -0
- package/dist/{post-edit-flag-stubs-I43B5QPO.js → post-edit-flag-stubs-2HZMK4NQ.js} +1 -1
- package/dist/{pre-edit-HJVNM7U5.js → pre-edit-JZX36QX6.js} +1 -1
- package/dist/{pre-edit-watch-gate-G6BVWIDL.js → pre-edit-watch-gate-T2TWL66C.js} +1 -1
- package/dist/{prompt-submit-OXYVNXHK.js → prompt-submit-GVZHK3CI.js} +1 -1
- package/dist/status-CNSPYNYP.js +4 -0
- package/dist/{stop-enforce-BP6IIW3D.js → stop-enforce-NKKP2X4U.js} +1 -1
- package/package.json +4 -3
- package/dist/chunk-F4UCCW7Q.js +0 -83
- package/dist/chunk-IVW5DUE4.js +0 -360
- package/dist/daemon-6UYMYGPI.js +0 -175
- package/dist/post-edit-analyze-2SBNWX6Y.js +0 -4
- package/dist/status-XUIBJXNP.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 Tt}from"./chunk-Y52M43LO.js";import{B as dr,D as Ct,E as ee,G as Et,H as $t,I as Pt,N as It,O as At,P as jt,Q as Mt,T as Lt,U as cr,a as L,b as I,c as lt,d as dt,e as ct,f as ut,g as ar,h as pt,i as ft,j as gt,m as yt,n as ht,o as kt,p as wt,q as bt,r as vt,s as St,t as xt,v as Rt}from"./chunk-HN55QF5N.js";import{j as lr,k as mt}from"./chunk-Q2TF5WLS.js";import{a as Fn,b as Wn,d as Dn,e as _n,f as Un,g as Vn,h as qn,i as Bn,j as Hn,k as zn,l as Gn,m as Kn,n as Jn}from"./chunk-47LLHHJH.js";import{a as et,c as sr,d as rt,e as nt,f as tt,g as ot,h as xe}from"./chunk-YRU6BOIP.js";import{b as Qn,c as Zn,d as Xn,f as Yn}from"./chunk-TZPYILZK.js";import{b as Se,c as F}from"./chunk-JQ2CRYVX.js";import{a as st,b as S}from"./chunk-WB3HHOCG.js";import{b as ae,c as jn,e as be,f as Mn}from"./chunk-BFAWQ5U2.js";import{a as we,b as Nn,c as ve}from"./chunk-QEE4CNMY.js";import{a as M}from"./chunk-OQ6KNYPG.js";import{a as Y,b as Ln,c as ir,d as On}from"./chunk-VHFITVRX.js";import{a as C,b as Tn,c as y}from"./chunk-JS3DLVVI.js";import{a as _r,b as it,c as at}from"./chunk-W3CXPVVB.js";import{a as w}from"./chunk-R4ZTRVDQ.js";import{b as Ur,c as ie,d as Vr,e as qr}from"./chunk-FEHVIHVA.js";import{a as x}from"./chunk-MHNGR6M7.js";import"./chunk-KOKEEAEF.js";import{b as Pn,h as In,j as X,m as An}from"./chunk-5RKZ44OU.js";import{$ as En,D as kn,E as wn,H as or,N as he,R as bn,S as vn,U as Sn,W as xn,X as Rn,Z as Cn,_ as ke,ca as $n,e as Q,f as u,g as mn,h as fn,m as tr,o as Z,p as gn,q as yn,s as hn}from"./chunk-BIB4JJKD.js";import{f as se,i as pn,j as J,l as ge,m as ye}from"./chunk-RLB66SU3.js";import{$ as q,Ia as dn,Ma as cn,Na as un,U as tn,V as N,Z as K,_ as on,ca as sn,ea as an,sa as j,t as nn,ta as ln}from"./chunk-ZSD6QDYB.js";import{a as rn}from"./chunk-7WZ3VIUU.js";import{b as en,e as nr}from"./chunk-KH4QH23U.js";import"./chunk-RIASQHPG.js";import{a as Br,b as Hr,c as zr,d,f as G,g as Gr,i as Kr,k as P,l as Jr,m as Qr,n as rr,o as Zr,p as Xr,q as Yr}from"./chunk-C7SV6AR2.js";import{b as fe}from"./chunk-HEOMRXZE.js";import"./chunk-NNH3YVVO.js";import"./chunk-KMZ3L5YA.js";import Kp from"update-notifier";import Jp from"yargs";import{hideBin as Qp}from"yargs/helpers";function Re({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 Ot(){return"Update available {currentVersion} \u2192 {latestVersion}\nRun `npx ripplo update`"}import{graphql as ta}from"gql.tada";import{exec as Ks}from"child_process";import{createAuthClient as zs}from"better-auth/client";import{deviceAuthorizationClient as Gs}from"better-auth/client/plugins";function Nt({baseURL:e}){return zs({baseURL:e,fetchOptions:{headers:{"User-Agent":"Ripplo CLI"}},plugins:[Gs()]})}import{err as Ft,ok as Js}from"neverthrow";var Qs=5e3,Wt="ripplo-cli";async function Dt({onDeviceCode:e,url:r}){let n=r??Tn().RIPPLO_SERVER_URL,t=Nt({baseURL:n}),o=await t.device.code({client_id:Wt});if(o.error!=null)return Ft({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}),na(a),(await Zs({authClient:t,deviceCode:i})).map(c=>(Jr({serverUrl:n,token:c}),c))}async function Zs({authClient:e,deviceCode:r}){for(;;){await ea(Qs);let n=await e.device.token({client_id:Wt,device_code:r,grant_type:"urn:ietf:params:oauth:grant-type:device_code"});if(n.data?.access_token!=null)return Js(n.data.access_token);if(n.error==null)continue;if(!Ys(n.error.error))return Ft({code:n.error.error,description:n.error.error_description,kind:"oauth-authorization-failed"})}}var Xs=new Set(["authorization_pending","slow_down"]);function Ys(e){return Xs.has(e)}function ea(e){return new Promise(r=>{setTimeout(r,e)})}function ra(){return process.platform==="darwin"?"open":process.platform==="win32"?"start":"xdg-open"}function na(e){let r=ra();Ks(`${r} "${e}"`,()=>{})}var oa=ta(`
|
|
5
5
|
query AuthViewer {
|
|
6
6
|
currentUser {
|
|
7
7
|
name
|
|
8
8
|
email
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
|
-
`);async function
|
|
11
|
+
`);async function _t(){let e=C(),r=P(e);if(r!=null&&await ia(e,r))return;let t=(await Dt({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(`${S(a)}
|
|
17
|
-
`),process.exit(1)})
|
|
18
|
-
`),process.stdout.write(o.kind==="ok"?`${s}, ${
|
|
17
|
+
`),process.exit(1)});await I("cli_login_completed");let o=await ur({serverUrl:e,token:t}),i=rn(process.cwd()),s=i?"Welcome back":"Welcome to Ripplo";process.stdout.write(`
|
|
18
|
+
`),process.stdout.write(o.kind==="ok"?`${s}, ${sa(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 ${rr(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 ia(e,r){let n=await ur({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 Ut(){let e=C(),r=P(e);r==null&&(process.stdout.write("Not signed in. Run `npx ripplo auth login`.\n"),process.exit(1));let n=await ur({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 Vt(){let e=C();if(!Qr(e)){process.stdout.write(`Already signed out.
|
|
29
|
+
`);return}process.stdout.write(`Signed out. Removed ${rr(e)}.
|
|
30
|
+
`)}async function ur({serverUrl:e,token:r}){try{let t=(await d({config:L({serverUrl:e,token:r}),document:oa,variables:void 0})).currentUser;return t==null?{kind:"rejected"}:{kind:"ok",viewer:{email:t.email,name:t.name}}}catch(n){return zr(n)==="UNAUTHENTICATED"?{kind:"rejected"}:{kind:"unreachable",message:n instanceof Error?n.message:String(n)}}}function sa(e){let r=e.name.trim().split(/\s+/)[0];return r!=null&&r.length>0?r:e.email}import{readFile as aa,writeFile as la}from"fs/promises";import da from"path";async function qt(e){let r=process.cwd(),n=await ye(r);n.isErr()&&Ce(Y(n.error));let t=n.value,o=we({cwd:r,lockfile:t});o.length>0&&Ce(ve(o));let i=await X(r,t),s=tn(j,i),a=da.join(r,J);if(e.check){await ca(a,i);return}await la(a,s),pn(r,s),await I("compile_succeeded"),pa(i)}function Ce(e){process.stderr.write(`${e}
|
|
31
|
+
`),process.exit(1)}async function ca(e,r){let n=await aa(e,"utf8").catch(()=>null);n==null&&Ce(ir("missing")),ua(n,r)||Ce(ir("stale")),process.stdout.write(`${Ln()}
|
|
32
|
+
`)}function ua(e,r){try{let n=N(j,e);return n.checks==null?!1:Pn(n,r)}catch{return!1}}function pa(e){let r=e.workflows.reduce((t,o)=>t+o.tests.length,0),n=[On(),Nn(r)];process.stdout.write(`${n.join(`
|
|
33
33
|
`)}
|
|
34
|
-
`)}import{graphql as
|
|
34
|
+
`)}import{graphql as Bt}from"gql.tada";function pr(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 ma}from"gql.tada";var fa=ma(`
|
|
35
35
|
query DevSessionCheckPreflight($projectId: String!, $cwd: String!) {
|
|
36
36
|
project(id: $projectId) {
|
|
37
37
|
id
|
|
@@ -41,68 +41,68 @@ import{a as bt}from"./chunk-AUXGLJ3J.js";import{B as ft,C as Q,E as gt,F as yt,G
|
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
`);function b(){return y(process.cwd()).match(e=>e,e=>{process.stderr.write(`${S(e)}
|
|
44
|
-
`),process.stderr.write(`${
|
|
45
|
-
`),process.exit(1)})}async function
|
|
46
|
-
`),process.exit(1))}var
|
|
44
|
+
`),process.stderr.write(`${x("setup")}
|
|
45
|
+
`),process.exit(1)})}async function R(e){(await d({config:e,document:fa,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 ga=Bt(`
|
|
47
47
|
mutation CliUpdateMaxLocalConcurrentRuns($value: Int!) {
|
|
48
48
|
updateMaxLocalConcurrentRuns(value: $value) {
|
|
49
49
|
id
|
|
50
50
|
maxLocalConcurrentRuns
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
|
-
`),
|
|
53
|
+
`),ya=Bt(`
|
|
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 d({config:r,document:
|
|
62
|
-
`)}function
|
|
60
|
+
`);async function Ht({value:e}){let r=b();if(e==null){let t=await d({config:r,document:ya,variables:{}});process.stdout.write(`${pr(t.currentUser?.maxLocalConcurrentRuns)}
|
|
61
|
+
`);return}let n=await d({config:r,document:ga,variables:{value:e}});process.stdout.write(`${pr(n.updateMaxLocalConcurrentRuns?.maxLocalConcurrentRuns)}
|
|
62
|
+
`)}function zt(e){return e.status==="match"?"\u2713 Webhook secret: your app and Ripplo agree":e.status==="missing-local"?"! Webhook secret: RIPPLO_WEBHOOK_SECRET is not set \u2014 the engine adapter needs it to verify Ripplo's calls":e.status==="unknown"?"! Webhook secret: could not read this project's secret from Ripplo, so a mismatch would not be caught here":`\u2717 Webhook secret: RIPPLO_WEBHOOK_SECRET does not match the secret Ripplo holds for this project (${ha(e)}). Local runs still pass because your app verifies against the same local value, but cloud runs will be rejected. Copy the secret from the project settings into your env file.`}function ha(e){let r=e.localFingerprint??"unset",n=e.serverFingerprint??"unknown";return`yours ${r}, Ripplo's ${n}`}function Gt(e){switch(e.type){case"settings":return ka(e);case"env-files":return wa(e);case"token":return ba(e);case"dev-server":return va(e);case"dev-session":return dt(e);case"state-sources":return Sa(e);case"webhook-verification":return xa(e);case"model-validation":return Ra(e);case"workflows":return Ca(e);case"browser":return $a(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 Pa(e);case"lockfile":return Ia(e);case"pre-commit-hook":return Aa(e);case"plugin-version":return Ta(e);case"stale-build":return ja(e);case"webhook-secret":return zt(e)}}function ka(e){return e.valid?"\u2713 Settings: project configured":`\u2717 Settings: missing fields: ${e.missingFields.join(", ")}`}function wa(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 ba(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 va(e){return e.reachable?`\u2713 Dev server: ${e.appUrl} is reachable`:`\u2717 Dev server: ${e.appUrl} is not responding. Start your dev server.`}function Sa(e){return e.count===0?"! State sources: none use HTTP":e.configured?e.endpointReachable===void 0?`! State sources: ${String(e.count)} use HTTP, but the engine endpoint was not verified`:`\u2713 State sources: ${String(e.count)} HTTP sources configured`:`\u2717 State sources: ${String(e.count)} use HTTP but RIPPLO_ENGINE_URL is not set`}function xa(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 Ra(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 Ca(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=>Ea(n));return`\u2717 Tests: ${String(e.invalidNames.length)} invalid
|
|
68
68
|
${r.join(`
|
|
69
|
-
`)}`}function
|
|
69
|
+
`)}`}function Ea(e){let r=e.errors.map(n=>" - "+(n.path===""?"":n.path+": ")+n.message);return" "+e.name+`:
|
|
70
70
|
`+r.join(`
|
|
71
|
-
`)}function
|
|
71
|
+
`)}function $a(e){return e.installed?"\u2713 Browser: Chromium installed":"\u2717 Browser: Chromium not installed. Run `npx playwright install chromium`."}function Pa(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 Ia(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 Aa(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 Ta(e){return e.installed===e.cliVersion?`\u2713 Claude plugin: v${e.installed} matches CLI`:`! Claude plugin: installed v${e.installed}, CLI v${e.cliVersion} \u2014 run \`npx ripplo update\` (or /plugin in Claude Code)`}function ja(e){return e.freshness.kind==="foreign-binary"?"! Build: running a ripplo binary from outside this workspace \u2014 its bundle may not match your source. Run `npx ripplo` from this workspace after `pnpm build`.":e.freshness.kind==="stale"?`! Build: source is newer than the built bundles (${e.freshness.packages.join(", ")}) \u2014 the daemon and engine may be serving stale code. Run \`pnpm build\`, then \`npx ripplo daemon stop\` and start it again.`:"\u2713 Build: bundles up to date"}import $e from"fs";import Va from"os";import mr from"path";import{z as W}from"zod";import Ma from"latest-version";import Kt from"semver";async function Ee(e){try{return await Promise.race([Ma("ripplo"),new Promise(r=>setTimeout(()=>{r(void 0)},e))])}catch{return}}function Jt(e){return e.filter(r=>Kt.valid(r)!=null).toSorted(Kt.rcompare)[0]}import{createHash as La}from"crypto";import{graphql as Oa}from"gql.tada";var Na=Oa(`
|
|
72
72
|
query ProjectWebhookSecret($projectId: String!) {
|
|
73
73
|
project(id: $projectId) {
|
|
74
74
|
id
|
|
75
75
|
webhookSecret
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
|
-
`);async function
|
|
78
|
+
`);async function Zt(e){let r=y(e).unwrapOr(void 0),n=r==null?null:Qt(r.webhookSecret);if(r==null||n==null)return{localFingerprint:null,serverFingerprint:null,status:"missing-local",type:"webhook-secret"};let t=await Wa(r),o=t==null?null:Qt(t);return o==null?{localFingerprint:n,serverFingerprint:null,status:"unknown",type:"webhook-secret"}:{localFingerprint:n,serverFingerprint:o,status:n===o?"match":"drifted",type:"webhook-secret"}}function Qt(e){return e.length===0?null:La("sha256").update(e).digest("hex").slice(0,Fa)}var Fa=8;async function Wa(e){return(await d({config:e,document:Na,variables:{projectId:e.projectId}}).catch(()=>null))?.project?.webhookSecret??null}import{graphql as Da}from"gql.tada";var _a=Da(`
|
|
79
79
|
query DoctorAuthViewer {
|
|
80
80
|
currentUser {
|
|
81
81
|
name
|
|
82
82
|
email
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
|
-
`),
|
|
86
|
-
`);let t=n.map(i=>
|
|
85
|
+
`),Ua="Failed to connect to Ripplo server";async function Xt({serverUrl:e,token:r}){try{let n=await d({config:L({serverUrl:e,token:r}),document:_a,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(Ua)?{kind:"unreachable"}:{kind:"invalid"}}}function Yt(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"state-sources":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"webhook-secret":return e.status==="drifted";case"model-validation":return!e.valid;case"workflows":return e.invalidNames.length>0;case"browser":return!e.installed;case"lockfile":return e.status!=="match";case"pre-commit-hook":return!e.installed;case"plugin-version":return!1;case"stale-build":return!1}}async function eo(e){let r=await za(e),n={missing:qr(e),type:"env-files"},t=await Ga(),o=await Ka(),i=await ye(e),s=Ja(e,i),a=Qa(i),l=await Za(e,i),c=Xa(e),g=Ha(e),m=qa(),p=await nl(r,i);return[r,n,t,...p,s,a,l,c,o,...g==null?[]:[g],...m==null?[]:[m]]}function qa(){let e=F();return e.kind==="fresh"?null:{freshness:e,type:"stale-build"}}var Ba=W.object({plugins:W.record(W.string(),W.array(W.object({projectPath:W.string().optional(),scope:W.string().optional(),version:W.string()})))});function Ha(e){let r=mr.join(Va.homedir(),".claude","plugins","installed_plugins.json"),n=$e.existsSync(r)?$e.readFileSync(r,"utf8"):null;if(n==null)return null;let t=Ba.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=Jt(o);return i==null?null:{cliVersion:w(),installed:i,type:"plugin-version"}}async function za(e){let r=await ut(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 Ga(){let e=C(),r=P(e);if(r==null||r.length===0)return{email:void 0,status:"missing",type:"token"};let n=await Xt({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 Ka(){let{chromium:e}=await import("playwright"),r=e.executablePath();return{installed:$e.existsSync(r),type:"browser"}}function Ja(e,r){if(r.isErr())return{errorCount:1,errors:[{message:Y(r.error),path:".ripplo/"}],found:!1,type:"model-validation",valid:!1};let n=we({cwd:e,lockfile:r.value});return{errorCount:n.length,errors:n.length===0?[]:[{message:ve(n),path:""}],found:!0,type:"model-validation",valid:n.length===0}}function Qa(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 Za(e,r){return r.isErr()?{status:"missing",type:"lockfile"}:{status:await An(e,r.value),type:"lockfile"}}function Xa(e){return{installed:Ya(e).some(n=>rl(n).includes("ripplo compile --check")),type:"pre-commit-hook"}}function Ya(e){let r=[el(e)??mr.join(".git","hooks"),".husky"];return[...new Set(r)].map(n=>mr.resolve(e,n,"pre-commit"))}function el(e){let r=en(["rev-parse","--git-path","hooks"],e).trim();return r.length===0?void 0:r}function rl(e){try{return $e.readFileSync(e,"utf8")}catch{return""}}async function nl(e,r){let n=Vr().map(s=>({appUrl:s.appUrl,engineUrl:s.engineUrl,webhookSecret:s.webhookSecret})).unwrapOr(void 0);if(n==null)return[];let t=[],o=await ar(n.appUrl)==null;t.push({appUrl:n.appUrl,reachable:o,type:"dev-server"});let i=await ct(process.cwd());if(t.push(i),e.valid&&r.isOk()){let s=await tl(n,r);t.push(...s)}return t}async function tl(e,r){let n=r.isOk()?r.value.state.sources.filter(g=>g.transport==="http").length:0,t=e.engineUrl.length>0,o={configured:t,count:n,endpointReachable:void 0,type:"state-sources"};if(n===0||!t)return[o];let i=il(e.appUrl,e.engineUrl);if(i==null)return[o];let s=await ar(i)==null,a=[];if(a.push({configured:!0,count:n,endpointReachable:s,type:"state-sources"}),ro(e.engineUrl)&&a.push({reachable:s,type:"engine-endpoint",url:i}),!s)return a;let l=await pt({appUrl:e.appUrl,engineUrl:e.engineUrl});a.push({rejectsUnsigned:l==null,type:"webhook-verification"});let c=await ol({engineUrl:i,webhookSecret:e.webhookSecret});return a.push({status:c,type:"adapter-enabled",url:i},await Zt(process.cwd())),a}async function ol({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",...Xr({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 ro(e){return e.startsWith("http://")||e.startsWith("https://")}function il(e,r){return ro(r)?r:`${e}${r}`}var sl=3e3;async function no(){let e=process.cwd(),[r,n]=await Promise.all([Ee(sl),eo(e)]);process.stdout.write(`${Re({current:w(),latest:r})}
|
|
86
|
+
`);let t=n.map(i=>Gt(i));process.stdout.write(t.join(`
|
|
87
87
|
`)+`
|
|
88
|
-
`);let o=n.some(i=>
|
|
88
|
+
`);let o=n.some(i=>Yt(i));process.exit(o?1:0)}import Pe from"fs";import{graphql as al}from"gql.tada";var ll=al(`
|
|
89
89
|
mutation CliSetHooksPaused($projectId: String!, $paused: Boolean!) {
|
|
90
90
|
setHooksPaused(projectId: $projectId, paused: $paused) {
|
|
91
91
|
id
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
|
-
`);async function
|
|
95
|
-
`);return}
|
|
96
|
-
`)}async function
|
|
97
|
-
`)})}import
|
|
98
|
-
`)).map(o=>o.trim()).filter(o=>o.length>0).slice(-
|
|
94
|
+
`);async function to(){let e=process.cwd();Kr(e);let r=nr(e);if(Pe.existsSync(r)){process.stdout.write("Hooks already paused. Run `npx ripplo hooks resume` to re-enable.\n");return}Pe.writeFileSync(r,""),await io(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 oo(){let e=process.cwd(),r=nr(e);if(!Pe.existsSync(r)){process.stdout.write(`Hooks already active.
|
|
95
|
+
`);return}Pe.unlinkSync(r),await io(e,!1),process.stdout.write(`Hooks resumed.
|
|
96
|
+
`)}async function io(e,r){let n=y(e).unwrapOr(void 0);n!=null&&await d({config:n,document:ll,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.
|
|
97
|
+
`)})}import re from"fs";import ne from"path";import{input as ho,select as ko}from"@inquirer/prompts";import{graphql as Bl}from"gql.tada";import{exec as dl,execFile as cl}from"child_process";import{err as ul,ok as so}from"neverthrow";import f from"fs";import{createRequire as pl}from"module";import k from"path";import{promisify as co}from"util";import{minVersion as ml}from"semver";import{z as h}from"zod";var fl=["ripplo","@ripplo/testing","@ripplo/instrument"],ao=[h.core.version.major,h.core.version.minor,h.core.version.patch].map(String).join("."),gl=4,lo=".ripplo/ripplo.lock linguist-generated=true",yl=[".ripplo/debug/",".ripplo/.local/"],hl=h.object({dependencies:h.record(h.string(),h.string()).optional(),devDependencies:h.record(h.string(),h.string()).optional(),optionalDependencies:h.record(h.string(),h.string()).optional(),peerDependencies:h.record(h.string(),h.string()).optional()}),kl=co(dl),wl=co(cl);async function uo({cwd:e,onStep:r}){let n=fo(e);r("Scaffolding project files..."),Tl({cwd:e,zodImportPath:n.importPath}),r("Updating .gitignore..."),Ml(e),r("Marking ripplo.lock as generated..."),El(e),r("Installing dependencies...");let t=w(),o=await vl({cwd:e,version:t}),i=[];o.ok||i.push({manualCommand:o.cmd,message:`Couldn't auto-install dev dependencies (${o.reason}). Run the command below, then run \`npx ripplo compile\` to build the lockfile.`});let s=o.ok?po(e):void 0;if(s!=null&&s!==t&&i.push({manualCommand:void 0,message:`Installed ripplo ${s}, but ${t} was requested. A registry policy such as pnpm's minimumReleaseAge can silently resolve an older version \u2014 allow the newer version and reinstall so the installed package matches the scaffolded files.`}),o.ok){r("Compiling initial lockfile...");let l=await Cl(e);l!=null&&i.push({manualCommand:void 0,message:l})}return r("Setting up browser..."),(await bl()).map(()=>i)}async function bl(){let{chromium:e}=await import("playwright"),r=e.executablePath();if(f.existsSync(r))return so(void 0);G.info("Chromium not found. Installing via Playwright...");let n=pl(import.meta.url),t=k.dirname(n.resolve("playwright/package.json")),o=k.join(t,"cli.js");return await wl(process.execPath,[o,"install","chromium"]),f.existsSync(r)?so(void 0):ul({kind:"playwright-install-failed"})}async function vl({cwd:e,version:r}){let n=fr({cwd:e,pm:gr(e),version:r});G.info("Installing dependencies: %s",n);try{return await kl(n,{cwd:e}),{ok:!0}}catch(t){let o=Rl(t);return G.warn("Install failed (%s): %s",n,o),{cmd:n,ok:!1,reason:o}}}var Sl=h.object({version:h.string()});function po(e){let r=k.join(e,"node_modules","ripplo","package.json");if(!f.existsSync(r)){let n=k.dirname(e);return n===e?void 0:po(n)}try{let n=Sl.safeParse(JSON.parse(f.readFileSync(r,"utf8")));return n.success?n.data.version:void 0}catch{return}}var xl=h.object({stderr:h.string().optional(),stdout:h.string().optional()});function Rl(e){let r=xl.safeParse(e),t=(r.success?[r.data.stderr,r.data.stdout]:[]).flatMap(o=>o==null?[]:o.split(`
|
|
98
|
+
`)).map(o=>o.trim()).filter(o=>o.length>0).slice(-gl);return t.length>0?t.join(" "):e instanceof Error?e.message:String(e)}async function Cl(e){try{await In(e);return}catch(r){return`Couldn't compile initial lockfile: ${r instanceof Error?r.message:String(r)}.`}}function El(e){let r=k.join(e,".gitattributes"),n=f.existsSync(r)?f.readFileSync(r,"utf8"):"";if(n.includes(lo))return;let t=n.length===0||n.endsWith(`
|
|
99
99
|
`)?"":`
|
|
100
|
-
`;
|
|
101
|
-
`)}function
|
|
100
|
+
`;f.writeFileSync(r,`${n}${t}${lo}
|
|
101
|
+
`)}function fr({cwd:e,pm:r,version:n}){let t=fl.map(s=>`${s}@${n}`),o=fo(e),i=[...t,o.installSpec].join(" ");return r==="pnpm"?$l(e)?`pnpm add -wD --save-exact ${i}`:`pnpm add -D --save-exact ${i}`:r==="yarn"?Pl({cwd:e,deps:i}):r==="bun"?`bun add -d --exact ${i}`:`npm install -D --save-exact ${i}`}function gr(e){return f.existsSync(k.join(e,"pnpm-lock.yaml"))?"pnpm":f.existsSync(k.join(e,"yarn.lock"))?"yarn":f.existsSync(k.join(e,"bun.lockb"))||f.existsSync(k.join(e,"bun.lock"))?"bun":"npm"}function $l(e){return f.existsSync(k.join(e,"pnpm-workspace.yaml"))||f.existsSync(k.join(e,"pnpm-workspace.yml"))}function Pl({cwd:e,deps:r}){return Il(e)?`yarn add -D --exact ${r}`:Al(e)?`yarn add -WD --exact ${r}`:`yarn add -D --exact ${r}`}function Il(e){if(f.existsSync(k.join(e,".yarnrc.yml"))||f.existsSync(k.join(e,".pnp.cjs"))||f.existsSync(k.join(e,".pnp.js")))return!0;let r=k.join(e,"package.json");if(!f.existsSync(r))return!1;try{let n=JSON.parse(f.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 Al(e){let r=k.join(e,"package.json");if(!f.existsSync(r))return!1;try{let n=JSON.parse(f.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 Tl({cwd:e,zodImportPath:r}){let n=k.join(e,".ripplo");mo({zodImportPath:r}).forEach(({content:t,relPath:o})=>{let i=k.join(n,o);f.mkdirSync(k.dirname(i),{recursive:!0}),jl(i,t)})}function jl(e,r){f.existsSync(e)||f.writeFileSync(e,r)}function Ml(e){let r=k.join(e,".gitignore");if(!f.existsSync(r))return;let n=f.readFileSync(r,"utf8"),t=yl.filter(i=>!n.includes(i));if(t.length===0)return;let o=n.endsWith(`
|
|
102
102
|
`)?"":`
|
|
103
|
-
`;
|
|
103
|
+
`;f.writeFileSync(r,n+o+t.join(`
|
|
104
104
|
`)+`
|
|
105
|
-
`)}var
|
|
105
|
+
`)}var Ll=`import { createRipplo } from "@ripplo/testing";
|
|
106
106
|
import { facts } from "./facts";
|
|
107
107
|
import { state } from "./state";
|
|
108
108
|
import { workflows } from "./workflows/index";
|
|
@@ -113,7 +113,7 @@ export default createRipplo({
|
|
|
113
113
|
viewports: ["desktop", "mobile"],
|
|
114
114
|
workflows,
|
|
115
115
|
});
|
|
116
|
-
`;function
|
|
116
|
+
`;function Ol(e){return`import { defineState, source } from "@ripplo/testing";
|
|
117
117
|
import { z } from "${e}";
|
|
118
118
|
|
|
119
119
|
export const state = defineState(
|
|
@@ -121,9 +121,9 @@ export const state = defineState(
|
|
|
121
121
|
app: source.http(z.object({})),
|
|
122
122
|
}),
|
|
123
123
|
);
|
|
124
|
-
`}var
|
|
125
|
-
`,
|
|
126
|
-
`,
|
|
124
|
+
`}var Nl=`export const facts = [] as const;
|
|
125
|
+
`,Fl=`export const workflows = [] as const;
|
|
126
|
+
`,Wl=`{
|
|
127
127
|
"compilerOptions": {
|
|
128
128
|
"strict": true,
|
|
129
129
|
"noUncheckedIndexedAccess": true,
|
|
@@ -138,7 +138,7 @@ export const state = defineState(
|
|
|
138
138
|
"include": ["*.ts", "workflows/**/*.ts"],
|
|
139
139
|
"exclude": ["node_modules"]
|
|
140
140
|
}
|
|
141
|
-
|
|
141
|
+
`,Dl=`// Guards spec files against shadowing DSL imports \u2014 \`const url = ...\` next to the
|
|
142
142
|
// imported \`url\` locator silently breaks specs. Requires typescript-eslint (and
|
|
143
143
|
// ESLint's per-directory config lookup). Delete this file if your lint setup differs.
|
|
144
144
|
import tseslint from "typescript-eslint";
|
|
@@ -152,47 +152,47 @@ export default tseslint.config({
|
|
|
152
152
|
},
|
|
153
153
|
plugins: { "@typescript-eslint": tseslint.plugin },
|
|
154
154
|
});
|
|
155
|
-
`;function
|
|
156
|
-
`),"written"}function
|
|
155
|
+
`;function mo({zodImportPath:e}){return[{content:Ll,relPath:"index.ts"},{content:Ol(e),relPath:"state.ts"},{content:Nl,relPath:"facts.ts"},{content:Fl,relPath:"workflows/index.ts"},{content:Wl,relPath:"tsconfig.json"},{content:Dl,relPath:"eslint.config.js"}]}var hg=mo({zodImportPath:"zod/v4"});function fo(e){return _l(e)?{importPath:"zod4",installSpec:`zod4@npm:zod@${ao}`}:{importPath:"zod/v4",installSpec:`zod@${ao}`}}function _l(e){let r=k.join(e,"package.json");if(!f.existsSync(r))return!1;let n=JSON.parse(f.readFileSync(r,"utf8")),t=hl.parse(n);return[t.dependencies?.zod,t.devDependencies?.zod,t.optionalDependencies?.zod,t.peerDependencies?.zod].filter(i=>i!=null).some(i=>!Ul(i))}function Ul(e){let r=e.replace(/^workspace:/,"").replace(/^npm:zod@/,"");return ml(r)?.major===4}import Ie from"fs";import go from"path";import{z as yr}from"zod";var Vl={autoUpdate:!0,source:{repo:"ripplo/claude-plugin",source:"github"}},yo=yr.record(yr.string(),yr.unknown());function Ae(e){let r=go.join(e,".claude","settings.json"),n=ql(r);if(n==null)return"unparseable";let t=yo.safeParse(n.extraKnownMarketplaces??{});if(!t.success)return"unparseable";if(t.data.ripplo!=null)return"already-present";let o={...n,extraKnownMarketplaces:{...t.data,ripplo:Vl}};return Ie.mkdirSync(go.dirname(r),{recursive:!0}),Ie.writeFileSync(r,`${JSON.stringify(o,null,2)}
|
|
156
|
+
`),"written"}function ql(e){if(!Ie.existsSync(e))return{};try{let r=yo.safeParse(JSON.parse(Ie.readFileSync(e,"utf8")));return r.success?r.data:void 0}catch{return}}function Te(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 Hl=Bl(`
|
|
157
157
|
query InitProjects {
|
|
158
158
|
projects {
|
|
159
159
|
id
|
|
160
160
|
name
|
|
161
161
|
}
|
|
162
162
|
}
|
|
163
|
-
`),
|
|
164
|
-
`),process.exit(1));let o=await
|
|
165
|
-
`);let
|
|
163
|
+
`),hr=["../.env.local","../.env"];async function wo(e=Kl()){let r=process.cwd(),n=C(),t=P(n);t==null&&(process.stdout.write("Not signed in. Run `npx ripplo auth login` first.\n"),process.exit(1)),zl(r)&&(process.stdout.write(`\`.ripplo/index.ts\` already exists at ${r}. To re-init, delete it first.
|
|
164
|
+
`),process.exit(1));let o=await Gl({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 Ql(o,e.projectId),s=await Zl(r,e.envFile),a=await Yl(e.appUrl),l=Jl(a,e.engineUrl),c=ne.resolve(ne.join(r,".ripplo"),s);Ur({cwd:r,envFiles:[s],projectId:i}),rd({appUrl:a,engineUrl:l,filePath:c}),process.stdout.write(`${Te(Ae(r))}
|
|
165
|
+
`);let m=(await uo({cwd:r,onStep:p=>{process.stdout.write(` ${p}
|
|
166
166
|
`)}})).match(p=>p,p=>{process.stderr.write(`${S(p)}
|
|
167
|
-
`),process.exit(1)});if(
|
|
168
|
-
`),
|
|
167
|
+
`),process.exit(1)});if(m.length>0){process.stdout.write(`Done with warnings:
|
|
168
|
+
`),m.forEach(p=>{process.stdout.write(` - ${p.message}
|
|
169
169
|
`),p.manualCommand!=null&&process.stdout.write(` run: ${p.manualCommand}
|
|
170
|
-
`)});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
|
|
171
|
-
`),process.exit(1)}return r}return`${e.replace(/\/$/,"")}/ripplo`}async function
|
|
170
|
+
`)});return}await I("cli_init_completed"),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 zl(e){return re.existsSync(ne.join(e,".ripplo","index.ts"))}async function Gl({serverUrl:e,token:r}){return((await d({config:L({serverUrl:e,token:r}),document:Hl,variables:void 0})).projects??[]).map(t=>({id:t.id,name:t.name}))}function Kl(){return{appUrl:void 0,engineUrl:void 0,envFile:void 0,projectId:void 0}}function Jl(e,r){if(r!=null){try{new URL(r)}catch{process.stdout.write(`--engine-url is not a valid URL: ${r}
|
|
171
|
+
`),process.exit(1)}return r}return`${e.replace(/\/$/,"")}/ripplo`}async function Ql(e,r){if(r!=null){let n=e.find(t=>t.id===r);return n==null&&(process.stdout.write(`Unknown project id: ${r}
|
|
172
172
|
`),process.exit(1)),process.stdout.write(`Using project: ${n.name} (${n.id})
|
|
173
173
|
`),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})
|
|
174
|
-
`),n.id}return
|
|
175
|
-
`),process.exit(1)),r):
|
|
176
|
-
`),process.exit(1)}return e}return
|
|
174
|
+
`),n.id}return ko({choices:e.map(n=>({name:n.name,value:n.id})),message:"Select a project"})}async function Zl(e,r){return r!=null?(r.trim().length===0&&(process.stdout.write(`--env must not be empty
|
|
175
|
+
`),process.exit(1)),r):Xl(e)}async function Xl(e){let r=ne.join(e,".ripplo"),n=hr.find(o=>re.existsSync(ne.resolve(r,o))),t=await ko({choices:[...hr.map(o=>({name:n===o?`${o} (detected)`:o,value:o})),{name:"custom path",value:"__custom__"}],default:n??hr[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:ho({message:"Path to env file (relative to .ripplo/, e.g. ../apps/server/.env)",validate:o=>o.trim().length>0?!0:"required"})}async function Yl(e){if(e!=null){try{new URL(e)}catch{process.stdout.write(`--app-url is not a valid URL: ${e}
|
|
176
|
+
`),process.exit(1)}return e}return ed()}async function ed(){return ho({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 rd({appUrl:e,engineUrl:r,filePath:n}){re.mkdirSync(ne.dirname(n),{recursive:!0});let t=re.existsSync(n)?re.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(`
|
|
177
177
|
`)?"":`
|
|
178
|
-
`;
|
|
178
|
+
`;re.writeFileSync(n,`${t}${i}${o.join(`
|
|
179
179
|
`)}
|
|
180
|
-
`)}import{graphql as
|
|
181
|
-
`)}function
|
|
180
|
+
`)}import{graphql as br}from"gql.tada";function kr(){return"Not signed in. Run `npx ripplo auth login` first."}function bo(){return"No organization found for your account. Sign in to the dashboard once, then retry."}function vo(e){return["You belong to multiple organizations \u2014 pass `--org <id>`:",...e.map(n=>` ${n.id} ${n.name}`)].join(`
|
|
181
|
+
`)}function wr(e){return`Could not create the project \u2014 ${e}`}var nd=br(`
|
|
182
182
|
query ProjectsList {
|
|
183
183
|
projects {
|
|
184
184
|
id
|
|
185
185
|
name
|
|
186
186
|
}
|
|
187
187
|
}
|
|
188
|
-
`),
|
|
188
|
+
`),td=br(`
|
|
189
189
|
query OrganizationsList {
|
|
190
190
|
organizations {
|
|
191
191
|
id
|
|
192
192
|
name
|
|
193
193
|
}
|
|
194
194
|
}
|
|
195
|
-
`),
|
|
195
|
+
`),od=br(`
|
|
196
196
|
mutation CliCreateProject($name: String!, $organizationId: String!) {
|
|
197
197
|
createProject(cloudBaseUrl: "", name: $name, organizationId: $organizationId) {
|
|
198
198
|
__typename
|
|
@@ -208,29 +208,29 @@ export default tseslint.config({
|
|
|
208
208
|
}
|
|
209
209
|
}
|
|
210
210
|
}
|
|
211
|
-
`);async function
|
|
212
|
-
`),process.exit(1));let t=((await d({config:
|
|
213
|
-
`)}async function
|
|
214
|
-
`),process.exit(1));let o=
|
|
215
|
-
`),process.exit(1)),l})).createProject;if(a?.__typename!=="Project"){let l=a?.message??"unknown error";process.stderr.write(`${
|
|
211
|
+
`);async function So(){let e=C(),r=P(e);r==null&&(process.stderr.write(`${kr()}
|
|
212
|
+
`),process.exit(1));let t=((await d({config:L({serverUrl:e,token:r}),document:nd,variables:void 0})).projects??[]).map(o=>({id:o.id,name:o.name}));process.stdout.write(`${JSON.stringify({projects:t},null,2)}
|
|
213
|
+
`)}async function xo({name:e,orgId:r}){let n=C(),t=P(n);t==null&&(process.stderr.write(`${kr()}
|
|
214
|
+
`),process.exit(1));let o=L({serverUrl:n,token:t}),i=r??await id(o),a=(await d({config:o,document:od,variables:{name:e,organizationId:i}}).catch(l=>{throw l instanceof Hr&&(process.stderr.write(`${wr(l.message)}
|
|
215
|
+
`),process.exit(1)),l})).createProject;if(a?.__typename!=="Project"){let l=a?.message??"unknown error";process.stderr.write(`${wr(l)}
|
|
216
216
|
`),process.exit(1)}process.stdout.write(`${JSON.stringify({project:{id:a.id,name:a.name}},null,2)}
|
|
217
|
-
`)}async function
|
|
218
|
-
`),process.exit(1)}import{spawnSync as
|
|
219
|
-
${e.detail}`:""}`}function
|
|
220
|
-
`);let e=
|
|
221
|
-
`),process.exit(1)),process.exit(e.exitCode)}import
|
|
222
|
-
`);let l=new
|
|
223
|
-
`)}}}async function
|
|
224
|
-
`),r.failed>0&&process.exit(1),process.exit(r.notRun>0?2:0)}function
|
|
225
|
-
`),process.exit(1)}function
|
|
226
|
-
`),
|
|
217
|
+
`)}async function id(e){let n=((await d({config:e,document:td,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?bo():vo(n)}
|
|
218
|
+
`),process.exit(1)}import{spawnSync as je}from"child_process";function Ro(){if(je("claude",["--version"],{stdio:"ignore"}).error!=null)return{kind:"claude-missing"};je("claude",["plugin","marketplace","add","ripplo/claude-plugin"],{stdio:"ignore"});let r=je("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:je("claude",["/ripplo:setup"],{stdio:"inherit"}).status??0,kind:"launched"}}function Co(){return"Installing the Ripplo plugin for Claude Code, then handing off to a guided setup session."}function Eo(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?`
|
|
219
|
+
${e.detail}`:""}`}function $o(){process.stdout.write(`${Co()}
|
|
220
|
+
`);let e=Ro();e.kind!=="launched"&&(process.stderr.write(`${Eo(e)}
|
|
221
|
+
`),process.exit(1)),process.exit(e.exitCode)}import sd from"path";import{CancellationTokenSource as ad}from"vscode-jsonrpc/node";function Me(e){return`ripplo: workspace build is stale (${e.join(", ")}) \u2014 rebuilding`}function Le(){return"ripplo: workspace build failed \u2014 fix the build, then rerun"}function te(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 Po({all:e,headed:r,ids:n}){let t=process.cwd(),o=process.argv[1];o==null&&D(xe({kind:"spawn-failed",message:"process.argv[1] missing"})),cd();let i=await et(t);i!=null&&D(tt(i));let a=(await Qn({cliEntry:o,cwd:t})).match(p=>p,p=>D(xe(p)));a.versionNote?.kind==="stale-busy"&&D(lr(a.versionNote)),a.versionNote!=null&&process.stderr.write(`${lr(a.versionNote)}
|
|
222
|
+
`);let l=new ad;process.once("SIGINT",()=>{l.cancel(),a.socket.destroy(),process.exit(130)});let c=sd.join(t,".ripplo","debug"),m=(await Zn({connection:a,onEvent:ld(c),request:{all:e,headed:r,tests:[...n]},token:l.token})).match(p=>p,p=>D(xe(p)));await dd({connection:a,result:m})}function ld(e){let r=!1;return n=>{let t=nt({debugDir:e,event:n});if(t!=null){if(process.stdout.isTTY&&n.kind==="run-progress"){process.stdout.write(`\r\x1B[2K${t}`),r=!0;return}r&&(process.stdout.write("\r\x1B[2K"),r=!1),process.stdout.write(`${t}
|
|
223
|
+
`)}}}async function dd({connection:e,result:r}){await new Promise(n=>{e.socket.end(n)}),r.kind==="daemon-error"&&D(ot(r.error)),await I("first_run_finished"),process.stdout.write(`${rt(r)}
|
|
224
|
+
`),r.failed>0&&process.exit(1),process.exit(r.notRun>0?2:0)}function D(e){process.stderr.write(`${e}
|
|
225
|
+
`),process.exit(1)}function cd(){let e=F();if(e.kind==="fresh")return;if(e.kind==="foreign-binary"){let n=te(e);D(n??"foreign binary in the ripplo workspace")}process.stderr.write(`${Me(e.packages)}
|
|
226
|
+
`),Se(e.workspaceRoot)||D(Le())}import B from"path";import gd from"os";import{mkdtempSync as yd,rmSync as hd}from"fs";import{err as Fe,ok as xr}from"neverthrow";import{readdir as ud,rm as pd,stat as md}from"fs/promises";import{existsSync as fd}from"fs";import vr from"path";async function Sr(e,r){let t=(await ud(e,{withFileTypes:!0}).catch(()=>[])).filter(s=>s.isDirectory()).map(s=>s.name).filter(s=>s.startsWith("replay-")||s.startsWith("explore-")||fd(vr.join(e,s,Gr)));if(t.length<=r)return;let i=(await Promise.all(t.map(async s=>({mtime:(await md(vr.join(e,s)).catch(()=>null))?.mtimeMs??0,name:s})))).toSorted((s,a)=>a.mtime-s.mtime).slice(r);await Promise.all(i.map(s=>pd(vr.join(e,s.name),{force:!0,recursive:!0}).catch(()=>{})))}var Io=50,kd=15e3,wd=15e3;async function Ao(){fe(w());let e=process.cwd(),r=G.child({worker:process.pid}),n=Rt(),t=yd(B.join(gd.tmpdir(),"ripplo-browser-cache-")),o=ke({cacheDir:t,clientVersion:w(),debugDir:B.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)},kd).unref(),Rd(i).then(()=>o.close().catch(()=>{})).then(()=>{hd(t,{force:!0,recursive:!0}),process.exit(l)})};bd({exit:a,workerLogger:r}),n.onRequest(ht,async(l,c)=>{let g=ft.safeParse(l);if(!g.success)return Oe("bad-run-assign");let m=g.data;ie(e);let p=y(e).match(v=>v,v=>v.kind);if(typeof p=="string")return Oe(`config:${p}`);let $=await To(n);if($.isErr())return Oe(`lockfile-unavailable:${$.error}`);let T=$.value,E=Z(T).find(v=>v.ref===m.testRef);if(E==null)return Oe(`no-test:${m.testRef}`);let me=Et({config:p,intervalMs:wd,runId:m.runId});try{let{outcome:v,persisted:er,progress:Hs}=await $t({config:p,cwd:e,errorSettle:"settle",fixturesDir:B.join(e,se),headed:m.headed,lockfile:T,onProgress:vd({connection:n,runId:m.runId}),runId:m.runId,session:o,signal:dr(c),test:E.test}),Dr=B.join(e,".ripplo","debug");return s(Promise.allSettled([er]).then(()=>Sd({config:p,debugDir:Dr,progress:Hs,runId:m.runId})).then(()=>Sr(Dr,Io)).catch(()=>{})),{outcome:mt(v),serverNotified:!0}}catch(v){let er=B.join(e,".ripplo","debug");if(s(ee({config:p,debugDir:er,runId:m.runId}).catch(()=>{})),v instanceof Br)return{outcome:{detail:v.message,kind:"infra-error"},serverNotified:!1};throw v}finally{me()}}),n.onRequest(bt,(l,c)=>Cd({connection:n,cwd:e,raw:l,session:o,token:c,track:s})),n.onNotification(vt,l=>{let c=gt.safeParse(l);c.success&&o.injectSpan(c.data.runId,c.data.span)}),n.onNotification(xt,()=>{a(0)}),n.sendNotification(yt),await new Promise(()=>{})}function bd({exit:e,workerLogger:r}){process.on("disconnect",()=>{e(1)}),process.on("unhandledRejection",n=>{r.error({err:n},"worker unhandled rejection")}),process.on("uncaughtException",n=>{r.error({err:n},"worker uncaught exception"),e(1)})}function vd({connection:e,runId:r}){return n=>{e.sendNotification(St,{runId:r,signal:n})}}async function Sd({config:e,debugDir:r,progress:n,runId:t}){n?.report({activity:{kind:"uploadingReplay"},deadlineAt:null,retry:null}),await n?.flush(),n!=null&&Pt({debugDir:r,history:n.history(),runId:t}),await ee({config:e,debugDir:r,runId:t})}function Oe(e){return{outcome:{detail:e,kind:"error"},serverNotified:!1}}var xd=5e3;async function Rd(e){e.size!==0&&await Promise.race([Promise.allSettled(e),new Promise(r=>{setTimeout(r,xd)})])}async function Cd({connection:e,cwd:r,raw:n,session:t,token:o,track:i}){let s=wt.safeParse(n);if(!s.success)return{error:{reason:"format-unsupported",source:"assignment-rejected"},kind:"error"};let{assign:a,currentTargetGeneration:l,devSessionId:c}=s.data;ie(r);let g=y(r).match(v=>v,v=>v.kind);if(typeof g=="string")return{error:{detail:g,source:"config"},kind:"error"};let m=await To(e);if(m.isErr())return{error:{source:"lockfile-stale"},kind:"error"};let p=m.value,$=await be(r);if($==null)return{error:{source:"lockfile-stale"},kind:"error"};let T=B.join(g.cwd,".ripplo","debug"),E=await It({assign:a,config:g,currentModelHash:$,currentTargetGeneration:l,debugDir:T,devSessionId:c??void 0,fixturesDir:B.join(g.cwd,se),headed:!1,lockfile:p,report:!0,session:t,signal:dr(o)}),me=(E.kind==="finding"||E.kind==="coverage-gap")&&E.runId!=null?ee({config:g,debugDir:T,runId:E.runId}):Promise.resolve();return i(me.then(()=>Sr(T,Io)).catch(()=>{})),E}async function To(e){return(await Ed(e)).andThen(n=>n.unavailable!=null?Fe(n.unavailable):n.lockfileJson==null?Fe("empty-reply"):$d(n.lockfileJson))}async function Ed(e){try{return xr(await e.sendRequest(kt))}catch(r){return Fe(`transport:${r instanceof Error?r.message:"unknown"}`)}}var Ne;function $d(e){if(Ne!==void 0&&Ne.json===e)return xr(Ne.lockfile);try{let r=ln(N(j,e));return Ne={json:e,lockfile:r},xr(r)}catch(r){return Fe(`worker-decode-failed:${r instanceof Error?r.message.slice(0,200):"unknown"}`)}}async function jo(){await Ao()}import{existsSync as Fd}from"fs";import Wd from"path";import{ok as Dd}from"neverthrow";import{gunzipSync as Pd}from"zlib";import{mkdir as Id,writeFile as Ad}from"fs/promises";import Mo from"path";import{graphql as Td}from"gql.tada";import{err as le,ok as jd}from"neverthrow";var Md=31,Ld=139;async function We(e,r){let n=y(e).match(s=>s,s=>s.kind);if(typeof n=="string")return le({detail:n,kind:"config"});let t=await d({config:n,document:Od,variables:{id:r}}).catch(()=>null);if(t==null)return le({kind:"request-failed"});if(t.run==null)return le({kind:"not-found"});if(t.run.behaviorUrl==null)return le({kind:"not-uploaded"});let o=await fetch(t.run.behaviorUrl);if(!o.ok)return le({kind:"download-failed",status:o.status});let i=Mo.join(e,".ripplo","debug",r,"behavior.jsonl");return await Id(Mo.dirname(i),{recursive:!0}),await Ad(i,Nd(Buffer.from(await o.arrayBuffer()))),jd({path:i,runId:r})}var Od=Td(`
|
|
227
227
|
query RunBehaviorUrl($id: String!) {
|
|
228
228
|
run(id: $id) {
|
|
229
229
|
id
|
|
230
230
|
behaviorUrl
|
|
231
231
|
}
|
|
232
232
|
}
|
|
233
|
-
`);function
|
|
233
|
+
`);function Nd(e){return e[0]===Md&&e[1]===Ld?Pd(e):e}async function _(e,r){let n=Wd.join(e,".ripplo","debug",r,"behavior.jsonl");return Fd(n)?Dd(void 0):(await We(e,r)).map(()=>{})}import{existsSync as Oo,readFileSync as No}from"fs";import Fo from"path";import{err as _d,ok as Ud}from"neverthrow";import{z as Rr}from"zod";function De(e){return e.shape==="legacy"?e.title:e.action==null?e.nodeType:dn(e.action).map(r=>r.text).join(" ")}var Cr=" \u203A ",Vd=4e3,qd=5;function Wo(e,r){let n=Fo.join(e,".ripplo","debug",r,"behavior.jsonl");if(!Oo(n))return _d({kind:"run-not-found",runId:r});let t=Bd(No(n,"utf8")),o=cc(e),i=o==null?[]:yn(o),s=[...t.failedChecks.map(a=>Jd({check:a,facts:i,lockfile:o,run:t})),...t.stepErrors.map(a=>ec({event:a,run:t})),...t.findings.map(a=>rc({event:a,run:t}))];return Ud({durationMs:Math.max(0,t.lastTs-t.firstTs),failures:s,lockfileLoaded:o!=null,progress:t.progress,runId:r,stepsRan:t.stepTitles.size,viewport:t.viewport})}function Bd(e){let r=K(e),n=r.filter(l=>l.kind==="check"&&l.outcome.kind==="failed"),t=r.filter(l=>l.kind==="stepError"),o=r.filter(l=>l.kind==="finding"),i=r.flatMap(l=>Gd(l)),s=r.flatMap(l=>l.kind==="progress"?[{atMs:q(l.timeNanos),signal:l.signal}]:[]),a=r.map(l=>q(l.timeNanos));return{causes:i,failedChecks:n,findings:o,firstTs:a.length===0?0:Math.min(...a),lastTs:a.length===0?0:Math.max(...a),progress:s,stepErrors:t,stepTitles:new Map(r.flatMap(l=>l.kind==="step"?[[l.stepIndex,De(l)]]:[])),viewport:zd(r)}}var Hd=Rr.object({height:Rr.number(),width:Rr.number()});function zd(e){return e.flatMap(r=>{if(r.kind!=="rrweb"||r.event.type!==4)return[];let n=Hd.safeParse(r.event.data);return n.success?[n.data]:[]})[0]}function Gd(e){let r=Kd(e);return r==null?[]:[{detail:r,timestamp:q(e.timeNanos)}]}function Kd(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 Jd({check:e,facts:r,lockfile:n,run:t}){let o=q(e.timeNanos),i=Qd(e.origin),s=t.stepTitles.get(e.stepIndex)??String(e.stepIndex);return{browserMismatch:void 0,causes:Er(t.causes,o),error:void 0,label:Zd(e),outcome:"failed",pending:void 0,ruleKind:i,rules:tc({check:Do(e),facts:r,lockfile:n,ruleKind:i,subjectKey:Yd(e)}),runWorkflow:s.split(Cr)[0]??s,snapshotAt:o,step:s,wait:void 0,waitMs:e.waitedMs}}function Qd(e){switch(e.kind){case"fact":return"fact";case"dataRule":return"data-rule";case"step":return"step"}}function Zd(e){let r=an(e);return r??`${e.family} ${Do(e)}: ${e.outcome.kind}`}function Do(e){switch(e.family){case"element":case"content":case"scalar":case"action":return sn(e);case"state":return e.subject;case"frame":return Xd(e);case"dataRule":return e.rule}}function Xd(e){if(e.outcome.kind==="passed")return e.family;let r=e.outcome.reason;return r.kind==="wrongScalar"||r.kind==="wrongElementState"||r.kind==="wrongElementContent"?r.subject:r.kind==="wrongCount"?r.entity:`${r.entity} [${r.key}]`}function Yd(e){if(e.family==="scalar")return e.subjectKey;if(e.family!=="frame"||e.outcome.kind!=="failed")return;let r=e.outcome.reason;if(r.kind==="wrongScalar"||r.kind==="wrongElementState"||r.kind==="wrongElementContent")return r.subjectKey}function ec({event:e,run:r}){let n=q(e.timeNanos),t=r.stepTitles.get(e.stepIndex)??String(e.stepIndex);return{browserMismatch:void 0,causes:Er(r.causes,n),error:e.error,label:`driver ${e.error.kind}`,outcome:"error",pending:void 0,ruleKind:"unknown",rules:[],runWorkflow:t.split(Cr)[0]??t,snapshotAt:n,step:t,wait:void 0,waitMs:void 0}}function rc({event:e,run:r}){let n=q(e.timeNanos);return{browserMismatch:void 0,causes:Er(r.causes,n),error:void 0,label:nc(e.payload),outcome:"failed",pending:void 0,ruleKind:"unknown",rules:[],runWorkflow:e.step.split(Cr)[0]??e.step,snapshotAt:n,step:e.step,wait:void 0,waitMs:void 0}}function nc(e){switch(e.kind){case"unrunnable":return e.unmet==null?`${e.kind} ${e.reason}`:`${e.kind} ${e.reason}: ${e.unmet}`;case"impossibleAction":return`${e.kind} ${e.action}`;case"liftVisibility":return`${e.kind} ${e.subject}`}}function tc({check:e,facts:r,lockfile:n,ruleKind:t,subjectKey:o}){return t!=="fact"||n==null?[]:r.filter(i=>oc({check:e,rule:i,subjectKey:o})).map(i=>({consequence:tr(i.consequence),origins:ic(i.origin,n),url:mn(i.when),when:fn(i.when)}))}function oc({check:e,rule:r,subjectKey:n}){return n!=null?hn(r)===n:tr(r.consequence)===e}function ic(e,r){let n=Z(r),t=sc(e).flatMap(o=>{let i=n.find(s=>s.ref===o);return i==null?[]:[{intent:i.workflow.intent,sourcePath:i.workflow.sourcePath}]});return ac(t)}function sc(e){return e==null?[]:e.kind==="declared"?[]:[e.test]}function ac(e){return[...new Map(e.map(r=>[r.intent,r])).values()]}function Er(e,r){let n=e.filter(t=>t.timestamp<=r&&t.timestamp>=r-Vd).toSorted((t,o)=>o.timestamp-t.timestamp);return lc(n).toSorted((t,o)=>Number(Lo(o.detail))-Number(Lo(t.detail))).slice(0,qd).map(t=>({deltaMs:r-t.timestamp,detail:t.detail}))}function lc(e){return e.reduce((r,n)=>{let t=dc(n.detail);return r.keys.has(t)?r:{keys:new Set([...r.keys,t]),out:[...r.out,n]}},{keys:new Set,out:[]}).out}function dc(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 Lo(e){return e.kind==="network"?e.status>=400:e.kind==="span"?e.statusCode==="error":!0}function cc(e){let r=Fo.join(e,".ripplo","ripplo.lock");if(!Oo(r))return null;try{return N(j,No(r,"utf8"))}catch{return null}}import{existsSync as _o,readFileSync as Uo}from"fs";import Vo from"path";import{graphql as uc}from"gql.tada";async function qo(e,r,n){let t=mc(e);return{test:t==null?void 0:await fc(n,r,t),timeline:pc(bc(e,r))}}function pc(e){return e.filter(r=>r.kind==="step").toSorted((r,n)=>r.stepIndex-n.stepIndex).map(r=>hc(r,e))}function mc(e){let r=Vo.join(e,".ripplo","ripplo.lock");return _o(r)?N(j,Uo(r,"utf8")):null}async function fc(e,r,n){let t=await d({config:e,document:vc,variables:{id:r}}).catch(()=>null);if(t?.run==null)return;let o=gc(t.run);return o!=null?Z(n).find(i=>i.ref===o)?.test:yc(n,t.run.reproJson)}function gc(e){let r=e.workflow?.slug,n=e.test?.slug;return r==null||n==null?void 0:`${r}/${n}`}function yc(e,r){if(r==null)return;let n=he(r);return n.kind==="rejected"?void 0:bn(e,{sweep:!0}).find(t=>t.name===n.repro.envelopeRef)?.test}function hc(e,r){let n=r.filter(i=>i.kind==="check"&&i.stepIndex===e.stepIndex),t=r.filter(i=>i.kind==="stepError"&&i.stepIndex===e.stepIndex),o=r.filter(i=>i.kind==="finding"&&i.stepIndex===e.stepIndex);return{changes:[...e.stateRows.flatMap(i=>kc(i)),...e.stateSingletons.flatMap(i=>wc(i))],checksHeld:n.filter(i=>i.outcome.kind==="passed").length,failures:[...n.filter(i=>i.outcome.kind==="failed").map(i=>({event:i,kind:"check"})),...t.map(i=>({event:i,kind:"stepError"})),...o.map(i=>({kind:"finding",payload:i.payload}))],index:e.stepIndex,title:De(e),url:e.pageUrl,workflow:e.sourceTest}}function kc(e){return e.status==="present"?[]:[`${e.status} ${e.entity} ${e.key}`]}function wc(e){return e.changed?[`${e.name} = ${e.value??"\u2205"}`]:[]}function bc(e,r){let n=Vo.join(e,".ripplo","debug",r,"behavior.jsonl");return _o(n)?K(Uo(n,"utf8")):[]}var vc=uc(`
|
|
234
234
|
query ExplainRunTest($id: String!) {
|
|
235
235
|
run(id: $id) {
|
|
236
236
|
id
|
|
@@ -245,30 +245,30 @@ ${e.detail}`:""}`}function yo(){process.stdout.write(`${fo()}
|
|
|
245
245
|
}
|
|
246
246
|
}
|
|
247
247
|
}
|
|
248
|
-
`);var
|
|
249
|
-
`)}function
|
|
250
|
-
`)}function
|
|
251
|
-
`)}function
|
|
252
|
-
`)}function
|
|
253
|
-
`)}function
|
|
254
|
-
`)}function
|
|
255
|
-
`)}function
|
|
256
|
-
`)}function
|
|
257
|
-
`),process.exit(1));let i=
|
|
258
|
-
`),process.exit(1)));process.stdout.write(`${r?JSON.stringify(i,null,2):
|
|
259
|
-
`),e&&!r&&await
|
|
260
|
-
${
|
|
261
|
-
`)}function
|
|
262
|
-
`)},n=>{process.stderr.write(`${
|
|
263
|
-
`),process.exit(1)})}import{randomUUID as
|
|
264
|
-
`).some(t=>t.includes('"kind":"rrweb"')):!1}var
|
|
248
|
+
`);var Bo=" \u203A ",Sc=["fact ","data rule ","step "];function Go(e){if(e.failures.length===0)return xc(e);let r=e.viewport==null?"":` (viewport ${String(e.viewport.width)}\xD7${String(e.viewport.height)})`,n=`${e.runId} \u2014 ${M(e.failures.length,"failing check")}${r}`,t=e.lockfileLoaded?[]:[u.dim("(no lockfile \u2014 workflow source unavailable)")],o=e.progress.at(-1),i=o==null?[]:[u.dim(`last progress \u2014 ${sr(o.signal)}`)],s=Rc(e.failures).map(a=>Cc(a,e.runId));return[n,...t,...i,"",...s,x("tasks")].join(`
|
|
249
|
+
`)}function Ko(e){return`${u.bad("fail")} \u2014 no artifacts for ${e.runId}. Run \`npx ripplo pull ${e.runId}\` first.`}function xc(e){if(e.stepsRan>0)return`${u.good("ok")} \u2014 ${e.runId}: no failing checks.`;let r=e.progress.at(-1),n=r==null?"":` It stopped at: ${sr(r.signal)}.`;return`${e.runId}: no steps ran, so there are no checks to explain.${n} A run that ends this early failed before its first step \u2014 setup, sign-in, or reaching your app. The reason is on the run itself, not in this artifact.`}function Rc(e){return[...new Set(e.map(n=>n.step))].map(n=>({failures:e.filter(t=>t.step===n),step:n}))}function Cc(e,r){let n=e.failures[0];if(n==null)return"";let t=Ec(e,r);if(t!=null)return t;let o=[...new Set(e.failures.map(s=>s.error==null?Qo(s.label):Q(s.error)))].join(", "),i=u.dim(`(${n.runWorkflow})`);return[`${u.bad("\u2717")} ${Pc(e.step)} ${i}`,` ${u.dim("failed")} ${o}`,...Ic(e),...Mc(n),...Lc(n.causes),` ${u.dim("frame")} npx ripplo snapshot ${r} --at ${String(n.snapshotAt)}`,""].join(`
|
|
250
|
+
`)}function Ec(e,r){let n=e.failures[0],t=e.failures.flatMap(c=>c.browserMismatch==null?[]:[c.browserMismatch])[0],o=Jo(e.failures.flatMap(c=>c.rules));if(n==null||t==null||o.length===0)return null;let i=Qo(e.failures.find(c=>c.rules.length>0)?.label??n.label),s=[...new Set(o.map(c=>c.url))].join(", "),a=u.dim(`(${n.runWorkflow})`);return[`${u.bad("\u2717")} ${i} ${u.warn("(wrong page)")} ${a}`,` ${u.dim("rule declared for url")} ${s}`,` ${u.dim("browser was actually at")} ${t.actual}`,` ${u.warn("\u21B3 declare the navigation: add url.path`...` to the step that caused it")}`,` ${u.dim("frame")} npx ripplo snapshot ${r} --at ${String(n.snapshotAt)}`,""].join(`
|
|
251
|
+
`)}function Jo(e){let r=e.map(n=>[$c(n),n]);return[...new Map(r).values()]}function $c(e){return`${e.url}|${e.when}|${e.origins.map(r=>r.intent).join(",")}`}function Qo(e){let r=Sc.find(n=>e.startsWith(n));return r==null?e:e.slice(r.length)}function Pc(e){let r=e.split(Bo);return r.length<2?e:r.slice(1).join(Bo)}function Ic(e){let r=Jo(e.failures.flatMap(n=>n.rules));return r.length===0?[]:[...r.flatMap(n=>Ac(n)),...jc(e,r)]}function Ac(e){let r=e.origins.length===0?u.dim("origin not in lockfile"):e.origins.map(n=>Tc(n)).join(", ");return[` ${u.dim("workflow declaration")}`,` ${u.dim("from")} ${r}`,` ${u.dim("at")} ${e.url} ${u.dim("\u2014 holds only when")} ${e.when}`]}function Tc(e){if(e.sourcePath==null)return e.intent;let r=u.dim(`(${e.sourcePath})`);return`${e.intent} ${r}`}function jc(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?[]:[` ${u.warn("\u21B3 declared by another workflow \u2014 this declaration may be missing distinguishing state")}`]}function Mc(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[` ${u.dim("waited")} up to ${r} (wait: ${e.wait})${n}`]}function Lc(e){if(e.length===0)return[];let r=Oc(e),n=e.flatMap(t=>Nc(t,r));return n.length===0?[]:[` ${u.dim("nearby")} ${n.join(" \xB7 ")}`]}function Oc(e){let r=e.flatMap(n=>n.detail.kind==="span"&&n.detail.traceId!=null?[[n.detail.traceId,n.detail]]:[]);return new Map(r)}function Nc(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 ${$r(t)}`;return[zo(n,`${$r(n)}${o}`)]}return[zo(n,$r(n))]}function $r(e){return e.kind==="network"?`${e.method} ${String(e.status)} ${Fc(e.url)}`:e.kind==="console"?`console.${e.level} ${Ho(e.text)}`:e.kind==="error"?`error ${Ho(e.message)}`:`span ${e.name} ${e.statusCode} ${String(Math.round(e.durationMs))}ms`}function Fc(e){let r=e.split("?")[0]??e;return r.length>60?`\u2026${r.slice(-57)}`:r}function Ho(e){let r=e.replaceAll(/\s+/g," ").trim();return r.length>100?`${r.slice(0,97)}\u2026`:r}function zo(e,r){return Wc(e)?u.bad(r):r}function Wc(e){return e.kind==="network"?e.status>=400:e.kind==="console"?e.level==="error":e.kind==="error"||e.statusCode==="error"}function Zo(e){return[Dc(e.test),"",Uc(e.factOrigins),Vc(e.timeline,e.factOrigins)].filter(r=>r.length>0).join(`
|
|
252
|
+
`)}function Dc(e){return e==null?u.dim("starting state (couldn't resolve the run's test \u2014 offline, or it left the model)"):["starting state",...[` - ${String(e.startingState.operations.length)} setup operations`,` - ${String(e.startingState.constraints.length)} state constraints`,` - actor: ${_c(e)}`]].join(`
|
|
253
|
+
`)}function _c(e){return e.actor.kind==="user"?`signed in as ${e.actor.alias}`:"signed out"}function Uc(e){return e.length===0?"":["facts checked here were declared in",...e.map(n=>` - ${n}`),""].join(`
|
|
254
|
+
`)}function Vc(e,r){return e.length===0?u.dim("timeline (no steps captured)"):["what happened, step by step",...e.map(t=>qc(t,r))].join(`
|
|
255
|
+
`)}function qc(e,r){let n=` ${String(e.index+1)}. ${e.title}${Bc(e.workflow)}${Hc(e.url)}`,t=e.changes.length===0?[]:[` \u0394 ${e.changes.join(", ")}`],o=e.failures.map(s=>` ${u.bad("\u2717")} ${zc(s,r)}`),i=e.checksHeld===0?[]:[u.dim(` ${String(e.checksHeld)} checks held`)];return[n,...t,...o,...i].join(`
|
|
256
|
+
`)}function Bc(e){if(e==null)return"";let r=`(${e})`;return` ${u.dim(r)}`}function Hc(e){if(e==null)return"";let r=`@ ${e}`;return` ${u.dim(r)}`}function zc(e,r){switch(e.kind){case"check":{let n=e.event.origin.kind==="fact"?Gc(r):"";return`${wn(e.event)}${n}`}case"stepError":return`run error \u2014 ${Q(e.event.error)}`;case"finding":return Kc(e.payload)}}function Gc(e){if(e.length===0)return"";let r=`(fact from ${e.join(", ")})`;return` ${u.dim(r)}`}function Kc(e){switch(e.kind){case"unrunnable":{let r=e.unmet==null?"":`: needs ${e.unmet}`;return`couldn't run \u2014 ${e.reason}${r}`}case"impossibleAction":return`impossible action: ${e.action} on ${e.subject}`;case"liftVisibility":{let r=String(e.visibleIndex+1),n=String(e.declaredIndex+1);return`${e.subject} visible by step ${r} but declared at step ${n}`}}}function Xo(e){return`Saved behavior.jsonl to ${e.path}`}function U(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 Yo({full:e,json:r,runId:n}){let t=process.cwd(),o=await _(t,n);o.isErr()&&(process.stderr.write(`${U(o.error)}
|
|
257
|
+
`),process.exit(1));let i=Wo(t,n).match(s=>s,s=>(process.stderr.write(`${Ko(s)}
|
|
258
|
+
`),process.exit(1)));process.stdout.write(`${r?JSON.stringify(i,null,2):Go(i)}
|
|
259
|
+
`),e&&!r&&await Jc(t,n,Qc(i))}async function Jc(e,r,n){let t=y(e).unwrapOr(void 0);if(t==null)return;let o=await qo(e,r,t);process.stdout.write(`
|
|
260
|
+
${Zo({...o,factOrigins:n})}
|
|
261
|
+
`)}function Qc(e){let r=e.failures.filter(n=>n.ruleKind==="fact").flatMap(n=>n.rules).flatMap(n=>n.origins).map(n=>n.sourcePath==null?n.intent:`${n.intent} (${n.sourcePath})`);return[...new Set(r)]}async function ei({runId:e}){(await We(process.cwd(),e)).match(n=>{process.stdout.write(`${Xo(n)}
|
|
262
|
+
`)},n=>{process.stderr.write(`${U(n)}
|
|
263
|
+
`),process.exit(1)})}import{randomUUID as Zc}from"crypto";import{existsSync as Xc,readFileSync as Yc}from"fs";import Pr from"path";import{graphql as ni}from"gql.tada";import{err as _e,ok as ri}from"neverthrow";async function ti(e,r,n){let t=eu(e);if(t.kind==="error")return _e(t.error);let o=t.config,i=await ge(e);if(i.result.isErr())return _e({kind:"compile-failed"});let s=await ru({config:o,runId:r});if(s.kind==="error")return _e(s.error);let{repro:a,reproJson:l}=s,c=await X(e,i.result.value),g=Mn(c);await jn({config:o,cwd:e,lockfile:c});let m=`replay-${Zc()}`,p=Pr.join(e,".ripplo","debug"),$=[],T=ke({cacheDir:void 0,clientVersion:w(),debugDir:p,headed:!1,writeOtlpPortFile:!1});try{let E=await $n({capture:!0,lockfile:c,options:{baseUrl:o.appUrl,engineUrl:o.engineUrl,fixturesDir:Pr.join(e,se),generate:nn,headed:!1,secret:o.webhookSecret},repro:a,runId:m,session:T,signal:n,onEvent:v=>{$.push(v)}});return(await tu({config:o,debugDir:p,events:$,lockfileHash:g,outcome:E,replayRunId:m,reproJson:l,stepSources:nu({lockfile:c,repro:a})})).map(()=>({outcome:E,recordingCaptured:ou(p,m),replayRunId:m}))}finally{await T.close()}}function eu(e){return y(e).match(r=>({config:r,kind:"found"}),r=>({error:{detail:r.kind,kind:"config"},kind:"error"}))}async function ru({config:e,runId:r}){let n=await d({config:e,document:iu,variables:{id:r}}).catch(()=>null);if(n==null)return{error:{kind:"request-failed"},kind:"error"};if(n.run==null)return{error:{kind:"not-found"},kind:"error"};let t=n.run.reproJson;if(t==null)return{error:{kind:"no-repro"},kind:"error"};let o=he(t);return o.kind==="rejected"?{error:{kind:"stale-repro",reason:"format-unsupported"},kind:"error"}:{kind:"found",repro:o.repro,reproJson:t}}function nu({lockfile:e,repro:r}){let n=gn(e);return r.steps.map(t=>n.find(o=>o.id===t.transitionId)?.test??null)}async function tu({config:e,debugDir:r,events:n,lockfileHash:t,outcome:o,replayRunId:i,reproJson:s,stepSources:a}){if(o.kind!=="resolved"&&o.kind!=="still-fails")return ri(void 0);try{return await d({config:e,document:su,variables:{lockfileHash:t,projectId:e.projectId,reproJson:s,runId:i}}),await Ct({config:e,debugDir:r,events:n,recordingOptional:!0,runId:i,stepSources:a}),await ee({config:e,debugDir:r,runId:i}),ri(void 0)}catch{return _e({kind:"report-failed"})}}function ou(e,r){let n=Pr.join(e,r,"behavior.jsonl");return Xc(n)?Yc(n,"utf8").split(`
|
|
264
|
+
`).some(t=>t.includes('"kind":"rrweb"')):!1}var iu=ni(`
|
|
265
265
|
query RunRepro($id: String!) {
|
|
266
266
|
run(id: $id) {
|
|
267
267
|
id
|
|
268
268
|
reproJson
|
|
269
269
|
}
|
|
270
270
|
}
|
|
271
|
-
`),
|
|
271
|
+
`),su=ni(`
|
|
272
272
|
mutation CreateReplayRun(
|
|
273
273
|
$projectId: String!
|
|
274
274
|
$runId: String!
|
|
@@ -284,11 +284,11 @@ ${_o({...o,factOrigins:n})}
|
|
|
284
284
|
id
|
|
285
285
|
}
|
|
286
286
|
}
|
|
287
|
-
`);function
|
|
287
|
+
`);function oi({outcome:e,recordingCaptured:r,replayRunId:n}){let t=au(e);if(e.kind!=="resolved"&&e.kind!=="still-fails")return t;let o=r?"":"\n! No page recording was captured \u2014 the page may never have loaded. Treat this verdict with suspicion and confirm with `npx ripplo run`.",i=e.kind==="resolved"?`
|
|
288
288
|
! A clean replay confirms the fix but doesn't explain the original failure. Classify the root cause \u2014 app bug or model gap \u2014 before you resolve. Don't file it as flake unless you know why it flaked.`:"";return`${t}${o}${i}
|
|
289
|
-
Replay run ${n} \u2014 snapshot it, or cite it as resolve proof: \`npx ripplo tasks resolve <id> --run ${n}\`.`}function
|
|
290
|
-
`),process.exit(
|
|
291
|
-
`),process.exit(1)})}import
|
|
289
|
+
Replay run ${n} \u2014 snapshot it, or cite it as resolve proof: \`npx ripplo tasks resolve <id> --run ${n}\`.`}function au(e){switch(e.kind){case"resolved":return"\u2713 Resolved \u2014 the finding's trail ran clean.";case"still-fails":return`\u2717 Still failing \u2014 ${M(e.contradictions.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 ii(e){switch(e.kind){case"config":return`Can't read project config (${e.detail}). Run from your project root.`;case"compile-failed":return"Couldn't compile the local `.ripplo/` model. Run `npx ripplo compile` first.";case"request-failed":return"Couldn't reach the server. Check you're signed in with `npx ripplo auth`.";case"not-found":return"No run with that id.";case"no-repro":return"This run has no replayable trail \u2014 predates repro capture, or isn't an explore finding.";case"report-failed":return"The replay finished but couldn't be registered with the server, so its id won't work as resolve proof. Check you're signed in, then rerun `npx ripplo replay`.";case"stale-repro":return"This finding uses an older explorer trail format and cannot be replayed. Let the explorer reconcile stale findings."}}function si(e){return e.kind==="resolved"}async function ai({runId:e}){(await ti(process.cwd(),e,new AbortController().signal)).match(n=>{process.stdout.write(`${oi(n)}
|
|
290
|
+
`),process.exit(si(n.outcome)?0:1)},n=>{process.stderr.write(`${ii(n)}
|
|
291
|
+
`),process.exit(1)})}import ui from"path";import{existsSync as fu}from"fs";import{writeFile as li}from"fs/promises";import di from"path";import{err as ce,ok as gu}from"neverthrow";import{readFile as lu}from"fs/promises";import{z as de}from"zod";var du={height:800,width:1280};async function Ue(e){let r=await lu(e,"utf8");return K(r).flatMap(n=>n.kind==="rrweb"?[n.event]:[])}var cu=de.object({data:de.looseObject({height:de.number(),width:de.number()}),type:de.literal(4)});function oe(e){let r=e.flatMap(n=>{let t=cu.safeParse(n);return t.success?[t.data]:[]})[0];return r==null?du:{height:r.data.height,width:r.data.width}}var uu='<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>',pu=`.replayer-mouse-tail { display: none; }
|
|
292
292
|
.replayer-mouse {
|
|
293
293
|
position: absolute;
|
|
294
294
|
width: 17px;
|
|
@@ -296,28 +296,37 @@ Replay run ${n} \u2014 snapshot it, or cite it as resolve proof: \`npx ripplo ta
|
|
|
296
296
|
z-index: 9999;
|
|
297
297
|
background-repeat: no-repeat;
|
|
298
298
|
background-size: contain;
|
|
299
|
-
background-image: url('data:image/svg+xml;utf8,${
|
|
300
|
-
}`,
|
|
299
|
+
background-image: url('data:image/svg+xml;utf8,${uu}');
|
|
300
|
+
}`,mu=".replayer-mouse, .replayer-mouse-tail { display: none; }";function Ve(e){return`<!doctype html><html><head><style>
|
|
301
301
|
html, body { margin: 0; padding: 0; }
|
|
302
302
|
.replayer-wrapper { position: relative; }
|
|
303
|
-
${e?
|
|
303
|
+
${e?pu:mu}
|
|
304
304
|
iframe { border: none; }
|
|
305
|
-
</style></head><body></body></html>`}
|
|
305
|
+
</style></head><body></body></html>`}function qe(){return`(() => {
|
|
306
|
+
const doc = document.querySelector(".replayer-wrapper iframe")?.contentDocument;
|
|
307
|
+
if (doc == null || doc.querySelector("style[data-ripplo-replay-styles]") != null) {
|
|
308
|
+
return;
|
|
309
|
+
}
|
|
310
|
+
const style = doc.createElement("style");
|
|
311
|
+
style.setAttribute("data-ripplo-replay-styles", "");
|
|
312
|
+
style.textContent = ${JSON.stringify(un.join(`
|
|
313
|
+
`))};
|
|
314
|
+
(doc.head ?? doc.documentElement).appendChild(style);
|
|
315
|
+
})()`}function Be(){return`(async () => {
|
|
306
316
|
const doc = document.querySelector(".replayer-wrapper iframe")?.contentDocument;
|
|
307
317
|
if (doc?.fonts != null) {
|
|
308
318
|
await doc.fonts.ready;
|
|
309
319
|
}
|
|
310
320
|
await new Promise((resolve) => requestAnimationFrame(() => requestAnimationFrame(resolve)));
|
|
311
|
-
})()`}function
|
|
321
|
+
})()`}function He(){return import("playwright").then(({chromium:e})=>e.launch({args:["--no-sandbox"],headless:!0})).catch(()=>null)}var ze=Rn(xn("@ripplo/rrweb-bundle/replay","rrweb-replay.js"));async function ci({jsonlPath:e,moment:r,outDir:n,runId:t}){if(!fu(e))return ce({kind:"run-not-found",runId:t});let o=await Ue(e),i=o[0],s=o.at(-1);if(i==null||s==null)return ce({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 ce({durationMs:a,firstTimestamp:i.timestamp,kind:"moment-out-of-range",lastTimestamp:s.timestamp,moment:r});let c=Math.min(l,a),g=String(Math.round(c)),m=di.join(n,`snapshot-${g}ms.png`),p=di.join(n,`snapshot-${g}ms.html`);return(await yu({events:o,htmlPath:p,offsetMs:c,pngPath:m})).map(()=>({durationMs:a,htmlPath:p,offsetMs:c,pngPath:m,viewport:oe(o)}))}async function yu({events:e,htmlPath:r,offsetMs:n,pngPath:t}){let o=await He();if(o==null)return ce({detail:"chromium launch",kind:"browser-failed"});try{let{html:i,png:s}=await hu({browser:o,events:e,offsetMs:n});return await li(t,s),await li(r,i,"utf8"),gu(void 0)}catch(i){return ce({detail:i instanceof Error?i.message:String(i),kind:"browser-failed"})}finally{await o.close()}}async function hu({browser:e,events:r,offsetMs:n}){let t=oe(r),o=await e.newPage({viewport:t});await o.setContent(Ve(!1)),await o.addScriptTag({content:await ze()}),await o.evaluate(ku({events:r,offsetMs:n})),await o.evaluate(qe()),await o.evaluate(Be());let i=o.locator(".replayer-wrapper iframe").first(),a=await(await i.count()>0?i:o).screenshot({type:"png"});return{html:await o.evaluate(wu()),png:a}}function ku({events:e,offsetMs:r}){return`(() => {
|
|
312
322
|
const replayer = new globalThis.__RipploReplayer(${JSON.stringify(e)}, {
|
|
313
|
-
insertStyleRules: [${JSON.stringify(Yo)}],
|
|
314
323
|
mouseTail: false,
|
|
315
324
|
root: document.body,
|
|
316
325
|
showWarning: false,
|
|
317
326
|
});
|
|
318
327
|
replayer.pause(${String(r+.5)});
|
|
319
328
|
globalThis.__ripploSnapshotReplayer = replayer;
|
|
320
|
-
})()`}function
|
|
329
|
+
})()`}function wu(){return`(() => {
|
|
321
330
|
const replayer = globalThis.__ripploSnapshotReplayer;
|
|
322
331
|
if (replayer == null) {
|
|
323
332
|
return "";
|
|
@@ -335,44 +344,56 @@ iframe { border: none; }
|
|
|
335
344
|
}
|
|
336
345
|
});
|
|
337
346
|
return "<!doctype html>\\n" + doc.documentElement.outerHTML;
|
|
338
|
-
})()`}function
|
|
339
|
-
`)}function
|
|
340
|
-
`),process.exit(1));let o=await
|
|
341
|
-
`),process.exit(1)),(await
|
|
342
|
-
`)},s=>{process.stderr.write(`${
|
|
343
|
-
`),process.exit(1)})}function
|
|
347
|
+
})()`}function pi({cwd:e,moment:r,runId:n}){let t=ui.join(e,".ripplo","debug",n);return ci({jsonlPath:ui.join(t,"behavior.jsonl"),moment:r,outDir:t,runId:n})}function mi(e){return[`${u.good("ok")} \u2014 rendered the page at ${String(Math.round(e.offsetMs))}ms into the recording (duration ${String(Math.round(e.durationMs))}ms, viewport ${String(e.viewport.width)}\xD7${String(e.viewport.height)})`,e.pngPath,"Read the PNG above to see the page state. Layout and text are faithful \u2014 URL-referenced images may be blank if the dev server is down.",e.htmlPath,"The HTML is the same frame with every element tagged `data-rrweb-id`. Grep it for your element's class or text to get the id for `tasks comment --element`."].join(`
|
|
348
|
+
`)}function fi(e){return`${u.bad("fail")} \u2014 ${bu(e)}`}function gi(){return`${u.bad("fail")} \u2014 pass exactly one of --at <epoch-ms from behavior.jsonl> or --offset <ms from the start of the recording>.`}function bu(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 yi({at:e,offset:r,runId:n}){let t=vu({at:e,offset:r});t==null&&(process.stderr.write(`${gi()}
|
|
349
|
+
`),process.exit(1));let o=await _(process.cwd(),n);o.isErr()&&(process.stderr.write(`${U(o.error)}
|
|
350
|
+
`),process.exit(1)),(await pi({cwd:process.cwd(),moment:t,runId:n})).match(s=>{process.stdout.write(`${mi(s)}
|
|
351
|
+
`)},s=>{process.stderr.write(`${fi(s)}
|
|
352
|
+
`),process.exit(1)})}function vu({at:e,offset:r}){if(e!=null&&r==null)return{at:e,kind:"absolute"};if(r!=null&&e==null)return{kind:"offset",offsetMs:r}}import wi from"path";import{spawn as Su}from"child_process";import{existsSync as xu}from"fs";import{mkdtemp as Ru,rm as Cu,writeFile as Eu}from"fs/promises";import $u from"os";import Ge from"path";import{err as H,ok as hi}from"neverthrow";var Ke=12;async function ki({ffmpegPath:e,jsonlPath:r,outDir:n,runId:t}){if(!xu(r))return H({kind:"run-not-found",runId:t});let o=await Ue(r),i=o[0],s=o.at(-1);if(i==null||s==null)return H({kind:"no-rrweb-events",runId:t});let a=s.timestamp-i.timestamp,l=Pu(a),c=Ge.join(n,"replay.mp4"),g=await Ru(Ge.join($u.tmpdir(),"ripplo-video-"));try{let m=await Iu({events:o,framesDir:g,offsets:l});return m.isErr()?H(m.error):(await Lu({ffmpegPath:e,framesDir:g,mp4Path:c})).map(()=>({durationMs:a,frameCount:l.length,mp4Path:c,viewport:oe(o)}))}finally{await Cu(g,{force:!0,recursive:!0})}}function Pu(e){let r=1e3/Ke,n=Math.max(1,Math.floor(e/r)+1);return Array.from({length:n},(t,o)=>Math.min(o*r,e))}async function Iu({events:e,framesDir:r,offsets:n}){let t=await He();if(t==null)return H({detail:"chromium launch",kind:"browser-failed"});try{return await Au({browser:t,events:e,framesDir:r,offsets:n}),hi(void 0)}catch(o){return H({detail:o instanceof Error?o.message:String(o),kind:"browser-failed"})}finally{await t.close()}}async function Au({browser:e,events:r,framesDir:n,offsets:t}){let o=await e.newPage({viewport:oe(r)});await o.setContent(Ve(!0)),await o.addScriptTag({content:await ze()}),await o.evaluate(Tu(r)),await o.evaluate(Be());let i=o.locator(".replayer-wrapper").first(),s=await i.count()>0?i:o;await t.reduce(async(a,l,c)=>{await a,await o.evaluate(ju(l)),await o.evaluate(qe());let g=await s.screenshot({type:"png"});await Eu(Ge.join(n,Mu(c)),g)},Promise.resolve())}function Tu(e){return`(() => {
|
|
353
|
+
const replayer = new globalThis.__RipploReplayer(${JSON.stringify(e)}, {
|
|
354
|
+
mouseTail: false,
|
|
355
|
+
root: document.body,
|
|
356
|
+
showWarning: false,
|
|
357
|
+
});
|
|
358
|
+
replayer.pause(0.5);
|
|
359
|
+
globalThis.__ripploVideoReplayer = replayer;
|
|
360
|
+
})()`}function ju(e){return`globalThis.__ripploVideoReplayer.pause(${String(e+.5)})`}function Mu(e){return`frame-${String(e).padStart(5,"0")}.png`}async function Lu({ffmpegPath:e,framesDir:r,mp4Path:n}){try{let{code:t,stderr:o}=await Ou({ffmpegPath:e,framesDir:r,mp4Path:n});return t===0?hi(void 0):H({detail:o.trim().slice(-400),kind:"encode-failed"})}catch(t){return H({detail:t instanceof Error?t.message:String(t),kind:"encode-failed"})}}function Ou({ffmpegPath:e,framesDir:r,mp4Path:n}){return new Promise((t,o)=>{let i=["-y","-framerate",String(Ke),"-i",Ge.join(r,"frame-%05d.png"),"-c:v","libx264","-pix_fmt","yuv420p","-vf","pad=ceil(iw/2)*2:ceil(ih/2)*2",n],s=Su(e,i,{stdio:["ignore","ignore","pipe"]}),a=[];s.stderr.on("data",l=>a.push(l)),s.on("error",o),s.on("close",l=>{t({code:l,stderr:Buffer.concat(a).toString("utf8")})})})}import bi from"ffmpeg-static";import{err as Nu}from"neverthrow";async function vi({cwd:e,runId:r}){if(bi==null)return Nu({kind:"ffmpeg-missing"});let n=wi.join(e,".ripplo","debug",r);return ki({ffmpegPath:bi,jsonlPath:wi.join(n,"behavior.jsonl"),outDir:n,runId:r})}function Si(e){return[`${u.good("ok")} \u2014 rendered ${String(e.frameCount)} frames at ${String(Ke)} fps (duration ${String(Math.round(e.durationMs))}ms, viewport ${String(e.viewport.width)}\xD7${String(e.viewport.height)})`,e.mp4Path,"The MP4 covers the whole recording. Layout and text are faithful \u2014 URL-referenced images may be blank if the dev server is down."].join(`
|
|
361
|
+
`)}function xi(e){return`${u.bad("fail")} \u2014 ${Fu(e)}`}function Fu(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"browser-failed":return`replay browser failed (${e.detail}). Is chromium installed? Try \`npx playwright install chromium\`.`;case"encode-failed":return`ffmpeg failed to encode the video (${e.detail}).`;case"ffmpeg-missing":return"the bundled ffmpeg has no binary for this platform. Install ffmpeg and set FFMPEG_BIN to its path."}}async function Ri({runId:e}){let r=await _(process.cwd(),e);r.isErr()&&(process.stderr.write(`${U(r.error)}
|
|
362
|
+
`),process.exit(1)),(await vi({cwd:process.cwd(),runId:e})).match(t=>{process.stdout.write(`${Si(t)}
|
|
363
|
+
`)},t=>{process.stderr.write(`${xi(t)}
|
|
364
|
+
`),process.exit(1)})}function Ci(e,r){switch(e.kind){case"config-failed":return S(e.failure);case"compile-failed":return Y(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: ${Q(e.error)}`;case"done":return Wu(e.result,r)}}function Ei(e){return e.kind==="done"&&e.result.kind==="handed-over"}function $i(e,r){return`landed at step ${String(e)} of ${r} \u2014 close the window to tear down`}function Wu(e,r){return e.kind==="failed"?`couldn't reach the step \u2014 the run failed first.
|
|
344
365
|
|
|
345
|
-
${e.contradictions.map(t=>
|
|
366
|
+
${e.contradictions.map(t=>kn({contradiction:t,evidencePath:void 0})).join(`
|
|
346
367
|
|
|
347
|
-
`)}`:`torn down \u2014 teleport session for ${r} ended`}async function
|
|
348
|
-
`)},o=await
|
|
349
|
-
`),process.exit(
|
|
350
|
-
`)}async function
|
|
351
|
-
`),process.exit(
|
|
352
|
-
`)}import{existsSync as
|
|
353
|
-
`)}function
|
|
354
|
-
`),process.exit(
|
|
355
|
-
`),process.exit(1)});process.stdout.write(`Synced ${String(n.lockfile.workflows.length)} workflows to dev session ${n.devSessionId}
|
|
368
|
+
`)}`:`torn down \u2014 teleport session for ${r} ended`}async function Pi({ref:e,step:r}){let n=new AbortController;process.once("SIGINT",()=>{n.abort()});let t=()=>{process.stdout.write(`${$i(r,e)}
|
|
369
|
+
`)},o=await At({cwd:process.cwd(),onReady:t,signal:n.signal,step:r,target:{kind:"test",ref:e}});process.stdout.write(`${Ci(o,e)}
|
|
370
|
+
`),process.exit(Ei(o)?0:1)}import Ii from"path";import{randomUUID as Du}from"crypto";async function Ai({cwd:e,onReady:r,signal:n}){let t=y(e).match(s=>s,s=>s.kind);if(typeof t=="string")return{detail:t,kind:"config-failed"};let o=`capture-${Du()}`;return(await Cn({clientVersion:w(),debugDir:Ii.join(t.cwd,".ripplo","debug"),onReady:r,profileDir:Ii.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 Ti(){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 ji(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.":_u(e.behaviorPath,e.runId)}function Mi(e){return e.kind==="done"}function _u(e,r){return[`Capture saved to ${e}`,"","Paste this to Claude Code to model the journey:",""," Load /ripplo:create. Turn this session into one critical Ripplo user journey under .ripplo/workflows/.","",` 1. Run \`npx ripplo clickpath ${r}\`. Name the user's intent, natural entry point, and actions that belong to that intent. Omit capture detours that are not part of the journey.`,` 2. Read ${e} for state-source requests and spans. Add only relevant paths to .ripplo/state.ts. Write the widest starting-state constraints valid for the whole journey.`," 3. Keep state-rendered values connected through handles and arbitrary(field). Use exact(value) only when the literal drives behavior."," 4. Declare every visible outcome and complete state effect, including cascades. Make every effect provably change state."," 5. Run `npx ripplo compile`, complete the /ripplo:create generality audit, then run the workflow."].join(`
|
|
371
|
+
`)}async function Li(){let e=new AbortController;process.once("SIGINT",()=>{e.abort()});let r=await Ai({cwd:process.cwd(),onReady:Uu,signal:e.signal});process.stdout.write(`${ji(r)}
|
|
372
|
+
`),process.exit(Mi(r)?0:1)}function Uu(){process.stdout.write(`${Ti()}
|
|
373
|
+
`)}import{existsSync as Vu,readFileSync as qu}from"fs";import Bu from"path";function Oi(e,r){let n=Bu.join(e,".ripplo","debug",r,"behavior.jsonl");return Vu(n)?{actions:En(qu(n,{encoding:"utf8"})),kind:"ok"}:{kind:"not-found",runId:r}}function Ni(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)=>Hu(r,n)).join(`
|
|
374
|
+
`)}function Fi(e){return e.kind==="ok"}function Hu(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 Wi({runId:e}){let r=Oi(process.cwd(),e);process.stdout.write(`${Ni(r)}
|
|
375
|
+
`),process.exit(Fi(r)?0:1)}async function Di(){let e=b();try{let n=(await ae(e.cwd,e)).match(t=>t,t=>{process.stderr.write(`${S(t)}
|
|
376
|
+
`),process.exit(1)});await I("lockfile_synced"),process.stdout.write(`Synced ${String(n.lockfile.workflows.length)} workflows to dev session ${n.devSessionId}
|
|
356
377
|
`)}catch(r){let n=r instanceof Error?r.message:String(r);process.stderr.write(`ripplo sync failed: ${n}
|
|
357
|
-
`),process.stderr.write(`${
|
|
358
|
-
`),process.exit(1)}}import{spawnSync as
|
|
359
|
-
`),n==null&&(process.stderr.write(`${
|
|
360
|
-
`),process.exit(1)),
|
|
361
|
-
`),process.stdout.write(`${
|
|
362
|
-
`),process.exit(0));let t=r==null?"global":
|
|
363
|
-
`),await
|
|
364
|
-
`)}function
|
|
365
|
-
`),process.exit(0)),r==="local"){let n=process.cwd(),t=
|
|
366
|
-
`),process.exit(0)}if(r==="npx"){let n=
|
|
367
|
-
`);return}
|
|
368
|
-
`),process.exit(1)}process.stdout.write(`${
|
|
369
|
-
`)}async function
|
|
370
|
-
`)}async function
|
|
371
|
-
`),n.kind!=="timeout"}function
|
|
372
|
-
`)}function
|
|
373
|
-
`),process.exit(1)});(e==null?await
|
|
374
|
-
`)},t=>{process.stderr.write(`${
|
|
375
|
-
`),process.exit(1)})}import{spawnSync as
|
|
378
|
+
`),process.stderr.write(`${x("setup","verify auth + server reachability")}
|
|
379
|
+
`),process.exit(1)}}import{spawnSync as Ju}from"child_process";import Qu from"fs";import Zu from"path";import Xu from"semver";import ue from"fs";import zu from"os";import z from"path";function _i(e){let r=e.split(z.sep);return r.includes("_npx")?"npx":e.includes(z.join("packages","cli"))?"workspace":Gu(r)?"local":"global"}function Ui(){let e=z.join(zu.homedir(),".npm","_npx");return ue.existsSync(e)?ue.readdirSync(e).map(r=>z.join(e,r)).filter(r=>ue.existsSync(z.join(r,"node_modules","ripplo"))).map(r=>(ue.rmSync(r,{force:!0,recursive:!0}),r)):[]}function Gu(e){let r=e.lastIndexOf("node_modules");if(r<1)return!1;let n=e.slice(0,r).join(z.sep);return ue.existsSync(z.join(n,"package.json"))}import{spawnSync as Vi}from"child_process";var Ku=["user","project","local"];function Ir(){return Vi("claude",["--version"],{stdio:"ignore"}).error!=null?"claude-missing":Ku.find(n=>Vi("claude",["plugin","update","ripplo","--scope",n],{stdio:"ignore"}).status===0)==null?"not-installed":"updated"}function qi(e){return`ripplo v${e} is already the latest version.`}function Bi(e){return`ripplo v${e}: could not reach the npm registry to check for updates.`}function Ar({evicted:e,latest:r,mode:n}){return n==="npx"?`ripplo: ${e===0?"npx cache had no stale copy":`cleared ${M(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 Hi(){return"ripplo: this is a workspace build (packages/cli/dist) \u2014 update via git pull + `pnpm --filter ripplo build`."}function zi(e){return`ripplo: installed as a project dependency \u2014 update it with your package manager: \`${e}\``}function Gi(e){return`ripplo: \`npm install -g ripplo@latest\` failed: ${e}`}function Tr(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 Ki(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 Yu=1e4;async function Ji(){let e=w(),r=process.argv[1];ep(process.cwd());let n=await Ee(Yu);process.stdout.write(`${Re({current:e,latest:n})}
|
|
380
|
+
`),n==null&&(process.stderr.write(`${Bi(e)}
|
|
381
|
+
`),process.exit(1)),Xu.gt(n,e)||(process.stdout.write(`${qi(e)}
|
|
382
|
+
`),process.stdout.write(`${Tr(Ir())}
|
|
383
|
+
`),process.exit(0));let t=r==null?"global":_i(r);rp({latest:n,mode:t}),process.stdout.write(`${Tr(Ir())}
|
|
384
|
+
`),await tp(process.cwd()),process.exit(0)}function ep(e){if(!Qu.existsSync(Zu.join(e,".ripplo")))return;let r=Ae(e);r==="written"&&process.stdout.write(`${Te(r).trim()}
|
|
385
|
+
`)}function rp({latest:e,mode:r}){if(r==="workspace"&&(process.stdout.write(`${Hi()}
|
|
386
|
+
`),process.exit(0)),r==="local"){let n=process.cwd(),t=fr({cwd:n,pm:gr(n),version:e});process.stdout.write(`${zi(t)}
|
|
387
|
+
`),process.exit(0)}if(r==="npx"){let n=Ui();process.stdout.write(`${Ar({evicted:n.length,latest:e,mode:r})}
|
|
388
|
+
`);return}np(e)}function np(e){let r=`ripplo@${e}`,n=Ju("npm",["install","-g",r],{stdio:"inherit"});if(n.status!==0){let t=`exit ${String(n.status)}`;process.stderr.write(`${Gi(t)}
|
|
389
|
+
`),process.exit(1)}process.stdout.write(`${Ar({evicted:0,latest:e,mode:"global"})}
|
|
390
|
+
`)}async function tp(e){if((await Yn(e)).kind==="not-running")return;let n=await Xn(e);process.stdout.write(`${Ki(n)}
|
|
391
|
+
`)}async function Qi({action:e,exploreDebug:r}){if(e==="status"){let{statusCommand:t}=await import("./status-CNSPYNYP.js");await t({format:"summary"});return}if(e==="stop"||e==="restart"){let t=await op();(e==="stop"||!t)&&process.exit(t?0:1)}ip();let{runDaemon:n}=await import("./daemon-D4UCHMHS.js");await n({exploreDebug:r})}async function op(){let{stopDevDaemon:e}=await import("./daemon-lock-RPKO5SNE.js"),{renderDaemonStopResult:r}=await import("./daemon-LZTY7W4M.js"),n=await e(process.cwd());return process.stdout.write(`${r(n)}
|
|
392
|
+
`),n.kind!=="timeout"}function ip(){let e=te(F());e!=null&&process.stderr.write(`${e}
|
|
393
|
+
`)}function Zi(e){return`executor: ${e}`}function Xi(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 Yi(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 es({mode:e}){let r=y(process.cwd()).match(t=>t,t=>{process.stderr.write(`${S(t)}
|
|
394
|
+
`),process.exit(1)});(e==null?await jt(r):await Mt(r,e)).match(t=>{process.stdout.write(`${e==null?Zi(t):Xi(t)}
|
|
395
|
+
`)},t=>{process.stderr.write(`${Yi(t)}
|
|
396
|
+
`),process.exit(1)})}import{spawnSync as yp}from"child_process";import{graphql as rs}from"gql.tada";import{err as jr,ok as Mr}from"neverthrow";var sp=rs(`
|
|
376
397
|
query ExploreState($devSessionId: String!) {
|
|
377
398
|
exploration(devSessionId: $devSessionId) {
|
|
378
399
|
active
|
|
@@ -383,7 +404,7 @@ ${e.contradictions.map(t=>an({contradiction:t,evidencePath:void 0})).join(`
|
|
|
383
404
|
unhealthySince
|
|
384
405
|
}
|
|
385
406
|
}
|
|
386
|
-
`),
|
|
407
|
+
`),ap=rs(`
|
|
387
408
|
mutation SetExploration(
|
|
388
409
|
$devSessionId: String!
|
|
389
410
|
$active: Boolean!
|
|
@@ -408,17 +429,17 @@ ${e.contradictions.map(t=>an({contradiction:t,evidencePath:void 0})).join(`
|
|
|
408
429
|
unhealthySince
|
|
409
430
|
}
|
|
410
431
|
}
|
|
411
|
-
`);async function
|
|
412
|
-
explorer is hitting infra errors \u2014 it pauses if this persists`:r}function
|
|
413
|
-
`)}function
|
|
414
|
-
`),process.exit(1)),process.stdout.write(`${e?JSON.stringify(s.analysis,null,2):
|
|
432
|
+
`);async function ns(e){let r=await os(e);if(r.isErr())return jr(r.error);let n=await is(e,r.value.id);return Mr(ss(r.value.executor,n))}async function ts(e,r){let n=await os(e);if(n.isErr())return jr(n.error);let t=await is(e,n.value.id),o=lp(n.value.executor,t,r),i=await d({config:e,document:ap,variables:{devSessionId:n.value.id,...o}});return Mr(ss(n.value.executor,i.setExploration))}async function os(e){let r=await lt(e);return r.kind==="active"?Mr({executor:r.executor,id:r.id}):jr({kind:r.kind==="starting"?"starting":"no-session"})}async function is(e,r){return(await d({config:e,document:sp,variables:{devSessionId:r}})).exploration??null}function ss(e,r){let n=e==="local";return{active:r?.active??!1,executor:e,maxTrailLength:r?.maxTrailLength??cr,unhealthy:r?.unhealthySince!=null,workers:(n?r?.localWorkers:r?.cloudWorkers)??0}}function lp(e,r,n){let t=e==="local",o=(t?r?.localWorkers:r?.cloudWorkers)??0,i=(t?r?.cloudWorkers:r?.localWorkers)??0,s=dp(n,o);return{active:n.active,autoCreateTasks:r?.autoCreateTasks??!1,cloudWorkers:t?i:s,localWorkers:t?s:i,maxTrailLength:n.trail??r?.maxTrailLength??cr}}function dp(e,r){return e.active?e.workers!=null?e.workers:r>0?r:Lt:r}function as(e){if(!e.active)return e.unhealthy?"explorer: off \u2014 paused after repeated infra errors, turn it back on with npx ripplo explore on":"explorer: off";let r=`explorer: on | ${String(e.workers)} workers | trail ${String(e.maxTrailLength)} | ${e.executor}`;return e.unhealthy?`${r}
|
|
433
|
+
explorer is hitting infra errors \u2014 it pauses if this persists`:r}function ls(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 ds(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."}var cp=32;async function cs({cwd:e,maxTrailLength:r}){let n=await ge(e);if(n.result.isErr())return{kind:"error",reason:"compile-failed"};let t=await be(e);if(t==null)return{kind:"error",reason:"no-lockfile"};let o=await X(e,n.result.value),i=vn(o);return i.kind==="model-empty"?{kind:"error",reason:"model-empty"}:{analysis:await Sn({attempts:cp,modelHash:t,prepared:i.value,strategy:r==null?or("even"):{...or("even"),maxAttemptLength:r}}),kind:"ok"}}function ps(e){return["Explorer model analysis",`${String(e.plannedPaths)} of ${String(e.attempts)} agendas produced complete paths.`,`${String(e.transitionsReached)} of ${String(e.transitionCount)} transitions were reached across ${String(e.composablePairs)} adjacent transition pairs.`,`${String(e.envelopesReached)} starting-state families and ${String(e.crossWorkflowPaths)} cross-workflow paths were used.`,up(e),pp(e),mp(e),fp(e),`Reached patterns: ${e.patternsReached.length===0?"none":e.patternsReached.join(", ")}.`,`${String(e.isolatedTransitions.length)} of ${String(e.targetsAnalyzed)} targeted transitions were unreachable. ${String(e.weaklyConnectedTransitions.length)} appeared in only one planned path.`,...us({heading:"Targets without a proved path:",transitions:e.isolatedTransitions}),...us({heading:"Targets reached in one planned path:",transitions:e.weaklyConnectedTransitions}),...gp(e.recommendations)].join(`
|
|
434
|
+
`)}function ms(e){switch(e){case"compile-failed":return"Explorer analysis could not load the workflow model. Run npx ripplo compile and fix the reported errors.";case"model-empty":return"Explorer analysis found no runnable workflows. Add a workflow with a modeled navigation step.";case"no-lockfile":return"Explorer analysis could not find .ripplo/ripplo.lock. Run npx ripplo compile."}}function up(e){let r=e.planningDepth;return`Path length target: ${String(r.targetSteps)} steps. Planned ${pe(r.averagePlannedSteps)} on average and ${String(r.maxPlannedSteps)} at most after searching ${pe(r.averageSearchedSteps)} on average and ${String(r.maxSearchedSteps)} at most. Search stopped at the target ${String(r.searchStops.targetReached)} times, exhausted legal continuations ${String(r.searchStops.frontierExhausted)} times, and exhausted its budget ${String(r.searchStops.budgetExhausted)} times.`}function pe(e){return String(Math.round(e))}function pp(e){let r=e.planningPerformance;return`Planner average: ${V(r.total.averageMs)} total, ${V(r.envelopes.averageMs)} starting states, ${V(r.search.averageMs)} search, and ${V(r.selection.averageMs)} selection. Total p95: ${V(r.total.p95Ms)}.`}function V(e){return`${String(Math.round(e))} ms`}function mp(e){let r=e.planningPerformance;return`Search average: ${V(r.expansion.averageMs)} proving runnable steps, ${V(r.candidates.averageMs)} scoring candidates, and ${V(r.beam.averageMs)} retaining the beam.`}function fp(e){let r=e.planningWork;return`Search average: ${pe(r.averageExpandedNodes)} expanded nodes after considering ${pe(r.averageRulesConsidered)} transitions and ${pe(r.averageParameterAttempts)} parameter attempts.`}function us({heading:e,transitions:r}){return r.length===0?[]:[e,...r.map(n=>`- ${n.test}: ${n.action}`)]}function gp(e){return e.length===0?["No workflow coverage improvements are required by this analysis."]:["Recommendations:",...e.map(r=>`- ${r}`)]}async function fs({json:e,state:r,trail:n,workers:t}){if(r==="analyze"){hp();let s=await cs({cwd:process.cwd(),maxTrailLength:n});s.kind==="error"&&(process.stderr.write(`${ms(s.reason)}
|
|
435
|
+
`),process.exit(1)),process.stdout.write(`${e?JSON.stringify(s.analysis,null,2):ps(s.analysis)}
|
|
415
436
|
`);return}let o=y(process.cwd()).match(s=>s,s=>{process.stderr.write(`${S(s)}
|
|
416
|
-
`),process.exit(1)});(r==null?await
|
|
417
|
-
`)},s=>{process.stderr.write(`${
|
|
418
|
-
`),process.exit(1)})}function
|
|
419
|
-
`),
|
|
420
|
-
`),process.exit(1)}function
|
|
421
|
-
`)}import{graphql as
|
|
437
|
+
`),process.exit(1)});(r==null?await ns(o):await ts(o,{active:r==="on",trail:n,workers:t})).match(s=>{process.stdout.write(`${r==null?as(s):ls(s)}
|
|
438
|
+
`)},s=>{process.stderr.write(`${ds(s)}
|
|
439
|
+
`),process.exit(1)})}function hp(){let e=F();e.kind!=="fresh"&&(e.kind==="foreign-binary"&&Je(te(e)??"This command is not using the workspace CLI."),process.stderr.write(`${Me(e.packages)}
|
|
440
|
+
`),Se(e.workspaceRoot)||Je(Le()),kp())}function Je(e){process.stderr.write(`${e}
|
|
441
|
+
`),process.exit(1)}function kp(){let e=process.argv[1];e==null&&Je("Ripplo rebuilt the workspace but could not find the CLI entry point.");let r=yp(process.execPath,[e,...process.argv.slice(2)],{cwd:process.cwd(),stdio:"inherit"});r.error!=null&&Je(`Ripplo rebuilt the workspace but could not restart analysis: ${r.error.message}`),process.exit(r.status??1)}import{graphql as Qe}from"gql.tada";function gs(){return"No scope items added \u2014 matched tests already in scope (`npx ripplo scope status`)."}function ys(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(`
|
|
442
|
+
`)}import{graphql as wp}from"gql.tada";var hs=wp(`
|
|
422
443
|
query ScopeStatus($projectId: String!, $cwd: String!) {
|
|
423
444
|
project(id: $projectId) {
|
|
424
445
|
id
|
|
@@ -438,7 +459,7 @@ explorer is hitting infra errors \u2014 it pauses if this persists`:r}function J
|
|
|
438
459
|
}
|
|
439
460
|
}
|
|
440
461
|
}
|
|
441
|
-
`);var
|
|
462
|
+
`);var bp=Qe(`
|
|
442
463
|
query ScopeWorkflowBySlug($projectId: String!, $cwd: String!, $slug: String!) {
|
|
443
464
|
project(id: $projectId) {
|
|
444
465
|
id
|
|
@@ -451,7 +472,7 @@ explorer is hitting infra errors \u2014 it pauses if this persists`:r}function J
|
|
|
451
472
|
}
|
|
452
473
|
}
|
|
453
474
|
}
|
|
454
|
-
`),
|
|
475
|
+
`),vp=Qe(`
|
|
455
476
|
mutation ScopeAddDirtyTests($projectId: String!, $cwd: String!, $workflowSlugs: [String!]!) {
|
|
456
477
|
addDirtyTestsToScope(projectId: $projectId, cwd: $cwd, workflowSlugs: $workflowSlugs) {
|
|
457
478
|
__typename
|
|
@@ -473,31 +494,31 @@ explorer is hitting infra errors \u2014 it pauses if this persists`:r}function J
|
|
|
473
494
|
}
|
|
474
495
|
}
|
|
475
496
|
}
|
|
476
|
-
`),
|
|
497
|
+
`),Sp=Qe(`
|
|
477
498
|
mutation ScopeLink($id: ID!, $workflowId: String!) {
|
|
478
499
|
linkScopeItem(id: $id, workflowId: $workflowId) {
|
|
479
500
|
id
|
|
480
501
|
}
|
|
481
502
|
}
|
|
482
|
-
`),
|
|
503
|
+
`),xp=Qe(`
|
|
483
504
|
mutation ScopeRemoveMany($ids: [ID!]!) {
|
|
484
505
|
removeScopeItems(ids: $ids)
|
|
485
506
|
}
|
|
486
|
-
`);async function
|
|
507
|
+
`);async function ks(e){let r=b();await R(r);let t=(await d({config:r,document:hs,variables:{cwd:r.cwd,projectId:r.projectId}})).project?.devSession?.scopeItems??[];if(e.format==="json"){process.stdout.write(`${JSON.stringify(t,null,2)}
|
|
487
508
|
`);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??""}
|
|
488
509
|
`);return}let s=i.spec==null?"stub":"implemented";process.stdout.write(` [${s}] (${o.id}) ${i.slug} \u2014 ${i.name}
|
|
489
|
-
`)})}async function
|
|
490
|
-
`),process.exit(1)});let o=(await d({config:r,document:
|
|
491
|
-
`),process.exit(1)),o?.__typename==="UnknownWorkflowSlugsError"&&(process.stderr.write(`${
|
|
492
|
-
`),process.exit(1));let i=o?.__typename==="MutationAddDirtyTestsToScopeSuccess"?o.data:[];if(i.length===0){process.stdout.write(`${
|
|
493
|
-
`);return}let s=i.map(a=>a.workflow?.slug??"?").join(", ");process.stdout.write(`Added ${
|
|
494
|
-
`)}async function
|
|
495
|
-
`),process.exit(1)});let o=await
|
|
496
|
-
`)}async function
|
|
497
|
-
`)}async function
|
|
498
|
-
`),process.stderr.write(`${
|
|
499
|
-
`),process.exit(1)),t.id}import{graphql as
|
|
500
|
-
`).reduce((t,o)=>t!=null||o.length===0?t:
|
|
510
|
+
`)})}async function ws({testIds:e}){let r=b();await R(r),(await ae(r.cwd,r)).match(()=>{},a=>{process.stderr.write(`${S(a)}
|
|
511
|
+
`),process.exit(1)});let o=(await d({config:r,document:vp,variables:{cwd:r.cwd,projectId:r.projectId,workflowSlugs:e.map(a=>cn(a))}})).addDirtyTestsToScope;o?.__typename==="NoActiveDevSessionError"&&(process.stderr.write(`${o.message}
|
|
512
|
+
`),process.exit(1)),o?.__typename==="UnknownWorkflowSlugsError"&&(process.stderr.write(`${ys(o.slugs)}
|
|
513
|
+
`),process.exit(1));let i=o?.__typename==="MutationAddDirtyTestsToScopeSuccess"?o.data:[];if(i.length===0){process.stdout.write(`${gs()}
|
|
514
|
+
`);return}let s=i.map(a=>a.workflow?.slug??"?").join(", ");process.stdout.write(`Added ${M(i.length,"scope item")}: ${s}
|
|
515
|
+
`)}async function bs({id:e,testId:r}){let n=b();await R(n),(await ae(n.cwd,n)).match(()=>{},i=>{process.stderr.write(`${S(i)}
|
|
516
|
+
`),process.exit(1)});let o=await Rp({cfg:n,slug:r});await d({config:n,document:Sp,variables:{id:e,workflowId:o}}),process.stdout.write(`Linked scope item ${e} to ${r}
|
|
517
|
+
`)}async function vs({ids:e}){let r=b();await R(r);let t=(await d({config:r,document:xp,variables:{ids:[...e]}})).removeScopeItems??0;process.stdout.write(`Removed ${M(t,"scope item")}
|
|
518
|
+
`)}async function Rp({cfg:e,slug:r}){let t=(await d({config:e,document:bp,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.
|
|
519
|
+
`),process.stderr.write(`${x("create")}
|
|
520
|
+
`),process.exit(1)),t.id}import{graphql as O}from"gql.tada";import{print as js}from"graphql";import{createClient as Ms}from"graphql-sse";import Lr from"fs";import Cp from"path";import{err as Ze,ok as Ep}from"neverthrow";function xs({cwd:e,rrwebId:r,runId:n}){let t=Cs(e,n);if(!Lr.existsSync(t))return Ze({kind:"no-behavior"});let o=Is(Ps(t,r));if(o==null)return Ze({kind:"not-found"});let i=Nr(o.node.type);return i===3?Ze({kind:"text-node",parentId:Nr(o.parent?.id)}):i!==2?Ze({kind:"non-element",nodeType:i??-1}):Ep({tagName:A(o.node.tagName)})}function Rs({cwd:e,rrwebId:r,runId:n}){let t=Ps(Cs(e,n),r);if(t==null)return null;let o=Is(t);return o==null||Nr(o.node.type)!==2?null:$p(t)}function Cs(e,r){return Cp.join(e,".ripplo","debug",r,"behavior.jsonl")}function $p(e){let r=e.at(-1)??{},n=Fr(r.attributes)??{},t=A(r.tagName);return{ariaName:A(n["aria-label"]),role:A(n.role),selector:Ip(e),tagName:t==null?null:t.toLowerCase(),testId:A(n["data-testid"]),text:Lp(Mp(r))}}var Pp=6;function Ip(e){let r=Es(e,e.length-1,Pp);return r.length===0?null:r.join(" > ")}function Es(e,r,n){let t=e[r];if(t==null||n<=0)return[];let o=Ap(t);if(o!=null)return[o];let i=Tp(t,e[r-1]);return r===0||n===1?[i]:[...Es(e,r-1,n-1),i]}function Ap(e){let r=Fr(e.attributes)??{},n=A(r["data-testid"]);if(n!=null)return`[data-testid="${n}"]`;let t=A(r.id);return t!=null&&t.length>0?`#${t}`:null}function Tp(e,r){let n=(A(e.tagName)??"*").toLowerCase(),t=$s(r).filter(i=>(A(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 $s(e){let r=e?.childNodes;return Array.isArray(r)?r.filter(n=>Xe(n)):[]}function Ps(e,r){return Lr.existsSync(e)?Lr.readFileSync(e,"utf8").split(`
|
|
521
|
+
`).reduce((t,o)=>t!=null||o.length===0?t:jp(o,r),null):null}function jp(e,r){let n=on(e);if(n?.kind!=="rrweb")return null;let t=Fr(n.event.data),o=Or(t?.node,r);if(o!=null)return o;let i=t?.adds;return Array.isArray(i)?i.reduce((s,a)=>s??(Xe(a)?Or(a.node,r):null),null):null}function Or(e,r){if(!Xe(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??Or(i,r),null);return t==null?null:[e,...t]}function Is(e){let r=e?.at(-1);return r==null?null:{node:r,parent:e?.at(-2)}}var Ss=80;function Mp(e){let r=$s(e).filter(n=>n.type===3).map(n=>A(n.textContent)).filter(n=>n!=null);return r.length===0?null:r.join(" ")}function A(e){return typeof e=="string"?e:null}function Lp(e){let r=e==null?"":e.replaceAll(/\s+/g," ").trim();return r.length===0?null:r.length>Ss?`${r.slice(0,Ss)}\u2026`:r}function Fr(e){return Xe(e)?e:void 0}function Xe(e){return typeof e=="object"&&e!=null}function Nr(e){return typeof e=="number"?e:null}function Wr(e,r){let n=r.flatMap(o=>Op(e,o)),t=new Map(r.map(o=>[o.id,o.fingerprint]));return{changes:n,seen:t}}function Op(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 Np=O(`
|
|
501
522
|
query WorkList($projectId: String!, $cwd: String!) {
|
|
502
523
|
project(id: $projectId) {
|
|
503
524
|
id
|
|
@@ -515,7 +536,7 @@ explorer is hitting infra errors \u2014 it pauses if this persists`:r}function J
|
|
|
515
536
|
}
|
|
516
537
|
}
|
|
517
538
|
}
|
|
518
|
-
`),
|
|
539
|
+
`),Fp=O(`
|
|
519
540
|
query WatchSeed($projectId: String!, $cwd: String!) {
|
|
520
541
|
project(id: $projectId) {
|
|
521
542
|
id
|
|
@@ -535,7 +556,7 @@ explorer is hitting infra errors \u2014 it pauses if this persists`:r}function J
|
|
|
535
556
|
}
|
|
536
557
|
}
|
|
537
558
|
}
|
|
538
|
-
`),
|
|
559
|
+
`),Ls=O(`
|
|
539
560
|
subscription WatchTasks($devSessionId: String!) {
|
|
540
561
|
tasksChanged(devSessionId: $devSessionId) {
|
|
541
562
|
devSession {
|
|
@@ -554,7 +575,7 @@ explorer is hitting infra errors \u2014 it pauses if this persists`:r}function J
|
|
|
554
575
|
}
|
|
555
576
|
}
|
|
556
577
|
}
|
|
557
|
-
`),
|
|
578
|
+
`),Wp=O(`
|
|
558
579
|
query WorkShow($id: String!) {
|
|
559
580
|
task(id: $id) {
|
|
560
581
|
id
|
|
@@ -571,7 +592,7 @@ explorer is hitting infra errors \u2014 it pauses if this persists`:r}function J
|
|
|
571
592
|
}
|
|
572
593
|
}
|
|
573
594
|
}
|
|
574
|
-
`),
|
|
595
|
+
`),Dp=O(`
|
|
575
596
|
mutation WorkComment(
|
|
576
597
|
$taskId: String!
|
|
577
598
|
$body: String!
|
|
@@ -597,7 +618,7 @@ explorer is hitting infra errors \u2014 it pauses if this persists`:r}function J
|
|
|
597
618
|
}
|
|
598
619
|
}
|
|
599
620
|
}
|
|
600
|
-
`),
|
|
621
|
+
`),_p=O(`
|
|
601
622
|
mutation WorkResolve($taskId: String!, $runId: String!, $note: String, $authorName: String) {
|
|
602
623
|
agentResolveTask(taskId: $taskId, runId: $runId, note: $note, authorName: $authorName) {
|
|
603
624
|
__typename
|
|
@@ -609,7 +630,7 @@ explorer is hitting infra errors \u2014 it pauses if this persists`:r}function J
|
|
|
609
630
|
}
|
|
610
631
|
}
|
|
611
632
|
}
|
|
612
|
-
`),
|
|
633
|
+
`),Up=O(`
|
|
613
634
|
mutation WorkStart($taskId: String!) {
|
|
614
635
|
agentStartTask(taskId: $taskId) {
|
|
615
636
|
__typename
|
|
@@ -622,7 +643,7 @@ explorer is hitting infra errors \u2014 it pauses if this persists`:r}function J
|
|
|
622
643
|
}
|
|
623
644
|
}
|
|
624
645
|
}
|
|
625
|
-
`),
|
|
646
|
+
`),Vp=O(`
|
|
626
647
|
mutation WorkClarify($taskId: String!, $body: String!, $authorName: String) {
|
|
627
648
|
agentSetNeedsClarification(taskId: $taskId, body: $body, authorName: $authorName) {
|
|
628
649
|
__typename
|
|
@@ -634,7 +655,7 @@ explorer is hitting infra errors \u2014 it pauses if this persists`:r}function J
|
|
|
634
655
|
}
|
|
635
656
|
}
|
|
636
657
|
}
|
|
637
|
-
`),
|
|
658
|
+
`),qp=O(`
|
|
638
659
|
mutation WorkDismiss($taskId: String!, $note: String, $authorName: String) {
|
|
639
660
|
agentDismissTask(taskId: $taskId, note: $note, authorName: $authorName) {
|
|
640
661
|
__typename
|
|
@@ -649,21 +670,21 @@ explorer is hitting infra errors \u2014 it pauses if this persists`:r}function J
|
|
|
649
670
|
}
|
|
650
671
|
}
|
|
651
672
|
}
|
|
652
|
-
`),
|
|
653
|
-
`);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(`${
|
|
654
|
-
`)}function
|
|
655
|
-
`)},next:o=>{let i=o.data?.tasksChanged?.devSession?.tasks??[],s=
|
|
656
|
-
`)}),t=s.seen}})}async function
|
|
673
|
+
`),Bp=18e4;async function Os(e){let r=b();await R(r);let n=await As(r),t=n.items.some(o=>o.kind==="finding");if(e.wait&&!t&&n.devSessionId!=null){await Hp({cfg:r,devSessionId:n.devSessionId});let o=await As(r);Ts(o.items,e.format);return}Ts(n.items,e.format)}async function As(e){let n=(await d({config:e,document:Np,variables:{cwd:e.cwd,projectId:e.projectId}})).project?.devSession;return{devSessionId:n?.id??null,items:n?.tasks??[]}}function Ts(e,r){if(r==="json"){process.stdout.write(`${JSON.stringify(e,null,2)}
|
|
674
|
+
`);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(`${Fn(n)}
|
|
675
|
+
`)}function Hp({cfg:e,devSessionId:r}){let n=Ms({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,Bp),o.dispose=n.subscribe({query:js(Ls),variables:{devSessionId:r}},{complete:i,error:()=>{i()},next:s=>{(s.data?.tasksChanged?.devSession?.tasks??[]).some(l=>l.kind==="finding")&&i()}})})}async function Ns(){let e=b();await R(e);let n=(await d({config:e,document:Fp,variables:{cwd:e.cwd,projectId:e.projectId}})).project?.devSession;if(n==null)throw new Error("dev session vanished between preflight and seed");let t=Wr(new Map,Ws(n.tasks??[])),o=Ms({headers:{Authorization:`Bearer ${e.token}`},retryAttempts:1/0,url:`${e.ripploServerUrl}/graphql`});zp({devSessionId:n.id,seen:t.seen,sseClient:o}),await new Promise(()=>{})}function zp({devSessionId:e,seen:r,sseClient:n}){let t=r;n.subscribe({query:js(Ls),variables:{devSessionId:e}},{complete:()=>{},error:o=>{process.stderr.write(`task watch error: ${String(o)}
|
|
676
|
+
`)},next:o=>{let i=o.data?.tasksChanged?.devSession?.tasks??[],s=Wr(t,Ws(i));s.changes.forEach(a=>{process.stdout.write(`${Dn(a)}
|
|
677
|
+
`)}),t=s.seen}})}async function Fs(e){let r=b();await R(r);let t=(await d({config:r,document:Wp,variables:{id:e.id}})).task;if(t==null&&(process.stderr.write(`${_n(e.id)}
|
|
657
678
|
`),process.exit(1)),e.format==="json"){process.stdout.write(`${JSON.stringify(t,null,2)}
|
|
658
|
-
`);return}let o=[...new Set((t.messages??[]).flatMap(s=>s.runId==null?[]:[s.runId]))];await Promise.all(o.map(s=>
|
|
659
|
-
`)}function
|
|
660
|
-
`),process.exit(1))}let n=await d({config:r,document:
|
|
661
|
-
`)}async function
|
|
662
|
-
`)}async function
|
|
663
|
-
`)}async function
|
|
664
|
-
`),process.exit(1));let r=b();await
|
|
665
|
-
`)}async function
|
|
666
|
-
`),process.exit(1)),process.stdout.write(`${
|
|
667
|
-
`)}function
|
|
668
|
-
`),process.exit(1))}function
|
|
669
|
-
`),process.exit(1)});var
|
|
679
|
+
`);return}let o=[...new Set((t.messages??[]).flatMap(s=>s.runId==null?[]:[s.runId]))];await Promise.all(o.map(s=>_(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:Rs({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(`${Wn(i)}
|
|
680
|
+
`)}function Ws(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 Ds(e){let r=b();if(await R(r),e.elementId!=null&&e.runId!=null){let t=xs({cwd:r.cwd,rrwebId:e.elementId,runId:e.runId}).match(()=>null,o=>o);t!=null&&t.kind!=="no-behavior"&&(process.stderr.write(`${Gp(t,e.elementId,e.runId)}
|
|
681
|
+
`),process.exit(1))}let n=await d({config:r,document:Dp,variables:{authorName:e.authorName??null,body:e.body,frameMs:e.offsetMs??null,rrwebId:e.elementId??null,runId:e.runId??null,taskId:e.id}});Ye(n.agentCommentOnTask),process.stdout.write(`${Un(e.id)}
|
|
682
|
+
`)}async function _s(e){let r=b();await R(r);let n=await d({config:r,document:_p,variables:{authorName:e.authorName??null,note:e.note??null,runId:e.runId,taskId:e.id}});Ye(n.agentResolveTask),process.stdout.write(`${zn(e.id)}
|
|
683
|
+
`)}async function Us(e){let r=b();await R(r);let n=await d({config:r,document:Up,variables:{taskId:e.id}});Ye(n.agentStartTask),process.stdout.write(`${Gn(e.id)}
|
|
684
|
+
`)}async function Vs(e){e.body.trim().length===0&&(process.stderr.write(`${Vn()}
|
|
685
|
+
`),process.exit(1));let r=b();await R(r);let n=await d({config:r,document:Vp,variables:{authorName:e.authorName??null,body:e.body,taskId:e.id}});Ye(n.agentSetNeedsClarification),process.stdout.write(`${Kn(e.id)}
|
|
686
|
+
`)}async function qs(e){let r=b();await R(r);let t=(await d({config:r,document:qp,variables:{authorName:e.authorName??null,note:e.note??null,taskId:e.id}})).agentDismissTask;(t?.__typename==="FindingNotDismissableError"||t?.__typename==="NoActiveDevSessionError")&&(process.stderr.write(`${t.message}
|
|
687
|
+
`),process.exit(1)),process.stdout.write(`${Jn(e.id)}
|
|
688
|
+
`)}function Ye(e){e?.__typename==="NoActiveDevSessionError"&&(process.stderr.write(`${e.message}
|
|
689
|
+
`),process.exit(1))}function Gp(e,r,n){return e.kind==="text-node"?qn(r,e.parentId):e.kind==="not-found"?Bn(r,n):Hn(r)}function Bs(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=>Os({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,()=>Ns()).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=>Fs({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=>Ds({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=>Us({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=>_s({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=>Vs({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=>qs({authorName:r.as,id:r.id,note:r.note})).demandCommand(1)}_r();ie(process.cwd());Zr();async function Zp(){fe(w()),Kp({pkg:{name:"ripplo",version:w()}}).notify({message:Ot()}),await Jp(Qp(process.argv)).scriptName("ripplo").version(w()).command(em()).command(rm()).command(tm()).command(pm()).command("auth <subcommand>","Manage authentication",km).command("projects <subcommand>","List or create Ripplo projects",hm).command("hooks <subcommand>","Pause or resume Ripplo hooks",ym).command(sm()).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=>wo({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`)",fm,e=>Po({all:e.all,headed:e.headed,ids:e.ids})).command(lm()).command(dm()).command(mm()).command(cm()).command(um()).command(am()).command(om()).command(im()).command("sync","Push the compiled .ripplo/ resources to the server (no run)",()=>{},()=>Di()).command("compile","Compile the DSL, run static model analysis, and write .ripplo/ripplo.lock",e=>e.option("check",{default:!1,describe:"Exit non-zero if the lockfile is missing or stale (does not write)",type:"boolean"}),e=>qt({check:e.check})).command("update","Update ripplo to the latest published version (and hand the daemon off to it)",()=>{},()=>Ji()).command("doctor","Check project health",()=>{},()=>no()).command("status","Report stub tests and daemon status",e=>e.option("format",{choices:["json","summary"],default:"json",describe:"Output format"}),e=>Tt({format:e.format})).command("scope <subcommand>","Manage testing scope",gm).command("tasks <subcommand>","Manage tasks for this dev session",Bs).command("run-worker",!1,()=>{},()=>jo()).command("hook <name>","Internal: run a Claude Code plugin hook",e=>e.positional("name",{choices:Object.keys(it),demandOption:!0,type:"string"}),e=>at(e.name)).strict().help().parse()}Zp().catch(e=>{process.stderr.write(`${st(e)}
|
|
690
|
+
`),process.exit(1)});var Xp=["start","stop","restart","status"],Yp="start";function em(){return{command:"daemon [action]",describe:"Run the long-lived local executor (IPC socket + run subscription)",builder:e=>e.positional("action",{choices:Xp,default:Yp,describe:"Lifecycle action for this project's daemon"}).option("explore-debug",{default:!1,describe:"Print local explorer planner decisions",type:"boolean"}),handler:e=>Qi({action:e.action,exploreDebug:e["explore-debug"]})}}function rm(){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=>es({mode:e.mode})}}var nm=["analyze","on","off"];function tm(){return{command:"explore [state]",describe:"Show or toggle the background explorer for the active dev session",builder:e=>e.positional("state",{choices:nm,describe:"Turn the explorer on or off, or analyze workflow coverage (omit to show current state)"}).option("json",{default:!1,describe:"Print machine-readable analysis",type:"boolean"}).option("trail",{describe:"Target steps per explored path",type:"number"}).option("workers",{describe:"Concurrent explorer workers",type:"number"}),handler:e=>fs({json:e.json,state:e.state,trail:e.trail,workers:e.workers})}}function om(){return{command:"explain <runId>",describe:"Explain a run's failing checks \u2014 what failed, where it came from, and what happened around it",builder:e=>e.positional("runId",{demandOption:!0,type:"string"}).option("json",{default:!1,describe:"Machine-readable output",type:"boolean"}).option("full",{default:!1,describe:"Also show the synthesized starting state and step-by-step run timeline",type:"boolean"}),handler:e=>Yo({full:e.full,json:e.json,runId:e.runId})}}function im(){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=>ai({runId:e.runId})}}function sm(){return{command:"setup",describe:"Install the Ripplo plugin for Claude Code and start a guided setup session",builder:e=>e,handler:()=>{$o()}}}function am(){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=>ei({runId:e.runId})}}function lm(){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=>yi({at:e.at,offset:e.offset,runId:e.runId})}}function dm(){return{command:"video <runId>",describe:"Render an MP4 of a run's rrweb recording",builder:e=>e.positional("runId",{demandOption:!0,type:"string"}),handler:e=>Ri({runId:e.runId})}}function cm(){return{command:"capture",describe:"Open your signed-in browser, record a flow, and hand the log to Claude",builder:e=>e,handler:()=>Li()}}function um(){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=>{Wi({runId:e.runId})}}}function pm(){return{command:"concurrency [value]",describe:"Show or set max local concurrent runs (daemon applies live)",builder:e=>e.positional("value",{type:"number"}),handler:e=>Ht({value:e.value})}}function mm(){return{command:"teleport <ref>",describe:"Open a live browser with starting state and earlier test steps applied",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=>Pi({ref:e.ref,step:e.step})}}function fm(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 gm(e){return e.command("status","Print the current scope",r=>r.option("format",{choices:["json","text"],default:"text",describe:"Output format"}),r=>ks({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=>ws({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=>bs({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=>vs({ids:r.ids})).demandCommand(1)}function ym(e){return e.command("pause","Disable all Ripplo pre-edit gates and stop enforcement until resumed",()=>{},()=>to()).command("resume","Re-enable Ripplo hooks paused via `ripplo hooks pause`",()=>{},()=>oo()).demandCommand(1)}function hm(e){return e.command("list","List projects you have access to (JSON)",()=>{},()=>So()).command("create <name>","Create a project (JSON)",r=>r.positional("name",{demandOption:!0,type:"string"}).option("org",{describe:"Organization id",type:"string"}),r=>xo({name:r.name,orgId:r.org})).demandCommand(1)}function km(e){return e.command("login","Authenticate via device flow",()=>{},()=>_t()).command("status","Show authentication status",()=>{},()=>Ut()).command("logout","Remove the saved token",()=>{},()=>{Vt()}).demandCommand(1)}export{Zp as main};
|