prjct-cli 2.24.2 → 2.24.3

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/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [2.24.3] - 2026-05-29
4
+
5
+ ### Performance
6
+
7
+ - hook hot-path benchmark (phase 0 instrumentation) (#380)
8
+
9
+
3
10
  ## [2.24.2] - 2026-05-29
4
11
 
5
12
  ### Performance
@@ -1363,7 +1363,7 @@ Run with: p. ${o}`)),{success:!0,workflowId:a,name:o,templatePath:l.path}):(mt.d
1363
1363
  `))),r.length>0&&i.push(X("Custom Workflows",r.map(o).join(`
1364
1364
  `))),console.log(W(...i,Ve([{label:"Create workflow",command:'prjct workflow create <name> "description" --md'},{label:"View workflow",command:"prjct workflow <name> --md"}])))}else{if(jt(`${t.length} workflow${t.length!==1?"s":""}`),n.length>0){console.log(`
1365
1365
  Built-in:`);for(let i of n)console.log(` ${i.name} \u2014 ${i.description}`)}if(r.length>0){console.log(`
1366
- Custom:`);for(let i of r)console.log(` ${i.name} \u2014 ${i.description}`)}}return{success:!0,workflows:t}}async function uS(s,e,t){let n=s.trim();if(!n)return H("Usage: prjct workflow delete <name>",t);try{return mt.deleteWorkflow(e,n)?(await gm.deleteWorkflowTemplate(n),t.md?console.log(W(Ce("Workflow Deleted",`Deleted workflow: ${n}`))):jt(`deleted workflow: ${n}`),{success:!0}):H(`Workflow '${n}' not found`,t)}catch(r){return H(b(r),t)}}var dS=h(()=>{"use strict";iS();Xo();$n();L();Ee();kt();Ad();lm();c(aS,"workflowInit");c(cS,"workflowCreate");c(lS,"workflowList");c(uS,"workflowDelete")});var Jr,fm=h(()=>{"use strict";Rn();oc();Xo();dt();L();ue();Ee();kt();Jo();pe();Qd();Ie();Qt();cm();tS();oS();dS();Jr=class extends z{static{c(this,"WorkflowCommands")}async now(e=null,t=process.cwd(),n={}){try{let r=await we(t);if(!r.ok)return r.result;let o=r.value;if(!e)return this._showActiveTask(o,n);let i=await rs(o,"task","before",{projectPath:t,skipRules:n.skipHooks});if(!i.success)return{success:!1,error:i.gatesFailed.length>0?`Blocked: ${i.gatesFailed.join(", ")}`:`Hook failed: ${i.hooksFailed.join(", ")}`};let a=/^[A-Z]+-\d+$/.test(e)?e:void 0,l=e,u=Je(),d=n.spec;if(await B.startTask(o,{id:u,description:l,sessionId:Je(),linearId:a,linkedSpecId:d}),d)try{let{specService:m}=await Promise.resolve().then(()=>(ac(),rp));await m.linkTask(t,d,u)}catch{}await this.logToMemory(t,"task_started",{task:l,taskId:u,timestamp:C()}),await rs(o,"task","after",{projectPath:t,skipRules:n.skipHooks});let p=await rc(t).catch(()=>"");return n.md?console.log(W(Vo({description:l,status:"active"}),X("State",Ne([`Task: \`${u}\``,p?`Branch: \`${p}\``:null,a?`Linear: \`${a}\``:null,i.instructions.length>0?`Agent instructions: ${i.instructions.length}`:null].filter(m=>m!==null))),i.instructions.length>0?X("Agent Instructions",Ne(i.instructions)):null,Ve([{label:"Pull project memory",command:"prjct context memory <topic>"},{label:"Tag the task",command:"prjct tag type:bug domain:auth"},{label:"Capture learnings",command:'prjct remember learning "..."'},{label:"Ship when done",command:"prjct ship --md"}]))):(f.done(`Task: ${l}`),Qw("working"),Rr("task")),{success:!0,task:l,taskId:u}}catch(r){let o=b(r);return n.md?console.log(`> ${o}`):f.fail(o),{success:!1,error:o}}}async _showActiveTask(e,t){let n=await B.getCurrentTask(e);if(!n){let r='no active task. `prjct task "<description>"` to start one.';return t.md?console.log(`> ${r}`):f.info(r),{success:!0,message:"no active task"}}return t.md?console.log(W(Vo({description:n.description,status:"active"}),X("State",Ne([`Task: \`${n.id}\``,n.branch?`Branch: \`${n.branch}\``:null,n.linearId?`Linear: \`${n.linearId}\``:null,`Started: ${n.startedAt}`].filter(r=>r!==null))))):f.info(`Active: ${n.description}`),{success:!0,currentTask:n}}async workflow(e=null,t=process.cwd(),n={}){try{let r=await we(t,n);if(!r.ok)return r.result;let o=r.value,i=e?.trim()??"";if(!i)return jc(null,o,n);let a=Vb(i);switch(a.type){case"add":return zb(a.args,o,n);case"gate":return Kb(a.args,o,n);case"instruction":return Yb(a.args,o,n);case"remove":return Qb(a.args,o,n);case"disable":return eS(a.args,o,n);case"reset":return Zb(o,n);case"init":return aS(o,t,n);case"help":return rS(n);case"create":return cS(a.args,o,t,n);case"list":return lS(o,n);case"delete":return uS(a.args,o,n);case"run":return this.run(a.args,t,n);case"view":return jc(a.args||null,o,n);default:return jc(i.split(/\s+/)[0]?.toLowerCase()||null,o,n)}}catch(r){return n.md?console.log(`> Error: ${b(r)}`):f.fail(b(r)),Oe(r)}}async run(e,t=process.cwd(),n={}){try{let r=await we(t,n);if(!r.ok)return r.result;let o=r.value,i=e.trim();if(!i){let u="Usage: prjct workflow run <name>";return n.md?console.log(`> ${u}`):f.warn(u),{success:!1,error:u}}let a=mt.getWorkflow(o,i);if(!a||!a.enabled){let u=`Workflow '${i}' not found`;return n.md?console.log(`> ${u}`):f.warn(u),{success:!1,error:u}}let l=await rs(o,i,"before",{projectPath:t});if(!l.success){if(n.md)zw("failed","workflow_gates_failed",[{label:"View rules",command:`prjct workflow ${i} --md`}]);else if(f.fail("Workflow gates failed"),l.gatesFailed)for(let u of l.gatesFailed)console.log(` \u2717 ${u}`);return{success:!1,error:"Workflow gates failed",gatesFailed:l.gatesFailed}}return await rs(o,i,"after",{projectPath:t}),n.md?console.log(W(Ce(`Workflow: ${i}`,a.description||""),Ve([{label:"View rules",command:`prjct workflow ${i} --md`},{label:"Run again",command:`p. ${i}`}]))):f.done(`${i} completed successfully`),{success:!0,workflow:i}}catch(r){let o=b(r);return n.md?console.log(`> Error: ${o}`):f.fail(o),{success:!1,error:o}}}}});var cs,B3,hm=h(()=>{"use strict";bc();Op();Np();Tc();ri();Wp();vc();Gp();Cc();Kp();kc();Qp();tm();am();fm();cs=class{static{c(this,"PrjctCommands")}workflow;planning;shipping;analysis;setupCmds;updateCmds;contextCmds;primitivesCmds;seedCmds;installCmds;captureCmds;mcpCmds;teamCmds;configCmds;specCmds;agent;agentInfo;currentAuthor;prjctDir;constructor(){this.workflow=new Jr,this.planning=new Ns,this.shipping=new Os,this.analysis=new Ls,this.setupCmds=new Fr,this.updateCmds=new qr,this.contextCmds=new is,this.primitivesCmds=new Nr,this.seedCmds=new Us,this.installCmds=new Fs,this.captureCmds=new Dr,this.mcpCmds=new Or,this.teamCmds=new Gr,this.configCmds=new Mr,this.specCmds=new Ur,this.agent=null,this.agentInfo=null,this.currentAuthor=null,this.prjctDir=".prjct"}async task(e=null,t=process.cwd(),n={}){return this.workflow.now(e,t,n)}async workflowPrefs(e=null,t=process.cwd(),n={}){return this.workflow.workflow(e,t,n)}async init(e=null,t=process.cwd()){return this.planning.init(e,t)}async ship(e,t=process.cwd(),n={}){return this.shipping.ship(e,t,{...n})}async analyze(e={},t=process.cwd()){return this.analysis.analyze(e,t)}async sync(e=process.cwd(),t={}){return this.analysis.sync(e,t)}async saveLlmAnalysis(e,t=process.cwd(),n={}){return this.analysis.saveLlmAnalysis(e,t,n)}async regenVault(e=process.cwd(),t={}){return this.analysis.regenVault(e,t)}async context(e=null,t=process.cwd(),n={}){return this.contextCmds.context(e,t,n)}async status(e=null,t=process.cwd(),n={}){return this.primitivesCmds.status(e,t,n)}async tag(e=null,t=process.cwd(),n={}){return this.primitivesCmds.tag(e,t,n)}async remember(e=null,t=process.cwd(),n={}){return this.primitivesCmds.remember(e,t,n)}async seed(e=null,t=process.cwd(),n={}){return this.seedCmds.seed(e,t,n)}async install(e=null,t=process.cwd(),n={}){return this.installCmds.install(null,t,n)}async capture(e=null,t=process.cwd(),n={}){return this.captureCmds.capture(e,t,n)}async mcp(e=null,t=process.cwd(),n={}){return this.mcpCmds.mcp(e,t,n)}async team(e=null,t=process.cwd(),n={}){return this.teamCmds.team(e,t,n)}async config(e=null,t=process.cwd(),n={}){return this.configCmds.config(e,t,n)}async auth(e=null,t={}){return this.setupCmds.auth(e,t)}async login(e={}){return this.setupCmds.login(e)}async logout(){return this.setupCmds.logout()}async start(){return this.setupCmds.start()}async setup(e={}){return this.setupCmds.setup(e)}async update(e={},t=process.cwd()){return this.updateCmds.update(e,t)}async installStatusLine(){return this.setupCmds.installStatusLine()}showAsciiArt(){this.setupCmds.showAsciiArt()}async initializeAgent(){return this.workflow.initializeAgent()}async ensureProjectInit(e){return this.workflow.ensureProjectInit(e)}async ensureAuthor(){return this.workflow.ensureAuthor()}async getGlobalProjectPath(e){return this.workflow.getGlobalProjectPath(e)}async logToMemory(e,t,n){return this.workflow.logToMemory(e,t,n)}async spec(e=null,t=process.cwd(),n={}){return this.specCmds.draft(e,t,n)}async specList(e=process.cwd(),t={}){return this.specCmds.list(null,e,t)}async specShow(e=null,t=process.cwd(),n={}){return this.specCmds.show(e,t,n)}async specUpdate(e=null,t=process.cwd(),n={}){return this.specCmds.update(e,t,n)}async specSetStatus(e=null,t=process.cwd(),n={}){return this.specCmds.setStatus(e,t,n)}async specRecordReview(e=null,t=process.cwd(),n={}){return this.specCmds.recordReview(e,t,n)}async specLinkTask(e=null,t=process.cwd(),n={}){return this.specCmds.linkTask(e,t,n)}async specShip(e=null,t=process.cwd(),n={}){return this.specCmds.ship(e,t,n)}async specAudit(e=null,t=process.cwd(),n={}){return this.specCmds.audit(e,t,n)}async specBreakdown(e=null,t=process.cwd(),n={}){return this.specCmds.breakdown(e,t,n)}async specInventory(e=process.cwd(),t={}){return this.specCmds.inventory(null,e,t)}},B3=new cs});var ym,ct,Xr=h(()=>{"use strict";oe();ge();L();ue();ym=class{static{c(this,"CommandRegistry")}handlers=new Map;handlerFns=new Map;metadata=new Map;categories=new Map;noProjectCommands=new Set(["init","setup","start","migrateAll"]);register(e,t){this.handlers.set(e.name,e),this.setMeta(e.name,t)}registerFn(e,t,n){this.handlerFns.set(e,t),this.setMeta(e,n)}setMeta(e,t){let n=t?.requiresProject??!this.noProjectCommands.has(e);this.metadata.set(e,{name:e,group:t?.group??"unknown",description:t?.description??"",requiresProject:n,usage:t?.usage??{claude:null,terminal:null},implemented:t?.implemented??!0,hasTemplate:t?.hasTemplate??!1,params:t?.params,blockingRules:t?.blockingRules,features:t?.features,isOptional:t?.isOptional,deprecated:t?.deprecated,replacedBy:t?.replacedBy})}registerCategory(e,t){this.categories.set(e,t)}registerMethod(e,t,n,r){let o=t[n];if(typeof o!="function")throw new Error(`${String(n)} is not a function`);let i=c(async(a,l)=>a!=null?o.call(t,a,l.projectPath):o.call(t,l.projectPath),"wrapper");this.handlerFns.set(e,i),this.setMeta(e,r)}has(e){return this.handlers.has(e)||this.handlerFns.has(e)}list(){return[...this.handlers.keys(),...this.handlerFns.keys()]}listByGroup(e){return Array.from(this.metadata.entries()).filter(([,t])=>t.group===e).map(([t])=>t)}getGroups(){let e=new Set;for(let t of this.metadata.values())e.add(t.group);return Array.from(e)}getMeta(e){return this.metadata.get(e)}getAll(){return Array.from(this.metadata.values())}getByName(e){return this.metadata.get(e)}getByCategory(e){return this.getAll().filter(t=>t.group===e)}getAllImplemented(){return this.getAll().filter(e=>e.implemented)}getAllWithTemplates(){return this.getAll().filter(e=>e.hasTemplate)}getClaudeCommands(){return this.getAll().filter(e=>e.usage.claude!==null)}getTerminalCommands(){return this.getAll().filter(e=>e.usage.terminal!==null)}getAllCategories(){return new Map(this.categories)}getCategory(e){return this.categories.get(e)}getRequiresInit(){return this.getAll().filter(e=>e.requiresProject)}getWithBlockingRules(){return this.getAll().filter(e=>e.blockingRules!==void 0)}getOptionalCommands(){return this.getAll().filter(e=>e.isOptional)}getDeprecatedCommands(){return this.getAll().filter(e=>e.deprecated)}getStats(){let e=this.getAll(),t={};for(let n of this.categories.keys())t[n]=e.filter(r=>r.group===n).length;return{total:e.length,implemented:e.filter(n=>n.implemented).length,withTemplates:e.filter(n=>n.hasTemplate).length,claudeOnly:e.filter(n=>n.usage.claude&&!n.usage.terminal).length,terminalOnly:e.filter(n=>!n.usage.claude&&n.usage.terminal).length,both:e.filter(n=>n.usage.claude&&n.usage.terminal).length,requiresInit:e.filter(n=>n.requiresProject).length,byCategory:t}}validate(){let e=[],t=this.getAll(),n=t.map(a=>a.name),r=n.filter((a,l)=>n.indexOf(a)!==l);r.length>0&&e.push(`Duplicate command names: ${r.join(", ")}`);let o=t.filter(a=>a.hasTemplate&&!a.implemented);o.length>0&&e.push(`Commands with templates but not implemented: ${o.map(a=>a.name).join(", ")}`);let i=Array.from(this.categories.keys());if(i.length>0){let a=t.filter(l=>!i.includes(l.group));a.length>0&&e.push(`Invalid categories: ${a.map(l=>`${l.name}:${l.group}`).join(", ")}`)}return{valid:e.length===0,issues:e}}async buildContext(e){let t=await _.getProjectId(e);if(!t)throw new Error("No prjct project found. Run /p:init first.");return{projectId:t,projectPath:e,globalPath:D.getGlobalProjectPath(t),timestamp:C()}}async execute(e,t,n=process.cwd()){let r=this.metadata.get(e),o;if(r?.requiresProject===!1)o={projectId:"",projectPath:n,globalPath:"",timestamp:C()};else try{o=await this.buildContext(n)}catch(l){return{success:!1,error:b(l)}}let i=this.handlers.get(e);if(i)return i.execute(t,o);let a=this.handlerFns.get(e);return a?a(t,o):{success:!1,error:`Command not found: ${e}`}}async executeWithoutProject(e,t,n=process.cwd()){let r=this.handlers.get(e);if(r){let i={projectId:"",projectPath:n,globalPath:"",timestamp:C()};return r.execute(t,i)}let o=this.handlerFns.get(e);if(o){let i={projectId:"",projectPath:n,globalPath:"",timestamp:C()};return o(t,i)}return{success:!1,error:`Command not found: ${e}`}}clear(){this.handlers.clear(),this.handlerFns.clear(),this.metadata.clear(),this.categories.clear()}},ct=new ym});import{execFileSync as pS}from"node:child_process";import Ic from"node:fs/promises";import ai from"node:path";async function gS(s){let e=0;try{let t=await Ic.readdir(s,{withFileTypes:!0});for(let n of t){let r=ai.join(s,n.name);if(n.isDirectory())e+=await gS(r);else try{let o=await Ic.stat(r);e+=o.size}catch{}}}catch{}return e}function wm(s){if(s===0)return"0 B";let e=["B","KB","MB","GB"],t=Math.floor(Math.log(s)/Math.log(1024));return`${(s/1024**t).toFixed(1)} ${e[t]}`}async function M0(s){try{return(await Ic.readdir(s,{withFileTypes:!0})).filter(t=>t.isDirectory()).length}catch{return 0}}function fS(){let s={homebrew:!1,npm:!1};try{pS("brew",["list","prjct-cli"],{encoding:"utf-8",stdio:["pipe","pipe","ignore"]})&&(s.homebrew=!0,s.homebrewFormula="prjct-cli")}catch{}try{pS("npm",["list","-g","prjct-cli","--depth=0"],{encoding:"utf-8",stdio:["pipe","pipe","ignore"]}).includes("prjct-cli")&&(s.npm=!0)}catch{}return s}async function hS(){let s=[],e=Dl(),t=D.getGlobalBasePath(),n=await E(t),r=n?await M0(ai.join(t,"projects")):0,o=n?await gS(t):0;s.push({path:t,type:"directory",description:`All project data${r>0?`, ${r} project${r>1?"s":""}`:""}`,size:o,count:r,exists:n});let i=ai.join(e.claude.config,"CLAUDE.md");s.push({path:i,type:"section",description:"prjct section in CLAUDE.md",exists:await mS(i)}),s.push({path:e.claude.router,type:"file",description:"Claude router",exists:await E(e.claude.router)});let a=ai.join(e.claude.config,"prjct-statusline.sh");s.push({path:a,type:"file",description:"Status line script",exists:await E(a)}),s.push({path:e.gemini.router,type:"file",description:"Gemini router",exists:await E(e.gemini.router)});let l=ai.join(e.gemini.config,"GEMINI.md");return await mS(l)&&s.push({path:l,type:"section",description:"prjct section in GEMINI.md",exists:!0}),s}async function mS(s){if(!await E(s))return!1;try{let e=await Ic.readFile(s,"utf-8");return e.includes(_c)&&e.includes(ci)}catch{return!1}}var _c,ci,km=h(()=>{"use strict";Wt();ge();J();_c="<!-- prjct:start - DO NOT REMOVE THIS MARKER -->",ci="<!-- prjct:end - DO NOT REMOVE THIS MARKER -->";c(gS,"getDirectorySize");c(wm,"formatSize");c(M0,"countDirectoryItems");c(fS,"detectInstallation");c(hS,"gatherUninstallItems");c(mS,"hasMarkerSection")});import{execFileSync as yS}from"node:child_process";import Ln from"node:fs/promises";import O0 from"node:os";import Dc from"node:path";import N0 from"node:readline";async function wS(s,e){await Ln.mkdir(e,{recursive:!0});let t=await Ln.readdir(s,{withFileTypes:!0});for(let n of t){let r=Dc.join(s,n.name),o=Dc.join(e,n.name);n.isDirectory()?await wS(r,o):await Ln.copyFile(r,o)}}async function kS(){let s=O0.homedir(),e=new Date().toISOString().replace(/[:.]/g,"-").substring(0,19),t=Dc.join(s,`.prjct-backup-${e}`);try{await Ln.mkdir(t,{recursive:!0});let n=D.getGlobalBasePath();return await E(n)&&await wS(n,Dc.join(t,".prjct-cli")),t}catch{return null}}async function L0(s){try{let e=await Ln.readFile(s,"utf-8");if(!e.includes(_c)||!e.includes(ci))return!1;let t=e.indexOf(_c),n=e.indexOf(ci)+ci.length,r=e.substring(0,t)+e.substring(n);return r=r.replace(/\n{3,}/g,`
1366
+ Custom:`);for(let i of r)console.log(` ${i.name} \u2014 ${i.description}`)}}return{success:!0,workflows:t}}async function uS(s,e,t){let n=s.trim();if(!n)return H("Usage: prjct workflow delete <name>",t);try{return mt.deleteWorkflow(e,n)?(await gm.deleteWorkflowTemplate(n),t.md?console.log(W(Ce("Workflow Deleted",`Deleted workflow: ${n}`))):jt(`deleted workflow: ${n}`),{success:!0}):H(`Workflow '${n}' not found`,t)}catch(r){return H(b(r),t)}}var dS=h(()=>{"use strict";iS();Xo();$n();L();Ee();kt();Ad();lm();c(aS,"workflowInit");c(cS,"workflowCreate");c(lS,"workflowList");c(uS,"workflowDelete")});var Jr,fm=h(()=>{"use strict";Rn();oc();Xo();dt();L();ue();Ee();kt();Jo();pe();Qd();Ie();Qt();cm();tS();oS();dS();Jr=class extends z{static{c(this,"WorkflowCommands")}async now(e=null,t=process.cwd(),n={}){try{let r=await we(t);if(!r.ok)return r.result;let o=r.value;if(!e)return this._showActiveTask(o,n);let i=await rs(o,"task","before",{projectPath:t,skipRules:n.skipHooks});if(!i.success)return{success:!1,error:i.gatesFailed.length>0?`Blocked: ${i.gatesFailed.join(", ")}`:`Hook failed: ${i.hooksFailed.join(", ")}`};let a=/^[A-Z]+-\d+$/.test(e)?e:void 0,l=e,u=Je(),d=n.spec;if(await B.startTask(o,{id:u,description:l,sessionId:Je(),linearId:a,linkedSpecId:d}),d)try{let{specService:m}=await Promise.resolve().then(()=>(ac(),rp));await m.linkTask(t,d,u)}catch{}await this.logToMemory(t,"task_started",{task:l,taskId:u,timestamp:C()}),await rs(o,"task","after",{projectPath:t,skipRules:n.skipHooks});let p=await rc(t).catch(()=>"");return n.md?console.log(W(Vo({description:l,status:"active"}),X("State",Ne([`Task: \`${u}\``,p?`Branch: \`${p}\``:null,a?`Linear: \`${a}\``:null,i.instructions.length>0?`Agent instructions: ${i.instructions.length}`:null].filter(m=>m!==null))),i.instructions.length>0?X("Agent Instructions",Ne(i.instructions)):null,Ve([{label:"Pull project memory",command:"prjct context memory <topic>"},{label:"Tag the task",command:"prjct tag type:bug domain:auth"},{label:"Capture learnings",command:'prjct remember learning "..."'},{label:"Ship when done",command:"prjct ship --md"}]))):(f.done(`Task: ${l}`),Qw("working"),Rr("task")),{success:!0,task:l,taskId:u}}catch(r){let o=b(r);return n.md?console.log(`> ${o}`):f.fail(o),{success:!1,error:o}}}async _showActiveTask(e,t){let n=await B.getCurrentTask(e);if(!n){let r='no active task. `prjct task "<description>"` to start one.';return t.md?console.log(`> ${r}`):f.info(r),{success:!0,message:"no active task"}}return t.md?console.log(W(Vo({description:n.description,status:"active"}),X("State",Ne([`Task: \`${n.id}\``,n.branch?`Branch: \`${n.branch}\``:null,n.linearId?`Linear: \`${n.linearId}\``:null,`Started: ${n.startedAt}`].filter(r=>r!==null))))):f.info(`Active: ${n.description}`),{success:!0,currentTask:n}}async workflow(e=null,t=process.cwd(),n={}){try{let r=await we(t,n);if(!r.ok)return r.result;let o=r.value,i=e?.trim()??"";if(!i)return jc(null,o,n);let a=Vb(i);switch(a.type){case"add":return zb(a.args,o,n);case"gate":return Kb(a.args,o,n);case"instruction":return Yb(a.args,o,n);case"remove":return Qb(a.args,o,n);case"disable":return eS(a.args,o,n);case"reset":return Zb(o,n);case"init":return aS(o,t,n);case"help":return rS(n);case"create":return cS(a.args,o,t,n);case"list":return lS(o,n);case"delete":return uS(a.args,o,n);case"run":return this.run(a.args,t,n);case"view":return jc(a.args||null,o,n);default:return jc(i.split(/\s+/)[0]?.toLowerCase()||null,o,n)}}catch(r){return n.md?console.log(`> Error: ${b(r)}`):f.fail(b(r)),Oe(r)}}async run(e,t=process.cwd(),n={}){try{let r=await we(t,n);if(!r.ok)return r.result;let o=r.value,i=e.trim();if(!i){let u="Usage: prjct workflow run <name>";return n.md?console.log(`> ${u}`):f.warn(u),{success:!1,error:u}}let a=mt.getWorkflow(o,i);if(!a||!a.enabled){let u=`Workflow '${i}' not found`;return n.md?console.log(`> ${u}`):f.warn(u),{success:!1,error:u}}let l=await rs(o,i,"before",{projectPath:t});if(!l.success){if(n.md)zw("failed","workflow_gates_failed",[{label:"View rules",command:`prjct workflow ${i} --md`}]);else if(f.fail("Workflow gates failed"),l.gatesFailed)for(let u of l.gatesFailed)console.log(` \u2717 ${u}`);return{success:!1,error:"Workflow gates failed",gatesFailed:l.gatesFailed}}return await rs(o,i,"after",{projectPath:t}),n.md?console.log(W(Ce(`Workflow: ${i}`,a.description||""),Ve([{label:"View rules",command:`prjct workflow ${i} --md`},{label:"Run again",command:`p. ${i}`}]))):f.done(`${i} completed successfully`),{success:!0,workflow:i}}catch(r){let o=b(r);return n.md?console.log(`> Error: ${o}`):f.fail(o),{success:!1,error:o}}}}});var cs,B8,hm=h(()=>{"use strict";bc();Op();Np();Tc();ri();Wp();vc();Gp();Cc();Kp();kc();Qp();tm();am();fm();cs=class{static{c(this,"PrjctCommands")}workflow;planning;shipping;analysis;setupCmds;updateCmds;contextCmds;primitivesCmds;seedCmds;installCmds;captureCmds;mcpCmds;teamCmds;configCmds;specCmds;agent;agentInfo;currentAuthor;prjctDir;constructor(){this.workflow=new Jr,this.planning=new Ns,this.shipping=new Os,this.analysis=new Ls,this.setupCmds=new Fr,this.updateCmds=new qr,this.contextCmds=new is,this.primitivesCmds=new Nr,this.seedCmds=new Us,this.installCmds=new Fs,this.captureCmds=new Dr,this.mcpCmds=new Or,this.teamCmds=new Gr,this.configCmds=new Mr,this.specCmds=new Ur,this.agent=null,this.agentInfo=null,this.currentAuthor=null,this.prjctDir=".prjct"}async task(e=null,t=process.cwd(),n={}){return this.workflow.now(e,t,n)}async workflowPrefs(e=null,t=process.cwd(),n={}){return this.workflow.workflow(e,t,n)}async init(e=null,t=process.cwd()){return this.planning.init(e,t)}async ship(e,t=process.cwd(),n={}){return this.shipping.ship(e,t,{...n})}async analyze(e={},t=process.cwd()){return this.analysis.analyze(e,t)}async sync(e=process.cwd(),t={}){return this.analysis.sync(e,t)}async saveLlmAnalysis(e,t=process.cwd(),n={}){return this.analysis.saveLlmAnalysis(e,t,n)}async regenVault(e=process.cwd(),t={}){return this.analysis.regenVault(e,t)}async context(e=null,t=process.cwd(),n={}){return this.contextCmds.context(e,t,n)}async status(e=null,t=process.cwd(),n={}){return this.primitivesCmds.status(e,t,n)}async tag(e=null,t=process.cwd(),n={}){return this.primitivesCmds.tag(e,t,n)}async remember(e=null,t=process.cwd(),n={}){return this.primitivesCmds.remember(e,t,n)}async seed(e=null,t=process.cwd(),n={}){return this.seedCmds.seed(e,t,n)}async install(e=null,t=process.cwd(),n={}){return this.installCmds.install(null,t,n)}async capture(e=null,t=process.cwd(),n={}){return this.captureCmds.capture(e,t,n)}async mcp(e=null,t=process.cwd(),n={}){return this.mcpCmds.mcp(e,t,n)}async team(e=null,t=process.cwd(),n={}){return this.teamCmds.team(e,t,n)}async config(e=null,t=process.cwd(),n={}){return this.configCmds.config(e,t,n)}async auth(e=null,t={}){return this.setupCmds.auth(e,t)}async login(e={}){return this.setupCmds.login(e)}async logout(){return this.setupCmds.logout()}async start(){return this.setupCmds.start()}async setup(e={}){return this.setupCmds.setup(e)}async update(e={},t=process.cwd()){return this.updateCmds.update(e,t)}async installStatusLine(){return this.setupCmds.installStatusLine()}showAsciiArt(){this.setupCmds.showAsciiArt()}async initializeAgent(){return this.workflow.initializeAgent()}async ensureProjectInit(e){return this.workflow.ensureProjectInit(e)}async ensureAuthor(){return this.workflow.ensureAuthor()}async getGlobalProjectPath(e){return this.workflow.getGlobalProjectPath(e)}async logToMemory(e,t,n){return this.workflow.logToMemory(e,t,n)}async spec(e=null,t=process.cwd(),n={}){return this.specCmds.draft(e,t,n)}async specList(e=process.cwd(),t={}){return this.specCmds.list(null,e,t)}async specShow(e=null,t=process.cwd(),n={}){return this.specCmds.show(e,t,n)}async specUpdate(e=null,t=process.cwd(),n={}){return this.specCmds.update(e,t,n)}async specSetStatus(e=null,t=process.cwd(),n={}){return this.specCmds.setStatus(e,t,n)}async specRecordReview(e=null,t=process.cwd(),n={}){return this.specCmds.recordReview(e,t,n)}async specLinkTask(e=null,t=process.cwd(),n={}){return this.specCmds.linkTask(e,t,n)}async specShip(e=null,t=process.cwd(),n={}){return this.specCmds.ship(e,t,n)}async specAudit(e=null,t=process.cwd(),n={}){return this.specCmds.audit(e,t,n)}async specBreakdown(e=null,t=process.cwd(),n={}){return this.specCmds.breakdown(e,t,n)}async specInventory(e=process.cwd(),t={}){return this.specCmds.inventory(null,e,t)}},B8=new cs});var ym,ct,Xr=h(()=>{"use strict";oe();ge();L();ue();ym=class{static{c(this,"CommandRegistry")}handlers=new Map;handlerFns=new Map;metadata=new Map;categories=new Map;noProjectCommands=new Set(["init","setup","start","migrateAll"]);register(e,t){this.handlers.set(e.name,e),this.setMeta(e.name,t)}registerFn(e,t,n){this.handlerFns.set(e,t),this.setMeta(e,n)}setMeta(e,t){let n=t?.requiresProject??!this.noProjectCommands.has(e);this.metadata.set(e,{name:e,group:t?.group??"unknown",description:t?.description??"",requiresProject:n,usage:t?.usage??{claude:null,terminal:null},implemented:t?.implemented??!0,hasTemplate:t?.hasTemplate??!1,params:t?.params,blockingRules:t?.blockingRules,features:t?.features,isOptional:t?.isOptional,deprecated:t?.deprecated,replacedBy:t?.replacedBy})}registerCategory(e,t){this.categories.set(e,t)}registerMethod(e,t,n,r){let o=t[n];if(typeof o!="function")throw new Error(`${String(n)} is not a function`);let i=c(async(a,l)=>a!=null?o.call(t,a,l.projectPath):o.call(t,l.projectPath),"wrapper");this.handlerFns.set(e,i),this.setMeta(e,r)}has(e){return this.handlers.has(e)||this.handlerFns.has(e)}list(){return[...this.handlers.keys(),...this.handlerFns.keys()]}listByGroup(e){return Array.from(this.metadata.entries()).filter(([,t])=>t.group===e).map(([t])=>t)}getGroups(){let e=new Set;for(let t of this.metadata.values())e.add(t.group);return Array.from(e)}getMeta(e){return this.metadata.get(e)}getAll(){return Array.from(this.metadata.values())}getByName(e){return this.metadata.get(e)}getByCategory(e){return this.getAll().filter(t=>t.group===e)}getAllImplemented(){return this.getAll().filter(e=>e.implemented)}getAllWithTemplates(){return this.getAll().filter(e=>e.hasTemplate)}getClaudeCommands(){return this.getAll().filter(e=>e.usage.claude!==null)}getTerminalCommands(){return this.getAll().filter(e=>e.usage.terminal!==null)}getAllCategories(){return new Map(this.categories)}getCategory(e){return this.categories.get(e)}getRequiresInit(){return this.getAll().filter(e=>e.requiresProject)}getWithBlockingRules(){return this.getAll().filter(e=>e.blockingRules!==void 0)}getOptionalCommands(){return this.getAll().filter(e=>e.isOptional)}getDeprecatedCommands(){return this.getAll().filter(e=>e.deprecated)}getStats(){let e=this.getAll(),t={};for(let n of this.categories.keys())t[n]=e.filter(r=>r.group===n).length;return{total:e.length,implemented:e.filter(n=>n.implemented).length,withTemplates:e.filter(n=>n.hasTemplate).length,claudeOnly:e.filter(n=>n.usage.claude&&!n.usage.terminal).length,terminalOnly:e.filter(n=>!n.usage.claude&&n.usage.terminal).length,both:e.filter(n=>n.usage.claude&&n.usage.terminal).length,requiresInit:e.filter(n=>n.requiresProject).length,byCategory:t}}validate(){let e=[],t=this.getAll(),n=t.map(a=>a.name),r=n.filter((a,l)=>n.indexOf(a)!==l);r.length>0&&e.push(`Duplicate command names: ${r.join(", ")}`);let o=t.filter(a=>a.hasTemplate&&!a.implemented);o.length>0&&e.push(`Commands with templates but not implemented: ${o.map(a=>a.name).join(", ")}`);let i=Array.from(this.categories.keys());if(i.length>0){let a=t.filter(l=>!i.includes(l.group));a.length>0&&e.push(`Invalid categories: ${a.map(l=>`${l.name}:${l.group}`).join(", ")}`)}return{valid:e.length===0,issues:e}}async buildContext(e){let t=await _.getProjectId(e);if(!t)throw new Error("No prjct project found. Run /p:init first.");return{projectId:t,projectPath:e,globalPath:D.getGlobalProjectPath(t),timestamp:C()}}async execute(e,t,n=process.cwd()){let r=this.metadata.get(e),o;if(r?.requiresProject===!1)o={projectId:"",projectPath:n,globalPath:"",timestamp:C()};else try{o=await this.buildContext(n)}catch(l){return{success:!1,error:b(l)}}let i=this.handlers.get(e);if(i)return i.execute(t,o);let a=this.handlerFns.get(e);return a?a(t,o):{success:!1,error:`Command not found: ${e}`}}async executeWithoutProject(e,t,n=process.cwd()){let r=this.handlers.get(e);if(r){let i={projectId:"",projectPath:n,globalPath:"",timestamp:C()};return r.execute(t,i)}let o=this.handlerFns.get(e);if(o){let i={projectId:"",projectPath:n,globalPath:"",timestamp:C()};return o(t,i)}return{success:!1,error:`Command not found: ${e}`}}clear(){this.handlers.clear(),this.handlerFns.clear(),this.metadata.clear(),this.categories.clear()}},ct=new ym});import{execFileSync as pS}from"node:child_process";import Ic from"node:fs/promises";import ai from"node:path";async function gS(s){let e=0;try{let t=await Ic.readdir(s,{withFileTypes:!0});for(let n of t){let r=ai.join(s,n.name);if(n.isDirectory())e+=await gS(r);else try{let o=await Ic.stat(r);e+=o.size}catch{}}}catch{}return e}function wm(s){if(s===0)return"0 B";let e=["B","KB","MB","GB"],t=Math.floor(Math.log(s)/Math.log(1024));return`${(s/1024**t).toFixed(1)} ${e[t]}`}async function M0(s){try{return(await Ic.readdir(s,{withFileTypes:!0})).filter(t=>t.isDirectory()).length}catch{return 0}}function fS(){let s={homebrew:!1,npm:!1};try{pS("brew",["list","prjct-cli"],{encoding:"utf-8",stdio:["pipe","pipe","ignore"]})&&(s.homebrew=!0,s.homebrewFormula="prjct-cli")}catch{}try{pS("npm",["list","-g","prjct-cli","--depth=0"],{encoding:"utf-8",stdio:["pipe","pipe","ignore"]}).includes("prjct-cli")&&(s.npm=!0)}catch{}return s}async function hS(){let s=[],e=Dl(),t=D.getGlobalBasePath(),n=await E(t),r=n?await M0(ai.join(t,"projects")):0,o=n?await gS(t):0;s.push({path:t,type:"directory",description:`All project data${r>0?`, ${r} project${r>1?"s":""}`:""}`,size:o,count:r,exists:n});let i=ai.join(e.claude.config,"CLAUDE.md");s.push({path:i,type:"section",description:"prjct section in CLAUDE.md",exists:await mS(i)}),s.push({path:e.claude.router,type:"file",description:"Claude router",exists:await E(e.claude.router)});let a=ai.join(e.claude.config,"prjct-statusline.sh");s.push({path:a,type:"file",description:"Status line script",exists:await E(a)}),s.push({path:e.gemini.router,type:"file",description:"Gemini router",exists:await E(e.gemini.router)});let l=ai.join(e.gemini.config,"GEMINI.md");return await mS(l)&&s.push({path:l,type:"section",description:"prjct section in GEMINI.md",exists:!0}),s}async function mS(s){if(!await E(s))return!1;try{let e=await Ic.readFile(s,"utf-8");return e.includes(_c)&&e.includes(ci)}catch{return!1}}var _c,ci,km=h(()=>{"use strict";Wt();ge();J();_c="<!-- prjct:start - DO NOT REMOVE THIS MARKER -->",ci="<!-- prjct:end - DO NOT REMOVE THIS MARKER -->";c(gS,"getDirectorySize");c(wm,"formatSize");c(M0,"countDirectoryItems");c(fS,"detectInstallation");c(hS,"gatherUninstallItems");c(mS,"hasMarkerSection")});import{execFileSync as yS}from"node:child_process";import Ln from"node:fs/promises";import O0 from"node:os";import Dc from"node:path";import N0 from"node:readline";async function wS(s,e){await Ln.mkdir(e,{recursive:!0});let t=await Ln.readdir(s,{withFileTypes:!0});for(let n of t){let r=Dc.join(s,n.name),o=Dc.join(e,n.name);n.isDirectory()?await wS(r,o):await Ln.copyFile(r,o)}}async function kS(){let s=O0.homedir(),e=new Date().toISOString().replace(/[:.]/g,"-").substring(0,19),t=Dc.join(s,`.prjct-backup-${e}`);try{await Ln.mkdir(t,{recursive:!0});let n=D.getGlobalBasePath();return await E(n)&&await wS(n,Dc.join(t,".prjct-cli")),t}catch{return null}}async function L0(s){try{let e=await Ln.readFile(s,"utf-8");if(!e.includes(_c)||!e.includes(ci))return!1;let t=e.indexOf(_c),n=e.indexOf(ci)+ci.length,r=e.substring(0,t)+e.substring(n);return r=r.replace(/\n{3,}/g,`
1367
1367
 
1368
1368
  `).trim(),!r||r.trim().length===0?await Ln.unlink(s):await Ln.writeFile(s,`${r}
1369
1369
  `,"utf-8"),!0}catch{return!1}}async function vS(s,e,t){let n=[],r=[];for(let o of s)if(o.exists)try{o.type==="section"?await L0(o.path)&&n.push(o.path):o.type==="directory"?(await Ln.rm(o.path,{recursive:!0,force:!0}),n.push(o.path)):o.type==="file"&&(await Ln.unlink(o.path),n.push(o.path))}catch(i){r.push(`${o.path}: ${b(i)}`)}try{await new cn().cleanupLegacyCommands()}catch{}if(!t.keepPackage){if(e.homebrew&&e.homebrewFormula)try{t.dryRun||yS("brew",["uninstall",e.homebrewFormula],{stdio:"pipe"}),n.push("Homebrew: prjct-cli")}catch(o){r.push(`Homebrew: ${b(o)}`)}if(e.npm)try{t.dryRun||yS("npm",["uninstall","-g","prjct-cli"],{stdio:"pipe"}),n.push("npm: prjct-cli")}catch(o){r.push(`npm: ${b(o)}`)}}return{deleted:n,errors:r}}async function bS(s){let e=N0.createInterface({input:process.stdin,output:process.stdout});return new Promise(t=>{e.question(s,n=>{e.close(),t(n.toLowerCase()==="uninstall")})})}var SS=h(()=>{"use strict";Wt();ge();L();J();km();c(wS,"copyDirectory");c(kS,"createBackup");c(L0,"removePrjctSection");c(vS,"performUninstall");c(bS,"promptConfirmation")});var ES={};M(ES,{UninstallCommands:()=>li,uninstall:()=>TS});import xe from"chalk";async function TS(s={},e=process.cwd()){let t=await hS(),n=fS(),r=t.filter(l=>l.exists);if(r.length===0&&!n.homebrew&&!n.npm)return console.log(xe.yellow(`
@@ -1633,7 +1633,7 @@ ${ee.yellow(`Command '${s}' not found.`)}
1633
1633
 
1634
1634
  Run 'prjct help' to see all available commands.
1635
1635
  `}function nM(){let s=[];s.push(""),s.push(ee.cyan.bold("All Commands")),s.push("");let e=Object.entries(fo).sort((t,n)=>t[1].order-n[1].order);for(let[t,n]of e){let r=Hn.filter(o=>o.group===t);if(r.length!==0){s.push(`${ee.bold(n.title)} ${ee.dim(`(${r.length} commands)`)}`),s.push(ee.dim(n.description)),s.push("");for(let o of r){let i=`p. ${o.name}`.padEnd(18),a=o.description.length>45?`${o.description.slice(0,42)}...`:o.description;s.push(` ${i} ${a}`)}s.push("")}}return s.push(ee.dim("Run 'prjct help <command>' for detailed help on a specific command.")),s.push(""),s.join(`
1636
- `)}function sM(s){return s?s==="commands"||s==="all"?nM():tM(s):QD()}var vE,YD,SE=h(()=>{"use strict";vi();Ge();vE=[{name:"start",description:"First-time setup wizard",example:"prjct start"},{name:"init",description:"Initialize project in current directory",example:"prjct init"},{name:"sync",description:"Sync project state and update context files",example:"prjct sync"},{name:"watch",description:"Auto-sync on file changes",example:"prjct watch",options:["--verbose","--debounce=<ms>","--interval=<sec>"]},{name:"hooks",description:"Manage git hooks for auto-sync",example:"prjct hooks install",subcommands:["install","uninstall","status"]},{name:"doctor",description:"Check system health and dependencies",example:"prjct doctor"},{name:"context",description:"Smart context filtering tools for AI",example:'prjct context files "add auth"',subcommands:["files","signatures","imports","recent","summary"]},{name:"stop",description:"Stop the background daemon",example:"prjct stop",options:["--force"]},{name:"restart",description:"Restart the background daemon",example:"prjct restart"},{name:"uninstall",description:"Complete system removal of prjct",example:"prjct uninstall --backup",options:["--force","--backup","--dry-run","--keep-package"]}],YD=[{flag:"-q, --quiet",description:"Suppress all output (errors to stderr only)"},{flag:"-v, --version",description:"Show version and provider status"},{flag:"-h, --help",description:"Show this help message"}];c(QD,"formatMainHelp");c(ZD,"formatTerminalCommandHelp");c(eM,"formatAgentCommandHelp");c(tM,"formatCommandHelp");c(nM,"formatCommandList");c(sM,"getHelp")});var TE=ME((Z9,rM)=>{rM.exports={name:"prjct-cli",version:"2.24.2",description:"Context layer for AI agents. Project context for Claude Code, Gemini CLI, and more.",main:"dist/bin/prjct.mjs",bin:{prjct:"bin/prjct"},publishConfig:{access:"public",registry:"https://registry.npmjs.org"},scripts:{build:"node scripts/build.js","build:node":"node scripts/build.js",release:"node scripts/release.js","release:patch":"node scripts/release.js patch","release:minor":"node scripts/release.js minor","release:major":"node scripts/release.js major",postinstall:"node scripts/postinstall.js",prepare:"lefthook install","update-commands":`bun -e "const installer = require('./core/infrastructure/command-installer'); installer.syncCommands().then(r => console.log('Commands updated:', r)).catch(e => console.error('Error:', e.message))"`,"install-global":"./scripts/install.sh",update:"./scripts/update.sh",test:"bun test","test:watch":"bun test --watch","test:coverage":"bun test --coverage",typecheck:"tsc --noEmit -p core/tsconfig.json","typecheck:watch":"tsc --noEmit -p core/tsconfig.json --watch",validate:"bun scripts/validate-commands.js",lint:"biome lint .","lint:fix":"biome lint --write .",knip:"knip","lint:meta":"bun core/cli/lint-meta-commentary.ts",format:"biome format --write .","format:check":"biome format .",check:"biome check .","check:fix":"biome check --write .","test:e2e":"bun test core/__tests__/e2e/"},keywords:["claude-code","gemini-cli","ai-agents","context-layer","developer-tools","ai-assistant","productivity","mcp","llm","coding-agents"],author:"prjct.app",license:"MIT",dependencies:{"@clack/prompts":"1.0.0","@modelcontextprotocol/sdk":"1.29.0","better-sqlite3":"12.9.0",chalk:"4.1.2",chokidar:"5.0.0","date-fns":"4.1.0",glob:"13.0.1","jsonc-parser":"3.3.1",zod:"3.25.76"},overrides:{"path-to-regexp":"8.4.0","brace-expansion":"5.0.5","fast-uri":">=3.1.2",hono:">=4.12.18","ip-address":">=10.1.1"},devDependencies:{"@biomejs/biome":"2.3.13","@types/better-sqlite3":"7.6.13","@types/bun":"latest","@types/chokidar":"2.1.7",esbuild:"0.25.0",knip:"6.3.1",lefthook:"2.1.0",typescript:"5.9.3"},repository:{type:"git",url:"git+https://github.com/jlopezlira/prjct-cli.git"},bugs:{url:"https://github.com/jlopezlira/prjct-cli/issues"},homepage:"https://prjct.app",packageManager:"bun@1.2.23",engines:{bun:">=1.0.0",node:">=22.22.2"},files:["assets/","bin/prjct","dist/","templates/","scripts/ensure-native-deps.js","scripts/postinstall.js","scripts/ensure-bun.sh","scripts/install.sh","LICENSE","README.md","CHANGELOG.md"],prepublishOnly:"node scripts/build.js",trustedDependencies:["better-sqlite3","chalk"]}});var uM={};import EE from"node:os";import Xc from"node:path";import Le from"chalk";async function oM(){let[s,...e]=process.argv.slice(2);if(["-v","--version","version"].includes(s)){let n=await Promise.resolve().then(()=>OE(TE()));await cM(n.version),process.exit(0)}if(["-h","--help",void 0].includes(s)&&(lM(),process.exit(0)),s&&Oc(s)&&!ct.getByName(s)){let n=Mc[s];n&&(f.failWithHint({message:`'prjct ${s}' was removed in v2. ${n.note}`,hint:`Use: ${n.replacement}`}),process.exit(1))}if(s&&!ct.getByName(s)&&!(e.length===0&&ui(s)!==null)){let r=[s,...e.filter(i=>!i.startsWith("-"))].join(" "),o=e.filter(i=>i.startsWith("-"));s="capture",e=[r,...o]}let t=e.includes("--md");t||f.start();try{let n=ct.getByName(s);if(!n){let m=ui(s),g=m?`Did you mean 'prjct ${m}'? Run 'prjct --help' for all commands`:"Run 'prjct --help' to see available commands";f.failWithHint(xo("UNKNOWN_COMMAND",{message:`Unknown command: ${s}`,hint:g})),t||f.end(),process.exit(1)}if(n.deprecated){let m=n.replacedBy?`Use 'prjct ${n.replacedBy}' instead`:"Run 'prjct --help' to see available commands";f.failWithHint({message:`Command '${s}' is deprecated`,hint:m}),t||f.end(),process.exit(1)}n.implemented||(f.failWithHint({message:`Command '${s}' is not yet implemented`,hint:"Run 'prjct --help' to see available commands",docs:"https://github.com/jlopezlira/prjct-cli"}),t||f.end(),process.exit(1));let{parsedArgs:r,options:o}=aM(n,e),i=!process.stdin.isTTY||o.md===!0||o.json===!0;n.requiresLlm&&!i&&(f.failWithHint({message:`'prjct ${s}' requires an AI agent to process its output`,hint:`Use 'p. ${s}' inside Claude/Cursor, or add --md flag`}),t||f.end(),process.exit(1));let a=iM(n,r);a&&(f.failWithHint(a),t||f.end(),process.exit(1));let l=null,u=Date.now();try{l=await _.getProjectId(process.cwd()),l&&(await pr.expireIfStale(l),await pr.touch(l))}catch{}let d=new cs,p;if(s==="analyze")p=await d.analyze(o);else if(s==="setup")p=await d.setup(o);else if(s==="update"||s==="upgrade")p=await d.update(o);else{let m=r.join(" ")||null,g=o.md===!0,T={task:c(y=>d.task(y,process.cwd(),{md:g,spec:o.spec?String(o.spec):void 0}),"task"),spec:c(y=>Nc(d,(y??"").trim().split(/\s+/).filter(Boolean),o,process.cwd()),"spec"),"audit-spec":c(y=>y?d.specAudit(y,process.cwd(),{md:g}):Promise.resolve({success:!1,error:"audit-spec requires a spec id"}),"audit-spec"),init:c(y=>d.init({idea:y,yes:o.yes===!0,pack:o.pack?String(o.pack):void 0,persona:o.persona?String(o.persona):void 0}),"init"),ship:c(y=>d.ship(y,process.cwd(),{md:g,noSpecGate:o["no-spec-gate"]===!0}),"ship"),workflow:c(y=>d.workflowPrefs(y,process.cwd(),{md:g}),"workflow"),sync:c(()=>d.sync(process.cwd(),{preview:o.preview===!0||o["dry-run"]===!0,yes:o.yes===!0,json:o.json===!0,md:g,package:o.package?String(o.package):void 0,full:o.full===!0}),"sync"),"analysis-save-llm":c(y=>y?d.saveLlmAnalysis(y,process.cwd(),{md:g}):Promise.resolve({success:!1,error:"analysis-save-llm requires a JSON payload as positional arg"}),"analysis-save-llm"),regen:c(()=>d.regenVault(process.cwd(),{md:g}),"regen"),start:c(()=>d.start(),"start"),context:c(y=>d.context(y),"context"),status:c(y=>d.status(y,process.cwd(),{md:g}),"status"),tag:c(y=>d.tag(y,process.cwd(),{md:g}),"tag"),remember:c(y=>d.remember(y,process.cwd(),{md:g,tags:o.tags?String(o.tags):void 0}),"remember"),login:c(()=>d.login({md:g,url:o.url?String(o.url):void 0}),"login"),logout:c(()=>d.logout(),"logout"),auth:c(y=>d.auth(y,{md:g}),"auth"),seed:c(y=>d.seed(y,process.cwd(),{md:g}),"seed"),install:c(()=>d.install(null,process.cwd(),{md:g}),"install"),capture:c(y=>d.capture(y,process.cwd(),{md:g,tags:o.tags?String(o.tags):void 0,force:o.force===!0}),"capture"),mcp:c(y=>d.mcp(y,process.cwd(),{md:g}),"mcp")}[s];if(T)p=await T(m);else throw new Error(`Command '${s}' has no handler`)}if(l){let m=Date.now()-u;try{await pr.trackCommand(l,s,m)}catch{}try{await Ao.recordTiming(l,"command_duration",m,{command:s});let g=globalThis.__perfStartNs;if(g){let k=Number(process.hrtime.bigint()-g)/1e6;await Ao.recordTiming(l,"startup_time",k)}await Ao.recordMemory(l,{command:s})}catch{}}p?.message&&console.log(p.message),t||f.end(),process.exit(p?.success?0:1)}catch(n){console.error("Error:",b(n)),process.env.DEBUG&&console.error(il(n)),t||f.end(),process.exit(1)}}function iM(s,e){if(!s.params)return null;let t=s.params.match(/<[^>]+>/g);if(!t||t.length===0)return null;if(e.length<t.length){let n=t.map(o=>o.slice(1,-1)).join(", "),r=s.usage.terminal||`prjct ${s.name} ${s.params}`;return xo("MISSING_PARAM",{message:`Missing required parameter: ${n}`,hint:`Usage: ${r}`})}return null}function aM(s,e){let t=[],n={};for(let r=0;r<e.length;r++){let o=e[r];if(o.startsWith("--")){let i=o.slice(2);r+1<e.length&&!e[r+1].startsWith("--")?n[i]=e[++r]:n[i]=!0}else t.push(o)}return{parsedArgs:t,options:n}}async function cM(s){let e=await Tn(),t=Xc.join(EE.homedir(),".claude","commands","p.md"),n=Xc.join(EE.homedir(),".gemini","commands","p.toml"),[r,o,i,a]=await Promise.all([E(t),E(n),E(Xc.join(process.cwd(),".cursor","commands","sync.md")),E(Xc.join(process.cwd(),".cursor"))]),l=await So();if(console.log(`
1636
+ `)}function sM(s){return s?s==="commands"||s==="all"?nM():tM(s):QD()}var vE,YD,SE=h(()=>{"use strict";vi();Ge();vE=[{name:"start",description:"First-time setup wizard",example:"prjct start"},{name:"init",description:"Initialize project in current directory",example:"prjct init"},{name:"sync",description:"Sync project state and update context files",example:"prjct sync"},{name:"watch",description:"Auto-sync on file changes",example:"prjct watch",options:["--verbose","--debounce=<ms>","--interval=<sec>"]},{name:"hooks",description:"Manage git hooks for auto-sync",example:"prjct hooks install",subcommands:["install","uninstall","status"]},{name:"doctor",description:"Check system health and dependencies",example:"prjct doctor"},{name:"context",description:"Smart context filtering tools for AI",example:'prjct context files "add auth"',subcommands:["files","signatures","imports","recent","summary"]},{name:"stop",description:"Stop the background daemon",example:"prjct stop",options:["--force"]},{name:"restart",description:"Restart the background daemon",example:"prjct restart"},{name:"uninstall",description:"Complete system removal of prjct",example:"prjct uninstall --backup",options:["--force","--backup","--dry-run","--keep-package"]}],YD=[{flag:"-q, --quiet",description:"Suppress all output (errors to stderr only)"},{flag:"-v, --version",description:"Show version and provider status"},{flag:"-h, --help",description:"Show this help message"}];c(QD,"formatMainHelp");c(ZD,"formatTerminalCommandHelp");c(eM,"formatAgentCommandHelp");c(tM,"formatCommandHelp");c(nM,"formatCommandList");c(sM,"getHelp")});var TE=ME((Z9,rM)=>{rM.exports={name:"prjct-cli",version:"2.24.3",description:"Context layer for AI agents. Project context for Claude Code, Gemini CLI, and more.",main:"dist/bin/prjct.mjs",bin:{prjct:"bin/prjct"},publishConfig:{access:"public",registry:"https://registry.npmjs.org"},scripts:{build:"node scripts/build.js","build:node":"node scripts/build.js",release:"node scripts/release.js","release:patch":"node scripts/release.js patch","release:minor":"node scripts/release.js minor","release:major":"node scripts/release.js major",postinstall:"node scripts/postinstall.js",prepare:"lefthook install","update-commands":`bun -e "const installer = require('./core/infrastructure/command-installer'); installer.syncCommands().then(r => console.log('Commands updated:', r)).catch(e => console.error('Error:', e.message))"`,"install-global":"./scripts/install.sh",update:"./scripts/update.sh",test:"bun test","test:watch":"bun test --watch","test:coverage":"bun test --coverage",typecheck:"tsc --noEmit -p core/tsconfig.json","typecheck:watch":"tsc --noEmit -p core/tsconfig.json --watch",validate:"bun scripts/validate-commands.js",lint:"biome lint .","lint:fix":"biome lint --write .",knip:"knip","lint:meta":"bun core/cli/lint-meta-commentary.ts",format:"biome format --write .","format:check":"biome format .",check:"biome check .","check:fix":"biome check --write .","test:e2e":"bun test core/__tests__/e2e/"},keywords:["claude-code","gemini-cli","ai-agents","context-layer","developer-tools","ai-assistant","productivity","mcp","llm","coding-agents"],author:"prjct.app",license:"MIT",dependencies:{"@clack/prompts":"1.0.0","@modelcontextprotocol/sdk":"1.29.0","better-sqlite3":"12.9.0",chalk:"4.1.2",chokidar:"5.0.0","date-fns":"4.1.0",glob:"13.0.1","jsonc-parser":"3.3.1",zod:"3.25.76"},overrides:{"path-to-regexp":"8.4.0","brace-expansion":"5.0.5","fast-uri":">=3.1.2",hono:">=4.12.18","ip-address":">=10.1.1"},devDependencies:{"@biomejs/biome":"2.3.13","@types/better-sqlite3":"7.6.13","@types/bun":"latest","@types/chokidar":"2.1.7",esbuild:"0.25.0",knip:"6.3.1",lefthook:"2.1.0",typescript:"5.9.3"},repository:{type:"git",url:"git+https://github.com/jlopezlira/prjct-cli.git"},bugs:{url:"https://github.com/jlopezlira/prjct-cli/issues"},homepage:"https://prjct.app",packageManager:"bun@1.2.23",engines:{bun:">=1.0.0",node:">=22.22.2"},files:["assets/","bin/prjct","dist/","templates/","scripts/ensure-native-deps.js","scripts/postinstall.js","scripts/ensure-bun.sh","scripts/install.sh","LICENSE","README.md","CHANGELOG.md"],prepublishOnly:"node scripts/build.js",trustedDependencies:["better-sqlite3","chalk"]}});var uM={};import EE from"node:os";import Xc from"node:path";import Le from"chalk";async function oM(){let[s,...e]=process.argv.slice(2);if(["-v","--version","version"].includes(s)){let n=await Promise.resolve().then(()=>OE(TE()));await cM(n.version),process.exit(0)}if(["-h","--help",void 0].includes(s)&&(lM(),process.exit(0)),s&&Oc(s)&&!ct.getByName(s)){let n=Mc[s];n&&(f.failWithHint({message:`'prjct ${s}' was removed in v2. ${n.note}`,hint:`Use: ${n.replacement}`}),process.exit(1))}if(s&&!ct.getByName(s)&&!(e.length===0&&ui(s)!==null)){let r=[s,...e.filter(i=>!i.startsWith("-"))].join(" "),o=e.filter(i=>i.startsWith("-"));s="capture",e=[r,...o]}let t=e.includes("--md");t||f.start();try{let n=ct.getByName(s);if(!n){let m=ui(s),g=m?`Did you mean 'prjct ${m}'? Run 'prjct --help' for all commands`:"Run 'prjct --help' to see available commands";f.failWithHint(xo("UNKNOWN_COMMAND",{message:`Unknown command: ${s}`,hint:g})),t||f.end(),process.exit(1)}if(n.deprecated){let m=n.replacedBy?`Use 'prjct ${n.replacedBy}' instead`:"Run 'prjct --help' to see available commands";f.failWithHint({message:`Command '${s}' is deprecated`,hint:m}),t||f.end(),process.exit(1)}n.implemented||(f.failWithHint({message:`Command '${s}' is not yet implemented`,hint:"Run 'prjct --help' to see available commands",docs:"https://github.com/jlopezlira/prjct-cli"}),t||f.end(),process.exit(1));let{parsedArgs:r,options:o}=aM(n,e),i=!process.stdin.isTTY||o.md===!0||o.json===!0;n.requiresLlm&&!i&&(f.failWithHint({message:`'prjct ${s}' requires an AI agent to process its output`,hint:`Use 'p. ${s}' inside Claude/Cursor, or add --md flag`}),t||f.end(),process.exit(1));let a=iM(n,r);a&&(f.failWithHint(a),t||f.end(),process.exit(1));let l=null,u=Date.now();try{l=await _.getProjectId(process.cwd()),l&&(await pr.expireIfStale(l),await pr.touch(l))}catch{}let d=new cs,p;if(s==="analyze")p=await d.analyze(o);else if(s==="setup")p=await d.setup(o);else if(s==="update"||s==="upgrade")p=await d.update(o);else{let m=r.join(" ")||null,g=o.md===!0,T={task:c(y=>d.task(y,process.cwd(),{md:g,spec:o.spec?String(o.spec):void 0}),"task"),spec:c(y=>Nc(d,(y??"").trim().split(/\s+/).filter(Boolean),o,process.cwd()),"spec"),"audit-spec":c(y=>y?d.specAudit(y,process.cwd(),{md:g}):Promise.resolve({success:!1,error:"audit-spec requires a spec id"}),"audit-spec"),init:c(y=>d.init({idea:y,yes:o.yes===!0,pack:o.pack?String(o.pack):void 0,persona:o.persona?String(o.persona):void 0}),"init"),ship:c(y=>d.ship(y,process.cwd(),{md:g,noSpecGate:o["no-spec-gate"]===!0}),"ship"),workflow:c(y=>d.workflowPrefs(y,process.cwd(),{md:g}),"workflow"),sync:c(()=>d.sync(process.cwd(),{preview:o.preview===!0||o["dry-run"]===!0,yes:o.yes===!0,json:o.json===!0,md:g,package:o.package?String(o.package):void 0,full:o.full===!0}),"sync"),"analysis-save-llm":c(y=>y?d.saveLlmAnalysis(y,process.cwd(),{md:g}):Promise.resolve({success:!1,error:"analysis-save-llm requires a JSON payload as positional arg"}),"analysis-save-llm"),regen:c(()=>d.regenVault(process.cwd(),{md:g}),"regen"),start:c(()=>d.start(),"start"),context:c(y=>d.context(y),"context"),status:c(y=>d.status(y,process.cwd(),{md:g}),"status"),tag:c(y=>d.tag(y,process.cwd(),{md:g}),"tag"),remember:c(y=>d.remember(y,process.cwd(),{md:g,tags:o.tags?String(o.tags):void 0}),"remember"),login:c(()=>d.login({md:g,url:o.url?String(o.url):void 0}),"login"),logout:c(()=>d.logout(),"logout"),auth:c(y=>d.auth(y,{md:g}),"auth"),seed:c(y=>d.seed(y,process.cwd(),{md:g}),"seed"),install:c(()=>d.install(null,process.cwd(),{md:g}),"install"),capture:c(y=>d.capture(y,process.cwd(),{md:g,tags:o.tags?String(o.tags):void 0,force:o.force===!0}),"capture"),mcp:c(y=>d.mcp(y,process.cwd(),{md:g}),"mcp")}[s];if(T)p=await T(m);else throw new Error(`Command '${s}' has no handler`)}if(l){let m=Date.now()-u;try{await pr.trackCommand(l,s,m)}catch{}try{await Ao.recordTiming(l,"command_duration",m,{command:s});let g=globalThis.__perfStartNs;if(g){let k=Number(process.hrtime.bigint()-g)/1e6;await Ao.recordTiming(l,"startup_time",k)}await Ao.recordMemory(l,{command:s})}catch{}}p?.message&&console.log(p.message),t||f.end(),process.exit(p?.success?0:1)}catch(n){console.error("Error:",b(n)),process.env.DEBUG&&console.error(il(n)),t||f.end(),process.exit(1)}}function iM(s,e){if(!s.params)return null;let t=s.params.match(/<[^>]+>/g);if(!t||t.length===0)return null;if(e.length<t.length){let n=t.map(o=>o.slice(1,-1)).join(", "),r=s.usage.terminal||`prjct ${s.name} ${s.params}`;return xo("MISSING_PARAM",{message:`Missing required parameter: ${n}`,hint:`Usage: ${r}`})}return null}function aM(s,e){let t=[],n={};for(let r=0;r<e.length;r++){let o=e[r];if(o.startsWith("--")){let i=o.slice(2);r+1<e.length&&!e[r+1].startsWith("--")?n[i]=e[++r]:n[i]=!0}else t.push(o)}return{parsedArgs:t,options:n}}async function cM(s){let e=await Tn(),t=Xc.join(EE.homedir(),".claude","commands","p.md"),n=Xc.join(EE.homedir(),".gemini","commands","p.toml"),[r,o,i,a]=await Promise.all([E(t),E(n),E(Xc.join(process.cwd(),".cursor","commands","sync.md")),E(Xc.join(process.cwd(),".cursor"))]),l=await So();if(console.log(`
1637
1637
  ${Le.cyan("p/")} prjct v${s}
1638
1638
  ${Le.dim("Context layer for AI coding agents")}
1639
1639
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prjct-cli",
3
- "version": "2.24.2",
3
+ "version": "2.24.3",
4
4
  "description": "Context layer for AI agents. Project context for Claude Code, Gemini CLI, and more.",
5
5
  "main": "dist/bin/prjct.mjs",
6
6
  "bin": {