@orkestrel/scaffold 0.0.125 → 0.0.127

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 (35) hide show
  1. package/dist/bin/main.js +50 -14
  2. package/dist/bin/main.js.map +1 -1
  3. package/dist/host/AGENTS.md +1 -1
  4. package/dist/host/agents/orchestration.md +5 -4
  5. package/dist/host/agents/skills/orkestrel-falsify/SKILL.md +1 -1
  6. package/dist/host/agents/skills/orkestrel-harden/references/methods.md +2 -2
  7. package/dist/host/agents/skills/orkestrel-journey/SKILL.md +18 -19
  8. package/dist/host/agents/skills/orkestrel-parallel/references/codex.md +2 -1
  9. package/dist/host/claude/AGENTS.md +2 -2
  10. package/dist/host/claude/agents/orkestrel.md +18 -18
  11. package/dist/host/claude/agents/planner.md +2 -2
  12. package/dist/host/claude/rules/quality.md +3 -0
  13. package/dist/host/claude/rules/tests.md +3 -0
  14. package/dist/host/claude/rules/workspace.md +11 -5
  15. package/dist/host/codex/agents/planner.toml +2 -2
  16. package/dist/host/guides/agent.md +285 -161
  17. package/dist/host/guides/capture.md +123 -123
  18. package/dist/host/guides/database.md +18 -7
  19. package/dist/host/guides/ndjson.md +4 -3
  20. package/dist/host/guides/ollama.md +2 -2
  21. package/dist/host/guides/program.md +3 -3
  22. package/dist/host/guides/qualifier.md +1 -1
  23. package/dist/host/guides/relation.md +71 -31
  24. package/dist/host/guides/scaffold.md +101 -64
  25. package/dist/host/guides/study.md +22 -12
  26. package/dist/host/guides/toolbox.md +9 -2
  27. package/dist/host/manifest.json +26 -26
  28. package/dist/host/tests/config.test.ts +24 -6
  29. package/dist/src/core/index.cjs +134 -79
  30. package/dist/src/core/index.cjs.map +1 -1
  31. package/dist/src/core/index.d.cts +30 -7
  32. package/dist/src/core/index.d.ts +30 -7
  33. package/dist/src/core/index.js +134 -80
  34. package/dist/src/core/index.js.map +1 -1
  35. package/package.json +4 -4
package/dist/bin/main.js CHANGED
@@ -10,7 +10,7 @@ import { readdirSync } from "node:fs";
10
10
  import { parseArgs } from "node:util";
