cngkit 1.1.20 → 1.1.22

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 (87) hide show
  1. package/LICENSE +198 -4
  2. package/README.md +8 -12
  3. package/dist/{chunk-NGEWD4BW.js → chunk-25Q463MH.js} +1 -2
  4. package/dist/{chunk-SMTQ3W3F.js → chunk-3BATDTKU.js} +131 -112
  5. package/dist/chunk-3BATDTKU.js.map +1 -0
  6. package/dist/chunk-AS7FIJWP.js +88 -0
  7. package/dist/chunk-AS7FIJWP.js.map +1 -0
  8. package/dist/chunk-BRFWVQI4.js +18 -0
  9. package/dist/chunk-BRFWVQI4.js.map +1 -0
  10. package/dist/{chunk-WDI43VPW.js → chunk-DCW4RKLC.js} +63 -234
  11. package/dist/chunk-DCW4RKLC.js.map +1 -0
  12. package/dist/{chunk-SKK2XLRZ.js → chunk-JNHW72SU.js} +21 -15
  13. package/dist/chunk-JNHW72SU.js.map +1 -0
  14. package/dist/{chunk-E2GLGGKO.js → chunk-KURN5BJ6.js} +300 -143
  15. package/dist/chunk-KURN5BJ6.js.map +1 -0
  16. package/dist/{chunk-CIZBVLN5.js → chunk-N255PYL7.js} +2 -2
  17. package/dist/chunk-N255PYL7.js.map +1 -0
  18. package/dist/chunk-NLAANOBW.js +67 -0
  19. package/dist/chunk-NLAANOBW.js.map +1 -0
  20. package/dist/chunk-TIY4RTXC.js +268 -0
  21. package/dist/chunk-TIY4RTXC.js.map +1 -0
  22. package/dist/chunk-VMTXY4KQ.js +111 -0
  23. package/dist/chunk-VMTXY4KQ.js.map +1 -0
  24. package/dist/chunk-YALWTRIP.js +102 -0
  25. package/dist/chunk-YALWTRIP.js.map +1 -0
  26. package/dist/cli.js +2 -2
  27. package/dist/cli.js.map +1 -1
  28. package/dist/commands/coderoom/index.js +4 -4
  29. package/dist/commands/coderoom/join.js +5 -5
  30. package/dist/commands/coderoom/share.js +8 -11
  31. package/dist/commands/coderoom/share.js.map +1 -1
  32. package/dist/commands/hookify/index.js +4 -4
  33. package/dist/commands/hookify/ingest.js +4 -4
  34. package/dist/commands/hooks/index.js +4 -4
  35. package/dist/commands/hooks/install.js +4 -4
  36. package/dist/commands/hooks/uninstall.js +4 -4
  37. package/dist/commands/index.js +3 -3
  38. package/dist/commands/knowledges/audiences.js +26 -8
  39. package/dist/commands/knowledges/audiences.js.map +1 -1
  40. package/dist/commands/knowledges/cat.js +26 -7
  41. package/dist/commands/knowledges/cat.js.map +1 -1
  42. package/dist/commands/knowledges/files.js +39 -8
  43. package/dist/commands/knowledges/files.js.map +1 -1
  44. package/dist/commands/knowledges/find.js +48 -8
  45. package/dist/commands/knowledges/find.js.map +1 -1
  46. package/dist/commands/knowledges/glob.js +41 -8
  47. package/dist/commands/knowledges/glob.js.map +1 -1
  48. package/dist/commands/knowledges/grep.js +73 -8
  49. package/dist/commands/knowledges/grep.js.map +1 -1
  50. package/dist/commands/knowledges/head.js +31 -8
  51. package/dist/commands/knowledges/head.js.map +1 -1
  52. package/dist/commands/knowledges/index.js +4 -4
  53. package/dist/commands/knowledges/list.js +39 -8
  54. package/dist/commands/knowledges/list.js.map +1 -1
  55. package/dist/commands/knowledges/ls.js +47 -8
  56. package/dist/commands/knowledges/ls.js.map +1 -1
  57. package/dist/commands/knowledges/read.js +46 -8
  58. package/dist/commands/knowledges/read.js.map +1 -1
  59. package/dist/commands/knowledges/realpath.js +23 -8
  60. package/dist/commands/knowledges/realpath.js.map +1 -1
  61. package/dist/commands/knowledges/search.js +34 -8
  62. package/dist/commands/knowledges/search.js.map +1 -1
  63. package/dist/commands/knowledges/stat.js +32 -8
  64. package/dist/commands/knowledges/stat.js.map +1 -1
  65. package/dist/commands/knowledges/status.js +26 -8
  66. package/dist/commands/knowledges/status.js.map +1 -1
  67. package/dist/commands/knowledges/tail.js +30 -8
  68. package/dist/commands/knowledges/tail.js.map +1 -1
  69. package/dist/commands/knowledges/tree.js +38 -8
  70. package/dist/commands/knowledges/tree.js.map +1 -1
  71. package/dist/commands/login.js +3 -3
  72. package/dist/commands/login.js.map +1 -1
  73. package/dist/commands/scrub.js +3 -3
  74. package/dist/commands/scrub.js.map +1 -1
  75. package/dist/commands/transcripts.js +137 -119
  76. package/dist/commands/transcripts.js.map +1 -1
  77. package/package.json +2 -2
  78. package/dist/chunk-CIZBVLN5.js.map +0 -1
  79. package/dist/chunk-E2GLGGKO.js.map +0 -1
  80. package/dist/chunk-MRXGD6TC.js +0 -42
  81. package/dist/chunk-MRXGD6TC.js.map +0 -1
  82. package/dist/chunk-NODJM6SH.js +0 -658
  83. package/dist/chunk-NODJM6SH.js.map +0 -1
  84. package/dist/chunk-SKK2XLRZ.js.map +0 -1
  85. package/dist/chunk-SMTQ3W3F.js.map +0 -1
  86. package/dist/chunk-WDI43VPW.js.map +0 -1
  87. /package/dist/{chunk-NGEWD4BW.js.map → chunk-25Q463MH.js.map} +0 -0
