bigpowers 2.34.1 → 2.35.0
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/security-review.md +323 -0
- 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/security-review/SKILL.md +324 -0
- 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 +14 -0
- package/README.md +4 -4
- package/SKILL-INDEX.md +2 -2
- 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/security-review/REFERENCE-confidence-rubric.md +85 -0
- package/security-review/REFERENCE-false-positives.md +68 -0
- package/security-review/REFERENCE-vuln-categories.md +103 -0
- package/security-review/SKILL.md +63 -0
- package/skills-lock.json +14 -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
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
# Validate Contracts — Reference
|
|
2
|
+
|
|
3
|
+
## Integration
|
|
4
|
+
|
|
5
|
+
- **Pre-deploy gate:** The `deploy` skill runs `validate-contracts` before smoke-test.
|
|
6
|
+
- **CI pipeline:** JSON Lines output is CI-friendly; pipe to `jq` for assertions.
|
|
7
|
+
- **Pre-migration:** Run `validate-contracts --shape` before consuming migration output.
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## Configuration
|
|
13
|
+
|
|
14
|
+
| Variable | Default | Description |
|
|
15
|
+
|----------|---------|-------------|
|
|
16
|
+
| `CONTRACTS_DIR` | `specs/contracts/` | Directory containing contract YAML files |
|
|
17
|
+
| `VALIDATE_ALL` | `false` | If true, run all contracts in the directory |
|
|
18
|
+
| `STRICT_MODE` | `false` | Treat warnings as failures |
|
|
19
|
+
| `OUTPUT_FORMAT` | `text` | `text` or `json` |
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## Verification
|
|
25
|
+
|
|
26
|
+
→ verify: `test -f validate-contracts/SKILL.md && grep -q 'name: validate-contracts' validate-contracts/SKILL.md && echo OK`
|
|
27
|
+
→ verify: `grep -qi 'specs/contracts\|JSON Schema\|key.set\|data.shape' validate-contracts/SKILL.md && echo OK`
|
|
28
|
+
→ verify: `grep -ci 'divergence\|missing key\|type mismatch\|diff\|conforms\|column' validate-contracts/SKILL.md | awk '{if($1>=3) print "OK"; else print "FAIL"}'`
|
|
29
|
+
→ 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"}'`
|
|
30
|
+
→ verify: `grep -q 'validate-contracts' SKILL-INDEX.md && echo OK`
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## Reference block 1
|
|
35
|
+
|
|
36
|
+
```yaml
|
|
37
|
+
# specs/contracts/users.schema.yaml
|
|
38
|
+
endpoint: /api/users
|
|
39
|
+
method: GET
|
|
40
|
+
schema:
|
|
41
|
+
type: object
|
|
42
|
+
required: [id, name, email]
|
|
43
|
+
properties:
|
|
44
|
+
id: { type: number }
|
|
45
|
+
name: { type: string }
|
|
46
|
+
email: { type: string, format: email }
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## Reference block 2
|
|
52
|
+
|
|
53
|
+
```yaml
|
|
54
|
+
# specs/contracts/migration-output.yaml
|
|
55
|
+
file: data/users-export.json
|
|
56
|
+
format: json
|
|
57
|
+
fields:
|
|
58
|
+
- name: user_id
|
|
59
|
+
type: number
|
|
60
|
+
required: true
|
|
61
|
+
- name: full_name
|
|
62
|
+
type: string
|
|
63
|
+
required: true
|
|
64
|
+
- name: created_at
|
|
65
|
+
type: string
|
|
66
|
+
format: date-time
|
|
67
|
+
required: false
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## Example 1
|
|
73
|
+
|
|
74
|
+
```
|
|
75
|
+
specs/contracts/
|
|
76
|
+
├── users.schema.yaml # API response schema
|
|
77
|
+
├── i18n-keys.yaml # Key-set comparison
|
|
78
|
+
├── migration-output.yaml # Data shape contract
|
|
79
|
+
└── README.md # Local conventions
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
## Example 2
|
|
85
|
+
|
|
86
|
+
```yaml
|
|
87
|
+
# specs/contracts/users.schema.yaml
|
|
88
|
+
endpoint: /api/users
|
|
89
|
+
method: GET
|
|
90
|
+
schema:
|
|
91
|
+
type: object
|
|
92
|
+
required: [id, name, email]
|
|
93
|
+
properties:
|
|
94
|
+
id: { type: number }
|
|
95
|
+
name: { type: string }
|
|
96
|
+
email: { type: string, format: email }
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
## Example 3
|
|
102
|
+
|
|
103
|
+
```yaml
|
|
104
|
+
# specs/contracts/i18n-keys.yaml
|
|
105
|
+
sources:
|
|
106
|
+
reference: src/frontend/locales/en.json
|
|
107
|
+
target: src/backend/messages/en.json
|
|
108
|
+
mode: subset # all target keys must exist in reference
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
## Example 4
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
validate-contracts --key-set specs/contracts/i18n-keys.yaml
|
|
117
|
+
# → missing: 2 keys in reference not found in target: ['settings.privacy', 'help.faq']
|
|
118
|
+
# → added: 1 key in target not in reference: ['deprecated.field']
|
|
119
|
+
# → exit 1 (divergence)
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
|
|
124
|
+
## Example 5
|
|
125
|
+
|
|
126
|
+
```yaml
|
|
127
|
+
# specs/contracts/migration-output.yaml
|
|
128
|
+
file: data/users-export.json
|
|
129
|
+
format: json
|
|
130
|
+
fields:
|
|
131
|
+
- name: user_id
|
|
132
|
+
type: number
|
|
133
|
+
required: true
|
|
134
|
+
- name: full_name
|
|
135
|
+
type: string
|
|
136
|
+
required: true
|
|
137
|
+
- name: created_at
|
|
138
|
+
type: string
|
|
139
|
+
format: date-time
|
|
140
|
+
required: false
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
---
|
|
144
|
+
|
|
145
|
+
## Example 6
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
validate-contracts --shape specs/contracts/migration-output.yaml
|
|
149
|
+
# → PASS: 3/3 fields validated, 5000 rows OK
|
|
150
|
+
# → WARN: field 'full_name' has 12 null values (0.24%)
|
|
151
|
+
# → FAIL: field 'user_id' has 3 rows with type string (expected number)
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
|
|
156
|
+
## Integration
|
|
157
|
+
|
|
158
|
+
- **Pre-deploy gate:** The `deploy` skill runs `validate-contracts` before smoke-test.
|
|
159
|
+
- **CI pipeline:** JSON Lines output is CI-friendly; pipe to `jq` for assertions.
|
|
160
|
+
- **Pre-migration:** Run `validate-contracts --shape` before consuming migration output.
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
---
|
|
164
|
+
|
|
165
|
+
## Configuration
|
|
166
|
+
|
|
167
|
+
| Variable | Default | Description |
|
|
168
|
+
|----------|---------|-------------|
|
|
169
|
+
| `CONTRACTS_DIR` | `specs/contracts/` | Directory containing contract YAML files |
|
|
170
|
+
| `VALIDATE_ALL` | `false` | If true, run all contracts in the directory |
|
|
171
|
+
| `STRICT_MODE` | `false` | Treat warnings as failures |
|
|
172
|
+
| `OUTPUT_FORMAT` | `text` | `text` or `json` |
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
---
|
|
176
|
+
|
|
177
|
+
## Verification
|
|
178
|
+
|
|
179
|
+
→ verify: `test -f validate-contracts/SKILL.md && grep -q 'name: validate-contracts' validate-contracts/SKILL.md && echo OK`
|
|
180
|
+
→ verify: `grep -qi 'specs/contracts\|JSON Schema\|key.set\|data.shape' validate-contracts/SKILL.md && echo OK`
|
|
181
|
+
→ verify: `grep -ci 'divergence\|missing key\|type mismatch\|diff\|conforms\|column' validate-contracts/SKILL.md | awk '{if($1>=3) print "OK"; else print "FAIL"}'`
|
|
182
|
+
→ 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"}'`
|
|
183
|
+
→ verify: `grep -q 'validate-contracts' SKILL-INDEX.md && echo OK`
|
|
@@ -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
|
+
```
|