@sublang/spex 5.0.0 → 7.0.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +453 -41
- package/dist/cli.js +12 -1
- package/dist/commands/add.d.ts +1 -1
- package/dist/commands/add.js +3 -3
- package/dist/commands/auth-target.d.ts +1 -0
- package/dist/commands/auth-target.js +4 -2
- package/dist/commands/environment.d.ts +15 -21
- package/dist/commands/environment.js +43 -57
- package/dist/commands/export.js +2 -2
- package/dist/commands/home.d.ts +2 -2
- package/dist/commands/home.js +3 -3
- package/dist/commands/list.js +1 -1
- package/dist/commands/login.js +12 -7
- package/dist/commands/logout.js +2 -3
- package/dist/commands/publish.js +16 -16
- package/dist/commands/remove.js +1 -1
- package/dist/commands/run.d.ts +1 -1
- package/dist/commands/run.js +22 -3
- package/dist/commands/search.js +1 -1
- package/dist/commands/settle.d.ts +1 -1
- package/dist/commands/settle.js +3 -3
- package/dist/commands/whoami.js +2 -6
- package/dist/guards/approval.d.ts +56 -0
- package/dist/guards/approval.js +158 -0
- package/dist/guards/checks.d.ts +207 -0
- package/dist/guards/checks.js +681 -0
- package/dist/guards/commands.d.ts +15 -0
- package/dist/guards/commands.js +313 -0
- package/dist/guards/copy.d.ts +67 -0
- package/dist/guards/copy.js +306 -0
- package/dist/guards/declaration.d.ts +45 -0
- package/dist/guards/declaration.js +224 -0
- package/dist/guards/files.d.ts +137 -0
- package/dist/guards/files.js +544 -0
- package/dist/guards/harness.d.ts +58 -0
- package/dist/guards/harness.js +420 -0
- package/dist/guards/items.d.ts +61 -0
- package/dist/guards/items.js +161 -0
- package/dist/guards/patch.d.ts +55 -0
- package/dist/guards/patch.js +258 -0
- package/dist/guards/processes.d.ts +49 -0
- package/dist/guards/processes.js +233 -0
- package/dist/guards/proofs.d.ts +88 -0
- package/dist/guards/proofs.js +503 -0
- package/dist/guards/records.d.ts +176 -0
- package/dist/guards/records.js +513 -0
- package/dist/guards/report.d.ts +26 -0
- package/dist/guards/report.js +492 -0
- package/dist/guards/runner.d.ts +42 -0
- package/dist/guards/runner.js +167 -0
- package/dist/guards/tla.d.ts +51 -0
- package/dist/guards/tla.js +352 -0
- package/dist/guards/tlapm.d.ts +81 -0
- package/dist/guards/tlapm.js +172 -0
- package/dist/guards/tlc.d.ts +191 -0
- package/dist/guards/tlc.js +457 -0
- package/dist/guards/translation.d.ts +66 -0
- package/dist/guards/translation.js +202 -0
- package/dist/guards/types.d.ts +185 -0
- package/dist/guards/types.js +437 -0
- package/dist/guards/verify.d.ts +290 -0
- package/dist/guards/verify.js +1191 -0
- package/dist/guards/xml.d.ts +18 -0
- package/dist/guards/xml.js +105 -0
- package/dist/lib/environment/archive.d.ts +16 -3
- package/dist/lib/environment/archive.js +39 -8
- package/dist/lib/environment/builtins.d.ts +10 -12
- package/dist/lib/environment/builtins.js +18 -20
- package/dist/lib/environment/exports.d.ts +14 -13
- package/dist/lib/environment/exports.js +31 -16
- package/dist/lib/environment/format.d.ts +2 -2
- package/dist/lib/environment/format.js +3 -3
- package/dist/lib/environment/git-source.js +6 -3
- package/dist/lib/environment/install.d.ts +14 -16
- package/dist/lib/environment/install.js +66 -61
- package/dist/lib/environment/lock.d.ts +4 -3
- package/dist/lib/environment/lock.js +6 -5
- package/dist/lib/environment/marker.js +1 -2
- package/dist/lib/environment/own-paths.d.ts +7 -10
- package/dist/lib/environment/own-paths.js +10 -13
- package/dist/lib/environment/placed-record.d.ts +3 -2
- package/dist/lib/environment/placed-record.js +5 -4
- package/dist/lib/environment/registries.d.ts +7 -9
- package/dist/lib/environment/registries.js +9 -36
- package/dist/lib/environment/registry.d.ts +6 -7
- package/dist/lib/environment/registry.js +12 -12
- package/dist/lib/environment/requests.d.ts +6 -5
- package/dist/lib/environment/requests.js +6 -8
- package/dist/lib/environment/resolve.d.ts +4 -4
- package/dist/lib/environment/resolve.js +3 -4
- package/dist/lib/environment/store.d.ts +34 -8
- package/dist/lib/environment/store.js +138 -43
- package/dist/lib/files.d.ts +72 -12
- package/dist/lib/files.js +200 -65
- package/dist/lib/git-host.d.ts +52 -258
- package/dist/lib/git-host.js +52 -265
- package/dist/lib/home-file.d.ts +13 -10
- package/dist/lib/home-file.js +28 -18
- package/dist/lib/instance.d.ts +1 -1
- package/dist/lib/instance.js +1 -1
- package/dist/lint.d.ts +22 -0
- package/dist/lint.js +36 -0
- package/dist/testing/standin-registry.js +1 -1
- package/package.json +7 -3
- package/scaffold/.file-history.json +14 -7
- package/scaffold/i18n/zh/source-pins.json +41 -0
- package/scaffold/i18n/zh/specs/decisions/000-spec-structure-format.md +0 -1
- package/scaffold/i18n/zh/specs/intents/000-spdx-headers.md +0 -1
- package/scaffold/i18n/zh/specs/map.md +0 -1
- package/scaffold/i18n/zh/specs/meta.md +18 -35
- package/scaffold/i18n/zh/specs/packages/git.md +0 -1
- package/scaffold/i18n/zh/specs/packages/licensing.md +0 -1
- package/scaffold/specs/meta.md +18 -3
- package/scripts/test-exit-guard.mjs +28 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** One element: its name, its child elements in order and the text
|
|
2
|
+
* directly inside it, its entities read. */
|
|
3
|
+
export type XmlElement = {
|
|
4
|
+
tag: string;
|
|
5
|
+
children: XmlElement[];
|
|
6
|
+
text: string;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Read an XML document into its root element. Throws a GuardError
|
|
10
|
+
* where the text is not XML of this shape: an attribute on an
|
|
11
|
+
* element, a tag that does not close, or text outside the root.
|
|
12
|
+
*/
|
|
13
|
+
export declare function parseXml(text: string): XmlElement;
|
|
14
|
+
/** The first child element named `tag`, or undefined. */
|
|
15
|
+
export declare function child(element: XmlElement | undefined, tag: string): XmlElement | undefined;
|
|
16
|
+
/** The text of the element at `path` under `element`, trimmed, or
|
|
17
|
+
* undefined where there is none. */
|
|
18
|
+
export declare function textAt(element: XmlElement | undefined, ...path: string[]): string | undefined;
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
// SPDX-FileCopyrightText: 2026 SubLang International <https://sublang.ai>
|
|
3
|
+
/*
|
|
4
|
+
* Guards package, DR-244 and DR-252: the smallest reader of the XML
|
|
5
|
+
* that TLC's parser writes of a module (`tla2sany.xml.XMLExporter`),
|
|
6
|
+
* enough to tell what a proof file holds. That XML has elements, text
|
|
7
|
+
* and the five predefined entities, and no attribute but in its
|
|
8
|
+
* declaration; this reads exactly that and refuses what it cannot
|
|
9
|
+
* read, so nothing it skips can hide a unit. It adds no dependency.
|
|
10
|
+
*/
|
|
11
|
+
import { GuardError } from "./types.js";
|
|
12
|
+
const ENTITIES = { lt: "<", gt: ">", amp: "&", quot: '"', apos: "'" };
|
|
13
|
+
/** Text with its entities read: the five named ones and numeric ones. */
|
|
14
|
+
function decoded(text, at) {
|
|
15
|
+
return text.replace(/&(#x[0-9A-Fa-f]+|#[0-9]+|[A-Za-z]+);|&/g, (whole, name) => {
|
|
16
|
+
if (name === undefined)
|
|
17
|
+
throw new GuardError(`the XML holds a lone & near character ${at}`);
|
|
18
|
+
if (name.startsWith("#x"))
|
|
19
|
+
return String.fromCodePoint(Number.parseInt(name.slice(2), 16));
|
|
20
|
+
if (name.startsWith("#"))
|
|
21
|
+
return String.fromCodePoint(Number.parseInt(name.slice(1), 10));
|
|
22
|
+
const named = ENTITIES[name];
|
|
23
|
+
if (named === undefined)
|
|
24
|
+
throw new GuardError(`the XML holds an unknown entity ${whole} near character ${at}`);
|
|
25
|
+
return named;
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Read an XML document into its root element. Throws a GuardError
|
|
30
|
+
* where the text is not XML of this shape: an attribute on an
|
|
31
|
+
* element, a tag that does not close, or text outside the root.
|
|
32
|
+
*/
|
|
33
|
+
export function parseXml(text) {
|
|
34
|
+
const markup = /<\?[\s\S]*?\?>|<!--[\s\S]*?-->|<!\[CDATA\[([\s\S]*?)\]\]>|<(\/?)([A-Za-z_][\w.:-]*)(\s*)(\/?)>|</g;
|
|
35
|
+
const open = [];
|
|
36
|
+
let root = null;
|
|
37
|
+
let last = 0;
|
|
38
|
+
const textUntil = (end) => {
|
|
39
|
+
const between = text.slice(last, end);
|
|
40
|
+
if (between === "")
|
|
41
|
+
return;
|
|
42
|
+
const top = open[open.length - 1];
|
|
43
|
+
if (top === undefined) {
|
|
44
|
+
if (between.trim() !== "")
|
|
45
|
+
throw new GuardError(`the XML holds text outside its root near character ${last}`);
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
top.text += decoded(between, last);
|
|
49
|
+
};
|
|
50
|
+
for (const found of text.matchAll(markup)) {
|
|
51
|
+
const at = found.index;
|
|
52
|
+
textUntil(at);
|
|
53
|
+
last = at + found[0].length;
|
|
54
|
+
const [whole, cdata, closing, tag, , empty] = found;
|
|
55
|
+
if (whole.startsWith("<?") || whole.startsWith("<!--"))
|
|
56
|
+
continue;
|
|
57
|
+
if (cdata !== undefined) {
|
|
58
|
+
const top = open[open.length - 1];
|
|
59
|
+
if (top === undefined)
|
|
60
|
+
throw new GuardError(`the XML holds text outside its root near character ${at}`);
|
|
61
|
+
top.text += cdata;
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
64
|
+
if (tag === undefined)
|
|
65
|
+
throw new GuardError(`the XML holds a tag this reader does not take near character ${at}`);
|
|
66
|
+
if (closing === "/") {
|
|
67
|
+
const top = open.pop();
|
|
68
|
+
if (top === undefined || top.tag !== tag)
|
|
69
|
+
throw new GuardError(`the XML closes ${tag} where it is not open, near character ${at}`);
|
|
70
|
+
if (open.length === 0)
|
|
71
|
+
root = top;
|
|
72
|
+
continue;
|
|
73
|
+
}
|
|
74
|
+
if (open.length === 0 && root !== null) {
|
|
75
|
+
throw new GuardError(`the XML holds a second root near character ${at}`);
|
|
76
|
+
}
|
|
77
|
+
const element = { tag, children: [], text: "" };
|
|
78
|
+
open[open.length - 1]?.children.push(element);
|
|
79
|
+
if (empty === "/") {
|
|
80
|
+
if (open.length === 0)
|
|
81
|
+
root = element;
|
|
82
|
+
}
|
|
83
|
+
else
|
|
84
|
+
open.push(element);
|
|
85
|
+
}
|
|
86
|
+
textUntil(text.length);
|
|
87
|
+
if (open.length > 0)
|
|
88
|
+
throw new GuardError(`the XML leaves ${open[open.length - 1].tag} open`);
|
|
89
|
+
if (root === null)
|
|
90
|
+
throw new GuardError("the XML holds no element");
|
|
91
|
+
return root;
|
|
92
|
+
}
|
|
93
|
+
/** The first child element named `tag`, or undefined. */
|
|
94
|
+
export function child(element, tag) {
|
|
95
|
+
return element?.children.find((one) => one.tag === tag);
|
|
96
|
+
}
|
|
97
|
+
/** The text of the element at `path` under `element`, trimmed, or
|
|
98
|
+
* undefined where there is none. */
|
|
99
|
+
export function textAt(element, ...path) {
|
|
100
|
+
let at = element;
|
|
101
|
+
for (const tag of path)
|
|
102
|
+
at = child(at, tag);
|
|
103
|
+
return at?.text.trim();
|
|
104
|
+
}
|
|
105
|
+
//# sourceMappingURL=xml.js.map
|
|
@@ -16,9 +16,22 @@ export interface UnpackedRelease {
|
|
|
16
16
|
}
|
|
17
17
|
/** Unpack and check a release archive as the registry does. */
|
|
18
18
|
export declare function unpackRelease(tgz: Uint8Array, pkg: string): UnpackedRelease;
|
|
19
|
-
/**
|
|
20
|
-
*
|
|
21
|
-
|
|
19
|
+
/** Explicit metadata for a publication snapshot; the local package keeps
|
|
20
|
+
* its own identity and license (environments-59). */
|
|
21
|
+
export interface PublicationFields {
|
|
22
|
+
org: string;
|
|
23
|
+
license: string;
|
|
24
|
+
}
|
|
25
|
+
/** Capture and validate the exact bytes a publication will upload. No file
|
|
26
|
+
* is written, including when publication metadata changes the snapshot. */
|
|
27
|
+
export declare function preparePublication(dir: string, publication?: PublicationFields): Promise<{
|
|
28
|
+
source: Manifest;
|
|
29
|
+
manifest: Manifest;
|
|
30
|
+
files: ReleaseFile[];
|
|
31
|
+
archive: Uint8Array;
|
|
32
|
+
}>;
|
|
33
|
+
/** Publish a release folder as it is (environments-59), uploading the
|
|
34
|
+
* same captured bytes that passed validation. */
|
|
22
35
|
export declare function publishRelease(registry: RegistrySource, dir: string): Promise<{
|
|
23
36
|
name: string;
|
|
24
37
|
version: string;
|
|
@@ -7,7 +7,8 @@
|
|
|
7
7
|
// special entry and anything outside the root.
|
|
8
8
|
import { readFileSync } from "node:fs";
|
|
9
9
|
import { join } from "node:path";
|
|
10
|
-
import {
|
|
10
|
+
import { parseDocument } from "yaml";
|
|
11
|
+
import { checkRelease, FormatError, parseManifestText, portablePathIssues, publishIssues, readRelease, sha256Hex } from "./format.js";
|
|
11
12
|
import { gunzip, gzip, readTar, writeTar } from "./tar.js";
|
|
12
13
|
/** Pack files into a release archive rooted at `<pkg>/`. */
|
|
13
14
|
export function packFiles(pkg, files) {
|
|
@@ -78,14 +79,44 @@ export function unpackRelease(tgz, pkg) {
|
|
|
78
79
|
issues.push(...checkRelease((path) => data.get(path), parsed.manifest, files));
|
|
79
80
|
return { manifest: parsed.manifest, files, data, issues };
|
|
80
81
|
}
|
|
81
|
-
/**
|
|
82
|
-
*
|
|
83
|
-
|
|
82
|
+
/** Capture and validate the exact bytes a publication will upload. No file
|
|
83
|
+
* is written, including when publication metadata changes the snapshot. */
|
|
84
|
+
export async function preparePublication(dir, publication) {
|
|
85
|
+
const release = await readRelease(dir);
|
|
86
|
+
const captured = release.files.map((file) => {
|
|
87
|
+
const data = readFileSync(join(dir, ...file.path.split("/")));
|
|
88
|
+
if (sha256Hex(data) !== file.sha256) {
|
|
89
|
+
throw new FormatError([{ path: file.path, rule: "changed", message: "changed while preparing publication; retry" }]);
|
|
90
|
+
}
|
|
91
|
+
return { path: file.path, executable: file.executable, data };
|
|
92
|
+
});
|
|
93
|
+
const meta = captured.find((file) => file.path === "meta.yaml");
|
|
94
|
+
const parsed = parseManifestText(meta.data.toString("utf8"));
|
|
95
|
+
if (!parsed.manifest || parsed.issues.length)
|
|
96
|
+
throw new FormatError(parsed.issues);
|
|
97
|
+
const source = parsed.manifest;
|
|
98
|
+
if (publication) {
|
|
99
|
+
if (!publication.license || publication.license.trim() !== publication.license || /[\r\n]/.test(publication.license)) {
|
|
100
|
+
throw new FormatError([{ path: "meta.yaml", rule: "field", message: "license must be a nonempty trimmed line" }], "publishing");
|
|
101
|
+
}
|
|
102
|
+
const doc = parseDocument(meta.data.toString("utf8"));
|
|
103
|
+
doc.set("org", publication.org);
|
|
104
|
+
doc.set("license", publication.license);
|
|
105
|
+
meta.data = Buffer.from(doc.toString({ lineWidth: 0 }));
|
|
106
|
+
}
|
|
107
|
+
const archive = packFiles(source.name, captured);
|
|
108
|
+
const checked = unpackRelease(archive, source.name);
|
|
109
|
+
const issues = [...checked.issues, ...(checked.manifest ? publishIssues(checked.manifest) : [])];
|
|
110
|
+
if (!checked.manifest || issues.length)
|
|
111
|
+
throw new FormatError(issues, "publishing");
|
|
112
|
+
return { source, manifest: checked.manifest, files: checked.files, archive };
|
|
113
|
+
}
|
|
114
|
+
/** Publish a release folder as it is (environments-59), uploading the
|
|
115
|
+
* same captured bytes that passed validation. */
|
|
84
116
|
export async function publishRelease(registry, dir) {
|
|
85
|
-
const { manifest,
|
|
86
|
-
const tgz = packRelease(dir, manifest, files);
|
|
117
|
+
const { manifest, archive } = await preparePublication(dir);
|
|
87
118
|
const name = `${manifest.org}/${manifest.name}`;
|
|
88
|
-
await registry.publish(name, manifest.version,
|
|
89
|
-
return { name, version: manifest.version, checksum: sha256Hex(
|
|
119
|
+
await registry.publish(name, manifest.version, archive);
|
|
120
|
+
return { name, version: manifest.version, checksum: sha256Hex(archive) };
|
|
90
121
|
}
|
|
91
122
|
//# sourceMappingURL=archive.js.map
|
|
@@ -24,8 +24,7 @@ export interface BuiltinRelease {
|
|
|
24
24
|
/** The built-in spec package staged under `root`, where the app's build
|
|
25
25
|
* stages it: the highest version staged. */
|
|
26
26
|
export declare function stagedBuiltinPackage(root: string): BuiltinPackage;
|
|
27
|
-
/** Seed a built-in release into the store and record its index
|
|
28
|
-
* (environments-11). Idempotent; an older seeded release stays. */
|
|
27
|
+
/** Seed a built-in release into the store and record its index. Idempotent; an older seeded release stays. */
|
|
29
28
|
export declare function seedBuiltinPackage(store: ContentStore, cacheDir: string, pkg: BuiltinPackage): Promise<BuiltinRelease>;
|
|
30
29
|
export interface BuiltinSourceOptions {
|
|
31
30
|
store: ContentStore;
|
|
@@ -36,12 +35,12 @@ export interface BuiltinSourceOptions {
|
|
|
36
35
|
* none where omitted. */
|
|
37
36
|
shipped?: BuiltinPackage | null;
|
|
38
37
|
}
|
|
39
|
-
/** The seeded built-in releases as a registry source
|
|
38
|
+
/** The seeded built-in releases as a registry source:
|
|
40
39
|
* no network, `sublang/playbooks` only. */
|
|
41
40
|
export declare function builtinRegistrySource(options: BuiltinSourceOptions): RegistrySource;
|
|
42
41
|
/**
|
|
43
42
|
* Whether this device's seed serves a lock's release of the built-in spec
|
|
44
|
-
* package (environments-7
|
|
43
|
+
* package (environments-7): it holds the locked version
|
|
45
44
|
* and each locked file at the digest the lock records for it. The
|
|
46
45
|
* archive's checksum is not compared: each device packs its own archive
|
|
47
46
|
* from its seed, so another device's lock of the same files may record
|
|
@@ -58,8 +57,8 @@ export declare function seedServes(seed: RegistrySource, version: string, files:
|
|
|
58
57
|
*/
|
|
59
58
|
export declare function builtinLock(pkg: BuiltinPackage, registryUrl: string, requestsText: string): Lock;
|
|
60
59
|
/**
|
|
61
|
-
* A new environment at its root
|
|
62
|
-
*
|
|
60
|
+
* A new environment at its root: the global
|
|
61
|
+
* records repository, or a project's working folder at its pairing.
|
|
63
62
|
* `spex.yaml` requests the built-in spec package where it does not —
|
|
64
63
|
* with `space` naming the environment's instance where one is given, the
|
|
65
64
|
* caller giving the instance its spex repository is placed at wherever
|
|
@@ -70,7 +69,7 @@ export declare function builtinLock(pkg: BuiltinPackage, registryUrl: string, re
|
|
|
70
69
|
export declare function prepareBuiltinEnvironment(root: string, pkg: BuiltinPackage, registryUrl: string, space?: string | null): boolean;
|
|
71
70
|
/**
|
|
72
71
|
* Move an environment's built-in lock to `registryUrl` where it is
|
|
73
|
-
* still the one a pairing prepared (
|
|
72
|
+
* still the one a pairing prepared (DR-127): `spex.yaml`
|
|
74
73
|
* requesting the built-in spec package alone, and `spex.lock` exactly
|
|
75
74
|
* the built-in lock at the registry it records — another than
|
|
76
75
|
* `registryUrl`, or that one while `spex.yaml` does not name `space`.
|
|
@@ -84,8 +83,7 @@ export declare function prepareBuiltinEnvironment(root: string, pkg: BuiltinPack
|
|
|
84
83
|
export declare function rehomeBuiltinLock(root: string, pkg: BuiltinPackage, registryUrl: string, space?: string | null): boolean;
|
|
85
84
|
/**
|
|
86
85
|
* Request the built-in spec package at a caret requirement in an
|
|
87
|
-
* environment's `spex.yaml` at its root where it is not requested
|
|
88
|
-
* (environments-11, storage-6): written synchronously, so a clone's
|
|
86
|
+
* environment's `spex.yaml` at its root where it is not requested: written synchronously, so a clone's
|
|
89
87
|
* first commit already holds it; comments and key order of an existing
|
|
90
88
|
* file are kept, and the file is written under the version read, so a
|
|
91
89
|
* file changed meanwhile is refused as a conflict (DR-111). Where `space` is given and the file
|
|
@@ -96,12 +94,12 @@ export declare function rehomeBuiltinLock(root: string, pkg: BuiltinPackage, reg
|
|
|
96
94
|
*/
|
|
97
95
|
export declare function ensureBuiltinRequest(root: string, version: string, space?: string | null): boolean;
|
|
98
96
|
/**
|
|
99
|
-
* A new project's environment at its pairing (
|
|
97
|
+
* A new project's environment at its pairing (DR-176): where
|
|
100
98
|
* the working folder holds no `spex.yaml`, one naming the public
|
|
101
99
|
* registry as every new file does (environments-38), `space` where the
|
|
102
|
-
* project's spex repository is placed at an instance
|
|
100
|
+
* project's spex repository is placed at an instance, and
|
|
103
101
|
* requesting nothing — the built-in spec package is a global package,
|
|
104
|
-
* never a project's request
|
|
102
|
+
* never a project's request. Created exclusively, so a
|
|
105
103
|
* file written meanwhile stands; a root that does not exist is left as
|
|
106
104
|
* it is. Returns whether it wrote.
|
|
107
105
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
|
2
2
|
// SPDX-FileCopyrightText: 2026 SubLang International <https://sublang.ai>
|
|
3
|
-
// The built-in spec package (
|
|
3
|
+
// The built-in spec package (DR-104): the playbooks
|
|
4
4
|
// Playbook ships, staged at build as `sublang/playbooks` at Playbook's
|
|
5
5
|
// version under `assets/builtins/<version>/`, seeded into the store at
|
|
6
6
|
// start with a release index under `cache/builtins/`, and served as a
|
|
@@ -31,22 +31,21 @@ export function stagedBuiltinPackage(root) {
|
|
|
31
31
|
function recordFile(cacheDir, version) {
|
|
32
32
|
return join(cacheDir, "builtins", `${version}.json`);
|
|
33
33
|
}
|
|
34
|
-
/** Seed a built-in release into the store and record its index
|
|
35
|
-
* (environments-11). Idempotent; an older seeded release stays. */
|
|
34
|
+
/** Seed a built-in release into the store and record its index. Idempotent; an older seeded release stays. */
|
|
36
35
|
export async function seedBuiltinPackage(store, cacheDir, pkg) {
|
|
37
36
|
// Seeded already, its files whole in the store: nothing to do.
|
|
38
37
|
const seeded = readRecord(recordFile(cacheDir, pkg.version));
|
|
39
|
-
if (seeded && seeded.files.every((file) => store.has(file.sha256
|
|
38
|
+
if (seeded && seeded.files.every((file) => store.has(file.sha256)))
|
|
40
39
|
return seeded;
|
|
41
40
|
const release = await shippedRecord(pkg);
|
|
42
41
|
if (`${release.manifest.org}/${release.manifest.name}` !== BUILTIN_PACKAGE_NAME || release.manifest.version !== pkg.version) {
|
|
43
42
|
throw new Error(`${pkg.dir} holds ${release.manifest.org}/${release.manifest.name} ${release.manifest.version}, not ${BUILTIN_PACKAGE_NAME} ${pkg.version}`);
|
|
44
43
|
}
|
|
45
44
|
for (const file of release.files) {
|
|
46
|
-
if (store.has(file.sha256
|
|
45
|
+
if (store.has(file.sha256))
|
|
47
46
|
continue;
|
|
48
47
|
const bytes = await readFile(join(pkg.dir, ...file.path.split("/")));
|
|
49
|
-
store.put(bytes, file.sha256,
|
|
48
|
+
store.put(bytes, file.sha256, `${BUILTIN_PACKAGE_NAME} ${file.path}`);
|
|
50
49
|
}
|
|
51
50
|
const file = recordFile(cacheDir, pkg.version);
|
|
52
51
|
await mkdir(dirname(file), { recursive: true });
|
|
@@ -80,7 +79,7 @@ function readRecord(file) {
|
|
|
80
79
|
}
|
|
81
80
|
}
|
|
82
81
|
const PUBLISHED_AT = "1970-01-01T00:00:00.000Z";
|
|
83
|
-
/** The seeded built-in releases as a registry source
|
|
82
|
+
/** The seeded built-in releases as a registry source:
|
|
84
83
|
* no network, `sublang/playbooks` only. */
|
|
85
84
|
export function builtinRegistrySource(options) {
|
|
86
85
|
const { store, cacheDir } = options;
|
|
@@ -102,7 +101,7 @@ export function builtinRegistrySource(options) {
|
|
|
102
101
|
continue;
|
|
103
102
|
const record = readRecord(join(dir, name));
|
|
104
103
|
// A seeded release serves only while the store holds its files.
|
|
105
|
-
if (record && record.files.every((file) => store.has(file.sha256
|
|
104
|
+
if (record && record.files.every((file) => store.has(file.sha256)))
|
|
106
105
|
out.set(record.version, record);
|
|
107
106
|
}
|
|
108
107
|
}
|
|
@@ -133,8 +132,8 @@ export function builtinRegistrySource(options) {
|
|
|
133
132
|
const file = release.files.find((item) => item.path === path);
|
|
134
133
|
if (!file)
|
|
135
134
|
throw new RegistryError("not_found", BUILTIN_PACKAGE_NAME, `${BUILTIN_PACKAGE_NAME} ${release.version} has no file ${path}`);
|
|
136
|
-
if (store.has(file.sha256
|
|
137
|
-
return new Uint8Array(await readFile(store.pathOf(file.sha256
|
|
135
|
+
if (store.has(file.sha256))
|
|
136
|
+
return new Uint8Array(await readFile(store.pathOf(file.sha256)));
|
|
138
137
|
const shipped = options.shipped ?? null;
|
|
139
138
|
if (shipped && shipped.version === release.version)
|
|
140
139
|
return new Uint8Array(await readFile(join(shipped.dir, ...path.split("/"))));
|
|
@@ -212,7 +211,7 @@ export function builtinRegistrySource(options) {
|
|
|
212
211
|
}
|
|
213
212
|
/**
|
|
214
213
|
* Whether this device's seed serves a lock's release of the built-in spec
|
|
215
|
-
* package (environments-7
|
|
214
|
+
* package (environments-7): it holds the locked version
|
|
216
215
|
* and each locked file at the digest the lock records for it. The
|
|
217
216
|
* archive's checksum is not compared: each device packs its own archive
|
|
218
217
|
* from its seed, so another device's lock of the same files may record
|
|
@@ -313,8 +312,8 @@ function builtinResolution(pkg, registryUrl) {
|
|
|
313
312
|
};
|
|
314
313
|
}
|
|
315
314
|
/**
|
|
316
|
-
* A new environment at its root
|
|
317
|
-
*
|
|
315
|
+
* A new environment at its root: the global
|
|
316
|
+
* records repository, or a project's working folder at its pairing.
|
|
318
317
|
* `spex.yaml` requests the built-in spec package where it does not —
|
|
319
318
|
* with `space` naming the environment's instance where one is given, the
|
|
320
319
|
* caller giving the instance its spex repository is placed at wherever
|
|
@@ -342,7 +341,7 @@ export function prepareBuiltinEnvironment(root, pkg, registryUrl, space = null)
|
|
|
342
341
|
return wrote;
|
|
343
342
|
try {
|
|
344
343
|
// Written only where no lock stands yet (DR-111).
|
|
345
|
-
writeVersionedBytes(lockFile, serializeLock(builtinLock(pkg, parseRequests(text).registry ??
|
|
344
|
+
writeVersionedBytes(lockFile, serializeLock(builtinLock(pkg, parseRequests(text).registry ?? PUBLIC_REGISTRY_ORIGIN, text)), null);
|
|
346
345
|
}
|
|
347
346
|
catch (error) {
|
|
348
347
|
// The first resolve writes it instead.
|
|
@@ -352,7 +351,7 @@ export function prepareBuiltinEnvironment(root, pkg, registryUrl, space = null)
|
|
|
352
351
|
}
|
|
353
352
|
/**
|
|
354
353
|
* Move an environment's built-in lock to `registryUrl` where it is
|
|
355
|
-
* still the one a pairing prepared (
|
|
354
|
+
* still the one a pairing prepared (DR-127): `spex.yaml`
|
|
356
355
|
* requesting the built-in spec package alone, and `spex.lock` exactly
|
|
357
356
|
* the built-in lock at the registry it records — another than
|
|
358
357
|
* `registryUrl`, or that one while `spex.yaml` does not name `space`.
|
|
@@ -422,8 +421,7 @@ export function rehomeBuiltinLock(root, pkg, registryUrl, space = null) {
|
|
|
422
421
|
}
|
|
423
422
|
/**
|
|
424
423
|
* Request the built-in spec package at a caret requirement in an
|
|
425
|
-
* environment's `spex.yaml` at its root where it is not requested
|
|
426
|
-
* (environments-11, storage-6): written synchronously, so a clone's
|
|
424
|
+
* environment's `spex.yaml` at its root where it is not requested: written synchronously, so a clone's
|
|
427
425
|
* first commit already holds it; comments and key order of an existing
|
|
428
426
|
* file are kept, and the file is written under the version read, so a
|
|
429
427
|
* file changed meanwhile is refused as a conflict (DR-111). Where `space` is given and the file
|
|
@@ -461,12 +459,12 @@ export function ensureBuiltinRequest(root, version, space = null) {
|
|
|
461
459
|
return true;
|
|
462
460
|
}
|
|
463
461
|
/**
|
|
464
|
-
* A new project's environment at its pairing (
|
|
462
|
+
* A new project's environment at its pairing (DR-176): where
|
|
465
463
|
* the working folder holds no `spex.yaml`, one naming the public
|
|
466
464
|
* registry as every new file does (environments-38), `space` where the
|
|
467
|
-
* project's spex repository is placed at an instance
|
|
465
|
+
* project's spex repository is placed at an instance, and
|
|
468
466
|
* requesting nothing — the built-in spec package is a global package,
|
|
469
|
-
* never a project's request
|
|
467
|
+
* never a project's request. Created exclusively, so a
|
|
470
468
|
* file written meanwhile stands; a root that does not exist is left as
|
|
471
469
|
* it is. Returns whether it wrote.
|
|
472
470
|
*/
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { type Lock, type Resolution } from "./lock.js";
|
|
2
|
-
/** The built-in spec package's name
|
|
2
|
+
/** The built-in spec package's name. */
|
|
3
3
|
export declare const BUILTIN_PACKAGE_NAME = "sublang/playbooks";
|
|
4
4
|
/** The manifest an export leaves in each agent folder it writes. */
|
|
5
5
|
export declare const EXPORTS_MANIFEST = ".spex-exports.json";
|
|
6
6
|
/** A managed block of a working folder's `info/exclude`: the exports,
|
|
7
|
-
* or the engine links a compile provisions
|
|
7
|
+
* or the engine links a compile provisions. */
|
|
8
8
|
export type ExcludeBlock = "exports" | "engine links";
|
|
9
9
|
export interface ExportOptions {
|
|
10
10
|
/** The environment's root (environments-26): its `.spex/` holds the
|
|
@@ -15,9 +15,9 @@ export interface ExportOptions {
|
|
|
15
15
|
* root's `.spex/` and the user's home. */
|
|
16
16
|
workingFolder: string | null;
|
|
17
17
|
/** The folder a path source's path is relative to (environments-2):
|
|
18
|
-
*
|
|
18
|
+
* the global records repository; the working folder where omitted. */
|
|
19
19
|
pathRoot?: string | null;
|
|
20
|
-
/** The user's home
|
|
20
|
+
/** The user's home when exporting the global environment; otherwise null. */
|
|
21
21
|
userHome: string | null;
|
|
22
22
|
/** The agents this device has: only their user-level folders are
|
|
23
23
|
* written, while every project-level folder is (environments-16). */
|
|
@@ -27,7 +27,7 @@ export interface ExportOptions {
|
|
|
27
27
|
rename?: (from: string, to: string) => void;
|
|
28
28
|
}
|
|
29
29
|
/** Where a provided spec stands under a project's `specs/`
|
|
30
|
-
* (environments-41, environments-
|
|
30
|
+
* (environments-41, environments-64): placed at its path; edited there,
|
|
31
31
|
* the package's copy by its marker line or the record, so left as the
|
|
32
32
|
* reader's — as is an edited copy its package no longer places, the
|
|
33
33
|
* project's own now; blocked by a file of its basename under `specs/`
|
|
@@ -72,9 +72,10 @@ export interface ExportReport {
|
|
|
72
72
|
/** Spec packages an exported artifact of which is not here: not
|
|
73
73
|
* installed, or a path source missing where its path resolves. */
|
|
74
74
|
missing: string[];
|
|
75
|
-
/** Each provided spec of a project's root with where it stands
|
|
76
|
-
*
|
|
77
|
-
*
|
|
75
|
+
/** Each provided spec of a project's root with where it stands
|
|
76
|
+
* (environments-41), by the whole `<org>/<pkg>` name as the lock
|
|
77
|
+
* lists its packages; none where the root is no working folder, as
|
|
78
|
+
* the global records repository. */
|
|
78
79
|
specs: SpecPlacement[];
|
|
79
80
|
}
|
|
80
81
|
/** Where a spec package's files stand: its installed folder, or a path
|
|
@@ -136,7 +137,7 @@ export declare function placedSpecPath(id: string): string;
|
|
|
136
137
|
/**
|
|
137
138
|
* Where each provided spec of a lock stands under a project's root, read
|
|
138
139
|
* from the files, their marker lines and the install record as a
|
|
139
|
-
* placement finds them, writing nothing (environments-
|
|
140
|
+
* placement finds them, writing nothing (environments-64,
|
|
140
141
|
* environments-41), so `spex list` and an install agree: waiting for
|
|
141
142
|
* `specs/` where the root holds none; else placed, edited or blocked as
|
|
142
143
|
* an install reports it. A spec whose package's files are not here as
|
|
@@ -161,7 +162,7 @@ export interface ModuleLocation {
|
|
|
161
162
|
}
|
|
162
163
|
/** The module candidates of a playbook artifact folder, preferred first. */
|
|
163
164
|
export declare function playbookModuleCandidates(folder: string, id: string): string[];
|
|
164
|
-
/** Each exported playbook's module location (environments-
|
|
165
|
+
/** Each exported playbook's module location (environments-8): the
|
|
165
166
|
* installed artifact under the root's `.spex/packages/`, or a path
|
|
166
167
|
* source's where its path resolves, `pathRoot` being the folder its path
|
|
167
168
|
* is relative to. Keyed by the exported name. */
|
|
@@ -183,8 +184,8 @@ export type LaunchModules = {
|
|
|
183
184
|
repository: string;
|
|
184
185
|
}[];
|
|
185
186
|
};
|
|
186
|
-
/** The modules a session hands the launcher (environments-
|
|
187
|
-
* enabled playbook from the project's environment, else
|
|
188
|
-
*
|
|
187
|
+
/** The modules a session hands the launcher (environments-8): each
|
|
188
|
+
* enabled playbook from the project's environment, else the global
|
|
189
|
+
* environment; one no environment exports is a config error naming the
|
|
189
190
|
* playbook and the spex repository whose environment lacks it. */
|
|
190
191
|
export declare function launchModules(enabled: Iterable<string>, project: EnvironmentModules | null, own: EnvironmentModules): LaunchModules;
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
|
2
2
|
// SPDX-FileCopyrightText: 2026 SubLang International <https://sublang.ai>
|
|
3
|
-
// Exports (environments-6, environments-8, environments-
|
|
4
|
-
// environments-14, environments-16, environments-30, environments-41,
|
|
5
|
-
// DR-104, DR-115, DR-124, DR-174). Only what a release provides is
|
|
3
|
+
// Exports (environments-6, environments-8, environments-64, environments-16, environments-30, environments-41, DR-104, DR-124, DR-174). Only what a release provides is
|
|
6
4
|
// placed, a support artifact installed and placed nowhere: each provided
|
|
7
5
|
// skill is copied — its `name` rewritten where aliased — and one skill
|
|
8
6
|
// is generated per provided playbook, into `<root>/.spex/skills/<name>/`;
|
|
9
7
|
// those are mirrored into the folder where each agent Spex drives reads
|
|
10
8
|
// project-level skills in the working folder, kept out of Git there by
|
|
11
|
-
// its `.git/info/exclude`, and, for
|
|
9
|
+
// its `.git/info/exclude`, and, for the global environment, into the user-level
|
|
12
10
|
// folders of the agents this device has. A playbook's skill goes only
|
|
13
11
|
// where the table lets it. A manifest beside them records what Spex
|
|
14
12
|
// wrote, so a re-export removes only its own and a skill the reader put
|
|
@@ -27,7 +25,7 @@
|
|
|
27
25
|
// whose package no longer places it leaves unless edited; and a file of
|
|
28
26
|
// its basename anywhere under `specs/` that is none of these blocks it.
|
|
29
27
|
// A project not scaffolded yet, its root holding no `specs/`, places no
|
|
30
|
-
// spec and reports it;
|
|
28
|
+
// spec and reports it; the global records repository, which is no project, has
|
|
31
29
|
// a generated skill hold the spec file instead.
|
|
32
30
|
// Playbooks go to the launcher as module locations at launch, bound to
|
|
33
31
|
// the environment whose lock exported them.
|
|
@@ -43,7 +41,7 @@ import { parseManifestText, providedArtifacts } from "./format.js";
|
|
|
43
41
|
import { isPathSource, resolutionVersion } from "./lock.js";
|
|
44
42
|
import { placedMarker, readPlacedMarker } from "./marker.js";
|
|
45
43
|
import { placedRecordPath, readPlacedRecord, serializePlacedRecord, writePlacedRecord } from "./placed-record.js";
|
|
46
|
-
/** The built-in spec package's name
|
|
44
|
+
/** The built-in spec package's name. */
|
|
47
45
|
export const BUILTIN_PACKAGE_NAME = "sublang/playbooks";
|
|
48
46
|
/** The manifest an export leaves in each agent folder it writes. */
|
|
49
47
|
export const EXPORTS_MANIFEST = ".spex-exports.json";
|
|
@@ -488,6 +486,16 @@ function specsByBasename(root) {
|
|
|
488
486
|
walk(SPECS);
|
|
489
487
|
return out;
|
|
490
488
|
}
|
|
489
|
+
/** Two `<org>/<pkg>` names by `<org>`, then by `<pkg>`, each compared
|
|
490
|
+
* as a string: the order in which packages of one `<pkg>` claim its
|
|
491
|
+
* path (environments-41). */
|
|
492
|
+
function byOrgThenPkg(a, b) {
|
|
493
|
+
const [orgA, pkgA] = a.split("/");
|
|
494
|
+
const [orgB, pkgB] = b.split("/");
|
|
495
|
+
if (orgA !== orgB)
|
|
496
|
+
return orgA < orgB ? -1 : 1;
|
|
497
|
+
return pkgA < pkgB ? -1 : pkgA > pkgB ? 1 : 0;
|
|
498
|
+
}
|
|
491
499
|
/** A record's waiting counts as a report lists them. */
|
|
492
500
|
function waitingList(waiting) {
|
|
493
501
|
return Object.keys(waiting).sort().map((name) => ({ name, count: waiting[name] }));
|
|
@@ -562,7 +570,7 @@ function deriveSpec(source, standing) {
|
|
|
562
570
|
*
|
|
563
571
|
* 1. each spec claims `specs/packages/<pkg>.md`: the package whose copy
|
|
564
572
|
* stands there — by the record, or by the marker line, as on a fresh
|
|
565
|
-
* clone — takes it, else the first
|
|
573
|
+
* clone — takes it, else the first by `<org>`, and a later one is
|
|
566
574
|
* blocked, as is one whose path a copy of a package whose files are
|
|
567
575
|
* not here holds, by the record or the marker line alike;
|
|
568
576
|
* 2. a recorded copy its package no longer places there — removed, no
|
|
@@ -590,7 +598,12 @@ function planSpecs(root, sources, unread, remove) {
|
|
|
590
598
|
const record = {};
|
|
591
599
|
const placements = [];
|
|
592
600
|
const writes = [];
|
|
593
|
-
|
|
601
|
+
// Name order for a claim is by `<org>`, then by `<pkg>` (environments-41),
|
|
602
|
+
// never by the whole name: `-` sorts before `/`, so `a-b/kit` would
|
|
603
|
+
// come before `a/kit`, though org `a` is before org `a-b`. The kept
|
|
604
|
+
// fault of the guard environments-55 patches the claim below as it
|
|
605
|
+
// is written.
|
|
606
|
+
const byName = (a, b) => byOrgThenPkg(a.name, b.name);
|
|
594
607
|
const ordered = [...sources].sort(byName);
|
|
595
608
|
const names = new Set(ordered.map((source) => source.name));
|
|
596
609
|
// A copy `remove` took leaves nothing standing at its path.
|
|
@@ -701,7 +714,9 @@ function planSpecs(root, sources, unread, remove) {
|
|
|
701
714
|
record[source.name] = { path, version: source.version, sha256: spec.sha256, waiting: spec.waiting };
|
|
702
715
|
placements.push({ name: source.name, path, state: "placed", waiting: waitingList(spec.waiting) });
|
|
703
716
|
}
|
|
704
|
-
|
|
717
|
+
// The report lists names as the lock does, by the whole name.
|
|
718
|
+
placements.sort((a, b) => (a.name < b.name ? -1 : a.name > b.name ? 1 : 0));
|
|
719
|
+
return { placements, writes, record };
|
|
705
720
|
}
|
|
706
721
|
/** Place the provided specs of a root holding `specs/` (environments-41)
|
|
707
722
|
* as `planSpecs` decides: a copy that leaves removed while it holds the
|
|
@@ -774,7 +789,7 @@ function lockedSpecs(root, lock, pathRoot) {
|
|
|
774
789
|
/**
|
|
775
790
|
* Where each provided spec of a lock stands under a project's root, read
|
|
776
791
|
* from the files, their marker lines and the install record as a
|
|
777
|
-
* placement finds them, writing nothing (environments-
|
|
792
|
+
* placement finds them, writing nothing (environments-64,
|
|
778
793
|
* environments-41), so `spex list` and an install agree: waiting for
|
|
779
794
|
* `specs/` where the root holds none; else placed, edited or blocked as
|
|
780
795
|
* an install reports it. A spec whose package's files are not here as
|
|
@@ -866,9 +881,9 @@ export async function exportEnvironment(options) {
|
|
|
866
881
|
}
|
|
867
882
|
// In a project's `specs/`, a file placed after the skills
|
|
868
883
|
// (environments-41); in a project holding no `specs/`, nowhere,
|
|
869
|
-
// reported waiting for it;
|
|
884
|
+
// reported waiting for it; for the global environment, a generated
|
|
870
885
|
// skill, the spec file in its chosen language byte for byte
|
|
871
|
-
// beside a SKILL.md saying what spec package it is (DR-
|
|
886
|
+
// beside a SKILL.md saying what spec package it is (DR-174).
|
|
872
887
|
if (mode === "files") {
|
|
873
888
|
specSources.push({ name, id, version, file });
|
|
874
889
|
continue;
|
|
@@ -966,7 +981,7 @@ export function playbookModuleCandidates(folder, id) {
|
|
|
966
981
|
join(folder, `${id}.registry.js`),
|
|
967
982
|
];
|
|
968
983
|
}
|
|
969
|
-
/** Each exported playbook's module location (environments-
|
|
984
|
+
/** Each exported playbook's module location (environments-8): the
|
|
970
985
|
* installed artifact under the root's `.spex/packages/`, or a path
|
|
971
986
|
* source's where its path resolves, `pathRoot` being the folder its path
|
|
972
987
|
* is relative to. Keyed by the exported name. */
|
|
@@ -1004,9 +1019,9 @@ export function moduleLocations(lock, root, pathRoot) {
|
|
|
1004
1019
|
}
|
|
1005
1020
|
return out;
|
|
1006
1021
|
}
|
|
1007
|
-
/** The modules a session hands the launcher (environments-
|
|
1008
|
-
* enabled playbook from the project's environment, else
|
|
1009
|
-
*
|
|
1022
|
+
/** The modules a session hands the launcher (environments-8): each
|
|
1023
|
+
* enabled playbook from the project's environment, else the global
|
|
1024
|
+
* environment; one no environment exports is a config error naming the
|
|
1010
1025
|
* playbook and the spex repository whose environment lacks it. */
|
|
1011
1026
|
export function launchModules(enabled, project, own) {
|
|
1012
1027
|
const modules = new Map();
|
|
@@ -126,8 +126,8 @@ export declare function readManifest(dir: string): Manifest;
|
|
|
126
126
|
/** Read and check a release folder (environments-1). */
|
|
127
127
|
export declare function readRelease(dir: string): Promise<Release>;
|
|
128
128
|
/** Every field the registry requires to publish that the manifest
|
|
129
|
-
* lacks, named as the registry names it (environments-
|
|
129
|
+
* lacks, named as the registry names it (environments-59). */
|
|
130
130
|
export declare function publishIssues(manifest: Manifest): Issue[];
|
|
131
|
-
/** Read a release folder as publishing takes it (environments-
|
|
131
|
+
/** Read a release folder as publishing takes it (environments-59):
|
|
132
132
|
* every release check, then the fields the registry requires. */
|
|
133
133
|
export declare function readPublishableRelease(dir: string): Promise<Release>;
|
|
@@ -630,16 +630,16 @@ export async function readRelease(dir) {
|
|
|
630
630
|
return { manifest, files: listed.files };
|
|
631
631
|
}
|
|
632
632
|
/** The manifest fields the registry requires of a release it takes,
|
|
633
|
-
* which reading a release leaves optional (environments-
|
|
633
|
+
* which reading a release leaves optional (environments-59). */
|
|
634
634
|
const PUBLISH_FIELDS = ["description", "license"];
|
|
635
635
|
/** Every field the registry requires to publish that the manifest
|
|
636
|
-
* lacks, named as the registry names it (environments-
|
|
636
|
+
* lacks, named as the registry names it (environments-59). */
|
|
637
637
|
export function publishIssues(manifest) {
|
|
638
638
|
return PUBLISH_FIELDS
|
|
639
639
|
.filter((field) => manifest[field] === undefined)
|
|
640
640
|
.map((field) => ({ path: "meta.yaml", rule: "field", message: `missing required field "${field}"` }));
|
|
641
641
|
}
|
|
642
|
-
/** Read a release folder as publishing takes it (environments-
|
|
642
|
+
/** Read a release folder as publishing takes it (environments-59):
|
|
643
643
|
* every release check, then the fields the registry requires. */
|
|
644
644
|
export async function readPublishableRelease(dir) {
|
|
645
645
|
const release = await readRelease(dir);
|