@orkestrel/scaffold 0.0.99 → 0.0.100
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/dist/bin/main.js +74 -19
- package/dist/bin/main.js.map +1 -1
- package/dist/host/guides/scaffold.md +26 -4
- package/dist/host/manifest.json +2 -2
- package/dist/src/core/index.cjs +103 -4
- package/dist/src/core/index.cjs.map +1 -1
- package/dist/src/core/index.d.cts +40 -1
- package/dist/src/core/index.d.ts +40 -1
- package/dist/src/core/index.js +101 -5
- package/dist/src/core/index.js.map +1 -1
- package/dist/src/server/index.cjs +9 -3
- package/dist/src/server/index.cjs.map +1 -1
- package/dist/src/server/index.d.cts +7 -1
- package/dist/src/server/index.d.ts +7 -1
- package/dist/src/server/index.js +11 -5
- package/dist/src/server/index.js.map +1 -1
- package/package.json +1 -1
package/dist/bin/main.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { align, renderTable, strip, stripControls, width } from "@orkestrel/console";
|
|
3
3
|
import { attempt, isArray, isError, isInstance, isRecord, isString, parseJSON } from "@orkestrel/contract";
|
|
4
|
-
import { AXES, BIN_ENTRY_PATH, CATALOG_AGENT_PATH, CONFORMANCE_TEST_PATH, Compiler, DEPENDENCY_NAME_PATTERN, ENVIRONMENTS, FRAMEWORKS, GLOBAL_SETUP_PATH, GROUPS, GUIDES_TEST_PATH, HOST_PATHS, INTEGRATION_TEST_PATH, JOURNEY_CONFIG_PATH, MAX_MANIFEST_BYTES, MAX_PATH_LENGTH, RESERVED_SHEET_NAMES, SERVICE_SETUP_PATH, SHEET_ENTRY_NAME, SHOWCASE_CONFIG_PATH, SHOWCASE_PAGES_PATH, SKILLS_CONFIG_PATH, STYLES_ENTRY_PATH, ScaffoldError, THEMES_BARREL_PATH, THEMES_ENTRY_PATH, blueprintToConfigArtifacts, blueprintToDevDependencies, blueprintToFaces, blueprintToProjects, blueprintToScripts, blueprintToSheets, blueprintToTestArtifacts, blueprintToWritableScripts, compareVersions, createBlueprint, extractRangeMajor, extractVersion, isFloorPath, isScaffoldError, isSheetName, manifestToDependencies, manifestToName, nameToGuide, parseExtension, replaceManifestScripts, replacePlanRanges } from "../src/core/index.js";
|
|
4
|
+
import { AXES, BIN_ENTRY_PATH, CATALOG_AGENT_PATH, CONFORMANCE_TEST_PATH, Compiler, DEPENDENCY_NAME_PATTERN, ENVIRONMENTS, FRAMEWORKS, GLOBAL_SETUP_PATH, GROUPS, GUIDES_TEST_PATH, HOST_PATHS, INTEGRATION_TEST_PATH, JOURNEY_CONFIG_PATH, MAX_MANIFEST_BYTES, MAX_PATH_LENGTH, RESERVED_SHEET_NAMES, SERVICE_SETUP_PATH, SHEET_ENTRY_NAME, SHOWCASE_CONFIG_PATH, SHOWCASE_DEV_DEPENDENCIES, SHOWCASE_PAGES_PATH, SKILLS_CONFIG_PATH, STYLES_ENTRY_PATH, ScaffoldError, THEMES_BARREL_PATH, THEMES_ENTRY_PATH, blueprintToConfigArtifacts, blueprintToDevDependencies, blueprintToFaces, blueprintToManifestOverrides, blueprintToProjects, blueprintToScripts, blueprintToSheets, blueprintToTestArtifacts, blueprintToWritableScripts, compareVersions, createBlueprint, extractRangeMajor, extractVersion, isFloorPath, isScaffoldError, isSheetName, manifestToDependencies, manifestToName, nameToGuide, parseExtension, replaceManifestOverrides, replaceManifestScripts, replacePlanRanges } from "../src/core/index.js";
|
|
5
5
|
import { MAX_INVENTORY_PATHS, Materializer, Upstream, filesToHost, isExactCaseFile, isPhysicalDirectory, isWorktree, listFiles, readFileText, readHostFloor, readHostManifest, readSnapshot, resolveContainedPath } from "../src/server/index.js";
|
|
6
6
|
import { createMarkdown, flattenText, isTableNode } from "@orkestrel/markdown";
|
|
7
7
|
import { createSession } from "@orkestrel/process/server";
|
|
@@ -10,7 +10,7 @@ import { normalize } from "node:path";
|
|
|
10
10
|
import { parseArgs } from "node:util";
|
|
11
11
|
var package_default = {
|
|
12
12
|
name: "@orkestrel/scaffold",
|
|
13
|
-
version: "0.0.
|
|
13
|
+
version: "0.0.100",
|
|
14
14
|
description: "Scaffold workspaces with commands: new, audit, repair, catalog, and overwrite.",
|
|
15
15
|
keywords: [
|
|
16
16
|
"audit",
|
|
@@ -637,6 +637,9 @@ function auditToExit(audit) {
|
|
|
637
637
|
* @param manifest - The target manifest text.
|
|
638
638
|
* @param blueprint - The workspace shape that supplies the planned tool set.
|
|
639
639
|
* @returns The declared fleet rows and planned foreign tools in their writable sections.
|
|
640
|
+
* @remarks
|
|
641
|
+
* Selected showcase tools retain every string declaration in both sections.
|
|
642
|
+
* Other foreign tools retain runtime precedence when declared in both sections.
|
|
640
643
|
*/
|
|
641
644
|
function manifestToWritableDependencies(manifest, blueprint) {
|
|
642
645
|
const declared = manifestToDependencies(manifest);
|
|
@@ -657,7 +660,7 @@ function manifestToWritableDependencies(manifest, blueprint) {
|
|
|
657
660
|
name,
|
|
658
661
|
range: runtimeRange
|
|
659
662
|
});
|
|
660
|
-
continue;
|
|
663
|
+
if (!(blueprint.showcase && blueprint.app.includes("browser") && Object.hasOwn(SHOWCASE_DEV_DEPENDENCIES, name))) continue;
|
|
661
664
|
}
|
|
662
665
|
const developmentRange = developmentRecord[name];
|
|
663
666
|
if (isString(developmentRange)) development.push({
|
|
@@ -1816,7 +1819,7 @@ var CLI = class {
|
|
|
1816
1819
|
const blueprint = this.#derive(target);
|
|
1817
1820
|
const groups = selectionToGroups(command.groups);
|
|
1818
1821
|
const declared = manifestToWritableDependencies(manifest, blueprint);
|
|
1819
|
-
const versions = await this.#versions(declared, command.offline === true);
|
|
1822
|
+
const versions = await this.#versions(declared, command.offline === true, blueprint);
|
|
1820
1823
|
const questions = [...this.#targetQuestions(target, blueprint, groups), ...releasesToQuestions(versions.releases)];
|
|
1821
1824
|
const host = await this.#host(command.from, target, command.offline === true);
|
|
1822
1825
|
try {
|
|
@@ -1861,11 +1864,12 @@ var CLI = class {
|
|
|
1861
1864
|
else this.#present(audit);
|
|
1862
1865
|
return 1;
|
|
1863
1866
|
}
|
|
1864
|
-
const versions = await this.#versions(manifestToWritableDependencies(this.#manifest(target), blueprint), command.offline === true);
|
|
1867
|
+
const versions = await this.#versions(manifestToWritableDependencies(this.#manifest(target), blueprint), command.offline === true, blueprint);
|
|
1865
1868
|
const refusal = versionsToRefusal(versions);
|
|
1866
1869
|
if (refusal !== void 0) throw refusal;
|
|
1867
1870
|
const result = mergeResults(host.materializer.repair(plan, audit, target), host.materializer.declare({
|
|
1868
1871
|
pins: versions.pins,
|
|
1872
|
+
overrides: blueprintToManifestOverrides(blueprint),
|
|
1869
1873
|
scripts: manifestToWritableScripts(this.#manifest(target), blueprint)
|
|
1870
1874
|
}, target));
|
|
1871
1875
|
const terminalBlueprint = this.#derive(target);
|
|
@@ -1967,25 +1971,34 @@ var CLI = class {
|
|
|
1967
1971
|
return 1;
|
|
1968
1972
|
}
|
|
1969
1973
|
const declared = {
|
|
1974
|
+
overrides: blueprintToManifestOverrides(blueprint),
|
|
1970
1975
|
pins: manifestToWritableDependencies(this.#manifest(target), blueprint),
|
|
1971
1976
|
scripts: manifestToWritableScripts(this.#manifest(target), blueprint)
|
|
1972
1977
|
};
|
|
1973
1978
|
const additions = manifestToAdditions(this.#manifest(target), blueprint);
|
|
1974
1979
|
const repaired = host.materializer.repair(plan, audit, target);
|
|
1975
|
-
const
|
|
1980
|
+
const policy = blueprint.showcase && blueprint.app.includes("browser") ? SHOWCASE_DEV_DEPENDENCIES : {};
|
|
1981
|
+
const added = additions.runtime.length === 0 && additions.development.length === 0 && Object.keys(policy).length === 0 ? void 0 : host.materializer.declare({
|
|
1976
1982
|
pins: {
|
|
1977
|
-
runtime:
|
|
1978
|
-
|
|
1983
|
+
runtime: declared.pins.runtime.filter(({ name }) => Object.hasOwn(policy, name)).map(({ name, range }) => ({
|
|
1984
|
+
name,
|
|
1985
|
+
range: policy[name] ?? range
|
|
1986
|
+
})),
|
|
1987
|
+
development: declared.pins.development.filter(({ name }) => Object.hasOwn(policy, name)).map(({ name, range }) => ({
|
|
1988
|
+
name,
|
|
1989
|
+
range: policy[name] ?? range
|
|
1990
|
+
}))
|
|
1979
1991
|
},
|
|
1980
1992
|
scripts: [],
|
|
1981
|
-
additions
|
|
1993
|
+
additions,
|
|
1994
|
+
overrides: blueprintToManifestOverrides(blueprint)
|
|
1982
1995
|
}, target);
|
|
1983
1996
|
const removed = host.materializer.remove(plan, audit, command.dirty === true ? {
|
|
1984
1997
|
tracked: worktree.tracked,
|
|
1985
1998
|
dirty: []
|
|
1986
1999
|
} : worktree, target);
|
|
1987
2000
|
const local = mergeResults(added === void 0 ? repaired : mergeResults(repaired, added), removed);
|
|
1988
|
-
const remainder = command.offline === true ? await this.#declare(host.materializer, target, declared, host.baseline) : await this.#reconcile(host.materializer, target, declared, host.baseline, host.forced);
|
|
2001
|
+
const remainder = command.offline === true ? await this.#declare(host.materializer, target, declared, host.baseline, blueprint) : await this.#reconcile(host.materializer, target, declared, host.baseline, host.forced, blueprint);
|
|
1989
2002
|
const [measured] = this.#survey(host.materializer, blueprint, target, groups);
|
|
1990
2003
|
const terminal = this.#appendQuestions(measured, target, blueprint, groups);
|
|
1991
2004
|
const outcome = {
|
|
@@ -2014,14 +2027,14 @@ var CLI = class {
|
|
|
2014
2027
|
host.materializer.destroy();
|
|
2015
2028
|
}
|
|
2016
2029
|
}
|
|
2017
|
-
async #declare(materializer, target, declared, host) {
|
|
2018
|
-
const versions = await this.#versions(declared.pins, true);
|
|
2030
|
+
async #declare(materializer, target, declared, host, blueprint) {
|
|
2031
|
+
const versions = await this.#versions(declared.pins, true, blueprint);
|
|
2019
2032
|
const refusal = versionsToRefusal(versions);
|
|
2020
2033
|
if (refusal !== void 0) throw refusal;
|
|
2021
2034
|
return {
|
|
2022
2035
|
...materializer.declare({
|
|
2023
|
-
|
|
2024
|
-
|
|
2036
|
+
...declared,
|
|
2037
|
+
pins: versions.pins
|
|
2025
2038
|
}, target),
|
|
2026
2039
|
mirrors: [],
|
|
2027
2040
|
releases: versions.releases,
|
|
@@ -2032,12 +2045,12 @@ var CLI = class {
|
|
|
2032
2045
|
note: "The catalog step did not complete: USAGE: 'catalog' does not take --offline."
|
|
2033
2046
|
};
|
|
2034
2047
|
}
|
|
2035
|
-
async #reconcile(materializer, target, declared, host, hostForced) {
|
|
2048
|
+
async #reconcile(materializer, target, declared, host, hostForced, blueprint) {
|
|
2036
2049
|
const previous = catalogToNames(target);
|
|
2037
2050
|
let releases = [];
|
|
2038
2051
|
let provenance = { ...host === void 0 ? {} : { host } };
|
|
2039
2052
|
try {
|
|
2040
|
-
const versions = await this.#versions(declared.pins, false);
|
|
2053
|
+
const versions = await this.#versions(declared.pins, false, blueprint);
|
|
2041
2054
|
releases = versions.releases;
|
|
2042
2055
|
provenance = {
|
|
2043
2056
|
...versions.baseline === void 0 ? {} : { versions: versions.baseline },
|
|
@@ -2057,8 +2070,8 @@ var CLI = class {
|
|
|
2057
2070
|
...host === void 0 ? {} : { host }
|
|
2058
2071
|
};
|
|
2059
2072
|
const written = mergeResults(this.#publish(materializer, target, fetched.entries, fetched.mirrors), materializer.declare({
|
|
2060
|
-
|
|
2061
|
-
|
|
2073
|
+
...declared,
|
|
2074
|
+
pins: versions.pins
|
|
2062
2075
|
}, target));
|
|
2063
2076
|
const floors = [];
|
|
2064
2077
|
if (hostForced) floors.push("host");
|
|
@@ -2115,7 +2128,26 @@ var CLI = class {
|
|
|
2115
2128
|
upstream.destroy();
|
|
2116
2129
|
}
|
|
2117
2130
|
}
|
|
2118
|
-
async #versions(declared, offline) {
|
|
2131
|
+
async #versions(declared, offline, blueprint) {
|
|
2132
|
+
if (blueprint?.showcase === true && blueprint.app.includes("browser")) {
|
|
2133
|
+
const ordinary = await this.#versions({
|
|
2134
|
+
runtime: declared.runtime.filter(({ name }) => !Object.hasOwn(SHOWCASE_DEV_DEPENDENCIES, name)),
|
|
2135
|
+
development: declared.development.filter(({ name }) => !Object.hasOwn(SHOWCASE_DEV_DEPENDENCIES, name))
|
|
2136
|
+
}, offline);
|
|
2137
|
+
return {
|
|
2138
|
+
...ordinary,
|
|
2139
|
+
pins: {
|
|
2140
|
+
runtime: [...ordinary.pins.runtime, ...declared.runtime.filter(({ name }) => Object.hasOwn(SHOWCASE_DEV_DEPENDENCIES, name)).map(({ name, range }) => ({
|
|
2141
|
+
name,
|
|
2142
|
+
range: SHOWCASE_DEV_DEPENDENCIES[name] ?? range
|
|
2143
|
+
}))],
|
|
2144
|
+
development: [...ordinary.pins.development, ...declared.development.filter(({ name }) => Object.hasOwn(SHOWCASE_DEV_DEPENDENCIES, name)).map(({ name, range }) => ({
|
|
2145
|
+
name,
|
|
2146
|
+
range: SHOWCASE_DEV_DEPENDENCIES[name] ?? range
|
|
2147
|
+
}))]
|
|
2148
|
+
}
|
|
2149
|
+
};
|
|
2150
|
+
}
|
|
2119
2151
|
const dependencies = [...declared.runtime, ...declared.development];
|
|
2120
2152
|
if (dependencies.length === 0) return {
|
|
2121
2153
|
releases: [],
|
|
@@ -2542,6 +2574,29 @@ var CLI = class {
|
|
|
2542
2574
|
}
|
|
2543
2575
|
#targetQuestions(target, blueprint, groups, writing = false, declaring = false) {
|
|
2544
2576
|
const questions = [];
|
|
2577
|
+
if (blueprint.showcase && blueprint.app.includes("browser")) {
|
|
2578
|
+
const manifest = this.#manifest(target);
|
|
2579
|
+
const parsed = parseJSON(manifest);
|
|
2580
|
+
const malformed = isRecord(parsed) ? ["dependencies", "devDependencies"].flatMap((section) => {
|
|
2581
|
+
const entries = parsed[section];
|
|
2582
|
+
return isRecord(entries) ? Object.keys(SHOWCASE_DEV_DEPENDENCIES).filter((name) => Object.hasOwn(entries, name) && !isString(entries[name])).map((name) => `${section}.${name}`) : [];
|
|
2583
|
+
}) : [];
|
|
2584
|
+
if (malformed.length > 0) questions.push({
|
|
2585
|
+
field: "dependencies",
|
|
2586
|
+
message: `The showcase declarations ${malformed.join(", ")} must hold version strings. Correct package.json before writing configuration or dependencies.`,
|
|
2587
|
+
blocking: true,
|
|
2588
|
+
groups: ["manifest"]
|
|
2589
|
+
});
|
|
2590
|
+
const aligned = replaceManifestOverrides(manifest, blueprintToManifestOverrides(blueprint));
|
|
2591
|
+
const pins = manifestToWritableDependencies(manifest, blueprint);
|
|
2592
|
+
const stale = [...pins.runtime, ...pins.development].filter(({ name, range }) => Object.hasOwn(SHOWCASE_DEV_DEPENDENCIES, name) && SHOWCASE_DEV_DEPENDENCIES[name] !== range);
|
|
2593
|
+
if (aligned === void 0 || !writing && (aligned !== manifest || stale.length > 0)) questions.push({
|
|
2594
|
+
field: "dependencies",
|
|
2595
|
+
message: aligned === void 0 ? "The showcase npm override path is malformed or duplicated. Correct package.json before writing configuration or dependencies." : `The showcase dependency contract has drifted. Run repair to apply ${JSON.stringify(SHOWCASE_DEV_DEPENDENCIES)} and ${JSON.stringify(blueprintToManifestOverrides(blueprint))}.`,
|
|
2596
|
+
blocking: true,
|
|
2597
|
+
groups: ["manifest"]
|
|
2598
|
+
});
|
|
2599
|
+
}
|
|
2545
2600
|
const browser = resolveContainedPath(target, "app/browser");
|
|
2546
2601
|
if (browser !== void 0 && listFiles(browser).some((path) => path.endsWith(".vue"))) questions.push({
|
|
2547
2602
|
field: "extensions",
|