forgedock 1.1.4 → 1.1.5
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.
- package/bin/hooks/pre-tool-use.mjs +32 -0
- package/package.json +1 -1
|
@@ -188,6 +188,10 @@ async function isForgeDockManagedCwd() {
|
|
|
188
188
|
/**
|
|
189
189
|
* Check whether a gh pr create command targets a forbidden base branch.
|
|
190
190
|
*
|
|
191
|
+
* Allows staging → main PRs (the deploy path) by detecting --head staging
|
|
192
|
+
* or falling back to the current git branch. Feature branches targeting
|
|
193
|
+
* main are still hard-blocked.
|
|
194
|
+
*
|
|
191
195
|
* @param {string} command
|
|
192
196
|
* @returns {string|null} Error message to show, or null if allowed.
|
|
193
197
|
*/
|
|
@@ -199,6 +203,12 @@ function checkPrTarget(command) {
|
|
|
199
203
|
if (!base) return null; // no --base flag — gh will use the default
|
|
200
204
|
|
|
201
205
|
if (FORBIDDEN_PR_BASES.includes(base.toLowerCase())) {
|
|
206
|
+
// Allow staging → main (the deploy path, not a pipeline violation).
|
|
207
|
+
const head = extractFlag(command, "--head") || extractFlag(command, "-H") || currentGitBranch();
|
|
208
|
+
if (head && /^staging$/.test(head)) {
|
|
209
|
+
return null; // deploy flow — allowed
|
|
210
|
+
}
|
|
211
|
+
|
|
202
212
|
return [
|
|
203
213
|
`[ForgeDock] BLOCKED: PR targets "${base}" — pipeline rule violation.`,
|
|
204
214
|
``,
|
|
@@ -206,6 +216,7 @@ function checkPrTarget(command) {
|
|
|
206
216
|
`A PR to "${base}" is a hard pipeline violation. Fix the --base flag.`,
|
|
207
217
|
``,
|
|
208
218
|
`Allowed targets: staging | milestone/<slug>`,
|
|
219
|
+
`Exception: staging → main (deploy flow) is allowed.`,
|
|
209
220
|
].join("\n");
|
|
210
221
|
}
|
|
211
222
|
|
|
@@ -315,6 +326,27 @@ function checkLabelTransition(command) {
|
|
|
315
326
|
return null; // valid transition — allow
|
|
316
327
|
}
|
|
317
328
|
|
|
329
|
+
// ---------------------------------------------------------------------------
|
|
330
|
+
// Git helpers
|
|
331
|
+
// ---------------------------------------------------------------------------
|
|
332
|
+
|
|
333
|
+
/**
|
|
334
|
+
* Return the current git branch name, or null on any failure.
|
|
335
|
+
* Used to detect the staging → main deploy path.
|
|
336
|
+
*/
|
|
337
|
+
function currentGitBranch() {
|
|
338
|
+
try {
|
|
339
|
+
const { execFileSync: exec } = _require("child_process");
|
|
340
|
+
return exec("git", ["rev-parse", "--abbrev-ref", "HEAD"], {
|
|
341
|
+
encoding: "utf-8",
|
|
342
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
343
|
+
timeout: 5000,
|
|
344
|
+
}).trim() || null;
|
|
345
|
+
} catch {
|
|
346
|
+
return null;
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
|
|
318
350
|
// ---------------------------------------------------------------------------
|
|
319
351
|
// Helpers
|
|
320
352
|
// ---------------------------------------------------------------------------
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "forgedock",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.5",
|
|
4
4
|
"description": "Autonomous dev pipeline for Claude Code. GitHub as institutional memory — every issue, PR, and annotation survives context resets and makes the next agent smarter.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"forgedock": "bin/forgedock.mjs"
|