cngkit 1.1.23 → 1.1.25

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 (70) hide show
  1. package/README.md +9 -7
  2. package/dist/{chunk-AS7FIJWP.js → chunk-2Y5FMKFS.js} +3 -4
  3. package/dist/chunk-2Y5FMKFS.js.map +1 -0
  4. package/dist/{chunk-VMTXY4KQ.js → chunk-3VDQDFHG.js} +14 -6
  5. package/dist/chunk-3VDQDFHG.js.map +1 -0
  6. package/dist/{chunk-U725ZHCI.js → chunk-55IPOJ3R.js} +2 -2
  7. package/dist/{chunk-BXS4IKUA.js → chunk-DDQ5TITN.js} +91 -15
  8. package/dist/chunk-DDQ5TITN.js.map +1 -0
  9. package/dist/{chunk-BRFWVQI4.js → chunk-LC4CYVCT.js} +1 -1
  10. package/dist/chunk-LC4CYVCT.js.map +1 -0
  11. package/dist/{chunk-YALWTRIP.js → chunk-LNFZT3R3.js} +2 -2
  12. package/dist/{chunk-JNHW72SU.js → chunk-QCAHQE7Q.js} +14 -9
  13. package/dist/chunk-QCAHQE7Q.js.map +1 -0
  14. package/dist/{chunk-WIEYHKQA.js → chunk-TC6YIS5Z.js} +12 -15
  15. package/dist/chunk-TC6YIS5Z.js.map +1 -0
  16. package/dist/{chunk-67FUBMNB.js → chunk-X3UQB2CC.js} +2 -2
  17. package/dist/{chunk-67FUBMNB.js.map → chunk-X3UQB2CC.js.map} +1 -1
  18. package/dist/{chunk-GYRLVNJX.js → chunk-YIU6G2D3.js} +2 -2
  19. package/dist/{chunk-3BATDTKU.js → chunk-YPGDQ6P2.js} +2 -4
  20. package/dist/chunk-YPGDQ6P2.js.map +1 -0
  21. package/dist/cli.js +2 -2
  22. package/dist/cli.js.map +1 -1
  23. package/dist/commands/coderoom/index.js +3 -3
  24. package/dist/commands/coderoom/join.js +14 -5
  25. package/dist/commands/coderoom/join.js.map +1 -1
  26. package/dist/commands/coderoom/share.js +4 -4
  27. package/dist/commands/hookify/index.js +3 -3
  28. package/dist/commands/hookify/ingest.js +3 -3
  29. package/dist/commands/hooks/index.js +3 -3
  30. package/dist/commands/hooks/install.js +3 -3
  31. package/dist/commands/hooks/uninstall.js +3 -3
  32. package/dist/commands/index.js +3 -3
  33. package/dist/commands/knowledges/audiences.js +6 -6
  34. package/dist/commands/knowledges/cat.js +6 -6
  35. package/dist/commands/knowledges/files.js +6 -6
  36. package/dist/commands/knowledges/find.js +6 -6
  37. package/dist/commands/knowledges/find.js.map +1 -1
  38. package/dist/commands/knowledges/glob.js +5 -5
  39. package/dist/commands/knowledges/grep.js +5 -5
  40. package/dist/commands/knowledges/grep.js.map +1 -1
  41. package/dist/commands/knowledges/head.js +6 -6
  42. package/dist/commands/knowledges/index.js +3 -3
  43. package/dist/commands/knowledges/list.js +6 -6
  44. package/dist/commands/knowledges/ls.js +6 -6
  45. package/dist/commands/knowledges/ls.js.map +1 -1
  46. package/dist/commands/knowledges/read.js +5 -5
  47. package/dist/commands/knowledges/read.js.map +1 -1
  48. package/dist/commands/knowledges/realpath.js +3 -3
  49. package/dist/commands/knowledges/realpath.js.map +1 -1
  50. package/dist/commands/knowledges/search.js +6 -6
  51. package/dist/commands/knowledges/stat.js +6 -6
  52. package/dist/commands/knowledges/status.js +6 -6
  53. package/dist/commands/knowledges/tail.js +6 -6
  54. package/dist/commands/knowledges/tree.js +6 -6
  55. package/dist/commands/login.js +2 -2
  56. package/dist/commands/scrub.js +17 -14
  57. package/dist/commands/scrub.js.map +1 -1
  58. package/dist/commands/transcripts.js +37 -27
  59. package/dist/commands/transcripts.js.map +1 -1
  60. package/package.json +1 -1
  61. package/dist/chunk-3BATDTKU.js.map +0 -1
  62. package/dist/chunk-AS7FIJWP.js.map +0 -1
  63. package/dist/chunk-BRFWVQI4.js.map +0 -1
  64. package/dist/chunk-BXS4IKUA.js.map +0 -1
  65. package/dist/chunk-JNHW72SU.js.map +0 -1
  66. package/dist/chunk-VMTXY4KQ.js.map +0 -1
  67. package/dist/chunk-WIEYHKQA.js.map +0 -1
  68. /package/dist/{chunk-U725ZHCI.js.map → chunk-55IPOJ3R.js.map} +0 -0
  69. /package/dist/{chunk-YALWTRIP.js.map → chunk-LNFZT3R3.js.map} +0 -0
  70. /package/dist/{chunk-GYRLVNJX.js.map → chunk-YIU6G2D3.js.map} +0 -0
@@ -1,24 +1,24 @@
1
1
  import {
2
2
  outputRawContent
3
- } from "../../chunk-BRFWVQI4.js";
3
+ } from "../../chunk-LC4CYVCT.js";
4
4
  import {
5
5
  createKnowledgesApi
6
- } from "../../chunk-U725ZHCI.js";
6
+ } from "../../chunk-55IPOJ3R.js";
7
7
  import {
8
8
  normalizeCatalogPath
9
- } from "../../chunk-AS7FIJWP.js";
9
+ } from "../../chunk-2Y5FMKFS.js";
10
10
  import {
11
11
  coerceLimit
12
12
  } from "../../chunk-XQGLUQFM.js";
13
- import "../../chunk-GYRLVNJX.js";
13
+ import "../../chunk-YIU6G2D3.js";
14
14
  import {
15
15
  JsonOutputOptionsSchema,
16
16
  RequiredFilePathArgsSchema
17
17
  } from "../../chunk-25Q463MH.js";
18
18
  import {
19
19
  CommandRunner
20
- } from "../../chunk-WIEYHKQA.js";
21
- import "../../chunk-67FUBMNB.js";
20
+ } from "../../chunk-TC6YIS5Z.js";
21
+ import "../../chunk-X3UQB2CC.js";
22
22
  import "../../chunk-PZ5AY32C.js";
23
23
 
24
24
  // src/commands/knowledges/head.tsx
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  renderKnowledgesHelp
3
- } from "../../chunk-JNHW72SU.js";
3
+ } from "../../chunk-QCAHQE7Q.js";
4
4
  import {
5
5
  GlobalOptionsSchema
6
6
  } from "../../chunk-25Q463MH.js";
7
7
  import {
8
8
  CommandRunner
9
- } from "../../chunk-WIEYHKQA.js";
10
- import "../../chunk-67FUBMNB.js";
9
+ } from "../../chunk-TC6YIS5Z.js";
10
+ import "../../chunk-X3UQB2CC.js";
11
11
  import "../../chunk-PZ5AY32C.js";
12
12
 
13
13
  // src/commands/knowledges/index.tsx
@@ -1,24 +1,24 @@
1
1
  import {
2
2
  KnowTopicList
3
- } from "../../chunk-VMTXY4KQ.js";
3
+ } from "../../chunk-3VDQDFHG.js";
4
4
  import {
5
5
  createKnowledgesApi
6
- } from "../../chunk-U725ZHCI.js";
7
- import "../../chunk-AS7FIJWP.js";
6
+ } from "../../chunk-55IPOJ3R.js";
7
+ import "../../chunk-2Y5FMKFS.js";
8
8
  import {
9
9
  coerceLimit,
10
10
  formatJson,
11
11
  shouldPrintJson
12
12
  } from "../../chunk-XQGLUQFM.js";
13
- import "../../chunk-GYRLVNJX.js";
13
+ import "../../chunk-YIU6G2D3.js";
14
14
  import {
15
15
  LimitOptionsSchema,
16
16
  OptionalQueryArgsSchema
17
17
  } from "../../chunk-25Q463MH.js";
18
18
  import {
19
19
  CommandRunner
20
- } from "../../chunk-WIEYHKQA.js";
21
- import "../../chunk-67FUBMNB.js";
20
+ } from "../../chunk-TC6YIS5Z.js";
21
+ import "../../chunk-X3UQB2CC.js";
22
22
  import "../../chunk-PZ5AY32C.js";
23
23
 
24
24
  // src/features/knowledges/handlers/list.ts
@@ -2,28 +2,28 @@ import {
2
2
  compareFilesystemEntries,
3
3
  formatLongFilesystemEntryLine,
4
4
  formatShellFilesystemEntryName
5
- } from "../../chunk-YALWTRIP.js";
5
+ } from "../../chunk-LNFZT3R3.js";
6
6
  import {
7
7
  createKnowledgesApi
8
- } from "../../chunk-U725ZHCI.js";
8
+ } from "../../chunk-55IPOJ3R.js";
9
9
  import {
10
10
  formatCatalogPathForDisplay,
11
11
  normalizeFilesystemCatalogPath
12
- } from "../../chunk-AS7FIJWP.js";
12
+ } from "../../chunk-2Y5FMKFS.js";
13
13
  import {
14
14
  coerceLimit,
15
15
  formatJson,
16
16
  shouldPrintJson
17
17
  } from "../../chunk-XQGLUQFM.js";
18
- import "../../chunk-GYRLVNJX.js";
18
+ import "../../chunk-YIU6G2D3.js";
19
19
  import {
20
20
  LimitOptionsSchema,
21
21
  OptionalPathArgsSchema
22
22
  } from "../../chunk-25Q463MH.js";
23
23
  import {
24
24
  CommandRunner
25
- } from "../../chunk-WIEYHKQA.js";
26
- import "../../chunk-67FUBMNB.js";
25
+ } from "../../chunk-TC6YIS5Z.js";
26
+ import "../../chunk-X3UQB2CC.js";
27
27
  import "../../chunk-PZ5AY32C.js";
