@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/CHANGELOG.md +103 -77
- package/LICENSE +21 -21
- package/README.md +127 -126
- package/docs/releasing.md +84 -106
- package/extensions/usage-bars/core.ts +1274 -1240
- package/extensions/usage-bars/index.ts +665 -656
- package/package.json +66 -67
- package/docs/financial-metrics-plan.md +0 -75
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
|
-
|
|
6
|
-
|
|
7
|
-
## Prerequisites
|
|
8
|
-
|
|
9
|
-
- Write access to `hknet/pi-usage-bars`.
|
|
10
|
-
- Publish access to the npm scope `@hk_net`.
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
npm
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
```bash
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
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.
|