@orkestrel/scaffold 0.0.129 → 0.0.131
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 +39 -36
- package/dist/bin/main.js.map +1 -1
- package/dist/host/agents/orchestration.md +1 -0
- package/dist/host/agents/platforms/windows.md +1 -0
- package/dist/host/agents/skills/orkestrel-parallel/references/t3.md +1 -0
- package/dist/host/agents/skills/orkestrel-polish/SKILL.md +1 -0
- package/dist/host/claude/agents/orkestrel.md +7 -7
- package/dist/host/claude/rules/patterns.md +2 -0
- package/dist/host/guides/agent.md +228 -152
- package/dist/host/guides/capture.md +5 -5
- package/dist/host/guides/middleware.md +82 -64
- package/dist/host/guides/scaffold.md +13 -6
- package/dist/host/manifest.json +11 -11
- package/dist/src/core/index.cjs +69 -18
- package/dist/src/core/index.cjs.map +1 -1
- package/dist/src/core/index.d.cts +5 -2
- package/dist/src/core/index.d.ts +5 -2
- package/dist/src/core/index.js +69 -18
- package/dist/src/core/index.js.map +1 -1
- package/package.json +1 -1
package/dist/src/core/index.cjs
CHANGED
|
@@ -4,7 +4,7 @@ let _orkestrel_template = require("@orkestrel/template");
|
|
|
4
4
|
let _orkestrel_emitter = require("@orkestrel/emitter");
|
|
5
5
|
var package_default = {
|
|
6
6
|
name: "@orkestrel/scaffold",
|
|
7
|
-
version: "0.0.
|
|
7
|
+
version: "0.0.131",
|
|
8
8
|
description: "Scaffold workspaces with commands: new, audit, surface, repair, catalog, and overwrite.",
|
|
9
9
|
keywords: [
|
|
10
10
|
"audit",
|
|
@@ -1690,7 +1690,8 @@ export function service(override?: UserConfig): UserConfig {
|
|
|
1690
1690
|
return mergeOverride(project, override)
|
|
1691
1691
|
}
|
|
1692
1692
|
`,
|
|
1693
|
-
studies: `// Run these @orkestrel/study proofs on demand with npm run test:studies;
|
|
1693
|
+
studies: `// Run these @orkestrel/study proofs on demand with npm run test:studies;
|
|
1694
|
+
// no gate or chain runs them.
|
|
1694
1695
|
export function studies(override?: UserConfig): UserConfig {
|
|
1695
1696
|
const project: UserConfig = {
|
|
1696
1697
|
resolve,
|
|
@@ -2755,10 +2756,15 @@ export interface DistributionClassification {
|
|
|
2755
2756
|
readonly targets: readonly string[]
|
|
2756
2757
|
}
|
|
2757
2758
|
|
|
2759
|
+
/** Holds the file, leading arguments, and shell route an npm run spawns with. */
|
|
2760
|
+
export interface DistributionNpmCommand {
|
|
2761
|
+
readonly file: string
|
|
2762
|
+
readonly prefix: readonly string[]
|
|
2763
|
+
readonly shell: boolean
|
|
2764
|
+
}
|
|
2765
|
+
|
|
2758
2766
|
/** Names the workspace whose packed artifact the proof consumes. */
|
|
2759
2767
|
export const DISTRIBUTION_ROOT = resolve(dirname(fileURLToPath(import.meta.url)), '..')
|
|
2760
|
-
/** Names the npm executable on the running host. */
|
|
2761
|
-
export const DISTRIBUTION_NPM = process.platform === 'win32' ? 'npm.cmd' : 'npm'
|
|
2762
2768
|
// The compiler this workspace installs, run as a command rather than called in
|
|
2763
2769
|
// process: the command and its plain-text diagnostics are the same across the
|
|
2764
2770
|
// compiler majors this toolchain supports, and its in-process API is not. It is
|
|
@@ -2771,12 +2777,6 @@ export const DISTRIBUTION_TYPESCRIPT = createRequire(
|
|
|
2771
2777
|
).resolve('typescript/package.json')
|
|
2772
2778
|
/** Names the compiler installed by the workspace under proof. */
|
|
2773
2779
|
export const DISTRIBUTION_COMPILER = join(dirname(DISTRIBUTION_TYPESCRIPT), 'bin', 'tsc')
|
|
2774
|
-
// Windows needs a shell to launch a \`.cmd\`: Node refuses one directly since the
|
|
2775
|
-
// batch-argument hardening, and \`spawnSync\` returns \`EINVAL\` with a null status
|
|
2776
|
-
// rather than an exit code a caller can read. Every following argument is a literal or
|
|
2777
|
-
// a path this file built, so the shell has nothing to escape.
|
|
2778
|
-
/** Selects the Windows command-shell route required by the npm shim. */
|
|
2779
|
-
export const DISTRIBUTION_SHELL = process.platform === 'win32'
|
|
2780
2780
|
// \`prepublishOnly\` runs this proof as \`npm run test:distribution -- --mode release\`,
|
|
2781
2781
|
// and the root configuration's project factories carry that mode into this project.
|
|
2782
2782
|
// Release is the publish gate, so evidence it cannot obtain fails there and skips
|
|
@@ -3103,6 +3103,50 @@ export function readDistributionOutput(result: SpawnSyncReturns<string>): string
|
|
|
3103
3103
|
return \`\${result.stdout ?? ''}\${result.stderr ?? ''}\`.trim()
|
|
3104
3104
|
}
|
|
3105
3105
|
|
|
3106
|
+
/**
|
|
3107
|
+
* Resolves the npm command for the running host.
|
|
3108
|
+
*
|
|
3109
|
+
* @remarks
|
|
3110
|
+
* npm's JavaScript entry beside the running Node binary spawns without a shell on every host. The
|
|
3111
|
+
* shim is the fallback where none sits there, and Windows needs a shell to launch its \`.cmd\`: Node
|
|
3112
|
+
* refuses one directly since the batch-argument hardening, and \`spawnSync\` returns \`EINVAL\` with a
|
|
3113
|
+
* null status rather than an exit code a caller can read. Every argument this file passes is a
|
|
3114
|
+
* literal or a path it built, so the shell has nothing to escape.
|
|
3115
|
+
*
|
|
3116
|
+
* @returns The file to spawn, the arguments that precede npm's own, and whether it needs a shell.
|
|
3117
|
+
*/
|
|
3118
|
+
export function resolveDistributionNpm(): DistributionNpmCommand {
|
|
3119
|
+
const cli = join(dirname(process.execPath), 'node_modules', 'npm', 'bin', 'npm-cli.js')
|
|
3120
|
+
if (existsSync(cli)) return { file: process.execPath, prefix: [cli], shell: false }
|
|
3121
|
+
const windows = process.platform === 'win32'
|
|
3122
|
+
return { file: windows ? 'npm.cmd' : 'npm', prefix: [], shell: windows }
|
|
3123
|
+
}
|
|
3124
|
+
|
|
3125
|
+
/**
|
|
3126
|
+
* Merges added variables over an inherited environment by case-folded name.
|
|
3127
|
+
*
|
|
3128
|
+
* @remarks
|
|
3129
|
+
* A Windows environment block folds names by case, and npm reads its \`npm_config_\` variables
|
|
3130
|
+
* case-insensitively on every host, so every inherited name an added name claims is dropped first:
|
|
3131
|
+
* an inherited \`NPM_CONFIG_CACHE\` would otherwise outrank an added \`npm_config_cache\`.
|
|
3132
|
+
*
|
|
3133
|
+
* @param inherited - The environment the child would inherit.
|
|
3134
|
+
* @param added - The variables the call sets.
|
|
3135
|
+
* @returns The merged environment.
|
|
3136
|
+
*/
|
|
3137
|
+
export function mergeDistributionEnvironment(
|
|
3138
|
+
inherited: Readonly<Record<string, string | undefined>>,
|
|
3139
|
+
added: Readonly<Record<string, string>>,
|
|
3140
|
+
): Readonly<Record<string, string | undefined>> {
|
|
3141
|
+
const claimed = new Set(Object.keys(added).map((name) => name.toLowerCase()))
|
|
3142
|
+
return {
|
|
3143
|
+
...Object.fromEntries(
|
|
3144
|
+
Object.entries(inherited).filter(([name]) => !claimed.has(name.toLowerCase())),
|
|
3145
|
+
),
|
|
3146
|
+
...added,
|
|
3147
|
+
}
|
|
3148
|
+
}
|
|
3149
|
+
|
|
3106
3150
|
/**
|
|
3107
3151
|
* Runs npm with a cache inside the owned scratch directory.
|
|
3108
3152
|
*
|
|
@@ -3116,11 +3160,12 @@ export function runDistributionNpm(
|
|
|
3116
3160
|
cwd: string,
|
|
3117
3161
|
scratch: string,
|
|
3118
3162
|
): SpawnSyncReturns<string> {
|
|
3119
|
-
|
|
3163
|
+
const npm = resolveDistributionNpm()
|
|
3164
|
+
return spawnSync(npm.file, [...npm.prefix, ...args], {
|
|
3120
3165
|
cwd,
|
|
3121
3166
|
encoding: 'utf8',
|
|
3122
|
-
env:
|
|
3123
|
-
shell:
|
|
3167
|
+
env: mergeDistributionEnvironment(process.env, { npm_config_cache: join(scratch, 'cache') }),
|
|
3168
|
+
shell: npm.shell,
|
|
3124
3169
|
windowsHide: true,
|
|
3125
3170
|
})
|
|
3126
3171
|
}
|
|
@@ -7425,7 +7470,7 @@ function blueprintToScripts(blueprint) {
|
|
|
7425
7470
|
...blueprint.showcase ? Object.fromEntries(application.flatMap((name) => [[`showcase:${name}`, `${showcase} --mode ${name}`], [`build:showcase:${name}`, `${buildShowcase} --mode ${name}`]])) : {},
|
|
7426
7471
|
...blueprint.app.includes("server") ? {
|
|
7427
7472
|
serve: "node dist/app/server/main.cjs",
|
|
7428
|
-
"serve:build": "npm run build
|
|
7473
|
+
"serve:build": "npm run build && npm run serve"
|
|
7429
7474
|
} : {},
|
|
7430
7475
|
...publishes ? {
|
|
7431
7476
|
prepack: "npm run build",
|
|
@@ -7455,6 +7500,9 @@ function blueprintToScripts(blueprint) {
|
|
|
7455
7500
|
* A base browser application's journey axis also adds `journey` and `capture`, and each
|
|
7456
7501
|
* app-side browser face adds `journey:<name>` and `capture:<name>`. Their generated
|
|
7457
7502
|
* commands are writable and have no predecessor forms; customized values remain caller-owned.
|
|
7503
|
+
* A workspace that plans the application server barrel adds `build:app:barrel`, which has no
|
|
7504
|
+
* predecessor form. A workspace with the server application adds `serve:build`, which runs `build`
|
|
7505
|
+
* before `serve`, so the barrel and every browser face the server serves are rebuilt.
|
|
7458
7506
|
* Aggregate test scripts and
|
|
7459
7507
|
* maintainer-owned gate chains stay outside the region.
|
|
7460
7508
|
*
|
|
@@ -7465,8 +7513,8 @@ function blueprintToScripts(blueprint) {
|
|
|
7465
7513
|
* existed. The pack hook accepts the build chain emitted before it
|
|
7466
7514
|
* delegated to `build`. The publication hook accepts the same gate chain without
|
|
7467
7515
|
* {@link RELEASE_PROOF_COMMAND}. No accepted publication chain carries a study
|
|
7468
|
-
* step.
|
|
7469
|
-
* it is not repeated there. Any other value is a script the workspace author
|
|
7516
|
+
* step. `serve:build` accepts the server-only chain it ran before it delegated to
|
|
7517
|
+
* `build`. The value being written is always writable, so it is not repeated there. Any other value is a script the workspace author
|
|
7470
7518
|
* customized, and {@link replaceManifestScripts} retains it while writing the
|
|
7471
7519
|
* other named scripts independently.
|
|
7472
7520
|
*
|
|
@@ -7487,11 +7535,14 @@ function blueprintToWritableScripts(blueprint) {
|
|
|
7487
7535
|
const sheet = sheets.some((face) => name === `build:src:${face}` || name === `check:src:${face}`);
|
|
7488
7536
|
const framework = blueprintToFaces(blueprint).some((extension) => extension.surface === "browser" && extension.axes.some((axis) => name === `check:${axis}:${extension.name}` || name === `build:${axis}:${extension.name}` || axis === "app" && (name === `dev:${extension.name}` || name === `journey:${extension.name}` || name === `capture:${extension.name}`)));
|
|
7489
7537
|
const showcase = name === "showcase" || name.startsWith("showcase:") || name === "build:showcase" || name.startsWith("build:showcase:");
|
|
7490
|
-
|
|
7538
|
+
const capture = name === "journey" || name === "capture";
|
|
7539
|
+
const barrel = matchesBarrel(blueprint) && name === "build:app:barrel";
|
|
7540
|
+
const served = blueprint.app.includes("server") && name === "serve:build";
|
|
7541
|
+
if (!direct && !sheet && !framework && !showcase && !capture && !barrel && !served) return [];
|
|
7491
7542
|
return [{
|
|
7492
7543
|
name,
|
|
7493
7544
|
command,
|
|
7494
|
-
accepted: name === "test:guides" ? ["vitest run --config vite.config.ts --no-cache --reporter=dot --project guides"] : name === "test:bench" ? ["vitest bench --config vite.config.ts --no-cache --project probe"] : name === "build:src:styles" && blueprint.themes ? ["vite build --config configs/src/vite.styles.config.ts"] : sheets.some((face) => name === `test:src:${face}`) ? [command.slice(command.indexOf(" && ") + 4)] : []
|
|
7545
|
+
accepted: name === "test:guides" ? ["vitest run --config vite.config.ts --no-cache --reporter=dot --project guides"] : name === "test:bench" ? ["vitest bench --config vite.config.ts --no-cache --project probe"] : name === "build:src:styles" && blueprint.themes ? ["vite build --config configs/src/vite.styles.config.ts"] : sheets.some((face) => name === `test:src:${face}`) ? [command.slice(command.indexOf(" && ") + 4)] : name === "serve:build" ? ["npm run build:app:server && npm run serve"] : []
|
|
7495
7546
|
}];
|
|
7496
7547
|
});
|
|
7497
7548
|
const prepack = scripts.prepack;
|