cngkit 1.1.21 → 1.1.23
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 +22 -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-DIJEVOVN.js → chunk-67FUBMNB.js} +71 -240
- package/dist/chunk-67FUBMNB.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-CVF2ODLP.js → chunk-BXS4IKUA.js} +300 -143
- package/dist/chunk-BXS4IKUA.js.map +1 -0
- package/dist/{chunk-YJXAH7D5.js → chunk-GYRLVNJX.js} +2 -2
- package/dist/chunk-GYRLVNJX.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-U725ZHCI.js +67 -0
- package/dist/chunk-U725ZHCI.js.map +1 -0
- package/dist/chunk-VMTXY4KQ.js +111 -0
- package/dist/chunk-VMTXY4KQ.js.map +1 -0
- package/dist/chunk-WIEYHKQA.js +268 -0
- package/dist/chunk-WIEYHKQA.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
|
@@ -1,19 +1,50 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
} from "../../chunk-
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
KnowTopicList
|
|
3
|
+
} from "../../chunk-VMTXY4KQ.js";
|
|
4
|
+
import {
|
|
5
|
+
createKnowledgesApi
|
|
6
|
+
} from "../../chunk-U725ZHCI.js";
|
|
7
|
+
import "../../chunk-AS7FIJWP.js";
|
|
8
|
+
import {
|
|
9
|
+
coerceLimit,
|
|
10
|
+
formatJson,
|
|
11
|
+
shouldPrintJson
|
|
12
|
+
} from "../../chunk-XQGLUQFM.js";
|
|
13
|
+
import "../../chunk-GYRLVNJX.js";
|
|
7
14
|
import {
|
|
8
15
|
LimitOptionsSchema,
|
|
9
16
|
OptionalQueryArgsSchema
|
|
10
|
-
} from "../../chunk-
|
|
17
|
+
} from "../../chunk-25Q463MH.js";
|
|
11
18
|
import {
|
|
12
19
|
CommandRunner
|
|
13
|
-
} from "../../chunk-
|
|
14
|
-
import "../../chunk-
|
|
20
|
+
} from "../../chunk-WIEYHKQA.js";
|
|
21
|
+
import "../../chunk-67FUBMNB.js";
|
|
15
22
|
import "../../chunk-PZ5AY32C.js";
|
|
16
23
|
|
|
24
|
+
// src/features/knowledges/handlers/list.ts
|
|
25
|
+
import { createElement } from "react";
|
|
26
|
+
async function runKnowListCommand(query, options2, output, dependencies) {
|
|
27
|
+
const api = dependencies?.api ?? createKnowledgesApi(options2);
|
|
28
|
+
const response = await api.listTopics();
|
|
29
|
+
const limit = coerceLimit(options2.limit, 25);
|
|
30
|
+
const normalizedQuery = query?.toLowerCase();
|
|
31
|
+
const topics = response.data.topics.filter((topic) => {
|
|
32
|
+
if (!normalizedQuery) {
|
|
33
|
+
return true;
|
|
34
|
+
}
|
|
35
|
+
return [topic.name, topic.title, topic.description, topic.type].join(" ").toLowerCase().includes(normalizedQuery);
|
|
36
|
+
}).slice(0, limit);
|
|
37
|
+
if (shouldPrintJson(options2)) {
|
|
38
|
+
output.raw(formatJson({ topics, total: topics.length }));
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
if (topics.length > 0) {
|
|
42
|
+
output.component(createElement(KnowTopicList, { topics }));
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
output.warning("No matching topics.");
|
|
46
|
+
}
|
|
47
|
+
|
|
17
48
|
// src/commands/knowledges/list.tsx
|
|
18
49
|
import { jsx } from "react/jsx-runtime";
|
|
19
50
|
var description = "List known topics";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/commands/knowledges/list.tsx"],"sourcesContent":["import { LimitOptionsSchema, OptionalQueryArgsSchema } from \"../../cli/options.js\";\nimport { runKnowListCommand
|
|
1
|
+
{"version":3,"sources":["../../../src/features/knowledges/handlers/list.ts","../../../src/commands/knowledges/list.tsx"],"sourcesContent":["import { createElement } from \"react\";\n\nimport { coerceLimit, formatJson, shouldPrintJson } from \"../../../shared/command-utils.js\";\nimport type { CommandOutput } from \"../../../shared/output/types.js\";\nimport { createKnowledgesApi, type KnowCommandDependencies } from \"../knowledges-api.js\";\nimport { KnowTopicList } from \"../knowledges-output.js\";\nimport type { KnowListCommandOptions } from \"../knowledges-options.js\";\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.listTopics();\n const limit = coerceLimit(options.limit, 25);\n const normalizedQuery = query?.toLowerCase();\n const topics = response.data.topics\n .filter((topic) => {\n if (!normalizedQuery) {\n return true;\n }\n return [topic.name, topic.title, topic.description, topic.type]\n .join(\" \")\n .toLowerCase()\n .includes(normalizedQuery);\n })\n .slice(0, limit);\n\n if (shouldPrintJson(options)) {\n output.raw(formatJson({ topics, total: topics.length }));\n return;\n }\n\n if (topics.length > 0) {\n output.component(createElement(KnowTopicList, { topics }));\n return;\n }\n\n output.warning(\"No matching topics.\");\n}\n","import { LimitOptionsSchema, OptionalQueryArgsSchema } from \"../../cli/options.js\";\nimport { runKnowListCommand } from \"../../features/knowledges/handlers/list.js\";\nimport type { KnowListCommandOptions } from \"../../features/knowledges/knowledges-options.js\";\nimport { CommandRunner } from \"../../cli/command-runner.js\";\n\nexport const description = \"List known topics\";\nexport const args = OptionalQueryArgsSchema;\nexport const options = LimitOptionsSchema;\n\ntype ListCommandProps = {\n readonly args: [string?];\n readonly options: KnowListCommandOptions;\n};\n\nexport default function ListCommand({ args, options }: ListCommandProps) {\n return <CommandRunner run={(output) => runKnowListCommand(args[0], options, output)} />;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,qBAAqB;AAQ9B,eAAsB,mBACpB,OACAA,UACA,QACA,cACe;AACf,QAAM,MAAM,cAAc,OAAO,oBAAoBA,QAAO;AAC5D,QAAM,WAAW,MAAM,IAAI,WAAW;AACtC,QAAM,QAAQ,YAAYA,SAAQ,OAAO,EAAE;AAC3C,QAAM,kBAAkB,OAAO,YAAY;AAC3C,QAAM,SAAS,SAAS,KAAK,OAC1B,OAAO,CAAC,UAAU;AACjB,QAAI,CAAC,iBAAiB;AACpB,aAAO;AAAA,IACT;AACA,WAAO,CAAC,MAAM,MAAM,MAAM,OAAO,MAAM,aAAa,MAAM,IAAI,EAC3D,KAAK,GAAG,EACR,YAAY,EACZ,SAAS,eAAe;AAAA,EAC7B,CAAC,EACA,MAAM,GAAG,KAAK;AAEjB,MAAI,gBAAgBA,QAAO,GAAG;AAC5B,WAAO,IAAI,WAAW,EAAE,QAAQ,OAAO,OAAO,OAAO,CAAC,CAAC;AACvD;AAAA,EACF;AAEA,MAAI,OAAO,SAAS,GAAG;AACrB,WAAO,UAAU,cAAc,eAAe,EAAE,OAAO,CAAC,CAAC;AACzD;AAAA,EACF;AAEA,SAAO,QAAQ,qBAAqB;AACtC;;;AC1BS;AAVF,IAAM,cAAc;AACpB,IAAM,OAAO;AACb,IAAM,UAAU;AAOR,SAAR,YAA6B,EAAE,MAAAC,OAAM,SAAAC,SAAQ,GAAqB;AACvE,SAAO,oBAAC,iBAAc,KAAK,CAAC,WAAW,mBAAmBD,MAAK,CAAC,GAAGC,UAAS,MAAM,GAAG;AACvF;","names":["options","args","options"]}
|
|
@@ -1,22 +1,61 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import
|
|
2
|
+
compareFilesystemEntries,
|
|
3
|
+
formatLongFilesystemEntryLine,
|
|
4
|
+
formatShellFilesystemEntryName
|
|
5
|
+
} from "../../chunk-YALWTRIP.js";
|
|
6
|
+
import {
|
|
7
|
+
createKnowledgesApi
|
|
8
|
+
} from "../../chunk-U725ZHCI.js";
|
|
9
|
+
import {
|
|
10
|
+
formatCatalogPathForDisplay,
|
|
11
|
+
normalizeFilesystemCatalogPath
|
|
12
|
+
} from "../../chunk-AS7FIJWP.js";
|
|
13
|
+
import {
|
|
14
|
+
coerceLimit,
|
|
15
|
+
formatJson,
|
|
16
|
+
shouldPrintJson
|
|
17
|
+
} from "../../chunk-XQGLUQFM.js";
|
|
18
|
+
import "../../chunk-GYRLVNJX.js";
|
|
7
19
|
import {
|
|
8
20
|
LimitOptionsSchema,
|
|
9
21
|
OptionalPathArgsSchema
|
|
10
|
-
} from "../../chunk-
|
|
22
|
+
} from "../../chunk-25Q463MH.js";
|
|
11
23
|
import {
|
|
12
24
|
CommandRunner
|
|
13
|
-
} from "../../chunk-
|
|
14
|
-
import "../../chunk-
|
|
25
|
+
} from "../../chunk-WIEYHKQA.js";
|
|
26
|
+
import "../../chunk-67FUBMNB.js";
|
|
15
27
|
import "../../chunk-PZ5AY32C.js";
|
|
16
28
|
|
|
17
29
|
// src/commands/knowledges/ls.tsx
|
|
18
30
|
import { option } from "pastel";
|
|
19
31
|
import { z } from "zod";
|
|
32
|
+
|
|
33
|
+
// src/features/knowledges/handlers/ls.ts
|
|
34
|
+
async function runKnowLsCommand(path, options2, output, dependencies) {
|
|
35
|
+
const api = dependencies?.api ?? createKnowledgesApi(options2);
|
|
36
|
+
const response = await api.listDirectory({
|
|
37
|
+
path: normalizeFilesystemCatalogPath(path ?? "/"),
|
|
38
|
+
limit: coerceLimit(options2.limit, 100, 1e3)
|
|
39
|
+
});
|
|
40
|
+
if (shouldPrintJson(options2)) {
|
|
41
|
+
output.raw(formatJson(response.data));
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
const entries = [...response.data.entries].sort(compareFilesystemEntries);
|
|
45
|
+
const lines = entries.map(
|
|
46
|
+
(entry) => options2.long === true ? formatLongFilesystemEntryLine(entry) : formatShellFilesystemEntryName(entry)
|
|
47
|
+
);
|
|
48
|
+
if (lines.length > 0) {
|
|
49
|
+
output.raw(lines.join("\n"));
|
|
50
|
+
} else {
|
|
51
|
+
output.warning(`No entries under ${formatCatalogPathForDisplay(response.data.path)}.`);
|
|
52
|
+
}
|
|
53
|
+
if (response.data.truncated) {
|
|
54
|
+
output.warning(`[truncated: ${response.data.total_entries} total entries]`);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// src/commands/knowledges/ls.tsx
|
|
20
59
|
import { jsx } from "react/jsx-runtime";
|
|
21
60
|
var description = "List remote catalog directory entries";
|
|
22
61
|
var args = OptionalPathArgsSchema;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/commands/knowledges/ls.tsx"],"sourcesContent":["import { option } from \"pastel\";\nimport { z } from \"zod\";\n\nimport { LimitOptionsSchema, OptionalPathArgsSchema } from \"../../cli/options.js\";\nimport { runKnowLsCommand
|
|
1
|
+
{"version":3,"sources":["../../../src/commands/knowledges/ls.tsx","../../../src/features/knowledges/handlers/ls.ts"],"sourcesContent":["import { option } from \"pastel\";\nimport { z } from \"zod\";\n\nimport { LimitOptionsSchema, OptionalPathArgsSchema } from \"../../cli/options.js\";\nimport { runKnowLsCommand } from \"../../features/knowledges/handlers/ls.js\";\nimport type { KnowLsCommandOptions } from \"../../features/knowledges/knowledges-options.js\";\nimport { CommandRunner } from \"../../cli/command-runner.js\";\n\nexport const description = \"List remote catalog directory entries\";\nexport const args = OptionalPathArgsSchema;\nexport const options = LimitOptionsSchema.extend({\n long: z\n .boolean()\n .optional()\n .describe(\n option({\n alias: \"l\",\n description: \"Print type, path, and metadata fields\",\n })\n ),\n});\n\ntype LsCommandProps = {\n readonly args: [string?];\n readonly options: KnowLsCommandOptions;\n};\n\nexport default function LsCommand({ args, options }: LsCommandProps) {\n return <CommandRunner run={(output) => runKnowLsCommand(args[0], options, output)} />;\n}\n","import { coerceLimit, formatJson, shouldPrintJson } from \"../../../shared/command-utils.js\";\nimport type { CommandOutput } from \"../../../shared/output/types.js\";\nimport {\n compareFilesystemEntries,\n formatLongFilesystemEntryLine,\n formatShellFilesystemEntryName,\n} from \"../format/filesystem-format.js\";\nimport { createKnowledgesApi, type KnowCommandDependencies } from \"../knowledges-api.js\";\nimport { formatCatalogPathForDisplay, normalizeFilesystemCatalogPath } from \"../knowledges-input.js\";\nimport type { KnowLsCommandOptions } from \"../knowledges-options.js\";\n\nexport async function runKnowLsCommand(\n path: string | undefined,\n options: KnowLsCommandOptions,\n output: CommandOutput,\n dependencies?: KnowCommandDependencies\n): Promise<void> {\n const api = dependencies?.api ?? createKnowledgesApi(options);\n const response = await api.listDirectory({\n path: normalizeFilesystemCatalogPath(path ?? \"/\"),\n limit: coerceLimit(options.limit, 100, 1000),\n });\n\n if (shouldPrintJson(options)) {\n output.raw(formatJson(response.data));\n return;\n }\n\n const entries = [...response.data.entries].sort(compareFilesystemEntries);\n const lines = entries.map((entry) =>\n options.long === true\n ? formatLongFilesystemEntryLine(entry)\n : formatShellFilesystemEntryName(entry)\n );\n\n if (lines.length > 0) {\n output.raw(lines.join(\"\\n\"));\n } else {\n output.warning(`No entries under ${formatCatalogPathForDisplay(response.data.path)}.`);\n }\n\n if (response.data.truncated) {\n output.warning(`[truncated: ${response.data.total_entries} total entries]`);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,cAAc;AACvB,SAAS,SAAS;;;ACUlB,eAAsB,iBACpB,MACAA,UACA,QACA,cACe;AACf,QAAM,MAAM,cAAc,OAAO,oBAAoBA,QAAO;AAC5D,QAAM,WAAW,MAAM,IAAI,cAAc;AAAA,IACvC,MAAM,+BAA+B,QAAQ,GAAG;AAAA,IAChD,OAAO,YAAYA,SAAQ,OAAO,KAAK,GAAI;AAAA,EAC7C,CAAC;AAED,MAAI,gBAAgBA,QAAO,GAAG;AAC5B,WAAO,IAAI,WAAW,SAAS,IAAI,CAAC;AACpC;AAAA,EACF;AAEA,QAAM,UAAU,CAAC,GAAG,SAAS,KAAK,OAAO,EAAE,KAAK,wBAAwB;AACxE,QAAM,QAAQ,QAAQ;AAAA,IAAI,CAAC,UACzBA,SAAQ,SAAS,OACb,8BAA8B,KAAK,IACnC,+BAA+B,KAAK;AAAA,EAC1C;AAEA,MAAI,MAAM,SAAS,GAAG;AACpB,WAAO,IAAI,MAAM,KAAK,IAAI,CAAC;AAAA,EAC7B,OAAO;AACL,WAAO,QAAQ,oBAAoB,4BAA4B,SAAS,KAAK,IAAI,CAAC,GAAG;AAAA,EACvF;AAEA,MAAI,SAAS,KAAK,WAAW;AAC3B,WAAO,QAAQ,eAAe,SAAS,KAAK,aAAa,iBAAiB;AAAA,EAC5E;AACF;;;ADhBS;AApBF,IAAM,cAAc;AACpB,IAAM,OAAO;AACb,IAAM,UAAU,mBAAmB,OAAO;AAAA,EAC/C,MAAM,EACH,QAAQ,EACR,SAAS,EACT;AAAA,IACC,OAAO;AAAA,MACL,OAAO;AAAA,MACP,aAAa;AAAA,IACf,CAAC;AAAA,EACH;AACJ,CAAC;AAOc,SAAR,UAA2B,EAAE,MAAAC,OAAM,SAAAC,SAAQ,GAAmB;AACnE,SAAO,oBAAC,iBAAc,KAAK,CAAC,WAAW,iBAAiBD,MAAK,CAAC,GAAGC,UAAS,MAAM,GAAG;AACrF;","names":["options","args","options"]}
|
|
@@ -1,22 +1,60 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
} from "../../chunk-
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
createKnowledgesApi
|
|
3
|
+
} from "../../chunk-U725ZHCI.js";
|
|
4
|
+
import {
|
|
5
|
+
normalizeCatalogPath
|
|
6
|
+
} from "../../chunk-AS7FIJWP.js";
|
|
7
|
+
import {
|
|
8
|
+
coerceLimit,
|
|
9
|
+
coerceOptionalNumber,
|
|
10
|
+
formatJson,
|
|
11
|
+
shouldPrintJson
|
|
12
|
+
} from "../../chunk-XQGLUQFM.js";
|
|
13
|
+
import "../../chunk-GYRLVNJX.js";
|
|
7
14
|
import {
|
|
8
15
|
JsonOutputOptionsSchema,
|
|
9
16
|
RequiredFilePathArgsSchema
|
|
10
|
-
} from "../../chunk-
|
|
17
|
+
} from "../../chunk-25Q463MH.js";
|
|
11
18
|
import {
|
|
12
19
|
CommandRunner
|
|
13
|
-
} from "../../chunk-
|
|
14
|
-
import
|
|
20
|
+
} from "../../chunk-WIEYHKQA.js";
|
|
21
|
+
import {
|
|
22
|
+
resolveOutputFormat
|
|
23
|
+
} from "../../chunk-67FUBMNB.js";
|
|
15
24
|
import "../../chunk-PZ5AY32C.js";
|
|
16
25
|
|
|
17
26
|
// src/commands/knowledges/read.tsx
|
|
18
27
|
import { option } from "pastel";
|
|
19
28
|
import { z } from "zod";
|
|
29
|
+
|
|
30
|
+
// src/features/knowledges/handlers/read.ts
|
|
31
|
+
async function runKnowReadCommand(filePath, options2, output, dependencies) {
|
|
32
|
+
if (!filePath) {
|
|
33
|
+
throw new Error("Missing file_path. Usage: cngkit knowledges read <file_path>");
|
|
34
|
+
}
|
|
35
|
+
const api = dependencies?.api ?? createKnowledgesApi(options2);
|
|
36
|
+
const response = await api.read({
|
|
37
|
+
filePath: normalizeCatalogPath(filePath),
|
|
38
|
+
offset: coerceOptionalNumber(options2.offset),
|
|
39
|
+
limit: coerceLimit(options2.limit, 200, 2e3)
|
|
40
|
+
});
|
|
41
|
+
if (shouldPrintJson(options2)) {
|
|
42
|
+
output.raw(formatJson(response.data));
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
if (resolveOutputFormat() === "markdown" || !response.data.file_path.endsWith(".md")) {
|
|
46
|
+
output.raw(response.data.content);
|
|
47
|
+
} else {
|
|
48
|
+
output.markdown(response.data.content);
|
|
49
|
+
}
|
|
50
|
+
if (response.data.truncated) {
|
|
51
|
+
output.warning(
|
|
52
|
+
`[truncated: showing ${response.data.limit} lines from offset ${response.data.offset} of ${response.data.total_lines}]`
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// src/commands/knowledges/read.tsx
|
|
20
58
|
import { jsx } from "react/jsx-runtime";
|
|
21
59
|
var description = "Claude-style file read";
|
|
22
60
|
var args = RequiredFilePathArgsSchema;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/commands/knowledges/read.tsx"],"sourcesContent":["import { option } from \"pastel\";\nimport { z } from \"zod\";\n\nimport { JsonOutputOptionsSchema, RequiredFilePathArgsSchema } from \"../../cli/options.js\";\nimport { runKnowReadCommand
|
|
1
|
+
{"version":3,"sources":["../../../src/commands/knowledges/read.tsx","../../../src/features/knowledges/handlers/read.ts"],"sourcesContent":["import { option } from \"pastel\";\nimport { z } from \"zod\";\n\nimport { JsonOutputOptionsSchema, RequiredFilePathArgsSchema } from \"../../cli/options.js\";\nimport { runKnowReadCommand } from \"../../features/knowledges/handlers/read.js\";\nimport type { KnowReadCommandOptions } from \"../../features/knowledges/knowledges-options.js\";\nimport { CommandRunner } from \"../../cli/command-runner.js\";\n\nexport const description = \"Claude-style file read\";\nexport const args = RequiredFilePathArgsSchema;\nexport const options = JsonOutputOptionsSchema.extend({\n offset: z\n .number()\n .optional()\n .describe(\n option({\n description: \"Starting line offset\",\n valueDescription: \"n\",\n })\n ),\n limit: z\n .number()\n .optional()\n .describe(\n option({\n description: \"Maximum lines\",\n valueDescription: \"n\",\n })\n ),\n});\n\ntype ReadCommandProps = {\n readonly args: [string];\n readonly options: KnowReadCommandOptions;\n};\n\nexport default function ReadCommand({ args, options }: ReadCommandProps) {\n return <CommandRunner run={(output) => runKnowReadCommand(args[0], options, output)} />;\n}\n","import { coerceLimit, coerceOptionalNumber, formatJson, shouldPrintJson } from \"../../../shared/command-utils.js\";\nimport { resolveOutputFormat } from \"../../../shared/config.js\";\nimport type { CommandOutput } from \"../../../shared/output/types.js\";\nimport { createKnowledgesApi, type KnowCommandDependencies } from \"../knowledges-api.js\";\nimport { normalizeCatalogPath } from \"../knowledges-input.js\";\nimport type { KnowReadCommandOptions } from \"../knowledges-options.js\";\n\nexport async function runKnowReadCommand(\n filePath: string | undefined,\n options: KnowReadCommandOptions,\n output: CommandOutput,\n dependencies?: KnowCommandDependencies\n): Promise<void> {\n if (!filePath) {\n throw new Error(\"Missing file_path. Usage: cngkit knowledges read <file_path>\");\n }\n\n const api = dependencies?.api ?? createKnowledgesApi(options);\n const response = await api.read({\n filePath: normalizeCatalogPath(filePath),\n offset: coerceOptionalNumber(options.offset),\n limit: coerceLimit(options.limit, 200, 2000),\n });\n\n if (shouldPrintJson(options)) {\n output.raw(formatJson(response.data));\n return;\n }\n\n if (resolveOutputFormat() === \"markdown\" || !response.data.file_path.endsWith(\".md\")) {\n output.raw(response.data.content);\n } else {\n output.markdown(response.data.content);\n }\n\n if (response.data.truncated) {\n output.warning(\n `[truncated: showing ${response.data.limit} lines from offset ${response.data.offset} of ${response.data.total_lines}]`\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,cAAc;AACvB,SAAS,SAAS;;;ACMlB,eAAsB,mBACpB,UACAA,UACA,QACA,cACe;AACf,MAAI,CAAC,UAAU;AACb,UAAM,IAAI,MAAM,8DAA8D;AAAA,EAChF;AAEA,QAAM,MAAM,cAAc,OAAO,oBAAoBA,QAAO;AAC5D,QAAM,WAAW,MAAM,IAAI,KAAK;AAAA,IAC9B,UAAU,qBAAqB,QAAQ;AAAA,IACvC,QAAQ,qBAAqBA,SAAQ,MAAM;AAAA,IAC3C,OAAO,YAAYA,SAAQ,OAAO,KAAK,GAAI;AAAA,EAC7C,CAAC;AAED,MAAI,gBAAgBA,QAAO,GAAG;AAC5B,WAAO,IAAI,WAAW,SAAS,IAAI,CAAC;AACpC;AAAA,EACF;AAEA,MAAI,oBAAoB,MAAM,cAAc,CAAC,SAAS,KAAK,UAAU,SAAS,KAAK,GAAG;AACpF,WAAO,IAAI,SAAS,KAAK,OAAO;AAAA,EAClC,OAAO;AACL,WAAO,SAAS,SAAS,KAAK,OAAO;AAAA,EACvC;AAEA,MAAI,SAAS,KAAK,WAAW;AAC3B,WAAO;AAAA,MACL,uBAAuB,SAAS,KAAK,KAAK,sBAAsB,SAAS,KAAK,MAAM,OAAO,SAAS,KAAK,WAAW;AAAA,IACtH;AAAA,EACF;AACF;;;ADHS;AA7BF,IAAM,cAAc;AACpB,IAAM,OAAO;AACb,IAAM,UAAU,wBAAwB,OAAO;AAAA,EACpD,QAAQ,EACL,OAAO,EACP,SAAS,EACT;AAAA,IACC,OAAO;AAAA,MACL,aAAa;AAAA,MACb,kBAAkB;AAAA,IACpB,CAAC;AAAA,EACH;AAAA,EACF,OAAO,EACJ,OAAO,EACP,SAAS,EACT;AAAA,IACC,OAAO;AAAA,MACL,aAAa;AAAA,MACb,kBAAkB;AAAA,IACpB,CAAC;AAAA,EACH;AACJ,CAAC;AAOc,SAAR,YAA6B,EAAE,MAAAC,OAAM,SAAAC,SAAQ,GAAqB;AACvE,SAAO,oBAAC,iBAAc,KAAK,CAAC,WAAW,mBAAmBD,MAAK,CAAC,GAAGC,UAAS,MAAM,GAAG;AACvF;","names":["options","args","options"]}
|
|
@@ -1,19 +1,34 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import
|
|
6
|
-
|
|
2
|
+
formatCatalogPathForDisplay,
|
|
3
|
+
normalizeFilesystemCatalogPath
|
|
4
|
+
} from "../../chunk-AS7FIJWP.js";
|
|
5
|
+
import {
|
|
6
|
+
formatJson,
|
|
7
|
+
shouldPrintJson
|
|
8
|
+
} from "../../chunk-XQGLUQFM.js";
|
|
7
9
|
import {
|
|
8
10
|
JsonOutputOptionsSchema,
|
|
9
11
|
RequiredCatalogPathArgsSchema
|
|
10
|
-
} from "../../chunk-
|
|
12
|
+
} from "../../chunk-25Q463MH.js";
|
|
11
13
|
import {
|
|
12
14
|
CommandRunner
|
|
13
|
-
} from "../../chunk-
|
|
14
|
-
import "../../chunk-
|
|
15
|
+
} from "../../chunk-WIEYHKQA.js";
|
|
16
|
+
import "../../chunk-67FUBMNB.js";
|
|
15
17
|
import "../../chunk-PZ5AY32C.js";
|
|
16
18
|
|
|
19
|
+
// src/features/knowledges/handlers/realpath.ts
|
|
20
|
+
async function runKnowRealpathCommand(path, options2, output) {
|
|
21
|
+
if (!path) {
|
|
22
|
+
throw new Error("Missing path. Usage: cngkit knowledges realpath <path>");
|
|
23
|
+
}
|
|
24
|
+
const resolvedPath = formatCatalogPathForDisplay(normalizeFilesystemCatalogPath(path));
|
|
25
|
+
if (shouldPrintJson(options2)) {
|
|
26
|
+
output.raw(formatJson({ path: resolvedPath }));
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
output.raw(resolvedPath);
|
|
30
|
+
}
|
|
31
|
+
|
|
17
32
|
// src/commands/knowledges/realpath.tsx
|
|
18
33
|
import { jsx } from "react/jsx-runtime";
|
|
19
34
|
var description = "Normalize a topics-root catalog path";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/commands/knowledges/realpath.tsx"],"sourcesContent":["import { JsonOutputOptionsSchema, RequiredCatalogPathArgsSchema } from \"../../cli/options.js\";\nimport { runKnowRealpathCommand
|
|
1
|
+
{"version":3,"sources":["../../../src/features/knowledges/handlers/realpath.ts","../../../src/commands/knowledges/realpath.tsx"],"sourcesContent":["import { formatJson, shouldPrintJson } from \"../../../shared/command-utils.js\";\nimport type { CommandOutput } from \"../../../shared/output/types.js\";\nimport { formatCatalogPathForDisplay, normalizeFilesystemCatalogPath } from \"../knowledges-input.js\";\nimport type { KnowRealpathCommandOptions } from \"../knowledges-options.js\";\n\nexport async function runKnowRealpathCommand(\n path: string | undefined,\n options: KnowRealpathCommandOptions,\n output: CommandOutput\n): Promise<void> {\n if (!path) {\n throw new Error(\"Missing path. Usage: cngkit knowledges realpath <path>\");\n }\n\n const resolvedPath = formatCatalogPathForDisplay(normalizeFilesystemCatalogPath(path));\n if (shouldPrintJson(options)) {\n output.raw(formatJson({ path: resolvedPath }));\n return;\n }\n\n output.raw(resolvedPath);\n}\n","import { JsonOutputOptionsSchema, RequiredCatalogPathArgsSchema } from \"../../cli/options.js\";\nimport { runKnowRealpathCommand } from \"../../features/knowledges/handlers/realpath.js\";\nimport type { KnowRealpathCommandOptions } from \"../../features/knowledges/knowledges-options.js\";\nimport { CommandRunner } from \"../../cli/command-runner.js\";\n\nexport const description = \"Normalize a topics-root catalog path\";\nexport const args = RequiredCatalogPathArgsSchema;\nexport const options = JsonOutputOptionsSchema;\n\ntype RealpathCommandProps = {\n readonly args: [string];\n readonly options: KnowRealpathCommandOptions;\n};\n\nexport default function RealpathCommand({ args, options }: RealpathCommandProps) {\n return <CommandRunner run={(output) => runKnowRealpathCommand(args[0], options, output)} />;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAKA,eAAsB,uBACpB,MACAA,UACA,QACe;AACf,MAAI,CAAC,MAAM;AACT,UAAM,IAAI,MAAM,wDAAwD;AAAA,EAC1E;AAEA,QAAM,eAAe,4BAA4B,+BAA+B,IAAI,CAAC;AACrF,MAAI,gBAAgBA,QAAO,GAAG;AAC5B,WAAO,IAAI,WAAW,EAAE,MAAM,aAAa,CAAC,CAAC;AAC7C;AAAA,EACF;AAEA,SAAO,IAAI,YAAY;AACzB;;;ACNS;AAVF,IAAM,cAAc;AACpB,IAAM,OAAO;AACb,IAAM,UAAU;AAOR,SAAR,gBAAiC,EAAE,MAAAC,OAAM,SAAAC,SAAQ,GAAyB;AAC/E,SAAO,oBAAC,iBAAc,KAAK,CAAC,WAAW,uBAAuBD,MAAK,CAAC,GAAGC,UAAS,MAAM,GAAG;AAC3F;","names":["options","args","options"]}
|
|
@@ -1,19 +1,45 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
} from "../../chunk-
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
KnowSearchResults
|
|
3
|
+
} from "../../chunk-VMTXY4KQ.js";
|
|
4
|
+
import {
|
|
5
|
+
createKnowledgesApi
|
|
6
|
+
} from "../../chunk-U725ZHCI.js";
|
|
7
|
+
import "../../chunk-AS7FIJWP.js";
|
|
8
|
+
import {
|
|
9
|
+
coerceLimit,
|
|
10
|
+
formatJson,
|
|
11
|
+
shouldPrintJson
|
|
12
|
+
} from "../../chunk-XQGLUQFM.js";
|
|
13
|
+
import "../../chunk-GYRLVNJX.js";
|
|
7
14
|
import {
|
|
8
15
|
LimitOptionsSchema,
|
|
9
16
|
RequiredQueryArgsSchema
|
|
10
|
-
} from "../../chunk-
|
|
17
|
+
} from "../../chunk-25Q463MH.js";
|
|
11
18
|
import {
|
|
12
19
|
CommandRunner
|
|
13
|
-
} from "../../chunk-
|
|
14
|
-
import "../../chunk-
|
|
20
|
+
} from "../../chunk-WIEYHKQA.js";
|
|
21
|
+
import "../../chunk-67FUBMNB.js";
|
|
15
22
|
import "../../chunk-PZ5AY32C.js";
|
|
16
23
|
|
|
24
|
+
// src/features/knowledges/handlers/search.ts
|
|
25
|
+
import { createElement } from "react";
|
|
26
|
+
async function runKnowSearchCommand(query, options2, output, dependencies) {
|
|
27
|
+
if (!query) {
|
|
28
|
+
throw new Error("Missing search query. Usage: cngkit knowledges search <query>");
|
|
29
|
+
}
|
|
30
|
+
const api = dependencies?.api ?? createKnowledgesApi(options2);
|
|
31
|
+
const response = await api.search(query, coerceLimit(options2.limit, 5));
|
|
32
|
+
if (shouldPrintJson(options2)) {
|
|
33
|
+
output.raw(formatJson(response.data));
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
if (response.data.results.length > 0) {
|
|
37
|
+
output.component(createElement(KnowSearchResults, { results: response.data.results }));
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
output.warning(`No results for "${query}".`);
|
|
41
|
+
}
|
|
42
|
+
|
|
17
43
|
// src/commands/knowledges/search.tsx
|
|
18
44
|
import { jsx } from "react/jsx-runtime";
|
|
19
45
|
var description = "Search over Postgres-backed knowledges records";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/commands/knowledges/search.tsx"],"sourcesContent":["import { RequiredQueryArgsSchema, LimitOptionsSchema } from \"../../cli/options.js\";\nimport { runKnowSearchCommand
|
|
1
|
+
{"version":3,"sources":["../../../src/features/knowledges/handlers/search.ts","../../../src/commands/knowledges/search.tsx"],"sourcesContent":["import { createElement } from \"react\";\n\nimport { coerceLimit, formatJson, shouldPrintJson } from \"../../../shared/command-utils.js\";\nimport type { CommandOutput } from \"../../../shared/output/types.js\";\nimport { createKnowledgesApi, type KnowCommandDependencies } from \"../knowledges-api.js\";\nimport { KnowSearchResults } from \"../knowledges-output.js\";\nimport type { KnowSearchCommandOptions } from \"../knowledges-options.js\";\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 if (response.data.results.length > 0) {\n output.component(createElement(KnowSearchResults, { results: response.data.results }));\n return;\n }\n\n output.warning(`No results for \"${query}\".`);\n}\n","import { RequiredQueryArgsSchema, LimitOptionsSchema } from \"../../cli/options.js\";\nimport { runKnowSearchCommand } from \"../../features/knowledges/handlers/search.js\";\nimport type { KnowSearchCommandOptions } from \"../../features/knowledges/knowledges-options.js\";\nimport { CommandRunner } from \"../../cli/command-runner.js\";\n\nexport const description = \"Search over Postgres-backed knowledges records\";\nexport const args = RequiredQueryArgsSchema;\nexport const options = LimitOptionsSchema;\n\ntype SearchCommandProps = {\n readonly args: string[];\n readonly options: KnowSearchCommandOptions;\n};\n\nexport default function SearchCommand({ args, options }: SearchCommandProps) {\n return <CommandRunner run={(output) => runKnowSearchCommand(args.join(\" \"), options, output)} />;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,qBAAqB;AAQ9B,eAAsB,qBACpB,OACAA,UACA,QACA,cACe;AACf,MAAI,CAAC,OAAO;AACV,UAAM,IAAI,MAAM,+DAA+D;AAAA,EACjF;AAEA,QAAM,MAAM,cAAc,OAAO,oBAAoBA,QAAO;AAC5D,QAAM,WAAW,MAAM,IAAI,OAAO,OAAO,YAAYA,SAAQ,OAAO,CAAC,CAAC;AAEtE,MAAI,gBAAgBA,QAAO,GAAG;AAC5B,WAAO,IAAI,WAAW,SAAS,IAAI,CAAC;AACpC;AAAA,EACF;AAEA,MAAI,SAAS,KAAK,QAAQ,SAAS,GAAG;AACpC,WAAO,UAAU,cAAc,mBAAmB,EAAE,SAAS,SAAS,KAAK,QAAQ,CAAC,CAAC;AACrF;AAAA,EACF;AAEA,SAAO,QAAQ,mBAAmB,KAAK,IAAI;AAC7C;;;ACjBS;AAVF,IAAM,cAAc;AACpB,IAAM,OAAO;AACb,IAAM,UAAU;AAOR,SAAR,cAA+B,EAAE,MAAAC,OAAM,SAAAC,SAAQ,GAAuB;AAC3E,SAAO,oBAAC,iBAAc,KAAK,CAAC,WAAW,qBAAqBD,MAAK,KAAK,GAAG,GAAGC,UAAS,MAAM,GAAG;AAChG;","names":["options","args","options"]}
|
|
@@ -1,19 +1,43 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
} from "../../chunk-
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
formatFilesystemStat
|
|
3
|
+
} from "../../chunk-YALWTRIP.js";
|
|
4
|
+
import {
|
|
5
|
+
createKnowledgesApi
|
|
6
|
+
} from "../../chunk-U725ZHCI.js";
|
|
7
|
+
import {
|
|
8
|
+
normalizeFilesystemCatalogPath
|
|
9
|
+
} from "../../chunk-AS7FIJWP.js";
|
|
10
|
+
import {
|
|
11
|
+
formatJson,
|
|
12
|
+
shouldPrintJson
|
|
13
|
+
} from "../../chunk-XQGLUQFM.js";
|
|
14
|
+
import "../../chunk-GYRLVNJX.js";
|
|
7
15
|
import {
|
|
8
16
|
JsonOutputOptionsSchema,
|
|
9
17
|
RequiredCatalogPathArgsSchema
|
|
10
|
-
} from "../../chunk-
|
|
18
|
+
} from "../../chunk-25Q463MH.js";
|
|
11
19
|
import {
|
|
12
20
|
CommandRunner
|
|
13
|
-
} from "../../chunk-
|
|
14
|
-
import "../../chunk-
|
|
21
|
+
} from "../../chunk-WIEYHKQA.js";
|
|
22
|
+
import "../../chunk-67FUBMNB.js";
|
|
15
23
|
import "../../chunk-PZ5AY32C.js";
|
|
16
24
|
|
|
25
|
+
// src/features/knowledges/handlers/stat.ts
|
|
26
|
+
async function runKnowStatCommand(path, options2, output, dependencies) {
|
|
27
|
+
if (!path) {
|
|
28
|
+
throw new Error("Missing path. Usage: cngkit knowledges stat <path>");
|
|
29
|
+
}
|
|
30
|
+
const api = dependencies?.api ?? createKnowledgesApi(options2);
|
|
31
|
+
const response = await api.statPath({
|
|
32
|
+
path: normalizeFilesystemCatalogPath(path)
|
|
33
|
+
});
|
|
34
|
+
if (shouldPrintJson(options2)) {
|
|
35
|
+
output.raw(formatJson(response.data));
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
output.raw(formatFilesystemStat(response.data));
|
|
39
|
+
}
|
|
40
|
+
|
|
17
41
|
// src/commands/knowledges/stat.tsx
|
|
18
42
|
import { jsx } from "react/jsx-runtime";
|
|
19
43
|
var description = "Print remote catalog path metadata";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/commands/knowledges/stat.tsx"],"sourcesContent":["import { JsonOutputOptionsSchema, RequiredCatalogPathArgsSchema } from \"../../cli/options.js\";\nimport { runKnowStatCommand
|
|
1
|
+
{"version":3,"sources":["../../../src/features/knowledges/handlers/stat.ts","../../../src/commands/knowledges/stat.tsx"],"sourcesContent":["import { formatJson, shouldPrintJson } from \"../../../shared/command-utils.js\";\nimport type { CommandOutput } from \"../../../shared/output/types.js\";\nimport { formatFilesystemStat } from \"../format/filesystem-format.js\";\nimport { createKnowledgesApi, type KnowCommandDependencies } from \"../knowledges-api.js\";\nimport { normalizeFilesystemCatalogPath } from \"../knowledges-input.js\";\nimport type { KnowStatCommandOptions } from \"../knowledges-options.js\";\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","import { JsonOutputOptionsSchema, RequiredCatalogPathArgsSchema } from \"../../cli/options.js\";\nimport { runKnowStatCommand } from \"../../features/knowledges/handlers/stat.js\";\nimport type { KnowStatCommandOptions } from \"../../features/knowledges/knowledges-options.js\";\nimport { CommandRunner } from \"../../cli/command-runner.js\";\n\nexport const description = \"Print remote catalog path metadata\";\nexport const args = RequiredCatalogPathArgsSchema;\nexport const options = JsonOutputOptionsSchema;\n\ntype StatCommandProps = {\n readonly args: [string];\n readonly options: KnowStatCommandOptions;\n};\n\nexport default function StatCommand({ args, options }: StatCommandProps) {\n return <CommandRunner run={(output) => runKnowStatCommand(args[0], options, output)} />;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAOA,eAAsB,mBACpB,MACAA,UACA,QACA,cACe;AACf,MAAI,CAAC,MAAM;AACT,UAAM,IAAI,MAAM,oDAAoD;AAAA,EACtE;AAEA,QAAM,MAAM,cAAc,OAAO,oBAAoBA,QAAO;AAC5D,QAAM,WAAW,MAAM,IAAI,SAAS;AAAA,IAClC,MAAM,+BAA+B,IAAI;AAAA,EAC3C,CAAC;AAED,MAAI,gBAAgBA,QAAO,GAAG;AAC5B,WAAO,IAAI,WAAW,SAAS,IAAI,CAAC;AACpC;AAAA,EACF;AAEA,SAAO,IAAI,qBAAqB,SAAS,IAAI,CAAC;AAChD;;;ACbS;AAVF,IAAM,cAAc;AACpB,IAAM,OAAO;AACb,IAAM,UAAU;AAOR,SAAR,YAA6B,EAAE,MAAAC,OAAM,SAAAC,SAAQ,GAAqB;AACvE,SAAO,oBAAC,iBAAc,KAAK,CAAC,WAAW,mBAAmBD,MAAK,CAAC,GAAGC,UAAS,MAAM,GAAG;AACvF;","names":["options","args","options"]}
|
|
@@ -1,18 +1,36 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
} from "../../chunk-
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
KnowCatalogSummary
|
|
3
|
+
} from "../../chunk-VMTXY4KQ.js";
|
|
4
|
+
import {
|
|
5
|
+
createKnowledgesApi
|
|
6
|
+
} from "../../chunk-U725ZHCI.js";
|
|
7
|
+
import "../../chunk-AS7FIJWP.js";
|
|
8
|
+
import {
|
|
9
|
+
formatJson,
|
|
10
|
+
shouldPrintJson
|
|
11
|
+
} from "../../chunk-XQGLUQFM.js";
|
|
12
|
+
import "../../chunk-GYRLVNJX.js";
|
|
7
13
|
import {
|
|
8
14
|
JsonOutputOptionsSchema
|
|
9
|
-
} from "../../chunk-
|
|
15
|
+
} from "../../chunk-25Q463MH.js";
|
|
10
16
|
import {
|
|
11
17
|
CommandRunner
|
|
12
|
-
} from "../../chunk-
|
|
13
|
-
import "../../chunk-
|
|
18
|
+
} from "../../chunk-WIEYHKQA.js";
|
|
19
|
+
import "../../chunk-67FUBMNB.js";
|
|
14
20
|
import "../../chunk-PZ5AY32C.js";
|
|
15
21
|
|
|
22
|
+
// src/features/knowledges/handlers/status.ts
|
|
23
|
+
import { createElement } from "react";
|
|
24
|
+
async function runKnowStatusCommand(options2, output, dependencies) {
|
|
25
|
+
const api = dependencies?.api ?? createKnowledgesApi(options2);
|
|
26
|
+
const response = await api.getCatalog();
|
|
27
|
+
if (shouldPrintJson(options2)) {
|
|
28
|
+
output.raw(formatJson(response.data));
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
output.component(createElement(KnowCatalogSummary, { catalog: response.data }));
|
|
32
|
+
}
|
|
33
|
+
|
|
16
34
|
// src/commands/knowledges/status.tsx
|
|
17
35
|
import { jsx } from "react/jsx-runtime";
|
|
18
36
|
var description = "Print remote catalog state";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/commands/knowledges/status.tsx"],"sourcesContent":["import { JsonOutputOptionsSchema } from \"../../cli/options.js\";\nimport { runKnowStatusCommand
|
|
1
|
+
{"version":3,"sources":["../../../src/features/knowledges/handlers/status.ts","../../../src/commands/knowledges/status.tsx"],"sourcesContent":["import { createElement } from \"react\";\n\nimport { formatJson, shouldPrintJson } from \"../../../shared/command-utils.js\";\nimport type { CommandOutput } from \"../../../shared/output/types.js\";\nimport { createKnowledgesApi, type KnowCommandDependencies } from \"../knowledges-api.js\";\nimport { KnowCatalogSummary } from \"../knowledges-output.js\";\nimport type { KnowStatusCommandOptions } from \"../knowledges-options.js\";\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 output.component(createElement(KnowCatalogSummary, { catalog: response.data }));\n}\n","import { JsonOutputOptionsSchema } from \"../../cli/options.js\";\nimport { runKnowStatusCommand } from \"../../features/knowledges/handlers/status.js\";\nimport type { KnowStatusCommandOptions } from \"../../features/knowledges/knowledges-options.js\";\nimport { CommandRunner } from \"../../cli/command-runner.js\";\n\nexport const description = \"Print remote catalog state\";\nexport const options = JsonOutputOptionsSchema;\n\ntype StatusCommandProps = {\n readonly options: KnowStatusCommandOptions;\n};\n\nexport default function StatusCommand({ options }: StatusCommandProps) {\n return <CommandRunner run={(output) => runKnowStatusCommand(options, output)} />;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,qBAAqB;AAQ9B,eAAsB,qBACpBA,UACA,QACA,cACe;AACf,QAAM,MAAM,cAAc,OAAO,oBAAoBA,QAAO;AAC5D,QAAM,WAAW,MAAM,IAAI,WAAW;AAEtC,MAAI,gBAAgBA,QAAO,GAAG;AAC5B,WAAO,IAAI,WAAW,SAAS,IAAI,CAAC;AACpC;AAAA,EACF;AAEA,SAAO,UAAU,cAAc,oBAAoB,EAAE,SAAS,SAAS,KAAK,CAAC,CAAC;AAChF;;;ACTS;AARF,IAAM,cAAc;AACpB,IAAM,UAAU;AAMR,SAAR,cAA+B,EAAE,SAAAC,SAAQ,GAAuB;AACrE,SAAO,oBAAC,iBAAc,KAAK,CAAC,WAAW,qBAAqBA,UAAS,MAAM,GAAG;AAChF;","names":["options","options"]}
|
|
@@ -1,22 +1,44 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
} from "../../chunk-
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
outputRawContent
|
|
3
|
+
} from "../../chunk-BRFWVQI4.js";
|
|
4
|
+
import {
|
|
5
|
+
createKnowledgesApi
|
|
6
|
+
} from "../../chunk-U725ZHCI.js";
|
|
7
|
+
import {
|
|
8
|
+
normalizeCatalogPath
|
|
9
|
+
} from "../../chunk-AS7FIJWP.js";
|
|
10
|
+
import {
|
|
11
|
+
coerceLimit
|
|
12
|
+
} from "../../chunk-XQGLUQFM.js";
|
|
13
|
+
import "../../chunk-GYRLVNJX.js";
|
|
7
14
|
import {
|
|
8
15
|
JsonOutputOptionsSchema,
|
|
9
16
|
RequiredFilePathArgsSchema
|
|
10
|
-
} from "../../chunk-
|
|
17
|
+
} from "../../chunk-25Q463MH.js";
|
|
11
18
|
import {
|
|
12
19
|
CommandRunner
|
|
13
|
-
} from "../../chunk-
|
|
14
|
-
import "../../chunk-
|
|
20
|
+
} from "../../chunk-WIEYHKQA.js";
|
|
21
|
+
import "../../chunk-67FUBMNB.js";
|
|
15
22
|
import "../../chunk-PZ5AY32C.js";
|
|
16
23
|
|
|
17
24
|
// src/commands/knowledges/tail.tsx
|
|
18
25
|
import { option } from "pastel";
|
|
19
26
|
import { z } from "zod";
|
|
27
|
+
|
|
28
|
+
// src/features/knowledges/handlers/tail.ts
|
|
29
|
+
async function runKnowTailCommand(filePath, options2, output, dependencies) {
|
|
30
|
+
if (!filePath) {
|
|
31
|
+
throw new Error("Missing file_path. Usage: cngkit knowledges tail <file_path> -n 10");
|
|
32
|
+
}
|
|
33
|
+
const api = dependencies?.api ?? createKnowledgesApi(options2);
|
|
34
|
+
const response = await api.tail({
|
|
35
|
+
filePath: normalizeCatalogPath(filePath),
|
|
36
|
+
lines: coerceLimit(options2.lines, 10, 2e3)
|
|
37
|
+
});
|
|
38
|
+
outputRawContent(response.data, options2, output);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// src/commands/knowledges/tail.tsx
|
|
20
42
|
import { jsx } from "react/jsx-runtime";
|
|
21
43
|
var description = "Print the last lines of a remote catalog file";
|
|
22
44
|
var args = RequiredFilePathArgsSchema;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/commands/knowledges/tail.tsx"],"sourcesContent":["import { option } from \"pastel\";\nimport { z } from \"zod\";\n\nimport { JsonOutputOptionsSchema, RequiredFilePathArgsSchema } from \"../../cli/options.js\";\nimport { runKnowTailCommand
|
|
1
|
+
{"version":3,"sources":["../../../src/commands/knowledges/tail.tsx","../../../src/features/knowledges/handlers/tail.ts"],"sourcesContent":["import { option } from \"pastel\";\nimport { z } from \"zod\";\n\nimport { JsonOutputOptionsSchema, RequiredFilePathArgsSchema } from \"../../cli/options.js\";\nimport { runKnowTailCommand } from \"../../features/knowledges/handlers/tail.js\";\nimport type { KnowTailCommandOptions } from \"../../features/knowledges/knowledges-options.js\";\nimport { CommandRunner } from \"../../cli/command-runner.js\";\n\nexport const description = \"Print the last lines of a remote catalog file\";\nexport const args = RequiredFilePathArgsSchema;\nexport const options = JsonOutputOptionsSchema.extend({\n lines: z\n .number()\n .optional()\n .describe(\n option({\n alias: \"n\",\n description: \"Number of lines\",\n valueDescription: \"n\",\n })\n ),\n});\n\ntype TailCommandProps = {\n readonly args: [string];\n readonly options: KnowTailCommandOptions;\n};\n\nexport default function TailCommand({ args, options }: TailCommandProps) {\n return <CommandRunner run={(output) => runKnowTailCommand(args[0], options, output)} />;\n}\n","import { coerceLimit } from \"../../../shared/command-utils.js\";\nimport type { CommandOutput } from \"../../../shared/output/types.js\";\nimport { createKnowledgesApi, type KnowCommandDependencies } from \"../knowledges-api.js\";\nimport { normalizeCatalogPath } from \"../knowledges-input.js\";\nimport type { KnowTailCommandOptions } from \"../knowledges-options.js\";\nimport { outputRawContent } from \"../format/content-format.js\";\n\nexport async function runKnowTailCommand(\n filePath: string | undefined,\n options: KnowTailCommandOptions,\n output: CommandOutput,\n dependencies?: KnowCommandDependencies\n): Promise<void> {\n if (!filePath) {\n throw new Error(\"Missing file_path. Usage: cngkit knowledges tail <file_path> -n 10\");\n }\n\n const api = dependencies?.api ?? createKnowledgesApi(options);\n const response = await api.tail({\n filePath: normalizeCatalogPath(filePath),\n lines: coerceLimit(options.lines, 10, 2000),\n });\n\n outputRawContent(response.data, options, output);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,cAAc;AACvB,SAAS,SAAS;;;ACMlB,eAAsB,mBACpB,UACAA,UACA,QACA,cACe;AACf,MAAI,CAAC,UAAU;AACb,UAAM,IAAI,MAAM,oEAAoE;AAAA,EACtF;AAEA,QAAM,MAAM,cAAc,OAAO,oBAAoBA,QAAO;AAC5D,QAAM,WAAW,MAAM,IAAI,KAAK;AAAA,IAC9B,UAAU,qBAAqB,QAAQ;AAAA,IACvC,OAAO,YAAYA,SAAQ,OAAO,IAAI,GAAI;AAAA,EAC5C,CAAC;AAED,mBAAiB,SAAS,MAAMA,UAAS,MAAM;AACjD;;;ADKS;AArBF,IAAM,cAAc;AACpB,IAAM,OAAO;AACb,IAAM,UAAU,wBAAwB,OAAO;AAAA,EACpD,OAAO,EACJ,OAAO,EACP,SAAS,EACT;AAAA,IACC,OAAO;AAAA,MACL,OAAO;AAAA,MACP,aAAa;AAAA,MACb,kBAAkB;AAAA,IACpB,CAAC;AAAA,EACH;AACJ,CAAC;AAOc,SAAR,YAA6B,EAAE,MAAAC,OAAM,SAAAC,SAAQ,GAAqB;AACvE,SAAO,oBAAC,iBAAc,KAAK,CAAC,WAAW,mBAAmBD,MAAK,CAAC,GAAGC,UAAS,MAAM,GAAG;AACvF;","names":["options","args","options"]}
|
|
@@ -1,22 +1,52 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
} from "../../chunk-
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
formatFilesystemTree
|
|
3
|
+
} from "../../chunk-YALWTRIP.js";
|
|
4
|
+
import {
|
|
5
|
+
createKnowledgesApi
|
|
6
|
+
} from "../../chunk-U725ZHCI.js";
|
|
7
|
+
import {
|
|
8
|
+
normalizeFilesystemCatalogPath
|
|
9
|
+
} from "../../chunk-AS7FIJWP.js";
|
|
10
|
+
import {
|
|
11
|
+
coerceLimit,
|
|
12
|
+
formatJson,
|
|
13
|
+
shouldPrintJson
|
|
14
|
+
} from "../../chunk-XQGLUQFM.js";
|
|
15
|
+
import "../../chunk-GYRLVNJX.js";
|
|
7
16
|
import {
|
|
8
17
|
JsonOutputOptionsSchema,
|
|
9
18
|
OptionalPathArgsSchema
|
|
10
|
-
} from "../../chunk-
|
|
19
|
+
} from "../../chunk-25Q463MH.js";
|
|
11
20
|
import {
|
|
12
21
|
CommandRunner
|
|
13
|
-
} from "../../chunk-
|
|
14
|
-
import "../../chunk-
|
|
22
|
+
} from "../../chunk-WIEYHKQA.js";
|
|
23
|
+
import "../../chunk-67FUBMNB.js";
|
|
15
24
|
import "../../chunk-PZ5AY32C.js";
|
|
16
25
|
|
|
17
26
|
// src/commands/knowledges/tree.tsx
|
|
18
27
|
import { option } from "pastel";
|
|
19
28
|
import { z } from "zod";
|
|
29
|
+
|
|
30
|
+
// src/features/knowledges/handlers/tree.ts
|
|
31
|
+
async function runKnowTreeCommand(path, options2, output, dependencies) {
|
|
32
|
+
const api = dependencies?.api ?? createKnowledgesApi(options2);
|
|
33
|
+
const response = await api.tree({
|
|
34
|
+
path: normalizeFilesystemCatalogPath(path ?? "/"),
|
|
35
|
+
depth: coerceLimit(options2.depth, 3, 8),
|
|
36
|
+
limit: coerceLimit(options2.limit, 500, 2e3)
|
|
37
|
+
});
|
|
38
|
+
if (shouldPrintJson(options2)) {
|
|
39
|
+
output.raw(formatJson(response.data));
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
const lines = formatFilesystemTree(response.data.path, response.data.entries);
|
|
43
|
+
output.raw(lines.join("\n"));
|
|
44
|
+
if (response.data.truncated) {
|
|
45
|
+
output.warning(`[truncated: ${response.data.total_entries} total entries]`);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// src/commands/knowledges/tree.tsx
|
|
20
50
|
import { jsx } from "react/jsx-runtime";
|
|
21
51
|
var description = "Print a remote catalog directory tree";
|
|
22
52
|
var args = OptionalPathArgsSchema;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/commands/knowledges/tree.tsx"],"sourcesContent":["import { option } from \"pastel\";\nimport { z } from \"zod\";\n\nimport { JsonOutputOptionsSchema, OptionalPathArgsSchema } from \"../../cli/options.js\";\nimport { runKnowTreeCommand
|
|
1
|
+
{"version":3,"sources":["../../../src/commands/knowledges/tree.tsx","../../../src/features/knowledges/handlers/tree.ts"],"sourcesContent":["import { option } from \"pastel\";\nimport { z } from \"zod\";\n\nimport { JsonOutputOptionsSchema, OptionalPathArgsSchema } from \"../../cli/options.js\";\nimport { runKnowTreeCommand } from \"../../features/knowledges/handlers/tree.js\";\nimport type { KnowTreeCommandOptions } from \"../../features/knowledges/knowledges-options.js\";\nimport { CommandRunner } from \"../../cli/command-runner.js\";\n\nexport const description = \"Print a remote catalog directory tree\";\nexport const args = OptionalPathArgsSchema;\nexport const options = JsonOutputOptionsSchema.extend({\n depth: z\n .number()\n .optional()\n .describe(\n option({\n description: \"Maximum tree depth\",\n valueDescription: \"n\",\n })\n ),\n limit: z\n .number()\n .optional()\n .describe(\n option({\n description: \"Maximum entries\",\n valueDescription: \"n\",\n })\n ),\n});\n\ntype TreeCommandProps = {\n readonly args: [string?];\n readonly options: KnowTreeCommandOptions;\n};\n\nexport default function TreeCommand({ args, options }: TreeCommandProps) {\n return <CommandRunner run={(output) => runKnowTreeCommand(args[0], options, output)} />;\n}\n","import { coerceLimit, formatJson, shouldPrintJson } from \"../../../shared/command-utils.js\";\nimport type { CommandOutput } from \"../../../shared/output/types.js\";\nimport { formatFilesystemTree } from \"../format/filesystem-format.js\";\nimport { createKnowledgesApi, type KnowCommandDependencies } from \"../knowledges-api.js\";\nimport { normalizeFilesystemCatalogPath } from \"../knowledges-input.js\";\nimport type { KnowTreeCommandOptions } from \"../knowledges-options.js\";\n\nexport async function runKnowTreeCommand(\n path: string | undefined,\n options: KnowTreeCommandOptions,\n output: CommandOutput,\n dependencies?: KnowCommandDependencies\n): Promise<void> {\n const api = dependencies?.api ?? createKnowledgesApi(options);\n const response = await api.tree({\n path: normalizeFilesystemCatalogPath(path ?? \"/\"),\n depth: coerceLimit(options.depth, 3, 8),\n limit: coerceLimit(options.limit, 500, 2000),\n });\n\n if (shouldPrintJson(options)) {\n output.raw(formatJson(response.data));\n return;\n }\n\n const lines = formatFilesystemTree(response.data.path, response.data.entries);\n output.raw(lines.join(\"\\n\"));\n\n if (response.data.truncated) {\n output.warning(`[truncated: ${response.data.total_entries} total entries]`);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,cAAc;AACvB,SAAS,SAAS;;;ACMlB,eAAsB,mBACpB,MACAA,UACA,QACA,cACe;AACf,QAAM,MAAM,cAAc,OAAO,oBAAoBA,QAAO;AAC5D,QAAM,WAAW,MAAM,IAAI,KAAK;AAAA,IAC9B,MAAM,+BAA+B,QAAQ,GAAG;AAAA,IAChD,OAAO,YAAYA,SAAQ,OAAO,GAAG,CAAC;AAAA,IACtC,OAAO,YAAYA,SAAQ,OAAO,KAAK,GAAI;AAAA,EAC7C,CAAC;AAED,MAAI,gBAAgBA,QAAO,GAAG;AAC5B,WAAO,IAAI,WAAW,SAAS,IAAI,CAAC;AACpC;AAAA,EACF;AAEA,QAAM,QAAQ,qBAAqB,SAAS,KAAK,MAAM,SAAS,KAAK,OAAO;AAC5E,SAAO,IAAI,MAAM,KAAK,IAAI,CAAC;AAE3B,MAAI,SAAS,KAAK,WAAW;AAC3B,WAAO,QAAQ,eAAe,SAAS,KAAK,aAAa,iBAAiB;AAAA,EAC5E;AACF;;;ADMS;AA7BF,IAAM,cAAc;AACpB,IAAM,OAAO;AACb,IAAM,UAAU,wBAAwB,OAAO;AAAA,EACpD,OAAO,EACJ,OAAO,EACP,SAAS,EACT;AAAA,IACC,OAAO;AAAA,MACL,aAAa;AAAA,MACb,kBAAkB;AAAA,IACpB,CAAC;AAAA,EACH;AAAA,EACF,OAAO,EACJ,OAAO,EACP,SAAS,EACT;AAAA,IACC,OAAO;AAAA,MACL,aAAa;AAAA,MACb,kBAAkB;AAAA,IACpB,CAAC;AAAA,EACH;AACJ,CAAC;AAOc,SAAR,YAA6B,EAAE,MAAAC,OAAM,SAAAC,SAAQ,GAAqB;AACvE,SAAO,oBAAC,iBAAc,KAAK,CAAC,WAAW,mBAAmBD,MAAK,CAAC,GAAGC,UAAS,MAAM,GAAG;AACvF;","names":["options","args","options"]}
|