@orkestrel/scaffold 0.0.137 → 0.0.139

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 (33) hide show
  1. package/dist/agents/skills/orkestrel-parallel/scripts/lane.js +489 -23
  2. package/dist/bin/main.js +6 -6
  3. package/dist/host/agents/skills/orkestrel-journey/SKILL.md +33 -27
  4. package/dist/host/agents/skills/orkestrel-journey/references/captures.md +37 -16
  5. package/dist/host/agents/skills/orkestrel-parallel/SKILL.md +1 -1
  6. package/dist/host/agents/skills/orkestrel-parallel/scripts/lane.ts +628 -41
  7. package/dist/host/agents/skills/orkestrel-polish/references/capture-harness.md +5 -0
  8. package/dist/host/claude/agents/orkestrel.md +54 -54
  9. package/dist/host/claude/rules/typescript.md +4 -1
  10. package/dist/host/claude/rules/workspace.md +6 -4
  11. package/dist/host/guides/capture.md +442 -313
  12. package/dist/host/guides/contract.md +314 -210
  13. package/dist/host/guides/middleware.md +489 -259
  14. package/dist/host/guides/process.md +139 -53
  15. package/dist/host/guides/router.md +282 -165
  16. package/dist/host/guides/scaffold.md +35 -23
  17. package/dist/host/guides/server.md +417 -181
  18. package/dist/host/guides/test.md +353 -232
  19. package/dist/host/manifest.json +18 -18
  20. package/dist/host/scripts/browsers.sh +0 -0
  21. package/dist/host/scripts/codex.sh +0 -0
  22. package/dist/host/scripts/cursor.sh +0 -0
  23. package/dist/host/scripts/deps.sh +0 -0
  24. package/dist/host/scripts/npm.sh +0 -0
  25. package/dist/host/scripts/ollama.sh +0 -0
  26. package/dist/host/tests/config.test.ts +19 -27
  27. package/dist/src/core/index.cjs +139 -60
  28. package/dist/src/core/index.cjs.map +1 -1
  29. package/dist/src/core/index.d.cts +1 -1
  30. package/dist/src/core/index.d.ts +1 -1
  31. package/dist/src/core/index.js +139 -60
  32. package/dist/src/core/index.js.map +1 -1
  33. package/package.json +6 -6
@@ -346,7 +346,7 @@
346
346
  "storage": "agents/skills/orkestrel-journey/SKILL.md",
347
347
  "destination": ".agents/skills/orkestrel-journey/SKILL.md",
348
348
  "executable": false,
349
- "digest": "a94ef36f33c3bb1ddfbdcddded2995160d8c4b03e33ba768cce7f36e50bf73e9"
349
+ "digest": "80b4a58b50b070fa6083fe3ff4ca14ef8d22f202c15f1c0ce2be75905993c4b6"
350
350
  },
351
351
  {
352
352
  "storage": "agents/skills/orkestrel-journey/agents/openai.yaml",
@@ -358,7 +358,7 @@
358
358
  "storage": "agents/skills/orkestrel-journey/references/captures.md",
359
359
  "destination": ".agents/skills/orkestrel-journey/references/captures.md",
360
360
  "executable": false,
361
- "digest": "5bddf8e88c0dc11626ee9a24322f961969a5138ea747667759b04983e19f2e91"
361
+ "digest": "87f87c8532871867948a3b45ec3717b835cbca168e36d82392e7760311d210c3"
362
362
  },
363
363
  {
364
364
  "storage": "agents/skills/orkestrel-journey/references/decide.md",
@@ -394,7 +394,7 @@
394
394
  "storage": "agents/skills/orkestrel-parallel/SKILL.md",
395
395
  "destination": ".agents/skills/orkestrel-parallel/SKILL.md",
396
396
  "executable": false,
397
- "digest": "e2c6ec215b9a206cdbc2ca74b60fa746c930bc361998b5a4d0d2ae8fe284144f"
397
+ "digest": "2b90fea9cb006e4a7bfc9e7da00940d2366ba8ab25de382aefbe2a23ae79c46b"
398
398
  },
399
399
  {
400
400
  "storage": "agents/skills/orkestrel-parallel/agents/openai.yaml",
@@ -442,7 +442,7 @@
442
442
  "storage": "agents/skills/orkestrel-parallel/scripts/lane.ts",
443
443
  "destination": ".agents/skills/orkestrel-parallel/scripts/lane.ts",
444
444
  "executable": false,
445
- "digest": "b5ed16532f3f6e010ce9f37c377c622aa3cddef1b61516597e08c5ad0c38545c"
445
+ "digest": "257108796b183e5ce3f0a6bcea179662562e812e6403d23e4231dc2b16fdd592"
446
446
  },
