poe-code 3.0.339 → 3.0.340

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.
Files changed (25) hide show
  1. package/dist/index.js +69 -16
  2. package/dist/index.js.map +3 -3
  3. package/dist/metafile.json +1 -1
  4. package/dist/workflow-templates/fix-vulnerabilities.ejected.yml +4 -3
  5. package/dist/workflow-templates/github-issue-comment-created.ejected.yml +8 -6
  6. package/dist/workflow-templates/github-issue-opened.ejected.yml +8 -6
  7. package/dist/workflow-templates/github-pull-request-comment-created.ejected.yml +8 -6
  8. package/dist/workflow-templates/github-pull-request-opened.ejected.yml +8 -6
  9. package/dist/workflow-templates/github-pull-request-synchronized.ejected.yml +8 -6
  10. package/dist/workflow-templates/update-dependencies.ejected.yml +4 -3
  11. package/dist/workflow-templates/update-documentation.ejected.yml +4 -3
  12. package/package.json +1 -1
  13. package/packages/github-workflows/dist/commands.js +4 -2
  14. package/packages/github-workflows/dist/discover.d.ts +1 -0
  15. package/packages/github-workflows/dist/discover.js +33 -4
  16. package/packages/github-workflows/dist/exec/trufflehog-pr-scan.js +26 -6
  17. package/packages/github-workflows/dist/preflight.js +1 -1
  18. package/packages/github-workflows/dist/workflow-templates/fix-vulnerabilities.ejected.yml +4 -3
  19. package/packages/github-workflows/dist/workflow-templates/github-issue-comment-created.ejected.yml +8 -6
  20. package/packages/github-workflows/dist/workflow-templates/github-issue-opened.ejected.yml +8 -6
  21. package/packages/github-workflows/dist/workflow-templates/github-pull-request-comment-created.ejected.yml +8 -6
  22. package/packages/github-workflows/dist/workflow-templates/github-pull-request-opened.ejected.yml +8 -6
  23. package/packages/github-workflows/dist/workflow-templates/github-pull-request-synchronized.ejected.yml +8 -6
  24. package/packages/github-workflows/dist/workflow-templates/update-dependencies.ejected.yml +4 -3
  25. package/packages/github-workflows/dist/workflow-templates/update-documentation.ejected.yml +4 -3
package/dist/index.js CHANGED
@@ -79518,7 +79518,7 @@ async function readAutomation(dir, fileName, baseName, baseDirs) {
79518
79518
  path: baseDir
79519
79519
  })),
79520
79520
  {
79521
- source: "defaults",
79521
+ source: DEFAULTS_SOURCE,
79522
79522
  data: {
79523
79523
  agent: "codex"
79524
79524
  }
@@ -79529,11 +79529,23 @@ async function readAutomation(dir, fileName, baseName, baseDirs) {
79529
79529
  }
79530
79530
  );
79531
79531
  const name = stripPrefix(fileName.slice(0, -3));
79532
- return {
79532
+ const automation = {
79533
79533
  name,
79534
79534
  prompt: readPrompt(getOwnEntry32(resolved.data, "prompt"), fileName),
79535
79535
  ...readAutomationFields(resolved.data, fileName)
79536
79536
  };
79537
+ Object.defineProperty(automation, AGENT_SOURCE_PROPERTY, {
79538
+ configurable: true,
79539
+ enumerable: false,
79540
+ value: resolved.sources.agent
79541
+ });
79542
+ return automation;
79543
+ }
79544
+ function usesDefaultAgent(automation) {
79545
+ return getInternalAgentSource(automation) === DEFAULTS_SOURCE;
79546
+ }
79547
+ function getInternalAgentSource(automation) {
79548
+ return automation[AGENT_SOURCE_PROPERTY];
79537
79549
  }
