prjct-cli 2.24.3 → 2.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -3
- package/dist/bin/prjct-core.mjs +387 -381
- package/dist/bin/prjct.mjs +20 -1
- package/dist/daemon/entry.mjs +330 -300
- package/dist/templates.json +1 -1
- package/package.json +1 -1
- package/templates/crew/CLAUDE-leader-mode.md +17 -3
- package/templates/crew/agents/leader.md +36 -10
- package/templates/skills/prjct/SKILL.md +4 -0
package/dist/bin/prjct.mjs
CHANGED
|
@@ -6,7 +6,26 @@ const cmd=args.find(a=>!a.startsWith("-"));
|
|
|
6
6
|
const skip=new Set(["daemon","stop","restart","start","setup","update","upgrade","dev","web","serve","context","hooks","doctor","uninstall","watch","help","-h","--help","version","-v","--version","claude","hook","seed","install","crew","mcp","prefs","retro","health","skill-adherence","review-risk","context-save","context-restore","spec","audit-spec"]);
|
|
7
7
|
function refuse(m){console.error("prjct: daemon dropped the request ("+m+"). Retry: prjct "+args.join(" "));process.exit(1)}
|
|
8
8
|
function isSafeRetry(e){const c=e&&e.code||"",m=e&&e.message||"";return c==="ECONNREFUSED"||c==="ENOENT"||m.includes("ECONNREFUSED")||m.includes("ENOENT")}
|
|
9
|
-
|
|
9
|
+
// Hook fast path: forward the event (stdin) to the warm daemon and write its
|
|
10
|
+
// response raw. Hooks must never disturb the host session, so ANY failure
|
|
11
|
+
// (connect error, timeout, closed socket) degrades to the empty no-op {} and
|
|
12
|
+
// exit 0 — the same fail-soft contract the in-process hook runner honors.
|
|
13
|
+
let hookDone=false;
|
|
14
|
+
function sendHook(sub,data){
|
|
15
|
+
if(hookDone)return;hookDone=true;
|
|
16
|
+
const msg=JSON.stringify({id:randomUUID(),command:"hook",args:sub?[sub]:[],options:{},cwd:process.cwd(),stdin:data})+"\n";
|
|
17
|
+
const sock=connect(sockPath);let buf="",done=false;
|
|
18
|
+
const soft=()=>{if(!done){done=true;clearTimeout(t);sock.destroy();process.stdout.write("{}\n");process.exit(0)}};
|
|
19
|
+
const t=setTimeout(soft,5000);
|
|
20
|
+
sock.on("connect",()=>sock.write(msg));
|
|
21
|
+
sock.on("data",c=>{buf+=c.toString();const n=buf.indexOf("\n");if(n!==-1){const r=JSON.parse(buf.slice(0,n));done=true;clearTimeout(t);sock.end();if(r.stdout)process.stdout.write(r.stdout);process.exit(r.exitCode!=null?r.exitCode:0)}});
|
|
22
|
+
sock.on("error",soft);
|
|
23
|
+
sock.on("close",soft);
|
|
24
|
+
}
|
|
25
|
+
if(cmd==="hook"&&process.env.PRJCT_NO_DAEMON!=="1"&&existsSync(sockPath)){
|
|
26
|
+
const sub=args[1];
|
|
27
|
+
if(process.stdin.isTTY){sendHook(sub,"")}else{let d="";process.stdin.on("data",c=>d+=c);process.stdin.on("end",()=>sendHook(sub,d));process.stdin.on("error",()=>sendHook(sub,d));setTimeout(()=>sendHook(sub,d),1000)}
|
|
28
|
+
}else if(cmd&&!skip.has(cmd)&&process.env.PRJCT_NO_DAEMON!=="1"&&existsSync(sockPath)){
|
|
10
29
|
const cArgs=[],cOpts={};
|
|
11
30
|
for(let i=0;i<args.length;i++){const a=args[i];if(a.startsWith("--")){const r=a.slice(2);if(r.includes("=")){const e=r.indexOf("=");cOpts[r.slice(0,e)]=r.slice(e+1)}else if(i+1<args.length&&!args[i+1].startsWith("--")){cOpts[r]=args[++i]}else{cOpts[r]=true}}else if(a.startsWith("-")&&a.length===2){cOpts[a.slice(1)]=true}else if(i>0){cArgs.push(a)}}
|
|
12
31
|
const msg=JSON.stringify({id:randomUUID(),command:cmd,args:cArgs,options:cOpts,cwd:process.cwd()})+"\n";
|