@runeditrun/rer 0.2.114 → 0.2.116
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/cli/agent-door.mjs +7 -1
- package/cli/contract-status.mjs +1 -1
- package/cli/contract.mjs +1 -1
- package/cli/release-candidate.mjs +32 -0
- package/cli/release.mjs +4 -0
- package/global/CHANGELOG.md +25 -0
- package/global/main.mjs +1 -0
- package/modules/release/README.md +29 -0
- package/modules/release/candidate.mjs +60 -0
- package/package.json +1 -1
package/cli/agent-door.mjs
CHANGED
|
@@ -33,7 +33,13 @@ function finish(result, report) {
|
|
|
33
33
|
export async function checkAgentDoor(root, { declaration, setupManifest, owner, report = console.log } = {}) {
|
|
34
34
|
const declared = await readAgentSurface(root);
|
|
35
35
|
if (!declared) { report('Agent door conformance: undeclared (no agent-surface.json).'); return { declared: false }; }
|
|
36
|
-
const
|
|
36
|
+
const surface = declared.surface;
|
|
37
|
+
if (surface && typeof surface === 'object' && !Array.isArray(surface) && Object.keys(surface).length === 1
|
|
38
|
+
&& surface.verification && typeof surface.verification === 'object' && !Array.isArray(surface.verification)) {
|
|
39
|
+
report('Agent door conformance: undeclared (verification-only agent-surface.json)');
|
|
40
|
+
return { declared: false };
|
|
41
|
+
}
|
|
42
|
+
const validation = validateAgentSurface(surface, { contract: declared.contract });
|
|
37
43
|
if (!validation.ok) return finish(validation, report);
|
|
38
44
|
const manifest = setupManifest ?? JSON.parse(await readFile(join(root, 'rer-setup.json'), 'utf8'));
|
|
39
45
|
const claim = manifest.steps?.find(step => step.type === 'owner-claim');
|
package/cli/contract-status.mjs
CHANGED
|
@@ -26,7 +26,7 @@ async function isManagedCopy(root) {
|
|
|
26
26
|
const value = JSON.parse(await readFile(path, 'utf8'));
|
|
27
27
|
return !!value && typeof value === 'object' && !Array.isArray(value) && Object.keys(value).sort().join(',') === 'commit,repository,schema,tag'
|
|
28
28
|
&& value.schema === 1 && /^[A-Za-z0-9][A-Za-z0-9-]{0,38}\/[A-Za-z0-9._-]{1,100}$/.test(value.repository)
|
|
29
|
-
&& /^v?(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/.test(value.tag) && /^[a-f0-9]{40}$/i.test(value.commit);
|
|
29
|
+
&& /^v?(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)(?:-(?:0|[1-9]\d*|[0-9A-Za-z-]*[A-Za-z-][0-9A-Za-z-]*)(?:\.(?:0|[1-9]\d*|[0-9A-Za-z-]*[A-Za-z-][0-9A-Za-z-]*))*)?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/.test(value.tag) && /^[a-f0-9]{40}$/i.test(value.commit);
|
|
30
30
|
} catch { return false; }
|
|
31
31
|
}
|
|
32
32
|
|
package/cli/contract.mjs
CHANGED
|
@@ -40,7 +40,7 @@ export const releaseFlags = ['--repo', '--project', '--repository', '--output',
|
|
|
40
40
|
export const releaseVerb = Object.freeze({
|
|
41
41
|
bootstrap: 'before', flags: [...commonFlags, ...releaseFlags],
|
|
42
42
|
// These operate on supplied files and keys, without running project code.
|
|
43
|
-
subcommands: Object.freeze({ sign: { bootstrap: 'never' }, receipt: { bootstrap: 'never' }, keygen: { bootstrap: 'never' } }),
|
|
43
|
+
subcommands: Object.freeze({ candidate: { bootstrap: 'never' }, sign: { bootstrap: 'never' }, receipt: { bootstrap: 'never' }, keygen: { bootstrap: 'never' } }),
|
|
44
44
|
});
|
|
45
45
|
// All checkout commands, including those supplied by rer rather than declared
|
|
46
46
|
// as seed operations. Bootstrap belongs to the selected command: before
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import {resolve} from 'node:path';
|
|
2
|
+
import {prepareCandidate} from '../modules/release/candidate.mjs';
|
|
3
|
+
|
|
4
|
+
export const candidateHelp = `Usage: rer release candidate --tag vVERSION-PRERELEASE [--cwd DIR] [--json]
|
|
5
|
+
|
|
6
|
+
Prepare stage-only version metadata in one local commit on the caller's checkout.
|
|
7
|
+
Updates only version in seed.json, package.json and RELEASE.json; requires a clean
|
|
8
|
+
checkout with matching committed versions and the caller's Git commit identity.
|
|
9
|
+
Repeating the same tag is a no-op. Accepts the current version core or the next
|
|
10
|
+
patch core. Stable tags require the normal release metadata path.
|
|
11
|
+
|
|
12
|
+
The output version always contains a SemVer pre-release suffix (for example
|
|
13
|
+
0.4.25-rc1); production consumers must refuse pre-release tags. Stage only: do not
|
|
14
|
+
publish a GitHub Release, Site or registry entry, or expose it to outside users.
|
|
15
|
+
Creates no tag, artifact, push, signature or deployment. Existing producer gates
|
|
16
|
+
still apply to the returned commit; run its two-commit rehearsal before stage use.
|
|
17
|
+
`;
|
|
18
|
+
|
|
19
|
+
export async function candidateCommand(args) {
|
|
20
|
+
try {
|
|
21
|
+
let cwd=process.cwd(), tag; const seen=new Set();
|
|
22
|
+
for (let index=0; index<args.length; index++) {
|
|
23
|
+
const flag=args[index];
|
|
24
|
+
if (seen.has(flag)) throw Error(`Repeated candidate flag ${flag}.`); seen.add(flag);
|
|
25
|
+
if (flag==='--help') {console.log(candidateHelp);return 0;}
|
|
26
|
+
if (flag==='--json' || flag==='--non-interactive') continue;
|
|
27
|
+
if (!['--cwd','--tag'].includes(flag) || !args[index+1]?.trim() || args[index+1].startsWith('--')) throw Error('Use rer release candidate --tag vVERSION-PRERELEASE [--cwd DIR] [--json].');
|
|
28
|
+
const value=args[++index]; if(flag==='--cwd')cwd=resolve(value);else tag=value;
|
|
29
|
+
}
|
|
30
|
+
console.log(JSON.stringify(prepareCandidate(cwd, tag), null, 2));return 0;
|
|
31
|
+
} catch(error) {console.error(error.message);return 2;}
|
|
32
|
+
}
|
package/cli/release.mjs
CHANGED
|
@@ -38,6 +38,9 @@ Without --tag, write a preview. This command never pushes, uploads or deploys.
|
|
|
38
38
|
--no-queue Bypass the job queue only in the original CI environment.
|
|
39
39
|
--help Print this help without performing release work.
|
|
40
40
|
|
|
41
|
+
Stage-only metadata preparation:
|
|
42
|
+
rer release candidate --tag vVERSION-PRERELEASE [--cwd DIR] [--json]
|
|
43
|
+
|
|
41
44
|
Signing and receipt commands:
|
|
42
45
|
rer release sign --artifact DIR (--key-file FILE | --key-stdin) [--scope test|rer] [--publisher NAMESPACE]
|
|
43
46
|
rer release receipt --artifact DIR --anchors FILE [--environment test] [--after VERSION:SHA256]
|
|
@@ -52,6 +55,7 @@ Key generation requires non-terminal stdout; --key-stdin requires non-terminal s
|
|
|
52
55
|
|
|
53
56
|
export async function dispatchRelease(args) {
|
|
54
57
|
if (args.length === 1 && args[0] === '--help') { console.log(releaseHelp); return 0; }
|
|
58
|
+
if (args[0] === 'candidate') return (await import('./release-candidate.mjs')).candidateCommand(args.slice(1));
|
|
55
59
|
if (Object.hasOwn(releaseVerb.subcommands, args[0])) return (await import('../modules/release/signing-cli.mjs')).dispatchSigning(args[0], args.slice(1));
|
|
56
60
|
try {
|
|
57
61
|
const options = {};
|
package/global/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.2.116
|
|
4
|
+
|
|
5
|
+
### Verification-only agent surfaces
|
|
6
|
+
|
|
7
|
+
- `rer verify` treats an `agent-surface.json` whose only top-level key is an object-valued `verification` as an undeclared agent door and returns `agentDoor: {declared:false}`. Any other top-level key, including schema or version metadata, keeps full agent declaration validation and conformance. Offline `rer check` still validates a present file as a full agent declaration.
|
|
8
|
+
- `rer size` still reads `verification.owner` for its disposable native owner and `verification.publicHosts` for admitted deployment hostname variables. A seed without agent tools can use those size-check settings without declaring an agent door; the actual setup flow is unchanged.
|
|
9
|
+
|
|
10
|
+
### Auth setup fixture diagnostics
|
|
11
|
+
|
|
12
|
+
- The Auth setup test fixture reports redacted refusal classifications for port availability/listening, private input custody and malformed local dev keys, plus whether a port was announced and whether the app port equals the controlled provider edge. These are fixture-only diagnostics; they do not change runtime setup behavior or contact a real provider.
|
|
13
|
+
|
|
14
|
+
Seeds receive the verification-only CLI support after adopting this rer through their pinned package or refreshed source. Preparing this release establishes no seed adoption, deployed behavior or production result. The actual diff adds no migrations and touches neither modules/import-kit nor modules/portability.
|
|
15
|
+
|
|
16
|
+
## 0.2.115
|
|
17
|
+
|
|
18
|
+
### Stage candidate metadata and installed-copy recognition
|
|
19
|
+
|
|
20
|
+
- New `rer release candidate --tag vVERSION-PRERELEASE --cwd DIR` prepares stage-only metadata in one local commit using the caller's Git identity. It changes only the top-level `version` in `seed.json`, `package.json` and `RELEASE.json`, preserving other metadata and formatting. A clean checkout with matching committed versions is required; the candidate must use the current version core or its next patch. Repeating the same tag is a no-op. Dirty checkouts, stable tags, malformed labels and unrelated cores are refused before writing.
|
|
21
|
+
- The command runs without project bootstrap and returns the exact commit, version, tag, `stageOnly: true` and whether it changed. It creates no tag, artifact, push, signature or deployment. Candidates require rehearsal and the existing producer gates before stage use; they are not for GitHub Release, Site/registry publication or outside-user resolution. Production consumers must refuse pre-release tags. Stable producer metadata, tag matching, verification, scans and receipts remain unchanged.
|
|
22
|
+
- Installed-copy checks now recognize valid SemVer pre-release upstream labels. A managed installation projection can omit publisher `.github` automation evidence during its two-commit rehearsal, as stable installed copies already can. Authoring checkouts still require publisher evidence, and other evidence paths remain required in installed copies. The global launcher and regenerated default-seed CLI expose the candidate command.
|
|
23
|
+
|
|
24
|
+
0.2.114 added `rer rehearse`; it was published but did not complete release qualification. 0.2.115 adds the candidate metadata and installed-copy recognition changes above and carries that rehearsal support forward. This prepares CLI support only: seed lanes and signers must adopt the rer and rehearse their own committed sources. No seed adoption, deployed behavior or production result is established here.
|
|
25
|
+
|
|
26
|
+
Code and documentation only: the actual diff since rer-v0.2.114 adds no migrations and touches neither modules/import-kit nor modules/portability. No provider calls are needed for candidate metadata preparation.
|
|
27
|
+
|
|
3
28
|
## 0.2.114
|
|
4
29
|
|
|
5
30
|
### Pre-install rehearsal
|
package/global/main.mjs
CHANGED
|
@@ -61,6 +61,7 @@ export async function main(argv) {
|
|
|
61
61
|
handleBrokenPipes();
|
|
62
62
|
const [verb] = argv;
|
|
63
63
|
const installsFirst = checkoutBootstrap(argv) === 'before';
|
|
64
|
+
if (verb === 'release' && argv[1] === 'candidate') return (await import('../cli/release-candidate.mjs')).candidateCommand(argv.slice(2));
|
|
64
65
|
if (verb === 'rehearse') return (await import('../cli/rehearse.mjs')).rehearseCommand(argv.slice(1));
|
|
65
66
|
if (verb === '--version' || verb === '-v') return (await import('./version.mjs')).versionCommand(argv);
|
|
66
67
|
if (verb === 'queue' && argv.length === 2 && argv[1] === '--help') {
|
|
@@ -1,5 +1,34 @@
|
|
|
1
1
|
# `rer release`
|
|
2
2
|
|
|
3
|
+
For a stage-only candidate from a landed seed commit, use a clean checkout on
|
|
4
|
+
its candidate branch:
|
|
5
|
+
|
|
6
|
+
```sh
|
|
7
|
+
rer release candidate --cwd /path/to/seed --tag v0.4.25-rc1
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
This writes only the top-level `version` fields in committed `seed.json`,
|
|
11
|
+
`package.json` and `RELEASE.json`, preserving other metadata and formatting,
|
|
12
|
+
and commits them together using the caller's Git identity. It requires their
|
|
13
|
+
existing versions to agree and accepts a SemVer pre-release of the current core
|
|
14
|
+
or its immediately following patch (for example, `0.4.24` to `0.4.25-rc1`).
|
|
15
|
+
Minor and major versions use the normal explicit metadata preparation. Repeating
|
|
16
|
+
the same tag succeeds without another commit. Dirty checkouts, stable tags,
|
|
17
|
+
malformed labels and unrelated version cores are refused before any write.
|
|
18
|
+
`--json` returns `stageOnly: true`, the version, tag, exact commit and whether
|
|
19
|
+
it changed. No project code, install, producer, tag or remote action runs.
|
|
20
|
+
|
|
21
|
+
The committed version always contains the SemVer pre-release suffix; production
|
|
22
|
+
consumers must refuse pre-release tags. These candidates are stage only: no
|
|
23
|
+
GitHub Release, Site/registry publication or outside-user release resolution.
|
|
24
|
+
Run `rer rehearse --cwd /path/to/seed --ref <candidate-commit>` and the existing
|
|
25
|
+
producer gates on the returned commit before stage use. To rehearse the exact
|
|
26
|
+
candidate label, use that label as `--ref` once it resolves locally. Installed
|
|
27
|
+
copies with a valid pre-release `rer-upstream.json` get the same narrowly scoped
|
|
28
|
+
publisher-automation evidence exception as stable installed copies. Authoring
|
|
29
|
+
checkouts still enforce every evidence file. The ordinary stable producer's
|
|
30
|
+
metadata, tag matching, verification, scans and receipts are unchanged.
|
|
31
|
+
|
|
3
32
|
Before a Base release, run `pnpm verify:scale` for the full import-kit datasets. It
|
|
4
33
|
is not part of `pnpm verify`: run it on a machine with at least 16 GB of memory and
|
|
5
34
|
nothing else heavy running, because its D1 datasets are large.
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import {writeFileSync} from 'node:fs';
|
|
2
|
+
import {execFileSync} from 'node:child_process';
|
|
3
|
+
import {resolve} from 'node:path';
|
|
4
|
+
import {git, inspectSource} from './source.mjs';
|
|
5
|
+
|
|
6
|
+
const core = '(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)';
|
|
7
|
+
const identifier = '(?:0|[1-9]\\d*|[0-9A-Za-z-]*[A-Za-z-][0-9A-Za-z-]*)';
|
|
8
|
+
const version = new RegExp(`^${core}(?:-${identifier}(?:\\.${identifier})*)?$`);
|
|
9
|
+
const candidate = new RegExp(`^v${core}-${identifier}(?:\\.${identifier})*$`);
|
|
10
|
+
const files = ['seed.json', 'package.json', 'RELEASE.json'];
|
|
11
|
+
|
|
12
|
+
// A candidate uses the current core or the immediately following patch.
|
|
13
|
+
// Minor and major releases keep their normal explicit metadata preparation.
|
|
14
|
+
function allowedCore(current, requested) {
|
|
15
|
+
const [major, minor, patch] = current;
|
|
16
|
+
return [current, [major, minor, patch + 1]]
|
|
17
|
+
.some(parts => parts.every((part, index) => part === requested[index]));
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function prepareCandidate(cwd, tag) {
|
|
21
|
+
const wanted = candidate.exec(tag ?? '');
|
|
22
|
+
if (!wanted) throw Error('Candidate requires --tag vMAJOR.MINOR.PATCH-PRERELEASE; stable tags use the normal release metadata path.');
|
|
23
|
+
const repo = git(resolve(cwd), 'rev-parse', '--show-toplevel').toString().trim();
|
|
24
|
+
const source = inspectSource(repo, 'HEAD'), current = version.exec(source.seed.version);
|
|
25
|
+
const requested = wanted.slice(1, 4).map(Number), previous = current?.slice(1, 4).map(Number);
|
|
26
|
+
if (!previous || ![...previous, ...requested].every(Number.isSafeInteger) || !allowedCore(previous, requested))
|
|
27
|
+
throw Error('Candidate must be a pre-release of the current version or its next patch version.');
|
|
28
|
+
const next = tag.slice(1);
|
|
29
|
+
if (source.seed.version === next) return {stageOnly:true, tag, version:next, commit:source.commit, changed:false};
|
|
30
|
+
// Preserve the caller's configured identity; the source reader deliberately
|
|
31
|
+
// ignores global Git config, so it must not be used to create this commit.
|
|
32
|
+
const commitGit = (...args) => execFileSync('git', ['-C', repo, '-c', 'core.hooksPath=/dev/null', '-c', 'commit.gpgSign=false', ...args], {stdio:['ignore','pipe','pipe']});
|
|
33
|
+
commitGit('var', 'GIT_AUTHOR_IDENT'); commitGit('var', 'GIT_COMMITTER_IDENT');
|
|
34
|
+
const changes = files.map(path => {
|
|
35
|
+
const bytes = source.bytes(path).toString(), value = JSON.parse(bytes);
|
|
36
|
+
// Preserve all other metadata and the caller's formatting. The committed
|
|
37
|
+
// top-level version is the only JSON value that may change.
|
|
38
|
+
const before = JSON.stringify(value);
|
|
39
|
+
let depth = 0, result = '', end = 0;
|
|
40
|
+
const strings = /"(?:[^"\\]|\\.)*"|[{}\[\]]/g;
|
|
41
|
+
for (const token of bytes.matchAll(strings)) {
|
|
42
|
+
if (['{','['].includes(token[0])) depth++;
|
|
43
|
+
else if (['}',']'].includes(token[0])) depth--;
|
|
44
|
+
else if (depth === 1 && JSON.parse(token[0]) === 'version') {
|
|
45
|
+
const tail = bytes.slice(token.index + token[0].length), match = /^\s*:\s*("(?:[^"\\]|\\.)*")/.exec(tail);
|
|
46
|
+
if (!match) continue;
|
|
47
|
+
const start = token.index + token[0].length + match[0].length - match[1].length;
|
|
48
|
+
result += bytes.slice(end, start) + JSON.stringify(next); end = start + match[1].length;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
result += bytes.slice(end);
|
|
52
|
+
value.version = next;
|
|
53
|
+
if (before === JSON.stringify(value) || JSON.stringify(JSON.parse(result)) !== JSON.stringify(value)) throw Error(`Cannot update only ${path} version.`);
|
|
54
|
+
return {path, bytes:result};
|
|
55
|
+
});
|
|
56
|
+
for (const {path, bytes} of changes) writeFileSync(resolve(repo, path), bytes);
|
|
57
|
+
git(repo, 'add', '--', ...files);
|
|
58
|
+
commitGit('commit', '-m', `Prepare stage-only candidate ${tag}`);
|
|
59
|
+
return {stageOnly:true, tag, version:next, commit:git(repo, 'rev-parse', 'HEAD').toString().trim(), changed:true};
|
|
60
|
+
}
|