@orkestrel/scaffold 0.0.129 → 0.0.130
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 +1 -1
- package/dist/host/agents/orchestration.md +1 -0
- package/dist/host/agents/skills/orkestrel-parallel/references/t3.md +1 -0
- package/dist/host/claude/agents/orkestrel.md +3 -3
- package/dist/host/guides/capture.md +5 -5
- package/dist/host/guides/middleware.md +82 -64
- package/dist/host/manifest.json +6 -6
- package/dist/src/core/index.cjs +56 -12
- package/dist/src/core/index.cjs.map +1 -1
- package/dist/src/core/index.js +56 -12
- package/dist/src/core/index.js.map +1 -1
- package/package.json +1 -1
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.130",
|
|
7
7
|
description: "Scaffold workspaces with commands: new, audit, surface, repair, catalog, and overwrite.",
|
|
8
8
|
keywords: [
|
|
9
9
|
"audit",
|
|
@@ -2754,10 +2754,15 @@ export interface DistributionClassification {
|
|
|
2754
2754
|
readonly targets: readonly string[]
|
|
2755
2755
|
}
|
|
2756
2756
|
|
|
2757
|
+
/** Holds the file, leading arguments, and shell route an npm run spawns with. */
|
|
2758
|
+
export interface DistributionNpmCommand {
|
|
2759
|
+
readonly file: string
|
|
2760
|
+
readonly prefix: readonly string[]
|
|
2761
|
+
readonly shell: boolean
|
|
2762
|
+
}
|
|
2763
|
+
|
|
2757
2764
|
/** Names the workspace whose packed artifact the proof consumes. */
|
|
2758
2765
|
export const DISTRIBUTION_ROOT = resolve(dirname(fileURLToPath(import.meta.url)), '..')
|
|
2759
|
-
/** Names the npm executable on the running host. */
|
|
2760
|
-
export const DISTRIBUTION_NPM = process.platform === 'win32' ? 'npm.cmd' : 'npm'
|
|
2761
2766
|
// The compiler this workspace installs, run as a command rather than called in
|
|
2762
2767
|
// process: the command and its plain-text diagnostics are the same across the
|
|
2763
2768
|
// compiler majors this toolchain supports, and its in-process API is not. It is
|
|
@@ -2770,12 +2775,6 @@ export const DISTRIBUTION_TYPESCRIPT = createRequire(
|
|
|
2770
2775
|
).resolve('typescript/package.json')
|
|
2771
2776
|
/** Names the compiler installed by the workspace under proof. */
|
|
2772
2777
|
export const DISTRIBUTION_COMPILER = join(dirname(DISTRIBUTION_TYPESCRIPT), 'bin', 'tsc')
|
|
2773
|
-
// Windows needs a shell to launch a \`.cmd\`: Node refuses one directly since the
|
|
2774
|
-
// batch-argument hardening, and \`spawnSync\` returns \`EINVAL\` with a null status
|
|
2775
|
-
// rather than an exit code a caller can read. Every following argument is a literal or
|
|
2776
|
-
// a path this file built, so the shell has nothing to escape.
|
|
2777
|
-
/** Selects the Windows command-shell route required by the npm shim. */
|
|
2778
|
-
export const DISTRIBUTION_SHELL = process.platform === 'win32'
|
|
2779
2778
|
// \`prepublishOnly\` runs this proof as \`npm run test:distribution -- --mode release\`,
|
|
2780
2779
|
// and the root configuration's project factories carry that mode into this project.
|
|
2781
2780
|
// Release is the publish gate, so evidence it cannot obtain fails there and skips
|
|
@@ -3102,6 +3101,50 @@ export function readDistributionOutput(result: SpawnSyncReturns<string>): string
|
|
|
3102
3101
|
return \`\${result.stdout ?? ''}\${result.stderr ?? ''}\`.trim()
|
|
3103
3102
|
}
|
|
3104
3103
|
|
|
3104
|
+
/**
|
|
3105
|
+
* Resolves the npm command for the running host.
|
|
3106
|
+
*
|
|
3107
|
+
* @remarks
|
|
3108
|
+
* npm's JavaScript entry beside the running Node binary spawns without a shell on every host. The
|
|
3109
|
+
* shim is the fallback where none sits there, and Windows needs a shell to launch its \`.cmd\`: Node
|
|
3110
|
+
* refuses one directly since the batch-argument hardening, and \`spawnSync\` returns \`EINVAL\` with a
|
|
3111
|
+
* null status rather than an exit code a caller can read. Every argument this file passes is a
|
|
3112
|
+
* literal or a path it built, so the shell has nothing to escape.
|
|
3113
|
+
*
|
|
3114
|
+
* @returns The file to spawn, the arguments that precede npm's own, and whether it needs a shell.
|
|
3115
|
+
*/
|
|
3116
|
+
export function resolveDistributionNpm(): DistributionNpmCommand {
|
|
3117
|
+
const cli = join(dirname(process.execPath), 'node_modules', 'npm', 'bin', 'npm-cli.js')
|
|
3118
|
+
if (existsSync(cli)) return { file: process.execPath, prefix: [cli], shell: false }
|
|
3119
|
+
const windows = process.platform === 'win32'
|
|
3120
|
+
return { file: windows ? 'npm.cmd' : 'npm', prefix: [], shell: windows }
|
|
3121
|
+
}
|
|
3122
|
+
|
|
3123
|
+
/**
|
|
3124
|
+
* Merges added variables over an inherited environment by case-folded name.
|
|
3125
|
+
*
|
|
3126
|
+
* @remarks
|
|
3127
|
+
* A Windows environment block folds names by case, and npm reads its \`npm_config_\` variables
|
|
3128
|
+
* case-insensitively on every host, so every inherited name an added name claims is dropped first:
|
|
3129
|
+
* an inherited \`NPM_CONFIG_CACHE\` would otherwise outrank an added \`npm_config_cache\`.
|
|
3130
|
+
*
|
|
3131
|
+
* @param inherited - The environment the child would inherit.
|
|
3132
|
+
* @param added - The variables the call sets.
|
|
3133
|
+
* @returns The merged environment.
|
|
3134
|
+
*/
|
|
3135
|
+
export function mergeDistributionEnvironment(
|
|
3136
|
+
inherited: Readonly<Record<string, string | undefined>>,
|
|
3137
|
+
added: Readonly<Record<string, string>>,
|
|
3138
|
+
): Readonly<Record<string, string | undefined>> {
|
|
3139
|
+
const claimed = new Set(Object.keys(added).map((name) => name.toLowerCase()))
|
|
3140
|
+
return {
|
|
3141
|
+
...Object.fromEntries(
|
|
3142
|
+
Object.entries(inherited).filter(([name]) => !claimed.has(name.toLowerCase())),
|
|
3143
|
+
),
|
|
3144
|
+
...added,
|
|
3145
|
+
}
|
|
3146
|
+
}
|
|
3147
|
+
|
|
3105
3148
|
/**
|
|
3106
3149
|
* Runs npm with a cache inside the owned scratch directory.
|
|
3107
3150
|
*
|
|
@@ -3115,11 +3158,12 @@ export function runDistributionNpm(
|
|
|
3115
3158
|
cwd: string,
|
|
3116
3159
|
scratch: string,
|
|
3117
3160
|
): SpawnSyncReturns<string> {
|
|
3118
|
-
|
|
3161
|
+
const npm = resolveDistributionNpm()
|
|
3162
|
+
return spawnSync(npm.file, [...npm.prefix, ...args], {
|
|
3119
3163
|
cwd,
|
|
3120
3164
|
encoding: 'utf8',
|
|
3121
|
-
env:
|
|
3122
|
-
shell:
|
|
3165
|
+
env: mergeDistributionEnvironment(process.env, { npm_config_cache: join(scratch, 'cache') }),
|
|
3166
|
+
shell: npm.shell,
|
|
3123
3167
|
windowsHide: true,
|
|
3124
3168
|
})
|
|
3125
3169
|
}
|