gitdone-agent 0.8.8 → 0.8.9

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 +12 -3
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -31,7 +31,7 @@ import { randomUUID, createHash } from 'node:crypto'
31
31
  // Reported to the server on every sync so the web UI can flag outdated agents.
32
32
  // Keep in lockstep with packages/agent/package.json. The server's offline
33
33
  // fallback is bumped only after this release has actually reached npm.
34
- const AGENT_VERSION = '0.8.8'
34
+ const AGENT_VERSION = '0.8.9'
35
35
 
36
36
  const AGENT_DIR = join(homedir(), '.gitdone-agent')
37
37
  const CONFIG_PATH = join(AGENT_DIR, 'config.json')
@@ -775,11 +775,12 @@ function gitTry(cmd, cwd) {
775
775
  // commit path swallowed that via git() + `|| 'committed'` and reported a fake
776
776
  // success while nothing was committed (gd-445). gitDiffUntracked() already uses
777
777
  // execFileSync for the same reason. Local calls get 2 min; pass net for 5.
778
- function gitArgs(args, cwd, { net = false } = {}) {
778
+ function gitArgs(args, cwd, { net = false, input } = {}) {
779
779
  try {
780
780
  const out = execFileSync('git', args, {
781
781
  cwd, encoding: 'utf8', stdio: ['pipe', 'pipe', 'pipe'],
782
782
  maxBuffer: GIT_MAX_BUFFER, timeout: net ? GIT_NET_TIMEOUT_MS : GIT_TIMEOUT_MS, env: GIT_ENV,
783
+ ...(input === undefined ? {} : { input }),
783
784
  }).trim()
784
785
  return { ok: true, out }
785
786
  } catch (err) {
@@ -2665,8 +2666,16 @@ async function executeCommand(cfg, cmd, repoPath) {
2665
2666
  const files = Array.isArray(cmd.payload?.files)
2666
2667
  ? cmd.payload.files.filter((f) => typeof f === 'string' && f.trim())
2667
2668
  : []
2669
+ // Do not put every selected path in argv: a large change set can exceed
2670
+ // Windows' ~32K CreateProcess command-line limit before git even starts
2671
+ // (`spawnSync git ENAMETOOLONG`). Git's NUL-delimited stdin pathspec mode
2672
+ // has no such argv limit and also preserves spaces/newlines verbatim.
2668
2673
  const add = files.length
2669
- ? gitArgs(['add', '--', ...files], repoPath)
2674
+ ? gitArgs(
2675
+ ['--literal-pathspecs', 'add', '--pathspec-from-file=-', '--pathspec-file-nul'],
2676
+ repoPath,
2677
+ { input: Buffer.from(`${files.join('\0')}\0`, 'utf8') },
2678
+ )
2670
2679
  : gitArgs(['add', '-A'], repoPath)
2671
2680
  if (!add.ok) throw new Error(`git add се провали: ${add.out}`)
2672
2681
  const commit = gitArgs(['commit', '-m', msg], repoPath)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gitdone-agent",
3
- "version": "0.8.8",
3
+ "version": "0.8.9",
4
4
  "description": "Local gitDone companion for repository and optional World of Warcraft progress sync",
5
5
  "type": "module",
6
6
  "files": [