79538
79550
  function readPrompt(value, fileName) {
79539
79551
  if (typeof value === "string") {
@@ -79546,8 +79558,8 @@ function readPrompt(value, fileName) {
79546
79558
  }
79547
79559
  function readAutomationFields(frontmatter, fileName) {
79548
79560
  const label = readOptionalString3(getOwnEntry32(frontmatter, "label"), "label", fileName);
79549
- const source = readOptionalString3(getOwnEntry32(frontmatter, "source"), "source", fileName);
79550
- const agent3 = readOptionalString3(getOwnEntry32(frontmatter, "agent"), "agent", fileName);
79561
+ const source = readOptionalNonBlankString(getOwnEntry32(frontmatter, "source"), "source", fileName);
79562
+ const agent3 = readOptionalNonBlankString(getOwnEntry32(frontmatter, "agent"), "agent", fileName);
79551
79563
  const mcp = readOptionalMcp(getOwnEntry32(frontmatter, "mcp"), fileName);
79552
79564
  const allow = readOptionalStringArray2(getOwnEntry32(frontmatter, "allow"), "allow", fileName);
79553
79565
  const prefix = readOptionalPrefix(getOwnEntry32(frontmatter, "prefix"), fileName);
@@ -79569,6 +79581,20 @@ function readOptionalString3(value, field, fileName) {
79569
79581
  }
79570
79582
  return value;
79571
79583
  }
79584
+ function readOptionalNonBlankString(value, field, fileName) {
79585
+ if (value === void 0) {
79586
+ return void 0;
79587
+ }
79588
+ if (typeof value !== "string") {
79589
+ throw new Error(`Automation "${fileName}" has invalid "${field}" frontmatter. Expected a string.`);
79590
+ }
79591
+ if (value.trim().length === 0) {
79592
+ throw new Error(
79593
+ `Automation "${fileName}" has invalid "${field}" frontmatter. Expected a non-empty string.`
79594
+ );
79595
+ }
79596
+ return value;
79597
+ }
79572
79598
  function readOptionalPrefix(value, fileName) {
79573
79599
  if (value === void 0) {
79574
79600
  return void 0;
@@ -79642,6 +79668,11 @@ function readOptionalMcp(value, fileName) {
79642
79668
  `Automation "${fileName}" has invalid "mcp.${serverName}.command" frontmatter. Expected a string.`
79643
79669
  );
79644
79670
  }
79671
+ if (command.trim().length === 0) {
79672
+ throw new Error(
79673
+ `Automation "${fileName}" has invalid "mcp.${serverName}.command" frontmatter. Expected a non-empty string.`
79674
+ );
79675
+ }
79645
79676
  const args = getOwnEntry32(serverValue, "args");
79646
79677
  if (args !== void 0 && (!Array.isArray(args) || args.some((item) => typeof item !== "string"))) {
79647
79678
  throw new Error(
@@ -79688,12 +79719,14 @@ function isStringRecord(value) {
79688
79719
  function stripPrefix(name) {
79689
79720
  return name.startsWith(POE_CODE_PREFIX) ? name.slice(POE_CODE_PREFIX.length) : name;
79690
79721
  }
79691
- var VALID_AUTHOR_ASSOCIATIONS, POE_CODE_PREFIX;
79722
+ var DEFAULTS_SOURCE, AGENT_SOURCE_PROPERTY, VALID_AUTHOR_ASSOCIATIONS, POE_CODE_PREFIX;
79692
79723
  var init_discover2 = __esm({
79693
79724
  "packages/github-workflows/src/discover.ts"() {
79694
79725
  "use strict";
79695
79726
  init_src5();
79696
79727
  init_errors6();
79728
+ DEFAULTS_SOURCE = "defaults";
79729
+ AGENT_SOURCE_PROPERTY = "__poeCodeAgentSource";
79697
79730
  VALID_AUTHOR_ASSOCIATIONS = /* @__PURE__ */ new Set([
79698
79731
  "COLLABORATOR",
79699
79732
  "CONTRIBUTOR",
@@ -79821,6 +79854,7 @@ function uniqueTruffleHogFindings(findings) {
79821
79854
  return [...unique4.values()];
79822
79855
  }
79823
79856
  function renderTruffleHogFindingsTable(findings, options) {
79857
+ assertPositiveInteger(options.maxFindings, "maxFindings");
79824
79858
  const uniqueFindings = uniqueTruffleHogFindings(findings);
79825
79859
  const rows = [
79826
79860
  "| Detector | Location | Verification |",
@@ -79895,7 +79929,7 @@ async function scanForSecrets(env, cwd, runner, fs29) {
79895
79929
  async function reportAdvisoryResult(env, runner, fs29) {
79896
79930
  const githubToken = requireEnv(env, "GH_TOKEN");
79897
79931
  const headSha = requireEnv(env, "HEAD_SHA");
79898
- const maxFindings = numberEnv(env, "MAX_FINDINGS");
79932
+ const maxFindings = positiveDecimalIntegerEnv(env, "MAX_FINDINGS");
79899
79933
  const prNumber = requireEnv(env, "PR_NUMBER");
79900
79934
  const repository = requireEnv(env, "REPOSITORY");
79901
79935
  const resultsFile = env.get("TRUFFLEHOG_RESULTS_FILE") ?? DEFAULT_RESULTS_FILE;
@@ -80076,12 +80110,31 @@ function requireEnv(env, name) {
80076
80110
  }
80077
80111
  return value;
80078
80112
  }
80079
- function numberEnv(env, name) {
80080
- const value = Number(requireEnv(env, name));
80081
- if (!Number.isFinite(value)) {
80082
- throw new UserError(`${name} must be a number.`);
80113
+ function positiveDecimalIntegerEnv(env, name) {
80114
+ const parsed = parsePositiveDecimalInteger(requireEnv(env, name));
80115
+ if (parsed === void 0) {
80116
+ throw new UserError(`${name} must be a positive integer.`);
80117
+ }
80118
+ return parsed;
80119
+ }
80120
+ function parsePositiveDecimalInteger(value) {
80121
+ let parsed = 0;
80122
+ for (const char of value) {
80123
+ const digit = char.charCodeAt(0) - "0".charCodeAt(0);
80124
+ if (digit < 0 || digit > 9) {
80125
+ return void 0;
80126
+ }
80127
+ parsed = parsed * 10 + digit;
80128
+ if (!Number.isSafeInteger(parsed)) {
80129
+ return void 0;
80130
+ }
80131
+ }
80132
+ return parsed > 0 ? parsed : void 0;
80133
+ }
80134
+ function assertPositiveInteger(value, label) {
80135
+ if (!Number.isInteger(value) || value <= 0) {
80136
+ throw new Error(`${label} must be a positive integer.`);
80083
80137
  }
80084
- return value;
80085
80138
  }
80086
80139
  function parseJsonObject(value) {
80087
80140
  try {
@@ -80156,7 +80209,7 @@ function runPreflightChecks(context) {
80156
80209
  }
80157
80210
  function checkRequiredEnvVar(env, key2) {
80158
80211
  const value = env.get(key2);
80159
- if (value === void 0 || value === "") {
80212
+ if (value === void 0 || value.trim() === "") {
80160
80213
  throw new UserError(`Missing required environment variable: ${key2}`);
80161
80214
  }
80162
80215
  }
@@ -80973,7 +81026,7 @@ var init_commands2 = __esm({
80973
81026
  await discoverAutomations(await resolveBuiltInPromptsDir(), ...projectPromptDirs(cwd))
80974
81027
  );
80975
81028
  const automation = await loadNamedAutomation(name, cwd);
80976
- const agent3 = automation.agent ?? params.agent ?? "codex";
81029
+ const agent3 = params.agent !== void 0 && usesDefaultAgent(automation) ? params.agent : automation.agent ?? params.agent ?? "codex";
80977
81030
  const variables = await loadVariables(await resolveBuiltInAssetsDir(), projectGitHubWorkflowsDir(cwd));
80978
81031
  const sharedTemplateContext = { ...variables, ...buildTemplateContext5(env) };
80979
81032
  if (automation.source === void 0) {
@@ -85752,7 +85805,7 @@ async function* runMatrix(opts) {
85752
85805
  const source = await openSource(opts.sourceDir);
85753
85806
  const evalIds = opts.evalIds ?? await listEvals(source);
85754
85807
  const repeats = opts.repeats ?? defaultRepeats;
85755
- assertPositiveInteger("repeats", repeats);
85808
+ assertPositiveInteger2("repeats", repeats);
85756
85809
  const matrixDir = path135.join(opts.outDir ?? "runs", matrixId);
85757
85810
  await ensureRunArtifactDirectory(source.rootDir, matrixDir);
85758
85811
  for (const evalId of evalIds) {
@@ -85902,7 +85955,7 @@ function assertNonEmpty(name, values) {
85902
85955
  throw new Error(`Eval matrix ${name} must be a non-empty array`);
85903
85956
  }
85904
85957
  }
85905
- function assertPositiveInteger(name, value) {
85958
+ function assertPositiveInteger2(name, value) {
85906
85959
  if (!Number.isInteger(value) || value < 1) {
85907
85960
  throw new Error(`Eval matrix ${name} must be a positive integer`);
85908
85961
  }
@@ -138162,7 +138215,7 @@ var init_package2 = __esm({
138162
138215
  "package.json"() {
138163
138216
  package_default2 = {
138164
138217
  name: "poe-code",
138165
- version: "3.0.339",
138218
+ version: "3.0.340",
138166
138219
  description: "CLI tool to configure Poe API for developer workflows.",
138167
138220
  type: "module",
138168
138221
  main: "./dist/index.js",