@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
@@ -630,7 +630,7 @@ export declare function isInventory(value: unknown): value is readonly unknown[]
630
630
  * The whole closed record a manifest-writing method accepts, so a caller
631
631
  * naming a region the writer does not carry is refused before any byte moves.
632
632
  * Each region is bounded by the same collection law its own list guard applies,
633
- * and `additions` is the one region a caller may omit.
633
+ * and `additions`, `overrides`, and `entries` are the regions a caller may omit.
634
634
  *
635
635
  * @example
636
636
  * ```ts
@@ -1397,7 +1397,8 @@ export declare class Materializer implements MaterializerInterface {
1397
1397
  * the manifest does not declare is the caller's mistake and throws. A script
1398
1398
  * holding a value the region does not accept is the workspace author's own
1399
1399
  * chain, so the script region is skipped without a byte moving and the range
1400
- * region is still written. The advisory channel reports what the maintainer
1400
+ * region is still written. An entry section holding another shape is the package's own
1401
+ * value, so the entry region is skipped the same way. The advisory channel reports what the maintainer
1401
1402
  * must paste.
1402
1403
  */
1403
1404
  declare(regions: ManifestRegionSet, target: string): MaterializeResult;
@@ -630,7 +630,7 @@ export declare function isInventory(value: unknown): value is readonly unknown[]
630
630
  * The whole closed record a manifest-writing method accepts, so a caller
631
631
  * naming a region the writer does not carry is refused before any byte moves.
632
632
  * Each region is bounded by the same collection law its own list guard applies,
633
- * and `additions` is the one region a caller may omit.
633
+ * and `additions`, `overrides`, and `entries` are the regions a caller may omit.
634
634
  *
635
635
  * @example
636
636
  * ```ts
@@ -1397,7 +1397,8 @@ export declare class Materializer implements MaterializerInterface {
1397
1397
  * the manifest does not declare is the caller's mistake and throws. A script
1398
1398
  * holding a value the region does not accept is the workspace author's own
1399
1399
  * chain, so the script region is skipped without a byte moving and the range
1400
- * region is still written. The advisory channel reports what the maintainer
1400
+ * region is still written. An entry section holding another shape is the package's own
1401
+ * value, so the entry region is skipped the same way. The advisory channel reports what the maintainer
1401
1402
  * must paste.
1402
1403
  */
1403
1404
  declare(regions: ManifestRegionSet, target: string): MaterializeResult;
@@ -1,6 +1,6 @@
1
1
  import { createRequire } from "node:module";
2
2
  import { andOf, arrayOf, attempt, boundsOf, comparePrimitives, compileGuard, holds, isArray, isBoolean, isDefined, isError, isFunction, isInteger, isNonNegativeInteger, isNumber, isObject, isRecord, isString, parseJSON, parseJSONAs, parseStringField, recordOf, recordShape, stringOf, stringShape, unionOf, whereOf } from "@orkestrel/contract";
3
- import { AXES, CANON_PATHS, CATALOG_AGENT_PATH, CATALOG_END_MARKER, CATALOG_START_MARKER, CONTROL_CHARACTER_PATTERN, DEPENDENCY_NAME_PATTERN, ENVIRONMENTS, EXECUTABLE_PATHS, FRAMEWORKS, HOST_INVENTORY_PATH, HOST_PATHS, MAX_ARTIFACT_BYTES, MAX_COLLECTION_ITEMS, MAX_DEPENDENCY_NAME_LENGTH, MAX_MANIFEST_BYTES, MAX_PATH_LENGTH, MAX_RANGE_LENGTH, MAX_REGISTRY_BYTES, MAX_TOTAL_ARTIFACT_BYTES, MAX_TOTAL_REGISTRY_BYTES, REFERENCE_PATHS, SURFACE_TRANSFERS, ScaffoldError, blueprintToConfigArtifacts, bytesToHex, catalogToLayers, collectSurfaceCollisions, collectSurfaceConflicts, compareSurfaceCollisions, compareVersions, computeBytes, computeTotal, contentToHex, createBlueprint, extractRangeMajor, extractVersion, inferArtifactGroup, insertManifestDependencies, isAudit, isCatalogEntry, isCollection, isDependency, isDependencyName, isFloorPath, isHexContent, isManifestScript, isMirror, isPath, isPlan, isRetainedPath, isSnapshot, iterateAnswers, manifestToName, matchesArtifactDriftReachability, matchesRange, nameToGuide, parseOwnedJSONValue, planToArtifactFindings, renderSkillPointer, replaceManifestOverrides, replaceManifestRanges, replaceManifestScripts } from "../core/index.js";
3
+ import { AXES, CANON_PATHS, CATALOG_AGENT_PATH, CATALOG_END_MARKER, CATALOG_START_MARKER, CONTROL_CHARACTER_PATTERN, DEPENDENCY_NAME_PATTERN, ENVIRONMENTS, EXECUTABLE_PATHS, FRAMEWORKS, HOST_INVENTORY_PATH, HOST_PATHS, MAX_ARTIFACT_BYTES, MAX_COLLECTION_ITEMS, MAX_DEPENDENCY_NAME_LENGTH, MAX_MANIFEST_BYTES, MAX_PATH_LENGTH, MAX_RANGE_LENGTH, MAX_REGISTRY_BYTES, MAX_TOTAL_ARTIFACT_BYTES, MAX_TOTAL_REGISTRY_BYTES, REFERENCE_PATHS, SURFACE_TRANSFERS, ScaffoldError, blueprintToConfigArtifacts, bytesToHex, catalogToLayers, collectSurfaceCollisions, collectSurfaceConflicts, compareSurfaceCollisions, compareVersions, computeBytes, computeTotal, contentToHex, createBlueprint, extractRangeMajor, extractVersion, inferArtifactGroup, insertManifestDependencies, insertManifestEntries, isAudit, isCatalogEntry, isCollection, isDependency, isDependencyName, isFloorPath, isHexContent, isManifestScript, isMirror, isPath, isPlan, isRetainedPath, isSnapshot, iterateAnswers, manifestToName, matchesArtifactDriftReachability, matchesRange, nameToGuide, parseOwnedJSONValue, planToArtifactFindings, renderSkillPointer, replaceManifestOverrides, replaceManifestRanges, replaceManifestScripts } from "../core/index.js";
4
4
  import { createHash, randomUUID } from "node:crypto";
5
5
  import { chmodSync, closeSync, constants, copyFileSync, fstatSync, linkSync, lstatSync, mkdirSync, mkdtempSync, openSync, opendirSync, readSync, readdirSync, readlinkSync, realpathSync, renameSync, rmSync, rmdirSync, writeFileSync } from "node:fs";
6
6
  import { tmpdir } from "node:os";
@@ -1045,7 +1045,7 @@ function listWrapperPaths(target, groups) {
1045
1045
  name,
1046
1046
  axes: AXES
1047
1047
  })),
