@orkestrel/scaffold 0.0.133 → 0.0.134

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.
Files changed (82) hide show
  1. package/dist/agents/skills/orkestrel-dispatch/scripts/bench.js +61 -96
  2. package/dist/agents/skills/orkestrel-dispatch/scripts/brief.js +48 -76
  3. package/dist/agents/skills/orkestrel-dispatch/scripts/chain.js +27 -66
  4. package/dist/agents/skills/orkestrel-dispatch/scripts/cite.js +31 -64
  5. package/dist/agents/skills/orkestrel-dispatch/scripts/launch.js +43 -57
  6. package/dist/agents/skills/orkestrel-dispatch/scripts/login.js +43 -86
  7. package/dist/agents/skills/orkestrel-dispatch/scripts/patch.js +68 -104
  8. package/dist/agents/skills/orkestrel-dispatch/scripts/result.js +35 -69
  9. package/dist/agents/skills/orkestrel-dispatch/scripts/sweep.js +47 -84
  10. package/dist/agents/skills/orkestrel-falsify/scripts/mutate.js +134 -116
  11. package/dist/agents/skills/orkestrel-harden/scripts/discovery.js +38 -90
  12. package/dist/agents/skills/orkestrel-harden/scripts/interleave.js +39 -103
  13. package/dist/agents/skills/orkestrel-harden/scripts/measure.js +40 -89
  14. package/dist/agents/skills/orkestrel-harden/scripts/titles.js +41 -87
  15. package/dist/agents/skills/orkestrel-parallel/scripts/cases.js +43 -88
  16. package/dist/agents/skills/orkestrel-parallel/scripts/lane.js +1018 -194
  17. package/dist/agents/skills/orkestrel-publish/scripts/compare.js +40 -60
  18. package/dist/agents/skills/orkestrel-publish/scripts/pins.js +47 -81
  19. package/dist/agents/skills/orkestrel-publish/scripts/steps.js +66 -104
  20. package/dist/agents/skills/orkestrel-publish/scripts/swap.js +74 -88
  21. package/dist/agents/skills/orkestrel-publish/scripts/wave.js +95 -108
  22. package/dist/agents/skills/orkestrel-publish/scripts/window.js +55 -96
  23. package/dist/agents/skills/orkestrel-scout/scripts/map.js +54 -101
  24. package/dist/bin/main.js +27 -3
  25. package/dist/bin/main.js.map +1 -1
  26. package/dist/host/agents/skills/orkestrel-dispatch/scripts/bench.ts +81 -97
  27. package/dist/host/agents/skills/orkestrel-dispatch/scripts/brief.ts +64 -72
  28. package/dist/host/agents/skills/orkestrel-dispatch/scripts/chain.ts +41 -63
  29. package/dist/host/agents/skills/orkestrel-dispatch/scripts/cite.ts +56 -79
  30. package/dist/host/agents/skills/orkestrel-dispatch/scripts/launch.ts +61 -74
  31. package/dist/host/agents/skills/orkestrel-dispatch/scripts/login.ts +59 -89
  32. package/dist/host/agents/skills/orkestrel-dispatch/scripts/patch.ts +87 -106
  33. package/dist/host/agents/skills/orkestrel-dispatch/scripts/result.ts +57 -76
  34. package/dist/host/agents/skills/orkestrel-dispatch/scripts/sweep.ts +73 -88
  35. package/dist/host/agents/skills/orkestrel-falsify/SKILL.md +2 -2
  36. package/dist/host/agents/skills/orkestrel-falsify/scripts/mutate.ts +167 -119
  37. package/dist/host/agents/skills/orkestrel-harden/references/methods.md +1 -1
  38. package/dist/host/agents/skills/orkestrel-harden/scripts/discovery.ts +58 -75
  39. package/dist/host/agents/skills/orkestrel-harden/scripts/interleave.ts +55 -99
  40. package/dist/host/agents/skills/orkestrel-harden/scripts/measure.ts +59 -90
  41. package/dist/host/agents/skills/orkestrel-harden/scripts/titles.ts +60 -80
  42. package/dist/host/agents/skills/orkestrel-parallel/SKILL.md +4 -4
  43. package/dist/host/agents/skills/orkestrel-parallel/scripts/cases.ts +71 -108
  44. package/dist/host/agents/skills/orkestrel-parallel/scripts/lane.ts +1288 -239
  45. package/dist/host/agents/skills/orkestrel-publish/references/wave.md +10 -6
  46. package/dist/host/agents/skills/orkestrel-publish/scripts/compare.ts +58 -79
  47. package/dist/host/agents/skills/orkestrel-publish/scripts/pins.ts +66 -87
  48. package/dist/host/agents/skills/orkestrel-publish/scripts/steps.ts +84 -102
  49. package/dist/host/agents/skills/orkestrel-publish/scripts/swap.ts +92 -99
  50. package/dist/host/agents/skills/orkestrel-publish/scripts/wave.ts +130 -126
  51. package/dist/host/agents/skills/orkestrel-publish/scripts/window.ts +82 -120
  52. package/dist/host/agents/skills/orkestrel-scout/SKILL.md +3 -3
  53. package/dist/host/agents/skills/orkestrel-scout/scripts/map.ts +85 -112
  54. package/dist/host/claude/agents/orkestrel.md +4 -4
  55. package/dist/host/claude/rules/documentation.md +1 -1
  56. package/dist/host/claude/rules/patterns.md +5 -4
  57. package/dist/host/claude/rules/styles.md +1 -1
  58. package/dist/host/claude/rules/tests.md +3 -3
  59. package/dist/host/claude/rules/workspace.md +47 -35
  60. package/dist/host/configs/helpers.ts +40 -15
  61. package/dist/host/dotfiles/oxlintrc.json +62 -0
  62. package/dist/host/guides/form.md +79 -4
  63. package/dist/host/guides/scaffold.md +93 -65
  64. package/dist/host/guides/table.md +20 -6
  65. package/dist/host/guides/test.md +9 -7
  66. package/dist/host/manifest.json +44 -44
  67. package/dist/host/tests/config.test.ts +201 -11
  68. package/dist/host/tests/policy.test.ts +14 -21
  69. package/dist/host/tests/setupPolicy.ts +43 -36
  70. package/dist/src/core/index.cjs +191 -93
  71. package/dist/src/core/index.cjs.map +1 -1
  72. package/dist/src/core/index.d.cts +27 -13
  73. package/dist/src/core/index.d.ts +27 -13
  74. package/dist/src/core/index.js +189 -93
  75. package/dist/src/core/index.js.map +1 -1
  76. package/dist/src/server/index.cjs +8 -9
  77. package/dist/src/server/index.cjs.map +1 -1
  78. package/dist/src/server/index.d.cts +1 -1
  79. package/dist/src/server/index.d.ts +1 -1
  80. package/dist/src/server/index.js +8 -9
  81. package/dist/src/server/index.js.map +1 -1
  82. package/package.json +2 -2
