@timurproko/a1 0.1.8-dev.0aceebe → 0.1.8-dev.112
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/README.md +41 -31
- package/dist/native/darwin-arm64/manifest.json +1 -1
- package/dist/native/linux-x64/manifest.json +1 -1
- package/dist/native/win32-x64/manifest.json +2 -2
- package/dist/native/win32-x64/process-guardian.exe +0 -0
- package/dist/src/cli/dispatch.js +67 -30
- package/dist/src/cli/packages.d.ts +9 -1
- package/dist/src/cli/packages.js +24 -20
- package/dist/src/cli/version-stats.js +4 -4
- package/dist/src/foundation/pi-component-adapter/index.d.ts +1 -1
- package/dist/src/foundation/pi-component-adapter/index.js +1 -1
- package/dist/src/foundation/pi-component-adapter/shell-presenters-transcript.js +2 -1
- package/dist/src/foundation/pi-engine-adapter/adapter.d.ts +7 -0
- package/dist/src/foundation/pi-engine-adapter/adapter.js +193 -39
- package/dist/src/foundation/pi-owned-ui-integration/session-shell.d.ts +6 -0
- package/dist/src/foundation/pi-owned-ui-integration/session-shell.js +223 -13
- package/dist/src/foundation/release/index.d.ts +0 -1
- package/dist/src/foundation/release/index.js +0 -1
- package/dist/src/foundation/release/update.d.ts +1 -1
- package/dist/src/foundation/release/update.js +13 -15
- package/docs/architecture/toolchain.md +1 -1
- package/docs/ci-release-runbook.md +76 -79
- package/docs/features/launch-profiles.md +1 -1
- package/docs/manual-transparent-checkpoint.md +1 -1
- package/package.json +3 -1
- package/dist/src/foundation/release/development-preview-release.d.ts +0 -49
- package/dist/src/foundation/release/development-preview-release.js +0 -114
|
@@ -5,107 +5,104 @@ GitHub Actions is the only automation platform. Three refs are protected:
|
|
|
5
5
|
| Ref | Protection | Produced by |
|
|
6
6
|
| --- | --- | --- |
|
|
7
7
|
| `develop` | `Development validation required` on every pull request | `.github/workflows/ci.yml` |
|
|
8
|
-
| `master` | cannot be deleted or force-updated |
|
|
9
|
-
| `refs/tags/v*` | cannot be deleted or moved |
|
|
8
|
+
| `master` | cannot be deleted or force-updated | stable publication |
|
|
9
|
+
| `refs/tags/v*` | cannot be deleted or moved | stable publication |
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
`.github/workflows/release.yml` is the only publisher. A push publishes neither
|
|
12
|
+
channel. The workflow starts at `03:17 UTC` for nightly development verification,
|
|
13
|
+
or by explicit dispatch from `npm run develop` or `npm run release`.
|
|
13
14
|
|
|
14
|
-
`develop` is where work lands. `master` records what
|
|
15
|
-
|
|
16
|
-
writes it. There is no promotion to arrange and nothing to keep in sync — `master`
|
|
17
|
-
is an effect of publishing, not a step before it.
|
|
15
|
+
`develop` is where work lands. `master` records what npm `latest` serves and is an
|
|
16
|
+
effect of stable publication, not a trigger.
|
|
18
17
|
|
|
19
|
-
##
|
|
18
|
+
## Validation by trigger
|
|
20
19
|
|
|
21
|
-
|
|
|
20
|
+
| Trigger | Validation and outcome |
|
|
22
21
|
| --- | --- |
|
|
23
|
-
|
|
|
24
|
-
|
|
|
25
|
-
|
|
|
26
|
-
|
|
|
22
|
+
| Pull request into `develop` | Fast required validation; docs/spec-only changes use strict OpenSpec validation |
|
|
23
|
+
| `npm run develop` | Preview package gates on Windows, Linux, and macOS; an existing numbered preview is an early successful no-op |
|
|
24
|
+
| Nightly at `03:17 UTC` | Complete non-physical suite on Windows, Linux, and macOS, every night |
|
|
25
|
+
| `npm run release -- ...` | Complete exact-byte stable gates, then npm `latest`, tag, GitHub Release, and `master` |
|
|
26
|
+
| `.github/workflows/full-regression.yml` | Additional on-demand complete regression without publication authority |
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
demand.
|
|
28
|
+
## Numbered development previews
|
|
30
29
|
|
|
31
|
-
|
|
30
|
+
A merge or push to `develop` does not publish by itself. To request a deliberate
|
|
31
|
+
preview from any authorized checkout:
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
```sh
|
|
34
|
+
npm run develop
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
The command fetches authoritative `origin/develop`, resolves the unique merged pull
|
|
38
|
+
request associated with that exact commit through GitHub, and derives
|
|
39
|
+
`<major.minor.patch>-dev.<pull-request number>`. Thus GitHub's `develop (#107)`
|
|
40
|
+
source produces `0.1.8-dev.107`. It first checks npm; if the immutable version
|
|
41
|
+
already exists it reports that version without dispatching package work. Otherwise
|
|
42
|
+
it dispatches GitHub Actions, waits, and reports the published version. It never
|
|
43
|
+
builds or uploads npm bytes from the workstation.
|
|
44
|
+
|
|
45
|
+
Nightly resolves the same current `origin/develop` source. It always runs complete
|
|
46
|
+
verification even if source has not changed. For a new number it packs once and
|
|
47
|
+
runs the suite against that final-version tarball before publication. For an
|
|
48
|
+
existing number it downloads the exact npm tarball and runs package/update gates
|
|
49
|
+
against those registry bytes; publication is then a successful no-op.
|
|
50
|
+
|
|
51
|
+
Manual and nightly runs share one non-cancelling concurrency group. Their final
|
|
52
|
+
registry check is serialized, so overlapping requests can produce only one publish
|
|
53
|
+
and one successful existing-version no-op. A development publication moves npm's
|
|
54
|
+
internal `next` dist-tag and never moves `latest`.
|
|
55
|
+
|
|
56
|
+
Users install previews with public `develop` terminology:
|
|
35
57
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
installed: `a1 update:<commit>` resolves it against the published list and
|
|
42
|
-
refuses a commit that was never published. `develop` therefore carries one open prerelease version between
|
|
43
|
-
releases, and no commit is ever spent on a preview.
|
|
58
|
+
```sh
|
|
59
|
+
a1 update:develop # current development channel
|
|
60
|
+
a1 update:107 # numbered preview
|
|
61
|
+
a1 update:0.1.8-dev.107 # exact full preview version
|
|
62
|
+
```
|
|
44
63
|
|
|
45
|
-
|
|
46
|
-
|
|
64
|
+
`a1 update:next` is removed and redirects to `a1 update:develop` without registry
|
|
65
|
+
or runtime work.
|
|
47
66
|
|
|
48
67
|
## Cutting a stable release
|
|
49
68
|
|
|
50
|
-
|
|
69
|
+
From a clean `develop` matching its remote:
|
|
51
70
|
|
|
52
71
|
```sh
|
|
53
72
|
npm run release -- patch # or minor, major, or an exact x.y.z
|
|
54
73
|
```
|
|
55
74
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
Landing the stable version is what publishes. The same pipeline sees a commit
|
|
61
|
-
declaring a stable version and runs its stable form: build the process guardian on
|
|
62
|
-
all three platforms, pack once, run the complete suite against those exact bytes on
|
|
63
|
-
all three platforms, publish to npm `latest` with provenance from the
|
|
64
|
-
`npm-publish` environment, and only then write the tag `vx.y.z`, record the GitHub
|
|
65
|
-
Release, and fast-forward `master`.
|
|
75
|
+
The command lands `x.y.z` through its version pull request, explicitly dispatches
|
|
76
|
+
stable publication for that exact current `origin/develop` commit, and waits. Only
|
|
77
|
+
after success does it land `x.y.(z+1)-dev`.
|
|
66
78
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
79
|
+
Stable publication builds the process guardian on all supported platforms, packs
|
|
80
|
+
once, runs the complete suite against those exact bytes on Windows, Linux, and
|
|
81
|
+
macOS, publishes to npm `latest` with provenance from the `npm-publish`
|
|
82
|
+
environment, and then writes `vx.y.z`, records the GitHub Release, and fast-forwards
|
|
83
|
+
`master`. A push of the stable version does not publish it.
|
|
70
84
|
|
|
71
85
|
Rules that do not bend:
|
|
72
86
|
|
|
73
|
-
- **Never upload locally rebuilt bytes.** The publisher uploads the artifact the
|
|
74
|
-
|
|
75
|
-
- **Never
|
|
76
|
-
job has no checkout of dependencies, no build, and no pack step.
|
|
77
|
-
- **Never move a release tag.** A wrong tag is superseded by the next version, not
|
|
78
|
-
repointed. The tag is written by the publication itself, so it exists only for
|
|
79
|
-
versions that shipped.
|
|
87
|
+
- **Never upload locally rebuilt bytes.** The publisher uploads the artifact the validation ran against and checks its digest before and after.
|
|
88
|
+
- **Never route around validation by rebuilding inside a publisher.** The publish job receives the packed artifact and does not install dependencies, build, or pack.
|
|
89
|
+
- **Never move a release tag.** A wrong tag is superseded by the next version, not repointed.
|
|
80
90
|
|
|
81
91
|
## When something fails
|
|
82
92
|
|
|
83
|
-
- **PR validation fails:** fix the code and push
|
|
84
|
-
- **
|
|
85
|
-
|
|
86
|
-
- **Stable
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
approving reviews to zero. It does not require the branch to be up to date: once a
|
|
100
|
-
PR is green it merges even if unrelated work landed first, with no re-validation
|
|
101
|
-
loop.
|
|
102
|
-
|
|
103
|
-
The `master` and tag rulesets carry no checks at all. Both only ever receive a commit
|
|
104
|
-
that has already been validated and published, so what matters about them is that
|
|
105
|
-
neither can be rewritten. Requiring a pull request on `master` would stop the release
|
|
106
|
-
from recording itself there.
|
|
107
|
-
|
|
108
|
-
Do not add a direct-push bypass as a shortcut, and never weaken the force-push or
|
|
109
|
-
deletion protection. Ruleset mutation is a separate administrative operation: run
|
|
110
|
-
`node scripts/check-github-rulesets.mjs` to see the diff, and apply only when a
|
|
111
|
-
maintainer explicitly confirms with `--apply --confirm apply-a1-ci-rulesets`.
|
|
93
|
+
- **PR validation fails:** fix the code and push; do not mark a failed tier optional.
|
|
94
|
+
- **Development publication fails:** fix the cause and rerun `npm run develop`; an npm version that already exists is never overwritten.
|
|
95
|
+
- **Stable publication fails before npm accepts bytes:** no tag, release, or moved branch exists. Fix the cause and release the next version.
|
|
96
|
+
- **Stable publication is uncertain after npm accepted bytes:** stop and inspect registry version, digest, tag, and release. Never republish immutable bytes.
|
|
97
|
+
|
|
98
|
+
## Branch protection rationale
|
|
99
|
+
|
|
100
|
+
One person maintains this repository, and a PR author cannot approve their own PR.
|
|
101
|
+
The `develop` ruleset therefore requires a pull request, a green required check,
|
|
102
|
+
and resolved review threads, but zero approving reviews. `master` and release tags
|
|
103
|
+
are written only after publication and are protected from force-push, movement, and
|
|
104
|
+
deletion.
|
|
105
|
+
|
|
106
|
+
Do not add direct-push bypasses. Ruleset mutation remains a separate administrative
|
|
107
|
+
operation: inspect with `node scripts/check-github-rulesets.mjs`, and apply only
|
|
108
|
+
with explicit maintainer confirmation.
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
| `a1 pi` | Untouched vanilla Pi fallback and comparison oracle | ordinary `~/.pi/agent` |
|
|
9
9
|
| `a1 sandbox` | Unchanged isolated vanilla Pi profile for experiments | `~/.a1/sandbox` |
|
|
10
10
|
|
|
11
|
-
`a1 pi` and `a1 sandbox` are development instruments: one compares A1 against pinned Pi, the other tries resources against an isolated profile. Prerelease builds — what `a1 update:
|
|
11
|
+
`a1 pi` and `a1 sandbox` are development instruments: one compares A1 against pinned Pi, the other tries resources against an isolated profile. Prerelease builds — what `a1 update:develop` or `a1 update:<number>` installs — expose them. A release build does not, and does not recognize the words: what it exposes is bare `a1` plus the maintenance and package commands. Working in this repository is unaffected, because `npm start:pi` and `npm run start:sandbox` prepare the profile and launch directly rather than through the command line.
|
|
12
12
|
|
|
13
13
|
There is no `a1 agent` command. The former `a1 ui` subcommand is removed. Bare `a1` is the owned agent product surface and remains the entry point when multi-agent UX is introduced.
|
|
14
14
|
|
|
@@ -50,4 +50,4 @@ Report failures with direct-versus-A1 behavior, platform/terminal versions, exac
|
|
|
50
50
|
|
|
51
51
|
For recovery, use `a1 pi`; do not use the removed `a1 ui` command. `a1 sandbox` remains profile isolation rather than a security boundary.
|
|
52
52
|
|
|
53
|
-
Manual acceptance can authorize an exact uncertified
|
|
53
|
+
Manual acceptance can authorize an exact uncertified development preview after non-desktop gates pass. It does not certify stable terminal parity or platform support.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@timurproko/a1",
|
|
3
|
-
"version": "0.1.8-dev.
|
|
3
|
+
"version": "0.1.8-dev.112",
|
|
4
4
|
"description": "Standalone terminal workspace for supervised native and managed agents",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"packageManager": "npm@11.13.0",
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
"check:deprecated": "node scripts/check-deprecated-dependencies.mjs",
|
|
34
34
|
"branches:prune": "node scripts/prune-merged-branches.mjs",
|
|
35
35
|
"check": "npm run test:fast",
|
|
36
|
+
"develop": "node scripts/develop.mjs",
|
|
36
37
|
"release": "node scripts/release.mjs",
|
|
37
38
|
"test": "npm run test:fast",
|
|
38
39
|
"test:fast": "node scripts/run-validation-tier.mjs typecheck fast",
|
|
@@ -57,6 +58,7 @@
|
|
|
57
58
|
"dependencies": {
|
|
58
59
|
"@earendil-works/pi-coding-agent": "0.84.2",
|
|
59
60
|
"@earendil-works/pi-tui": "0.84.2",
|
|
61
|
+
"chalk": "5.6.2",
|
|
60
62
|
"cross-spawn": "7.0.6",
|
|
61
63
|
"grok-mermaid": "0.2.2",
|
|
62
64
|
"semver": "7.8.5"
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
export declare const PREVIEW_RELEASE_SCHEMA: string;
|
|
2
|
-
export interface DevelopmentPreviewCandidate {
|
|
3
|
-
readonly version: string;
|
|
4
|
-
readonly requiresVersionCommit: boolean;
|
|
5
|
-
}
|
|
6
|
-
export interface DevelopmentPreviewRegistryState {
|
|
7
|
-
readonly published: boolean;
|
|
8
|
-
readonly nextVersion: string | null;
|
|
9
|
-
}
|
|
10
|
-
export interface DevelopmentPreviewVerificationOptions {
|
|
11
|
-
readonly attempts?: number;
|
|
12
|
-
readonly delayMs?: number;
|
|
13
|
-
readonly delay?: (milliseconds: number) => Promise<void>;
|
|
14
|
-
}
|
|
15
|
-
export interface DevelopmentPreviewPublishResult {
|
|
16
|
-
readonly published: boolean;
|
|
17
|
-
readonly recoveredPublishError: unknown | null;
|
|
18
|
-
}
|
|
19
|
-
export interface UncertifiedDevelopmentPreviewEvidenceInput {
|
|
20
|
-
readonly packageName: string;
|
|
21
|
-
readonly version: string;
|
|
22
|
-
readonly commit: string;
|
|
23
|
-
readonly tarball: string;
|
|
24
|
-
readonly integrity: string;
|
|
25
|
-
readonly shasum: string;
|
|
26
|
-
readonly platform: NodeJS.Platform;
|
|
27
|
-
readonly architecture: string;
|
|
28
|
-
readonly recordedAt: string;
|
|
29
|
-
}
|
|
30
|
-
export interface UncertifiedDevelopmentPreviewEvidence extends UncertifiedDevelopmentPreviewEvidenceInput {
|
|
31
|
-
readonly schema: typeof PREVIEW_RELEASE_SCHEMA;
|
|
32
|
-
readonly channel: "next";
|
|
33
|
-
readonly certificationStatus: "uncertified-development-preview";
|
|
34
|
-
readonly terminalCapability: "owned-ui";
|
|
35
|
-
readonly manualAcceptance: "accepted";
|
|
36
|
-
readonly physicalHostCertification: "deferred";
|
|
37
|
-
readonly crossPlatformCertification: "deferred";
|
|
38
|
-
readonly stableReleaseEligible: false;
|
|
39
|
-
}
|
|
40
|
-
export declare function createUncertifiedDevelopmentPreviewEvidence(input: UncertifiedDevelopmentPreviewEvidenceInput): UncertifiedDevelopmentPreviewEvidence;
|
|
41
|
-
export declare function requireManuallyAcceptedDevelopmentPreview(version: string, acceptedVersion: string): void;
|
|
42
|
-
export declare function selectDevelopmentPreviewCandidate(currentVersion: string, publishedVersions: readonly string[]): DevelopmentPreviewCandidate;
|
|
43
|
-
/**
|
|
44
|
-
* Treats npm's process result as provisional: browser-auth completion can fail
|
|
45
|
-
* after the immutable upload succeeds. Registry identity remains authoritative.
|
|
46
|
-
*/
|
|
47
|
-
export declare function publishDevelopmentPreviewWithRecovery(publish: () => Promise<void>, verify: () => Promise<void>): Promise<DevelopmentPreviewPublishResult>;
|
|
48
|
-
export declare function verifyDevelopmentPreviewRegistry(version: string, observe: () => Promise<DevelopmentPreviewRegistryState>, repairNextTag: () => Promise<void>, options?: DevelopmentPreviewVerificationOptions): Promise<void>;
|
|
49
|
-
export declare function developmentPreviewTarballName(packageName: string, version: string): string;
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
import { compare, inc, prerelease, valid } from "semver";
|
|
2
|
-
import { PRODUCT_IDENTITY } from "../../product-identity.js";
|
|
3
|
-
export const PREVIEW_RELEASE_SCHEMA = PRODUCT_IDENTITY.evidence.previewReleaseSchema;
|
|
4
|
-
export function createUncertifiedDevelopmentPreviewEvidence(input) {
|
|
5
|
-
const prereleaseParts = prerelease(input.version);
|
|
6
|
-
if (valid(input.version) === null || prereleaseParts?.[0] !== "dev") {
|
|
7
|
-
throw new Error(`uncertified preview requires a development prerelease: ${input.version}`);
|
|
8
|
-
}
|
|
9
|
-
return {
|
|
10
|
-
schema: PREVIEW_RELEASE_SCHEMA,
|
|
11
|
-
channel: "next",
|
|
12
|
-
certificationStatus: "uncertified-development-preview",
|
|
13
|
-
terminalCapability: "owned-ui",
|
|
14
|
-
manualAcceptance: "accepted",
|
|
15
|
-
physicalHostCertification: "deferred",
|
|
16
|
-
crossPlatformCertification: "deferred",
|
|
17
|
-
stableReleaseEligible: false,
|
|
18
|
-
...input,
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
export function requireManuallyAcceptedDevelopmentPreview(version, acceptedVersion) {
|
|
22
|
-
const acceptedPrerelease = prerelease(acceptedVersion);
|
|
23
|
-
if (valid(acceptedVersion) === null || acceptedPrerelease?.[0] !== "dev") {
|
|
24
|
-
throw new Error(`invalid manually accepted development preview: ${acceptedVersion}`);
|
|
25
|
-
}
|
|
26
|
-
if (version !== acceptedVersion) {
|
|
27
|
-
throw new Error(`development preview ${version} has no exact manual acceptance; accepted version is ${acceptedVersion}`);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
export function selectDevelopmentPreviewCandidate(currentVersion, publishedVersions) {
|
|
31
|
-
if (valid(currentVersion) === null)
|
|
32
|
-
throw new Error(`invalid current package version: ${currentVersion}`);
|
|
33
|
-
const published = publishedVersions.map(version => {
|
|
34
|
-
if (valid(version) === null)
|
|
35
|
-
throw new Error(`invalid published package version: ${version}`);
|
|
36
|
-
return version;
|
|
37
|
-
});
|
|
38
|
-
const publishedSet = new Set(published);
|
|
39
|
-
const highestPublished = published.reduce((highest, version) => highest === null || compare(version, highest) > 0 ? version : highest, null);
|
|
40
|
-
const currentPrerelease = prerelease(currentVersion);
|
|
41
|
-
const currentIsUnpublishedLeadingDev = currentPrerelease?.[0] === "dev"
|
|
42
|
-
&& !publishedSet.has(currentVersion)
|
|
43
|
-
&& (highestPublished === null || compare(currentVersion, highestPublished) > 0);
|
|
44
|
-
if (currentIsUnpublishedLeadingDev)
|
|
45
|
-
return { version: currentVersion, requiresVersionCommit: false };
|
|
46
|
-
const base = highestPublished === null || compare(currentVersion, highestPublished) > 0
|
|
47
|
-
? currentVersion
|
|
48
|
-
: highestPublished;
|
|
49
|
-
const basePrerelease = prerelease(base);
|
|
50
|
-
let candidate = basePrerelease?.[0] === "dev"
|
|
51
|
-
? inc(base, "prerelease", "dev")
|
|
52
|
-
: inc(base, "prepatch", "dev");
|
|
53
|
-
if (candidate === null)
|
|
54
|
-
throw new Error(`could not increment development preview from ${base}`);
|
|
55
|
-
while (publishedSet.has(candidate)) {
|
|
56
|
-
candidate = inc(candidate, "prerelease", "dev");
|
|
57
|
-
if (candidate === null)
|
|
58
|
-
throw new Error(`could not increment development preview from ${base}`);
|
|
59
|
-
}
|
|
60
|
-
return { version: candidate, requiresVersionCommit: candidate !== currentVersion };
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Treats npm's process result as provisional: browser-auth completion can fail
|
|
64
|
-
* after the immutable upload succeeds. Registry identity remains authoritative.
|
|
65
|
-
*/
|
|
66
|
-
export async function publishDevelopmentPreviewWithRecovery(publish, verify) {
|
|
67
|
-
let publishError = null;
|
|
68
|
-
try {
|
|
69
|
-
await publish();
|
|
70
|
-
}
|
|
71
|
-
catch (error) {
|
|
72
|
-
publishError = error;
|
|
73
|
-
}
|
|
74
|
-
try {
|
|
75
|
-
await verify();
|
|
76
|
-
return { published: true, recoveredPublishError: publishError };
|
|
77
|
-
}
|
|
78
|
-
catch (verificationError) {
|
|
79
|
-
if (publishError !== null)
|
|
80
|
-
throw new AggregateError([publishError, verificationError], "npm publish failed and the exact version could not be verified in the registry");
|
|
81
|
-
throw verificationError;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
export async function verifyDevelopmentPreviewRegistry(version, observe, repairNextTag, options = {}) {
|
|
85
|
-
const attempts = options.attempts ?? 12;
|
|
86
|
-
const delayMs = options.delayMs ?? 2_000;
|
|
87
|
-
const delay = options.delay ?? (async (milliseconds) => await new Promise(resolvePromise => setTimeout(resolvePromise, milliseconds)));
|
|
88
|
-
if (!Number.isInteger(attempts) || attempts < 1)
|
|
89
|
-
throw new Error(`invalid registry verification attempts: ${attempts}`);
|
|
90
|
-
let repaired = false;
|
|
91
|
-
let last = { published: false, nextVersion: null };
|
|
92
|
-
for (let attempt = 1; attempt <= attempts; attempt += 1) {
|
|
93
|
-
last = await observe();
|
|
94
|
-
if (last.published && last.nextVersion === version)
|
|
95
|
-
return;
|
|
96
|
-
if (last.published && !repaired) {
|
|
97
|
-
await repairNextTag();
|
|
98
|
-
repaired = true;
|
|
99
|
-
}
|
|
100
|
-
if (attempt < attempts)
|
|
101
|
-
await delay(delayMs);
|
|
102
|
-
}
|
|
103
|
-
if (!last.published)
|
|
104
|
-
throw new Error(`npm registry did not expose published version ${version} after ${attempts} attempts`);
|
|
105
|
-
throw new Error(`npm next resolved ${last.nextVersion ?? "nothing"}; expected ${version} after ${attempts} attempts`);
|
|
106
|
-
}
|
|
107
|
-
export function developmentPreviewTarballName(packageName, version) {
|
|
108
|
-
if (valid(version) === null)
|
|
109
|
-
throw new Error(`invalid development preview version: ${version}`);
|
|
110
|
-
const unscopedName = packageName.startsWith("@") ? packageName.slice(1).replace("/", "-") : packageName;
|
|
111
|
-
if (!/^[a-z0-9._-]+$/i.test(unscopedName))
|
|
112
|
-
throw new Error(`invalid package name: ${packageName}`);
|
|
113
|
-
return `${unscopedName}-${version}.tgz`;
|
|
114
|
-
}
|