@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.
Files changed (92) 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 +1568 -213
  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 +387 -109
  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 +275 -33
  25. package/dist/bin/main.js.map +1 -1
  26. package/dist/host/AGENTS.md +1 -1
  27. package/dist/host/agents/skills/orkestrel-dispatch/scripts/bench.ts +81 -97
  28. package/dist/host/agents/skills/orkestrel-dispatch/scripts/brief.ts +64 -72
  29. package/dist/host/agents/skills/orkestrel-dispatch/scripts/chain.ts +41 -63
  30. package/dist/host/agents/skills/orkestrel-dispatch/scripts/cite.ts +56 -79
  31. package/dist/host/agents/skills/orkestrel-dispatch/scripts/launch.ts +61 -74
  32. package/dist/host/agents/skills/orkestrel-dispatch/scripts/login.ts +59 -89
  33. package/dist/host/agents/skills/orkestrel-dispatch/scripts/patch.ts +87 -106
  34. package/dist/host/agents/skills/orkestrel-dispatch/scripts/result.ts +57 -76
  35. package/dist/host/agents/skills/orkestrel-dispatch/scripts/sweep.ts +73 -88
  36. package/dist/host/agents/skills/orkestrel-falsify/SKILL.md +2 -2
  37. package/dist/host/agents/skills/orkestrel-falsify/scripts/mutate.ts +167 -119
  38. package/dist/host/agents/skills/orkestrel-harden/references/methods.md +1 -1
  39. package/dist/host/agents/skills/orkestrel-harden/scripts/discovery.ts +58 -75
  40. package/dist/host/agents/skills/orkestrel-harden/scripts/interleave.ts +55 -99
  41. package/dist/host/agents/skills/orkestrel-harden/scripts/measure.ts +59 -90
  42. package/dist/host/agents/skills/orkestrel-harden/scripts/titles.ts +60 -80
  43. package/dist/host/agents/skills/orkestrel-parallel/SKILL.md +4 -4
  44. package/dist/host/agents/skills/orkestrel-parallel/scripts/cases.ts +71 -108
  45. package/dist/host/agents/skills/orkestrel-parallel/scripts/lane.ts +1990 -274
  46. package/dist/host/agents/skills/orkestrel-publish/references/release.md +1 -0
  47. package/dist/host/agents/skills/orkestrel-publish/references/wave.md +28 -7
  48. package/dist/host/agents/skills/orkestrel-publish/scripts/compare.ts +58 -79
  49. package/dist/host/agents/skills/orkestrel-publish/scripts/pins.ts +66 -87
  50. package/dist/host/agents/skills/orkestrel-publish/scripts/steps.ts +84 -102
  51. package/dist/host/agents/skills/orkestrel-publish/scripts/swap.ts +92 -99
  52. package/dist/host/agents/skills/orkestrel-publish/scripts/wave.ts +483 -127
  53. package/dist/host/agents/skills/orkestrel-publish/scripts/window.ts +82 -120
  54. package/dist/host/agents/skills/orkestrel-scout/SKILL.md +3 -3
  55. package/dist/host/agents/skills/orkestrel-scout/scripts/map.ts +85 -112
  56. package/dist/host/claude/agents/orkestrel.md +16 -16
  57. package/dist/host/claude/rules/architecture.md +1 -1
  58. package/dist/host/claude/rules/documentation.md +1 -1
  59. package/dist/host/claude/rules/patterns.md +7 -4
  60. package/dist/host/claude/rules/styles.md +1 -1
  61. package/dist/host/claude/rules/tests.md +3 -3
  62. package/dist/host/claude/rules/workspace.md +50 -37
  63. package/dist/host/configs/helpers.ts +117 -71
  64. package/dist/host/dotfiles/oxlintrc.json +6 -0
  65. package/dist/host/guides/agent.md +989 -395
  66. package/dist/host/guides/database.md +357 -342
  67. package/dist/host/guides/form.md +79 -4
  68. package/dist/host/guides/middleware.md +5 -5
  69. package/dist/host/guides/ollama.md +41 -42
  70. package/dist/host/guides/scaffold.md +170 -70
  71. package/dist/host/guides/study.md +12 -12
  72. package/dist/host/guides/table.md +20 -6
  73. package/dist/host/guides/test.md +166 -52
  74. package/dist/host/guides/toolbox.md +127 -81
  75. package/dist/host/guides/workspace.md +21 -14
  76. package/dist/host/manifest.json +54 -54
  77. package/dist/host/tests/config.test.ts +251 -7
  78. package/dist/host/tests/policy.test.ts +14 -21
  79. package/dist/host/tests/setupPolicy.ts +43 -36
  80. package/dist/src/core/index.cjs +533 -139
  81. package/dist/src/core/index.cjs.map +1 -1
  82. package/dist/src/core/index.d.cts +223 -16
  83. package/dist/src/core/index.d.ts +223 -16
  84. package/dist/src/core/index.js +524 -139
  85. package/dist/src/core/index.js.map +1 -1
  86. package/dist/src/server/index.cjs +23 -14
  87. package/dist/src/server/index.cjs.map +1 -1
  88. package/dist/src/server/index.d.cts +3 -2
  89. package/dist/src/server/index.d.ts +3 -2
  90. package/dist/src/server/index.js +24 -15
  91. package/dist/src/server/index.js.map +1 -1
  92. package/package.json +2 -2
