@neta-art/cohub-cli 6.2.0 → 6.2.2

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
@@ -285,9 +285,9 @@ overwrites files; it never deletes existing ones.
285
285
 
286
286
  Confirm before deleting files or directories.
287
287
 
288
- ## Works
288
+ ## Apps
289
289
 
290
- Publish and manage Work entries from a Space workspace. Public Work URLs require a username and a Space slug.
290
+ Publish and manage Apps from a Space workspace. Public App URLs require a username and a Space slug.
291
291
 
292
292
  `--file` and `--dir` take paths relative to the Space workspace — the same paths
293
293
  `spaces files ls` shows, not your local filesystem. To publish local build
@@ -297,51 +297,51 @@ Space-side path.
297
297
  ```bash
298
298
  cohub profile update --username <username>
299
299
  cohub spaces update <spaceId> --slug <space-slug>
300
- cohub -s <spaceId> works ls --json
301
- cohub works get <workId|url|username/space/work> --json
302
- cohub works stats <workId|url|username/space/work>
303
- cohub works download <workId|url|username/space/work> --output <path>
304
- cohub -s <spaceId> works publish demo --file dist/index.html
305
- cohub -s <spaceId> works publish site --dir dist
306
- cohub -s <spaceId> works publish app --port 3000
307
- cohub works publish-version <workId>
308
- cohub works versions <workId> --json
309
- cohub works rm <workId> --yes
300
+ cohub -s <spaceId> apps ls --json
301
+ cohub apps get <appId|url|username/space/app> --json
302
+ cohub apps stats <appId|url|username/space/app>
303
+ cohub apps download <appId|url|username/space/app> --output <path>
304
+ cohub -s <spaceId> apps publish demo --file dist/index.html
305
+ cohub -s <spaceId> apps publish site --dir dist
306
+ cohub -s <spaceId> apps publish app --port 3000
307
+ cohub apps publish-version <appId>
308
+ cohub apps versions <appId> --json
309
+ cohub apps rm <appId> --yes
310
310
  ```
311
311
 
312
- Resolve a published Work by public identity:
312
+ Resolve a published App by public identity:
313
313
 
314
314
  ```bash
315
- cohub works resolve <workSlug> --owner <username> --space-slug <spaceSlug>
315
+ cohub apps resolve <appSlug> --owner <username> --space-slug <spaceSlug>
316
316
  ```
317
317
 
318
- 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.
318
+ Use `--json` for machine-readable output. `apps get`, `apps stats`, and `apps download` also accept `app://<username>/<space>/<app>` mention URIs. `apps 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 apps are not downloadable. The resolve command remains available for explicit slug-based lookup.
319
319
 
320
- Realtime rooms use a published Work's runtime identity, so they are available
320
+ Realtime rooms use a published App's runtime identity, so they are available
321
321
  through `client.app.realtime` in the SDK rather than as CLI commands.
322
322
 
323
323
  ## Drive the Cohub UI
324
324
 
325
- Show a file or Work preview in the Cohub tab that started the current work, and call
326
- methods the Work exposes.
325
+ Show a file or App preview in the Cohub tab that started the current session, and call
326
+ methods the App exposes.
327
327
 
328
328
  ```bash
329
- cohub desktop open <workId|url|cohub://works/...|username/space/work|file://path>
329
+ cohub desktop open <appId|url|app://...|username/space/app|file://path>
330
330
  cohub desktop open file://src/main.ts
331
- cohub desktop open work://alice/studio/launch
332
- cohub desktop open <work-or-file> --call selection.get
333
- cohub desktop open <work> --call board.focus --data '{"nodeId":"n1"}'
334
- cohub desktop open <work> --call report.build --input payload.json --json
331
+ cohub desktop open app://alice/studio/launch
332
+ cohub desktop open <app-or-file> --call selection.get
333
+ cohub desktop open <app> --call board.focus --data '{"nodeId":"n1"}'
334
+ cohub desktop open <app> --call report.build --input payload.json --json
335
335
  ```
336
336
 
337
- `ui preview` accepts `file://` Space-relative paths, `work://` Work references, and
337
+ `ui preview` accepts `file://` Space-relative paths, `app://` App references, and
338
338
  legacy bare targets. A bare target checks the current Space for a file first, then
339
- falls back to the same Work references as `works get`. Showing a preview is
339
+ falls back to the same App references as `apps get`. Showing a preview is
340
340
  idempotent: repeating it re-activates the same tab and refreshes any launch state
341
- carried by the reference. With `--call`, the command waits for the Work to announce readiness, invokes the method,
342
- and waits for the Work to complete the same UI command with `client.ui.reportResult()`.
341
+ carried by the reference. With `--call`, the command waits for the App to announce readiness, invokes the method,
342
+ and waits for the App to complete the same UI command with `client.ui.reportResult()`.
343
343
 
