prjct-cli 3.80.1 → 3.83.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 +21 -0
- package/README.md +7 -6
- package/assets/scripts/refresh-update.mjs +3 -2
- package/dist/bin/prjct-core.mjs +756 -764
- package/dist/bin/prjct-hooks.mjs +373 -381
- package/dist/bin/prjct.mjs +12 -12
- package/dist/daemon/entry.mjs +664 -672
- package/dist/mcp/server.mjs +389 -397
- package/dist/templates.json +1 -1
- package/package.json +7 -5
- package/templates/antigravity/SKILL.md +0 -19
- package/templates/codex/SKILL.md +0 -19
- package/templates/crew/registry.json +0 -27
- package/templates/cursor/router.mdc +0 -9
- package/templates/global/ANTIGRAVITY.md +0 -32
- package/templates/global/CURSOR.mdc +0 -14
- package/templates/global/GEMINI.md +0 -32
- package/templates/global/WINDSURF.md +0 -14
- package/templates/grok/SKILL.md +0 -19
- package/templates/mcp-config.json +0 -29
- package/templates/windsurf/router.md +0 -9
package/dist/bin/prjct.mjs
CHANGED
|
@@ -13,22 +13,22 @@ function isSafeRetry(e){const c=e&&e.code||"",m=e&&e.message||"";return c==="ECO
|
|
|
13
13
|
// response raw. Hooks must never disturb the host session, so ANY failure
|
|
14
14
|
// (connect error, timeout, closed socket) degrades to the empty no-op {} and
|
|
15
15
|
// exit 0 — the same fail-soft contract the in-process hook runner honors.
|
|
16
|
-
|
|
16
|
+
const hookCompletion=new AbortController();
|
|
17
17
|
function sendHook(sub,data){
|
|
18
|
-
if(
|
|
18
|
+
if(hookCompletion.signal.aborted)return;hookCompletion.abort();
|
|
19
19
|
const msg=JSON.stringify({id:randomUUID(),command:"hook",args:sub?[sub]:[],options:{},cwd:process.cwd(),stdin:data})+"\n";
|
|
20
|
-
const sock=connect(sockPath);
|
|
21
|
-
const soft=()=>{if(!
|
|
20
|
+
const sock=connect(sockPath);const chunks=[],completion=new AbortController();
|
|
21
|
+
const soft=()=>{if(!completion.signal.aborted){completion.abort();clearTimeout(t);sock.destroy();process.stdout.write("{}\n");process.exit(0)}};
|
|
22
22
|
const t=setTimeout(soft,5000);
|
|
23
23
|
sock.on("connect",()=>sock.write(msg));
|
|
24
|
-
sock.on("data",c=>{
|
|
24
|
+
sock.on("data",c=>{chunks.push(c.toString());const buf=chunks.join("");const n=buf.indexOf("\n");if(n!==-1){const r=JSON.parse(buf.slice(0,n));if(r.retry){soft();return}completion.abort();clearTimeout(t);sock.end();if(r.stdout)process.stdout.write(r.stdout);process.exit(r.exitCode!=null?r.exitCode:0)}});
|
|
25
25
|
sock.on("error",soft);
|
|
26
26
|
sock.on("close",soft);
|
|
27
27
|
}
|
|
28
28
|
if(cmd==="hook"){
|
|
29
29
|
if(process.env.PRJCT_NO_DAEMON!=="1"&&hasEndpoint()){
|
|
30
30
|
const sub=args[1];
|
|
31
|
-
if(process.stdin.isTTY){sendHook(sub,"")}else{
|
|
31
|
+
if(process.stdin.isTTY){sendHook(sub,"")}else{const chunks=[];process.stdin.on("data",c=>chunks.push(c));const send=()=>sendHook(sub,Buffer.concat(chunks).toString("utf8"));process.stdin.on("end",send);process.stdin.on("error",send);setTimeout(send,1000)}
|
|
32
32
|
}else{
|
|
33
33
|
// Cold path (daemon disabled/unreachable): run the hook from the dedicated
|
|
34
34
|
// hooks bundle, NOT the full core. cold-entry emits host JSON then detaches
|
|
@@ -37,16 +37,16 @@ if(cmd==="hook"){
|
|
|
37
37
|
}
|
|
38
38
|
}else if(cmd&&!skip.has(cmd)&&process.env.PRJCT_NO_DAEMON!=="1"&&hasEndpoint()){
|
|
39
39
|
const cArgs=[],cOpts={};
|
|
40
|
-
for(
|
|
40
|
+
const consumed=new Set();for(const [i,a] of args.entries()){if(consumed.has(i))continue;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+1];consumed.add(i+1)}else{cOpts[r]=true}}else if(a.startsWith("-")&&a.length===2){cOpts[a.slice(1)]=true}else if(i>0){cArgs.push(a)}}
|
|
41
41
|
const msg=JSON.stringify({id:randomUUID(),command:cmd,args:cArgs,options:cOpts,cwd:process.cwd()})+"\n";
|
|
42
|
-
const sock=connect(sockPath);
|
|
42
|
+
const sock=connect(sockPath);const chunks=[],completion=new AbortController();
|
|
43
43
|
// Long verbs (ship/sync/…) need 10min; everything else stays at 30s.
|
|
44
44
|
const LONG=new Set(["ship","sync","dream","update","upgrade","analyze","init","cloud"]);
|
|
45
45
|
const waitMs=LONG.has(cmd)?600000:30000;
|
|
46
|
-
const t=setTimeout(()=>{if(!
|
|
46
|
+
const t=setTimeout(()=>{if(!completion.signal.aborted){completion.abort();sock.destroy();refuse("timed out")}},waitMs);
|
|
47
47
|
sock.on("connect",()=>sock.write(msg));
|
|
48
|
-
sock.on("data",c=>{
|
|
49
|
-
sock.on("error",e=>{if(!
|
|
50
|
-
sock.on("close",()=>{if(!
|
|
48
|
+
sock.on("data",c=>{chunks.push(c.toString());const buf=chunks.join("");const n=buf.indexOf("\n");if(n!==-1){const r=JSON.parse(buf.slice(0,n));completion.abort();clearTimeout(t);sock.end();if(r.retry){process.env.PRJCT_NO_DAEMON="1";fallback();return}if(r.stdout)console.log(r.stdout);if(r.stderr)console.error(r.stderr);process.exit(r.exitCode)}});
|
|
49
|
+
sock.on("error",e=>{if(!completion.signal.aborted){completion.abort();clearTimeout(t);if(isSafeRetry(e))fallback();else refuse(e&&e.message||String(e))}});
|
|
50
|
+
sock.on("close",()=>{if(!completion.signal.aborted){completion.abort();clearTimeout(t);refuse("Connection closed before response")}});
|
|
51
51
|
}else{fallback()}
|
|
52
52
|
async function fallback(){await import("./prjct-core.mjs")}
|