@a-company/paradigm 5.37.8 → 5.38.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/dist/{accept-orchestration-SBZVK3H4.js → accept-orchestration-OATWIRHP.js} +1 -1
  2. package/dist/{aggregate-W66DM3GA.js → aggregate-A5S5MTCC.js} +1 -1
  3. package/dist/{beacon-5QVYV5DF.js → beacon-QVUD3MGP.js} +1 -1
  4. package/dist/{chunk-SI6SV76D.js → chunk-3DZK54RU.js} +72 -19
  5. package/dist/{chunk-KFNHCQ4R.js → chunk-4L7665QV.js} +1 -1
  6. package/dist/chunk-4VKSEOXZ.js +6 -0
  7. package/dist/{chunk-CHVQNRRT.js → chunk-5QOCKWK5.js} +1 -1
  8. package/dist/chunk-HOBHJPTL.js +24 -0
  9. package/dist/{chunk-T6IDXUUA.js → chunk-LWAIVOSF.js} +1 -1
  10. package/dist/chunk-NQ47TA6C.js +111 -0
  11. package/dist/{chunk-G7XFK2GI.js → chunk-RBLK34IA.js} +1 -1
  12. package/dist/chunk-RN4VE6P3.js +521 -0
  13. package/dist/{chunk-SUU6M4JH.js → chunk-TOYQ2QCB.js} +1 -1
  14. package/dist/{chunk-LBQBWIEX.js → chunk-Y4P4SGZV.js} +1 -1
  15. package/dist/chunk-ZJQY5PPP.js +7 -0
  16. package/dist/{commands-LMUD5L6R.js → commands-ANRJNG2W.js} +1 -1
  17. package/dist/compliance-D7GD6ZYC.js +6 -0
  18. package/dist/{constellation-CG7C4WFE.js → constellation-NWLXYATA.js} +1 -1
  19. package/dist/{cost-IDNVMAEV.js → cost-24UZSS2P.js} +1 -1
  20. package/dist/{diff-JVEYCXUC.js → diff-YGHBIJY5.js} +1 -1
  21. package/dist/dist-JZZJLVMR.js +2 -0
  22. package/dist/{dist-3ZCH25SG.js → dist-OG6MM4VY.js} +1 -1
  23. package/dist/dist-SE67SOXB.js +2 -0
  24. package/dist/doctor-WMVULMQD.js +2 -0
  25. package/dist/{flow-POQP27WA.js → flow-FVZR3YJ4.js} +1 -1
  26. package/dist/{hooks-IG2GOAHP.js → hooks-TFMMMB2H.js} +1 -1
  27. package/dist/index.js +5 -5
  28. package/dist/init-XYB62Q3X.js +2 -0
  29. package/dist/{integrity-UYDOOJDP.js → integrity-ROO3G43N.js} +1 -1
  30. package/dist/mcp.js +18 -10
  31. package/dist/{migrate-IBDE7VK4.js → migrate-Z5UQN57G.js} +1 -1
  32. package/dist/{orchestrate-RCAMBOIB.js → orchestrate-M5PBZBJQ.js} +1 -1
  33. package/dist/portal-check-ZMLVBIGW.js +8 -0
  34. package/dist/portal-compliance-6YR27IQU.js +2 -0
  35. package/dist/{probe-B22G2JKF.js → probe-3FTG6LYO.js} +1 -1
  36. package/dist/{reindex-FO5VMZVQ.js → reindex-I6LPAKCC.js} +1 -1
  37. package/dist/{review-6UAH6V3R.js → review-VMSX2PKI.js} +1 -1
  38. package/dist/{ripple-ZGDITCGB.js → ripple-FNZI47SH.js} +1 -1
  39. package/dist/sentinel.js +1 -1
  40. package/dist/{setup-3F5IK7MO.js → setup-FEWSYS3Y.js} +2 -2
  41. package/dist/{shift-CZMQWZWP.js → shift-PC6C7NUX.js} +4 -4
  42. package/dist/{snapshot-L2G56RPL.js → snapshot-3IYB67D4.js} +1 -1
  43. package/dist/{status-77M3SDIF.js → status-DB3KNLW3.js} +1 -1
  44. package/dist/{summary-LXLHFRN7.js → summary-PYTEIJ4U.js} +1 -1
  45. package/dist/{team-NSP6PMPS.js → team-PDK64JXI.js} +1 -1
  46. package/dist/{test-BQJMS4Y2.js → test-WLEPZQFC.js} +1 -1
  47. package/dist/{tools-BZUAEUSQ.js → tools-5ITPEPSV.js} +1 -1
  48. package/dist/{validate-VZXTJHGO.js → validate-BB6LRWIY.js} +1 -1
  49. package/dist/workspace-VMSPYIBV.js +2 -0
  50. package/package.json +2 -1
  51. package/templates/paradigm/specs/symbols.md +4 -2
  52. package/dist/chunk-3TR6LLXP.js +0 -111
  53. package/dist/chunk-3VF3CMCF.js +0 -521
  54. package/dist/chunk-J6KWGCHN.js +0 -24
  55. package/dist/chunk-QT2LKB3P.js +0 -7
  56. package/dist/chunk-SHD27BQX.js +0 -6
  57. package/dist/compliance-WJINB5DM.js +0 -6
  58. package/dist/dist-R3RWD35F.js +0 -2
  59. package/dist/dist-VXCZWVVJ.js +0 -2
  60. package/dist/doctor-QJ47XAUP.js +0 -2
  61. package/dist/init-HIBRSVUB.js +0 -2
  62. package/dist/portal-check-Z3OCQEQR.js +0 -8
  63. package/dist/portal-compliance-4MG5F2GI.js +0 -2
  64. package/dist/workspace-MKSQN7B2.js +0 -2
