@a-company/paradigm 5.37.6 → 5.37.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-L3IGMK27.js → chunk-3VF3CMCF.js} +40 -40
- package/dist/{chunk-22ISTMKI.js → chunk-46ZCEIF6.js} +1 -1
- package/dist/{chunk-D6ZXAI26.js → chunk-CHVQNRRT.js} +60 -20
- package/dist/{chunk-JOHAOLEC.js → chunk-G7XFK2GI.js} +4 -4
- package/dist/{chunk-354XVOW5.js → chunk-SI6SV76D.js} +103 -23
- package/dist/doctor-QJ47XAUP.js +2 -0
- package/dist/{hooks-EDPSLX6B.js → hooks-IG2GOAHP.js} +1 -1
- package/dist/index.js +3 -3
- package/dist/{init-EHVSM7YY.js → init-HIBRSVUB.js} +1 -1
- package/dist/mcp.js +1 -1
- package/dist/{migrate-L2V3VCKR.js → migrate-IBDE7VK4.js} +1 -1
- package/dist/{promote-NJQDZBZA.js → promote-KU2ECEXX.js} +1 -1
- package/dist/{setup-KPIMRZ4Q.js → setup-6SRJHDA7.js} +1 -1
- package/dist/{shift-EMAOEIGE.js → shift-CZMQWZWP.js} +2 -2
- package/dist/{switch-CTW4PDGI.js → switch-RXEXXIN7.js} +1 -1
- package/dist/{tools-CK6TG3YA.js → tools-BZUAEUSQ.js} +1 -1
- package/package.json +1 -1
- package/dist/doctor-G37LCXG5.js +0 -2
|
@@ -12,7 +12,7 @@ ${s}
|
|
|
12
12
|
`));return}let p=[];if(n.client)if(n.client==="all")p=c;else {let o=g.find(f=>f.id===n.client);if(!o){console.log(e.red(`Unknown client: ${n.client}`)),console.log(e.gray(`Available: ${g.map(f=>f.id).join(", ")}
|
|
13
13
|
`));return}o.detected||(console.log(e.yellow(`${o.name} not detected on this system.`)),console.log(e.gray(`Proceeding anyway...
|
|
14
14
|
`))),p=[o];}else if(c.length===1)p=c;else {console.log(e.cyan(`Multiple clients detected. Specify which to configure:
|
|
15
|
-
`)),console.log(e.white(" paradigm mcp setup --client=cursor")),console.log(e.white(" paradigm mcp setup --client=claude-desktop")),console.log(e.white(" paradigm mcp setup --client=all")),console.log();return}for(let o of p){t.start(`Configuring ${o.name}...`);let f=a$1.operation(`mcp-setup-${o.id}`).start("Configuring MCP",{client:o.id}),u=R(o,s,r),d=O(o,u,n.force||false);d.success?(t.succeed(`${o.name} configured`),f.success("MCP configured",{client:o.id,path:o.configPath}),console.log(e.gray(` \u2192 ${o.configPath}`)),o.configType==="project"&&n.gitignore!==false&&F(o.configPath)&&(console.log(e.gray(" \u2192 Added to .gitignore")),a$1.component("gitignore").debug("Added MCP config to .gitignore",{path:o.configPath}))):(t.fail(`Failed to configure ${o.name}: ${d.message}`),f.error("MCP configuration failed",{client:o.id,message:d.message}));}if(console.log(e.green(`
|
|
15
|
+
`)),console.log(e.white(" paradigm mcp setup --client=cursor")),console.log(e.white(" paradigm mcp setup --client=claude-desktop")),console.log(e.white(" paradigm mcp setup --client=all")),console.log();return}for(let o of p){t.start(`Configuring ${o.name}...`);let f=a$1.operation(`mcp-setup-${o.id}`).start("Configuring MCP",{client:o.id}),u=R(o,s,r),d=O(o,u,n.force||false);d.success?(t.succeed(`${o.name} configured`),f.success("MCP configured",{client:o.id,path:o.configPath}),console.log(e.gray(` \u2192 ${o.configPath}`)),o.configType==="project"&&n.gitignore!==false&&F(o.configPath)&&(console.log(e.gray(" \u2192 Added to .gitignore")),a$1.component("gitignore").debug("Added MCP config to .gitignore",{path:o.configPath}))):(t.fail(`Failed to configure ${o.name}: ${d.message}`),console.log(e.gray(" Troubleshooting: .paradigm/docs/troubleshooting.md")),f.error("MCP configuration failed",{client:o.id,message:d.message}));}if(console.log(e.green(`
|
|
16
16
|
\u2713 MCP setup complete!
|
|
17
17
|
`)),console.log(e.cyan("Next steps:")),[...new Set(p.map(o=>o.instructions))].forEach(o=>{console.log(e.gray(` \u2022 ${o}`));}),console.log(e.gray(`
|
|
18
18
|
Then try asking your AI:`)),console.log(e.white(` "What features are in the ${r} project?"`)),console.log(e.white(' "What would break if I changed @feature-name?"')),console.log(),n.json){let o={project:r,path:s,configured:p.map(f=>({client:f.id,name:f.name,configPath:f.configPath,configType:f.configType}))};console.log(JSON.stringify(o,null,2));}}async function z(n){console.log(e.blue(`
|
|
@@ -1,12 +1,52 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {b}from'./chunk-LBQBWIEX.js';import {a as a$2,g as g$1,h,d as d$1,f}from'./chunk-UIKLE3WD.js';import {g}from'./chunk-T6IDXUUA.js';import {c}from'./chunk-JIXHEBGK.js';import {c as c$1,d,e}from'./chunk-DOCDDDTD.js';import {a as a$1}from'./chunk-LKAT7IAK.js';import*as
|
|
3
|
-
`).length}catch{return 0}}function
|
|
4
|
-
`)}function G(){let s=fileURLToPath(import.meta.url),
|
|
2
|
+
import {b as b$1}from'./chunk-LBQBWIEX.js';import {a as a$2,g as g$1,h,d as d$1,f}from'./chunk-UIKLE3WD.js';import {g}from'./chunk-T6IDXUUA.js';import {c}from'./chunk-JIXHEBGK.js';import {c as c$1,d,e}from'./chunk-DOCDDDTD.js';import {a as a$1}from'./chunk-LKAT7IAK.js';import*as i from'fs';import*as a from'path';import {fileURLToPath}from'url';import t from'chalk';import q from'ora';function b(s){try{return i.readFileSync(s,"utf8").split(`
|
|
3
|
+
`).length}catch{return 0}}function _(s){let o=g$1(s);if(o&&f[o])return f[o].name;let e=a$2(s);if(e!=="backend")return e.charAt(0).toUpperCase()+e.slice(1)}function U(s){let o=[],e=0,n={name:"cursor",displayName:"Cursor"},g=a.join(s,".cursorrules"),r=a.join(s,".cursor","rules");if(i.existsSync(g)){let l=b(g);n.legacy={path:".cursorrules",lines:l,type:"legacy"},e+=l;}if(i.existsSync(r)){let l=i.readdirSync(r).filter(m=>m.endsWith(".mdc"));l.length>0&&(n.modern=l.map(m=>{let x=a.join(r,m),j=b(x);return e+=j,{path:`.cursor/rules/${m}`,lines:j,type:"modern"}}));}(n.legacy||n.modern)&&o.push(n);let u={name:"copilot",displayName:"GitHub Copilot"},c=a.join(s,".github","copilot-instructions.md"),f=a.join(s,".github","instructions");if(i.existsSync(c)){let l=b(c);u.legacy={path:".github/copilot-instructions.md",lines:l,type:"legacy"},e+=l;}if(i.existsSync(f)){let l=i.readdirSync(f).filter(m=>m.endsWith(".md"));l.length>0&&(u.modern=l.map(m=>{let x=a.join(f,m),j=b(x);return e+=j,{path:`.github/instructions/${m}`,lines:j,type:"modern"}}));}(u.legacy||u.modern)&&o.push(u);let h=a.join(s,".windsurfrules");if(i.existsSync(h)){let l=b(h);o.push({name:"windsurf",displayName:"Windsurf",legacy:{path:".windsurfrules",lines:l,type:"legacy"}}),e+=l;}let w=a.join(s,"CLAUDE.md");if(i.existsSync(w)){let l=b(w);o.push({name:"claude",displayName:"Claude",legacy:{path:"CLAUDE.md",lines:l,type:"legacy"}}),e+=l;}let p=a.join(s,"AGENTS.md");if(i.existsSync(p)){let l=b(p);o.push({name:"agents",displayName:"AGENTS.md",legacy:{path:"AGENTS.md",lines:l,type:"legacy"}}),e+=l;}let y=a$2(s),d=g$1(s);return {ides:o,hasExisting:o.length>0,totalLines:e,projectType:_(s),discipline:y!=="backend"?y:void 0,stack:d||void 0}}function O(s,o){let e=[];e.push("# Migrate IDE Instructions to Paradigm Format"),e.push(""),e.push("## Overview"),e.push(""),e.push(`Migrate existing IDE instruction files for **${o}** to Paradigm's managed, scoped format.`),e.push(""),e.push("## Source Files Found"),e.push("");for(let n of s.ides)if(n.legacy&&e.push(`- \`${n.legacy.path}\` (${n.legacy.lines} lines) - ${n.displayName} ${n.legacy.type} format`),n.modern)for(let g of n.modern)e.push(`- \`${g.path}\` (${g.lines} lines) - ${n.displayName} modern format`);return e.push(""),s.ides.some(n=>n.name==="cursor")&&(e.push("## Cursor Migration \u2192 `.cursor/rules/*.mdc`"),e.push(""),e.push("Split the existing `.cursorrules` into scoped `.mdc` files with YAML frontmatter:"),e.push(""),e.push("### File Structure"),e.push(""),e.push("```"),e.push(".cursor/rules/"),e.push("\u251C\u2500\u2500 project-core.mdc # Always applies - project overview, architecture"),e.push("\u251C\u2500\u2500 code-style.mdc # globs: **/*.{ts,tsx,js,jsx} - naming, formatting"),e.push("\u251C\u2500\u2500 components.mdc # globs: **/components/**/* - component patterns"),e.push("\u251C\u2500\u2500 api-patterns.mdc # globs: **/api/**/* - API conventions"),e.push("\u251C\u2500\u2500 testing.mdc # globs: **/*.test.* - testing guidelines"),e.push("\u2514\u2500\u2500 custom.mdc # Any project-specific rules"),e.push("```"),e.push(""),e.push("### Frontmatter Format"),e.push(""),e.push("```yaml"),e.push("---"),e.push("description: Brief description of what these rules cover"),e.push('globs: "**/*.ts" # File pattern (OR use alwaysApply)'),e.push("alwaysApply: true # Apply to all files (OR use globs)"),e.push("---"),e.push("```"),e.push("")),s.ides.some(n=>n.name==="copilot")&&(e.push("## Copilot Migration \u2192 `.github/instructions/*.instructions.md`"),e.push(""),e.push("Split into scoped instruction files with `applyTo` frontmatter:"),e.push(""),e.push("### File Structure"),e.push(""),e.push("```"),e.push(".github/"),e.push("\u251C\u2500\u2500 copilot-instructions.md # Always applies - core rules"),e.push("\u2514\u2500\u2500 instructions/"),e.push(" \u251C\u2500\u2500 typescript.instructions.md # applyTo: **/*.ts"),e.push(" \u251C\u2500\u2500 react.instructions.md # applyTo: **/*.tsx"),e.push(" \u251C\u2500\u2500 api.instructions.md # applyTo: **/api/**"),e.push(" \u2514\u2500\u2500 testing.instructions.md # applyTo: **/*.test.*"),e.push("```"),e.push(""),e.push("### Frontmatter Format"),e.push(""),e.push("```yaml"),e.push("---"),e.push('applyTo: "**/*.ts"'),e.push("---"),e.push("```"),e.push("")),e.push("## Migration Steps"),e.push(""),e.push("1. **Read each source file** and identify logical sections:"),e.push(" - Project overview / architecture"),e.push(" - Code style / naming conventions"),e.push(" - Language-specific patterns"),e.push(" - Framework-specific rules"),e.push(" - Testing guidelines"),e.push(" - API patterns"),e.push(""),e.push("2. **Create scoped target files** with appropriate frontmatter"),e.push(""),e.push("3. **Backup originals** by renaming to `.bak`:"),e.push(" - `.cursorrules` \u2192 `.cursorrules.bak`"),e.push(" - `.github/copilot-instructions.md` \u2192 `.github/copilot-instructions.md.bak`"),e.push(""),e.push("4. **Verify** the migration by checking that rules apply correctly"),e.push(""),e.push("## Tips"),e.push(""),e.push("- **Prefer specific globs** over `alwaysApply` when possible"),e.push("- **Keep files focused** - one concern per file"),e.push("- **Use descriptive names** that indicate the scope"),e.push("- **Paradigm will generate its own rules** - keep custom rules separate"),e.push("- After migration, run `paradigm sync` to add Paradigm-managed rules"),e.push(""),e.push("---"),e.push(""),e.push("*Generated by `paradigm init --migrate`*"),e.join(`
|
|
4
|
+
`)}function G(){let s=fileURLToPath(import.meta.url),o=a.dirname(s),e=[a.join(o,"..","..","templates","paradigm"),a.join(o,"..","templates","paradigm"),a.join(o,"..","..","src","templates","paradigm")];for(let n of e)if(i.existsSync(n))return n;return a.join(o,"..","templates","paradigm")}var A={directories:["prompts"],files:["echoes.yaml","docs/commands.md","docs/queries.md","specs/disciplines.md","specs/scan.md","specs/context-tracking.md"]};function z(s){for(let o of A.directories)if(s===o||s.startsWith(o+"/"))return true;return !!A.files.includes(s)}function N(s,o,e,n=""){i.existsSync(o)||i.mkdirSync(o,{recursive:true});let g=i.readdirSync(s,{withFileTypes:true});for(let r of g){let u=a.join(s,r.name),c=a.join(o,r.name),f=n?`${n}/${r.name}`:r.name;if(!z(f))if(r.isDirectory())N(u,c,e,f);else {let h=i.readFileSync(u,"utf8");h=h.replace(/\{\{PROJECT_NAME\}\}/g,e),i.writeFileSync(c,h,"utf8");}}}function M(s,o){if(console.log(t.blue(`
|
|
5
5
|
\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(t.blue("\u2502")+t.white.bold(" Welcome to Paradigm ")+t.blue("\u2502")),console.log(t.blue("\u2502")+t.gray(" Let's set up your project ")+t.blue("\u2502")),console.log(t.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
|
|
6
|
-
`)),console.log(t.white(" \u{1F4C1} Project: ")+t.cyan(
|
|
7
|
-
`));for(let e of s.ides)if(e.legacy&&console.log(t.green(" \u2713 ")+t.white(e.legacy.path)+t.gray(` (${e.legacy.lines} lines)`)),e.modern)for(let n of e.modern)console.log(t.green(" \u2713 ")+t.white(n.path)+t.gray(` (${n.lines} lines)`));console.log(""),console.log(t.gray(` Total: ${s.totalLines} lines of existing instructions`));}else console.log(t.gray(" \u{1F4C4} No existing IDE instructions found"));console.log(""),console.log(t.gray(" \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500")),console.log("");}function B(s,
|
|
6
|
+
`)),console.log(t.white(" \u{1F4C1} Project: ")+t.cyan(o)+(s.projectType?t.gray(` (${s.projectType} detected)`):"")),s.discipline&&console.log(t.white(" \u{1F3AF} Discipline: ")+t.cyan(s.discipline)+(s.stack?t.gray(` \u2192 stack: ${s.stack}`):"")),console.log(""),s.hasExisting){console.log(t.white(` \u{1F4C4} Found existing IDE instructions:
|
|
7
|
+
`));for(let e of s.ides)if(e.legacy&&console.log(t.green(" \u2713 ")+t.white(e.legacy.path)+t.gray(` (${e.legacy.lines} lines)`)),e.modern)for(let n of e.modern)console.log(t.green(" \u2713 ")+t.white(n.path)+t.gray(` (${n.lines} lines)`));console.log(""),console.log(t.gray(` Total: ${s.totalLines} lines of existing instructions`));}else console.log(t.gray(" \u{1F4C4} No existing IDE instructions found"));console.log(""),console.log(t.gray(" \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500")),console.log("");}function B(s,o){let n={cursor:".cursor/rules/",copilot:".github/instructions/",windsurf:".windsurfrules",claude:"CLAUDE.md"}[s]||".cursor/rules/";console.log(t.blue(`
|
|
8
8
|
\u2728 Paradigm initialized!
|
|
9
|
-
`)),console.log(t.white(" Created:")),console.log(t.gray(" \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500")),console.log(t.white(" \u{1F4C1} .paradigm/")),console.log(t.gray(" \u251C\u2500\u2500 config.yaml Configuration")),console.log(t.gray(" \u251C\u2500\u2500 specs/ Logger, symbols, context")),console.log(t.gray(" \u2514\u2500\u2500 docs/ Patterns, troubleshooting")),console.log(t.white(" \u{1F4C4} .premise Project overview")),console.log(t.white(" \u{1F4C4} .purpose Feature context")),console.log(t.white(` \u{1F4C4} ${n.padEnd(20)} IDE instructions`)),console.log(""),console.log(t.gray(" Reference content (prompts, commands, etc.) available via MCP")),
|
|
9
|
+
`)),console.log(t.white(" Created:")),console.log(t.gray(" \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500")),console.log(t.white(" \u{1F4C1} .paradigm/")),console.log(t.gray(" \u251C\u2500\u2500 config.yaml Configuration")),console.log(t.gray(" \u251C\u2500\u2500 specs/ Logger, symbols, context")),console.log(t.gray(" \u2514\u2500\u2500 docs/ Patterns, troubleshooting")),console.log(t.white(" \u{1F4C4} .premise Project overview")),console.log(t.white(" \u{1F4C4} .purpose Feature context")),console.log(t.white(` \u{1F4C4} ${n.padEnd(20)} IDE instructions`)),console.log(""),console.log(t.gray(" Reference content (prompts, commands, etc.) available via MCP")),o.hasExisting&&(console.log(""),console.log(t.yellow(" \u26A0 Your existing IDE files were preserved.")),console.log(t.gray(" Run `paradigm init --migrate` to get a migration prompt."))),console.log(""),console.log(t.white(" Next steps:")),console.log(t.gray(" \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500")),console.log(t.white(" 1. ")+t.gray("Review ")+t.cyan(".paradigm/config.yaml")),console.log(t.white(" 2. ")+t.gray("Edit ")+t.cyan(".purpose")+t.gray(" to define your features")),console.log(t.white(" 3. ")+t.gray("Run ")+t.cyan("paradigm beacon")+t.gray(" to generate AI context")),console.log(t.white(" 4. ")+t.gray("Run ")+t.cyan("paradigm doctor")+t.gray(" to verify setup")),console.log(t.white(" 5. ")+t.gray("Run ")+t.cyan("paradigm visualize")+t.gray(" to see your project")),console.log(""),console.log(t.gray(" Maintenance cost: ~5 min per feature to update .purpose files.")),console.log(t.gray(" What you get: agents with accurate context, ripple analysis, and")),console.log(t.gray(" drift detection \u2014 without re-explaining your project every session.")),console.log("");}function V(s,o,e,n){let g=a.join(s,".paradigm","init-report.md"),r=new Date().toISOString().split("T")[0],u=[];try{let h=i.readdirSync(s,{withFileTypes:!0});for(let p of h)p.name===".purpose"&&u.push(".purpose");let w=a.join(s,".paradigm");i.existsSync(w)&&u.push(".paradigm/ (config, specs, docs)");}catch{}let c=n.hasExisting?"\n> **Note:** Existing IDE files were preserved. Run `paradigm init --migrate` to convert them.\n":"",f=`# Paradigm Init Report \u2014 ${o}
|
|
10
|
+
|
|
11
|
+
**Date:** ${r}
|
|
12
|
+
**IDE:** ${e}
|
|
13
|
+
|
|
14
|
+
${c}
|
|
15
|
+
## What Was Created
|
|
16
|
+
|
|
17
|
+
- \`.paradigm/config.yaml\` \u2014 project configuration
|
|
18
|
+
- \`.paradigm/specs/\` \u2014 symbol and logger specifications
|
|
19
|
+
- \`.paradigm/docs/\` \u2014 command reference and troubleshooting
|
|
20
|
+
- \`.premise\` \u2014 project overview (edit to describe your project)
|
|
21
|
+
- \`.purpose\` \u2014 root feature context (edit to register your components)
|
|
22
|
+
- IDE instructions for **${e}**
|
|
23
|
+
|
|
24
|
+
## What You Get
|
|
25
|
+
|
|
26
|
+
| Tool | What it does |
|
|
27
|
+
|------|-------------|
|
|
28
|
+
| \`paradigm_navigate\` | Orients agents to your project structure |
|
|
29
|
+
| \`paradigm_ripple\` | Shows what breaks when you change a symbol |
|
|
30
|
+
| \`paradigm_status\` | Health check for context coverage |
|
|
31
|
+
| \`paradigm_aspect_check\` | Detects undocumented side effects |
|
|
32
|
+
| 30+ more | Full list: \`paradigm docs\` |
|
|
33
|
+
|
|
34
|
+
## Maintenance Contract
|
|
35
|
+
|
|
36
|
+
Each new feature costs ~5 minutes of \`.purpose\` file maintenance.
|
|
37
|
+
What you get: agents with accurate context, ripple analysis, and drift detection \u2014 without re-explaining your project every session.
|
|
38
|
+
|
|
39
|
+
## Next Steps
|
|
40
|
+
|
|
41
|
+
1. Edit \`.purpose\` \u2014 add your first component
|
|
42
|
+
2. Run \`paradigm scan\` \u2014 build the symbol index
|
|
43
|
+
3. Run \`paradigm beacon\` \u2014 generate AI orientation context
|
|
44
|
+
4. Run \`paradigm doctor\` \u2014 verify setup
|
|
45
|
+
5. Start a Claude Code session \u2014 the MCP tools and hooks are ready
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
*Generated by \`paradigm init\` \xB7 ${r}*
|
|
49
|
+
`;try{i.writeFileSync(g,f,"utf8"),console.log(t.gray(" Report: .paradigm/init-report.md"));}catch{}}async function oe(s){let o=process.cwd(),e$1=s.name||a.basename(o),n=q(),g$1=a$1.command("init").start("Initializing Paradigm",{project:e$1,quick:!!s.quick}),r=U(o);if(a$1.operation("detect-ide").debug("IDE detection complete",{hasExisting:r.hasExisting}),s.migrate){if(!r.hasExisting){console.log(t.yellow(`
|
|
10
50
|
No existing IDE instruction files found.
|
|
11
51
|
`)),console.log(t.gray(" Run `paradigm init` to create a fresh setup.\n"));return}console.log(t.blue(`
|
|
12
52
|
Migration Prompt
|
|
@@ -14,30 +54,30 @@ import {b}from'./chunk-LBQBWIEX.js';import {a as a$2,g as g$1,h,d as d$1,f}from'
|
|
|
14
54
|
`)),console.log(t.gray(` \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550
|
|
15
55
|
`)),console.log(O(r,e$1)),console.log(t.gray(`
|
|
16
56
|
\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550
|
|
17
|
-
`));return}if(s.dryRun){
|
|
18
|
-
`));return}s.quick||(
|
|
57
|
+
`));return}if(s.dryRun){M(r,e$1),console.log(t.white(" Would create (dry run):")),console.log(t.gray(" \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500")),console.log(t.cyan(" \u{1F4C1} .paradigm/")),console.log(t.cyan(" \u251C\u2500\u2500 config.yaml")),console.log(t.cyan(" \u251C\u2500\u2500 specs/")),console.log(t.cyan(" \u2514\u2500\u2500 docs/")),console.log(t.cyan(" \u{1F4C4} .premise")),console.log(t.cyan(" \u{1F4C4} .purpose")),console.log(t.cyan(" \u{1F4C1} .cursor/rules/*.mdc")),console.log(""),console.log(t.gray(" Reference content (prompts, commands, etc.) served via MCP")),console.log(t.gray(` Run without --dry-run to create these files.
|
|
58
|
+
`));return}s.quick||(M(r,e$1),r.hasExisting&&!s.force&&(console.log(t.white(` What would you like to do?
|
|
19
59
|
`)),console.log(t.cyan(" paradigm init --migrate")),console.log(t.gray(` Get an AI-ready prompt to convert your existing rules
|
|
20
60
|
`)),console.log(t.cyan(" paradigm init --force")),console.log(t.gray(` Create .paradigm/ alongside existing files
|
|
21
61
|
`)),console.log(t.cyan(" paradigm init --dry-run")),console.log(t.gray(` Preview what would be created
|
|
22
|
-
`))));let u=G(),
|
|
23
|
-
`));return}}n.start("Creating .paradigm/ directory...");try{
|
|
62
|
+
`))));let u=G(),c$2=a.join(o,".paradigm");if(i.existsSync(c$2)){let d=i.statSync(c$2);if(d.isFile()){if(!s.force){console.log(t.yellow(" \u26A0 Legacy .paradigm file found.")),console.log(t.gray(" Run `paradigm upgrade --all` to migrate.\n"));return}i.unlinkSync(c$2);}else if(d.isDirectory()&&!s.force){console.log(t.yellow(` \u26A0 .paradigm/ already exists (use --force to overwrite)
|
|
63
|
+
`));return}}n.start("Creating .paradigm/ directory...");try{i.existsSync(c$2)||i.mkdirSync(c$2,{recursive:!0}),i.existsSync(u)?(N(u,c$2,e$1),i.existsSync(a.join(c$2,"fixtures.yaml"))||L(c$2),Y(c$2,o,s.stack),n.succeed(t.green(".paradigm/ created"))):(n.warn(t.yellow("Templates not found, creating minimal structure")),H(c$2,e$1));}catch(d){n.fail(t.red(`Failed: ${d.message}`));return}let f=a.join(o,".premise");(!i.existsSync(f)||s.force)&&(n.start("Creating .premise..."),i.writeFileSync(f,g(e$1)),n.succeed(t.green(".premise created")));let h=a.join(o,".purpose");(!i.existsSync(h)||s.force)&&(n.start("Creating .purpose..."),i.writeFileSync(h,c()),n.succeed(t.green(".purpose created")));let w=a.join(o,"portal.yaml");i.existsSync(w)||(console.log(t.gray(" \u25CB No portal.yaml (optional - create manually if you need gate/auth definitions)")),console.log(t.gray(" See: https://github.com/a-company/paradigm/blob/main/docs/guides/portals.md")));let p;s.ide?p=["cursor","copilot","windsurf","claude"].includes(s.ide.toLowerCase())?s.ide.toLowerCase():"cursor":(n.start("Detecting IDE..."),p=c$1(o).detected||"cursor",n.succeed(`Using ${t.cyan(p)}`));let y=d(o);if(y){n.start("Generating IDE instructions...");let d=e(o,p,y,true);d.success?n.succeed(t.green(d.message||"IDE instructions generated")):n.warn(t.yellow(d.message));}if(!s.quick){n.start("Creating scan index for MCP tools...");try{await b$1(o,{quiet:!0}),n.succeed(t.green("Scan index created"));}catch(d){n.warn(t.yellow("Could not create scan index: "+d.message)),console.log(t.gray(" Run `paradigm scan` manually after adding .purpose files"));}}B(p,r),V(o,e$1,p,r),g$1.success("Paradigm initialized",{project:e$1,ide:p});}function Y(s,o,e){let n=a.join(s,"config.yaml");if(!i.existsSync(n))return;let g=a$2(o);if(g==="auto")return;let r=i.readFileSync(n,"utf8");r=r.replace(/^discipline:\s*auto\b.*$/m,`discipline: ${g}`);let u=e||g$1(o),c=u?h(u):d$1(g);if(!c){let y=function(){let d=Object.entries(p.symbolMapping).map(([m,x])=>` "${m}": "${x}"`).join(`
|
|
24
64
|
`);r=r.replace(/ symbol-mapping:\n(?:(?: .*| *)\n)*/,` symbol-mapping:
|
|
25
|
-
${
|
|
26
|
-
`);let
|
|
65
|
+
${d}
|
|
66
|
+
`);let l=p.purposeRequired.map(m=>` - pattern: "${m.pattern}"
|
|
27
67
|
depth: ${m.depth}`).join(`
|
|
28
68
|
`);r=r.replace(/purpose-required:\n(?: - pattern:.*\n depth:.*\n)*/,`purpose-required:
|
|
29
|
-
${
|
|
30
|
-
`),
|
|
31
|
-
stack: ${u}`));let f=Object.entries(
|
|
69
|
+
${l}
|
|
70
|
+
`),i.writeFileSync(n,r,"utf8");};let p=d$1(g);y();return}u&&(r=r.replace(/^(discipline:\s*.+)$/m,`$1
|
|
71
|
+
stack: ${u}`));let f=Object.entries(c.symbolMapping).map(([p,y])=>` "${p}": "${y}"`).join(`
|
|
32
72
|
`);r=r.replace(/ symbol-mapping:\n(?:(?: .*| *)\n)*/,` symbol-mapping:
|
|
33
73
|
${f}
|
|
34
|
-
`);let h$1=
|
|
74
|
+
`);let h$1=c.purposeRequired.map(p=>` - pattern: "${p.pattern}"
|
|
35
75
|
depth: ${p.depth}`).join(`
|
|
36
76
|
`);r=r.replace(/purpose-required:\n(?: - pattern:.*\n depth:.*\n)*/,`purpose-required:
|
|
37
77
|
${h$1}
|
|
38
|
-
`),
|
|
78
|
+
`),i.writeFileSync(n,r,"utf8");}function H(s,o){i.mkdirSync(a.join(s,"specs"),{recursive:true}),i.mkdirSync(a.join(s,"docs"),{recursive:true}),i.mkdirSync(a.join(s,"tasks"),{recursive:true}),i.mkdirSync(a.join(s,"lore"),{recursive:true});let e=`# Paradigm Configuration
|
|
39
79
|
version: "1.0"
|
|
40
|
-
project: "${
|
|
80
|
+
project: "${o}"
|
|
41
81
|
|
|
42
82
|
agent-guidelines:
|
|
43
83
|
overview: |
|
|
@@ -85,7 +125,7 @@ conventions:
|
|
|
85
125
|
- "Reference related items using symbol prefixes (# $ ^ ! ~)"
|
|
86
126
|
- "Update .purpose files when changing feature behavior"
|
|
87
127
|
- "ALWAYS use Paradigm logger, NEVER raw console.log/print"
|
|
88
|
-
`;
|
|
128
|
+
`;i.writeFileSync(a.join(s,"config.yaml"),e,"utf8"),L(s);}function L(s){i.writeFileSync(a.join(s,"fixtures.yaml"),`# Test Fixtures for Flow Validation
|
|
89
129
|
# Use with paradigm_test_fixtures MCP tool
|
|
90
130
|
version: "1.0"
|
|
91
131
|
|
|
@@ -131,4 +171,4 @@ payloads:
|
|
|
131
171
|
updateTask:
|
|
132
172
|
title: "Updated Task"
|
|
133
173
|
status: "in-progress"
|
|
134
|
-
`,"utf8");}export{
|
|
174
|
+
`,"utf8");}export{oe as a};
|
|
@@ -3,9 +3,9 @@ import {c,a as a$1}from'./chunk-DOCDDDTD.js';import {e as e$1}from'./chunk-JQKKV
|
|
|
3
3
|
\u{1FA7A} Paradigm Doctor
|
|
4
4
|
`)),console.log(N?l.gray(`Running context audit checks...
|
|
5
5
|
`):l.gray(`Checking Paradigm setup...
|
|
6
|
-
`)));let I=a.command("doctor").start("Running health checks");if(!N){let E=function(t){let a=[];try{let n=e.readdirSync(t,{withFileTypes:!0});for(let r of n){if(r.name==="node_modules"||r.name==="dist"||r.name===".git")continue;let f=i.join(t,r.name);r.isDirectory()?a.push(...E(f)):r.name===".purpose"&&a.push(f);}}catch{}return a};let o=i.join(p,".paradigm");if(e.existsSync(o))if(e.statSync(o).isFile())s.push({name:".paradigm",status:"warn",message:"Legacy file format (should be directory)",fix:"paradigm upgrade --all"});else {s.push({name:".paradigm/",status:"ok",message:"Directory exists"});let a=i.join(o,"config.yaml");if(e.existsSync(a))try{let g=e.readFileSync(a,"utf8");e$1(g),s.push({name:".paradigm/config.yaml",status:"ok",message:"Valid YAML"});}catch(g){s.push({name:".paradigm/config.yaml",status:"error",message:`Invalid YAML: ${g.message}`,fix:"Check YAML syntax"});}else s.push({name:".paradigm/config.yaml",status:"missing",message:"Config file not found",fix:"paradigm init --force"});let n=["logger.md","scan.md","symbols.md"],r=i.join(o,"specs");if(e.existsSync(r))for(let g of n){let x=i.join(r,g);e.existsSync(x)?s.push({name:`.paradigm/specs/${g}`,status:"ok",message:"Present"}):s.push({name:`.paradigm/specs/${g}`,status:"missing",message:"Spec file not found",fix:"paradigm upgrade --all"});}else s.push({name:".paradigm/specs/",status:"missing",message:"Specs directory not found",fix:"paradigm upgrade --all"});let f=i.join(o,"docs");e.existsSync(f)?s.push({name:".paradigm/docs/",status:"ok",message:"Directory exists"}):s.push({name:".paradigm/docs/",status:"missing",message:"Docs directory not found",fix:"paradigm upgrade --all"});let h=i.join(o,"prompts");e.existsSync(h)?s.push({name:".paradigm/prompts/",status:"ok",message:"Directory exists"}):s.push({name:".paradigm/prompts/",status:"missing",message:"Prompts directory not found",fix:"paradigm upgrade --all"});let u=["specs","implementation-guides","prompts","decisions"],d=[];for(let g of u){let x=i.join(o,g);if(e.existsSync(x)&&e.statSync(x).isDirectory()){let k=i.join(x,".index.yaml");e.existsSync(k)||d.push(`.paradigm/${g}/`);}}d.length>0?s.push({name:"Docs-class indexes",status:"warn",message:`${d.length} director${d.length===1?"y":"ies"} missing .index.yaml: ${d.join(", ")}`,fix:"paradigm docs scaffold"}):s.push({name:"Docs-class indexes",status:"ok",message:"All docs-class directories have .index.yaml"});let y=i.join(o,"scan-index.json"),F=i.join(p,".paradigm-scan-index.json");if(e.existsSync(y)){let g=e.statSync(y),x=Date.now()-g.mtime.getTime(),k=Math.floor(x/(1e3*60*60));k>24?s.push({name:".paradigm/scan-index.json",status:"warn",message:`Stale (${k} hours old)`,fix:"paradigm index"}):s.push({name:".paradigm/scan-index.json",status:"ok",message:k>0?`${k} hours old`:"Fresh"});}else e.existsSync(F)?s.push({name:"scan-index",status:"warn",message:"Using legacy location",fix:"paradigm index"}):s.push({name:".paradigm/scan-index.json",status:"missing",message:"Not generated",fix:"paradigm index"});}else s.push({name:".paradigm/",status:"missing",message:"Not initialized",fix:"paradigm init"});let m=c(p);if(m.detected){let t=a$1(m.detected);if(t){let a=i.join(p,t.outputPath);e.existsSync(a)?s.push({name:t.outputPath,status:"ok",message:`Present (${m.detected})`}):s.push({name:t.outputPath,status:"missing",message:`Not generated for ${m.detected}`,fix:"paradigm sync"});}}let c$1=i.join(p,".premise");e.existsSync(c$1)?s.push({name:".premise",status:"ok",message:"Present"}):s.push({name:".premise",status:"missing",message:"Not found (optional)"});let v=i.join(p,".purpose");e.existsSync(v)?s.push({name:".purpose",status:"ok",message:"Present"}):s.push({name:".purpose",status:"warn",message:"Root .purpose not found",fix:"paradigm init"});let A=i.join(p,".paradigm","config.yaml");if(e.existsSync(A))try{let t=e.readFileSync(A,"utf8"),n=S.load(t)?.["purpose-required"];if(n&&Array.isArray(n)){let r=[];for(let f of n){if(!f.pattern)continue;let{glob:h}=await import('glob'),u=await h(f.pattern,{cwd:p,nodir:!1});for(let d of u){let y=i.join(p,d);try{e.statSync(y).isDirectory()&&!e.existsSync(i.join(y,".purpose"))&&r.push(d);}catch{}}}r.length>0?s.push({name:"Purpose-required",status:"warn",message:`${r.length} director${r.length===1?"y":"ies"} missing .purpose: ${r.join(", ")}`,fix:"Create .purpose files with paradigm_purpose_init + paradigm_purpose_add_component"}):s.push({name:"Purpose-required",status:"ok",message:"All required directories have .purpose files"});}}catch{}let q=/\[NEEDS CLARIFICATION:\s*[^\]]+\]/gi,R=0,Y=E(p);for(let t of Y)try{let n=e.readFileSync(t,"utf8").match(q);n&&(R+=n.length);}catch{}R>0?s.push({name:"Clarification markers",status:"warn",message:`${R} [NEEDS CLARIFICATION] marker${R>1?"s":""} found in .purpose files`,fix:"Resolve open clarification markers before shipping"}):Y.length>0&&s.push({name:"Clarification markers",status:"ok",message:"No unresolved markers"});let L=i.join(p,"portal.yaml");if(e.existsSync(L))try{let t=e.readFileSync(L,"utf8"),a=S.load(t);if(a?.version&&a?.gates){let n=Object.keys(a.gates||{}).length,r=Object.keys(a.routes||{}).length;s.push({name:"portal.yaml",status:"ok",message:`Valid (${n} gates, ${r} routes)`});}else s.push({name:"portal.yaml",status:"warn",message:"Missing version or gates section",fix:'Add version: "1.0" and gates: {} to portal.yaml'});}catch(t){s.push({name:"portal.yaml",status:"error",message:`Invalid YAML: ${t.message}`,fix:"Check YAML syntax in portal.yaml"});}if(e.existsSync(L))try{let{checkPortalCompliance:t,getComplianceSummary:a}=await import('./portal-compliance-4MG5F2GI.js'),n=await t(p),r=a(n);s.push({name:"Portal compliance",status:r.status,message:r.message,fix:r.status!=="ok"?"paradigm portal check":void 0});}catch{}let U=i.join(p,".paradigm","flows.yaml");if(e.existsSync(U))try{let t=e.readFileSync(U,"utf8"),a=S.load(t);if(a?.version&&a?.flows){let n=Object.keys(a.flows||{}).length,r=Object.entries(a.flows||{}).filter(([,f])=>!f?.steps||(f.steps?.length??0)===0);r.length>0?s.push({name:".paradigm/flows.yaml",status:"warn",message:`${n} flows defined, ${r.length} have no steps`,fix:"Add steps to empty flow definitions"}):s.push({name:".paradigm/flows.yaml",status:"ok",message:`Valid (${n} flows)`});}else s.push({name:".paradigm/flows.yaml",status:"warn",message:"Missing version or flows section",fix:'Ensure flows.yaml has version: "1.0" and flows: {}'});}catch(t){s.push({name:".paradigm/flows.yaml",status:"error",message:`Invalid YAML: ${t.message}`,fix:"Check YAML syntax in flows.yaml"});}let H=i.join(p,".paradigm","lore");if(e.existsSync(H))try{let t=e.readdirSync(H).filter(a=>a.endsWith(".yaml"));t.length===0?s.push({name:"Lore entries",status:"warn",message:"Lore directory exists but no entries found",fix:"Record a lore entry: paradigm lore record"}):s.push({name:"Lore entries",status:"ok",message:`${t.length} lore file${t.length>1?"s":""}`});}catch{s.push({name:"Lore entries",status:"warn",message:"Could not read lore directory"});}let G=i.join(p,".paradigm","university");if(e.existsSync(G))try{let t=i.join(G,"content"),a=0,n=0;if(e.existsSync(t))for(let r of ["notes","policies","quizzes","paths"]){let f=i.join(t,r);e.existsSync(f)&&(a+=e.readdirSync(f).filter(h=>h.endsWith(".md")||h.endsWith(".yaml")).length);}if(a===0)s.push({name:"University content",status:"warn",message:"University directory exists but no content found",fix:'Add content: paradigm university add note --title "Getting Started"'});else {let r=i.join(t,"quizzes");if(e.existsSync(r))for(let h of e.readdirSync(r).filter(u=>u.endsWith(".yaml")))try{let u=S.load(e.readFileSync(i.join(r,h),"utf8"));if(u?.questions)for(let d of u.questions)d.choices&&d.correct&&!(d.correct in d.choices)&&n++;}catch{}let f=i.join(t,"paths");if(e.existsSync(f))for(let h of e.readdirSync(f).filter(u=>u.endsWith(".yaml")))try{let u=S.load(e.readFileSync(i.join(f,h),"utf8"));if(u?.steps){for(let d of u.steps)if(d.content&&!d.content.startsWith("plsat:")){let y=!1;for(let F of ["notes","policies","quizzes","paths"]){let g=i.join(t,F);if(e.existsSync(g)&&e.readdirSync(g).some(k=>k.startsWith(d.content))){y=!0;break}}y||n++;}}}catch{}n>0?s.push({name:"University content",status:"warn",message:`${a} items, ${n} issue${n>1?"s":""}`,fix:"Run: paradigm university validate --deep"}):s.push({name:"University content",status:"ok",message:`${a} content item${a>1?"s":""}`});}}catch{s.push({name:"University content",status:"warn",message:"Could not read university directory"});}let _=i.join(p,".claude","hooks.json"),ss=i.join(p,"plugins","paradigm","hooks.json");if(e.existsSync(_)){let t=e.statSync(_),a=Date.now()-t.mtime.getTime(),n=Math.floor(a/(1e3*60*60*24));n>30?s.push({name:"Claude Code hooks",status:"warn",message:`Hooks are ${n} days old \u2014 may be outdated`,fix:"paradigm hooks install"}):s.push({name:"Claude Code hooks",status:"ok",message:n>0?`${n} days old`:"Fresh"});}else e.existsSync(ss)?s.push({name:"Claude Code hooks",status:"ok",message:"Using plugin hooks"}):s.push({name:"Claude Code hooks",status:"missing",message:"No hooks installed",fix:"paradigm hooks install"});let V=i.join(p,".paradigm","habits.yaml");if(e.existsSync(V))try{let t=e.readFileSync(V,"utf8"),a=S.load(t);if(a?.version&&Array.isArray(a?.habits)){let n=a.habits.filter(r=>r.enabled!==!1).length;s.push({name:"Habits config",status:"ok",message:`Valid (${n}/${a.habits.length} enabled)`});}else s.push({name:"Habits config",status:"warn",message:"Missing version or habits array",fix:"Regenerate habits.yaml with paradigm habits init"});}catch(t){s.push({name:"Habits config",status:"error",message:`Invalid YAML: ${t.message}`,fix:"Check YAML syntax in habits.yaml"});}let J=i.join(p,"AGENTS.md");if(e.existsSync(J)){let t=e.statSync(J),a=Date.now()-t.mtime.getTime(),n=Math.floor(a/(1e3*60*60*24));n>60?s.push({name:"AGENTS.md",status:"warn",message:`${n} days since last update \u2014 may be stale`,fix:"paradigm sync"}):s.push({name:"AGENTS.md",status:"ok",message:n>0?`Updated ${n} days ago`:"Fresh"});}}let W=0,z=0,$=0;for(let o of s){let m,c;switch(o.status){case "ok":m="\u2713",c=l.green;break;case "warn":m="\u26A0",c=l.yellow,z++;break;case "error":m="\u2717",c=l.red,W++;break;case "missing":m="\u25CB",c=l.gray,$++;break}if(!w){let v=o.name.padEnd(30);console.log(` ${c(m)} ${v} ${c(o.message)}`),o.fix&&console.log(l.gray(` \u2514\u2500 Fix: ${o.fix}`));}}let{runContextAudit:Z}=await import('./context-audit-XRPT3OU2.js'),M=await Z(p,{quiet:w}),O=0,T=0,C=0;!w&&M.length>0&&(console.log(""),console.log(l.blue(" Context Audit")),console.log(l.gray(" \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500")));for(let o of M){let m,c;switch(o.status){case "ok":m="\u2713",c=l.green;break;case "warn":m="\u26A0",c=l.yellow,T++;break;case "error":m="\u2717",c=l.red,O++;break;case "advisory":m="\u2139",c=l.cyan,C++;break}if(!w){let v=o.check.padEnd(30);if(console.log(` ${c(m)} ${v} ${c(o.message)}`),o.details&&o.details.length>0){let A=o.details.slice(0,5);for(let q of A)console.log(l.gray(` \u2502 ${q}`));o.details.length>5&&console.log(l.gray(` \u2502 ... and ${o.details.length-5} more`));}o.fix&&console.log(l.gray(` \u2514\u2500 Fix: ${o.fix}`));}}let b=W+O,j=z+T,D=b+j+$===0;if(!w)if(console.log(""),D)console.log(l.green(`\u2728 All checks passed!
|
|
7
|
-
`));else {let o=[];
|
|
8
|
-
`),console.log(l.gray(
|
|
6
|
+
`)));let I=a.command("doctor").start("Running health checks");if(!N){let E=function(t){let a=[];try{let n=e.readdirSync(t,{withFileTypes:!0});for(let r of n){if(r.name==="node_modules"||r.name==="dist"||r.name===".git")continue;let f=i.join(t,r.name);r.isDirectory()?a.push(...E(f)):r.name===".purpose"&&a.push(f);}}catch{}return a};let o=i.join(p,".paradigm");if(e.existsSync(o))if(e.statSync(o).isFile())s.push({name:".paradigm",status:"warn",message:"Legacy file format (should be directory)",fix:"paradigm upgrade --all"});else {s.push({name:".paradigm/",status:"ok",message:"Directory exists"});let a=i.join(o,"config.yaml");if(e.existsSync(a))try{let g=e.readFileSync(a,"utf8");e$1(g),s.push({name:".paradigm/config.yaml",status:"ok",message:"Valid YAML"});}catch(g){s.push({name:".paradigm/config.yaml",status:"error",message:`Invalid YAML: ${g.message}`,fix:"Check YAML syntax"});}else s.push({name:".paradigm/config.yaml",status:"missing",message:"Config file not found",fix:"paradigm init --force"});let n=["logger.md","scan.md","symbols.md"],r=i.join(o,"specs");if(e.existsSync(r))for(let g of n){let x=i.join(r,g);e.existsSync(x)?s.push({name:`.paradigm/specs/${g}`,status:"ok",message:"Present"}):s.push({name:`.paradigm/specs/${g}`,status:"missing",message:"Spec file not found",fix:"paradigm upgrade --all"});}else s.push({name:".paradigm/specs/",status:"missing",message:"Specs directory not found",fix:"paradigm upgrade --all"});let f=i.join(o,"docs");e.existsSync(f)?s.push({name:".paradigm/docs/",status:"ok",message:"Directory exists"}):s.push({name:".paradigm/docs/",status:"missing",message:"Docs directory not found",fix:"paradigm upgrade --all"});let h=i.join(o,"prompts");e.existsSync(h)?s.push({name:".paradigm/prompts/",status:"ok",message:"Directory exists"}):s.push({name:".paradigm/prompts/",status:"missing",message:"Prompts directory not found",fix:"paradigm upgrade --all"});let u=["specs","implementation-guides","prompts","decisions"],d=[];for(let g of u){let x=i.join(o,g);if(e.existsSync(x)&&e.statSync(x).isDirectory()){let k=i.join(x,".index.yaml");e.existsSync(k)||d.push(`.paradigm/${g}/`);}}d.length>0?s.push({name:"Docs-class indexes",status:"warn",message:`${d.length} director${d.length===1?"y":"ies"} missing .index.yaml: ${d.join(", ")}`,fix:"paradigm docs scaffold"}):s.push({name:"Docs-class indexes",status:"ok",message:"All docs-class directories have .index.yaml"});let y=i.join(o,"scan-index.json"),F=i.join(p,".paradigm-scan-index.json");if(e.existsSync(y)){let g=e.statSync(y),x=Date.now()-g.mtime.getTime(),k=Math.floor(x/(1e3*60*60));k>24?s.push({name:".paradigm/scan-index.json",status:"warn",message:`Stale (${k} hours old)`,fix:"paradigm index"}):s.push({name:".paradigm/scan-index.json",status:"ok",message:k>0?`${k} hours old`:"Fresh"});}else e.existsSync(F)?s.push({name:"scan-index",status:"warn",message:"Using legacy location",fix:"paradigm index"}):s.push({name:".paradigm/scan-index.json",status:"missing",message:"Not generated",fix:"paradigm index"});}else s.push({name:".paradigm/",status:"missing",message:"Not initialized",fix:"paradigm init"});let m=c(p);if(m.detected){let t=a$1(m.detected);if(t){let a=i.join(p,t.outputPath);e.existsSync(a)?s.push({name:t.outputPath,status:"ok",message:`Present (${m.detected})`}):s.push({name:t.outputPath,status:"missing",message:`Not generated for ${m.detected}`,fix:"paradigm sync"});}}let c$1=i.join(p,".premise");e.existsSync(c$1)?s.push({name:".premise",status:"ok",message:"Present"}):s.push({name:".premise",status:"missing",message:"Not found (optional)"});let v=i.join(p,".purpose");e.existsSync(v)?s.push({name:".purpose",status:"ok",message:"Present"}):s.push({name:".purpose",status:"warn",message:"Root .purpose not found",fix:"paradigm init"});let A=i.join(p,".paradigm","config.yaml");if(e.existsSync(A))try{let t=e.readFileSync(A,"utf8"),n=S.load(t)?.["purpose-required"];if(n&&Array.isArray(n)){let r=[];for(let f of n){if(!f.pattern)continue;let{glob:h}=await import('glob'),u=await h(f.pattern,{cwd:p,nodir:!1});for(let d of u){let y=i.join(p,d);try{e.statSync(y).isDirectory()&&!e.existsSync(i.join(y,".purpose"))&&r.push(d);}catch{}}}r.length>0?s.push({name:"Purpose-required",status:"warn",message:`${r.length} director${r.length===1?"y":"ies"} missing .purpose: ${r.join(", ")}`,fix:"Create .purpose files with paradigm_purpose_init + paradigm_purpose_add_component"}):s.push({name:"Purpose-required",status:"ok",message:"All required directories have .purpose files"});}}catch{}let q=/\[NEEDS CLARIFICATION:\s*[^\]]+\]/gi,R=0,Y=E(p);for(let t of Y)try{let n=e.readFileSync(t,"utf8").match(q);n&&(R+=n.length);}catch{}R>0?s.push({name:"Clarification markers",status:"warn",message:`${R} [NEEDS CLARIFICATION] marker${R>1?"s":""} found in .purpose files`,fix:"Resolve open clarification markers before shipping"}):Y.length>0&&s.push({name:"Clarification markers",status:"ok",message:"No unresolved markers"});let L=i.join(p,"portal.yaml");if(e.existsSync(L))try{let t=e.readFileSync(L,"utf8"),a=S.load(t);if(a?.version&&a?.gates){let n=Object.keys(a.gates||{}).length,r=Object.keys(a.routes||{}).length;s.push({name:"portal.yaml",status:"ok",message:`Valid (${n} gates, ${r} routes)`});}else s.push({name:"portal.yaml",status:"warn",message:"Missing version or gates section",fix:'Add version: "1.0" and gates: {} to portal.yaml'});}catch(t){s.push({name:"portal.yaml",status:"error",message:`Invalid YAML: ${t.message}`,fix:"Check YAML syntax in portal.yaml"});}if(e.existsSync(L))try{let{checkPortalCompliance:t,getComplianceSummary:a}=await import('./portal-compliance-4MG5F2GI.js'),n=await t(p),r=a(n);s.push({name:"Portal compliance",status:r.status,message:r.message,fix:r.status!=="ok"?"paradigm portal check":void 0});}catch{}let U=i.join(p,".paradigm","flows.yaml");if(e.existsSync(U))try{let t=e.readFileSync(U,"utf8"),a=S.load(t);if(a?.version&&a?.flows){let n=Object.keys(a.flows||{}).length,r=Object.entries(a.flows||{}).filter(([,f])=>!f?.steps||(f.steps?.length??0)===0);r.length>0?s.push({name:".paradigm/flows.yaml",status:"warn",message:`${n} flows defined, ${r.length} have no steps`,fix:"Add steps to empty flow definitions"}):s.push({name:".paradigm/flows.yaml",status:"ok",message:`Valid (${n} flows)`});}else s.push({name:".paradigm/flows.yaml",status:"warn",message:"Missing version or flows section",fix:'Ensure flows.yaml has version: "1.0" and flows: {}'});}catch(t){s.push({name:".paradigm/flows.yaml",status:"error",message:`Invalid YAML: ${t.message}`,fix:"Check YAML syntax in flows.yaml"});}let H=i.join(p,".paradigm","lore");if(e.existsSync(H))try{let t=e.readdirSync(H).filter(a=>a.endsWith(".yaml"));t.length===0?s.push({name:"Lore entries",status:"warn",message:"Lore directory exists but no entries found",fix:"Record a lore entry: paradigm lore record"}):s.push({name:"Lore entries",status:"ok",message:`${t.length} lore file${t.length>1?"s":""}`});}catch{s.push({name:"Lore entries",status:"warn",message:"Could not read lore directory"});}let G=i.join(p,".paradigm","university");if(e.existsSync(G))try{let t=i.join(G,"content"),a=0,n=0;if(e.existsSync(t))for(let r of ["notes","policies","quizzes","paths"]){let f=i.join(t,r);e.existsSync(f)&&(a+=e.readdirSync(f).filter(h=>h.endsWith(".md")||h.endsWith(".yaml")).length);}if(a===0)s.push({name:"University content",status:"warn",message:"University directory exists but no content found",fix:'Add content: paradigm university add note --title "Getting Started"'});else {let r=i.join(t,"quizzes");if(e.existsSync(r))for(let h of e.readdirSync(r).filter(u=>u.endsWith(".yaml")))try{let u=S.load(e.readFileSync(i.join(r,h),"utf8"));if(u?.questions)for(let d of u.questions)d.choices&&d.correct&&!(d.correct in d.choices)&&n++;}catch{}let f=i.join(t,"paths");if(e.existsSync(f))for(let h of e.readdirSync(f).filter(u=>u.endsWith(".yaml")))try{let u=S.load(e.readFileSync(i.join(f,h),"utf8"));if(u?.steps){for(let d of u.steps)if(d.content&&!d.content.startsWith("plsat:")){let y=!1;for(let F of ["notes","policies","quizzes","paths"]){let g=i.join(t,F);if(e.existsSync(g)&&e.readdirSync(g).some(k=>k.startsWith(d.content))){y=!0;break}}y||n++;}}}catch{}n>0?s.push({name:"University content",status:"warn",message:`${a} items, ${n} issue${n>1?"s":""}`,fix:"Run: paradigm university validate --deep"}):s.push({name:"University content",status:"ok",message:`${a} content item${a>1?"s":""}`});}}catch{s.push({name:"University content",status:"warn",message:"Could not read university directory"});}let _=i.join(p,".claude","hooks.json"),ss=i.join(p,"plugins","paradigm","hooks.json");if(e.existsSync(_)){let t=e.statSync(_),a=Date.now()-t.mtime.getTime(),n=Math.floor(a/(1e3*60*60*24));n>30?s.push({name:"Claude Code hooks",status:"warn",message:`Hooks are ${n} days old \u2014 may be outdated`,fix:"paradigm hooks install"}):s.push({name:"Claude Code hooks",status:"ok",message:n>0?`${n} days old`:"Fresh"});}else e.existsSync(ss)?s.push({name:"Claude Code hooks",status:"ok",message:"Using plugin hooks"}):s.push({name:"Claude Code hooks",status:"missing",message:"No hooks installed",fix:"paradigm hooks install"});let V=i.join(p,".paradigm","habits.yaml");if(e.existsSync(V))try{let t=e.readFileSync(V,"utf8"),a=S.load(t);if(a?.version&&Array.isArray(a?.habits)){let n=a.habits.filter(r=>r.enabled!==!1).length;s.push({name:"Habits config",status:"ok",message:`Valid (${n}/${a.habits.length} enabled)`});}else s.push({name:"Habits config",status:"warn",message:"Missing version or habits array",fix:"Regenerate habits.yaml with paradigm habits init"});}catch(t){s.push({name:"Habits config",status:"error",message:`Invalid YAML: ${t.message}`,fix:"Check YAML syntax in habits.yaml"});}let J=i.join(p,"AGENTS.md");if(e.existsSync(J)){let t=e.statSync(J),a=Date.now()-t.mtime.getTime(),n=Math.floor(a/(1e3*60*60*24));n>60?s.push({name:"AGENTS.md",status:"warn",message:`${n} days since last update \u2014 may be stale`,fix:"paradigm sync"}):s.push({name:"AGENTS.md",status:"ok",message:n>0?`Updated ${n} days ago`:"Fresh"});}}let T=0,W=0,$=0;for(let o of s){let m,c;switch(o.status){case "ok":m="\u2713",c=l.green;break;case "warn":m="\u26A0",c=l.yellow,W++;break;case "error":m="\u2717",c=l.red,T++;break;case "missing":m="\u25CB",c=l.gray,$++;break}if(!w){let v=o.name.padEnd(30);console.log(` ${c(m)} ${v} ${c(o.message)}`),o.fix&&console.log(l.gray(` \u2514\u2500 Fix: ${o.fix}`));}}let{runContextAudit:Z}=await import('./context-audit-XRPT3OU2.js'),M=await Z(p,{quiet:w}),z=0,O=0,b=0;!w&&M.length>0&&(console.log(""),console.log(l.blue(" Context Audit")),console.log(l.gray(" \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500")));for(let o of M){let m,c;switch(o.status){case "ok":m="\u2713",c=l.green;break;case "warn":m="\u26A0",c=l.yellow,O++;break;case "error":m="\u2717",c=l.red,z++;break;case "advisory":m="\u2139",c=l.cyan,b++;break}if(!w){let v=o.check.padEnd(30);if(console.log(` ${c(m)} ${v} ${c(o.message)}`),o.details&&o.details.length>0){let A=o.details.slice(0,5);for(let q of A)console.log(l.gray(` \u2502 ${q}`));o.details.length>5&&console.log(l.gray(` \u2502 ... and ${o.details.length-5} more`));}o.fix&&console.log(l.gray(` \u2514\u2500 Fix: ${o.fix}`));}}let C=T+z,j=W+O,D=C+j+$===0;if(!w)if(console.log(""),D)console.log(l.green(`\u2728 All checks passed!
|
|
7
|
+
`));else {let o=[];C>0&&o.push(l.red(`${C} error${C>1?"s":""}`)),j>0&&o.push(l.yellow(`${j} warning${j>1?"s":""}`)),$>0&&o.push(l.gray(`${$} missing`)),b>0&&o.push(l.cyan(`${b} advisor${b>1?"ies":"y"}`)),console.log(`${o.join(", ")} found.
|
|
8
|
+
`),console.log(l.gray("Run the suggested commands to fix issues.")),console.log(l.gray(`Troubleshooting guide: .paradigm/docs/troubleshooting.md
|
|
9
9
|
`));}if(!w&&P.explain&&!D)try{let{narrateAllGaps:o}=await import('./gap-narrator-NTXLUI7I.js'),m=[];for(let c of s)c.status!=="ok"&&(c.name===".purpose"||c.name.startsWith("Purpose-required")?m.push({type:"missing-purpose",target:c.name,severity:"improvement"}):c.name===".paradigm/scan-index.json"&&c.status==="warn"?m.push({type:"index-stale",target:c.name,severity:"improvement"}):c.name==="Portal compliance"?m.push({type:"portal-mismatch",target:c.name,severity:c.status==="error"?"blocking":"improvement"}):c.name==="Clarification markers"&&m.push({type:"missing-description",target:c.name,severity:"improvement"}));if(m.length>0){let c=o(m);console.log(l.blue(`
|
|
10
10
|
Gap Narrations (--explain)
|
|
11
|
-
`)),console.log(l.gray(c.narrative)),console.log("");}}catch{}return D?I.success("All health checks passed",{total:s.length+M.length}):I.error("Health checks found issues",{errors:
|
|
11
|
+
`)),console.log(l.gray(c.narrative)),console.log("");}}catch{}return D?I.success("All health checks passed",{total:s.length+M.length}):I.error("Health checks found issues",{errors:C,warnings:j,missing:$,advisories:b}),D}export{rs as a};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import*as e from'fs';import*as r from'path';import*as
|
|
2
|
+
import*as e from'fs';import*as r from'path';import*as S from'os';import {execSync}from'child_process';import o from'chalk';var y=`#!/bin/sh
|
|
3
3
|
# paradigm-common.sh \u2014 Shared compliance checks for Paradigm stop hooks
|
|
4
4
|
# Sourced by claude-code-stop.sh and cursor-stop.sh
|
|
5
5
|
#
|
|
@@ -831,7 +831,7 @@ _compliance_snapshot() {
|
|
|
831
831
|
"$_ts" "$VIOLATION_COUNT" "$_checks" >> "$_dir/compliance-history.jsonl" 2>/dev/null || true
|
|
832
832
|
}
|
|
833
833
|
_compliance_snapshot
|
|
834
|
-
`,
|
|
834
|
+
`,U=`#!/bin/sh
|
|
835
835
|
# Paradigm Claude Code Stop Hook (v2)
|
|
836
836
|
# Validates paradigm compliance before allowing the agent to finish.
|
|
837
837
|
# Installed by: paradigm hooks install --claude-code
|
|
@@ -907,6 +907,7 @@ if [ "$VIOLATION_COUNT" -gt 0 ]; then
|
|
|
907
907
|
echo " 6. paradigm_habits_check \u2014 evaluate habit compliance" >&2
|
|
908
908
|
echo "" >&2
|
|
909
909
|
echo "Tip: Set PARADIGM_AUTO_FIX=1 to auto-fix trivial violations (missing .purpose stubs, missing lore)." >&2
|
|
910
|
+
echo "Help: See .paradigm/docs/troubleshooting.md for step-by-step resolution guides." >&2
|
|
910
911
|
exit 2
|
|
911
912
|
fi
|
|
912
913
|
|
|
@@ -947,11 +948,11 @@ if command -v paradigm >/dev/null 2>&1 && [ -f ".paradigm/events/verdicts.jsonl"
|
|
|
947
948
|
fi
|
|
948
949
|
|
|
949
950
|
exit 0
|
|
950
|
-
`,
|
|
951
|
+
`,D=`#!/bin/sh
|
|
951
952
|
# Legacy afterFileEdit hook \u2014 replaced by paradigm-posttooluse.sh (postToolUse)
|
|
952
953
|
# Kept as a no-op because Claude Code expects the file to exist.
|
|
953
954
|
exit 0
|
|
954
|
-
`,
|
|
955
|
+
`,v=`#!/bin/sh
|
|
955
956
|
# Paradigm Claude Code Pre-Commit Hook
|
|
956
957
|
# Intercepts git commit Bash calls and auto-rebuilds the index.
|
|
957
958
|
# Installed by: paradigm hooks install --claude-code
|
|
@@ -996,7 +997,85 @@ done
|
|
|
996
997
|
|
|
997
998
|
# Never block \u2014 exit 0
|
|
998
999
|
exit 0
|
|
999
|
-
`,
|
|
1000
|
+
`,P=`#!/bin/sh
|
|
1001
|
+
# Paradigm Claude Code PreToolUse \u2014 Navigation Reminder
|
|
1002
|
+
# Fires before Glob/Grep tool calls to inject scan-index context and prompt
|
|
1003
|
+
# paradigm_navigate usage before broad file searches.
|
|
1004
|
+
# Installed by: paradigm hooks install --claude-code
|
|
1005
|
+
#
|
|
1006
|
+
# Hook type: PreToolUse (matcher: Glob|Grep)
|
|
1007
|
+
# Exit 0 = always allows (advisory only \u2014 never blocks)
|
|
1008
|
+
#
|
|
1009
|
+
# Advisory model: lightweight context injection that fires once per session.
|
|
1010
|
+
# Unlike a pure text reminder, this reads the scan-index $meta and surfaces
|
|
1011
|
+
# the symbol counts directly \u2014 agents can act on the context immediately
|
|
1012
|
+
# without a separate tool call.
|
|
1013
|
+
# Uses a session marker (.paradigm/.nav-reminded) to fire at most once.
|
|
1014
|
+
|
|
1015
|
+
# Read JSON from stdin (hook input)
|
|
1016
|
+
INPUT=$(cat)
|
|
1017
|
+
|
|
1018
|
+
# Extract cwd from input
|
|
1019
|
+
if command -v jq >/dev/null 2>&1; then
|
|
1020
|
+
CWD=$(echo "$INPUT" | jq -r '.cwd // empty' 2>/dev/null)
|
|
1021
|
+
else
|
|
1022
|
+
CWD=$(echo "$INPUT" | grep -o '"cwd"[[:space:]]*:[[:space:]]*"[^"]*"' | sed 's/.*"cwd"[[:space:]]*:[[:space:]]*"//' | sed 's/"$//')
|
|
1023
|
+
fi
|
|
1024
|
+
|
|
1025
|
+
if [ -z "$CWD" ]; then
|
|
1026
|
+
CWD="$(pwd)"
|
|
1027
|
+
fi
|
|
1028
|
+
|
|
1029
|
+
# Not a paradigm project \u2014 pass
|
|
1030
|
+
if [ ! -d "$CWD/.paradigm" ]; then
|
|
1031
|
+
exit 0
|
|
1032
|
+
fi
|
|
1033
|
+
|
|
1034
|
+
# Only remind once per session
|
|
1035
|
+
MARKER="$CWD/.paradigm/.nav-reminded"
|
|
1036
|
+
if [ -f "$MARKER" ]; then
|
|
1037
|
+
exit 0
|
|
1038
|
+
fi
|
|
1039
|
+
|
|
1040
|
+
# Extract tool name to check we're in a search/read context
|
|
1041
|
+
if command -v jq >/dev/null 2>&1; then
|
|
1042
|
+
TOOL_NAME=$(echo "$INPUT" | jq -r '.tool_name // empty' 2>/dev/null)
|
|
1043
|
+
else
|
|
1044
|
+
TOOL_NAME=$(echo "$INPUT" | grep -o '"tool_name"[[:space:]]*:[[:space:]]*"[^"]*"' | head -1 | sed 's/.*"tool_name"[[:space:]]*:[[:space:]]*"//' | sed 's/"$//')
|
|
1045
|
+
fi
|
|
1046
|
+
|
|
1047
|
+
# Only fire for broad exploration tools (Glob/Grep) \u2014 not targeted Read calls
|
|
1048
|
+
case "$TOOL_NAME" in
|
|
1049
|
+
Glob|Grep) ;;
|
|
1050
|
+
*) exit 0 ;;
|
|
1051
|
+
esac
|
|
1052
|
+
|
|
1053
|
+
# Mark as reminded so this only fires once per session
|
|
1054
|
+
touch "$MARKER" 2>/dev/null
|
|
1055
|
+
|
|
1056
|
+
# Read scan-index $meta for symbol counts (optional \u2014 graceful fallback)
|
|
1057
|
+
SCAN_INDEX="$CWD/.paradigm/scan-index.json"
|
|
1058
|
+
SYMBOL_SUMMARY=""
|
|
1059
|
+
if [ -f "$SCAN_INDEX" ] && command -v jq >/dev/null 2>&1; then
|
|
1060
|
+
COMP_COUNT=$(jq '(.components // {}) | length' "$SCAN_INDEX" 2>/dev/null)
|
|
1061
|
+
FEAT_COUNT=$(jq '(.features // {}) | length' "$SCAN_INDEX" 2>/dev/null)
|
|
1062
|
+
FLOW_COUNT=$(jq '(.flows // {}) | length' "$SCAN_INDEX" 2>/dev/null)
|
|
1063
|
+
GATE_COUNT=$(jq '(.gates // {}) | length' "$SCAN_INDEX" 2>/dev/null)
|
|
1064
|
+
if [ -n "$COMP_COUNT" ] && [ -n "$FEAT_COUNT" ]; then
|
|
1065
|
+
SYMBOL_SUMMARY=" ($COMP_COUNT components, $FEAT_COUNT features, $FLOW_COUNT flows, $GATE_COUNT gates indexed)"
|
|
1066
|
+
fi
|
|
1067
|
+
fi
|
|
1068
|
+
|
|
1069
|
+
# Emit context injection (non-blocking)
|
|
1070
|
+
echo "" >&2
|
|
1071
|
+
echo "[paradigm] Context available \u2014 use paradigm_navigate before searching.$SYMBOL_SUMMARY" >&2
|
|
1072
|
+
echo " paradigm_navigate({ intent: \\"context\\", task: \\"<your task>\\" })" >&2
|
|
1073
|
+
echo " Returns relevant .purpose files, symbols, and file paths \u2014 skips blind Glob/Grep." >&2
|
|
1074
|
+
echo " Scan index: $SCAN_INDEX" >&2
|
|
1075
|
+
echo " Navigator: $CWD/.paradigm/navigator.yaml" >&2
|
|
1076
|
+
|
|
1077
|
+
exit 0
|
|
1078
|
+
`,b=`#!/bin/sh
|
|
1000
1079
|
# Paradigm Cursor Session Start Hook
|
|
1001
1080
|
# Fires before the agent does anything \u2014 injects additional_context
|
|
1002
1081
|
# that acts as a deterministic system prompt (not subject to context compaction).
|
|
@@ -1096,7 +1175,7 @@ fi
|
|
|
1096
1175
|
printf '{"additional_context":"%s","continue":true}\\n' "$CONTEXT"
|
|
1097
1176
|
|
|
1098
1177
|
exit 0
|
|
1099
|
-
`,
|
|
1178
|
+
`,L=`#!/bin/sh
|
|
1100
1179
|
# Paradigm Cursor Stop Hook (v2)
|
|
1101
1180
|
# Validates paradigm compliance before allowing the agent to finish.
|
|
1102
1181
|
# Installed by: paradigm hooks install --cursor
|
|
@@ -1187,6 +1266,7 @@ if [ "$VIOLATION_COUNT" -gt 0 ]; then
|
|
|
1187
1266
|
echo " 6. paradigm_habits_check \u2014 evaluate habit compliance" >&2
|
|
1188
1267
|
echo "" >&2
|
|
1189
1268
|
echo "Tip: Set PARADIGM_AUTO_FIX=1 to auto-fix trivial violations (missing .purpose stubs, missing lore)." >&2
|
|
1269
|
+
echo "Help: See .paradigm/docs/troubleshooting.md for step-by-step resolution guides." >&2
|
|
1190
1270
|
|
|
1191
1271
|
# Output followup_message JSON to stdout for Cursor's compliance loop.
|
|
1192
1272
|
# Cursor auto-submits this as the next user message, creating a retry loop.
|
|
@@ -1229,11 +1309,11 @@ rm -f ".paradigm/.purpose-paths"
|
|
|
1229
1309
|
rm -f ".paradigm/.orchestrated"
|
|
1230
1310
|
|
|
1231
1311
|
exit 0
|
|
1232
|
-
`,
|
|
1312
|
+
`,w=`#!/bin/sh
|
|
1233
1313
|
# Legacy afterFileEdit hook \u2014 replaced by paradigm-posttooluse.sh (postToolUse)
|
|
1234
1314
|
# Kept as a no-op because Cursor expects the file to exist.
|
|
1235
1315
|
exit 0
|
|
1236
|
-
`,
|
|
1316
|
+
`,x=`#!/bin/sh
|
|
1237
1317
|
# Paradigm Cursor Pre-Commit Hook
|
|
1238
1318
|
# Intercepts git commit shell executions and auto-rebuilds the index.
|
|
1239
1319
|
# Installed by: paradigm hooks install --cursor
|
|
@@ -1278,7 +1358,7 @@ done
|
|
|
1278
1358
|
|
|
1279
1359
|
# Never block \u2014 exit 0
|
|
1280
1360
|
exit 0
|
|
1281
|
-
`,
|
|
1361
|
+
`,M=`#!/bin/sh
|
|
1282
1362
|
# Paradigm Cursor PreToolUse Hook \u2014 Graduated Blocking
|
|
1283
1363
|
# Fires BEFORE the agent calls Edit or Write.
|
|
1284
1364
|
# Uses graduated enforcement based on uncovered source edits.
|
|
@@ -1423,7 +1503,7 @@ else
|
|
|
1423
1503
|
echo " Then retry your edit." >&2
|
|
1424
1504
|
exit 2
|
|
1425
1505
|
fi
|
|
1426
|
-
`,
|
|
1506
|
+
`,F=`#!/bin/sh
|
|
1427
1507
|
# Paradigm Cursor PostToolUse Hook \u2014 Advisory Feedback
|
|
1428
1508
|
# Fires AFTER the agent calls Edit or Write.
|
|
1429
1509
|
# Tracks modified source files and outputs advisory the agent can see.
|
|
@@ -1547,9 +1627,9 @@ if [ "$PENDING_COUNT" -ge 30 ]; then
|
|
|
1547
1627
|
fi
|
|
1548
1628
|
|
|
1549
1629
|
exit 0
|
|
1550
|
-
`;function
|
|
1551
|
-
`,"utf8"),h.push("settings.json hooks"));}}catch{}return {cleaned:h.length>0,removed:h}}function
|
|
1552
|
-
`)[0]||"unknown error"}`}finally{try{e.unlinkSync(c);}catch{}}}catch{return null}}var
|
|
1630
|
+
`;function H(){try{let i=r.join(S.homedir(),".claude","settings.json");if(!e.existsSync(i))return {active:!1};if(!JSON.parse(e.readFileSync(i,"utf8")).enabledPlugins?.["paradigm@a-paradigm"])return {active:!1};let d=r.join(S.homedir(),".claude","plugins","cache","a-paradigm","paradigm");if(!e.existsSync(d))return {active:!1};let a=e.readdirSync(d).filter(s=>e.statSync(r.join(d,s)).isDirectory()).sort().reverse();if(a.length===0)return {active:!1};let p=r.join(d,a[0]),l=r.join(p,"hooks","hooks.json");return e.existsSync(l)?{active:!0,cacheVersion:a[0]}:{active:!1}}catch{return {active:false}}}function W(){try{let i=H();if(!i.active||!i.cacheVersion)return {compatible:!0};let h=r.join(S.homedir(),".claude","plugins","cache","a-paradigm","paradigm",i.cacheVersion,"hooks.json");if(!e.existsSync(h))return {compatible:!0};let d=JSON.parse(e.readFileSync(h,"utf8")).compatibleVersions;if(!d)return {compatible:!0};let a=q();if(!a)return {compatible:!0};let p=d.split(/\s+/);for(let l of p){let s=l.match(/^(>=?|<=?)\s*(\d+\.\d+\.\d+)/);if(!s)continue;let[,t,n]=s,f=J(a,n);if(t===">="&&f<0)return {compatible:!1,message:`Plugin requires paradigm ${d}, current: ${a}`};if(t===">"&&f<=0)return {compatible:!1,message:`Plugin requires paradigm ${d}, current: ${a}`};if(t==="<="&&f>0)return {compatible:!1,message:`Plugin requires paradigm ${d}, current: ${a}`};if(t==="<"&&f>=0)return {compatible:!1,message:`Plugin requires paradigm ${d}, current: ${a}`}}return {compatible:!0}}catch{return {compatible:true}}}function q(){try{let i=r.join(r.dirname(new URL(import.meta.url).pathname),"..","..","package.json");return JSON.parse(e.readFileSync(i,"utf8")).version||null}catch{return null}}function J(i,h){let c=i.split(".").map(Number),d=h.split(".").map(Number);for(let a=0;a<3;a++){if((c[a]||0)<(d[a]||0))return -1;if((c[a]||0)>(d[a]||0))return 1}return 0}function B(i){let h=[],c=r.join(i,".claude","hooks");if(e.existsSync(c)){for(let a of ["paradigm-common.sh","paradigm-stop.sh","paradigm-precommit.sh","paradigm-postwrite.sh","paradigm-navigate-remind.sh"]){let p=r.join(c,a);e.existsSync(p)&&(e.unlinkSync(p),h.push(a));}try{e.readdirSync(c).length===0&&e.rmdirSync(c);}catch{}}let d=r.join(i,".claude","settings.json");if(e.existsSync(d))try{let a=JSON.parse(e.readFileSync(d,"utf8")),p=a.hooks;if(p){let l=!1;for(let[s,t]of Object.entries(p)){if(!Array.isArray(t))continue;let n=t.filter(f=>!JSON.stringify(f).includes("paradigm-"));n.length!==t.length&&(l=!0,n.length===0?delete p[s]:p[s]=n);}l&&(Object.keys(p).length===0?delete a.hooks:a.hooks=p,e.writeFileSync(d,JSON.stringify(a,null,2)+`
|
|
1631
|
+
`,"utf8"),h.push("settings.json hooks"));}}catch{}return {cleaned:h.length>0,removed:h}}function K(i,h){try{let c=r.join(S.tmpdir(),`paradigm-hook-validate-${Date.now()}.sh`);e.writeFileSync(c,i,"utf8");try{return execSync(`bash -n "${c}" 2>&1`,{encoding:"utf-8"}),null}catch(d){return `${h}: bash syntax error \u2014 ${d.message?.split(`
|
|
1632
|
+
`)[0]||"unknown error"}`}finally{try{e.unlinkSync(c);}catch{}}}catch{return null}}var G=`#!/bin/sh
|
|
1553
1633
|
# Paradigm post-commit hook - captures history from commits
|
|
1554
1634
|
# Installed by: paradigm hooks install
|
|
1555
1635
|
|
|
@@ -1633,7 +1713,7 @@ if [ -n "$SYMBOLS" ] && [ -d ".paradigm/history" ]; then
|
|
|
1633
1713
|
|
|
1634
1714
|
echo "[paradigm] History entry $ID recorded"
|
|
1635
1715
|
fi
|
|
1636
|
-
`,
|
|
1716
|
+
`,Y=`#!/bin/sh
|
|
1637
1717
|
# Paradigm pre-push hook - reindex history before pushing
|
|
1638
1718
|
# Installed by: paradigm hooks install
|
|
1639
1719
|
|
|
@@ -1641,25 +1721,25 @@ if [ -d ".paradigm/history" ] && [ -f ".paradigm/history/log.jsonl" ]; then
|
|
|
1641
1721
|
echo "[paradigm] Reindexing history..."
|
|
1642
1722
|
npx paradigm history reindex 2>/dev/null || true
|
|
1643
1723
|
fi
|
|
1644
|
-
`;async function
|
|
1724
|
+
`;async function re(i={}){let h=process.cwd(),c=i.dryRun||false;c&&console.log(o.cyan(`
|
|
1645
1725
|
[dry-run] Showing what would be installed:
|
|
1646
|
-
`));let d=i.claudeCode&&!i.postCommit&&!i.prePush&&!i.cursor,a=i.cursor&&!i.postCommit&&!i.prePush&&!i.claudeCode;if(!c){let s=[{name:"post-commit",content:
|
|
1726
|
+
`));let d=i.claudeCode&&!i.postCommit&&!i.prePush&&!i.cursor,a=i.cursor&&!i.postCommit&&!i.prePush&&!i.claudeCode;if(!c){let s=[{name:"post-commit",content:G},{name:"pre-push",content:Y},{name:"paradigm-common",content:y},{name:"claude-code-stop",content:U},{name:"claude-code-precommit",content:v},{name:"claude-code-postwrite",content:D},{name:"claude-code-navigate-remind",content:P},{name:"cursor-session-start",content:b},{name:"cursor-stop",content:L},{name:"cursor-precommit",content:x},{name:"cursor-postwrite",content:w},{name:"cursor-pretooluse",content:M},{name:"cursor-posttooluse",content:F}];for(let t of s){let n=K(t.content,t.name);if(n){console.log(o.red(`Hook syntax error: ${n}`)),console.log(o.gray("Aborting installation. Fix the hook script and try again."));return}}}let p=W();if(p.compatible||(console.log(o.yellow(`
|
|
1647
1727
|
\u26A0 ${p.message}`)),console.log(o.gray(` Hook installation will continue, but behavior may differ from plugin expectations.
|
|
1648
|
-
`))),!d&&!a){let s=r.join(h,".git");if(!e.existsSync(s)){console.log(o.red("Not a git repository."));return}let t=r.join(s,"hooks"),n=!i.postCommit&&!i.prePush&&!i.claudeCode,f=[];if(n||i.postCommit){let u=r.join(t,"post-commit");if(c){let
|
|
1728
|
+
`))),!d&&!a){let s=r.join(h,".git");if(!e.existsSync(s)){console.log(o.red("Not a git repository."));return}let t=r.join(s,"hooks"),n=!i.postCommit&&!i.prePush&&!i.claudeCode,f=[];if(n||i.postCommit){let u=r.join(t,"post-commit");if(c){let _=e.existsSync(u)&&!i.force?"skip (exists)":"install";console.log(o.gray(` post-commit: ${_} \u2192 ${u}`));}else e.existsSync(u)&&!i.force?e.readFileSync(u,"utf8").includes("paradigm")?console.log(o.gray("post-commit hook already installed by paradigm")):console.log(o.yellow("post-commit hook exists. Use --force to overwrite.")):(e.mkdirSync(t,{recursive:true}),e.writeFileSync(u,G),e.chmodSync(u,"755"),f.push("post-commit"));}if(n||i.prePush){let u=r.join(t,"pre-push");if(c){let _=e.existsSync(u)&&!i.force?"skip (exists)":"install";console.log(o.gray(` pre-push: ${_} \u2192 ${u}`));}else e.existsSync(u)&&!i.force?e.readFileSync(u,"utf8").includes("paradigm")?console.log(o.gray("pre-push hook already installed by paradigm")):console.log(o.yellow("pre-push hook exists. Use --force to overwrite.")):(e.mkdirSync(t,{recursive:true}),e.writeFileSync(u,Y),e.chmodSync(u,"755"),f.push("pre-push"));}!c&&f.length>0&&console.log(o.green(`Git hooks installed: ${f.join(", ")}`));let O=r.join(h,".paradigm/history");!e.existsSync(O)&&!c&&console.log(o.gray("Tip: Run `paradigm history init` to initialize history tracking"));}let l=!i.postCommit&&!i.prePush&&!i.claudeCode&&!i.cursor;(l||i.claudeCode)&&(c?(console.log(o.gray(" Claude Code hooks: would install paradigm-stop.sh, paradigm-precommit.sh, paradigm-postwrite.sh, paradigm-navigate-remind.sh")),console.log(o.gray(` \u2192 ${r.join(h,".claude","hooks")}/`)),console.log(o.gray(" \u2192 Update .claude/settings.json with hook configuration"))):await z(h,i.force)),(l||i.cursor)&&(c?(console.log(o.gray(" Cursor hooks: would install paradigm-session-start.sh, paradigm-stop.sh, paradigm-precommit.sh, paradigm-postwrite.sh, paradigm-pretooluse.sh, paradigm-posttooluse.sh")),console.log(o.gray(` \u2192 ${r.join(h,".cursor","hooks")}/`)),console.log(o.gray(" \u2192 Update .cursor/hooks.json"))):await Q(h,i.force)),c&&console.log(o.cyan(`
|
|
1649
1729
|
[dry-run] No changes made.
|
|
1650
|
-
`));}async function
|
|
1651
|
-
`,"utf8"),a.length>0&&console.log(o.green(`Claude Code hooks installed: ${a.join(", ")}`)),console.log(o.green("Claude Code settings.json updated with hook configuration"));}async function
|
|
1652
|
-
`,"utf8"),d.length>0&&console.log(o.green(`Cursor hooks installed: ${d.join(", ")}`)),console.log(o.green("Cursor hooks.json updated with hook configuration"));}async function
|
|
1730
|
+
`));}async function z(i,h){let c=H();if(c.active){console.log(o.cyan(` Paradigm plugin v${c.cacheVersion} is active \u2014 hooks are managed by the plugin.`));let{cleaned:g,removed:E}=B(i);console.log(g?o.green(` Cleaned up stale project hooks: ${E.join(", ")}`):o.gray(" No stale project hooks to clean up.")),console.log(o.gray(" Plugin hooks auto-update with each session \u2014 no manual install needed."));return}let d=r.join(i,".claude","hooks");e.mkdirSync(d,{recursive:true});let a=[],p=r.join(d,"paradigm-common.sh");e.writeFileSync(p,y,"utf8"),e.chmodSync(p,"755");let l=[{name:"paradigm-stop.sh",content:U},{name:"paradigm-precommit.sh",content:v},{name:"paradigm-postwrite.sh",content:D},{name:"paradigm-navigate-remind.sh",content:P}];for(let g of l){let E=r.join(d,g.name);if(e.existsSync(E)&&!h){console.log(o.gray(` ${g.name}: already installed`));continue}e.writeFileSync(E,g.content,"utf8"),e.chmodSync(E,"755"),a.push(g.name);}let s=r.join(i,".claude","settings.json"),t={};if(e.existsSync(s))try{t=JSON.parse(e.readFileSync(s,"utf8"));}catch{}let n=t.hooks||{},f={hooks:[{type:"command",command:'bash "$CLAUDE_PROJECT_DIR/.claude/hooks/paradigm-stop.sh"',timeout:10}]},O={matcher:"Bash",hooks:[{type:"command",command:'bash "$CLAUDE_PROJECT_DIR/.claude/hooks/paradigm-precommit.sh"',timeout:30}]},u=n.Stop||[];u.some(g=>JSON.stringify(g).includes("paradigm-stop.sh"))||u.push(f),n.Stop=u;let $=n.PreToolUse||[];$.some(g=>JSON.stringify(g).includes("paradigm-precommit.sh"))||$.push(O),n.PreToolUse=$;let V={matcher:"Glob|Grep",hooks:[{type:"command",command:'bash "$CLAUDE_PROJECT_DIR/.claude/hooks/paradigm-navigate-remind.sh"',timeout:5}]};$.some(g=>JSON.stringify(g).includes("paradigm-navigate-remind.sh"))||$.push(V),n.PreToolUse=$;let j={matcher:"Edit,Write",hooks:[{type:"command",command:'bash "$CLAUDE_PROJECT_DIR/.claude/hooks/paradigm-postwrite.sh"',timeout:5}]},T=n.PostToolUse||[];T.some(g=>JSON.stringify(g).includes("paradigm-postwrite.sh"))||T.push(j),n.PostToolUse=T,t.hooks=n,e.writeFileSync(s,JSON.stringify(t,null,2)+`
|
|
1731
|
+
`,"utf8"),a.length>0&&console.log(o.green(`Claude Code hooks installed: ${a.join(", ")}`)),console.log(o.green("Claude Code settings.json updated with hook configuration"));}async function Q(i,h){let c=r.join(i,".cursor","hooks");e.mkdirSync(c,{recursive:true});let d=[],a=r.join(c,"paradigm-common.sh");e.writeFileSync(a,y,"utf8"),e.chmodSync(a,"755");let p=[{name:"paradigm-session-start.sh",content:b},{name:"paradigm-stop.sh",content:L},{name:"paradigm-precommit.sh",content:x},{name:"paradigm-postwrite.sh",content:w},{name:"paradigm-pretooluse.sh",content:M},{name:"paradigm-posttooluse.sh",content:F}];for(let m of p){let A=r.join(c,m.name);if(e.existsSync(A)&&!h){console.log(o.gray(` ${m.name}: already installed (Cursor)`));continue}e.writeFileSync(A,m.content,"utf8"),e.chmodSync(A,"755"),d.push(m.name);}let l=r.join(i,".cursor","hooks.json"),s={};if(e.existsSync(l))try{s=JSON.parse(e.readFileSync(l,"utf8"));}catch{}s.version=1;let t=s.hooks||{},n={command:".cursor/hooks/paradigm-session-start.sh",timeout:5},f={command:".cursor/hooks/paradigm-stop.sh",timeout:10,loop_limit:3},O={command:".cursor/hooks/paradigm-postwrite.sh",timeout:5},u={command:".cursor/hooks/paradigm-precommit.sh",matcher:"git commit",timeout:30},_=t.sessionStart||[];_.some(m=>JSON.stringify(m).includes("paradigm-session-start.sh"))||_.push(n),t.sessionStart=_;let I=t.stop||[];I.some(m=>JSON.stringify(m).includes("paradigm-stop.sh"))||I.push(f),t.stop=I;let N=t.afterFileEdit||[];N.some(m=>JSON.stringify(m).includes("paradigm-postwrite.sh"))||N.push(O),t.afterFileEdit=N;let T={command:".cursor/hooks/paradigm-pretooluse.sh",matcher:"Edit|Write",timeout:5},C=t.preToolUse||[];C.some(m=>JSON.stringify(m).includes("paradigm-pretooluse.sh"))||C.push(T),t.preToolUse=C;let E={command:".cursor/hooks/paradigm-posttooluse.sh",matcher:"Edit|Write",timeout:5},k=t.postToolUse||[];k.some(m=>JSON.stringify(m).includes("paradigm-posttooluse.sh"))||k.push(E),t.postToolUse=k;let R=t.beforeShellExecution||[];R.some(m=>JSON.stringify(m).includes("paradigm-precommit.sh"))||R.push(u),t.beforeShellExecution=R,s.hooks=t,e.writeFileSync(l,JSON.stringify(s,null,2)+`
|
|
1732
|
+
`,"utf8"),d.length>0&&console.log(o.green(`Cursor hooks installed: ${d.join(", ")}`)),console.log(o.green("Cursor hooks.json updated with hook configuration"));}async function ae(i={}){let h=process.cwd(),c=i.dryRun||false;if(c&&console.log(o.cyan(`
|
|
1653
1733
|
[dry-run] Showing what would be removed:
|
|
1654
1734
|
`)),!i.cursor){let d=r.join(h,".git");if(!e.existsSync(d)){console.log(o.red("Not a git repository."));return}let a=r.join(d,"hooks"),p=[];for(let l of ["post-commit","pre-push"]){let s=r.join(a,l);e.existsSync(s)&&e.readFileSync(s,"utf8").includes("paradigm")&&(c?console.log(o.gray(` Would remove: ${s}`)):e.unlinkSync(s),p.push(l));}c?p.length===0&&console.log(o.gray(" No paradigm git hooks to remove")):p.length>0?console.log(o.green(`Git hooks removed: ${p.join(", ")}`)):console.log(o.gray("No paradigm git hooks found to remove"));}if(i.cursor){let d=r.join(h,".cursor","hooks"),a=[];for(let l of ["paradigm-session-start.sh","paradigm-stop.sh","paradigm-precommit.sh","paradigm-postwrite.sh","paradigm-pretooluse.sh","paradigm-posttooluse.sh"]){let s=r.join(d,l);e.existsSync(s)&&(c?console.log(o.gray(` Would remove: ${s}`)):e.unlinkSync(s),a.push(l));}let p=r.join(h,".cursor","hooks.json");if(e.existsSync(p))if(c)console.log(o.gray(` Would clean paradigm entries from: ${p}`));else try{let l=JSON.parse(e.readFileSync(p,"utf8")),s=l.hooks||{};for(let t of ["sessionStart","stop","afterFileEdit","beforeShellExecution","preToolUse","postToolUse"])Array.isArray(s[t])&&(s[t]=s[t].filter(n=>!JSON.stringify(n).includes("paradigm-")),s[t].length===0&&delete s[t]);l.hooks=s,e.writeFileSync(p,JSON.stringify(l,null,2)+`
|
|
1655
1735
|
`,"utf8");}catch{}c?a.length===0&&console.log(o.gray(" No paradigm Cursor hooks to remove")):a.length>0?console.log(o.green(`Cursor hooks removed: ${a.join(", ")}`)):console.log(o.gray("No paradigm Cursor hooks found to remove"));}c&&console.log(o.cyan(`
|
|
1656
1736
|
[dry-run] No changes made.
|
|
1657
|
-
`));}async function
|
|
1737
|
+
`));}async function ne(){let i=process.cwd(),h=r.join(i,".git");if(e.existsSync(h)){console.log(o.magenta(`
|
|
1658
1738
|
Git Hooks Status
|
|
1659
1739
|
`));let l=r.join(h,"hooks"),s=["post-commit","pre-push"];for(let n of s){let f=r.join(l,n);e.existsSync(f)?e.readFileSync(f,"utf8").includes("paradigm")?console.log(o.green(` ${n}: installed (paradigm)`)):console.log(o.yellow(` ${n}: exists (other)`)):console.log(o.gray(` ${n}: not installed`));}console.log();let t=r.join(i,".paradigm/history");if(e.existsSync(t)){let n=r.join(t,"log.jsonl");if(e.existsSync(n)){let O=e.readFileSync(n,"utf8").split(`
|
|
1660
1740
|
`).filter(u=>u.trim()).length;console.log(o.white(` History entries: ${O}`));}}else console.log(o.gray(" History: not initialized")),console.log(o.gray(" Run `paradigm history init` to enable"));}else console.log(o.gray(`
|
|
1661
1741
|
Not a git repository (git hooks N/A)
|
|
1662
1742
|
`));console.log(o.magenta(` Claude Code Hooks Status
|
|
1663
|
-
`));let c=
|
|
1743
|
+
`));let c=H();if(c.active){console.log(o.cyan(` Plugin: paradigm v${c.cacheVersion} (active)`)),console.log(o.green(" Hooks are managed by the plugin \u2014 auto-updates with each session."));let l=r.join(i,".claude","hooks"),s=[];for(let f of ["paradigm-common.sh","paradigm-stop.sh","paradigm-precommit.sh","paradigm-postwrite.sh","paradigm-navigate-remind.sh"])e.existsSync(r.join(l,f))&&s.push(f);let t=r.join(i,".claude","settings.json"),n=false;if(e.existsSync(t))try{let f=JSON.parse(e.readFileSync(t,"utf8"));n=JSON.stringify(f.hooks||{}).includes("paradigm-");}catch{}(s.length>0||n)&&(console.log(o.yellow(` WARNING: Stale project hooks detected (${s.join(", ")}${n?", settings.json entries":""})`)),console.log(o.yellow(" These shadow the plugin hooks and may run outdated logic.")),console.log(o.gray(" Run `paradigm hooks install --claude-code` to clean them up.")));}else {console.log(o.gray(" Plugin: not active (using project-level hooks)"));let l=r.join(i,".claude","hooks"),s=["paradigm-stop.sh","paradigm-precommit.sh","paradigm-postwrite.sh","paradigm-navigate-remind.sh"];for(let n of s){let f=r.join(l,n);e.existsSync(f)?console.log(o.green(` ${n}: installed`)):console.log(o.gray(` ${n}: not installed`));}let t=r.join(i,".claude","settings.json");if(e.existsSync(t))try{let f=JSON.parse(e.readFileSync(t,"utf8")).hooks||{},O=JSON.stringify(f.Stop||[]).includes("paradigm-stop.sh"),u=JSON.stringify(f.PreToolUse||[]).includes("paradigm-precommit.sh"),_=JSON.stringify(f.PostToolUse||[]).includes("paradigm-postwrite.sh");console.log(o.gray(` settings.json Stop hook: ${O?"configured":"missing"}`)),console.log(o.gray(` settings.json PreToolUse hook: ${u?"configured":"missing"}`)),console.log(o.gray(` settings.json PostToolUse hook: ${_?"configured":"missing"}`));}catch{console.log(o.yellow(" settings.json: parse error"));}else console.log(o.gray(" settings.json: not found"));}console.log(o.magenta(`
|
|
1664
1744
|
Cursor Hooks Status
|
|
1665
|
-
`));let d=r.join(i,".cursor","hooks"),a=["paradigm-session-start.sh","paradigm-stop.sh","paradigm-precommit.sh","paradigm-postwrite.sh","paradigm-pretooluse.sh","paradigm-posttooluse.sh"];for(let l of a){let s=r.join(d,l);e.existsSync(s)?console.log(o.green(` ${l}: installed`)):console.log(o.gray(` ${l}: not installed`));}let p=r.join(i,".cursor","hooks.json");if(e.existsSync(p))try{let s=JSON.parse(e.readFileSync(p,"utf8")).hooks||{},t=JSON.stringify(s.sessionStart||[]).includes("paradigm-session-start.sh"),n=JSON.stringify(s.stop||[]).includes("paradigm-stop.sh"),f=JSON.stringify(s.afterFileEdit||[]).includes("paradigm-postwrite.sh"),O=JSON.stringify(s.beforeShellExecution||[]).includes("paradigm-precommit.sh"),u=JSON.stringify(s.preToolUse||[]).includes("paradigm-pretooluse.sh"),
|
|
1745
|
+
`));let d=r.join(i,".cursor","hooks"),a=["paradigm-session-start.sh","paradigm-stop.sh","paradigm-precommit.sh","paradigm-postwrite.sh","paradigm-pretooluse.sh","paradigm-posttooluse.sh"];for(let l of a){let s=r.join(d,l);e.existsSync(s)?console.log(o.green(` ${l}: installed`)):console.log(o.gray(` ${l}: not installed`));}let p=r.join(i,".cursor","hooks.json");if(e.existsSync(p))try{let s=JSON.parse(e.readFileSync(p,"utf8")).hooks||{},t=JSON.stringify(s.sessionStart||[]).includes("paradigm-session-start.sh"),n=JSON.stringify(s.stop||[]).includes("paradigm-stop.sh"),f=JSON.stringify(s.afterFileEdit||[]).includes("paradigm-postwrite.sh"),O=JSON.stringify(s.beforeShellExecution||[]).includes("paradigm-precommit.sh"),u=JSON.stringify(s.preToolUse||[]).includes("paradigm-pretooluse.sh"),_=JSON.stringify(s.postToolUse||[]).includes("paradigm-posttooluse.sh");console.log(o.gray(` hooks.json sessionStart: ${t?"configured":"missing"}`)),console.log(o.gray(` hooks.json stop: ${n?"configured":"missing"}`)),console.log(o.gray(` hooks.json afterFileEdit: ${f?"configured":"missing"}`)),console.log(o.gray(` hooks.json preToolUse: ${u?"configured":"missing"}`)),console.log(o.gray(` hooks.json postToolUse: ${_?"configured":"missing"}`)),console.log(o.gray(` hooks.json beforeShellExecution: ${O?"configured":"missing"}`));}catch{console.log(o.yellow(" hooks.json: parse error"));}else console.log(o.gray(" hooks.json: not found"));console.log();}export{re as a,ae as b,ne as c};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
export{a as hooksInstallCommand,c as hooksStatusCommand,b as hooksUninstallCommand}from'./chunk-
|
|
2
|
+
export{a as hooksInstallCommand,c as hooksStatusCommand,b as hooksUninstallCommand}from'./chunk-SI6SV76D.js';import'./chunk-5TAVYPOV.js';
|