@@ -0,0 +1,102 @@
1
+ import {
2
+ formatCatalogPathForDisplay
3
+ } from "./chunk-AS7FIJWP.js";
4
+ import {
5
+ coerceOptionalNumber
6
+ } from "./chunk-XQGLUQFM.js";
7
+
8
+ // src/features/knowledges/format/filesystem-format.ts
9
+ function compareFilesystemEntries(left, right) {
10
+ if (left.type !== right.type) {
11
+ return left.type === "directory" ? -1 : 1;
12
+ }
13
+ return left.path.localeCompare(right.path);
14
+ }
15
+ function formatFilesystemTree(rootPath, entries) {
16
+ const normalizedRootPath = rootPath.replace(/\/+$/, "");
17
+ const rootLine = formatTreeDirectoryName(rootPath);
18
+ const entryLines = [...entries].sort(compareFilesystemEntries).map((entry) => {
19
+ const relativePath = stripRootPath(entry.path, normalizedRootPath);
20
+ const segmentCount = relativePath.split("/").filter(Boolean).length;
21
+ const indent = " ".repeat(Math.max(segmentCount - 1, 0));
22
+ return `${indent}${formatShellFilesystemEntryName(entry)}`;
23
+ });
24
+ return [rootLine, ...entryLines];
25
+ }
26
+ function stripRootPath(path, rootPath) {
27
+ if (path === rootPath) {
28
+ return "";
29
+ }
30
+ if (rootPath && path.startsWith(`${rootPath}/`)) {
31
+ return path.slice(rootPath.length + 1);
32
+ }
33
+ return path;
34
+ }
35
+ function formatTreeDirectoryName(path) {
36
+ const normalizedPath = formatCatalogPathForDisplay(path).replace(/\/+$/, "");
37
+ return normalizedPath ? `${normalizedPath}/` : "/";
38
+ }
39
+ function formatShellFilesystemEntryName(entry) {
40
+ return entry.type === "directory" ? `${entry.name}/` : entry.name;
41
+ }
42
+ function formatFilesystemEntryPath(entry) {
43
+ const displayPath = formatCatalogPathForDisplay(entry.path);
44
+ return entry.type === "directory" ? `${displayPath}/` : displayPath;
45
+ }
46
+ function formatLongFilesystemEntryLine(entry) {
47
+ const fields = [
48
+ entry.type,
49
+ formatCatalogPathForDisplay(entry.path),
50
+ ...formatOptionalEntryFields([
51
+ ["size", entry.size],
52
+ ["files", entry.file_count],
53
+ ["children", entry.child_count],
54
+ ["total_size", entry.total_size],
55
+ ["sha256", entry.sha256],
56
+ ["asset_kind", entry.asset_kind],
57
+ ["topic", entry.topic_name]
58
+ ])
59
+ ];
60
+ return fields.join(" ");
61
+ }
62
+ function coerceOptionalFiniteNumber(value) {
63
+ const normalizedValue = coerceOptionalNumber(value);
64
+ return normalizedValue === void 0 || Number.isNaN(normalizedValue) ? void 0 : Math.max(1, Math.trunc(normalizedValue));
65
+ }
66
+ function formatFilesystemStat(entry) {
67
+ const fields = [
68
+ ["path", formatCatalogPathForDisplay(entry.path)],
69
+ ["type", entry.type],
70
+ ["name", entry.name],
71
+ ["depth", entry.depth],
72
+ ["size", entry.size],
73
+ ["files", entry.file_count],
74
+ ["children", entry.child_count],
75
+ ["total_size", entry.total_size],
76
+ ["sha256", entry.sha256],
77
+ ["asset_kind", entry.asset_kind],
78
+ ["title", entry.title],
79
+ ["topic", entry.topic_name],
80
+ ["updated_at", entry.updated_at]
81
+ ];
82
+ return formatOptionalEntryFields(fields).join("\n");
83
+ }
84
+ function formatOptionalEntryFields(fields) {
85
+ return fields.flatMap(([key, value]) => {
86
+ if (value === null || value === "") {
87
+ return [];
88
+ }
89
+ return [`${key}=${value}`];
90
+ });
91
+ }
92
+
93
+ export {
94
+ compareFilesystemEntries,
95
+ formatFilesystemTree,
96
+ formatShellFilesystemEntryName,
97
+ formatFilesystemEntryPath,
98
+ formatLongFilesystemEntryLine,
99
+ coerceOptionalFiniteNumber,
100
+ formatFilesystemStat
101
+ };
102
+ //# sourceMappingURL=chunk-YALWTRIP.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/features/knowledges/format/filesystem-format.ts"],"sourcesContent":["import type { CngApi } from \"@cng/client\";\n\nimport { coerceOptionalNumber, type NumberOption } from \"../../../shared/command-utils.js\";\nimport { formatCatalogPathForDisplay } from \"../knowledges-input.js\";\n\nexport function compareFilesystemEntries(\n left: CngApi.HarnessFilesystemEntry,\n right: CngApi.HarnessFilesystemEntry\n): number {\n if (left.type !== right.type) {\n return left.type === \"directory\" ? -1 : 1;\n }\n\n return left.path.localeCompare(right.path);\n}\n\nexport function formatFilesystemTree(\n rootPath: string,\n entries: CngApi.HarnessFilesystemEntry[]\n): string[] {\n const normalizedRootPath = rootPath.replace(/\\/+$/, \"\");\n const rootLine = formatTreeDirectoryName(rootPath);\n const entryLines = [...entries].sort(compareFilesystemEntries).map((entry) => {\n const relativePath = stripRootPath(entry.path, normalizedRootPath);\n const segmentCount = relativePath.split(\"/\").filter(Boolean).length;\n const indent = \" \".repeat(Math.max(segmentCount - 1, 0));\n return `${indent}${formatShellFilesystemEntryName(entry)}`;\n });\n\n return [rootLine, ...entryLines];\n}\n\nexport function stripRootPath(path: string, rootPath: string): string {\n if (path === rootPath) {\n return \"\";\n }\n\n if (rootPath && path.startsWith(`${rootPath}/`)) {\n return path.slice(rootPath.length + 1);\n }\n\n return path;\n}\n\nexport function formatTreeDirectoryName(path: string): string {\n const normalizedPath = formatCatalogPathForDisplay(path).replace(/\\/+$/, \"\");\n return normalizedPath ? `${normalizedPath}/` : \"/\";\n}\n\nexport function formatShellFilesystemEntryName(entry: CngApi.HarnessFilesystemEntry): string {\n return entry.type === \"directory\" ? `${entry.name}/` : entry.name;\n}\n\nexport function formatFilesystemEntryPath(entry: CngApi.HarnessFilesystemEntry): string {\n const displayPath = formatCatalogPathForDisplay(entry.path);\n return entry.type === \"directory\" ? `${displayPath}/` : displayPath;\n}\n\nexport function formatLongFilesystemEntryLine(entry: CngApi.HarnessFilesystemEntry): string {\n const fields = [\n entry.type,\n formatCatalogPathForDisplay(entry.path),\n ...formatOptionalEntryFields([\n [\"size\", entry.size],\n [\"files\", entry.file_count],\n [\"children\", entry.child_count],\n [\"total_size\", entry.total_size],\n [\"sha256\", entry.sha256],\n [\"asset_kind\", entry.asset_kind],\n [\"topic\", entry.topic_name],\n ]),\n ];\n\n return fields.join(\"\\t\");\n}\n\nexport function coerceOptionalFiniteNumber(value: NumberOption | undefined): number | undefined {\n const normalizedValue = coerceOptionalNumber(value);\n return normalizedValue === undefined || Number.isNaN(normalizedValue)\n ? undefined\n : Math.max(1, Math.trunc(normalizedValue));\n}\n\nexport function formatFilesystemStat(entry: CngApi.HarnessFilesystemStatResponse): string {\n const fields: Array<[string, string | number | null]> = [\n [\"path\", formatCatalogPathForDisplay(entry.path)],\n [\"type\", entry.type],\n [\"name\", entry.name],\n [\"depth\", entry.depth],\n [\"size\", entry.size],\n [\"files\", entry.file_count],\n [\"children\", entry.child_count],\n [\"total_size\", entry.total_size],\n [\"sha256\", entry.sha256],\n [\"asset_kind\", entry.asset_kind],\n [\"title\", entry.title],\n [\"topic\", entry.topic_name],\n [\"updated_at\", entry.updated_at],\n ];\n\n return formatOptionalEntryFields(fields).join(\"\\n\");\n}\n\nexport function formatOptionalEntryFields(\n fields: Array<[string, string | number | null]>\n): string[] {\n return fields.flatMap(([key, value]) => {\n if (value === null || value === \"\") {\n return [];\n }\n\n return [`${key}=${value}`];\n });\n}\n"],"mappings":";;;;;;;;AAKO,SAAS,yBACd,MACA,OACQ;AACR,MAAI,KAAK,SAAS,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,UAAU,IAAI;AAClC,aAAO,CAAC;AAAA,IACV;AAEA,WAAO,CAAC,GAAG,GAAG,IAAI,KAAK,EAAE;AAAA,EAC3B,CAAC;AACH;","names":[]}
package/dist/cli.js CHANGED
@@ -2,12 +2,12 @@
2
2
  import {
3
3
  renderCngkitHelp,
4
4
  renderKnowledgesHelp
5
- } from "./chunk-SKK2XLRZ.js";
5
+ } from "./chunk-JNHW72SU.js";
6
6
  import {
7
7
  formatError,
8
8
  packageVersion,
9
9
  parseOutputFormat
10
- } from "./chunk-WDI43VPW.js";
10
+ } from "./chunk-DCW4RKLC.js";
11
11
  import "./chunk-PZ5AY32C.js";
12
12
 
13
13
  // src/cli.ts
