@orkestrel/scaffold 0.0.45 → 0.0.47
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.
- package/dist/bin/main.js +179 -44
- package/dist/bin/main.js.map +1 -1
- package/dist/host/AGENTS.md +1 -0
- package/dist/host/agents/orchestration.md +3 -1
- package/dist/host/claude/agents/codex.md +4 -4
- package/dist/host/claude/agents/orkestrel.md +6 -5
- package/dist/host/claude/rules/documentation.md +2 -1
- package/dist/host/claude/rules/quality.md +3 -0
- package/dist/host/claude/rules/tests.md +19 -0
- package/dist/host/claude/rules/workspace.md +28 -21
- package/dist/host/claude/settings.json +781 -2
- package/dist/host/codex/config.toml +4 -0
- package/dist/host/configs/policy.ts +167 -10
- package/dist/host/cursor/mcp.json +4 -0
- package/dist/host/dotfiles/mcp.json +4 -0
- package/dist/host/dotfiles/oxlintrc.json +9 -0
- package/dist/host/guides/scaffold.md +143 -44
- package/dist/host/scripts/codex.sh +0 -0
- package/dist/host/scripts/cursor.sh +0 -0
- package/dist/host/scripts/deps.sh +0 -0
- package/dist/host/scripts/ollama.sh +0 -0
- package/dist/host/tests/config.test.ts +126 -11
- package/dist/host/tests/policy.test.ts +7 -0
- package/dist/host/tests/setupPolicy.ts +222 -8
- package/dist/src/core/index.cjs +420 -23
- package/dist/src/core/index.cjs.map +1 -1
- package/dist/src/core/index.d.cts +102 -9
- package/dist/src/core/index.d.ts +102 -9
- package/dist/src/core/index.js +416 -24
- package/dist/src/core/index.js.map +1 -1
- package/dist/src/server/index.cjs +41 -49
- package/dist/src/server/index.cjs.map +1 -1
- package/dist/src/server/index.d.cts +9 -8
- package/dist/src/server/index.d.ts +9 -8
- package/dist/src/server/index.js +42 -50
- package/dist/src/server/index.js.map +1 -1
- package/package.json +8 -5
|
@@ -2426,7 +2426,7 @@ var Materializer = class Materializer {
|
|
|
2426
2426
|
return this.#rewrite(directory, _src_core.CATALOG_AGENT_PATH, _src_core.MAX_ARTIFACT_BYTES, this.#recatalog(accepted));
|
|
2427
2427
|
}
|
|
2428
2428
|
/**
|
|
2429
|
-
* Rewrite the
|
|
2429
|
+
* Rewrite the declared dependency ranges the caller names in the target's manifest.
|
|
2430
2430
|
*
|
|
2431
2431
|
* @param dependencies - The names and ranges the manifest must declare.
|
|
2432
2432
|
* @param target - The directory to write into.
|
|
@@ -2925,45 +2925,12 @@ var Materializer = class Materializer {
|
|
|
2925
2925
|
}
|
|
2926
2926
|
#redeclare(dependencies) {
|
|
2927
2927
|
return (text) => {
|
|
2928
|
-
|
|
2929
|
-
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
let index = manifest.indexOf(key);
|
|
2933
|
-
let declared = false;
|
|
2934
|
-
while (index >= 0) {
|
|
2935
|
-
const span = this.#span(manifest, index + key.length);
|
|
2936
|
-
if (span === void 0) {
|
|
2937
|
-
index = manifest.indexOf(key, index + key.length);
|
|
2938
|
-
continue;
|
|
2939
|
-
}
|
|
2940
|
-
manifest = manifest.slice(0, span[0]) + range + manifest.slice(span[1]);
|
|
2941
|
-
declared = true;
|
|
2942
|
-
index = manifest.indexOf(key, span[0] + range.length);
|
|
2943
|
-
}
|
|
2944
|
-
if (!declared) throw this.#error("INVALID", `The manifest does not declare ${dependency.name}, so its range cannot be rewritten.`, { name: dependency.name });
|
|
2945
|
-
}
|
|
2946
|
-
return manifest;
|
|
2928
|
+
const manifest = (0, _src_core.replaceManifestRanges)(text, dependencies);
|
|
2929
|
+
if (manifest !== void 0) return manifest;
|
|
2930
|
+
const missing = dependencies.find((dependency) => !text.includes(JSON.stringify(dependency.name)));
|
|
2931
|
+
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 });
|
|
2947
2932
|
};
|
|
2948
2933
|
}
|
|
2949
|
-
#span(text, from) {
|
|
2950
|
-
let index = from;
|
|
2951
|
-
while (index < text.length && /\s/u.test(text.charAt(index))) index += 1;
|
|
2952
|
-
if (text.charAt(index) !== ":") return void 0;
|
|
2953
|
-
index += 1;
|
|
2954
|
-
while (index < text.length && /\s/u.test(text.charAt(index))) index += 1;
|
|
2955
|
-
if (text.charAt(index) !== "\"") return void 0;
|
|
2956
|
-
const start = index;
|
|
2957
|
-
index += 1;
|
|
2958
|
-
while (index < text.length) {
|
|
2959
|
-
if (text.charAt(index) === "\\") {
|
|
2960
|
-
index += 2;
|
|
2961
|
-
continue;
|
|
2962
|
-
}
|
|
2963
|
-
if (text.charAt(index) === "\"") return [start, index + 1];
|
|
2964
|
-
index += 1;
|
|
2965
|
-
}
|
|
2966
|
-
}
|
|
2967
2934
|
#finish(result) {
|
|
2968
2935
|
this.#emitter.emit("finish", result);
|
|
2969
2936
|
return result;
|
|
@@ -3028,7 +2995,6 @@ var Upstream = class Upstream {
|
|
|
3028
2995
|
static #defaultTimeout = 1e4;
|
|
3029
2996
|
static #defaultConcurrency = 6;
|
|
3030
2997
|
static #defaultRetries = 0;
|
|
3031
|
-
static #defaultBudget = 16777216;
|
|
3032
2998
|
static #scope = "orkestrel";
|
|
3033
2999
|
static #unreadable = "the answer carries no readable latest version";
|
|
3034
3000
|
static #packument = "application/vnd.npm.install-v1+json";
|
|
@@ -3076,15 +3042,15 @@ var Upstream = class Upstream {
|
|
|
3076
3042
|
this.#registryTimeout = options?.registry?.timeout ?? Upstream.#defaultTimeout;
|
|
3077
3043
|
this.#concurrency = options?.concurrency ?? Upstream.#defaultConcurrency;
|
|
3078
3044
|
this.#retries = options?.retries ?? Upstream.#defaultRetries;
|
|
3079
|
-
this.#limit = options?.limit ?? _src_core.
|
|
3080
|
-
this.#budget = options?.budget ??
|
|
3045
|
+
this.#limit = options?.limit ?? _src_core.MAX_REGISTRY_BYTES;
|
|
3046
|
+
this.#budget = options?.budget ?? _src_core.MAX_TOTAL_REGISTRY_BYTES;
|
|
3081
3047
|
}
|
|
3082
3048
|
/** The upstream reader's observation channel. */
|
|
3083
3049
|
get emitter() {
|
|
3084
3050
|
return this.#emitter;
|
|
3085
3051
|
}
|
|
3086
3052
|
/**
|
|
3087
|
-
* Look up the
|
|
3053
|
+
* Look up the newest release each declared range admits.
|
|
3088
3054
|
*
|
|
3089
3055
|
* @param dependencies - The declared dependencies to look up.
|
|
3090
3056
|
* @returns One release verdict per dependency, in input order.
|
|
@@ -3093,10 +3059,11 @@ var Upstream = class Upstream {
|
|
|
3093
3059
|
* torn down before or during the call.
|
|
3094
3060
|
*
|
|
3095
3061
|
* @remarks
|
|
3096
|
-
*
|
|
3097
|
-
*
|
|
3098
|
-
*
|
|
3099
|
-
*
|
|
3062
|
+
* The reader selects across the packument's stable version map before any
|
|
3063
|
+
* collection bound can truncate it. It falls back to `dist-tags.latest` only
|
|
3064
|
+
* when that version satisfies the declared range. `*` requests the newest
|
|
3065
|
+
* stable version outright. The verdict's `major` field carries the stable
|
|
3066
|
+
* major from the latest tag when that tag can be read.
|
|
3100
3067
|
*
|
|
3101
3068
|
* @example
|
|
3102
3069
|
* ```ts
|
|
@@ -3225,17 +3192,21 @@ var Upstream = class Upstream {
|
|
|
3225
3192
|
}
|
|
3226
3193
|
async #release(dependency, allowance) {
|
|
3227
3194
|
const outcome = await this.#read(this.#registryURL(dependency.name), this.#registryTimeout, allowance, Upstream.#packument);
|
|
3228
|
-
const latest = outcome.lookup === "found" ? this.#
|
|
3195
|
+
const latest = outcome.lookup === "found" ? this.#releaseVersion(outcome.content, dependency.range) : void 0;
|
|
3196
|
+
const tagged = outcome.lookup === "found" ? this.#latest(outcome.content) : void 0;
|
|
3197
|
+
const major = tagged === void 0 ? void 0 : (0, _src_core.extractVersion)(tagged)?.[0];
|
|
3229
3198
|
const release = latest === void 0 ? {
|
|
3230
3199
|
name: dependency.name,
|
|
3231
3200
|
range: dependency.range,
|
|
3232
3201
|
lookup: outcome.lookup === "missing" ? "missing" : "failed",
|
|
3233
|
-
note: outcome.lookup === "found" ? Upstream.#unreadable : outcome.note
|
|
3202
|
+
note: outcome.lookup === "found" ? Upstream.#unreadable : outcome.note,
|
|
3203
|
+
...major === void 0 ? {} : { major }
|
|
3234
3204
|
} : {
|
|
3235
3205
|
name: dependency.name,
|
|
3236
3206
|
range: dependency.range,
|
|
3237
3207
|
lookup: "found",
|
|
3238
|
-
latest
|
|
3208
|
+
latest,
|
|
3209
|
+
...major === void 0 ? {} : { major }
|
|
3239
3210
|
};
|
|
3240
3211
|
this.#emitter.emit("release", release);
|
|
3241
3212
|
return release;
|
|
@@ -3320,6 +3291,27 @@ var Upstream = class Upstream {
|
|
|
3320
3291
|
if (latest === void 0 || latest.length === 0 || latest.length > _src_core.MAX_RANGE_LENGTH) return;
|
|
3321
3292
|
return _src_core.CONTROL_CHARACTER_PATTERN.test(latest) ? void 0 : latest;
|
|
3322
3293
|
}
|
|
3294
|
+
#releaseVersion(content, range) {
|
|
3295
|
+
const parsed = (0, _orkestrel_contract.parseJSON)(content);
|
|
3296
|
+
if (!(0, _orkestrel_contract.isRecord)(parsed)) return void 0;
|
|
3297
|
+
const versions = parsed.versions;
|
|
3298
|
+
let selected;
|
|
3299
|
+
if ((0, _orkestrel_contract.isRecord)(versions)) for (const version of Object.keys(versions)) {
|
|
3300
|
+
if (!this.#admits(range, version)) continue;
|
|
3301
|
+
if (selected === void 0 || (0, _src_core.compareVersions)(version, selected) > 0) selected = version;
|
|
3302
|
+
}
|
|
3303
|
+
if (selected !== void 0) return selected;
|
|
3304
|
+
const latest = this.#latest(content);
|
|
3305
|
+
return latest !== void 0 && this.#admits(range, latest) ? latest : void 0;
|
|
3306
|
+
}
|
|
3307
|
+
#admits(range, version) {
|
|
3308
|
+
const extracted = (0, _src_core.extractVersion)(version);
|
|
3309
|
+
if (extracted === void 0) return false;
|
|
3310
|
+
if (range === "*") return true;
|
|
3311
|
+
const major = (0, _src_core.extractRangeMajor)(range);
|
|
3312
|
+
if (major !== void 0 && range === `^${String(major)}`) return extracted[0] === major;
|
|
3313
|
+
return (0, _src_core.matchesRange)(range, version);
|
|
3314
|
+
}
|
|
3323
3315
|
#registryURL(name) {
|
|
3324
3316
|
return `${this.#registryBase}/${encodeURIComponent(name).replaceAll("%40", "@")}`;
|
|
3325
3317
|
}
|