@cod3vil/kount-cli 1.0.1 → 1.0.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 (3) hide show
  1. package/dist/kount.js +744 -732
  2. package/package.json +3 -3
  3. package/dist/kount +0 -0
package/dist/kount.js CHANGED
@@ -32592,7 +32592,7 @@ var require_suggestSimilar = __commonJS((exports) => {
32592
32592
  var require_command = __commonJS((exports) => {
32593
32593
  var EventEmitter3 = __require("node:events").EventEmitter;
32594
32594
  var childProcess = __require("node:child_process");
32595
- var path = __require("node:path");
32595
+ var path2 = __require("node:path");
32596
32596
  var fs3 = __require("node:fs");
32597
32597
  var process14 = __require("node:process");
32598
32598
  var { Argument, humanReadableArgName } = require_argument();
@@ -33142,10 +33142,10 @@ Expecting one of '${allowedValues.join("', '")}'`);
33142
33142
  let launchWithNode = false;
33143
33143
  const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
33144
33144
  function findFile(baseDir, baseName) {
33145
- const localBin = path.resolve(baseDir, baseName);
33145
+ const localBin = path2.resolve(baseDir, baseName);
33146
33146
  if (fs3.existsSync(localBin))
33147
33147
  return localBin;
33148
- if (sourceExt.includes(path.extname(baseName)))
33148
+ if (sourceExt.includes(path2.extname(baseName)))
33149
33149
  return;
33150
33150
  const foundExt = sourceExt.find((ext) => fs3.existsSync(`${localBin}${ext}`));
33151
33151
  if (foundExt)
@@ -33163,19 +33163,19 @@ Expecting one of '${allowedValues.join("', '")}'`);
33163
33163
  } catch {
33164
33164
  resolvedScriptPath = this._scriptPath;
33165
33165
  }
33166
- executableDir = path.resolve(path.dirname(resolvedScriptPath), executableDir);
33166
+ executableDir = path2.resolve(path2.dirname(resolvedScriptPath), executableDir);
33167
33167
  }
33168
33168
  if (executableDir) {
33169
33169
  let localFile = findFile(executableDir, executableFile);
33170
33170
  if (!localFile && !subcommand._executableFile && this._scriptPath) {
33171
- const legacyName = path.basename(this._scriptPath, path.extname(this._scriptPath));
33171
+ const legacyName = path2.basename(this._scriptPath, path2.extname(this._scriptPath));
33172
33172
  if (legacyName !== this._name) {
33173
33173
  localFile = findFile(executableDir, `${legacyName}-${subcommand._name}`);
33174
33174
  }
33175
33175
  }
33176
33176
  executableFile = localFile || executableFile;
33177
33177
  }
33178
- launchWithNode = sourceExt.includes(path.extname(executableFile));
33178
+ launchWithNode = sourceExt.includes(path2.extname(executableFile));
33179
33179
  let proc;
33180
33180
  if (process14.platform !== "win32") {
33181
33181
  if (launchWithNode) {
@@ -33764,13 +33764,13 @@ Expecting one of '${allowedValues.join("', '")}'`);
33764
33764
  cmd.helpGroup(this._defaultCommandGroup);
33765
33765
  }
33766
33766
  nameFromFilename(filename) {
33767
- this._name = path.basename(filename, path.extname(filename));
33767
+ this._name = path2.basename(filename, path2.extname(filename));
33768
33768
  return this;
33769
33769
  }
33770
- executableDir(path2) {
33771
- if (path2 === undefined)
33770
+ executableDir(path3) {
33771
+ if (path3 === undefined)
33772
33772
  return this._executableDir;
33773
- this._executableDir = path2;
33773
+ this._executableDir = path3;
33774
33774
  return this;
33775
33775
  }
33776
33776
  helpInformation(contextOptions) {
@@ -34513,9 +34513,6 @@ var require_jsx_dev_runtime = __commonJS((exports, module) => {
34513
34513
  }
34514
34514
  });
34515
34515
 
34516
- // src/index.tsx
34517
- var import_react30 = __toESM(require_react(), 1);
34518
-
34519
34516
  // node_modules/ink/build/render.js
34520
34517
  import { Stream } from "node:stream";
34521
34518
  import process13 from "node:process";
@@ -42714,38 +42711,8 @@ var import_react26 = __toESM(require_react(), 1);
42714
42711
  var import_react27 = __toESM(require_react(), 1);
42715
42712
  // node_modules/ink/build/hooks/use-cursor.js
42716
42713
  var import_react28 = __toESM(require_react(), 1);
42717
- // node_modules/commander/esm.mjs
42718
- var import__ = __toESM(require_commander(), 1);
42719
- var {
42720
- program,
42721
- createCommand,
42722
- createArgument,
42723
- createOption,
42724
- CommanderError,
42725
- InvalidArgumentError,
42726
- InvalidOptionArgumentError,
42727
- Command,
42728
- Argument,
42729
- Option,
42730
- Help
42731
- } = import__.default;
42732
-
42733
- // src/cli/parser.ts
42734
- function createCli(argv) {
42735
- const program2 = new Command;
42736
- program2.name("kount").description("Project Intelligence for Codebases — analyze your code with precision.").version("1.0.0").option("-d, --root-dir <path>", "Root directory to scan (default: current directory)").option("-o, --output-mode <mode>", "Output mode: terminal, markdown, or html (default: terminal)").option("-t, --include-tests", "Include test files in the analysis").option("--no-gitignore", "Ignore .gitignore rules").option("--no-cache", "Disable caching").option("--clear-cache", "Clear the cache before scanning").option("-f, --force", "Force overwrite output files (for markdown mode)").option("--output <path>", "Output file path (for markdown mode)").parse(argv);
42737
- const opts = program2.opts();
42738
- return {
42739
- rootDir: opts.rootDir,
42740
- outputMode: opts.outputMode,
42741
- includeTests: opts.includeTests,
42742
- respectGitignore: opts.gitignore,
42743
- cache: opts.cache,
42744
- clearCache: opts.clearCache,
42745
- force: opts.force,
42746
- output: opts.output
42747
- };
42748
- }
42714
+ // src/index.tsx
42715
+ var import_react30 = __toESM(require_react(), 1);
42749
42716
 
42750
42717
  // src/cli/config-resolver.ts
42751
42718
  import fsp from "node:fs/promises";
@@ -42843,6 +42810,39 @@ function validateOutputMode(mode) {
42843
42810
  return "terminal";
42844
42811
  }
42845
42812
 
42813
+ // node_modules/commander/esm.mjs
42814
+ var import__ = __toESM(require_commander(), 1);
42815
+ var {
42816
+ program,
42817
+ createCommand,
42818
+ createArgument,
42819
+ createOption,
42820
+ CommanderError,
42821
+ InvalidArgumentError,
42822
+ InvalidOptionArgumentError,
42823
+ Command,
42824
+ Argument,
42825
+ Option,
42826
+ Help
42827
+ } = import__.default;
42828
+
42829
+ // src/cli/parser.ts
42830
+ function createCli(argv) {
42831
+ const program2 = new Command;
42832
+ program2.name("kount").description("Project Intelligence for Codebases — analyze your code with precision.").version("1.0.0").option("-d, --root-dir <path>", "Root directory to scan (default: current directory)").option("-o, --output-mode <mode>", "Output mode: terminal, markdown, or html (default: terminal)").option("-t, --include-tests", "Include test files in the analysis").option("--no-gitignore", "Ignore .gitignore rules").option("--no-cache", "Disable caching").option("--clear-cache", "Clear the cache before scanning").option("-f, --force", "Force overwrite output files (for markdown mode)").option("--output <path>", "Output file path (for markdown mode)").parse(argv);
42833
+ const opts = program2.opts();
42834
+ return {
42835
+ rootDir: opts.rootDir,
42836
+ outputMode: opts.outputMode,
42837
+ includeTests: opts.includeTests,
42838
+ respectGitignore: opts.gitignore,
42839
+ cache: opts.cache,
42840
+ clearCache: opts.clearCache,
42841
+ force: opts.force,
42842
+ output: opts.output
42843
+ };
42844
+ }
42845
+
42846
42846
  // src/core/aggregator.ts
42847
42847
  import fsp4 from "node:fs/promises";
42848
42848
  import path5 from "node:path";
@@ -43518,630 +43518,11 @@ class Aggregator {
43518
43518
  }
43519
43519
  }
43520
43520
 
43521
- // src/reporters/terminal/Splash.tsx
43522
- var jsx_dev_runtime = __toESM(require_jsx_dev_runtime(), 1);
43523
- var LOGO = `
43524
- ██╗ ██╗ ██████╗ ██╗ ██╗███╗ ██╗████████╗
43525
- ██║ ██╔╝██╔═══██╗██║ ██║████╗ ██║╚══██╔══╝
43526
- █████╔╝ ██║ ██║██║ ██║██╔██╗ ██║ ██║
43527
- ██╔═██╗ ██║ ██║██║ ██║██║╚██╗██║ ██║
43528
- ██║ ██╗╚██████╔╝╚██████╔╝██║ ╚████║ ██║
43529
- ╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═══╝ ╚═╝`;
43530
- function Splash() {
43531
- return /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Box_default, {
43532
- flexDirection: "column",
43533
- borderStyle: "round",
43534
- borderColor: "cyan",
43535
- paddingX: 2,
43536
- paddingY: 1,
43537
- children: [
43538
- /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Text, {
43539
- color: "cyan",
43540
- bold: true,
43541
- children: LOGO
43542
- }, undefined, false, undefined, this),
43543
- /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Box_default, {
43544
- marginTop: 1,
43545
- children: /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Text, {
43546
- color: "white",
43547
- dimColor: true,
43548
- children: " Project Intelligence for Codebases"
43549
- }, undefined, false, undefined, this)
43550
- }, undefined, false, undefined, this)
43551
- ]
43552
- }, undefined, true, undefined, this);
43553
- }
43554
-
43555
- // src/reporters/terminal/Progress.tsx
43556
- var jsx_dev_runtime2 = __toESM(require_jsx_dev_runtime(), 1);
43557
- function Progress({ current, total, currentFile }) {
43558
- const percentage = total > 0 ? Math.round(current / total * 100) : 0;
43559
- const barWidth = 30;
43560
- const filled = Math.round(percentage / 100 * barWidth);
43561
- const empty = barWidth - filled;
43562
- const bar = "█".repeat(filled) + "░".repeat(empty);
43563
- const barColor = percentage < 33 ? "red" : percentage < 66 ? "yellow" : "green";
43564
- return /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Box_default, {
43565
- flexDirection: "column",
43566
- marginY: 1,
43567
- children: [
43568
- /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Box_default, {
43569
- children: [
43570
- /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Text, {
43571
- color: "white",
43572
- bold: true,
43573
- children: "Scanning: "
43574
- }, undefined, false, undefined, this),
43575
- /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Text, {
43576
- color: barColor,
43577
- children: bar
43578
- }, undefined, false, undefined, this),
43579
- /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Text, {
43580
- color: "white",
43581
- children: [
43582
- " ",
43583
- percentage,
43584
- "%"
43585
- ]
43586
- }, undefined, true, undefined, this),
43587
- /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Text, {
43588
- color: "gray",
43589
- children: [
43590
- " (",
43591
- current,
43592
- "/",
43593
- total,
43594
- ")"
43595
- ]
43596
- }, undefined, true, undefined, this)
43597
- ]
43598
- }, undefined, true, undefined, this),
43599
- /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Box_default, {
43600
- marginTop: 0,
43601
- children: /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Text, {
43602
- color: "gray",
43603
- wrap: "truncate-end",
43604
- children: [
43605
- " ",
43606
- currentFile
43607
- ]
43608
- }, undefined, true, undefined, this)
43609
- }, undefined, false, undefined, this)
43610
- ]
43611
- }, undefined, true, undefined, this);
43612
- }
43613
-
43614
- // src/reporters/terminal/Summary.tsx
43615
- var jsx_dev_runtime3 = __toESM(require_jsx_dev_runtime(), 1);
43521
+ // src/reporters/html.ts
43522
+ import { exec as exec3 } from "node:child_process";
43523
+ import http from "node:http";
43616
43524
  import path6 from "node:path";
43617
- function Summary({ stats }) {
43618
- const totalLines = stats.pluginResults.get("TotalLines")?.summaryValue ?? 0;
43619
- const blankLines = stats.pluginResults.get("BlankLines")?.summaryValue ?? 0;
43620
- const commentLines = stats.pluginResults.get("CommentLines")?.summaryValue ?? 0;
43621
- const totalBytes = stats.pluginResults.get("FileSize")?.summaryValue ?? 0;
43622
- const codeLines = totalLines - blankLines - commentLines;
43623
- const codeRatio = totalLines > 0 ? (codeLines / totalLines * 100).toFixed(1) : "0.0";
43624
- const formatSize = (bytes) => {
43625
- if (bytes < 1024)
43626
- return `${bytes} B`;
43627
- if (bytes < 1024 * 1024)
43628
- return `${(bytes / 1024).toFixed(1)} KB`;
43629
- return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
43630
- };
43631
- const sortedLangs = [...stats.languageDistribution.entries()].sort((a, b) => b[1] - a[1]);
43632
- return /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Box_default, {
43633
- flexDirection: "column",
43634
- marginY: 1,
43635
- children: [
43636
- /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Box_default, {
43637
- flexDirection: "column",
43638
- borderStyle: "single",
43639
- borderColor: "green",
43640
- paddingX: 2,
43641
- paddingY: 1,
43642
- children: [
43643
- /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
43644
- color: "green",
43645
- bold: true,
43646
- children: " SCAN RESULTS"
43647
- }, undefined, false, undefined, this),
43648
- /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Box_default, {
43649
- marginTop: 1,
43650
- flexDirection: "column",
43651
- children: [
43652
- /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Box_default, {
43653
- children: [
43654
- /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Box_default, {
43655
- width: 20,
43656
- children: /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
43657
- color: "white",
43658
- children: "Files"
43659
- }, undefined, false, undefined, this)
43660
- }, undefined, false, undefined, this),
43661
- /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
43662
- color: "cyan",
43663
- bold: true,
43664
- children: stats.totalFiles.toLocaleString()
43665
- }, undefined, false, undefined, this)
43666
- ]
43667
- }, undefined, true, undefined, this),
43668
- /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Box_default, {
43669
- children: [
43670
- /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Box_default, {
43671
- width: 20,
43672
- children: /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
43673
- color: "white",
43674
- children: "Total Lines"
43675
- }, undefined, false, undefined, this)
43676
- }, undefined, false, undefined, this),
43677
- /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
43678
- color: "cyan",
43679
- bold: true,
43680
- children: totalLines.toLocaleString()
43681
- }, undefined, false, undefined, this)
43682
- ]
43683
- }, undefined, true, undefined, this),
43684
- /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Box_default, {
43685
- children: [
43686
- /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Box_default, {
43687
- width: 20,
43688
- children: /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
43689
- color: "white",
43690
- children: "Code Lines"
43691
- }, undefined, false, undefined, this)
43692
- }, undefined, false, undefined, this),
43693
- /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
43694
- color: "green",
43695
- bold: true,
43696
- children: codeLines.toLocaleString()
43697
- }, undefined, false, undefined, this)
43698
- ]
43699
- }, undefined, true, undefined, this),
43700
- /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Box_default, {
43701
- children: [
43702
- /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Box_default, {
43703
- width: 20,
43704
- children: /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
43705
- color: "white",
43706
- children: "Comment Lines"
43707
- }, undefined, false, undefined, this)
43708
- }, undefined, false, undefined, this),
43709
- /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
43710
- color: "yellow",
43711
- bold: true,
43712
- children: commentLines.toLocaleString()
43713
- }, undefined, false, undefined, this)
43714
- ]
43715
- }, undefined, true, undefined, this),
43716
- /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Box_default, {
43717
- children: [
43718
- /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Box_default, {
43719
- width: 20,
43720
- children: /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
43721
- color: "white",
43722
- children: "Blank Lines"
43723
- }, undefined, false, undefined, this)
43724
- }, undefined, false, undefined, this),
43725
- /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
43726
- color: "gray",
43727
- bold: true,
43728
- children: blankLines.toLocaleString()
43729
- }, undefined, false, undefined, this)
43730
- ]
43731
- }, undefined, true, undefined, this),
43732
- /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Box_default, {
43733
- children: [
43734
- /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Box_default, {
43735
- width: 20,
43736
- children: /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
43737
- color: "white",
43738
- children: "Code Ratio"
43739
- }, undefined, false, undefined, this)
43740
- }, undefined, false, undefined, this),
43741
- /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
43742
- color: "green",
43743
- bold: true,
43744
- children: [
43745
- codeRatio,
43746
- "%"
43747
- ]
43748
- }, undefined, true, undefined, this)
43749
- ]
43750
- }, undefined, true, undefined, this),
43751
- /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Box_default, {
43752
- children: [
43753
- /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Box_default, {
43754
- width: 20,
43755
- children: /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
43756
- color: "white",
43757
- children: "Total Size"
43758
- }, undefined, false, undefined, this)
43759
- }, undefined, false, undefined, this),
43760
- /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
43761
- color: "cyan",
43762
- bold: true,
43763
- children: formatSize(totalBytes)
43764
- }, undefined, false, undefined, this)
43765
- ]
43766
- }, undefined, true, undefined, this)
43767
- ]
43768
- }, undefined, true, undefined, this)
43769
- ]
43770
- }, undefined, true, undefined, this),
43771
- sortedLangs.length > 0 && /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Box_default, {
43772
- flexDirection: "column",
43773
- borderStyle: "single",
43774
- borderColor: "blue",
43775
- paddingX: 2,
43776
- paddingY: 1,
43777
- marginTop: 1,
43778
- children: [
43779
- /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
43780
- color: "blue",
43781
- bold: true,
43782
- children: " LANGUAGE DISTRIBUTION"
43783
- }, undefined, false, undefined, this),
43784
- /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Box_default, {
43785
- marginTop: 1,
43786
- flexDirection: "column",
43787
- children: sortedLangs.map(([lang, count]) => {
43788
- const pct = (count / stats.totalFiles * 100).toFixed(1);
43789
- return /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Box_default, {
43790
- children: [
43791
- /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Box_default, {
43792
- width: 22,
43793
- children: /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
43794
- color: "white",
43795
- children: lang
43796
- }, undefined, false, undefined, this)
43797
- }, undefined, false, undefined, this),
43798
- /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Box_default, {
43799
- width: 8,
43800
- children: /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
43801
- color: "cyan",
43802
- children: [
43803
- count,
43804
- " files"
43805
- ]
43806
- }, undefined, true, undefined, this)
43807
- }, undefined, false, undefined, this),
43808
- /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
43809
- color: "gray",
43810
- children: [
43811
- " (",
43812
- pct,
43813
- "%)"
43814
- ]
43815
- }, undefined, true, undefined, this)
43816
- ]
43817
- }, lang, true, undefined, this);
43818
- })
43819
- }, undefined, false, undefined, this)
43820
- ]
43821
- }, undefined, true, undefined, this),
43822
- stats.largestFiles.length > 0 && /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Box_default, {
43823
- flexDirection: "column",
43824
- borderStyle: "single",
43825
- borderColor: "magenta",
43826
- paddingX: 2,
43827
- paddingY: 1,
43828
- marginTop: 1,
43829
- children: [
43830
- /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
43831
- color: "magenta",
43832
- bold: true,
43833
- children: [
43834
- " TOP ",
43835
- stats.largestFiles.length,
43836
- " LARGEST FILES"
43837
- ]
43838
- }, undefined, true, undefined, this),
43839
- /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Box_default, {
43840
- marginTop: 1,
43841
- flexDirection: "column",
43842
- children: stats.largestFiles.map((file, i) => {
43843
- const relPath = path6.relative(stats.rootDir, file.filePath);
43844
- return /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Box_default, {
43845
- children: [
43846
- /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Box_default, {
43847
- width: 4,
43848
- children: /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
43849
- color: "gray",
43850
- children: [
43851
- i + 1,
43852
- "."
43853
- ]
43854
- }, undefined, true, undefined, this)
43855
- }, undefined, false, undefined, this),
43856
- /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Box_default, {
43857
- width: 40,
43858
- children: /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
43859
- color: "white",
43860
- wrap: "truncate-end",
43861
- children: relPath
43862
- }, undefined, false, undefined, this)
43863
- }, undefined, false, undefined, this),
43864
- /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
43865
- color: "yellow",
43866
- children: formatSize(file.size)
43867
- }, undefined, false, undefined, this)
43868
- ]
43869
- }, file.filePath, true, undefined, this);
43870
- })
43871
- }, undefined, false, undefined, this)
43872
- ]
43873
- }, undefined, true, undefined, this),
43874
- /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Box_default, {
43875
- marginTop: 1,
43876
- children: /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
43877
- color: "gray",
43878
- children: [
43879
- "Scanned at ",
43880
- stats.scannedAt.toLocaleString()
43881
- ]
43882
- }, undefined, true, undefined, this)
43883
- }, undefined, false, undefined, this)
43884
- ]
43885
- }, undefined, true, undefined, this);
43886
- }
43887
-
43888
- // src/reporters/terminal/Wizard.tsx
43889
- var import_react29 = __toESM(require_react(), 1);
43890
- var jsx_dev_runtime4 = __toESM(require_jsx_dev_runtime(), 1);
43891
- var OUTPUT_MODES = ["terminal", "markdown", "html"];
43892
- function Wizard({ onComplete }) {
43893
- const { exit } = use_app_default();
43894
- const [step, setStep] = import_react29.useState("rootDir");
43895
- const [rootDir, setRootDir] = import_react29.useState(".");
43896
- const [rootDirInput, setRootDirInput] = import_react29.useState(".");
43897
- const [outputModeIndex, setOutputModeIndex] = import_react29.useState(0);
43898
- const [includeTestsIndex, setIncludeTestsIndex] = import_react29.useState(0);
43899
- const boolOptions = ["Yes", "No"];
43900
- use_input_default(import_react29.useCallback((input, key) => {
43901
- if (key.escape) {
43902
- exit();
43903
- return;
43904
- }
43905
- if (step === "rootDir") {
43906
- if (key.return) {
43907
- setRootDir(rootDirInput || ".");
43908
- setStep("outputMode");
43909
- } else if (key.backspace || key.delete) {
43910
- setRootDirInput((prev) => prev.slice(0, -1));
43911
- } else if (input && !key.upArrow && !key.downArrow) {
43912
- setRootDirInput((prev) => prev + input);
43913
- }
43914
- } else if (step === "outputMode") {
43915
- if (key.upArrow) {
43916
- setOutputModeIndex((prev) => (prev - 1 + OUTPUT_MODES.length) % OUTPUT_MODES.length);
43917
- } else if (key.downArrow) {
43918
- setOutputModeIndex((prev) => (prev + 1) % OUTPUT_MODES.length);
43919
- } else if (key.return) {
43920
- setStep("includeTests");
43921
- }
43922
- } else if (step === "includeTests") {
43923
- if (key.upArrow || key.downArrow) {
43924
- setIncludeTestsIndex((prev) => (prev + 1) % 2);
43925
- } else if (key.return) {
43926
- onComplete({
43927
- rootDir,
43928
- outputMode: OUTPUT_MODES[outputModeIndex],
43929
- includeTests: includeTestsIndex === 0
43930
- });
43931
- }
43932
- }
43933
- }, [step, rootDirInput, rootDir, outputModeIndex, includeTestsIndex, onComplete, exit]));
43934
- return /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Box_default, {
43935
- flexDirection: "column",
43936
- paddingX: 1,
43937
- paddingY: 1,
43938
- children: [
43939
- /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Text, {
43940
- color: "cyan",
43941
- bold: true,
43942
- children: "KOUNT Setup Wizard"
43943
- }, undefined, false, undefined, this),
43944
- /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Text, {
43945
- color: "gray",
43946
- children: "Press ESC to cancel at any time."
43947
- }, undefined, false, undefined, this),
43948
- /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Box_default, {
43949
- marginTop: 1,
43950
- flexDirection: "column",
43951
- children: [
43952
- /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Box_default, {
43953
- flexDirection: "column",
43954
- children: [
43955
- /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Text, {
43956
- color: step === "rootDir" ? "white" : "green",
43957
- bold: true,
43958
- children: [
43959
- step === "rootDir" ? ">" : "✓",
43960
- " Root directory:",
43961
- step !== "rootDir" && /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Text, {
43962
- color: "cyan",
43963
- children: [
43964
- " ",
43965
- rootDir
43966
- ]
43967
- }, undefined, true, undefined, this)
43968
- ]
43969
- }, undefined, true, undefined, this),
43970
- step === "rootDir" && /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Box_default, {
43971
- marginLeft: 2,
43972
- children: [
43973
- /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Text, {
43974
- color: "cyan",
43975
- children: rootDirInput
43976
- }, undefined, false, undefined, this),
43977
- /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Text, {
43978
- color: "gray",
43979
- children: "█"
43980
- }, undefined, false, undefined, this)
43981
- ]
43982
- }, undefined, true, undefined, this)
43983
- ]
43984
- }, undefined, true, undefined, this),
43985
- (step === "outputMode" || step === "includeTests") && /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Box_default, {
43986
- flexDirection: "column",
43987
- marginTop: 1,
43988
- children: [
43989
- /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Text, {
43990
- color: step === "outputMode" ? "white" : "green",
43991
- bold: true,
43992
- children: [
43993
- step === "outputMode" ? ">" : "✓",
43994
- " Output mode:",
43995
- step !== "outputMode" && /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Text, {
43996
- color: "cyan",
43997
- children: [
43998
- " ",
43999
- OUTPUT_MODES[outputModeIndex]
44000
- ]
44001
- }, undefined, true, undefined, this)
44002
- ]
44003
- }, undefined, true, undefined, this),
44004
- step === "outputMode" && /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Box_default, {
44005
- marginLeft: 2,
44006
- flexDirection: "column",
44007
- children: OUTPUT_MODES.map((mode, i) => /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Text, {
44008
- color: i === outputModeIndex ? "cyan" : "gray",
44009
- children: [
44010
- i === outputModeIndex ? "> " : " ",
44011
- mode
44012
- ]
44013
- }, mode, true, undefined, this))
44014
- }, undefined, false, undefined, this)
44015
- ]
44016
- }, undefined, true, undefined, this),
44017
- step === "includeTests" && /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Box_default, {
44018
- flexDirection: "column",
44019
- marginTop: 1,
44020
- children: [
44021
- /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Text, {
44022
- color: "white",
44023
- bold: true,
44024
- children: [
44025
- ">",
44026
- " Include test files?"
44027
- ]
44028
- }, undefined, true, undefined, this),
44029
- /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Box_default, {
44030
- marginLeft: 2,
44031
- flexDirection: "column",
44032
- children: boolOptions.map((opt, i) => /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Text, {
44033
- color: i === includeTestsIndex ? "cyan" : "gray",
44034
- children: [
44035
- i === includeTestsIndex ? "> " : " ",
44036
- opt
44037
- ]
44038
- }, opt, true, undefined, this))
44039
- }, undefined, false, undefined, this)
44040
- ]
44041
- }, undefined, true, undefined, this)
44042
- ]
44043
- }, undefined, true, undefined, this)
44044
- ]
44045
- }, undefined, true, undefined, this);
44046
- }
44047
-
44048
- // src/reporters/markdown.ts
44049
- import fsp5 from "node:fs/promises";
44050
- import path7 from "node:path";
44051
- var KOUNT_HEADER = "<!-- KOUNT:START -->";
44052
- var KOUNT_FOOTER = "<!-- KOUNT:END -->";
44053
- function generateMarkdownReport(stats) {
44054
- const totalLines = stats.pluginResults.get("TotalLines")?.summaryValue ?? 0;
44055
- const blankLines = stats.pluginResults.get("BlankLines")?.summaryValue ?? 0;
44056
- const commentLines = stats.pluginResults.get("CommentLines")?.summaryValue ?? 0;
44057
- const totalBytes = stats.pluginResults.get("FileSize")?.summaryValue ?? 0;
44058
- const codeLines = totalLines - blankLines - commentLines;
44059
- const codeRatio = totalLines > 0 ? (codeLines / totalLines * 100).toFixed(1) : "0.0";
44060
- const formatSize = (bytes) => {
44061
- if (bytes < 1024)
44062
- return `${bytes} B`;
44063
- if (bytes < 1024 * 1024)
44064
- return `${(bytes / 1024).toFixed(1)} KB`;
44065
- return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
44066
- };
44067
- const lines = [];
44068
- lines.push(KOUNT_HEADER);
44069
- lines.push("");
44070
- lines.push("## Codebase Statistics");
44071
- lines.push("");
44072
- lines.push(`> Generated by [kount](https://github.com/kount) on ${stats.scannedAt.toLocaleDateString()}`);
44073
- lines.push("");
44074
- lines.push("### Summary");
44075
- lines.push("");
44076
- lines.push("| Metric | Value |");
44077
- lines.push("|--------|-------|");
44078
- lines.push(`| Files | ${stats.totalFiles.toLocaleString()} |`);
44079
- lines.push(`| Total Lines | ${totalLines.toLocaleString()} |`);
44080
- lines.push(`| Code Lines | ${codeLines.toLocaleString()} |`);
44081
- lines.push(`| Comment Lines | ${commentLines.toLocaleString()} |`);
44082
- lines.push(`| Blank Lines | ${blankLines.toLocaleString()} |`);
44083
- lines.push(`| Code Ratio | ${codeRatio}% |`);
44084
- lines.push(`| Total Size | ${formatSize(totalBytes)} |`);
44085
- lines.push("");
44086
- if (stats.languageDistribution.size > 0) {
44087
- const sortedLangs = [...stats.languageDistribution.entries()].sort((a, b) => b[1] - a[1]);
44088
- lines.push("### Language Distribution");
44089
- lines.push("");
44090
- lines.push("| Language | Files | % |");
44091
- lines.push("|----------|-------|---|");
44092
- for (const [lang, count] of sortedLangs) {
44093
- const pct = (count / stats.totalFiles * 100).toFixed(1);
44094
- lines.push(`| ${lang} | ${count} | ${pct}% |`);
44095
- }
44096
- lines.push("");
44097
- }
44098
- if (stats.largestFiles.length > 0) {
44099
- lines.push("### Top 10 Largest Files");
44100
- lines.push("");
44101
- lines.push("| # | File | Size |");
44102
- lines.push("|---|------|------|");
44103
- for (let i = 0;i < stats.largestFiles.length; i++) {
44104
- const file = stats.largestFiles[i];
44105
- const relPath = path7.relative(stats.rootDir, file.filePath);
44106
- lines.push(`| ${i + 1} | \`${relPath}\` | ${formatSize(file.size)} |`);
44107
- }
44108
- lines.push("");
44109
- }
44110
- lines.push(KOUNT_FOOTER);
44111
- return lines.join(`
44112
- `);
44113
- }
44114
- async function writeMarkdownReport(stats, outputPath, force = false) {
44115
- const targetPath = outputPath ?? path7.join(stats.rootDir, "README.md");
44116
- const report = generateMarkdownReport(stats);
44117
- if (force) {
44118
- await fsp5.writeFile(targetPath, report, "utf8");
44119
- return targetPath;
44120
- }
44121
- try {
44122
- const existing = await fsp5.readFile(targetPath, "utf8");
44123
- const startIdx = existing.indexOf(KOUNT_HEADER);
44124
- const endIdx = existing.indexOf(KOUNT_FOOTER);
44125
- if (startIdx !== -1 && endIdx !== -1) {
44126
- const before = existing.substring(0, startIdx);
44127
- const after = existing.substring(endIdx + KOUNT_FOOTER.length);
44128
- await fsp5.writeFile(targetPath, before + report + after, "utf8");
44129
- } else {
44130
- await fsp5.writeFile(targetPath, existing + `
44131
-
44132
- ` + report, "utf8");
44133
- }
44134
- } catch {
44135
- await fsp5.writeFile(targetPath, report, "utf8");
44136
- }
44137
- return targetPath;
44138
- }
44139
-
44140
- // src/reporters/html.ts
44141
- import { exec as exec3 } from "node:child_process";
44142
- import http from "node:http";
44143
- import path8 from "node:path";
44144
- function generateHtmlDashboard(stats) {
43525
+ function generateHtmlDashboard(stats) {
44145
43526
  const totalLines = stats.pluginResults.get("TotalLines")?.summaryValue ?? 0;
44146
43527
  const blankLines = stats.pluginResults.get("BlankLines")?.summaryValue ?? 0;
44147
43528
  const commentLines = stats.pluginResults.get("CommentLines")?.summaryValue ?? 0;
@@ -44162,7 +43543,7 @@ function generateHtmlDashboard(stats) {
44162
43543
  }));
44163
43544
  const largestData = stats.largestFiles.map((f, i) => ({
44164
43545
  rank: i + 1,
44165
- path: path8.relative(stats.rootDir, f.filePath),
43546
+ path: path6.relative(stats.rootDir, f.filePath),
44166
43547
  size: formatSize(f.size),
44167
43548
  rawSize: f.size
44168
43549
  }));
@@ -44421,68 +43802,687 @@ function generateHtmlDashboard(stats) {
44421
43802
  Generated by KOUNT &mdash; Project Intelligence for Codebases
44422
43803
  </div>
44423
43804
 
44424
- </div>
43805
+ </div>
43806
+
43807
+ <script>
43808
+ function dashboard() {
43809
+ const data = ${jsonData};
43810
+ return {
43811
+ data,
43812
+ currentTab: 'dashboard',
43813
+ langSort: 'count',
43814
+ get summaryCards() {
43815
+ const s = this.data.summary;
43816
+ return [
43817
+ { label: 'Files', value: s.files.toLocaleString(), color: 'text-cyan-400' },
43818
+ { label: 'Total Lines', value: s.totalLines.toLocaleString(), color: 'text-white' },
43819
+ { label: 'Code Lines', value: s.codeLines.toLocaleString(), color: 'text-green-400' },
43820
+ { label: 'Code Ratio', value: s.codeRatio + '%', color: 'text-green-400' },
43821
+ { label: 'Comment Lines', value: s.commentLines.toLocaleString(), color: 'text-yellow-400' },
43822
+ { label: 'Blank Lines', value: s.blankLines.toLocaleString(), color: 'text-gray-400' },
43823
+ { label: 'Total Size', value: s.totalSize, color: 'text-cyan-400' },
43824
+ ];
43825
+ },
43826
+ get sortedLanguages() {
43827
+ const langs = [...this.data.languages];
43828
+ if (this.langSort === 'name') {
43829
+ langs.sort((a, b) => a.lang.localeCompare(b.lang));
43830
+ } else {
43831
+ langs.sort((a, b) => b.count - a.count);
43832
+ }
43833
+ return langs;
43834
+ }
43835
+ };
43836
+ }
43837
+ </script>
43838
+ </body>
43839
+ </html>`;
43840
+ }
43841
+ async function serveHtmlDashboard(stats, port = 0) {
43842
+ const html = generateHtmlDashboard(stats);
43843
+ return new Promise((resolve, reject) => {
43844
+ const server = http.createServer((_req, res) => {
43845
+ res.writeHead(200, {
43846
+ "Content-Type": "text/html; charset=utf-8",
43847
+ "Cache-Control": "no-store"
43848
+ });
43849
+ res.end(html);
43850
+ });
43851
+ server.listen(port, "127.0.0.1", () => {
43852
+ const address = server.address();
43853
+ if (!address || typeof address === "string") {
43854
+ reject(new Error("Failed to get server address"));
43855
+ return;
43856
+ }
43857
+ const url = `http://127.0.0.1:${address.port}`;
43858
+ const openCmd = process.platform === "darwin" ? `open "${url}"` : process.platform === "win32" ? `start "${url}"` : `xdg-open "${url}"`;
43859
+ exec3(openCmd);
43860
+ resolve({
43861
+ url,
43862
+ close: () => server.close()
43863
+ });
43864
+ });
43865
+ server.on("error", reject);
43866
+ });
43867
+ }
43868
+
43869
+ // src/reporters/markdown.ts
43870
+ import fsp5 from "node:fs/promises";
43871
+ import path7 from "node:path";
43872
+ var KOUNT_HEADER = "<!-- KOUNT:START -->";
43873
+ var KOUNT_FOOTER = "<!-- KOUNT:END -->";
43874
+ function generateMarkdownReport(stats) {
43875
+ const totalLines = stats.pluginResults.get("TotalLines")?.summaryValue ?? 0;
43876
+ const blankLines = stats.pluginResults.get("BlankLines")?.summaryValue ?? 0;
43877
+ const commentLines = stats.pluginResults.get("CommentLines")?.summaryValue ?? 0;
43878
+ const totalBytes = stats.pluginResults.get("FileSize")?.summaryValue ?? 0;
43879
+ const codeLines = totalLines - blankLines - commentLines;
43880
+ const codeRatio = totalLines > 0 ? (codeLines / totalLines * 100).toFixed(1) : "0.0";
43881
+ const formatSize = (bytes) => {
43882
+ if (bytes < 1024)
43883
+ return `${bytes} B`;
43884
+ if (bytes < 1024 * 1024)
43885
+ return `${(bytes / 1024).toFixed(1)} KB`;
43886
+ return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
43887
+ };
43888
+ const lines = [];
43889
+ lines.push(KOUNT_HEADER);
43890
+ lines.push("");
43891
+ lines.push("## Codebase Statistics");
43892
+ lines.push("");
43893
+ lines.push(`> Generated by [kount](https://github.com/kount) on ${stats.scannedAt.toLocaleDateString()}`);
43894
+ lines.push("");
43895
+ lines.push("### Summary");
43896
+ lines.push("");
43897
+ lines.push("| Metric | Value |");
43898
+ lines.push("|--------|-------|");
43899
+ lines.push(`| Files | ${stats.totalFiles.toLocaleString()} |`);
43900
+ lines.push(`| Total Lines | ${totalLines.toLocaleString()} |`);
43901
+ lines.push(`| Code Lines | ${codeLines.toLocaleString()} |`);
43902
+ lines.push(`| Comment Lines | ${commentLines.toLocaleString()} |`);
43903
+ lines.push(`| Blank Lines | ${blankLines.toLocaleString()} |`);
43904
+ lines.push(`| Code Ratio | ${codeRatio}% |`);
43905
+ lines.push(`| Total Size | ${formatSize(totalBytes)} |`);
43906
+ lines.push("");
43907
+ if (stats.languageDistribution.size > 0) {
43908
+ const sortedLangs = [...stats.languageDistribution.entries()].sort((a, b) => b[1] - a[1]);
43909
+ lines.push("### Language Distribution");
43910
+ lines.push("");
43911
+ lines.push("| Language | Files | % |");
43912
+ lines.push("|----------|-------|---|");
43913
+ for (const [lang, count] of sortedLangs) {
43914
+ const pct = (count / stats.totalFiles * 100).toFixed(1);
43915
+ lines.push(`| ${lang} | ${count} | ${pct}% |`);
43916
+ }
43917
+ lines.push("");
43918
+ }
43919
+ if (stats.largestFiles.length > 0) {
43920
+ lines.push("### Top 10 Largest Files");
43921
+ lines.push("");
43922
+ lines.push("| # | File | Size |");
43923
+ lines.push("|---|------|------|");
43924
+ for (let i = 0;i < stats.largestFiles.length; i++) {
43925
+ const file = stats.largestFiles[i];
43926
+ const relPath = path7.relative(stats.rootDir, file.filePath);
43927
+ lines.push(`| ${i + 1} | \`${relPath}\` | ${formatSize(file.size)} |`);
43928
+ }
43929
+ lines.push("");
43930
+ }
43931
+ lines.push(KOUNT_FOOTER);
43932
+ return lines.join(`
43933
+ `);
43934
+ }
43935
+ async function writeMarkdownReport(stats, outputPath, force = false) {
43936
+ const targetPath = outputPath ?? path7.join(stats.rootDir, "README.md");
43937
+ const report = generateMarkdownReport(stats);
43938
+ if (force) {
43939
+ await fsp5.writeFile(targetPath, report, "utf8");
43940
+ return targetPath;
43941
+ }
43942
+ try {
43943
+ const existing = await fsp5.readFile(targetPath, "utf8");
43944
+ const startIdx = existing.indexOf(KOUNT_HEADER);
43945
+ const endIdx = existing.indexOf(KOUNT_FOOTER);
43946
+ if (startIdx !== -1 && endIdx !== -1) {
43947
+ const before = existing.substring(0, startIdx);
43948
+ const after = existing.substring(endIdx + KOUNT_FOOTER.length);
43949
+ await fsp5.writeFile(targetPath, before + report + after, "utf8");
43950
+ } else {
43951
+ await fsp5.writeFile(targetPath, existing + `
43952
+
43953
+ ` + report, "utf8");
43954
+ }
43955
+ } catch {
43956
+ await fsp5.writeFile(targetPath, report, "utf8");
43957
+ }
43958
+ return targetPath;
43959
+ }
43960
+
43961
+ // src/reporters/terminal/Progress.tsx
43962
+ var jsx_dev_runtime = __toESM(require_jsx_dev_runtime(), 1);
43963
+ function Progress({ current, total, currentFile }) {
43964
+ const percentage = total > 0 ? Math.round(current / total * 100) : 0;
43965
+ const barWidth = 30;
43966
+ const filled = Math.round(percentage / 100 * barWidth);
43967
+ const empty = barWidth - filled;
43968
+ const bar = "█".repeat(filled) + "░".repeat(empty);
43969
+ const barColor = percentage < 33 ? "red" : percentage < 66 ? "yellow" : "green";
43970
+ return /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Box_default, {
43971
+ flexDirection: "column",
43972
+ marginY: 1,
43973
+ children: [
43974
+ /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Box_default, {
43975
+ children: [
43976
+ /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Text, {
43977
+ color: "white",
43978
+ bold: true,
43979
+ children: "Scanning: "
43980
+ }, undefined, false, undefined, this),
43981
+ /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Text, {
43982
+ color: barColor,
43983
+ children: bar
43984
+ }, undefined, false, undefined, this),
43985
+ /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Text, {
43986
+ color: "white",
43987
+ children: [
43988
+ " ",
43989
+ percentage,
43990
+ "%"
43991
+ ]
43992
+ }, undefined, true, undefined, this),
43993
+ /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Text, {
43994
+ color: "gray",
43995
+ children: [
43996
+ " (",
43997
+ current,
43998
+ "/",
43999
+ total,
44000
+ ")"
44001
+ ]
44002
+ }, undefined, true, undefined, this)
44003
+ ]
44004
+ }, undefined, true, undefined, this),
44005
+ /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Box_default, {
44006
+ marginTop: 0,
44007
+ children: /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Text, {
44008
+ color: "gray",
44009
+ wrap: "truncate-end",
44010
+ children: [
44011
+ " ",
44012
+ currentFile
44013
+ ]
44014
+ }, undefined, true, undefined, this)
44015
+ }, undefined, false, undefined, this)
44016
+ ]
44017
+ }, undefined, true, undefined, this);
44018
+ }
44019
+
44020
+ // src/reporters/terminal/Splash.tsx
44021
+ var jsx_dev_runtime2 = __toESM(require_jsx_dev_runtime(), 1);
44022
+ var LOGO = `
44023
+ ██╗ ██╗ ██████╗ ██╗ ██╗███╗ ██╗████████╗
44024
+ ██║ ██╔╝██╔═══██╗██║ ██║████╗ ██║╚══██╔══╝
44025
+ █████╔╝ ██║ ██║██║ ██║██╔██╗ ██║ ██║
44026
+ ██╔═██╗ ██║ ██║██║ ██║██║╚██╗██║ ██║
44027
+ ██║ ██╗╚██████╔╝╚██████╔╝██║ ╚████║ ██║
44028
+ ╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═══╝ ╚═╝`;
44029
+ function Splash() {
44030
+ return /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Box_default, {
44031
+ flexDirection: "column",
44032
+ borderStyle: "round",
44033
+ borderColor: "cyan",
44034
+ paddingX: 2,
44035
+ paddingY: 1,
44036
+ children: [
44037
+ /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Text, {
44038
+ color: "cyan",
44039
+ bold: true,
44040
+ children: LOGO
44041
+ }, undefined, false, undefined, this),
44042
+ /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Box_default, {
44043
+ marginTop: 1,
44044
+ children: /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Text, {
44045
+ color: "white",
44046
+ dimColor: true,
44047
+ children: " Project Intelligence for Codebases"
44048
+ }, undefined, false, undefined, this)
44049
+ }, undefined, false, undefined, this)
44050
+ ]
44051
+ }, undefined, true, undefined, this);
44052
+ }
44053
+
44054
+ // src/reporters/terminal/Summary.tsx
44055
+ var jsx_dev_runtime3 = __toESM(require_jsx_dev_runtime(), 1);
44056
+ import path8 from "node:path";
44057
+ function Summary({ stats }) {
44058
+ const totalLines = stats.pluginResults.get("TotalLines")?.summaryValue ?? 0;
44059
+ const blankLines = stats.pluginResults.get("BlankLines")?.summaryValue ?? 0;
44060
+ const commentLines = stats.pluginResults.get("CommentLines")?.summaryValue ?? 0;
44061
+ const totalBytes = stats.pluginResults.get("FileSize")?.summaryValue ?? 0;
44062
+ const codeLines = totalLines - blankLines - commentLines;
44063
+ const codeRatio = totalLines > 0 ? (codeLines / totalLines * 100).toFixed(1) : "0.0";
44064
+ const formatSize = (bytes) => {
44065
+ if (bytes < 1024)
44066
+ return `${bytes} B`;
44067
+ if (bytes < 1024 * 1024)
44068
+ return `${(bytes / 1024).toFixed(1)} KB`;
44069
+ return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
44070
+ };
44071
+ const sortedLangs = [...stats.languageDistribution.entries()].sort((a, b) => b[1] - a[1]);
44072
+ return /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Box_default, {
44073
+ flexDirection: "column",
44074
+ marginY: 1,
44075
+ children: [
44076
+ /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Box_default, {
44077
+ flexDirection: "column",
44078
+ borderStyle: "single",
44079
+ borderColor: "green",
44080
+ paddingX: 2,
44081
+ paddingY: 1,
44082
+ children: [
44083
+ /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
44084
+ color: "green",
44085
+ bold: true,
44086
+ children: " SCAN RESULTS"
44087
+ }, undefined, false, undefined, this),
44088
+ /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Box_default, {
44089
+ marginTop: 1,
44090
+ flexDirection: "column",
44091
+ children: [
44092
+ /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Box_default, {
44093
+ children: [
44094
+ /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Box_default, {
44095
+ width: 20,
44096
+ children: /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
44097
+ color: "white",
44098
+ children: "Files"
44099
+ }, undefined, false, undefined, this)
44100
+ }, undefined, false, undefined, this),
44101
+ /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
44102
+ color: "cyan",
44103
+ bold: true,
44104
+ children: stats.totalFiles.toLocaleString()
44105
+ }, undefined, false, undefined, this)
44106
+ ]
44107
+ }, undefined, true, undefined, this),
44108
+ /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Box_default, {
44109
+ children: [
44110
+ /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Box_default, {
44111
+ width: 20,
44112
+ children: /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
44113
+ color: "white",
44114
+ children: "Total Lines"
44115
+ }, undefined, false, undefined, this)
44116
+ }, undefined, false, undefined, this),
44117
+ /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
44118
+ color: "cyan",
44119
+ bold: true,
44120
+ children: totalLines.toLocaleString()
44121
+ }, undefined, false, undefined, this)
44122
+ ]
44123
+ }, undefined, true, undefined, this),
44124
+ /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Box_default, {
44125
+ children: [
44126
+ /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Box_default, {
44127
+ width: 20,
44128
+ children: /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
44129
+ color: "white",
44130
+ children: "Code Lines"
44131
+ }, undefined, false, undefined, this)
44132
+ }, undefined, false, undefined, this),
44133
+ /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
44134
+ color: "green",
44135
+ bold: true,
44136
+ children: codeLines.toLocaleString()
44137
+ }, undefined, false, undefined, this)
44138
+ ]
44139
+ }, undefined, true, undefined, this),
44140
+ /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Box_default, {
44141
+ children: [
44142
+ /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Box_default, {
44143
+ width: 20,
44144
+ children: /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
44145
+ color: "white",
44146
+ children: "Comment Lines"
44147
+ }, undefined, false, undefined, this)
44148
+ }, undefined, false, undefined, this),
44149
+ /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
44150
+ color: "yellow",
44151
+ bold: true,
44152
+ children: commentLines.toLocaleString()
44153
+ }, undefined, false, undefined, this)
44154
+ ]
44155
+ }, undefined, true, undefined, this),
44156
+ /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Box_default, {
44157
+ children: [
44158
+ /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Box_default, {
44159
+ width: 20,
44160
+ children: /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
44161
+ color: "white",
44162
+ children: "Blank Lines"
44163
+ }, undefined, false, undefined, this)
44164
+ }, undefined, false, undefined, this),
44165
+ /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
44166
+ color: "gray",
44167
+ bold: true,
44168
+ children: blankLines.toLocaleString()
44169
+ }, undefined, false, undefined, this)
44170
+ ]
44171
+ }, undefined, true, undefined, this),
44172
+ /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Box_default, {
44173
+ children: [
44174
+ /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Box_default, {
44175
+ width: 20,
44176
+ children: /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
44177
+ color: "white",
44178
+ children: "Code Ratio"
44179
+ }, undefined, false, undefined, this)
44180
+ }, undefined, false, undefined, this),
44181
+ /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
44182
+ color: "green",
44183
+ bold: true,
44184
+ children: [
44185
+ codeRatio,
44186
+ "%"
44187
+ ]
44188
+ }, undefined, true, undefined, this)
44189
+ ]
44190
+ }, undefined, true, undefined, this),
44191
+ /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Box_default, {
44192
+ children: [
44193
+ /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Box_default, {
44194
+ width: 20,
44195
+ children: /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
44196
+ color: "white",
44197
+ children: "Total Size"
44198
+ }, undefined, false, undefined, this)
44199
+ }, undefined, false, undefined, this),
44200
+ /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
44201
+ color: "cyan",
44202
+ bold: true,
44203
+ children: formatSize(totalBytes)
44204
+ }, undefined, false, undefined, this)
44205
+ ]
44206
+ }, undefined, true, undefined, this)
44207
+ ]
44208
+ }, undefined, true, undefined, this)
44209
+ ]
44210
+ }, undefined, true, undefined, this),
44211
+ sortedLangs.length > 0 && /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Box_default, {
44212
+ flexDirection: "column",
44213
+ borderStyle: "single",
44214
+ borderColor: "blue",
44215
+ paddingX: 2,
44216
+ paddingY: 1,
44217
+ marginTop: 1,
44218
+ children: [
44219
+ /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
44220
+ color: "blue",
44221
+ bold: true,
44222
+ children: " LANGUAGE DISTRIBUTION"
44223
+ }, undefined, false, undefined, this),
44224
+ /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Box_default, {
44225
+ marginTop: 1,
44226
+ flexDirection: "column",
44227
+ children: sortedLangs.map(([lang, count]) => {
44228
+ const pct = (count / stats.totalFiles * 100).toFixed(1);
44229
+ return /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Box_default, {
44230
+ children: [
44231
+ /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Box_default, {
44232
+ width: 22,
44233
+ children: /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
44234
+ color: "white",
44235
+ children: lang
44236
+ }, undefined, false, undefined, this)
44237
+ }, undefined, false, undefined, this),
44238
+ /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Box_default, {
44239
+ width: 8,
44240
+ children: /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
44241
+ color: "cyan",
44242
+ children: [
44243
+ count,
44244
+ " files"
44245
+ ]
44246
+ }, undefined, true, undefined, this)
44247
+ }, undefined, false, undefined, this),
44248
+ /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
44249
+ color: "gray",
44250
+ children: [
44251
+ " (",
44252
+ pct,
44253
+ "%)"
44254
+ ]
44255
+ }, undefined, true, undefined, this)
44256
+ ]
44257
+ }, lang, true, undefined, this);
44258
+ })
44259
+ }, undefined, false, undefined, this)
44260
+ ]
44261
+ }, undefined, true, undefined, this),
44262
+ stats.largestFiles.length > 0 && /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Box_default, {
44263
+ flexDirection: "column",
44264
+ borderStyle: "single",
44265
+ borderColor: "magenta",
44266
+ paddingX: 2,
44267
+ paddingY: 1,
44268
+ marginTop: 1,
44269
+ children: [
44270
+ /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
44271
+ color: "magenta",
44272
+ bold: true,
44273
+ children: [
44274
+ " TOP ",
44275
+ stats.largestFiles.length,
44276
+ " LARGEST FILES"
44277
+ ]
44278
+ }, undefined, true, undefined, this),
44279
+ /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Box_default, {
44280
+ marginTop: 1,
44281
+ flexDirection: "column",
44282
+ children: stats.largestFiles.map((file, i) => {
44283
+ const relPath = path8.relative(stats.rootDir, file.filePath);
44284
+ return /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Box_default, {
44285
+ children: [
44286
+ /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Box_default, {
44287
+ width: 4,
44288
+ children: /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
44289
+ color: "gray",
44290
+ children: [
44291
+ i + 1,
44292
+ "."
44293
+ ]
44294
+ }, undefined, true, undefined, this)
44295
+ }, undefined, false, undefined, this),
44296
+ /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Box_default, {
44297
+ width: 40,
44298
+ children: /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
44299
+ color: "white",
44300
+ wrap: "truncate-end",
44301
+ children: relPath
44302
+ }, undefined, false, undefined, this)
44303
+ }, undefined, false, undefined, this),
44304
+ /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
44305
+ color: "yellow",
44306
+ children: formatSize(file.size)
44307
+ }, undefined, false, undefined, this)
44308
+ ]
44309
+ }, file.filePath, true, undefined, this);
44310
+ })
44311
+ }, undefined, false, undefined, this)
44312
+ ]
44313
+ }, undefined, true, undefined, this),
44314
+ /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Box_default, {
44315
+ marginTop: 1,
44316
+ children: /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
44317
+ color: "gray",
44318
+ children: [
44319
+ "Scanned at ",
44320
+ stats.scannedAt.toLocaleString()
44321
+ ]
44322
+ }, undefined, true, undefined, this)
44323
+ }, undefined, false, undefined, this)
44324
+ ]
44325
+ }, undefined, true, undefined, this);
44326
+ }
44425
44327
 
