prjct-cli 3.0.0 → 3.2.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.
@@ -25,9 +25,16 @@ function sendHook(sub,data){
25
25
  sock.on("error",soft);
26
26
  sock.on("close",soft);
27
27
  }
28
- if(cmd==="hook"&&process.env.PRJCT_NO_DAEMON!=="1"&&hasEndpoint()){
29
- const sub=args[1];
30
- 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
+ if(cmd==="hook"){
29
+ if(process.env.PRJCT_NO_DAEMON!=="1"&&hasEndpoint()){
30
+ const sub=args[1];
31
+ 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)}
32
+ }else{
33
+ // Cold path (daemon disabled/unreachable): run the hook from the dedicated
34
+ // ~136KB hooks bundle, NOT the ~936KB core. cold-entry reads argv+stdin and
35
+ // exits, awaiting afterEmit (byte-identical output to the old core path).
36
+ import("./prjct-hooks.mjs").catch(()=>{process.stdout.write("{}\n");process.exit(0)})
37
+ }
31
38
  }else if(cmd&&!skip.has(cmd)&&process.env.PRJCT_NO_DAEMON!=="1"&&hasEndpoint()){
32
39
  const cArgs=[],cOpts={};
33
40
  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)}}