cngkit 1.1.14 → 1.1.16
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.
- package/README.md +30 -12
- package/dist/{chunk-Q3F7DVFP.js → chunk-7KQBSEQV.js} +84 -8
- package/dist/chunk-7KQBSEQV.js.map +1 -0
- package/dist/{chunk-AOJSBSHF.js → chunk-F7ZOO3P5.js} +3 -3
- package/dist/{chunk-VQTRHKNP.js → chunk-GZ2DPIU6.js} +40 -30
- package/dist/chunk-GZ2DPIU6.js.map +1 -0
- package/dist/{chunk-ERSRJLYP.js → chunk-MJVMVXV5.js} +15 -15
- package/dist/chunk-MJVMVXV5.js.map +1 -0
- package/dist/{chunk-BXKVJRTD.js → chunk-NRWEU6YQ.js} +21 -13
- package/dist/chunk-NRWEU6YQ.js.map +1 -0
- package/dist/{chunk-JX33GP2L.js → chunk-W7X6HWP5.js} +2 -2
- package/dist/{chunk-QZEB4VMX.js → chunk-XQGLUQFM.js} +5 -1
- package/dist/chunk-XQGLUQFM.js.map +1 -0
- package/dist/cli.js +100 -23
- package/dist/cli.js.map +1 -1
- package/dist/commands/coderoom/index.js +3 -3
- package/dist/commands/coderoom/join.js +4 -5
- package/dist/commands/coderoom/join.js.map +1 -1
- package/dist/commands/coderoom/share.js +4 -5
- package/dist/commands/coderoom/share.js.map +1 -1
- package/dist/commands/index.js +3 -3
- package/dist/commands/knowledges/audiences.js +6 -7
- package/dist/commands/knowledges/audiences.js.map +1 -1
- package/dist/commands/knowledges/files.js +6 -7
- package/dist/commands/knowledges/files.js.map +1 -1
- package/dist/commands/knowledges/glob.js +6 -7
- package/dist/commands/knowledges/glob.js.map +1 -1
- package/dist/commands/knowledges/grep.js +6 -7
- package/dist/commands/knowledges/grep.js.map +1 -1
- package/dist/commands/knowledges/index.js +3 -3
- package/dist/commands/knowledges/list.js +6 -7
- package/dist/commands/knowledges/list.js.map +1 -1
- package/dist/commands/knowledges/read.js +6 -7
- package/dist/commands/knowledges/read.js.map +1 -1
- package/dist/commands/knowledges/search.js +7 -8
- package/dist/commands/knowledges/search.js.map +1 -1
- package/dist/commands/knowledges/status.js +6 -7
- package/dist/commands/knowledges/status.js.map +1 -1
- package/dist/commands/login.js +4 -5
- package/dist/commands/login.js.map +1 -1
- package/dist/commands/scrub.js +2 -2
- package/dist/commands/transcripts.js +8 -7
- package/dist/commands/transcripts.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-BXKVJRTD.js.map +0 -1
- package/dist/chunk-ERSRJLYP.js.map +0 -1
- package/dist/chunk-Q3F7DVFP.js.map +0 -1
- package/dist/chunk-QZEB4VMX.js.map +0 -1
- package/dist/chunk-UZMVTVL2.js +0 -22
- package/dist/chunk-UZMVTVL2.js.map +0 -1
- package/dist/chunk-VQTRHKNP.js.map +0 -1
- /package/dist/{chunk-AOJSBSHF.js.map → chunk-F7ZOO3P5.js.map} +0 -0
- /package/dist/{chunk-JX33GP2L.js.map → chunk-W7X6HWP5.js.map} +0 -0
|
@@ -2,11 +2,15 @@ import {
|
|
|
2
2
|
coerceLimit,
|
|
3
3
|
coerceOptionalNumber,
|
|
4
4
|
formatJson,
|
|
5
|
+
shouldPrintJson,
|
|
5
6
|
singleLine
|
|
6
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-XQGLUQFM.js";
|
|
7
8
|
import {
|
|
8
9
|
createCngApiClient
|
|
9
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-MJVMVXV5.js";
|
|
11
|
+
import {
|
|
12
|
+
resolveOutputFormat
|
|
13
|
+
} from "./chunk-7KQBSEQV.js";
|
|
10
14
|
|
|
11
15
|
// src/features/knowledges/knowledges-api.ts
|
|
12
16
|
function createKnowledgesApi(options) {
|
|
@@ -109,7 +113,7 @@ function normalizeGrepMode(value) {
|
|
|
109
113
|
async function runKnowStatusCommand(options, output, dependencies) {
|
|
110
114
|
const api = dependencies?.api ?? createKnowledgesApi(options);
|
|
111
115
|
const response = await api.getCatalog();
|
|
112
|
-
if (options
|
|
116
|
+
if (shouldPrintJson(options)) {
|
|
113
117
|
output.raw(formatJson(response.data));
|
|
114
118
|
return;
|
|
115
119
|
}
|
|
@@ -118,7 +122,7 @@ async function runKnowStatusCommand(options, output, dependencies) {
|
|
|
118
122
|
`Catalog: ${response.data.name}`,
|
|
119
123
|
`Files: ${response.data.files}`,
|
|
120
124
|
`Blobs: ${response.data.blobs}`,
|
|
121
|
-
`
|
|
125
|
+
`Database: ${response.data.database.engine} (${response.data.database.binding})`
|
|
122
126
|
];
|
|
123
127
|
if (latestRun) {
|
|
124
128
|
lines.push(`Latest run: ${latestRun.status} (${latestRun.id})`);
|
|
@@ -133,7 +137,7 @@ async function runKnowStatusCommand(options, output, dependencies) {
|
|
|
133
137
|
async function runKnowAudiencesCommand(options, output, dependencies) {
|
|
134
138
|
const api = dependencies?.api ?? createKnowledgesApi(options);
|
|
135
139
|
const response = await api.listAudiences();
|
|
136
|
-
if (options
|
|
140
|
+
if (shouldPrintJson(options)) {
|
|
137
141
|
output.raw(formatJson(response.data));
|
|
138
142
|
return;
|
|
139
143
|
}
|
|
@@ -149,7 +153,7 @@ async function runKnowSearchCommand(query, options, output, dependencies) {
|
|
|
149
153
|
}
|
|
150
154
|
const api = dependencies?.api ?? createKnowledgesApi(options);
|
|
151
155
|
const response = await api.search(query, coerceLimit(options.limit, 5));
|
|
152
|
-
if (options
|
|
156
|
+
if (shouldPrintJson(options)) {
|
|
153
157
|
output.raw(formatJson(response.data));
|
|
154
158
|
return;
|
|
155
159
|
}
|
|
@@ -175,7 +179,7 @@ async function runKnowListCommand(query, options, output, dependencies) {
|
|
|
175
179
|
}
|
|
176
180
|
return [subskill.name, subskill.title, subskill.description, subskill.type].join(" ").toLowerCase().includes(normalizedQuery);
|
|
177
181
|
}).slice(0, limit);
|
|
178
|
-
if (options
|
|
182
|
+
if (shouldPrintJson(options)) {
|
|
179
183
|
output.raw(formatJson({ subskills, total: subskills.length }));
|
|
180
184
|
return;
|
|
181
185
|
}
|
|
@@ -197,7 +201,7 @@ async function runKnowFilesCommand(query, options, output, dependencies) {
|
|
|
197
201
|
audience: normalizeAudienceId(options.audience),
|
|
198
202
|
limit: coerceLimit(options.limit, 25)
|
|
199
203
|
});
|
|
200
|
-
if (options
|
|
204
|
+
if (shouldPrintJson(options)) {
|
|
201
205
|
output.raw(formatJson(response.data));
|
|
202
206
|
return;
|
|
203
207
|
}
|
|
@@ -222,11 +226,15 @@ async function runKnowReadCommand(filePath, options, output, dependencies) {
|
|
|
222
226
|
offset: coerceOptionalNumber(options.offset),
|
|
223
227
|
limit: coerceLimit(options.limit, 200, 2e3)
|
|
224
228
|
});
|
|
225
|
-
if (options
|
|
229
|
+
if (shouldPrintJson(options)) {
|
|
226
230
|
output.raw(formatJson(response.data));
|
|
227
231
|
return;
|
|
228
232
|
}
|
|
229
|
-
|
|
233
|
+
if (resolveOutputFormat() === "markdown" || !response.data.file_path.endsWith(".md")) {
|
|
234
|
+
output.raw(response.data.content);
|
|
235
|
+
} else {
|
|
236
|
+
output.markdown(response.data.content);
|
|
237
|
+
}
|
|
230
238
|
if (response.data.truncated) {
|
|
231
239
|
output.warning(
|
|
232
240
|
`[truncated: showing ${response.data.limit} lines from offset ${response.data.offset} of ${response.data.total_lines}]`
|
|
@@ -247,7 +255,7 @@ async function runKnowGrepCommand(pattern, options, output, dependencies) {
|
|
|
247
255
|
context: coerceLimit(options.context, 0, 20),
|
|
248
256
|
ignoreCase: options.caseInsensitive === true
|
|
249
257
|
});
|
|
250
|
-
if (options
|
|
258
|
+
if (shouldPrintJson(options)) {
|
|
251
259
|
output.raw(formatJson(response.data));
|
|
252
260
|
return;
|
|
253
261
|
}
|
|
@@ -290,7 +298,7 @@ async function runKnowGlobCommand(pattern, options, output, dependencies) {
|
|
|
290
298
|
pattern: pattern ?? "**/*.md",
|
|
291
299
|
path: normalizeCatalogPath(options.path ?? "/")
|
|
292
300
|
});
|
|
293
|
-
if (options
|
|
301
|
+
if (shouldPrintJson(options)) {
|
|
294
302
|
output.raw(formatJson(response.data));
|
|
295
303
|
return;
|
|
296
304
|
}
|
|
@@ -316,4 +324,4 @@ export {
|
|
|
316
324
|
runKnowGrepCommand,
|
|
317
325
|
runKnowGlobCommand
|
|
318
326
|
};
|
|
319
|
-
//# sourceMappingURL=chunk-
|
|
327
|
+
//# sourceMappingURL=chunk-NRWEU6YQ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/features/knowledges/knowledges-api.ts","../src/features/knowledges/knowledges-input.ts","../src/features/knowledges/run-knowledges-command.ts"],"sourcesContent":["import type { CngApi } from \"@cng/client\";\n\nimport { createCngApiClient } from \"../../shared/api-client.js\";\nimport type { GlobalCommandOptions } from \"../../shared/config.js\";\n\nexport type KnowCommandDependencies = {\n api?: KnowledgesApi;\n};\n\nexport type KnowledgesApi = {\n getCatalog(): Promise<CngApi.HarnessCatalogSummaryApiResponse>;\n listAudiences(): Promise<CngApi.HarnessAudiencesApiResponse>;\n search(query: string, limit: number): Promise<CngApi.HarnessSemanticSearchApiResponse>;\n listSubskills(): Promise<CngApi.HarnessSubskillsApiResponse>;\n listFiles(options: {\n query?: string;\n audience?: CngApi.HarnessAudienceId;\n limit: number;\n }): Promise<CngApi.HarnessSubskillAssetsApiResponse>;\n read(options: {\n filePath: string;\n offset?: number;\n limit: number;\n }): Promise<CngApi.HarnessReadApiResponse>;\n grep(options: {\n pattern: string;\n path: string;\n include: string;\n mode: CngApi.HarnessGrepOutputMode;\n context: number;\n ignoreCase: boolean;\n }): Promise<CngApi.HarnessGrepApiResponse>;\n glob(options: { pattern: string; path: string }): Promise<CngApi.HarnessGlobApiResponse>;\n};\n\nexport function createKnowledgesApi(options: GlobalCommandOptions): KnowledgesApi {\n const client = createCngApiClient(options);\n\n return {\n getCatalog: () => client.harnessKnowledges.getHarnessKnowledgesCatalog(),\n listAudiences: () => client.harnessKnowledges.listHarnessKnowledgesAudiences(),\n search: (query, limit) =>\n client.harnessKnowledges.searchHarnessKnowledges({\n q: query,\n limit,\n }),\n listSubskills: () => client.harnessKnowledges.listHarnessKnowledgesSubskills(),\n listFiles: ({ query, audience, limit }) =>\n client.harnessKnowledges.listHarnessSubskillAssets({\n ...(query ? { q: query } : {}),\n ...(audience ? { audience } : {}),\n limit,\n }),\n read: ({ filePath, offset, limit }) =>\n client.harnessFilesystem.getHarnessFilesystemRead({\n file_path: filePath,\n offset,\n limit,\n }),\n grep: ({ pattern, path, include, mode, context, ignoreCase }) =>\n client.harnessFilesystem.getHarnessFilesystemGrep({\n pattern,\n path,\n include,\n output_mode: mode,\n context,\n case_insensitive: ignoreCase ? \"true\" : undefined,\n }),\n glob: ({ pattern, path }) =>\n client.harnessFilesystem.getHarnessFilesystemGlob({\n pattern,\n path,\n }),\n };\n}\n","import type { CngApi } from \"@cng/client\";\n\nexport function normalizeAudienceId(value: string | undefined): CngApi.HarnessAudienceId | undefined {\n if (value === undefined) {\n return undefined;\n }\n\n switch (value) {\n case \"all\":\n case \"operators\":\n case \"builders\":\n case \"researchers\":\n case \"agent-makers\":\n return value;\n default:\n throw new Error(\n `Unknown audience \"${value}\". Run cngkit knowledges audiences to see supported values.`\n );\n }\n}\n\nexport function normalizeCatalogPath(value: string): string {\n const trimmed = value.trim();\n if (trimmed === \"/\" || trimmed === \"\") {\n return \"skills\";\n }\n\n const relativePath = trimmed.replace(/^\\/+/, \"\");\n if (relativePath.startsWith(\"skills/knowledges/\")) {\n return relativePath;\n }\n\n const [firstSegment, ...restSegments] = relativePath.split(\"/\");\n if (!firstSegment) {\n return relativePath;\n }\n\n switch (firstSegment) {\n case \"concepts\":\n case \"domains\":\n case \"formats\":\n case \"languages\":\n case \"libraries\":\n case \"patterns\":\n case \"platforms\":\n case \"procedures\":\n case \"protocols\":\n case \"tools\":\n return `skills/knowledges/subskills/${firstSegment}${restSegments.length > 0 ? `/${restSegments.join(\"/\")}` : \"\"}`;\n default:\n return relativePath;\n }\n}\n\nexport function normalizeGrepMode(value: string | undefined): CngApi.HarnessGrepOutputMode {\n if (value === undefined) {\n return \"content\";\n }\n\n switch (value) {\n case \"content\":\n case \"files_with_matches\":\n case \"count\":\n return value;\n default:\n throw new Error(\"Unknown grep mode. Use one of: content, files_with_matches, count.\");\n }\n}\n","import { formatKnowledgesHelp } from \"../../cli/help-specs.js\";\nimport {\n coerceLimit,\n coerceOptionalNumber,\n formatJson,\n optionalJoinedArgument,\n shouldPrintJson,\n singleLine,\n type JsonOutputOptions,\n type NumberOption,\n} from \"../../shared/command-utils.js\";\nimport { resolveOutputFormat } from \"../../shared/config.js\";\nimport type { GlobalCommandOptions } from \"../../shared/config.js\";\nimport type { CommandOutput } from \"../../shared/output.js\";\nimport { createKnowledgesApi, type KnowCommandDependencies } from \"./knowledges-api.js\";\nimport { normalizeAudienceId, normalizeCatalogPath, normalizeGrepMode } from \"./knowledges-input.js\";\n\nexport type KnowStatusCommandOptions = GlobalCommandOptions & JsonOutputOptions;\n\nexport type KnowAudiencesCommandOptions = GlobalCommandOptions & JsonOutputOptions;\n\nexport type KnowSearchCommandOptions = GlobalCommandOptions &\n JsonOutputOptions & {\n limit?: NumberOption;\n };\n\nexport type KnowListCommandOptions = GlobalCommandOptions &\n JsonOutputOptions & {\n limit?: NumberOption;\n };\n\nexport type KnowFilesCommandOptions = GlobalCommandOptions &\n JsonOutputOptions & {\n audience?: string;\n limit?: NumberOption;\n };\n\nexport type KnowReadCommandOptions = GlobalCommandOptions &\n JsonOutputOptions & {\n offset?: NumberOption;\n limit?: NumberOption;\n };\n\nexport type KnowGrepCommandOptions = GlobalCommandOptions &\n JsonOutputOptions & {\n path?: string;\n include?: string;\n outputMode?: string;\n context?: NumberOption;\n caseInsensitive?: boolean;\n limit?: NumberOption;\n };\n\nexport type KnowGlobCommandOptions = GlobalCommandOptions &\n JsonOutputOptions & {\n path?: string;\n limit?: NumberOption;\n };\n\nexport type KnowledgesCliOptions = KnowFilesCommandOptions &\n KnowGlobCommandOptions &\n KnowGrepCommandOptions &\n KnowReadCommandOptions &\n KnowSearchCommandOptions;\n\nexport async function runKnowledgesCommand(\n args: string[] | undefined,\n options: KnowledgesCliOptions,\n output: CommandOutput,\n dependencies?: KnowCommandDependencies\n): Promise<void> {\n const [subcommand, ...subcommandArgs] = args ?? [];\n\n if (subcommand === undefined || subcommand === \"help\") {\n output.markdown(formatKnowledgesHelp(subcommandArgs[0]));\n return;\n }\n\n switch (subcommand) {\n case \"status\":\n return runKnowStatusCommand(options, output, dependencies);\n case \"audiences\":\n return runKnowAudiencesCommand(options, output, dependencies);\n case \"search\":\n return runKnowSearchCommand(optionalJoinedArgument(subcommandArgs), options, output, dependencies);\n case \"list\":\n return runKnowListCommand(optionalJoinedArgument(subcommandArgs), options, output, dependencies);\n case \"files\":\n return runKnowFilesCommand(optionalJoinedArgument(subcommandArgs), options, output, dependencies);\n case \"read\":\n return runKnowReadCommand(subcommandArgs[0], options, output, dependencies);\n case \"grep\":\n return runKnowGrepCommand(optionalJoinedArgument(subcommandArgs), options, output, dependencies);\n case \"glob\":\n return runKnowGlobCommand(optionalJoinedArgument(subcommandArgs), options, output, dependencies);\n default:\n throw new Error(\n \"Missing knowledges command. Usage: cngkit knowledges <status|audiences|search|list|files|read|grep|glob>\"\n );\n }\n}\n\nexport async function runKnowStatusCommand(\n options: KnowStatusCommandOptions,\n output: CommandOutput,\n dependencies?: KnowCommandDependencies\n): Promise<void> {\n const api = dependencies?.api ?? createKnowledgesApi(options);\n const response = await api.getCatalog();\n\n if (shouldPrintJson(options)) {\n output.raw(formatJson(response.data));\n return;\n }\n\n const latestRun = response.data.latestRun;\n const lines = [\n `Catalog: ${response.data.name}`,\n `Files: ${response.data.files}`,\n `Blobs: ${response.data.blobs}`,\n `Database: ${response.data.database.engine} (${response.data.database.binding})`,\n ];\n\n if (latestRun) {\n lines.push(`Latest run: ${latestRun.status} (${latestRun.id})`);\n if (latestRun.updated_at) {\n lines.push(`Updated: ${latestRun.updated_at}`);\n }\n } else {\n lines.push(\"Latest run: none\");\n }\n\n output.info(lines.join(\"\\n\"));\n}\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 const lines = response.data.audiences.flatMap((audience) => [\n `${audience.id} - ${audience.label}`,\n ` ${singleLine(audience.help)}`,\n ]);\n\n output.info(lines.length > 0 ? lines.join(\"\\n\") : \"No audiences available.\");\n}\n\nexport async function runKnowSearchCommand(\n query: string | undefined,\n options: KnowSearchCommandOptions,\n output: CommandOutput,\n dependencies?: KnowCommandDependencies\n): Promise<void> {\n if (!query) {\n throw new Error(\"Missing search query. Usage: cngkit knowledges search <query>\");\n }\n\n const api = dependencies?.api ?? createKnowledgesApi(options);\n const response = await api.search(query, coerceLimit(options.limit, 5));\n\n if (shouldPrintJson(options)) {\n output.raw(formatJson(response.data));\n return;\n }\n\n const lines = response.data.results.flatMap((result, index) => [\n `${index + 1}. ${result.title} (${result.subskillName})`,\n ` score ${result.score.toFixed(3)} | ${result.path}`,\n ` ${singleLine(result.description || result.contentPreview)}`,\n ]);\n\n if (lines.length > 0) {\n output.info(lines.join(\"\\n\"));\n return;\n }\n\n output.warning(`No results for \"${query}\".`);\n}\n\nexport async function runKnowListCommand(\n query: string | undefined,\n options: KnowListCommandOptions,\n output: CommandOutput,\n dependencies?: KnowCommandDependencies\n): Promise<void> {\n const api = dependencies?.api ?? createKnowledgesApi(options);\n const response = await api.listSubskills();\n const limit = coerceLimit(options.limit, 25);\n const normalizedQuery = query?.toLowerCase();\n const subskills = response.data.subskills\n .filter((subskill) => {\n if (!normalizedQuery) {\n return true;\n }\n return [subskill.name, subskill.title, subskill.description, subskill.type]\n .join(\" \")\n .toLowerCase()\n .includes(normalizedQuery);\n })\n .slice(0, limit);\n\n if (shouldPrintJson(options)) {\n output.raw(formatJson({ subskills, total: subskills.length }));\n return;\n }\n\n const lines = subskills.flatMap((subskill) => [\n `${subskill.name} [${subskill.type}]`,\n ` ${subskill.title} | files ${subskill.fileCount} | rating ${subskill.rating}`,\n ` ${singleLine(subskill.description)}`,\n ]);\n\n if (lines.length > 0) {\n output.info(lines.join(\"\\n\"));\n return;\n }\n\n output.warning(\"No matching subskills.\");\n}\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 const lines = response.data.files.map((file) => {\n const title = file.display_title ?? file.title ?? file.subskill_name ?? \"Untitled\";\n return `${file.path}\\n ${title}`;\n });\n\n if (lines.length > 0) {\n output.info(lines.join(\"\\n\"));\n return;\n }\n\n output.warning(\"No matching files.\");\n}\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\nexport async function runKnowGrepCommand(\n pattern: string | undefined,\n options: KnowGrepCommandOptions,\n output: CommandOutput,\n dependencies?: KnowCommandDependencies\n): Promise<void> {\n if (!pattern) {\n throw new Error(\"Missing pattern. Usage: cngkit knowledges grep <pattern>\");\n }\n\n const api = dependencies?.api ?? createKnowledgesApi(options);\n const limit = options.limit !== undefined ? coerceOptionalNumber(options.limit) : undefined;\n const response = await api.grep({\n pattern,\n path: normalizeCatalogPath(options.path ?? \"/\"),\n include: options.include ?? \"*\",\n mode: normalizeGrepMode(options.outputMode),\n context: coerceLimit(options.context, 0, 20),\n ignoreCase: options.caseInsensitive === true,\n });\n\n if (shouldPrintJson(options)) {\n output.raw(formatJson(response.data));\n return;\n }\n\n if (response.data.mode === \"files_with_matches\") {\n const files = limit ? response.data.files.slice(0, limit) : response.data.files;\n if (files.length > 0) {\n output.raw(files.join(\"\\n\"));\n return;\n }\n\n output.warning(`No files matched \"${pattern}\".`);\n return;\n }\n\n if (response.data.mode === \"count\") {\n const counts = limit ? response.data.counts.slice(0, limit) : response.data.counts;\n const lines = counts.map((count) => `${count.file_path}: ${count.match_count}`);\n if (lines.length > 0) {\n output.raw(lines.join(\"\\n\"));\n return;\n }\n\n output.warning(`No matches for \"${pattern}\".`);\n return;\n }\n\n const matches = limit ? response.data.matches.slice(0, limit) : response.data.matches;\n const lines = matches.flatMap((match) => [\n `${match.file_path}:${match.line_number}`,\n ...match.context_before.map((line) => ` ${line}`),\n `> ${match.line}`,\n ...match.context_after.map((line) => ` ${line}`),\n ]);\n\n if (lines.length > 0) {\n output.raw(lines.join(\"\\n\"));\n return;\n }\n\n output.warning(`No matches for \"${pattern}\".`);\n}\n\nexport async function runKnowGlobCommand(\n pattern: string | undefined,\n options: KnowGlobCommandOptions,\n output: CommandOutput,\n dependencies?: KnowCommandDependencies\n): Promise<void> {\n const api = dependencies?.api ?? createKnowledgesApi(options);\n const limit = options.limit !== undefined ? coerceOptionalNumber(options.limit) : undefined;\n const response = await api.glob({\n pattern: pattern ?? \"**/*.md\",\n path: normalizeCatalogPath(options.path ?? \"/\"),\n });\n\n if (shouldPrintJson(options)) {\n output.raw(formatJson(response.data));\n return;\n }\n\n const files = limit ? response.data.files.slice(0, limit) : response.data.files;\n const wasClientTruncated = limit ? response.data.files.length > limit : false;\n\n if (files.length > 0) {\n output.raw(files.join(\"\\n\"));\n } else {\n output.warning(\"No matching files.\");\n }\n if (response.data.truncated || wasClientTruncated) {\n output.warning(`[truncated: ${response.data.total_files} total files]`);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AAmCO,SAAS,oBAAoB,SAA8C;AAChF,QAAM,SAAS,mBAAmB,OAAO;AAEzC,SAAO;AAAA,IACL,YAAY,MAAM,OAAO,kBAAkB,4BAA4B;AAAA,IACvE,eAAe,MAAM,OAAO,kBAAkB,+BAA+B;AAAA,IAC7E,QAAQ,CAAC,OAAO,UACd,OAAO,kBAAkB,wBAAwB;AAAA,MAC/C,GAAG;AAAA,MACH;AAAA,IACF,CAAC;AAAA,IACH,eAAe,MAAM,OAAO,kBAAkB,+BAA+B;AAAA,IAC7E,WAAW,CAAC,EAAE,OAAO,UAAU,MAAM,MACnC,OAAO,kBAAkB,0BAA0B;AAAA,MACjD,GAAI,QAAQ,EAAE,GAAG,MAAM,IAAI,CAAC;AAAA,MAC5B,GAAI,WAAW,EAAE,SAAS,IAAI,CAAC;AAAA,MAC/B;AAAA,IACF,CAAC;AAAA,IACH,MAAM,CAAC,EAAE,UAAU,QAAQ,MAAM,MAC/B,OAAO,kBAAkB,yBAAyB;AAAA,MAChD,WAAW;AAAA,MACX;AAAA,MACA;AAAA,IACF,CAAC;AAAA,IACH,MAAM,CAAC,EAAE,SAAS,MAAM,SAAS,MAAM,SAAS,WAAW,MACzD,OAAO,kBAAkB,yBAAyB;AAAA,MAChD;AAAA,MACA;AAAA,MACA;AAAA,MACA,aAAa;AAAA,MACb;AAAA,MACA,kBAAkB,aAAa,SAAS;AAAA,IAC1C,CAAC;AAAA,IACH,MAAM,CAAC,EAAE,SAAS,KAAK,MACrB,OAAO,kBAAkB,y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AAC;AAED,MAAI,gBAAgB,OAAO,GAAG;AAC5B,WAAO,IAAI,WAAW,SAAS,IAAI,CAAC;AACpC;AAAA,EACF;AAEA,QAAM,QAAQ,QAAQ,SAAS,KAAK,MAAM,MAAM,GAAG,KAAK,IAAI,SAAS,KAAK;AAC1E,QAAM,qBAAqB,QAAQ,SAAS,KAAK,MAAM,SAAS,QAAQ;AAExE,MAAI,MAAM,SAAS,GAAG;AACpB,WAAO,IAAI,MAAM,KAAK,IAAI,CAAC;AAAA,EAC7B,OAAO;AACL,WAAO,QAAQ,oBAAoB;AAAA,EACrC;AACA,MAAI,SAAS,KAAK,aAAa,oBAAoB;AACjD,WAAO,QAAQ,eAAe,SAAS,KAAK,WAAW,eAAe;AAAA,EACxE;AACF;","names":["lines"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createCommandOutput,
|
|
3
3
|
formatError
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-7KQBSEQV.js";
|
|
5
5
|
|
|
6
6
|
// src/cli/command-runner.tsx
|
|
7
7
|
import { useEffect } from "react";
|
|
@@ -23,4 +23,4 @@ function CommandRunner({ run }) {
|
|
|
23
23
|
export {
|
|
24
24
|
CommandRunner
|
|
25
25
|
};
|
|
26
|
-
//# sourceMappingURL=chunk-
|
|
26
|
+
//# sourceMappingURL=chunk-W7X6HWP5.js.map
|
|
@@ -15,6 +15,9 @@ function coerceOptionalNumber(value) {
|
|
|
15
15
|
function formatJson(value) {
|
|
16
16
|
return JSON.stringify(value, null, 2);
|
|
17
17
|
}
|
|
18
|
+
function shouldPrintJson(options) {
|
|
19
|
+
return options.json === true || process.env.CNGKIT_FORMAT?.toLowerCase() === "json";
|
|
20
|
+
}
|
|
18
21
|
function optionalJoinedArgument(values) {
|
|
19
22
|
return values.length > 0 ? values.join(" ") : void 0;
|
|
20
23
|
}
|
|
@@ -26,7 +29,8 @@ export {
|
|
|
26
29
|
coerceLimit,
|
|
27
30
|
coerceOptionalNumber,
|
|
28
31
|
formatJson,
|
|
32
|
+
shouldPrintJson,
|
|
29
33
|
optionalJoinedArgument,
|
|
30
34
|
singleLine
|
|
31
35
|
};
|
|
32
|
-
//# sourceMappingURL=chunk-
|
|
36
|
+
//# sourceMappingURL=chunk-XQGLUQFM.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/shared/command-utils.ts"],"sourcesContent":["export type JsonOutputOptions = {\n json?: boolean;\n};\n\nexport type NumberOption = number | string;\n\nexport function coerceLimit(\n value: NumberOption | undefined,\n defaultValue: number,\n maxValue = 100\n): number {\n const normalizedValue = coerceOptionalNumber(value);\n if (normalizedValue === undefined || Number.isNaN(normalizedValue)) {\n return defaultValue;\n }\n return Math.max(defaultValue === 0 ? 0 : 1, Math.min(maxValue, Math.trunc(normalizedValue)));\n}\n\nexport function coerceOptionalNumber(value: NumberOption | undefined): number | undefined {\n if (value === undefined || value === \"\") {\n return undefined;\n }\n return Number(value);\n}\n\nexport function formatJson(value: unknown): string {\n return JSON.stringify(value, null, 2);\n}\n\nexport function shouldPrintJson(options: JsonOutputOptions): boolean {\n return options.json === true || process.env.CNGKIT_FORMAT?.toLowerCase() === \"json\";\n}\n\nexport function optionalJoinedArgument(values: string[]): string | undefined {\n return values.length > 0 ? values.join(\" \") : undefined;\n}\n\nexport function singleLine(value: string): string {\n return value.replace(/\\s+/g, \" \").trim();\n}\n"],"mappings":";AAMO,SAAS,YACd,OACA,cACA,WAAW,KACH;AACR,QAAM,kBAAkB,qBAAqB,KAAK;AAClD,MAAI,oBAAoB,UAAa,OAAO,MAAM,eAAe,GAAG;AAClE,WAAO;AAAA,EACT;AACA,SAAO,KAAK,IAAI,iBAAiB,IAAI,IAAI,GAAG,KAAK,IAAI,UAAU,KAAK,MAAM,eAAe,CAAC,CAAC;AAC7F;AAEO,SAAS,qBAAqB,OAAqD;AACxF,MAAI,UAAU,UAAa,UAAU,IAAI;AACvC,WAAO;AAAA,EACT;AACA,SAAO,OAAO,KAAK;AACrB;AAEO,SAAS,WAAW,OAAwB;AACjD,SAAO,KAAK,UAAU,OAAO,MAAM,CAAC;AACtC;AAEO,SAAS,gBAAgB,SAAqC;AACnE,SAAO,QAAQ,SAAS,QAAQ,QAAQ,IAAI,eAAe,YAAY,MAAM;AAC/E;AAEO,SAAS,uBAAuB,QAAsC;AAC3E,SAAO,OAAO,SAAS,IAAI,OAAO,KAAK,GAAG,IAAI;AAChD;AAEO,SAAS,WAAW,OAAuB;AAChD,SAAO,MAAM,QAAQ,QAAQ,GAAG,EAAE,KAAK;AACzC;","names":[]}
|
package/dist/cli.js
CHANGED
|
@@ -2,14 +2,13 @@
|
|
|
2
2
|
import {
|
|
3
3
|
formatCngkitHelp,
|
|
4
4
|
formatKnowledgesHelp
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import {
|
|
7
|
-
packageVersion
|
|
8
|
-
} from "./chunk-UZMVTVL2.js";
|
|
5
|
+
} from "./chunk-GZ2DPIU6.js";
|
|
9
6
|
import {
|
|
10
7
|
consoleOutput,
|
|
11
|
-
formatError
|
|
12
|
-
|
|
8
|
+
formatError,
|
|
9
|
+
packageVersion,
|
|
10
|
+
parseOutputFormat
|
|
11
|
+
} from "./chunk-7KQBSEQV.js";
|
|
13
12
|
import "./chunk-PZ5AY32C.js";
|
|
14
13
|
|
|
15
14
|
// src/cli.ts
|
|
@@ -49,42 +48,120 @@ function printMarkdownHelpIfRequested(argv, output = consoleOutput) {
|
|
|
49
48
|
}
|
|
50
49
|
|
|
51
50
|
// src/cli.ts
|
|
52
|
-
var normalizedArgv = normalizeGlobalOptions(process.argv);
|
|
53
|
-
if (printMarkdownHelpIfRequested(normalizedArgv)) {
|
|
54
|
-
process.exit(0);
|
|
55
|
-
}
|
|
56
|
-
var app = new Pastel({
|
|
57
|
-
importMeta: import.meta,
|
|
58
|
-
name: "cngkit",
|
|
59
|
-
version: packageVersion,
|
|
60
|
-
description: "Opinionated Curly.ng CLI kit for Coderoom collaboration and website tooling."
|
|
61
|
-
});
|
|
62
51
|
try {
|
|
52
|
+
const normalizedArgv = normalizeGlobalOptions(process.argv);
|
|
53
|
+
if (printMarkdownHelpIfRequested(normalizedArgv)) {
|
|
54
|
+
process.exit(0);
|
|
55
|
+
}
|
|
56
|
+
guardKnownCommand(normalizedArgv);
|
|
57
|
+
const app = new Pastel({
|
|
58
|
+
importMeta: import.meta,
|
|
59
|
+
name: "cngkit",
|
|
60
|
+
version: packageVersion,
|
|
61
|
+
description: "Opinionated Curly.ng CLI kit for Coderoom collaboration and website tooling."
|
|
62
|
+
});
|
|
63
63
|
await app.run(normalizedArgv);
|
|
64
64
|
} catch (error) {
|
|
65
65
|
console.error(formatError(error));
|
|
66
66
|
process.exitCode = 1;
|
|
67
67
|
}
|
|
68
68
|
function normalizeGlobalOptions(argv) {
|
|
69
|
-
const
|
|
70
|
-
for (let index = 2; index <
|
|
71
|
-
const argument =
|
|
69
|
+
const normalizedArgv = [...argv];
|
|
70
|
+
for (let index = 2; index < normalizedArgv.length; index += 1) {
|
|
71
|
+
const argument = normalizedArgv[index];
|
|
72
72
|
if (argument === "--api-base-url") {
|
|
73
|
-
const value =
|
|
73
|
+
const value = normalizedArgv[index + 1];
|
|
74
74
|
if (!value || value.startsWith("-")) {
|
|
75
75
|
throw new Error("Missing value for --api-base-url");
|
|
76
76
|
}
|
|
77
77
|
process.env.CNGKIT_API_BASE_URL = value;
|
|
78
|
-
|
|
78
|
+
normalizedArgv.splice(index, 2);
|
|
79
79
|
index -= 1;
|
|
80
80
|
continue;
|
|
81
81
|
}
|
|
82
82
|
if (argument.startsWith("--api-base-url=")) {
|
|
83
83
|
process.env.CNGKIT_API_BASE_URL = argument.slice("--api-base-url=".length);
|
|
84
|
-
|
|
84
|
+
normalizedArgv.splice(index, 1);
|
|
85
|
+
index -= 1;
|
|
86
|
+
continue;
|
|
87
|
+
}
|
|
88
|
+
if (argument === "--format") {
|
|
89
|
+
const value = normalizedArgv[index + 1];
|
|
90
|
+
if (!value || value.startsWith("-")) {
|
|
91
|
+
throw new Error("Missing value for --format");
|
|
92
|
+
}
|
|
93
|
+
process.env.CNGKIT_FORMAT = parseOutputFormat(value);
|
|
94
|
+
normalizedArgv.splice(index, 2);
|
|
95
|
+
index -= 1;
|
|
96
|
+
continue;
|
|
97
|
+
}
|
|
98
|
+
if (argument.startsWith("--format=")) {
|
|
99
|
+
process.env.CNGKIT_FORMAT = parseOutputFormat(argument.slice("--format=".length));
|
|
100
|
+
normalizedArgv.splice(index, 1);
|
|
101
|
+
index -= 1;
|
|
102
|
+
continue;
|
|
103
|
+
}
|
|
104
|
+
if (argument === "--no-color" || argument === "--no-colors") {
|
|
105
|
+
process.env.CNGKIT_COLOR = "never";
|
|
106
|
+
process.env.CNGKIT_NO_COLOR = "1";
|
|
107
|
+
normalizedArgv.splice(index, 1);
|
|
108
|
+
index -= 1;
|
|
109
|
+
continue;
|
|
110
|
+
}
|
|
111
|
+
if (argument === "--color") {
|
|
112
|
+
process.env.CNGKIT_COLOR = "always";
|
|
113
|
+
normalizedArgv.splice(index, 1);
|
|
114
|
+
index -= 1;
|
|
115
|
+
continue;
|
|
116
|
+
}
|
|
117
|
+
if (argument.startsWith("--color=")) {
|
|
118
|
+
const colorMode = argument.slice("--color=".length);
|
|
119
|
+
process.env.CNGKIT_COLOR = colorMode === "false" || colorMode === "never" ? "never" : "always";
|
|
120
|
+
normalizedArgv.splice(index, 1);
|
|
85
121
|
index -= 1;
|
|
86
122
|
}
|
|
87
123
|
}
|
|
88
|
-
return
|
|
124
|
+
return normalizedArgv;
|
|
125
|
+
}
|
|
126
|
+
function guardKnownCommand(argv) {
|
|
127
|
+
const commandName = argv[2];
|
|
128
|
+
if (commandName === void 0 || commandName.startsWith("-")) {
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
const knownCommands = /* @__PURE__ */ new Set(["help", "login", "coderoom", "scrub", "transcripts", "knowledges"]);
|
|
132
|
+
if (!knownCommands.has(commandName)) {
|
|
133
|
+
throw new Error(`Unknown command "${commandName}". Run cngkit --help for available commands.`);
|
|
134
|
+
}
|
|
135
|
+
guardKnownSubcommand(commandName, argv.slice(3));
|
|
136
|
+
}
|
|
137
|
+
function guardKnownSubcommand(commandName, commandArgs) {
|
|
138
|
+
const subcommand = commandArgs.find((argument) => !argument.startsWith("-"));
|
|
139
|
+
if (!subcommand) {
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
if (commandName === "coderoom") {
|
|
143
|
+
const knownCoderoomSubcommands = /* @__PURE__ */ new Set(["share", "join"]);
|
|
144
|
+
if (!knownCoderoomSubcommands.has(subcommand)) {
|
|
145
|
+
throw new Error(`Unknown coderoom command "${subcommand}". Use one of: share, join.`);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
if (commandName === "knowledges") {
|
|
149
|
+
const knownKnowledgesSubcommands = /* @__PURE__ */ new Set([
|
|
150
|
+
"status",
|
|
151
|
+
"audiences",
|
|
152
|
+
"search",
|
|
153
|
+
"list",
|
|
154
|
+
"files",
|
|
155
|
+
"read",
|
|
156
|
+
"grep",
|
|
157
|
+
"glob",
|
|
158
|
+
"help"
|
|
159
|
+
]);
|
|
160
|
+
if (!knownKnowledgesSubcommands.has(subcommand)) {
|
|
161
|
+
throw new Error(
|
|
162
|
+
`Unknown knowledges command "${subcommand}". Use one of: status, audiences, search, list, files, read, grep, glob.`
|
|
163
|
+
);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
89
166
|
}
|
|
90
167
|
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/cli.ts","../src/cli/help.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport process from \"node:process\";\n\nimport Pastel from \"pastel\";\n\nimport { printMarkdownHelpIfRequested } from \"./cli/help.js\";\nimport { packageVersion } from \"./shared/config.js\";\nimport { formatError } from \"./shared/output.js\";\n\
|
|
1
|
+
{"version":3,"sources":["../src/cli.ts","../src/cli/help.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport process from \"node:process\";\n\nimport Pastel from \"pastel\";\n\nimport { printMarkdownHelpIfRequested } from \"./cli/help.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 (printMarkdownHelpIfRequested(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 Curly.ng CLI kit for Coderoom collaboration and website tooling.\",\n });\n\n await app.run(normalizedArgv);\n} catch (error) {\n console.error(formatError(error));\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 === \"--api-base-url\") {\n const value = normalizedArgv[index + 1];\n if (!value || value.startsWith(\"-\")) {\n throw new Error(\"Missing value for --api-base-url\");\n }\n\n process.env.CNGKIT_API_BASE_URL = value;\n normalizedArgv.splice(index, 2);\n index -= 1;\n continue;\n }\n\n if (argument.startsWith(\"--api-base-url=\")) {\n process.env.CNGKIT_API_BASE_URL = argument.slice(\"--api-base-url=\".length);\n normalizedArgv.splice(index, 1);\n index -= 1;\n continue;\n }\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 = colorMode === \"false\" || colorMode === \"never\" ? \"never\" : \"always\";\n normalizedArgv.splice(index, 1);\n index -= 1;\n }\n }\n\n return normalizedArgv;\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([\"help\", \"login\", \"coderoom\", \"scrub\", \"transcripts\", \"knowledges\"]);\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 \"grep\",\n \"glob\",\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, grep, glob.`\n );\n }\n }\n}\n","import { formatCngkitHelp, formatKnowledgesHelp } from \"./help-specs.js\";\nimport { consoleOutput, type CommandOutput } from \"../shared/output.js\";\n\nexport function printMarkdownHelpIfRequested(\n argv: string[],\n output: CommandOutput = consoleOutput\n): boolean {\n const commandName = argv[2];\n\n if (commandName === undefined || commandName === \"--help\" || commandName === \"-h\") {\n output.markdown(formatCngkitHelp());\n return true;\n }\n\n if (commandName === \"help\") {\n const [topicName, subtopicName] = argv.slice(3);\n const topic =\n (topicName === \"knowledges\" || topicName === \"coderoom\") && subtopicName\n ? `${topicName}-${subtopicName}`\n : topicName;\n output.markdown(formatCngkitHelp(topic));\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((argument, index) => index !== helpIndex && !argument.startsWith(\"-\"));\n output.markdown(formatKnowledgesHelp(topic));\n return true;\n }\n\n if (commandName === \"coderoom\") {\n const topic = commandArgs.find((argument, index) => index !== helpIndex && !argument.startsWith(\"-\"));\n output.markdown(formatCngkitHelp(topic ? `coderoom-${topic}` : \"coderoom\"));\n return true;\n }\n\n output.markdown(formatCngkitHelp(commandName));\n return true;\n}\n"],"mappings":";;;;;;;;;;;;;;AAEA,OAAO,aAAa;AAEpB,OAAO,YAAY;;;ACDZ,SAAS,6BACd,MACA,SAAwB,eACf;AACT,QAAM,cAAc,KAAK,CAAC;AAE1B,MAAI,gBAAgB,UAAa,gBAAgB,YAAY,gBAAgB,MAAM;AACjF,WAAO,SAAS,iBAAiB,CAAC;AAClC,WAAO;AAAA,EACT;AAEA,MAAI,gBAAgB,QAAQ;AAC1B,UAAM,CAAC,WAAW,YAAY,IAAI,KAAK,MAAM,CAAC;AAC9C,UAAM,SACH,cAAc,gBAAgB,cAAc,eAAe,eACxD,GAAG,SAAS,IAAI,YAAY,KAC5B;AACN,WAAO,SAAS,iBAAiB,KAAK,CAAC;AACvC,WAAO;AAAA,EACT;AAEA,QAAM,cAAc,KAAK,MAAM,CAAC;AAChC,QAAM,YAAY,YAAY,UAAU,CAAC,aAAa,aAAa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D;AAAA,EACF;AAEA,QAAM,gBAAgB,oBAAI,IAAI,CAAC,QAAQ,SAAS,YAAY,SAAS,eAAe,YAAY,CAAC;AACjG,MAAI,CAAC,cAAc,IAAI,WAAW,GAAG;AACnC,UAAM,IAAI,MAAM,oBAAoB,WAAW,8CAA8C;AAAA,EAC/F;AAEA,uBAAqB,aAAa,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,IACF,CAAC;AACD,QAAI,CAAC,2BAA2B,IAAI,UAAU,GAAG;AAC/C,YAAM,IAAI;AAAA,QACR,+BAA+B,UAAU;AAAA,MAC3C;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
formatCngkitHelp
|
|
3
|
-
} from "../../chunk-
|
|
3
|
+
} from "../../chunk-GZ2DPIU6.js";
|
|
4
4
|
import {
|
|
5
5
|
GlobalOptionsSchema
|
|
6
6
|
} from "../../chunk-MLKBG5YJ.js";
|
|
7
7
|
import {
|
|
8
8
|
CommandRunner
|
|
9
|
-
} from "../../chunk-
|
|
10
|
-
import "../../chunk-
|
|
9
|
+
} from "../../chunk-W7X6HWP5.js";
|
|
10
|
+
import "../../chunk-7KQBSEQV.js";
|
|
11
11
|
import "../../chunk-PZ5AY32C.js";
|
|
12
12
|
|
|
13
13
|
// src/commands/coderoom/index.tsx
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
runJoinCommand
|
|
3
|
-
} from "../../chunk-
|
|
4
|
-
import "../../chunk-
|
|
5
|
-
import "../../chunk-UZMVTVL2.js";
|
|
3
|
+
} from "../../chunk-F7ZOO3P5.js";
|
|
4
|
+
import "../../chunk-MJVMVXV5.js";
|
|
6
5
|
import {
|
|
7
6
|
GlobalOptionsSchema,
|
|
8
7
|
RequiredRoomCodeArgsSchema
|
|
9
8
|
} from "../../chunk-MLKBG5YJ.js";
|
|
10
9
|
import {
|
|
11
10
|
CommandRunner
|
|
12
|
-
} from "../../chunk-
|
|
13
|
-
import "../../chunk-
|
|
11
|
+
} from "../../chunk-W7X6HWP5.js";
|
|
12
|
+
import "../../chunk-7KQBSEQV.js";
|
|
14
13
|
import "../../chunk-PZ5AY32C.js";
|
|
15
14
|
|
|
16
15
|
// src/commands/coderoom/join.tsx
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/commands/coderoom/join.tsx"],"sourcesContent":["import { GlobalOptionsSchema, RequiredRoomCodeArgsSchema } from \"../../cli/options.js\";\nimport { runJoinCommand } from \"../../features/coderoom/run-coderoom-command.js\";\nimport type { GlobalCommandOptions } from \"../../shared/config.js\";\nimport { CommandRunner } from \"../../cli/command-runner.js\";\n\nexport const description = \"Join another developer's live room from the current directory\";\nexport const args = RequiredRoomCodeArgsSchema;\nexport const options = GlobalOptionsSchema;\n\ntype JoinCommandProps = {\n readonly args: [string];\n readonly options: GlobalCommandOptions;\n};\n\nexport default function JoinCommand({ args, options }: JoinCommandProps) {\n return <CommandRunner run={(output) => runJoinCommand(args[0], options, output)} />;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../src/commands/coderoom/join.tsx"],"sourcesContent":["import { GlobalOptionsSchema, RequiredRoomCodeArgsSchema } from \"../../cli/options.js\";\nimport { runJoinCommand } from \"../../features/coderoom/run-coderoom-command.js\";\nimport type { GlobalCommandOptions } from \"../../shared/config.js\";\nimport { CommandRunner } from \"../../cli/command-runner.js\";\n\nexport const description = \"Join another developer's live room from the current directory\";\nexport const args = RequiredRoomCodeArgsSchema;\nexport const options = GlobalOptionsSchema;\n\ntype JoinCommandProps = {\n readonly args: [string];\n readonly options: GlobalCommandOptions;\n};\n\nexport default function JoinCommand({ args, options }: JoinCommandProps) {\n return <CommandRunner run={(output) => runJoinCommand(args[0], options, output)} />;\n}\n"],"mappings":";;;;;;;;;;;;;;;AAeS;AAVF,IAAM,cAAc;AACpB,IAAM,OAAO;AACb,IAAM,UAAU;AAOR,SAAR,YAA6B,EAAE,MAAAA,OAAM,SAAAC,SAAQ,GAAqB;AACvE,SAAO,oBAAC,iBAAc,KAAK,CAAC,WAAW,eAAeD,MAAK,CAAC,GAAGC,UAAS,MAAM,GAAG;AACnF;","names":["args","options"]}
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
runShareCommand
|
|
3
|
-
} from "../../chunk-
|
|
4
|
-
import "../../chunk-
|
|
5
|
-
import "../../chunk-UZMVTVL2.js";
|
|
3
|
+
} from "../../chunk-F7ZOO3P5.js";
|
|
4
|
+
import "../../chunk-MJVMVXV5.js";
|
|
6
5
|
import {
|
|
7
6
|
GlobalOptionsSchema,
|
|
8
7
|
OptionalRoomCodeArgsSchema
|
|
9
8
|
} from "../../chunk-MLKBG5YJ.js";
|
|
10
9
|
import {
|
|
11
10
|
CommandRunner
|
|
12
|
-
} from "../../chunk-
|
|
13
|
-
import "../../chunk-
|
|
11
|
+
} from "../../chunk-W7X6HWP5.js";
|
|
12
|
+
import "../../chunk-7KQBSEQV.js";
|
|
14
13
|
import "../../chunk-PZ5AY32C.js";
|
|
15
14
|
|
|
16
15
|
// src/commands/coderoom/share.tsx
|
|
@@ -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":"
|
|
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"]}
|
package/dist/commands/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
formatCngkitHelp
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-GZ2DPIU6.js";
|
|
4
4
|
import {
|
|
5
5
|
CommandRunner
|
|
6
|
-
} from "../chunk-
|
|
7
|
-
import "../chunk-
|
|
6
|
+
} from "../chunk-W7X6HWP5.js";
|
|
7
|
+
import "../chunk-7KQBSEQV.js";
|
|
8
8
|
import "../chunk-PZ5AY32C.js";
|
|
9
9
|
|
|
10
10
|
// src/commands/index.tsx
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
runKnowAudiencesCommand
|
|
3
|
-
} from "../../chunk-
|
|
4
|
-
import "../../chunk-
|
|
5
|
-
import "../../chunk-
|
|
6
|
-
import "../../chunk-
|
|
7
|
-
import "../../chunk-UZMVTVL2.js";
|
|
3
|
+
} from "../../chunk-NRWEU6YQ.js";
|
|
4
|
+
import "../../chunk-XQGLUQFM.js";
|
|
5
|
+
import "../../chunk-GZ2DPIU6.js";
|
|
6
|
+
import "../../chunk-MJVMVXV5.js";
|
|
8
7
|
import {
|
|
9
8
|
JsonOutputOptionsSchema
|
|
10
9
|
} from "../../chunk-MLKBG5YJ.js";
|
|
11
10
|
import {
|
|
12
11
|
CommandRunner
|
|
13
|
-
} from "../../chunk-
|
|
14
|
-
import "../../chunk-
|
|
12
|
+
} from "../../chunk-W7X6HWP5.js";
|
|
13
|
+
import "../../chunk-7KQBSEQV.js";
|
|
15
14
|
import "../../chunk-PZ5AY32C.js";
|
|
16
15
|
|
|
17
16
|
// src/commands/knowledges/audiences.tsx
|
|
@@ -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":"
|
|
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,18 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
runKnowFilesCommand
|
|
3
|
-
} from "../../chunk-
|
|
4
|
-
import "../../chunk-
|
|
5
|
-
import "../../chunk-
|
|
6
|
-
import "../../chunk-
|
|
7
|
-
import "../../chunk-UZMVTVL2.js";
|
|
3
|
+
} from "../../chunk-NRWEU6YQ.js";
|
|
4
|
+
import "../../chunk-XQGLUQFM.js";
|
|
5
|
+
import "../../chunk-GZ2DPIU6.js";
|
|
6
|
+
import "../../chunk-MJVMVXV5.js";
|
|
8
7
|
import {
|
|
9
8
|
JsonOutputOptionsSchema,
|
|
10
9
|
OptionalQueryArgsSchema
|
|
11
10
|
} from "../../chunk-MLKBG5YJ.js";
|
|
12
11
|
import {
|
|
13
12
|
CommandRunner
|
|
14
|
-
} from "../../chunk-
|
|
15
|
-
import "../../chunk-
|
|
13
|
+
} from "../../chunk-W7X6HWP5.js";
|
|
14
|
+
import "../../chunk-7KQBSEQV.js";
|
|
16
15
|
import "../../chunk-PZ5AY32C.js";
|
|
17
16
|
|
|
18
17
|
// src/commands/knowledges/files.tsx
|
|
@@ -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":"
|
|
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,18 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
runKnowGlobCommand
|
|
3
|
-
} from "../../chunk-
|
|
4
|
-
import "../../chunk-
|
|
5
|
-
import "../../chunk-
|
|
6
|
-
import "../../chunk-
|
|
7
|
-
import "../../chunk-UZMVTVL2.js";
|
|
3
|
+
} from "../../chunk-NRWEU6YQ.js";
|
|
4
|
+
import "../../chunk-XQGLUQFM.js";
|
|
5
|
+
import "../../chunk-GZ2DPIU6.js";
|
|
6
|
+
import "../../chunk-MJVMVXV5.js";
|
|
8
7
|
import {
|
|
9
8
|
LimitOptionsSchema,
|
|
10
9
|
OptionalGlobPatternArgsSchema
|
|
11
10
|
} from "../../chunk-MLKBG5YJ.js";
|
|
12
11
|
import {
|
|
13
12
|
CommandRunner
|
|
14
|
-
} from "../../chunk-
|
|
15
|
-
import "../../chunk-
|
|
13
|
+
} from "../../chunk-W7X6HWP5.js";
|
|
14
|
+
import "../../chunk-7KQBSEQV.js";
|
|
16
15
|
import "../../chunk-PZ5AY32C.js";
|
|
17
16
|
|
|
18
17
|
// src/commands/knowledges/glob.tsx
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/commands/knowledges/glob.tsx"],"sourcesContent":["import { option } from \"pastel\";\nimport { z } from \"zod\";\n\nimport { LimitOptionsSchema, OptionalGlobPatternArgsSchema } from \"../../cli/options.js\";\nimport { runKnowGlobCommand, type KnowGlobCommandOptions } from \"../../features/knowledges/run-knowledges-command.js\";\nimport { CommandRunner } from \"../../cli/command-runner.js\";\n\nexport const description = \"Claude-style file discovery\";\nexport const args = OptionalGlobPatternArgsSchema;\nexport const options = LimitOptionsSchema.extend({\n path: z\n .string()\n .optional()\n .describe(\n option({\n description: \"Catalog path prefix\",\n valueDescription: \"path\",\n })\n ),\n});\n\ntype GlobCommandProps = {\n readonly args: string[];\n readonly options: KnowGlobCommandOptions;\n};\n\nexport default function GlobCommand({ args, options }: GlobCommandProps) {\n return <CommandRunner run={(output) => runKnowGlobCommand(args.join(\" \"), options, output)} />;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../src/commands/knowledges/glob.tsx"],"sourcesContent":["import { option } from \"pastel\";\nimport { z } from \"zod\";\n\nimport { LimitOptionsSchema, OptionalGlobPatternArgsSchema } from \"../../cli/options.js\";\nimport { runKnowGlobCommand, type KnowGlobCommandOptions } from \"../../features/knowledges/run-knowledges-command.js\";\nimport { CommandRunner } from \"../../cli/command-runner.js\";\n\nexport const description = \"Claude-style file discovery\";\nexport const args = OptionalGlobPatternArgsSchema;\nexport const options = LimitOptionsSchema.extend({\n path: z\n .string()\n .optional()\n .describe(\n option({\n description: \"Catalog path prefix\",\n valueDescription: \"path\",\n })\n ),\n});\n\ntype GlobCommandProps = {\n readonly args: string[];\n readonly options: KnowGlobCommandOptions;\n};\n\nexport default function GlobCommand({ args, options }: GlobCommandProps) {\n return <CommandRunner run={(output) => runKnowGlobCommand(args.join(\" \"), options, output)} />;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA,SAAS,cAAc;AACvB,SAAS,SAAS;AA0BT;AApBF,IAAM,cAAc;AACpB,IAAM,OAAO;AACb,IAAM,UAAU,mBAAmB,OAAO;AAAA,EAC/C,MAAM,EACH,OAAO,EACP,SAAS,EACT;AAAA,IACC,OAAO;AAAA,MACL,aAAa;AAAA,MACb,kBAAkB;AAAA,IACpB,CAAC;AAAA,EACH;AACJ,CAAC;AAOc,SAAR,YAA6B,EAAE,MAAAA,OAAM,SAAAC,SAAQ,GAAqB;AACvE,SAAO,oBAAC,iBAAc,KAAK,CAAC,WAAW,mBAAmBD,MAAK,KAAK,GAAG,GAAGC,UAAS,MAAM,GAAG;AAC9F;","names":["args","options"]}
|
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
runKnowGrepCommand
|
|
3
|
-
} from "../../chunk-
|
|
4
|
-
import "../../chunk-
|
|
5
|
-
import "../../chunk-
|
|
6
|
-
import "../../chunk-
|
|
7
|
-
import "../../chunk-UZMVTVL2.js";
|
|
3
|
+
} from "../../chunk-NRWEU6YQ.js";
|
|
4
|
+
import "../../chunk-XQGLUQFM.js";
|
|
5
|
+
import "../../chunk-GZ2DPIU6.js";
|
|
6
|
+
import "../../chunk-MJVMVXV5.js";
|
|
8
7
|
import {
|
|
9
8
|
LimitOptionsSchema,
|
|
10
9
|
RequiredPatternArgsSchema
|
|
11
10
|
} from "../../chunk-MLKBG5YJ.js";
|
|
12
11
|
import {
|
|
13
12
|
CommandRunner
|
|
14
|
-
} from "../../chunk-
|
|
15
|
-
import "../../chunk-
|
|
13
|
+
} from "../../chunk-W7X6HWP5.js";
|
|
14
|
+
import "../../chunk-7KQBSEQV.js";
|
|
16
15
|
import "../../chunk-PZ5AY32C.js";
|
|
17
16
|
|
|
18
17
|
// src/commands/knowledges/grep.tsx
|