poe-code 3.0.142 → 3.0.143
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
CHANGED
|
@@ -14010,7 +14010,7 @@ function readAutomationFields(frontmatter, fileName) {
|
|
|
14010
14010
|
const agent2 = readOptionalString(frontmatter.agent, "agent", fileName);
|
|
14011
14011
|
const mcp = readOptionalMcp(frontmatter.mcp, fileName);
|
|
14012
14012
|
const allow = readOptionalStringArray(frontmatter.allow, "allow", fileName);
|
|
14013
|
-
const prefix =
|
|
14013
|
+
const prefix = readOptionalPrefix(frontmatter.prefix, fileName);
|
|
14014
14014
|
return {
|
|
14015
14015
|
...label === void 0 ? {} : { label },
|
|
14016
14016
|
...source === void 0 ? {} : { source },
|
|
@@ -14027,13 +14027,38 @@ function readOptionalString(value, field, fileName) {
|
|
|
14027
14027
|
if (typeof value !== "string") {
|
|
14028
14028
|
throw new Error(`Automation "${fileName}" has invalid "${field}" frontmatter. Expected a string.`);
|
|
14029
14029
|
}
|
|
14030
|
-
|
|
14030
|
+
return value;
|
|
14031
|
+
}
|
|
14032
|
+
function readOptionalPrefix(value, fileName) {
|
|
14033
|
+
if (value === void 0) {
|
|
14034
|
+
return void 0;
|
|
14035
|
+
}
|
|
14036
|
+
if (typeof value === "string") {
|
|
14037
|
+
validatePrefixValue(value, fileName, "Expected a non-empty string without surrounding whitespace.");
|
|
14038
|
+
return value;
|
|
14039
|
+
}
|
|
14040
|
+
if (!Array.isArray(value) || value.some((item) => typeof item !== "string")) {
|
|
14031
14041
|
throw new Error(
|
|
14032
|
-
`Automation "${fileName}" has invalid "
|
|
14042
|
+
`Automation "${fileName}" has invalid "prefix" frontmatter. Expected a string or an array of strings.`
|
|
14033
14043
|
);
|
|
14034
14044
|
}
|
|
14045
|
+
if (value.length === 0) {
|
|
14046
|
+
throw new Error(
|
|
14047
|
+
`Automation "${fileName}" has invalid "prefix" frontmatter. Expected at least one string.`
|
|
14048
|
+
);
|
|
14049
|
+
}
|
|
14050
|
+
for (const item of value) {
|
|
14051
|
+
validatePrefixValue(item, fileName, "Expected non-empty strings without surrounding whitespace.");
|
|
14052
|
+
}
|
|
14035
14053
|
return value;
|
|
14036
14054
|
}
|
|
14055
|
+
function validatePrefixValue(value, fileName, expectation) {
|
|
14056
|
+
if (value.length === 0 || value.trim() !== value) {
|
|
14057
|
+
throw new Error(
|
|
14058
|
+
`Automation "${fileName}" has invalid "prefix" frontmatter. ${expectation}`
|
|
14059
|
+
);
|
|
14060
|
+
}
|
|
14061
|
+
}
|
|
14037
14062
|
function readOptionalStringArray(value, field, fileName) {
|
|
14038
14063
|
if (value === void 0) {
|
|
14039
14064
|
return void 0;
|
|
@@ -14606,11 +14631,13 @@ function requireCommentPrefix(automation, commentBody) {
|
|
|
14606
14631
|
`Automation "${automation.name}" requires COMMENT_BODY when "prefix" frontmatter is set.`
|
|
14607
14632
|
);
|
|
14608
14633
|
}
|
|
14609
|
-
|
|
14634
|
+
const prefixes = Array.isArray(automation.prefix) ? automation.prefix : [automation.prefix];
|
|
14635
|
+
if (prefixes.some((prefix) => commentBody.startsWith(prefix))) {
|
|
14610
14636
|
return;
|
|
14611
14637
|
}
|
|
14638
|
+
const expectedPrefixes = prefixes.length === 1 ? `"${prefixes[0]}"` : `one of: ${prefixes.map((prefix) => `"${prefix}"`).join(", ")}`;
|
|
14612
14639
|
throw new UserError(
|
|
14613
|
-
`Automation "${automation.name}" requires COMMENT_BODY to start with
|
|
14640
|
+
`Automation "${automation.name}" requires COMMENT_BODY to start with ${expectedPrefixes}.`
|
|
14614
14641
|
);
|
|
14615
14642
|
}
|
|
14616
14643
|
var init_require_comment_prefix = __esm({
|
|
@@ -14759,7 +14786,7 @@ function buildCommandEnv(env, secrets) {
|
|
|
14759
14786
|
"PR_TITLE",
|
|
14760
14787
|
"PR_AUTHOR"
|
|
14761
14788
|
]) {
|
|
14762
|
-
const value = env
|
|
14789
|
+
const value = getOptionalEnvValue(env, key);
|
|
14763
14790
|
if (value !== void 0) {
|
|
14764
14791
|
values[key] = value;
|
|
14765
14792
|
}
|
|
@@ -14767,25 +14794,25 @@ function buildCommandEnv(env, secrets) {
|
|
|
14767
14794
|
return values;
|
|
14768
14795
|
}
|
|
14769
14796
|
function buildTemplateContext(env) {
|
|
14770
|
-
const repo = env
|
|
14771
|
-
const issueNumber = env
|
|
14772
|
-
const prNumber = env
|
|
14797
|
+
const repo = getOptionalEnvValue(env, "GITHUB_REPOSITORY");
|
|
14798
|
+
const issueNumber = getOptionalEnvValue(env, "ISSUE_NUMBER");
|
|
14799
|
+
const prNumber = getOptionalEnvValue(env, "PR_NUMBER");
|
|
14773
14800
|
return {
|
|
14774
14801
|
...repo === void 0 ? {} : { repo },
|
|
14775
14802
|
...buildUrl(repo, issueNumber, prNumber) === void 0 ? {} : { url: buildUrl(repo, issueNumber, prNumber) },
|
|
14776
14803
|
issue: pruneUndefined({
|
|
14777
14804
|
number: issueNumber,
|
|
14778
|
-
title: env
|
|
14779
|
-
body: env
|
|
14805
|
+
title: getOptionalEnvValue(env, "ISSUE_TITLE"),
|
|
14806
|
+
body: getOptionalEnvValue(env, "ISSUE_BODY")
|
|
14780
14807
|
}),
|
|
14781
14808
|
comment: pruneUndefined({
|
|
14782
|
-
author: env
|
|
14783
|
-
body: env
|
|
14809
|
+
author: getOptionalEnvValue(env, "COMMENT_AUTHOR"),
|
|
14810
|
+
body: getOptionalEnvValue(env, "COMMENT_BODY")
|
|
14784
14811
|
}),
|
|
14785
14812
|
pr: pruneUndefined({
|
|
14786
14813
|
number: prNumber,
|
|
14787
|
-
title: env
|
|
14788
|
-
author: env
|
|
14814
|
+
title: getOptionalEnvValue(env, "PR_TITLE"),
|
|
14815
|
+
author: getOptionalEnvValue(env, "PR_AUTHOR")
|
|
14789
14816
|
})
|
|
14790
14817
|
};
|
|
14791
14818
|
}
|
|
@@ -14793,14 +14820,21 @@ function buildUrl(repo, issueNumber, prNumber) {
|
|
|
14793
14820
|
if (repo === void 0) {
|
|
14794
14821
|
return void 0;
|
|
14795
14822
|
}
|
|
14796
|
-
if (issueNumber !== void 0) {
|
|
14797
|
-
return `https://github.com/${repo}/issues/${issueNumber}`;
|
|
14798
|
-
}
|
|
14799
14823
|
if (prNumber !== void 0) {
|
|
14800
14824
|
return `https://github.com/${repo}/pull/${prNumber}`;
|
|
14801
14825
|
}
|
|
14826
|
+
if (issueNumber !== void 0) {
|
|
14827
|
+
return `https://github.com/${repo}/issues/${issueNumber}`;
|
|
14828
|
+
}
|
|
14802
14829
|
return void 0;
|
|
14803
14830
|
}
|
|
14831
|
+
function getOptionalEnvValue(env, key) {
|
|
14832
|
+
const value = env.get(key);
|
|
14833
|
+
if (value === void 0 || value === "") {
|
|
14834
|
+
return void 0;
|
|
14835
|
+
}
|
|
14836
|
+
return value;
|
|
14837
|
+
}
|
|
14804
14838
|
function pruneUndefined(record) {
|
|
14805
14839
|
return Object.fromEntries(
|
|
14806
14840
|
Object.entries(record).filter((entry) => entry[1] !== void 0)
|
|
@@ -28091,7 +28125,7 @@ var init_package = __esm({
|
|
|
28091
28125
|
"package.json"() {
|
|
28092
28126
|
package_default = {
|
|
28093
28127
|
name: "poe-code",
|
|
28094
|
-
version: "3.0.
|
|
28128
|
+
version: "3.0.143",
|
|
28095
28129
|
description: "CLI tool to configure Poe API for developer workflows.",
|
|
28096
28130
|
type: "module",
|
|
28097
28131
|
main: "./dist/index.js",
|