@tech-leads-club/harness-toolkit 0.16.1 → 0.16.3

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 (40) hide show
  1. package/README.md +9 -5
  2. package/bin/tlc-exec.mjs +14 -2
  3. package/dist/compact-before.mjs +70 -70
  4. package/dist/doctor.mjs +73 -73
  5. package/dist/init-project.mjs +71 -71
  6. package/dist/install-runtime.mjs +67 -67
  7. package/dist/lessons-cli.mjs +69 -69
  8. package/dist/obs-cli.mjs +68 -68
  9. package/dist/prompt-submit.mjs +86 -86
  10. package/dist/refresh-model-prices.mjs +69 -69
  11. package/dist/response-after.mjs +70 -70
  12. package/dist/run.mjs +69 -69
  13. package/dist/session-end.mjs +69 -69
  14. package/dist/session-start.mjs +71 -71
  15. package/dist/shim.mjs +66 -66
  16. package/dist/ship-gate.mjs +83 -83
  17. package/dist/stop.mjs +91 -91
  18. package/dist/subagent-start.mjs +70 -70
  19. package/dist/subagent-stop.mjs +88 -88
  20. package/dist/support.mjs +85 -85
  21. package/dist/tlc-cli.mjs +83 -83
  22. package/dist/tool-after.mjs +86 -86
  23. package/dist/tool-before.mjs +94 -94
  24. package/dist/tool-failure.mjs +70 -70
  25. package/dist/uninstall-runtime.mjs +3 -3
  26. package/docs/architecture.md +20 -10
  27. package/docs/log.md +4 -0
  28. package/docs/providers/cursor.md +2 -1
  29. package/package.json +1 -1
  30. package/src/core/handoff/handoff.types.ts +4 -0
  31. package/src/core/skill/skill.link.ts +4 -2
  32. package/src/core/supply-chain/supply-chain.catalog.ts +8 -1
  33. package/src/entrypoints/prompt-submit.ts +1 -1
  34. package/src/entrypoints/run.ts +1 -1
  35. package/src/entrypoints/ship-gate.ts +1 -1
  36. package/src/entrypoints/stop.ts +7 -3
  37. package/src/entrypoints/support.ts +37 -13
  38. package/src/entrypoints/tool-before.ts +22 -2
  39. package/src/platform/git.ts +27 -1
  40. package/src/providers/cursor/cursor.detect.ts +1 -4
package/README.md CHANGED
@@ -448,11 +448,15 @@ Healthy install checklist:
448
448
 
449
449
  ```mermaid
450
450
  graph LR
451
- EV["provider event<br/><i>Cursor or Claude Code hook</i>"]
452
- HK["user-level hook file"]
453
- LX["bin/tlc-exec.mjs &lt;handler&gt;<br/><i>Bun first, Node + dist fallback</i>"]
454
- EP["src/entrypoints/&lt;handler&gt;.ts<br/><i>core + resolved adapter</i>"]
455
- OUT["follow-up · handoff · observability<br/><i>under project policy</i>"]
451
+ EV["`provider event
452
+ *Cursor or Claude Code hook*`"]
453
+ HK["`user-level hook file`"]
454
+ LX["`bin/tlc-exec.mjs #60;handler#62;
455
+ *Bun first, Node + dist fallback*`"]
456
+ EP["`src/entrypoints/#60;handler#62;.ts
457
+ *core + resolved adapter*`"]
458
+ OUT["`follow-up · handoff · observability
459
+ *under project policy*`"]
456
460
  EV --> HK --> LX --> EP --> OUT
457
461
  ```
458
462
 
package/bin/tlc-exec.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { spawnSync } from "node:child_process";
3
- import { existsSync, mkdirSync, readFileSync, realpathSync, writeFileSync } from "node:fs";
3
+ import { existsSync, mkdirSync, readFileSync, realpathSync, writeFileSync, writeSync } from "node:fs";
4
4
  import { homedir } from "node:os";
5
5
  import { delimiter, dirname, join } from "node:path";
6
6
  import { fileURLToPath, pathToFileURL } from "node:url";
@@ -235,8 +235,10 @@ export function decideRuntime({ harnessHome, entry, bunPath, nodeMajor, distExis
235
235
  }
236
236
 
237
237
  function run(harnessHome, command, commandArgs, origin = harnessHome, entry = "") {
238
+ const isHook = HOOK_ENTRIES.has(entry);
238
239
  const result = spawnSync(command, commandArgs, {
239
- stdio: "inherit",
240
+ stdio: isHook ? ["inherit", "pipe", "inherit"] : "inherit",
241
+ maxBuffer: 64 * 1024 * 1024,
240
242
  // why: `TLC_ORIGIN` is where this copy physically lives, which is not `TLC_HOME` once an npm-installed shim
241
243
  // is driving the runtime installed under the conventional path. `tlc harness install` needs the former as
242
244
  // its source and the latter as its destination, and nothing else in the runtime reads it.
@@ -259,6 +261,16 @@ function run(harnessHome, command, commandArgs, origin = harnessHome, entry = ""
259
261
  }
260
262
  process.exit(127);
261
263
  }
264
+ if (isHook) {
265
+ const stdout = result.stdout ?? Buffer.alloc(0);
266
+ if (stdout.toString("utf8").trim() === "") {
267
+ console.error(
268
+ `tlc: ${entry} produced no verdict (exit ${result.status ?? result.signal}); carrying on without one.`,
269
+ );
270
+ carryOn();
271
+ }
272
+ writeSync(1, stdout);
273
+ }
262
274
  process.exit(result.status ?? 1);
263
275
  }
264
276