package/dist/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/cli.ts","../src/cli/render-once.ts","../src/cli/help.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport process from \"node:process\";\nimport { createElement } from \"react\";\nimport { Text } from \"ink\";\n\nimport Pastel from \"pastel\";\n\nimport { printHelpIfRequested } from \"./cli/help.js\";\nimport { renderOnce } from \"./cli/render-once.js\";\nimport { packageVersion, parseOutputFormat } from \"./shared/config.js\";\nimport { formatError } from \"./shared/output.js\";\n\ntry {\n const normalizedArgv = normalizeGlobalOptions(process.argv);\n\n if (await printHelpIfRequested(normalizedArgv)) {\n process.exit(0);\n }\n\n guardKnownCommand(normalizedArgv);\n\n const app = new Pastel({\n importMeta: import.meta,\n name: \"cngkit\",\n version: packageVersion,\n description: \"Opinionated CNG CLI kit for Coderoom collaboration and operator workflows.\",\n });\n\n await app.run(normalizedArgv);\n} catch (error) {\n await renderOnce(\n createElement(\n Text,\n {\n bold: true,\n color: \"red\",\n wrap: \"wrap\",\n },\n formatError(error)\n ),\n { stdout: process.stderr }\n );\n process.exitCode = 1;\n}\n\nfunction normalizeGlobalOptions(argv: string[]): string[] {\n const normalizedArgv = [...argv];\n\n for (let index = 2; index < normalizedArgv.length; index += 1) {\n const argument = normalizedArgv[index];\n\n if (argument === \"--format\") {\n const value = normalizedArgv[index + 1];\n if (!value || value.startsWith(\"-\")) {\n throw new Error(\"Missing value for --format\");\n }\n\n process.env.CNGKIT_FORMAT = parseOutputFormat(value);\n normalizedArgv.splice(index, 2);\n index -= 1;\n continue;\n }\n\n if (argument.startsWith(\"--format=\")) {\n process.env.CNGKIT_FORMAT = parseOutputFormat(argument.slice(\"--format=\".length));\n normalizedArgv.splice(index, 1);\n index -= 1;\n continue;\n }\n\n if (argument === \"--no-color\" || argument === \"--no-colors\") {\n process.env.CNGKIT_COLOR = \"never\";\n process.env.CNGKIT_NO_COLOR = \"1\";\n normalizedArgv.splice(index, 1);\n index -= 1;\n continue;\n }\n\n if (argument === \"--color\") {\n process.env.CNGKIT_COLOR = \"always\";\n normalizedArgv.splice(index, 1);\n index -= 1;\n continue;\n }\n\n if (argument.startsWith(\"--color=\")) {\n const colorMode = argument.slice(\"--color=\".length);\n process.env.CNGKIT_COLOR =\n colorMode === \"false\" || colorMode === \"never\" ? \"never\" : \"always\";\n normalizedArgv.splice(index, 1);\n index -= 1;\n }\n }\n\n normalizeKnowledgesFindOptions(normalizedArgv);\n return normalizedArgv;\n}\n\nfunction normalizeKnowledgesFindOptions(argv: string[]): void {\n if (argv[2] !== \"knowledges\" || argv[3] !== \"find\") {\n return;\n }\n\n for (let index = 4; index < argv.length; index += 1) {\n if (argv[index] === \"-name\") {\n argv[index] = \"--name\";\n continue;\n }\n\n if (argv[index] === \"-type\") {\n argv[index] = \"--type\";\n continue;\n }\n\n if (argv[index] === \"-maxdepth\") {\n argv[index] = \"--max-depth\";\n }\n }\n}\n\nfunction guardKnownCommand(argv: string[]): void {\n const commandName = argv[2];\n if (commandName === undefined || commandName.startsWith(\"-\")) {\n return;\n }\n\n const knownCommands = new Set([\n \"help\",\n \"login\",\n \"coderoom\",\n \"scrub\",\n \"transcripts\",\n \"knowledges\",\n \"hooks\",\n \"hookify\",\n ]);\n if (!knownCommands.has(commandName)) {\n throw new Error(`Unknown command \"${commandName}\". Run cngkit --help for available commands.`);\n }\n\n guardKnownSubcommand(commandName, argv.slice(3));\n}\n\nfunction guardKnownSubcommand(commandName: string, commandArgs: string[]): void {\n const subcommand = commandArgs.find((argument) => !argument.startsWith(\"-\"));\n if (!subcommand) {\n return;\n }\n\n if (commandName === \"coderoom\") {\n const knownCoderoomSubcommands = new Set([\"share\", \"join\"]);\n if (!knownCoderoomSubcommands.has(subcommand)) {\n throw new Error(`Unknown coderoom command \"${subcommand}\". Use one of: share, join.`);\n }\n }\n\n if (commandName === \"knowledges\") {\n const knownKnowledgesSubcommands = new Set([\n \"status\",\n \"audiences\",\n \"search\",\n \"list\",\n \"files\",\n \"read\",\n \"cat\",\n \"head\",\n \"tail\",\n \"grep\",\n \"glob\",\n \"ls\",\n \"tree\",\n \"find\",\n \"stat\",\n \"realpath\",\n \"help\",\n ]);\n if (!knownKnowledgesSubcommands.has(subcommand)) {\n throw new Error(\n `Unknown knowledges command \"${subcommand}\". Use one of: status, audiences, search, list, files, read, cat, head, tail, grep, glob, ls, tree, find, stat, realpath.`\n );\n }\n }\n\n if (commandName === \"hookify\") {\n const knownHookifySubcommands = new Set([\"ingest\"]);\n if (!knownHookifySubcommands.has(subcommand)) {\n throw new Error(`Unknown hookify command \"${subcommand}\". Use one of: ingest.`);\n }\n }\n\n if (commandName === \"hooks\") {\n const knownHooksSubcommands = new Set([\"install\", \"uninstall\"]);\n if (!knownHooksSubcommands.has(subcommand)) {\n throw new Error(`Unknown hooks command \"${subcommand}\". Use one of: install, uninstall.`);\n }\n }\n}\n","import process from \"node:process\";\nimport { createElement, useEffect, type ReactElement } from \"react\";\nimport { render, useApp } from \"ink\";\n\ntype OutputStream = NodeJS.WriteStream;\n\nexport async function renderOnce(\n element: ReactElement,\n options?: {\n readonly stdout?: OutputStream;\n }\n): Promise<void> {\n const instance = render(createElement(ExitAfterFirstRender, { element }), {\n stdin: process.stdin,\n stdout: options?.stdout ?? process.stdout,\n stderr: process.stderr,\n });\n await instance.waitUntilExit();\n}\n\nfunction ExitAfterFirstRender({ element }: { readonly element: ReactElement }) {\n const { exit } = useApp();\n\n useEffect(() => {\n queueMicrotask(() => exit());\n }, [exit]);\n\n return element;\n}\n","import type { ReactElement } from \"react\";\n\nimport { renderCngkitHelp, renderKnowledgesHelp } from \"./help-specs.js\";\nimport { renderOnce } from \"./render-once.js\";\nimport type { CommandOutput } from \"../shared/output.js\";\n\nexport async function printHelpIfRequested(\n argv: string[],\n output?: CommandOutput\n): Promise<boolean> {\n const commandName = argv[2];\n\n if (commandName === undefined || commandName === \"--help\" || commandName === \"-h\") {\n await printHelpComponent(renderCngkitHelp(), output);\n return true;\n }\n\n if (commandName === \"help\") {\n const [topicName, subtopicName] = argv.slice(3);\n const topic =\n (topicName === \"knowledges\" ||\n topicName === \"coderoom\" ||\n topicName === \"hookify\" ||\n topicName === \"hooks\") &&\n subtopicName\n ? `${topicName}-${subtopicName}`\n : topicName;\n await printHelpComponent(renderCngkitHelp(topic), output);\n return true;\n }\n\n const commandArgs = argv.slice(3);\n const helpIndex = commandArgs.findIndex((argument) => argument === \"--help\" || argument === \"-h\");\n\n if (helpIndex < 0) {\n return false;\n }\n\n if (commandName === \"knowledges\") {\n const topic = commandArgs.find(\n (argument, index) => index !== helpIndex && !argument.startsWith(\"-\")\n );\n await printHelpComponent(renderKnowledgesHelp(topic), output);\n return true;\n }\n\n if (commandName === \"coderoom\") {\n const topic = commandArgs.find(\n (argument, index) => index !== helpIndex && !argument.startsWith(\"-\")\n );\n await printHelpComponent(renderCngkitHelp(topic ? `coderoom-${topic}` : \"coderoom\"), output);\n return true;\n }\n\n if (commandName === \"hookify\") {\n const topic = commandArgs.find(\n (argument, index) => index !== helpIndex && !argument.startsWith(\"-\")\n );\n await printHelpComponent(renderCngkitHelp(topic ? `hookify-${topic}` : \"hookify\"), output);\n return true;\n }\n\n if (commandName === \"hooks\") {\n const topic = commandArgs.find(\n (argument, index) => index !== helpIndex && !argument.startsWith(\"-\")\n );\n await printHelpComponent(renderCngkitHelp(topic ? `hooks-${topic}` : \"hooks\"), output);\n return true;\n }\n\n await printHelpComponent(renderCngkitHelp(commandName), output);\n return true;\n}\n\nasync function printHelpComponent(element: ReactElement, output: CommandOutput | undefined): Promise<void> {\n if (output) {\n output.component(element);\n return;\n }\n\n await renderOnce(element);\n}\n"],"mappings":";;;;;;;;;;;;;AAEA,OAAOA,cAAa;AACpB,SAAS,iBAAAC,sBAAqB;AAC9B,SAAS,YAAY;AAErB,OAAO,YAAY;;;ACNnB,OAAO,aAAa;AACpB,SAAS,eAAe,iBAAoC;AAC5D,SAAS,QAAQ,cAAc;AAI/B,eAAsB,WACpB,SACA,SAGe;AACf,QAAM,WAAW,OAAO,cAAc,sBAAsB,EAAE,QAAQ,CAAC,GAAG;AAAA,IACxE,OAAO,QAAQ;AAAA,IACf,QAAQ,SAAS,UAAU,QAAQ;AAAA,IACnC,QAAQ,QAAQ;AAAA,EAClB,CAAC;AACD,QAAM,SAAS,cAAc;AAC/B;AAEA,SAAS,qBAAqB,EAAE,QAAQ,GAAuC;AAC7E,QAAM,EAAE,KAAK,IAAI,OAAO;AAExB,YAAU,MAAM;AACd,mBAAe,MAAM,KAAK,CAAC;AAAA,EAC7B,GAAG,CAAC,IAAI,CAAC;AAET,SAAO;AACT;;;ACtBA,eAAsB,qBACpB,MACA,QACkB;AAClB,QAAM,cAAc,KAAK,CAAC;AAE1B,MAAI,gBAAgB,UAAa,gBAAgB,YAAY,gBAAgB,MAAM;AACjF,UAAM,mBAAmB,iBAAiB,GAAG,MAAM;AACnD,WAAO;AAAA,EACT;AAEA,MAAI,gBAAgB,QAAQ;AAC1B,UAAM,CAAC,WAAW,YAAY,IAAI,KAAK,MAAM,CAAC;AAC9C,UAAM,SACH,cAAc,gBACb,cAAc,cACd,cAAc,aACd,cAAc,YAChB,eACI,GAAG,SAAS,IAAI,YAAY,KAC5B;AACN,UAAM,mBAAmB,iBAAiB,KAAK,GAAG,MAAM;AACxD,WAAO;AAAA,EACT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,KAAK,MAAM,CAAC,CAAC;AACjD;AAEA,SAAS,qBAAqB,aAAqB,aAA6B;AAC9E,QAAM,aAAa,YAAY,KAAK,CAAC,aAAa,CAAC,SAAS,WAAW,GAAG,CAAC;AAC3E,MAAI,CAAC,YAAY;AACf;AAAA,EACF;AAEA,MAAI,gBAAgB,YAAY;AAC9B,UAAM,2BAA2B,oBAAI,IAAI,CAAC,SAAS,MAAM,CAAC;AAC1D,QAAI,CAAC,yBAAyB,IAAI,UAAU,GAAG;AAC7C,YAAM,IAAI,MAAM,6BAA6B,UAAU,6BAA6B;AAAA,IACtF;AAAA,EACF;AAEA,MAAI,gBAAgB,cAAc;AAChC,UAAM,6BAA6B,oBAAI,IAAI;AAAA,MACzC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF,CAAC;AACD,QAAI,CAAC,2BAA2B,IAAI,UAAU,GAAG;AAC/C,YAAM,IAAI;AAAA,QACR,+BAA+B,UAAU;AAAA,MAC3C;AAAA,IACF;AAAA,EACF;AAEA,MAAI,gBAAgB,WAAW;AAC7B,UAAM,0BAA0B,oBAAI,IAAI,CAAC,QAAQ,CAAC;AAClD,QAAI,CAAC,wBAAwB,IAAI,UAAU,GAAG;AAC5C,YAAM,IAAI,MAAM,4BAA4B,UAAU,wBAAwB;AAAA,IAChF;AAAA,EACF;AAEA,MAAI,gBAAgB,SAAS;AAC3B,UAAM,wBAAwB,oBAAI,IAAI,CAAC,WAAW,WAAW,CAAC;AAC9D,QAAI,CAAC,sBAAsB,IAAI,UAAU,GAAG;AAC1C,YAAM,IAAI,MAAM,0BAA0B,UAAU,oCAAoC;AAAA,IAC1F;AAAA,EACF;AACF;","names":["process","createElement","process","createElement"]}
1
+ {"version":3,"sources":["../src/cli.ts","../src/cli/render-once.ts","../src/cli/help.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport process from \"node:process\";\nimport { createElement } from \"react\";\nimport { Text } from \"ink\";\n\nimport Pastel from \"pastel\";\n\nimport { printHelpIfRequested } from \"./cli/help.js\";\nimport { renderOnce } from \"./cli/render-once.js\";\nimport { packageVersion, parseOutputFormat } from \"./shared/config.js\";\nimport { formatError } from \"./shared/output/errors.js\";\n\ntry {\n const normalizedArgv = normalizeGlobalOptions(process.argv);\n\n if (await printHelpIfRequested(normalizedArgv)) {\n process.exit(0);\n }\n\n guardKnownCommand(normalizedArgv);\n\n const app = new Pastel({\n importMeta: import.meta,\n name: \"cngkit\",\n version: packageVersion,\n description: \"Opinionated CNG CLI kit for Coderoom collaboration and operator workflows.\",\n });\n\n await app.run(normalizedArgv);\n} catch (error) {\n await renderOnce(\n createElement(\n Text,\n {\n bold: true,\n color: \"red\",\n wrap: \"wrap\",\n },\n formatError(error)\n ),\n { stdout: process.stderr }\n );\n process.exitCode = 1;\n}\n\nfunction normalizeGlobalOptions(argv: string[]): string[] {\n const normalizedArgv = [...argv];\n\n for (let index = 2; index < normalizedArgv.length; index += 1) {\n const argument = normalizedArgv[index];\n\n if (argument === \"--format\") {\n const value = normalizedArgv[index + 1];\n if (!value || value.startsWith(\"-\")) {\n throw new Error(\"Missing value for --format\");\n }\n\n process.env.CNGKIT_FORMAT = parseOutputFormat(value);\n normalizedArgv.splice(index, 2);\n index -= 1;\n continue;\n }\n\n if (argument.startsWith(\"--format=\")) {\n process.env.CNGKIT_FORMAT = parseOutputFormat(argument.slice(\"--format=\".length));\n normalizedArgv.splice(index, 1);\n index -= 1;\n continue;\n }\n\n if (argument === \"--no-color\" || argument === \"--no-colors\") {\n process.env.CNGKIT_COLOR = \"never\";\n process.env.CNGKIT_NO_COLOR = \"1\";\n normalizedArgv.splice(index, 1);\n index -= 1;\n continue;\n }\n\n if (argument === \"--color\") {\n process.env.CNGKIT_COLOR = \"always\";\n normalizedArgv.splice(index, 1);\n index -= 1;\n continue;\n }\n\n if (argument.startsWith(\"--color=\")) {\n const colorMode = argument.slice(\"--color=\".length);\n process.env.CNGKIT_COLOR =\n colorMode === \"false\" || colorMode === \"never\" ? \"never\" : \"always\";\n normalizedArgv.splice(index, 1);\n index -= 1;\n }\n }\n\n normalizeKnowledgesFindOptions(normalizedArgv);\n return normalizedArgv;\n}\n\nfunction normalizeKnowledgesFindOptions(argv: string[]): void {\n if (argv[2] !== \"knowledges\" || argv[3] !== \"find\") {\n return;\n }\n\n for (let index = 4; index < argv.length; index += 1) {\n if (argv[index] === \"-name\") {\n argv[index] = \"--name\";\n continue;\n }\n\n if (argv[index] === \"-type\") {\n argv[index] = \"--type\";\n continue;\n }\n\n if (argv[index] === \"-maxdepth\") {\n argv[index] = \"--max-depth\";\n }\n }\n}\n\nfunction guardKnownCommand(argv: string[]): void {\n const commandName = argv[2];\n if (commandName === undefined || commandName.startsWith(\"-\")) {\n return;\n }\n\n const knownCommands = new Set([\n \"help\",\n \"login\",\n \"coderoom\",\n \"scrub\",\n \"transcripts\",\n \"knowledges\",\n \"hooks\",\n \"hookify\",\n ]);\n if (!knownCommands.has(commandName)) {\n throw new Error(`Unknown command \"${commandName}\". Run cngkit --help for available commands.`);\n }\n\n guardKnownSubcommand(commandName, argv.slice(3));\n}\n\nfunction guardKnownSubcommand(commandName: string, commandArgs: string[]): void {\n const subcommand = commandArgs.find((argument) => !argument.startsWith(\"-\"));\n if (!subcommand) {\n return;\n }\n\n if (commandName === \"coderoom\") {\n const knownCoderoomSubcommands = new Set([\"share\", \"join\"]);\n if (!knownCoderoomSubcommands.has(subcommand)) {\n throw new Error(`Unknown coderoom command \"${subcommand}\". Use one of: share, join.`);\n }\n }\n\n if (commandName === \"knowledges\") {\n const knownKnowledgesSubcommands = new Set([\n \"status\",\n \"audiences\",\n \"search\",\n \"list\",\n \"files\",\n \"read\",\n \"cat\",\n \"head\",\n \"tail\",\n \"grep\",\n \"glob\",\n \"ls\",\n \"tree\",\n \"find\",\n \"stat\",\n \"realpath\",\n \"help\",\n ]);\n if (!knownKnowledgesSubcommands.has(subcommand)) {\n throw new Error(\n `Unknown knowledges command \"${subcommand}\". Use one of: status, audiences, search, list, files, read, cat, head, tail, grep, glob, ls, tree, find, stat, realpath.`\n );\n }\n }\n\n if (commandName === \"hookify\") {\n const knownHookifySubcommands = new Set([\"ingest\"]);\n if (!knownHookifySubcommands.has(subcommand)) {\n throw new Error(`Unknown hookify command \"${subcommand}\". Use one of: ingest.`);\n }\n }\n\n if (commandName === \"hooks\") {\n const knownHooksSubcommands = new Set([\"install\", \"uninstall\"]);\n if (!knownHooksSubcommands.has(subcommand)) {\n throw new Error(`Unknown hooks command \"${subcommand}\". Use one of: install, uninstall.`);\n }\n }\n}\n","import process from \"node:process\";\nimport { createElement, useEffect, type ReactElement } from \"react\";\nimport { render, useApp } from \"ink\";\n\ntype OutputStream = NodeJS.WriteStream;\n\nexport async function renderOnce(\n element: ReactElement,\n options?: {\n readonly stdout?: OutputStream;\n }\n): Promise<void> {\n const instance = render(createElement(ExitAfterFirstRender, { element }), {\n stdin: process.stdin,\n stdout: options?.stdout ?? process.stdout,\n stderr: process.stderr,\n });\n await instance.waitUntilExit();\n}\n\nfunction ExitAfterFirstRender({ element }: { readonly element: ReactElement }) {\n const { exit } = useApp();\n\n useEffect(() => {\n queueMicrotask(() => exit());\n }, [exit]);\n\n return element;\n}\n","import type { ReactElement } from \"react\";\n\nimport { renderCngkitHelp, renderKnowledgesHelp } from \"./help-specs.js\";\nimport { renderOnce } from \"./render-once.js\";\nimport type { CommandOutput } from \"../shared/output/types.js\";\n\nexport async function printHelpIfRequested(\n argv: string[],\n output?: CommandOutput\n): Promise<boolean> {\n const commandName = argv[2];\n\n if (commandName === undefined || commandName === \"--help\" || commandName === \"-h\") {\n await printHelpComponent(renderCngkitHelp(), output);\n return true;\n }\n\n if (commandName === \"help\") {\n const [topicName, subtopicName] = argv.slice(3);\n const topic =\n (topicName === \"knowledges\" ||\n topicName === \"coderoom\" ||\n topicName === \"hookify\" ||\n topicName === \"hooks\") &&\n subtopicName\n ? `${topicName}-${subtopicName}`\n : topicName;\n await printHelpComponent(renderCngkitHelp(topic), output);\n return true;\n }\n\n const commandArgs = argv.slice(3);\n const helpIndex = commandArgs.findIndex((argument) => argument === \"--help\" || argument === \"-h\");\n\n if (helpIndex < 0) {\n return false;\n }\n\n if (commandName === \"knowledges\") {\n const topic = commandArgs.find(\n (argument, index) => index !== helpIndex && !argument.startsWith(\"-\")\n );\n await printHelpComponent(renderKnowledgesHelp(topic), output);\n return true;\n }\n\n if (commandName === \"coderoom\") {\n const topic = commandArgs.find(\n (argument, index) => index !== helpIndex && !argument.startsWith(\"-\")\n );\n await printHelpComponent(renderCngkitHelp(topic ? `coderoom-${topic}` : \"coderoom\"), output);\n return true;\n }\n\n if (commandName === \"hookify\") {\n const topic = commandArgs.find(\n (argument, index) => index !== helpIndex && !argument.startsWith(\"-\")\n );\n await printHelpComponent(renderCngkitHelp(topic ? `hookify-${topic}` : \"hookify\"), output);\n return true;\n }\n\n if (commandName === \"hooks\") {\n const topic = commandArgs.find(\n (argument, index) => index !== helpIndex && !argument.startsWith(\"-\")\n );\n await printHelpComponent(renderCngkitHelp(topic ? `hooks-${topic}` : \"hooks\"), output);\n return true;\n }\n\n await printHelpComponent(renderCngkitHelp(commandName), output);\n return true;\n}\n\nasync function printHelpComponent(element: ReactElement, output: CommandOutput | undefined): Promise<void> {\n if (output) {\n output.component(element);\n return;\n }\n\n await renderOnce(element);\n}\n"],"mappings":";;;;;;;;;;;;;AAEA,OAAOA,cAAa;AACpB,SAAS,iBAAAC,sBAAqB;AAC9B,SAAS,YAAY;AAErB,OAAO,YAAY;;;ACNnB,OAAO,aAAa;AACpB,SAAS,eAAe,iBAAoC;AAC5D,SAAS,QAAQ,cAAc;AAI/B,eAAsB,WACpB,SACA,SAGe;AACf,QAAM,WAAW,OAAO,cAAc,sBAAsB,EAAE,QAAQ,CAAC,GAAG;AAAA,IACxE,O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MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF,CAAC;AACD,QAAI,CAAC,2BAA2B,IAAI,UAAU,GAAG;AAC/C,YAAM,IAAI;AAAA,QACR,+BAA+B,UAAU;AAAA,MAC3C;AAAA,IACF;AAAA,EACF;AAEA,MAAI,gBAAgB,WAAW;AAC7B,UAAM,0BAA0B,oBAAI,IAAI,CAAC,QAAQ,CAAC;AAClD,QAAI,CAAC,wBAAwB,IAAI,UAAU,GAAG;AAC5C,YAAM,IAAI,MAAM,4BAA4B,UAAU,wBAAwB;AAAA,IAChF;AAAA,EACF;AAEA,MAAI,gBAAgB,SAAS;AAC3B,UAAM,wBAAwB,oBAAI,IAAI,CAAC,WAAW,WAAW,CAAC;AAC9D,QAAI,CAAC,sBAAsB,IAAI,UAAU,GAAG;AAC1C,YAAM,IAAI,MAAM,0BAA0B,UAAU,oCAAoC;AAAA,IAC1F;AAAA,EACF;AACF;","names":["process","createElement","process","createElement"]}
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  renderCngkitHelp
3
- } from "../../chunk-SKK2XLRZ.js";
3
+ } from "../../chunk-JNHW72SU.js";
4
4
  import {
5
5
  GlobalOptionsSchema
6
- } from "../../chunk-NGEWD4BW.js";
6
+ } from "../../chunk-25Q463MH.js";
7
7
  import {
8
8
  CommandRunner
9
- } from "../../chunk-MRXGD6TC.js";
10
- import "../../chunk-WDI43VPW.js";
9
+ } from "../../chunk-TIY4RTXC.js";
10
+ import "../../chunk-DCW4RKLC.js";
11
11
  import "../../chunk-PZ5AY32C.js";
