@harness-engineering/cli 1.25.5 → 1.25.7

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 (54) hide show
  1. package/dist/{agents-md-COWXFHR5.js → agents-md-QPO3H5HX.js} +3 -3
  2. package/dist/{architecture-EYPG4ZMC.js → architecture-IJLXRHZA.js} +4 -4
  3. package/dist/{assess-project-JQPEVJIA.js → assess-project-QU6XIVJK.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-TNY64AOS.js} +4 -4
  8. package/dist/{chunk-HWLHJSJQ.js → chunk-2DF6OZLG.js} +2 -2
  9. package/dist/{chunk-2OIPQMU5.js → chunk-AS5DQT4S.js} +9 -9
  10. package/dist/{chunk-YFIALHGI.js → chunk-D3XL2FLX.js} +5 -5
  11. package/dist/{chunk-4NK7Z3BP.js → chunk-E5Z6NTTQ.js} +1 -1
  12. package/dist/{chunk-KWQTMJ3B.js → chunk-FRDS4XGD.js} +1 -1
  13. package/dist/{chunk-KXUCIAM4.js → chunk-G5SNXUIK.js} +1 -1
  14. package/dist/{chunk-2TFT7XRX.js → chunk-GVNT2YC7.js} +9 -9
  15. package/dist/{chunk-UI6NWJJK.js → chunk-IQO7IINR.js} +1 -1
  16. package/dist/{chunk-ZYYVDA5K.js → chunk-IT2KORSK.js} +1 -1
  17. package/dist/{chunk-2X42NMPD.js → chunk-JJQ3TW2E.js} +227 -109
  18. package/dist/{chunk-BOQRTARD.js → chunk-JPZY7ZQX.js} +1 -1
  19. package/dist/{chunk-24ZGGCIW.js → chunk-K35D7HF3.js} +1 -1
  20. package/dist/{chunk-KDHZAL4B.js → chunk-K533WNZG.js} +38 -2
  21. package/dist/{chunk-WN6YIQ66.js → chunk-KVJZQ2MV.js} +1 -1
  22. package/dist/{chunk-Q6ZEUMOF.js → chunk-LTCEV7VF.js} +3 -3
  23. package/dist/{chunk-BVRWLK5U.js → chunk-LXPRO2FH.js} +2 -2
  24. package/dist/{chunk-2X336Q7J.js → chunk-MCDCZMKN.js} +1 -1
  25. package/dist/{chunk-UB6NZNJJ.js → chunk-MLOGYWLY.js} +2 -2
  26. package/dist/{chunk-K2SON7TI.js → chunk-NKQEMWGT.js} +333 -121
  27. package/dist/{chunk-PVRKHUTA.js → chunk-PCOU2UXU.js} +8 -8
  28. package/dist/chunk-RC5ZY3EV.js +82 -0
  29. package/dist/{chunk-2OM5TA56.js → chunk-SZ3Q4XEO.js} +212 -183
  30. package/dist/{chunk-5R2LFUU3.js → chunk-TQRCODRJ.js} +1 -1
  31. package/dist/{chunk-KVK3KAFQ.js → chunk-XVJRFP7W.js} +6 -6
  32. package/dist/{chunk-JD4FGVHH.js → chunk-YRBNAHH4.js} +4 -4
  33. package/dist/{chunk-KHMKAC6E.js → chunk-ZIYLIYN4.js} +115 -103
  34. package/dist/{ci-workflow-35KBJC2U.js → ci-workflow-FJYRFZYQ.js} +3 -3
  35. package/dist/{dist-RADHOOXG.js → dist-HPWNWCT6.js} +3 -1
  36. package/dist/{dist-UMONICND.js → dist-ZV6GO6FA.js} +2 -2
  37. package/dist/{docs-T5J2AJH6.js → docs-7DW3DI4Z.js} +4 -4
  38. package/dist/{engine-KWHV2LUX.js → engine-P7EE2IWO.js} +3 -3
  39. package/dist/{entropy-GEBHWBPR.js → entropy-HCXRTDFU.js} +3 -3
  40. package/dist/{feedback-I4QPE3RI.js → feedback-Y4FYN3NR.js} +1 -1
  41. package/dist/{generate-agent-definitions-3XNR77ET.js → generate-agent-definitions-3EHPIWBO.js} +4 -4
  42. package/dist/{graph-loader-JHQVQRUS.js → graph-loader-KXVS3YK3.js} +1 -1
  43. package/dist/index.d.ts +14 -8
  44. package/dist/index.js +26 -25
  45. package/dist/{loader-MN2CZXPG.js → loader-SKHF3JVV.js} +3 -3
  46. package/dist/{mcp-XSU77BZY.js → mcp-MWYIPDQU.js} +16 -15
  47. package/dist/{performance-7I5MCEFP.js → performance-ADWH5NJY.js} +4 -4
  48. package/dist/{review-pipeline-PWPKJXSN.js → review-pipeline-TLKE5OQD.js} +3 -3
  49. package/dist/{runtime-ZYEFJSGS.js → runtime-7LYAW7GU.js} +3 -3
  50. package/dist/{scan-MPJ6JHUY.js → scan-BGJ7TLLV.js} +1 -1
  51. package/dist/{security-OVTGS7DL.js → security-5XWINYVB.js} +1 -1
  52. package/dist/{validate-ACIP5BUO.js → validate-BFFHYHY7.js} +4 -4
  53. package/dist/{validate-cross-check-OWITNCHN.js → validate-cross-check-GQX7OVCR.js} +3 -3
  54. package/package.json +5 -5