28
28
 
29
29
  // src/commands/knowledges/ls.tsx
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/commands/knowledges/ls.tsx","../../../src/features/knowledges/handlers/ls.ts"],"sourcesContent":["import { option } from \"pastel\";\nimport { z } from \"zod\";\n\nimport { LimitOptionsSchema, OptionalPathArgsSchema } from \"../../cli/options.js\";\nimport { runKnowLsCommand } from \"../../features/knowledges/handlers/ls.js\";\nimport type { KnowLsCommandOptions } from \"../../features/knowledges/knowledges-options.js\";\nimport { CommandRunner } from \"../../cli/command-runner.js\";\n\nexport const description = \"List remote catalog directory entries\";\nexport const args = OptionalPathArgsSchema;\nexport const options = LimitOptionsSchema.extend({\n long: z\n .boolean()\n .optional()\n .describe(\n option({\n alias: \"l\",\n description: \"Print type, path, and metadata fields\",\n })\n ),\n});\n\ntype LsCommandProps = {\n readonly args: [string?];\n readonly options: KnowLsCommandOptions;\n};\n\nexport default function LsCommand({ args, options }: LsCommandProps) {\n return <CommandRunner run={(output) => runKnowLsCommand(args[0], options, output)} />;\n}\n","import { coerceLimit, formatJson, shouldPrintJson } from \"../../../shared/command-utils.js\";\nimport type { CommandOutput } from \"../../../shared/output/types.js\";\nimport {\n compareFilesystemEntries,\n formatLongFilesystemEntryLine,\n formatShellFilesystemEntryName,\n} from \"../format/filesystem-format.js\";\nimport { createKnowledgesApi, type KnowCommandDependencies } from \"../knowledges-api.js\";\nimport { formatCatalogPathForDisplay, normalizeFilesystemCatalogPath } from \"../knowledges-input.js\";\nimport type { KnowLsCommandOptions } from \"../knowledges-options.js\";\n\nexport async function runKnowLsCommand(\n path: string | undefined,\n options: KnowLsCommandOptions,\n output: CommandOutput,\n dependencies?: KnowCommandDependencies\n): Promise<void> {\n const api = dependencies?.api ?? createKnowledgesApi(options);\n const response = await api.listDirectory({\n path: normalizeFilesystemCatalogPath(path ?? \"/\"),\n limit: coerceLimit(options.limit, 100, 1000),\n });\n\n if (shouldPrintJson(options)) {\n output.raw(formatJson(response.data));\n return;\n }\n\n const entries = [...response.data.entries].sort(compareFilesystemEntries);\n const lines = entries.map((entry) =>\n options.long === true\n ? formatLongFilesystemEntryLine(entry)\n : formatShellFilesystemEntryName(entry)\n );\n\n if (lines.length > 0) {\n output.raw(lines.join(\"\\n\"));\n } else {\n output.warning(`No entries under ${formatCatalogPathForDisplay(response.data.path)}.`);\n }\n\n if (response.data.truncated) {\n output.warning(`[truncated: ${response.data.total_entries} total entries]`);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,cAAc;AACvB,SAAS,SAAS;;;ACUlB,eAAsB,iBACpB,MACAA,UACA,QACA,cACe;AACf,QAAM,MAAM,cAAc,OAAO,oBAAoBA,QAAO;AAC5D,QAAM,WAAW,MAAM,IAAI,cAAc;AAAA,IACvC,MAAM,+BAA+B,QAAQ,GAAG;AAAA,IAChD,OAAO,YAAYA,SAAQ,OAAO,KAAK,GAAI;AAAA,EAC7C,CAAC;AAED,MAAI,gBAAgBA,QAAO,GAAG;AAC5B,WAAO,IAAI,WAAW,SAAS,IAAI,CAAC;AACpC;AAAA,EACF;AAEA,QAAM,UAAU,CAAC,GAAG,SAAS,KAAK,OAAO,EAAE,KAAK,wBAAwB;AACxE,QAAM,QAAQ,QAAQ;AAAA,IAAI,CAAC,UACzBA,SAAQ,SAAS,OACb,8BAA8B,KAAK,IACnC,+BAA+B,KAAK;AAAA,EAC1C;AAEA,MAAI,MAAM,SAAS,GAAG;AACpB,WAAO,IAAI,MAAM,KAAK,IAAI,CAAC;AAAA,EAC7B,OAAO;AACL,WAAO,QAAQ,oBAAoB,4BAA4B,SAAS,KAAK,IAAI,CAAC,GAAG;AAAA,EACvF;AAEA,MAAI,SAAS,KAAK,WAAW;AAC3B,WAAO,QAAQ,eAAe,SAAS,KAAK,aAAa,iBAAiB;AAAA,EAC5E;AACF;;;ADhBS;AApBF,IAAM,cAAc;AACpB,IAAM,OAAO;AACb,IAAM,UAAU,mBAAmB,OAAO;AAAA,EAC/C,MAAM,EACH,QAAQ,EACR,SAAS,EACT;AAAA,IACC,OAAO;AAAA,MACL,OAAO;AAAA,MACP,aAAa;AAAA,IACf,CAAC;AAAA,EACH;AACJ,CAAC;AAOc,SAAR,UAA2B,EAAE,MAAAC,OAAM,SAAAC,SAAQ,GAAmB;AACnE,SAAO,oBAAC,iBAAc,KAAK,CAAC,WAAW,iBAAiBD,MAAK,CAAC,GAAGC,UAAS,MAAM,GAAG;AACrF;","names":["options","args","options"]}
1
+ {"version":3,"sources":["../../../src/commands/knowledges/ls.tsx","../../../src/features/knowledges/handlers/ls.ts"],"sourcesContent":["import { option } from \"pastel\";\nimport { z } from \"zod\";\n\nimport { LimitOptionsSchema, OptionalPathArgsSchema } from \"../../cli/options.js\";\nimport { runKnowLsCommand } from \"../../features/knowledges/handlers/ls.js\";\nimport type { KnowLsCommandOptions } from \"../../features/knowledges/knowledges-options.js\";\nimport { CommandRunner } from \"../../cli/command-runner.js\";\n\nexport const description = \"List remote catalog directory entries\";\nexport const args = OptionalPathArgsSchema;\nexport const options = LimitOptionsSchema.extend({\n long: z\n .boolean()\n .optional()\n .describe(\n option({\n alias: \"l\",\n description: \"Print type, path, and metadata fields\",\n })\n ),\n});\n\ntype LsCommandProps = {\n readonly args: [string?];\n readonly options: KnowLsCommandOptions;\n};\n\nexport default function LsCommand({ args, options }: LsCommandProps) {\n return <CommandRunner run={(output) => runKnowLsCommand(args[0], options, output)} />;\n}\n","import { coerceLimit, formatJson, shouldPrintJson } from \"../../../shared/command-utils.js\";\nimport type { CommandOutput } from \"../../../shared/output/types.js\";\nimport {\n compareFilesystemEntries,\n formatLongFilesystemEntryLine,\n formatShellFilesystemEntryName,\n} from \"../format/filesystem-format.js\";\nimport { createKnowledgesApi, type KnowCommandDependencies } from \"../knowledges-api.js\";\nimport {\n formatCatalogPathForDisplay,\n normalizeFilesystemCatalogPath,\n} from \"../knowledges-input.js\";\nimport type { KnowLsCommandOptions } from \"../knowledges-options.js\";\n\nexport async function runKnowLsCommand(\n path: string | undefined,\n options: KnowLsCommandOptions,\n output: CommandOutput,\n dependencies?: KnowCommandDependencies\n): Promise<void> {\n const api = dependencies?.api ?? createKnowledgesApi(options);\n const response = await api.listDirectory({\n path: normalizeFilesystemCatalogPath(path ?? \"/\"),\n limit: coerceLimit(options.limit, 100, 1000),\n });\n\n if (shouldPrintJson(options)) {\n output.raw(formatJson(response.data));\n return;\n }\n\n const entries = [...response.data.entries].sort(compareFilesystemEntries);\n const lines = entries.map((entry) =>\n options.long === true\n ? formatLongFilesystemEntryLine(entry)\n : formatShellFilesystemEntryName(entry)\n );\n\n if (lines.length > 0) {\n output.raw(lines.join(\"\\n\"));\n } else {\n output.warning(`No entries under ${formatCatalogPathForDisplay(response.data.path)}.`);\n }\n\n if (response.data.truncated) {\n output.warning(`[truncated: ${response.data.total_entries} total entries]`);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,cAAc;AACvB,SAAS,SAAS;;;ACalB,eAAsB,iBACpB,MACAA,UACA,QACA,cACe;AACf,QAAM,MAAM,cAAc,OAAO,oBAAoBA,QAAO;AAC5D,QAAM,WAAW,MAAM,IAAI,cAAc;AAAA,IACvC,MAAM,+BAA+B,QAAQ,GAAG;AAAA,IAChD,OAAO,YAAYA,SAAQ,OAAO,KAAK,GAAI;AAAA,EAC7C,CAAC;AAED,MAAI,gBAAgBA,QAAO,GAAG;AAC5B,WAAO,IAAI,WAAW,SAAS,IAAI,CAAC;AACpC;AAAA,EACF;AAEA,QAAM,UAAU,CAAC,GAAG,SAAS,KAAK,OAAO,EAAE,KAAK,wBAAwB;AACxE,QAAM,QAAQ,QAAQ;AAAA,IAAI,CAAC,UACzBA,SAAQ,SAAS,OACb,8BAA8B,KAAK,IACnC,+BAA+B,KAAK;AAAA,EAC1C;AAEA,MAAI,MAAM,SAAS,GAAG;AACpB,WAAO,IAAI,MAAM,KAAK,IAAI,CAAC;AAAA,EAC7B,OAAO;AACL,WAAO,QAAQ,oBAAoB,4BAA4B,SAAS,KAAK,IAAI,CAAC,GAAG;AAAA,EACvF;AAEA,MAAI,SAAS,KAAK,WAAW;AAC3B,WAAO,QAAQ,eAAe,SAAS,KAAK,aAAa,iBAAiB;AAAA,EAC5E;AACF;;;ADnBS;AApBF,IAAM,cAAc;AACpB,IAAM,OAAO;AACb,IAAM,UAAU,mBAAmB,OAAO;AAAA,EAC/C,MAAM,EACH,QAAQ,EACR,SAAS,EACT;AAAA,IACC,OAAO;AAAA,MACL,OAAO;AAAA,MACP,aAAa;AAAA,IACf,CAAC;AAAA,EACH;AACJ,CAAC;AAOc,SAAR,UAA2B,EAAE,MAAAC,OAAM,SAAAC,SAAQ,GAAmB;AACnE,SAAO,oBAAC,iBAAc,KAAK,CAAC,WAAW,iBAAiBD,MAAK,CAAC,GAAGC,UAAS,MAAM,GAAG;AACrF;","names":["options","args","options"]}
@@ -1,26 +1,26 @@
1
1
  import {
2
2
  createKnowledgesApi
3
- } from "../../chunk-U725ZHCI.js";
3
+ } from "../../chunk-55IPOJ3R.js";
4
4
  import {
5
5
  normalizeCatalogPath
6
- } from "../../chunk-AS7FIJWP.js";
6
+ } from "../../chunk-2Y5FMKFS.js";
7
7
  import {
8
8
  coerceLimit,
9
9
  coerceOptionalNumber,
10
10
  formatJson,
11
11
  shouldPrintJson
12
12
  } from "../../chunk-XQGLUQFM.js";