12
12
 
13
13
  // src/commands/coderoom/index.tsx
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  runJoinCommand
3
- } from "../../chunk-E2GLGGKO.js";
4
- import "../../chunk-CIZBVLN5.js";
3
+ } from "../../chunk-KURN5BJ6.js";
4
+ import "../../chunk-N255PYL7.js";
5
5
  import {
6
6
  GlobalOptionsSchema,
7
7
  RequiredRoomCodeArgsSchema
8
- } from "../../chunk-NGEWD4BW.js";
8
+ } from "../../chunk-25Q463MH.js";
9
9
  import {
10
10
  CommandRunner
11
- } from "../../chunk-MRXGD6TC.js";
12
- import "../../chunk-WDI43VPW.js";
11
+ } from "../../chunk-TIY4RTXC.js";
12
+ import "../../chunk-DCW4RKLC.js";
13
13
  import "../../chunk-PZ5AY32C.js";
14
14
 
15
15
  // src/commands/coderoom/join.tsx
@@ -1,27 +1,24 @@
1
1
  import {
2
2
  runShareCommand
3
- } from "../../chunk-E2GLGGKO.js";
4
- import "../../chunk-CIZBVLN5.js";
3
+ } from "../../chunk-KURN5BJ6.js";
4
+ import "../../chunk-N255PYL7.js";
5
5
  import {
6
- GlobalOptionsSchema,
7
- OptionalRoomCodeArgsSchema
8
- } from "../../chunk-NGEWD4BW.js";
6
+ GlobalOptionsSchema
7
+ } from "../../chunk-25Q463MH.js";
9
8
  import {
10
9
  CommandRunner
11
- } from "../../chunk-MRXGD6TC.js";
12
- import "../../chunk-WDI43VPW.js";
10
+ } from "../../chunk-TIY4RTXC.js";
11
+ import "../../chunk-DCW4RKLC.js";
13
12
  import "../../chunk-PZ5AY32C.js";
