@rulemetric/cli 0.18.1 → 0.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/base-command.js +1 -1
- package/dist/chunk-25JPYUEV.js +4 -0
- package/dist/{chunk-NSO2EBYE.js → chunk-2WRP6ZJF.js} +1 -1
- package/dist/{chunk-3ZHBOILE.js → chunk-45CCW25C.js} +1 -1
- package/dist/{chunk-TQFHRD5B.js → chunk-4EGU65H4.js} +1 -1
- package/dist/{chunk-CXENLSMR.js → chunk-4RC2SYZX.js} +1 -1
- package/dist/chunk-4W5BF4ZN.js +1 -0
- package/dist/{chunk-RQBN7WNS.js → chunk-4XIYUMTD.js} +7 -7
- package/dist/{chunk-NMCQ7JZZ.js → chunk-52RILE5M.js} +1 -1
- package/dist/{chunk-O7ZQEKND.js → chunk-5O62P6KC.js} +1 -1
- package/dist/chunk-6NTW62L4.js +1 -0
- package/dist/{chunk-ENW5SUQJ.js → chunk-6XCD343D.js} +1 -1
- package/dist/chunk-6Z4JNHBO.js +1 -0
- package/dist/{chunk-XAGNGQL3.js → chunk-7CQBFCHP.js} +1 -1
- package/dist/{chunk-MJLW5KN2.js → chunk-7F3S6JQ2.js} +1 -1
- package/dist/{chunk-ZFEDOPRU.js → chunk-AEIKPNLG.js} +1 -1
- package/dist/{chunk-XCN2YPWI.js → chunk-ANPGOUIO.js} +1 -1
- package/dist/chunk-B56GMANB.js +1 -0
- package/dist/chunk-BXXC3VXB.js +7 -0
- package/dist/{chunk-KIQK7NVF.js → chunk-CLPIN7TY.js} +1 -1
- package/dist/chunk-D6CXQBMN.js +1 -0
- package/dist/{chunk-5VWVQCNR.js → chunk-E5FI5YHO.js} +1 -1
- package/dist/{chunk-7MQZPDDZ.js → chunk-E6O2IFOK.js} +1 -1
- package/dist/{chunk-BOYWPUV2.js → chunk-EA3X4TAE.js} +1 -1
- package/dist/{chunk-AZWY2DOT.js → chunk-EBGVDX3Z.js} +1 -1
- package/dist/chunk-FKUFJWII.js +1 -0
- package/dist/chunk-G2MRNA45.js +1 -0
- package/dist/{chunk-C3XWDYZJ.js → chunk-G2UGWEMO.js} +1 -1
- package/dist/chunk-GKWZ2DSE.js +2 -0
- package/dist/chunk-GRTEWHXU.js +5 -0
- package/dist/{chunk-RRBFKVCI.js → chunk-HN2MRF25.js} +1 -1
- package/dist/chunk-HRU6WGCG.js +1 -0
- package/dist/{chunk-MHLHLJ5T.js → chunk-I2U5GNNM.js} +2 -2
- package/dist/{chunk-AZRGURHR.js → chunk-ICULHHNZ.js} +1 -1
- package/dist/{chunk-BRYURAUN.js → chunk-ID47WFUP.js} +1 -1
- package/dist/{chunk-4LVSD2XZ.js → chunk-IULEYP4V.js} +1 -1
- package/dist/chunk-JE2JX7IJ.js +4 -0
- package/dist/chunk-JES2CV5Z.js +1 -0
- package/dist/chunk-JXUSXDS6.js +1 -0
- package/dist/{chunk-D7L7IMJQ.js → chunk-K2PI3OGV.js} +1 -1
- package/dist/chunk-K4LO27GG.js +1 -0
- package/dist/{chunk-IYX65N6T.js → chunk-KIXBBZL5.js} +1 -1
- package/dist/{chunk-5LTJNYCP.js → chunk-KTLRSRHF.js} +1 -1
- package/dist/{chunk-WLLIFRRE.js → chunk-KUD7LWJJ.js} +1 -1
- package/dist/{chunk-I2FPXRA6.js → chunk-KYJ6WAPX.js} +1 -1
- package/dist/chunk-LAJ4RBRB.js +1 -0
- package/dist/chunk-LDFGM37E.js +2 -0
- package/dist/{chunk-K65DDLTZ.js → chunk-LKOUL3IF.js} +1 -1
- package/dist/{chunk-A2JFQUDW.js → chunk-NI6RDOZ5.js} +1 -1
- package/dist/{chunk-JCZOEIL7.js → chunk-NJKPUZNM.js} +1 -1
- package/dist/{chunk-PPQFN62M.js → chunk-NN4M476J.js} +1 -1
- package/dist/{chunk-RAMQVEJB.js → chunk-NNUZ4CG4.js} +1 -1
- package/dist/{chunk-7J7H7YFQ.js → chunk-O662MWOR.js} +1 -1
- package/dist/{chunk-UROUVE3D.js → chunk-OHMVGDWQ.js} +1 -1
- package/dist/chunk-ONSRPEUQ.js +7 -0
- package/dist/chunk-P2N4KRAR.js +1 -0
- package/dist/{chunk-CAQLSYOK.js → chunk-PCSSIYH6.js} +1 -1
- package/dist/chunk-Q42RXJ4R.js +1 -0
- package/dist/chunk-RAOV3MFF.js +1 -0
- package/dist/{chunk-3EZZGA72.js → chunk-RFLO7L5X.js} +1 -1
- package/dist/{chunk-5U5SHJJA.js → chunk-RYMQMJ7O.js} +1 -1
- package/dist/chunk-S7ZQTZNB.js +3 -0
- package/dist/{chunk-LELSVLNK.js → chunk-SFZSHNZZ.js} +1 -1
- package/dist/{chunk-WSUKOU3X.js → chunk-SWCM7IHC.js} +1 -1
- package/dist/{chunk-7N55TWYQ.js → chunk-T7DAU6DV.js} +1 -1
- package/dist/{chunk-HNPC5U3C.js → chunk-TUSFCQBL.js} +1 -1
- package/dist/chunk-UFRJ75FW.js +1 -0
- package/dist/{chunk-FGGESTXG.js → chunk-UJTMT6Z7.js} +1 -1
- package/dist/{chunk-QRKMRG6W.js → chunk-WGPFOHV3.js} +1 -1
- package/dist/{chunk-NAS7FIGM.js → chunk-WLLSWFAJ.js} +1 -1
- package/dist/chunk-WUDHDZOG.js +1 -0
- package/dist/{chunk-A6JUIZ3H.js → chunk-WYDRKFXO.js} +1 -1
- package/dist/chunk-XLFVX7N7.js +1 -0
- package/dist/{chunk-LSZ32DUR.js → chunk-XPVI6H2L.js} +1 -1
- package/dist/{chunk-IPNBW7ZW.js → chunk-XQEI7NOC.js} +1 -1
- package/dist/{chunk-EKTNI6RV.js → chunk-Y6VBAURK.js} +1 -1
- package/dist/chunk-YL62YV7G.js +1 -0
- package/dist/chunk-YMIO3CVV.js +2 -0
- package/dist/{chunk-ANLPPIMS.js → chunk-ZFIGOHQ6.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/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 +3 -3
- package/dist/commands/evals/auto-run.js +1 -5
- package/dist/commands/evals/benchmark.js +1 -1
- package/dist/commands/evals/compare.js +1 -31
- package/dist/commands/evals/create.js +1 -1
- package/dist/commands/evals/optimize-description.js +1 -59
- package/dist/commands/evals/optimize.js +1 -5
- package/dist/commands/evals/refine-cases.js +1 -1
- package/dist/commands/evals/run.js +1 -3
- package/dist/commands/evals/validate-judge.js +1 -1
- package/dist/commands/experiments/enroll.js +1 -0
- package/dist/commands/experiments/list.js +1 -1
- package/dist/commands/experiments/reuse.js +1 -0
- 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/instructions/create.js +1 -1
- package/dist/commands/instructions/dedupe.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/restore.js +1 -1
- package/dist/commands/instructions/retract.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/local/down.js +1 -1
- package/dist/commands/local/up.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/resume-scoped-outcomes.js +1 -1
- package/dist/commands/research/tail-transcript.js +1 -1
- package/dist/commands/service/install.js +37 -37
- package/dist/commands/service/status.js +1 -1
- package/dist/commands/service/uninstall.js +1 -1
- package/dist/commands/service/updates.js +1 -0
- 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/auto.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/commands/suggestions/undo.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/dashboard/panels/measurement.js +1 -1
- package/dist/dashboard/telemetry.js +1 -1
- package/dist/{dist-ZJY72TUD.js → dist-D2HLWE5I.js} +1 -1
- package/dist/lib/active-org-refresh.js +1 -1
- package/dist/lib/agent-loop.js +1 -1
- package/dist/lib/agent-presence.js +1 -1
- package/dist/lib/antigravity-transcript.js +1 -1
- package/dist/lib/api-client.js +1 -1
- package/dist/lib/case-refinement-policy.js +1 -0
- package/dist/lib/discovery-evidence.js +1 -0
- package/dist/lib/discovery-repository.js +1 -0
- 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-compare.js +1 -1
- package/dist/lib/eval-conversation-handler.js +1 -1
- package/dist/lib/eval-quota-gate.js +1 -1
- package/dist/lib/eval-resume.js +1 -1
- package/dist/lib/eval-run-batch.js +1 -1
- package/dist/lib/eval-trigger-tester.js +8 -1
- package/dist/lib/experiment-reuse.js +1 -0
- package/dist/lib/insights/generation/installed-asks.js +1 -1
- package/dist/lib/insights/generation/project-evidence.js +1 -1
- package/dist/lib/insights/generation/quality-review.js +1 -1
- package/dist/lib/insights/nomination/nominate.js +1 -1
- package/dist/lib/instruction-proposer.js +16 -1
- package/dist/lib/instruction-restoration.js +1 -1
- package/dist/lib/instructions/acceptance/accept-events.js +1 -1
- package/dist/lib/instructions/acceptance/accept-hook.js +1 -1
- package/dist/lib/instructions/acceptance/hook-install.js +1 -1
- package/dist/lib/instructions/acceptance/reverse-applications.js +1 -1
- package/dist/lib/instructions/acceptance/suggestion-accept.js +1 -1
- package/dist/lib/jobs/handlers/cron-auto-accept-suggestions.js +1 -1
- package/dist/lib/jobs/handlers/cron-eval-autorun.js +1 -1
- package/dist/lib/jobs/handlers/cron-instruction-training.js +1 -1
- package/dist/lib/jobs/handlers/cron-reconcile-attribution.js +1 -1
- package/dist/lib/jobs/handlers/cron-refine-cases.js +1 -1
- package/dist/lib/jobs/handlers/cron-refresh-pricing.js +1 -1
- package/dist/lib/jobs/handlers/cron-retire-unused-skills.js +1 -1
- package/dist/lib/jobs/handlers/cron-suggest-instructions.js +1 -1
- package/dist/lib/jobs/handlers/distill-memories.js +1 -1
- package/dist/lib/jobs/handlers/finalize-scoped-launch.js +1 -1
- package/dist/lib/jobs/handlers/harbor-ab.js +1 -1
- package/dist/lib/jobs/handlers/prepare-isolated-launch.js +1 -0
- package/dist/lib/jobs/handlers/prepare-suggestion-live.js +1 -1
- package/dist/lib/jobs/handlers/process-changelog.js +1 -1
- package/dist/lib/jobs/handlers/process-conversation.js +1 -1
- package/dist/lib/jobs/handlers/process-eval.js +1 -1
- package/dist/lib/jobs/handlers/process-insights.js +1 -1
- package/dist/lib/jobs/handlers/process-judge-review.js +1 -1
- package/dist/lib/jobs/handlers/process-launch.js +1 -1
- package/dist/lib/jobs/handlers/process-run-cleanup.js +1 -1
- package/dist/lib/jobs/handlers/process-session-goal.js +1 -1
- package/dist/lib/jobs/handlers/process-suggestion-adoption.js +1 -1
- package/dist/lib/jobs/handlers/process-suggestion-discovery.js +1 -1
- package/dist/lib/jobs/handlers/process-suggestion-eval.js +1 -1
- package/dist/lib/jobs/handlers/restore-instruction.js +1 -0
- package/dist/lib/jobs/shed-retry.js +1 -1
- package/dist/lib/judge-review-runner.js +1 -1
- package/dist/lib/manual-tasks.js +1 -1
- package/dist/lib/projects/workspace/worktree.js +1 -1
- package/dist/lib/refine-cases.js +1 -1
- package/dist/lib/research-client.js +1 -1
- package/dist/lib/retraction.js +1 -1
- package/dist/lib/session-updates.js +1 -1
- package/dist/lib/setup-steps.js +1 -1
- package/dist/lib/study-fixture.js +1 -1
- package/dist/lib/study-result-store.js +1 -0
- package/dist/lib/suggestion-discovery.js +1 -1
- package/dist/lib/telemetry.js +1 -1
- package/dist/lib/terminal-target-heartbeat.js +1 -1
- package/dist/lib/transcript-sync.js +1 -1
- package/dist/lib/work-report.js +1 -1
- package/dist/lib/worker-updates.js +1 -0
- package/oclif.manifest.json +996 -813
- package/package.json +8 -8
- package/dist/chunk-2C7CFCMM.js +0 -1
- package/dist/chunk-647M2I2Y.js +0 -1
- package/dist/chunk-7OTOAC6C.js +0 -8
- package/dist/chunk-A6XQSO62.js +0 -4
- package/dist/chunk-AHLVY52I.js +0 -1
- package/dist/chunk-BDWQ6J4V.js +0 -1
- package/dist/chunk-BU3ZGLQG.js +0 -1
- package/dist/chunk-CJ2WSSHD.js +0 -1
- package/dist/chunk-DTTR4EUJ.js +0 -1
- package/dist/chunk-DZRBB34J.js +0 -16
- package/dist/chunk-FLJTAD2R.js +0 -1
- package/dist/chunk-G7V4ZZZ3.js +0 -1
- package/dist/chunk-GHUW7P55.js +0 -2
- package/dist/chunk-GYKYJJNF.js +0 -1
- package/dist/chunk-JU5ZNXPK.js +0 -1
- package/dist/chunk-KFNFLMUR.js +0 -3
- package/dist/chunk-KOIFFSYW.js +0 -2
- package/dist/chunk-KR32Y5Q5.js +0 -1
- package/dist/chunk-L5ILEWHH.js +0 -1
- package/dist/chunk-LZPE6424.js +0 -5
- package/dist/chunk-MRQIYIQE.js +0 -1
- package/dist/chunk-NLUHMHPM.js +0 -1
- package/dist/chunk-NVOYP4HX.js +0 -1
- package/dist/chunk-P577DWWL.js +0 -1
- package/dist/chunk-PMMHMRFS.js +0 -1
- package/dist/chunk-R26SQ3BE.js +0 -5
- package/dist/chunk-RITL4NU3.js +0 -1
- package/dist/chunk-RWQG25JU.js +0 -1
- package/dist/chunk-YZQZD2E6.js +0 -1
- package/dist/chunk-ZJABRHIP.js +0 -1
- package/dist/lib/eval-accumulation.js +0 -1
- package/dist/lib/evolution-cost.js +0 -1
- package/dist/lib/evolution-enrolment.js +0 -1
- package/dist/lib/jobs/handlers/cron-instruction-evolution.js +0 -1
- package/dist/lib/jobs/handlers/process-memory-ab.js +0 -1
- package/dist/lib/optimize-compare.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as c}from"../../chunk-MODXEGCU.js";import{a as
|
|
1
|
+
import{a as p,b as d,c as g,d as f,e as b,g as h,h as x}from"../../chunk-LAJ4RBRB.js";import{a as m}from"../../chunk-MODXEGCU.js";import{a as u}from"../../chunk-4EGU65H4.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-KTLRSRHF.js";import"../../chunk-RFLO7L5X.js";import"../../chunk-7CQBFCHP.js";import"../../chunk-3AV3GTMP.js";import{e as l}from"../../chunk-E5FI5YHO.js";import"../../chunk-I2U5GNNM.js";import"../../chunk-XQYAVSUQ.js";import"../../chunk-PZNWH4VQ.js";import{a as c}from"../../chunk-ZLLER3HP.js";import{Flags as v}from"@oclif/core";import{printTable as P}from"@oclif/table";import{z as e}from"zod";var n=p,O=n.options,y={positive:"improved",negative:"worsened",not_useful:"no_useful_difference"},E=d,U=e.object({source:n.optional(),outcome:e.preprocess(t=>typeof t=="string"?y[t]??t:t,g.optional()),status:E.optional(),search:e.string().trim().max(200).default(""),project:e.string().max(4096).optional(),offset:e.coerce.number().int().min(0).max(1e6).default(0),limit:e.coerce.number().int().min(1).max(100).default(25)}),A=e.object({id:e.string(),source:n,name:e.string(),projectPath:e.string().nullable(),targetId:e.string().nullable(),createdAt:e.string(),finishedAt:e.string().nullable(),status:E,result:f.nullable(),applicationCounts:h,model:e.string().nullable(),engine:e.string().nullable(),evidenceScope:e.string(),href:e.string()}).strict(),S=e.object({rows:e.array(A),total:e.number(),nextOffset:e.number().nullable(),counts:e.object({all:e.number(),improved:e.number(),running:e.number(),failed:e.number()}).strict()}).strict(),_=e.object({id:e.string(),source:e.enum(["harbor","target"]),name:e.string(),description:e.string(),projectPath:e.string().nullable(),cases:e.number(),plannedCalls:e.number().nullable(),href:e.string(),runnable:e.boolean(),blockedReason:e.string().nullable(),schedule:e.string()}).strict(),C=e.object({suites:e.array(_),total:e.number(),nextOffset:e.number().nullable()}).strict(),L=e.discriminatedUnion("source",[e.object({source:e.literal("harbor"),id:e.string().min(1).max(100)}).strict(),e.object({source:e.literal("target"),id:e.string().uuid()}).strict(),e.object({source:e.literal("study"),id:e.string().uuid()}).strict()]);var o=class t extends u{static{c(this,"ExperimentsList")}static description="List experiments with execution, metric finding, and application separately";static examples=["<%= config.bin %> experiments list","<%= config.bin %> experiments list --all"];static flags={project:v.string({char:"p",description:"Project path (defaults to current directory)"}),all:v.boolean({description:"Every project",default:!1})};async run(){let{flags:s}=await this.parse(t);this.requireAuth();let a=new URLSearchParams({limit:"50"});s.all||a.set("project",m(s.project??process.cwd()));let r=S.parse(await l(`/api/evaluations?${a}`));if(!r.rows.length){this.log("No experiments found.");return}P({data:r.rows.map(i=>({Experiment:i.name,Execution:i.status,Metric:i.result?.metrics.find(j=>j.key===i.result?.primaryMetric)?.label??"Unassessed",Finding:b(i.result??null).replaceAll("_"," "),Actions:x(i.applicationCounts)})),columns:["Experiment","Execution","Metric","Finding","Actions"]}),this.log(`Showing ${r.rows.length} of ${r.total} experiments. Findings describe the named metric; application requires its own receipt.`)}};export{o as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as k}from"../../chunk-P2N4KRAR.js";import{f as x}from"../../chunk-LAJ4RBRB.js";import{b as g,g as h}from"../../chunk-LDFGM37E.js";import{a as f}from"../../chunk-6XTLP2G7.js";import"../../chunk-PJ3WHQ67.js";import{a as m}from"../../chunk-4EGU65H4.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-KTLRSRHF.js";import"../../chunk-RFLO7L5X.js";import"../../chunk-7CQBFCHP.js";import"../../chunk-3AV3GTMP.js";import{e as p,f as l}from"../../chunk-E5FI5YHO.js";import"../../chunk-I2U5GNNM.js";import"../../chunk-XQYAVSUQ.js";import"../../chunk-PZNWH4VQ.js";import{a as c}from"../../chunk-ZLLER3HP.js";import{Args as b,Flags as i}from"@oclif/core";import{execFileSync as I}from"node:child_process";import{createHash as w}from"node:crypto";var o=class v extends m{static{c(this,"ExperimentsReuse")}static description="Run selected previously measured fixture tasks with a new bounded exploratory budget";static args={id:b.string({required:!0,description:"Completed source experiment UUID"})};static flags={task:i.string({required:!0,multiple:!0,description:"Source task ID to reuse (repeat for multiple tasks)"}),reason:i.string({required:!0,description:"Why this additional exploratory execution is useful (at least 20 characters)"}),"request-id":i.string({description:"Explicit UUID for a new budget; identical arguments otherwise recover the same request"})};async run(){let{args:y,flags:r}=await this.parse(v);this.requireAuth();let e=x.parse(await p(`/api/experiments/${encodeURIComponent(y.id)}`));(e.executor!=="fixture"||e.status!=="completed")&&this.error("Choose a completed fixture experiment.");let s=h.parse(e.protocol);for(let u of r.task){let d=s.tasks.find(q=>q.taskId===u);d||this.error(`Source task not found: ${u}`),g(d)}let a=f("claude");a||this.error("Claude is required for fixture execution.");let n=k(e.id,{sourceProtocolHash:w("sha256").update(JSON.stringify(s)).digest("hex"),taskIds:r.task,rationale:r.reason,harnessVersion:I(a,["--version"],{encoding:"utf8",timeout:1e4}).trim(),requestId:r["request-id"]});this.log(`Request ${n.requestId}: previously exposed tasks, exploratory only; no automatic adoption.`);let t=await l(`/api/experiments/${e.id}/reuse`,n);this.log(`${t.existing?"Recovered existing":"Queued"} experiment ${t.id}; job ${t.jobId}`),t.noLiveWorker&&this.log("Waiting for a compatible worker."),this.log(`Evidence: ${t.href}`)}};export{o as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as y,c as h}from"../../chunk-NVABG3AO.js";import{e,i as p,k as m,m as f}from"../../chunk-QWCEZEDO.js";import"../../chunk-KKDHD4XA.js";import{b as d,d as u}from"../../chunk-SZ62CP55.js";import{B as l,E as g}from"../../chunk-OZQNSELV.js";import"../../chunk-HFGO5762.js";import"../../chunk-VS5ROGDP.js";import{a as c}from"../../chunk-
|
|
1
|
+
import{b as y,c as h}from"../../chunk-NVABG3AO.js";import{e,i as p,k as m,m as f}from"../../chunk-QWCEZEDO.js";import"../../chunk-KKDHD4XA.js";import{b as d,d as u}from"../../chunk-SZ62CP55.js";import{B as l,E as g}from"../../chunk-OZQNSELV.js";import"../../chunk-HFGO5762.js";import"../../chunk-VS5ROGDP.js";import{a as c}from"../../chunk-4EGU65H4.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-KTLRSRHF.js";import"../../chunk-RFLO7L5X.js";import"../../chunk-7CQBFCHP.js";import"../../chunk-3AV3GTMP.js";import"../../chunk-E5FI5YHO.js";import"../../chunk-I2U5GNNM.js";import"../../chunk-XQYAVSUQ.js";import"../../chunk-PZNWH4VQ.js";import{a}from"../../chunk-ZLLER3HP.js";import{spawn as S}from"node:child_process";import{existsSync as v,readFileSync as R,statSync as C,writeFileSync as M}from"node:fs";import{homedir as T}from"node:os";import{join as o}from"node:path";var s=o(T(),".config","rulemetric"),x=o(s,"proxy-addon.version"),_=o(s,"proxy.pid"),w=o(s,"proxy-drift-restart.at"),E=10*6e4,n=class P extends c{static{a(this,"GatewayEnsure")}static description="Ensure the gateway proxy is running (called by hooks, not for direct use)";static hidden=!0;async run(){await this.parse(P),this.maybeRestartStaleProxy();let t=await p(e);if(t.status==="ours-live"){let r=h(i=>{i==="vscode"?l(e):g(e)});r.length>0&&console.error(`[RuleMetric] Gateway healthy again \u2014 restored ${r.join(", ")} proxy settings.`);return}if(t.status==="foreign"){if(m())return;let r=y(e);console.error(`[RuleMetric] A non-RuleMetric process holds :${e} \u2014 cannot start gateway. `+(r.length>0?`Unpinned ${r.join(", ")} proxy settings so editors are not routed through it. `:"")+"Run `rulemetric diagnostics` if Claude Code HTTPS requests fail.");return}try{f(this.config.version)}catch(r){console.error(`[RuleMetric] Could not start gateway: ${r.message}`)}}maybeRestartStaleProxy(){try{if(!v(x))return;let t=R(x,"utf-8").trim();if(!t||t===this.config.version)return;let r=R(_,"utf-8").trim(),i=Number(r);if(!Number.isFinite(i)||!u(i,d))return;try{if(Date.now()-C(w).mtimeMs<E)return}catch{}M(w,new Date().toISOString()),S(process.execPath,[process.argv[1],"proxy","restart"],{detached:!0,stdio:"ignore"}).unref(),console.error(`[RuleMetric] Capture proxy is running CLI ${t} but ${this.config.version} is installed \u2014 restarting it in the background.`)}catch{}}};export{n as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as mt}from"../../chunk-5INUF4A4.js";import{a as yt}from"../../chunk-6XEC6474.js";import{e as s,i as F,j as V,k as q,m as A,n as W}from"../../chunk-QWCEZEDO.js";import{e as D}from"../../chunk-KKDHD4XA.js";import"../../chunk-SZ62CP55.js";import"../../chunk-N7ODX6PO.js";import{B as ht,E as gt,H as pt,I as ft,e as Z,f as tt,g as et,i as st,j as ot,k as it,n as rt,p as at,q as nt,r as lt,u as ct,v as ut,y as dt}from"../../chunk-OZQNSELV.js";import{a as J,b as z,c as m,d as Q,g as R}from"../../chunk-HFGO5762.js";import"../../chunk-VS5ROGDP.js";import{a as f}from"../../chunk-PJ3WHQ67.js";import{a as X}from"../../chunk-JCZOEIL7.js";import{a as B}from"../../chunk-TQFHRD5B.js";import"../../chunk-IZTIYR5Q.js";import{c as Y}from"../../chunk-5LTJNYCP.js";import"../../chunk-3EZZGA72.js";import{b as M}from"../../chunk-XAGNGQL3.js";import"../../chunk-3AV3GTMP.js";import"../../chunk-5VWVQCNR.js";import"../../chunk-MHLHLJ5T.js";import"../../chunk-XQYAVSUQ.js";import{a as L}from"../../chunk-PZNWH4VQ.js";import{a as w}from"../../chunk-ZLLER3HP.js";import{Flags as y}from"@oclif/core";import{execFileSync as Ct,spawnSync as l}from"node:child_process";import{existsSync as u}from"node:fs";import{homedir as kt}from"node:os";import{join as _,dirname as wt}from"node:path";function xt(){try{let h=Ct("/bin/sh",["-c","command -v rulemetric"],{encoding:"utf-8"}).trim();if(h&&u(h))return wt(h)}catch{}}w(xt,"resolveHookBinDir");function Pt(){try{return Ct("launchctl",["list","com.rulemetric.gateway"],{stdio:["ignore","pipe","pipe"]}),!0}catch{return!1}}w(Pt,"isGatewayLaunchdManaged");var o=_(kt(),".mitmproxy","mitmproxy-ca-cert.pem"),K=class h extends B{static{w(this,"HooksInstall")}static description="Install session tracking hooks and context capture proxy for Claude Code";static examples=["<%= config.bin %> hooks install","<%= config.bin %> hooks install --global","<%= config.bin %> hooks install --no-proxy"];static flags={"no-proxy":y.boolean({default:!1,description:"Skip proxy/gateway configuration (hooks only)"}),"project-dir":y.string({description:"Project directory to install hooks in (defaults to cwd)"}),"user-hooks":y.boolean({description:"Write user-level Cursor/Antigravity hooks (~/.cursor, ~/.gemini). Required for Cursor capture \u2014 its traffic bypasses the proxy.",default:!0,allowNo:!0}),global:y.boolean({char:"g",default:!1,description:"Install hooks globally (~/.claude/settings.json) so all projects are tracked"}),"statusline-usage":y.boolean({default:!1,description:"Install the statusline shim so Claude Code pushes live rate_limits on every refresh (makes /usage rings update in real time without needing the proxy)"})};async run(){let{flags:i}=await this.parse(h),r=i.global,a=r?kt():i["project-dir"]??process.cwd(),x=_(a,".claude"),C=it(x,r),$=r?"settings.json":"settings.local.json",P=i["no-proxy"],b=!1,g=P?"no_proxy_flag":void 0,p=!1,S=[];r&&this.log(`Installing hooks globally \u2192 ${C}`);let{settings:n,recoveredBackup:I}=Z(C);if(I&&this.log(`[!!] ${C} was not valid JSON \u2014 backed it up to ${I} and continued with a fresh file.`),!r){let e=rt(_(x,"settings.json"),s);e.migrated&&(this.log("[OK] Moved RuleMetric machine-local state out of the shared .claude/settings.json (it now lives in .claude/settings.local.json)"),e.backupPath&&this.log(` Previous shared settings backed up \u2192 ${e.backupPath}`),e.removedStatusline&&u(J)&&!R(n)&&(n.statusLine=m))}let E=L();(E.accessToken||process.env.RULEMETRIC_ACCESS_TOKEN)&&!E.apiKey&&!process.env.RULEMETRIC_API_KEY&&await X(this.log.bind(this),this.warn.bind(this),this.config.version);let vt=st(n),k=xt();if(et(n,k),this.log(vt?`[OK] Refreshed RuleMetric Claude Code session hooks \u2192 .claude/${$}`:`[OK] Installed RuleMetric Claude Code session hooks \u2192 .claude/${$}`),!P){let e=!!f("mitmdump");if(e||(this.log(""),this.log("[!!] mitmproxy not found \u2014 installing..."),S=["brew","pipx","uv"].filter(t=>!!f(t)),e=this.installMitmproxy(),e||(this.log("[!!] Could not install mitmproxy. Skipping proxy config."),this.log(" Install manually: pipx install mitmproxy"),this.log(" Then re-run: rulemetric hooks install"))),u(o))this.log("[OK] CA certificate found");else{this.log("[..] Generating CA certificate...");let t=f("mitmdump");t&&(l(t,["--set","listen_port=0","-q"],{timeout:5e3,stdio:"ignore"}),u(o)?this.log(`[OK] CA certificate generated at ${o}`):this.log("[!!] Could not generate CA cert"))}let c=u(o);c&&!this.isCACertTrusted()?(this.log("[..] Installing CA certificate into system trust store (requires admin)..."),p=this.trustCACert(),p?this.log("[OK] CA certificate trusted by system"):(this.log("[!!] Could not install CA cert automatically."),process.platform==="darwin"?this.log(` Run manually: sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain ${o}`):process.platform==="linux"&&this.log(` Run manually: sudo cp ${o} /usr/local/share/ca-certificates/mitmproxy-ca.crt && sudo update-ca-certificates`))):c&&(this.log("[OK] CA certificate already trusted"),p=!0);let d=Pt(),O=await F(s);if(d)this.log("[OK] Gateway managed by launchd (com.rulemetric.gateway)");else if(O.status==="ours-live")this.log("[OK] Gateway already running");else if(O.status==="foreign"&&q()){this.log("[..] Restarting gateway (running build predates the identity handshake)..."),W(),await new Promise(t=>setTimeout(t,500));try{let t=A(this.config.version);this.log(`[OK] Gateway restarted (PID ${t})`)}catch(t){this.log(`[!!] Could not restart gateway: ${t.message}`)}}else if(O.status!=="foreign")try{let t=A(this.config.version);this.log(`[OK] Gateway started (PID ${t})`)}catch(t){this.log(`[!!] Could not start gateway: ${t.message}`)}let G=await V(s,{timeoutMs:4e3});if(!c)g=e?"ca_not_generated":S.length===0?"no_package_manager":"mitmproxy_install_failed",this.log("[!!] No CA certificate \u2014 NOT setting HTTPS_PROXY (capture stays hooks-only)."),this.log(" Install mitmproxy, then re-run: rulemetric hooks install");else if(G.status==="foreign"&&!d){g="gateway_port_foreign";let t=D(s);this.log(`[!!] Port :${s} is held by a process that is NOT the RuleMetric gateway \u2014 NOT setting HTTPS_PROXY.`),this.log(t?` Holding the port: ${t}`:` Could not identify the holder (try: lsof -nP -iTCP:${s} -sTCP:LISTEN)`),this.log(" Capture still works via hooks. Free the port, then re-run: rulemetric hooks install")}else if(G.status==="dead")g="gateway_not_live",this.log(`[!!] Gateway is not answering on :${s} \u2014 NOT setting HTTPS_PROXY.`),this.log(" Capture still works via hooks. To enable deep (proxy) capture later:"),this.log(" rulemetric proxy start && rulemetric hooks install");else{let t=n.env??{};t.HTTPS_PROXY=`http://localhost:${s}`,t.NO_PROXY=ot,u(o)&&(t.NODE_EXTRA_CA_CERTS=o),n.env=t,b=!0,this.log(`[OK] HTTPS_PROXY set to gateway on :${s} (verified live)`),ct(a,s,o)&&this.log("[OK] Cursor proxy configured \u2192 .cursor/settings.json"),ut(a,s,o)&&this.log("[OK] VS Code workspace proxy configured \u2192 .vscode/settings.json"),ht(s)&&this.log("[OK] VS Code user proxy configured \u2192 ~/Library/Application Support/Code/User/settings.json"),gt(s)&&this.log("[OK] Cursor user proxy configured \u2192 ~/Library/Application Support/Cursor/User/settings.json"),p?dt(s,o)&&this.log("[OK] HTTPS_PROXY set for GUI apps (launchctl + LaunchAgent)"):(g="ca_untrusted",this.log("[!!] CA not trusted \u2014 skipping machine-wide GUI proxy (would break native-app TLS)."),this.log(" Claude Code capture is unaffected. Trust the CA + re-run to enable cross-app capture."))}}let v=[];if(!r){let e=at(a,k);e&&(this.log(`[OK] Cursor hooks configured \u2192 ${e}`),v.push(e));let c=lt(a,k);c&&(this.log(`[OK] Copilot Agent hooks configured \u2192 ${c}`),v.push(c));let d=pt(a);d&&(this.log(`[OK] Antigravity workspace hooks configured \u2192 ${d}`),v.push(d))}let H=i["user-hooks"]?ft():null;H&&this.log(`[OK] Antigravity user hooks configured \u2192 ${H}`);let U=i["user-hooks"]?nt(k):null;if(U&&this.log(`[OK] Cursor user hooks configured \u2192 ${U}`),i["user-hooks"]||(this.log("[--] Skipped user-level Cursor/Antigravity hooks (--no-user-hooks)."),this.log(" Cursor capture will not work: its chat traffic bypasses the proxy,"),this.log(" so hooks are the only path. Claude Code capture is unaffected.")),i["statusline-usage"])if(R(n))this.log("[OK] Statusline shim already installed");else{let e=Q(n);z(e),n.statusLine=m,e?this.log(`[OK] Statusline shim installed \u2192 ${m.command} (chains to: ${e})`):this.log(`[OK] Statusline shim installed \u2192 ${m.command}`),this.log(" Rate-limit rings will now update on Claude Code's statusline refresh cadence")}let{backupPath:N}=tt(C,n);N&&this.log(`[OK] Backed up previous settings \u2192 ${N}`),this.log(""),this.log("Setup complete! Next steps:"),r?(this.log(" 1. Install always-on API: rulemetric service install"),this.log(" 2. Start Claude Code in any project \u2014 all sessions tracked automatically"),this.log(""),this.log("The API service starts on login and restarts on crash.")):P?(this.log(" 1. Start Claude Code \u2014 sessions are captured by the hooks just installed"),this.log(""),this.log("No proxy means no mitmproxy / CA cert needed. The hooks capture full"),this.log("sessions on their own; re-run without --no-proxy to also capture system"),this.log("prompts for instruction-effectiveness linking.")):(this.log(" 1. Start Claude Code \u2014 sessions are captured by hooks immediately"),b?this.log(" 2. Full-depth capture is ON \u2014 the proxy is live on :"+s+"."):this.log(" 2. Enable full depth (proxy not yet live): rulemetric proxy start"),this.log(""),this.log("Hooks capture every session (lifecycle + transcript). The proxy adds the"),this.log("rendered system prompt (instruction-effectiveness linking) + cross-tool capture."),this.log(""),this.log("To capture traffic from other clients (Python, curl, etc.):"),this.log(' eval "$(rulemetric proxy env --all)"'));let j=mt(a,v);j&&this.log(j),await M(),Y("hooks_installed",{proxy:b,caTrusted:p,reason:g,installers:S,global:r},this.config.version);let T=await yt();this.log(""),T.available?this.log(`[OK] tmux found${T.version?` (v${T.version})`:""} \u2014 live send enabled`):this.log("[!!] tmux not found \u2014 live send will fall back to opening Terminal. Install with: brew install tmux")}installMitmproxy(){for(let[i,r]of[["pipx",["install","mitmproxy"]],["uv",["tool","install","mitmproxy"]],["brew",["install","mitmproxy"]]]){let a=f(i);if(a&&(this.log(` Installing via ${i}...`),l(a,[...r],{stdio:"inherit"}).status===0))return!0}return!1}isCACertTrusted(){return process.platform==="darwin"?l("security",["verify-cert","-c",o],{stdio:"pipe"}).status===0:process.platform==="linux"?u("/usr/local/share/ca-certificates/mitmproxy-ca.crt"):process.platform==="win32"?l("certutil",["-verify",o],{stdio:"pipe"}).status===0:!1}trustCACert(){return process.platform==="darwin"?l("sudo",["security","add-trusted-cert","-d","-r","trustRoot","-k","/Library/Keychains/System.keychain",o],{stdio:"inherit"}).status===0:process.platform==="linux"?l("sudo",["cp",o,"/usr/local/share/ca-certificates/mitmproxy-ca.crt"],{stdio:"inherit"}).status!==0?!1:l("sudo",["update-ca-certificates"],{stdio:"inherit"}).status===0:process.platform==="win32"?l("certutil",["-addstore","-f","Root",o],{stdio:"inherit"}).status===0:!1}};export{K as default};
|
|
1
|
+
import{b as mt}from"../../chunk-5INUF4A4.js";import{a as yt}from"../../chunk-6XEC6474.js";import"../../chunk-N7ODX6PO.js";import{e as s,i as F,j as V,k as q,m as A,n as W}from"../../chunk-QWCEZEDO.js";import{e as D}from"../../chunk-KKDHD4XA.js";import"../../chunk-SZ62CP55.js";import{a as f}from"../../chunk-PJ3WHQ67.js";import{B as ht,E as gt,H as pt,I as ft,e as Z,f as tt,g as et,i as st,j as ot,k as it,n as rt,p as at,q as nt,r as lt,u as ct,v as ut,y as dt}from"../../chunk-OZQNSELV.js";import{a as J,b as z,c as m,d as Q,g as R}from"../../chunk-HFGO5762.js";import"../../chunk-VS5ROGDP.js";import{a as X}from"../../chunk-NJKPUZNM.js";import{a as B}from"../../chunk-4EGU65H4.js";import"../../chunk-IZTIYR5Q.js";import{c as Y}from"../../chunk-KTLRSRHF.js";import"../../chunk-RFLO7L5X.js";import{b as M}from"../../chunk-7CQBFCHP.js";import"../../chunk-3AV3GTMP.js";import"../../chunk-E5FI5YHO.js";import"../../chunk-I2U5GNNM.js";import"../../chunk-XQYAVSUQ.js";import{a as L}from"../../chunk-PZNWH4VQ.js";import{a as w}from"../../chunk-ZLLER3HP.js";import{Flags as y}from"@oclif/core";import{execFileSync as Ct,spawnSync as l}from"node:child_process";import{existsSync as u}from"node:fs";import{homedir as kt}from"node:os";import{join as _,dirname as wt}from"node:path";function xt(){try{let h=Ct("/bin/sh",["-c","command -v rulemetric"],{encoding:"utf-8"}).trim();if(h&&u(h))return wt(h)}catch{}}w(xt,"resolveHookBinDir");function Pt(){try{return Ct("launchctl",["list","com.rulemetric.gateway"],{stdio:["ignore","pipe","pipe"]}),!0}catch{return!1}}w(Pt,"isGatewayLaunchdManaged");var o=_(kt(),".mitmproxy","mitmproxy-ca-cert.pem"),K=class h extends B{static{w(this,"HooksInstall")}static description="Install session tracking hooks and context capture proxy for Claude Code";static examples=["<%= config.bin %> hooks install","<%= config.bin %> hooks install --global","<%= config.bin %> hooks install --no-proxy"];static flags={"no-proxy":y.boolean({default:!1,description:"Skip proxy/gateway configuration (hooks only)"}),"project-dir":y.string({description:"Project directory to install hooks in (defaults to cwd)"}),"user-hooks":y.boolean({description:"Write user-level Cursor/Antigravity hooks (~/.cursor, ~/.gemini). Required for Cursor capture \u2014 its traffic bypasses the proxy.",default:!0,allowNo:!0}),global:y.boolean({char:"g",default:!1,description:"Install hooks globally (~/.claude/settings.json) so all projects are tracked"}),"statusline-usage":y.boolean({default:!1,description:"Install the statusline shim so Claude Code pushes live rate_limits on every refresh (makes /usage rings update in real time without needing the proxy)"})};async run(){let{flags:i}=await this.parse(h),r=i.global,a=r?kt():i["project-dir"]??process.cwd(),x=_(a,".claude"),C=it(x,r),$=r?"settings.json":"settings.local.json",P=i["no-proxy"],b=!1,g=P?"no_proxy_flag":void 0,p=!1,S=[];r&&this.log(`Installing hooks globally \u2192 ${C}`);let{settings:n,recoveredBackup:I}=Z(C);if(I&&this.log(`[!!] ${C} was not valid JSON \u2014 backed it up to ${I} and continued with a fresh file.`),!r){let e=rt(_(x,"settings.json"),s);e.migrated&&(this.log("[OK] Moved RuleMetric machine-local state out of the shared .claude/settings.json (it now lives in .claude/settings.local.json)"),e.backupPath&&this.log(` Previous shared settings backed up \u2192 ${e.backupPath}`),e.removedStatusline&&u(J)&&!R(n)&&(n.statusLine=m))}let E=L();(E.accessToken||process.env.RULEMETRIC_ACCESS_TOKEN)&&!E.apiKey&&!process.env.RULEMETRIC_API_KEY&&await X(this.log.bind(this),this.warn.bind(this),this.config.version);let vt=st(n),k=xt();if(et(n,k),this.log(vt?`[OK] Refreshed RuleMetric Claude Code session hooks \u2192 .claude/${$}`:`[OK] Installed RuleMetric Claude Code session hooks \u2192 .claude/${$}`),!P){let e=!!f("mitmdump");if(e||(this.log(""),this.log("[!!] mitmproxy not found \u2014 installing..."),S=["brew","pipx","uv"].filter(t=>!!f(t)),e=this.installMitmproxy(),e||(this.log("[!!] Could not install mitmproxy. Skipping proxy config."),this.log(" Install manually: pipx install mitmproxy"),this.log(" Then re-run: rulemetric hooks install"))),u(o))this.log("[OK] CA certificate found");else{this.log("[..] Generating CA certificate...");let t=f("mitmdump");t&&(l(t,["--set","listen_port=0","-q"],{timeout:5e3,stdio:"ignore"}),u(o)?this.log(`[OK] CA certificate generated at ${o}`):this.log("[!!] Could not generate CA cert"))}let c=u(o);c&&!this.isCACertTrusted()?(this.log("[..] Installing CA certificate into system trust store (requires admin)..."),p=this.trustCACert(),p?this.log("[OK] CA certificate trusted by system"):(this.log("[!!] Could not install CA cert automatically."),process.platform==="darwin"?this.log(` Run manually: sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain ${o}`):process.platform==="linux"&&this.log(` Run manually: sudo cp ${o} /usr/local/share/ca-certificates/mitmproxy-ca.crt && sudo update-ca-certificates`))):c&&(this.log("[OK] CA certificate already trusted"),p=!0);let d=Pt(),O=await F(s);if(d)this.log("[OK] Gateway managed by launchd (com.rulemetric.gateway)");else if(O.status==="ours-live")this.log("[OK] Gateway already running");else if(O.status==="foreign"&&q()){this.log("[..] Restarting gateway (running build predates the identity handshake)..."),W(),await new Promise(t=>setTimeout(t,500));try{let t=A(this.config.version);this.log(`[OK] Gateway restarted (PID ${t})`)}catch(t){this.log(`[!!] Could not restart gateway: ${t.message}`)}}else if(O.status!=="foreign")try{let t=A(this.config.version);this.log(`[OK] Gateway started (PID ${t})`)}catch(t){this.log(`[!!] Could not start gateway: ${t.message}`)}let G=await V(s,{timeoutMs:4e3});if(!c)g=e?"ca_not_generated":S.length===0?"no_package_manager":"mitmproxy_install_failed",this.log("[!!] No CA certificate \u2014 NOT setting HTTPS_PROXY (capture stays hooks-only)."),this.log(" Install mitmproxy, then re-run: rulemetric hooks install");else if(G.status==="foreign"&&!d){g="gateway_port_foreign";let t=D(s);this.log(`[!!] Port :${s} is held by a process that is NOT the RuleMetric gateway \u2014 NOT setting HTTPS_PROXY.`),this.log(t?` Holding the port: ${t}`:` Could not identify the holder (try: lsof -nP -iTCP:${s} -sTCP:LISTEN)`),this.log(" Capture still works via hooks. Free the port, then re-run: rulemetric hooks install")}else if(G.status==="dead")g="gateway_not_live",this.log(`[!!] Gateway is not answering on :${s} \u2014 NOT setting HTTPS_PROXY.`),this.log(" Capture still works via hooks. To enable deep (proxy) capture later:"),this.log(" rulemetric proxy start && rulemetric hooks install");else{let t=n.env??{};t.HTTPS_PROXY=`http://localhost:${s}`,t.NO_PROXY=ot,u(o)&&(t.NODE_EXTRA_CA_CERTS=o),n.env=t,b=!0,this.log(`[OK] HTTPS_PROXY set to gateway on :${s} (verified live)`),ct(a,s,o)&&this.log("[OK] Cursor proxy configured \u2192 .cursor/settings.json"),ut(a,s,o)&&this.log("[OK] VS Code workspace proxy configured \u2192 .vscode/settings.json"),ht(s)&&this.log("[OK] VS Code user proxy configured \u2192 ~/Library/Application Support/Code/User/settings.json"),gt(s)&&this.log("[OK] Cursor user proxy configured \u2192 ~/Library/Application Support/Cursor/User/settings.json"),p?dt(s,o)&&this.log("[OK] HTTPS_PROXY set for GUI apps (launchctl + LaunchAgent)"):(g="ca_untrusted",this.log("[!!] CA not trusted \u2014 skipping machine-wide GUI proxy (would break native-app TLS)."),this.log(" Claude Code capture is unaffected. Trust the CA + re-run to enable cross-app capture."))}}let v=[];if(!r){let e=at(a,k);e&&(this.log(`[OK] Cursor hooks configured \u2192 ${e}`),v.push(e));let c=lt(a,k);c&&(this.log(`[OK] Copilot Agent hooks configured \u2192 ${c}`),v.push(c));let d=pt(a);d&&(this.log(`[OK] Antigravity workspace hooks configured \u2192 ${d}`),v.push(d))}let H=i["user-hooks"]?ft():null;H&&this.log(`[OK] Antigravity user hooks configured \u2192 ${H}`);let U=i["user-hooks"]?nt(k):null;if(U&&this.log(`[OK] Cursor user hooks configured \u2192 ${U}`),i["user-hooks"]||(this.log("[--] Skipped user-level Cursor/Antigravity hooks (--no-user-hooks)."),this.log(" Cursor capture will not work: its chat traffic bypasses the proxy,"),this.log(" so hooks are the only path. Claude Code capture is unaffected.")),i["statusline-usage"])if(R(n))this.log("[OK] Statusline shim already installed");else{let e=Q(n);z(e),n.statusLine=m,e?this.log(`[OK] Statusline shim installed \u2192 ${m.command} (chains to: ${e})`):this.log(`[OK] Statusline shim installed \u2192 ${m.command}`),this.log(" Rate-limit rings will now update on Claude Code's statusline refresh cadence")}let{backupPath:N}=tt(C,n);N&&this.log(`[OK] Backed up previous settings \u2192 ${N}`),this.log(""),this.log("Setup complete! Next steps:"),r?(this.log(" 1. Install always-on API: rulemetric service install"),this.log(" 2. Start Claude Code in any project \u2014 all sessions tracked automatically"),this.log(""),this.log("The API service starts on login and restarts on crash.")):P?(this.log(" 1. Start Claude Code \u2014 sessions are captured by the hooks just installed"),this.log(""),this.log("No proxy means no mitmproxy / CA cert needed. The hooks capture full"),this.log("sessions on their own; re-run without --no-proxy to also capture system"),this.log("prompts for instruction-effectiveness linking.")):(this.log(" 1. Start Claude Code \u2014 sessions are captured by hooks immediately"),b?this.log(" 2. Full-depth capture is ON \u2014 the proxy is live on :"+s+"."):this.log(" 2. Enable full depth (proxy not yet live): rulemetric proxy start"),this.log(""),this.log("Hooks capture every session (lifecycle + transcript). The proxy adds the"),this.log("rendered system prompt (instruction-effectiveness linking) + cross-tool capture."),this.log(""),this.log("To capture traffic from other clients (Python, curl, etc.):"),this.log(' eval "$(rulemetric proxy env --all)"'));let j=mt(a,v);j&&this.log(j),await M(),Y("hooks_installed",{proxy:b,caTrusted:p,reason:g,installers:S,global:r},this.config.version);let T=await yt();this.log(""),T.available?this.log(`[OK] tmux found${T.version?` (v${T.version})`:""} \u2014 live send enabled`):this.log("[!!] tmux not found \u2014 live send will fall back to opening Terminal. Install with: brew install tmux")}installMitmproxy(){for(let[i,r]of[["pipx",["install","mitmproxy"]],["uv",["tool","install","mitmproxy"]],["brew",["install","mitmproxy"]]]){let a=f(i);if(a&&(this.log(` Installing via ${i}...`),l(a,[...r],{stdio:"inherit"}).status===0))return!0}return!1}isCACertTrusted(){return process.platform==="darwin"?l("security",["verify-cert","-c",o],{stdio:"pipe"}).status===0:process.platform==="linux"?u("/usr/local/share/ca-certificates/mitmproxy-ca.crt"):process.platform==="win32"?l("certutil",["-verify",o],{stdio:"pipe"}).status===0:!1}trustCACert(){return process.platform==="darwin"?l("sudo",["security","add-trusted-cert","-d","-r","trustRoot","-k","/Library/Keychains/System.keychain",o],{stdio:"inherit"}).status===0:process.platform==="linux"?l("sudo",["cp",o,"/usr/local/share/ca-certificates/mitmproxy-ca.crt"],{stdio:"inherit"}).status!==0?!1:l("sudo",["update-ca-certificates"],{stdio:"inherit"}).status===0:process.platform==="win32"?l("certutil",["-addstore","-f","Root",o],{stdio:"inherit"}).status===0:!1}};export{K as default};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{a as m,b as f,d as g}from"../../chunk-
|
|
1
|
+
import{a as m,b as f,d as g}from"../../chunk-AEIKPNLG.js";import{a as d}from"../../chunk-4EGU65H4.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-KTLRSRHF.js";import"../../chunk-RFLO7L5X.js";import"../../chunk-7CQBFCHP.js";import"../../chunk-3AV3GTMP.js";import"../../chunk-E5FI5YHO.js";import"../../chunk-I2U5GNNM.js";import"../../chunk-XQYAVSUQ.js";import"../../chunk-PZNWH4VQ.js";import{a as u}from"../../chunk-ZLLER3HP.js";import{Args as v}from"@oclif/core";import{execFileSync as S}from"node:child_process";import{existsSync as y}from"node:fs";import{join as k,delimiter as E}from"node:path";var O=["session-start","session-end","user-prompt","post-tool-use","assistant-response"],p=class h extends d{static{u(this,"HooksRun")}static description="Execute a hook script (called by AI tool hooks, not for direct use)";static hidden=!0;static args={hook:v.string({description:"Hook name to run",required:!0,options:[...O]})};async run(){let{args:o}=await this.parse(h),s=o.hook,{scriptsDir:r}=await import("@rulemetric/hooks/scripts-dir"),n=k(r,`${s}.sh`);y(n)||this.error(`Hook script not found: ${n}`);try{let e=await this.readStdin();try{let{evaluateHookCaptureGate:t}=await import("../../lib/hooks-capture-gate.js"),{getDefaultConfigDir:w}=await import("../../lib/auth.js");if(!(await t({stdin:e,configDir:w()})).allowed)return}catch{}let a=`${process.env.PATH??""}${E}${r}`,l=s==="session-end"?3e4:1e4,i=s==="session-start"?m(e):null,c="";try{c=S("bash",[n],{input:e,stdio:["pipe",i?"pipe":"inherit","inherit"],timeout:l,env:{...process.env,PATH:a}})?.toString()??""}catch(t){if(!i)throw t;c=t.stdout?.toString()??""}if(i){let t=await g(i.cwd);process.stdout.write(f(c,t?.message??null)),t?.emitted()}if(process.env.RULEMETRIC_HOOK_TOOL==="antigravity"&&s==="post-tool-use")try{let{tailAntigravityTranscript:t}=await import("../../lib/antigravity-transcript.js");await t(e)}catch(t){process.stderr.write(`[antigravity-tailer] ${t.message}
|
|
2
2
|
`)}}catch(e){let a=e.status;process.env.RULEMETRIC_HOOK_DEBUG&&process.stderr.write(`[rulemetric hooks run ${s}] non-fatal exit ${a??"?"}: ${e.message??""}
|
|
3
3
|
`)}}readStdin(){return new Promise(o=>{let s=[];process.stdin.on("data",r=>s.push(r)),process.stdin.on("end",()=>o(Buffer.concat(s).toString("utf-8"))),process.stdin.readableEnded&&o(Buffer.concat(s).toString("utf-8"))})}};export{p as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{e as v,n as y}from"../../chunk-QWCEZEDO.js";import"../../chunk-KKDHD4XA.js";import"../../chunk-SZ62CP55.js";import{C as j,F as b,J as A,K as w,o as R,s as k,t as x,w as C,x as S,z as P}from"../../chunk-OZQNSELV.js";import"../../chunk-HFGO5762.js";import"../../chunk-VS5ROGDP.js";import{a as p}from"../../chunk-
|
|
1
|
+
import{e as v,n as y}from"../../chunk-QWCEZEDO.js";import"../../chunk-KKDHD4XA.js";import"../../chunk-SZ62CP55.js";import{C as j,F as b,J as A,K as w,o as R,s as k,t as x,w as C,x as S,z as P}from"../../chunk-OZQNSELV.js";import"../../chunk-HFGO5762.js";import"../../chunk-VS5ROGDP.js";import{a as p}from"../../chunk-4EGU65H4.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-KTLRSRHF.js";import"../../chunk-RFLO7L5X.js";import"../../chunk-7CQBFCHP.js";import"../../chunk-3AV3GTMP.js";import"../../chunk-E5FI5YHO.js";import"../../chunk-I2U5GNNM.js";import"../../chunk-XQYAVSUQ.js";import"../../chunk-PZNWH4VQ.js";import{a as l}from"../../chunk-ZLLER3HP.js";import{existsSync as c,readFileSync as N,writeFileSync as T}from"node:fs";import{spawnSync as s}from"node:child_process";import{homedir as O}from"node:os";import{join as u}from"node:path";import{Flags as a}from"@oclif/core";var i=u(O(),".mitmproxy","mitmproxy-ca-cert.pem");function E(){return c(i)?process.platform==="darwin"?s("sudo",["security","remove-trusted-cert","-d",i],{stdio:"inherit"}).status===0:process.platform==="linux"?s("sudo",["rm","-f","/usr/local/share/ca-certificates/mitmproxy-ca.crt"],{stdio:"inherit"}).status!==0?!1:s("sudo",["update-ca-certificates","--fresh"],{stdio:"inherit"}).status===0:process.platform==="win32"?s("certutil",["-delstore","Root","mitmproxy"],{stdio:"inherit"}).status===0:!1:!1}l(E,"untrustCACert");var m=class f extends p{static{l(this,"HooksUninstall")}static flags={global:a.boolean({description:"Remove the GLOBAL install (~/.claude) rather than this project",default:!1}),"project-dir":a.string({description:"Project directory to clean (defaults to cwd)"}),"user-hooks":a.boolean({description:"Also strip user-level Cursor/Antigravity hooks (~/.cursor, ~/.gemini)",default:!0,allowNo:!0})};static description="Remove session tracking hooks from a project (or the global install)";static examples=["<%= config.bin %> hooks uninstall","<%= config.bin %> hooks uninstall --global","<%= config.bin %> hooks uninstall --project-dir ~/work/repo-a","<%= config.bin %> hooks uninstall --no-user-hooks"];async run(){let{flags:r}=await this.parse(f),t=r.global?O():r["project-dir"]??process.cwd(),d=u(t,".claude");r.global&&this.log(`Removing the GLOBAL install \u2192 ${d}`);let h=R(d,v);if(h.length===0){this.log("No .claude/settings.json or .claude/settings.local.json found \u2014 nothing to uninstall.");return}let e=!1,g=!1;for(let o of h)o.recoveredBackup&&this.log(`[!!] ${o.configPath} was not valid JSON \u2014 backed up to ${o.recoveredBackup}; continuing.`),o.removedHooks&&this.log(`Removed RuleMetric hooks from .claude/${o.fileName}`),o.removedProxyEnv&&(this.log(`Removed HTTPS_PROXY, NO_PROXY and NODE_EXTRA_CA_CERTS from .claude/${o.fileName}`),g=!0),o.removedStatusline&&this.log(`Removed RuleMetric statusline shim from .claude/${o.fileName}`),e=e||o.changed;e||this.log("No hooks or proxy config found \u2014 nothing to uninstall."),k(t)&&(this.log("Removed RuleMetric hooks from .cursor/hooks.json"),e=!0),r["user-hooks"]&&x()&&(this.log("Removed RuleMetric hooks from ~/.cursor/hooks.json"),e=!0);let n=u(t,".cursor","settings.json");if(c(n))try{let o=JSON.parse(N(n,"utf-8"));o["http.proxy"]?.includes("localhost")&&(delete o["http.proxy"],delete o["http.proxyStrictSSL"],T(n,JSON.stringify(o,null,2)+`
|
|
2
2
|
`),this.log("Removed proxy config from .cursor/settings.json"),e=!0)}catch{}S(t)&&(this.log("Removed RuleMetric hooks from .github/hooks/"),e=!0),A(t)&&(this.log("Removed RuleMetric block from .agents/hooks.json"),e=!0),r["user-hooks"]&&w()&&(this.log("Removed RuleMetric block from ~/.gemini/config/hooks.json"),e=!0),C(t)&&(this.log("Removed proxy config from .vscode/settings.json"),e=!0),j()&&(this.log("Removed proxy config from VS Code user settings"),e=!0),b()&&(this.log("Removed proxy config from Cursor user settings"),e=!0),P()&&(this.log("Removed HTTPS_PROXY LaunchAgent"),e=!0),g&&c(i)&&(this.log("Removing the mitmproxy CA from the system trust store (requires sudo)..."),E()?this.log("[OK] mitmproxy CA untrusted."):(this.log("[!!] Could not untrust the CA automatically. Remove it manually:"),process.platform==="darwin"?this.log(` sudo security remove-trusted-cert -d ${i}`):process.platform==="linux"&&this.log(" sudo rm -f /usr/local/share/ca-certificates/mitmproxy-ca.crt && sudo update-ca-certificates --fresh"))),y()&&this.log("Gateway stopped.")}};export{m as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as p}from"../../chunk-
|
|
1
|
+
import{a as p}from"../../chunk-4EGU65H4.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-KTLRSRHF.js";import"../../chunk-RFLO7L5X.js";import"../../chunk-7CQBFCHP.js";import"../../chunk-3AV3GTMP.js";import{f}from"../../chunk-E5FI5YHO.js";import"../../chunk-I2U5GNNM.js";import"../../chunk-XQYAVSUQ.js";import"../../chunk-PZNWH4VQ.js";import{a as d}from"../../chunk-ZLLER3HP.js";import*as s from"node:fs";import{Args as m,Flags as t}from"@oclif/core";var c=class u extends p{static{d(this,"InstructionsCreate")}static description="Create a new instruction";static examples=['<%= config.bin %> instructions create ./my-instruction.md --name "My Rules" --description "Team coding rules"','<%= config.bin %> instructions create ./rules.md -n "Rules" -d "Project rules" -s project'];static args={file:m.string({description:"Path to markdown file"})};static flags={name:t.string({char:"n",description:"Instruction name",required:!0}),description:t.string({char:"d",description:"Instruction description",required:!0}),scope:t.string({char:"s",description:"Instruction scope",options:["org","team","project","personal"],default:"personal"}),"scope-ref":t.string({description:"Scope reference UUID"}),tags:t.string({char:"t",description:"Comma-separated tags"})};async run(){let{args:i,flags:e}=await this.parse(u);this.requireAuth();let n;if(i.file)s.existsSync(i.file)||this.error(`File not found: ${i.file}`),n=s.readFileSync(i.file,"utf-8");else{this.log("No file provided. Paste content (Ctrl+D to finish):");let r=[];for await(let l of process.stdin)r.push(l);n=Buffer.concat(r).toString("utf-8")}let o={name:e.name,description:e.description,scope:e.scope,content:n};e["scope-ref"]&&(o.scopeRef=e["scope-ref"]),e.tags&&(o.tags=e.tags.split(",").map(r=>r.trim()));let a=await f("/api/instructions",o);this.log(`Created instruction: ${a.name} (${a.id})`)}};export{c as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as p}from"../../chunk-LJRE3LZ2.js";import{a as m}from"../../chunk-
|
|
1
|
+
import{e as p}from"../../chunk-LJRE3LZ2.js";import{a as m}from"../../chunk-4EGU65H4.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-KTLRSRHF.js";import"../../chunk-RFLO7L5X.js";import"../../chunk-7CQBFCHP.js";import"../../chunk-3AV3GTMP.js";import"../../chunk-E5FI5YHO.js";import{E as f}from"../../chunk-I2U5GNNM.js";import"../../chunk-XQYAVSUQ.js";import"../../chunk-PZNWH4VQ.js";import{a}from"../../chunk-ZLLER3HP.js";import{Flags as $}from"@oclif/core";var l=class n extends m{static{a(this,"InstructionsDedupe")}static description="Report instructions in this project that repeat each other in different words";static examples=["<%= config.bin %> instructions dedupe","<%= config.bin %> instructions dedupe --dir apps/cli"];static flags={dir:$.string({description:"Directory whose CLAUDE.md to check (ancestors are included)",default:"."}),threshold:$.string({description:"Similarity floor 0-1 for calling two asks the same (default 0.3)"})};async run(){let{flags:i}=await this.parse(n),o=i.threshold===void 0?void 0:Number(i.threshold);o!==void 0&&(!Number.isFinite(o)||o<=0||o>1)&&this.error("--threshold must be a number greater than 0 and at most 1");let s=p(i.dir);if(s.length===0){this.log(`No CLAUDE.md found at or above ${i.dir}.`);return}let h=[...new Set(s.map(t=>t.source).filter(Boolean))];this.log(`Checked ${s.length} instruction(s) across ${h.length} file(s):`);for(let t of h)this.log(` ${t}`);this.log("");let d=f(s,o);if(d.length===0){this.log("No repeated instructions found.");return}let u=[...d].sort((t,e)=>Number(e.verdict.redundant)-Number(t.verdict.redundant));for(let{instruction:t,verdict:e}of u){let v=e.redundant?"FULLY COVERED \u2014 says nothing the earlier rules do not":`PARTLY COVERED \u2014 ${e.matches.length} of ${e.matches.length+e.novel.length} asks are repeats`;this.log(`${t.source??""} \xB7 ${t.id}`),this.log(` ${v}`);for(let r of e.matches)this.log(` "${c(r.directive)}"`),this.log(` \u21B3 ${(r.similarity*100).toFixed(0)}% match with ${r.matchedSource??r.matchedId}: "${c(r.matchedDirective)}"`);for(let r of e.novel)this.log(` KEEPS: "${c(r)}"`);e.redundant&&!t.id.includes("#handwritten")&&this.log(` Remove it: rulemetric suggestions undo ${t.id}`),this.log("")}let g=u.filter(t=>t.verdict.redundant).length;this.log(`${d.length} instruction(s) repeat earlier ones; ${g} ${g===1?"adds":"add"} nothing new. Nothing was changed \u2014 review each before removing it.`)}};function c(n,i=96){return n.length<=i?n:`${n.slice(0,i-1)}\u2026`}a(c,"clip");export{l as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as c}from"../../chunk-WLVQJH4E.js";import{a}from"../../chunk-
|
|
1
|
+
import{a as c}from"../../chunk-WLVQJH4E.js";import{a}from"../../chunk-4EGU65H4.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-KTLRSRHF.js";import"../../chunk-RFLO7L5X.js";import"../../chunk-7CQBFCHP.js";import"../../chunk-3AV3GTMP.js";import{e as n,i as s}from"../../chunk-E5FI5YHO.js";import"../../chunk-I2U5GNNM.js";import"../../chunk-XQYAVSUQ.js";import"../../chunk-PZNWH4VQ.js";import{a as r}from"../../chunk-ZLLER3HP.js";import{Args as f,Flags as u}from"@oclif/core";var o=class d extends a{static{r(this,"InstructionsDelete")}static description="Delete (archive) an instruction";static examples=["<%= config.bin %> instructions delete <id>","<%= config.bin %> instructions delete <id> --force"];static args={id:f.string({description:"Instruction ID",required:!0})};static flags={force:u.boolean({char:"f",description:"Skip confirmation prompt",default:!1})};async run(){let{args:i,flags:l}=await this.parse(d);this.requireAuth(),c(i.id,"instruction ID");let t=await n(`/api/instructions/${encodeURIComponent(i.id)}`);if(!l.force){let{confirm:m}=await import("@inquirer/prompts");if(!await m({message:`Are you sure you want to delete "${t.name}"?`,default:!1})){this.log("Cancelled.");return}}await s(`/api/instructions/${encodeURIComponent(i.id)}`),this.log(`Archived instruction: ${t.name}`);let e=t.contextIdentity;e&&!e.startsWith("public_skill::")&&(this.log(""),this.log("NOTE: this archived the database row only \u2014 nothing was removed from disk."),this.log(` Still present: ${e.split("::").slice(1).join("::")}`),this.log(` To remove it from the file: rulemetric instructions retract ${i.id}`))}};export{o as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as s}from"../../chunk-
|
|
1
|
+
import{a as s}from"../../chunk-4EGU65H4.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-KTLRSRHF.js";import"../../chunk-RFLO7L5X.js";import"../../chunk-7CQBFCHP.js";import"../../chunk-3AV3GTMP.js";import{f as o}from"../../chunk-E5FI5YHO.js";import"../../chunk-I2U5GNNM.js";import"../../chunk-XQYAVSUQ.js";import"../../chunk-PZNWH4VQ.js";import{a as t}from"../../chunk-ZLLER3HP.js";import{Args as a}from"@oclif/core";var i=class e extends s{static{t(this,"InstructionsFork")}static description="Fork an instruction to your personal scope";static examples=["<%= config.bin %> instructions fork <instruction-id>"];static args={id:a.string({description:"ID of the instruction to fork",required:!0})};async run(){let{args:n}=await this.parse(e);this.requireAuth();let r=await o(`/api/instructions/${n.id}/fork`,{});this.log(`Forked instruction: ${r.name} (${r.id})`)}};export{i as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as l}from"../../chunk-WLVQJH4E.js";import{a as i,c}from"../../chunk-W2MV25SB.js";import{a}from"../../chunk-
|
|
1
|
+
import{a as l}from"../../chunk-WLVQJH4E.js";import{a as i,c}from"../../chunk-W2MV25SB.js";import{a}from"../../chunk-4EGU65H4.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-KTLRSRHF.js";import"../../chunk-RFLO7L5X.js";import"../../chunk-7CQBFCHP.js";import"../../chunk-3AV3GTMP.js";import{e as n}from"../../chunk-E5FI5YHO.js";import"../../chunk-I2U5GNNM.js";import"../../chunk-XQYAVSUQ.js";import"../../chunk-PZNWH4VQ.js";import{a as e}from"../../chunk-ZLLER3HP.js";import{Args as g,Flags as m}from"@oclif/core";var o=class d extends a{static{e(this,"InstructionsGet")}static description="Get an instruction by ID";static examples=["<%= config.bin %> instructions get <id>","<%= config.bin %> instructions get <id> --format raw"];static enableJsonFlag=!0;static args={id:g.string({description:"Instruction ID",required:!0})};static flags={format:m.string({char:"f",description:"Output format",options:["yaml","json","raw"],default:"yaml"})};async run(){let{args:r,flags:s}=await this.parse(d);this.requireAuth(),l(r.id,"instruction ID");let t=await n(`/api/instructions/${encodeURIComponent(r.id)}`);return s.format==="json"?this.log(JSON.stringify(t,null,2)):s.format==="raw"?this.log(t.content):(this.log(`Name: ${t.name}`),this.log(`Description: ${t.description}`),this.log(`Scope: ${c(t.scope)}`),this.log(`Version: ${t.version}`),this.log(`Tags: ${(t.tags??[]).join(", ")||"(none)"}`),this.log(`Created: ${i(t.createdAt)}`),this.log(`Updated: ${i(t.updatedAt)}`),this.log(""),this.log("--- Content ---"),this.log(t.content)),t}};export{o as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b as n,c as m}from"../../chunk-W2MV25SB.js";import{a as s}from"../../chunk-
|
|
1
|
+
import{a,b as n,c as m}from"../../chunk-W2MV25SB.js";import{a as s}from"../../chunk-4EGU65H4.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-KTLRSRHF.js";import"../../chunk-RFLO7L5X.js";import"../../chunk-7CQBFCHP.js";import"../../chunk-3AV3GTMP.js";import{e as i}from"../../chunk-E5FI5YHO.js";import"../../chunk-I2U5GNNM.js";import"../../chunk-XQYAVSUQ.js";import"../../chunk-PZNWH4VQ.js";import{a as o}from"../../chunk-ZLLER3HP.js";import{Flags as p}from"@oclif/core";import{printTable as l}from"@oclif/table";var e=class c extends s{static{o(this,"InstructionSummarysList")}static description="List your instructions";static examples=["<%= config.bin %> instructions list","<%= config.bin %> instructions list --json"];static enableJsonFlag=!0;static flags={format:p.string({char:"f",description:"Output format",options:["table","json"],default:"table"})};async run(){let{flags:u}=await this.parse(c);this.requireAuth();let t=await i("/api/instructions");return t.length===0?(this.log("No instructions found. Create one with `rulemetric instructions create`."),t):(u.format==="json"?this.log(JSON.stringify(t,null,2)):l({data:t.map(r=>({Name:n(r.name,40),Scope:m(r.scope),Version:r.version,Tags:(r.tags??[]).join(", "),Updated:a(r.updatedAt)})),columns:["Name","Scope","Version","Tags","Updated"]}),t)}};export{e as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as s}from"../../chunk-
|
|
1
|
+
import{a as s}from"../../chunk-4EGU65H4.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-KTLRSRHF.js";import"../../chunk-RFLO7L5X.js";import"../../chunk-7CQBFCHP.js";import"../../chunk-3AV3GTMP.js";import{f as i}from"../../chunk-E5FI5YHO.js";import"../../chunk-I2U5GNNM.js";import"../../chunk-XQYAVSUQ.js";import"../../chunk-PZNWH4VQ.js";import{a as t}from"../../chunk-ZLLER3HP.js";import{Args as p,Flags as a}from"@oclif/core";var e=class n extends s{static{t(this,"InstructionsPromote")}static description="Promote an instruction to a higher scope (personal \u2192 team \u2192 org)";static examples=["<%= config.bin %> instructions promote <id> --scope team --ref <team-id>","<%= config.bin %> instructions promote <id> --scope org --ref <org-id>"];static args={id:p.string({description:"ID of the instruction to promote",required:!0})};static flags={scope:a.string({description:"Target scope",required:!0,options:["team","org"]}),ref:a.string({description:"Target scope ref (team or org ID)",required:!0})};async run(){let{args:c,flags:r}=await this.parse(n);this.requireAuth();let o=await i(`/api/instructions/${c.id}/promote`,{scope:r.scope,scopeRef:r.ref});this.log(`Promoted "${o.name}" to ${o.scope} scope`)}};export{e as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as r}from"../../chunk-
|
|
1
|
+
import{a as r}from"../../chunk-4EGU65H4.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-KTLRSRHF.js";import"../../chunk-RFLO7L5X.js";import"../../chunk-7CQBFCHP.js";import"../../chunk-3AV3GTMP.js";import{f as s}from"../../chunk-E5FI5YHO.js";import"../../chunk-I2U5GNNM.js";import"../../chunk-XQYAVSUQ.js";import"../../chunk-PZNWH4VQ.js";import{a as i}from"../../chunk-ZLLER3HP.js";import{Args as a}from"@oclif/core";var e=class o extends r{static{i(this,"InstructionsPull")}static description="Pull upstream changes into a forked instruction";static args={id:a.string({description:"ID of the forked instruction",required:!0})};async run(){let{args:n}=await this.parse(o);this.requireAuth();let t=await s(`/api/instructions/${n.id}/pull-upstream`,{});t.hasConflicts?(this.log("Merge conflicts detected. Resolve in the web UI:"),this.log(t.merged??"")):this.log(`Successfully pulled upstream changes into "${t.instruction?.name}"`)}};export{e as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as s}from"../../chunk-WLVQJH4E.js";import{a as o}from"../../chunk-
|
|
1
|
+
import{a as s}from"../../chunk-WLVQJH4E.js";import{a as o}from"../../chunk-4EGU65H4.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-KTLRSRHF.js";import"../../chunk-RFLO7L5X.js";import"../../chunk-7CQBFCHP.js";import"../../chunk-3AV3GTMP.js";import{f as e}from"../../chunk-E5FI5YHO.js";import"../../chunk-I2U5GNNM.js";import"../../chunk-XQYAVSUQ.js";import"../../chunk-PZNWH4VQ.js";import{a as r}from"../../chunk-ZLLER3HP.js";import{Args as d}from"@oclif/core";var t=class n extends o{static{r(this,"InstructionsRestore")}static description="Restore an archived instruction";static examples=["<%= config.bin %> instructions restore <id>"];static args={id:d.string({description:"Instruction ID",required:!0})};async run(){let{args:i}=await this.parse(n);this.requireAuth(),s(i.id,"instruction ID");let a=await e(`/api/instructions/${encodeURIComponent(i.id)}/restore`,{});this.log(`Restored: ${a.name} is active again.`),this.log("If it was removed from CLAUDE.md, re-add it with: rulemetric instructions get "+i.id)}};export{t as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as f,d as l,e as p}from"../../chunk-
|
|
1
|
+
import{b as f,d as l,e as p}from"../../chunk-EBGVDX3Z.js";import"../../chunk-UPFH72PF.js";import{a as m}from"../../chunk-4EGU65H4.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-KTLRSRHF.js";import"../../chunk-RFLO7L5X.js";import"../../chunk-7CQBFCHP.js";import"../../chunk-3AV3GTMP.js";import{e as c}from"../../chunk-E5FI5YHO.js";import"../../chunk-I2U5GNNM.js";import"../../chunk-XQYAVSUQ.js";import"../../chunk-PZNWH4VQ.js";import{a as u}from"../../chunk-ZLLER3HP.js";import{Args as v,Flags as r}from"@oclif/core";var g=class k extends m{static{u(this,"InstructionsRetract")}static description="Remove an instruction, skill, hook or MCP server from disk (dry-run by default)";static examples=["<%= config.bin %> instructions retract <instruction-id>","<%= config.bin %> instructions retract <instruction-id> --apply","<%= config.bin %> instructions retract --kind skill --target agent-browser","<%= config.bin %> instructions retract --kind mcp --target supabase --apply",'<%= config.bin %> instructions retract --kind hook --target "doomed-tool" --apply'];static args={id:v.string({description:"Instruction ID (omit when using --kind/--target)",required:!1})};static flags={apply:r.boolean({description:"Actually write. Without this, nothing is modified.",default:!1}),force:r.boolean({description:"Proceed without a randomised verdict (observational evidence only)",default:!1}),kind:r.string({description:"Retract something that is not an instruction row",options:["claude-md","memory","skill","hook","mcp"]}),target:r.string({description:"File path, skill name, MCP server name, or hook command substring"}),heading:r.string({description:"Markdown heading to remove (defaults to the instruction name)"})};async run(){let{args:n,flags:i}=await this.parse(k);!n.id&&!(i.kind&&i.target)&&this.error("Provide an instruction ID, or both --kind and --target.");let h=process.cwd(),e,a;if(n.id){this.requireAuth();let t=await c(`/api/instructions/${n.id}`);a=t.name;let o=await this.fetchVerdict(n.id);if(!o&&!i.force){this.log(""),this.log(`No randomised verdict exists for "${t.name}".`),this.log(""),this.log('Every removal signal available today \u2014 including "measured harmful" \u2014 comes from the'),this.log("OBSERVATIONAL path, which is confounded (docs/architecture/effectiveness.md \xA712)."),this.log("Deleting a file on that evidence is the exact conflation \xA713 forbids."),this.log(""),this.log("Re-run with --force if you want to act on observational evidence anyway.");return}o?this.log(`Randomised verdict: ${o.decision} (\u0394 ${o.delta}, n=${o.nTreated}/${o.nControl})`):this.log("\u26A0 Proceeding on OBSERVATIONAL evidence (--force). This signal is confounded.");let s=t.contextIdentity?f(t.contextIdentity):null;if(!s){this.log(""),this.log(`"${t.name}" has no local file behind it (context identity: ${t.contextIdentity??"none"}).`),this.log("Catalog rows live only in the database \u2014 there is nothing on disk to retract.");return}e=l({kind:s.kind,target:s.target,heading:i.heading??t.name,body:s.kind==="claude_md_section"?t.content:void 0,cwd:h})}else{let t={"claude-md":"claude_md_section",memory:"memory_section",skill:"skill_file",hook:"settings_hook",mcp:"mcp_server"};a=i.target,e=l({kind:t[i.kind],target:i.target,heading:i.heading,cwd:h})}if(this.log(""),!e.ok){this.log(`Cannot retract "${a}":`),this.log(""),this.log(e.refusal??"unknown reason"),this.log(""),this.log("Nothing was modified.");return}this.log(`${e.deletesFile?"DELETE":"EDIT"} ${e.path}`),this.log(""),this.log(e.preview),this.log("");for(let t of e.warnings)this.log(`\u26A0 ${t}`);if(!i.apply){this.log(""),this.log("Dry run \u2014 nothing was modified. Re-run with --apply to write.");return}let y=new Date().toISOString().replace(/[:.]/g,"-"),d=p(e,y);d.applied||this.error(`Retraction failed: ${d.error}. Nothing was modified.`),this.log(""),this.log(`\u2713 Retracted from ${e.path}`),this.log(` Backup: ${d.backupPath}`),this.log(" Undo: restore that file, or `git checkout -- <path>` if it is tracked.")}async fetchVerdict(n){try{return(await c(`/api/instruction-verdicts?instructionId=${n}`)).verdicts?.[0]??null}catch{return null}}};export{g as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../../chunk-
|
|
1
|
+
import{a}from"../../chunk-4EGU65H4.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-KTLRSRHF.js";import"../../chunk-RFLO7L5X.js";import"../../chunk-7CQBFCHP.js";import"../../chunk-3AV3GTMP.js";import{e as s}from"../../chunk-E5FI5YHO.js";import"../../chunk-I2U5GNNM.js";import"../../chunk-XQYAVSUQ.js";import"../../chunk-PZNWH4VQ.js";import{a as i}from"../../chunk-ZLLER3HP.js";import{Args as n}from"@oclif/core";var e=class o extends a{static{i(this,"InstructionsUpstream")}static description="Check if a forked instruction has upstream updates";static args={id:n.string({description:"ID of the forked instruction",required:!0})};async run(){let{args:r}=await this.parse(o);this.requireAuth();let t=await s(`/api/instructions/${r.id}/upstream`);t.hasUpdate?(this.log(`Upstream update available: ${t.parentName} is at ${t.upstreamVersion} (you have ${t.currentVersion})`),this.log(`Run: rulemetric instructions pull ${r.id}`)):this.log("Up to date with upstream.")}};export{e as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as m}from"../../chunk-WLVQJH4E.js";import{a}from"../../chunk-W2MV25SB.js";import{a as s}from"../../chunk-
|
|
1
|
+
import{a as m}from"../../chunk-WLVQJH4E.js";import{a}from"../../chunk-W2MV25SB.js";import{a as s}from"../../chunk-4EGU65H4.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-KTLRSRHF.js";import"../../chunk-RFLO7L5X.js";import"../../chunk-7CQBFCHP.js";import"../../chunk-3AV3GTMP.js";import{e as n}from"../../chunk-E5FI5YHO.js";import"../../chunk-I2U5GNNM.js";import"../../chunk-XQYAVSUQ.js";import"../../chunk-PZNWH4VQ.js";import{a as o}from"../../chunk-ZLLER3HP.js";import{Args as c}from"@oclif/core";import{printTable as d}from"@oclif/table";var i=class u extends s{static{o(this,"InstructionsVersions")}static description="List version history for an instruction";static examples=["<%= config.bin %> instructions versions <id>"];static enableJsonFlag=!0;static args={id:c.string({description:"Instruction ID",required:!0})};async run(){let{args:e}=await this.parse(u);this.requireAuth(),m(e.id,"instruction ID");let r=await n(`/api/instructions/${encodeURIComponent(e.id)}/versions`);return r.length===0?(this.log("No versions found."),r):(d({data:r.map(t=>({Version:String(t.versionNumber),"Change Summary":t.changeSummary??"(none)","Created At":a(t.createdAt)})),columns:["Version","Change Summary","Created At"]}),r)}};export{i as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as r}from"../chunk-
|
|
1
|
+
import{a as r}from"../chunk-4EGU65H4.js";import"../chunk-IZTIYR5Q.js";import"../chunk-KTLRSRHF.js";import"../chunk-RFLO7L5X.js";import"../chunk-7CQBFCHP.js";import"../chunk-3AV3GTMP.js";import"../chunk-E5FI5YHO.js";import"../chunk-I2U5GNNM.js";import"../chunk-XQYAVSUQ.js";import"../chunk-PZNWH4VQ.js";import{a as i}from"../chunk-ZLLER3HP.js";var e=class extends r{static{i(this,"Launcher")}static hidden=!0;static description="Manual session launching is currently unavailable";async run(){this.error("Manual session launching has been shelved. Start your coding tool directly, or use `rulemetric dashboard` to view activity.")}};export{e as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as t,d as c}from"../../chunk-HRXACKAH.js";import{a as l}from"../../chunk-
|
|
1
|
+
import{c as t,d as c}from"../../chunk-HRXACKAH.js";import{a as l}from"../../chunk-4EGU65H4.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-KTLRSRHF.js";import"../../chunk-RFLO7L5X.js";import"../../chunk-7CQBFCHP.js";import"../../chunk-3AV3GTMP.js";import"../../chunk-E5FI5YHO.js";import"../../chunk-I2U5GNNM.js";import"../../chunk-XQYAVSUQ.js";import"../../chunk-PZNWH4VQ.js";import{a as i}from"../../chunk-ZLLER3HP.js";import{Flags as u}from"@oclif/core";import{execFileSync as m,execSync as f,spawnSync as h}from"node:child_process";import{existsSync as d,rmSync as g}from"node:fs";import{homedir as b}from"node:os";import{join as n}from"node:path";var a=n(b(),"Library","LaunchAgents",`${c}.plist`),s=class p extends l{static{i(this,"LocalDown")}static description="Stop the local RuleMetric server and database stack. Data is preserved (restart with `rulemetric local up`); use --delete-data to also wipe the local database.";static flags={"delete-data":u.boolean({default:!1,description:"Also delete the local database volumes (irreversible)"})};async run(){let{flags:o}=await this.parse(p);if(process.platform==="darwin"&&d(a)){let e=f("id -u",{encoding:"utf-8"}).trim();try{m("launchctl",["bootout",`gui/${e}`,a],{stdio:["ignore","pipe","pipe"]}),this.log("[OK] Stopped the local server")}catch{}g(a,{force:!0})}if(d(n(t,"supabase","config.toml"))){let e=o["delete-data"]?["stop","--no-backup"]:["stop"],r=h("supabase",e,{cwd:t,stdio:"inherit"});r.status!==0?this.warn(`\`supabase ${e.join(" ")}\` exited ${r.status} \u2014 the stack may not have been running.`):this.log(o["delete-data"]?"[OK] Database stack stopped and data deleted":"[OK] Database stack stopped (data preserved)")}else this.log("No local stack configured (nothing to stop). Run: rulemetric local up")}};export{s as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as o,b as O,c as x,d as U}from"../../chunk-XB4OMOSE.js";import{a as E,c as p,d as h,h as m,i as f,j as D,l as C,m as I,n as _}from"../../chunk-HRXACKAH.js";import{a as $}from"../../chunk-
|
|
1
|
+
import{a as o,b as O,c as x,d as U}from"../../chunk-XB4OMOSE.js";import{a as E,c as p,d as h,h as m,i as f,j as D,l as C,m as I,n as _}from"../../chunk-HRXACKAH.js";import{a as $}from"../../chunk-NJKPUZNM.js";import{a as A}from"../../chunk-4EGU65H4.js";import"../../chunk-IZTIYR5Q.js";import{c as T}from"../../chunk-KTLRSRHF.js";import"../../chunk-RFLO7L5X.js";import{b as R}from"../../chunk-7CQBFCHP.js";import"../../chunk-3AV3GTMP.js";import{b as S,d}from"../../chunk-E5FI5YHO.js";import"../../chunk-I2U5GNNM.js";import"../../chunk-XQYAVSUQ.js";import{d as L,h as P}from"../../chunk-PZNWH4VQ.js";import{a as w}from"../../chunk-ZLLER3HP.js";import{Flags as l}from"@oclif/core";import{execSync as H,spawnSync as a}from"node:child_process";import{mkdirSync as M}from"node:fs";import{homedir as b}from"node:os";import{dirname as G,join as n}from"node:path";var K=n(b(),"Library","LaunchAgents",`${h}.plist`),g=n(b(),".config","rulemetric","logs"),v=class B extends A{static{w(this,"LocalUp")}static description="Run RuleMetric fully locally: start a local Supabase stack (Docker), apply migrations, and serve the API + dashboard from the @rulemetric/local runtime \u2014 all data on this machine, zero cloud contact. Downloads the runtime package on first run.";static examples=["<%= config.bin %> local up --email you@example.com --password <pw>","<%= config.bin %> local up --port 3000","<%= config.bin %> local up --foreground"];static flags={port:l.integer({char:"p",default:3e3,description:"Local API + dashboard port"}),email:l.string({char:"e",description:"Create the first user with this email (with --password)"}),password:l.string({description:"Password for the first user (min 8 chars)"}),foreground:l.boolean({default:!1,description:"Run the server in this terminal instead of installing a launchd service (works on any OS; skips user provisioning)"}),yes:l.boolean({char:"y",default:!1,description:"Skip the runtime-download confirmation"})};async run(){let{flags:s}=await this.parse(B),t=s.port;!s.foreground&&process.platform!=="darwin"&&this.error(`The managed local service is macOS-only (launchd) for now. On this OS, run the server in the foreground instead:
|
|
2
2
|
rulemetric local up --foreground`),a("docker",["info"],{stdio:"ignore"}).status!==0&&this.error(`Docker is not running (or not installed). The local database runs in Docker.
|
|
3
3
|
Install/start Docker Desktop (or colima), then re-run: rulemetric local up`),a("supabase",["--version"],{stdio:"ignore"}).status!==0&&this.error(`The Supabase CLI is required to manage the local database stack.
|
|
4
4
|
Install it: brew install supabase/tap/supabase (or see supabase.com/docs/guides/cli)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as f}from"../../chunk-
|
|
1
|
+
import{a as f}from"../../chunk-4EGU65H4.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-KTLRSRHF.js";import"../../chunk-RFLO7L5X.js";import"../../chunk-7CQBFCHP.js";import{a as c,b as t,c as l,d}from"../../chunk-3AV3GTMP.js";import{b as g,e}from"../../chunk-E5FI5YHO.js";import"../../chunk-I2U5GNNM.js";import"../../chunk-XQYAVSUQ.js";import{g as a}from"../../chunk-PZNWH4VQ.js";import{a as s}from"../../chunk-ZLLER3HP.js";var o=class u extends f{static{s(this,"OrgCurrent")}static description="Show the current active organization";static examples=["<%= config.bin %> org current"];async run(){await this.parse(u);let n=process.env.RULEMETRIC_ORG_ID?.trim();if(n){this.log(`${n} (env override)`);return}a()||this.error("Not logged in. Run `rulemetric auth login` to authenticate.");let i=c();if(i&&d(i))try{let r=await e("/api/profile");if(!r.activeOrgId)l(),i=null;else if(r.activeOrgId!==i.orgId){let m=(await e("/api/orgs")).find(p=>p.id===r.activeOrgId);i={orgId:r.activeOrgId,orgSlug:m?.slug,syncedAt:Date.now()},t(i)}else i={...i,syncedAt:Date.now()},t(i)}catch(r){if(!(r instanceof g))throw r}if(!i){this.log("No active organization. Run `rulemetric org switch <slug>`.");return}i.orgSlug?this.log(`${i.orgSlug} (${i.orgId})`):this.log(i.orgId)}};export{o as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as d}from"../../chunk-
|
|
1
|
+
import{a as d}from"../../chunk-4EGU65H4.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-KTLRSRHF.js";import"../../chunk-RFLO7L5X.js";import"../../chunk-7CQBFCHP.js";import{a as c}from"../../chunk-3AV3GTMP.js";import{e as g}from"../../chunk-E5FI5YHO.js";import"../../chunk-I2U5GNNM.js";import"../../chunk-XQYAVSUQ.js";import"../../chunk-PZNWH4VQ.js";import{a as s}from"../../chunk-ZLLER3HP.js";var p=process.env.RULEMETRIC_WEB_URL??"https://rulemetric.com",o=class l extends d{static{s(this,"OrgList")}static description="List organizations the current user is a member of";static examples=["<%= config.bin %> org list"];async run(){await this.parse(l),this.requireAuth();let e=await g("/api/orgs");if(e.length===0){this.log("No organizations."),this.log(`Create one in the web UI: ${p}`);return}let i=c()?.orgId??null,r=Math.max(4,...e.map(t=>t.slug.length)),a=Math.max(4,...e.map(t=>t.name.length)),n=Math.max(4,...e.map(t=>t.role.length)),m=` ACTIVE ${"SLUG".padEnd(r)} ${"NAME".padEnd(a)} ${"ROLE".padEnd(n)}`;this.log(m);for(let t of e){let h=t.id===i?"*":" ";this.log(` ${h} ${t.slug.padEnd(r)} ${t.name.padEnd(a)} ${t.role.padEnd(n)}`)}i||(this.log(""),this.log("No active organization. Run `rulemetric org switch <slug>` to set one."))}};export{o as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as l}from"../../chunk-
|
|
1
|
+
import{a as l}from"../../chunk-4EGU65H4.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-KTLRSRHF.js";import"../../chunk-RFLO7L5X.js";import"../../chunk-7CQBFCHP.js";import{b as a,c as g}from"../../chunk-3AV3GTMP.js";import{e as s,h as e}from"../../chunk-E5FI5YHO.js";import"../../chunk-I2U5GNNM.js";import"../../chunk-XQYAVSUQ.js";import"../../chunk-PZNWH4VQ.js";import{a as o}from"../../chunk-ZLLER3HP.js";import{Args as d,Flags as m}from"@oclif/core";var t=class c extends l{static{o(this,"OrgSwitch")}static description="Switch the active organization";static examples=["<%= config.bin %> org switch acme","<%= config.bin %> org switch --clear"];static args={slug:d.string({description:"Organization slug to switch to",required:!1})};static flags={clear:m.boolean({description:"Clear the active organization (personal mode)",default:!1})};async run(){let{args:i,flags:n}=await this.parse(c);if(this.requireAuth(),n.clear){await e("/api/profile",{activeOrgId:null}),g(),this.log("Active org cleared (personal mode).");return}i.slug||this.error("Slug is required. Run `rulemetric org list` to see your orgs, or use --clear to unset.");let r=(await s("/api/orgs")).find(u=>u.slug===i.slug);r||this.error(`Not a member of "${i.slug}". Run \`rulemetric org list\` to see your orgs.`),await e("/api/profile",{activeOrgId:r.id}),a({orgId:r.id,orgSlug:r.slug,syncedAt:Date.now()}),this.log(`Active org: ${r.slug}`)}};export{t as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as o}from"../../chunk-
|
|
1
|
+
import{a as o}from"../../chunk-4EGU65H4.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-KTLRSRHF.js";import"../../chunk-RFLO7L5X.js";import"../../chunk-7CQBFCHP.js";import"../../chunk-3AV3GTMP.js";import{f as s}from"../../chunk-E5FI5YHO.js";import"../../chunk-I2U5GNNM.js";import"../../chunk-XQYAVSUQ.js";import"../../chunk-PZNWH4VQ.js";import{a as r}from"../../chunk-ZLLER3HP.js";import{Args as a}from"@oclif/core";var i=class n extends o{static{r(this,"PacksAddInstruction")}static description="Add an instruction to a pack";static examples=["<%= config.bin %> packs add-instruction <pack-id> <instruction-id>"];static args={packId:a.string({description:"Pack ID",required:!0}),instructionId:a.string({description:"Instruction ID",required:!0})};async run(){let{args:t}=await this.parse(n);this.requireAuth(),await s(`/api/packs/${t.packId}/instructions`,{instructionId:t.instructionId}),this.log("Instruction added to pack.")}};export{i as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as s}from"../../chunk-
|
|
1
|
+
import{a as s}from"../../chunk-4EGU65H4.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-KTLRSRHF.js";import"../../chunk-RFLO7L5X.js";import"../../chunk-7CQBFCHP.js";import"../../chunk-3AV3GTMP.js";import{f as i}from"../../chunk-E5FI5YHO.js";import"../../chunk-I2U5GNNM.js";import"../../chunk-XQYAVSUQ.js";import"../../chunk-PZNWH4VQ.js";import{a as r}from"../../chunk-ZLLER3HP.js";import{Args as c,Flags as l}from"@oclif/core";var t=class o extends s{static{r(this,"PacksApply")}static description="Apply a pack to a project (bulk-link all instructions)";static examples=["<%= config.bin %> packs apply <pack-id> --project <project-id>"];static args={id:c.string({description:"Pack ID",required:!0})};static flags={project:l.string({char:"p",description:"Project ID",required:!0})};async run(){let{args:a,flags:p}=await this.parse(o);this.requireAuth();let e=await i(`/api/packs/${a.id}/apply`,{projectId:p.project});this.log(`Applied pack: ${e.linked} of ${e.total} instructions linked to project.`)}};export{t as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as o}from"../../chunk-
|
|
1
|
+
import{a as o}from"../../chunk-4EGU65H4.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-KTLRSRHF.js";import"../../chunk-RFLO7L5X.js";import"../../chunk-7CQBFCHP.js";import"../../chunk-3AV3GTMP.js";import{f as n}from"../../chunk-E5FI5YHO.js";import"../../chunk-I2U5GNNM.js";import"../../chunk-XQYAVSUQ.js";import"../../chunk-PZNWH4VQ.js";import{a}from"../../chunk-ZLLER3HP.js";import{Flags as t}from"@oclif/core";var i=class c extends o{static{a(this,"PacksCreate")}static description="Create a new instruction pack";static examples=['<%= config.bin %> packs create --name "Security Pack" --description "Security-focused instructions"'];static flags={name:t.string({char:"n",description:"Pack name",required:!0}),description:t.string({char:"d",description:"Pack description",required:!0}),scope:t.string({char:"s",description:"Pack scope",options:["org","team","personal"],default:"personal"}),tags:t.string({char:"t",description:"Comma-separated tags"})};async run(){let{flags:e}=await this.parse(c);this.requireAuth();let r={name:e.name,description:e.description,scope:e.scope};e.tags&&(r.tags=e.tags.split(",").map(p=>p.trim()));let s=await n("/api/packs",r);this.log(`Created pack: ${s.name} (${s.id})`)}};export{i as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"../../chunk-
|
|
1
|
+
import{a as e}from"../../chunk-4EGU65H4.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-KTLRSRHF.js";import"../../chunk-RFLO7L5X.js";import"../../chunk-7CQBFCHP.js";import"../../chunk-3AV3GTMP.js";import{f as o}from"../../chunk-E5FI5YHO.js";import"../../chunk-I2U5GNNM.js";import"../../chunk-XQYAVSUQ.js";import"../../chunk-PZNWH4VQ.js";import{a as t}from"../../chunk-ZLLER3HP.js";import{Args as p}from"@oclif/core";var r=class s extends e{static{t(this,"PacksFork")}static description="Fork a pack to your personal scope";static examples=["<%= config.bin %> packs fork <pack-id>"];static args={id:p.string({description:"ID of the pack to fork",required:!0})};async run(){let{args:a}=await this.parse(s);this.requireAuth();let i=await o(`/api/packs/${a.id}/fork`,{});this.log(`Forked pack: ${i.name} (${i.id})`)}};export{r as default};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{b as a,c as r}from"../../chunk-W2MV25SB.js";import{a as o}from"../../chunk-
|
|
1
|
+
import{b as a,c as r}from"../../chunk-W2MV25SB.js";import{a as o}from"../../chunk-4EGU65H4.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-KTLRSRHF.js";import"../../chunk-RFLO7L5X.js";import"../../chunk-7CQBFCHP.js";import"../../chunk-3AV3GTMP.js";import{e}from"../../chunk-E5FI5YHO.js";import"../../chunk-I2U5GNNM.js";import"../../chunk-XQYAVSUQ.js";import"../../chunk-PZNWH4VQ.js";import{a as n}from"../../chunk-ZLLER3HP.js";import{Args as g}from"@oclif/core";import{printTable as m}from"@oclif/table";var s=class c extends o{static{n(this,"PacksGet")}static description="Get pack detail with instruction list";static examples=["<%= config.bin %> packs get <pack-id>"];static args={id:g.string({description:"Pack ID",required:!0})};async run(){let{args:p}=await this.parse(c);this.requireAuth();let i=await e(`/api/packs/${p.id}`);this.log(`
|
|
2
2
|
Pack: ${i.name}`),this.log(`Description: ${i.description}`),this.log(`Scope: ${r(i.scope)} | Version: ${i.version} | Tier: ${i.tier}`),this.log(`Tags: ${(i.tags??[]).join(", ")||"(none)"}`),this.log(`Instructions: ${i.instructionCount}
|
|
3
3
|
`),i.instructions.length>0&&m({data:i.instructions.map(t=>({"#":String(t.position),Name:a(t.name,40),Scope:r(t.scope),Version:t.version})),columns:["#","Name","Scope","Version"]})}};export{s as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as o,b as n,c}from"../../chunk-W2MV25SB.js";import{a as s}from"../../chunk-
|
|
1
|
+
import{a as o,b as n,c}from"../../chunk-W2MV25SB.js";import{a as s}from"../../chunk-4EGU65H4.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-KTLRSRHF.js";import"../../chunk-RFLO7L5X.js";import"../../chunk-7CQBFCHP.js";import"../../chunk-3AV3GTMP.js";import{e as a}from"../../chunk-E5FI5YHO.js";import"../../chunk-I2U5GNNM.js";import"../../chunk-XQYAVSUQ.js";import"../../chunk-PZNWH4VQ.js";import{a as i}from"../../chunk-ZLLER3HP.js";import{Flags as p}from"@oclif/core";import{printTable as g}from"@oclif/table";var e=class m extends s{static{i(this,"PacksList")}static description="List your instruction packs";static examples=["<%= config.bin %> packs list","<%= config.bin %> packs list --json"];static enableJsonFlag=!0;static flags={format:p.string({char:"f",description:"Output format",options:["table","json"],default:"table"})};async run(){let{flags:u}=await this.parse(m);this.requireAuth();let r=await a("/api/packs");return r.length===0?(this.log("No packs found. Create one with `rulemetric packs create`."),r):(u.format==="json"?this.log(JSON.stringify(r,null,2)):g({data:r.map(t=>({Name:n(t.name,40),Scope:c(t.scope),Tier:t.tier,Count:String(t.instructionCount),Tags:(t.tags??[]).join(", "),Updated:o(t.updatedAt)})),columns:["Name","Scope","Tier","Count","Tags","Updated"]}),r)}};export{e as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as s}from"../../chunk-
|
|
1
|
+
import{a as s}from"../../chunk-4EGU65H4.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-KTLRSRHF.js";import"../../chunk-RFLO7L5X.js";import"../../chunk-7CQBFCHP.js";import"../../chunk-3AV3GTMP.js";import{i as e}from"../../chunk-E5FI5YHO.js";import"../../chunk-I2U5GNNM.js";import"../../chunk-XQYAVSUQ.js";import"../../chunk-PZNWH4VQ.js";import{a as t}from"../../chunk-ZLLER3HP.js";import{Args as o}from"@oclif/core";var i=class a extends s{static{t(this,"PacksRemoveInstruction")}static description="Remove an instruction from a pack";static examples=["<%= config.bin %> packs remove-instruction <pack-id> <instruction-id>"];static args={packId:o.string({description:"Pack ID",required:!0}),instructionId:o.string({description:"Instruction ID",required:!0})};async run(){let{args:r}=await this.parse(a);this.requireAuth(),await e(`/api/packs/${r.packId}/instructions/${r.instructionId}`),this.log("Instruction removed from pack.")}};export{i as default};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{e as f}from"../../chunk-QWCEZEDO.js";import"../../chunk-KKDHD4XA.js";import"../../chunk-SZ62CP55.js";import{a as h}from"../../chunk-
|
|
1
|
+
import{e as f}from"../../chunk-QWCEZEDO.js";import"../../chunk-KKDHD4XA.js";import"../../chunk-SZ62CP55.js";import{a as h}from"../../chunk-4EGU65H4.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-KTLRSRHF.js";import"../../chunk-RFLO7L5X.js";import"../../chunk-7CQBFCHP.js";import"../../chunk-3AV3GTMP.js";import"../../chunk-E5FI5YHO.js";import"../../chunk-I2U5GNNM.js";import"../../chunk-XQYAVSUQ.js";import"../../chunk-PZNWH4VQ.js";import{a as m}from"../../chunk-ZLLER3HP.js";import{Flags as i}from"@oclif/core";import{existsSync as v}from"node:fs";import{homedir as x}from"node:os";import{join as g}from"node:path";var o=g(x(),".mitmproxy","mitmproxy-ca-cert.pem"),l=class d extends h{static{m(this,"ProxyEnv")}static description="Print shell env vars to route any client through the RuleMetric proxy";static examples=["<%= config.bin %> proxy env","<%= config.bin %> proxy env --shell fish",'eval "$(rulemetric proxy env)"',"rulemetric proxy env --python"];static flags={shell:i.string({char:"s",default:"posix",description:"Shell format (posix, fish, powershell)",options:["posix","fish","powershell"]}),python:i.boolean({default:!1,description:"Include Python-specific env vars (REQUESTS_CA_BUNDLE, SSL_CERT_FILE)"}),node:i.boolean({default:!1,description:"Include Node.js-specific env vars (NODE_EXTRA_CA_CERTS)"}),all:i.boolean({default:!1,description:"Include env vars for all runtimes"}),vscode:i.boolean({default:!1,description:"Output VS Code settings.json snippet for Copilot proxy"})};async run(){let{flags:s}=await this.parse(d),y=s.shell,c=s.all,a=s.python||c,p=s.node||c,u=v(o),n=`http://localhost:${f}`;if(u||(this.warn(`CA certificate not found at ${o}
|
|
2
2
|
Run 'rulemetric hooks install' or 'rulemetric proxy setup' to generate it.`),this.exit(1)),s.vscode){let e={"http.proxy":n,"http.proxyStrictSSL":u,"github.copilot.advanced":{"debug.overrideProxyUrl":n}};this.log(JSON.stringify(e,null,2));return}let r=[{key:"HTTPS_PROXY",value:n,comment:"Route HTTPS through RuleMetric gateway"},{key:"HTTP_PROXY",value:n,comment:"Route HTTP through RuleMetric gateway"}];r.push({key:"SSL_CERT_FILE",value:o,comment:"Trust mitmproxy CA (generic \u2014 works with most libraries)"}),(p||!a&&!p)&&r.push({key:"NODE_EXTRA_CA_CERTS",value:o,comment:"Trust mitmproxy CA (Node.js)"}),a&&(r.push({key:"REQUESTS_CA_BUNDLE",value:o,comment:"Trust mitmproxy CA (Python requests / httpx)"}),r.push({key:"CURL_CA_BUNDLE",value:o,comment:"Trust mitmproxy CA (curl / libcurl)"}));let t=[];for(let e of r)switch(y){case"fish":e.comment&&t.push(`# ${e.comment}`),t.push(`set -gx ${e.key} "${e.value}"`);break;case"powershell":e.comment&&t.push(`# ${e.comment}`),t.push(`$env:${e.key} = "${e.value}"`);break;default:e.comment&&t.push(`# ${e.comment}`),t.push(`export ${e.key}="${e.value}"`)}this.log(t.join(`
|
|
3
3
|
`))}};export{l as default};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{a as c}from"../../chunk-
|
|
1
|
+
import{a as c}from"../../chunk-4EGU65H4.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-KTLRSRHF.js";import"../../chunk-RFLO7L5X.js";import"../../chunk-7CQBFCHP.js";import"../../chunk-3AV3GTMP.js";import"../../chunk-E5FI5YHO.js";import"../../chunk-I2U5GNNM.js";import"../../chunk-XQYAVSUQ.js";import"../../chunk-PZNWH4VQ.js";import{a as l}from"../../chunk-ZLLER3HP.js";import{Flags as a}from"@oclif/core";import{existsSync as f,readFileSync as p}from"node:fs";import{homedir as x}from"node:os";import{join as n}from"node:path";import{spawn as m}from"node:child_process";var g=n(x(),".config","rulemetric"),s=n(g,"proxy.log"),d=n(g,"proxy.pid"),h="rulemetric-proxy",r=class u extends c{static{l(this,"ProxyLogs")}static description="View context capture proxy logs";static examples=["<%= config.bin %> proxy logs","<%= config.bin %> proxy logs --follow","<%= config.bin %> proxy logs --lines 50"];static flags={follow:a.boolean({char:"f",default:!1,description:"Follow log output (like tail -f)"}),lines:a.integer({char:"n",default:30,description:"Number of lines to show"})};async run(){let{flags:i}=await this.parse(u);if(f(d)&&p(d,"utf-8").trim().startsWith("docker:")){let o=["logs"];i.follow&&o.push("-f"),o.push("--tail",String(i.lines),h);let t=m("docker",o,{stdio:"inherit"});process.on("SIGINT",()=>{t.kill(),process.exit(0)}),await new Promise(e=>{t.on("exit",()=>e())});return}if(!f(s)){this.log(`No proxy log file found at ${s}`),this.log("Start the proxy first: rulemetric proxy start");return}if(i.follow){let o=m("tail",["-f","-n",String(i.lines),s],{stdio:"inherit"});process.on("SIGINT",()=>{o.kill(),process.exit(0)}),await new Promise(t=>{o.on("exit",()=>t())})}else{let e=p(s,"utf-8").split(`
|
|
2
2
|
`).slice(-i.lines).join(`
|
|
3
3
|
`);this.log(e)}}};export{r as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as s}from"../../chunk-
|
|
1
|
+
import{a as s}from"../../chunk-4EGU65H4.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-KTLRSRHF.js";import"../../chunk-RFLO7L5X.js";import"../../chunk-7CQBFCHP.js";import"../../chunk-3AV3GTMP.js";import"../../chunk-E5FI5YHO.js";import"../../chunk-I2U5GNNM.js";import"../../chunk-XQYAVSUQ.js";import"../../chunk-PZNWH4VQ.js";import{a as e}from"../../chunk-ZLLER3HP.js";import{Flags as i}from"@oclif/core";import{setTimeout as p}from"node:timers/promises";var o=class a extends s{static{e(this,"ProxyRestart")}static description="Restart the context capture proxy (stop + start)";static examples=["<%= config.bin %> proxy restart"];static flags={port:i.integer({char:"p",description:"Proxy listen port"}),docker:i.boolean({char:"d",default:!1,description:"Run in Docker mode"})};async run(){let{flags:t}=await this.parse(a);await this.config.runCommand("proxy:stop",[]),await p(500);let r=["--skip-checks"];t.docker&&r.push("--docker"),t.port&&r.push("--port",String(t.port)),await this.config.runCommand("proxy:start",r)}};export{o as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as g}from"../../chunk-PJ3WHQ67.js";import{a as S}from"../../chunk-
|
|
1
|
+
import{a as g}from"../../chunk-PJ3WHQ67.js";import{a as S}from"../../chunk-4EGU65H4.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-KTLRSRHF.js";import"../../chunk-RFLO7L5X.js";import"../../chunk-7CQBFCHP.js";import"../../chunk-3AV3GTMP.js";import"../../chunk-E5FI5YHO.js";import"../../chunk-I2U5GNNM.js";import"../../chunk-XQYAVSUQ.js";import{g as x}from"../../chunk-PZNWH4VQ.js";import{a as h}from"../../chunk-ZLLER3HP.js";import{Flags as _}from"@oclif/core";import{execSync as P,spawnSync as m}from"node:child_process";import{existsSync as f,readFileSync as y,appendFileSync as T,writeFileSync as k,mkdirSync as v}from"node:fs";import{homedir as d}from"node:os";import{dirname as E,join as u}from"node:path";var c=u(d(),".mitmproxy","mitmproxy-ca-cert.pem"),$=u(d(),".config","rulemetric"),A=8787,R=class C extends S{static{h(this,"ProxySetup")}static description="Set up context capture proxy (installs mitmproxy, configures shell)";static examples=["<%= config.bin %> proxy setup","<%= config.bin %> proxy setup --shell zsh","<%= config.bin %> proxy setup --check"];static flags={shell:_.string({description:"Shell to configure (auto-detected if omitted)",options:["zsh","bash","fish","powershell"]}),port:_.integer({char:"p",default:A,description:"Proxy listen port"}),check:_.boolean({description:"Only check prerequisites, do not install anything",default:!1})};async run(){let{flags:e}=await this.parse(C),i=e.check,t=e.port;this.log("RuleMetric Proxy Setup"),this.log(`=====================
|
|
2
2
|
`);let l=[await this.checkAuth(),await this.checkMitmproxy(),await this.checkCACert(),await this.checkHooks(),this.checkShellEnv(t)],r=!0;for(let n of l){let p=n.ok?"[OK]":"[!!]";this.log(`${p} ${n.name}: ${n.message}`),n.ok||(r=!1)}if(r){this.log("\nAll checks passed. Run `rulemetric proxy start` to begin capturing.");return}if(i){this.log("\nSome checks failed. Run `rulemetric proxy setup` (without --check) to fix.");return}this.log(`
|
|
3
3
|
Fixing issues...
|
|
4
4
|
`);for(let n of l){if(n.ok||!n.fix)continue;this.log(`Fixing: ${n.name}...`),await n.fix()?this.log(` Fixed.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as K}from"../../chunk-OMXUK4M6.js";import{b as F,d as N}from"../../chunk-SZ62CP55.js";import{a as U}from"../../chunk-PJ3WHQ67.js";import{a as M}from"../../chunk-
|
|
1
|
+
import{a as K}from"../../chunk-OMXUK4M6.js";import{b as F,d as N}from"../../chunk-SZ62CP55.js";import{a as U}from"../../chunk-PJ3WHQ67.js";import{a as M}from"../../chunk-4EGU65H4.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-KTLRSRHF.js";import"../../chunk-RFLO7L5X.js";import"../../chunk-7CQBFCHP.js";import"../../chunk-3AV3GTMP.js";import"../../chunk-E5FI5YHO.js";import"../../chunk-I2U5GNNM.js";import"../../chunk-XQYAVSUQ.js";import{g as $}from"../../chunk-PZNWH4VQ.js";import{a as u}from"../../chunk-ZLLER3HP.js";import{Flags as _}from"@oclif/core";import{execSync as H,spawn as q,spawnSync as m}from"node:child_process";import{appendFileSync as G,existsSync as l,mkdirSync as P,openSync as V,readFileSync as b,writeFileSync as Y}from"node:fs";import{createRequire as W}from"node:module";import{homedir as x}from"node:os";import{dirname as A,join as c,resolve as f}from"node:path";import{fileURLToPath as X}from"node:url";var g=A(X(import.meta.url)),J=8788,S=c(x(),".config","rulemetric"),T=c(S,"proxy.pid"),D=c(S,"proxy.log"),w="rulemetric/proxy",v="rulemetric-proxy";function j(s,o){try{let d=W(import.meta.url).resolve(`@rulemetric/proxy/${s}`);if(l(d))return d}catch{}for(let t of o)if(l(t))return t;return null}u(j,"resolveProxyFile");function B(){let s=[f(g,"../../../../../packages/proxy/addon/rulemetric_addon.py"),f(g,"../../../node_modules/@rulemetric/proxy/addon/rulemetric_addon.py"),f(g,"../../../../../node_modules/@rulemetric/proxy/addon/rulemetric_addon.py")],o=j("addon/rulemetric_addon.py",s);if(o)return o;throw new Error(`Could not find rulemetric_addon.py. Is @rulemetric/proxy installed?
|
|
2
2
|
Searched (after module resolution):
|
|
3
3
|
`+s.map(t=>` ${t}`).join(`
|
|
4
4
|
`))}u(B,"findAddonPath");function z(){let s=[f(g,"../../../../../packages/proxy/Dockerfile"),f(g,"../../../node_modules/@rulemetric/proxy/Dockerfile"),f(g,"../../../../../node_modules/@rulemetric/proxy/Dockerfile")],o=j("Dockerfile",s);if(o)return A(o);throw new Error("Could not find proxy Dockerfile. Is @rulemetric/proxy installed?")}u(z,"findDockerfilePath");function Q(){return m("docker",["image","inspect",w],{stdio:"ignore"}).status===0}u(Q,"dockerImageExists");function Z(){let s=m("docker",["container","inspect","-f","{{.State.Running}}",v],{encoding:"utf-8",stdio:["ignore","pipe","ignore"]});return s.status===0&&s.stdout?.trim()==="true"}u(Z,"dockerContainerRunning");var L=class s extends M{static{u(this,"ProxyStart")}static description="Start context capture proxy";static examples=["<%= config.bin %> proxy start","<%= config.bin %> proxy start --docker","<%= config.bin %> proxy start --port 9090","<%= config.bin %> proxy start --web"];static flags={port:_.integer({char:"p",default:J,description:"Proxy listen port"}),docker:_.boolean({char:"d",default:!1,description:"Run proxy in Docker (no local mitmproxy needed)"}),web:_.boolean({default:!1,description:"Launch mitmweb debug UI instead of mitmdump (local mode only)"}),"skip-checks":_.boolean({default:!1,description:"Skip prerequisite checks"}),build:_.boolean({default:!1,description:"Force rebuild Docker image"})};async run(){let{flags:o}=await this.parse(s),t=o.port;o.docker?await this.startDocker(t,o.build):await this.startLocal(t,o.web,o["skip-checks"])}async startDocker(o,t){try{H("docker info",{stdio:"ignore"})}catch{this.error("Docker is not running. Start Docker Desktop and try again.")}Z()&&this.error("Proxy container already running. Stop it first: rulemetric proxy stop");let d=this.findComposeFile(),k=c(x(),".mitmproxy");P(k,{recursive:!0});let E=process.env.TMPDIR||"/tmp";P(c(E,"rulemetric"),{recursive:!0});let y={PROXY_PORT:String(o),RULEMETRIC_PROJECT_PATH:process.cwd()};if(!process.env.RULEMETRIC_API_KEY&&!process.env.RULEMETRIC_ACCESS_TOKEN){let n=c(x(),".config","rulemetric","env");if(l(n))for(let h of b(n,"utf-8").split(`
|