@plainconceptsplatform/workflows 0.4.5 → 0.4.6

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.
@@ -77,9 +77,12 @@ async function preserveConsumerWorkerEnv(repositoryPath, files) {
77
77
  }
78
78
  function mergeWorkerEnv(packageContent, consumerContent) {
79
79
  const consumerEnv = workerEnvValues(consumerContent);
80
- if (consumerEnv.size === 0)
81
- return packageContent;
82
- return packageContent.replace(/^ ([A-Z][A-Z0-9_]*): .+$/gm, (line, key) => consumerEnv.has(key) ? ` ${key}: ${consumerEnv.get(key)}` : line);
80
+ let result = packageContent.replace(/^ ([A-Z][A-Z0-9_]*): .+$/gm, (line, key) => consumerEnv.has(key) ? ` ${key}: ${consumerEnv.get(key)}` : line);
81
+ const endpoint = engineEndpoint(consumerContent);
82
+ if (endpoint !== undefined) {
83
+ result = result.replace(/^ OPENAI_BASE_URL: .+$/m, ` OPENAI_BASE_URL: ${endpoint}`);
84
+ }
85
+ return result;
83
86
  }
84
87
  function workerEnvValues(content) {
85
88
  const frontmatter = /^---\r?\n([\s\S]*?)\r?\n---/m.exec(content)?.[1];
@@ -94,6 +97,9 @@ function workerEnvValues(content) {
94
97
  }
95
98
  return values;
96
99
  }
100
+ function engineEndpoint(content) {
101
+ return /^ OPENAI_BASE_URL: (.+)$/m.exec(content)?.[1];
102
+ }
97
103
  function transformOpencodeFiles(files, inspection) {
98
104
  const result = new Map(files);
99
105
  for (const [key, content] of result) {
@@ -289,15 +289,15 @@ describe("catalog installation", () => {
289
289
  it("preserves consumer-specific worker environment values during a forced update", async () => {
290
290
  const sourcePath = await createDirectory({
291
291
  "actions/check/action.yml": "name: Check\n",
292
- "workflows/agent-check.md": "---\nenv:\n VERIFY_COMMANDS: \"package verify\"\n REPO_RULES: \"package rules\"\n OPENAI_BASE_URL: https://forge.plainconcepts.com/v1\n---\n",
292
+ "workflows/agent-check.md": "---\nenv:\n VERIFY_COMMANDS: \"package verify\"\n REPO_RULES: \"package rules\"\n---\nengine:\n env:\n OPENAI_BASE_URL: https://forge.plainconcepts.com/v1\n",
293
293
  "scripts/compile-agent-workflows.mjs": "compile\n",
294
294
  "templates/opencode/opencode.ci.json": "{}\n",
295
295
  });
296
296
  const repositoryPath = await createDirectory({
297
- ".github/workflows/agent-check.md": "---\nenv:\n VERIFY_COMMANDS: \"consumer verify\"\n REPO_RULES: \"consumer rules\"\n OPENAI_BASE_URL: https://consumer.example/v1\n---\n",
297
+ ".github/workflows/agent-check.md": "---\nenv:\n VERIFY_COMMANDS: \"consumer verify\"\n REPO_RULES: \"consumer rules\"\n---\nengine:\n env:\n OPENAI_BASE_URL: https://consumer.example/v1\n",
298
298
  });
299
299
  await installCatalog(repositoryPath, { force: true, sourcePath });
300
- await expect(readFile(join(repositoryPath, ".github/workflows/agent-check.md"), "utf8")).resolves.toContain(" REPO_RULES: \"consumer rules\"\n OPENAI_BASE_URL: https://consumer.example/v1\n");
300
+ await expect(readFile(join(repositoryPath, ".github/workflows/agent-check.md"), "utf8")).resolves.toContain(" REPO_RULES: \"consumer rules\"\n---\nengine:\n env:\n OPENAI_BASE_URL: https://consumer.example/v1\n");
301
301
  });
302
302
  it("applies staged generated locks with managed sources", async () => {
303
303
  const sourcePath = await createDirectory({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plainconceptsplatform/workflows",
3
- "version": "0.4.5",
3
+ "version": "0.4.6",
4
4
  "description": "Install and update Platform GitHub agentic workflows.",
5
5
  "keywords": [
6
6
  "github-actions",