14
13
 
15
14
  // src/commands/coderoom/share.tsx
16
15
  import { jsx } from "react/jsx-runtime";
17
16
  var description = "Start a live room from the current directory";
18
- var args = OptionalRoomCodeArgsSchema;
19
17
  var options = GlobalOptionsSchema;
20
- function ShareCommand({ args: args2, options: options2 }) {
21
- return /* @__PURE__ */ jsx(CommandRunner, { run: (output) => runShareCommand(args2[0], options2, output) });
18
+ function ShareCommand({ options: options2 }) {
19
+ return /* @__PURE__ */ jsx(CommandRunner, { run: (output) => runShareCommand(options2, output) });
22
20
  }
23
21
  export {
24
- args,
25
22
  ShareCommand as default,
26
23
  description,
27
24
  options
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/commands/coderoom/share.tsx"],"sourcesContent":["import { GlobalOptionsSchema, OptionalRoomCodeArgsSchema } from \"../../cli/options.js\";\nimport { runShareCommand, type ShareCommandOptions } from \"../../features/coderoom/run-coderoom-command.js\";\nimport { CommandRunner } from \"../../cli/command-runner.js\";\n\nexport const description = \"Start a live room from the current directory\";\nexport const args = OptionalRoomCodeArgsSchema;\nexport const options = GlobalOptionsSchema;\n\ntype ShareCommandProps = {\n readonly args: [string?];\n readonly options: ShareCommandOptions;\n};\n\nexport default function ShareCommand({ args, options }: ShareCommandProps) {\n return <CommandRunner run={(output) => runShareCommand(args[0], options, output)} />;\n}\n"],"mappings":";;;;;;;;;;;;;;;AAcS;AAVF,IAAM,cAAc;AACpB,IAAM,OAAO;AACb,IAAM,UAAU;AAOR,SAAR,aAA8B,EAAE,MAAAA,OAAM,SAAAC,SAAQ,GAAsB;AACzE,SAAO,oBAAC,iBAAc,KAAK,CAAC,WAAW,gBAAgBD,MAAK,CAAC,GAAGC,UAAS,MAAM,GAAG;AACpF;","names":["args","options"]}
1
+ {"version":3,"sources":["../../../src/commands/coderoom/share.tsx"],"sourcesContent":["import { GlobalOptionsSchema } from \"../../cli/options.js\";\nimport {\n runShareCommand,\n type ShareCommandOptions,\n} from \"../../features/coderoom/run-coderoom-command.js\";\nimport { CommandRunner } from \"../../cli/command-runner.js\";\n\nexport const description = \"Start a live room from the current directory\";\nexport const options = GlobalOptionsSchema;\n\ntype ShareCommandProps = {\n readonly options: ShareCommandOptions;\n};\n\nexport default function ShareCommand({ options }: ShareCommandProps) {\n return <CommandRunner run={(output) => runShareCommand(options, output)} />;\n}\n"],"mappings":";;;;;;;;;;;;;;AAeS;AARF,IAAM,cAAc;AACpB,IAAM,UAAU;AAMR,SAAR,aAA8B,EAAE,SAAAA,SAAQ,GAAsB;AACnE,SAAO,oBAAC,iBAAc,KAAK,CAAC,WAAW,gBAAgBA,UAAS,MAAM,GAAG;AAC3E;","names":["options"]}
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  renderCngkitHelp
3
- } from "../../chunk-SKK2XLRZ.js";
3
+ } from "../../chunk-JNHW72SU.js";
4
4
  import {
5
5
  GlobalOptionsSchema
6
- } from "../../chunk-NGEWD4BW.js";
6
+ } from "../../chunk-25Q463MH.js";
7
7
  import {
8
8
  CommandRunner
9
- } from "../../chunk-MRXGD6TC.js";
10
- import "../../chunk-WDI43VPW.js";
9
+ } from "../../chunk-TIY4RTXC.js";
10
+ import "../../chunk-DCW4RKLC.js";
11
11
  import "../../chunk-PZ5AY32C.js";