344
- Work authors decide what is callable by registering handlers inside the Work:
344
+ App authors decide what is callable by registering handlers inside the App:
345
345
 
346
346
  ```ts
347
347
  client.app.surface.handle("image.open", async (input, { commandId }) => {
@@ -349,7 +349,7 @@ client.app.surface.handle("image.open", async (input, { commandId }) => {
349
349
  });
350
350
  ```
351
351
 
352
- A Work answers only a Cohub app origin, so a third-party site that embeds it
352
+ An App answers only a Cohub app origin, so a third-party site that embeds it
353
353
  cannot invoke these methods.
354
354
 
355
355
  Retrying with the same `--command-id` re-delivers the command rather than
@@ -361,7 +361,7 @@ Delivery is at-least-once. Deduplication lives in the receiving tab's memory, so
361
361
  retry that spans a page reload can run a `--call` method a second time. Prefer
362
362
  methods that are safe to repeat.
363
363
 
364
- Commands reach only the frontend instance that originated the current work,
364
+ Commands reach only the frontend instance that originated the current session,
365
365
  resolved from request provenance (`X-Cohub-Source-Client`, propagated into the
366
366
  Sandbox as `COHUB_SOURCE_CLIENT_ID`). They cannot target another user's browser,
367
367
  and offer no DOM access or script evaluation. Pass `--client` to address a
@@ -414,7 +414,7 @@ Confirm before enabling, disabling, or deleting recurring scheduled prompts.
414
414
 
415
415
  Confirm before:
416
416
 
417
- - deleting files, directories, or Works
417
+ - deleting files, directories, or Apps
418
418
  - creating scheduled or recurring prompts with side effects
419
419
  - enabling, disabling, or deleting recurring scheduled prompts
420
420
  - changing access policies, member roles, or membership
package/dist/bootstrap.js CHANGED
@@ -1,35 +1,19 @@
1
1
  #!/usr/bin/env node
2
- import { relaunchCli } from "./launcher.js";
3
- import { ensureCliSelfUpdated } from "./self-update.js";
2
+ import { ensureCliSelfUpdated, SELF_UPDATE_WORKER_ENV, startCliSelfUpdate } from "./self-update.js";
4
3
  const argv = process.argv.slice(2);
5
4
  const isVersionRequest = argv.some((arg) => arg === "-v" || arg === "--version");
