@seclai/cli 1.0.1 → 1.0.3
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 +12 -1
- package/dist/cli.js +16 -6
- package/dist/cli.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -14,7 +14,7 @@ npm i -g @seclai/cli
|
|
|
14
14
|
|
|
15
15
|
Command reference (latest):
|
|
16
16
|
|
|
17
|
-
https://seclai.github.io/seclai-cli/1.0.
|
|
17
|
+
https://seclai.github.io/seclai-cli/1.0.3/
|
|
18
18
|
|
|
19
19
|
## Authentication
|
|
20
20
|
|
|
@@ -57,6 +57,17 @@ seclai agents run 6b9e2a1c-4d5f-4a7b-9c0d-1e2f3a4b5c6d --json-file ./run.json
|
|
|
57
57
|
cat ./run.json | seclai agents run 6b9e2a1c-4d5f-4a7b-9c0d-1e2f3a4b5c6d --json-file -
|
|
58
58
|
```
|
|
59
59
|
|
|
60
|
+
Run an agent via SSE streaming (waits until the final result or timeout):
|
|
61
|
+
|
|
62
|
+
This command exits successfully when the stream emits the final `done` event; it fails if the stream ends early or the timeout is reached.
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
seclai agents run 6b9e2a1c-4d5f-4a7b-9c0d-1e2f3a4b5c6d \
|
|
66
|
+
--json '{"input":"Hello from streaming"}' \
|
|
67
|
+
--stream \
|
|
68
|
+
--timeout-ms 60000
|
|
69
|
+
```
|
|
70
|
+
|
|
60
71
|
List runs:
|
|
61
72
|
|
|
62
73
|
```bash
|
package/dist/cli.js
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
// src/cli.ts
|
|
4
4
|
import { Command } from "commander";
|
|
5
5
|
import { readFile } from "fs/promises";
|
|
6
|
-
import { readFileSync } from "fs";
|
|
6
|
+
import { readFileSync, realpathSync } from "fs";
|
|
7
7
|
import process from "process";
|
|
8
|
-
import { pathToFileURL } from "url";
|
|
8
|
+
import { fileURLToPath, pathToFileURL } from "url";
|
|
9
9
|
import {
|
|
10
10
|
Seclai,
|
|
11
11
|
SeclaiAPIStatusError,
|
|
@@ -62,6 +62,8 @@ function getCliVersion() {
|
|
|
62
62
|
function createClient(opts) {
|
|
63
63
|
const seclaiOpts = {};
|
|
64
64
|
if (opts.apiKey !== void 0) seclaiOpts.apiKey = opts.apiKey;
|
|
65
|
+
const envUrl = process.env.SECLAI_API_URL;
|
|
66
|
+
seclaiOpts.baseUrl = envUrl && envUrl.length > 0 ? envUrl : "https://api.seclai.com";
|
|
65
67
|
return new Seclai(seclaiOpts);
|
|
66
68
|
}
|
|
67
69
|
function printJson(rt, value) {
|
|
@@ -122,7 +124,7 @@ function createProgram(rt = defaultRuntime()) {
|
|
|
122
124
|
writeErr: (str) => rt.writeErr(str)
|
|
123
125
|
});
|
|
124
126
|
program.exitOverride();
|
|
125
|
-
const sources = program.command("sources").description("Manage sources");
|
|
127
|
+
const sources = program.command("sources").alias("source").description("Manage sources");
|
|
126
128
|
sources.command("list").description("List sources").option("--page <n>", "Page number", (v) => Number(v)).option("--limit <n>", "Page size", (v) => Number(v)).option("--sort <field>", "Sort field").option("--order <asc|desc>", "Sort order").option("--account-id <id>", "Filter by account id").action(async (opts) => {
|
|
127
129
|
await run(rt, async () => {
|
|
128
130
|
const global = program.opts();
|
|
@@ -256,9 +258,17 @@ async function runCli(argv, rt = defaultRuntime()) {
|
|
|
256
258
|
return finalExitCode;
|
|
257
259
|
}
|
|
258
260
|
if (process.argv[1]) {
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
261
|
+
try {
|
|
262
|
+
const entryReal = realpathSync(process.argv[1]);
|
|
263
|
+
const selfReal = realpathSync(fileURLToPath(import.meta.url));
|
|
264
|
+
if (entryReal === selfReal) {
|
|
265
|
+
await runCli(process.argv);
|
|
266
|
+
}
|
|
267
|
+
} catch {
|
|
268
|
+
const entryHref = pathToFileURL(process.argv[1]).href;
|
|
269
|
+
if (import.meta.url === entryHref) {
|
|
270
|
+
await runCli(process.argv);
|
|
271
|
+
}
|
|
262
272
|
}
|
|
263
273
|
}
|
|
264
274
|
export {
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/cli.ts"],"sourcesContent":["import { Command } from \"commander\";\nimport { readFile } from \"node:fs/promises\";\nimport { readFileSync } from \"node:fs\";\nimport process from \"node:process\";\nimport { pathToFileURL } from \"node:url\";\n\nimport {\n Seclai,\n SeclaiAPIStatusError,\n SeclaiAPIValidationError,\n SeclaiConfigurationError,\n} from \"@seclai/sdk\";\n\ntype GlobalOptions = {\n apiKey?: string;\n};\n\nexport type CliRuntime = {\n stdin: NodeJS.ReadableStream;\n writeOut: (text: string) => void;\n writeErr: (text: string) => void;\n setExitCode: (code: number) => void;\n};\n\nfunction defaultRuntime(): CliRuntime {\n return {\n stdin: process.stdin,\n writeOut: (text) => {\n process.stdout.write(text);\n },\n writeErr: (text) => {\n process.stderr.write(text);\n },\n setExitCode: (code) => {\n process.exitCode = code;\n },\n };\n}\n\nasync function readStdinText(rt: CliRuntime): Promise<string> {\n return await new Promise((resolve, reject) => {\n let data = \"\";\n rt.stdin.setEncoding(\"utf8\");\n rt.stdin.on(\"data\", (chunk: string) => (data += chunk));\n rt.stdin.on(\"end\", () => resolve(data));\n rt.stdin.on(\"error\", reject);\n });\n}\n\nasync function readJsonInput(\n rt: CliRuntime,\n opts: {\n json?: string;\n jsonFile?: string;\n }\n): Promise<unknown> {\n if (opts.json !== undefined && opts.jsonFile !== undefined) {\n throw new Error(\"Provide only one of --json or --json-file\");\n }\n\n if (opts.jsonFile !== undefined) {\n const text =\n opts.jsonFile === \"-\" ? await readStdinText(rt) : await readFile(opts.jsonFile, \"utf8\");\n return JSON.parse(text);\n }\n\n if (opts.json !== undefined) {\n const text = opts.json === \"-\" ? await readStdinText(rt) : opts.json;\n return JSON.parse(text);\n }\n\n throw new Error(\"Missing JSON input. Provide --json or --json-file.\");\n}\n\nfunction getCliVersion(): string {\n try {\n const packageJsonPath = new URL(\"../package.json\", import.meta.url);\n const raw = readFileSync(packageJsonPath, \"utf8\");\n const parsed = JSON.parse(raw) as { version?: unknown };\n return typeof parsed.version === \"string\" ? parsed.version : \"0.0.0\";\n } catch {\n return \"0.0.0\";\n }\n}\n\nfunction createClient(opts: GlobalOptions): Seclai {\n const seclaiOpts: { apiKey?: string } = {};\n if (opts.apiKey !== undefined) seclaiOpts.apiKey = opts.apiKey;\n return new Seclai(seclaiOpts);\n}\n\nfunction printJson(rt: CliRuntime, value: unknown): void {\n rt.writeOut(`${JSON.stringify(value, null, 2)}\\n`);\n}\n\nfunction printError(rt: CliRuntime, err: unknown): void {\n if (err instanceof SeclaiAPIValidationError) {\n rt.writeErr(`${err.name}: ${err.message}\\n`);\n rt.writeErr(`status: ${err.statusCode}\\n`);\n rt.writeErr(`url: ${err.url}\\n`);\n if (err.responseText) rt.writeErr(`response: ${err.responseText}\\n`);\n if (err.validationError) printJson(rt, { validationError: err.validationError });\n return;\n }\n\n if (err instanceof SeclaiAPIStatusError) {\n rt.writeErr(`${err.name}: ${err.message}\\n`);\n rt.writeErr(`status: ${err.statusCode}\\n`);\n rt.writeErr(`url: ${err.url}\\n`);\n if (err.responseText) rt.writeErr(`response: ${err.responseText}\\n`);\n return;\n }\n\n if (err instanceof SeclaiConfigurationError) {\n rt.writeErr(`${err.name}: ${err.message}\\n`);\n return;\n }\n\n if (err instanceof Error) {\n rt.writeErr(`${err.name}: ${err.message}\\n`);\n return;\n }\n\n rt.writeErr(String(err));\n rt.writeErr(\"\\n\");\n}\n\nasync function run(rt: CliRuntime, main: () => Promise<void>): Promise<void> {\n try {\n await main();\n } catch (err) {\n printError(rt, err);\n rt.setExitCode(1);\n }\n}\n\nexport function createProgram(rt: CliRuntime = defaultRuntime()): Command {\n const program = new Command();\n const cliVersion = getCliVersion();\n\n program\n .name(\"seclai\")\n .description(`Seclai Command Line Interface (v${cliVersion})`)\n .version(cliVersion, \"-V, --version\", \"output the version\")\n .option(\"--api-key <key>\", \"API key (defaults to SECLAI_API_KEY)\");\n\n program.configureOutput({\n writeOut: (str) => rt.writeOut(str),\n writeErr: (str) => rt.writeErr(str),\n });\n // Prevent commander from calling process.exit() (needed for testability)\n program.exitOverride();\n\n // sources\n const sources = program.command(\"sources\").description(\"Manage sources\");\n\nsources\n .command(\"list\")\n .description(\"List sources\")\n .option(\"--page <n>\", \"Page number\", (v) => Number(v))\n .option(\"--limit <n>\", \"Page size\", (v) => Number(v))\n .option(\"--sort <field>\", \"Sort field\")\n .option(\"--order <asc|desc>\", \"Sort order\")\n .option(\"--account-id <id>\", \"Filter by account id\")\n .action(async (opts) => {\n await run(rt, async () => {\n const global = program.opts<GlobalOptions>();\n const client = createClient(global);\n const res = await client.listSources({\n page: opts.page,\n limit: opts.limit,\n sort: opts.sort,\n order: opts.order,\n accountId: opts.accountId,\n });\n printJson(rt, res);\n });\n });\n\nsources\n .command(\"upload\")\n .description(\"Upload a file to a source connection\")\n .argument(\"<sourceConnectionId>\", \"Source connection id\")\n .requiredOption(\"--file <path>\", \"Path to local file\")\n .option(\"--title <title>\", \"Optional title\")\n .option(\"--file-name <name>\", \"Filename to send (defaults to basename)\")\n .option(\"--mime-type <type>\", \"MIME type\")\n .action(async (sourceConnectionId: string, opts) => {\n await run(rt, async () => {\n const global = program.opts<GlobalOptions>();\n const client = createClient(global);\n\n const bytes = new Uint8Array(await readFile(opts.file));\n\n const uploadOpts: {\n file: Uint8Array;\n title?: string;\n fileName?: string;\n mimeType?: string;\n } = { file: bytes };\n if (opts.title !== undefined) uploadOpts.title = opts.title;\n if (opts.fileName !== undefined) uploadOpts.fileName = opts.fileName;\n if (opts.mimeType !== undefined) uploadOpts.mimeType = opts.mimeType;\n\n const res = await client.uploadFileToSource(sourceConnectionId, uploadOpts);\n printJson(rt, res);\n });\n });\n\n// agents\nconst agents = program.command(\"agents\").description(\"Run agents and manage runs\");\n\nagents\n .command(\"run\")\n .description(\"Run an agent\")\n .argument(\"<agentId>\", \"Agent id\")\n .option(\"--json <json>\", \"Request body JSON (string or '-')\")\n .option(\"--json-file <path>\", \"Request body JSON file path (or '-')\")\n .option(\"--stream\", \"Use streaming SSE endpoint and wait for completion\")\n .option(\"--timeout-ms <n>\", \"Client-side timeout in milliseconds\", (v) => Number(v))\n .action(async (agentId: string, opts) => {\n await run(rt, async () => {\n const global = program.opts<GlobalOptions>();\n const client = createClient(global);\n\n const body = await readJsonInput(rt, { json: opts.json, jsonFile: opts.jsonFile });\n\n let res: unknown;\n if (opts.stream) {\n const streamFn = (client as any).runStreamingAgentAndWait as\n | undefined\n | ((agentId: string, body: unknown, opts?: { timeoutMs?: number }) => Promise<unknown>);\n if (!streamFn) {\n throw new Error(\n \"This version of @seclai/sdk does not support streaming agent runs yet. Upgrade @seclai/sdk to a version that includes runStreamingAgentAndWait.\"\n );\n }\n res = await streamFn(agentId, body, opts.timeoutMs !== undefined ? { timeoutMs: opts.timeoutMs } : undefined);\n } else {\n res = await client.runAgent(agentId, body as any);\n }\n printJson(rt, res);\n });\n });\n\nconst agentRuns = agents.command(\"runs\").description(\"Manage agent runs\");\n\nagentRuns\n .command(\"list\")\n .description(\"List runs for an agent\")\n .argument(\"<agentId>\", \"Agent id\")\n .option(\"--page <n>\", \"Page number\", (v) => Number(v))\n .option(\"--limit <n>\", \"Page size\", (v) => Number(v))\n .action(async (agentId: string, opts) => {\n await run(rt, async () => {\n const global = program.opts<GlobalOptions>();\n const client = createClient(global);\n const res = await client.listAgentRuns(agentId, { page: opts.page, limit: opts.limit });\n printJson(rt, res);\n });\n });\n\nagentRuns\n .command(\"get\")\n .description(\"Get a specific agent run\")\n .argument(\"<agentId>\", \"Agent id\")\n .argument(\"<runId>\", \"Run id\")\n .action(async (agentId: string, runId: string) => {\n await run(rt, async () => {\n const global = program.opts<GlobalOptions>();\n const client = createClient(global);\n const res = await client.getAgentRun(agentId, runId);\n printJson(rt, res);\n });\n });\n\nagentRuns\n .command(\"delete\")\n .description(\"Cancel/delete a specific agent run\")\n .argument(\"<agentId>\", \"Agent id\")\n .argument(\"<runId>\", \"Run id\")\n .action(async (agentId: string, runId: string) => {\n await run(rt, async () => {\n const global = program.opts<GlobalOptions>();\n const client = createClient(global);\n const res = await client.deleteAgentRun(agentId, runId);\n printJson(rt, res);\n });\n });\n\n// contents\nconst contents = program.command(\"contents\").description(\"Inspect content and embeddings\");\n\ncontents\n .command(\"get\")\n .description(\"Get content detail\")\n .argument(\"<sourceConnectionContentVersion>\", \"Content version id\")\n .option(\"--start <n>\", \"Start offset\", (v) => Number(v))\n .option(\"--end <n>\", \"End offset\", (v) => Number(v))\n .action(async (sourceConnectionContentVersion: string, opts) => {\n await run(rt, async () => {\n const global = program.opts<GlobalOptions>();\n const client = createClient(global);\n const res = await client.getContentDetail(sourceConnectionContentVersion, {\n start: opts.start,\n end: opts.end,\n });\n printJson(rt, res);\n });\n });\n\ncontents\n .command(\"delete\")\n .description(\"Delete a content version\")\n .argument(\"<sourceConnectionContentVersion>\", \"Content version id\")\n .action(async (sourceConnectionContentVersion: string) => {\n await run(rt, async () => {\n const global = program.opts<GlobalOptions>();\n const client = createClient(global);\n await client.deleteContent(sourceConnectionContentVersion);\n printJson(rt, { ok: true });\n });\n });\n\ncontents\n .command(\"embeddings\")\n .description(\"List embeddings for a content version\")\n .argument(\"<sourceConnectionContentVersion>\", \"Content version id\")\n .option(\"--page <n>\", \"Page number\", (v) => Number(v))\n .option(\"--limit <n>\", \"Page size\", (v) => Number(v))\n .action(async (sourceConnectionContentVersion: string, opts) => {\n await run(rt, async () => {\n const global = program.opts<GlobalOptions>();\n const client = createClient(global);\n const res = await client.listContentEmbeddings(sourceConnectionContentVersion, {\n page: opts.page,\n limit: opts.limit,\n });\n printJson(rt, res);\n });\n });\n\n return program;\n}\n\nexport async function runCli(argv: string[], rt: CliRuntime = defaultRuntime()): Promise<number> {\n let observedExitCode = 0;\n const wrappedRt: CliRuntime = {\n ...rt,\n setExitCode: (code) => {\n observedExitCode = code;\n rt.setExitCode(code);\n },\n };\n\n const program = createProgram(wrappedRt);\n let exitCode = 0;\n\n try {\n await program.parseAsync(argv);\n } catch (err: any) {\n // commander throws a CommanderError on help/version/etc due to exitOverride()\n const maybeExitCode = typeof err?.exitCode === \"number\" ? err.exitCode : undefined;\n if (maybeExitCode !== undefined) {\n exitCode = maybeExitCode;\n } else {\n printError(wrappedRt, err);\n exitCode = 1;\n }\n }\n\n const finalExitCode = observedExitCode !== 0 ? observedExitCode : exitCode;\n wrappedRt.setExitCode(finalExitCode);\n return finalExitCode;\n}\n\n// Only run when executed as an entrypoint, not when imported (e.g. during tests).\nif (process.argv[1]) {\n const entryHref = pathToFileURL(process.argv[1]).href;\n if (import.meta.url === entryHref) {\n await runCli(process.argv);\n }\n}\n"],"mappings":";;;AAAA,SAAS,eAAe;AACxB,SAAS,gBAAgB;AACzB,SAAS,oBAAoB;AAC7B,OAAO,aAAa;AACpB,SAAS,qBAAqB;AAE9B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAaP,SAAS,iBAA6B;AACpC,SAAO;AAAA,IACL,OAAO,QAAQ;AAAA,IACf,UAAU,CAAC,SAAS;AAClB,cAAQ,OAAO,MAAM,IAAI;AAAA,IAC3B;AAAA,IACA,UAAU,CAAC,SAAS;AAClB,cAAQ,OAAO,MAAM,IAAI;AAAA,IAC3B;AAAA,IACA,aAAa,CAAC,SAAS;AACrB,cAAQ,WAAW;AAAA,IACrB;AAAA,EACF;AACF;AAEA,eAAe,cAAc,IAAiC;AAC5D,SAAO,MAAM,IAAI,QAAQ,CAAC,SAAS,WAAW;AAC5C,QAAI,OAAO;AACX,OAAG,MAAM,YAAY,MAAM;AAC3B,OAAG,MAAM,GAAG,QAAQ,CAAC,UAAmB,QAAQ,KAAM;AACtD,OAAG,MAAM,GAAG,OAAO,MAAM,QAAQ,IAAI,CAAC;AACtC,OAAG,MAAM,GAAG,SAAS,MAAM;AAAA,EAC7B,CAAC;AACH;AAEA,eAAe,cACb,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,SAAS,KAAU;AAEjB,UAAM,gBAAgB,OAAO,KAAK,aAAa,WAAW,IAAI,WAAW;AACzE,QAAI,kBAAkB,QAAW;AAC/B,iBAAW;AAAA,IACb,OAAO;AACL,iBAAW,WAAW,GAAG;AACzB,iBAAW;AAAA,IACb;AAAA,EACF;AAEA,QAAM,gBAAgB,qBAAqB,IAAI,mBAAmB;AAClE,YAAU,YAAY,aAAa;AACnC,SAAO;AACT;AAGA,IAAI,QAAQ,KAAK,CAAC,GAAG;AACnB,QAAM,YAAY,cAAc,QAAQ,KAAK,CAAC,CAAC,EAAE;AACjD,MAAI,YAAY,QAAQ,WAAW;AACjC,UAAM,OAAO,QAAQ,IAAI;AAAA,EAC3B;AACF;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/cli.ts"],"sourcesContent":["import { Command } from \"commander\";\nimport { readFile } from \"node:fs/promises\";\nimport { readFileSync, realpathSync } from \"node:fs\";\nimport process from \"node:process\";\nimport { fileURLToPath, pathToFileURL } from \"node:url\";\n\nimport {\n Seclai,\n SeclaiAPIStatusError,\n SeclaiAPIValidationError,\n SeclaiConfigurationError,\n} from \"@seclai/sdk\";\n\ntype GlobalOptions = {\n apiKey?: string;\n};\n\nexport type CliRuntime = {\n stdin: NodeJS.ReadableStream;\n writeOut: (text: string) => void;\n writeErr: (text: string) => void;\n setExitCode: (code: number) => void;\n};\n\nfunction defaultRuntime(): CliRuntime {\n return {\n stdin: process.stdin,\n writeOut: (text) => {\n process.stdout.write(text);\n },\n writeErr: (text) => {\n process.stderr.write(text);\n },\n setExitCode: (code) => {\n process.exitCode = code;\n },\n };\n}\n\nasync function readStdinText(rt: CliRuntime): Promise<string> {\n return await new Promise((resolve, reject) => {\n let data = \"\";\n rt.stdin.setEncoding(\"utf8\");\n rt.stdin.on(\"data\", (chunk: string) => (data += chunk));\n rt.stdin.on(\"end\", () => resolve(data));\n rt.stdin.on(\"error\", reject);\n });\n}\n\nasync function readJsonInput(\n rt: CliRuntime,\n opts: {\n json?: string;\n jsonFile?: string;\n }\n): Promise<unknown> {\n if (opts.json !== undefined && opts.jsonFile !== undefined) {\n throw new Error(\"Provide only one of --json or --json-file\");\n }\n\n if (opts.jsonFile !== undefined) {\n const text =\n opts.jsonFile === \"-\" ? await readStdinText(rt) : await readFile(opts.jsonFile, \"utf8\");\n return JSON.parse(text);\n }\n\n if (opts.json !== undefined) {\n const text = opts.json === \"-\" ? await readStdinText(rt) : opts.json;\n return JSON.parse(text);\n }\n\n throw new Error(\"Missing JSON input. Provide --json or --json-file.\");\n}\n\nfunction getCliVersion(): string {\n try {\n const packageJsonPath = new URL(\"../package.json\", import.meta.url);\n const raw = readFileSync(packageJsonPath, \"utf8\");\n const parsed = JSON.parse(raw) as { version?: unknown };\n return typeof parsed.version === \"string\" ? parsed.version : \"0.0.0\";\n } catch {\n return \"0.0.0\";\n }\n}\n\nfunction createClient(opts: GlobalOptions): Seclai {\n const seclaiOpts: { apiKey?: string; baseUrl?: string } = {};\n if (opts.apiKey !== undefined) seclaiOpts.apiKey = opts.apiKey;\n\n // Be explicit about the default API host. (The SDK also supports SECLAI_API_URL.)\n const envUrl = process.env.SECLAI_API_URL;\n seclaiOpts.baseUrl = envUrl && envUrl.length > 0 ? envUrl : \"https://api.seclai.com\";\n\n return new Seclai(seclaiOpts);\n}\n\nfunction printJson(rt: CliRuntime, value: unknown): void {\n rt.writeOut(`${JSON.stringify(value, null, 2)}\\n`);\n}\n\nfunction printError(rt: CliRuntime, err: unknown): void {\n if (err instanceof SeclaiAPIValidationError) {\n rt.writeErr(`${err.name}: ${err.message}\\n`);\n rt.writeErr(`status: ${err.statusCode}\\n`);\n rt.writeErr(`url: ${err.url}\\n`);\n if (err.responseText) rt.writeErr(`response: ${err.responseText}\\n`);\n if (err.validationError) printJson(rt, { validationError: err.validationError });\n return;\n }\n\n if (err instanceof SeclaiAPIStatusError) {\n rt.writeErr(`${err.name}: ${err.message}\\n`);\n rt.writeErr(`status: ${err.statusCode}\\n`);\n rt.writeErr(`url: ${err.url}\\n`);\n if (err.responseText) rt.writeErr(`response: ${err.responseText}\\n`);\n return;\n }\n\n if (err instanceof SeclaiConfigurationError) {\n rt.writeErr(`${err.name}: ${err.message}\\n`);\n return;\n }\n\n if (err instanceof Error) {\n rt.writeErr(`${err.name}: ${err.message}\\n`);\n return;\n }\n\n rt.writeErr(String(err));\n rt.writeErr(\"\\n\");\n}\n\nasync function run(rt: CliRuntime, main: () => Promise<void>): Promise<void> {\n try {\n await main();\n } catch (err) {\n printError(rt, err);\n rt.setExitCode(1);\n }\n}\n\nexport function createProgram(rt: CliRuntime = defaultRuntime()): Command {\n const program = new Command();\n const cliVersion = getCliVersion();\n\n program\n .name(\"seclai\")\n .description(`Seclai Command Line Interface (v${cliVersion})`)\n .version(cliVersion, \"-V, --version\", \"output the version\")\n .option(\"--api-key <key>\", \"API key (defaults to SECLAI_API_KEY)\");\n\n program.configureOutput({\n writeOut: (str) => rt.writeOut(str),\n writeErr: (str) => rt.writeErr(str),\n });\n // Prevent commander from calling process.exit() (needed for testability)\n program.exitOverride();\n\n // sources\n const sources = program\n .command(\"sources\")\n .alias(\"source\")\n .description(\"Manage sources\");\n\nsources\n .command(\"list\")\n .description(\"List sources\")\n .option(\"--page <n>\", \"Page number\", (v) => Number(v))\n .option(\"--limit <n>\", \"Page size\", (v) => Number(v))\n .option(\"--sort <field>\", \"Sort field\")\n .option(\"--order <asc|desc>\", \"Sort order\")\n .option(\"--account-id <id>\", \"Filter by account id\")\n .action(async (opts) => {\n await run(rt, async () => {\n const global = program.opts<GlobalOptions>();\n const client = createClient(global);\n const res = await client.listSources({\n page: opts.page,\n limit: opts.limit,\n sort: opts.sort,\n order: opts.order,\n accountId: opts.accountId,\n });\n printJson(rt, res);\n });\n });\n\nsources\n .command(\"upload\")\n .description(\"Upload a file to a source connection\")\n .argument(\"<sourceConnectionId>\", \"Source connection id\")\n .requiredOption(\"--file <path>\", \"Path to local file\")\n .option(\"--title <title>\", \"Optional title\")\n .option(\"--file-name <name>\", \"Filename to send (defaults to basename)\")\n .option(\"--mime-type <type>\", \"MIME type\")\n .action(async (sourceConnectionId: string, opts) => {\n await run(rt, async () => {\n const global = program.opts<GlobalOptions>();\n const client = createClient(global);\n\n const bytes = new Uint8Array(await readFile(opts.file));\n\n const uploadOpts: {\n file: Uint8Array;\n title?: string;\n fileName?: string;\n mimeType?: string;\n } = { file: bytes };\n if (opts.title !== undefined) uploadOpts.title = opts.title;\n if (opts.fileName !== undefined) uploadOpts.fileName = opts.fileName;\n if (opts.mimeType !== undefined) uploadOpts.mimeType = opts.mimeType;\n\n const res = await client.uploadFileToSource(sourceConnectionId, uploadOpts);\n printJson(rt, res);\n });\n });\n\n// agents\nconst agents = program.command(\"agents\").description(\"Run agents and manage runs\");\n\nagents\n .command(\"run\")\n .description(\"Run an agent\")\n .argument(\"<agentId>\", \"Agent id\")\n .option(\"--json <json>\", \"Request body JSON (string or '-')\")\n .option(\"--json-file <path>\", \"Request body JSON file path (or '-')\")\n .option(\"--stream\", \"Use streaming SSE endpoint and wait for completion\")\n .option(\"--timeout-ms <n>\", \"Client-side timeout in milliseconds\", (v) => Number(v))\n .action(async (agentId: string, opts) => {\n await run(rt, async () => {\n const global = program.opts<GlobalOptions>();\n const client = createClient(global);\n\n const body = await readJsonInput(rt, { json: opts.json, jsonFile: opts.jsonFile });\n\n let res: unknown;\n if (opts.stream) {\n const streamFn = (client as any).runStreamingAgentAndWait as\n | undefined\n | ((agentId: string, body: unknown, opts?: { timeoutMs?: number }) => Promise<unknown>);\n if (!streamFn) {\n throw new Error(\n \"This version of @seclai/sdk does not support streaming agent runs yet. Upgrade @seclai/sdk to a version that includes runStreamingAgentAndWait.\"\n );\n }\n res = await streamFn(agentId, body, opts.timeoutMs !== undefined ? { timeoutMs: opts.timeoutMs } : undefined);\n } else {\n res = await client.runAgent(agentId, body as any);\n }\n printJson(rt, res);\n });\n });\n\nconst agentRuns = agents.command(\"runs\").description(\"Manage agent runs\");\n\nagentRuns\n .command(\"list\")\n .description(\"List runs for an agent\")\n .argument(\"<agentId>\", \"Agent id\")\n .option(\"--page <n>\", \"Page number\", (v) => Number(v))\n .option(\"--limit <n>\", \"Page size\", (v) => Number(v))\n .action(async (agentId: string, opts) => {\n await run(rt, async () => {\n const global = program.opts<GlobalOptions>();\n const client = createClient(global);\n const res = await client.listAgentRuns(agentId, { page: opts.page, limit: opts.limit });\n printJson(rt, res);\n });\n });\n\nagentRuns\n .command(\"get\")\n .description(\"Get a specific agent run\")\n .argument(\"<agentId>\", \"Agent id\")\n .argument(\"<runId>\", \"Run id\")\n .action(async (agentId: string, runId: string) => {\n await run(rt, async () => {\n const global = program.opts<GlobalOptions>();\n const client = createClient(global);\n const res = await client.getAgentRun(agentId, runId);\n printJson(rt, res);\n });\n });\n\nagentRuns\n .command(\"delete\")\n .description(\"Cancel/delete a specific agent run\")\n .argument(\"<agentId>\", \"Agent id\")\n .argument(\"<runId>\", \"Run id\")\n .action(async (agentId: string, runId: string) => {\n await run(rt, async () => {\n const global = program.opts<GlobalOptions>();\n const client = createClient(global);\n const res = await client.deleteAgentRun(agentId, runId);\n printJson(rt, res);\n });\n });\n\n// contents\nconst contents = program.command(\"contents\").description(\"Inspect content and embeddings\");\n\ncontents\n .command(\"get\")\n .description(\"Get content detail\")\n .argument(\"<sourceConnectionContentVersion>\", \"Content version id\")\n .option(\"--start <n>\", \"Start offset\", (v) => Number(v))\n .option(\"--end <n>\", \"End offset\", (v) => Number(v))\n .action(async (sourceConnectionContentVersion: string, opts) => {\n await run(rt, async () => {\n const global = program.opts<GlobalOptions>();\n const client = createClient(global);\n const res = await client.getContentDetail(sourceConnectionContentVersion, {\n start: opts.start,\n end: opts.end,\n });\n printJson(rt, res);\n });\n });\n\ncontents\n .command(\"delete\")\n .description(\"Delete a content version\")\n .argument(\"<sourceConnectionContentVersion>\", \"Content version id\")\n .action(async (sourceConnectionContentVersion: string) => {\n await run(rt, async () => {\n const global = program.opts<GlobalOptions>();\n const client = createClient(global);\n await client.deleteContent(sourceConnectionContentVersion);\n printJson(rt, { ok: true });\n });\n });\n\ncontents\n .command(\"embeddings\")\n .description(\"List embeddings for a content version\")\n .argument(\"<sourceConnectionContentVersion>\", \"Content version id\")\n .option(\"--page <n>\", \"Page number\", (v) => Number(v))\n .option(\"--limit <n>\", \"Page size\", (v) => Number(v))\n .action(async (sourceConnectionContentVersion: string, opts) => {\n await run(rt, async () => {\n const global = program.opts<GlobalOptions>();\n const client = createClient(global);\n const res = await client.listContentEmbeddings(sourceConnectionContentVersion, {\n page: opts.page,\n limit: opts.limit,\n });\n printJson(rt, res);\n });\n });\n\n return program;\n}\n\nexport async function runCli(argv: string[], rt: CliRuntime = defaultRuntime()): Promise<number> {\n let observedExitCode = 0;\n const wrappedRt: CliRuntime = {\n ...rt,\n setExitCode: (code) => {\n observedExitCode = code;\n rt.setExitCode(code);\n },\n };\n\n const program = createProgram(wrappedRt);\n let exitCode = 0;\n\n try {\n await program.parseAsync(argv);\n } catch (err: any) {\n // commander throws a CommanderError on help/version/etc due to exitOverride()\n const maybeExitCode = typeof err?.exitCode === \"number\" ? err.exitCode : undefined;\n if (maybeExitCode !== undefined) {\n exitCode = maybeExitCode;\n } else {\n printError(wrappedRt, err);\n exitCode = 1;\n }\n }\n\n const finalExitCode = observedExitCode !== 0 ? observedExitCode : exitCode;\n wrappedRt.setExitCode(finalExitCode);\n return finalExitCode;\n}\n\n// Only run when executed as an entrypoint, not when imported (e.g. during tests).\nif (process.argv[1]) {\n // `process.argv[1]` can be a symlink (common with npm global installs).\n // Compare realpaths so the guard works reliably.\n try {\n const entryReal = realpathSync(process.argv[1]);\n const selfReal = realpathSync(fileURLToPath(import.meta.url));\n if (entryReal === selfReal) {\n await runCli(process.argv);\n }\n } catch {\n // Fall back to a URL comparison (best-effort).\n const entryHref = pathToFileURL(process.argv[1]).href;\n if (import.meta.url === entryHref) {\n await runCli(process.argv);\n }\n }\n}\n"],"mappings":";;;AAAA,SAAS,eAAe;AACxB,SAAS,gBAAgB;AACz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GAAG,CAAC;AAC5D,QAAI,cAAc,UAAU;AAC1B,YAAM,OAAO,QAAQ,IAAI;AAAA,IAC3B;AAAA,EACF,QAAQ;AAEN,UAAM,YAAY,cAAc,QAAQ,KAAK,CAAC,CAAC,EAAE;AACjD,QAAI,YAAY,QAAQ,WAAW;AACjC,YAAM,OAAO,QAAQ,IAAI;AAAA,IAC3B;AAAA,EACF;AACF;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seclai/cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "Seclai Command Line Interface",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@seclai/sdk": "^1.0.
|
|
29
|
+
"@seclai/sdk": "^1.0.3",
|
|
30
30
|
"commander": "^13.1.0"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|