@artifactshare/cli 0.13.0 → 0.13.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/CHANGELOG.md CHANGED
@@ -5,6 +5,18 @@ For user-facing announcements, see https://artifactshare.com/updates?product=cli
5
5
 
6
6
  ## Unreleased
7
7
 
8
+ ## 0.13.2 - 2026-08-30
9
+
10
+ - Define preview startup in the bundled agent skill as one owned long-lived
11
+ process with the ready JSON as its handshake, separating server startup from
12
+ comment waiting and avoiding duplicate launches while startup is unverified.
13
+
14
+ ## 0.13.1 - 2026-08-30
15
+
16
+ - Restore direct `npx @artifactshare/cli ...` invocation after adding the
17
+ Cursor preview executable by exposing `cli` as an alias of the main
18
+ `artifactshare` entrypoint.
19
+
8
20
  ## 0.13.0 - 2026-08-30
9
21
 
10
22
  - Continue local preview work in a managed Cursor ACP conversation, restoring
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@artifactshare/cli",
3
- "version": "0.13.0",
3
+ "version": "0.13.2",
4
4
  "description": "Upload and share HTML, Markdown, folders, and static sites from terminals, AI agents, automation, and CI.",
5
5
  "homepage": "https://artifactshare.com/connect",
6
6
  "repository": {
@@ -21,6 +21,7 @@
21
21
  "type": "module",
22
22
  "sideEffects": false,
23
23
  "bin": {
24
+ "cli": "./dist/index.js",
24
25
  "artifactshare": "./dist/index.js",
25
26
  "artifactshare-preview-cursor": "./dist/cursor-acp-entry.js"
26
27
  },
@@ -4,7 +4,7 @@ description: Share, publish, upload, host, update, open, or read back existing f
4
4
  ---
5
5
 
6
6
  <!-- artifactshare-skill
7
- version: 36
7
+ version: 37
8
8
  managed: true
9
9
  -->
10
10
 
@@ -353,18 +353,41 @@ elements or text selections in the browser and submits them as an explicit
353
353
  batch, and the agent fixes the file. Nothing is uploaded by previewing;
354
354
  an upload happens only if the user opens the share dialog from the page.
355
355
 
356
+ ### Start and own one preview
357
+
358
+ `preview` starts a long-lived local service; process exit is not its success
359
+ condition. Start it once for the file using the environment's supported
360
+ long-running or background process mechanism. Keep that process or task handle
361
+ for the lifetime of the preview.
362
+
356
363
  ```bash
357
364
  npm exec --yes --package=@artifactshare/cli -- artifactshare preview ./lp.html
358
365
  npm exec --yes --package=@artifactshare/cli -- artifactshare preview start ./lp.html --no-open
359
366
  ```
360
367
 
361
- - Internally this runs the `preview start` subcommand (bare `preview <file>`
362
- is rewritten to it). It prints a single ready JSON line with `url` (the
363
- local page), `session` (id for `--session`), `share_origin`, and `reused`
364
- (`true` means an already-live session for the same file was picked up
365
- instead of starting a new server), plus a sanitized `agent` notification
366
- projection, then keeps running until stopped.
368
+ - Run the CLI invocation itself as the long-running task. Do not add shell
369
+ pipelines, redirections, command substitutions, or wrappers that wait for
370
+ output or process exit; output capture managed by the agent's background-task
371
+ tool is part of that tool's contract. Extra shell layers change ownership and
372
+ the service's output contract.
373
+ - Bare `preview <file>` is rewritten to `preview start <file>`. Start prints
374
+ exactly one ready JSON line with `url`, `session`, `share_origin`, `reused`,
375
+ and a sanitized `agent` notification projection, then keeps serving.
367
376
  `--no-open` skips opening the browser.
377
+ - The ready JSON is the startup handshake. A background task id or running PID
378
+ only proves that launch began. Treat the preview as ready, retain its `url`
379
+ and `session`, and tell the user it opened only after reading that line.
380
+ - `session` is generated by start. Use the returned value only with
381
+ `preview next`, `done`, `reply`, or `stop`; do not pass `--session` to start.
382
+ - After one launch begins, do not launch another copy until that attempt either
383
+ returns a CLI failure or exits without a ready line. If the task is still
384
+ running but its ready output cannot be read, the state is indeterminate:
385
+ keep the task, report that startup could not be verified, and ask the user
386
+ how to proceed. Do not infer a preview URL from ports or unrelated processes.
387
+ - A later deliberate start for the same file may return `reused: true`. Its
388
+ ready JSON is a valid handshake, but that invocation exits because the
389
+ original preview process still owns the service. Do not treat the reused
390
+ invocation's task or process handle as the server owner.
368
391
  - Editing and saving the file reloads the page automatically; annotations
369
392
  stay anchored where possible.
370
393
  - `preview next` returns every batch the user has submitted; it is
@@ -397,14 +420,22 @@ Pick the first mode your environment supports:
397
420
  that it started processing. If it remains queued, the session may have
398
421
  ended: use `codex resume`, then run `preview next`. Never copy comments into
399
422
  a queue message; `preview next` is their source of truth.
400
- 2. In Claude Code, use the background-wait path only if
401
- `CLAUDE_CODE_DISABLE_BACKGROUND_TASKS` is neither `1` nor `true`, Bash exposes
402
- `run_in_background`, and starting `preview next --wait 3600` in the
403
- background returns a task ID. End your turn. A submitted batch completes the
404
- command and resumes you; fix the file, report with `preview done`, then arm
405
- one new background wait. If the wait returns `timed_out: true`, do not
406
- re-arm it automatically. If background execution is unavailable or
407
- rejected, use manual pickup and do not describe the session as waiting.
423
+ 2. In Claude Code, if `CLAUDE_CODE_DISABLE_BACKGROUND_TASKS` is neither `1` nor
424
+ `true` and Bash exposes `run_in_background`, run the preview start command
425
+ itself as one Bash background task and read it through Claude Code's
426
+ task-output mechanism until the ready JSON arrives; add no shell pipeline or
427
+ redirection. Keep a non-reused task alive as the server owner. After the
428
+ handshake,
429
+ use the background-wait path only if starting
430
+ `preview next --wait 3600` in a separate background task returns a task ID.
431
+ End your turn. A submitted batch completes the wait and resumes you; fix the
432
+ file, report with `preview done`, then arm one new wait. If the wait returns
433
+ `timed_out: true`, do not re-arm it automatically. If background waiting is
434
+ unavailable or rejected after start, use manual pickup and do not describe
435
+ the session as waiting. If background Bash tasks are unavailable before
436
+ start, ask the user to run and keep the preview command open in their own
437
+ terminal; that user-owned process is the server owner, and comment pickup is
438
+ manual.
408
439
  3. For an Artifact Share-managed Cursor ACP session, start with
409
440
  `npm exec --yes --package=@artifactshare/cli -- artifactshare-preview-cursor <file>`.
410
441
  Run one managed launcher per workspace. The launcher creates or loads the
@@ -4,7 +4,7 @@ alwaysApply: false
4
4
  ---
5
5
 
6
6
  <!-- artifactshare-skill
7
- version: 36
7
+ version: 37
8
8
  managed: true
9
9
  -->
10
10
 
@@ -79,6 +79,6 @@ contain `$`, spaces, `*`, or `?`; use single quotes such as
79
79
  - Manage projects: `projects list --json`, `projects create <name> --json` (uses `default_project_visibility` when saved, otherwise `workspace`; pass `--visibility private` for a confidential project), `projects edit <id>` for name, description, visibility, audience (`--add-email`/`--remove-email`), and archive state (`--archive`/`--unarchive`).
80
80
  - Save a default project with `init --project-id <id> --json`. Preview setup with `init --dry-run --json`.
81
81
  - Manage skills: `skills ensure --tool auto --json` detects Claude Code, Codex, or Cursor and installs or updates user-scope skills; Cursor project scope needs `skills install --tool cursor --scope project --json`. Use `skills install --tool cursor --scope user --json` for the Cursor user-scope skill explicitly. Project scope is opt-in via `skills install --tool <tool> --scope project --json`. `skills update --json` updates installed managed skills; `--force` overwrites unmanaged files on install.
82
- - Preview a local `.md` / `.html` file with `preview <file> --json` (add `--no-open` to keep the browser closed). It is local and needs no sign-in: one ready JSON line (`url` / `session` / `share_origin` / `reused` / sanitized `agent`) is printed and the process keeps serving; saving the file reloads the page. A preview started inside Codex registers the trusted thread UUID and uses `codex queue` for a fixed batch-ready notice; `queued` means accepted, while `preview next` is the first proof of processing. If it remains queued, reopen the session with `codex resume`. In Claude Code, if background tasks are enabled (`CLAUDE_CODE_DISABLE_BACKGROUND_TASKS` is neither `1` nor `true`), Bash exposes `run_in_background`, and the command returns a task ID, arm one background `preview next --wait 3600`; re-arm after `preview done`, but not after `timed_out: true`. If background execution is disabled or rejected, use manual pickup. In Cursor, keep `preview next --wait 90` in the foreground. The user annotates in the browser and submits batches. Fetch them with `preview next [--wait <sec>] [--session <id>]` — non-claiming long poll where `timed_out` / `session_ended` are normal empty results and `preview_session_not_found` means no live session, `preview_request_failed` means the session is alive and rejected the request, and `preview_session_unverified` means the recorded session went silent — retry, then stop the process before `preview stop <file> --force`. Fix the whole batch in one edit, then pipe `{"items":[{"thread","generation","outcome":"fixed|skipped","note"}]}` to `preview done --stdin` (idempotent per generation; results `accepted|stale|already_reported|unknown_thread`; `skipped` needs a note; items with `anchor.state: "orphaned"` are skipped, not re-fixed; the note becomes the thread summary). `preview reply --thread <id> --body <text>` answers without changing state; `preview stop` ends the session and keeps annotations. Never copy comment content into a provider notification; `preview next` is the source of truth. If `preview next` immediately returns the same items again, stop polling and tell the user. Nothing is uploaded unless the user shares from the page.
82
+ - Preview a local `.md` / `.html` file with `preview <file> --json` (add `--no-open` to keep the browser closed). Preview start is a long-lived service, so run the CLI invocation itself once with the environment's long-running/background process mechanism and retain that task or process as its owner; add no shell pipeline, redirection, command substitution, or wrapper that waits for process exit (tool-managed background output capture is fine). The single ready JSON line (`url` / generated `session` / `share_origin` / `reused` / sanitized `agent`) is the startup handshake: a task id or PID alone is not readiness, and `--session` is only for later `next` / `done` / `reply` / `stop`, never start. While one launch is still running without readable ready output, do not launch a second or infer a URL from listening ports; report that startup is unverified and ask the user how to proceed. A `reused: true` handshake is valid, but that invocation exits because the original process remains the server owner; do not treat the reused invocation's handle as ownership. Saving the file reloads the page. A preview started inside Codex registers the trusted thread UUID and uses `codex queue` for a fixed batch-ready notice; `queued` means accepted, while `preview next` is the first proof of processing. If it remains queued, reopen the session with `codex resume`. In Claude Code, only when background tasks are enabled (`CLAUDE_CODE_DISABLE_BACKGROUND_TASKS` is neither `1` nor `true`) and Bash exposes `run_in_background`, run preview start as one Bash background task, read it through Claude Code's task-output mechanism until the ready JSON arrives, and keep a non-reused task alive; then arm `preview next --wait 3600` as a separate background task. Re-arm after `preview done`, but not after `timed_out: true`. If background waiting is disabled or rejected after start, use manual pickup. If background Bash tasks are unavailable before start, ask the user to run and keep preview open in their own terminal; that user-owned process owns the server and pickup is manual. In Cursor, keep `preview next --wait 90` in the foreground. The user annotates in the browser and submits batches. Fetch them with `preview next [--wait <sec>] [--session <id>]` — non-claiming long poll where `timed_out` / `session_ended` are normal empty results and `preview_session_not_found` means no live session, `preview_request_failed` means the session is alive and rejected the request, and `preview_session_unverified` means the recorded session went silent — retry, then stop the process before `preview stop <file> --force`. Fix the whole batch in one edit, then pipe `{"items":[{"thread","generation","outcome":"fixed|skipped","note"}]}` to `preview done --stdin` (idempotent per generation; results `accepted|stale|already_reported|unknown_thread`; `skipped` needs a note; items with `anchor.state: "orphaned"` are skipped, not re-fixed; the note becomes the thread summary). `preview reply --thread <id> --body <text>` answers without changing state; `preview stop` ends the session and keeps annotations. Never copy comment content into a provider notification; `preview next` is the source of truth. If `preview next` immediately returns the same items again, stop polling and tell the user. Nothing is uploaded unless the user shares from the page.
83
83
  - Check the current state with `whoami --json` or `doctor --json` for token storage, authentication, destination, network, upload access, and skill update status.
84
84
  - First-time setup: `npm exec --yes --package=@artifactshare/cli -- artifactshare init --json` detects Claude Code, Codex, or Cursor, installs or updates user-scope skills, and reports the next steps (sign in, then share). For Cursor project scope, run `skills install --tool cursor --scope project --json` explicitly.