@orkestrel/scaffold 0.0.121 → 0.0.123

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 (85) hide show
  1. package/dist/agents/skills/orkestrel-dispatch/scripts/brief.js +57 -9
  2. package/dist/agents/skills/orkestrel-dispatch/scripts/chain.js +22 -2
  3. package/dist/agents/skills/orkestrel-harden/scripts/interleave.js +539 -0
  4. package/dist/agents/skills/orkestrel-parallel/scripts/lane.js +1163 -0
  5. package/dist/agents/skills/orkestrel-publish/scripts/pins.js +5 -5
  6. package/dist/agents/skills/orkestrel-publish/scripts/wave.js +67 -5
  7. package/dist/bin/main.js +8 -6
  8. package/dist/bin/main.js.map +1 -1
  9. package/dist/host/agents/orchestration.md +29 -18
  10. package/dist/host/agents/skills/orkestrel-dispatch/SKILL.md +7 -6
  11. package/dist/host/agents/skills/orkestrel-dispatch/references/launch.md +3 -2
  12. package/dist/host/agents/skills/orkestrel-dispatch/scripts/brief.ts +65 -9
  13. package/dist/host/agents/skills/orkestrel-dispatch/scripts/chain.ts +28 -2
  14. package/dist/host/agents/skills/orkestrel-falsify/SKILL.md +4 -2
  15. package/dist/host/agents/skills/orkestrel-falsify/references/brief.md +3 -2
  16. package/dist/host/agents/skills/orkestrel-harden/SKILL.md +24 -11
  17. package/dist/host/agents/skills/orkestrel-harden/references/bindings.md +18 -12
  18. package/dist/host/agents/skills/orkestrel-harden/references/document.md +1 -0
  19. package/dist/host/agents/skills/orkestrel-harden/references/equivalence.md +2 -1
  20. package/dist/host/agents/skills/orkestrel-harden/references/hardening.md +4 -4
  21. package/dist/host/agents/skills/orkestrel-harden/references/methods.md +642 -0
  22. package/dist/host/agents/skills/orkestrel-harden/scripts/interleave.ts +665 -0
  23. package/dist/host/agents/skills/orkestrel-parallel/SKILL.md +16 -15
  24. package/dist/host/agents/skills/orkestrel-parallel/references/{claude.md → claude-code.md} +13 -13
  25. package/dist/host/agents/skills/orkestrel-parallel/references/t3.md +1 -0
  26. package/dist/host/agents/skills/orkestrel-parallel/scripts/lane.ts +1433 -0
  27. package/dist/host/agents/skills/orkestrel-publish/SKILL.md +12 -9
  28. package/dist/host/agents/skills/orkestrel-publish/references/release.md +2 -2
  29. package/dist/host/agents/skills/orkestrel-publish/references/wave.md +39 -8
  30. package/dist/host/agents/skills/orkestrel-publish/references/window.md +5 -1
  31. package/dist/host/agents/skills/orkestrel-publish/scripts/pins.ts +5 -5
  32. package/dist/host/agents/skills/orkestrel-publish/scripts/wave.ts +86 -7
  33. package/dist/host/claude/AGENTS.md +2 -2
  34. package/dist/host/claude/agents/analyst.md +1 -1
  35. package/dist/host/claude/agents/builder.md +1 -1
  36. package/dist/host/claude/agents/distiller.md +2 -1
  37. package/dist/host/claude/agents/grok.md +2 -2
  38. package/dist/host/claude/agents/opus.md +8 -7
  39. package/dist/host/claude/agents/orkestrel.md +7 -7
  40. package/dist/host/claude/agents/planner.md +3 -3
  41. package/dist/host/claude/agents/reviewer.md +3 -3
  42. package/dist/host/claude/agents/scout.md +2 -1
  43. package/dist/host/claude/agents/verifier.md +2 -2
  44. package/dist/host/claude/rules/campaign.md +15 -13
  45. package/dist/host/claude/rules/documentation.md +1 -0
  46. package/dist/host/claude/rules/names.md +13 -7
  47. package/dist/host/claude/rules/patterns.md +14 -0
  48. package/dist/host/claude/rules/quality.md +4 -1
  49. package/dist/host/claude/rules/tests.md +5 -1
  50. package/dist/host/claude/rules/workspace.md +9 -0
  51. package/dist/host/claude/rules/writing.md +1 -1
  52. package/dist/host/claude/skills/orkestrel-harden/SKILL.md +1 -1
  53. package/dist/host/claude/skills/orkestrel-parallel/SKILL.md +1 -1
  54. package/dist/host/codex/agents/analyst.toml +6 -6
  55. package/dist/host/codex/agents/astra.toml +1 -1
  56. package/dist/host/codex/agents/builder.toml +1 -1
  57. package/dist/host/codex/agents/distiller.toml +4 -2
  58. package/dist/host/codex/agents/grok.toml +5 -2
  59. package/dist/host/codex/agents/opus.toml +6 -4
  60. package/dist/host/codex/agents/planner.toml +6 -5
  61. package/dist/host/codex/agents/reviewer.toml +9 -8
  62. package/dist/host/codex/agents/scout.toml +5 -1
  63. package/dist/host/codex/agents/verifier.toml +8 -3
  64. package/dist/host/dotfiles/gitignore +1 -2
  65. package/dist/host/guides/agent.md +1119 -457
  66. package/dist/host/guides/ndjson.md +81 -21
  67. package/dist/host/guides/ollama.md +22 -18
  68. package/dist/host/guides/probe.md +29 -27
  69. package/dist/host/guides/scaffold.md +42 -15
  70. package/dist/host/guides/study.md +538 -450
  71. package/dist/host/manifest.json +81 -63
  72. package/dist/host/tests/config.test.ts +7 -0
  73. package/dist/src/core/index.cjs +14 -8
  74. package/dist/src/core/index.cjs.map +1 -1
  75. package/dist/src/core/index.d.cts +1 -4
  76. package/dist/src/core/index.d.ts +1 -4
  77. package/dist/src/core/index.js +14 -8
  78. package/dist/src/core/index.js.map +1 -1
  79. package/dist/src/server/index.cjs +87 -8
  80. package/dist/src/server/index.cjs.map +1 -1
  81. package/dist/src/server/index.d.cts +50 -6
  82. package/dist/src/server/index.d.ts +50 -6
  83. package/dist/src/server/index.js +87 -10
  84. package/dist/src/server/index.js.map +1 -1
  85. package/package.json +2 -2
