@harness-engineering/cli 1.25.5 → 1.25.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.
Files changed (53) hide show
  1. package/dist/{agents-md-COWXFHR5.js → agents-md-2PYJM2MK.js} +3 -3
  2. package/dist/{architecture-EYPG4ZMC.js → architecture-VCLB7A23.js} +4 -4
  3. package/dist/{assess-project-JQPEVJIA.js → assess-project-64C6LIKN.js} +1 -1
  4. package/dist/bin/harness-mcp.js +16 -15
  5. package/dist/bin/harness.js +26 -25
  6. package/dist/business-knowledge-6RHYJOB3.js +7 -0
  7. package/dist/{check-phase-gate-AJRMDGYW.js → check-phase-gate-RT6PGEHY.js} +4 -4
  8. package/dist/{chunk-KHMKAC6E.js → chunk-42ZZLMYD.js} +115 -103
  9. package/dist/{chunk-2X42NMPD.js → chunk-43VBX44J.js} +218 -106
  10. package/dist/{chunk-UB6NZNJJ.js → chunk-4YEBV2FT.js} +2 -2
  11. package/dist/{chunk-ZYYVDA5K.js → chunk-7BAGSY5Q.js} +1 -1
  12. package/dist/{chunk-KDHZAL4B.js → chunk-BUJOMC3O.js} +1 -1
  13. package/dist/{chunk-YFIALHGI.js → chunk-CBZECDCW.js} +5 -5
  14. package/dist/{chunk-KXUCIAM4.js → chunk-EY6F2QXW.js} +1 -1
  15. package/dist/{chunk-24ZGGCIW.js → chunk-FL6A72LV.js} +1 -1
  16. package/dist/{chunk-JD4FGVHH.js → chunk-JQCS75DY.js} +4 -4
  17. package/dist/{chunk-5R2LFUU3.js → chunk-JUXFYB2K.js} +1 -1
  18. package/dist/{chunk-2TFT7XRX.js → chunk-KJC4SE7C.js} +9 -9
  19. package/dist/{chunk-4NK7Z3BP.js → chunk-R2BI5UPK.js} +1 -1
  20. package/dist/{chunk-2OM5TA56.js → chunk-R7P2FMJT.js} +209 -182
  21. package/dist/chunk-RC5ZY3EV.js +82 -0
  22. package/dist/{chunk-K2SON7TI.js → chunk-RDQGCHKD.js} +252 -57
  23. package/dist/{chunk-WN6YIQ66.js → chunk-RKZW3FDF.js} +1 -1
  24. package/dist/{chunk-BOQRTARD.js → chunk-SMY35HJM.js} +1 -1
  25. package/dist/{chunk-KVK3KAFQ.js → chunk-SZZ5UQL7.js} +6 -6
  26. package/dist/{chunk-2X336Q7J.js → chunk-U2OMWI7Z.js} +1 -1
  27. package/dist/{chunk-KWQTMJ3B.js → chunk-VELT5VAG.js} +1 -1
  28. package/dist/{chunk-Q6ZEUMOF.js → chunk-WEOGCL7B.js} +3 -3
  29. package/dist/{chunk-PVRKHUTA.js → chunk-X2JJ3CPG.js} +8 -8
  30. package/dist/{chunk-2OIPQMU5.js → chunk-XLO4AXXM.js} +9 -9
  31. package/dist/{chunk-UI6NWJJK.js → chunk-XMEEYMGE.js} +1 -1
  32. package/dist/{chunk-BVRWLK5U.js → chunk-Y5JA4J2M.js} +2 -2
  33. package/dist/{chunk-HWLHJSJQ.js → chunk-ZAKUCM7O.js} +2 -2
  34. package/dist/{ci-workflow-35KBJC2U.js → ci-workflow-SZL3KVUK.js} +3 -3
  35. package/dist/{dist-RADHOOXG.js → dist-GRW3X2ZQ.js} +3 -1
  36. package/dist/{dist-UMONICND.js → dist-T3DGV5UN.js} +2 -2
  37. package/dist/{docs-T5J2AJH6.js → docs-WDLJORLK.js} +4 -4
  38. package/dist/{engine-KWHV2LUX.js → engine-2YWYRCKK.js} +3 -3
  39. package/dist/{entropy-GEBHWBPR.js → entropy-PJGTOORX.js} +3 -3
  40. package/dist/{feedback-I4QPE3RI.js → feedback-M5KCJKL2.js} +1 -1
  41. package/dist/{generate-agent-definitions-3XNR77ET.js → generate-agent-definitions-MFDW6LZT.js} +4 -4
  42. package/dist/{graph-loader-JHQVQRUS.js → graph-loader-QMKXT454.js} +1 -1
  43. package/dist/index.js +26 -25
  44. package/dist/{loader-MN2CZXPG.js → loader-6O52FYHE.js} +3 -3
  45. package/dist/{mcp-XSU77BZY.js → mcp-GGNFWKVC.js} +16 -15
  46. package/dist/{performance-7I5MCEFP.js → performance-337U5URQ.js} +4 -4
  47. package/dist/{review-pipeline-PWPKJXSN.js → review-pipeline-DB5RD4SN.js} +3 -3
  48. package/dist/{runtime-ZYEFJSGS.js → runtime-B74EN2WD.js} +3 -3
  49. package/dist/{scan-MPJ6JHUY.js → scan-DXQUHGTT.js} +1 -1
  50. package/dist/{security-OVTGS7DL.js → security-3AYN6FVU.js} +1 -1
  51. package/dist/{validate-ACIP5BUO.js → validate-35CD7VWN.js} +4 -4
  52. package/dist/{validate-cross-check-OWITNCHN.js → validate-cross-check-LJKXBQYH.js} +3 -3
  53. package/package.json +4 -4