6
- let shouldRelaunch = false;
7
- try {
8
- if (!isVersionRequest) {
9
- shouldRelaunch = await ensureCliSelfUpdated() !== "current";
10
- }
11
- }
12
- catch (error) {
13
- const message = error instanceof Error ? error.message : String(error);
14
- process.stderr.write(`cohub self-update failed: ${message}\n`);
15
- process.stderr.write("run with --version to skip self-update\n");
16
- process.exit(1);
17
- }
18
- if (shouldRelaunch) {
19
- const entrypoint = process.argv[1];
20
- if (!entrypoint) {
21
- process.stderr.write("cohub failed to locate its updated entrypoint\n");
22
- process.exit(1);
23
- }
5
+ if (process.env[SELF_UPDATE_WORKER_ENV] === "1") {
24
6
  try {
25
- process.exitCode = await relaunchCli(entrypoint, argv);
7
+ await ensureCliSelfUpdated();
26
8
  }
27
- catch (error) {
28
- const message = error instanceof Error ? error.message : String(error);
29
- process.stderr.write(`cohub failed to launch the updated CLI: ${message}\n`);
30
- process.exitCode = 1;
9
+ catch {
10
+ // Self-update is best effort and must never affect the foreground command.
31
11
  }
12
+ process.exit(0);
32
13
  }
33
- else {
34
- await import("./index.js");
14
+ if (!isVersionRequest) {
15
+ const entrypoint = process.argv[1];
16
+ if (entrypoint)
17
+ process.once("exit", () => startCliSelfUpdate(entrypoint));
35
18
  }
19
+ await import("./index.js");
@@ -161,11 +161,12 @@ function parseRunResult(detail) {
161
161
  exitCode: typeof terminationRecord.exitCode === "number" ? terminationRecord.exitCode : null,
162
162
  ...(typeof terminationRecord.timeoutSecs === "number" ? { timeoutSecs: terminationRecord.timeoutSecs } : {}),
163
163
  ...(typeof terminationRecord.message === "string" ? { message: terminationRecord.message } : {}),
164
+ ...(typeof terminationRecord.outputTruncated === "boolean" ? { outputTruncated: terminationRecord.outputTruncated } : {}),
164
165
  }
165
166
  : undefined,
166
167
  durationMs: typeof result?.durationMs === "number" ? result.durationMs : 0,
167
168
  output: typeof result?.output === "string" ? result.output : "",
168
- truncated: Boolean(result?.truncated),
169
+ truncated: Boolean(result?.truncated) || Boolean(result?.outputTruncated) || Boolean(terminationRecord?.outputTruncated),
169
170
  };
170
171
  }
171
172
  function writeOutput(output) {
@@ -1,3 +1,6 @@
1
+ export declare const SELF_UPDATE_WORKER_ENV = "COHUB_CLI_SELF_UPDATE_WORKER";
1
2
  export type CliSelfUpdateResult = "current" | "updated" | "updated-by-peer";
2
3
  export declare function resolveSelfUpdateResult(beforeVersion: string | undefined, afterVersion: string | undefined, updatedByPeer: boolean): CliSelfUpdateResult;
4
+ export declare const isCliSelfUpdateDue: () => boolean;
5
+ export declare function startCliSelfUpdate(entrypoint: string): void;
3
6
  export declare function ensureCliSelfUpdated(): Promise<CliSelfUpdateResult>;
@@ -3,6 +3,7 @@ import { mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
3
3
  import { homedir } from "node:os";
4
4
  import { dirname, join } from "node:path";
5
5
  const PACKAGE_NAME = "@neta-art/cohub-cli";
6
+ export const SELF_UPDATE_WORKER_ENV = "COHUB_CLI_SELF_UPDATE_WORKER";
6
7
  const DEFAULT_INTERVAL_MS = 6 * 60 * 60 * 1000;
7
8
  const DEFAULT_TIMEOUT_MS = 60_000;
8
9
  const LOCK_STALE_MS = 5 * 60 * 1000;
@@ -55,7 +56,7 @@ export function resolveSelfUpdateResult(beforeVersion, afterVersion, updatedByPe
55
56
  return "current";
56
57
  return updatedByPeer ? "updated-by-peer" : "updated";
57
58
  }
58
- const isDue = () => {
59
+ export const isCliSelfUpdateDue = () => {
59
60
  const state = readState();
60
61
  if (!state.lastUpdatedAt)
61
62
  return true;
@@ -127,10 +128,21 @@ const runNpmUpdate = (timeoutMs) => {
127
128
  });
128
129
  });
129
130
  };
131
+ export function startCliSelfUpdate(entrypoint) {
132
+ if (process.env.COHUB_CLI_AUTO_UPDATE === "0" || !isCliSelfUpdateDue())
133
+ return;
134
+ const worker = spawn(process.execPath, [entrypoint], {
135
+ detached: true,
136
+ env: { ...process.env, [SELF_UPDATE_WORKER_ENV]: "1" },
137
+ stdio: "ignore",
138
+ });
139
+ worker.on("error", () => undefined);
140
+ worker.unref();
141
+ }
130
142
  export async function ensureCliSelfUpdated() {
131
143
  if (process.env.COHUB_CLI_AUTO_UPDATE === "0")
132
144
  return "current";
133
- if (!isDue())
145
+ if (!isCliSelfUpdateDue())
134
146
  return "current";
135
147
  const beforeVersion = readInstalledVersion();
136
148
  const timeoutMs = getTimeoutMs();
@@ -141,7 +153,7 @@ export async function ensureCliSelfUpdated() {
141
153
  try {
142
154
  // Another process may have completed the update while this process was
143
155
  // waiting for the lock.
144
- if (!isDue()) {
156
+ if (!isCliSelfUpdateDue()) {
145
157
  return resolveSelfUpdateResult(beforeVersion, readInstalledVersion(), true);
146
158
  }
147
159
  await runNpmUpdate(timeoutMs);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neta-art/cohub-cli",
3
- "version": "6.2.0",
3
+ "version": "6.2.2",
4
4
  "description": "CLI for Cohub — spaces, sessions, and agent collaboration.",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -15,21 +15,21 @@
15
15
  "NOTICE"
16
16
  ],
17
17
  "dependencies": {
18
- "@neta-art/generation": "^0.1.22",
18
+ "@neta-art/generation": "^0.1.23",
19
19
  "commander": "^15.0.0",
20
- "pixi.js": "^8.19.0",
21
- "sharp": "^0.35.3",
22
- "@neta-art/cohub": "8.5.0"
20
+ "pixi.js": "^8.20.1",
21
+ "sharp": "^0.35.4",
22
+ "@neta-art/cohub": "8.5.1"
23
23
  },
24
24
  "publishConfig": {
25
25
  "access": "public"
26
26
  },
27
27
  "devDependencies": {
28
- "@types/node": "^26.1.1",
28
+ "@types/node": "^26.4.0",
29
29
  "typescript": "^7.0.2"
30
30
  },
31
31
  "optionalDependencies": {
32
- "@napi-rs/canvas": "^1.0.2"
32
+ "@napi-rs/canvas": "^1.0.8"
33
33
  },
34
34
  "scripts": {
35
35
  "build": "tsc -p tsconfig.build.json",