@@ -1,6 +1,6 @@
1
- // Sweep source and tests for a prior version or range literal after a bump or a re-pin. Run from
2
- // the publishing package's root:
3
- // node .agents/skills/orkestrel-publish/scripts/pins.ts --version 0.0.76 [--range ^0.0.16 ...] [--paths src,tests] [--json]
1
+ // Sweep source, tests, and guides for a prior version or range literal after a bump or a re-pin.
2
+ // Run from the publishing package's root:
3
+ // node .agents/skills/orkestrel-publish/scripts/pins.ts --version 0.0.76 [--range ^0.0.16 ...] [--paths src,tests,guides] [--json]
4
4
  // `--range` repeats. A version hit is the literal bounded by characters other than digits and dots,
5
5
  // so `~0.0.76` and `"0.0.76"` both hit and `0.0.760` does not. A range that is one comparator over
6
6
  // one version (`^8.3.0`, `~8.3.0`, `>=8.3.0`, `v8.3.0`) hits its bare version in any form, bounded the
@@ -28,7 +28,7 @@ export const SKIPPED_DIRECTORIES = new Set([
28
28
  /** Lists every flag the script reads, value flags and switches alike. */
29
29
  export const FLAGS = ['--version', '--range', '--paths', '--json'];
30
30
  /** Holds the usage line the script prints on a usage refusal. */
31
- export const USAGE = 'usage: pins.ts --version PRIOR [--range PRIOR_RANGE ...] [--paths src,tests] [--json]';
31
+ export const USAGE = 'usage: pins.ts --version PRIOR [--range PRIOR_RANGE ...] [--paths src,tests,guides] [--json]';
32
32
  /**
33
33
  * Normalizes a host path to forward slashes.
34
34
  *
@@ -208,7 +208,7 @@ export function main(argv) {
208
208
  }
209
209
  const version = readOptions(argv, '--version')[0];
210
210
  const ranges = readOptions(argv, '--range');
211
- const paths = (readOptions(argv, '--paths')[0] ?? 'src,tests').split(',');
211
+ const paths = (readOptions(argv, '--paths')[0] ?? 'src,tests,guides').split(',');
212
212
  if (version === undefined && ranges.length === 0) {
213
213
  console.error(USAGE);
214
214
  return 64;
@@ -1262,24 +1262,86 @@ export function runVerify(runner, scaffoldFile, scaffoldPrefix, offline, own) {
1262
1262
  .map((release) => `${release.name} ${release.range} vs ${String(release.latest)}`)
1263
1263
  .join(', '), drift.length === 0 ? 0 : 1);
1264
1264
  }
1265
+ /**
1266
+ * Reads the ranges the manifest declared in the commit that released a version.
1267
+ *
1268
+ * @remarks
1269
+ * The fleet's release commit carries the subject `Release <version>` and touches the manifest, and
1270
+ * the upload is exported from it, so its manifest holds the ranges the version shipped. A re-pin
1271
+ * made after it, committed or not, differs from those ranges, which `HEAD` alone cannot show.
1272
+ *
1273
+ * @param target - The target directory.
1274
+ * @param version - The released version.
1275
+ * @returns The ranges keyed by `field name` from the newest commit whose subject is exactly
1276
+ * `Release <version>`, or undefined when the target is no work tree, no such commit touched its
1277
+ * manifest, or that manifest is unreadable.
1278
+ */
1279
+ export function readReleasedRanges(target, version) {
1280
+ const subject = `Release ${version}`;
1281
+ const log = spawnSync('git', ['log', '--format=%H %s', '--fixed-strings', `--grep=${subject}`, '--', 'package.json'], { cwd: target, encoding: 'utf8', windowsHide: true, maxBuffer: 64 * 1024 * 1024 });
1282
+ if (log.status !== 0)
1283
+ return undefined;
1284
+ const commit = log.stdout
1285
+ .split(/\r\n|\n/u)
1286
+ .map((line) => /^([0-9a-f]+) (.*)$/u.exec(line))
1287
+ .find((match) => match?.[2] === subject)?.[1];
1288
+ if (commit === undefined)
1289
+ return undefined;
1290
+ const shown = spawnSync('git', ['show', `${commit}:./package.json`], {
1291
+ cwd: target,
1292
+ encoding: 'utf8',
1293
+ windowsHide: true,
1294
+ maxBuffer: 64 * 1024 * 1024,
1295
+ });
1296
+ const manifest = shown.status === 0 ? parseJsonRecord(shown.stdout) : undefined;
1297
+ return manifest === undefined ? undefined : readRanges(manifest, RANGE_FIELDS);
1298
+ }
1299
+ /**
1300
+ * Collects every prior range that no longer stands in the final ranges.
1301
+ *
1302
+ * @param after - The ranges the manifest declares after the visit.
1303
+ * @param priors - Each earlier reading of the ranges, such as the release commit's and the visit's
1304
+ * starting ones.
1305
+ * @returns Each distinct range an earlier reading declared under a key whose final range differs,
1306
+ * in reading order.
1307
+ */
1308
+ export function collectPriorRanges(after, priors) {
1309
+ return [
1310
+ ...new Set(priors.flatMap((prior) => [...prior].filter(([key, range]) => after.get(key) !== range).map(([, range]) => range))),
1311
+ ];
1312
+ }
1265
1313
  /**
1266
1314
  * Runs the pins step.
1267
1315
  *
1316
+ * @remarks
1317
+ * The sweep takes every range that moved since the prior version's release commit as well as every
1318
+ * range the visit moved, so a re-pin made before the visit is swept too. Without that commit, or
1319
+ * under --dry-run, it takes the visit's moves alone; a run that executes the sweep names its source
1320
+ * in the row's note.
1321
+ *
1268
1322
  * @param runner - The visit's state.
1269
1323
  * @param before - The ranges the manifest declared before the visit.
1270
1324
  * @param version - The version to sweep for, or undefined when none is known.
1271
1325
  * @returns The number of hit lines, or undefined when the sweep did not run.
1272
1326
  */
1273
1327
  export function runPins(runner, before, version) {
1274
- const after = readRanges(readManifest(runner.target) ?? {}, RANGE_FIELDS);
1275
- const prior = [...before]
1276
- .filter(([name, range]) => after.get(name) !== range)
1277
- .flatMap(([, range]) => ['--range', range]);
1278
1328
  if (version === undefined) {
1279
1329
  appendStep(runner, 'pins', basename(PINS), 'no prior version to sweep for; pass --prior');
1280
1330
  return undefined;
1281
1331
  }
1282
- const swept = runStep(runner, 'pins', process.execPath, [PINS, '--version', version, ...prior], runner.target);
1332
+ const after = readRanges(readManifest(runner.target) ?? {}, RANGE_FIELDS);
1333
+ const released = runner.dry ? undefined : readReleasedRanges(runner.target, version);
1334
+ const prior = collectPriorRanges(after, released === undefined ? [before] : [released, before]);
1335
+ const source = released === undefined
1336
+ ? `no "Release ${version}" commit touched package.json; swept the ranges this visit moved`
1337
+ : `swept the ranges moved since the "Release ${version}" commit and by this visit`;
1338
+ const swept = runStep(runner, 'pins', process.execPath, [PINS, '--version', version, ...prior.flatMap((range) => ['--range', range])], runner.target, (result) => {
1339
+ const verdict = readVerdict(result);
1340
+ return {
1341
+ ...verdict,
1342
+ note: [verdict.note, source].filter((part) => part !== undefined).join('; '),
1343
+ };
1344
+ });
1283
1345
  return swept === undefined
1284
1346
  ? undefined
1285
1347
  : swept.stdout.split(/\r\n|\n/).filter((line) => /^\S+:\d+: /u.test(line)).length;
package/dist/bin/main.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import { align, renderTable, strip, stripControls, width } from "@orkestrel/console";
3
3
  import { attempt, isArray, isDefined, isError, isInstance, isRecord, isString, parseJSON } from "@orkestrel/contract";
4
4
  import { ARTIFACT_GROUPS, AXES, BIN_ENTRY_PATH, CATALOG_AGENT_PATH, CONFORMANCE_TEST_PATH, Compiler, DEPENDENCY_NAME_PATTERN, ENVIRONMENTS, FRAMEWORKS, GLOBAL_SETUP_PATH, GUIDES_TEST_PATH, HOST_PATHS, INTEGRATION_TEST_PATH, JOURNEY_CONFIG_PATH, MAX_MANIFEST_BYTES, MAX_PATH_LENGTH, MAX_RANGE_LENGTH, RESERVED_SHEET_NAMES, SERVICE_SETUP_PATH, SHEET_ENTRY_NAME, SHOWCASE_CONFIG_PATH, SHOWCASE_DEV_DEPENDENCIES, SHOWCASE_PAGES_PATH, SKILLS_CONFIG_PATH, STYLES_ENTRY_PATH, ScaffoldError, THEMES_BARREL_PATH, THEMES_ENTRY_PATH, TREE_TEST_PATH, blueprintToConfigArtifacts, blueprintToDevDependencies, blueprintToFaces, blueprintToManifestOverrides, blueprintToProjects, blueprintToScripts, blueprintToSheets, blueprintToTestArtifacts, blueprintToToolchainHolds, blueprintToWritableScripts, collectSurfaceAdvisories, collectSurfaceCollisions, compareSurfaceCollisions, compareVersions, createBlueprint, extractRangeMajor, extractVersion, isFloorPath, isScaffoldError, isSheetName, iterateAnswers, manifestToDependencies, manifestToName, matchesGuideRefusal, nameToGuide, parseExtension, replaceManifestOverrides, replaceManifestScripts, replacePlanRanges } from "../src/core/index.js";
5
- import { MAX_INVENTORY_PATHS, Materializer, Upstream, filesToHost, isExactCaseFile, isPhysicalDirectory, isWorktree, listFiles, readFileText, readHostFloor, readHostManifest, readSnapshot, readSurfaceCandidate, readSurfaceFile, readSurfaceGuide, readSurfaceRecord, resolveContainedPath } from "../src/server/index.js";
5
+ import { MAX_INVENTORY_PATHS, Materializer, Upstream, filesToHost, isExactCaseFile, isPhysicalDirectory, isWorktree, listFiles, readFileText, readHostFloor, readHostManifest, readSnapshot, readSurfaceCandidate, readSurfaceFile, readSurfaceGuide, readSurfaceRecord, resolveContainedPath, resolveSurfaceLoader } from "../src/server/index.js";
6
6
  import { join, normalize, resolve } from "node:path";
7
7
  import { createDuplex } from "@orkestrel/process/server";
8
8
  import { createMarkdown, flattenText, isTableNode } from "@orkestrel/markdown";
@@ -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.121",
13
+ version: "0.0.123",
14
14
  description: "Scaffold workspaces with commands: new, audit, surface, repair, catalog, and overwrite.",
15
15
  keywords: [
16
16
  "audit",
@@ -114,7 +114,7 @@ var package_default = {
114
114
  "@orkestrel/browser": "^0.0.31",
115
115
  "@orkestrel/guide": "^0.0.29",
116
116
  "@orkestrel/html": "^0.0.14",
117
- "@orkestrel/probe": "^0.0.27",
117
+ "@orkestrel/probe": "^0.0.28",
118
118
  "@orkestrel/test": "^0.0.32",
119
119
  "@types/node": "^24.19.2",
120
120
  "@vitest/browser-playwright": "^5.0.5",
@@ -1924,20 +1924,22 @@ var CLI = class {
1924
1924
  const membership = upstream === void 0 ? void 0 : await this.#readMembership(upstream);
1925
1925
  const inventory = upstream === void 0 ? void 0 : await this.#readRecord(upstream);
1926
1926
  const target = resolve(command.target ?? process.cwd());
1927
- const candidates = [.../* @__PURE__ */ new Set([...command.checkouts.map((path) => resolve(path)), ...isExactCaseFile(join(target, "package.json")) ? [target] : []])].map((path) => readSurfaceCandidate(path));
1927
+ const paths = [.../* @__PURE__ */ new Set([...command.checkouts.map((path) => resolve(path)), ...isExactCaseFile(join(target, "package.json")) ? [target] : []])];
1928
+ const loader = resolveSurfaceLoader(paths);
1929
+ const candidates = paths.map((path) => readSurfaceCandidate(path, loader));
1928
1930
  const names = membership?.entries?.map(({ name }) => name) ?? catalogToNames(floor);
1929
1931
  const owners = [.../* @__PURE__ */ new Set([...candidates.map(({ owner }) => owner), ...names.map((name) => name.replace(/^@orkestrel\//u, ""))])].sort();
1930
1932
  const mirrors = upstream === void 0 ? [] : await upstream.fetch(owners.map((owner) => `@orkestrel/${owner}`), {});
1931
1933
  const published = new Map(owners.map((owner) => {
1932
1934
  const tolerant = candidates.some((candidate) => candidate.owner === owner);
1933
1935
  const live = mirrors.find((mirror) => mirror.name === `@orkestrel/${owner}`);
1934
- const read = live?.lookup === "found" ? attempt(() => readSurfaceGuide(live.content, owner, `live ${live.path}`)) : void 0;
1936
+ const read = live?.lookup === "found" ? attempt(() => readSurfaceGuide(live.content, owner, `live ${live.path}`, loader)) : void 0;
1935
1937
  if (read?.success === true) return [owner, {
1936
1938
  ...read.value,
1937
1939
  source: "live"
1938
1940
  }];
1939
1941
  if (read !== void 0 && !(tolerant && matchesGuideRefusal(read.error))) throw read.error;
1940
- const fallback = attempt(() => readSurfaceFile(floor, owner, "floor"));
1942
+ const fallback = attempt(() => readSurfaceFile(floor, owner, "floor", loader));
1941
1943
  if (fallback.success) return [owner, fallback.value === void 0 ? void 0 : {
1942
1944
  ...fallback.value,
1943
1945
  source: "floor"