cngkit 1.1.21 → 1.1.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +198 -4
- package/README.md +8 -12
- package/dist/{chunk-NGEWD4BW.js → chunk-25Q463MH.js} +1 -2
- package/dist/{chunk-SMTQ3W3F.js → chunk-3BATDTKU.js} +131 -112
- package/dist/chunk-3BATDTKU.js.map +1 -0
- package/dist/chunk-AS7FIJWP.js +88 -0
- package/dist/chunk-AS7FIJWP.js.map +1 -0
- package/dist/chunk-BRFWVQI4.js +18 -0
- package/dist/chunk-BRFWVQI4.js.map +1 -0
- package/dist/{chunk-DIJEVOVN.js → chunk-DCW4RKLC.js} +63 -234
- package/dist/chunk-DCW4RKLC.js.map +1 -0
- package/dist/{chunk-SKK2XLRZ.js → chunk-JNHW72SU.js} +21 -15
- package/dist/chunk-JNHW72SU.js.map +1 -0
- package/dist/{chunk-CVF2ODLP.js → chunk-KURN5BJ6.js} +300 -143
- package/dist/chunk-KURN5BJ6.js.map +1 -0
- package/dist/{chunk-YJXAH7D5.js → chunk-N255PYL7.js} +2 -2
- package/dist/chunk-N255PYL7.js.map +1 -0
- package/dist/chunk-NLAANOBW.js +67 -0
- package/dist/chunk-NLAANOBW.js.map +1 -0
- package/dist/chunk-TIY4RTXC.js +268 -0
- package/dist/chunk-TIY4RTXC.js.map +1 -0
- package/dist/chunk-VMTXY4KQ.js +111 -0
- package/dist/chunk-VMTXY4KQ.js.map +1 -0
- package/dist/chunk-YALWTRIP.js +102 -0
- package/dist/chunk-YALWTRIP.js.map +1 -0
- package/dist/cli.js +2 -2
- 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 +8 -11
- package/dist/commands/coderoom/share.js.map +1 -1
- package/dist/commands/hookify/index.js +4 -4
- package/dist/commands/hookify/ingest.js +4 -4
- package/dist/commands/hooks/index.js +4 -4
- package/dist/commands/hooks/install.js +4 -4
- package/dist/commands/hooks/uninstall.js +4 -4
- package/dist/commands/index.js +3 -3
- package/dist/commands/knowledges/audiences.js +26 -8
- package/dist/commands/knowledges/audiences.js.map +1 -1
- package/dist/commands/knowledges/cat.js +26 -7
- package/dist/commands/knowledges/cat.js.map +1 -1
- package/dist/commands/knowledges/files.js +39 -8
- package/dist/commands/knowledges/files.js.map +1 -1
- package/dist/commands/knowledges/find.js +48 -8
- package/dist/commands/knowledges/find.js.map +1 -1
- package/dist/commands/knowledges/glob.js +41 -8
- package/dist/commands/knowledges/glob.js.map +1 -1
- package/dist/commands/knowledges/grep.js +73 -8
- package/dist/commands/knowledges/grep.js.map +1 -1
- package/dist/commands/knowledges/head.js +31 -8
- package/dist/commands/knowledges/head.js.map +1 -1
- package/dist/commands/knowledges/index.js +4 -4
- package/dist/commands/knowledges/list.js +39 -8
- package/dist/commands/knowledges/list.js.map +1 -1
- package/dist/commands/knowledges/ls.js +47 -8
- package/dist/commands/knowledges/ls.js.map +1 -1
- package/dist/commands/knowledges/read.js +46 -8
- package/dist/commands/knowledges/read.js.map +1 -1
- package/dist/commands/knowledges/realpath.js +23 -8
- package/dist/commands/knowledges/realpath.js.map +1 -1
- package/dist/commands/knowledges/search.js +34 -8
- package/dist/commands/knowledges/search.js.map +1 -1
- package/dist/commands/knowledges/stat.js +32 -8
- package/dist/commands/knowledges/stat.js.map +1 -1
- package/dist/commands/knowledges/status.js +26 -8
- package/dist/commands/knowledges/status.js.map +1 -1
- package/dist/commands/knowledges/tail.js +30 -8
- package/dist/commands/knowledges/tail.js.map +1 -1
- package/dist/commands/knowledges/tree.js +38 -8
- package/dist/commands/knowledges/tree.js.map +1 -1
- package/dist/commands/login.js +3 -3
- package/dist/commands/login.js.map +1 -1
- package/dist/commands/scrub.js +3 -3
- package/dist/commands/scrub.js.map +1 -1
- package/dist/commands/transcripts.js +137 -119
- package/dist/commands/transcripts.js.map +1 -1
- package/package.json +2 -2
- package/dist/chunk-52PGDSFU.js +0 -42
- package/dist/chunk-52PGDSFU.js.map +0 -1
- package/dist/chunk-5WTRGYAO.js +0 -658
- package/dist/chunk-5WTRGYAO.js.map +0 -1
- package/dist/chunk-CVF2ODLP.js.map +0 -1
- package/dist/chunk-DIJEVOVN.js.map +0 -1
- package/dist/chunk-SKK2XLRZ.js.map +0 -1
- package/dist/chunk-SMTQ3W3F.js.map +0 -1
- package/dist/chunk-YJXAH7D5.js.map +0 -1
- /package/dist/{chunk-NGEWD4BW.js.map → chunk-25Q463MH.js.map} +0 -0
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
// src/features/knowledges/knowledges-input.ts
|
|
2
|
+
var storedTopicsRoot = "skills/knowledges/topics";
|
|
3
|
+
function normalizeAudienceId(value) {
|
|
4
|
+
if (value === void 0) {
|
|
5
|
+
return void 0;
|
|
6
|
+
}
|
|
7
|
+
switch (value) {
|
|
8
|
+
case "all":
|
|
9
|
+
case "operators":
|
|
10
|
+
case "builders":
|
|
11
|
+
case "researchers":
|
|
12
|
+
case "agent-makers":
|
|
13
|
+
return value;
|
|
14
|
+
default:
|
|
15
|
+
throw new Error(
|
|
16
|
+
`Unknown audience "${value}". Run cngkit knowledges audiences to see supported values.`
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
function normalizeCatalogPath(value) {
|
|
21
|
+
const trimmed = value.trim();
|
|
22
|
+
if (trimmed === "/" || trimmed === "") {
|
|
23
|
+
return storedTopicsRoot;
|
|
24
|
+
}
|
|
25
|
+
const relativePath = trimmed.replace(/^\/+/, "");
|
|
26
|
+
if (relativePath === storedTopicsRoot || relativePath.startsWith(`${storedTopicsRoot}/`)) {
|
|
27
|
+
return relativePath;
|
|
28
|
+
}
|
|
29
|
+
const topicRelativePath = relativePath.startsWith("topics/") ? relativePath.slice("topics/".length) : relativePath;
|
|
30
|
+
const [firstSegment, ...restSegments] = relativePath.split("/");
|
|
31
|
+
if (!firstSegment) {
|
|
32
|
+
return relativePath;
|
|
33
|
+
}
|
|
34
|
+
switch (firstSegment) {
|
|
35
|
+
case "concepts":
|
|
36
|
+
case "domains":
|
|
37
|
+
case "formats":
|
|
38
|
+
case "languages":
|
|
39
|
+
case "libraries":
|
|
40
|
+
case "patterns":
|
|
41
|
+
case "platforms":
|
|
42
|
+
case "procedures":
|
|
43
|
+
case "protocols":
|
|
44
|
+
case "tools":
|
|
45
|
+
return `${storedTopicsRoot}/${firstSegment}${restSegments.length > 0 ? `/${restSegments.join("/")}` : ""}`;
|
|
46
|
+
default:
|
|
47
|
+
return `${storedTopicsRoot}/${topicRelativePath}`;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
function normalizeFilesystemCatalogPath(value) {
|
|
51
|
+
const trimmed = value.trim();
|
|
52
|
+
if (trimmed === "/" || trimmed === "") {
|
|
53
|
+
return storedTopicsRoot;
|
|
54
|
+
}
|
|
55
|
+
return normalizeCatalogPath(trimmed);
|
|
56
|
+
}
|
|
57
|
+
function formatCatalogPathForDisplay(value) {
|
|
58
|
+
const normalized = value.replace(/\/+$/, "");
|
|
59
|
+
if (normalized === storedTopicsRoot) {
|
|
60
|
+
return "/";
|
|
61
|
+
}
|
|
62
|
+
if (normalized.startsWith(`${storedTopicsRoot}/`)) {
|
|
63
|
+
return `/${normalized.slice(storedTopicsRoot.length + 1)}`;
|
|
64
|
+
}
|
|
65
|
+
return value;
|
|
66
|
+
}
|
|
67
|
+
function normalizeGrepMode(value) {
|
|
68
|
+
if (value === void 0) {
|
|
69
|
+
return "content";
|
|
70
|
+
}
|
|
71
|
+
switch (value) {
|
|
72
|
+
case "content":
|
|
73
|
+
case "files_with_matches":
|
|
74
|
+
case "count":
|
|
75
|
+
return value;
|
|
76
|
+
default:
|
|
77
|
+
throw new Error("Unknown grep mode. Use one of: content, files_with_matches, count.");
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export {
|
|
82
|
+
normalizeAudienceId,
|
|
83
|
+
normalizeCatalogPath,
|
|
84
|
+
normalizeFilesystemCatalogPath,
|
|
85
|
+
formatCatalogPathForDisplay,
|
|
86
|
+
normalizeGrepMode
|
|
87
|
+
};
|
|
88
|
+
//# sourceMappingURL=chunk-AS7FIJWP.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/features/knowledges/knowledges-input.ts"],"sourcesContent":["import type { CngApi } from \"@cng/client\";\n\nconst storedTopicsRoot = \"skills/knowledges/topics\";\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 storedTopicsRoot;\n }\n\n const relativePath = trimmed.replace(/^\\/+/, \"\");\n if (relativePath === storedTopicsRoot || relativePath.startsWith(`${storedTopicsRoot}/`)) {\n return relativePath;\n }\n\n const topicRelativePath = relativePath.startsWith(\"topics/\")\n ? relativePath.slice(\"topics/\".length)\n : relativePath;\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 `${storedTopicsRoot}/${firstSegment}${restSegments.length > 0 ? `/${restSegments.join(\"/\")}` : \"\"}`;\n default:\n return `${storedTopicsRoot}/${topicRelativePath}`;\n }\n}\n\nexport function normalizeFilesystemCatalogPath(value: string): string {\n const trimmed = value.trim();\n if (trimmed === \"/\" || trimmed === \"\") {\n return storedTopicsRoot;\n }\n\n return normalizeCatalogPath(trimmed);\n}\n\nexport function formatCatalogPathForDisplay(value: string): string {\n const normalized = value.replace(/\\/+$/, \"\");\n if (normalized === storedTopicsRoot) {\n return \"/\";\n }\n\n if (normalized.startsWith(`${storedTopicsRoot}/`)) {\n return `/${normalized.slice(storedTopicsRoot.length + 1)}`;\n }\n\n return value;\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"],"mappings":";AAEA,IAAM,mBAAmB;AAElB,SAAS,oBAAoB,OAAiE;AACnG,MAAI,UAAU,QAAW;AACvB,WAAO;AAAA,EACT;AAEA,UAAQ,OAAO;AAAA,IACb,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AACH,aAAO;AAAA,IACT;AACE,YAAM,IAAI;AAAA,QACR,qBAAqB,KAAK;AAAA,MAC5B;AAAA,EACJ;AACF;AAEO,SAAS,qBAAqB,OAAuB;AAC1D,QAAM,UAAU,MAAM,KAAK;AAC3B,MAAI,YAAY,OAAO,YAAY,IAAI;AACrC,WAAO;AAAA,EACT;AAEA,QAAM,eAAe,QAAQ,QAAQ,QAAQ,EAAE;AAC/C,MAAI,iBAAiB,oBAAoB,aAAa,WAAW,GAAG,gBAAgB,GAAG,GAAG;AACxF,WAAO;AAAA,EACT;AAEA,QAAM,oBAAoB,aAAa,WAAW,SAAS,IACvD,aAAa,MAAM,UAAU,MAAM,IACnC;AAEJ,QAAM,CAAC,cAAc,GAAG,YAAY,IAAI,aAAa,MAAM,GAAG;AAC9D,MAAI,CAAC,cAAc;AACjB,WAAO;AAAA,EACT;AAEA,UAAQ,cAAc;AAAA,IACpB,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AACH,aAAO,GAAG,gBAAgB,IAAI,YAAY,GAAG,aAAa,SAAS,IAAI,IAAI,aAAa,KAAK,GAAG,CAAC,KAAK,EAAE;AAAA,IAC1G;AACE,aAAO,GAAG,gBAAgB,IAAI,iBAAiB;AAAA,EACnD;AACF;AAEO,SAAS,+BAA+B,OAAuB;AACpE,QAAM,UAAU,MAAM,KAAK;AAC3B,MAAI,YAAY,OAAO,YAAY,IAAI;AACrC,WAAO;AAAA,EACT;AAEA,SAAO,qBAAqB,OAAO;AACrC;AAEO,SAAS,4BAA4B,OAAuB;AACjE,QAAM,aAAa,MAAM,QAAQ,QAAQ,EAAE;AAC3C,MAAI,eAAe,kBAAkB;AACnC,WAAO;AAAA,EACT;AAEA,MAAI,WAAW,WAAW,GAAG,gBAAgB,GAAG,GAAG;AACjD,WAAO,IAAI,WAAW,MAAM,iBAAiB,SAAS,CAAC,CAAC;AAAA,EAC1D;AAEA,SAAO;AACT;AAEO,SAAS,kBAAkB,OAAyD;AACzF,MAAI,UAAU,QAAW;AACvB,WAAO;AAAA,EACT;AAEA,UAAQ,OAAO;AAAA,IACb,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AACH,aAAO;AAAA,IACT;AACE,YAAM,IAAI,MAAM,oEAAoE;AAAA,EACxF;AACF;","names":[]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import {
|
|
2
|
+
formatJson,
|
|
3
|
+
shouldPrintJson
|
|
4
|
+
} from "./chunk-XQGLUQFM.js";
|
|
5
|
+
|
|
6
|
+
// src/features/knowledges/format/content-format.ts
|
|
7
|
+
function outputRawContent(data, options, output) {
|
|
8
|
+
if (shouldPrintJson(options)) {
|
|
9
|
+
output.raw(formatJson(data));
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
output.raw(data.content);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export {
|
|
16
|
+
outputRawContent
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=chunk-BRFWVQI4.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/features/knowledges/format/content-format.ts"],"sourcesContent":["import type { CngApi } from \"@cng/client\";\n\nimport { formatJson, shouldPrintJson, type JsonOutputOptions } from \"../../../shared/command-utils.js\";\nimport type { CommandOutput } from \"../../../shared/output/types.js\";\n\nexport function outputRawContent(\n data: CngApi.HarnessReadResponse,\n options: JsonOutputOptions,\n output: CommandOutput\n): void {\n if (shouldPrintJson(options)) {\n output.raw(formatJson(data));\n return;\n }\n\n output.raw(data.content);\n}\n"],"mappings":";;;;;;AAKO,SAAS,iBACd,MACA,SACA,QACM;AACN,MAAI,gBAAgB,OAAO,GAAG;AAC5B,WAAO,IAAI,WAAW,IAAI,CAAC;AAC3B;AAAA,EACF;AAEA,SAAO,IAAI,KAAK,OAAO;AACzB;","names":[]}
|
|
@@ -3,9 +3,8 @@ import {
|
|
|
3
3
|
} from "./chunk-PZ5AY32C.js";
|
|
4
4
|
|
|
5
5
|
// src/shared/config.ts
|
|
6
|
-
import { randomBytes, randomUUID } from "crypto";
|
|
7
6
|
import process2 from "process";
|
|
8
|
-
var packageVersion = "1.1.
|
|
7
|
+
var packageVersion = "1.1.22";
|
|
9
8
|
var defaultApiBaseUrl = "https://curly.ng";
|
|
10
9
|
function resolveApiBaseUrl(options) {
|
|
11
10
|
void options;
|
|
@@ -25,18 +24,6 @@ function parseOutputFormat(value) {
|
|
|
25
24
|
}
|
|
26
25
|
throw new Error("Unknown --format value. Use one of: text, json, markdown.");
|
|
27
26
|
}
|
|
28
|
-
function createRoomCode() {
|
|
29
|
-
return randomBytes(4).toString("hex").toUpperCase();
|
|
30
|
-
}
|
|
31
|
-
function createPeerId() {
|
|
32
|
-
return randomUUID();
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
// src/shared/output.ts
|
|
36
|
-
import process3 from "process";
|
|
37
|
-
import { createElement, useEffect } from "react";
|
|
38
|
-
import { Static, Text, useStderr, useStdout } from "ink";
|
|
39
|
-
import Markdown from "@inkkit/ink-markdown";
|
|
40
27
|
|
|
41
28
|
// ../../packages/client/src/generated/core/json.ts
|
|
42
29
|
var toJson = (value, replacer, space) => {
|
|
@@ -2119,6 +2106,61 @@ var AuthClient = class {
|
|
|
2119
2106
|
}
|
|
2120
2107
|
};
|
|
2121
2108
|
|
|
2109
|
+
// ../../packages/client/src/generated/api/resources/coderoom/client/Client.ts
|
|
2110
|
+
var CoderoomClient = class {
|
|
2111
|
+
_options;
|
|
2112
|
+
constructor(options = {}) {
|
|
2113
|
+
this._options = normalizeClientOptions(options);
|
|
2114
|
+
}
|
|
2115
|
+
/**
|
|
2116
|
+
* @param {CoderoomClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
2117
|
+
*
|
|
2118
|
+
* @throws {@link CngApi.InternalServerError}
|
|
2119
|
+
* @throws {@link CngApi.ServiceUnavailableError}
|
|
2120
|
+
*
|
|
2121
|
+
* @example
|
|
2122
|
+
* await client.coderoom.createCoderoomRoom()
|
|
2123
|
+
*/
|
|
2124
|
+
createCoderoomRoom(requestOptions) {
|
|
2125
|
+
return HttpResponsePromise.fromPromise(this.__createCoderoomRoom(requestOptions));
|
|
2126
|
+
}
|
|
2127
|
+
async __createCoderoomRoom(requestOptions) {
|
|
2128
|
+
const _headers = mergeHeaders(this._options?.headers, requestOptions?.headers);
|
|
2129
|
+
const _response = await fetcher({
|
|
2130
|
+
url: url_exports.join(
|
|
2131
|
+
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment) ?? CngApiEnvironment.Default,
|
|
2132
|
+
"api/cng/coderoom/rooms"
|
|
2133
|
+
),
|
|
2134
|
+
method: "POST",
|
|
2135
|
+
headers: _headers,
|
|
2136
|
+
queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
|
|
2137
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
|
|
2138
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
2139
|
+
abortSignal: requestOptions?.abortSignal,
|
|
2140
|
+
fetchFn: this._options?.fetch,
|
|
2141
|
+
logging: this._options.logging
|
|
2142
|
+
});
|
|
2143
|
+
if (_response.ok) {
|
|
2144
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
2145
|
+
}
|
|
2146
|
+
if (_response.error.reason === "status-code") {
|
|
2147
|
+
switch (_response.error.statusCode) {
|
|
2148
|
+
case 500:
|
|
2149
|
+
throw new InternalServerError(_response.error.body, _response.rawResponse);
|
|
2150
|
+
case 503:
|
|
2151
|
+
throw new ServiceUnavailableError(_response.error.body, _response.rawResponse);
|
|
2152
|
+
default:
|
|
2153
|
+
throw new CngApiError({
|
|
2154
|
+
statusCode: _response.error.statusCode,
|
|
2155
|
+
body: _response.error.body,
|
|
2156
|
+
rawResponse: _response.rawResponse
|
|
2157
|
+
});
|
|
2158
|
+
}
|
|
2159
|
+
}
|
|
2160
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/api/cng/coderoom/rooms");
|
|
2161
|
+
}
|
|
2162
|
+
};
|
|
2163
|
+
|
|
2122
2164
|
// ../../packages/client/src/generated/api/resources/harnessFilesystem/client/Client.ts
|
|
2123
2165
|
var HarnessFilesystemClient = class {
|
|
2124
2166
|
_options;
|
|
@@ -3135,10 +3177,7 @@ var HarnessKnowledgesClient = class {
|
|
|
3135
3177
|
if (_response.error.reason === "status-code") {
|
|
3136
3178
|
switch (_response.error.statusCode) {
|
|
3137
3179
|
case 500:
|
|
3138
|
-
throw new InternalServerError(
|
|
3139
|
-
_response.error.body,
|
|
3140
|
-
_response.rawResponse
|
|
3141
|
-
);
|
|
3180
|
+
throw new InternalServerError(_response.error.body, _response.rawResponse);
|
|
3142
3181
|
default:
|
|
3143
3182
|
throw new CngApiError({
|
|
3144
3183
|
statusCode: _response.error.statusCode,
|
|
@@ -3741,6 +3780,7 @@ var CngApiClient = class {
|
|
|
3741
3780
|
_telemetry;
|
|
3742
3781
|
_llm;
|
|
3743
3782
|
_hookify;
|
|
3783
|
+
_coderoom;
|
|
3744
3784
|
constructor(options = {}) {
|
|
3745
3785
|
this._options = normalizeClientOptions(options);
|
|
3746
3786
|
}
|
|
@@ -3771,6 +3811,9 @@ var CngApiClient = class {
|
|
|
3771
3811
|
get hookify() {
|
|
3772
3812
|
return this._hookify ??= new HookifyClient(this._options);
|
|
3773
3813
|
}
|
|
3814
|
+
get coderoom() {
|
|
3815
|
+
return this._coderoom ??= new CoderoomClient(this._options);
|
|
3816
|
+
}
|
|
3774
3817
|
/**
|
|
3775
3818
|
* Make a passthrough request using the SDK's configured auth, retry, logging, etc.
|
|
3776
3819
|
* This is useful for making requests to endpoints not yet supported in the SDK.
|
|
@@ -3805,163 +3848,7 @@ var logging;
|
|
|
3805
3848
|
logging2.ConsoleLogger = ConsoleLogger;
|
|
3806
3849
|
})(logging || (logging = {}));
|
|
3807
3850
|
|
|
3808
|
-
// src/shared/
|
|
3809
|
-
import { Chalk } from "chalk";
|
|
3810
|
-
var statusStylePropsByOutputStyle = {
|
|
3811
|
-
info: {
|
|
3812
|
-
color: "cyan"
|
|
3813
|
-
},
|
|
3814
|
-
success: {
|
|
3815
|
-
color: "green",
|
|
3816
|
-
bold: true
|
|
3817
|
-
},
|
|
3818
|
-
warning: {
|
|
3819
|
-
color: "yellow",
|
|
3820
|
-
bold: true
|
|
3821
|
-
},
|
|
3822
|
-
muted: {
|
|
3823
|
-
dimColor: true
|
|
3824
|
-
},
|
|
3825
|
-
error: {
|
|
3826
|
-
color: "red",
|
|
3827
|
-
bold: true
|
|
3828
|
-
}
|
|
3829
|
-
};
|
|
3830
|
-
function createMarkdownTheme(useColor) {
|
|
3831
|
-
const chalk = new Chalk({ level: useColor ? 1 : 0 });
|
|
3832
|
-
const identity = (value) => value;
|
|
3833
|
-
return {
|
|
3834
|
-
code: chalk.green,
|
|
3835
|
-
blockquote: chalk.dim.italic,
|
|
3836
|
-
html: chalk.gray,
|
|
3837
|
-
heading: chalk.blueBright.bold,
|
|
3838
|
-
firstHeading: chalk.magentaBright.bold,
|
|
3839
|
-
hr: chalk.gray,
|
|
3840
|
-
listitem: identity,
|
|
3841
|
-
table: identity,
|
|
3842
|
-
paragraph: identity,
|
|
3843
|
-
strong: chalk.bold,
|
|
3844
|
-
em: chalk.italic,
|
|
3845
|
-
codespan: chalk.cyanBright,
|
|
3846
|
-
del: chalk.dim.strikethrough,
|
|
3847
|
-
link: chalk.blueBright,
|
|
3848
|
-
href: chalk.blue.underline,
|
|
3849
|
-
text: identity,
|
|
3850
|
-
showSectionPrefix: false,
|
|
3851
|
-
reflowText: true,
|
|
3852
|
-
unescape: true,
|
|
3853
|
-
emoji: false,
|
|
3854
|
-
tab: 2
|
|
3855
|
-
};
|
|
3856
|
-
}
|
|
3857
|
-
|
|
3858
|
-
// src/shared/output.ts
|
|
3859
|
-
function createCommandOutput(sink) {
|
|
3860
|
-
const stdout = sink.stdout ?? process3.stdout;
|
|
3861
|
-
const stderr = sink.stderr ?? process3.stderr;
|
|
3862
|
-
return {
|
|
3863
|
-
info(message) {
|
|
3864
|
-
appendStyledMessage(sink, stdout, "stdout", "info", message);
|
|
3865
|
-
},
|
|
3866
|
-
success(message) {
|
|
3867
|
-
appendStyledMessage(sink, stdout, "stdout", "success", message);
|
|
3868
|
-
},
|
|
3869
|
-
warning(message) {
|
|
3870
|
-
appendStyledMessage(sink, stdout, "stdout", "warning", message);
|
|
3871
|
-
},
|
|
3872
|
-
muted(message) {
|
|
3873
|
-
appendStyledMessage(sink, stdout, "stdout", "muted", message);
|
|
3874
|
-
},
|
|
3875
|
-
markdown(message) {
|
|
3876
|
-
if (resolveOutputFormat() === "markdown") {
|
|
3877
|
-
stdout.write(`${message}
|
|
3878
|
-
`);
|
|
3879
|
-
return;
|
|
3880
|
-
}
|
|
3881
|
-
if (sink.appendMessage) {
|
|
3882
|
-
sink.appendMessage({ kind: "markdown", message: prepareMarkdownForTerminal(message) });
|
|
3883
|
-
return;
|
|
3884
|
-
}
|
|
3885
|
-
stdout.write(`${message}
|
|
3886
|
-
`);
|
|
3887
|
-
},
|
|
3888
|
-
component(element) {
|
|
3889
|
-
if (sink.appendMessage) {
|
|
3890
|
-
sink.appendMessage({ kind: "component", element });
|
|
3891
|
-
return;
|
|
3892
|
-
}
|
|
3893
|
-
stdout.write("\n");
|
|
3894
|
-
},
|
|
3895
|
-
raw(message) {
|
|
3896
|
-
stdout.write(`${message}
|
|
3897
|
-
`);
|
|
3898
|
-
},
|
|
3899
|
-
error(message) {
|
|
3900
|
-
appendStyledMessage(sink, stderr, "stderr", "error", message);
|
|
3901
|
-
}
|
|
3902
|
-
};
|
|
3903
|
-
}
|
|
3904
|
-
function CommandOutputMessages({
|
|
3905
|
-
messages
|
|
3906
|
-
}) {
|
|
3907
|
-
const { stdout } = useStdout();
|
|
3908
|
-
const width = clampMarkdownWidth(stdout.columns);
|
|
3909
|
-
const useColor = shouldRenderColor(stdout);
|
|
3910
|
-
if (messages.length === 0) {
|
|
3911
|
-
return null;
|
|
3912
|
-
}
|
|
3913
|
-
return createElement(
|
|
3914
|
-
Static,
|
|
3915
|
-
{
|
|
3916
|
-
items: [...messages],
|
|
3917
|
-
style: { flexDirection: "column" },
|
|
3918
|
-
children: (message) => createElement(CommandOutputMessageView, {
|
|
3919
|
-
key: message.id,
|
|
3920
|
-
message,
|
|
3921
|
-
useColor,
|
|
3922
|
-
width
|
|
3923
|
-
})
|
|
3924
|
-
}
|
|
3925
|
-
);
|
|
3926
|
-
}
|
|
3927
|
-
function CommandOutputMessageView({
|
|
3928
|
-
message,
|
|
3929
|
-
useColor,
|
|
3930
|
-
width
|
|
3931
|
-
}) {
|
|
3932
|
-
if (message.kind === "styled") {
|
|
3933
|
-
if (message.stream === "stderr") {
|
|
3934
|
-
return createElement(StderrLine, { message: message.message });
|
|
3935
|
-
}
|
|
3936
|
-
return createElement(
|
|
3937
|
-
Text,
|
|
3938
|
-
{
|
|
3939
|
-
...statusStylePropsByOutputStyle[message.style],
|
|
3940
|
-
wrap: "wrap"
|
|
3941
|
-
},
|
|
3942
|
-
message.message
|
|
3943
|
-
);
|
|
3944
|
-
}
|
|
3945
|
-
if (message.kind === "markdown") {
|
|
3946
|
-
return createElement(
|
|
3947
|
-
Markdown,
|
|
3948
|
-
{
|
|
3949
|
-
...createMarkdownTheme(useColor),
|
|
3950
|
-
width
|
|
3951
|
-
},
|
|
3952
|
-
message.message
|
|
3953
|
-
);
|
|
3954
|
-
}
|
|
3955
|
-
return message.element;
|
|
3956
|
-
}
|
|
3957
|
-
function StderrLine({ message }) {
|
|
3958
|
-
const { write } = useStderr();
|
|
3959
|
-
useEffect(() => {
|
|
3960
|
-
write(`${message}
|
|
3961
|
-
`);
|
|
3962
|
-
}, [message, write]);
|
|
3963
|
-
return null;
|
|
3964
|
-
}
|
|
3851
|
+
// src/shared/output/errors.ts
|
|
3965
3852
|
function formatError(error) {
|
|
3966
3853
|
if (error instanceof CngApiError) {
|
|
3967
3854
|
return formatApiError(error);
|
|
@@ -4002,71 +3889,13 @@ function extractBodyErrorMessage(body) {
|
|
|
4002
3889
|
}
|
|
4003
3890
|
return void 0;
|
|
4004
3891
|
}
|
|
4005
|
-
function appendStyledMessage(sink, stream, streamName, style, message) {
|
|
4006
|
-
if (sink.appendMessage) {
|
|
4007
|
-
sink.appendMessage({ kind: "styled", stream: streamName, style, message });
|
|
4008
|
-
return;
|
|
4009
|
-
}
|
|
4010
|
-
stream.write(`${message}
|
|
4011
|
-
`);
|
|
4012
|
-
}
|
|
4013
|
-
function prepareMarkdownForTerminal(markdown) {
|
|
4014
|
-
if (!markdown.startsWith("---\n")) {
|
|
4015
|
-
return markdown;
|
|
4016
|
-
}
|
|
4017
|
-
const frontmatterEndIndex = markdown.indexOf("\n---", 4);
|
|
4018
|
-
if (frontmatterEndIndex < 0) {
|
|
4019
|
-
return formatFrontmatterForTerminal(markdown.slice(4).trimEnd());
|
|
4020
|
-
}
|
|
4021
|
-
const frontmatter = markdown.slice(4, frontmatterEndIndex).trimEnd();
|
|
4022
|
-
const body = markdown.slice(frontmatterEndIndex + "\n---".length).replace(/^\n+/, "");
|
|
4023
|
-
return `${formatFrontmatterForTerminal(frontmatter)}
|
|
4024
|
-
|
|
4025
|
-
${body}`;
|
|
4026
|
-
}
|
|
4027
|
-
function formatFrontmatterForTerminal(frontmatter) {
|
|
4028
|
-
return `## Metadata
|
|
4029
|
-
|
|
4030
|
-
\`\`\`yaml
|
|
4031
|
-
${frontmatter}
|
|
4032
|
-
\`\`\``;
|
|
4033
|
-
}
|
|
4034
|
-
function shouldRenderColor(stream) {
|
|
4035
|
-
if (process3.env.CNGKIT_NO_COLOR === "1") {
|
|
4036
|
-
return false;
|
|
4037
|
-
}
|
|
4038
|
-
const colorMode = process3.env.CNGKIT_COLOR?.toLowerCase();
|
|
4039
|
-
if (colorMode === "never" || colorMode === "0" || colorMode === "false") {
|
|
4040
|
-
return false;
|
|
4041
|
-
}
|
|
4042
|
-
if (colorMode === "always" || colorMode === "1" || colorMode === "true") {
|
|
4043
|
-
return true;
|
|
4044
|
-
}
|
|
4045
|
-
if (process3.env.FORCE_COLOR !== void 0 && process3.env.FORCE_COLOR !== "0") {
|
|
4046
|
-
return true;
|
|
4047
|
-
}
|
|
4048
|
-
if (process3.env.NO_COLOR !== void 0) {
|
|
4049
|
-
return false;
|
|
4050
|
-
}
|
|
4051
|
-
return stream.isTTY === true;
|
|
4052
|
-
}
|
|
4053
|
-
function clampMarkdownWidth(columns) {
|
|
4054
|
-
if (columns === void 0) {
|
|
4055
|
-
return 100;
|
|
4056
|
-
}
|
|
4057
|
-
return Math.max(72, Math.min(columns, 120));
|
|
4058
|
-
}
|
|
4059
3892
|
|
|
4060
3893
|
export {
|
|
4061
3894
|
packageVersion,
|
|
4062
3895
|
resolveApiBaseUrl,
|
|
4063
3896
|
resolveOutputFormat,
|
|
4064
3897
|
parseOutputFormat,
|
|
4065
|
-
createRoomCode,
|
|
4066
|
-
createPeerId,
|
|
4067
3898
|
CngApiClient,
|
|
4068
|
-
createCommandOutput,
|
|
4069
|
-
CommandOutputMessages,
|
|
4070
3899
|
formatError
|
|
4071
3900
|
};
|
|
4072
|
-
//# sourceMappingURL=chunk-
|
|
3901
|
+
//# sourceMappingURL=chunk-DCW4RKLC.js.map
|