@phnx-labs/artifacts-cli 0.4.7 → 0.6.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/CHANGELOG.md +135 -1
- package/README.md +161 -10
- package/dist/cli.d.ts +1 -6
- package/dist/cli.js +100 -88
- package/dist/cli.js.map +1 -1
- package/dist/commands/auth.d.ts +5 -0
- package/dist/commands/auth.js +112 -0
- package/dist/commands/auth.js.map +1 -0
- package/dist/commands/favorite.d.ts +9 -0
- package/dist/commands/favorite.js +59 -0
- package/dist/commands/favorite.js.map +1 -0
- package/dist/commands/share.d.ts +297 -14
- package/dist/commands/share.js +1351 -71
- package/dist/commands/share.js.map +1 -1
- package/dist/lib/browser-detect.d.ts +28 -0
- package/dist/lib/browser-detect.js +126 -0
- package/dist/lib/browser-detect.js.map +1 -0
- package/dist/lib/components.d.ts +23 -0
- package/dist/lib/components.js +44 -0
- package/dist/lib/components.js.map +1 -0
- package/dist/lib/config.d.ts +17 -0
- package/dist/lib/config.js +8 -0
- package/dist/lib/config.js.map +1 -1
- package/dist/lib/embedded-html.d.ts +1 -1
- package/dist/lib/embedded-html.js +14 -0
- package/dist/lib/embedded-html.js.map +1 -1
- package/dist/lib/excerpt.d.ts +48 -0
- package/dist/lib/excerpt.js +167 -0
- package/dist/lib/excerpt.js.map +1 -0
- package/dist/lib/explorer.d.ts +37 -0
- package/dist/lib/explorer.js +166 -0
- package/dist/lib/explorer.js.map +1 -0
- package/dist/lib/favorites.d.ts +73 -0
- package/dist/lib/favorites.js +180 -0
- package/dist/lib/favorites.js.map +1 -0
- package/dist/lib/format.d.ts +2 -0
- package/dist/lib/format.js +14 -0
- package/dist/lib/format.js.map +1 -0
- package/dist/lib/github.d.ts +14 -0
- package/dist/lib/github.js +36 -0
- package/dist/lib/github.js.map +1 -0
- package/dist/lib/header-actions.d.ts +44 -0
- package/dist/lib/header-actions.js +181 -0
- package/dist/lib/header-actions.js.map +1 -0
- package/dist/lib/identity/client.d.ts +49 -0
- package/dist/lib/identity/client.js +97 -0
- package/dist/lib/identity/client.js.map +1 -0
- package/dist/lib/identity/index.d.ts +60 -0
- package/dist/lib/identity/index.js +69 -0
- package/dist/lib/identity/index.js.map +1 -0
- package/dist/lib/link-previews.d.ts +67 -0
- package/dist/lib/link-previews.js +427 -0
- package/dist/lib/link-previews.js.map +1 -0
- package/dist/lib/links.d.ts +2 -0
- package/dist/lib/links.js +21 -2
- package/dist/lib/links.js.map +1 -1
- package/dist/lib/math.d.ts +31 -0
- package/dist/lib/math.js +122 -0
- package/dist/lib/math.js.map +1 -0
- package/dist/lib/metadata-menu.d.ts +15 -0
- package/dist/lib/metadata-menu.js +23 -0
- package/dist/lib/metadata-menu.js.map +1 -1
- package/dist/lib/open.d.ts +6 -0
- package/dist/lib/open.js +54 -0
- package/dist/lib/open.js.map +1 -0
- package/dist/lib/render.d.ts +5 -0
- package/dist/lib/render.js +166 -35
- package/dist/lib/render.js.map +1 -1
- package/dist/lib/revisions.d.ts +17 -0
- package/dist/lib/revisions.js +6 -1
- package/dist/lib/revisions.js.map +1 -1
- package/dist/lib/share/analytics.d.ts +13 -0
- package/dist/lib/share/analytics.js +46 -0
- package/dist/lib/share/analytics.js.map +1 -0
- package/dist/lib/share/backend.d.ts +105 -0
- package/dist/lib/share/backend.js +161 -0
- package/dist/lib/share/backend.js.map +1 -0
- package/dist/lib/share/capture.d.ts +31 -0
- package/dist/lib/share/capture.js +175 -0
- package/dist/lib/share/capture.js.map +1 -0
- package/dist/lib/share/config.d.ts +82 -0
- package/dist/lib/share/config.js +181 -0
- package/dist/lib/share/config.js.map +1 -0
- package/dist/lib/share/delete.d.ts +122 -0
- package/dist/lib/share/delete.js +174 -0
- package/dist/lib/share/delete.js.map +1 -0
- package/dist/lib/share/html.d.ts +22 -0
- package/dist/lib/share/html.js +89 -0
- package/dist/lib/share/html.js.map +1 -0
- package/dist/lib/share/http-error.d.ts +52 -0
- package/dist/lib/share/http-error.js +66 -0
- package/dist/lib/share/http-error.js.map +1 -0
- package/dist/lib/share/og.d.ts +25 -0
- package/dist/lib/share/og.js +85 -0
- package/dist/lib/share/og.js.map +1 -0
- package/dist/lib/share/provision.d.ts +99 -0
- package/dist/lib/share/provision.js +271 -0
- package/dist/lib/share/provision.js.map +1 -0
- package/dist/lib/share/publish.d.ts +393 -0
- package/dist/lib/share/publish.js +829 -0
- package/dist/lib/share/publish.js.map +1 -0
- package/dist/lib/share/qr.d.ts +36 -0
- package/dist/lib/share/qr.js +102 -0
- package/dist/lib/share/qr.js.map +1 -0
- package/dist/lib/share/storage-policy.d.ts +9 -0
- package/dist/lib/share/storage-policy.js +43 -0
- package/dist/lib/share/storage-policy.js.map +1 -0
- package/dist/lib/share/visibility.d.ts +92 -0
- package/dist/lib/share/visibility.js +108 -0
- package/dist/lib/share/visibility.js.map +1 -0
- package/dist/lib/share/worker-template.d.ts +29 -0
- package/dist/lib/share/worker-template.js +2154 -0
- package/dist/lib/share/worker-template.js.map +1 -0
- package/dist/lib/status-list.d.ts +49 -0
- package/dist/lib/status-list.js +153 -0
- package/dist/lib/status-list.js.map +1 -0
- package/dist/lib/validate.js +128 -9
- package/dist/lib/validate.js.map +1 -1
- package/package.json +12 -3
- package/dist/lib/share-provision.d.ts +0 -31
- package/dist/lib/share-provision.js +0 -83
- package/dist/lib/share-provision.js.map +0 -1
- package/dist/lib/share-worker.d.ts +0 -1
- package/dist/lib/share-worker.js +0 -66
- package/dist/lib/share-worker.js.map +0 -1
- package/dist/lib/share.d.ts +0 -39
- package/dist/lib/share.js +0 -159
- package/dist/lib/share.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,140 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## 0.6.0 — 2026-10-04
|
|
4
|
+
|
|
5
|
+
- **Inspectable components from data.** An `explorer` JSON fence renders services,
|
|
6
|
+
modules, findings or stages as expandable rows with optional bars and source
|
|
7
|
+
links. Native controls work offline and by keyboard; printing exposes detail
|
|
8
|
+
and restores the reader's state. Strict validation rejects unknown fields,
|
|
9
|
+
unsafe links and values without an explicit scale. `artifacts components
|
|
10
|
+
[name] [--json]` lists the explorer and existing chart/excerpt/diff/field
|
|
11
|
+
components with examples. Table warnings now ask whether the form fits the
|
|
12
|
+
reading task, rather than automatically preferring tiles.
|
|
13
|
+
|
|
14
|
+
- **Every table warns, files are links, and the `excerpt` fence shows file
|
|
15
|
+
evidence.** `artifacts check` no longer asks a plan for a table; it warns on
|
|
16
|
+
every table with the row and sentence-cell counts and names the visual to
|
|
17
|
+
draw instead (a fenced `bar-chart`, an SVG timeline, matrix, or flow, stat
|
|
18
|
+
tiles, panels), since only the artifact critic's recorded acceptance should
|
|
19
|
+
keep one. A bare `path.ext:NNN` outside a link warns. A new fenced `excerpt`
|
|
20
|
+
block renders a file card: the cited lines with real numbers, the highlighted
|
|
21
|
+
range, the path linked to the commit, and a note. Only a git-tracked file in a
|
|
22
|
+
checkout can be cited, and a file in another checkout only with a `repo=`
|
|
23
|
+
that matches its origin; the checker errors on a missing path or range, an
|
|
24
|
+
untracked or ignored file, a path outside any checkout, or an unnamed
|
|
25
|
+
sibling checkout.
|
|
26
|
+
- **Math.** `$…$` and `\(…\)` inline, `$$…$$` and `\[…\]` display, rendered
|
|
27
|
+
with KaTeX at build time (HTML plus MathML, no script). The KaTeX stylesheet
|
|
28
|
+
and its woff2 fonts are inlined only on pages that contain math, so the
|
|
29
|
+
page stays one self-contained file and every other page is unchanged.
|
|
30
|
+
Inline `$` follows the pandoc rule, so `$5 and $10` is prose; `\$` is a
|
|
31
|
+
literal dollar; math inside code is never touched. KaTeX markup is produced
|
|
32
|
+
after the body sanitizer from placeholders the tokenizer emits, and TeX can
|
|
33
|
+
never inject markup or URLs (`\href` is off).
|
|
34
|
+
- **Citation chips and link previews.** A numbered citation — `[[1]](url)`
|
|
35
|
+
or `[1](url)` — now renders as a pill naming the host with the number as a
|
|
36
|
+
superscript (`arxiv.org¹`) instead of a bare `[1]`. Every outbound pill also
|
|
37
|
+
gets a click preview: at render time the target's title, description, site
|
|
38
|
+
name, and social image URL are fetched once (5s timeout, 512 KB cap, six at
|
|
39
|
+
a time, cached for a week under the artifact history root) and embedded as
|
|
40
|
+
JSON outside the body, so the body revision never changes because a page
|
|
41
|
+
title changed upstream. Clicking a pill opens the card; its "Open" link, or a
|
|
42
|
+
modifier-click on the pill, goes to the page. Pills whose target could not be
|
|
43
|
+
fetched behave exactly as before. Only public hosts are fetched, checked on every redirect
|
|
44
|
+
hop, so an unattended render never pulls a loopback or private-network page
|
|
45
|
+
into an artifact; `ARTIFACTS_LINK_PREVIEWS_ALLOW_PRIVATE=1` lifts that for
|
|
46
|
+
intranet documentation. `--no-link-previews` or
|
|
47
|
+
`ARTIFACTS_NO_LINK_PREVIEWS=1` skips the network entirely.
|
|
48
|
+
- **Status lists.** Lines that open with a status emoji — `✅`, `❌`, `⚠️`,
|
|
49
|
+
`➡️` (and `✔`, `❎`, `✖`, `❗`, `▶`) — render as a list with a coloured state
|
|
50
|
+
icon per line instead of collapsing into one run-on paragraph, whether bare
|
|
51
|
+
or as the items of a bullet list. A line shaped `**Label** - description`
|
|
52
|
+
stacks the label over its description. A bullet list with any non-status
|
|
53
|
+
item, and status lines inside a fence, are left exactly as written.
|
|
54
|
+
- **Syntax highlighting in fenced code.** A fence tagged with a language
|
|
55
|
+
highlight.js's common bundle knows (TypeScript, JavaScript, Bash, JSON, YAML,
|
|
56
|
+
Python, Go, Rust, SQL, HTML/XML, CSS, Markdown, and about thirty more) now
|
|
57
|
+
renders with token colouring on the fixed dark code surface, in both themes,
|
|
58
|
+
with no CDN and no script. Fences with no language, or an unknown one, and
|
|
59
|
+
`diff` fences are rendered exactly as before; nothing is auto-detected.
|
|
60
|
+
- **Operator-configured unlimited share storage.** Setup/update can persist exact
|
|
61
|
+
Phoenix email/domain allowlists that bypass aggregate storage and page-count
|
|
62
|
+
limits while retaining body-size and publish-rate caps. Existing usage remains
|
|
63
|
+
accounted for; missing or unknown ledger plans keep free limits.
|
|
64
|
+
|
|
65
|
+
- **Footer "Created" stamp.** The header only ever shows the latest timestamp,
|
|
66
|
+
so an updated document hid when it was created. The page footer now carries
|
|
67
|
+
the created instant on the right — revision 1's stored time when saved
|
|
68
|
+
history exists, else the frontmatter `created:` stamp, and nothing when no
|
|
69
|
+
created instant was honestly recorded. It relativizes live like the header
|
|
70
|
+
stamp ("Created 2 hours ago") and prints.
|
|
71
|
+
- **Footer QR on shared pages.** `artifacts share` embeds a small QR of the
|
|
72
|
+
exact share URL — including the `?k=` viewer key on `--protected` publishes —
|
|
73
|
+
at the right of the page footer, so a desktop reader can hand the page to a
|
|
74
|
+
phone. The code is a self-contained SVG data URL on a fixed white card
|
|
75
|
+
(scannable in both themes, no CDN, no script), replaced rather than stacked
|
|
76
|
+
on re-publish, and never added to local renders. Opt out with `--no-qr` (or
|
|
77
|
+
the `qr: false` publish option).
|
|
78
|
+
- **Share and Favorite actions in the reader header.** Every rendered artifact's
|
|
79
|
+
header now carries a Share button (owner-only first — `--visibility me`) and a
|
|
80
|
+
Favorite star. Served by `artifacts render --open`, they act through the
|
|
81
|
+
loopback server (`POST /artifacts/share`, `POST /artifacts/favorite`) and
|
|
82
|
+
report the result in place; elsewhere they copy the exact CLI command
|
|
83
|
+
(`artifacts share <id> --visibility me`, `artifacts favorite <id>`), and on an
|
|
84
|
+
already-published page Share becomes a plain copy-link. Commands address the
|
|
85
|
+
artifact by its store id, so no local path enters reader-facing HTML.
|
|
86
|
+
`artifacts share` now accepts a 64-hex artifact id and uploads the latest
|
|
87
|
+
hash-verified snapshot for it.
|
|
88
|
+
- **`artifacts favorite` and `artifacts list`.** A favorites store
|
|
89
|
+
(`favorites.json` beside the revision history, same `ARTIFACTS_HISTORY_DIR`
|
|
90
|
+
override) backs `artifacts favorite <source.md|artifact-id>` (toggle, or
|
|
91
|
+
`--on`/`--off`) and `artifacts list [--favorites] [--json]`, which enumerates
|
|
92
|
+
every artifact the device knows with title, source, and saved dates.
|
|
93
|
+
|
|
94
|
+
## 0.5.0 - 2026-09-06
|
|
95
|
+
|
|
96
|
+
- **Sharing moved in, whole (PHNX-3992).** `artifacts share` was a BYO-only
|
|
97
|
+
uploader; it is now the single home for artifact sharing, with the mature
|
|
98
|
+
managed stack relocated here from agents-cli.
|
|
99
|
+
|
|
100
|
+
- `artifacts auth login` signs this machine in to Phoenix ID with the RFC 8628
|
|
101
|
+
device-code flow. Signed in, `artifacts share <file>` publishes to
|
|
102
|
+
`share.getrush.ai/<handle>/<slug>` with no Cloudflare account, bucket, or
|
|
103
|
+
write token; the handle is your email local-part, first-writer-claimed, and
|
|
104
|
+
`--handle` picks a different one. `artifacts auth whoami` / `logout` round
|
|
105
|
+
it out. Signed out, the existing BYO path is unchanged.
|
|
106
|
+
- **Visibility.** `--visibility public|unlisted|private|me|org`, with
|
|
107
|
+
`--unlisted` (alias `--private`) and `--protected` as direct flags. Public is
|
|
108
|
+
the default: listed in your gallery with an Open Graph cover, so the link
|
|
109
|
+
unfurls into a preview card. `me`/`org` are login-gated by the Worker;
|
|
110
|
+
`unlisted` is an unauthenticated capability URL and now says so loudly before
|
|
111
|
+
publishing; `--protected` is real read-auth — a secret `?k=` key, `404`
|
|
112
|
+
without it. Hidden pages get no cover, and `--no-cover` opts out anywhere.
|
|
113
|
+
- **Managing what you published.** `share list` (with `--scope`/`--all` and
|
|
114
|
+
agent/session/label/meta filters), `share revisions`, `share edit`,
|
|
115
|
+
`share visibility` (in place, same URL, no revision), `share open` (opens
|
|
116
|
+
your page signed in as the owner, so the visibility chip is live), and
|
|
117
|
+
`artifacts unshare` / `share delete`, which take down the cover and retained
|
|
118
|
+
revisions too and verify a `404` before reporting success.
|
|
119
|
+
- **Provenance and safety on every publish.** Agent, session, host, repo, and
|
|
120
|
+
date are captured from the environment when genuinely present and never
|
|
121
|
+
invented; a label is derived from the HTML `<title>`, frontmatter title, or
|
|
122
|
+
filename. The pre-publish scan refuses emails and credential-shaped strings
|
|
123
|
+
in the body, the label, and every `--meta` value unless `--force` is passed.
|
|
124
|
+
Links expire in 30 days by default; `--expire never` opts out.
|
|
125
|
+
- **The Worker.** `src/lib/share/worker-template.ts` — visibility enforcement,
|
|
126
|
+
the gallery and its JSON listing, revision retention, server-side OG card
|
|
127
|
+
rendering, Phoenix bearer verification, per-account quotas — now lives here
|
|
128
|
+
and is deployed by `artifacts share setup` / `artifacts share update`
|
|
129
|
+
(`--check` answers "is a deploy due?" as JSON with no Cloudflare credentials).
|
|
130
|
+
It replaces the BYO-only `src/lib/share-worker.ts`, which is deleted.
|
|
131
|
+
- **The release deploys it.** `scripts/release.sh` runs the template check
|
|
132
|
+
against the just-published version after `npm publish` and redeploys the
|
|
133
|
+
managed Worker when the shipped template changed, so the deployed Worker
|
|
134
|
+
never drifts from the released source. `--deploy-worker=auto|on|off`.
|
|
135
|
+
- `artifacts render --publish` calls the publish path in process instead of
|
|
136
|
+
shelling out to `agents artifacts share`, so rendering no longer depends on
|
|
137
|
+
another CLI being installed.
|
|
4
138
|
|
|
5
139
|
- Compact reader freshness uses "min/mins" and "just now" below a minute.
|
|
6
140
|
Device/session copy icons appear only on hover or keyboard focus, without
|
package/README.md
CHANGED
|
@@ -28,7 +28,8 @@ Write the Markdown, run one command:
|
|
|
28
28
|
artifacts new plan --out plan.md # scaffold; provenance auto-fills
|
|
29
29
|
$EDITOR plan.md # kind + title; plans also need surface
|
|
30
30
|
artifacts render plan.md --open # writes, serves on 127.0.0.1, watches, opens
|
|
31
|
-
artifacts
|
|
31
|
+
artifacts auth login # once per machine, for the managed endpoint
|
|
32
|
+
artifacts share plan.md # publish a public link with a preview card
|
|
32
33
|
```
|
|
33
34
|
|
|
34
35
|
That is the whole surface. Two more when you want them:
|
|
@@ -38,6 +39,42 @@ artifacts new design # project-wide branding (DESIGN.md)
|
|
|
38
39
|
artifacts check plan.md # validate without rendering
|
|
39
40
|
```
|
|
40
41
|
|
|
42
|
+
## Reusable components
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
artifacts components # available names and when to use them
|
|
46
|
+
artifacts components explorer # input contract and copyable example
|
|
47
|
+
artifacts components explorer --json # machine-readable catalogue entry
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Use an `explorer` fence for service → module → evidence, a finding's affected
|
|
51
|
+
paths, or stages with supporting detail. Agents fill in JSON; the compiler
|
|
52
|
+
supplies expandable rows, optional bars, keyboard navigation, responsive styles
|
|
53
|
+
and print expansion. It works as a standalone file, without React, a CDN or a
|
|
54
|
+
running agent. Existing `bar-chart`, `excerpt`, `diff` and worksheet `field`
|
|
55
|
+
components are discoverable through the same catalogue.
|
|
56
|
+
|
|
57
|
+
```explorer
|
|
58
|
+
{
|
|
59
|
+
"title": "Cleanup candidates",
|
|
60
|
+
"metric": {"label": "Estimated removable share", "unit": "%", "max": 100},
|
|
61
|
+
"items": [{
|
|
62
|
+
"label": "Web", "value": 25, "detail": "2,000 of 8,000 lines (illustrative)",
|
|
63
|
+
"children": [{"label": "Legacy editor", "description": "Check remaining callers before removal."}]
|
|
64
|
+
}]
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Strings are plain text. Source links belong to their item as
|
|
69
|
+
`sources: [{"label": "Evidence", "href": "https://…"}]` (or `#section`). Unknown
|
|
70
|
+
fields, missing scales and out-of-range values are errors. See the
|
|
71
|
+
[complete example](examples/explorer.md) and [authoring contract](skills/artifacts/references/authoring.md).
|
|
72
|
+
|
|
73
|
+
The registry/data approach follows `phnx-labs/harness-ui`; its React components
|
|
74
|
+
are not imported. Its chart drill-down emits a live-agent callback, whereas an
|
|
75
|
+
artifact must carry the breakdown with it. This component uses native HTML
|
|
76
|
+
`details` and the existing artifact theme; it does not execute agent actions.
|
|
77
|
+
|
|
41
78
|
## Origin and revision history
|
|
42
79
|
|
|
43
80
|
The header shows the document type, a clickable Created/Updated timestamp,
|
|
@@ -47,6 +84,15 @@ version, and session. Clicking the short session copies the complete UUID.
|
|
|
47
84
|
There is no origin dropdown or visible table of missing fields. Clipboard failure
|
|
48
85
|
exposes selectable text instead of claiming success. Resume remains in Details.
|
|
49
86
|
|
|
87
|
+
The header also carries **Share** and **Favorite** actions. Share is owner-only
|
|
88
|
+
first (`artifacts share <id> --visibility me`): served by `render --open` it
|
|
89
|
+
publishes through the loopback server and copies the resulting link; on a plain
|
|
90
|
+
file:// page it copies the exact command to run; on an already-published page it
|
|
91
|
+
degrades to copying the page's own URL instead of re-sharing. Favorite toggles the
|
|
92
|
+
star through the same loopback channel (persisted to the local store and reflected
|
|
93
|
+
after reload), or copies `artifacts favorite <id>` where no server is present.
|
|
94
|
+
Both address the artifact by its store id, so no local path enters the page.
|
|
95
|
+
|
|
50
96
|
New scaffolds preserve `sessionId`, `harnessVersion`, `hostPlatform`, and
|
|
51
97
|
`hostArch`, and `hostAddress` when this device has an exact-match Tailscale entry
|
|
52
98
|
in the local Agents device registry. No DNS lookup or guessed address is used.
|
|
@@ -83,6 +129,12 @@ Snapshots retain previous content until explicitly removed; they are not pruned
|
|
|
83
129
|
automatically. They are never embedded in, or uploaded alongside, the current HTML.
|
|
84
130
|
The shared page carries only revision numbers/times and local open commands.
|
|
85
131
|
|
|
132
|
+
Favorites live beside the history in `favorites.json` under the same directory.
|
|
133
|
+
`artifacts favorite <source.md|artifact-id>` toggles the star (the header star on a
|
|
134
|
+
served page writes here too), and `artifacts list [--favorites] [--json]` enumerates
|
|
135
|
+
everything the local store knows — id, title, source path, first/last saved dates,
|
|
136
|
+
favorite marker.
|
|
137
|
+
|
|
86
138
|
Validation/storage failures do not replace the previous output. Concurrent renders
|
|
87
139
|
serialize their history writes, and repeated unchanged renders reuse the revision.
|
|
88
140
|
Direct `renderMarkdown()` previews without an output path and imported raw HTML
|
|
@@ -170,16 +222,22 @@ offline brand mark; other hosts try a remote favicon and drop it if load fails.
|
|
|
170
222
|
|
|
171
223
|
## Commands
|
|
172
224
|
|
|
173
|
-
|
|
225
|
+
Ten commands (`share` spans three rows). Everything else is a flag or subcommand on one of them.
|
|
174
226
|
|
|
175
227
|
| Command | Purpose |
|
|
176
228
|
| --- | --- |
|
|
177
229
|
| `artifacts new <plan\|report\|visual\|worksheet\|design> [--out file] [--project name] [--blank] [--stdout]` | Scaffolds an artifact and pre-fills detectable provenance. When the target lands under a committed `.agents/artifacts/` tree it pre-fills anonymized provenance instead (`human: author`, `host: fleet-worker`, no session id) — that directory is published. `project` is detected only when cwd is genuinely inside the project's own checkout (a known `~/.agents/projects/` entry or the git remote's repo name); inside the durable artifact home (`~/.agents/artifacts/`) detection stays empty rather than inventing a name — pass `--project` or fill the frontmatter, and `artifacts check` warns until you do. `--blank` leaves every field empty (an explicit `--project` still pins the project); `--stdout` prints the skeleton without writing; `design` writes a starter `DESIGN.md`; `worksheet` generates a `worksheet_id`. |
|
|
178
230
|
| `artifacts check file.md` | Validates frontmatter metadata, required sections, asset paths, and embedded HTML/SVG safety. |
|
|
179
|
-
| `artifacts render file.md [--out file] [--open] [--no-serve] [--publish]` | Renders Markdown to self-contained HTML next to the source. Local by default: `--publish` additionally publishes it to a durable **private** managed URL and prints the URL plus a terminal QR (every render used to publish, which filled the managed quota with intermediate iterations; `ARTIFACTS_NO_PUBLISH=1` still overrides `--publish`, and the `--open` watch loop re-renders on save but never publishes). `--open` serves on 127.0.0.1, watches the Markdown, and shows it in your browser; `--no-serve` keeps file:// behavior. Embeds the Markdown source for recovery. |
|
|
231
|
+
| `artifacts render file.md [--out file] [--open] [--no-serve] [--publish] [--no-link-previews]` | Renders Markdown to self-contained HTML next to the source. Local by default: `--publish` additionally publishes it to a durable **private** managed URL and prints the URL plus a terminal QR (every render used to publish, which filled the managed quota with intermediate iterations; `ARTIFACTS_NO_PUBLISH=1` still overrides `--publish`, and the `--open` watch loop re-renders on save but never publishes). `--open` serves on 127.0.0.1, watches the Markdown, and shows it in your browser; `--no-serve` keeps file:// behavior. Embeds the Markdown source for recovery. |
|
|
180
232
|
| `artifacts answers <ws.md> [--from file.json] [--json] [--pending]` | Reads or merges a `worksheet`'s answers. No flag prints a filled/pending table; `--json` emits `id → {label, value, state}`; `--pending` filters to pending fields or worksheets; `--from` merges an exported answers file back into the `.md` (id-matched, dirty-only, atomic). A directory scans for worksheets and lists per-file pending counts. |
|
|
181
233
|
| `artifacts notes <file.md\|file.html> [--from sidecar.json] [--json]` | Reads the adjacent `<basename>.notes.json` review sidecar as a table or JSON, or imports an `artifacts.notes.v1` sidecar. |
|
|
182
|
-
| `artifacts
|
|
234
|
+
| `artifacts auth <login\|whoami\|logout>` | Signs this machine in to Phoenix ID, which is what lets `artifacts share` publish to the managed endpoint with no Cloudflare setup. Optional — everything else works signed out. |
|
|
235
|
+
| `artifacts share file.md [--slug slug] [--visibility level] [--unlisted] [--protected] [--no-cover] [--no-qr] [--expire spec] [--label text] [--meta k=v] [--json]` | Renders Markdown when needed and publishes it — managed when signed in, otherwise your own R2/Worker. Public by default, with an OG cover. The published page's footer carries a small QR of the exact share URL (including the `?k=` key on `--protected`), so a desktop reader can hand the page to a phone; `--no-qr` skips it. The URL slug is derived from the artifact title (filename for title-less files); `--slug` overrides it. Re-sharing the same title updates the same URL and keeps the replaced version as a revision. See [Sharing](#sharing). |
|
|
236
|
+
| `artifacts share <list\|revisions\|edit\|visibility\|open\|status\|analytics>` | Inspect and manage what you have published: the listing, retained revisions, label/metadata edits, in-place visibility changes, and an owner-authenticated browser open. |
|
|
237
|
+
| `artifacts share <setup\|join\|update>` | Provision your own Cloudflare endpoint, adopt an existing one, or redeploy the current Worker template to one you already have (`--check` answers "is a deploy due?" without credentials). |
|
|
238
|
+
| `artifacts unshare <targets...>` | Alias of `artifacts share delete`. Takes a page down along with its OG cover and retained revisions, and verifies it `404`s before reporting success. |
|
|
239
|
+
| `artifacts favorite <source.md\|artifact-id> [--on\|--off] [--json]` | Toggles an artifact's favorite flag in the local store (the header star on a served page writes the same store). |
|
|
240
|
+
| `artifacts list [--favorites] [--json]` | Lists artifacts known to this device — id, title, source, created/updated dates, favorite marker. `--favorites` filters to starred. |
|
|
183
241
|
|
|
184
242
|
### Internal commands
|
|
185
243
|
|
|
@@ -288,6 +346,8 @@ That example is a **90.4% authoring-token reduction** when the alternative is ha
|
|
|
288
346
|
|
|
289
347
|
Write links as ordinary Markdown. Every outbound `http(s)` link in the body renders as a **link pill**: the source's brand mark (GitHub, Linear, Jira, Notion, GitLab, Bitbucket, Asana, Trello, Slack, Figma) or its favicon, followed by the link text, in a bordered, clickable container. No HTML to hand-write.
|
|
290
348
|
|
|
349
|
+
Body links render as pills. A numbered citation (`[[1]](url)`) shows the host with the number as a superscript. Every outbound pill gets a click preview card whose title, description, and site name are fetched once at render time (5s timeout, 512 KB cap, cached for a week in the artifact history directory) and embedded as JSON outside the body, so previews never change the body revision. The card's Open link, or a modifier-click on the pill, goes to the page; a pill whose target could not be fetched opens directly. Only public hosts are fetched, on every redirect hop, so a render never pulls a loopback or private-network page into an artifact; set `ARTIFACTS_LINK_PREVIEWS_ALLOW_PRIVATE=1` for intranet documentation. `--no-link-previews` or `ARTIFACTS_NO_LINK_PREVIEWS=1` skips the fetch for offline renders.
|
|
350
|
+
|
|
291
351
|
```markdown
|
|
292
352
|
See [the merge guard](https://github.com/phnx-labs/agents-cli/pull/1914) for context.
|
|
293
353
|
Ticket: [RUSH-2513](https://linear.app/phnx/issue/RUSH-2513/version-drift)
|
|
@@ -399,20 +459,111 @@ file.md --open` and use the browser's own print dialog.
|
|
|
399
459
|
|
|
400
460
|
## Sharing
|
|
401
461
|
|
|
402
|
-
|
|
462
|
+
A share is a single object behind a Cloudflare Worker in front of R2. There are
|
|
463
|
+
two ways to reach one, and you pick by signing in or not.
|
|
403
464
|
|
|
404
|
-
|
|
465
|
+
### Managed — sign in, publish, done
|
|
405
466
|
|
|
406
467
|
```bash
|
|
407
|
-
artifacts
|
|
468
|
+
artifacts auth login # device-code sign-in in your browser
|
|
469
|
+
artifacts share plan.md # https://share.getrush.ai/<handle>/<slug>
|
|
408
470
|
```
|
|
409
471
|
|
|
410
|
-
|
|
472
|
+
No Cloudflare account, bucket, or write token. The URL namespace is your handle,
|
|
473
|
+
the local-part of the signed-in email (`--handle <name>` publishes under a
|
|
474
|
+
different one; the first account to write a handle claims it). The session lives
|
|
475
|
+
in `~/.artifacts/phoenix-session.json`; `artifacts auth logout` clears this
|
|
476
|
+
machine only, and `PHOENIX_ID_BASE` points the CLI at a different backend.
|
|
477
|
+
|
|
478
|
+
### Bring your own Cloudflare
|
|
411
479
|
|
|
412
480
|
```bash
|
|
481
|
+
artifacts share setup --token "$CLOUDFLARE_API_TOKEN" --account "$CLOUDFLARE_ACCOUNT_ID"
|
|
413
482
|
artifacts share join https://artifacts-share.example.workers.dev --token "$WRITE_TOKEN"
|
|
414
483
|
```
|
|
415
484
|
|
|
416
|
-
|
|
485
|
+
`setup` provisions the bucket, its lifecycle rule, and the Worker, then mints a
|
|
486
|
+
write token; `join` adopts an endpoint someone else provisioned. Both persist to
|
|
487
|
+
`~/.artifacts/config.json`. For ephemeral agents, inject `ARTIFACTS_SHARE_TOKEN`
|
|
488
|
+
(or `SHARE_WRITE_TOKEN`) instead of storing one. Signed in and want BYO anyway?
|
|
489
|
+
`ARTIFACTS_SHARE_BACKEND=byo`.
|
|
490
|
+
|
|
491
|
+
### Visibility
|
|
492
|
+
|
|
493
|
+
A bare `artifacts share <file>` is **public**: listed in your gallery, with an
|
|
494
|
+
Open Graph cover so the link unfurls into a preview card in Slack, iMessage,
|
|
495
|
+
Twitter, and Discord. Narrow it with one flag:
|
|
496
|
+
|
|
497
|
+
| Flag | What the link is |
|
|
498
|
+
| --- | --- |
|
|
499
|
+
| *(none)* | `public` — listed, OG cover, indexable |
|
|
500
|
+
| `--visibility me` | owner-only; anyone else gets a login gate (needs a session) |
|
|
501
|
+
| `--visibility org` | everyone at your signed-in email domain (needs a session) |
|
|
502
|
+
| `--unlisted` (alias `--private`) | a capability URL: hidden from the gallery, `noindex`, **still world-readable by anyone holding it** |
|
|
503
|
+
| `--protected` | token-gated: the URL carries a secret `?k=` key and GET returns `404` without it |
|
|
504
|
+
|
|
505
|
+
`me` and `org` are refused on a BYO endpoint — there is no signed-in owner to
|
|
506
|
+
gate on. `--no-cover` skips the OG image; hidden visibilities never get one.
|
|
507
|
+
Published HTML pages embed a footer QR of the exact share URL by default — on
|
|
508
|
+
`--protected` pages it encodes the full `?k=` URL, since the page `404`s
|
|
509
|
+
without it — and `--no-qr` opts out.
|
|
510
|
+
|
|
511
|
+
Links expire in 30 days by default so an accidental publish decays; `--expire
|
|
512
|
+
never` for a permanent one. Before every publish the file body, the label, and
|
|
513
|
+
every `--meta` value are scanned for email addresses and credential-shaped
|
|
514
|
+
strings, and the publish is refused unless you pass `--force` — all three are
|
|
515
|
+
world-readable on a public page.
|
|
516
|
+
|
|
517
|
+
### Managing what you published
|
|
518
|
+
|
|
519
|
+
```bash
|
|
520
|
+
artifacts share list --all # every page, including hidden ones
|
|
521
|
+
artifacts share revisions q3-plan # prior versions kept on republish
|
|
522
|
+
artifacts share edit q3-plan --label "Q3" # retitle without republishing
|
|
523
|
+
artifacts share visibility q3-plan me # re-scope in place, same URL
|
|
524
|
+
artifacts share open q3-plan # open it signed in as the owner
|
|
525
|
+
artifacts unshare q3-plan # take it down, cover and revisions too
|
|
526
|
+
```
|
|
527
|
+
|
|
528
|
+
Republishing an existing slug keeps the version it replaces as a retained
|
|
529
|
+
revision (`--no-revision` opts out). A takedown is only reported as successful
|
|
530
|
+
once a follow-up GET returns `404` — R2's delete is idempotent, so `{"ok":true}`
|
|
531
|
+
alone proves nothing.
|
|
532
|
+
|
|
533
|
+
### The Worker
|
|
534
|
+
|
|
535
|
+
**Operator storage policy.** `share setup` and `share update` accept
|
|
536
|
+
`--unlimited-storage '<json>'`, with exact `emails` and `domains` arrays:
|
|
537
|
+
|
|
538
|
+
```sh
|
|
539
|
+
artifacts share update --unlimited-storage '{"emails":[],"domains":["example.org"]}'
|
|
540
|
+
```
|
|
417
541
|
|
|
418
|
-
|
|
542
|
+
The allowlist uses only the email returned by Phoenix authentication or retained
|
|
543
|
+
in a server-signed identity cookie. Entries are trimmed and case-insensitive;
|
|
544
|
+
domains match exactly, with no subdomain, wildcard, Gmail dot, or plus-alias
|
|
545
|
+
expansion. There are no built-in allowed identities. An allowed identity can
|
|
546
|
+
publish beyond the aggregate 200 MiB / 150-page free limits, including when its
|
|
547
|
+
existing usage ledger is full. Accounting continues for pages and retained
|
|
548
|
+
revisions. The 20 MiB request-body cap and 60 publishes per hour still apply.
|
|
549
|
+
Missing/unknown ledger plans remain free; a ledger plan or client identity header
|
|
550
|
+
cannot grant unlimited storage.
|
|
551
|
+
|
|
552
|
+
The operator's endpoint config persists this policy as `share.unlimitedStorage`.
|
|
553
|
+
Every subsequent update reapplies it, including template-current updates, and
|
|
554
|
+
uploads include it in the `SHARE_UNLIMITED_STORAGE` Worker secret binding.
|
|
555
|
+
When the deploying host has no local policy, uploads discover and inherit the
|
|
556
|
+
existing Worker binding. A failed settings read stops the upload, except when
|
|
557
|
+
Cloudflare confirms the Worker does not exist. Pass `'{"emails":[],"domains":[]}'` to revoke all
|
|
558
|
+
exceptions. `--check` reports a supplied policy change without saving or deploying
|
|
559
|
+
it. Missing or malformed Worker bindings grant no exceptions. This policy does
|
|
560
|
+
not change link expiration or the bucket's lifecycle rules.
|
|
561
|
+
|
|
562
|
+
`artifacts share setup` and `artifacts share update` deploy the Worker in
|
|
563
|
+
`src/lib/share/worker-template.ts`, which owns visibility enforcement, the
|
|
564
|
+
gallery, revision retention, OG card rendering, and Phoenix bearer verification.
|
|
565
|
+
`artifacts share status` reports whether your endpoint's deployed template is
|
|
566
|
+
current; `artifacts share update --check --update-json` answers the same
|
|
567
|
+
question as JSON without touching Cloudflare. The release script runs that check
|
|
568
|
+
after publishing and redeploys the managed Worker when the shipped template
|
|
569
|
+
changed, so what is deployed never drifts from what was released.
|
package/dist/cli.d.ts
CHANGED
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { type PublishOptions } from './lib/render.js';
|
|
3
|
-
export
|
|
4
|
-
tryAgents?: (p: string) => boolean;
|
|
5
|
-
osOpen?: (p: string) => void;
|
|
6
|
-
/** Override the probe timeout so a test can assert the fallback quickly. */
|
|
7
|
-
timeoutMs?: number;
|
|
8
|
-
}): void;
|
|
3
|
+
export { openPath } from './lib/open.js';
|
|
9
4
|
export declare function serveArtifact(source: string, out: string, options?: PublishOptions): Promise<{
|
|
10
5
|
url: string;
|
|
11
6
|
close: () => Promise<void>;
|