@@ -1,19 +1,19 @@
1
1
  import {
2
2
  generateAgentsMd
3
- } from "./chunk-ZYYVDA5K.js";
3
+ } from "./chunk-IT2KORSK.js";
4
4
  import {
5
5
  generateCIWorkflow
6
- } from "./chunk-WN6YIQ66.js";
6
+ } from "./chunk-KVJZQ2MV.js";
7
7
  import {
8
8
  TemplateEngine
9
- } from "./chunk-KDHZAL4B.js";
9
+ } from "./chunk-K533WNZG.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-K35D7HF3.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-LXPRO2FH.js";
32
32
  import {
33
33
  createGenerateAgentDefinitionsCommand,
34
34
  generateAgentDefinitions
35
- } from "./chunk-2X336Q7J.js";
35
+ } from "./chunk-MCDCZMKN.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-FRDS4XGD.js";
43
43
  import {
44
44
  createScanCommand
45
- } from "./chunk-4NK7Z3BP.js";
45
+ } from "./chunk-E5Z6NTTQ.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-JJQ3TW2E.js";
60
60
  import {
61
61
  findConfigFile,
62
62
  resolveConfig
63
- } from "./chunk-5R2LFUU3.js";
63
+ } from "./chunk-TQRCODRJ.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-JPZY7ZQX.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-ZIYLIYN4.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-ZV6GO6FA.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-ZV6GO6FA.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-ZV6GO6FA.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-HPWNWCT6.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-HPWNWCT6.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-HPWNWCT6.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-HPWNWCT6.js");
2931
2939
  const graphDir = path18.join(projectPath, ".harness", "graph");
2932
2940
  const store = new GraphStore();
2933
2941
  await store.load(graphDir);
@@ -4063,9 +4071,11 @@ function scaffoldProject(engine, ctx) {
4063
4071
  ...language !== void 0 && { language }
4064
4072
  });
4065
4073
  if (!renderResult.ok) return Err(new CLIError(renderResult.error.message, ExitCode.ERROR));
4074
+ const existingProject = !force && engine.isExistingProject(cwd);
4066
4075
  const writeResult = engine.write(renderResult.value, cwd, {
4067
4076
  overwrite: force,
4068
- ...language !== void 0 && { language }
4077
+ ...language !== void 0 && { language },
4078
+ existingProject
4069
4079
  });
4070
4080
  if (!writeResult.ok) return Err(new CLIError(writeResult.error.message, ExitCode.ERROR));
