@homespunapps/cli 1.6.57 → 1.6.59
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/dist/commands/data.js +23 -2
- package/dist/help-catalog.js +4 -0
- package/package.json +2 -2
package/dist/commands/data.js
CHANGED
|
@@ -18,7 +18,7 @@ export async function runData(args) {
|
|
|
18
18
|
return;
|
|
19
19
|
}
|
|
20
20
|
if (!appArg || !collection || !verb) {
|
|
21
|
-
fail("usage: homespun data <app> <collection> <list|get|upsert|update|delete|restore|deleted|purge|import|retention>", "invalid_args");
|
|
21
|
+
fail("usage: homespun data <app> <collection> <list|count|get|upsert|update|delete|restore|deleted|purge|import|retention>", "invalid_args");
|
|
22
22
|
}
|
|
23
23
|
const sub = {
|
|
24
24
|
positionals: args.positionals.slice(3),
|
|
@@ -31,6 +31,8 @@ export async function runData(args) {
|
|
|
31
31
|
switch (verb) {
|
|
32
32
|
case "list":
|
|
33
33
|
return runList(appArg, collection, sub);
|
|
34
|
+
case "count":
|
|
35
|
+
return runCount(appArg, collection, sub);
|
|
34
36
|
case "get":
|
|
35
37
|
return runGet(appArg, collection, sub);
|
|
36
38
|
case "upsert":
|
|
@@ -50,7 +52,7 @@ export async function runData(args) {
|
|
|
50
52
|
case "retention":
|
|
51
53
|
return runRetention(appArg, collection, sub);
|
|
52
54
|
default:
|
|
53
|
-
fail(`unknown verb '${verb}': homespun data <app> <collection> <list|get|upsert|update|delete|restore|deleted|purge|import|retention>`, "invalid_args");
|
|
55
|
+
fail(`unknown verb '${verb}': homespun data <app> <collection> <list|count|get|upsert|update|delete|restore|deleted|purge|import|retention>`, "invalid_args");
|
|
54
56
|
}
|
|
55
57
|
}
|
|
56
58
|
function parseIntFlag(args, name, defaultValue, bounds = {}) {
|
|
@@ -91,6 +93,25 @@ async function runList(appArg, collection, args) {
|
|
|
91
93
|
failFromError(e);
|
|
92
94
|
}
|
|
93
95
|
}
|
|
96
|
+
// `homespun data <app> <coll> count`: live row count (spec B4, issue #1056),
|
|
97
|
+
// the same aggregate the browser `/_hs/count/:name` door and the MCP
|
|
98
|
+
// `count_rows` tool call through. Gated by the collection's `countRead`
|
|
99
|
+
// opt-in, INDEPENDENT of `read`: a collection that opted in returns its count
|
|
100
|
+
// even to a caller who cannot `list` the rows, and a collection that never
|
|
101
|
+
// declared `countRead` refuses with collection_count_forbidden even for a
|
|
102
|
+
// caller who could otherwise list. No `--where`/`--sort`/`--since`/`--limit`:
|
|
103
|
+
// count is a whole-scope total, there is nothing here to filter or page.
|
|
104
|
+
async function runCount(appArg, collection, args) {
|
|
105
|
+
assertKnownFlags(args, ...specFor("data", "count"));
|
|
106
|
+
const client = makeClient(args);
|
|
107
|
+
const appId = await resolveAppId(client, appArg);
|
|
108
|
+
try {
|
|
109
|
+
printJson(await client.countAppRows(appId, collection));
|
|
110
|
+
}
|
|
111
|
+
catch (e) {
|
|
112
|
+
failFromError(e);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
94
115
|
// Parse a `--<name> <json>` flag whose value must be a JSON array. Returns
|
|
95
116
|
// undefined when the flag is absent; fails cleanly (invalid_args) when present
|
|
96
117
|
// but not a JSON array. Element-level validation is left to the relay, which
|
package/dist/help-catalog.js
CHANGED
|
@@ -174,6 +174,10 @@ const DATA = {
|
|
|
174
174
|
},
|
|
175
175
|
],
|
|
176
176
|
},
|
|
177
|
+
{
|
|
178
|
+
verb: "count",
|
|
179
|
+
summary: "Shows the collection's live row count. Independent of read: works when the manifest opted the collection into countRead even for a caller who cannot list.",
|
|
180
|
+
},
|
|
177
181
|
{
|
|
178
182
|
verb: "get",
|
|
179
183
|
positionals: "<key>",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@homespunapps/cli",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.59",
|
|
4
4
|
"description": "Command-line client for the Homespun relay: deploy a real multi-user web app from your agent, then keep reading and writing its data.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"test:unit": "vitest run"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@homespunapps/core": "^1.6.
|
|
39
|
+
"@homespunapps/core": "^1.6.59",
|
|
40
40
|
"qrcode-terminal": "^0.12.0"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|