artshelf 0.10.0 → 0.10.1
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 +15 -0
- package/README.md +8 -6
- package/SPEC.md +15 -6
- package/dist/src/cli.js +20 -4
- package/docs/reference.html +9 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -72,6 +72,21 @@
|
|
|
72
72
|
backward-compatible audit report. The default human renders of these three
|
|
73
73
|
commands now lead each ledger and summary line with a `✓`/`⚠` attention glyph
|
|
74
74
|
(plain Unicode, no color) so redirected output stays clean.
|
|
75
|
+
- Shortened the automatic update-check cache so no-update, failed, missing, or
|
|
76
|
+
null results expire after 1 hour while update-available results keep the
|
|
77
|
+
24-hour TTL, letting newly published releases surface sooner. `artshelf update`
|
|
78
|
+
forces a fresh latest-version check instead of trusting a stale no-update
|
|
79
|
+
cache, `ARTSHELF_NO_UPDATE_CHECK_TTL_MS` overrides the no-update/failed TTL
|
|
80
|
+
(falling back to `ARTSHELF_UPDATE_CHECK_TTL_MS` for compatibility), and a
|
|
81
|
+
non-numeric TTL value falls back to the default instead of disabling expiry.
|
|
82
|
+
|
|
83
|
+
## [0.10.1](https://github.com/calvinnwq/artshelf/compare/artshelf-v0.10.0...artshelf-v0.10.1) (2026-06-12)
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
### Bug Fixes
|
|
87
|
+
|
|
88
|
+
* **cli:** shorten no-update cache TTL for update checks ([d41e49e](https://github.com/calvinnwq/artshelf/commit/d41e49e7d5da02dfaa86fb70eaa7d5e7fb3d543e))
|
|
89
|
+
* **cli:** split update-check cache TTL so new releases surface sooner ([5afcfaa](https://github.com/calvinnwq/artshelf/commit/5afcfaafac4941b71f6a84c694139a64774a1d59))
|
|
75
90
|
|
|
76
91
|
## [0.10.0](https://github.com/calvinnwq/artshelf/compare/artshelf-v0.9.0...artshelf-v0.10.0) (2026-06-12)
|
|
77
92
|
|
package/README.md
CHANGED
|
@@ -62,12 +62,14 @@ install with `npm unlink -g artshelf`.
|
|
|
62
62
|
</details>
|
|
63
63
|
|
|
64
64
|
Artshelf checks npm occasionally and prints a non-blocking notice to stderr when
|
|
65
|
-
a newer published version is available.
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
`
|
|
70
|
-
|
|
65
|
+
a newer published version is available. Available-update results are cached for
|
|
66
|
+
24 hours by default; failed, missing, or no-update results are cached for 1 hour
|
|
67
|
+
so a newly published release is noticed sooner. Run `artshelf update` only for
|
|
68
|
+
npm global installs; it forces a fresh latest-version check before upgrading
|
|
69
|
+
with `npm install -g artshelf@latest`. pnpm global installs should update with
|
|
70
|
+
`pnpm add -g artshelf@latest`, and source installs still update by pulling,
|
|
71
|
+
rebuilding, and linking the checkout. Set `ARTSHELF_NO_UPDATE_CHECK=1` for
|
|
72
|
+
scheduled jobs that must avoid network and update-cache writes.
|
|
71
73
|
|
|
72
74
|
### Recommended agent setup
|
|
73
75
|
|
package/SPEC.md
CHANGED
|
@@ -353,12 +353,17 @@ Rules:
|
|
|
353
353
|
- Read-only command guarantees refer to ledger and artifact mutation; automatic
|
|
354
354
|
update-check cache writes are separate and can be disabled.
|
|
355
355
|
- Update notices must never pollute JSON stdout.
|
|
356
|
-
- Automatic checks cache
|
|
357
|
-
`~/.artshelf/update-check.json` by default
|
|
356
|
+
- Automatic checks cache latest-version lookups at
|
|
357
|
+
`~/.artshelf/update-check.json` by default. Cached update-available results
|
|
358
|
+
(`latest > current`) keep the long 24-hour TTL; cached no-update, failed,
|
|
359
|
+
missing, or null results use a shorter 1-hour TTL so newly published releases
|
|
360
|
+
are noticed sooner.
|
|
358
361
|
- `ARTSHELF_NO_UPDATE_CHECK=1` disables automatic checks for scheduled jobs,
|
|
359
362
|
tests, and no-network environments.
|
|
360
363
|
- `ARTSHELF_UPDATE_CACHE` overrides the update-cache path,
|
|
361
|
-
`ARTSHELF_UPDATE_CHECK_TTL_MS` overrides the cache TTL,
|
|
364
|
+
`ARTSHELF_UPDATE_CHECK_TTL_MS` overrides the update-available cache TTL,
|
|
365
|
+
`ARTSHELF_NO_UPDATE_CHECK_TTL_MS` overrides the no-update/failed cache TTL
|
|
366
|
+
(falling back to `ARTSHELF_UPDATE_CHECK_TTL_MS` for compatibility), and
|
|
362
367
|
`ARTSHELF_NPM_REGISTRY_URL` overrides the npm latest-version endpoint.
|
|
363
368
|
- `ARTSHELF_LATEST_VERSION` overrides the discovered latest version for tests.
|
|
364
369
|
- `ARTSHELF_UPDATE_DRY_RUN=1` makes `artshelf update` report the npm command it
|
|
@@ -541,9 +546,13 @@ V1 also supports a user-level registry of known ledgers:
|
|
|
541
546
|
overrides it for tests and controlled runs; legacy `SHELF_NOW` is read only
|
|
542
547
|
when `ARTSHELF_NOW` is unset.
|
|
543
548
|
- Automatic npm update checks cache their latest-version result at
|
|
544
|
-
`~/.artshelf/update-check.json` by default.
|
|
545
|
-
|
|
546
|
-
|
|
549
|
+
`~/.artshelf/update-check.json` by default. Cached update-available results
|
|
550
|
+
use the long 24-hour TTL; cached no-update, failed, missing, or null results
|
|
551
|
+
use a shorter 1-hour TTL. `ARTSHELF_NO_UPDATE_CHECK=1` disables automatic
|
|
552
|
+
checks, `ARTSHELF_UPDATE_CACHE` overrides the cache path,
|
|
553
|
+
`ARTSHELF_UPDATE_CHECK_TTL_MS` overrides the update-available TTL, and
|
|
554
|
+
`ARTSHELF_NO_UPDATE_CHECK_TTL_MS` overrides the no-update/failed TTL
|
|
555
|
+
(falling back to `ARTSHELF_UPDATE_CHECK_TTL_MS` for compatibility).
|
|
547
556
|
- `put` registers the ledger it writes to.
|
|
548
557
|
- `ledgers add` registers an existing ledger explicitly.
|
|
549
558
|
- `--all` reads registered ledgers as one review surface.
|
package/dist/src/cli.js
CHANGED
|
@@ -9,6 +9,7 @@ const VERSION = readPackageVersion();
|
|
|
9
9
|
const PACKAGE_NAME = "artshelf";
|
|
10
10
|
const NPM_REGISTRY_URL = process.env.ARTSHELF_NPM_REGISTRY_URL ?? `https://registry.npmjs.org/${PACKAGE_NAME}/latest`;
|
|
11
11
|
const UPDATE_CHECK_TTL_MS = 24 * 60 * 60 * 1000;
|
|
12
|
+
const NO_UPDATE_CHECK_TTL_MS = 60 * 60 * 1000;
|
|
12
13
|
const BOOLEAN_FLAGS = new Set(["all", "json", "agent", "manual-review", "dry-run", "execute", "help", "version", "plain"]);
|
|
13
14
|
const VALUE_FLAGS = new Set([
|
|
14
15
|
"cleanup",
|
|
@@ -1015,26 +1016,41 @@ async function getLatestVersion(options) {
|
|
|
1015
1016
|
return latest;
|
|
1016
1017
|
}
|
|
1017
1018
|
function readUpdateCache() {
|
|
1018
|
-
const ttl = Number(process.env.ARTSHELF_UPDATE_CHECK_TTL_MS ?? UPDATE_CHECK_TTL_MS);
|
|
1019
|
-
if (ttl < 0)
|
|
1020
|
-
return null;
|
|
1021
1019
|
const cachePath = updateCachePath();
|
|
1022
1020
|
if (!existsSync(cachePath))
|
|
1023
1021
|
return null;
|
|
1024
1022
|
try {
|
|
1025
1023
|
const cache = JSON.parse(readFileSync(cachePath, "utf8"));
|
|
1024
|
+
if (!("latest" in cache))
|
|
1025
|
+
cache.latest = null;
|
|
1026
1026
|
if (cache.latest !== null && typeof cache.latest !== "string")
|
|
1027
1027
|
return null;
|
|
1028
1028
|
if (typeof cache.checkedAt !== "number")
|
|
1029
1029
|
return null;
|
|
1030
|
+
const latest = cache.latest === null ? null : normalizeVersion(cache.latest);
|
|
1031
|
+
const ttl = updateCacheTtlFor(latest);
|
|
1032
|
+
if (ttl < 0)
|
|
1033
|
+
return null;
|
|
1030
1034
|
if (Date.now() - cache.checkedAt > ttl)
|
|
1031
1035
|
return null;
|
|
1032
|
-
return { latest
|
|
1036
|
+
return { latest };
|
|
1033
1037
|
}
|
|
1034
1038
|
catch {
|
|
1035
1039
|
return null;
|
|
1036
1040
|
}
|
|
1037
1041
|
}
|
|
1042
|
+
function updateCacheTtlFor(latest) {
|
|
1043
|
+
if (latest && compareVersions(latest, VERSION) > 0) {
|
|
1044
|
+
return resolveTtlMs(process.env.ARTSHELF_UPDATE_CHECK_TTL_MS, UPDATE_CHECK_TTL_MS);
|
|
1045
|
+
}
|
|
1046
|
+
return resolveTtlMs(process.env.ARTSHELF_NO_UPDATE_CHECK_TTL_MS ?? process.env.ARTSHELF_UPDATE_CHECK_TTL_MS, NO_UPDATE_CHECK_TTL_MS);
|
|
1047
|
+
}
|
|
1048
|
+
function resolveTtlMs(value, fallback) {
|
|
1049
|
+
if (value === undefined)
|
|
1050
|
+
return fallback;
|
|
1051
|
+
const parsed = Number(value);
|
|
1052
|
+
return Number.isFinite(parsed) ? parsed : fallback;
|
|
1053
|
+
}
|
|
1038
1054
|
function writeUpdateCache(latest) {
|
|
1039
1055
|
try {
|
|
1040
1056
|
const cachePath = updateCachePath();
|
package/docs/reference.html
CHANGED
|
@@ -148,7 +148,10 @@ artshelf update [--json]</code></pre>
|
|
|
148
148
|
only. pnpm global installs should update with
|
|
149
149
|
<code>pnpm add -g artshelf@latest</code>. Source installs should update by
|
|
150
150
|
pulling, rebuilding, and linking the checkout. Notices are cached in
|
|
151
|
-
<code>~/.artshelf/update-check.json</code
|
|
151
|
+
<code>~/.artshelf/update-check.json</code>: update-available results use
|
|
152
|
+
the long 24-hour TTL, while no-update, failed, missing, or null results
|
|
153
|
+
use a shorter 1-hour TTL so newly published releases are noticed sooner.
|
|
154
|
+
<code>artshelf update</code> forces a fresh latest-version check. Set
|
|
152
155
|
<code>ARTSHELF_NO_UPDATE_CHECK=1</code> to disable automatic checks for
|
|
153
156
|
no-network scripts and scheduled jobs. Read-only command labels refer
|
|
154
157
|
to ledger and artifact mutation, not this optional update-check cache.
|
|
@@ -261,7 +264,8 @@ artshelf trash purge --execute --plan-id <id> [--ledger <path>] [--j
|
|
|
261
264
|
<tr><td>ARTSHELF_NOW</td><td>override current time for retention and due calculations</td></tr>
|
|
262
265
|
<tr><td>ARTSHELF_NO_UPDATE_CHECK=1</td><td>disable automatic npm update checks</td></tr>
|
|
263
266
|
<tr><td>ARTSHELF_UPDATE_CACHE</td><td>override the update-check cache path</td></tr>
|
|
264
|
-
<tr><td>ARTSHELF_UPDATE_CHECK_TTL_MS</td><td>override the update-
|
|
267
|
+
<tr><td>ARTSHELF_UPDATE_CHECK_TTL_MS</td><td>override the update-available cache TTL; also acts as the no-update TTL fallback for compatibility</td></tr>
|
|
268
|
+
<tr><td>ARTSHELF_NO_UPDATE_CHECK_TTL_MS</td><td>override the no-update/failed cache TTL specifically</td></tr>
|
|
265
269
|
<tr><td>ARTSHELF_NPM_REGISTRY_URL</td><td>override the npm latest-version endpoint</td></tr>
|
|
266
270
|
<tr><td>ARTSHELF_UPDATE_DRY_RUN=1</td><td>print the npm update command without running it</td></tr>
|
|
267
271
|
<tr><td>ARTSHELF_LATEST_VERSION</td><td>override the latest-version value for tests</td></tr>
|
|
@@ -290,7 +294,9 @@ artshelf trash purge --execute --plan-id <id> [--ledger <path>] [--j
|
|
|
290
294
|
<code>~/.artshelf/ledgers.json</code> is the discovery index for <code>--all</code>
|
|
291
295
|
review, status, cleanup dry-run, and trash-list; project records stay in their own
|
|
292
296
|
repo-local ledgers. Automatic update checks cache their last npm result at
|
|
293
|
-
<code>~/.artshelf/update-check.json</code> by default
|
|
297
|
+
<code>~/.artshelf/update-check.json</code> by default, with a long TTL
|
|
298
|
+
for update-available results and a shorter TTL for no-update or failed
|
|
299
|
+
results.
|
|
294
300
|
</p>
|
|
295
301
|
<div class="callout" data-kind="boundary">
|
|
296
302
|
<span class="callout-label">Hard boundary</span>
|