homegraph 1.5.0 → 1.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 (214) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +305 -305
  3. package/dist/bin/command-supervision.d.ts.map +1 -1
  4. package/dist/bin/command-supervision.js +7 -4
  5. package/dist/bin/command-supervision.js.map +1 -1
  6. package/dist/bin/homegraph.js +9 -9
  7. package/dist/db/index.js +36 -36
  8. package/dist/db/migrations.js +37 -37
  9. package/dist/db/queries.js +156 -156
  10. package/dist/db/schema.sql +203 -203
  11. package/dist/directory.js +5 -5
  12. package/dist/extraction/languages/arkts-viewtree.d.ts +2 -4
  13. package/dist/extraction/languages/arkts-viewtree.d.ts.map +1 -1
  14. package/dist/extraction/languages/arkts-viewtree.js +6 -21
  15. package/dist/extraction/languages/arkts-viewtree.js.map +1 -1
  16. package/dist/extraction/languages/arkts.d.ts +16 -6
  17. package/dist/extraction/languages/arkts.d.ts.map +1 -1
  18. package/dist/extraction/languages/arkts.js +174 -21
  19. package/dist/extraction/languages/arkts.js.map +1 -1
  20. package/dist/extraction/wasm/tree-sitter-c_sharp.wasm +0 -0
  21. package/dist/extraction/wasm/tree-sitter-cfml.wasm +0 -0
  22. package/dist/extraction/wasm/tree-sitter-cfquery.wasm +0 -0
  23. package/dist/extraction/wasm/tree-sitter-cfscript.wasm +0 -0
  24. package/dist/extraction/wasm/tree-sitter-cobol.wasm +0 -0
  25. package/dist/extraction/wasm/tree-sitter-erlang.wasm +0 -0
  26. package/dist/extraction/wasm/tree-sitter-nix.wasm +0 -0
  27. package/dist/extraction/wasm/tree-sitter-pascal.wasm +0 -0
  28. package/dist/extraction/wasm/tree-sitter-vbnet.wasm +0 -0
  29. package/dist/installer/instructions-template.js +9 -9
  30. package/dist/mcp/liveness-watchdog.d.ts +18 -0
  31. package/dist/mcp/liveness-watchdog.d.ts.map +1 -1
  32. package/dist/mcp/liveness-watchdog.js +185 -73
  33. package/dist/mcp/liveness-watchdog.js.map +1 -1
  34. package/dist/mcp/server-instructions.js +47 -47
  35. package/dist/reasoning/reasoner.js +32 -32
  36. package/dist/spec/db/commit-node.js +4 -4
  37. package/dist/spec/db/fragment-node.js +10 -10
  38. package/dist/spec/db/fts.js +8 -8
  39. package/dist/spec/db/relations.js +88 -88
  40. package/dist/spec/db/schema.js +6 -6
  41. package/dist/spec/db/schema.sql +121 -121
  42. package/dist/spec/db/spec-node.js +4 -4
  43. package/dist/spec/llm/prompts.js +53 -53
  44. package/dist/spec/utils.d.ts +16 -4
  45. package/dist/spec/utils.d.ts.map +1 -1
  46. package/dist/spec/utils.js +58 -6
  47. package/dist/spec/utils.js.map +1 -1
  48. package/package.json +62 -62
  49. package/scripts/_tmp-cfwk-resolve.log +0 -0
  50. package/scripts/_tmp-cfwk-sig.log +0 -0
  51. package/scripts/_tmp-cfwk-vt.log +0 -0
  52. package/scripts/add-lang/bench.sh +60 -60
  53. package/scripts/add-lang/check-grammar.mjs +75 -75
  54. package/scripts/add-lang/dump-ast.mjs +103 -103
  55. package/scripts/add-lang/verify-extraction.mjs +70 -70
  56. package/scripts/agent-eval/ab-adoption.sh +91 -91
  57. package/scripts/agent-eval/ab-hook.sh +86 -86
  58. package/scripts/agent-eval/ab-impl.sh +78 -78
  59. package/scripts/agent-eval/ab-new-vs-baseline.sh +102 -102
  60. package/scripts/agent-eval/ab-sufficiency.sh +78 -78
  61. package/scripts/agent-eval/arms-F.sh +21 -21
  62. package/scripts/agent-eval/arms-matrix.sh +37 -37
  63. package/scripts/agent-eval/audit.sh +68 -68
  64. package/scripts/agent-eval/bench-readme.sh +28 -28
  65. package/scripts/agent-eval/bench-why-repo.sh +22 -22
  66. package/scripts/agent-eval/block-read-hook.sh +19 -19
  67. package/scripts/agent-eval/hook-settings.json +15 -15
  68. package/scripts/agent-eval/itrun.sh +120 -120
  69. package/scripts/agent-eval/offload-eval-3arm.sh +72 -72
  70. package/scripts/agent-eval/offload-eval-cost.mjs +133 -133
  71. package/scripts/agent-eval/offload-eval-effort.mjs +108 -108
  72. package/scripts/agent-eval/offload-eval-frontload-matrix.sh +25 -25
  73. package/scripts/agent-eval/offload-eval-frontload.sh +47 -47
  74. package/scripts/agent-eval/offload-eval-ground-truth.json +18 -18
  75. package/scripts/agent-eval/offload-eval-hook.mjs +84 -84
  76. package/scripts/agent-eval/offload-eval-judge.mjs +103 -103
  77. package/scripts/agent-eval/offload-eval-matrix.sh +20 -20
  78. package/scripts/agent-eval/offload-eval-metrics.mjs +94 -94
  79. package/scripts/agent-eval/offload-eval-refs1.sh +50 -50
  80. package/scripts/agent-eval/offload-eval-setup.sh +24 -24
  81. package/scripts/agent-eval/offload-eval-styles.sh +71 -71
  82. package/scripts/agent-eval/offload-eval-summarize.mjs +68 -68
  83. package/scripts/agent-eval/offload-eval.md +76 -76
  84. package/scripts/agent-eval/parse-arms.mjs +116 -116
  85. package/scripts/agent-eval/parse-bench-readme.mjs +84 -84
  86. package/scripts/agent-eval/parse-run.mjs +45 -45
  87. package/scripts/agent-eval/parse-session.mjs +93 -93
  88. package/scripts/agent-eval/probe-context.mjs +21 -21
  89. package/scripts/agent-eval/probe-explore.mjs +40 -40
  90. package/scripts/agent-eval/probe-node.mjs +20 -20
  91. package/scripts/agent-eval/probe-sweep.mjs +119 -119
  92. package/scripts/agent-eval/probe-trace.mjs +20 -20
  93. package/scripts/agent-eval/redirect-read-hook.sh +38 -38
  94. package/scripts/agent-eval/repro-concurrent-explore.mjs +119 -119
  95. package/scripts/agent-eval/repro-daemon-clients.mjs +125 -125
  96. package/scripts/agent-eval/run-agent.sh +34 -34
  97. package/scripts/agent-eval/run-all.sh +75 -75
  98. package/scripts/agent-eval/run-arms.sh +56 -56
  99. package/scripts/agent-eval/seq-matrix.mjs +137 -137
  100. package/scripts/bench-arkts-init-rss.log +0 -0
  101. package/scripts/build-bundle.sh +123 -123
  102. package/scripts/exp_boundary_eval/README.md +247 -247
  103. package/scripts/exp_boundary_eval/__pycache__/_utils.cpython-310.pyc +0 -0
  104. package/scripts/exp_boundary_eval/__pycache__/_utils.cpython-38.pyc +0 -0
  105. package/scripts/exp_boundary_eval/__pycache__/analyze.cpython-310.pyc +0 -0
  106. package/scripts/exp_boundary_eval/__pycache__/analyze.cpython-38.pyc +0 -0
  107. package/scripts/exp_boundary_eval/__pycache__/deveco_arm.cpython-38.pyc +0 -0
  108. package/scripts/exp_boundary_eval/__pycache__/run_all.cpython-310.pyc +0 -0
  109. package/scripts/exp_boundary_eval/__pycache__/run_all.cpython-38.pyc +0 -0
  110. package/scripts/exp_boundary_eval/__pycache__/run_one.cpython-310.pyc +0 -0
  111. package/scripts/exp_boundary_eval/__pycache__/run_one.cpython-38.pyc +0 -0
  112. package/scripts/exp_boundary_eval/__pycache__/run_session.cpython-310.pyc +0 -0
  113. package/scripts/exp_boundary_eval/__pycache__/run_session.cpython-38.pyc +0 -0
  114. package/scripts/exp_boundary_eval/__pycache__/setup.cpython-310.pyc +0 -0
  115. package/scripts/exp_boundary_eval/__pycache__/setup.cpython-38.pyc +0 -0
  116. package/scripts/exp_boundary_eval/__pycache__/win_mcp_launcher.cpython-38.pyc +0 -0
  117. package/scripts/exp_boundary_eval/_test_mcp_chain.py +78 -78
  118. package/scripts/exp_boundary_eval/_test_stdin.py +8 -8
  119. package/scripts/exp_boundary_eval/_utils.py +1116 -1116
  120. package/scripts/exp_boundary_eval/analyze.py +1313 -1313
  121. package/scripts/exp_boundary_eval/deveco_arm.py +519 -519
  122. package/scripts/exp_boundary_eval/run_all.py +378 -378
  123. package/scripts/exp_boundary_eval/run_one.py +165 -165
  124. package/scripts/exp_boundary_eval/run_session.py +158 -158
  125. package/scripts/exp_boundary_eval/setup.py +120 -120
  126. package/scripts/exp_boundary_eval/win_mcp_launcher.py +73 -73
  127. package/scripts/exp_boundary_eval/win_mcp_stdio_wrap.js +36 -36
  128. package/scripts/exp_boundary_eval/win_node_launcher.py +24 -24
  129. package/scripts/extract-release-notes.mjs +130 -130
  130. package/scripts/local-install.sh +41 -41
  131. package/scripts/npm-sdk.js +75 -75
  132. package/scripts/npm-shim.js +275 -275
  133. package/scripts/ohos-sdk-publish.mjs +133 -133
  134. package/scripts/pack-npm.sh +119 -119
  135. package/scripts/prepare-release.mjs +270 -270
  136. package/scripts/probe-arkts-mem-why-run.log +0 -0
  137. package/scripts/probe-banner-livecard-ir.log +0 -0
  138. package/scripts/probe-cfwk-ast.stderr.log +0 -0
  139. package/scripts/probe-cfwk-ast.stdout.log +0 -0
  140. package/scripts/probe-cfwk-attr-shape.log +0 -0
  141. package/scripts/probe-cfwk-cfgdump.stderr.log +0 -0
  142. package/scripts/probe-cfwk-cfgdump.stdout.log +0 -0
  143. package/scripts/probe-cfwk-cvc.stderr.log +0 -0
  144. package/scripts/probe-cfwk-cvc.stdout.log +0 -0
  145. package/scripts/probe-cfwk-diag2.log +0 -0
  146. package/scripts/probe-cfwk-diag3.log +0 -0
  147. package/scripts/probe-cfwk-fedbg.stderr.log +0 -0
  148. package/scripts/probe-cfwk-fedbg.stdout.log +0 -0
  149. package/scripts/probe-cfwk-fileresult.log +0 -0
  150. package/scripts/probe-cfwk-fix.stderr.log +0 -0
  151. package/scripts/probe-cfwk-fix.stdout.log +0 -0
  152. package/scripts/probe-cfwk-fix2.stderr.log +0 -0
  153. package/scripts/probe-cfwk-fix2.stdout.log +0 -0
  154. package/scripts/probe-cfwk-fix3.stderr.log +0 -0
  155. package/scripts/probe-cfwk-fix3.stdout.log +0 -0
  156. package/scripts/probe-cfwk-foreach.log +0 -0
  157. package/scripts/probe-cfwk-getmethod-throw.log +0 -0
  158. package/scripts/probe-cfwk-hg-extract.log +0 -0
  159. package/scripts/probe-cfwk-pr1003-noprior.stderr.log +0 -0
  160. package/scripts/probe-cfwk-pr1003-noprior.stdout.log +0 -0
  161. package/scripts/probe-cfwk-pr1003.stderr.log +0 -0
  162. package/scripts/probe-cfwk-pr1003.stdout.log +0 -0
  163. package/scripts/probe-cfwk-preroot-noprior.stderr.log +0 -0
  164. package/scripts/probe-cfwk-preroot-noprior.stdout.log +0 -0
  165. package/scripts/probe-cfwk-preroot-prior.stderr.log +0 -0
  166. package/scripts/probe-cfwk-preroot-prior.stdout.log +0 -0
  167. package/scripts/probe-cfwk-preroot-skipstate.stderr.log +0 -0
  168. package/scripts/probe-cfwk-preroot-skipstate.stdout.log +0 -0
  169. package/scripts/probe-cfwk-resolve-sim.log +0 -0
  170. package/scripts/probe-cfwk-tree-shape.log +0 -0
  171. package/scripts/probe-cfwk-walk-abort.log +0 -0
  172. package/scripts/probe-cfwk.log +0 -0
  173. package/scripts/probe-force-index.log +0 -0
  174. package/scripts/probe-no-force-index.log +0 -0
  175. package/scripts/probe-samefile-ir.stderr.log +0 -0
  176. package/scripts/probe-samefile-ir.stdout.log +224 -0
  177. package/scripts/probe-sdk-vs-project.log +0 -0
  178. package/scripts/probe-viewtree-downgrade.log +0 -0
  179. package/dist/arkts/ohos-api-index.d.ts +0 -15
  180. package/dist/arkts/ohos-api-index.d.ts.map +0 -1
  181. package/dist/arkts/ohos-api-index.js +0 -190
  182. package/dist/arkts/ohos-api-index.js.map +0 -1
  183. package/dist/arkts/ohos-sdk-input.d.ts +0 -36
  184. package/dist/arkts/ohos-sdk-input.d.ts.map +0 -1
  185. package/dist/arkts/ohos-sdk-input.js +0 -214
  186. package/dist/arkts/ohos-sdk-input.js.map +0 -1
  187. package/dist/extraction/languages/arkts-state-decorators.d.ts +0 -13
  188. package/dist/extraction/languages/arkts-state-decorators.d.ts.map +0 -1
  189. package/dist/extraction/languages/arkts-state-decorators.js +0 -26
  190. package/dist/extraction/languages/arkts-state-decorators.js.map +0 -1
  191. package/dist/extraction/languages/ohos-api-consumer.d.ts +0 -34
  192. package/dist/extraction/languages/ohos-api-consumer.d.ts.map +0 -1
  193. package/dist/extraction/languages/ohos-api-consumer.js +0 -283
  194. package/dist/extraction/languages/ohos-api-consumer.js.map +0 -1
  195. package/dist/spec/build/git-scanner.d.ts +0 -93
  196. package/dist/spec/build/git-scanner.d.ts.map +0 -1
  197. package/dist/spec/build/git-scanner.js +0 -254
  198. package/dist/spec/build/git-scanner.js.map +0 -1
  199. package/dist/spec/git-utils.d.ts +0 -8
  200. package/dist/spec/git-utils.d.ts.map +0 -1
  201. package/dist/spec/git-utils.js +0 -14
  202. package/dist/spec/git-utils.js.map +0 -1
  203. package/dist/spec/mine/clusterer.d.ts +0 -63
  204. package/dist/spec/mine/clusterer.d.ts.map +0 -1
  205. package/dist/spec/mine/clusterer.js +0 -904
  206. package/dist/spec/mine/clusterer.js.map +0 -1
  207. package/dist/spec/mine/progress-handler.d.ts +0 -22
  208. package/dist/spec/mine/progress-handler.d.ts.map +0 -1
  209. package/dist/spec/mine/progress-handler.js +0 -108
  210. package/dist/spec/mine/progress-handler.js.map +0 -1
  211. package/dist/spec/mine/progress.d.ts +0 -23
  212. package/dist/spec/mine/progress.d.ts.map +0 -1
  213. package/dist/spec/mine/progress.js +0 -12
  214. package/dist/spec/mine/progress.js.map +0 -1
