@redue/cli 0.1.0-alpha.19 → 0.1.0-alpha.20

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,17 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.0-alpha.20 — 2026-10-24
4
+
5
+ A fix for agents on macOS.
6
+
7
+ - Fixed: on macOS, `redue status --sync --json`, `status --json` and
8
+ `explain --json` read by an agent's shell tool stopped at 8 KB, leaving
9
+ invalid JSON. The agent instructions REDUE installs run `status --sync
10
+ --json`; its output passes 8 KB at about 25 checks, or sooner when STALE
11
+ checks list many changed files. Through a shell pipe, `init --json`
12
+ stopped at 64 KB. The CLI exited with output still queued; it now writes
13
+ all of it first. Linux and Windows were not affected.
14
+
3
15
  ## 0.1.0-alpha.19 — 2026-10-24
4
16
 
5
17
  A general recipe for typecheck and lint scripts that the strict recipes do not
package/bin/redue.mjs CHANGED
@@ -46,6 +46,10 @@ Commands:
46
46
  No checks run in the background. Direct commands outside redue create no receipts.`;
47
47
 
48
48
  function error(message){console.error(`redue: ${message}`);process.exit(2);}
49
+ // Exits once queued output is written. On macOS, output to a pipe is written
50
+ // asynchronously; exiting with it queued cuts it (at 8 KB through the pipe a
51
+ // Node program, such as an agent's shell tool, reads).
52
+ async function exit(code){await new Promise(resolve=>process.stdout.write('',resolve));process.exit(code);}
49
53
  const args=process.argv.slice(2);
50
54
  if(args.length===3&&args[0]==='agent'&&args[1]==='hook'&&args[2]==='claude'){
51
55
  // Runs before config discovery: the hook must exit 0 on every failure,
@@ -54,7 +58,7 @@ if(args.length===3&&args[0]==='agent'&&args[1]==='hook'&&args[2]==='claude'){
54
58
  await runClaudeHook(fileURLToPath(import.meta.url));process.exit(0);
55
59
  }
56
60
  if(args.length===1&&args[0]==='--version'){console.log(version);process.exit(0);}
57
- if(args.includes('--help')||args.includes('-h')||!args.length){console.log(help);process.exit(0);}
61
+ if(args.includes('--help')||args.includes('-h')||!args.length){console.log(help);await exit(0);}
58
62
  let configFile=null,stateOverride=null;
59
63
  for(let i=0;i<args.length;){
60
64
  if(args[i]==='--config'||args[i]==='--state-dir'){
@@ -73,9 +77,7 @@ if(command==='agent'){
73
77
  const {agentCommand}=await import('../src/agent-integration.mjs');
74
78
  try{await agentCommand(args,{configFile,stateOverride,entry:fileURLToPath(import.meta.url)});}
75
79
  catch(e){error(e.message);}
76
- // Exiting with piped output still queued truncates it (8 KB on macOS).
77
- await new Promise(resolve=>process.stdout.write('',resolve));
78
- process.exit(0);
80
+ await exit(0);
79
81
  }
80
82
  if(!['init','start','stop','status','detail','explain','run','remove-state'].includes(command))
81
83
  error(`unknown command ${command||'<none>'}; use --help`);
@@ -153,7 +155,7 @@ if(command==='init'){
153
155
  console.log('Use redue status first. --sync can establish applicability, but may cost more than rerunning a cheap check.');}
154
156
  } else if(unsupported&&!json)console.log(`No config written: ${summary.issue||'unsupported discovery boundary'}.`);
155
157
  if(json)console.log(JSON.stringify({...summary,proposed_config:discovery.config}));
156
- process.exit(0);
158
+ await exit(0);
157
159
  }
158
160
  function printLifecycle(output,action,machine){
159
161
  if(machine){process.stdout.write(output);return;}
@@ -175,7 +177,7 @@ if(stateOverride&&['stop','remove-state'].includes(command)){
175
177
  {cwd:os.tmpdir(),stdio:['inherit','pipe','inherit'],encoding:'utf8',env:process.env});
176
178
  if(result.error)error(result.error.message);
177
179
  if(result.stdout)printLifecycle(result.stdout,command,json);
178
- process.exit(result.status??2);
180
+ await exit(result.status??2);
179
181
  }
180
182
  let publicConfig;
181
183
  try{publicConfig=JSON.parse(fs.readFileSync(configFile,'utf8'));}
@@ -362,7 +364,7 @@ if(!maintenance&&!created){
362
364
  if(command==='status'&&!sync){
363
365
  const value=readCachedStatus(state,publicConfig.checks);
364
366
  console.log(json?JSON.stringify(value):renderStatus(value,{short}));
365
- process.exit(0);
367
+ await exit(0);
366
368
  }
367
369
 
368
370
  const details=command==='detail'||command==='explain';
@@ -404,5 +406,5 @@ if(command==='run'&&process.platform!=='win32'){
404
406
  else console.log(details?renderExplain(value,check):renderStatus(value,{short}));
405
407
  }else printLifecycle(result.stdout,command,json);
406
408
  }
407
- process.exit(result.status??1);
409
+ await exit(result.status??1);
408
410
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@redue/cli",
3
3
  "private": false,
4
- "version": "0.1.0-alpha.19",
4
+ "version": "0.1.0-alpha.20",
5
5
  "publishConfig": {
6
6
  "access": "public",
7
7
  "tag": "alpha"