@plainconceptsplatform/workflows 0.4.7 → 0.4.9

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.
@@ -162,16 +162,19 @@ async function preCommitHookUpdate(repositoryPath) {
162
162
  const compileLine = "node scripts/compile-agent-workflows.mjs";
163
163
  const stageLine = "git add -- .github/workflows/*.lock.yml";
164
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`;
165
+ const managedLines = `if git diff --cached --name-only -- .github | grep -q .; then\n ${compileLine}\n ${stageLine}\n ${actionLockLine}\nfi\n`;
166
166
  if (!await exists(hookPath)) {
167
167
  return { target, content: managedLines };
168
168
  }
169
169
  const content = await readFile(hookPath, "utf8");
170
170
  if (content.includes("compile-agent-workflows")) {
171
- if (content.includes(stageLine))
171
+ const legacyLines = `${compileLine}\n${stageLine}\n${actionLockLine}\n`;
172
+ if (content.includes(managedLines))
172
173
  return { target, content };
174
+ if (content.includes(legacyLines))
175
+ return { target, content: content.replace(legacyLines, managedLines) };
173
176
  const suffix = content.endsWith("\n") || content === "" ? "" : "\n";
174
- return { target, content: `${content}${suffix}${stageLine}\n${actionLockLine}\n` };
177
+ return { target, content: `${content}${suffix}${managedLines}` };
175
178
  }
176
179
  return { target, content: content.endsWith("\n") || content === ""
177
180
  ? `${content}${managedLines}`
@@ -253,20 +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\ngit add -- .github/workflows/*.lock.yml\n[ ! -f .github/actions/actions-lock.json ] || git add -- .github/actions/actions-lock.json\n");
256
+ .resolves.toBe("if git diff --cached --name-only -- .github | grep -q .; then\n node scripts/compile-agent-workflows.mjs\n git add -- .github/workflows/*.lock.yml\n [ ! -f .github/actions/actions-lock.json ] || git add -- .github/actions/actions-lock.json\nfi\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\ngit add -- .github/workflows/*.lock.yml\n[ ! -f .github/actions/actions-lock.json ] || git add -- .github/actions/actions-lock.json\n");
263
+ .resolves.toBe("pnpm lint\nif git diff --cached --name-only -- .github | grep -q .; then\n node scripts/compile-agent-workflows.mjs\n git add -- .github/workflows/*.lock.yml\n [ ! -f .github/actions/actions-lock.json ] || git add -- .github/actions/actions-lock.json\nfi\n");
264
264
  });
265
265
  it("upgrades an existing compiler hook to stage generated locks", async () => {
266
266
  const repositoryPath = await createDirectory({ ".husky/pre-commit": "node scripts/compile-agent-workflows.mjs\n" });
267
267
  await ensurePreCommitHook(repositoryPath);
268
268
  await expect(readFile(join(repositoryPath, ".husky", "pre-commit"), "utf8"))
269
- .resolves.toContain("git add -- .github/workflows/*.lock.yml");
269
+ .resolves.toContain("if git diff --cached --name-only -- .github | grep -q .; then");
270
270
  });
271
271
  it("leaves consumer files untouched when staged workflow compilation fails", async () => {
272
272
  const sourcePath = await createDirectory({
@@ -31,7 +31,7 @@ export function injectStackEnv(content, defaults) {
31
31
  export function generateOpencodeCi(baseContent, inspection) {
32
32
  let result = baseContent;
33
33
  if (inspection.stackHints.solutionFiles.length > 0) {
34
- const solutionPath = inspection.stackHints.solutionFiles[0];
34
+ const solutionPath = inspection.stackHints.solutionFiles[0].replaceAll("\\", "/");
35
35
  const nugetSteps = ` - name: Cache NuGet packages
36
36
  uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
37
37
  with:
@@ -123,6 +123,13 @@ describe("generateOpencodeCi", () => {
123
123
  expect(result).toContain("\n - name: Restore .NET dependencies\n");
124
124
  expect(result).not.toContain("\n - name: Restore .NET dependencies\n");
125
125
  });
126
+ it("uses POSIX separators for .NET restore commands", () => {
127
+ const result = generateOpencodeCi(OPENCODE_CI_MD, makeInspection({
128
+ solutionFiles: ["apps\\api\\Numa.slnx"],
129
+ }));
130
+ expect(result).toContain("dotnet restore apps/api/Numa.slnx");
131
+ expect(result).not.toContain("dotnet restore apps\\api\\Numa.slnx");
132
+ });
126
133
  it("adds the pinned OpenSpec CLI install step when openspec/ directory exists", () => {
127
134
  const result = generateOpencodeCi(OPENCODE_CI_MD, makeInspection({
128
135
  openSpec: true,
@@ -23,6 +23,7 @@ name: "Agent: Apply Review"
23
23
  # Router-only worker. The Work Router owns triggers, classification, and rung 1-2 checks.
24
24
  # This workflow receives the classified inputs and runs rung 3+.
25
25
  imports:
26
+ - github/gh-aw/.github/workflows/shared/opencode.md@v0.86.2
26
27
  - shared/platform-defaults.md
27
28
  - shared/opencode-ci.md
28
29
 
@@ -24,6 +24,7 @@ name: "Agent: Audit"
24
24
  # Shared: network policy only. This workflow owns its Safe Outputs and OpenCode configuration.
25
25
  # permissions, engine, model and runs-on cannot be shared , see shared/platform-defaults.md.
26
26
  imports:
27
+ - github/gh-aw/.github/workflows/shared/opencode.md@v0.86.2
27
28
  - shared/platform-defaults.md
28
29
  - shared/opencode-ci.md
29
30
 
@@ -25,6 +25,7 @@ description: |
25
25
  name: "Agent: Direct"
26
26
 
27
27
  imports:
28
+ - github/gh-aw/.github/workflows/shared/opencode.md@v0.86.2
28
29
  - shared/platform-defaults.md
29
30
  - shared/opencode-ci.md
30
31
 
@@ -28,6 +28,7 @@ name: "Agent: Implement Issue"
28
28
  # Shared: network policy only. This workflow owns its Safe Outputs and OpenCode configuration.
29
29
  # permissions, engine, model and runs-on cannot be shared , see shared/platform-defaults.md.
30
30
  imports:
31
+ - github/gh-aw/.github/workflows/shared/opencode.md@v0.86.2
31
32
  - shared/platform-defaults.md
32
33
  - shared/opencode-ci.md
33
34
 
@@ -25,6 +25,7 @@ name: "Agent: Merge Gate"
25
25
  # Router-only worker. The Work Router owns triggers, classification, and rung 1-2 checks.
26
26
  # This workflow receives the classified inputs and runs rung 3+.
27
27
  imports:
28
+ - github/gh-aw/.github/workflows/shared/opencode.md@v0.86.2
28
29
  - shared/platform-defaults.md
29
30
  - shared/opencode-ci.md
30
31
 
@@ -37,6 +37,7 @@ name: "Agent: Propose Feature"
37
37
  # Shared: network policy only. This workflow owns its Safe Outputs and OpenCode configuration.
38
38
  # permissions, engine, model and runs-on cannot be shared, see shared/platform-defaults.md.
39
39
  imports:
40
+ - github/gh-aw/.github/workflows/shared/opencode.md@v0.86.2
40
41
  - shared/platform-defaults.md
41
42
  - shared/opencode-ci.md
42
43
 
@@ -33,6 +33,7 @@ description: |
33
33
  name: "Agent: Refine Issue"
34
34
 
35
35
  imports:
36
+ - github/gh-aw/.github/workflows/shared/opencode.md@v0.86.2
36
37
  - shared/platform-defaults.md
37
38
  - shared/opencode-ci.md
38
39
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plainconceptsplatform/workflows",
3
- "version": "0.4.7",
3
+ "version": "0.4.9",
4
4
  "description": "Install and update Platform GitHub agentic workflows.",
5
5
  "keywords": [
6
6
  "github-actions",