4071
4081
  if (writeResult.value.skippedConfigs.length > 0) {
@@ -5428,7 +5438,7 @@ function createMcpCommand() {
5428
5438
  parseBudget
5429
5439
  ).action(async (opts) => {
5430
5440
  const [{ startServer: startServer2, getToolDefinitions: getToolDefinitions2 }, { selectTier }] = await Promise.all([
5431
- import("./mcp-XSU77BZY.js"),
5441
+ import("./mcp-MWYIPDQU.js"),
5432
5442
  import("./tool-tiers-7QGZ3FKY.js")
5433
5443
  ]);
5434
5444
  if (opts.tools && opts.tools.length > 0) {
@@ -5494,7 +5504,7 @@ function registerBenchCommand(perf) {
5494
5504
  perf.command("bench [glob]").description("Run benchmarks via vitest bench").action(async (glob2, _opts, cmd) => {
5495
5505
  const globalOpts = cmd.optsWithGlobals();
5496
5506
  const cwd = process.cwd();
5497
- const { BenchmarkRunner } = await import("./dist-UMONICND.js");
5507
+ const { BenchmarkRunner } = await import("./dist-ZV6GO6FA.js");
5498
5508
  const runner = new BenchmarkRunner();
5499
5509
  const benchFiles = runner.discover(cwd, glob2);
5500
5510
  if (benchFiles.length === 0) {
@@ -5558,7 +5568,7 @@ async function runBaselinesShow(globalOpts) {
5558
5568
  }
5559
5569
  async function runBaselinesUpdate(globalOpts) {
5560
5570
  const cwd = process.cwd();
5561
- const { BenchmarkRunner } = await import("./dist-UMONICND.js");
5571
+ const { BenchmarkRunner } = await import("./dist-ZV6GO6FA.js");
5562
5572
  const runner = new BenchmarkRunner();
5563
5573
  const manager = new BaselineManager(cwd);
5564
5574
  logger.info("Running benchmarks to update baselines...");
@@ -5599,7 +5609,7 @@ function registerReportCommand(perf) {
5599
5609
  perf.command("report").description("Full performance report with metrics, trends, and hotspots").action(async (_opts, cmd) => {
5600
5610
  const globalOpts = cmd.optsWithGlobals();
5601
5611
  const cwd = process.cwd();
5602
- const { EntropyAnalyzer: EntropyAnalyzer2 } = await import("./dist-UMONICND.js");
5612
+ const { EntropyAnalyzer: EntropyAnalyzer2 } = await import("./dist-ZV6GO6FA.js");
5603
5613
  const analyzer = new EntropyAnalyzer2({
5604
5614
  rootDir: path40.resolve(cwd),
5605
5615
  analyze: { complexity: true, coupling: true }
@@ -5990,7 +6000,7 @@ async function runPublishAnalyses(opts) {
5990
6000
  const nameToExternalId = buildNameToExternalIdMap(projectPath);
5991
6001
  if (!nameToExternalId) return process.exit(1);
5992
6002
  const { AnalysisArchive } = await import("@harness-engineering/orchestrator");
5993
- const { GitHubIssuesSyncAdapter: GitHubIssuesSyncAdapter2 } = await import("./dist-UMONICND.js");
6003
+ const { GitHubIssuesSyncAdapter: GitHubIssuesSyncAdapter2 } = await import("./dist-ZV6GO6FA.js");
5994
6004
  const archive = new AnalysisArchive(path42.join(projectPath, ".harness", "analyses"));
5995
6005
  const analyses = await archive.list();
5996
6006
  if (analyses.length === 0) {
@@ -6516,7 +6526,7 @@ function ensureHooks(cwd) {
6516
6526
  }
6517
6527
  async function runInitialGraphScan(cwd) {
6518
6528
  try {
6519
- const { runScan: runScan2 } = await import("./scan-MPJ6JHUY.js");
6529
+ const { runScan: runScan2 } = await import("./scan-BGJ7TLLV.js");
6520
6530
  const result = await runScan2(cwd);
6521
6531
  return {
6522
6532
  status: "pass",
@@ -8019,7 +8029,7 @@ async function runSyncAnalyses(opts) {
8019
8029
  return;
8020
8030
  }
8021
8031
  const { AnalysisArchive, loadPublishedIndex: loadPublishedIndex2, savePublishedIndex: savePublishedIndex2 } = await import("@harness-engineering/orchestrator");
8022
- const { GitHubIssuesSyncAdapter: GitHubIssuesSyncAdapter2 } = await import("./dist-UMONICND.js");
8032
+ const { GitHubIssuesSyncAdapter: GitHubIssuesSyncAdapter2 } = await import("./dist-ZV6GO6FA.js");
8023
8033
  const adapter = new GitHubIssuesSyncAdapter2({ token, config: trackerConfig });
8024
8034
  const archive = new AnalysisArchive(path58.join(projectPath, ".harness", "analyses"));
8025
8035
  const publishedIndex = loadPublishedIndex2(projectPath);
@@ -8201,29 +8211,33 @@ function resolveDisabledReason() {
8201
8211
  if (process.env.HARNESS_TELEMETRY_OPTOUT === "1") return "HARNESS_TELEMETRY_OPTOUT=1";
8202
8212
  return "telemetry.enabled is false in config";
8203
8213
  }
8214
+ function printIdentity2(identity) {
8215
+ const hasIdentity = identity.project || identity.team || identity.alias;
8216
+ if (!hasIdentity) {
8217
+ logger.info("Identity: not configured");
8218
+ return;
8219
+ }
8220
+ logger.info("Identity:");
8221
+ for (const [key, value] of Object.entries(identity)) {
8222
+ if (value) logger.info(` ${key.padEnd(7)}: ${value}`);
8223
+ }
8224
+ }
8225
+ function printEnvOverrides(overrides) {
8226
+ const keys = Object.keys(overrides);
8227
+ if (keys.length === 0) return;
8228
+ logger.info("Env overrides:");
8229
+ for (const key of keys) {
8230
+ logger.info(` ${key}=${overrides[key]}`);
8231
+ }
8232
+ }
8204
8233
  function printHumanStatus(result) {
8205
8234
  logger.info(`Telemetry: ${result.consent.allowed ? "enabled" : "disabled"}`);
8206
8235
  if (!result.consent.allowed && result.consent.reason) {
8207
8236
  logger.info(` Reason: ${result.consent.reason}`);
8208
8237
  }
8209
8238
  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
- }
8239
+ printIdentity2(result.identity);
8240
+ printEnvOverrides(result.envOverrides);
8227
8241
  }
8228
8242
  function createStatusCommand() {
8229
8243
  const cmd = new Command75("status").description("Show current telemetry consent state, install ID, and identity").option("--json", "Output as JSON").action((opts) => {
@@ -8283,8 +8297,8 @@ function installCommandTelemetry(program, cwd) {
8283
8297
  if (typeof program.hook !== "function") return;
8284
8298
  const projectRoot = findProjectRoot(cwd);
8285
8299
  flushTelemetryBackground(projectRoot);
8286
- program.hook("preAction", (thisCommand) => {
8287
- commandName = resolveCommandName(thisCommand);
8300
+ program.hook("preAction", (_thisCommand, actionCommand) => {
8301
+ commandName = resolveCommandName(actionCommand);
8288
8302
  startTime = Date.now();
8289
8303
  });
8290
8304
  process.on("exit", (code) => {
@@ -8324,20 +8338,25 @@ function writeCommandRecordSync(cwd, command, duration, outcome) {
8324
8338
  } catch {
8325
8339
  }
8326
8340
  }
8341
+ function isTelemetryDisabledByConfig(cwd) {
8342
+ const configPath = join45(cwd, "harness.config.json");
8343
+ if (!existsSync36(configPath)) return false;
8344
+ try {
8345
+ const config = JSON.parse(readFileSync25(configPath, "utf-8"));
8346
+ return config?.telemetry?.enabled === false;
8347
+ } catch {
8348
+ return false;
8349
+ }
8350
+ }
8351
+ function isTelemetryOptedOut(cwd) {
8352
+ if (isTelemetryDisabledByConfig(cwd)) return true;
8353
+ return process.env.DO_NOT_TRACK === "1" || process.env.HARNESS_TELEMETRY_OPTOUT === "1";
8354
+ }
8327
8355
  function flushTelemetryBackground(cwd) {
8328
8356
  try {
8329
8357
  const adoptionFile = join45(cwd, ".harness", "metrics", "adoption.jsonl");
8330
8358
  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;
8359
+ if (isTelemetryOptedOut(cwd)) return;
8341
8360
  const reporterPath = join45(cwd, ".harness", "hooks", "telemetry-reporter.js");
8342
8361
  if (!existsSync36(reporterPath)) return;
8343
8362
  const child = spawn2(process.execPath, [reporterPath], {
@@ -8354,6 +8373,27 @@ function flushTelemetryBackground(cwd) {
8354
8373
 
8355
8374
  // src/commands/telemetry/test.ts
8356
8375
  var POSTHOG_BATCH_URL = "https://app.posthog.com/batch";
8376
+ function buildTestEvent(distinctId, installId, identity) {
8377
+ return {
8378
+ event: "telemetry_test",
8379
+ distinct_id: distinctId,
8380
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
8381
+ properties: {
8382
+ installId,
8383
+ os: process.platform,
8384
+ nodeVersion: process.version,
8385
+ test: true,
8386
+ ...identity.project ? { project: identity.project } : {},
8387
+ ...identity.team ? { team: identity.team } : {}
8388
+ }
8389
+ };
8390
+ }
8391
+ function reportTestSuccess(status, distinctId, identity) {
8392
+ logger.success(`PostHog responded ${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}`);
8396
+ }
8357
8397
  function createTestCommand() {
8358
8398
  return new Command76("test").description("Send a test event to PostHog and verify connectivity").action(async () => {
8359
8399
  const cwd = process.cwd();
@@ -8365,19 +8405,7 @@ function createTestCommand() {
8365
8405
  }
8366
8406
  const { installId, identity } = consent;
8367
8407
  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
- };
8408
+ const event = buildTestEvent(distinctId, installId, identity);
8381
8409
  const payload = JSON.stringify({ api_key: POSTHOG_API_KEY, batch: [event] });
8382
8410
  logger.info(`Sending test event as "${distinctId}"...`);
8383
8411
  try {
@@ -8389,10 +8417,7 @@ function createTestCommand() {
8389
8417
  });
8390
8418
  const body = await res.text();
8391
8419
  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}`);
8420
+ reportTestSuccess(res.status, distinctId, identity);
8396
8421
  } else {
8397
8422
  logger.error(`PostHog responded ${res.status}: ${body}`);
8398
8423
  process.exitCode = 1;
@@ -8531,7 +8556,7 @@ async function runTraceability(options) {
8531
8556
  const projectPath = process.cwd();
8532
8557
  const store = await loadGraphStore(projectPath);
8533
8558
  if (!store) handleNoStore(mode);
8534
- const graphModule = await import("./dist-RADHOOXG.js");
8559
+ const graphModule = await import("./dist-HPWNWCT6.js");
8535
8560
  const filterOptions = buildFilterOptions(options);
8536
8561
  const results = graphModule.queryTraceability(store, filterOptions);
8537
8562
  if (results.length === 0) handleEmptyResults(mode);
@@ -8945,7 +8970,7 @@ function createUpdateCommand() {
8945
8970
  // src/commands/usage.ts
8946
8971
  import { Command as Command82 } from "commander";
8947
8972
  async function loadAndPriceRecords(cwd, includeClaudeSessions = false) {
8948
- const { readCostRecords, loadPricingData, calculateCost, parseCCRecords } = await import("./dist-UMONICND.js");
8973
+ const { readCostRecords, loadPricingData, calculateCost, parseCCRecords } = await import("./dist-ZV6GO6FA.js");
8949
8974
  const records = readCostRecords(cwd);
8950
8975
  if (includeClaudeSessions) {
8951
8976
  const ccRecords = parseCCRecords();
@@ -8989,6 +9014,41 @@ function formatModels(models) {
8989
9014
  if (models.length === 1) return models[0] ?? "unknown";
8990
9015
  return `${models[0] ?? "unknown"} and ${models.length - 1} other${models.length - 1 > 1 ? "s" : ""}`;
8991
9016
  }
9017
+ function enrichDayForJson(day, pricingData) {
9018
+ const hitRate = computeCacheHitRate(day.cacheReadTokens, day.tokens.inputTokens);
9019
+ const savings = computeCacheSavings(day.cacheReadTokens, day.models[0], pricingData);
9020
+ return {
9021
+ ...day,
9022
+ ...hitRate != null ? { cacheHitRate: Math.round(hitRate * 1e3) / 1e3 } : {},
9023
+ ...savings != null ? { cacheSavingsMicroUSD: savings } : {}
9024
+ };
9025
+ }
9026
+ function formatDayCacheColumns(day, pricingData) {
9027
+ const rate = computeCacheHitRate(day.cacheReadTokens, day.tokens.inputTokens);
9028
+ const savings = computeCacheSavings(day.cacheReadTokens, day.models[0], pricingData);
9029
+ const rateStr = rate != null ? formatPercent(rate).padStart(5) : " -";
9030
+ const savingsStr = savings != null ? formatMicroUSD(savings).padStart(7) : " N/A";
9031
+ return " | " + rateStr + " | " + savingsStr;
9032
+ }
9033
+ function printDailyTable(limited, pricingData) {
9034
+ const hasCacheData = limited.some((d) => d.cacheReadTokens != null && d.cacheReadTokens > 0);
9035
+ const cacheHeader = hasCacheData ? " | Cache | Saved " : "";
9036
+ const cacheDivider = hasCacheData ? " | ------ | -------" : "";
9037
+ const header = "Date | Sessions | Input | Output | Model(s) | Cost " + cacheHeader;
9038
+ const divider = "-------------|----------|-----------|-----------|------------------------------|-------" + cacheDivider;
9039
+ logger.info(header);
9040
+ logger.info(divider);
9041
+ for (const day of limited) {
9042
+ const date = day.date.padEnd(12);
9043
+ const sessions = String(day.sessionCount).padStart(8);
9044
+ const input = formatTokenCount(day.tokens.inputTokens).padStart(9);
9045
+ const output = formatTokenCount(day.tokens.outputTokens).padStart(9);
9046
+ const models = formatModels(day.models).padEnd(28);
9047
+ const cost = formatMicroUSD(day.costMicroUSD);
9048
+ const cacheCol = hasCacheData ? formatDayCacheColumns(day, pricingData) : "";
9049
+ logger.info(`${date} | ${sessions} | ${input} | ${output} | ${models} | ${cost}${cacheCol}`);
9050
+ }
9051
+ }
8992
9052
  function registerDailyCommand(usage) {
8993
9053
  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
9054
  const globalOpts = cmd.optsWithGlobals();
@@ -8999,54 +9059,23 @@ function registerDailyCommand(usage) {
8999
9059
  globalOpts.includeClaudeSessions
9000
9060
  );
9001
9061
  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
- }
9062
+ if (globalOpts.json) console.log(JSON.stringify([]));
9063
+ else logger.info("No usage data found. Run some harness sessions first.");
9007
9064
  return;
9008
9065
  }
9009
- const { aggregateByDay } = await import("./dist-UMONICND.js");
9010
- const dailyData = aggregateByDay(records);
9011
- const limited = dailyData.slice(0, days);
9066
+ const { aggregateByDay } = await import("./dist-ZV6GO6FA.js");
9067
+ const limited = aggregateByDay(records).slice(0, days);
9012
9068
  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}`
9069
+ console.log(
9070
+ JSON.stringify(
9071
+ limited.map((d) => enrichDayForJson(d, pricingData)),
9072
+ null,
9073
+ 2
9074
+ )
9048
9075
  );
9076
+ return;
9049
9077
  }
9078
+ printDailyTable(limited, pricingData);
9050
9079
  });
9051
9080
  }
9052
9081
  function registerSessionsCommand(usage) {
@@ -9063,7 +9092,7 @@ function registerSessionsCommand(usage) {
9063
9092
  }
9064
9093
  return;
9065
9094
  }
9066
- const { aggregateBySession } = await import("./dist-UMONICND.js");
9095
+ const { aggregateBySession } = await import("./dist-ZV6GO6FA.js");
9067
9096
  const sessionData = aggregateBySession(records);
9068
9097
  const limited = sessionData.slice(0, limit);
9069
9098
  if (globalOpts.json) {
@@ -9143,7 +9172,7 @@ function registerSessionCommand(usage) {
9143
9172
  cwd,
9144
9173
  globalOpts.includeClaudeSessions
9145
9174
  );
9146
- const { aggregateBySession } = await import("./dist-UMONICND.js");
9175
+ const { aggregateBySession } = await import("./dist-ZV6GO6FA.js");
9147
9176
  const sessionData = aggregateBySession(records);
9148
9177
  const match = sessionData.find((s) => s.sessionId === id);
9149
9178
  if (!match) {
@@ -9178,7 +9207,7 @@ function registerLatestCommand(usage) {
9178
9207
  }
9179
9208
  return;
9180
9209
  }
9181
- const { aggregateBySession } = await import("./dist-UMONICND.js");
9210
+ const { aggregateBySession } = await import("./dist-ZV6GO6FA.js");
9182
9211
  const sessionData = aggregateBySession(records);
9183
9212
  const latest = sessionData[0];
9184
9213
  if (!latest) {
@@ -9302,7 +9331,7 @@ function resolveValidateMode(globalOpts) {
9302
9331
  return OutputMode.TEXT;
9303
9332
  }
9304
9333
  async function printCrossCheckWarnings(mode) {
9305
- const { runCrossCheck: runCrossCheck2 } = await import("./validate-cross-check-OWITNCHN.js");
9334
+ const { runCrossCheck: runCrossCheck2 } = await import("./validate-cross-check-GQX7OVCR.js");
9306
9335
  const cwd = process.cwd();
9307
9336
  const crossResult = await runCrossCheck2({
9308
9337
  specsDir: path62.join(cwd, "docs", "specs"),