@tech-leads-club/harness-toolkit 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.
Files changed (41) hide show
  1. package/bin/tlc-build.mjs +35 -6
  2. package/dist/chunks/compact-before-1e4qg1qt.mjs +1185 -0
  3. package/dist/chunks/compact-before-2hpbfxm5.mjs +5782 -0
  4. package/dist/chunks/compact-before-49j320yp.mjs +1283 -0
  5. package/dist/chunks/compact-before-4jrq0sqs.mjs +61 -0
  6. package/dist/chunks/compact-before-6w8n1vh1.mjs +186 -0
  7. package/dist/chunks/compact-before-7sdmwswh.mjs +52 -0
  8. package/dist/chunks/compact-before-beqpmqrm.mjs +187 -0
  9. package/dist/chunks/compact-before-j9y4jgn4.mjs +845 -0
  10. package/dist/chunks/compact-before-pk86tqx2.mjs +118 -0
  11. package/dist/chunks/compact-before-pkqk5v29.mjs +137 -0
  12. package/dist/chunks/compact-before-w1293m4n.mjs +315 -0
  13. package/dist/chunks/compact-before-wnnds45y.mjs +26 -0
  14. package/dist/chunks/compact-before-wt2c3nh4.mjs +551 -0
  15. package/dist/compact-before.mjs +13 -7961
  16. package/dist/doctor.mjs +33 -8480
  17. package/dist/help-topic.mjs +6 -14
  18. package/dist/init-project.mjs +36 -793
  19. package/dist/install-runtime.mjs +17 -7268
  20. package/dist/lessons-cli.mjs +25 -7043
  21. package/dist/obs-cli.mjs +27 -7037
  22. package/dist/price-lookup.mjs +11 -201
  23. package/dist/prompt-submit.mjs +14 -7974
  24. package/dist/refresh-model-prices.mjs +26 -7061
  25. package/dist/response-after.mjs +11 -7961
  26. package/dist/run.mjs +10 -7960
  27. package/dist/session-end.mjs +14 -8029
  28. package/dist/session-start.mjs +20 -8075
  29. package/dist/shim.mjs +18 -7024
  30. package/dist/stop.mjs +29 -8042
  31. package/dist/subagent-start.mjs +13 -7983
  32. package/dist/subagent-stop.mjs +11 -7961
  33. package/dist/support.mjs +21 -7168
  34. package/dist/tlc-cli.mjs +65 -8200
  35. package/dist/tool-after.mjs +20 -8176
  36. package/dist/tool-before.mjs +15 -7990
  37. package/dist/tool-failure.mjs +14 -7961
  38. package/dist/uninstall-runtime.mjs +61 -1008
  39. package/docs/log.md +4 -0
  40. package/package.json +1 -1
  41. package/src/core/release/release.version.ts +10 -4
package/bin/tlc-build.mjs CHANGED
@@ -37,14 +37,37 @@ function sourcesIn(dir) {
37
37
  .map((entry) => ({ name: basename(entry.name, ".ts"), source: join(dir, entry.name) }));
38
38
  }
39
39
 
40
- function buildOne(source, out) {
40
+ /**
41
+ * why one invocation with every entry: `--splitting` can only share a chunk between entries it sees together.
42
+ * Built one at a time, each bundle inlined the whole core — measured, 24 bundles of ~257 KB each where more than
43
+ * half of every one was byte-identical to its neighbour: 5.0 MB of `dist/` to carry 548 KB of distinct code
44
+ * ([/decisions/ad-098.md](/decisions/ad-098.md)).
45
+ *
46
+ * invariant: the entry names stay flat and keep `.mjs`, because the launcher resolves `dist/<entry>.mjs` and the
47
+ * hooks on every installed machine name the launcher. Chunks go in a subdirectory, so pruning an orphan entry
48
+ * never has to tell the two apart.
49
+ */
50
+ const CHUNK_DIR = "chunks";
51
+
52
+ function build(targets) {
41
53
  const result = spawnSync(
42
54
  "bun",
43
- ["build", "--target=node", "--format=esm", `--outfile=${out}`, source],
55
+ [
56
+ "build",
57
+ "--target=node",
58
+ "--format=esm",
59
+ "--splitting",
60
+ `--outdir=${dist}`,
61
+ "--entry-naming",
62
+ "[name].mjs",
63
+ "--chunk-naming",
64
+ `${CHUNK_DIR}/[name]-[hash].mjs`,
65
+ ...targets.map((target) => target.source),
66
+ ],
44
67
  { stdio: "inherit" },
45
68
  );
46
69
  if (result.error?.code === "ENOENT") {
47
- console.error("tlc-build: Bun is not on PATH, and dist/ is committed so the bundler is part of the artefact.");
70
+ console.error("tlc-build: Bun is not on PATH, and it is the only bundler this builds with.");
48
71
  console.error(" curl -fsSL https://bun.sh/install | bash");
49
72
  process.exit(1);
50
73
  }
@@ -61,9 +84,15 @@ const targets = [
61
84
 
62
85
  mkdirSync(dist, { recursive: true });
63
86
  console.log(`tlc-build → ${dist}`);
64
- for (const target of targets) {
65
- buildOne(target.source, join(dist, `${target.name}.mjs`));
66
- }
87
+
88
+ /**
89
+ * hazard: chunk names carry a content hash, so a rebuild after a source change writes new ones and leaves the old
90
+ * ones behind. Nothing references them and they ship anyway, growing the package with every build.
91
+ *
92
+ * invariant: the chunk directory is derived, so it is replaced rather than merged.
93
+ */
94
+ rmSync(join(dist, CHUNK_DIR), { recursive: true, force: true });
95
+ build(targets);
67
96
 
68
97
  // invariant: the launcher stays executable on a filesystem that tracks the bit. A no-op where it does not.
69
98
  try {