@a-company/paradigm 6.0.4 → 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.
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env node
2
+ import'./chunk-5TAVYPOV.js';import*as e from'fs';import*as i from'path';import*as f from'js-yaml';import s from'chalk';var l=".v6-0-4-migration-acknowledged",m=new Set(["node_modules",".git","dist","build",".next",".turbo","coverage",".paradigm",".cache"]);function u(t){function r(n,a){if(a>8)return false;let c;try{c=e.readdirSync(n,{withFileTypes:!0});}catch{return false}for(let o of c)if(o.isDirectory()){if(m.has(o.name)||o.name.startsWith("."))continue;if(r(i.join(n,o.name),a+1))return true}else if(o.isFile()&&o.name===".purpose")try{let p=e.readFileSync(i.join(n,o.name),"utf8");if(/^\s*-?\s*~/m.test(p))return !0}catch{}return false}return r(t,0)}function d(t){let r=i.join(t,".paradigm","roster.yaml");if(!e.existsSync(r))return false;try{let n=e.readFileSync(r,"utf8"),a=f.load(n);return Array.isArray(a?.active)&&a.active.includes("compliance")}catch{return false}}function h(t){return d(t)?false:u(t)}async function y(t){try{let r=i.join(t,".paradigm");if(!e.existsSync(r))return;let n=i.join(r,l);if(e.existsSync(n)||!h(t))return;let a=["",s.yellow("[paradigm 6.0.4] Enforcement model changed."),"","This project defines ~aspects but has no compliance-archetype agent on","the roster. Previously, the Stop hook blocked on aspect drift. As of","6.0.4, the framework no longer enforces aspect coverage in absentia.","",`Run \`${s.cyan("paradigm shift")}\` to nominate Rune (compliance) for this project, or`,"ignore this notice to opt out of aspect enforcement.","",s.yellow("[paradigm 6.0.5+] Aspect anchor follow-up."),"","If you upgraded to v6.0.4 with aspect anchors that crossed directories",'(e.g., `../proxy-fetch.ts`), they may have appeared as "missing" when',"checked via paradigm_aspect_check or paradigm_aspect_drift. v6.0.5+","fixes the reader to resolve under both project-root and .purpose-dir","bases. No data migration required.","",s.dim("This message will not appear again."),""].join(`
3
+ `);console.log(a);try{e.writeFileSync(n,`Acknowledged at ${new Date().toISOString()}
4
+ `,"utf8");}catch{}}catch{}}export{y as checkAndEmitMigrationNotices,h as isCohortC};
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- export{qa as getReindexToolsList,ra as handleReindexTool,sa as rebuildStaticFiles}from'./chunk-WXF5VFB4.js';import'./chunk-M4UMM6DC.js';import'./chunk-GRZQIKST.js';import'./chunk-6QXBXZF6.js';import'./chunk-EK4ZRIFJ.js';import'./chunk-LAYBUKMB.js';import'./chunk-5TAVYPOV.js';
2
+ export{sa as getReindexToolsList,ta as handleReindexTool,ua as rebuildStaticFiles}from'./chunk-K7EQHFZP.js';import'./chunk-M4UMM6DC.js';import'./chunk-GRZQIKST.js';import'./chunk-6QXBXZF6.js';import'./chunk-EK4ZRIFJ.js';import'./chunk-LAYBUKMB.js';import'./chunk-5TAVYPOV.js';
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import {a as a$5,d as d$3,b as b$2,e as e$1,f}from'./chunk-Z72SDTBJ.js';import {b}from'./chunk-2AU5L333.js';import'./chunk-IOVHF4SR.js';import'./chunk-TYWB5IQJ.js';import'./chunk-AMLD7IYC.js';import'./chunk-FYDRENK7.js';import'./chunk-HXGYVS2N.js';import {d as d$2}from'./chunk-TQOT2LBO.js';import'./chunk-Y4XFVDZC.js';import {a as a$7}from'./chunk-DBEWOKD6.js';import {d as d$1}from'./chunk-TOYQ2QCB.js';import {a as a$4,b as b$1}from'./chunk-GE3GQALR.js';import {a as a$8}from'./chunk-XQLO5URP.js';import'./chunk-EKZDFEJW.js';import {a as a$2}from'./chunk-4PSD5R7N.js';import {b as b$3}from'./chunk-Y4P4SGZV.js';import'./chunk-4TXOVRWD.js';import'./chunk-VCKKJDLP.js';import'./chunk-WR6D3SC6.js';import {a as a$3}from'./chunk-UIKLE3WD.js';import {a as a$6}from'./chunk-UZ5H7K6Q.js';import'./chunk-LPBCQM5Y.js';import'./chunk-LWAIVOSF.js';import'./chunk-JIXHEBGK.js';import'./chunk-ZJQY5PPP.js';import'./chunk-YNDPSWOE.js';import'./chunk-VIG5LSGZ.js';import {a as a$1}from'./chunk-LKAT7IAK.js';import'./chunk-5TAVYPOV.js';import*as a from'fs';import*as ne from'os';import*as d from'path';import e from'chalk';import Se from'ora';import*as h from'js-yaml';import*as C from'fs/promises';var ae=[{path:".paradigm/config.yaml",defaultContent:['version: "2.0"','project: ""','description: ""','initialized: ""'].join(`
2
+ import {a as a$5,d as d$3,b as b$2,e as e$1,f}from'./chunk-Z72SDTBJ.js';import {b}from'./chunk-2AU5L333.js';import'./chunk-IOVHF4SR.js';import'./chunk-TYWB5IQJ.js';import'./chunk-AMLD7IYC.js';import'./chunk-FYDRENK7.js';import'./chunk-HXGYVS2N.js';import {d as d$2}from'./chunk-TQOT2LBO.js';import'./chunk-Y4XFVDZC.js';import {a as a$7}from'./chunk-5RFISGUW.js';import {d as d$1}from'./chunk-TOYQ2QCB.js';import {a as a$4,b as b$1}from'./chunk-GE3GQALR.js';import {a as a$8}from'./chunk-XQLO5URP.js';import'./chunk-EKZDFEJW.js';import {a as a$2}from'./chunk-4PSD5R7N.js';import {b as b$3}from'./chunk-Y4P4SGZV.js';import'./chunk-4TXOVRWD.js';import'./chunk-VCKKJDLP.js';import'./chunk-WR6D3SC6.js';import {a as a$3}from'./chunk-UIKLE3WD.js';import {a as a$6}from'./chunk-UZ5H7K6Q.js';import'./chunk-LPBCQM5Y.js';import'./chunk-LWAIVOSF.js';import'./chunk-JIXHEBGK.js';import'./chunk-ZJQY5PPP.js';import'./chunk-YNDPSWOE.js';import'./chunk-VIG5LSGZ.js';import {a as a$1}from'./chunk-LKAT7IAK.js';import'./chunk-5TAVYPOV.js';import*as a from'fs';import*as ne from'os';import*as d from'path';import e from'chalk';import Se from'ora';import*as h from'js-yaml';import*as C from'fs/promises';var ae=[{path:".paradigm/config.yaml",defaultContent:['version: "2.0"','project: ""','description: ""','initialized: ""'].join(`
3
3
  `)+`
4
4
  `},{path:".paradigm/agents.yaml",defaultContent:['version: "1.0"',"agents: []"].join(`
5
5
  `)+`
@@ -48,13 +48,13 @@ Generated by paradigm shift.
48
48
 
49
49
  Generated by paradigm shift.
50
50
  `},{path:".cursor/rules/",defaultContent:"",isDir:true},{path:".claude/hooks/",defaultContent:"",isDir:true}];async function Q(o){let n=[],l=[];for(let r of ae){let f=d.join(o,r.path);if(r.isDir)await X(f)?l.push(r.path):(await C.mkdir(f,{recursive:true}),n.push(r.path));else if(await X(f))l.push(r.path);else {let i=d.dirname(f);await C.mkdir(i,{recursive:true}),await C.writeFile(f,r.defaultContent,"utf-8"),n.push(r.path);}}return {created:n,existed:l}}async function X(o){try{return await C.access(o),!0}catch{return false}}var ie=4,se=50,ce=['description: ""',"components: []","description: ''"],le={"claude-code":["opus","sonnet","haiku"],cursor:["sonnet","sonnet","haiku"],fallback:["sonnet","sonnet","sonnet"]};async function Z(o){let n=await Promise.allSettled([de(o),pe(o),fe(o),me(o),ue(o),ge(o),ye(o),he(o),we()]),l=[];for(let i of n)i.status==="fulfilled"&&i.value&&l.push(i.value);l.sort((i,b)=>i.priority-b.priority);let r=l.filter(i=>i.type==="action"),f=l.filter(i=>i.type==="info");return [...r.slice(0,ie),...f]}function ee(o){if(o.length===0)return "";let n=o.filter(m=>m.type==="action"),l=o.filter(m=>m.type==="info"),r=[];r.push(""),r.push(e.bold(" Recommendations")),r.push(e.gray(" "+"\u2500".repeat(49)));for(let m=0;m<n.length;m++){let i=n[m],b=e.white(` ${m+1}. `),S=e.white(i.message);i.command?(r.push(b+S),r.push(" "+e.cyan(i.command))):r.push(b+S);}if(l.length>0){r.push("");for(let m of l)r.push(e.dim(" "+m.message));}let f=n.length;if(f>0){r.push("");let m=f===1?"item needs":"items need";r.push(e.dim(` ${f} ${m} attention.`));}return r.push(""),r.join(`
51
- `)}async function de(o){let n=d.join(o,".purpose");try{let l=await C.readFile(n,"utf-8");if(l.trim().length<se)return {id:"empty-purpose",priority:1,message:"Edit `.purpose` to define your project's features",command:void 0,type:"action"};if(ce.some(f=>l.includes(f)))return {id:"empty-purpose",priority:1,message:"Edit `.purpose` to define your project's features",command:void 0,type:"action"}}catch{return {id:"empty-purpose",priority:1,message:"Edit `.purpose` to define your project's features",command:void 0,type:"action"}}return null}async function pe(o){let n=["src","packages","apps"];for(let r of n){let f=d.join(o,r);if(!a.existsSync(f))continue;if(await te(f))return null}return n.some(r=>a.existsSync(d.join(o,r)))?{id:"no-sub-purpose",priority:2,message:"Add `.purpose` files to feature directories",command:void 0,type:"action"}:null}async function fe(o){let n=d.join(o,"portal.yaml");try{let l=await C.readFile(n,"utf-8"),r=l.includes("gates:")&&!l.match(/gates:\s*(\[\]|\{\})\s*$/m)&&!l.match(/gates:\s*(\[\]|\{\})\s*\n/),f=l.includes("routes:")&&!l.match(/routes:\s*(\[\]|\{\})\s*$/m)&&!l.match(/routes:\s*(\[\]|\{\})\s*\n/);if(!r&&!f)return {id:"empty-portal",priority:3,message:"Define auth gates in `portal.yaml` if your project has auth",command:void 0,type:"action"}}catch{return {id:"empty-portal",priority:3,message:"Define auth gates in `portal.yaml` if your project has auth",command:void 0,type:"action"}}return null}async function me(o){let n=d.join(o,".paradigm","agents.yaml");try{let l=await C.readFile(n,"utf-8");if(l.includes("agents: []")||l.trim().length<40)return {id:"agents-unconfigured",priority:4,message:"Review agent roles",command:"paradigm agent list",type:"action"}}catch{return null}return null}async function ue(o){let n=d.join(o,".paradigm",".pending-scope-reviews");return a.existsSync(n)?{id:"pending-scope-reviews",priority:2,message:"Review agent scopes",command:"paradigm agent review",type:"action"}:null}async function ge(o){let n=d.join(o,".paradigm","config.yaml");try{let l=await C.readFile(n,"utf-8");if(!l.includes("model-resolution"))return null;let r=l.match(/tier-1:\s*(\S+)/),f=l.match(/tier-2:\s*(\S+)/),m=l.match(/tier-3:\s*(\S+)/);if(!r||!f||!m)return null;let i=[r[1].replace(/['"]/g,""),f[1].replace(/['"]/g,""),m[1].replace(/['"]/g,"")];if(Object.values(le).some(S=>S[0]===i[0]&&S[1]===i[1]&&S[2]===i[2]))return {id:"model-tiers-default",priority:5,message:"Fine-tune model tiers",command:"paradigm team models",type:"action"}}catch{return null}return null}async function ye(o){let n=d.join(o,".paradigm","lore","entries");try{if((await C.readdir(n)).filter(f=>!f.startsWith(".")).length===0)return {id:"no-lore",priority:8,message:"Lore records automatically as you work",command:void 0,type:"info"}}catch{return {id:"no-lore",priority:8,message:"Lore records automatically as you work",command:void 0,type:"info"}}return null}async function he(o){let n=d.join(o,".paradigm","notebooks");try{if((await C.readdir(n)).filter(f=>!f.startsWith(".")).length===0)return {id:"no-notebooks",priority:8,message:"Agent notebooks build over time",command:void 0,type:"info"}}catch{return {id:"no-notebooks",priority:8,message:"Agent notebooks build over time",command:void 0,type:"info"}}return null}async function we(){return {id:"verify-not-run",priority:6,message:"Verify setup health",command:"paradigm doctor --verify",type:"action"}}async function te(o,n=0){if(n>4)return false;try{let l=await C.readdir(o,{withFileTypes:!0});for(let r of l)if(!(r.isDirectory()&&["node_modules","dist",".git",".next",".paradigm","build","out","target",".turbo"].includes(r.name))&&(r.name===".purpose"&&!r.isDirectory()||r.isDirectory()&&await te(d.join(o,r.name),n+1)))return !0}catch{a$1.operation("shift-recommendations").debug("Could not read directory",{dir:o});}return false}var oe=new Set(["architect","builder","reviewer","security","advocate","tester","compliance","documentor"]),I={architect:{nickname:"Apex",role:"System design, specifications"},builder:{nickname:"Kit",role:"Implementation, tests"},reviewer:{nickname:"Judge",role:"Code quality, compliance"},security:{nickname:"Aegis",role:"Auth flows, vulnerability scanning"},advocate:{nickname:"Jinx",role:"Stress testing, edge cases"},tester:{nickname:"Probe",role:"Unit and integration tests"},compliance:{nickname:"Rune",role:"Symbol compliance enforcement"},documentor:{nickname:"Scribe",role:".purpose, portal.yaml maintenance"}};function ke(o){let n=[],l=d.join(ne.homedir(),".paradigm","agents");for(let[r,f]of Object.entries(o.agents)){let m,i=r,b=d.join(l,`${r}.agent`);if(a.existsSync(b))try{let v=a.readFileSync(b,"utf8"),E=h.load(v);E?.nickname&&(m=E.nickname),E?.role&&(i=E.role);}catch{}!m&&I[r]&&(m=I[r].nickname,i=I[r].role);let S=f.source==="core"||f.source==="ecosystem"?f.source:oe.has(r)?"core":"ecosystem";n.push({id:r,nickname:m,role:i,source:S});}return n}async function be(o,n,l){if(!a.existsSync(n))return;let r;try{r=h.load(a.readFileSync(n,"utf8"))??{active:[]};}catch{return}let f=Array.isArray(r.active)?r.active:[];if(f.includes("compliance"))return;let{isCohortC:m}=await import('./migration-notices-BHLEYC4T.js');if(!m(o))return;let i=d.join(o,".paradigm",".compliance-nomination-skipped");if(a.existsSync(i)&&!l.force)return;if(!process.stdin.isTTY||l.prompt===false){try{a.writeFileSync(i,"","utf8");}catch{}return}console.log(""),console.log(e.cyan("Step 2c-nominate/6: Symbol enforcement")),console.log(""),console.log(" This project defines ~aspects but no compliance-archetype agent"),console.log(" (Rune) is on the roster."),console.log(""),console.log(" Without a claimant, paradigm 6.0.4 no longer enforces aspect"),console.log(" coverage. You can:"),console.log(""),console.log(` ${e.green("[Y]")} Add Rune (compliance) to the roster \u2014 recommended`),console.log(" Authority defaults will be written to .paradigm/authority.yaml."),console.log(" Default mode: advise (Rune surfaces findings, never blocks)."),console.log(""),console.log(` ${e.yellow("[N]")} Skip \u2014 opt out of aspect enforcement for this project`),console.log(" This decision is remembered. Re-run with --force to revisit."),console.log("");let S=(await import('readline/promises')).createInterface({input:process.stdin,output:process.stdout}),v="";try{v=(await S.question(" Add Rune to roster? [Y/n]: ")).trim().toLowerCase();}catch{v="";}finally{S.close();}if(v===""||v==="y"||v==="yes"){r.active=[...f,"compliance"].sort();try{a.writeFileSync(n,h.dump(r,{lineWidth:-1,noRefs:!0}),"utf8"),console.log(e.green(" \u2713 Rune (compliance) added to roster"));}catch(x){a$1.operation("shift").debug("Roster update failed",{error:x.message});return}try{let{writeArchetypeDefaults:x}=await import('./authority-FA3HLEOA.js');await x(o,"archetype-default"),console.log(e.gray(" \u2713 Authority defaults written to .paradigm/authority.yaml"));}catch(x){a$1.operation("shift").debug("Authority defaults write failed",{error:x.message});}if(a.existsSync(i))try{a.unlinkSync(i);}catch{}}else {try{a.writeFileSync(i,"","utf8");}catch{}console.log(e.gray(" Skipped \u2014 opt out of aspect enforcement for this project"));}}async function Le(o={}){let n=process.cwd(),l=d.basename(n),r=d.join(n,".paradigm"),f$1=a.existsSync(r)&&a.statSync(r).isDirectory();console.log(e.blue(`
51
+ `)}async function de(o){let n=d.join(o,".purpose");try{let l=await C.readFile(n,"utf-8");if(l.trim().length<se)return {id:"empty-purpose",priority:1,message:"Edit `.purpose` to define your project's features",command:void 0,type:"action"};if(ce.some(f=>l.includes(f)))return {id:"empty-purpose",priority:1,message:"Edit `.purpose` to define your project's features",command:void 0,type:"action"}}catch{return {id:"empty-purpose",priority:1,message:"Edit `.purpose` to define your project's features",command:void 0,type:"action"}}return null}async function pe(o){let n=["src","packages","apps"];for(let r of n){let f=d.join(o,r);if(!a.existsSync(f))continue;if(await te(f))return null}return n.some(r=>a.existsSync(d.join(o,r)))?{id:"no-sub-purpose",priority:2,message:"Add `.purpose` files to feature directories",command:void 0,type:"action"}:null}async function fe(o){let n=d.join(o,"portal.yaml");try{let l=await C.readFile(n,"utf-8"),r=l.includes("gates:")&&!l.match(/gates:\s*(\[\]|\{\})\s*$/m)&&!l.match(/gates:\s*(\[\]|\{\})\s*\n/),f=l.includes("routes:")&&!l.match(/routes:\s*(\[\]|\{\})\s*$/m)&&!l.match(/routes:\s*(\[\]|\{\})\s*\n/);if(!r&&!f)return {id:"empty-portal",priority:3,message:"Define auth gates in `portal.yaml` if your project has auth",command:void 0,type:"action"}}catch{return {id:"empty-portal",priority:3,message:"Define auth gates in `portal.yaml` if your project has auth",command:void 0,type:"action"}}return null}async function me(o){let n=d.join(o,".paradigm","agents.yaml");try{let l=await C.readFile(n,"utf-8");if(l.includes("agents: []")||l.trim().length<40)return {id:"agents-unconfigured",priority:4,message:"Review agent roles",command:"paradigm agent list",type:"action"}}catch{return null}return null}async function ue(o){let n=d.join(o,".paradigm",".pending-scope-reviews");return a.existsSync(n)?{id:"pending-scope-reviews",priority:2,message:"Review agent scopes",command:"paradigm agent review",type:"action"}:null}async function ge(o){let n=d.join(o,".paradigm","config.yaml");try{let l=await C.readFile(n,"utf-8");if(!l.includes("model-resolution"))return null;let r=l.match(/tier-1:\s*(\S+)/),f=l.match(/tier-2:\s*(\S+)/),m=l.match(/tier-3:\s*(\S+)/);if(!r||!f||!m)return null;let i=[r[1].replace(/['"]/g,""),f[1].replace(/['"]/g,""),m[1].replace(/['"]/g,"")];if(Object.values(le).some(S=>S[0]===i[0]&&S[1]===i[1]&&S[2]===i[2]))return {id:"model-tiers-default",priority:5,message:"Fine-tune model tiers",command:"paradigm team models",type:"action"}}catch{return null}return null}async function ye(o){let n=d.join(o,".paradigm","lore","entries");try{if((await C.readdir(n)).filter(f=>!f.startsWith(".")).length===0)return {id:"no-lore",priority:8,message:"Lore records automatically as you work",command:void 0,type:"info"}}catch{return {id:"no-lore",priority:8,message:"Lore records automatically as you work",command:void 0,type:"info"}}return null}async function he(o){let n=d.join(o,".paradigm","notebooks");try{if((await C.readdir(n)).filter(f=>!f.startsWith(".")).length===0)return {id:"no-notebooks",priority:8,message:"Agent notebooks build over time",command:void 0,type:"info"}}catch{return {id:"no-notebooks",priority:8,message:"Agent notebooks build over time",command:void 0,type:"info"}}return null}async function we(){return {id:"verify-not-run",priority:6,message:"Verify setup health",command:"paradigm doctor --verify",type:"action"}}async function te(o,n=0){if(n>4)return false;try{let l=await C.readdir(o,{withFileTypes:!0});for(let r of l)if(!(r.isDirectory()&&["node_modules","dist",".git",".next",".paradigm","build","out","target",".turbo"].includes(r.name))&&(r.name===".purpose"&&!r.isDirectory()||r.isDirectory()&&await te(d.join(o,r.name),n+1)))return !0}catch{a$1.operation("shift-recommendations").debug("Could not read directory",{dir:o});}return false}var oe=new Set(["architect","builder","reviewer","security","advocate","tester","compliance","documentor"]),I={architect:{nickname:"Apex",role:"System design, specifications"},builder:{nickname:"Kit",role:"Implementation, tests"},reviewer:{nickname:"Judge",role:"Code quality, compliance"},security:{nickname:"Aegis",role:"Auth flows, vulnerability scanning"},advocate:{nickname:"Jinx",role:"Stress testing, edge cases"},tester:{nickname:"Probe",role:"Unit and integration tests"},compliance:{nickname:"Rune",role:"Symbol compliance enforcement"},documentor:{nickname:"Scribe",role:".purpose, portal.yaml maintenance"}};function ke(o){let n=[],l=d.join(ne.homedir(),".paradigm","agents");for(let[r,f]of Object.entries(o.agents)){let m,i=r,b=d.join(l,`${r}.agent`);if(a.existsSync(b))try{let v=a.readFileSync(b,"utf8"),E=h.load(v);E?.nickname&&(m=E.nickname),E?.role&&(i=E.role);}catch{}!m&&I[r]&&(m=I[r].nickname,i=I[r].role);let S=f.source==="core"||f.source==="ecosystem"?f.source:oe.has(r)?"core":"ecosystem";n.push({id:r,nickname:m,role:i,source:S});}return n}async function be(o,n,l){if(!a.existsSync(n))return;let r;try{r=h.load(a.readFileSync(n,"utf8"))??{active:[]};}catch{return}let f=Array.isArray(r.active)?r.active:[];if(f.includes("compliance"))return;let{isCohortC:m}=await import('./migration-notices-MRZ6PVDS.js');if(!m(o))return;let i=d.join(o,".paradigm",".compliance-nomination-skipped");if(a.existsSync(i)&&!l.force)return;if(!process.stdin.isTTY||l.prompt===false){try{a.writeFileSync(i,"","utf8");}catch{}return}console.log(""),console.log(e.cyan("Step 2c-nominate/6: Symbol enforcement")),console.log(""),console.log(" This project defines ~aspects but no compliance-archetype agent"),console.log(" (Rune) is on the roster."),console.log(""),console.log(" Without a claimant, paradigm 6.0.4 no longer enforces aspect"),console.log(" coverage. You can:"),console.log(""),console.log(` ${e.green("[Y]")} Add Rune (compliance) to the roster \u2014 recommended`),console.log(" Authority defaults will be written to .paradigm/authority.yaml."),console.log(" Default mode: advise (Rune surfaces findings, never blocks)."),console.log(""),console.log(` ${e.yellow("[N]")} Skip \u2014 opt out of aspect enforcement for this project`),console.log(" This decision is remembered. Re-run with --force to revisit."),console.log("");let S=(await import('readline/promises')).createInterface({input:process.stdin,output:process.stdout}),v="";try{v=(await S.question(" Add Rune to roster? [Y/n]: ")).trim().toLowerCase();}catch{v="";}finally{S.close();}if(v===""||v==="y"||v==="yes"){r.active=[...f,"compliance"].sort();try{a.writeFileSync(n,h.dump(r,{lineWidth:-1,noRefs:!0}),"utf8"),console.log(e.green(" \u2713 Rune (compliance) added to roster"));}catch(x){a$1.operation("shift").debug("Roster update failed",{error:x.message});return}try{let{writeArchetypeDefaults:x}=await import('./authority-GCMPX7RW.js');await x(o,"archetype-default"),console.log(e.gray(" \u2713 Authority defaults written to .paradigm/authority.yaml"));}catch(x){a$1.operation("shift").debug("Authority defaults write failed",{error:x.message});}if(a.existsSync(i))try{a.unlinkSync(i);}catch{}}else {try{a.writeFileSync(i,"","utf8");}catch{}console.log(e.gray(" Skipped \u2014 opt out of aspect enforcement for this project"));}}async function Le(o={}){let n=process.cwd(),l=d.basename(n),r=d.join(n,".paradigm"),f$1=a.existsSync(r)&&a.statSync(r).isDirectory();console.log(e.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(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
53
53
  `)),console.log(e.white(` \u{1F4C1} Project: ${e.cyan(l)}`)),console.log(e.white(` \u{1F4CD} Status: ${f$1?e.green("Paradigm detected"):e.yellow("New project")}`)),console.log("");let m=a$1.command("shift").start("Running paradigm shift",{project:l}),i=Se();if(!f$1||o.force){i.start("Step 1/6: Initializing Paradigm...");try{await a$2({force:o.force,quick:!0,name:l,stack:o.stack}),i.succeed(e.green("Paradigm initialized"));}catch(t){i.fail(e.red(`Init failed: ${t.message}`)),m.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=d.join(r,"config.yaml");if(a.existsSync(t))try{let s=a.readFileSync(t,"utf8"),c=h.load(s);if(!c.discipline||c.discipline==="auto"){let p=a$3(n);if(p!=="backend"){let u=s.replace(/^discipline:\s*auto\b.*$/m,`discipline: ${p}`);u!==s&&(a.writeFileSync(t,u,"utf8"),console.log(e.green(` \u2713 Detected discipline: ${e.cyan(p)} (updated config.yaml)`)));}else if(!c.discipline){let u=s.replace(/^(project:\s*.+)$/m,`$1
54
- discipline: ${p}`);u!==s&&(a.writeFileSync(t,u,"utf8"),console.log(e.green(` \u2713 Added discipline: ${e.cyan(p)} to config.yaml`)));}}}catch(s){a$1.operation("shift").debug("Discipline detection failed",{error:s.message});}}if(f$1){i.start("Step 1b/6: Checking for migrations...");try{let{migrateCommand:t}=await import('./migrate-ZPNYDNM4.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=d.join(r,"config.yaml");if(o.workspace&&a.existsSync(t)){let s=o.workspacePath?d.resolve(n,o.workspacePath):d.join(d.dirname(n),".paradigm-workspace");if(a.existsSync(s))try{let c=h.load(a.readFileSync(s,"utf8")),p=d.basename(n),u=d.dirname(s),g="./"+d.relative(u,n);if(c.members.some(j=>d.resolve(u,j.path)===n))console.log(e.green(` \u2713 Already a member of workspace: ${e.cyan(c.name)}`));else {let j=d$1(p,n);c.members.push({name:p,path:g,...j&&{role:j}}),a.writeFileSync(s,h.dump(c,{indent:2,lineWidth:120,noRefs:!0,sortKeys:!1,quotingType:'"'}),"utf8"),console.log(e.green(` \u2713 Joined workspace: ${e.cyan(c.name)} (added as member)`));}}catch(c){console.log(e.yellow(` \u26A0 Failed to join workspace: ${c.message}`));}else try{let c=d.basename(n),p=d.dirname(s),u="./"+d.relative(p,n),g=d$1(c,n),y={version:"1.0",name:o.workspace,members:[{name:c,path:u,...g&&{role:g}}]};a.mkdirSync(d.dirname(s),{recursive:!0}),a.writeFileSync(s,h.dump(y,{indent:2,lineWidth:120,noRefs:!0,sortKeys:!1,quotingType:'"'}),"utf8"),console.log(e.green(` \u2713 Created workspace: ${e.cyan(o.workspace)} at ${e.gray(d.relative(n,s))}`));}catch(c){console.log(e.yellow(` \u26A0 Failed to create workspace: ${c.message}`));}try{let c=a.readFileSync(t,"utf8"),p=h.load(c),u=d.relative(n,s);if(p.workspace!==u){if(p.workspace){let g=c.replace(/^workspace:\s*.*$/m,`workspace: "${u}"`);a.writeFileSync(t,g,"utf8");}else {let g=c.trimEnd()+`
54
+ discipline: ${p}`);u!==s&&(a.writeFileSync(t,u,"utf8"),console.log(e.green(` \u2713 Added discipline: ${e.cyan(p)} to config.yaml`)));}}}catch(s){a$1.operation("shift").debug("Discipline detection failed",{error:s.message});}}if(f$1){i.start("Step 1b/6: Checking for migrations...");try{let{migrateCommand:t}=await import('./migrate-R64OQGSM.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=d.join(r,"config.yaml");if(o.workspace&&a.existsSync(t)){let s=o.workspacePath?d.resolve(n,o.workspacePath):d.join(d.dirname(n),".paradigm-workspace");if(a.existsSync(s))try{let c=h.load(a.readFileSync(s,"utf8")),p=d.basename(n),u=d.dirname(s),g="./"+d.relative(u,n);if(c.members.some(j=>d.resolve(u,j.path)===n))console.log(e.green(` \u2713 Already a member of workspace: ${e.cyan(c.name)}`));else {let j=d$1(p,n);c.members.push({name:p,path:g,...j&&{role:j}}),a.writeFileSync(s,h.dump(c,{indent:2,lineWidth:120,noRefs:!0,sortKeys:!1,quotingType:'"'}),"utf8"),console.log(e.green(` \u2713 Joined workspace: ${e.cyan(c.name)} (added as member)`));}}catch(c){console.log(e.yellow(` \u26A0 Failed to join workspace: ${c.message}`));}else try{let c=d.basename(n),p=d.dirname(s),u="./"+d.relative(p,n),g=d$1(c,n),y={version:"1.0",name:o.workspace,members:[{name:c,path:u,...g&&{role:g}}]};a.mkdirSync(d.dirname(s),{recursive:!0}),a.writeFileSync(s,h.dump(y,{indent:2,lineWidth:120,noRefs:!0,sortKeys:!1,quotingType:'"'}),"utf8"),console.log(e.green(` \u2713 Created workspace: ${e.cyan(o.workspace)} at ${e.gray(d.relative(n,s))}`));}catch(c){console.log(e.yellow(` \u26A0 Failed to create workspace: ${c.message}`));}try{let c=a.readFileSync(t,"utf8"),p=h.load(c),u=d.relative(n,s);if(p.workspace!==u){if(p.workspace){let g=c.replace(/^workspace:\s*.*$/m,`workspace: "${u}"`);a.writeFileSync(t,g,"utf8");}else {let g=c.trimEnd()+`
55
55
  workspace: "${u}"
56
56
  `;a.writeFileSync(t,g,"utf8");}console.log(e.green(" \u2713 Linked workspace in config.yaml"));}}catch(c){a$1.operation("shift").debug("Workspace config link failed",{error:c.message});}}else if(a.existsSync(t))try{let s=a.readFileSync(t,"utf8");if(!h.load(s).workspace){let p=d.dirname(n);for(let u=0;u<3;u++){let g=d.join(p,".paradigm-workspace");if(a.existsSync(g)){let j=d.relative(n,g),re=s.trimEnd()+`
57
57
  workspace: "${j}"
58
58
  `;a.writeFileSync(t,re,"utf8"),console.log(e.green(` \u2713 Found workspace: ${e.cyan(j)} (added to config.yaml)`));break}let y=d.dirname(p);if(y===p)break;p=y;}}}catch(s){a$1.operation("shift").debug("Workspace auto-detect failed",{error:s.message});}}if(!d$2(n)||o.force){console.log(e.cyan(" Step 2/6: Initializing team configuration..."));try{await b(n,{force:o.force,json:!1,configureModels:o.configureModels||!1,noConfigureModels:!o.configureModels}),console.log(e.green(` \u2713 Team configuration initialized
59
59
  `));}catch(t){console.log(e.yellow(` \u26A0 Team init warning: ${t.message}
60
- `));}}else i.succeed(e.gray("Step 2/6: Team already configured (use --force to reinit)"));if(o.force){let t=d.join(n,".paradigm",".compliance-nomination-skipped");if(a.existsSync(t))try{a.unlinkSync(t);}catch{}}let S=d.join(n,".paradigm","roster.yaml");if(!a.existsSync(S)||o.force)try{let t=a$4(n),s=b$1[t]||b$1.generic,c={version:"1.0",project:l,type:t,active:s.sort()};a.writeFileSync(S,h.dump(c,{lineWidth:-1,noRefs:!0}),"utf8"),console.log(e.green(` \u2713 Agent roster set: ${e.cyan(s.length)} agents for ${e.cyan(t)}`));}catch(t){a$1.operation("shift").debug("Roster setup failed",{error:t.message});}else try{let s=h.load(a.readFileSync(S,"utf8"))?.active?.length??0;console.log(e.gray(` \u2713 Agent roster exists (${s} agents active)`));}catch{console.log(e.gray(" \u2713 Agent roster exists"));}await be(n,S,o);{let t=d.join(n,".paradigm","adoptions.yaml"),s=a.existsSync(t);try{let c=a$4(n),p=s?await a$5(n):null,u=p&&Object.keys(p.agents).length>0;if(!u&&a.existsSync(S))p=await d$3(n),await b$2(n,p),a$1.operation("shift").debug("Migrated roster to adoptions",{count:Object.keys(p.agents).length});else if(!u){p=e$1(c);let g=a.existsSync(S)?h.load(a.readFileSync(S,"utf8")):{active:[]},y=new Date().toISOString();for(let j of g.active||[])p.agents[j]={adopted:y,source:oe.has(j)?"core":"ecosystem",defaultsAccepted:!0};Object.keys(p.agents).length>0&&await b$2(n,p);}if(p&&Object.keys(p.agents).length>0){let g=ke(p),y=f(g,c);console.log(y),console.log(e.green(` \u2713 ${Object.keys(p.agents).length} agents adopted`));}if(p&&p.agents.compliance){let g=d.join(n,".paradigm","authority.yaml");if(!a.existsSync(g))try{let{writeArchetypeDefaults:y}=await import('./authority-FA3HLEOA.js');await y(n,"archetype-default"),a$1.operation("shift").debug("Wrote archetype-default authority.yaml",{source:"default-adoption"});}catch(y){a$1.operation("shift").debug("Authority defaults write failed",{error:y.message});}}}catch(c){a$1.operation("shift").debug("Adoption ceremony failed",{error:c.message});}}{let t=d.join(r,"config.yaml");if(a.existsSync(t))try{let s=a.readFileSync(t,"utf8"),c=h.load(s);if(!c["model-resolution"]||o.force){let{ModelDiscovery:p}=await import('./model-discovery-HMB3YI4L.js'),g=new p(n).detectEnvironment(),y;g==="claude-code"?y={"tier-1":"opus","tier-2":"sonnet","tier-3":"haiku"}:g==="cursor"?y={"tier-1":"sonnet","tier-2":"sonnet","tier-3":"haiku"}:y={"tier-1":"sonnet","tier-2":"sonnet","tier-3":"sonnet"},c["model-resolution"]=y,a.writeFileSync(t,h.dump(c,{lineWidth:-1,noRefs:!0}),"utf8"),console.log(e.green(` \u2713 Model tiers configured for ${e.cyan(g)}: tier-1=${y["tier-1"]}, tier-2=${y["tier-2"]}, tier-3=${y["tier-3"]}`));}}catch(s){a$1.operation("shift").debug("Model tier config failed",{error:s.message});}}try{let{ensureEnforcementDefaults:t}=await import('./enforcement-BEGPQIUN.js');t(n)&&console.log(e.green(` \u2713 Enforcement config initialized (${e.cyan("balanced")} preset)`));}catch(t){a$1.operation("shift").debug("Enforcement config setup failed",{error:t.message});}{i.start("Ensuring core files...");try{let{created:t,existed:s}=await Q(n);i.succeed(e.green(`Core files ensured: ${e.cyan(String(t.length))} created, ${e.cyan(String(s.length))} already existed`));}catch(t){i.warn(e.yellow(`Guaranteed files warning: ${t.message}`));}}if(o.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$3(n,{quiet:!0}),i.succeed(e.green("Symbols indexed"));}catch(t){i.warn(e.yellow(`Scan warning: ${t.message}`));}}{let t=d.join(r,"config.yaml");if(a.existsSync(t))try{if(h.load(a.readFileSync(t,"utf8")).workspace){i.start("Step 3b/6: Reindexing workspace members...");try{let{workspaceReindexCommand:c}=await import('./workspace-VMSPYIBV.js');await c({quiet:!0}),i.succeed(e.green("Workspace members reindexed"));}catch(c){i.warn(e.yellow(`Workspace reindex: ${c.message}`));}}}catch(s){a$1.operation("shift").debug("Workspace config read failed",{error:s.message});}}let v=d.join(n,"portal.yaml");a.existsSync(v)||a.writeFileSync(v,h.dump({version:"1.0.0",gates:{},routes:{}},{lineWidth:-1,noRefs:true}),"utf8");let E=d.join(n,".paradigm","lore");a.existsSync(E)||a.mkdirSync(E,{recursive:true});let x=d.join(n,".paradigm","university");for(let t of ["content/notes","content/policies","content/quizzes","content/paths","diplomas"]){let s=d.join(x,t);a.existsSync(s)||a.mkdirSync(s,{recursive:true});}let N=d.join(x,"config.yaml");if(!a.existsSync(N)){let t="Project";try{let c=d.join(n,".paradigm","config.yaml");if(a.existsSync(c)){let p=h.load(a.readFileSync(c,"utf8"));p.project&&typeof p.project=="string"&&(t=p.project);}}catch{}let s={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}};a.writeFileSync(N,h.dump(s,{lineWidth:-1,noRefs:true}),"utf8");}i.start("Step 4/6: Syncing IDE configurations...");try{let t=o.ide?[o.ide]:["claude","cursor","copilot","windsurf","agents"],s=[];for(let c of t)try{await a$6(c,{quiet:!0,force:!0}),s.push(c);}catch{}s.length>0?i.succeed(e.green(`IDE configs synced: ${s.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$7({force:o.force}),i.succeed(e.green("Hooks installed (git + Claude Code + Cursor)"));}catch(t){i.warn(e.yellow(`Hooks warning: ${t.message}`));}if(o.verify){i.start("Step 6/6: Running health checks...");try{await a$8({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 O=[{path:".paradigm/config.yaml",desc:"Project configuration"},{path:".paradigm/navigator.yaml",desc:"Symbol navigation map"},{path:".paradigm/agents.yaml",desc:"Team agent configuration"},{path:".paradigm/adoptions.yaml",desc:"Agent adoption records"},{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}],W=d.join(r,"config.yaml");if(a.existsSync(W))try{let t=h.load(a.readFileSync(W,"utf8"));if(typeof t.workspace=="string"){let s=d.resolve(n,t.workspace),c=d.relative(n,s);O.push({path:c,desc:"Multi-project workspace",optional:!0});}}catch(t){a$1.operation("shift").debug("Summary config read failed",{error:t.message});}for(let t of O){let s=d.join(n,t.path);a.existsSync(s)?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})`));}try{let t=await Z(n),s=ee(t);s&&console.log(s);}catch(t){a$1.operation("shift").debug("Recommendations engine failed",{error:t.message}),console.log(""),console.log(e.white(" Next steps:")),console.log(e.gray(" "+"\u2500".repeat(49))),console.log(e.white(" 1. ")+e.gray("Edit ")+e.cyan(".purpose")+e.gray(" to define your features")),console.log(e.white(" 2. ")+e.gray("Run ")+e.cyan("paradigm shift --verify")+e.gray(" to check health")),console.log("");}try{let{captureSnapshot:t,seedMetricsConsent:s}=await import('./metrics-UESGUHTA.js');s(n),t(n);}catch(t){a$1.operation("shift").debug("metrics snapshot failed",{error:t.message});}m.success("Paradigm shift complete",{project:l});}export{be as runComplianceNominationStep,Le as shiftCommand};
60
+ `));}}else i.succeed(e.gray("Step 2/6: Team already configured (use --force to reinit)"));if(o.force){let t=d.join(n,".paradigm",".compliance-nomination-skipped");if(a.existsSync(t))try{a.unlinkSync(t);}catch{}}let S=d.join(n,".paradigm","roster.yaml");if(!a.existsSync(S)||o.force)try{let t=a$4(n),s=b$1[t]||b$1.generic,c={version:"1.0",project:l,type:t,active:s.sort()};a.writeFileSync(S,h.dump(c,{lineWidth:-1,noRefs:!0}),"utf8"),console.log(e.green(` \u2713 Agent roster set: ${e.cyan(s.length)} agents for ${e.cyan(t)}`));}catch(t){a$1.operation("shift").debug("Roster setup failed",{error:t.message});}else try{let s=h.load(a.readFileSync(S,"utf8"))?.active?.length??0;console.log(e.gray(` \u2713 Agent roster exists (${s} agents active)`));}catch{console.log(e.gray(" \u2713 Agent roster exists"));}await be(n,S,o);{let t=d.join(n,".paradigm","adoptions.yaml"),s=a.existsSync(t);try{let c=a$4(n),p=s?await a$5(n):null,u=p&&Object.keys(p.agents).length>0;if(!u&&a.existsSync(S))p=await d$3(n),await b$2(n,p),a$1.operation("shift").debug("Migrated roster to adoptions",{count:Object.keys(p.agents).length});else if(!u){p=e$1(c);let g=a.existsSync(S)?h.load(a.readFileSync(S,"utf8")):{active:[]},y=new Date().toISOString();for(let j of g.active||[])p.agents[j]={adopted:y,source:oe.has(j)?"core":"ecosystem",defaultsAccepted:!0};Object.keys(p.agents).length>0&&await b$2(n,p);}if(p&&Object.keys(p.agents).length>0){let g=ke(p),y=f(g,c);console.log(y),console.log(e.green(` \u2713 ${Object.keys(p.agents).length} agents adopted`));}if(p&&p.agents.compliance){let g=d.join(n,".paradigm","authority.yaml");if(!a.existsSync(g))try{let{writeArchetypeDefaults:y}=await import('./authority-GCMPX7RW.js');await y(n,"archetype-default"),a$1.operation("shift").debug("Wrote archetype-default authority.yaml",{source:"default-adoption"});}catch(y){a$1.operation("shift").debug("Authority defaults write failed",{error:y.message});}}}catch(c){a$1.operation("shift").debug("Adoption ceremony failed",{error:c.message});}}{let t=d.join(r,"config.yaml");if(a.existsSync(t))try{let s=a.readFileSync(t,"utf8"),c=h.load(s);if(!c["model-resolution"]||o.force){let{ModelDiscovery:p}=await import('./model-discovery-HMB3YI4L.js'),g=new p(n).detectEnvironment(),y;g==="claude-code"?y={"tier-1":"opus","tier-2":"sonnet","tier-3":"haiku"}:g==="cursor"?y={"tier-1":"sonnet","tier-2":"sonnet","tier-3":"haiku"}:y={"tier-1":"sonnet","tier-2":"sonnet","tier-3":"sonnet"},c["model-resolution"]=y,a.writeFileSync(t,h.dump(c,{lineWidth:-1,noRefs:!0}),"utf8"),console.log(e.green(` \u2713 Model tiers configured for ${e.cyan(g)}: tier-1=${y["tier-1"]}, tier-2=${y["tier-2"]}, tier-3=${y["tier-3"]}`));}}catch(s){a$1.operation("shift").debug("Model tier config failed",{error:s.message});}}try{let{ensureEnforcementDefaults:t}=await import('./enforcement-BEGPQIUN.js');t(n)&&console.log(e.green(` \u2713 Enforcement config initialized (${e.cyan("balanced")} preset)`));}catch(t){a$1.operation("shift").debug("Enforcement config setup failed",{error:t.message});}{i.start("Ensuring core files...");try{let{created:t,existed:s}=await Q(n);i.succeed(e.green(`Core files ensured: ${e.cyan(String(t.length))} created, ${e.cyan(String(s.length))} already existed`));}catch(t){i.warn(e.yellow(`Guaranteed files warning: ${t.message}`));}}if(o.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$3(n,{quiet:!0}),i.succeed(e.green("Symbols indexed"));}catch(t){i.warn(e.yellow(`Scan warning: ${t.message}`));}}{let t=d.join(r,"config.yaml");if(a.existsSync(t))try{if(h.load(a.readFileSync(t,"utf8")).workspace){i.start("Step 3b/6: Reindexing workspace members...");try{let{workspaceReindexCommand:c}=await import('./workspace-VMSPYIBV.js');await c({quiet:!0}),i.succeed(e.green("Workspace members reindexed"));}catch(c){i.warn(e.yellow(`Workspace reindex: ${c.message}`));}}}catch(s){a$1.operation("shift").debug("Workspace config read failed",{error:s.message});}}let v=d.join(n,"portal.yaml");a.existsSync(v)||a.writeFileSync(v,h.dump({version:"1.0.0",gates:{},routes:{}},{lineWidth:-1,noRefs:true}),"utf8");let E=d.join(n,".paradigm","lore");a.existsSync(E)||a.mkdirSync(E,{recursive:true});let x=d.join(n,".paradigm","university");for(let t of ["content/notes","content/policies","content/quizzes","content/paths","diplomas"]){let s=d.join(x,t);a.existsSync(s)||a.mkdirSync(s,{recursive:true});}let N=d.join(x,"config.yaml");if(!a.existsSync(N)){let t="Project";try{let c=d.join(n,".paradigm","config.yaml");if(a.existsSync(c)){let p=h.load(a.readFileSync(c,"utf8"));p.project&&typeof p.project=="string"&&(t=p.project);}}catch{}let s={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}};a.writeFileSync(N,h.dump(s,{lineWidth:-1,noRefs:true}),"utf8");}i.start("Step 4/6: Syncing IDE configurations...");try{let t=o.ide?[o.ide]:["claude","cursor","copilot","windsurf","agents"],s=[];for(let c of t)try{await a$6(c,{quiet:!0,force:!0}),s.push(c);}catch{}s.length>0?i.succeed(e.green(`IDE configs synced: ${s.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$7({force:o.force}),i.succeed(e.green("Hooks installed (git + Claude Code + Cursor)"));}catch(t){i.warn(e.yellow(`Hooks warning: ${t.message}`));}if(o.verify){i.start("Step 6/6: Running health checks...");try{await a$8({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 O=[{path:".paradigm/config.yaml",desc:"Project configuration"},{path:".paradigm/navigator.yaml",desc:"Symbol navigation map"},{path:".paradigm/agents.yaml",desc:"Team agent configuration"},{path:".paradigm/adoptions.yaml",desc:"Agent adoption records"},{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}],W=d.join(r,"config.yaml");if(a.existsSync(W))try{let t=h.load(a.readFileSync(W,"utf8"));if(typeof t.workspace=="string"){let s=d.resolve(n,t.workspace),c=d.relative(n,s);O.push({path:c,desc:"Multi-project workspace",optional:!0});}}catch(t){a$1.operation("shift").debug("Summary config read failed",{error:t.message});}for(let t of O){let s=d.join(n,t.path);a.existsSync(s)?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})`));}try{let t=await Z(n),s=ee(t);s&&console.log(s);}catch(t){a$1.operation("shift").debug("Recommendations engine failed",{error:t.message}),console.log(""),console.log(e.white(" Next steps:")),console.log(e.gray(" "+"\u2500".repeat(49))),console.log(e.white(" 1. ")+e.gray("Edit ")+e.cyan(".purpose")+e.gray(" to define your features")),console.log(e.white(" 2. ")+e.gray("Run ")+e.cyan("paradigm shift --verify")+e.gray(" to check health")),console.log("");}try{let{captureSnapshot:t,seedMetricsConsent:s}=await import('./metrics-UESGUHTA.js');s(n),t(n);}catch(t){a$1.operation("shift").debug("metrics snapshot failed",{error:t.message});}m.success("Paradigm shift complete",{project:l});}export{be as runComplianceNominationStep,Le as shiftCommand};
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- export{h as registerTools}from'./chunk-23T6UG73.js';import'./chunk-4UJ4NIEQ.js';import'./chunk-4N56FRNE.js';import'./chunk-Q527BPUF.js';import'./chunk-KLBH26PA.js';import'./chunk-JNSJVCTU.js';import'./chunk-XROULIQN.js';import'./chunk-ZUAUFZRJ.js';import'./chunk-3KVVC4WV.js';import'./chunk-WXF5VFB4.js';import'./chunk-M4UMM6DC.js';import'./chunk-GRZQIKST.js';import'./chunk-KAFQA7HV.js';import'./chunk-6QXBXZF6.js';import'./chunk-EK4ZRIFJ.js';import'./chunk-LAYBUKMB.js';import'./chunk-DVZWCXB6.js';import'./chunk-QGZRM6ZB.js';import'./chunk-K7X3Z3GL.js';import'./chunk-5TAVYPOV.js';
2
+ export{h as registerTools}from'./chunk-MOVDVBU7.js';import'./chunk-4UJ4NIEQ.js';import'./chunk-4N56FRNE.js';import'./chunk-Q527BPUF.js';import'./chunk-KLBH26PA.js';import'./chunk-JNSJVCTU.js';import'./chunk-XROULIQN.js';import'./chunk-ZUAUFZRJ.js';import'./chunk-3KVVC4WV.js';import'./chunk-K7EQHFZP.js';import'./chunk-M4UMM6DC.js';import'./chunk-GRZQIKST.js';import'./chunk-KAFQA7HV.js';import'./chunk-6QXBXZF6.js';import'./chunk-EK4ZRIFJ.js';import'./chunk-LAYBUKMB.js';import'./chunk-DVZWCXB6.js';import'./chunk-QGZRM6ZB.js';import'./chunk-K7X3Z3GL.js';import'./chunk-5TAVYPOV.js';
@@ -76,6 +76,8 @@ Tier is exactly one thing: the default model the agent calls. Keep it that simpl
76
76
 
77
77
  > **Coming in v6.1:** Paradigm introduces a separate concept also named "tier" for **notebooks** — tier-1 (transferable across projects, owned by the agent) versus tier-2 (project-local, owned by the project). The two "tier" concepts are orthogonal: an agent's *model tier* (this entry) is about cost and capability; a *notebook tier* (v6.1) is about scope and ownership of learned patterns. The naming collision is unfortunate; we keep them strictly separate in PARA 451 and 551 to avoid conflation. See `agent-owned-enforcement-plan.md`.
78
78
 
79
+ > **Updated in v6.0.5:** Tier discussion sometimes raises the related question of *path-resolution semantics* across MCP writer/reader pairs (since aspects, anchors, and other tier-aware tools must agree on a base directory). In v6.0.5 the framework standardised on a shared `resolveAnchorPath()` helper imported by both `paradigm_aspect_check` and `paradigm_aspect_drift`; anchors are resolved with both-bases fallback (project-root first, then `.purpose`-dir). This is a framework-internal convention — it doesn't change tier semantics — but if you came here from a v6.0.4 lesson that referenced single-base anchor resolution, that detail is now historical. See `.paradigm/research/path-bug-and-agent-protocol-analysis.md` for the team analysis.
80
+
79
81
  ## Up next
80
82
 
81
83
  The next entry — **N-para-451-roster-reference** — is where everything you have learned so far comes together: the canonical roster, with each agent's id, nickname, archetype, *and* tier all in a single scannable table.
@@ -83,5 +83,5 @@ Error generating stack: `+i.message+`
83
83
  */var Il=S,fm=cm;function dm(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var pm=typeof Object.is=="function"?Object.is:dm,hm=fm.useSyncExternalStore,mm=Il.useRef,vm=Il.useEffect,gm=Il.useMemo,ym=Il.useDebugValue;hf.useSyncExternalStoreWithSelector=function(e,t,n,r,l){var i=mm(null);if(i.current===null){var o={hasValue:!1,value:null};i.current=o}else o=i.current;i=gm(function(){function u(x){if(!c){if(c=!0,h=x,x=r(x),l!==void 0&&o.hasValue){var y=o.value;if(l(y,x))return m=y}return m=x}if(y=m,pm(h,x))return y;var w=r(x);return l!==void 0&&l(y,w)?(h=x,y):(h=x,m=w)}var c=!1,h,m,v=n===void 0?null:n;return[function(){return u(t())},v===null?void 0:function(){return u(v())}]},[t,n,r,l]);var s=hm(e,i[0],i[1]);return vm(function(){o.hasValue=!0,o.value=s},[s]),ym(s),s};pf.exports=hf;var xm=pf.exports;const wm=Uu(xm),gf={},{useDebugValue:Sm}=vo,{useSyncExternalStoreWithSelector:km}=wm;let Iu=!1;const Cm=e=>e;function Em(e,t=Cm,n){(gf?"production":void 0)!=="production"&&n&&!Iu&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),Iu=!0);const r=km(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return Sm(r),r}const Ou=e=>{(gf?"production":void 0)!=="production"&&typeof e!="function"&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const t=typeof e=="function"?em(e):e,n=(r,l)=>Em(t,r,l);return Object.assign(n,t),n},cs=e=>e?Ou(e):Ou,Ol=cs((e,t)=>({courses:[],courseCache:{},isLoading:!1,error:null,loadCourses:async()=>{e({isLoading:!0,error:null});try{const n=await fetch("/api/courses");if(!n.ok)throw new Error("Failed to load courses");const r=await n.json();e({courses:r.courses,isLoading:!1})}catch(n){e({error:n.message,isLoading:!1})}},loadCourse:async n=>{const r=t().courseCache[n];if(r)return r;try{const l=await fetch(`/api/courses/${n}`);if(!l.ok)return null;const i=await l.json();return e(o=>({courseCache:{...o.courseCache,[n]:i}})),i}catch{return null}}})),yf="paradigm-university-progress";function jm(){try{const e=localStorage.getItem(yf);return e?JSON.parse(e):{}}catch{return{}}}function pi(e){try{localStorage.setItem(yf,JSON.stringify(e))}catch{}}const Ml=cs((e,t)=>({progress:jm(),completeLesson:(n,r)=>{e(l=>{const i=l.progress[n]||{courseId:n,completedLessons:[],quizResults:{}};if(i.completedLessons.includes(r))return l;const o={...l.progress,[n]:{...i,completedLessons:[...i.completedLessons,r]}};return pi(o),{progress:o}})},recordQuiz:n=>{e(r=>{const l=r.progress[n.courseId]||{courseId:n.courseId,completedLessons:[],quizResults:{}},i={...r.progress,[n.courseId]:{...l,quizResults:{...l.quizResults,[n.lessonId]:n}}};return pi(i),{progress:i}})},getCourseProgress:n=>t().progress[n]||{courseId:n,completedLessons:[],quizResults:{}},isLessonCompleted:(n,r)=>{const l=t().progress[n];return l?l.completedLessons.includes(r):!1},getCoursePercentage:(n,r)=>{if(r===0)return 0;const l=t().progress[n];return l?Math.round(l.completedLessons.length/r*100):0},resetProgress:()=>{pi({}),e({progress:{}})}})),xf="paradigm-university-plsat";function Nm(){try{const e=localStorage.getItem(xf);return e?JSON.parse(e):{certificates:[],studentName:""}}catch{return{certificates:[],studentName:""}}}function Mu(e){try{localStorage.setItem(xf,JSON.stringify(e))}catch{}}const fs=cs((e,t)=>{const n=Nm();return{certificates:n.certificates,studentName:n.studentName,setStudentName:r=>{e({studentName:r});const l=t();Mu({certificates:l.certificates,studentName:r})},addCertificate:r=>{e(l=>{const i=[...l.certificates,r];return Mu({certificates:i,studentName:l.studentName}),{certificates:i}})},getLatestCertificate:()=>{const r=t().certificates;return r.length===0?null:r.reduce((l,i)=>new Date(i.date)>new Date(l.date)?i:l)},getCertificateForVersion:r=>t().certificates.find(l=>l.plsatVersion===r&&l.passed)||null,hasPassed:()=>t().certificates.some(r=>r.passed)}});function wf({percentage:e,size:t=48,strokeWidth:n=4}){const r=(t-n)/2,l=2*Math.PI*r,i=l-e/100*l;return a.jsxs("div",{className:"progress-ring",style:{width:t,height:t},children:[a.jsxs("svg",{width:t,height:t,children:[a.jsx("circle",{className:"ring-bg",cx:t/2,cy:t/2,r,fill:"none",strokeWidth:n}),a.jsx("circle",{className:"ring-fill",cx:t/2,cy:t/2,r,fill:"none",strokeWidth:n,strokeLinecap:"round",strokeDasharray:l,strokeDashoffset:i})]}),a.jsxs("span",{className:"ring-label",children:[e,"%"]})]})}function Pm(){const{courses:e,isLoading:t,loadCourses:n}=Ol(),r=Ml(i=>i.getCoursePercentage),l=fs(i=>i.hasPassed);return S.useEffect(()=>{n()},[n]),t?a.jsx("div",{className:"loading",children:"Opening the campus gates..."}):a.jsxs("div",{className:"home",children:[a.jsxs("div",{className:"home-hero",children:[a.jsx(pn,{size:140}),a.jsx("h1",{children:"Paradigm University"}),a.jsx("p",{className:"motto",children:"Universitas Paradigmatica — Lux in Codice"}),a.jsx("p",{className:"description",children:"Master the Paradigm framework through structured courses, hands-on quizzes, and the legendary PLSAT certification exam."})]}),a.jsx("div",{className:"gold-divider"}),a.jsxs("section",{className:"course-catalog",children:[a.jsx("h2",{children:"Course Catalog"}),e.map(i=>{const o=r(i.id,i.lessonCount);return a.jsxs(q,{to:`/course/${i.id}`,className:"course-card",children:[a.jsxs("div",{className:"course-card-header",children:[a.jsxs("div",{className:"course-card-title",children:[a.jsx("span",{className:"course-number",children:i.id.replace("para-","PARA ")}),a.jsx("h3",{children:i.title.replace(/^PARA \d+: /,"")})]}),a.jsx(wf,{percentage:o})]}),a.jsx("p",{className:"course-description",children:i.description}),a.jsx("div",{className:"course-topics",children:i.lessons.map(s=>a.jsx("span",{className:"course-topic-tag",children:s.title},s.id))}),a.jsxs("div",{className:"course-meta",children:[a.jsxs("span",{children:[i.lessonCount," lessons"]}),a.jsx("span",{className:"course-meta-cta",children:"Start course →"})]})]},i.id)})]}),a.jsx("div",{className:"gold-divider"}),a.jsxs("section",{children:[a.jsx("h2",{className:"mb-lg",children:"Quick Links"}),a.jsxs("div",{className:"quick-links",children:[a.jsx(q,{to:"/plsat",className:"quick-link",children:l()?"Retake the PLSAT":"Take the PLSAT"}),a.jsx(q,{to:"/reference",className:"quick-link",children:"Reference Library"}),a.jsx(q,{to:"/certificate",className:"quick-link",children:"View Certificates"}),a.jsx(q,{to:"/course/para-101",className:"quick-link",children:"Start Learning"})]})]})]})}function _m(){const{courses:e,isLoading:t,loadCourses:n}=Ol(),r=Ml(l=>l.getCoursePercentage);return S.useEffect(()=>{n()},[n]),t?a.jsx("div",{className:"loading",children:"Loading courses..."}):a.jsx("div",{className:"home",children:a.jsxs("section",{className:"course-catalog",children:[a.jsx("h2",{children:"Course Catalog"}),e.map(l=>{const i=r(l.id,l.lessonCount);return a.jsxs(q,{to:`/course/${l.id}`,className:"course-card",children:[a.jsx("span",{className:"course-number",children:l.id.replace("para-","PARA ")}),a.jsx("h3",{children:l.title.replace(/^PARA \d+: /,"")}),a.jsx("p",{className:"course-description",children:l.description}),a.jsxs("div",{className:"course-meta",children:[a.jsxs("span",{children:[l.lessonCount," lessons"]}),a.jsx(wf,{percentage:i})]})]},l.id)})]})})}function Du(e){return e.replace(/`([^`]+)`/g,"<code>$1</code>").replace(/\*\*([^*]+)\*\*/g,"<strong>$1</strong>").replace(/\*([^*]+)\*/g,"<em>$1</em>")}function Lm(e){const t=e.trim().split(`
84
84
  `);if(t.length<2)return e;const n=o=>o.split("|").map(s=>s.trim()).filter(s=>s.length>0),r=n(t[0]),l=t.slice(2).map(n);let i="<table><thead><tr>";for(const o of r)i+=`<th>${Du(o)}</th>`;i+="</tr></thead><tbody>";for(const o of l){i+="<tr>";for(const s of o)i+=`<td>${Du(s)}</td>`;i+="</tr>"}return i+="</tbody></table>",i}function Ut(e){const t=[];let n=e.replace(/```(\w*)\n([\s\S]*?)```/g,(r,l,i)=>{const o=t.length;return t.push(`<pre><code>${i}</code></pre>`),`\0BLOCK${o}\0`});return n=n.replace(/((?:^\|.+\|\n?)+)/gm,r=>{const l=r.trim().split(`
85
85
  `);if(l.length>=3&&/^[\s-:|]+$/.test(l[1])){const i=t.length;return t.push(Lm(r)),`\0BLOCK${i}\0`}return r}),n=n.replace(/`([^`]+)`/g,"<code>$1</code>").replace(/^#### (.+)$/gm,"<h4>$1</h4>").replace(/^### (.+)$/gm,"<h3>$1</h3>").replace(/^## (.+)$/gm,"<h2>$1</h2>").replace(/\*\*([^*]+)\*\*/g,"<strong>$1</strong>").replace(/\*([^*]+)\*/g,"<em>$1</em>").replace(/^> (.+)$/gm,"<blockquote>$1</blockquote>").replace(/^\d+\.\s+(.+)$/gm,"<oli>$1</oli>").replace(/((?:<oli>.*<\/oli>\n?)+)/g,r=>"<ol>"+r.replace(/<\/?oli>/g,l=>l.replace("oli","li"))+"</ol>").replace(/^- (.+)$/gm,"<li>$1</li>").replace(/((?:<li>.*<\/li>\n?)+)/g,"<ul>$1</ul>").replace(/^(?!<(?:h[1-6]|ul|ol|li|p|blockquote|pre|table|thead|tbody|tr|td|th|\x00)).+$/gm,"<p>$&</p>").replace(/\n{2,}/g,`
86
- `),n=n.replace(/\x00BLOCK(\d+)\x00/g,(r,l)=>t[Number(l)]),n}function Au(){const{courseId:e,lessonId:t}=uf(),n=sf(),r=Ol(d=>d.loadCourse),[l,i]=S.useState(null),[o,s]=S.useState(null),[u,c]=S.useState(!0),{isLessonCompleted:h,completeLesson:m}=Ml();if(S.useEffect(()=>{e&&(c(!0),r(e).then(d=>{if(i(d),d&&d.lessons.length>0){const f=t?d.lessons.find(p=>p.id===t):null;f?s(f):(s(d.lessons[0]),n(`/course/${e}/${d.lessons[0].id}`,{replace:!0}))}c(!1)}))},[e,t,r,n]),u)return a.jsx("div",{className:"loading",children:"Opening the textbook..."});if(!l)return a.jsxs("div",{className:"empty-state",children:[a.jsx("h3",{children:"Course not found"}),a.jsx("p",{children:"The requested course does not exist."}),a.jsx(q,{to:"/",className:"btn btn-primary mt-lg",children:"Return to Campus"})]});const v=o?l.lessons.findIndex(d=>d.id===o.id):0,x=()=>{o&&e&&m(e,o.id)},y=(d,f=!1)=>{s(d),n(`/course/${e}/${d.id}`),f&&window.scrollTo(0,0)},w=()=>{v<l.lessons.length-1&&y(l.lessons[v+1],!0)},N=()=>{v>0&&y(l.lessons[v-1],!0)};return a.jsxs("div",{className:"course-layout",children:[a.jsxs("aside",{className:"course-sidebar",children:[a.jsx("h2",{children:l.title}),a.jsx("nav",{className:"lesson-nav",children:l.lessons.map(d=>{const f=e?h(e,d.id):!1,p=(o==null?void 0:o.id)===d.id;let g="lesson-nav-item";return p&&(g+=" active"),f&&!p&&(g+=" completed"),a.jsx("button",{className:g,onClick:()=>y(d),children:d.title},d.id)})})]}),a.jsx("div",{className:"course-content",children:o&&a.jsxs(a.Fragment,{children:[a.jsx("h1",{children:o.title}),o.keyConcepts.length>0&&a.jsx("div",{className:"key-concepts",children:o.keyConcepts.map(d=>a.jsx("span",{className:"concept-tag",children:d},d))}),a.jsx("div",{className:"lesson-content",dangerouslySetInnerHTML:{__html:Ut(o.content)}}),a.jsxs("div",{className:"lesson-actions",children:[a.jsx("div",{children:v>0&&a.jsx("button",{className:"btn btn-secondary",onClick:N,children:"Previous"})}),a.jsxs("div",{style:{display:"flex",gap:"0.5rem"},children:[e&&!h(e,o.id)&&a.jsx("button",{className:"btn btn-secondary",onClick:x,children:"Mark Complete"}),o.quiz.length>0&&e&&a.jsx(q,{to:`/course/${e}/quiz/${o.id}`,className:"btn btn-gold",children:"Take Quiz"}),v<l.lessons.length-1&&a.jsx("button",{className:"btn btn-primary",onClick:w,children:"Next Lesson"})]})]})]})})]})}function co({number:e,question:t,scenario:n,choices:r,correct:l,explanation:i,selectedAnswer:o,onSelect:s,showResult:u,onAnswered:c,splitLayout:h}){const[m,v]=S.useState(null),[x,y]=S.useState(!1),w=s!==void 0,N=w?o||null:m,d=w?u:x,f=j=>{d&&!w||(w?s==null||s(j):(v(j),y(!0),c==null||c(j)))},p=N===l,g=Object.keys(r).sort(),E=a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"question-number",children:["Question ",e]}),n&&a.jsx("div",{className:"scenario",dangerouslySetInnerHTML:{__html:Ut(n)}}),a.jsx("div",{className:"question-text",dangerouslySetInnerHTML:{__html:Ut(t)}})]}),k=a.jsx("div",{className:"choices",children:g.map(j=>{let P="choice-btn";return N===j&&(P+=" selected"),d&&j===l&&(P+=" correct"),d&&N===j&&j!==l&&(P+=" incorrect"),a.jsxs("button",{className:P,onClick:()=>f(j),disabled:d&&!w,children:[a.jsxs("span",{className:"choice-letter",children:[j,"."]}),a.jsx("span",{dangerouslySetInnerHTML:{__html:Ut(r[j])}})]},j)})});return h?a.jsxs("div",{className:"question-card",children:[a.jsxs("div",{className:"question-split-layout",children:[a.jsx("div",{className:"question-content",children:E}),a.jsx("div",{className:"answer-choices",children:k})]}),d&&a.jsxs("div",{className:`explanation ${p?"":"wrong"}`,children:[a.jsx("strong",{children:p?"Correct!":`Incorrect. The answer is ${l}.`}),a.jsx("br",{}),a.jsx("span",{dangerouslySetInnerHTML:{__html:Ut(i)}})]})]}):a.jsxs("div",{className:"question-card",children:[E,k,d&&a.jsxs("div",{className:`explanation ${p?"":"wrong"}`,children:[a.jsx("strong",{children:p?"Correct!":`Incorrect. The answer is ${l}.`}),a.jsx("br",{}),a.jsx("span",{dangerouslySetInnerHTML:{__html:Ut(i)}})]})]})}function Tm(){const{courseId:e,lessonId:t}=uf(),n=Ol(g=>g.loadCourse),{recordQuiz:r,completeLesson:l,getCourseProgress:i}=Ml(),[o,s]=S.useState(null),[u,c]=S.useState(null),[h,m]=S.useState(!0),[v,x]=S.useState(!1),[y,w]=S.useState(0),N=e&&t?i(e).quizResults[t]:void 0;S.useEffect(()=>{e&&(m(!0),n(e).then(g=>{if(g&&t){const E=g.lessons.findIndex(k=>k.id===t);s(E>=0?g.lessons[E]:null),E>=0&&E<g.lessons.length-1&&c(g.lessons[E+1].id)}m(!1)}))},[e,t,n]);const[d,f]=S.useState({}),p=(g,E)=>{if(f(k=>({...k,[g]:E})),o){const k={...d,[g]:E};if(Object.keys(k).length===o.quiz.length){const j=o.quiz.filter(P=>k[P.id]===P.correct).length;if(w(j),x(!0),e&&t){const P={courseId:e,lessonId:t,score:j,total:o.quiz.length,answers:k,date:new Date().toISOString()};r(P),l(e,t)}}}};return h?a.jsx("div",{className:"loading",children:"Preparing your examination..."}):!o||o.quiz.length===0?a.jsxs("div",{className:"empty-state",children:[a.jsx("h3",{children:"No quiz available"}),a.jsx("p",{children:"This lesson does not have a quiz."}),a.jsx(q,{to:`/course/${e}`,className:"btn btn-primary mt-lg",children:"Back to Course"})]}):a.jsxs("div",{className:"quiz-container",children:[a.jsxs("div",{className:"quiz-header",children:[a.jsxs("h1",{children:[o.title," — Quiz"]}),a.jsx("p",{className:"quiz-progress",children:v?`Score: ${y}/${o.quiz.length} (${Math.round(y/o.quiz.length*100)}%)`:`${Object.keys(d).length}/${o.quiz.length} answered`}),N&&!v&&a.jsxs("p",{className:"text-muted mt-sm",children:["Previous best: ",N.score,"/",N.total]})]}),o.quiz.map((g,E)=>a.jsx(co,{number:E+1,question:g.question,choices:g.choices,correct:g.correct,explanation:g.explanation,onAnswered:k=>p(g.id,k)},g.id)),v&&a.jsxs("div",{className:"text-center mt-xl",children:[a.jsx("p",{className:"mb-lg",style:{fontSize:"1.25rem",fontFamily:"var(--font-serif)"},children:y===o.quiz.length?"Perfect score! Exemplary scholarship.":y>=o.quiz.length*.8?"Well done, scholar. You have demonstrated understanding.":"Review the material and try again. Persistence is the path to mastery."}),u?a.jsx(q,{to:`/course/${e}/${u}`,className:"btn btn-primary",children:"Next Lesson"}):a.jsx(q,{to:`/course/${e}`,className:"btn btn-primary",children:"Return to Course"})]})]})}function zm({totalSeconds:e,onTimeUp:t,running:n}){const[r,l]=S.useState(e),i=S.useCallback(()=>{t()},[t]);S.useEffect(()=>{if(!n)return;const h=setInterval(()=>{l(m=>m<=1?(clearInterval(h),i(),0):m-1)},1e3);return()=>clearInterval(h)},[n,i]);const o=Math.floor(r/60),s=r%60,u=r/e*100;let c="timer-display";return u<20?c+=" critical":u<40&&(c+=" warning"),a.jsxs("span",{className:c,children:[String(o).padStart(2,"0"),":",String(s).padStart(2,"0")]})}function Fu({text:e}){const t=e.split(/(```[\s\S]*?```)/g);return a.jsx("div",{className:"passage-block",children:a.jsx("div",{className:"passage-content",children:t.map((n,r)=>{if(n.startsWith("```")){const l=n.match(/^```(\w*)\n?([\s\S]*?)```$/),i=l?l[2]:n.slice(3,-3);return a.jsx("pre",{children:a.jsx("code",{children:i})},r)}return n.split(/\n\n+/).map((l,i)=>a.jsx("p",{children:l},`${r}-${i}`))})})})}function $u(e,t,n){if(!t)return null;const r=e[n];return r.passageId?t[r.passageId]??null:null}function Rm(){const[e,t]=S.useState(null),[n,r]=S.useState("intro"),[l,i]=S.useState({}),[o,s]=S.useState(0),[u,c]=S.useState(!0),[h,m]=S.useState(null),{studentName:v,setStudentName:x,addCertificate:y}=fs(),[w,N]=S.useState(v);S.useEffect(()=>{fetch("/api/plsat/3.0").then(k=>k.json()).then(k=>{t(k),c(!1)}).catch(()=>c(!1))},[]);const d=S.useCallback(()=>{if(!e)return;const k=e.questions.filter(de=>l[de.id]===de.correct).length,j=e.questions.length,P=Math.round(k/j*100),M=P>=e.passThreshold*100,z={name:w||"Anonymous Scholar",score:k,total:j,percentage:P,passed:M,plsatVersion:e.version,frameworkVersion:e.frameworkVersion,date:new Date().toISOString()};m(z),y(z),w&&x(w),r("results")},[e,l,w,y,x]),f=S.useCallback(()=>{d()},[d]),p=()=>{d()},g=()=>{i({}),s(0),r("exam")},E=S.useMemo(()=>!e||n!=="exam"?null:$u(e.questions,e.passages,o),[e,n,o]);if(u)return a.jsx("div",{className:"loading",children:"The examination board is convening..."});if(!e)return a.jsxs("div",{className:"empty-state",children:[a.jsx("h3",{children:"PLSAT Unavailable"}),a.jsx("p",{children:"Could not load the examination. Please try again."})]});if(n==="intro")return a.jsxs("div",{className:"plsat-container",children:[a.jsxs("div",{className:"plsat-intro",children:[a.jsx(pn,{size:100}),a.jsx("h1",{children:"The PLSAT"}),a.jsx("p",{className:"plsat-subtitle",children:"Paradigm Licensure Standardized Assessment Test"}),a.jsxs("p",{className:"text-muted",children:["Version ",e.version]})]}),a.jsxs("div",{className:"plsat-rules",children:[a.jsx("h3",{children:"Examination Rules"}),a.jsxs("ul",{children:[a.jsxs("li",{children:[a.jsxs("strong",{children:[e.questions.length," questions"]})," covering all aspects of the Paradigm framework"]}),a.jsxs("li",{children:[a.jsxs("strong",{children:[Math.floor(e.timeLimit/60)," minutes"]})," to complete the examination"]}),a.jsxs("li",{children:[a.jsxs("strong",{children:[e.passThreshold*100,"%"]})," required to pass and receive certification"]}),a.jsx("li",{children:"All questions are multiple choice (A through E)"}),a.jsx("li",{children:"Some questions reference a shared passage — read it carefully"}),a.jsx("li",{children:"You may navigate between questions freely"}),a.jsx("li",{children:"There is no penalty for guessing — answer every question"}),a.jsx("li",{children:"Your certificate will display the PLSAT version for posterity"})]})]}),a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"mb-lg",children:a.jsx("input",{type:"text",className:"name-input",placeholder:"Enter your name, scholar",value:w,onChange:k=>N(k.target.value)})}),a.jsx("button",{className:"btn btn-primary btn-lg",onClick:g,children:"Begin Examination"})]})]});if(n==="exam"){const k=e.questions[o],j=Object.keys(l).length;return a.jsxs("div",{className:"plsat-container",children:[a.jsxs("div",{className:"plsat-timer",children:[a.jsx(zm,{totalSeconds:e.timeLimit,onTimeUp:f,running:!0}),a.jsxs("span",{className:"plsat-progress-text",children:["Question ",o+1," of ",e.questions.length," | ",j," answered"]})]}),a.jsxs("div",{style:{marginTop:"var(--space-lg)"},children:[E&&a.jsx(Fu,{text:E}),a.jsx(co,{number:o+1,question:k.question,scenario:k.scenario,choices:k.choices,correct:k.correct,explanation:k.explanation,selectedAnswer:l[k.id],onSelect:P=>i(M=>({...M,[k.id]:P})),showResult:!1,splitLayout:!0})]}),a.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginTop:"var(--space-lg)"},children:[a.jsx("button",{className:"btn btn-secondary",disabled:o===0,onClick:()=>s(P=>P-1),children:"Previous"}),a.jsxs("div",{style:{display:"flex",gap:"0.5rem"},children:[j===e.questions.length&&a.jsx("button",{className:"btn btn-gold",onClick:p,children:"Submit Examination"}),a.jsx("button",{className:"btn btn-primary",disabled:o===e.questions.length-1,onClick:()=>s(P=>P+1),children:"Next"})]})]}),a.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"4px",marginTop:"var(--space-xl)",justifyContent:"center"},children:e.questions.map((P,M)=>a.jsx("button",{onClick:()=>s(M),style:{width:28,height:28,borderRadius:"50%",border:M===o?"2px solid var(--burgundy)":"1px solid var(--parchment-dark)",background:l[P.id]?"var(--gold-bg)":"var(--cream)",color:"var(--ink)",fontSize:"0.6875rem",cursor:"pointer",fontWeight:M===o?600:400},children:M+1},P.id))})]})}return n==="results"&&h?a.jsx("div",{className:"plsat-container",children:a.jsxs("div",{className:"plsat-results",children:[a.jsx(pn,{size:80}),a.jsxs("div",{className:`score-display ${h.passed?"passed":"failed"}`,children:[h.percentage,"%"]}),a.jsx("p",{className:"verdict",children:h.passed?"Congratulations! You have passed the PLSAT.":"The examination board regrets to inform you that you did not pass."}),a.jsxs("p",{className:"text-muted mb-lg",children:["Score: ",h.score,"/",h.total," | PLSAT v",h.plsatVersion," | ",new Date(h.date).toLocaleDateString()]}),a.jsxs("div",{style:{display:"flex",gap:"1rem",justifyContent:"center"},children:[h.passed&&a.jsx(q,{to:"/certificate",className:"btn btn-gold btn-lg",children:"View Certificate"}),a.jsx("button",{className:"btn btn-secondary",onClick:()=>r("review"),children:"Review Answers"}),a.jsx("button",{className:"btn btn-primary",onClick:()=>r("intro"),children:h.passed?"Retake":"Try Again"})]})]})}):n==="review"?a.jsxs("div",{className:"plsat-container",children:[a.jsxs("div",{className:"quiz-header",children:[a.jsx("h1",{children:"PLSAT Review"}),a.jsx("p",{className:"quiz-progress",children:h?`Score: ${h.score}/${h.total} (${h.percentage}%)`:""})]}),e.questions.map((k,j)=>{const P=$u(e.questions,e.passages,j);return a.jsxs("div",{children:[P&&a.jsx(Fu,{text:P}),a.jsx(co,{number:j+1,question:k.question,scenario:k.scenario,choices:k.choices,correct:k.correct,explanation:k.explanation,selectedAnswer:l[k.id],onSelect:()=>{},showResult:!0,splitLayout:!0})]},k.id)}),a.jsx("div",{className:"text-center mt-xl",children:a.jsx("button",{className:"btn btn-primary",onClick:()=>r("results"),children:"Back to Results"})})]}):null}function Im(){const[e,t]=S.useState(null),[n,r]=S.useState(!0);return S.useEffect(()=>{fetch("/api/reference").then(l=>l.json()).then(l=>{t(l),r(!1)}).catch(()=>r(!1))},[]),n?a.jsx("div",{className:"loading",children:"Opening the reference library..."}):e?a.jsxs("div",{className:"reference-container",children:[a.jsx("h1",{className:"mb-lg",children:"Reference Library"}),e.sections.map(l=>a.jsxs("section",{className:"reference-section",children:[a.jsx("h2",{children:l.title}),a.jsx("div",{className:"reference-grid",children:l.cards.map(i=>a.jsxs("div",{className:"ref-card",children:[i.symbol&&a.jsx("div",{className:"ref-symbol",children:i.symbol}),a.jsx("h4",{children:i.name}),a.jsx("p",{children:i.description}),i.examples&&i.examples.length>0&&a.jsx("div",{className:"ref-examples",children:i.examples.map(o=>a.jsx("span",{className:"ref-example",children:o},o))}),i.logger&&a.jsx("p",{style:{marginTop:"0.5rem"},children:a.jsx("code",{children:i.logger})}),i.when&&a.jsx("p",{className:"text-muted",style:{fontSize:"0.8125rem",marginTop:"0.25rem"},children:a.jsx("em",{children:i.when})}),i.command&&a.jsx("p",{style:{marginTop:"0.5rem"},children:a.jsx("code",{children:i.command})}),i.steps&&i.steps.length>0&&a.jsx("ol",{style:{fontSize:"0.875rem",paddingLeft:"1.25rem",marginTop:"0.5rem"},children:i.steps.map((o,s)=>a.jsx("li",{style:{marginBottom:"0.25rem"},children:o},s))})]},i.id))})]},l.id))]}):a.jsxs("div",{className:"empty-state",children:[a.jsx("h3",{children:"Reference library unavailable"}),a.jsx("p",{children:"Could not load reference data."})]})}function Om(){const{certificates:e}=fs(),t=e.filter(r=>r.passed),n=t.length>0?t.reduce((r,l)=>new Date(l.date)>new Date(r.date)?l:r):null;return n?a.jsxs("div",{className:"certificate-container",children:[a.jsx("div",{className:"no-print text-center mb-lg",children:a.jsx("button",{className:"btn btn-gold",onClick:()=>window.print(),children:"Print Certificate"})}),a.jsxs("div",{className:"certificate",children:[a.jsx(pn,{size:100,className:"cert-seal"}),a.jsx("h1",{children:"Paradigm University"}),a.jsx("p",{className:"cert-title",children:"Universitas Paradigmatica — Lux in Codice"}),a.jsx("div",{className:"gold-divider"}),a.jsx("p",{style:{fontSize:"0.875rem",color:"var(--ink-muted)",marginTop:"var(--space-lg)"},children:"This is to certify that"}),a.jsx("div",{className:"cert-name",children:n.name}),a.jsxs("p",{className:"cert-body",children:["has successfully completed the",a.jsx("br",{}),a.jsx("strong",{children:"Paradigm Licensure Standardized Assessment Test"}),a.jsx("br",{}),"and is hereby recognized as a certified Paradigm practitioner."]}),a.jsxs("p",{className:"cert-score",children:["Score: ",n.score,"/",n.total," (",n.percentage,"%)"]}),a.jsx("div",{className:"gold-divider"}),a.jsxs("dl",{className:"cert-meta",children:[a.jsxs("div",{children:[a.jsx("dt",{children:"PLSAT Version"}),a.jsxs("dd",{children:["v",n.plsatVersion]})]}),a.jsxs("div",{children:[a.jsx("dt",{children:"Framework Version"}),a.jsxs("dd",{children:["v",n.frameworkVersion]})]}),a.jsxs("div",{children:[a.jsx("dt",{children:"Date Issued"}),a.jsx("dd",{children:new Date(n.date).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"})})]})]})]}),e.length>1&&a.jsxs("div",{className:"no-print mt-xl",children:[a.jsx("h3",{className:"mb-md",children:"All Attempts"}),[...e].reverse().map((r,l)=>a.jsx("div",{className:"ref-card",style:{marginBottom:"0.5rem"},children:a.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[a.jsxs("span",{children:["PLSAT v",r.plsatVersion," — ",r.score,"/",r.total," (",r.percentage,"%)",r.passed?" ✓":""]}),a.jsx("span",{className:"text-muted",children:new Date(r.date).toLocaleDateString()})]})},l))]})]}):a.jsxs("div",{className:"certificate-container",children:[a.jsxs("div",{className:"empty-state",children:[a.jsx(pn,{size:80}),a.jsx("h3",{className:"mt-lg",children:"No Certificates Yet"}),a.jsx("p",{children:"Pass the PLSAT examination to earn your Paradigm certification."}),a.jsx(q,{to:"/plsat",className:"btn btn-primary mt-lg",children:"Take the PLSAT"})]}),e.length>0&&a.jsxs("div",{className:"mt-xl",children:[a.jsx("h3",{className:"mb-md",children:"Previous Attempts"}),e.map((r,l)=>a.jsx("div",{className:"ref-card",style:{marginBottom:"0.5rem"},children:a.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[a.jsxs("span",{children:["PLSAT v",r.plsatVersion," — ",r.score,"/",r.total," (",r.percentage,"%)"]}),a.jsx("span",{className:"text-muted",children:new Date(r.date).toLocaleDateString()})]})},l))]})]})}function Mm(){return a.jsxs("div",{className:"app",children:[a.jsx(Zh,{version:"6.0.1"}),a.jsx("main",{className:"main-content",children:a.jsxs(Bh,{children:[a.jsx(We,{path:"/",element:a.jsx(Pm,{})}),a.jsx(We,{path:"/courses",element:a.jsx(_m,{})}),a.jsx(We,{path:"/course/:courseId",element:a.jsx(Au,{})}),a.jsx(We,{path:"/course/:courseId/:lessonId",element:a.jsx(Au,{})}),a.jsx(We,{path:"/course/:courseId/quiz/:lessonId",element:a.jsx(Tm,{})}),a.jsx(We,{path:"/plsat",element:a.jsx(Rm,{})}),a.jsx(We,{path:"/reference",element:a.jsx(Im,{})}),a.jsx(We,{path:"/certificate",element:a.jsx(Om,{})})]})})]})}hi.createRoot(document.getElementById("root")).render(a.jsx(vo.StrictMode,{children:a.jsx(Gh,{children:a.jsx(Mm,{})})}));
87
- //# sourceMappingURL=index-nNgzO1il.js.map
86
+ `),n=n.replace(/\x00BLOCK(\d+)\x00/g,(r,l)=>t[Number(l)]),n}function Au(){const{courseId:e,lessonId:t}=uf(),n=sf(),r=Ol(d=>d.loadCourse),[l,i]=S.useState(null),[o,s]=S.useState(null),[u,c]=S.useState(!0),{isLessonCompleted:h,completeLesson:m}=Ml();if(S.useEffect(()=>{e&&(c(!0),r(e).then(d=>{if(i(d),d&&d.lessons.length>0){const f=t?d.lessons.find(p=>p.id===t):null;f?s(f):(s(d.lessons[0]),n(`/course/${e}/${d.lessons[0].id}`,{replace:!0}))}c(!1)}))},[e,t,r,n]),u)return a.jsx("div",{className:"loading",children:"Opening the textbook..."});if(!l)return a.jsxs("div",{className:"empty-state",children:[a.jsx("h3",{children:"Course not found"}),a.jsx("p",{children:"The requested course does not exist."}),a.jsx(q,{to:"/",className:"btn btn-primary mt-lg",children:"Return to Campus"})]});const v=o?l.lessons.findIndex(d=>d.id===o.id):0,x=()=>{o&&e&&m(e,o.id)},y=(d,f=!1)=>{s(d),n(`/course/${e}/${d.id}`),f&&window.scrollTo(0,0)},w=()=>{v<l.lessons.length-1&&y(l.lessons[v+1],!0)},N=()=>{v>0&&y(l.lessons[v-1],!0)};return a.jsxs("div",{className:"course-layout",children:[a.jsxs("aside",{className:"course-sidebar",children:[a.jsx("h2",{children:l.title}),a.jsx("nav",{className:"lesson-nav",children:l.lessons.map(d=>{const f=e?h(e,d.id):!1,p=(o==null?void 0:o.id)===d.id;let g="lesson-nav-item";return p&&(g+=" active"),f&&!p&&(g+=" completed"),a.jsx("button",{className:g,onClick:()=>y(d),children:d.title},d.id)})})]}),a.jsx("div",{className:"course-content",children:o&&a.jsxs(a.Fragment,{children:[a.jsx("h1",{children:o.title}),o.keyConcepts.length>0&&a.jsx("div",{className:"key-concepts",children:o.keyConcepts.map(d=>a.jsx("span",{className:"concept-tag",children:d},d))}),a.jsx("div",{className:"lesson-content",dangerouslySetInnerHTML:{__html:Ut(o.content)}}),a.jsxs("div",{className:"lesson-actions",children:[a.jsx("div",{children:v>0&&a.jsx("button",{className:"btn btn-secondary",onClick:N,children:"Previous"})}),a.jsxs("div",{style:{display:"flex",gap:"0.5rem"},children:[e&&!h(e,o.id)&&a.jsx("button",{className:"btn btn-secondary",onClick:x,children:"Mark Complete"}),o.quiz.length>0&&e&&a.jsx(q,{to:`/course/${e}/quiz/${o.id}`,className:"btn btn-gold",children:"Take Quiz"}),v<l.lessons.length-1&&a.jsx("button",{className:"btn btn-primary",onClick:w,children:"Next Lesson"})]})]})]})})]})}function co({number:e,question:t,scenario:n,choices:r,correct:l,explanation:i,selectedAnswer:o,onSelect:s,showResult:u,onAnswered:c,splitLayout:h}){const[m,v]=S.useState(null),[x,y]=S.useState(!1),w=s!==void 0,N=w?o||null:m,d=w?u:x,f=j=>{d&&!w||(w?s==null||s(j):(v(j),y(!0),c==null||c(j)))},p=N===l,g=Object.keys(r).sort(),E=a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"question-number",children:["Question ",e]}),n&&a.jsx("div",{className:"scenario",dangerouslySetInnerHTML:{__html:Ut(n)}}),a.jsx("div",{className:"question-text",dangerouslySetInnerHTML:{__html:Ut(t)}})]}),k=a.jsx("div",{className:"choices",children:g.map(j=>{let P="choice-btn";return N===j&&(P+=" selected"),d&&j===l&&(P+=" correct"),d&&N===j&&j!==l&&(P+=" incorrect"),a.jsxs("button",{className:P,onClick:()=>f(j),disabled:d&&!w,children:[a.jsxs("span",{className:"choice-letter",children:[j,"."]}),a.jsx("span",{dangerouslySetInnerHTML:{__html:Ut(r[j])}})]},j)})});return h?a.jsxs("div",{className:"question-card",children:[a.jsxs("div",{className:"question-split-layout",children:[a.jsx("div",{className:"question-content",children:E}),a.jsx("div",{className:"answer-choices",children:k})]}),d&&a.jsxs("div",{className:`explanation ${p?"":"wrong"}`,children:[a.jsx("strong",{children:p?"Correct!":`Incorrect. The answer is ${l}.`}),a.jsx("br",{}),a.jsx("span",{dangerouslySetInnerHTML:{__html:Ut(i)}})]})]}):a.jsxs("div",{className:"question-card",children:[E,k,d&&a.jsxs("div",{className:`explanation ${p?"":"wrong"}`,children:[a.jsx("strong",{children:p?"Correct!":`Incorrect. The answer is ${l}.`}),a.jsx("br",{}),a.jsx("span",{dangerouslySetInnerHTML:{__html:Ut(i)}})]})]})}function Tm(){const{courseId:e,lessonId:t}=uf(),n=Ol(g=>g.loadCourse),{recordQuiz:r,completeLesson:l,getCourseProgress:i}=Ml(),[o,s]=S.useState(null),[u,c]=S.useState(null),[h,m]=S.useState(!0),[v,x]=S.useState(!1),[y,w]=S.useState(0),N=e&&t?i(e).quizResults[t]:void 0;S.useEffect(()=>{e&&(m(!0),n(e).then(g=>{if(g&&t){const E=g.lessons.findIndex(k=>k.id===t);s(E>=0?g.lessons[E]:null),E>=0&&E<g.lessons.length-1&&c(g.lessons[E+1].id)}m(!1)}))},[e,t,n]);const[d,f]=S.useState({}),p=(g,E)=>{if(f(k=>({...k,[g]:E})),o){const k={...d,[g]:E};if(Object.keys(k).length===o.quiz.length){const j=o.quiz.filter(P=>k[P.id]===P.correct).length;if(w(j),x(!0),e&&t){const P={courseId:e,lessonId:t,score:j,total:o.quiz.length,answers:k,date:new Date().toISOString()};r(P),l(e,t)}}}};return h?a.jsx("div",{className:"loading",children:"Preparing your examination..."}):!o||o.quiz.length===0?a.jsxs("div",{className:"empty-state",children:[a.jsx("h3",{children:"No quiz available"}),a.jsx("p",{children:"This lesson does not have a quiz."}),a.jsx(q,{to:`/course/${e}`,className:"btn btn-primary mt-lg",children:"Back to Course"})]}):a.jsxs("div",{className:"quiz-container",children:[a.jsxs("div",{className:"quiz-header",children:[a.jsxs("h1",{children:[o.title," — Quiz"]}),a.jsx("p",{className:"quiz-progress",children:v?`Score: ${y}/${o.quiz.length} (${Math.round(y/o.quiz.length*100)}%)`:`${Object.keys(d).length}/${o.quiz.length} answered`}),N&&!v&&a.jsxs("p",{className:"text-muted mt-sm",children:["Previous best: ",N.score,"/",N.total]})]}),o.quiz.map((g,E)=>a.jsx(co,{number:E+1,question:g.question,choices:g.choices,correct:g.correct,explanation:g.explanation,onAnswered:k=>p(g.id,k)},g.id)),v&&a.jsxs("div",{className:"text-center mt-xl",children:[a.jsx("p",{className:"mb-lg",style:{fontSize:"1.25rem",fontFamily:"var(--font-serif)"},children:y===o.quiz.length?"Perfect score! Exemplary scholarship.":y>=o.quiz.length*.8?"Well done, scholar. You have demonstrated understanding.":"Review the material and try again. Persistence is the path to mastery."}),u?a.jsx(q,{to:`/course/${e}/${u}`,className:"btn btn-primary",children:"Next Lesson"}):a.jsx(q,{to:`/course/${e}`,className:"btn btn-primary",children:"Return to Course"})]})]})}function zm({totalSeconds:e,onTimeUp:t,running:n}){const[r,l]=S.useState(e),i=S.useCallback(()=>{t()},[t]);S.useEffect(()=>{if(!n)return;const h=setInterval(()=>{l(m=>m<=1?(clearInterval(h),i(),0):m-1)},1e3);return()=>clearInterval(h)},[n,i]);const o=Math.floor(r/60),s=r%60,u=r/e*100;let c="timer-display";return u<20?c+=" critical":u<40&&(c+=" warning"),a.jsxs("span",{className:c,children:[String(o).padStart(2,"0"),":",String(s).padStart(2,"0")]})}function Fu({text:e}){const t=e.split(/(```[\s\S]*?```)/g);return a.jsx("div",{className:"passage-block",children:a.jsx("div",{className:"passage-content",children:t.map((n,r)=>{if(n.startsWith("```")){const l=n.match(/^```(\w*)\n?([\s\S]*?)```$/),i=l?l[2]:n.slice(3,-3);return a.jsx("pre",{children:a.jsx("code",{children:i})},r)}return n.split(/\n\n+/).map((l,i)=>a.jsx("p",{children:l},`${r}-${i}`))})})})}function $u(e,t,n){if(!t)return null;const r=e[n];return r.passageId?t[r.passageId]??null:null}function Rm(){const[e,t]=S.useState(null),[n,r]=S.useState("intro"),[l,i]=S.useState({}),[o,s]=S.useState(0),[u,c]=S.useState(!0),[h,m]=S.useState(null),{studentName:v,setStudentName:x,addCertificate:y}=fs(),[w,N]=S.useState(v);S.useEffect(()=>{fetch("/api/plsat/3.0").then(k=>k.json()).then(k=>{t(k),c(!1)}).catch(()=>c(!1))},[]);const d=S.useCallback(()=>{if(!e)return;const k=e.questions.filter(de=>l[de.id]===de.correct).length,j=e.questions.length,P=Math.round(k/j*100),M=P>=e.passThreshold*100,z={name:w||"Anonymous Scholar",score:k,total:j,percentage:P,passed:M,plsatVersion:e.version,frameworkVersion:e.frameworkVersion,date:new Date().toISOString()};m(z),y(z),w&&x(w),r("results")},[e,l,w,y,x]),f=S.useCallback(()=>{d()},[d]),p=()=>{d()},g=()=>{i({}),s(0),r("exam")},E=S.useMemo(()=>!e||n!=="exam"?null:$u(e.questions,e.passages,o),[e,n,o]);if(u)return a.jsx("div",{className:"loading",children:"The examination board is convening..."});if(!e)return a.jsxs("div",{className:"empty-state",children:[a.jsx("h3",{children:"PLSAT Unavailable"}),a.jsx("p",{children:"Could not load the examination. Please try again."})]});if(n==="intro")return a.jsxs("div",{className:"plsat-container",children:[a.jsxs("div",{className:"plsat-intro",children:[a.jsx(pn,{size:100}),a.jsx("h1",{children:"The PLSAT"}),a.jsx("p",{className:"plsat-subtitle",children:"Paradigm Licensure Standardized Assessment Test"}),a.jsxs("p",{className:"text-muted",children:["Version ",e.version]})]}),a.jsxs("div",{className:"plsat-rules",children:[a.jsx("h3",{children:"Examination Rules"}),a.jsxs("ul",{children:[a.jsxs("li",{children:[a.jsxs("strong",{children:[e.questions.length," questions"]})," covering all aspects of the Paradigm framework"]}),a.jsxs("li",{children:[a.jsxs("strong",{children:[Math.floor(e.timeLimit/60)," minutes"]})," to complete the examination"]}),a.jsxs("li",{children:[a.jsxs("strong",{children:[e.passThreshold*100,"%"]})," required to pass and receive certification"]}),a.jsx("li",{children:"All questions are multiple choice (A through E)"}),a.jsx("li",{children:"Some questions reference a shared passage — read it carefully"}),a.jsx("li",{children:"You may navigate between questions freely"}),a.jsx("li",{children:"There is no penalty for guessing — answer every question"}),a.jsx("li",{children:"Your certificate will display the PLSAT version for posterity"})]})]}),a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"mb-lg",children:a.jsx("input",{type:"text",className:"name-input",placeholder:"Enter your name, scholar",value:w,onChange:k=>N(k.target.value)})}),a.jsx("button",{className:"btn btn-primary btn-lg",onClick:g,children:"Begin Examination"})]})]});if(n==="exam"){const k=e.questions[o],j=Object.keys(l).length;return a.jsxs("div",{className:"plsat-container",children:[a.jsxs("div",{className:"plsat-timer",children:[a.jsx(zm,{totalSeconds:e.timeLimit,onTimeUp:f,running:!0}),a.jsxs("span",{className:"plsat-progress-text",children:["Question ",o+1," of ",e.questions.length," | ",j," answered"]})]}),a.jsxs("div",{style:{marginTop:"var(--space-lg)"},children:[E&&a.jsx(Fu,{text:E}),a.jsx(co,{number:o+1,question:k.question,scenario:k.scenario,choices:k.choices,correct:k.correct,explanation:k.explanation,selectedAnswer:l[k.id],onSelect:P=>i(M=>({...M,[k.id]:P})),showResult:!1,splitLayout:!0})]}),a.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginTop:"var(--space-lg)"},children:[a.jsx("button",{className:"btn btn-secondary",disabled:o===0,onClick:()=>s(P=>P-1),children:"Previous"}),a.jsxs("div",{style:{display:"flex",gap:"0.5rem"},children:[j===e.questions.length&&a.jsx("button",{className:"btn btn-gold",onClick:p,children:"Submit Examination"}),a.jsx("button",{className:"btn btn-primary",disabled:o===e.questions.length-1,onClick:()=>s(P=>P+1),children:"Next"})]})]}),a.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"4px",marginTop:"var(--space-xl)",justifyContent:"center"},children:e.questions.map((P,M)=>a.jsx("button",{onClick:()=>s(M),style:{width:28,height:28,borderRadius:"50%",border:M===o?"2px solid var(--burgundy)":"1px solid var(--parchment-dark)",background:l[P.id]?"var(--gold-bg)":"var(--cream)",color:"var(--ink)",fontSize:"0.6875rem",cursor:"pointer",fontWeight:M===o?600:400},children:M+1},P.id))})]})}return n==="results"&&h?a.jsx("div",{className:"plsat-container",children:a.jsxs("div",{className:"plsat-results",children:[a.jsx(pn,{size:80}),a.jsxs("div",{className:`score-display ${h.passed?"passed":"failed"}`,children:[h.percentage,"%"]}),a.jsx("p",{className:"verdict",children:h.passed?"Congratulations! You have passed the PLSAT.":"The examination board regrets to inform you that you did not pass."}),a.jsxs("p",{className:"text-muted mb-lg",children:["Score: ",h.score,"/",h.total," | PLSAT v",h.plsatVersion," | ",new Date(h.date).toLocaleDateString()]}),a.jsxs("div",{style:{display:"flex",gap:"1rem",justifyContent:"center"},children:[h.passed&&a.jsx(q,{to:"/certificate",className:"btn btn-gold btn-lg",children:"View Certificate"}),a.jsx("button",{className:"btn btn-secondary",onClick:()=>r("review"),children:"Review Answers"}),a.jsx("button",{className:"btn btn-primary",onClick:()=>r("intro"),children:h.passed?"Retake":"Try Again"})]})]})}):n==="review"?a.jsxs("div",{className:"plsat-container",children:[a.jsxs("div",{className:"quiz-header",children:[a.jsx("h1",{children:"PLSAT Review"}),a.jsx("p",{className:"quiz-progress",children:h?`Score: ${h.score}/${h.total} (${h.percentage}%)`:""})]}),e.questions.map((k,j)=>{const P=$u(e.questions,e.passages,j);return a.jsxs("div",{children:[P&&a.jsx(Fu,{text:P}),a.jsx(co,{number:j+1,question:k.question,scenario:k.scenario,choices:k.choices,correct:k.correct,explanation:k.explanation,selectedAnswer:l[k.id],onSelect:()=>{},showResult:!0,splitLayout:!0})]},k.id)}),a.jsx("div",{className:"text-center mt-xl",children:a.jsx("button",{className:"btn btn-primary",onClick:()=>r("results"),children:"Back to Results"})})]}):null}function Im(){const[e,t]=S.useState(null),[n,r]=S.useState(!0);return S.useEffect(()=>{fetch("/api/reference").then(l=>l.json()).then(l=>{t(l),r(!1)}).catch(()=>r(!1))},[]),n?a.jsx("div",{className:"loading",children:"Opening the reference library..."}):e?a.jsxs("div",{className:"reference-container",children:[a.jsx("h1",{className:"mb-lg",children:"Reference Library"}),e.sections.map(l=>a.jsxs("section",{className:"reference-section",children:[a.jsx("h2",{children:l.title}),a.jsx("div",{className:"reference-grid",children:l.cards.map(i=>a.jsxs("div",{className:"ref-card",children:[i.symbol&&a.jsx("div",{className:"ref-symbol",children:i.symbol}),a.jsx("h4",{children:i.name}),a.jsx("p",{children:i.description}),i.examples&&i.examples.length>0&&a.jsx("div",{className:"ref-examples",children:i.examples.map(o=>a.jsx("span",{className:"ref-example",children:o},o))}),i.logger&&a.jsx("p",{style:{marginTop:"0.5rem"},children:a.jsx("code",{children:i.logger})}),i.when&&a.jsx("p",{className:"text-muted",style:{fontSize:"0.8125rem",marginTop:"0.25rem"},children:a.jsx("em",{children:i.when})}),i.command&&a.jsx("p",{style:{marginTop:"0.5rem"},children:a.jsx("code",{children:i.command})}),i.steps&&i.steps.length>0&&a.jsx("ol",{style:{fontSize:"0.875rem",paddingLeft:"1.25rem",marginTop:"0.5rem"},children:i.steps.map((o,s)=>a.jsx("li",{style:{marginBottom:"0.25rem"},children:o},s))})]},i.id))})]},l.id))]}):a.jsxs("div",{className:"empty-state",children:[a.jsx("h3",{children:"Reference library unavailable"}),a.jsx("p",{children:"Could not load reference data."})]})}function Om(){const{certificates:e}=fs(),t=e.filter(r=>r.passed),n=t.length>0?t.reduce((r,l)=>new Date(l.date)>new Date(r.date)?l:r):null;return n?a.jsxs("div",{className:"certificate-container",children:[a.jsx("div",{className:"no-print text-center mb-lg",children:a.jsx("button",{className:"btn btn-gold",onClick:()=>window.print(),children:"Print Certificate"})}),a.jsxs("div",{className:"certificate",children:[a.jsx(pn,{size:100,className:"cert-seal"}),a.jsx("h1",{children:"Paradigm University"}),a.jsx("p",{className:"cert-title",children:"Universitas Paradigmatica — Lux in Codice"}),a.jsx("div",{className:"gold-divider"}),a.jsx("p",{style:{fontSize:"0.875rem",color:"var(--ink-muted)",marginTop:"var(--space-lg)"},children:"This is to certify that"}),a.jsx("div",{className:"cert-name",children:n.name}),a.jsxs("p",{className:"cert-body",children:["has successfully completed the",a.jsx("br",{}),a.jsx("strong",{children:"Paradigm Licensure Standardized Assessment Test"}),a.jsx("br",{}),"and is hereby recognized as a certified Paradigm practitioner."]}),a.jsxs("p",{className:"cert-score",children:["Score: ",n.score,"/",n.total," (",n.percentage,"%)"]}),a.jsx("div",{className:"gold-divider"}),a.jsxs("dl",{className:"cert-meta",children:[a.jsxs("div",{children:[a.jsx("dt",{children:"PLSAT Version"}),a.jsxs("dd",{children:["v",n.plsatVersion]})]}),a.jsxs("div",{children:[a.jsx("dt",{children:"Framework Version"}),a.jsxs("dd",{children:["v",n.frameworkVersion]})]}),a.jsxs("div",{children:[a.jsx("dt",{children:"Date Issued"}),a.jsx("dd",{children:new Date(n.date).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"})})]})]})]}),e.length>1&&a.jsxs("div",{className:"no-print mt-xl",children:[a.jsx("h3",{className:"mb-md",children:"All Attempts"}),[...e].reverse().map((r,l)=>a.jsx("div",{className:"ref-card",style:{marginBottom:"0.5rem"},children:a.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[a.jsxs("span",{children:["PLSAT v",r.plsatVersion," — ",r.score,"/",r.total," (",r.percentage,"%)",r.passed?" ✓":""]}),a.jsx("span",{className:"text-muted",children:new Date(r.date).toLocaleDateString()})]})},l))]})]}):a.jsxs("div",{className:"certificate-container",children:[a.jsxs("div",{className:"empty-state",children:[a.jsx(pn,{size:80}),a.jsx("h3",{className:"mt-lg",children:"No Certificates Yet"}),a.jsx("p",{children:"Pass the PLSAT examination to earn your Paradigm certification."}),a.jsx(q,{to:"/plsat",className:"btn btn-primary mt-lg",children:"Take the PLSAT"})]}),e.length>0&&a.jsxs("div",{className:"mt-xl",children:[a.jsx("h3",{className:"mb-md",children:"Previous Attempts"}),e.map((r,l)=>a.jsx("div",{className:"ref-card",style:{marginBottom:"0.5rem"},children:a.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[a.jsxs("span",{children:["PLSAT v",r.plsatVersion," — ",r.score,"/",r.total," (",r.percentage,"%)"]}),a.jsx("span",{className:"text-muted",children:new Date(r.date).toLocaleDateString()})]})},l))]})]})}function Mm(){return a.jsxs("div",{className:"app",children:[a.jsx(Zh,{version:"6.0.2"}),a.jsx("main",{className:"main-content",children:a.jsxs(Bh,{children:[a.jsx(We,{path:"/",element:a.jsx(Pm,{})}),a.jsx(We,{path:"/courses",element:a.jsx(_m,{})}),a.jsx(We,{path:"/course/:courseId",element:a.jsx(Au,{})}),a.jsx(We,{path:"/course/:courseId/:lessonId",element:a.jsx(Au,{})}),a.jsx(We,{path:"/course/:courseId/quiz/:lessonId",element:a.jsx(Tm,{})}),a.jsx(We,{path:"/plsat",element:a.jsx(Rm,{})}),a.jsx(We,{path:"/reference",element:a.jsx(Im,{})}),a.jsx(We,{path:"/certificate",element:a.jsx(Om,{})})]})})]})}hi.createRoot(document.getElementById("root")).render(a.jsx(vo.StrictMode,{children:a.jsx(Gh,{children:a.jsx(Mm,{})})}));
87
+ //# sourceMappingURL=index-CkgaxOXi.js.map