artshelf 0.7.0 โ†’ 0.8.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 CHANGED
@@ -54,8 +54,17 @@
54
54
  - Added packaged `ArtshelfReviewReport` schema, canonical example files, and a
55
55
  portable renderer script for deterministic agent review reports, plus
56
56
  deterministic footnote guidance for `artshelf put --json` registrations.
57
- - Split the agent docs into Create, Monitor, Review, and Clean workflow pages
58
- backed by shared docs-site chrome, search, and navigation.
57
+ - Split the agent docs into Create, Monitor, Review, Clean, and Purge workflow
58
+ pages backed by shared docs-site chrome, search, and navigation.
59
+ - Added `artshelf update` plus cached npm update notices, with
60
+ `ARTSHELF_NO_UPDATE_CHECK=1` for no-network scheduled jobs.
61
+
62
+ ## [0.8.0](https://github.com/calvinnwq/artshelf/compare/artshelf-v0.7.0...artshelf-v0.8.0) (2026-06-11)
63
+
64
+
65
+ ### Features
66
+
67
+ * **cli:** add update command ([#35](https://github.com/calvinnwq/artshelf/issues/35)) ([c55f689](https://github.com/calvinnwq/artshelf/commit/c55f689d1a58a10430d1ea00a1dea5de408e5ac2))
59
68
 
60
69
  ## [0.7.0](https://github.com/calvinnwq/artshelf/compare/artshelf-v0.6.0...artshelf-v0.7.0) (2026-06-10)
61
70
 
package/README.md CHANGED
@@ -1,51 +1,49 @@
1
- # Artshelf
1
+ <div align="center">
2
2
 
3
- Artshelf is a tiny CLI for putting temporary artifacts, backups, and run outputs
4
- somewhere accountable, with an expiry tag and a cleanup plan.
3
+ # ๐Ÿ—ƒ๏ธ Artshelf
5
4
 
6
- It is built for agents first. Coding agents, workflow runners, and review bots
7
- create files in `tmp/`, repo folders, or backup locations and then lose context.
8
- Artshelf gives them a small, auditable contract: record why an artifact exists
9
- when it is created, monitor the ledgers later, present a review packet, and clean
10
- only from explicit approvals.
5
+ **Accountable retention for the temporary files agents leave behind.**
11
6
 
12
- Artshelf centers on four approval-first workflows: **register a temp artifact** the
13
- moment it is created, **review everything safely** before anything moves,
14
- **approve cleanup safely** from a reviewed plan, and **purge old trash
15
- explicitly** from a separate reviewed plan. The reference sections further down
16
- stay out of the way until you need them.
7
+ [![npm version](https://img.shields.io/npm/v/artshelf.svg)](https://www.npmjs.com/package/artshelf) [![npm downloads](https://img.shields.io/npm/dm/artshelf.svg)](https://www.npmjs.com/package/artshelf) [![CI](https://github.com/calvinnwq/artshelf/actions/workflows/ci.yml/badge.svg)](https://github.com/calvinnwq/artshelf/actions/workflows/ci.yml) [![docs](https://img.shields.io/badge/docs-site-blue.svg)](https://calvinnwq.github.io/artshelf/) [![license](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE) [![X @calvinnwq](https://img.shields.io/badge/X-%40calvinnwq-black?logo=x)](https://x.com/calvinnwq)
17
8
 
18
- ## Status
9
+ [**Docs**](https://calvinnwq.github.io/artshelf/) ยท [Quickstart](#quickstart) ยท [Spec](SPEC.md) ยท [Agent setup](INSTALL.md)
19
10
 
20
- Artshelf is an early v1 MVP. The CLI is distributed under the unscoped
21
- `artshelf` package name. The existing local/source install path remains supported
22
- as a fallback.
11
+ </div>
23
12
 
24
- ## Install
13
+ Agents make a mess. Coding agents, workflow runners, and review bots scatter
14
+ debug dumps, backups, and run outputs across `tmp/` and your repo โ€” then forget
15
+ them. The clutter piles up, and nobody remembers what's safe to delete.
25
16
 
26
- The intended install path is agent-led: ask your agent to install Artshelf,
27
- verify it, install or reference the portable skill, and offer to schedule a
28
- read-only review job in the host runtime. Humans can still run the commands
29
- below directly.
17
+ Artshelf makes that mess accountable. Every artifact is logged with a reason, an
18
+ expiry, and a cleanup plan the moment it's created. Later you review the ledger,
19
+ preview a cleanup, and execute only an approved plan โ€” approval-first, trash
20
+ before delete, `--json` everywhere. No daemon, no surprise deletions, no guessing
21
+ from a filesystem scan.
30
22
 
31
- Install the npm package:
23
+ > **Status:** early v1 MVP, published to npm as the unscoped `artshelf` package.
32
24
 
33
- ```bash
34
- npm install -g artshelf
35
- artshelf --version
36
- artshelf doctor
37
- ```
25
+ ## Quickstart
38
26
 
39
- With pnpm:
27
+ Install globally โ€” all methods end with the same `artshelf` command (requires
28
+ Node.js 22+):
40
29
 
41
30
  ```bash
31
+ # npm
32
+ npm install -g artshelf
33
+
34
+ # pnpm
42
35
  pnpm add -g artshelf
36
+
37
+ # verify
43
38
  artshelf --version
44
39
  artshelf doctor
40
+
41
+ # later, for npm installs
42
+ artshelf update
45
43
  ```
46
44
 
47
- Source install remains the fallback path: clone the repo, build it, and link the
48
- CLI with `npm link`.
45
+ <details>
46
+ <summary>Install from source</summary>
49
47
 
50
48
  ```bash
51
49
  git clone https://github.com/calvinnwq/artshelf.git
@@ -58,200 +56,83 @@ artshelf --version
58
56
  artshelf doctor
59
57
  ```
60
58
 
61
- To remove the linked command later:
62
-
63
- ```bash
64
- npm uninstall -g artshelf
65
- npm unlink -g artshelf
66
- ```
67
-
68
- For agent setup, the agent should prompt before optional integration steps:
69
-
70
- - install CLI from npm, or use a source checkout
71
- - install/copy/reference the whole `skills/artshelf` directory
72
- - register existing project ledgers
73
- - schedule a read-only review job in the host runtime
74
- - choose where review packets should be delivered
75
-
76
- Agents should drive the selected setup steps explicitly and verify with
77
- `artshelf doctor`.
78
-
79
- ## Core Workflows
80
-
81
- Artshelf is built around four approval-first workflows. Start here; the reference
82
- sections below are there when you need them, not before.
83
-
84
- ### 1. Register a temp artifact
85
-
86
- Record an artifact the moment it is created, while the reason is still fresh:
87
-
88
- ```bash
89
- artshelf put tmp/run-output --reason "debug parser output" --ttl 3d --kind scratch --cleanup trash
90
- ```
91
-
92
- Artshelf returns an id. Capture it anywhere restart or cleanup context matters.
93
-
94
- ### 2. Review everything safely
95
-
96
- Inspect the ledger and preview cleanup without moving anything:
97
-
98
- ```bash
99
- artshelf list
100
- artshelf status
101
- artshelf due
102
- artshelf cleanup --dry-run
103
- ```
104
-
105
- Because this example keeps the artifact for three days, an immediate dry-run
106
- reports `not-created` and writes no plan. A dry-run returns a real plan id only
107
- after `due` shows cleanup entries.
108
-
109
- ### 3. Approve cleanup safely
110
-
111
- Execute only from a reviewed plan id, and only after a human approves it:
112
-
113
- ```bash
114
- artshelf cleanup --execute --plan-id plan_20260601_120000_ab12
115
- ```
116
-
117
- There is no auto-execute, no global execute, and no fresh-plan-then-execute
118
- shortcut. Execution writes a receipt and updates the touched ledger records.
119
-
120
- ### 4. Purge old trash explicitly
121
-
122
- Cleanup execution with `cleanup=trash` moves artifacts into Artshelf's local trash
123
- folder. Those trashed records remain discoverable (`artshelf trash list`) for review
124
- and should only be physically removed through a separately reviewed trash purge
125
- plan:
126
-
127
- ```bash
128
- artshelf trash purge --older-than 30d --dry-run --json
129
- artshelf trash purge --execute --plan-id purge_20260601_120000_ab12
130
- ```
131
-
132
- This adds a separate approval boundary between quarantine and destructive deletion.
133
-
134
- ## Ideal Agent Loop
135
-
136
- Agents should use Artshelf as a small lifecycle around their own work:
59
+ `npm link` connects the checkout to your global npm bin, so later rebuilds update
60
+ the command. Remove an npm install with `npm uninstall -g artshelf`; a source
61
+ install with `npm unlink -g artshelf`.
62
+ </details>
137
63
 
138
- 1. **Create**: when a durable temp artifact, backup, debug output, report, or
139
- quarantine folder is created, run lookup-before-put, then `artshelf put`, and
140
- include the Artshelf id in the task summary or handoff.
141
- 2. **Monitor**: run scheduled read-only checks such as `artshelf status --all --json`,
142
- `artshelf review --all --json`, and `artshelf trash list --all --json`.
143
- 3. **Review**: turn attention into a compact `ArtshelfReviewReport` decision
144
- packet with registry health, affected ledgers, grouped candidates, exact
145
- approval targets, and a clear safety line.
146
- 4. **Clean**: after explicit approval for the reviewed ledger and plan id, run
147
- cleanup or resolve, then verify the next review is quiet or explain what
148
- remains.
64
+ Artshelf checks npm occasionally and prints a non-blocking notice to stderr when
65
+ a newer published version is available. Run `artshelf update` only for npm
66
+ global installs; it upgrades with `npm install -g artshelf@latest`. pnpm global
67
+ installs should update with `pnpm add -g artshelf@latest`, and source installs
68
+ still update by pulling, rebuilding, and linking the checkout. Set
69
+ `ARTSHELF_NO_UPDATE_CHECK=1` for scheduled jobs that must avoid network and
70
+ update-cache writes.
149
71
 
150
- ## Explicit Ledgers
72
+ ### Recommended agent setup
151
73
 
152
- By default, Artshelf writes repo-local `.artshelf/ledger.jsonl` inside a git repo and
153
- `~/.artshelf/ledger.jsonl` outside one. Use `--ledger <path>` and an isolated
154
- `--registry <path>` for tests, demos, and unusual workflows:
74
+ Artshelf is agent-operated, so let your agent finish the job. Paste this one line
75
+ into your coding agent:
155
76
 
156
- ```bash
157
- artshelf put /tmp/parser-output --reason "parser fixture" --ttl 1d --ledger /tmp/artshelf-ledger.jsonl --registry /tmp/artshelf-registry.json --json
158
- artshelf list --ledger /tmp/artshelf-ledger.jsonl
77
+ ```text
78
+ Follow the instructions in https://github.com/calvinnwq/artshelf/blob/main/INSTALL.md to set up Artshelf in this workspace.
159
79
  ```
160
80
 
161
- Artshelf also keeps a small global registry of known ledgers at
162
- `~/.artshelf/ledgers.json`. Override it with `--registry <path>` or
163
- `ARTSHELF_REGISTRY`. `put` registers its ledger automatically, and you can
164
- register an existing ledger explicitly:
81
+ It will install the CLI, copy the portable skill (with its bundled review-report
82
+ renderer), register any existing project ledgers, and โ€” only with your approval โ€”
83
+ schedule a **read-only** daily review. Scheduled jobs review and report only;
84
+ cleanup and purge execution always come back to you. See [INSTALL.md](INSTALL.md)
85
+ for the full steps.
165
86
 
166
- ```bash
167
- artshelf ledgers list
168
- artshelf ledgers add --ledger /path/to/repo/.artshelf/ledger.jsonl --name my-repo
169
- ```
87
+ ## How it works
170
88
 
171
- `artshelf ledgers list` validates each registered ledger by default โ€” reporting
172
- ok/missing/invalid status with entry counts, and exiting non-zero when the
173
- registry or any ledger is broken โ€” so it doubles as a stale-entry check. Add
174
- `--plain` for the fast listing that skips validation.
89
+ The whole lifecycle is five steps, and every step that touches files is gated on
90
+ a reviewed plan a human approved:
175
91
 
176
- Use `--all` for one read-only discovery entry point across registered ledgers:
92
+ | Step | What happens | Command |
93
+ |------|--------------|---------|
94
+ | **1. Register** | Record an artifact the moment it is created, while the reason is fresh. Returns an id. | `artshelf put <path> --reason "โ€ฆ" --ttl 3d --kind scratch --cleanup trash` |
95
+ | **2. Monitor** | Read-only checks across all known ledgers โ€” moves nothing. | `artshelf status --all --json` ยท `artshelf due --all` |
96
+ | **3. Review** | Preview a cleanup plan. A real plan id appears only once entries are due. | `artshelf review --all` ยท `artshelf cleanup --dry-run` |
97
+ | **4. Clean** | Execute exactly the reviewed plan id, after approval. Trashes, never deletes. | `artshelf cleanup --execute --plan-id <id>` |
98
+ | **5. Purge** | Permanently remove old trashed artifacts via a *separate* reviewed plan. | `artshelf trash purge --older-than 30d --dry-run` โ†’ `--execute --plan-id <id>` |
177
99
 
178
- ```bash
179
- artshelf review --all --json
180
- artshelf status --all --json
181
- artshelf due --all --json
182
- artshelf trash list --all --json
183
- artshelf find --all --owner <agent-or-runtime> --json
184
- ```
100
+ Trash is the holding area between steps 4 and 5: cleanup quarantines artifacts
101
+ into Artshelf's local trash (`artshelf trash list`), and only a separately
102
+ reviewed purge removes them for good โ€” a second approval boundary before
103
+ destructive deletion.
185
104
 
186
- `artshelf review --all` adds an aggregate triage summary (affected ledgers, due,
187
- manual-review, missing-path, executable, and skipped counts plus preview plan
188
- ids) and states the next safe action, while staying read-only.
105
+ ## Safety model
189
106
 
190
- Use global dry-run cleanup when you want Artshelf to write cleanup plans for
191
- registered ledgers with cleanup entries, without moving files:
107
+ - **Ledger-first**, not filesystem-scan-first โ€” every artifact is a recorded decision.
108
+ - **Dry-run before mutation**, and execute only from a reviewed plan id.
109
+ - **No daemon, no auto-execute, no global execute** โ€” `--all` is read-only or
110
+ dry-run reporting; cleanup and purge refuse it.
111
+ - **No fresh-plan-then-execute shortcut** โ€” review the plan, then run that plan.
112
+ - **Trash before delete** โ€” `cleanup=delete` stays refused; physical deletion
113
+ needs its own reviewed trash purge. No silent deletion, ever.
114
+ - **`--json` on every command**, so agents can act on structured output.
192
115
 
193
- ```bash
194
- artshelf cleanup --dry-run --all --json
195
- ```
116
+ ## Reference
196
117
 
197
- Global execution is intentionally refused. To mutate files, review a dry-run
198
- plan, then execute it against the specific ledger that produced it.
199
- Repeated dry-runs with the same executable cleanup entries reuse the existing
200
- plan id and refresh its timestamp instead of creating duplicate plan files.
201
-
202
- ## Safety Model
203
-
204
- - Ledger-first, not filesystem-scan-first.
205
- - Dry-run before mutation.
206
- - Execute only from a reviewed plan id.
207
- - No daemon or auto-execute path.
208
- - No global execute; cleanup execute and trash purge refuse `--all`.
209
- `--all` is read-only or dry-run reporting only.
210
- - No fresh-plan-then-execute shortcut.
211
- - Trash/review by default, not delete.
212
- - No silent deletion; `cleanup=delete` stays refused, and trash purge needs its own reviewed plan.
213
- - Agent-friendly JSON output from every command.
214
- - Small enough to actually use.
215
-
216
- V1 only moves `cleanup=trash` entries into Artshelf's local trash folder. Entries
217
- marked `cleanup=review` become `review-required`, and `cleanup=delete` is
218
- refused as `cleanup-refused`; physical deletion only happens through a separate
219
- reviewed `artshelf trash purge --execute` plan.
220
-
221
- Dry-run cleanup writes a plan only when there are executable cleanup entries.
222
- No-op dry-runs report `not-created` and avoid writing plan files. When Artshelf does
223
- write a plan, it also records that plan in the ledger as an Artshelf-owned artifact.
224
-
225
- After `cleanup --execute`, Artshelf writes a receipt, records the receipt as a
226
- Artshelf-owned artifact, and updates touched ledger records. Handled records stop
227
- appearing in `due` and later dry-run cleanup plans, while `artshelf list` still
228
- keeps the audit trail visible.
229
-
230
- ## Commands
118
+ <details>
119
+ <summary>All commands</summary>
231
120
 
232
121
  ```bash
233
122
  artshelf put <path> --reason "debug parser output" --ttl 3d --kind scratch
234
- artshelf ledgers list
235
- artshelf ledgers list --plain
123
+ artshelf ledgers list [--plain]
236
124
  artshelf ledgers add --ledger <path>
237
- artshelf list
238
- artshelf list --all
239
- artshelf list --status active
125
+ artshelf list [--all] [--status active]
240
126
  artshelf find --path <path> --owner <agent-or-runtime> --label <task-or-run-id>
241
127
  artshelf find --all --owner <agent-or-runtime>
242
- artshelf get <id>
243
- artshelf get <id> --all
244
- artshelf due
245
- artshelf due --all
246
- artshelf validate
247
- artshelf validate --all
248
- artshelf review
249
- artshelf review --all
128
+ artshelf get <id> [--all]
129
+ artshelf due [--all]
130
+ artshelf validate [--all]
131
+ artshelf review [--all]
132
+ artshelf status [--all]
250
133
  artshelf doctor
251
- artshelf status
252
- artshelf status --all
253
- artshelf cleanup --dry-run
254
- artshelf cleanup --dry-run --all
134
+ artshelf update [--json]
135
+ artshelf cleanup --dry-run [--all]
255
136
  artshelf cleanup --execute --plan-id <id>
256
137
  artshelf trash list [--all] [--ledger <path>] [--json]
257
138
  artshelf trash purge --older-than <ttl> --dry-run [--ledger <path>] [--json]
@@ -259,68 +140,86 @@ artshelf trash purge --execute --plan-id <id> [--ledger <path>] [--json]
259
140
  artshelf resolve <id> --status resolved --reason "inspected and no longer needed"
260
141
  ```
261
142
 
262
- Use `artshelf help` or `artshelf help <command>` for command details. All core
263
- commands support `--json`.
143
+ Use `artshelf help` or `artshelf help <command>` for details. All core commands
144
+ support `--json`.
145
+ </details>
264
146
 
265
- See the [docs site](https://calvinnwq.github.io/artshelf/) for install,
266
- quickstart, agent usage, and CLI reference. The source repo also keeps the
267
- [v1 spec](SPEC.md) and [agent usage guide](docs/agent-usage.md).
147
+ <details>
148
+ <summary>Explicit ledgers and <code>--all</code> discovery</summary>
268
149
 
269
- ## Agent Skill
150
+ By default, Artshelf writes repo-local `.artshelf/ledger.jsonl` inside a git repo
151
+ and `~/.artshelf/ledger.jsonl` outside one. Use `--ledger <path>` and an isolated
152
+ `--registry <path>` for tests, demos, and unusual workflows:
270
153
 
271
- The package includes an agent-facing skill at `skills/artshelf`. Agents
272
- that support local skills can copy or reference this directory to learn when to call
273
- `artshelf put`, how to report deterministic Artshelf footnotes after JSON
274
- registration, why `artshelf find` / `artshelf get` are the read-only idempotency
275
- lookup surface, why `cleanup --execute` requires explicit approval for a
276
- reviewed plan id, how to render dry-run cleanup and trash purge plans as
277
- review-report decision packets, how to review trashed records with
278
- `artshelf trash list` before a separately approved trash purge, and when
279
- `artshelf resolve <id> --status resolved --reason <text>` may mark confirmed
280
- handled, missing, or no-longer-needed records without moving or deleting files.
154
+ ```bash
155
+ artshelf put /tmp/parser-output --reason "parser fixture" --ttl 1d --ledger /tmp/artshelf-ledger.jsonl --registry /tmp/artshelf-registry.json --json
156
+ artshelf list --ledger /tmp/artshelf-ledger.jsonl
157
+ ```
281
158
 
282
- The same skill ships in the npm package alongside
283
- `scripts/render-review-report.mjs`,
159
+ Artshelf keeps a small global registry of known ledgers at
160
+ `~/.artshelf/ledgers.json` (override with `--registry <path>` or
161
+ `ARTSHELF_REGISTRY`). `put` registers its ledger automatically; register an
162
+ existing one with `artshelf ledgers add --ledger <path> --name <project>`.
163
+ `artshelf ledgers list` validates each registered ledger by default (ok/missing/invalid
164
+ status with counts, non-zero exit when broken), so it doubles as a stale-entry
165
+ check; add `--plain` to skip validation.
166
+
167
+ Use `--all` for one read-only discovery entry point across registered ledgers
168
+ (`review`, `status`, `due`, `trash list`, `find`). `artshelf cleanup --dry-run --all`
169
+ writes plans for ledgers with executable entries without moving files. Global
170
+ execution is intentionally refused: to mutate files, review a dry-run plan, then
171
+ execute it against the specific ledger that produced it.
172
+ </details>
173
+
174
+ <details>
175
+ <summary>Agent skill</summary>
176
+
177
+ The package includes an agent-facing skill at `skills/artshelf`. Agents that
178
+ support local skills can copy or reference this directory to learn when to call
179
+ `artshelf put`, how to report deterministic footnotes after JSON registration,
180
+ why `artshelf find` / `artshelf get` are the read-only idempotency lookup surface,
181
+ why `cleanup --execute` requires an approved reviewed plan id, how to render
182
+ dry-run cleanup and trash purge plans as review-report decision packets, and when
183
+ `artshelf resolve <id> --status resolved --reason <text>` may mark a record handled
184
+ without moving or deleting files.
185
+
186
+ The skill ships in the npm package alongside `scripts/render-review-report.mjs`,
284
187
  `schemas/artshelf-review-report.schema.json`, and the canonical
285
- `examples/artshelf-review-report.json` packet. From a source checkout, use the
286
- whole `skills/artshelf` directory directly. Agents should ask where the user
287
- wants Artshelf cloned before installing or linking it.
188
+ `examples/artshelf-review-report.json` packet. Copy the whole `skills/artshelf`
189
+ directory so the renderer, schema, and examples travel together.
190
+ </details>
288
191
 
289
- ## Development
192
+ <details>
193
+ <summary>Development</summary>
290
194
 
291
195
  ```bash
292
196
  pnpm install
293
- pnpm check
294
- ```
295
-
296
- Preview the static docs site locally:
297
-
298
- ```bash
299
- pnpm docs:serve
197
+ pnpm check # build + test
198
+ pnpm docs:serve # preview docs at http://127.0.0.1:8080/
300
199
  ```
301
200
 
302
- Then open <http://127.0.0.1:8080/>.
201
+ Release Please owns version bumps, changelog, tags, and releases. When a Release
202
+ Please PR merges, the release workflow validates with `pnpm check` and publishes
203
+ `artshelf` to npm through npm Trusted Publishing โ€” no long-lived npm token in
204
+ GitHub secrets. During tests or one-off runs, pass both `--ledger <path>` and
205
+ `--registry <path>` to keep entries out of default Artshelf storage.
206
+ </details>
303
207
 
304
- Release Please owns version bumps, changelog updates, tags, and GitHub releases.
305
- When a Release Please PR is merged and a release is created, the release workflow
306
- validates the package with `pnpm check` and publishes `artshelf` to npm through
307
- npm Trusted Publishing. The npm package must have this repository's release
308
- workflow configured as a trusted publisher; no long-lived npm token is expected
309
- in GitHub secrets.
208
+ ## Learn more
310
209
 
311
- During tests or one-off runs, pass both `--ledger <path>` and `--registry <path>`
312
- to keep entries and registry updates out of default Artshelf storage.
210
+ - **[Docs site](https://calvinnwq.github.io/artshelf/)** โ€” install, quickstart, agent usage, and CLI reference.
211
+ - **[v1 spec](SPEC.md)** โ€” the full behavioral contract.
212
+ - **[Agent usage guide](docs/agent-usage.md)** โ€” deeper agent integration notes.
313
213
 
314
214
  ## Contributing
315
215
 
316
216
  Artshelf is small on purpose. Keep new behavior ledger-first, previewable, and
317
217
  covered by tests. See [CONTRIBUTING.md](CONTRIBUTING.md).
318
218
 
319
- ## Support And Security
219
+ ## Support and security
320
220
 
321
221
  Use [GitHub issues](https://github.com/calvinnwq/artshelf/issues) for bugs and
322
- feature ideas. See
323
- [SUPPORT.md](SUPPORT.md) and [SECURITY.md](SECURITY.md).
222
+ feature ideas. See [SUPPORT.md](SUPPORT.md) and [SECURITY.md](SECURITY.md).
324
223
 
325
224
  ## License
326
225
 
package/SPEC.md CHANGED
@@ -284,6 +284,45 @@ ledger exits non-zero. Due entries are normal operational state and do not chang
284
284
  the exit code. With single `--ledger`, a not-yet-created ledger reports empty
285
285
  counts.
286
286
 
287
+ ### `artshelf update`
288
+
289
+ Checks the latest published npm version and, for npm global installs, updates the
290
+ package with npm.
291
+
292
+ ```bash
293
+ artshelf update
294
+ artshelf update --json
295
+ ```
296
+
297
+ Rules:
298
+
299
+ - Normal commands may perform a best-effort npm update check after command
300
+ handling and print a non-blocking notice to stderr when a newer version is
301
+ available.
302
+ - Read-only command guarantees refer to ledger and artifact mutation; automatic
303
+ update-check cache writes are separate and can be disabled.
304
+ - Update notices must never pollute JSON stdout.
305
+ - Automatic checks cache successful and failed latest-version lookups at
306
+ `~/.artshelf/update-check.json` by default, with a 24-hour TTL.
307
+ - `ARTSHELF_NO_UPDATE_CHECK=1` disables automatic checks for scheduled jobs,
308
+ tests, and no-network environments.
309
+ - `ARTSHELF_UPDATE_CACHE` overrides the update-cache path,
310
+ `ARTSHELF_UPDATE_CHECK_TTL_MS` overrides the cache TTL, and
311
+ `ARTSHELF_NPM_REGISTRY_URL` overrides the npm latest-version endpoint.
312
+ - `ARTSHELF_LATEST_VERSION` overrides the discovered latest version for tests.
313
+ - `ARTSHELF_UPDATE_DRY_RUN=1` makes `artshelf update` report the npm command it
314
+ would run without invoking npm.
315
+ - `artshelf update` forces a fresh latest-version check and does not run the
316
+ automatic post-command notice check.
317
+ - If the current version is already current, update exits 0 and reports that no
318
+ update was installed.
319
+ - When an update is available, `artshelf update` runs
320
+ `npm install -g artshelf@latest`; `--json` captures npm stdout/stderr and
321
+ returns npm's exit code.
322
+ - `artshelf update` is for npm global installs only. pnpm global installs should
323
+ use `pnpm add -g artshelf@latest`; source installs should pull, rebuild, and
324
+ link the checkout again.
325
+
287
326
  ### `artshelf cleanup --dry-run`
288
327
 
289
328
  Creates a cleanup plan when there are executable cleanup entries, but does not
@@ -450,6 +489,10 @@ V1 also supports a user-level registry of known ledgers:
450
489
  - Retention and due calculations use wall-clock time by default. `ARTSHELF_NOW`
451
490
  overrides it for tests and controlled runs; legacy `SHELF_NOW` is read only
452
491
  when `ARTSHELF_NOW` is unset.
492
+ - Automatic npm update checks cache their latest-version result at
493
+ `~/.artshelf/update-check.json` by default. `ARTSHELF_NO_UPDATE_CHECK=1`
494
+ disables automatic checks, `ARTSHELF_UPDATE_CACHE` overrides the cache path,
495
+ and `ARTSHELF_UPDATE_CHECK_TTL_MS` overrides the cache TTL.
453
496
  - `put` registers the ledger it writes to.
454
497
  - `ledgers add` registers an existing ledger explicitly.
455
498
  - `--all` reads registered ledgers as one review surface.
@@ -632,6 +675,9 @@ artshelf trash list --all --json
632
675
  artshelf trash purge --older-than <ttl> --dry-run --ledger <path> --json
633
676
  ```
634
677
 
678
+ Set `ARTSHELF_NO_UPDATE_CHECK=1` for scheduled jobs that must avoid npm network
679
+ checks and update-cache writes.
680
+
635
681
  `artshelf review --all --json` is the read-only all-ledger triage surface;
636
682
  scheduled reports should include its aggregate `summary` and `nextAction` when
637
683
  whole-machine review is needed.
@@ -683,6 +729,8 @@ human review.
683
729
  - CLI reports a read-only daily dashboard through `artshelf status`, with
684
730
  `--all --json` suitable for cron and human output short enough to paste into
685
731
  a chat; status never creates plans, receipts, or records.
732
+ - CLI can check for npm package updates, print non-blocking stderr notices, and
733
+ update npm global installs through `artshelf update`.
686
734
  - Cleanup dry-run creates a plan id only when there are executable cleanup
687
735
  entries; no-op dry-runs do not write plan files.
688
736
  - Cleanup dry-run and execute register the plan/receipt artifacts that Artshelf