@kobbe/cli 0.1.0 → 0.2.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 +1 -0
- package/package.json +2 -2
- package/src/cli.js +15 -0
- package/src/client.js +4 -0
- package/src/mcp.js +8 -1
package/README.md
CHANGED
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kobbe/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Kobbe CLI and MCP server for AI agents.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "UNLICENSED",
|
|
7
|
-
"homepage": "https://kobbe.io/docs/ai-
|
|
7
|
+
"homepage": "https://kobbe.io/docs/ai-agents",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
10
10
|
"url": "git+https://github.com/michael-andreuzza/analytics.git",
|
package/src/cli.js
CHANGED
|
@@ -29,6 +29,7 @@ function printJson(value) {
|
|
|
29
29
|
const icons = {
|
|
30
30
|
account: "@",
|
|
31
31
|
sites: "#",
|
|
32
|
+
live: "*",
|
|
32
33
|
money: "$",
|
|
33
34
|
range: "~",
|
|
34
35
|
overview: ">",
|
|
@@ -142,6 +143,16 @@ function printSites(data, options) {
|
|
|
142
143
|
])
|
|
143
144
|
}
|
|
144
145
|
|
|
146
|
+
function printLive(data, options) {
|
|
147
|
+
const rows = data.sites || []
|
|
148
|
+
const total = rows.reduce((sum, row) => sum + (row.online || 0), 0)
|
|
149
|
+
process.stdout.write(`${icon("live", options)}Online now: ${total}\n\n`)
|
|
150
|
+
printRows(rows, [
|
|
151
|
+
{ label: "Site", value: (row) => siteLabel(row.site) },
|
|
152
|
+
{ label: "Online", value: (row) => row.online },
|
|
153
|
+
])
|
|
154
|
+
}
|
|
155
|
+
|
|
145
156
|
function printRevenue(data, options) {
|
|
146
157
|
const revenue = data.revenue
|
|
147
158
|
process.stdout.write(`${icon("money", options)}Money map for ${siteLabel(data.site)}\n`)
|
|
@@ -295,6 +306,7 @@ function printResetStats(data, options) {
|
|
|
295
306
|
function printHuman(command, data, options) {
|
|
296
307
|
if (command === "me") return printMe(data, options)
|
|
297
308
|
if (command === "sites") return printSites(data, options)
|
|
309
|
+
if (command === "live") return printLive(data, options)
|
|
298
310
|
if (command === "overview") return printOverview(data, options)
|
|
299
311
|
if (command === "revenue") return printRevenue(data, options)
|
|
300
312
|
if (command === "top-pages") return printTopPages(data, options)
|
|
@@ -321,6 +333,7 @@ Usage:
|
|
|
321
333
|
kobbe login --token kbpat_... [--api https://app.kobbe.io]
|
|
322
334
|
kobbe me
|
|
323
335
|
kobbe sites
|
|
336
|
+
kobbe live
|
|
324
337
|
kobbe overview --site <site-id> [--range today]
|
|
325
338
|
kobbe revenue --site <site-id> [--range today]
|
|
326
339
|
kobbe top-pages --site <site-id> [--range today] [--limit 10]
|
|
@@ -369,6 +382,8 @@ async function main() {
|
|
|
369
382
|
return printOutput(command, await client.me(), options)
|
|
370
383
|
if (command === "sites")
|
|
371
384
|
return printOutput(command, await client.sites(), options)
|
|
385
|
+
if (command === "live")
|
|
386
|
+
return printOutput(command, await client.live(), options)
|
|
372
387
|
|
|
373
388
|
const site = options.site
|
|
374
389
|
const range = options.range || "today"
|
package/src/client.js
CHANGED
package/src/mcp.js
CHANGED
|
@@ -9,6 +9,12 @@ const tools = [
|
|
|
9
9
|
description: "List Kobbe sites in the authenticated workspace.",
|
|
10
10
|
inputSchema: { type: "object", properties: {} },
|
|
11
11
|
},
|
|
12
|
+
{
|
|
13
|
+
name: "get_live",
|
|
14
|
+
description:
|
|
15
|
+
"Get the number of visitors online right now for every site in the workspace.",
|
|
16
|
+
inputSchema: { type: "object", properties: {} },
|
|
17
|
+
},
|
|
12
18
|
{
|
|
13
19
|
name: "get_overview",
|
|
14
20
|
description:
|
|
@@ -146,6 +152,7 @@ const tools = [
|
|
|
146
152
|
|
|
147
153
|
async function callTool(name, args = {}) {
|
|
148
154
|
if (name === "list_sites") return client.sites()
|
|
155
|
+
if (name === "get_live") return client.live()
|
|
149
156
|
if (name === "get_overview")
|
|
150
157
|
return client.overview(args.siteId, args.range || "today")
|
|
151
158
|
if (name === "get_revenue")
|
|
@@ -193,7 +200,7 @@ export async function startMcpServer() {
|
|
|
193
200
|
result: {
|
|
194
201
|
protocolVersion: "2024-11-05",
|
|
195
202
|
capabilities: { tools: {} },
|
|
196
|
-
serverInfo: { name: "@kobbe/cli", version: "0.
|
|
203
|
+
serverInfo: { name: "@kobbe/cli", version: "0.2.0" },
|
|
197
204
|
},
|
|
198
205
|
})
|
|
199
206
|
return
|