12
12
 
13
13
  // src/commands/hookify/index.tsx
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  createCngApiClient
3
- } from "../../chunk-CIZBVLN5.js";
3
+ } from "../../chunk-N255PYL7.js";
4
4
  import {
5
5
  GlobalOptionsSchema
6
- } from "../../chunk-NGEWD4BW.js";
6
+ } from "../../chunk-25Q463MH.js";
7
7
  import {
8
8
  CommandRunner
9
- } from "../../chunk-MRXGD6TC.js";
10
- import "../../chunk-WDI43VPW.js";
9
+ } from "../../chunk-TIY4RTXC.js";
10
+ import "../../chunk-DCW4RKLC.js";
11
11
  import "../../chunk-PZ5AY32C.js";
12
12
 
13
13
  // src/commands/hookify/ingest.tsx
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  renderCngkitHelp
3
- } from "../../chunk-SKK2XLRZ.js";
3
+ } from "../../chunk-JNHW72SU.js";
4
4
  import {
5
5
  GlobalOptionsSchema
6
- } from "../../chunk-NGEWD4BW.js";
6
+ } from "../../chunk-25Q463MH.js";
7
7
  import {
8
8
  CommandRunner
9
- } from "../../chunk-MRXGD6TC.js";
10
- import "../../chunk-WDI43VPW.js";
9
+ } from "../../chunk-TIY4RTXC.js";
10
+ import "../../chunk-DCW4RKLC.js";
11
11
  import "../../chunk-PZ5AY32C.js";
12
12
 
13
13
  // src/commands/hooks/index.tsx
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  hookToolIds,
3
3
  runHooksInstallCommand
4
- } from "../../chunk-SMTQ3W3F.js";
4
+ } from "../../chunk-3BATDTKU.js";
5
5
  import {
6
6
  GlobalOptionsSchema
7
- } from "../../chunk-NGEWD4BW.js";
7
+ } from "../../chunk-25Q463MH.js";
8
8
  import {
9
9
  CommandRunner
10
- } from "../../chunk-MRXGD6TC.js";
11
- import "../../chunk-WDI43VPW.js";
10
+ } from "../../chunk-TIY4RTXC.js";
11
+ import "../../chunk-DCW4RKLC.js";
12
12
  import "../../chunk-PZ5AY32C.js";
13
13
 
14
14
  // src/commands/hooks/install.tsx
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  hookToolIds,
3
3
  runHooksUninstallCommand
4
- } from "../../chunk-SMTQ3W3F.js";
4
+ } from "../../chunk-3BATDTKU.js";
5
5
  import {
6
6
  GlobalOptionsSchema
7
- } from "../../chunk-NGEWD4BW.js";
7
+ } from "../../chunk-25Q463MH.js";
8
8
  import {
9
9
  CommandRunner
10
- } from "../../chunk-MRXGD6TC.js";
11
- import "../../chunk-WDI43VPW.js";
10
+ } from "../../chunk-TIY4RTXC.js";
11
+ import "../../chunk-DCW4RKLC.js";
12
12
  import "../../chunk-PZ5AY32C.js";
13
13
 
14
14
  // src/commands/hooks/uninstall.tsx
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  renderCngkitHelp
3
- } from "../chunk-SKK2XLRZ.js";
3
+ } from "../chunk-JNHW72SU.js";
4
4
  import {
5
5
  CommandRunner
6
- } from "../chunk-MRXGD6TC.js";
7
- import "../chunk-WDI43VPW.js";
6
+ } from "../chunk-TIY4RTXC.js";
7
+ import "../chunk-DCW4RKLC.js";
8
8
  import "../chunk-PZ5AY32C.js";
9
9
 
10
10
  // src/commands/index.tsx
@@ -1,18 +1,36 @@
1
1
  import {
2
- runKnowAudiencesCommand
3
- } from "../../chunk-NODJM6SH.js";
4
- import "../../chunk-XQGLUQFM.js";
5
- import "../../chunk-SKK2XLRZ.js";
6
- import "../../chunk-CIZBVLN5.js";
2
+ KnowAudienceList
3
+ } from "../../chunk-VMTXY4KQ.js";
4
+ import {
5
+ createKnowledgesApi
6
+ } from "../../chunk-NLAANOBW.js";
7
+ import "../../chunk-AS7FIJWP.js";
8
+ import "../../chunk-N255PYL7.js";
9
+ import {
10
+ formatJson,
11
+ shouldPrintJson
12
+ } from "../../chunk-XQGLUQFM.js";
7
13
  import {
8
14
  JsonOutputOptionsSchema
9
- } from "../../chunk-NGEWD4BW.js";
15
+ } from "../../chunk-25Q463MH.js";
10
16
  import {
11
17
  CommandRunner
12
- } from "../../chunk-MRXGD6TC.js";
13
- import "../../chunk-WDI43VPW.js";
18
+ } from "../../chunk-TIY4RTXC.js";
19
+ import "../../chunk-DCW4RKLC.js";
14
20
  import "../../chunk-PZ5AY32C.js";
15
21
 
22
+ // src/features/knowledges/handlers/audiences.ts
23
+ import { createElement } from "react";
24
+ async function runKnowAudiencesCommand(options2, output, dependencies) {
25
+ const api = dependencies?.api ?? createKnowledgesApi(options2);
26
+ const response = await api.listAudiences();
27
+ if (shouldPrintJson(options2)) {
28
+ output.raw(formatJson(response.data));
29
+ return;
30
+ }
31
+ output.component(createElement(KnowAudienceList, { audiences: response.data.audiences }));
32
+ }
33
+
16
34
  // src/commands/knowledges/audiences.tsx
17
35
  import { jsx } from "react/jsx-runtime";