44426
- <script>
44427
- function dashboard() {
44428
- const data = ${jsonData};
44429
- return {
44430
- data,
44431
- currentTab: 'dashboard',
44432
- langSort: 'count',
44433
- get summaryCards() {
44434
- const s = this.data.summary;
44435
- return [
44436
- { label: 'Files', value: s.files.toLocaleString(), color: 'text-cyan-400' },
44437
- { label: 'Total Lines', value: s.totalLines.toLocaleString(), color: 'text-white' },
44438
- { label: 'Code Lines', value: s.codeLines.toLocaleString(), color: 'text-green-400' },
44439
- { label: 'Code Ratio', value: s.codeRatio + '%', color: 'text-green-400' },
44440
- { label: 'Comment Lines', value: s.commentLines.toLocaleString(), color: 'text-yellow-400' },
44441
- { label: 'Blank Lines', value: s.blankLines.toLocaleString(), color: 'text-gray-400' },
44442
- { label: 'Total Size', value: s.totalSize, color: 'text-cyan-400' },
44443
- ];
44444
- },
44445
- get sortedLanguages() {
44446
- const langs = [...this.data.languages];
44447
- if (this.langSort === 'name') {
44448
- langs.sort((a, b) => a.lang.localeCompare(b.lang));
44449
- } else {
44450
- langs.sort((a, b) => b.count - a.count);
44451
- }
44452
- return langs;
44453
- }
44454
- };
44328
+ // src/reporters/terminal/Wizard.tsx
44329
+ var import_react29 = __toESM(require_react(), 1);
44330
+ var jsx_dev_runtime4 = __toESM(require_jsx_dev_runtime(), 1);
44331
+ var OUTPUT_MODES = ["terminal", "markdown", "html"];
44332
+ function Wizard({ onComplete }) {
44333
+ const { exit } = use_app_default();
44334
+ const [step, setStep] = import_react29.useState("rootDir");
44335
+ const [rootDir, setRootDir] = import_react29.useState(".");
44336
+ const [rootDirInput, setRootDirInput] = import_react29.useState(".");
44337
+ const [outputModeIndex, setOutputModeIndex] = import_react29.useState(0);
44338
+ const [includeTestsIndex, setIncludeTestsIndex] = import_react29.useState(0);
44339
+ const boolOptions = ["Yes", "No"];
44340
+ use_input_default(import_react29.useCallback((input, key) => {
44341
+ if (key.escape) {
44342
+ exit();
44343
+ return;
44455
44344
  }
44456
- </script>
44457
- </body>
44458
- </html>`;
44459
- }
44460
- async function serveHtmlDashboard(stats, port = 0) {
44461
- const html = generateHtmlDashboard(stats);
44462
- return new Promise((resolve, reject) => {
44463
- const server = http.createServer((_req, res) => {
44464
- res.writeHead(200, {
44465
- "Content-Type": "text/html; charset=utf-8",
44466
- "Cache-Control": "no-store"
44467
- });
44468
- res.end(html);
44469
- });
44470
- server.listen(port, "127.0.0.1", () => {
44471
- const address = server.address();
44472
- if (!address || typeof address === "string") {
44473
- reject(new Error("Failed to get server address"));
44474
- return;
44345
+ if (step === "rootDir") {
44346
+ if (key.return) {
44347
+ setRootDir(rootDirInput || ".");
44348
+ setStep("outputMode");
44349
+ } else if (key.backspace || key.delete) {
44350
+ setRootDirInput((prev) => prev.slice(0, -1));
44351
+ } else if (input && !key.upArrow && !key.downArrow) {
44352
+ setRootDirInput((prev) => prev + input);
44475
44353
  }
44476
- const url = `http://127.0.0.1:${address.port}`;
44477
- const openCmd = process.platform === "darwin" ? `open "${url}"` : process.platform === "win32" ? `start "${url}"` : `xdg-open "${url}"`;
44478
- exec3(openCmd);
44479
- resolve({
44480
- url,
44481
- close: () => server.close()
44482
- });
44483
- });
44484
- server.on("error", reject);
44485
- });
44354
+ } else if (step === "outputMode") {
44355
+ if (key.upArrow) {
44356
+ setOutputModeIndex((prev) => (prev - 1 + OUTPUT_MODES.length) % OUTPUT_MODES.length);
44357
+ } else if (key.downArrow) {
44358
+ setOutputModeIndex((prev) => (prev + 1) % OUTPUT_MODES.length);
44359
+ } else if (key.return) {
44360
+ setStep("includeTests");
44361
+ }
44362
+ } else if (step === "includeTests") {
44363
+ if (key.upArrow || key.downArrow) {
44364
+ setIncludeTestsIndex((prev) => (prev + 1) % 2);
44365
+ } else if (key.return) {
44366
+ onComplete({
44367
+ rootDir,
44368
+ outputMode: OUTPUT_MODES[outputModeIndex],
44369
+ includeTests: includeTestsIndex === 0
44370
+ });
44371
+ }
44372
+ }
44373
+ }, [step, rootDirInput, rootDir, outputModeIndex, includeTestsIndex, onComplete, exit]));
44374
+ return /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Box_default, {
44375
+ flexDirection: "column",
44376
+ paddingX: 1,
44377
+ paddingY: 1,
44378
+ children: [
44379
+ /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Text, {
44380
+ color: "cyan",
44381
+ bold: true,
44382
+ children: "KOUNT Setup Wizard"
44383
+ }, undefined, false, undefined, this),
44384
+ /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Text, {
44385
+ color: "gray",
44386
+ children: "Press ESC to cancel at any time."
44387
+ }, undefined, false, undefined, this),
44388
+ /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Box_default, {
44389
+ marginTop: 1,
44390
+ flexDirection: "column",
44391
+ children: [
44392
+ /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Box_default, {
44393
+ flexDirection: "column",
44394
+ children: [
44395
+ /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Text, {
44396
+ color: step === "rootDir" ? "white" : "green",
44397
+ bold: true,
44398
+ children: [
44399
+ step === "rootDir" ? ">" : "✓",
44400
+ " Root directory:",
44401
+ step !== "rootDir" && /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Text, {
44402
+ color: "cyan",
44403
+ children: [
44404
+ " ",
44405
+ rootDir
44406
+ ]
44407
+ }, undefined, true, undefined, this)
44408
+ ]
44409
+ }, undefined, true, undefined, this),
44410
+ step === "rootDir" && /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Box_default, {
44411
+ marginLeft: 2,
44412
+ children: [
44413
+ /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Text, {
44414
+ color: "cyan",
44415
+ children: rootDirInput
44416
+ }, undefined, false, undefined, this),
44417
+ /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Text, {
44418
+ color: "gray",
44419
+ children: "█"
44420
+ }, undefined, false, undefined, this)
44421
+ ]
44422
+ }, undefined, true, undefined, this)
44423
+ ]
44424
+ }, undefined, true, undefined, this),
44425
+ (step === "outputMode" || step === "includeTests") && /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Box_default, {
44426
+ flexDirection: "column",
44427
+ marginTop: 1,
44428
+ children: [
44429
+ /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Text, {
44430
+ color: step === "outputMode" ? "white" : "green",
44431
+ bold: true,
44432
+ children: [
44433
+ step === "outputMode" ? ">" : "✓",
44434
+ " Output mode:",
44435
+ step !== "outputMode" && /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Text, {
44436
+ color: "cyan",
44437
+ children: [
44438
+ " ",
44439
+ OUTPUT_MODES[outputModeIndex]
44440
+ ]
44441
+ }, undefined, true, undefined, this)
44442
+ ]
44443
+ }, undefined, true, undefined, this),
44444
+ step === "outputMode" && /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Box_default, {
44445
+ marginLeft: 2,
44446
+ flexDirection: "column",
44447
+ children: OUTPUT_MODES.map((mode, i) => /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Text, {
44448
+ color: i === outputModeIndex ? "cyan" : "gray",
44449
+ children: [
44450
+ i === outputModeIndex ? "> " : " ",
44451
+ mode
44452
+ ]
44453
+ }, mode, true, undefined, this))
44454
+ }, undefined, false, undefined, this)
44455
+ ]
44456
+ }, undefined, true, undefined, this),
44457
+ step === "includeTests" && /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Box_default, {
44458
+ flexDirection: "column",
44459
+ marginTop: 1,
44460
+ children: [
44461
+ /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Text, {
44462
+ color: "white",
44463
+ bold: true,
44464
+ children: [
44465
+ ">",
44466
+ " Include test files?"
44467
+ ]
44468
+ }, undefined, true, undefined, this),
44469
+ /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Box_default, {
44470
+ marginLeft: 2,
44471
+ flexDirection: "column",
44472
+ children: boolOptions.map((opt, i) => /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Text, {
44473
+ color: i === includeTestsIndex ? "cyan" : "gray",
44474
+ children: [
44475
+ i === includeTestsIndex ? "> " : " ",
44476
+ opt
44477
+ ]
44478
+ }, opt, true, undefined, this))
44479
+ }, undefined, false, undefined, this)
44480
+ ]
44481
+ }, undefined, true, undefined, this)
44482
+ ]
44483
+ }, undefined, true, undefined, this)
44484
+ ]
44485
+ }, undefined, true, undefined, this);
44486
44486
  }
