artshelf 0.3.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 +103 -0
- package/LICENSE +21 -0
- package/README.md +282 -0
- package/SPEC.md +675 -0
- package/dist/src/cli.js +1149 -0
- package/dist/src/ledger.js +846 -0
- package/dist/src/registry.js +137 -0
- package/dist/src/time.js +71 -0
- package/dist/src/types.js +1 -0
- package/docs/.nojekyll +1 -0
- package/docs/agent-usage.html +325 -0
- package/docs/agent-usage.md +392 -0
- package/docs/index.html +172 -0
- package/docs/install.html +137 -0
- package/docs/quickstart.html +142 -0
- package/docs/reference.html +170 -0
- package/docs/site.css +639 -0
- package/docs/theme.js +42 -0
- package/package.json +56 -0
- package/skills/artshelf/SKILL.md +373 -0
|
@@ -0,0 +1,373 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: artshelf
|
|
3
|
+
description: "Use before any final response, status update, handoff, or done report to check whether created/copied/exported/quarantined/backed-up/preserved non-source files or directories outlive the command; and when registering temporary artifacts, backups, run outputs, debug evidence, daily Artshelf reviews, cleanup plans, trash listings, or trash purge plans with Artshelf."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Artshelf
|
|
7
|
+
|
|
8
|
+
Artshelf is a tiny CLI for accountable temporary artifact retention. Use this
|
|
9
|
+
skill when an agent creates or reviews files that should survive the current
|
|
10
|
+
command but should not be kept forever.
|
|
11
|
+
|
|
12
|
+
Core rule: register artifacts at creation time, while the reason is still
|
|
13
|
+
fresh. Do not infer intent later from filesystem age or path names.
|
|
14
|
+
|
|
15
|
+
## Contract
|
|
16
|
+
|
|
17
|
+
- Mandatory trigger: before final response, handoff, status, or "done"
|
|
18
|
+
reporting, check whether the task created, copied, exported, quarantined,
|
|
19
|
+
backed up, or preserved any non-source file or directory that may outlive the
|
|
20
|
+
current command.
|
|
21
|
+
- Use `artshelf put` for meaningful temporary artifacts, backups, run outputs, and
|
|
22
|
+
debug evidence immediately after the path exists.
|
|
23
|
+
- If an eligible artifact is not registered, record a clear skip reason.
|
|
24
|
+
- Include a clear reason, retention rule, cleanup mode, owner, and useful
|
|
25
|
+
labels.
|
|
26
|
+
- Capture the Artshelf id in handoffs, PRs, issue comments, memory, or run
|
|
27
|
+
summaries when the artifact matters for restart or review.
|
|
28
|
+
- Cleanup execution is approval-only. Read-only review is fine; mutation needs
|
|
29
|
+
a reviewed plan id and explicit human approval.
|
|
30
|
+
|
|
31
|
+
## Register
|
|
32
|
+
|
|
33
|
+
Check the installed CLI first:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
artshelf --version
|
|
37
|
+
artshelf doctor
|
|
38
|
+
artshelf help put
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
If Artshelf is not installed, prefer the package-manager install when available,
|
|
42
|
+
then verify `artshelf --version` and `artshelf doctor`.
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
npm install -g artshelf
|
|
46
|
+
artshelf --version
|
|
47
|
+
artshelf doctor
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
With pnpm:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
pnpm add -g artshelf
|
|
54
|
+
artshelf --version
|
|
55
|
+
artshelf doctor
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
For source installs, ask the user where to clone the repo before making changes.
|
|
59
|
+
Do not hard-code a personal repo path. Clone the repo, build it, run `npm link`,
|
|
60
|
+
then verify `artshelf --version` and `artshelf doctor`. Do not create a custom
|
|
61
|
+
shim.
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
git clone https://github.com/calvinnwq/artshelf.git "$ARTSHELF_REPO"
|
|
65
|
+
cd "$ARTSHELF_REPO"
|
|
66
|
+
corepack enable
|
|
67
|
+
pnpm install --frozen-lockfile
|
|
68
|
+
pnpm run build
|
|
69
|
+
npm link
|
|
70
|
+
artshelf --version
|
|
71
|
+
artshelf doctor
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Common registration:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
artshelf put <path> \
|
|
78
|
+
--reason "<why this exists>" \
|
|
79
|
+
--ttl 3d \
|
|
80
|
+
--kind run-artifact \
|
|
81
|
+
--cleanup review \
|
|
82
|
+
--owner agent \
|
|
83
|
+
--label <project-or-task> \
|
|
84
|
+
--json
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Use `--json` when another tool or handoff needs the entry id.
|
|
88
|
+
|
|
89
|
+
## Lookup
|
|
90
|
+
|
|
91
|
+
Use read-only lookup before `put` when a workflow needs idempotent artifact
|
|
92
|
+
registration:
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
artshelf find --path <path> --owner <agent-or-runtime> --label <task-or-run-id> --json
|
|
96
|
+
artshelf get <id> --json
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
`find` requires at least one selector: `--path`, `--owner`, `--label`, or
|
|
100
|
+
`--status`. Multiple labels must all match. If a matching record already
|
|
101
|
+
exists, reuse its Artshelf id instead of creating a duplicate record.
|
|
102
|
+
|
|
103
|
+
Use the ledger registry when reviewing all known Artshelf state from one entry
|
|
104
|
+
point:
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
artshelf ledgers list --json
|
|
108
|
+
artshelf review --all --json
|
|
109
|
+
artshelf status --all --json
|
|
110
|
+
artshelf find --all --owner <agent-or-runtime> --json
|
|
111
|
+
artshelf trash list --all --json
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
`artshelf ledgers list --json` reports per-ledger validation status
|
|
115
|
+
(ok/missing/invalid) with entry and warning/error counts, so you can detect
|
|
116
|
+
stale registry entries without a separate validate pass; `--plain` skips
|
|
117
|
+
validation. `artshelf review --all --json` adds an aggregate triage summary and the
|
|
118
|
+
next safe action.
|
|
119
|
+
|
|
120
|
+
`put` registers its ledger automatically. For existing project ledgers, register
|
|
121
|
+
them explicitly:
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
artshelf ledgers add --ledger <repo>/.shelf/ledger.jsonl --name <project> --scope repo --json
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
`--all` is for discovery and review. Do not use it as permission to mutate
|
|
128
|
+
files.
|
|
129
|
+
|
|
130
|
+
## Daily Review Workflow
|
|
131
|
+
|
|
132
|
+
Use this flow when a scheduled review, recurring task, or user request asks for
|
|
133
|
+
Artshelf cleanup attention:
|
|
134
|
+
|
|
135
|
+
1. Register artifacts early during work, or state why an eligible artifact was
|
|
136
|
+
skipped.
|
|
137
|
+
2. Review state with read-only commands first:
|
|
138
|
+
`artshelf ledgers list --json`, `artshelf review --all --json`, and
|
|
139
|
+
`artshelf trash list --all --json`; for old trash on a selected ledger, run
|
|
140
|
+
`artshelf trash purge --older-than 7d --dry-run --ledger <ledger-path> --json`.
|
|
141
|
+
3. Present a decision packet instead of raw counts. Include registry health,
|
|
142
|
+
affected ledgers, due/manual-review/missing-path counts, executable entries,
|
|
143
|
+
skipped entries, refused entries, trashed record counts and ages, purge
|
|
144
|
+
dry-run plan ids/skipped entries, and the next safe action.
|
|
145
|
+
4. Classify each candidate:
|
|
146
|
+
- `trash-safe`: disposable after the reviewed plan moves it into Artshelf trash.
|
|
147
|
+
- `needs-human-review`: `cleanup=review`, evidence, backups, reports, or
|
|
148
|
+
anything that should be inspected before closing.
|
|
149
|
+
- `resolve-candidate`: already handled, missing, or no longer needed; use
|
|
150
|
+
`artshelf resolve` only after confirmation.
|
|
151
|
+
- `registry-problem`: stale, missing, or invalid ledger; fix registry health
|
|
152
|
+
before touching artifacts.
|
|
153
|
+
5. If cleanup execution is appropriate, generate or reuse a dry-run plan, then
|
|
154
|
+
ask for explicit approval naming the ledger path and reviewed plan id.
|
|
155
|
+
6. For any `trash-safe` candidates moved by `cleanup=trash`, run `artshelf trash list`
|
|
156
|
+
and then require a separate reviewed purge plan before physical deletion:
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
artshelf trash list --ledger <ledger-path>
|
|
160
|
+
artshelf trash purge --older-than 7d --dry-run --ledger <ledger-path> --json
|
|
161
|
+
artshelf trash purge --execute --plan-id <purge-plan-id> --ledger <ledger-path> --json
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
7. After approved cleanup execute, trash purge, or resolve, verify quiet with
|
|
165
|
+
`artshelf review --all --json`, plus `artshelf trash list --ledger <ledger-path> --json`
|
|
166
|
+
and purge receipt evidence after purge, or explain what remains.
|
|
167
|
+
|
|
168
|
+
Approval wording should be exact:
|
|
169
|
+
|
|
170
|
+
```text
|
|
171
|
+
approve artshelf cleanup ledger <ledger-path> plan <plan-id>
|
|
172
|
+
approve artshelf trash purge ledger <ledger-path> plan <purge-plan-id>
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
Never execute from a read-only preview id. Never generate a fresh plan and
|
|
176
|
+
execute it in the same step. `trash` moves artifacts into Artshelf trash; physical
|
|
177
|
+
deletion requires a separate reviewed trash purge plan.
|
|
178
|
+
|
|
179
|
+
## What To Register
|
|
180
|
+
|
|
181
|
+
Register:
|
|
182
|
+
|
|
183
|
+
- config backups and rollback copies
|
|
184
|
+
- quarantine folders
|
|
185
|
+
- debug output directories
|
|
186
|
+
- generated evidence or reports
|
|
187
|
+
- long-running workflow run artifacts
|
|
188
|
+
- copied files kept for review
|
|
189
|
+
|
|
190
|
+
Skip:
|
|
191
|
+
|
|
192
|
+
- source files that belong in git
|
|
193
|
+
- cheap regenerated build outputs
|
|
194
|
+
- dependency caches
|
|
195
|
+
- artifacts already owned by a durable workflow ledger
|
|
196
|
+
- secrets or credential dumps
|
|
197
|
+
|
|
198
|
+
If you skip an otherwise eligible artifact, report the reason briefly. Examples:
|
|
199
|
+
source-controlled, regeneratable, secret-bearing, already tracked by another
|
|
200
|
+
durable ledger, or user asked not to retain it.
|
|
201
|
+
|
|
202
|
+
## Defaults
|
|
203
|
+
|
|
204
|
+
- `kind=scratch` for temporary working directories.
|
|
205
|
+
- `kind=backup` for rollback copies.
|
|
206
|
+
- `kind=run-artifact` for logs, reports, and generated evidence.
|
|
207
|
+
- `kind=quarantine` for isolated questionable files.
|
|
208
|
+
- `cleanup=review` when judgment is needed later.
|
|
209
|
+
- `cleanup=trash` only when disposal after the retention window is clearly safe.
|
|
210
|
+
- `owner=<agent-or-runtime>` should name the agent, tool, CI job, or human
|
|
211
|
+
process that created the artifact.
|
|
212
|
+
|
|
213
|
+
## Report
|
|
214
|
+
|
|
215
|
+
After registration, include the Artshelf id where the future reader will look:
|
|
216
|
+
|
|
217
|
+
```text
|
|
218
|
+
Artshelf artifact: shf_20260601_182800_ab12, /tmp/parser-output, retain until
|
|
219
|
+
2026-06-04, cleanup=review.
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
## Completion Check
|
|
223
|
+
|
|
224
|
+
Before finalizing a task, review your own file actions:
|
|
225
|
+
|
|
226
|
+
1. Did you create, copy, export, quarantine, back up, or preserve any non-source
|
|
227
|
+
file or directory?
|
|
228
|
+
2. Will any of those paths outlive this command?
|
|
229
|
+
3. If yes, did you register them with Artshelf or state why Artshelf is not
|
|
230
|
+
appropriate?
|
|
231
|
+
|
|
232
|
+
Do not call work done while known eligible artifacts are neither registered nor
|
|
233
|
+
explicitly skipped.
|
|
234
|
+
|
|
235
|
+
## Cleanup
|
|
236
|
+
|
|
237
|
+
Allowed without extra approval because they do not move or delete files:
|
|
238
|
+
|
|
239
|
+
```bash
|
|
240
|
+
artshelf validate --json
|
|
241
|
+
artshelf validate --all --json
|
|
242
|
+
artshelf due --json
|
|
243
|
+
artshelf due --all --json
|
|
244
|
+
artshelf review --all --json
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
Cleanup dry-run is safe to run. It writes plan files for later review only when
|
|
248
|
+
there are executable cleanup entries:
|
|
249
|
+
|
|
250
|
+
```bash
|
|
251
|
+
artshelf cleanup --dry-run --json
|
|
252
|
+
artshelf cleanup --dry-run --all --json
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
Cleanup execution requires explicit approval that names the reviewed plan id:
|
|
256
|
+
|
|
257
|
+
```bash
|
|
258
|
+
artshelf cleanup --execute --plan-id <id>
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
After cleanup execution, trash list and purge dry-run are safe review steps, but
|
|
262
|
+
trash purge execution requires separate human approval naming the ledger and
|
|
263
|
+
reviewed purge plan id:
|
|
264
|
+
|
|
265
|
+
```bash
|
|
266
|
+
artshelf trash list --ledger <ledger-path>
|
|
267
|
+
artshelf trash purge --older-than 7d --dry-run --ledger <ledger-path> --json
|
|
268
|
+
artshelf trash purge --execute --plan-id <purge-plan-id> --ledger <ledger-path> --json
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
No-op dry-runs report `not-created` and do not write plan files.
|
|
272
|
+
Never generate a fresh plan and execute it in the same step.
|
|
273
|
+
Execution writes a receipt and updates touched ledger records to `trashed`,
|
|
274
|
+
`review-required`, or `cleanup-refused`, so handled artifacts stop reappearing in
|
|
275
|
+
future due and dry-run cleanup output.
|
|
276
|
+
Artshelf records generated plans and receipts as `owner=artshelf` artifacts.
|
|
277
|
+
|
|
278
|
+
You may mark a record manually resolved when the user confirms the artifact was
|
|
279
|
+
inspected, is already missing, or is no longer needed:
|
|
280
|
+
|
|
281
|
+
```bash
|
|
282
|
+
artshelf resolve <id> --status resolved --reason <text>
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
Use a specific reason. `resolve` only updates the ledger; it does not move or
|
|
286
|
+
delete files. Resolved records stop reappearing in future due and dry-run
|
|
287
|
+
cleanup output while remaining visible in `artshelf list --status resolved`.
|
|
288
|
+
|
|
289
|
+
## Scheduled Review
|
|
290
|
+
|
|
291
|
+
Agents may schedule routine Artshelf checks for stale artifacts through their host
|
|
292
|
+
runtime, such as an agent cron, CI job, or recurring task. Scheduled jobs are
|
|
293
|
+
review/report only.
|
|
294
|
+
|
|
295
|
+
Allowed in scheduled jobs:
|
|
296
|
+
|
|
297
|
+
```bash
|
|
298
|
+
artshelf validate --json
|
|
299
|
+
artshelf due --json
|
|
300
|
+
artshelf review --all --json
|
|
301
|
+
artshelf cleanup --dry-run --json
|
|
302
|
+
artshelf trash list --ledger <ledger-path> --json
|
|
303
|
+
artshelf trash list --all --json
|
|
304
|
+
artshelf trash purge --older-than 7d --dry-run --ledger <ledger-path> --json
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
Read-only health and dashboard checks are also safe to schedule. Run
|
|
308
|
+
`artshelf review --all --json` for aggregate triage (`summary` and `nextAction`),
|
|
309
|
+
`artshelf doctor --json` to catch a broken or stale registry before relying on
|
|
310
|
+
cleanup planning, and `artshelf status --all --json` for a compact cron summary:
|
|
311
|
+
|
|
312
|
+
```bash
|
|
313
|
+
artshelf doctor --json
|
|
314
|
+
artshelf status --all --json
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
The report should include the ledger path, due/manual-review/missing-path counts,
|
|
318
|
+
cleanup dry-run plan id, executable entries, skipped entries, and refused
|
|
319
|
+
entries. When reporting trash, `artshelf trash list --all --json` may discover trashed
|
|
320
|
+
records across registered ledgers. Include trashed record counts and target ages;
|
|
321
|
+
run purge dry-runs only for an explicit ledger and report any plan id, matching
|
|
322
|
+
entries, and skipped entries. Stay quiet when
|
|
323
|
+
nothing needs attention unless a regular summary was requested.
|
|
324
|
+
|
|
325
|
+
Repeated dry-runs with the same executable cleanup entries reuse the existing
|
|
326
|
+
plan id and refresh that plan file's timestamp instead of creating duplicate
|
|
327
|
+
plans.
|
|
328
|
+
|
|
329
|
+
Use explicit ledger paths for scheduled checks. Do not scan arbitrary filesystem
|
|
330
|
+
locations for ledgers unless the user opted into that discovery scope.
|
|
331
|
+
|
|
332
|
+
Never schedule cleanup execution or trash purge execution. Scheduled jobs may
|
|
333
|
+
only dry-run and report plans for later human review:
|
|
334
|
+
|
|
335
|
+
```bash
|
|
336
|
+
artshelf cleanup --execute --plan-id <id>
|
|
337
|
+
artshelf trash purge --execute --plan-id <id>
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
## Review
|
|
341
|
+
|
|
342
|
+
When asked to review Artshelf state:
|
|
343
|
+
|
|
344
|
+
1. Run `artshelf validate --json`.
|
|
345
|
+
2. Run `artshelf due --json`.
|
|
346
|
+
3. Run `artshelf trash list --json` to surface quarantined artifacts.
|
|
347
|
+
4. If cleanup is requested, run `artshelf cleanup --dry-run --json`.
|
|
348
|
+
5. If old-trash purge review is requested, run
|
|
349
|
+
`artshelf trash purge --older-than <ttl> --dry-run --json` for the explicit
|
|
350
|
+
ledger.
|
|
351
|
+
6. Report plan id, executable entries, skipped entries, refused entries, trashed
|
|
352
|
+
records, and any purge plan id.
|
|
353
|
+
7. Stop before `cleanup --execute` or `trash purge --execute` unless the user
|
|
354
|
+
explicitly approves that reviewed plan id.
|
|
355
|
+
|
|
356
|
+
For a whole-machine Artshelf review, prefer:
|
|
357
|
+
|
|
358
|
+
```bash
|
|
359
|
+
artshelf review --all --json
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
If the user asks for cleanup candidates across projects, run
|
|
363
|
+
`artshelf cleanup --dry-run --all --json` and report each ledger's plan id. Execute
|
|
364
|
+
only a specific reviewed plan against its specific ledger.
|
|
365
|
+
|
|
366
|
+
## Safety
|
|
367
|
+
|
|
368
|
+
- Do not register secrets or credential dumps.
|
|
369
|
+
- Do not use Artshelf as a replacement for git, workflow ledgers, or backups.
|
|
370
|
+
- Do not silently delete files.
|
|
371
|
+
- Do not treat `cleanup=delete` as permission to delete. Cleanup execution
|
|
372
|
+
records `cleanup-refused` with `delete is disabled in v1`; physical deletion
|
|
373
|
+
requires a separate reviewed trash purge plan.
|