@plainconceptsplatform/workflows 0.4.6 → 0.4.8
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:
|
|
167
|
+
return { target, content: managedLines };
|
|
165
168
|
}
|
|
166
169
|
const content = await readFile(hookPath, "utf8");
|
|
167
|
-
if (content.includes("compile-agent-workflows"))
|
|
168
|
-
|
|
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}${
|
|
171
|
-
: `${content}\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({
|
package/dist/stack-defaults.js
CHANGED
|
@@ -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,
|
|
@@ -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
|
}
|