@@ -1,84 +1,33 @@
1
- // Check a Vitest JSON report against named red and green cases. Run from the checkout root:
2
- // node .agents/skills/orkestrel-parallel/scripts/cases.ts --report FILE.json [--passed NAME ...] [--failed NAME ...]
3
- // The report is Vitest's `--reporter=json` output. A name matches every case whose full name (its
4
- // `describe` titles and its own title, joined by spaces) or whose own title equals it exactly; a name
5
- // that opens with `--` cannot be given. Each `--passed NAME` requires every case it matches to have
6
- // passed and each `--failed NAME` requires every one to have failed; a name that matches no case is
7
- // missing. A failed case that no name matches is refused, so a run that fails more than the request
8
- // expected reads as a difference. A test file that failed with no failed case (it did not collect,
9
- // or a hook threw) is an unnamed failure named by its file, and a report whose `success` is false
10
- // while no case and no file failed is a difference too. Name no case to require a report with no
11
- // failure. Both flags repeat and a name may not be given to both. The script prints one summary
12
- // line, one line per difference, and `ok` or `differences=N`. The script refuses a flag it does not
13
- // read, the `--flag=value` form included, and names an unknown flag before a flag given with no
14
- // value. Exit 0 when the report matches the names, 3 when it does not, 2 when the report cannot be
15
- // read as a Vitest report, 64 on usage.
16
- import { existsSync, readFileSync, realpathSync, statSync } from 'node:fs';
1
+ import { readFileSync, realpathSync, statSync } from 'node:fs';
17
2
  import { relative } from 'node:path';
18
- /** Lists the flags that take a value. */
19
- export const VALUE_FLAGS = ['--report', '--passed', '--failed'];
20
- /** Lists every flag the script reads, value flags and switches alike. */
21
- export const FLAGS = VALUE_FLAGS;
3
+ import { parseArgs } from 'node:util';
22
4
  /** Holds the usage line printed when a call names no report. */
23
5
  export const USAGE = 'usage: cases.ts --report FILE.json [--passed NAME ...] [--failed NAME ...]; --passed and --failed repeat';
6
+ /** Declares every flag the script reads, for `parseArgs`. */
7
+ export const OPTIONS = Object.freeze({
8
+ report: Object.freeze({ type: 'string' }),
9
+ passed: Object.freeze({ type: 'string', multiple: true }),
10
+ failed: Object.freeze({ type: 'string', multiple: true }),
11
+ });
24
12
  /**
25
- * Names the value flags a caller gave with no value, at any occurrence.
13
+ * Parses the arguments in strict mode against `OPTIONS`.
26
14
  *
27
15
  * @param argv - The arguments after the script path.
28
- * @param names - The flags that take a value.
29
- * @returns Each named flag that appears last or is followed by another flag, in argument order.
16
+ * @returns The values and positionals, or the message `parseArgs` refused the arguments with.
30
17
  */
