@a-company/paradigm 6.0.2 → 6.0.5
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/{accept-orchestration-QQISPINV.js → accept-orchestration-TIXUQQGR.js} +1 -1
- package/dist/active-remediations-EBLHRMNN.js +5 -0
- package/dist/agent-MB3H5EZA.js +33 -0
- package/dist/{agent-loader-2WJHD46U.js → agent-loader-VGBPL3TH.js} +1 -1
- package/dist/{agent-loader-YKS2PQWO.js → agent-loader-W3RQJVW7.js} +1 -1
- package/dist/{agents-suggest-HYTFMQD3.js → agents-suggest-IKY6VD2R.js} +1 -1
- package/dist/{ambient-NVKQCW2A.js → ambient-AI42BOM5.js} +2 -2
- package/dist/{ambient-BE3SQXNN.js → ambient-FNNFB4AP.js} +1 -1
- package/dist/authority-GCMPX7RW.js +2 -0
- package/dist/{chunk-FEYOQMZ5.js → chunk-2AU5L333.js} +1 -1
- package/dist/{chunk-M3PPXJU4.js → chunk-4N56FRNE.js} +1 -1
- package/dist/{chunk-3DZK54RU.js → chunk-5RFISGUW.js} +110 -22
- package/dist/{chunk-TNVWGPCE.js → chunk-6QXBXZF6.js} +1 -1
- package/dist/{chunk-WESTEMIM.js → chunk-AMLD7IYC.js} +1 -1
- package/dist/{chunk-VXIIVMTM.js → chunk-F6E3HW45.js} +1 -1
- package/dist/{chunk-TBWWFRL5.js → chunk-GD4F2HC6.js} +1 -1
- package/dist/{chunk-6SKSV5B2.js → chunk-IOVHF4SR.js} +1 -1
- package/dist/{chunk-PHEX6LU4.js → chunk-K7EQHFZP.js} +26 -26
- package/dist/{chunk-M2HKWR25.js → chunk-KAFQA7HV.js} +2 -2
- package/dist/{chunk-GAFKOFAV.js → chunk-LAYBUKMB.js} +1 -1
- package/dist/{chunk-TZDYIPVU.js → chunk-MOVDVBU7.js} +133 -49
- package/dist/{chunk-AO7ZSRME.js → chunk-TQOT2LBO.js} +2 -2
- package/dist/chunk-XQLO5URP.js +11 -0
- package/dist/{compliance-BNFWQPKM.js → compliance-J3VOV445.js} +1 -1
- package/dist/{diff-MF55KQZH.js → diff-75MABOSL.js} +1 -1
- package/dist/{docs-O37YLLRN.js → docs-TSAAS4W3.js} +1 -1
- package/dist/doctor-L5XZENCF.js +2 -0
- package/dist/{hooks-TFMMMB2H.js → hooks-45WDP6QS.js} +1 -1
- package/dist/index.js +4 -4
- package/dist/mcp.js +2 -2
- package/dist/{migrate-Z5UQN57G.js → migrate-R64OQGSM.js} +1 -1
- package/dist/migration-notices-MRZ6PVDS.js +4 -0
- package/dist/{nomination-engine-QPZJH6XO.js → nomination-engine-NCLTGMAK.js} +1 -1
- package/dist/{orchestrate-RID7HHHH.js → orchestrate-K4KBTBYK.js} +1 -1
- package/dist/{providers-4PXMWA7V.js → providers-TBPOE4DI.js} +1 -1
- package/dist/registry-OUTA3DXW.js +20 -0
- package/dist/reindex-GSRV4MQO.js +2 -0
- package/dist/{serve-MO35XIZE.js → serve-3FMUWW5K.js} +1 -1
- package/dist/session-tracker-HHNY6J4I.js +2 -0
- package/dist/{session-work-log-EE4UIZ33.js → session-work-log-MEJ33TYD.js} +1 -1
- package/dist/{session-work-log-4IEVE4KK.js → session-work-log-ZVVJGO7X.js} +1 -1
- package/dist/shift-3ATE2ONQ.js +60 -0
- package/dist/{spawn-UH5RENSE.js → spawn-KKDDR6UR.js} +1 -1
- package/dist/{team-MGT66HZQ.js → team-2LGZQRP4.js} +1 -1
- package/dist/tools-VNDXOFXR.js +2 -0
- package/dist/university-content/notes/N-para-451-agent-routing.md +117 -0
- package/dist/university-content/notes/N-para-451-archetypes-vs-instances.md +82 -0
- package/dist/university-content/notes/N-para-451-identity-layers.md +76 -0
- package/dist/university-content/notes/N-para-451-orchestration-modes.md +85 -0
- package/dist/university-content/notes/N-para-451-paradigm-shift.md +95 -0
- package/dist/university-content/notes/N-para-451-partners-primitive.md +107 -0
- package/dist/university-content/notes/N-para-451-roster-management.md +132 -0
- package/dist/university-content/notes/N-para-451-roster-reference.md +106 -0
- package/dist/university-content/notes/N-para-451-the-team-pattern.md +87 -0
- package/dist/university-content/notes/N-para-451-tiers.md +83 -0
- package/dist/university-content/notes/N-para-451-welcome.md +55 -0
- package/dist/university-content/notes/N-para-451-what-is-an-agent.md +73 -0
- package/dist/university-content/paths/LP-para-451.yaml +69 -0
- package/dist/university-content/quizzes/Q-para-451-foundations.yaml +154 -0
- package/dist/university-content/quizzes/Q-para-451-when-to-invoke.yaml +182 -0
- package/dist/university-ui/assets/{index-nNgzO1il.js → index-CkgaxOXi.js} +2 -2
- package/dist/university-ui/assets/{index-nNgzO1il.js.map → index-CkgaxOXi.js.map} +1 -1
- package/dist/university-ui/index.html +1 -1
- package/package.json +1 -1
- package/dist/agent-X6I2YWOB.js +0 -33
- package/dist/chunk-R5ECMBIV.js +0 -11
- package/dist/doctor-IG5XM4C4.js +0 -2
- package/dist/registry-KOOKFUWD.js +0 -20
- package/dist/reindex-FWPD2VGM.js +0 -2
- package/dist/session-tracker-KGORN6B5.js +0 -2
- package/dist/shift-TVNY2CQF.js +0 -60
- package/dist/tools-QJHAVYI6.js +0 -2
- /package/dist/{chunk-IZSBGW6E.js → chunk-HXGYVS2N.js} +0 -0
- /package/dist/{platform-server-UD45NTGV.js → platform-server-ANOALDPL.js} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {b}from'./chunk-
|
|
2
|
+
import {b}from'./chunk-IOVHF4SR.js';import'./chunk-TYWB5IQJ.js';import'./chunk-AMLD7IYC.js';import'./chunk-FYDRENK7.js';import'./chunk-HXGYVS2N.js';import'./chunk-TQOT2LBO.js';import'./chunk-EKZDFEJW.js';import'./chunk-LPBCQM5Y.js';import'./chunk-LWAIVOSF.js';import'./chunk-JIXHEBGK.js';import'./chunk-ZJQY5PPP.js';import'./chunk-5TAVYPOV.js';import*as g from'path';import e from'chalk';async function u(n,s,r){let a=s?g.resolve(s):process.cwd();if(!n){r.json?console.log(JSON.stringify({error:"Orchestration ID required"})):(console.log(e.red(`
|
|
3
3
|
Orchestration ID required.`)),console.log(e.gray(`Usage: paradigm team accept <orchestration-id>
|
|
4
4
|
`)));return}let l=new b(a),o=l.getOrchestration(n);if(!o){r.json?console.log(JSON.stringify({error:"Orchestration not found",id:n})):console.log(e.red(`
|
|
5
5
|
Orchestration not found: ${n}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import'./chunk-5TAVYPOV.js';import*as i from'fs/promises';import*as r from'path';import*as m from'js-yaml';async function u(p={}){let l=process.cwd(),a=r.join(l,".paradigm","remediations"),n=[],s;try{s=await i.readdir(a);}catch{process.stdout.write(JSON.stringify(n)+`
|
|
3
|
+
`);return}let f=new Date().toISOString();for(let e of s){if(e.startsWith(".")||!e.endsWith(".yaml")&&!e.endsWith(".yml"))continue;let o=r.join(a,e),c;try{if(!(await i.stat(o)).isFile())continue;c=await i.readFile(o,"utf8");}catch{continue}let t;try{t=m.load(c);}catch(d){process.stderr.write(`paradigm internal active-remediations: skipping ${e}: ${d.message}
|
|
4
|
+
`);continue}!t||typeof t!="object"||t.expires_at&&t.expires_at<f||!t.id||!t.claimant||!t.severity||!t.reason||n.push({id:t.id,claimant:t.claimant,severity:t.severity,reason:t.reason,...t.expires_at?{expires_at:t.expires_at}:{},...t.created?{created:t.created}:{}});}process.stdout.write(JSON.stringify(n)+`
|
|
5
|
+
`);}export{u as activeRemediationsCommand};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {a as a$1}from'./chunk-LKAT7IAK.js';import'./chunk-5TAVYPOV.js';import*as a from'fs';import*as p from'path';import*as R from'os';import n from'chalk';import*as m from'js-yaml';var h=p.join(R.homedir(),".paradigm","agents"),x=".paradigm/agents",$=".agent",k=".paradigm/roster.yaml";function A(e){let s=p.join(e,k);if(!a.existsSync(s))return null;try{return m.load(a.readFileSync(s,"utf8"))?.active??null}catch{return null}}function F(e,s){let c=p.join(e,k),o=p.dirname(c);a.existsSync(o)||a.mkdirSync(o,{recursive:true});let t={version:"1.0",active:s.sort()};a.writeFileSync(c,m.dump(t,{lineWidth:-1,noRefs:true}),"utf8");}function C(){if(!a.existsSync(h))return [];try{return a.readdirSync(h).filter(e=>e.endsWith($)).map(e=>e.replace($,""))}catch{return []}}var E={architect:{style:"deliberate",risk:"conservative",verbosity:"detailed"},builder:{style:"rapid",risk:"balanced",verbosity:"concise"},tester:{style:"methodical",risk:"conservative",verbosity:"concise"},reviewer:{style:"deliberate",risk:"conservative",verbosity:"detailed"},security:{style:"methodical",risk:"conservative",verbosity:"detailed"}};async function D(e={}){let s=process.cwd(),c=a$1.command("agent-list").start("Listing agent profiles",{cwd:s}),o=[];if(!e.project&&a.existsSync(h))try{let f=a.readdirSync(h).filter(r=>r.endsWith($));for(let r of f)try{let d=a.readFileSync(p.join(h,r),"utf-8"),i=m.load(d);i?.id&&o.push(i);}catch{}}catch{}let t=p.join(s,x);if(!e.global&&a.existsSync(t))try{let f=a.readdirSync(t).filter(r=>r.endsWith($));for(let r of f)try{let d=a.readFileSync(p.join(t,r),"utf-8"),i=m.load(d);if(i?.id){let g=o.findIndex(u=>u.id===i.id);g>=0?o[g]=i:o.push(i);}}catch{}}catch{}if(e.json){console.log(JSON.stringify({count:o.length,agents:o.map(T)},null,2)),c.success(`Found ${o.length} agents`);return}if(console.log(n.blue(`
|
|
3
|
+
\u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510`)),console.log(n.blue("\u2502")+n.white.bold(" paradigm agent list ")+n.blue("\u2502")),console.log(n.blue("\u2502")+n.gray(" Persistent agent identity profiles ")+n.blue("\u2502")),console.log(n.blue(`\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518
|
|
4
|
+
`)),o.length===0){console.log(n.yellow(" No .agent profiles found.")),console.log(n.gray(` Create one: paradigm agent create <id> --global
|
|
5
|
+
`)),c.success("No agents found");return}let l=new Set(o.map(f=>f.id)),y=false;for(let f of o){let d=(f.expertise||[]).sort((i,g)=>g.confidence-i.confidence).slice(0,3).map(i=>`${i.symbol} (${(i.confidence*100).toFixed(0)}%)`).join(", ")||n.gray("none yet");if(console.log(` ${n.white.bold(f.id)} \u2014 ${n.gray(f.role)}`),console.log(` Style: ${f.personality?.style||"?"} | Risk: ${f.personality?.risk||"?"} | Verbosity: ${f.personality?.verbosity||"?"}`),console.log(` Top expertise: ${d}`),f.partners&&f.partners.length>0){let i=f.partners.map(g=>l.has(g.id)?g.id:(y=true,`${g.id}${n.yellow("*")}`));console.log(` Partners: ${i.join(", ")}`);}console.log(` Projects: ${Object.keys(f.contexts||{}).join(", ")||n.gray("none")}`),console.log("");}y&&(console.log(n.dim(" * not installed \u2014 run: paradigm agent install <id>")),console.log("")),c.success(`Listed ${o.length} agents`);}async function L(e,s={}){let c=process.cwd(),o=a$1.command("agent-show").start(`Showing agent ${e}`,{cwd:c}),t=j(c,e);if(!t){s.json?console.log(JSON.stringify({error:`Agent "${e}" not found`})):(console.log(n.red(`
|
|
6
|
+
Agent "${e}" not found.`)),console.log(n.gray(` Create: paradigm agent create ${e} --global
|
|
7
|
+
`))),o.error(`Agent ${e} not found`);return}if(s.json){console.log(JSON.stringify(t,null,2)),o.success(`Showed agent ${e}`);return}if(console.log(n.blue(`
|
|
8
|
+
\u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510`)),console.log(n.blue("\u2502")+n.white.bold(` Agent: ${e}`.padEnd(50))+n.blue("\u2502")),console.log(n.blue(`\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518
|
|
9
|
+
`)),console.log(` ${n.white.bold("Role:")} ${t.role}`),console.log(` ${n.white.bold("Description:")} ${t.description}`),console.log(` ${n.white.bold("Version:")} ${t.version}`),console.log(` ${n.white.bold("Created:")} ${t.created}`),console.log(` ${n.white.bold("Updated:")} ${t.updated}`),console.log(""),t.personality){let d=t.personality;console.log(` ${n.white.bold("Personality")}`),console.log(` Style: ${d.style} | Risk: ${d.risk} | Verbosity: ${d.verbosity}`),console.log("");}if(t.partners&&t.partners.length>0){let d=O(c),i=new Set(d.map(g=>g.id));console.log(` ${n.white.bold("Partners")} (${t.partners.length})`);for(let g of t.partners){if(!i.has(g.id)){console.log(` ${g.id} ${n.yellow("(not installed)")} ${n.dim("\u2014 paradigm agent install "+g.id)}`);continue}let b=d.find(w=>w.id===g.id)?.partners?.some(w=>w.id===t.id)??false;console.log(b?` ${g.id} ${n.green("\u2713 reciprocal")}${g.relation?n.dim(` \u2014 ${g.relation}`):""}`:` ${g.id} ${n.yellow("\u26A0 pending")} ${n.dim(`(${g.id} does not list ${t.id})`)}`);}console.log("");}let l=(t.expertise||[]).sort((d,i)=>i.confidence-d.confidence);if(l.length>0){console.log(` ${n.white.bold("Expertise")} (${l.length} symbols)`),console.log(` ${"Symbol".padEnd(30)} ${"Confidence".padEnd(12)} ${"Sessions".padEnd(10)} Last Touch`),console.log(` ${"-".repeat(70)}`);for(let d of l.slice(0,20)){let i=`${(d.confidence*100).toFixed(0)}%`.padEnd(12),g=String(d.sessions).padEnd(10),u=d.lastTouch?d.lastTouch.split("T")[0]:"\u2014";console.log(` ${d.symbol.padEnd(30)} ${i} ${g} ${u}`);}l.length>20&&console.log(n.gray(` ... and ${l.length-20} more`)),console.log("");}else console.log(n.gray(" No expertise recorded. Run `paradigm agent sync` to bootstrap from lore.\n"));let y=t.transferable||[];if(y.length>0){console.log(` ${n.white.bold("Transferable Patterns")} (${y.length})`);for(let d of y)console.log(` ${d.id}: ${(d.successRate*100).toFixed(0)}% success \u2014 ${d.description}`),console.log(n.gray(` Learned in: ${d.learnedIn} | Applied in: ${d.appliedIn.join(", ")||"none"}`));console.log("");}let f=Object.entries(t.contexts||{});if(f.length>0){console.log(` ${n.white.bold("Project Contexts")} (${f.length})`);for(let[d,i]of f)console.log(` ${n.white(d)}: ${i.sessionsInProject||0} sessions, last active ${i.lastActive?.split("T")[0]||"\u2014"}`),i.defaultModel&&console.log(` Model: ${i.defaultModel}`),i.focus?.length&&console.log(` Focus: ${i.focus.join(", ")}`);console.log("");}let r=t.permissions;r&&(console.log(` ${n.white.bold("Permissions")}`),r.paths?.read?.length&&console.log(` Read: ${r.paths.read.join(", ")}`),r.paths?.write?.length&&console.log(` Write: ${r.paths.write.join(", ")}`),r.paths?.deny?.length&&console.log(` Deny: ${n.red(r.paths.deny.join(", "))}`),r.tools?.allow?.length&&console.log(` Tools allow: ${r.tools.allow.join(", ")}`),r.tools?.deny?.length&&console.log(` Tools deny: ${n.red(r.tools.deny.join(", "))}`),r.dangerous_actions?.length&&console.log(` Requires approval: ${r.dangerous_actions.join(", ")}`),console.log("")),o.success(`Showed agent ${e}`);}async function W(e,s={}){let c=process.cwd(),o=s.global?"global":"project",t=a$1.command("agent-create").start(`Creating agent ${e} (${o})`,{cwd:c}),l=o==="global"?h:p.join(c,x);a.existsSync(l)||a.mkdirSync(l,{recursive:true});let y=p.join(l,`${e}${$}`);if(a.existsSync(y)){console.log(n.yellow(`
|
|
10
|
+
Agent "${e}" already exists at ${y}`)),console.log(n.gray(" Use `paradigm agent show` to view.\n")),t.error("Agent already exists");return}let f=new Date().toISOString(),r=E[e]||{style:"deliberate",risk:"balanced",verbosity:"concise"},d={id:e,role:s.role||`${e.charAt(0).toUpperCase()+e.slice(1)} agent`,description:s.description||`Persistent identity for the ${e} agent role`,version:"1.0.0",personality:r,expertise:[],transferable:[],contexts:{},created:f,updated:f};if(s.denyPaths){let g=s.denyPaths.split(",").map(u=>u.trim());d.permissions={paths:{deny:g}};}let i=m.dump(d,{lineWidth:120,noRefs:true,sortKeys:false});a.writeFileSync(y,i,"utf-8"),console.log(n.green(`
|
|
11
|
+
\u2713 Created agent "${e}" at ${y}`)),console.log(n.gray(" Run `paradigm agent sync` to bootstrap expertise from lore.\n")),t.success(`Created agent ${e}`);}async function M(e,s={}){let c=process.cwd(),o=a$1.command("agent-sync").start(`Syncing expertise for ${e}`,{cwd:c}),t=p.join(c,".paradigm","lore","entries");if(!a.existsSync(t)){console.log(n.yellow(`
|
|
12
|
+
No lore directory found. Nothing to sync from.
|
|
13
|
+
`)),o.error("No lore found");return}let l=j(c,e);if(!l){if(s.dryRun){console.log(n.yellow(`
|
|
14
|
+
Agent "${e}" not found. Would create with --no-dry-run.
|
|
15
|
+
`)),o.success("Dry run \u2014 would create");return}let g=(a.existsSync(p.join(h,`${e}${$}`))?"global":"project")==="global"?h:p.join(c,x);a.existsSync(g)||a.mkdirSync(g,{recursive:true});let u=new Date().toISOString(),b=E[e]||{style:"deliberate",risk:"balanced",verbosity:"concise"};l={id:e,role:`${e.charAt(0).toUpperCase()+e.slice(1)} agent`,description:`Persistent identity for the ${e} agent role`,version:"1.0.0",personality:b,expertise:[],transferable:[],contexts:{},created:u,updated:u};}let y=l.expertise||[],f=0,r=new Set,d=I(t);for(let i of d)if(!(!i.symbols_touched||i.symbols_touched.length===0)){f++;for(let g of i.symbols_touched){r.add(g);let u=y.find(b=>b.symbol===g);u?(u.sessions++,u.lastTouch=i.timestamp||u.lastTouch,i.confidence!=null&&(u.confidence=.7*u.confidence+.3*i.confidence)):y.push({symbol:g,confidence:i.confidence??.5,sessions:1,lastTouch:i.timestamp||new Date().toISOString()});}}if(l.expertise=y,s.json)console.log(JSON.stringify({agentId:e,entriesProcessed:f,symbolsUpdated:r.size,dryRun:!!s.dryRun,topExpertise:y.sort((i,g)=>g.confidence-i.confidence).slice(0,10)},null,2));else if(console.log(n.blue(`
|
|
16
|
+
Syncing expertise for "${e}" from ${f} lore entries...`)),console.log(` ${n.green("\u2713")} ${r.size} symbols updated`),console.log(` ${n.green("\u2713")} ${f} entries processed`),y.length>0){console.log(`
|
|
17
|
+
Top expertise:`);for(let i of y.sort((g,u)=>u.confidence-g.confidence).slice(0,5))console.log(` ${i.symbol}: ${(i.confidence*100).toFixed(0)}% (${i.sessions} sessions)`);}if(s.dryRun)s.json||console.log(n.yellow(`
|
|
18
|
+
Dry run \u2014 no changes written.
|
|
19
|
+
`));else {l.updated=new Date().toISOString();let i=p.join(c,x,`${e}${$}`),g=p.join(h,`${e}${$}`),u=a.existsSync(i)?"project":"global",b=u==="global"?h:p.join(c,x);a.existsSync(b)||a.mkdirSync(b,{recursive:true});let w=u==="global"?g:i;a.writeFileSync(w,m.dump(l,{lineWidth:120,noRefs:true,sortKeys:false}),"utf-8"),s.json||console.log(n.green(`
|
|
20
|
+
\u2713 Saved to ${w}
|
|
21
|
+
`));}o.success(`Synced ${r.size} symbols from ${f} entries`);}async function U(e={}){let s=process.cwd(),c=a$1.command("agent-roster").start("Agent roster",{cwd:s}),o=[];if(a.existsSync(h))for(let r of a.readdirSync(h).filter(d=>d.endsWith($)))try{let d=m.load(a.readFileSync(p.join(h,r),"utf-8"));d?.id&&o.push(d);}catch{}let t=p.join(s,x);if(a.existsSync(t))for(let r of a.readdirSync(t).filter(d=>d.endsWith($)))try{let d=m.load(a.readFileSync(p.join(t,r),"utf-8"));if(d?.id){let i=o.findIndex(g=>g.id===d.id);i>=0?o[i]=d:o.push(d);}}catch{}let l=A(s),y=l?o.filter(r=>l.includes(r.id)):o,f=l?o.filter(r=>!l.includes(r.id)):[];if(e.json){console.log(JSON.stringify({active:y.map(r=>v(r,false)),benched:f.map(r=>v(r,true))},null,2)),c.success(`${y.length} active, ${f.length} benched`);return}if(console.log(n.blue(`
|
|
22
|
+
\u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510`)),console.log(n.blue("\u2502")+n.white.bold(" Agent Roster ")+n.blue("\u2502")),console.log(n.blue(`\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518
|
|
23
|
+
`)),y.length>0){console.log(n.green.bold(" Active"));for(let r of y)P(r);}if(f.length>0){console.log(n.gray.bold(`
|
|
24
|
+
Benched`));for(let r of f)P(r,true);}o.length===0?console.log(n.yellow(` No agents found.
|
|
25
|
+
`)):console.log(""),c.success(`${y.length} active, ${f.length} benched`);}function P(e,s=false){let c=(e.expertise||[]).sort((r,d)=>d.confidence-r.confidence),o=c[0]?`${c[0].symbol} (${(c[0].confidence*100).toFixed(0)}%)`:n.gray("\u2014"),t=s?n.gray:n.white,l=e.nickname?` (${e.nickname})`:"",y=e.attention?.threshold,f=y!=null?` | thr: ${y.toFixed(2)}`:"";console.log(` ${t.bold(e.id)}${n.gray(l)} \u2014 ${n.gray(e.role)}`),console.log(` Top: ${o} | ${c.length} symbols${f}`);}function v(e,s=false){let c=(e.expertise||[]).sort((o,t)=>t.confidence-o.confidence);return {id:e.id,role:e.role,nickname:e.nickname,benched:s,expertiseCount:c.length,topExpertise:c.slice(0,3).map(o=>({symbol:o.symbol,confidence:parseFloat(o.confidence.toFixed(2))})),threshold:e.attention?.threshold}}async function J(e){let s=process.cwd(),c=a$1.command("agent-bench").start(`Benching agent ${e}`,{cwd:s}),o=j(s,e);if(!o){console.log(n.red(`
|
|
26
|
+
Agent "${e}" not found.
|
|
27
|
+
`)),c.error("Not found");return}let t=A(s);t?t=t.filter(l=>l!==o.id):t=C().filter(l=>l!==o.id),F(s,t),console.log(n.yellow(`
|
|
28
|
+
Agent "${o.id}" removed from this project's roster.`)),console.log(n.gray(` Maestro will skip this agent during orchestration. Still available globally.
|
|
29
|
+
`)),c.success(`Benched ${o.id} (roster: ${t.length} active)`);}async function z(e){let s=process.cwd(),c=a$1.command("agent-activate").start(`Activating agent ${e}`,{cwd:s}),o=j(s,e);if(!o){console.log(n.red(`
|
|
30
|
+
Agent "${e}" not found.
|
|
31
|
+
`)),c.error("Not found");return}let t=A(s);if(t)t.includes(o.id)||t.push(o.id);else {let l=C();t=l.includes(o.id)?l:[...l,o.id];}F(s,t),console.log(n.green(`
|
|
32
|
+
\u25B6 Agent "${o.id}" added to this project's roster.`)),console.log(n.gray(` Maestro will include this agent in orchestration. Roster is per-project.
|
|
33
|
+
`)),c.success(`Activated ${o.id} (roster: ${t.length} active)`);}function j(e,s){let c=p.join(e,x,`${s}${$}`);if(a.existsSync(c))try{return m.load(a.readFileSync(c,"utf-8"))}catch{}let o=p.join(h,`${s}${$}`);if(a.existsSync(o))try{return m.load(a.readFileSync(o,"utf-8"))}catch{}return null}function O(e){let s=[],c=new Set;if(a.existsSync(h))try{for(let t of a.readdirSync(h).filter(l=>l.endsWith($)))try{let l=m.load(a.readFileSync(p.join(h,t),"utf-8"));l?.id&&!c.has(l.id)&&(s.push(l),c.add(l.id));}catch{}}catch{}let o=p.join(e,x);if(a.existsSync(o))try{for(let t of a.readdirSync(o).filter(l=>l.endsWith($)))try{let l=m.load(a.readFileSync(p.join(o,t),"utf-8"));if(l?.id){let y=s.findIndex(f=>f.id===l.id);y>=0?s[y]=l:(s.push(l),c.add(l.id));}}catch{}}catch{}return s}function T(e){return {id:e.id,role:e.role,personality:e.personality,expertiseCount:(e.expertise||[]).length,topExpertise:(e.expertise||[]).sort((s,c)=>c.confidence-s.confidence).slice(0,3).map(s=>({symbol:s.symbol,confidence:parseFloat(s.confidence.toFixed(2))})),projectContexts:Object.keys(e.contexts||{}),transferableCount:(e.transferable||[]).length}}function I(e){let s=[];try{let c=a.readdirSync(e,{withFileTypes:!0});for(let o of c){if(!o.isDirectory())continue;let t=p.join(e,o.name);try{let l=a.readdirSync(t).filter(y=>y.endsWith(".yaml")||y.endsWith(".yml"));for(let y of l)try{let f=a.readFileSync(p.join(t,y),"utf-8"),r=m.load(f);r?.symbols_touched&&Array.isArray(r.symbols_touched)&&s.push({symbols_touched:r.symbols_touched,confidence:typeof r.confidence=="number"?r.confidence:void 0,timestamp:r.timestamp||o.name});}catch{}}catch{}}}catch{}return s}export{z as agentActivateCommand,J as agentBenchCommand,W as agentCreateCommand,D as agentListCommand,U as agentRosterCommand,L as agentShowCommand,M as agentSyncCommand};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
export{p as buildProfileEnrichment,t as checkPathPermission,u as checkToolPermission,x as computeIntegrityHash,k as createAgentProfile,a as decayedConfidence,s as determineIntegrityStatus,w as enforcePermissions,g as findAgentsByNickname,v as getPermissionConstraints,c as isAgentActive,e as listAllGlobalAgentIds,f as loadAgentProfile,i as loadAllAgentProfiles,b as loadProjectRoster,o as mergeAgentProfileWithManifest,l as queryExpertise,h as resolveAgent,r as sanitizeForPrompt,j as saveAgentProfile,d as saveProjectRoster,q as syncExpertiseFromLore,n as updateExpertiseFromAssessment,m as updateExpertiseFromLore,y as verifyIntegrity}from'./chunk-
|
|
2
|
+
export{p as buildProfileEnrichment,t as checkPathPermission,u as checkToolPermission,x as computeIntegrityHash,k as createAgentProfile,a as decayedConfidence,s as determineIntegrityStatus,w as enforcePermissions,g as findAgentsByNickname,v as getPermissionConstraints,c as isAgentActive,e as listAllGlobalAgentIds,f as loadAgentProfile,i as loadAllAgentProfiles,b as loadProjectRoster,o as mergeAgentProfileWithManifest,l as queryExpertise,h as resolveAgent,r as sanitizeForPrompt,j as saveAgentProfile,d as saveProjectRoster,q as syncExpertiseFromLore,n as updateExpertiseFromAssessment,m as updateExpertiseFromLore,y as verifyIntegrity}from'./chunk-GD4F2HC6.js';import'./chunk-MBPLJKE5.js';import'./chunk-5TAVYPOV.js';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {z}from'./chunk-
|
|
2
|
+
import {z}from'./chunk-KAFQA7HV.js';export{p as buildProfileEnrichment,t as checkPathPermission,u as checkToolPermission,x as computeIntegrityHash,k as createAgentProfile,a as decayedConfidence,s as determineIntegrityStatus,w as enforcePermissions,g as findAgentsByNickname,v as getPermissionConstraints,c as isAgentActive,e as listAllGlobalAgentIds,f as loadAgentProfile,i as loadAllAgentProfiles,b as loadProjectRoster,o as mergeAgentProfileWithManifest,l as queryExpertise,h as resolveAgent,r as sanitizeForPrompt,j as saveAgentProfile,d as saveProjectRoster,q as syncExpertiseFromLore,n as updateExpertiseFromAssessment,m as updateExpertiseFromLore,y as verifyIntegrity}from'./chunk-KAFQA7HV.js';import'./chunk-EK4ZRIFJ.js';import'./chunk-5TAVYPOV.js';z();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {a}from'./chunk-TYWB5IQJ.js';import {e}from'./chunk-
|
|
2
|
+
import {a}from'./chunk-TYWB5IQJ.js';import {e}from'./chunk-TQOT2LBO.js';import'./chunk-5TAVYPOV.js';import o from'chalk';async function y(s,g){let r=process.cwd(),t=e(r);t||(g.json?console.log(JSON.stringify({error:"No agents.yaml found"})):console.log(o.red("\nNo agents.yaml found. Run `paradigm team init` first.\n")),process.exit(1));let e$1=a(s,t.agents);if(g.json){console.log(JSON.stringify({task:s,suggestions:e$1},null,2));return}if(console.log(o.cyan(`
|
|
3
3
|
Suggested agents for this task:
|
|
4
4
|
`)),console.log(o.gray(` Task: "${s}"
|
|
5
5
|
`)),e$1.length===0){console.log(o.yellow(` No agents matched. Consider using architect \u2192 builder flow.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {f,p as p$1,i,c as c$1,j}from'./chunk-
|
|
2
|
+
import {f,p as p$1,i,c as c$1,j}from'./chunk-GD4F2HC6.js';import {e,b as b$2,f as f$1}from'./chunk-F6E3HW45.js';import {b as b$3}from'./chunk-7SWEOPWF.js';import'./chunk-MBPLJKE5.js';import {c,b as b$1,d,a}from'./chunk-5TAVYPOV.js';import*as p from'fs';import*as b from'path';import*as T from'js-yaml';import*as Z from'os';var kt={};c(kt,{getJournalStats:()=>se,loadAllJournalEntries:()=>re,loadJournalEntries:()=>O,loadJournalEntry:()=>ie,recordJournalEntry:()=>V});function G(e){let t=process.env.HOME||process.env.USERPROFILE||"";return b.join(t,".paradigm","agents",e,"journal")}function oe(){let e=new Date,t=e.toISOString().slice(0,10),n=e.toISOString().slice(11,19).replace(/:/g,""),o=String(Math.floor(Math.random()*999)+1).padStart(3,"0");return `LJ-${t}-${n}-${o}`}function V(e,t){let n=new Date,o=oe(),r={id:o,agent:e,timestamp:n.toISOString(),...t},i=G(e);p.mkdirSync(i,{recursive:true});let s=b.join(i,`${o}.yaml`);return p.writeFileSync(s,T.dump(r,{lineWidth:120,noRefs:true}),"utf8"),r}function O(e,t){let n=G(e);if(!p.existsSync(n))return [];let o=[],r=p.readdirSync(n).filter(s=>s.endsWith(".yaml"));for(let s of r)try{let a=p.readFileSync(b.join(n,s),"utf8"),c=T.load(a);c&&c.id&&o.push(c);}catch{}let i=o;return t?.trigger&&(i=i.filter(s=>s.trigger===t.trigger)),t?.project&&(i=i.filter(s=>s.project===t.project)),t?.transferable!==void 0&&(i=i.filter(s=>s.transferable===t.transferable)),t?.tag&&(i=i.filter(s=>s.tags?.some(a=>a.startsWith(t.tag)))),t?.dateFrom&&(i=i.filter(s=>s.timestamp>=t.dateFrom)),t?.dateTo&&(i=i.filter(s=>s.timestamp<=t.dateTo)),i.sort((s,a)=>a.timestamp.localeCompare(s.timestamp)),t?.limit&&(i=i.slice(0,t.limit)),i}function ie(e,t){let n=G(e),o=b.join(n,`${t}.yaml`);if(!p.existsSync(o))return null;let r=p.readFileSync(o,"utf8");return T.load(r)}function re(e){let t=process.env.HOME||process.env.USERPROFILE||"",n=b.join(t,".paradigm","agents");if(!p.existsSync(n))return [];let o=[],r=p.readdirSync(n,{withFileTypes:true}).filter(i=>i.isDirectory());for(let i of r){if(e?.agent&&i.name!==e.agent)continue;let s=O(i.name,e);o.push(...s);}return o.sort((i,s)=>s.timestamp.localeCompare(i.timestamp)),e?.limit?o.slice(0,e.limit):o}function se(e){let t=O(e),n={},o={},r=0;for(let i of t)n[i.trigger]=(n[i.trigger]||0)+1,o[i.project]=(o[i.project]||0)+1,i.transferable&&r++;return {total:t.length,byTrigger:n,byProject:o,transferableCount:r,recentInsights:t.slice(0,5).map(i=>({id:i.id,trigger:i.trigger,insight:i.insight.slice(0,200),timestamp:i.timestamp}))}}var K=b$1(()=>{});var Tt={};c(Tt,{addNotebookEntry:()=>Rt,classifyNotebookScope:()=>$t,incrementApplied:()=>de,loadNotebookEntries:()=>Nt,promoteFromLore:()=>le,searchNotebooks:()=>ce});function Nt(e,t,n){let o=new Map,r=b.join(X,e);xt(r,o);let i=b.join(t,Y,e);xt(i,o);let s=Array.from(o.values());if(n?.concepts&&n.concepts.length>0){let a=new Set(n.concepts.map(c=>c.toLowerCase()));s=s.filter(c=>c.concepts.some(u=>a.has(u.toLowerCase())));}if(n?.tags&&n.tags.length>0){let a=new Set(n.tags.map(c=>c.toLowerCase()));s=s.filter(c=>c.tags.some(u=>a.has(u.toLowerCase())));}return s.sort((a,c)=>c.appliedCount-a.appliedCount)}function xt(e,t){if(p.existsSync(e))try{let n=p.readdirSync(e).filter(o=>o.startsWith(ae)&&o.endsWith(Q));for(let o of n)try{let r=p.readFileSync(b.join(e,o),"utf-8"),i=T.load(r);i?.id&&t.set(i.id,i);}catch{}}catch{}}function ce(e,t,n){let o=Nt(e,n),r=t.toLowerCase();return o.filter(i=>i.context.toLowerCase().includes(r)||i.snippet.toLowerCase().includes(r)||i.concepts.some(s=>s.toLowerCase().includes(r))||i.tags.some(s=>s.toLowerCase().includes(r)))}function $t(e){let t=[e.context,e.snippet,...e.concepts,...e.tags].join(" ").toLowerCase();return ["paradigm","mcp_","mcp tool",".paradigm/","lore entry","lore record","aspect","^gate","portal.yaml",".purpose","sentinel","symphony","ambient nomination","paradigm_"," pan ","agent notebook","concept anchor","symbol system","work log","knowledge stream","nevr.land","neverland"].some(o=>t.includes(o))?"platform-specific":/[#$^!~][a-z][a-z0-9-]{2,}/.test(t)||/\/[a-z0-9_-]{2,}\/[a-z0-9_-]/.test(t)?"project-specific":"generalizable"}function Rt(e,t,n,o){let r=new Date().toISOString(),i=(t.concepts[0]||t.context.split(" ").slice(0,4).join(" ")||"entry").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,40),a=`nb-${e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}-${i}`,c=t.scope??$t({context:t.context,snippet:t.snippet,concepts:t.concepts,tags:t.tags}),u={...t,id:a,scope:c,publishable:t.publishable??true,appliedCount:0,created:r,updated:r},d=n==="global"?b.join(X,e):b.join(o||process.cwd(),Y,e);p.existsSync(d)||p.mkdirSync(d,{recursive:true});let l=`${a}${Q}`,m=b.join(d,l),g=T.dump(u,{lineWidth:120,noRefs:true,sortKeys:false});return p.writeFileSync(m,g,"utf-8"),{entry:u,filePath:m}}async function le(e,t,n,o="global"){let{loadLoreEntry:r}=await import('./lore-loader-D2ISOASW.js'),i=await r(n,t);if(!i)return null;let s=[];if(i.symbols_touched)for(let u of i.symbols_touched){let d=u.replace(/^[#$^!~]/,"").toLowerCase();s.push(d);}let a=i.summary||"";i.body&&(a+=`
|
|
3
3
|
|
|
4
4
|
`+i.body);let c={source:"lore",loreEntryId:t,originProject:b.basename(n),createdBy:e};return Rt(e,{context:i.title||`Promoted from ${t}`,snippet:a,provenance:c,confidence:i.confidence??.7,concepts:s,tags:i.tags||[]},o,n)}function de(e,t,n){let o=b.join(n,Y,e),r=b.join(X,e);for(let i of [o,r]){let s=b.join(i,`${t}${Q}`);if(p.existsSync(s))try{let a=p.readFileSync(s,"utf-8"),c=T.load(a);if(c)return c.appliedCount=(c.appliedCount||0)+1,c.updated=new Date().toISOString(),p.writeFileSync(s,T.dump(c,{lineWidth:120,noRefs:!0,sortKeys:!1}),"utf-8"),!0}catch{}}return false}var X,Y,ae,Q,Pt=b$1(()=>{X=b.join(Z.homedir(),".paradigm","notebooks"),Y=".paradigm/notebooks",ae="nb-",Q=".yaml";});var ht=".paradigm/events",Yt="stream.jsonl",J=1e3,$=[];function bt(e){return b.join(e,ht,Yt)}function Qt(){let e=Date.now(),t=Math.floor(Math.random()*9999).toString().padStart(4,"0");return `ev-${e}-${t}`}function M(e,t){let n={id:Qt(),timestamp:new Date().toISOString(),...t};$.push(n),$.length>J&&($=$.slice(-J));try{let o=b.join(e,ht);p.mkdirSync(o,{recursive:!0});let r=bt(e);p.appendFileSync(r,JSON.stringify(n)+`
|
|
5
5
|
`,"utf8"),Zt(r);}catch{}return n}function Zt(e){try{if(p.statSync(e).size>512*1024){let o=p.readFileSync(e,"utf8").trim().split(`
|
|
@@ -31,5 +31,5 @@ import {f,p as p$1,i,c as c$1,j}from'./chunk-TBWWFRL5.js';import {e,b as b$2,f a
|
|
|
31
31
|
`,"utf8");}else p.writeFileSync(g,y,"utf8");break}}}}catch{}}catch{}return {promoted:a.length,entries:a}}var xe=".paradigm/surfacing.yaml";function Ht(e){let t=b.join(e,xe),n={default_min_urgency:"low",enable_debates:true};if(!p.existsSync(t))return n;try{let o=a("js-yaml"),r=p.readFileSync(t,"utf8"),i=o.load(r);return {...n,...i}}catch{return n}}function Bt(e,t){let n={critical:0,high:1,medium:2,low:3},o=n[t.default_min_urgency||"low"]??3;return e.filter(r=>{let i=n[r.urgency]??3;if(t.preferences){let s=t.preferences.find(a=>a.agent===r.agent);if(s){if(s.always_show)return true;if(s.mute_unless?.length&&!s.mute_unless.some(c=>r.urgency===c||r.type===c))return false;if(s.min_urgency){let a=n[s.min_urgency]??3;return i<=a}}}return i<=o})}var De=".paradigm/decisions";function Wt(e,t){let n=b.join(e,De);if(!p.existsSync(n))return [];let o=[],r=p.readdirSync(n).filter(s=>s.endsWith(".yaml"));for(let s of r)try{let a=p.readFileSync(b.join(n,s),"utf8"),c=T.load(a);c&&c.id&&o.push(c);}catch{}let i=o;return (i=i.filter(s=>s.status===t.status)),t?.participant&&(i=i.filter(s=>s.participants.some(a=>a.id===t.participant))),t?.symbol&&(i=i.filter(s=>s.symbols_affected?.includes(t.symbol))),t?.tag&&(i=i.filter(s=>s.tags?.some(a=>a.startsWith(t.tag)))),t?.dateFrom&&(i=i.filter(s=>s.timestamp>=t.dateFrom)),t?.dateTo&&(i=i.filter(s=>s.timestamp<=t.dateTo)),i.sort((s,a)=>a.timestamp.localeCompare(s.timestamp)),t?.limit&&(i=i.slice(0,t.limit)),i}K();function Ye(){return [{name:"paradigm_ambient_nominations",description:"Get pending agent nominations \u2014 agents that self-nominated contributions based on recent events. Filters by urgency, agent, pending status. Marks returned nominations as surfaced. ~200 tokens.",inputSchema:{type:"object",properties:{urgency:{type:"string",enum:["critical","high","medium","low"],description:"Filter by urgency level"},agent:{type:"string",description:"Filter by agent ID"},pending_only:{type:"boolean",description:"Only show un-engaged nominations (default: true)"},include_debates:{type:"boolean",description:"Include debate groupings (default: false)"},limit:{type:"number",description:"Max nominations to return (default: 20)"}}},annotations:{readOnlyHint:false,destructiveHint:false}},{name:"paradigm_ambient_events",description:"Query the ambient event stream \u2014 recent tool calls, file edits, gate checks, and other project activity. Filters by type, source, symbol, agent, time window. ~200 tokens.",inputSchema:{type:"object",properties:{type:{type:"string",description:'Event type filter (e.g., "file-modified", "gate-checked", "decision-made")'},source:{type:"string",description:'Event source filter (e.g., "mcp-tool-call", "post-write-hook")'},symbol:{type:"string",description:"Filter events referencing this symbol"},agent:{type:"string",description:"Filter events from this agent"},since:{type:"string",description:'Relative time filter (e.g., "1h", "30m", "2d") or ISO timestamp'},limit:{type:"number",description:"Max events to return (default: 50)"}}},annotations:{readOnlyHint:true,destructiveHint:false}},{name:"paradigm_ambient_engage",description:"Accept, dismiss, or defer a nomination. Optionally resolves a debate by choosing this nomination over others. ~50 tokens.",inputSchema:{type:"object",properties:{nomination_id:{type:"string",description:"Nomination ID to engage with"},response:{type:"string",enum:["accepted","dismissed","deferred"],description:"How to respond"},resolve_debate:{type:"string",description:"Optional debate ID to resolve by choosing this nomination"},reason:{type:"string",description:"Reason for response \u2014 stored on nomination for learning feedback. Especially valuable for dismissals."}},required:["nomination_id","response"]},annotations:{readOnlyHint:false,destructiveHint:false}},{name:"paradigm_context_compose",description:"Compose full agent session context: profile enrichment + recent decisions + transferable journal entries + pending nominations. Returns a markdown context block for prompt injection. ~300 tokens.",inputSchema:{type:"object",properties:{agent:{type:"string",description:"Agent ID to compose context for"},symbols:{type:"array",items:{type:"string"},description:"Relevant symbols for expertise filtering"},include_nominations:{type:"boolean",description:"Include pending nominations (default: true)"},include_decisions:{type:"boolean",description:"Include recent team decisions (default: true)"},include_journal:{type:"boolean",description:"Include transferable journal entries (default: true)"},max_decisions:{type:"number",description:"Max decisions to include (default: 5)"},max_journal:{type:"number",description:"Max journal entries to include (default: 5)"}},required:["agent"]},annotations:{readOnlyHint:true,destructiveHint:false}},{name:"paradigm_ambient_promote",description:"Auto-promote high-confidence pattern discoveries from an agent's learning journal to its notebook. Promotes entries with trigger=pattern_discovered and confidence_after >= 0.8. ~100 tokens.",inputSchema:{type:"object",properties:{agent:{type:"string",description:"Agent ID whose journal to scan"}},required:["agent"]},annotations:{readOnlyHint:false,destructiveHint:false}},{name:"paradigm_ambient_learn",description:"Analyze an agent's nomination acceptance/dismissal history and adjust its attention threshold. If >60% dismissed \u2192 raise threshold (less noise). If >80% accepted \u2192 lower threshold (contribute more). Also returns engagement stats. ~100 tokens.",inputSchema:{type:"object",properties:{agent:{type:"string",description:"Agent ID to analyze and adjust"},dry_run:{type:"boolean",description:"If true, return stats without adjusting (default: false)"}},required:["agent"]},annotations:{readOnlyHint:false,destructiveHint:false}},{name:"paradigm_ambient_health",description:"Agent learning health metrics \u2014 aggregate learning quality across all agents: nomination acceptance rates, threshold drift, notebook counts, expertise growth, and overall health status (cold-start \u2192 accumulating \u2192 calibrating \u2192 mature).",inputSchema:{type:"object",properties:{}},annotations:{readOnlyHint:true,destructiveHint:false}},{name:"paradigm_ambient_learn_postflight",description:"Postflight learning pass \u2014 converts session work log verdicts into agent journal entries. Reads accepted/dismissed/revised verdicts from the session log, creates journal entries for each agent, then auto-promotes high-confidence entries to notebooks. Typically called at session end by the stop hook. ~200 tokens.",inputSchema:{type:"object",properties:{session_id:{type:"string",description:"Session ID (default: current session)"},dry_run:{type:"boolean",description:"If true, show what would be written without writing (default: false)"}}},annotations:{readOnlyHint:false,destructiveHint:false}}]}function Ne(e){let t=Date.now(),n=e.match(/^(\d+)(m|h|d)$/);if(n){let o=parseInt(n[1],10),r=n[2],i=r==="m"?o*6e4:r==="h"?o*36e5:o*864e5;return new Date(t-i).toISOString()}return e}async function Qe(e,t,n){let o=r=>JSON.stringify(r,null,2);switch(e){case "paradigm_ambient_nominations":{Mt(n.rootDir);let i=t.pending_only!==false,s=t.limit||20,a=E(n.rootDir,{agent:t.agent,urgency:t.urgency,pending_only:i,limit:s+20}),c=Ht(n.rootDir);a=Bt(a,c).slice(0,s);let u=b.join(n.rootDir,".paradigm/events/nominations.jsonl");if(p.existsSync(u))try{let l=p.readFileSync(u,"utf8"),m=new Set(a.map(f=>f.id)),g=l.trim().split(`
|
|
32
32
|
`).map(f=>{try{let y=JSON.parse(f);return m.has(y.id)?(y.surfaced=!0,JSON.stringify(y)):f}catch{return f}});p.writeFileSync(u,g.join(`
|
|
33
33
|
`)+`
|
|
34
|
-
`,"utf8");}catch{}let d={count:a.length,nominations:a.map(l=>({id:l.id,agent:l.agent,urgency:l.urgency,type:l.type,brief:l.brief,relevance:l.relevance,timestamp:l.timestamp,engaged:l.engaged,response:l.response}))};if(t.include_debates){let m=It(n.rootDir).filter(g=>!g.resolution);d.debates=m.map(g=>({id:g.id,topic:g.topic,type:g.type,nominations:g.nominations})),d.debate_count=m.length;}return {text:o(d),handled:true}}case "paradigm_ambient_events":{let r=t.since?Ne(t.since):void 0,i=t.limit||50,s=St(n.rootDir,{type:t.type,source:t.source,symbol:t.symbol,agent:t.agent,since:r,limit:i});return {text:o({count:s.length,events:s.map(a=>({id:a.id,type:a.type,source:a.source,timestamp:a.timestamp,path:a.path,symbols:a.symbols,context:a.context,agent:a.agent,tool:a.tool,severity:a.severity}))}),handled:true}}case "paradigm_ambient_engage":{let r=t.nomination_id,i=t.response,s=t.reason,a=Ct(n.rootDir,r,i,s);if(a)try{let{appendSessionWorkEntry:u,appendVerdictEntry:d}=await import('./session-work-log-
|
|
34
|
+
`,"utf8");}catch{}let d={count:a.length,nominations:a.map(l=>({id:l.id,agent:l.agent,urgency:l.urgency,type:l.type,brief:l.brief,relevance:l.relevance,timestamp:l.timestamp,engaged:l.engaged,response:l.response}))};if(t.include_debates){let m=It(n.rootDir).filter(g=>!g.resolution);d.debates=m.map(g=>({id:g.id,topic:g.topic,type:g.type,nominations:g.nominations})),d.debate_count=m.length;}return {text:o(d),handled:true}}case "paradigm_ambient_events":{let r=t.since?Ne(t.since):void 0,i=t.limit||50,s=St(n.rootDir,{type:t.type,source:t.source,symbol:t.symbol,agent:t.agent,since:r,limit:i});return {text:o({count:s.length,events:s.map(a=>({id:a.id,type:a.type,source:a.source,timestamp:a.timestamp,path:a.path,symbols:a.symbols,context:a.context,agent:a.agent,tool:a.tool,severity:a.severity}))}),handled:true}}case "paradigm_ambient_engage":{let r=t.nomination_id,i=t.response,s=t.reason,a=Ct(n.rootDir,r,i,s);if(a)try{let{appendSessionWorkEntry:u,appendVerdictEntry:d}=await import('./session-work-log-ZVVJGO7X.js'),m=E(n.rootDir,{limit:500}).find(f=>f.id===r),g={timestamp:new Date().toISOString(),type:"user-verdict",agent:m?.agent,nominationId:r,verdict:i,reason:s};u(n.rootDir,g),d(n.rootDir,g);}catch{}let c=false;return t.resolve_debate&&a&&(c=Jt(n.rootDir,t.resolve_debate,r,t.reason)),{text:o({engaged:a,nomination_id:r,response:i,debate_resolved:c||void 0}),handled:true}}case "paradigm_context_compose":{let r=t.agent,i=t.symbols||[],s=t.include_nominations!==false,a=t.include_decisions!==false,c=t.include_journal!==false,u=t.max_decisions||5,d=t.max_journal||5,l=f(n.rootDir,r);if(!l)return {text:o({error:`Agent profile not found: ${r}`}),handled:true};let m=[],g=p$1(l,i);if(g.trim()&&m.push(g),a){let f=Wt(n.rootDir,{status:"active",limit:u});if(f.length>0){m.push("## Recent Team Decisions");for(let y of f)m.push(`- **${y.title}**: ${y.decision.slice(0,150)}${y.decision.length>150?"...":""}`);m.push("");}}if(c){let f=O(r,{transferable:true,limit:d});if(f.length>0){m.push("## Transferable Insights");for(let y of f)m.push(`- [${y.trigger}] ${y.insight.slice(0,150)}${y.insight.length>150?"...":""}`);m.push("");}}if(s){let f=E(n.rootDir,{pending_only:true,limit:10});if(f.length>0){m.push("## Pending Nominations");for(let y of f)m.push(`- [${y.urgency}] ${y.brief}`);m.push("");}}return {text:o({agent:r,context:m.join(`
|
|
35
35
|
`),sections_included:{profile:true,decisions:a,journal:c,nominations:s}}),handled:true}}case "paradigm_ambient_promote":{let r=t.agent,i=ot(n.rootDir,r);return {text:o({agent:r,promoted:i.promoted,entries:i.entries}),handled:true}}case "paradigm_ambient_learn":{let r=t.agent,i=t.dry_run===true,s=nt(n.rootDir,r);if(i)return {text:o({agent:r,dry_run:true,stats:s,note:s.total<5?"Insufficient data for threshold adjustment (need 5+ engaged nominations)":`Accept rate: ${(s.acceptRate*100).toFixed(0)}% \u2014 ${s.acceptRate>.8?"would lower threshold":s.acceptRate<.4?"would raise threshold":"no adjustment needed"}`}),handled:true};let a=Lt(n.rootDir,r);return {text:o({agent:r,...a,stats:s}),handled:true}}case "paradigm_ambient_health":case "paradigm_ambient_neverland":{let r=Ut(n.rootDir);return {text:o(r),handled:true}}case "paradigm_ambient_learn_postflight":return {text:o(await Te(n.rootDir,t)),handled:true};default:return {text:`Unknown ambient tool: ${e}`,handled:false}}}var $e={accepted:"human_feedback",dismissed:"confidence_miss",revised:"correction_received"};function Re(e){try{let t=b.join(e,".paradigm","config.yaml");if(p.existsSync(t)){let o=p.readFileSync(t,"utf8").match(/project:\s*["']?([^"'\n]+)["']?/);if(o)return o[1].trim()}}catch{}return b.basename(e)}async function Te(e$1,t={}){let n=t.dry_run===true,o=Re(e$1),r=e(e$1).filter(f=>f.verdict&&f.agent),i=b$2(e$1);if(r.length===0)return {sessionEntries:i.length,agentsProcessed:[],journalsWritten:0,journalsByAgent:{},promoted:0,promotedByAgent:{},dryRun:n,details:[]};let s=new Map;for(let f of r){let y=f.agent;s.has(y)||s.set(y,[]),s.get(y).push(f);}let a=i.filter(f=>f.type==="agent-contribution"),c=new Map;for(let f of a)f.agent&&(c.has(f.agent)||c.set(f.agent,[]),c.get(f.agent).push(f));let u=[],d={},l=0;for(let[f,y]of s){d[f]=0;let D=y.filter(h=>h.verdict==="accepted").length;y.filter(h=>h.verdict==="dismissed").length;y.filter(h=>h.verdict==="revised").length;let H=y.length,zt=H>0?D/H:0;for(let h of y){let B=$e[h.verdict];if(!B)continue;let Gt=c.get(f)?.shift(),st=Pe(h,Gt,{acceptRate:zt,total:H,accepted:D}),Vt=h.verdict==="accepted"?.85:h.verdict==="revised"?.6:.4,Kt={agent:f,verdict:h.verdict,trigger:B,insight:st,symbols:h.symbols};if(u.push(Kt),n)d[f]++,l++;else try{V(f,{trigger:B,insight:st,confidence_before:h.verdict==="accepted"?.7:.8,confidence_after:Vt,project:o,transferable:h.verdict==="dismissed",tags:["postflight",`verdict:${h.verdict}`,...(h.symbols||[]).map(Xt=>`symbol:${Xt}`)]}),d[f]++,l++;}catch{}}}let m={},g=0;if(!n)for(let f of s.keys())try{let y=ot(e$1,f);y.promoted>0&&(m[f]=y.promoted,g+=y.promoted);}catch{}return !n&&r.length>0&&f$1(e$1,r.map(f=>f.nominationId).filter(Boolean)),{sessionEntries:i.length,agentsProcessed:Array.from(s.keys()),journalsWritten:l,journalsByAgent:d,promoted:g,promotedByAgent:m,dryRun:n,details:u}}function Pe(e,t,n){let o=e.symbols?.length?` (symbols: ${e.symbols.join(", ")})`:"",r=e.reason?` Reason: ${e.reason}.`:"";switch(e.verdict){case "accepted":return `Contribution accepted by user${o}.${r}`+(t?.contribution?` Original: "${t.contribution.slice(0,120)}".`:"")+` Session accept rate: ${(n.acceptRate*100).toFixed(0)}% (${n.accepted}/${n.total}).`;case "dismissed":return `Contribution dismissed by user${o}.${r}`+(t?.contribution?` Rejected contribution: "${t.contribution.slice(0,120)}".`:"")+` Learn from this dismissal to improve future nominations. Session accept rate: ${(n.acceptRate*100).toFixed(0)}% (${n.accepted}/${n.total}).`;case "revised":return `Contribution revised by user${o}.${r}`+(e.revisionDelta?` Delta: "${e.revisionDelta.slice(0,120)}".`:"")+(t?.contribution?` Original: "${t.contribution.slice(0,120)}".`:"")+` Partial credit \u2014 close but not accurate enough. Session accept rate: ${(n.acceptRate*100).toFixed(0)}% (${n.accepted}/${n.total}).`;default:return `Unknown verdict "${e.verdict}"${o}.${r}`}}export{Ye as getAmbientToolsList,Qe as handleAmbientTool,Te as runPostflightLearning};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import'./chunk-5TAVYPOV.js';import*as s from'path';import t from'chalk';async function g(n){let e=n.project?s.resolve(n.project):process.cwd(),r=n.dryRun===true,{readPendingVerdicts:a}=await import('./session-work-log-
|
|
2
|
+
import'./chunk-5TAVYPOV.js';import*as s from'path';import t from'chalk';async function g(n){let e=n.project?s.resolve(n.project):process.cwd(),r=n.dryRun===true,{readPendingVerdicts:a}=await import('./session-work-log-ZVVJGO7X.js'),i=a(e);if(i.length===0){console.log(t.dim("[paradigm] No pending verdicts \u2014 postflight skipped."));return}console.log(t.cyan(`[paradigm] Running postflight \u2014 ${i.length} pending verdict(s)${r?" (dry run)":""}...`));let{runPostflightLearning:l}=await import('./ambient-AI42BOM5.js'),o=await l(e,{dry_run:r});if(o.journalsWritten===0&&o.promoted===0){console.log(t.dim("[paradigm] Postflight complete \u2014 no new journals written."));return}console.log(t.green("[paradigm] Postflight complete:")),o.journalsWritten>0&&console.log(` ${t.bold(o.journalsWritten)} journal entries written across ${o.agentsProcessed.length} agent(s)`),o.promoted>0&&console.log(` ${t.bold(o.promoted)} entries auto-promoted to notebooks`);}export{g as ambientPostflightCommand};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import'./chunk-5TAVYPOV.js';import*as a from'fs/promises';import*as s from'path';import*as n from'js-yaml';var c=s.join(".paradigm","authority.yaml");async function y(e,r){let t=s.join(e,c);try{await a.access(t);return}catch{}await a.mkdir(s.dirname(t),{recursive:true});let i=new Date().toISOString(),m=n.dump({version:"1.0",schema:"v0-experimental",claims:{"aspect-coverage":{claimant:"compliance",severity:"advise",since:i,source:r},"aspect-drift":{claimant:"compliance",severity:"advise",since:i,source:r},"anchor-staleness":{claimant:"compliance",severity:"advise",since:i,source:r}}},{lineWidth:100,sortKeys:false});await a.writeFile(t,m,"utf8");}async function l(e){let r=s.join(e,c),t;try{t=await a.readFile(r,"utf8");}catch(o){if(o.code==="ENOENT")return null;throw o}let i=n.load(t);return i==null||typeof i!="object"?{version:"1.0",schema:"v0-experimental",claims:{}}:((!i.claims||typeof i.claims!="object")&&(i.claims={}),i)}async function h(e){return (await l(e))?.claims??{}}async function u(e,r){let t=s.join(e,c);await a.mkdir(s.dirname(t),{recursive:true});let i=n.dump(r,{lineWidth:100,sortKeys:false});await a.writeFile(t,i,"utf8");}async function f(e,r,t){let i=await l(e)??{version:"1.0",schema:"v0-experimental",claims:{}};i.claims[r]=t,await u(e,i);}async function p(e,r){let t=await l(e);return !t||!(r in t.claims)?false:(delete t.claims[r],await u(e,t),true)}export{h as getActiveClaims,l as readAuthority,p as removeClaim,f as upsertClaim,y as writeArchetypeDefaults};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {b}from'./chunk-
|
|
2
|
+
import {b}from'./chunk-IOVHF4SR.js';import {e,f,c,d,l,h,g,k,i,m as m$1,o,n,j,b as b$1,a as a$1}from'./chunk-TQOT2LBO.js';import {a}from'./chunk-Y4XFVDZC.js';import*as $ from'fs';import*as m from'path';import e$1 from'chalk';import E from'prompts';function F(){return process.env.CLAUDE_CODE==="1"||process.env.TERM_PROGRAM==="claude"?false:!!(process.env.TERM_PROGRAM==="cursor"||process.env.CURSOR_SESSION||process.env.CURSOR_TRACE_ID||process.env.VSCODE_CWD&&process.env.VSCODE_CWD.toLowerCase().includes("cursor")||process.env.VSCODE_NLS_CONFIG&&process.env.VSCODE_NLS_CONFIG.toLowerCase().includes("cursor")||process.env.TERM_PROGRAM==="vscode"&&process.env.VSCODE_GIT_ASKPASS_NODE?.toLowerCase().includes("cursor")||process.stdin.isTTY)}async function T(g){let n=new a(g),c=await n.discover();console.log(e$1.cyan(`
|
|
3
3
|
Configure Agent Models
|
|
4
4
|
`)),console.log(e$1.gray(` Environment: ${c.source}`)),console.log(e$1.gray(` Available: ${c.models.length} models
|
|
5
5
|
`));let i={},o=n.groupByTier(c.models),a$2=t=>{let r=a$1[t],s=r.tier==="high"?o.high:r.tier==="medium"?o.medium:o.low,l=[];for(let f of s){let P=l.length===0;l.push({title:P?`${f.name} (recommended)`:f.name,value:f.id,description:`${f.provider} - ${r.tier} tier`});}let u=o.high.filter(f=>!s.includes(f)),y=o.medium.filter(f=>!s.includes(f)),v=o.low.filter(f=>!s.includes(f));for(let f of u)l.push({title:f.name,value:f.id,description:`${f.provider} - high tier`});for(let f of y)l.push({title:f.name,value:f.id,description:`${f.provider} - medium tier`});for(let f of v)l.push({title:f.name,value:f.id,description:`${f.provider} - low tier`});return l};for(let t of ["architect","builder","tester","reviewer","security"]){let r=a$1[t],s=t.charAt(0).toUpperCase()+t.slice(1),l=a$2(t),u=await E({type:"select",name:"model",message:`${s} (${r.description})`,choices:l,initial:0},{onCancel:()=>{console.log(e$1.yellow(`
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {c,b as b$1}from'./chunk-3KVVC4WV.js';import {z as z$1,i,c as c$1,f,j}from'./chunk-
|
|
2
|
+
import {c,b as b$1}from'./chunk-3KVVC4WV.js';import {z as z$1,i,c as c$1,f,j}from'./chunk-KAFQA7HV.js';import {g as g$1,f as f$1}from'./chunk-QGZRM6ZB.js';import {h,g as g$2}from'./chunk-K7X3Z3GL.js';import {b,a,d as d$1}from'./chunk-5TAVYPOV.js';import*as d from'fs';import*as g from'path';import*as W from'js-yaml';import*as T from'os';function Y(e){return g.join(e,G,at)}function ct(){let e=Date.now(),t=Math.floor(Math.random()*9999).toString().padStart(4,"0");return `ev-${e}-${t}`}function E(e,t){let n={id:ct(),timestamp:new Date().toISOString(),...t};_.push(n),_.length>v&&(_=_.slice(-v));try{let r=g.join(e,G);d.mkdirSync(r,{recursive:!0});let o=Y(e);d.appendFileSync(o,JSON.stringify(n)+`
|
|
3
3
|
`,"utf8"),lt(o);}catch{}return n}function lt(e){try{if(d.statSync(e).size>512*1024){let r=d.readFileSync(e,"utf8").trim().split(`
|
|
4
4
|
`);if(r.length>v){let o=r.slice(-v);d.writeFileSync(e,o.join(`
|
|
5
5
|
`)+`
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import*as e from'fs';import*as
|
|
2
|
+
import*as e from'fs';import*as a from'path';import*as S from'os';import {execSync}from'child_process';import o from'chalk';var y=`#!/bin/sh
|
|
3
3
|
# paradigm-common.sh \u2014 Shared compliance checks for Paradigm stop hooks
|
|
4
4
|
# Sourced by claude-code-stop.sh and cursor-stop.sh
|
|
5
5
|
#
|
|
@@ -32,6 +32,7 @@ import*as e from'fs';import*as r from'path';import*as S from'os';import {execSyn
|
|
|
32
32
|
# 11. Portal gate implementation compliance (from unified compliance-check)
|
|
33
33
|
# 12. Graduation failure tracking (auto-demotion)
|
|
34
34
|
# 13. Orchestration required for complex tasks
|
|
35
|
+
# 14. Active remediations from agent-authored .paradigm/remediations/ (v6.1)
|
|
35
36
|
|
|
36
37
|
VIOLATIONS=""
|
|
37
38
|
VIOLATION_COUNT=0
|
|
@@ -68,6 +69,31 @@ if [ -n "$ENFORCEMENT_MAP" ]; then
|
|
|
68
69
|
[ -n "$_ot" ] && ORCH_THRESHOLD="$_ot"
|
|
69
70
|
fi
|
|
70
71
|
|
|
72
|
+
# --- Detect compliance archetype on roster (v6.0.4) ---
|
|
73
|
+
# Sets HAS_COMPLIANCE_CLAIMANT=true iff .paradigm/roster.yaml has 'compliance'
|
|
74
|
+
# under its 'active:' list (block- or inline-array form). Falls back to false on
|
|
75
|
+
# missing/unparseable. Wave 1: helper only \u2014 no callers yet (Wave 2 wires Check
|
|
76
|
+
# 6 and Check 10 to consume this gate).
|
|
77
|
+
HAS_COMPLIANCE_CLAIMANT=false
|
|
78
|
+
_ROSTER_FILE=".paradigm/roster.yaml"
|
|
79
|
+
if [ -f "$_ROSTER_FILE" ]; then
|
|
80
|
+
# Extract the 'active:' section: from 'active:' line until the next non-indented
|
|
81
|
+
# top-level key, then look for 'compliance' as a list item or array entry.
|
|
82
|
+
_ACTIVE_BLOCK=$(awk '/^active:/{flag=1; print; next} /^[A-Za-z]/{flag=0} flag' "$_ROSTER_FILE" 2>/dev/null)
|
|
83
|
+
if echo "$_ACTIVE_BLOCK" | grep -Eq '(^[[:space:]]*-[[:space:]]*compliance[[:space:]]*$|[[\\,[:space:]]compliance[\\],[:space:]])'; then
|
|
84
|
+
HAS_COMPLIANCE_CLAIMANT=true
|
|
85
|
+
fi
|
|
86
|
+
fi
|
|
87
|
+
|
|
88
|
+
# --- Cache active remediations JSON (v6.1, consumed by Check 14) ---
|
|
89
|
+
# Single shell-out per stop-hook run. Helper outputs \`[]\` on every error path
|
|
90
|
+
# (missing dir, parse failure, missing binary) so this never breaks the hook.
|
|
91
|
+
_REMEDIATIONS_JSON="[]"
|
|
92
|
+
if command -v paradigm >/dev/null 2>&1; then
|
|
93
|
+
_REMEDIATIONS_JSON=$(paradigm internal active-remediations --json 2>/dev/null) || _REMEDIATIONS_JSON="[]"
|
|
94
|
+
[ -z "$_REMEDIATIONS_JSON" ] && _REMEDIATIONS_JSON="[]"
|
|
95
|
+
fi
|
|
96
|
+
|
|
71
97
|
# --- Cache .purpose file paths (avoid repeated find scans) ---
|
|
72
98
|
PURPOSE_CACHE=".paradigm/.purpose-paths"
|
|
73
99
|
if [ -f "$PURPOSE_CACHE" ]; then
|
|
@@ -428,7 +454,10 @@ if [ "$_SEV" != "off" ]; then
|
|
|
428
454
|
esac
|
|
429
455
|
done
|
|
430
456
|
|
|
431
|
-
|
|
457
|
+
# v6.0.4: emit only when a compliance archetype is rostered (Rune owns aspect
|
|
458
|
+
# advisories). Detection above runs unconditionally for data-continuity
|
|
459
|
+
# symmetry with Check 10; only the user-facing emission is gated.
|
|
460
|
+
if [ "$ASPECT_UPDATED" = false ] && [ "$HAS_COMPLIANCE_CLAIMANT" = "true" ]; then
|
|
432
461
|
ADVISORY=" This project defines ~aspects with code anchors. Check if existing
|
|
433
462
|
~aspects need updated anchors or applies-to patterns."
|
|
434
463
|
fi
|
|
@@ -573,7 +602,13 @@ if [ -n "$COMPLIANCE_RESULT" ]; then
|
|
|
573
602
|
echo "[paradigm] Auto-healed $HEALED_COUNT shifted anchor(s)." >&2
|
|
574
603
|
fi
|
|
575
604
|
|
|
576
|
-
|
|
605
|
+
# v6.0.4: drift emission gated on compliance archetype being rostered (Rune
|
|
606
|
+
# owns aspect-drift policy). DRIFTED_COUNT compute above stays unconditional
|
|
607
|
+
# so it still flows to compliance-history.jsonl for Loid's data continuity.
|
|
608
|
+
# NOTE: gate placement matters \u2014 invocation (lines ~538-547) and the
|
|
609
|
+
# v5.37.12 fail-closed audit fix (lines ~549-563) MUST stay outside this
|
|
610
|
+
# guard. Only the user-facing emission is gated.
|
|
611
|
+
if [ "$HAS_COMPLIANCE_CLAIMANT" = "true" ] && [ "$_SEV" != "off" ] && [ -n "$DRIFTED_COUNT" ] && [ "$DRIFTED_COUNT" -gt 0 ] 2>/dev/null; then
|
|
577
612
|
if [ "$_SEV" = "block" ]; then
|
|
578
613
|
VIOLATIONS="$VIOLATIONS
|
|
579
614
|
- $DRIFTED_COUNT aspect anchor(s) have drifted (content genuinely changed).
|
|
@@ -871,6 +906,59 @@ if [ "$_SEV" != "off" ]; then
|
|
|
871
906
|
fi
|
|
872
907
|
fi
|
|
873
908
|
|
|
909
|
+
# --- Check 14: Active remediations (v6.1 soft-block primitive) ---
|
|
910
|
+
# Iterates the cached _REMEDIATIONS_JSON array. severity=guard adds to
|
|
911
|
+
# VIOLATIONS (block); advise|auto-author goes to ADVISORY. PARADIGM_OVERRIDE
|
|
912
|
+
# (comma-separated id list) skips matching remediations and writes an
|
|
913
|
+
# override audit row to .paradigm/events/overrides.jsonl.
|
|
914
|
+
#
|
|
915
|
+
# Iteration uses a temp file + redirect (NOT pipe) so VIOLATION_COUNT
|
|
916
|
+
# increments propagate out of the loop (POSIX subshell-safe \u2014 spec \xA712 #4).
|
|
917
|
+
if [ "$_REMEDIATIONS_JSON" != "[]" ] && [ -n "$_REMEDIATIONS_JSON" ]; then
|
|
918
|
+
_RMD_TMP="/tmp/.paradigm-rmds-$$"
|
|
919
|
+
# Split JSON array into one record per line: strip outer brackets, split on \`},{\`.
|
|
920
|
+
echo "$_REMEDIATIONS_JSON" | sed 's/^\\[//; s/\\]$//; s/},{/}\\n{/g' > "$_RMD_TMP"
|
|
921
|
+
_OVERRIDE_LIST=",\${PARADIGM_OVERRIDE:-},"
|
|
922
|
+
while IFS= read -r _line; do
|
|
923
|
+
[ -z "$_line" ] && continue
|
|
924
|
+
case "$_line" in
|
|
925
|
+
*'"id":"'*) ;;
|
|
926
|
+
*) continue ;;
|
|
927
|
+
esac
|
|
928
|
+
_RID=$(echo "$_line" | grep -o '"id":"[^"]*"' | head -1 | sed 's/^"id":"//; s/"$//')
|
|
929
|
+
_RSEV=$(echo "$_line" | grep -o '"severity":"[^"]*"' | head -1 | sed 's/^"severity":"//; s/"$//')
|
|
930
|
+
_RCLAIM=$(echo "$_line" | grep -o '"claimant":"[^"]*"' | head -1 | sed 's/^"claimant":"//; s/"$//')
|
|
931
|
+
_RREASON=$(echo "$_line" | grep -o '"reason":"[^"]*"' | head -1 | sed 's/^"reason":"//; s/"$//')
|
|
932
|
+
[ -z "$_RID" ] && continue
|
|
933
|
+
|
|
934
|
+
# PARADIGM_OVERRIDE check \u2014 comma-separated list, exact id match.
|
|
935
|
+
case "$_OVERRIDE_LIST" in
|
|
936
|
+
*",$_RID,"*)
|
|
937
|
+
# Write override audit event (mirror compliance-snapshot pattern, line 906).
|
|
938
|
+
_ts=$(date -u +"%Y-%m-%dT%H:%M:%SZ" 2>/dev/null || date +"%Y-%m-%dT%H:%M:%SZ")
|
|
939
|
+
mkdir -p ".paradigm/events" 2>/dev/null || true
|
|
940
|
+
printf '{"timestamp":"%s","remediation_id":"%s","claimant":"%s","mechanism":"env","unblock_predicate_matched":false}\\n' \\
|
|
941
|
+
"$_ts" "$_RID" "$_RCLAIM" >> ".paradigm/events/overrides.jsonl" 2>/dev/null || true
|
|
942
|
+
continue
|
|
943
|
+
;;
|
|
944
|
+
esac
|
|
945
|
+
|
|
946
|
+
case "$_RSEV" in
|
|
947
|
+
guard)
|
|
948
|
+
VIOLATIONS="$VIOLATIONS
|
|
949
|
+
- [$_RID] ($_RCLAIM) $_RREASON
|
|
950
|
+
Override: paradigm override $_RID (or PARADIGM_OVERRIDE=$_RID <cmd>)"
|
|
951
|
+
VIOLATION_COUNT=$((VIOLATION_COUNT + 1))
|
|
952
|
+
;;
|
|
953
|
+
advise|auto-author)
|
|
954
|
+
ADVISORY="$ADVISORY
|
|
955
|
+
- (remediation:$_RSEV) [$_RID] ($_RCLAIM) $_RREASON"
|
|
956
|
+
;;
|
|
957
|
+
esac
|
|
958
|
+
done < "$_RMD_TMP"
|
|
959
|
+
rm -f "$_RMD_TMP"
|
|
960
|
+
fi
|
|
961
|
+
|
|
874
962
|
# --- Compliance snapshot (non-fatal, fire-and-forget) ---
|
|
875
963
|
# Record this stop-hook run to .paradigm/events/compliance-history.jsonl for trend analysis.
|
|
876
964
|
# VIOLATION_COUNT and SOURCE_COUNT are now final at this point.
|
|
@@ -884,7 +972,7 @@ _compliance_snapshot() {
|
|
|
884
972
|
"$_ts" "$VIOLATION_COUNT" "$_checks" >> "$_dir/compliance-history.jsonl" 2>/dev/null || true
|
|
885
973
|
}
|
|
886
974
|
_compliance_snapshot
|
|
887
|
-
`,
|
|
975
|
+
`,v=`#!/bin/sh
|
|
888
976
|
# Paradigm Claude Code Stop Hook (v2)
|
|
889
977
|
# Validates paradigm compliance before allowing the agent to finish.
|
|
890
978
|
# Installed by: paradigm hooks install --claude-code
|
|
@@ -1005,7 +1093,7 @@ exit 0
|
|
|
1005
1093
|
# Legacy afterFileEdit hook \u2014 replaced by paradigm-posttooluse.sh (postToolUse)
|
|
1006
1094
|
# Kept as a no-op because Claude Code expects the file to exist.
|
|
1007
1095
|
exit 0
|
|
1008
|
-
`,
|
|
1096
|
+
`,U=`#!/bin/sh
|
|
1009
1097
|
# Paradigm Claude Code Pre-Commit Hook
|
|
1010
1098
|
# Intercepts git commit Bash calls and auto-rebuilds the index.
|
|
1011
1099
|
# Installed by: paradigm hooks install --claude-code
|
|
@@ -1128,7 +1216,7 @@ echo " Scan index: $SCAN_INDEX" >&2
|
|
|
1128
1216
|
echo " Navigator: $CWD/.paradigm/navigator.yaml" >&2
|
|
1129
1217
|
|
|
1130
1218
|
exit 0
|
|
1131
|
-
`,
|
|
1219
|
+
`,L=`#!/bin/sh
|
|
1132
1220
|
# Paradigm Cursor Session Start Hook
|
|
1133
1221
|
# Fires before the agent does anything \u2014 injects additional_context
|
|
1134
1222
|
# that acts as a deterministic system prompt (not subject to context compaction).
|
|
@@ -1228,7 +1316,7 @@ fi
|
|
|
1228
1316
|
printf '{"additional_context":"%s","continue":true}\\n' "$CONTEXT"
|
|
1229
1317
|
|
|
1230
1318
|
exit 0
|
|
1231
|
-
`,
|
|
1319
|
+
`,b=`#!/bin/sh
|
|
1232
1320
|
# Paradigm Cursor Stop Hook (v2)
|
|
1233
1321
|
# Validates paradigm compliance before allowing the agent to finish.
|
|
1234
1322
|
# Installed by: paradigm hooks install --cursor
|
|
@@ -1680,8 +1768,8 @@ if [ "$PENDING_COUNT" -ge 30 ]; then
|
|
|
1680
1768
|
fi
|
|
1681
1769
|
|
|
1682
1770
|
exit 0
|
|
1683
|
-
`;function F(){try{let i=
|
|
1684
|
-
`,"utf8"),h.push("settings.json hooks"));}}catch{}return {cleaned:h.length>0,removed:h}}function K(i,h){try{let c=
|
|
1771
|
+
`;function F(){try{let i=a.join(S.homedir(),".claude","settings.json");if(!e.existsSync(i))return {active:!1};if(!JSON.parse(e.readFileSync(i,"utf8")).enabledPlugins?.["paradigm@a-paradigm"])return {active:!1};let d=a.join(S.homedir(),".claude","plugins","cache","a-paradigm","paradigm");if(!e.existsSync(d))return {active:!1};let r=e.readdirSync(d).filter(t=>e.statSync(a.join(d,t)).isDirectory()).sort().reverse();if(r.length===0)return {active:!1};let p=a.join(d,r[0]),l=a.join(p,"hooks","hooks.json");return e.existsSync(l)?{active:!0,cacheVersion:r[0]}:{active:!1}}catch{return {active:false}}}function W(){try{let i=F();if(!i.active||!i.cacheVersion)return {compatible:!0};let h=a.join(S.homedir(),".claude","plugins","cache","a-paradigm","paradigm",i.cacheVersion,"hooks.json");if(!e.existsSync(h))return {compatible:!0};let d=JSON.parse(e.readFileSync(h,"utf8")).compatibleVersions;if(!d)return {compatible:!0};let r=J();if(!r)return {compatible:!0};let p=d.split(/\s+/);for(let l of p){let t=l.match(/^(>=?|<=?)\s*(\d+\.\d+\.\d+)/);if(!t)continue;let[,s,n]=t,f=q(r,n);if(s===">="&&f<0)return {compatible:!1,message:`Plugin requires paradigm ${d}, current: ${r}`};if(s===">"&&f<=0)return {compatible:!1,message:`Plugin requires paradigm ${d}, current: ${r}`};if(s==="<="&&f>0)return {compatible:!1,message:`Plugin requires paradigm ${d}, current: ${r}`};if(s==="<"&&f>=0)return {compatible:!1,message:`Plugin requires paradigm ${d}, current: ${r}`}}return {compatible:!0}}catch{return {compatible:true}}}function J(){try{let i=a.join(a.dirname(new URL(import.meta.url).pathname),"..","..","package.json");return JSON.parse(e.readFileSync(i,"utf8")).version||null}catch{return null}}function q(i,h){let c=i.split(".").map(Number),d=h.split(".").map(Number);for(let r=0;r<3;r++){if((c[r]||0)<(d[r]||0))return -1;if((c[r]||0)>(d[r]||0))return 1}return 0}function B(i){let h=[],c=a.join(i,".claude","hooks");if(e.existsSync(c)){for(let r of ["paradigm-common.sh","paradigm-stop.sh","paradigm-precommit.sh","paradigm-postwrite.sh","paradigm-navigate-remind.sh"]){let p=a.join(c,r);e.existsSync(p)&&(e.unlinkSync(p),h.push(r));}try{e.readdirSync(c).length===0&&e.rmdirSync(c);}catch{}}let d=a.join(i,".claude","settings.json");if(e.existsSync(d))try{let r=JSON.parse(e.readFileSync(d,"utf8")),p=r.hooks;if(p){let l=!1;for(let[t,s]of Object.entries(p)){if(!Array.isArray(s))continue;let n=s.filter(f=>!JSON.stringify(f).includes("paradigm-"));n.length!==s.length&&(l=!0,n.length===0?delete p[t]:p[t]=n);}l&&(Object.keys(p).length===0?delete r.hooks:r.hooks=p,e.writeFileSync(d,JSON.stringify(r,null,2)+`
|
|
1772
|
+
`,"utf8"),h.push("settings.json hooks"));}}catch{}return {cleaned:h.length>0,removed:h}}function K(i,h){try{let c=a.join(S.tmpdir(),`paradigm-hook-validate-${Date.now()}.sh`);e.writeFileSync(c,i,"utf8");try{return execSync(`bash -n "${c}" 2>&1`,{encoding:"utf-8"}),null}catch(d){return `${h}: bash syntax error \u2014 ${d.message?.split(`
|
|
1685
1773
|
`)[0]||"unknown error"}`}finally{try{e.unlinkSync(c);}catch{}}}catch{return null}}var G=`#!/bin/sh
|
|
1686
1774
|
# Paradigm post-commit hook - captures history from commits
|
|
1687
1775
|
# Installed by: paradigm hooks install
|
|
@@ -1774,25 +1862,25 @@ if [ -d ".paradigm/history" ] && [ -f ".paradigm/history/log.jsonl" ]; then
|
|
|
1774
1862
|
echo "[paradigm] Reindexing history..."
|
|
1775
1863
|
npx paradigm history reindex 2>/dev/null || true
|
|
1776
1864
|
fi
|
|
1777
|
-
`;async function
|
|
1865
|
+
`;async function ae(i={}){let h=process.cwd(),c=i.dryRun||false;c&&console.log(o.cyan(`
|
|
1778
1866
|
[dry-run] Showing what would be installed:
|
|
1779
|
-
`));let d=i.claudeCode&&!i.postCommit&&!i.prePush&&!i.cursor,
|
|
1867
|
+
`));let d=i.claudeCode&&!i.postCommit&&!i.prePush&&!i.cursor,r=i.cursor&&!i.postCommit&&!i.prePush&&!i.claudeCode;if(!c){let t=[{name:"post-commit",content:G},{name:"pre-push",content:Y},{name:"paradigm-common",content:y},{name:"claude-code-stop",content:v},{name:"claude-code-precommit",content:U},{name:"claude-code-postwrite",content:D},{name:"claude-code-navigate-remind",content:P},{name:"cursor-session-start",content:L},{name:"cursor-stop",content:b},{name:"cursor-precommit",content:x},{name:"cursor-postwrite",content:w},{name:"cursor-pretooluse",content:M},{name:"cursor-posttooluse",content:V}];for(let s of t){let n=K(s.content,s.name);if(n){console.log(o.red(`Hook syntax error: ${n}`)),console.log(o.gray("Aborting installation. Fix the hook script and try again."));return}}}let p=W();if(p.compatible||(console.log(o.yellow(`
|
|
1780
1868
|
\u26A0 ${p.message}`)),console.log(o.gray(` Hook installation will continue, but behavior may differ from plugin expectations.
|
|
1781
|
-
`))),!d&&!
|
|
1869
|
+
`))),!d&&!r){let t=a.join(h,".git");if(!e.existsSync(t)){console.log(o.red("Not a git repository."));return}let s=a.join(t,"hooks"),n=!i.postCommit&&!i.prePush&&!i.claudeCode,f=[];if(n||i.postCommit){let m=a.join(s,"post-commit");if(c){let _=e.existsSync(m)&&!i.force?"skip (exists)":"install";console.log(o.gray(` post-commit: ${_} \u2192 ${m}`));}else e.existsSync(m)&&!i.force?e.readFileSync(m,"utf8").includes("paradigm")?console.log(o.gray("post-commit hook already installed by paradigm")):console.log(o.yellow("post-commit hook exists. Use --force to overwrite.")):(e.mkdirSync(s,{recursive:true}),e.writeFileSync(m,G),e.chmodSync(m,"755"),f.push("post-commit"));}if(n||i.prePush){let m=a.join(s,"pre-push");if(c){let _=e.existsSync(m)&&!i.force?"skip (exists)":"install";console.log(o.gray(` pre-push: ${_} \u2192 ${m}`));}else e.existsSync(m)&&!i.force?e.readFileSync(m,"utf8").includes("paradigm")?console.log(o.gray("pre-push hook already installed by paradigm")):console.log(o.yellow("pre-push hook exists. Use --force to overwrite.")):(e.mkdirSync(s,{recursive:true}),e.writeFileSync(m,Y),e.chmodSync(m,"755"),f.push("pre-push"));}!c&&f.length>0&&console.log(o.green(`Git hooks installed: ${f.join(", ")}`));let O=a.join(h,".paradigm/history");!e.existsSync(O)&&!c&&console.log(o.gray("Tip: Run `paradigm history init` to initialize history tracking"));}let l=!i.postCommit&&!i.prePush&&!i.claudeCode&&!i.cursor;(l||i.claudeCode)&&(c?(console.log(o.gray(" Claude Code hooks: would install paradigm-stop.sh, paradigm-precommit.sh, paradigm-postwrite.sh, paradigm-navigate-remind.sh")),console.log(o.gray(` \u2192 ${a.join(h,".claude","hooks")}/`)),console.log(o.gray(" \u2192 Update .claude/settings.json with hook configuration"))):await z(h,i.force)),(l||i.cursor)&&(c?(console.log(o.gray(" Cursor hooks: would install paradigm-session-start.sh, paradigm-stop.sh, paradigm-precommit.sh, paradigm-postwrite.sh, paradigm-pretooluse.sh, paradigm-posttooluse.sh")),console.log(o.gray(` \u2192 ${a.join(h,".cursor","hooks")}/`)),console.log(o.gray(" \u2192 Update .cursor/hooks.json"))):await Q(h,i.force)),c&&console.log(o.cyan(`
|
|
1782
1870
|
[dry-run] No changes made.
|
|
1783
|
-
`));}async function z(i,h){let c=F();if(c.active){console.log(o.cyan(` Paradigm plugin v${c.cacheVersion} is active \u2014 hooks are managed by the plugin.`));let{cleaned:g,removed:E}=B(i);console.log(g?o.green(` Cleaned up stale project hooks: ${E.join(", ")}`):o.gray(" No stale project hooks to clean up.")),console.log(o.gray(" Plugin hooks auto-update with each session \u2014 no manual install needed."));return}let d=
|
|
1784
|
-
`,"utf8"),
|
|
1785
|
-
`,"utf8"),d.length>0&&console.log(o.green(`Cursor hooks installed: ${d.join(", ")}`)),console.log(o.green("Cursor hooks.json updated with hook configuration"));}async function
|
|
1871
|
+
`));}async function z(i,h){let c=F();if(c.active){console.log(o.cyan(` Paradigm plugin v${c.cacheVersion} is active \u2014 hooks are managed by the plugin.`));let{cleaned:g,removed:E}=B(i);console.log(g?o.green(` Cleaned up stale project hooks: ${E.join(", ")}`):o.gray(" No stale project hooks to clean up.")),console.log(o.gray(" Plugin hooks auto-update with each session \u2014 no manual install needed."));return}let d=a.join(i,".claude","hooks");e.mkdirSync(d,{recursive:true});let r=[],p=a.join(d,"paradigm-common.sh");e.writeFileSync(p,y,"utf8"),e.chmodSync(p,"755");let l=[{name:"paradigm-stop.sh",content:v},{name:"paradigm-precommit.sh",content:U},{name:"paradigm-postwrite.sh",content:D},{name:"paradigm-navigate-remind.sh",content:P}];for(let g of l){let E=a.join(d,g.name);if(e.existsSync(E)&&!h){console.log(o.gray(` ${g.name}: already installed`));continue}e.writeFileSync(E,g.content,"utf8"),e.chmodSync(E,"755"),r.push(g.name);}let t=a.join(i,".claude","settings.json"),s={};if(e.existsSync(t))try{s=JSON.parse(e.readFileSync(t,"utf8"));}catch{}let n=s.hooks||{},f={hooks:[{type:"command",command:'bash "$CLAUDE_PROJECT_DIR/.claude/hooks/paradigm-stop.sh"',timeout:10}]},O={matcher:"Bash",hooks:[{type:"command",command:'bash "$CLAUDE_PROJECT_DIR/.claude/hooks/paradigm-precommit.sh"',timeout:30}]},m=n.Stop||[];m.some(g=>JSON.stringify(g).includes("paradigm-stop.sh"))||m.push(f),n.Stop=m;let $=n.PreToolUse||[];$.some(g=>JSON.stringify(g).includes("paradigm-precommit.sh"))||$.push(O),n.PreToolUse=$;let H={matcher:"Glob|Grep",hooks:[{type:"command",command:'bash "$CLAUDE_PROJECT_DIR/.claude/hooks/paradigm-navigate-remind.sh"',timeout:5}]};$.some(g=>JSON.stringify(g).includes("paradigm-navigate-remind.sh"))||$.push(H),n.PreToolUse=$;let j={matcher:"Edit,Write",hooks:[{type:"command",command:'bash "$CLAUDE_PROJECT_DIR/.claude/hooks/paradigm-postwrite.sh"',timeout:5}]},T=n.PostToolUse||[];T.some(g=>JSON.stringify(g).includes("paradigm-postwrite.sh"))||T.push(j),n.PostToolUse=T,s.hooks=n,e.writeFileSync(t,JSON.stringify(s,null,2)+`
|
|
1872
|
+
`,"utf8"),r.length>0&&console.log(o.green(`Claude Code hooks installed: ${r.join(", ")}`)),console.log(o.green("Claude Code settings.json updated with hook configuration"));}async function Q(i,h){let c=a.join(i,".cursor","hooks");e.mkdirSync(c,{recursive:true});let d=[],r=a.join(c,"paradigm-common.sh");e.writeFileSync(r,y,"utf8"),e.chmodSync(r,"755");let p=[{name:"paradigm-session-start.sh",content:L},{name:"paradigm-stop.sh",content:b},{name:"paradigm-precommit.sh",content:x},{name:"paradigm-postwrite.sh",content:w},{name:"paradigm-pretooluse.sh",content:M},{name:"paradigm-posttooluse.sh",content:V}];for(let u of p){let R=a.join(c,u.name);if(e.existsSync(R)&&!h){console.log(o.gray(` ${u.name}: already installed (Cursor)`));continue}e.writeFileSync(R,u.content,"utf8"),e.chmodSync(R,"755"),d.push(u.name);}let l=a.join(i,".cursor","hooks.json"),t={};if(e.existsSync(l))try{t=JSON.parse(e.readFileSync(l,"utf8"));}catch{}t.version=1;let s=t.hooks||{},n={command:".cursor/hooks/paradigm-session-start.sh",timeout:5},f={command:".cursor/hooks/paradigm-stop.sh",timeout:10,loop_limit:3},O={command:".cursor/hooks/paradigm-postwrite.sh",timeout:5},m={command:".cursor/hooks/paradigm-precommit.sh",matcher:"git commit",timeout:30},_=s.sessionStart||[];_.some(u=>JSON.stringify(u).includes("paradigm-session-start.sh"))||_.push(n),s.sessionStart=_;let I=s.stop||[];I.some(u=>JSON.stringify(u).includes("paradigm-stop.sh"))||I.push(f),s.stop=I;let N=s.afterFileEdit||[];N.some(u=>JSON.stringify(u).includes("paradigm-postwrite.sh"))||N.push(O),s.afterFileEdit=N;let T={command:".cursor/hooks/paradigm-pretooluse.sh",matcher:"Edit|Write",timeout:5},C=s.preToolUse||[];C.some(u=>JSON.stringify(u).includes("paradigm-pretooluse.sh"))||C.push(T),s.preToolUse=C;let E={command:".cursor/hooks/paradigm-posttooluse.sh",matcher:"Edit|Write",timeout:5},k=s.postToolUse||[];k.some(u=>JSON.stringify(u).includes("paradigm-posttooluse.sh"))||k.push(E),s.postToolUse=k;let A=s.beforeShellExecution||[];A.some(u=>JSON.stringify(u).includes("paradigm-precommit.sh"))||A.push(m),s.beforeShellExecution=A,t.hooks=s,e.writeFileSync(l,JSON.stringify(t,null,2)+`
|
|
1873
|
+
`,"utf8"),d.length>0&&console.log(o.green(`Cursor hooks installed: ${d.join(", ")}`)),console.log(o.green("Cursor hooks.json updated with hook configuration"));}async function re(i={}){let h=process.cwd(),c=i.dryRun||false;if(c&&console.log(o.cyan(`
|
|
1786
1874
|
[dry-run] Showing what would be removed:
|
|
1787
|
-
`)),!i.cursor){let d=
|
|
1788
|
-
`,"utf8");}catch{}c?
|
|
1875
|
+
`)),!i.cursor){let d=a.join(h,".git");if(!e.existsSync(d)){console.log(o.red("Not a git repository."));return}let r=a.join(d,"hooks"),p=[];for(let l of ["post-commit","pre-push"]){let t=a.join(r,l);e.existsSync(t)&&e.readFileSync(t,"utf8").includes("paradigm")&&(c?console.log(o.gray(` Would remove: ${t}`)):e.unlinkSync(t),p.push(l));}c?p.length===0&&console.log(o.gray(" No paradigm git hooks to remove")):p.length>0?console.log(o.green(`Git hooks removed: ${p.join(", ")}`)):console.log(o.gray("No paradigm git hooks found to remove"));}if(i.cursor){let d=a.join(h,".cursor","hooks"),r=[];for(let l of ["paradigm-session-start.sh","paradigm-stop.sh","paradigm-precommit.sh","paradigm-postwrite.sh","paradigm-pretooluse.sh","paradigm-posttooluse.sh"]){let t=a.join(d,l);e.existsSync(t)&&(c?console.log(o.gray(` Would remove: ${t}`)):e.unlinkSync(t),r.push(l));}let p=a.join(h,".cursor","hooks.json");if(e.existsSync(p))if(c)console.log(o.gray(` Would clean paradigm entries from: ${p}`));else try{let l=JSON.parse(e.readFileSync(p,"utf8")),t=l.hooks||{};for(let s of ["sessionStart","stop","afterFileEdit","beforeShellExecution","preToolUse","postToolUse"])Array.isArray(t[s])&&(t[s]=t[s].filter(n=>!JSON.stringify(n).includes("paradigm-")),t[s].length===0&&delete t[s]);l.hooks=t,e.writeFileSync(p,JSON.stringify(l,null,2)+`
|
|
1876
|
+
`,"utf8");}catch{}c?r.length===0&&console.log(o.gray(" No paradigm Cursor hooks to remove")):r.length>0?console.log(o.green(`Cursor hooks removed: ${r.join(", ")}`)):console.log(o.gray("No paradigm Cursor hooks found to remove"));}c&&console.log(o.cyan(`
|
|
1789
1877
|
[dry-run] No changes made.
|
|
1790
|
-
`));}async function ne(){let i=process.cwd(),h=
|
|
1878
|
+
`));}async function ne(){let i=process.cwd(),h=a.join(i,".git");if(e.existsSync(h)){console.log(o.magenta(`
|
|
1791
1879
|
Git Hooks Status
|
|
1792
|
-
`));let l=
|
|
1793
|
-
`).filter(
|
|
1880
|
+
`));let l=a.join(h,"hooks"),t=["post-commit","pre-push"];for(let n of t){let f=a.join(l,n);e.existsSync(f)?e.readFileSync(f,"utf8").includes("paradigm")?console.log(o.green(` ${n}: installed (paradigm)`)):console.log(o.yellow(` ${n}: exists (other)`)):console.log(o.gray(` ${n}: not installed`));}console.log();let s=a.join(i,".paradigm/history");if(e.existsSync(s)){let n=a.join(s,"log.jsonl");if(e.existsSync(n)){let O=e.readFileSync(n,"utf8").split(`
|
|
1881
|
+
`).filter(m=>m.trim()).length;console.log(o.white(` History entries: ${O}`));}}else console.log(o.gray(" History: not initialized")),console.log(o.gray(" Run `paradigm history init` to enable"));}else console.log(o.gray(`
|
|
1794
1882
|
Not a git repository (git hooks N/A)
|
|
1795
1883
|
`));console.log(o.magenta(` Claude Code Hooks Status
|
|
1796
|
-
`));let c=F();if(c.active){console.log(o.cyan(` Plugin: paradigm v${c.cacheVersion} (active)`)),console.log(o.green(" Hooks are managed by the plugin \u2014 auto-updates with each session."));let l=
|
|
1884
|
+
`));let c=F();if(c.active){console.log(o.cyan(` Plugin: paradigm v${c.cacheVersion} (active)`)),console.log(o.green(" Hooks are managed by the plugin \u2014 auto-updates with each session."));let l=a.join(i,".claude","hooks"),t=[];for(let f of ["paradigm-common.sh","paradigm-stop.sh","paradigm-precommit.sh","paradigm-postwrite.sh","paradigm-navigate-remind.sh"])e.existsSync(a.join(l,f))&&t.push(f);let s=a.join(i,".claude","settings.json"),n=false;if(e.existsSync(s))try{let f=JSON.parse(e.readFileSync(s,"utf8"));n=JSON.stringify(f.hooks||{}).includes("paradigm-");}catch{}(t.length>0||n)&&(console.log(o.yellow(` WARNING: Stale project hooks detected (${t.join(", ")}${n?", settings.json entries":""})`)),console.log(o.yellow(" These shadow the plugin hooks and may run outdated logic.")),console.log(o.gray(" Run `paradigm hooks install --claude-code` to clean them up.")));}else {console.log(o.gray(" Plugin: not active (using project-level hooks)"));let l=a.join(i,".claude","hooks"),t=["paradigm-stop.sh","paradigm-precommit.sh","paradigm-postwrite.sh","paradigm-navigate-remind.sh"];for(let n of t){let f=a.join(l,n);e.existsSync(f)?console.log(o.green(` ${n}: installed`)):console.log(o.gray(` ${n}: not installed`));}let s=a.join(i,".claude","settings.json");if(e.existsSync(s))try{let f=JSON.parse(e.readFileSync(s,"utf8")).hooks||{},O=JSON.stringify(f.Stop||[]).includes("paradigm-stop.sh"),m=JSON.stringify(f.PreToolUse||[]).includes("paradigm-precommit.sh"),_=JSON.stringify(f.PostToolUse||[]).includes("paradigm-postwrite.sh");console.log(o.gray(` settings.json Stop hook: ${O?"configured":"missing"}`)),console.log(o.gray(` settings.json PreToolUse hook: ${m?"configured":"missing"}`)),console.log(o.gray(` settings.json PostToolUse hook: ${_?"configured":"missing"}`));}catch{console.log(o.yellow(" settings.json: parse error"));}else console.log(o.gray(" settings.json: not found"));}console.log(o.magenta(`
|
|
1797
1885
|
Cursor Hooks Status
|
|
1798
|
-
`));let d=
|
|
1886
|
+
`));let d=a.join(i,".cursor","hooks"),r=["paradigm-session-start.sh","paradigm-stop.sh","paradigm-precommit.sh","paradigm-postwrite.sh","paradigm-pretooluse.sh","paradigm-posttooluse.sh"];for(let l of r){let t=a.join(d,l);e.existsSync(t)?console.log(o.green(` ${l}: installed`)):console.log(o.gray(` ${l}: not installed`));}let p=a.join(i,".cursor","hooks.json");if(e.existsSync(p))try{let t=JSON.parse(e.readFileSync(p,"utf8")).hooks||{},s=JSON.stringify(t.sessionStart||[]).includes("paradigm-session-start.sh"),n=JSON.stringify(t.stop||[]).includes("paradigm-stop.sh"),f=JSON.stringify(t.afterFileEdit||[]).includes("paradigm-postwrite.sh"),O=JSON.stringify(t.beforeShellExecution||[]).includes("paradigm-precommit.sh"),m=JSON.stringify(t.preToolUse||[]).includes("paradigm-pretooluse.sh"),_=JSON.stringify(t.postToolUse||[]).includes("paradigm-posttooluse.sh");console.log(o.gray(` hooks.json sessionStart: ${s?"configured":"missing"}`)),console.log(o.gray(` hooks.json stop: ${n?"configured":"missing"}`)),console.log(o.gray(` hooks.json afterFileEdit: ${f?"configured":"missing"}`)),console.log(o.gray(` hooks.json preToolUse: ${m?"configured":"missing"}`)),console.log(o.gray(` hooks.json postToolUse: ${_?"configured":"missing"}`)),console.log(o.gray(` hooks.json beforeShellExecution: ${O?"configured":"missing"}`));}catch{console.log(o.yellow(" hooks.json: parse error"));}else console.log(o.gray(" hooks.json: not found"));console.log();}export{ae as a,re as b,ne as c};
|