13
- import "../../chunk-GYRLVNJX.js";
13
+ import "../../chunk-YIU6G2D3.js";
14
14
  import {
15
15
  JsonOutputOptionsSchema,
16
16
  RequiredFilePathArgsSchema
17
17
  } from "../../chunk-25Q463MH.js";
18
18
  import {
19
19
  CommandRunner
20
- } from "../../chunk-WIEYHKQA.js";
20
+ } from "../../chunk-TC6YIS5Z.js";
21
21
  import {
22
22
  resolveOutputFormat
23
- } from "../../chunk-67FUBMNB.js";
23
+ } from "../../chunk-X3UQB2CC.js";
24
24
  import "../../chunk-PZ5AY32C.js";
25
25
 
26
26
  // src/commands/knowledges/read.tsx
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/commands/knowledges/read.tsx","../../../src/features/knowledges/handlers/read.ts"],"sourcesContent":["import { option } from \"pastel\";\nimport { z } from \"zod\";\n\nimport { JsonOutputOptionsSchema, RequiredFilePathArgsSchema } from \"../../cli/options.js\";\nimport { runKnowReadCommand } from \"../../features/knowledges/handlers/read.js\";\nimport type { KnowReadCommandOptions } from \"../../features/knowledges/knowledges-options.js\";\nimport { CommandRunner } from \"../../cli/command-runner.js\";\n\nexport const description = \"Claude-style file read\";\nexport const args = RequiredFilePathArgsSchema;\nexport const options = JsonOutputOptionsSchema.extend({\n offset: z\n .number()\n .optional()\n .describe(\n option({\n description: \"Starting line offset\",\n valueDescription: \"n\",\n })\n ),\n limit: z\n .number()\n .optional()\n .describe(\n option({\n description: \"Maximum lines\",\n valueDescription: \"n\",\n })\n ),\n});\n\ntype ReadCommandProps = {\n readonly args: [string];\n readonly options: KnowReadCommandOptions;\n};\n\nexport default function ReadCommand({ args, options }: ReadCommandProps) {\n return <CommandRunner run={(output) => runKnowReadCommand(args[0], options, output)} />;\n}\n","import { coerceLimit, coerceOptionalNumber, formatJson, shouldPrintJson } from \"../../../shared/command-utils.js\";\nimport { resolveOutputFormat } from \"../../../shared/config.js\";\nimport type { CommandOutput } from \"../../../shared/output/types.js\";\nimport { createKnowledgesApi, type KnowCommandDependencies } from \"../knowledges-api.js\";\nimport { normalizeCatalogPath } from \"../knowledges-input.js\";\nimport type { KnowReadCommandOptions } from \"../knowledges-options.js\";\n\nexport async function runKnowReadCommand(\n filePath: string | undefined,\n options: KnowReadCommandOptions,\n output: CommandOutput,\n dependencies?: KnowCommandDependencies\n): Promise<void> {\n if (!filePath) {\n throw new Error(\"Missing file_path. Usage: cngkit knowledges read <file_path>\");\n }\n\n const api = dependencies?.api ?? createKnowledgesApi(options);\n const response = await api.read({\n filePath: normalizeCatalogPath(filePath),\n offset: coerceOptionalNumber(options.offset),\n limit: coerceLimit(options.limit, 200, 2000),\n });\n\n if (shouldPrintJson(options)) {\n output.raw(formatJson(response.data));\n return;\n }\n\n if (resolveOutputFormat() === \"markdown\" || !response.data.file_path.endsWith(\".md\")) {\n output.raw(response.data.content);\n } else {\n output.markdown(response.data.content);\n }\n\n if (response.data.truncated) {\n output.warning(\n `[truncated: showing ${response.data.limit} lines from offset ${response.data.offset} of ${response.data.total_lines}]`\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,cAAc;AACvB,SAAS,SAAS;;;ACMlB,eAAsB,mBACpB,UACAA,UACA,QACA,cACe;AACf,MAAI,CAAC,UAAU;AACb,UAAM,IAAI,MAAM,8DAA8D;AAAA,EAChF;AAEA,QAAM,MAAM,cAAc,OAAO,oBAAoBA,QAAO;AAC5D,QAAM,WAAW,MAAM,IAAI,KAAK;AAAA,IAC9B,UAAU,qBAAqB,QAAQ;AAAA,IACvC,QAAQ,qBAAqBA,SAAQ,MAAM;AAAA,IAC3C,OAAO,YAAYA,SAAQ,OAAO,KAAK,GAAI;AAAA,EAC7C,CAAC;AAED,MAAI,gBAAgBA,QAAO,GAAG;AAC5B,WAAO,IAAI,WAAW,SAAS,IAAI,CAAC;AACpC;AAAA,EACF;AAEA,MAAI,oBAAoB,MAAM,cAAc,CAAC,SAAS,KAAK,UAAU,SAAS,KAAK,GAAG;AACpF,WAAO,IAAI,SAAS,KAAK,OAAO;AAAA,EAClC,OAAO;AACL,WAAO,SAAS,SAAS,KAAK,OAAO;AAAA,EACvC;AAEA,MAAI,SAAS,KAAK,WAAW;AAC3B,WAAO;AAAA,MACL,uBAAuB,SAAS,KAAK,KAAK,sBAAsB,SAAS,KAAK,MAAM,OAAO,SAAS,KAAK,WAAW;AAAA,IACtH;AAAA,EACF;AACF;;;ADHS;AA7BF,IAAM,cAAc;AACpB,IAAM,OAAO;AACb,IAAM,UAAU,wBAAwB,OAAO;AAAA,EACpD,QAAQ,EACL,OAAO,EACP,SAAS,EACT;AAAA,IACC,OAAO;AAAA,MACL,aAAa;AAAA,MACb,kBAAkB;AAAA,IACpB,CAAC;AAAA,EACH;AAAA,EACF,OAAO,EACJ,OAAO,EACP,SAAS,EACT;AAAA,IACC,OAAO;AAAA,MACL,aAAa;AAAA,MACb,kBAAkB;AAAA,IACpB,CAAC;AAAA,EACH;AACJ,CAAC;AAOc,SAAR,YAA6B,EAAE,MAAAC,OAAM,SAAAC,SAAQ,GAAqB;AACvE,SAAO,oBAAC,iBAAc,KAAK,CAAC,WAAW,mBAAmBD,MAAK,CAAC,GAAGC,UAAS,MAAM,GAAG;AACvF;","names":["options","args","options"]}
1
+ {"version":3,"sources":["../../../src/commands/knowledges/read.tsx","../../../src/features/knowledges/handlers/read.ts"],"sourcesContent":["import { option } from \"pastel\";\nimport { z } from \"zod\";\n\nimport { JsonOutputOptionsSchema, RequiredFilePathArgsSchema } from \"../../cli/options.js\";\nimport { runKnowReadCommand } from \"../../features/knowledges/handlers/read.js\";\nimport type { KnowReadCommandOptions } from \"../../features/knowledges/knowledges-options.js\";\nimport { CommandRunner } from \"../../cli/command-runner.js\";\n\nexport const description = \"Claude-style file read\";\nexport const args = RequiredFilePathArgsSchema;\nexport const options = JsonOutputOptionsSchema.extend({\n offset: z\n .number()\n .optional()\n .describe(\n option({\n description: \"Starting line offset\",\n valueDescription: \"n\",\n })\n ),\n limit: z\n .number()\n .optional()\n .describe(\n option({\n description: \"Maximum lines\",\n valueDescription: \"n\",\n })\n ),\n});\n\ntype ReadCommandProps = {\n readonly args: [string];\n readonly options: KnowReadCommandOptions;\n};\n\nexport default function ReadCommand({ args, options }: ReadCommandProps) {\n return <CommandRunner run={(output) => runKnowReadCommand(args[0], options, output)} />;\n}\n","import {\n coerceLimit,\n coerceOptionalNumber,\n formatJson,\n shouldPrintJson,\n} from \"../../../shared/command-utils.js\";\nimport { resolveOutputFormat } from \"../../../shared/config.js\";\nimport type { CommandOutput } from \"../../../shared/output/types.js\";\nimport { createKnowledgesApi, type KnowCommandDependencies } from \"../knowledges-api.js\";\nimport { normalizeCatalogPath } from \"../knowledges-input.js\";\nimport type { KnowReadCommandOptions } from \"../knowledges-options.js\";\n\nexport async function runKnowReadCommand(\n filePath: string | undefined,\n options: KnowReadCommandOptions,\n output: CommandOutput,\n dependencies?: KnowCommandDependencies\n): Promise<void> {\n if (!filePath) {\n throw new Error(\"Missing file_path. Usage: cngkit knowledges read <file_path>\");\n }\n\n const api = dependencies?.api ?? createKnowledgesApi(options);\n const response = await api.read({\n filePath: normalizeCatalogPath(filePath),\n offset: coerceOptionalNumber(options.offset),\n limit: coerceLimit(options.limit, 200, 2000),\n });\n\n if (shouldPrintJson(options)) {\n output.raw(formatJson(response.data));\n return;\n }\n\n if (resolveOutputFormat() === \"markdown\" || !response.data.file_path.endsWith(\".md\")) {\n output.raw(response.data.content);\n } else {\n output.markdown(response.data.content);\n }\n\n if (response.data.truncated) {\n output.warning(\n `[truncated: showing ${response.data.limit} lines from offset ${response.data.offset} of ${response.data.total_lines}]`\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,cAAc;AACvB,SAAS,SAAS;;;ACWlB,eAAsB,mBACpB,UACAA,UACA,QACA,cACe;AACf,MAAI,CAAC,UAAU;AACb,UAAM,IAAI,MAAM,8DAA8D;AAAA,EAChF;AAEA,QAAM,MAAM,cAAc,OAAO,oBAAoBA,QAAO;AAC5D,QAAM,WAAW,MAAM,IAAI,KAAK;AAAA,IAC9B,UAAU,qBAAqB,QAAQ;AAAA,IACvC,QAAQ,qBAAqBA,SAAQ,MAAM;AAAA,IAC3C,OAAO,YAAYA,SAAQ,OAAO,KAAK,GAAI;AAAA,EAC7C,CAAC;AAED,MAAI,gBAAgBA,QAAO,GAAG;AAC5B,WAAO,IAAI,WAAW,SAAS,IAAI,CAAC;AACpC;AAAA,EACF;AAEA,MAAI,oBAAoB,MAAM,cAAc,CAAC,SAAS,KAAK,UAAU,SAAS,KAAK,GAAG;AACpF,WAAO,IAAI,SAAS,KAAK,OAAO;AAAA,EAClC,OAAO;AACL,WAAO,SAAS,SAAS,KAAK,OAAO;AAAA,EACvC;AAEA,MAAI,SAAS,KAAK,WAAW;AAC3B,WAAO;AAAA,MACL,uBAAuB,SAAS,KAAK,KAAK,sBAAsB,SAAS,KAAK,MAAM,OAAO,SAAS,KAAK,WAAW;AAAA,IACtH;AAAA,EACF;AACF;;;ADRS;AA7BF,IAAM,cAAc;AACpB,IAAM,OAAO;AACb,IAAM,UAAU,wBAAwB,OAAO;AAAA,EACpD,QAAQ,EACL,OAAO,EACP,SAAS,EACT;AAAA,IACC,OAAO;AAAA,MACL,aAAa;AAAA,MACb,kBAAkB;AAAA,IACpB,CAAC;AAAA,EACH;AAAA,EACF,OAAO,EACJ,OAAO,EACP,SAAS,EACT;AAAA,IACC,OAAO;AAAA,MACL,aAAa;AAAA,MACb,kBAAkB;AAAA,IACpB,CAAC;AAAA,EACH;AACJ,CAAC;AAOc,SAAR,YAA6B,EAAE,MAAAC,OAAM,SAAAC,SAAQ,GAAqB;AACvE,SAAO,oBAAC,iBAAc,KAAK,CAAC,WAAW,mBAAmBD,MAAK,CAAC,GAAGC,UAAS,MAAM,GAAG;AACvF;","names":["options","args","options"]}
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  formatCatalogPathForDisplay,
3
3
  normalizeFilesystemCatalogPath
4
- } from "../../chunk-AS7FIJWP.js";
4
+ } from "../../chunk-2Y5FMKFS.js";
5
5
  import {
6
6
  formatJson,
7
7
  shouldPrintJson
@@ -12,8 +12,8 @@ import {
12
12
  } from "../../chunk-25Q463MH.js";
13
13
  import {
14
14
  CommandRunner
15
- } from "../../chunk-WIEYHKQA.js";
16
- import "../../chunk-67FUBMNB.js";
15
+ } from "../../chunk-TC6YIS5Z.js";
16
+ import "../../chunk-X3UQB2CC.js";
17
17
  import "../../chunk-PZ5AY32C.js";