44487
44487
 
44488
44488
  // src/index.tsx
@@ -44538,14 +44538,26 @@ function App2({ config: initialConfig, needsWizard }) {
44538
44538
  });
44539
44539
  }, [phase, config]);
44540
44540
  const handleWizardComplete = import_react30.useCallback((result) => {
44541
- setConfig((prev) => ({
44542
- ...prev,
44541
+ const updatedConfig = {
44542
+ ...config,
44543
44543
  rootDir: result.rootDir,
44544
44544
  outputMode: result.outputMode,
44545
44545
  includeTests: result.includeTests
44546
- }));
44546
+ };
44547
+ if (result.outputMode !== "terminal") {
44548
+ exit();
44549
+ setTimeout(() => {
44550
+ runHeadless(updatedConfig).catch((err) => {
44551
+ process.stderr.write(`Error: ${err instanceof Error ? err.message : String(err)}
44552
+ `);
44553
+ process.exit(1);
44554
+ });
44555
+ }, 100);
44556
+ return;
44557
+ }
44558
+ setConfig(updatedConfig);
44547
44559
  setPhase("scanning");
44548
- }, []);
44560
+ }, [config, exit]);
44549
44561
  import_react30.useEffect(() => {
44550
44562
  if (phase === "done" && stats) {
44551
44563
  const timer = setTimeout(() => exit(), 500);