1048
- bin: true,
1048
+ bin: ["main"],
1049
1049
  styles: true,
1050
1050
  themes: true,
1051
1051
  showcase: true,
@@ -1090,8 +1090,6 @@ function pruneEmptiedDirectories(target, removed) {
1090
1090
  return [...new Set(Iterator.from(removed).flatMap((path) => listAncestors(path).slice(1, -1)).toArray())].sort((left, right) => comparePrimitives(right.split("/").length, left.split("/").length) || comparePrimitives(left, right)).flatMap((candidate) => {
1091
1091
  const directory = resolveContainedPath(target, candidate);
1092
1092
  if (directory === void 0 || !isPhysicalDirectory(directory)) return [];
1093
- const entries = attempt(() => readdirSync(directory));
1094
- if (!entries.success || entries.value.length > 0) return [];
1095
1093
  return attempt(() => rmdirSync(directory)).success ? [candidate] : [];
1096
1094
  });
1097
1095
  }
@@ -1940,7 +1938,7 @@ function readSurfaceCandidate(root, loader) {
1940
1938
  const owner = name.replace(/^@orkestrel\//u, "");
1941
1939
  const guide = readSurfaceFile(root, owner, "candidate", loader);
1942
1940
  const source = join(root, "src");
1943
- if (guide === void 0 && !isPhysicalDirectory(source)) throw new ScaffoldError("TARGET", `Surface candidate ${JSON.stringify(root.slice(0, 512))} has neither ${JSON.stringify(`guides/${owner}.md`)} nor src/. Add its guide or source directory before checking its claims.`, { root });
1941
+ if (guide === void 0 && !isPhysicalDirectory(source)) throw new ScaffoldError("TARGET", `Surface candidate ${JSON.stringify(root.slice(0, 512))} publishes no surface: it has neither ${JSON.stringify(`guides/${owner}.md`)} nor src/, as an app-only workspace has neither. Its test:policy surface rule enforces fleet name ownership over its exports, so run npm run test:policy there; add its guide or src/ only when the package is meant to publish names.`, { root });
1944
1942
  const reflection = readSurfaceModule(loader);
1945
1943
  const files = Object.fromEntries(listFiles(source).filter((file) => file.endsWith(".ts")).map((file) => {
1946
1944
  const text = readFileText(source, file);
@@ -2471,7 +2469,7 @@ var isDependencies = andOf(isCollection, arrayOf(isDependency));
2471
2469
  * The whole closed record a manifest-writing method accepts, so a caller
2472
2470
  * naming a region the writer does not carry is refused before any byte moves.
2473
2471
  * Each region is bounded by the same collection law its own list guard applies,
2474
- * and `additions` is the one region a caller may omit.
2472
+ * and `additions`, `overrides`, and `entries` are the regions a caller may omit.
2475
2473
  *
2476
2474
  * @example
2477
2475
  * ```ts
@@ -2496,8 +2494,17 @@ var isManifestRegionSet = recordOf({
2496
2494
  runtime: isDependencies,
2497
2495
  development: isDependencies
2498
2496
  }),
2499
- overrides: compileGuard(recordShape(recordShape(stringShape())))
2500
- }, ["additions", "overrides"]);
2497
+ overrides: compileGuard(recordShape(recordShape(stringShape()))),
2498
+ entries: recordOf({
2499
+ bin: compileGuard(recordShape(stringShape())),
2500
+ files: andOf(isCollection, arrayOf(isString)),
2501
+ exports: isRecord
2502
+ })
2503
+ }, [
2504
+ "additions",
2505
+ "overrides",
2506
+ "entries"
2507
+ ]);
2501
2508
  /** Narrows a value to a bounded list of fetched guide mirrors. */
2502
2509
  var isMirrors = andOf(isCollection, arrayOf(isMirror));
2503
2510
  /** Narrows a value to a bounded list of fleet catalog rows. */
@@ -3065,7 +3072,7 @@ var WriteTransaction = class {
3065
3072
  const destination = resolve(path);
3066
3073
  const { anchor: located, missing } = this.#locate(destination);
3067
3074
  const created = [];
3068
- for (const segment of [...missing].reverse()) {
3075
+ for (const segment of missing.toReversed()) {
3069
3076
  const anchor = created.at(-1) ?? located;
3070
3077
  if (!matchesAnchor(anchor)) throw new ScaffoldError("WRITE", `The directory at ${anchor.path} changed while writing.`, {
3071
3078
  path: destination,
@@ -3141,10 +3148,10 @@ var WriteTransaction = class {
3141
3148
  renameSync(expectation.path, backup);
3142
3149
  }
3143
3150
  #recover(promoted, taken) {
3144
- const restoreFailures = [...[...taken].reverse().flatMap((path) => {
3151
+ const restoreFailures = [...taken.toReversed().flatMap((path) => {
3145
3152
  const restored = attempt(() => renameSync(this.#resolve(this.#backup, path), this.#expectation(path).path));
3146
3153
  return restored.success ? [] : [restored.error];
3147
- }), ...[...promoted].reverse().flatMap((path) => {
3154
+ }), ...promoted.toReversed().flatMap((path) => {
3148
3155
  const expectation = this.#expectation(path);
3149
3156
  const restored = attempt(() => {
3150
3157
  if (expectation.shape === "absent") {
@@ -3160,7 +3167,7 @@ var WriteTransaction = class {
3160
3167
  force: true
3161
3168
  })) : void 0;
3162
3169
  const clearFailures = cleared === void 0 || cleared.success ? [] : [cleared.error];
3163
- const removeFailures = [...this.#created].reverse().flatMap((created) => {
3170
+ const removeFailures = this.#created.toReversed().flatMap((created) => {
3164
3171
  const path = isString(created) ? created : created.path;
3165
3172
  const removed = attempt(() => rmdirSync(path));
3166
3173
  return !removed.success && !matchesMissingPath(removed.error) ? [removed.error] : [];
@@ -3513,7 +3520,8 @@ var Materializer = class {
3513
3520
  * the manifest does not declare is the caller's mistake and throws. A script
3514
3521
  * holding a value the region does not accept is the workspace author's own
3515
3522
  * chain, so the script region is skipped without a byte moving and the range
3516
- * region is still written. The advisory channel reports what the maintainer
3523
+ * region is still written. An entry section holding another shape is the package's own
3524
+ * value, so the entry region is skipped the same way. The advisory channel reports what the maintainer
3517
3525
  * must paste.
3518
3526
  */
3519
3527
  declare(regions, target) {
@@ -4107,7 +4115,8 @@ var Materializer = class {
4107
4115
  const missing = [...regions.pins.runtime, ...regions.pins.development].find((dependency) => !text.includes(JSON.stringify(dependency.name)));
4108
4116
  throw this.#error("INVALID", `The manifest does not declare ${missing?.name ?? "a requested package"}, so its range cannot be rewritten.`, missing === void 0 ? void 0 : { name: missing.name });
4109
4117
  }
4110
- return replaceManifestScripts(manifest, regions.scripts) ?? manifest;
4118
+ const scripted = replaceManifestScripts(manifest, regions.scripts) ?? manifest;
4119
+ return regions.entries === void 0 ? scripted : insertManifestEntries(scripted, regions.entries) ?? scripted;
4111
4120
  };
4112
4121
  }
4113
4122
  #finish(result) {
@@ -4673,7 +4682,7 @@ var Upstream = class {
4673
4682
  url,
4674
4683
  count: names.length
4675
4684
  });
4676
- return [...names].sort();
4685
+ return names.toSorted();
4677
4686
  }
4678
4687
  #latest(content) {
4679
4688
  const parsed = parseJSON(content);