@seclai/cli 1.0.3 → 1.0.5
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 +4 -3
- package/dist/cli.js +113 -15
- 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.5/
|
|
18
18
|
|
|
19
19
|
## Authentication
|
|
20
20
|
|
|
@@ -78,13 +78,14 @@ seclai agents runs list 6b9e2a1c-4d5f-4a7b-9c0d-1e2f3a4b5c6d --page 1 --limit 50
|
|
|
78
78
|
Get a run:
|
|
79
79
|
|
|
80
80
|
```bash
|
|
81
|
-
seclai
|
|
81
|
+
seclai runs get 3f1a2b4c-5d6e-4f70-8a9b-1c2d3e4f5a6b
|
|
82
|
+
seclai runs get 3f1a2b4c-5d6e-4f70-8a9b-1c2d3e4f5a6b --include-step-outputs
|
|
82
83
|
```
|
|
83
84
|
|
|
84
85
|
Cancel/delete a run:
|
|
85
86
|
|
|
86
87
|
```bash
|
|
87
|
-
seclai
|
|
88
|
+
seclai runs delete 3f1a2b4c-5d6e-4f70-8a9b-1c2d3e4f5a6b
|
|
88
89
|
```
|
|
89
90
|
|
|
90
91
|
### Contents
|
package/dist/cli.js
CHANGED
|
@@ -118,14 +118,41 @@ async function run(rt, main) {
|
|
|
118
118
|
function createProgram(rt = defaultRuntime()) {
|
|
119
119
|
const program = new Command();
|
|
120
120
|
const cliVersion = getCliVersion();
|
|
121
|
-
program.name("seclai").description(
|
|
121
|
+
program.name("seclai").description(
|
|
122
|
+
`Seclai Command Line Interface (v${cliVersion})
|
|
123
|
+
|
|
124
|
+
Use this CLI to interact with Seclai from scripts and CI: manage connected content sources, run agents, and inspect agent runs and indexed content.
|
|
125
|
+
|
|
126
|
+
All commands return JSON to stdout by default, which makes it easy to pipe into tools like jq.`
|
|
127
|
+
).version(cliVersion, "-V, --version", "output the version").option(
|
|
128
|
+
"--api-key <key>",
|
|
129
|
+
"Seclai API key (defaults to SECLAI_API_KEY). You can create/manage keys in the Seclai dashboard (Settings \u2192 API Keys)."
|
|
130
|
+
);
|
|
131
|
+
program.addHelpText(
|
|
132
|
+
"after",
|
|
133
|
+
`
|
|
134
|
+
Environment:
|
|
135
|
+
SECLAI_API_KEY Default API key (alternative to --api-key)
|
|
136
|
+
SECLAI_API_URL Override API base URL (default: https://api.seclai.com). Intended for dev/staging.
|
|
137
|
+
|
|
138
|
+
Examples:
|
|
139
|
+
seclai sources list
|
|
140
|
+
seclai sources upload <sourceConnectionId> --file ./document.pdf
|
|
141
|
+
seclai agents run <agentId> --json '{"input":"Hello"}'
|
|
142
|
+
seclai agents run <agentId> --json-file - --stream --timeout-ms 60000 < run.json
|
|
143
|
+
`
|
|
144
|
+
);
|
|
122
145
|
program.configureOutput({
|
|
123
146
|
writeOut: (str) => rt.writeOut(str),
|
|
124
147
|
writeErr: (str) => rt.writeErr(str)
|
|
125
148
|
});
|
|
126
149
|
program.exitOverride();
|
|
127
|
-
const sources = program.command("sources").alias("source").description(
|
|
128
|
-
|
|
150
|
+
const sources = program.command("sources").alias("source").description(
|
|
151
|
+
"Manage content sources connected to Seclai.\n\nSources are how Seclai ingests content (e.g., websites, RSS feeds, document uploads) into a knowledge base so agents can retrieve and cite it."
|
|
152
|
+
);
|
|
153
|
+
sources.command("list").description(
|
|
154
|
+
"List sources available to your organization/account.\n\nUse this to discover source connections and their IDs before uploading documents or debugging indexing."
|
|
155
|
+
).option("--page <n>", "Page number for pagination (1-based).", (v) => Number(v)).option("--limit <n>", "Page size (number of items to return).", (v) => Number(v)).option("--sort <field>", "Sort field (API-defined; commonly created_at or updated_at).").option("--order <asc|desc>", "Sort direction: asc or desc.").option("--account-id <id>", "Filter results to a specific account/organization id.").action(async (opts) => {
|
|
129
156
|
await run(rt, async () => {
|
|
130
157
|
const global = program.opts();
|
|
131
158
|
const client = createClient(global);
|
|
@@ -139,7 +166,15 @@ function createProgram(rt = defaultRuntime()) {
|
|
|
139
166
|
printJson(rt, res);
|
|
140
167
|
});
|
|
141
168
|
});
|
|
142
|
-
sources.command("upload").description(
|
|
169
|
+
sources.command("upload").description(
|
|
170
|
+
"Upload a local file to an existing source connection.\n\nThis is commonly used for document-upload sources inside a knowledge base. The uploaded file becomes indexed content that agents can retrieve from.\n\nNote: file size limits and supported MIME types are defined by the Seclai API (see the API reference for the upload endpoint)."
|
|
171
|
+
).argument(
|
|
172
|
+
"<sourceConnectionId>",
|
|
173
|
+
"Source connection ID to upload into. You can find this in the Seclai dashboard or by listing sources."
|
|
174
|
+
).requiredOption("--file <path>", "Path to a local file to upload.").option("--title <title>", "Optional human-readable title to associate with the uploaded content.").option(
|
|
175
|
+
"--file-name <name>",
|
|
176
|
+
"Override the filename sent to the API (defaults to the basename of --file). Useful when uploading from temp paths."
|
|
177
|
+
).option("--mime-type <type>", "Explicit MIME type (e.g., application/pdf, text/plain).").action(async (sourceConnectionId, opts) => {
|
|
143
178
|
await run(rt, async () => {
|
|
144
179
|
const global = program.opts();
|
|
145
180
|
const client = createClient(global);
|
|
@@ -152,8 +187,19 @@ function createProgram(rt = defaultRuntime()) {
|
|
|
152
187
|
printJson(rt, res);
|
|
153
188
|
});
|
|
154
189
|
});
|
|
155
|
-
const agents = program.command("agents").description(
|
|
156
|
-
|
|
190
|
+
const agents = program.command("agents").description(
|
|
191
|
+
"Run agents and manage agent runs.\n\nAgents are workflows/assistants backed by your configured knowledge base and model settings. Running an agent creates a run, which you can inspect later for status, outputs, and (optionally) step-level details."
|
|
192
|
+
);
|
|
193
|
+
agents.command("run").description(
|
|
194
|
+
"Run an agent by ID and print the run result as JSON.\n\nThe request body is passed through to the Seclai API as-is (see the API docs for the specific agent/run schema).\n\nFor automation, prefer --json-file and pipe input via stdin (use '-' as the path)."
|
|
195
|
+
).argument("<agentId>", "Agent ID to run (from the Seclai dashboard).").option("--json <json>", "Inline JSON request body. Use '-' to read JSON from stdin.").option("--json-file <path>", "Path to a JSON file containing the request body. Use '-' to read from stdin.").option(
|
|
196
|
+
"--stream",
|
|
197
|
+
"Wait for completion using the streaming (SSE) endpoint. The CLI prints the final result when the run is done."
|
|
198
|
+
).option(
|
|
199
|
+
"--timeout-ms <n>",
|
|
200
|
+
"Client-side timeout (milliseconds) when using --stream. This controls how long the CLI waits; it does not change server-side execution limits.",
|
|
201
|
+
(v) => Number(v)
|
|
202
|
+
).action(async (agentId, opts) => {
|
|
157
203
|
await run(rt, async () => {
|
|
158
204
|
const global = program.opts();
|
|
159
205
|
const client = createClient(global);
|
|
@@ -174,7 +220,9 @@ function createProgram(rt = defaultRuntime()) {
|
|
|
174
220
|
});
|
|
175
221
|
});
|
|
176
222
|
const agentRuns = agents.command("runs").description("Manage agent runs");
|
|
177
|
-
agentRuns.command("list").description(
|
|
223
|
+
agentRuns.command("list").description(
|
|
224
|
+
"List runs for a specific agent.\n\nThis is useful for monitoring recent executions, checking statuses, and obtaining run IDs for follow-up commands."
|
|
225
|
+
).argument("<agentId>", "Agent ID whose runs you want to list.").option("--page <n>", "Page number for pagination (1-based).", (v) => Number(v)).option("--limit <n>", "Page size (number of runs to return).", (v) => Number(v)).action(async (agentId, opts) => {
|
|
178
226
|
await run(rt, async () => {
|
|
179
227
|
const global = program.opts();
|
|
180
228
|
const client = createClient(global);
|
|
@@ -182,24 +230,70 @@ function createProgram(rt = defaultRuntime()) {
|
|
|
182
230
|
printJson(rt, res);
|
|
183
231
|
});
|
|
184
232
|
});
|
|
185
|
-
agentRuns.command("get").description(
|
|
233
|
+
agentRuns.command("get").description(
|
|
234
|
+
"Fetch a specific agent run and print it as JSON.\n\nUse this to inspect status, timestamps, and outputs. Optionally include step outputs for deeper debugging (may be large)."
|
|
235
|
+
).argument(
|
|
236
|
+
"<agentId>",
|
|
237
|
+
"Agent ID (accepted for backward compatibility; the API identifies runs globally by runId)."
|
|
238
|
+
).argument("<runId>", "Run ID to retrieve.").option(
|
|
239
|
+
"--include-step-outputs",
|
|
240
|
+
"Include step-level outputs when available. This may increase response size and latency."
|
|
241
|
+
).action(async (agentId, runId, opts) => {
|
|
242
|
+
await run(rt, async () => {
|
|
243
|
+
const global = program.opts();
|
|
244
|
+
const client = createClient(global);
|
|
245
|
+
const res = await client.getAgentRun(runId, opts.includeStepOutputs ? { includeStepOutputs: true } : void 0);
|
|
246
|
+
printJson(rt, res);
|
|
247
|
+
});
|
|
248
|
+
});
|
|
249
|
+
agentRuns.command("delete").description(
|
|
250
|
+
"Cancel or delete a specific agent run by ID.\n\nIf a run is still in progress, this requests cancellation. If it has already completed, behavior depends on the API (it may delete or mark the run)."
|
|
251
|
+
).argument(
|
|
252
|
+
"<agentId>",
|
|
253
|
+
"Agent ID (accepted for backward compatibility; the API identifies runs globally by runId)."
|
|
254
|
+
).argument("<runId>", "Run ID to cancel/delete.").action(async (agentId, runId) => {
|
|
255
|
+
await run(rt, async () => {
|
|
256
|
+
const global = program.opts();
|
|
257
|
+
const client = createClient(global);
|
|
258
|
+
const res = await client.deleteAgentRun(runId);
|
|
259
|
+
printJson(rt, res);
|
|
260
|
+
});
|
|
261
|
+
});
|
|
262
|
+
const runs = program.command("runs").alias("agent-runs").description(
|
|
263
|
+
"Manage agent runs by run ID (globally unique).\n\nUse this when you already have a runId (for example from `agents runs list`) and don't want to supply an agentId."
|
|
264
|
+
);
|
|
265
|
+
runs.command("get").description(
|
|
266
|
+
"Fetch a specific agent run by run ID and print it as JSON.\n\nUse --include-step-outputs to include step-level details when available (may be large)."
|
|
267
|
+
).argument("<runId>", "Run ID to retrieve.").option(
|
|
268
|
+
"--include-step-outputs",
|
|
269
|
+
"Include step-level outputs when available. This may increase response size and latency."
|
|
270
|
+
).action(async (runId, opts) => {
|
|
186
271
|
await run(rt, async () => {
|
|
187
272
|
const global = program.opts();
|
|
188
273
|
const client = createClient(global);
|
|
189
|
-
const res = await client.getAgentRun(
|
|
274
|
+
const res = await client.getAgentRun(runId, opts.includeStepOutputs ? { includeStepOutputs: true } : void 0);
|
|
190
275
|
printJson(rt, res);
|
|
191
276
|
});
|
|
192
277
|
});
|
|
193
|
-
|
|
278
|
+
runs.command("delete").description(
|
|
279
|
+
"Cancel or delete a specific agent run by run ID.\n\nIf the run is in progress, this requests cancellation. If it is completed, behavior depends on the API (it may delete or mark the run)."
|
|
280
|
+
).argument("<runId>", "Run ID to cancel/delete.").action(async (runId) => {
|
|
194
281
|
await run(rt, async () => {
|
|
195
282
|
const global = program.opts();
|
|
196
283
|
const client = createClient(global);
|
|
197
|
-
const res = await client.deleteAgentRun(
|
|
284
|
+
const res = await client.deleteAgentRun(runId);
|
|
198
285
|
printJson(rt, res);
|
|
199
286
|
});
|
|
200
287
|
});
|
|
201
|
-
const contents = program.command("contents").description(
|
|
202
|
-
|
|
288
|
+
const contents = program.command("contents").description(
|
|
289
|
+
"Inspect indexed content and embeddings.\n\nWhen Seclai ingests data from sources into a knowledge base, it creates content versions and generates vector embeddings for retrieval. These commands help you debug what was indexed and what embeddings were produced."
|
|
290
|
+
);
|
|
291
|
+
contents.command("get").description(
|
|
292
|
+
"Get details for a specific content version.\n\nThis typically includes extracted text/metadata produced during indexing. Use --start/--end to fetch a slice of the text for faster inspection."
|
|
293
|
+
).argument(
|
|
294
|
+
"<sourceConnectionContentVersion>",
|
|
295
|
+
"Content version ID to retrieve (from Seclai dashboard or API responses)."
|
|
296
|
+
).option("--start <n>", "Start offset for returned text (0-based).", (v) => Number(v)).option("--end <n>", "End offset for returned text (exclusive).", (v) => Number(v)).action(async (sourceConnectionContentVersion, opts) => {
|
|
203
297
|
await run(rt, async () => {
|
|
204
298
|
const global = program.opts();
|
|
205
299
|
const client = createClient(global);
|
|
@@ -210,7 +304,9 @@ function createProgram(rt = defaultRuntime()) {
|
|
|
210
304
|
printJson(rt, res);
|
|
211
305
|
});
|
|
212
306
|
});
|
|
213
|
-
contents.command("delete").description(
|
|
307
|
+
contents.command("delete").description(
|
|
308
|
+
"Delete a specific content version from Seclai.\n\nUse with care: removing a content version can affect retrieval results for agents that rely on the associated knowledge base."
|
|
309
|
+
).argument("<sourceConnectionContentVersion>", "Content version ID to delete.").action(async (sourceConnectionContentVersion) => {
|
|
214
310
|
await run(rt, async () => {
|
|
215
311
|
const global = program.opts();
|
|
216
312
|
const client = createClient(global);
|
|
@@ -218,7 +314,9 @@ function createProgram(rt = defaultRuntime()) {
|
|
|
218
314
|
printJson(rt, { ok: true });
|
|
219
315
|
});
|
|
220
316
|
});
|
|
221
|
-
contents.command("embeddings").description(
|
|
317
|
+
contents.command("embeddings").description(
|
|
318
|
+
"List embeddings generated for a content version.\n\nEmbeddings power similarity search and retrieval for knowledge base agents. Listing them is useful for debugging indexing and verifying that content produced vectors."
|
|
319
|
+
).argument("<sourceConnectionContentVersion>", "Content version ID whose embeddings you want to list.").option("--page <n>", "Page number for pagination (1-based).", (v) => Number(v)).option("--limit <n>", "Page size (number of embeddings to return).", (v) => Number(v)).action(async (sourceConnectionContentVersion, opts) => {
|
|
222
320
|
await run(rt, async () => {
|
|
223
321
|
const global = program.opts();
|
|
224
322
|
const client = createClient(global);
|
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, 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;AACzB,SAAS,cAAc,oBAAoB;AAC3C,OAAO,aAAa;AACpB,SAAS,eAAe,qBAAqB;AAE7C;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,IACA,MAIkB;AAClB,MAAI,KAAK,SAAS,UAAa,KAAK,aAAa,QAAW;AAC1D,UAAM,IAAI,MAAM,2CAA2C;AAAA,EAC7D;AAEA,MAAI,KAAK,aAAa,QAAW;AAC/B,UAAM,OACJ,KA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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;AAGnB,MAAI;AACF,UAAM,YAAY,aAAa,QAAQ,KAAK,CAAC,CAAC;AAC9C,UAAM,WAAW,aAAa,cAAc,YAAY,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":[]}
|
|
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(\n `Seclai Command Line Interface (v${cliVersion})\\n\\n` +\n `Use this CLI to interact with Seclai from scripts and CI: manage connected content sources, run agents, and inspect agent runs and indexed content.\\n\\n` +\n `All commands return JSON to stdout by default, which makes it easy to pipe into tools like jq.`\n )\n .version(cliVersion, \"-V, --version\", \"output the version\")\n .option(\n \"--api-key <key>\",\n \"Seclai API key (defaults to SECLAI_API_KEY). You can create/manage keys in the Seclai dashboard (Settings → API Keys).\"\n );\n\n program.addHelpText(\n \"after\",\n `\\nEnvironment:\\n` +\n ` SECLAI_API_KEY Default API key (alternative to --api-key)\\n` +\n ` SECLAI_API_URL Override API base URL (default: https://api.seclai.com). Intended for dev/staging.\\n\\n` +\n `Examples:\\n` +\n ` seclai sources list\\n` +\n ` seclai sources upload <sourceConnectionId> --file ./document.pdf\\n` +\n ` seclai agents run <agentId> --json '{\"input\":\"Hello\"}'\\n` +\n ` seclai agents run <agentId> --json-file - --stream --timeout-ms 60000 < run.json\\n`\n );\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(\n \"Manage content sources connected to Seclai.\\n\\n\" +\n \"Sources are how Seclai ingests content (e.g., websites, RSS feeds, document uploads) into a knowledge base so agents can retrieve and cite it.\"\n );\n\nsources\n .command(\"list\")\n .description(\n \"List sources available to your organization/account.\\n\\n\" +\n \"Use this to discover source connections and their IDs before uploading documents or debugging indexing.\"\n )\n .option(\"--page <n>\", \"Page number for pagination (1-based).\", (v) => Number(v))\n .option(\"--limit <n>\", \"Page size (number of items to return).\", (v) => Number(v))\n .option(\"--sort <field>\", \"Sort field (API-defined; commonly created_at or updated_at).\")\n .option(\"--order <asc|desc>\", \"Sort direction: asc or desc.\")\n .option(\"--account-id <id>\", \"Filter results to a specific account/organization 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(\n \"Upload a local file to an existing source connection.\\n\\n\" +\n \"This is commonly used for document-upload sources inside a knowledge base. The uploaded file becomes indexed content that agents can retrieve from.\\n\\n\" +\n \"Note: file size limits and supported MIME types are defined by the Seclai API (see the API reference for the upload endpoint).\"\n )\n .argument(\n \"<sourceConnectionId>\",\n \"Source connection ID to upload into. You can find this in the Seclai dashboard or by listing sources.\"\n )\n .requiredOption(\"--file <path>\", \"Path to a local file to upload.\")\n .option(\"--title <title>\", \"Optional human-readable title to associate with the uploaded content.\")\n .option(\n \"--file-name <name>\",\n \"Override the filename sent to the API (defaults to the basename of --file). Useful when uploading from temp paths.\"\n )\n .option(\"--mime-type <type>\", \"Explicit MIME type (e.g., application/pdf, text/plain).\")\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\n .command(\"agents\")\n .description(\n \"Run agents and manage agent runs.\\n\\n\" +\n \"Agents are workflows/assistants backed by your configured knowledge base and model settings. Running an agent creates a run, which you can inspect later for status, outputs, and (optionally) step-level details.\"\n );\n\nagents\n .command(\"run\")\n .description(\n \"Run an agent by ID and print the run result as JSON.\\n\\n\" +\n \"The request body is passed through to the Seclai API as-is (see the API docs for the specific agent/run schema).\\n\\n\" +\n \"For automation, prefer --json-file and pipe input via stdin (use '-' as the path).\"\n )\n .argument(\"<agentId>\", \"Agent ID to run (from the Seclai dashboard).\")\n .option(\"--json <json>\", \"Inline JSON request body. Use '-' to read JSON from stdin.\")\n .option(\"--json-file <path>\", \"Path to a JSON file containing the request body. Use '-' to read from stdin.\")\n .option(\n \"--stream\",\n \"Wait for completion using the streaming (SSE) endpoint. The CLI prints the final result when the run is done.\"\n )\n .option(\n \"--timeout-ms <n>\",\n \"Client-side timeout (milliseconds) when using --stream. This controls how long the CLI waits; it does not change server-side execution limits.\",\n (v) => Number(v)\n )\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(\n \"List runs for a specific agent.\\n\\n\" +\n \"This is useful for monitoring recent executions, checking statuses, and obtaining run IDs for follow-up commands.\"\n )\n .argument(\"<agentId>\", \"Agent ID whose runs you want to list.\")\n .option(\"--page <n>\", \"Page number for pagination (1-based).\", (v) => Number(v))\n .option(\"--limit <n>\", \"Page size (number of runs to return).\", (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(\n \"Fetch a specific agent run and print it as JSON.\\n\\n\" +\n \"Use this to inspect status, timestamps, and outputs. Optionally include step outputs for deeper debugging (may be large).\"\n )\n .argument(\n \"<agentId>\",\n \"Agent ID (accepted for backward compatibility; the API identifies runs globally by runId).\"\n )\n .argument(\"<runId>\", \"Run ID to retrieve.\")\n .option(\n \"--include-step-outputs\",\n \"Include step-level outputs when available. This may increase response size and latency.\"\n )\n .action(async (agentId: string, runId: string, opts) => {\n await run(rt, async () => {\n const global = program.opts<GlobalOptions>();\n const client = createClient(global);\n // Backward-compatible CLI: agentId is accepted but no longer required by the API.\n const res = await client.getAgentRun(runId, opts.includeStepOutputs ? { includeStepOutputs: true } : undefined);\n printJson(rt, res);\n });\n });\n\nagentRuns\n .command(\"delete\")\n .description(\n \"Cancel or delete a specific agent run by ID.\\n\\n\" +\n \"If a run is still in progress, this requests cancellation. If it has already completed, behavior depends on the API (it may delete or mark the run).\"\n )\n .argument(\n \"<agentId>\",\n \"Agent ID (accepted for backward compatibility; the API identifies runs globally by runId).\"\n )\n .argument(\"<runId>\", \"Run ID to cancel/delete.\")\n .action(async (agentId: string, runId: string) => {\n await run(rt, async () => {\n const global = program.opts<GlobalOptions>();\n const client = createClient(global);\n // Backward-compatible CLI: agentId is accepted but no longer required by the API.\n const res = await client.deleteAgentRun(runId);\n printJson(rt, res);\n });\n });\n\n// runs (run id is globally unique)\nconst runs = program\n .command(\"runs\")\n .alias(\"agent-runs\")\n .description(\n \"Manage agent runs by run ID (globally unique).\\n\\n\" +\n \"Use this when you already have a runId (for example from `agents runs list`) and don't want to supply an agentId.\"\n );\n\nruns\n .command(\"get\")\n .description(\n \"Fetch a specific agent run by run ID and print it as JSON.\\n\\n\" +\n \"Use --include-step-outputs to include step-level details when available (may be large).\"\n )\n .argument(\"<runId>\", \"Run ID to retrieve.\")\n .option(\n \"--include-step-outputs\",\n \"Include step-level outputs when available. This may increase response size and latency.\"\n )\n .action(async (runId: string, opts) => {\n await run(rt, async () => {\n const global = program.opts<GlobalOptions>();\n const client = createClient(global);\n const res = await client.getAgentRun(runId, opts.includeStepOutputs ? { includeStepOutputs: true } : undefined);\n printJson(rt, res);\n });\n });\n\nruns\n .command(\"delete\")\n .description(\n \"Cancel or delete a specific agent run by run ID.\\n\\n\" +\n \"If the run is in progress, this requests cancellation. If it is completed, behavior depends on the API (it may delete or mark the run).\"\n )\n .argument(\"<runId>\", \"Run ID to cancel/delete.\")\n .action(async (runId: string) => {\n await run(rt, async () => {\n const global = program.opts<GlobalOptions>();\n const client = createClient(global);\n const res = await client.deleteAgentRun(runId);\n printJson(rt, res);\n });\n });\n\n// contents\nconst contents = program\n .command(\"contents\")\n .description(\n \"Inspect indexed content and embeddings.\\n\\n\" +\n \"When Seclai ingests data from sources into a knowledge base, it creates content versions and generates vector embeddings for retrieval. These commands help you debug what was indexed and what embeddings were produced.\"\n );\n\ncontents\n .command(\"get\")\n .description(\n \"Get details for a specific content version.\\n\\n\" +\n \"This typically includes extracted text/metadata produced during indexing. Use --start/--end to fetch a slice of the text for faster inspection.\"\n )\n .argument(\n \"<sourceConnectionContentVersion>\",\n \"Content version ID to retrieve (from Seclai dashboard or API responses).\"\n )\n .option(\"--start <n>\", \"Start offset for returned text (0-based).\", (v) => Number(v))\n .option(\"--end <n>\", \"End offset for returned text (exclusive).\", (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(\n \"Delete a specific content version from Seclai.\\n\\n\" +\n \"Use with care: removing a content version can affect retrieval results for agents that rely on the associated knowledge base.\"\n )\n .argument(\"<sourceConnectionContentVersion>\", \"Content version ID to delete.\")\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(\n \"List embeddings generated for a content version.\\n\\n\" +\n \"Embeddings power similarity search and retrieval for knowledge base agents. Listing them is useful for debugging indexing and verifying that content produced vectors.\"\n )\n .argument(\"<sourceConnectionContentVersion>\", \"Content version ID whose embeddings you want to list.\")\n .option(\"--page <n>\", \"Page number for pagination (1-based).\", (v) => Number(v))\n .option(\"--limit <n>\", \"Page size (number of embeddings to return).\", (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;AACzB,SAAS,cAAc,oBAAoB;AAC3C,OAAO,aAAa;AACpB,SAAS,eAAe,qBAAqB;AAE7C;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,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AAC;AAAA,EACH,CAAC;AAED,SAAO;AACT;AAEA,eAAsB,OAAO,MAAgB,KAAiB,eAAe,GAAoB;AAC/F,MAAI,mBAAmB;AACvB,QAAM,YAAwB;AAAA,IAC5B,GAAG;AAAA,IACH,aAAa,CAAC,SAAS;AACrB,yBAAmB;AACnB,SAAG,YAAY,IAAI;AAAA,IACrB;AAAA,EACF;AAEA,QAAM,UAAU,cAAc,SAAS;AACvC,MAAI,WAAW;AAEf,MAAI;AACF,UAAM,QAAQ,WAAW,IAAI;AAAA,EAC/B,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;AAGnB,MAAI;AACF,UAAM,YAAY,aAAa,QAAQ,KAAK,CAAC,CAAC;AAC9C,UAAM,WAAW,aAAa,cAAc,YAAY,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.5",
|
|
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.6",
|
|
30
30
|
"commander": "^13.1.0"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|