cngkit 1.1.16 → 1.1.18
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 +23 -17
- package/dist/{chunk-NRWEU6YQ.js → chunk-C7HFDK4S.js} +70 -4
- package/dist/chunk-C7HFDK4S.js.map +1 -0
- package/dist/{chunk-7KQBSEQV.js → chunk-CBIVTEZP.js} +33 -60
- package/dist/chunk-CBIVTEZP.js.map +1 -0
- package/dist/{chunk-MJVMVXV5.js → chunk-FJ34NVQ4.js} +350 -2
- package/dist/chunk-FJ34NVQ4.js.map +1 -0
- package/dist/{chunk-F7ZOO3P5.js → chunk-IB5B3BLY.js} +3 -3
- package/dist/{chunk-GZ2DPIU6.js → chunk-KSW6QT5Q.js} +58 -11
- package/dist/chunk-KSW6QT5Q.js.map +1 -0
- package/dist/{chunk-W7X6HWP5.js → chunk-TWQDLZ6F.js} +2 -2
- package/dist/{chunk-MLKBG5YJ.js → chunk-ZA4YOWPB.js} +10 -9
- package/dist/chunk-ZA4YOWPB.js.map +1 -0
- package/dist/cli.js +31 -22
- package/dist/cli.js.map +1 -1
- package/dist/commands/coderoom/index.js +4 -4
- package/dist/commands/coderoom/join.js +5 -5
- package/dist/commands/coderoom/share.js +5 -5
- package/dist/commands/hookify/index.js +25 -0
- package/dist/commands/hookify/index.js.map +1 -0
- package/dist/commands/hookify/ingest.js +88 -0
- package/dist/commands/hookify/ingest.js.map +1 -0
- package/dist/commands/index.js +3 -3
- package/dist/commands/knowledges/audiences.js +6 -6
- package/dist/commands/knowledges/files.js +6 -6
- package/dist/commands/knowledges/glob.js +6 -6
- package/dist/commands/knowledges/grep.js +6 -6
- package/dist/commands/knowledges/index.js +4 -4
- package/dist/commands/knowledges/list.js +6 -6
- package/dist/commands/knowledges/ls.js +31 -0
- package/dist/commands/knowledges/ls.js.map +1 -0
- package/dist/commands/knowledges/read.js +6 -6
- package/dist/commands/knowledges/search.js +6 -6
- package/dist/commands/knowledges/status.js +6 -6
- package/dist/commands/login.js +3 -3
- package/dist/commands/scrub.js +3 -3
- package/dist/commands/transcripts.js +4 -4
- package/package.json +3 -5
- package/dist/chunk-7KQBSEQV.js.map +0 -1
- package/dist/chunk-GZ2DPIU6.js.map +0 -1
- package/dist/chunk-MJVMVXV5.js.map +0 -1
- package/dist/chunk-MLKBG5YJ.js.map +0 -1
- package/dist/chunk-NRWEU6YQ.js.map +0 -1
- /package/dist/{chunk-F7ZOO3P5.js.map → chunk-IB5B3BLY.js.map} +0 -0
- /package/dist/{chunk-W7X6HWP5.js.map → chunk-TWQDLZ6F.js.map} +0 -0
package/README.md
CHANGED
|
@@ -43,14 +43,16 @@ cngkit scrub [path]
|
|
|
43
43
|
cngkit transcripts list --limit 12
|
|
44
44
|
cngkit knowledges search Cloudflare --limit 3
|
|
45
45
|
cngkit knowledges read /libraries/lib-cloudflare/SUBSKILL.md --limit 80
|
|
46
|
+
printf '{"hook":"PreToolUse"}' | cngkit hookify ingest --event PreToolUse
|
|
46
47
|
```
|
|
47
48
|
|
|
48
|
-
The CLI currently has
|
|
49
|
+
The CLI currently has five main jobs:
|
|
49
50
|
|
|
50
51
|
- **Coderoom**: start or join a live shared working-tree room.
|
|
51
52
|
- **Scrub**: scan local files for secrets and optionally mask them inline.
|
|
52
53
|
- **Transcripts**: inspect local Claude and Codex transcript files from the terminal.
|
|
53
54
|
- **Knowledges**: search and read the hosted Harness knowledge catalog.
|
|
55
|
+
- **Hookify**: forward local hook events to Curly.ng for server-side hook processing.
|
|
54
56
|
|
|
55
57
|
## Coderoom
|
|
56
58
|
|
|
@@ -168,6 +170,20 @@ Safety notes:
|
|
|
168
170
|
- Raw secret values are never printed.
|
|
169
171
|
- `--mask` is accepted as a compatibility alias, but inline changes still require `--yes`.
|
|
170
172
|
|
|
173
|
+
## Hookify
|
|
174
|
+
|
|
175
|
+
`hookify` is the Curly.ng hook processing surface. The first command is intentionally
|
|
176
|
+
small: it reads stdin and forwards the raw payload to the backend.
|
|
177
|
+
|
|
178
|
+
```bash
|
|
179
|
+
cngkit hookify ingest --event PreToolUse < hook-payload.json
|
|
180
|
+
cngkit hookify ingest --event Stop --async < hook-payload.json
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
The backend response controls stdout and the process exit code. If the backend request
|
|
184
|
+
fails, the command falls back to exit code `0` so local hooks do not block work because
|
|
185
|
+
the remote service is unavailable.
|
|
186
|
+
|
|
171
187
|
## Local Agent Transcripts
|
|
172
188
|
|
|
173
189
|
`transcripts` reads local JSONL files from:
|
|
@@ -199,26 +215,14 @@ Transcript commands are local-only. They do not upload transcript content to Cur
|
|
|
199
215
|
By default, they print user and assistant text and skip internal prompt, hook, and tool noise.
|
|
200
216
|
Use `--include-internal` when debugging transcript plumbing.
|
|
201
217
|
|
|
202
|
-
## Backend
|
|
218
|
+
## Backend
|
|
203
219
|
|
|
204
|
-
|
|
220
|
+
`cngkit` always talks to:
|
|
205
221
|
|
|
206
222
|
```text
|
|
207
223
|
https://curly.ng
|
|
208
224
|
```
|
|
209
225
|
|
|
210
|
-
Override the backend for one command:
|
|
211
|
-
|
|
212
|
-
```bash
|
|
213
|
-
cngkit --api-base-url https://curly.ng knowledges status
|
|
214
|
-
```
|
|
215
|
-
|
|
216
|
-
Or with an environment variable:
|
|
217
|
-
|
|
218
|
-
```bash
|
|
219
|
-
CNGKIT_API_BASE_URL=https://curly.ng cngkit knowledges status
|
|
220
|
-
```
|
|
221
|
-
|
|
222
226
|
## Output Format
|
|
223
227
|
|
|
224
228
|
Human-facing output renders as structured terminal text by default, including help
|
|
@@ -247,6 +251,8 @@ cngkit help knowledges
|
|
|
247
251
|
cngkit coderoom --help
|
|
248
252
|
cngkit knowledges read --help
|
|
249
253
|
cngkit transcripts --help
|
|
254
|
+
cngkit hookify --help
|
|
255
|
+
cngkit hookify ingest --help
|
|
250
256
|
```
|
|
251
257
|
|
|
252
258
|
Help uses terminal Markdown rendering in interactive terminals and pipes. Status, warnings,
|
|
@@ -261,7 +267,7 @@ that does not report itself as a TTY.
|
|
|
261
267
|
|
|
262
268
|
- **Pastel** owns command and subcommand routing through files under `src/commands/`.
|
|
263
269
|
- **Ink** owns terminal rendering through built-in components such as `<Text>`.
|
|
264
|
-
-
|
|
270
|
+
- **@inkkit/ink-markdown** owns terminal Markdown rendering for help screens and Markdown catalog reads.
|
|
265
271
|
- **Chalk** owns the cngkit color theme passed into the Markdown renderer.
|
|
266
272
|
- **Zod** owns option and argument schemas for each route.
|
|
267
273
|
|
|
@@ -281,7 +287,7 @@ src/commands/
|
|
|
281
287
|
|
|
282
288
|
The CLI does not hand-roll ANSI escape codes. Status styles go through Ink's built-in
|
|
283
289
|
`<Text color="..." bold dimColor>` support, and help screens render through
|
|
284
|
-
|
|
290
|
+
`@inkkit/ink-markdown` with a shared Chalk-backed theme. Commands that return parse-oriented
|
|
285
291
|
content for agents or shell pipelines write clean lines instead.
|
|
286
292
|
|
|
287
293
|
## For Contributors
|
|
@@ -7,10 +7,10 @@ import {
|
|
|
7
7
|
} from "./chunk-XQGLUQFM.js";
|
|
8
8
|
import {
|
|
9
9
|
createCngApiClient
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-FJ34NVQ4.js";
|
|
11
11
|
import {
|
|
12
12
|
resolveOutputFormat
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-CBIVTEZP.js";
|
|
14
14
|
|
|
15
15
|
// src/features/knowledges/knowledges-api.ts
|
|
16
16
|
function createKnowledgesApi(options) {
|
|
@@ -44,6 +44,13 @@ function createKnowledgesApi(options) {
|
|
|
44
44
|
glob: ({ pattern, path }) => client.harnessFilesystem.getHarnessFilesystemGlob({
|
|
45
45
|
pattern,
|
|
46
46
|
path
|
|
47
|
+
}),
|
|
48
|
+
listDirectory: ({ path, limit }) => client.harnessFilesystem.getHarnessFilesystemLs({
|
|
49
|
+
path,
|
|
50
|
+
limit
|
|
51
|
+
}),
|
|
52
|
+
statPath: ({ path }) => client.harnessFilesystem.getHarnessFilesystemStat({
|
|
53
|
+
path
|
|
47
54
|
})
|
|
48
55
|
};
|
|
49
56
|
}
|
|
@@ -95,6 +102,13 @@ function normalizeCatalogPath(value) {
|
|
|
95
102
|
return relativePath;
|
|
96
103
|
}
|
|
97
104
|
}
|
|
105
|
+
function normalizeFilesystemCatalogPath(value) {
|
|
106
|
+
const trimmed = value.trim();
|
|
107
|
+
if (trimmed === "/" || trimmed === "") {
|
|
108
|
+
return "skills/knowledges/subskills";
|
|
109
|
+
}
|
|
110
|
+
return normalizeCatalogPath(trimmed);
|
|
111
|
+
}
|
|
98
112
|
function normalizeGrepMode(value) {
|
|
99
113
|
if (value === void 0) {
|
|
100
114
|
return "content";
|
|
@@ -313,6 +327,57 @@ async function runKnowGlobCommand(pattern, options, output, dependencies) {
|
|
|
313
327
|
output.warning(`[truncated: ${response.data.total_files} total files]`);
|
|
314
328
|
}
|
|
315
329
|
}
|
|
330
|
+
async function runKnowLsCommand(path, options, output, dependencies) {
|
|
331
|
+
const api = dependencies?.api ?? createKnowledgesApi(options);
|
|
332
|
+
const response = await api.listDirectory({
|
|
333
|
+
path: normalizeFilesystemCatalogPath(path ?? "/"),
|
|
334
|
+
limit: coerceLimit(options.limit, 100, 1e3)
|
|
335
|
+
});
|
|
336
|
+
if (shouldPrintJson(options)) {
|
|
337
|
+
output.raw(formatJson(response.data));
|
|
338
|
+
return;
|
|
339
|
+
}
|
|
340
|
+
const entries = [...response.data.entries].sort(compareFilesystemEntries);
|
|
341
|
+
const lines = entries.map(formatFilesystemEntryLine);
|
|
342
|
+
if (lines.length > 0) {
|
|
343
|
+
output.raw(lines.join("\n"));
|
|
344
|
+
} else {
|
|
345
|
+
output.warning(`No entries under ${response.data.path}.`);
|
|
346
|
+
}
|
|
347
|
+
if (response.data.truncated) {
|
|
348
|
+
output.warning(`[truncated: ${response.data.total_entries} total entries]`);
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
function compareFilesystemEntries(left, right) {
|
|
352
|
+
if (left.type !== right.type) {
|
|
353
|
+
return left.type === "directory" ? -1 : 1;
|
|
354
|
+
}
|
|
355
|
+
return left.path.localeCompare(right.path);
|
|
356
|
+
}
|
|
357
|
+
function formatFilesystemEntryLine(entry) {
|
|
358
|
+
const fields = [
|
|
359
|
+
entry.type,
|
|
360
|
+
entry.path,
|
|
361
|
+
...formatOptionalEntryFields([
|
|
362
|
+
["size", entry.size],
|
|
363
|
+
["files", entry.file_count],
|
|
364
|
+
["children", entry.child_count],
|
|
365
|
+
["total_size", entry.total_size],
|
|
366
|
+
["sha256", entry.sha256],
|
|
367
|
+
["asset_kind", entry.asset_kind],
|
|
368
|
+
["subskill", entry.subskill_name]
|
|
369
|
+
])
|
|
370
|
+
];
|
|
371
|
+
return fields.join(" ");
|
|
372
|
+
}
|
|
373
|
+
function formatOptionalEntryFields(fields) {
|
|
374
|
+
return fields.flatMap(([key, value]) => {
|
|
375
|
+
if (value === null || value === "") {
|
|
376
|
+
return [];
|
|
377
|
+
}
|
|
378
|
+
return [`${key}=${value}`];
|
|
379
|
+
});
|
|
380
|
+
}
|
|
316
381
|
|
|
317
382
|
export {
|
|
318
383
|
runKnowStatusCommand,
|
|
@@ -322,6 +387,7 @@ export {
|
|
|
322
387
|
runKnowFilesCommand,
|
|
323
388
|
runKnowReadCommand,
|
|
324
389
|
runKnowGrepCommand,
|
|
325
|
-
runKnowGlobCommand
|
|
390
|
+
runKnowGlobCommand,
|
|
391
|
+
runKnowLsCommand
|
|
326
392
|
};
|
|
327
|
-
//# sourceMappingURL=chunk-
|
|
393
|
+
//# sourceMappingURL=chunk-C7HFDK4S.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 listDirectory(options: {\n path: string;\n limit: number;\n }): Promise<CngApi.HarnessFilesystemLsApiResponse>;\n statPath(options: { path: string }): Promise<CngApi.HarnessFilesystemStatApiResponse>;\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 listDirectory: ({ path, limit }) =>\n client.harnessFilesystem.getHarnessFilesystemLs({\n path,\n limit,\n }),\n statPath: ({ path }) =>\n client.harnessFilesystem.getHarnessFilesystemStat({\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 normalizeFilesystemCatalogPath(value: string): string {\n const trimmed = value.trim();\n if (trimmed === \"/\" || trimmed === \"\") {\n return \"skills/knowledges/subskills\";\n }\n\n return normalizeCatalogPath(trimmed);\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 type { CngApi } from \"@cng/client\";\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 {\n normalizeAudienceId,\n normalizeCatalogPath,\n normalizeFilesystemCatalogPath,\n normalizeGrepMode,\n} 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 KnowLsCommandOptions = GlobalCommandOptions &\n JsonOutputOptions & {\n limit?: NumberOption;\n };\n\nexport type KnowStatCommandOptions = GlobalCommandOptions & JsonOutputOptions;\n\nexport type KnowRealpathCommandOptions = GlobalCommandOptions & JsonOutputOptions;\n\nexport type KnowledgesCliOptions = KnowFilesCommandOptions &\n KnowGlobCommandOptions &\n KnowGrepCommandOptions &\n KnowReadCommandOptions &\n KnowSearchCommandOptions &\n KnowLsCommandOptions;\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 case \"ls\":\n return runKnowLsCommand(subcommandArgs[0], options, output, dependencies);\n case \"stat\":\n return runKnowStatCommand(subcommandArgs[0], options, output, dependencies);\n case \"realpath\":\n return runKnowRealpathCommand(subcommandArgs[0], options, output);\n default:\n throw new Error(\n \"Missing knowledges command. Usage: cngkit knowledges <status|audiences|search|list|files|read|grep|glob|ls|stat|realpath>\"\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\nexport async function runKnowLsCommand(\n path: string | undefined,\n options: KnowLsCommandOptions,\n output: CommandOutput,\n dependencies?: KnowCommandDependencies\n): Promise<void> {\n const api = dependencies?.api ?? createKnowledgesApi(options);\n const response = await api.listDirectory({\n path: normalizeFilesystemCatalogPath(path ?? \"/\"),\n limit: coerceLimit(options.limit, 100, 1000),\n });\n\n if (shouldPrintJson(options)) {\n output.raw(formatJson(response.data));\n return;\n }\n\n const entries = [...response.data.entries].sort(compareFilesystemEntries);\n const lines = entries.map(formatFilesystemEntryLine);\n\n if (lines.length > 0) {\n output.raw(lines.join(\"\\n\"));\n } else {\n output.warning(`No entries under ${response.data.path}.`);\n }\n\n if (response.data.truncated) {\n output.warning(`[truncated: ${response.data.total_entries} total entries]`);\n }\n}\n\nexport async function runKnowStatCommand(\n path: string | undefined,\n options: KnowStatCommandOptions,\n output: CommandOutput,\n dependencies?: KnowCommandDependencies\n): Promise<void> {\n if (!path) {\n throw new Error(\"Missing path. Usage: cngkit knowledges stat <path>\");\n }\n\n const api = dependencies?.api ?? createKnowledgesApi(options);\n const response = await api.statPath({\n path: normalizeFilesystemCatalogPath(path),\n });\n\n if (shouldPrintJson(options)) {\n output.raw(formatJson(response.data));\n return;\n }\n\n output.raw(formatFilesystemStat(response.data));\n}\n\nexport async function runKnowRealpathCommand(\n path: string | undefined,\n options: KnowRealpathCommandOptions,\n output: CommandOutput\n): Promise<void> {\n if (!path) {\n throw new Error(\"Missing path. Usage: cngkit knowledges realpath <path>\");\n }\n\n const resolvedPath = normalizeFilesystemCatalogPath(path);\n if (shouldPrintJson(options)) {\n output.raw(formatJson({ path: resolvedPath }));\n return;\n }\n\n output.raw(resolvedPath);\n}\n\nfunction 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\nfunction formatFilesystemEntryLine(entry: CngApi.HarnessFilesystemEntry): string {\n const fields = [\n entry.type,\n 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 [\"subskill\", entry.subskill_name],\n ]),\n ];\n\n return fields.join(\"\\t\");\n}\n\nfunction formatFilesystemStat(entry: CngApi.HarnessFilesystemStatResponse): string {\n const fields: Array<[string, string | number | null]> = [\n [\"path\", 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 [\"subskill\", entry.subskill_name],\n [\"updated_at\", entry.updated_at],\n ];\n\n return formatOptionalEntryFields(fields).join(\"\\n\");\n}\n\nfunction formatOptionalEntryFields(fields: Array<[string, string | number | null]>): string[] {\n return fields.flatMap(([key, value]) => {\n if (value === null || value === \"\") {\n return [];\n }\n\n return [`${key}=${value}`];\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;AAwCO,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,yBAAyB;AAAA,MAChD;AAAA,MACA;AAAA,IACF,CAAC;AAAA,IACH,eAAe,CAAC,EAAE,MAAM,MAAM,MAC5B,OAAO,kBAAkB,uBAAuB;AAAA,MAC9C;AAAA,MACA;AAAA,IACF,CAAC;AAAA,IACH,UAAU,CAAC,EAAE,KAAK,MAChB,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AK,WAAW;AAC3B,WAAO,QAAQ,eAAe,SAAS,KAAK,aAAa,iBAAiB;AAAA,EAC5E;AACF;AA2CA,SAAS,yBACP,MACA,OACQ;AACR,MAAI,KAAK,SAAS,MAAM,MAAM;AAC5B,WAAO,KAAK,SAAS,cAAc,KAAK;AAAA,EAC1C;AAEA,SAAO,KAAK,KAAK,cAAc,MAAM,IAAI;AAC3C;AAEA,SAAS,0BAA0B,OAA8C;AAC/E,QAAM,SAAS;AAAA,IACb,MAAM;AAAA,IACN,MAAM;AAAA,IACN,GAAG,0BAA0B;AAAA,MAC3B,CAAC,QAAQ,MAAM,IAAI;AAAA,MACnB,CAAC,SAAS,MAAM,UAAU;AAAA,MAC1B,CAAC,YAAY,MAAM,WAAW;AAAA,MAC9B,CAAC,cAAc,MAAM,UAAU;AAAA,MAC/B,CAAC,UAAU,MAAM,MAAM;AAAA,MACvB,CAAC,cAAc,MAAM,UAAU;AAAA,MAC/B,CAAC,YAAY,MAAM,aAAa;AAAA,IAClC,CAAC;AAAA,EACH;AAEA,SAAO,OAAO,KAAK,GAAI;AACzB;AAsBA,SAAS,0BAA0B,QAA2D;AAC5F,SAAO,OAAO,QAAQ,CAAC,CAAC,KAAK,KAAK,MAAM;AACtC,QAAI,UAAU,QAAQ,UAAU,IAAI;AAClC,aAAO,CAAC;AAAA,IACV;AAEA,WAAO,CAAC,GAAG,GAAG,IAAI,KAAK,EAAE;AAAA,EAC3B,CAAC;AACH;","names":["lines"]}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
// src/shared/config.ts
|
|
2
2
|
import { randomBytes, randomUUID } from "crypto";
|
|
3
3
|
import process from "process";
|
|
4
|
-
var packageVersion = "1.1.
|
|
4
|
+
var packageVersion = "1.1.18";
|
|
5
5
|
var defaultApiBaseUrl = "https://curly.ng";
|
|
6
6
|
function resolveApiBaseUrl(options) {
|
|
7
|
-
|
|
7
|
+
void options;
|
|
8
|
+
return defaultApiBaseUrl;
|
|
8
9
|
}
|
|
9
10
|
function resolveOutputFormat() {
|
|
10
11
|
const value = process.env.CNGKIT_FORMAT?.toLowerCase();
|
|
@@ -29,15 +30,13 @@ function createPeerId() {
|
|
|
29
30
|
|
|
30
31
|
// src/shared/output.ts
|
|
31
32
|
import process2 from "process";
|
|
32
|
-
import { Marked } from "marked";
|
|
33
|
-
import { markedTerminal } from "marked-terminal";
|
|
34
33
|
import { createElement } from "react";
|
|
35
34
|
import { renderToString, Text } from "ink";
|
|
36
|
-
import
|
|
35
|
+
import Markdown from "@inkkit/ink-markdown";
|
|
36
|
+
import stripAnsi from "strip-ansi";
|
|
37
37
|
|
|
38
38
|
// src/shared/theme.ts
|
|
39
39
|
import { Chalk } from "chalk";
|
|
40
|
-
import stripAnsi from "strip-ansi";
|
|
41
40
|
var statusStylePropsByOutputStyle = {
|
|
42
41
|
info: {
|
|
43
42
|
color: "cyan"
|
|
@@ -78,40 +77,13 @@ function createMarkdownTheme(useColor) {
|
|
|
78
77
|
link: chalk.blueBright,
|
|
79
78
|
href: chalk.blue.underline,
|
|
80
79
|
text: identity,
|
|
81
|
-
showSectionPrefix:
|
|
80
|
+
showSectionPrefix: false,
|
|
82
81
|
reflowText: true,
|
|
83
82
|
unescape: true,
|
|
84
83
|
emoji: false,
|
|
85
84
|
tab: 2
|
|
86
85
|
};
|
|
87
86
|
}
|
|
88
|
-
function decorateMarkdownOutput(output) {
|
|
89
|
-
const chalk = new Chalk({ level: 1 });
|
|
90
|
-
const decoratedLines = output.split("\n").map((line) => {
|
|
91
|
-
const plainLine = stripAnsi(line);
|
|
92
|
-
if (plainLine.startsWith("# ")) {
|
|
93
|
-
return chalk.magentaBright.bold(plainLine);
|
|
94
|
-
}
|
|
95
|
-
if (plainLine.startsWith("## ")) {
|
|
96
|
-
return chalk.blueBright.bold(plainLine);
|
|
97
|
-
}
|
|
98
|
-
return line;
|
|
99
|
-
}).join("\n");
|
|
100
|
-
return decoratedLines.replace(/`([^`\n]+)`/g, (_match, value) => chalk.cyanBright(value)).replace(/(^|\s)(--[a-z][a-z0-9-]*)/g, (_match, prefix, flag) => {
|
|
101
|
-
return `${prefix}${chalk.yellow(flag)}`;
|
|
102
|
-
}).replace(/(https?:\/\/[^\s)]+)/g, (url) => chalk.blueBright.underline(url)).replace(/^(\s*)\*\s+/gm, (_match, prefix) => {
|
|
103
|
-
return `${prefix}${chalk.magentaBright("-")} `;
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
function normalizeRenderedMarkdownOutput(output) {
|
|
107
|
-
return output.split("\n").map((line) => {
|
|
108
|
-
const headingMatch = line.match(/^(\s*)#{1,6}\s+(.+)$/);
|
|
109
|
-
if (headingMatch) {
|
|
110
|
-
return `${headingMatch[1]}${headingMatch[2]}`;
|
|
111
|
-
}
|
|
112
|
-
return line.replace(/^(\s*)\*\s+/, "$1- ");
|
|
113
|
-
}).join("\n").replace(/`([^`\n]+)`/g, "$1");
|
|
114
|
-
}
|
|
115
87
|
|
|
116
88
|
// src/shared/output.ts
|
|
117
89
|
var consoleOutput = createCommandOutput(process2.stdout, process2.stderr);
|
|
@@ -173,47 +145,45 @@ function formatMarkdownMessage(stream, markdown) {
|
|
|
173
145
|
}
|
|
174
146
|
const useColor = shouldRenderColor(stream);
|
|
175
147
|
const markdownWidth = clampMarkdownWidth(stream.columns);
|
|
176
|
-
const parser = new Marked();
|
|
177
|
-
parser.use(
|
|
178
|
-
markedTerminal({
|
|
179
|
-
...createMarkdownTheme(false),
|
|
180
|
-
width: markdownWidth
|
|
181
|
-
})
|
|
182
|
-
);
|
|
183
148
|
const preparedMarkdown = prepareMarkdownForTerminal(markdown);
|
|
184
|
-
const renderedMarkdown =
|
|
185
|
-
|
|
149
|
+
const renderedMarkdown = renderToString(
|
|
150
|
+
createElement(
|
|
151
|
+
Markdown,
|
|
152
|
+
{
|
|
153
|
+
...createMarkdownTheme(useColor),
|
|
154
|
+
children: preparedMarkdown,
|
|
155
|
+
width: markdownWidth
|
|
156
|
+
}
|
|
157
|
+
),
|
|
158
|
+
{
|
|
159
|
+
columns: markdownWidth
|
|
160
|
+
}
|
|
186
161
|
);
|
|
187
|
-
return useColor ?
|
|
162
|
+
return useColor ? renderedMarkdown.trimEnd() : stripAnsi(renderedMarkdown).trimEnd();
|
|
188
163
|
}
|
|
189
164
|
function prepareMarkdownForTerminal(markdown) {
|
|
190
165
|
if (!markdown.startsWith("---\n")) {
|
|
191
|
-
return
|
|
166
|
+
return markdown;
|
|
192
167
|
}
|
|
193
168
|
const frontmatterEndIndex = markdown.indexOf("\n---", 4);
|
|
194
169
|
if (frontmatterEndIndex < 0) {
|
|
195
|
-
return
|
|
196
|
-
prefix: formatFrontmatterForTerminal(markdown.slice(4).trimEnd()),
|
|
197
|
-
body: ""
|
|
198
|
-
};
|
|
170
|
+
return formatFrontmatterForTerminal(markdown.slice(4).trimEnd());
|
|
199
171
|
}
|
|
200
172
|
const frontmatter = markdown.slice(4, frontmatterEndIndex).trimEnd();
|
|
201
173
|
const body = markdown.slice(frontmatterEndIndex + "\n---".length).replace(/^\n+/, "");
|
|
202
|
-
return {
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
};
|
|
174
|
+
return `${formatFrontmatterForTerminal(frontmatter)}
|
|
175
|
+
|
|
176
|
+
${body}`;
|
|
206
177
|
}
|
|
207
178
|
function formatFrontmatterForTerminal(frontmatter) {
|
|
208
|
-
|
|
209
|
-
return `Metadata
|
|
210
|
-
|
|
211
|
-
${formattedFrontmatter}
|
|
179
|
+
return `## Metadata
|
|
212
180
|
|
|
213
|
-
|
|
181
|
+
\`\`\`yaml
|
|
182
|
+
${frontmatter}
|
|
183
|
+
\`\`\``;
|
|
214
184
|
}
|
|
215
185
|
function shouldRenderColor(stream) {
|
|
216
|
-
if (process2.env.
|
|
186
|
+
if (process2.env.CNGKIT_NO_COLOR === "1") {
|
|
217
187
|
return false;
|
|
218
188
|
}
|
|
219
189
|
const colorMode = process2.env.CNGKIT_COLOR?.toLowerCase();
|
|
@@ -226,6 +196,9 @@ function shouldRenderColor(stream) {
|
|
|
226
196
|
if (process2.env.FORCE_COLOR !== void 0 && process2.env.FORCE_COLOR !== "0") {
|
|
227
197
|
return true;
|
|
228
198
|
}
|
|
199
|
+
if (process2.env.NO_COLOR !== void 0) {
|
|
200
|
+
return false;
|
|
201
|
+
}
|
|
229
202
|
return stream.isTTY === true;
|
|
230
203
|
}
|
|
231
204
|
function clampMarkdownWidth(columns) {
|
|
@@ -246,4 +219,4 @@ export {
|
|
|
246
219
|
createCommandOutput,
|
|
247
220
|
formatError
|
|
248
221
|
};
|
|
249
|
-
//# sourceMappingURL=chunk-
|
|
222
|
+
//# sourceMappingURL=chunk-CBIVTEZP.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/shared/config.ts","../src/shared/output.ts","../src/shared/theme.ts"],"sourcesContent":["import { randomBytes, randomUUID } from \"node:crypto\";\nimport process from \"node:process\";\n\nexport const packageVersion = \"1.1.18\";\nexport const defaultApiBaseUrl = \"https://curly.ng\";\nexport const outputFormats = [\"text\", \"json\", \"markdown\"] as const;\n\nexport type OutputFormat = (typeof outputFormats)[number];\n\nexport type GlobalCommandOptions = {\n readonly apiBaseUrl?: never;\n};\n\nexport function resolveApiBaseUrl(options: GlobalCommandOptions): string {\n void options;\n return defaultApiBaseUrl;\n}\n\nexport function resolveOutputFormat(): OutputFormat {\n const value = process.env.CNGKIT_FORMAT?.toLowerCase();\n if (value === \"json\" || value === \"markdown\") {\n return value;\n }\n\n return \"text\";\n}\n\nexport function parseOutputFormat(value: string): OutputFormat {\n const normalizedValue = value.toLowerCase();\n if (normalizedValue === \"text\" || normalizedValue === \"json\" || normalizedValue === \"markdown\") {\n return normalizedValue;\n }\n\n throw new Error(\"Unknown --format value. Use one of: text, json, markdown.\");\n}\n\nexport function createRoomCode(): string {\n return randomBytes(4).toString(\"hex\").toUpperCase();\n}\n\nexport function createPeerId(): string {\n return randomUUID();\n}\n","import process from \"node:process\";\nimport { createElement } from \"react\";\nimport { renderToString, Text } from \"ink\";\nimport Markdown from \"@inkkit/ink-markdown\";\nimport stripAnsi from \"strip-ansi\";\nimport {\n createMarkdownTheme,\n statusStylePropsByOutputStyle,\n type OutputStyle,\n} from \"./theme.js\";\nimport { resolveOutputFormat } from \"./config.js\";\n\ntype OutputStream = NodeJS.WriteStream & {\n isTTY?: boolean;\n columns?: number;\n};\n\nexport type CommandOutput = {\n info(message: string): void;\n success(message: string): void;\n warning(message: string): void;\n muted(message: string): void;\n markdown(message: string): void;\n raw(message: string): void;\n error(message: string): void;\n};\n\nexport const consoleOutput = createCommandOutput(process.stdout, process.stderr);\n\nexport function createCommandOutput(stdout: OutputStream, stderr: OutputStream): CommandOutput {\n return {\n info(message) {\n writeStyledMessage(stdout, \"info\", message);\n },\n success(message) {\n writeStyledMessage(stdout, \"success\", message);\n },\n warning(message) {\n writeStyledMessage(stdout, \"warning\", message);\n },\n muted(message) {\n writeStyledMessage(stdout, \"muted\", message);\n },\n markdown(message) {\n stdout.write(`${formatMarkdownMessage(stdout, message)}\\n`);\n },\n raw(message) {\n stdout.write(`${message}\\n`);\n },\n error(message) {\n writeStyledMessage(stderr, \"error\", message);\n },\n };\n}\n\nexport function formatError(error: unknown): string {\n return error instanceof Error ? error.message : String(error);\n}\n\nfunction writeStyledMessage(stream: OutputStream, style: OutputStyle, message: string): void {\n stream.write(`${formatStyledMessage(stream, style, message)}\\n`);\n}\n\nfunction formatStyledMessage(stream: OutputStream, style: OutputStyle, message: string): string {\n if (!shouldRenderColor(stream)) {\n return message;\n }\n\n return renderToString(\n createElement(\n Text,\n {\n ...statusStylePropsByOutputStyle[style],\n wrap: \"wrap\",\n },\n message\n ),\n {\n columns: 10_000,\n }\n );\n}\n\nfunction formatMarkdownMessage(stream: OutputStream, markdown: string): string {\n if (resolveOutputFormat() === \"markdown\") {\n return markdown;\n }\n\n const useColor = shouldRenderColor(stream);\n const markdownWidth = clampMarkdownWidth(stream.columns);\n const preparedMarkdown = prepareMarkdownForTerminal(markdown);\n const renderedMarkdown = renderToString(\n createElement(\n Markdown,\n {\n ...createMarkdownTheme(useColor),\n children: preparedMarkdown,\n width: markdownWidth,\n }\n ),\n {\n columns: markdownWidth,\n }\n );\n\n return useColor ? renderedMarkdown.trimEnd() : stripAnsi(renderedMarkdown).trimEnd();\n}\n\nfunction prepareMarkdownForTerminal(markdown: string): string {\n if (!markdown.startsWith(\"---\\n\")) {\n return markdown;\n }\n\n const frontmatterEndIndex = markdown.indexOf(\"\\n---\", 4);\n if (frontmatterEndIndex < 0) {\n return formatFrontmatterForTerminal(markdown.slice(4).trimEnd());\n }\n\n const frontmatter = markdown.slice(4, frontmatterEndIndex).trimEnd();\n const body = markdown.slice(frontmatterEndIndex + \"\\n---\".length).replace(/^\\n+/, \"\");\n\n return `${formatFrontmatterForTerminal(frontmatter)}\\n\\n${body}`;\n}\n\nfunction formatFrontmatterForTerminal(frontmatter: string): string {\n return `## Metadata\\n\\n\\`\\`\\`yaml\\n${frontmatter}\\n\\`\\`\\``;\n}\n\nfunction shouldRenderColor(stream: OutputStream): boolean {\n if (process.env.CNGKIT_NO_COLOR === \"1\") {\n return false;\n }\n\n const colorMode = process.env.CNGKIT_COLOR?.toLowerCase();\n\n if (colorMode === \"never\" || colorMode === \"0\" || colorMode === \"false\") {\n return false;\n }\n\n if (colorMode === \"always\" || colorMode === \"1\" || colorMode === \"true\") {\n return true;\n }\n\n if (process.env.FORCE_COLOR !== undefined && process.env.FORCE_COLOR !== \"0\") {\n return true;\n }\n\n if (process.env.NO_COLOR !== undefined) {\n return false;\n }\n\n return stream.isTTY === true;\n}\n\nfunction clampMarkdownWidth(columns: number | undefined): number {\n if (columns === undefined) {\n return 100;\n }\n\n return Math.max(72, Math.min(columns, 120));\n}\n","import { Chalk } from \"chalk\";\nimport type { TextProps } from \"ink\";\n\nexport type OutputStyle = \"info\" | \"success\" | \"warning\" | \"muted\" | \"error\";\n\nexport const statusStylePropsByOutputStyle = {\n info: {\n color: \"cyan\",\n },\n success: {\n color: \"green\",\n bold: true,\n },\n warning: {\n color: \"yellow\",\n bold: true,\n },\n muted: {\n dimColor: true,\n },\n error: {\n color: \"red\",\n bold: true,\n },\n} satisfies Record<OutputStyle, TextProps>;\n\nexport function createMarkdownTheme(useColor: boolean) {\n const chalk = new Chalk({ level: useColor ? 1 : 0 });\n const identity = (value: string) => value;\n\n return {\n code: chalk.green,\n blockquote: chalk.dim.italic,\n html: chalk.gray,\n heading: chalk.blueBright.bold,\n firstHeading: chalk.magentaBright.bold,\n hr: chalk.gray,\n listitem: identity,\n table: identity,\n paragraph: identity,\n strong: chalk.bold,\n em: chalk.italic,\n codespan: chalk.cyanBright,\n del: chalk.dim.strikethrough,\n link: chalk.blueBright,\n href: chalk.blue.underline,\n text: identity,\n showSectionPrefix: false,\n reflowText: true,\n unescape: true,\n emoji: false,\n tab: 2,\n };\n}\n"],"mappings":";AAAA,SAAS,aAAa,kBAAkB;AACxC,OAAO,aAAa;AAEb,IAAM,iBAAiB;AACvB,IAAM,oBAAoB;AAS1B,SAAS,kBAAkB,SAAuC;AACvE,OAAK;AACL,SAAO;AACT;AAEO,SAAS,sBAAoC;AAClD,QAAM,QAAQ,QAAQ,IAAI,eAAe,YAAY;AACrD,MAAI,UAAU,UAAU,UAAU,YAAY;AAC5C,WAAO;AAAA,EACT;AAEA,SAAO;AACT;AAEO,SAAS,kBAAkB,OAA6B;AAC7D,QAAM,kBAAkB,MAAM,YAAY;AAC1C,MAAI,oBAAoB,UAAU,oBAAoB,UAAU,oBAAoB,YAAY;AAC9F,WAAO;AAAA,EACT;AAEA,QAAM,IAAI,MAAM,2DAA2D;AAC7E;AAEO,SAAS,iBAAyB;AACvC,SAAO,YAAY,CAAC,EAAE,SAAS,KAAK,EAAE,YAAY;AACpD;AAEO,SAAS,eAAuB;AACrC,SAAO,WAAW;AACpB;;;AC1CA,OAAOA,cAAa;AACpB,SAAS,qBAAqB;AAC9B,SAAS,gBAAgB,YAAY;AACrC,OAAO,cAAc;AACrB,OAAO,eAAe;;;AC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