bigpowers 2.86.2 → 2.86.4
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/.agents/skills/wire-ci/SKILL.md +78 -59
- package/.codebuddy/skills/wire-ci/SKILL.md +78 -59
- package/.codex/skills/wire-ci/SKILL.md +78 -59
- package/.hermes/skills/wire-ci/SKILL.md +78 -59
- package/.kilocode/rules/wire-ci.md +78 -59
- package/.mimocode/skills/wire-ci/SKILL.md +78 -59
- package/.pi/package.json +1 -1
- package/.pi/prompts/wire-ci.md +78 -59
- package/.pi/skills/wire-ci/SKILL.md +78 -59
- package/.trae/skills/wire-ci/SKILL.md +78 -59
- package/.windsurf/rules/wire-ci.md +78 -59
- package/.zcode/skills/wire-ci/SKILL.md +78 -59
- package/CHANGELOG.md +21 -0
- package/SKILL-INDEX.md +1 -1
- package/package.json +1 -1
- package/scripts/golden-g12-status-consistency.sh +232 -0
- package/scripts/lib/__pycache__/link_utils.cpython-312.pyc +0 -0
- package/scripts/lib/__pycache__/srp_engine_links.cpython-312.pyc +0 -0
- package/scripts/lib/context-wire.sh +9 -0
- package/scripts/lib/detect-forge.sh +105 -0
- package/scripts/lib/extract-story-verify.py +102 -0
- package/scripts/lib/fail-open-detect.sh +67 -0
- package/scripts/lib/golden-suite-gates.sh +9 -0
- package/scripts/lib/plan-consistency-check.sh +26 -2
- package/scripts/lib/test-assertions.sh +11 -1
- package/scripts/run-skill-verify.sh +5 -46
- package/scripts/run-story-verify.sh +208 -0
- package/scripts/sync-status-from-epics.sh +8 -0
- package/scripts/test-adapters.sh +14 -8
- package/scripts/verify-install.sh +13 -1
- package/scripts/wire-ci.sh +159 -0
- package/skills/wire-ci/REFERENCE.md +15 -4
- package/skills/wire-ci/SKILL.md +63 -55
- package/skills-lock.json +2 -2
|
@@ -1,104 +1,112 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: wire-ci
|
|
3
3
|
model: sonnet
|
|
4
|
-
description: "CI pipeline setup with
|
|
4
|
+
description: "CI pipeline setup with bundled, forge-neutral templates and local validation. Detects the forge from the git remote, generates workflows for supported forges, and skips honestly for the rest. The CI equivalent of wire-observability."
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# Wire CI
|
|
8
8
|
|
|
9
|
-
> **HARD GATE** — Do not ship a project without CI. Run this skill before first merge to main
|
|
9
|
+
> **HARD GATE (supported forges only)** — Do not ship a project without CI. Run this skill before first merge to main.
|
|
10
|
+
>
|
|
11
|
+
> On a forge bigpowers ships no templates for, this skill **is not a gate**: it reports the forge, explains what it cannot do, and exits 3. A gate that cannot run must not claim it did. See § Unsupported forges.
|
|
10
12
|
>
|
|
11
13
|
> **HARD GATE** — CI that is untestable locally will break every cycle. Always run `--validate` after generating workflows and `--dry-run` before pushing.
|
|
12
14
|
|
|
13
|
-
Generate, validate, and test CI workflows. Detects
|
|
15
|
+
Generate, validate, and test CI workflows. Detects the forge and project type, copies a **bundled** template, and verifies locally before anything reaches CI.
|
|
14
16
|
|
|
15
|
-
##
|
|
17
|
+
## Forge resolution
|
|
16
18
|
|
|
17
|
-
|
|
18
|
-
2. **Deploy workflow** — `.github/workflows/deploy.yml` triggered via `workflow_run` (BigBase/Pages stacks only; CLI/library repos omit this)
|
|
19
|
-
3. **`--validate` mode** — checks YAML syntax, workflow permissions, required secrets, and common pitfalls
|
|
20
|
-
4. **`--dry-run` mode** — runs workflows locally via `act` or `gh workflow run` to prove correctness before push
|
|
21
|
-
5. **Failure pattern documentation** — common CI failure categories and their fixes
|
|
19
|
+
`scripts/lib/detect-forge.sh` resolves the forge, first match wins: `BIGPOWERS_FORGE` env var → `forge:` in `specs/forge.yaml` → the `origin` remote URL → `unknown`.
|
|
22
20
|
|
|
23
|
-
|
|
21
|
+
```bash
|
|
22
|
+
bash scripts/wire-ci.sh --detect # report forge + stack, write nothing
|
|
23
|
+
bash scripts/wire-ci.sh --plan # show the template that would be used
|
|
24
|
+
bash scripts/wire-ci.sh --apply # write the workflow
|
|
25
|
+
```
|
|
24
26
|
|
|
25
|
-
|
|
27
|
+
GitHub ships templates (`.github/workflows/`). GitLab, Bitbucket, Codeberg, and Gitea are detected but **unsupported** — `--apply` writes nothing and exits 3.
|
|
26
28
|
|
|
27
|
-
|
|
29
|
+
## Template source — configurable, bundled by default
|
|
28
30
|
|
|
29
|
-
|
|
30
|
-
|----------|------|-------------------------------------|
|
|
31
|
-
| `Cargo.toml` | Rust | `test-build-release-monorepo.yml` + `deploy-monorepo.yml` (or monorepo subset) |
|
|
32
|
-
| `package.json` | Node | `test-build-release-node.yml` + `deploy-node.yml` |
|
|
33
|
-
| `setup.py` / `pyproject.toml` | Python | `test-build-release-python.yml` + `deploy-python.yml` |
|
|
34
|
-
| `go.mod` | Go | `test-build-release-go.yml` + `deploy-go.yml` |
|
|
35
|
-
| Static site (no server) | Static | `test-build-release-static.yml` + `deploy-static.yml` |
|
|
36
|
-
| `Package.swift` | Swift | `test-build-release-swift.yml` only (no deploy yet) |
|
|
37
|
-
| Multiple detected | Polyglot | `test-build-release-monorepo.yml` + `deploy-monorepo.yml` |
|
|
31
|
+
Templates live in `docs/templates/ci/<forge>/` **inside the bigpowers package**, so there is no network dependency on any third party's repository. Override with `BIGPOWERS_CI_TEMPLATES=/path/to/your/templates`, laid out as `<root>/<forge>/test-build-release-<stack>.yml`.
|
|
38
32
|
|
|
39
|
-
|
|
33
|
+
## What this sets up
|
|
40
34
|
|
|
41
|
-
|
|
35
|
+
1. **Test Build Release workflow** — lint → test → build → release in one `needs:` chain
|
|
36
|
+
2. **`--validate` mode** — YAML syntax, workflow permissions, required secrets, common pitfalls
|
|
37
|
+
3. **`--dry-run` mode** — runs workflows locally via `act` before push
|
|
38
|
+
4. **Failure pattern documentation** — see the table below
|
|
42
39
|
|
|
43
|
-
|
|
40
|
+
Deploy workflows are **not** bundled: they are platform-specific. See [REFERENCE.md](REFERENCE.md) for a worked example.
|
|
44
41
|
|
|
45
|
-
|
|
42
|
+
## Process
|
|
43
|
+
|
|
44
|
+
### 1. Detect forge and stack
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
bash scripts/wire-ci.sh --detect
|
|
48
|
+
```
|
|
46
49
|
|
|
47
|
-
|
|
50
|
+
Stack detection reads the project root:
|
|
48
51
|
|
|
49
|
-
|
|
52
|
+
| Manifest | Stack | Bundled template |
|
|
53
|
+
|----------|-------|------------------|
|
|
54
|
+
| `Cargo.toml` | Rust | `test-build-release-rust.yml` |
|
|
55
|
+
| `package.json` | Node | `test-build-release-node.yml` |
|
|
56
|
+
| `pyproject.toml` / `setup.py` | Python | `test-build-release-python.yml` |
|
|
57
|
+
| `go.mod` | Go | `test-build-release-go.yml` |
|
|
50
58
|
|
|
51
|
-
|
|
59
|
+
No recognized manifest → exit 3 with the list of manifests it looked for. Do not guess.
|
|
52
60
|
|
|
53
|
-
|
|
61
|
+
### 2. Apply the template
|
|
54
62
|
|
|
55
63
|
```bash
|
|
56
|
-
|
|
64
|
+
bash scripts/wire-ci.sh --apply
|
|
57
65
|
```
|
|
58
66
|
|
|
59
|
-
|
|
67
|
+
**Do not rename the workflow `name:` field** — deploy listens for `"Test Build Release"`.
|
|
60
68
|
|
|
61
|
-
|
|
69
|
+
Edit placeholders after copying: language versions, `APP_TYPE`, `SITE_URL`.
|
|
62
70
|
|
|
63
|
-
###
|
|
71
|
+
### 3. Unsupported forges
|
|
64
72
|
|
|
65
|
-
|
|
73
|
+
`--apply` writes nothing and exits 3. Your options, in the order the runner prints them:
|
|
66
74
|
|
|
67
|
-
|
|
75
|
+
- point `BIGPOWERS_CI_TEMPLATES` at templates for your forge
|
|
76
|
+
- pin `forge: github` in `specs/forge.yaml` if the remote is misdetected
|
|
77
|
+
- write the CI config by hand
|
|
68
78
|
|
|
69
|
-
|
|
70
|
-
- `0` — all checks pass (no errors)
|
|
71
|
-
- `1` — YAML syntax errors found
|
|
72
|
-
- `2` — validation warnings only (missing permissions, secrets, etc.)
|
|
79
|
+
Contributing a `docs/templates/ci/gitlab/` set and adding `gitlab` to `FORGE_SUPPORTED_LIST` is the natural next slice — per-forge command mapping (`gh pr checks` → `glab ci status`) is not implemented yet.
|
|
73
80
|
|
|
74
|
-
###
|
|
81
|
+
### 4. Validate workflows (`--validate`)
|
|
75
82
|
|
|
76
|
-
|
|
83
|
+
See [REFERENCE.md](REFERENCE.md). Exit codes: `0` clean, `1` YAML syntax errors, `2` warnings only.
|
|
84
|
+
|
|
85
|
+
### 5. Dry-run workflows (`--dry-run`)
|
|
77
86
|
|
|
78
|
-
See [REFERENCE.md](REFERENCE.md)
|
|
87
|
+
See [REFERENCE.md](REFERENCE.md).
|
|
79
88
|
|
|
80
89
|
> **act** runs workflows in a local Docker environment — the most accurate pre-push validation.
|
|
81
|
-
> **gh workflow run** sends the workflow to GitHub but
|
|
90
|
+
> **gh workflow run** sends the workflow to GitHub but does not execute locally.
|
|
82
91
|
|
|
83
92
|
### 6. Document common CI failure patterns
|
|
84
93
|
|
|
85
|
-
Add the following to the project's documentation or CLAUDE.md after setup:
|
|
86
|
-
|
|
87
94
|
| Failure | Cause | Fix |
|
|
88
95
|
|---------|-------|-----|
|
|
89
|
-
| `npm publish` fails | `NPM_TOKEN` not set as repo secret | Add `NPM_TOKEN` to
|
|
90
|
-
| `semantic-release` fails on push | Missing `permissions: contents: write` | Add
|
|
91
|
-
| `cargo publish` auth fail | `CARGO_REGISTRY_TOKEN` not set | Add token to `~/.cargo/config.toml`
|
|
92
|
-
| `go vet` fails | Go version mismatch |
|
|
93
|
-
| `cargo clippy` errors | New lints
|
|
94
|
-
| `act` not found | Docker not running or act
|
|
95
|
-
| Hardcoded Node version stale | `.nvmrc` exists but workflow
|
|
96
|
-
| Deploy never runs | TBR workflow renamed | Keep `name: Test Build Release`
|
|
97
|
-
| Release rebuilds binary | Artifact not downloaded | `release`
|
|
96
|
+
| `npm publish` fails | `NPM_TOKEN` not set as repo secret | Add `NPM_TOKEN` to repo secrets |
|
|
97
|
+
| `semantic-release` fails on push | Missing `permissions: contents: write` | Add it to the release job |
|
|
98
|
+
| `cargo publish` auth fail | `CARGO_REGISTRY_TOKEN` not set | Add token to env or `~/.cargo/config.toml` |
|
|
99
|
+
| `go vet` fails | Go version mismatch | Use `go-version-file: go.mod` |
|
|
100
|
+
| `cargo clippy` errors | New nightly lints | Pin the toolchain; `cargo clippy --fix` |
|
|
101
|
+
| `act` not found | Docker not running or act missing | `brew install act`; `docker ps` |
|
|
102
|
+
| Hardcoded Node version stale | `.nvmrc` exists but workflow hardcodes | Use `node-version-file: .nvmrc` |
|
|
103
|
+
| Deploy never runs | TBR workflow renamed | Keep `name: Test Build Release` |
|
|
104
|
+
| Release rebuilds binary | Artifact not downloaded | `release` must `download-artifact` from `build` |
|
|
98
105
|
|
|
99
106
|
## Verify
|
|
100
107
|
|
|
101
|
-
→ verify: `
|
|
108
|
+
→ verify: `bash scripts/wire-ci.sh --self-test`
|
|
109
|
+
→ verify: `test -f docs/templates/ci/github/test-build-release-node.yml && test -f scripts/lib/detect-forge.sh`
|
|
102
110
|
→ verify: `grep -q wire-ci SKILL-INDEX.md`
|
|
103
111
|
|
|
104
112
|
---
|
|
@@ -121,19 +129,26 @@ Add the following to the project's documentation or CLAUDE.md after setup:
|
|
|
121
129
|
### Create CI for a Go project (TBR + optional deploy)
|
|
122
130
|
|
|
123
131
|
```bash
|
|
124
|
-
#
|
|
125
|
-
|
|
126
|
-
|
|
132
|
+
# Resolve forge + stack, then apply the bundled template
|
|
133
|
+
bash scripts/wire-ci.sh --detect
|
|
134
|
+
bash scripts/wire-ci.sh --apply
|
|
127
135
|
|
|
128
136
|
wire-ci --validate
|
|
129
137
|
wire-ci --dry-run
|
|
130
138
|
```
|
|
131
139
|
|
|
140
|
+
To use your own org templates instead of the bundled ones:
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
BIGPOWERS_CI_TEMPLATES=/path/to/your/templates bash scripts/wire-ci.sh --apply
|
|
144
|
+
```
|
|
145
|
+
|
|
132
146
|
### Create CI for a CLI tool (TBR only, no deploy)
|
|
133
147
|
|
|
134
148
|
```bash
|
|
135
|
-
|
|
149
|
+
bash scripts/wire-ci.sh --apply
|
|
136
150
|
# Edit release job to download build artifact — see big-release dogfood
|
|
151
|
+
# CLI/library repos: delete deploy.yml; the release job is terminal.
|
|
137
152
|
|
|
138
153
|
wire-ci --validate
|
|
139
154
|
```
|
|
@@ -277,6 +292,10 @@ jobs:
|
|
|
277
292
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
278
293
|
run-id: ${{ github.event.workflow_run.id }}
|
|
279
294
|
path: deploy-meta
|
|
295
|
+
# BigBase-specific composite action, not a bigpowers default: this deploy
|
|
296
|
+
# example targets the author's own hosting stack. Replace it with your
|
|
297
|
+
# platform's deploy step (or drop the deploy job entirely for CLI and
|
|
298
|
+
# library repos). bigpowers itself ships no deploy templates. (GH #104)
|
|
280
299
|
- uses: danielvm-git/.github/actions/bigbase-deploy@9c56ac10c629f3baa110ddb19136579e3c90d690 # v1
|
|
281
300
|
with:
|
|
282
301
|
site_id: ${{ secrets.BIGBASE_SITE_ID }}
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,24 @@
|
|
|
1
|
+
## [2.86.4](https://github.com/danielvm-git/bigpowers/compare/v2.86.3...v2.86.4) (2026-07-26)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **specs:** reconcile planning SoT drift and gate it with G-12 ([d8553a7](https://github.com/danielvm-git/bigpowers/commit/d8553a748d4cdc81fa612564f84600a62c4789ce))
|
|
7
|
+
|
|
8
|
+
## [2.86.3](https://github.com/danielvm-git/bigpowers/compare/v2.86.2...v2.86.3) (2026-07-26)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* **adapters:** make copy-mode context wiring idempotent ([2154e5f](https://github.com/danielvm-git/bigpowers/commit/2154e5f55140c8cb8f9c0ea22a7ea7bacf55f99e)), closes [#106](https://github.com/danielvm-git/bigpowers/issues/106)
|
|
14
|
+
* **specs:** give e60s01 a runnable verify ([585f0aa](https://github.com/danielvm-git/bigpowers/commit/585f0aa78ecc25dba5c13fccd1090c1b626900af)), closes [#106](https://github.com/danielvm-git/bigpowers/issues/106)
|
|
15
|
+
* **sync:** restore .pi and .gemini artifacts dropped by a concurrent sync ([b901340](https://github.com/danielvm-git/bigpowers/commit/b901340d08cbd74e34853beb8e9aad6fbec66698))
|
|
16
|
+
* **test:** scope agy gemini-path assertion to install_agy body ([1ac37f0](https://github.com/danielvm-git/bigpowers/commit/1ac37f0c0673e031996b7d9dde8ba0304d2a6ca1)), closes [#106](https://github.com/danielvm-git/bigpowers/issues/106)
|
|
17
|
+
* **test:** stop ta_cleanup EXIT trap forcing exit 1 ([cd409ef](https://github.com/danielvm-git/bigpowers/commit/cd409efcf2d8d92f8796114f50871cd55538067d)), closes [#106](https://github.com/danielvm-git/bigpowers/issues/106)
|
|
18
|
+
* **verify:** execute story-level verify: commands ([#106](https://github.com/danielvm-git/bigpowers/issues/106)) ([9b3f82a](https://github.com/danielvm-git/bigpowers/commit/9b3f82a18c18014a70380e1062de81c268639ef9)), closes [#96](https://github.com/danielvm-git/bigpowers/issues/96)
|
|
19
|
+
* **verify:** story-level verify and CI template fix ([#104](https://github.com/danielvm-git/bigpowers/issues/104), [#106](https://github.com/danielvm-git/bigpowers/issues/106)) ([049c7c9](https://github.com/danielvm-git/bigpowers/commit/049c7c9529fa0584b6823033e68e2fb7281ff750))
|
|
20
|
+
* **wire-ci:** un-hardcode template source, skip unsupported forges ([#104](https://github.com/danielvm-git/bigpowers/issues/104)) ([31a6fac](https://github.com/danielvm-git/bigpowers/commit/31a6fac06f823b55a00b38637d06f01b555b25c8))
|
|
21
|
+
|
|
1
22
|
## [2.86.2](https://github.com/danielvm-git/bigpowers/compare/v2.86.1...v2.86.2) (2026-07-26)
|
|
2
23
|
|
|
3
24
|
|
package/SKILL-INDEX.md
CHANGED
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
| 37 | Build | `quick-fix` | "Streamlined fast-path for trivial data-only fixes — no TDD, no branching cere | ✅ Active |
|
|
66
66
|
| 38 | Build | `setup-environment` | Pre-install dependencies and configure tools before development work begins. Use | ✅ Active |
|
|
67
67
|
| 39 | Build | `spike-prototype` | Throw-away prototype for unknown problem spaces. Output is learning notes in spe | ✅ Active |
|
|
68
|
-
| 40 | Build | `wire-ci` | "CI pipeline setup with
|
|
68
|
+
| 40 | Build | `wire-ci` | "CI pipeline setup with bundled, forge-neutral templates and local validation. D | ✅ Active |
|
|
69
69
|
| 41 | Build | `wire-observability` | Add structured JSON logging, observability commands, and idempotent setup script | ✅ Active |
|
|
70
70
|
| 42 | Verify | `audit-code` | Self-review checklist for the coding agent to run before dispatching a reviewer. | ✅ Active |
|
|
71
71
|
| 43 | Verify | `context7-mcp` | Fetch current library docs via Context7 MCP instead of training data. Use when u | ✅ Active |
|
package/package.json
CHANGED
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# story: e51s04
|
|
3
|
+
# golden-g12-status-consistency.sh — Planning SoT Consistency Gate (G-12)
|
|
4
|
+
#
|
|
5
|
+
# CONVENTIONS.md § specs/ declares specs/execution-status.yaml the sole SoT for
|
|
6
|
+
# story state. Nothing enforced that. sync-status-from-epics.sh is a *seeder*:
|
|
7
|
+
# it preloads keys from execution-status.yaml itself and uses setdefault(), so
|
|
8
|
+
# an existing key keeps its old value and epic.yaml's stories[].status is never
|
|
9
|
+
# read. Story status written by build-epic step 8 into a capsule could therefore
|
|
10
|
+
# disagree with the SoT forever, undetected
|
|
11
|
+
# (BUG-2026-07-26-planning-sot-drift).
|
|
12
|
+
#
|
|
13
|
+
# This gate makes the two agree or fails.
|
|
14
|
+
#
|
|
15
|
+
# Authority model (CONVENTIONS.md § specs/): execution-status.yaml is the sole
|
|
16
|
+
# SoT for story state; a capsule's stories[].status is derived. Capsules under
|
|
17
|
+
# specs/epics/archive/ are frozen historical records — an archived shard that
|
|
18
|
+
# still reads 'todo' while the SoT reads 'done' is normal history, not drift, so
|
|
19
|
+
# archive/ is excluded. Status vocabulary is normalised before comparison
|
|
20
|
+
# ('passing' == 'done'; 'todo'/'planned'/'not-started' == 'backlog').
|
|
21
|
+
#
|
|
22
|
+
# Checks:
|
|
23
|
+
# 1. A LIVE capsule must not disagree with execution-status.yaml (both the
|
|
24
|
+
# stories: and development_status: sections). In practice this catches a
|
|
25
|
+
# capsule marked done by build-epic step 8 whose SoT was never updated.
|
|
26
|
+
# 2. Every capsule_dir in release-plan.yaml must resolve to a real directory.
|
|
27
|
+
# 3. A live capsule must not also exist under archive/ — two shards for one
|
|
28
|
+
# epic makes "which status is authoritative" undecidable.
|
|
29
|
+
#
|
|
30
|
+
# Usage: bash scripts/golden-g12-status-consistency.sh [--self-test]
|
|
31
|
+
# Exit 0: SoT is consistent
|
|
32
|
+
# Exit 1: drift detected (or, under --self-test, the gate failed to detect
|
|
33
|
+
# deliberately injected drift — a vacuous gate, G-08 bug class)
|
|
34
|
+
|
|
35
|
+
set -euo pipefail
|
|
36
|
+
source "$(dirname "${BASH_SOURCE[0]}")/lib/python-env.sh"
|
|
37
|
+
source "$(dirname "${BASH_SOURCE[0]}")/lib/skill-common.sh"
|
|
38
|
+
resolve_repo_root
|
|
39
|
+
|
|
40
|
+
RED='\033[0;31m'
|
|
41
|
+
GREEN='\033[0;32m'
|
|
42
|
+
NC='\033[0m'
|
|
43
|
+
|
|
44
|
+
SELF_TEST=0
|
|
45
|
+
[[ "${1:-}" == "--self-test" ]] && SELF_TEST=1
|
|
46
|
+
|
|
47
|
+
check_tree() {
|
|
48
|
+
# $1 = specs dir to check
|
|
49
|
+
$PYTHON - "$1" <<'PY'
|
|
50
|
+
import sys, re
|
|
51
|
+
from pathlib import Path
|
|
52
|
+
import yaml
|
|
53
|
+
|
|
54
|
+
specs = Path(sys.argv[1])
|
|
55
|
+
epics_dir = specs / "epics"
|
|
56
|
+
exec_path = specs / "execution-status.yaml"
|
|
57
|
+
rp_path = specs / "release-plan.yaml"
|
|
58
|
+
|
|
59
|
+
problems = []
|
|
60
|
+
archived_skipped = 0
|
|
61
|
+
|
|
62
|
+
# Status vocabulary normalisation — different skills have written different
|
|
63
|
+
# words for the same state over the repo's history.
|
|
64
|
+
ALIASES = {
|
|
65
|
+
"passing": "done",
|
|
66
|
+
"complete": "done",
|
|
67
|
+
"completed": "done",
|
|
68
|
+
"todo": "backlog",
|
|
69
|
+
"planned": "backlog",
|
|
70
|
+
"not-started": "backlog",
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def norm(v):
|
|
75
|
+
return ALIASES.get(str(v).strip().lower(), str(v).strip().lower())
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
exec_data = yaml.safe_load(exec_path.read_text(encoding="utf-8")) or {}
|
|
79
|
+
dev = exec_data.get("development_status") or {}
|
|
80
|
+
stories = exec_data.get("stories") or {}
|
|
81
|
+
|
|
82
|
+
# --- Check 1: LIVE epic.yaml story status vs execution-status.yaml ---
|
|
83
|
+
for epic_file in sorted(epics_dir.rglob("epic.yaml")):
|
|
84
|
+
rel = epic_file.relative_to(specs)
|
|
85
|
+
if "archive" in epic_file.relative_to(epics_dir).parts:
|
|
86
|
+
archived_skipped += 1
|
|
87
|
+
continue
|
|
88
|
+
|
|
89
|
+
try:
|
|
90
|
+
ed = yaml.safe_load(epic_file.read_text(encoding="utf-8")) or {}
|
|
91
|
+
except Exception as exc:
|
|
92
|
+
problems.append(f"unparseable epic shard {rel}: {exc}")
|
|
93
|
+
continue
|
|
94
|
+
|
|
95
|
+
for story in ed.get("stories") or []:
|
|
96
|
+
if not isinstance(story, dict):
|
|
97
|
+
continue
|
|
98
|
+
sid = story.get("id")
|
|
99
|
+
declared = story.get("status")
|
|
100
|
+
if not sid or not declared:
|
|
101
|
+
continue
|
|
102
|
+
if not re.match(r"^e\d+s\d+$", str(sid)):
|
|
103
|
+
continue
|
|
104
|
+
|
|
105
|
+
sot_detail = stories.get(sid, {})
|
|
106
|
+
sot_detail = sot_detail.get("status") if isinstance(sot_detail, dict) else None
|
|
107
|
+
sot_summary = dev.get(sid)
|
|
108
|
+
|
|
109
|
+
if sot_detail is not None and norm(sot_detail) != norm(declared):
|
|
110
|
+
problems.append(
|
|
111
|
+
f"{sid}: {rel} says '{declared}' but execution-status.yaml "
|
|
112
|
+
f"stories.{sid}.status says '{sot_detail}'"
|
|
113
|
+
)
|
|
114
|
+
if sot_summary is not None and norm(sot_summary) != norm(declared):
|
|
115
|
+
problems.append(
|
|
116
|
+
f"{sid}: {rel} says '{declared}' but execution-status.yaml "
|
|
117
|
+
f"development_status.{sid} says '{sot_summary}'"
|
|
118
|
+
)
|
|
119
|
+
|
|
120
|
+
# --- Check 2: release-plan.yaml capsule_dir resolves ---
|
|
121
|
+
if rp_path.exists():
|
|
122
|
+
rp = yaml.safe_load(rp_path.read_text(encoding="utf-8")) or {}
|
|
123
|
+
for ep in rp.get("epics") or []:
|
|
124
|
+
if not isinstance(ep, dict):
|
|
125
|
+
continue
|
|
126
|
+
cd = ep.get("capsule_dir")
|
|
127
|
+
if cd and not (specs / cd).is_dir():
|
|
128
|
+
problems.append(
|
|
129
|
+
f"{ep.get('id')}: release-plan.yaml capsule_dir '{cd}' does not exist"
|
|
130
|
+
)
|
|
131
|
+
|
|
132
|
+
# --- Check 3: no epic has both a live and an archived capsule ---
|
|
133
|
+
archive_dir = epics_dir / "archive"
|
|
134
|
+
if archive_dir.is_dir():
|
|
135
|
+
live = {p.name for p in epics_dir.iterdir() if p.is_dir() and p.name != "archive"}
|
|
136
|
+
for p in archive_dir.iterdir():
|
|
137
|
+
if p.is_dir() and p.name in live:
|
|
138
|
+
problems.append(
|
|
139
|
+
f"{p.name}: capsule exists both live and under archive/ — "
|
|
140
|
+
f"authoritative status is undecidable"
|
|
141
|
+
)
|
|
142
|
+
|
|
143
|
+
if archived_skipped:
|
|
144
|
+
print(f" info: {archived_skipped} archived capsule(s) skipped (frozen history)")
|
|
145
|
+
|
|
146
|
+
if problems:
|
|
147
|
+
for p in problems:
|
|
148
|
+
print(f" DRIFT {p}")
|
|
149
|
+
print(f"\n{len(problems)} inconsistencies")
|
|
150
|
+
sys.exit(1)
|
|
151
|
+
|
|
152
|
+
print(" ok : epic shards, execution-status.yaml and release-plan.yaml agree")
|
|
153
|
+
sys.exit(0)
|
|
154
|
+
PY
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
if [[ "$SELF_TEST" -eq 1 ]]; then
|
|
158
|
+
echo "=== G-12 self-test: prove the gate can fail ==="
|
|
159
|
+
TMP=$(mktemp -d)
|
|
160
|
+
trap 'rm -rf "$TMP"' EXIT
|
|
161
|
+
# Copy only what check_tree reads — specs/ as a whole is ~28MB and the copy
|
|
162
|
+
# would dominate the gate's runtime.
|
|
163
|
+
mkdir -p "$TMP/specs"
|
|
164
|
+
cp -R "$REPO_ROOT/specs/epics" "$TMP/specs/epics"
|
|
165
|
+
cp "$REPO_ROOT/specs/execution-status.yaml" "$TMP/specs/"
|
|
166
|
+
cp "$REPO_ROOT/specs/release-plan.yaml" "$TMP/specs/"
|
|
167
|
+
|
|
168
|
+
# Inject drift into a LIVE capsule. Archived shards are excluded from the
|
|
169
|
+
# check, so mutating one would prove nothing — the gate would rightly stay
|
|
170
|
+
# silent and the self-test would report a false vacuity failure.
|
|
171
|
+
$PYTHON - "$TMP/specs" <<'PY'
|
|
172
|
+
import sys, re
|
|
173
|
+
from pathlib import Path
|
|
174
|
+
import yaml
|
|
175
|
+
|
|
176
|
+
specs = Path(sys.argv[1])
|
|
177
|
+
epics_dir = specs / "epics"
|
|
178
|
+
exec_path = specs / "execution-status.yaml"
|
|
179
|
+
data = yaml.safe_load(exec_path.read_text(encoding="utf-8")) or {}
|
|
180
|
+
|
|
181
|
+
for epic_file in sorted(epics_dir.rglob("epic.yaml")):
|
|
182
|
+
if "archive" in epic_file.relative_to(epics_dir).parts:
|
|
183
|
+
continue
|
|
184
|
+
ed = yaml.safe_load(epic_file.read_text(encoding="utf-8")) or {}
|
|
185
|
+
for story in ed.get("stories") or []:
|
|
186
|
+
if not isinstance(story, dict):
|
|
187
|
+
continue
|
|
188
|
+
sid, st = story.get("id"), story.get("status")
|
|
189
|
+
if sid and st and re.match(r"^e\d+s\d+$", str(sid)):
|
|
190
|
+
flipped = "backlog" if st != "backlog" else "done"
|
|
191
|
+
data.setdefault("stories", {}).setdefault(sid, {})["status"] = flipped
|
|
192
|
+
data.setdefault("development_status", {})[sid] = flipped
|
|
193
|
+
exec_path.write_text(
|
|
194
|
+
yaml.dump(data, default_flow_style=False, sort_keys=False),
|
|
195
|
+
encoding="utf-8",
|
|
196
|
+
)
|
|
197
|
+
print(f"injected: {sid} {st} -> {flipped} (live capsule)")
|
|
198
|
+
sys.exit(0)
|
|
199
|
+
print("ERROR: no live story with a status found to mutate", file=sys.stderr)
|
|
200
|
+
sys.exit(2)
|
|
201
|
+
PY
|
|
202
|
+
|
|
203
|
+
set +e
|
|
204
|
+
check_tree "$TMP/specs" >/dev/null 2>&1
|
|
205
|
+
injected_exit=$?
|
|
206
|
+
set -e
|
|
207
|
+
|
|
208
|
+
if [[ $injected_exit -ne 0 ]]; then
|
|
209
|
+
echo -e "${GREEN}PASS${NC} G-12 detected injected drift (exit $injected_exit)"
|
|
210
|
+
echo "G-12 self-test: PASS"
|
|
211
|
+
exit 0
|
|
212
|
+
fi
|
|
213
|
+
echo -e "${RED}FAIL${NC} G-12 passed on deliberately drifted specs — vacuous gate"
|
|
214
|
+
echo "G-12 self-test: FAIL — same bug class as G-08 / BUG-2026-07-26-planning-sot-drift"
|
|
215
|
+
exit 1
|
|
216
|
+
fi
|
|
217
|
+
|
|
218
|
+
echo "=== G-12: Planning SoT Consistency ==="
|
|
219
|
+
set +e
|
|
220
|
+
output=$(check_tree "$REPO_ROOT/specs" 2>&1)
|
|
221
|
+
actual_exit=$?
|
|
222
|
+
set -e
|
|
223
|
+
echo "$output"
|
|
224
|
+
|
|
225
|
+
if [[ $actual_exit -eq 0 ]]; then
|
|
226
|
+
echo -e "${GREEN}PASS${NC} planning SoT is consistent"
|
|
227
|
+
echo "G-12: PASS"
|
|
228
|
+
exit 0
|
|
229
|
+
fi
|
|
230
|
+
echo -e "${RED}FAIL${NC} planning SoT has drifted"
|
|
231
|
+
echo "G-12: FAIL — see BUG-2026-07-26-planning-sot-drift"
|
|
232
|
+
exit 1
|
|
Binary file
|
|
Binary file
|
|
@@ -54,6 +54,15 @@ wire_context_mode() {
|
|
|
54
54
|
symlink|copy)
|
|
55
55
|
[[ -n "$file" ]] || { echo "context-wire: file required for mode=$mode" >&2; return 1; }
|
|
56
56
|
if [[ "$mode" == "copy" ]]; then
|
|
57
|
+
[[ -f "$src" ]] || { echo "context-wire: source missing: $src" >&2; return 1; }
|
|
58
|
+
# Already wired — nothing to do. kilocode and windsurf declare
|
|
59
|
+
# `mode: copy, file: AGENTS.md` in targets.yaml, and the source is also
|
|
60
|
+
# AGENTS.md, so a bare `cp` fails with "are identical" and made
|
|
61
|
+
# wire_context non-idempotent. wire_symlink_or_copy already guards this;
|
|
62
|
+
# the copy branch did not. (#106)
|
|
63
|
+
if [[ -f "$file" ]] && cmp -s "$src" "$file" 2>/dev/null; then
|
|
64
|
+
return 0
|
|
65
|
+
fi
|
|
57
66
|
cp "$src" "$file"
|
|
58
67
|
else
|
|
59
68
|
wire_symlink_or_copy "$src" "$file"
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# story: GH-104-forge-neutrality
|
|
3
|
+
# detect-forge.sh — resolve which git forge a project uses.
|
|
4
|
+
#
|
|
5
|
+
# bigpowers ships to solo devs generally, but its CI advice assumed GitHub
|
|
6
|
+
# everywhere (GH #104). This is the seam: skills ask which forge is in play and
|
|
7
|
+
# what it supports, instead of hardcoding `gh` and `.github/workflows/`.
|
|
8
|
+
#
|
|
9
|
+
# Resolution order (first match wins):
|
|
10
|
+
# 1. BIGPOWERS_FORGE environment variable — explicit override
|
|
11
|
+
# 2. forge: key in specs/forge.yaml — per-project setting
|
|
12
|
+
# 3. the `origin` remote URL — inferred
|
|
13
|
+
# 4. "unknown" — no remote, or an unrecognized host
|
|
14
|
+
#
|
|
15
|
+
# Source this file, then call detect_forge / forge_is_supported / forge_ci_path.
|
|
16
|
+
|
|
17
|
+
if [[ -n "${DETECT_FORGE_LOADED:-}" ]]; then return 0; fi
|
|
18
|
+
DETECT_FORGE_LOADED=1
|
|
19
|
+
|
|
20
|
+
FORGE_UNKNOWN="unknown"
|
|
21
|
+
|
|
22
|
+
# Forges whose CI templates bigpowers actually ships. Anything else must be
|
|
23
|
+
# reported honestly and skipped — never silently handed GitHub Actions config.
|
|
24
|
+
FORGE_SUPPORTED_LIST="github"
|
|
25
|
+
|
|
26
|
+
_forge_from_remote_url() {
|
|
27
|
+
local url="$1"
|
|
28
|
+
case "$url" in
|
|
29
|
+
"") echo "$FORGE_UNKNOWN" ;;
|
|
30
|
+
*github.com[:/]*|*github.*.com[:/]*) echo "github" ;;
|
|
31
|
+
*gitlab.com[:/]*|*gitlab.*[:/]*) echo "gitlab" ;;
|
|
32
|
+
*bitbucket.org[:/]*) echo "bitbucket" ;;
|
|
33
|
+
*codeberg.org[:/]*) echo "codeberg" ;;
|
|
34
|
+
*gitea.*[:/]*) echo "gitea" ;;
|
|
35
|
+
*) echo "$FORGE_UNKNOWN" ;;
|
|
36
|
+
esac
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
_forge_from_config() {
|
|
40
|
+
local repo_root="$1"
|
|
41
|
+
local config="$repo_root/specs/forge.yaml"
|
|
42
|
+
[[ -f "$config" ]] || return 1
|
|
43
|
+
local value
|
|
44
|
+
value=$(grep -E '^forge:' "$config" 2>/dev/null | head -1 \
|
|
45
|
+
| sed -E 's/^forge:[[:space:]]*//; s/^"(.*)"$/\1/; s/[[:space:]]*$//')
|
|
46
|
+
[[ -n "$value" ]] || return 1
|
|
47
|
+
printf '%s' "$value"
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
# Echo the forge id. Never fails — an undetectable forge is "unknown", which
|
|
51
|
+
# callers must treat as "skip honestly", not as "assume GitHub".
|
|
52
|
+
detect_forge() {
|
|
53
|
+
local repo_root="${1:-.}"
|
|
54
|
+
|
|
55
|
+
if [[ -n "${BIGPOWERS_FORGE:-}" ]]; then
|
|
56
|
+
printf '%s\n' "$BIGPOWERS_FORGE"
|
|
57
|
+
return 0
|
|
58
|
+
fi
|
|
59
|
+
|
|
60
|
+
local configured
|
|
61
|
+
if configured=$(_forge_from_config "$repo_root"); then
|
|
62
|
+
printf '%s\n' "$configured"
|
|
63
|
+
return 0
|
|
64
|
+
fi
|
|
65
|
+
|
|
66
|
+
local url
|
|
67
|
+
url=$(git -C "$repo_root" remote get-url origin 2>/dev/null || echo "")
|
|
68
|
+
_forge_from_remote_url "$url"
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
forge_is_supported() {
|
|
72
|
+
local forge="$1"
|
|
73
|
+
case " $FORGE_SUPPORTED_LIST " in
|
|
74
|
+
*" $forge "*) return 0 ;;
|
|
75
|
+
*) return 1 ;;
|
|
76
|
+
esac
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
# Where a forge expects its CI config. Empty for unsupported forges — callers
|
|
80
|
+
# must check forge_is_supported first rather than treating "" as a path.
|
|
81
|
+
forge_ci_path() {
|
|
82
|
+
local forge="$1"
|
|
83
|
+
case "$forge" in
|
|
84
|
+
github) echo ".github/workflows" ;;
|
|
85
|
+
gitlab) echo ".gitlab-ci.yml" ;;
|
|
86
|
+
*) echo "" ;;
|
|
87
|
+
esac
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
# Root of the bundled CI templates. Overridable so a user can point at their own
|
|
91
|
+
# org templates; the previous hardcoded `danielvm-git/.github` made every
|
|
92
|
+
# installation depend on one person's personal repository.
|
|
93
|
+
#
|
|
94
|
+
# Resolved against the bigpowers package — NOT the target project. Templates
|
|
95
|
+
# ship with bigpowers; deriving this from the project being wired would look for
|
|
96
|
+
# them inside the user's repo, where they do not exist.
|
|
97
|
+
forge_template_root() {
|
|
98
|
+
if [[ -n "${BIGPOWERS_CI_TEMPLATES:-}" ]]; then
|
|
99
|
+
printf '%s' "$BIGPOWERS_CI_TEMPLATES"
|
|
100
|
+
return 0
|
|
101
|
+
fi
|
|
102
|
+
local package_root
|
|
103
|
+
package_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
|
|
104
|
+
printf '%s' "$package_root/docs/templates/ci"
|
|
105
|
+
}
|