@neta-art/cohub-cli 6.0.1 → 6.1.1

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 CHANGED
@@ -297,7 +297,7 @@ cohub works resolve <workSlug> --owner <username> --space-slug <spaceSlug>
297
297
  Use `--json` for machine-readable output. `works get`, `works stats`, and `works download` also accept `cohub://works/<username>/<space>/<work>` mention URIs. `works stats` reports total, 24-hour, 7-day, and 30-day views with a source breakdown. Download restores newly published file and directory artifacts directly from the CDN with checksum verification. HTML files with companion assets are restored as directory bundles; Board and port Works are not downloadable. The resolve command remains available for explicit slug-based lookup.
298
298
 
299
299
  Realtime rooms use a published Work's runtime identity, so they are available
300
- through `client.work.realtime` in the SDK rather than as CLI commands.
300
+ through `client.app.realtime` in the SDK rather than as CLI commands.
301
301
 
302
302
  ## Drive the Cohub UI
303
303
 
@@ -305,12 +305,12 @@ Show a file or Work preview in the Cohub tab that started the current work, and
305
305
  methods the Work exposes.
306
306
 
307
307
  ```bash
308
- cohub ui preview <workId|url|cohub://works/...|username/space/work|file://path>
309
- cohub ui preview file://src/main.ts
310
- cohub ui preview work://alice/studio/launch
311
- cohub ui preview <work-or-file> --call selection.get
312
- cohub ui preview <work> --call board.focus --data '{"nodeId":"n1"}'
313
- cohub ui preview <work> --call report.build --input payload.json --json
308
+ cohub desktop open <workId|url|cohub://works/...|username/space/work|file://path>
309
+ cohub desktop open file://src/main.ts
310
+ cohub desktop open work://alice/studio/launch
311
+ cohub desktop open <work-or-file> --call selection.get
312
+ cohub desktop open <work> --call board.focus --data '{"nodeId":"n1"}'
313
+ cohub desktop open <work> --call report.build --input payload.json --json
314
314
  ```
315
315
 
316
316
  `ui preview` accepts `file://` Space-relative paths, `work://` Work references, and
@@ -323,7 +323,7 @@ and waits for the Work to complete the same UI command with `client.ui.reportRes
323
323
  Work authors decide what is callable by registering handlers inside the Work:
324
324
 
325
325
  ```ts
