gitdone-agent 0.5.0 → 0.5.1

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.
Files changed (2) hide show
  1. package/index.js +16 -4
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -27,7 +27,7 @@ import { randomUUID } from 'node:crypto'
27
27
  // Reported to the server on every sync so the web UI can flag outdated agents.
28
28
  // Keep in lockstep with packages/agent/package.json "version" AND
29
29
  // src/lib/agentVersion.ts LATEST_AGENT_VERSION.
30
- const AGENT_VERSION = '0.5.0'
30
+ const AGENT_VERSION = '0.5.1'
31
31
 
32
32
  const AGENT_DIR = join(homedir(), '.gitdone-agent')
33
33
  const CONFIG_PATH = join(AGENT_DIR, 'config.json')
@@ -460,14 +460,18 @@ function runAiCommand(cfg, cmd, repoPath) {
460
460
  }
461
461
 
462
462
  const { path: claudePath, shell } = findClaude()
463
- // shell:true (claude.cmd) can't carry raw newlines on the command line.
464
- const promptArg = shell ? prompt.replace(/\r?\n/g, ' ') : prompt
465
463
 
466
464
  let settingsPath
467
465
  try { settingsPath = ensureAiHookFiles() } catch (e) { log(`✗ ai hook setup failed: ${e.message}`) }
468
466
 
467
+ // The prompt is delivered on STDIN, not as a `-p <arg>` command-line value.
468
+ // A multi-line, non-ASCII (Cyrillic) prompt passed as an argv element gets
469
+ // mangled under the claude.cmd npm shim (shell:true → cmd.exe splits/strips
470
+ // it), so Claude received no prompt and fell back to an empty stdin
471
+ // ("no stdin data received…"), then ran blind off whatever was in the repo.
472
+ // Piping it to stdin is robust for both the native exe and the shim.
469
473
  const args = [
470
- '-p', promptArg,
474
+ '-p',
471
475
  '--output-format', 'stream-json',
472
476
  '--verbose',
473
477
  '--permission-mode', 'acceptEdits',
@@ -505,6 +509,14 @@ function runAiCommand(cfg, cmd, repoPath) {
505
509
  return
506
510
  }
507
511
 
512
+ // Write the prompt to stdin and close it so Claude reads it as the task.
513
+ // Swallow EPIPE in case the process exits before we finish writing.
514
+ if (child.stdin) {
515
+ child.stdin.on('error', () => {})
516
+ try { child.stdin.write(prompt); child.stdin.end() }
517
+ catch (e) { push('SYSTEM', `stdin write failed: ${e.message}`) }
518
+ }
519
+
508
520
  let buf = ''
509
521
  child.stdout.on('data', (d) => {
510
522
  buf += d.toString()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gitdone-agent",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "Local git agent for gitdone — watches a local repo and sends snapshots to gitdone.eu",
5
5
  "type": "module",
6
6
  "bin": {