@hk_net/pi-usage-bars 0.4.0 → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/docs/releasing.md CHANGED
@@ -1,106 +1,84 @@
1
- # Releasing
2
-
3
- This repository uses semantic versions. The package version, changelog heading, Git tag, and npm version must agree.
4
-
5
- The npm publish workflow is manual-only. Pushing a Git tag does not publish the package, which prevents a tag pushed after a local npm release from attempting to publish the same version twice.
6
-
7
- ## Prerequisites
8
-
9
- - Write access to `hknet/pi-usage-bars`.
10
- - Publish access to the npm scope `@hk_net`.
11
- - npm authentication for the `hk_net` account (`npm whoami`).
12
- - Node.js 22.19 or newer.
13
- - Bun 1.3.0. The commands below use a temporary pinned Bun installation, so a global Bun installation is not required.
14
-
15
- Never place an npm token in the repository, command history, or endpoint override. Complete npm's browser or OTP authorization when prompted.
16
-
17
- ## 1. Verify the source release
18
-
19
- From the repository root:
20
-
21
- ```bash
22
- git switch main
23
- git pull --ff-only origin main
24
- git status --short
25
- node -p "require('./package.json').version"
26
- ```
27
-
28
- For this release, the version must be `0.4.0` and the working tree must be clean.
29
-
30
- Run the same checks used by CI and npm's `prepublishOnly` hook:
31
-
32
- ```bash
33
- npx --yes --package bun@1.3.0 -- npm run check
34
- npm audit --omit=dev --audit-level=high
35
- npm pack --dry-run
36
- ```
37
-
38
- Expected results for `0.4.0`:
39
-
40
- - strict TypeScript check passes;
41
- - 32 tests pass;
42
- - Pi smoke test passes;
43
- - production audit has no vulnerabilities;
44
- - the dry-run package is `@hk_net/pi-usage-bars@0.4.0` and contains the extension, documentation, changelog, and license.
45
-
46
- ## 2. Verify npm state
47
-
48
- ```bash
49
- npm whoami
50
- npm view @hk_net/pi-usage-bars version
51
- ```
52
-
53
- Before publishing `0.4.0`, the registry should still report `0.3.0`. If it already reports `0.4.0`, do not publish it again.
54
-
55
- Optionally inspect exactly what npm will receive:
56
-
57
- ```bash
58
- npm pack --dry-run --json
59
- ```
60
-
61
- ## 3. Publish manually
62
-
63
- Local npm publication cannot use GitHub's OIDC provenance attestation, so explicitly disable provenance for this manual release:
64
-
65
- ```bash
66
- npx --yes --package bun@1.3.0 -- \
67
- npm publish --access public --provenance=false
68
- ```
69
-
70
- The `prepublishOnly` hook reruns the complete check. Complete the npm browser/OTP authorization if requested. Do not retry blindly after an ambiguous network failure; verify the registry first.
71
-
72
- ## 4. Verify the published package
73
-
74
- ```bash
75
- npm view @hk_net/pi-usage-bars version dist-tags.latest
76
- npm view @hk_net/pi-usage-bars@0.4.0 dist.integrity
77
- ```
78
-
79
- Both version values should report `0.4.0`, and the integrity field should be present.
80
-
81
- Test installation or update through Pi:
82
-
83
- ```bash
84
- pi install npm:@hk_net/pi-usage-bars
85
- # If it is already installed:
86
- pi update npm:@hk_net/pi-usage-bars
87
- ```
88
-
89
- Restart Pi, or use `/reload`, then run `/usage`.
90
-
91
- ## 5. Tag the verified source
92
-
93
- Only tag after npm verification succeeds:
94
-
95
- ```bash
96
- git switch main
97
- git pull --ff-only origin main
98
- git tag -a v0.4.0 -m "Release v0.4.0"
99
- git push origin v0.4.0
100
- ```
101
-
102
- The tag does not trigger npm publication. It records the exact source corresponding to the already-published package. A GitHub release can then be created from `v0.4.0` using the `0.4.0` changelog section.
103
-
104
- ## CI publishing alternative
105
-
106
- The **Publish to npm (manual)** GitHub Actions workflow remains available as an alternative. It requires the `NPM_TOKEN` repository secret and publishes with npm provenance. Do not run it after publishing the same version locally.
1
+ # Releasing
2
+
3
+ This repository uses semantic versions. The package version, changelog heading, Git tag, and npm version must agree.
4
+
5
+ Local releases use npm staged publishing followed by browser 2FA approval. Browser login only authenticates the CLI; it does not publish or approve a staged package. The GitHub Actions publish workflow is manual-only; pushing a tag does not publish the package.
6
+
7
+ ## Prerequisites
8
+
9
+ - Write access to `hknet/pi-usage-bars`.
10
+ - Publish access to the npm scope `@hk_net`.
11
+ - Node.js 22.19 or newer.
12
+ - A clean, synchronized `main` branch.
13
+
14
+ Never place an npm token in the repository, command history, or endpoint configuration. Complete npm's browser or OTP authorization when prompted.
15
+
16
+ ## Recommended release script
17
+
18
+ From the repository root, provide the exact new semantic version:
19
+
20
+ ```bash
21
+ cd /path/to/pi-usage-bars
22
+ scripts/release.sh X.Y.Z
23
+ ```
24
+
25
+ This **default command only prepares the release**. It deliberately stops before npm login or publication, so the pushed release commit can be reviewed first. The launcher first executes an immutable temporary copy of itself, so editing the script while a release is running cannot corrupt that run.
26
+
27
+ Preparation:
28
+
29
+ 1. verifies that `main` is clean and synchronized with `origin/main`;
30
+ 2. rejects an existing npm version or Git tag;
31
+ 3. updates `package.json` and `package-lock.json` without creating an early tag;
32
+ 4. promotes the `Unreleased` changelog entries into a dated release while preserving an empty `Unreleased` heading;
33
+ 5. installs dependencies with `npm ci --no-audit`, provisions a temporary pinned Bun binary, and runs typecheck, tests, detailed dependency audits, and package dry-run; and
34
+ 6. commits and pushes the release source.
35
+
36
+ After reviewing the prepared commit, stage it for browser approval:
37
+
38
+ ```bash
39
+ scripts/release.sh X.Y.Z stage
40
+ ```
41
+
42
+ `stage` submits the package to npm's staged-publishing queue. It **does not publish live**, does not open a browser, and does not tag Git. If npm authentication is needed, run `npm login --auth-type=web` manually first; this only authenticates the CLI.
43
+
44
+ In [npmjs.com](https://www.npmjs.com), open **Staged Packages**, review the staged tarball, and click **Approve**. npm prompts for 2FA during approval. After npm shows the version as live, finalize the release:
45
+
46
+ ```bash
47
+ scripts/release.sh X.Y.Z finalize
48
+ ```
49
+
50
+ `finalize` refuses to run until the exact version is live in the npm registry. It then verifies registry metadata and creates/pushes the annotated Git tag. It never stages or publishes a package.
51
+
52
+ Use `--yes` only for attended preparation:
53
+
54
+ ```bash
55
+ scripts/release.sh X.Y.Z --yes # prepare only
56
+ ```
57
+
58
+ ## Recovery
59
+
60
+ Staging and finalization are safe to rerun: `stage` refuses if the exact version is already live, and `finalize` refuses until it is live. Never force-push a release tag.
61
+
62
+ The release script first prints a full dependency audit with package names, dependency paths, affected ranges, and available fixes. This is informational because it includes development-only dependencies. It then runs a blocking production-only audit, which rejects high or critical production findings.
63
+
64
+ Show script help with:
65
+
66
+ ```bash
67
+ scripts/release.sh --help
68
+ ```
69
+
70
+ ## Post-release verification
71
+
72
+ Confirm installation through Pi:
73
+
74
+ ```bash
75
+ pi install npm:@hk_net/pi-usage-bars
76
+ # If already installed from npm:
77
+ pi update npm:@hk_net/pi-usage-bars
78
+ ```
79
+
80
+ Restart Pi, or use `/reload`, then run `/usage`.
81
+
82
+ ## GitHub Actions alternative
83
+
84
+ The **Publish to npm (manual)** workflow is available as an alternative. It requires the `NPM_TOKEN` repository secret and publishes with npm provenance. Do not run it after publishing the same version locally.