@orkestrel/scaffold 0.0.133 → 0.0.135
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/agents/skills/orkestrel-dispatch/scripts/bench.js +61 -96
- package/dist/agents/skills/orkestrel-dispatch/scripts/brief.js +48 -76
- package/dist/agents/skills/orkestrel-dispatch/scripts/chain.js +27 -66
- package/dist/agents/skills/orkestrel-dispatch/scripts/cite.js +31 -64
- package/dist/agents/skills/orkestrel-dispatch/scripts/launch.js +43 -57
- package/dist/agents/skills/orkestrel-dispatch/scripts/login.js +43 -86
- package/dist/agents/skills/orkestrel-dispatch/scripts/patch.js +68 -104
- package/dist/agents/skills/orkestrel-dispatch/scripts/result.js +35 -69
- package/dist/agents/skills/orkestrel-dispatch/scripts/sweep.js +47 -84
- package/dist/agents/skills/orkestrel-falsify/scripts/mutate.js +134 -116
- package/dist/agents/skills/orkestrel-harden/scripts/discovery.js +38 -90
- package/dist/agents/skills/orkestrel-harden/scripts/interleave.js +39 -103
- package/dist/agents/skills/orkestrel-harden/scripts/measure.js +40 -89
- package/dist/agents/skills/orkestrel-harden/scripts/titles.js +41 -87
- package/dist/agents/skills/orkestrel-parallel/scripts/cases.js +43 -88
- package/dist/agents/skills/orkestrel-parallel/scripts/lane.js +1568 -213
- package/dist/agents/skills/orkestrel-publish/scripts/compare.js +40 -60
- package/dist/agents/skills/orkestrel-publish/scripts/pins.js +47 -81
- package/dist/agents/skills/orkestrel-publish/scripts/steps.js +66 -104
- package/dist/agents/skills/orkestrel-publish/scripts/swap.js +74 -88
- package/dist/agents/skills/orkestrel-publish/scripts/wave.js +387 -109
- package/dist/agents/skills/orkestrel-publish/scripts/window.js +55 -96
- package/dist/agents/skills/orkestrel-scout/scripts/map.js +54 -101
- package/dist/bin/main.js +275 -33
- package/dist/bin/main.js.map +1 -1
- package/dist/host/AGENTS.md +1 -1
- package/dist/host/agents/skills/orkestrel-dispatch/scripts/bench.ts +81 -97
- package/dist/host/agents/skills/orkestrel-dispatch/scripts/brief.ts +64 -72
- package/dist/host/agents/skills/orkestrel-dispatch/scripts/chain.ts +41 -63
- package/dist/host/agents/skills/orkestrel-dispatch/scripts/cite.ts +56 -79
- package/dist/host/agents/skills/orkestrel-dispatch/scripts/launch.ts +61 -74
- package/dist/host/agents/skills/orkestrel-dispatch/scripts/login.ts +59 -89
- package/dist/host/agents/skills/orkestrel-dispatch/scripts/patch.ts +87 -106
- package/dist/host/agents/skills/orkestrel-dispatch/scripts/result.ts +57 -76
- package/dist/host/agents/skills/orkestrel-dispatch/scripts/sweep.ts +73 -88
- package/dist/host/agents/skills/orkestrel-falsify/SKILL.md +2 -2
- package/dist/host/agents/skills/orkestrel-falsify/scripts/mutate.ts +167 -119
- package/dist/host/agents/skills/orkestrel-harden/references/methods.md +1 -1
- package/dist/host/agents/skills/orkestrel-harden/scripts/discovery.ts +58 -75
- package/dist/host/agents/skills/orkestrel-harden/scripts/interleave.ts +55 -99
- package/dist/host/agents/skills/orkestrel-harden/scripts/measure.ts +59 -90
- package/dist/host/agents/skills/orkestrel-harden/scripts/titles.ts +60 -80
- package/dist/host/agents/skills/orkestrel-parallel/SKILL.md +4 -4
- package/dist/host/agents/skills/orkestrel-parallel/scripts/cases.ts +71 -108
- package/dist/host/agents/skills/orkestrel-parallel/scripts/lane.ts +1990 -274
- package/dist/host/agents/skills/orkestrel-publish/references/release.md +1 -0
- package/dist/host/agents/skills/orkestrel-publish/references/wave.md +28 -7
- package/dist/host/agents/skills/orkestrel-publish/scripts/compare.ts +58 -79
- package/dist/host/agents/skills/orkestrel-publish/scripts/pins.ts +66 -87
- package/dist/host/agents/skills/orkestrel-publish/scripts/steps.ts +84 -102
- package/dist/host/agents/skills/orkestrel-publish/scripts/swap.ts +92 -99
- package/dist/host/agents/skills/orkestrel-publish/scripts/wave.ts +483 -127
- package/dist/host/agents/skills/orkestrel-publish/scripts/window.ts +82 -120
- package/dist/host/agents/skills/orkestrel-scout/SKILL.md +3 -3
- package/dist/host/agents/skills/orkestrel-scout/scripts/map.ts +85 -112
- package/dist/host/claude/agents/orkestrel.md +16 -16
- package/dist/host/claude/rules/architecture.md +1 -1
- package/dist/host/claude/rules/documentation.md +1 -1
- package/dist/host/claude/rules/patterns.md +7 -4
- package/dist/host/claude/rules/styles.md +1 -1
- package/dist/host/claude/rules/tests.md +3 -3
- package/dist/host/claude/rules/workspace.md +50 -37
- package/dist/host/configs/helpers.ts +117 -71
- package/dist/host/dotfiles/oxlintrc.json +6 -0
- package/dist/host/guides/agent.md +989 -395
- package/dist/host/guides/database.md +357 -342
- package/dist/host/guides/form.md +79 -4
- package/dist/host/guides/middleware.md +5 -5
- package/dist/host/guides/ollama.md +41 -42
- package/dist/host/guides/scaffold.md +170 -70
- package/dist/host/guides/study.md +12 -12
- package/dist/host/guides/table.md +20 -6
- package/dist/host/guides/test.md +166 -52
- package/dist/host/guides/toolbox.md +127 -81
- package/dist/host/guides/workspace.md +21 -14
- package/dist/host/manifest.json +54 -54
- package/dist/host/tests/config.test.ts +251 -7
- package/dist/host/tests/policy.test.ts +14 -21
- package/dist/host/tests/setupPolicy.ts +43 -36
- package/dist/src/core/index.cjs +533 -139
- package/dist/src/core/index.cjs.map +1 -1
- package/dist/src/core/index.d.cts +223 -16
- package/dist/src/core/index.d.ts +223 -16
- package/dist/src/core/index.js +524 -139
- package/dist/src/core/index.js.map +1 -1
- package/dist/src/server/index.cjs +23 -14
- package/dist/src/server/index.cjs.map +1 -1
- package/dist/src/server/index.d.cts +3 -2
- package/dist/src/server/index.d.ts +3 -2
- package/dist/src/server/index.js +24 -15
- package/dist/src/server/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -2,6 +2,7 @@ import { spawnSync } from 'node:child_process';
|
|
|
2
2
|
import { createHash } from 'node:crypto';
|
|
3
3
|
import { existsSync, lstatSync, mkdirSync, mkdtempSync, readdirSync, readFileSync, realpathSync, renameSync, rmSync, writeFileSync, } from 'node:fs';
|
|
4
4
|
import { basename, dirname, isAbsolute, join, relative, resolve } from 'node:path';
|
|
5
|
+
import { isDeepStrictEqual, parseArgs } from 'node:util';
|
|
5
6
|
/** Lists the manifest fields a pin rewrites. */
|
|
6
7
|
export const FIELDS = ['dependencies', 'devDependencies'];
|
|
7
8
|
/** Lists the modes in the order the script checks them. */
|
|
@@ -20,17 +21,11 @@ export const EXIT_DRIFT = 3;
|
|
|
20
21
|
export const EXIT_USAGE = 64;
|
|
21
22
|
/** Holds the refusal for a manifest the script would reformat. */
|
|
22
23
|
export const FORMAT_PROBLEM = 'package.json is not tab-indented JSON with a trailing newline; the script would reformat it';
|
|
23
|
-
/** Lists the
|
|
24
|
-
export const
|
|
25
|
-
pin: ['
|
|
26
|
-
restore: ['
|
|
27
|
-
status: ['
|
|
28
|
-
};
|
|
29
|
-
/** Lists the switch flags each mode reads. */
|
|
30
|
-
export const SWITCH_FLAGS = {
|
|
31
|
-
pin: ['--pin', '--no-build', '--dry-run', '--json'],
|
|
32
|
-
restore: ['--restore', '--json'],
|
|
33
|
-
status: ['--status', '--json'],
|
|
24
|
+
/** Lists the flags each mode reads, by the name `parseArgs` reads them under. */
|
|
25
|
+
export const MODE_OPTIONS = {
|
|
26
|
+
pin: ['pin', 'consumer', 'source', 'override', 'no-build', 'dry-run', 'json'],
|
|
27
|
+
restore: ['restore', 'consumer', 'package', 'json'],
|
|
28
|
+
status: ['status', 'consumer', 'json'],
|
|
34
29
|
};
|
|
35
30
|
/**
|
|
36
31
|
* Lists the `package.json` keys oxfmt sorts ahead of `overrides`.
|
|
@@ -118,6 +113,39 @@ export const USAGE = [
|
|
|
118
113
|
' swap.ts --restore --consumer DIR [--package NAME ...] [--json]',
|
|
119
114
|
' swap.ts --status --consumer DIR [--json]',
|
|
120
115
|
].join('\n');
|
|
116
|
+
/** Declares every flag the script reads, for `parseArgs`. */
|
|
117
|
+
export const OPTIONS = Object.freeze({
|
|
118
|
+
pin: Object.freeze({ type: 'boolean' }),
|
|
119
|
+
restore: Object.freeze({ type: 'boolean' }),
|
|
120
|
+
status: Object.freeze({ type: 'boolean' }),
|
|
121
|
+
consumer: Object.freeze({ type: 'string' }),
|
|
122
|
+
source: Object.freeze({ type: 'string', multiple: true }),
|
|
123
|
+
override: Object.freeze({ type: 'string', multiple: true }),
|
|
124
|
+
package: Object.freeze({ type: 'string', multiple: true }),
|
|
125
|
+
'no-build': Object.freeze({ type: 'boolean' }),
|
|
126
|
+
'dry-run': Object.freeze({ type: 'boolean' }),
|
|
127
|
+
json: Object.freeze({ type: 'boolean' }),
|
|
128
|
+
});
|
|
129
|
+
/**
|
|
130
|
+
* Parses the arguments in strict mode against `OPTIONS`.
|
|
131
|
+
*
|
|
132
|
+
* @param argv - The arguments after the script path.
|
|
133
|
+
* @returns The values and positionals, or the message `parseArgs` refused the arguments with.
|
|
134
|
+
*/
|
|
135
|
+
export function parseArguments(argv) {
|
|
136
|
+
try {
|
|
137
|
+
const { values, positionals } = parseArgs({
|
|
138
|
+
args: [...argv],
|
|
139
|
+
options: OPTIONS,
|
|
140
|
+
strict: true,
|
|
141
|
+
allowPositionals: false,
|
|
142
|
+
});
|
|
143
|
+
return { success: true, value: { values, positionals } };
|
|
144
|
+
}
|
|
145
|
+
catch (error) {
|
|
146
|
+
return { success: false, error: error instanceof Error ? error.message : String(error) };
|
|
147
|
+
}
|
|
148
|
+
}
|
|
121
149
|
/** Names the manifest fields that hold specs, including nested overrides. */
|
|
122
150
|
export const SPEC_FIELDS = Object.freeze([
|
|
123
151
|
'dependencies',
|
|
@@ -192,47 +220,7 @@ export function removeTree(path) {
|
|
|
192
220
|
* @returns The same path with every backslash replaced by a slash.
|
|
193
221
|
*/
|
|
194
222
|
export function normalizeSlashes(path) {
|
|
195
|
-
return path.
|
|
196
|
-
}
|
|
197
|
-
/**
|
|
198
|
-
* Reads the value that follows a flag.
|
|
199
|
-
*
|
|
200
|
-
* @remarks
|
|
201
|
-
* Reads `--flag value` pairs: the first occurrence of a flag wins, a following value that opens
|
|
202
|
-
* with `--` is a missing value, and the `--flag=value` form is not read.
|
|
203
|
-
*
|
|
204
|
-
* @param argv - The arguments after the script path.
|
|
205
|
-
* @param name - The flag, such as `--consumer`.
|
|
206
|
-
* @returns The value after the flag, or undefined when the flag is absent, last, or followed by
|
|
207
|
-
* another flag.
|
|
208
|
-
*/
|
|
209
|
-
export function readOption(argv, name) {
|
|
210
|
-
const index = argv.indexOf(name);
|
|
211
|
-
const value = index === -1 ? undefined : argv[index + 1];
|
|
212
|
-
return value === undefined || value.startsWith('--') ? undefined : value;
|
|
213
|
-
}
|
|
214
|
-
/**
|
|
215
|
-
* Names the value flags a caller gave with no value.
|
|
216
|
-
*
|
|
217
|
-
* @param argv - The arguments after the script path.
|
|
218
|
-
* @param names - The flags that take a value.
|
|
219
|
-
* @returns Each named flag that appears last or is followed by another flag, in argument order.
|
|
220
|
-
*/
|
|
221
|
-
export function readMissingFlags(argv, names) {
|
|
222
|
-
return names.filter((name) => argv.includes(name) && readOption(argv, name) === undefined);
|
|
223
|
-
}
|
|
224
|
-
/**
|
|
225
|
-
* Reads every value that follows a repeatable flag.
|
|
226
|
-
*
|
|
227
|
-
* @param argv - The arguments after the script path.
|
|
228
|
-
* @param name - The flag, such as `--source`.
|
|
229
|
-
* @returns The values in order, empty when the flag never appears.
|
|
230
|
-
*/
|
|
231
|
-
export function readOptions(argv, name) {
|
|
232
|
-
return argv.flatMap((argument, index) => {
|
|
233
|
-
const value = argv[index + 1];
|
|
234
|
-
return argument === name && value !== undefined && !value.startsWith('--') ? [value] : [];
|
|
235
|
-
});
|
|
223
|
+
return path.replaceAll('\\', '/');
|
|
236
224
|
}
|
|
237
225
|
/**
|
|
238
226
|
* Parses a whole text as one JSON object.
|
|
@@ -900,24 +888,16 @@ export function matchesRange(text, range) {
|
|
|
900
888
|
* Parses the command line.
|
|
901
889
|
*
|
|
902
890
|
* @param argv - The arguments after the script path.
|
|
903
|
-
* @returns The command, or the reason the line is refused: no mode or two
|
|
904
|
-
*
|
|
905
|
-
* source.
|
|
891
|
+
* @returns The command, or the reason the line is refused: the `parseArgs` refusal, no mode or two
|
|
892
|
+
* modes, a flag the mode does not read, no consumer, or a pin with no source.
|
|
906
893
|
*/
|
|
907
894
|
export function parseCommand(argv) {
|
|
908
|
-
const
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
]);
|
|
913
|
-
|
|
914
|
-
const end = argv.indexOf('--');
|
|
915
|
-
const foreign = (end === -1 ? argv : argv.slice(0, end)).filter((token) => token.startsWith('--') && !known.includes(token));
|
|
916
|
-
if (foreign.length > 0) {
|
|
917
|
-
return { ok: false, message: `${foreign.join(', ')} is not a flag this script reads` };
|
|
918
|
-
}
|
|
919
|
-
const given = MODES.filter((candidate) => argv.includes(`--${candidate}`));
|
|
920
|
-
const mode = MODES.find((candidate) => argv.includes(`--${candidate}`));
|
|
895
|
+
const parsed = parseArguments(argv);
|
|
896
|
+
if (!parsed.success)
|
|
897
|
+
return { ok: false, message: parsed.error };
|
|
898
|
+
const { values } = parsed.value;
|
|
899
|
+
const given = MODES.filter((candidate) => values[candidate] === true);
|
|
900
|
+
const [mode] = given;
|
|
921
901
|
if (mode === undefined)
|
|
922
902
|
return { ok: false, message: 'Give one of --pin, --restore, and --status' };
|
|
923
903
|
if (given.length > 1) {
|
|
@@ -926,22 +906,17 @@ export function parseCommand(argv) {
|
|
|
926
906
|
message: `Give one mode, not ${given.map((candidate) => `--${candidate}`).join(' and ')}`,
|
|
927
907
|
};
|
|
928
908
|
}
|
|
929
|
-
const
|
|
930
|
-
const switches = SWITCH_FLAGS[mode];
|
|
931
|
-
const unknown = argv.filter((token, index) => token.startsWith('--')
|
|
932
|
-
? !values.includes(token) && !switches.includes(token)
|
|
933
|
-
: !values.includes(argv[index - 1] ?? ''));
|
|
909
|
+
const unknown = Object.keys(values).filter((name) => values[name] !== undefined && !MODE_OPTIONS[mode].includes(name));
|
|
934
910
|
if (unknown.length > 0) {
|
|
935
|
-
return {
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
return { ok: false, message: `${missing.join(', ')} given with no value` };
|
|
911
|
+
return {
|
|
912
|
+
ok: false,
|
|
913
|
+
message: `--${mode} does not read ${unknown.map((name) => `--${name}`).join(', ')}`,
|
|
914
|
+
};
|
|
940
915
|
}
|
|
941
|
-
const consumer =
|
|
916
|
+
const consumer = typeof values.consumer === 'string' ? values.consumer : undefined;
|
|
942
917
|
if (consumer === undefined)
|
|
943
918
|
return { ok: false, message: '--consumer DIR is required' };
|
|
944
|
-
const sources =
|
|
919
|
+
const sources = collectStrings(values.source);
|
|
945
920
|
if (mode === 'pin' && sources.length === 0) {
|
|
946
921
|
return { ok: false, message: '--pin takes at least one --source DIR' };
|
|
947
922
|
}
|
|
@@ -951,14 +926,25 @@ export function parseCommand(argv) {
|
|
|
951
926
|
mode,
|
|
952
927
|
consumer: resolve(consumer),
|
|
953
928
|
sources: sources.map((source) => resolve(source)),
|
|
954
|
-
overrides:
|
|
955
|
-
packages:
|
|
956
|
-
build:
|
|
957
|
-
dry:
|
|
958
|
-
json:
|
|
929
|
+
overrides: collectStrings(values.override),
|
|
930
|
+
packages: collectStrings(values.package),
|
|
931
|
+
build: values['no-build'] !== true,
|
|
932
|
+
dry: values['dry-run'] === true,
|
|
933
|
+
json: values.json === true,
|
|
959
934
|
},
|
|
960
935
|
};
|
|
961
936
|
}
|
|
937
|
+
/**
|
|
938
|
+
* Collects the strings a repeatable flag's value holds.
|
|
939
|
+
*
|
|
940
|
+
* @param value - The value `parseArgs` read for a flag declared with `multiple: true`.
|
|
941
|
+
* @returns Each string in order, empty when the flag never appears.
|
|
942
|
+
*/
|
|
943
|
+
export function collectStrings(value) {
|
|
944
|
+
return Array.isArray(value)
|
|
945
|
+
? value.filter((member) => typeof member === 'string')
|
|
946
|
+
: [];
|
|
947
|
+
}
|
|
962
948
|
/**
|
|
963
949
|
* Computes the SHA-256 digest of bytes.
|
|
964
950
|
*
|
|
@@ -1247,7 +1233,7 @@ export function proveInstalled(consumer, tarball, declared, copies) {
|
|
|
1247
1233
|
]
|
|
1248
1234
|
: []),
|
|
1249
1235
|
...(installed?.link === true ? [`${name} is installed as a link`] : []),
|
|
1250
|
-
...(real &&
|
|
1236
|
+
...(real && !isDeepStrictEqual(present, tarball.files)
|
|
1251
1237
|
? [`${name} file set differs from its pack list`]
|
|
1252
1238
|
: []),
|
|
1253
1239
|
...(differing.length > 0 ? [`${name} differs from its source in ${differing.join(', ')}`] : []),
|
|
@@ -1385,7 +1371,7 @@ export function printReport(json, lines, report) {
|
|
|
1385
1371
|
* @returns The usage exit code.
|
|
1386
1372
|
*/
|
|
1387
1373
|
export function reportUsage(message) {
|
|
1388
|
-
process.stderr.write(`swap: ${message}
|
|
1374
|
+
process.stderr.write(`swap: ${message}; ${USAGE}\n`);
|
|
1389
1375
|
return EXIT_USAGE;
|
|
1390
1376
|
}
|
|
1391
1377
|
/**
|
|
@@ -1904,7 +1890,7 @@ export function executeStatus(command) {
|
|
|
1904
1890
|
const archive = join(tarballs, entry.tarball);
|
|
1905
1891
|
const git = existsSync(entry.source) ? inspectCheckout(entry.source) : undefined;
|
|
1906
1892
|
const held = entry.field === undefined ? current[name] : declaration?.spec;
|
|
1907
|
-
const link =
|
|
1893
|
+
const link = lstatSync(top, { throwIfNoEntry: false })?.isSymbolicLink() === true;
|
|
1908
1894
|
const installed = existsSync(top)
|
|
1909
1895
|
? {
|
|
1910
1896
|
version: readString(loadJSONRecord(join(top, 'package.json')), 'version'),
|