@velaro/cli 1.4.183 → 1.4.184
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/bin/velaro.js +2 -0
- package/lib/commands/api-usage.js +17 -0
- package/package.json +1 -1
package/bin/velaro.js
CHANGED
|
@@ -16,6 +16,7 @@ import { productMatchCommand } from '../lib/commands/product-match.js';
|
|
|
16
16
|
import { partFinderCommand } from '../lib/commands/part-finder.js';
|
|
17
17
|
import { knowledgeCommand } from '../lib/commands/knowledge.js';
|
|
18
18
|
import { productCommand } from '../lib/commands/product.js';
|
|
19
|
+
import { apiUsageCommand } from '../lib/commands/api-usage.js';
|
|
19
20
|
import { mcpKeyCommand } from '../lib/commands/mcp-key.js';
|
|
20
21
|
import { deployStateCommand } from '../lib/commands/deploy-state.js';
|
|
21
22
|
import { checkCommand } from '../lib/commands/check.js';
|
|
@@ -179,6 +180,7 @@ await (registerStaffCommands ? registerStaffCommands(baseYargs) : baseYargs)
|
|
|
179
180
|
.command(knowledgeCommand)
|
|
180
181
|
.command(productCommand)
|
|
181
182
|
.command(mcpKeyCommand)
|
|
183
|
+
.command(apiUsageCommand)
|
|
182
184
|
.command(deployStateCommand)
|
|
183
185
|
.command(checkCommand)
|
|
184
186
|
.command(siteCommand)
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { get } from '../api.js';
|
|
2
|
+
import { runCommand } from '../run.js';
|
|
3
|
+
|
|
4
|
+
// velaro api-usage: API calls, API keys and webhook endpoints against the plan limits.
|
|
5
|
+
// Mirrors the get_api_usage MCP tool and Moshky tool. Route: GET /ApiKeys (usage array).
|
|
6
|
+
export const apiUsageCommand = {
|
|
7
|
+
command: 'api-usage',
|
|
8
|
+
describe: 'Show API usage against plan limits (calls today/month, keys, webhook endpoints)',
|
|
9
|
+
builder: y => y,
|
|
10
|
+
handler: runCommand(async () => {
|
|
11
|
+
const d = await get('/ApiKeys');
|
|
12
|
+
for (const m of d.usage || []) {
|
|
13
|
+
const cap = m.limit > 0 ? `${m.limit.toLocaleString()} (${m.percent}%)` : 'no cap';
|
|
14
|
+
console.log(`${m.label}: ${m.used.toLocaleString()} of ${cap}`);
|
|
15
|
+
}
|
|
16
|
+
}),
|
|
17
|
+
};
|
package/package.json
CHANGED