@a-company/paradigm 6.2.0 → 6.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/arch-loader-T3TARMSO.js +2 -0
- package/dist/chunk-ARLB6YYW.js +3 -0
- package/dist/chunk-EMGJWT7D.js +111 -0
- package/dist/chunk-MA75GS7J.js +635 -0
- package/dist/chunk-SU5F5D4I.js +3 -0
- package/dist/mcp.js +3 -52
- package/dist/reindex-PJVOMN57.js +2 -0
- package/dist/tools-BPEKRC2U.js +2 -0
- package/dist/university-ui/assets/{index-CkgaxOXi.js → index-SNyIB61M.js} +2 -2
- package/dist/university-ui/assets/{index-CkgaxOXi.js.map → index-SNyIB61M.js.map} +1 -1
- package/dist/university-ui/index.html +1 -1
- package/package.json +1 -1
- package/dist/chunk-K7EQHFZP.js +0 -111
- package/dist/chunk-UMC4RC66.js +0 -636
- package/dist/reindex-GSRV4MQO.js +0 -2
- package/dist/tools-F34P22PW.js +0 -2
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import*as k from'fs';import*as I from'js-yaml';import {z as z$1}from'zod';import*as S from'path';import {glob}from'glob';var E=z$1.object({description:z$1.string(),type:z$1.string().optional(),parent:z$1.string().optional(),anchors:z$1.array(z$1.string()).optional(),tags:z$1.array(z$1.string()).optional(),endpoints:z$1.array(z$1.string()).optional(),tests:z$1.array(z$1.string()).optional(),rules:z$1.record(z$1.unknown()).optional(),aspects:z$1.array(z$1.string()).optional(),flows:z$1.array(z$1.string()).optional(),gates:z$1.array(z$1.string()).optional(),signals:z$1.array(z$1.string()).optional(),states:z$1.array(z$1.string()).optional(),components:z$1.array(z$1.string()).optional(),location:z$1.string().optional(),locations:z$1.array(z$1.string()).optional(),uses:z$1.array(z$1.string()).optional(),"used-by":z$1.array(z$1.string()).optional(),"used-for":z$1.array(z$1.string()).optional(),exports:z$1.array(z$1.string()).optional(),status:z$1.string().optional(),properties:z$1.record(z$1.unknown()).optional(),handles:z$1.array(z$1.string()).optional()}).passthrough(),L=E.extend({id:z$1.string()}),fe=z$1.object({description:z$1.string().optional(),category:z$1.string().optional(),severity:z$1.enum(["info","warn","error"]).optional(),emitters:z$1.array(z$1.string()).optional(),related:z$1.array(z$1.string()).optional(),data:z$1.record(z$1.unknown()).optional()}),le=z$1.union([fe,z$1.string().transform(o=>({description:o}))]),ue=z$1.object({from:z$1.string(),to:z$1.string(),type:z$1.string(),description:z$1.string().optional()}),de=z$1.union([ue,z$1.string()]),me=z$1.object({component:z$1.string(),action:z$1.string(),description:z$1.string().optional()}),Y=z$1.union([me,z$1.string()]),ge=z$1.object({name:z$1.string(),description:z$1.string().optional(),steps:z$1.array(Y)}),he=z$1.object({description:z$1.string().optional(),gates:z$1.array(z$1.string()).optional(),signals:z$1.array(z$1.string()).optional(),components:z$1.array(z$1.string()).optional(),steps:z$1.array(Y).optional()}),ye=z$1.object({description:z$1.string().optional(),requires:z$1.array(z$1.string()).optional(),keys:z$1.array(z$1.string()).optional(),signals:z$1.array(z$1.string()).optional()}),$e=z$1.object({description:z$1.string().optional(),default:z$1.unknown().optional(),type:z$1.string().optional()}),we=z$1.object({description:z$1.string().optional(),tags:z$1.array(z$1.string()).optional(),anchors:z$1.array(z$1.string()).optional(),"applies-to":z$1.array(z$1.string()).optional(),enforcement:z$1.string().optional()}),be=z$1.object({target:z$1.string(),type:z$1.string(),path:z$1.string()}),Se=z$1.object({version:z$1.string().optional(),description:z$1.string().optional(),apiSpec:z$1.string().optional(),context:z$1.array(z$1.string()).optional(),rules:z$1.record(z$1.unknown()).optional(),features:z$1.union([z$1.array(L),z$1.record(E)]).optional(),components:z$1.union([z$1.array(L),z$1.record(E)]).optional(),gates:z$1.record(ye).optional(),states:z$1.record($e).optional(),signals:z$1.record(le).optional(),aspects:z$1.record(we).optional(),relationships:z$1.array(de).optional(),flows:z$1.union([z$1.array(ge),z$1.record(he)]).optional(),references:z$1.array(be).optional()});function ve(o){let t=xe(o);return {data:t.data,errors:t.errors}}function xe(o){let t=[],e=[],n;try{n=k.readFileSync(o,"utf8");}catch(c){let p=`Cannot read file: ${c.message}`;return t.push(p),e.push({message:p,type:"file"}),{data:null,errors:t,detailedErrors:e,rawContent:void 0,isYamlValid:false}}let a=n.replace(/^([#~!$^][\w-]+):/gm,'"$1":').replace(/^(\s*-\s+)([!#][\w-]+)$/gm,'$1"$2"'),i=null;try{i=I.load(a);}catch(c){let p=c,f=p.mark?.line?p.mark.line+1:void 0,u=`YAML syntax error: ${p.reason||c.message}`;return t.push(`${u}${f?` (line ${f})`:""}`),e.push({message:u,line:f,type:"yaml"}),{data:null,errors:t,detailedErrors:e,rawContent:n,isYamlValid:false}}if(i==null)return {data:{},errors:[],detailedErrors:[],rawContent:n,isYamlValid:true};if(typeof i=="object"&&i!==null){let c=i,p={"#":"components",$:"flows","^":"gates","!":"signals","~":"aspects"};for(let f of Object.keys(c)){let u=f[0],g=p[u];if(!g||f.length<2)continue;let h=f.slice(1),$=c[f];if(typeof $!="object"||$===null)continue;let x=c[g]||{};g in c||(c[g]=x),h in x||(x[h]=$),delete c[f];}}let r=Se.safeParse(i);if(!r.success){for(let c of r.error.issues){let p=c.path.join("."),f=c.message;t.push(`Schema error at ${p||"/"}: ${f}`),e.push({message:f,path:p||"/",type:"schema"});}return {data:i,errors:t,detailedErrors:e,rawContent:n,isYamlValid:true}}return {data:r.data,errors:[],detailedErrors:[],rawContent:n,isYamlValid:true}}function Ne(o){return I.dump(o,{indent:2,lineWidth:-1,noRefs:true,sortKeys:false})}function j(o){return o?Array.isArray(o)?o.map(t=>[t.id,t]):Object.entries(o):[]}async function ke(o){let t=S.resolve(o);return (await glob("**/.purpose",{cwd:t,absolute:true,ignore:["**/node_modules/**","**/dist/**","**/.git/**"]})).sort((n,a)=>{let i=n.split(S.sep).length,r=a.split(S.sep).length;return i-r})}async function B(o){let t=await ke(o),e=[];for(let n of t){let{data:a,errors:i}=ve(n);a&&(e.push({filePath:n,data:a}),i.length>0&&console.warn(`Warnings parsing ${n}:`,i));}return e}function V(o){let t=new Map;for(let{filePath:e,data:n}of o){let a=j(n.features);for(let[i,r]of a)t.set(i,{item:r,filePath:e});}return t}function _(o){let t=new Map;for(let{filePath:e,data:n}of o){let a=j(n.components);for(let[i,r]of a)t.set(i,{item:r,filePath:e});}return t}function N(o){let t=new Map;for(let{filePath:e,data:n}of o)if(n.gates)for(let[a,i]of Object.entries(n.gates))t.set(a,{item:i,filePath:e});return t}function K(o){let t=new Map;for(let{filePath:e,data:n}of o)if(n.states)for(let[a,i]of Object.entries(n.states))t.set(a,{item:i,filePath:e});return t}function q(o){let t=new Map;for(let{filePath:e,data:n}of o)if(n.flows)if(Array.isArray(n.flows))for(let a of n.flows)t.set(a.name,{item:{id:a.name,description:a.description,steps:a.steps},filePath:e});else for(let[a,i]of Object.entries(n.flows))t.set(a,{item:{id:a,description:i.description,gates:i.gates,signals:i.signals,components:i.components,steps:i.steps},filePath:e});return t}function Z(o){let t=new Map;for(let{filePath:e,data:n}of o)if(n.signals)for(let[a,i]of Object.entries(n.signals))t.set(a,{item:i,filePath:e});return t}function U(o){let t=new Map;for(let{filePath:e,data:n}of o)if(n.aspects)for(let[a,i]of Object.entries(n.aspects))t.set(a,{item:i,filePath:e});return t}function X(o){let t=[],e=new Set;for(let{filePath:n,data:a}of o){let i=j(a.features);for(let[c,p]of i)M(`#${c}`,p,n,t,e);let r=j(a.components);for(let[c,p]of r)M(`#${c}`,p,n,t,e);}return t}function M(o,t,e,n,a){if(t.flows)for(let i of t.flows){let r=i.startsWith("$")?i:`$${i}`;a.has(r)||(a.add(r),n.push({symbol:r,type:"flow",sourceSymbol:o,filePath:e}));}if(t.gates)for(let i of t.gates){let r=i.startsWith("^")?i:`^${i}`;a.has(r)||(a.add(r),n.push({symbol:r,type:"gate",sourceSymbol:o,filePath:e}));}if(t.signals)for(let i of t.signals){let r=i.startsWith("!")?i:`!${i}`;a.has(r)||(a.add(r),n.push({symbol:r,type:"signal",sourceSymbol:o,filePath:e}));}if(t.states)for(let i of t.states){let r=i.startsWith("#")?i:i.startsWith("%")?`#${i.slice(1)}`:`#${i}`;a.has(r)||(a.add(r),n.push({symbol:r,type:"component",sourceSymbol:o,filePath:e}));}if(t.components)for(let i of t.components){let r=i.startsWith("#")?i:`#${i}`;a.has(r)||(a.add(r),n.push({symbol:r,type:"component",sourceSymbol:o,filePath:e}));}if(t.aspects)for(let i of t.aspects){let r=i.startsWith("~")?i:`~${i}`;a.has(r)||(a.add(r),n.push({symbol:r,type:"aspect",sourceSymbol:o,filePath:e}));}if(t.description){let i=je(t.description);for(let{symbol:r,type:c}of i)a.has(r)||(a.add(r),n.push({symbol:r,type:c,sourceSymbol:o,filePath:e}));}}var Ce=new Set(["$lib","$env","$app","$service-worker","$virtual","$schema","$ref","$id","$type"]);function je(o){let t=[],e=/([$^!#~%])([a-zA-Z][a-zA-Z0-9._-]*)/g,n;for(;(n=e.exec(o))!==null;){let a=n[1],i=n[2],r,c;switch(a){case "#":c="component",r=`#${i}`;break;case "$":c="flow",r=`$${i}`;break;case "^":c="gate",r=`^${i}`;break;case "!":c="signal",r=`!${i}`;break;case "~":c="aspect",r=`~${i}`;break;case "%":c="component",r=`#${i}`;break;default:continue}Ce.has(r)||t.push({symbol:r,type:c});}return t}function v(o){return o?Array.isArray(o)?o.map(t=>[t.id,t]):Object.entries(o):[]}function O(o){return o?Array.isArray(o)?o.map(t=>t.id):Object.keys(o):[]}function qe(o,t){let e=[],n=t?`${t}: `:"",a=v(o.features);for(let[r,c]of a)G(r,c,"feature",n,e);let i=v(o.components);for(let[r,c]of i)G(r,c,"component",n,e);if(o.relationships){let r=new Set([...O(o.features),...O(o.components)]);for(let c of o.relationships){if(typeof c=="string"||!c||!c.from||!c.to)continue;let p=c.from.replace(/^[@#$%~^!?]/,"");!r.has(p)&&!c.from.includes(".")&&e.push({type:"warning",message:`${n}Relationship references unknown source: "${c.from}"`,path:"relationships"});let f=c.to.replace(/^[@#$%~^!?]/,"");!r.has(f)&&!c.to.includes(".")&&e.push({type:"warning",message:`${n}Relationship references unknown target: "${c.to}"`,path:"relationships"});}}if(o.flows){let r=new Set(O(o.components));if(Array.isArray(o.flows)){for(let c of o.flows)if(!(!c||typeof c!="object")&&(c.name||e.push({type:"error",message:`${n}Flow missing required "name" field`,path:"flows"}),c.steps&&Array.isArray(c.steps)))for(let p of c.steps){if(typeof p=="string"||!p||!p.component)continue;let f=p.component.replace(/^#/,"");r.has(f)||e.push({type:"warning",message:`${n}Flow "${c.name}" references unknown component: "${p.component}"`,path:`flows.${c.name}`});}}else for(let[c,p]of Object.entries(o.flows))if(!(!p||typeof p!="object")&&p.steps&&Array.isArray(p.steps))for(let f of p.steps){if(typeof f=="string"||!f||!f.component)continue;let u=f.component.replace(/^#/,"");r.has(u)||e.push({type:"warning",message:`${n}Flow "${c}" references unknown component: "${f.component}"`,path:`flows.${c}`});}}return {valid:e.filter(r=>r.type==="error").length===0,issues:e}}function G(o,t,e,n,a){let i=`${e}s.${o}`;if(/^[a-zA-Z][a-zA-Z0-9-]*$/.test(o)||a.push({type:"warning",message:`${n}${e} ID "${o}" should use alphanumeric characters and hyphens`,path:i}),(!t.description||t.description.trim()==="")&&a.push({type:"warning",message:`${n}${e} "${o}" has no description`,path:i}),t.endpoints)for(let r of t.endpoints)/^(GET|POST|PUT|PATCH|DELETE|HEAD|OPTIONS)\s+\//.test(r)||a.push({type:"warning",message:`${n}Endpoint "${r}" in ${e} "${o}" may not be in standard format (e.g., "GET /api/users")`,path:`${i}.endpoints`});}function Ze(o){let t=[],e=new Set;for(let{data:n}of o){let a=v(n.components);for(let[r]of a)e.add(`#${r}`),e.add(r);let i=v(n.features);for(let[r]of i)e.add(`#${r}`),e.add(r);if(n.gates)for(let r of Object.keys(n.gates))e.add(`^${r}`),e.add(r);if(n.signals)for(let r of Object.keys(n.signals))e.add(`!${r}`),e.add(r);if(n.flows)if(Array.isArray(n.flows))for(let r of n.flows)r?.name&&(e.add(`$${r.name}`),e.add(r.name));else for(let r of Object.keys(n.flows))e.add(`$${r}`),e.add(r);if(n.aspects)for(let r of Object.keys(n.aspects))e.add(`~${r}`),e.add(r);if(n.states)for(let r of Object.keys(n.states))e.add(`#${r}`),e.add(r);}for(let{filePath:n,data:a}of o){let i=n?`${n}: `:"",r=[...v(a.components),...v(a.features)];for(let[c,p]of r){if(p.parent){let u=p.parent.replace(/^["']|["']$/g,""),g=u.replace(/^[#$^!~@%?&]/,"");!e.has(u)&&!e.has(g)&&t.push({type:"warning",message:`${i}Component "${c}" references parent "${u}" which is not defined in any .purpose file`,path:`components.${c}.parent`});}let f=[{field:"gates",refs:p.gates},{field:"signals",refs:p.signals},{field:"flows",refs:p.flows},{field:"components",refs:p.components},{field:"aspects",refs:p.aspects}];for(let{field:u,refs:g}of f)if(g)for(let h of g){let $=h.replace(/^[#$^!~@%?&]/,"");!e.has(h)&&!e.has($)&&t.push({type:"warning",message:`${i}Symbol "${c}" references ${u} "${h}" which is not defined`,path:`components.${c}.${u}`});}}if(a.flows){if(Array.isArray(a.flows)){for(let c of a.flows)if(c?.steps)for(let p of c.steps){if(typeof p=="string"||!p?.component)continue;let f=p.component.replace(/^#/,"");!e.has(p.component)&&!e.has(f)&&t.push({type:"warning",message:`${i}Flow "${c.name}" step references "${p.component}" which is not defined`,path:`flows.${c.name}.steps`});}}else for(let[c,p]of Object.entries(a.flows))if(p?.steps)for(let f of p.steps){if(typeof f=="string"||!f?.component)continue;let u=f.component.replace(/^#/,"");!e.has(f.component)&&!e.has(u)&&t.push({type:"warning",message:`${i}Flow "${c}" step references "${f.component}" which is not defined`,path:`flows.${c}.steps`});}}}return {valid:t.filter(n=>n.type==="error").length===0,issues:t}}var Ie={visualizerPort:42195,watcherPort:42196,autoConnect:true};async function D(o){let t=S.resolve(o),e=S.dirname(t);if(!k.existsSync(t))throw new Error(`Gate config not found: ${t}`);let n=k.readFileSync(t,"utf8"),a=I.load(n);if(!a.version)throw new Error('Gate config missing required "version" field');let i=[],r=a,c=a.gates||r.portals;if(c)for(let[f,u]of Object.entries(c)){let g=f.startsWith("^")?f.slice(1):f;i.push(F(g,u));}if(a.include)for(let f of a.include){let u=S.join(e,f),g=await glob(u.replace(/\\/g,"/"));for(let h of g){let $=await Ae(h);i.push(...$);}}let p=[];if(a.flows)for(let[f,u]of Object.entries(a.flows))p.push(Oe(f,u));return {version:a.version,gates:i,flows:p,settings:{dev:{...Ie,...a.settings?.dev}}}}async function Ae(o){let t=k.readFileSync(o,"utf8"),e=I.load(t);if(e.id){let n=e.id,a=n.startsWith("^")?n.slice(1):n;return [F(a,e)]}if(e.gates){let n=[];for(let[a,i]of Object.entries(e.gates)){let r=a.startsWith("^")?a.slice(1):a;n.push(F(r,i));}return n}return []}function F(o,t){let e=[];if(t.locks)for(let a of t.locks)e.push(De(a));let n=[];if(t.prizes)for(let a of t.prizes)n.push(ze(a));return {id:o,description:t.description,locks:e,prizes:n,position:t.position}}function De(o){let t=o,e=[];if(t.keys){for(let n of t.keys)if(typeof n=="string")e.push({expression:n});else if(n.expression){let a=n;e.push({expression:a.expression,description:a.description});}}return {id:t.id,description:t.description,keys:e,mode:t.mode||"all"}}function ze(o){let t=o;return {id:t.id,oneTime:t.oneTime??false,metadata:t.metadata}}function Oe(o,t){return {id:o,description:t.description,gates:t.gates||[],forkable:t.forkable}}async function J(o){let t=S.resolve(o);return await glob("**/portal.yaml",{cwd:t,absolute:true,ignore:["**/node_modules/**","**/dist/**","**/.git/**"]})}function He(o){if(o instanceof I.YAMLException){let t=(o.reason||"").toLowerCase();return t.includes("duplicated mapping key")||t.includes("duplicate mapping key")?{errorClass:"duplicate-key",detail:"duplicate mapping key"}:["unexpected","expected","bad indentation","mapping values","cannot read a block mapping entry","end of the stream","while scanning","while parsing"].some(n=>t.includes(n))?{errorClass:"syntax",detail:"yaml syntax error"}:{errorClass:"other",detail:"yaml parse error"}}return {errorClass:"other",detail:"yaml parse error"}}var Ee=z$1.object({x:z$1.number(),y:z$1.number()}),Fe=z$1.object({x:z$1.number(),y:z$1.number(),zoom:z$1.number()}),ee=z$1.object({path:z$1.string(),include:z$1.array(z$1.string()).optional(),exclude:z$1.array(z$1.string()).optional()}),oe=z$1.object({id:z$1.string(),symbol:z$1.string(),type:z$1.enum(["feature","component","flow","state","aspect","gate","signal","idea"]),content:z$1.string().optional(),position:Ee,tags:z$1.array(z$1.string()).optional(),created:z$1.string(),modified:z$1.string().optional()}),se=z$1.object({from:z$1.string(),to:z$1.string(),label:z$1.string().optional(),type:z$1.string().optional()}),Te=z$1.object({id:z$1.string(),name:z$1.string(),nodes:z$1.array(z$1.string()),color:z$1.string().optional()}),ne=z$1.object({viewport:Fe,groups:z$1.array(Te).optional()}),Re=z$1.object({nodes:z$1.array(oe),connections:z$1.array(se),layout:ne}),Le=z$1.object({id:z$1.string(),name:z$1.string(),timestamp:z$1.string(),description:z$1.string().optional(),state:Re});z$1.object({version:z$1.string(),metadata:z$1.object({name:z$1.string(),created:z$1.string(),modified:z$1.string()}),sources:z$1.object({purpose:z$1.array(ee).optional(),portal:z$1.array(ee).optional()}),nodes:z$1.array(oe),connections:z$1.array(se),layout:ne,snapshots:z$1.array(Le).optional()});async function Me(o,t){let e=[],n=[],a=[],i=[];if(o.sources.purpose)for(let p of o.sources.purpose){let f=S.resolve(t,p.path);try{let u=await B(f);a.push(...u.map(d=>d.filePath));let g=V(u);for(let[d,{item:m,filePath:y}]of g){let P=["feature",...m.tags||[]];e.push(w({id:`purpose-feature-${d}`,symbol:`#${d}`,type:"component",source:"purpose",filePath:y,data:m,description:m.description,tags:P,componentType:m.type,parentSymbol:m.parent,anchors:m.anchors?.map(pe=>T(pe))}));}let h=_(u);for(let[d,{item:m,filePath:y}]of h)e.push(w({id:`purpose-component-${d}`,symbol:`#${d}`,type:"component",source:"purpose",filePath:y,data:m,description:m.description,tags:m.tags,componentType:m.type,parentSymbol:m.parent,anchors:m.anchors?.map(P=>T(P))}));let $=N(u);for(let[d,{item:m,filePath:y}]of $)e.push(w({id:`purpose-gate-${d}`,symbol:`^${d}`,type:"gate",source:"purpose",filePath:y,data:m,description:m.description}));let x=K(u);for(let[d,{item:m,filePath:y}]of x)e.push(w({id:`purpose-state-${d}`,symbol:`#${d}`,type:"component",source:"purpose",filePath:y,data:m,description:m.description,tags:["state"]}));let re=q(u);for(let[d,{item:m,filePath:y}]of re)e.push(w({id:`purpose-flow-${d}`,symbol:`$${d}`,type:"flow",source:"purpose",filePath:y,data:m,description:m.description}));let ae=Z(u);for(let[d,{item:m,filePath:y}]of ae)e.push(w({id:`purpose-signal-${d}`,symbol:`!${d}`,type:"signal",source:"purpose",filePath:y,data:m,description:m.description}));let ie=U(u);for(let[d,{item:m,filePath:y}]of ie)e.push(w({id:`purpose-aspect-${d}`,symbol:`~${d}`,type:"aspect",source:"purpose",filePath:y,data:m,description:m.description,anchors:m.anchors?.map(P=>T(P)),appliesTo:m["applies-to"],tags:m.tags,enforcement:m.enforcement}));let ce=X(u),R=new Set(e.map(d=>d.symbol));for(let d of ce)R.has(d.symbol)||(R.add(d.symbol),e.push(w({id:`purpose-ref-${d.type}-${d.symbol.slice(1)}`,symbol:d.symbol,type:d.type,source:"purpose",filePath:d.filePath,data:{referencedFrom:d.sourceSymbol},description:`Referenced from ${d.sourceSymbol}`})));}catch(u){n.push({source:"purpose",filePath:f,message:u.message});}}if(o.sources.portal)for(let p of o.sources.portal){let f=S.resolve(t,p.path);try{let u;if(f.endsWith(".yaml")||f.endsWith(".yml"))u=await D(f),i.push(f);else {let g=await J(f);if(i.push(...g),g.length>0){u=await D(g[0]);for(let h=1;h<g.length;h++){let $=await D(g[h]);u.gates.push(...$.gates),u.flows.push(...$.flows);}}else continue}for(let g of u.gates){e.push(Ge(g,f));for(let h of g.prizes)e.push(w({id:`gate-signal-${g.id}-${h.id}`,symbol:`!${h.id}`,type:"signal",source:"portal",filePath:f,data:h,description:`Signal from gate ${g.id}`}));}for(let g of u.flows)e.push(We(g,f));}catch(u){n.push({source:"portal",filePath:f,message:u.message});}}for(let p of o.nodes){let f=p.tags?.includes("idea");if(!p.content&&!f){let u=e.find(g=>g.symbol===p.symbol);if(u){u.position=p.position,u.tags=p.tags;continue}}e.push(w({id:p.id,symbol:p.symbol,type:p.type,source:"premise",filePath:".premise",data:p,description:p.content,position:p.position,tags:p.tags,created:p.created,modified:p.modified}));}Be(e);let r=new Map;for(let p of e){let f=r.get(p.symbol)||[];f.includes(p.filePath)||f.push(p.filePath),r.set(p.symbol,f);}let c=[];for(let[p,f]of r)f.length>1&&c.push({symbol:p,files:f});return {symbols:e,purposeFiles:a,portalFiles:i,errors:n,timestamp:Date.now(),...c.length>0?{duplicateSymbols:c}:{}}}function w(o){return {...o,data:o.data??null,references:o.references??[],referencedBy:o.referencedBy??[]}}function Ge(o,t){let e=o.id.startsWith("^")?o.id.slice(1):o.id;return w({id:`gate-${e}`,symbol:`^${e}`,type:"gate",source:"portal",filePath:t,data:o,description:o.description,position:o.position})}function We(o,t){return w({id:`gate-flow-${o.id}`,symbol:`$${o.id}`,type:"flow",source:"portal",filePath:t,data:o,description:o.description})}function T(o){let t=o.lastIndexOf(":");if(t===-1||t===o.length-1)return {path:o,lines:0,raw:o};let e=o.slice(t+1),n=o.slice(0,t);if(!/^[\d,\- ]+$/.test(e))return {path:o,lines:0,raw:o};if(e.includes("-")){let[a,i]=e.split("-").map(Number);return {path:n,lines:[a,i],raw:o}}else if(e.includes(",")){let a=e.split(",").map(Number);return {path:n,lines:a,raw:o}}else return {path:n,lines:Number(e),raw:o}}var Ye=new Set(["$lib","$env","$app","$service-worker","$virtual","$schema","$ref","$id","$type"]);function Be(o){let t=new Map(o.map(e=>[e.symbol,e]));for(let e of o){let n=JSON.stringify(e.data),a=/(?:\?[@#$%~^!]|[@#$%~^!?])[a-zA-Z][\w-]*/g,i=(n.match(a)||[]).filter(r=>!Ye.has(r));for(let r of i)if(r!==e.symbol&&t.has(r)){e.references.includes(r)||e.references.push(r);let c=t.get(r);c&&!c.referencedBy.includes(e.symbol)&&c.referencedBy.push(e.symbol);}}}async function st(o){let t={metadata:{name:S.basename(o),created:new Date().toISOString(),modified:new Date().toISOString()},sources:{purpose:[{path:"./"}],portal:[{path:"./"}]},nodes:[]};return Me(t,o)}function Ve(){return {entries:new Map,byType:new Map,bySource:new Map,timestamp:0}}function nt(o){let t=Ve();t.timestamp=o.timestamp;for(let e of o.symbols)t.entries.set(e.id,e),t.byType.has(e.type)||t.byType.set(e.type,[]),t.byType.get(e.type).push(e),t.bySource.has(e.source)||t.bySource.set(e.source,[]),t.bySource.get(e.source).push(e);return t}function z(o,t){for(let e of o.entries.values())if(e.symbol===t)return e}function rt(o,t){return o.byType.get(t)||[]}function at(o,t){let e=t.toLowerCase(),n=[];for(let a of o.entries.values()){if(a.symbol.toLowerCase().includes(e)){n.push(a);continue}if(a.description?.toLowerCase().includes(e)){n.push(a);continue}if(a.tags?.some(i=>i.toLowerCase().includes(e))){n.push(a);continue}if(a.componentType?.toLowerCase().includes(e)){n.push(a);continue}}return n}function it(o,t){let e=z(o,t);return e?e.referencedBy.map(n=>z(o,n)).filter(n=>n!==void 0):[]}function ct(o,t){let e=z(o,t);return e?e.references.map(n=>z(o,n)).filter(n=>n!==void 0):[]}function pt(o){let t={component:0,flow:0,gate:0,signal:0,aspect:0};for(let[e,n]of o.byType)e in t&&(t[e]=n.length);return t}function ft(o){return Array.from(o.entries.values())}
|
|
3
|
+
export{ve as a,xe as b,Ne as c,ke as d,qe as e,Ze as f,D as g,He as h,st as i,nt as j,z as k,rt as l,at as m,it as n,ct as o,pt as p,ft as q};
|
package/dist/mcp.js
CHANGED
|
@@ -1,54 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {d,g,h,e,a as a$1,b as b$1,f,c}from'./chunk-UMC4RC66.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 {m as m$1,n,p,h as h$1,i,ua}from'./chunk-K7EQHFZP.js';import'./chunk-M4UMM6DC.js';import'./chunk-GRZQIKST.js';import'./chunk-KAFQA7HV.js';import {j as j$1}from'./chunk-6QXBXZF6.js';import {b,a}from'./chunk-EK4ZRIFJ.js';import'./chunk-LAYBUKMB.js';import'./chunk-DVZWCXB6.js';import'./chunk-QGZRM6ZB.js';import'./chunk-K7X3Z3GL.js';import'./chunk-5TAVYPOV.js';import {Server}from'@modelcontextprotocol/sdk/server/index.js';import {StdioServerTransport}from'@modelcontextprotocol/sdk/server/stdio.js';import {ListResourcesRequestSchema,ReadResourceRequestSchema}from'@modelcontextprotocol/sdk/types.js';import*as l from'fs';import*as m from'path';function se(e){return {id:e.id,symbol:`^${e.id}`,description:e.description,locks:e.locks?.map(s=>({id:s.id,description:s.description,keys:s.keys?.map(n=>n.expression||n),mode:s.mode||"all"})),prizes:e.prizes?.map(s=>({id:s.id,oneTime:s.oneTime}))}}function F(e){let s=e.gateConfig?.gates||[],n=i(e.index,"gate"),t=new Map;for(let o of n){let i=o.symbol.replace(/^\^/,"");t.set(i,{id:i,symbol:o.symbol,description:o.description,source:"purpose",filePath:o.filePath,data:o.data});}for(let o of s)t.set(o.id,{...se(o),source:"portal.yaml"});return Array.from(t.values())}function I(e){let s=e.gateConfig?.flows||[],n=i(e.index,"flow"),t=new Map;for(let o of n){let i=o.symbol.replace(/^\$/,"");t.set(i,{id:i,symbol:o.symbol,description:o.description,source:"purpose",filePath:o.filePath,data:o.data});}for(let o of s)t.set(o.id,{id:o.id,symbol:`$${o.id}`,description:o.description,gates:o.gates,source:"portal.yaml"});return Array.from(t.values())}function U(){return [{uri:"paradigm://wisdom/preferences",name:"Wisdom - Preferences",description:"Team preferences for patterns, testing, and code style",mimeType:"application/json"},{uri:"paradigm://wisdom/antipatterns",name:"Wisdom - Antipatterns",description:"What NOT to do, with reasons and alternatives",mimeType:"application/json"},{uri:"paradigm://wisdom/decisions",name:"Wisdom - Decisions",description:"Architectural Decision Records (ADRs) index",mimeType:"application/json"}]}async function z(e$1,s){if(e$1==="wisdom/preferences"){let n=await e(s);return {handled:true,text:JSON.stringify({version:n.preferences?.version||"1.0",global:n.preferences?.global||{},by_symbol:n.preferences?.by_symbol||{},symbol_count:Object.keys(n.preferences?.by_symbol||{}).length},null,2)}}if(e$1.startsWith("wisdom/preferences/")){let n=decodeURIComponent(e$1.replace("wisdom/preferences/","")),t=await e(s),o=a$1(t,n);return {handled:true,text:JSON.stringify({symbol:n,preferences:o.preferences,global:t.preferences?.global||{}},null,2)}}if(e$1==="wisdom/antipatterns"){let n=await e(s);return {handled:true,text:JSON.stringify({count:n.antipatterns.length,antipatterns:n.antipatterns},null,2)}}if(e$1.startsWith("wisdom/antipatterns/")){let n=decodeURIComponent(e$1.replace("wisdom/antipatterns/","")),t=await e(s),o=a$1(t,n);return {handled:true,text:JSON.stringify({symbol:n,count:o.antipatterns.length,antipatterns:o.antipatterns},null,2)}}if(e$1==="wisdom/decisions"){let n=await e(s);return {handled:true,text:JSON.stringify({count:n.decisions.length,decisions:n.decisions.map(t=>({id:t.id,title:t.title,status:t.status,date:t.date,symbols:t.symbols}))},null,2)}}if(e$1.startsWith("wisdom/decision/")){let n=e$1.replace("wisdom/decision/",""),t=await e(s),o=t.decisions.find(i=>i.id===n);return o?{handled:true,text:JSON.stringify(o,null,2)}:{handled:true,text:JSON.stringify({error:"Decision not found",id:n,available:t.decisions.map(i=>i.id)},null,2)}}if(e$1.startsWith("wisdom/expertise/")){let n=decodeURIComponent(e$1.replace("wisdom/expertise/","")),t=await e(s),o=b$1(t,{symbol:n});return {handled:true,text:JSON.stringify({symbol:n,count:o.length,experts:o.map(i=>({name:i.name,symbols:i.symbols,areas:i.areas,contact:i.contact}))},null,2)}}return {handled:false,text:""}}function G(){return [{uri:"paradigm://history/fragile",name:"History - Fragile Symbols",description:"Symbols with high fragility that need extra care when modifying",mimeType:"application/json"},{uri:"paradigm://history/validation/summary",name:"History - Validation Summary",description:"Overall validation statistics and pass rates",mimeType:"application/json"}]}async function $(e,s){if(e.startsWith("history/symbol/")&&!e.endsWith("/recent")){let n=decodeURIComponent(e.replace("history/symbol/","")),t=await f(s),o=c(t,n);return {handled:true,text:JSON.stringify({symbol:n,summary:o.summary?{total_changes:o.summary.total_changes,last_modified:o.summary.last_modified,stability_score:o.summary.stability_score,fragility:o.summary.fragility,contributors:o.summary.contributors}:null,recent:o.recent,co_changes:o.co_changes,validation:o.validation},null,2)}}if(e.startsWith("history/symbol/")&&e.endsWith("/recent")){let n=decodeURIComponent(e.replace("history/symbol/","").replace("/recent","")),t=await f(s),o=c(t,n);return {handled:true,text:JSON.stringify({symbol:n,fragility:o.summary?.fragility||"unknown",stability_score:o.summary?.stability_score,recent:o.recent.slice(0,5)},null,2)}}if(e==="history/fragile"){let n=await f(s);return {handled:true,text:JSON.stringify({count:n.index?.fragile_symbols?.length||0,fragile_symbols:n.index?.fragile_symbols||[],recommendation:"Consider adding extra test coverage and reviewing recent changes before modifying these symbols"},null,2)}}if(e.startsWith("history/cochanges/")){let n=decodeURIComponent(e.replace("history/cochanges/","")),o=(await f(s)).index?.co_changes?.filter(i=>i.symbols.includes(n))||[];return {handled:true,text:JSON.stringify({symbol:n,count:o.length,co_changes:o.map(i=>({with:i.symbols.filter(r=>r!==n),frequency:i.frequency,correlation:i.correlation})),recommendation:o.length>0?"These symbols often change together - consider if they need updates too":"No strong co-change patterns detected"},null,2)}}if(e==="history/validation/summary"){let n=await f(s);return {handled:true,text:JSON.stringify({last_run:n.validation?.last_run,total_validations:n.validation?.total_validations||0,pass_rate:n.validation?.pass_rate||0,by_symbol:n.validation?.by_symbol||{}},null,2)}}return {handled:false,text:""}}function q(){return [{uri:"paradigm://context/agent-protocol",name:"Agent Protocol",description:"IMPORTANT: Read this first. Workflow instructions for using Paradigm MCP tools effectively.",mimeType:"text/markdown"},{uri:"paradigm://context/session",name:"Session Info",description:"Current MCP session statistics and context usage estimate",mimeType:"application/json"},{uri:"paradigm://context/handoff-guide",name:"Handoff Guide",description:"When and how to perform context handoffs",mimeType:"text/markdown"}]}async function H(e,s){if(e==="context/agent-protocol")return {handled:true,text:`# Agent Protocol for Paradigm MCP Tools
|
|
3
|
-
|
|
4
|
-
## Query Before Modify
|
|
5
|
-
|
|
6
|
-
**Always query before making changes** - this ensures you understand impact and dependencies.
|
|
7
|
-
|
|
8
|
-
| Before doing this... | Call this MCP tool |
|
|
9
|
-
|---------------------|-------------------|
|
|
10
|
-
| Modifying a symbol | \`paradigm_ripple\` with the symbol |
|
|
11
|
-
| Starting a session | \`paradigm_status\` for project overview |
|
|
12
|
-
| Understanding code | \`paradigm_navigate\` with explore intent |
|
|
13
|
-
| Checking dependencies | \`paradigm_related\` for connections |
|
|
14
|
-
|
|
15
|
-
## Example Workflow
|
|
16
|
-
|
|
17
|
-
1. **Get oriented**: Call \`paradigm_status\` to see project symbols and health
|
|
18
|
-
2. **Find relevant code**: Call \`paradigm_navigate\` with intent "find" or "explore"
|
|
19
|
-
3. **Before editing**: Call \`paradigm_ripple\` on symbols you'll modify
|
|
20
|
-
4. **Check context**: Call \`paradigm_session_health\` every 10-15 tool calls
|
|
21
|
-
|
|
22
|
-
## Benefits
|
|
23
|
-
|
|
24
|
-
- **Fresh data**: Always current from live project index
|
|
25
|
-
- **Precise**: Only get the data you need
|
|
26
|
-
- **Token-efficient**: ~100 tokens per query vs ~2000 for reading files
|
|
27
|
-
|
|
28
|
-
## Context Monitoring
|
|
29
|
-
|
|
30
|
-
Call \`paradigm_session_health\` periodically to monitor session health:
|
|
31
|
-
- **<50%**: Continue working
|
|
32
|
-
- **50-70%**: Plan a stopping point
|
|
33
|
-
- **70-85%**: Prepare handoff soon
|
|
34
|
-
- **>85%**: Handoff after current task
|
|
35
|
-
|
|
36
|
-
## Available Tools Summary
|
|
37
|
-
|
|
38
|
-
| Tool | Purpose |
|
|
39
|
-
|------|---------|
|
|
40
|
-
| \`paradigm_status\` | Project overview and health |
|
|
41
|
-
| \`paradigm_search\` | Find symbols by name/description |
|
|
42
|
-
| \`paradigm_ripple\` | Impact analysis before changes |
|
|
43
|
-
| \`paradigm_related\` | Symbol dependencies |
|
|
44
|
-
| \`paradigm_navigate\` | Codebase exploration |
|
|
45
|
-
| \`paradigm_session_health\` | Session health monitoring |
|
|
46
|
-
| \`paradigm_handoff_prepare\` | Prepare context handoff |
|
|
47
|
-
|
|
48
|
-
---
|
|
49
|
-
|
|
50
|
-
*This protocol ensures efficient, safe modifications to the codebase.*
|
|
51
|
-
`};if(e==="context/session"){let n=j$1(),t=n.getStats(),o=n.getDurationMinutes();return {handled:true,text:JSON.stringify({session:{durationMinutes:o,startTime:new Date(t.startTime).toISOString(),lastActivity:new Date(t.lastActivity).toISOString()},interactions:{toolCalls:t.totals.toolCallCount,resourceReads:t.totals.resourceReadCount,totalInteractions:t.totals.toolCallCount+t.totals.resourceReadCount},tokens:{estimatedMcpContribution:t.totals.totalTokens,note:"Use paradigm_session_health tool for full analysis with handoff recommendations"}},null,2)}}return e==="context/handoff-guide"?{handled:true,text:`# Context Handoff Guide
|
|
2
|
+
import {d,g,h,e,a as a$1,b as b$2,f,c}from'./chunk-MA75GS7J.js';import {b as b$1,ga}from'./chunk-EMGJWT7D.js';import'./chunk-4UJ4NIEQ.js';import'./chunk-4N56FRNE.js';import'./chunk-Q527BPUF.js';import'./chunk-KLBH26PA.js';import'./chunk-ARLB6YYW.js';import {p,q as q$1,k,l as l$1}from'./chunk-SU5F5D4I.js';import'./chunk-JNSJVCTU.js';import'./chunk-XROULIQN.js';import'./chunk-ZUAUFZRJ.js';import'./chunk-3KVVC4WV.js';import'./chunk-M4UMM6DC.js';import'./chunk-GRZQIKST.js';import'./chunk-KAFQA7HV.js';import {j as j$1}from'./chunk-6QXBXZF6.js';import {b,a}from'./chunk-EK4ZRIFJ.js';import'./chunk-LAYBUKMB.js';import'./chunk-DVZWCXB6.js';import'./chunk-QGZRM6ZB.js';import'./chunk-K7X3Z3GL.js';import'./chunk-5TAVYPOV.js';import {Server}from'@modelcontextprotocol/sdk/server/index.js';import {StdioServerTransport}from'@modelcontextprotocol/sdk/server/stdio.js';import {ListResourcesRequestSchema,ReadResourceRequestSchema}from'@modelcontextprotocol/sdk/types.js';import*as l from'fs';import*as m from'path';function se(e){return {id:e.id,symbol:`^${e.id}`,description:e.description,locks:e.locks?.map(s=>({id:s.id,description:s.description,keys:s.keys?.map(n=>n.expression||n),mode:s.mode||"all"})),prizes:e.prizes?.map(s=>({id:s.id,oneTime:s.oneTime}))}}function L(e){let s=e.gateConfig?.gates||[],n=l$1(e.index,"gate"),t=new Map;for(let o of n){let i=o.symbol.replace(/^\^/,"");t.set(i,{id:i,symbol:o.symbol,description:o.description,source:"purpose",filePath:o.filePath,data:o.data});}for(let o of s)t.set(o.id,{...se(o),source:"portal.yaml"});return Array.from(t.values())}function F(e){let s=e.gateConfig?.flows||[],n=l$1(e.index,"flow"),t=new Map;for(let o of n){let i=o.symbol.replace(/^\$/,"");t.set(i,{id:i,symbol:o.symbol,description:o.description,source:"purpose",filePath:o.filePath,data:o.data});}for(let o of s)t.set(o.id,{id:o.id,symbol:`$${o.id}`,description:o.description,gates:o.gates,source:"portal.yaml"});return Array.from(t.values())}function z(){return [{uri:"paradigm://wisdom/preferences",name:"Wisdom - Preferences",description:"Team preferences for patterns, testing, and code style",mimeType:"application/json"},{uri:"paradigm://wisdom/antipatterns",name:"Wisdom - Antipatterns",description:"What NOT to do, with reasons and alternatives",mimeType:"application/json"},{uri:"paradigm://wisdom/decisions",name:"Wisdom - Decisions",description:"Architectural Decision Records (ADRs) index",mimeType:"application/json"}]}async function U(e$1,s){if(e$1==="wisdom/preferences"){let n=await e(s);return {handled:true,text:JSON.stringify({version:n.preferences?.version||"1.0",global:n.preferences?.global||{},by_symbol:n.preferences?.by_symbol||{},symbol_count:Object.keys(n.preferences?.by_symbol||{}).length},null,2)}}if(e$1.startsWith("wisdom/preferences/")){let n=decodeURIComponent(e$1.replace("wisdom/preferences/","")),t=await e(s),o=a$1(t,n);return {handled:true,text:JSON.stringify({symbol:n,preferences:o.preferences,global:t.preferences?.global||{}},null,2)}}if(e$1==="wisdom/antipatterns"){let n=await e(s);return {handled:true,text:JSON.stringify({count:n.antipatterns.length,antipatterns:n.antipatterns},null,2)}}if(e$1.startsWith("wisdom/antipatterns/")){let n=decodeURIComponent(e$1.replace("wisdom/antipatterns/","")),t=await e(s),o=a$1(t,n);return {handled:true,text:JSON.stringify({symbol:n,count:o.antipatterns.length,antipatterns:o.antipatterns},null,2)}}if(e$1==="wisdom/decisions"){let n=await e(s);return {handled:true,text:JSON.stringify({count:n.decisions.length,decisions:n.decisions.map(t=>({id:t.id,title:t.title,status:t.status,date:t.date,symbols:t.symbols}))},null,2)}}if(e$1.startsWith("wisdom/decision/")){let n=e$1.replace("wisdom/decision/",""),t=await e(s),o=t.decisions.find(i=>i.id===n);return o?{handled:true,text:JSON.stringify(o,null,2)}:{handled:true,text:JSON.stringify({error:"Decision not found",id:n,available:t.decisions.map(i=>i.id)},null,2)}}if(e$1.startsWith("wisdom/expertise/")){let n=decodeURIComponent(e$1.replace("wisdom/expertise/","")),t=await e(s),o=b$2(t,{symbol:n});return {handled:true,text:JSON.stringify({symbol:n,count:o.length,experts:o.map(i=>({name:i.name,symbols:i.symbols,areas:i.areas,contact:i.contact}))},null,2)}}return {handled:false,text:""}}function $(){return [{uri:"paradigm://history/fragile",name:"History - Fragile Symbols",description:"Symbols with high fragility that need extra care when modifying",mimeType:"application/json"},{uri:"paradigm://history/validation/summary",name:"History - Validation Summary",description:"Overall validation statistics and pass rates",mimeType:"application/json"}]}async function G(e,s){if(e.startsWith("history/symbol/")&&!e.endsWith("/recent")){let n=decodeURIComponent(e.replace("history/symbol/","")),t=await f(s),o=c(t,n);return {handled:true,text:JSON.stringify({symbol:n,summary:o.summary?{total_changes:o.summary.total_changes,last_modified:o.summary.last_modified,stability_score:o.summary.stability_score,fragility:o.summary.fragility,contributors:o.summary.contributors}:null,recent:o.recent,co_changes:o.co_changes,validation:o.validation},null,2)}}if(e.startsWith("history/symbol/")&&e.endsWith("/recent")){let n=decodeURIComponent(e.replace("history/symbol/","").replace("/recent","")),t=await f(s),o=c(t,n);return {handled:true,text:JSON.stringify({symbol:n,fragility:o.summary?.fragility||"unknown",stability_score:o.summary?.stability_score,recent:o.recent.slice(0,5)},null,2)}}if(e==="history/fragile"){let n=await f(s);return {handled:true,text:JSON.stringify({count:n.index?.fragile_symbols?.length||0,fragile_symbols:n.index?.fragile_symbols||[],recommendation:"Consider adding extra test coverage and reviewing recent changes before modifying these symbols"},null,2)}}if(e.startsWith("history/cochanges/")){let n=decodeURIComponent(e.replace("history/cochanges/","")),o=(await f(s)).index?.co_changes?.filter(i=>i.symbols.includes(n))||[];return {handled:true,text:JSON.stringify({symbol:n,count:o.length,co_changes:o.map(i=>({with:i.symbols.filter(a=>a!==n),frequency:i.frequency,correlation:i.correlation})),recommendation:o.length>0?"These symbols often change together - consider if they need updates too":"No strong co-change patterns detected"},null,2)}}if(e==="history/validation/summary"){let n=await f(s);return {handled:true,text:JSON.stringify({last_run:n.validation?.last_run,total_validations:n.validation?.total_validations||0,pass_rate:n.validation?.pass_rate||0,by_symbol:n.validation?.by_symbol||{}},null,2)}}return {handled:false,text:""}}function q(){return [{uri:"paradigm://context/agent-protocol",name:"Agent Protocol",description:"IMPORTANT: Read this first. Workflow instructions for using Paradigm MCP tools effectively.",mimeType:"text/markdown"},{uri:"paradigm://context/session",name:"Session Info",description:"Current MCP session statistics and context usage estimate",mimeType:"application/json"},{uri:"paradigm://context/handoff-guide",name:"Handoff Guide",description:"When and how to perform context handoffs",mimeType:"text/markdown"}]}async function H(e,s){if(e==="context/agent-protocol")return {handled:true,text:'# Agent Protocol for Paradigm MCP Tools\n\n## What Paradigm Is\n\nParadigm adds a metadata layer (`.purpose` files + `portal.yaml`) to any codebase so AI agents can query architecture context via MCP instead of reading source files directly.\n\n**What it does**\n- Tracks codebase symbols: `#components`, `$flows`, `^gates`, `!signals`, `~aspects`\n- Answers queries about structure, dependencies, authorization, and history without file reads\n- Enforces coverage: hooks block sessions that modify code without updating `.purpose` files\n\n**Tool surface (50+ tools)**\n- Navigation: `paradigm_status`, `paradigm_search`, `paradigm_navigate`, `paradigm_related`\n- Impact: `paradigm_ripple`, `paradigm_flows_affected`\n- Authorization: `paradigm_gates_for_route`, `paradigm_portal_add_gate`\n- History: `paradigm_history_context`, `paradigm_lore_record`, `paradigm_lore_search`\n- Agents: `paradigm_agent_list`, `paradigm_orchestrate_inline`, `paradigm_ambient_events`\n- Compliance: `paradigm_aspect_check`, `paradigm_protocol_search`\n- Session: `paradigm_session_health`, `paradigm_handoff_prepare`\n\n**Setup** (if not already initialized)\nRun `paradigm shift` \u2014 auto-detects language/framework, creates `.paradigm/` config, scaffolds `.purpose` and `portal.yaml`, installs hooks.\n\n---\n\n## Query Before Modify\n\n**Always query before making changes** - this ensures you understand impact and dependencies.\n\n| Before doing this... | Call this MCP tool |\n|---------------------|-------------------|\n| Modifying a symbol | `paradigm_ripple` with the symbol |\n| Starting a session | `paradigm_status` for project overview |\n| Understanding code | `paradigm_navigate` with explore intent |\n| Checking dependencies | `paradigm_related` for connections |\n\n## Example Workflow\n\n1. **Get oriented**: Call `paradigm_status` to see project symbols and health\n2. **Find relevant code**: Call `paradigm_navigate` with intent "find" or "explore"\n3. **Before editing**: Call `paradigm_ripple` on symbols you\'ll modify\n4. **Check context**: Call `paradigm_session_health` every 10-15 tool calls\n\n## Benefits\n\n- **Fresh data**: Always current from live project index\n- **Precise**: Only get the data you need\n- **Token-efficient**: ~100 tokens per query vs ~2000 for reading files\n\n## Context Monitoring\n\nCall `paradigm_session_health` periodically to monitor session health:\n- **<50%**: Continue working\n- **50-70%**: Plan a stopping point\n- **70-85%**: Prepare handoff soon\n- **>85%**: Handoff after current task\n\n## Tool Surface by Category\n\n| Category | Tools |\n|----------|-------|\n| Navigation | `paradigm_status`, `paradigm_search`, `paradigm_navigate`, `paradigm_related` |\n| Impact analysis | `paradigm_ripple`, `paradigm_flows_affected` |\n| Authorization | `paradigm_gates_for_route`, `paradigm_portal_add_gate` |\n| History & lore | `paradigm_history_context`, `paradigm_lore_record`, `paradigm_lore_search` |\n| Agent team | `paradigm_agent_list`, `paradigm_orchestrate_inline`, `paradigm_captain_brief` |\n| Compliance | `paradigm_aspect_check`, `paradigm_protocol_search`, `paradigm_aspect_drift` |\n| Session | `paradigm_session_health`, `paradigm_handoff_prepare`, `paradigm_session_recover` |\n| Architecture | `paradigm_arch_status`, `paradigm_arch_diagram` |\n\n---\n\n*This protocol ensures efficient, safe modifications to the codebase.*\n'};if(e==="context/session"){let n=j$1(),t=n.getStats(),o=n.getDurationMinutes();return {handled:true,text:JSON.stringify({session:{durationMinutes:o,startTime:new Date(t.startTime).toISOString(),lastActivity:new Date(t.lastActivity).toISOString()},interactions:{toolCalls:t.totals.toolCallCount,resourceReads:t.totals.resourceReadCount,totalInteractions:t.totals.toolCallCount+t.totals.resourceReadCount},tokens:{estimatedMcpContribution:t.totals.totalTokens,note:"Use paradigm_session_health tool for full analysis with handoff recommendations"}},null,2)}}return e==="context/handoff-guide"?{handled:true,text:`# Context Handoff Guide
|
|
52
3
|
|
|
53
4
|
## When to Handoff
|
|
54
5
|
|
|
@@ -97,7 +48,7 @@ Call the \`paradigm_session_health\` tool to get:
|
|
|
97
48
|
- List specific file paths modified
|
|
98
49
|
- Include any blockers or decisions needed
|
|
99
50
|
- Reference relevant symbols (@feature, #component, etc.)
|
|
100
|
-
`}:{handled:false,text:""}}var ce={"add-feature":"Pathway for adding a new user-facing feature with proper symbol definitions","add-gate":"Add a new gate (portal) for authorization control","debug-auth":"Debug authentication and authorization issues","implement-ftux":"Implement First-Time User Experience (FTUX) flow","implement-sandbox":"Set up a sandbox environment for testing","read-docs":"Read and understand existing documentation",refactor:"Refactor existing code with proper planning","run-e2e-tests":"Run and debug end-to-end tests","trace-flow":"Trace a flow through the system","validate-portals":"Validate portal.yaml configuration"};function pe(e,s){let n=[m.join(__dirname,"../../../../paradigm/templates/paradigm",e),m.join(s.rootDir,"node_modules/@a-company/paradigm/templates/paradigm",e),m.join(s.rootDir,"../../packages/paradigm/templates/paradigm",e),m.join(process.env.HOME||"",".paradigm/templates",e),m.resolve(__dirname,"../../../paradigm/templates/paradigm",e)];for(let t of n)try{if(l.existsSync(t))return t}catch{}return null}function J(e){return pe("prompts",e)}function de(e){return Math.ceil(e.length/3.5)}function B(e){let s=J(e);if(!s)return [];try{return l.readdirSync(s).filter(t=>t.endsWith(".md")).map(t=>{let o=t.replace(".md",""),i=m.join(s,t),r=l.statSync(i),a=l.readFileSync(i,"utf8");return {name:o,description:ce[o]||`Prompt template: ${o}`,filename:t,size:r.size,tokens:de(a)}})}catch{return []}}function le(e,s){let n=J(s);if(!n)return {found:false,content:"",error:"Prompts directory not found. Ensure @a-company/paradigm is installed."};let t=m.join(n,`${e}.md`);try{if(!l.existsSync(t)){let i=B(s).map(r=>r.name);return {found:!1,content:"",error:`Prompt "${e}" not found. Available prompts: ${i.join(", ")}`}}return {content:l.readFileSync(t,"utf8"),found:!0}}catch(o){return {found:false,content:"",error:`Error reading prompt: ${o.message}`}}}function V(){return [{uri:"paradigm://prompts",name:"Prompts",description:"List all available prompt templates with metadata (name, description, size)",mimeType:"application/json"},{uri:"paradigm://prompts/{name}",name:"Prompt Content",description:"Get a specific prompt template content. Replace {name} with prompt name (e.g., add-feature)",mimeType:"text/markdown"}]}async function Y(e,s){let n=`paradigm://${e}`;if(e==="prompts"){let t=B(s),o=t.reduce((a,p)=>a+p.size,0),i=t.reduce((a,p)=>a+p.tokens,0),r=JSON.stringify({count:t.length,totalSize:o,totalTokens:i,prompts:t.map(a=>({name:a.name,description:a.description,size:a.size,tokens:a.tokens,uri:`paradigm://prompts/${a.name}`})),usage:"Read a specific prompt with paradigm://prompts/{name}"},null,2);return p(r.length,n),{handled:true,text:r,mimeType:"application/json"}}if(e.startsWith("prompts/")){let t=decodeURIComponent(e.replace("prompts/","")),{content:o,found:i,error:r}=le(t,s);if(!i){let a=JSON.stringify({error:r,name:t},null,2);return p(a.length,n),{handled:true,text:a,mimeType:"application/json"}}return p(o.length,n),{handled:true,text:o,mimeType:"text/markdown"}}return {handled:false,text:"",mimeType:"application/json"}}var A={disciplines:"Language and discipline-agnostic symbol mappings for different domains",scan:"Paradigm Probe protocol for visual discovery and UI-to-code mapping","context-tracking":"Context tracking system for session monitoring and handoffs"};function me(e,s){let n=[m.join(__dirname,"../../../../paradigm/templates/paradigm",e),m.join(s.rootDir,"node_modules/@a-company/paradigm/templates/paradigm",e),m.join(s.rootDir,"../../packages/paradigm/templates/paradigm",e),m.join(process.env.HOME||"",".paradigm/templates",e),m.resolve(__dirname,"../../../paradigm/templates/paradigm",e)];for(let t of n)try{if(l.existsSync(t))return t}catch{}return null}function Q(e){return me("specs",e)}function ge(e){return Math.ceil(e.length/3.5)}function ue(e){let s=Q(e);if(!s)return [];let n=[];for(let[t,o]of Object.entries(A)){let i=`${t}.md`,r=m.join(s,i);try{if(l.existsSync(r)){let a=l.statSync(r),p=l.readFileSync(r,"utf8");n.push({name:t,description:o,filename:i,size:a.size,tokens:ge(p)});}}catch{}}return n}function fe(e,s){if(!A[e]){let o=Object.keys(A);return {found:false,content:"",error:`"${e}" is not a reference spec. Reference specs available via MCP: ${o.join(", ")}. Project-specific specs should be read from .paradigm/specs/ directly.`}}let n=Q(s);if(!n)return {found:false,content:"",error:"Specs directory not found. Ensure @a-company/paradigm is installed."};let t=m.join(n,`${e}.md`);try{return l.existsSync(t)?{content:l.readFileSync(t,"utf8"),found:!0}:{found:!1,content:"",error:`Spec "${e}" file not found at expected location.`}}catch(o){return {found:false,content:"",error:`Error reading spec: ${o.message}`}}}function K(){return [{uri:"paradigm://specs",name:"Reference Specs",description:"List reference specifications (disciplines, scan, context-tracking)",mimeType:"application/json"},{uri:"paradigm://specs/{name}",name:"Spec Content",description:"Get a reference spec. Available: disciplines, scan, context-tracking",mimeType:"text/markdown"}]}async function X(e,s){let n=`paradigm://${e}`;if(e==="specs"){let t=ue(s),o=t.reduce((a,p)=>a+p.size,0),i=t.reduce((a,p)=>a+p.tokens,0),r=JSON.stringify({count:t.length,totalSize:o,totalTokens:i,note:"These are reference specs served via MCP. Project-specific specs (logger, symbols, etc.) should be read from .paradigm/specs/ directly.",specs:t.map(a=>({name:a.name,description:a.description,size:a.size,tokens:a.tokens,uri:`paradigm://specs/${a.name}`}))},null,2);return p(r.length,n),{handled:true,text:r,mimeType:"application/json"}}if(e.startsWith("specs/")&&e!=="specs/"){let t=decodeURIComponent(e.replace("specs/","")),{content:o,found:i,error:r}=fe(t,s);if(!i){let a=JSON.stringify({error:r,name:t},null,2);return p(a.length,n),{handled:true,text:a,mimeType:"application/json"}}return p(o.length,n),{handled:true,text:o,mimeType:"text/markdown"}}return {handled:false,text:"",mimeType:"application/json"}}var M={commands:"Complete CLI command reference with examples and usage guidance",queries:"jq query examples for querying the constellation symbol graph"};function he(e,s){let n=[m.join(__dirname,"../../../../paradigm/templates/paradigm",e),m.join(s.rootDir,"node_modules/@a-company/paradigm/templates/paradigm",e),m.join(s.rootDir,"../../packages/paradigm/templates/paradigm",e),m.join(process.env.HOME||"",".paradigm/templates",e),m.resolve(__dirname,"../../../paradigm/templates/paradigm",e)];for(let t of n)try{if(l.existsSync(t))return t}catch{}return null}function Z(e){return he("docs",e)}function ye(e){return Math.ceil(e.length/3.5)}function be(e){let s=Z(e);if(!s)return [];let n=[];for(let[t,o]of Object.entries(M)){let i=`${t}.md`,r=m.join(s,i);try{if(l.existsSync(r)){let a=l.statSync(r),p=l.readFileSync(r,"utf8");n.push({name:t,description:o,filename:i,size:a.size,tokens:ye(p)});}}catch{}}return n}function we(e,s){if(!M[e]){let o=Object.keys(M);return {found:false,content:"",error:`"${e}" is not a reference doc. Reference docs available via MCP: ${o.join(", ")}. Project-specific docs (patterns, troubleshooting, etc.) should be read from .paradigm/docs/ directly.`}}let n=Z(s);if(!n)return {found:false,content:"",error:"Docs directory not found. Ensure @a-company/paradigm is installed."};let t=m.join(n,`${e}.md`);try{return l.existsSync(t)?{content:l.readFileSync(t,"utf8"),found:!0}:{found:!1,content:"",error:`Doc "${e}" file not found at expected location.`}}catch(o){return {found:false,content:"",error:`Error reading doc: ${o.message}`}}}function ee(){return [{uri:"paradigm://docs",name:"Reference Docs",description:"List reference documentation (commands, queries)",mimeType:"application/json"},{uri:"paradigm://docs/{name}",name:"Doc Content",description:"Get a reference doc. Available: commands, queries",mimeType:"text/markdown"}]}async function te(e,s){let n=`paradigm://${e}`;if(e==="docs"){let t=be(s),o=t.reduce((a,p)=>a+p.size,0),i=t.reduce((a,p)=>a+p.tokens,0),r=JSON.stringify({count:t.length,totalSize:o,totalTokens:i,note:"These are reference docs served via MCP. Project-specific docs (patterns, troubleshooting, etc.) should be read from .paradigm/docs/ directly.",docs:t.map(a=>({name:a.name,description:a.description,size:a.size,tokens:a.tokens,uri:`paradigm://docs/${a.name}`}))},null,2);return p(r.length,n),{handled:true,text:r,mimeType:"application/json"}}if(e.startsWith("docs/")&&e!=="docs/"){let t=decodeURIComponent(e.replace("docs/","")),{content:o,found:i,error:r}=we(t,s);if(!i){let a=JSON.stringify({error:r,name:t},null,2);return p(a.length,n),{handled:true,text:a,mimeType:"application/json"}}return p(o.length,n),{handled:true,text:o,mimeType:"text/markdown"}}return {handled:false,text:"",mimeType:"application/json"}}var j={logging:{description:"Paradigm logger usage, symbol-to-method mapping by directory",generate:()=>"# Paradigm Logging Guide\n\n**IMPORTANT:** Use the Paradigm logger instead of raw console.log/print.\n\n## Usage Pattern\n\n```typescript\nlog.component('#login-handler').info('Starting login', { email });\nlog.component('#database').debug('Query executed', { duration });\nlog.gate('^authenticated').warn('Access denied', { userId });\nlog.signal('!login-success').info('User authenticated');\nlog.flow('$checkout').info('Flow step reached');\nlog.aspect('~audit-required').info('Audit triggered');\n```\n\n## Symbol Mapping by Directory\n\n| Directory | Symbol | Logger Method |\n|-----------|--------|---------------|\n| `features/**` | `#` | `log.component()` |\n| `routes/**` | `#` | `log.component()` |\n| `api/**` | `#` | `log.component()` |\n| `endpoints/**` | `#` | `log.component()` |\n| `commands/**` | `#` | `log.component()` |\n| `models/**` | `#` | `log.component()` |\n| `components/**` | `#` | `log.component()` |\n| `lib/**` | `#` | `log.component()` |\n| `utils/**` | `#` | `log.component()` |\n| `services/**` | `#` | `log.component()` |\n| `core/**` | `#` | `log.component()` |\n| `drivers/**` | `#` | `log.component()` |\n| `systems/**` | `#` | `log.component()` |\n| `integrations/**` | `#` | `log.component()` |\n| `external/**` | `#` | `log.component()` |\n| `vendors/**` | `#` | `log.component()` |\n| `stores/**` | `#` | `log.component()` |\n| `state/**` | `#` | `log.component()` |\n| `reducers/**` | `#` | `log.component()` |\n| `config/**` | `#` | `log.component()` |\n| `middleware/**` | `^` | `log.gate()` |\n| `auth/**` | `^` | `log.gate()` |\n| `guards/**` | `^` | `log.gate()` |\n| `policies/**` | `^` | `log.gate()` |\n| `events/**` | `!` | `log.signal()` |\n| `handlers/**` | `!` | `log.signal()` |\n| `listeners/**` | `!` | `log.signal()` |\n| `hooks/**` | `!` | `log.signal()` |\n| `flows/**` | `$` | `log.flow()` |\n| `sagas/**` | `$` | `log.flow()` |\n| `workflows/**` | `$` | `log.flow()` |\n| `pipelines/**` | `$` | `log.flow()` |\n| `aspects/**` | `~` | `log.aspect()` |\n| `rules/**` | `~` | `log.aspect()` |\n| `constraints/**` | `~` | `log.aspect()` |\n\nSee `.paradigm/specs/logger.md` for full specification."},portal:{description:"Portal protocol \u2014 authorization, gates, portal.yaml structure and workflow",generate:()=>`# Portal Protocol (Authorization)
|
|
51
|
+
`}:{handled:false,text:""}}var ce={"add-feature":"Pathway for adding a new user-facing feature with proper symbol definitions","add-gate":"Add a new gate (portal) for authorization control","debug-auth":"Debug authentication and authorization issues","implement-ftux":"Implement First-Time User Experience (FTUX) flow","implement-sandbox":"Set up a sandbox environment for testing","read-docs":"Read and understand existing documentation",refactor:"Refactor existing code with proper planning","run-e2e-tests":"Run and debug end-to-end tests","trace-flow":"Trace a flow through the system","validate-portals":"Validate portal.yaml configuration"};function de(e,s){let n=[m.join(__dirname,"../../../../paradigm/templates/paradigm",e),m.join(s.rootDir,"node_modules/@a-company/paradigm/templates/paradigm",e),m.join(s.rootDir,"../../packages/paradigm/templates/paradigm",e),m.join(process.env.HOME||"",".paradigm/templates",e),m.resolve(__dirname,"../../../paradigm/templates/paradigm",e)];for(let t of n)try{if(l.existsSync(t))return t}catch{}return null}function J(e){return de("prompts",e)}function pe(e){return Math.ceil(e.length/3.5)}function B(e){let s=J(e);if(!s)return [];try{return l.readdirSync(s).filter(t=>t.endsWith(".md")).map(t=>{let o=t.replace(".md",""),i=m.join(s,t),a=l.statSync(i),r=l.readFileSync(i,"utf8");return {name:o,description:ce[o]||`Prompt template: ${o}`,filename:t,size:a.size,tokens:pe(r)}})}catch{return []}}function le(e,s){let n=J(s);if(!n)return {found:false,content:"",error:"Prompts directory not found. Ensure @a-company/paradigm is installed."};let t=m.join(n,`${e}.md`);try{if(!l.existsSync(t)){let i=B(s).map(a=>a.name);return {found:!1,content:"",error:`Prompt "${e}" not found. Available prompts: ${i.join(", ")}`}}return {content:l.readFileSync(t,"utf8"),found:!0}}catch(o){return {found:false,content:"",error:`Error reading prompt: ${o.message}`}}}function V(){return [{uri:"paradigm://prompts",name:"Prompts",description:"List all available prompt templates with metadata (name, description, size)",mimeType:"application/json"},{uri:"paradigm://prompts/{name}",name:"Prompt Content",description:"Get a specific prompt template content. Replace {name} with prompt name (e.g., add-feature)",mimeType:"text/markdown"}]}async function Y(e,s){let n=`paradigm://${e}`;if(e==="prompts"){let t=B(s),o=t.reduce((r,d)=>r+d.size,0),i=t.reduce((r,d)=>r+d.tokens,0),a=JSON.stringify({count:t.length,totalSize:o,totalTokens:i,prompts:t.map(r=>({name:r.name,description:r.description,size:r.size,tokens:r.tokens,uri:`paradigm://prompts/${r.name}`})),usage:"Read a specific prompt with paradigm://prompts/{name}"},null,2);return b$1(a.length,n),{handled:true,text:a,mimeType:"application/json"}}if(e.startsWith("prompts/")){let t=decodeURIComponent(e.replace("prompts/","")),{content:o,found:i,error:a}=le(t,s);if(!i){let r=JSON.stringify({error:a,name:t},null,2);return b$1(r.length,n),{handled:true,text:r,mimeType:"application/json"}}return b$1(o.length,n),{handled:true,text:o,mimeType:"text/markdown"}}return {handled:false,text:"",mimeType:"application/json"}}var A={disciplines:"Language and discipline-agnostic symbol mappings for different domains",scan:"Paradigm Probe protocol for visual discovery and UI-to-code mapping","context-tracking":"Context tracking system for session monitoring and handoffs"};function me(e,s){let n=[m.join(__dirname,"../../../../paradigm/templates/paradigm",e),m.join(s.rootDir,"node_modules/@a-company/paradigm/templates/paradigm",e),m.join(s.rootDir,"../../packages/paradigm/templates/paradigm",e),m.join(process.env.HOME||"",".paradigm/templates",e),m.resolve(__dirname,"../../../paradigm/templates/paradigm",e)];for(let t of n)try{if(l.existsSync(t))return t}catch{}return null}function Q(e){return me("specs",e)}function ge(e){return Math.ceil(e.length/3.5)}function ue(e){let s=Q(e);if(!s)return [];let n=[];for(let[t,o]of Object.entries(A)){let i=`${t}.md`,a=m.join(s,i);try{if(l.existsSync(a)){let r=l.statSync(a),d=l.readFileSync(a,"utf8");n.push({name:t,description:o,filename:i,size:r.size,tokens:ge(d)});}}catch{}}return n}function fe(e,s){if(!A[e]){let o=Object.keys(A);return {found:false,content:"",error:`"${e}" is not a reference spec. Reference specs available via MCP: ${o.join(", ")}. Project-specific specs should be read from .paradigm/specs/ directly.`}}let n=Q(s);if(!n)return {found:false,content:"",error:"Specs directory not found. Ensure @a-company/paradigm is installed."};let t=m.join(n,`${e}.md`);try{return l.existsSync(t)?{content:l.readFileSync(t,"utf8"),found:!0}:{found:!1,content:"",error:`Spec "${e}" file not found at expected location.`}}catch(o){return {found:false,content:"",error:`Error reading spec: ${o.message}`}}}function K(){return [{uri:"paradigm://specs",name:"Reference Specs",description:"List reference specifications (disciplines, scan, context-tracking)",mimeType:"application/json"},{uri:"paradigm://specs/{name}",name:"Spec Content",description:"Get a reference spec. Available: disciplines, scan, context-tracking",mimeType:"text/markdown"}]}async function X(e,s){let n=`paradigm://${e}`;if(e==="specs"){let t=ue(s),o=t.reduce((r,d)=>r+d.size,0),i=t.reduce((r,d)=>r+d.tokens,0),a=JSON.stringify({count:t.length,totalSize:o,totalTokens:i,note:"These are reference specs served via MCP. Project-specific specs (logger, symbols, etc.) should be read from .paradigm/specs/ directly.",specs:t.map(r=>({name:r.name,description:r.description,size:r.size,tokens:r.tokens,uri:`paradigm://specs/${r.name}`}))},null,2);return b$1(a.length,n),{handled:true,text:a,mimeType:"application/json"}}if(e.startsWith("specs/")&&e!=="specs/"){let t=decodeURIComponent(e.replace("specs/","")),{content:o,found:i,error:a}=fe(t,s);if(!i){let r=JSON.stringify({error:a,name:t},null,2);return b$1(r.length,n),{handled:true,text:r,mimeType:"application/json"}}return b$1(o.length,n),{handled:true,text:o,mimeType:"text/markdown"}}return {handled:false,text:"",mimeType:"application/json"}}var M={commands:"Complete CLI command reference with examples and usage guidance",queries:"jq query examples for querying the constellation symbol graph"};function he(e,s){let n=[m.join(__dirname,"../../../../paradigm/templates/paradigm",e),m.join(s.rootDir,"node_modules/@a-company/paradigm/templates/paradigm",e),m.join(s.rootDir,"../../packages/paradigm/templates/paradigm",e),m.join(process.env.HOME||"",".paradigm/templates",e),m.resolve(__dirname,"../../../paradigm/templates/paradigm",e)];for(let t of n)try{if(l.existsSync(t))return t}catch{}return null}function Z(e){return he("docs",e)}function ye(e){return Math.ceil(e.length/3.5)}function be(e){let s=Z(e);if(!s)return [];let n=[];for(let[t,o]of Object.entries(M)){let i=`${t}.md`,a=m.join(s,i);try{if(l.existsSync(a)){let r=l.statSync(a),d=l.readFileSync(a,"utf8");n.push({name:t,description:o,filename:i,size:r.size,tokens:ye(d)});}}catch{}}return n}function _e(e,s){if(!M[e]){let o=Object.keys(M);return {found:false,content:"",error:`"${e}" is not a reference doc. Reference docs available via MCP: ${o.join(", ")}. Project-specific docs (patterns, troubleshooting, etc.) should be read from .paradigm/docs/ directly.`}}let n=Z(s);if(!n)return {found:false,content:"",error:"Docs directory not found. Ensure @a-company/paradigm is installed."};let t=m.join(n,`${e}.md`);try{return l.existsSync(t)?{content:l.readFileSync(t,"utf8"),found:!0}:{found:!1,content:"",error:`Doc "${e}" file not found at expected location.`}}catch(o){return {found:false,content:"",error:`Error reading doc: ${o.message}`}}}function ee(){return [{uri:"paradigm://docs",name:"Reference Docs",description:"List reference documentation (commands, queries)",mimeType:"application/json"},{uri:"paradigm://docs/{name}",name:"Doc Content",description:"Get a reference doc. Available: commands, queries",mimeType:"text/markdown"}]}async function te(e,s){let n=`paradigm://${e}`;if(e==="docs"){let t=be(s),o=t.reduce((r,d)=>r+d.size,0),i=t.reduce((r,d)=>r+d.tokens,0),a=JSON.stringify({count:t.length,totalSize:o,totalTokens:i,note:"These are reference docs served via MCP. Project-specific docs (patterns, troubleshooting, etc.) should be read from .paradigm/docs/ directly.",docs:t.map(r=>({name:r.name,description:r.description,size:r.size,tokens:r.tokens,uri:`paradigm://docs/${r.name}`}))},null,2);return b$1(a.length,n),{handled:true,text:a,mimeType:"application/json"}}if(e.startsWith("docs/")&&e!=="docs/"){let t=decodeURIComponent(e.replace("docs/","")),{content:o,found:i,error:a}=_e(t,s);if(!i){let r=JSON.stringify({error:a,name:t},null,2);return b$1(r.length,n),{handled:true,text:r,mimeType:"application/json"}}return b$1(o.length,n),{handled:true,text:o,mimeType:"text/markdown"}}return {handled:false,text:"",mimeType:"application/json"}}var j={logging:{description:"Paradigm logger usage, symbol-to-method mapping by directory",generate:()=>"# Paradigm Logging Guide\n\n**IMPORTANT:** Use the Paradigm logger instead of raw console.log/print.\n\n## Usage Pattern\n\n```typescript\nlog.component('#login-handler').info('Starting login', { email });\nlog.component('#database').debug('Query executed', { duration });\nlog.gate('^authenticated').warn('Access denied', { userId });\nlog.signal('!login-success').info('User authenticated');\nlog.flow('$checkout').info('Flow step reached');\nlog.aspect('~audit-required').info('Audit triggered');\n```\n\n## Symbol Mapping by Directory\n\n| Directory | Symbol | Logger Method |\n|-----------|--------|---------------|\n| `features/**` | `#` | `log.component()` |\n| `routes/**` | `#` | `log.component()` |\n| `api/**` | `#` | `log.component()` |\n| `endpoints/**` | `#` | `log.component()` |\n| `commands/**` | `#` | `log.component()` |\n| `models/**` | `#` | `log.component()` |\n| `components/**` | `#` | `log.component()` |\n| `lib/**` | `#` | `log.component()` |\n| `utils/**` | `#` | `log.component()` |\n| `services/**` | `#` | `log.component()` |\n| `core/**` | `#` | `log.component()` |\n| `drivers/**` | `#` | `log.component()` |\n| `systems/**` | `#` | `log.component()` |\n| `integrations/**` | `#` | `log.component()` |\n| `external/**` | `#` | `log.component()` |\n| `vendors/**` | `#` | `log.component()` |\n| `stores/**` | `#` | `log.component()` |\n| `state/**` | `#` | `log.component()` |\n| `reducers/**` | `#` | `log.component()` |\n| `config/**` | `#` | `log.component()` |\n| `middleware/**` | `^` | `log.gate()` |\n| `auth/**` | `^` | `log.gate()` |\n| `guards/**` | `^` | `log.gate()` |\n| `policies/**` | `^` | `log.gate()` |\n| `events/**` | `!` | `log.signal()` |\n| `handlers/**` | `!` | `log.signal()` |\n| `listeners/**` | `!` | `log.signal()` |\n| `hooks/**` | `!` | `log.signal()` |\n| `flows/**` | `$` | `log.flow()` |\n| `sagas/**` | `$` | `log.flow()` |\n| `workflows/**` | `$` | `log.flow()` |\n| `pipelines/**` | `$` | `log.flow()` |\n| `aspects/**` | `~` | `log.aspect()` |\n| `rules/**` | `~` | `log.aspect()` |\n| `constraints/**` | `~` | `log.aspect()` |\n\nSee `.paradigm/specs/logger.md` for full specification."},portal:{description:"Portal protocol \u2014 authorization, gates, portal.yaml structure and workflow",generate:()=>`# Portal Protocol (Authorization)
|
|
101
52
|
|
|
102
53
|
**Portal.yaml is REQUIRED when the project has protected routes.**
|
|
103
54
|
|
|
@@ -463,4 +414,4 @@ components:
|
|
|
463
414
|
| When | Tool | Purpose |
|
|
464
415
|
|------|------|---------|
|
|
465
416
|
| Starting any task | \`paradigm_pm_preflight\` | Get compliance plan |
|
|
466
|
-
| Finishing any task | _(handled by stop hook)_ | Auto-checks compliance |`}};function
|
|
417
|
+
| Finishing any task | _(handled by stop hook)_ | Auto-checks compliance |`}};function we(e){return Math.ceil(e.length/3.5)}function oe(){return [{uri:"paradigm://guidance",name:"Guidance Topics",description:"List all available on-demand guidance topics (logging, portal, flows, orchestration, etc.)",mimeType:"application/json"},{uri:"paradigm://guidance/{topic}",name:"Guidance Content",description:`Get guidance for a topic. Available: ${Object.keys(j).join(", ")}`,mimeType:"text/markdown"}]}async function ne(e,s){let n=`paradigm://${e}`;if(e==="guidance"){let t=Object.entries(j).map(([i,a])=>{let r=a.generate();return {name:i,description:a.description,tokens:we(r)}}),o=JSON.stringify({count:t.length,totalTokens:t.reduce((i,a)=>i+a.tokens,0),note:"These guidance topics were previously baked into CLAUDE.md. Load on-demand to save context.",topics:t.map(i=>({...i,uri:`paradigm://guidance/${i.name}`}))},null,2);return b$1(o.length,n),{handled:true,text:o,mimeType:"application/json"}}if(e.startsWith("guidance/")&&e!=="guidance/"){let t=decodeURIComponent(e.replace("guidance/","")),o=j[t];if(!o){let a=Object.keys(j),r=JSON.stringify({error:`Unknown guidance topic: "${t}"`,available:a},null,2);return b$1(r.length,n),{handled:true,text:r,mimeType:"application/json"}}let i=o.generate();return b$1(i.length,n),{handled:true,text:i,mimeType:"text/markdown"}}return {handled:false,text:"",mimeType:"application/json"}}function ie(e,s){e.setRequestHandler(ListResourcesRequestSchema,async()=>({resources:[{uri:"paradigm://symbols",name:"All Symbols",description:"Overview of all Paradigm symbols in the project",mimeType:"application/json"},{uri:"paradigm://symbols/type/feature",name:"Features",description:"All @feature symbols",mimeType:"application/json"},{uri:"paradigm://symbols/type/component",name:"Components",description:"All #component symbols",mimeType:"application/json"},{uri:"paradigm://symbols/type/gate",name:"Gates",description:"All ^gate symbols (authorization)",mimeType:"application/json"},{uri:"paradigm://symbols/type/flow",name:"Flows",description:"All $flow symbols (processes)",mimeType:"application/json"},{uri:"paradigm://symbols/type/signal",name:"Signals",description:"All !signal symbols (events)",mimeType:"application/json"},{uri:"paradigm://symbols/type/state",name:"States",description:"All %state symbols",mimeType:"application/json"},{uri:"paradigm://gates",name:"Gates (Detailed)",description:"All gates with locks, keys, and prizes from portal.yaml",mimeType:"application/json"},{uri:"paradigm://flows",name:"Flows (Detailed)",description:"All flows with gate sequences",mimeType:"application/json"},...z(),...$(),...q(),...V(),...K(),...ee(),...oe()]})),e.setRequestHandler(ReadResourceRequestSchema,async n=>{let t=n.params.uri;if(!t?.startsWith("paradigm://"))throw new Error(`Unknown URI scheme: ${t}`);let o=s(),i=t.replace("paradigm://","");if(i==="symbols"){let a=p(o.index),r=q$1(o.index),d=JSON.stringify({project:o.projectName,counts:a,total:Object.values(a).reduce((p,k)=>p+k,0),symbols:r.map(p=>({symbol:p.symbol,type:p.type,description:p.description}))},null,2);return b$1(d.length,t),{contents:[{uri:t,mimeType:"application/json",text:d}]}}if(i.startsWith("symbol/")){let a=decodeURIComponent(i.replace("symbol/","")),r=k(o.index,a);if(!r){let p=JSON.stringify({error:"Symbol not found",symbol:a,available:q$1(o.index).filter(k=>k.symbol.includes(a.slice(1))).slice(0,5).map(k=>k.symbol)},null,2);return b$1(p.length,t),{contents:[{uri:t,mimeType:"application/json",text:p}]}}let d=JSON.stringify({symbol:r.symbol,type:r.type,description:r.description,filePath:r.filePath,references:r.references,referencedBy:r.referencedBy,tags:r.tags,data:r.data},null,2);return b$1(d.length,t),{contents:[{uri:t,mimeType:"application/json",text:d}]}}if(i.startsWith("symbols/type/")){let a=i.replace("symbols/type/",""),r=l$1(o.index,a),d=JSON.stringify({type:a,count:r.length,symbols:r.map(p=>({symbol:p.symbol,description:p.description,filePath:p.filePath,referencesCount:p.references.length,referencedByCount:p.referencedBy.length}))},null,2);return b$1(d.length,t),{contents:[{uri:t,mimeType:"application/json",text:d}]}}if(i==="gates"){let a=L(o),r=JSON.stringify({count:a.length,gates:a},null,2);return b$1(r.length,t),{contents:[{uri:t,mimeType:"application/json",text:r}]}}if(i==="flows"){let a=F(o),r=JSON.stringify({count:a.length,flows:a},null,2);return b$1(r.length,t),{contents:[{uri:t,mimeType:"application/json",text:r}]}}if(i.startsWith("wisdom/")){let a=await U(i,o);if(a.handled)return b$1(a.text.length),{contents:[{uri:t,mimeType:"application/json",text:a.text}]}}if(i.startsWith("history/")){let a=await G(i,o);if(a.handled)return b$1(a.text.length),{contents:[{uri:t,mimeType:"application/json",text:a.text}]}}if(i.startsWith("context/")){let a=await H(i);if(a.handled)return b$1(a.text.length),{contents:[{uri:t,mimeType:a.text.startsWith("#")?"text/markdown":"application/json",text:a.text}]}}if(i==="prompts"||i.startsWith("prompts/")){let a=await Y(i,o);if(a.handled)return {contents:[{uri:t,mimeType:a.mimeType,text:a.text}]}}if(i==="specs"||i.startsWith("specs/")){let a=await X(i,o);if(a.handled)return {contents:[{uri:t,mimeType:a.mimeType,text:a.text}]}}if(i==="docs"||i.startsWith("docs/")){let a=await te(i,o);if(a.handled)return {contents:[{uri:t,mimeType:a.mimeType,text:a.text}]}}if(i==="guidance"||i.startsWith("guidance/")){let a=await ne(i);if(a.handled)return {contents:[{uri:t,mimeType:a.mimeType,text:a.text}]}}throw new Error(`Unknown resource: ${i}`)});}b();var v=process.argv[2]||process.cwd(),_=null;function ae(){if(!_)throw new Error("Project context not loaded");return _}async function je(){_=await d(v),ga(v,_).catch(e=>{a.component("#paradigm-mcp").warn("Background reindex failed",{error:e.message});});}async function Te(){a.component("#paradigm-mcp").info("Loading project",{projectDir:v});try{_=await d(v),j$1().setRootDir(_.rootDir),a.component("#paradigm-mcp").info("Project loaded",{symbols:_.aggregation.symbols.length,project:_.projectName});}catch(n){a.component("#paradigm-mcp").error("Error loading project",{error:n.message}),process.exit(1);}g(v);let e=new Server({name:"paradigm",version:"0.1.0"},{capabilities:{resources:{},tools:{}}});ie(e,ae),h(e,ae,je),e.onerror=n=>{a.component("#paradigm-mcp").error("Server error",{error:String(n)});};let s=new StdioServerTransport;await e.connect(s),a.component("#paradigm-mcp").info("Server running on stdio");}Te().catch(e=>{a.component("#paradigm-mcp").error("Fatal error",{error:e.message}),process.exit(1);});
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
export{ea as getReindexToolsList,fa as handleReindexTool,ga as rebuildStaticFiles}from'./chunk-EMGJWT7D.js';import'./chunk-SU5F5D4I.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';
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
export{h as registerTools}from'./chunk-MA75GS7J.js';import'./chunk-EMGJWT7D.js';import'./chunk-4UJ4NIEQ.js';import'./chunk-4N56FRNE.js';import'./chunk-Q527BPUF.js';import'./chunk-KLBH26PA.js';import'./chunk-ARLB6YYW.js';import'./chunk-SU5F5D4I.js';import'./chunk-JNSJVCTU.js';import'./chunk-XROULIQN.js';import'./chunk-ZUAUFZRJ.js';import'./chunk-3KVVC4WV.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';
|
|
@@ -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.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-
|
|
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.3"}),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-SNyIB61M.js.map
|