pomaster 0.1.0 → 0.1.1
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/README.md +385 -396
- package/dist/bin.js +523 -150
- package/package.json +1 -1
package/dist/bin.js
CHANGED
|
@@ -18732,8 +18732,8 @@ var init_digest = __esm({
|
|
|
18732
18732
|
});
|
|
18733
18733
|
|
|
18734
18734
|
// packages/kernel/dist/io.js
|
|
18735
|
-
import { appendFileSync, mkdirSync, readFileSync, renameSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
18736
|
-
import { dirname as
|
|
18735
|
+
import { appendFileSync, mkdirSync, readFileSync as readFileSync2, renameSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
18736
|
+
import { dirname as dirname3 } from "node:path";
|
|
18737
18737
|
function captureOriginal(path) {
|
|
18738
18738
|
try {
|
|
18739
18739
|
statSync(path);
|
|
@@ -18743,7 +18743,7 @@ function captureOriginal(path) {
|
|
|
18743
18743
|
throw error;
|
|
18744
18744
|
}
|
|
18745
18745
|
try {
|
|
18746
|
-
return
|
|
18746
|
+
return readFileSync2(path, "utf8");
|
|
18747
18747
|
} catch (error) {
|
|
18748
18748
|
throw new GovernanceError("ENVIRONMENT_ERROR", `cannot read existing file for staged write: ${path}`, "\u68C0\u67E5\u6587\u4EF6\u5360\u7528/\u6743\u9650\u540E\u91CD\u8BD5\uFF1B\u5355\u673A\u672C\u5730\u76D8\u5047\u8BBE\u7834\u88C2\u65F6 doctor \u4F1A\u62A5 environment_error\uFF08\u7981\u9759\u9ED8\uFF09", { path, cause: String(error) });
|
|
18749
18749
|
}
|
|
@@ -18757,7 +18757,7 @@ function ensureDir(dir) {
|
|
|
18757
18757
|
}
|
|
18758
18758
|
function readText(path) {
|
|
18759
18759
|
try {
|
|
18760
|
-
return
|
|
18760
|
+
return readFileSync2(path, "utf8");
|
|
18761
18761
|
} catch (error) {
|
|
18762
18762
|
if (isNotFoundError(error))
|
|
18763
18763
|
return null;
|
|
@@ -18806,7 +18806,7 @@ function executeWrites(writes) {
|
|
|
18806
18806
|
const renamed = [];
|
|
18807
18807
|
try {
|
|
18808
18808
|
writes.forEach((write, index) => {
|
|
18809
|
-
ensureDir(
|
|
18809
|
+
ensureDir(dirname3(write.path));
|
|
18810
18810
|
const tmp = `${write.path}.tmp-${process.pid}-${index}`;
|
|
18811
18811
|
writeFileSync(tmp, write.next, "utf8");
|
|
18812
18812
|
tmpPaths.push(tmp);
|
|
@@ -18953,8 +18953,8 @@ var init_paths = __esm({
|
|
|
18953
18953
|
});
|
|
18954
18954
|
|
|
18955
18955
|
// packages/kernel/dist/evidence-artifacts.js
|
|
18956
|
-
import { existsSync, mkdirSync as mkdirSync2, readFileSync as
|
|
18957
|
-
import { dirname as
|
|
18956
|
+
import { existsSync, mkdirSync as mkdirSync2, readFileSync as readFileSync3, writeFileSync as writeFileSync2 } from "node:fs";
|
|
18957
|
+
import { dirname as dirname4 } from "node:path";
|
|
18958
18958
|
function blobAbsolutePath(evidenceDir, storagePath) {
|
|
18959
18959
|
return `${evidenceDir}/${storagePath}`;
|
|
18960
18960
|
}
|
|
@@ -18973,19 +18973,19 @@ function persistEvidenceArtifact(evidenceDir, input) {
|
|
|
18973
18973
|
const storagePath = storagePathOfSha256(sha256);
|
|
18974
18974
|
const absolutePath = blobAbsolutePath(evidenceDir, storagePath);
|
|
18975
18975
|
if (existsSync(absolutePath)) {
|
|
18976
|
-
const existing =
|
|
18976
|
+
const existing = readFileSync3(absolutePath);
|
|
18977
18977
|
if (!existing.equals(Buffer.from(input.bytes.buffer, input.bytes.byteOffset, input.bytes.byteLength))) {
|
|
18978
18978
|
throw new GovernanceError("REF_INTEGRITY_VIOLATION", `blob \u8DEF\u5F84\u5DF2\u5B58\u5728\u4E14\u5B57\u8282\u4E0D\u540C\uFF08sha256 \u78B0\u649E\u6216\u5185\u5BB9\u5BFB\u5740\u5B58\u50A8\u635F\u574F\uFF09\uFF1A${storagePath}`, "\u5185\u5BB9\u5BFB\u5740\u4E0D\u53D8\u91CF\uFF1A\u540C\u4E00\u8DEF\u5F84 \u21D4 \u540C\u4E00\u5B57\u8282\u3002\u8BF7\u6838\u67E5\u8BE5 blob \u7684\u5199\u5165\u6765\u6E90\uFF1B\u7981\u6B62\u8986\u76D6\u65E2\u6709 artifact", { storagePath, sha256 });
|
|
18979
18979
|
}
|
|
18980
18980
|
return { sha256, media: input.media, byteSize: input.bytes.length, storagePath };
|
|
18981
18981
|
}
|
|
18982
18982
|
try {
|
|
18983
|
-
mkdirSync2(
|
|
18983
|
+
mkdirSync2(dirname4(absolutePath), { recursive: true });
|
|
18984
18984
|
writeFileSync2(absolutePath, input.bytes);
|
|
18985
18985
|
} catch (error) {
|
|
18986
18986
|
throw new GovernanceError("ENVIRONMENT_ERROR", `blob \u5199\u5165\u5931\u8D25\uFF1A${storagePath}`, "\u68C0\u67E5\u78C1\u76D8\u53EF\u5199\u6027\u540E\u91CD\u8BD5\uFF1BpersistEvidenceArtifact \u662F evidence blob \u5E73\u9762\u7684\u552F\u4E00\u5199\u5165\u53E3", { storagePath, cause: String(error) });
|
|
18987
18987
|
}
|
|
18988
|
-
const readBack =
|
|
18988
|
+
const readBack = readFileSync3(absolutePath);
|
|
18989
18989
|
const readBackSha = sha256OfBytes(readBack);
|
|
18990
18990
|
if (readBackSha !== sha256) {
|
|
18991
18991
|
throw new GovernanceError("ENVIRONMENT_ERROR", `blob \u8BFB\u56DE\u81EA\u8BC1\u5931\u8D25\uFF08\u5199\u540E\u91CD\u7B97 ${readBackSha} \u2260 \u8EAB\u4EFD ${sha256}\uFF09\uFF1A${storagePath}`, "\u5B58\u50A8\u5C42\u4E0D\u53EF\u4FE1\uFF08\u5B57\u8282\u635F\u574F/\u5E76\u53D1\u8986\u5199\uFF09\uFF1B\u7981\u6B62\u643A\u5E26\u672A\u81EA\u8BC1\u7684 blob \u5F15\u7528\u5165\u8D26", { storagePath });
|
|
@@ -19044,7 +19044,7 @@ function assertArtifactBlobsExist(refs, evidenceDir) {
|
|
|
19044
19044
|
function parseBindingRecord(runRecordPath) {
|
|
19045
19045
|
let text;
|
|
19046
19046
|
try {
|
|
19047
|
-
text =
|
|
19047
|
+
text = readFileSync3(runRecordPath, "utf8");
|
|
19048
19048
|
} catch (error) {
|
|
19049
19049
|
if (isNotFoundError(error)) {
|
|
19050
19050
|
throw new GovernanceError("SCHEMA_INVALID", `run \u8BB0\u5F55\u6587\u4EF6\u7F3A\u5931\uFF1A${runRecordPath}`, "verifyEvidenceBinding \u6821\u9A8C\u5BF9\u8C61\u662F\u5DF2\u843D\u76D8\u7684 evidence/runs/GRN-*.json\uFF1B\u5148\u5165\u8D26\u518D\u6821\u9A8C", { runRecordPath });
|
|
@@ -19124,7 +19124,7 @@ function verifyEvidenceBinding(input) {
|
|
|
19124
19124
|
const absolutePath = blobAbsolutePath(input.evidenceDir, storagePath);
|
|
19125
19125
|
let bytes;
|
|
19126
19126
|
try {
|
|
19127
|
-
bytes =
|
|
19127
|
+
bytes = readFileSync3(absolutePath);
|
|
19128
19128
|
} catch (error) {
|
|
19129
19129
|
if (isNotFoundError(error)) {
|
|
19130
19130
|
return {
|
|
@@ -24283,13 +24283,13 @@ var init_ref_integrity = __esm({
|
|
|
24283
24283
|
|
|
24284
24284
|
// packages/kernel/dist/catalog.js
|
|
24285
24285
|
import { createHash as createHash3 } from "node:crypto";
|
|
24286
|
-
import { existsSync as existsSync2, readdirSync as readdirSync3, readFileSync as
|
|
24287
|
-
import { fileURLToPath } from "node:url";
|
|
24288
|
-
import { join as
|
|
24286
|
+
import { existsSync as existsSync2, readdirSync as readdirSync3, readFileSync as readFileSync4 } from "node:fs";
|
|
24287
|
+
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
24288
|
+
import { join as join3 } from "node:path";
|
|
24289
24289
|
function catalogRootCandidates(moduleUrl) {
|
|
24290
24290
|
return [
|
|
24291
|
-
|
|
24292
|
-
|
|
24291
|
+
fileURLToPath2(new URL("../../../catalog", moduleUrl)),
|
|
24292
|
+
fileURLToPath2(new URL("../catalog", moduleUrl))
|
|
24293
24293
|
];
|
|
24294
24294
|
}
|
|
24295
24295
|
function resolveCatalogRoot(explicitRoot) {
|
|
@@ -24307,7 +24307,7 @@ function resolveCatalogRoot(explicitRoot) {
|
|
|
24307
24307
|
throw new GovernanceError("NOT_CONFIGURED", `catalog/ \u76EE\u5F55\u672A\u627E\u5230\uFF08\u5019\u9009\u5747\u7F3A\u5E2D: ${candidates.join(" \u3001 ")}\uFF09`, "catalog/ \u662F POMaster_VNext \u4ED3\u5E93\u8D44\u4EA7\uFF08\u4ED3\u5E93\u5E03\u5C40 packages/kernel/{src,dist} \u2192 \u4ED3\u5E93\u6839 catalog/\uFF09\u6216 npm \u5B89\u88C5\u5F62\u6001\u7684\u5305\u5185\u8D44\u4EA7\uFF08<pkg>/dist/ \u2192 <pkg>/catalog/\uFF09\uFF1B\u5D4C\u5165\u65B9\u65E0\u6CD5\u547D\u4E2D\u65F6\u663E\u5F0F\u6CE8\u5165 catalog \u6839\u76EE\u5F55\u3002", { catalogRootCandidates: candidates });
|
|
24308
24308
|
}
|
|
24309
24309
|
function readCatalogLock(catalogRoot) {
|
|
24310
|
-
const lockPath =
|
|
24310
|
+
const lockPath = join3(catalogRoot, LOCK_FILE_NAME);
|
|
24311
24311
|
const raw = readText(lockPath);
|
|
24312
24312
|
if (raw === null) {
|
|
24313
24313
|
throw new GovernanceError("NOT_CONFIGURED", `catalog-lock \u7F3A\u5931: ${LOCK_FILE_NAME}`, "catalog-lock \u662F catalog \u7269\u6599\u7684 read-side \u6307\u7EB9\uFF08D24\uFF09\uFF1B\u5148\u8DD1 catalog/tools/materialize_*.py \u7269\u5316\u5E76\u91CD\u9501\u3002", { lockPath });
|
|
@@ -24361,11 +24361,11 @@ function verifyCatalogLock(catalogRoot, lock) {
|
|
|
24361
24361
|
}
|
|
24362
24362
|
const onDiskBySection = /* @__PURE__ */ new Map();
|
|
24363
24363
|
for (const section of CATALOG_SECTIONS) {
|
|
24364
|
-
const dir =
|
|
24364
|
+
const dir = join3(catalogRoot, section);
|
|
24365
24365
|
onDiskBySection.set(section, existsSync2(dir) ? new Set(readdirSync3(dir).filter((name) => name.endsWith(".json"))) : /* @__PURE__ */ new Set());
|
|
24366
24366
|
}
|
|
24367
24367
|
for (const entry of document.entries) {
|
|
24368
|
-
const target =
|
|
24368
|
+
const target = join3(catalogRoot, entry.path);
|
|
24369
24369
|
const raw = readText(target);
|
|
24370
24370
|
if (raw === null) {
|
|
24371
24371
|
drifts.push({
|
|
@@ -24423,7 +24423,7 @@ function asRecord2(value) {
|
|
|
24423
24423
|
return typeof value === "object" && value !== null ? value : {};
|
|
24424
24424
|
}
|
|
24425
24425
|
function loadCatalogPolicies(catalogRoot) {
|
|
24426
|
-
const dir =
|
|
24426
|
+
const dir = join3(catalogRoot, "policies");
|
|
24427
24427
|
if (!existsSync2(dir)) {
|
|
24428
24428
|
throw new GovernanceError("SCHEMA_INVALID", `catalog/policies/ \u76EE\u5F55\u7F3A\u5931: ${dir}`, "policies/ \u662F catalog-lock required \u7BA1\u8F96\u9762\uFF1B\u76EE\u5F55\u7F3A\u5931\u8BF4\u660E\u7269\u6599\u4E0D\u5B8C\u6574\uFF0C\u91CD\u8DD1 materialize \u5DE5\u5177\u3002", { dir });
|
|
24429
24429
|
}
|
|
@@ -24443,7 +24443,7 @@ function loadCatalogPolicies(catalogRoot) {
|
|
|
24443
24443
|
const materials = [];
|
|
24444
24444
|
for (const fileName of readdirSync3(dir).filter((name) => name.endsWith(".json")).sort()) {
|
|
24445
24445
|
const file = `policies/${fileName}`;
|
|
24446
|
-
const raw =
|
|
24446
|
+
const raw = readFileSync4(join3(dir, fileName), "utf8");
|
|
24447
24447
|
let body;
|
|
24448
24448
|
try {
|
|
24449
24449
|
body = asRecord2(JSON.parse(raw));
|
|
@@ -24546,19 +24546,19 @@ function loadCatalogPolicies(catalogRoot) {
|
|
|
24546
24546
|
return materials;
|
|
24547
24547
|
}
|
|
24548
24548
|
function loadCatalogTools(catalogRoot) {
|
|
24549
|
-
const dir =
|
|
24549
|
+
const dir = join3(catalogRoot, "tools");
|
|
24550
24550
|
if (!existsSync2(dir))
|
|
24551
24551
|
return [];
|
|
24552
24552
|
return readdirSync3(dir).filter((name) => name !== "." && name !== "..").filter((name) => !name.startsWith(".")).sort().map((name) => ({ file: `tools/${name}`, name }));
|
|
24553
24553
|
}
|
|
24554
24554
|
function loadCatalogProjectionPresets(catalogRoot) {
|
|
24555
|
-
const dir =
|
|
24555
|
+
const dir = join3(catalogRoot, "projection-presets");
|
|
24556
24556
|
if (!existsSync2(dir))
|
|
24557
24557
|
return [];
|
|
24558
24558
|
const materials = [];
|
|
24559
24559
|
for (const fileName of readdirSync3(dir).filter((name) => name.endsWith(".yaml")).sort()) {
|
|
24560
24560
|
const file = `projection-presets/${fileName}`;
|
|
24561
|
-
const lines =
|
|
24561
|
+
const lines = readFileSync4(join3(dir, fileName), "utf8").split("\n");
|
|
24562
24562
|
const pick3 = (key) => {
|
|
24563
24563
|
const pattern = new RegExp(`^ {2}${key}:(?:\\s+(\\S+))?\\s*(?:#.*)?$`);
|
|
24564
24564
|
let inPreset = false;
|
|
@@ -24591,14 +24591,14 @@ function isNonEmptyStringArray(value) {
|
|
|
24591
24591
|
return Array.isArray(value) && value.length > 0 && value.every((item) => typeof item === "string" && item.length > 0);
|
|
24592
24592
|
}
|
|
24593
24593
|
function loadCatalogSensors(catalogRoot) {
|
|
24594
|
-
const dir =
|
|
24594
|
+
const dir = join3(catalogRoot, "sensors");
|
|
24595
24595
|
if (!existsSync2(dir)) {
|
|
24596
24596
|
throw new GovernanceError("SCHEMA_INVALID", `catalog/sensors/ \u76EE\u5F55\u7F3A\u5931: ${dir}`, "sensors/ \u662F catalog-lock required \u7BA1\u8F96\u9762\uFF08P1-5 \u767B\u8BB0\u540E\uFF09\uFF1B\u76EE\u5F55\u7F3A\u5931\u8BF4\u660E\u7269\u6599\u4E0D\u5B8C\u6574\uFF0C\u5BF9\u7167 catalog-lock.draft.json required \u6BB5\u6062\u590D\u3002", { dir });
|
|
24597
24597
|
}
|
|
24598
24598
|
const materials = /* @__PURE__ */ new Map();
|
|
24599
24599
|
for (const fileName of readdirSync3(dir).filter((name) => name.endsWith(".json")).sort()) {
|
|
24600
24600
|
const file = `sensors/${fileName}`;
|
|
24601
|
-
const raw =
|
|
24601
|
+
const raw = readFileSync4(join3(dir, fileName), "utf8");
|
|
24602
24602
|
let body;
|
|
24603
24603
|
try {
|
|
24604
24604
|
body = asRecord2(JSON.parse(raw));
|
|
@@ -26542,7 +26542,7 @@ var init_supervisor_trigger = __esm({
|
|
|
26542
26542
|
|
|
26543
26543
|
// packages/kernel/dist/spec-analyzer.js
|
|
26544
26544
|
import { existsSync as existsSync4, readdirSync as readdirSync7 } from "node:fs";
|
|
26545
|
-
import { join as
|
|
26545
|
+
import { join as join4, relative, sep } from "node:path";
|
|
26546
26546
|
function normalizeClassificationValue(value) {
|
|
26547
26547
|
return CATALOG_CLASSIFICATION_VALUES.includes(value) ? value : null;
|
|
26548
26548
|
}
|
|
@@ -27187,7 +27187,7 @@ function walkMarkdownFiles(rootDir) {
|
|
|
27187
27187
|
let skipped = 0;
|
|
27188
27188
|
const walk = (dir) => {
|
|
27189
27189
|
for (const entry of readdirSync7(dir, { withFileTypes: true })) {
|
|
27190
|
-
const full =
|
|
27190
|
+
const full = join4(dir, entry.name);
|
|
27191
27191
|
if (entry.isDirectory()) {
|
|
27192
27192
|
walk(full);
|
|
27193
27193
|
continue;
|
|
@@ -27301,7 +27301,7 @@ function analyzeSpecDir(specDir) {
|
|
|
27301
27301
|
throw new GovernanceError("NOT_CONFIGURED", `spec \u76EE\u5F55\u65E0 Markdown \u6587\u4EF6: ${specDir}`, "\u786E\u8BA4\u76EE\u5F55\u662F\u5426\u4E3A spec \u76EE\u5F55\uFF1B\u7A7A\u76EE\u5F55\u662F\u663E\u5F0F\u9519\u8BEF\u800C\u975E\u7A7A\u6E05\u5355\uFF08\u5206\u6BCD fail-closed\uFF0C\u7981\u9759\u9ED8\u8FD4\u56DE\u7A7A\u62A5\u544A\uFF09", { specDir, skippedNonMarkdown: skipped });
|
|
27302
27302
|
}
|
|
27303
27303
|
const files = markdown.map((relativePath) => {
|
|
27304
|
-
const text = readText(
|
|
27304
|
+
const text = readText(join4(specDir, relativePath));
|
|
27305
27305
|
if (text === null) {
|
|
27306
27306
|
throw new GovernanceError("SCHEMA_INVALID", `spec \u6587\u4EF6\u626B\u63CF\u6E05\u5355\u5728\u5EA7\u800C\u8BFB\u53D6\u5931\u8D25\uFF08\u626B\u63CF\u540E\u6D88\u5931/\u5E76\u53D1\u5220\u6539\u7A97\u53E3\uFF09\uFF1A${relativePath}`, "\u91CD\u8DD1 analyzeSpecDir\uFF08\u7F3A\u5E2D\u6587\u4EF6\u82E5\u4E3A\u5E76\u53D1\u5220\u9664\u6240\u81F4\uFF0C\u4EE5\u91CD\u8DD1\u65F6\u7684\u771F\u5B9E\u76EE\u5F55\u4E3A\u51C6\uFF09\uFF1B\u7981\u9759\u9ED8\u6309\u7A7A\u6587\u4EF6\u8BA1\u5165\u5206\u6BCD", { specDir, relativePath });
|
|
27307
27307
|
}
|
|
@@ -28193,7 +28193,7 @@ var init_doctor = __esm({
|
|
|
28193
28193
|
});
|
|
28194
28194
|
|
|
28195
28195
|
// packages/kernel/dist/portability.js
|
|
28196
|
-
import { existsSync as existsSync5, mkdirSync as mkdirSync3, readdirSync as readdirSync10, readFileSync as
|
|
28196
|
+
import { existsSync as existsSync5, mkdirSync as mkdirSync3, readdirSync as readdirSync10, readFileSync as readFileSync5, rmSync as rmSync3, statSync as statSync2 } from "node:fs";
|
|
28197
28197
|
import { homedir } from "node:os";
|
|
28198
28198
|
import { resolve } from "node:path";
|
|
28199
28199
|
function canonicalPortabilityManifest() {
|
|
@@ -28724,7 +28724,7 @@ function stateHashes(rootDir) {
|
|
|
28724
28724
|
for (const entry of entries) {
|
|
28725
28725
|
const relName = rel.length > 0 ? `${rel}/${entry.name}` : entry.name;
|
|
28726
28726
|
if (entry.isFile()) {
|
|
28727
|
-
out.set(relName, sha256OfUtf8(
|
|
28727
|
+
out.set(relName, sha256OfUtf8(readFileSync5(`${dir}/${entry.name}`, "utf8")));
|
|
28728
28728
|
} else if (entry.isDirectory()) {
|
|
28729
28729
|
walk(`${dir}/${entry.name}`, relName);
|
|
28730
28730
|
}
|
|
@@ -31443,7 +31443,7 @@ var init_adapter_types = __esm({
|
|
|
31443
31443
|
});
|
|
31444
31444
|
|
|
31445
31445
|
// packages/gauntlet-lite/dist/detectors.js
|
|
31446
|
-
import { statSync as statSync4, readFileSync as
|
|
31446
|
+
import { statSync as statSync4, readFileSync as readFileSync7 } from "node:fs";
|
|
31447
31447
|
import { join as pathJoin } from "node:path";
|
|
31448
31448
|
function platformDetectorFacts(projectRoot) {
|
|
31449
31449
|
const isWindows = process.platform === "win32";
|
|
@@ -31462,7 +31462,7 @@ function platformDetectorFacts(projectRoot) {
|
|
|
31462
31462
|
},
|
|
31463
31463
|
readTextFile: (absolutePath) => {
|
|
31464
31464
|
try {
|
|
31465
|
-
return
|
|
31465
|
+
return readFileSync7(absolutePath, "utf8");
|
|
31466
31466
|
} catch {
|
|
31467
31467
|
return null;
|
|
31468
31468
|
}
|
|
@@ -32112,10 +32112,10 @@ var init_normalize_common = __esm({
|
|
|
32112
32112
|
});
|
|
32113
32113
|
|
|
32114
32114
|
// packages/gauntlet-lite/dist/pytest-leg.js
|
|
32115
|
-
import { spawnSync } from "node:child_process";
|
|
32116
|
-
import { mkdtempSync, readFileSync as
|
|
32115
|
+
import { spawnSync as spawnSync2 } from "node:child_process";
|
|
32116
|
+
import { mkdtempSync, readFileSync as readFileSync8, rmSync as rmSync4 } from "node:fs";
|
|
32117
32117
|
import { tmpdir } from "node:os";
|
|
32118
|
-
import { join as
|
|
32118
|
+
import { join as join6 } from "node:path";
|
|
32119
32119
|
import { performance as performance2 } from "node:perf_hooks";
|
|
32120
32120
|
function runPytestLeg(plan, spawnFn = pytestSpawn) {
|
|
32121
32121
|
const probeTimeoutMs = Math.min(plan.timeoutMs, 6e4);
|
|
@@ -32139,8 +32139,8 @@ function runPytestLeg(plan, spawnFn = pytestSpawn) {
|
|
|
32139
32139
|
let runCommand = plan.command;
|
|
32140
32140
|
let reportDir = null;
|
|
32141
32141
|
try {
|
|
32142
|
-
reportDir = mkdtempSync(
|
|
32143
|
-
runCommand = `${plan.command} --junitxml="${
|
|
32142
|
+
reportDir = mkdtempSync(join6(tmpdir(), "pomaster-gauntlet-pytest-"));
|
|
32143
|
+
runCommand = `${plan.command} --junitxml="${join6(reportDir, "junit.xml")}"`;
|
|
32144
32144
|
} catch {
|
|
32145
32145
|
reportDir = null;
|
|
32146
32146
|
}
|
|
@@ -32151,7 +32151,7 @@ function runPytestLeg(plan, spawnFn = pytestSpawn) {
|
|
|
32151
32151
|
let stdout = run.stdout;
|
|
32152
32152
|
if (reportDir !== null) {
|
|
32153
32153
|
try {
|
|
32154
|
-
stdout =
|
|
32154
|
+
stdout = readFileSync8(join6(reportDir, "junit.xml"), "utf8");
|
|
32155
32155
|
} catch {
|
|
32156
32156
|
}
|
|
32157
32157
|
try {
|
|
@@ -32343,7 +32343,7 @@ var init_pytest_leg = __esm({
|
|
|
32343
32343
|
pytestSpawn = (command, options) => {
|
|
32344
32344
|
const startedAt = performance2.now();
|
|
32345
32345
|
const sanitizedEnv = stripQuotesFromPathEnv({ ...process.env });
|
|
32346
|
-
const res =
|
|
32346
|
+
const res = spawnSync2(command, {
|
|
32347
32347
|
shell: true,
|
|
32348
32348
|
cwd: options.cwd,
|
|
32349
32349
|
timeout: options.timeoutMs,
|
|
@@ -32366,7 +32366,7 @@ var init_pytest_leg = __esm({
|
|
|
32366
32366
|
});
|
|
32367
32367
|
|
|
32368
32368
|
// packages/gauntlet-lite/dist/build-adapter.js
|
|
32369
|
-
import { spawnSync as
|
|
32369
|
+
import { spawnSync as spawnSync3 } from "node:child_process";
|
|
32370
32370
|
import { performance as performance3 } from "node:perf_hooks";
|
|
32371
32371
|
function detectVitest(facts) {
|
|
32372
32372
|
const tool = VITEST_TOOL_ID;
|
|
@@ -32754,7 +32754,7 @@ var init_build_adapter = __esm({
|
|
|
32754
32754
|
defaultSpawn = (command, options) => {
|
|
32755
32755
|
const startedAt = performance3.now();
|
|
32756
32756
|
const sanitizedEnv = stripQuotesFromPathEnv({ ...process.env });
|
|
32757
|
-
const res =
|
|
32757
|
+
const res = spawnSync3(command, {
|
|
32758
32758
|
shell: true,
|
|
32759
32759
|
cwd: options.cwd,
|
|
32760
32760
|
timeout: options.timeoutMs,
|
|
@@ -32776,7 +32776,7 @@ var init_build_adapter = __esm({
|
|
|
32776
32776
|
});
|
|
32777
32777
|
|
|
32778
32778
|
// packages/gauntlet-lite/dist/browser-adapter.js
|
|
32779
|
-
import { spawnSync as
|
|
32779
|
+
import { spawnSync as spawnSync4 } from "node:child_process";
|
|
32780
32780
|
import { performance as performance4 } from "node:perf_hooks";
|
|
32781
32781
|
function pngSignatureMatches(base64Data) {
|
|
32782
32782
|
const decoded = Buffer.from(base64Data, "base64");
|
|
@@ -33180,7 +33180,7 @@ var init_browser_adapter = __esm({
|
|
|
33180
33180
|
})}
|
|
33181
33181
|
`;
|
|
33182
33182
|
defaultMcpSmokeFn = (plan) => {
|
|
33183
|
-
const res =
|
|
33183
|
+
const res = spawnSync4(plan.smokeCommand, {
|
|
33184
33184
|
shell: true,
|
|
33185
33185
|
cwd: plan.projectRoot,
|
|
33186
33186
|
input: MCP_INITIALIZE_MESSAGE,
|
|
@@ -33220,8 +33220,8 @@ var init_browser_adapter = __esm({
|
|
|
33220
33220
|
});
|
|
33221
33221
|
|
|
33222
33222
|
// packages/gauntlet-lite/dist/playwright-leg.js
|
|
33223
|
-
import { spawnSync as
|
|
33224
|
-
import { existsSync as existsSync9, readFileSync as
|
|
33223
|
+
import { spawnSync as spawnSync5 } from "node:child_process";
|
|
33224
|
+
import { existsSync as existsSync9, readFileSync as readFileSync9, rmSync as rmSync5 } from "node:fs";
|
|
33225
33225
|
import { isAbsolute as pathIsAbsolute, join as pathJoin2, relative as pathRelative, resolve as pathResolve } from "node:path";
|
|
33226
33226
|
import { performance as performance5 } from "node:perf_hooks";
|
|
33227
33227
|
function isPlainObject2(value) {
|
|
@@ -33384,7 +33384,7 @@ function runPlaywrightLeg(plan, spawnFn = playwrightSpawn, executableProbe = pla
|
|
|
33384
33384
|
});
|
|
33385
33385
|
let reportText = null;
|
|
33386
33386
|
try {
|
|
33387
|
-
reportText =
|
|
33387
|
+
reportText = readFileSync9(reportAbs, "utf8");
|
|
33388
33388
|
} catch {
|
|
33389
33389
|
reportText = null;
|
|
33390
33390
|
}
|
|
@@ -33853,7 +33853,7 @@ var init_playwright_leg = __esm({
|
|
|
33853
33853
|
playwrightSpawn = (command, options) => {
|
|
33854
33854
|
const startedAt = performance5.now();
|
|
33855
33855
|
const sanitizedEnv = stripQuotesFromPathEnv({ ...process.env });
|
|
33856
|
-
const res =
|
|
33856
|
+
const res = spawnSync5(command, {
|
|
33857
33857
|
shell: true,
|
|
33858
33858
|
cwd: options.cwd,
|
|
33859
33859
|
timeout: options.timeoutMs,
|
|
@@ -34121,7 +34121,7 @@ var init_browser_legs = __esm({
|
|
|
34121
34121
|
});
|
|
34122
34122
|
|
|
34123
34123
|
// packages/gauntlet-lite/dist/oasdiff-leg.js
|
|
34124
|
-
import { spawnSync as
|
|
34124
|
+
import { spawnSync as spawnSync6 } from "node:child_process";
|
|
34125
34125
|
import { performance as performance7 } from "node:perf_hooks";
|
|
34126
34126
|
function oasdiffLegExecutable(versionProbeCommand) {
|
|
34127
34127
|
return firstCommandToken(versionProbeCommand);
|
|
@@ -34350,7 +34350,7 @@ var init_oasdiff_leg = __esm({
|
|
|
34350
34350
|
oasdiffSpawn = (command, options) => {
|
|
34351
34351
|
const startedAt = performance7.now();
|
|
34352
34352
|
const sanitizedEnv = stripQuotesFromPathEnv({ ...process.env });
|
|
34353
|
-
const res =
|
|
34353
|
+
const res = spawnSync6(command, {
|
|
34354
34354
|
shell: true,
|
|
34355
34355
|
cwd: options.cwd,
|
|
34356
34356
|
timeout: options.timeoutMs,
|
|
@@ -34375,8 +34375,8 @@ var init_oasdiff_leg = __esm({
|
|
|
34375
34375
|
});
|
|
34376
34376
|
|
|
34377
34377
|
// packages/gauntlet-lite/dist/schemathesis-leg.js
|
|
34378
|
-
import { spawnSync as
|
|
34379
|
-
import { existsSync as existsSync10, readFileSync as
|
|
34378
|
+
import { spawnSync as spawnSync7 } from "node:child_process";
|
|
34379
|
+
import { existsSync as existsSync10, readFileSync as readFileSync10, rmSync as rmSync6 } from "node:fs";
|
|
34380
34380
|
import { isAbsolute as pathIsAbsolute2, join as pathJoin3, relative as pathRelative2, resolve as pathResolve2 } from "node:path";
|
|
34381
34381
|
import { performance as performance8 } from "node:perf_hooks";
|
|
34382
34382
|
function pathEscapesProjectRoot2(projectRoot, absolutePath) {
|
|
@@ -34463,7 +34463,7 @@ function runSchemathesisLeg(plan, spawnFn = schemathesisSpawn, executableProbe =
|
|
|
34463
34463
|
});
|
|
34464
34464
|
let reportText = null;
|
|
34465
34465
|
try {
|
|
34466
|
-
reportText =
|
|
34466
|
+
reportText = readFileSync10(reportAbs, "utf8");
|
|
34467
34467
|
} catch {
|
|
34468
34468
|
reportText = null;
|
|
34469
34469
|
}
|
|
@@ -34746,7 +34746,7 @@ var init_schemathesis_leg = __esm({
|
|
|
34746
34746
|
schemathesisSpawn = (command, options) => {
|
|
34747
34747
|
const startedAt = performance8.now();
|
|
34748
34748
|
const sanitizedEnv = stripQuotesFromPathEnv({ ...process.env });
|
|
34749
|
-
const res =
|
|
34749
|
+
const res = spawnSync7(command, {
|
|
34750
34750
|
shell: true,
|
|
34751
34751
|
cwd: options.cwd,
|
|
34752
34752
|
timeout: options.timeoutMs,
|
|
@@ -34770,7 +34770,7 @@ var init_schemathesis_leg = __esm({
|
|
|
34770
34770
|
});
|
|
34771
34771
|
|
|
34772
34772
|
// packages/gauntlet-lite/dist/contract-adapter.js
|
|
34773
|
-
import { readFileSync as
|
|
34773
|
+
import { readFileSync as readFileSync11 } from "node:fs";
|
|
34774
34774
|
import { join as pathJoin4 } from "node:path";
|
|
34775
34775
|
import { performance as performance9 } from "node:perf_hooks";
|
|
34776
34776
|
function readContractConfig(facts) {
|
|
@@ -35144,7 +35144,7 @@ function createContractAdapter(options = {}) {
|
|
|
35144
35144
|
}
|
|
35145
35145
|
let text;
|
|
35146
35146
|
try {
|
|
35147
|
-
text =
|
|
35147
|
+
text = readFileSync11(pathJoin4(plan.projectRoot, plan.openapiPath ?? ""), "utf8");
|
|
35148
35148
|
} catch {
|
|
35149
35149
|
return {
|
|
35150
35150
|
plan,
|
|
@@ -35275,7 +35275,7 @@ var init_contract_adapter = __esm({
|
|
|
35275
35275
|
});
|
|
35276
35276
|
|
|
35277
35277
|
// packages/gauntlet-lite/dist/dependency-cruiser-leg.js
|
|
35278
|
-
import { spawnSync as
|
|
35278
|
+
import { spawnSync as spawnSync8 } from "node:child_process";
|
|
35279
35279
|
import { performance as performance10 } from "node:perf_hooks";
|
|
35280
35280
|
function runDepcruiseLeg(plan, spawnFn = depcruiseSpawn, executableProbe = platformExecutableProbe) {
|
|
35281
35281
|
const executable = firstCommandToken(plan.command);
|
|
@@ -35459,7 +35459,7 @@ var init_dependency_cruiser_leg = __esm({
|
|
|
35459
35459
|
depcruiseSpawn = (command, options) => {
|
|
35460
35460
|
const startedAt = performance10.now();
|
|
35461
35461
|
const sanitizedEnv = stripQuotesFromPathEnv({ ...process.env });
|
|
35462
|
-
const res =
|
|
35462
|
+
const res = spawnSync8(command, {
|
|
35463
35463
|
shell: true,
|
|
35464
35464
|
cwd: options.cwd,
|
|
35465
35465
|
timeout: options.timeoutMs,
|
|
@@ -35482,7 +35482,7 @@ var init_dependency_cruiser_leg = __esm({
|
|
|
35482
35482
|
});
|
|
35483
35483
|
|
|
35484
35484
|
// packages/gauntlet-lite/dist/import-linter-leg.js
|
|
35485
|
-
import { spawnSync as
|
|
35485
|
+
import { spawnSync as spawnSync9 } from "node:child_process";
|
|
35486
35486
|
import { performance as performance11 } from "node:perf_hooks";
|
|
35487
35487
|
function runImportLinterLeg(plan, spawnFn = importLinterSpawn, executableProbe = platformExecutableProbe) {
|
|
35488
35488
|
const executable = firstCommandToken(plan.command);
|
|
@@ -35653,7 +35653,7 @@ var init_import_linter_leg = __esm({
|
|
|
35653
35653
|
importLinterSpawn = (command, options) => {
|
|
35654
35654
|
const startedAt = performance11.now();
|
|
35655
35655
|
const sanitizedEnv = stripQuotesFromPathEnv({ ...process.env });
|
|
35656
|
-
const res =
|
|
35656
|
+
const res = spawnSync9(command, {
|
|
35657
35657
|
shell: true,
|
|
35658
35658
|
cwd: options.cwd,
|
|
35659
35659
|
timeout: options.timeoutMs,
|
|
@@ -35677,7 +35677,7 @@ var init_import_linter_leg = __esm({
|
|
|
35677
35677
|
});
|
|
35678
35678
|
|
|
35679
35679
|
// packages/gauntlet-lite/dist/architecture-adapter.js
|
|
35680
|
-
import { readdirSync as readdirSync15, readFileSync as
|
|
35680
|
+
import { readdirSync as readdirSync15, readFileSync as readFileSync12 } from "node:fs";
|
|
35681
35681
|
import { join as pathJoin5, sep as pathSep } from "node:path";
|
|
35682
35682
|
import { performance as performance12 } from "node:perf_hooks";
|
|
35683
35683
|
function readArchitectureConfig(facts) {
|
|
@@ -36069,7 +36069,7 @@ function createArchitectureAdapter(options = {}) {
|
|
|
36069
36069
|
filesCovered++;
|
|
36070
36070
|
let text;
|
|
36071
36071
|
try {
|
|
36072
|
-
text =
|
|
36072
|
+
text = readFileSync12(pathJoin5(plan.projectRoot, relative3), "utf8");
|
|
36073
36073
|
} catch {
|
|
36074
36074
|
continue;
|
|
36075
36075
|
}
|
|
@@ -36211,8 +36211,8 @@ var init_architecture_adapter = __esm({
|
|
|
36211
36211
|
});
|
|
36212
36212
|
|
|
36213
36213
|
// packages/gauntlet-lite/dist/coverage-leg.js
|
|
36214
|
-
import { spawnSync as
|
|
36215
|
-
import { existsSync as existsSync11, readFileSync as
|
|
36214
|
+
import { spawnSync as spawnSync10 } from "node:child_process";
|
|
36215
|
+
import { existsSync as existsSync11, readFileSync as readFileSync13, rmSync as rmSync7 } from "node:fs";
|
|
36216
36216
|
import { join as pathJoin6, dirname as pathDirname, isAbsolute as pathIsAbsolute3, relative as pathRelative3, resolve as pathResolve3 } from "node:path";
|
|
36217
36217
|
import { performance as performance13 } from "node:perf_hooks";
|
|
36218
36218
|
function resolveCoverageProvisionalThresholdsForTier(tier) {
|
|
@@ -36296,7 +36296,7 @@ function runCoverageLeg(plan, spawnFn = coverageSpawn, executableProbe = platfor
|
|
|
36296
36296
|
});
|
|
36297
36297
|
let reportText = null;
|
|
36298
36298
|
try {
|
|
36299
|
-
reportText =
|
|
36299
|
+
reportText = readFileSync13(reportAbs, "utf8");
|
|
36300
36300
|
} catch {
|
|
36301
36301
|
reportText = null;
|
|
36302
36302
|
}
|
|
@@ -36624,7 +36624,7 @@ var init_coverage_leg = __esm({
|
|
|
36624
36624
|
coverageSpawn = (command, options) => {
|
|
36625
36625
|
const startedAt = performance13.now();
|
|
36626
36626
|
const sanitizedEnv = stripQuotesFromPathEnv({ ...process.env });
|
|
36627
|
-
const res =
|
|
36627
|
+
const res = spawnSync10(command, {
|
|
36628
36628
|
shell: true,
|
|
36629
36629
|
cwd: options.cwd,
|
|
36630
36630
|
timeout: options.timeoutMs,
|
|
@@ -36861,7 +36861,7 @@ var init_crap = __esm({
|
|
|
36861
36861
|
});
|
|
36862
36862
|
|
|
36863
36863
|
// packages/gauntlet-lite/dist/coverage-adapter.js
|
|
36864
|
-
import { readFileSync as
|
|
36864
|
+
import { readFileSync as readFileSync14 } from "node:fs";
|
|
36865
36865
|
import { join as pathJoin7 } from "node:path";
|
|
36866
36866
|
import { performance as performance14 } from "node:perf_hooks";
|
|
36867
36867
|
function isPlainObject3(value) {
|
|
@@ -37334,7 +37334,7 @@ function createCrapGateAdapter() {
|
|
|
37334
37334
|
}
|
|
37335
37335
|
const readOrNull = (relative3) => {
|
|
37336
37336
|
try {
|
|
37337
|
-
return
|
|
37337
|
+
return readFileSync14(pathJoin7(plan.projectRoot, relative3), "utf8");
|
|
37338
37338
|
} catch {
|
|
37339
37339
|
return null;
|
|
37340
37340
|
}
|
|
@@ -37378,8 +37378,8 @@ var init_coverage_adapter = __esm({
|
|
|
37378
37378
|
});
|
|
37379
37379
|
|
|
37380
37380
|
// packages/gauntlet-lite/dist/mutation-leg.js
|
|
37381
|
-
import { spawnSync as
|
|
37382
|
-
import { existsSync as existsSync12, readFileSync as
|
|
37381
|
+
import { spawnSync as spawnSync11 } from "node:child_process";
|
|
37382
|
+
import { existsSync as existsSync12, readFileSync as readFileSync15, rmSync as rmSync8 } from "node:fs";
|
|
37383
37383
|
import { join as pathJoin8, isAbsolute as pathIsAbsolute4, relative as pathRelative4, resolve as pathResolve4 } from "node:path";
|
|
37384
37384
|
import { performance as performance15 } from "node:perf_hooks";
|
|
37385
37385
|
function runMutationLeg(plan, spawnFn = mutationSpawn, executableProbe = platformExecutableProbe) {
|
|
@@ -37453,7 +37453,7 @@ function runMutationLeg(plan, spawnFn = mutationSpawn, executableProbe = platfor
|
|
|
37453
37453
|
});
|
|
37454
37454
|
let reportText = null;
|
|
37455
37455
|
try {
|
|
37456
|
-
reportText =
|
|
37456
|
+
reportText = readFileSync15(reportAbs, "utf8");
|
|
37457
37457
|
} catch {
|
|
37458
37458
|
reportText = null;
|
|
37459
37459
|
}
|
|
@@ -37852,7 +37852,7 @@ var init_mutation_leg = __esm({
|
|
|
37852
37852
|
mutationSpawn = (command, options) => {
|
|
37853
37853
|
const startedAt = performance15.now();
|
|
37854
37854
|
const sanitizedEnv = stripQuotesFromPathEnv({ ...process.env });
|
|
37855
|
-
const res =
|
|
37855
|
+
const res = spawnSync11(command, {
|
|
37856
37856
|
shell: true,
|
|
37857
37857
|
cwd: options.cwd,
|
|
37858
37858
|
timeout: options.timeoutMs,
|
|
@@ -38207,8 +38207,8 @@ var init_mutation_adapter = __esm({
|
|
|
38207
38207
|
});
|
|
38208
38208
|
|
|
38209
38209
|
// packages/gauntlet-lite/dist/performance-leg.js
|
|
38210
|
-
import { spawnSync as
|
|
38211
|
-
import { existsSync as existsSync13, readFileSync as
|
|
38210
|
+
import { spawnSync as spawnSync12 } from "node:child_process";
|
|
38211
|
+
import { existsSync as existsSync13, readFileSync as readFileSync16, rmSync as rmSync9 } from "node:fs";
|
|
38212
38212
|
import { isAbsolute as pathIsAbsolute5, join as pathJoin9, relative as pathRelative5, resolve as pathResolve5 } from "node:path";
|
|
38213
38213
|
import { performance as performance17 } from "node:perf_hooks";
|
|
38214
38214
|
function performanceCapabilityNote(runner) {
|
|
@@ -38463,7 +38463,7 @@ function runPerformanceLeg(plan, spawnFn = performanceSpawn, executableProbe = p
|
|
|
38463
38463
|
});
|
|
38464
38464
|
let reportText = null;
|
|
38465
38465
|
try {
|
|
38466
|
-
reportText =
|
|
38466
|
+
reportText = readFileSync16(reportAbs, "utf8");
|
|
38467
38467
|
} catch {
|
|
38468
38468
|
reportText = null;
|
|
38469
38469
|
}
|
|
@@ -38973,7 +38973,7 @@ var init_performance_leg = __esm({
|
|
|
38973
38973
|
performanceSpawn = (command, options) => {
|
|
38974
38974
|
const startedAt = performance17.now();
|
|
38975
38975
|
const sanitizedEnv = stripQuotesFromPathEnv({ ...process.env });
|
|
38976
|
-
const res =
|
|
38976
|
+
const res = spawnSync12(command, {
|
|
38977
38977
|
shell: true,
|
|
38978
38978
|
cwd: options.cwd,
|
|
38979
38979
|
timeout: options.timeoutMs,
|
|
@@ -39271,8 +39271,8 @@ var init_performance_adapter = __esm({
|
|
|
39271
39271
|
});
|
|
39272
39272
|
|
|
39273
39273
|
// packages/gauntlet-lite/dist/security-leg.js
|
|
39274
|
-
import { spawnSync as
|
|
39275
|
-
import { existsSync as existsSync14, readFileSync as
|
|
39274
|
+
import { spawnSync as spawnSync13 } from "node:child_process";
|
|
39275
|
+
import { existsSync as existsSync14, readFileSync as readFileSync17, rmSync as rmSync10 } from "node:fs";
|
|
39276
39276
|
import { isAbsolute as pathIsAbsolute6, join as pathJoin10, relative as pathRelative6, resolve as pathResolve6 } from "node:path";
|
|
39277
39277
|
import { performance as performance19 } from "node:perf_hooks";
|
|
39278
39278
|
function securityCapabilityNote(runner) {
|
|
@@ -39349,7 +39349,7 @@ function runSecurityLeg(plan, spawnFn = securitySpawn, executableProbe = platfor
|
|
|
39349
39349
|
});
|
|
39350
39350
|
let reportText = null;
|
|
39351
39351
|
try {
|
|
39352
|
-
reportText =
|
|
39352
|
+
reportText = readFileSync17(reportAbs, "utf8");
|
|
39353
39353
|
} catch {
|
|
39354
39354
|
reportText = null;
|
|
39355
39355
|
}
|
|
@@ -39686,7 +39686,7 @@ var init_security_leg = __esm({
|
|
|
39686
39686
|
securitySpawn = (command, options) => {
|
|
39687
39687
|
const startedAt = performance19.now();
|
|
39688
39688
|
const sanitizedEnv = stripQuotesFromPathEnv({ ...process.env });
|
|
39689
|
-
const res =
|
|
39689
|
+
const res = spawnSync13(command, {
|
|
39690
39690
|
shell: true,
|
|
39691
39691
|
cwd: options.cwd,
|
|
39692
39692
|
timeout: options.timeoutMs,
|
|
@@ -41092,6 +41092,9 @@ var {
|
|
|
41092
41092
|
Help
|
|
41093
41093
|
} = import_index.default;
|
|
41094
41094
|
|
|
41095
|
+
// packages/cli/dist/index.js
|
|
41096
|
+
import { createInterface } from "node:readline";
|
|
41097
|
+
|
|
41095
41098
|
// packages/cli/dist/cli-info.js
|
|
41096
41099
|
var CLI_NAME = "pomaster";
|
|
41097
41100
|
var CLI_VERSION = "0.0.0";
|
|
@@ -41132,6 +41135,8 @@ var DISCOVERY_ID_PATTERN = /^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$/;
|
|
|
41132
41135
|
var CONFIG_RELATIVE = ".pomaster/config.yaml";
|
|
41133
41136
|
var AGENTS_MD_RELATIVE = "AGENTS.md";
|
|
41134
41137
|
var CLAUDE_MD_RELATIVE = "CLAUDE.md";
|
|
41138
|
+
var CURSOR_RULES_RELATIVE = ".cursor/rules/pomaster.mdc";
|
|
41139
|
+
var QODER_RULES_RELATIVE = ".qoder/rules/pomaster.md";
|
|
41135
41140
|
var GENERATED_MARKER = "<!-- pomaster:generated -->";
|
|
41136
41141
|
function truthIndexPath(rootDir) {
|
|
41137
41142
|
return join(rootDir, ...TRUTH_INDEX_RELATIVE.split("/"));
|
|
@@ -41337,6 +41342,143 @@ function triageRequest(request) {
|
|
|
41337
41342
|
}
|
|
41338
41343
|
|
|
41339
41344
|
// packages/cli/dist/init.js
|
|
41345
|
+
var INIT_PLATFORMS = ["claude", "codex", "cursor", "qoder"];
|
|
41346
|
+
var THIN_POINTER_BODY = [
|
|
41347
|
+
"# POMaster vNext \u2014 Agent \u5165\u53E3\u6307\u9488",
|
|
41348
|
+
"\u552F\u4E00\u4E8B\u5B9E\u6E90\u662F\u4ED3\u5E93\u6839\u7684 `AGENTS.md`\uFF08\u7531 `pomaster init` \u751F\u6210\uFF0C\u5E42\u7B49\uFF09\uFF1B\u5148\u8BFB\u6839\u76EE\u5F55 `AGENTS.md`\uFF0C\u9075\u5FAA\u5176\u300C\u5F53\u524D\u6CBB\u7406\u6863\u4F4D\u300D\u4E0E\u300C\u5E38\u7528\u547D\u4EE4\u300D\u3002"
|
|
41349
|
+
].join("\n");
|
|
41350
|
+
var PLATFORM_ADAPTERS = [
|
|
41351
|
+
{
|
|
41352
|
+
name: "claude",
|
|
41353
|
+
file: CLAUDE_MD_RELATIVE,
|
|
41354
|
+
coveredByAgentsMd: false,
|
|
41355
|
+
render: () => CLAUDE_ENTRY_CONTENT
|
|
41356
|
+
},
|
|
41357
|
+
{
|
|
41358
|
+
name: "codex",
|
|
41359
|
+
file: AGENTS_MD_RELATIVE,
|
|
41360
|
+
coveredByAgentsMd: true,
|
|
41361
|
+
render: () => ""
|
|
41362
|
+
},
|
|
41363
|
+
{
|
|
41364
|
+
name: "cursor",
|
|
41365
|
+
file: CURSOR_RULES_RELATIVE,
|
|
41366
|
+
coveredByAgentsMd: false,
|
|
41367
|
+
render: () => [
|
|
41368
|
+
"---",
|
|
41369
|
+
"description: POMaster vNext \u6CBB\u7406\u5165\u53E3\uFF08\u552F\u4E00\u4E8B\u5B9E\u6E90\uFF1A\u4ED3\u5E93\u6839 AGENTS.md\uFF09",
|
|
41370
|
+
"globs:",
|
|
41371
|
+
"alwaysApply: true",
|
|
41372
|
+
"---",
|
|
41373
|
+
"",
|
|
41374
|
+
THIN_POINTER_BODY
|
|
41375
|
+
].join("\n")
|
|
41376
|
+
},
|
|
41377
|
+
{
|
|
41378
|
+
name: "qoder",
|
|
41379
|
+
file: QODER_RULES_RELATIVE,
|
|
41380
|
+
coveredByAgentsMd: false,
|
|
41381
|
+
render: () => [
|
|
41382
|
+
"---",
|
|
41383
|
+
"trigger: always_on",
|
|
41384
|
+
"---",
|
|
41385
|
+
"",
|
|
41386
|
+
THIN_POINTER_BODY
|
|
41387
|
+
].join("\n")
|
|
41388
|
+
}
|
|
41389
|
+
];
|
|
41390
|
+
var PLATFORM_WORDS_HINT = `\u5408\u6CD5\u8BCD\u5F62\uFF1A${INIT_PLATFORMS.join(" | ")} | none`;
|
|
41391
|
+
function parsePlatformSelection(raw) {
|
|
41392
|
+
const tokens = raw.split(",").map((token) => token.trim()).filter((token) => token.length > 0);
|
|
41393
|
+
if (tokens.length === 0) {
|
|
41394
|
+
return {
|
|
41395
|
+
ok: false,
|
|
41396
|
+
error: {
|
|
41397
|
+
code: "SCHEMA_INVALID",
|
|
41398
|
+
message: `\u5E73\u53F0\u9009\u62E9\u4E3A\u7A7A\uFF1B${PLATFORM_WORDS_HINT}`,
|
|
41399
|
+
hint: "\u793A\u4F8B\uFF1A--platforms claude,cursor \u6216 --platforms none\u3002"
|
|
41400
|
+
}
|
|
41401
|
+
};
|
|
41402
|
+
}
|
|
41403
|
+
if (tokens.includes("none")) {
|
|
41404
|
+
if (tokens.length > 1) {
|
|
41405
|
+
return {
|
|
41406
|
+
ok: false,
|
|
41407
|
+
error: {
|
|
41408
|
+
code: "SCHEMA_INVALID",
|
|
41409
|
+
message: `none \u4E0D\u53EF\u4E0E\u5176\u4ED6\u5E73\u53F0\u5E76\u5217\uFF1A${raw.trim()}`,
|
|
41410
|
+
hint: `${PLATFORM_WORDS_HINT}\uFF1B\u53EA\u5EFA AGENTS.md/\u72B6\u6001\u9AA8\u67B6\u65F6\u5355\u72EC\u4F7F\u7528 none\u3002`
|
|
41411
|
+
}
|
|
41412
|
+
};
|
|
41413
|
+
}
|
|
41414
|
+
return { ok: true, platforms: [] };
|
|
41415
|
+
}
|
|
41416
|
+
const platforms = [];
|
|
41417
|
+
const push = (platform) => {
|
|
41418
|
+
if (!platforms.includes(platform))
|
|
41419
|
+
platforms.push(platform);
|
|
41420
|
+
};
|
|
41421
|
+
for (const token of tokens) {
|
|
41422
|
+
if (INIT_PLATFORMS.includes(token)) {
|
|
41423
|
+
push(token);
|
|
41424
|
+
continue;
|
|
41425
|
+
}
|
|
41426
|
+
if (token === "a" || token === "all") {
|
|
41427
|
+
for (const platform of INIT_PLATFORMS)
|
|
41428
|
+
push(platform);
|
|
41429
|
+
continue;
|
|
41430
|
+
}
|
|
41431
|
+
if (/^[1-9][0-9]*$/.test(token)) {
|
|
41432
|
+
const platform = INIT_PLATFORMS[Number.parseInt(token, 10) - 1];
|
|
41433
|
+
if (platform === void 0) {
|
|
41434
|
+
return {
|
|
41435
|
+
ok: false,
|
|
41436
|
+
error: {
|
|
41437
|
+
code: "SCHEMA_INVALID",
|
|
41438
|
+
message: `\u5E73\u53F0\u7F16\u53F7\u8D8A\u754C\uFF1A${token}\uFF1B${PLATFORM_WORDS_HINT}`,
|
|
41439
|
+
hint: `\u7F16\u53F7\u5BF9\u5E94 renderPlatformMenu \u6E05\u5355\uFF081-${INIT_PLATFORMS.length}\uFF09\u3002`
|
|
41440
|
+
}
|
|
41441
|
+
};
|
|
41442
|
+
}
|
|
41443
|
+
push(platform);
|
|
41444
|
+
continue;
|
|
41445
|
+
}
|
|
41446
|
+
return {
|
|
41447
|
+
ok: false,
|
|
41448
|
+
error: {
|
|
41449
|
+
code: "SCHEMA_INVALID",
|
|
41450
|
+
message: `\u975E\u6CD5\u5E73\u53F0\u8BCD\u5F62\uFF1A${token}\uFF1B${PLATFORM_WORDS_HINT}`,
|
|
41451
|
+
hint: "\u793A\u4F8B\uFF1A--platforms claude,cursor \u6216 --platforms none\u3002"
|
|
41452
|
+
}
|
|
41453
|
+
};
|
|
41454
|
+
}
|
|
41455
|
+
return { ok: true, platforms };
|
|
41456
|
+
}
|
|
41457
|
+
function renderPlatformMenu() {
|
|
41458
|
+
const lines = ["\u53EF\u542F\u7528\u7684\u5E73\u53F0\u9002\u914D\u5668\uFF08AGENTS.md \u6052\u751F\u6210\uFF0C\u4E3A\u552F\u4E00\u4E8B\u5B9E\u6E90\uFF09\uFF1A"];
|
|
41459
|
+
PLATFORM_ADAPTERS.forEach((spec, index) => {
|
|
41460
|
+
const note = spec.coveredByAgentsMd ? "\uFF08codex \u539F\u751F\u5165\u53E3\uFF0C\u96F6\u989D\u5916\u6587\u4EF6\uFF09" : "";
|
|
41461
|
+
lines.push(` ${index + 1}. ${spec.name.padEnd(7)} ${spec.file}${note}`);
|
|
41462
|
+
});
|
|
41463
|
+
lines.push("\u8F93\u5165\u8981\u542F\u7528\u7684\u5E73\u53F0\u7F16\u53F7\uFF08\u9017\u53F7\u5206\u9694\uFF0C\u56DE\u8F66\u9ED8\u8BA4 claude\uFF1Ba=\u5168\u9009\uFF09\uFF1A");
|
|
41464
|
+
return lines;
|
|
41465
|
+
}
|
|
41466
|
+
async function runInitInteractive(rootDir, interactive) {
|
|
41467
|
+
for (const line of renderPlatformMenu())
|
|
41468
|
+
interactive.write(line);
|
|
41469
|
+
const raw = (await interactive.readLine()).trim();
|
|
41470
|
+
const parse = parsePlatformSelection(raw === "" ? "claude" : raw);
|
|
41471
|
+
if (!parse.ok) {
|
|
41472
|
+
return failOutcome("init", {
|
|
41473
|
+
change: "NO_CHANGE",
|
|
41474
|
+
tool: INIT_TOOL_ID,
|
|
41475
|
+
profile: "LIGHT",
|
|
41476
|
+
files: [],
|
|
41477
|
+
platforms: []
|
|
41478
|
+
}, [parse.error], ["init: FAILED \u2014 SCHEMA_INVALID", ` ${parse.error.message}`, ` hint: ${parse.error.hint}`]);
|
|
41479
|
+
}
|
|
41480
|
+
return runInit(rootDir, { platforms: parse.platforms.join(",") });
|
|
41481
|
+
}
|
|
41340
41482
|
function parseConfigProfile(configText) {
|
|
41341
41483
|
const match = /^\s*profile:\s*([A-Za-z_-]+)/m.exec(configText);
|
|
41342
41484
|
const value = match?.[1]?.toUpperCase();
|
|
@@ -41438,10 +41580,45 @@ Claude harness \u5165\u53E3\u4E0E AGENTS.md \u5171\u4EAB\u540C\u4E00\u8F7B\u5165
|
|
|
41438
41580
|
|
|
41439
41581
|
@AGENTS.md
|
|
41440
41582
|
`;
|
|
41441
|
-
|
|
41583
|
+
var INIT_LOGO_LINES = [
|
|
41584
|
+
"\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557 ",
|
|
41585
|
+
"\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557 \u2588\u2588\u2554\u2550\u2550\u2550\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2551 \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557 \u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u2550\u2588\u2588\u2554\u2550\u2550\u255D \u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557",
|
|
41586
|
+
"\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D \u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2554\u2588\u2588\u2588\u2588\u2554\u2588\u2588\u2551 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2551 \u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D",
|
|
41587
|
+
"\u2588\u2588\u2554\u2550\u2550\u2550\u255D \u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551\u255A\u2588\u2588\u2554\u255D\u2588\u2588\u2551 \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2551 \u255A\u2550\u2550\u2550\u2550\u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2554\u2550\u2550\u255D \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557",
|
|
41588
|
+
"\u2588\u2588\u2551 \u255A\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D \u2588\u2588\u2551 \u255A\u2550\u255D \u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2551 \u2588\u2588\u2551",
|
|
41589
|
+
"\u255A\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u255D",
|
|
41590
|
+
" VNext"
|
|
41591
|
+
];
|
|
41592
|
+
var INIT_BANNER_LINES = [
|
|
41593
|
+
"",
|
|
41594
|
+
"POMaster \xB7 Governed Software State Control Plane",
|
|
41595
|
+
"",
|
|
41596
|
+
" State is the only truth. Evidence is the only proof.",
|
|
41597
|
+
" A tool that reports green without evidence is more dangerous",
|
|
41598
|
+
" than no tool at all. Every change is permitted, every claim",
|
|
41599
|
+
" is accounted for, and every fact carries its authority.",
|
|
41600
|
+
"",
|
|
41601
|
+
"Contact / commercial licensing: allenxujianyang@outlook.com"
|
|
41602
|
+
];
|
|
41603
|
+
async function runInit(rootDir, options = {}) {
|
|
41442
41604
|
const warnings = [];
|
|
41443
41605
|
const errors = [];
|
|
41444
41606
|
const files = [];
|
|
41607
|
+
const selection = parsePlatformSelection(options.platforms ?? "claude");
|
|
41608
|
+
if (!selection.ok) {
|
|
41609
|
+
return failOutcome("init", {
|
|
41610
|
+
change: "NO_CHANGE",
|
|
41611
|
+
tool: INIT_TOOL_ID,
|
|
41612
|
+
profile: "LIGHT",
|
|
41613
|
+
files: [],
|
|
41614
|
+
platforms: []
|
|
41615
|
+
}, [selection.error], [
|
|
41616
|
+
"init: FAILED \u2014 SCHEMA_INVALID",
|
|
41617
|
+
` ${selection.error.message}`,
|
|
41618
|
+
` hint: ${selection.error.hint}`
|
|
41619
|
+
]);
|
|
41620
|
+
}
|
|
41621
|
+
const selectedPlatforms = selection.platforms;
|
|
41445
41622
|
const { mkdir: mkdir3 } = await import("node:fs/promises");
|
|
41446
41623
|
await mkdir3(objectsDirPath(rootDir), { recursive: true });
|
|
41447
41624
|
const ledgerPath = truthIndexPath(rootDir);
|
|
@@ -41535,14 +41712,16 @@ async function runInit(rootDir) {
|
|
|
41535
41712
|
absolute: `${rootDir}/${AGENTS_MD_RELATIVE}`,
|
|
41536
41713
|
content: withMarker(entryMarkdown),
|
|
41537
41714
|
mayUpdate: true
|
|
41538
|
-
}
|
|
41539
|
-
|
|
41715
|
+
}
|
|
41716
|
+
];
|
|
41717
|
+
if (selectedPlatforms.includes("claude")) {
|
|
41718
|
+
plans.push({
|
|
41540
41719
|
relative: CLAUDE_MD_RELATIVE,
|
|
41541
41720
|
absolute: `${rootDir}/${CLAUDE_MD_RELATIVE}`,
|
|
41542
41721
|
content: withMarker(CLAUDE_ENTRY_CONTENT),
|
|
41543
41722
|
mayUpdate: true
|
|
41544
|
-
}
|
|
41545
|
-
|
|
41723
|
+
});
|
|
41724
|
+
}
|
|
41546
41725
|
for (const plan of plans) {
|
|
41547
41726
|
const existing = await readIfExists(plan.absolute);
|
|
41548
41727
|
if (existing === null) {
|
|
@@ -41567,10 +41746,36 @@ async function runInit(rootDir) {
|
|
|
41567
41746
|
files.push({ file: plan.relative, action: "updated" });
|
|
41568
41747
|
}
|
|
41569
41748
|
}
|
|
41570
|
-
const
|
|
41749
|
+
const platforms = [];
|
|
41750
|
+
for (const spec of PLATFORM_ADAPTERS) {
|
|
41751
|
+
if (!selectedPlatforms.includes(spec.name))
|
|
41752
|
+
continue;
|
|
41753
|
+
if (spec.coveredByAgentsMd) {
|
|
41754
|
+
platforms.push({ name: spec.name, file: spec.file, action: "covered" });
|
|
41755
|
+
continue;
|
|
41756
|
+
}
|
|
41757
|
+
if (spec.name === "claude") {
|
|
41758
|
+
const entry = files.find((f) => f.file === CLAUDE_MD_RELATIVE);
|
|
41759
|
+
platforms.push({
|
|
41760
|
+
name: "claude",
|
|
41761
|
+
file: CLAUDE_MD_RELATIVE,
|
|
41762
|
+
action: entry?.action === "created" ? "created" : "skipped-existing"
|
|
41763
|
+
});
|
|
41764
|
+
continue;
|
|
41765
|
+
}
|
|
41766
|
+
const absolute = `${rootDir}/${spec.file}`;
|
|
41767
|
+
if (await pathExists(absolute)) {
|
|
41768
|
+
platforms.push({ name: spec.name, file: spec.file, action: "skipped-existing" });
|
|
41769
|
+
continue;
|
|
41770
|
+
}
|
|
41771
|
+
await ensureParentDir(absolute);
|
|
41772
|
+
await writeFile(absolute, spec.render(), "utf8");
|
|
41773
|
+
platforms.push({ name: spec.name, file: spec.file, action: "created" });
|
|
41774
|
+
}
|
|
41775
|
+
const created = files.some((f) => f.action === "created") || platforms.some((p) => p.action === "created");
|
|
41571
41776
|
const updated = files.some((f) => f.action === "updated");
|
|
41572
41777
|
const change = created ? "CREATED" : updated ? "UPDATED" : "NO_CHANGE";
|
|
41573
|
-
const result2 = { change, tool: INIT_TOOL_ID, profile, files };
|
|
41778
|
+
const result2 = { change, tool: INIT_TOOL_ID, profile, files, platforms };
|
|
41574
41779
|
if (errors.length > 0) {
|
|
41575
41780
|
return failOutcome("init", result2, errors, [
|
|
41576
41781
|
"init: FAILED",
|
|
@@ -41578,14 +41783,158 @@ async function runInit(rootDir) {
|
|
|
41578
41783
|
hint: ${e.hint}`)
|
|
41579
41784
|
], warnings);
|
|
41580
41785
|
}
|
|
41786
|
+
const platformLines = [" platforms:"];
|
|
41787
|
+
if (platforms.length === 0) {
|
|
41788
|
+
platformLines.push(" none\uFF08--platforms none\uFF1A\u672A\u542F\u7528\u4EFB\u4F55\u5E73\u53F0\u9002\u914D\u5668\uFF09");
|
|
41789
|
+
} else {
|
|
41790
|
+
for (const platform of platforms) {
|
|
41791
|
+
const note = platform.action === "covered" ? "\uFF08codex \u539F\u751F\u5165\u53E3\uFF0C\u96F6\u989D\u5916\u6587\u4EF6\uFF09" : "";
|
|
41792
|
+
platformLines.push(` [${platform.name}] ${platform.action.padEnd(16)} ${platform.file}${note}`);
|
|
41793
|
+
}
|
|
41794
|
+
}
|
|
41581
41795
|
const human = [
|
|
41796
|
+
...INIT_LOGO_LINES,
|
|
41797
|
+
"",
|
|
41582
41798
|
`init: ${change}`,
|
|
41583
41799
|
...files.map((f) => ` ${f.action.padEnd(15)} ${f.file}`),
|
|
41584
|
-
|
|
41800
|
+
...platformLines,
|
|
41801
|
+
` profile: ${profile}`,
|
|
41802
|
+
...INIT_BANNER_LINES
|
|
41585
41803
|
];
|
|
41586
41804
|
return okOutcome("init", result2, human, warnings);
|
|
41587
41805
|
}
|
|
41588
41806
|
|
|
41807
|
+
// packages/cli/dist/update.js
|
|
41808
|
+
import { spawnSync } from "node:child_process";
|
|
41809
|
+
|
|
41810
|
+
// packages/cli/dist/version.js
|
|
41811
|
+
import { readFileSync } from "node:fs";
|
|
41812
|
+
import { dirname as dirname2, join as join2 } from "node:path";
|
|
41813
|
+
import { fileURLToPath } from "node:url";
|
|
41814
|
+
var CLI_PACKAGE_NAME = "@pomaster/cli";
|
|
41815
|
+
function readCliPackageVersion() {
|
|
41816
|
+
let dir = dirname2(fileURLToPath(import.meta.url));
|
|
41817
|
+
for (let depth = 0; depth < 8; depth += 1) {
|
|
41818
|
+
try {
|
|
41819
|
+
const manifest = JSON.parse(readFileSync(join2(dir, "package.json"), "utf8"));
|
|
41820
|
+
if (manifest.name === CLI_PACKAGE_NAME && typeof manifest.version === "string") {
|
|
41821
|
+
return manifest.version;
|
|
41822
|
+
}
|
|
41823
|
+
} catch {
|
|
41824
|
+
}
|
|
41825
|
+
const parent = dirname2(dir);
|
|
41826
|
+
if (parent === dir)
|
|
41827
|
+
break;
|
|
41828
|
+
dir = parent;
|
|
41829
|
+
}
|
|
41830
|
+
return CLI_VERSION;
|
|
41831
|
+
}
|
|
41832
|
+
function resolveCliVersion() {
|
|
41833
|
+
if (true) {
|
|
41834
|
+
return "0.1.1";
|
|
41835
|
+
}
|
|
41836
|
+
return readCliPackageVersion();
|
|
41837
|
+
}
|
|
41838
|
+
|
|
41839
|
+
// packages/cli/dist/update.js
|
|
41840
|
+
var UPDATE_PACKAGE_NAME = "pomaster";
|
|
41841
|
+
var NPM_VIEW_TIMEOUT_MS = 15e3;
|
|
41842
|
+
var NPM_INSTALL_TIMEOUT_MS = 3e5;
|
|
41843
|
+
function defaultNpmRunner(args, options) {
|
|
41844
|
+
const res = spawnSync("npm", [...args], {
|
|
41845
|
+
encoding: "utf8",
|
|
41846
|
+
timeout: options.timeoutMs,
|
|
41847
|
+
shell: process.platform === "win32",
|
|
41848
|
+
...options.inheritStdio ? { stdio: "inherit" } : {}
|
|
41849
|
+
});
|
|
41850
|
+
return {
|
|
41851
|
+
status: res.status,
|
|
41852
|
+
stdout: typeof res.stdout === "string" ? res.stdout : "",
|
|
41853
|
+
stderr: typeof res.stderr === "string" ? res.stderr : ""
|
|
41854
|
+
};
|
|
41855
|
+
}
|
|
41856
|
+
function compareSemver(a, b) {
|
|
41857
|
+
const pa = a.trim().replace(/^v/i, "").split(".");
|
|
41858
|
+
const pb = b.trim().replace(/^v/i, "").split(".");
|
|
41859
|
+
for (let i = 0; i < 3; i += 1) {
|
|
41860
|
+
const na = Number.parseInt(pa[i] ?? "0", 10) || 0;
|
|
41861
|
+
const nb = Number.parseInt(pb[i] ?? "0", 10) || 0;
|
|
41862
|
+
if (na !== nb)
|
|
41863
|
+
return na - nb;
|
|
41864
|
+
}
|
|
41865
|
+
return 0;
|
|
41866
|
+
}
|
|
41867
|
+
function parseLatestVersion(stdout) {
|
|
41868
|
+
const value = stdout.trim();
|
|
41869
|
+
return /^v?\d+\.\d+\.\d+/.test(value) ? value.replace(/^v/, "") : null;
|
|
41870
|
+
}
|
|
41871
|
+
function runUpdate(options = {}, deps = {}) {
|
|
41872
|
+
const yes = options.yes === true;
|
|
41873
|
+
const current = deps.currentVersion ?? resolveCliVersion();
|
|
41874
|
+
const runNpm = deps.runNpm ?? defaultNpmRunner;
|
|
41875
|
+
const npmView = runNpm(["view", UPDATE_PACKAGE_NAME, "version"], {
|
|
41876
|
+
timeoutMs: NPM_VIEW_TIMEOUT_MS,
|
|
41877
|
+
inheritStdio: false
|
|
41878
|
+
});
|
|
41879
|
+
const latest = npmView.status === 0 ? parseLatestVersion(npmView.stdout) : null;
|
|
41880
|
+
if (latest === null) {
|
|
41881
|
+
const stderrExcerpt = npmView.stderr.trim().slice(0, 200);
|
|
41882
|
+
const result2 = {
|
|
41883
|
+
current,
|
|
41884
|
+
latest: null,
|
|
41885
|
+
updateAvailable: null,
|
|
41886
|
+
check: "registry_unreachable"
|
|
41887
|
+
};
|
|
41888
|
+
return failOutcome("update", result2, [
|
|
41889
|
+
{
|
|
41890
|
+
code: "REGISTRY_UNREACHABLE",
|
|
41891
|
+
message: `npm view ${UPDATE_PACKAGE_NAME} version \u672A\u8FD4\u56DE\u53EF\u89E3\u6790\u7248\u672C\uFF08exit ${npmView.status}${stderrExcerpt ? `\uFF1Bstderr: ${stderrExcerpt}` : ""}\uFF09`,
|
|
41892
|
+
hint: "\u68C0\u67E5\u7F51\u7EDC\u6216 npm registry \u914D\u7F6E\uFF1B\u4E5F\u53EF\u76F4\u63A5\u8FD0\u884C npm i -g pomaster\u3002"
|
|
41893
|
+
}
|
|
41894
|
+
], [
|
|
41895
|
+
`update: current ${current}`,
|
|
41896
|
+
"registry \u4E0D\u53EF\u8FBE\uFF0C\u65E0\u6CD5\u68C0\u67E5\u66F4\u65B0",
|
|
41897
|
+
...yes ? ["--yes \u5DF2\u62D2\u7EDD\u6267\u884C\uFF1A\u68C0\u67E5\u672A\u5B8C\u6210\uFF0C\u4E0D\u505A\u76F2\u88C5\uFF08fail-closed\uFF09\u3002"] : []
|
|
41898
|
+
]);
|
|
41899
|
+
}
|
|
41900
|
+
const updateAvailable = compareSemver(latest, current) > 0;
|
|
41901
|
+
if (yes && !updateAvailable) {
|
|
41902
|
+
return okOutcome("update", { current, latest, updateAvailable, check: "ok" }, [`update: current ${current} / latest ${latest}`, "\u5DF2\u662F\u6700\u65B0"]);
|
|
41903
|
+
}
|
|
41904
|
+
if (yes) {
|
|
41905
|
+
const installArgs = ["install", "-g", `${UPDATE_PACKAGE_NAME}@latest`];
|
|
41906
|
+
const npmInstall = runNpm(installArgs, {
|
|
41907
|
+
timeoutMs: NPM_INSTALL_TIMEOUT_MS,
|
|
41908
|
+
inheritStdio: true
|
|
41909
|
+
});
|
|
41910
|
+
const install = {
|
|
41911
|
+
command: `npm ${installArgs.join(" ")}`,
|
|
41912
|
+
exit_code: npmInstall.status,
|
|
41913
|
+
ok: npmInstall.status === 0
|
|
41914
|
+
};
|
|
41915
|
+
const human2 = [
|
|
41916
|
+
`update: current ${current} / latest ${latest} \u2192 ${install.command}`,
|
|
41917
|
+
install.ok ? "npm install \u5B8C\u6210" : "npm install \u5931\u8D25\uFF08\u8BE6\u89C1\u4E0A\u65B9 npm \u900F\u4F20\u8F93\u51FA\uFF09",
|
|
41918
|
+
...install.ok ? ["\u91CD\u65B0\u8FD0\u884C pomaster init\uFF08\u5E42\u7B49\uFF09\u5237\u65B0\u8F7B\u5165\u53E3\u3002"] : []
|
|
41919
|
+
];
|
|
41920
|
+
const result2 = { current, latest, updateAvailable, check: "ok", install };
|
|
41921
|
+
if (install.ok) {
|
|
41922
|
+
return okOutcome("update", result2, human2);
|
|
41923
|
+
}
|
|
41924
|
+
const installError = {
|
|
41925
|
+
code: "NPM_INSTALL_FAILED",
|
|
41926
|
+
message: `${install.command} \u5931\u8D25\uFF08exit ${npmInstall.status}\uFF09`,
|
|
41927
|
+
hint: "npm \u7684\u9519\u8BEF\u8F93\u51FA\u5DF2\u900F\u4F20\u5230\u7EC8\u7AEF\uFF1B\u53EF\u624B\u52A8\u8FD0\u884C npm i -g pomaster \u540E\u91CD\u8BD5\u3002"
|
|
41928
|
+
};
|
|
41929
|
+
return failOutcome("update", result2, [installError], human2);
|
|
41930
|
+
}
|
|
41931
|
+
const human = [
|
|
41932
|
+
`update: current ${current} / latest ${latest}`,
|
|
41933
|
+
updateAvailable ? `\u66F4\u65B0\u53EF\u7528\uFF1A\u8FD0\u884C pomaster update --yes \u6216 npm i -g ${UPDATE_PACKAGE_NAME}` : "\u5DF2\u662F\u6700\u65B0"
|
|
41934
|
+
];
|
|
41935
|
+
return okOutcome("update", { current, latest, updateAvailable, check: "ok" }, human);
|
|
41936
|
+
}
|
|
41937
|
+
|
|
41589
41938
|
// packages/cli/dist/status.js
|
|
41590
41939
|
init_src();
|
|
41591
41940
|
import { readFile as readFile2 } from "node:fs/promises";
|
|
@@ -41783,12 +42132,12 @@ function countMigratingWithPermit(objectRows) {
|
|
|
41783
42132
|
// packages/cli/dist/inspect.js
|
|
41784
42133
|
init_dist();
|
|
41785
42134
|
import { readFile as readFile4 } from "node:fs/promises";
|
|
41786
|
-
import { join as
|
|
42135
|
+
import { join as join5 } from "node:path";
|
|
41787
42136
|
|
|
41788
42137
|
// packages/cli/dist/evidence.js
|
|
41789
42138
|
init_dist();
|
|
41790
42139
|
init_src();
|
|
41791
|
-
import { existsSync as existsSync8, readdirSync as readdirSync14, readFileSync as
|
|
42140
|
+
import { existsSync as existsSync8, readdirSync as readdirSync14, readFileSync as readFileSync6 } from "node:fs";
|
|
41792
42141
|
var GRN_FILE_PATTERN = /^GRN-[0-9]+\.json$/;
|
|
41793
42142
|
var CLM_FILE_PATTERN = /^CLM-[0-9]+\.json$/;
|
|
41794
42143
|
var GRN_REF_PATTERN = /^GRN-[0-9]+$/;
|
|
@@ -42061,7 +42410,7 @@ function planRunFile(input) {
|
|
|
42061
42410
|
const grn = input.fileName.slice(0, -".json".length);
|
|
42062
42411
|
let bytes;
|
|
42063
42412
|
try {
|
|
42064
|
-
bytes =
|
|
42413
|
+
bytes = readFileSync6(`${input.runsDir}/${input.fileName}`, "utf8");
|
|
42065
42414
|
} catch (err) {
|
|
42066
42415
|
return { malformed: malformedOf(relPath, `\u6587\u4EF6\u4E0D\u53EF\u8BFB\uFF1A${err instanceof Error ? err.message : String(err)}`) };
|
|
42067
42416
|
}
|
|
@@ -42139,7 +42488,7 @@ function findCanonicalRunMatch(input) {
|
|
|
42139
42488
|
const grn = fileName.slice(0, -".json".length);
|
|
42140
42489
|
let bytes;
|
|
42141
42490
|
try {
|
|
42142
|
-
bytes =
|
|
42491
|
+
bytes = readFileSync6(`${input.runsDir}/${fileName}`, "utf8");
|
|
42143
42492
|
} catch {
|
|
42144
42493
|
continue;
|
|
42145
42494
|
}
|
|
@@ -42351,7 +42700,7 @@ function planClaimFile(input) {
|
|
|
42351
42700
|
const clm = input.fileName.slice(0, -".json".length);
|
|
42352
42701
|
let bytes;
|
|
42353
42702
|
try {
|
|
42354
|
-
bytes =
|
|
42703
|
+
bytes = readFileSync6(`${input.claimsDir}/${input.fileName}`, "utf8");
|
|
42355
42704
|
} catch (err) {
|
|
42356
42705
|
return { malformed: malformedOf(relPath, `\u6587\u4EF6\u4E0D\u53EF\u8BFB\uFF1A${err instanceof Error ? err.message : String(err)}`) };
|
|
42357
42706
|
}
|
|
@@ -42404,7 +42753,7 @@ function findCanonicalClaimMatch(input) {
|
|
|
42404
42753
|
const clm = fileName.slice(0, -".json".length);
|
|
42405
42754
|
let bytes;
|
|
42406
42755
|
try {
|
|
42407
|
-
bytes =
|
|
42756
|
+
bytes = readFileSync6(`${input.claimsDir}/${fileName}`, "utf8");
|
|
42408
42757
|
} catch {
|
|
42409
42758
|
continue;
|
|
42410
42759
|
}
|
|
@@ -43116,7 +43465,7 @@ async function runInspect(rootDir, input) {
|
|
|
43116
43465
|
hint: "truth-index \u884C\u7531 kernel \u4E8B\u52A1\u7EF4\u62A4\uFF1B\u4ECE git \u6062\u590D\u540E\u91CD\u8BD5\u3002"
|
|
43117
43466
|
}, input.id);
|
|
43118
43467
|
}
|
|
43119
|
-
const bodyPath =
|
|
43468
|
+
const bodyPath = join5(rootDir, POMASTER_DIR, ...bodyRef.split("/"));
|
|
43120
43469
|
let bodyRaw;
|
|
43121
43470
|
try {
|
|
43122
43471
|
bodyRaw = await readFile4(bodyPath, "utf8");
|
|
@@ -43148,7 +43497,7 @@ async function runInspect(rootDir, input) {
|
|
|
43148
43497
|
};
|
|
43149
43498
|
const warnings = [];
|
|
43150
43499
|
const runs = [];
|
|
43151
|
-
const runsDir =
|
|
43500
|
+
const runsDir = join5(rootDir, POMASTER_DIR, "evidence", "runs");
|
|
43152
43501
|
for (const fileName of listPlaneFiles(runsDir)) {
|
|
43153
43502
|
if (!GRN_FILE_PATTERN.test(fileName)) {
|
|
43154
43503
|
warnings.push({
|
|
@@ -43160,7 +43509,7 @@ async function runInspect(rootDir, input) {
|
|
|
43160
43509
|
}
|
|
43161
43510
|
let record;
|
|
43162
43511
|
try {
|
|
43163
|
-
const parsed = JSON.parse(await readFile4(
|
|
43512
|
+
const parsed = JSON.parse(await readFile4(join5(runsDir, fileName), "utf8"));
|
|
43164
43513
|
if (!isRecord4(parsed))
|
|
43165
43514
|
throw new TypeError("run record is not an object");
|
|
43166
43515
|
record = parsed;
|
|
@@ -43183,7 +43532,7 @@ async function runInspect(rootDir, input) {
|
|
|
43183
43532
|
});
|
|
43184
43533
|
}
|
|
43185
43534
|
const claims = [];
|
|
43186
|
-
const claimsDir =
|
|
43535
|
+
const claimsDir = join5(rootDir, POMASTER_DIR, "evidence", "claims");
|
|
43187
43536
|
for (const fileName of listPlaneFiles(claimsDir)) {
|
|
43188
43537
|
if (!CLM_FILE_PATTERN.test(fileName)) {
|
|
43189
43538
|
warnings.push({
|
|
@@ -43195,7 +43544,7 @@ async function runInspect(rootDir, input) {
|
|
|
43195
43544
|
}
|
|
43196
43545
|
let record;
|
|
43197
43546
|
try {
|
|
43198
|
-
const parsed = JSON.parse(await readFile4(
|
|
43547
|
+
const parsed = JSON.parse(await readFile4(join5(claimsDir, fileName), "utf8"));
|
|
43199
43548
|
if (!isRecord4(parsed))
|
|
43200
43549
|
throw new TypeError("claim record is not an object");
|
|
43201
43550
|
record = parsed;
|
|
@@ -44750,7 +45099,7 @@ ${" ".repeat(18)}note: ${row2.note}`}`)
|
|
|
44750
45099
|
|
|
44751
45100
|
// packages/cli/dist/exec-guard.js
|
|
44752
45101
|
init_dist();
|
|
44753
|
-
import { readFileSync as
|
|
45102
|
+
import { readFileSync as readFileSync18 } from "node:fs";
|
|
44754
45103
|
import { readFile as readFile7 } from "node:fs/promises";
|
|
44755
45104
|
function isFATALCode(err) {
|
|
44756
45105
|
return typeof err === "object" && err !== null && (err.reason === "unknown_prefix" || err.reason === "grammar");
|
|
@@ -44827,7 +45176,7 @@ async function runExecGuard(rootDir, input) {
|
|
|
44827
45176
|
let text;
|
|
44828
45177
|
if (input.attempt === "-") {
|
|
44829
45178
|
try {
|
|
44830
|
-
text =
|
|
45179
|
+
text = readFileSync18(0, "utf8");
|
|
44831
45180
|
} catch (err) {
|
|
44832
45181
|
return malformed("ATTEMPT_MALFORMED", `stdin \u8BFB\u53D6\u5931\u8D25\uFF1A${err instanceof Error ? err.message : String(err)}`, "stdin \u5F62\u6001\u8981\u6C42\u7BA1\u9053\u4F20\u5165 attempt JSON\uFF08echo \u2026 | pomaster exec-guard --attempt -\uFF09\u3002");
|
|
44833
45182
|
}
|
|
@@ -45001,7 +45350,7 @@ async function runReconcile(rootDir, input) {
|
|
|
45001
45350
|
|
|
45002
45351
|
// packages/cli/dist/record.js
|
|
45003
45352
|
init_dist();
|
|
45004
|
-
import { existsSync as existsSync15, readFileSync as
|
|
45353
|
+
import { existsSync as existsSync15, readFileSync as readFileSync19 } from "node:fs";
|
|
45005
45354
|
function emptyGateRunResult() {
|
|
45006
45355
|
return {
|
|
45007
45356
|
grn: null,
|
|
@@ -45020,7 +45369,7 @@ function gateRunFail(error) {
|
|
|
45020
45369
|
}
|
|
45021
45370
|
function readFromBytes(path) {
|
|
45022
45371
|
try {
|
|
45023
|
-
return { bytes:
|
|
45372
|
+
return { bytes: readFileSync19(path, "utf8") };
|
|
45024
45373
|
} catch (err) {
|
|
45025
45374
|
return {
|
|
45026
45375
|
code: EVIDENCE_MALFORMED_CODE,
|
|
@@ -45158,7 +45507,7 @@ async function runRecordGateRun(rootDir, input) {
|
|
|
45158
45507
|
grn = input.grn;
|
|
45159
45508
|
let targetBytes = null;
|
|
45160
45509
|
try {
|
|
45161
|
-
targetBytes =
|
|
45510
|
+
targetBytes = readFileSync19(`${runsDir}/${grn}.json`, "utf8");
|
|
45162
45511
|
} catch {
|
|
45163
45512
|
targetBytes = null;
|
|
45164
45513
|
}
|
|
@@ -45380,7 +45729,7 @@ async function runRecordClaim(rootDir, input) {
|
|
|
45380
45729
|
clm = input.clm;
|
|
45381
45730
|
let targetBytes = null;
|
|
45382
45731
|
try {
|
|
45383
|
-
targetBytes =
|
|
45732
|
+
targetBytes = readFileSync19(`${claimsDir}/${clm}.json`, "utf8");
|
|
45384
45733
|
} catch {
|
|
45385
45734
|
targetBytes = null;
|
|
45386
45735
|
}
|
|
@@ -45459,7 +45808,7 @@ init_dist();
|
|
|
45459
45808
|
init_src();
|
|
45460
45809
|
import { readdirSync as readdirSync16 } from "node:fs";
|
|
45461
45810
|
import { readFile as readFile8 } from "node:fs/promises";
|
|
45462
|
-
import { join as
|
|
45811
|
+
import { join as join7 } from "node:path";
|
|
45463
45812
|
function emptyResult4(task) {
|
|
45464
45813
|
return {
|
|
45465
45814
|
task,
|
|
@@ -45532,7 +45881,7 @@ function listGrnSidecarFiles(runsDir) {
|
|
|
45532
45881
|
async function readRunRecord(runsDir, fileName) {
|
|
45533
45882
|
let parsed;
|
|
45534
45883
|
try {
|
|
45535
|
-
parsed = JSON.parse(await readFile8(
|
|
45884
|
+
parsed = JSON.parse(await readFile8(join7(runsDir, fileName), "utf8"));
|
|
45536
45885
|
} catch (err) {
|
|
45537
45886
|
return { damage: `evidence/runs/${fileName}: JSON \u65E0\u6CD5\u89E3\u6790 \u2014 ${err instanceof Error ? err.message : String(err)}` };
|
|
45538
45887
|
}
|
|
@@ -45553,7 +45902,7 @@ async function readRunRecord(runsDir, fileName) {
|
|
|
45553
45902
|
async function readClaimRecord(claimsDir, fileName) {
|
|
45554
45903
|
let bytes;
|
|
45555
45904
|
try {
|
|
45556
|
-
bytes = await readFile8(
|
|
45905
|
+
bytes = await readFile8(join7(claimsDir, fileName), "utf8");
|
|
45557
45906
|
} catch {
|
|
45558
45907
|
return { missing: true };
|
|
45559
45908
|
}
|
|
@@ -45616,7 +45965,7 @@ async function runCloseout(rootDir, input) {
|
|
|
45616
45965
|
hint: "change \u7684\u5B8C\u6210\u5224\u5377\u7ECF\u7531\u5176 affected TASKs \u9010\u4EFB\u52A1 closeout\uFF1Bkind \u8BCD\u5F62\u89C1 02b kind-payloads\u3002"
|
|
45617
45966
|
}, withKind);
|
|
45618
45967
|
}
|
|
45619
|
-
const bodyPath =
|
|
45968
|
+
const bodyPath = join7(rootDir, POMASTER_DIR, ...row2.bodyRef.split("/"));
|
|
45620
45969
|
let bodyRaw;
|
|
45621
45970
|
try {
|
|
45622
45971
|
bodyRaw = await readFile8(bodyPath, "utf8");
|
|
@@ -46092,8 +46441,8 @@ async function runCatalogExplain(id, deps) {
|
|
|
46092
46441
|
}
|
|
46093
46442
|
|
|
46094
46443
|
// packages/cli/dist/eval.js
|
|
46095
|
-
import { existsSync as existsSync16, readFileSync as
|
|
46096
|
-
import { fileURLToPath as
|
|
46444
|
+
import { existsSync as existsSync16, readFileSync as readFileSync20 } from "node:fs";
|
|
46445
|
+
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
46097
46446
|
|
|
46098
46447
|
// packages/cli/dist/triage-rule-v0.js
|
|
46099
46448
|
var PROFILE_LADDER = ["MINIMAL", "LIGHT", "STANDARD"];
|
|
@@ -46222,7 +46571,7 @@ function triageRuleV0(req) {
|
|
|
46222
46571
|
|
|
46223
46572
|
// packages/cli/dist/eval.js
|
|
46224
46573
|
var EVAL_SUITES = ["behavioral"];
|
|
46225
|
-
var BEHAVIORAL_SEEDS_PATH =
|
|
46574
|
+
var BEHAVIORAL_SEEDS_PATH = fileURLToPath3(new URL("../../../tests/behavioral/seeds.json", import.meta.url));
|
|
46226
46575
|
var L5_FAMILIES = ["A", "B", "C", "D", "E", "F", "G", "X"];
|
|
46227
46576
|
var L5_EVALUATORS = ["cli_keyword", "rule_v0"];
|
|
46228
46577
|
function loadSeeds(seedsPath = BEHAVIORAL_SEEDS_PATH) {
|
|
@@ -46230,7 +46579,7 @@ function loadSeeds(seedsPath = BEHAVIORAL_SEEDS_PATH) {
|
|
|
46230
46579
|
if (lower.endsWith(".yaml") || lower.endsWith(".yml")) {
|
|
46231
46580
|
throw new Error(`eval \u547D\u4EE4\u6D88\u8D39\u9762\u4E3A seeds.json\uFF0C\u4E0D\u63A5\u53D7 yaml \u8F7D\u7269\uFF08${seedsPath}\uFF09\u3002PRD \xA794.2 yaml \u8F7D\u7269\uFF08tests/behavioral/eval-cases.yaml\uFF09\u662F\u767B\u8BB0\u5F62\u6001\uFF1Aschema \u6821\u9A8C\u4E0E json \u540C\u6784\u951A\u5B9A\u5728 tests/behavioral/eval-carrier.spec.ts\uFF08js-yaml devDependency + ajv\uFF0Ctests \u9762\uFF09\uFF1B\u5224\u5377\u8BF7\u6CE8\u5165 seeds.json \u6216\u7701\u7565 seedsPath \u7528\u4ED3\u5E93\u7F3A\u7701\u8D26\u672C\u3002`);
|
|
46232
46581
|
}
|
|
46233
|
-
const raw = JSON.parse(
|
|
46582
|
+
const raw = JSON.parse(readFileSync20(seedsPath, "utf8"));
|
|
46234
46583
|
const file = raw;
|
|
46235
46584
|
if (!Array.isArray(file.seeds)) {
|
|
46236
46585
|
throw new Error(`seeds.json \u5F62\u6001\u975E\u6CD5\uFF1A\u7F3A seeds \u6570\u7EC4\uFF08${seedsPath}\uFF09`);
|
|
@@ -46570,7 +46919,7 @@ async function runEval(input) {
|
|
|
46570
46919
|
// packages/cli/dist/projection-common.js
|
|
46571
46920
|
init_dist();
|
|
46572
46921
|
import { readFile as readFile9 } from "node:fs/promises";
|
|
46573
|
-
import { join as
|
|
46922
|
+
import { join as join8 } from "node:path";
|
|
46574
46923
|
function isRecord6(value) {
|
|
46575
46924
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
46576
46925
|
}
|
|
@@ -46606,7 +46955,7 @@ async function readRawIndexOrFail(rootDir) {
|
|
|
46606
46955
|
}
|
|
46607
46956
|
}
|
|
46608
46957
|
async function readLedgerEntries(rootDir) {
|
|
46609
|
-
const path =
|
|
46958
|
+
const path = join8(rootDir, POMASTER_DIR, "state", "exception-ledger.json");
|
|
46610
46959
|
let raw;
|
|
46611
46960
|
try {
|
|
46612
46961
|
raw = await readFile9(path, "utf8");
|
|
@@ -46670,7 +47019,7 @@ async function readBodyEnvelope(rootDir, row2) {
|
|
|
46670
47019
|
}
|
|
46671
47020
|
};
|
|
46672
47021
|
}
|
|
46673
|
-
const bodyPath =
|
|
47022
|
+
const bodyPath = join8(rootDir, POMASTER_DIR, ...bodyRef.split("/"));
|
|
46674
47023
|
let raw;
|
|
46675
47024
|
try {
|
|
46676
47025
|
raw = await readFile9(bodyPath, "utf8");
|
|
@@ -46699,7 +47048,7 @@ async function readBodyEnvelope(rootDir, row2) {
|
|
|
46699
47048
|
}
|
|
46700
47049
|
}
|
|
46701
47050
|
async function readPermitFile(rootDir) {
|
|
46702
|
-
const path =
|
|
47051
|
+
const path = join8(rootDir, POMASTER_DIR, "state", "permits.json");
|
|
46703
47052
|
let raw;
|
|
46704
47053
|
try {
|
|
46705
47054
|
raw = await readFile9(path, "utf8");
|
|
@@ -46736,7 +47085,7 @@ async function readEvidencePlane(rootDir, warnings) {
|
|
|
46736
47085
|
return record[field];
|
|
46737
47086
|
};
|
|
46738
47087
|
const runs = [];
|
|
46739
|
-
const runsDir =
|
|
47088
|
+
const runsDir = join8(rootDir, POMASTER_DIR, "evidence", "runs");
|
|
46740
47089
|
for (const fileName of listPlaneFiles(runsDir)) {
|
|
46741
47090
|
if (!GRN_FILE_PATTERN.test(fileName)) {
|
|
46742
47091
|
warnings.push({
|
|
@@ -46748,7 +47097,7 @@ async function readEvidencePlane(rootDir, warnings) {
|
|
|
46748
47097
|
}
|
|
46749
47098
|
let record;
|
|
46750
47099
|
try {
|
|
46751
|
-
const parsed = JSON.parse(await read(
|
|
47100
|
+
const parsed = JSON.parse(await read(join8(runsDir, fileName), "utf8"));
|
|
46752
47101
|
if (!isRecord6(parsed))
|
|
46753
47102
|
throw new TypeError("run record is not an object");
|
|
46754
47103
|
record = parsed;
|
|
@@ -46769,7 +47118,7 @@ async function readEvidencePlane(rootDir, warnings) {
|
|
|
46769
47118
|
});
|
|
46770
47119
|
}
|
|
46771
47120
|
const claims = [];
|
|
46772
|
-
const claimsDir =
|
|
47121
|
+
const claimsDir = join8(rootDir, POMASTER_DIR, "evidence", "claims");
|
|
46773
47122
|
for (const fileName of listPlaneFiles(claimsDir)) {
|
|
46774
47123
|
if (!CLM_FILE_PATTERN.test(fileName)) {
|
|
46775
47124
|
warnings.push({
|
|
@@ -46781,7 +47130,7 @@ async function readEvidencePlane(rootDir, warnings) {
|
|
|
46781
47130
|
}
|
|
46782
47131
|
let record;
|
|
46783
47132
|
try {
|
|
46784
|
-
const parsed = JSON.parse(await read(
|
|
47133
|
+
const parsed = JSON.parse(await read(join8(claimsDir, fileName), "utf8"));
|
|
46785
47134
|
if (!isRecord6(parsed))
|
|
46786
47135
|
throw new TypeError("claim record is not an object");
|
|
46787
47136
|
record = parsed;
|
|
@@ -46805,7 +47154,7 @@ async function readEvidencePlane(rootDir, warnings) {
|
|
|
46805
47154
|
return { runs, claims };
|
|
46806
47155
|
}
|
|
46807
47156
|
async function readTransitionHistory(rootDir) {
|
|
46808
|
-
const path =
|
|
47157
|
+
const path = join8(rootDir, POMASTER_DIR, "state", "journal.jsonl");
|
|
46809
47158
|
let raw;
|
|
46810
47159
|
try {
|
|
46811
47160
|
raw = await readFile9(path, "utf8");
|
|
@@ -47472,7 +47821,7 @@ async function runAuditTask(rootDir, input) {
|
|
|
47472
47821
|
init_dist();
|
|
47473
47822
|
init_src();
|
|
47474
47823
|
import { readFile as readFile10 } from "node:fs/promises";
|
|
47475
|
-
import { join as
|
|
47824
|
+
import { join as join9 } from "node:path";
|
|
47476
47825
|
async function runLedgerRecord(rootDir, input, deps) {
|
|
47477
47826
|
const emptyResult5 = {
|
|
47478
47827
|
ledger_ref: "",
|
|
@@ -47561,7 +47910,7 @@ async function runLedgerRecord(rootDir, input, deps) {
|
|
|
47561
47910
|
}
|
|
47562
47911
|
async function runLedgerList(rootDir, input) {
|
|
47563
47912
|
const classificationFilter = input.classification?.trim() ? input.classification.trim() : null;
|
|
47564
|
-
const path =
|
|
47913
|
+
const path = join9(rootDir, POMASTER_DIR, "state", "exception-ledger.json");
|
|
47565
47914
|
let raw;
|
|
47566
47915
|
try {
|
|
47567
47916
|
raw = await readFile10(path, "utf8");
|
|
@@ -47651,13 +48000,13 @@ async function runLedgerList(rootDir, input) {
|
|
|
47651
48000
|
// packages/cli/dist/knowledge.js
|
|
47652
48001
|
init_dist();
|
|
47653
48002
|
import { existsSync as existsSync18 } from "node:fs";
|
|
47654
|
-
import { join as
|
|
48003
|
+
import { join as join11 } from "node:path";
|
|
47655
48004
|
|
|
47656
48005
|
// packages/cli/dist/research.js
|
|
47657
48006
|
init_dist();
|
|
47658
48007
|
import { existsSync as existsSync17 } from "node:fs";
|
|
47659
48008
|
import { mkdir, readFile as readFile11, readdir, writeFile as writeFile2 } from "node:fs/promises";
|
|
47660
|
-
import { join as
|
|
48009
|
+
import { join as join10 } from "node:path";
|
|
47661
48010
|
var RESEARCH_MODE_ARGV_ALIASES = {
|
|
47662
48011
|
internal: "INTERNAL",
|
|
47663
48012
|
external: "EXTERNAL",
|
|
@@ -47716,7 +48065,7 @@ async function resolveResearchHost(rootDir, hostOption) {
|
|
|
47716
48065
|
}
|
|
47717
48066
|
};
|
|
47718
48067
|
}
|
|
47719
|
-
if (!existsSync17(
|
|
48068
|
+
if (!existsSync17(join10(rootDir, ...host.split("/")))) {
|
|
47720
48069
|
return {
|
|
47721
48070
|
error: {
|
|
47722
48071
|
code: "RESEARCH_HOST_NOT_FOUND",
|
|
@@ -47741,7 +48090,7 @@ async function resolveResearchHost(rootDir, hostOption) {
|
|
|
47741
48090
|
const active = [];
|
|
47742
48091
|
for (const id of entries) {
|
|
47743
48092
|
try {
|
|
47744
|
-
const raw = JSON.parse(await readFile11(
|
|
48093
|
+
const raw = JSON.parse(await readFile11(join10(padsDir, id, "state.json"), "utf8"));
|
|
47745
48094
|
if (typeof raw.state === "string" && (raw.state === "DISCOVERY" || raw.state === "READY_TO_PROMOTE")) {
|
|
47746
48095
|
active.push(id);
|
|
47747
48096
|
}
|
|
@@ -47856,10 +48205,10 @@ async function runResearchStart(rootDir, input) {
|
|
|
47856
48205
|
const created = [];
|
|
47857
48206
|
const skipped = [];
|
|
47858
48207
|
try {
|
|
47859
|
-
const researchDir =
|
|
48208
|
+
const researchDir = join10(rootDir, ...artifactRoot.split("/"));
|
|
47860
48209
|
await mkdir(researchDir, { recursive: true });
|
|
47861
48210
|
for (const fileName of RESEARCH_ARTIFACT_FILES) {
|
|
47862
|
-
const filePath =
|
|
48211
|
+
const filePath = join10(researchDir, fileName);
|
|
47863
48212
|
if (existsSync17(filePath)) {
|
|
47864
48213
|
skipped.push(`${artifactRoot}${fileName}`);
|
|
47865
48214
|
continue;
|
|
@@ -47931,7 +48280,7 @@ async function runResearchList(rootDir, hostArg) {
|
|
|
47931
48280
|
], [`research list: FAILED \u2014 SCHEMA_INVALID`]);
|
|
47932
48281
|
}
|
|
47933
48282
|
const hostRef = normalizeDir(hostArg);
|
|
47934
|
-
const hostDir =
|
|
48283
|
+
const hostDir = join10(rootDir, ...hostRef.split("/"));
|
|
47935
48284
|
if (!existsSync17(hostDir)) {
|
|
47936
48285
|
return failOutcome("research list", { host_ref: hostRef, artifacts: [] }, [
|
|
47937
48286
|
{
|
|
@@ -47941,7 +48290,7 @@ async function runResearchList(rootDir, hostArg) {
|
|
|
47941
48290
|
}
|
|
47942
48291
|
], [`research list: FAILED \u2014 RESEARCH_HOST_NOT_FOUND (${hostRef})`]);
|
|
47943
48292
|
}
|
|
47944
|
-
const indexPath =
|
|
48293
|
+
const indexPath = join10(hostDir, "research", "index.yaml");
|
|
47945
48294
|
const index = await readIndexYaml(indexPath);
|
|
47946
48295
|
const artifacts = [];
|
|
47947
48296
|
if (index !== null) {
|
|
@@ -47998,7 +48347,7 @@ async function runResearchInspect(rootDir, researchId) {
|
|
|
47998
48347
|
}
|
|
47999
48348
|
], [`research inspect: FAILED \u2014 SCHEMA_INVALID`]);
|
|
48000
48349
|
}
|
|
48001
|
-
const hostDir =
|
|
48350
|
+
const hostDir = join10(rootDir, ...hostRef.split("/"));
|
|
48002
48351
|
if (!existsSync17(hostDir)) {
|
|
48003
48352
|
return failOutcome("research inspect", {
|
|
48004
48353
|
research_id: researchId,
|
|
@@ -48016,8 +48365,8 @@ async function runResearchInspect(rootDir, researchId) {
|
|
|
48016
48365
|
}
|
|
48017
48366
|
], [`research inspect: FAILED \u2014 RESEARCH_HOST_NOT_FOUND (${hostRef})`]);
|
|
48018
48367
|
}
|
|
48019
|
-
const researchDir =
|
|
48020
|
-
const indexPath =
|
|
48368
|
+
const researchDir = join10(hostDir, "research");
|
|
48369
|
+
const indexPath = join10(researchDir, "index.yaml");
|
|
48021
48370
|
if (!existsSync17(indexPath)) {
|
|
48022
48371
|
return failOutcome("research inspect", {
|
|
48023
48372
|
research_id: researchId,
|
|
@@ -48072,7 +48421,7 @@ async function runResearchInspect(rootDir, researchId) {
|
|
|
48072
48421
|
}
|
|
48073
48422
|
const files = RESEARCH_ARTIFACT_FILES.map((f) => ({
|
|
48074
48423
|
file: f,
|
|
48075
|
-
present: existsSync17(
|
|
48424
|
+
present: existsSync17(join10(researchDir, f))
|
|
48076
48425
|
}));
|
|
48077
48426
|
const missing = files.filter((f) => !f.present).map((f) => f.file);
|
|
48078
48427
|
const rawFindings = Array.isArray(index.findings) ? index.findings : [];
|
|
@@ -48416,7 +48765,7 @@ async function loadResearchFinding(rootDir, researchId, findingNumber) {
|
|
|
48416
48765
|
}
|
|
48417
48766
|
};
|
|
48418
48767
|
}
|
|
48419
|
-
const indexPath =
|
|
48768
|
+
const indexPath = join11(rootDir, ...artifactRoot.split("/"), "index.yaml");
|
|
48420
48769
|
if (!existsSync18(indexPath)) {
|
|
48421
48770
|
return {
|
|
48422
48771
|
error: {
|
|
@@ -48634,16 +48983,16 @@ init_src();
|
|
|
48634
48983
|
init_dist();
|
|
48635
48984
|
import { existsSync as existsSync19 } from "node:fs";
|
|
48636
48985
|
import { mkdir as mkdir2, readdir as readdir2, readFile as readFile12, writeFile as writeFile3 } from "node:fs/promises";
|
|
48637
|
-
import { isAbsolute, join as
|
|
48986
|
+
import { isAbsolute, join as join12, relative as relative2, resolve as resolve2 } from "node:path";
|
|
48638
48987
|
var PROMOTE_TARGETS = ["CHANGE", "TASK"];
|
|
48639
48988
|
function scratchpadRefOf(id) {
|
|
48640
48989
|
return `.pomaster/discovery/scratchpads/${id}/`;
|
|
48641
48990
|
}
|
|
48642
48991
|
function stateFilePath(rootDir, id) {
|
|
48643
|
-
return
|
|
48992
|
+
return join12(discoveryScratchpadDirPath(rootDir, id), "state.json");
|
|
48644
48993
|
}
|
|
48645
48994
|
function metaFilePath(rootDir, id) {
|
|
48646
|
-
return
|
|
48995
|
+
return join12(discoveryScratchpadDirPath(rootDir, id), "meta.json");
|
|
48647
48996
|
}
|
|
48648
48997
|
function cliError(err) {
|
|
48649
48998
|
if (err instanceof GovernedIdParseError) {
|
|
@@ -49042,7 +49391,7 @@ async function runBrainstormPromote(rootDir, input) {
|
|
|
49042
49391
|
return fail6(txOutError, [`brainstorm promote: FAILED \u2014 SCHEMA_INVALID (--tx-out)`]);
|
|
49043
49392
|
}
|
|
49044
49393
|
if (txPath === null) {
|
|
49045
|
-
txPath =
|
|
49394
|
+
txPath = join12(discoveryScratchpadDirPath(rootDir, input.discoveryId), "promote-tx.json");
|
|
49046
49395
|
}
|
|
49047
49396
|
try {
|
|
49048
49397
|
await mkdir2(discoveryScratchpadDirPath(rootDir, input.discoveryId), { recursive: true });
|
|
@@ -49150,7 +49499,7 @@ async function runBrainstormPromote(rootDir, input) {
|
|
|
49150
49499
|
|
|
49151
49500
|
// packages/cli/dist/memory.js
|
|
49152
49501
|
init_dist();
|
|
49153
|
-
import { readFileSync as
|
|
49502
|
+
import { readFileSync as readFileSync21 } from "node:fs";
|
|
49154
49503
|
import { homedir as homedir3 } from "node:os";
|
|
49155
49504
|
var [MEMORY_ENTRY_NOT_FOUND, MEMORY_ALREADY_REVIEWED, MEMORY_REVIEW_REQUIRED, MEMORY_ALREADY_PROMOTED, MEMORY_PROMOTE_OWNER_REQUIRED, MEMORY_CAPTURE_DUPLICATE, MEMORY_HARVEST_NOT_RUN] = MEMORY_CLI_ERROR_VALUES;
|
|
49156
49505
|
function toCliError2(err, docSection) {
|
|
@@ -49219,7 +49568,7 @@ function readStdinText() {
|
|
|
49219
49568
|
};
|
|
49220
49569
|
}
|
|
49221
49570
|
try {
|
|
49222
|
-
return { text:
|
|
49571
|
+
return { text: readFileSync21(0, "utf8") };
|
|
49223
49572
|
} catch (err) {
|
|
49224
49573
|
return {
|
|
49225
49574
|
error: {
|
|
@@ -49797,7 +50146,7 @@ async function runMemoryAudit(rootDir, input) {
|
|
|
49797
50146
|
|
|
49798
50147
|
// packages/cli/dist/production.js
|
|
49799
50148
|
init_dist();
|
|
49800
|
-
import { readFileSync as
|
|
50149
|
+
import { readFileSync as readFileSync22 } from "node:fs";
|
|
49801
50150
|
var [BAND_SCHEMA_INVALID, BAND_NOT_FOUND, OBSERVATION_NOT_EVALUABLE, CHALLENGE_REJECTED, EVIDENCE_NOT_FOUND] = PRODUCTION_CLI_ERROR_VALUES;
|
|
49802
50151
|
var NO_AUTO_APPLY_NOTE = "\u5448\u62A5\u6001\u2014\u2014\u4E0D\u5F97\u81EA\u52A8\u5E94\u7528\uFF08PRD \xA790.4 L5695 \u9010\u5B57\uFF09\uFF1APOMASTER_SELF_IMPROVEMENT_CANDIDATE \u65E0\u4EFB\u4F55\u81EA\u52A8\u5E94\u7528\u901A\u8DEF\uFF0C\u300C\u5E94\u7528\u300D\u6C38\u8FDC\u662F\u4EBA/Owner \u7ECF\u6CBB\u7406\u9762\u7684\u663E\u5F0F\u52A8\u4F5C";
|
|
49803
50152
|
function fail5(result2, command, error) {
|
|
@@ -50059,7 +50408,7 @@ async function runProductionEvaluate(rootDir, input) {
|
|
|
50059
50408
|
const filePath = input.observationsFile.trim();
|
|
50060
50409
|
let text;
|
|
50061
50410
|
try {
|
|
50062
|
-
text =
|
|
50411
|
+
text = readFileSync22(filePath, "utf8");
|
|
50063
50412
|
} catch (err) {
|
|
50064
50413
|
return fail5(empty, command, {
|
|
50065
50414
|
code: OBSERVATION_NOT_EVALUABLE,
|
|
@@ -51443,10 +51792,24 @@ function createProgram(runs, io = defaultIo) {
|
|
|
51443
51792
|
writeOut: (chunk) => io.stdout(chunk.replace(/\n$/, "")),
|
|
51444
51793
|
writeErr: (chunk) => io.stderr(chunk.replace(/\n$/, ""))
|
|
51445
51794
|
});
|
|
51446
|
-
program2.name(CLI_NAME).description("POMaster vNext \u2014 Governed Software State Control Plane\uFF08\u516B\u62CD Change Loop \u547D\u4EE4\u9762\uFF09").version(
|
|
51447
|
-
program2.
|
|
51448
|
-
|
|
51449
|
-
|
|
51795
|
+
program2.name(CLI_NAME).description("POMaster vNext \u2014 Governed Software State Control Plane\uFF08\u516B\u62CD Change Loop \u547D\u4EE4\u9762\uFF09").version(resolveCliVersion()).option("--dir <path>", "project root directory", process.cwd());
|
|
51796
|
+
program2.addHelpText("after", "\nContact / commercial licensing: allenxujianyang@outlook.com");
|
|
51797
|
+
program2.command("init").description("\u521B\u5EFA .pomaster/ \u6700\u5C0F\u9AA8\u67B6 + AGENTS.md \u552F\u4E00\u4E8B\u5B9E\u6E90 + \u5E73\u53F0\u9002\u914D\u5668\uFF08F1\uFF1A--platforms \u9017\u53F7\u5217\u8868 claude,codex,cursor,qoder / none\uFF1B\u5E42\u7B49\uFF1B\u91CD\u590D\u6267\u884C NO_CHANGE\uFF09").option("--platforms <platforms>", "\u5E73\u53F0\u9002\u914D\u5668\u9017\u53F7\u5217\u8868\uFF08claude|codex|cursor|qoder|none\uFF1B\u7F3A\u7701 claude\uFF1BTTY \u4EBA\u8BFB\u6A21\u5F0F\u65E0\u65D7\u6807\u65F6\u51FA\u6E05\u5355\u4EA4\u4E92\uFF09").option("--json", "machine-readable JSON output (\xA745)").action(async (_opts, command) => {
|
|
51798
|
+
const platformsArg = command.opts().platforms;
|
|
51799
|
+
const asJson = command.opts().json === true;
|
|
51800
|
+
const outcome = platformsArg === void 0 && !asJson && process.stdin.isTTY === true ? await runInitInteractive(resolveDir(command), {
|
|
51801
|
+
write: (line) => io.stdout(line),
|
|
51802
|
+
readLine: readLineFromStdin
|
|
51803
|
+
}) : await runInit(resolveDir(command), { platforms: platformsArg });
|
|
51804
|
+
record({ command: "init", outcome, asJson });
|
|
51805
|
+
});
|
|
51806
|
+
program2.command("update").description("\u68C0\u67E5/\u6267\u884C CLI \u81EA\u66F4\u65B0\uFF1A\u7F3A\u7701 --check\uFF08npm view \u6BD4\u5BF9 semver\uFF0Cregistry \u4E0D\u53EF\u8FBE\u663E\u5F0F\u5448\u73B0\u7981\u5047\u7EFF\uFF09\uFF1B--yes = \u66F4\u65B0\u53EF\u7528\u65F6 npm install -g pomaster@latest\uFF08npm \u5931\u8D25\u900F\u4F20 exit 1\uFF1B\u5B8C\u6210\u540E\u91CD\u65B0 pomaster init \u5237\u65B0\u8F7B\u5165\u53E3\uFF09").option("--check", "\u68C0\u67E5\u66F4\u65B0\uFF08\u7F3A\u7701\u884C\u4E3A\uFF0C\u663E\u5F0F\u8BCD\u5F62\u517C\u5BB9\uFF09").option("--yes", "\u68C0\u67E5\u5230\u66F4\u65B0\u65F6\u6267\u884C npm install -g pomaster@latest").option("--json", "machine-readable JSON output (\xA745)").action(async (opts, command) => {
|
|
51807
|
+
const outcome = runUpdate({ yes: opts.yes === true });
|
|
51808
|
+
record({
|
|
51809
|
+
command: "update",
|
|
51810
|
+
outcome,
|
|
51811
|
+
asJson: command.optsWithGlobals().json === true
|
|
51812
|
+
});
|
|
51450
51813
|
});
|
|
51451
51814
|
program2.command("triage").description("\u516B\u62CD\u2460\uFF1A\u89C4\u5219\u6876\u5224\u6863\uFF08\u8DE8\u57DF contract\u2192STANDARD\uFF1B\u7EAF\u6587\u6848/\u6837\u5F0F\u2192MINIMAL\uFF1B\u9ED8\u8BA4 LIGHT\uFF09").argument("<request>", "change request text").option("--json", "machine-readable JSON output (\xA745)").action(async (request, _opts, command) => {
|
|
51452
51815
|
const result2 = triageRequest(request);
|
|
@@ -52321,6 +52684,16 @@ function createProgram(runs, io = defaultIo) {
|
|
|
52321
52684
|
function collectValues(value, previous) {
|
|
52322
52685
|
return [...previous ?? [], value];
|
|
52323
52686
|
}
|
|
52687
|
+
function readLineFromStdin() {
|
|
52688
|
+
const rl = createInterface({ input: process.stdin });
|
|
52689
|
+
return new Promise((resolve3) => {
|
|
52690
|
+
rl.once("line", (line) => {
|
|
52691
|
+
resolve3(line);
|
|
52692
|
+
rl.close();
|
|
52693
|
+
});
|
|
52694
|
+
rl.once("close", () => resolve3(""));
|
|
52695
|
+
});
|
|
52696
|
+
}
|
|
52324
52697
|
function isInformationalCommanderExit(err) {
|
|
52325
52698
|
return err instanceof CommanderError && (err.code === "commander.helpDisplayed" || err.code === "commander.help" || err.code === "commander.version");
|
|
52326
52699
|
}
|