@intflow/sentinelctl 0.7.0 → 0.8.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/README.md +12 -7
- package/package.json +1 -1
- package/src/commands.mjs +17 -13
- package/src/main.mjs +5 -2
package/README.md
CHANGED
|
@@ -36,22 +36,27 @@ Credentials live in `~/.config/sentinelctl/credentials.json` (Linux/macOS) or `%
|
|
|
36
36
|
An access key is a long-lived credential for MCP clients and scripts. It carries your account and your current role, and it keeps working without any browser or CLI login: logging out, an expired web session or a revoked CLI token do not affect it.
|
|
37
37
|
|
|
38
38
|
```bash
|
|
39
|
-
sentinelctl access create "
|
|
40
|
-
sentinelctl access
|
|
39
|
+
sentinelctl access create "work laptop" # read key, printed once
|
|
40
|
+
sentinelctl access create "metadata bot" --access full # may also change data
|
|
41
|
+
sentinelctl access list # shows the ACCESS level
|
|
41
42
|
sentinelctl access revoke <key-id>
|
|
42
43
|
```
|
|
43
44
|
|
|
45
|
+
- Every key has one level, chosen when it is created and never changed: `read` (the default) runs only commands that do not change data; `full` runs everything your role allows. With a read key, MCP lists only read-only tools and the server answers a request that changes data with 403 `read_only_key` (exit code 3). For another level, create a new key.
|
|
44
46
|
- A key lasts 30 days. Each time it is used a week or more after its last extension it gains 7 days, so a key in regular use does not expire. An unused key expires after 30 days.
|
|
45
47
|
- Up to 10 keys per person. Keys are created and revoked only from a web or CLI login, never with another key.
|
|
46
48
|
- The key stops working when you revoke it or an admin disables your account. A role change applies on the next request.
|
|
47
49
|
|
|
48
|
-
The console serves every command of this CLI as a remote MCP tool at `/api/mcp/` (Streamable HTTP). Nothing is installed on the client, and new server releases update the tools.
|
|
50
|
+
The console serves every command of this CLI as a remote MCP tool at `/api/mcp/` (Streamable HTTP). Nothing is installed on the client, and new server releases update the tools. Any MCP client that supports Streamable HTTP with custom headers can connect:
|
|
49
51
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
+
- URL: `https://monitor.intflow.dev/api/mcp/`
|
|
53
|
+
- Header: `Authorization: Bearer <access key>`
|
|
54
|
+
|
|
55
|
+
```json
|
|
56
|
+
{ "mcpServers": { "sentinel": { "type": "http", "url": "https://monitor.intflow.dev/api/mcp/", "headers": { "Authorization": "Bearer sentinel_..." } } } }
|
|
52
57
|
```
|
|
53
58
|
|
|
54
|
-
|
|
59
|
+
Clients that register servers by command take the same two values, for example `claude mcp add --transport http sentinel https://monitor.intflow.dev/api/mcp/ --header "Authorization: Bearer sentinel_..."`. Tools are named `sentinel_<group>_<command>` (for example `sentinel_logs_stats`) and take the same options; the tool list contains only what your role and the key level allow. The same key also works as `SENTINEL_TOKEN` for this CLI.
|
|
55
60
|
|
|
56
61
|
## Getting help
|
|
57
62
|
|
|
@@ -161,7 +166,7 @@ The server tells the CLI the latest version; when a newer one exists the CLI pri
|
|
|
161
166
|
GitHub Actions publishes both packages (`.github/workflows/publish-cli.yml`) with npm trusted publishing, so no npm token is stored.
|
|
162
167
|
|
|
163
168
|
1. Bump `cli/package.json`, `cli/unscoped/package.json` (version and its `@intflow/sentinelctl` dependency) and `cliLatestVersion` in `config/dashboard.json` to the same version; `node scripts/check-cli-release.mjs` checks this.
|
|
164
|
-
2. Commit, then push a tag: `git tag cli-v0.
|
|
169
|
+
2. Commit, then push a tag: `git tag cli-v0.8.0 && git push origin cli-v0.8.0`.
|
|
165
170
|
3. The workflow runs the CLI checks and tests, publishes `@intflow/sentinelctl`, waits for the registry, then publishes the `sentinelctl` alias. Versions already on npm are skipped. Run it manually (Actions → publish-cli) to verify and pack without publishing.
|
|
166
171
|
|
|
167
172
|
One-time setup on npmjs.com, for each of the two packages: Settings → Trusted Publisher → GitHub Actions, organization or user `yeon3724`, repository `sentinel-fleet-console`, workflow `publish-cli.yml`, environment `npm`.
|
package/package.json
CHANGED
package/src/commands.mjs
CHANGED
|
@@ -740,7 +740,7 @@ async function metadataExport(context, { options }) {
|
|
|
740
740
|
context.note(`Saved metadata for ${body.devices?.length ?? 0} devices to ${options.file}.`);
|
|
741
741
|
return;
|
|
742
742
|
}
|
|
743
|
-
context
|
|
743
|
+
emit(context, body, () => JSON.stringify(body, null, 2));
|
|
744
744
|
}
|
|
745
745
|
|
|
746
746
|
async function metadataImport(context, { options, positionals }) {
|
|
@@ -785,6 +785,7 @@ async function sessionsRevoke(context, { positionals }) {
|
|
|
785
785
|
const accessKeyColumns = [
|
|
786
786
|
{ header: 'ID', value: (key) => key.id },
|
|
787
787
|
{ header: 'NAME', value: (key) => key.name, max: 32 },
|
|
788
|
+
{ header: 'ACCESS', value: (key) => key.access ?? '-' },
|
|
788
789
|
{ header: 'CREATED', value: (key) => localTime(key.createdAt) },
|
|
789
790
|
{ header: 'LAST USED', value: (key) => (key.lastUsedAt ? localTime(key.lastUsedAt) : 'never') },
|
|
790
791
|
{ header: 'EXPIRES', value: (key) => localTime(key.expiresAt) },
|
|
@@ -797,17 +798,17 @@ async function accessList(context) {
|
|
|
797
798
|
: 'No access keys. Create one with `sentinelctl access create <name>`.'));
|
|
798
799
|
}
|
|
799
800
|
|
|
800
|
-
async function accessCreate(context, { positionals }) {
|
|
801
|
+
async function accessCreate(context, { options, positionals }) {
|
|
801
802
|
const name = positionals.join(' ').trim();
|
|
802
|
-
if (!name) throw new UsageError('A key name is required.', { hint: 'Example: sentinelctl access create "
|
|
803
|
-
const key = await context.client.post('/api/access', { name });
|
|
803
|
+
if (!name) throw new UsageError('A key name is required.', { hint: 'Example: sentinelctl access create "work laptop"' });
|
|
804
|
+
const key = await context.client.post('/api/access', { name, access: options.access });
|
|
804
805
|
const mcpUrl = new URL('/api/mcp/', context.client.server).href;
|
|
805
806
|
emit(context, { ...key, mcpUrl }, () => [
|
|
806
|
-
renderKeyValues([['Name', key.name], ['ID', key.id], ['Expires', localTime(key.expiresAt)], ['MCP URL', mcpUrl]]),
|
|
807
|
+
renderKeyValues([['Name', key.name], ['ID', key.id], ['Access', key.access], ['Expires', localTime(key.expiresAt)], ['MCP URL', mcpUrl]]),
|
|
807
808
|
'',
|
|
808
809
|
key.token,
|
|
809
810
|
].join('\n'));
|
|
810
|
-
context.hint(`Shown once; store it now.
|
|
811
|
+
context.hint(`Shown once; store it now. Any MCP client that speaks Streamable HTTP connects with URL ${mcpUrl} and header "Authorization: Bearer <key>".`);
|
|
811
812
|
}
|
|
812
813
|
|
|
813
814
|
async function accessRevoke(context, { positionals }) {
|
|
@@ -1209,15 +1210,18 @@ const commands = [
|
|
|
1209
1210
|
{
|
|
1210
1211
|
group: 'access', name: 'create', run: accessCreate, role: 'viewer', mutates: true, mcp: false,
|
|
1211
1212
|
summary: 'Create an access key for MCP clients and scripts (shown once)',
|
|
1212
|
-
description: 'The key carries your account and role, works without a browser or CLI login, lasts 30 days and gains 7 more days whenever it is used a week or more after the last extension. Up to 10 keys per person.',
|
|
1213
|
-
args: [{ name: 'name', description: 'A label to recognise the key by, 1-80 characters.' }],
|
|
1214
|
-
|
|
1215
|
-
|
|
1213
|
+
description: 'The key carries your account and role, works without a browser or CLI login, lasts 30 days and gains 7 more days whenever it is used a week or more after the last extension. Up to 10 keys per person. A read key runs only commands that do not change data; the level is fixed when the key is created.',
|
|
1214
|
+
args: [{ name: 'name', description: 'A label to recognise the key by, 1-80 characters.' }],
|
|
1215
|
+
options: {
|
|
1216
|
+
access: { type: 'string', choices: ['read', 'full'], default: 'read', description: 'read: only commands that do not change data; full: everything your role allows.' },
|
|
1217
|
+
},
|
|
1218
|
+
examples: ['sentinelctl access create "work laptop"', 'sentinelctl access create "metadata bot" --access full', 'sentinelctl access create ci -o json --select token'],
|
|
1219
|
+
output: '{id, name, access, createdAt, lastUsedAt, expiresAt, token, mcpUrl}. The token is never shown again.',
|
|
1216
1220
|
},
|
|
1217
1221
|
{
|
|
1218
1222
|
group: 'access', name: 'list', run: accessList, role: 'viewer', mutates: false, mcp: false,
|
|
1219
1223
|
summary: 'Your access keys', options: {},
|
|
1220
|
-
examples: ['sentinelctl access list'], output: '{keys[]: {id, name, createdAt, lastUsedAt, expiresAt}}.',
|
|
1224
|
+
examples: ['sentinelctl access list'], output: '{keys[]: {id, name, access, createdAt, lastUsedAt, expiresAt}}.',
|
|
1221
1225
|
},
|
|
1222
1226
|
{
|
|
1223
1227
|
group: 'access', name: 'revoke', run: accessRevoke, role: 'viewer', mutates: true, mcp: false,
|
|
@@ -1258,7 +1262,7 @@ const commands = [
|
|
|
1258
1262
|
examples: ['sentinelctl admin revoke <session-id>'], output: 'Confirmation message.',
|
|
1259
1263
|
},
|
|
1260
1264
|
{
|
|
1261
|
-
group: 'admin', name: 'audit', run: adminAudit, role: 'admin', mutates:
|
|
1265
|
+
group: 'admin', name: 'audit', run: adminAudit, role: 'admin', mutates: true,
|
|
1262
1266
|
summary: 'Metadata audit clean-up records; run the clean-up now',
|
|
1263
1267
|
options: {
|
|
1264
1268
|
cleanup: { type: 'boolean', description: 'Apply the retention policy now (default 365 days / 64 MiB).' },
|
|
@@ -1278,7 +1282,7 @@ const commands = [
|
|
|
1278
1282
|
examples: ['sentinelctl health -o json'], output: '{status, application, components{metrics, logs, metadata}: {status, latencyMs}}.',
|
|
1279
1283
|
},
|
|
1280
1284
|
{
|
|
1281
|
-
group: null, name: 'api', run: rawApi, role: 'viewer', mutates:
|
|
1285
|
+
group: null, name: 'api', run: rawApi, role: 'viewer', mutates: true,
|
|
1282
1286
|
summary: 'Call a console API directly (JSON output; the server enforces roles)',
|
|
1283
1287
|
args: [{ name: 'path', description: 'Starts with /api/.' }],
|
|
1284
1288
|
options: {
|
package/src/main.mjs
CHANGED
|
@@ -134,8 +134,8 @@ const agentGuide = `sentinelctl for AI agents
|
|
|
134
134
|
|
|
135
135
|
Setup A human runs \`sentinelctl login\` once (30 days), or set SENTINEL_URL and SENTINEL_TOKEN
|
|
136
136
|
(an access key from \`sentinelctl access create <name>\` works and renews itself while used).
|
|
137
|
-
MCP The same commands are remote MCP tools
|
|
138
|
-
Authorization: Bearer <access key>. Nothing to install; the server updates the tools.
|
|
137
|
+
MCP The same commands are remote MCP tools for any Streamable HTTP client: URL <server>/api/mcp/,
|
|
138
|
+
header Authorization: Bearer <access key>. Nothing to install; the server updates the tools.
|
|
139
139
|
Output Use -o json. stdout is data; notes, hints and errors go to stderr (--quiet drops notes).
|
|
140
140
|
Errors One stderr line {"error":{status,code,message,hint,exitCode}}; messages are Korean, hints English.
|
|
141
141
|
Exit 0 ok · 1 server/network (retry later) · 2 usage (fix arguments) · 3 login/role/too old (stop).
|
|
@@ -290,6 +290,9 @@ function apiHint(error, context, command) {
|
|
|
290
290
|
? 'SENTINEL_TOKEN has expired or was revoked; supply a new token.'
|
|
291
291
|
: 'The CLI token has expired or was revoked. Run `sentinelctl login` again.';
|
|
292
292
|
}
|
|
293
|
+
if (error.code === 'read_only_key') {
|
|
294
|
+
return 'This access key is read-only. For commands that change data, create a key with `sentinelctl access create <name> --access full` or on the web CLI · MCP page.';
|
|
295
|
+
}
|
|
293
296
|
if (error.status === 403) {
|
|
294
297
|
const required = command ? roleOf(command, context.options ?? {}) : null;
|
|
295
298
|
return `Insufficient role${required && required !== 'viewer' ? ` (requires ${required})` : ''}. Ask an admin to run \`sentinelctl admin grant <your-email> --role <role>\`; check yours with \`sentinelctl whoami\`.`;
|