guardian-framework 0.1.144 → 0.1.145
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/dist/cli.js +1 -1
- package/dist/exports.js +1 -1
- package/package.json +1 -1
- package/templates/pi/extensions/architect.ts +53 -7
- package/templates/pi/extensions/pipeline.ts +64 -3
- package/templates/pi/preflight_report.json +1 -1
- package/templates/pi/prompts/epic-closeout.md +78 -0
- package/templates/pi/scripts/ci/epic-gate.sh +44 -0
- package/templates/pi/scripts/epic-branch.sh +46 -0
package/dist/cli.js
CHANGED
|
@@ -3206,7 +3206,7 @@ __export(exports_package, {
|
|
|
3206
3206
|
bin: () => bin,
|
|
3207
3207
|
author: () => author
|
|
3208
3208
|
});
|
|
3209
|
-
var name = "guardian-framework", version = "0.1.
|
|
3209
|
+
var name = "guardian-framework", version = "0.1.145", description = "Token-optimized agentic framework scaffolder with pi-first architecture", type = "module", main = "dist/exports.js", exports, types = "dist/exports.d.ts", bin, files, engines, scripts, publishConfig, pi, repository, homepage = "https://github.com/arman-jalili/guardian-framework#readme", bugs, dependencies, devDependencies, keywords, author = "Arman Wolkensteiner-Jalili", license = "MIT", package_default;
|
|
3210
3210
|
var init_package = __esm(() => {
|
|
3211
3211
|
exports = {
|
|
3212
3212
|
".": {
|
package/dist/exports.js
CHANGED
|
@@ -1991,7 +1991,7 @@ __export(exports_package, {
|
|
|
1991
1991
|
bin: () => bin,
|
|
1992
1992
|
author: () => author
|
|
1993
1993
|
});
|
|
1994
|
-
var name = "guardian-framework", version = "0.1.
|
|
1994
|
+
var name = "guardian-framework", version = "0.1.145", description = "Token-optimized agentic framework scaffolder with pi-first architecture", type = "module", main = "dist/exports.js", exports, types = "dist/exports.d.ts", bin, files, engines, scripts, publishConfig, pi, repository, homepage = "https://github.com/arman-jalili/guardian-framework#readme", bugs, dependencies, devDependencies, keywords, author = "Arman Wolkensteiner-Jalili", license = "MIT", package_default;
|
|
1995
1995
|
var init_package = __esm(() => {
|
|
1996
1996
|
exports = {
|
|
1997
1997
|
".": {
|
package/package.json
CHANGED
|
@@ -1,3 +1,28 @@
|
|
|
1
|
+
// ── Epic-mode pipeline (one branch, one PR per epic) ───────────────────────
|
|
2
|
+
// Default is "epic": issues commit to one epic branch, each item is gated by
|
|
3
|
+
// local CI, and a single PR is opened after the last item. `--pr-per issue`
|
|
4
|
+
// restores the legacy per-issue PR flow.
|
|
5
|
+
function prStrategyFor(ctx: { cwd: string }): "issue" | "epic" {
|
|
6
|
+
try {
|
|
7
|
+
const statePath = join(ctx.cwd, ".pi", ".guardian-epic-state.json");
|
|
8
|
+
if (existsSync(statePath)) {
|
|
9
|
+
const st = JSON.parse(readFileSync(statePath, "utf-8")) as { prStrategy?: "issue" | "epic" };
|
|
10
|
+
if (st.prStrategy === "issue" || st.prStrategy === "epic") return st.prStrategy;
|
|
11
|
+
}
|
|
12
|
+
} catch {
|
|
13
|
+
// ignore
|
|
14
|
+
}
|
|
15
|
+
return "epic";
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function epicBranchName(moduleName: string): string {
|
|
19
|
+
const slug = String(moduleName ?? "epic")
|
|
20
|
+
.toLowerCase()
|
|
21
|
+
.replace(/[^a-z0-9]+/g, "-")
|
|
22
|
+
.replace(/^-|-$/g, "");
|
|
23
|
+
return `epic/${slug || "epic"}`;
|
|
24
|
+
}
|
|
25
|
+
|
|
1
26
|
/**
|
|
2
27
|
* Architect Extension — Full Architecture-to-Implementation Pipeline
|
|
3
28
|
*
|
|
@@ -467,7 +492,7 @@ export default function architectExtension(pi: ExtensionAPI) {
|
|
|
467
492
|
const tokens = raw ? parseArgs(raw) : [];
|
|
468
493
|
if (tokens.length === 0) {
|
|
469
494
|
ctx.ui.notify(
|
|
470
|
-
"Usage: /architect [--epic Name] [--tracking-issue N] [--tdd] | --roadmap | --phase \"Phase 1\" | --phase-status | --phase-done <N> | --phase-module-done <N> \"Module\" | status | next-epic | abort",
|
|
495
|
+
"Usage: /architect [--epic Name] [--tracking-issue N] [--tdd] [--pr-per epic|issue] | --roadmap | --phase \"Phase 1\" | --phase-status | --phase-done <N> | --phase-module-done <N> \"Module\" | status | next-epic | abort",
|
|
471
496
|
"info",
|
|
472
497
|
);
|
|
473
498
|
return;
|
|
@@ -611,8 +636,8 @@ export default function architectExtension(pi: ExtensionAPI) {
|
|
|
611
636
|
steps: [
|
|
612
637
|
{ name: "implement", prompt: ".pi/prompts/issue-implementation-series.md", acceptance: { type: "validator", validators: ["ci"] } },
|
|
613
638
|
{ name: "validate", acceptance: { type: "validator", validators: ["ci", "tests", "security"] } },
|
|
614
|
-
{ name: "create-mr", prompt: ".pi/prompts/
|
|
615
|
-
{ name: "merge", prompt: ".pi/prompts/
|
|
639
|
+
{ name: "create-mr", prompt: ".pi/prompts/epic-closeout.md", acceptance: { type: "none" } },
|
|
640
|
+
{ name: "merge", prompt: ".pi/prompts/epic-closeout.md", acceptance: { type: "validator", validators: ["ci", "canonical"] } },
|
|
616
641
|
],
|
|
617
642
|
currentItemIndex: 0,
|
|
618
643
|
currentStepIndex: 0,
|
|
@@ -620,6 +645,8 @@ export default function architectExtension(pi: ExtensionAPI) {
|
|
|
620
645
|
retryCount: 0,
|
|
621
646
|
results: [],
|
|
622
647
|
mergeOnValid: true,
|
|
648
|
+
prStrategy: prStrategyFor(ctx),
|
|
649
|
+
epicBranch: epicBranchName(mod.name),
|
|
623
650
|
createdAt: new Date().toISOString(),
|
|
624
651
|
updatedAt: new Date().toISOString(),
|
|
625
652
|
};
|
|
@@ -671,8 +698,8 @@ export default function architectExtension(pi: ExtensionAPI) {
|
|
|
671
698
|
steps: [
|
|
672
699
|
{ name: "implement", prompt: ".pi/prompts/issue-implementation-series.md", acceptance: { type: "validator", validators: ["ci"] } },
|
|
673
700
|
{ name: "validate", acceptance: { type: "validator", validators: ["ci", "tests", "security"] } },
|
|
674
|
-
{ name: "create-mr", prompt: ".pi/prompts/
|
|
675
|
-
{ name: "merge", prompt: ".pi/prompts/
|
|
701
|
+
{ name: "create-mr", prompt: ".pi/prompts/epic-closeout.md", acceptance: { type: "none" } },
|
|
702
|
+
{ name: "merge", prompt: ".pi/prompts/epic-closeout.md", acceptance: { type: "validator", validators: ["ci", "canonical"] } },
|
|
676
703
|
],
|
|
677
704
|
currentItemIndex: 0,
|
|
678
705
|
currentStepIndex: 0,
|
|
@@ -680,6 +707,8 @@ export default function architectExtension(pi: ExtensionAPI) {
|
|
|
680
707
|
retryCount: 0,
|
|
681
708
|
results: [],
|
|
682
709
|
mergeOnValid: true,
|
|
710
|
+
prStrategy: prStrategyFor(ctx),
|
|
711
|
+
epicBranch: epicBranchName(mod.name),
|
|
683
712
|
createdAt: new Date().toISOString(),
|
|
684
713
|
updatedAt: new Date().toISOString(),
|
|
685
714
|
};
|
|
@@ -830,6 +859,21 @@ export default function architectExtension(pi: ExtensionAPI) {
|
|
|
830
859
|
|
|
831
860
|
const epicName = findFlag(tokens, "--epic");
|
|
832
861
|
const trackingIssueId = findFlag(tokens, "--tracking-issue");
|
|
862
|
+
// --pr-per epic (default) | issue — one PR for the whole epic, or the
|
|
863
|
+
// legacy per-issue PR flow.
|
|
864
|
+
const prPerFlag = (findFlag(tokens, "--pr-per") ?? "epic").toLowerCase();
|
|
865
|
+
const epicPrStrategy: "issue" | "epic" = prPerFlag === "issue" ? "issue" : "epic";
|
|
866
|
+
try {
|
|
867
|
+
const epicStatePath = join(ctx.cwd, ".pi", ".guardian-epic-state.json");
|
|
868
|
+
const st = existsSync(epicStatePath)
|
|
869
|
+
? (JSON.parse(readFileSync(epicStatePath, "utf-8")) as Record<string, unknown>)
|
|
870
|
+
: {};
|
|
871
|
+
st.prStrategy = epicPrStrategy;
|
|
872
|
+
mkdirSync(join(ctx.cwd, ".pi"), { recursive: true });
|
|
873
|
+
writeFileSync(epicStatePath, JSON.stringify(st, null, 2), "utf-8");
|
|
874
|
+
} catch {
|
|
875
|
+
// ignore — strategy falls back to epic
|
|
876
|
+
}
|
|
833
877
|
const tddEnabled = tokens.includes("--tdd");
|
|
834
878
|
|
|
835
879
|
if (!epicName) {
|
|
@@ -881,8 +925,8 @@ export default function architectExtension(pi: ExtensionAPI) {
|
|
|
881
925
|
steps: [
|
|
882
926
|
{ name: "implement", prompt: ".pi/prompts/issue-implementation-series.md", acceptance: { type: "validator", validators: ["ci"] } },
|
|
883
927
|
{ name: "validate", acceptance: { type: "validator", validators: ["ci", "tests", "security"] } },
|
|
884
|
-
{ name: "create-mr", prompt: ".pi/prompts/
|
|
885
|
-
{ name: "merge", prompt: ".pi/prompts/
|
|
928
|
+
{ name: "create-mr", prompt: ".pi/prompts/epic-closeout.md", acceptance: { type: "none" } },
|
|
929
|
+
{ name: "merge", prompt: ".pi/prompts/epic-closeout.md", acceptance: { type: "validator", validators: ["ci", "canonical"] } },
|
|
886
930
|
],
|
|
887
931
|
currentItemIndex: 0,
|
|
888
932
|
currentStepIndex: 0,
|
|
@@ -890,6 +934,8 @@ export default function architectExtension(pi: ExtensionAPI) {
|
|
|
890
934
|
retryCount: 0,
|
|
891
935
|
results: [],
|
|
892
936
|
mergeOnValid: true,
|
|
937
|
+
prStrategy: prStrategyFor(ctx),
|
|
938
|
+
epicBranch: epicBranchName(epicName),
|
|
893
939
|
createdAt: new Date().toISOString(),
|
|
894
940
|
updatedAt: new Date().toISOString(),
|
|
895
941
|
};
|
|
@@ -155,6 +155,18 @@ type PipelineState = {
|
|
|
155
155
|
retryCount: number;
|
|
156
156
|
results: ItemResult[];
|
|
157
157
|
mergeOnValid: boolean;
|
|
158
|
+
/**
|
|
159
|
+
* "issue" (legacy): implement → validate → create-mr → merge per item.
|
|
160
|
+
* "epic" (default for /architect): every item implements on ONE epic branch,
|
|
161
|
+
* local-ci gates each item, and a single PR is opened/merged for the epic.
|
|
162
|
+
*/
|
|
163
|
+
prStrategy?: "issue" | "epic";
|
|
164
|
+
/** Branch shared by all items in epic mode (e.g. epic/policy-engine). */
|
|
165
|
+
epicBranch?: string;
|
|
166
|
+
/** Set once the epic PR has been created in epic mode. */
|
|
167
|
+
epicPrCreated?: boolean;
|
|
168
|
+
/** Set when the last item finished in epic mode (open the single PR now). */
|
|
169
|
+
epicReadyForPr?: boolean;
|
|
158
170
|
createdAt: string;
|
|
159
171
|
updatedAt: string;
|
|
160
172
|
};
|
|
@@ -422,22 +434,48 @@ class PipelineManager {
|
|
|
422
434
|
if (!step) return { verified: true, reason: "No current step" };
|
|
423
435
|
|
|
424
436
|
const slug = item.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
|
|
425
|
-
const
|
|
437
|
+
const epicMode = this.state?.prStrategy === "epic";
|
|
438
|
+
const epicBranch = this.state?.epicBranch ?? "";
|
|
439
|
+
// In epic mode every item lands on the shared epic branch; there is no
|
|
440
|
+
// per-item branch, no per-item PR and no per-item merge.
|
|
441
|
+
const branch = epicMode ? epicBranch : `feat/${slug}`;
|
|
426
442
|
|
|
427
443
|
switch (step.name) {
|
|
428
444
|
case "implement": {
|
|
445
|
+
if (!epicMode) {
|
|
446
|
+
if (!this.gitBranchExists(branch) || !this.branchHasCommits(branch)) {
|
|
447
|
+
return { verified: false, reason: `No commits found on branch ${branch}. Implement the feature first.` };
|
|
448
|
+
}
|
|
449
|
+
return { verified: true, reason: "Commits found on branch" };
|
|
450
|
+
}
|
|
451
|
+
if (!epicMode || !branch) {
|
|
452
|
+
return { verified: false, reason: "Epic mode requires an epic branch (state.epicBranch)." };
|
|
453
|
+
}
|
|
429
454
|
if (!this.gitBranchExists(branch) || !this.branchHasCommits(branch)) {
|
|
430
|
-
return { verified: false, reason: `No commits found on branch ${branch}. Implement the
|
|
455
|
+
return { verified: false, reason: `No commits found on epic branch ${branch}. Implement the item there first.` };
|
|
431
456
|
}
|
|
432
|
-
return { verified: true, reason:
|
|
457
|
+
return { verified: true, reason: `Commits found on epic branch ${branch}` };
|
|
433
458
|
}
|
|
434
459
|
case "create-mr": {
|
|
460
|
+
if (epicMode) {
|
|
461
|
+
// Deferred: the epic PR is opened once, after the last item.
|
|
462
|
+
return { verified: true, reason: "Epic mode: PR is created once for the whole epic (deferred)" };
|
|
463
|
+
}
|
|
435
464
|
if (!this.forgePrExists(branch)) {
|
|
436
465
|
return { verified: false, reason: `No PR/MR found for branch ${branch}. Create a PR/MR first.` };
|
|
437
466
|
}
|
|
438
467
|
return { verified: true, reason: "PR/MR exists" };
|
|
439
468
|
}
|
|
440
469
|
case "merge": {
|
|
470
|
+
if (epicMode) {
|
|
471
|
+
if (!this.state?.epicPrCreated) {
|
|
472
|
+
return { verified: true, reason: "Epic mode: merge handled at epic level" };
|
|
473
|
+
}
|
|
474
|
+
if (!this.forgePrMerged(branch)) {
|
|
475
|
+
return { verified: false, reason: `Epic PR for ${branch} is not merged yet.` };
|
|
476
|
+
}
|
|
477
|
+
return { verified: true, reason: "Epic PR merged" };
|
|
478
|
+
}
|
|
441
479
|
if (!this.forgePrMerged(branch)) {
|
|
442
480
|
return { verified: false, reason: `PR/MR for ${branch} is not merged yet.` };
|
|
443
481
|
}
|
|
@@ -573,6 +611,12 @@ class PipelineManager {
|
|
|
573
611
|
this.state.currentStepIndex = 0;
|
|
574
612
|
this.state.retryCount = 0;
|
|
575
613
|
|
|
614
|
+
// Epic mode: the last item completing means the epic is ready for its
|
|
615
|
+
// single PR. Mark the epic state so next-task surfaces the closeout.
|
|
616
|
+
if (this.state.prStrategy === "epic" && this.state.currentItemIndex >= this.state.items.length) {
|
|
617
|
+
this.state.epicReadyForPr = true;
|
|
618
|
+
}
|
|
619
|
+
|
|
576
620
|
if (this.state.currentItemIndex >= this.state.items.length) {
|
|
577
621
|
this.state.status = "done";
|
|
578
622
|
this.syncRoadmapState();
|
|
@@ -1237,13 +1281,30 @@ export default function (pi: ExtensionAPI) {
|
|
|
1237
1281
|
].join("\n")
|
|
1238
1282
|
: "";
|
|
1239
1283
|
|
|
1284
|
+
const epicModeBlock = state.prStrategy === "epic"
|
|
1285
|
+
? [
|
|
1286
|
+
"",
|
|
1287
|
+
"## Epic Mode — one branch, one PR",
|
|
1288
|
+
"",
|
|
1289
|
+
`- Work on the shared epic branch: \`${state.epicBranch ?? "(unset)"}\``,
|
|
1290
|
+
"- Commit directly to that branch (no per-issue branch, no per-issue PR).",
|
|
1291
|
+
"- Gate every item with LOCAL CI before committing:",
|
|
1292
|
+
" `bash .pi/scripts/ci/run_preflight.sh` and the validators for this step.",
|
|
1293
|
+
"- Do NOT run `gh pr create` / `glab mr create` for this item.",
|
|
1294
|
+
`- The single epic PR is opened after the last of the ${state.items.length} items.`,
|
|
1295
|
+
"",
|
|
1296
|
+
].join("\n")
|
|
1297
|
+
: "";
|
|
1298
|
+
|
|
1240
1299
|
const text = [
|
|
1241
1300
|
"## Pipeline Task",
|
|
1242
1301
|
"",
|
|
1243
1302
|
`**Pipeline:** ${state.name} (${state.id})`,
|
|
1244
1303
|
`**Item:** ${issueId} (${state.currentItemIndex + 1}/${state.items.length})`,
|
|
1245
1304
|
`**Step:** ${step.name} (${state.currentStepIndex + 1}/${state.steps.length})`,
|
|
1305
|
+
`**Mode:** ${state.prStrategy === "epic" ? "epic (single PR)" : "per-issue PR"}`,
|
|
1246
1306
|
`**Issue:** ${issueSource}`,
|
|
1307
|
+
epicModeBlock,
|
|
1247
1308
|
"",
|
|
1248
1309
|
"---",
|
|
1249
1310
|
"",
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# Epic Closeout — one PR for the whole epic
|
|
2
|
+
|
|
3
|
+
<!--
|
|
4
|
+
Canonical Reference: .pi/prompts/epic-closeout.md
|
|
5
|
+
Implements: /architect epic-mode closeout (one branch, one PR, full-epic CI)
|
|
6
|
+
-->
|
|
7
|
+
|
|
8
|
+
**Purpose:** All issues of this epic have been implemented on the shared epic branch.
|
|
9
|
+
Open **one** pull request for the epic, let CI validate the **complete** epic, and merge it.
|
|
10
|
+
This replaces the per-issue closeout when the pipeline runs in epic mode.
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## Preconditions
|
|
15
|
+
|
|
16
|
+
1. Every issue of the epic is implemented and committed on the epic branch.
|
|
17
|
+
2. Local CI is green for the full branch:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
bash .pi/scripts/ci/run_preflight.sh
|
|
21
|
+
bash .pi/scripts/validate-architecture.sh
|
|
22
|
+
bash .pi/scripts/validate-tests.sh
|
|
23
|
+
bash .pi/scripts/validate-canonical.sh
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
3. The epic branch is up to date with the base branch (rebase, do not merge the base in).
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## Open the single epic PR
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
# Push the epic branch
|
|
34
|
+
git push -u origin <epic-branch>
|
|
35
|
+
|
|
36
|
+
# One PR for the whole epic (body lists every issue)
|
|
37
|
+
gh pr create \
|
|
38
|
+
--base main \
|
|
39
|
+
--head <epic-branch> \
|
|
40
|
+
--title "feat(<module>): <epic name> epic" \
|
|
41
|
+
--body "$(cat <<'EOF'
|
|
42
|
+
## Epic
|
|
43
|
+
<module> — <epic name>
|
|
44
|
+
|
|
45
|
+
## Issues
|
|
46
|
+
- [ ] #<n> <title>
|
|
47
|
+
- [ ] #<n> <title>
|
|
48
|
+
|
|
49
|
+
## Evidence
|
|
50
|
+
- Local CI green on the full epic branch
|
|
51
|
+
- Architecture validators green (incl. language consistency)
|
|
52
|
+
- Test suite green
|
|
53
|
+
|
|
54
|
+
Closes #<n>, #<n>
|
|
55
|
+
EOF
|
|
56
|
+
)"
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
For GitLab use `glab mr create` with the same content (see `.pi/scripts/create-mr.sh`).
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## Validate, then merge
|
|
64
|
+
|
|
65
|
+
- Wait for CI **once** — it runs against the full epic, which is a stronger
|
|
66
|
+
signal than N per-issue runs.
|
|
67
|
+
- On green: merge (squash or merge-commit per repo policy) and delete the branch.
|
|
68
|
+
- Record the epic completion in `.pi/architecture/CHANGELOG.md` and set the module
|
|
69
|
+
doc status to implemented.
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## Rules
|
|
74
|
+
|
|
75
|
+
- **Never** open a PR/MR per issue in epic mode.
|
|
76
|
+
- **Never** merge before CI reports on the epic PR.
|
|
77
|
+
- If a single issue fails after the epic PR is open, fix it on the epic branch and
|
|
78
|
+
push — do not open additional PRs.
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# ============================================================================
|
|
3
|
+
# epic-gate.sh — local CI gate for one epic issue (no remote PR wait)
|
|
4
|
+
# ============================================================================
|
|
5
|
+
# In epic mode each issue is validated LOCALLY before committing. The remote
|
|
6
|
+
# pipeline runs once, on the single epic PR.
|
|
7
|
+
#
|
|
8
|
+
# Run as: bash .pi/scripts/ci/epic-gate.sh [--full]
|
|
9
|
+
# default: preflight + architecture + tests (fast, per issue)
|
|
10
|
+
# --full: also security + canonical + integration (before the epic PR)
|
|
11
|
+
# ============================================================================
|
|
12
|
+
set -uo pipefail
|
|
13
|
+
FULL=0
|
|
14
|
+
[ "${1:-}" = "--full" ] && FULL=1
|
|
15
|
+
FAILED=0
|
|
16
|
+
|
|
17
|
+
run() {
|
|
18
|
+
local name="$1"; shift
|
|
19
|
+
echo ""
|
|
20
|
+
echo "── $name"
|
|
21
|
+
if bash "$@" ; then
|
|
22
|
+
echo " ✅ $name"
|
|
23
|
+
else
|
|
24
|
+
echo " ❌ $name"
|
|
25
|
+
FAILED=1
|
|
26
|
+
fi
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
[ -f ".pi/scripts/ci/run_preflight.sh" ] && run "preflight" .pi/scripts/ci/run_preflight.sh
|
|
30
|
+
[ -f ".pi/scripts/validate-architecture.sh" ] && run "architecture" .pi/scripts/validate-architecture.sh
|
|
31
|
+
[ -f ".pi/scripts/validate-tests.sh" ] && run "tests" .pi/scripts/validate-tests.sh
|
|
32
|
+
if [ "$FULL" = "1" ]; then
|
|
33
|
+
[ -f ".pi/scripts/validate-security.sh" ] && run "security" .pi/scripts/validate-security.sh
|
|
34
|
+
[ -f ".pi/scripts/validate-canonical.sh" ] && run "canonical" .pi/scripts/validate-canonical.sh
|
|
35
|
+
[ -f ".pi/scripts/validate-integration.sh" ] && run "integration" .pi/scripts/validate-integration.sh
|
|
36
|
+
fi
|
|
37
|
+
|
|
38
|
+
echo ""
|
|
39
|
+
if [ "$FAILED" -eq 0 ]; then
|
|
40
|
+
echo "✅ Epic gate passed${FULL:+ (full)} — safe to commit"
|
|
41
|
+
exit 0
|
|
42
|
+
fi
|
|
43
|
+
echo "❌ Epic gate failed — fix before committing (no PR needed)"
|
|
44
|
+
exit 1
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# ============================================================================
|
|
3
|
+
# epic-branch.sh — create or enter the shared epic branch (epic mode)
|
|
4
|
+
# ============================================================================
|
|
5
|
+
# Epic mode: all issues of an epic commit to ONE branch; a single PR is opened
|
|
6
|
+
# after the last issue. This script makes branch handling deterministic for
|
|
7
|
+
# agents and humans.
|
|
8
|
+
#
|
|
9
|
+
# Run as: bash .pi/scripts/epic-branch.sh <module-name> [base-branch]
|
|
10
|
+
# bash .pi/scripts/epic-branch.sh --current
|
|
11
|
+
#
|
|
12
|
+
# Exit codes: 0 ok, 1 usage/error
|
|
13
|
+
# ============================================================================
|
|
14
|
+
set -euo pipefail
|
|
15
|
+
|
|
16
|
+
slugify() {
|
|
17
|
+
echo "$1" | tr '[:upper:]' '[:lower:]' \
|
|
18
|
+
| sed -E 's/[^a-z0-9]+/-/g; s/^-+//; s/-+$//'
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
if [ "${1:-}" = "--current" ]; then
|
|
22
|
+
git rev-parse --abbrev-ref HEAD
|
|
23
|
+
exit 0
|
|
24
|
+
fi
|
|
25
|
+
|
|
26
|
+
MODULE="${1:-}"
|
|
27
|
+
BASE="${2:-main}"
|
|
28
|
+
if [ -z "$MODULE" ]; then
|
|
29
|
+
echo "Usage: epic-branch.sh <module-name> [base-branch] | --current" >&2
|
|
30
|
+
exit 1
|
|
31
|
+
fi
|
|
32
|
+
|
|
33
|
+
BRANCH="epic/$(slugify "$MODULE")"
|
|
34
|
+
|
|
35
|
+
if git show-ref --verify --quiet "refs/heads/$BRANCH"; then
|
|
36
|
+
echo "Epic branch already exists: $BRANCH"
|
|
37
|
+
git checkout "$BRANCH"
|
|
38
|
+
else
|
|
39
|
+
echo "Creating epic branch: $BRANCH (from $BASE)"
|
|
40
|
+
git fetch origin "$BASE" --quiet 2>/dev/null || true
|
|
41
|
+
git checkout -b "$BRANCH" "origin/$BASE" 2>/dev/null || git checkout -b "$BRANCH" "$BASE"
|
|
42
|
+
fi
|
|
43
|
+
|
|
44
|
+
echo "On branch: $(git rev-parse --abbrev-ref HEAD)"
|
|
45
|
+
echo "Epic mode: commit every issue here; open ONE PR after the last issue:"
|
|
46
|
+
echo " bash .pi/scripts/ci/run_preflight.sh # local gate per issue"
|