@@ -1,116 +1,72 @@
1
1
  // Check a Vitest JSON report against named red and green cases. Run from the checkout root:
2
2
  // node .agents/skills/orkestrel-parallel/scripts/cases.ts --report FILE.json [--passed NAME ...] [--failed NAME ...]
3
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'
4
+ // `describe` titles and its own title, joined by spaces) or whose own title equals it exactly; give
5
+ // a name that opens with `-` in the `--passed=NAME` form. Each `--passed NAME` requires every case
6
+ // it matches to have passed and each `--failed NAME` requires every one to have failed; a name that
7
+ // matches no case is missing. A failed case that no name matches is refused, so a run that fails
8
+ // more than the request expected reads as a difference. A test file that failed with no failed case
9
+ // (it did not collect, or a hook threw) is an unnamed failure named by its file, and a report whose
10
+ // `success` is false while no case and no file failed is a difference too. Name no case to require
11
+ // a report with no failure. Both flags repeat and a name may not be given to both. The script
12
+ // prints one summary line, one line per difference, and `ok` or `differences=N`. The script reads
13
+ // its flags with `parseArgs` in strict mode. Exit 0 when the report matches the names, 3 when it
14
+ // does not, 2 when the report cannot be read as a Vitest report, 64 on usage.
15
+ import type { ParseArgsOptionsConfig } from 'node:util'
16
+ import { readFileSync, realpathSync, statSync } from 'node:fs'
17
17
  import { relative } from 'node:path'
18
-
19
- /** Lists the flags that take a value. */
20
- export const VALUE_FLAGS: readonly string[] = ['--report', '--passed', '--failed']
21
-
22
- /** Lists every flag the script reads, value flags and switches alike. */
23
- export const FLAGS: readonly string[] = VALUE_FLAGS
18
+ import { parseArgs } from 'node:util'
24
19
 
25
20
  /** Holds the usage line printed when a call names no report. */
26
21
  export const USAGE =
27
22
  'usage: cases.ts --report FILE.json [--passed NAME ...] [--failed NAME ...]; --passed and --failed repeat'
28
23
 
29
- /** Describes one test case a report holds. */
30
- export interface Case {
31
- readonly file: string
32
- readonly fullName: string
33
- readonly title: string
34
- readonly status: string
35
- }
36
-
37
- /**
38
- * Names the value flags a caller gave with no value, at any occurrence.
39
- *
40
- * @param argv - The arguments after the script path.
41
- * @param names - The flags that take a value.
42
- * @returns Each named flag that appears last or is followed by another flag, in argument order.
43
- */
44
- export function readMissingFlags(
45
- argv: readonly string[],
46
- names: readonly string[],
47
- ): readonly string[] {
48
- return names.filter((name) =>
49
- argv.some((argument, index) => argument === name && isMissingValue(argv, index)),
50
- )
51
- }
24
+ /** Declares every flag the script reads, for `parseArgs`. */
25
+ export const OPTIONS: ParseArgsOptionsConfig = Object.freeze({
26
+ report: Object.freeze({ type: 'string' }),
27
+ passed: Object.freeze({ type: 'string', multiple: true }),
28
+ failed: Object.freeze({ type: 'string', multiple: true }),
29
+ })
52
30
 
