poe-code 3.0.213 → 3.0.214
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 +382 -59
- package/dist/index.js.map +4 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -38279,7 +38279,7 @@ function selectNextExecution(plan, taskId) {
|
|
|
38279
38279
|
function describeExecutionContext(selection) {
|
|
38280
38280
|
return selection.stepName ? `task "${selection.task.id}" step "${selection.stepName}"` : `task "${selection.task.id}"`;
|
|
38281
38281
|
}
|
|
38282
|
-
async function resolveFileIncludes(template2, cwd,
|
|
38282
|
+
async function resolveFileIncludes(template2, cwd, readFile46) {
|
|
38283
38283
|
const matches2 = [...template2.matchAll(FILE_INCLUDE_PATTERN)];
|
|
38284
38284
|
if (matches2.length === 0) {
|
|
38285
38285
|
return template2;
|
|
@@ -38287,7 +38287,7 @@ async function resolveFileIncludes(template2, cwd, readFile45) {
|
|
|
38287
38287
|
let result = template2;
|
|
38288
38288
|
for (const match of matches2) {
|
|
38289
38289
|
const absolutePath = path51.resolve(cwd, match[1]);
|
|
38290
|
-
const content = await
|
|
38290
|
+
const content = await readFile46(absolutePath, "utf8");
|
|
38291
38291
|
result = result.replace(match[0], content);
|
|
38292
38292
|
}
|
|
38293
38293
|
return result;
|
|
@@ -38355,15 +38355,15 @@ async function resolveDocVarFromPath(options) {
|
|
|
38355
38355
|
);
|
|
38356
38356
|
}
|
|
38357
38357
|
}
|
|
38358
|
-
async function resolvePipelineVars(vars, cwd,
|
|
38358
|
+
async function resolvePipelineVars(vars, cwd, readFile46) {
|
|
38359
38359
|
const resolved = {};
|
|
38360
38360
|
for (const [key2, value] of Object.entries(vars)) {
|
|
38361
38361
|
if (key2.endsWith("_doc") && looksLikeDocPath(value)) {
|
|
38362
|
-
const docContent = await resolveDocVarFromPath({ key: key2, value, cwd, readFile:
|
|
38363
|
-
resolved[key2] = await resolveFileIncludes(docContent, cwd,
|
|
38362
|
+
const docContent = await resolveDocVarFromPath({ key: key2, value, cwd, readFile: readFile46 });
|
|
38363
|
+
resolved[key2] = await resolveFileIncludes(docContent, cwd, readFile46);
|
|
38364
38364
|
continue;
|
|
38365
38365
|
}
|
|
38366
|
-
resolved[key2] = await resolveFileIncludes(value, cwd,
|
|
38366
|
+
resolved[key2] = await resolveFileIncludes(value, cwd, readFile46);
|
|
38367
38367
|
}
|
|
38368
38368
|
return resolved;
|
|
38369
38369
|
}
|
|
@@ -49593,6 +49593,316 @@ var init_require_comment_prefix = __esm({
|
|
|
49593
49593
|
}
|
|
49594
49594
|
});
|
|
49595
49595
|
|
|
49596
|
+
// packages/github-workflows/src/exec/trufflehog-pr-scan.ts
|
|
49597
|
+
import { appendFile as appendFile5, readFile as readFile24, writeFile as writeFile15 } from "node:fs/promises";
|
|
49598
|
+
async function runTruffleHogPrScanCommand(command, env, options = {}) {
|
|
49599
|
+
const runner = options.runner ?? runCommand;
|
|
49600
|
+
const cwd = options.cwd ?? process.cwd();
|
|
49601
|
+
if (command === "scan-for-secrets") {
|
|
49602
|
+
await scanForSecrets(env, cwd, runner);
|
|
49603
|
+
return null;
|
|
49604
|
+
}
|
|
49605
|
+
if (command === "report-advisory-result") {
|
|
49606
|
+
await reportAdvisoryResult(env, runner);
|
|
49607
|
+
return null;
|
|
49608
|
+
}
|
|
49609
|
+
await clearStaleAdvisoryResult(env, runner);
|
|
49610
|
+
return null;
|
|
49611
|
+
}
|
|
49612
|
+
function parseTruffleHogFindings(jsonl) {
|
|
49613
|
+
const findings = [];
|
|
49614
|
+
for (const line of jsonl.split("\n")) {
|
|
49615
|
+
if (line.trim() === "") {
|
|
49616
|
+
continue;
|
|
49617
|
+
}
|
|
49618
|
+
const parsed = parseJsonObject(line);
|
|
49619
|
+
const detector = stringValue(parsed.DetectorName);
|
|
49620
|
+
if (detector === void 0) {
|
|
49621
|
+
continue;
|
|
49622
|
+
}
|
|
49623
|
+
findings.push({
|
|
49624
|
+
detector,
|
|
49625
|
+
filePath: readFilePath(parsed),
|
|
49626
|
+
lineNumber: readLineNumber(parsed),
|
|
49627
|
+
status: readStatus(parsed)
|
|
49628
|
+
});
|
|
49629
|
+
}
|
|
49630
|
+
return findings;
|
|
49631
|
+
}
|
|
49632
|
+
function uniqueTruffleHogFindings(findings) {
|
|
49633
|
+
const unique = /* @__PURE__ */ new Map();
|
|
49634
|
+
for (const finding of findings) {
|
|
49635
|
+
const key2 = [finding.status, finding.detector, finding.filePath, String(finding.lineNumber)].join("\0");
|
|
49636
|
+
if (!unique.has(key2)) {
|
|
49637
|
+
unique.set(key2, finding);
|
|
49638
|
+
}
|
|
49639
|
+
}
|
|
49640
|
+
return [...unique.values()];
|
|
49641
|
+
}
|
|
49642
|
+
function renderTruffleHogFindingsTable(findings, options) {
|
|
49643
|
+
const uniqueFindings = uniqueTruffleHogFindings(findings);
|
|
49644
|
+
const rows = [
|
|
49645
|
+
"| Detector | Location | Verification |",
|
|
49646
|
+
"| --- | --- | --- |",
|
|
49647
|
+
...uniqueFindings.slice(0, options.maxFindings).map((finding) => `| ${md(finding.detector)} | ${renderLocation(finding, options)} | ${md(finding.status)} |`)
|
|
49648
|
+
];
|
|
49649
|
+
if (uniqueFindings.length > options.maxFindings) {
|
|
49650
|
+
rows.push("", `_Showing first ${options.maxFindings} of ${uniqueFindings.length} findings._`);
|
|
49651
|
+
}
|
|
49652
|
+
return rows.join("\n");
|
|
49653
|
+
}
|
|
49654
|
+
function renderTruffleHogComment(findings, options) {
|
|
49655
|
+
const uniqueFindings = uniqueTruffleHogFindings(findings);
|
|
49656
|
+
const heading = uniqueFindings.length === 1 ? "TruffleHog found a possible secret" : `TruffleHog found ${uniqueFindings.length} possible secrets`;
|
|
49657
|
+
return [
|
|
49658
|
+
COMMENT_MARKER,
|
|
49659
|
+
"",
|
|
49660
|
+
`### ${heading}`,
|
|
49661
|
+
"",
|
|
49662
|
+
renderTruffleHogFindingsTable(findings, options),
|
|
49663
|
+
"",
|
|
49664
|
+
FIX_MESSAGE
|
|
49665
|
+
].join("\n");
|
|
49666
|
+
}
|
|
49667
|
+
async function scanForSecrets(env, cwd, runner) {
|
|
49668
|
+
const baseSha = requireEnv(env, "BASE_SHA");
|
|
49669
|
+
const headSha = requireEnv(env, "HEAD_SHA");
|
|
49670
|
+
const results = requireEnv(env, "RESULTS");
|
|
49671
|
+
const image = requireEnv(env, "TRUFFLEHOG_IMAGE");
|
|
49672
|
+
const resultsFile = env.get("TRUFFLEHOG_RESULTS_FILE") ?? DEFAULT_RESULTS_FILE;
|
|
49673
|
+
const stderrFile = env.get("TRUFFLEHOG_STDERR_FILE") ?? DEFAULT_STDERR_FILE;
|
|
49674
|
+
const result = await runner(
|
|
49675
|
+
"docker",
|
|
49676
|
+
[
|
|
49677
|
+
"run",
|
|
49678
|
+
"--rm",
|
|
49679
|
+
"-v",
|
|
49680
|
+
`${cwd}:/tmp`,
|
|
49681
|
+
"-w",
|
|
49682
|
+
"/tmp",
|
|
49683
|
+
image,
|
|
49684
|
+
"git",
|
|
49685
|
+
"file:///tmp/",
|
|
49686
|
+
"--since-commit",
|
|
49687
|
+
baseSha,
|
|
49688
|
+
"--branch",
|
|
49689
|
+
headSha,
|
|
49690
|
+
"--fail",
|
|
49691
|
+
"--no-update",
|
|
49692
|
+
"--json",
|
|
49693
|
+
`--results=${results}`
|
|
49694
|
+
],
|
|
49695
|
+
{ cwd }
|
|
49696
|
+
);
|
|
49697
|
+
await writeFile15(resultsFile, result.stdout, "utf8");
|
|
49698
|
+
await writeFile15(stderrFile, result.stderr, "utf8");
|
|
49699
|
+
process.stderr.write(result.stderr);
|
|
49700
|
+
const findingsCount = parseTruffleHogFindings(result.stdout).length;
|
|
49701
|
+
await setGitHubOutput(env, "exit_code", String(result.exitCode));
|
|
49702
|
+
await setGitHubOutput(env, "findings_count", String(findingsCount));
|
|
49703
|
+
if (result.exitCode !== 0 && findingsCount === 0) {
|
|
49704
|
+
throw new UserError(`TruffleHog exited with ${result.exitCode} without producing findings.`);
|
|
49705
|
+
}
|
|
49706
|
+
}
|
|
49707
|
+
async function reportAdvisoryResult(env, runner) {
|
|
49708
|
+
const githubToken = requireEnv(env, "GH_TOKEN");
|
|
49709
|
+
const headSha = requireEnv(env, "HEAD_SHA");
|
|
49710
|
+
const maxFindings = numberEnv(env, "MAX_FINDINGS");
|
|
49711
|
+
const prNumber = requireEnv(env, "PR_NUMBER");
|
|
49712
|
+
const repository = requireEnv(env, "REPOSITORY");
|
|
49713
|
+
const resultsFile = env.get("TRUFFLEHOG_RESULTS_FILE") ?? DEFAULT_RESULTS_FILE;
|
|
49714
|
+
const findings = uniqueTruffleHogFindings(parseTruffleHogFindings(await readFile24(resultsFile, "utf8")));
|
|
49715
|
+
const body = renderTruffleHogComment(findings, { repository, headSha, maxFindings });
|
|
49716
|
+
emitInlineAnnotations(findings, { maxFindings });
|
|
49717
|
+
const existingCommentId = await findExistingCommentId(runner, githubToken, repository, prNumber);
|
|
49718
|
+
if (existingCommentId === void 0) {
|
|
49719
|
+
await ghApi(runner, githubToken, ["repos", repository, "issues", prNumber, "comments"], [
|
|
49720
|
+
"--method",
|
|
49721
|
+
"POST",
|
|
49722
|
+
"--field",
|
|
49723
|
+
`body=${body}`
|
|
49724
|
+
]);
|
|
49725
|
+
} else {
|
|
49726
|
+
await ghApi(runner, githubToken, ["repos", repository, "issues", "comments", existingCommentId], [
|
|
49727
|
+
"--method",
|
|
49728
|
+
"PATCH",
|
|
49729
|
+
"--field",
|
|
49730
|
+
`body=${body}`
|
|
49731
|
+
]);
|
|
49732
|
+
}
|
|
49733
|
+
const heading = findings.length === 1 ? "TruffleHog found a possible secret" : `TruffleHog found ${findings.length} possible secrets`;
|
|
49734
|
+
const errorTitle = findings.length === 1 ? "TruffleHog finding" : "TruffleHog findings";
|
|
49735
|
+
const errorMessage = findings.length === 1 ? "Possible secret detected." : "Possible secrets detected.";
|
|
49736
|
+
console.log(`::error title=${errorTitle}::${errorMessage}`);
|
|
49737
|
+
await appendStepSummary(env, [
|
|
49738
|
+
`### ${heading}`,
|
|
49739
|
+
"",
|
|
49740
|
+
renderTruffleHogFindingsTable(findings, { repository, headSha, maxFindings }),
|
|
49741
|
+
"",
|
|
49742
|
+
FIX_MESSAGE
|
|
49743
|
+
].join("\n"));
|
|
49744
|
+
}
|
|
49745
|
+
async function clearStaleAdvisoryResult(env, runner) {
|
|
49746
|
+
const githubToken = requireEnv(env, "GH_TOKEN");
|
|
49747
|
+
const prNumber = requireEnv(env, "PR_NUMBER");
|
|
49748
|
+
const repository = requireEnv(env, "REPOSITORY");
|
|
49749
|
+
const existingCommentId = await findExistingCommentId(runner, githubToken, repository, prNumber);
|
|
49750
|
+
if (existingCommentId !== void 0) {
|
|
49751
|
+
await ghApi(runner, githubToken, ["repos", repository, "issues", "comments", existingCommentId], [
|
|
49752
|
+
"--method",
|
|
49753
|
+
"DELETE"
|
|
49754
|
+
]);
|
|
49755
|
+
}
|
|
49756
|
+
}
|
|
49757
|
+
function emitInlineAnnotations(findings, options) {
|
|
49758
|
+
for (const finding of findings.slice(0, options.maxFindings)) {
|
|
49759
|
+
if (finding.filePath === "" || finding.lineNumber <= 0) {
|
|
49760
|
+
continue;
|
|
49761
|
+
}
|
|
49762
|
+
console.log(
|
|
49763
|
+
`::error file=${commandValue(finding.filePath)},line=${finding.lineNumber},title=${commandValue(`TruffleHog: ${finding.detector}`)}::${messageValue(`Possible secret detected (${finding.status}). Remove it from the PR and rotate it if it was real.`)}`
|
|
49764
|
+
);
|
|
49765
|
+
}
|
|
49766
|
+
}
|
|
49767
|
+
async function findExistingCommentId(runner, githubToken, repository, prNumber) {
|
|
49768
|
+
const output = await ghApi(runner, githubToken, ["repos", repository, "issues", prNumber, "comments"]);
|
|
49769
|
+
const comments = parseJsonArray(output);
|
|
49770
|
+
for (let index = comments.length - 1; index >= 0; index -= 1) {
|
|
49771
|
+
const comment = comments[index];
|
|
49772
|
+
if (stringValue(comment.body)?.includes(COMMENT_MARKER) === true) {
|
|
49773
|
+
return stringValue(comment.id);
|
|
49774
|
+
}
|
|
49775
|
+
}
|
|
49776
|
+
return void 0;
|
|
49777
|
+
}
|
|
49778
|
+
async function ghApi(runner, githubToken, pathParts, args = []) {
|
|
49779
|
+
const result = await runner("gh", ["api", pathParts.join("/"), ...args], {
|
|
49780
|
+
env: { GH_TOKEN: githubToken }
|
|
49781
|
+
});
|
|
49782
|
+
if (result.exitCode !== 0) {
|
|
49783
|
+
throw new UserError(`GitHub API call failed with exit code ${result.exitCode}: ${result.stderr}`);
|
|
49784
|
+
}
|
|
49785
|
+
return result.stdout;
|
|
49786
|
+
}
|
|
49787
|
+
async function setGitHubOutput(env, key2, value) {
|
|
49788
|
+
const outputPath = env.get("GITHUB_OUTPUT");
|
|
49789
|
+
if (outputPath !== void 0 && outputPath !== "") {
|
|
49790
|
+
await appendFile5(outputPath, `${key2}=${value}
|
|
49791
|
+
`, "utf8");
|
|
49792
|
+
}
|
|
49793
|
+
}
|
|
49794
|
+
async function appendStepSummary(env, content) {
|
|
49795
|
+
const summaryPath = env.get("GITHUB_STEP_SUMMARY");
|
|
49796
|
+
if (summaryPath !== void 0 && summaryPath !== "") {
|
|
49797
|
+
await appendFile5(summaryPath, `${content}
|
|
49798
|
+
`, "utf8");
|
|
49799
|
+
}
|
|
49800
|
+
}
|
|
49801
|
+
function renderLocation(finding, options) {
|
|
49802
|
+
if (finding.lineNumber > 0 && finding.filePath !== "unknown") {
|
|
49803
|
+
return `[${finding.filePath}:${finding.lineNumber}](https://github.com/${options.repository}/blob/${options.headSha}/${finding.filePath}#L${finding.lineNumber})`;
|
|
49804
|
+
}
|
|
49805
|
+
if (finding.filePath !== "unknown") {
|
|
49806
|
+
return `\`${md(finding.filePath)}\``;
|
|
49807
|
+
}
|
|
49808
|
+
return "unknown";
|
|
49809
|
+
}
|
|
49810
|
+
function readStatus(record) {
|
|
49811
|
+
if (record.Verified === true) {
|
|
49812
|
+
return "verified";
|
|
49813
|
+
}
|
|
49814
|
+
const verificationError = stringValue(record.VerificationError);
|
|
49815
|
+
return verificationError === void 0 || verificationError === "" ? "unverified" : "unknown";
|
|
49816
|
+
}
|
|
49817
|
+
function readFilePath(record) {
|
|
49818
|
+
const metadata = objectValue(record.SourceMetadata);
|
|
49819
|
+
const gitMetadata = recordValue(recordValue(metadata.Data)?.Git) ?? recordValue(metadata.Git) ?? recordValue(metadata.git) ?? recordValue(recordValue(metadata.data)?.git) ?? {};
|
|
49820
|
+
const filesystemMetadata = recordValue(metadata.Filesystem) ?? recordValue(metadata.filesystem) ?? {};
|
|
49821
|
+
return stringValue(gitMetadata.file) ?? stringValue(gitMetadata.File) ?? stringValue(filesystemMetadata.file) ?? "unknown";
|
|
49822
|
+
}
|
|
49823
|
+
function readLineNumber(record) {
|
|
49824
|
+
const metadata = objectValue(record.SourceMetadata);
|
|
49825
|
+
const gitMetadata = recordValue(recordValue(metadata.Data)?.Git) ?? recordValue(metadata.Git) ?? recordValue(metadata.git) ?? recordValue(recordValue(metadata.data)?.git) ?? {};
|
|
49826
|
+
const filesystemMetadata = recordValue(metadata.Filesystem) ?? recordValue(metadata.filesystem) ?? {};
|
|
49827
|
+
return numberValue(gitMetadata.line) ?? numberValue(gitMetadata.Line) ?? numberValue(filesystemMetadata.line) ?? 0;
|
|
49828
|
+
}
|
|
49829
|
+
function requireEnv(env, name) {
|
|
49830
|
+
const value = env.get(name);
|
|
49831
|
+
if (value === void 0 || value === "") {
|
|
49832
|
+
throw new UserError(`${name} is required.`);
|
|
49833
|
+
}
|
|
49834
|
+
return value;
|
|
49835
|
+
}
|
|
49836
|
+
function numberEnv(env, name) {
|
|
49837
|
+
const value = Number(requireEnv(env, name));
|
|
49838
|
+
if (!Number.isFinite(value)) {
|
|
49839
|
+
throw new UserError(`${name} must be a number.`);
|
|
49840
|
+
}
|
|
49841
|
+
return value;
|
|
49842
|
+
}
|
|
49843
|
+
function parseJsonObject(value) {
|
|
49844
|
+
try {
|
|
49845
|
+
const parsed = JSON.parse(value);
|
|
49846
|
+
return objectValue(parsed);
|
|
49847
|
+
} catch {
|
|
49848
|
+
return {};
|
|
49849
|
+
}
|
|
49850
|
+
}
|
|
49851
|
+
function parseJsonArray(value) {
|
|
49852
|
+
try {
|
|
49853
|
+
const parsed = JSON.parse(value);
|
|
49854
|
+
return Array.isArray(parsed) ? parsed.map(objectValue) : [];
|
|
49855
|
+
} catch {
|
|
49856
|
+
return [];
|
|
49857
|
+
}
|
|
49858
|
+
}
|
|
49859
|
+
function objectValue(value) {
|
|
49860
|
+
return recordValue(value) ?? {};
|
|
49861
|
+
}
|
|
49862
|
+
function recordValue(value) {
|
|
49863
|
+
return typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
|
|
49864
|
+
}
|
|
49865
|
+
function stringValue(value) {
|
|
49866
|
+
if (typeof value === "string") {
|
|
49867
|
+
return value;
|
|
49868
|
+
}
|
|
49869
|
+
if (typeof value === "number") {
|
|
49870
|
+
return String(value);
|
|
49871
|
+
}
|
|
49872
|
+
return void 0;
|
|
49873
|
+
}
|
|
49874
|
+
function numberValue(value) {
|
|
49875
|
+
if (typeof value === "number") {
|
|
49876
|
+
return value;
|
|
49877
|
+
}
|
|
49878
|
+
if (typeof value !== "string") {
|
|
49879
|
+
return void 0;
|
|
49880
|
+
}
|
|
49881
|
+
const parsed = Number(value);
|
|
49882
|
+
return Number.isFinite(parsed) ? parsed : void 0;
|
|
49883
|
+
}
|
|
49884
|
+
function md(value) {
|
|
49885
|
+
return value.replaceAll("|", "\\|").replaceAll("`", "'").replaceAll("\r", " ").replaceAll("\n", " ");
|
|
49886
|
+
}
|
|
49887
|
+
function commandValue(value) {
|
|
49888
|
+
return value.replaceAll("%", "%25").replaceAll("\r", "%0D").replaceAll("\n", "%0A").replaceAll(":", "%3A").replaceAll(",", "%2C");
|
|
49889
|
+
}
|
|
49890
|
+
function messageValue(value) {
|
|
49891
|
+
return value.replaceAll("%", "%25").replaceAll("\r", "%0D").replaceAll("\n", "%0A");
|
|
49892
|
+
}
|
|
49893
|
+
var DEFAULT_RESULTS_FILE, DEFAULT_STDERR_FILE, COMMENT_MARKER, FIX_MESSAGE;
|
|
49894
|
+
var init_trufflehog_pr_scan = __esm({
|
|
49895
|
+
"packages/github-workflows/src/exec/trufflehog-pr-scan.ts"() {
|
|
49896
|
+
"use strict";
|
|
49897
|
+
init_src16();
|
|
49898
|
+
init_src12();
|
|
49899
|
+
DEFAULT_RESULTS_FILE = "/tmp/trufflehog-results.jsonl";
|
|
49900
|
+
DEFAULT_STDERR_FILE = "/tmp/trufflehog-stderr.log";
|
|
49901
|
+
COMMENT_MARKER = "<!-- trufflehog-pr-scan -->";
|
|
49902
|
+
FIX_MESSAGE = "Fix: remove the value, rotate it if it was real, and push a cleanup commit.";
|
|
49903
|
+
}
|
|
49904
|
+
});
|
|
49905
|
+
|
|
49596
49906
|
// packages/github-workflows/src/preflight.ts
|
|
49597
49907
|
function runPreflightChecks(context) {
|
|
49598
49908
|
checkRequiredEnvVar(context.env, "POE_API_KEY");
|
|
@@ -49661,7 +49971,7 @@ var init_setup_agent = __esm({
|
|
|
49661
49971
|
|
|
49662
49972
|
// packages/github-workflows/src/variables.ts
|
|
49663
49973
|
import path75 from "node:path";
|
|
49664
|
-
import { readFile as
|
|
49974
|
+
import { readFile as readFile25 } from "node:fs/promises";
|
|
49665
49975
|
import { isMap as isMap4, parseDocument as parseDocument9, stringify as stringify4 } from "yaml";
|
|
49666
49976
|
function isRecord25(value) {
|
|
49667
49977
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -49752,7 +50062,7 @@ function extractUserOverrideBlocks(filePath, content) {
|
|
|
49752
50062
|
}
|
|
49753
50063
|
async function readOptionalVariablesContent(filePath) {
|
|
49754
50064
|
try {
|
|
49755
|
-
return await
|
|
50065
|
+
return await readFile25(filePath, "utf8");
|
|
49756
50066
|
} catch (error2) {
|
|
49757
50067
|
if (error2 instanceof Error && error2.code === "ENOENT") {
|
|
49758
50068
|
return void 0;
|
|
@@ -49781,7 +50091,7 @@ function formatCommentedBlock(name, value) {
|
|
|
49781
50091
|
}
|
|
49782
50092
|
async function loadVariableSources(builtInDir, projectDir) {
|
|
49783
50093
|
const builtInPath = path75.join(builtInDir, VARIABLES_FILE_NAME);
|
|
49784
|
-
const builtInVariables = parseVariables(builtInPath, await
|
|
50094
|
+
const builtInVariables = parseVariables(builtInPath, await readFile25(builtInPath, "utf8"));
|
|
49785
50095
|
const projectVariablesPath = projectDir === void 0 ? void 0 : path75.join(projectDir, VARIABLES_FILE_NAME);
|
|
49786
50096
|
const projectVariablesContent = projectVariablesPath === void 0 ? void 0 : await readOptionalVariablesContent(projectVariablesPath);
|
|
49787
50097
|
if (projectVariablesPath === void 0 || projectVariablesContent === void 0) {
|
|
@@ -49795,7 +50105,7 @@ async function loadVariableSources(builtInDir, projectDir) {
|
|
|
49795
50105
|
}
|
|
49796
50106
|
async function loadVariables(builtInDir, projectDir) {
|
|
49797
50107
|
const builtInPath = path75.join(builtInDir, VARIABLES_FILE_NAME);
|
|
49798
|
-
const builtInContent = await
|
|
50108
|
+
const builtInContent = await readFile25(builtInPath, "utf8");
|
|
49799
50109
|
const builtInVariables = parseVariables(builtInPath, builtInContent);
|
|
49800
50110
|
if (projectDir === void 0) {
|
|
49801
50111
|
return filterDisabledVariables(builtInVariables);
|
|
@@ -49819,7 +50129,7 @@ async function loadVariables(builtInDir, projectDir) {
|
|
|
49819
50129
|
}
|
|
49820
50130
|
],
|
|
49821
50131
|
{
|
|
49822
|
-
fs: { readFile:
|
|
50132
|
+
fs: { readFile: readFile25 },
|
|
49823
50133
|
autoExtend: true
|
|
49824
50134
|
}
|
|
49825
50135
|
);
|
|
@@ -49894,7 +50204,7 @@ var init_variables2 = __esm({
|
|
|
49894
50204
|
});
|
|
49895
50205
|
|
|
49896
50206
|
// packages/github-workflows/src/commands.ts
|
|
49897
|
-
import { access as access3, mkdir as mkdir16, readFile as
|
|
50207
|
+
import { access as access3, mkdir as mkdir16, readFile as readFile26, unlink as unlink12, writeFile as writeFile16 } from "node:fs/promises";
|
|
49898
50208
|
import path76 from "node:path";
|
|
49899
50209
|
import { fileURLToPath as fileURLToPath8 } from "node:url";
|
|
49900
50210
|
import Mustache3 from "mustache";
|
|
@@ -49918,7 +50228,7 @@ async function loadNamedAutomation(name, cwd) {
|
|
|
49918
50228
|
}
|
|
49919
50229
|
async function readBuiltInPromptFile(name) {
|
|
49920
50230
|
try {
|
|
49921
|
-
return await
|
|
50231
|
+
return await readFile26(path76.join(await resolveBuiltInPromptsDir(), `${name}.md`), "utf8");
|
|
49922
50232
|
} catch (error2) {
|
|
49923
50233
|
if (isMissingPathError2(error2)) {
|
|
49924
50234
|
throw new UserError(`Automation "${name}" was not found.`);
|
|
@@ -49929,7 +50239,7 @@ async function readBuiltInPromptFile(name) {
|
|
|
49929
50239
|
async function readBuiltInWorkflowTemplate(name, variant, automationName = name, promptPath) {
|
|
49930
50240
|
const templatePath = path76.join(await resolveBuiltInWorkflowTemplatesDir(), `${name}.${variant}.yml`);
|
|
49931
50241
|
try {
|
|
49932
|
-
const content = await
|
|
50242
|
+
const content = await readFile26(templatePath, "utf8");
|
|
49933
50243
|
const header = promptPath !== void 0 ? `# Auto-generated by: poe-code github-workflows install ${name}
|
|
49934
50244
|
# Edit ${path76.relative(process.cwd(), promptPath)} to customize the prompt.
|
|
49935
50245
|
` : `# Auto-generated by: poe-code github-workflows install ${name}
|
|
@@ -50140,10 +50450,10 @@ async function installAutomation(name, cwd, isEject) {
|
|
|
50140
50450
|
]);
|
|
50141
50451
|
const workflowPath = path76.join(cwd, ".github", "workflows", `poe-code-${name}.yml`);
|
|
50142
50452
|
await mkdir16(path76.dirname(workflowPath), { recursive: true });
|
|
50143
|
-
await
|
|
50453
|
+
await writeFile16(workflowPath, workflowTemplate, "utf8");
|
|
50144
50454
|
if (promptPath !== void 0) {
|
|
50145
50455
|
await mkdir16(path76.dirname(promptPath), { recursive: true });
|
|
50146
|
-
await
|
|
50456
|
+
await writeFile16(promptPath, addPromptHeader(rawPrompt, name), "utf8");
|
|
50147
50457
|
}
|
|
50148
50458
|
return {
|
|
50149
50459
|
name,
|
|
@@ -50158,17 +50468,17 @@ async function ensureProjectSupportFiles(cwd, builtInVariables) {
|
|
|
50158
50468
|
const variablesPath = path76.join(projectDir, "variables.yaml");
|
|
50159
50469
|
const readmePath = path76.join(projectDir, "README.md");
|
|
50160
50470
|
await mkdir16(projectDir, { recursive: true });
|
|
50161
|
-
await
|
|
50471
|
+
await writeFile16(
|
|
50162
50472
|
variablesPath,
|
|
50163
50473
|
generateProjectVariablesFile(builtInVariables, await readOptionalFile4(variablesPath)),
|
|
50164
50474
|
"utf8"
|
|
50165
50475
|
);
|
|
50166
|
-
await
|
|
50476
|
+
await writeFile16(readmePath, renderProjectReadme(), "utf8");
|
|
50167
50477
|
return { readmePath, variablesPath };
|
|
50168
50478
|
}
|
|
50169
50479
|
async function readOptionalFile4(filePath) {
|
|
50170
50480
|
try {
|
|
50171
|
-
return await
|
|
50481
|
+
return await readFile26(filePath, "utf8");
|
|
50172
50482
|
} catch (error2) {
|
|
50173
50483
|
if (isMissingPathError2(error2)) {
|
|
50174
50484
|
return void 0;
|
|
@@ -50215,7 +50525,7 @@ async function selectAutomationName(message2, automations) {
|
|
|
50215
50525
|
}
|
|
50216
50526
|
return selected;
|
|
50217
50527
|
}
|
|
50218
|
-
var UPSTREAM_REPO, builtInPromptsDirCandidates, builtInWorkflowTemplatesDirCandidates, installableAutomations, runCommandDef, listCommand, installCommand2, uninstallCommand, requireUserAllowCommand, requireCommentPrefixCommand, prepareCommand, promptPreviewCommand, variablesCommand, ghGroup;
|
|
50528
|
+
var UPSTREAM_REPO, builtInPromptsDirCandidates, builtInWorkflowTemplatesDirCandidates, installableAutomations, runCommandDef, listCommand, installCommand2, uninstallCommand, requireUserAllowCommand, requireCommentPrefixCommand, truffleHogPrScanCommand, prepareCommand, promptPreviewCommand, variablesCommand, ghGroup;
|
|
50219
50529
|
var init_commands2 = __esm({
|
|
50220
50530
|
"packages/github-workflows/src/commands.ts"() {
|
|
50221
50531
|
"use strict";
|
|
@@ -50226,6 +50536,7 @@ var init_commands2 = __esm({
|
|
|
50226
50536
|
init_discover2();
|
|
50227
50537
|
init_check_user_allow();
|
|
50228
50538
|
init_require_comment_prefix();
|
|
50539
|
+
init_trufflehog_pr_scan();
|
|
50229
50540
|
init_preflight();
|
|
50230
50541
|
init_setup_agent();
|
|
50231
50542
|
init_variables2();
|
|
@@ -50485,6 +50796,16 @@ var init_commands2 = __esm({
|
|
|
50485
50796
|
return null;
|
|
50486
50797
|
}
|
|
50487
50798
|
});
|
|
50799
|
+
truffleHogPrScanCommand = defineCommand({
|
|
50800
|
+
name: "trufflehog-pr-scan",
|
|
50801
|
+
description: "Run the TruffleHog PR scan workflow helper.",
|
|
50802
|
+
positional: ["command"],
|
|
50803
|
+
params: S.Object({
|
|
50804
|
+
command: S.Enum(["scan-for-secrets", "report-advisory-result", "clear-stale-advisory-result"])
|
|
50805
|
+
}),
|
|
50806
|
+
scope: ["cli"],
|
|
50807
|
+
handler: async ({ params, env }) => runTruffleHogPrScanCommand(params.command, env)
|
|
50808
|
+
});
|
|
50488
50809
|
prepareCommand = defineCommand({
|
|
50489
50810
|
name: "prepare",
|
|
50490
50811
|
description: "Install and configure the agent required by a workflow automation.",
|
|
@@ -50571,6 +50892,7 @@ var init_commands2 = __esm({
|
|
|
50571
50892
|
prepareCommand,
|
|
50572
50893
|
requireUserAllowCommand,
|
|
50573
50894
|
requireCommentPrefixCommand,
|
|
50895
|
+
truffleHogPrScanCommand,
|
|
50574
50896
|
listCommand,
|
|
50575
50897
|
installCommand2,
|
|
50576
50898
|
uninstallCommand,
|
|
@@ -50591,6 +50913,7 @@ var init_src32 = __esm({
|
|
|
50591
50913
|
init_commands2();
|
|
50592
50914
|
init_check_user_allow();
|
|
50593
50915
|
init_require_comment_prefix();
|
|
50916
|
+
init_trufflehog_pr_scan();
|
|
50594
50917
|
}
|
|
50595
50918
|
});
|
|
50596
50919
|
|
|
@@ -51831,7 +52154,7 @@ var init_renderer3 = __esm({
|
|
|
51831
52154
|
});
|
|
51832
52155
|
|
|
51833
52156
|
// packages/toolcraft/src/cli.ts
|
|
51834
|
-
import { access as access4, readFile as
|
|
52157
|
+
import { access as access4, readFile as readFile27, writeFile as writeFile17 } from "node:fs/promises";
|
|
51835
52158
|
import path79 from "node:path";
|
|
51836
52159
|
import {
|
|
51837
52160
|
Command as CommanderCommand,
|
|
@@ -53083,9 +53406,9 @@ async function withOutputFormat2(output, fn) {
|
|
|
53083
53406
|
}
|
|
53084
53407
|
function createFs3() {
|
|
53085
53408
|
return {
|
|
53086
|
-
readFile: async (path108, encoding = "utf8") =>
|
|
53409
|
+
readFile: async (path108, encoding = "utf8") => readFile27(path108, { encoding }),
|
|
53087
53410
|
writeFile: async (path108, contents) => {
|
|
53088
|
-
await
|
|
53411
|
+
await writeFile17(path108, contents);
|
|
53089
53412
|
},
|
|
53090
53413
|
exists: async (path108) => {
|
|
53091
53414
|
try {
|
|
@@ -53192,7 +53515,7 @@ function validatePresetFieldValue(value, field, presetPath) {
|
|
|
53192
53515
|
async function loadPresetValues(fields, presetPath) {
|
|
53193
53516
|
let rawPreset;
|
|
53194
53517
|
try {
|
|
53195
|
-
rawPreset = await
|
|
53518
|
+
rawPreset = await readFile27(presetPath, {
|
|
53196
53519
|
encoding: "utf8"
|
|
53197
53520
|
});
|
|
53198
53521
|
} catch (error2) {
|
|
@@ -53449,7 +53772,7 @@ async function loadFixtureScenario(command, selector) {
|
|
|
53449
53772
|
const fixturePath = resolveFixturePath(commandPath);
|
|
53450
53773
|
let rawFixture;
|
|
53451
53774
|
try {
|
|
53452
|
-
rawFixture = await
|
|
53775
|
+
rawFixture = await readFile27(fixturePath, {
|
|
53453
53776
|
encoding: "utf8"
|
|
53454
53777
|
});
|
|
53455
53778
|
} catch {
|
|
@@ -54530,12 +54853,12 @@ function createOverlayFileSystem(base) {
|
|
|
54530
54853
|
}
|
|
54531
54854
|
return base.readFile(filePath, "utf8");
|
|
54532
54855
|
};
|
|
54533
|
-
async function
|
|
54856
|
+
async function readFile46(filePath, encoding) {
|
|
54534
54857
|
const content = await readOverlayText(filePath);
|
|
54535
54858
|
return encoding ? content : Buffer.from(content);
|
|
54536
54859
|
}
|
|
54537
54860
|
const fs19 = {
|
|
54538
|
-
readFile:
|
|
54861
|
+
readFile: readFile46,
|
|
54539
54862
|
async writeFile(filePath, content) {
|
|
54540
54863
|
writes.set(filePath, stringifyFileContent(content));
|
|
54541
54864
|
},
|
|
@@ -58885,7 +59208,7 @@ var init_dashboard_loop_shared = __esm({
|
|
|
58885
59208
|
|
|
58886
59209
|
// src/cli/commands/pipeline.ts
|
|
58887
59210
|
import path83 from "node:path";
|
|
58888
|
-
import { readFile as
|
|
59211
|
+
import { readFile as readFile28, stat as stat18 } from "node:fs/promises";
|
|
58889
59212
|
import { fileURLToPath as fileURLToPath10 } from "node:url";
|
|
58890
59213
|
async function resolvePipelineCommandConfig(container) {
|
|
58891
59214
|
const [configDoc, pipelineYamlConfig] = await Promise.all([
|
|
@@ -59339,8 +59662,8 @@ async function loadPipelineTemplates() {
|
|
|
59339
59662
|
continue;
|
|
59340
59663
|
}
|
|
59341
59664
|
const [skillPlan, steps] = await Promise.all([
|
|
59342
|
-
|
|
59343
|
-
|
|
59665
|
+
readFile28(path83.join(templateRoot, "SKILL_plan.md"), "utf8"),
|
|
59666
|
+
readFile28(path83.join(templateRoot, "steps.yaml.mustache"), "utf8")
|
|
59344
59667
|
]);
|
|
59345
59668
|
pipelineTemplatesCache = { skillPlan, steps };
|
|
59346
59669
|
return pipelineTemplatesCache;
|
|
@@ -59668,11 +59991,11 @@ function registerPipelineCommand(program, container) {
|
|
|
59668
59991
|
if (typeof t.status === "string") return t.status === "done";
|
|
59669
59992
|
return Object.values(t.status).every((s) => s === "done");
|
|
59670
59993
|
}).length;
|
|
59671
|
-
const
|
|
59994
|
+
const readFile46 = container.fs.readFile.bind(container.fs);
|
|
59672
59995
|
const resolvedVars = await resolvePipelineVars(
|
|
59673
59996
|
plan.vars ?? {},
|
|
59674
59997
|
container.env.cwd,
|
|
59675
|
-
|
|
59998
|
+
readFile46
|
|
59676
59999
|
);
|
|
59677
60000
|
const resolvedSetup = plan.setup === null ? void 0 : plan.setup ?? steps.setup;
|
|
59678
60001
|
const resolvedTeardown = plan.teardown === null ? void 0 : plan.teardown ?? steps.teardown;
|
|
@@ -59694,7 +60017,7 @@ function registerPipelineCommand(program, container) {
|
|
|
59694
60017
|
if (opts.preview) {
|
|
59695
60018
|
if (resolvedSetup) {
|
|
59696
60019
|
const raw = interpolatePipelineVars(resolvedSetup.prompt, resolvedVars, "setup");
|
|
59697
|
-
const expanded = await resolveFileIncludes(raw, container.env.cwd,
|
|
60020
|
+
const expanded = await resolveFileIncludes(raw, container.env.cwd, readFile46);
|
|
59698
60021
|
resources.logger.resolved("setup", expanded);
|
|
59699
60022
|
}
|
|
59700
60023
|
for (const task of plan.tasks) {
|
|
@@ -59707,7 +60030,7 @@ function registerPipelineCommand(program, container) {
|
|
|
59707
60030
|
vars: resolvedVars
|
|
59708
60031
|
}),
|
|
59709
60032
|
container.env.cwd,
|
|
59710
|
-
|
|
60033
|
+
readFile46
|
|
59711
60034
|
);
|
|
59712
60035
|
resources.logger.resolved(`task: ${task.id} \u2014 ${task.title}`, expanded);
|
|
59713
60036
|
} else {
|
|
@@ -59720,7 +60043,7 @@ function registerPipelineCommand(program, container) {
|
|
|
59720
60043
|
vars: resolvedVars
|
|
59721
60044
|
}),
|
|
59722
60045
|
container.env.cwd,
|
|
59723
|
-
|
|
60046
|
+
readFile46
|
|
59724
60047
|
);
|
|
59725
60048
|
resources.logger.resolved(`task: ${task.id} / ${stepName}`, expanded);
|
|
59726
60049
|
}
|
|
@@ -59728,7 +60051,7 @@ function registerPipelineCommand(program, container) {
|
|
|
59728
60051
|
}
|
|
59729
60052
|
if (resolvedTeardown) {
|
|
59730
60053
|
const raw = interpolatePipelineVars(resolvedTeardown.prompt, resolvedVars, "teardown");
|
|
59731
|
-
const expanded = await resolveFileIncludes(raw, container.env.cwd,
|
|
60054
|
+
const expanded = await resolveFileIncludes(raw, container.env.cwd, readFile46);
|
|
59732
60055
|
resources.logger.resolved("teardown", expanded);
|
|
59733
60056
|
}
|
|
59734
60057
|
}
|
|
@@ -60483,7 +60806,7 @@ var init_ralph3 = __esm({
|
|
|
60483
60806
|
|
|
60484
60807
|
// src/cli/commands/experiment.ts
|
|
60485
60808
|
import path85 from "node:path";
|
|
60486
|
-
import { readFile as
|
|
60809
|
+
import { readFile as readFile29, stat as stat19 } from "node:fs/promises";
|
|
60487
60810
|
import { fileURLToPath as fileURLToPath11 } from "node:url";
|
|
60488
60811
|
function resolveExperimentPaths(scope, cwd, homeDir) {
|
|
60489
60812
|
const rootPath = scope === "global" ? path85.join(homeDir, ".poe-code", "experiments") : path85.join(cwd, ".poe-code", "experiments");
|
|
@@ -60531,8 +60854,8 @@ async function loadExperimentTemplates() {
|
|
|
60531
60854
|
continue;
|
|
60532
60855
|
}
|
|
60533
60856
|
const [skillPlan, runYaml] = await Promise.all([
|
|
60534
|
-
|
|
60535
|
-
|
|
60857
|
+
readFile29(path85.join(templateRoot, "SKILL_experiment.md"), "utf8"),
|
|
60858
|
+
readFile29(path85.join(templateRoot, "run.yaml.mustache"), "utf8")
|
|
60536
60859
|
]);
|
|
60537
60860
|
experimentTemplatesCache = { skillPlan, runYaml };
|
|
60538
60861
|
return experimentTemplatesCache;
|
|
@@ -76842,7 +77165,7 @@ var init_dump = __esm({
|
|
|
76842
77165
|
});
|
|
76843
77166
|
|
|
76844
77167
|
// packages/agent-script/src/snapshot/scheduler.ts
|
|
76845
|
-
import { mkdir as mkdir21, rename as rename8, writeFile as
|
|
77168
|
+
import { mkdir as mkdir21, rename as rename8, writeFile as writeFile24 } from "node:fs/promises";
|
|
76846
77169
|
import { dirname as dirname6 } from "node:path";
|
|
76847
77170
|
function createSnapshotScheduler(options) {
|
|
76848
77171
|
if (options.snapshotPath === void 0) {
|
|
@@ -76875,7 +77198,7 @@ function createSnapshotScheduler(options) {
|
|
|
76875
77198
|
async function writeSnapshotAtomically(snapshotPath, snapshot2) {
|
|
76876
77199
|
const temporaryPath = `${snapshotPath}.tmp`;
|
|
76877
77200
|
await mkdir21(dirname6(snapshotPath), { recursive: true });
|
|
76878
|
-
await
|
|
77201
|
+
await writeFile24(temporaryPath, JSON.stringify(snapshot2, null, 2));
|
|
76879
77202
|
await rename8(temporaryPath, snapshotPath);
|
|
76880
77203
|
}
|
|
76881
77204
|
var DEFAULT_SNAPSHOT_INTERVAL_MS;
|
|
@@ -79073,22 +79396,22 @@ function writeBlockSequence(state, level, object, compact) {
|
|
|
79073
79396
|
state.dump = _result || "[]";
|
|
79074
79397
|
}
|
|
79075
79398
|
function writeFlowMapping(state, level, object) {
|
|
79076
|
-
var _result = "", _tag = state.tag, objectKeyList = Object.keys(object), index, length, objectKey,
|
|
79399
|
+
var _result = "", _tag = state.tag, objectKeyList = Object.keys(object), index, length, objectKey, objectValue2, pairBuffer;
|
|
79077
79400
|
for (index = 0, length = objectKeyList.length; index < length; index += 1) {
|
|
79078
79401
|
pairBuffer = "";
|
|
79079
79402
|
if (_result !== "") pairBuffer += ", ";
|
|
79080
79403
|
if (state.condenseFlow) pairBuffer += '"';
|
|
79081
79404
|
objectKey = objectKeyList[index];
|
|
79082
|
-
|
|
79405
|
+
objectValue2 = object[objectKey];
|
|
79083
79406
|
if (state.replacer) {
|
|
79084
|
-
|
|
79407
|
+
objectValue2 = state.replacer.call(object, objectKey, objectValue2);
|
|
79085
79408
|
}
|
|
79086
79409
|
if (!writeNode(state, level, objectKey, false, false)) {
|
|
79087
79410
|
continue;
|
|
79088
79411
|
}
|
|
79089
79412
|
if (state.dump.length > 1024) pairBuffer += "? ";
|
|
79090
79413
|
pairBuffer += state.dump + (state.condenseFlow ? '"' : "") + ":" + (state.condenseFlow ? "" : " ");
|
|
79091
|
-
if (!writeNode(state, level,
|
|
79414
|
+
if (!writeNode(state, level, objectValue2, false, false)) {
|
|
79092
79415
|
continue;
|
|
79093
79416
|
}
|
|
79094
79417
|
pairBuffer += state.dump;
|
|
@@ -79098,7 +79421,7 @@ function writeFlowMapping(state, level, object) {
|
|
|
79098
79421
|
state.dump = "{" + _result + "}";
|
|
79099
79422
|
}
|
|
79100
79423
|
function writeBlockMapping(state, level, object, compact) {
|
|
79101
|
-
var _result = "", _tag = state.tag, objectKeyList = Object.keys(object), index, length, objectKey,
|
|
79424
|
+
var _result = "", _tag = state.tag, objectKeyList = Object.keys(object), index, length, objectKey, objectValue2, explicitPair, pairBuffer;
|
|
79102
79425
|
if (state.sortKeys === true) {
|
|
79103
79426
|
objectKeyList.sort();
|
|
79104
79427
|
} else if (typeof state.sortKeys === "function") {
|
|
@@ -79112,9 +79435,9 @@ function writeBlockMapping(state, level, object, compact) {
|
|
|
79112
79435
|
pairBuffer += generateNextLine(state, level);
|
|
79113
79436
|
}
|
|
79114
79437
|
objectKey = objectKeyList[index];
|
|
79115
|
-
|
|
79438
|
+
objectValue2 = object[objectKey];
|
|
79116
79439
|
if (state.replacer) {
|
|
79117
|
-
|
|
79440
|
+
objectValue2 = state.replacer.call(object, objectKey, objectValue2);
|
|
79118
79441
|
}
|
|
79119
79442
|
if (!writeNode(state, level + 1, objectKey, true, true, true)) {
|
|
79120
79443
|
continue;
|
|
@@ -79131,7 +79454,7 @@ function writeBlockMapping(state, level, object, compact) {
|
|
|
79131
79454
|
if (explicitPair) {
|
|
79132
79455
|
pairBuffer += generateNextLine(state, level);
|
|
79133
79456
|
}
|
|
79134
|
-
if (!writeNode(state, level + 1,
|
|
79457
|
+
if (!writeNode(state, level + 1, objectValue2, true, explicitPair)) {
|
|
79135
79458
|
continue;
|
|
79136
79459
|
}
|
|
79137
79460
|
if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
|
|
@@ -79835,7 +80158,7 @@ var init_frontmatter6 = __esm({
|
|
|
79835
80158
|
});
|
|
79836
80159
|
|
|
79837
80160
|
// packages/agent-script/src/runner/run-harness.ts
|
|
79838
|
-
import { readFile as
|
|
80161
|
+
import { readFile as readFile42 } from "node:fs/promises";
|
|
79839
80162
|
import { extname as extname2 } from "node:path";
|
|
79840
80163
|
var init_run_harness = __esm({
|
|
79841
80164
|
"packages/agent-script/src/runner/run-harness.ts"() {
|
|
@@ -80697,7 +81020,7 @@ var init_validate3 = __esm({
|
|
|
80697
81020
|
});
|
|
80698
81021
|
|
|
80699
81022
|
// packages/agent-harness/src/loader/run.ts
|
|
80700
|
-
import { mkdir as mkdir22, readFile as
|
|
81023
|
+
import { mkdir as mkdir22, readFile as readFile44, unlink as unlink15, writeFile as writeFile25 } from "node:fs/promises";
|
|
80701
81024
|
import os12 from "node:os";
|
|
80702
81025
|
import { dirname as dirname8, join as join8 } from "node:path";
|
|
80703
81026
|
async function runHarnessPair(mdPath, options) {
|
|
@@ -80884,7 +81207,7 @@ async function createHostCallReplay(snapshotPath) {
|
|
|
80884
81207
|
}
|
|
80885
81208
|
async function readHostCallRecords(storePath) {
|
|
80886
81209
|
try {
|
|
80887
|
-
const parsed = JSON.parse(await
|
|
81210
|
+
const parsed = JSON.parse(await readFile44(storePath, "utf8"));
|
|
80888
81211
|
return Array.isArray(parsed) ? parsed : [];
|
|
80889
81212
|
} catch (error2) {
|
|
80890
81213
|
if (hasErrorCode5(error2, "ENOENT")) {
|
|
@@ -80901,7 +81224,7 @@ async function writeHostCallRecords(storePath, records) {
|
|
|
80901
81224
|
return;
|
|
80902
81225
|
}
|
|
80903
81226
|
await mkdir22(dirname8(storePath), { recursive: true });
|
|
80904
|
-
await
|
|
81227
|
+
await writeFile25(storePath, serialized);
|
|
80905
81228
|
}
|
|
80906
81229
|
async function cleanupCompletedSnapshot(snapshotPath) {
|
|
80907
81230
|
await Promise.all([
|
|
@@ -80953,7 +81276,7 @@ function resolveSnapshotPath(mdPath, snapshotPath) {
|
|
|
80953
81276
|
}
|
|
80954
81277
|
async function readSnapshot(snapshotPath) {
|
|
80955
81278
|
try {
|
|
80956
|
-
return JSON.parse(await
|
|
81279
|
+
return JSON.parse(await readFile44(snapshotPath, "utf8"));
|
|
80957
81280
|
} catch (error2) {
|
|
80958
81281
|
if (hasErrorCode5(error2, "ENOENT")) {
|
|
80959
81282
|
return void 0;
|
|
@@ -80962,7 +81285,7 @@ async function readSnapshot(snapshotPath) {
|
|
|
80962
81285
|
}
|
|
80963
81286
|
}
|
|
80964
81287
|
async function readTextFile(path108) {
|
|
80965
|
-
const source = await
|
|
81288
|
+
const source = await readFile44(path108, "utf8");
|
|
80966
81289
|
return source.startsWith("\uFEFF") ? source.slice(1) : source;
|
|
80967
81290
|
}
|
|
80968
81291
|
function formatLintErrorMessage(diagnostics) {
|
|
@@ -81040,7 +81363,7 @@ var init_src36 = __esm({
|
|
|
81040
81363
|
|
|
81041
81364
|
// src/cli/commands/harness.ts
|
|
81042
81365
|
import path107 from "node:path";
|
|
81043
|
-
import { readFile as
|
|
81366
|
+
import { readFile as readFile45 } from "node:fs/promises";
|
|
81044
81367
|
function registerHarnessCommand(program, container) {
|
|
81045
81368
|
const harness = program.command("harness").description("Run and manage agent harness pairs.");
|
|
81046
81369
|
harness.command("run").description("Run a harness pair.").argument("[md-path]", "Path to the harness .md file").option("-y, --yes", "Accept defaults without prompting.").action(async (mdPath, options) => {
|
|
@@ -81087,8 +81410,8 @@ async function executeHarnessNew(program, container, kind, basename4, options) {
|
|
|
81087
81410
|
return;
|
|
81088
81411
|
}
|
|
81089
81412
|
const [mdSource, ajsSource] = await Promise.all([
|
|
81090
|
-
|
|
81091
|
-
|
|
81413
|
+
readFile45(template2.mdPath, "utf8"),
|
|
81414
|
+
readFile45(template2.ajsPath, "utf8")
|
|
81092
81415
|
]);
|
|
81093
81416
|
await container.fs.mkdir(resolvedDir, { recursive: true });
|
|
81094
81417
|
await Promise.all([
|
|
@@ -81360,7 +81683,7 @@ var init_package2 = __esm({
|
|
|
81360
81683
|
"package.json"() {
|
|
81361
81684
|
package_default2 = {
|
|
81362
81685
|
name: "poe-code",
|
|
81363
|
-
version: "3.0.
|
|
81686
|
+
version: "3.0.214",
|
|
81364
81687
|
description: "CLI tool to configure Poe API for developer workflows.",
|
|
81365
81688
|
type: "module",
|
|
81366
81689
|
main: "./dist/index.js",
|