@seclai/cli 0.0.0
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 +21 -0
- package/README.md +147 -0
- package/dist/cli.js +257 -0
- package/dist/cli.js.map +1 -0
- package/package.json +39 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Seclai, Inc.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
# Seclai CLI
|
|
2
|
+
|
|
3
|
+
Seclai Command Line Interface
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
Global install (recommended):
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm i -g @seclai/cli
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Documentation
|
|
14
|
+
|
|
15
|
+
Command reference (latest):
|
|
16
|
+
|
|
17
|
+
https://seclai.github.io/seclai-cli/latest/
|
|
18
|
+
|
|
19
|
+
## Authentication
|
|
20
|
+
|
|
21
|
+
The CLI uses API key authentication.
|
|
22
|
+
|
|
23
|
+
Set `SECLAI_API_KEY` (or pass `--api-key`).
|
|
24
|
+
|
|
25
|
+
You can also pass options per command:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
seclai --api-key "$SECLAI_API_KEY" sources list
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Commands
|
|
32
|
+
|
|
33
|
+
### Sources
|
|
34
|
+
|
|
35
|
+
List sources:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
seclai sources list
|
|
39
|
+
seclai sources list --page 1 --limit 20 --sort created_at --order desc
|
|
40
|
+
seclai sources list --account-id 9f3c2a7d-2d4a-4c8e-9d1d-3f7a2f1c0b5e
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Upload a file to a source connection:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
seclai sources upload 2b1f0f3a-1d2c-4b5a-8e9f-0a1b2c3d4e5f --file ./mydoc.pdf
|
|
47
|
+
seclai sources upload 2b1f0f3a-1d2c-4b5a-8e9f-0a1b2c3d4e5f --file ./notes.txt --title "Notes" --mime-type text/plain
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### Agents
|
|
51
|
+
|
|
52
|
+
Run an agent (body is JSON):
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
seclai agents run 6b9e2a1c-4d5f-4a7b-9c0d-1e2f3a4b5c6d --json '{"query":"hello"}'
|
|
56
|
+
seclai agents run 6b9e2a1c-4d5f-4a7b-9c0d-1e2f3a4b5c6d --json-file ./run.json
|
|
57
|
+
cat ./run.json | seclai agents run 6b9e2a1c-4d5f-4a7b-9c0d-1e2f3a4b5c6d --json-file -
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
List runs:
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
seclai agents runs list 6b9e2a1c-4d5f-4a7b-9c0d-1e2f3a4b5c6d
|
|
64
|
+
seclai agents runs list 6b9e2a1c-4d5f-4a7b-9c0d-1e2f3a4b5c6d --page 1 --limit 50
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Get a run:
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
seclai agents runs get 6b9e2a1c-4d5f-4a7b-9c0d-1e2f3a4b5c6d 3f1a2b4c-5d6e-4f70-8a9b-1c2d3e4f5a6b
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Cancel/delete a run:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
seclai agents runs delete 6b9e2a1c-4d5f-4a7b-9c0d-1e2f3a4b5c6d 3f1a2b4c-5d6e-4f70-8a9b-1c2d3e4f5a6b
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### Contents
|
|
80
|
+
|
|
81
|
+
Get content detail:
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
seclai contents get a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d
|
|
85
|
+
seclai contents get a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d --start 0 --end 5000
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Delete a content version:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
seclai contents delete a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
List embeddings:
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
seclai contents embeddings a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d
|
|
98
|
+
seclai contents embeddings a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d --page 1 --limit 20
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## Development
|
|
102
|
+
|
|
103
|
+
### Base URL
|
|
104
|
+
|
|
105
|
+
Overriding the base URL is intended for development/staging.
|
|
106
|
+
|
|
107
|
+
Set `SECLAI_API_URL` to point at a different API host:
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
export SECLAI_API_URL="https://example.invalid"
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Or pass it per-invocation:
|
|
114
|
+
|
|
115
|
+
This is intentionally environment-variable-only (there is no CLI flag for it).
|
|
116
|
+
|
|
117
|
+
### Install dependencies
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
npm install
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### Type checking
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
npm run typecheck
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### Build
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
npm run build
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### Run locally
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
npm run dev -- --help
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### Test global install locally
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
npm run build
|
|
145
|
+
npm link
|
|
146
|
+
seclai --help
|
|
147
|
+
```
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// src/cli.ts
|
|
4
|
+
import { Command } from "commander";
|
|
5
|
+
import { readFile } from "fs/promises";
|
|
6
|
+
import { readFileSync } from "fs";
|
|
7
|
+
import process from "process";
|
|
8
|
+
import { pathToFileURL } from "url";
|
|
9
|
+
import {
|
|
10
|
+
Seclai,
|
|
11
|
+
SeclaiAPIStatusError,
|
|
12
|
+
SeclaiAPIValidationError,
|
|
13
|
+
SeclaiConfigurationError
|
|
14
|
+
} from "@seclai/sdk";
|
|
15
|
+
function defaultRuntime() {
|
|
16
|
+
return {
|
|
17
|
+
stdin: process.stdin,
|
|
18
|
+
writeOut: (text) => {
|
|
19
|
+
process.stdout.write(text);
|
|
20
|
+
},
|
|
21
|
+
writeErr: (text) => {
|
|
22
|
+
process.stderr.write(text);
|
|
23
|
+
},
|
|
24
|
+
setExitCode: (code) => {
|
|
25
|
+
process.exitCode = code;
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
async function readStdinText(rt) {
|
|
30
|
+
return await new Promise((resolve, reject) => {
|
|
31
|
+
let data = "";
|
|
32
|
+
rt.stdin.setEncoding("utf8");
|
|
33
|
+
rt.stdin.on("data", (chunk) => data += chunk);
|
|
34
|
+
rt.stdin.on("end", () => resolve(data));
|
|
35
|
+
rt.stdin.on("error", reject);
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
async function readJsonInput(rt, opts) {
|
|
39
|
+
if (opts.json !== void 0 && opts.jsonFile !== void 0) {
|
|
40
|
+
throw new Error("Provide only one of --json or --json-file");
|
|
41
|
+
}
|
|
42
|
+
if (opts.jsonFile !== void 0) {
|
|
43
|
+
const text = opts.jsonFile === "-" ? await readStdinText(rt) : await readFile(opts.jsonFile, "utf8");
|
|
44
|
+
return JSON.parse(text);
|
|
45
|
+
}
|
|
46
|
+
if (opts.json !== void 0) {
|
|
47
|
+
const text = opts.json === "-" ? await readStdinText(rt) : opts.json;
|
|
48
|
+
return JSON.parse(text);
|
|
49
|
+
}
|
|
50
|
+
throw new Error("Missing JSON input. Provide --json or --json-file.");
|
|
51
|
+
}
|
|
52
|
+
function getCliVersion() {
|
|
53
|
+
try {
|
|
54
|
+
const packageJsonPath = new URL("../package.json", import.meta.url);
|
|
55
|
+
const raw = readFileSync(packageJsonPath, "utf8");
|
|
56
|
+
const parsed = JSON.parse(raw);
|
|
57
|
+
return typeof parsed.version === "string" ? parsed.version : "0.0.0";
|
|
58
|
+
} catch {
|
|
59
|
+
return "0.0.0";
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
function createClient(opts) {
|
|
63
|
+
const seclaiOpts = {};
|
|
64
|
+
if (opts.apiKey !== void 0) seclaiOpts.apiKey = opts.apiKey;
|
|
65
|
+
return new Seclai(seclaiOpts);
|
|
66
|
+
}
|
|
67
|
+
function printJson(rt, value) {
|
|
68
|
+
rt.writeOut(`${JSON.stringify(value, null, 2)}
|
|
69
|
+
`);
|
|
70
|
+
}
|
|
71
|
+
function printError(rt, err) {
|
|
72
|
+
if (err instanceof SeclaiAPIValidationError) {
|
|
73
|
+
rt.writeErr(`${err.name}: ${err.message}
|
|
74
|
+
`);
|
|
75
|
+
rt.writeErr(`status: ${err.statusCode}
|
|
76
|
+
`);
|
|
77
|
+
rt.writeErr(`url: ${err.url}
|
|
78
|
+
`);
|
|
79
|
+
if (err.responseText) rt.writeErr(`response: ${err.responseText}
|
|
80
|
+
`);
|
|
81
|
+
if (err.validationError) printJson(rt, { validationError: err.validationError });
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
if (err instanceof SeclaiAPIStatusError) {
|
|
85
|
+
rt.writeErr(`${err.name}: ${err.message}
|
|
86
|
+
`);
|
|
87
|
+
rt.writeErr(`status: ${err.statusCode}
|
|
88
|
+
`);
|
|
89
|
+
rt.writeErr(`url: ${err.url}
|
|
90
|
+
`);
|
|
91
|
+
if (err.responseText) rt.writeErr(`response: ${err.responseText}
|
|
92
|
+
`);
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
if (err instanceof SeclaiConfigurationError) {
|
|
96
|
+
rt.writeErr(`${err.name}: ${err.message}
|
|
97
|
+
`);
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
if (err instanceof Error) {
|
|
101
|
+
rt.writeErr(`${err.name}: ${err.message}
|
|
102
|
+
`);
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
rt.writeErr(String(err));
|
|
106
|
+
rt.writeErr("\n");
|
|
107
|
+
}
|
|
108
|
+
async function run(rt, main) {
|
|
109
|
+
try {
|
|
110
|
+
await main();
|
|
111
|
+
} catch (err) {
|
|
112
|
+
printError(rt, err);
|
|
113
|
+
rt.setExitCode(1);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
function createProgram(rt = defaultRuntime()) {
|
|
117
|
+
const program = new Command();
|
|
118
|
+
const cliVersion = getCliVersion();
|
|
119
|
+
program.name("seclai").description(`Seclai Command Line Interface (v${cliVersion})`).version(cliVersion, "-V, --version", "output the version").option("--api-key <key>", "API key (defaults to SECLAI_API_KEY)");
|
|
120
|
+
program.configureOutput({
|
|
121
|
+
writeOut: (str) => rt.writeOut(str),
|
|
122
|
+
writeErr: (str) => rt.writeErr(str)
|
|
123
|
+
});
|
|
124
|
+
program.exitOverride();
|
|
125
|
+
const sources = program.command("sources").description("Manage sources");
|
|
126
|
+
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
|
+
await run(rt, async () => {
|
|
128
|
+
const global = program.opts();
|
|
129
|
+
const client = createClient(global);
|
|
130
|
+
const res = await client.listSources({
|
|
131
|
+
page: opts.page,
|
|
132
|
+
limit: opts.limit,
|
|
133
|
+
sort: opts.sort,
|
|
134
|
+
order: opts.order,
|
|
135
|
+
accountId: opts.accountId
|
|
136
|
+
});
|
|
137
|
+
printJson(rt, res);
|
|
138
|
+
});
|
|
139
|
+
});
|
|
140
|
+
sources.command("upload").description("Upload a file to a source connection").argument("<sourceConnectionId>", "Source connection id").requiredOption("--file <path>", "Path to local file").option("--title <title>", "Optional title").option("--file-name <name>", "Filename to send (defaults to basename)").option("--mime-type <type>", "MIME type").action(async (sourceConnectionId, opts) => {
|
|
141
|
+
await run(rt, async () => {
|
|
142
|
+
const global = program.opts();
|
|
143
|
+
const client = createClient(global);
|
|
144
|
+
const bytes = new Uint8Array(await readFile(opts.file));
|
|
145
|
+
const uploadOpts = { file: bytes };
|
|
146
|
+
if (opts.title !== void 0) uploadOpts.title = opts.title;
|
|
147
|
+
if (opts.fileName !== void 0) uploadOpts.fileName = opts.fileName;
|
|
148
|
+
if (opts.mimeType !== void 0) uploadOpts.mimeType = opts.mimeType;
|
|
149
|
+
const res = await client.uploadFileToSource(sourceConnectionId, uploadOpts);
|
|
150
|
+
printJson(rt, res);
|
|
151
|
+
});
|
|
152
|
+
});
|
|
153
|
+
const agents = program.command("agents").description("Run agents and manage runs");
|
|
154
|
+
agents.command("run").description("Run an agent").argument("<agentId>", "Agent id").option("--json <json>", "Request body JSON (string or '-')").option("--json-file <path>", "Request body JSON file path (or '-')").action(async (agentId, opts) => {
|
|
155
|
+
await run(rt, async () => {
|
|
156
|
+
const global = program.opts();
|
|
157
|
+
const client = createClient(global);
|
|
158
|
+
const body = await readJsonInput(rt, { json: opts.json, jsonFile: opts.jsonFile });
|
|
159
|
+
const res = await client.runAgent(agentId, body);
|
|
160
|
+
printJson(rt, res);
|
|
161
|
+
});
|
|
162
|
+
});
|
|
163
|
+
const agentRuns = agents.command("runs").description("Manage agent runs");
|
|
164
|
+
agentRuns.command("list").description("List runs for an agent").argument("<agentId>", "Agent id").option("--page <n>", "Page number", (v) => Number(v)).option("--limit <n>", "Page size", (v) => Number(v)).action(async (agentId, opts) => {
|
|
165
|
+
await run(rt, async () => {
|
|
166
|
+
const global = program.opts();
|
|
167
|
+
const client = createClient(global);
|
|
168
|
+
const res = await client.listAgentRuns(agentId, { page: opts.page, limit: opts.limit });
|
|
169
|
+
printJson(rt, res);
|
|
170
|
+
});
|
|
171
|
+
});
|
|
172
|
+
agentRuns.command("get").description("Get a specific agent run").argument("<agentId>", "Agent id").argument("<runId>", "Run id").action(async (agentId, runId) => {
|
|
173
|
+
await run(rt, async () => {
|
|
174
|
+
const global = program.opts();
|
|
175
|
+
const client = createClient(global);
|
|
176
|
+
const res = await client.getAgentRun(agentId, runId);
|
|
177
|
+
printJson(rt, res);
|
|
178
|
+
});
|
|
179
|
+
});
|
|
180
|
+
agentRuns.command("delete").description("Cancel/delete a specific agent run").argument("<agentId>", "Agent id").argument("<runId>", "Run id").action(async (agentId, runId) => {
|
|
181
|
+
await run(rt, async () => {
|
|
182
|
+
const global = program.opts();
|
|
183
|
+
const client = createClient(global);
|
|
184
|
+
const res = await client.deleteAgentRun(agentId, runId);
|
|
185
|
+
printJson(rt, res);
|
|
186
|
+
});
|
|
187
|
+
});
|
|
188
|
+
const contents = program.command("contents").description("Inspect content and embeddings");
|
|
189
|
+
contents.command("get").description("Get content detail").argument("<sourceConnectionContentVersion>", "Content version id").option("--start <n>", "Start offset", (v) => Number(v)).option("--end <n>", "End offset", (v) => Number(v)).action(async (sourceConnectionContentVersion, opts) => {
|
|
190
|
+
await run(rt, async () => {
|
|
191
|
+
const global = program.opts();
|
|
192
|
+
const client = createClient(global);
|
|
193
|
+
const res = await client.getContentDetail(sourceConnectionContentVersion, {
|
|
194
|
+
start: opts.start,
|
|
195
|
+
end: opts.end
|
|
196
|
+
});
|
|
197
|
+
printJson(rt, res);
|
|
198
|
+
});
|
|
199
|
+
});
|
|
200
|
+
contents.command("delete").description("Delete a content version").argument("<sourceConnectionContentVersion>", "Content version id").action(async (sourceConnectionContentVersion) => {
|
|
201
|
+
await run(rt, async () => {
|
|
202
|
+
const global = program.opts();
|
|
203
|
+
const client = createClient(global);
|
|
204
|
+
await client.deleteContent(sourceConnectionContentVersion);
|
|
205
|
+
printJson(rt, { ok: true });
|
|
206
|
+
});
|
|
207
|
+
});
|
|
208
|
+
contents.command("embeddings").description("List embeddings for a content version").argument("<sourceConnectionContentVersion>", "Content version id").option("--page <n>", "Page number", (v) => Number(v)).option("--limit <n>", "Page size", (v) => Number(v)).action(async (sourceConnectionContentVersion, opts) => {
|
|
209
|
+
await run(rt, async () => {
|
|
210
|
+
const global = program.opts();
|
|
211
|
+
const client = createClient(global);
|
|
212
|
+
const res = await client.listContentEmbeddings(sourceConnectionContentVersion, {
|
|
213
|
+
page: opts.page,
|
|
214
|
+
limit: opts.limit
|
|
215
|
+
});
|
|
216
|
+
printJson(rt, res);
|
|
217
|
+
});
|
|
218
|
+
});
|
|
219
|
+
return program;
|
|
220
|
+
}
|
|
221
|
+
async function runCli(argv, rt = defaultRuntime()) {
|
|
222
|
+
let observedExitCode = 0;
|
|
223
|
+
const wrappedRt = {
|
|
224
|
+
...rt,
|
|
225
|
+
setExitCode: (code) => {
|
|
226
|
+
observedExitCode = code;
|
|
227
|
+
rt.setExitCode(code);
|
|
228
|
+
}
|
|
229
|
+
};
|
|
230
|
+
const program = createProgram(wrappedRt);
|
|
231
|
+
let exitCode = 0;
|
|
232
|
+
try {
|
|
233
|
+
await program.parseAsync(argv);
|
|
234
|
+
} catch (err) {
|
|
235
|
+
const maybeExitCode = typeof err?.exitCode === "number" ? err.exitCode : void 0;
|
|
236
|
+
if (maybeExitCode !== void 0) {
|
|
237
|
+
exitCode = maybeExitCode;
|
|
238
|
+
} else {
|
|
239
|
+
printError(wrappedRt, err);
|
|
240
|
+
exitCode = 1;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
const finalExitCode = observedExitCode !== 0 ? observedExitCode : exitCode;
|
|
244
|
+
wrappedRt.setExitCode(finalExitCode);
|
|
245
|
+
return finalExitCode;
|
|
246
|
+
}
|
|
247
|
+
if (process.argv[1]) {
|
|
248
|
+
const entryHref = pathToFileURL(process.argv[1]).href;
|
|
249
|
+
if (import.meta.url === entryHref) {
|
|
250
|
+
await runCli(process.argv);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
export {
|
|
254
|
+
createProgram,
|
|
255
|
+
runCli
|
|
256
|
+
};
|
|
257
|
+
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
ADDED
|
@@ -0,0 +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\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 .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 const res = await client.runAgent(agentId, body as any);\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,gBAAg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ACd,CAAC;AACD,gBAAU,IAAI,GAAG;AAAA,IACnB,CAAC;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;AACnB,QAAM,YAAY,cAAc,QAAQ,KAAK,CAAC,CAAC,EAAE;AACjD,MAAI,YAAY,QAAQ,WAAW;AACjC,UAAM,OAAO,QAAQ,IAAI;AAAA,EAC3B;AACF;","names":[]}
|
package/package.json
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@seclai/cli",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"description": "Seclai Command Line Interface",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"bin": {
|
|
8
|
+
"seclai": "dist/cli.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"dist",
|
|
12
|
+
"LICENSE",
|
|
13
|
+
"README.md"
|
|
14
|
+
],
|
|
15
|
+
"repository": "github:seclai/seclai-cli",
|
|
16
|
+
"scripts": {
|
|
17
|
+
"version:apply": "node scripts/set-version.mjs apply && node scripts/set-readme-version.mjs apply",
|
|
18
|
+
"version:restore": "node scripts/set-readme-version.mjs restore && node scripts/set-version.mjs restore",
|
|
19
|
+
"build": "tsup",
|
|
20
|
+
"dev": "tsx src/cli.ts",
|
|
21
|
+
"docs": "npm run build && node scripts/generate-docs.mjs",
|
|
22
|
+
"build:versioned": "npm run version:apply && npm run build && npm run version:restore",
|
|
23
|
+
"publish:ci": "npm run version:apply && npm run build && npm publish --provenance --access public --ignore-scripts && npm run version:restore",
|
|
24
|
+
"test": "vitest run",
|
|
25
|
+
"test:watch": "vitest",
|
|
26
|
+
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
27
|
+
},
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"@seclai/sdk": "*",
|
|
30
|
+
"commander": "^13.1.0"
|
|
31
|
+
},
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"@types/node": "^20.19.0",
|
|
34
|
+
"tsup": "^8.5.0",
|
|
35
|
+
"tsx": "^4.19.2",
|
|
36
|
+
"vitest": "^2.1.9",
|
|
37
|
+
"typescript": "^5.7.3"
|
|
38
|
+
}
|
|
39
|
+
}
|