bigpowers 2.34.1 → 2.34.2
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/.pi/package.json +2 -2
- package/.pi/prompts/deploy.md +53 -28
- package/.pi/prompts/develop-tdd.md +5 -80
- package/.pi/prompts/migrate-spec.md +273 -197
- package/.pi/prompts/publish-package.md +125 -67
- package/.pi/prompts/release-branch.md +85 -69
- package/.pi/prompts/smoke-test.md +98 -58
- package/.pi/prompts/using-bigpowers.md +2 -2
- package/.pi/prompts/validate-contracts.md +169 -54
- package/.pi/prompts/wire-ci.md +147 -89
- package/.pi/skills/deploy/SKILL.md +53 -28
- package/.pi/skills/develop-tdd/SKILL.md +5 -80
- package/.pi/skills/migrate-spec/SKILL.md +273 -197
- package/.pi/skills/publish-package/SKILL.md +125 -67
- package/.pi/skills/release-branch/SKILL.md +85 -69
- package/.pi/skills/smoke-test/SKILL.md +98 -58
- package/.pi/skills/using-bigpowers/SKILL.md +2 -2
- package/.pi/skills/validate-contracts/SKILL.md +169 -54
- package/.pi/skills/wire-ci/SKILL.md +147 -89
- package/CHANGELOG.md +7 -0
- package/README.md +4 -4
- package/SKILL-INDEX.md +1 -1
- package/deploy/REFERENCE.md +82 -0
- package/deploy/SKILL.md +3 -63
- package/develop-tdd/SKILL.md +5 -80
- package/migrate-spec/REFERENCE.md +268 -0
- package/migrate-spec/SKILL.md +5 -199
- package/package.json +2 -2
- package/publish-package/REFERENCE.md +239 -0
- package/publish-package/SKILL.md +8 -192
- package/release-branch/REFERENCE.md +83 -0
- package/release-branch/SKILL.md +2 -69
- package/scripts/generate-reference-tables.sh +1 -0
- package/scripts/sync-skills.sh +4 -1
- package/skills-lock.json +9 -9
- package/smoke-test/REFERENCE.md +162 -0
- package/smoke-test/SKILL.md +5 -130
- package/using-bigpowers/SKILL.md +2 -2
- package/validate-contracts/REFERENCE.md +183 -0
- package/validate-contracts/SKILL.md +6 -77
- package/wire-ci/REFERENCE.md +257 -0
- package/wire-ci/SKILL.md +8 -210
|
@@ -28,30 +28,13 @@ Three modes of validation:
|
|
|
28
28
|
|
|
29
29
|
All contract files live in `specs/contracts/` and use YAML:
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
specs/contracts/
|
|
33
|
-
├── users.schema.yaml # API response schema
|
|
34
|
-
├── i18n-keys.yaml # Key-set comparison
|
|
35
|
-
├── migration-output.yaml # Data shape contract
|
|
36
|
-
└── README.md # Local conventions
|
|
37
|
-
```
|
|
31
|
+
See [REFERENCE.md](REFERENCE.md) for examples.
|
|
38
32
|
|
|
39
33
|
### 1. API Response Contracts (`--schema`)
|
|
40
34
|
|
|
41
35
|
Define expected API response shapes and validate live endpoints against them:
|
|
42
36
|
|
|
43
|
-
|
|
44
|
-
# specs/contracts/users.schema.yaml
|
|
45
|
-
endpoint: /api/users
|
|
46
|
-
method: GET
|
|
47
|
-
schema:
|
|
48
|
-
type: object
|
|
49
|
-
required: [id, name, email]
|
|
50
|
-
properties:
|
|
51
|
-
id: { type: number }
|
|
52
|
-
name: { type: string }
|
|
53
|
-
email: { type: string, format: email }
|
|
54
|
-
```
|
|
37
|
+
See [REFERENCE.md](REFERENCE.md) for examples.
|
|
55
38
|
|
|
56
39
|
Usage:
|
|
57
40
|
|
|
@@ -65,52 +48,21 @@ validate-contracts --schema specs/contracts/users.schema.yaml --url https://api.
|
|
|
65
48
|
|
|
66
49
|
Assert that two data sources share a consistent set of keys:
|
|
67
50
|
|
|
68
|
-
|
|
69
|
-
# specs/contracts/i18n-keys.yaml
|
|
70
|
-
sources:
|
|
71
|
-
reference: src/frontend/locales/en.json
|
|
72
|
-
target: src/backend/messages/en.json
|
|
73
|
-
mode: subset # all target keys must exist in reference
|
|
74
|
-
```
|
|
51
|
+
See [REFERENCE.md](REFERENCE.md) for examples.
|
|
75
52
|
|
|
76
53
|
Usage:
|
|
77
54
|
|
|
78
|
-
|
|
79
|
-
validate-contracts --key-set specs/contracts/i18n-keys.yaml
|
|
80
|
-
# → missing: 2 keys in reference not found in target: ['settings.privacy', 'help.faq']
|
|
81
|
-
# → added: 1 key in target not in reference: ['deprecated.field']
|
|
82
|
-
# → exit 1 (divergence)
|
|
83
|
-
```
|
|
55
|
+
See [REFERENCE.md](REFERENCE.md) for examples.
|
|
84
56
|
|
|
85
57
|
### 3. Data Shape Contracts (`--shape`)
|
|
86
58
|
|
|
87
59
|
Validate that a data file matches expected column types and constraints:
|
|
88
60
|
|
|
89
|
-
|
|
90
|
-
# specs/contracts/migration-output.yaml
|
|
91
|
-
file: data/users-export.json
|
|
92
|
-
format: json
|
|
93
|
-
fields:
|
|
94
|
-
- name: user_id
|
|
95
|
-
type: number
|
|
96
|
-
required: true
|
|
97
|
-
- name: full_name
|
|
98
|
-
type: string
|
|
99
|
-
required: true
|
|
100
|
-
- name: created_at
|
|
101
|
-
type: string
|
|
102
|
-
format: date-time
|
|
103
|
-
required: false
|
|
104
|
-
```
|
|
61
|
+
See [REFERENCE.md](REFERENCE.md) for examples.
|
|
105
62
|
|
|
106
63
|
Usage:
|
|
107
64
|
|
|
108
|
-
|
|
109
|
-
validate-contracts --shape specs/contracts/migration-output.yaml
|
|
110
|
-
# → PASS: 3/3 fields validated, 5000 rows OK
|
|
111
|
-
# → WARN: field 'full_name' has 12 null values (0.24%)
|
|
112
|
-
# → FAIL: field 'user_id' has 3 rows with type string (expected number)
|
|
113
|
-
```
|
|
65
|
+
See [REFERENCE.md](REFERENCE.md) for examples.
|
|
114
66
|
|
|
115
67
|
## Process
|
|
116
68
|
|
|
@@ -157,26 +109,3 @@ FAILED: 1 contract has divergence
|
|
|
157
109
|
bash scripts/validate-contracts.sh <contract-file>
|
|
158
110
|
# → All pass → ready to deploy
|
|
159
111
|
```
|
|
160
|
-
|
|
161
|
-
## Integration
|
|
162
|
-
|
|
163
|
-
- **Pre-deploy gate:** The `deploy` skill runs `validate-contracts` before smoke-test.
|
|
164
|
-
- **CI pipeline:** JSON Lines output is CI-friendly; pipe to `jq` for assertions.
|
|
165
|
-
- **Pre-migration:** Run `validate-contracts --shape` before consuming migration output.
|
|
166
|
-
|
|
167
|
-
## Configuration
|
|
168
|
-
|
|
169
|
-
| Variable | Default | Description |
|
|
170
|
-
|----------|---------|-------------|
|
|
171
|
-
| `CONTRACTS_DIR` | `specs/contracts/` | Directory containing contract YAML files |
|
|
172
|
-
| `VALIDATE_ALL` | `false` | If true, run all contracts in the directory |
|
|
173
|
-
| `STRICT_MODE` | `false` | Treat warnings as failures |
|
|
174
|
-
| `OUTPUT_FORMAT` | `text` | `text` or `json` |
|
|
175
|
-
|
|
176
|
-
## Verification
|
|
177
|
-
|
|
178
|
-
→ verify: `test -f validate-contracts/SKILL.md && grep -q 'name: validate-contracts' validate-contracts/SKILL.md && echo OK`
|
|
179
|
-
→ verify: `grep -qi 'specs/contracts\|JSON Schema\|key.set\|data.shape' validate-contracts/SKILL.md && echo OK`
|
|
180
|
-
→ verify: `grep -ci 'divergence\|missing key\|type mismatch\|diff\|conforms\|column' validate-contracts/SKILL.md | awk '{if($1>=3) print "OK"; else print "FAIL"}'`
|
|
181
|
-
→ verify: `grep -ci 'JSON Lines\|machine.parse\|CI\|deploy.*gate\|pre.deploy' validate-contracts/SKILL.md | awk '{if($1>=2) print "OK"; else print "FAIL"}'`
|
|
182
|
-
→ verify: `grep -q 'validate-contracts' SKILL-INDEX.md && echo OK`
|
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
# Wire Ci — Reference
|
|
2
|
+
|
|
3
|
+
## Examples
|
|
4
|
+
|
|
5
|
+
### Create CI for a Rust project
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# Detect from Cargo.toml, generate workflows
|
|
9
|
+
wire-ci
|
|
10
|
+
|
|
11
|
+
# Validate generated workflows
|
|
12
|
+
wire-ci --validate
|
|
13
|
+
|
|
14
|
+
# Run locally with act
|
|
15
|
+
wire-ci --dry-run
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
### Create CI for a Node project with semantic-release
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
wire-ci
|
|
22
|
+
wire-ci --validate
|
|
23
|
+
# Expect warning: "npm publish step found but no NPM_TOKEN in secrets"
|
|
24
|
+
# Fix: add NPM_TOKEN to repo secrets
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### Validate existing workflows (no generation)
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
wire-ci --validate --check-only
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## Options
|
|
37
|
+
|
|
38
|
+
| Flag | Description |
|
|
39
|
+
|------|-------------|
|
|
40
|
+
| `--validate` | Check YAML syntax, permissions, secrets, common pitfalls |
|
|
41
|
+
| `--dry-run` | Run workflows locally via `act` or dispatch via `gh` |
|
|
42
|
+
| `--check-only` | Only validate, do not generate new files |
|
|
43
|
+
| `--type <type>` | Force project type (skip auto-detection) |
|
|
44
|
+
| `--force` | Overwrite existing workflow files |
|
|
45
|
+
| `--no-release` | Skip release workflow generation even if semantic-release detected |
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## Integration with build-epic
|
|
51
|
+
|
|
52
|
+
When `wire-ci` is used as part of `build-epic`:
|
|
53
|
+
|
|
54
|
+
1. **During develop-tdd**: If the task modifies `.github/workflows/`, run `wire-ci --validate` as a CI dry-run sub-step
|
|
55
|
+
2. **During release-branch**: After push, run `gh run list --limit 1 --branch main --json status,conclusion` to verify CI passes
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## Reference block 1
|
|
60
|
+
|
|
61
|
+
```yaml
|
|
62
|
+
name: CI
|
|
63
|
+
on: [push, pull_request]
|
|
64
|
+
jobs:
|
|
65
|
+
test:
|
|
66
|
+
runs-on: ubuntu-latest
|
|
67
|
+
steps:
|
|
68
|
+
- uses: actions/checkout@v4
|
|
69
|
+
- uses: actions-rust/toolchain@v1
|
|
70
|
+
with:
|
|
71
|
+
toolchain: stable
|
|
72
|
+
components: clippy, rustfmt
|
|
73
|
+
- run: cargo fmt --all -- --check
|
|
74
|
+
- run: cargo clippy -- -D warnings
|
|
75
|
+
- run: cargo test
|
|
76
|
+
- run: cargo build --release
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
## Reference block 2
|
|
82
|
+
|
|
83
|
+
```yaml
|
|
84
|
+
name: CI
|
|
85
|
+
on: [push, pull_request]
|
|
86
|
+
jobs:
|
|
87
|
+
test:
|
|
88
|
+
runs-on: ubuntu-latest
|
|
89
|
+
steps:
|
|
90
|
+
- uses: actions/checkout@v4
|
|
91
|
+
- uses: actions/setup-node@v4
|
|
92
|
+
with:
|
|
93
|
+
node-version: 20
|
|
94
|
+
cache: npm
|
|
95
|
+
- run: npm ci
|
|
96
|
+
- run: npm test
|
|
97
|
+
- run: npm run lint 2>/dev/null || true
|
|
98
|
+
- run: npm run typecheck 2>/dev/null || true
|
|
99
|
+
- run: npm run build 2>/dev/null || true
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
## Reference block 3
|
|
105
|
+
|
|
106
|
+
```yaml
|
|
107
|
+
name: CI
|
|
108
|
+
on: [push, pull_request]
|
|
109
|
+
jobs:
|
|
110
|
+
test:
|
|
111
|
+
runs-on: ubuntu-latest
|
|
112
|
+
steps:
|
|
113
|
+
- uses: actions/checkout@v4
|
|
114
|
+
- uses: actions/setup-python@v5
|
|
115
|
+
with:
|
|
116
|
+
python-version: "3.12"
|
|
117
|
+
cache: pip
|
|
118
|
+
- run: pip install -e ".[dev]" || pip install -e .
|
|
119
|
+
- run: pip install pytest ruff mypy
|
|
120
|
+
- run: ruff check .
|
|
121
|
+
- run: mypy . 2>/dev/null || true
|
|
122
|
+
- run: pytest
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
## Reference block 4
|
|
128
|
+
|
|
129
|
+
```yaml
|
|
130
|
+
name: CI
|
|
131
|
+
on: [push, pull_request]
|
|
132
|
+
jobs:
|
|
133
|
+
test:
|
|
134
|
+
runs-on: ubuntu-latest
|
|
135
|
+
steps:
|
|
136
|
+
- uses: actions/checkout@v4
|
|
137
|
+
- uses: actions/setup-go@v5
|
|
138
|
+
with:
|
|
139
|
+
go-version: stable
|
|
140
|
+
cache: true
|
|
141
|
+
- run: go vet ./...
|
|
142
|
+
- run: go test ./...
|
|
143
|
+
- run: go build ./...
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
## Reference block 5
|
|
149
|
+
|
|
150
|
+
```yaml
|
|
151
|
+
name: CI
|
|
152
|
+
on: [push, pull_request]
|
|
153
|
+
jobs:
|
|
154
|
+
test:
|
|
155
|
+
runs-on: ubuntu-latest
|
|
156
|
+
steps:
|
|
157
|
+
- uses: actions/checkout@v4
|
|
158
|
+
- run: cmake -B build
|
|
159
|
+
- run: cmake --build build
|
|
160
|
+
- run: ctest --test-dir build
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
---
|
|
164
|
+
|
|
165
|
+
## Reference block 6
|
|
166
|
+
|
|
167
|
+
```yaml
|
|
168
|
+
name: Release
|
|
169
|
+
on:
|
|
170
|
+
push:
|
|
171
|
+
branches: [main]
|
|
172
|
+
jobs:
|
|
173
|
+
release:
|
|
174
|
+
runs-on: ubuntu-latest
|
|
175
|
+
permissions:
|
|
176
|
+
contents: write
|
|
177
|
+
issues: write
|
|
178
|
+
pull-requests: write
|
|
179
|
+
id-token: write
|
|
180
|
+
steps:
|
|
181
|
+
- uses: actions/checkout@v4
|
|
182
|
+
with:
|
|
183
|
+
fetch-depth: 0
|
|
184
|
+
- uses: actions/setup-node@v4
|
|
185
|
+
with:
|
|
186
|
+
node-version: 20
|
|
187
|
+
cache: npm
|
|
188
|
+
- run: npm ci
|
|
189
|
+
- run: npm run build 2>/dev/null || true
|
|
190
|
+
- run: npx semantic-release
|
|
191
|
+
env:
|
|
192
|
+
GITHUB_TOKEN: \${{ secrets.GITHUB_TOKEN }}
|
|
193
|
+
NPM_TOKEN: \${{ secrets.NPM_TOKEN }}
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
---
|
|
197
|
+
|
|
198
|
+
## Reference block 7
|
|
199
|
+
|
|
200
|
+
```bash
|
|
201
|
+
# Validate YAML syntax
|
|
202
|
+
for f in .github/workflows/*.yaml; do
|
|
203
|
+
python3 -c "import yaml; yaml.safe_load(open('$f'))" || echo "FAIL: $f has YAML syntax errors"
|
|
204
|
+
done
|
|
205
|
+
|
|
206
|
+
# Check permissions block presence
|
|
207
|
+
for f in .github/workflows/*.yaml; do
|
|
208
|
+
if grep -q "permissions:" "$f"; then
|
|
209
|
+
echo "OK: $f has permissions block"
|
|
210
|
+
else
|
|
211
|
+
echo "WARNING: $f missing permissions block — add one for security"
|
|
212
|
+
fi
|
|
213
|
+
done
|
|
214
|
+
|
|
215
|
+
# Check for npm publish without NPM_TOKEN
|
|
216
|
+
for f in .github/workflows/*.yaml; do
|
|
217
|
+
if grep -q "npm publish\|npx semantic-release" "$f"; then
|
|
218
|
+
if ! grep -q "NPM_TOKEN" "$f"; then
|
|
219
|
+
echo "WARNING: $f has npm publish/semantic-release but no NPM_TOKEN secret"
|
|
220
|
+
fi
|
|
221
|
+
fi
|
|
222
|
+
done
|
|
223
|
+
|
|
224
|
+
# Check for hardcoded Node versions
|
|
225
|
+
for f in .github/workflows/*.yaml; do
|
|
226
|
+
if grep -q "node-version: [0-9]" "$f" && grep -qv "node-version-file\|\.nvmrc" "$f"; then
|
|
227
|
+
echo "NOTE: $f has hardcoded Node version — consider using .nvmrc instead"
|
|
228
|
+
fi
|
|
229
|
+
done
|
|
230
|
+
|
|
231
|
+
# Check for common secrets reference errors
|
|
232
|
+
for f in .github/workflows/*.yaml; do
|
|
233
|
+
# Secrets referencing something that doesn't exist in the workflow
|
|
234
|
+
grep -oP 'secrets\.\w+' "$f" | sort -u | while read -r secret; do
|
|
235
|
+
echo "REF: $f references $secret"
|
|
236
|
+
done
|
|
237
|
+
done
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
---
|
|
241
|
+
|
|
242
|
+
## Reference block 8
|
|
243
|
+
|
|
244
|
+
```bash
|
|
245
|
+
# Option A: Use act (recommended)
|
|
246
|
+
if command -v act &>/dev/null; then
|
|
247
|
+
act push --dry-run
|
|
248
|
+
echo "OK: act dry-run completed"
|
|
249
|
+
elif command -v gh &>/dev/null; then
|
|
250
|
+
# Option B: Use gh workflow run (remote test, no local docker)
|
|
251
|
+
gh workflow run ci.yaml --ref "$(git branch --show-current)"
|
|
252
|
+
echo "OK: CI workflow dispatched. Check status: gh run list"
|
|
253
|
+
else
|
|
254
|
+
echo "NOTE: Install act (https://github.com/nektos/act) for full local dry-run"
|
|
255
|
+
echo " Install gh CLI for remote dry-run"
|
|
256
|
+
fi
|
|
257
|
+
```
|
package/wire-ci/SKILL.md
CHANGED
|
@@ -42,128 +42,25 @@ If no manifest is found, prompt the user to specify the type or pass `--type <ru
|
|
|
42
42
|
Create `.github/workflows/ci.yaml` with standard steps derived from the project type and its manifest:
|
|
43
43
|
|
|
44
44
|
**Rust template (`Cargo.toml`):**
|
|
45
|
-
|
|
46
|
-
name: CI
|
|
47
|
-
on: [push, pull_request]
|
|
48
|
-
jobs:
|
|
49
|
-
test:
|
|
50
|
-
runs-on: ubuntu-latest
|
|
51
|
-
steps:
|
|
52
|
-
- uses: actions/checkout@v4
|
|
53
|
-
- uses: actions-rust/toolchain@v1
|
|
54
|
-
with:
|
|
55
|
-
toolchain: stable
|
|
56
|
-
components: clippy, rustfmt
|
|
57
|
-
- run: cargo fmt --all -- --check
|
|
58
|
-
- run: cargo clippy -- -D warnings
|
|
59
|
-
- run: cargo test
|
|
60
|
-
- run: cargo build --release
|
|
61
|
-
```
|
|
45
|
+
See [REFERENCE.md](REFERENCE.md)
|
|
62
46
|
|
|
63
47
|
**Node template (`package.json`):**
|
|
64
|
-
|
|
65
|
-
name: CI
|
|
66
|
-
on: [push, pull_request]
|
|
67
|
-
jobs:
|
|
68
|
-
test:
|
|
69
|
-
runs-on: ubuntu-latest
|
|
70
|
-
steps:
|
|
71
|
-
- uses: actions/checkout@v4
|
|
72
|
-
- uses: actions/setup-node@v4
|
|
73
|
-
with:
|
|
74
|
-
node-version: 20
|
|
75
|
-
cache: npm
|
|
76
|
-
- run: npm ci
|
|
77
|
-
- run: npm test
|
|
78
|
-
- run: npm run lint 2>/dev/null || true
|
|
79
|
-
- run: npm run typecheck 2>/dev/null || true
|
|
80
|
-
- run: npm run build 2>/dev/null || true
|
|
81
|
-
```
|
|
48
|
+
See [REFERENCE.md](REFERENCE.md)
|
|
82
49
|
|
|
83
50
|
**Python template (`setup.py` / `pyproject.toml`):**
|
|
84
|
-
|
|
85
|
-
name: CI
|
|
86
|
-
on: [push, pull_request]
|
|
87
|
-
jobs:
|
|
88
|
-
test:
|
|
89
|
-
runs-on: ubuntu-latest
|
|
90
|
-
steps:
|
|
91
|
-
- uses: actions/checkout@v4
|
|
92
|
-
- uses: actions/setup-python@v5
|
|
93
|
-
with:
|
|
94
|
-
python-version: "3.12"
|
|
95
|
-
cache: pip
|
|
96
|
-
- run: pip install -e ".[dev]" || pip install -e .
|
|
97
|
-
- run: pip install pytest ruff mypy
|
|
98
|
-
- run: ruff check .
|
|
99
|
-
- run: mypy . 2>/dev/null || true
|
|
100
|
-
- run: pytest
|
|
101
|
-
```
|
|
51
|
+
See [REFERENCE.md](REFERENCE.md)
|
|
102
52
|
|
|
103
53
|
**Go template (`go.mod`):**
|
|
104
|
-
|
|
105
|
-
name: CI
|
|
106
|
-
on: [push, pull_request]
|
|
107
|
-
jobs:
|
|
108
|
-
test:
|
|
109
|
-
runs-on: ubuntu-latest
|
|
110
|
-
steps:
|
|
111
|
-
- uses: actions/checkout@v4
|
|
112
|
-
- uses: actions/setup-go@v5
|
|
113
|
-
with:
|
|
114
|
-
go-version: stable
|
|
115
|
-
cache: true
|
|
116
|
-
- run: go vet ./...
|
|
117
|
-
- run: go test ./...
|
|
118
|
-
- run: go build ./...
|
|
119
|
-
```
|
|
54
|
+
See [REFERENCE.md](REFERENCE.md)
|
|
120
55
|
|
|
121
56
|
**C/C++ template (`CMakeLists.txt`):**
|
|
122
|
-
|
|
123
|
-
name: CI
|
|
124
|
-
on: [push, pull_request]
|
|
125
|
-
jobs:
|
|
126
|
-
test:
|
|
127
|
-
runs-on: ubuntu-latest
|
|
128
|
-
steps:
|
|
129
|
-
- uses: actions/checkout@v4
|
|
130
|
-
- run: cmake -B build
|
|
131
|
-
- run: cmake --build build
|
|
132
|
-
- run: ctest --test-dir build
|
|
133
|
-
```
|
|
57
|
+
See [REFERENCE.md](REFERENCE.md)
|
|
134
58
|
|
|
135
59
|
### 3. Generate release workflow (if semantic-release detected)
|
|
136
60
|
|
|
137
61
|
If the project has semantic-release configured (in `package.json`, `.releaserc`, or `release.config.js`), also generate `.github/workflows/release.yaml`:
|
|
138
62
|
|
|
139
|
-
|
|
140
|
-
name: Release
|
|
141
|
-
on:
|
|
142
|
-
push:
|
|
143
|
-
branches: [main]
|
|
144
|
-
jobs:
|
|
145
|
-
release:
|
|
146
|
-
runs-on: ubuntu-latest
|
|
147
|
-
permissions:
|
|
148
|
-
contents: write
|
|
149
|
-
issues: write
|
|
150
|
-
pull-requests: write
|
|
151
|
-
id-token: write
|
|
152
|
-
steps:
|
|
153
|
-
- uses: actions/checkout@v4
|
|
154
|
-
with:
|
|
155
|
-
fetch-depth: 0
|
|
156
|
-
- uses: actions/setup-node@v4
|
|
157
|
-
with:
|
|
158
|
-
node-version: 20
|
|
159
|
-
cache: npm
|
|
160
|
-
- run: npm ci
|
|
161
|
-
- run: npm run build 2>/dev/null || true
|
|
162
|
-
- run: npx semantic-release
|
|
163
|
-
env:
|
|
164
|
-
GITHUB_TOKEN: \${{ secrets.GITHUB_TOKEN }}
|
|
165
|
-
NPM_TOKEN: \${{ secrets.NPM_TOKEN }}
|
|
166
|
-
```
|
|
63
|
+
See [REFERENCE.md](REFERENCE.md)
|
|
167
64
|
|
|
168
65
|
> **NPM_TOKEN is required** for publishing to npm. Without it, semantic-release will fail at the publish step. See `--validate` to check this.
|
|
169
66
|
|
|
@@ -171,45 +68,7 @@ jobs:
|
|
|
171
68
|
|
|
172
69
|
Run `wire-ci --validate` to check all generated workflow files:
|
|
173
70
|
|
|
174
|
-
|
|
175
|
-
# Validate YAML syntax
|
|
176
|
-
for f in .github/workflows/*.yaml; do
|
|
177
|
-
python3 -c "import yaml; yaml.safe_load(open('$f'))" || echo "FAIL: $f has YAML syntax errors"
|
|
178
|
-
done
|
|
179
|
-
|
|
180
|
-
# Check permissions block presence
|
|
181
|
-
for f in .github/workflows/*.yaml; do
|
|
182
|
-
if grep -q "permissions:" "$f"; then
|
|
183
|
-
echo "OK: $f has permissions block"
|
|
184
|
-
else
|
|
185
|
-
echo "WARNING: $f missing permissions block — add one for security"
|
|
186
|
-
fi
|
|
187
|
-
done
|
|
188
|
-
|
|
189
|
-
# Check for npm publish without NPM_TOKEN
|
|
190
|
-
for f in .github/workflows/*.yaml; do
|
|
191
|
-
if grep -q "npm publish\|npx semantic-release" "$f"; then
|
|
192
|
-
if ! grep -q "NPM_TOKEN" "$f"; then
|
|
193
|
-
echo "WARNING: $f has npm publish/semantic-release but no NPM_TOKEN secret"
|
|
194
|
-
fi
|
|
195
|
-
fi
|
|
196
|
-
done
|
|
197
|
-
|
|
198
|
-
# Check for hardcoded Node versions
|
|
199
|
-
for f in .github/workflows/*.yaml; do
|
|
200
|
-
if grep -q "node-version: [0-9]" "$f" && grep -qv "node-version-file\|\.nvmrc" "$f"; then
|
|
201
|
-
echo "NOTE: $f has hardcoded Node version — consider using .nvmrc instead"
|
|
202
|
-
fi
|
|
203
|
-
done
|
|
204
|
-
|
|
205
|
-
# Check for common secrets reference errors
|
|
206
|
-
for f in .github/workflows/*.yaml; do
|
|
207
|
-
# Secrets referencing something that doesn't exist in the workflow
|
|
208
|
-
grep -oP 'secrets\.\w+' "$f" | sort -u | while read -r secret; do
|
|
209
|
-
echo "REF: $f references $secret"
|
|
210
|
-
done
|
|
211
|
-
done
|
|
212
|
-
```
|
|
71
|
+
See [REFERENCE.md](REFERENCE.md)
|
|
213
72
|
|
|
214
73
|
**Exit codes:**
|
|
215
74
|
- `0` — all checks pass (no errors)
|
|
@@ -220,20 +79,7 @@ done
|
|
|
220
79
|
|
|
221
80
|
Attempt to run the generated workflows locally to catch errors before push:
|
|
222
81
|
|
|
223
|
-
|
|
224
|
-
# Option A: Use act (recommended)
|
|
225
|
-
if command -v act &>/dev/null; then
|
|
226
|
-
act push --dry-run
|
|
227
|
-
echo "OK: act dry-run completed"
|
|
228
|
-
elif command -v gh &>/dev/null; then
|
|
229
|
-
# Option B: Use gh workflow run (remote test, no local docker)
|
|
230
|
-
gh workflow run ci.yaml --ref "$(git branch --show-current)"
|
|
231
|
-
echo "OK: CI workflow dispatched. Check status: gh run list"
|
|
232
|
-
else
|
|
233
|
-
echo "NOTE: Install act (https://github.com/nektos/act) for full local dry-run"
|
|
234
|
-
echo " Install gh CLI for remote dry-run"
|
|
235
|
-
fi
|
|
236
|
-
```
|
|
82
|
+
See [REFERENCE.md](REFERENCE.md)
|
|
237
83
|
|
|
238
84
|
> **act** runs workflows in a local Docker environment — the most accurate pre-push validation.
|
|
239
85
|
> **gh workflow run** sends the workflow to GitHub but doesn't execute locally — useful for checking YAML parsing but not for testing the actual steps.
|
|
@@ -252,54 +98,6 @@ Add the following to the project's documentation or CLAUDE.md after setup:
|
|
|
252
98
|
| `act` not found | Docker not running or act not installed | `brew install act` / `docker ps` to verify Docker |
|
|
253
99
|
| Hardcoded Node version stale | `.nvmrc` exists but workflow uses hardcoded version | Use `node-version-file: .nvmrc` instead |
|
|
254
100
|
|
|
255
|
-
## Examples
|
|
256
|
-
|
|
257
|
-
### Create CI for a Rust project
|
|
258
|
-
|
|
259
|
-
```bash
|
|
260
|
-
# Detect from Cargo.toml, generate workflows
|
|
261
|
-
wire-ci
|
|
262
|
-
|
|
263
|
-
# Validate generated workflows
|
|
264
|
-
wire-ci --validate
|
|
265
|
-
|
|
266
|
-
# Run locally with act
|
|
267
|
-
wire-ci --dry-run
|
|
268
|
-
```
|
|
269
|
-
|
|
270
|
-
### Create CI for a Node project with semantic-release
|
|
271
|
-
|
|
272
|
-
```bash
|
|
273
|
-
wire-ci
|
|
274
|
-
wire-ci --validate
|
|
275
|
-
# Expect warning: "npm publish step found but no NPM_TOKEN in secrets"
|
|
276
|
-
# Fix: add NPM_TOKEN to repo secrets
|
|
277
|
-
```
|
|
278
|
-
|
|
279
|
-
### Validate existing workflows (no generation)
|
|
280
|
-
|
|
281
|
-
```bash
|
|
282
|
-
wire-ci --validate --check-only
|
|
283
|
-
```
|
|
284
|
-
|
|
285
|
-
## Options
|
|
286
|
-
|
|
287
|
-
| Flag | Description |
|
|
288
|
-
|------|-------------|
|
|
289
|
-
| `--validate` | Check YAML syntax, permissions, secrets, common pitfalls |
|
|
290
|
-
| `--dry-run` | Run workflows locally via `act` or dispatch via `gh` |
|
|
291
|
-
| `--check-only` | Only validate, do not generate new files |
|
|
292
|
-
| `--type <type>` | Force project type (skip auto-detection) |
|
|
293
|
-
| `--force` | Overwrite existing workflow files |
|
|
294
|
-
| `--no-release` | Skip release workflow generation even if semantic-release detected |
|
|
295
|
-
|
|
296
|
-
## Integration with build-epic
|
|
297
|
-
|
|
298
|
-
When `wire-ci` is used as part of `build-epic`:
|
|
299
|
-
|
|
300
|
-
1. **During develop-tdd**: If the task modifies `.github/workflows/`, run `wire-ci --validate` as a CI dry-run sub-step
|
|
301
|
-
2. **During release-branch**: After push, run `gh run list --limit 1 --branch main --json status,conclusion` to verify CI passes
|
|
302
|
-
|
|
303
101
|
## Verify
|
|
304
102
|
|
|
305
103
|
→ verify: `test -f wire-ci/SKILL.md && echo "OK: skill file exists" || echo "FAIL: no skill file"`
|