From 9b54ac7e03b8ba58682381585a7935d19afbb544 Mon Sep 17 00:00:00 2001 From: Pavel Grigorenko Date: Wed, 14 Oct 2026 15:52:11 +0200 Subject: [PATCH 01/11] Rename the package to @unicitylabs/proof-cli --- package-lock.json | 4 ++-- package.json | 16 +++++++++------- src/lib/constants.ts | 5 +++++ 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/package-lock.json b/package-lock.json index cbd7607..1f650c7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,11 +1,11 @@ { - "name": "@unicitylabs/timestamp-cli", + "name": "@unicitylabs/proof-cli", "version": "0.1.2", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "@unicitylabs/timestamp-cli", + "name": "@unicitylabs/proof-cli", "version": "0.1.2", "license": "MIT", "dependencies": { diff --git a/package.json b/package.json index a3dfbf9..6191b9a 100644 --- a/package.json +++ b/package.json @@ -1,10 +1,10 @@ { - "name": "@unicitylabs/timestamp-cli", + "name": "@unicitylabs/proof-cli", "version": "0.1.2", - "description": "Timestamp a SHA-256 hash on the Unicity Network and verify the resulting token offline", + "description": "Create and verify Unicity proofs: certify a SHA-256 hash on the Unicity Network and verify the token offline", "type": "module", "bin": { - "unicity-timestamp": "lib/cli.js" + "unicity-proof": "lib/cli.js" }, "exports": { ".": { @@ -33,22 +33,24 @@ }, "repository": { "type": "git", - "url": "git+https://github.com/unicitynetwork/timestamp-cli.git" + "url": "git+https://github.com/unicitynetwork/proof-cli.git" }, "keywords": [ "unicity", - "timestamp", + "proof", + "attestation", "timestamping", "proof-of-existence", + "agent", "cli" ], "license": "MIT", "publishConfig": { "access": "public" }, - "homepage": "https://github.com/unicitynetwork/timestamp-cli#readme", + "homepage": "https://github.com/unicitynetwork/proof-cli#readme", "bugs": { - "url": "https://github.com/unicitynetwork/timestamp-cli/issues" + "url": "https://github.com/unicitynetwork/proof-cli/issues" }, "engines": { "node": ">=22" diff --git a/src/lib/constants.ts b/src/lib/constants.ts index a5f103f..07f01f6 100644 --- a/src/lib/constants.ts +++ b/src/lib/constants.ts @@ -8,6 +8,11 @@ import { HexConverter } from '@unicitylabs/state-transition-sdk/lib/util/HexConv * reason is its UTF-8 bytes, and it is the domain tag of the payload signature. * It carries no version on purpose: the payload has its own version field, so * this identifier stays stable while the payload format evolves. + * + * It is also not the product name, and must never be changed to match it. + * Renaming it gives every later stamp a different token type, recipient and + * signature domain, and nothing already certified would verify. The CLI is + * `unicity-proof`; the format is `unicity-timestamp` and stays so. */ export const TIMESTAMP_TAG = 'unicity-timestamp'; From c45ef7fd89068ada16a415d39117f9e91247140c Mon Sep 17 00:00:00 2001 From: Pavel Grigorenko Date: Wed, 14 Oct 2026 15:53:31 +0200 Subject: [PATCH 02/11] Correct the migration order and the help assertions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit npm requires a package's `repository` to match, case-sensitively, the repository it publishes with provenance from, so a manifest naming `proof-cli` cannot publish from a repository still named `timestamp-cli`. The repository rename is now step 1 of the migration rather than the last step, which also makes the manifest URLs true at every point in the sequence. A new trusted-publisher configuration has to complete its first successful publish within two days or it expires permanently, so the release step records that window and the configuration step says not to do it until the release is ready. The binding is to the repository's immutable identity, which survives a rename, so the step that re-pointed it afterwards is gone. Restricting token publishing is a separate opt-in and is now listed as one. The plan's help assertion no longer writes the old name into a test file: two later steps grep the tree for that string and expect it absent, so the assertion would have failed checks the plan itself specifies. It asserts the whole usage line instead, and the `--out` default text — which top-level help never carried — gets its own assertion against `keygen --help`. --- docs/plans/2026-10-14-rename-to-proof-cli.md | 78 +++++++++++++---- docs/specs/2026-10-14-rename-to-proof-cli.md | 92 ++++++++++---------- 2 files changed, 109 insertions(+), 61 deletions(-) diff --git a/docs/plans/2026-10-14-rename-to-proof-cli.md b/docs/plans/2026-10-14-rename-to-proof-cli.md index 213b39a..103dafd 100644 --- a/docs/plans/2026-10-14-rename-to-proof-cli.md +++ b/docs/plans/2026-10-14-rename-to-proof-cli.md @@ -127,10 +127,27 @@ git commit -m "Rename the package to @unicitylabs/proof-cli" In `tests/e2e/CliOfflineTest.ts`, add to the existing `prints help and version` test, after the `-v, --version` assertion: ```ts -// The installed command name and the name the help prints have to agree, -// or the help tells the reader to run something not on their PATH. -expect(help.stdout).toContain('unicity-proof'); -expect(help.stdout).not.toContain('unicity-timestamp'); +// The installed command name and the name the help prints have to agree, or +// the help tells the reader to run something that is not on their PATH. The +// whole usage line is asserted rather than a substring, so a stale name cannot +// hide in it — and the old name is deliberately absent from this file, because +// Task 4 and Task 5 grep the tree for it. +expect(help.stdout.split('\n')[0]).toEqual('Usage: unicity-proof [options] [command]'); +``` + +The `--out` default is a separate string in a different help screen, so it gets +its own assertion. Add this test next to the one above: + +```ts +it( + 'names the default key file in the keygen help', + async () => { + const keygenHelp = await runCli(['keygen', '--help'], { cwd }); + expect(keygenHelp.code).toBe(0); + expect(keygenHelp.stdout).toContain('unicity-proof.key'); + }, + TIMEOUT, +); ``` - [ ] **Step 2: Write the failing test for the default key file** @@ -338,9 +355,12 @@ Run: `python3 -c "import yaml,sys; yaml.safe_load(open('.github/workflows/npm.ym Expected: `yaml ok` Run: `grep -rnI 'timestamp-cli\|unicity-timestamp' .github .env.example scripts tests` -Expected: no output. `-I` skips `tests/fixtures/*.cbor`, which carry the tag in -their burn reason by design; without it grep reports them as binary matches and -the check looks failed when it passed. +Expected: no output. Two things make that achievable: `-I` skips +`tests/fixtures/*.cbor`, which carry the tag in their burn reason by design and +would otherwise be reported as binary matches; and Task 2's assertions were +written without the old name in them, so no test file contains it. If this grep +returns a hit inside `tests/`, a test embedded the literal — fix the test +rather than loosening this check. - [ ] **Step 5: Run the suite and lint** @@ -384,7 +404,7 @@ Expected: `OK` twice. These tokens were certified before the rename; this is the - [ ] **Step 3: Confirm the old name survives only where it must** -Run: `grep -rlnI 'unicity-timestamp' src tests README.md | sort` +Run: `grep -rlI 'unicity-timestamp' src tests README.md | sort` Expected exactly these three files: ``` @@ -396,7 +416,8 @@ src/lib/constants.ts Any other file is a missed rename. `-I` is required: the two `tests/fixtures/*.cbor` files contain the tag in their burn reason — which is the whole point of keeping them — and `grep -l` reports binary matches rather -than skipping them, so without `-I` this check can never pass. +than skipping them, so without `-I` this check can never pass. `-l` also +suppresses line numbers, so `-n` is not used here. - [ ] **Step 4: Confirm the package would publish correctly** @@ -470,11 +491,34 @@ gh pr create --title "Rename the CLI to @unicitylabs/proof-cli" --body-file ../p ## Operator steps after merge -These need registry or organisation credentials and are not part of the code change. They are migration steps 2 through 8 of the spec, in order: - -1. `npm version 0.2.0-rc1 --no-git-tag-version`, then `npm publish --access public --tag next`. Discard the local bump. **`--tag next` is required** — npm points `latest` at whatever it publishes, prerelease or not. -2. Configure the new package's trusted publisher: repository as currently named, workflow `npm.yml`, environment `npm-publish`. -3. Run the release workflow with `0.2.0` as the explicit version input. -4. `npm deprecate @unicitylabs/timestamp-cli "Renamed to @unicitylabs/proof-cli"`. -5. Optionally `npm dist-tag rm @unicitylabs/proof-cli next`. -6. Rename the repository on GitHub, then re-point the trusted publisher at the new repository name. +These need registry or organisation credentials and are not part of the code +change. **The repository rename comes first**, because this branch points +`repository`, `homepage` and `bugs` at `unicitynetwork/proof-cli`, and npm +requires a package's `repository` to match, case-sensitively, the repository it +is publishing with provenance from. Publishing from a repository still named +`timestamp-cli` with those URLs in the manifest fails. + +1. Rename the repository on GitHub to `proof-cli`. Organisation admin. Update + the remote in any working copy. +2. Merge this branch. +3. `npm version 0.2.0-rc1 --no-git-tag-version`, then + `npm publish --access public --tag next`. Discard the local bump. + **`--tag next` is required** — npm points `latest` at whatever it publishes, + prerelease or not. +4. Configure the new package's trusted publisher: repository + `unicitynetwork/proof-cli`, workflow `npm.yml`, environment `npm-publish`. +5. Run the release workflow with `0.2.0` as the explicit version input. + **Within two days of step 4.** A new trusted-publisher configuration has to + complete its first successful publish inside that window; after it, the + configuration expires and can no longer be used or edited, and has to be + recreated. Do not configure the publisher until ready to release. +6. `npm deprecate @unicitylabs/timestamp-cli "Renamed to @unicitylabs/proof-cli"`. +7. Optionally `npm dist-tag rm @unicitylabs/proof-cli next`. +8. Optionally restrict token publishing on the new package — npm Settings, + Publishing access, "Require two-factor authentication and disallow tokens". + Configuring a trusted publisher does not do this on its own, and the + bootstrap token from step 3 keeps working until it is done. + +Step 4's binding is to the repository's immutable identity, which survives a +later rename, so re-pointing it is only needed if the repository is renamed +again after the binding is made. diff --git a/docs/specs/2026-10-14-rename-to-proof-cli.md b/docs/specs/2026-10-14-rename-to-proof-cli.md index e360e2c..2f25c92 100644 --- a/docs/specs/2026-10-14-rename-to-proof-cli.md +++ b/docs/specs/2026-10-14-rename-to-proof-cli.md @@ -109,61 +109,64 @@ frozen; `proof` means the product and is free to change. ## Migration -The package rename and the repository rename are separable. The package rename -needs no organisation admin and carries no redirect risk; the repository rename -needs both. The new package needs its own trusted publisher either way — only -its repository value differs — so neither rename avoids that step. - -### Package rename - -npm's trusted publishing cannot create a package name the publisher does not -already own, so one publish has to happen by hand. That publish is a -prerelease whose only purpose is to make the name exist, which keeps the real -0.2.0 on the audited path. - -1. Land the rename. The release workflow owns versions, so the rename commit - carries no bump and stays at 0.1.2. -2. Bootstrap the name by hand: `npm version 0.2.0-rc1 --no-git-tag-version`, +**The repository rename comes first.** npm requires a package's `repository` to +match, case-sensitively, the repository it is publishing with provenance from, +so a manifest naming `unicitynetwork/proof-cli` cannot publish from a repository +still named `timestamp-cli`. The two renames remain separable in principle — a +package rename alone needs no organisation admin, and would keep the old +repository URLs in the manifest — but when both are being done, this is the +order that works. + +1. Rename the repository on GitHub to `proof-cli`. Requires organisation admin. + Update the remote in any working copy. +2. Land the rename: code, docs and workflow strings, reviewed as one change. + The version stays 0.1.2; the release workflow owns the bump. +3. Bootstrap the package name by hand: `npm version 0.2.0-rc1 --no-git-tag-version`, which regenerates `src/version.ts` through the `version` lifecycle script and keeps `VersionTest` green, then `npm publish --access public --tag next`. - Discard the local bump afterwards. + Discard the local bump afterwards. npm's trusted publishing cannot create a + package name the publisher does not already own, so this one publish cannot + come from CI. **`--tag next` is required.** npm points `latest` at whatever it publishes, prerelease or not, so without it a plain `npm install @unicitylabs/proof-cli` would hand everyone a release candidate. The workflow derives the same tag from the version itself; this publish is the one that does not go through it. -3. Configure the new package's trusted publisher: the repository as it is named - at the time, workflow `npm.yml`, environment `npm-publish`. -4. Run the release workflow with `0.2.0` as the explicit version input. It - bumps, builds, tests, publishes to `latest`, pushes the bump with its tag and - creates the release. -5. `npm deprecate @unicitylabs/timestamp-cli "Renamed to @unicitylabs/proof-cli"`. +4. Configure the new package's trusted publisher: repository + `unicitynetwork/proof-cli`, workflow `npm.yml`, environment `npm-publish`. +5. Run the release workflow with `0.2.0` as the explicit version input, **within + two days of step 4**. A new trusted-publisher configuration must complete its + first successful publish inside that window; afterwards it expires and can no + longer be used or edited, and has to be recreated. Do not configure the + publisher until the release is ready to go out. +6. `npm deprecate @unicitylabs/timestamp-cli "Renamed to @unicitylabs/proof-cli"`. The old versions stay installable. Unpublishing would break existing lockfiles. -6. Optionally `npm dist-tag rm @unicitylabs/proof-cli next` once 0.2.0 is on +7. Optionally `npm dist-tag rm @unicitylabs/proof-cli next` once 0.2.0 is on `latest`. +8. Optionally restrict token publishing on the new package — npm Settings, + Publishing access, "Require two-factor authentication and disallow tokens". + Configuring a trusted publisher does not do this by itself, so the bootstrap + credential from step 3 keeps working until it is done. -Publishing 0.2.0 from the workflow rather than by hand is what earns it a -provenance attestation: 0.1.2, released through the workflow, carries an SLSA -predicate, and 0.1.0, published by hand to bootstrap the current name, carries -none. Under this order the unattested artifact is a release candidate on a tag -nothing resolves by default. +Step 4's configuration binds to the repository's immutable identity once step 5 +succeeds, and that identity survives a rename, so the binding only needs +re-pointing if the repository is renamed again afterwards. -### Repository rename +Publishing 0.2.0 from the workflow rather than by hand is what earns it a +provenance attestation: 0.1.1 and 0.1.2, released through the workflow, carry an +SLSA predicate, and 0.1.0, published by hand to bootstrap the current name, +carries none. Under this order the unattested artifact is a release candidate on +a tag nothing resolves by default. -7. Rename the repository on GitHub. Requires organisation admin. Update the - remote in any working copy. -8. Re-point the new package's trusted publisher at the new repository name, if - step 3 ran before the rename. +Steps 1, 3, 4, 6, 7 and 8 need registry or organisation credentials. GitHub redirects the old paths only until a repository with the old name is created in the organisation, so the redirect is not a permanent guarantee. Every published 0.1.x tarball carries `repository`, `homepage` and `bugs` URLs naming the old repository for as long as anyone installs those versions. -Steps 2, 3, 5, 6, 7 and 8 need registry or organisation credentials. - ## Verification The regression that matters is that a token certified before the rename still @@ -204,12 +207,13 @@ from the user's side. ## Risks -| Risk | Mitigation | -| -------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- | -| The frozen tag is renamed later for consistency | A sentence at the constant, the frozen-section list above, and `ConstantsTest` | -| The README appendix is caught by a file-wide replace | Both sections named as frozen above; review the README diff line by line | -| `latest` ends up on a release candidate | The bootstrap publish passes `--tag next`; 0.2.0 reaches `latest` only through the workflow, which derives the tag from the version | -| Releases break after the repository rename | Step 8 | -| Users on the old package never learn of the move | Step 5's deprecation message appears on install | -| 0.2.0 ships without a provenance attestation | Only the bootstrap prerelease is published by hand; 0.2.0 comes from the workflow | -| The old repository name is recreated, breaking redirects | Do not create a repository named `timestamp-cli` in the organisation | +| Risk | Mitigation | +| -------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- | +| The frozen tag is renamed later for consistency | A sentence at the constant, the frozen-section list above, and `ConstantsTest` | +| The README appendix is caught by a file-wide replace | Both sections named as frozen above; review the README diff line by line | +| `latest` ends up on a release candidate | The bootstrap publish passes `--tag next`; 0.2.0 reaches `latest` only through the workflow, which derives the tag from the version | +| A provenance publish is attempted from the old repository name | The repository rename is step 1, before any publish | +| Users on the old package never learn of the move | Step 6's deprecation message appears on install | +| 0.2.0 ships without a provenance attestation | Only the bootstrap prerelease is published by hand; 0.2.0 comes from the workflow | +| The old repository name is recreated, breaking redirects | Do not create a repository named `timestamp-cli` in the organisation | +| The trusted-publisher configuration expires unused | Step 4 happens only when the release is ready, and step 5 follows within two days | From f1e4fc5b2b8284bb595aa24fb8e83f240e044e99 Mon Sep 17 00:00:00 2001 From: Pavel Grigorenko Date: Wed, 14 Oct 2026 15:58:45 +0200 Subject: [PATCH 03/11] Fix stale binary name in package-lock.json packages[""].bin field --- package-lock.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package-lock.json b/package-lock.json index 1f650c7..0272bd1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,7 +13,7 @@ "commander": "15.0.0" }, "bin": { - "unicity-timestamp": "lib/cli.js" + "unicity-proof": "lib/cli.js" }, "devDependencies": { "@babel/core": "8.0.1", From d6e4b438fcb2a0bc191a366a9858d2f7abbdd28a Mon Sep 17 00:00:00 2001 From: Pavel Grigorenko Date: Wed, 14 Oct 2026 15:59:29 +0200 Subject: [PATCH 04/11] Add the lockfile bin map to the rename inventory The spec and the plan both listed only the two name fields in package-lock.json, but the `""` package entry mirrors the manifest and carries a `bin` map, which kept the old binary name after the rename. `npm ci` does not repair it, so nothing in the sequence would have caught it before a future lockfile regeneration. --- docs/plans/2026-10-14-rename-to-proof-cli.md | 2 +- docs/specs/2026-10-14-rename-to-proof-cli.md | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/plans/2026-10-14-rename-to-proof-cli.md b/docs/plans/2026-10-14-rename-to-proof-cli.md index 103dafd..8a470e8 100644 --- a/docs/plans/2026-10-14-rename-to-proof-cli.md +++ b/docs/plans/2026-10-14-rename-to-proof-cli.md @@ -27,7 +27,7 @@ **Files:** - Modify: `package.json` (name, bin, description, keywords, repository, homepage, bugs) -- Modify: `package-lock.json` (name at the root and in the `""` package entry) +- Modify: `package-lock.json` (name at the root and in the `""` package entry, and the `bin` map inside that entry) - Modify: `src/lib/constants.ts:6-12` (the comment on `TIMESTAMP_TAG`) **Interfaces:** diff --git a/docs/specs/2026-10-14-rename-to-proof-cli.md b/docs/specs/2026-10-14-rename-to-proof-cli.md index 2f25c92..84a5ee9 100644 --- a/docs/specs/2026-10-14-rename-to-proof-cli.md +++ b/docs/specs/2026-10-14-rename-to-proof-cli.md @@ -84,7 +84,8 @@ Brand and user-visible surface: - `package.json`: `name`, `bin`, `description`, `keywords`, `repository`, `homepage`, `bugs` -- `package-lock.json`: the package name at the root and in the `""` package entry +- `package-lock.json`: the package name at the root and in the `""` package + entry, and the `bin` map inside that entry, which mirrors the manifest - `src/cli.ts`: `.name()`, `.description()` — the sentence `--help` prints — and the `--out` help text naming the default key file - `src/output.ts`: the recovery hint printed when a certified stamp cannot be From b0d7bced66ffd2732ff592cbf3bce089d767b030 Mon Sep 17 00:00:00 2001 From: Pavel Grigorenko Date: Wed, 14 Oct 2026 16:04:19 +0200 Subject: [PATCH 05/11] Rename the binary to unicity-proof --- src/cli.ts | 6 +++--- src/commands/keygen.ts | 2 +- src/output.ts | 2 +- tests/e2e/CliOfflineTest.ts | 28 ++++++++++++++++++++++++++++ tests/unit/StampWriteTest.ts | 3 +++ 5 files changed, 36 insertions(+), 5 deletions(-) diff --git a/src/cli.ts b/src/cli.ts index 36afa75..4937011 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -23,8 +23,8 @@ process.once('SIGINT', () => { const program = new Command(); program - .name('unicity-timestamp') - .description('Timestamp a SHA-256 hash on the Unicity Network and verify the resulting token offline.') + .name('unicity-proof') + .description('Certify a SHA-256 hash on the Unicity Network and verify the resulting proof offline.') // Commander defaults the version option to `-V`, keeping `-v` free for a // `--verbose` this CLI does not have. `node -v` and `npm -v` are what people // reach for, so the short flag is lowercase here. Commander refuses two short @@ -100,7 +100,7 @@ program program .command('keygen') .description('generate a secp256k1 private key for signed stamps') - .option('--out ', 'key file; default unicity-timestamp.key; "-" prints the key to stdout') + .option('--out ', 'key file; default unicity-proof.key; "-" prints the key to stdout') .option('--force', 'overwrite the key file') .action(async (flags: IKeygenFlags) => { process.exitCode = await runKeygen(flags, context()); diff --git a/src/commands/keygen.ts b/src/commands/keygen.ts index 2283b75..1008027 100644 --- a/src/commands/keygen.ts +++ b/src/commands/keygen.ts @@ -14,7 +14,7 @@ export interface IKeygenFlags { readonly out?: string; } -const DEFAULT_KEY_FILE = 'unicity-timestamp.key'; +const DEFAULT_KEY_FILE = 'unicity-proof.key'; /** * Write a private key to a path that already holds a file. diff --git a/src/output.ts b/src/output.ts index 97c371b..0cb72c3 100644 --- a/src/output.ts +++ b/src/output.ts @@ -145,7 +145,7 @@ export function warningLine(message: string): string { export function recoveryLines(bytes: Uint8Array): string { return [ 'error: the stamp was certified but could not be written.', - 'Save the token below; `unicity-timestamp verify` accepts hex text.', + 'Save the token below; `unicity-proof verify` accepts hex text.', HexConverter.encode(bytes), '', ].join('\n'); diff --git a/tests/e2e/CliOfflineTest.ts b/tests/e2e/CliOfflineTest.ts index aab1599..c87732a 100644 --- a/tests/e2e/CliOfflineTest.ts +++ b/tests/e2e/CliOfflineTest.ts @@ -28,6 +28,13 @@ describe('unicity-timestamp (offline)', () => { expect(help.stdout).toContain('verify'); expect(help.stdout).toContain('-v, --version'); + // The installed command name and the name the help prints have to agree, or + // the help tells the reader to run something that is not on their PATH. The + // whole usage line is asserted rather than a substring, so a stale name cannot + // hide in it — and the old name is deliberately absent from this file, because + // Task 4 and Task 5 grep the tree for it. + expect(help.stdout.split('\n')[0]).toEqual('Usage: unicity-proof [options] [command]'); + // Read from the manifest rather than written out, so a release bump does // not have to remember to come back and edit this line. const manifest = JSON.parse(await readFile(path.resolve('package.json'), 'utf8')) as { version: string }; @@ -45,6 +52,27 @@ describe('unicity-timestamp (offline)', () => { TIMEOUT, ); + it( + 'names the default key file in the keygen help', + async () => { + const keygenHelp = await runCli(['keygen', '--help'], { cwd }); + expect(keygenHelp.code).toBe(0); + expect(keygenHelp.stdout).toContain('unicity-proof.key'); + }, + TIMEOUT, + ); + + it( + 'names the default key file after the command', + async () => { + const directory = await tempDir('proof-cli-default-key-'); + const result = await runCli(['keygen'], { cwd: directory }); + expect(result.code).toBe(0); + expect(await readdir(directory)).toEqual(['unicity-proof.key']); + }, + TIMEOUT, + ); + it( 'exits 2 on usage errors before touching the network', async () => { diff --git a/tests/unit/StampWriteTest.ts b/tests/unit/StampWriteTest.ts index 17fcc8d..bf6fabd 100644 --- a/tests/unit/StampWriteTest.ts +++ b/tests/unit/StampWriteTest.ts @@ -38,6 +38,9 @@ describe('writeCertifiedToken', () => { // from stderr, and no partial file is left lying around. expect(await readFile(out, 'utf8')).toEqual('existing'); expect(sink.stderr()).toContain('could not be written'); + // The hint is the only instruction a user gets for recovering a stamp they + // have already paid for, so it has to name a command that exists. + expect(sink.stderr()).toContain('`unicity-proof verify` accepts hex text'); expect(sink.stderr()).toContain(HexConverter.encode(TOKEN)); expect(await readdir(directory)).toEqual(['token.cbor']); }); From 17ca959a84826c785d434b94c74ded3b040e0108 Mon Sep 17 00:00:00 2001 From: Pavel Grigorenko Date: Wed, 14 Oct 2026 16:11:47 +0200 Subject: [PATCH 06/11] Rename the CLI throughout the README, leaving the format appendix --- README.md | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index 6a3d2e5..3ed1795 100644 --- a/README.md +++ b/README.md @@ -10,23 +10,23 @@ Timestamping service on Unicity network. Tokens are standard Unicity tokens prod ## Installation ```bash -npm install -g @unicitylabs/timestamp-cli -unicity-timestamp --help +npm install -g @unicitylabs/proof-cli +unicity-proof --help ``` Or run it without installing: ```bash -npx @unicitylabs/timestamp-cli --help +npx @unicitylabs/proof-cli --help ``` To work from a checkout instead: ```bash -git clone https://github.com/unicitynetwork/timestamp-cli.git -cd timestamp-cli +git clone https://github.com/unicitynetwork/proof-cli.git +cd proof-cli npm install # builds through the prepare script -npm link # optional: puts `unicity-timestamp` on your PATH +npm link # optional: puts `unicity-proof` on your PATH ``` ## Configuration @@ -59,12 +59,12 @@ as the table says. ### Stamp ```bash -unicity-timestamp stamp # hash supplied -unicity-timestamp stamp --file # hash computed locally -unicity-timestamp stamp --file document.pdf --out document.cbor -unicity-timestamp stamp --file document.pdf --network testnet2 -unicity-timestamp stamp --file document.pdf --timeout 120 -unicity-timestamp stamp --file document.pdf --json > stamp.json +unicity-proof stamp # hash supplied +unicity-proof stamp --file # hash computed locally +unicity-proof stamp --file document.pdf --out document.cbor +unicity-proof stamp --file document.pdf --network testnet2 +unicity-proof stamp --file document.pdf --timeout 120 +unicity-proof stamp --file document.pdf --json > stamp.json ``` A stamp prints a summary and writes the token to `--out`, by default `token_.cbor` in the current directory. The token file is the receipt; keep it with the document. @@ -96,8 +96,8 @@ that text recovers the stamp in full; there is no need to stamp again. By default a stamp proves only that the hash existed. To also prove that *you* stamped it, sign with a key: ```bash -unicity-timestamp keygen --out my.key # once; mode 0600, 64 hex characters -unicity-timestamp stamp --file document.pdf --key-file my.key +unicity-proof keygen --out my.key # once; mode 0600, 64 hex characters +unicity-proof stamp --file document.pdf --key-file my.key ``` `keygen --out -` prints the private key to stdout instead of writing a file, as @@ -115,10 +115,10 @@ The signer's compressed public key is printed on every `stamp` and `verify`, as ### Verify ```bash -unicity-timestamp verify document.cbor # is this a valid Unicity timestamp? -unicity-timestamp verify document.cbor --file document.pdf # ...and is it for this file? -unicity-timestamp verify document.cbor --hash 2cf24dba…9824 # ...or for this digest? -cat document.cbor | unicity-timestamp verify - # from stdin; binary or hex +unicity-proof verify document.cbor # is this a valid Unicity timestamp? +unicity-proof verify document.cbor --file document.pdf # ...and is it for this file? +unicity-proof verify document.cbor --hash 2cf24dba…9824 # ...or for this digest? +cat document.cbor | unicity-proof verify - # from stdin; binary or hex ``` ``` @@ -140,7 +140,7 @@ The `Trust base` line says which root of trust produced that verdict — `bundle ### Inspect ```bash -unicity-timestamp inspect document.cbor +unicity-proof inspect document.cbor ``` Prints the same fields as `verify` without checking anything, under an `UNVERIFIED` banner. Useful for looking at tokens from other networks or other token types. @@ -150,7 +150,7 @@ Prints the same fields as `verify` without checking anything, under an `UNVERIFI Every command accepts `--json` and prints one JSON object on stdout; everything else goes to stderr. Large integers are decimal strings. `referenceTimeIso` is null when the token carries a reference time no date can represent; `referenceTime` always holds the raw value. ```bash -unicity-timestamp verify document.cbor --file document.pdf --json | jq -r .referenceTimeIso +unicity-proof verify document.cbor --file document.pdf --json | jq -r .referenceTimeIso ``` | Exit code | Meaning | @@ -164,9 +164,9 @@ unicity-timestamp verify document.cbor --file document.pdf --json | jq -r .refer ### Testnet and custom gateways ```bash -unicity-timestamp stamp --file document.pdf --network testnet2 --api-key sk_ddc3cfcc001e4a28ac3fad7407f99590 -unicity-timestamp stamp --file document.pdf --gateway https://gateway.example --trust-base ./bft-trustbase.json -unicity-timestamp stamp --file document.pdf --gateway http://localhost:3000 --allow-insecure # local aggregator only +unicity-proof stamp --file document.pdf --network testnet2 --api-key sk_ddc3cfcc001e4a28ac3fad7407f99590 +unicity-proof stamp --file document.pdf --gateway https://gateway.example --trust-base ./bft-trustbase.json +unicity-proof stamp --file document.pdf --gateway http://localhost:3000 --allow-insecure # local aggregator only ``` The testnet2 key above is the shared public demo key published in the [sphere-sdk README](https://github.com/unicity-sphere/sphere-sdk/blob/main/README.md#api-key), where it is documented as public rather than secret; capacity is shared, so get your own key for sustained use. Trust bases for mainnet and testnet2 ship inside the package. The CLI never downloads a trust base at run time. From 756ee2986079f31423054401e99119dec2715722 Mon Sep 17 00:00:00 2001 From: Pavel Grigorenko Date: Wed, 14 Oct 2026 16:18:04 +0200 Subject: [PATCH 07/11] Rename the README's H1 title to match the proof-cli rename --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3ed1795..3e10c76 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Unicity Timestamp CLI +# Unicity Proof CLI Timestamping service on Unicity network. Tokens are standard Unicity tokens produced with the [state transition SDK](https://github.com/unicitynetwork/state-transition-sdk-js). From a3d626c27f81c8e09aaa165c8f53d56b8c60da26 Mon Sep 17 00:00:00 2001 From: Pavel Grigorenko Date: Wed, 14 Oct 2026 16:19:02 +0200 Subject: [PATCH 08/11] Check for the product name in title case too The README's H1 is `# Unicity Timestamp CLI`, which is title case and space-separated, so the line-ranged substitutions did not touch it and the verification grep -- built from the same two patterns -- could not see it. Both checks now also look for the title-case form, and the README edit renames the title. The check is deliberately not a case-insensitive search for `timestamp`: the README uses the English word throughout, for round timestamps and for what a timestamp attests, and none of that is being renamed. --- docs/plans/2026-10-14-rename-to-proof-cli.md | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/docs/plans/2026-10-14-rename-to-proof-cli.md b/docs/plans/2026-10-14-rename-to-proof-cli.md index 8a470e8..6b6bc0d 100644 --- a/docs/plans/2026-10-14-rename-to-proof-cli.md +++ b/docs/plans/2026-10-14-rename-to-proof-cli.md @@ -289,9 +289,19 @@ Expected: the digest from Step 1. If the line numbers moved, the appendix was ed - [ ] **Step 5: Verify no stale brand references remain outside the appendix** -Run: `head -214 README.md | grep -n 'unicity-timestamp\|timestamp-cli'` +Run: `head -214 README.md | grep -nI 'unicity-timestamp\|timestamp-cli\|Timestamp CLI\|Unicity Timestamp'` Expected: no output. +The last two patterns matter: the H1 title reads `# Unicity Timestamp CLI`, +which is Title Case and space-separated, so Step 2's substitutions do not touch +it and a check using only their patterns cannot see it. Change the title to +`# Unicity Proof CLI` as part of Step 2. + +Do **not** broaden this to a case-insensitive search for `timestamp`. The README +uses the English word legitimately throughout — "round timestamp", "A timestamp +is an attestation", "classic timestamp authority" — and all of it stays. Only +the product name is being renamed. + - [ ] **Step 6: Commit** ```bash @@ -404,7 +414,7 @@ Expected: `OK` twice. These tokens were certified before the rename; this is the - [ ] **Step 3: Confirm the old name survives only where it must** -Run: `grep -rlI 'unicity-timestamp' src tests README.md | sort` +Run: `grep -rlI 'unicity-timestamp\|Timestamp CLI\|Unicity Timestamp' src tests README.md | sort` Expected exactly these three files: ``` From ca673d1514c3ef76d330b90108ed8c74bff1046d Mon Sep 17 00:00:00 2001 From: Pavel Grigorenko Date: Wed, 14 Oct 2026 16:22:24 +0200 Subject: [PATCH 09/11] Rename the CLI in the workflow, the env sample and the test titles --- .env.example | 2 +- .github/workflows/npm.yml | 8 ++++---- scripts/update-trust-bases.mjs | 2 +- tests/e2e/CliNetworkTest.ts | 4 ++-- tests/e2e/CliOfflineTest.ts | 8 ++++---- tests/support/fixtures.ts | 2 +- tests/unit/ConfigTest.ts | 2 +- tests/unit/KeygenTest.ts | 4 ++-- tests/unit/StampWriteTest.ts | 2 +- tests/unit/VerifyTest.ts | 2 +- 10 files changed, 18 insertions(+), 18 deletions(-) diff --git a/.env.example b/.env.example index c0c861a..4c3985f 100644 --- a/.env.example +++ b/.env.example @@ -1,7 +1,7 @@ # Copy to .env and fill in. .env is gitignored. # --- CLI runtime ------------------------------------------------------------- -# Gateway API key used by `unicity-timestamp stamp`. Get one at https://sphere.unicity.network/ +# Gateway API key used by `unicity-proof stamp`. Get one at https://sphere.unicity.network/ UNICITY_API_KEY=sk_your_gateway_key # mainnet | testnet2 UNICITY_NETWORK=mainnet diff --git a/.github/workflows/npm.yml b/.github/workflows/npm.yml index c2e79cf..a5e7fcd 100644 --- a/.github/workflows/npm.yml +++ b/.github/workflows/npm.yml @@ -12,7 +12,7 @@ name: Release # restriction rather than anything written in this file. # * The package exists on the registry and names this workflow as its trusted # publisher (npmjs.com > the package > Settings > Trusted Publisher; -# repository `unicitynetwork/timestamp-cli`, workflow `npm.yml`, environment +# repository `unicitynetwork/proof-cli`, workflow `npm.yml`, environment # `npm-publish`). npm will not accept a trusted publisher for a package that # has never been published, so the first release is published by hand and # every release after it runs from here. @@ -157,8 +157,8 @@ jobs: - name: Refuse a version that is already published run: | version='${{ steps.version.outputs.version }}' - if npm view "@unicitylabs/timestamp-cli@${version}" version >/dev/null 2>&1; then - echo "@unicitylabs/timestamp-cli@${version} is already on the registry." >&2 + if npm view "@unicitylabs/proof-cli@${version}" version >/dev/null 2>&1; then + echo "@unicitylabs/proof-cli@${version} is already on the registry." >&2 exit 1 fi @@ -192,5 +192,5 @@ jobs: fi gh release create "v${version}" \ --title "v${version}" \ - --notes "https://www.npmjs.com/package/@unicitylabs/timestamp-cli/v/${version}" \ + --notes "https://www.npmjs.com/package/@unicitylabs/proof-cli/v/${version}" \ --verify-tag $prerelease diff --git a/scripts/update-trust-bases.mjs b/scripts/update-trust-bases.mjs index d87c93f..55b320c 100644 --- a/scripts/update-trust-bases.mjs +++ b/scripts/update-trust-bases.mjs @@ -14,7 +14,7 @@ const NETWORKS = [ const targetDirectory = path.join(path.dirname(fileURLToPath(import.meta.url)), '..', 'src', 'trust-bases'); async function fetchText(url) { - const response = await fetch(url, { headers: { 'User-Agent': 'unicity-timestamp-cli' } }); + const response = await fetch(url, { headers: { 'User-Agent': 'unicity-proof-cli' } }); if (!response.ok) { throw new Error(`GET ${url} failed with HTTP ${response.status}`); } diff --git a/tests/e2e/CliNetworkTest.ts b/tests/e2e/CliNetworkTest.ts index f047593..df90869 100644 --- a/tests/e2e/CliNetworkTest.ts +++ b/tests/e2e/CliNetworkTest.ts @@ -14,7 +14,7 @@ const TIMEOUT = 180_000; const describeNetwork = TEST_API_KEY ? describe : describe.skip; const itWritesFixtures = process.env.UNICITY_E2E_WRITE_FIXTURES === '1' ? it : it.skip; -describeNetwork(`unicity-timestamp against ${TEST_NETWORK}`, () => { +describeNetwork(`unicity-proof against ${TEST_NETWORK}`, () => { let cwd: string; const env = { UNICITY_API_KEY: TEST_API_KEY ?? '', UNICITY_NETWORK: TEST_NETWORK }; const digest = HexConverter.encode(crypto.getRandomValues(new Uint8Array(32))); @@ -23,7 +23,7 @@ describeNetwork(`unicity-timestamp against ${TEST_NETWORK}`, () => { let signedToken: string; beforeAll(async () => { - cwd = await tempDir('timestamp-cli-net-'); + cwd = await tempDir('proof-cli-net-'); anonymousToken = path.join(cwd, 'anonymous.cbor'); signedToken = path.join(cwd, 'signed.cbor'); }); diff --git a/tests/e2e/CliOfflineTest.ts b/tests/e2e/CliOfflineTest.ts index c87732a..ac12e05 100644 --- a/tests/e2e/CliOfflineTest.ts +++ b/tests/e2e/CliOfflineTest.ts @@ -7,11 +7,11 @@ import { tempDir, TEST_DIGEST_HEX } from '../support/fixtures.js'; const TIMEOUT = 30_000; const INCLUSION_PROOF_BYTE_OFFSET = 700; -describe('unicity-timestamp (offline)', () => { +describe('unicity-proof (offline)', () => { let cwd: string; beforeAll(async () => { - cwd = await tempDir('timestamp-cli-e2e-'); + cwd = await tempDir('proof-cli-e2e-'); }); it( @@ -107,7 +107,7 @@ describe('unicity-timestamp (offline)', () => { async () => { const envFile = path.join(cwd, 'custom.env'); await writeFile(envFile, 'UNICITY_NETWORK=devnet\n'); - const dotenvDir = await tempDir('timestamp-cli-dotenv-'); + const dotenvDir = await tempDir('proof-cli-dotenv-'); await writeFile(path.join(dotenvDir, '.env'), 'UNICITY_NETWORK=devnet\n'); const args = [ 'stamp', @@ -229,7 +229,7 @@ describe('unicity-timestamp (offline)', () => { async () => { // A token plus a .env naming the trust base that validates it would // otherwise be a complete forgery kit, and the verdict would not say so. - const directory = await tempDir('timestamp-cli-dotenv-'); + const directory = await tempDir('proof-cli-dotenv-'); const mainnetTrustBase = path.resolve('src/trust-bases/bft-trustbase.mainnet.json'); const fixture = path.resolve('tests/fixtures/testnet2-anonymous.cbor'); await writeFile(path.join(directory, '.env'), `UNICITY_TRUST_BASE=${mainnetTrustBase}\n`); diff --git a/tests/support/fixtures.ts b/tests/support/fixtures.ts index d6eb8b6..192a792 100644 --- a/tests/support/fixtures.ts +++ b/tests/support/fixtures.ts @@ -19,7 +19,7 @@ export const TEST_PUBLIC_KEY_HEX = '031b84c5567b126440995d3ed5aaba0565d71e183460 const handedOut: string[] = []; /** Fresh temporary directory under the OS temp root, removed when the file finishes. */ -export async function tempDir(prefix = 'timestamp-cli-'): Promise { +export async function tempDir(prefix = 'proof-cli-'): Promise { const directory = await mkdtemp(path.join(tmpdir(), prefix)); handedOut.push(directory); return directory; diff --git a/tests/unit/ConfigTest.ts b/tests/unit/ConfigTest.ts index 76071e9..7881638 100644 --- a/tests/unit/ConfigTest.ts +++ b/tests/unit/ConfigTest.ts @@ -206,7 +206,7 @@ describe('resolveStampConfig', () => { let directory: string; beforeEach(async () => { - directory = await tempDir('timestamp-cli-out-'); + directory = await tempDir('proof-cli-out-'); }); afterEach(async () => { diff --git a/tests/unit/KeygenTest.ts b/tests/unit/KeygenTest.ts index ca929e4..39e70f5 100644 --- a/tests/unit/KeygenTest.ts +++ b/tests/unit/KeygenTest.ts @@ -13,7 +13,7 @@ describe('runKeygen under a umask that masks owner bits', () => { let previousUmask: number; beforeEach(async () => { - directory = await tempDir('timestamp-cli-umask-'); + directory = await tempDir('proof-cli-umask-'); previousUmask = process.umask(0o477); }); @@ -41,7 +41,7 @@ describe('runKeygen when the staged write cannot complete', () => { let directory: string; beforeEach(async () => { - directory = await tempDir('timestamp-cli-keygen-fail-'); + directory = await tempDir('proof-cli-keygen-fail-'); }); afterEach(async () => { diff --git a/tests/unit/StampWriteTest.ts b/tests/unit/StampWriteTest.ts index bf6fabd..2b976bb 100644 --- a/tests/unit/StampWriteTest.ts +++ b/tests/unit/StampWriteTest.ts @@ -15,7 +15,7 @@ describe('writeCertifiedToken', () => { let directory: string; beforeEach(async () => { - directory = await tempDir('timestamp-cli-write-'); + directory = await tempDir('proof-cli-write-'); }); it('writes the token and nothing else', async () => { diff --git a/tests/unit/VerifyTest.ts b/tests/unit/VerifyTest.ts index fb1297d..937ddea 100644 --- a/tests/unit/VerifyTest.ts +++ b/tests/unit/VerifyTest.ts @@ -21,7 +21,7 @@ describe('runVerify on a token whose network has no bundled pin', () => { pollIntervalMs: 10, timeoutMs: 2_000, }); - file = path.join(await tempDir('timestamp-cli-verify-'), 'token.cbor'); + file = path.join(await tempDir('proof-cli-verify-'), 'token.cbor'); await writeFile(file, token.toCBOR()); }); From e6c9fc5dc229d98195a16a7f0ab16bd689396943 Mon Sep 17 00:00:00 2001 From: Pavel Grigorenko Date: Wed, 14 Oct 2026 16:43:02 +0200 Subject: [PATCH 10/11] Fix inconsistencies found in the final branch review The post-merge section was titled "Operator steps after merge" with a preamble saying the steps need registry or organisation credentials and are not part of the code change, but the list opens with renaming the GitHub repository (which precedes the merge) and merging the branch itself (which is the code change). Retitled to "Operator steps" and reworded the preamble to hold for the whole list. Both docs also narrowed npm's repository-match rule to provenance publishes specifically; npm documents the exact-match requirement for trusted publishing generally, so the qualifier is dropped in the plan and the spec. The plan's suite-run step said "the one new keygen test" where two were added (naming the default key file after the command, and in its --help), and its expected failure for the help assertion described a toContain substring check when the assertion is now a toEqual on the whole usage line; both are corrected to match. The README's tagline under the new "Unicity Proof CLI" heading still read "Timestamping service on Unicity network," unlike the renamed package description and CLI help text. Replaced with "Proof-of-existence service on the Unicity network," leaving the rest of the line, the frozen wire-format sections, and every other use of "timestamp" as a common noun untouched. The e2e help-and-version test asserted the usage line against a hardcoded command name, so nothing cross-checked it against the manifest that actually installs the binary. It now reads the expected name from package.json's `bin` entry, the same way the version assertions already read the version from the manifest, so a rename that only touches `bin` can no longer slip past the suite. Both docs also claimed the trusted-publisher binding "survives a later rename." npm's documentation only says the first successful publish binds it to the repository's immutable identity; it does not say what a later rename requires. Softened both to say the binding is to that identity rather than to the name, that npm doesn't document the later case, and that the ordering in this plan makes it moot. Added a risk-table row for the window between merging and the bootstrap publish, during which the README's install command 404s because the package doesn't exist on npm yet; the mitigation is running the bootstrap publish immediately after merging. --- README.md | 2 +- docs/plans/2026-10-14-rename-to-proof-cli.md | 24 +++++++------- docs/specs/2026-10-14-rename-to-proof-cli.md | 34 +++++++++++--------- tests/e2e/CliOfflineTest.ts | 19 ++++++----- 4 files changed, 42 insertions(+), 37 deletions(-) diff --git a/README.md b/README.md index 3e10c76..dde74f9 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Unicity Proof CLI -Timestamping service on Unicity network. Tokens are standard Unicity tokens produced with the [state transition SDK](https://github.com/unicitynetwork/state-transition-sdk-js). +Proof-of-existence service on the Unicity network. Tokens are standard Unicity tokens produced with the [state transition SDK](https://github.com/unicitynetwork/state-transition-sdk-js). ## Requirements diff --git a/docs/plans/2026-10-14-rename-to-proof-cli.md b/docs/plans/2026-10-14-rename-to-proof-cli.md index 6b6bc0d..fc75fcd 100644 --- a/docs/plans/2026-10-14-rename-to-proof-cli.md +++ b/docs/plans/2026-10-14-rename-to-proof-cli.md @@ -180,7 +180,7 @@ expect(sink.stderr()).toContain('`unicity-proof verify` accepts hex text'); - [ ] **Step 4: Run the three tests to verify they fail** Run: `npm run build && npx jest tests/e2e/CliOfflineTest.ts -t 'prints help and version'` -Expected: FAIL — `Expected substring: "unicity-proof"` +Expected: FAIL — equality mismatch: received `Usage: unicity-timestamp [options] [command]` Run: `npx jest tests/e2e/CliOfflineTest.ts -t 'names the default key file'` Expected: FAIL — received `["unicity-timestamp.key"]` @@ -375,7 +375,7 @@ rather than loosening this check. - [ ] **Step 5: Run the suite and lint** Run: `npm run lint && CI= npm test` -Expected: PASS, same test count as before the rename plus the one new keygen test. +Expected: PASS, same test count as before the rename plus the two new keygen tests. - [ ] **Step 6: Commit** @@ -499,14 +499,14 @@ gh pr create --title "Rename the CLI to @unicitylabs/proof-cli" --body-file ../p --- -## Operator steps after merge +## Operator steps -These need registry or organisation credentials and are not part of the code -change. **The repository rename comes first**, because this branch points -`repository`, `homepage` and `bugs` at `unicitynetwork/proof-cli`, and npm -requires a package's `repository` to match, case-sensitively, the repository it -is publishing with provenance from. Publishing from a repository still named -`timestamp-cli` with those URLs in the manifest fails. +Most of these need registry or organisation credentials; none is part of the +code change. Step 2 is the merge of this branch. **The repository rename comes +first**, because this branch points `repository`, `homepage` and `bugs` at +`unicitynetwork/proof-cli`, and npm requires a package's `repository` to +match, case-sensitively, the repository it publishes from. Publishing from a +repository still named `timestamp-cli` with those URLs in the manifest fails. 1. Rename the repository on GitHub to `proof-cli`. Organisation admin. Update the remote in any working copy. @@ -529,6 +529,6 @@ is publishing with provenance from. Publishing from a repository still named Configuring a trusted publisher does not do this on its own, and the bootstrap token from step 3 keeps working until it is done. -Step 4's binding is to the repository's immutable identity, which survives a -later rename, so re-pointing it is only needed if the repository is renamed -again after the binding is made. +Step 4's binding is to the repository's immutable identity, not its name. npm +does not document what a later rename requires of it; under this ordering the +repository is not renamed again afterwards, so the question is moot. diff --git a/docs/specs/2026-10-14-rename-to-proof-cli.md b/docs/specs/2026-10-14-rename-to-proof-cli.md index 84a5ee9..dd05e6c 100644 --- a/docs/specs/2026-10-14-rename-to-proof-cli.md +++ b/docs/specs/2026-10-14-rename-to-proof-cli.md @@ -111,9 +111,9 @@ frozen; `proof` means the product and is free to change. ## Migration **The repository rename comes first.** npm requires a package's `repository` to -match, case-sensitively, the repository it is publishing with provenance from, -so a manifest naming `unicitynetwork/proof-cli` cannot publish from a repository -still named `timestamp-cli`. The two renames remain separable in principle — a +match, case-sensitively, the repository it publishes from, so a manifest +naming `unicitynetwork/proof-cli` cannot publish from a repository still named +`timestamp-cli`. The two renames remain separable in principle — a package rename alone needs no organisation admin, and would keep the old repository URLs in the manifest — but when both are being done, this is the order that works. @@ -151,9 +151,10 @@ order that works. Configuring a trusted publisher does not do this by itself, so the bootstrap credential from step 3 keeps working until it is done. -Step 4's configuration binds to the repository's immutable identity once step 5 -succeeds, and that identity survives a rename, so the binding only needs -re-pointing if the repository is renamed again afterwards. +Step 4's configuration binds to the repository's immutable identity, not its +name, once step 5 succeeds. npm does not document what a later rename requires +of that binding; under this ordering the repository is not renamed again +afterwards, so the question is moot. Publishing 0.2.0 from the workflow rather than by hand is what earns it a provenance attestation: 0.1.1 and 0.1.2, released through the workflow, carry an @@ -208,13 +209,14 @@ from the user's side. ## Risks -| Risk | Mitigation | -| -------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- | -| The frozen tag is renamed later for consistency | A sentence at the constant, the frozen-section list above, and `ConstantsTest` | -| The README appendix is caught by a file-wide replace | Both sections named as frozen above; review the README diff line by line | -| `latest` ends up on a release candidate | The bootstrap publish passes `--tag next`; 0.2.0 reaches `latest` only through the workflow, which derives the tag from the version | -| A provenance publish is attempted from the old repository name | The repository rename is step 1, before any publish | -| Users on the old package never learn of the move | Step 6's deprecation message appears on install | -| 0.2.0 ships without a provenance attestation | Only the bootstrap prerelease is published by hand; 0.2.0 comes from the workflow | -| The old repository name is recreated, breaking redirects | Do not create a repository named `timestamp-cli` in the organisation | -| The trusted-publisher configuration expires unused | Step 4 happens only when the release is ready, and step 5 follows within two days | +| Risk | Mitigation | +| --------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- | +| The frozen tag is renamed later for consistency | A sentence at the constant, the frozen-section list above, and `ConstantsTest` | +| The README appendix is caught by a file-wide replace | Both sections named as frozen above; review the README diff line by line | +| `latest` ends up on a release candidate | The bootstrap publish passes `--tag next`; 0.2.0 reaches `latest` only through the workflow, which derives the tag from the version | +| A provenance publish is attempted from the old repository name | The repository rename is step 1, before any publish | +| Users on the old package never learn of the move | Step 6's deprecation message appears on install | +| 0.2.0 ships without a provenance attestation | Only the bootstrap prerelease is published by hand; 0.2.0 comes from the workflow | +| The old repository name is recreated, breaking redirects | Do not create a repository named `timestamp-cli` in the organisation | +| The trusted-publisher configuration expires unused | Step 4 happens only when the release is ready, and step 5 follows within two days | +| The README's install command 404s between the merge and the bootstrap publish, because the package does not exist yet | Run the bootstrap publish immediately after merging | diff --git a/tests/e2e/CliOfflineTest.ts b/tests/e2e/CliOfflineTest.ts index ac12e05..0cb7818 100644 --- a/tests/e2e/CliOfflineTest.ts +++ b/tests/e2e/CliOfflineTest.ts @@ -28,16 +28,19 @@ describe('unicity-proof (offline)', () => { expect(help.stdout).toContain('verify'); expect(help.stdout).toContain('-v, --version'); - // The installed command name and the name the help prints have to agree, or - // the help tells the reader to run something that is not on their PATH. The - // whole usage line is asserted rather than a substring, so a stale name cannot - // hide in it — and the old name is deliberately absent from this file, because - // Task 4 and Task 5 grep the tree for it. - expect(help.stdout.split('\n')[0]).toEqual('Usage: unicity-proof [options] [command]'); - // Read from the manifest rather than written out, so a release bump does // not have to remember to come back and edit this line. - const manifest = JSON.parse(await readFile(path.resolve('package.json'), 'utf8')) as { version: string }; + const manifest = JSON.parse(await readFile(path.resolve('package.json'), 'utf8')) as { + bin: Record; + version: string; + }; + + // The installed command name and the name the help prints have to agree, or + // the help tells the reader to run something that is not on their PATH, so + // the name is taken from the manifest that installs it rather than written + // out here. The whole usage line is asserted, so a stale name cannot hide. + expect(help.stdout.split('\n')[0]).toEqual(`Usage: ${Object.keys(manifest.bin)[0]} [options] [command]`); + expect(version.code).toBe(0); expect(version.stdout.trim()).toEqual(manifest.version); expect(short.code).toBe(0); From 5b0a1213b203cd4a278bbb86d85d59ec2ab5f054 Mon Sep 17 00:00:00 2001 From: Pavel Grigorenko Date: Wed, 14 Oct 2026 18:32:20 +0200 Subject: [PATCH 11/11] Require direct publishing on the new trusted publisher npm's "Allowed actions" defaults a trusted-publisher configuration created after 3 September 2026 to `npm stage publish` only, and the release workflow publishes directly with `npm publish`. A configuration left on the default refuses the release, and because the configuration has to complete its first successful publish within two days or expire permanently, the refusal would also spend that window on a publish that cannot succeed. The migration step, its mirror in the plan and the workflow's own prerequisite comment now all say to permit direct publishing, and the risks table records the default. --- .github/workflows/npm.yml | 4 +++ docs/plans/2026-10-14-rename-to-proof-cli.md | 5 +++- docs/specs/2026-10-14-rename-to-proof-cli.md | 30 ++++++++++++-------- 3 files changed, 26 insertions(+), 13 deletions(-) diff --git a/.github/workflows/npm.yml b/.github/workflows/npm.yml index a5e7fcd..eaab067 100644 --- a/.github/workflows/npm.yml +++ b/.github/workflows/npm.yml @@ -16,6 +16,10 @@ name: Release # `npm-publish`). npm will not accept a trusted publisher for a package that # has never been published, so the first release is published by hand and # every release after it runs from here. +# * That configuration permits direct publishing under "Allowed actions". +# Configurations created after 3 September 2026 allow only +# `npm stage publish` by default, and the publish step below runs +# `npm publish`, so a default configuration refuses it. on: workflow_dispatch: inputs: diff --git a/docs/plans/2026-10-14-rename-to-proof-cli.md b/docs/plans/2026-10-14-rename-to-proof-cli.md index fc75fcd..752d5ee 100644 --- a/docs/plans/2026-10-14-rename-to-proof-cli.md +++ b/docs/plans/2026-10-14-rename-to-proof-cli.md @@ -516,7 +516,10 @@ repository still named `timestamp-cli` with those URLs in the manifest fails. **`--tag next` is required** — npm points `latest` at whatever it publishes, prerelease or not. 4. Configure the new package's trusted publisher: repository - `unicitynetwork/proof-cli`, workflow `npm.yml`, environment `npm-publish`. + `unicitynetwork/proof-cli`, workflow `npm.yml`, environment `npm-publish`, + and under "Allowed actions" permit direct publishing with `npm publish`. + Configurations created after 3 September 2026 default to `npm stage publish` + only, and this workflow publishes directly. 5. Run the release workflow with `0.2.0` as the explicit version input. **Within two days of step 4.** A new trusted-publisher configuration has to complete its first successful publish inside that window; after it, the diff --git a/docs/specs/2026-10-14-rename-to-proof-cli.md b/docs/specs/2026-10-14-rename-to-proof-cli.md index dd05e6c..a89a61d 100644 --- a/docs/specs/2026-10-14-rename-to-proof-cli.md +++ b/docs/specs/2026-10-14-rename-to-proof-cli.md @@ -135,7 +135,12 @@ order that works. from the version itself; this publish is the one that does not go through it. 4. Configure the new package's trusted publisher: repository - `unicitynetwork/proof-cli`, workflow `npm.yml`, environment `npm-publish`. + `unicitynetwork/proof-cli`, workflow `npm.yml`, environment `npm-publish`, + and under "Allowed actions" **permit direct publishing with `npm publish`**. + Configurations created after 3 September 2026 allow only `npm stage publish` + by default, and this workflow publishes directly, so a configuration left on + the default refuses the release — which would also spend the two-day window + in step 5 on a publish that cannot succeed. 5. Run the release workflow with `0.2.0` as the explicit version input, **within two days of step 4**. A new trusted-publisher configuration must complete its first successful publish inside that window; afterwards it expires and can no @@ -209,14 +214,15 @@ from the user's side. ## Risks -| Risk | Mitigation | -| --------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- | -| The frozen tag is renamed later for consistency | A sentence at the constant, the frozen-section list above, and `ConstantsTest` | -| The README appendix is caught by a file-wide replace | Both sections named as frozen above; review the README diff line by line | -| `latest` ends up on a release candidate | The bootstrap publish passes `--tag next`; 0.2.0 reaches `latest` only through the workflow, which derives the tag from the version | -| A provenance publish is attempted from the old repository name | The repository rename is step 1, before any publish | -| Users on the old package never learn of the move | Step 6's deprecation message appears on install | -| 0.2.0 ships without a provenance attestation | Only the bootstrap prerelease is published by hand; 0.2.0 comes from the workflow | -| The old repository name is recreated, breaking redirects | Do not create a repository named `timestamp-cli` in the organisation | -| The trusted-publisher configuration expires unused | Step 4 happens only when the release is ready, and step 5 follows within two days | -| The README's install command 404s between the merge and the bootstrap publish, because the package does not exist yet | Run the bootstrap publish immediately after merging | +| Risk | Mitigation | +| --------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ | +| The frozen tag is renamed later for consistency | A sentence at the constant, the frozen-section list above, and `ConstantsTest` | +| The README appendix is caught by a file-wide replace | Both sections named as frozen above; review the README diff line by line | +| `latest` ends up on a release candidate | The bootstrap publish passes `--tag next`; 0.2.0 reaches `latest` only through the workflow, which derives the tag from the version | +| A provenance publish is attempted from the old repository name | The repository rename is step 1, before any publish | +| Users on the old package never learn of the move | Step 6's deprecation message appears on install | +| 0.2.0 ships without a provenance attestation | Only the bootstrap prerelease is published by hand; 0.2.0 comes from the workflow | +| The old repository name is recreated, breaking redirects | Do not create a repository named `timestamp-cli` in the organisation | +| The trusted publisher allows only staged publishing | Step 4 permits direct `npm publish`; the default for configurations created after 3 September 2026 does not, and the workflow publishes directly | +| The trusted-publisher configuration expires unused | Step 4 happens only when the release is ready, and step 5 follows within two days | +| The README's install command 404s between the merge and the bootstrap publish, because the package does not exist yet | Run the bootstrap publish immediately after merging |