31
- export function readMissingFlags(argv, names) {
32
- return names.filter((name) => argv.some((argument, index) => argument === name && isMissingValue(argv, index)));
33
- }
34
- /**
35
- * Checks whether the argument after a flag is absent or is another flag.
36
- *
37
- * @param argv - The arguments after the script path.
38
- * @param index - The position of the flag.
39
- * @returns True when no value follows the flag; false otherwise.
40
- */
41
- export function isMissingValue(argv, index) {
42
- const value = argv[index + 1];
43
- return value === undefined || value.startsWith('--');
44
- }
45
- /**
46
- * Names the flags a caller gave that the script does not read.
47
- *
48
- * @remarks
49
- * A `--flag=value` argument is unknown, because the script reads no such form. A bare `--` ends the
50
- * scan.
51
- *
52
- * @param argv - The arguments after the script path.
53
- * @param flags - Every flag the script reads, value flags and switches alike.
54
- * @returns Each argument that opens with `--` and is not a read flag, in argument order.
55
- */
56
- export function readUnknownFlags(argv, flags) {
57
- const end = argv.indexOf('--');
58
- return (end === -1 ? argv : argv.slice(0, end)).filter((argument) => argument.startsWith('--') && !flags.includes(argument));
59
- }
60
- /**
61
- * Reads every value that follows a repeatable flag.
62
- *
63
- * @param argv - The arguments after the script path.
64
- * @param name - The flag, such as `--passed`.
65
- * @returns The values in order, empty when the flag never appears.
66
- */
67
- export function readOptions(argv, name) {
68
- return argv.flatMap((argument, index) => {
69
- const value = argv[index + 1];
70
- return argument === name && value !== undefined && !value.startsWith('--') ? [value] : [];
71
- });
72
- }
73
- /**
74
- * Reads the arguments that are neither a flag nor the value of a value flag.
75
- *
76
- * @param argv - The arguments after the script path.
77
- * @param valueFlags - The flags that take a value.
78
- * @returns The positional arguments in order.
79
- */
80
- export function readPositionals(argv, valueFlags) {
81
- return argv.filter((argument, index) => !argument.startsWith('--') && !valueFlags.includes(argv[index - 1] ?? ''));
18
+ export function parseArguments(argv) {
19
+ try {
20
+ const { values, positionals } = parseArgs({
21
+ args: [...argv],
22
+ options: OPTIONS,
23
+ strict: true,
24
+ allowPositionals: false,
25
+ });
26
+ return { success: true, value: { values, positionals } };
27
+ }
28
+ catch (error) {
29
+ return { success: false, error: error instanceof Error ? error.message : String(error) };
30
+ }
82
31
  }
83
32
  /**
84
33
  * Checks whether a value is a non-null, non-array object.
@@ -269,6 +218,17 @@ export function readReport(path) {
269
218
  return undefined;
270
219
  }
271
220
  }
221
+ /**
222
+ * Collects the strings a repeatable flag's value holds.
223
+ *
224
+ * @param value - The value `parseArgs` read for a flag declared with `multiple: true`.
225
+ * @returns Each string in order, empty when the flag never appears.
226
+ */
227
+ export function collectStrings(value) {
228
+ return Array.isArray(value)
229
+ ? value.filter((member) => typeof member === 'string')
230
+ : [];
231
+ }
272
232
  /**
273
233
  * Runs the script on its arguments.
274
234
  *
@@ -277,21 +237,16 @@ export function readReport(path) {
277
237
  * cannot be read as a Vitest report, 64 on usage.
278
238
  */
279
239
  export function main(argv) {
280
- const unknown = readUnknownFlags(argv, FLAGS);
281
- if (unknown.length > 0) {
282
- console.error(`cases: ${unknown.join(', ')} is not a flag this script reads; ${USAGE}`);
283
- return 64;
284
- }
285
- const missing = readMissingFlags(argv, VALUE_FLAGS);
286
- if (missing.length > 0) {
287
- console.error(`cases: ${missing.join(', ')} given with no value`);
240
+ const parsed = parseArguments(argv);
241
+ if (!parsed.success) {
242
+ console.error(`cases: ${parsed.error}; ${USAGE}`);
288
243
  return 64;
289
244
  }
290
- const reports = readOptions(argv, '--report');
291
- const path = reports[0];
292
- const passed = readOptions(argv, '--passed');
293
- const failed = readOptions(argv, '--failed');
294
- if (path === undefined || readPositionals(argv, VALUE_FLAGS).length > 0) {
245
+ const { values } = parsed.value;
246
+ const path = typeof values.report === 'string' ? values.report : undefined;
247
+ const passed = collectStrings(values.passed);
248
+ const failed = collectStrings(values.failed);
249
+ if (path === undefined) {
295
250
  console.error(USAGE);
296
251
  return 64;
297
252
  }
@@ -300,7 +255,7 @@ export function main(argv) {
300
255
  console.error(`cases: ${both.map(quote).join(', ')} given to both --passed and --failed; ${USAGE}`);
301
256
  return 64;
302
257
  }
303
- if (!existsSync(path) || !statSync(path).isFile()) {
258
+ if (statSync(path, { throwIfNoEntry: false })?.isFile() !== true) {
304
259
  console.error(`cases: ${quote(path)} is not a readable file`);
305
260
  return 2;
306
261
  }