@orkestrel/scaffold 0.0.135 → 0.0.137

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 (36) hide show
  1. package/dist/agents/skills/orkestrel-parallel/scripts/lane.js +167 -4
  2. package/dist/agents/skills/orkestrel-publish/scripts/wave.js +20 -5
  3. package/dist/bin/main.js +12 -12
  4. package/dist/host/AGENTS.md +1 -1
  5. package/dist/host/agents/orchestration.md +2 -2
  6. package/dist/host/agents/skills/orkestrel-parallel/scripts/lane.ts +201 -8
  7. package/dist/host/agents/skills/orkestrel-publish/scripts/wave.ts +24 -5
  8. package/dist/host/claude/agents/orkestrel.md +52 -52
  9. package/dist/host/claude/agents/reviewer.md +1 -1
  10. package/dist/host/claude/rules/documentation.md +1 -1
  11. package/dist/host/claude/rules/patterns.md +2 -2
  12. package/dist/host/claude/rules/workspace.md +9 -4
  13. package/dist/host/configs/helpers.ts +21 -6
  14. package/dist/host/guides/agent.md +3 -1
  15. package/dist/host/guides/brief.md +16 -16
  16. package/dist/host/guides/browser.md +1 -1
  17. package/dist/host/guides/contract.md +198 -163
  18. package/dist/host/guides/database.md +773 -310
  19. package/dist/host/guides/indexeddb.md +80 -66
  20. package/dist/host/guides/reason.md +1 -1
  21. package/dist/host/guides/relation.md +56 -32
  22. package/dist/host/guides/scaffold.md +8 -2
  23. package/dist/host/guides/sqlite.md +44 -23
  24. package/dist/host/guides/test.md +7 -3
  25. package/dist/host/guides/tool.md +2 -1
  26. package/dist/host/guides/toolbox.md +44 -44
  27. package/dist/host/guides/workflow.md +2 -2
  28. package/dist/host/manifest.json +26 -26
  29. package/dist/host/tests/config.test.ts +71 -3
  30. package/dist/src/core/index.cjs +112 -35
  31. package/dist/src/core/index.cjs.map +1 -1
  32. package/dist/src/core/index.d.cts +31 -5
  33. package/dist/src/core/index.d.ts +31 -5
  34. package/dist/src/core/index.js +112 -36
  35. package/dist/src/core/index.js.map +1 -1
  36. package/package.json +12 -12
@@ -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.135",
7
+ version: "0.0.137",
8
8
  description: "Scaffold workspaces with commands: new, audit, surface, repair, catalog, and overwrite.",
