@orkestrel/scaffold 0.0.60 → 0.0.62
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 +13 -10
- package/dist/bin/main.js +632 -320
- package/dist/bin/main.js.map +1 -1
- package/dist/host/CLAUDE.md +5 -1
- package/dist/host/agents/orchestration.md +44 -19
- package/dist/host/agents/skills/enterprise-bootstrap/references/components.md +5 -5
- package/dist/host/agents/skills/orkestrel-debrief/SKILL.md +2 -2
- package/dist/host/agents/skills/orkestrel-debrief/references/instruction-audit.md +10 -9
- package/dist/host/agents/skills/orkestrel-falsify/SKILL.md +21 -11
- package/dist/host/agents/skills/orkestrel-falsify/references/brief.md +20 -2
- package/dist/host/agents/skills/orkestrel-harden-package/SKILL.md +1 -1
- package/dist/host/agents/skills/orkestrel-harden-package/references/hardening.md +1 -1
- package/dist/host/agents/skills/orkestrel-harden-package/references/research.md +1 -1
- package/dist/host/agents/templates/brief.md +16 -7
- package/dist/host/agents/transports/claude.md +4 -2
- package/dist/host/agents/transports/codex.md +4 -1
- package/dist/host/claude/agents/analyst.md +3 -1
- package/dist/host/claude/agents/application.md +1 -1
- package/dist/host/claude/agents/builder.md +3 -3
- package/dist/host/claude/agents/checker.md +5 -0
- package/dist/host/claude/agents/grok.md +15 -5
- package/dist/host/claude/agents/implementer.md +1 -1
- package/dist/host/claude/agents/orkestrel.md +2 -2
- package/dist/host/claude/agents/planner.md +10 -0
- package/dist/host/claude/agents/reviewer.md +14 -8
- package/dist/host/claude/agents/sol.md +3 -1
- package/dist/host/claude/agents/verifier.md +2 -4
- package/dist/host/claude/rules/architecture.md +7 -5
- package/dist/host/claude/rules/documentation.md +1 -0
- package/dist/host/claude/rules/names.md +23 -5
- package/dist/host/claude/rules/patterns.md +1 -0
- package/dist/host/claude/rules/quality.md +1 -1
- package/dist/host/claude/rules/tests.md +3 -3
- package/dist/host/claude/rules/typescript.md +4 -1
- package/dist/host/claude/rules/writing.md +2 -2
- package/dist/host/codex/agents/builder.toml +6 -6
- package/dist/host/codex/agents/checker.toml +2 -1
- package/dist/host/codex/agents/grok.toml +12 -5
- package/dist/host/codex/agents/implementer.toml +2 -2
- package/dist/host/codex/agents/opus.toml +6 -1
- package/dist/host/codex/agents/planner.toml +11 -6
- package/dist/host/codex/agents/reviewer.toml +8 -6
- package/dist/host/guides/scaffold.md +39 -14
- package/dist/host/manifest.json +41 -41
- package/dist/host/scripts/codex.sh +0 -0
- package/dist/host/scripts/cursor.sh +0 -0
- package/dist/host/scripts/deps.sh +0 -0
- package/dist/host/scripts/ollama.sh +0 -0
- package/dist/src/core/index.cjs +429 -287
- package/dist/src/core/index.cjs.map +1 -1
- package/dist/src/core/index.d.cts +361 -220
- package/dist/src/core/index.d.ts +361 -220
- package/dist/src/core/index.js +426 -288
- package/dist/src/core/index.js.map +1 -1
- package/dist/src/server/index.cjs +208 -170
- package/dist/src/server/index.cjs.map +1 -1
- package/dist/src/server/index.d.cts +276 -152
- package/dist/src/server/index.d.ts +276 -152
- package/dist/src/server/index.js +200 -172
- package/dist/src/server/index.js.map +1 -1
- package/package.json +13 -12
package/dist/src/core/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { fillTemplate } from "@orkestrel/template";
|
|
|
3
3
|
import { Emitter } from "@orkestrel/emitter";
|
|
4
4
|
var package_default = {
|
|
5
5
|
name: "@orkestrel/scaffold",
|
|
6
|
-
version: "0.0.
|
|
6
|
+
version: "0.0.62",
|
|
7
7
|
description: "Scaffold workspaces with five commands: new, audit, repair, catalog, and overwrite.",
|
|
8
8
|
keywords: [
|
|
9
9
|
"audit",
|
|
@@ -58,7 +58,7 @@ var package_default = {
|
|
|
58
58
|
"clean": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\"",
|
|
59
59
|
"copy": "node -e \"const fs=require('node:fs'),p=require('node:path'),a=process.argv[1],b=process.argv[2];fs.mkdirSync(p.dirname(b),{recursive:true});fs.cpSync(a,b,{force:true});console.log('Copied: '+a+' to '+b)\"",
|
|
60
60
|
"scaffold": "node ./dist/bin/main.js",
|
|
61
|
-
"lint": "oxlint --config .oxlintrc.json --fix
|
|
61
|
+
"lint": "oxlint --config .oxlintrc.json --fix .",
|
|
62
62
|
"check": "tsc --noEmit --project tsconfig.json && npm run check:src",
|
|
63
63
|
"check:src": "npm run check:src:core && npm run check:src:server && npm run check:src:bin",
|
|
64
64
|
"check:src:core": "tsc --noEmit -p configs/src/tsconfig.core.json",
|
|
@@ -67,7 +67,7 @@ var package_default = {
|
|
|
67
67
|
"format": "oxfmt --config .oxfmtrc.json --write .",
|
|
68
68
|
"format:check": "oxfmt --config .oxfmtrc.json --check .",
|
|
69
69
|
"lint:check": "oxlint --config .oxlintrc.json --deny-warnings .",
|
|
70
|
-
"test": "npm run test:src:core && npm run test:src:server && npm run test:src:bin && npm run test:policy && npm run test:config && npm run test:guides",
|
|
70
|
+
"test": "npm run test:src:core && npm run test:src:server && npm run test:src:bin && npm run test:policy && npm run test:config && npm run test:setup && npm run test:guides",
|
|
71
71
|
"test:src:core": "vitest run --config vite.config.ts --no-cache --reporter=dot --project src:core",
|
|
72
72
|
"test:src:server": "vitest run --config vite.config.ts --no-cache --reporter=dot --project src:server",
|
|
73
73
|
"test:src:bin": "vitest run --config vite.config.ts --no-cache --reporter=dot --project src:bin",
|
|
@@ -77,6 +77,7 @@ var package_default = {
|
|
|
77
77
|
"test:distribution": "vitest run --config vite.config.ts --no-cache --reporter=dot --project distribution",
|
|
78
78
|
"test:probe": "vitest run --config vite.config.ts --no-cache --reporter=verbose --project probe",
|
|
79
79
|
"test:bench": "vitest bench --config vite.config.ts --no-cache --project probe",
|
|
80
|
+
"test:setup": "vitest run --config vite.config.ts --no-cache --reporter=dot --project setup",
|
|
80
81
|
"build": "npm run clean && npm run build:src && npm run build:host && npm run build:inventory",
|
|
81
82
|
"build:src": "npm run build:src:core && npm run build:src:server && npm run build:src:bin",
|
|
82
83
|
"build:src:core": "vite build --config configs/src/vite.core.config.ts && npm run copy dist/src/core/index.d.ts dist/src/core/index.d.cts",
|
|
@@ -88,19 +89,19 @@ var package_default = {
|
|
|
88
89
|
"prepublishOnly": "npm run format:check && npm run lint:check && npm run check && npm run build && npm test && npm run test:distribution -- --mode release"
|
|
89
90
|
},
|
|
90
91
|
dependencies: {
|
|
91
|
-
"@orkestrel/console": "^0.0.
|
|
92
|
-
"@orkestrel/contract": "^0.0.
|
|
93
|
-
"@orkestrel/emitter": "^0.0.
|
|
94
|
-
"@orkestrel/markdown": "^0.0.
|
|
95
|
-
"@orkestrel/process": "^0.0.
|
|
96
|
-
"@orkestrel/template": "^0.0.
|
|
92
|
+
"@orkestrel/console": "^0.0.12",
|
|
93
|
+
"@orkestrel/contract": "^0.0.16",
|
|
94
|
+
"@orkestrel/emitter": "^0.0.9",
|
|
95
|
+
"@orkestrel/markdown": "^0.0.13",
|
|
96
|
+
"@orkestrel/process": "^0.0.10",
|
|
97
|
+
"@orkestrel/template": "^0.0.6"
|
|
97
98
|
},
|
|
98
99
|
devDependencies: {
|
|
99
100
|
"@microsoft/api-extractor": "^7.59.0",
|
|
100
|
-
"@orkestrel/guide": "^0.0.
|
|
101
|
-
"@orkestrel/html": "^0.0.
|
|
101
|
+
"@orkestrel/guide": "^0.0.16",
|
|
102
|
+
"@orkestrel/html": "^0.0.8",
|
|
102
103
|
"@orkestrel/probe": "^0.0.11",
|
|
103
|
-
"@orkestrel/test": "^0.0.
|
|
104
|
+
"@orkestrel/test": "^0.0.13",
|
|
104
105
|
"@types/node": "^26.4.0",
|
|
105
106
|
"@vitest/browser-playwright": "^4.1.11",
|
|
106
107
|
"oxfmt": "^0.65.0",
|
|
@@ -116,7 +117,7 @@ var package_default = {
|
|
|
116
117
|
//#endregion
|
|
117
118
|
//#region src/core/constants.ts
|
|
118
119
|
/**
|
|
119
|
-
*
|
|
120
|
+
* Lists the `Environment` values, frozen.
|
|
120
121
|
*
|
|
121
122
|
* @remarks
|
|
122
123
|
* A blueprint's `src` and `app` axes are caller-supplied, so the gate measures
|
|
@@ -130,7 +131,7 @@ var ENVIRONMENTS = Object.freeze([
|
|
|
130
131
|
"server"
|
|
131
132
|
]);
|
|
132
133
|
/**
|
|
133
|
-
*
|
|
134
|
+
* Lists the `Group` values in plan order, frozen.
|
|
134
135
|
*
|
|
135
136
|
* @remarks
|
|
136
137
|
* A compile that names no groups covers every one of them, so this list is the
|
|
@@ -147,7 +148,7 @@ var GROUPS = Object.freeze([
|
|
|
147
148
|
"orchestration"
|
|
148
149
|
]);
|
|
149
150
|
/**
|
|
150
|
-
*
|
|
151
|
+
* Holds the build and export settings each published `src` environment contributes, frozen.
|
|
151
152
|
*
|
|
152
153
|
* @remarks
|
|
153
154
|
* Per environment: the thin configuration files it adds under `configs/src`,
|
|
@@ -177,7 +178,8 @@ var SRC_MATRIX = Object.freeze({
|
|
|
177
178
|
})
|
|
178
179
|
});
|
|
179
180
|
/**
|
|
180
|
-
*
|
|
181
|
+
* Holds the configuration and runtime-entry settings each private `app` environment
|
|
182
|
+
* contributes, frozen.
|
|
181
183
|
*
|
|
182
184
|
* @remarks
|
|
183
185
|
* An application environment declares no exports, so it carries a runtime
|
|
@@ -200,24 +202,25 @@ var APP_MATRIX = Object.freeze({
|
|
|
200
202
|
entry: "app/server/main.ts"
|
|
201
203
|
})
|
|
202
204
|
});
|
|
203
|
-
/**
|
|
205
|
+
/** Lists the configuration files a workspace that ships its own executable adds, frozen. */
|
|
204
206
|
var BIN_CONFIGS = Object.freeze(["configs/src/vite.bin.config.ts", "configs/src/tsconfig.bin.json"]);
|
|
205
|
-
/**
|
|
207
|
+
/** Names the executable entry whose presence makes a workspace `bin`. */
|
|
206
208
|
var BIN_ENTRY_PATH = "src/bin/main.ts";
|
|
207
209
|
/**
|
|
208
|
-
*
|
|
210
|
+
* Lists the paths a target receives from the vendored data root, frozen.
|
|
209
211
|
*
|
|
210
212
|
* @remarks
|
|
211
|
-
* These are the files the fleet shares verbatim and
|
|
212
|
-
* of: the licence, the harness permission file, the
|
|
213
|
-
* shared policy register, the
|
|
214
|
-
*
|
|
215
|
-
*
|
|
213
|
+
* These are the files the fleet shares verbatim, and each target holds a copy
|
|
214
|
+
* of the paths it selects: the licence, the harness permission file, the
|
|
215
|
+
* session-start hooks, the shared policy register, the shared policy proof,
|
|
216
|
+
* the shared policy plugin, the shared configuration leaf and its proof, the
|
|
217
|
+
* byte-identical root dotfiles, and the guide mirrors a generated workspace
|
|
218
|
+
* starts from. A directory entry vendors everything beneath it.
|
|
216
219
|
*
|
|
217
220
|
* A plan carries the subset its target selects, which is why the list is a
|
|
218
221
|
* candidate set rather than a plan: a workspace never mirrors its own guide.
|
|
219
222
|
*
|
|
220
|
-
* Neither the instruction canon nor the
|
|
223
|
+
* Neither the instruction canon nor the bench and MCP wiring is here. A target reads
|
|
221
224
|
* its rules, its skills, its agent roles, its bench configuration, and its MCP
|
|
222
225
|
* registrations from {@link CANON_PATHS} inside the installed package, so no
|
|
223
226
|
* file scaffold leaves in a target names a path the target does not hold.
|
|
@@ -247,7 +250,7 @@ var HOST_PATHS = Object.freeze([
|
|
|
247
250
|
"guides/scaffold.md"
|
|
248
251
|
]);
|
|
249
252
|
/**
|
|
250
|
-
*
|
|
253
|
+
* Lists the instruction-canon paths staged for reading rather than for a target, frozen.
|
|
251
254
|
*
|
|
252
255
|
* @remarks
|
|
253
256
|
* The root instruction documents, the orchestration contract every harness
|
|
@@ -293,10 +296,10 @@ var CANON_PATHS = Object.freeze([
|
|
|
293
296
|
".cursor/mcp.json",
|
|
294
297
|
".cursor/rules"
|
|
295
298
|
]);
|
|
296
|
-
/**
|
|
299
|
+
/** Names the repository-relative path where the committed vendored-file inventory is served. */
|
|
297
300
|
var HOST_INVENTORY_PATH = "host.json";
|
|
298
301
|
/**
|
|
299
|
-
*
|
|
302
|
+
* Lists the vendored paths whose present bytes belong to each workspace, frozen.
|
|
300
303
|
*
|
|
301
304
|
* @remarks
|
|
302
305
|
* These paths are copied into a workspace when absent and are never compared
|
|
@@ -306,7 +309,7 @@ var HOST_INVENTORY_PATH = "host.json";
|
|
|
306
309
|
*/
|
|
307
310
|
var WORKSPACE_OWNED_PATHS = Object.freeze([".gitignore"]);
|
|
308
311
|
/**
|
|
309
|
-
*
|
|
312
|
+
* Lists the vendored paths a target receives with its executable bit set, frozen.
|
|
310
313
|
*
|
|
311
314
|
* @remarks
|
|
312
315
|
* Declared rather than read from the staging host's filesystem, because that
|
|
@@ -325,7 +328,7 @@ var EXECUTABLE_PATHS = Object.freeze([
|
|
|
325
328
|
"scripts/ollama.sh"
|
|
326
329
|
]);
|
|
327
330
|
/**
|
|
328
|
-
*
|
|
331
|
+
* Lists the path prefixes whose contents instruct or wire an agent, frozen.
|
|
329
332
|
*
|
|
330
333
|
* @remarks
|
|
331
334
|
* A path is grouped by what it governs rather than by where it sits: anything
|
|
@@ -343,7 +346,7 @@ var ORCHESTRATION_PATH_PREFIXES = Object.freeze([
|
|
|
343
346
|
"scripts/"
|
|
344
347
|
]);
|
|
345
348
|
/**
|
|
346
|
-
*
|
|
349
|
+
* Lists the exact root filenames that wire an agent bench rather than the toolchain, frozen.
|
|
347
350
|
*
|
|
348
351
|
* @remarks
|
|
349
352
|
* `.mcp.json` registers MCP servers for the harness. It sits among the root
|
|
@@ -351,7 +354,7 @@ var ORCHESTRATION_PATH_PREFIXES = Object.freeze([
|
|
|
351
354
|
*/
|
|
352
355
|
var ORCHESTRATION_PATH_NAMES = Object.freeze([".mcp.json"]);
|
|
353
356
|
/**
|
|
354
|
-
*
|
|
357
|
+
* Names the agent file whose marker-bounded package table the catalog verb alone owns.
|
|
355
358
|
*
|
|
356
359
|
* @remarks
|
|
357
360
|
* A plan claims it at a canon path, because the catalog verb refuses a target
|
|
@@ -365,16 +368,34 @@ var ORCHESTRATION_PATH_NAMES = Object.freeze([".mcp.json"]);
|
|
|
365
368
|
* inside the markers.
|
|
366
369
|
*/
|
|
367
370
|
var CATALOG_AGENT_PATH = ".claude/agents/orkestrel.md";
|
|
368
|
-
/**
|
|
371
|
+
/**
|
|
372
|
+
* Names the marker opening the package table inside {@link CATALOG_AGENT_PATH}.
|
|
373
|
+
*
|
|
374
|
+
* @remarks
|
|
375
|
+
* The catalog verb rewrites the region between this marker and
|
|
376
|
+
* {@link CATALOG_CLOSING_MARKER} and leaves every other byte of the file alone,
|
|
377
|
+
* so the writer and every proof that reads the rendered file read the pair from
|
|
378
|
+
* here rather than repeating a literal that only agrees by inspection.
|
|
379
|
+
*/
|
|
380
|
+
var CATALOG_OPENING_MARKER = "<!-- orkestrel:catalog -->";
|
|
381
|
+
/**
|
|
382
|
+
* Names the marker closing the package table inside {@link CATALOG_AGENT_PATH}.
|
|
383
|
+
*
|
|
384
|
+
* @remarks
|
|
385
|
+
* It pairs with {@link CATALOG_OPENING_MARKER}; a file missing either marker is
|
|
386
|
+
* refused rather than rewritten.
|
|
387
|
+
*/
|
|
388
|
+
var CATALOG_CLOSING_MARKER = "<!-- /orkestrel:catalog -->";
|
|
389
|
+
/** Names the provisioner skeleton a workspace with declared service vendors is given once. */
|
|
369
390
|
var SERVICE_SCRIPT_PATH = "scripts/service.sh";
|
|
370
|
-
/**
|
|
391
|
+
/** Names the shared Vitest global-setup module whose presence makes a workspace `global`. */
|
|
371
392
|
var GLOBAL_SETUP_PATH = "tests/setupGlobal.ts";
|
|
372
|
-
/**
|
|
393
|
+
/** Names the guide-parity proof whose presence selects the planned `guides` project. */
|
|
373
394
|
var GUIDES_TEST_PATH = "tests/guides.test.ts";
|
|
374
|
-
/**
|
|
395
|
+
/** Names the generated packed-package proof every publishing workspace is planned at. */
|
|
375
396
|
var DISTRIBUTION_TEST_PATH = "tests/distribution.test.ts";
|
|
376
397
|
/**
|
|
377
|
-
*
|
|
398
|
+
* Names the `prepublishOnly` row that runs the packed-package proof against a real registry.
|
|
378
399
|
*
|
|
379
400
|
* @remarks
|
|
380
401
|
* The proof reads `import.meta.env.MODE`, so without `--mode release` it passes
|
|
@@ -382,22 +403,28 @@ var DISTRIBUTION_TEST_PATH = "tests/distribution.test.ts";
|
|
|
382
403
|
* and both the script compiler and the manifest region writer read it from here.
|
|
383
404
|
*/
|
|
384
405
|
var RELEASE_PROOF_COMMAND = "npm run test:distribution -- --mode release";
|
|
385
|
-
/**
|
|
406
|
+
/**
|
|
407
|
+
* Names the cross-environment composition proof whose presence makes a workspace
|
|
408
|
+
* `integration`.
|
|
409
|
+
*/
|
|
386
410
|
var INTEGRATION_TEST_PATH = "tests/integration.test.ts";
|
|
387
|
-
/**
|
|
411
|
+
/** Names the manifest path every compiler plan emits with birth ownership. */
|
|
388
412
|
var MANIFEST_PATH = "package.json";
|
|
389
|
-
/**
|
|
413
|
+
/** Names the official-tooling drift proof whose presence makes a workspace `conformance`. */
|
|
390
414
|
var CONFORMANCE_TEST_PATH = "tests/conformance.test.ts";
|
|
391
|
-
/**
|
|
415
|
+
/** Names the live-service readiness module whose presence makes a workspace `service`. */
|
|
392
416
|
var SERVICE_SETUP_PATH = "tests/setupService.ts";
|
|
393
|
-
/**
|
|
417
|
+
/**
|
|
418
|
+
* Names the include the live-service project covers, which is a directory rather than
|
|
419
|
+
* one proof.
|
|
420
|
+
*/
|
|
394
421
|
var SERVICE_TEST_INCLUDE = "tests/service/**/*.test.ts";
|
|
395
|
-
/**
|
|
422
|
+
/** Names the Vite wrapper whose presence makes a workspace `showcase`. */
|
|
396
423
|
var SHOWCASE_CONFIG_PATH = "configs/app/vite.showcase.config.ts";
|
|
397
|
-
/**
|
|
424
|
+
/** Matches the bare workspace name syntax: lowercase alphanumeric with hyphens, letter first. */
|
|
398
425
|
var NAME_PATTERN = /^[a-z][a-z0-9-]*$/;
|
|
399
426
|
/**
|
|
400
|
-
*
|
|
427
|
+
* Matches the runtime dependency name syntax: the `@orkestrel` scope and a bare name.
|
|
401
428
|
*
|
|
402
429
|
* @remarks
|
|
403
430
|
* A dependency name reaches a path, because a workspace's guide mirror is
|
|
@@ -407,7 +434,7 @@ var NAME_PATTERN = /^[a-z][a-z0-9-]*$/;
|
|
|
407
434
|
*/
|
|
408
435
|
var DEPENDENCY_NAME_PATTERN = /^@orkestrel\/[a-z][a-z0-9-]*$/;
|
|
409
436
|
/**
|
|
410
|
-
*
|
|
437
|
+
* Matches the package name syntax for a dependency this package does not publish.
|
|
411
438
|
*
|
|
412
439
|
* @remarks
|
|
413
440
|
* A foreign package is one this package does not publish, so its name reaches
|
|
@@ -417,10 +444,10 @@ var DEPENDENCY_NAME_PATTERN = /^@orkestrel\/[a-z][a-z0-9-]*$/;
|
|
|
417
444
|
* is admitted, so the shape cannot express a traversal.
|
|
418
445
|
*/
|
|
419
446
|
var FOREIGN_NAME_PATTERN = /^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/;
|
|
420
|
-
/**
|
|
447
|
+
/** Matches the exact `major.minor.patch` version syntax a blueprint declares. */
|
|
421
448
|
var VERSION_PATTERN = /^(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)$/;
|
|
422
449
|
/**
|
|
423
|
-
*
|
|
450
|
+
* Matches the exact caret-pinned pre-1.0 range accepted for an `@orkestrel/*` runtime dependency.
|
|
424
451
|
*
|
|
425
452
|
* @remarks
|
|
426
453
|
* Pre-1.0 means any `0.x`, not `0.0.x`. The narrower form would refuse the first
|
|
@@ -429,10 +456,10 @@ var VERSION_PATTERN = /^(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)$/;
|
|
|
429
456
|
* workspace that had already been pinned to it.
|
|
430
457
|
*/
|
|
431
458
|
var ORKESTREL_RANGE_PATTERN = /^\^0\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)$/;
|
|
432
|
-
/**
|
|
459
|
+
/** Matches the registry-only semver subset accepted for a development extra's range. */
|
|
433
460
|
var EXTRA_RANGE_PATTERN = /^(?:\^|~)?(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)(?:-(?:0|[1-9]\d*|\d*[A-Za-z-][0-9A-Za-z-]*)(?:\.(?:0|[1-9]\d*|\d*[A-Za-z-][0-9A-Za-z-]*))*)?$/;
|
|
434
461
|
/**
|
|
435
|
-
*
|
|
462
|
+
* Matches the exact `major.minor.patch` floor accepted for a foreign peer's range.
|
|
436
463
|
*
|
|
437
464
|
* @remarks
|
|
438
465
|
* This is independent from {@link ENGINES_PATTERN}. An engine floors the Node
|
|
@@ -440,44 +467,47 @@ var EXTRA_RANGE_PATTERN = /^(?:\^|~)?(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\
|
|
|
440
467
|
* supplies. Either obligation may change without changing the other.
|
|
441
468
|
*/
|
|
442
469
|
var FLOOR_RANGE_PATTERN = /^>=(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)$/;
|
|
443
|
-
/**
|
|
470
|
+
/** Matches the minimum-Node engine syntax a blueprint declares. */
|
|
444
471
|
var ENGINES_PATTERN = /^>=(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)$/;
|
|
445
|
-
/**
|
|
472
|
+
/** Matches exact lowercase hexadecimal bytes: two digits per byte, and empty content is valid. */
|
|
446
473
|
var HEX_PATTERN = /^(?:[0-9a-f]{2})*$/;
|
|
447
|
-
/**
|
|
474
|
+
/**
|
|
475
|
+
* Matches the Unicode controls, formatting controls, and line and paragraph separators
|
|
476
|
+
* rejected in text.
|
|
477
|
+
*/
|
|
448
478
|
var CONTROL_CHARACTER_PATTERN = /[\p{Cc}\p{Cf}\p{Zl}\p{Zp}]/u;
|
|
449
|
-
/**
|
|
479
|
+
/** Matches the visible characters a target-relative path and a Markdown path cell both forbid. */
|
|
450
480
|
var INVALID_PATH_CHARACTER_PATTERN = /[<>:"|?*\\]/;
|
|
451
481
|
/**
|
|
452
|
-
*
|
|
482
|
+
* Caps the bare workspace name length.
|
|
453
483
|
*
|
|
454
484
|
* @remarks
|
|
455
485
|
* The registry caps a whole package name at 214 characters and the generated
|
|
456
486
|
* scope `@orkestrel/` spends 11 of them.
|
|
457
487
|
*/
|
|
458
488
|
var MAX_NAME_LENGTH = 203;
|
|
459
|
-
/**
|
|
489
|
+
/** Sets the maximum dependency package name length, scope included, as the registry caps it. */
|
|
460
490
|
var MAX_DEPENDENCY_NAME_LENGTH = 214;
|
|
461
|
-
/**
|
|
491
|
+
/** Caps the length of one declared package range. */
|
|
462
492
|
var MAX_RANGE_LENGTH = 2048;
|
|
463
|
-
/**
|
|
493
|
+
/** Caps the length of one manifest script name or command. */
|
|
464
494
|
var MAX_SCRIPT_LENGTH = 4096;
|
|
465
|
-
/**
|
|
495
|
+
/** Caps the length of one path, matching the longest a supported filesystem accepts. */
|
|
466
496
|
var MAX_PATH_LENGTH = 32767;
|
|
467
|
-
/**
|
|
497
|
+
/** Caps the items accepted in one public collection. */
|
|
468
498
|
var MAX_COLLECTION_ITEMS = 1e3;
|
|
469
|
-
/**
|
|
499
|
+
/** Caps the columns one emitted line may occupy, matching `printWidth` in `.oxfmtrc.json`. */
|
|
470
500
|
var PRINT_WIDTH = 100;
|
|
471
|
-
/**
|
|
501
|
+
/** Sets the columns one tab occupies when the formatter measures a line, matching `tabWidth`. */
|
|
472
502
|
var TAB_WIDTH = 2;
|
|
473
|
-
/**
|
|
503
|
+
/** Caps the findings one audit can produce from a bounded plan and snapshot. */
|
|
474
504
|
var MAX_AUDIT_FINDINGS = MAX_COLLECTION_ITEMS * 2;
|
|
475
|
-
/**
|
|
505
|
+
/** Caps the bytes accepted for one artifact. */
|
|
476
506
|
var MAX_ARTIFACT_BYTES = 5242880;
|
|
477
|
-
/**
|
|
507
|
+
/** Caps the length of the hexadecimal string carrying one artifact's bytes. */
|
|
478
508
|
var MAX_ARTIFACT_HEX_LENGTH = MAX_ARTIFACT_BYTES * 2;
|
|
479
509
|
/**
|
|
480
|
-
*
|
|
510
|
+
* Caps the decoded bytes accepted from one registry response.
|
|
481
511
|
*
|
|
482
512
|
* @remarks
|
|
483
513
|
* The 2026-08-21 abbreviated-packument measurements were 8,647,138 bytes for
|
|
@@ -487,24 +517,24 @@ var MAX_ARTIFACT_HEX_LENGTH = MAX_ARTIFACT_BYTES * 2;
|
|
|
487
517
|
*/
|
|
488
518
|
var MAX_REGISTRY_BYTES = 33554432;
|
|
489
519
|
/**
|
|
490
|
-
*
|
|
520
|
+
* Caps the decoded bytes accepted across one registry-reading call.
|
|
491
521
|
*
|
|
492
522
|
* @remarks
|
|
493
523
|
* The 2026-08-21 browser-workspace registry set measured about 24 MiB. The
|
|
494
524
|
* bound leaves headroom for that set to grow without making a call unbounded.
|
|
495
525
|
*/
|
|
496
526
|
var MAX_TOTAL_REGISTRY_BYTES = 100663296;
|
|
497
|
-
/**
|
|
527
|
+
/** Caps the bytes accepted for one package or vendored-host manifest. */
|
|
498
528
|
var MAX_MANIFEST_BYTES = 1048576;
|
|
499
|
-
/**
|
|
529
|
+
/** Caps the bytes retained across one whole plan or audit. */
|
|
500
530
|
var MAX_TOTAL_ARTIFACT_BYTES = 104857600;
|
|
501
|
-
/**
|
|
531
|
+
/** Names the oldest Node version the generated toolchain supports. */
|
|
502
532
|
var MINIMUM_NODE_VERSION = "22.12.0";
|
|
503
|
-
/**
|
|
533
|
+
/** Names the version a workspace starts at. */
|
|
504
534
|
var DEFAULT_VERSION = "0.0.1";
|
|
505
|
-
/**
|
|
535
|
+
/** Names the `engines.node` range a workspace starts with. */
|
|
506
536
|
var DEFAULT_ENGINES = `>=${MINIMUM_NODE_VERSION}`;
|
|
507
|
-
/**
|
|
537
|
+
/** Holds the tooling versions scaffold and every generated workspace share. */
|
|
508
538
|
var BASE_DEV_DEPENDENCIES = Object.freeze({
|
|
509
539
|
"@orkestrel/guide": package_default.devDependencies["@orkestrel/guide"],
|
|
510
540
|
"@orkestrel/probe": package_default.devDependencies["@orkestrel/probe"],
|
|
@@ -517,19 +547,22 @@ var BASE_DEV_DEPENDENCIES = Object.freeze({
|
|
|
517
547
|
vite: package_default.devDependencies.vite,
|
|
518
548
|
vitest: package_default.devDependencies.vitest
|
|
519
549
|
});
|
|
520
|
-
/**
|
|
550
|
+
/**
|
|
551
|
+
* Lists the development dependencies that emit declarations for published source or an
|
|
552
|
+
* executable.
|
|
553
|
+
*/
|
|
521
554
|
var DECLARATION_DEV_DEPENDENCIES = Object.freeze({
|
|
522
555
|
"@microsoft/api-extractor": package_default.devDependencies["@microsoft/api-extractor"],
|
|
523
556
|
"vite-plugin-dts": package_default.devDependencies["vite-plugin-dts"]
|
|
524
557
|
});
|
|
525
|
-
/**
|
|
558
|
+
/** Lists the development dependencies a published browser `src` environment adds. */
|
|
526
559
|
var SOURCE_BROWSER_DEV_DEPENDENCIES = Object.freeze({
|
|
527
560
|
"@vitest/browser-playwright": package_default.devDependencies["@vitest/browser-playwright"],
|
|
528
561
|
playwright: package_default.devDependencies.playwright
|
|
529
562
|
});
|
|
530
|
-
/**
|
|
563
|
+
/** Names the development dependency every private `app` environment adds. */
|
|
531
564
|
var APP_DEV_DEPENDENCIES = Object.freeze({ "@orkestrel/contract": package_default.dependencies["@orkestrel/contract"] });
|
|
532
|
-
/**
|
|
565
|
+
/** Lists the development dependencies a private Vue browser application adds. */
|
|
533
566
|
var APP_BROWSER_DEV_DEPENDENCIES = Object.freeze({
|
|
534
567
|
...SOURCE_BROWSER_DEV_DEPENDENCIES,
|
|
535
568
|
"@orkestrel/html": package_default.devDependencies["@orkestrel/html"],
|
|
@@ -538,7 +571,7 @@ var APP_BROWSER_DEV_DEPENDENCIES = Object.freeze({
|
|
|
538
571
|
"vue-tsc": "^3.3.7"
|
|
539
572
|
});
|
|
540
573
|
/**
|
|
541
|
-
*
|
|
574
|
+
* Names the development dependency used only by the optional single-file showcase build.
|
|
542
575
|
*
|
|
543
576
|
* @example
|
|
544
577
|
* ```ts
|
|
@@ -548,7 +581,7 @@ var APP_BROWSER_DEV_DEPENDENCIES = Object.freeze({
|
|
|
548
581
|
* ```
|
|
549
582
|
*/
|
|
550
583
|
var SHOWCASE_DEV_DEPENDENCIES = Object.freeze({ "vite-plugin-singlefile": "^2.3.3" });
|
|
551
|
-
/**
|
|
584
|
+
/** Lists the development dependencies a private server application adds. */
|
|
552
585
|
var APP_SERVER_DEV_DEPENDENCIES = Object.freeze({
|
|
553
586
|
"@orkestrel/emitter": package_default.dependencies["@orkestrel/emitter"],
|
|
554
587
|
"@orkestrel/middleware": "^0.0.16",
|
|
@@ -558,7 +591,7 @@ var APP_SERVER_DEV_DEPENDENCIES = Object.freeze({
|
|
|
558
591
|
//#endregion
|
|
559
592
|
//#region src/core/templates.ts
|
|
560
593
|
/**
|
|
561
|
-
*
|
|
594
|
+
* Holds formatter-stable template text for every configuration artifact.
|
|
562
595
|
*
|
|
563
596
|
* @remarks
|
|
564
597
|
* Builders in `compilers.ts` fill these definitions through
|
|
@@ -1229,8 +1262,8 @@ import { accessSync, constants as FS_CONSTANTS, globSync, readdirSync, statSync
|
|
|
1229
1262
|
import { basename, dirname, join, resolve as resolvePath } from 'node:path'
|
|
1230
1263
|
|
|
1231
1264
|
/**
|
|
1232
|
-
* Chromium executable layouts inside a \`chromium-<revision>\` browsers-directory
|
|
1233
|
-
* platform.
|
|
1265
|
+
* Lists the Chromium executable layouts inside a \`chromium-<revision>\` browsers-directory
|
|
1266
|
+
* entry, per platform.
|
|
1234
1267
|
*
|
|
1235
1268
|
* @remarks
|
|
1236
1269
|
* The current Playwright build ships Chrome for Testing on macOS. The trailing \`Chromium.app\`
|
|
@@ -1248,17 +1281,17 @@ export const CHROMIUM_LAYOUTS = Object.freeze([
|
|
|
1248
1281
|
'chrome-mac-arm64/Chromium.app/Contents/MacOS/Chromium',
|
|
1249
1282
|
])
|
|
1250
1283
|
|
|
1251
|
-
/**
|
|
1284
|
+
/** Matches the \`chromium-<revision>\` entry name Playwright installs one managed build into. */
|
|
1252
1285
|
export const CHROMIUM_ENTRY_PATTERN = /^chromium-\\d+$/
|
|
1253
1286
|
|
|
1254
|
-
/**
|
|
1287
|
+
/** Matches the revision number carried by any path containing a \`chromium-<revision>\` segment. */
|
|
1255
1288
|
export const CHROMIUM_REVISION_PATTERN = /chromium-(\\d+)/
|
|
1256
1289
|
|
|
1257
|
-
/**
|
|
1290
|
+
/** Names the directory a managed Linux container installs its bundled Playwright browsers into. */
|
|
1258
1291
|
export const BUNDLED_BROWSERS_ROOT = '/opt/pw-browsers'
|
|
1259
1292
|
|
|
1260
1293
|
/**
|
|
1261
|
-
*
|
|
1294
|
+
* Lists the bundled Chromium layouts under the managed-container browsers root, as glob patterns.
|
|
1262
1295
|
*
|
|
1263
1296
|
* @remarks
|
|
1264
1297
|
* The revision directory and its inner layout both drift across Playwright builds, and the
|
|
@@ -1270,7 +1303,7 @@ export const BUNDLED_CHROMIUM_LAYOUTS = Object.freeze([
|
|
|
1270
1303
|
'chromium-*/chrome-linux/chrome',
|
|
1271
1304
|
])
|
|
1272
1305
|
|
|
1273
|
-
/**
|
|
1306
|
+
/** Lists the stable Playwright Chromium channels and their standard executable layouts. */
|
|
1274
1307
|
export const SYSTEM_BROWSER_CHANNELS = Object.freeze([
|
|
1275
1308
|
Object.freeze({
|
|
1276
1309
|
channel: 'chrome',
|
|
@@ -1291,10 +1324,10 @@ export const SYSTEM_BROWSER_CHANNELS = Object.freeze([
|
|
|
1291
1324
|
])
|
|
1292
1325
|
|
|
1293
1326
|
/**
|
|
1294
|
-
*
|
|
1327
|
+
* Determines whether a path identifies an executable regular file.
|
|
1295
1328
|
*
|
|
1296
1329
|
* @param path - The filesystem path to inspect.
|
|
1297
|
-
* @returns
|
|
1330
|
+
* @returns True if the path is a regular file with execute access; false otherwise.
|
|
1298
1331
|
*
|
|
1299
1332
|
* @example
|
|
1300
1333
|
* \`\`\`ts
|
|
@@ -1312,7 +1345,7 @@ export function isBrowserExecutable(path: string): boolean {
|
|
|
1312
1345
|
}
|
|
1313
1346
|
|
|
1314
1347
|
/**
|
|
1315
|
-
*
|
|
1348
|
+
* Orders two Chromium paths so the highest revision sorts first.
|
|
1316
1349
|
*
|
|
1317
1350
|
* @param left - The first path or directory entry to compare.
|
|
1318
1351
|
* @param right - The second path or directory entry to compare.
|
|
@@ -1335,7 +1368,7 @@ export function compareRevisions(left: string, right: string): number {
|
|
|
1335
1368
|
}
|
|
1336
1369
|
|
|
1337
1370
|
/**
|
|
1338
|
-
*
|
|
1371
|
+
* Reads the executable path of Playwright's pinned Chromium revision.
|
|
1339
1372
|
*
|
|
1340
1373
|
* @returns The pinned executable path, or \`undefined\` when this platform has none.
|
|
1341
1374
|
*
|
|
@@ -1358,7 +1391,7 @@ export function resolvePinnedBrowser(): string | undefined {
|
|
|
1358
1391
|
}
|
|
1359
1392
|
|
|
1360
1393
|
/**
|
|
1361
|
-
*
|
|
1394
|
+
* Resolves a launchable Playwright-managed Chromium executable: the pinned revision when installed,
|
|
1362
1395
|
* otherwise a \`chromium\` / \`chromium.exe\` alias or any other \`chromium-*\` revision under the same
|
|
1363
1396
|
* Playwright browsers directory. A pinned-revision miss is not Chromium absence — managed
|
|
1364
1397
|
* containers ship one usable build, often behind a revision-agnostic alias, for many Playwright
|
|
@@ -1405,7 +1438,7 @@ export function resolveManagedBrowser(pinned: string): string | undefined {
|
|
|
1405
1438
|
}
|
|
1406
1439
|
|
|
1407
1440
|
/**
|
|
1408
|
-
*
|
|
1441
|
+
* Resolves the Chromium a managed Linux container bundles outside the Playwright cache.
|
|
1409
1442
|
*
|
|
1410
1443
|
* @param platform - The Node platform the container runs on.
|
|
1411
1444
|
* @param root - The bundled browsers directory to search.
|
|
@@ -1434,7 +1467,7 @@ export function resolveBundledBrowser(platform: NodeJS.Platform, root: string):
|
|
|
1434
1467
|
}
|
|
1435
1468
|
|
|
1436
1469
|
/**
|
|
1437
|
-
*
|
|
1470
|
+
* Resolves the first installed stable system Chromium channel.
|
|
1438
1471
|
*
|
|
1439
1472
|
* @param platform - The Node platform whose standard layouts this call probes.
|
|
1440
1473
|
* @param environment - The process environment supplying Windows installation roots.
|
|
@@ -1478,7 +1511,7 @@ export function resolveSystemBrowser(
|
|
|
1478
1511
|
}
|
|
1479
1512
|
|
|
1480
1513
|
/**
|
|
1481
|
-
*
|
|
1514
|
+
* Resolves Playwright provider options for whatever browser this host can actually launch.
|
|
1482
1515
|
*
|
|
1483
1516
|
* @param pinned - The executable path for Playwright's pinned Chromium revision, when it has one.
|
|
1484
1517
|
* @param platform - The Node platform whose standard layouts this call probes.
|
|
@@ -1533,7 +1566,7 @@ export function resolveBrowser(
|
|
|
1533
1566
|
`
|
|
1534
1567
|
});
|
|
1535
1568
|
/**
|
|
1536
|
-
*
|
|
1569
|
+
* Holds formatter-stable template text for source, test, document, guide, and service artifacts.
|
|
1537
1570
|
*
|
|
1538
1571
|
* @remarks
|
|
1539
1572
|
* Builders in `compilers.ts` fill every varying span through
|
|
@@ -2627,7 +2660,7 @@ printf '%s\\n' \\
|
|
|
2627
2660
|
//#endregion
|
|
2628
2661
|
//#region src/core/errors.ts
|
|
2629
2662
|
/**
|
|
2630
|
-
*
|
|
2663
|
+
* Represents the one error this package throws, carrying the coded reason it was raised.
|
|
2631
2664
|
*
|
|
2632
2665
|
* @remarks
|
|
2633
2666
|
* Each code names one cause: `INVALID` for off-contract input, `DESTROYED` for
|
|
@@ -2664,7 +2697,7 @@ var ScaffoldError = class extends Error {
|
|
|
2664
2697
|
code;
|
|
2665
2698
|
context;
|
|
2666
2699
|
/**
|
|
2667
|
-
*
|
|
2700
|
+
* Constructs a coded scaffold error.
|
|
2668
2701
|
*
|
|
2669
2702
|
* @param code - The coded reason the error is raised.
|
|
2670
2703
|
* @param message - What went wrong, in one sentence.
|
|
@@ -2678,10 +2711,10 @@ var ScaffoldError = class extends Error {
|
|
|
2678
2711
|
}
|
|
2679
2712
|
};
|
|
2680
2713
|
/**
|
|
2681
|
-
*
|
|
2714
|
+
* Narrows a caught value to a {@link ScaffoldError}.
|
|
2682
2715
|
*
|
|
2683
2716
|
* @param value - The caught value to narrow.
|
|
2684
|
-
* @returns
|
|
2717
|
+
* @returns True if `value` is a {@link ScaffoldError}; false otherwise.
|
|
2685
2718
|
*
|
|
2686
2719
|
* @example
|
|
2687
2720
|
* ```ts
|
|
@@ -2697,11 +2730,11 @@ function isScaffoldError(value) {
|
|
|
2697
2730
|
//#endregion
|
|
2698
2731
|
//#region src/core/validators.ts
|
|
2699
2732
|
/**
|
|
2700
|
-
*
|
|
2733
|
+
* Narrows a value to a logical target-relative path.
|
|
2701
2734
|
*
|
|
2702
2735
|
* @param value - The candidate path.
|
|
2703
|
-
* @returns
|
|
2704
|
-
* control character, or reserved syntax character.
|
|
2736
|
+
* @returns True if the value is a bounded relative path with no traversal, empty
|
|
2737
|
+
* segment, control character, or reserved syntax character; false otherwise.
|
|
2705
2738
|
*
|
|
2706
2739
|
* @remarks
|
|
2707
2740
|
* Every path this package reads or writes passes here, so one law covers a
|
|
@@ -2730,7 +2763,7 @@ function isPath(value) {
|
|
|
2730
2763
|
});
|
|
2731
2764
|
}
|
|
2732
2765
|
/**
|
|
2733
|
-
*
|
|
2766
|
+
* Narrows a value to exact lowercase hexadecimal bytes within one artifact's limit.
|
|
2734
2767
|
*
|
|
2735
2768
|
* @remarks
|
|
2736
2769
|
* Two digits per byte, so an odd length is refused and empty content is valid.
|
|
@@ -2750,7 +2783,7 @@ var isHex = stringOf({
|
|
|
2750
2783
|
pattern: HEX_PATTERN
|
|
2751
2784
|
});
|
|
2752
2785
|
/**
|
|
2753
|
-
*
|
|
2786
|
+
* Narrows a value to text this package will accept as one artifact's content.
|
|
2754
2787
|
*
|
|
2755
2788
|
* @remarks
|
|
2756
2789
|
* The bound is a code-unit ceiling rather than a byte count, because a string
|
|
@@ -2761,10 +2794,11 @@ var isHex = stringOf({
|
|
|
2761
2794
|
*/
|
|
2762
2795
|
var isContent = stringOf({ max: MAX_ARTIFACT_BYTES });
|
|
2763
2796
|
/**
|
|
2764
|
-
*
|
|
2797
|
+
* Narrows a value to an array within the limit one public collection accepts.
|
|
2765
2798
|
*
|
|
2766
2799
|
* @param value - The candidate collection.
|
|
2767
|
-
* @returns
|
|
2800
|
+
* @returns True if the value is an array of no more than
|
|
2801
|
+
* `MAX_COLLECTION_ITEMS` items; false otherwise.
|
|
2768
2802
|
*
|
|
2769
2803
|
* @remarks
|
|
2770
2804
|
* Compose this ahead of an element guard so the item count is settled before
|
|
@@ -2783,7 +2817,7 @@ function isCollection(value) {
|
|
|
2783
2817
|
return holds(() => isArray(value) && value.length <= 1e3);
|
|
2784
2818
|
}
|
|
2785
2819
|
/**
|
|
2786
|
-
*
|
|
2820
|
+
* Narrows a value to one {@link Environment} a workspace may select.
|
|
2787
2821
|
*
|
|
2788
2822
|
* @example
|
|
2789
2823
|
* ```ts
|
|
@@ -2795,7 +2829,7 @@ function isCollection(value) {
|
|
|
2795
2829
|
*/
|
|
2796
2830
|
var isEnvironment = literalOf(ENVIRONMENTS);
|
|
2797
2831
|
/**
|
|
2798
|
-
*
|
|
2832
|
+
* Narrows a value to one {@link Group} a plan selects over.
|
|
2799
2833
|
*
|
|
2800
2834
|
* @example
|
|
2801
2835
|
* ```ts
|
|
@@ -2806,10 +2840,10 @@ var isEnvironment = literalOf(ENVIRONMENTS);
|
|
|
2806
2840
|
* ```
|
|
2807
2841
|
*/
|
|
2808
2842
|
var isGroup = literalOf(GROUPS);
|
|
2809
|
-
/**
|
|
2843
|
+
/** Narrows a value to a bounded group selection. */
|
|
2810
2844
|
var isGroups = andOf(isCollection, arrayOf(isGroup));
|
|
2811
2845
|
/**
|
|
2812
|
-
*
|
|
2846
|
+
* Narrows a value to the scoped package name a runtime dependency carries.
|
|
2813
2847
|
*
|
|
2814
2848
|
* @remarks
|
|
2815
2849
|
* A dependency name reaches a path, because a workspace's guide mirror is
|
|
@@ -2831,7 +2865,7 @@ var isDependencyName = stringOf({
|
|
|
2831
2865
|
pattern: DEPENDENCY_NAME_PATTERN
|
|
2832
2866
|
});
|
|
2833
2867
|
/**
|
|
2834
|
-
*
|
|
2868
|
+
* Narrows a value to a {@link Dependency}.
|
|
2835
2869
|
*
|
|
2836
2870
|
* @remarks
|
|
2837
2871
|
* Structural and bounded: which names and ranges a blueprint may declare is a
|
|
@@ -2858,7 +2892,7 @@ var isDependency = recordOf({
|
|
|
2858
2892
|
optional: isBoolean
|
|
2859
2893
|
}, ["optional"]);
|
|
2860
2894
|
/**
|
|
2861
|
-
*
|
|
2895
|
+
* Narrows a value to a {@link ManifestScript}.
|
|
2862
2896
|
*
|
|
2863
2897
|
* @remarks
|
|
2864
2898
|
* Structural and bounded, exactly as {@link isDependency} is: a script name
|
|
@@ -2889,7 +2923,7 @@ var isManifestScript = recordOf({
|
|
|
2889
2923
|
})))
|
|
2890
2924
|
});
|
|
2891
2925
|
/**
|
|
2892
|
-
*
|
|
2926
|
+
* Narrows a value to an {@link Override}.
|
|
2893
2927
|
*
|
|
2894
2928
|
* @remarks
|
|
2895
2929
|
* Whether the path names a planned artifact is a gate law; whether it names a
|
|
@@ -2907,7 +2941,7 @@ var isOverride = recordOf({
|
|
|
2907
2941
|
content: isContent
|
|
2908
2942
|
});
|
|
2909
2943
|
/**
|
|
2910
|
-
*
|
|
2944
|
+
* Narrows a value to a {@link Blueprint}.
|
|
2911
2945
|
*
|
|
2912
2946
|
* @remarks
|
|
2913
2947
|
* The whole closed record, its literal axes, and the count and length bounds
|
|
@@ -2948,7 +2982,7 @@ var isBlueprint = recordOf({
|
|
|
2948
2982
|
showcase: isBoolean
|
|
2949
2983
|
}, ["description"]);
|
|
2950
2984
|
/**
|
|
2951
|
-
*
|
|
2985
|
+
* Narrows a value to an {@link Artifact}.
|
|
2952
2986
|
*
|
|
2953
2987
|
* @remarks
|
|
2954
2988
|
* One branch per way content is produced, discriminated by `origin` and
|
|
@@ -2988,7 +3022,7 @@ var isArtifact = unionOf(recordOf({
|
|
|
2988
3022
|
content: isContent
|
|
2989
3023
|
}, ["environment"]));
|
|
2990
3024
|
/**
|
|
2991
|
-
*
|
|
3025
|
+
* Narrows a value to a {@link Plan}.
|
|
2992
3026
|
*
|
|
2993
3027
|
* @remarks
|
|
2994
3028
|
* A plan reaches the writer, and the writer has no question channel, so this
|
|
@@ -3004,7 +3038,7 @@ var isPlan = andOf(recordOf({
|
|
|
3004
3038
|
hash: isHex
|
|
3005
3039
|
}, ["hash"]), (plan) => plan.artifacts.every((artifact) => artifact.path !== "package.json" || artifact.ownership === "birth"));
|
|
3006
3040
|
/**
|
|
3007
|
-
*
|
|
3041
|
+
* Narrows a value to a {@link Question}.
|
|
3008
3042
|
*
|
|
3009
3043
|
* @example
|
|
3010
3044
|
* ```ts
|
|
@@ -3020,7 +3054,7 @@ var isQuestion = recordOf({
|
|
|
3020
3054
|
candidates: andOf(isCollection, arrayOf(isString))
|
|
3021
3055
|
}, ["candidates"]);
|
|
3022
3056
|
/**
|
|
3023
|
-
*
|
|
3057
|
+
* Narrows a value to a {@link Finding}.
|
|
3024
3058
|
*
|
|
3025
3059
|
* @remarks
|
|
3026
3060
|
* `observed` is required exactly where the mutation it precedes is held to it,
|
|
@@ -3057,7 +3091,7 @@ var isFinding = unionOf(recordOf({
|
|
|
3057
3091
|
observed: isHex
|
|
3058
3092
|
}, ["observed"]));
|
|
3059
3093
|
/**
|
|
3060
|
-
*
|
|
3094
|
+
* Narrows a value to an {@link Audit}.
|
|
3061
3095
|
*
|
|
3062
3096
|
* @remarks
|
|
3063
3097
|
* An audit reaches the writer and the destructive verb, so it is guarded as
|
|
@@ -3069,7 +3103,7 @@ var isAudit = recordOf({
|
|
|
3069
3103
|
questions: andOf(isCollection, arrayOf(isQuestion))
|
|
3070
3104
|
});
|
|
3071
3105
|
/**
|
|
3072
|
-
*
|
|
3106
|
+
* Narrows a value to a {@link Mirror}.
|
|
3073
3107
|
*
|
|
3074
3108
|
* @remarks
|
|
3075
3109
|
* `content` is the fetched guide text and `observed` is the local mirror's
|
|
@@ -3090,7 +3124,7 @@ var isMirror = unionOf(recordOf({
|
|
|
3090
3124
|
observed: isHex
|
|
3091
3125
|
}, ["observed"]));
|
|
3092
3126
|
/**
|
|
3093
|
-
*
|
|
3127
|
+
* Narrows a value to a {@link CatalogEntry}.
|
|
3094
3128
|
*
|
|
3095
3129
|
* @remarks
|
|
3096
3130
|
* A row that found no version carries the cause instead, and neither branch may
|
|
@@ -3107,11 +3141,11 @@ var isCatalogEntry = unionOf(recordOf({
|
|
|
3107
3141
|
note: isString
|
|
3108
3142
|
}));
|
|
3109
3143
|
/**
|
|
3110
|
-
*
|
|
3144
|
+
* Narrows a value to a {@link Snapshot}.
|
|
3111
3145
|
*
|
|
3112
3146
|
* @param value - The candidate target snapshot.
|
|
3113
|
-
* @returns
|
|
3114
|
-
* whose every value is exact lowercase hexadecimal bytes.
|
|
3147
|
+
* @returns True if the value is a bounded plain record whose every key is a path and
|
|
3148
|
+
* whose every value is exact lowercase hexadecimal bytes; false otherwise.
|
|
3115
3149
|
*
|
|
3116
3150
|
* @remarks
|
|
3117
3151
|
* Read through the shared total key lens, so a hostile `ownKeys` trap and a
|
|
@@ -3137,7 +3171,7 @@ function isSnapshot(value) {
|
|
|
3137
3171
|
});
|
|
3138
3172
|
}
|
|
3139
3173
|
/**
|
|
3140
|
-
*
|
|
3174
|
+
* Narrows a value to the compiler's initial listener record.
|
|
3141
3175
|
*
|
|
3142
3176
|
* @remarks
|
|
3143
3177
|
* Every event is optional and every declared value is a function. A key outside
|
|
@@ -3152,7 +3186,7 @@ var isCompilerHooks = recordOf({
|
|
|
3152
3186
|
destroy: isFunction
|
|
3153
3187
|
}, true);
|
|
3154
3188
|
/**
|
|
3155
|
-
*
|
|
3189
|
+
* Narrows a value to {@link CompilerOptions}.
|
|
3156
3190
|
*
|
|
3157
3191
|
* @example
|
|
3158
3192
|
* ```ts
|
|
@@ -3169,7 +3203,7 @@ var isCompilerOptions = recordOf({
|
|
|
3169
3203
|
//#endregion
|
|
3170
3204
|
//#region src/core/cloners.ts
|
|
3171
3205
|
/**
|
|
3172
|
-
*
|
|
3206
|
+
* Snapshots an untrusted value into exact JSON data the caller owns.
|
|
3173
3207
|
*
|
|
3174
3208
|
* @param value - The untrusted value to take ownership of.
|
|
3175
3209
|
* @returns A deeply frozen copy sharing nothing with `value`, or `undefined`
|
|
@@ -3217,7 +3251,7 @@ function cloneValue(value) {
|
|
|
3217
3251
|
//#endregion
|
|
3218
3252
|
//#region src/core/parsers.ts
|
|
3219
3253
|
/**
|
|
3220
|
-
*
|
|
3254
|
+
* Coerces an untrusted value to a {@link Blueprint}.
|
|
3221
3255
|
*
|
|
3222
3256
|
* @param value - The value to parse.
|
|
3223
3257
|
* @returns The blueprint, or `undefined` when the value is not one.
|
|
@@ -3239,7 +3273,7 @@ function parseBlueprint(value) {
|
|
|
3239
3273
|
return isBlueprint(value) ? value : void 0;
|
|
3240
3274
|
}
|
|
3241
3275
|
/**
|
|
3242
|
-
*
|
|
3276
|
+
* Coerces an untrusted value to a group selection.
|
|
3243
3277
|
*
|
|
3244
3278
|
* @param value - The value to parse.
|
|
3245
3279
|
* @returns The selection, or `undefined` when the value is not one.
|
|
@@ -3261,7 +3295,7 @@ function parseGroups(value) {
|
|
|
3261
3295
|
return isGroups(value) ? value : void 0;
|
|
3262
3296
|
}
|
|
3263
3297
|
/**
|
|
3264
|
-
*
|
|
3298
|
+
* Coerces an untrusted value to a {@link Snapshot}.
|
|
3265
3299
|
*
|
|
3266
3300
|
* @param value - The value to parse.
|
|
3267
3301
|
* @returns The snapshot, or `undefined` when the value is not one.
|
|
@@ -3281,7 +3315,7 @@ function parseSnapshot(value) {
|
|
|
3281
3315
|
return isSnapshot(value) ? value : void 0;
|
|
3282
3316
|
}
|
|
3283
3317
|
/**
|
|
3284
|
-
*
|
|
3318
|
+
* Coerces an untrusted value to {@link CompilerOptions}.
|
|
3285
3319
|
*
|
|
3286
3320
|
* @param value - The value to parse.
|
|
3287
3321
|
* @returns The options, or `undefined` when the value is not an option bag.
|
|
@@ -3305,7 +3339,7 @@ function parseCompilerOptions(value) {
|
|
|
3305
3339
|
//#endregion
|
|
3306
3340
|
//#region src/core/helpers.ts
|
|
3307
3341
|
/**
|
|
3308
|
-
*
|
|
3342
|
+
* Encodes bytes as exact lowercase hexadecimal text.
|
|
3309
3343
|
*
|
|
3310
3344
|
* @param bytes - The bytes to encode.
|
|
3311
3345
|
* @returns Two lowercase hexadecimal digits per input byte, and `''` for no bytes.
|
|
@@ -3329,7 +3363,7 @@ function bytesToHex(bytes) {
|
|
|
3329
3363
|
return hex;
|
|
3330
3364
|
}
|
|
3331
3365
|
/**
|
|
3332
|
-
*
|
|
3366
|
+
* Encodes text as the exact lowercase hexadecimal form of its UTF-8 bytes.
|
|
3333
3367
|
*
|
|
3334
3368
|
* @param content - The text to encode.
|
|
3335
3369
|
* @returns The hexadecimal form of the text's exact UTF-8 bytes.
|
|
@@ -3351,7 +3385,7 @@ function contentToHex(content) {
|
|
|
3351
3385
|
return bytesToHex(new TextEncoder().encode(content));
|
|
3352
3386
|
}
|
|
3353
3387
|
/**
|
|
3354
|
-
*
|
|
3388
|
+
* Counts the UTF-8 bytes text encodes to.
|
|
3355
3389
|
*
|
|
3356
3390
|
* @param content - The text to measure.
|
|
3357
3391
|
* @returns The exact number of UTF-8 bytes.
|
|
@@ -3379,7 +3413,7 @@ function computeBytes(content) {
|
|
|
3379
3413
|
return bytes;
|
|
3380
3414
|
}
|
|
3381
3415
|
/**
|
|
3382
|
-
*
|
|
3416
|
+
* Computes the deterministic content identity of text.
|
|
3383
3417
|
*
|
|
3384
3418
|
* @param text - The text to digest.
|
|
3385
3419
|
* @returns Sixteen lowercase hexadecimal digits.
|
|
@@ -3408,11 +3442,11 @@ function computeHash(text) {
|
|
|
3408
3442
|
return hash.toString(16).padStart(16, "0");
|
|
3409
3443
|
}
|
|
3410
3444
|
/**
|
|
3411
|
-
*
|
|
3445
|
+
* Tests whether a path instructs or wires an agent rather than the toolchain.
|
|
3412
3446
|
*
|
|
3413
3447
|
* @param path - The target-relative path to test.
|
|
3414
|
-
* @returns
|
|
3415
|
-
*
|
|
3448
|
+
* @returns True if the path is beneath a harness directory or is one of the exact
|
|
3449
|
+
* root filenames that wires an agent bench; false otherwise.
|
|
3416
3450
|
*
|
|
3417
3451
|
* @remarks
|
|
3418
3452
|
* The one home of the orchestration membership rule. A vendored path and a
|
|
@@ -3437,8 +3471,8 @@ function matchesOrchestrationPath(path) {
|
|
|
3437
3471
|
* Checks whether another surface owns the vendored bytes at a path.
|
|
3438
3472
|
*
|
|
3439
3473
|
* @param path - The target-relative vendored path to test.
|
|
3440
|
-
* @returns
|
|
3441
|
-
*
|
|
3474
|
+
* @returns True if the path is the catalog agent file or a Markdown guide
|
|
3475
|
+
* mirror; false otherwise.
|
|
3442
3476
|
*
|
|
3443
3477
|
* @remarks
|
|
3444
3478
|
* The materializer keeps these paths presence-owned because the catalog or
|
|
@@ -3460,8 +3494,8 @@ function isDeferredPath(path) {
|
|
|
3460
3494
|
* Checks whether a path belongs to the instruction canon a target reads rather than holds.
|
|
3461
3495
|
*
|
|
3462
3496
|
* @param path - The target-relative path to test.
|
|
3463
|
-
* @returns
|
|
3464
|
-
* member that is a directory;
|
|
3497
|
+
* @returns True if the path is a {@link CANON_PATHS} member or sits beneath a
|
|
3498
|
+
* member that is a directory; false otherwise.
|
|
3465
3499
|
*
|
|
3466
3500
|
* @remarks
|
|
3467
3501
|
* The one reading of canon membership, so the live overlay and the executable's
|
|
@@ -3486,7 +3520,57 @@ function isCanonPath(path) {
|
|
|
3486
3520
|
return CANON_PATHS.some((canon) => path === canon || path.startsWith(`${canon}/`));
|
|
3487
3521
|
}
|
|
3488
3522
|
/**
|
|
3489
|
-
*
|
|
3523
|
+
* Checks whether a target's present bytes at a path are owned by another surface.
|
|
3524
|
+
*
|
|
3525
|
+
* @param path - The target-relative path to test.
|
|
3526
|
+
* @returns True if the path is a {@link WORKSPACE_OWNED_PATHS} member or a
|
|
3527
|
+
* deferred path; false otherwise.
|
|
3528
|
+
*
|
|
3529
|
+
* @remarks
|
|
3530
|
+
* The one reading of presence ownership. A workspace-owned path carries bytes
|
|
3531
|
+
* the consumer's own workspace writes, and a deferred path carries bytes the
|
|
3532
|
+
* catalog or mirror surface writes, so a vendored expansion plans either by
|
|
3533
|
+
* presence rather than reading and claiming its content.
|
|
3534
|
+
*
|
|
3535
|
+
* @example
|
|
3536
|
+
* ```ts
|
|
3537
|
+
* import { isRetainedPath } from '@orkestrel/scaffold'
|
|
3538
|
+
*
|
|
3539
|
+
* isRetainedPath('.gitignore') // true
|
|
3540
|
+
* isRetainedPath('LICENSE') // false
|
|
3541
|
+
* ```
|
|
3542
|
+
*/
|
|
3543
|
+
function isRetainedPath(path) {
|
|
3544
|
+
return WORKSPACE_OWNED_PATHS.includes(path) || isDeferredPath(path);
|
|
3545
|
+
}
|
|
3546
|
+
/**
|
|
3547
|
+
* Checks whether a destination's floor bytes survive a live overlay.
|
|
3548
|
+
*
|
|
3549
|
+
* @param path - The target-relative destination to test.
|
|
3550
|
+
* @returns True if the path is deferred or belongs to the instruction
|
|
3551
|
+
* canon; false otherwise.
|
|
3552
|
+
*
|
|
3553
|
+
* @remarks
|
|
3554
|
+
* The one reading of what a live fill does not replace, so the overlay assembler
|
|
3555
|
+
* and the executable's fetch list never disagree about a destination. A deferred
|
|
3556
|
+
* path's bytes belong to the catalog or mirror verb, and a canon destination is
|
|
3557
|
+
* staged for reading rather than for a target, so the installed floor's bytes
|
|
3558
|
+
* stand for both. A reader that requested either would spend a round trip on
|
|
3559
|
+
* bytes the overlay would not take.
|
|
3560
|
+
*
|
|
3561
|
+
* @example
|
|
3562
|
+
* ```ts
|
|
3563
|
+
* import { isFloorPath } from '@orkestrel/scaffold'
|
|
3564
|
+
*
|
|
3565
|
+
* isFloorPath('AGENTS.md') // true
|
|
3566
|
+
* isFloorPath('scripts/codex.sh') // false
|
|
3567
|
+
* ```
|
|
3568
|
+
*/
|
|
3569
|
+
function isFloorPath(path) {
|
|
3570
|
+
return isDeferredPath(path) || isCanonPath(path);
|
|
3571
|
+
}
|
|
3572
|
+
/**
|
|
3573
|
+
* Infers the {@link Group} a path belongs to.
|
|
3490
3574
|
*
|
|
3491
3575
|
* @param path - The target-relative path to classify.
|
|
3492
3576
|
* @returns The group that owns the path.
|
|
@@ -3521,7 +3605,7 @@ function inferGroup(path) {
|
|
|
3521
3605
|
return "configs";
|
|
3522
3606
|
}
|
|
3523
3607
|
/**
|
|
3524
|
-
*
|
|
3608
|
+
* Serializes one string as a single-quoted TypeScript literal.
|
|
3525
3609
|
*
|
|
3526
3610
|
* @param value - The string to serialize.
|
|
3527
3611
|
* @returns A complete single-quoted literal with line-breaking and delimiter
|
|
@@ -3564,7 +3648,7 @@ function serializeTypeScriptString(value) {
|
|
|
3564
3648
|
return `${serialized}'`;
|
|
3565
3649
|
}
|
|
3566
3650
|
/**
|
|
3567
|
-
*
|
|
3651
|
+
* Derives the guide mirror path a package name answers for.
|
|
3568
3652
|
*
|
|
3569
3653
|
* @param name - A bare or `@orkestrel`-scoped package name.
|
|
3570
3654
|
* @returns The mirror path, `guides/<bare name>.md`.
|
|
@@ -3589,10 +3673,10 @@ function nameToGuide(name) {
|
|
|
3589
3673
|
return `guides/${name.slice(name.lastIndexOf("/") + 1)}.md`;
|
|
3590
3674
|
}
|
|
3591
3675
|
/**
|
|
3592
|
-
*
|
|
3676
|
+
* Tests whether one emitted line fits the vendored formatter width.
|
|
3593
3677
|
*
|
|
3594
3678
|
* @param line - One emitted line, leading tabs included.
|
|
3595
|
-
* @returns
|
|
3679
|
+
* @returns True if the expanded line fits; false otherwise.
|
|
3596
3680
|
*
|
|
3597
3681
|
* @remarks
|
|
3598
3682
|
* A generator writes source the formatter then reads back, so a line packed
|
|
@@ -3613,7 +3697,7 @@ function matchesPrintWidth(line) {
|
|
|
3613
3697
|
return line.replaceAll(" ", " ".repeat(2)).length <= 100;
|
|
3614
3698
|
}
|
|
3615
3699
|
/**
|
|
3616
|
-
*
|
|
3700
|
+
* Derives the declaration rewrite a published face's `beforeWriteFile` applies.
|
|
3617
3701
|
*
|
|
3618
3702
|
* @param name - The workspace's own bare package name.
|
|
3619
3703
|
* @returns The ternary consequent an emitted `vite.{browser,server}.config.ts`
|
|
@@ -3653,7 +3737,34 @@ function nameToRewrite(name) {
|
|
|
3653
3737
|
].join("\n");
|
|
3654
3738
|
}
|
|
3655
3739
|
/**
|
|
3656
|
-
*
|
|
3740
|
+
* Selects the single published environment a package root points at.
|
|
3741
|
+
*
|
|
3742
|
+
* @param src - The declared published environments.
|
|
3743
|
+
* @returns That environment, or `undefined` when the selection declares none or
|
|
3744
|
+
* several.
|
|
3745
|
+
*
|
|
3746
|
+
* @remarks
|
|
3747
|
+
* A workspace publishing exactly one environment puts it at the package root,
|
|
3748
|
+
* so its entry fields and its `'.'` export condition both name that
|
|
3749
|
+
* environment's build. A workspace publishing several puts core at the root and
|
|
3750
|
+
* gives every other environment a subpath, so there is no single root to name.
|
|
3751
|
+
* Both callers read the same answer, which is why the branch is decided once
|
|
3752
|
+
* here rather than twice.
|
|
3753
|
+
*
|
|
3754
|
+
* @example
|
|
3755
|
+
* ```ts
|
|
3756
|
+
* import { srcToRoot } from '@orkestrel/scaffold'
|
|
3757
|
+
*
|
|
3758
|
+
* srcToRoot(['browser']) // 'browser'
|
|
3759
|
+
* srcToRoot(['core', 'server']) // undefined
|
|
3760
|
+
* ```
|
|
3761
|
+
*/
|
|
3762
|
+
function srcToRoot(src) {
|
|
3763
|
+
if (src.length !== 1) return void 0;
|
|
3764
|
+
return src[0];
|
|
3765
|
+
}
|
|
3766
|
+
/**
|
|
3767
|
+
* Selects the host paths a named workspace vendors.
|
|
3657
3768
|
*
|
|
3658
3769
|
* @param paths - The candidate host paths, in their declared order.
|
|
3659
3770
|
* @param name - The target workspace's own bare package name.
|
|
@@ -3676,7 +3787,7 @@ function selectHostPaths(paths, name) {
|
|
|
3676
3787
|
return paths.filter((path) => path !== guide);
|
|
3677
3788
|
}
|
|
3678
3789
|
/**
|
|
3679
|
-
*
|
|
3790
|
+
* Selects the groups a compile covers, in plan order.
|
|
3680
3791
|
*
|
|
3681
3792
|
* @param groups - The requested selection; every group when absent.
|
|
3682
3793
|
* @returns The requested groups in `GROUPS` order, without repeats.
|
|
@@ -3701,7 +3812,7 @@ function selectGroups(groups) {
|
|
|
3701
3812
|
return GROUPS.filter((group) => selection.includes(group));
|
|
3702
3813
|
}
|
|
3703
3814
|
/**
|
|
3704
|
-
*
|
|
3815
|
+
* Projects an artifact to the exact bytes it claims, as hexadecimal.
|
|
3705
3816
|
*
|
|
3706
3817
|
* @param artifact - The planned artifact to read.
|
|
3707
3818
|
* @returns The claimed bytes, or `undefined` when the artifact claims none.
|
|
@@ -3730,7 +3841,7 @@ function artifactToHex(artifact) {
|
|
|
3730
3841
|
return artifact.hex;
|
|
3731
3842
|
}
|
|
3732
3843
|
/**
|
|
3733
|
-
*
|
|
3844
|
+
* Infers how one target path compares to the artifact planned for it.
|
|
3734
3845
|
*
|
|
3735
3846
|
* @param artifact - The planned artifact.
|
|
3736
3847
|
* @param observed - The destination's exact bytes as hexadecimal; absent when
|
|
@@ -3772,16 +3883,99 @@ function inferDrift(artifact, observed) {
|
|
|
3772
3883
|
return observed === artifactToHex(artifact) ? "aligned" : "stale";
|
|
3773
3884
|
}
|
|
3774
3885
|
/**
|
|
3775
|
-
*
|
|
3886
|
+
* Projects one planned artifact and the bytes found at its path into a verdict.
|
|
3887
|
+
*
|
|
3888
|
+
* @param artifact - The planned artifact.
|
|
3889
|
+
* @param observed - The destination's exact bytes as hexadecimal; absent when
|
|
3890
|
+
* the destination holds no file.
|
|
3891
|
+
* @returns The finding, carrying the artifact's ownership and `observed`
|
|
3892
|
+
* exactly where bytes were read.
|
|
3893
|
+
*
|
|
3894
|
+
* @remarks
|
|
3895
|
+
* The comparison itself is {@link inferDrift}'s, so ownership decides it here
|
|
3896
|
+
* exactly as it does everywhere else. This adds only the shape: a missing
|
|
3897
|
+
* destination has no bytes to record, and every other verdict records the bytes
|
|
3898
|
+
* it was given, which is the precondition the mutation that follows is held to.
|
|
3899
|
+
* Ownership is copied rather than inferred from drift because aligned findings
|
|
3900
|
+
* span every ownership tier.
|
|
3901
|
+
*
|
|
3902
|
+
* `foreign` is not answerable here, because it describes a path no artifact was
|
|
3903
|
+
* planned for.
|
|
3904
|
+
*
|
|
3905
|
+
* @example
|
|
3906
|
+
* ```ts
|
|
3907
|
+
* import { artifactToFinding } from '@orkestrel/scaffold'
|
|
3908
|
+
*
|
|
3909
|
+
* artifactToFinding(
|
|
3910
|
+
* { path: 'README.md', group: 'docs', ownership: 'content', origin: 'computed', content: 'hi\n' },
|
|
3911
|
+
* '6279650a',
|
|
3912
|
+
* ) // { path: 'README.md', group: 'docs', ownership: 'content', drift: 'stale', observed: '6279650a' }
|
|
3913
|
+
* ```
|
|
3914
|
+
*/
|
|
3915
|
+
function artifactToFinding(artifact, observed) {
|
|
3916
|
+
const path = artifact.path;
|
|
3917
|
+
const group = artifact.group;
|
|
3918
|
+
const ownership = artifact.ownership;
|
|
3919
|
+
if (observed === void 0) return inferDrift(artifact) === "aligned" ? {
|
|
3920
|
+
path,
|
|
3921
|
+
group,
|
|
3922
|
+
ownership,
|
|
3923
|
+
drift: "aligned"
|
|
3924
|
+
} : {
|
|
3925
|
+
path,
|
|
3926
|
+
group,
|
|
3927
|
+
ownership,
|
|
3928
|
+
drift: "missing"
|
|
3929
|
+
};
|
|
3930
|
+
return inferDrift(artifact, observed) === "stale" ? {
|
|
3931
|
+
path,
|
|
3932
|
+
group,
|
|
3933
|
+
ownership,
|
|
3934
|
+
drift: "stale",
|
|
3935
|
+
observed
|
|
3936
|
+
} : {
|
|
3937
|
+
path,
|
|
3938
|
+
group,
|
|
3939
|
+
ownership,
|
|
3940
|
+
drift: "aligned",
|
|
3941
|
+
observed
|
|
3942
|
+
};
|
|
3943
|
+
}
|
|
3944
|
+
/**
|
|
3945
|
+
* Tests whether {@link inferDrift} could have produced a finding for an ownership.
|
|
3776
3946
|
*
|
|
3777
3947
|
* @param ownership - What scaffold claims at the planned path.
|
|
3778
3948
|
* @param finding - The audit verdict to test.
|
|
3779
|
-
* @returns
|
|
3949
|
+
* @returns True if the ownership and verdict are reachable through
|
|
3950
|
+
* {@link inferDrift}; false otherwise.
|
|
3780
3951
|
*
|
|
3781
3952
|
* @remarks
|
|
3782
3953
|
* This predicate keeps the comparison law beside the reachability law it
|
|
3783
3954
|
* restates. A mutation uses it so a refusal can distinguish an impossible
|
|
3784
3955
|
* verdict from a target that genuinely moved after its audit.
|
|
3956
|
+
*
|
|
3957
|
+
* @example
|
|
3958
|
+
* ```ts
|
|
3959
|
+
* import type { Finding } from '@orkestrel/scaffold'
|
|
3960
|
+
* import { matchesDriftReachability } from '@orkestrel/scaffold'
|
|
3961
|
+
*
|
|
3962
|
+
* const aligned: Finding = {
|
|
3963
|
+
* path: 'README.md',
|
|
3964
|
+
* group: 'docs',
|
|
3965
|
+
* ownership: 'birth',
|
|
3966
|
+
* drift: 'aligned',
|
|
3967
|
+
* }
|
|
3968
|
+
* const stale: Finding = {
|
|
3969
|
+
* path: 'README.md',
|
|
3970
|
+
* group: 'docs',
|
|
3971
|
+
* ownership: 'birth',
|
|
3972
|
+
* drift: 'stale',
|
|
3973
|
+
* observed: '6279650a',
|
|
3974
|
+
* }
|
|
3975
|
+
*
|
|
3976
|
+
* matchesDriftReachability('birth', aligned) // true
|
|
3977
|
+
* matchesDriftReachability('birth', stale) // false
|
|
3978
|
+
* ```
|
|
3785
3979
|
*/
|
|
3786
3980
|
function matchesDriftReachability(ownership, finding) {
|
|
3787
3981
|
if (finding.drift === "aligned") return ownership === "birth" || finding.observed !== void 0;
|
|
@@ -3789,7 +3983,7 @@ function matchesDriftReachability(ownership, finding) {
|
|
|
3789
3983
|
return finding.drift === "stale" && ownership === "content";
|
|
3790
3984
|
}
|
|
3791
3985
|
/**
|
|
3792
|
-
*
|
|
3986
|
+
* Projects a catalog into the layers it publishes in.
|
|
3793
3987
|
*
|
|
3794
3988
|
* @param entries - The catalog rows to order.
|
|
3795
3989
|
* @returns One layer per round, each holding the names publishable together,
|
|
@@ -3837,7 +4031,7 @@ function catalogToLayers(entries) {
|
|
|
3837
4031
|
return layers;
|
|
3838
4032
|
}
|
|
3839
4033
|
/**
|
|
3840
|
-
*
|
|
4034
|
+
* Projects a plan into its tally by artifact origin.
|
|
3841
4035
|
*
|
|
3842
4036
|
* @param plan - The plan to summarize.
|
|
3843
4037
|
* @returns The workspace's name, both environment axes, the covered groups, and
|
|
@@ -3874,7 +4068,7 @@ function planToSummary(plan) {
|
|
|
3874
4068
|
};
|
|
3875
4069
|
}
|
|
3876
4070
|
/**
|
|
3877
|
-
*
|
|
4071
|
+
* Extracts the major, minor, and patch components of an exact version.
|
|
3878
4072
|
*
|
|
3879
4073
|
* @param version - The candidate version text.
|
|
3880
4074
|
* @returns The major, minor, and patch numbers, or `undefined` when the text is
|
|
@@ -3904,7 +4098,7 @@ function extractVersion(version) {
|
|
|
3904
4098
|
];
|
|
3905
4099
|
}
|
|
3906
4100
|
/**
|
|
3907
|
-
*
|
|
4101
|
+
* Extracts the major component of an admitted dependency range.
|
|
3908
4102
|
*
|
|
3909
4103
|
* @param range - The candidate range text.
|
|
3910
4104
|
* @returns The major number, or `undefined` when the text is not a canonical
|
|
@@ -3930,7 +4124,7 @@ function extractRangeMajor(range) {
|
|
|
3930
4124
|
return major === void 0 ? void 0 : Number(major);
|
|
3931
4125
|
}
|
|
3932
4126
|
/**
|
|
3933
|
-
*
|
|
4127
|
+
* Compares two versions by their numeric components.
|
|
3934
4128
|
*
|
|
3935
4129
|
* @param left - The version ordered first when it compares lower.
|
|
3936
4130
|
* @param right - The version compared against.
|
|
@@ -3965,11 +4159,11 @@ function compareVersions(left, right) {
|
|
|
3965
4159
|
return 0;
|
|
3966
4160
|
}
|
|
3967
4161
|
/**
|
|
3968
|
-
*
|
|
4162
|
+
* Tests whether a declared range already admits a published version.
|
|
3969
4163
|
*
|
|
3970
4164
|
* @param range - The declared dependency range.
|
|
3971
4165
|
* @param latest - The version the registry reported as latest.
|
|
3972
|
-
* @returns
|
|
4166
|
+
* @returns True if the range admits that version; false otherwise.
|
|
3973
4167
|
*
|
|
3974
4168
|
* @remarks
|
|
3975
4169
|
* The one place this comparison is made. A `Release` records the declared range
|
|
@@ -4022,11 +4216,11 @@ function matchesRange(range, latest) {
|
|
|
4022
4216
|
return compareVersions(latest, declared) >= 0;
|
|
4023
4217
|
}
|
|
4024
4218
|
/**
|
|
4025
|
-
*
|
|
4219
|
+
* Tests whether a declared engines floor is at or above the supported minimum.
|
|
4026
4220
|
*
|
|
4027
4221
|
* @param engines - The declared `engines.node` range.
|
|
4028
|
-
* @returns
|
|
4029
|
-
*
|
|
4222
|
+
* @returns True if the range is the accepted syntax and its floor is at or above
|
|
4223
|
+
* `MINIMUM_NODE_VERSION`; false otherwise.
|
|
4030
4224
|
*
|
|
4031
4225
|
* @remarks
|
|
4032
4226
|
* The declaration states a floor, so the comparison is against the oldest Node
|
|
@@ -4047,7 +4241,7 @@ function matchesEngines(engines) {
|
|
|
4047
4241
|
return compareVersions(engines.slice(2), MINIMUM_NODE_VERSION) >= 0;
|
|
4048
4242
|
}
|
|
4049
4243
|
/**
|
|
4050
|
-
*
|
|
4244
|
+
* Projects a package manifest's text to its own name.
|
|
4051
4245
|
*
|
|
4052
4246
|
* @param manifest - The `package.json` text.
|
|
4053
4247
|
* @returns The declared name, or `undefined` when the text is oversized,
|
|
@@ -4075,7 +4269,8 @@ function manifestToName(manifest) {
|
|
|
4075
4269
|
return name;
|
|
4076
4270
|
}
|
|
4077
4271
|
/**
|
|
4078
|
-
*
|
|
4272
|
+
* Projects a package manifest's text to the `@orkestrel/*` packages each dependency
|
|
4273
|
+
* section declares.
|
|
4079
4274
|
*
|
|
4080
4275
|
* @param manifest - The `package.json` text.
|
|
4081
4276
|
* @returns The runtime, development, and peer declarations as separate lists.
|
|
@@ -4147,34 +4342,7 @@ function manifestToDependencies(manifest) {
|
|
|
4147
4342
|
//#endregion
|
|
4148
4343
|
//#region src/core/compilers.ts
|
|
4149
4344
|
/**
|
|
4150
|
-
*
|
|
4151
|
-
*
|
|
4152
|
-
* @param src - The declared published environments.
|
|
4153
|
-
* @returns That environment, or `undefined` when the selection declares none or
|
|
4154
|
-
* several.
|
|
4155
|
-
*
|
|
4156
|
-
* @remarks
|
|
4157
|
-
* A workspace publishing exactly one environment puts it at the package root,
|
|
4158
|
-
* so its entry fields and its `'.'` export condition both name that
|
|
4159
|
-
* environment's build. A workspace publishing several puts core at the root and
|
|
4160
|
-
* gives every other environment a subpath, so there is no single root to name.
|
|
4161
|
-
* Both callers read the same answer, which is why the branch is decided once
|
|
4162
|
-
* here rather than twice.
|
|
4163
|
-
*
|
|
4164
|
-
* @example
|
|
4165
|
-
* ```ts
|
|
4166
|
-
* import { srcToRoot } from '@orkestrel/scaffold'
|
|
4167
|
-
*
|
|
4168
|
-
* srcToRoot(['browser']) // 'browser'
|
|
4169
|
-
* srcToRoot(['core', 'server']) // undefined
|
|
4170
|
-
* ```
|
|
4171
|
-
*/
|
|
4172
|
-
function srcToRoot(src) {
|
|
4173
|
-
if (src.length !== 1) return void 0;
|
|
4174
|
-
return src[0];
|
|
4175
|
-
}
|
|
4176
|
-
/**
|
|
4177
|
-
* Build one `exports` condition block for a built environment.
|
|
4345
|
+
* Builds one `exports` condition block for a built environment.
|
|
4178
4346
|
*
|
|
4179
4347
|
* @param path - The extensionless `dist` path both conditions point at.
|
|
4180
4348
|
* @param formats - The module formats that environment builds.
|
|
@@ -4210,7 +4378,7 @@ function pathToCondition(path, formats) {
|
|
|
4210
4378
|
};
|
|
4211
4379
|
}
|
|
4212
4380
|
/**
|
|
4213
|
-
*
|
|
4381
|
+
* Projects a published selection into the manifest's entry fields.
|
|
4214
4382
|
*
|
|
4215
4383
|
* @param src - The declared published environments.
|
|
4216
4384
|
* @returns The `main` and `module` fields, plus `types` when one environment
|
|
@@ -4247,7 +4415,7 @@ function srcToEntry(src) {
|
|
|
4247
4415
|
};
|
|
4248
4416
|
}
|
|
4249
4417
|
/**
|
|
4250
|
-
*
|
|
4418
|
+
* Projects a published selection into the manifest's `exports` map.
|
|
4251
4419
|
*
|
|
4252
4420
|
* @param src - The declared published environments.
|
|
4253
4421
|
* @returns The map, keyed by subpath in `ENVIRONMENTS` order.
|
|
@@ -4284,7 +4452,7 @@ function srcToExports(src) {
|
|
|
4284
4452
|
return map;
|
|
4285
4453
|
}
|
|
4286
4454
|
/**
|
|
4287
|
-
*
|
|
4455
|
+
* Projects a blueprint into the development dependencies its manifest declares.
|
|
4288
4456
|
*
|
|
4289
4457
|
* @param blueprint - The workspace specification.
|
|
4290
4458
|
* @returns The merged set, sorted by package name.
|
|
@@ -4336,7 +4504,7 @@ function blueprintToDevDependencies(blueprint) {
|
|
|
4336
4504
|
return Object.fromEntries(Object.entries(merged).filter(([name]) => name !== own && !runtime.has(name)).sort(([left], [right]) => compareValues(left, right)));
|
|
4337
4505
|
}
|
|
4338
4506
|
/**
|
|
4339
|
-
*
|
|
4507
|
+
* Projects a blueprint into the scripts its manifest declares.
|
|
4340
4508
|
*
|
|
4341
4509
|
* @param blueprint - The workspace specification.
|
|
4342
4510
|
* @returns The scripts, in the order the manifest lists them.
|
|
@@ -4473,7 +4641,7 @@ function blueprintToScripts(blueprint) {
|
|
|
4473
4641
|
return scripts;
|
|
4474
4642
|
}
|
|
4475
4643
|
/**
|
|
4476
|
-
*
|
|
4644
|
+
* Projects a blueprint into the manifest scripts a region write may replace.
|
|
4477
4645
|
*
|
|
4478
4646
|
* @param blueprint - The workspace specification.
|
|
4479
4647
|
* @returns One entry per writable script.
|
|
@@ -4530,7 +4698,7 @@ function blueprintToWritableScripts(blueprint) {
|
|
|
4530
4698
|
return writable;
|
|
4531
4699
|
}
|
|
4532
4700
|
/**
|
|
4533
|
-
*
|
|
4701
|
+
* Compiles a blueprint into its `package.json` content.
|
|
4534
4702
|
*
|
|
4535
4703
|
* @param blueprint - The workspace specification.
|
|
4536
4704
|
* @returns The manifest text, newline-terminated.
|
|
@@ -4616,7 +4784,7 @@ function blueprintToManifest(blueprint) {
|
|
|
4616
4784
|
return `${JSON.stringify(manifest, void 0, " ")}\n`;
|
|
4617
4785
|
}
|
|
4618
4786
|
/**
|
|
4619
|
-
*
|
|
4787
|
+
* Derives the host-specific machinery a generated root Vite configuration carries.
|
|
4620
4788
|
*
|
|
4621
4789
|
* @param blueprint - The workspace specification.
|
|
4622
4790
|
* @returns The pipelines the generated configuration selects.
|
|
@@ -4652,7 +4820,7 @@ function blueprintToMachinery(blueprint) {
|
|
|
4652
4820
|
};
|
|
4653
4821
|
}
|
|
4654
4822
|
/**
|
|
4655
|
-
*
|
|
4823
|
+
* Compiles the root TypeScript configuration for a blueprint.
|
|
4656
4824
|
*
|
|
4657
4825
|
* @param blueprint - The workspace specification.
|
|
4658
4826
|
* @returns Formatter-stable `tsconfig.json` text.
|
|
@@ -4674,7 +4842,7 @@ function blueprintToRootTsconfig(blueprint) {
|
|
|
4674
4842
|
return fillTemplate(CONFIG_TEMPLATES.root.tsconfig, { paths });
|
|
4675
4843
|
}
|
|
4676
4844
|
/**
|
|
4677
|
-
*
|
|
4845
|
+
* Compiles the root Vite and Vitest configuration for a blueprint.
|
|
4678
4846
|
*
|
|
4679
4847
|
* @param blueprint - The workspace specification.
|
|
4680
4848
|
* @returns Formatter-stable `vite.config.ts` text.
|
|
@@ -4865,7 +5033,7 @@ ${projects.map((project) => `\t\t\t${project},`).join("\n")}
|
|
|
4865
5033
|
});
|
|
4866
5034
|
}
|
|
4867
5035
|
/**
|
|
4868
|
-
*
|
|
5036
|
+
* Compiles every artifact in the `configs` group.
|
|
4869
5037
|
*
|
|
4870
5038
|
* @param blueprint - The workspace specification.
|
|
4871
5039
|
* @returns Root and selected wrapper artifacts in matrix order.
|
|
@@ -4975,7 +5143,7 @@ ${paths.join("\n")}
|
|
|
4975
5143
|
return artifacts;
|
|
4976
5144
|
}
|
|
4977
5145
|
/**
|
|
4978
|
-
*
|
|
5146
|
+
* Compiles every artifact in the `source` group.
|
|
4979
5147
|
*
|
|
4980
5148
|
* @param blueprint - The workspace specification.
|
|
4981
5149
|
* @returns Empty published barrels, selected application entries, and the optional bin entry.
|
|
@@ -5050,7 +5218,7 @@ function blueprintToSourceArtifacts(blueprint) {
|
|
|
5050
5218
|
return artifacts;
|
|
5051
5219
|
}
|
|
5052
5220
|
/**
|
|
5053
|
-
*
|
|
5221
|
+
* Compiles every artifact in the `tests` group that is not vendored from the host.
|
|
5054
5222
|
*
|
|
5055
5223
|
* @param blueprint - The workspace specification.
|
|
5056
5224
|
* @returns Shared setup modules, axis tests, and the optional integration seed.
|
|
@@ -5206,10 +5374,19 @@ function blueprintToTestArtifacts(blueprint) {
|
|
|
5206
5374
|
return artifacts;
|
|
5207
5375
|
}
|
|
5208
5376
|
/**
|
|
5209
|
-
*
|
|
5377
|
+
* Compiles the generated workspace's guide index.
|
|
5210
5378
|
*
|
|
5211
5379
|
* @param blueprint - The workspace specification.
|
|
5212
5380
|
* @returns One birth-owned guide index carrying the concept and directory views.
|
|
5381
|
+
*
|
|
5382
|
+
* @example
|
|
5383
|
+
* ```ts
|
|
5384
|
+
* import { blueprintToGuideArtifacts, createBlueprint } from '@orkestrel/scaffold'
|
|
5385
|
+
*
|
|
5386
|
+
* const blueprint = createBlueprint('router', { src: ['core'] })
|
|
5387
|
+
*
|
|
5388
|
+
* blueprintToGuideArtifacts(blueprint)[0]?.path // 'guides/README.md'
|
|
5389
|
+
* ```
|
|
5213
5390
|
*/
|
|
5214
5391
|
function blueprintToGuideArtifacts(blueprint) {
|
|
5215
5392
|
const source = [];
|
|
@@ -5245,7 +5422,7 @@ function blueprintToGuideArtifacts(blueprint) {
|
|
|
5245
5422
|
}];
|
|
5246
5423
|
}
|
|
5247
5424
|
/**
|
|
5248
|
-
*
|
|
5425
|
+
* Compiles the generated workspace's root documentation.
|
|
5249
5426
|
*
|
|
5250
5427
|
* @param blueprint - The workspace specification.
|
|
5251
5428
|
* @returns The birth-owned package front page and the content-owned `AGENTS.md`
|
|
@@ -5264,6 +5441,15 @@ function blueprintToGuideArtifacts(blueprint) {
|
|
|
5264
5441
|
* Neither pointer carries a varying span, so neither is filled: a workspace's
|
|
5265
5442
|
* name never reaches the text, and the paths a reader follows are the same in
|
|
5266
5443
|
* every target.
|
|
5444
|
+
*
|
|
5445
|
+
* @example
|
|
5446
|
+
* ```ts
|
|
5447
|
+
* import { blueprintToDocumentArtifacts, createBlueprint } from '@orkestrel/scaffold'
|
|
5448
|
+
*
|
|
5449
|
+
* const blueprint = createBlueprint('router', { src: ['core'] })
|
|
5450
|
+
*
|
|
5451
|
+
* blueprintToDocumentArtifacts(blueprint).map((artifact) => artifact.path) // ['README.md', 'AGENTS.md', 'CLAUDE.md']
|
|
5452
|
+
* ```
|
|
5267
5453
|
*/
|
|
5268
5454
|
function blueprintToDocumentArtifacts(blueprint) {
|
|
5269
5455
|
const publishes = blueprint.src.length > 0;
|
|
@@ -5297,7 +5483,7 @@ function blueprintToDocumentArtifacts(blueprint) {
|
|
|
5297
5483
|
];
|
|
5298
5484
|
}
|
|
5299
5485
|
/**
|
|
5300
|
-
*
|
|
5486
|
+
* Compiles the blueprint-dependent orchestration artifacts.
|
|
5301
5487
|
*
|
|
5302
5488
|
* @param blueprint - The workspace specification.
|
|
5303
5489
|
* @returns A vendor inventory script when vendors are declared, otherwise none.
|
|
@@ -5306,6 +5492,17 @@ function blueprintToDocumentArtifacts(blueprint) {
|
|
|
5306
5492
|
* A vendor name does not describe startup, readiness, or cleanup. The script
|
|
5307
5493
|
* therefore records only the declared inventory and does not invent a service
|
|
5308
5494
|
* runner or test project.
|
|
5495
|
+
*
|
|
5496
|
+
* @example
|
|
5497
|
+
* ```ts
|
|
5498
|
+
* import { blueprintToOrchestrationArtifacts, createBlueprint } from '@orkestrel/scaffold'
|
|
5499
|
+
*
|
|
5500
|
+
* const plain = createBlueprint('router', { src: ['core'] })
|
|
5501
|
+
* const served = createBlueprint('router', { src: ['core'], vendors: ['ollama'] })
|
|
5502
|
+
*
|
|
5503
|
+
* blueprintToOrchestrationArtifacts(plain) // []
|
|
5504
|
+
* blueprintToOrchestrationArtifacts(served)[0]?.path // 'scripts/service.sh'
|
|
5505
|
+
* ```
|
|
5309
5506
|
*/
|
|
5310
5507
|
function blueprintToOrchestrationArtifacts(blueprint) {
|
|
5311
5508
|
if (blueprint.vendors.length === 0) return [];
|
|
@@ -5319,7 +5516,7 @@ function blueprintToOrchestrationArtifacts(blueprint) {
|
|
|
5319
5516
|
}];
|
|
5320
5517
|
}
|
|
5321
5518
|
/**
|
|
5322
|
-
*
|
|
5519
|
+
* Compiles the vendored host artifacts a named workspace plans.
|
|
5323
5520
|
*
|
|
5324
5521
|
* @param name - The target workspace's own bare package name.
|
|
5325
5522
|
* @returns One artifact per vendored path in `HOST_PATHS` order, then the
|
|
@@ -5364,7 +5561,7 @@ function nameToHostArtifacts(name) {
|
|
|
5364
5561
|
}));
|
|
5365
5562
|
}
|
|
5366
5563
|
/**
|
|
5367
|
-
*
|
|
5564
|
+
* Replaces the content of every drafted artifact an override names.
|
|
5368
5565
|
*
|
|
5369
5566
|
* @param artifacts - The drafted artifacts.
|
|
5370
5567
|
* @param overrides - The blueprint's overrides.
|
|
@@ -5399,7 +5596,7 @@ function applyOverrides(artifacts, overrides) {
|
|
|
5399
5596
|
});
|
|
5400
5597
|
}
|
|
5401
5598
|
/**
|
|
5402
|
-
*
|
|
5599
|
+
* Replaces declared dependency ranges in package manifest text.
|
|
5403
5600
|
*
|
|
5404
5601
|
* @param manifest - The manifest text to compile.
|
|
5405
5602
|
* @param pins - The runtime and development names and replacement ranges.
|
|
@@ -5580,7 +5777,7 @@ function replaceManifestRanges(manifest, pins) {
|
|
|
5580
5777
|
return declaredRuntime && declaredDevelopment ? compiled : void 0;
|
|
5581
5778
|
}
|
|
5582
5779
|
/**
|
|
5583
|
-
*
|
|
5780
|
+
* Replaces named script values in package manifest text.
|
|
5584
5781
|
*
|
|
5585
5782
|
* @param manifest - The manifest text to compile.
|
|
5586
5783
|
* @param scripts - The scripts to write, each with the predecessors it accepts.
|
|
@@ -5808,7 +6005,7 @@ function replaceManifestScripts(manifest, scripts) {
|
|
|
5808
6005
|
return compiled;
|
|
5809
6006
|
}
|
|
5810
6007
|
/**
|
|
5811
|
-
*
|
|
6008
|
+
* Replaces dependency ranges in a plan's manifest and recomputes its identity.
|
|
5812
6009
|
*
|
|
5813
6010
|
* @param plan - The plan carrying the manifest artifact to compile.
|
|
5814
6011
|
* @param pins - The runtime and development names and replacement ranges.
|
|
@@ -5856,7 +6053,7 @@ function replacePlanRanges(plan, pins) {
|
|
|
5856
6053
|
};
|
|
5857
6054
|
}
|
|
5858
6055
|
/**
|
|
5859
|
-
*
|
|
6056
|
+
* Computes a plan's content identity.
|
|
5860
6057
|
*
|
|
5861
6058
|
* @param plan - The plan to identify.
|
|
5862
6059
|
* @returns Sixteen lowercase hexadecimal digits, or `undefined` when the plan
|
|
@@ -5893,66 +6090,7 @@ function planToHash(plan) {
|
|
|
5893
6090
|
return computeHash(outcome.value);
|
|
5894
6091
|
}
|
|
5895
6092
|
/**
|
|
5896
|
-
*
|
|
5897
|
-
*
|
|
5898
|
-
* @param artifact - The planned artifact.
|
|
5899
|
-
* @param observed - The destination's exact bytes as hexadecimal; absent when
|
|
5900
|
-
* the destination holds no file.
|
|
5901
|
-
* @returns The finding, carrying the artifact's ownership and `observed`
|
|
5902
|
-
* exactly where bytes were read.
|
|
5903
|
-
*
|
|
5904
|
-
* @remarks
|
|
5905
|
-
* The comparison itself is {@link inferDrift}'s, so ownership decides it here
|
|
5906
|
-
* exactly as it does everywhere else. This adds only the shape: a missing
|
|
5907
|
-
* destination has no bytes to record, and every other verdict records the bytes
|
|
5908
|
-
* it was given, which is the precondition the mutation that follows is held to.
|
|
5909
|
-
* Ownership is copied rather than inferred from drift because aligned findings
|
|
5910
|
-
* span every ownership tier.
|
|
5911
|
-
*
|
|
5912
|
-
* `foreign` is not answerable here, because it describes a path no artifact was
|
|
5913
|
-
* planned for.
|
|
5914
|
-
*
|
|
5915
|
-
* @example
|
|
5916
|
-
* ```ts
|
|
5917
|
-
* import { artifactToFinding } from '@orkestrel/scaffold'
|
|
5918
|
-
*
|
|
5919
|
-
* artifactToFinding(
|
|
5920
|
-
* { path: 'README.md', group: 'docs', ownership: 'content', origin: 'computed', content: 'hi\n' },
|
|
5921
|
-
* '6279650a',
|
|
5922
|
-
* ) // { path: 'README.md', group: 'docs', ownership: 'content', drift: 'stale', observed: '6279650a' }
|
|
5923
|
-
* ```
|
|
5924
|
-
*/
|
|
5925
|
-
function artifactToFinding(artifact, observed) {
|
|
5926
|
-
const path = artifact.path;
|
|
5927
|
-
const group = artifact.group;
|
|
5928
|
-
const ownership = artifact.ownership;
|
|
5929
|
-
if (observed === void 0) return inferDrift(artifact) === "aligned" ? {
|
|
5930
|
-
path,
|
|
5931
|
-
group,
|
|
5932
|
-
ownership,
|
|
5933
|
-
drift: "aligned"
|
|
5934
|
-
} : {
|
|
5935
|
-
path,
|
|
5936
|
-
group,
|
|
5937
|
-
ownership,
|
|
5938
|
-
drift: "missing"
|
|
5939
|
-
};
|
|
5940
|
-
return inferDrift(artifact, observed) === "stale" ? {
|
|
5941
|
-
path,
|
|
5942
|
-
group,
|
|
5943
|
-
ownership,
|
|
5944
|
-
drift: "stale",
|
|
5945
|
-
observed
|
|
5946
|
-
} : {
|
|
5947
|
-
path,
|
|
5948
|
-
group,
|
|
5949
|
-
ownership,
|
|
5950
|
-
drift: "aligned",
|
|
5951
|
-
observed
|
|
5952
|
-
};
|
|
5953
|
-
}
|
|
5954
|
-
/**
|
|
5955
|
-
* Compare a plan against a target's current content.
|
|
6093
|
+
* Compares a plan against a target's current content.
|
|
5956
6094
|
*
|
|
5957
6095
|
* @param plan - The compiled plan.
|
|
5958
6096
|
* @param current - The target's exact bytes, keyed by artifact-relative path.
|
|
@@ -5998,7 +6136,7 @@ function planToFindings(plan, current) {
|
|
|
5998
6136
|
return findings;
|
|
5999
6137
|
}
|
|
6000
6138
|
/**
|
|
6001
|
-
*
|
|
6139
|
+
* Measures one declared package list against the name and range syntax it accepts.
|
|
6002
6140
|
*
|
|
6003
6141
|
* @param dependencies - The declared list.
|
|
6004
6142
|
* @param field - The blueprint field the list came from, reported on each question.
|
|
@@ -6055,7 +6193,7 @@ function dependenciesToQuestions(dependencies, field, name, range) {
|
|
|
6055
6193
|
return questions;
|
|
6056
6194
|
}
|
|
6057
6195
|
/**
|
|
6058
|
-
*
|
|
6196
|
+
* Measures a blueprint against every law its own fields decide.
|
|
6059
6197
|
*
|
|
6060
6198
|
* @param blueprint - The workspace specification.
|
|
6061
6199
|
* @returns One question per rejected field, in blueprint field order, with the
|
|
@@ -6195,7 +6333,7 @@ function blueprintToQuestions(blueprint) {
|
|
|
6195
6333
|
return questions;
|
|
6196
6334
|
}
|
|
6197
6335
|
/**
|
|
6198
|
-
*
|
|
6336
|
+
* Measures a drafted artifact list against the laws a whole plan decides.
|
|
6199
6337
|
*
|
|
6200
6338
|
* @param artifacts - The drafted artifacts.
|
|
6201
6339
|
* @returns One blocking question per colliding path and per exceeded ceiling.
|
|
@@ -6252,7 +6390,7 @@ function artifactsToQuestions(artifacts) {
|
|
|
6252
6390
|
return questions;
|
|
6253
6391
|
}
|
|
6254
6392
|
/**
|
|
6255
|
-
*
|
|
6393
|
+
* Measures a blueprint's overrides against the artifacts drafted for it.
|
|
6256
6394
|
*
|
|
6257
6395
|
* @param overrides - The blueprint's overrides.
|
|
6258
6396
|
* @param artifacts - The drafted artifacts, before overrides are applied.
|
|
@@ -6316,7 +6454,7 @@ function overridesToQuestions(overrides, artifacts) {
|
|
|
6316
6454
|
//#endregion
|
|
6317
6455
|
//#region src/core/factories.ts
|
|
6318
6456
|
/**
|
|
6319
|
-
*
|
|
6457
|
+
* Constructs a {@link Blueprint} from a name and the fields that differ from the defaults.
|
|
6320
6458
|
*
|
|
6321
6459
|
* @param name - The bare workspace name.
|
|
6322
6460
|
* @param input - The fields to set; every omitted field takes its default.
|
|
@@ -6381,7 +6519,7 @@ function createBlueprint(name, input) {
|
|
|
6381
6519
|
//#endregion
|
|
6382
6520
|
//#region src/core/Compiler.ts
|
|
6383
6521
|
/**
|
|
6384
|
-
*
|
|
6522
|
+
* Represents the compile spine: draft, gate, pin, run in that order over a blueprint.
|
|
6385
6523
|
*
|
|
6386
6524
|
* @remarks
|
|
6387
6525
|
* The draft stage assembles the artifacts the selected groups cover. The gate
|
|
@@ -6425,7 +6563,7 @@ var Compiler = class {
|
|
|
6425
6563
|
#emitter;
|
|
6426
6564
|
#destroyed = false;
|
|
6427
6565
|
/**
|
|
6428
|
-
*
|
|
6566
|
+
* Constructs a compiler.
|
|
6429
6567
|
*
|
|
6430
6568
|
* @param options - The initial listeners and the listener-error handler.
|
|
6431
6569
|
* @throws {@link ScaffoldError} coded `INVALID` when `options` is present but
|
|
@@ -6445,12 +6583,12 @@ var Compiler = class {
|
|
|
6445
6583
|
...accepted?.error === void 0 ? {} : { error: accepted.error }
|
|
6446
6584
|
});
|
|
6447
6585
|
}
|
|
6448
|
-
/**
|
|
6586
|
+
/** Exposes the compiler's observation channel. */
|
|
6449
6587
|
get emitter() {
|
|
6450
6588
|
return this.#emitter;
|
|
6451
6589
|
}
|
|
6452
6590
|
/**
|
|
6453
|
-
*
|
|
6591
|
+
* Compiles a blueprint into a plan through the draft, gate, and pin stages.
|
|
6454
6592
|
*
|
|
6455
6593
|
* @param blueprint - The workspace specification to compile.
|
|
6456
6594
|
* @param groups - The artifact groups to cover; every group when absent.
|
|
@@ -6489,7 +6627,7 @@ var Compiler = class {
|
|
|
6489
6627
|
return scaffolding;
|
|
6490
6628
|
}
|
|
6491
6629
|
/**
|
|
6492
|
-
*
|
|
6630
|
+
* Compiles a blueprint and compares its plan to a target's current content.
|
|
6493
6631
|
*
|
|
6494
6632
|
* @param blueprint - The workspace specification to compile.
|
|
6495
6633
|
* @param current - The target's exact bytes, keyed by artifact-relative path.
|
|
@@ -6532,7 +6670,7 @@ var Compiler = class {
|
|
|
6532
6670
|
return result;
|
|
6533
6671
|
}
|
|
6534
6672
|
/**
|
|
6535
|
-
*
|
|
6673
|
+
* Tears the compiler down. Every later call throws, and teardown is idempotent.
|
|
6536
6674
|
*
|
|
6537
6675
|
* @returns Nothing.
|
|
6538
6676
|
*
|
|
@@ -6680,6 +6818,6 @@ var Compiler = class {
|
|
|
6680
6818
|
}
|
|
6681
6819
|
};
|
|
6682
6820
|
//#endregion
|
|
6683
|
-
export { APP_BROWSER_DEV_DEPENDENCIES, APP_DEV_DEPENDENCIES, APP_MATRIX, APP_SERVER_DEV_DEPENDENCIES, ARTIFACT_TEMPLATES, BASE_DEV_DEPENDENCIES, BIN_CONFIGS, BIN_ENTRY_PATH, CANON_PATHS, CATALOG_AGENT_PATH, CONFIG_TEMPLATES, CONFORMANCE_TEST_PATH, CONTROL_CHARACTER_PATTERN, Compiler, DECLARATION_DEV_DEPENDENCIES, DEFAULT_ENGINES, DEFAULT_VERSION, DEPENDENCY_NAME_PATTERN, DISTRIBUTION_TEST_PATH, ENGINES_PATTERN, ENVIRONMENTS, EXECUTABLE_PATHS, EXTRA_RANGE_PATTERN, FLOOR_RANGE_PATTERN, FOREIGN_NAME_PATTERN, GLOBAL_SETUP_PATH, GROUPS, GUIDES_TEST_PATH, HEX_PATTERN, HOST_INVENTORY_PATH, HOST_PATHS, INTEGRATION_TEST_PATH, INVALID_PATH_CHARACTER_PATTERN, MANIFEST_PATH, MAX_ARTIFACT_BYTES, MAX_ARTIFACT_HEX_LENGTH, MAX_AUDIT_FINDINGS, MAX_COLLECTION_ITEMS, MAX_DEPENDENCY_NAME_LENGTH, MAX_MANIFEST_BYTES, MAX_NAME_LENGTH, MAX_PATH_LENGTH, MAX_RANGE_LENGTH, MAX_REGISTRY_BYTES, MAX_SCRIPT_LENGTH, MAX_TOTAL_ARTIFACT_BYTES, MAX_TOTAL_REGISTRY_BYTES, MINIMUM_NODE_VERSION, NAME_PATTERN, ORCHESTRATION_PATH_NAMES, ORCHESTRATION_PATH_PREFIXES, ORKESTREL_RANGE_PATTERN, PRINT_WIDTH, RELEASE_PROOF_COMMAND, SERVICE_SCRIPT_PATH, SERVICE_SETUP_PATH, SERVICE_TEST_INCLUDE, SHOWCASE_CONFIG_PATH, SHOWCASE_DEV_DEPENDENCIES, SOURCE_BROWSER_DEV_DEPENDENCIES, SRC_MATRIX, ScaffoldError, TAB_WIDTH, VERSION_PATTERN, WORKSPACE_OWNED_PATHS, applyOverrides, artifactToFinding, artifactToHex, artifactsToQuestions, blueprintToConfigArtifacts, blueprintToDevDependencies, blueprintToDocumentArtifacts, blueprintToGuideArtifacts, blueprintToMachinery, blueprintToManifest, blueprintToOrchestrationArtifacts, blueprintToQuestions, blueprintToRootTsconfig, blueprintToRootVite, blueprintToScripts, blueprintToSourceArtifacts, blueprintToTestArtifacts, blueprintToWritableScripts, bytesToHex, catalogToLayers, cloneValue, compareVersions, computeBytes, computeHash, contentToHex, createBlueprint, dependenciesToQuestions, extractRangeMajor, extractVersion, inferDrift, inferGroup, isArtifact, isAudit, isBlueprint, isCanonPath, isCatalogEntry, isCollection, isCompilerHooks, isCompilerOptions, isContent, isDeferredPath, isDependency, isDependencyName, isEnvironment, isFinding, isGroup, isGroups, isHex, isManifestScript, isMirror, isOverride, isPath, isPlan, isQuestion, isScaffoldError, isSnapshot, manifestToDependencies, manifestToName, matchesDriftReachability, matchesEngines, matchesOrchestrationPath, matchesPrintWidth, matchesRange, nameToGuide, nameToHostArtifacts, nameToRewrite, overridesToQuestions, parseBlueprint, parseCompilerOptions, parseGroups, parseSnapshot, pathToCondition, planToFindings, planToHash, planToSummary, replaceManifestRanges, replaceManifestScripts, replacePlanRanges, selectGroups, selectHostPaths, serializeTypeScriptString, srcToEntry, srcToExports, srcToRoot };
|
|
6821
|
+
export { APP_BROWSER_DEV_DEPENDENCIES, APP_DEV_DEPENDENCIES, APP_MATRIX, APP_SERVER_DEV_DEPENDENCIES, ARTIFACT_TEMPLATES, BASE_DEV_DEPENDENCIES, BIN_CONFIGS, BIN_ENTRY_PATH, CANON_PATHS, CATALOG_AGENT_PATH, CATALOG_CLOSING_MARKER, CATALOG_OPENING_MARKER, CONFIG_TEMPLATES, CONFORMANCE_TEST_PATH, CONTROL_CHARACTER_PATTERN, Compiler, DECLARATION_DEV_DEPENDENCIES, DEFAULT_ENGINES, DEFAULT_VERSION, DEPENDENCY_NAME_PATTERN, DISTRIBUTION_TEST_PATH, ENGINES_PATTERN, ENVIRONMENTS, EXECUTABLE_PATHS, EXTRA_RANGE_PATTERN, FLOOR_RANGE_PATTERN, FOREIGN_NAME_PATTERN, GLOBAL_SETUP_PATH, GROUPS, GUIDES_TEST_PATH, HEX_PATTERN, HOST_INVENTORY_PATH, HOST_PATHS, INTEGRATION_TEST_PATH, INVALID_PATH_CHARACTER_PATTERN, MANIFEST_PATH, MAX_ARTIFACT_BYTES, MAX_ARTIFACT_HEX_LENGTH, MAX_AUDIT_FINDINGS, MAX_COLLECTION_ITEMS, MAX_DEPENDENCY_NAME_LENGTH, MAX_MANIFEST_BYTES, MAX_NAME_LENGTH, MAX_PATH_LENGTH, MAX_RANGE_LENGTH, MAX_REGISTRY_BYTES, MAX_SCRIPT_LENGTH, MAX_TOTAL_ARTIFACT_BYTES, MAX_TOTAL_REGISTRY_BYTES, MINIMUM_NODE_VERSION, NAME_PATTERN, ORCHESTRATION_PATH_NAMES, ORCHESTRATION_PATH_PREFIXES, ORKESTREL_RANGE_PATTERN, PRINT_WIDTH, RELEASE_PROOF_COMMAND, SERVICE_SCRIPT_PATH, SERVICE_SETUP_PATH, SERVICE_TEST_INCLUDE, SHOWCASE_CONFIG_PATH, SHOWCASE_DEV_DEPENDENCIES, SOURCE_BROWSER_DEV_DEPENDENCIES, SRC_MATRIX, ScaffoldError, TAB_WIDTH, VERSION_PATTERN, WORKSPACE_OWNED_PATHS, applyOverrides, artifactToFinding, artifactToHex, artifactsToQuestions, blueprintToConfigArtifacts, blueprintToDevDependencies, blueprintToDocumentArtifacts, blueprintToGuideArtifacts, blueprintToMachinery, blueprintToManifest, blueprintToOrchestrationArtifacts, blueprintToQuestions, blueprintToRootTsconfig, blueprintToRootVite, blueprintToScripts, blueprintToSourceArtifacts, blueprintToTestArtifacts, blueprintToWritableScripts, bytesToHex, catalogToLayers, cloneValue, compareVersions, computeBytes, computeHash, contentToHex, createBlueprint, dependenciesToQuestions, extractRangeMajor, extractVersion, inferDrift, inferGroup, isArtifact, isAudit, isBlueprint, isCanonPath, isCatalogEntry, isCollection, isCompilerHooks, isCompilerOptions, isContent, isDeferredPath, isDependency, isDependencyName, isEnvironment, isFinding, isFloorPath, isGroup, isGroups, isHex, isManifestScript, isMirror, isOverride, isPath, isPlan, isQuestion, isRetainedPath, isScaffoldError, isSnapshot, manifestToDependencies, manifestToName, matchesDriftReachability, matchesEngines, matchesOrchestrationPath, matchesPrintWidth, matchesRange, nameToGuide, nameToHostArtifacts, nameToRewrite, overridesToQuestions, parseBlueprint, parseCompilerOptions, parseGroups, parseSnapshot, pathToCondition, planToFindings, planToHash, planToSummary, replaceManifestRanges, replaceManifestScripts, replacePlanRanges, selectGroups, selectHostPaths, serializeTypeScriptString, srcToEntry, srcToExports, srcToRoot };
|
|
6684
6822
|
|
|
6685
6823
|
//# sourceMappingURL=index.js.map
|