@@ -1,19 +1,19 @@
1
1
  import {
2
2
  generateAgentsMd
3
- } from "./chunk-ZYYVDA5K.js";
3
+ } from "./chunk-7BAGSY5Q.js";
4
4
  import {
5
5
  generateCIWorkflow
6
- } from "./chunk-WN6YIQ66.js";
6
+ } from "./chunk-RKZW3FDF.js";
7
7
  import {
8
8
  TemplateEngine
9
- } from "./chunk-KDHZAL4B.js";
9
+ } from "./chunk-BUJOMC3O.js";
10
10
  import {
11
11
  generate,
12
12
  validate
13
13
  } from "./chunk-CQ553GZO.js";
14
14
  import {
15
15
  generateRuntime
16
- } from "./chunk-24ZGGCIW.js";
16
+ } from "./chunk-FL6A72LV.js";
17
17
  import {
18
18
  runPersona
19
19
  } from "./chunk-GISMXMVL.js";
@@ -28,21 +28,21 @@ import {
28
28
  OutputMode,
29
29
  createCheckPhaseGateCommand,
30
30
  findFiles
31
- } from "./chunk-BVRWLK5U.js";
31
+ } from "./chunk-Y5JA4J2M.js";
32
32
  import {
33
33
  createGenerateAgentDefinitionsCommand,
34
34
  generateAgentDefinitions
35
- } from "./chunk-2X336Q7J.js";
35
+ } from "./chunk-U2OMWI7Z.js";
36
36
  import {
37
37
  toKebabCase
38
38
  } from "./chunk-KET4QQZB.js";
39
39
  import {
40
40
  listPersonas,
41
41
  loadPersona
42
- } from "./chunk-KWQTMJ3B.js";
42
+ } from "./chunk-VELT5VAG.js";
43
43
  import {
44
44
  createScanCommand
45
- } from "./chunk-4NK7Z3BP.js";
45
+ } from "./chunk-R2BI5UPK.js";
46
46
  import {
47
47
  appendFrameworkAgents,
48
48
  captureHealthSnapshot,
@@ -56,11 +56,11 @@ import {
56
56
  loadOrRebuildIndex,
57
57
  persistToolingConfig,
58
58
  recommend
59
- } from "./chunk-2X42NMPD.js";
59
+ } from "./chunk-43VBX44J.js";
60
60
  import {
61
61
  findConfigFile,
62
62
  resolveConfig
63
- } from "./chunk-5R2LFUU3.js";
63
+ } from "./chunk-JUXFYB2K.js";
64
64
  import {
65
65
  VALID_PLATFORMS
66
66
  } from "./chunk-3ISINLYT.js";
@@ -74,7 +74,7 @@ import {
74
74
  } from "./chunk-6B6UN6SG.js";
75
75
  import {
76
76
  loadGraphStore
77
- } from "./chunk-BOQRTARD.js";
77
+ } from "./chunk-SMY35HJM.js";
78
78
  import {
79
79
  CLI_VERSION
80
80
  } from "./chunk-BM3PWGXQ.js";
