smol-symphony 0.3.1 → 0.3.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "smol-symphony",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "description": "TypeScript orchestrator that runs coding agents (Claude, Codex, OpenCode) in per-issue Gondolin microVMs over ACP.",
5
5
  "keywords": [
6
6
  "orchestrator",
@@ -17,7 +17,7 @@
17
17
 
18
18
  import { createRequire } from 'node:module';
19
19
  import { spawnSync } from 'node:child_process';
20
- import { readFileSync } from 'node:fs';
20
+ import { readFileSync, existsSync, writeFileSync, rmSync } from 'node:fs';
21
21
  import { dirname, join, resolve, relative, sep } from 'node:path';
22
22
  import { fileURLToPath } from 'node:url';
23
23
 
@@ -55,9 +55,32 @@ const appRoot = idx === -1 ? process.cwd() : depPkgJson.slice(0, idx);
55
55
  // patch-package REQUIRES --patch-dir to be relative to its CWD (it rejects an
56
56
  // absolute path), so express our bundled patches dir relative to appRoot.
57
57
  const relPatchDir = relative(appRoot, patchDir) || '.';
58
+
59
+ // patch-package's getAppRootPath() walks up from CWD for a package.json and
60
+ // THROWS "no package.json found for this project" if none exists. Under `npx`,
61
+ // the install root (~/.npm/_npx/<hash>/) has a node_modules but NO package.json,
62
+ // so patch-package crashes there and the whole npx invocation aborts before the
63
+ // bin ever runs. If appRoot lacks one, drop a minimal placeholder for the
64
+ // duration of the run and remove it after. (A normal `npm install`/-g already has
65
+ // one, so we leave it untouched.)
66
+ const appPkgJson = join(appRoot, 'package.json');
67
+ const createdTempPkgJson = !existsSync(appPkgJson);
68
+ if (createdTempPkgJson) {
69
+ try {
70
+ writeFileSync(appPkgJson, '{"name":"_symphony-patch-root","version":"0.0.0"}\n');
71
+ } catch {
72
+ // Can't write (read-only root) — let patch-package surface whatever it can.
73
+ }
74
+ }
75
+
58
76
  const patchPackageBin = join(dirname(require.resolve('patch-package/package.json')), 'index.js');
59
77
  const res = spawnSync(process.execPath, [patchPackageBin, '--patch-dir', relPatchDir], {
60
78
  cwd: appRoot,
61
79
  stdio: 'inherit',
62
80
  });
81
+
82
+ // Remove the placeholder BEFORE exiting (process.exit skips finally blocks).
83
+ if (createdTempPkgJson) {
84
+ try { rmSync(appPkgJson); } catch { /* best-effort cleanup */ }
85
+ }
63
86
  process.exit(res.status ?? 0);