@orkestrel/scaffold 0.0.4 → 0.0.6

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.
@@ -153,8 +153,8 @@ export declare const DEFAULT_SYNC_TIMEOUT = 10000;
153
153
  * dev-installed for local testing) is likewise excluded from `extras` — it
154
154
  * already appears as a `peer`/`dependency` above, and double-counting it as
155
155
  * an `extra` would land it in `peers ∩ extras`, a blocking `validateBlueprint`
156
- * gate. `overrides` is always `[]` — derivation cannot know a caller's
157
- * template-override intent.
156
+ * gate. `overrides` is always `[]` — derivation cannot recover a caller's
157
+ * artifact-override intent from repository state.
158
158
  * @returns The reconstructed `Blueprint`.
159
159
  * @throws `ScaffoldError('TARGET', …)` when `target`'s manifest is unreadable
160
160
  * (via `readManifest`), is not valid JSON, its name is unsafe for its
@@ -210,6 +210,8 @@ export declare function discardWriteTransaction(transaction: WriteTransaction):
210
210
  * `@orkestrel/`. A child with an unreadable or unparsable `package.json`,
211
211
  * or a non-`@orkestrel` name, is skipped silently — it simply is not a
212
212
  * fleet member.
213
+ * @throws `ScaffoldError('TARGET', …)` when a child directory name contains
214
+ * terminal controls and therefore cannot be safely inspected or reported.
213
215
  *
214
216
  * @example
215
217
  * ```ts
@@ -153,8 +153,8 @@ export declare const DEFAULT_SYNC_TIMEOUT = 10000;
153
153
  * dev-installed for local testing) is likewise excluded from `extras` — it
154
154
  * already appears as a `peer`/`dependency` above, and double-counting it as
155
155
  * an `extra` would land it in `peers ∩ extras`, a blocking `validateBlueprint`
156
- * gate. `overrides` is always `[]` — derivation cannot know a caller's
157
- * template-override intent.
156
+ * gate. `overrides` is always `[]` — derivation cannot recover a caller's
157
+ * artifact-override intent from repository state.
158
158
  * @returns The reconstructed `Blueprint`.
159
159
  * @throws `ScaffoldError('TARGET', …)` when `target`'s manifest is unreadable
160
160
  * (via `readManifest`), is not valid JSON, its name is unsafe for its
@@ -210,6 +210,8 @@ export declare function discardWriteTransaction(transaction: WriteTransaction):
210
210
  * `@orkestrel/`. A child with an unreadable or unparsable `package.json`,
211
211
  * or a non-`@orkestrel` name, is skipped silently — it simply is not a
212
212
  * fleet member.
213
+ * @throws `ScaffoldError('TARGET', …)` when a child directory name contains
214
+ * terminal controls and therefore cannot be safely inspected or reported.
213
215
  *
214
216
  * @example
215
217
  * ```ts
@@ -1,4 +1,4 @@
1
- import { CONTROL_CHARACTER_PATTERN, DEFAULT_ENGINES, DEFAULT_VERSION, DEPENDENCY_NAME_PATTERN, ENVIRONMENTS, HEX_PATTERN, HOST_PATHS, INVALID_PATH_CHARACTER_PATTERN, MAX_ARTIFACT_BYTES, MAX_ARTIFACT_HEX_LENGTH, MAX_COLLECTION_ITEMS, MAX_MANIFEST_BYTES, MAX_PATH_LENGTH, MAX_TOTAL_ARTIFACT_BYTES, SYNC_BASELINE_PATTERN, ScaffoldError, VERSION_PATTERN, blueprint, bytesToHex, contentByteLength, devDependenciesFor, diffPlan, findFileConflict, findPathConflict, hasOnlyDataProperties, hasValidAuditBytes, hasValidSnapshotBytes, isDenseDataArray, isDependency, isEmitterErrorHandler, isPlan, isSyncReport, isWorkspaceName, manifestToDependencies, ownDataValue, parsePlan, parseSyncReport, rangeToFreshness, snapshotPlan, validateDependencyArray, validatePlan } from "../core/index.js";
1
+ import { CONTROL_CHARACTER_PATTERN, DEFAULT_ENGINES, DEFAULT_VERSION, DEPENDENCY_NAME_PATTERN, ENVIRONMENTS, HEX_PATTERN, HOST_PATHS, INVALID_PATH_CHARACTER_PATTERN, MAX_ARTIFACT_BYTES, MAX_ARTIFACT_HEX_LENGTH, MAX_COLLECTION_ITEMS, MAX_MANIFEST_BYTES, MAX_PATH_LENGTH, MAX_TOTAL_ARTIFACT_BYTES, SYNC_BASELINE_PATTERN, ScaffoldError, VERSION_PATTERN, blueprint, bytesToHex, contentByteLength, devDependenciesFor, diffPlan, findFileConflict, findPathConflict, hasOnlyDataProperties, hasValidAuditBytes, hasValidSnapshotBytes, isDenseDataArray, isDependency, isEmitterErrorHandler, isPlan, isSyncReport, isWorkspaceName, manifestToDependencies, manifestToName, ownDataValue, parsePlan, parseSyncReport, rangeToFreshness, snapshotPlan, validateDependencyArray, validatePlan } from "../core/index.js";
2
2
  import { attempt, booleanShape, createContract, integerShape, isError, isFunction, isRecord, isString, objectShape, optionalShape, parseJSON, parseJSONAs, stringShape } from "@orkestrel/contract";