447
447
  {
448
448
  "storage": "agents/skills/orkestrel-polish/SKILL.md",
@@ -460,7 +460,7 @@
460
460
  "storage": "agents/skills/orkestrel-polish/references/capture-harness.md",
461
461
  "destination": ".agents/skills/orkestrel-polish/references/capture-harness.md",
462
462
  "executable": false,
463
- "digest": "e6a6149fd9e85abbc6f3976ec0daf7d590b02226f3bb8619d4d46e5a5c6909e6"
463
+ "digest": "9e6dda1a3be870271723863f180a9fd5933953ea35c9a92524905766af25b828"
464
464
  },
465
465
  {
466
466
  "storage": "agents/skills/orkestrel-publish/SKILL.md",
@@ -628,7 +628,7 @@
628
628
  "storage": "claude/agents/orkestrel.md",
629
629
  "destination": ".claude/agents/orkestrel.md",
630
630
  "executable": false,
631
- "digest": "888f199f9b5ba273e554f1db961c45e3325c45284bb432065d07ea52dd3663b2"
631
+ "digest": "b29b5a278e6c9d64603cdcf794ec6ef04ca1c769d6f7c1b1604905b7a646941e"
632
632
  },
633
633
  {
634
634
  "storage": "claude/agents/planner.md",
@@ -730,13 +730,13 @@
730
730
  "storage": "claude/rules/typescript.md",
731
731
  "destination": ".claude/rules/typescript.md",
732
732
  "executable": false,
733
- "digest": "86f52e4c081b4b26b7b10006e6b87d242b14afb8411ef19959c2bb35345917d6"
733
+ "digest": "25ed2168c556f5addf446731424395aa91d8eb7b0eb92b6edef7cff9651a6570"
734
734
  },
735
735
  {
736
736
  "storage": "claude/rules/workspace.md",
737
737
  "destination": ".claude/rules/workspace.md",
738
738
  "executable": false,
739
- "digest": "7124c162e3f6bf56d57dd0dcdc1dca1cf0beab8d292a653d615230a3cd500f62"
739
+ "digest": "a6cb8abb75e63dfd7ea26b502f9aec6a9c80205e1c44c336c1c8cc6c540dd375"
740
740
  },
741
741
  {
742
742
  "storage": "claude/rules/writing.md",
@@ -1018,7 +1018,7 @@
1018
1018
  "storage": "guides/capture.md",
1019
1019
  "destination": "guides/capture.md",
1020
1020
  "executable": false,
1021
- "digest": "07c53b0e17c49a01d9d71546bebf0890f3d340f6cb3a86f8c99a7eafe8edb2bf"
1021
+ "digest": "aa14ae83360a535e25d30356b5b8500ec0a7538b23726079cbd1a60a8479be06"
1022
1022
  },
1023
1023
  {
1024
1024
  "storage": "guides/codec.md",
@@ -1036,7 +1036,7 @@
1036
1036
  "storage": "guides/contract.md",
1037
1037
  "destination": "guides/contract.md",
1038
1038
  "executable": false,
1039
- "digest": "99a5bba7aea85328bde9be5e29b709d20349a23ed0cb471d97b3a37b6f851d5c"
1039
+ "digest": "2a14e9259b37afdf0640ba85db631edcd724ef30980fb0bd578ba6fbf4c5b0a3"
1040
1040
  },
1041
1041
  {
1042
1042
  "storage": "guides/csv.md",
@@ -1114,7 +1114,7 @@
1114
1114
  "storage": "guides/middleware.md",
1115
1115
  "destination": "guides/middleware.md",
1116
1116
  "executable": false,
1117
- "digest": "e378a2a8e1f1f1d2e48b06f7e683b10267f2abeba8e062bd98d6c6a743777ceb"
1117
+ "digest": "d3a06d7904ebff0c028443c59d5b8a223a9c9c0aedb854fc2a03f7e3c078d3bb"
1118
1118
  },
1119
1119
  {
1120
1120
  "storage": "guides/msg.md",
@@ -1150,7 +1150,7 @@
1150
1150
  "storage": "guides/process.md",
1151
1151
  "destination": "guides/process.md",
1152
1152
  "executable": false,
1153
- "digest": "dda5485fcbb3f1e8d661c5a6d72d8eb44446fcf4a359942d216756098cf7838d"
1153
+ "digest": "a3271f4fae8bed6c35e3a3b66c7d657d4f86dcd22ea06c8e9448cb6c79a0b676"
1154
1154
  },
1155
1155
  {
1156
1156
  "storage": "guides/program.md",
@@ -1192,13 +1192,13 @@
1192
1192
  "storage": "guides/router.md",
1193
1193
  "destination": "guides/router.md",
1194
1194
  "executable": false,
1195
- "digest": "527ef0697269eaf2c362cdb1316e28fcedb5bd932ceb30106d1287b8832ae5ad"
1195
+ "digest": "14cb506ed9bbdbf9dd24ccecfcae9a393c9a52eabd15fd07d78e8c70383d6fbb"
1196
1196
  },