@@ -148,7 +148,7 @@ import {
148
148
  validateKnowledgeMap,
149
149
  writeConfig,
150
150
  writeLockfile
151
- } from "./chunk-KHMKAC6E.js";
151
+ } from "./chunk-42ZZLMYD.js";
152
152
  import {
153
153
  Err,
154
154
  Ok
@@ -362,7 +362,7 @@ function registerSkillsCommand(adoption) {
362
362
  const globalOpts = cmd.optsWithGlobals();
363
363
  const limit = Math.max(parseInt(opts.limit, 10) || 20, 1);
364
364
  const cwd = process.cwd();
365
- const { readAdoptionRecords, aggregateBySkill } = await import("./dist-UMONICND.js");
365
+ const { readAdoptionRecords, aggregateBySkill } = await import("./dist-T3DGV5UN.js");
366
366
  const records = readAdoptionRecords(cwd);
367
367
  if (records.length === 0) {
368
368
  if (globalOpts.json) {
@@ -398,7 +398,7 @@ function registerRecentCommand(adoption) {
398
398
  const globalOpts = cmd.optsWithGlobals();
399
399
  const limit = Math.max(parseInt(opts.limit, 10) || 20, 1);
400
400
  const cwd = process.cwd();
401
- const { readAdoptionRecords } = await import("./dist-UMONICND.js");
401
+ const { readAdoptionRecords } = await import("./dist-T3DGV5UN.js");
402
402
  const records = readAdoptionRecords(cwd);
403
403
  if (records.length === 0) {
404
404
  if (globalOpts.json) {
@@ -431,62 +431,68 @@ function registerRecentCommand(adoption) {
431
431
  Showing ${limited.length} of ${records.length} invocations`);
432
432
  });
433
433
  }
434
+ function computePhaseRates(skillRecords) {
435
+ const phaseMap = /* @__PURE__ */ new Map();
436
+ for (const r of skillRecords) {
437
+ for (const phase of r.phasesReached) {
438
+ phaseMap.set(phase, (phaseMap.get(phase) ?? 0) + 1);
439
+ }
440
+ }
441
+ return Array.from(phaseMap.entries()).map(([phase, count]) => ({ phase, count, rate: count / skillRecords.length })).sort((a, b) => b.count - a.count);
442
+ }
443
+ function computeOutcomes(skillRecords) {
444
+ const outcomes = { completed: 0, failed: 0, abandoned: 0 };
445
+ for (const r of skillRecords) {
446
+ if (r.outcome in outcomes) {
447
+ outcomes[r.outcome]++;
448
+ }
449
+ }
450
+ return outcomes;
451
+ }
452
+ function printSkillDetail(name, summary, phaseRates, skillRecords) {
453
+ console.log(`Skill: ${name}`);
454
+ console.log(`Invocations: ${summary.invocations}`);
455
+ console.log(`Success rate: ${formatRate(summary.successRate)}`);
456
+ console.log(`Avg duration: ${formatDuration(summary.avgDuration)}`);
457
+ console.log(`Last used: ${summary.lastUsed.slice(0, 10)}`);
458
+ if (summary.tier != null) {
459
+ console.log(`Tier: ${summary.tier}`);
460
+ }
461
+ if (phaseRates.length > 0) {
462
+ console.log("\nPhase completion rates:");
463
+ for (const p of phaseRates) {
464
+ console.log(
465
+ ` ${padRight(p.phase, 20)} ${formatRate(p.rate)} (${p.count}/${skillRecords.length})`
466
+ );
467
+ }
468
+ }
469
+ const outcomes = computeOutcomes(skillRecords);
470
+ console.log("\nOutcome breakdown:");
471
+ console.log(` Completed: ${outcomes.completed}`);
472
+ console.log(` Failed: ${outcomes.failed}`);
473
+ console.log(` Abandoned: ${outcomes.abandoned}`);
474
+ }
434
475
  function registerSkillCommand(adoption) {
435
476
  adoption.command("skill <name>").description("Show detail for a specific skill").action(async (name, _opts, cmd) => {
436
477
  const globalOpts = cmd.optsWithGlobals();
437
478
  const cwd = process.cwd();
438
- const { readAdoptionRecords, aggregateBySkill } = await import("./dist-UMONICND.js");
479
+ const { readAdoptionRecords, aggregateBySkill } = await import("./dist-T3DGV5UN.js");
439
480
  const records = readAdoptionRecords(cwd);
440
481
  const skillRecords = records.filter((r) => r.skill === name);
441
482
  if (skillRecords.length === 0) {
442
- if (globalOpts.json) {
443
- console.log(JSON.stringify(null));
444
- } else {
445
- logger.info(`No adoption data found for skill "${name}".`);
446
- }
483
+ if (globalOpts.json) console.log(JSON.stringify(null));
484
+ else logger.info(`No adoption data found for skill "${name}".`);
447
485
  return;
448
486
  }
449
- const summaries = aggregateBySkill(skillRecords);
450
- const summary = summaries[0];
451
- const phaseMap = /* @__PURE__ */ new Map();
452
- for (const r of skillRecords) {
453
- for (const phase of r.phasesReached) {
454
- phaseMap.set(phase, (phaseMap.get(phase) ?? 0) + 1);
455
- }
456
- }
457
- const phaseRates = Array.from(phaseMap.entries()).map(([phase, count]) => ({ phase, count, rate: count / skillRecords.length })).sort((a, b) => b.count - a.count);
487
+ const summary = aggregateBySkill(skillRecords)[0];
488
+ const phaseRates = computePhaseRates(skillRecords);
458
489
  if (globalOpts.json) {
459
490
  console.log(
460
491
  JSON.stringify({ summary, phaseRates, totalRecords: skillRecords.length }, null, 2)
461
492
  );
462
493
  return;
463
494
  }
464
- console.log(`Skill: ${name}`);
465
- console.log(`Invocations: ${summary.invocations}`);
466
- console.log(`Success rate: ${formatRate(summary.successRate)}`);
467
- console.log(`Avg duration: ${formatDuration(summary.avgDuration)}`);
468
- console.log(`Last used: ${summary.lastUsed.slice(0, 10)}`);
469
- if (summary.tier != null) {
470
- console.log(`Tier: ${summary.tier}`);
471
- }
472
- if (phaseRates.length > 0) {
473
- console.log("\nPhase completion rates:");
474
- for (const p of phaseRates) {
475
- console.log(
476
- ` ${padRight(p.phase, 20)} ${formatRate(p.rate)} (${p.count}/${skillRecords.length})`
477
- );
478
- }
479
- }
480
- const outcomes = { completed: 0, failed: 0, abandoned: 0 };
481
- for (const r of skillRecords) {
482
- if (r.outcome in outcomes) {
483
- outcomes[r.outcome]++;
484
- }
485
- }
486
- console.log("\nOutcome breakdown:");
487
- console.log(` Completed: ${outcomes.completed}`);
488
- console.log(` Failed: ${outcomes.failed}`);
489
- console.log(` Abandoned: ${outcomes.abandoned}`);
495
+ printSkillDetail(name, summary, phaseRates, skillRecords);
490
496
  });
491
497
  }
492
498
  function createAdoptionCommand() {
@@ -2052,6 +2058,12 @@ async function runCleanupSessions(options) {
2052
2058
  }
2053
2059
  return Ok(result);
2054
2060
  }
2061
+ function printSessionList(label, sessions) {
2062
+ if (sessions.length === 0) return;
2063
+ console.log(`
2064
+ ${label} (${sessions.length}):`);
2065
+ for (const s of sessions) console.log(` - ${s}`);
2066
+ }
2055
2067
  function printResult(result, dryRun, asJson) {
2056
2068
  const { removed, kept } = result;
2057
2069
  if (asJson) {
@@ -2062,17 +2074,9 @@ function printResult(result, dryRun, asJson) {
2062
2074
  console.log("No sessions found.");
2063
2075
  return;
2064
2076
  }
2065
- if (removed.length > 0) {
2066
- const label = dryRun ? "Stale (would remove)" : "Removed";
2067
- console.log(`
2068
- ${label} (${removed.length}):`);
2069
- for (const s of removed) console.log(` - ${s}`);
2070
- }
2071
- if (kept.length > 0) {
2072
- console.log(`
2073
- Kept (${kept.length}):`);
2074
- for (const s of kept) console.log(` - ${s}`);
2075
- }
2077
+ const removeLabel = dryRun ? "Stale (would remove)" : "Removed";
2078
+ printSessionList(removeLabel, removed);
2079
+ printSessionList("Kept", kept);
2076
2080
  if (!dryRun && removed.length > 0) {
2077
2081
  console.log(`
2078
2082
  Cleaned up ${removed.length} stale session(s).`);
@@ -2146,16 +2150,7 @@ function spawnDashboardServer(server, env) {
2146
2150
  });
2147
2151
  return child;
2148
2152
  }
2149
- function runDashboard(opts) {
2150
- const clientPort = Number(opts.port ?? DEFAULT_CLIENT_PORT);
2151
- const apiPort = Number(opts.apiPort ?? DEFAULT_API_PORT);
2152
- const projectPath = resolve11(opts.cwd ?? process.cwd());
2153
- const url = `http://localhost:${apiPort}`;
2154
- const server = resolveServerScript();
2155
- if (!server) {
2156
- console.error("Could not locate the dashboard server. Run `pnpm build` in packages/dashboard.");
2157
- process.exit(1);
2158
- }
2153
+ function buildDashboardEnv(opts, clientPort, apiPort, projectPath) {
2159
2154
  const env = {
2160
2155
  ...process.env,
2161
2156
  DASHBOARD_API_PORT: String(apiPort),
@@ -2167,6 +2162,19 @@ function runDashboard(opts) {
2167
2162
  } else if (!env["ORCHESTRATOR_URL"] && !env["ORCHESTRATOR_PORT"]) {
2168
2163
  env["ORCHESTRATOR_PORT"] = "8080";
2169
2164
  }
2165
+ return env;
2166
+ }
2167
+ function runDashboard(opts) {
2168
+ const clientPort = Number(opts.port ?? DEFAULT_CLIENT_PORT);
2169
+ const apiPort = Number(opts.apiPort ?? DEFAULT_API_PORT);
2170
+ const projectPath = resolve11(opts.cwd ?? process.cwd());
2171
+ const url = `http://localhost:${apiPort}`;
2172
+ const server = resolveServerScript();
2173
+ if (!server) {
2174
+ console.error("Could not locate the dashboard server. Run `pnpm build` in packages/dashboard.");
2175
+ process.exit(1);
2176
+ }
2177
+ const env = buildDashboardEnv(opts, clientPort, apiPort, projectPath);
2170
2178
  spawnDashboardServer(server, env);
2171
2179
  console.log(`Dashboard API starting on http://localhost:${apiPort}`);
2172
2180
  console.log(`Open ${url} (pass --no-open to suppress)`);
@@ -2757,7 +2765,7 @@ import { Command as Command25 } from "commander";
2757
2765
  // src/commands/graph/status.ts
2758
2766
  import * as path15 from "path";
2759
2767
  async function runGraphStatus(projectPath) {
2760
- const { GraphStore } = await import("./dist-RADHOOXG.js");
2768
+ const { GraphStore } = await import("./dist-GRW3X2ZQ.js");
2761
2769
  const graphDir = path15.join(projectPath, ".harness", "graph");
2762
2770
  const store = new GraphStore();
2763
2771
  const loaded = await store.load(graphDir);
@@ -2797,7 +2805,7 @@ async function runGraphStatus(projectPath) {
2797
2805
  // src/commands/graph/export.ts
2798
2806
  import * as path16 from "path";
2799
2807
  async function runGraphExport(projectPath, format) {
2800
- const { GraphStore } = await import("./dist-RADHOOXG.js");
2808
+ const { GraphStore } = await import("./dist-GRW3X2ZQ.js");
2801
2809
  const graphDir = path16.join(projectPath, ".harness", "graph");
2802
2810
  const store = new GraphStore();
2803
2811
  const loaded = await store.load(graphDir);
@@ -2833,7 +2841,7 @@ import * as path19 from "path";
2833
2841
  import { Command as Command23 } from "commander";
2834
2842
  import * as path17 from "path";
2835
2843
  async function runQuery(projectPath, rootNodeId, opts) {
2836
- const { GraphStore, ContextQL } = await import("./dist-RADHOOXG.js");
2844
+ const { GraphStore, ContextQL } = await import("./dist-GRW3X2ZQ.js");
2837
2845
  const store = new GraphStore();
2838
2846
  const graphDir = path17.join(projectPath, ".harness", "graph");
2839
2847
  const loaded = await store.load(graphDir);
@@ -2927,7 +2935,7 @@ async function runIngest(projectPath, source, opts) {
2927
2935
  SlackConnector,
2928
2936
  CIConnector,
2929
2937
  ConfluenceConnector
2930
- } = await import("./dist-RADHOOXG.js");
2938
+ } = await import("./dist-GRW3X2ZQ.js");
2931
2939
  const graphDir = path18.join(projectPath, ".harness", "graph");
2932
2940
  const store = new GraphStore();
2933
2941
  await store.load(graphDir);
@@ -5428,7 +5436,7 @@ function createMcpCommand() {
5428
5436
  parseBudget
5429
5437
  ).action(async (opts) => {
5430
5438
  const [{ startServer: startServer2, getToolDefinitions: getToolDefinitions2 }, { selectTier }] = await Promise.all([
5431
- import("./mcp-XSU77BZY.js"),
5439
+ import("./mcp-GGNFWKVC.js"),
5432
5440
  import("./tool-tiers-7QGZ3FKY.js")
5433
5441
  ]);
5434
5442
  if (opts.tools && opts.tools.length > 0) {
@@ -5494,7 +5502,7 @@ function registerBenchCommand(perf) {
5494
5502
  perf.command("bench [glob]").description("Run benchmarks via vitest bench").action(async (glob2, _opts, cmd) => {
5495
5503
  const globalOpts = cmd.optsWithGlobals();
5496
5504
  const cwd = process.cwd();
5497
- const { BenchmarkRunner } = await import("./dist-UMONICND.js");
5505
+ const { BenchmarkRunner } = await import("./dist-T3DGV5UN.js");
5498
5506
  const runner = new BenchmarkRunner();
5499
5507
  const benchFiles = runner.discover(cwd, glob2);
5500
5508
  if (benchFiles.length === 0) {
@@ -5558,7 +5566,7 @@ async function runBaselinesShow(globalOpts) {
5558
5566
  }
5559
5567
  async function runBaselinesUpdate(globalOpts) {
5560
5568
  const cwd = process.cwd();
5561
- const { BenchmarkRunner } = await import("./dist-UMONICND.js");
5569
+ const { BenchmarkRunner } = await import("./dist-T3DGV5UN.js");
5562
5570
  const runner = new BenchmarkRunner();
5563
5571
  const manager = new BaselineManager(cwd);
5564
5572
  logger.info("Running benchmarks to update baselines...");
@@ -5599,7 +5607,7 @@ function registerReportCommand(perf) {
5599
5607
  perf.command("report").description("Full performance report with metrics, trends, and hotspots").action(async (_opts, cmd) => {
5600
5608
  const globalOpts = cmd.optsWithGlobals();
5601
5609
  const cwd = process.cwd();
5602
- const { EntropyAnalyzer: EntropyAnalyzer2 } = await import("./dist-UMONICND.js");
5610
+ const { EntropyAnalyzer: EntropyAnalyzer2 } = await import("./dist-T3DGV5UN.js");
5603
5611
  const analyzer = new EntropyAnalyzer2({
5604
5612
  rootDir: path40.resolve(cwd),
5605
5613
  analyze: { complexity: true, coupling: true }
@@ -5990,7 +5998,7 @@ async function runPublishAnalyses(opts) {
5990
5998
  const nameToExternalId = buildNameToExternalIdMap(projectPath);
5991
5999
  if (!nameToExternalId) return process.exit(1);
5992
6000
  const { AnalysisArchive } = await import("@harness-engineering/orchestrator");
5993
- const { GitHubIssuesSyncAdapter: GitHubIssuesSyncAdapter2 } = await import("./dist-UMONICND.js");
6001
+ const { GitHubIssuesSyncAdapter: GitHubIssuesSyncAdapter2 } = await import("./dist-T3DGV5UN.js");
5994
6002
  const archive = new AnalysisArchive(path42.join(projectPath, ".harness", "analyses"));
5995
6003
  const analyses = await archive.list();
5996
6004
  if (analyses.length === 0) {
@@ -6516,7 +6524,7 @@ function ensureHooks(cwd) {
6516
6524
  }
6517
6525
  async function runInitialGraphScan(cwd) {
6518
6526
  try {
6519
- const { runScan: runScan2 } = await import("./scan-MPJ6JHUY.js");
6527
+ const { runScan: runScan2 } = await import("./scan-DXQUHGTT.js");
6520
6528
  const result = await runScan2(cwd);
6521
6529
  return {
6522
6530
  status: "pass",
@@ -8019,7 +8027,7 @@ async function runSyncAnalyses(opts) {
8019
8027
  return;
8020
8028
  }
8021
8029
  const { AnalysisArchive, loadPublishedIndex: loadPublishedIndex2, savePublishedIndex: savePublishedIndex2 } = await import("@harness-engineering/orchestrator");
8022
- const { GitHubIssuesSyncAdapter: GitHubIssuesSyncAdapter2 } = await import("./dist-UMONICND.js");
8030
+ const { GitHubIssuesSyncAdapter: GitHubIssuesSyncAdapter2 } = await import("./dist-T3DGV5UN.js");
8023
8031
  const adapter = new GitHubIssuesSyncAdapter2({ token, config: trackerConfig });
8024
8032
  const archive = new AnalysisArchive(path58.join(projectPath, ".harness", "analyses"));
8025
8033
  const publishedIndex = loadPublishedIndex2(projectPath);
@@ -8201,29 +8209,33 @@ function resolveDisabledReason() {
8201
8209
  if (process.env.HARNESS_TELEMETRY_OPTOUT === "1") return "HARNESS_TELEMETRY_OPTOUT=1";
8202
8210
  return "telemetry.enabled is false in config";
8203
8211
  }
8212
+ function printIdentity2(identity) {
8213
+ const hasIdentity = identity.project || identity.team || identity.alias;
8214
+ if (!hasIdentity) {
8215
+ logger.info("Identity: not configured");
8216
+ return;
8217
+ }
8218
+ logger.info("Identity:");
8219
+ for (const [key, value] of Object.entries(identity)) {
8220
+ if (value) logger.info(` ${key.padEnd(7)}: ${value}`);
8221
+ }
8222
+ }
8223
+ function printEnvOverrides(overrides) {
8224
+ const keys = Object.keys(overrides);
8225
+ if (keys.length === 0) return;
8226
+ logger.info("Env overrides:");
8227
+ for (const key of keys) {
8228
+ logger.info(` ${key}=${overrides[key]}`);
8229
+ }
8230
+ }
8204
8231
  function printHumanStatus(result) {
8205
8232
  logger.info(`Telemetry: ${result.consent.allowed ? "enabled" : "disabled"}`);
8206
8233
  if (!result.consent.allowed && result.consent.reason) {
8207
8234
  logger.info(` Reason: ${result.consent.reason}`);
8208
8235
  }
8209
8236
  logger.info(`Install ID: ${result.installId ?? "not yet created"}`);
8210
- const { identity } = result;
8211
- const hasIdentity = identity.project || identity.team || identity.alias;
8212
- if (hasIdentity) {
8213
- logger.info("Identity:");
8214
- for (const [key, value] of Object.entries(identity)) {
8215
- if (value) logger.info(` ${key.padEnd(7)}: ${value}`);
8216
- }
8217
- } else {
8218
- logger.info("Identity: not configured");
8219
- }
8220
- const overrideKeys = Object.keys(result.envOverrides);
8221
- if (overrideKeys.length > 0) {
8222
- logger.info("Env overrides:");
8223
- for (const key of overrideKeys) {
8224
- logger.info(` ${key}=${result.envOverrides[key]}`);
8225
- }
8226
- }
8237
+ printIdentity2(result.identity);
8238
+ printEnvOverrides(result.envOverrides);
8227
8239
  }
8228
8240
  function createStatusCommand() {
8229
8241
  const cmd = new Command75("status").description("Show current telemetry consent state, install ID, and identity").option("--json", "Output as JSON").action((opts) => {
@@ -8283,8 +8295,8 @@ function installCommandTelemetry(program, cwd) {
8283
8295
  if (typeof program.hook !== "function") return;
8284
8296
  const projectRoot = findProjectRoot(cwd);
8285
8297
  flushTelemetryBackground(projectRoot);
8286
- program.hook("preAction", (thisCommand) => {
8287
- commandName = resolveCommandName(thisCommand);
8298
+ program.hook("preAction", (_thisCommand, actionCommand) => {
8299
+ commandName = resolveCommandName(actionCommand);
8288
8300
  startTime = Date.now();
8289
8301
  });
8290
8302
  process.on("exit", (code) => {
@@ -8324,20 +8336,25 @@ function writeCommandRecordSync(cwd, command, duration, outcome) {
8324
8336
  } catch {
8325
8337
  }
8326
8338
  }
8339
+ function isTelemetryDisabledByConfig(cwd) {
8340
+ const configPath = join45(cwd, "harness.config.json");
8341
+ if (!existsSync36(configPath)) return false;
8342
+ try {
8343
+ const config = JSON.parse(readFileSync25(configPath, "utf-8"));
8344
+ return config?.telemetry?.enabled === false;
8345
+ } catch {
8346
+ return false;
8347
+ }
8348
+ }
8349
+ function isTelemetryOptedOut(cwd) {
8350
+ if (isTelemetryDisabledByConfig(cwd)) return true;
8351
+ return process.env.DO_NOT_TRACK === "1" || process.env.HARNESS_TELEMETRY_OPTOUT === "1";
8352
+ }
8327
8353
  function flushTelemetryBackground(cwd) {
8328
8354
  try {
8329
8355
  const adoptionFile = join45(cwd, ".harness", "metrics", "adoption.jsonl");
8330
8356
  if (!existsSync36(adoptionFile)) return;
8331
- const configPath = join45(cwd, "harness.config.json");
8332
- if (existsSync36(configPath)) {
8333
- try {
8334
- const config = JSON.parse(readFileSync25(configPath, "utf-8"));
8335
- if (config?.telemetry?.enabled === false) return;
8336
- } catch {
8337
- }
8338
- }
8339
- if (process.env.DO_NOT_TRACK === "1") return;
8340
- if (process.env.HARNESS_TELEMETRY_OPTOUT === "1") return;
8357
+ if (isTelemetryOptedOut(cwd)) return;
8341
8358
  const reporterPath = join45(cwd, ".harness", "hooks", "telemetry-reporter.js");
8342
8359
  if (!existsSync36(reporterPath)) return;
8343
8360
  const child = spawn2(process.execPath, [reporterPath], {
@@ -8354,6 +8371,27 @@ function flushTelemetryBackground(cwd) {
8354
8371
 
8355
8372
  // src/commands/telemetry/test.ts
8356
8373
  var POSTHOG_BATCH_URL = "https://app.posthog.com/batch";
8374
+ function buildTestEvent(distinctId, installId, identity) {
8375
+ return {
8376
+ event: "telemetry_test",
8377
+ distinct_id: distinctId,
8378
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
8379
+ properties: {
8380
+ installId,
8381
+ os: process.platform,
8382
+ nodeVersion: process.version,
8383
+ test: true,
8384
+ ...identity.project ? { project: identity.project } : {},
8385
+ ...identity.team ? { team: identity.team } : {}
8386
+ }
8387
+ };
8388
+ }
8389
+ function reportTestSuccess(status, distinctId, identity) {
8390
+ logger.success(`PostHog responded ${status} OK \u2014 telemetry is working`);
8391
+ logger.info(` distinct_id: ${distinctId}`);
8392
+ if (identity.project) logger.info(` project: ${identity.project}`);
8393
+ if (identity.team) logger.info(` team: ${identity.team}`);
8394
+ }
8357
8395
  function createTestCommand() {
8358
8396
  return new Command76("test").description("Send a test event to PostHog and verify connectivity").action(async () => {
8359
8397
  const cwd = process.cwd();
@@ -8365,19 +8403,7 @@ function createTestCommand() {
8365
8403
  }
8366
8404
  const { installId, identity } = consent;
8367
8405
  const distinctId = identity.alias ?? installId;
8368
- const event = {
8369
- event: "telemetry_test",
8370
- distinct_id: distinctId,
8371
- timestamp: (/* @__PURE__ */ new Date()).toISOString(),
8372
- properties: {
8373
- installId,
8374
- os: process.platform,
8375
- nodeVersion: process.version,
8376
- test: true,
8377
- ...identity.project ? { project: identity.project } : {},
8378
- ...identity.team ? { team: identity.team } : {}
8379
- }
8380
- };
8406
+ const event = buildTestEvent(distinctId, installId, identity);
8381
8407
  const payload = JSON.stringify({ api_key: POSTHOG_API_KEY, batch: [event] });
8382
8408
  logger.info(`Sending test event as "${distinctId}"...`);
8383
8409
  try {
@@ -8389,10 +8415,7 @@ function createTestCommand() {
8389
8415
  });
8390
8416
  const body = await res.text();
8391
8417
  if (res.ok) {
8392
- logger.success(`PostHog responded ${res.status} OK \u2014 telemetry is working`);
8393
- logger.info(` distinct_id: ${distinctId}`);
8394
- if (identity.project) logger.info(` project: ${identity.project}`);
8395
- if (identity.team) logger.info(` team: ${identity.team}`);
8418
+ reportTestSuccess(res.status, distinctId, identity);
8396
8419
  } else {
8397
8420
  logger.error(`PostHog responded ${res.status}: ${body}`);
8398
8421
  process.exitCode = 1;
@@ -8531,7 +8554,7 @@ async function runTraceability(options) {
8531
8554
  const projectPath = process.cwd();
8532
8555
  const store = await loadGraphStore(projectPath);
8533
8556
  if (!store) handleNoStore(mode);
8534
- const graphModule = await import("./dist-RADHOOXG.js");
8557
+ const graphModule = await import("./dist-GRW3X2ZQ.js");
8535
8558
  const filterOptions = buildFilterOptions(options);
8536
8559
  const results = graphModule.queryTraceability(store, filterOptions);
8537
8560
  if (results.length === 0) handleEmptyResults(mode);
@@ -8945,7 +8968,7 @@ function createUpdateCommand() {
8945
8968
  // src/commands/usage.ts
8946
8969
  import { Command as Command82 } from "commander";
8947
8970
  async function loadAndPriceRecords(cwd, includeClaudeSessions = false) {
8948
- const { readCostRecords, loadPricingData, calculateCost, parseCCRecords } = await import("./dist-UMONICND.js");
8971
+ const { readCostRecords, loadPricingData, calculateCost, parseCCRecords } = await import("./dist-T3DGV5UN.js");
8949
8972
  const records = readCostRecords(cwd);
8950
8973
  if (includeClaudeSessions) {
8951
8974
  const ccRecords = parseCCRecords();
@@ -8989,6 +9012,41 @@ function formatModels(models) {
8989
9012
  if (models.length === 1) return models[0] ?? "unknown";
8990
9013
  return `${models[0] ?? "unknown"} and ${models.length - 1} other${models.length - 1 > 1 ? "s" : ""}`;
8991
9014
  }
9015
+ function enrichDayForJson(day, pricingData) {
9016
+ const hitRate = computeCacheHitRate(day.cacheReadTokens, day.tokens.inputTokens);
9017
+ const savings = computeCacheSavings(day.cacheReadTokens, day.models[0], pricingData);
9018
+ return {
9019
+ ...day,
9020
+ ...hitRate != null ? { cacheHitRate: Math.round(hitRate * 1e3) / 1e3 } : {},
9021
+ ...savings != null ? { cacheSavingsMicroUSD: savings } : {}
9022
+ };
9023
+ }
9024
+ function formatDayCacheColumns(day, pricingData) {
9025
+ const rate = computeCacheHitRate(day.cacheReadTokens, day.tokens.inputTokens);
9026
+ const savings = computeCacheSavings(day.cacheReadTokens, day.models[0], pricingData);
9027
+ const rateStr = rate != null ? formatPercent(rate).padStart(5) : " -";
9028
+ const savingsStr = savings != null ? formatMicroUSD(savings).padStart(7) : " N/A";
9029
+ return " | " + rateStr + " | " + savingsStr;
9030
+ }
9031
+ function printDailyTable(limited, pricingData) {
9032
+ const hasCacheData = limited.some((d) => d.cacheReadTokens != null && d.cacheReadTokens > 0);
9033
+ const cacheHeader = hasCacheData ? " | Cache | Saved " : "";
9034
+ const cacheDivider = hasCacheData ? " | ------ | -------" : "";
9035
+ const header = "Date | Sessions | Input | Output | Model(s) | Cost " + cacheHeader;
9036
+ const divider = "-------------|----------|-----------|-----------|------------------------------|-------" + cacheDivider;
9037
+ logger.info(header);
9038
+ logger.info(divider);
9039
+ for (const day of limited) {
9040
+ const date = day.date.padEnd(12);
9041
+ const sessions = String(day.sessionCount).padStart(8);
9042
+ const input = formatTokenCount(day.tokens.inputTokens).padStart(9);
9043
+ const output = formatTokenCount(day.tokens.outputTokens).padStart(9);
9044
+ const models = formatModels(day.models).padEnd(28);
9045
+ const cost = formatMicroUSD(day.costMicroUSD);
9046
+ const cacheCol = hasCacheData ? formatDayCacheColumns(day, pricingData) : "";
9047
+ logger.info(`${date} | ${sessions} | ${input} | ${output} | ${models} | ${cost}${cacheCol}`);
9048
+ }
9049
+ }
8992
9050
  function registerDailyCommand(usage) {
8993
9051
  usage.command("daily").description("Show per-day token usage and cost").option("--days <n>", "Number of days to show (default: 7, max: 90)", "7").action(async (opts, cmd) => {
8994
9052
  const globalOpts = cmd.optsWithGlobals();
@@ -8999,54 +9057,23 @@ function registerDailyCommand(usage) {
8999
9057
  globalOpts.includeClaudeSessions
9000
9058
  );
9001
9059
  if (records.length === 0) {
9002
- if (globalOpts.json) {
9003
- console.log(JSON.stringify([]));
9004
- } else {
9005
- logger.info("No usage data found. Run some harness sessions first.");
9006
- }
9060
+ if (globalOpts.json) console.log(JSON.stringify([]));
9061
+ else logger.info("No usage data found. Run some harness sessions first.");
9007
9062
  return;
9008
9063
  }
9009
- const { aggregateByDay } = await import("./dist-UMONICND.js");
9010
- const dailyData = aggregateByDay(records);
9011
- const limited = dailyData.slice(0, days);
9064
+ const { aggregateByDay } = await import("./dist-T3DGV5UN.js");
9065
+ const limited = aggregateByDay(records).slice(0, days);
9012
9066
  if (globalOpts.json) {
9013
- const enriched = limited.map((day) => {
9014
- const hitRate = computeCacheHitRate(day.cacheReadTokens, day.tokens.inputTokens);
9015
- const savings = computeCacheSavings(day.cacheReadTokens, day.models[0], pricingData);
9016
- return {
9017
- ...day,
9018
- ...hitRate != null ? { cacheHitRate: Math.round(hitRate * 1e3) / 1e3 } : {},
9019
- ...savings != null ? { cacheSavingsMicroUSD: savings } : {}
9020
- };
9021
- });
9022
- console.log(JSON.stringify(enriched, null, 2));
9023
- return;
9024
- }
9025
- const hasCacheData = limited.some((d) => d.cacheReadTokens != null && d.cacheReadTokens > 0);
9026
- const cacheHeader = hasCacheData ? " | Cache | Saved " : "";
9027
- const cacheDivider = hasCacheData ? " | ------ | -------" : "";
9028
- const header = "Date | Sessions | Input | Output | Model(s) | Cost " + cacheHeader;
9029
- const divider = "-------------|----------|-----------|-----------|------------------------------|-------" + cacheDivider;
9030
- logger.info(header);
9031
- logger.info(divider);
9032
- for (const day of limited) {
9033
- const date = day.date.padEnd(12);
9034
- const sessions = String(day.sessionCount).padStart(8);
9035
- const input = formatTokenCount(day.tokens.inputTokens).padStart(9);
9036
- const output = formatTokenCount(day.tokens.outputTokens).padStart(9);
9037
- const models = formatModels(day.models).padEnd(28);
9038
- const cost = formatMicroUSD(day.costMicroUSD);
9039
- const cacheCol = hasCacheData ? (() => {
9040
- const rate = computeCacheHitRate(day.cacheReadTokens, day.tokens.inputTokens);
9041
- const savings = computeCacheSavings(day.cacheReadTokens, day.models[0], pricingData);
9042
- const rateStr = rate != null ? formatPercent(rate).padStart(5) : " -";
9043
- const savingsStr = savings != null ? formatMicroUSD(savings).padStart(7) : " N/A";
9044
- return " | " + rateStr + " | " + savingsStr;
9045
- })() : "";
9046
- logger.info(
9047
- `${date} | ${sessions} | ${input} | ${output} | ${models} | ${cost}${cacheCol}`
9067
+ console.log(
9068
+ JSON.stringify(
9069
+ limited.map((d) => enrichDayForJson(d, pricingData)),
9070
+ null,
9071
+ 2
9072
+ )
9048
9073
  );
9074
+ return;
9049
9075
  }
9076
+ printDailyTable(limited, pricingData);
9050
9077
  });
9051
9078
  }
9052
9079
  function registerSessionsCommand(usage) {
@@ -9063,7 +9090,7 @@ function registerSessionsCommand(usage) {
9063
9090
  }
9064
9091
  return;
9065
9092
  }
9066
- const { aggregateBySession } = await import("./dist-UMONICND.js");
9093
+ const { aggregateBySession } = await import("./dist-T3DGV5UN.js");
9067
9094
  const sessionData = aggregateBySession(records);
9068
9095
  const limited = sessionData.slice(0, limit);
9069
9096
  if (globalOpts.json) {
@@ -9143,7 +9170,7 @@ function registerSessionCommand(usage) {
9143
9170
  cwd,
9144
9171
  globalOpts.includeClaudeSessions
9145
9172
  );
9146
- const { aggregateBySession } = await import("./dist-UMONICND.js");
9173
+ const { aggregateBySession } = await import("./dist-T3DGV5UN.js");
9147
9174
  const sessionData = aggregateBySession(records);
9148
9175
  const match = sessionData.find((s) => s.sessionId === id);
9149
9176
  if (!match) {
@@ -9178,7 +9205,7 @@ function registerLatestCommand(usage) {
9178
9205
  }
9179
9206
  return;
9180
9207
  }
9181
- const { aggregateBySession } = await import("./dist-UMONICND.js");
9208
+ const { aggregateBySession } = await import("./dist-T3DGV5UN.js");
9182
9209
  const sessionData = aggregateBySession(records);
9183
9210
  const latest = sessionData[0];
9184
9211
  if (!latest) {
@@ -9302,7 +9329,7 @@ function resolveValidateMode(globalOpts) {
9302
9329
  return OutputMode.TEXT;
9303
9330
  }
9304
9331
  async function printCrossCheckWarnings(mode) {
9305
- const { runCrossCheck: runCrossCheck2 } = await import("./validate-cross-check-OWITNCHN.js");
9332
+ const { runCrossCheck: runCrossCheck2 } = await import("./validate-cross-check-LJKXBQYH.js");
9306
9333
  const cwd = process.cwd();
9307
9334
  const crossResult = await runCrossCheck2({
9308
9335
  specsDir: path62.join(cwd, "docs", "specs"),