@rulemetric/cli 0.7.39 → 0.7.40
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/base-command.js +1 -1
- package/dist/{chunk-ZYI66XKV.js → chunk-2RCWYVEU.js} +1 -1
- package/dist/{chunk-VLXCQ2DC.js → chunk-3QXRLIGC.js} +1 -1
- package/dist/chunk-45DOTNQM.js +1 -0
- package/dist/{chunk-G6XGDHGC.js → chunk-4Q72B377.js} +1 -1
- package/dist/{chunk-Q4APAZUC.js → chunk-5KD2N2MH.js} +1 -1
- package/dist/{chunk-GPTPK6QX.js → chunk-5R5RGKOW.js} +3 -3
- package/dist/{chunk-ZR3MUNLS.js → chunk-5RUEROLC.js} +1 -1
- package/dist/{chunk-TIOKY2IA.js → chunk-5XUN743A.js} +1 -1
- package/dist/{chunk-VSUL3MNG.js → chunk-5ZACMVV3.js} +1 -1
- package/dist/{chunk-SNJ2NIIE.js → chunk-6ME5OTS5.js} +1 -1
- package/dist/{chunk-V44SRRYR.js → chunk-6VKQT2J3.js} +1 -1
- package/dist/{chunk-TYL5LNTJ.js → chunk-7UCNONVI.js} +1 -1
- package/dist/{chunk-X64R6JCJ.js → chunk-AI6FMGKM.js} +1 -1
- package/dist/{chunk-KQCAELPN.js → chunk-ATL4WZBF.js} +1 -1
- package/dist/{chunk-W2MOTOQE.js → chunk-BLCMXTIK.js} +1 -1
- package/dist/{chunk-2ZAKZEXW.js → chunk-DBELYMDA.js} +1 -1
- package/dist/{chunk-WFYQ6SPJ.js → chunk-EF6JLMNH.js} +1 -1
- package/dist/{chunk-CYKELSHS.js → chunk-EHNPJJIH.js} +1 -1
- package/dist/{chunk-SWSGNEVO.js → chunk-EN43UYBN.js} +1 -1
- package/dist/{chunk-BPQ66YTY.js → chunk-FAXV5AAG.js} +1 -1
- package/dist/{chunk-PBPNIKQA.js → chunk-FNGVEZPD.js} +1 -1
- package/dist/{chunk-I2DZGJRR.js → chunk-HFGO5762.js} +8 -2
- package/dist/{chunk-ZYVWALMS.js → chunk-HXZM2UHO.js} +1 -1
- package/dist/{chunk-RQ424GI6.js → chunk-IQCE4VBP.js} +1 -1
- package/dist/chunk-JZ5Z2BRO.js +7 -0
- package/dist/{chunk-HUADECKZ.js → chunk-KGQ5W54Y.js} +1 -1
- package/dist/chunk-KLEF5D3A.js +1 -0
- package/dist/{chunk-6Q4GWZQV.js → chunk-KUTOHRLK.js} +1 -1
- package/dist/{chunk-XXDZJ6YI.js → chunk-LLNQZ4SZ.js} +1 -1
- package/dist/{chunk-PPKPCXJD.js → chunk-LWI5K6T4.js} +1 -1
- package/dist/{chunk-H7J27U4P.js → chunk-MOAJLSYV.js} +1 -1
- package/dist/{chunk-U6XEU573.js → chunk-NIRD7ETU.js} +1 -1
- package/dist/{chunk-NKPLTT7J.js → chunk-O2BKBW7Z.js} +1 -1
- package/dist/{chunk-QV4A73AC.js → chunk-O7PSLZO6.js} +1 -1
- package/dist/{chunk-5KP66L7P.js → chunk-QDYMIFY4.js} +1 -1
- package/dist/{chunk-IQTSUAGM.js → chunk-QUDMK76I.js} +1 -1
- package/dist/{chunk-VLOX6KOM.js → chunk-QY3UKLDE.js} +1 -1
- package/dist/{chunk-XICLXXRH.js → chunk-RJLAAKEN.js} +1 -1
- package/dist/{chunk-RDET7CKR.js → chunk-ULMEKK7C.js} +1 -1
- package/dist/{chunk-IXLDCX7M.js → chunk-YW3JQKGY.js} +1 -1
- package/dist/{chunk-VTA6HDVW.js → chunk-Z2MZOQCD.js} +1 -1
- package/dist/commands/antigravity/backfill.js +1 -1
- package/dist/commands/auth/create-key.js +1 -1
- package/dist/commands/auth/login.js +1 -1
- package/dist/commands/auth/logout.js +1 -1
- package/dist/commands/auth/revoke-key.js +1 -1
- package/dist/commands/auth/signup.js +1 -1
- package/dist/commands/auth/status.js +1 -1
- package/dist/commands/capture/scope.js +1 -1
- package/dist/commands/catalog/index.js +1 -1
- package/dist/commands/catalog/recommend.js +1 -1
- package/dist/commands/convert.js +1 -1
- package/dist/commands/converters.js +1 -1
- package/dist/commands/crons/list.js +1 -1
- package/dist/commands/crons/run.js +1 -1
- package/dist/commands/dashboard.js +1 -1
- package/dist/commands/diagnostics.js +1 -1
- package/dist/commands/eval-targets/create.js +1 -1
- package/dist/commands/eval-targets/list.js +1 -1
- package/dist/commands/evals/agent.js +1 -1
- package/dist/commands/evals/auto-run.js +1 -1
- package/dist/commands/evals/benchmark.js +1 -1
- package/dist/commands/evals/compare.js +1 -1
- package/dist/commands/evals/create.js +1 -1
- package/dist/commands/evals/optimize-description.js +1 -1
- package/dist/commands/evals/optimize.js +1 -1
- package/dist/commands/evals/refine-cases.js +1 -1
- package/dist/commands/evals/run.js +1 -1
- package/dist/commands/evals/validate-judge.js +1 -1
- package/dist/commands/gateway/ensure.js +1 -1
- package/dist/commands/hooks/install.js +1 -1
- package/dist/commands/hooks/run.js +1 -1
- package/dist/commands/hooks/uninstall.js +1 -1
- package/dist/commands/import.js +1 -1
- package/dist/commands/instructions/create.js +1 -1
- package/dist/commands/instructions/delete.js +1 -1
- package/dist/commands/instructions/fork.js +1 -1
- package/dist/commands/instructions/get.js +1 -1
- package/dist/commands/instructions/list.js +1 -1
- package/dist/commands/instructions/promote.js +1 -1
- package/dist/commands/instructions/pull.js +1 -1
- package/dist/commands/instructions/upstream.js +1 -1
- package/dist/commands/instructions/versions.js +1 -1
- package/dist/commands/launcher.js +1 -1
- package/dist/commands/org/current.js +1 -1
- package/dist/commands/org/list.js +1 -1
- package/dist/commands/org/switch.js +1 -1
- package/dist/commands/packs/add-instruction.js +1 -1
- package/dist/commands/packs/apply.js +1 -1
- package/dist/commands/packs/create.js +1 -1
- package/dist/commands/packs/fork.js +1 -1
- package/dist/commands/packs/get.js +1 -1
- package/dist/commands/packs/list.js +1 -1
- package/dist/commands/packs/remove-instruction.js +1 -1
- package/dist/commands/proxy/env.js +1 -1
- package/dist/commands/proxy/logs.js +1 -1
- package/dist/commands/proxy/restart.js +1 -1
- package/dist/commands/proxy/setup.js +1 -1
- package/dist/commands/proxy/start.js +1 -1
- package/dist/commands/proxy/status.js +1 -1
- package/dist/commands/proxy/stop.js +1 -1
- package/dist/commands/research/backfill.js +1 -1
- package/dist/commands/research/tail-transcript.js +1 -1
- package/dist/commands/service/install.js +1 -1
- package/dist/commands/service/status.js +1 -1
- package/dist/commands/service/uninstall.js +1 -1
- package/dist/commands/sessions/analyze.js +1 -1
- package/dist/commands/sessions/delete.js +1 -1
- package/dist/commands/sessions/end.js +1 -1
- package/dist/commands/sessions/import.js +1 -1
- package/dist/commands/sessions/list.js +1 -1
- package/dist/commands/sessions/start.js +1 -1
- package/dist/commands/setup.js +1 -1
- package/dist/commands/skills/export-approved.js +1 -1
- package/dist/commands/skills/install.js +1 -1
- package/dist/commands/skills/list.js +1 -1
- package/dist/commands/skills/publish.js +1 -1
- package/dist/commands/skills/search.js +1 -1
- package/dist/commands/skills/update.js +1 -1
- package/dist/commands/suggestions/accept.js +1 -1
- package/dist/commands/suggestions/dismiss.js +1 -1
- package/dist/commands/suggestions/list.js +1 -1
- package/dist/commands/suggestions/refresh.js +1 -1
- package/dist/dashboard/Dashboard.js +1 -1
- package/dist/dashboard/data.js +1 -1
- package/dist/dashboard/launcher/LauncherOverlay.js +1 -1
- package/dist/dashboard/launcher/api.js +1 -1
- package/dist/dashboard/launcher/useLaunchJobs.js +1 -1
- package/dist/lib/active-org-refresh.js +1 -1
- package/dist/lib/agent-loop.js +1 -1
- package/dist/lib/antigravity-transcript.js +1 -1
- package/dist/lib/api-client.js +1 -1
- package/dist/lib/auth.js +1 -1
- package/dist/lib/editor-proxy-pins.js +1 -1
- package/dist/lib/ensure-api-key.js +1 -1
- package/dist/lib/ensure-fresh-token.js +1 -1
- package/dist/lib/eval-benchmark.js +1 -1
- package/dist/lib/eval-candidate-run.js +1 -1
- package/dist/lib/eval-conversation-handler.js +1 -1
- package/dist/lib/eval-run-batch.js +1 -1
- package/dist/lib/handlers/cron-eval-autorun.js +1 -1
- package/dist/lib/handlers/cron-instruction-evolution.js +1 -1
- package/dist/lib/handlers/cron-refresh-pricing.js +1 -1
- package/dist/lib/handlers/cron-suggest-instructions.js +1 -1
- package/dist/lib/handlers/distill-memories.js +1 -1
- package/dist/lib/handlers/process-announcement.js +1 -1
- package/dist/lib/handlers/process-changelog.js +1 -1
- package/dist/lib/handlers/process-conversation.js +1 -1
- package/dist/lib/handlers/process-eval.js +1 -1
- package/dist/lib/handlers/process-insights.js +1 -1
- package/dist/lib/handlers/process-judge-review.js +1 -1
- package/dist/lib/handlers/process-launch.js +1 -1
- package/dist/lib/handlers/process-memory-ab.js +1 -1
- package/dist/lib/handlers/process-run-cleanup.js +1 -1
- package/dist/lib/handlers/process-session-goal.js +1 -1
- package/dist/lib/hooks-config.js +1 -1
- package/dist/lib/judge-review-runner.js +1 -1
- package/dist/lib/manual-tasks.js +1 -1
- package/dist/lib/research-client.js +1 -1
- package/dist/lib/setup-steps.js +1 -1
- package/dist/lib/statusline-shim.js +1 -1
- package/dist/lib/telemetry.js +1 -1
- package/dist/lib/terminal-target-heartbeat.js +1 -1
- package/oclif.manifest.json +1 -1
- package/package.json +4 -4
- package/dist/chunk-H2ORWIEY.js +0 -1
- package/dist/chunk-JGLVVIEM.js +0 -1
- package/dist/chunk-O6C2UGBY.js +0 -7
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{f}from"./chunk-B3BHB26P.js";import{b as S,e as a,h as y}from"./chunk-
|
|
1
|
+
import{f}from"./chunk-B3BHB26P.js";import{b as S,e as a,h as y}from"./chunk-KLEF5D3A.js";import{a as p}from"./chunk-ZLLER3HP.js";var _=1800*1e3,G=300*1e3,T=10,h=`Given these messages from an AI coding session, write a 1-2 sentence summary of what the user is trying to accomplish. Focus on the goal, not the steps. No preamble.
|
|
2
2
|
|
|
3
3
|
Return strict JSON in the form: {"goalSummary": "..."}`;async function k(n,e={}){let d=e.llm??f,o=e.now??Date.now,w=e.getSession??(async s=>{try{return await a(`/api/sessions/${s}`)}catch(t){if(t instanceof S&&t.statusCode===404)return null;throw t}}),m=e.getEvents??((s,t)=>a(`/api/sessions/${s}/events?limit=${t.limit}&sort=${t.sort}`)),v=e.saveGoal??(async(s,t)=>{await y(`/api/sessions/${s}/enrich`,{analysis:t})}),i=await w(n.sessionId);if(!i)return{skipped:"not_found"};let[P]=await m(n.sessionId,{limit:1,sort:"desc"}),A=new Date(P?.timestamp??i.startedAt).getTime();if(o()-A>_)return{skipped:"stale"};let l=i.analysis??{},c=l.goalSummaryAt?new Date(l.goalSummaryAt).getTime():0;if(c&&o()-c<G)return{skipped:"recent"};let g=(await m(n.sessionId,{limit:T*2,sort:"asc"})).filter(s=>s.content&&(s.eventType==="user_message"||s.eventType==="assistant_response")).map(s=>`${s.eventType==="user_message"?"USER":"ASSISTANT"}: ${s.content}`).join(`
|
|
4
4
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b as E,d as R}from"./chunk-
|
|
1
|
+
import{b as E,d as R}from"./chunk-KLEF5D3A.js";import{a as o}from"./chunk-ZLLER3HP.js";import{createHash as C}from"node:crypto";import{existsSync as A,mkdirSync as I,readFileSync as p,renameSync as L,rmdirSync as M,writeFileSync as m}from"node:fs";import{homedir as U,tmpdir as x}from"node:os";import{join as c}from"node:path";var $=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function v(t){return $.test(t)?t:`antigravity-${C("sha256").update(t).digest("hex").slice(0,16)}`}o(v,"hookSessionKey");var _=100,F=new Set(["RUN_COMMAND","VIEW_FILE","LIST_DIRECTORY","CODE_ACTION","GREP_SEARCH","SEARCH_WEB"]),H=new Set(["CONVERSATION_HISTORY","KNOWLEDGE_ARTIFACTS","CHECKPOINT"]);function T(){return process.env.RULEMETRIC_CONFIG_DIR??c(U(),".config","rulemetric")}o(T,"configDir");function O(){return c(T(),"antigravity-state")}o(O,"stateDir");function P(t){return c(O(),`${t}.json`)}o(P,"stateFile");function k(){let t=c(T(),"env");if(A(t))try{let n=p(t,"utf-8");for(let r of n.split(/\r?\n/)){let e=r.match(/^([A-Z_][A-Z0-9_]*)=(.*)$/);if(!e)continue;let i=e[1];if(process.env[i]!==void 0)continue;let s=e[2];(s.startsWith('"')&&s.endsWith('"')||s.startsWith("'")&&s.endsWith("'"))&&(s=s.slice(1,-1)),process.env[i]=s}}catch{}}o(k,"loadEnvFile");function b(t){try{let n=p(P(t),"utf-8"),r=JSON.parse(n);if(r&&typeof r=="object"&&"lastStepIdx"in r){let e=r.lastStepIdx;if(typeof e=="number"&&Number.isFinite(e))return{lastStepIdx:e}}}catch{}return null}o(b,"loadState");function g(t,n){I(O(),{recursive:!0});let r=P(t),e=`${r}.tmp`;m(e,JSON.stringify(n),{mode:384});try{L(e,r)}catch{m(r,JSON.stringify(n),{mode:384})}}o(g,"saveState");function N(t){let n=process.env.TMPDIR??x(),r=c(n,"rulemetric"),e=c(r,v(t));try{return p(e,"utf-8").trim()||null}catch{return null}}o(N,"resolveRwSessionId");function W(t){let n=process.env.TMPDIR??x(),r=c(n,"rulemetric"),e=v(t),i=c(r,`${e}.seq`),s=c(r,`${e}.seqlock`),l=Date.now()+5e3;for(;Date.now()<l;)try{I(s);break}catch{}let a=1;try{a=parseInt(p(i,"utf-8").trim(),10)+1,(!Number.isFinite(a)||a<1)&&(a=1)}catch{a=1}try{m(i,String(a))}catch{}try{M(s)}catch{}return a}o(W,"nextSequence");function Y(t,n){let r;try{r=p(t,"utf-8")}catch{return[]}let e=[];for(let i of r.split(/\r?\n/))if(i.trim())try{let s=JSON.parse(i);typeof s.step_index=="number"&&s.step_index>n&&e.push(s)}catch{}return e.sort((i,s)=>i.step_index-s.step_index),e}o(Y,"readNewRecords");function G(t){let n;try{n=p(t,"utf-8")}catch{return-1}let r=-1;for(let e of n.split(/\r?\n/))if(e.trim())try{let i=JSON.parse(e);typeof i.step_index=="number"&&i.step_index>r&&(r=i.step_index)}catch{}return r}o(G,"findMaxStepIndex");function J(t){let n=t.match(/<USER_REQUEST>\s*([\s\S]*?)\s*<\/USER_REQUEST>/);return n?n[1].trim():t.trim()}o(J,"extractUserPrompt");function j(t,n){let r=t.created_at??new Date().toISOString(),e={antigravityStepIndex:t.step_index,antigravitySource:t.source,antigravityType:t.type};if(H.has(t.type)||F.has(t.type))return null;if(t.source==="USER_EXPLICIT"&&t.type==="USER_INPUT")return{sequence:n,eventType:"user_message",content:J(t.content??""),timestamp:r,metadata:e};if(t.source==="MODEL"&&t.type==="PLANNER_RESPONSE"){let i=[];return t.thinking&&t.thinking.trim()&&i.push(`[thinking]
|
|
2
2
|
${t.thinking.trim()}`),t.content&&t.content.trim()&&i.push(t.content.trim()),t.tool_calls&&t.tool_calls.length>0&&(e.antigravityToolCalls=t.tool_calls.map(s=>s.name).filter(Boolean)),{sequence:n,eventType:"assistant_response",content:i.join(`
|
|
3
3
|
|
|
4
4
|
`)||null,timestamp:r,metadata:e}}return t.source==="MODEL"&&t.type==="GENERIC"?{sequence:n,eventType:"tool_result",content:t.content??null,timestamp:r,metadata:e}:t.source==="SYSTEM"&&(t.type==="SYSTEM_MESSAGE"||t.type==="ERROR_MESSAGE")?null:{sequence:n,eventType:`antigravity_${t.type.toLowerCase()}`,content:t.content??null,timestamp:r,metadata:e}}o(j,"classifyRecord");function q(t){try{let n=JSON.parse(t);return n&&typeof n=="object"?n:null}catch{return null}}o(q,"parseHookPayload");async function K(t,n,r,e,i={}){let s=i.errorSink??(u=>process.stderr.write(u)),l=0,a=0,d=0,S=0,f=e;for(let u of t){l++,i.onProgress?.({attempted:l,total:t.length,record:u});let w=W(r),y=j(u,w);if(!y)S++;else try{await R(`/api/sessions/${n}/events`,{method:"POST",body:y}),a++}catch(h){d++;let D=h instanceof E?h.statusCode:"unknown";s(`[antigravity-tailer] failed step=${u.step_index} type=${u.type} status=${D}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import{a as e}from"./chunk-ZLLER3HP.js";import*as i from"node:fs";import*as u from"node:path";import*as R from"node:os";function m(){return process.env.RULEMETRIC_CONFIG_DIR||u.join(R.homedir(),".config","rulemetric")}e(m,"getConfigDir");var l;function F(){if(l!==void 0)return l;try{let n=u.join(m(),"env");if(!i.existsSync(n))return l={};let s=i.readFileSync(n,"utf-8"),E=e(h=>s.match(new RegExp(`^${h}=(.+)$`,"m"))?.[1]?.trim(),"read");return l={apiKey:E("RULEMETRIC_API_KEY"),accessToken:E("RULEMETRIC_ACCESS_TOKEN"),apiUrl:E("RULEMETRIC_API_URL"),strictLocal:E("RULEMETRIC_STRICT_LOCAL")},l}catch{return l={}}}e(F,"loadEnvFileAuth");function L(){l=void 0}e(L,"__resetEnvFileAuthCache");function S(n=m()){let s=u.join(n,"auth.json");function E(o){i.mkdirSync(n,{recursive:!0,mode:448}),i.writeFileSync(s,JSON.stringify(o,null,2),{encoding:"utf-8",mode:384})}e(E,"saveToken");function h(){try{let o=i.readFileSync(s,"utf-8"),t=JSON.parse(o);return t&&typeof t=="object"&&"accessToken"in t&&"expiresAt"in t&&"email"in t&&typeof t.accessToken=="string"&&typeof t.expiresAt=="string"?t:null}catch{return null}}e(h,"loadToken");function _(){try{i.unlinkSync(s)}catch{}}e(_,"clearToken");function g(){let o=h();if(!o)return!1;let t=new Date(o.expiresAt).getTime();return Number.isNaN(t)?!1:Date.now()<t}e(g,"isAuthenticated");function y(o=0){let t=h();if(!t?.refreshToken)return!1;let r=new Date(t.expiresAt).getTime();return Number.isNaN(r)?!0:Date.now()>=r-o}e(y,"isRefreshable");function k(o,t){i.mkdirSync(n,{recursive:!0,mode:448});let r=u.join(n,"env"),c="",p="";try{let v=i.readFileSync(r,"utf-8"),T=v.match(/^RULEMETRIC_API_KEY=(.+)$/m);T&&(c=T[1]);let d=v.match(/^RULEMETRIC_API_URL=(.+)$/m);d&&(p=d[1])}catch{}let f=[`RULEMETRIC_ACCESS_TOKEN=${o}`];c&&f.push(`RULEMETRIC_API_KEY=${c}`);let A=t||p||"https://rulemetric.com";f.push(`RULEMETRIC_API_URL=${A}`),i.writeFileSync(r,f.join(`
|
|
2
|
+
`)+`
|
|
3
|
+
`,{encoding:"utf-8",mode:384})}e(k,"saveEnvFile");function C(o,t){i.mkdirSync(n,{recursive:!0,mode:448});let r=u.join(n,"env"),c="",p="";try{let v=i.readFileSync(r,"utf-8"),T=v.match(/^RULEMETRIC_ACCESS_TOKEN=(.+)$/m);T&&(c=T[1]);let d=v.match(/^RULEMETRIC_API_URL=(.+)$/m);d&&(p=d[1])}catch{}let f=[`RULEMETRIC_API_KEY=${o}`];c&&f.push(`RULEMETRIC_ACCESS_TOKEN=${c}`);let A=t||p||"https://rulemetric.com";A&&f.push(`RULEMETRIC_API_URL=${A}`),i.writeFileSync(r,f.join(`
|
|
4
|
+
`)+`
|
|
5
|
+
`,{encoding:"utf-8",mode:384})}e(C,"saveApiKeyToEnv");function I(){let o=u.join(n,"env");try{i.unlinkSync(o)}catch{}}e(I,"clearEnvFile");function x(){let o=u.join(n,"env");try{let t=i.readFileSync(o,"utf-8"),r=t.split(`
|
|
6
|
+
`).filter(c=>!c.startsWith("RULEMETRIC_API_KEY=")).join(`
|
|
7
|
+
`);r!==t&&i.writeFileSync(o,r,{encoding:"utf-8",mode:384})}catch{}}return e(x,"removeApiKeyFromEnvFile"),{saveToken:E,loadToken:h,clearToken:_,isAuthenticated:g,isRefreshable:y,saveEnvFile:k,saveApiKeyToEnv:C,clearEnvFile:I,removeApiKeyFromEnvFile:x,configDir:n,authFile:s}}e(S,"createAuthStore");function a(){return S()}e(a,"getStore");function U(n){a().saveToken(n)}e(U,"saveToken");function K(){return a().loadToken()}e(K,"loadToken");function M(){a().clearToken()}e(M,"clearToken");function P(){if(process.env.RULEMETRIC_API_KEY||a().isAuthenticated())return!0;let n=F();return!!(n.apiKey||n.accessToken)}e(P,"isAuthenticated");function N(n,s){a().saveEnvFile(n,s)}e(N,"saveEnvFile");function j(n,s){a().saveApiKeyToEnv(n,s)}e(j,"saveApiKey");function $(){a().clearEnvFile()}e($,"clearEnvFile");function w(){a().removeApiKeyFromEnvFile()}e(w,"removeApiKeyFromEnv");function O(){return m()}e(O,"getDefaultConfigDir");var b=m();export{F as a,L as b,S as c,U as d,K as e,M as f,P as g,N as h,j as i,$ as j,w as k,O as l,b as m};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as T}from"./chunk-5RBLIVBF.js";import{a as S}from"./chunk-YQ56FQEO.js";import{b as A}from"./chunk-CNOD6HWU.js";import{e as x}from"./chunk-L2CFSMBC.js";import{a as C}from"./chunk-4L2ZEIRE.js";import{c as M}from"./chunk-HMMO27U4.js";import{e as k,f as E,h as p}from"./chunk-
|
|
1
|
+
import{a as T}from"./chunk-5RBLIVBF.js";import{a as S}from"./chunk-YQ56FQEO.js";import{b as A}from"./chunk-CNOD6HWU.js";import{e as x}from"./chunk-L2CFSMBC.js";import{a as C}from"./chunk-4L2ZEIRE.js";import{c as M}from"./chunk-HMMO27U4.js";import{e as k,f as E,h as p}from"./chunk-KLEF5D3A.js";import{a as w}from"./chunk-ZLLER3HP.js";async function W(v,f){let{mirrorId:i,evalTargetId:g,config:o}=v,a=w(e=>f.logger.info(e),"log"),s=await k(`/api/eval-targets/${g}`),$=await k(`/api/eval-targets/${g}/evals`);if($.length===0&&o.generateIfEmpty){a("No eval cases on target \u2014 generating from content via local LLM...");let e=await A({content:s.content,name:s.name});if(e===null)throw new Error("Case generation requires an LLM backend (claude CLI on PATH or ANTHROPIC_API_KEY) \u2014 none available on this worker.");let n=[];for(let t of e)n.push(await E(`/api/eval-targets/${g}/evals`,t));$=n,a(`Generated ${n.length} eval case(s)`)}if($.length===0)throw new T("No evals defined for target");let G=o.runsPerEval??1,R=o.timeout??12e4,j=o.iteration??1,y=new Set;if(f.job.attempts>1)for(let n=0;;n+=100){let t=await k(`/api/eval-targets/${g}/runs?jobId=${i}&limit=100&offset=${n}`);for(let r of t)y.add(`${r.evalId}|${r.configuration}|${r.runNumber}|${r.iteration}`);if(t.length<100)break}let _=[{name:"with_target",content:s.content}];o.skipBaseline||_.push({name:"without_target"});let d=[];for(let e of $)for(let n of _)for(let t=1;t<=G;t++)y.has(`${e.id}|${n.name}|${t}|${j}`)||d.push({eval_:e,configuration:n.name,targetContent:n.content,runNumber:t});y.size>0&&a(`Resuming attempt ${f.job.attempts}: ${y.size} run(s) already persisted, ${d.length} remaining`);let l=d.length,u=0,m=Math.min(o.parallel??1,4);await p(`/api/eval-jobs/${i}/progress`,{status:"running",progress:{total:l,completed:0,current:null,message:`Starting ${l} eval runs (concurrency: ${m})...`}});let b=[];async function I(e){let n=`${e.configuration} \xB7 ${e.eval_.name} \xB7 run#${e.runNumber}`;a(`[${u+1}/${l}] ${n}`);let t=x({targetType:s.type,targetContent:e.targetContent,targetName:s.name});t.leakedFiles.length&&a(`\u26A0 CONTAMINATED ${n}: ${t.leakedFiles.join(", ")} survived the strip`);try{let r=await M({prompt:e.eval_.prompt,targetContent:t.systemPrompt,workDir:t.workDir,timeout:R,model:o.model}),c={};return!o.skipGrading&&e.eval_.expectations.length>0&&!r.error&&(c=await C({prompt:e.eval_.prompt,output:r.output,expectations:e.eval_.expectations,model:o.graderModel??o.model,timeout:R})),{jobId:i,evalId:e.eval_.id,evalTargetId:s.id,evalTargetVersion:s.version,configuration:e.configuration,runNumber:e.runNumber,iteration:j,status:r.error?"failed":"completed",outputs:{...r.error?{error:r.error}:{transcript:r.output,...r.model?{model:r.model}:{}},methodology:t.methodology,delivery:t.delivery,isolated:t.isWorktree,...t.leakedFiles.length?{leakedFiles:t.leakedFiles}:{}},timing:{duration_ms:r.durationMs,total_tokens:r.totalTokens},grading:c,worktree:t.isWorktree?!0:void 0}}finally{t.cleanup()}}if(w(I,"processItem"),m<=1)for(let e of d){let n=`${e.configuration} \xB7 ${e.eval_.name} \xB7 run#${e.runNumber}`;await p(`/api/eval-jobs/${i}/progress`,{status:"running",progress:{total:l,completed:u,current:n,message:`Executing ${n}...`}});let t=await I(e);await E("/api/eval-runs",t),b.push(t),u++,await p(`/api/eval-jobs/${i}/progress`,{status:"running",progress:{total:l,completed:u,current:n,message:`Completed ${n}`}})}else{a(`Running ${l} evals with concurrency=${m} (worktree isolation)`);for(let e=0;e<d.length;e+=m){let n=d.slice(e,e+m),t=`batch ${Math.floor(e/m)+1}/${Math.ceil(d.length/m)}`;await p(`/api/eval-jobs/${i}/progress`,{status:"running",progress:{total:l,completed:u,current:t,message:`Executing ${t} (${n.length} parallel)...`}});let r=await Promise.all(n.map(I));for(let c of r)await E("/api/eval-runs",c),b.push(c),u++;await p(`/api/eval-jobs/${i}/progress`,{status:"running",progress:{total:l,completed:u,current:t,message:`Completed ${t}`}})}}let P=J(b),h;if(!o.skipGrading&&b.some(e=>e.grading&&Object.keys(e.grading).length>0))try{a(`Running meta-judge for job ${i}...`);let e=$.map(n=>{let r=b.filter(c=>c.evalId===n.id&&c.configuration==="with_target")[0];return{evalName:n.name,prompt:n.prompt,expectations:n.expectations,grading:r?.grading?r.grading:null,output:r?.outputs?.transcript?.slice(0,500)}});h=await S({targetName:s.name,evalResults:e,model:o.graderModel??o.model,timeout:6e4}),a(`Meta-judge: quality=${h.quality_score}/5, issues=${h.issues.length}`)}catch(e){a(`Meta-judge failed (non-fatal): ${e instanceof Error?e.message:String(e)}`)}let N=h?{...P,meta_judgement:h}:P;return a(`Job ${i} completed: ${u}/${l} runs`),await p(`/api/eval-jobs/${i}/state`,{result:N}).catch(e=>{a(`result persist failed: ${e instanceof Error?e.message:String(e)}`)}),N}w(W,"processEval");function J(v){let f=v.filter(a=>a.status==="completed"),i=v.filter(a=>a.status==="failed"),g=f.filter(a=>{let s=a.grading;return s&&Object.keys(s).length>0}),o=g.length>0?g.reduce((a,s)=>a+(s.grading?.summary?.pass_rate??0),0)/g.length:null;return{total:v.length,completed:f.length,failed:i.length,avgPassRate:o}}w(J,"buildSummary");export{W as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as p,e as w}from"./chunk-JZ5Z2BRO.js";import{a as o}from"./chunk-ZLLER3HP.js";import{fileURLToPath as _}from"node:url";import{existsSync as v,readFileSync as A}from"node:fs";import{dirname as L,join as b}from"node:path";function x(){let t=L(_(import.meta.url));for(let e=0;e<8;e++){let r=b(t,"package.json");if(v(r))try{let a=JSON.parse(A(r,"utf8"));if(a.name==="@rulemetric/cli"&&a.version)return a.version}catch{}let n=L(t);if(n===t)break;t=n}return"0.0.0"}o(x,"readCliVersion");var C=x(),O="https://rulemetric.com",T=class extends Error{constructor(r,n){super(n);this.statusCode=r;this.name="ApiError"}static{o(this,"ApiError")}};function I(){let t=p(),e=process.env.RULEMETRIC_API_URL??t.apiUrl;if(!e){if(process.env.RULEMETRIC_STRICT_LOCAL==="1"||t.strictLocal==="1")throw new Error("RULEMETRIC_STRICT_LOCAL is set but no RULEMETRIC_API_URL is configured \u2014 refusing the cloud default. Set RULEMETRIC_API_URL in the environment or ~/.config/rulemetric/env.");e=O}let r=new URL(e);if(r.protocol==="http:"&&r.hostname!=="localhost"&&r.hostname!=="127.0.0.1")throw new Error(`API URL must use HTTPS for non-localhost hosts: ${e}`);return e}o(I,"getBaseUrl");async function c(t,e={}){let n=`${I()}${t}`,a={"Content-Type":"application/json","User-Agent":`rulemetric-cli/${C}`,...e.headers},d=p(),m=process.env.RULEMETRIC_API_KEY||d.apiKey||w()?.accessToken||d.accessToken;m&&(a.Authorization=`Bearer ${m}`);let h=new URL(n),f=h.hostname==="localhost"||h.hostname==="127.0.0.1",P=process.env.HTTPS_PROXY,R=process.env.HTTP_PROXY;f&&(delete process.env.HTTPS_PROXY,delete process.env.HTTP_PROXY);let l=e.timeoutMs?new AbortController:void 0,g=!1,y=l?setTimeout(()=>{g=!0,l.abort()},e.timeoutMs):void 0,s;try{s=await fetch(n,{method:e.method??"GET",headers:a,body:e.body?JSON.stringify(e.body):void 0,signal:l?.signal})}catch(u){if(g){let E=new URL(n).host,U=Math.round(e.timeoutMs/1e3);throw new T(408,`Request to ${E} timed out after ${U}s. This is usually transient or a local proxy/gateway issue \u2014 retry, and if it persists check HTTPS_PROXY / the RuleMetric gateway (:8787).`)}throw u}finally{y&&clearTimeout(y),f&&(P!==void 0&&(process.env.HTTPS_PROXY=P),R!==void 0&&(process.env.HTTP_PROXY=R))}let i;if(s.headers.get("content-type")?.includes("application/json")?i=await s.json():i=await s.text(),!s.ok){let u=i&&typeof i=="object"&&"error"in i?String(i.error):`HTTP ${s.status}`;throw new T(s.status,u)}return i}o(c,"api");var $=o(t=>c(t),"apiGet"),j=o((t,e)=>c(t,{method:"POST",body:e}),"apiPost"),X=o((t,e)=>c(t,{method:"PUT",body:e}),"apiPut"),F=o((t,e)=>c(t,{method:"PATCH",body:e}),"apiPatch"),B=o(t=>c(t,{method:"DELETE"}),"apiDelete");export{O as a,T as b,I as c,c as d,$ as e,j as f,X as g,F as h,B as i};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as J}from"./chunk-B22HYCBV.js";import{a as j}from"./chunk-
|
|
1
|
+
import{a as J}from"./chunk-B22HYCBV.js";import{a as j}from"./chunk-ULMEKK7C.js";import{b as I,c as P,d as v}from"./chunk-5RUEROLC.js";import{a as E}from"./chunk-X23L2MF6.js";import{d as T}from"./chunk-NJ5UED3H.js";import{a as b}from"./chunk-ZLLER3HP.js";import{useEffect as R,useState as i}from"react";import{Box as l,Text as s,useInput as Z}from"ink";import{jsx as t,jsxs as a}from"react/jsx-runtime";function K({onClose:A,activeOrg:F,defaultProjectPath:y,width:_}){let{jobs:u,error:L,loading:$,refetch:S}=j(20),[M,C]=i([]),[d,m]=i("list"),[f,w]=i(0),[h,g]=i(null),[x,B]=i(null),[p,c]=i(null);R(()=>{v().then(C).catch(o=>{let r=o instanceof Error?o.message:String(o);c(`couldn't load launchers: ${r}`),C([{tool:"claude_code",capabilities:{headless:!0,interactive:!0,remoteSpawn:!0}}])})},[]),R(()=>{if(!p)return;let o=setTimeout(()=>c(null),5e3);return()=>clearTimeout(o)},[p]),Z((o,r)=>{if(h){if(o==="y"||o==="Y"){let e=h.id;g(null),P(e).then(()=>{S(),c(`cancelled ${e.slice(0,8)}`)}).catch(n=>c(`cancel failed: ${n instanceof Error?n.message:String(n)}`))}else(o==="n"||o==="N"||r.escape)&&g(null);return}if(r.escape){if(d!=="none"){m("none");return}A();return}if(r.tab){m(e=>e==="list"?"form":e==="form"?"none":"list");return}if(o!=="q"&&d==="list"){if(r.upArrow)w(e=>Math.max(0,e-1));else if(r.downArrow)w(e=>Math.min(u.length-1,e+1));else if(o==="c"){let e=u[f];e&&(e.status==="running"||e.status==="queued"||e.status==="pending")&&g(e)}else if(o==="r"){let e=u[f],n=e?.result?.externalSessionId;e&&e.tool==="claude_code"&&n?(B({tool:"claude_code",projectPath:e.config.projectPath,resumeSessionId:n}),m("form")):c("resume needs a Claude Code session with a session id")}else if(o==="o"){let n=u[f]?.result?.externalSessionId;if(n){let O=process.env.RULEMETRIC_WEB_URL??"http://localhost:5174";import("node:child_process").then(({spawn:U})=>{U("open",[`${O}/sessions/${n}`],{detached:!0,stdio:"ignore"}).unref()})}}}});async function N(o){await I(o),B(null),m("list"),c("launched"),S()}return b(N,"handleSubmit"),a(l,{flexDirection:"column",borderStyle:"round",borderColor:T,width:_,paddingX:1,children:[a(l,{children:[t(s,{bold:!0,color:T,children:"Launcher"}),t(s,{dimColor:!0,children:" active org: "}),t(s,{children:F??"(none)"}),$&&t(s,{dimColor:!0,children:" loading\u2026"}),L&&a(s,{color:"#F55B5B",children:[" \u26A0 ",L]})]}),t(l,{marginTop:1,children:t(E,{jobs:u,selectedIndex:f,focused:d==="list"})}),t(l,{marginTop:1,children:t(J,{launchers:M,defaultProjectPath:x?.projectPath??y,defaultTool:x?.tool,defaultResumeSessionId:x?.resumeSessionId,focused:d==="form",onSubmit:N})}),h&&t(l,{marginTop:1,children:a(s,{color:"#FFD700",children:["Cancel job ",h.id.slice(0,8),"? (y/n)"]})}),p&&t(l,{marginTop:1,children:a(s,{dimColor:!0,children:["\xB7 ",p]})}),t(l,{marginTop:1,children:a(s,{dimColor:!0,children:["\u2191\u2193 select tab focus c cancel r resume o open esc ",d==="none"?"close":"back"]})})]})}b(K,"LauncherOverlay");export{K as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as o,f as a}from"./chunk-
|
|
1
|
+
import{b as o,f as a}from"./chunk-KLEF5D3A.js";import{a as n}from"./chunk-ZLLER3HP.js";function c(e){return e==null?e??null:e instanceof Date?e.toISOString():e}n(c,"serializeDate");async function d(e){let r={provider:e.provider,plan:e.plan,limitType:e.limitType,value:e.value,unit:e.unit,comparator:e.comparator,resetsAt:c(e.resetsAt),sourceType:e.sourceType,sourceUrl:e.sourceUrl,sourceEvidence:e.sourceEvidence,confidence:e.confidence,observedAt:c(e.observedAt)};return a("/api/internal/research/observe",r)}n(d,"postObservation");async function f(e){let r=0,i=0,s=[];for(let u of e)try{await d(u),r++}catch(t){i++;let p=t instanceof o?`HTTP ${t.statusCode}: ${t.message}`:String(t);s.length<5&&s.push(p)}return{posted:r,failed:i,errors:s}}n(f,"postObservations");export{d as a,f as b};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as c,c as d}from"./chunk-IZTIYR5Q.js";import{d as u}from"./chunk-
|
|
1
|
+
import{a as c,c as d}from"./chunk-IZTIYR5Q.js";import{d as u}from"./chunk-6VKQT2J3.js";import{a}from"./chunk-NIRD7ETU.js";import{a as n}from"./chunk-QY3UKLDE.js";import{b as i}from"./chunk-KLEF5D3A.js";import{g as r}from"./chunk-JZ5Z2BRO.js";import{a as s}from"./chunk-ZLLER3HP.js";import{Command as f,Flags as h}from"@oclif/core";function p(t){return t instanceof i?t.statusCode>=500||t.statusCode===408||t.statusCode===0:/fetch failed|ECONNREFUSED|ECONNRESET|ETIMEDOUT|EAI_AGAIN|bad gateway|timed out/i.test(t.message??"")}s(p,"isAvailabilityError");var m=class extends f{static{s(this,"BaseCommand")}static baseFlags={"api-url":h.string({description:"Override API base URL",env:"RULEMETRIC_API_URL",hidden:!0})};async init(){await super.init();let{flags:e}=await this.parse(this.constructor);e["api-url"]&&(process.env.RULEMETRIC_API_URL=e["api-url"]);let o=d(this.config.version);o&&!this.argv.includes("--quiet")&&!process.env.RULEMETRIC_QUIET&&process.stderr.write(`
|
|
2
2
|
${o}
|
|
3
3
|
|
|
4
4
|
`),c();try{await a()}catch{}}requireAuth(){r()||this.error("Not logged in. Run `rulemetric auth login` to authenticate."),n()}async catch(e){throw p(e)&&await u({command:this.id,statusCode:e instanceof i?e.statusCode:void 0,message:e.message,cliVersion:this.config.version}),e instanceof i&&(e.statusCode===401&&this.error("Session expired. Run `rulemetric auth login` to re-authenticate."),this.error(e.message)),(e.message?.includes("fetch failed")||e.message?.includes("ECONNREFUSED"))&&this.error("Could not connect to the API server. Is it running?"),e}};export{m as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as d,d as t}from"./chunk-
|
|
1
|
+
import{c as d,d as t}from"./chunk-AI6FMGKM.js";import{a as r}from"./chunk-ZLLER3HP.js";async function g(o,i){let{evalTargetId:s}=o;try{let e=await t({targetId:s,engineFlag:"auto",skipReviewed:!0,log:r(a=>i.logger.info(`[judge-review] ${a}`),"log"),warn:r(a=>i.logger.warn(`[judge-review] ${a}`),"warn")});return{evalTargetId:s,reviewerModel:e.reviewerModel,comparedPairs:e.report.pairs,disagreements:e.report.disagreements.length,persisted:e.persisted,alreadyReviewed:e.alreadyReviewed,deferredPartialRuns:e.deferredPartialRuns}}catch(e){if(e instanceof d)return i.logger.info(`[judge-review] skipped (${e.reason}): ${e.message}`),{evalTargetId:s,skipped:e.reason};throw e}}r(g,"processJudgeReview");export{g as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as l}from"./chunk-
|
|
1
|
+
import{c as l}from"./chunk-KLEF5D3A.js";import{c as a,l as u}from"./chunk-JZ5Z2BRO.js";import{a as o}from"./chunk-ZLLER3HP.js";var c=120*1e3,t=null;async function k(){if(process.env.RULEMETRIC_API_KEY)return!0;let e=a(u());if(!e.isRefreshable(c))return!0;let r=e.loadToken();return r?.refreshToken?t||(t=f(e,r).finally(()=>{t=null}),t):!0}o(k,"ensureFreshToken");async function f(e,r){let s;try{s=await fetch(`${l()}/auth/refresh`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:r.refreshToken})})}catch{return!0}if(s.status===401)return e.clearToken(),!1;if(!s.ok)return!0;let n=await s.json().catch(()=>null);if(!n?.accessToken||!n.refreshToken)return!0;let i={accessToken:n.accessToken,refreshToken:n.refreshToken,expiresAt:n.expiresAt??r.expiresAt,email:n.email??r.email};return e.saveToken(i),e.saveEnvFile(i.accessToken),!0}o(f,"doRefresh");export{k as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as i}from"./chunk-
|
|
1
|
+
import{a as i}from"./chunk-5KD2N2MH.js";import{h as s}from"./chunk-KLEF5D3A.js";import{a as n}from"./chunk-ZLLER3HP.js";async function l(a,c){let{mirrorId:g,evalTargetId:p,config:r}=a,e=n(o=>c.logger.info(o),"log");await i(r,p,e);let t={type:"conversation",conversationId:r.conversationId};return await s(`/api/eval-jobs/${g}/state`,{result:t}).catch(o=>{e(`result persist failed: ${o instanceof Error?o.message:String(o)}`)}),t}n(l,"processConversation");export{l as a};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as S,b as z,c as T}from"./chunk-QFVGUZDO.js";import{a as O}from"./chunk-
|
|
1
|
+
import{a as S,b as z,c as T}from"./chunk-QFVGUZDO.js";import{a as O}from"./chunk-5R5RGKOW.js";import{a as j}from"./chunk-5RBLIVBF.js";import{c as A,d as C,f as b}from"./chunk-B3BHB26P.js";import{e as _,f as I,h as u}from"./chunk-KLEF5D3A.js";import{a as $}from"./chunk-ZLLER3HP.js";async function D(f,m){let{mirrorId:o,projectPath:s,projectId:i,config:p}=f,e=$(n=>m.logger.info(n),"log");if(p?.sessionId)return M({mirrorId:o,sessionId:p.sessionId},e);e(`Processing insights job ${o}...`),await u(`/api/insights-jobs/${o}/progress`,{status:"running",progress:{step:"reading_data"}});try{let{repaired:n}=await I("/api/sessions/repair-analyzed-at",{});n>0&&e(` Repaired analyzed_at on ${n} orphan session(s).`)}catch(n){e(` Warning: analyzed_at repair failed: ${n instanceof Error?n.message:String(n)}`)}let a=await J(s,i);if(!a)throw new j("No session data found \u2014 ensure sessions are captured and enriched.");e(` Found ${a.stats.sessions} sessions, generating recommendations...`);let w=20,c=200;if(C()!=="none"){let n=0,t=0;try{for(;n<c;){let l=await _(`/api/sessions?hasAnalysis=false&limit=${w}&offset=${t}`);if(l.length===0)break;e(` Generating facets for ${l.length} un-analyzed sessions (drained ${n} so far)...`);for(let g of l){if(n>=c)break;try{let d=await _(`/api/sessions/${g.id}/events?limit=100`);if(d.length<2){n++,t++;continue}let P=d.filter(h=>h.eventType==="user_message"||h.eventType==="human").map(h=>h.content?.slice(0,200)??"").filter(Boolean).join(`
|
|
2
2
|
---
|
|
3
3
|
`);if(!P){n++,t++;continue}let E=await b(T,P,4096);if(E){let h=d.filter(R=>R.eventType==="user_message"||R.eventType==="human").length;await u(`/api/sessions/${g.id}/enrich`,{analysis:{source:"generated_facets",...E},analyzedEventCount:d.length,analyzedTurnCount:h}),e(` Generated facets for session ${g.id} (${g.tool})`)}else t++;n++}catch(d){e(` Failed to generate facets for session ${g.id}: ${d instanceof Error?d.message:String(d)}`),n++,t++}}if(l.length<w)break}}catch(l){e(` Warning: facet generation failed after ${n} sessions: ${l instanceof Error?l.message:String(l)}`)}}let r={},y=S.length+1;for(let n=0;n<S.length;n++){let t=S[n];e(` [${n+1}/${y}] Generating ${t.name}...`);try{await u(`/api/insights-jobs/${o}/progress`,{status:"running",progress:{step:t.name,current:n+1,total:y,partial:{...r}}})}catch(g){e(` Warning: progress update failed for ${t.name}: ${g instanceof Error?g.message:String(g)}`)}e(` Running LLM prompt for ${t.name}...`);let l=await b(t.prompt,a.summary,t.maxTokens);l?(r[t.name]=l,e(` Got result for ${t.name}`)):e(` No result for ${t.name} (LLM returned null)`)}e(` [${y}/${y}] Generating at_a_glance...`),await u(`/api/insights-jobs/${o}/progress`,{status:"running",progress:{step:"at_a_glance",current:y,total:y,partial:{...r}}});let N=[a.summary,r.what_works?`
|
|
4
4
|
## What Works
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as m,e as p}from"./chunk-
|
|
1
|
+
import{d as m,e as p}from"./chunk-5R5RGKOW.js";import{a as C}from"./chunk-N7TGRFVZ.js";import{f as c,i as f}from"./chunk-45DOTNQM.js";import{a as r}from"./chunk-ZLLER3HP.js";import*as a from"node:fs/promises";import*as g from"node:path";import{eq as b}from"drizzle-orm";async function v(e){let n=e;for(let t=0;t<50;t++){try{return await a.stat(g.join(n,"pnpm-workspace.yaml")),n}catch{}let i=g.dirname(n);if(i===n)return null;n=i}return null}r(v,"findRepoRoot");async function k(e){if(e)try{return await a.readFile(e,"utf-8")}catch{return null}let n=await v(process.cwd())??process.cwd(),t=g.join(n,"CHANGELOG.md");try{return await a.readFile(t,"utf-8")}catch{return null}}r(k,"readChangelog");var _="https://rulemetric.com";function D(e){let n=e.date??new Date().toISOString().slice(0,10),t=C({version:e.version,date:n,sections:e.sections,unsubscribeUrl:"{{unsubscribe_url}}",recipientName:"{{recipient_name}}",productUrl:_});return{version:e.version,releaseDate:n,subject:t.subject,htmlBody:t.html,textBody:t.text,sections:e.sections}}r(D,"renderRow");async function R(e={}){let n=e.db??f(),t=e.logger??{info:r(s=>console.log(s),"info"),warn:r(s=>console.warn(s),"warn")},i=await k(e.changelogPath);if(i===null)return t.info("[cron_check_changelog] CHANGELOG.md not found; nothing to do"),{createdCount:0,skippedCount:0};let y=m(i),h=p(y);if(h.length===0)return t.info("[cron_check_changelog] No announceable entries; nothing to do"),{createdCount:0,skippedCount:0};let d=0,l=0;for(let s of h){if((await n.select({id:c.id}).from(c).where(b(c.version,s.version)).limit(1)).length>0){l++;continue}let o=D(s);try{await n.insert(c).values({version:o.version,releaseDate:o.releaseDate,subject:o.subject,htmlBody:o.htmlBody,textBody:o.textBody,sections:o.sections,status:"draft"}),d++,t.info(`[cron_check_changelog] Created draft announcement for ${o.version}`)}catch(u){let w=u instanceof Error?u.message:String(u);if(/duplicate key|unique/i.test(w)){l++;continue}throw u}}return t.info(`[cron_check_changelog] Done: created ${d}, skipped ${l}`),{createdCount:d,skippedCount:l}}r(R,"processChangelog");export{R as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as u,e as t,i as x}from"./chunk-
|
|
1
|
+
import{d as u,e as t,i as x}from"./chunk-45DOTNQM.js";import{a as A}from"./chunk-4L2ZEIRE.js";import{b as P}from"./chunk-G5BXZT6F.js";import{c as E}from"./chunk-HMMO27U4.js";import{a as f}from"./chunk-ZLLER3HP.js";import{eq as s}from"drizzle-orm";var v=f(m=>(m.summary.pass_rate??0)>=1?1:0,"fullPassScore");async function q(m,d={}){let r=d.db??x(),w=d.executeEval??E,y=d.grade??A,n=d.now??Date.now,[e]=await r.select().from(t).where(s(t.id,m.experimentId)).limit(1);if(!e)return{skipped:"not_found"};if(e.status==="completed"||e.status==="failed")return{skipped:"already_terminal",status:e.status};let[g]=await r.select({body:u.body}).from(u).where(s(u.id,e.memoryId)).limit(1);if(!g)return await r.update(t).set({status:"failed",error:"memory no longer exists",completedAt:new Date(n())}).where(s(t.id,e.id)),{skipped:"memory_gone",status:"failed"};await r.update(t).set({status:"running",startedAt:new Date(n())}).where(s(t.id,e.id));let b=e.expectations??[],l=e.model??void 0,a=[],h=0;try{for(let i=0;i<e.trials;i++){let c=await w({prompt:e.taskPrompt,targetContent:g.body,model:l}),p=await w({prompt:e.taskPrompt,model:l});if(c.error||p.error){h++;continue}let[D,M]=await Promise.all([y({prompt:e.taskPrompt,output:c.output,expectations:b,model:l}),y({prompt:e.taskPrompt,output:p.output,expectations:b,model:l})]);a.push({withScore:v(D),withoutScore:v(M),withLatency:c.durationMs/1e3,withoutLatency:p.durationMs/1e3})}if(a.length===0){let i=`no trials completed (${h}/${e.trials} runs errored \u2014 is the claude CLI available?)`;return await r.update(t).set({status:"failed",error:i,completedAt:new Date(n())}).where(s(t.id,e.id)),{status:"failed",requestedTrials:e.trials,completedTrials:0}}let o=P(a);return await r.update(t).set({status:"completed",result:{verdict:o,pairs:a,completedTrials:a.length,model:l??null},completedAt:new Date(n())}).where(s(t.id,e.id)),{status:"completed",requestedTrials:e.trials,completedTrials:a.length,significant:o.significant,delta:o.delta}}catch(o){let i=o instanceof Error?o.message:String(o);return await r.update(t).set({status:"failed",error:i.slice(0,500),completedAt:new Date(n())}).where(s(t.id,e.id)),{status:"failed",requestedTrials:e.trials,completedTrials:a.length}}}f(q,"processMemoryAb");export{q as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as s,b as n,c as a,d as g}from"./chunk-3AV3GTMP.js";import{e as o}from"./chunk-
|
|
1
|
+
import{a as s,b as n,c as a,d as g}from"./chunk-3AV3GTMP.js";import{e as o}from"./chunk-KLEF5D3A.js";import{a as e}from"./chunk-ZLLER3HP.js";var i=!1;async function c(){if(process.env.RULEMETRIC_ORG_ID)return;let r=s();if(!(r&&!g(r)))try{let t=await o("/api/profile");if(!t.activeOrgId){a();return}if(r&&t.activeOrgId===r.orgId){n({orgId:r.orgId,orgSlug:r.orgSlug,syncedAt:Date.now()});return}let d=(await o("/api/orgs")).find(l=>l.id===t.activeOrgId);n({orgId:t.activeOrgId,orgSlug:d?.slug,syncedAt:Date.now()})}catch{}}e(c,"syncActiveOrgFromServer");async function p(){i||(i=!0,await c())}e(p,"maybeRefreshActiveOrg");async function v(){i=!0,await c()}e(v,"bootstrapActiveOrg");function O(){i=!1}e(O,"_resetRefreshAttempt");export{p as a,v as b,O as c};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as u}from"./chunk-
|
|
1
|
+
import{c as u}from"./chunk-6VKQT2J3.js";import{b as c,e as y,f as m}from"./chunk-KLEF5D3A.js";import{a as n,b as t,i as s,k as p}from"./chunk-JZ5Z2BRO.js";import{a}from"./chunk-ZLLER3HP.js";import{hostname as l}from"node:os";async function R(f,r,h){t();let o=process.env.RULEMETRIC_API_KEY,d=n().apiKey;if(o||d)try{await y("/api/profile");return}catch(e){if(!(e instanceof c)||e.statusCode!==401)return;if(o){r('Your exported RULEMETRIC_API_KEY was rejected (revoked?). Unset it or replace it with a fresh key (`rulemetric auth create-key --name "my-laptop"`).');return}p(),t(),r("Stored API key was rejected (revoked?) \u2014 replacing it with a fresh one.")}let i=`${l()} (auto)`;try{let e=await m("/api/auth/api-keys",{name:i});s(e.key,process.env.RULEMETRIC_API_URL),t(),f(`Created API key "${i}" for hooks + proxy auth (saved to your config).`),u("key_created",{},h)}catch(e){let k=e instanceof Error?e.message:String(e);r(`Could not auto-create an API key (${k}). Hooks/proxy will work via your session token for ABOUT AN HOUR \u2014 the token expires, and capture then stops until a key exists. Run \`rulemetric auth create-key --name "my-laptop"\` (or \`rulemetric auth login\` again) to fix this permanently.`)}}a(R,"ensureDeviceApiKey");export{R as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as i}from"./chunk-
|
|
1
|
+
import{a as i}from"./chunk-5RUEROLC.js";import{a as f}from"./chunk-ZLLER3HP.js";import{useEffect as J,useState as u,useCallback as m,useRef as s}from"react";var y=5e3;function T(a=20){let[d,b]=u([]),[g,l]=u(null),[h,p]=u(!0),r=s(!1),e=s(null),c=s(0),t=m(async()=>{let o=++c.current;try{let n=await i({limit:a});if(r.current||o!==c.current)return;b(n),l(null)}catch(n){if(r.current||o!==c.current)return;l(n instanceof Error?n.message:String(n))}finally{if(r.current||o!==c.current)return;p(!1),e.current=setTimeout(()=>{t()},y)}},[a]),L=m(()=>{e.current&&clearTimeout(e.current),t()},[t]);return J(()=>(r.current=!1,t(),()=>{r.current=!0,e.current&&clearTimeout(e.current)}),[t]),{jobs:d,error:g,loading:h,refetch:L}}f(T,"useLaunchJobs");export{T as a};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{f as E}from"./chunk-B3BHB26P.js";import{b,e as y,f as k,h as M}from"./chunk-
|
|
1
|
+
import{f as E}from"./chunk-B3BHB26P.js";import{b,e as y,f as k,h as M}from"./chunk-KLEF5D3A.js";import{a as u}from"./chunk-ZLLER3HP.js";var v=50,I=24e3,P=3,R=3,C=40,N=4e3,x=new Set(["fact","decision","correction","convention"]),L=`You are distilling DURABLE, PROJECT-SPECIFIC knowledge from an AI coding session so a future agent working on the SAME project starts smarter.
|
|
2
2
|
|
|
3
3
|
Extract ONLY facts / decisions / corrections / conventions that will STILL be true and useful in FUTURE sessions \u2014 architecture facts, deliberate design decisions, corrections of a wrong approach, or project conventions.
|
|
4
4
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as R,g as v,h as T,j as I,m as C}from"./chunk-
|
|
1
|
+
import{a as R,g as v,h as T,j as I,m as C}from"./chunk-3QXRLIGC.js";import{e as d}from"./chunk-QWCEZEDO.js";import{d as g}from"./chunk-NTKO4H2K.js";import{e as _}from"./chunk-KLEF5D3A.js";import{g as m,l as k}from"./chunk-JZ5Z2BRO.js";import{a as i}from"./chunk-ZLLER3HP.js";import{execSync as j}from"node:child_process";import{existsSync as p,readFileSync as y}from"node:fs";import{homedir as f}from"node:os";import{join as a}from"node:path";var P=["install","auth","hooks","worker"],O=["judge"],M=[...P,...O];function $(){return{projectPath:process.cwd(),configDir:k()}}i($,"defaultContext");var A=a(f(),".mitmproxy","mitmproxy-ca-cert.pem");function S(e){if(!e)return"";if(e.length<=8)return"*".repeat(e.length);let t=e.slice(0,4),n=e.slice(-4);return`${t}${"*".repeat(Math.max(4,e.length-8))}${n}`}i(S,"maskToken");function te(e,t){let n=e===null?[]:e.replace(/\n$/,"").split(`
|
|
2
2
|
`),o=t===null?[]:t.replace(/\n$/,"").split(`
|
|
3
3
|
`),s=[],u=Math.max(n.length,o.length);for(let c=0;c<u;c++){let l=n[c],r=o[c];l===r?s.push(` ${l}`):(l!==void 0&&s.push(`-${l}`),r!==void 0&&s.push(`+${r}`))}return s.join(`
|
|
4
4
|
`)}i(te,"renderDiff");function x(e,t){let n=a(e,"env");if(!p(n))return null;try{let s=y(n,"utf-8").match(new RegExp(`^${t}=(.+)$`,"m"));return s?s[1]:null}catch{return null}}i(x,"readEnvValue");async function b(){if(!m())return!1;try{return(await Promise.race([_("/api/setup/status"),new Promise((t,n)=>setTimeout(()=>n(new Error("setup/status timeout")),2500))]))?.workerActive===!0}catch{return!1}}i(b,"workerActive");function E(e,t){let n=a(e,".claude",t),o={},s=null;if(p(n))try{s=y(n,"utf-8").replace(/\n$/,""),o=JSON.parse(s)}catch{o={}}return{settings:o,before:s}}i(E,"readProjectSettings");function D(e){let{settings:t,before:n}=E(e,"settings.local.json");return v(t),{before:n,after:JSON.stringify(t,null,2)}}i(D,"projectHooksSettings");function N(e){let{settings:t,before:n}=E(e,"settings.local.json"),o={...t.env??{}};return o.HTTPS_PROXY=`http://localhost:${d}`,o.NO_PROXY=I,o.NODE_EXTRA_CA_CERTS=A,{before:n,after:JSON.stringify({...t,env:o},null,2)}}i(N,"projectProxyEnvSettings");function U(e){let{settings:t,before:n}=E(e,"settings.json");if(n===null)return null;let{removed:o}=C(t,d);return o?{before:n,after:JSON.stringify(t,null,2)}:null}i(U,"projectSharedSettingsMigration");var Y=a(f(),"Library","LaunchAgents","com.rulemetric.worker.plist"),G=a(f(),".config","systemd","user","rulemetric-worker.service");function h(e){j(e,{stdio:"inherit"})}i(h,"runCommand");var L=[{id:"install",title:"Install the CLI",command:"npm install -g @rulemetric/cli",async detect(){return m()||await b()},async plan(){return{id:"install",title:"Install the CLI",command:"npm install -g @rulemetric/cli",artifacts:[{path:"npm install -g @rulemetric/cli",kind:"command",before:null,after:"rulemetric --version # verifies the binary is on PATH"}]}},async apply(){h("npm install -g @rulemetric/cli")}},{id:"auth",title:"Authenticate",command:"rulemetric auth login",async detect(){return m()},async plan(e){let t=a(e.configDir,"env"),n=null;if(p(t))try{n=X(y(t,"utf-8"))}catch{n="(unreadable)"}let o=x(e.configDir,"RULEMETRIC_ACCESS_TOKEN"),u=[`RULEMETRIC_ACCESS_TOKEN=${S(o||"<token-from-login>")}`],c=x(e.configDir,"RULEMETRIC_API_KEY");c&&u.push(`RULEMETRIC_API_KEY=${S(c)}`);let l=process.env.RULEMETRIC_API_URL;l&&u.push(`RULEMETRIC_API_URL=${l}`);let r=u.join(`
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as v,b as u,e as y,g as d}from"../../chunk-
|
|
1
|
+
import{a as v,b as u,e as y,g as d}from"../../chunk-IQCE4VBP.js";import{a as h}from"../../chunk-LWI5K6T4.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-6VKQT2J3.js";import"../../chunk-NIRD7ETU.js";import"../../chunk-QY3UKLDE.js";import"../../chunk-3AV3GTMP.js";import"../../chunk-KLEF5D3A.js";import"../../chunk-JZ5Z2BRO.js";import{a as p}from"../../chunk-ZLLER3HP.js";import{Args as k,Flags as o}from"@oclif/core";import{existsSync as T}from"node:fs";import{homedir as P}from"node:os";import{join as I}from"node:path";var A=I(P(),".gemini","antigravity-ide","brain"),g=class x extends h{static{p(this,"AntigravityBackfill")}static description="Backfill historical events from an Antigravity conversation transcript into a RuleMetric session. Useful for seeding a conversation that existed before hooks were installed \u2014 the live hook intentionally only captures forward.";static examples=["<%= config.bin %> antigravity backfill 26fd215d-f43b-4ea5-b177-dc2c0e696f97 --session 158db9aa-68ee-43fc-961b-f3a180578694","<%= config.bin %> antigravity backfill 26fd215d-f43b-4ea5-b177-dc2c0e696f97 --dry-run"];static args={conversationId:k.string({description:"Antigravity conversationId (UUID) \u2014 the directory name under ~/.gemini/antigravity-ide/brain/",required:!0})};static flags={session:o.string({char:"s",description:"RuleMetric session UUID to POST events into. If omitted, resolved from the hook tmp file ($TMPDIR/rulemetric/<conversationId>) \u2014 fails if neither is present."}),transcript:o.string({description:"Path to the transcript.jsonl file. Defaults to ~/.gemini/antigravity-ide/brain/<conversationId>/.system_generated/logs/transcript.jsonl"}),"after-step":o.integer({description:"Only emit records with step_index > this value. Default: read from existing state file, else -1 (everything)."}),limit:o.integer({description:"Cap on the number of records to process this run."}),"dry-run":o.boolean({default:!1,description:"Classify records without POSTing. Reports counts only."}),"save-state":o.boolean({default:!0,allowNo:!0,description:"After backfill, persist the highest step_index so the live hook resumes from there."})};async run(){let{args:b,flags:e}=await this.parse(x),t=b.conversationId;d.loadEnvFile(),process.env.RULEMETRIC_API_URL||this.error("RULEMETRIC_API_URL is not set. Configure it via env or ~/.config/rulemetric/env.");let l=e.transcript??I(A,t,".system_generated","logs","transcript.jsonl");T(l)||this.error(`Transcript not found: ${l}`);let m=e.session??d.resolveRwSessionId(t);m||this.error(`No RuleMetric session resolved. Pass --session <uuid>, or run the Antigravity hook at least once so $TMPDIR/rulemetric/${t} is populated.`);let n=e["after-step"];n===void 0&&(n=d.load(t)?.lastStepIdx??-1);let i=v(l,n);e.limit!==void 0&&i.length>e.limit&&(i=i.slice(0,e.limit));let R=u(l);if(this.log(`Conversation ${t}: transcript max step = ${R}, after-step = ${n}, records to process = ${i.length}`),i.length===0){this.log("Nothing to backfill.");return}if(e["dry-run"]){let r=0,a=0,c={};for(let S of i){let f=(await import("../../lib/antigravity-transcript.js")).classifyRecord(S,0);f?(r++,c[f.eventType]=(c[f.eventType]??0)+1):a++}this.log(`Dry run: would emit ${r}, skip ${a}. By eventType: ${JSON.stringify(c)}`);return}let w=Date.now(),s=await y(i,m,t,n,{onProgress:p(({attempted:r,total:a})=>{(r%100===0||r===a)&&process.stderr.write(` \u2026${r}/${a}
|
|
2
2
|
`)},"onProgress")}),$=((Date.now()-w)/1e3).toFixed(1);this.log(`Backfill complete in ${$}s. attempted=${s.attempted} emitted=${s.emitted} skipped=${s.skipped} failed=${s.failed} highestStepIdx=${s.highestStepIdx}`),e["save-state"]?(d.save(t,{lastStepIdx:s.highestStepIdx}),this.log(`State saved \u2192 live hook will resume from step_index > ${s.highestStepIdx}.`)):this.log("State NOT saved (--no-save-state). Live hook will re-emit any new records from after-step.")}};export{g as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as n}from"../../chunk-
|
|
1
|
+
import{a as n}from"../../chunk-LWI5K6T4.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-6VKQT2J3.js";import"../../chunk-NIRD7ETU.js";import"../../chunk-QY3UKLDE.js";import"../../chunk-3AV3GTMP.js";import{f as r}from"../../chunk-KLEF5D3A.js";import{i as o,l as s}from"../../chunk-JZ5Z2BRO.js";import{a}from"../../chunk-ZLLER3HP.js";import*as c from"node:path";import{Flags as l}from"@oclif/core";var t=class g extends n{static{a(this,"AuthCreateKey")}static description="Create a long-lived API key for CLI and proxy authentication";static examples=['<%= config.bin %> auth create-key --name "laptop"','<%= config.bin %> auth create-key --name "ci token" --no-save'];static flags={name:l.string({char:"n",description:"Name for this key",required:!0}),save:l.boolean({char:"s",description:"Save key to ~/.config/rulemetric/env for hooks/proxy",default:!0,allowNo:!0})};async run(){let{flags:i}=await this.parse(g),e=await r("/api/auth/api-keys",{name:i.name});this.log(""),this.log("API key created successfully:"),this.log(""),this.log(` Name: ${e.name}`),this.log(` Key: ${e.key}`),this.log(` Prefix: ${e.keyPrefix}`),this.log(""),this.warn("Save this key now \u2014 it will not be shown again."),i.save&&(o(e.key,process.env.RULEMETRIC_API_URL),this.log(""),this.log(`Key saved to ${c.join(s(),"env")} (RULEMETRIC_API_KEY)`),this.log("Hooks and proxy will use this key automatically."))}};export{t as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as f}from"../../chunk-
|
|
1
|
+
import{a as f}from"../../chunk-RJLAAKEN.js";import{a as w}from"../../chunk-LWI5K6T4.js";import"../../chunk-IZTIYR5Q.js";import{c}from"../../chunk-6VKQT2J3.js";import"../../chunk-NIRD7ETU.js";import{b as n}from"../../chunk-QY3UKLDE.js";import"../../chunk-3AV3GTMP.js";import{b as r,d as a}from"../../chunk-KLEF5D3A.js";import{b as m,d,h as u,i as g}from"../../chunk-JZ5Z2BRO.js";import{a as l}from"../../chunk-ZLLER3HP.js";import{Flags as p}from"@oclif/core";var h=class y extends w{static{l(this,"AuthLogin")}static description="Log in to RuleMetric";static examples=["<%= config.bin %> auth login","<%= config.bin %> auth login -e user@example.com"];static flags={email:p.string({char:"e",description:"Email address"}),password:p.string({char:"p",description:"Password (for non-interactive use)"}),"api-key":p.string({description:"Authenticate with an API key from https://rulemetric.com/connect (required for Google/GitHub sign-ins, which have no password)",exclusive:["password"]})};async run(){let{flags:s}=await this.parse(y);if(s["api-key"]){await this.loginWithApiKey(s["api-key"]);return}let e=s.email,t=s.password;if(!e||!t){process.stdin.isTTY||this.error("Missing credentials in a non-interactive shell. Pass --email/-e and --password/-p, or set RULEMETRIC_API_KEY (create a key at https://rulemetric.com/connect).");let{input:o,password:k}=await import("@inquirer/prompts");this.log("Signed up with Google or GitHub? You have no password \u2014 press Ctrl-C and run:"),this.log(" rulemetric auth login --api-key <key> (create one at https://rulemetric.com/connect)"),this.log(""),e||(e=await o({message:"Email:"})),t||(t=await k({message:"Password:"}))}let i;try{i=await a("/auth/login",{method:"POST",body:{email:e,password:t},timeoutMs:2e4})}catch(o){throw o instanceof r&&o.statusCode===401&&this.error(`Invalid email or password.
|
|
2
2
|
|
|
3
3
|
If you signed up with Google or GitHub, you have no password \u2014 that is why this cannot work. Create an API key at https://rulemetric.com/connect, then run:
|
|
4
4
|
rulemetric auth login --api-key <key>`),o}let v=i.expiresAt??new Date(Date.now()+3600*1e3).toISOString();d({accessToken:i.accessToken,refreshToken:i.refreshToken,expiresAt:v,email:i.email}),u(i.accessToken,process.env.RULEMETRIC_API_URL),await n(),await f(this.log.bind(this),this.warn.bind(this),this.config.version),c("auth_login",{},this.config.version),this.log(`Logged in as ${i.email}`)}async loginWithApiKey(s){let e=s.trim();e||this.error("Empty --api-key. Create one at https://rulemetric.com/connect"),process.env.RULEMETRIC_API_KEY=e;try{await a("/api/setup/status",{timeoutMs:2e4})}catch(t){throw delete process.env.RULEMETRIC_API_KEY,t instanceof r&&(t.statusCode===401||t.statusCode===403)&&this.error("That API key was rejected. Check you copied it whole (it is shown only once at creation) or mint a new one at https://rulemetric.com/connect"),t}g(e,process.env.RULEMETRIC_API_URL),m(),await n(),c("auth_login",{method:"api_key"},this.config.version),this.log(`Authenticated with API key ${e.slice(0,11)}...`),this.log("Verify any time with: rulemetric auth status")}};export{h as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as s}from"../../chunk-
|
|
1
|
+
import{a as s}from"../../chunk-LWI5K6T4.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-6VKQT2J3.js";import"../../chunk-NIRD7ETU.js";import"../../chunk-QY3UKLDE.js";import"../../chunk-3AV3GTMP.js";import"../../chunk-KLEF5D3A.js";import{f as i,j as r}from"../../chunk-JZ5Z2BRO.js";import{a as o}from"../../chunk-ZLLER3HP.js";var e=class t extends s{static{o(this,"AuthLogout")}static description="Log out of RuleMetric";static examples=["<%= config.bin %> auth logout"];async run(){await this.parse(t),i(),r(),this.log("Logged out successfully.")}};export{e as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as k}from"../../chunk-
|
|
1
|
+
import{a as k}from"../../chunk-LWI5K6T4.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-6VKQT2J3.js";import"../../chunk-NIRD7ETU.js";import"../../chunk-QY3UKLDE.js";import"../../chunk-3AV3GTMP.js";import{e as n,i as c}from"../../chunk-KLEF5D3A.js";import"../../chunk-JZ5Z2BRO.js";import{a as s}from"../../chunk-ZLLER3HP.js";import{Args as y}from"@oclif/core";var a=class m extends k{static{s(this,"AuthRevokeKey")}static description="Revoke an API key (run with no argument to list active keys)";static examples=["<%= config.bin %> auth revoke-key","<%= config.bin %> auth revoke-key rm_abc12345",'<%= config.bin %> auth revoke-key "my-laptop (auto)"'];static args={id:y.string({description:"API key ID, prefix (rm_xxxxxxxx), or name"})};async run(){let{args:o}=await this.parse(m),r=(await n("/api/auth/api-keys")).filter(e=>!e.revokedAt);if(!o.id){if(r.length===0){this.log("No active API keys.");return}this.log(`Active API keys \u2014 pass an id, prefix, or name to revoke one:
|
|
2
2
|
`);for(let e of r)this.log(` ${e.id} ${e.keyPrefix}... ${e.name}`);return}let i=o.id,t=r.filter(e=>e.id===i||e.name===i||i.startsWith("rm_")&&i.startsWith(e.keyPrefix));t.length===0&&this.error(`No active API key matches "${i}". Run \`rulemetric auth revoke-key\` with no argument to list keys.`),t.length>1&&this.error(`"${i}" matches ${t.length} keys \u2014 use the exact key ID:
|
|
3
3
|
`+t.map(e=>` ${e.id} ${e.keyPrefix}... ${e.name}`).join(`
|
|
4
4
|
`)),await c(`/api/auth/api-keys/${t[0].id}`),this.log(`API key ${t[0].keyPrefix}... ("${t[0].name}") revoked.`)}};export{a as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as g}from"../../chunk-
|
|
1
|
+
import{a as g}from"../../chunk-RJLAAKEN.js";import{a as h}from"../../chunk-LWI5K6T4.js";import"../../chunk-IZTIYR5Q.js";import{c as d}from"../../chunk-6VKQT2J3.js";import"../../chunk-NIRD7ETU.js";import{b as l}from"../../chunk-QY3UKLDE.js";import"../../chunk-3AV3GTMP.js";import{b as m,d as p}from"../../chunk-KLEF5D3A.js";import{d as n,h as c}from"../../chunk-JZ5Z2BRO.js";import{a as o}from"../../chunk-ZLLER3HP.js";import{Flags as u}from"@oclif/core";var t=class f extends h{static{o(this,"AuthSignup")}static description="Create a RuleMetric account from the CLI";static examples=["<%= config.bin %> auth signup","<%= config.bin %> auth signup -e user@example.com"];static flags={email:u.string({char:"e",description:"Email address"}),password:u.string({char:"p",description:"Password (min 8 chars; for non-interactive use)"})};async run(){let{flags:a}=await this.parse(f),i=a.email,r=a.password;if(!i||!r){process.stdin.isTTY||this.error("Missing credentials in a non-interactive shell. Pass --email/-e and --password/-p.");let{input:s,password:v}=await import("@inquirer/prompts");i||(i=await s({message:"Email:"})),r||(r=await v({message:"Password (min 8 chars):"}))}let e;try{e=await p("/auth/signup",{method:"POST",body:{email:i,password:r},timeoutMs:2e4})}catch(s){throw s instanceof m&&s.statusCode===409&&this.error(`An account with ${i} already exists. Run: rulemetric auth login -e ${i}`),s}if(e.confirmationRequired||!e.accessToken||!e.refreshToken){this.log(`Account created for ${e.email}.`),this.log("Check your email and click the confirmation link, then run:"),this.log(` rulemetric auth login -e ${e.email}`);return}let w=e.expiresAt??new Date(Date.now()+3600*1e3).toISOString();n({accessToken:e.accessToken,refreshToken:e.refreshToken,expiresAt:w,email:e.email}),c(e.accessToken,process.env.RULEMETRIC_API_URL),await l(),await g(this.log.bind(this),this.warn.bind(this),this.config.version),d("auth_signup",{},this.config.version),this.log(`Signed up and logged in as ${e.email}`)}};export{t as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as c}from"../../chunk-W2MV25SB.js";import{a as g}from"../../chunk-
|
|
1
|
+
import{a as c}from"../../chunk-W2MV25SB.js";import{a as g}from"../../chunk-LWI5K6T4.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-6VKQT2J3.js";import"../../chunk-NIRD7ETU.js";import"../../chunk-QY3UKLDE.js";import"../../chunk-3AV3GTMP.js";import"../../chunk-KLEF5D3A.js";import{a,e as l,l as t}from"../../chunk-JZ5Z2BRO.js";import{a as r}from"../../chunk-ZLLER3HP.js";import*as u from"node:path";var o=class h extends g{static{r(this,"AuthStatus")}static description="Show current authentication status";static examples=["<%= config.bin %> auth status"];async run(){await this.parse(h);let e=l(),i=process.env.RULEMETRIC_API_KEY,s=a().apiKey;if(i||s){let m=i||s,p=i?"RULEMETRIC_API_KEY env var":u.join(t(),"env");this.log(`Authenticated via API key ${m.slice(0,11)}... (${p})`),e&&this.log(`Logged in as: ${e.email}`),this.log(`Config: ${t()}`);return}if(!e){this.log("Not logged in. Run `rulemetric auth login` to authenticate.");return}let n=new Date(e.expiresAt).getTime();if(Number.isNaN(n)||Date.now()>=n){this.log("Session expired. Run `rulemetric auth login` to re-authenticate.");return}this.log(`Logged in as: ${e.email}`),this.log(`Session expires: ${c(e.expiresAt)}`),this.log(`Config: ${t()}`)}};export{o as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as f,b as k,c as S,d as x,e as R,f as n,g as y}from"../../chunk-SHYP27B7.js";import{b as C,c as w,f as v,g as b}from"../../chunk-QXPYGN7I.js";import{a as u}from"../../chunk-
|
|
1
|
+
import{a as f,b as k,c as S,d as x,e as R,f as n,g as y}from"../../chunk-SHYP27B7.js";import{b as C,c as w,f as v,g as b}from"../../chunk-QXPYGN7I.js";import{a as u}from"../../chunk-LWI5K6T4.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-6VKQT2J3.js";import"../../chunk-NIRD7ETU.js";import"../../chunk-QY3UKLDE.js";import"../../chunk-3AV3GTMP.js";import"../../chunk-KLEF5D3A.js";import{l as m}from"../../chunk-JZ5Z2BRO.js";import{a as h}from"../../chunk-ZLLER3HP.js";import{existsSync as O}from"node:fs";import{Flags as c}from"@oclif/core";var g=class E extends u{static{h(this,"CaptureScope")}static description="Show or set which projects RuleMetric captures \u2014 the Codex sweep and hook-driven sessions each have their own scope";static examples=["<%= config.bin %> <%= command.id %>","<%= config.bin %> <%= command.id %> --add ~/work/client-a --add ~/work/client-b","<%= config.bin %> <%= command.id %> --tool hooks --add ~/work/client-a","<%= config.bin %> <%= command.id %> --tool hooks --off","<%= config.bin %> <%= command.id %> --remove ~/work/client-a","<%= config.bin %> <%= command.id %> --off","<%= config.bin %> <%= command.id %> --all"];static flags={tool:c.string({description:'Which capture path to edit: "codex" (the worker transcript sweep, the default) or "hooks" (Claude Code / Cursor / Copilot / Antigravity hook sessions).',options:["codex","hooks"],default:"codex"}),add:c.string({description:"Capture sessions under this path (repeatable). Implies an allowlist.",multiple:!0}),remove:c.string({description:"Stop capturing under this path (repeatable).",multiple:!0}),off:c.boolean({description:"Turn this capture path off entirely.",exclusive:["all"]}),all:c.boolean({description:"Capture every project (the default).",exclusive:["off"]}),clear:c.boolean({description:"Remove this scope, restoring the default."})};async run(){let{flags:o}=await this.parse(E),s=m(),d=f(s);if(!((o.add?.length??0)>0||(o.remove?.length??0)>0||o.off||o.all||o.clear)){await this.show(s,d);return}for(let t of[...o.add??[],...o.remove??[]])R(t)||this.error(`Not an absolute path: ${t}
|
|
2
2
|
Use an absolute path or ~/\u2026 \u2014 relative paths cannot be matched against a session's cwd.`);for(let t of o.add??[]){let a=x(t);O(a)||this.warn(`${a} does not exist yet \u2014 added anyway, but nothing will match until it does.`)}let e;try{e=k(s)}catch(t){o.clear||this.error(t instanceof Error?t.message:String(t));let a=y(s);this.warn(`${f(s)} was not valid JSON \u2014 saved it to ${a} and starting fresh.`),e={}}let i=o.tool??"codex",r=void 0,l=!1;if(o.clear&&({config:e}=n(e,{op:"clear"},r,i)),o.off&&({config:e}=n(e,{op:"mode",mode:"off"},r,i)),o.all&&({config:e}=n(e,{op:"mode",mode:"all"},r,i)),o.remove?.length){let t=n(e,{op:"remove",roots:o.remove},r,i);e=t.config,l=t.emptiedToOff}o.add?.length&&({config:e}=n(e,{op:"add",roots:o.add},r,i)),S(s,e),l&&(this.log(`Removed the last root \u2014 ${i==="hooks"?"hook":"Codex"} capture is now OFF rather than silently capturing everything.`),this.log("Use --all to go back to capturing every project.")),await this.show(s,d),this.log(""),this.log(i==="hooks"?"Takes effect on the next hook fire. No restart needed.":"Takes effect on the next sweep (within ~30s). No restart needed.")}async show(o,s){let d=await C({configDir:o}),p=await w({configDir:o}),e=h((i,r,l,t)=>{if(this.log(`${i}: ${l}`),r.roots.length)for(let a of r.roots)this.log(` \u2022 ${a}`);r.error&&(this.log(" This scope is FAILING CLOSED \u2014 nothing is being captured on this path."),this.log(` Fix the file, or run \`rulemetric capture scope ${i==="Hook capture"?"--tool hooks ":""}--clear\` to start over.`)),r.source==="env"&&this.log(` Set by environment variable, which outranks the config file (${t}).`)},"print");e("Codex capture",d,v(d),"RULEMETRIC_CODEX_CAPTURE / RULEMETRIC_CODEX_ROOTS"),e("Hook capture",p,b(p),"RULEMETRIC_HOOKS_CAPTURE / RULEMETRIC_HOOKS_ROOTS"),this.log(`Config: ${s}`)}};export{g as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as g,b as d,c as p}from"../../chunk-W2MV25SB.js";import{a as c}from"../../chunk-
|
|
1
|
+
import{a as g,b as d,c as p}from"../../chunk-W2MV25SB.js";import{a as c}from"../../chunk-LWI5K6T4.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-6VKQT2J3.js";import"../../chunk-NIRD7ETU.js";import"../../chunk-QY3UKLDE.js";import"../../chunk-3AV3GTMP.js";import{e as n}from"../../chunk-KLEF5D3A.js";import"../../chunk-JZ5Z2BRO.js";import{a}from"../../chunk-ZLLER3HP.js";import{Flags as i}from"@oclif/core";var o=class m extends c{static{a(this,"Catalog")}static description="Browse the org instruction catalog";static flags={badge:i.string({description:"Filter by badge",options:["recommended","required"]}),scope:i.string({description:"Filter by scope",options:["org","team"]}),search:i.string({description:"Search by name or description"})};async run(){let{flags:e}=await this.parse(m);this.requireAuth();let s=new URLSearchParams;e.badge&&s.set("badge",e.badge),e.scope&&s.set("scope",e.scope),e.search&&s.set("search",e.search);let r=await n(`/api/catalog?${s.toString()}`);if(r.length===0){this.log("No instructions found in catalog.");return}for(let t of r){let l=t.badge?` [${t.badge}]`:"",f=t.tags?.length?` (${t.tags.join(", ")})`:"";this.log(` ${d(t.name,40)} \u2014 ${p(t.scope)}${l} v${t.version}${f} ${g(t.updatedAt)}`)}this.log(`
|
|
2
2
|
${r.length} instruction(s) found.`)}};export{o as default};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{a as i}from"../../chunk-
|
|
1
|
+
import{a as i}from"../../chunk-LWI5K6T4.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-6VKQT2J3.js";import"../../chunk-NIRD7ETU.js";import"../../chunk-QY3UKLDE.js";import"../../chunk-3AV3GTMP.js";import{f as n}from"../../chunk-KLEF5D3A.js";import"../../chunk-JZ5Z2BRO.js";import{a as t}from"../../chunk-ZLLER3HP.js";import{Args as c}from"@oclif/core";var o=class s extends i{static{t(this,"CatalogRecommend")}static description="Get AI-powered instruction recommendations for a project";static args={projectId:c.string({description:"ID of the project",required:!0})};async run(){let{args:a}=await this.parse(s);this.requireAuth(),this.log(`Analyzing project and generating recommendations...
|
|
2
2
|
`);let r=await n(`/api/projects/${a.projectId}/recommendations`,{});if(r.error&&this.warn(`Note: ${r.error}`),r.recommendations.length===0){this.log("No recommendations found.");return}for(let e of r.recommendations)this.log(` ${(e.score*100).toFixed(0)}% \u2014 ${e.instructionId}`),this.log(` ${e.reason}
|
|
3
3
|
`)}};export{o as default};
|
package/dist/commands/convert.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as l}from"../chunk-WLVQJH4E.js";import{a as u}from"../chunk-
|
|
1
|
+
import{a as l}from"../chunk-WLVQJH4E.js";import{a as u}from"../chunk-LWI5K6T4.js";import"../chunk-IZTIYR5Q.js";import"../chunk-6VKQT2J3.js";import"../chunk-NIRD7ETU.js";import"../chunk-QY3UKLDE.js";import"../chunk-3AV3GTMP.js";import{a as n,f as c}from"../chunk-KLEF5D3A.js";import"../chunk-JZ5Z2BRO.js";import{a}from"../chunk-ZLLER3HP.js";import*as d from"node:fs";import{Args as p,Flags as i}from"@oclif/core";var e=class f extends u{static{a(this,"Convert")}static description="Convert an instruction to a target format";static examples=["<%= config.bin %> convert <id> --format claude-md","<%= config.bin %> convert <id> -f cursorrules --score","<%= config.bin %> convert <id> -f copilot -o .github/copilot-instructions.md"];static args={id:p.string({description:"Instruction ID",required:!0})};static flags={format:i.string({char:"f",description:"Target format (e.g., claude-md, cursorrules)",required:!0}),score:i.boolean({description:"Include quality score",default:!1}),output:i.string({char:"o",description:"Write output to file"})};async run(){let{args:s,flags:t}=await this.parse(f);this.requireAuth(),l(s.id,"instruction ID");let o=new URL(`${process.env.RULEMETRIC_API_URL??n}/api/instructions/${encodeURIComponent(s.id)}/convert`);o.searchParams.set("format",t.format),o.searchParams.set("score",String(t.score));let r=await c(`${o.pathname}${o.search}`,{});t.output?(d.writeFileSync(t.output,r.output,"utf-8"),this.log(`Written to ${t.output}`)):this.log(r.output),t.score&&r.score&&(this.log(""),this.log(`Quality Score: ${r.score.overall}/100`)),r.warnings.length>0&&this.warn(`Warnings: ${r.warnings.join(", ")}`)}};export{e as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as s}from"../chunk-
|
|
1
|
+
import{a as s}from"../chunk-LWI5K6T4.js";import"../chunk-IZTIYR5Q.js";import"../chunk-6VKQT2J3.js";import"../chunk-NIRD7ETU.js";import"../chunk-QY3UKLDE.js";import"../chunk-3AV3GTMP.js";import{e as a}from"../chunk-KLEF5D3A.js";import"../chunk-JZ5Z2BRO.js";import{a as o}from"../chunk-ZLLER3HP.js";import{Flags as m}from"@oclif/core";import{printTable as c}from"@oclif/table";var e=class n extends s{static{o(this,"Converters")}static description="List all supported conversion formats";static examples=["<%= config.bin %> converters","<%= config.bin %> converters --tier 1"];static enableJsonFlag=!0;static flags={tier:m.string({char:"t",description:"Filter by tier",options:["1","2","3"]})};async run(){let{flags:i}=await this.parse(n);this.requireAuth();let r=await a("/api/converters");if(i.tier){let t=Number.parseInt(i.tier,10);r=r.filter(p=>p.tier===t)}return c({data:r.map(t=>({ID:t.id,Name:t.name,Tier:String(t.tier),"Output Path":t.outputPath})),columns:["ID","Name","Tier","Output Path"]}),r}};export{e as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as o}from"../../chunk-GY5IJ4RS.js";import{a as n}from"../../chunk-
|
|
1
|
+
import{a as o}from"../../chunk-GY5IJ4RS.js";import{a as n}from"../../chunk-LWI5K6T4.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-6VKQT2J3.js";import"../../chunk-NIRD7ETU.js";import"../../chunk-QY3UKLDE.js";import"../../chunk-3AV3GTMP.js";import"../../chunk-KLEF5D3A.js";import"../../chunk-JZ5Z2BRO.js";import{a as i}from"../../chunk-ZLLER3HP.js";import{printTable as t}from"@oclif/table";var a=class s extends n{static{i(this,"CronsList")}static description="List manually-runnable maintenance tasks";static examples=["<%= config.bin %> crons list"];async run(){await this.parse(s),t({data:o.map(e=>({Name:e.name,"Scheduled by":e.scheduledBy,Description:e.description})),columns:["Name","Scheduled by","Description"]}),this.log(""),this.log("Scheduled crons run in Supabase pg_cron \u2014 audit them with:"),this.log(` psql "$DATABASE_URL" -c 'select jobname, schedule, active from cron.job;'`),this.log("Run any task above on demand with: rulemetric crons run <name>")}};export{a as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as u}from"../../chunk-GY5IJ4RS.js";import{a as c}from"../../chunk-
|
|
1
|
+
import{a as u}from"../../chunk-GY5IJ4RS.js";import{a as c}from"../../chunk-LWI5K6T4.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-6VKQT2J3.js";import"../../chunk-NIRD7ETU.js";import"../../chunk-QY3UKLDE.js";import"../../chunk-3AV3GTMP.js";import"../../chunk-KLEF5D3A.js";import"../../chunk-JZ5Z2BRO.js";import{a as l}from"../../chunk-ZLLER3HP.js";import{Args as g,Flags as f}from"@oclif/core";var i=class m extends c{static{l(this,"CronsRun")}static description="Run a maintenance task synchronously, right now";static examples=["<%= config.bin %> crons run cron_check_changelog","<%= config.bin %> crons run cron_suggest_instructions --quiet"];static args={name:g.string({description:"Task name (run `rulemetric crons list` to see all)",required:!0})};static flags={quiet:f.boolean({char:"q",description:"Suppress per-line log output; print summary only"})};async run(){let{args:s,flags:d}=await this.parse(m);this.requireAuth();let n=u.find(e=>e.name===s.name);n||this.error(`Unknown task: ${s.name}
|
|
2
2
|
Run \`rulemetric crons list\` to see available tasks.`);let o;try{({runManualTask:o}=await import("../../lib/manual-tasks.js"))}catch(e){let r=e?.code;throw(r==="ERR_MODULE_NOT_FOUND"||r==="MODULE_NOT_FOUND")&&this.error("`crons run` needs the worker runtime, which isn't available in this install.\nThese maintenance tasks connect to the database directly \u2014 run them from a full RuleMetric checkout with DATABASE_URL and the worker dependencies installed."),e}this.log(`\u25B6 Running ${n.name} \u2026`);let h=Date.now(),t=await o(s.name);if(!d.quiet)for(let e of t.logs){let r=e.level==="error"||e.level==="warn"?`[${e.level}]`:"";this.log(` ${r} ${e.message}`)}let a=((t.durationMs??Date.now()-h)/1e3).toFixed(1);t.ok?this.log(`\u2713 ${n.name} completed in ${a}s (${t.logs.length} log line${t.logs.length===1?"":"s"})`):this.error(`\u2717 ${n.name} failed after ${a}s: ${t.error}`)}};export{i as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as o}from"../chunk-
|
|
1
|
+
import{a as o}from"../chunk-LWI5K6T4.js";import"../chunk-IZTIYR5Q.js";import"../chunk-6VKQT2J3.js";import"../chunk-NIRD7ETU.js";import"../chunk-QY3UKLDE.js";import"../chunk-3AV3GTMP.js";import"../chunk-KLEF5D3A.js";import"../chunk-JZ5Z2BRO.js";import{a as i}from"../chunk-ZLLER3HP.js";import{Flags as r}from"@oclif/core";var a=class s extends o{static{i(this,"Dashboard")}static description="Interactive TUI dashboard showing session analytics, outcomes, friction, and insights";static examples=["<%= config.bin %> dashboard","<%= config.bin %> dashboard --period 30days","<%= config.bin %> dashboard --launcher"];static flags={period:r.string({char:"p",default:"week",options:["today","week","30days","month","all"],description:"Initial time period"}),launcher:r.boolean({char:"l",default:!1,description:"Open the launcher overlay immediately"})};async run(){let{flags:e}=await this.parse(s),{renderDashboard:t}=await import("../dashboard/Dashboard.js");await t(e.period,{openLauncher:e.launcher})}};export{a as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as A,c as M}from"../chunk-V5U3E4BZ.js";import{a as D}from"../chunk-
|
|
1
|
+
import{b as A,c as M}from"../chunk-V5U3E4BZ.js";import{a as D}from"../chunk-3QXRLIGC.js";import"../chunk-HFGO5762.js";import{e as E,f as S,g as x}from"../chunk-QWCEZEDO.js";import"../chunk-KKDHD4XA.js";import"../chunk-SZ62CP55.js";import{d as W,e as V}from"../chunk-2RCWYVEU.js";import"../chunk-RMDLJN4L.js";import{i as Y,j as B,k as F,m as G,n as j}from"../chunk-BL4BN6RU.js";import"../chunk-DBELYMDA.js";import{d as N}from"../chunk-NTKO4H2K.js";import"../chunk-ATL4WZBF.js";import"../chunk-L2CFSMBC.js";import"../chunk-Z72VHGV7.js";import"../chunk-4L2ZEIRE.js";import"../chunk-CDY7TQFZ.js";import"../chunk-XRTZU7IZ.js";import"../chunk-B3BHB26P.js";import"../chunk-N7ODX6PO.js";import"../chunk-PJ3WHQ67.js";import"../chunk-G5BXZT6F.js";import"../chunk-HMMO27U4.js";import{a as H,b as I,c as U,f as X,g as L}from"../chunk-QXPYGN7I.js";import{a as O}from"../chunk-LWI5K6T4.js";import"../chunk-IZTIYR5Q.js";import"../chunk-6VKQT2J3.js";import"../chunk-NIRD7ETU.js";import"../chunk-QY3UKLDE.js";import"../chunk-3AV3GTMP.js";import{a as _,e as P}from"../chunk-KLEF5D3A.js";import{a as R,g as v,l as k}from"../chunk-JZ5Z2BRO.js";import{a as b}from"../chunk-ZLLER3HP.js";import{spawnSync as Q}from"node:child_process";import{existsSync as Z,readFileSync as ee}from"node:fs";import{join as J}from"node:path";var C=class h extends O{static{b(this,"Diagnostics")}static description='Diagnose capture / proxy / connectivity problems (e.g. a client-side "502 Bad Gateway")';static examples=["<%= config.bin %> diagnostics"];baseUrl(){return process.env.RULEMETRIC_API_URL??R().apiUrl??_}async checkDirect(){let o=process.env.HTTPS_PROXY,s=process.env.HTTP_PROXY;delete process.env.HTTPS_PROXY,delete process.env.HTTP_PROXY;let t=new AbortController,a=setTimeout(()=>t.abort(),8e3);try{return(await globalThis.fetch(`${this.baseUrl()}/health`,{signal:t.signal})).ok}catch{return!1}finally{clearTimeout(a),o!==void 0&&(process.env.HTTPS_PROXY=o),s!==void 0&&(process.env.HTTP_PROXY=s)}}configuredProxy(){if(process.env.HTTPS_PROXY)return process.env.HTTPS_PROXY;for(let o of["settings.local.json","settings.json"]){let s=J(process.cwd(),".claude",o);if(Z(s))try{let t=JSON.parse(ee(s,"utf8"));if(t.env?.HTTPS_PROXY)return t.env.HTTPS_PROXY}catch{}}return null}checkThroughProxy(o){let s=Q("curl",["-sS","-x",o,"--max-time","8","-o","/dev/null","-w","%{http_code}",`${this.baseUrl()}/health`],{encoding:"utf8",stdio:["ignore","pipe","ignore"]});return s.error||typeof s.stdout!="string"?null:s.stdout.trim()==="200"}async run(){await this.parse(h);let o=process.version,s=this.configuredProxy(),t=s!=null,[a,m,c]=await Promise.all([this.checkDirect(),x(E),x(S)]),u=t&&s?this.checkThroughProxy(s):null,e=b((n,p,g)=>{let f=p===null?"\u2013":p?"[OK]":"[!!]";this.log(` ${f} ${n.padEnd(22)} ${g}`)},"line");this.log("RuleMetric diagnostics"),this.log(""),e("Node",!A(o),`${o}${A(o)?" (< 20.11 \u2014 breaks the bundled proxy)":""}`),e("API (direct)",a,`${this.baseUrl()}/health ${a?"reachable":"UNREACHABLE"}`),e("Authenticated",v(),v()?"yes":"no \u2014 run `rulemetric auth login`"),e("Proxy configured",t?!0:null,t?s:"no HTTPS_PROXY set"),t&&(e("Gateway :"+E,m,m?"listening":"NOT listening"),e("mitmproxy :"+S,c,c?"listening":"not listening (gateway should route direct)"),e("API (via proxy)",u,u===null?"inconclusive (curl unavailable)":u?"reachable":"FAILED \u2014 502/blocked through your proxy"));let i=N();e("claude CLI",i.claudeBin!=null,i.claudeBin??"not found \u2014 LLM features (grading, distill) will no-op"),e("codex CLI",i.codexBin!=null?!0:null,i.codexBin?`${i.codexBin}${i.codexConfiguredModel?` (model ${i.codexConfiguredModel})`:""}`:"not found \u2014 optional; enables the cross-vendor reviewer (evals validate-judge)");let r=null;if(v()&&a)try{r=await P("/api/workers/health")}catch{r=null}if(r){let n=r.worker;e("Worker",!!n.active,n.present?n.active?`online (last heartbeat ${n.ageSeconds??"?"}s ago${n.clientVersion?`, v${n.clientVersion}`:""})`:`NOT RUNNING \u2014 last heartbeat ${te(n.ageSeconds)} ago`:"never connected \u2014 no worker has ever reported in");let p=r.pending.reduce((g,f)=>g+f.count,0);if(p>0){let g=r.verdict.stuck.reduce((w,T)=>w+T.count,0),f=r.verdict.unclaimable.reduce((w,T)=>w+T.count,0);e("Job queue",g===0,`${p} pending`+(g>0?` \u2014 ${g} waiting on this worker`:"")+(f>0?` \u2014 ${f} need a worker with DATABASE_URL`:""))}else e("Job queue",!0,"empty")}else v()&&a&&e("Worker",null,"could not read /workers/health (older API?)");let l=D(process.cwd()),d=await I({configDir:k()}),q=await U({configDir:k()}),y=` \u2014 ${L(q)}`,K={claude_code:`session hooks (+ proxy for instruction linking)${y}`,codex:`worker transcript sync of ~/.codex/sessions \u2014 ${X(d)}`,cursor:`user hooks (~/.cursor/hooks.json)${y}`,copilot_agent:`workspace hooks${y}`,antigravity:`user hooks (~/.gemini/config/hooks.json)${y}`};this.log(""),this.log(" Capture coverage (agents found on this machine):");for(let n of l)this.log(` \u2022 ${n.padEnd(15)} ${K[n]??"captured"}`);if(l.includes("codex"))if(d.error)this.log(` ! ${d.error}`);else if(d.mode==="allowlist")for(let n of d.roots)this.log(` \u21B3 ${n}`);else d.mode==="all"&&this.log(` \u21B3 scope it with ${J(k(),H)} ({"codex":{"roots":["/path/to/repo"]}}) or RULEMETRIC_CODEX_CAPTURE=off`);r&&!r.worker.active&&l.includes("codex")&&d.mode!=="off"&&this.log(" ! Codex capture runs INSIDE the worker \u2014 it is stopped while the worker is down."),v()&&a&&await this.reportEvolutionSpend();let $=M({nodeVersion:o,directApiOk:a,httpsProxySet:t,gatewayAlive:m,mitmproxyAlive:c,proxyPathOk:u});this.log("");let z=$.severity==="ok"?"[OK]":$.severity==="warn"?"[!!]":"[XX]";this.log(`${z} ${$.headline}`);for(let n of $.hints)this.log(` \u2022 ${n}`);if(r&&r.verdict.severity!=="ok"){let n=r.verdict.severity==="warn"?"[!!]":"[XX]";this.log(""),this.log(`${n} ${r.verdict.headline}`);for(let p of r.verdict.hints)this.log(` \u2022 ${p}`)}}async reportEvolutionSpend(){let o;try{o=await P("/api/eval-targets?type=instruction&limit=200")}catch{return}let s=o.filter(t=>{let a=t.metadata??{};return a.autoEvolveEnabled===!0||a.autoEvolveEnabled==="true"});if(s.length!==0){this.log(""),this.log(" Nightly instruction evolution (cron_instruction_evolution, 07:30 UTC):");for(let t of s){let a=t.metadata??{},m=B(a),c=Y(a);if(m){this.log(` \u2022 ${t.name} \u2014 PAUSED (metadata.autoEvolvePaused). Opt-in preserved.`),this.log(" \u21B3 resume: set autoEvolvePaused=false");continue}let u=null;try{u=(await P(`/api/eval-targets/${t.id}/evals`)).filter(i=>!i.retiredAt).length}catch{}if(this.log(` \u2022 ${t.name}`),u!=null){let e=V(u,c.minPairs,W(c,u));if(!e.feasible)this.log(` \u21B3 cannot reach a verdict \u2014 ${e.reason}`);else{let i=F({liveCases:u,passes:e.passes});this.log(` \u21B3 each night: ${j(i)}`)}}this.log(` \u21B3 pairs budget ${c.minPairs}`+(c.configured?" (metadata.autoEvolvePairs)":" (default)")+` \xB7 writes ${a.autoEvolveApply===!0||a.autoEvolveApply==="true"?"ENABLED":"off (dry run)"}`),c.note&&this.log(` ! ${c.note}`);try{let e=await P(`/api/eval-targets/${t.id}/promotions?limit=1`),i=e.promotions[0];if(i){let l=i.gates?.cost,d=l?.modelCalls?`${l.modelCalls} model calls, ${l.usablePairs??"?"} usable pair(s)`+(l.mde!=null?`, resolved +/-${G(l.mde)}`:"")+(l.wallMs?`, ${(l.wallMs/6e4).toFixed(0)} min`:""):"cost not recorded (decision predates cost tracking)";this.log(` \u21B3 last run ${new Date(i.createdAt).toISOString().slice(0,10)}: ${i.decision}${i.applied?" (APPLIED)":""} \u2014 ${d}`)}let r=e.counts??{};this.log(` \u21B3 lifetime: ${r.promote??0} promote / ${r.revert??0} revert / ${r.refuse??0} refuse`)}catch{}}this.log(" \u21B3 pause the spend: metadata.autoEvolvePaused=true (keeps the opt-in)")}}};function te(h){if(h===null)return"never";if(h<90)return`${Math.round(h)}s`;let o=Math.round(h/60);return o<90?`${o}m`:`${Math.round(o/60)}h`}b(te,"formatAge");export{C as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../../chunk-
|
|
1
|
+
import{a}from"../../chunk-LWI5K6T4.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-6VKQT2J3.js";import"../../chunk-NIRD7ETU.js";import"../../chunk-QY3UKLDE.js";import"../../chunk-3AV3GTMP.js";import{f as s}from"../../chunk-KLEF5D3A.js";import"../../chunk-JZ5Z2BRO.js";import{a as o}from"../../chunk-ZLLER3HP.js";import{Flags as e}from"@oclif/core";import{readFileSync as p}from"node:fs";var n=class c extends a{static{o(this,"EvalTargetCreate")}static description="Create an eval target (instruction, skill, prompt, or plan to test)";static examples=["<%= config.bin %> eval-targets create --name my-rules --type instruction --file ./CLAUDE.md",'<%= config.bin %> eval-targets create --name my-prompt --type prompt --content "Always use TypeScript"'];static flags={name:e.string({char:"n",description:"Name for the eval target",required:!0}),type:e.string({char:"t",description:"Target type",options:["instruction","skill","prompt","plan"],required:!0}),file:e.string({char:"f",description:"Path to content file"}),content:e.string({char:"c",description:"Content string (alternative to --file)"}),description:e.string({char:"d",description:"Description of the target",default:""})};async run(){let{flags:t}=await this.parse(c);this.requireAuth();let i;t.file?i=p(t.file,"utf-8"):t.content?i=t.content:this.error("Provide either --file or --content");let r=await s("/api/eval-targets",{name:t.name,type:t.type,content:i,description:t.description});this.log(`Created eval target: ${r.name} (${r.id}) v${r.version}`)}};export{n as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as p,b as e}from"../../chunk-W2MV25SB.js";import{a as o}from"../../chunk-
|
|
1
|
+
import{a as p,b as e}from"../../chunk-W2MV25SB.js";import{a as o}from"../../chunk-LWI5K6T4.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-6VKQT2J3.js";import"../../chunk-NIRD7ETU.js";import"../../chunk-QY3UKLDE.js";import"../../chunk-3AV3GTMP.js";import{e as n}from"../../chunk-KLEF5D3A.js";import"../../chunk-JZ5Z2BRO.js";import{a as s}from"../../chunk-ZLLER3HP.js";import{Flags as m}from"@oclif/core";import{printTable as d}from"@oclif/table";var r=class l extends o{static{s(this,"EvalTargetList")}static description="List eval targets";static examples=["<%= config.bin %> eval-targets list","<%= config.bin %> eval-targets list --type instruction"];static flags={type:m.string({char:"t",description:"Filter by type",options:["instruction","skill","prompt","plan"]})};async run(){let{flags:i}=await this.parse(l);this.requireAuth();let c=i.type?`?type=${i.type}`:"",a=await n(`/api/eval-targets${c}`);if(a.length===0){this.log("No eval targets found. Create one with `rulemetric eval-targets create`.");return}d({data:a.map(t=>({Name:e(t.name,30),Type:t.type,Version:`v${t.version}`,Description:e(t.description,40),Updated:p(t.updatedAt)})),columns:["Name","Type","Version","Description","Updated"]})}};export{r as default};
|