package/dist/mcp.js CHANGED
@@ -1,5 +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-3VF3CMCF.js';import'./chunk-4UJ4NIEQ.js';import'./chunk-BOYQAMGC.js';import'./chunk-KLBH26PA.js';import'./chunk-JNSJVCTU.js';import'./chunk-Q2J542ST.js';import'./chunk-XROULIQN.js';import'./chunk-ZUAUFZRJ.js';import'./chunk-3KVVC4WV.js';import {m as m$1,n,p as p$1,h as h$1,i,ma}from'./chunk-3TR6LLXP.js';import'./chunk-M4UMM6DC.js';import'./chunk-ODVKPZZ4.js';import'./chunk-74SGKSRQ.js';import {j as j$1}from'./chunk-MQIG6SMF.js';import {b,a}from'./chunk-EK4ZRIFJ.js';import'./chunk-NEJ4ZLCY.js';import'./chunk-DVZWCXB6.js';import'./chunk-QGZRM6ZB.js';import'./chunk-RLCH7DXQ.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 p 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 r=o.symbol.replace(/^\^/,"");t.set(r,{id:r,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 r=o.symbol.replace(/^\$/,"");t.set(r,{id:r,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(r=>r.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(r=>r.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(r=>({name:r.name,symbols:r.symbols,areas:r.areas,contact:r.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(r=>r.symbols.includes(n))||[];return {handled:true,text:JSON.stringify({symbol:n,count:o.length,co_changes:o.map(r=>({with:r.symbols.filter(i=>i!==n),frequency:r.frequency,correlation:r.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
2
+ import {d,g,h,e,a as a$1,b as b$1,f,c}from'./chunk-RN4VE6P3.js';import'./chunk-4UJ4NIEQ.js';import'./chunk-BOYQAMGC.js';import'./chunk-KLBH26PA.js';import'./chunk-JNSJVCTU.js';import'./chunk-Q2J542ST.js';import'./chunk-XROULIQN.js';import'./chunk-ZUAUFZRJ.js';import'./chunk-3KVVC4WV.js';import {n,o,q as q$1,i,j as j$2,oa}from'./chunk-NQ47TA6C.js';import'./chunk-M4UMM6DC.js';import'./chunk-ODVKPZZ4.js';import'./chunk-74SGKSRQ.js';import {j as j$1}from'./chunk-MQIG6SMF.js';import {b,a}from'./chunk-EK4ZRIFJ.js';import'./chunk-NEJ4ZLCY.js';import'./chunk-DVZWCXB6.js';import'./chunk-QGZRM6ZB.js';import'./chunk-RLCH7DXQ.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 p 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=j$2(e.index,"gate"),t=new Map;for(let o of n){let r=o.symbol.replace(/^\^/,"");t.set(r,{id:r,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=j$2(e.index,"flow"),t=new Map;for(let o of n){let r=o.symbol.replace(/^\$/,"");t.set(r,{id:r,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(r=>r.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(r=>r.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(r=>({name:r.name,symbols:r.symbols,areas:r.areas,contact:r.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(r=>r.symbols.includes(n))||[];return {handled:true,text:JSON.stringify({symbol:n,count:o.length,co_changes:o.map(r=>({with:r.symbols.filter(i=>i!==n),frequency:r.frequency,correlation:r.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
3
 
4
4
  ## Query Before Modify
5
5
 
@@ -97,7 +97,7 @@ Call the \`paradigm_session_health\` tool to get:
97
97
  - List specific file paths modified
98
98
  - Include any blockers or decisions needed
99
99
  - 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 le(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(p.existsSync(t))return t}catch{}return null}function J(e){return le("prompts",e)}function de(e){return Math.ceil(e.length/3.5)}function B(e){let s=J(e);if(!s)return [];try{return p.readdirSync(s).filter(t=>t.endsWith(".md")).map(t=>{let o=t.replace(".md",""),r=m.join(s,t),i=p.statSync(r),a=p.readFileSync(r,"utf8");return {name:o,description:ce[o]||`Prompt template: ${o}`,filename:t,size:i.size,tokens:de(a)}})}catch{return []}}function pe(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(!p.existsSync(t)){let r=B(s).map(i=>i.name);return {found:!1,content:"",error:`Prompt "${e}" not found. Available prompts: ${r.join(", ")}`}}return {content:p.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 Q(e,s){let n=`paradigm://${e}`;if(e==="prompts"){let t=B(s),o=t.reduce((a,l)=>a+l.size,0),r=t.reduce((a,l)=>a+l.tokens,0),i=JSON.stringify({count:t.length,totalSize:o,totalTokens:r,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$1(i.length,n),{handled:true,text:i,mimeType:"application/json"}}if(e.startsWith("prompts/")){let t=decodeURIComponent(e.replace("prompts/","")),{content:o,found:r,error:i}=pe(t,s);if(!r){let a=JSON.stringify({error:i,name:t},null,2);return p$1(a.length,n),{handled:true,text:a,mimeType:"application/json"}}return p$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(p.existsSync(t))return t}catch{}return null}function Y(e){return me("specs",e)}function ge(e){return Math.ceil(e.length/3.5)}function ue(e){let s=Y(e);if(!s)return [];let n=[];for(let[t,o]of Object.entries(A)){let r=`${t}.md`,i=m.join(s,r);try{if(p.existsSync(i)){let a=p.statSync(i),l=p.readFileSync(i,"utf8");n.push({name:t,description:o,filename:r,size:a.size,tokens:ge(l)});}}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=Y(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 p.existsSync(t)?{content:p.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,l)=>a+l.size,0),r=t.reduce((a,l)=>a+l.tokens,0),i=JSON.stringify({count:t.length,totalSize:o,totalTokens:r,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$1(i.length,n),{handled:true,text:i,mimeType:"application/json"}}if(e.startsWith("specs/")&&e!=="specs/"){let t=decodeURIComponent(e.replace("specs/","")),{content:o,found:r,error:i}=fe(t,s);if(!r){let a=JSON.stringify({error:i,name:t},null,2);return p$1(a.length,n),{handled:true,text:a,mimeType:"application/json"}}return p$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(p.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 r=`${t}.md`,i=m.join(s,r);try{if(p.existsSync(i)){let a=p.statSync(i),l=p.readFileSync(i,"utf8");n.push({name:t,description:o,filename:r,size:a.size,tokens:ye(l)});}}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 p.existsSync(t)?{content:p.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,l)=>a+l.size,0),r=t.reduce((a,l)=>a+l.tokens,0),i=JSON.stringify({count:t.length,totalSize:o,totalTokens:r,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$1(i.length,n),{handled:true,text:i,mimeType:"application/json"}}if(e.startsWith("docs/")&&e!=="docs/"){let t=decodeURIComponent(e.replace("docs/","")),{content:o,found:r,error:i}=we(t,s);if(!r){let a=JSON.stringify({error:i,name:t},null,2);return p$1(a.length,n),{handled:true,text:a,mimeType:"application/json"}}return p$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)
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 le(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(p.existsSync(t))return t}catch{}return null}function J(e){return le("prompts",e)}function de(e){return Math.ceil(e.length/3.5)}function B(e){let s=J(e);if(!s)return [];try{return p.readdirSync(s).filter(t=>t.endsWith(".md")).map(t=>{let o=t.replace(".md",""),r=m.join(s,t),i=p.statSync(r),a=p.readFileSync(r,"utf8");return {name:o,description:ce[o]||`Prompt template: ${o}`,filename:t,size:i.size,tokens:de(a)}})}catch{return []}}function pe(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(!p.existsSync(t)){let r=B(s).map(i=>i.name);return {found:!1,content:"",error:`Prompt "${e}" not found. Available prompts: ${r.join(", ")}`}}return {content:p.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 Q(e,s){let n=`paradigm://${e}`;if(e==="prompts"){let t=B(s),o=t.reduce((a,l)=>a+l.size,0),r=t.reduce((a,l)=>a+l.tokens,0),i=JSON.stringify({count:t.length,totalSize:o,totalTokens:r,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 q$1(i.length,n),{handled:true,text:i,mimeType:"application/json"}}if(e.startsWith("prompts/")){let t=decodeURIComponent(e.replace("prompts/","")),{content:o,found:r,error:i}=pe(t,s);if(!r){let a=JSON.stringify({error:i,name:t},null,2);return q$1(a.length,n),{handled:true,text:a,mimeType:"application/json"}}return q$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(p.existsSync(t))return t}catch{}return null}function Y(e){return me("specs",e)}function ge(e){return Math.ceil(e.length/3.5)}function ue(e){let s=Y(e);if(!s)return [];let n=[];for(let[t,o]of Object.entries(A)){let r=`${t}.md`,i=m.join(s,r);try{if(p.existsSync(i)){let a=p.statSync(i),l=p.readFileSync(i,"utf8");n.push({name:t,description:o,filename:r,size:a.size,tokens:ge(l)});}}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=Y(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 p.existsSync(t)?{content:p.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,l)=>a+l.size,0),r=t.reduce((a,l)=>a+l.tokens,0),i=JSON.stringify({count:t.length,totalSize:o,totalTokens:r,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 q$1(i.length,n),{handled:true,text:i,mimeType:"application/json"}}if(e.startsWith("specs/")&&e!=="specs/"){let t=decodeURIComponent(e.replace("specs/","")),{content:o,found:r,error:i}=fe(t,s);if(!r){let a=JSON.stringify({error:i,name:t},null,2);return q$1(a.length,n),{handled:true,text:a,mimeType:"application/json"}}return q$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(p.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 r=`${t}.md`,i=m.join(s,r);try{if(p.existsSync(i)){let a=p.statSync(i),l=p.readFileSync(i,"utf8");n.push({name:t,description:o,filename:r,size:a.size,tokens:ye(l)});}}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 p.existsSync(t)?{content:p.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,l)=>a+l.size,0),r=t.reduce((a,l)=>a+l.tokens,0),i=JSON.stringify({count:t.length,totalSize:o,totalTokens:r,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 q$1(i.length,n),{handled:true,text:i,mimeType:"application/json"}}if(e.startsWith("docs/")&&e!=="docs/"){let t=decodeURIComponent(e.replace("docs/","")),{content:o,found:r,error:i}=we(t,s);if(!r){let a=JSON.stringify({error:i,name:t},null,2);return q$1(a.length,n),{handled:true,text:a,mimeType:"application/json"}}return q$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
101
 
102
102
  **Portal.yaml is REQUIRED when the project has protected routes.**
103
103
 
@@ -111,22 +111,30 @@ Create \`portal.yaml\` in project root when:
111
111
  ## portal.yaml Structure
112
112
 
113
113
  \`\`\`yaml
114
- version: "1.0"
114
+ # Gate keys are bare ids (no ^ prefix). The ^ prefix is for gate
115
+ # *references* \u2014 in routes, flow steps, code, and prose.
116
+ version: "2.0"
115
117
  gates:
116
- ^authenticated:
118
+ authenticated:
117
119
  description: User must be logged in
118
120
  check: req.user != null
119
- ^project-admin:
121
+ project-admin:
120
122
  description: User must be admin of the project
121
123
  check: project.admins.includes(req.user.id)
122
- ^comment-author:
124
+ comment-author:
123
125
  description: User must be the comment author
124
126
  check: comment.authorId === req.user.id
125
127
 
126
128
  routes:
127
- "GET /api/projects/:id": [^authenticated, ^project-member]
128
- "PUT /api/projects/:id": [^authenticated, ^project-admin]
129
- "DELETE /api/comments/:id": [^authenticated, ^comment-author]
129
+ "GET /api/projects/:id":
130
+ gates: [^authenticated, ^project-member]
131
+ prizes: []
132
+ "PUT /api/projects/:id":
133
+ gates: [^authenticated, ^project-admin]
134
+ prizes: []
135
+ "DELETE /api/comments/:id":
136
+ gates: [^authenticated, ^comment-author]
137
+ prizes: []
130
138
  \`\`\`
131
139
 
132
140
  ## When Adding New Endpoints
@@ -455,4 +463,4 @@ components:
455
463
  | When | Tool | Purpose |
456
464
  |------|------|---------|
457
465
  | Starting any task | \`paradigm_pm_preflight\` | Get compliance plan |
458
- | Finishing any task | _(handled by stop hook)_ | Auto-checks compliance |`}};function xe(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(([r,i])=>{let a=i.generate();return {name:r,description:i.description,tokens:xe(a)}}),o=JSON.stringify({count:t.length,totalTokens:t.reduce((r,i)=>r+i.tokens,0),note:"These guidance topics were previously baked into CLAUDE.md. Load on-demand to save context.",topics:t.map(r=>({...r,uri:`paradigm://guidance/${r.name}`}))},null,2);return p$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 i=Object.keys(j),a=JSON.stringify({error:`Unknown guidance topic: "${t}"`,available:i},null,2);return p$1(a.length,n),{handled:true,text:a,mimeType:"application/json"}}let r=o.generate();return p$1(r.length,n),{handled:true,text:r,mimeType:"text/markdown"}}return {handled:false,text:"",mimeType:"application/json"}}function re(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"},...U(),...G(),...q(),...V(),...K(),...ee(),...oe()]})),e.setRequestHandler(ReadResourceRequestSchema,async n$1=>{let t=n$1.params.uri;if(!t?.startsWith("paradigm://"))throw new Error(`Unknown URI scheme: ${t}`);let o=s(),r=t.replace("paradigm://","");if(r==="symbols"){let i=m$1(o.index),a=n(o.index),l=JSON.stringify({project:o.projectName,counts:i,total:Object.values(i).reduce((d,k)=>d+k,0),symbols:a.map(d=>({symbol:d.symbol,type:d.type,description:d.description}))},null,2);return p$1(l.length,t),{contents:[{uri:t,mimeType:"application/json",text:l}]}}if(r.startsWith("symbol/")){let i=decodeURIComponent(r.replace("symbol/","")),a=h$1(o.index,i);if(!a){let d=JSON.stringify({error:"Symbol not found",symbol:i,available:n(o.index).filter(k=>k.symbol.includes(i.slice(1))).slice(0,5).map(k=>k.symbol)},null,2);return p$1(d.length,t),{contents:[{uri:t,mimeType:"application/json",text:d}]}}let l=JSON.stringify({symbol:a.symbol,type:a.type,description:a.description,filePath:a.filePath,references:a.references,referencedBy:a.referencedBy,tags:a.tags,data:a.data},null,2);return p$1(l.length,t),{contents:[{uri:t,mimeType:"application/json",text:l}]}}if(r.startsWith("symbols/type/")){let i$1=r.replace("symbols/type/",""),a=i(o.index,i$1),l=JSON.stringify({type:i$1,count:a.length,symbols:a.map(d=>({symbol:d.symbol,description:d.description,filePath:d.filePath,referencesCount:d.references.length,referencedByCount:d.referencedBy.length}))},null,2);return p$1(l.length,t),{contents:[{uri:t,mimeType:"application/json",text:l}]}}if(r==="gates"){let i=F(o),a=JSON.stringify({count:i.length,gates:i},null,2);return p$1(a.length,t),{contents:[{uri:t,mimeType:"application/json",text:a}]}}if(r==="flows"){let i=I(o),a=JSON.stringify({count:i.length,flows:i},null,2);return p$1(a.length,t),{contents:[{uri:t,mimeType:"application/json",text:a}]}}if(r.startsWith("wisdom/")){let i=await z(r,o);if(i.handled)return p$1(i.text.length),{contents:[{uri:t,mimeType:"application/json",text:i.text}]}}if(r.startsWith("history/")){let i=await $(r,o);if(i.handled)return p$1(i.text.length),{contents:[{uri:t,mimeType:"application/json",text:i.text}]}}if(r.startsWith("context/")){let i=await H(r);if(i.handled)return p$1(i.text.length),{contents:[{uri:t,mimeType:i.text.startsWith("#")?"text/markdown":"application/json",text:i.text}]}}if(r==="prompts"||r.startsWith("prompts/")){let i=await Q(r,o);if(i.handled)return {contents:[{uri:t,mimeType:i.mimeType,text:i.text}]}}if(r==="specs"||r.startsWith("specs/")){let i=await X(r,o);if(i.handled)return {contents:[{uri:t,mimeType:i.mimeType,text:i.text}]}}if(r==="docs"||r.startsWith("docs/")){let i=await te(r,o);if(i.handled)return {contents:[{uri:t,mimeType:i.mimeType,text:i.text}]}}if(r==="guidance"||r.startsWith("guidance/")){let i=await ne(r);if(i.handled)return {contents:[{uri:t,mimeType:i.mimeType,text:i.text}]}}throw new Error(`Unknown resource: ${r}`)});}b();var v=process.argv[2]||process.cwd(),w=null;function ie(){if(!w)throw new Error("Project context not loaded");return w}async function je(){w=await d(v),ma(v,w).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{w=await d(v),j$1().setRootDir(w.rootDir),a.component("#paradigm-mcp").info("Project loaded",{symbols:w.aggregation.symbols.length,project:w.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:{}}});re(e,ie),h(e,ie,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);});
466
+ | Finishing any task | _(handled by stop hook)_ | Auto-checks compliance |`}};function xe(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(([r,i])=>{let a=i.generate();return {name:r,description:i.description,tokens:xe(a)}}),o=JSON.stringify({count:t.length,totalTokens:t.reduce((r,i)=>r+i.tokens,0),note:"These guidance topics were previously baked into CLAUDE.md. Load on-demand to save context.",topics:t.map(r=>({...r,uri:`paradigm://guidance/${r.name}`}))},null,2);return q$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 i=Object.keys(j),a=JSON.stringify({error:`Unknown guidance topic: "${t}"`,available:i},null,2);return q$1(a.length,n),{handled:true,text:a,mimeType:"application/json"}}let r=o.generate();return q$1(r.length,n),{handled:true,text:r,mimeType:"text/markdown"}}return {handled:false,text:"",mimeType:"application/json"}}function re(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"},...U(),...G(),...q(),...V(),...K(),...ee(),...oe()]})),e.setRequestHandler(ReadResourceRequestSchema,async n$1=>{let t=n$1.params.uri;if(!t?.startsWith("paradigm://"))throw new Error(`Unknown URI scheme: ${t}`);let o$1=s(),r=t.replace("paradigm://","");if(r==="symbols"){let i=n(o$1.index),a=o(o$1.index),l=JSON.stringify({project:o$1.projectName,counts:i,total:Object.values(i).reduce((d,k)=>d+k,0),symbols:a.map(d=>({symbol:d.symbol,type:d.type,description:d.description}))},null,2);return q$1(l.length,t),{contents:[{uri:t,mimeType:"application/json",text:l}]}}if(r.startsWith("symbol/")){let i$1=decodeURIComponent(r.replace("symbol/","")),a=i(o$1.index,i$1);if(!a){let d=JSON.stringify({error:"Symbol not found",symbol:i$1,available:o(o$1.index).filter(k=>k.symbol.includes(i$1.slice(1))).slice(0,5).map(k=>k.symbol)},null,2);return q$1(d.length,t),{contents:[{uri:t,mimeType:"application/json",text:d}]}}let l=JSON.stringify({symbol:a.symbol,type:a.type,description:a.description,filePath:a.filePath,references:a.references,referencedBy:a.referencedBy,tags:a.tags,data:a.data},null,2);return q$1(l.length,t),{contents:[{uri:t,mimeType:"application/json",text:l}]}}if(r.startsWith("symbols/type/")){let i=r.replace("symbols/type/",""),a=j$2(o$1.index,i),l=JSON.stringify({type:i,count:a.length,symbols:a.map(d=>({symbol:d.symbol,description:d.description,filePath:d.filePath,referencesCount:d.references.length,referencedByCount:d.referencedBy.length}))},null,2);return q$1(l.length,t),{contents:[{uri:t,mimeType:"application/json",text:l}]}}if(r==="gates"){let i=F(o$1),a=JSON.stringify({count:i.length,gates:i},null,2);return q$1(a.length,t),{contents:[{uri:t,mimeType:"application/json",text:a}]}}if(r==="flows"){let i=I(o$1),a=JSON.stringify({count:i.length,flows:i},null,2);return q$1(a.length,t),{contents:[{uri:t,mimeType:"application/json",text:a}]}}if(r.startsWith("wisdom/")){let i=await z(r,o$1);if(i.handled)return q$1(i.text.length),{contents:[{uri:t,mimeType:"application/json",text:i.text}]}}if(r.startsWith("history/")){let i=await $(r,o$1);if(i.handled)return q$1(i.text.length),{contents:[{uri:t,mimeType:"application/json",text:i.text}]}}if(r.startsWith("context/")){let i=await H(r);if(i.handled)return q$1(i.text.length),{contents:[{uri:t,mimeType:i.text.startsWith("#")?"text/markdown":"application/json",text:i.text}]}}if(r==="prompts"||r.startsWith("prompts/")){let i=await Q(r,o$1);if(i.handled)return {contents:[{uri:t,mimeType:i.mimeType,text:i.text}]}}if(r==="specs"||r.startsWith("specs/")){let i=await X(r,o$1);if(i.handled)return {contents:[{uri:t,mimeType:i.mimeType,text:i.text}]}}if(r==="docs"||r.startsWith("docs/")){let i=await te(r,o$1);if(i.handled)return {contents:[{uri:t,mimeType:i.mimeType,text:i.text}]}}if(r==="guidance"||r.startsWith("guidance/")){let i=await ne(r);if(i.handled)return {contents:[{uri:t,mimeType:i.mimeType,text:i.text}]}}throw new Error(`Unknown resource: ${r}`)});}b();var v=process.argv[2]||process.cwd(),w=null;function ie(){if(!w)throw new Error("Project context not loaded");return w}async function je(){w=await d(v),oa(v,w).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{w=await d(v),j$1().setRootDir(w.rootDir),a.component("#paradigm-mcp").info("Project loaded",{symbols:w.aggregation.symbols.length,project:w.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:{}}});re(e,ie),h(e,ie,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);});
@@ -48,7 +48,7 @@ component_types:
48
48
  `),{status:"applied",message:"Added component_types glossary to config.yaml",filesModified:[".paradigm/config.yaml"]}):{status:"error",message:"Cannot read config.yaml"}}},ue={id:"add-discipline-config",introducedIn:"3.4.0",description:"Add discipline field to config.yaml",category:"config",auto:true,async check(e){let t=A(e);return t?D(t,"discipline")?{needed:false,reason:"discipline already set"}:{needed:true,reason:"Missing discipline field"}:{needed:false,reason:"No config.yaml found"}},async apply(e,t){if(t.dryRun)return {status:"skipped",message:"Would add discipline to config.yaml"};let n=I(e);if(!n)return {status:"error",message:"Cannot read config.yaml"};let i=n.replace(/^(project:\s*.+)$/m,`$1
49
49
  discipline: auto`);return i===n?x(e,n.trimEnd()+`
50
50
  discipline: auto
51
- `):x(e,i),{status:"applied",message:"Added discipline: auto to config.yaml",filesModified:[".paradigm/config.yaml"]}}},fe={id:"sync-templates",introducedIn:"evergreen",description:"Update specs/ and docs/ from installed CLI templates",category:"template",auto:true,async check(e){let t=$();if(!t)return {needed:false,reason:"Templates directory not found"};let n=[],i=["specs","docs","prompts"];for(let r of i){let a=p.join(t,r),d=p.join(e,".paradigm",r);if(o.existsSync(a))try{let g=o.readdirSync(a).filter(m=>o.statSync(p.join(a,m)).isFile());for(let m of g)o.existsSync(p.join(d,m))||n.push(`${r}/${m}`);}catch{}}return n.length===0?{needed:false,reason:"All templates are up to date"}:{needed:true,reason:`${n.length} new template file(s) available`,details:n.map(r=>`New: ${r}`)}},async apply(e,t){let n=$();if(!n)return {status:"error",message:"Templates directory not found"};let i=p.basename(e),r=[],a=["specs","docs","prompts"];for(let d of a){let g=p.join(n,d),m=p.join(e,".paradigm",d);if(o.existsSync(g)){t.dryRun||o.mkdirSync(m,{recursive:true});try{let S=o.readdirSync(g,{withFileTypes:!0});for(let k of S){if(k.isDirectory())continue;let M=p.join(m,k.name);if(!o.existsSync(M)){if(t.dryRun){r.push(`${d}/${k.name}`);continue}let c=o.readFileSync(p.join(g,k.name),"utf8");c=c.replace(/\{\{PROJECT_NAME\}\}/g,i),o.writeFileSync(M,c,"utf8"),r.push(`${d}/${k.name}`);}}}catch{}}}return t.dryRun?{status:"skipped",message:`Would copy ${r.length} template file(s)`}:r.length===0?{status:"skipped",message:"No new templates to sync"}:{status:"applied",message:`Synced ${r.length} template file(s)`,filesCreated:r.map(d=>`.paradigm/${d}`)}}},me={id:"refresh-hooks",introducedIn:"evergreen",description:"Reinstall hook scripts from plugin",category:"hook",auto:true,async check(e){let t=[p.join(e,".claude","hooks"),p.join(e,".cursor","hooks")];for(let i of t)if(o.existsSync(i))try{if(o.readdirSync(i).some(a=>a.includes("paradigm")))return {needed:!1,reason:"Hooks are installed"}}catch{}let n=p.join(e,".claude","settings.local.json");if(o.existsSync(n))try{if(JSON.parse(o.readFileSync(n,"utf8")).hooks)return {needed:!1,reason:"Plugin-managed hooks are configured"}}catch{}return {needed:true,reason:"No paradigm hooks found"}},async apply(e,t){if(t.dryRun)return {status:"skipped",message:"Would reinstall hooks"};try{let{hooksInstallCommand:n}=await import('./hooks-IG2GOAHP.js');return await n({force:!0}),{status:"applied",message:"Hooks reinstalled"}}catch(n){return {status:"error",message:`Hook install failed: ${n.message}`}}}},b=[Q,X,Z,ee,te,ne,se,ue,de,le,re,oe,ie,ae,ce,pe,ge,fe,me];var he=createRequire(import.meta.url),{version:W}=he("../package.json");function C(e){let t=p.join(e,".paradigm","migrate.yaml");if(!o.existsSync(t))return null;try{let n=o.readFileSync(t,"utf8");return F.load(n)}catch{return null}}async function V(e){let t=p.join(e,".paradigm"),n=C(e),i=n?.applied.map(l=>l.id)??[],r="unknown",a=p.join(t,"config.yaml");if(o.existsSync(a))try{let l=F.load(o.readFileSync(a,"utf8"));r=String(l.version??"unknown");}catch{}let g=["specs","docs","prompts","lore","tasks","protocols","personas"].filter(l=>!o.existsSync(p.join(t,l))),m=["discipline","tag-bank","purpose-required","component_types"],S=[];if(o.existsSync(a))try{let l=F.load(o.readFileSync(a,"utf8"));S=m.filter(h=>{let j=h.replace(/-/g,"_");return !(h in l)&&!(j in l)&&!(h.replace(/_/g,"-")in l)});}catch{}let k=[],M=$();if(M){let l=["specs","docs"];for(let h of l){let j=p.join(M,h),L=p.join(t,h);if(o.existsSync(j)&&o.existsSync(L)){let J=o.readdirSync(j).filter(R=>!o.statSync(p.join(j,R)).isDirectory());for(let R of J){let Y=p.join(L,R);o.existsSync(Y)||k.push(`${h}/${R}`);}}}}let c=!o.existsSync(p.join(e,".claude","hooks")),u=[];for(let l of b){let h=l.introducedIn==="evergreen";if(i.includes(l.id)&&!h)continue;(await l.check(e)).needed&&u.push(l);}return {configVersion:r,cliVersion:W,pendingMigrations:u,appliedIds:i,health:{missingDirectories:g,missingConfigFields:S,staleTemplates:k,hooksOutdated:c}}}async function U(e){let t=[],n=new Date().toISOString();for(let i of b){if(i.introducedIn==="evergreen")continue;(await i.check(e)).needed||t.push({id:i.id,appliedAt:n,cliVersion:W});}return t}function $(){let e=new URL(import.meta.url).pathname,t=p.dirname(e),n=[p.join(t,"..","..","..","templates","paradigm"),p.join(t,"..","..","templates","paradigm"),p.join(t,"..","templates","paradigm")];for(let i of n)if(o.existsSync(i))return i;return null}var ke=createRequire(import.meta.url),{version:N}=ke("../package.json");async function B(e){let t=C(e);if(t)return t;let n=await U(e);return {version:"1.0",cliVersion:N,lastMigrated:new Date().toISOString(),applied:n}}function _(e,t){let n=p.join(e,".paradigm","migrate.yaml");o.mkdirSync(p.dirname(n),{recursive:true}),t.cliVersion=N,t.lastMigrated=new Date().toISOString(),o.writeFileSync(n,F.dump(t,{indent:2,lineWidth:120,noRefs:true,sortKeys:false,quotingType:'"'}),"utf8");}async function E(e,t,n,i){let r={applied:0,skipped:0,errors:0,manual:0,results:[]},a=new Date().toISOString();for(let d of t){if(!d.auto){r.manual++,r.results.push({id:d.id,result:{status:"skipped",message:"Manual review recommended"}});continue}try{let g=await d.apply(e,n);r.results.push({id:d.id,result:g}),g.status==="applied"?(r.applied++,i.applied.push({id:d.id,appliedAt:a,cliVersion:N})):g.status==="skipped"?r.skipped++:r.errors++;}catch(g){r.errors++,r.results.push({id:d.id,result:{status:"error",message:g.message}});}}return r}async function _e(e={}){let t=process.cwd(),n=p.join(t,".paradigm");if((!o.existsSync(n)||!o.statSync(n).isDirectory())&&!(o.existsSync(n)&&o.statSync(n).isFile())){e.quiet||console.log(s.yellow("\n No .paradigm/ directory found. Run `paradigm init` or `paradigm shift` first.\n"));return}let i=we();e.quiet||i.start("Detecting project state...");let r=await V(t);e.quiet||i.stop();let a=await B(t),d=r.pendingMigrations;if(e.only&&e.only.length>0&&(d=d.filter(c=>e.only.includes(c.id))),e.category&&(d=d.filter(c=>c.category===e.category)),e.force){let c=e.only?b.filter(u=>e.only.includes(u.id)):e.category?b.filter(u=>u.category===e.category):b;d=[];for(let u of c)((await u.check(t)).needed||e.force)&&d.push(u);}let g=d.filter(c=>c.auto),m=d.filter(c=>!c.auto);if(e.list){Me(a,r,e);return}if(e.quiet){if(g.length===0)return;let c=await E(t,g,e,a);return _(t,a),c}let S=C(t);if(console.log(s.blue(`
51
+ `):x(e,i),{status:"applied",message:"Added discipline: auto to config.yaml",filesModified:[".paradigm/config.yaml"]}}},fe={id:"sync-templates",introducedIn:"evergreen",description:"Update specs/ and docs/ from installed CLI templates",category:"template",auto:true,async check(e){let t=$();if(!t)return {needed:false,reason:"Templates directory not found"};let n=[],i=["specs","docs","prompts"];for(let r of i){let a=p.join(t,r),d=p.join(e,".paradigm",r);if(o.existsSync(a))try{let g=o.readdirSync(a).filter(m=>o.statSync(p.join(a,m)).isFile());for(let m of g)o.existsSync(p.join(d,m))||n.push(`${r}/${m}`);}catch{}}return n.length===0?{needed:false,reason:"All templates are up to date"}:{needed:true,reason:`${n.length} new template file(s) available`,details:n.map(r=>`New: ${r}`)}},async apply(e,t){let n=$();if(!n)return {status:"error",message:"Templates directory not found"};let i=p.basename(e),r=[],a=["specs","docs","prompts"];for(let d of a){let g=p.join(n,d),m=p.join(e,".paradigm",d);if(o.existsSync(g)){t.dryRun||o.mkdirSync(m,{recursive:true});try{let S=o.readdirSync(g,{withFileTypes:!0});for(let k of S){if(k.isDirectory())continue;let M=p.join(m,k.name);if(!o.existsSync(M)){if(t.dryRun){r.push(`${d}/${k.name}`);continue}let c=o.readFileSync(p.join(g,k.name),"utf8");c=c.replace(/\{\{PROJECT_NAME\}\}/g,i),o.writeFileSync(M,c,"utf8"),r.push(`${d}/${k.name}`);}}}catch{}}}return t.dryRun?{status:"skipped",message:`Would copy ${r.length} template file(s)`}:r.length===0?{status:"skipped",message:"No new templates to sync"}:{status:"applied",message:`Synced ${r.length} template file(s)`,filesCreated:r.map(d=>`.paradigm/${d}`)}}},me={id:"refresh-hooks",introducedIn:"evergreen",description:"Reinstall hook scripts from plugin",category:"hook",auto:true,async check(e){let t=[p.join(e,".claude","hooks"),p.join(e,".cursor","hooks")];for(let i of t)if(o.existsSync(i))try{if(o.readdirSync(i).some(a=>a.includes("paradigm")))return {needed:!1,reason:"Hooks are installed"}}catch{}let n=p.join(e,".claude","settings.local.json");if(o.existsSync(n))try{if(JSON.parse(o.readFileSync(n,"utf8")).hooks)return {needed:!1,reason:"Plugin-managed hooks are configured"}}catch{}return {needed:true,reason:"No paradigm hooks found"}},async apply(e,t){if(t.dryRun)return {status:"skipped",message:"Would reinstall hooks"};try{let{hooksInstallCommand:n}=await import('./hooks-TFMMMB2H.js');return await n({force:!0}),{status:"applied",message:"Hooks reinstalled"}}catch(n){return {status:"error",message:`Hook install failed: ${n.message}`}}}},b=[Q,X,Z,ee,te,ne,se,ue,de,le,re,oe,ie,ae,ce,pe,ge,fe,me];var he=createRequire(import.meta.url),{version:W}=he("../package.json");function C(e){let t=p.join(e,".paradigm","migrate.yaml");if(!o.existsSync(t))return null;try{let n=o.readFileSync(t,"utf8");return F.load(n)}catch{return null}}async function V(e){let t=p.join(e,".paradigm"),n=C(e),i=n?.applied.map(l=>l.id)??[],r="unknown",a=p.join(t,"config.yaml");if(o.existsSync(a))try{let l=F.load(o.readFileSync(a,"utf8"));r=String(l.version??"unknown");}catch{}let g=["specs","docs","prompts","lore","tasks","protocols","personas"].filter(l=>!o.existsSync(p.join(t,l))),m=["discipline","tag-bank","purpose-required","component_types"],S=[];if(o.existsSync(a))try{let l=F.load(o.readFileSync(a,"utf8"));S=m.filter(h=>{let j=h.replace(/-/g,"_");return !(h in l)&&!(j in l)&&!(h.replace(/_/g,"-")in l)});}catch{}let k=[],M=$();if(M){let l=["specs","docs"];for(let h of l){let j=p.join(M,h),L=p.join(t,h);if(o.existsSync(j)&&o.existsSync(L)){let J=o.readdirSync(j).filter(R=>!o.statSync(p.join(j,R)).isDirectory());for(let R of J){let Y=p.join(L,R);o.existsSync(Y)||k.push(`${h}/${R}`);}}}}let c=!o.existsSync(p.join(e,".claude","hooks")),u=[];for(let l of b){let h=l.introducedIn==="evergreen";if(i.includes(l.id)&&!h)continue;(await l.check(e)).needed&&u.push(l);}return {configVersion:r,cliVersion:W,pendingMigrations:u,appliedIds:i,health:{missingDirectories:g,missingConfigFields:S,staleTemplates:k,hooksOutdated:c}}}async function U(e){let t=[],n=new Date().toISOString();for(let i of b){if(i.introducedIn==="evergreen")continue;(await i.check(e)).needed||t.push({id:i.id,appliedAt:n,cliVersion:W});}return t}function $(){let e=new URL(import.meta.url).pathname,t=p.dirname(e),n=[p.join(t,"..","..","..","templates","paradigm"),p.join(t,"..","..","templates","paradigm"),p.join(t,"..","templates","paradigm")];for(let i of n)if(o.existsSync(i))return i;return null}var ke=createRequire(import.meta.url),{version:N}=ke("../package.json");async function B(e){let t=C(e);if(t)return t;let n=await U(e);return {version:"1.0",cliVersion:N,lastMigrated:new Date().toISOString(),applied:n}}function _(e,t){let n=p.join(e,".paradigm","migrate.yaml");o.mkdirSync(p.dirname(n),{recursive:true}),t.cliVersion=N,t.lastMigrated=new Date().toISOString(),o.writeFileSync(n,F.dump(t,{indent:2,lineWidth:120,noRefs:true,sortKeys:false,quotingType:'"'}),"utf8");}async function E(e,t,n,i){let r={applied:0,skipped:0,errors:0,manual:0,results:[]},a=new Date().toISOString();for(let d of t){if(!d.auto){r.manual++,r.results.push({id:d.id,result:{status:"skipped",message:"Manual review recommended"}});continue}try{let g=await d.apply(e,n);r.results.push({id:d.id,result:g}),g.status==="applied"?(r.applied++,i.applied.push({id:d.id,appliedAt:a,cliVersion:N})):g.status==="skipped"?r.skipped++:r.errors++;}catch(g){r.errors++,r.results.push({id:d.id,result:{status:"error",message:g.message}});}}return r}async function _e(e={}){let t=process.cwd(),n=p.join(t,".paradigm");if((!o.existsSync(n)||!o.statSync(n).isDirectory())&&!(o.existsSync(n)&&o.statSync(n).isFile())){e.quiet||console.log(s.yellow("\n No .paradigm/ directory found. Run `paradigm init` or `paradigm shift` first.\n"));return}let i=we();e.quiet||i.start("Detecting project state...");let r=await V(t);e.quiet||i.stop();let a=await B(t),d=r.pendingMigrations;if(e.only&&e.only.length>0&&(d=d.filter(c=>e.only.includes(c.id))),e.category&&(d=d.filter(c=>c.category===e.category)),e.force){let c=e.only?b.filter(u=>e.only.includes(u.id)):e.category?b.filter(u=>u.category===e.category):b;d=[];for(let u of c)((await u.check(t)).needed||e.force)&&d.push(u);}let g=d.filter(c=>c.auto),m=d.filter(c=>!c.auto);if(e.list){Me(a,r,e);return}if(e.quiet){if(g.length===0)return;let c=await E(t,g,e,a);return _(t,a),c}let S=C(t);if(console.log(s.blue(`
52
52
  \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510`)),console.log(s.blue("\u2502")+s.white.bold(" paradigm migrate ")+s.blue("\u2502")),console.log(s.blue("\u2502")+s.gray(" Bring your project up to date ")+s.blue("\u2502")),console.log(s.blue(`\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518
53
53
  `)),console.log(s.white(` Project: ${s.cyan(p.basename(t))}`)),console.log(s.white(` Config version: ${s.cyan(r.configVersion)}`)),console.log(s.white(` CLI version: ${s.cyan(r.cliVersion)}`)),console.log(s.white(` Last migrated: ${s.cyan(S?.lastMigrated??"never")}`)),console.log(""),d.length===0){console.log(s.green(` All migrations are up to date.
54
54
  `)),S||(_(t,a),e.verbose&&console.log(s.gray(` Created .paradigm/migrate.yaml with bootstrap state.
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import {a,b}from'./chunk-J6KWGCHN.js';import'./chunk-TYWB5IQJ.js';import'./chunk-ORDKEGII.js';import'./chunk-BV5PRPLB.js';import {e as e$1}from'./chunk-AO7ZSRME.js';import'./chunk-FYDRENK7.js';import {d,c}from'./chunk-EKZDFEJW.js';import'./chunk-SHD27BQX.js';import'./chunk-T6IDXUUA.js';import'./chunk-JIXHEBGK.js';import'./chunk-QT2LKB3P.js';import'./chunk-5TAVYPOV.js';import*as S from'path';import e from'chalk';import O from'ora';async function I(o,n,t){let i=n?S.resolve(n):process.cwd();if(!o){t.json?console.log(JSON.stringify({error:"Task is required"})):(console.log(e.red(`
2
+ import {a,b}from'./chunk-HOBHJPTL.js';import'./chunk-TYWB5IQJ.js';import'./chunk-ORDKEGII.js';import'./chunk-BV5PRPLB.js';import {e as e$1}from'./chunk-AO7ZSRME.js';import'./chunk-FYDRENK7.js';import {d,c}from'./chunk-EKZDFEJW.js';import'./chunk-4VKSEOXZ.js';import'./chunk-LWAIVOSF.js';import'./chunk-JIXHEBGK.js';import'./chunk-ZJQY5PPP.js';import'./chunk-5TAVYPOV.js';import*as S from'path';import e from'chalk';import O from'ora';async function I(o,n,t){let i=n?S.resolve(n):process.cwd();if(!o){t.json?console.log(JSON.stringify({error:"Task is required"})):(console.log(e.red(`
3
3
  Task is required.`)),console.log(e.gray(`Example: paradigm team orchestrate "Build @payment-system with Stripe"
4
4
  `)));return}if(!e$1(i)){t.json?console.log(JSON.stringify({error:"Team not configured"})):console.log(e.yellow("\nTeam not configured. Run `paradigm team init` first.\n"));return}let f="faceted";t.solo&&(f="solo"),t.faceted&&(f="faceted");let g;if(t.budget){let s=t.budget.split(",");g={};for(let l of s){let[a,r]=l.split("=");a==="tokens"&&(g.maxTokens=parseInt(r)),a==="cost"&&(g.maxCostUsd=parseFloat(r)),a==="warn"&&(g.warnAtPercent=parseInt(r));}}let c=O({text:"Initializing orchestrator...",isSilent:t.quiet||t.json}).start(),y=new a(i);try{await y.initialize();}catch(s){c.fail("Failed to initialize orchestrator"),t.json?console.log(JSON.stringify({error:s instanceof Error?s.message:String(s)})):console.log(e.red(`
5
5
  Error: ${s instanceof Error?s.message:s}
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env node
2
+ import {e,f}from'./chunk-4VKSEOXZ.js';import'./chunk-ZJQY5PPP.js';import'./chunk-5TAVYPOV.js';import r from'chalk';async function p(n){let a=process.cwd(),e$1=await e(a);if(n.json){let o=e$1.usedButUndeclared.filter(s=>s!=="__portal_unparseable__");console.log(JSON.stringify({status:e$1.status,declaredButUnusedCount:e$1.declaredButUnused.length,usedButUndeclaredCount:o.length,properlyDeclaredCount:e$1.properlyDeclared.length,declaredButUnused:e$1.declaredButUnused,usedButUndeclared:o,properlyDeclared:e$1.properlyDeclared,...e$1.portalError?{portalError:e$1.portalError}:{}}));}else {let o=f(e$1);e$1.status==="compliant"?console.log(r.green(`
3
+ ${o}
4
+ `)):e$1.status==="warnings"?console.log(r.yellow(`
5
+ ${o}
6
+ `)):console.log(r.red(`
7
+ ${o}
8
+ `));}}export{p as portalCheckCommand};
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export{e as checkPortalCompliance,c as extractDeclaredGates,d as findGateReferences,f as formatComplianceReport,g as getComplianceSummary,a as loadPortalConfig,b as loadPortalConfigLegacy}from'./chunk-4VKSEOXZ.js';import'./chunk-ZJQY5PPP.js';import'./chunk-5TAVYPOV.js';
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import {a as a$1,c}from'./chunk-LBQBWIEX.js';import {a,b}from'./chunk-4TXOVRWD.js';import'./chunk-VCKKJDLP.js';import'./chunk-WR6D3SC6.js';import {m}from'./chunk-T6IDXUUA.js';import'./chunk-JIXHEBGK.js';import'./chunk-QT2LKB3P.js';import {e as e$1}from'./chunk-JQKKVAAN.js';import'./chunk-5TAVYPOV.js';import*as n from'fs';import*as e from'path';import s from'chalk';import I from'ora';async function T(i,o){let a$2=i?e.resolve(i):process.cwd(),m$1=e.basename(a$2),g=I(),f=e.join(a$2,".paradigm"),F=n.existsSync(f)&&n.statSync(f).isFile(),p;o.output?p=e.resolve(o.output):F?p=e.join(a$2,".paradigm-scan-index.json"):(p=e.join(a$2,".paradigm","scan-index.json"),n.existsSync(e.dirname(p))||n.mkdirSync(e.dirname(p),{recursive:true})),o.quiet||console.log(s.blue(`
2
+ import {a as a$1,c}from'./chunk-Y4P4SGZV.js';import {a,b}from'./chunk-4TXOVRWD.js';import'./chunk-VCKKJDLP.js';import'./chunk-WR6D3SC6.js';import {m}from'./chunk-LWAIVOSF.js';import'./chunk-JIXHEBGK.js';import'./chunk-ZJQY5PPP.js';import {e as e$1}from'./chunk-JQKKVAAN.js';import'./chunk-5TAVYPOV.js';import*as n from'fs';import*as e from'path';import s from'chalk';import I from'ora';async function T(i,o){let a$2=i?e.resolve(i):process.cwd(),m$1=e.basename(a$2),g=I(),f=e.join(a$2,".paradigm"),F=n.existsSync(f)&&n.statSync(f).isFile(),p;o.output?p=e.resolve(o.output):F?p=e.join(a$2,".paradigm-scan-index.json"):(p=e.join(a$2,".paradigm","scan-index.json"),n.existsSync(e.dirname(p))||n.mkdirSync(e.dirname(p),{recursive:true})),o.quiet||console.log(s.blue(`
3
3
  \u{1F52D} Generating Paradigm Scan Index
4
4
  `));let y,k=[e.join(a$2,".paradigm"),e.join(a$2,".paradigm","config.yaml")];for(let c of k)if(n.existsSync(c)&&n.statSync(c).isFile())try{let t=n.readFileSync(c,"utf8");y=e$1(t).scan;break}catch{}g.start("Aggregating symbols from purpose and gate files...");let r;try{r=await m(a$2);}catch(c){g.fail(s.red("Failed to aggregate symbols")),console.error(s.gray(c.message)),process.exit(1);}if(g.succeed(`Found ${r.symbols.length} symbols`),!o.quiet){let c={components:r.symbols.filter(t=>t.type==="component").length,flows:r.symbols.filter(t=>t.type==="flow").length,gates:r.symbols.filter(t=>t.type==="gate").length,signals:r.symbols.filter(t=>t.type==="signal").length,aspects:r.symbols.filter(t=>t.type==="aspect").length};console.log(s.gray(" Breakdown:"));for(let[t,u]of Object.entries(c))u>0&&console.log(s.gray(` ${t}: ${u}`));console.log();}g.start("Generating scan index...");let l=a({symbols:r.symbols,purposeFiles:r.purposeFiles,portalFiles:r.portalFiles},{projectName:m$1,visualTagMappings:y?.visualTagMappings,screenDefinitions:y?.screens});try{n.writeFileSync(p,b(l),"utf8"),g.succeed(s.green("Scan index generated"));}catch(c){g.fail(s.red("Failed to write scan index")),console.error(s.gray(c.message)),process.exit(1);}await a$1(a$2,r,{quiet:o.quiet});let d=await c(a$2,r.purposeFiles,{quiet:o.quiet});if(d&&Object.keys(d.flows).length>0){let c=e.join(a$2,".paradigm","flow-index.json");if(n.writeFileSync(c,JSON.stringify(d,null,2),"utf8"),!o.quiet){let t=Object.keys(d.symbolToFlows).length;g.succeed(s.green(`Flow index generated (${Object.keys(d.flows).length} flows, ${t} symbol mappings)`));}}return o.quiet||(console.log(s.gray(`
5
5
  Output: ${p}`)),console.log(s.gray(` Components: ${Object.keys(l.components).length}`)),console.log(s.gray(` Features: ${Object.keys(l.features).length}`)),console.log(s.gray(` Flows: ${Object.keys(l.flows).length}`)),console.log(s.gray(` State: ${Object.keys(l.state).length}`)),console.log(s.gray(` Gates: ${Object.keys(l.gates).length}`)),console.log(s.gray(` Signals: ${Object.keys(l.signals).length}`)),console.log(s.gray(` Aspects: ${Object.keys(l.aspects).length}`)),console.log(),console.log(s.blue('\u2728 Scan index ready for "paradigm scan" queries')),console.log(s.gray(` Attach an image and say "paradigm scan" to map UI to code
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- export{ka as getReindexToolsList,la as handleReindexTool,ma as rebuildStaticFiles}from'./chunk-3TR6LLXP.js';import'./chunk-M4UMM6DC.js';import'./chunk-ODVKPZZ4.js';import'./chunk-MQIG6SMF.js';import'./chunk-EK4ZRIFJ.js';import'./chunk-NEJ4ZLCY.js';import'./chunk-5TAVYPOV.js';
2
+ export{ma as getReindexToolsList,na as handleReindexTool,oa as rebuildStaticFiles}from'./chunk-NQ47TA6C.js';import'./chunk-M4UMM6DC.js';import'./chunk-ODVKPZZ4.js';import'./chunk-MQIG6SMF.js';import'./chunk-EK4ZRIFJ.js';import'./chunk-NEJ4ZLCY.js';import'./chunk-5TAVYPOV.js';
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import {n,m,o as o$1,t,r as r$1}from'./chunk-T6IDXUUA.js';import'./chunk-JIXHEBGK.js';import'./chunk-QT2LKB3P.js';import {a as a$1}from'./chunk-LKAT7IAK.js';import'./chunk-5TAVYPOV.js';import*as a from'fs';import*as r from'path';import o from'chalk';import {execSync}from'child_process';import*as F from'js-yaml';var W=/[@#$%^!?&~][a-zA-Z][a-zA-Z0-9_-]*/g,_=[/\.(get|post|put|patch|delete)\s*\(\s*['"`]([^'"`]+)['"`]/gi,/export\s+(async\s+)?function\s+(GET|POST|PUT|PATCH|DELETE)/gi];async function G(n$1={}){let i=process.cwd(),b=a$1.command("review").start("Running review pipeline",{cwd:i}),u=[],m$1=[];try{if(n$1.pr)u=execSync(`gh pr diff ${n$1.pr} --name-only`,{cwd:i,encoding:"utf8",timeout:15e3}).trim().split(`
2
+ import {n,m,o as o$1,t,r as r$1}from'./chunk-LWAIVOSF.js';import'./chunk-JIXHEBGK.js';import'./chunk-ZJQY5PPP.js';import {a as a$1}from'./chunk-LKAT7IAK.js';import'./chunk-5TAVYPOV.js';import*as a from'fs';import*as r from'path';import o from'chalk';import {execSync}from'child_process';import*as F from'js-yaml';var W=/[@#$%^!?&~][a-zA-Z][a-zA-Z0-9_-]*/g,_=[/\.(get|post|put|patch|delete)\s*\(\s*['"`]([^'"`]+)['"`]/gi,/export\s+(async\s+)?function\s+(GET|POST|PUT|PATCH|DELETE)/gi];async function G(n$1={}){let i=process.cwd(),b=a$1.command("review").start("Running review pipeline",{cwd:i}),u=[],m$1=[];try{if(n$1.pr)u=execSync(`gh pr diff ${n$1.pr} --name-only`,{cwd:i,encoding:"utf8",timeout:15e3}).trim().split(`
3
3
  `).filter(Boolean);else {let e=execSync("git diff --cached --name-only",{cwd:i,encoding:"utf8",timeout:5e3}).trim(),t=execSync("git diff --name-only",{cwd:i,encoding:"utf8",timeout:5e3}).trim();u=[...new Set([...e.split(`
4
4
  `).filter(Boolean),...t.split(`
5
5
  `).filter(Boolean)])];}}catch(e){let t=e.message;n$1.json||a$1.command("review").error(`Failed to get changed files: ${t}`),b.error("Failed to get changed files"),n$1.ci&&process.exit(1);return}if(u.length===0){n$1.json?console.log(JSON.stringify({findings:[],summary:{total:0,blocking:0,improvements:0,notes:0}})):console.log(o.green(`
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import {D as D$1,m,o,r,p,x,y}from'./chunk-T6IDXUUA.js';import'./chunk-JIXHEBGK.js';import'./chunk-QT2LKB3P.js';import {a}from'./chunk-LKAT7IAK.js';import'./chunk-5TAVYPOV.js';import*as u from'path';import e from'chalk';import F from'ora';function I(s,t){let r$1=r(t,"flow"),a=[];for(let p of r$1){let l=p.data,i=l?.sequence||l?.gates||p.references,g=i.indexOf(s);g!==-1&&a.push({flow:p.symbol,position:g+1,total:i.length});}return a}function O(s){let t=u.dirname(s),r=`${t}/**/*.test.{ts,tsx}`,a=`npm test -- --testPathPattern="${t}"`;return {testPath:r,testCommand:a}}function C(s){return {components:s.filter(t=>t.type==="component").map(t=>t.symbol),gates:s.filter(t=>t.type==="gate").map(t=>t.symbol),signals:s.filter(t=>t.type==="signal").map(t=>t.symbol),flows:s.filter(t=>t.type==="flow").map(t=>t.symbol),aspects:s.filter(t=>t.type==="aspect").map(t=>t.symbol)}}function B(s,t){let r=p(t,s);if(!r)return null;let a=x(t,s),p$1=y(t,s),l=C(a),i=C(p$1),g=I(s,t),{testPath:m,testCommand:y$1}=O(r.filePath);return {symbol:r.symbol,type:r.type,path:r.filePath,description:r.description,requires:r.references,requiredBy:r.referencedBy,downstream:{components:l.components,signals:l.signals,aspects:l.aspects},upstream:{gates:i.gates,flows:i.flows},partOfFlows:g,testPath:m,testCommand:y$1}}async function D(s,t,r$1={}){let a$1=process.cwd(),p=t?u.resolve(a$1,t):a$1,l=D$1(s);l||(console.log(e.red(`
2
+ import {D as D$1,m,o,r,p,x,y}from'./chunk-LWAIVOSF.js';import'./chunk-JIXHEBGK.js';import'./chunk-ZJQY5PPP.js';import {a}from'./chunk-LKAT7IAK.js';import'./chunk-5TAVYPOV.js';import*as u from'path';import e from'chalk';import F from'ora';function I(s,t){let r$1=r(t,"flow"),a=[];for(let p of r$1){let l=p.data,i=l?.sequence||l?.gates||p.references,g=i.indexOf(s);g!==-1&&a.push({flow:p.symbol,position:g+1,total:i.length});}return a}function O(s){let t=u.dirname(s),r=`${t}/**/*.test.{ts,tsx}`,a=`npm test -- --testPathPattern="${t}"`;return {testPath:r,testCommand:a}}function C(s){return {components:s.filter(t=>t.type==="component").map(t=>t.symbol),gates:s.filter(t=>t.type==="gate").map(t=>t.symbol),signals:s.filter(t=>t.type==="signal").map(t=>t.symbol),flows:s.filter(t=>t.type==="flow").map(t=>t.symbol),aspects:s.filter(t=>t.type==="aspect").map(t=>t.symbol)}}function B(s,t){let r=p(t,s);if(!r)return null;let a=x(t,s),p$1=y(t,s),l=C(a),i=C(p$1),g=I(s,t),{testPath:m,testCommand:y$1}=O(r.filePath);return {symbol:r.symbol,type:r.type,path:r.filePath,description:r.description,requires:r.references,requiredBy:r.referencedBy,downstream:{components:l.components,signals:l.signals,aspects:l.aspects},upstream:{gates:i.gates,flows:i.flows},partOfFlows:g,testPath:m,testCommand:y$1}}async function D(s,t,r$1={}){let a$1=process.cwd(),p=t?u.resolve(a$1,t):a$1,l=D$1(s);l||(console.log(e.red(`
3
3
  \u274C Invalid symbol format: ${s}`)),console.log(e.gray(" Symbols must start with @, #, ^, !, $, %, ~, or ?")),console.log(e.gray(` Example: paradigm ripple @checkout
4
4
  `)),process.exit(1)),!r$1.quiet&&!r$1.json&&console.log(e.blue(`
5
5
  \u{1F30A} Ripple Analysis for ${e.cyan(s)}
package/dist/sentinel.js CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import {Command}from'commander';import {createRequire}from'module';var r=createRequire(import.meta.url),{version:c}=r("../package.json"),o=new Command;o.name("sentinel").description("Semantic error monitoring \u2014 errors that speak your language").version(c);o.command("defend",{isDefault:true}).description("Launch the Sentinel dashboard").option("-p, --port <port>","Port number","3838").option("--no-open","Don't open browser").action(async t=>{let{launchDashboard:i}=await import('./commands-LMUD5L6R.js');await i(t);});o.command("init").description("Initialize Sentinel in current project").option("--detect","Auto-detect symbols from codebase").action(async t=>{let{initProject:i}=await import('./commands-LMUD5L6R.js');await i(t);});var n=o.command("triage").description("Incident triage");n.command("list").description("List incidents").option("-s, --status <status>","Filter by status (open, investigating, resolved, wont-fix)").option("-e, --env <env>","Filter by environment").option("--symbol <symbol>","Filter by symbol").option("-n, --limit <n>","Max results","10").action(async t=>{let{triageList:i}=await import('./commands-LMUD5L6R.js');await i(t);});n.command("show <id>").description("Show incident details").option("--timeline","Include flow timeline").action(async(t,i)=>{let{triageShow:e}=await import('./commands-LMUD5L6R.js');await e(t,i);});n.command("resolve <id>").description("Resolve an incident").option("--pattern <id>","Pattern that resolved it").option("--commit <hash>","Fix commit").option("--notes <text>","Resolution notes").action(async(t,i)=>{let{triageResolve:e}=await import('./commands-LMUD5L6R.js');await e(t,i);});n.command("stats").description("Show incident statistics").option("-p, --period <period>","Period (7d, 30d, 90d)","7d").action(async t=>{let{triageStats:i}=await import('./commands-LMUD5L6R.js');await i(t);});o.parse();
2
+ import {Command}from'commander';import {createRequire}from'module';var r=createRequire(import.meta.url),{version:c}=r("../package.json"),o=new Command;o.name("sentinel").description("Semantic error monitoring \u2014 errors that speak your language").version(c);o.command("defend",{isDefault:true}).description("Launch the Sentinel dashboard").option("-p, --port <port>","Port number","3838").option("--no-open","Don't open browser").action(async t=>{let{launchDashboard:i}=await import('./commands-ANRJNG2W.js');await i(t);});o.command("init").description("Initialize Sentinel in current project").option("--detect","Auto-detect symbols from codebase").action(async t=>{let{initProject:i}=await import('./commands-ANRJNG2W.js');await i(t);});var n=o.command("triage").description("Incident triage");n.command("list").description("List incidents").option("-s, --status <status>","Filter by status (open, investigating, resolved, wont-fix)").option("-e, --env <env>","Filter by environment").option("--symbol <symbol>","Filter by symbol").option("-n, --limit <n>","Max results","10").action(async t=>{let{triageList:i}=await import('./commands-ANRJNG2W.js');await i(t);});n.command("show <id>").description("Show incident details").option("--timeline","Include flow timeline").action(async(t,i)=>{let{triageShow:e}=await import('./commands-ANRJNG2W.js');await e(t,i);});n.command("resolve <id>").description("Resolve an incident").option("--pattern <id>","Pattern that resolved it").option("--commit <hash>","Fix commit").option("--notes <text>","Resolution notes").action(async(t,i)=>{let{triageResolve:e}=await import('./commands-ANRJNG2W.js');await e(t,i);});n.command("stats").description("Show incident statistics").option("-p, --period <period>","Period (7d, 30d, 90d)","7d").action(async t=>{let{triageStats:i}=await import('./commands-ANRJNG2W.js');await i(t);});o.parse();
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import {b,c as c$2}from'./chunk-W7C6FFMO.js';import'./chunk-4TXOVRWD.js';import {g}from'./chunk-T6IDXUUA.js';import {c as c$1}from'./chunk-JIXHEBGK.js';import'./chunk-QT2LKB3P.js';import {d as d$1,b as b$1,a}from'./chunk-JQKKVAAN.js';import'./chunk-5TAVYPOV.js';import*as n from'fs';import*as c from'path';import*as D from'readline';import e from'chalk';function x(){return D.createInterface({input:process.stdin,output:process.stdout})}async function d(s,r){return new Promise(t=>{s.question(r,o=>{t(o.trim());});})}async function p(s,r,t){console.log(`
2
+ import {b,c as c$2}from'./chunk-W7C6FFMO.js';import'./chunk-4TXOVRWD.js';import {g}from'./chunk-LWAIVOSF.js';import {c as c$1}from'./chunk-JIXHEBGK.js';import'./chunk-ZJQY5PPP.js';import {d as d$1,b as b$1,a}from'./chunk-JQKKVAAN.js';import'./chunk-5TAVYPOV.js';import*as n from'fs';import*as c from'path';import*as D from'readline';import e from'chalk';function x(){return D.createInterface({input:process.stdin,output:process.stdout})}async function d(s,r){return new Promise(t=>{s.question(r,o=>{t(o.trim());});})}async function p(s,r,t){console.log(`
3
3
  ${e.cyan(r)}`),t.forEach((i,u)=>{console.log(e.gray(` ${u+1}) `)+i.name);});let o=await d(s,e.white(`Enter number (1-${t.length}): `)),a=parseInt(o,10)-1;return a>=0&&a<t.length?t[a].value:t[0].value}async function k(s,r,t){return console.log(`
4
4
  ${e.cyan(r)}`),t.forEach((i,u)=>{console.log(e.gray(` ${u+1}) `)+i.name);}),(await d(s,e.white("Enter numbers separated by commas (e.g., 1,2,3): "))).split(",").map(i=>parseInt(i.trim(),10)-1).filter(i=>i>=0&&i<t.length).map(i=>t[i].value)}function A(s){let r={};for(let t of ["src","app","lib","packages"])if(n.existsSync(c.join(s,t))){r.sourceDir=t;break}if(r.sourceDir){let t=c.join(s,r.sourceDir);try{let o=n.readdirSync(t,{withFileTypes:!0});r.directories=o.filter(a=>a.isDirectory()).map(a=>a.name).filter(a=>!a.startsWith(".")&&!a.startsWith("_"));}catch{}}return r}function I(s,r){let t={version:"1.0","agent-guidelines":{overview:`${r} uses Paradigm for structured AI context management.`,"how-to-use":["Check .purpose files in directories before making changes","Run `paradigm status` to see all symbols in the project","Run `paradigm visualize` to explore the Dreamscape","Reference symbols using @ # $ % ~ ^ ! ? prefixes"],"update-rules":["When adding a feature, create/update the nearest .purpose file","When adding authorization, update portal.yaml","When exploring ideas, add to .premise with ? prefix","Run `paradigm cursorrules` after updating .paradigm"]},"symbol-system":a,states:{},"purpose-required":[],conventions:b$1};if(t.states||(t.states={}),s.hasAuth&&s.hasAuth!=="none"&&(t.states.user={authenticated:{type:"boolean",default:false,description:"User is logged in"},role:{type:"enum",values:["guest","user","admin"],description:"User access level"}},s.hasAuth==="session"&&(t.states.user.sessionExpiry={type:"string",description:"Session expiration time"})),s.hasSubscription&&s.hasSubscription!=="none"&&(t.states.user||(t.states.user={}),s.hasSubscription==="tiers"?t.states.user.subscription={type:"enum",values:["free","trial","pro","enterprise"],description:"Subscription tier"}:t.states.user.isPremium={type:"boolean",default:false,description:"Has premium access"}),s.hasGates==="yes"&&t["agent-guidelines"]["how-to-use"].push("Check portal.yaml for authorization rules before modifying access control"),s.directories&&s.directories.length>0&&s.sourceDir&&(t["purpose-required"]=s.directories.map(o=>({pattern:`${s.sourceDir}/${o}/*`,depth:1}))),s.customStates){let o=s.customStates.split(",").map(a=>a.trim()).filter(Boolean);for(let a of o){let i=a.split(".");if(i.length>=2){let u=i[0],g=i.slice(1).join(".");t.states[u]||(t.states[u]={}),t.states[u][g]={type:"boolean",description:`Custom state: ${a}`};}}}return t}async function j(s){let r=x(),t={};console.log(e.blue(`
5
5
  \u{1F305} Paradigm Setup Wizard
@@ -23,7 +23,7 @@ ${e.cyan(r)}`),t.forEach((i,u)=>{console.log(e.gray(` ${u+1}) `)+i.name);}),(aw
23
23
  `));return}let i;r.yes?(i={sourceDir:A(t).sourceDir||"src",directories:["features","components"],hasAuth:"session",hasSubscription:"none",hasGates:"yes",cursorMode:"create"},console.log(e.blue(`
24
24
  \u{1F305} Using default configuration...
25
25
  `))):i=await j(t);let u=I(i,o);n.writeFileSync(a,d$1(u),"utf8"),console.log(e.green(`
26
- \u2705 Created .paradigm configuration`));let g$1=c.join(t,".premise");n.existsSync(g$1)||(n.writeFileSync(g$1,g(o),"utf8"),console.log(e.green("\u2705 Created .premise file")));let f=c.join(t,".purpose");n.existsSync(f)||(n.writeFileSync(f,c$1(),"utf8"),console.log(e.green("\u2705 Created .purpose file")));let h=c.join(t,"portal.yaml");if(i.hasGates==="yes"&&!n.existsSync(h)){let{getDefaultGateConfig:l}=await import('./dist-VXCZWVVJ.js');n.writeFileSync(h,l(),"utf8"),console.log(e.green("\u2705 Created portal.yaml"));}let m=i.cursorMode||"skip";if(m!=="skip"){let l=b(t,u,m,o);l.success&&l.path&&console.log(e.green(`\u2705 ${l.message}`));}console.log(e.gray(`
26
+ \u2705 Created .paradigm configuration`));let g$1=c.join(t,".premise");n.existsSync(g$1)||(n.writeFileSync(g$1,g(o),"utf8"),console.log(e.green("\u2705 Created .premise file")));let f=c.join(t,".purpose");n.existsSync(f)||(n.writeFileSync(f,c$1(),"utf8"),console.log(e.green("\u2705 Created .purpose file")));let h=c.join(t,"portal.yaml");if(i.hasGates==="yes"&&!n.existsSync(h)){let{getDefaultGateConfig:l}=await import('./dist-SE67SOXB.js');n.writeFileSync(h,l(),"utf8"),console.log(e.green("\u2705 Created portal.yaml"));}let m=i.cursorMode||"skip";if(m!=="skip"){let l=b(t,u,m,o);l.success&&l.path&&console.log(e.green(`\u2705 ${l.message}`));}console.log(e.gray(`
27
27
  \u2500`.repeat(55))),console.log(e.blue(`
28
28
  \u{1F389} Paradigm setup complete!
29
29
  `)),console.log(e.white("Files created:")),console.log(e.gray(" \u2022 .paradigm ")+e.white("AI guidelines, symbols, states")),console.log(e.gray(" \u2022 .premise ")+e.white("Project overview & ideas")),console.log(e.gray(" \u2022 .purpose ")+e.white("Root context & features")),i.hasGates==="yes"&&console.log(e.gray(" \u2022 portal.yaml ")+e.white("Authorization topology")),m!=="skip"&&console.log(e.gray(" \u2022 .cursorrules ")+e.white("Cursor AI integration")),console.log(e.white(`
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import {a as a$4,d as d$3,b as b$2,e as e$1,f}from'./chunk-Z72SDTBJ.js';import {b}from'./chunk-KFNHCQ4R.js';import'./chunk-J6KWGCHN.js';import'./chunk-TYWB5IQJ.js';import'./chunk-ORDKEGII.js';import'./chunk-BV5PRPLB.js';import {d as d$2}from'./chunk-AO7ZSRME.js';import'./chunk-FYDRENK7.js';import'./chunk-Y4XFVDZC.js';import {a as a$6}from'./chunk-SI6SV76D.js';import {d as d$1}from'./chunk-SUU6M4JH.js';import {a as a$3,b as b$1}from'./chunk-GE3GQALR.js';import {a as a$7}from'./chunk-G7XFK2GI.js';import'./chunk-EKZDFEJW.js';import {a as a$1}from'./chunk-CHVQNRRT.js';import {b as b$3}from'./chunk-LBQBWIEX.js';import'./chunk-4TXOVRWD.js';import'./chunk-VCKKJDLP.js';import'./chunk-WR6D3SC6.js';import {a as a$2}from'./chunk-UIKLE3WD.js';import {a as a$5}from'./chunk-3XGNXXCT.js';import'./chunk-SHD27BQX.js';import'./chunk-T6IDXUUA.js';import'./chunk-JIXHEBGK.js';import'./chunk-QT2LKB3P.js';import'./chunk-DOCDDDTD.js';import'./chunk-JQKKVAAN.js';import {a}from'./chunk-LKAT7IAK.js';import'./chunk-5TAVYPOV.js';import*as s from'fs';import*as ne from'os';import*as d from'path';import e from'chalk';import ke from'ora';import*as h from'js-yaml';import*as v from'fs/promises';var ae=[{path:".paradigm/config.yaml",defaultContent:['version: "2.0"','project: ""','description: ""','initialized: ""'].join(`
2
+ import {a as a$4,d as d$3,b as b$2,e as e$1,f}from'./chunk-Z72SDTBJ.js';import {b}from'./chunk-4L7665QV.js';import'./chunk-HOBHJPTL.js';import'./chunk-TYWB5IQJ.js';import'./chunk-ORDKEGII.js';import'./chunk-BV5PRPLB.js';import {d as d$2}from'./chunk-AO7ZSRME.js';import'./chunk-FYDRENK7.js';import'./chunk-Y4XFVDZC.js';import {a as a$6}from'./chunk-3DZK54RU.js';import {d as d$1}from'./chunk-TOYQ2QCB.js';import {a as a$3,b as b$1}from'./chunk-GE3GQALR.js';import {a as a$7}from'./chunk-RBLK34IA.js';import'./chunk-EKZDFEJW.js';import {a as a$1}from'./chunk-5QOCKWK5.js';import {b as b$3}from'./chunk-Y4P4SGZV.js';import'./chunk-4TXOVRWD.js';import'./chunk-VCKKJDLP.js';import'./chunk-WR6D3SC6.js';import {a as a$2}from'./chunk-UIKLE3WD.js';import {a as a$5}from'./chunk-3XGNXXCT.js';import'./chunk-4VKSEOXZ.js';import'./chunk-LWAIVOSF.js';import'./chunk-JIXHEBGK.js';import'./chunk-ZJQY5PPP.js';import'./chunk-DOCDDDTD.js';import'./chunk-JQKKVAAN.js';import {a}from'./chunk-LKAT7IAK.js';import'./chunk-5TAVYPOV.js';import*as s from'fs';import*as ne from'os';import*as d from'path';import e from'chalk';import ke from'ora';import*as h from'js-yaml';import*as v from'fs/promises';var ae=[{path:".paradigm/config.yaml",defaultContent:['version: "2.0"','project: ""','description: ""','initialized: ""'].join(`
3
3
  `)+`
4
4
  `},{path:".paradigm/agents.yaml",defaultContent:['version: "1.0"',"agents: []"].join(`
5
5
  `)+`
@@ -21,7 +21,7 @@ import {a as a$4,d as d$3,b as b$2,e as e$1,f}from'./chunk-Z72SDTBJ.js';import {
21
21
  `)+`
22
22
  `},{path:".paradigm/graduation.yaml",defaultContent:['version: "1.0"',"graduations: []"].join(`
23
23
  `)+`
24
- `},{path:"portal.yaml",defaultContent:['version: "2.0"',"gates: []","routes: []"].join(`
24
+ `},{path:"portal.yaml",defaultContent:['version: "2.0"',"gates: {}","routes: {}"].join(`
25
25
  `)+`
26
26
  `},{path:".purpose",defaultContent:['version: "2.0"',"id: root",'description: ""',"components: []"].join(`
27
27
  `)+`
@@ -51,10 +51,10 @@ Generated by paradigm shift.
51
51
  `)}async function de(o){let n=d.join(o,".purpose");try{let l=await v.readFile(n,"utf-8");if(l.trim().length<se)return {id:"empty-purpose",priority:1,message:"Edit `.purpose` to define your project's features",command:void 0,type:"action"};if(ce.some(f=>l.includes(f)))return {id:"empty-purpose",priority:1,message:"Edit `.purpose` to define your project's features",command:void 0,type:"action"}}catch{return {id:"empty-purpose",priority:1,message:"Edit `.purpose` to define your project's features",command:void 0,type:"action"}}return null}async function me(o){let n=["src","packages","apps"];for(let r of n){let f=d.join(o,r);if(!s.existsSync(f))continue;if(await te(f))return null}return n.some(r=>s.existsSync(d.join(o,r)))?{id:"no-sub-purpose",priority:2,message:"Add `.purpose` files to feature directories",command:void 0,type:"action"}:null}async function fe(o){let n=d.join(o,"portal.yaml");try{let l=await v.readFile(n,"utf-8"),r=l.includes("gates:")&&!l.match(/gates:\s*(\[\]|\{\})\s*$/m)&&!l.match(/gates:\s*(\[\]|\{\})\s*\n/),f=l.includes("routes:")&&!l.match(/routes:\s*(\[\]|\{\})\s*$/m)&&!l.match(/routes:\s*(\[\]|\{\})\s*\n/);if(!r&&!f)return {id:"empty-portal",priority:3,message:"Define auth gates in `portal.yaml` if your project has auth",command:void 0,type:"action"}}catch{return {id:"empty-portal",priority:3,message:"Define auth gates in `portal.yaml` if your project has auth",command:void 0,type:"action"}}return null}async function pe(o){let n=d.join(o,".paradigm","agents.yaml");try{let l=await v.readFile(n,"utf-8");if(l.includes("agents: []")||l.trim().length<40)return {id:"agents-unconfigured",priority:4,message:"Review agent roles",command:"paradigm agent list",type:"action"}}catch{return null}return null}async function ue(o){let n=d.join(o,".paradigm",".pending-scope-reviews");return s.existsSync(n)?{id:"pending-scope-reviews",priority:2,message:"Review agent scopes",command:"paradigm agent review",type:"action"}:null}async function ge(o){let n=d.join(o,".paradigm","config.yaml");try{let l=await v.readFile(n,"utf-8");if(!l.includes("model-resolution"))return null;let r=l.match(/tier-1:\s*(\S+)/),f=l.match(/tier-2:\s*(\S+)/),p=l.match(/tier-3:\s*(\S+)/);if(!r||!f||!p)return null;let i=[r[1].replace(/['"]/g,""),f[1].replace(/['"]/g,""),p[1].replace(/['"]/g,"")];if(Object.values(le).some(w=>w[0]===i[0]&&w[1]===i[1]&&w[2]===i[2]))return {id:"model-tiers-default",priority:5,message:"Fine-tune model tiers",command:"paradigm team models",type:"action"}}catch{return null}return null}async function he(o){let n=d.join(o,".paradigm","lore","entries");try{if((await v.readdir(n)).filter(f=>!f.startsWith(".")).length===0)return {id:"no-lore",priority:8,message:"Lore records automatically as you work",command:void 0,type:"info"}}catch{return {id:"no-lore",priority:8,message:"Lore records automatically as you work",command:void 0,type:"info"}}return null}async function ye(o){let n=d.join(o,".paradigm","notebooks");try{if((await v.readdir(n)).filter(f=>!f.startsWith(".")).length===0)return {id:"no-notebooks",priority:8,message:"Agent notebooks build over time",command:void 0,type:"info"}}catch{return {id:"no-notebooks",priority:8,message:"Agent notebooks build over time",command:void 0,type:"info"}}return null}async function we(){return {id:"verify-not-run",priority:6,message:"Verify setup health",command:"paradigm doctor --verify",type:"action"}}async function te(o,n=0){if(n>4)return false;try{let l=await v.readdir(o,{withFileTypes:!0});for(let r of l)if(!(r.isDirectory()&&["node_modules","dist",".git",".next",".paradigm","build","out","target",".turbo"].includes(r.name))&&(r.name===".purpose"&&!r.isDirectory()||r.isDirectory()&&await te(d.join(o,r.name),n+1)))return !0}catch{a.operation("shift-recommendations").debug("Could not read directory",{dir:o});}return false}var oe=new Set(["architect","builder","reviewer","security","advocate","tester","compliance","documentor"]),M={architect:{nickname:"Apex",role:"System design, specifications"},builder:{nickname:"Kit",role:"Implementation, tests"},reviewer:{nickname:"Judge",role:"Code quality, compliance"},security:{nickname:"Aegis",role:"Auth flows, vulnerability scanning"},advocate:{nickname:"Jinx",role:"Stress testing, edge cases"},tester:{nickname:"Probe",role:"Unit and integration tests"},compliance:{nickname:"Rune",role:"Symbol compliance enforcement"},documentor:{nickname:"Scribe",role:".purpose, portal.yaml maintenance"}};function Se(o){let n=[],l=d.join(ne.homedir(),".paradigm","agents");for(let[r,f]of Object.entries(o.agents)){let p,i=r,j=d.join(l,`${r}.agent`);if(s.existsSync(j))try{let x=s.readFileSync(j,"utf8"),C=h.load(x);C?.nickname&&(p=C.nickname),C?.role&&(i=C.role);}catch{}!p&&M[r]&&(p=M[r].nickname,i=M[r].role);let w=f.source==="core"||f.source==="ecosystem"?f.source:oe.has(r)?"core":"ecosystem";n.push({id:r,nickname:p,role:i,source:w});}return n}async function _e(o={}){let n=process.cwd(),l=d.basename(n),r=d.join(n,".paradigm"),f$1=s.existsSync(r)&&s.statSync(r).isDirectory();console.log(e.blue(`
52
52
  \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510`)),console.log(e.blue("\u2502")+e.white.bold(" paradigm shift ")+e.blue("\u2502")),console.log(e.blue("\u2502")+e.gray(" Full project setup in one command ")+e.blue("\u2502")),console.log(e.blue(`\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518
53
53
  `)),console.log(e.white(` \u{1F4C1} Project: ${e.cyan(l)}`)),console.log(e.white(` \u{1F4CD} Status: ${f$1?e.green("Paradigm detected"):e.yellow("New project")}`)),console.log("");let p=a.command("shift").start("Running paradigm shift",{project:l}),i=ke();if(!f$1||o.force){i.start("Step 1/6: Initializing Paradigm...");try{await a$1({force:o.force,quick:!0,name:l,stack:o.stack}),i.succeed(e.green("Paradigm initialized"));}catch(t){i.fail(e.red(`Init failed: ${t.message}`)),p.error("Shift failed at init",{error:t.message});return}}else {i.succeed(e.gray("Step 1/6: Already initialized (use --force to reinit)"));let t=d.join(r,"config.yaml");if(s.existsSync(t))try{let a=s.readFileSync(t,"utf8"),c=h.load(a);if(!c.discipline||c.discipline==="auto"){let m=a$2(n);if(m!=="backend"){let u=a.replace(/^discipline:\s*auto\b.*$/m,`discipline: ${m}`);u!==a&&(s.writeFileSync(t,u,"utf8"),console.log(e.green(` \u2713 Detected discipline: ${e.cyan(m)} (updated config.yaml)`)));}else if(!c.discipline){let u=a.replace(/^(project:\s*.+)$/m,`$1
54
- discipline: ${m}`);u!==a&&(s.writeFileSync(t,u,"utf8"),console.log(e.green(` \u2713 Added discipline: ${e.cyan(m)} to config.yaml`)));}}}catch(a$1){a.operation("shift").debug("Discipline detection failed",{error:a$1.message});}}if(f$1){i.start("Step 1b/6: Checking for migrations...");try{let{migrateCommand:t}=await import('./migrate-IBDE7VK4.js');await t({apply:!0,quiet:!0,noSync:!0}),i.succeed(e.green("Migrations applied"));}catch(t){i.warn(e.yellow(`Migration warning: ${t.message}`));}}{let t=d.join(r,"config.yaml");if(o.workspace&&s.existsSync(t)){let a$1=o.workspacePath?d.resolve(n,o.workspacePath):d.join(d.dirname(n),".paradigm-workspace");if(s.existsSync(a$1))try{let c=h.load(s.readFileSync(a$1,"utf8")),m=d.basename(n),u=d.dirname(a$1),g="./"+d.relative(u,n);if(c.members.some(b=>d.resolve(u,b.path)===n))console.log(e.green(` \u2713 Already a member of workspace: ${e.cyan(c.name)}`));else {let b=d$1(m,n);c.members.push({name:m,path:g,...b&&{role:b}}),s.writeFileSync(a$1,h.dump(c,{indent:2,lineWidth:120,noRefs:!0,sortKeys:!1,quotingType:'"'}),"utf8"),console.log(e.green(` \u2713 Joined workspace: ${e.cyan(c.name)} (added as member)`));}}catch(c){console.log(e.yellow(` \u26A0 Failed to join workspace: ${c.message}`));}else try{let c=d.basename(n),m=d.dirname(a$1),u="./"+d.relative(m,n),g=d$1(c,n),y={version:"1.0",name:o.workspace,members:[{name:c,path:u,...g&&{role:g}}]};s.mkdirSync(d.dirname(a$1),{recursive:!0}),s.writeFileSync(a$1,h.dump(y,{indent:2,lineWidth:120,noRefs:!0,sortKeys:!1,quotingType:'"'}),"utf8"),console.log(e.green(` \u2713 Created workspace: ${e.cyan(o.workspace)} at ${e.gray(d.relative(n,a$1))}`));}catch(c){console.log(e.yellow(` \u26A0 Failed to create workspace: ${c.message}`));}try{let c=s.readFileSync(t,"utf8"),m=h.load(c),u=d.relative(n,a$1);if(m.workspace!==u){if(m.workspace){let g=c.replace(/^workspace:\s*.*$/m,`workspace: "${u}"`);s.writeFileSync(t,g,"utf8");}else {let g=c.trimEnd()+`
54
+ discipline: ${m}`);u!==a&&(s.writeFileSync(t,u,"utf8"),console.log(e.green(` \u2713 Added discipline: ${e.cyan(m)} to config.yaml`)));}}}catch(a$1){a.operation("shift").debug("Discipline detection failed",{error:a$1.message});}}if(f$1){i.start("Step 1b/6: Checking for migrations...");try{let{migrateCommand:t}=await import('./migrate-Z5UQN57G.js');await t({apply:!0,quiet:!0,noSync:!0}),i.succeed(e.green("Migrations applied"));}catch(t){i.warn(e.yellow(`Migration warning: ${t.message}`));}}{let t=d.join(r,"config.yaml");if(o.workspace&&s.existsSync(t)){let a$1=o.workspacePath?d.resolve(n,o.workspacePath):d.join(d.dirname(n),".paradigm-workspace");if(s.existsSync(a$1))try{let c=h.load(s.readFileSync(a$1,"utf8")),m=d.basename(n),u=d.dirname(a$1),g="./"+d.relative(u,n);if(c.members.some(b=>d.resolve(u,b.path)===n))console.log(e.green(` \u2713 Already a member of workspace: ${e.cyan(c.name)}`));else {let b=d$1(m,n);c.members.push({name:m,path:g,...b&&{role:b}}),s.writeFileSync(a$1,h.dump(c,{indent:2,lineWidth:120,noRefs:!0,sortKeys:!1,quotingType:'"'}),"utf8"),console.log(e.green(` \u2713 Joined workspace: ${e.cyan(c.name)} (added as member)`));}}catch(c){console.log(e.yellow(` \u26A0 Failed to join workspace: ${c.message}`));}else try{let c=d.basename(n),m=d.dirname(a$1),u="./"+d.relative(m,n),g=d$1(c,n),y={version:"1.0",name:o.workspace,members:[{name:c,path:u,...g&&{role:g}}]};s.mkdirSync(d.dirname(a$1),{recursive:!0}),s.writeFileSync(a$1,h.dump(y,{indent:2,lineWidth:120,noRefs:!0,sortKeys:!1,quotingType:'"'}),"utf8"),console.log(e.green(` \u2713 Created workspace: ${e.cyan(o.workspace)} at ${e.gray(d.relative(n,a$1))}`));}catch(c){console.log(e.yellow(` \u26A0 Failed to create workspace: ${c.message}`));}try{let c=s.readFileSync(t,"utf8"),m=h.load(c),u=d.relative(n,a$1);if(m.workspace!==u){if(m.workspace){let g=c.replace(/^workspace:\s*.*$/m,`workspace: "${u}"`);s.writeFileSync(t,g,"utf8");}else {let g=c.trimEnd()+`
55
55
  workspace: "${u}"
56
56
  `;s.writeFileSync(t,g,"utf8");}console.log(e.green(" \u2713 Linked workspace in config.yaml"));}}catch(c){a.operation("shift").debug("Workspace config link failed",{error:c.message});}}else if(s.existsSync(t))try{let a=s.readFileSync(t,"utf8");if(!h.load(a).workspace){let m=d.dirname(n);for(let u=0;u<3;u++){let g=d.join(m,".paradigm-workspace");if(s.existsSync(g)){let b=d.relative(n,g),re=a.trimEnd()+`
57
57
  workspace: "${b}"
58
58
  `;s.writeFileSync(t,re,"utf8"),console.log(e.green(` \u2713 Found workspace: ${e.cyan(b)} (added to config.yaml)`));break}let y=d.dirname(m);if(y===m)break;m=y;}}}catch(a$1){a.operation("shift").debug("Workspace auto-detect failed",{error:a$1.message});}}if(!d$2(n)||o.force){console.log(e.cyan(" Step 2/6: Initializing team configuration..."));try{await b(n,{force:o.force,json:!1,configureModels:o.configureModels||!1,noConfigureModels:!o.configureModels}),console.log(e.green(` \u2713 Team configuration initialized
59
59
  `));}catch(t){console.log(e.yellow(` \u26A0 Team init warning: ${t.message}
60
- `));}}else i.succeed(e.gray("Step 2/6: Team already configured (use --force to reinit)"));let w=d.join(n,".paradigm","roster.yaml");if(!s.existsSync(w)||o.force)try{let t=a$3(n),a=b$1[t]||b$1.generic,c={version:"1.0",project:l,type:t,active:a.sort()};s.writeFileSync(w,h.dump(c,{lineWidth:-1,noRefs:!0}),"utf8"),console.log(e.green(` \u2713 Agent roster set: ${e.cyan(a.length)} agents for ${e.cyan(t)}`));}catch(t){a.operation("shift").debug("Roster setup failed",{error:t.message});}else try{let a=h.load(s.readFileSync(w,"utf8"))?.active?.length??0;console.log(e.gray(` \u2713 Agent roster exists (${a} agents active)`));}catch{console.log(e.gray(" \u2713 Agent roster exists"));}{let t=d.join(n,".paradigm","adoptions.yaml"),a$1=s.existsSync(t);try{let c=a$3(n),m=a$1?await a$4(n):null,u=m&&Object.keys(m.agents).length>0;if(!u&&s.existsSync(w))m=await d$3(n),await b$2(n,m),a.operation("shift").debug("Migrated roster to adoptions",{count:Object.keys(m.agents).length});else if(!u){m=e$1(c);let g=s.existsSync(w)?h.load(s.readFileSync(w,"utf8")):{active:[]},y=new Date().toISOString();for(let b of g.active||[])m.agents[b]={adopted:y,source:oe.has(b)?"core":"ecosystem",defaultsAccepted:!0};Object.keys(m.agents).length>0&&await b$2(n,m);}if(m&&Object.keys(m.agents).length>0){let g=Se(m),y=f(g,c);console.log(y),console.log(e.green(` \u2713 ${Object.keys(m.agents).length} agents adopted`));}}catch(c){a.operation("shift").debug("Adoption ceremony failed",{error:c.message});}}{let t=d.join(r,"config.yaml");if(s.existsSync(t))try{let a=s.readFileSync(t,"utf8"),c=h.load(a);if(!c["model-resolution"]||o.force){let{ModelDiscovery:m}=await import('./model-discovery-HMB3YI4L.js'),g=new m(n).detectEnvironment(),y;g==="claude-code"?y={"tier-1":"opus","tier-2":"sonnet","tier-3":"haiku"}:g==="cursor"?y={"tier-1":"sonnet","tier-2":"sonnet","tier-3":"haiku"}:y={"tier-1":"sonnet","tier-2":"sonnet","tier-3":"sonnet"},c["model-resolution"]=y,s.writeFileSync(t,h.dump(c,{lineWidth:-1,noRefs:!0}),"utf8"),console.log(e.green(` \u2713 Model tiers configured for ${e.cyan(g)}: tier-1=${y["tier-1"]}, tier-2=${y["tier-2"]}, tier-3=${y["tier-3"]}`));}}catch(a$1){a.operation("shift").debug("Model tier config failed",{error:a$1.message});}}try{let{ensureEnforcementDefaults:t}=await import('./enforcement-BEGPQIUN.js');t(n)&&console.log(e.green(` \u2713 Enforcement config initialized (${e.cyan("balanced")} preset)`));}catch(t){a.operation("shift").debug("Enforcement config setup failed",{error:t.message});}{i.start("Ensuring core files...");try{let{created:t,existed:a}=await Y(n);i.succeed(e.green(`Core files ensured: ${e.cyan(String(t.length))} created, ${e.cyan(String(a.length))} already existed`));}catch(t){i.warn(e.yellow(`Guaranteed files warning: ${t.message}`));}}if(o.quick)i.succeed(e.gray("Step 3/6: Skipped scan (--quick mode)"));else {i.start("Step 3/6: Scanning and indexing symbols...");try{await b$3(n,{quiet:!0}),i.succeed(e.green("Symbols indexed"));}catch(t){i.warn(e.yellow(`Scan warning: ${t.message}`));}}{let t=d.join(r,"config.yaml");if(s.existsSync(t))try{if(h.load(s.readFileSync(t,"utf8")).workspace){i.start("Step 3b/6: Reindexing workspace members...");try{let{workspaceReindexCommand:c}=await import('./workspace-MKSQN7B2.js');await c({quiet:!0}),i.succeed(e.green("Workspace members reindexed"));}catch(c){i.warn(e.yellow(`Workspace reindex: ${c.message}`));}}}catch(a$1){a.operation("shift").debug("Workspace config read failed",{error:a$1.message});}}let x=d.join(n,"portal.yaml");s.existsSync(x)||s.writeFileSync(x,h.dump({version:"1.0.0",gates:{},routes:{}},{lineWidth:-1,noRefs:true}),"utf8");let C=d.join(n,".paradigm","lore");s.existsSync(C)||s.mkdirSync(C,{recursive:true});let I=d.join(n,".paradigm","university");for(let t of ["content/notes","content/policies","content/quizzes","content/paths","diplomas"]){let a=d.join(I,t);s.existsSync(a)||s.mkdirSync(a,{recursive:true});}let N=d.join(I,"config.yaml");if(!s.existsSync(N)){let t="Project";try{let c=d.join(n,".paradigm","config.yaml");if(s.existsSync(c)){let m=h.load(s.readFileSync(c,"utf8"));m.project&&typeof m.project=="string"&&(t=m.project);}}catch{}let a={branding:{name:`${t} University`,tagline:`Learn the ${t} codebase`,institution:t},theme:{primary:"#6366f1",secondary:"#8b5cf6",accent:"#f59e0b",background:"#0f172a",surface:"#1e293b",text:"#f8fafc",textMuted:"#94a3b8",success:"#22c55e",error:"#ef4444",font:"Inter, system-ui, sans-serif"},content:{categories:[],defaultDifficulty:"beginner",requireApproval:false},diplomas:{includeGlobalPLSAT:true}};s.writeFileSync(N,h.dump(a,{lineWidth:-1,noRefs:true}),"utf8");}i.start("Step 4/6: Syncing IDE configurations...");try{let t=o.ide?[o.ide]:["claude","cursor","copilot","windsurf","agents"],a=[];for(let c of t)try{await a$5(c,{quiet:!0,force:!0}),a.push(c);}catch{}a.length>0?i.succeed(e.green(`IDE configs synced: ${a.join(", ")}`)):i.warn(e.yellow("No IDE configs to sync"));}catch(t){i.warn(e.yellow(`Sync warning: ${t.message}`));}i.start("Step 5/6: Installing hooks...");try{await a$6({force:o.force}),i.succeed(e.green("Hooks installed (git + Claude Code + Cursor)"));}catch(t){i.warn(e.yellow(`Hooks warning: ${t.message}`));}if(o.verify){i.start("Step 6/6: Running health checks...");try{await a$7({quiet:!0})?i.succeed(e.green("All health checks passed")):i.warn(e.yellow("Some health checks need attention"));}catch(t){i.warn(e.yellow(`Doctor warning: ${t.message}`));}}else i.succeed(e.gray("Step 6/6: Skipped verify (use --verify to check health)"));console.log(""),console.log(e.blue("\u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510")),console.log(e.blue("\u2502")+e.white.bold(" \u2728 Paradigm shift complete! ")+e.blue("\u2502")),console.log(e.blue("\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518")),console.log(""),console.log(e.white(" Created/Updated:")),console.log(e.gray(" \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"));let O=[{path:".paradigm/config.yaml",desc:"Project configuration"},{path:".paradigm/navigator.yaml",desc:"Symbol navigation map"},{path:".paradigm/agents.yaml",desc:"Team agent configuration"},{path:".paradigm/adoptions.yaml",desc:"Agent adoption records"},{path:".purpose",desc:"Root feature definitions"},{path:".paradigm/lore/",desc:"Project lore timeline",isDir:true},{path:"portal.yaml",desc:"Authorization gates"},{path:".paradigm/roster.yaml",desc:"Agent roster for this project"},{path:"CLAUDE.md",desc:"Claude Code AI instructions"},{path:"AGENTS.md",desc:"Universal AI agent instructions"},{path:".cursor/rules/",desc:"Cursor AI instructions",isDir:true},{path:".claude/hooks/",desc:"Claude Code enforcement hooks",isDir:true,optional:true},{path:".cursor/hooks/",desc:"Cursor enforcement hooks",isDir:true,optional:true}],G=d.join(r,"config.yaml");if(s.existsSync(G))try{let t=h.load(s.readFileSync(G,"utf8"));if(typeof t.workspace=="string"){let a=d.resolve(n,t.workspace),c=d.relative(n,a);O.push({path:c,desc:"Multi-project workspace",optional:!0});}}catch(t){a.operation("shift").debug("Summary config read failed",{error:t.message});}for(let t of O){let a=d.join(n,t.path);s.existsSync(a)?console.log(e.green(" \u2713 ")+e.white(t.path.padEnd(28))+e.gray(t.desc)):t.optional||console.log(e.yellow(" \u25CB ")+e.gray(t.path.padEnd(28))+e.gray(`(${t.desc})`));}try{let t=await Z(n),a=ee(t);a&&console.log(a);}catch(t){a.operation("shift").debug("Recommendations engine failed",{error:t.message}),console.log(""),console.log(e.white(" Next steps:")),console.log(e.gray(" "+"\u2500".repeat(49))),console.log(e.white(" 1. ")+e.gray("Edit ")+e.cyan(".purpose")+e.gray(" to define your features")),console.log(e.white(" 2. ")+e.gray("Run ")+e.cyan("paradigm shift --verify")+e.gray(" to check health")),console.log("");}p.success("Paradigm shift complete",{project:l});}export{_e as shiftCommand};
60
+ `));}}else i.succeed(e.gray("Step 2/6: Team already configured (use --force to reinit)"));let w=d.join(n,".paradigm","roster.yaml");if(!s.existsSync(w)||o.force)try{let t=a$3(n),a=b$1[t]||b$1.generic,c={version:"1.0",project:l,type:t,active:a.sort()};s.writeFileSync(w,h.dump(c,{lineWidth:-1,noRefs:!0}),"utf8"),console.log(e.green(` \u2713 Agent roster set: ${e.cyan(a.length)} agents for ${e.cyan(t)}`));}catch(t){a.operation("shift").debug("Roster setup failed",{error:t.message});}else try{let a=h.load(s.readFileSync(w,"utf8"))?.active?.length??0;console.log(e.gray(` \u2713 Agent roster exists (${a} agents active)`));}catch{console.log(e.gray(" \u2713 Agent roster exists"));}{let t=d.join(n,".paradigm","adoptions.yaml"),a$1=s.existsSync(t);try{let c=a$3(n),m=a$1?await a$4(n):null,u=m&&Object.keys(m.agents).length>0;if(!u&&s.existsSync(w))m=await d$3(n),await b$2(n,m),a.operation("shift").debug("Migrated roster to adoptions",{count:Object.keys(m.agents).length});else if(!u){m=e$1(c);let g=s.existsSync(w)?h.load(s.readFileSync(w,"utf8")):{active:[]},y=new Date().toISOString();for(let b of g.active||[])m.agents[b]={adopted:y,source:oe.has(b)?"core":"ecosystem",defaultsAccepted:!0};Object.keys(m.agents).length>0&&await b$2(n,m);}if(m&&Object.keys(m.agents).length>0){let g=Se(m),y=f(g,c);console.log(y),console.log(e.green(` \u2713 ${Object.keys(m.agents).length} agents adopted`));}}catch(c){a.operation("shift").debug("Adoption ceremony failed",{error:c.message});}}{let t=d.join(r,"config.yaml");if(s.existsSync(t))try{let a=s.readFileSync(t,"utf8"),c=h.load(a);if(!c["model-resolution"]||o.force){let{ModelDiscovery:m}=await import('./model-discovery-HMB3YI4L.js'),g=new m(n).detectEnvironment(),y;g==="claude-code"?y={"tier-1":"opus","tier-2":"sonnet","tier-3":"haiku"}:g==="cursor"?y={"tier-1":"sonnet","tier-2":"sonnet","tier-3":"haiku"}:y={"tier-1":"sonnet","tier-2":"sonnet","tier-3":"sonnet"},c["model-resolution"]=y,s.writeFileSync(t,h.dump(c,{lineWidth:-1,noRefs:!0}),"utf8"),console.log(e.green(` \u2713 Model tiers configured for ${e.cyan(g)}: tier-1=${y["tier-1"]}, tier-2=${y["tier-2"]}, tier-3=${y["tier-3"]}`));}}catch(a$1){a.operation("shift").debug("Model tier config failed",{error:a$1.message});}}try{let{ensureEnforcementDefaults:t}=await import('./enforcement-BEGPQIUN.js');t(n)&&console.log(e.green(` \u2713 Enforcement config initialized (${e.cyan("balanced")} preset)`));}catch(t){a.operation("shift").debug("Enforcement config setup failed",{error:t.message});}{i.start("Ensuring core files...");try{let{created:t,existed:a}=await Y(n);i.succeed(e.green(`Core files ensured: ${e.cyan(String(t.length))} created, ${e.cyan(String(a.length))} already existed`));}catch(t){i.warn(e.yellow(`Guaranteed files warning: ${t.message}`));}}if(o.quick)i.succeed(e.gray("Step 3/6: Skipped scan (--quick mode)"));else {i.start("Step 3/6: Scanning and indexing symbols...");try{await b$3(n,{quiet:!0}),i.succeed(e.green("Symbols indexed"));}catch(t){i.warn(e.yellow(`Scan warning: ${t.message}`));}}{let t=d.join(r,"config.yaml");if(s.existsSync(t))try{if(h.load(s.readFileSync(t,"utf8")).workspace){i.start("Step 3b/6: Reindexing workspace members...");try{let{workspaceReindexCommand:c}=await import('./workspace-VMSPYIBV.js');await c({quiet:!0}),i.succeed(e.green("Workspace members reindexed"));}catch(c){i.warn(e.yellow(`Workspace reindex: ${c.message}`));}}}catch(a$1){a.operation("shift").debug("Workspace config read failed",{error:a$1.message});}}let x=d.join(n,"portal.yaml");s.existsSync(x)||s.writeFileSync(x,h.dump({version:"1.0.0",gates:{},routes:{}},{lineWidth:-1,noRefs:true}),"utf8");let C=d.join(n,".paradigm","lore");s.existsSync(C)||s.mkdirSync(C,{recursive:true});let I=d.join(n,".paradigm","university");for(let t of ["content/notes","content/policies","content/quizzes","content/paths","diplomas"]){let a=d.join(I,t);s.existsSync(a)||s.mkdirSync(a,{recursive:true});}let N=d.join(I,"config.yaml");if(!s.existsSync(N)){let t="Project";try{let c=d.join(n,".paradigm","config.yaml");if(s.existsSync(c)){let m=h.load(s.readFileSync(c,"utf8"));m.project&&typeof m.project=="string"&&(t=m.project);}}catch{}let a={branding:{name:`${t} University`,tagline:`Learn the ${t} codebase`,institution:t},theme:{primary:"#6366f1",secondary:"#8b5cf6",accent:"#f59e0b",background:"#0f172a",surface:"#1e293b",text:"#f8fafc",textMuted:"#94a3b8",success:"#22c55e",error:"#ef4444",font:"Inter, system-ui, sans-serif"},content:{categories:[],defaultDifficulty:"beginner",requireApproval:false},diplomas:{includeGlobalPLSAT:true}};s.writeFileSync(N,h.dump(a,{lineWidth:-1,noRefs:true}),"utf8");}i.start("Step 4/6: Syncing IDE configurations...");try{let t=o.ide?[o.ide]:["claude","cursor","copilot","windsurf","agents"],a=[];for(let c of t)try{await a$5(c,{quiet:!0,force:!0}),a.push(c);}catch{}a.length>0?i.succeed(e.green(`IDE configs synced: ${a.join(", ")}`)):i.warn(e.yellow("No IDE configs to sync"));}catch(t){i.warn(e.yellow(`Sync warning: ${t.message}`));}i.start("Step 5/6: Installing hooks...");try{await a$6({force:o.force}),i.succeed(e.green("Hooks installed (git + Claude Code + Cursor)"));}catch(t){i.warn(e.yellow(`Hooks warning: ${t.message}`));}if(o.verify){i.start("Step 6/6: Running health checks...");try{await a$7({quiet:!0})?i.succeed(e.green("All health checks passed")):i.warn(e.yellow("Some health checks need attention"));}catch(t){i.warn(e.yellow(`Doctor warning: ${t.message}`));}}else i.succeed(e.gray("Step 6/6: Skipped verify (use --verify to check health)"));console.log(""),console.log(e.blue("\u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510")),console.log(e.blue("\u2502")+e.white.bold(" \u2728 Paradigm shift complete! ")+e.blue("\u2502")),console.log(e.blue("\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518")),console.log(""),console.log(e.white(" Created/Updated:")),console.log(e.gray(" \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"));let O=[{path:".paradigm/config.yaml",desc:"Project configuration"},{path:".paradigm/navigator.yaml",desc:"Symbol navigation map"},{path:".paradigm/agents.yaml",desc:"Team agent configuration"},{path:".paradigm/adoptions.yaml",desc:"Agent adoption records"},{path:".purpose",desc:"Root feature definitions"},{path:".paradigm/lore/",desc:"Project lore timeline",isDir:true},{path:"portal.yaml",desc:"Authorization gates"},{path:".paradigm/roster.yaml",desc:"Agent roster for this project"},{path:"CLAUDE.md",desc:"Claude Code AI instructions"},{path:"AGENTS.md",desc:"Universal AI agent instructions"},{path:".cursor/rules/",desc:"Cursor AI instructions",isDir:true},{path:".claude/hooks/",desc:"Claude Code enforcement hooks",isDir:true,optional:true},{path:".cursor/hooks/",desc:"Cursor enforcement hooks",isDir:true,optional:true}],G=d.join(r,"config.yaml");if(s.existsSync(G))try{let t=h.load(s.readFileSync(G,"utf8"));if(typeof t.workspace=="string"){let a=d.resolve(n,t.workspace),c=d.relative(n,a);O.push({path:c,desc:"Multi-project workspace",optional:!0});}}catch(t){a.operation("shift").debug("Summary config read failed",{error:t.message});}for(let t of O){let a=d.join(n,t.path);s.existsSync(a)?console.log(e.green(" \u2713 ")+e.white(t.path.padEnd(28))+e.gray(t.desc)):t.optional||console.log(e.yellow(" \u25CB ")+e.gray(t.path.padEnd(28))+e.gray(`(${t.desc})`));}try{let t=await Z(n),a=ee(t);a&&console.log(a);}catch(t){a.operation("shift").debug("Recommendations engine failed",{error:t.message}),console.log(""),console.log(e.white(" Next steps:")),console.log(e.gray(" "+"\u2500".repeat(49))),console.log(e.white(" 1. ")+e.gray("Edit ")+e.cyan(".purpose")+e.gray(" to define your features")),console.log(e.white(" 2. ")+e.gray("Run ")+e.cyan("paradigm shift --verify")+e.gray(" to check health")),console.log("");}p.success("Paradigm shift complete",{project:l});}export{_e as shiftCommand};
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import {c,k,f as f$1}from'./chunk-T6IDXUUA.js';import'./chunk-JIXHEBGK.js';import'./chunk-QT2LKB3P.js';import'./chunk-5TAVYPOV.js';import*as n from'fs';import*as f from'path';import o from'chalk';import y from'ora';async function w(t,r){let m=process.cwd(),i=f.join(m,".premise");console.log(o.blue(`
2
+ import {c,k,f as f$1}from'./chunk-LWAIVOSF.js';import'./chunk-JIXHEBGK.js';import'./chunk-ZJQY5PPP.js';import'./chunk-5TAVYPOV.js';import*as n from'fs';import*as f from'path';import o from'chalk';import y from'ora';async function w(t,r){let m=process.cwd(),i=f.join(m,".premise");console.log(o.blue(`
3
3
  \u{1F4F8} Creating Snapshot...
4
4
  `));let e=y("Loading .premise file...").start();try{n.existsSync(i)||(e.fail(".premise file not found"),console.log(o.yellow(`
5
5
  Run "paradigm init" first to create a .premise file
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import {m,o as o$1,B}from'./chunk-T6IDXUUA.js';import {e}from'./chunk-JIXHEBGK.js';import {e as e$1}from'./chunk-QT2LKB3P.js';import {a as a$1}from'./chunk-LKAT7IAK.js';import'./chunk-5TAVYPOV.js';import*as l from'fs';import*as a from'path';import o from'chalk';import G from'ora';async function D(){let t=process.cwd();console.log(o.blue(`
2
+ import {m,o as o$1,B}from'./chunk-LWAIVOSF.js';import {e}from'./chunk-JIXHEBGK.js';import {e as e$1}from'./chunk-ZJQY5PPP.js';import {a as a$1}from'./chunk-LKAT7IAK.js';import'./chunk-5TAVYPOV.js';import*as l from'fs';import*as a from'path';import o from'chalk';import G from'ora';async function D(){let t=process.cwd();console.log(o.blue(`
3
3
  \u{1F4CA} Paradigm Status
4
4
  `)),console.log(o.gray("\u2500".repeat(40)));let i=a$1.command("status").start("Getting project status"),r=G("Scanning project...").start(),p=l.existsSync(a.join(t,".premise")),m$1=l.existsSync(a.join(t,".purpose")),f=l.existsSync(a.join(t,"portal.yaml"));r.stop(),console.log(o.white(`
5
5
  Configuration Files`)),console.log(o.gray("\u2500".repeat(40))),console.log(` .premise: ${p?o.green("\u2713 Found"):o.yellow("\u25CB Not found")}`),console.log(` .purpose: ${m$1?o.green("\u2713 Found"):o.yellow("\u25CB Not found")}`),console.log(` portal.yaml: ${f?o.green("\u2713 Found"):o.yellow("\u25CB Not found")}`),r.start("Counting files...");let u=await e(t),y=await e$1(t);if(r.stop(),console.log(o.white(`
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import {m}from'./chunk-T6IDXUUA.js';import'./chunk-JIXHEBGK.js';import'./chunk-QT2LKB3P.js';import {c as c$1,a}from'./chunk-DOCDDDTD.js';import'./chunk-JQKKVAAN.js';import'./chunk-5TAVYPOV.js';import*as n from'fs';import*as c from'path';import o from'chalk';import S from'ora';async function F(){let p=process.cwd(),x=c.basename(p),l=S();console.log(o.blue(`
2
+ import {m}from'./chunk-LWAIVOSF.js';import'./chunk-JIXHEBGK.js';import'./chunk-ZJQY5PPP.js';import {c as c$1,a}from'./chunk-DOCDDDTD.js';import'./chunk-JQKKVAAN.js';import'./chunk-5TAVYPOV.js';import*as n from'fs';import*as c from'path';import o from'chalk';import S from'ora';async function F(){let p=process.cwd(),x=c.basename(p),l=S();console.log(o.blue(`
3
3
  \u{1F4CA} Paradigm Summary
4
4
  `));let r=c.join(p,".paradigm");(!n.existsSync(r)||!n.statSync(r).isDirectory())&&(console.log(o.red("\u274C No .paradigm/ directory found.")),console.log(o.gray(" Run `paradigm init` first.\n")),process.exit(1)),l.start("Aggregating symbols...");let m$1;try{m$1=await m(p),l.succeed(`Found ${m$1.symbols.length} symbols`);}catch(e){l.fail(o.red("Failed to aggregate symbols")),console.error(o.gray(e.message)),process.exit(1);}let u={components:{count:0,examples:[]},flows:{count:0,examples:[]},gates:{count:0,examples:[]},signals:{count:0,examples:[]},aspects:{count:0,examples:[]}};for(let e of m$1.symbols){let t=e.type,i=t==="component"?"components":t==="flow"?"flows":t==="gate"?"gates":t==="signal"?"signals":t==="aspect"?"aspects":null;i&&u[i]&&(u[i].count++,u[i].examples.length<3&&u[i].examples.push(e.symbol));}let a$1=[];n.existsSync(c.join(r,"config.yaml"))?a$1.push({check:"Config",status:"ok"}):a$1.push({check:"Config",status:"missing"});let k=["logger.md","scan.md","symbols.md"].every(e=>n.existsSync(c.join(r,"specs",e)));a$1.push({check:"Specs",status:k?"ok":"warn"});let j=n.existsSync(c.join(r,"docs"));a$1.push({check:"Docs",status:j?"ok":"warn"});let g=c$1(p);if(g.detected){let e=a(g.detected);e&&n.existsSync(c.join(p,e.outputPath))?a$1.push({check:`IDE (${g.detected})`,status:"ok"}):a$1.push({check:`IDE (${g.detected})`,status:"warn"});}let w=n.existsSync(c.join(r,"scan-index.json"))||n.existsSync(c.join(p,".paradigm-scan-index.json"));a$1.push({check:"Scan index",status:w?"ok":"missing"});let s=[];s.push(`# Project: ${x}`),s.push(""),s.push(`**Generated:** ${new Date().toISOString()}`),s.push("**Paradigm Version:** 0.2.0"),s.push(""),s.push("## Symbol Counts"),s.push(""),s.push("| Type | Count | Examples |"),s.push("|------|-------|----------|");for(let[e,t]of Object.entries(u))if(t.count>0){let i=t.examples.join(", ");s.push(`| ${e} | ${t.count} | ${i} |`);}s.push(""),s.push("## Source Files"),s.push(""),s.push(`- Purpose files: ${m$1.purposeFiles.length}`),s.push(`- Gate files: ${m$1.portalFiles.length}`),s.push(""),s.push("## Health Status"),s.push("");for(let e of a$1){let t=e.status==="ok"?"\u2713":e.status==="warn"?"\u26A0":"\u25CB";s.push(`- ${t} ${e.check}`);}s.push(""),s.push("---"),s.push("*Generated by `paradigm summary`*");let h=c.join(r,"project.md");l.start("Writing project.md...");try{n.writeFileSync(h,s.join(`
5
5
  `),"utf8"),l.succeed(o.green("project.md generated"));}catch(e){l.fail(o.red("Failed to write project.md")),console.error(o.gray(e.message)),process.exit(1);}console.log(o.gray(`
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- export{e as teamAcceptCommand,f as teamCheckCommand,d as teamHandoffCommand,g as teamHistoryCommand,b as teamInitCommand,a as teamModelsCommand,h as teamResetCommand,c as teamStatusCommand}from'./chunk-KFNHCQ4R.js';import'./chunk-J6KWGCHN.js';import'./chunk-TYWB5IQJ.js';import'./chunk-ORDKEGII.js';import'./chunk-BV5PRPLB.js';import'./chunk-AO7ZSRME.js';import'./chunk-FYDRENK7.js';import'./chunk-Y4XFVDZC.js';import'./chunk-EKZDFEJW.js';import'./chunk-SHD27BQX.js';import'./chunk-T6IDXUUA.js';import'./chunk-JIXHEBGK.js';import'./chunk-QT2LKB3P.js';import'./chunk-5TAVYPOV.js';
2
+ export{e as teamAcceptCommand,f as teamCheckCommand,d as teamHandoffCommand,g as teamHistoryCommand,b as teamInitCommand,a as teamModelsCommand,h as teamResetCommand,c as teamStatusCommand}from'./chunk-4L7665QV.js';import'./chunk-HOBHJPTL.js';import'./chunk-TYWB5IQJ.js';import'./chunk-ORDKEGII.js';import'./chunk-BV5PRPLB.js';import'./chunk-AO7ZSRME.js';import'./chunk-FYDRENK7.js';import'./chunk-Y4XFVDZC.js';import'./chunk-EKZDFEJW.js';import'./chunk-4VKSEOXZ.js';import'./chunk-LWAIVOSF.js';import'./chunk-JIXHEBGK.js';import'./chunk-ZJQY5PPP.js';import'./chunk-5TAVYPOV.js';
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import {a}from'./chunk-QT2LKB3P.js';import'./chunk-5TAVYPOV.js';import*as y from'path';import*as h from'fs';import p from'chalk';var R=null;function G(e){R=e;}function k(){return R}async function O(e,s,t){let n=t||k();if(!n)return {passed:false,results:[],errors:["No gate client configured"]};let o=[],r=[];for(let i of s)try{let c=await n.check(e,i.entity),u=c.passed===i.expected;if(i.expectedPrizes&&c.passed){let a=c.triggeredPrizes.map(l=>l.id),f=i.expectedPrizes.filter(l=>!a.includes(l));f.length>0&&r.push(`Test "${i.name}": Expected prizes not triggered: ${f.join(", ")}`);}o.push({testCase:i,result:c,passed:u}),u||r.push(`Test "${i.name}": Expected ${i.expected?"pass":"fail"}, got ${c.passed?"pass":"fail"}`);}catch(c){r.push(`Test "${i.name}": ${c.message}`),o.push({testCase:i,result:{gate:{id:e,locks:[],prizes:[]},passed:false,lockResults:[],triggeredPrizes:[],timestamp:Date.now()},passed:false});}return {passed:r.length===0,results:o,errors:r}}async function T(e,s={}){let{outputDir:t="tests/gates",framework:n="jest",includeFlows:o=true}=s,r=await a(e),i=[],c=y.resolve(t);h.existsSync(c)||h.mkdirSync(c,{recursive:true});for(let u of r.gates){let a=N(u,n),f=`${u.id.replace(/[^a-z0-9]/gi,"-")}.test.ts`,l=y.join(c,f);h.writeFileSync(l,a,"utf8"),i.push(l);}if(o&&r.flows.length>0){let u=y.join(c,"..","flows");h.existsSync(u)||h.mkdirSync(u,{recursive:true});for(let a of r.flows){let f=z(a,r.gates,n),l=`${a.id.replace(/[^a-z0-9]/gi,"-")}.test.ts`,d=y.join(u,l);h.writeFileSync(d,f,"utf8"),i.push(d);}}return i}function N(e,s){let t=s==="mocha"||s==="vitest"?"it":"test",n=e.id,o=e.description||n,r=e.locks.map(i=>{let c=i.keys.map((u,a)=>` ${t}('should check key: ${u.description||`Key ${a+1}`}', async () => {
2
+ import {a}from'./chunk-ZJQY5PPP.js';import'./chunk-5TAVYPOV.js';import*as y from'path';import*as h from'fs';import p from'chalk';var R=null;function G(e){R=e;}function k(){return R}async function O(e,s,t){let n=t||k();if(!n)return {passed:false,results:[],errors:["No gate client configured"]};let o=[],r=[];for(let i of s)try{let c=await n.check(e,i.entity),u=c.passed===i.expected;if(i.expectedPrizes&&c.passed){let a=c.triggeredPrizes.map(l=>l.id),f=i.expectedPrizes.filter(l=>!a.includes(l));f.length>0&&r.push(`Test "${i.name}": Expected prizes not triggered: ${f.join(", ")}`);}o.push({testCase:i,result:c,passed:u}),u||r.push(`Test "${i.name}": Expected ${i.expected?"pass":"fail"}, got ${c.passed?"pass":"fail"}`);}catch(c){r.push(`Test "${i.name}": ${c.message}`),o.push({testCase:i,result:{gate:{id:e,locks:[],prizes:[]},passed:false,lockResults:[],triggeredPrizes:[],timestamp:Date.now()},passed:false});}return {passed:r.length===0,results:o,errors:r}}async function T(e,s={}){let{outputDir:t="tests/gates",framework:n="jest",includeFlows:o=true}=s,r=await a(e),i=[],c=y.resolve(t);h.existsSync(c)||h.mkdirSync(c,{recursive:true});for(let u of r.gates){let a=N(u,n),f=`${u.id.replace(/[^a-z0-9]/gi,"-")}.test.ts`,l=y.join(c,f);h.writeFileSync(l,a,"utf8"),i.push(l);}if(o&&r.flows.length>0){let u=y.join(c,"..","flows");h.existsSync(u)||h.mkdirSync(u,{recursive:true});for(let a of r.flows){let f=z(a,r.gates,n),l=`${a.id.replace(/[^a-z0-9]/gi,"-")}.test.ts`,d=y.join(u,l);h.writeFileSync(d,f,"utf8"),i.push(d);}}return i}function N(e,s){let t=s==="mocha"||s==="vitest"?"it":"test",n=e.id,o=e.description||n,r=e.locks.map(i=>{let c=i.keys.map((u,a)=>` ${t}('should check key: ${u.description||`Key ${a+1}`}', async () => {
3
3
  const entity = {
4
4
  // TODO: Add entity properties needed for this key
5
5
  // Key expression: ${u.expression}
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- export{h as registerTools}from'./chunk-3VF3CMCF.js';import'./chunk-4UJ4NIEQ.js';import'./chunk-BOYQAMGC.js';import'./chunk-KLBH26PA.js';import'./chunk-JNSJVCTU.js';import'./chunk-Q2J542ST.js';import'./chunk-XROULIQN.js';import'./chunk-ZUAUFZRJ.js';import'./chunk-3KVVC4WV.js';import'./chunk-3TR6LLXP.js';import'./chunk-M4UMM6DC.js';import'./chunk-ODVKPZZ4.js';import'./chunk-74SGKSRQ.js';import'./chunk-MQIG6SMF.js';import'./chunk-EK4ZRIFJ.js';import'./chunk-NEJ4ZLCY.js';import'./chunk-DVZWCXB6.js';import'./chunk-QGZRM6ZB.js';import'./chunk-RLCH7DXQ.js';import'./chunk-5TAVYPOV.js';
2
+ export{h as registerTools}from'./chunk-RN4VE6P3.js';import'./chunk-4UJ4NIEQ.js';import'./chunk-BOYQAMGC.js';import'./chunk-KLBH26PA.js';import'./chunk-JNSJVCTU.js';import'./chunk-Q2J542ST.js';import'./chunk-XROULIQN.js';import'./chunk-ZUAUFZRJ.js';import'./chunk-3KVVC4WV.js';import'./chunk-NQ47TA6C.js';import'./chunk-M4UMM6DC.js';import'./chunk-ODVKPZZ4.js';import'./chunk-74SGKSRQ.js';import'./chunk-MQIG6SMF.js';import'./chunk-EK4ZRIFJ.js';import'./chunk-NEJ4ZLCY.js';import'./chunk-DVZWCXB6.js';import'./chunk-QGZRM6ZB.js';import'./chunk-RLCH7DXQ.js';import'./chunk-5TAVYPOV.js';
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import {a,f,g}from'./chunk-QT2LKB3P.js';import'./chunk-5TAVYPOV.js';import*as i from'path';import t from'chalk';import d from'ora';async function h(a$1){let c=process.cwd(),g$1=i.resolve(c,a$1);console.log(t.blue(`
2
+ import {a,f,g}from'./chunk-ZJQY5PPP.js';import'./chunk-5TAVYPOV.js';import*as i from'path';import t from'chalk';import d from'ora';async function h(a$1){let c=process.cwd(),g$1=i.resolve(c,a$1);console.log(t.blue(`
3
3
  \u{1F50D} Validating Gate Configuration...
4
4
  `));let e=d(`Parsing ${a$1}...`).start();try{let o=await a(g$1);e.succeed("Parsed portal.yaml");let s=f(o);console.log(t.white(`
5
5
  Gates: ${o.gates.length}`)),console.log(t.white(`Flows: ${o.flows.length}`)),console.log(g(s)),s.valid||process.exit(1),console.log("");}catch(o){e.fail("Validation failed"),console.log(t.red(`Error: ${o.message}
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export{d as detectProjectRole,a as workspaceInitCommand,c as workspaceReindexCommand,b as workspaceStatusCommand}from'./chunk-TOYQ2QCB.js';import'./chunk-Y4P4SGZV.js';import'./chunk-4TXOVRWD.js';import'./chunk-VCKKJDLP.js';import'./chunk-WR6D3SC6.js';import'./chunk-LWAIVOSF.js';import'./chunk-JIXHEBGK.js';import'./chunk-ZJQY5PPP.js';import'./chunk-LKAT7IAK.js';import'./chunk-5TAVYPOV.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@a-company/paradigm",
3
- "version": "5.37.8",
3
+ "version": "5.38.0",
4
4
  "description": "Unified CLI for Paradigm developer tools",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -34,6 +34,7 @@
34
34
  "prepublishOnly": "npm run build"
35
35
  },
36
36
  "dependencies": {
37
+ "@a-company/portal-core": "*",
37
38
  "@a-company/registry-client": "^0.1.0",
38
39
  "@modelcontextprotocol/sdk": "^1.0.0",
39
40
  "chalk": "^5.3.0",