1197
1197
  {
1198
1198
  "storage": "guides/scaffold.md",
1199
1199
  "destination": "guides/scaffold.md",
1200
1200
  "executable": false,
1201
- "digest": "b01fb8c25003a490b54617012fd83fc31b41cfa0d8c62ac69fd00c9d4178eecc"
1201
+ "digest": "caabb0824320128d41b44dd5f7c9eaa444da900f402f03b8c8287b70682eb468"
1202
1202
  },
1203
1203
  {
1204
1204
  "storage": "guides/sea.md",
@@ -1210,7 +1210,7 @@
1210
1210
  "storage": "guides/server.md",
1211
1211
  "destination": "guides/server.md",
1212
1212
  "executable": false,
1213
- "digest": "6440fb22098f41afa0ddbeafd0966696f88d9d57df9cadac1b7a8779fc039ce4"
1213
+ "digest": "be54eea16d4c1ba9f1d56e193362d0137bc93bbd624096b68af29db90bfeabff"
1214
1214
  },
1215
1215
  {
1216
1216
  "storage": "guides/sqlite.md",
@@ -1252,7 +1252,7 @@
1252
1252
  "storage": "guides/test.md",
1253
1253
  "destination": "guides/test.md",
1254
1254
  "executable": false,
1255
- "digest": "4d98bccf675ca5d0a35c91a6a4b0368c7931e271a276227f094a8a9051654c84"
1255
+ "digest": "25654abd6d15895a4298d49159dc775272dd2d93e02f76bbced6c89fb9bfd061"
1256
1256
  },
1257
1257
  {
1258
1258
  "storage": "guides/timeout.md",
@@ -1336,7 +1336,7 @@
1336
1336
  "storage": "tests/config.test.ts",
1337
1337
  "destination": "tests/config.test.ts",
1338
1338
  "executable": false,
1339
- "digest": "6654cb7240a0d3b2ce29344699a248f81ef9d7634e04b16d63b7be3ecdf98487"
1339
+ "digest": "2fdde0aa178e50cf03838ecd3516a58ca642dbb8c2fc59ddc2cf54be0a3b1a42"
1340
1340
  },
1341
1341
  {
1342
1342
  "storage": "tests/policy.test.ts",
@@ -1417,5 +1417,5 @@
1417
1417
  "scripts"
1418
1418
  ],
1419
1419
  "surface": [],
