@intflow/sentinelctl 0.11.0 → 0.11.2
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 +1 -0
- package/package.json +1 -1
- package/src/commands.mjs +51 -5
- package/src/main.mjs +1 -1
package/README.md
CHANGED
|
@@ -91,6 +91,7 @@ Mistyped commands and options get a suggestion (`Did you mean --range?`), and ev
|
|
|
91
91
|
## Fleet overview and metrics
|
|
92
92
|
|
|
93
93
|
```bash
|
|
94
|
+
sentinelctl fleet wallboard --edge-only --limit 10 -o json # wallboard attention, recovery and field operations
|
|
94
95
|
sentinelctl fleet summary # status, offline split, attention, busiest devices, trends, log levels, error patterns
|
|
95
96
|
sentinelctl fleet summary -r 1h -o json # about 10KB
|
|
96
97
|
sentinelctl metrics top memory -r 7d # devices ranked by 7-day average memory + fleet distribution
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intflow/sentinelctl",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.2",
|
|
4
4
|
"description": "Sentinel Fleet Console CLI: search device logs, inspect status and metrics, edit metadata, manage roles and create access keys for MCP",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
package/src/commands.mjs
CHANGED
|
@@ -372,6 +372,34 @@ async function metricsTop(context, { options, positionals }) {
|
|
|
372
372
|
else if (body.scope.matched > body.devices.length) context.hint(`Showing ${body.devices.length} of ${body.scope.matched}. Raise --top (max 100).`);
|
|
373
373
|
}
|
|
374
374
|
|
|
375
|
+
async function fleetWallboard(context, { options }) {
|
|
376
|
+
const limit = options.limit;
|
|
377
|
+
if (!Number.isInteger(limit) || limit < 1 || limit > 100) throw new UsageError('--limit must be between 1 and 100.');
|
|
378
|
+
const body = await context.client.get('/api/wallboard', {
|
|
379
|
+
fleet: options['edge-only'] ? 'edge' : undefined,
|
|
380
|
+
hideUnknown: options['hide-unknown'] ? 'true' : undefined,
|
|
381
|
+
excludeTestDemo: options['include-test-demo'] ? 'false' : undefined,
|
|
382
|
+
});
|
|
383
|
+
const ops = body.operations;
|
|
384
|
+
const result = {
|
|
385
|
+
generatedAt: body.generatedAt, stale: body.stale, counts: body.counts, services: body.services,
|
|
386
|
+
attentionTotal: body.attentionTotal, resourcesTotal: body.resourcesTotal, recoveredTotal: body.recoveredTotal,
|
|
387
|
+
attention: body.attention.slice(0, limit), resources: body.resources.slice(0, limit), recovered: body.recovered.slice(0, limit),
|
|
388
|
+
operations: ops ? {
|
|
389
|
+
summary: ops.summary, today: ops.today,
|
|
390
|
+
actions: ops.actions.slice(0, limit).map(({ id, farmName, state, severity, owner, nextActionDate }) => ({ id, farmName, state, severity, owner, nextActionDate })),
|
|
391
|
+
visits: ops.visits.slice(0, limit).map(({ id, farmName, visitDate, owner }) => ({ id, farmName, visitDate, owner })),
|
|
392
|
+
watched: ops.watched.slice(0, limit).map(({ key, name, watchReasons }) => ({ key, name, watchReasons })),
|
|
393
|
+
} : null,
|
|
394
|
+
};
|
|
395
|
+
emit(context, result, () => renderKeyValues([
|
|
396
|
+
['Data', body.stale ? 'stale' : 'fresh'], ['Attention', body.attentionTotal], ['Resource warnings', body.resourcesTotal],
|
|
397
|
+
['Recovered (1h)', body.recoveredTotal], ...Object.entries(ops?.summary ?? {}),
|
|
398
|
+
...result.attention.map(item => [item.name, [item.status, ...item.reasons].join(' · ')]),
|
|
399
|
+
...((result.operations?.visits ?? []).map(item => [item.farmName, item.visitDate])),
|
|
400
|
+
]));
|
|
401
|
+
}
|
|
402
|
+
|
|
375
403
|
async function fleetSummary(context, { options }) {
|
|
376
404
|
const body = await context.client.get('/api/fleet/summary', { range: options.range, logs: options.logs === false ? 0 : undefined, trends: options.trends === false ? 0 : undefined });
|
|
377
405
|
emit(context, body, () => {
|
|
@@ -1287,6 +1315,12 @@ async function changesRecent(context, { options }) {
|
|
|
1287
1315
|
}
|
|
1288
1316
|
|
|
1289
1317
|
const commands = [
|
|
1318
|
+
{
|
|
1319
|
+
group: null, name: 'whoami', role: 'viewer', mutates: false,
|
|
1320
|
+
summary: 'Show the authenticated account, role and credential',
|
|
1321
|
+
args: [], options: {}, examples: ['sentinelctl whoami'],
|
|
1322
|
+
run: async context => { const identity = await context.client.get('/api/session'); emit(context, identity, () => identity.user); },
|
|
1323
|
+
},
|
|
1290
1324
|
{
|
|
1291
1325
|
group: null, name: 'update', role: 'viewer', mutates: false, mcp: false, local: true,
|
|
1292
1326
|
run: async (context, { options }) => context.out(JSON.stringify(await update(options))),
|
|
@@ -1509,6 +1543,18 @@ const commands = [
|
|
|
1509
1543
|
],
|
|
1510
1544
|
output: '{metric, unit, scope{devices, withData, matched}, distribution{min, avg, p50, p90, p95, max}, devices[]: {agentId, displayName, status, value, previous?, change?}}.',
|
|
1511
1545
|
},
|
|
1546
|
+
{
|
|
1547
|
+
group: 'fleet', name: 'wallboard', run: fleetWallboard, role: 'viewer', mutates: false, userText: true,
|
|
1548
|
+
summary: 'Wallboard attention, recent recoveries and field operations with the same filters as the console',
|
|
1549
|
+
options: {
|
|
1550
|
+
'edge-only': { type: 'boolean', description: 'Only edge devices.' },
|
|
1551
|
+
'hide-unknown': { type: 'boolean', description: 'Hide devices with unknown reception.' },
|
|
1552
|
+
'include-test-demo': { type: 'boolean', description: 'Include test and demo devices.' },
|
|
1553
|
+
limit: { type: 'integer', default: 10, description: 'Rows per detail list (1–100). Counts cover all matches.' },
|
|
1554
|
+
},
|
|
1555
|
+
examples: ['sentinelctl fleet wallboard --edge-only -o json'],
|
|
1556
|
+
output: 'Counts, services, limited attention/resources/recovered rows and operations summary, actions, visits and watched farms.',
|
|
1557
|
+
},
|
|
1512
1558
|
{
|
|
1513
1559
|
group: 'fleet', name: 'summary', run: fleetSummary, role: 'viewer', mutates: false,
|
|
1514
1560
|
summary: 'Status, attention, trends and error patterns in one call',
|
|
@@ -1609,7 +1655,7 @@ const commands = [
|
|
|
1609
1655
|
examples: ['sentinelctl sessions revoke <session-id>'], output: 'Confirmation message.',
|
|
1610
1656
|
},
|
|
1611
1657
|
{
|
|
1612
|
-
group: 'access', name: 'create', run: accessCreate, role: 'viewer', mutates: true,
|
|
1658
|
+
group: 'access', name: 'create', run: accessCreate, role: 'viewer', mutates: true, browser: true,
|
|
1613
1659
|
summary: 'Create an access key for MCP clients and scripts (shown once)',
|
|
1614
1660
|
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.',
|
|
1615
1661
|
args: [{ name: 'name', description: 'A label to recognise the key by, 1-80 characters.' }],
|
|
@@ -1620,12 +1666,12 @@ const commands = [
|
|
|
1620
1666
|
output: '{id, name, access, createdAt, lastUsedAt, expiresAt, token, mcpUrl}. The token is never shown again.',
|
|
1621
1667
|
},
|
|
1622
1668
|
{
|
|
1623
|
-
group: 'access', name: 'list', run: accessList, role: 'viewer', mutates: false,
|
|
1669
|
+
group: 'access', name: 'list', run: accessList, role: 'viewer', mutates: false, browser: true,
|
|
1624
1670
|
summary: 'Your access keys', options: {},
|
|
1625
1671
|
examples: ['sentinelctl access list'], output: '{keys[]: {id, name, access, createdAt, lastUsedAt, expiresAt}}.',
|
|
1626
1672
|
},
|
|
1627
1673
|
{
|
|
1628
|
-
group: 'access', name: 'revoke', run: accessRevoke, role: 'viewer', mutates: true,
|
|
1674
|
+
group: 'access', name: 'revoke', run: accessRevoke, role: 'viewer', mutates: true, browser: true,
|
|
1629
1675
|
summary: 'Revoke one of your access keys now', args: [{ name: 'key-id' }], options: {},
|
|
1630
1676
|
examples: ['sentinelctl access revoke <key-id>'], output: 'Confirmation message.',
|
|
1631
1677
|
},
|
|
@@ -1760,7 +1806,7 @@ const commands = [
|
|
|
1760
1806
|
output: '{sourceId, generatedAt, status, ingest, last, kinds, key, rejections}.',
|
|
1761
1807
|
},
|
|
1762
1808
|
{
|
|
1763
|
-
group: 'sources', name: 'test', run: sourcesTest, role: 'viewer', mutates: true,
|
|
1809
|
+
group: 'sources', name: 'test', run: sourcesTest, role: 'viewer', mutates: true, browser: true,
|
|
1764
1810
|
summary: 'Send one test event with a source key file and verify the same event ID in central search',
|
|
1765
1811
|
args: [{ name: 'source-id' }],
|
|
1766
1812
|
options: { 'key-file': { type: 'string', placeholder: 'path', description: 'Owner-only source write-key file; the key is never printed.' } },
|
|
@@ -1768,7 +1814,7 @@ const commands = [
|
|
|
1768
1814
|
output: '{sourceId, eventId, status: verified, receivedAt, test: true}.',
|
|
1769
1815
|
},
|
|
1770
1816
|
{
|
|
1771
|
-
group: 'sources', name: 'keys issue', run: sourcesKeysIssue, role: 'viewer', mutates: true,
|
|
1817
|
+
group: 'sources', name: 'keys issue', run: sourcesKeysIssue, role: 'viewer', mutates: true, browser: true,
|
|
1772
1818
|
summary: 'Issue the write key of a source (events:write, 365 days, shown once)',
|
|
1773
1819
|
description: 'One valid key per source. With --replace the current key is revoked at once and a new one is issued.',
|
|
1774
1820
|
args: [{ name: 'source-id' }],
|
package/src/main.mjs
CHANGED
|
@@ -174,7 +174,7 @@ function commandsCatalog(selected = null) {
|
|
|
174
174
|
exitCodes,
|
|
175
175
|
commands: [
|
|
176
176
|
...(selected ? [] : Object.entries(specialCommands).map(([name, command]) => ({ command: name, usage: command.usage, summary: command.summary, mutates: name === 'logout' }))),
|
|
177
|
-
...(selected ?? catalog).map((command) => compact({
|
|
177
|
+
...(selected ?? catalog.filter(command => !Object.hasOwn(specialCommands, commandPath(command)))).map((command) => compact({
|
|
178
178
|
command: commandPath(command), usage: usageLine(command), summary: command.summary, description: command.description,
|
|
179
179
|
role: command.role, roleNote: command.roleNote, mutates: command.mutates, args: command.args,
|
|
180
180
|
options: Object.fromEntries(Object.entries(command.options).map(([name, spec]) => [name, compact({
|