326
- client.work.surface.handle("image.open", async (input, { commandId }) => {
326
+ client.app.surface.handle("image.open", async (input, { commandId }) => {
327
327
  openImageStudio(input, commandId);
328
328
  });
329
329
  ```
@@ -267,8 +267,8 @@ export function registerApps(program) {
267
267
  .option("--disabled", "Create as disabled")
268
268
  .option("--status <status>", "App status: published, disabled")
269
269
  .option("--visibility <visibility>", "App visibility: public, space")
270
- .option("--app-scope <scope>", "Scope granted to the app runtime (space.view, session.view, file.view, taskrun.view)", collectOption, [])
271
- .option("--viewer-scope <scope>", "Scope viewers may request (taskrun.view, session.prompt.readonly, session.prompt.fullaccess, generation.create, user.space.list, user.session.list, user.usage.read)", collectOption, [])
270
+ .option("--app-scope <scope>", "Scope granted directly to the app runtime (space.view, session.view, file.view, file.edit, taskrun.view, session.prompt.readonly, session.prompt.fullaccess, command.execute)", collectOption, [])
271
+ .option("--viewer-scope <scope>", "Deprecated: viewer grants are no longer gated by the app configuration", collectOption, [])
272
272
  .option("--meta <json>", "App metadata as a JSON object")
273
273
  .option("--hide-cohub-bar", "Hide the Cohub footer bar on the public app page")
274
274
  .option("--show-cohub-bar", "Show the Cohub footer bar on the public app page")
@@ -346,8 +346,8 @@ export function registerApps(program) {
346
346
  .option("--disabled", "Set status to disabled")
347
347
  .option("--status <status>", "App status: published, disabled")
348
348
  .option("--visibility <visibility>", "App visibility: public, space")
349
- .option("--app-scope <scope>", "Scope granted to the app runtime (space.view, session.view, file.view, taskrun.view)", collectOption, [])
350
- .option("--viewer-scope <scope>", "Scope viewers may request (taskrun.view, session.prompt.readonly, session.prompt.fullaccess, generation.create, user.space.list, user.session.list, user.usage.read)", collectOption, [])
349
+ .option("--app-scope <scope>", "Scope granted directly to the app runtime (space.view, session.view, file.view, file.edit, taskrun.view, session.prompt.readonly, session.prompt.fullaccess, command.execute)", collectOption, [])
350
+ .option("--viewer-scope <scope>", "Deprecated: viewer grants are no longer gated by the app configuration", collectOption, [])
351
351
  .option("--clear-app-scopes", "Clear app runtime scopes")
352
352
  .option("--clear-viewer-scopes", "Clear viewer-requestable scopes")
353
353
  .option("--meta <json>", "App metadata as a JSON object")
@@ -548,6 +548,66 @@ export function registerApps(program) {
548
548
  }
549
549
  });
550
550
  registerAppCommerce(appsCmd);
551
+ // ── Viewer grants ─────────────────────────────────────────────────────────
552
+ appsCmd
553
+ .command("authorize <app>")
554
+ .description("Grant an app scopes as the current user")
555
+ .requiredOption("--scope <scope>", "Scope to grant (repeatable)", collectOption, [])
556
+ .option("--space <spaceId>", "Target space; defaults to the app's own space")
557
+ .option("--json", "Output as JSON")
558
+ .action(async (appRef, opts) => {
559
+ const client = createClient();
560
+ try {
561
+ const detail = await getAppByRef(client, appRef);
562
+ const result = await client.apps.authorize(detail.app.id, {
563
+ scopes: opts.scope,
564
+ ...(opts.space ? { spaceId: opts.space } : {}),
565
+ });
566
+ if (jsonRequested(opts))
567
+ return outJson(result);
568
+ ok(`Granted ${result.grant.scopes.join(", ")} on space ${result.grant.spaceId}`);
569
+ }
570
+ catch (e) {
571
+ handleHttp(e);
572
+ }
573
+ });
574
+ appsCmd
575
+ .command("grants <app>")
576
+ .description("List your grants for an app")
577
+ .option("--json", "Output as JSON")
578
+ .action(async (appRef, opts) => {
579
+ const client = createClient();
580
+ try {
581
+ const detail = await getAppByRef(client, appRef);
582
+ const result = await client.apps.listMyGrants(detail.app.id);
583
+ if (jsonRequested(opts))
584
+ return outJson(result);
585
+ table(result.grants, [
586
+ { key: "id", label: "ID" },
587
+ { key: "spaceId", label: "Space" },
588
+ { key: "scopes", label: "Scopes" },
589
+ { key: "expiresAt", label: "Expires" },
590
+ { key: "revokedAt", label: "Revoked" },
591
+ ]);
592
+ }
593
+ catch (e) {
594
+ handleHttp(e);
595
+ }
596
+ });
597
+ appsCmd
598
+ .command("revoke <app> <grantId>")
599
+ .description("Revoke one of your grants for an app")
600
+ .action(async (appRef, grantId) => {
601
+ const client = createClient();
602
+ try {
603
+ const detail = await getAppByRef(client, appRef);
604
+ await client.apps.revokeMyGrant(detail.app.id, grantId);
605
+ ok("Grant revoked");
606
+ }
607
+ catch (e) {
608
+ handleHttp(e);
609
+ }
610
+ });
551
611
  appsCmd
552
612
  .command("rm <id>")
553
613
  .alias("delete")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neta-art/cohub-cli",
3
- "version": "6.0.1",
3
+ "version": "6.1.1",
4
4
  "description": "CLI for Cohub — spaces, sessions, and agent collaboration.",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -19,7 +19,7 @@
19
19
  "commander": "^15.0.0",
20
20
  "pixi.js": "^8.19.0",
21
21
  "sharp": "^0.35.3",
22
- "@neta-art/cohub": "8.0.1"
22
+ "@neta-art/cohub": "8.2.0"
23
23
  },
24
24
  "publishConfig": {
25
25
  "access": "public"