@osfactory/har 1.10.0 → 1.11.0
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/index.js +285 -124
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -593,8 +593,8 @@ var init_parseUtil = __esm({
|
|
|
593
593
|
init_errors();
|
|
594
594
|
init_en();
|
|
595
595
|
makeIssue = (params) => {
|
|
596
|
-
const { data, path:
|
|
597
|
-
const fullPath = [...
|
|
596
|
+
const { data, path: path101, errorMaps, issueData } = params;
|
|
597
|
+
const fullPath = [...path101, ...issueData.path || []];
|
|
598
598
|
const fullIssue = {
|
|
599
599
|
...issueData,
|
|
600
600
|
path: fullPath
|
|
@@ -902,11 +902,11 @@ var init_types = __esm({
|
|
|
902
902
|
init_parseUtil();
|
|
903
903
|
init_util();
|
|
904
904
|
ParseInputLazyPath = class {
|
|
905
|
-
constructor(parent, value,
|
|
905
|
+
constructor(parent, value, path101, key) {
|
|
906
906
|
this._cachedPath = [];
|
|
907
907
|
this.parent = parent;
|
|
908
908
|
this.data = value;
|
|
909
|
-
this._path =
|
|
909
|
+
this._path = path101;
|
|
910
910
|
this._key = key;
|
|
911
911
|
}
|
|
912
912
|
get path() {
|
|
@@ -4332,8 +4332,15 @@ var init_schema = __esm({
|
|
|
4332
4332
|
* Harness runtime-contract version (#241) — the shape of the installed
|
|
4333
4333
|
* `.har/` surface (thin shims + pure config = '1.0.0'). Absent on pre-1.0
|
|
4334
4334
|
* harnesses; the migration registry (src/harness/migrations.ts) keys on it.
|
|
4335
|
+
* Not the CLI that wrote the harness — that is `cliVersion`.
|
|
4335
4336
|
*/
|
|
4336
4337
|
runtimeVersion: external_exports.string().optional(),
|
|
4338
|
+
/**
|
|
4339
|
+
* @osfactory/har version that last wrote this harness (#344).
|
|
4340
|
+
* Stamped by init / maintain / add-plugin / line add. Doctor compares it
|
|
4341
|
+
* to the running CLI and stops with an upgrade error when the CLI is older.
|
|
4342
|
+
*/
|
|
4343
|
+
cliVersion: external_exports.string().optional(),
|
|
4337
4344
|
/** Shape this harness was migrated from ('pre-1.0'), stamped at migration (#241). */
|
|
4338
4345
|
migratedFrom: external_exports.string().optional(),
|
|
4339
4346
|
migratedAt: external_exports.string().optional(),
|
|
@@ -35421,8 +35428,20 @@ function readManifest(repoPath) {
|
|
|
35421
35428
|
return result.success ? result.data : null;
|
|
35422
35429
|
}
|
|
35423
35430
|
function writeManifest(repoPath, manifest) {
|
|
35431
|
+
const stamped = {
|
|
35432
|
+
...manifest,
|
|
35433
|
+
cliVersion: getHarPackageVersion()
|
|
35434
|
+
};
|
|
35424
35435
|
const manifestPath = getManifestPath(repoPath);
|
|
35425
|
-
writeFileSafe(manifestPath, JSON.stringify(
|
|
35436
|
+
writeFileSafe(manifestPath, JSON.stringify(stamped, null, 2) + "\n");
|
|
35437
|
+
}
|
|
35438
|
+
function stampManifestWriter(repoPath) {
|
|
35439
|
+
const existing = readManifest(repoPath);
|
|
35440
|
+
if (!existing) return;
|
|
35441
|
+
writeManifest(repoPath, {
|
|
35442
|
+
...existing,
|
|
35443
|
+
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
35444
|
+
});
|
|
35426
35445
|
}
|
|
35427
35446
|
function computeFileChecksum(content) {
|
|
35428
35447
|
return crypto.createHash("sha256").update(content).digest("hex").slice(0, 16);
|
|
@@ -35452,6 +35471,7 @@ function createManifest(repoPath, adaptationSummary, stack, profile, templateChe
|
|
|
35452
35471
|
return {
|
|
35453
35472
|
version: MANIFEST_VERSION,
|
|
35454
35473
|
runtimeVersion: HARNESS_RUNTIME_VERSION,
|
|
35474
|
+
cliVersion: getHarPackageVersion(),
|
|
35455
35475
|
outputDir: DEFAULT_HAR_DIR,
|
|
35456
35476
|
createdAt: now,
|
|
35457
35477
|
updatedAt: now,
|
|
@@ -35482,6 +35502,7 @@ var init_manifest = __esm({
|
|
|
35482
35502
|
crypto = __toESM(require("crypto"));
|
|
35483
35503
|
fs4 = __toESM(require("fs"));
|
|
35484
35504
|
path4 = __toESM(require("path"));
|
|
35505
|
+
init_package_version();
|
|
35485
35506
|
init_schema2();
|
|
35486
35507
|
init_file_ops();
|
|
35487
35508
|
MANIFEST_VERSION = "1";
|
|
@@ -35776,7 +35797,7 @@ function runScriptCapture(scriptPath, args = [], options = {}) {
|
|
|
35776
35797
|
const stream = options.stream ?? false;
|
|
35777
35798
|
const echoStdout = stream && (options.streamStdout ?? true);
|
|
35778
35799
|
const { stream: _stream, streamStdout: _streamStdout, ...spawnOptions } = options;
|
|
35779
|
-
return new Promise((
|
|
35800
|
+
return new Promise((resolve70) => {
|
|
35780
35801
|
const proc = (0, import_child_process.spawn)("bash", [scriptPath, ...args], {
|
|
35781
35802
|
...spawnOptions,
|
|
35782
35803
|
stdio: ["inherit", "pipe", "pipe"]
|
|
@@ -35791,14 +35812,14 @@ function runScriptCapture(scriptPath, args = [], options = {}) {
|
|
|
35791
35812
|
stderr += d;
|
|
35792
35813
|
if (stream) process.stderr.write(d);
|
|
35793
35814
|
});
|
|
35794
|
-
proc.on("close", (code) =>
|
|
35815
|
+
proc.on("close", (code) => resolve70({ stdout, stderr, code: code ?? 0 }));
|
|
35795
35816
|
});
|
|
35796
35817
|
}
|
|
35797
35818
|
function runShellCommand(command2, options = {}) {
|
|
35798
35819
|
const stream = options.stream ?? false;
|
|
35799
35820
|
const echoStdout = stream && (options.streamStdout ?? true);
|
|
35800
35821
|
const { stream: _stream, streamStdout: _streamStdout, ...spawnOptions } = options;
|
|
35801
|
-
return new Promise((
|
|
35822
|
+
return new Promise((resolve70) => {
|
|
35802
35823
|
const proc = (0, import_child_process.spawn)("bash", ["-lc", command2], {
|
|
35803
35824
|
...spawnOptions,
|
|
35804
35825
|
stdio: ["inherit", "pipe", "pipe"]
|
|
@@ -35813,7 +35834,7 @@ function runShellCommand(command2, options = {}) {
|
|
|
35813
35834
|
stderr += d;
|
|
35814
35835
|
if (stream) process.stderr.write(d);
|
|
35815
35836
|
});
|
|
35816
|
-
proc.on("close", (code) =>
|
|
35837
|
+
proc.on("close", (code) => resolve70({ stdout, stderr, code: code ?? 0 }));
|
|
35817
35838
|
});
|
|
35818
35839
|
}
|
|
35819
35840
|
var import_child_process;
|
|
@@ -37247,14 +37268,14 @@ function ensureWorkEvidenceIgnored(harnessRoot) {
|
|
|
37247
37268
|
fs17.writeFileSync(gitignorePath, `${content}${separator}${missing.join("\n")}
|
|
37248
37269
|
`);
|
|
37249
37270
|
}
|
|
37250
|
-
function listRecords(harnessRoot, dir,
|
|
37271
|
+
function listRecords(harnessRoot, dir, parse5) {
|
|
37251
37272
|
const recordDir = harEvidenceDir(harnessRoot, dir);
|
|
37252
37273
|
if (!fs17.existsSync(recordDir)) return [];
|
|
37253
37274
|
const records = [];
|
|
37254
37275
|
for (const name of fs17.readdirSync(recordDir)) {
|
|
37255
37276
|
if (!name.endsWith(".json")) continue;
|
|
37256
37277
|
try {
|
|
37257
|
-
records.push(
|
|
37278
|
+
records.push(parse5(JSON.parse(fs17.readFileSync(path17.join(recordDir, name), "utf8"))));
|
|
37258
37279
|
} catch {
|
|
37259
37280
|
}
|
|
37260
37281
|
}
|
|
@@ -37652,7 +37673,7 @@ var init_results = __esm({
|
|
|
37652
37673
|
|
|
37653
37674
|
// src/runtime/exec.ts
|
|
37654
37675
|
function spawnResult(cmd, args, opts, shell) {
|
|
37655
|
-
return new Promise((
|
|
37676
|
+
return new Promise((resolve70) => {
|
|
37656
37677
|
const stream = opts.stream ?? false;
|
|
37657
37678
|
const proc = (0, import_child_process4.spawn)(cmd, args, {
|
|
37658
37679
|
cwd: opts.cwd,
|
|
@@ -37664,8 +37685,8 @@ function spawnResult(cmd, args, opts, shell) {
|
|
|
37664
37685
|
let stderr = "";
|
|
37665
37686
|
proc.stdout?.on("data", (c) => stdout += c.toString());
|
|
37666
37687
|
proc.stderr?.on("data", (c) => stderr += c.toString());
|
|
37667
|
-
proc.on("error", (err) =>
|
|
37668
|
-
proc.on("close", (code) =>
|
|
37688
|
+
proc.on("error", (err) => resolve70({ code: 127, stdout, stderr: stderr || String(err) }));
|
|
37689
|
+
proc.on("close", (code) => resolve70({ code: code ?? 1, stdout, stderr }));
|
|
37669
37690
|
});
|
|
37670
37691
|
}
|
|
37671
37692
|
var import_child_process4, fs18, path19, realSystemOps, defaultExec, stderrLog, realSleep;
|
|
@@ -37728,7 +37749,7 @@ var init_exec = __esm({
|
|
|
37728
37749
|
process.stderr.write(`==> ${message}
|
|
37729
37750
|
`);
|
|
37730
37751
|
};
|
|
37731
|
-
realSleep = (seconds) => new Promise((
|
|
37752
|
+
realSleep = (seconds) => new Promise((resolve70) => setTimeout(resolve70, seconds * 1e3));
|
|
37732
37753
|
}
|
|
37733
37754
|
});
|
|
37734
37755
|
|
|
@@ -43702,7 +43723,7 @@ async function attempt(url) {
|
|
|
43702
43723
|
async function readControlJson(url) {
|
|
43703
43724
|
const first = await attempt(url);
|
|
43704
43725
|
if (first.read.ok || !first.retryable) return first.read;
|
|
43705
|
-
await new Promise((
|
|
43726
|
+
await new Promise((resolve70) => setTimeout(resolve70, RETRY_DELAY_MS));
|
|
43706
43727
|
return (await attempt(url)).read;
|
|
43707
43728
|
}
|
|
43708
43729
|
async function readControlPages(options) {
|
|
@@ -44193,7 +44214,7 @@ async function postForResponse(url, headers, payload) {
|
|
|
44193
44214
|
} catch (err) {
|
|
44194
44215
|
lastErr = err;
|
|
44195
44216
|
if (attempt2 < MAX_FETCH_ATTEMPTS) {
|
|
44196
|
-
await new Promise((
|
|
44217
|
+
await new Promise((resolve70) => setTimeout(resolve70, attempt2 * 100));
|
|
44197
44218
|
}
|
|
44198
44219
|
}
|
|
44199
44220
|
}
|
|
@@ -44450,7 +44471,7 @@ async function waitForControlApi(apiUrl = getControlApiUrl(), timeoutMs = 6e4, i
|
|
|
44450
44471
|
const deadline = Date.now() + timeoutMs;
|
|
44451
44472
|
while (Date.now() < deadline) {
|
|
44452
44473
|
if (await isControlApiReachable(apiUrl)) return true;
|
|
44453
|
-
await new Promise((
|
|
44474
|
+
await new Promise((resolve70) => setTimeout(resolve70, intervalMs));
|
|
44454
44475
|
}
|
|
44455
44476
|
return false;
|
|
44456
44477
|
}
|
|
@@ -46141,15 +46162,15 @@ var require_route = __commonJS({
|
|
|
46141
46162
|
};
|
|
46142
46163
|
}
|
|
46143
46164
|
function wrapConversion(toModel, graph) {
|
|
46144
|
-
const
|
|
46165
|
+
const path101 = [graph[toModel].parent, toModel];
|
|
46145
46166
|
let fn = conversions[graph[toModel].parent][toModel];
|
|
46146
46167
|
let cur = graph[toModel].parent;
|
|
46147
46168
|
while (graph[cur].parent) {
|
|
46148
|
-
|
|
46169
|
+
path101.unshift(graph[cur].parent);
|
|
46149
46170
|
fn = link(conversions[graph[cur].parent][cur], fn);
|
|
46150
46171
|
cur = graph[cur].parent;
|
|
46151
46172
|
}
|
|
46152
|
-
fn.conversion =
|
|
46173
|
+
fn.conversion = path101;
|
|
46153
46174
|
return fn;
|
|
46154
46175
|
}
|
|
46155
46176
|
module2.exports = function(fromModel) {
|
|
@@ -52643,26 +52664,26 @@ var require_lib2 = __commonJS({
|
|
|
52643
52664
|
return matches;
|
|
52644
52665
|
};
|
|
52645
52666
|
exports2.analyse = analyse;
|
|
52646
|
-
var detectFile = (filepath, opts = {}) => new Promise((
|
|
52667
|
+
var detectFile = (filepath, opts = {}) => new Promise((resolve70, reject) => {
|
|
52647
52668
|
let fd;
|
|
52648
|
-
const
|
|
52669
|
+
const fs81 = (0, node_1.default)();
|
|
52649
52670
|
const handler = (err, buffer) => {
|
|
52650
52671
|
if (fd) {
|
|
52651
|
-
|
|
52672
|
+
fs81.closeSync(fd);
|
|
52652
52673
|
}
|
|
52653
52674
|
if (err) {
|
|
52654
52675
|
reject(err);
|
|
52655
52676
|
} else if (buffer) {
|
|
52656
|
-
|
|
52677
|
+
resolve70((0, exports2.detect)(buffer));
|
|
52657
52678
|
} else {
|
|
52658
52679
|
reject(new Error("No error and no buffer received"));
|
|
52659
52680
|
}
|
|
52660
52681
|
};
|
|
52661
52682
|
const sampleSize = (opts === null || opts === void 0 ? void 0 : opts.sampleSize) || 0;
|
|
52662
52683
|
if (sampleSize > 0) {
|
|
52663
|
-
fd =
|
|
52684
|
+
fd = fs81.openSync(filepath, "r");
|
|
52664
52685
|
let sample = Buffer.allocUnsafe(sampleSize);
|
|
52665
|
-
|
|
52686
|
+
fs81.read(fd, sample, 0, sampleSize, opts.offset, (err, bytesRead) => {
|
|
52666
52687
|
if (err) {
|
|
52667
52688
|
handler(err, null);
|
|
52668
52689
|
} else {
|
|
@@ -52674,22 +52695,22 @@ var require_lib2 = __commonJS({
|
|
|
52674
52695
|
});
|
|
52675
52696
|
return;
|
|
52676
52697
|
}
|
|
52677
|
-
|
|
52698
|
+
fs81.readFile(filepath, handler);
|
|
52678
52699
|
});
|
|
52679
52700
|
exports2.detectFile = detectFile;
|
|
52680
52701
|
var detectFileSync = (filepath, opts = {}) => {
|
|
52681
|
-
const
|
|
52702
|
+
const fs81 = (0, node_1.default)();
|
|
52682
52703
|
if (opts && opts.sampleSize) {
|
|
52683
|
-
const fd =
|
|
52704
|
+
const fd = fs81.openSync(filepath, "r");
|
|
52684
52705
|
let sample = Buffer.allocUnsafe(opts.sampleSize);
|
|
52685
|
-
const bytesRead =
|
|
52706
|
+
const bytesRead = fs81.readSync(fd, sample, 0, opts.sampleSize, opts.offset);
|
|
52686
52707
|
if (bytesRead < opts.sampleSize) {
|
|
52687
52708
|
sample = sample.subarray(0, bytesRead);
|
|
52688
52709
|
}
|
|
52689
|
-
|
|
52710
|
+
fs81.closeSync(fd);
|
|
52690
52711
|
return (0, exports2.detect)(sample);
|
|
52691
52712
|
}
|
|
52692
|
-
return (0, exports2.detect)(
|
|
52713
|
+
return (0, exports2.detect)(fs81.readFileSync(filepath));
|
|
52693
52714
|
};
|
|
52694
52715
|
exports2.detectFileSync = detectFileSync;
|
|
52695
52716
|
exports2.default = {
|
|
@@ -57202,7 +57223,7 @@ var require_Observable = __commonJS({
|
|
|
57202
57223
|
Observable2.prototype.forEach = function(next, promiseCtor) {
|
|
57203
57224
|
var _this = this;
|
|
57204
57225
|
promiseCtor = getPromiseCtor(promiseCtor);
|
|
57205
|
-
return new promiseCtor(function(
|
|
57226
|
+
return new promiseCtor(function(resolve70, reject) {
|
|
57206
57227
|
var subscriber = new Subscriber_1.SafeSubscriber({
|
|
57207
57228
|
next: function(value) {
|
|
57208
57229
|
try {
|
|
@@ -57213,7 +57234,7 @@ var require_Observable = __commonJS({
|
|
|
57213
57234
|
}
|
|
57214
57235
|
},
|
|
57215
57236
|
error: reject,
|
|
57216
|
-
complete:
|
|
57237
|
+
complete: resolve70
|
|
57217
57238
|
});
|
|
57218
57239
|
_this.subscribe(subscriber);
|
|
57219
57240
|
});
|
|
@@ -57235,14 +57256,14 @@ var require_Observable = __commonJS({
|
|
|
57235
57256
|
Observable2.prototype.toPromise = function(promiseCtor) {
|
|
57236
57257
|
var _this = this;
|
|
57237
57258
|
promiseCtor = getPromiseCtor(promiseCtor);
|
|
57238
|
-
return new promiseCtor(function(
|
|
57259
|
+
return new promiseCtor(function(resolve70, reject) {
|
|
57239
57260
|
var value;
|
|
57240
57261
|
_this.subscribe(function(x) {
|
|
57241
57262
|
return value = x;
|
|
57242
57263
|
}, function(err) {
|
|
57243
57264
|
return reject(err);
|
|
57244
57265
|
}, function() {
|
|
57245
|
-
return
|
|
57266
|
+
return resolve70(value);
|
|
57246
57267
|
});
|
|
57247
57268
|
});
|
|
57248
57269
|
};
|
|
@@ -59338,11 +59359,11 @@ var require_innerFrom = __commonJS({
|
|
|
59338
59359
|
"use strict";
|
|
59339
59360
|
var __awaiter = exports2 && exports2.__awaiter || function(thisArg, _arguments, P2, generator) {
|
|
59340
59361
|
function adopt(value) {
|
|
59341
|
-
return value instanceof P2 ? value : new P2(function(
|
|
59342
|
-
|
|
59362
|
+
return value instanceof P2 ? value : new P2(function(resolve70) {
|
|
59363
|
+
resolve70(value);
|
|
59343
59364
|
});
|
|
59344
59365
|
}
|
|
59345
|
-
return new (P2 || (P2 = Promise))(function(
|
|
59366
|
+
return new (P2 || (P2 = Promise))(function(resolve70, reject) {
|
|
59346
59367
|
function fulfilled(value) {
|
|
59347
59368
|
try {
|
|
59348
59369
|
step(generator.next(value));
|
|
@@ -59358,7 +59379,7 @@ var require_innerFrom = __commonJS({
|
|
|
59358
59379
|
}
|
|
59359
59380
|
}
|
|
59360
59381
|
function step(result) {
|
|
59361
|
-
result.done ?
|
|
59382
|
+
result.done ? resolve70(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
59362
59383
|
}
|
|
59363
59384
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
59364
59385
|
});
|
|
@@ -59440,14 +59461,14 @@ var require_innerFrom = __commonJS({
|
|
|
59440
59461
|
}, i);
|
|
59441
59462
|
function verb(n) {
|
|
59442
59463
|
i[n] = o[n] && function(v2) {
|
|
59443
|
-
return new Promise(function(
|
|
59444
|
-
v2 = o[n](v2), settle(
|
|
59464
|
+
return new Promise(function(resolve70, reject) {
|
|
59465
|
+
v2 = o[n](v2), settle(resolve70, reject, v2.done, v2.value);
|
|
59445
59466
|
});
|
|
59446
59467
|
};
|
|
59447
59468
|
}
|
|
59448
|
-
function settle(
|
|
59469
|
+
function settle(resolve70, reject, d, v2) {
|
|
59449
59470
|
Promise.resolve(v2).then(function(v3) {
|
|
59450
|
-
|
|
59471
|
+
resolve70({ value: v3, done: d });
|
|
59451
59472
|
}, reject);
|
|
59452
59473
|
}
|
|
59453
59474
|
};
|
|
@@ -60066,7 +60087,7 @@ var require_lastValueFrom = __commonJS({
|
|
|
60066
60087
|
var EmptyError_1 = require_EmptyError();
|
|
60067
60088
|
function lastValueFrom2(source, config2) {
|
|
60068
60089
|
var hasConfig = typeof config2 === "object";
|
|
60069
|
-
return new Promise(function(
|
|
60090
|
+
return new Promise(function(resolve70, reject) {
|
|
60070
60091
|
var _hasValue = false;
|
|
60071
60092
|
var _value;
|
|
60072
60093
|
source.subscribe({
|
|
@@ -60077,9 +60098,9 @@ var require_lastValueFrom = __commonJS({
|
|
|
60077
60098
|
error: reject,
|
|
60078
60099
|
complete: function() {
|
|
60079
60100
|
if (_hasValue) {
|
|
60080
|
-
|
|
60101
|
+
resolve70(_value);
|
|
60081
60102
|
} else if (hasConfig) {
|
|
60082
|
-
|
|
60103
|
+
resolve70(config2.defaultValue);
|
|
60083
60104
|
} else {
|
|
60084
60105
|
reject(new EmptyError_1.EmptyError());
|
|
60085
60106
|
}
|
|
@@ -60101,16 +60122,16 @@ var require_firstValueFrom = __commonJS({
|
|
|
60101
60122
|
var Subscriber_1 = require_Subscriber();
|
|
60102
60123
|
function firstValueFrom(source, config2) {
|
|
60103
60124
|
var hasConfig = typeof config2 === "object";
|
|
60104
|
-
return new Promise(function(
|
|
60125
|
+
return new Promise(function(resolve70, reject) {
|
|
60105
60126
|
var subscriber = new Subscriber_1.SafeSubscriber({
|
|
60106
60127
|
next: function(value) {
|
|
60107
|
-
|
|
60128
|
+
resolve70(value);
|
|
60108
60129
|
subscriber.unsubscribe();
|
|
60109
60130
|
},
|
|
60110
60131
|
error: reject,
|
|
60111
60132
|
complete: function() {
|
|
60112
60133
|
if (hasConfig) {
|
|
60113
|
-
|
|
60134
|
+
resolve70(config2.defaultValue);
|
|
60114
60135
|
} else {
|
|
60115
60136
|
reject(new EmptyError_1.EmptyError());
|
|
60116
60137
|
}
|
|
@@ -65902,14 +65923,14 @@ var require_run_async = __commonJS({
|
|
|
65902
65923
|
return function() {
|
|
65903
65924
|
var args = arguments;
|
|
65904
65925
|
var originalThis = this;
|
|
65905
|
-
var promise = new Promise(function(
|
|
65926
|
+
var promise = new Promise(function(resolve70, reject) {
|
|
65906
65927
|
var resolved = false;
|
|
65907
65928
|
const wrappedResolve = function(value) {
|
|
65908
65929
|
if (resolved) {
|
|
65909
65930
|
console.warn("Run-async promise already resolved.");
|
|
65910
65931
|
}
|
|
65911
65932
|
resolved = true;
|
|
65912
|
-
|
|
65933
|
+
resolve70(value);
|
|
65913
65934
|
};
|
|
65914
65935
|
var rejected = false;
|
|
65915
65936
|
const wrappedReject = function(value) {
|
|
@@ -69452,7 +69473,7 @@ var require_compile = __commonJS({
|
|
|
69452
69473
|
const schOrFunc = root.refs[ref];
|
|
69453
69474
|
if (schOrFunc)
|
|
69454
69475
|
return schOrFunc;
|
|
69455
|
-
let _sch =
|
|
69476
|
+
let _sch = resolve70.call(this, root, ref);
|
|
69456
69477
|
if (_sch === void 0) {
|
|
69457
69478
|
const schema = (_a2 = root.localRefs) === null || _a2 === void 0 ? void 0 : _a2[ref];
|
|
69458
69479
|
const { schemaId } = this.opts;
|
|
@@ -69479,7 +69500,7 @@ var require_compile = __commonJS({
|
|
|
69479
69500
|
function sameSchemaEnv(s1, s2) {
|
|
69480
69501
|
return s1.schema === s2.schema && s1.root === s2.root && s1.baseId === s2.baseId;
|
|
69481
69502
|
}
|
|
69482
|
-
function
|
|
69503
|
+
function resolve70(root, ref) {
|
|
69483
69504
|
let sch;
|
|
69484
69505
|
while (typeof (sch = this.refs[ref]) == "string")
|
|
69485
69506
|
ref = sch;
|
|
@@ -69697,8 +69718,8 @@ var require_utils2 = __commonJS({
|
|
|
69697
69718
|
}
|
|
69698
69719
|
return ind;
|
|
69699
69720
|
}
|
|
69700
|
-
function removeDotSegments(
|
|
69701
|
-
let input =
|
|
69721
|
+
function removeDotSegments(path101) {
|
|
69722
|
+
let input = path101;
|
|
69702
69723
|
const output = [];
|
|
69703
69724
|
let nextSlash = -1;
|
|
69704
69725
|
let len = 0;
|
|
@@ -69950,8 +69971,8 @@ var require_schemes = __commonJS({
|
|
|
69950
69971
|
wsComponent.secure = void 0;
|
|
69951
69972
|
}
|
|
69952
69973
|
if (wsComponent.resourceName) {
|
|
69953
|
-
const [
|
|
69954
|
-
wsComponent.path =
|
|
69974
|
+
const [path101, query] = wsComponent.resourceName.split("?");
|
|
69975
|
+
wsComponent.path = path101 && path101 !== "/" ? path101 : void 0;
|
|
69955
69976
|
wsComponent.query = query;
|
|
69956
69977
|
wsComponent.resourceName = void 0;
|
|
69957
69978
|
}
|
|
@@ -70106,21 +70127,21 @@ var require_fast_uri = __commonJS({
|
|
|
70106
70127
|
normalizeString(uri, options);
|
|
70107
70128
|
} else if (typeof uri === "object") {
|
|
70108
70129
|
uri = /** @type {T} */
|
|
70109
|
-
|
|
70130
|
+
parse5(serialize(uri, options), options);
|
|
70110
70131
|
}
|
|
70111
70132
|
return uri;
|
|
70112
70133
|
}
|
|
70113
|
-
function
|
|
70134
|
+
function resolve70(baseURI, relativeURI, options) {
|
|
70114
70135
|
const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
|
|
70115
|
-
const resolved = resolveComponent(
|
|
70136
|
+
const resolved = resolveComponent(parse5(baseURI, schemelessOptions), parse5(relativeURI, schemelessOptions), schemelessOptions, true);
|
|
70116
70137
|
schemelessOptions.skipEscape = true;
|
|
70117
70138
|
return serialize(resolved, schemelessOptions);
|
|
70118
70139
|
}
|
|
70119
70140
|
function resolveComponent(base, relative6, options, skipNormalization) {
|
|
70120
70141
|
const target = {};
|
|
70121
70142
|
if (!skipNormalization) {
|
|
70122
|
-
base =
|
|
70123
|
-
relative6 =
|
|
70143
|
+
base = parse5(serialize(base, options), options);
|
|
70144
|
+
relative6 = parse5(serialize(relative6, options), options);
|
|
70124
70145
|
}
|
|
70125
70146
|
options = options || {};
|
|
70126
70147
|
if (!options.tolerant && relative6.scheme) {
|
|
@@ -70343,7 +70364,7 @@ var require_fast_uri = __commonJS({
|
|
|
70343
70364
|
}
|
|
70344
70365
|
return { parsed, malformedAuthorityOrPort };
|
|
70345
70366
|
}
|
|
70346
|
-
function
|
|
70367
|
+
function parse5(uri, opts) {
|
|
70347
70368
|
return parseWithStatus(uri, opts).parsed;
|
|
70348
70369
|
}
|
|
70349
70370
|
function normalizeString(uri, opts) {
|
|
@@ -70368,11 +70389,11 @@ var require_fast_uri = __commonJS({
|
|
|
70368
70389
|
var fastUri = {
|
|
70369
70390
|
SCHEMES,
|
|
70370
70391
|
normalize: normalize3,
|
|
70371
|
-
resolve:
|
|
70392
|
+
resolve: resolve70,
|
|
70372
70393
|
resolveComponent,
|
|
70373
70394
|
equal,
|
|
70374
70395
|
serialize,
|
|
70375
|
-
parse:
|
|
70396
|
+
parse: parse5
|
|
70376
70397
|
};
|
|
70377
70398
|
module2.exports = fastUri;
|
|
70378
70399
|
module2.exports.default = fastUri;
|
|
@@ -73344,12 +73365,12 @@ var require_dist = __commonJS({
|
|
|
73344
73365
|
throw new Error(`Unknown format "${name}"`);
|
|
73345
73366
|
return f2;
|
|
73346
73367
|
};
|
|
73347
|
-
function addFormats(ajv, list,
|
|
73368
|
+
function addFormats(ajv, list, fs81, exportName) {
|
|
73348
73369
|
var _a2;
|
|
73349
73370
|
var _b2;
|
|
73350
73371
|
(_a2 = (_b2 = ajv.opts.code).formats) !== null && _a2 !== void 0 ? _a2 : _b2.formats = (0, codegen_1._)`require("ajv-formats/dist/formats").${exportName}`;
|
|
73351
73372
|
for (const f2 of list)
|
|
73352
|
-
ajv.addFormat(f2,
|
|
73373
|
+
ajv.addFormat(f2, fs81[f2]);
|
|
73353
73374
|
}
|
|
73354
73375
|
module2.exports = exports2 = formatsPlugin;
|
|
73355
73376
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
@@ -74633,11 +74654,11 @@ var parser = new YargsParser({
|
|
|
74633
74654
|
resolve: import_path2.resolve,
|
|
74634
74655
|
// TODO: figure out a way to combine ESM and CJS coverage, such that
|
|
74635
74656
|
// we can exercise all the lines below:
|
|
74636
|
-
require: (
|
|
74657
|
+
require: (path101) => {
|
|
74637
74658
|
if (typeof require !== "undefined") {
|
|
74638
|
-
return require(
|
|
74639
|
-
} else if (
|
|
74640
|
-
return JSON.parse((0, import_fs2.readFileSync)(
|
|
74659
|
+
return require(path101);
|
|
74660
|
+
} else if (path101.match(/\.json$/)) {
|
|
74661
|
+
return JSON.parse((0, import_fs2.readFileSync)(path101, "utf8"));
|
|
74641
74662
|
} else {
|
|
74642
74663
|
throw Error("only .json config files are supported in ESM");
|
|
74643
74664
|
}
|
|
@@ -77163,12 +77184,12 @@ var YargsInstance = class {
|
|
|
77163
77184
|
async getCompletion(args, done) {
|
|
77164
77185
|
argsert("<array> [function]", [args, done], arguments.length);
|
|
77165
77186
|
if (!done) {
|
|
77166
|
-
return new Promise((
|
|
77187
|
+
return new Promise((resolve70, reject) => {
|
|
77167
77188
|
__classPrivateFieldGet(this, _YargsInstance_completion, "f").getCompletion(args, (err, completions) => {
|
|
77168
77189
|
if (err)
|
|
77169
77190
|
reject(err);
|
|
77170
77191
|
else
|
|
77171
|
-
|
|
77192
|
+
resolve70(completions);
|
|
77172
77193
|
});
|
|
77173
77194
|
});
|
|
77174
77195
|
} else {
|
|
@@ -77200,9 +77221,9 @@ var YargsInstance = class {
|
|
|
77200
77221
|
__classPrivateFieldSet(this, _YargsInstance_hasOutput, true, "f");
|
|
77201
77222
|
if (!__classPrivateFieldGet(this, _YargsInstance_usage, "f").hasCachedHelpMessage()) {
|
|
77202
77223
|
if (!this.parsed) {
|
|
77203
|
-
const
|
|
77204
|
-
if (isPromise(
|
|
77205
|
-
return
|
|
77224
|
+
const parse5 = this[kRunYargsParserAndExecuteCommands](__classPrivateFieldGet(this, _YargsInstance_processArgs, "f"), void 0, void 0, 0, true);
|
|
77225
|
+
if (isPromise(parse5)) {
|
|
77226
|
+
return parse5.then(() => {
|
|
77206
77227
|
return __classPrivateFieldGet(this, _YargsInstance_usage, "f").help();
|
|
77207
77228
|
});
|
|
77208
77229
|
}
|
|
@@ -77546,9 +77567,9 @@ var YargsInstance = class {
|
|
|
77546
77567
|
__classPrivateFieldSet(this, _YargsInstance_hasOutput, true, "f");
|
|
77547
77568
|
if (!__classPrivateFieldGet(this, _YargsInstance_usage, "f").hasCachedHelpMessage()) {
|
|
77548
77569
|
if (!this.parsed) {
|
|
77549
|
-
const
|
|
77550
|
-
if (isPromise(
|
|
77551
|
-
|
|
77570
|
+
const parse5 = this[kRunYargsParserAndExecuteCommands](__classPrivateFieldGet(this, _YargsInstance_processArgs, "f"), void 0, void 0, 0, true);
|
|
77571
|
+
if (isPromise(parse5)) {
|
|
77572
|
+
parse5.then(() => {
|
|
77552
77573
|
__classPrivateFieldGet(this, _YargsInstance_usage, "f").showHelp(level);
|
|
77553
77574
|
});
|
|
77554
77575
|
return this;
|
|
@@ -78418,16 +78439,16 @@ async function handleAgentSkills(options) {
|
|
|
78418
78439
|
}
|
|
78419
78440
|
async function askYesNo(question) {
|
|
78420
78441
|
const rl = readline.createInterface({ input: process.stdin, output: process.stderr });
|
|
78421
|
-
return new Promise((
|
|
78442
|
+
return new Promise((resolve70) => {
|
|
78422
78443
|
process.stderr.write(`${question} `);
|
|
78423
78444
|
rl.once("line", (answer) => {
|
|
78424
78445
|
rl.close();
|
|
78425
78446
|
const trimmed = answer.trim();
|
|
78426
78447
|
if (trimmed === "") {
|
|
78427
|
-
|
|
78448
|
+
resolve70(true);
|
|
78428
78449
|
return;
|
|
78429
78450
|
}
|
|
78430
|
-
|
|
78451
|
+
resolve70(/^y(es)?$/i.test(trimmed));
|
|
78431
78452
|
});
|
|
78432
78453
|
});
|
|
78433
78454
|
}
|
|
@@ -80028,13 +80049,13 @@ var PromisePolyfill = class extends Promise {
|
|
|
80028
80049
|
// Available starting from Node 22
|
|
80029
80050
|
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/withResolvers
|
|
80030
80051
|
static withResolver() {
|
|
80031
|
-
let
|
|
80052
|
+
let resolve70;
|
|
80032
80053
|
let reject;
|
|
80033
80054
|
const promise = new Promise((res, rej) => {
|
|
80034
|
-
|
|
80055
|
+
resolve70 = res;
|
|
80035
80056
|
reject = rej;
|
|
80036
80057
|
});
|
|
80037
|
-
return { promise, resolve:
|
|
80058
|
+
return { promise, resolve: resolve70, reject };
|
|
80038
80059
|
}
|
|
80039
80060
|
};
|
|
80040
80061
|
|
|
@@ -80068,7 +80089,7 @@ function createPrompt(view) {
|
|
|
80068
80089
|
output
|
|
80069
80090
|
});
|
|
80070
80091
|
const screen = new ScreenManager(rl);
|
|
80071
|
-
const { promise, resolve:
|
|
80092
|
+
const { promise, resolve: resolve70, reject } = PromisePolyfill.withResolver();
|
|
80072
80093
|
const cancel = () => reject(new CancelPromptError());
|
|
80073
80094
|
if (signal) {
|
|
80074
80095
|
const abort = () => reject(new AbortPromptError({ cause: signal.reason }));
|
|
@@ -80095,7 +80116,7 @@ function createPrompt(view) {
|
|
|
80095
80116
|
cycle(() => {
|
|
80096
80117
|
try {
|
|
80097
80118
|
const nextView = view(config2, (value) => {
|
|
80098
|
-
setImmediate(() =>
|
|
80119
|
+
setImmediate(() => resolve70(value));
|
|
80099
80120
|
});
|
|
80100
80121
|
if (nextView === void 0) {
|
|
80101
80122
|
const callerFilename = callSites[1]?.getFileName();
|
|
@@ -81404,9 +81425,9 @@ var import_rxjs = __toESM(require_cjs(), 1);
|
|
|
81404
81425
|
var import_run_async = __toESM(require_run_async(), 1);
|
|
81405
81426
|
var import_mute_stream2 = __toESM(require_lib(), 1);
|
|
81406
81427
|
var _ = {
|
|
81407
|
-
set: (obj,
|
|
81428
|
+
set: (obj, path101 = "", value) => {
|
|
81408
81429
|
let pointer = obj;
|
|
81409
|
-
|
|
81430
|
+
path101.split(".").forEach((key, index, arr) => {
|
|
81410
81431
|
if (key === "__proto__" || key === "constructor")
|
|
81411
81432
|
return;
|
|
81412
81433
|
if (index === arr.length - 1) {
|
|
@@ -81417,8 +81438,8 @@ var _ = {
|
|
|
81417
81438
|
pointer = pointer[key];
|
|
81418
81439
|
});
|
|
81419
81440
|
},
|
|
81420
|
-
get: (obj,
|
|
81421
|
-
const travel = (regexp) => String.prototype.split.call(
|
|
81441
|
+
get: (obj, path101 = "", defaultValue) => {
|
|
81442
|
+
const travel = (regexp) => String.prototype.split.call(path101, regexp).filter(Boolean).reduce(
|
|
81422
81443
|
// @ts-expect-error implicit any on res[key]
|
|
81423
81444
|
(res, key) => res == null ? res : res[key],
|
|
81424
81445
|
obj
|
|
@@ -81536,7 +81557,7 @@ var PromptsRunner = class {
|
|
|
81536
81557
|
throw new Error(`Prompt for type ${question.type} not found`);
|
|
81537
81558
|
}
|
|
81538
81559
|
let cleanupSignal;
|
|
81539
|
-
const promptFn = isPromptConstructor(prompt2) ? (q2, opt) => new Promise((
|
|
81560
|
+
const promptFn = isPromptConstructor(prompt2) ? (q2, opt) => new Promise((resolve70, reject) => {
|
|
81540
81561
|
const { signal: signal2 } = opt;
|
|
81541
81562
|
if (signal2.aborted) {
|
|
81542
81563
|
reject(new AbortPromptError({ cause: signal2.reason }));
|
|
@@ -81573,7 +81594,7 @@ var PromptsRunner = class {
|
|
|
81573
81594
|
signal2.removeEventListener("abort", abort);
|
|
81574
81595
|
cleanupSignal = void 0;
|
|
81575
81596
|
};
|
|
81576
|
-
activePrompt.run().then(
|
|
81597
|
+
activePrompt.run().then(resolve70, reject).finally(cleanup);
|
|
81577
81598
|
}) : prompt2;
|
|
81578
81599
|
let cleanupModuleSignal;
|
|
81579
81600
|
const { signal: moduleSignal } = this.opt;
|
|
@@ -82879,6 +82900,7 @@ function writePluginAdaptationPrompt(repoPath, pluginId, content) {
|
|
|
82879
82900
|
|
|
82880
82901
|
// src/harness/plugins.ts
|
|
82881
82902
|
init_schema2();
|
|
82903
|
+
init_manifest();
|
|
82882
82904
|
init_stages();
|
|
82883
82905
|
var PluginManifestFileSchema = external_exports.object({
|
|
82884
82906
|
src: external_exports.string().min(1),
|
|
@@ -83113,6 +83135,7 @@ function applyPluginFromDir(repoPath, pluginDir, options, meta) {
|
|
|
83113
83135
|
});
|
|
83114
83136
|
const promptAbsPath = writePluginAdaptationPrompt(resolved, manifest.id, promptContent);
|
|
83115
83137
|
const adaptPromptPath = path65.relative(resolved, promptAbsPath);
|
|
83138
|
+
stampManifestWriter(resolved);
|
|
83116
83139
|
success(`Applied plugin: ${manifest.id}`);
|
|
83117
83140
|
info(`Registered stage(s): ${stageIds.join(", ")}`);
|
|
83118
83141
|
for (const file of filesWritten) {
|
|
@@ -83846,8 +83869,20 @@ init_stages();
|
|
|
83846
83869
|
// src/harness/doctor.ts
|
|
83847
83870
|
var fs64 = __toESM(require("fs"));
|
|
83848
83871
|
var path73 = __toESM(require("path"));
|
|
83872
|
+
init_package_version();
|
|
83849
83873
|
init_slot_registry();
|
|
83850
83874
|
|
|
83875
|
+
// src/utils/semver.ts
|
|
83876
|
+
function compareSemver(a, b2) {
|
|
83877
|
+
const pa = a.split(".").map((n) => parseInt(n, 10) || 0);
|
|
83878
|
+
const pb = b2.split(".").map((n) => parseInt(n, 10) || 0);
|
|
83879
|
+
for (let i = 0; i < Math.max(pa.length, pb.length); i++) {
|
|
83880
|
+
const d = (pa[i] ?? 0) - (pb[i] ?? 0);
|
|
83881
|
+
if (d !== 0) return d < 0 ? -1 : 1;
|
|
83882
|
+
}
|
|
83883
|
+
return 0;
|
|
83884
|
+
}
|
|
83885
|
+
|
|
83851
83886
|
// src/harness/eject.ts
|
|
83852
83887
|
var fs60 = __toESM(require("fs"));
|
|
83853
83888
|
var path68 = __toESM(require("path"));
|
|
@@ -84120,6 +84155,7 @@ function cleanupResolvedLine(source) {
|
|
|
84120
84155
|
// src/harness/lines.ts
|
|
84121
84156
|
init_schema2();
|
|
84122
84157
|
init_schema2();
|
|
84158
|
+
init_manifest();
|
|
84123
84159
|
init_stages();
|
|
84124
84160
|
function lineDirRel(lineId) {
|
|
84125
84161
|
return `${LOCAL_LINES_DIR}/${lineId}`;
|
|
@@ -84308,6 +84344,7 @@ function applyLineFromDir(repoPath, bundleDir, options, meta) {
|
|
|
84308
84344
|
buildLineAdaptationPrompt(resolved, program, { ...partial2, adaptPromptPath: "" })
|
|
84309
84345
|
);
|
|
84310
84346
|
const adaptPromptPath = path71.relative(resolved, promptAbsPath);
|
|
84347
|
+
stampManifestWriter(resolved);
|
|
84311
84348
|
success(`Applied line: ${manifest.id}`);
|
|
84312
84349
|
info(`Stations: ${partial2.stationIds.join(" \u2192 ")}`);
|
|
84313
84350
|
info(
|
|
@@ -84816,6 +84853,7 @@ function listHarnessShellScripts(harnessDir) {
|
|
|
84816
84853
|
return out;
|
|
84817
84854
|
}
|
|
84818
84855
|
var CHECK_LABELS = {
|
|
84856
|
+
"cli-version": "CLI vs harness writer",
|
|
84819
84857
|
"harness-env": "harness.env schema",
|
|
84820
84858
|
"stages-registry": "stages.json registry",
|
|
84821
84859
|
"stage-files": "stage scripts & commands",
|
|
@@ -84888,6 +84926,28 @@ function runDoctor(repoPath) {
|
|
|
84888
84926
|
}
|
|
84889
84927
|
const contract = detectContract(harnessDir);
|
|
84890
84928
|
const contractSeverity = contract === "1.0" ? "error" : "warning";
|
|
84929
|
+
const writerVersion = readManifest(repoPath)?.cliVersion;
|
|
84930
|
+
const runningVersion = getHarPackageVersion();
|
|
84931
|
+
if (!writerVersion) {
|
|
84932
|
+
skipped.add("cli-version");
|
|
84933
|
+
}
|
|
84934
|
+
if (writerVersion && compareSemver(runningVersion, writerVersion) < 0) {
|
|
84935
|
+
const finding = {
|
|
84936
|
+
check: "cli-version",
|
|
84937
|
+
severity: "error",
|
|
84938
|
+
file: "manifest.json",
|
|
84939
|
+
message: `This harness was written by @osfactory/har ${writerVersion}; you are running ${runningVersion}.`,
|
|
84940
|
+
remedy: "npm install -g @osfactory/har@latest (or run the repo's local build: node dist/index.js)"
|
|
84941
|
+
};
|
|
84942
|
+
return {
|
|
84943
|
+
ok: false,
|
|
84944
|
+
contract,
|
|
84945
|
+
checks: Object.keys(CHECK_LABELS).map(
|
|
84946
|
+
(id) => id === "cli-version" ? { id, label: CHECK_LABELS[id], status: "fail" } : { id, label: CHECK_LABELS[id], status: "skip" }
|
|
84947
|
+
),
|
|
84948
|
+
findings: [finding]
|
|
84949
|
+
};
|
|
84950
|
+
}
|
|
84891
84951
|
const envValidation = readValidatedHarnessEnv(repoPath);
|
|
84892
84952
|
let portLanes = {};
|
|
84893
84953
|
if (!envValidation) {
|
|
@@ -85411,6 +85471,7 @@ async function maintainHarness(options) {
|
|
|
85411
85471
|
}
|
|
85412
85472
|
retireLifecycleShims(repoPath);
|
|
85413
85473
|
ensureEcosystemVerificationStages(repoPath);
|
|
85474
|
+
stampManifestWriter(repoPath);
|
|
85414
85475
|
const drift = compareHarnessToTemplate(repoPath);
|
|
85415
85476
|
const validation2 = validateHarness(repoPath);
|
|
85416
85477
|
if (options.finalize) {
|
|
@@ -85582,12 +85643,12 @@ function printAdaptationPrompt(content) {
|
|
|
85582
85643
|
}
|
|
85583
85644
|
function askYesNo2(question) {
|
|
85584
85645
|
const rl = readline5.createInterface({ input: process.stdin, output: process.stderr });
|
|
85585
|
-
return new Promise((
|
|
85646
|
+
return new Promise((resolve70) => {
|
|
85586
85647
|
process.stderr.write(`${question} `);
|
|
85587
85648
|
rl.once("line", (answer) => {
|
|
85588
85649
|
rl.close();
|
|
85589
85650
|
const trimmed = answer.trim();
|
|
85590
|
-
|
|
85651
|
+
resolve70(trimmed === "" || /^y(es)?$/i.test(trimmed));
|
|
85591
85652
|
});
|
|
85592
85653
|
});
|
|
85593
85654
|
}
|
|
@@ -85678,16 +85739,16 @@ async function promptScaffoldCursorRule(exists) {
|
|
|
85678
85739
|
}
|
|
85679
85740
|
async function askYesNo3(question) {
|
|
85680
85741
|
const rl = readline6.createInterface({ input: process.stdin, output: process.stderr });
|
|
85681
|
-
return new Promise((
|
|
85742
|
+
return new Promise((resolve70) => {
|
|
85682
85743
|
process.stderr.write(`${question} `);
|
|
85683
85744
|
rl.once("line", (answer) => {
|
|
85684
85745
|
rl.close();
|
|
85685
85746
|
const trimmed = answer.trim();
|
|
85686
85747
|
if (trimmed === "") {
|
|
85687
|
-
|
|
85748
|
+
resolve70(true);
|
|
85688
85749
|
return;
|
|
85689
85750
|
}
|
|
85690
|
-
|
|
85751
|
+
resolve70(/^y(es)?$/i.test(trimmed));
|
|
85691
85752
|
});
|
|
85692
85753
|
});
|
|
85693
85754
|
}
|
|
@@ -86664,8 +86725,8 @@ async function askYesNo4(question) {
|
|
|
86664
86725
|
if (!process.stdin.isTTY || !process.stdout.isTTY) return false;
|
|
86665
86726
|
const readline8 = await import("readline");
|
|
86666
86727
|
const rl = readline8.createInterface({ input: process.stdin, output: process.stderr });
|
|
86667
|
-
const answer = await new Promise((
|
|
86668
|
-
rl.question(question,
|
|
86728
|
+
const answer = await new Promise((resolve70) => {
|
|
86729
|
+
rl.question(question, resolve70);
|
|
86669
86730
|
});
|
|
86670
86731
|
rl.close();
|
|
86671
86732
|
return /^[Yy]$/.test(answer.trim());
|
|
@@ -86762,12 +86823,12 @@ init_stages();
|
|
|
86762
86823
|
init_logging();
|
|
86763
86824
|
function askYesNo5(question) {
|
|
86764
86825
|
const rl = readline7.createInterface({ input: process.stdin, output: process.stderr });
|
|
86765
|
-
return new Promise((
|
|
86826
|
+
return new Promise((resolve70) => {
|
|
86766
86827
|
process.stderr.write(`${question} `);
|
|
86767
86828
|
rl.once("line", (answer) => {
|
|
86768
86829
|
rl.close();
|
|
86769
86830
|
const trimmed = answer.trim();
|
|
86770
|
-
|
|
86831
|
+
resolve70(trimmed === "" || /^y(es)?$/i.test(trimmed));
|
|
86771
86832
|
});
|
|
86772
86833
|
});
|
|
86773
86834
|
}
|
|
@@ -87769,7 +87830,7 @@ async function confirm(question) {
|
|
|
87769
87830
|
if (!process.stdin.isTTY) return false;
|
|
87770
87831
|
const readline8 = await import("readline");
|
|
87771
87832
|
const rl = readline8.createInterface({ input: process.stdin, output: process.stderr });
|
|
87772
|
-
const answer = await new Promise((
|
|
87833
|
+
const answer = await new Promise((resolve70) => rl.question(question, resolve70));
|
|
87773
87834
|
rl.close();
|
|
87774
87835
|
return /^y(es)?$/i.test(answer.trim());
|
|
87775
87836
|
}
|
|
@@ -88128,7 +88189,7 @@ async function loginViaBrowser(portalUrl, openUrlOrOptions = openBrowser) {
|
|
|
88128
88189
|
const options = typeof openUrlOrOptions === "function" ? { openUrl: openUrlOrOptions } : openUrlOrOptions;
|
|
88129
88190
|
const openUrl = options.openUrl ?? openBrowser;
|
|
88130
88191
|
const state = (0, import_crypto.randomUUID)();
|
|
88131
|
-
return new Promise((
|
|
88192
|
+
return new Promise((resolve70, reject) => {
|
|
88132
88193
|
let timer;
|
|
88133
88194
|
const server = http.createServer((req, res) => {
|
|
88134
88195
|
const requestUrl = new URL(req.url ?? "", "http://127.0.0.1");
|
|
@@ -88156,7 +88217,7 @@ async function loginViaBrowser(portalUrl, openUrlOrOptions = openBrowser) {
|
|
|
88156
88217
|
res.end("<h1>Logged in</h1><p>You can close this tab and return to the terminal.</p>");
|
|
88157
88218
|
cleanup();
|
|
88158
88219
|
const targets = parseCliTargetsParam(requestUrl.searchParams.get("targets"));
|
|
88159
|
-
|
|
88220
|
+
resolve70({
|
|
88160
88221
|
portalUrl,
|
|
88161
88222
|
token,
|
|
88162
88223
|
workspace: workspaceSlug ?? workspace,
|
|
@@ -88752,8 +88813,8 @@ async function askYesNo6(question) {
|
|
|
88752
88813
|
if (!process.stdin.isTTY || !process.stdout.isTTY) return false;
|
|
88753
88814
|
const readline8 = await import("readline");
|
|
88754
88815
|
const rl = readline8.createInterface({ input: process.stdin, output: process.stderr });
|
|
88755
|
-
const answer = await new Promise((
|
|
88756
|
-
rl.question(question,
|
|
88816
|
+
const answer = await new Promise((resolve70) => {
|
|
88817
|
+
rl.question(question, resolve70);
|
|
88757
88818
|
});
|
|
88758
88819
|
rl.close();
|
|
88759
88820
|
return /^[Yy]$/.test(answer.trim());
|
|
@@ -88958,8 +89019,8 @@ async function askYesNo7(question) {
|
|
|
88958
89019
|
if (!process.stdin.isTTY || !process.stdout.isTTY) return false;
|
|
88959
89020
|
const readline8 = await import("readline");
|
|
88960
89021
|
const rl = readline8.createInterface({ input: process.stdin, output: process.stderr });
|
|
88961
|
-
const answer = await new Promise((
|
|
88962
|
-
rl.question(question,
|
|
89022
|
+
const answer = await new Promise((resolve70) => {
|
|
89023
|
+
rl.question(question, resolve70);
|
|
88963
89024
|
});
|
|
88964
89025
|
rl.close();
|
|
88965
89026
|
return /^[Yy]$/.test(answer.trim());
|
|
@@ -90042,10 +90103,10 @@ function assignProp(target, prop, value) {
|
|
|
90042
90103
|
configurable: true
|
|
90043
90104
|
});
|
|
90044
90105
|
}
|
|
90045
|
-
function getElementAtPath(obj,
|
|
90046
|
-
if (!
|
|
90106
|
+
function getElementAtPath(obj, path101) {
|
|
90107
|
+
if (!path101)
|
|
90047
90108
|
return obj;
|
|
90048
|
-
return
|
|
90109
|
+
return path101.reduce((acc, key) => acc?.[key], obj);
|
|
90049
90110
|
}
|
|
90050
90111
|
function promiseAllObject(promisesObj) {
|
|
90051
90112
|
const keys = Object.keys(promisesObj);
|
|
@@ -90365,11 +90426,11 @@ function aborted(x, startIndex = 0) {
|
|
|
90365
90426
|
}
|
|
90366
90427
|
return false;
|
|
90367
90428
|
}
|
|
90368
|
-
function prefixIssues(
|
|
90429
|
+
function prefixIssues(path101, issues) {
|
|
90369
90430
|
return issues.map((iss) => {
|
|
90370
90431
|
var _a2;
|
|
90371
90432
|
(_a2 = iss).path ?? (_a2.path = []);
|
|
90372
|
-
iss.path.unshift(
|
|
90433
|
+
iss.path.unshift(path101);
|
|
90373
90434
|
return iss;
|
|
90374
90435
|
});
|
|
90375
90436
|
}
|
|
@@ -95692,7 +95753,7 @@ var Protocol = class {
|
|
|
95692
95753
|
return;
|
|
95693
95754
|
}
|
|
95694
95755
|
const pollInterval = task2.pollInterval ?? this._options?.defaultTaskPollInterval ?? 1e3;
|
|
95695
|
-
await new Promise((
|
|
95756
|
+
await new Promise((resolve70) => setTimeout(resolve70, pollInterval));
|
|
95696
95757
|
options?.signal?.throwIfAborted();
|
|
95697
95758
|
}
|
|
95698
95759
|
} catch (error3) {
|
|
@@ -95709,7 +95770,7 @@ var Protocol = class {
|
|
|
95709
95770
|
*/
|
|
95710
95771
|
request(request, resultSchema, options) {
|
|
95711
95772
|
const { relatedRequestId, resumptionToken, onresumptiontoken, task, relatedTask } = options ?? {};
|
|
95712
|
-
return new Promise((
|
|
95773
|
+
return new Promise((resolve70, reject) => {
|
|
95713
95774
|
const earlyReject = (error3) => {
|
|
95714
95775
|
reject(error3);
|
|
95715
95776
|
};
|
|
@@ -95787,7 +95848,7 @@ var Protocol = class {
|
|
|
95787
95848
|
if (!parseResult.success) {
|
|
95788
95849
|
reject(parseResult.error);
|
|
95789
95850
|
} else {
|
|
95790
|
-
|
|
95851
|
+
resolve70(parseResult.data);
|
|
95791
95852
|
}
|
|
95792
95853
|
} catch (error3) {
|
|
95793
95854
|
reject(error3);
|
|
@@ -96048,12 +96109,12 @@ var Protocol = class {
|
|
|
96048
96109
|
}
|
|
96049
96110
|
} catch {
|
|
96050
96111
|
}
|
|
96051
|
-
return new Promise((
|
|
96112
|
+
return new Promise((resolve70, reject) => {
|
|
96052
96113
|
if (signal.aborted) {
|
|
96053
96114
|
reject(new McpError(ErrorCode.InvalidRequest, "Request cancelled"));
|
|
96054
96115
|
return;
|
|
96055
96116
|
}
|
|
96056
|
-
const timeoutId = setTimeout(
|
|
96117
|
+
const timeoutId = setTimeout(resolve70, interval);
|
|
96057
96118
|
signal.addEventListener("abort", () => {
|
|
96058
96119
|
clearTimeout(timeoutId);
|
|
96059
96120
|
reject(new McpError(ErrorCode.InvalidRequest, "Request cancelled"));
|
|
@@ -96926,12 +96987,12 @@ var StdioServerTransport = class {
|
|
|
96926
96987
|
this.onclose?.();
|
|
96927
96988
|
}
|
|
96928
96989
|
send(message) {
|
|
96929
|
-
return new Promise((
|
|
96990
|
+
return new Promise((resolve70) => {
|
|
96930
96991
|
const json = serializeMessage(message);
|
|
96931
96992
|
if (this._stdout.write(json)) {
|
|
96932
|
-
|
|
96993
|
+
resolve70();
|
|
96933
96994
|
} else {
|
|
96934
|
-
this._stdout.once("drain",
|
|
96995
|
+
this._stdout.once("drain", resolve70);
|
|
96935
96996
|
}
|
|
96936
96997
|
});
|
|
96937
96998
|
}
|
|
@@ -99695,8 +99756,108 @@ async function runCli() {
|
|
|
99695
99756
|
await syncDirtyRepos();
|
|
99696
99757
|
}
|
|
99697
99758
|
|
|
99759
|
+
// src/core/prefer-local-runtime.ts
|
|
99760
|
+
var fs80 = __toESM(require("fs"));
|
|
99761
|
+
var path100 = __toESM(require("path"));
|
|
99762
|
+
var import_child_process22 = require("child_process");
|
|
99763
|
+
init_package_version();
|
|
99764
|
+
var PACKAGE_NAME = "@osfactory/har";
|
|
99765
|
+
function readPackageJson(dir) {
|
|
99766
|
+
const pkgPath = path100.join(dir, "package.json");
|
|
99767
|
+
if (!fs80.existsSync(pkgPath)) return null;
|
|
99768
|
+
try {
|
|
99769
|
+
return JSON.parse(fs80.readFileSync(pkgPath, "utf8"));
|
|
99770
|
+
} catch {
|
|
99771
|
+
return null;
|
|
99772
|
+
}
|
|
99773
|
+
}
|
|
99774
|
+
function resolveHarEntry(pkgDir, pkg) {
|
|
99775
|
+
let rel = "dist/index.js";
|
|
99776
|
+
if (pkg.bin && typeof pkg.bin === "object" && pkg.bin !== null && "har" in pkg.bin) {
|
|
99777
|
+
const bin = pkg.bin.har;
|
|
99778
|
+
if (typeof bin === "string" && bin.length > 0) rel = bin;
|
|
99779
|
+
} else if (typeof pkg.bin === "string" && pkg.bin.length > 0) {
|
|
99780
|
+
rel = pkg.bin;
|
|
99781
|
+
}
|
|
99782
|
+
const entry = path100.resolve(pkgDir, rel);
|
|
99783
|
+
return fs80.existsSync(entry) ? entry : null;
|
|
99784
|
+
}
|
|
99785
|
+
function sameFile(a, b2) {
|
|
99786
|
+
try {
|
|
99787
|
+
return fs80.realpathSync(a) === fs80.realpathSync(b2);
|
|
99788
|
+
} catch {
|
|
99789
|
+
return path100.resolve(a) === path100.resolve(b2);
|
|
99790
|
+
}
|
|
99791
|
+
}
|
|
99792
|
+
function considerCandidate(candidate, currentVersion, currentEntry) {
|
|
99793
|
+
if (!candidate) return null;
|
|
99794
|
+
if (currentEntry && sameFile(candidate.entryPath, currentEntry)) return null;
|
|
99795
|
+
if (compareSemver(candidate.version, currentVersion) <= 0) return null;
|
|
99796
|
+
return candidate;
|
|
99797
|
+
}
|
|
99798
|
+
function inspectDir(dir) {
|
|
99799
|
+
const pkg = readPackageJson(dir);
|
|
99800
|
+
if (pkg?.name === PACKAGE_NAME && pkg.version) {
|
|
99801
|
+
const entry = resolveHarEntry(dir, pkg);
|
|
99802
|
+
if (entry) return { entryPath: entry, version: pkg.version, reason: "har-repo" };
|
|
99803
|
+
}
|
|
99804
|
+
const nestedDir = path100.join(dir, "node_modules", PACKAGE_NAME);
|
|
99805
|
+
const nested = readPackageJson(nestedDir);
|
|
99806
|
+
if (nested?.name === PACKAGE_NAME && nested.version) {
|
|
99807
|
+
const entry = resolveHarEntry(nestedDir, nested);
|
|
99808
|
+
if (entry) return { entryPath: entry, version: nested.version, reason: "node_modules" };
|
|
99809
|
+
}
|
|
99810
|
+
return null;
|
|
99811
|
+
}
|
|
99812
|
+
function walkParents(start) {
|
|
99813
|
+
const out = [];
|
|
99814
|
+
let current = path100.resolve(start);
|
|
99815
|
+
const { root } = path100.parse(current);
|
|
99816
|
+
for (; ; ) {
|
|
99817
|
+
out.push(current);
|
|
99818
|
+
if (current === root) break;
|
|
99819
|
+
current = path100.dirname(current);
|
|
99820
|
+
}
|
|
99821
|
+
return out;
|
|
99822
|
+
}
|
|
99823
|
+
function findPreferredLocalRuntime(options) {
|
|
99824
|
+
const seen = /* @__PURE__ */ new Set();
|
|
99825
|
+
const roots = [...(options.extraRoots ?? []).map((r) => path100.resolve(r)), ...walkParents(options.cwd)];
|
|
99826
|
+
for (const dir of roots) {
|
|
99827
|
+
if (seen.has(dir)) continue;
|
|
99828
|
+
seen.add(dir);
|
|
99829
|
+
const found = considerCandidate(inspectDir(dir), options.currentVersion, options.currentEntry);
|
|
99830
|
+
if (found) return found;
|
|
99831
|
+
}
|
|
99832
|
+
return null;
|
|
99833
|
+
}
|
|
99834
|
+
function maybeReexecPreferredRuntime() {
|
|
99835
|
+
if (process.env.HAR_USING_LOCAL_RUNTIME || process.env.HAR_SKIP_LOCAL_RUNTIME) {
|
|
99836
|
+
return;
|
|
99837
|
+
}
|
|
99838
|
+
const currentVersion = getHarPackageVersion();
|
|
99839
|
+
const extraRoots = process.env.HAR_ROOT ? [process.env.HAR_ROOT] : [];
|
|
99840
|
+
const found = findPreferredLocalRuntime({
|
|
99841
|
+
cwd: process.cwd(),
|
|
99842
|
+
currentVersion,
|
|
99843
|
+
currentEntry: process.argv[1],
|
|
99844
|
+
extraRoots
|
|
99845
|
+
});
|
|
99846
|
+
if (!found) return;
|
|
99847
|
+
process.stderr.write(
|
|
99848
|
+
`Using repo-local @osfactory/har ${found.version} (this CLI is ${currentVersion})
|
|
99849
|
+
`
|
|
99850
|
+
);
|
|
99851
|
+
const result = (0, import_child_process22.spawnSync)(process.execPath, [found.entryPath, ...process.argv.slice(2)], {
|
|
99852
|
+
stdio: "inherit",
|
|
99853
|
+
env: { ...process.env, HAR_USING_LOCAL_RUNTIME: "1" }
|
|
99854
|
+
});
|
|
99855
|
+
process.exit(result.status ?? 1);
|
|
99856
|
+
}
|
|
99857
|
+
|
|
99698
99858
|
// src/index.ts
|
|
99699
99859
|
init_sync_context();
|
|
99860
|
+
maybeReexecPreferredRuntime();
|
|
99700
99861
|
runCli().catch(async (err) => {
|
|
99701
99862
|
console.error(err.message);
|
|
99702
99863
|
await syncDirtyRepos();
|