18
18
 
19
19
  // src/features/knowledges/handlers/realpath.ts
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/features/knowledges/handlers/realpath.ts","../../../src/commands/knowledges/realpath.tsx"],"sourcesContent":["import { formatJson, shouldPrintJson } from \"../../../shared/command-utils.js\";\nimport type { CommandOutput } from \"../../../shared/output/types.js\";\nimport { formatCatalogPathForDisplay, normalizeFilesystemCatalogPath } from \"../knowledges-input.js\";\nimport type { KnowRealpathCommandOptions } from \"../knowledges-options.js\";\n\nexport async function runKnowRealpathCommand(\n path: string | undefined,\n options: KnowRealpathCommandOptions,\n output: CommandOutput\n): Promise<void> {\n if (!path) {\n throw new Error(\"Missing path. Usage: cngkit knowledges realpath <path>\");\n }\n\n const resolvedPath = formatCatalogPathForDisplay(normalizeFilesystemCatalogPath(path));\n if (shouldPrintJson(options)) {\n output.raw(formatJson({ path: resolvedPath }));\n return;\n }\n\n output.raw(resolvedPath);\n}\n","import { JsonOutputOptionsSchema, RequiredCatalogPathArgsSchema } from \"../../cli/options.js\";\nimport { runKnowRealpathCommand } from \"../../features/knowledges/handlers/realpath.js\";\nimport type { KnowRealpathCommandOptions } from \"../../features/knowledges/knowledges-options.js\";\nimport { CommandRunner } from \"../../cli/command-runner.js\";\n\nexport const description = \"Normalize a topics-root catalog path\";\nexport const args = RequiredCatalogPathArgsSchema;\nexport const options = JsonOutputOptionsSchema;\n\ntype RealpathCommandProps = {\n readonly args: [string];\n readonly options: KnowRealpathCommandOptions;\n};\n\nexport default function RealpathCommand({ args, options }: RealpathCommandProps) {\n return <CommandRunner run={(output) => runKnowRealpathCommand(args[0], options, output)} />;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAKA,eAAsB,uBACpB,MACAA,UACA,QACe;AACf,MAAI,CAAC,MAAM;AACT,UAAM,IAAI,MAAM,wDAAwD;AAAA,EAC1E;AAEA,QAAM,eAAe,4BAA4B,+BAA+B,IAAI,CAAC;AACrF,MAAI,gBAAgBA,QAAO,GAAG;AAC5B,WAAO,IAAI,WAAW,EAAE,MAAM,aAAa,CAAC,CAAC;AAC7C;AAAA,EACF;AAEA,SAAO,IAAI,YAAY;AACzB;;;ACNS;AAVF,IAAM,cAAc;AACpB,IAAM,OAAO;AACb,IAAM,UAAU;AAOR,SAAR,gBAAiC,EAAE,MAAAC,OAAM,SAAAC,SAAQ,GAAyB;AAC/E,SAAO,oBAAC,iBAAc,KAAK,CAAC,WAAW,uBAAuBD,MAAK,CAAC,GAAGC,UAAS,MAAM,GAAG;AAC3F;","names":["options","args","options"]}
1
+ {"version":3,"sources":["../../../src/features/knowledges/handlers/realpath.ts","../../../src/commands/knowledges/realpath.tsx"],"sourcesContent":["import { formatJson, shouldPrintJson } from \"../../../shared/command-utils.js\";\nimport type { CommandOutput } from \"../../../shared/output/types.js\";\nimport {\n formatCatalogPathForDisplay,\n normalizeFilesystemCatalogPath,\n} from \"../knowledges-input.js\";\nimport type { KnowRealpathCommandOptions } from \"../knowledges-options.js\";\n\nexport async function runKnowRealpathCommand(\n path: string | undefined,\n options: KnowRealpathCommandOptions,\n output: CommandOutput\n): Promise<void> {\n if (!path) {\n throw new Error(\"Missing path. Usage: cngkit knowledges realpath <path>\");\n }\n\n const resolvedPath = formatCatalogPathForDisplay(normalizeFilesystemCatalogPath(path));\n if (shouldPrintJson(options)) {\n output.raw(formatJson({ path: resolvedPath }));\n return;\n }\n\n output.raw(resolvedPath);\n}\n","import { JsonOutputOptionsSchema, RequiredCatalogPathArgsSchema } from \"../../cli/options.js\";\nimport { runKnowRealpathCommand } from \"../../features/knowledges/handlers/realpath.js\";\nimport type { KnowRealpathCommandOptions } from \"../../features/knowledges/knowledges-options.js\";\nimport { CommandRunner } from \"../../cli/command-runner.js\";\n\nexport const description = \"Normalize a topics-root catalog path\";\nexport const args = RequiredCatalogPathArgsSchema;\nexport const options = JsonOutputOptionsSchema;\n\ntype RealpathCommandProps = {\n readonly args: [string];\n readonly options: KnowRealpathCommandOptions;\n};\n\nexport default function RealpathCommand({ args, options }: RealpathCommandProps) {\n return <CommandRunner run={(output) => runKnowRealpathCommand(args[0], options, output)} />;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAQA,eAAsB,uBACpB,MACAA,UACA,QACe;AACf,MAAI,CAAC,MAAM;AACT,UAAM,IAAI,MAAM,wDAAwD;AAAA,EAC1E;AAEA,QAAM,eAAe,4BAA4B,+BAA+B,IAAI,CAAC;AACrF,MAAI,gBAAgBA,QAAO,GAAG;AAC5B,WAAO,IAAI,WAAW,EAAE,MAAM,aAAa,CAAC,CAAC;AAC7C;AAAA,EACF;AAEA,SAAO,IAAI,YAAY;AACzB;;;ACTS;AAVF,IAAM,cAAc;AACpB,IAAM,OAAO;AACb,IAAM,UAAU;AAOR,SAAR,gBAAiC,EAAE,MAAAC,OAAM,SAAAC,SAAQ,GAAyB;AAC/E,SAAO,oBAAC,iBAAc,KAAK,CAAC,WAAW,uBAAuBD,MAAK,CAAC,GAAGC,UAAS,MAAM,GAAG;AAC3F;","names":["options","args","options"]}
@@ -1,24 +1,24 @@
1
1
  import {
2
2
  KnowSearchResults
3
- } from "../../chunk-VMTXY4KQ.js";
3
+ } from "../../chunk-3VDQDFHG.js";
4
4
  import {
5
5
  createKnowledgesApi
6
- } from "../../chunk-U725ZHCI.js";
7
- import "../../chunk-AS7FIJWP.js";
6
+ } from "../../chunk-55IPOJ3R.js";
7
+ import "../../chunk-2Y5FMKFS.js";
8
8
  import {
9
9
  coerceLimit,
10
10
  formatJson,
11
11
  shouldPrintJson
12
12
  } from "../../chunk-XQGLUQFM.js";
