@hive3/cli 0.2.1 → 0.3.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 +7 -1
- package/package.json +7 -2
- package/src/api-client.js +12 -12
- package/src/commands.js +24 -8
- package/src/usage.js +1 -1
package/README.md
CHANGED
|
@@ -25,6 +25,8 @@ hive login --access read
|
|
|
25
25
|
hive login --access full
|
|
26
26
|
```
|
|
27
27
|
|
|
28
|
+
Approving a login requires a Honey Bee (or higher) account; otherwise the approval page shows "A Honey Bee subscription is required to create API keys." and Approve is disabled. A CLI key reaches every account where its signed-in owner is owner, admin or moderator. To act as a different account, run `hive logout` and log in as that account.
|
|
29
|
+
|
|
28
30
|
The CLI stores credentials in the OS config directory, or `HIVE_CONFIG_HOME` when set. It prints approval URLs, codes, key prefixes, and config paths, but never prints the API key secret after login completion.
|
|
29
31
|
|
|
30
32
|
Useful environment overrides:
|
|
@@ -55,7 +57,7 @@ Advanced users can request exact scopes with repeated `--scope` flags.
|
|
|
55
57
|
- `account:read` and `account:write`: profile, account preferences, wallets visibility, NFT exposure, export/deletion requests, uploads, and builder config.
|
|
56
58
|
- `posts:read` and `posts:write`: posts and comments.
|
|
57
59
|
- `resources:read` and `resources:write`: events, courses, content, quests, jobs, participant workflows, evidence, attendance, progress, and applications.
|
|
58
|
-
- `communities:read`, `communities:moderate`, and `communities:write`: capability discovery and current-role community membership/member workflows.
|
|
60
|
+
- `communities:read`, `communities:moderate`, and `communities:write`: capability discovery, managed-account profiles and builders (`--account`), and current-role community membership/member workflows.
|
|
59
61
|
|
|
60
62
|
Scopes are necessary but not sufficient. Resource manager routes also require the person behind the key to be the owner or have the current community role. If `hive capabilities` returns an empty community list, personal commands can still work, but community-scoped commands should not be attempted.
|
|
61
63
|
|
|
@@ -166,6 +168,8 @@ hive profile get
|
|
|
166
168
|
hive profile update --name "Ada" --image-storage-id <storage-id>
|
|
167
169
|
hive profile access --type open
|
|
168
170
|
hive profile overview save --file overview.json
|
|
171
|
+
hive profile update --account <account-id-or-handle> --name "Design Guild"
|
|
172
|
+
hive profile overview export --account <account-id-or-handle> --file overview.json
|
|
169
173
|
hive account preferences --theme dark
|
|
170
174
|
hive account export
|
|
171
175
|
hive wallets default <wallet-address>
|
|
@@ -177,6 +181,8 @@ hive communities applications <community-id>
|
|
|
177
181
|
hive communities approve <application-id>
|
|
178
182
|
```
|
|
179
183
|
|
|
184
|
+
Add `--account <id-or-handle>` (once) to `profile get|update|handle|access` and builder `get|save|import|export` to manage an account where you are owner, admin or moderator. The key needs `communities:read` for reads or `communities:write` for writes. Moderators can't change roles or anything involving payments. `hive upload` always uploads as you; attach the returned storage ID with `--account`.
|
|
185
|
+
|
|
180
186
|
Destructive or high-risk commands require explicit arguments such as exact IDs or confirmations. `archive`, member removal, role changes, application review, attendance recording, account deletion requests, and evidence/applicant decisions should be treated as confirmation-worthy in agent workflows.
|
|
181
187
|
|
|
182
188
|
## Excluded Operations
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hive3/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Command-line client for Hive's public API.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -18,7 +18,12 @@
|
|
|
18
18
|
},
|
|
19
19
|
"scripts": {
|
|
20
20
|
"check": "node --check bin/hive.js && node --check src/api-client.js && node --check src/commands.js && node --check src/config.js && node --check src/extended-commands.js && node --check src/login.js && node --check src/update.js && node --check src/usage.js",
|
|
21
|
-
"test": "node --test test/*.test.mjs"
|
|
21
|
+
"test": "node --test test/*.test.mjs",
|
|
22
|
+
"typecheck": "tsc -p tsconfig.json"
|
|
23
|
+
},
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"@types/node": "25.0.6",
|
|
26
|
+
"typescript": "5.9.3"
|
|
22
27
|
},
|
|
23
28
|
"engines": {
|
|
24
29
|
"node": ">=20"
|
package/src/api-client.js
CHANGED
|
@@ -136,8 +136,8 @@ export function createApiClient(options) {
|
|
|
136
136
|
capabilities() {
|
|
137
137
|
return request("GET", "/capabilities");
|
|
138
138
|
},
|
|
139
|
-
checkHandle(handle) {
|
|
140
|
-
return request("GET", "/profile/handle", { query: { handle } });
|
|
139
|
+
checkHandle(handle, account) {
|
|
140
|
+
return request("GET", "/profile/handle", { query: { handle, account } });
|
|
141
141
|
},
|
|
142
142
|
createComment(postId, payload) {
|
|
143
143
|
return request("POST", `/posts/${encodeURIComponent(postId)}/comments`, { body: payload });
|
|
@@ -157,11 +157,11 @@ export function createApiClient(options) {
|
|
|
157
157
|
getAccount() {
|
|
158
158
|
return request("GET", "/account");
|
|
159
159
|
},
|
|
160
|
-
getBuilder(kind) {
|
|
161
|
-
return request("GET", `/profile/${kind}
|
|
160
|
+
getBuilder(kind, account) {
|
|
161
|
+
return request("GET", `/profile/${kind}`, { query: { account } });
|
|
162
162
|
},
|
|
163
|
-
getProfile() {
|
|
164
|
-
return request("GET", "/profile");
|
|
163
|
+
getProfile(account) {
|
|
164
|
+
return request("GET", "/profile", { query: { account } });
|
|
165
165
|
},
|
|
166
166
|
listResource(kind, query) {
|
|
167
167
|
return request("GET", `/${kind}`, { query });
|
|
@@ -199,8 +199,8 @@ export function createApiClient(options) {
|
|
|
199
199
|
revokeCurrentKey() {
|
|
200
200
|
return request("DELETE", "/account/keys/current");
|
|
201
201
|
},
|
|
202
|
-
saveBuilder(kind, config) {
|
|
203
|
-
return request("PATCH", `/profile/${kind}`, { body: { config } });
|
|
202
|
+
saveBuilder(kind, config, account) {
|
|
203
|
+
return request("PATCH", `/profile/${kind}`, { body: { config }, query: { account } });
|
|
204
204
|
},
|
|
205
205
|
setDefaultWallet(walletAddress) {
|
|
206
206
|
return request("PATCH", "/wallets/default", { body: { walletAddress } });
|
|
@@ -225,11 +225,11 @@ export function createApiClient(options) {
|
|
|
225
225
|
updateAccountPreferences(payload) {
|
|
226
226
|
return request("PATCH", "/account/preferences", { body: payload });
|
|
227
227
|
},
|
|
228
|
-
updateProfile(payload) {
|
|
229
|
-
return request("PATCH", "/profile", { body: payload });
|
|
228
|
+
updateProfile(payload, account) {
|
|
229
|
+
return request("PATCH", "/profile", { body: payload, query: { account } });
|
|
230
230
|
},
|
|
231
|
-
updateProfileAccess(payload) {
|
|
232
|
-
return request("PATCH", "/profile/access", { body: payload });
|
|
231
|
+
updateProfileAccess(payload, account) {
|
|
232
|
+
return request("PATCH", "/profile/access", { body: payload, query: { account } });
|
|
233
233
|
},
|
|
234
234
|
updateResource(kind, id, payload) {
|
|
235
235
|
return request("PATCH", `/${kind}/${encodeURIComponent(id)}`, { body: payload });
|
package/src/commands.js
CHANGED
|
@@ -51,6 +51,21 @@ function requiredFlagValue(flag, value) {
|
|
|
51
51
|
return value;
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
+
function takeAccountFlag(args) {
|
|
55
|
+
let account;
|
|
56
|
+
const rest = [];
|
|
57
|
+
for (let index = 0; index < args.length; index += 1) {
|
|
58
|
+
if (args[index] === "--account") {
|
|
59
|
+
if (account !== undefined) throw new Error("--account may only be given once");
|
|
60
|
+
index += 1;
|
|
61
|
+
account = requiredFlagValue("--account", args[index]);
|
|
62
|
+
} else {
|
|
63
|
+
rest.push(args[index]);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return { account, rest };
|
|
67
|
+
}
|
|
68
|
+
|
|
54
69
|
function parseListOptions(args) {
|
|
55
70
|
const query = {};
|
|
56
71
|
for (let index = 0; index < args.length; index += 1) {
|
|
@@ -289,21 +304,22 @@ async function runResource(kind, args, deps) {
|
|
|
289
304
|
}
|
|
290
305
|
|
|
291
306
|
async function runProfile(args, deps) {
|
|
292
|
-
const [action, ...
|
|
307
|
+
const [action, ...actionArgs] = args;
|
|
308
|
+
const { account, rest } = takeAccountFlag(actionArgs);
|
|
293
309
|
const client = await authenticatedClient(deps);
|
|
294
310
|
if (action === "get") {
|
|
295
311
|
if (rest.length > 0) throw new Error(`Unknown profile get option: ${rest[0]}`);
|
|
296
|
-
writeJson(deps.stdout, await client.getProfile());
|
|
312
|
+
writeJson(deps.stdout, await client.getProfile(account));
|
|
297
313
|
return;
|
|
298
314
|
}
|
|
299
315
|
if (action === "update") {
|
|
300
|
-
writeJson(deps.stdout, await client.updateProfile(parseProfileUpdatePayload(rest)));
|
|
316
|
+
writeJson(deps.stdout, await client.updateProfile(parseProfileUpdatePayload(rest), account));
|
|
301
317
|
return;
|
|
302
318
|
}
|
|
303
319
|
if (action === "handle") {
|
|
304
320
|
const handle = requiredFlagValue("handle", rest[0]);
|
|
305
321
|
if (rest.length > 1) throw new Error(`Unknown profile handle option: ${rest[1]}`);
|
|
306
|
-
writeJson(deps.stdout, await client.checkHandle(handle));
|
|
322
|
+
writeJson(deps.stdout, await client.checkHandle(handle, account));
|
|
307
323
|
return;
|
|
308
324
|
}
|
|
309
325
|
if (action === "access") {
|
|
@@ -320,7 +336,7 @@ async function runProfile(args, deps) {
|
|
|
320
336
|
}
|
|
321
337
|
}
|
|
322
338
|
if (!accessType) throw new Error("--type is required");
|
|
323
|
-
writeJson(deps.stdout, await client.updateProfileAccess({ accessType, subscriptionId }));
|
|
339
|
+
writeJson(deps.stdout, await client.updateProfileAccess({ accessType, subscriptionId }, account));
|
|
324
340
|
return;
|
|
325
341
|
}
|
|
326
342
|
const builderKind = profileBuilderKind(action);
|
|
@@ -329,21 +345,21 @@ async function runProfile(args, deps) {
|
|
|
329
345
|
const apiKind = apiBuilderKind(builderKind);
|
|
330
346
|
if (builderAction === "get") {
|
|
331
347
|
if (builderRest.length > 0) throw new Error(`Unknown ${builderKind} get option: ${builderRest[0]}`);
|
|
332
|
-
writeJson(deps.stdout, await client.getBuilder(apiKind));
|
|
348
|
+
writeJson(deps.stdout, await client.getBuilder(apiKind, account));
|
|
333
349
|
return;
|
|
334
350
|
}
|
|
335
351
|
if (builderAction === "save" || builderAction === "import") {
|
|
336
352
|
if (builderRest[0] !== "--file") throw new Error("--file is required");
|
|
337
353
|
const file = requiredFlagValue("--file", builderRest[1]);
|
|
338
354
|
if (builderRest.length > 2) throw new Error(`Unknown ${builderKind} ${builderAction} option: ${builderRest[2]}`);
|
|
339
|
-
writeJson(deps.stdout, await client.saveBuilder(apiKind, await readJsonFile(file)));
|
|
355
|
+
writeJson(deps.stdout, await client.saveBuilder(apiKind, await readJsonFile(file), account));
|
|
340
356
|
return;
|
|
341
357
|
}
|
|
342
358
|
if (builderAction === "export") {
|
|
343
359
|
if (builderRest[0] !== "--file") throw new Error("--file is required");
|
|
344
360
|
const file = requiredFlagValue("--file", builderRest[1]);
|
|
345
361
|
if (builderRest.length > 2) throw new Error(`Unknown ${builderKind} export option: ${builderRest[2]}`);
|
|
346
|
-
const data = await client.getBuilder(apiKind);
|
|
362
|
+
const data = await client.getBuilder(apiKind, account);
|
|
347
363
|
await writeFile(file, `${JSON.stringify(data.data, null, 2)}\n`, "utf8");
|
|
348
364
|
writeLine(deps.stdout, `Wrote ${builderKind} config to ${file}.`);
|
|
349
365
|
return;
|
package/src/usage.js
CHANGED
|
@@ -10,7 +10,7 @@ export function usage() {
|
|
|
10
10
|
" update [--check] Install or check for the latest Hive CLI",
|
|
11
11
|
" whoami Show the authenticated Hive account",
|
|
12
12
|
" capabilities List community targets available to this account",
|
|
13
|
-
" profile <action> Manage profile text, media IDs, access, and builders",
|
|
13
|
+
" profile <action> Manage profile text, media IDs, access, and builders; add --account <id-or-handle> for an account you help run",
|
|
14
14
|
" upload <file> Upload an allowed image or document and print its storage ID",
|
|
15
15
|
" account <action> Manage account preferences, exports, and deletion requests",
|
|
16
16
|
" wallets <action> Manage linked wallet visibility/default selection",
|