3
3
  import { createHash, randomUUID } from "node:crypto";
4
4
  import { chmodSync, closeSync, constants, copyFileSync, existsSync, fstatSync, linkSync, lstatSync, mkdirSync, openSync, opendirSync, readSync, realpathSync, renameSync, rmSync, rmdirSync, writeFileSync } from "node:fs";
@@ -1747,8 +1747,8 @@ function selectOrkestrelEntries(value) {
1747
1747
  * dev-installed for local testing) is likewise excluded from `extras` — it
1748
1748
  * already appears as a `peer`/`dependency` above, and double-counting it as
1749
1749
  * an `extra` would land it in `peers ∩ extras`, a blocking `validateBlueprint`
1750
- * gate. `overrides` is always `[]` — derivation cannot know a caller's
1751
- * template-override intent.
1750
+ * gate. `overrides` is always `[]` — derivation cannot recover a caller's
1751
+ * artifact-override intent from repository state.
1752
1752
  * @returns The reconstructed `Blueprint`.
1753
1753
  * @throws `ScaffoldError('TARGET', …)` when `target`'s manifest is unreadable
1754
1754
  * (via `readManifest`), is not valid JSON, its name is unsafe for its
@@ -2860,6 +2860,8 @@ function consumeCatalogAllowance(allowance, root) {
2860
2860
  * `@orkestrel/`. A child with an unreadable or unparsable `package.json`,
2861
2861
  * or a non-`@orkestrel` name, is skipped silently — it simply is not a
2862
2862
  * fleet member.
2863
+ * @throws `ScaffoldError('TARGET', …)` when a child directory name contains
2864
+ * terminal controls and therefore cannot be safely inspected or reported.
2863
2865
  *
2864
2866
  * @example
2865
2867
  * ```ts
@@ -2887,6 +2889,7 @@ function discoverPackages(root, allowance = new Float64Array([MAX_HOST_ENTRIES])
2887
2889
  if (entry === null) break;
2888
2890
  consumeCatalogAllowance(allowance, root);
2889
2891
  if (!entry.isDirectory()) continue;
2892
+ if (!isTerminalText(entry.name)) throw new ScaffoldError("TARGET", "Fleet discovery found a non-portable directory");
2890
2893
  const directory = join(root, entry.name);
2891
2894
  const text = attempt(() => readFileText(directory, "package.json", "TARGET", "package", MAX_MANIFEST_BYTES));
2892
2895
  if (!text.success) continue;
@@ -3601,12 +3604,15 @@ var Sync = class Sync {
3601
3604
  }
3602
3605
  async pull(target, dependencies) {
3603
3606
  this.#ensureAlive();
3604
- const declared = manifestToDependencies(readManifest(target));
3607
+ const manifest = readManifest(target);
3608
+ const declared = manifestToDependencies(manifest);
3605
3609
  const deps = dependencies === void 0 ? declared : parseSyncDependencies(dependencies, false);
3606
3610
  if (dependencies !== void 0 && deps.some((dependency) => !declared.some((candidate) => candidate.name === dependency.name && candidate.range === dependency.range))) throw new ScaffoldError("INVALID", "Sync pull selection is not declared by the target");
3607
- const current = readGuideReferences(target, deps);
3611
+ const name = manifestToName(manifest);
3612
+ const guideDependencies = name === void 0 ? deps : deps.filter((dependency) => dependency.name !== name);
3613
+ const current = readGuideReferences(target, guideDependencies);
3608
3614
  const allowance = Float64Array.of(this.#budget);
3609
- const report = syncReportOf(target, await this.#guides(deps, current, allowance), await this.#versions(deps, allowance));
3615
+ const report = syncReportOf(target, await this.#guides(guideDependencies, current, allowance), await this.#versions(deps, allowance));
3610
3616
  this.#emitter.emit("done", report);
3611
3617
  return report;
3612
3618
  }