13
- import "../../chunk-GYRLVNJX.js";
13
+ import "../../chunk-YIU6G2D3.js";
14
14
  import {
15
15
  LimitOptionsSchema,
16
16
  RequiredQueryArgsSchema
17
17
  } from "../../chunk-25Q463MH.js";
18
18
  import {
19
19
  CommandRunner
20
- } from "../../chunk-WIEYHKQA.js";
21
- import "../../chunk-67FUBMNB.js";
20
+ } from "../../chunk-TC6YIS5Z.js";
21
+ import "../../chunk-X3UQB2CC.js";
22
22
  import "../../chunk-PZ5AY32C.js";
23
23
 
24
24
  // src/features/knowledges/handlers/search.ts
@@ -1,25 +1,25 @@
1
1
  import {
2
2
  formatFilesystemStat
3
- } from "../../chunk-YALWTRIP.js";
3
+ } from "../../chunk-LNFZT3R3.js";
4
4
  import {
5
5
  createKnowledgesApi
6
- } from "../../chunk-U725ZHCI.js";
6
+ } from "../../chunk-55IPOJ3R.js";
7
7
  import {
8
8
  normalizeFilesystemCatalogPath
9
- } from "../../chunk-AS7FIJWP.js";
9
+ } from "../../chunk-2Y5FMKFS.js";
10
10
  import {
11
11
  formatJson,
12
12
  shouldPrintJson
13
13
  } from "../../chunk-XQGLUQFM.js";
14
- import "../../chunk-GYRLVNJX.js";
14
+ import "../../chunk-YIU6G2D3.js";
15
15
  import {
16
16
  JsonOutputOptionsSchema,
17
17
  RequiredCatalogPathArgsSchema
18
18
  } from "../../chunk-25Q463MH.js";
19
19
  import {
20
20
  CommandRunner
21
- } from "../../chunk-WIEYHKQA.js";
22
- import "../../chunk-67FUBMNB.js";
21
+ } from "../../chunk-TC6YIS5Z.js";
22
+ import "../../chunk-X3UQB2CC.js";
23
23
  import "../../chunk-PZ5AY32C.js";
24
24
 
25
25
  // src/features/knowledges/handlers/stat.ts
@@ -1,22 +1,22 @@
1
1
  import {
2
2
  KnowCatalogSummary
3
- } from "../../chunk-VMTXY4KQ.js";
3
+ } from "../../chunk-3VDQDFHG.js";
4
4
  import {
5
5
  createKnowledgesApi
6
- } from "../../chunk-U725ZHCI.js";
7
- import "../../chunk-AS7FIJWP.js";
6
+ } from "../../chunk-55IPOJ3R.js";
7
+ import "../../chunk-2Y5FMKFS.js";
8
8
  import {
9
9
  formatJson,
10
10
  shouldPrintJson
11
11
  } from "../../chunk-XQGLUQFM.js";
12
- import "../../chunk-GYRLVNJX.js";
12
+ import "../../chunk-YIU6G2D3.js";
13
13
  import {
14
14
  JsonOutputOptionsSchema
15
15
  } from "../../chunk-25Q463MH.js";
16
16
  import {
17
17
  CommandRunner
18
- } from "../../chunk-WIEYHKQA.js";
19
- import "../../chunk-67FUBMNB.js";
18
+ } from "../../chunk-TC6YIS5Z.js";
19
+ import "../../chunk-X3UQB2CC.js";
20
20
  import "../../chunk-PZ5AY32C.js";
21
21
 
22
22
  // src/features/knowledges/handlers/status.ts
@@ -1,24 +1,24 @@
1
1
  import {
2
2
  outputRawContent
3
- } from "../../chunk-BRFWVQI4.js";
3
+ } from "../../chunk-LC4CYVCT.js";
4
4
  import {
5
5
  createKnowledgesApi
6
- } from "../../chunk-U725ZHCI.js";
6
+ } from "../../chunk-55IPOJ3R.js";
7
7
  import {
8
8
  normalizeCatalogPath
9
- } from "../../chunk-AS7FIJWP.js";
9
+ } from "../../chunk-2Y5FMKFS.js";
10
10
  import {
11
11
  coerceLimit
12
12
  } from "../../chunk-XQGLUQFM.js";
13
- import "../../chunk-GYRLVNJX.js";
13
+ import "../../chunk-YIU6G2D3.js";
14
14
  import {
15
15
  JsonOutputOptionsSchema,
16
16
  RequiredFilePathArgsSchema
17
17
  } from "../../chunk-25Q463MH.js";
18
18
  import {
19
19
  CommandRunner
20
- } from "../../chunk-WIEYHKQA.js";
21
- import "../../chunk-67FUBMNB.js";
20
+ } from "../../chunk-TC6YIS5Z.js";
21
+ import "../../chunk-X3UQB2CC.js";
22
22
  import "../../chunk-PZ5AY32C.js";
23
23
 
24
24
  // src/commands/knowledges/tail.tsx
@@ -1,26 +1,26 @@
1
1
  import {
2
2
  formatFilesystemTree
3
- } from "../../chunk-YALWTRIP.js";
3
+ } from "../../chunk-LNFZT3R3.js";
4
4
  import {
5
5
  createKnowledgesApi
6
- } from "../../chunk-U725ZHCI.js";
6
+ } from "../../chunk-55IPOJ3R.js";
7
7
  import {
8
8
  normalizeFilesystemCatalogPath
9
- } from "../../chunk-AS7FIJWP.js";
9
+ } from "../../chunk-2Y5FMKFS.js";
10
10
  import {
11
11
  coerceLimit,
12
12
  formatJson,
13
13
  shouldPrintJson
14
14
  } from "../../chunk-XQGLUQFM.js";
15
- import "../../chunk-GYRLVNJX.js";
15
+ import "../../chunk-YIU6G2D3.js";
16
16
  import {
17
17
  JsonOutputOptionsSchema,
18
18
  OptionalPathArgsSchema
19
19
  } from "../../chunk-25Q463MH.js";
20
20
  import {
21
21
  CommandRunner
22
- } from "../../chunk-WIEYHKQA.js";
23
- import "../../chunk-67FUBMNB.js";
22
+ } from "../../chunk-TC6YIS5Z.js";
23
+ import "../../chunk-X3UQB2CC.js";
24
24
  import "../../chunk-PZ5AY32C.js";
25
25
 
26
26
  // src/commands/knowledges/tree.tsx
@@ -3,10 +3,10 @@ import {
3
3
  } from "../chunk-25Q463MH.js";
4
4
  import {
5
5
  CommandRunner
6
- } from "../chunk-WIEYHKQA.js";
6
+ } from "../chunk-TC6YIS5Z.js";
7
7
  import {
8
8
  resolveApiBaseUrl
9
- } from "../chunk-67FUBMNB.js";
9
+ } from "../chunk-X3UQB2CC.js";
10
10
  import "../chunk-PZ5AY32C.js";
11
11
 
12
12
  // src/shared/browser.ts
@@ -4,8 +4,8 @@ import {
4
4
  } from "../chunk-25Q463MH.js";
5
5
  import {
6
6
  CommandRunner
7
- } from "../chunk-WIEYHKQA.js";
8
- import "../chunk-67FUBMNB.js";
7
+ } from "../chunk-TC6YIS5Z.js";
8
+ import "../chunk-X3UQB2CC.js";
9
9
  import "../chunk-PZ5AY32C.js";
10
10
 
11
11
  // src/commands/scrub.tsx
@@ -115,18 +115,21 @@ function ScrubFindingsReport({ findings }) {
115
115
  findings.map((finding, index) => {
116
116
  const location = finding.line ? `${finding.filePath}:${finding.line}` : finding.filePath;
117
117
  const status = finding.verified ? "verified" : "unverified";
118
- return /* @__PURE__ */ jsxs(Text, { children: [
119
- /* @__PURE__ */ jsx(Text, { color: "cyan", children: "- " }),
120
- /* @__PURE__ */ jsx(Text, { children: location }),
121
- /* @__PURE__ */ jsxs(Text, { dimColor: true, children: [
122
- " ",
123
- finding.detectorName
124
- ] }),
125
- /* @__PURE__ */ jsxs(Text, { color: finding.verified ? "green" : "yellow", children: [
126
- " ",
127
- status
128
- ] })
129
- ] }, `${finding.filePath}-${finding.line ?? 0}-${finding.detectorName}-${index}`);
118
+ return (
119
+ // biome-ignore lint/suspicious/noArrayIndexKey: Findings can have duplicate filePaths; index is the simplest stable key
120
+ /* @__PURE__ */ jsxs(Text, { children: [
121
+ /* @__PURE__ */ jsx(Text, { color: "cyan", children: "- " }),
122
+ /* @__PURE__ */ jsx(Text, { children: location }),
123
+ /* @__PURE__ */ jsxs(Text, { dimColor: true, children: [
124
+ " ",
125
+ finding.detectorName
126
+ ] }),
127
+ /* @__PURE__ */ jsxs(Text, { color: finding.verified ? "green" : "yellow", children: [
128
+ " ",
129
+ status
130
+ ] })
131
+ ] }, index)
132
+ );
130
133
  })
131
134
  ] });
