@a-company/paradigm 5.21.2 → 5.23.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.
@@ -48,7 +48,7 @@ component_types:
48
48
  `),{status:"applied",message:"Added component_types glossary to config.yaml",filesModified:[".paradigm/config.yaml"]}):{status:"error",message:"Cannot read config.yaml"}}},ue={id:"add-discipline-config",introducedIn:"3.4.0",description:"Add discipline field to config.yaml",category:"config",auto:true,async check(e){let t=A(e);return t?D(t,"discipline")?{needed:false,reason:"discipline already set"}:{needed:true,reason:"Missing discipline field"}:{needed:false,reason:"No config.yaml found"}},async apply(e,t){if(t.dryRun)return {status:"skipped",message:"Would add discipline to config.yaml"};let n=I(e);if(!n)return {status:"error",message:"Cannot read config.yaml"};let i=n.replace(/^(project:\s*.+)$/m,`$1
49
49
  discipline: auto`);return i===n?x(e,n.trimEnd()+`
50
50
  discipline: auto
51
- `):x(e,i),{status:"applied",message:"Added discipline: auto to config.yaml",filesModified:[".paradigm/config.yaml"]}}},fe={id:"sync-templates",introducedIn:"evergreen",description:"Update specs/ and docs/ from installed CLI templates",category:"template",auto:true,async check(e){let t=$();if(!t)return {needed:false,reason:"Templates directory not found"};let n=[],i=["specs","docs","prompts"];for(let r of i){let a=p.join(t,r),d=p.join(e,".paradigm",r);if(o.existsSync(a))try{let g=o.readdirSync(a).filter(m=>o.statSync(p.join(a,m)).isFile());for(let m of g)o.existsSync(p.join(d,m))||n.push(`${r}/${m}`);}catch{}}return n.length===0?{needed:false,reason:"All templates are up to date"}:{needed:true,reason:`${n.length} new template file(s) available`,details:n.map(r=>`New: ${r}`)}},async apply(e,t){let n=$();if(!n)return {status:"error",message:"Templates directory not found"};let i=p.basename(e),r=[],a=["specs","docs","prompts"];for(let d of a){let g=p.join(n,d),m=p.join(e,".paradigm",d);if(o.existsSync(g)){t.dryRun||o.mkdirSync(m,{recursive:true});try{let S=o.readdirSync(g,{withFileTypes:!0});for(let k of S){if(k.isDirectory())continue;let M=p.join(m,k.name);if(!o.existsSync(M)){if(t.dryRun){r.push(`${d}/${k.name}`);continue}let c=o.readFileSync(p.join(g,k.name),"utf8");c=c.replace(/\{\{PROJECT_NAME\}\}/g,i),o.writeFileSync(M,c,"utf8"),r.push(`${d}/${k.name}`);}}}catch{}}}return t.dryRun?{status:"skipped",message:`Would copy ${r.length} template file(s)`}:r.length===0?{status:"skipped",message:"No new templates to sync"}:{status:"applied",message:`Synced ${r.length} template file(s)`,filesCreated:r.map(d=>`.paradigm/${d}`)}}},me={id:"refresh-hooks",introducedIn:"evergreen",description:"Reinstall hook scripts from plugin",category:"hook",auto:true,async check(e){let t=[p.join(e,".claude","hooks"),p.join(e,".cursor","hooks")];for(let i of t)if(o.existsSync(i))try{if(o.readdirSync(i).some(a=>a.includes("paradigm")))return {needed:!1,reason:"Hooks are installed"}}catch{}let n=p.join(e,".claude","settings.local.json");if(o.existsSync(n))try{if(JSON.parse(o.readFileSync(n,"utf8")).hooks)return {needed:!1,reason:"Plugin-managed hooks are configured"}}catch{}return {needed:true,reason:"No paradigm hooks found"}},async apply(e,t){if(t.dryRun)return {status:"skipped",message:"Would reinstall hooks"};try{let{hooksInstallCommand:n}=await import('./hooks-JQKA3TUG.js');return await n({force:!0}),{status:"applied",message:"Hooks reinstalled"}}catch(n){return {status:"error",message:`Hook install failed: ${n.message}`}}}},b=[Q,X,Z,ee,te,ne,se,ue,de,le,re,oe,ie,ae,ce,pe,ge,fe,me];var he=createRequire(import.meta.url),{version:W}=he("../package.json");function C(e){let t=p.join(e,".paradigm","migrate.yaml");if(!o.existsSync(t))return null;try{let n=o.readFileSync(t,"utf8");return F.load(n)}catch{return null}}async function V(e){let t=p.join(e,".paradigm"),n=C(e),i=n?.applied.map(l=>l.id)??[],r="unknown",a=p.join(t,"config.yaml");if(o.existsSync(a))try{let l=F.load(o.readFileSync(a,"utf8"));r=String(l.version??"unknown");}catch{}let g=["specs","docs","prompts","lore","tasks","protocols","personas"].filter(l=>!o.existsSync(p.join(t,l))),m=["discipline","tag-bank","purpose-required","component_types"],S=[];if(o.existsSync(a))try{let l=F.load(o.readFileSync(a,"utf8"));S=m.filter(h=>{let j=h.replace(/-/g,"_");return !(h in l)&&!(j in l)&&!(h.replace(/_/g,"-")in l)});}catch{}let k=[],M=$();if(M){let l=["specs","docs"];for(let h of l){let j=p.join(M,h),L=p.join(t,h);if(o.existsSync(j)&&o.existsSync(L)){let J=o.readdirSync(j).filter(R=>!o.statSync(p.join(j,R)).isDirectory());for(let R of J){let Y=p.join(L,R);o.existsSync(Y)||k.push(`${h}/${R}`);}}}}let c=!o.existsSync(p.join(e,".claude","hooks")),u=[];for(let l of b){let h=l.introducedIn==="evergreen";if(i.includes(l.id)&&!h)continue;(await l.check(e)).needed&&u.push(l);}return {configVersion:r,cliVersion:W,pendingMigrations:u,appliedIds:i,health:{missingDirectories:g,missingConfigFields:S,staleTemplates:k,hooksOutdated:c}}}async function U(e){let t=[],n=new Date().toISOString();for(let i of b){if(i.introducedIn==="evergreen")continue;(await i.check(e)).needed||t.push({id:i.id,appliedAt:n,cliVersion:W});}return t}function $(){let e=new URL(import.meta.url).pathname,t=p.dirname(e),n=[p.join(t,"..","..","..","templates","paradigm"),p.join(t,"..","..","templates","paradigm"),p.join(t,"..","templates","paradigm")];for(let i of n)if(o.existsSync(i))return i;return null}var ke=createRequire(import.meta.url),{version:N}=ke("../package.json");async function B(e){let t=C(e);if(t)return t;let n=await U(e);return {version:"1.0",cliVersion:N,lastMigrated:new Date().toISOString(),applied:n}}function _(e,t){let n=p.join(e,".paradigm","migrate.yaml");o.mkdirSync(p.dirname(n),{recursive:true}),t.cliVersion=N,t.lastMigrated=new Date().toISOString(),o.writeFileSync(n,F.dump(t,{indent:2,lineWidth:120,noRefs:true,sortKeys:false,quotingType:'"'}),"utf8");}async function E(e,t,n,i){let r={applied:0,skipped:0,errors:0,manual:0,results:[]},a=new Date().toISOString();for(let d of t){if(!d.auto){r.manual++,r.results.push({id:d.id,result:{status:"skipped",message:"Manual review recommended"}});continue}try{let g=await d.apply(e,n);r.results.push({id:d.id,result:g}),g.status==="applied"?(r.applied++,i.applied.push({id:d.id,appliedAt:a,cliVersion:N})):g.status==="skipped"?r.skipped++:r.errors++;}catch(g){r.errors++,r.results.push({id:d.id,result:{status:"error",message:g.message}});}}return r}async function _e(e={}){let t=process.cwd(),n=p.join(t,".paradigm");if((!o.existsSync(n)||!o.statSync(n).isDirectory())&&!(o.existsSync(n)&&o.statSync(n).isFile())){e.quiet||console.log(s.yellow("\n No .paradigm/ directory found. Run `paradigm init` or `paradigm shift` first.\n"));return}let i=we();e.quiet||i.start("Detecting project state...");let r=await V(t);e.quiet||i.stop();let a=await B(t),d=r.pendingMigrations;if(e.only&&e.only.length>0&&(d=d.filter(c=>e.only.includes(c.id))),e.category&&(d=d.filter(c=>c.category===e.category)),e.force){let c=e.only?b.filter(u=>e.only.includes(u.id)):e.category?b.filter(u=>u.category===e.category):b;d=[];for(let u of c)((await u.check(t)).needed||e.force)&&d.push(u);}let g=d.filter(c=>c.auto),m=d.filter(c=>!c.auto);if(e.list){Me(a,r,e);return}if(e.quiet){if(g.length===0)return;let c=await E(t,g,e,a);return _(t,a),c}let S=C(t);if(console.log(s.blue(`
51
+ `):x(e,i),{status:"applied",message:"Added discipline: auto to config.yaml",filesModified:[".paradigm/config.yaml"]}}},fe={id:"sync-templates",introducedIn:"evergreen",description:"Update specs/ and docs/ from installed CLI templates",category:"template",auto:true,async check(e){let t=$();if(!t)return {needed:false,reason:"Templates directory not found"};let n=[],i=["specs","docs","prompts"];for(let r of i){let a=p.join(t,r),d=p.join(e,".paradigm",r);if(o.existsSync(a))try{let g=o.readdirSync(a).filter(m=>o.statSync(p.join(a,m)).isFile());for(let m of g)o.existsSync(p.join(d,m))||n.push(`${r}/${m}`);}catch{}}return n.length===0?{needed:false,reason:"All templates are up to date"}:{needed:true,reason:`${n.length} new template file(s) available`,details:n.map(r=>`New: ${r}`)}},async apply(e,t){let n=$();if(!n)return {status:"error",message:"Templates directory not found"};let i=p.basename(e),r=[],a=["specs","docs","prompts"];for(let d of a){let g=p.join(n,d),m=p.join(e,".paradigm",d);if(o.existsSync(g)){t.dryRun||o.mkdirSync(m,{recursive:true});try{let S=o.readdirSync(g,{withFileTypes:!0});for(let k of S){if(k.isDirectory())continue;let M=p.join(m,k.name);if(!o.existsSync(M)){if(t.dryRun){r.push(`${d}/${k.name}`);continue}let c=o.readFileSync(p.join(g,k.name),"utf8");c=c.replace(/\{\{PROJECT_NAME\}\}/g,i),o.writeFileSync(M,c,"utf8"),r.push(`${d}/${k.name}`);}}}catch{}}}return t.dryRun?{status:"skipped",message:`Would copy ${r.length} template file(s)`}:r.length===0?{status:"skipped",message:"No new templates to sync"}:{status:"applied",message:`Synced ${r.length} template file(s)`,filesCreated:r.map(d=>`.paradigm/${d}`)}}},me={id:"refresh-hooks",introducedIn:"evergreen",description:"Reinstall hook scripts from plugin",category:"hook",auto:true,async check(e){let t=[p.join(e,".claude","hooks"),p.join(e,".cursor","hooks")];for(let i of t)if(o.existsSync(i))try{if(o.readdirSync(i).some(a=>a.includes("paradigm")))return {needed:!1,reason:"Hooks are installed"}}catch{}let n=p.join(e,".claude","settings.local.json");if(o.existsSync(n))try{if(JSON.parse(o.readFileSync(n,"utf8")).hooks)return {needed:!1,reason:"Plugin-managed hooks are configured"}}catch{}return {needed:true,reason:"No paradigm hooks found"}},async apply(e,t){if(t.dryRun)return {status:"skipped",message:"Would reinstall hooks"};try{let{hooksInstallCommand:n}=await import('./hooks-E7HQQ57M.js');return await n({force:!0}),{status:"applied",message:"Hooks reinstalled"}}catch(n){return {status:"error",message:`Hook install failed: ${n.message}`}}}},b=[Q,X,Z,ee,te,ne,se,ue,de,le,re,oe,ie,ae,ce,pe,ge,fe,me];var he=createRequire(import.meta.url),{version:W}=he("../package.json");function C(e){let t=p.join(e,".paradigm","migrate.yaml");if(!o.existsSync(t))return null;try{let n=o.readFileSync(t,"utf8");return F.load(n)}catch{return null}}async function V(e){let t=p.join(e,".paradigm"),n=C(e),i=n?.applied.map(l=>l.id)??[],r="unknown",a=p.join(t,"config.yaml");if(o.existsSync(a))try{let l=F.load(o.readFileSync(a,"utf8"));r=String(l.version??"unknown");}catch{}let g=["specs","docs","prompts","lore","tasks","protocols","personas"].filter(l=>!o.existsSync(p.join(t,l))),m=["discipline","tag-bank","purpose-required","component_types"],S=[];if(o.existsSync(a))try{let l=F.load(o.readFileSync(a,"utf8"));S=m.filter(h=>{let j=h.replace(/-/g,"_");return !(h in l)&&!(j in l)&&!(h.replace(/_/g,"-")in l)});}catch{}let k=[],M=$();if(M){let l=["specs","docs"];for(let h of l){let j=p.join(M,h),L=p.join(t,h);if(o.existsSync(j)&&o.existsSync(L)){let J=o.readdirSync(j).filter(R=>!o.statSync(p.join(j,R)).isDirectory());for(let R of J){let Y=p.join(L,R);o.existsSync(Y)||k.push(`${h}/${R}`);}}}}let c=!o.existsSync(p.join(e,".claude","hooks")),u=[];for(let l of b){let h=l.introducedIn==="evergreen";if(i.includes(l.id)&&!h)continue;(await l.check(e)).needed&&u.push(l);}return {configVersion:r,cliVersion:W,pendingMigrations:u,appliedIds:i,health:{missingDirectories:g,missingConfigFields:S,staleTemplates:k,hooksOutdated:c}}}async function U(e){let t=[],n=new Date().toISOString();for(let i of b){if(i.introducedIn==="evergreen")continue;(await i.check(e)).needed||t.push({id:i.id,appliedAt:n,cliVersion:W});}return t}function $(){let e=new URL(import.meta.url).pathname,t=p.dirname(e),n=[p.join(t,"..","..","..","templates","paradigm"),p.join(t,"..","..","templates","paradigm"),p.join(t,"..","templates","paradigm")];for(let i of n)if(o.existsSync(i))return i;return null}var ke=createRequire(import.meta.url),{version:N}=ke("../package.json");async function B(e){let t=C(e);if(t)return t;let n=await U(e);return {version:"1.0",cliVersion:N,lastMigrated:new Date().toISOString(),applied:n}}function _(e,t){let n=p.join(e,".paradigm","migrate.yaml");o.mkdirSync(p.dirname(n),{recursive:true}),t.cliVersion=N,t.lastMigrated=new Date().toISOString(),o.writeFileSync(n,F.dump(t,{indent:2,lineWidth:120,noRefs:true,sortKeys:false,quotingType:'"'}),"utf8");}async function E(e,t,n,i){let r={applied:0,skipped:0,errors:0,manual:0,results:[]},a=new Date().toISOString();for(let d of t){if(!d.auto){r.manual++,r.results.push({id:d.id,result:{status:"skipped",message:"Manual review recommended"}});continue}try{let g=await d.apply(e,n);r.results.push({id:d.id,result:g}),g.status==="applied"?(r.applied++,i.applied.push({id:d.id,appliedAt:a,cliVersion:N})):g.status==="skipped"?r.skipped++:r.errors++;}catch(g){r.errors++,r.results.push({id:d.id,result:{status:"error",message:g.message}});}}return r}async function _e(e={}){let t=process.cwd(),n=p.join(t,".paradigm");if((!o.existsSync(n)||!o.statSync(n).isDirectory())&&!(o.existsSync(n)&&o.statSync(n).isFile())){e.quiet||console.log(s.yellow("\n No .paradigm/ directory found. Run `paradigm init` or `paradigm shift` first.\n"));return}let i=we();e.quiet||i.start("Detecting project state...");let r=await V(t);e.quiet||i.stop();let a=await B(t),d=r.pendingMigrations;if(e.only&&e.only.length>0&&(d=d.filter(c=>e.only.includes(c.id))),e.category&&(d=d.filter(c=>c.category===e.category)),e.force){let c=e.only?b.filter(u=>e.only.includes(u.id)):e.category?b.filter(u=>u.category===e.category):b;d=[];for(let u of c)((await u.check(t)).needed||e.force)&&d.push(u);}let g=d.filter(c=>c.auto),m=d.filter(c=>!c.auto);if(e.list){Me(a,r,e);return}if(e.quiet){if(g.length===0)return;let c=await E(t,g,e,a);return _(t,a),c}let S=C(t);if(console.log(s.blue(`
52
52
  \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(s.blue("\u2502")+s.white.bold(" paradigm migrate ")+s.blue("\u2502")),console.log(s.blue("\u2502")+s.gray(" Bring your project up to date ")+s.blue("\u2502")),console.log(s.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
53
53
  `)),console.log(s.white(` Project: ${s.cyan(p.basename(t))}`)),console.log(s.white(` Config version: ${s.cyan(r.configVersion)}`)),console.log(s.white(` CLI version: ${s.cyan(r.cliVersion)}`)),console.log(s.white(` Last migrated: ${s.cyan(S?.lastMigrated??"never")}`)),console.log(""),d.length===0){console.log(s.green(` All migrations are up to date.
54
54
  `)),S||(_(t,a),e.verbose&&console.log(s.gray(` Created .paradigm/migrate.yaml with bootstrap state.
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- export{b as ROSTER_SUGGESTIONS,a as detectProjectType}from'./chunk-AGVAHVUA.js';import'./chunk-5TAVYPOV.js';
2
+ export{b as ROSTER_SUGGESTIONS,a as detectProjectType}from'./chunk-4DVT5IEY.js';import'./chunk-5TAVYPOV.js';
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import {a as a$1,f,c,e,g as g$1,b as b$1,d}from'./chunk-WR6D3SC6.js';import {a}from'./chunk-LKAT7IAK.js';import'./chunk-5TAVYPOV.js';import*as g from'fs';import*as m from'path';import*as b from'os';import r from'chalk';import*as $ from'js-yaml';var x=m.join(b.homedir(),".paradigm","agents"),O=".agent";function C(){return m.join(process.cwd(),".paradigm","roster.yaml")}function k(){let n=C();if(!g.existsSync(n))return null;try{return $.load(g.readFileSync(n,"utf-8"))}catch{return null}}function F(n){let s=C(),c=m.dirname(s);g.existsSync(c)||g.mkdirSync(c,{recursive:true}),g.writeFileSync(s,$.dump(n,{lineWidth:-1,noRefs:true,sortKeys:false}),"utf-8");}function E(){if(!g.existsSync(x))return [];try{return g.readdirSync(x).filter(n=>n.endsWith(O)).map(n=>n.replace(O,"")).sort()}catch{return []}}function P(n){let s=m.join(x,`${n}${O}`);if(!g.existsSync(s))return null;try{let c=$.load(g.readFileSync(s,"utf-8"));return {id:c.id||n,nickname:c.nickname,role:c.role||"Unknown"}}catch{return null}}async function U(n={}){let s=process.cwd(),c$1=a.command("agent-roster-show").start("Showing project roster",{cwd:s}),o=E().length,i=k();if(!i){n.json?a$1(JSON.stringify({roster:null,message:"No roster configured",totalAgents:o})):(f("Agent Roster"),a$1(""),c(`No roster configured \u2014 all ${o} agents are active.`),e(` Run ${r.cyan("paradigm agent roster init")} to create one.`),a$1("")),c$1.success("No roster found");return}let t=i.active||[];if(n.json){let h=t.map(y=>P(y)||{id:y,role:"Unknown"});a$1(JSON.stringify({count:t.length,total:o,project:i.project,type:i.type,agents:h},null,2)),c$1.success(`${t.length} of ${o} agents active`);return}f("Agent Roster"),a$1("");let a$2="ID".padEnd(16),l="Nickname".padEnd(12);a$1(` ${r.dim(a$2)} ${r.dim(l)} ${r.dim("Role")}`),a$1(` ${r.dim("-".repeat(16))} ${r.dim("-".repeat(12))} ${r.dim("-".repeat(30))}`);for(let h of t.sort()){let y=P(h),f=y?.nickname||r.dim("\u2014"),S=y?.role||r.dim("Unknown");a$1(` ${r.white.bold(h.padEnd(16))} ${f.toString().padEnd(12)} ${r.gray(S)}`);}a$1(""),a$1(` ${r.cyan(String(t.length))} of ${r.cyan(String(o))} agents active on this project`),i.type&&g$1("Project type",i.type),a$1(""),c$1.success(`${t.length} of ${o} agents active`);}async function G(n={}){let s=process.cwd(),c$1=a.command("agent-roster-init").start("Initializing project roster",{cwd:s}),u=C();if(g.existsSync(u)&&!n.force){let S=k()?.active?.length??0;n.json?a$1(JSON.stringify({error:"Roster already exists",count:S})):(c(`Roster already exists with ${S} agents.`),e(` Use ${r.cyan("--force")} to reinitialize, or ${r.cyan("paradigm agent roster add/remove")} to modify.`)),c$1.error("Roster already exists");return}let{detectProjectType:o,ROSTER_SUGGESTIONS:i}=await import('./project-type-SURTOIG7.js'),t=o(s),a$2=i[t]||i.generic,l=m.basename(s),d=m.join(s,".paradigm","config.yaml");if(g.existsSync(d))try{let f=$.load(g.readFileSync(d,"utf-8"));f?.project&&typeof f.project=="string"&&(l=f.project);}catch{}let h={version:"1.0",project:l,type:t,active:a$2.sort()};F(h);let y=E();n.json?a$1(JSON.stringify({created:true,project:l,type:t,active:a$2.sort(),count:a$2.length,total:y.length},null,2)):(f("Agent Roster Initialized"),a$1(""),g$1("Project",l),g$1("Detected type",t),g$1("Active agents",`${a$2.length} of ${y.length}`),a$1(""),a$1(` ${r.cyan(a$2.sort().join(", "))}`),a$1(""),b$1(`Roster written to ${r.dim(".paradigm/roster.yaml")}`),e(` Modify with ${r.cyan("paradigm agent roster add/remove <agent-id>")}`),a$1("")),c$1.success(`Created roster: ${a$2.length} agents for ${t}`);}async function _(n,s={}){let c=process.cwd(),u=a.command("agent-roster-add").start(`Adding agents: ${n.join(", ")}`,{cwd:c}),o=k();if(!o){s.json?a$1(JSON.stringify({error:"No roster found. Run `paradigm agent roster init` first."})):(d("No roster found."),e(` Run ${r.cyan("paradigm agent roster init")} first.`)),u.error("No roster found");return}let i=E(),t=[],a$2=[],l=[];for(let d of n){if(!i.includes(d)){t.push(d);continue}if(o.active.includes(d)){a$2.push(d);continue}o.active.push(d),l.push(d);}l.length>0&&(o.active.sort(),F(o)),s.json?a$1(JSON.stringify({added:l,alreadyActive:a$2,invalid:t,total:o.active.length},null,2)):(l.length>0&&b$1(`Added: ${r.cyan(l.join(", "))}`),a$2.length>0&&e(` Already active: ${a$2.join(", ")}`),t.length>0&&(d(`Unknown agent(s): ${t.join(", ")}`),e(` Available: ${i.join(", ")}`)),l.length>0&&a$1(` Roster now has ${r.cyan(String(o.active.length))} active agents.`)),u.success(`Added ${l.length}, skipped ${a$2.length}, invalid ${t.length}`);}async function z(n,s={}){let c$1=process.cwd(),u=a.command("agent-roster-remove").start(`Removing agents: ${n.join(", ")}`,{cwd:c$1}),o=k();if(!o){s.json?a$1(JSON.stringify({error:"No roster found. Run `paradigm agent roster init` first."})):(d("No roster found."),e(` Run ${r.cyan("paradigm agent roster init")} first.`)),u.error("No roster found");return}let i=[],t=[];for(let a of n){let l=o.active.indexOf(a);if(l<0){i.push(a);continue}o.active.splice(l,1),t.push(a);}t.length>0&&F(o),s.json?a$1(JSON.stringify({removed:t,notFound:i,total:o.active.length},null,2)):(t.length>0&&b$1(`Removed: ${r.cyan(t.join(", "))}`),i.length>0&&c(`Not in roster: ${i.join(", ")}`),t.length>0&&a$1(` Roster now has ${r.cyan(String(o.active.length))} active agents.`)),u.success(`Removed ${t.length}, not found ${i.length}`);}export{_ as rosterAddCommand,G as rosterInitCommand,z as rosterRemoveCommand,U as rosterShowCommand};
2
+ import {a as a$1,f,c,e,g as g$1,b as b$1,d}from'./chunk-WR6D3SC6.js';import {a}from'./chunk-LKAT7IAK.js';import'./chunk-5TAVYPOV.js';import*as g from'fs';import*as m from'path';import*as b from'os';import r from'chalk';import*as $ from'js-yaml';var x=m.join(b.homedir(),".paradigm","agents"),O=".agent";function C(){return m.join(process.cwd(),".paradigm","roster.yaml")}function k(){let n=C();if(!g.existsSync(n))return null;try{return $.load(g.readFileSync(n,"utf-8"))}catch{return null}}function F(n){let s=C(),c=m.dirname(s);g.existsSync(c)||g.mkdirSync(c,{recursive:true}),g.writeFileSync(s,$.dump(n,{lineWidth:-1,noRefs:true,sortKeys:false}),"utf-8");}function E(){if(!g.existsSync(x))return [];try{return g.readdirSync(x).filter(n=>n.endsWith(O)).map(n=>n.replace(O,"")).sort()}catch{return []}}function P(n){let s=m.join(x,`${n}${O}`);if(!g.existsSync(s))return null;try{let c=$.load(g.readFileSync(s,"utf-8"));return {id:c.id||n,nickname:c.nickname,role:c.role||"Unknown"}}catch{return null}}async function U(n={}){let s=process.cwd(),c$1=a.command("agent-roster-show").start("Showing project roster",{cwd:s}),o=E().length,i=k();if(!i){n.json?a$1(JSON.stringify({roster:null,message:"No roster configured",totalAgents:o})):(f("Agent Roster"),a$1(""),c(`No roster configured \u2014 all ${o} agents are active.`),e(` Run ${r.cyan("paradigm agent roster init")} to create one.`),a$1("")),c$1.success("No roster found");return}let t=i.active||[];if(n.json){let h=t.map(y=>P(y)||{id:y,role:"Unknown"});a$1(JSON.stringify({count:t.length,total:o,project:i.project,type:i.type,agents:h},null,2)),c$1.success(`${t.length} of ${o} agents active`);return}f("Agent Roster"),a$1("");let a$2="ID".padEnd(16),l="Nickname".padEnd(12);a$1(` ${r.dim(a$2)} ${r.dim(l)} ${r.dim("Role")}`),a$1(` ${r.dim("-".repeat(16))} ${r.dim("-".repeat(12))} ${r.dim("-".repeat(30))}`);for(let h of t.sort()){let y=P(h),f=y?.nickname||r.dim("\u2014"),S=y?.role||r.dim("Unknown");a$1(` ${r.white.bold(h.padEnd(16))} ${f.toString().padEnd(12)} ${r.gray(S)}`);}a$1(""),a$1(` ${r.cyan(String(t.length))} of ${r.cyan(String(o))} agents active on this project`),i.type&&g$1("Project type",i.type),a$1(""),c$1.success(`${t.length} of ${o} agents active`);}async function G(n={}){let s=process.cwd(),c$1=a.command("agent-roster-init").start("Initializing project roster",{cwd:s}),u=C();if(g.existsSync(u)&&!n.force){let S=k()?.active?.length??0;n.json?a$1(JSON.stringify({error:"Roster already exists",count:S})):(c(`Roster already exists with ${S} agents.`),e(` Use ${r.cyan("--force")} to reinitialize, or ${r.cyan("paradigm agent roster add/remove")} to modify.`)),c$1.error("Roster already exists");return}let{detectProjectType:o,ROSTER_SUGGESTIONS:i}=await import('./project-type-4Y6CESWP.js'),t=o(s),a$2=i[t]||i.generic,l=m.basename(s),d=m.join(s,".paradigm","config.yaml");if(g.existsSync(d))try{let f=$.load(g.readFileSync(d,"utf-8"));f?.project&&typeof f.project=="string"&&(l=f.project);}catch{}let h={version:"1.0",project:l,type:t,active:a$2.sort()};F(h);let y=E();n.json?a$1(JSON.stringify({created:true,project:l,type:t,active:a$2.sort(),count:a$2.length,total:y.length},null,2)):(f("Agent Roster Initialized"),a$1(""),g$1("Project",l),g$1("Detected type",t),g$1("Active agents",`${a$2.length} of ${y.length}`),a$1(""),a$1(` ${r.cyan(a$2.sort().join(", "))}`),a$1(""),b$1(`Roster written to ${r.dim(".paradigm/roster.yaml")}`),e(` Modify with ${r.cyan("paradigm agent roster add/remove <agent-id>")}`),a$1("")),c$1.success(`Created roster: ${a$2.length} agents for ${t}`);}async function _(n,s={}){let c=process.cwd(),u=a.command("agent-roster-add").start(`Adding agents: ${n.join(", ")}`,{cwd:c}),o=k();if(!o){s.json?a$1(JSON.stringify({error:"No roster found. Run `paradigm agent roster init` first."})):(d("No roster found."),e(` Run ${r.cyan("paradigm agent roster init")} first.`)),u.error("No roster found");return}let i=E(),t=[],a$2=[],l=[];for(let d of n){if(!i.includes(d)){t.push(d);continue}if(o.active.includes(d)){a$2.push(d);continue}o.active.push(d),l.push(d);}l.length>0&&(o.active.sort(),F(o)),s.json?a$1(JSON.stringify({added:l,alreadyActive:a$2,invalid:t,total:o.active.length},null,2)):(l.length>0&&b$1(`Added: ${r.cyan(l.join(", "))}`),a$2.length>0&&e(` Already active: ${a$2.join(", ")}`),t.length>0&&(d(`Unknown agent(s): ${t.join(", ")}`),e(` Available: ${i.join(", ")}`)),l.length>0&&a$1(` Roster now has ${r.cyan(String(o.active.length))} active agents.`)),u.success(`Added ${l.length}, skipped ${a$2.length}, invalid ${t.length}`);}async function z(n,s={}){let c$1=process.cwd(),u=a.command("agent-roster-remove").start(`Removing agents: ${n.join(", ")}`,{cwd:c$1}),o=k();if(!o){s.json?a$1(JSON.stringify({error:"No roster found. Run `paradigm agent roster init` first."})):(d("No roster found."),e(` Run ${r.cyan("paradigm agent roster init")} first.`)),u.error("No roster found");return}let i=[],t=[];for(let a of n){let l=o.active.indexOf(a);if(l<0){i.push(a);continue}o.active.splice(l,1),t.push(a);}t.length>0&&F(o),s.json?a$1(JSON.stringify({removed:t,notFound:i,total:o.active.length},null,2)):(t.length>0&&b$1(`Removed: ${r.cyan(t.join(", "))}`),i.length>0&&c(`Not in roster: ${i.join(", ")}`),t.length>0&&a$1(` Roster now has ${r.cyan(String(o.active.length))} active agents.`)),u.success(`Removed ${t.length}, not found ${i.length}`);}export{_ as rosterAddCommand,G as rosterInitCommand,z as rosterRemoveCommand,U as rosterShowCommand};
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env node
2
+ import {b}from'./chunk-VPMJWJ5R.js';import'./chunk-DG236EXP.js';import'./chunk-TYWB5IQJ.js';import'./chunk-WESTEMIM.js';import'./chunk-FYDRENK7.js';import'./chunk-IZSBGW6E.js';import {d as d$1}from'./chunk-AO7ZSRME.js';import'./chunk-Y4XFVDZC.js';import {a as a$5}from'./chunk-FSOI3CCD.js';import {d}from'./chunk-W5IWDW4Y.js';import {a as a$3,b as b$1}from'./chunk-4DVT5IEY.js';import'./chunk-SHD27BQX.js';import {a as a$6}from'./chunk-CSXVL2U7.js';import'./chunk-EKZDFEJW.js';import {a as a$1}from'./chunk-33LKBMVK.js';import {b as b$2}from'./chunk-JBDMCRPP.js';import'./chunk-4TXOVRWD.js';import'./chunk-T6IDXUUA.js';import'./chunk-JIXHEBGK.js';import'./chunk-QT2LKB3P.js';import'./chunk-VCKKJDLP.js';import'./chunk-WR6D3SC6.js';import {a as a$2}from'./chunk-UIKLE3WD.js';import {a as a$4}from'./chunk-QNZEG7IT.js';import'./chunk-HMQ5BHP2.js';import'./chunk-JQKKVAAN.js';import {a}from'./chunk-LKAT7IAK.js';import'./chunk-5TAVYPOV.js';import*as r from'fs';import*as n from'path';import e from'chalk';import U from'ora';import*as g from'js-yaml';async function te(l={}){let s=process.cwd(),h=n.basename(s),u=n.join(s,".paradigm"),k=r.existsSync(u)&&r.statSync(u).isDirectory();console.log(e.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(e.blue("\u2502")+e.white.bold(" paradigm shift ")+e.blue("\u2502")),console.log(e.blue("\u2502")+e.gray(" Full project setup in one command ")+e.blue("\u2502")),console.log(e.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
+ `)),console.log(e.white(` \u{1F4C1} Project: ${e.cyan(h)}`)),console.log(e.white(` \u{1F4CD} Status: ${k?e.green("Paradigm detected"):e.yellow("New project")}`)),console.log("");let j=a.command("shift").start("Running paradigm shift",{project:h}),i=U();if(!k||l.force){i.start("Step 1/6: Initializing Paradigm...");try{await a$1({force:l.force,quick:!0,name:h,stack:l.stack}),i.succeed(e.green("Paradigm initialized"));}catch(t){i.fail(e.red(`Init failed: ${t.message}`)),j.error("Shift failed at init",{error:t.message});return}}else {i.succeed(e.gray("Step 1/6: Already initialized (use --force to reinit)"));let t=n.join(u,"config.yaml");if(r.existsSync(t))try{let o=r.readFileSync(t,"utf8"),a=g.load(o);if(!a.discipline||a.discipline==="auto"){let c=a$2(s);if(c!=="backend"){let f=o.replace(/^discipline:\s*auto\b.*$/m,`discipline: ${c}`);f!==o&&(r.writeFileSync(t,f,"utf8"),console.log(e.green(` \u2713 Detected discipline: ${e.cyan(c)} (updated config.yaml)`)));}else if(!a.discipline){let f=o.replace(/^(project:\s*.+)$/m,`$1
5
+ discipline: ${c}`);f!==o&&(r.writeFileSync(t,f,"utf8"),console.log(e.green(` \u2713 Added discipline: ${e.cyan(c)} to config.yaml`)));}}}catch(o){a.operation("shift").debug("Discipline detection failed",{error:o.message});}}if(k){i.start("Step 1b/6: Checking for migrations...");try{let{migrateCommand:t}=await import('./migrate-WT56YYAM.js');await t({apply:!0,quiet:!0,noSync:!0}),i.succeed(e.green("Migrations applied"));}catch(t){i.warn(e.yellow(`Migration warning: ${t.message}`));}}{let t=n.join(u,"config.yaml");if(l.workspace&&r.existsSync(t)){let o=l.workspacePath?n.resolve(s,l.workspacePath):n.join(n.dirname(s),".paradigm-workspace");if(r.existsSync(o))try{let a=g.load(r.readFileSync(o,"utf8")),c=n.basename(s),f=n.dirname(o),d$1="./"+n.relative(f,s);if(a.members.some(y=>n.resolve(f,y.path)===s))console.log(e.green(` \u2713 Already a member of workspace: ${e.cyan(a.name)}`));else {let y=d(c,s);a.members.push({name:c,path:d$1,...y&&{role:y}}),r.writeFileSync(o,g.dump(a,{indent:2,lineWidth:120,noRefs:!0,sortKeys:!1,quotingType:'"'}),"utf8"),console.log(e.green(` \u2713 Joined workspace: ${e.cyan(a.name)} (added as member)`));}}catch(a){console.log(e.yellow(` \u26A0 Failed to join workspace: ${a.message}`));}else try{let a=n.basename(s),c=n.dirname(o),f="./"+n.relative(c,s),d$1=d(a,s),p={version:"1.0",name:l.workspace,members:[{name:a,path:f,...d$1&&{role:d$1}}]};r.mkdirSync(n.dirname(o),{recursive:!0}),r.writeFileSync(o,g.dump(p,{indent:2,lineWidth:120,noRefs:!0,sortKeys:!1,quotingType:'"'}),"utf8"),console.log(e.green(` \u2713 Created workspace: ${e.cyan(l.workspace)} at ${e.gray(n.relative(s,o))}`));}catch(a){console.log(e.yellow(` \u26A0 Failed to create workspace: ${a.message}`));}try{let a=r.readFileSync(t,"utf8"),c=g.load(a),f=n.relative(s,o);if(c.workspace!==f){if(c.workspace){let d=a.replace(/^workspace:\s*.*$/m,`workspace: "${f}"`);r.writeFileSync(t,d,"utf8");}else {let d=a.trimEnd()+`
6
+ workspace: "${f}"
7
+ `;r.writeFileSync(t,d,"utf8");}console.log(e.green(" \u2713 Linked workspace in config.yaml"));}}catch(a$1){a.operation("shift").debug("Workspace config link failed",{error:a$1.message});}}else if(r.existsSync(t))try{let o=r.readFileSync(t,"utf8");if(!g.load(o).workspace){let c=n.dirname(s);for(let f=0;f<3;f++){let d=n.join(c,".paradigm-workspace");if(r.existsSync(d)){let y=n.relative(s,d),N=o.trimEnd()+`
8
+ workspace: "${y}"
9
+ `;r.writeFileSync(t,N,"utf8"),console.log(e.green(` \u2713 Found workspace: ${e.cyan(y)} (added to config.yaml)`));break}let p=n.dirname(c);if(p===c)break;c=p;}}}catch(o){a.operation("shift").debug("Workspace auto-detect failed",{error:o.message});}}if(!d$1(s)||l.force){console.log(e.cyan(" Step 2/6: Initializing team configuration..."));try{await b(s,{force:l.force,json:!1,configureModels:!0,noConfigureModels:!1}),console.log(e.green(` \u2713 Team configuration initialized
10
+ `));}catch(t){console.log(e.yellow(` \u26A0 Team init warning: ${t.message}
11
+ `));}}else i.succeed(e.gray("Step 2/6: Team already configured (use --force to reinit)"));let S=n.join(s,".paradigm","roster.yaml");if(!r.existsSync(S)||l.force)try{let t=a$3(s),o=b$1[t]||b$1.generic,a={version:"1.0",project:h,type:t,active:o.sort()};r.writeFileSync(S,g.dump(a,{lineWidth:-1,noRefs:!0}),"utf8"),console.log(e.green(` \u2713 Agent roster set: ${e.cyan(o.length)} agents for ${e.cyan(t)}`));}catch(t){a.operation("shift").debug("Roster setup failed",{error:t.message});}else try{let o=g.load(r.readFileSync(S,"utf8"))?.active?.length??0;console.log(e.gray(` \u2713 Agent roster exists (${o} agents active)`));}catch{console.log(e.gray(" \u2713 Agent roster exists"));}{let t=n.join(u,"config.yaml");if(r.existsSync(t))try{let o=r.readFileSync(t,"utf8"),a=g.load(o);if(!a["model-resolution"]||l.force){let{ModelDiscovery:c}=await import('./model-discovery-HMB3YI4L.js'),d=new c(s).detectEnvironment(),p;d==="claude-code"?p={"tier-1":"opus","tier-2":"sonnet","tier-3":"haiku"}:d==="cursor"?p={"tier-1":"sonnet","tier-2":"sonnet","tier-3":"haiku"}:p={"tier-1":"sonnet","tier-2":"sonnet","tier-3":"sonnet"},a["model-resolution"]=p,r.writeFileSync(t,g.dump(a,{lineWidth:-1,noRefs:!0}),"utf8"),console.log(e.green(` \u2713 Model tiers configured for ${e.cyan(d)}: tier-1=${p["tier-1"]}, tier-2=${p["tier-2"]}, tier-3=${p["tier-3"]}`));}}catch(o){a.operation("shift").debug("Model tier config failed",{error:o.message});}}try{let{ensureEnforcementDefaults:t}=await import('./enforcement-TJOXPSTJ.js');t(s)&&console.log(e.green(` \u2713 Enforcement config initialized (${e.cyan("balanced")} preset)`));}catch(t){a.operation("shift").debug("Enforcement config setup failed",{error:t.message});}if(l.quick)i.succeed(e.gray("Step 3/6: Skipped scan (--quick mode)"));else {i.start("Step 3/6: Scanning and indexing symbols...");try{await b$2(s,{quiet:!0}),i.succeed(e.green("Symbols indexed"));}catch(t){i.warn(e.yellow(`Scan warning: ${t.message}`));}}{let t=n.join(u,"config.yaml");if(r.existsSync(t))try{if(g.load(r.readFileSync(t,"utf8")).workspace){i.start("Step 3b/6: Reindexing workspace members...");try{let{workspaceReindexCommand:a}=await import('./workspace-2ODL5WLY.js');await a({quiet:!0}),i.succeed(e.green("Workspace members reindexed"));}catch(a){i.warn(e.yellow(`Workspace reindex: ${a.message}`));}}}catch(o){a.operation("shift").debug("Workspace config read failed",{error:o.message});}}let v=n.join(s,"portal.yaml");r.existsSync(v)||r.writeFileSync(v,g.dump({version:"1.0.0",gates:{},routes:{}},{lineWidth:-1,noRefs:true}),"utf8");let C=n.join(s,".paradigm","lore");r.existsSync(C)||r.mkdirSync(C,{recursive:true});let P=n.join(s,".paradigm","university");for(let t of ["content/notes","content/policies","content/quizzes","content/paths","diplomas"]){let o=n.join(P,t);r.existsSync(o)||r.mkdirSync(o,{recursive:true});}let E=n.join(P,"config.yaml");if(!r.existsSync(E)){let t="Project";try{let a=n.join(s,".paradigm","config.yaml");if(r.existsSync(a)){let c=g.load(r.readFileSync(a,"utf8"));c.project&&typeof c.project=="string"&&(t=c.project);}}catch{}let o={branding:{name:`${t} University`,tagline:`Learn the ${t} codebase`,institution:t},theme:{primary:"#6366f1",secondary:"#8b5cf6",accent:"#f59e0b",background:"#0f172a",surface:"#1e293b",text:"#f8fafc",textMuted:"#94a3b8",success:"#22c55e",error:"#ef4444",font:"Inter, system-ui, sans-serif"},content:{categories:[],defaultDifficulty:"beginner",requireApproval:false},diplomas:{includeGlobalPLSAT:true}};r.writeFileSync(E,g.dump(o,{lineWidth:-1,noRefs:true}),"utf8");}i.start("Step 4/6: Syncing IDE configurations...");try{let t=l.ide?[l.ide]:["claude","cursor","copilot","windsurf","agents"],o=[];for(let a of t)try{await a$4(a,{quiet:!0,force:!0}),o.push(a);}catch{}o.length>0?i.succeed(e.green(`IDE configs synced: ${o.join(", ")}`)):i.warn(e.yellow("No IDE configs to sync"));}catch(t){i.warn(e.yellow(`Sync warning: ${t.message}`));}i.start("Step 5/6: Installing hooks...");try{await a$5({force:l.force}),i.succeed(e.green("Hooks installed (git + Claude Code + Cursor)"));}catch(t){i.warn(e.yellow(`Hooks warning: ${t.message}`));}if(l.verify){i.start("Step 6/6: Running health checks...");try{await a$6({quiet:!0})?i.succeed(e.green("All health checks passed")):i.warn(e.yellow("Some health checks need attention"));}catch(t){i.warn(e.yellow(`Doctor warning: ${t.message}`));}}else i.succeed(e.gray("Step 6/6: Skipped verify (use --verify to check health)"));console.log(""),console.log(e.blue("\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(e.blue("\u2502")+e.white.bold(" \u2728 Paradigm shift complete! ")+e.blue("\u2502")),console.log(e.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")),console.log(""),console.log(e.white(" Created/Updated:")),console.log(e.gray(" \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"));let x=[{path:".paradigm/config.yaml",desc:"Project configuration"},{path:".paradigm/navigator.yaml",desc:"Symbol navigation map"},{path:".paradigm/agents.yaml",desc:"Team agent configuration"},{path:".purpose",desc:"Root feature definitions"},{path:".paradigm/lore/",desc:"Project lore timeline",isDir:true},{path:"portal.yaml",desc:"Authorization gates"},{path:".paradigm/roster.yaml",desc:"Agent roster for this project"},{path:"CLAUDE.md",desc:"Claude Code AI instructions"},{path:"AGENTS.md",desc:"Universal AI agent instructions"},{path:".cursor/rules/",desc:"Cursor AI instructions",isDir:true},{path:".claude/hooks/",desc:"Claude Code enforcement hooks",isDir:true,optional:true},{path:".cursor/hooks/",desc:"Cursor enforcement hooks",isDir:true,optional:true}],F=n.join(u,"config.yaml");if(r.existsSync(F))try{let t=g.load(r.readFileSync(F,"utf8"));if(typeof t.workspace=="string"){let o=n.resolve(s,t.workspace),a=n.relative(s,o);x.push({path:a,desc:"Multi-project workspace",optional:!0});}}catch(t){a.operation("shift").debug("Summary config read failed",{error:t.message});}for(let t of x){let o=n.join(s,t.path);r.existsSync(o)?console.log(e.green(" \u2713 ")+e.white(t.path.padEnd(28))+e.gray(t.desc)):t.optional||console.log(e.yellow(" \u25CB ")+e.gray(t.path.padEnd(28))+e.gray(`(${t.desc})`));}console.log(""),console.log(e.white(" AI agents will now:")),console.log(e.gray(" \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")),console.log(e.cyan(" \u2022 ")+e.white("Use MCP tools for navigation (paradigm_search, etc.)")),console.log(e.cyan(" \u2022 ")+e.white("Check .purpose files before modifying features")),console.log(e.cyan(" \u2022 ")+e.white("Update Paradigm files when making structural changes")),console.log(e.cyan(" \u2022 ")+e.white("Follow antipatterns and team preferences")),console.log(e.cyan(" \u2022 ")+e.white("Record lore entries to capture work history")),console.log(""),console.log(e.white(" Next steps:")),console.log(e.gray(" \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"));let w=1;l.workspace&&console.log(e.white(` ${w++}. `)+e.gray("Run ")+e.cyan(`paradigm shift --workspace "${l.workspace}"`)+e.gray(" in sibling projects")),console.log(e.white(` ${w++}. `)+e.gray("Edit ")+e.cyan(".purpose")+e.gray(" to define your features")),console.log(e.white(` ${w++}. `)+e.gray("Add ")+e.cyan(".purpose")+e.gray(" files to feature directories")),console.log(e.white(` ${w++}. `)+e.gray("Run ")+e.cyan("paradigm shift --verify")+e.gray(" to check health")),console.log(""),j.success("Paradigm shift complete",{project:h});}export{te as shiftCommand};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@a-company/paradigm",
3
- "version": "5.21.2",
3
+ "version": "5.23.0",
4
4
  "description": "Unified CLI for Paradigm developer tools",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- import*as c from'fs';import*as a from'path';import {Glob}from'glob';function s(t){let e=r=>{if(r.includes("*"))try{return new Glob(r,{cwd:t,nodir:!0}).walkSync().length>0}catch{return false}return c.existsSync(a.join(t,r))};return e("project.godot")||e("Assets/ProjectSettings")?"game":e("Package.swift")&&!e("package.json")?e("Sources/*/App")||e("**/AppDelegate.swift")?"macos-app":"ios-app":e("pubspec.yaml")?"flutter-app":e("supabase")&&(e("next.config.*")||e("vite.config.*"))?"saas-web-app":e("next.config.*")||e("vite.config.*")||e("nuxt.config.*")?"web-app":e("Dockerfile")||e("prisma")||e("drizzle.config.*")?"backend-api":e("Cargo.toml")?"rust-project":e("pyproject.toml")||e("setup.py")||e("requirements.txt")?"python-project":"generic"}var n={"saas-web-app":["architect","builder","reviewer","tester","security","documentor","designer","copywriter","performance","devops","dba","e2e","dx","seo","pm","product","sales","legal","a11y","qa","advocate","debugger","release","narrator"],"web-app":["architect","builder","reviewer","tester","security","documentor","designer","copywriter","performance","devops","e2e","seo","a11y","qa","debugger"],"backend-api":["architect","builder","reviewer","tester","security","documentor","devops","dba","performance","dx","qa","debugger","release"],"ios-app":["architect","builder","reviewer","tester","security","documentor","designer","mobile","performance","a11y","qa","debugger"],"macos-app":["architect","builder","reviewer","tester","security","documentor","designer","performance","qa","debugger"],"flutter-app":["architect","builder","reviewer","tester","security","documentor","designer","mobile","performance","a11y","debugger"],game:["architect","builder","reviewer","tester","documentor","gamedev","3d","audio","designer","performance","debugger"],"rust-project":["architect","builder","reviewer","tester","security","documentor","performance","debugger","qa"],"python-project":["architect","builder","reviewer","tester","security","documentor","performance","debugger","qa"],generic:["architect","builder","reviewer","tester","security","documentor","debugger","qa"]};export{s as a,n as b};
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- export{a as doctorCommand}from'./chunk-UONPO7SC.js';import'./chunk-HMQ5BHP2.js';import'./chunk-JQKKVAAN.js';import'./chunk-LKAT7IAK.js';import'./chunk-5TAVYPOV.js';
@@ -1,11 +0,0 @@
1
- #!/usr/bin/env node
2
- import {b}from'./chunk-VPMJWJ5R.js';import'./chunk-DG236EXP.js';import'./chunk-TYWB5IQJ.js';import'./chunk-WESTEMIM.js';import'./chunk-FYDRENK7.js';import'./chunk-IZSBGW6E.js';import {d as d$2}from'./chunk-AO7ZSRME.js';import'./chunk-Y4XFVDZC.js';import {a as a$5}from'./chunk-SWFC4HD7.js';import {d as d$1}from'./chunk-W5IWDW4Y.js';import {a as a$3,b as b$1}from'./chunk-AGVAHVUA.js';import'./chunk-SHD27BQX.js';import {a as a$6}from'./chunk-UONPO7SC.js';import'./chunk-EKZDFEJW.js';import {a as a$1}from'./chunk-33LKBMVK.js';import {b as b$2}from'./chunk-JBDMCRPP.js';import'./chunk-4TXOVRWD.js';import'./chunk-T6IDXUUA.js';import'./chunk-JIXHEBGK.js';import'./chunk-QT2LKB3P.js';import'./chunk-VCKKJDLP.js';import'./chunk-WR6D3SC6.js';import {a as a$2}from'./chunk-UIKLE3WD.js';import {a as a$4}from'./chunk-QNZEG7IT.js';import'./chunk-HMQ5BHP2.js';import'./chunk-JQKKVAAN.js';import {a}from'./chunk-LKAT7IAK.js';import'./chunk-5TAVYPOV.js';import*as r from'fs';import*as n from'path';import e from'chalk';import U from'ora';import*as d from'js-yaml';async function te(l={}){let s=process.cwd(),h=n.basename(s),u=n.join(s,".paradigm"),k=r.existsSync(u)&&r.statSync(u).isDirectory();console.log(e.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(e.blue("\u2502")+e.white.bold(" paradigm shift ")+e.blue("\u2502")),console.log(e.blue("\u2502")+e.gray(" Full project setup in one command ")+e.blue("\u2502")),console.log(e.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
- `)),console.log(e.white(` \u{1F4C1} Project: ${e.cyan(h)}`)),console.log(e.white(` \u{1F4CD} Status: ${k?e.green("Paradigm detected"):e.yellow("New project")}`)),console.log("");let j=a.command("shift").start("Running paradigm shift",{project:h}),i=U();if(!k||l.force){i.start("Step 1/6: Initializing Paradigm...");try{await a$1({force:l.force,quick:!0,name:h,stack:l.stack}),i.succeed(e.green("Paradigm initialized"));}catch(t){i.fail(e.red(`Init failed: ${t.message}`)),j.error("Shift failed at init",{error:t.message});return}}else {i.succeed(e.gray("Step 1/6: Already initialized (use --force to reinit)"));let t=n.join(u,"config.yaml");if(r.existsSync(t))try{let o=r.readFileSync(t,"utf8"),a=d.load(o);if(!a.discipline||a.discipline==="auto"){let c=a$2(s);if(c!=="backend"){let f=o.replace(/^discipline:\s*auto\b.*$/m,`discipline: ${c}`);f!==o&&(r.writeFileSync(t,f,"utf8"),console.log(e.green(` \u2713 Detected discipline: ${e.cyan(c)} (updated config.yaml)`)));}else if(!a.discipline){let f=o.replace(/^(project:\s*.+)$/m,`$1
5
- discipline: ${c}`);f!==o&&(r.writeFileSync(t,f,"utf8"),console.log(e.green(` \u2713 Added discipline: ${e.cyan(c)} to config.yaml`)));}}}catch(o){a.operation("shift").debug("Discipline detection failed",{error:o.message});}}if(k){i.start("Step 1b/6: Checking for migrations...");try{let{migrateCommand:t}=await import('./migrate-ZLITTMVW.js');await t({apply:!0,quiet:!0,noSync:!0}),i.succeed(e.green("Migrations applied"));}catch(t){i.warn(e.yellow(`Migration warning: ${t.message}`));}}{let t=n.join(u,"config.yaml");if(l.workspace&&r.existsSync(t)){let o=l.workspacePath?n.resolve(s,l.workspacePath):n.join(n.dirname(s),".paradigm-workspace");if(r.existsSync(o))try{let a=d.load(r.readFileSync(o,"utf8")),c=n.basename(s),f=n.dirname(o),g="./"+n.relative(f,s);if(a.members.some(y=>n.resolve(f,y.path)===s))console.log(e.green(` \u2713 Already a member of workspace: ${e.cyan(a.name)}`));else {let y=d$1(c,s);a.members.push({name:c,path:g,...y&&{role:y}}),r.writeFileSync(o,d.dump(a,{indent:2,lineWidth:120,noRefs:!0,sortKeys:!1,quotingType:'"'}),"utf8"),console.log(e.green(` \u2713 Joined workspace: ${e.cyan(a.name)} (added as member)`));}}catch(a){console.log(e.yellow(` \u26A0 Failed to join workspace: ${a.message}`));}else try{let a=n.basename(s),c=n.dirname(o),f="./"+n.relative(c,s),g=d$1(a,s),p={version:"1.0",name:l.workspace,members:[{name:a,path:f,...g&&{role:g}}]};r.mkdirSync(n.dirname(o),{recursive:!0}),r.writeFileSync(o,d.dump(p,{indent:2,lineWidth:120,noRefs:!0,sortKeys:!1,quotingType:'"'}),"utf8"),console.log(e.green(` \u2713 Created workspace: ${e.cyan(l.workspace)} at ${e.gray(n.relative(s,o))}`));}catch(a){console.log(e.yellow(` \u26A0 Failed to create workspace: ${a.message}`));}try{let a=r.readFileSync(t,"utf8"),c=d.load(a),f=n.relative(s,o);if(c.workspace!==f){if(c.workspace){let g=a.replace(/^workspace:\s*.*$/m,`workspace: "${f}"`);r.writeFileSync(t,g,"utf8");}else {let g=a.trimEnd()+`
6
- workspace: "${f}"
7
- `;r.writeFileSync(t,g,"utf8");}console.log(e.green(" \u2713 Linked workspace in config.yaml"));}}catch(a$1){a.operation("shift").debug("Workspace config link failed",{error:a$1.message});}}else if(r.existsSync(t))try{let o=r.readFileSync(t,"utf8");if(!d.load(o).workspace){let c=n.dirname(s);for(let f=0;f<3;f++){let g=n.join(c,".paradigm-workspace");if(r.existsSync(g)){let y=n.relative(s,g),N=o.trimEnd()+`
8
- workspace: "${y}"
9
- `;r.writeFileSync(t,N,"utf8"),console.log(e.green(` \u2713 Found workspace: ${e.cyan(y)} (added to config.yaml)`));break}let p=n.dirname(c);if(p===c)break;c=p;}}}catch(o){a.operation("shift").debug("Workspace auto-detect failed",{error:o.message});}}if(!d$2(s)||l.force){console.log(e.cyan(" Step 2/6: Initializing team configuration..."));try{await b(s,{force:l.force,json:!1,configureModels:!0,noConfigureModels:!1}),console.log(e.green(` \u2713 Team configuration initialized
10
- `));}catch(t){console.log(e.yellow(` \u26A0 Team init warning: ${t.message}
11
- `));}}else i.succeed(e.gray("Step 2/6: Team already configured (use --force to reinit)"));let S=n.join(s,".paradigm","roster.yaml");if(!r.existsSync(S)||l.force)try{let t=a$3(s),o=b$1[t]||b$1.generic,a={version:"1.0",project:h,type:t,active:o.sort()};r.writeFileSync(S,d.dump(a,{lineWidth:-1,noRefs:!0}),"utf8"),console.log(e.green(` \u2713 Agent roster set: ${e.cyan(o.length)} agents for ${e.cyan(t)}`));}catch(t){a.operation("shift").debug("Roster setup failed",{error:t.message});}else try{let o=d.load(r.readFileSync(S,"utf8"))?.active?.length??0;console.log(e.gray(` \u2713 Agent roster exists (${o} agents active)`));}catch{console.log(e.gray(" \u2713 Agent roster exists"));}{let t=n.join(u,"config.yaml");if(r.existsSync(t))try{let o=r.readFileSync(t,"utf8"),a=d.load(o);if(!a["model-resolution"]||l.force){let{ModelDiscovery:c}=await import('./model-discovery-HMB3YI4L.js'),g=new c(s).detectEnvironment(),p;g==="claude-code"?p={"tier-1":"opus","tier-2":"sonnet","tier-3":"haiku"}:g==="cursor"?p={"tier-1":"sonnet","tier-2":"sonnet","tier-3":"haiku"}:p={"tier-1":"sonnet","tier-2":"sonnet","tier-3":"sonnet"},a["model-resolution"]=p,r.writeFileSync(t,d.dump(a,{lineWidth:-1,noRefs:!0}),"utf8"),console.log(e.green(` \u2713 Model tiers configured for ${e.cyan(g)}: tier-1=${p["tier-1"]}, tier-2=${p["tier-2"]}, tier-3=${p["tier-3"]}`));}}catch(o){a.operation("shift").debug("Model tier config failed",{error:o.message});}}if(l.quick)i.succeed(e.gray("Step 3/6: Skipped scan (--quick mode)"));else {i.start("Step 3/6: Scanning and indexing symbols...");try{await b$2(s,{quiet:!0}),i.succeed(e.green("Symbols indexed"));}catch(t){i.warn(e.yellow(`Scan warning: ${t.message}`));}}{let t=n.join(u,"config.yaml");if(r.existsSync(t))try{if(d.load(r.readFileSync(t,"utf8")).workspace){i.start("Step 3b/6: Reindexing workspace members...");try{let{workspaceReindexCommand:a}=await import('./workspace-2ODL5WLY.js');await a({quiet:!0}),i.succeed(e.green("Workspace members reindexed"));}catch(a){i.warn(e.yellow(`Workspace reindex: ${a.message}`));}}}catch(o){a.operation("shift").debug("Workspace config read failed",{error:o.message});}}let v=n.join(s,"portal.yaml");r.existsSync(v)||r.writeFileSync(v,d.dump({version:"1.0.0",gates:{},routes:{}},{lineWidth:-1,noRefs:true}),"utf8");let C=n.join(s,".paradigm","lore");r.existsSync(C)||r.mkdirSync(C,{recursive:true});let P=n.join(s,".paradigm","university");for(let t of ["content/notes","content/policies","content/quizzes","content/paths","diplomas"]){let o=n.join(P,t);r.existsSync(o)||r.mkdirSync(o,{recursive:true});}let x=n.join(P,"config.yaml");if(!r.existsSync(x)){let t="Project";try{let a=n.join(s,".paradigm","config.yaml");if(r.existsSync(a)){let c=d.load(r.readFileSync(a,"utf8"));c.project&&typeof c.project=="string"&&(t=c.project);}}catch{}let o={branding:{name:`${t} University`,tagline:`Learn the ${t} codebase`,institution:t},theme:{primary:"#6366f1",secondary:"#8b5cf6",accent:"#f59e0b",background:"#0f172a",surface:"#1e293b",text:"#f8fafc",textMuted:"#94a3b8",success:"#22c55e",error:"#ef4444",font:"Inter, system-ui, sans-serif"},content:{categories:[],defaultDifficulty:"beginner",requireApproval:false},diplomas:{includeGlobalPLSAT:true}};r.writeFileSync(x,d.dump(o,{lineWidth:-1,noRefs:true}),"utf8");}i.start("Step 4/6: Syncing IDE configurations...");try{let t=l.ide?[l.ide]:["claude","cursor","copilot","windsurf","agents"],o=[];for(let a of t)try{await a$4(a,{quiet:!0,force:!0}),o.push(a);}catch{}o.length>0?i.succeed(e.green(`IDE configs synced: ${o.join(", ")}`)):i.warn(e.yellow("No IDE configs to sync"));}catch(t){i.warn(e.yellow(`Sync warning: ${t.message}`));}i.start("Step 5/6: Installing hooks...");try{await a$5({force:l.force}),i.succeed(e.green("Hooks installed (git + Claude Code + Cursor)"));}catch(t){i.warn(e.yellow(`Hooks warning: ${t.message}`));}if(l.verify){i.start("Step 6/6: Running health checks...");try{await a$6({quiet:!0})?i.succeed(e.green("All health checks passed")):i.warn(e.yellow("Some health checks need attention"));}catch(t){i.warn(e.yellow(`Doctor warning: ${t.message}`));}}else i.succeed(e.gray("Step 6/6: Skipped verify (use --verify to check health)"));console.log(""),console.log(e.blue("\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(e.blue("\u2502")+e.white.bold(" \u2728 Paradigm shift complete! ")+e.blue("\u2502")),console.log(e.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")),console.log(""),console.log(e.white(" Created/Updated:")),console.log(e.gray(" \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"));let E=[{path:".paradigm/config.yaml",desc:"Project configuration"},{path:".paradigm/navigator.yaml",desc:"Symbol navigation map"},{path:".paradigm/agents.yaml",desc:"Team agent configuration"},{path:".purpose",desc:"Root feature definitions"},{path:".paradigm/lore/",desc:"Project lore timeline",isDir:true},{path:"portal.yaml",desc:"Authorization gates"},{path:".paradigm/roster.yaml",desc:"Agent roster for this project"},{path:"CLAUDE.md",desc:"Claude Code AI instructions"},{path:"AGENTS.md",desc:"Universal AI agent instructions"},{path:".cursor/rules/",desc:"Cursor AI instructions",isDir:true},{path:".claude/hooks/",desc:"Claude Code enforcement hooks",isDir:true,optional:true},{path:".cursor/hooks/",desc:"Cursor enforcement hooks",isDir:true,optional:true}],F=n.join(u,"config.yaml");if(r.existsSync(F))try{let t=d.load(r.readFileSync(F,"utf8"));if(typeof t.workspace=="string"){let o=n.resolve(s,t.workspace),a=n.relative(s,o);E.push({path:a,desc:"Multi-project workspace",optional:!0});}}catch(t){a.operation("shift").debug("Summary config read failed",{error:t.message});}for(let t of E){let o=n.join(s,t.path);r.existsSync(o)?console.log(e.green(" \u2713 ")+e.white(t.path.padEnd(28))+e.gray(t.desc)):t.optional||console.log(e.yellow(" \u25CB ")+e.gray(t.path.padEnd(28))+e.gray(`(${t.desc})`));}console.log(""),console.log(e.white(" AI agents will now:")),console.log(e.gray(" \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")),console.log(e.cyan(" \u2022 ")+e.white("Use MCP tools for navigation (paradigm_search, etc.)")),console.log(e.cyan(" \u2022 ")+e.white("Check .purpose files before modifying features")),console.log(e.cyan(" \u2022 ")+e.white("Update Paradigm files when making structural changes")),console.log(e.cyan(" \u2022 ")+e.white("Follow antipatterns and team preferences")),console.log(e.cyan(" \u2022 ")+e.white("Record lore entries to capture work history")),console.log(""),console.log(e.white(" Next steps:")),console.log(e.gray(" \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"));let w=1;l.workspace&&console.log(e.white(` ${w++}. `)+e.gray("Run ")+e.cyan(`paradigm shift --workspace "${l.workspace}"`)+e.gray(" in sibling projects")),console.log(e.white(` ${w++}. `)+e.gray("Edit ")+e.cyan(".purpose")+e.gray(" to define your features")),console.log(e.white(` ${w++}. `)+e.gray("Add ")+e.cyan(".purpose")+e.gray(" files to feature directories")),console.log(e.white(` ${w++}. `)+e.gray("Run ")+e.cyan("paradigm shift --verify")+e.gray(" to check health")),console.log(""),j.success("Paradigm shift complete",{project:h});}export{te as shiftCommand};