1420
- "digest": "81c6ca1d8161422d27bf430a38f65129cea8d35333a3f62bcfe167f6f8f66f4a"
1420
+ "digest": "e7ef07eee354d8f155640d7f012d1c538be5579b3d131e925b634e5940bba7b8"
1421
1421
  }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -451,12 +451,14 @@ describe('selected faces', () => {
451
451
  loaded.config.test.projects.length === 0
452
452
  )
453
453
  throw new Error('Missing journey projects')
454
- // Each awaited factory appends the variant it provides and the variants it declares.
454
+ // Each project appends the variant it provides and the variants it declares. The capture
455
+ // wrapper factory returns each project as configuration; a project factory is awaited.
455
456
  const provided: Array<{ readonly variant: string; readonly names: readonly string[] }> = []
456
- for (const factory of loaded.config.test.projects) {
457
- if (typeof factory !== 'function') throw new Error('Missing journey factory')
457
+ for (const entry of loaded.config.test.projects) {
458
458
  const project = readConfigRecord(
459
- await Reflect.apply(factory, undefined, [{ command: 'serve', mode: application }]),
459
+ typeof entry === 'function'
460
+ ? await Reflect.apply(entry, undefined, [{ command: 'serve', mode: application }])
461
+ : entry,
460
462
  )
461
463
  const test = readConfigRecord(project.test)
462
464
  expect(test.include).toEqual([`tests/app/${application}/integration.test.ts`])
@@ -525,17 +527,12 @@ describe('selected faces', () => {
525
527
  if (!Array.isArray(projects) || projects.length === 0)
526
528
  throw new Error('Missing journey projects')
527
529
  for (const project of projects) {
528
- if (typeof project !== 'function') throw new Error('Missing journey factory')
530
+ const resolved: unknown =
531
+ typeof project === 'function'
532
+ ? await Reflect.apply(project, undefined, [{ command: 'serve', mode: application }])
533
+ : project
529
534
  const held = readConfigRecord(
530
- readConfigRecord(
531
- readConfigRecord(
532
- readConfigRecord(
533
- await Reflect.apply(project, undefined, [
534
- { command: 'serve', mode: application },
535
- ]),
536
- ).test,
537
- ).browser,
538
- ).commands,
535
+ readConfigRecord(readConfigRecord(readConfigRecord(resolved).test).browser).commands,
539
536
  )
540
537
  for (const commands of registered) {
541
538
  for (const [key, command] of Object.entries(commands)) expect(held[key]).toBe(command)
@@ -546,23 +543,19 @@ describe('selected faces', () => {
546
543
  const factory = factories.appJourney
547
544
  if (typeof factory !== 'function') throw new Error('Missing application journey')
548
545
  expect(() =>
549
- Reflect.apply(factory, undefined, [
550
- { name: 'desktop', width: 1280, height: 800 },
551
- [],
552
- 'absent',
553
- ]),
546
+ Reflect.apply(factory, undefined, [{ name: 'desktop', width: 1280, height: 800 }, 'absent']),
554
547
  ).toThrow('not declared')
555
548
  // The record names an application exactly when its exact-case entry exists.
556
549
  const variant = { name: 'desktop', width: 1280, height: 800 }
557
550
  for (const application of applications) {
558
551
  expect(
559
552
  readConfigRecord(
560
- readConfigRecord(Reflect.apply(factory, undefined, [variant, [], application])).test,
553
+ readConfigRecord(Reflect.apply(factory, undefined, [variant, application])).test,
561
554
  ).include,
562
555
  ).toStrictEqual([`tests/app/${application}/integration.test.ts`])
563
556
  }
564
557
  for (const application of candidates.filter((name) => !applications.includes(name))) {
565
- expect(() => Reflect.apply(factory, undefined, [variant, [], application])).toThrow(
558
+ expect(() => Reflect.apply(factory, undefined, [variant, application])).toThrow(
566
559
  'not declared',
567
560
  )
568
561
  }
@@ -1291,12 +1284,11 @@ describe('root configuration', () => {
1291
1284
  throw new Error(`${wrapper} carries no journey projects`)
1292
1285
  }
1293
1286
  const tests: object[] = []
1294
- for (const factory of projects) {
1295
- if (typeof factory !== 'function')
1296
- throw new Error(`${wrapper} carries no project factory`)
1297
- const project: unknown = await Reflect.apply(factory, undefined, [
1298
- { command: 'serve', mode },
1299
- ])
1287
+ for (const entry of projects) {
1288
+ const project: unknown =
1289
+ typeof entry === 'function'
1290
+ ? await Reflect.apply(entry, undefined, [{ command: 'serve', mode }])
1291
+ : entry
1300
1292
  if (typeof project !== 'object' || project === null)
1301
1293
  throw new Error('A journey project is not a configuration')
1302
1294
  const test: unknown = Object.getOwnPropertyDescriptor(project, 'test')?.value
@@ -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.137",
7
+ version: "0.0.139",
8
8
  description: "Scaffold workspaces with commands: new, audit, surface, repair, catalog, and overwrite.",
9
9
  keywords: [
10
10
  "audit",
@@ -97,10 +97,10 @@ var package_default = {
97
97
  },
98
98
  dependencies: {
99
99
  "@orkestrel/console": "^0.0.21",
100
- "@orkestrel/contract": "^0.0.24",
100
+ "@orkestrel/contract": "^0.0.26",
101
101
  "@orkestrel/emitter": "^0.0.17",
102
102
  "@orkestrel/markdown": "^0.0.22",
103
- "@orkestrel/process": "^0.0.20",
103
+ "@orkestrel/process": "^0.0.21",
104
104
  "@orkestrel/template": "^0.0.15"
105
105
  },
106
106
  devDependencies: {
@@ -109,11 +109,11 @@ var package_default = {
109
109
  "@orkestrel/guide": "^0.0.32",
110
110
  "@orkestrel/html": "^0.0.17",
111
111
  "@orkestrel/probe": "^0.0.31",
112
- "@orkestrel/test": "^0.0.40",
112
+ "@orkestrel/test": "^0.0.43",
113
113
  "@types/node": "^24.19.2",
114
114
  "@vitest/browser-playwright": "^5.1.0",
115
- "oxfmt": "^0.78.0",
116
- "oxlint": "^1.93.0",
115
+ "oxfmt": "^0.79.0",
116
+ "oxlint": "^1.94.0",
117
117
  "playwright": "^1.64.1",
118
118
  "typescript": "^7.0.2",
119
119
  "vite": "^8.3.8",
@@ -796,10 +796,10 @@ var BROWSE_DEV_DEPENDENCIES = Object.freeze({ "@orkestrel/browser": package_defa
796
796
  * ```ts
797
797
  * import { CAPTURE_DEV_DEPENDENCIES } from '@orkestrel/scaffold'
798
798
  *
799
- * CAPTURE_DEV_DEPENDENCIES['@orkestrel/capture'] // '^0.0.5'
799
+ * CAPTURE_DEV_DEPENDENCIES['@orkestrel/capture'] // '^0.0.10'
800
800
  * ```
801
801
  */
802
- var CAPTURE_DEV_DEPENDENCIES = Object.freeze({ "@orkestrel/capture": "^0.0.5" });
802
+ var CAPTURE_DEV_DEPENDENCIES = Object.freeze({ "@orkestrel/capture": "^0.0.10" });
803
803
  /**
804
804
  * Lists the Orkestrel packages that publish a `/browser` entry, frozen.
805
805
  *
@@ -848,6 +848,7 @@ var CAPTURE_UPSTREAM = Object.freeze([
848
848
  "@orkestrel/contract",
849
849
  "@orkestrel/emitter",
850
850
  "@orkestrel/process",
851
+ "@orkestrel/test",
851
852
  "@orkestrel/timeout"
852
853
  ]);
853
854
  /**
@@ -1409,7 +1410,6 @@ export function srcBin(override?: UserConfig): UserConfig {
1409
1410
  // and retain the exclusion of the journey suite.
1410
1411
  export function appJourney(
1411
1412
  variant: JourneyVariant,
1412
- variants: readonly JourneyVariant[],
1413
1413
  mode?: string,
1414
1414
  override?: UserConfig,
1415
1415
  ): UserConfig {
@@ -1422,7 +1422,6 @@ export function appJourney(
1422
1422
  name: { label: \`journey:\${variant.name}\`, color: 'green' },
1423
1423
  include: [\`tests/app/\${application}/integration.test.ts\`],
1424
1424
  exclude: [],
1425
- provide: { variant: variant.name, variants, capture },
1426
1425
  browser: {
1427
1426
  ...browser.test?.browser,
1428
1427
  enabled: true,
@@ -2222,6 +2221,7 @@ import { appShowcase } from '../../vite.config.ts'
2222
2221
  export default defineConfig(({ mode }) => appShowcase(mode))
2223
2222
  `,
2224
2223
  journey: `import type { JourneyVariant } from '@orkestrel/test'
2224
+ import { buildCaptureWrapper } from '@orkestrel/capture/server'
2225
2225
  import { defineConfig } from 'vitest/config'
2226
2226
  import { appJourney } from '../../vite.config.ts'
2227
2227
 
@@ -2231,11 +2231,24 @@ const VARIANTS: readonly JourneyVariant[] = Object.freeze([
2231
2231
  { name: 'compact', width: 390, height: 844 },
2232
2232
  ])
2233
2233
 
2234
- export default defineConfig(({ mode }) => ({
2235
- test: {
2236
- projects: VARIANTS.map((variant) => () => appJourney(variant, VARIANTS, mode)),
2237
- },
2238
- }))
2234
+ // Declare every owner path a journey case carries; the seeded arrival journey owns pages:arrival.
2235
+ export default defineConfig(({ mode }) =>
2236
+ buildCaptureWrapper({
2237
+ url: import.meta.url,
2238
+ variants: VARIANTS,
2239
+ owners: ['pages:arrival'],
2240
+ first: 'desktop',
2241
+ final: 'closes the run',
2242
+ directory: 'tmp/captures/states',
2243
+ inputs: ['app/**', 'src/**', 'configs/**', 'tests/**', 'vite.config.ts', 'package-lock.json'],
2244
+ sources: {
2245
+ shared: ['configs/**', 'tests/setup*.ts', 'vite.config.ts', 'package-lock.json'],
2246
+ tests: ['tests/app/**'],
2247
+ },
2248
+ portfolios: [{ portfolio: 'states', directory: 'tmp/captures/states', scoped: true }],
2249
+ project: (variant, override) => appJourney(variant, mode, override),
2250
+ }),
2251
+ )
2239
2252
  `
2240
2253
  })
2241
2254
  }),
@@ -2644,7 +2657,16 @@ createApp(App).mount(document.body.appendChild(document.createElement('main')))
2644
2657
  `
2645
2658
  }),
2646
2659
  tests: Object.freeze({
2647
- journey: `import {
2660
+ journey: `import type { CaptureRules } from '@orkestrel/capture'
2661
+ import {
2662
+ buildCaptureDestinations,
2663
+ buildCaptureRun,
2664
+ buildCaptureTags,
2665
+ buildCaptureTest,
2666
+ collectCaptureCases,
2667
+ renderCaptureArtifact,
2668
+ } from '@orkestrel/capture'
2669
+ import {
2648
2670
  ACCESSIBLE_ROLES,
2649
2671
  createPortfolio,
2650
2672
  expandCaptures,
@@ -2652,26 +2674,42 @@ createApp(App).mount(document.body.appendChild(document.createElement('main')))
2652
2674
  readRefusal,
2653
2675
  readStyle,
2654
2676
  } from '@orkestrel/test/browser'
2655
- {{imports}}import { page } from 'vitest/browser'
2677
+ {{imports}}import { page, server } from 'vitest/browser'
2656
2678
  import { describe, expect, inject, it } from 'vitest'
2657
2679
 
2658
2680
  const VARIANT = inject('variant')
2659
2681
  const VARIANTS = inject('variants')
2660
2682
  const CAPTURE = inject('capture')
2683
+ const REQUEST = inject('request')
2684
+ const RECORD = inject('record')
2685
+ const STATES = ['{{application}}-arrival']
2686
+ const RULES: CaptureRules = {
2687
+ owners: ['pages:arrival'],
2688
+ part: (state) => {
2689
+ if (!STATES.includes(state)) throw new Error(\`Undeclared capture state: \${state}\`)
2690
+ return 'pages:arrival'
2691
+ },
2692
+ sources: () => ({ own: ['app/{{application}}/**'], ...inject('sources') }),
2693
+ }
2694
+ const ARRIVAL = buildCaptureTest(
2695
+ { owner: 'pages:arrival', states: STATES, variant: VARIANT },
2696
+ RULES,
2697
+ )
2698
+ const FINAL = { tags: [...buildCaptureTags(RULES.owners)] }
2699
+ const PORTFOLIO = createPortfolio({
2700
+ states: STATES,
2701
+ variants: VARIANTS,
2702
+ variant: VARIANT,
2703
+ directory: '../../../tmp/captures/states',
2704
+ scope: () => 'pages',
2705
+ enabled: CAPTURE,
2706
+ ...(REQUEST?.state === undefined ? {} : { state: REQUEST.state }),
2707
+ })
2661
2708
 
2662
2709
  describe('{{application}} arrival journey', () => {
2663
- it('proves the declared arrival families', async () => {
2710
+ it('proves the declared arrival families', ARRIVAL, async () => {
2664
2711
  const families = ['Journey', 'Refusal', 'Matrix', ...(CAPTURE ? ['Capture'] : [])]
2665
2712
  const proven: string[] = []
2666
- const states = ['{{application}}-arrival']
2667
- const placed: string[] = []
2668
- const portfolio = createPortfolio({
2669
- states,
2670
- variants: VARIANTS,
2671
- variant: VARIANT,
2672
- directory: '../../../tmp/captures/states',
2673
- enabled: CAPTURE,
2674
- })
2675
2713
  {{mount}} try {
2676
2714
  {{arrival}} const heading = page
2677
2715
  .getByRole('heading', {
@@ -2682,8 +2720,7 @@ describe('{{application}} arrival journey', () => {
2682
2720
  .element()
2683
2721
  expect(isRendered(heading)).toBe(true)
2684
2722
  proven.push('Journey')
2685
- await portfolio.place('{{application}}-arrival')
2686
- placed.push('{{application}}-arrival')
2723
+ await PORTFOLIO.place('{{application}}-arrival')
2687
2724
 
2688
2725
  for (const role of ACCESSIBLE_ROLES) expect(page.getByRole(role).elements()).toEqual([])
2689
2726
  expect(readRefusal('Continue')).toBe(
@@ -2701,19 +2738,22 @@ describe('{{application}} arrival journey', () => {
2701
2738
  expect(measured).toEqual(VARIANTS.map(({ name }) => name))
2702
2739
  proven.push('Matrix')
2703
2740
 
2704
- const files = expandCaptures(states, VARIANTS)
2705
- expect(portfolio.files).toEqual(files)
2706
- expect(new Set(files).size).toBe(states.length * VARIANTS.length)
2707
- expect(placed).toEqual(states)
2741
+ const files = expandCaptures(STATES, VARIANTS, () => 'pages')
2742
+ expect(PORTFOLIO.files).toEqual(files)
2743
+ expect(new Set(files).size).toBe(STATES.length * VARIANTS.length)
2744
+ expect(PORTFOLIO.observed).toEqual(STATES)
2708
2745
  const expected = CAPTURE
2709
2746
  ? expandCaptures(
2710
- states,
2747
+ STATES,
2711
2748
  VARIANTS.filter(({ name }) => name === VARIANT),
2749
+ () => 'pages',
2712
2750
  )
2713
2751
  : []
2714
- expect(portfolio.paths.map((path) => path.replaceAll('\\\\', '/').split('/').at(-1))).toEqual(
2715
- expected,
2716
- )
2752
+ expect(
2753
+ (await server.commands.readCaptureFrames()).filter((file) =>
2754
+ file.endsWith(\`--\${VARIANT}.png\`),
2755
+ ),
2756
+ ).toEqual(expected)
2717
2757
  if (CAPTURE) proven.push('Capture')
2718
2758
  expect(proven).toEqual(families)
2719
2759
  } finally {
@@ -2722,14 +2762,53 @@ describe('{{application}} arrival journey', () => {
2722
2762
  }
2723
2763
  })
2724
2764
  })
2765
+
2766
+ it('closes the run', FINAL, async (context) => {
2767
+ const cases = collectCaptureCases(context.task.file)
2768
+ const run = buildCaptureRun({
2769
+ cases,
2770
+ registry: buildCaptureDestinations(cases, RULES, {
2771
+ project: \`journey:\${VARIANT}\`,
2772
+ portfolios: inject('portfolios').map((root) => ({
2773
+ ...root,
2774
+ variant: VARIANT,
2775
+ states: STATES,
2776
+ })),
2777
+ }),
2778
+ observed: PORTFOLIO.observed,
2779
+ emitted: [...PORTFOLIO.placements.entries()].flatMap(([index, state]) => {
2780
+ const path = PORTFOLIO.paths[index]
2781
+ return path === undefined ? [] : [[state, path] as const]
2782
+ }),
2783
+ variant: VARIANT,
2784
+ time: new Date().toISOString(),
2785
+ ...(REQUEST === undefined ? {} : { request: REQUEST }),
2786
+ })
2787
+ const stem = RECORD.slice('tmp/captures/states/'.length).replace(/\\.json$/u, '')
2788
+ const artifact = \`tmp/journey/\${stem}.txt\`
2789
+ const text = [...renderCaptureArtifact(RECORD, run), ''].join('\\n')
2790
+ const digest = Array.from(
2791
+ new Uint8Array(await crypto.subtle.digest('SHA-256', new TextEncoder().encode(text))),
2792
+ (byte) => byte.toString(16).padStart(2, '0'),
2793
+ ).join('')
2794
+ await server.commands.writeFile(artifact, text)
2795
+ await server.commands.writeFile(
2796
+ RECORD,
2797
+ JSON.stringify({ ...run, artifact: { file: artifact, digest } }),
2798
+ )
2799
+ expect(run.passed).not.toEqual([])
2800
+ })
2725
2801
  `,
2726
- browser: `import type { JourneyVariant } from '@orkestrel/test'
2802
+ browser: `import type { CaptureMeta, CaptureProvided } from '@orkestrel/capture'
2727
2803
 
2728
2804
  declare module 'vitest' {
2729
- export interface ProvidedContext {
2730
- readonly variant: string
2731
- readonly variants: readonly JourneyVariant[]
2732
- readonly capture: boolean
2805
+ export interface ProvidedContext extends CaptureProvided {}
2806
+ export interface TaskMeta extends CaptureMeta {}
2807
+ }
2808
+
2809
+ declare module 'vitest/browser' {
2810
+ export interface BrowserCommands {
2811
+ readonly readCaptureFrames: () => Promise<readonly string[]>
2733
2812
  }
2734
2813
  }
2735
2814
  `,
@@ -8260,7 +8339,7 @@ ${projects.map((project) => `\t\t\t${project},`).join("\n")}
8260
8339
  vitest: benches.length === 0 ? "" : "defaultExclude, ",
8261
8340
  helpers: helpers.length === 0 ? "" : matchesPrintWidth(helperImport.trimEnd()) ? helperImport : `import {\n${helpers.map((helper) => `\t${helper},`).join("\n")}\n} from './configs/helpers.js'\n`,
8262
8341
  browsers: machinery.browser ? "import { resolveBrowser, resolvePinnedBrowser } from './configs/browsers.js'\nimport { commands } from './configs/commands.js'\n" : "",
8263
- options: (machinery.browser ? "const browserOptions = resolveBrowser(resolvePinnedBrowser(), process.platform, process.env)\n// Vitest writes a page.screenshot() capture beside its test file unless a directory is named.\nconst screenshots = resolveWorkspacePath('tmp/captures/screenshots')\n\n" + blueprintToOptimizedDependencies(blueprint) : "") + (journeyed ? "const capture = process.env.CAPTURE === '1'\n\n" : "") + ((blueprint.journey || blueprint.showcase) && (base || applicationFaces.length > 0) ? `const applications = {\n${base ? " browser: appBrowser,\n" : ""}${applicationFaces.map((extension) => `\t${extension.name}: app${extension.name[0]?.toUpperCase()}${extension.name.slice(1)},\n`).join("")}}\n\n` : ""),
8342
+ options: (machinery.browser ? "const browserOptions = resolveBrowser(resolvePinnedBrowser(), process.platform, process.env)\n// Vitest writes a page.screenshot() capture beside its test file unless a directory is named.\nconst screenshots = resolveWorkspacePath('tmp/captures/screenshots')\n\n" + blueprintToOptimizedDependencies(blueprint) : "") + ((blueprint.journey || blueprint.showcase) && (base || applicationFaces.length > 0) ? `const applications = {\n${base ? " browser: appBrowser,\n" : ""}${applicationFaces.map((extension) => `\t${extension.name}: app${extension.name[0]?.toUpperCase()}${extension.name.slice(1)},\n`).join("")}}\n\n` : ""),
8264
8343
  factories: body,
8265
8344
  projects: projectRows
8266
8345
  });
@@ -8665,13 +8744,29 @@ function blueprintToTestArtifacts(blueprint) {
8665
8744
  })
8666
8745
  };
8667
8746
  });
8747
+ const base = blueprint.base && blueprint.app.includes("browser");
8748
+ const journeys = blueprint.journey && (base || blueprintToFaces(blueprint).some((extension) => extension.surface === "browser" && extension.axes.includes("app"))) ? [...base ? ["browser"] : [], ...blueprintToFaces(blueprint).flatMap((extension) => extension.surface === "browser" && extension.axes.includes("app") ? [extension.name] : [])].map((application) => ({
8749
+ path: `tests/app/${application}/integration.test.ts`,
8750
+ group: "tests",
8751
+ ownership: "birth",
8752
+ origin: "template",
8753
+ environment: "browser",
8754
+ content: (0, _orkestrel_template.fillTemplate)(ARTIFACT_TEMPLATES.tests.journey, {
8755
+ application,
8756
+ heading: serializeTypeScriptString(blueprint.name),
8757
+ imports: application === "vue" ? "import { createApp } from 'vue'\nimport App from '../../../app/vue/App.vue'\n" : "",
8758
+ mount: application === "vue" ? " const container = document.body.appendChild(document.createElement('main'))\n const app = createApp(App)\n" : "",
8759
+ arrival: application === "vue" ? " app.mount(container)\n" : " await import('../../../app/browser/main.js')\n",
8760
+ cleanup: application === "vue" ? " app.unmount()\n container.remove()\n" : " for (const main of page.getByRole('main').elements()) main.remove()\n"
8761
+ })
8762
+ })) : [];
8668
8763
  const browsers = blueprintToMachinery(blueprint).browser ? [{
8669
8764
  path: "tests/setupBrowser.ts",
8670
8765
  group: "tests",
8671
8766
  ownership: "birth",
8672
8767
  origin: "template",
8673
8768
  environment: "browser",
8674
- content: blueprint.journey ? ARTIFACT_TEMPLATES.tests.browser : ARTIFACT_TEMPLATES.tests.setup
8769
+ content: journeys.length > 0 ? ARTIFACT_TEMPLATES.tests.browser : ARTIFACT_TEMPLATES.tests.setup
8675
8770
  }] : [];
8676
8771
  const servers = blueprint.src.includes("server") || blueprint.app.includes("server") || blueprint.bin.length > 0 || blueprint.conformance || blueprint.tree ? [{
8677
8772
  path: "tests/setupServer.ts",
@@ -8701,22 +8796,6 @@ function blueprintToTestArtifacts(blueprint) {
8701
8796
  origin: "template",
8702
8797
  content: ARTIFACT_TEMPLATES.tests.global.proof
8703
8798
  }] : [];
8704
- const base = blueprint.base && blueprint.app.includes("browser");
8705
- const journeys = blueprint.journey && (base || blueprintToFaces(blueprint).some((extension) => extension.surface === "browser" && extension.axes.includes("app"))) ? [...base ? ["browser"] : [], ...blueprintToFaces(blueprint).flatMap((extension) => extension.surface === "browser" && extension.axes.includes("app") ? [extension.name] : [])].map((application) => ({
8706
- path: `tests/app/${application}/integration.test.ts`,
8707
- group: "tests",
8708
- ownership: "birth",
8709
- origin: "template",
8710
- environment: "browser",
8711
- content: (0, _orkestrel_template.fillTemplate)(ARTIFACT_TEMPLATES.tests.journey, {
8712
- application,
8713
- heading: serializeTypeScriptString(blueprint.name),
8714
- imports: application === "vue" ? "import { createApp } from 'vue'\nimport App from '../../../app/vue/App.vue'\n" : "",
8715
- mount: application === "vue" ? " const container = document.body.appendChild(document.createElement('main'))\n const app = createApp(App)\n" : "",
8716
- arrival: application === "vue" ? " app.mount(container)\n" : " await import('../../../app/browser/main.js')\n",
8717
- cleanup: application === "vue" ? " app.unmount()\n container.remove()\n" : " for (const main of page.getByRole('main').elements()) main.remove()\n"
8718
- })
8719
- })) : [];
8720
8799
  const sources = Iterator.from(blueprint.src).map((environment) => ({
8721
8800
  path: `tests/src/${environment}/index.test.ts`,
8722
8801
  group: "tests",