18
36
  var description = "List valid audience filters";
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/commands/knowledges/audiences.tsx"],"sourcesContent":["import { JsonOutputOptionsSchema } from \"../../cli/options.js\";\nimport { runKnowAudiencesCommand, type KnowAudiencesCommandOptions } from \"../../features/knowledges/run-knowledges-command.js\";\nimport { CommandRunner } from \"../../cli/command-runner.js\";\n\nexport const description = \"List valid audience filters\";\nexport const options = JsonOutputOptionsSchema;\n\ntype AudiencesCommandProps = {\n readonly options: KnowAudiencesCommandOptions;\n};\n\nexport default function AudiencesCommand({ options }: AudiencesCommandProps) {\n return <CommandRunner run={(output) => runKnowAudiencesCommand(options, output)} />;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAYS;AARF,IAAM,cAAc;AACpB,IAAM,UAAU;AAMR,SAAR,iBAAkC,EAAE,SAAAA,SAAQ,GAA0B;AAC3E,SAAO,oBAAC,iBAAc,KAAK,CAAC,WAAW,wBAAwBA,UAAS,MAAM,GAAG;AACnF;","names":["options"]}
1
+ {"version":3,"sources":["../../../src/features/knowledges/handlers/audiences.ts","../../../src/commands/knowledges/audiences.tsx"],"sourcesContent":["import { createElement } from \"react\";\n\nimport { formatJson, shouldPrintJson } from \"../../../shared/command-utils.js\";\nimport type { CommandOutput } from \"../../../shared/output/types.js\";\nimport { createKnowledgesApi, type KnowCommandDependencies } from \"../knowledges-api.js\";\nimport { KnowAudienceList } from \"../knowledges-output.js\";\nimport type { KnowAudiencesCommandOptions } from \"../knowledges-options.js\";\n\nexport async function runKnowAudiencesCommand(\n options: KnowAudiencesCommandOptions,\n output: CommandOutput,\n dependencies?: KnowCommandDependencies\n): Promise<void> {\n const api = dependencies?.api ?? createKnowledgesApi(options);\n const response = await api.listAudiences();\n\n if (shouldPrintJson(options)) {\n output.raw(formatJson(response.data));\n return;\n }\n\n output.component(createElement(KnowAudienceList, { audiences: response.data.audiences }));\n}\n","import { JsonOutputOptionsSchema } from \"../../cli/options.js\";\nimport { runKnowAudiencesCommand } from \"../../features/knowledges/handlers/audiences.js\";\nimport type { KnowAudiencesCommandOptions } from \"../../features/knowledges/knowledges-options.js\";\nimport { CommandRunner } from \"../../cli/command-runner.js\";\n\nexport const description = \"List valid audience filters\";\nexport const options = JsonOutputOptionsSchema;\n\ntype AudiencesCommandProps = {\n readonly options: KnowAudiencesCommandOptions;\n};\n\nexport default function AudiencesCommand({ options }: AudiencesCommandProps) {\n return <CommandRunner run={(output) => runKnowAudiencesCommand(options, output)} />;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,qBAAqB;AAQ9B,eAAsB,wBACpBA,UACA,QACA,cACe;AACf,QAAM,MAAM,cAAc,OAAO,oBAAoBA,QAAO;AAC5D,QAAM,WAAW,MAAM,IAAI,cAAc;AAEzC,MAAI,gBAAgBA,QAAO,GAAG;AAC5B,WAAO,IAAI,WAAW,SAAS,IAAI,CAAC;AACpC;AAAA,EACF;AAEA,SAAO,UAAU,cAAc,kBAAkB,EAAE,WAAW,SAAS,KAAK,UAAU,CAAC,CAAC;AAC1F;;;ACTS;AARF,IAAM,cAAc;AACpB,IAAM,UAAU;AAMR,SAAR,iBAAkC,EAAE,SAAAC,SAAQ,GAA0B;AAC3E,SAAO,oBAAC,iBAAc,KAAK,CAAC,WAAW,wBAAwBA,UAAS,MAAM,GAAG;AACnF;","names":["options","options"]}
@@ -1,19 +1,38 @@
1
1
  import {
2
- runKnowCatCommand
3
- } from "../../chunk-NODJM6SH.js";
2
+ outputRawContent
3
+ } from "../../chunk-BRFWVQI4.js";
4
+ import {
5
+ createKnowledgesApi
6
+ } from "../../chunk-NLAANOBW.js";
7
+ import {
8
+ normalizeCatalogPath
9
+ } from "../../chunk-AS7FIJWP.js";
10
+ import "../../chunk-N255PYL7.js";
4
11
  import "../../chunk-XQGLUQFM.js";
5
- import "../../chunk-SKK2XLRZ.js";
6
- import "../../chunk-CIZBVLN5.js";
7
12
  import {
8
13
  JsonOutputOptionsSchema,
9
14
  RequiredFilePathArgsSchema
10
- } from "../../chunk-NGEWD4BW.js";
15
+ } from "../../chunk-25Q463MH.js";
11
16
  import {
12
17
  CommandRunner
13
- } from "../../chunk-MRXGD6TC.js";
14
- import "../../chunk-WDI43VPW.js";
18
+ } from "../../chunk-TIY4RTXC.js";
19
+ import "../../chunk-DCW4RKLC.js";
15
20
  import "../../chunk-PZ5AY32C.js";
16
21
 
22
+ // src/features/knowledges/handlers/cat.ts
23
+ async function runKnowCatCommand(filePath, options2, output, dependencies) {
24
+ if (!filePath) {
25
+ throw new Error("Missing file_path. Usage: cngkit knowledges cat <file_path>");
26
+ }
27
+ const api = dependencies?.api ?? createKnowledgesApi(options2);
28
+ const response = await api.read({
29
+ filePath: normalizeCatalogPath(filePath),
30
+ offset: 0,
31
+ limit: 2e3
32
+ });
33
+ outputRawContent(response.data, options2, output);
34
+ }
35
+
17
36
  // src/commands/knowledges/cat.tsx
18
37
  import { jsx } from "react/jsx-runtime";
19
38
  var description = "Print a remote catalog file as raw text";
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/commands/knowledges/cat.tsx"],"sourcesContent":["import { JsonOutputOptionsSchema, RequiredFilePathArgsSchema } from \"../../cli/options.js\";\nimport { runKnowCatCommand, type KnowCatCommandOptions } from \"../../features/knowledges/run-knowledges-command.js\";\nimport { CommandRunner } from \"../../cli/command-runner.js\";\n\nexport const description = \"Print a remote catalog file as raw text\";\nexport const args = RequiredFilePathArgsSchema;\nexport const options = JsonOutputOptionsSchema;\n\ntype CatCommandProps = {\n readonly args: [string];\n readonly options: KnowCatCommandOptions;\n};\n\nexport default function CatCommand({ args, options }: CatCommandProps) {\n return <CommandRunner run={(output) => runKnowCatCommand(args[0], options, output)} />;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAcS;AAVF,IAAM,cAAc;AACpB,IAAM,OAAO;AACb,IAAM,UAAU;AAOR,SAAR,WAA4B,EAAE,MAAAA,OAAM,SAAAC,SAAQ,GAAoB;AACrE,SAAO,oBAAC,iBAAc,KAAK,CAAC,WAAW,kBAAkBD,MAAK,CAAC,GAAGC,UAAS,MAAM,GAAG;AACtF;","names":["args","options"]}
1
+ {"version":3,"sources":["../../../src/features/knowledges/handlers/cat.ts","../../../src/commands/knowledges/cat.tsx"],"sourcesContent":["import type { CommandOutput } from \"../../../shared/output/types.js\";\nimport { createKnowledgesApi, type KnowCommandDependencies } from \"../knowledges-api.js\";\nimport { normalizeCatalogPath } from \"../knowledges-input.js\";\nimport type { KnowCatCommandOptions } from \"../knowledges-options.js\";\nimport { outputRawContent } from \"../format/content-format.js\";\n\nexport async function runKnowCatCommand(\n filePath: string | undefined,\n options: KnowCatCommandOptions,\n output: CommandOutput,\n dependencies?: KnowCommandDependencies\n): Promise<void> {\n if (!filePath) {\n throw new Error(\"Missing file_path. Usage: cngkit knowledges cat <file_path>\");\n }\n\n const api = dependencies?.api ?? createKnowledgesApi(options);\n const response = await api.read({\n filePath: normalizeCatalogPath(filePath),\n offset: 0,\n limit: 2000,\n });\n\n outputRawContent(response.data, options, output);\n}\n","import { JsonOutputOptionsSchema, RequiredFilePathArgsSchema } from \"../../cli/options.js\";\nimport { runKnowCatCommand } from \"../../features/knowledges/handlers/cat.js\";\nimport type { KnowCatCommandOptions } from \"../../features/knowledges/knowledges-options.js\";\nimport { CommandRunner } from \"../../cli/command-runner.js\";\n\nexport const description = \"Print a remote catalog file as raw text\";\nexport const args = RequiredFilePathArgsSchema;\nexport const options = JsonOutputOptionsSchema;\n\ntype CatCommandProps = {\n readonly args: [string];\n readonly options: KnowCatCommandOptions;\n};\n\nexport default function CatCommand({ args, options }: CatCommandProps) {\n return <CommandRunner run={(output) => runKnowCatCommand(args[0], options, output)} />;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAMA,eAAsB,kBACpB,UACAA,UACA,QACA,cACe;AACf,MAAI,CAAC,UAAU;AACb,UAAM,IAAI,MAAM,6DAA6D;AAAA,EAC/E;AAEA,QAAM,MAAM,cAAc,OAAO,oBAAoBA,QAAO;AAC5D,QAAM,WAAW,MAAM,IAAI,KAAK;AAAA,IAC9B,UAAU,qBAAqB,QAAQ;AAAA,IACvC,QAAQ;AAAA,IACR,OAAO;AAAA,EACT,CAAC;AAED,mBAAiB,SAAS,MAAMA,UAAS,MAAM;AACjD;;;ACTS;AAVF,IAAM,cAAc;AACpB,IAAM,OAAO;AACb,IAAM,UAAU;AAOR,SAAR,WAA4B,EAAE,MAAAC,OAAM,SAAAC,SAAQ,GAAoB;AACrE,SAAO,oBAAC,iBAAc,KAAK,CAAC,WAAW,kBAAkBD,MAAK,CAAC,GAAGC,UAAS,MAAM,GAAG;AACtF;","names":["options","args","options"]}
@@ -1,22 +1,53 @@
1
1
  import {
2
- runKnowFilesCommand
3
- } from "../../chunk-NODJM6SH.js";
4
- import "../../chunk-XQGLUQFM.js";
5
- import "../../chunk-SKK2XLRZ.js";
6
- import "../../chunk-CIZBVLN5.js";
2
+ KnowTopicFileList
3
+ } from "../../chunk-VMTXY4KQ.js";
4
+ import {
5
+ createKnowledgesApi
6
+ } from "../../chunk-NLAANOBW.js";
7
+ import {
8
+ normalizeAudienceId
9
+ } from "../../chunk-AS7FIJWP.js";
10
+ import "../../chunk-N255PYL7.js";
11
+ import {
12
+ coerceLimit,
13
+ formatJson,
14
+ shouldPrintJson
15
+ } from "../../chunk-XQGLUQFM.js";
7
16
  import {
8
17
  JsonOutputOptionsSchema,
9
18
  OptionalQueryArgsSchema
10
- } from "../../chunk-NGEWD4BW.js";
19
+ } from "../../chunk-25Q463MH.js";
11
20
  import {
12
21
  CommandRunner
13
- } from "../../chunk-MRXGD6TC.js";
14
- import "../../chunk-WDI43VPW.js";
22
+ } from "../../chunk-TIY4RTXC.js";
23
+ import "../../chunk-DCW4RKLC.js";
15
24
  import "../../chunk-PZ5AY32C.js";
