@tech-leads-club/harness-toolkit 0.3.4 → 0.3.6

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/bin/tlc-build.mjs CHANGED
@@ -49,10 +49,19 @@ function sourcesIn(dir) {
49
49
  * one program that is allowed to run it. Splitting can come back when no library module carries that guard, and
50
50
  * not before — the size win is real and it is not worth a CLI that cannot install.
51
51
  */
52
+ /**
53
+ * why `--minify`: one bundle per entry means the core is inlined 24 times, and minifying is the part of that cost
54
+ * that can be removed without touching module identity. Measured: `dist/` 5.0 MB → 3.0 MB, `stop.mjs` 281,400 →
55
+ * 164,937 bytes. Splitting would take it to 548 KB and cannot be done until no library module self-executes
56
+ * ([/decisions/ad-098.md](/decisions/ad-098.md)).
57
+ *
58
+ * invariant: safe because nothing here reads a function or class name at runtime, and no stack trace reaches an
59
+ * operator — both checked before turning it on. Renaming locals is all this does.
60
+ */
52
61
  function buildOne(source, out) {
53
62
  const result = spawnSync(
54
63
  "bun",
55
- ["build", "--target=node", "--format=esm", `--outfile=${out}`, source],
64
+ ["build", "--target=node", "--format=esm", "--minify", `--outfile=${out}`, source],
56
65
  { stdio: "inherit" },
57
66
  );
58
67
  if (result.error?.code === "ENOENT") {
package/bin/tlc-cli.ts CHANGED
@@ -1048,7 +1048,7 @@ export type Action =
1048
1048
  | { kind: "policy"; accept: string[] }
1049
1049
  | { kind: "prices-help" }
1050
1050
  | { kind: "prices-refresh"; scope: string }
1051
- | { kind: "prices-lookup"; modelId: string }
1051
+ | { kind: "prices-lookup"; modelId: string; provider: string }
1052
1052
  | { kind: "entry"; entry: string; args: string[] }
1053
1053
  | { kind: "install"; args: string[] }
1054
1054
  | { kind: "unknown"; cmd: string };
@@ -1146,10 +1146,17 @@ export function route(args: string[]): Action {
1146
1146
  const modelId = args[2];
1147
1147
  if (!modelId) {
1148
1148
  throw new UsageError(
1149
- "usage: tlc harness prices lookup <model-id>\ndetail: tlc harness help prices",
1149
+ "usage: tlc harness prices lookup <model-id> [provider]\ndetail: tlc harness help prices",
1150
1150
  );
1151
1151
  }
1152
- return { kind: "prices-lookup", modelId };
1152
+ /**
1153
+ * hazard: the provider was parsed by the tool and dropped by this route, so every lookup ran with an empty
1154
+ * provider — which is the one input that matches no provider plane. `prices lookup composer-2.5 cursor`
1155
+ * answered `source: missing` for a model priced `$0.5/$2.5`, while the same call straight to the tool
1156
+ * resolved it. The help and `docs/measure.md` had documented the argument all along
1157
+ * ([/decisions/ad-098.md](/decisions/ad-098.md)).
1158
+ */
1159
+ return { kind: "prices-lookup", modelId, provider: args[3] ?? "" };
1153
1160
  }
1154
1161
  throw new UsageError(
1155
1162
  "usage: tlc harness prices refresh [all|cursor|litellm] | tlc harness prices lookup <model>\ndetail: tlc harness help prices",
@@ -1644,7 +1651,12 @@ function main(argv: string[]): void {
1644
1651
  runEntry("refresh-model-prices", [action.scope], root);
1645
1652
  break;
1646
1653
  case "prices-lookup":
1647
- runEntry("price-lookup", json ? [action.modelId, JSON_FLAG] : [action.modelId], root);
1654
+ runEntry(
1655
+ "price-lookup",
1656
+ // invariant: the provider reaches the tool, or the lookup can only ever match the vendor plane.
1657
+ [action.modelId, ...(action.provider ? [action.provider] : []), ...(json ? [JSON_FLAG] : [])],
1658
+ root,
1659
+ );
1648
1660
  break;
1649
1661
  case "install":
1650
1662
  runInstall(action.args, root);