132
135
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/commands/scrub.tsx","../../src/features/scrub/run-scrub-command.ts","../../src/features/scrub/masker.ts","../../src/features/scrub/scrub-output.tsx","../../src/features/scrub/trufflehog.ts","../../src/features/scrub/findings.ts"],"sourcesContent":["import { option } from \"pastel\";\nimport { z } from \"zod\";\n\nimport { GlobalOptionsSchema, OptionalPathArgsSchema } from \"../cli/options.js\";\nimport { runScrubCommand, type ScrubCommandOptions } from \"../features/scrub/run-scrub-command.js\";\nimport { CommandRunner } from \"../cli/command-runner.js\";\n\nexport const description = \"Scan for secrets with TruffleHog and optionally mask them inline\";\nexport const args = OptionalPathArgsSchema;\nexport const options = GlobalOptionsSchema.extend({\n mask: z\n .boolean()\n .optional()\n .describe(\n option({\n description: \"Compatibility alias for inline scrubbing; --yes is still required\",\n })\n ),\n yes: z\n .boolean()\n .optional()\n .describe(\n option({\n description: \"Confirm and run inline scrubbing\",\n })\n ),\n});\n\ntype ScrubCommandProps = {\n readonly args: z.infer<typeof args>;\n readonly options: ScrubCommandOptions;\n};\n\nexport default function ScrubCommand({ args, options }: ScrubCommandProps) {\n return <CommandRunner run={(output) => runScrubCommand(args[0], options, output)} />;\n}\n","import process from \"node:process\";\nimport { createElement } from \"react\";\n\nimport type { GlobalCommandOptions } from \"../../shared/config.js\";\nimport type { CommandOutput } from \"../../shared/output/types.js\";\nimport type { ScrubFinding } from \"./findings.js\";\nimport { scrubFindingsInline } from \"./masker.js\";\nimport { ScrubFindingsReport } from \"./scrub-output.js\";\nimport { scanFilesystemWithTruffleHog } from \"./trufflehog.js\";\n\nexport type ScrubCommandOptions = GlobalCommandOptions & {\n mask?: boolean;\n yes?: boolean;\n};\n\nexport type ScrubCommandDependencies = {\n scanFilesystem(targetPath: string): Promise<ScrubFinding[]>;\n};\n\nexport async function runScrubCommand(\n targetPath: string | undefined,\n options: ScrubCommandOptions,\n output: CommandOutput,\n dependencies?: ScrubCommandDependencies\n): Promise<void> {\n const scrubTargetPath = targetPath ?? \".\";\n const scanFilesystem =\n dependencies?.scanFilesystem ??\n ((scanTargetPath: string) =>\n scanFilesystemWithTruffleHog(scanTargetPath, {\n cwd: process.cwd(),\n }));\n const findings = await scanFilesystem(scrubTargetPath);\n\n if (findings.length === 0) {\n output.success(\"No secrets found.\");\n return;\n }\n\n output.component(createElement(ScrubFindingsReport, { findings }));\n\n if (!options.yes) {\n if (options.mask) {\n throw new Error(\"Inline scrubbing rewrites files. Re-run with --yes to continue.\");\n }\n\n output.warning(\"Report only. Re-run with --yes to scrub files inline.\");\n return;\n }\n\n const result = await scrubFindingsInline(scrubTargetPath, findings);\n output.success(\n `Masked ${result.replacements} secret${result.replacements === 1 ? \"\" : \"s\"} in ${\n result.filesChanged\n } file${result.filesChanged === 1 ? \"\" : \"s\"}.`\n );\n\n if (result.skippedFindings > 0) {\n output.warning(`Skipped ${result.skippedFindings} finding(s) outside the scrub root.`);\n }\n}\n","import fs from \"node:fs/promises\";\nimport path from \"node:path\";\n\nimport type { ScrubFinding } from \"./findings.js\";\n\nexport type InlineScrubResult = {\n filesChanged: number;\n replacements: number;\n skippedFindings: number;\n};\n\nexport async function scrubFindingsInline(\n targetPath: string,\n findings: ScrubFinding[]\n): Promise<InlineScrubResult> {\n const target = await resolveScrubTarget(targetPath);\n const findingsByFile = groupFindingsBySafePath(target, findings);\n let filesChanged = 0;\n let replacements = 0;\n\n for (const [absolutePath, fileFindings] of findingsByFile.safeFindingsByPath) {\n const originalContent = await fs.readFile(absolutePath, \"utf8\");\n let scrubbedContent = originalContent;\n let fileReplacements = 0;\n\n for (const finding of fileFindings) {\n const placeholder = formatSecretPlaceholder(finding);\n const nextContent = scrubbedContent.split(finding.rawSecret).join(placeholder);\n if (nextContent !== scrubbedContent) {\n fileReplacements += countOccurrences(scrubbedContent, finding.rawSecret);\n scrubbedContent = nextContent;\n }\n }\n\n if (scrubbedContent !== originalContent) {\n await fs.writeFile(absolutePath, scrubbedContent);\n filesChanged += 1;\n replacements += fileReplacements;\n }\n }\n\n return {\n filesChanged,\n replacements,\n skippedFindings: findingsByFile.skippedFindings,\n };\n}\n\nexport function formatSecretPlaceholder(finding: ScrubFinding): string {\n return `[CNGKIT_SECRET:${sanitizePlaceholderPart(finding.detectorName)}:${\n finding.verified ? \"verified\" : \"unverified\"\n }]`;\n}\n\nfunction groupFindingsBySafePath(\n target: ScrubTarget,\n findings: ScrubFinding[]\n): {\n safeFindingsByPath: Map<string, ScrubFinding[]>;\n skippedFindings: number;\n} {\n const safeFindingsByPath = new Map<string, ScrubFinding[]>();\n let skippedFindings = 0;\n\n for (const finding of findings) {\n const absolutePath = resolveSafeFindingPath(target, finding.filePath);\n if (!absolutePath) {\n skippedFindings += 1;\n continue;\n }\n\n const fileFindings = safeFindingsByPath.get(absolutePath) ?? [];\n fileFindings.push(finding);\n safeFindingsByPath.set(absolutePath, fileFindings);\n }\n\n return { safeFindingsByPath, skippedFindings };\n}\n\ntype ScrubTarget = {\n rootDir: string;\n allowedFilePath?: string;\n};\n\nasync function resolveScrubTarget(targetPath: string): Promise<ScrubTarget> {\n const absoluteTargetPath = path.resolve(targetPath);\n const stat = await fs.stat(absoluteTargetPath);\n\n if (stat.isFile()) {\n return {\n rootDir: path.dirname(absoluteTargetPath),\n allowedFilePath: absoluteTargetPath,\n };\n }\n\n return {\n rootDir: absoluteTargetPath,\n };\n}\n\nfunction resolveSafeFindingPath(\n target: ScrubTarget,\n findingFilePath: string\n): string | undefined {\n const absolutePath = path.isAbsolute(findingFilePath)\n ? path.resolve(findingFilePath)\n : path.resolve(target.rootDir, findingFilePath);\n\n if (target.allowedFilePath) {\n return absolutePath === target.allowedFilePath ? absolutePath : undefined;\n }\n\n const normalizedRoot = `${path.resolve(target.rootDir)}${path.sep}`;\n\n if (absolutePath === path.resolve(target.rootDir) || absolutePath.startsWith(normalizedRoot)) {\n return absolutePath;\n }\n\n return undefined;\n}\n\nfunction countOccurrences(value: string, search: string): number {\n if (!search) {\n return 0;\n }\n\n return value.split(search).length - 1;\n}\n\nfunction sanitizePlaceholderPart(value: string): string {\n return value.replace(/[^A-Za-z0-9_-]+/g, \"-\").replace(/^-+|-+$/g, \"\") || \"Unknown\";\n}\n","import { Box, Text } from \"ink\";\n\nimport type { ScrubFinding } from \"./findings.js\";\n\nexport function ScrubFindingsReport({ findings }: { readonly findings: readonly ScrubFinding[] }) {\n return (\n <Box flexDirection=\"column\">\n <Text color=\"yellow\" bold>\n Found {findings.length} possible secret{findings.length === 1 ? \"\" : \"s\"}:\n </Text>\n {findings.map((finding, index) => {\n const location = finding.line ? `${finding.filePath}:${finding.line}` : finding.filePath;\n const status = finding.verified ? \"verified\" : \"unverified\";\n\n return (\n <Text key={`${finding.filePath}-${finding.line ?? 0}-${finding.detectorName}-${index}`}>\n <Text color=\"cyan\">- </Text>\n <Text>{location}</Text>\n <Text dimColor> {finding.detectorName}</Text>\n <Text color={finding.verified ? \"green\" : \"yellow\"}> {status}</Text>\n </Text>\n );\n })}\n </Box>\n );\n}\n","import { spawn } from \"node:child_process\";\nimport path from \"node:path\";\n\nimport { parseTruffleHogJsonLines, type ScrubFinding } from \"./findings.js\";\n\nexport type TruffleHogScanOptions = {\n cwd: string;\n};\n\nexport async function scanFilesystemWithTruffleHog(\n targetPath: string,\n options: TruffleHogScanOptions\n): Promise<ScrubFinding[]> {\n const absoluteTargetPath = path.resolve(options.cwd, targetPath);\n const { stdout } = await runTruffleHog([\n \"filesystem\",\n absoluteTargetPath,\n \"--json\",\n \"--no-update\",\n \"--force-skip-binaries\",\n \"--force-skip-archives\",\n ]);\n\n return parseTruffleHogJsonLines(stdout);\n}\n\nfunction runTruffleHog(args: string[]): Promise<{ stdout: string; stderr: string }> {\n return new Promise((resolve, reject) => {\n const child = spawn(\"trufflehog\", args, {\n stdio: [\"ignore\", \"pipe\", \"pipe\"],\n });\n const stdoutChunks: Buffer[] = [];\n const stderrChunks: Buffer[] = [];\n\n child.stdout.on(\"data\", (chunk: Buffer) => {\n stdoutChunks.push(chunk);\n });\n child.stderr.on(\"data\", (chunk: Buffer) => {\n stderrChunks.push(chunk);\n });\n child.on(\"error\", (error: NodeJS.ErrnoException) => {\n if (error.code === \"ENOENT\") {\n reject(\n new Error(\n \"TruffleHog is not installed. Install it with `brew install trufflehog` or see https://github.com/trufflesecurity/trufflehog.\"\n )\n );\n return;\n }\n\n reject(error);\n });\n child.on(\"close\", (exitCode) => {\n const stdout = Buffer.concat(stdoutChunks).toString(\"utf8\");\n const stderr = Buffer.concat(stderrChunks).toString(\"utf8\");\n\n if (exitCode && exitCode !== 0) {\n reject(new Error(`TruffleHog scan failed with exit code ${exitCode}: ${stderr.trim()}`));\n return;\n }\n\n resolve({ stdout, stderr });\n });\n });\n}\n","export type ScrubFinding = {\n detectorName: string;\n filePath: string;\n line?: number;\n rawSecret: string;\n redactedSecret: string;\n verified: boolean;\n};\n\ntype JsonRecord = Record<string, unknown>;\n\nexport function parseTruffleHogJsonLines(output: string): ScrubFinding[] {\n const findings: ScrubFinding[] = [];\n\n for (const line of output.split(/\\r?\\n/)) {\n const trimmedLine = line.trim();\n if (!trimmedLine.startsWith(\"{\")) {\n continue;\n }\n\n const parsedLine = parseJsonRecord(trimmedLine);\n if (!parsedLine) {\n continue;\n }\n\n const finding = parseTruffleHogFinding(parsedLine);\n if (finding) {\n findings.push(finding);\n }\n }\n\n return findings;\n}\n\nfunction parseTruffleHogFinding(finding: JsonRecord): ScrubFinding | undefined {\n const rawSecret = readString(finding.Raw) || readString(finding.RawV2);\n const filePath = readFilesystemFilePath(finding);\n\n if (!rawSecret || !filePath) {\n return undefined;\n }\n\n return {\n detectorName: readString(finding.DetectorName) || \"Unknown\",\n filePath,\n line: readFilesystemLine(finding),\n rawSecret,\n redactedSecret: readString(finding.Redacted) || \"\",\n verified: finding.Verified === true,\n };\n}\n\nfunction readFilesystemFilePath(finding: JsonRecord): string | undefined {\n const filesystem = readFilesystemMetadata(finding);\n if (!filesystem) {\n return undefined;\n }\n\n return readString(filesystem.file) || readString(filesystem.path);\n}\n\nfunction readFilesystemLine(finding: JsonRecord): number | undefined {\n const filesystem = readFilesystemMetadata(finding);\n if (!filesystem) {\n return undefined;\n }\n\n return typeof filesystem.line === \"number\" ? filesystem.line : undefined;\n}\n\nfunction readFilesystemMetadata(finding: JsonRecord): JsonRecord | undefined {\n const sourceMetadata = readRecord(finding.SourceMetadata);\n const data = readRecord(sourceMetadata?.Data);\n return readRecord(data?.Filesystem);\n}\n\nfunction parseJsonRecord(line: string): JsonRecord | undefined {\n try {\n return readRecord(JSON.parse(line));\n } catch {\n return undefined;\n }\n}\n\nfunction isJsonRecord(value: unknown): value is JsonRecord {\n if (typeof value !== \"object\" || value === null || Array.isArray(value)) {\n return false;\n }\n const prototype = Object.getPrototypeOf(value);\n return prototype === Object.prototype || prototype === null;\n}\n\nfunction readRecord(value: unknown): JsonRecord | undefined {\n return isJsonRecord(value) ? value : undefined;\n}\n\nfunction readString(value: unknown): string | undefined {\n return typeof value === \"string\" && value.length > 0 ? value : undefined;\n}\n"],"mappings":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AQ,IAAI;AAAA,EACnB,CAAC;AACL,QAAM,WAAW,MAAM,eAAe,eAAe;AAErD,MAAI,SAAS,WAAW,GAAG;AACzB,WAAO,QAAQ,mBAAmB;AAClC;AAAA,EACF;AAEA,SAAO,UAAU,cAAc,qBAAqB,EAAE,SAAS,CAAC,CAAC;AAEjE,MAAI,CAACA,SAAQ,KAAK;AAChB,QAAIA,SAAQ,MAAM;AAChB,YAAM,IAAI,MAAM,iEAAiE;AAAA,IACnF;AAEA,WAAO,QAAQ,uDAAuD;AACtE;AAAA,EACF;AAEA,QAAM,SAAS,MAAM,oBAAoB,iBAAiB,QAAQ;AAClE,SAAO;AAAA,IACL,UAAU,OAAO,YAAY,UAAU,OAAO,iBAAiB,IAAI,KAAK,GAAG,OACzE,OAAO,YACT,QAAQ,OAAO,iBAAiB,IAAI,KAAK,GAAG;AAAA,EAC9C;AAEA,MAAI,OAAO,kBAAkB,GAAG;AAC9B,WAAO,QAAQ,WAAW,OAAO,eAAe,qCAAqC;AAAA,EACvF;AACF;;;AD1BS,gBAAAC,YAAA;AA3BF,IAAM,cAAc;AACpB,IAAM,OAAO;AACb,IAAM,UAAU,oBAAoB,OAAO;AAAA,EAChD,MAAM,EACH,QAAQ,EACR,SAAS,EACT;AAAA,IACC,OAAO;AAAA,MACL,aAAa;AAAA,IACf,CAAC;AAAA,EACH;AAAA,EACF,KAAK,EACF,QAAQ,EACR,SAAS,EACT;AAAA,IACC,OAAO;AAAA,MACL,aAAa;AAAA,IACf,CAAC;AAAA,EACH;AACJ,CAAC;AAOc,SAAR,aAA8B,EAAE,MAAAC,OAAM,SAAAC,SAAQ,GAAsB;AACzE,SAAO,gBAAAF,KAAC,iBAAc,KAAK,CAAC,WAAW,gBAAgBC,MAAK,CAAC,GAAGC,UAAS,MAAM,GAAG;AACpF;","names":["path","options","path","args","options","jsx","args","options"]}
1
+ {"version":3,"sources":["../../src/commands/scrub.tsx","../../src/features/scrub/run-scrub-command.ts","../../src/features/scrub/masker.ts","../../src/features/scrub/scrub-output.tsx","../../src/features/scrub/trufflehog.ts","../../src/features/scrub/findings.ts"],"sourcesContent":["import { option } from \"pastel\";\nimport { z } from \"zod\";\n\nimport { GlobalOptionsSchema, OptionalPathArgsSchema } from \"../cli/options.js\";\nimport { runScrubCommand, type ScrubCommandOptions } from \"../features/scrub/run-scrub-command.js\";\nimport { CommandRunner } from \"../cli/command-runner.js\";\n\nexport const description = \"Scan for secrets with TruffleHog and optionally mask them inline\";\nexport const args = OptionalPathArgsSchema;\nexport const options = GlobalOptionsSchema.extend({\n mask: z\n .boolean()\n .optional()\n .describe(\n option({\n description: \"Compatibility alias for inline scrubbing; --yes is still required\",\n })\n ),\n yes: z\n .boolean()\n .optional()\n .describe(\n option({\n description: \"Confirm and run inline scrubbing\",\n })\n ),\n});\n\ntype ScrubCommandProps = {\n readonly args: z.infer<typeof args>;\n readonly options: ScrubCommandOptions;\n};\n\nexport default function ScrubCommand({ args, options }: ScrubCommandProps) {\n return <CommandRunner run={(output) => runScrubCommand(args[0], options, output)} />;\n}\n","import process from \"node:process\";\nimport { createElement } from \"react\";\n\nimport type { GlobalCommandOptions } from \"../../shared/config.js\";\nimport type { CommandOutput } from \"../../shared/output/types.js\";\nimport type { ScrubFinding } from \"./findings.js\";\nimport { scrubFindingsInline } from \"./masker.js\";\nimport { ScrubFindingsReport } from \"./scrub-output.js\";\nimport { scanFilesystemWithTruffleHog } from \"./trufflehog.js\";\n\nexport type ScrubCommandOptions = GlobalCommandOptions & {\n mask?: boolean;\n yes?: boolean;\n};\n\nexport type ScrubCommandDependencies = {\n scanFilesystem(targetPath: string): Promise<ScrubFinding[]>;\n};\n\nexport async function runScrubCommand(\n targetPath: string | undefined,\n options: ScrubCommandOptions,\n output: CommandOutput,\n dependencies?: ScrubCommandDependencies\n): Promise<void> {\n const scrubTargetPath = targetPath ?? \".\";\n const scanFilesystem =\n dependencies?.scanFilesystem ??\n ((scanTargetPath: string) =>\n scanFilesystemWithTruffleHog(scanTargetPath, {\n cwd: process.cwd(),\n }));\n const findings = await scanFilesystem(scrubTargetPath);\n\n if (findings.length === 0) {\n output.success(\"No secrets found.\");\n return;\n }\n\n output.component(createElement(ScrubFindingsReport, { findings }));\n\n if (!options.yes) {\n if (options.mask) {\n throw new Error(\"Inline scrubbing rewrites files. Re-run with --yes to continue.\");\n }\n\n output.warning(\"Report only. Re-run with --yes to scrub files inline.\");\n return;\n }\n\n const result = await scrubFindingsInline(scrubTargetPath, findings);\n output.success(\n `Masked ${result.replacements} secret${result.replacements === 1 ? \"\" : \"s\"} in ${\n result.filesChanged\n } file${result.filesChanged === 1 ? \"\" : \"s\"}.`\n );\n\n if (result.skippedFindings > 0) {\n output.warning(`Skipped ${result.skippedFindings} finding(s) outside the scrub root.`);\n }\n}\n","import fs from \"node:fs/promises\";\nimport path from \"node:path\";\n\nimport type { ScrubFinding } from \"./findings.js\";\n\nexport type InlineScrubResult = {\n filesChanged: number;\n replacements: number;\n skippedFindings: number;\n};\n\nexport async function scrubFindingsInline(\n targetPath: string,\n findings: ScrubFinding[]\n): Promise<InlineScrubResult> {\n const target = await resolveScrubTarget(targetPath);\n const findingsByFile = groupFindingsBySafePath(target, findings);\n let filesChanged = 0;\n let replacements = 0;\n\n for (const [absolutePath, fileFindings] of findingsByFile.safeFindingsByPath) {\n const originalContent = await fs.readFile(absolutePath, \"utf8\");\n let scrubbedContent = originalContent;\n let fileReplacements = 0;\n\n for (const finding of fileFindings) {\n const placeholder = formatSecretPlaceholder(finding);\n const nextContent = scrubbedContent.split(finding.rawSecret).join(placeholder);\n if (nextContent !== scrubbedContent) {\n fileReplacements += countOccurrences(scrubbedContent, finding.rawSecret);\n scrubbedContent = nextContent;\n }\n }\n\n if (scrubbedContent !== originalContent) {\n await fs.writeFile(absolutePath, scrubbedContent);\n filesChanged += 1;\n replacements += fileReplacements;\n }\n }\n\n return {\n filesChanged,\n replacements,\n skippedFindings: findingsByFile.skippedFindings,\n };\n}\n\nexport function formatSecretPlaceholder(finding: ScrubFinding): string {\n return `[CNGKIT_SECRET:${sanitizePlaceholderPart(finding.detectorName)}:${\n finding.verified ? \"verified\" : \"unverified\"\n }]`;\n}\n\nfunction groupFindingsBySafePath(\n target: ScrubTarget,\n findings: ScrubFinding[]\n): {\n safeFindingsByPath: Map<string, ScrubFinding[]>;\n skippedFindings: number;\n} {\n const safeFindingsByPath = new Map<string, ScrubFinding[]>();\n let skippedFindings = 0;\n\n for (const finding of findings) {\n const absolutePath = resolveSafeFindingPath(target, finding.filePath);\n if (!absolutePath) {\n skippedFindings += 1;\n continue;\n }\n\n const fileFindings = safeFindingsByPath.get(absolutePath) ?? [];\n fileFindings.push(finding);\n safeFindingsByPath.set(absolutePath, fileFindings);\n }\n\n return { safeFindingsByPath, skippedFindings };\n}\n\ntype ScrubTarget = {\n rootDir: string;\n allowedFilePath?: string;\n};\n\nasync function resolveScrubTarget(targetPath: string): Promise<ScrubTarget> {\n const absoluteTargetPath = path.resolve(targetPath);\n const stat = await fs.stat(absoluteTargetPath);\n\n if (stat.isFile()) {\n return {\n rootDir: path.dirname(absoluteTargetPath),\n allowedFilePath: absoluteTargetPath,\n };\n }\n\n return {\n rootDir: absoluteTargetPath,\n };\n}\n\nfunction resolveSafeFindingPath(target: ScrubTarget, findingFilePath: string): string | undefined {\n const absolutePath = path.isAbsolute(findingFilePath)\n ? path.resolve(findingFilePath)\n : path.resolve(target.rootDir, findingFilePath);\n\n if (target.allowedFilePath) {\n return absolutePath === target.allowedFilePath ? absolutePath : undefined;\n }\n\n const normalizedRoot = `${path.resolve(target.rootDir)}${path.sep}`;\n\n if (absolutePath === path.resolve(target.rootDir) || absolutePath.startsWith(normalizedRoot)) {\n return absolutePath;\n }\n\n return undefined;\n}\n\nfunction countOccurrences(value: string, search: string): number {\n if (!search) {\n return 0;\n }\n\n return value.split(search).length - 1;\n}\n\nfunction sanitizePlaceholderPart(value: string): string {\n return value.replace(/[^A-Za-z0-9_-]+/g, \"-\").replace(/^-+|-+$/g, \"\") || \"Unknown\";\n}\n","import { Box, Text } from \"ink\";\n\nimport type { ScrubFinding } from \"./findings.js\";\n\nexport function ScrubFindingsReport({ findings }: { readonly findings: readonly ScrubFinding[] }) {\n return (\n <Box flexDirection=\"column\">\n <Text color=\"yellow\" bold>\n Found {findings.length} possible secret{findings.length === 1 ? \"\" : \"s\"}:\n </Text>\n {findings.map((finding, index) => {\n const location = finding.line ? `${finding.filePath}:${finding.line}` : finding.filePath;\n const status = finding.verified ? \"verified\" : \"unverified\";\n\n return (\n // biome-ignore lint/suspicious/noArrayIndexKey: Findings can have duplicate filePaths; index is the simplest stable key\n <Text key={index}>\n <Text color=\"cyan\">- </Text>\n <Text>{location}</Text>\n <Text dimColor> {finding.detectorName}</Text>\n <Text color={finding.verified ? \"green\" : \"yellow\"}> {status}</Text>\n </Text>\n );\n })}\n </Box>\n );\n}\n","import { spawn } from \"node:child_process\";\nimport path from \"node:path\";\n\nimport { parseTruffleHogJsonLines, type ScrubFinding } from \"./findings.js\";\n\nexport type TruffleHogScanOptions = {\n cwd: string;\n};\n\nexport async function scanFilesystemWithTruffleHog(\n targetPath: string,\n options: TruffleHogScanOptions\n): Promise<ScrubFinding[]> {\n const absoluteTargetPath = path.resolve(options.cwd, targetPath);\n const { stdout } = await runTruffleHog([\n \"filesystem\",\n absoluteTargetPath,\n \"--json\",\n \"--no-update\",\n \"--force-skip-binaries\",\n \"--force-skip-archives\",\n ]);\n\n return parseTruffleHogJsonLines(stdout);\n}\n\nfunction runTruffleHog(args: string[]): Promise<{ stdout: string; stderr: string }> {\n return new Promise((resolve, reject) => {\n const child = spawn(\"trufflehog\", args, {\n stdio: [\"ignore\", \"pipe\", \"pipe\"],\n });\n const stdoutChunks: Buffer[] = [];\n const stderrChunks: Buffer[] = [];\n\n child.stdout.on(\"data\", (chunk: Buffer) => {\n stdoutChunks.push(chunk);\n });\n child.stderr.on(\"data\", (chunk: Buffer) => {\n stderrChunks.push(chunk);\n });\n child.on(\"error\", (error: NodeJS.ErrnoException) => {\n if (error.code === \"ENOENT\") {\n reject(\n new Error(\n \"TruffleHog is not installed. Install it with `brew install trufflehog` or see https://github.com/trufflesecurity/trufflehog.\"\n )\n );\n return;\n }\n\n reject(error);\n });\n child.on(\"close\", (exitCode) => {\n const stdout = Buffer.concat(stdoutChunks).toString(\"utf8\");\n const stderr = Buffer.concat(stderrChunks).toString(\"utf8\");\n\n if (exitCode && exitCode !== 0) {\n reject(new Error(`TruffleHog scan failed with exit code ${exitCode}: ${stderr.trim()}`));\n return;\n }\n\n resolve({ stdout, stderr });\n });\n });\n}\n","export type ScrubFinding = {\n detectorName: string;\n filePath: string;\n line?: number;\n rawSecret: string;\n redactedSecret: string;\n verified: boolean;\n};\n\ntype JsonRecord = Record<string, unknown>;\n\nexport function parseTruffleHogJsonLines(output: string): ScrubFinding[] {\n const findings: ScrubFinding[] = [];\n\n for (const line of output.split(/\\r?\\n/)) {\n const trimmedLine = line.trim();\n if (!trimmedLine.startsWith(\"{\")) {\n continue;\n }\n\n const parsedLine = parseJsonRecord(trimmedLine);\n if (!parsedLine) {\n continue;\n }\n\n const finding = parseTruffleHogFinding(parsedLine);\n if (finding) {\n findings.push(finding);\n }\n }\n\n return findings;\n}\n\nfunction parseTruffleHogFinding(finding: JsonRecord): ScrubFinding | undefined {\n const rawSecret = readString(finding.Raw) || readString(finding.RawV2);\n const filePath = readFilesystemFilePath(finding);\n\n if (!rawSecret || !filePath) {\n return undefined;\n }\n\n return {\n detectorName: readString(finding.DetectorName) || \"Unknown\",\n filePath,\n line: readFilesystemLine(finding),\n rawSecret,\n redactedSecret: readString(finding.Redacted) || \"\",\n verified: finding.Verified === true,\n };\n}\n\nfunction readFilesystemFilePath(finding: JsonRecord): string | undefined {\n const filesystem = readFilesystemMetadata(finding);\n if (!filesystem) {\n return undefined;\n }\n\n return readString(filesystem.file) || readString(filesystem.path);\n}\n\nfunction readFilesystemLine(finding: JsonRecord): number | undefined {\n const filesystem = readFilesystemMetadata(finding);\n if (!filesystem) {\n return undefined;\n }\n\n return typeof filesystem.line === \"number\" ? filesystem.line : undefined;\n}\n\nfunction readFilesystemMetadata(finding: JsonRecord): JsonRecord | undefined {\n const sourceMetadata = readRecord(finding.SourceMetadata);\n const data = readRecord(sourceMetadata?.Data);\n return readRecord(data?.Filesystem);\n}\n\nfunction parseJsonRecord(line: string): JsonRecord | undefined {\n try {\n return readRecord(JSON.parse(line));\n } catch {\n return undefined;\n }\n}\n\nfunction isJsonRecord(value: unknown): value is JsonRecord {\n if (typeof value !== \"object\" || value === null || Array.isArray(value)) {\n return false;\n }\n const prototype = Object.getPrototypeOf(value);\n return prototype === Object.prototype || prototype === null;\n}\n\nfunction readRecord(value: unknown): JsonRecord | undefined {\n return isJsonRecord(value) ? value : undefined;\n}\n\nfunction readString(value: unknown): string | undefined {\n return typeof value === \"string\" && value.length > 0 ? value : undefined;\n}\n"],"mappings":";;;;;;;;;;;AAAA,SAAS,cAAc;AACvB,SAAS,SAAS;;;ACDlB,OAAO,aAAa;AACpB,SAAS,qBAAqB;;;ACD9B,OAAO,QAAQ;AACf,OAAO,UAAU;AAUjB,eAAsB,oBACpB,YACA,UAC4B;AAC5B,QAAM,SAAS,MAAM,mBAAmB,UAAU;AAClD,QAAM,iBAAiB,wBAAwB,QAAQ,QAAQ;AAC/D,MAAI,eAAe;AACnB,MAAI,eAAe;AAEnB,aAAW,CAAC,cAAc,YAAY,KAAK,eAAe,oBAAoB;AAC5E,UAAM,kBAAkB,MAAM,GAAG,SAAS,cAAc,MAAM;AAC9D,QAAI,kBAAkB;AACtB,QAAI,mBAAmB;AAEvB,eAAW,WAAW,cAAc;AAClC,YAAM,cAAc,wBAAwB,OAAO;AACnD,YAAM,cAAc,gBAAgB,MAAM,QAAQ,SAAS,EAAE,KAAK,WAAW;AAC7E,UAAI,gBAAgB,iBAAiB;AACnC,4BAAoB,iBAAiB,iBAAiB,QAAQ,SAAS;AACvE,0BAAkB;AAAA,MACpB;AAAA,IACF;AAEA,QAAI,oBAAoB,iBAAiB;AACv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