53
- /**
54
- * Checks whether the argument after a flag is absent or is another flag.
55
- *
56
- * @param argv - The arguments after the script path.
57
- * @param index - The position of the flag.
58
- * @returns True when no value follows the flag; false otherwise.
59
- */
60
- export function isMissingValue(argv: readonly string[], index: number): boolean {
61
- const value = argv[index + 1]
62
- return value === undefined || value.startsWith('--')
31
+ /** Describes the arguments `parseArgs` read: each flag's value by name, and the positionals. */
32
+ export interface Arguments {
33
+ readonly values: Readonly<
34
+ Record<string, string | boolean | ReadonlyArray<string | boolean> | undefined>
35
+ >
36
+ readonly positionals: readonly string[]
63
37
  }
64
38
 
65
- /**
66
- * Names the flags a caller gave that the script does not read.
67
- *
68
- * @remarks
69
- * A `--flag=value` argument is unknown, because the script reads no such form. A bare `--` ends the
70
- * scan.
71
- *
72
- * @param argv - The arguments after the script path.
73
- * @param flags - Every flag the script reads, value flags and switches alike.
74
- * @returns Each argument that opens with `--` and is not a read flag, in argument order.
75
- */
76
- export function readUnknownFlags(
77
- argv: readonly string[],
78
- flags: readonly string[],
79
- ): readonly string[] {
80
- const end = argv.indexOf('--')
81
- return (end === -1 ? argv : argv.slice(0, end)).filter(
82
- (argument) => argument.startsWith('--') && !flags.includes(argument),
83
- )
84
- }
39
+ /** Describes how `parseArgs` read the arguments: the arguments, or the message it refused them with. */
40
+ export type ArgumentsResult =
41
+ | { readonly success: true; readonly value: Arguments }
42
+ | { readonly success: false; readonly error: string }
85
43
 
86
44
  /**
87
- * Reads every value that follows a repeatable flag.
45
+ * Parses the arguments in strict mode against `OPTIONS`.
88
46
  *
89
47
  * @param argv - The arguments after the script path.
90
- * @param name - The flag, such as `--passed`.
91
- * @returns The values in order, empty when the flag never appears.
48
+ * @returns The values and positionals, or the message `parseArgs` refused the arguments with.
92
49
  */
93
- export function readOptions(argv: readonly string[], name: string): readonly string[] {
94
- return argv.flatMap((argument, index) => {
95
- const value = argv[index + 1]
96
- return argument === name && value !== undefined && !value.startsWith('--') ? [value] : []
97
- })
50
+ export function parseArguments(argv: readonly string[]): ArgumentsResult {
51
+ try {
52
+ const { values, positionals } = parseArgs({
53
+ args: [...argv],
54
+ options: OPTIONS,
55
+ strict: true,
56
+ allowPositionals: false,
57
+ })
58
+ return { success: true, value: { values, positionals } }
59
+ } catch (error) {
60
+ return { success: false, error: error instanceof Error ? error.message : String(error) }
61
+ }
98
62
  }
99
63
 
100
- /**
101
- * Reads the arguments that are neither a flag nor the value of a value flag.
102
- *
103
- * @param argv - The arguments after the script path.
104
- * @param valueFlags - The flags that take a value.
105
- * @returns The positional arguments in order.
106
- */
107
- export function readPositionals(
108
- argv: readonly string[],
109
- valueFlags: readonly string[],
110
- ): readonly string[] {
111
- return argv.filter(
112
- (argument, index) => !argument.startsWith('--') && !valueFlags.includes(argv[index - 1] ?? ''),
113
- )
64
+ /** Describes one test case a report holds. */
65
+ export interface Case {
66
+ readonly file: string
67
+ readonly fullName: string
68
+ readonly title: string
69
+ readonly status: string
114
70
  }
115
71
 
116
72
  /**
@@ -325,6 +281,18 @@ export function readReport(path: string): unknown {
325
281
  }
326
282
  }
327
283
 
284
+ /**
285
+ * Collects the strings a repeatable flag's value holds.
286
+ *
287
+ * @param value - The value `parseArgs` read for a flag declared with `multiple: true`.
288
+ * @returns Each string in order, empty when the flag never appears.
289
+ */
290
+ export function collectStrings(value: unknown): readonly string[] {
291
+ return Array.isArray(value)
292
+ ? value.filter((member): member is string => typeof member === 'string')
293
+ : []
294
+ }
295
+
328
296
  /**
329
297
  * Runs the script on its arguments.
330
298
  *
@@ -333,21 +301,16 @@ export function readReport(path: string): unknown {
333
301
  * cannot be read as a Vitest report, 64 on usage.
334
302
  */
335
303
  export function main(argv: readonly string[]): number {
336
- const unknown = readUnknownFlags(argv, FLAGS)
337
- if (unknown.length > 0) {
338
- console.error(`cases: ${unknown.join(', ')} is not a flag this script reads; ${USAGE}`)
339
- return 64
340
- }
341
- const missing = readMissingFlags(argv, VALUE_FLAGS)
342
- if (missing.length > 0) {
343
- console.error(`cases: ${missing.join(', ')} given with no value`)
304
+ const parsed = parseArguments(argv)
305
+ if (!parsed.success) {
306
+ console.error(`cases: ${parsed.error}; ${USAGE}`)
344
307
  return 64
345
308
  }
346
- const reports = readOptions(argv, '--report')
347
- const path = reports[0]
348
- const passed = readOptions(argv, '--passed')
349
- const failed = readOptions(argv, '--failed')
350
- if (path === undefined || readPositionals(argv, VALUE_FLAGS).length > 0) {
309
+ const { values } = parsed.value
310
+ const path = typeof values.report === 'string' ? values.report : undefined
311
+ const passed = collectStrings(values.passed)
312
+ const failed = collectStrings(values.failed)
313
+ if (path === undefined) {
351
314
  console.error(USAGE)
352
315
  return 64
353
316
  }
@@ -358,7 +321,7 @@ export function main(argv: readonly string[]): number {
358
321
  )
359
322
  return 64
360
323
  }
361
- if (!existsSync(path) || !statSync(path).isFile()) {
324
+ if (statSync(path, { throwIfNoEntry: false })?.isFile() !== true) {
362
325
  console.error(`cases: ${quote(path)} is not a readable file`)
363
326
  return 2
364
327
  }