11
11
  var package_default = {
12
12
  name: "@orkestrel/scaffold",
13
- version: "0.0.125",
13
+ version: "0.0.127",
14
14
  description: "Scaffold workspaces with commands: new, audit, surface, repair, catalog, and overwrite.",
15
15
  keywords: [
16
16
  "audit",
@@ -118,11 +118,11 @@ var package_default = {
118
118
  "@orkestrel/test": "^0.0.33",
119
119
  "@types/node": "^24.19.2",
120
120
  "@vitest/browser-playwright": "^5.1.0",
121
- "oxfmt": "^0.76.0",
122
- "oxlint": "^1.91.0",
121
+ "oxfmt": "^0.78.0",
122
+ "oxlint": "^1.93.0",
123
123
  "playwright": "^1.64.1",
124
124
  "typescript": "^7.0.2",
125
- "vite": "^8.3.6",
125
+ "vite": "^8.3.7",
126
126
  "vitest": "^5.1.0"
127
127
  },
128
128
  engines: { "node": ">=22.18.0" }
@@ -819,6 +819,10 @@ function sheetTestToQuestion(artifact, present) {
819
819
  * declared chain is a generated predecessor of it.
820
820
  *
821
821
  * @remarks
822
+ * A publishing manifest's byte-exact former generated chain also joins the writable region: the
823
+ * planned chain with its generated application and journey invocations after `test:src`. A chain
824
+ * that differs in spacing, order, or another step does not match that predecessor.
825
+ *
822
826
  * A declared `test` chain is a generated predecessor when it runs fewer `&&` steps than the
823
827
  * planned chain and every step it runs is a planned step, in the planned order. That is the chain
824
828
  * a birth or an earlier write left before a structural fact planned another step, such as a root
@@ -833,11 +837,21 @@ function sheetTestToQuestion(artifact, present) {
833
837
  */
834
838
  function manifestToWritableScripts(manifest, blueprint) {
835
839
  const writable = blueprintToWritableScripts(blueprint);
836
- const planned = blueprintToScripts(blueprint).test;
840
+ const generated = blueprintToScripts(blueprint);
841
+ const planned = generated.test;
837
842
  const parsed = parseJSON(manifest);
838
843
  const scripts = isRecord(parsed) && isRecord(parsed.scripts) ? parsed.scripts : {};
839
844
  const declared = scripts.test;
840
845
  if (planned === void 0 || !isString(declared)) return writable;
846
+ if (generated.prepublishOnly !== void 0 && isRecord(parsed) && parsed.private !== true) {
847
+ const helpers = Object.keys(generated).filter((name) => name === "test:app" || /^test:journey(:|$)/u.test(name));
848
+ const former = planned.replace("npm run test:src", ["npm run test:src", ...helpers.map((name) => `npm run ${name}`)].join(" && "));
849
+ if (helpers.length > 0 && declared === former) return [...writable, {
850
+ name: "test",
851
+ command: planned,
852
+ accepted: [declared]
853
+ }];
854
+ }
841
855
  const steps = declared.split("&&").map((step) => step.trim());
842
856
  const expected = planned.split("&&").map((step) => step.trim());
843
857
  if (steps.length >= expected.length) return writable;
@@ -1253,7 +1267,7 @@ function scanScriptTokens(script) {
1253
1267
  * Reads the literal Vitest projects, configuration paths, and npm run scripts a shell command names.
1254
1268
  *
1255
1269
  * @param script - The manifest script text to read.
1256
- * @param wrappers - Planned wrapper paths mapped to the face projects they run.
1270
+ * @param wrappers - Planned wrapper paths mapped to the projects they run.
1257
1271
  * @returns The named projects, configurations, and scripts, or `undefined` when the command
1258
1272
  * cannot be read literally.
1259
1273
  *
@@ -1364,8 +1378,8 @@ function scriptToInvocations(script, wrappers = /* @__PURE__ */ new Map()) {
1364
1378
  *
1365
1379
  * @param gate - The script name the walk starts at.
1366
1380
  * @param scripts - The manifest's scripts by name; a value that is not a string names no command.
1367
- * @param wrappers - Planned wrapper paths mapped to the face projects they run.
1368
- * @returns The script names the walk visited, the Vitest projects those scripts name, and the
1381
+ * @param wrappers - Planned wrapper paths mapped to the projects they run.
1382
+ * @returns The visited script names, their readable invocations and Vitest projects, and the
1369
1383
  * visited scripts whose command cannot be read literally.
1370
1384
  *
1371
1385
  * @remarks
@@ -1377,8 +1391,8 @@ function scriptToInvocations(script, wrappers = /* @__PURE__ */ new Map()) {
1377
1391
  * ```ts
1378
1392
  * import { collectScriptChain } from './helpers.js'
1379
1393
  *
1380
- * collectScriptChain('test', { test: 'npm run test:src', 'test:src': 'vitest run --project src:core' }, new Map())
1381
- * // { visited: Set { 'test', 'test:src' }, projects: Set { 'src:core' }, unreadable: Set {} }
1394
+ * const chain = collectScriptChain('test', { test: 'npm run test:src', 'test:src': 'vitest run --project src:core' }, new Map())
1395
+ * chain.readings.get('test:src') // { projects: ['src:core'], configs: [], scripts: [] }
1382
1396
  * ```
1383
1397
  */
1384
1398
  function collectScriptChain(gate, scripts, wrappers) {
@@ -1399,6 +1413,7 @@ function collectScriptChain(gate, scripts, wrappers) {
1399
1413
  }
1400
1414
  return {
1401
1415
  visited,
1416
+ readings: new Map(reads.flatMap(({ name, invoked }) => invoked === void 0 ? [] : [[name, invoked]])),
1402
1417
  projects: new Set(reads.flatMap(({ invoked }) => invoked?.projects ?? [])),
1403
1418
  unreadable: new Set(reads.flatMap(({ name, invoked }) => invoked === void 0 ? [name] : []))
1404
1419
  };
@@ -2038,6 +2053,7 @@ var CLI = class {
2038
2053
  themes: command.themes === true,
2039
2054
  showcase: command.showcase === true,
2040
2055
  journey: app.includes("browser"),
2056
+ base: app.includes("browser"),
2041
2057
  bin: command.bin === true,
2042
2058
  setup: [],
2043
2059
  dependencies: selectionToPackages(command.dependencies).map((name) => ({
@@ -2599,6 +2615,7 @@ var CLI = class {
2599
2615
  const service = resolveContainedPath(target, SERVICE_SETUP_PATH);
2600
2616
  const global = resolveContainedPath(target, GLOBAL_SETUP_PATH);
2601
2617
  const journey = resolveContainedPath(target, JOURNEY_CONFIG_PATH);
2618
+ const browserEntry = resolveContainedPath(target, "app/browser/main.ts");
2602
2619
  const skills = resolveContainedPath(target, SKILLS_CONFIG_PATH);
2603
2620
  const files = tests === void 0 ? [] : listFiles(tests);
2604
2621
  const studies = files.some((path) => {
@@ -2628,6 +2645,7 @@ var CLI = class {
2628
2645
  studies,
2629
2646
  global: global !== void 0 && isExactCaseFile(global),
2630
2647
  journey: journey !== void 0 && isExactCaseFile(journey),
2648
+ base: browserEntry !== void 0 && isExactCaseFile(browserEntry),
2631
2649
  skills: skills !== void 0 && isExactCaseFile(skills)
2632
2650
  });
2633
2651
  }
@@ -2638,7 +2656,8 @@ var CLI = class {
2638
2656
  const planned = new Set(blueprintToProjects(blueprint));
2639
2657
  const parsed = parseJSON(manifest);
2640
2658
  const scripts = isRecord(parsed) && isRecord(parsed.scripts) ? parsed.scripts : {};
2641
- const gates = !isRecord(parsed) || parsed.private !== true ? ["test", "prepublishOnly"] : ["test"];
2659
+ const publishes = !isRecord(parsed) || parsed.private !== true;
2660
+ const gates = publishes ? ["test", "prepublishOnly"] : ["test"];
2642
2661
  const gateNames = gates.join(" or ");
2643
2662
  const readings = Object.values(scripts).filter((script) => isString(script) && script.includes("vitest")).map((script) => scriptToInvocations(script));
2644
2663
  const unresolved = readings.some((invocations) => invocations === void 0);
@@ -2677,11 +2696,16 @@ var CLI = class {
2677
2696
  return (scriptToInvocations(script)?.projects ?? []).flatMap((project) => {
2678
2697
  const direct = `test:${project}`;
2679
2698
  const command = expected[direct];
2680
- return project === "probe" || project === "studies" || command === void 0 ? [] : [[project, `"${direct}": ${JSON.stringify(command)},`]];
2699
+ return project === "probe" || project === "studies" || publishes && project.startsWith("app:") || command === void 0 ? [] : [[project, `"${direct}": ${JSON.stringify(command)},`]];
2681
2700
  });
2682
2701
  }));
2683
- const faces = /* @__PURE__ */ new Set([...blueprintToSheets(blueprint).map((name) => `src:${name}`), ...blueprintToFaces(blueprint).flatMap(({ name, axes }) => axes.map((axis) => `${axis}:${name}`))]);
2702
+ const faces = /* @__PURE__ */ new Set([
2703
+ ...blueprint.app.map((environment) => `app:${environment}`),
2704
+ ...blueprintToSheets(blueprint).map((name) => `src:${name}`),
2705
+ ...blueprintToFaces(blueprint).flatMap(({ name, axes }) => axes.map((axis) => `${axis}:${name}`))
2706
+ ]);
2684
2707
  const wrappers = new Map(blueprintToConfigArtifacts(blueprint).flatMap((artifact) => {
2708
+ if (artifact.path === JOURNEY_CONFIG_PATH) return [[artifact.path, "journey"]];
2685
2709
  const match = /^configs\/(src|app)\/vite\.([^.]+)\.config\.ts$/u.exec(artifact.path);
2686
2710
  const project = match === null ? void 0 : `${match[1]}:${match[2]}`;
2687
2711
  return project !== void 0 && faces.has(project) ? [[artifact.path, project]] : [];
@@ -2696,7 +2720,19 @@ var CLI = class {
2696
2720
  };
2697
2721
  const ungated = [...expectedLines].filter(([project]) => !reachable.has(project)).sort(([left], [right]) => left.localeCompare(right)).filter(([project]) => isString(scripts[`test:${project}`]));
2698
2722
  if (ungated.length === 0) {
2699
- if (!writing && expected["test:journey"] !== void 0 && !chains.get("test")?.visited.has("test:journey")) return {
2723
+ if (publishes && !writing) {
2724
+ const helpers = [.../* @__PURE__ */ new Set([...[...chains.values()].flatMap((chain) => [...chain.visited].filter((name) => /^test:(app|journey)(:|$)/u.test(name))), ...[...reachable].filter((project) => /^(app|journey)(:|$)/u.test(project)).map((project) => `test:${project}`)])].sort();
2725
+ if (helpers.length > 0) {
2726
+ const invocations = [...new Map([...chains.values()].flatMap((chain) => [...chain.readings]))].filter(([, reading]) => reading.projects.some((project) => /^(app|journey)(:|$)/u.test(project))).map(([name]) => `${name}: ${scripts[name]}`);
2727
+ return {
2728
+ field: "projects",
2729
+ message: `The publishing manifest at ${target} reaches application or journey suites from ${gateNames}: ${helpers.join(", ")}.${invocations.length > 0 ? ` Reached invocations: ${invocations.join("; ")}.` : ""} Remove their invocations from the gate chains and run them on demand.`,
2730
+ blocking: false,
2731
+ groups: ["configs"]
2732
+ };
2733
+ }
2734
+ }
2735
+ if (!publishes && !writing && expected["test:journey"] !== void 0 && !chains.get("test")?.visited.has("test:journey")) return {
2700
2736
  field: "projects",
2701
2737
  message: `The manifest at ${target} does not invoke npm run test:journey from its test chain. Add npm run test:journey after npm run test:app.`,
2702
2738
  blocking: false,