16
25
 
17
26
  // src/commands/knowledges/files.tsx
18
27
  import { option } from "pastel";
19
28
  import { z } from "zod";
29
+
30
+ // src/features/knowledges/handlers/files.ts
31
+ import { createElement } from "react";
32
+ async function runKnowFilesCommand(query, options2, output, dependencies) {
33
+ const api = dependencies?.api ?? createKnowledgesApi(options2);
34
+ const response = await api.listFiles({
35
+ query,
36
+ audience: normalizeAudienceId(options2.audience),
37
+ limit: coerceLimit(options2.limit, 25)
38
+ });
39
+ if (shouldPrintJson(options2)) {
40
+ output.raw(formatJson(response.data));
41
+ return;
42
+ }
43
+ if (response.data.files.length > 0) {
44
+ output.component(createElement(KnowTopicFileList, { files: response.data.files }));
45
+ return;
46
+ }
47
+ output.warning("No matching files.");
48
+ }
49
+
50
+ // src/commands/knowledges/files.tsx
20
51
  import { jsx } from "react/jsx-runtime";
21
52
  var description = "List uploaded catalog files";
22
53
  var args = OptionalQueryArgsSchema;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/commands/knowledges/files.tsx"],"sourcesContent":["import { option } from \"pastel\";\nimport { z } from \"zod\";\n\nimport { JsonOutputOptionsSchema, OptionalQueryArgsSchema } from \"../../cli/options.js\";\nimport { runKnowFilesCommand, type KnowFilesCommandOptions } from \"../../features/knowledges/run-knowledges-command.js\";\nimport { CommandRunner } from \"../../cli/command-runner.js\";\n\nexport const description = \"List uploaded catalog files\";\nexport const args = OptionalQueryArgsSchema;\nexport const options = JsonOutputOptionsSchema.extend({\n audience: z\n .string()\n .optional()\n .describe(\n option({\n description: \"Audience filter\",\n valueDescription: \"id\",\n })\n ),\n limit: z\n .number()\n .optional()\n .describe(\n option({\n description: \"Maximum results\",\n valueDescription: \"n\",\n })\n ),\n});\n\ntype FilesCommandProps = {\n readonly args: [string?];\n readonly options: KnowFilesCommandOptions;\n};\n\nexport default function FilesCommand({ args, options }: FilesCommandProps) {\n return <CommandRunner run={(output) => runKnowFilesCommand(args[0], options, output)} />;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA,SAAS,cAAc;AACvB,SAAS,SAAS;AAmCT;AA7BF,IAAM,cAAc;AACpB,IAAM,OAAO;AACb,IAAM,UAAU,wBAAwB,OAAO;AAAA,EACpD,UAAU,EACP,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,aAA8B,EAAE,MAAAA,OAAM,SAAAC,SAAQ,GAAsB;AACzE,SAAO,oBAAC,iBAAc,KAAK,CAAC,WAAW,oBAAoBD,MAAK,CAAC,GAAGC,UAAS,MAAM,GAAG;AACxF;","names":["args","options"]}
1
+ {"version":3,"sources":["../../../src/commands/knowledges/files.tsx","../../../src/features/knowledges/handlers/files.ts"],"sourcesContent":["import { option } from \"pastel\";\nimport { z } from \"zod\";\n\nimport { JsonOutputOptionsSchema, OptionalQueryArgsSchema } from \"../../cli/options.js\";\nimport { runKnowFilesCommand } from \"../../features/knowledges/handlers/files.js\";\nimport type { KnowFilesCommandOptions } from \"../../features/knowledges/knowledges-options.js\";\nimport { CommandRunner } from \"../../cli/command-runner.js\";\n\nexport const description = \"List uploaded catalog files\";\nexport const args = OptionalQueryArgsSchema;\nexport const options = JsonOutputOptionsSchema.extend({\n audience: z\n .string()\n .optional()\n .describe(\n option({\n description: \"Audience filter\",\n valueDescription: \"id\",\n })\n ),\n limit: z\n .number()\n .optional()\n .describe(\n option({\n description: \"Maximum results\",\n valueDescription: \"n\",\n })\n ),\n});\n\ntype FilesCommandProps = {\n readonly args: [string?];\n readonly options: KnowFilesCommandOptions;\n};\n\nexport default function FilesCommand({ args, options }: FilesCommandProps) {\n return <CommandRunner run={(output) => runKnowFilesCommand(args[0], options, output)} />;\n}\n","import { createElement } from \"react\";\n\nimport { coerceLimit, formatJson, shouldPrintJson } from \"../../../shared/command-utils.js\";\nimport type { CommandOutput } from \"../../../shared/output/types.js\";\nimport { createKnowledgesApi, type KnowCommandDependencies } from \"../knowledges-api.js\";\nimport { normalizeAudienceId } from \"../knowledges-input.js\";\nimport { KnowTopicFileList } from \"../knowledges-output.js\";\nimport type { KnowFilesCommandOptions } from \"../knowledges-options.js\";\n\nexport async function runKnowFilesCommand(\n query: string | undefined,\n options: KnowFilesCommandOptions,\n output: CommandOutput,\n dependencies?: KnowCommandDependencies\n): Promise<void> {\n const api = dependencies?.api ?? createKnowledgesApi(options);\n const response = await api.listFiles({\n query,\n audience: normalizeAudienceId(options.audience),\n limit: coerceLimit(options.limit, 25),\n });\n\n if (shouldPrintJson(options)) {\n output.raw(formatJson(response.data));\n return;\n }\n\n if (response.data.files.length > 0) {\n output.component(createElement(KnowTopicFileList, { files: response.data.files }));\n return;\n }\n\n output.warning(\"No matching files.\");\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,cAAc;AACvB,SAAS,SAAS;;;ACDlB,SAAS,qBAAqB;AAS9B,eAAsB,oBACpB,OACAA,UACA,QACA,cACe;AACf,QAAM,MAAM,cAAc,OAAO,oBAAoBA,QAAO;AAC5D,QAAM,WAAW,MAAM,IAAI,UAAU;AAAA,IACnC;AAAA,IACA,UAAU,oBAAoBA,SAAQ,QAAQ;AAAA,IAC9C,OAAO,YAAYA,SAAQ,OAAO,EAAE;AAAA,EACtC,CAAC;AAED,MAAI,gBAAgBA,QAAO,GAAG;AAC5B,WAAO,IAAI,WAAW,SAAS,IAAI,CAAC;AACpC;AAAA,EACF;AAEA,MAAI,SAAS,KAAK,MAAM,SAAS,GAAG;AAClC,WAAO,UAAU,cAAc,mBAAmB,EAAE,OAAO,SAAS,KAAK,MAAM,CAAC,CAAC;AACjF;AAAA,EACF;AAEA,SAAO,QAAQ,oBAAoB;AACrC;;;ADIS;AA7BF,IAAM,cAAc;AACpB,IAAM,OAAO;AACb,IAAM,UAAU,wBAAwB,OAAO;AAAA,EACpD,UAAU,EACP,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,aAA8B,EAAE,MAAAC,OAAM,SAAAC,SAAQ,GAAsB;AACzE,SAAO,oBAAC,iBAAc,KAAK,CAAC,WAAW,oBAAoBD,MAAK,CAAC,GAAGC,UAAS,MAAM,GAAG;AACxF;","names":["options","args","options"]}