9
9
  keywords: [
10
10
  "audit",
@@ -96,20 +96,20 @@ var package_default = {
96
96
  "prepublishOnly": "npm run format:check && npm run lint:check && npm run check && npm run build && npm test && npm run test:templates && npm run test:distribution -- --mode release"
97
97
  },
98
98
  dependencies: {
99
- "@orkestrel/console": "^0.0.20",
100
- "@orkestrel/contract": "^0.0.23",
101
- "@orkestrel/emitter": "^0.0.16",
102
- "@orkestrel/markdown": "^0.0.21",
103
- "@orkestrel/process": "^0.0.19",
104
- "@orkestrel/template": "^0.0.14"
99
+ "@orkestrel/console": "^0.0.21",
100
+ "@orkestrel/contract": "^0.0.24",
101
+ "@orkestrel/emitter": "^0.0.17",
102
+ "@orkestrel/markdown": "^0.0.22",
103
+ "@orkestrel/process": "^0.0.20",
104
+ "@orkestrel/template": "^0.0.15"
105
105
  },
106
106
  devDependencies: {
107
107
  "@microsoft/api-extractor": "^7.60.1",
108
- "@orkestrel/browser": "^0.0.33",
109
- "@orkestrel/guide": "^0.0.31",
110
- "@orkestrel/html": "^0.0.16",
111
- "@orkestrel/probe": "^0.0.30",
112
- "@orkestrel/test": "^0.0.38",
108
+ "@orkestrel/browser": "^0.0.34",
109
+ "@orkestrel/guide": "^0.0.32",
110
+ "@orkestrel/html": "^0.0.17",
111
+ "@orkestrel/probe": "^0.0.31",
112
+ "@orkestrel/test": "^0.0.40",
113
113
  "@types/node": "^24.19.2",
114
114
  "@vitest/browser-playwright": "^5.1.0",
115
115
  "oxfmt": "^0.78.0",
@@ -955,7 +955,7 @@ var CONFIG_TEMPLATES = Object.freeze({
955
955
  `,
956
956
  vite: `{{journey}}import type { PluginOption, UserConfig } from 'vite'
957
957
  import { mergeConfig } from 'vite'
958
- {{imports}}import { defineConfig } from 'vitest/config'
958
+ {{imports}}import { {{vitest}}defineConfig } from 'vitest/config'
959
959
  import manifest from './package.json' with { type: 'json' }
960
960
  import tsconfig from './tsconfig.json' with { type: 'json' }
961
961
  {{helpers}}{{browsers}}import { fileURLToPath, URL } from 'node:url'
@@ -1790,11 +1790,11 @@ export function studies(override?: UserConfig): UserConfig {
1790
1790
  return mergeOverride(project, override)
1791
1791
  }
1792
1792
  `,
1793
- probe: `// A workbench, not a proof. No gate selects this project. Run in test mode by the
1793
+ probe: `{{benches}}// A workbench, not a proof. No gate selects this project. Run in test mode by the
1794
1794
  // \`test:probe\` script, it collects \`tmp/probes/**/*.test.ts\`. Run in benchmark mode by the
1795
- // \`test:bench\` script, it collects \`*.bench.ts\` files under \`tmp/probes\` and \`tests\`.
1796
- // Each benchmark is a regular test that uses its context's \`bench\` fixture and awaits
1797
- // \`bench(name, options, fn).run()\` or \`bench.compare(...)\`.
1795
+ // \`test:bench\` script, it collects \`*.bench.ts\` files under \`tmp/probes\` and \`tests\`, other
1796
+ // than a browser-hosted face's benches. Each benchmark is a regular test that uses its
1797
+ // context's \`bench\` fixture and awaits \`bench(name, options, fn).run()\` or \`bench.compare(...)\`.
1798
1798
  export function probe(override?: UserConfig): UserConfig {
1799
1799
  const project: UserConfig = {
1800
1800
  resolve,
@@ -1807,7 +1807,29 @@ export function probe(override?: UserConfig): UserConfig {
1807
1807
  fileParallelism: false,
1808
1808
  sequence: { groupOrder: 1 },
1809
1809
  pool: 'threads',
1810
- benchmark: { include: ['tmp/probes/**/*.bench.ts', 'tests/**/*.bench.ts'] },
1810
+ {{benchmark}} },
1811
+ }
1812
+ return mergeOverride(project, override)
1813
+ }
1814
+ `,
1815
+ bench: `// Runs the browser benches in Playwright Chromium beside the \`probe\` workbench, through the
1816
+ // \`test:bench\` script. No gate selects this project, and it collects no test file.
1817
+ export function benchBrowser(override?: UserConfig): UserConfig {
1818
+ const project: UserConfig = {
1819
+ resolve,
1820
+ {{optimization}},
1821
+ {{plugins}} test: {
1822
+ name: { label: 'bench:browser', color: 'black' },
1823
+ include: [],
1824
+ setupFiles: ['./tests/setup.ts', './tests/setupBrowser.ts'],
1825
+ browser: {
1826
+ enabled: true,
1827
+ provider: playwright(browserOptions),
1828
+ commands,
1829
+ screenshotDirectory: screenshots,
1830
+ instances: [{ browser: 'chromium', headless: true }],
1831
+ },
1832
+ benchmark: { include: browserBenches },
1811
1833
  },
1812
1834
  }
1813
1835
  return mergeOverride(project, override)
@@ -6329,6 +6351,35 @@ function matchesBarrel(blueprint) {
6329
6351
  return blueprint.studies && blueprint.app.includes("server");
6330
6352
  }
6331
6353
  /**
6354
+ * Lists the bench globs of the browser-hosted projects among a workspace's project labels.
6355
+ *
6356
+ * @param projects - The project labels, in registration order.
6357
+ * @returns One glob per browser-hosted label, matching every `*.bench.ts` file beneath that
6358
+ * label's directory under `tests/<axis>/`, in label order.
6359
+ *
6360
+ * @remarks
6361
+ * A label on the `src` or `app` axis names a project that runs in Playwright Chromium unless it
6362
+ * names `core`, `server`, or `bin`, which run in Node. The `src:themes` target collects
6363
+ * `tests/src/styles/themes`. Every other label sits on neither axis and adds no glob.
6364
+ *
6365
+ * @example
6366
+ * ```ts
6367
+ * import { projectsToBenches } from '@orkestrel/scaffold'
6368
+ *
6369
+ * const benches = projectsToBenches(['src:core', 'src:browser', 'app:vue', 'policy'])
6370
+ *
6371
+ * benches.length // 2
6372
+ * benches[1]?.startsWith('tests/app/vue/') // true
6373
+ * ```
6374
+ */
6375
+ function projectsToBenches(projects) {
6376
+ return projects.flatMap((label) => {
6377
+ const [axis, face, ...rest] = label.split(":");
6378
+ if (axis !== "src" && axis !== "app" || face === void 0 || face.length === 0 || rest.length > 0 || face === "core" || face === "server" || face === "bin") return [];
6379
+ return [`tests/${axis}/${face === "themes" ? "styles/themes" : face}/**/*.bench.ts`];
6380
+ });
6381
+ }
6382
+ /**
6332
6383
  * Selects the single published environment a package root points at.
6333
6384
  *
6334
6385
  * @param src - The declared published environments.
@@ -7601,7 +7652,11 @@ function blueprintToScripts(blueprint) {
7601
7652
  ...blueprint.conformance ? { "test:conformance": `${vitest} --project conformance` } : {},
7602
7653
  ...blueprint.tree ? { "test:tree": `${vitest} --project tree` } : {},
7603
7654
  "test:probe": "vitest run --config vite.config.ts --no-cache --reporter=verbose --project probe",
7604
- "test:bench": "vitest bench --config vite.config.ts --no-cache --project \"probe (bench)\" --mode benchmark",
7655
+ "test:bench": [
7656
+ "vitest bench --config vite.config.ts --no-cache --project \"probe (bench)\"",
7657
+ ...blueprintToProjects(blueprint).includes("bench:browser") ? ["--project bench:browser"] : [],
7658
+ "--mode benchmark"
7659
+ ].join(" "),
7605
7660
  ...publishes ? { "test:distribution": `${vitest} --project distribution` } : {},
7606
7661
  ...integrates ? { "test:integration": `${vitest} --project integration` } : {},
7607
7662
  ...blueprint.service ? { "test:service": `${vitest} --project service` } : {},
@@ -7677,10 +7732,11 @@ function blueprintToScripts(blueprint) {
7677
7732
  *
7678
7733
  * `accepted` carries each generated predecessor the region can replace. The
7679
7734
  * guides entry accepts the generated command that invoked the guides project
7680
- * through Vitest alone. The benchmark entry accepts the one command that ran the
7735
+ * through Vitest alone. The benchmark entry accepts the command that ran the
7681
7736
  * `probe` project through `vitest bench`, before the dedicated bench project
7682
- * existed. The pack hook accepts the build chain emitted before it
7683
- * delegated to `build`. The publication hook accepts the same gate chain without
7737
+ * existed, and the command planned for the other state of the browser bench project, so
7738
+ * the entry follows a browser-hosted face that arrives or leaves. The pack hook accepts the
7739
+ * build chain emitted before it delegated to `build`. The publication hook accepts the same gate chain without
7684
7740
  * {@link RELEASE_PROOF_COMMAND}. No accepted publication chain carries a study
7685
7741
  * step. `serve:build` accepts the server-only chain it ran before it delegated to `build`.
7686
7742
  * The value being written is always writable, so it is not repeated there. Any other value is a
@@ -7712,7 +7768,11 @@ function blueprintToWritableScripts(blueprint) {
7712
7768
  return [{
7713
7769
  name,
7714
7770
  command,
7715
- accepted: name === "test:guides" ? ["vitest run --config vite.config.ts --no-cache --reporter=dot --project guides"] : name === "test:bench" ? ["vitest bench --config vite.config.ts --no-cache --project probe"] : name === "build:src:styles" && blueprint.themes ? ["vite build --config configs/src/vite.styles.config.ts"] : sheets.some((face) => name === `test:src:${face}`) ? [command.slice(command.indexOf(" && ") + 4)] : name === "serve:build" ? ["npm run build:app:server && npm run serve"] : []
7771
+ accepted: name === "test:guides" ? ["vitest run --config vite.config.ts --no-cache --reporter=dot --project guides"] : name === "test:bench" ? [
7772
+ "vitest bench --config vite.config.ts --no-cache --project probe",
7773
+ "vitest bench --config vite.config.ts --no-cache --project \"probe (bench)\" --mode benchmark",
7774
+ "vitest bench --config vite.config.ts --no-cache --project \"probe (bench)\" --project bench:browser --mode benchmark"
7775
+ ].filter((predecessor) => predecessor !== command) : name === "build:src:styles" && blueprint.themes ? ["vite build --config configs/src/vite.styles.config.ts"] : sheets.some((face) => name === `test:src:${face}`) ? [command.slice(command.indexOf(" && ") + 4)] : name === "serve:build" ? ["npm run build:app:server && npm run serve"] : []
7716
7776
  }];
7717
7777
  });
7718
7778
  const prepack = scripts.prepack;
@@ -7961,8 +8021,8 @@ function blueprintToRootTsconfig(blueprint) {
7961
8021
  * Projects a blueprint into the project labels its root Vitest configuration registers.
7962
8022
  *
7963
8023
  * @param blueprint - The workspace specification.
7964
- * @returns Project labels in registration order, including wrapper-registered sheet faces and
7965
- * the probe benchmark variant.
8024
+ * @returns Project labels in registration order, including wrapper-registered sheet faces,
8025
+ * the probe benchmark variant, and, beside a browser-hosted face, the browser bench project.
7966
8026
  *
7967
8027
  * @example
7968
8028
  * ```ts
@@ -7975,15 +8035,19 @@ function blueprintToProjects(blueprint) {
7975
8035
  const sheets = blueprintToSheets(blueprint);
7976
8036
  const styled = sheets.length > 0 || blueprint.themes;
7977
8037
  const faces = blueprintToFaces(blueprint);
7978
- return [
8038
+ const environments = AXES.flatMap((axis) => [
8039
+ ...ENVIRONMENTS.filter((environment) => (axis !== "app" || environment !== "server") && blueprint[axis].includes(environment)).map((environment) => `${axis}:${environment}`),
8040
+ ...faces.filter((face) => face.axes.includes(axis)).map((face) => `${axis}:${face.name}`),
8041
+ ...axis === "src" && blueprint.bin.length > 0 ? ["src:bin"] : [],
8042
+ ...axis === "app" && blueprint.app.includes("server") ? ["app:server"] : []
8043
+ ]);
8044
+ const labels = [
7979
8045
  ...sheets.map((name) => `src:${name}`),
7980
8046
  ...blueprint.themes && !blueprint.styles ? ["src:themes"] : [],
7981
- ...AXES.flatMap((axis) => [
7982
- ...ENVIRONMENTS.filter((environment) => (axis !== "app" || environment !== "server") && blueprint[axis].includes(environment)).map((environment) => `${axis}:${environment}`),
7983
- ...faces.filter((face) => face.axes.includes(axis)).map((face) => `${axis}:${face.name}`),
7984
- ...axis === "src" && blueprint.bin.length > 0 ? ["src:bin"] : [],
7985
- ...axis === "app" && blueprint.app.includes("server") ? ["app:server"] : []
7986
- ]),
8047
+ ...environments
8048
+ ];
8049
+ return [
8050
+ ...labels,
7987
8051
  "policy",
7988
8052
  "config",
7989
8053
  ...blueprint.setup.includes("node") || blueprint.global ? ["setup"] : [],
@@ -7997,7 +8061,8 @@ function blueprintToProjects(blueprint) {
7997
8061
  ...blueprint.src.length > 0 || styled ? ["distribution"] : [],
7998
8062
  ...blueprint.integration ? ["integration"] : [],
7999
8063
  "probe",
8000
- "probe (bench)"
8064
+ "probe (bench)",
8065
+ ...projectsToBenches(labels).length > 0 ? ["bench:browser"] : []
8001
8066
  ];
8002
8067
  }
8003
8068
  /**
@@ -8070,6 +8135,8 @@ function blueprintToRootVite(blueprint) {
8070
8135
  ...machinery.showcase ? ["import { viteSingleFile } from 'vite-plugin-singlefile'", "import { resolve as resolvePath } from 'node:path'"] : []
8071
8136
  ];
8072
8137
  const external = "external: resolveSourceExternal,";
8138
+ const benches = projectsToBenches([...planned]);
8139
+ const inlineBenches = `const browserBenches = [${benches.map((glob) => `'${glob}'`).join(", ")}]`;
8073
8140
  const factories = [
8074
8141
  ...blueprint.src.includes("browser") || blueprint.src.includes("server") ? [blueprint.src.includes("core") ? `function resolveSourceExternal(id: string): boolean {
8075
8142
  return (
@@ -8138,7 +8205,14 @@ function blueprintToRootVite(blueprint) {
8138
8205
  ...planned.has("studies") ? [CONFIG_TEMPLATES.factories.studies] : [],
8139
8206
  ...planned.has("distribution") ? [CONFIG_TEMPLATES.factories.distribution] : [],
8140
8207
  ...planned.has("integration") ? [(0, _orkestrel_template.fillTemplate)(styled ? CONFIG_TEMPLATES.factories.integration.sheet : CONFIG_TEMPLATES.factories.integration.module, { global })] : [],
8141
- CONFIG_TEMPLATES.factories.probe
8208
+ (0, _orkestrel_template.fillTemplate)(CONFIG_TEMPLATES.factories.probe, {
8209
+ benches: benches.length === 0 ? "" : `// A browser-hosted face's bench reads host APIs that Node lacks, so only \`bench:browser\` runs it.\n${matchesPrintWidth(inlineBenches) ? inlineBenches : `const browserBenches = [\n${benches.map((glob) => `\t'${glob}',`).join("\n")}\n]`}\n\n`,
8210
+ benchmark: benches.length === 0 ? " benchmark: { include: ['tmp/probes/**/*.bench.ts', 'tests/**/*.bench.ts'] },\n" : " benchmark: {\n include: ['tmp/probes/**/*.bench.ts', 'tests/**/*.bench.ts'],\n // A set `exclude` replaces Vitest's default, so the default is kept.\n exclude: [...defaultExclude, ...browserBenches],\n },\n"
8211
+ }),
8212
+ ...planned.has("bench:browser") ? [(0, _orkestrel_template.fillTemplate)(CONFIG_TEMPLATES.factories.bench, {
8213
+ optimization: machinery.frameworks.includes("vue") ? "optimizeDeps: { include: [...optimizeDeps.include, 'vue'] }" : "optimizeDeps",
8214
+ plugins: machinery.frameworks.includes("vue") ? " plugins: [vue()],\n" : ""
8215
+ })] : []
8142
8216
  ];
8143
8217
  const projects = [
8144
8218
  ...styled ? [...sheets.map((name) => `'./configs/src/vite.${name}.config.ts'`), ...planned.has("src:themes") ? ["'./configs/src/vite.themes.config.ts'"] : []] : [],
@@ -8163,7 +8237,8 @@ function blueprintToRootVite(blueprint) {
8163
8237
  ...planned.has("studies") ? ["studies"] : [],
8164
8238
  ...planned.has("distribution") ? ["distribution"] : [],
8165
8239
  ...planned.has("integration") ? ["integration"] : [],
8166
- "probe"
8240
+ "probe",
8241
+ ...planned.has("bench:browser") ? ["benchBrowser"] : []
8167
8242
  ];
8168
8243
  const joinedProjects = `\t\tprojects: [${projects.join(", ")}],`;
8169
8244
  const projectRows = matchesPrintWidth(joinedProjects) ? joinedProjects : `\t\tprojects: [
@@ -8182,6 +8257,7 @@ ${projects.map((project) => `\t\t\t${project},`).join("\n")}
8182
8257
  return (0, _orkestrel_template.fillTemplate)(CONFIG_TEMPLATES.root.vite, {
8183
8258
  journey: journeyed ? "import type { JourneyVariant } from '@orkestrel/test'\n" : "",
8184
8259
  imports: imports.length === 0 ? "" : `${imports.join("\n")}\n`,
8260
+ vitest: benches.length === 0 ? "" : "defaultExclude, ",
8185
8261
  helpers: helpers.length === 0 ? "" : matchesPrintWidth(helperImport.trimEnd()) ? helperImport : `import {\n${helpers.map((helper) => `\t${helper},`).join("\n")}\n} from './configs/helpers.js'\n`,
8186
8262
  browsers: machinery.browser ? "import { resolveBrowser, resolvePinnedBrowser } from './configs/browsers.js'\nimport { commands } from './configs/commands.js'\n" : "",
8187
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` : ""),
@@ -10605,6 +10681,7 @@ exports.pathToCondition = pathToCondition;
10605
10681
  exports.planToArtifactFindings = planToArtifactFindings;
10606
10682
  exports.planToHash = planToHash;
10607
10683
  exports.planToSummary = planToSummary;
10684
+ exports.projectsToBenches = projectsToBenches;
10608
10685
  exports.renderSkillPointer = renderSkillPointer;
10609
10686
  exports.replaceManifestOverride = replaceManifestOverride;
10610
10687
  exports.replaceManifestOverrides = replaceManifestOverrides;