@plainconceptsplatform/workflows 0.4.6 → 0.4.7

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.
@@ -160,15 +160,22 @@ async function preCommitHookUpdate(repositoryPath) {
160
160
  const target = ".husky/pre-commit";
161
161
  const hookPath = join(repositoryPath, target);
162
162
  const compileLine = "node scripts/compile-agent-workflows.mjs";
163
+ const stageLine = "git add -- .github/workflows/*.lock.yml";
164
+ const actionLockLine = "[ ! -f .github/actions/actions-lock.json ] || git add -- .github/actions/actions-lock.json";
165
+ const managedLines = `${compileLine}\n${stageLine}\n${actionLockLine}\n`;
163
166
  if (!await exists(hookPath)) {
164
- return { target, content: `${compileLine}\n` };
167
+ return { target, content: managedLines };
165
168
  }
166
169
  const content = await readFile(hookPath, "utf8");
167
- if (content.includes("compile-agent-workflows"))
168
- return { target, content };
170
+ if (content.includes("compile-agent-workflows")) {
171
+ if (content.includes(stageLine))
172
+ return { target, content };
173
+ const suffix = content.endsWith("\n") || content === "" ? "" : "\n";
174
+ return { target, content: `${content}${suffix}${stageLine}\n${actionLockLine}\n` };
175
+ }
169
176
  return { target, content: content.endsWith("\n") || content === ""
170
- ? `${content}${compileLine}\n`
171
- : `${content}\n${compileLine}\n` };
177
+ ? `${content}${managedLines}`
178
+ : `${content}\n${managedLines}` };
172
179
  }
173
180
  export async function runCompileIfAvailable(repositoryPath) {
174
181
  const script = join(repositoryPath, "scripts", "compile-agent-workflows.mjs");
@@ -253,14 +253,20 @@ describe("catalog installation", () => {
253
253
  const repositoryPath = await createDirectory({});
254
254
  await ensurePreCommitHook(repositoryPath);
255
255
  await expect(readFile(join(repositoryPath, ".husky", "pre-commit"), "utf8"))
256
- .resolves.toBe("node scripts/compile-agent-workflows.mjs\n");
256
+ .resolves.toBe("node scripts/compile-agent-workflows.mjs\ngit add -- .github/workflows/*.lock.yml\n[ ! -f .github/actions/actions-lock.json ] || git add -- .github/actions/actions-lock.json\n");
257
257
  });
258
258
  it("keeps existing pre-commit commands and appends the compiler once", async () => {
259
259
  const repositoryPath = await createDirectory({ ".husky/pre-commit": "pnpm lint\n" });
260
260
  await ensurePreCommitHook(repositoryPath);
261
261
  await ensurePreCommitHook(repositoryPath);
262
262
  await expect(readFile(join(repositoryPath, ".husky", "pre-commit"), "utf8"))
263
- .resolves.toBe("pnpm lint\nnode scripts/compile-agent-workflows.mjs\n");
263
+ .resolves.toBe("pnpm lint\nnode scripts/compile-agent-workflows.mjs\ngit add -- .github/workflows/*.lock.yml\n[ ! -f .github/actions/actions-lock.json ] || git add -- .github/actions/actions-lock.json\n");
264
+ });
265
+ it("upgrades an existing compiler hook to stage generated locks", async () => {
266
+ const repositoryPath = await createDirectory({ ".husky/pre-commit": "node scripts/compile-agent-workflows.mjs\n" });
267
+ await ensurePreCommitHook(repositoryPath);
268
+ await expect(readFile(join(repositoryPath, ".husky", "pre-commit"), "utf8"))
269
+ .resolves.toContain("git add -- .github/workflows/*.lock.yml");
264
270
  });
265
271
  it("leaves consumer files untouched when staged workflow compilation fails", async () => {
266
272
  const sourcePath = await createDirectory({
@@ -37,7 +37,8 @@ for (const file of readdirSync(workflowDirectory)) {
37
37
  const patched = content
38
38
  .replaceAll("opencode run --print-logs --log-level DEBUG", "opencode run --log-level ERROR")
39
39
  .replaceAll("opencode run --print-logs --log-level ERROR", "opencode run --log-level ERROR")
40
- .replaceAll("--log-level DEBUG", "--log-level ERROR");
40
+ .replaceAll("--log-level DEBUG", "--log-level ERROR")
41
+ .replace(/GH_AW_INFO_MODEL_COSTS: '[^']*'/g, "GH_AW_INFO_MODEL_COSTS: '{\"providers\":{}}'");
41
42
 
42
43
  if (patched !== content) writeFileSync(path, patched);
43
44
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plainconceptsplatform/workflows",
3
- "version": "0.4.6",
3
+ "version": "0.4.7",
4
4
  "description": "Install and update Platform GitHub agentic workflows.",
5
5
  "keywords": [
6
6
  "github-actions",