@@ -1,137 +1,137 @@
1
- #!/usr/bin/env node
2
- // Mine the surviving A/B stream-json logs (/tmp/ab-matrix/<Cell>/run-headless-*.jsonl)
3
- // for what the aggregate matrix can't see: the call SEQUENCE and per-call output SIZE.
4
- //
5
- // Answers three questions:
6
- // 1. Trace adoption — on a flow question, does the with-arm actually call homegraph_trace?
7
- // 2. Payload size vs repo size — is trace path-scoped (tiny, size-independent) while
8
- // explore is breadth-scoped (grows with the repo / over-returns on small repos)?
9
- // 3. Round-trips — num_turns with vs without (the real wall-clock driver).
10
- //
11
- // Usage: node scripts/agent-eval/seq-matrix.mjs [/tmp/ab-matrix]
12
- import { readFileSync, readdirSync, existsSync } from 'fs';
13
- import { join } from 'path';
14
-
15
- const AB = process.argv[2] || '/tmp/ab-matrix';
16
- const MD = new URL('../../docs/benchmarks/homegraph-ab-matrix.md', import.meta.url).pathname;
17
-
18
- // repo -> {lang,size,files} from the published matrix table
19
- const repoMeta = {};
20
- if (existsSync(MD)) for (const line of readFileSync(MD, 'utf8').split('\n')) {
21
- const m = line.match(/^\|\s*([^|]+?)\s*\|\s*(S|M|L)\s*\|\s*`([^`]+)`\s*\|\s*(\d+)\s*\|/);
22
- if (m) repoMeta[m[3]] = { lang: m[1].trim(), size: m[2], files: +m[4] };
23
- }
24
-
25
- const cgShort = (n) => n.replace('mcp__homegraph__homegraph_', '').replace('mcp__homegraph__', '');
26
- const tag = (n) => n === 'Read' ? 'R' : n === 'Grep' ? 'G' : n === 'Glob' ? 'Gl'
27
- : n === 'Bash' ? 'B' : n === 'Task' ? 'Ag' : n === 'ToolSearch' ? 'TS'
28
- : n.includes('homegraph') ? cgShort(n) : n;
29
-
30
- function parse(file) {
31
- if (!existsSync(file)) return null;
32
- const lines = readFileSync(file, 'utf8').split('\n').filter(Boolean);
33
- const calls = []; let result = null, initCg = 0;
34
- for (const l of lines) {
35
- let ev; try { ev = JSON.parse(l); } catch { continue; }
36
- if (ev.type === 'system' && ev.subtype === 'init') initCg = (ev.tools || []).filter(t => /homegraph/.test(t)).length;
37
- if (ev.type === 'assistant') for (const b of (ev.message?.content || [])) if (b.type === 'tool_use') {
38
- const i = b.input || {};
39
- const q = i.query ?? i.symbol ?? i.task ?? (i.from && i.to ? `${i.from}->${i.to}` : (i.file_path || i.command || ''));
40
- calls.push({ id: b.id, name: b.name, q: String(q ?? '').slice(0, 38), out: 0 });
41
- }
42
- if (ev.type === 'user') for (const b of (ev.message?.content || [])) if (b.type === 'tool_result') {
43
- const c = b.content;
44
- const txt = typeof c === 'string' ? c : Array.isArray(c) ? c.map(x => x?.text || '').join('') : '';
45
- const call = calls.find(k => k.id === b.tool_use_id); if (call) call.out = txt.length;
46
- }
47
- if (ev.type === 'result') result = ev;
48
- }
49
- const cg = calls.filter(c => c.name.includes('homegraph'));
50
- const perTool = {};
51
- for (const c of cg) { const k = cgShort(c.name); (perTool[k] ??= { n: 0, out: 0 }); perTool[k].n++; perTool[k].out += c.out; }
52
- const traceIdx = cg.findIndex(c => c.name.includes('trace'));
53
- const u = result?.usage || {};
54
- return {
55
- initCg, cg, perTool,
56
- cgSeq: cg.map(c => cgShort(c.name)),
57
- seq: calls.map(c => tag(c.name)),
58
- reads: calls.filter(c => c.name === 'Read').length,
59
- greps: calls.filter(c => c.name === 'Grep').length,
60
- cgOut: cg.reduce((s, c) => s + c.out, 0),
61
- traceUsed: traceIdx >= 0,
62
- afterTrace: traceIdx >= 0 ? cg.slice(traceIdx + 1).map(c => cgShort(c.name)) : null,
63
- turns: result?.num_turns ?? null,
64
- dur: result?.duration_ms ? Math.round(result.duration_ms / 1000) : null,
65
- cost: result?.total_cost_usd || 0,
66
- };
67
- }
68
-
69
- const cells = [];
70
- for (const d of readdirSync(AB)) {
71
- const dir = join(AB, d);
72
- if (!existsSync(join(dir, 'run-headless-with.jsonl'))) continue;
73
- const log = existsSync(join(AB, d + '.log')) ? readFileSync(join(AB, d + '.log'), 'utf8') : '';
74
- const repo = (log.match(/repo:\s*\S*\/([^\s/]+)/) || [])[1] || d;
75
- const question = (log.match(/question:\s*(.+)/) || [])[1] || '';
76
- cells.push({ cell: d, repo, question, ...(repoMeta[repo] || {}),
77
- with: parse(join(dir, 'run-headless-with.jsonl')),
78
- without: parse(join(dir, 'run-headless-without.jsonl')) });
79
- }
80
- cells.sort((a, b) => (a.files || 0) - (b.files || 0));
81
-
82
- const k = (n) => (n / 1000).toFixed(1);
83
- const pad = (s, n) => String(s).padEnd(n);
84
-
85
- // ---- per-cell sequence table ----
86
- console.log('\n=== PER-CELL: with-arm homegraph sequence + payload (sorted by repo size) ===');
87
- console.log(pad('repo', 22), pad('files', 6), 'trace', pad('cg-call sequence', 40), pad('cgOutK', 7), 'turns(w/wo)');
88
- for (const c of cells) {
89
- const w = c.with;
90
- console.log(
91
- pad(c.repo, 22), pad(c.files ?? '?', 6),
92
- pad(w.traceUsed ? 'YES' : 'no', 5),
93
- pad(w.cgSeq.join(',') || '(none)', 40),
94
- pad(k(w.cgOut), 7),
95
- `${w.turns}/${c.without?.turns}`,
96
- );
97
- }
98
-
99
- // ---- trace adoption ----
100
- const flow = cells; // every matrix question is a canonical flow question by design
101
- const used = flow.filter(c => c.with.traceUsed);
102
- console.log(`\n=== TRACE ADOPTION (all ${flow.length} cells are flow questions) ===`);
103
- console.log(`trace called in ${used.length}/${flow.length} cells`);
104
- console.log('used trace:', used.map(c => c.repo).join(', ') || '(none)');
105
- if (used.length) console.log('after-trace follow-ups:', used.map(c => `${c.repo}[${c.with.afterTrace.join(',') || 'none'}]`).join(' '));
106
-
107
- // ---- payload size by repo-size tier ----
108
- const tier = (f) => f < 200 ? 'S(<200)' : f < 2000 ? 'M(<2000)' : 'L(>=2000)';
109
- const byTier = {};
110
- for (const c of cells) { (byTier[tier(c.files || 0)] ??= []).push(c.with.cgOut); }
111
- console.log('\n=== with-arm TOTAL homegraph payload by repo-size tier ===');
112
- for (const t of ['S(<200)', 'M(<2000)', 'L(>=2000)']) {
113
- const a = byTier[t] || []; if (!a.length) continue;
114
- const avg = a.reduce((s, x) => s + x, 0) / a.length;
115
- console.log(` ${pad(t, 10)} n=${a.length} avg cgOut=${k(avg)}K range ${k(Math.min(...a))}-${k(Math.max(...a))}K`);
116
- }
117
-
118
- // ---- per-tool usage + avg payload (breadth vs path evidence) ----
119
- const tot = {};
120
- for (const c of cells) for (const [name, v] of Object.entries(c.with.perTool)) {
121
- (tot[name] ??= { n: 0, out: 0 }); tot[name].n += v.n; tot[name].out += v.out;
122
- }
123
- console.log('\n=== homegraph tool usage across all cells (n calls, avg payload/call) ===');
124
- for (const [name, v] of Object.entries(tot).sort((a, b) => b[1].n - a[1].n)) {
125
- console.log(` ${pad(name, 10)} calls=${pad(v.n, 4)} avg=${k(v.out / v.n)}K/call total=${k(v.out)}K`);
126
- }
127
-
128
- // ---- round-trips ----
129
- const sum = (arr, f) => arr.reduce((s, x) => s + (f(x) || 0), 0);
130
- const wTurns = sum(cells, c => c.with.turns), woTurns = sum(cells, c => c.without?.turns);
131
- const wCalls = sum(cells, c => c.with.cg.length);
132
- const tsAll = cells.every(c => c.with.seq[0] === 'TS');
133
- console.log('\n=== ROUND-TRIPS ===');
134
- console.log(`turns: with=${wTurns} without=${woTurns} (${((1 - wTurns / woTurns) * 100).toFixed(0)}% fewer with)`);
135
- console.log(`avg turns/cell: with=${(wTurns / cells.length).toFixed(1)} without=${(woTurns / cells.length).toFixed(1)}`);
136
- console.log(`total homegraph calls=${wCalls} (avg ${(wCalls / cells.length).toFixed(1)}/cell)`);
137
- console.log(`every with-arm opens with a ToolSearch round-trip (deferred tools): ${tsAll ? 'YES — 1 fixed tax/run' : 'no'}`);
1
+ #!/usr/bin/env node
2
+ // Mine the surviving A/B stream-json logs (/tmp/ab-matrix/<Cell>/run-headless-*.jsonl)
3
+ // for what the aggregate matrix can't see: the call SEQUENCE and per-call output SIZE.
4
+ //
5
+ // Answers three questions:
6
+ // 1. Trace adoption — on a flow question, does the with-arm actually call homegraph_trace?
7
+ // 2. Payload size vs repo size — is trace path-scoped (tiny, size-independent) while
8
+ // explore is breadth-scoped (grows with the repo / over-returns on small repos)?
9
+ // 3. Round-trips — num_turns with vs without (the real wall-clock driver).
10
+ //
11
+ // Usage: node scripts/agent-eval/seq-matrix.mjs [/tmp/ab-matrix]
12
+ import { readFileSync, readdirSync, existsSync } from 'fs';
13
+ import { join } from 'path';
14
+
15
+ const AB = process.argv[2] || '/tmp/ab-matrix';
16
+ const MD = new URL('../../docs/benchmarks/homegraph-ab-matrix.md', import.meta.url).pathname;
17
+
18
+ // repo -> {lang,size,files} from the published matrix table
19
+ const repoMeta = {};
20
+ if (existsSync(MD)) for (const line of readFileSync(MD, 'utf8').split('\n')) {
21
+ const m = line.match(/^\|\s*([^|]+?)\s*\|\s*(S|M|L)\s*\|\s*`([^`]+)`\s*\|\s*(\d+)\s*\|/);
22
+ if (m) repoMeta[m[3]] = { lang: m[1].trim(), size: m[2], files: +m[4] };
23
+ }
24
+
25
+ const cgShort = (n) => n.replace('mcp__homegraph__homegraph_', '').replace('mcp__homegraph__', '');
26
+ const tag = (n) => n === 'Read' ? 'R' : n === 'Grep' ? 'G' : n === 'Glob' ? 'Gl'
27
+ : n === 'Bash' ? 'B' : n === 'Task' ? 'Ag' : n === 'ToolSearch' ? 'TS'
28
+ : n.includes('homegraph') ? cgShort(n) : n;
29
+
30
+ function parse(file) {
31
+ if (!existsSync(file)) return null;
32
+ const lines = readFileSync(file, 'utf8').split('\n').filter(Boolean);
33
+ const calls = []; let result = null, initCg = 0;
34
+ for (const l of lines) {
35
+ let ev; try { ev = JSON.parse(l); } catch { continue; }
36
+ if (ev.type === 'system' && ev.subtype === 'init') initCg = (ev.tools || []).filter(t => /homegraph/.test(t)).length;
37
+ if (ev.type === 'assistant') for (const b of (ev.message?.content || [])) if (b.type === 'tool_use') {
38
+ const i = b.input || {};
39
+ const q = i.query ?? i.symbol ?? i.task ?? (i.from && i.to ? `${i.from}->${i.to}` : (i.file_path || i.command || ''));
40
+ calls.push({ id: b.id, name: b.name, q: String(q ?? '').slice(0, 38), out: 0 });
41
+ }
42
+ if (ev.type === 'user') for (const b of (ev.message?.content || [])) if (b.type === 'tool_result') {
43
+ const c = b.content;
44
+ const txt = typeof c === 'string' ? c : Array.isArray(c) ? c.map(x => x?.text || '').join('') : '';
45
+ const call = calls.find(k => k.id === b.tool_use_id); if (call) call.out = txt.length;
46
+ }
47
+ if (ev.type === 'result') result = ev;
48
+ }
49
+ const cg = calls.filter(c => c.name.includes('homegraph'));
50
+ const perTool = {};
51
+ for (const c of cg) { const k = cgShort(c.name); (perTool[k] ??= { n: 0, out: 0 }); perTool[k].n++; perTool[k].out += c.out; }
52
+ const traceIdx = cg.findIndex(c => c.name.includes('trace'));
53
+ const u = result?.usage || {};
54
+ return {
55
+ initCg, cg, perTool,
56
+ cgSeq: cg.map(c => cgShort(c.name)),
57
+ seq: calls.map(c => tag(c.name)),
58
+ reads: calls.filter(c => c.name === 'Read').length,
59
+ greps: calls.filter(c => c.name === 'Grep').length,
60
+ cgOut: cg.reduce((s, c) => s + c.out, 0),
61
+ traceUsed: traceIdx >= 0,
62
+ afterTrace: traceIdx >= 0 ? cg.slice(traceIdx + 1).map(c => cgShort(c.name)) : null,
63
+ turns: result?.num_turns ?? null,
64
+ dur: result?.duration_ms ? Math.round(result.duration_ms / 1000) : null,
65
+ cost: result?.total_cost_usd || 0,
66
+ };
67
+ }
68
+
69
+ const cells = [];
70
+ for (const d of readdirSync(AB)) {
71
+ const dir = join(AB, d);
72
+ if (!existsSync(join(dir, 'run-headless-with.jsonl'))) continue;
73
+ const log = existsSync(join(AB, d + '.log')) ? readFileSync(join(AB, d + '.log'), 'utf8') : '';
74
+ const repo = (log.match(/repo:\s*\S*\/([^\s/]+)/) || [])[1] || d;
75
+ const question = (log.match(/question:\s*(.+)/) || [])[1] || '';
76
+ cells.push({ cell: d, repo, question, ...(repoMeta[repo] || {}),
77
+ with: parse(join(dir, 'run-headless-with.jsonl')),
78
+ without: parse(join(dir, 'run-headless-without.jsonl')) });
79
+ }
80
+ cells.sort((a, b) => (a.files || 0) - (b.files || 0));
81
+
82
+ const k = (n) => (n / 1000).toFixed(1);
83
+ const pad = (s, n) => String(s).padEnd(n);
84
+
85
+ // ---- per-cell sequence table ----
86
+ console.log('\n=== PER-CELL: with-arm homegraph sequence + payload (sorted by repo size) ===');
87
+ console.log(pad('repo', 22), pad('files', 6), 'trace', pad('cg-call sequence', 40), pad('cgOutK', 7), 'turns(w/wo)');
88
+ for (const c of cells) {
89
+ const w = c.with;
90
+ console.log(
91
+ pad(c.repo, 22), pad(c.files ?? '?', 6),
92
+ pad(w.traceUsed ? 'YES' : 'no', 5),
93
+ pad(w.cgSeq.join(',') || '(none)', 40),
94
+ pad(k(w.cgOut), 7),
95
+ `${w.turns}/${c.without?.turns}`,
96
+ );
97
+ }
98
+
99
+ // ---- trace adoption ----
100
+ const flow = cells; // every matrix question is a canonical flow question by design
101
+ const used = flow.filter(c => c.with.traceUsed);
102
+ console.log(`\n=== TRACE ADOPTION (all ${flow.length} cells are flow questions) ===`);
103
+ console.log(`trace called in ${used.length}/${flow.length} cells`);
104
+ console.log('used trace:', used.map(c => c.repo).join(', ') || '(none)');
105
+ if (used.length) console.log('after-trace follow-ups:', used.map(c => `${c.repo}[${c.with.afterTrace.join(',') || 'none'}]`).join(' '));
106
+
107
+ // ---- payload size by repo-size tier ----
108
+ const tier = (f) => f < 200 ? 'S(<200)' : f < 2000 ? 'M(<2000)' : 'L(>=2000)';
109
+ const byTier = {};
110
+ for (const c of cells) { (byTier[tier(c.files || 0)] ??= []).push(c.with.cgOut); }
111
+ console.log('\n=== with-arm TOTAL homegraph payload by repo-size tier ===');
112
+ for (const t of ['S(<200)', 'M(<2000)', 'L(>=2000)']) {
113
+ const a = byTier[t] || []; if (!a.length) continue;
114
+ const avg = a.reduce((s, x) => s + x, 0) / a.length;
115
+ console.log(` ${pad(t, 10)} n=${a.length} avg cgOut=${k(avg)}K range ${k(Math.min(...a))}-${k(Math.max(...a))}K`);
116
+ }
117
+
118
+ // ---- per-tool usage + avg payload (breadth vs path evidence) ----
119
+ const tot = {};
120
+ for (const c of cells) for (const [name, v] of Object.entries(c.with.perTool)) {
121
+ (tot[name] ??= { n: 0, out: 0 }); tot[name].n += v.n; tot[name].out += v.out;
122
+ }
123
+ console.log('\n=== homegraph tool usage across all cells (n calls, avg payload/call) ===');
124
+ for (const [name, v] of Object.entries(tot).sort((a, b) => b[1].n - a[1].n)) {
125
+ console.log(` ${pad(name, 10)} calls=${pad(v.n, 4)} avg=${k(v.out / v.n)}K/call total=${k(v.out)}K`);
126
+ }
127
+
128
+ // ---- round-trips ----
129
+ const sum = (arr, f) => arr.reduce((s, x) => s + (f(x) || 0), 0);
130
+ const wTurns = sum(cells, c => c.with.turns), woTurns = sum(cells, c => c.without?.turns);
131
+ const wCalls = sum(cells, c => c.with.cg.length);
132
+ const tsAll = cells.every(c => c.with.seq[0] === 'TS');
133
+ console.log('\n=== ROUND-TRIPS ===');
134
+ console.log(`turns: with=${wTurns} without=${woTurns} (${((1 - wTurns / woTurns) * 100).toFixed(0)}% fewer with)`);
135
+ console.log(`avg turns/cell: with=${(wTurns / cells.length).toFixed(1)} without=${(woTurns / cells.length).toFixed(1)}`);
136
+ console.log(`total homegraph calls=${wCalls} (avg ${(wCalls / cells.length).toFixed(1)}/cell)`);
137
+ console.log(`every with-arm opens with a ToolSearch round-trip (deferred tools): ${tsAll ? 'YES — 1 fixed tax/run' : 'no'}`);
Binary file
@@ -1,123 +1,123 @@
1
- #!/usr/bin/env bash
2
- #
3
- # Build a self-contained HomeGraph bundle: an official Node runtime + the
4
- # compiled app + its production deps, so HomeGraph runs with NO system Node and
5
- # NO native build — node:sqlite is built into the bundled Node. One archive per
6
- # platform.
7
- #
8
- # Because dropping better-sqlite3 left zero native addons, the recipe is pure
9
- # file-packaging (download the target's Node, copy the app, archive) — so any
10
- # platform's bundle can be built on any OS. No cross-compile, no native runners.
11
- #
12
- # Usage:
13
- # scripts/build-bundle.sh <target> [node-version]
14
- # target: darwin-arm64 | darwin-x64 | linux-x64 | linux-arm64
15
- # | win32-x64 | win32-arm64
16
- # node-version: e.g. v24.16.0 (default below; pin for reproducible builds)
17
- #
18
- # Output:
19
- # unix: release/homegraph-<target>.tar.gz (launcher: bin/homegraph)
20
- # windows: release/homegraph-<target>.zip (launcher: bin/homegraph.cmd)
21
- set -euo pipefail
22
-
23
- TARGET="${1:?usage: build-bundle.sh <target> [node-version]}"
24
- NODE_VERSION="${2:-v24.16.0}"
25
-
26
- ROOT="$(cd "$(dirname "$0")/.." && pwd)"
27
- OUT="$ROOT/release"
28
- WORK="$(mktemp -d)"
29
- trap 'rm -rf "$WORK"' EXIT
30
-
31
- ARCH="${TARGET##*-}" # x64 | arm64
32
- OSFAM="${TARGET%-*}" # darwin | linux | win32
33
-
34
- echo "[bundle] target=${TARGET} node=${NODE_VERSION}"
35
-
36
- # 1. Download + extract the official Node runtime for the target platform.
37
- if [ "$OSFAM" = "win32" ]; then
38
- NODE_DIST="node-${NODE_VERSION}-win-${ARCH}"
39
- NODE_URL="https://nodejs.org/dist/${NODE_VERSION}/${NODE_DIST}.zip"
40
- echo "[bundle] downloading ${NODE_URL}"
41
- curl -fsSL "$NODE_URL" -o "$WORK/node.zip"
42
- if command -v unzip >/dev/null 2>&1; then
43
- unzip -q "$WORK/node.zip" -d "$WORK"
44
- else
45
- tar -xf "$WORK/node.zip" -C "$WORK" # bsdtar can read zip
46
- fi
47
- NODE_BIN="$WORK/${NODE_DIST}/node.exe"
48
- else
49
- NODE_DIST="node-${NODE_VERSION}-${TARGET}"
50
- NODE_URL="https://nodejs.org/dist/${NODE_VERSION}/${NODE_DIST}.tar.gz"
51
- echo "[bundle] downloading ${NODE_URL}"
52
- curl -fsSL "$NODE_URL" -o "$WORK/node.tar.gz"
53
- tar -xzf "$WORK/node.tar.gz" -C "$WORK"
54
- NODE_BIN="$WORK/${NODE_DIST}/bin/node"
55
- fi
56
- [ -f "$NODE_BIN" ] || { echo "[bundle] error: node binary not found ($NODE_BIN)" >&2; exit 1; }
57
-
58
- # 2. Build the app (compiled JS + copied wasm/schema assets).
59
- echo "[bundle] building app"
60
- ( cd "$ROOT" && npm run build >/dev/null )
61
-
62
- # 3. Stage: app + production-only deps (pure JS/wasm → portable across platforms).
63
- STAGE="$WORK/homegraph-${TARGET}"
64
- mkdir -p "$STAGE/lib" "$STAGE/bin"
65
- cp -R "$ROOT/dist" "$STAGE/lib/dist"
66
- cp "$ROOT/package.json" "$ROOT/package-lock.json" "$STAGE/lib/"
67
- echo "[bundle] installing production dependencies"
68
- ( cd "$STAGE/lib" && npm ci --omit=dev --ignore-scripts >/dev/null 2>&1 )
69
- rm -f "$STAGE/lib/package-lock.json"
70
-
71
- # 4. Vendored Node + launcher (the launcher uses the bundled Node by relative
72
- # path, so no system Node is ever needed).
73
- #
74
- # `--liftoff-only`: keep tree-sitter's large WASM grammars on V8's Liftoff
75
- # baseline compiler so they never reach the turboshaft optimizing tier, whose
76
- # per-compilation Zone arena OOMs the whole process (`Fatal process out of
77
- # memory: Zone`) on Node >= 22 — even with tens of GB free. The flag is read at
78
- # V8 engine init so it must be on node's command line; the parse worker inherits
79
- # it. See issues #293/#298 and src/extraction/wasm-runtime-flags.ts. (The CLI
80
- # also self-relaunches with this flag when launched without it, so non-bundled
81
- # runs are covered too; passing it here avoids that extra spawn.)
82
- if [ "$OSFAM" = "win32" ]; then
83
- cp "$NODE_BIN" "$STAGE/node.exe"
84
- printf '@"%%~dp0..\\node.exe" --liftoff-only "%%~dp0..\\lib\\dist\\bin\\homegraph.js" %%*\r\n' \
85
- > "$STAGE/bin/homegraph.cmd"
86
- else
87
- cp "$NODE_BIN" "$STAGE/node"
88
- cat > "$STAGE/bin/homegraph" <<'LAUNCH'
89
- #!/bin/sh
90
- # Resolve symlinks (e.g. the ~/.local/bin/homegraph link install.sh creates) so
91
- # we find the real bundle dir, not the symlink's location.
92
- SELF="$0"
93
- while [ -L "$SELF" ]; do
94
- target="$(readlink "$SELF")"
95
- case "$target" in
96
- /*) SELF="$target" ;;
97
- *) SELF="$(dirname "$SELF")/$target" ;;
98
- esac
99
- done
100
- DIR="$(cd "$(dirname "$SELF")/.." && pwd)"
101
- # Thread the MCP host's pid to the server's orphan watchdog (issue #1185).
102
- # $PPID is our parent — the host itself when it launched this script directly;
103
- # an already-threaded value (the npm shim sets the true host pid) wins.
104
- HOMEGRAPH_HOST_PPID="${HOMEGRAPH_HOST_PPID:-$PPID}"
105
- export HOMEGRAPH_HOST_PPID
106
- # --liftoff-only: avoid the V8 turboshaft WASM Zone OOM (issues #293/#298).
107
- exec "$DIR/node" --liftoff-only "$DIR/lib/dist/bin/homegraph.js" "$@"
108
- LAUNCH
109
- chmod +x "$STAGE/bin/homegraph"
110
- fi
111
-
112
- # 5. Archive (.zip for Windows, .tar.gz otherwise).
113
- mkdir -p "$OUT"
114
- if [ "$OSFAM" = "win32" ]; then
115
- ARCHIVE="$OUT/homegraph-${TARGET}.zip"
116
- rm -f "$ARCHIVE"
117
- ( cd "$WORK" && zip -rqX "$ARCHIVE" "homegraph-${TARGET}" )
118
- else
119
- ARCHIVE="$OUT/homegraph-${TARGET}.tar.gz"
120
- # --no-xattrs: don't embed macOS xattrs that make GNU tar warn on Linux.
121
- tar --no-xattrs -czf "$ARCHIVE" -C "$WORK" "homegraph-${TARGET}"
122
- fi
123
- echo "[bundle] wrote ${ARCHIVE} ($(du -h "$ARCHIVE" | cut -f1))"
1
+ #!/usr/bin/env bash
2
+ #
3
+ # Build a self-contained HomeGraph bundle: an official Node runtime + the
4
+ # compiled app + its production deps, so HomeGraph runs with NO system Node and
5
+ # NO native build — node:sqlite is built into the bundled Node. One archive per
6
+ # platform.
7
+ #
8
+ # Because dropping better-sqlite3 left zero native addons, the recipe is pure
9
+ # file-packaging (download the target's Node, copy the app, archive) — so any
10
+ # platform's bundle can be built on any OS. No cross-compile, no native runners.
11
+ #
12
+ # Usage:
13
+ # scripts/build-bundle.sh <target> [node-version]
14
+ # target: darwin-arm64 | darwin-x64 | linux-x64 | linux-arm64
15
+ # | win32-x64 | win32-arm64
16
+ # node-version: e.g. v24.16.0 (default below; pin for reproducible builds)
17
+ #
18
+ # Output:
19
+ # unix: release/homegraph-<target>.tar.gz (launcher: bin/homegraph)
20
+ # windows: release/homegraph-<target>.zip (launcher: bin/homegraph.cmd)
21
+ set -euo pipefail
22
+
23
+ TARGET="${1:?usage: build-bundle.sh <target> [node-version]}"
24
+ NODE_VERSION="${2:-v24.16.0}"
25
+
26
+ ROOT="$(cd "$(dirname "$0")/.." && pwd)"
27
+ OUT="$ROOT/release"
28
+ WORK="$(mktemp -d)"
29
+ trap 'rm -rf "$WORK"' EXIT
30
+
31
+ ARCH="${TARGET##*-}" # x64 | arm64
32
+ OSFAM="${TARGET%-*}" # darwin | linux | win32
33
+
34
+ echo "[bundle] target=${TARGET} node=${NODE_VERSION}"
35
+
36
+ # 1. Download + extract the official Node runtime for the target platform.
37
+ if [ "$OSFAM" = "win32" ]; then
38
+ NODE_DIST="node-${NODE_VERSION}-win-${ARCH}"
39
+ NODE_URL="https://nodejs.org/dist/${NODE_VERSION}/${NODE_DIST}.zip"
40
+ echo "[bundle] downloading ${NODE_URL}"
41
+ curl -fsSL "$NODE_URL" -o "$WORK/node.zip"
42
+ if command -v unzip >/dev/null 2>&1; then
43
+ unzip -q "$WORK/node.zip" -d "$WORK"
44
+ else
45
+ tar -xf "$WORK/node.zip" -C "$WORK" # bsdtar can read zip
46
+ fi
47
+ NODE_BIN="$WORK/${NODE_DIST}/node.exe"
48
+ else
49
+ NODE_DIST="node-${NODE_VERSION}-${TARGET}"
50
+ NODE_URL="https://nodejs.org/dist/${NODE_VERSION}/${NODE_DIST}.tar.gz"
51
+ echo "[bundle] downloading ${NODE_URL}"
52
+ curl -fsSL "$NODE_URL" -o "$WORK/node.tar.gz"
53
+ tar -xzf "$WORK/node.tar.gz" -C "$WORK"
54
+ NODE_BIN="$WORK/${NODE_DIST}/bin/node"
55
+ fi
56
+ [ -f "$NODE_BIN" ] || { echo "[bundle] error: node binary not found ($NODE_BIN)" >&2; exit 1; }
57
+
58
+ # 2. Build the app (compiled JS + copied wasm/schema assets).
59
+ echo "[bundle] building app"
60
+ ( cd "$ROOT" && npm run build >/dev/null )
61
+
62
+ # 3. Stage: app + production-only deps (pure JS/wasm → portable across platforms).
63
+ STAGE="$WORK/homegraph-${TARGET}"
64
+ mkdir -p "$STAGE/lib" "$STAGE/bin"
65
+ cp -R "$ROOT/dist" "$STAGE/lib/dist"
66
+ cp "$ROOT/package.json" "$ROOT/package-lock.json" "$STAGE/lib/"
67
+ echo "[bundle] installing production dependencies"
68
+ ( cd "$STAGE/lib" && npm ci --omit=dev --ignore-scripts >/dev/null 2>&1 )
69
+ rm -f "$STAGE/lib/package-lock.json"
70
+
71
+ # 4. Vendored Node + launcher (the launcher uses the bundled Node by relative
72
+ # path, so no system Node is ever needed).
73
+ #
74
+ # `--liftoff-only`: keep tree-sitter's large WASM grammars on V8's Liftoff
75
+ # baseline compiler so they never reach the turboshaft optimizing tier, whose
76
+ # per-compilation Zone arena OOMs the whole process (`Fatal process out of
77
+ # memory: Zone`) on Node >= 22 — even with tens of GB free. The flag is read at
78
+ # V8 engine init so it must be on node's command line; the parse worker inherits
79
+ # it. See issues #293/#298 and src/extraction/wasm-runtime-flags.ts. (The CLI
80
+ # also self-relaunches with this flag when launched without it, so non-bundled
81
+ # runs are covered too; passing it here avoids that extra spawn.)
82
+ if [ "$OSFAM" = "win32" ]; then
83
+ cp "$NODE_BIN" "$STAGE/node.exe"
84
+ printf '@"%%~dp0..\\node.exe" --liftoff-only "%%~dp0..\\lib\\dist\\bin\\homegraph.js" %%*\r\n' \
85
+ > "$STAGE/bin/homegraph.cmd"
86
+ else
87
+ cp "$NODE_BIN" "$STAGE/node"
88
+ cat > "$STAGE/bin/homegraph" <<'LAUNCH'
89
+ #!/bin/sh
90
+ # Resolve symlinks (e.g. the ~/.local/bin/homegraph link install.sh creates) so
91
+ # we find the real bundle dir, not the symlink's location.
92
+ SELF="$0"
93
+ while [ -L "$SELF" ]; do
94
+ target="$(readlink "$SELF")"
95
+ case "$target" in
96
+ /*) SELF="$target" ;;
97
+ *) SELF="$(dirname "$SELF")/$target" ;;
98
+ esac
99
+ done
100
+ DIR="$(cd "$(dirname "$SELF")/.." && pwd)"
101
+ # Thread the MCP host's pid to the server's orphan watchdog (issue #1185).
102
+ # $PPID is our parent — the host itself when it launched this script directly;
103
+ # an already-threaded value (the npm shim sets the true host pid) wins.
104
+ HOMEGRAPH_HOST_PPID="${HOMEGRAPH_HOST_PPID:-$PPID}"
105
+ export HOMEGRAPH_HOST_PPID
106
+ # --liftoff-only: avoid the V8 turboshaft WASM Zone OOM (issues #293/#298).
107
+ exec "$DIR/node" --liftoff-only "$DIR/lib/dist/bin/homegraph.js" "$@"
108
+ LAUNCH
109
+ chmod +x "$STAGE/bin/homegraph"
110
+ fi
111
+
112
+ # 5. Archive (.zip for Windows, .tar.gz otherwise).
113
+ mkdir -p "$OUT"
114
+ if [ "$OSFAM" = "win32" ]; then
115
+ ARCHIVE="$OUT/homegraph-${TARGET}.zip"
116
+ rm -f "$ARCHIVE"
117
+ ( cd "$WORK" && zip -rqX "$ARCHIVE" "homegraph-${TARGET}" )
118
+ else
119
+ ARCHIVE="$OUT/homegraph-${TARGET}.tar.gz"
120
+ # --no-xattrs: don't embed macOS xattrs that make GNU tar warn on Linux.
121
+ tar --no-xattrs -czf "$ARCHIVE" -C "$WORK" "homegraph-${TARGET}"
122
+ fi
123
+ echo "[bundle] wrote ${ARCHIVE} ($(du -h "$ARCHIVE" | cut -f1))"