@logickernel/agileflow 0.4.0 → 0.4.1
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/README.md +133 -211
- package/docs/README.md +39 -24
- package/docs/best-practices.md +201 -234
- package/docs/branching-strategy.md +153 -254
- package/docs/cli-reference.md +84 -64
- package/docs/configuration.md +154 -167
- package/docs/conventional-commits.md +207 -160
- package/docs/getting-started.md +162 -117
- package/docs/installation.md +244 -106
- package/docs/migration-guide.md +212 -299
- package/docs/release-management.md +195 -384
- package/docs/troubleshooting.md +276 -250
- package/docs/version-centric-cicd.md +239 -116
- package/package.json +3 -2
package/docs/best-practices.md
CHANGED
|
@@ -1,339 +1,306 @@
|
|
|
1
|
-
# Best Practices
|
|
1
|
+
# Best Practices
|
|
2
2
|
|
|
3
|
-
This guide
|
|
3
|
+
This guide covers recommended practices for using AgileFlow effectively.
|
|
4
|
+
|
|
5
|
+
## Decoupled Pipeline Architecture
|
|
6
|
+
|
|
7
|
+
### Separate Versioning from Build/Deploy
|
|
8
|
+
|
|
9
|
+
AgileFlow works best with a decoupled architecture:
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
Versioning Workflow Release Workflow
|
|
13
|
+
────────────────── ─────────────────
|
|
14
|
+
on: push to main on: tag created
|
|
15
|
+
→ AgileFlow → build
|
|
16
|
+
→ create tag → deploy
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
**Benefits:**
|
|
20
|
+
- Clear separation of concerns
|
|
21
|
+
- Each pipeline has one responsibility
|
|
22
|
+
- Easy to rerun builds independently
|
|
23
|
+
|
|
24
|
+
### Version Workflow (Minimal)
|
|
25
|
+
|
|
26
|
+
Keep the versioning workflow simple:
|
|
27
|
+
|
|
28
|
+
```yaml
|
|
29
|
+
# ✅ Good — Focused on versioning only
|
|
30
|
+
name: Version
|
|
31
|
+
on:
|
|
32
|
+
push:
|
|
33
|
+
branches: [main]
|
|
34
|
+
jobs:
|
|
35
|
+
version:
|
|
36
|
+
steps:
|
|
37
|
+
- uses: actions/checkout@v4
|
|
38
|
+
with:
|
|
39
|
+
fetch-depth: 0
|
|
40
|
+
- run: npx @logickernel/agileflow github
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Release Workflow (Complete)
|
|
44
|
+
|
|
45
|
+
Put build and deploy logic in the tag-triggered workflow:
|
|
46
|
+
|
|
47
|
+
```yaml
|
|
48
|
+
# ✅ Good — Triggered by tag, handles build/deploy
|
|
49
|
+
name: Release
|
|
50
|
+
on:
|
|
51
|
+
push:
|
|
52
|
+
tags: ['v*']
|
|
53
|
+
jobs:
|
|
54
|
+
build:
|
|
55
|
+
# Build logic here
|
|
56
|
+
deploy:
|
|
57
|
+
# Deploy logic here
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
---
|
|
4
61
|
|
|
5
62
|
## Commit Message Best Practices
|
|
6
63
|
|
|
7
|
-
###
|
|
64
|
+
### Use Conventional Commits Consistently
|
|
8
65
|
|
|
9
66
|
```bash
|
|
10
|
-
# ✅ Good
|
|
67
|
+
# ✅ Good — Clear type and description
|
|
11
68
|
feat(auth): add OAuth2 login support
|
|
12
69
|
fix(api): handle null user ID gracefully
|
|
13
|
-
docs: update installation guide
|
|
14
70
|
|
|
15
|
-
# ❌ Bad
|
|
71
|
+
# ❌ Bad — Unclear
|
|
16
72
|
add oauth
|
|
17
73
|
fix bug
|
|
18
|
-
update docs
|
|
19
74
|
```
|
|
20
75
|
|
|
21
|
-
###
|
|
76
|
+
### Add Scopes for Organization
|
|
22
77
|
|
|
23
78
|
```bash
|
|
24
|
-
# ✅ Good
|
|
25
|
-
feat(auth): implement JWT
|
|
26
|
-
fix(api): resolve
|
|
79
|
+
# ✅ Good — Scoped commits
|
|
80
|
+
feat(auth): implement JWT validation
|
|
81
|
+
fix(api): resolve timeout issue
|
|
27
82
|
docs(readme): add troubleshooting section
|
|
28
|
-
|
|
29
|
-
# ❌ Bad - No scope
|
|
30
|
-
feat: implement JWT token validation
|
|
31
|
-
fix: resolve user lookup timeout
|
|
32
|
-
docs: add troubleshooting section
|
|
33
83
|
```
|
|
34
84
|
|
|
35
|
-
###
|
|
85
|
+
### Mark Breaking Changes Properly
|
|
36
86
|
|
|
37
87
|
```bash
|
|
38
|
-
# ✅ Good
|
|
39
|
-
feat
|
|
40
|
-
fix(api): handle database connection failures gracefully
|
|
41
|
-
docs: add comprehensive API reference
|
|
42
|
-
|
|
43
|
-
# ❌ Bad - Vague description
|
|
44
|
-
feat: add 2FA
|
|
45
|
-
fix: fix bug
|
|
46
|
-
docs: update docs
|
|
47
|
-
```
|
|
88
|
+
# ✅ Good — Breaking change marked
|
|
89
|
+
feat!: remove deprecated API endpoints
|
|
48
90
|
|
|
49
|
-
|
|
91
|
+
# ✅ Good — Using footer
|
|
92
|
+
feat: change API format
|
|
50
93
|
|
|
51
|
-
|
|
52
|
-
# ✅ Good - Breaking changes clearly marked
|
|
53
|
-
feat!: remove deprecated API endpoints
|
|
54
|
-
feat(auth)!: change user ID format to UUID
|
|
55
|
-
BREAKING CHANGE: modify database schema
|
|
94
|
+
BREAKING CHANGE: Response uses camelCase keys
|
|
56
95
|
|
|
57
|
-
# ❌ Bad
|
|
58
|
-
feat: remove deprecated
|
|
59
|
-
feat(auth): change user ID format to UUID
|
|
96
|
+
# ❌ Bad — Not marked
|
|
97
|
+
feat: remove deprecated endpoints
|
|
60
98
|
```
|
|
61
99
|
|
|
62
|
-
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
## Pipeline Best Practices
|
|
63
103
|
|
|
64
|
-
###
|
|
104
|
+
### Use Tag as Version
|
|
65
105
|
|
|
106
|
+
In your release workflow, extract the version from the tag:
|
|
107
|
+
|
|
108
|
+
**GitHub Actions:**
|
|
66
109
|
```yaml
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
stage: build
|
|
70
|
-
script:
|
|
71
|
-
- docker build -t myapp:${VERSION} .
|
|
72
|
-
- docker push myapp:${VERSION}
|
|
110
|
+
- name: Get version
|
|
111
|
+
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
|
|
73
112
|
|
|
74
|
-
|
|
75
|
-
build
|
|
76
|
-
stage: build
|
|
77
|
-
script:
|
|
78
|
-
- docker build -t myapp:latest .
|
|
79
|
-
- docker build -t myapp:${CI_COMMIT_REF_SLUG} .
|
|
113
|
+
- name: Build
|
|
114
|
+
run: docker build -t myapp:$VERSION .
|
|
80
115
|
```
|
|
81
116
|
|
|
82
|
-
|
|
83
|
-
|
|
117
|
+
**GitLab CI:**
|
|
84
118
|
```yaml
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
-
|
|
90
|
-
|
|
91
|
-
# ❌ Bad - No dependencies specified
|
|
92
|
-
deploy:
|
|
93
|
-
stage: deploy
|
|
119
|
+
build:
|
|
120
|
+
script:
|
|
121
|
+
- docker build -t myapp:$CI_COMMIT_TAG .
|
|
122
|
+
rules:
|
|
123
|
+
- if: '$CI_COMMIT_TAG =~ /^v/'
|
|
94
124
|
```
|
|
95
125
|
|
|
96
|
-
###
|
|
126
|
+
### Deploy Same Version Everywhere
|
|
97
127
|
|
|
98
128
|
```yaml
|
|
99
|
-
# ✅ Good
|
|
129
|
+
# ✅ Good — Same version for all environments
|
|
100
130
|
deploy-staging:
|
|
101
|
-
|
|
102
|
-
|
|
131
|
+
script:
|
|
132
|
+
- kubectl set image deployment/myapp myapp=myapp:$VERSION
|
|
103
133
|
|
|
104
134
|
deploy-production:
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
when: manual
|
|
135
|
+
script:
|
|
136
|
+
- kubectl set image deployment/myapp myapp=myapp:$VERSION
|
|
108
137
|
```
|
|
109
138
|
|
|
110
|
-
###
|
|
139
|
+
### Add Health Checks
|
|
111
140
|
|
|
112
141
|
```yaml
|
|
113
|
-
|
|
114
|
-
test:
|
|
115
|
-
stage: test
|
|
142
|
+
deploy:
|
|
116
143
|
script:
|
|
117
|
-
-
|
|
118
|
-
|
|
119
|
-
-
|
|
144
|
+
- kubectl set image deployment/myapp myapp=myapp:$VERSION
|
|
145
|
+
- kubectl rollout status deployment/myapp --timeout=300s
|
|
146
|
+
- ./health-check.sh
|
|
120
147
|
```
|
|
121
148
|
|
|
149
|
+
---
|
|
150
|
+
|
|
122
151
|
## Version Management Best Practices
|
|
123
152
|
|
|
124
|
-
###
|
|
153
|
+
### Keep Releases Small
|
|
125
154
|
|
|
126
|
-
-
|
|
127
|
-
-
|
|
128
|
-
-
|
|
155
|
+
- Small releases reduce risk
|
|
156
|
+
- Frequent releases provide faster feedback
|
|
157
|
+
- Focused changes simplify rollbacks
|
|
129
158
|
|
|
130
|
-
###
|
|
159
|
+
### Test Before Merging
|
|
131
160
|
|
|
132
|
-
-
|
|
133
|
-
-
|
|
134
|
-
-
|
|
161
|
+
- Unit tests pass on feature branches
|
|
162
|
+
- Integration tests run before merge
|
|
163
|
+
- Documentation updated with changes
|
|
135
164
|
|
|
136
|
-
###
|
|
165
|
+
### Plan for Rollbacks
|
|
137
166
|
|
|
167
|
+
**GitHub Actions:**
|
|
138
168
|
```yaml
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
169
|
+
rollback:
|
|
170
|
+
runs-on: ubuntu-latest
|
|
171
|
+
steps:
|
|
172
|
+
- uses: actions/checkout@v4
|
|
173
|
+
with:
|
|
174
|
+
fetch-depth: 0
|
|
175
|
+
- name: Rollback
|
|
176
|
+
run: |
|
|
177
|
+
PREVIOUS=$(git describe --tags --abbrev=0 HEAD^)
|
|
178
|
+
kubectl set image deployment/myapp myapp=myapp:$PREVIOUS
|
|
145
179
|
```
|
|
146
180
|
|
|
147
|
-
|
|
148
|
-
|
|
181
|
+
**GitLab CI:**
|
|
149
182
|
```yaml
|
|
150
|
-
|
|
151
|
-
deploy:
|
|
152
|
-
stage: deploy
|
|
183
|
+
rollback:
|
|
153
184
|
script:
|
|
154
|
-
-
|
|
155
|
-
- kubectl
|
|
156
|
-
|
|
185
|
+
- PREVIOUS=$(git describe --tags --abbrev=0 HEAD^)
|
|
186
|
+
- kubectl set image deployment/myapp myapp=myapp:$PREVIOUS
|
|
187
|
+
when: manual
|
|
157
188
|
```
|
|
158
189
|
|
|
159
|
-
|
|
190
|
+
---
|
|
160
191
|
|
|
161
|
-
|
|
192
|
+
## Security Best Practices
|
|
162
193
|
|
|
163
|
-
|
|
164
|
-
# ✅ Good - Protected and masked variables
|
|
165
|
-
variables:
|
|
166
|
-
AGILEFLOW_TOKEN: $AGILEFLOW_TOKEN # Protected and masked
|
|
167
|
-
GITLAB_USER_NAME: "AgileFlow Bot" # Not sensitive
|
|
168
|
-
|
|
169
|
-
# ❌ Bad - Exposed sensitive information
|
|
170
|
-
variables:
|
|
171
|
-
AGILEFLOW_TOKEN: "glpat-xxxxxxxxxxxxxxxxxxxx"
|
|
172
|
-
```
|
|
194
|
+
### Protect Tokens
|
|
173
195
|
|
|
174
|
-
|
|
196
|
+
**GitHub:**
|
|
197
|
+
- Use repository secrets (automatically protected)
|
|
198
|
+
- Rotate tokens regularly
|
|
175
199
|
|
|
176
|
-
|
|
177
|
-
-
|
|
178
|
-
-
|
|
200
|
+
**GitLab:**
|
|
201
|
+
- Mark variables as Protected and Masked
|
|
202
|
+
- Use project tokens over personal tokens
|
|
179
203
|
|
|
180
|
-
###
|
|
204
|
+
### Minimal Permissions
|
|
181
205
|
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
name: staging
|
|
187
|
-
variables:
|
|
188
|
-
DATABASE_URL: $STAGING_DATABASE_URL
|
|
206
|
+
| Platform | Required Permission |
|
|
207
|
+
|----------|---------------------|
|
|
208
|
+
| GitHub | `contents: write` |
|
|
209
|
+
| GitLab | `api` scope, `Maintainer` role |
|
|
189
210
|
|
|
190
|
-
|
|
191
|
-
environment:
|
|
192
|
-
name: production
|
|
193
|
-
variables:
|
|
194
|
-
DATABASE_URL: $PRODUCTION_DATABASE_URL
|
|
195
|
-
```
|
|
211
|
+
---
|
|
196
212
|
|
|
197
213
|
## Performance Best Practices
|
|
198
214
|
|
|
199
|
-
###
|
|
215
|
+
### Shallow Clone for Release Workflow
|
|
216
|
+
|
|
217
|
+
The release workflow doesn't need full history:
|
|
200
218
|
|
|
201
219
|
```yaml
|
|
202
|
-
#
|
|
220
|
+
# Versioning — needs full history
|
|
221
|
+
version:
|
|
222
|
+
steps:
|
|
223
|
+
- uses: actions/checkout@v4
|
|
224
|
+
with:
|
|
225
|
+
fetch-depth: 0 # Full history
|
|
226
|
+
|
|
227
|
+
# Release — doesn't need history
|
|
203
228
|
build:
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
paths:
|
|
208
|
-
- node_modules/
|
|
209
|
-
- .cache/
|
|
210
|
-
script:
|
|
211
|
-
- npm ci --cache .npm --prefer-offline
|
|
212
|
-
- npm run build
|
|
229
|
+
steps:
|
|
230
|
+
- uses: actions/checkout@v4
|
|
231
|
+
# Default shallow clone
|
|
213
232
|
```
|
|
214
233
|
|
|
215
|
-
###
|
|
234
|
+
### Cache Dependencies
|
|
216
235
|
|
|
217
236
|
```yaml
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
- docker build -t backend:${VERSION} ./backend
|
|
223
|
-
|
|
224
|
-
build-frontend:
|
|
225
|
-
stage: build
|
|
226
|
-
script:
|
|
227
|
-
- docker build -t frontend:${VERSION} ./frontend
|
|
228
|
-
|
|
229
|
-
# Both jobs can run in parallel
|
|
237
|
+
- uses: actions/cache@v4
|
|
238
|
+
with:
|
|
239
|
+
path: ~/.npm
|
|
240
|
+
key: npm-${{ hashFiles('package-lock.json') }}
|
|
230
241
|
```
|
|
231
242
|
|
|
232
|
-
###
|
|
243
|
+
### Parallel Jobs
|
|
233
244
|
|
|
234
245
|
```yaml
|
|
235
|
-
#
|
|
236
|
-
build:
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
- dist/
|
|
241
|
-
- build/
|
|
242
|
-
expire_in: 1 week
|
|
243
|
-
when: on_success
|
|
246
|
+
# Build jobs run in parallel
|
|
247
|
+
build-backend:
|
|
248
|
+
runs-on: ubuntu-latest
|
|
249
|
+
build-frontend:
|
|
250
|
+
runs-on: ubuntu-latest
|
|
244
251
|
```
|
|
245
252
|
|
|
246
|
-
|
|
253
|
+
---
|
|
247
254
|
|
|
248
|
-
|
|
255
|
+
## Documentation Best Practices
|
|
249
256
|
|
|
250
|
-
|
|
251
|
-
# ✅ Good - Clear job names and descriptions
|
|
252
|
-
build-production:
|
|
253
|
-
stage: build
|
|
254
|
-
description: "Build production artifacts with version ${VERSION}"
|
|
255
|
-
script:
|
|
256
|
-
- echo "Building version ${VERSION}"
|
|
257
|
-
```
|
|
257
|
+
### Write Meaningful Commit Messages
|
|
258
258
|
|
|
259
|
-
|
|
259
|
+
```bash
|
|
260
|
+
# ✅ Good — Becomes clear release note
|
|
261
|
+
feat(auth): add OAuth2 login with Google and GitHub providers
|
|
260
262
|
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
deploy:
|
|
264
|
-
stage: deploy
|
|
265
|
-
script:
|
|
266
|
-
- kubectl set image deployment/myapp myapp=myapp:${VERSION}
|
|
267
|
-
- echo "Deployed ${VERSION} at $(date)" >> deployment.log
|
|
263
|
+
# ❌ Bad — Poor release note
|
|
264
|
+
feat: add login
|
|
268
265
|
```
|
|
269
266
|
|
|
270
|
-
###
|
|
267
|
+
### Include Docs in Changes
|
|
271
268
|
|
|
272
|
-
```
|
|
273
|
-
|
|
274
|
-
deploy:
|
|
275
|
-
stage: deploy
|
|
276
|
-
script:
|
|
277
|
-
- |
|
|
278
|
-
if ! kubectl set image deployment/myapp myapp=myapp:${VERSION}; then
|
|
279
|
-
echo "Deployment failed for version ${VERSION}"
|
|
280
|
-
exit 1
|
|
281
|
-
fi
|
|
282
|
-
```
|
|
269
|
+
```bash
|
|
270
|
+
git commit -m "feat(auth): add OAuth2 login
|
|
283
271
|
|
|
284
|
-
|
|
272
|
+
- Implement OAuth2 flow
|
|
273
|
+
- Add configuration documentation
|
|
274
|
+
- Update API reference"
|
|
275
|
+
```
|
|
285
276
|
|
|
286
|
-
|
|
277
|
+
---
|
|
287
278
|
|
|
288
|
-
|
|
289
|
-
- **Gradually migrate** existing pipelines
|
|
290
|
-
- **Test thoroughly** before full migration
|
|
279
|
+
## Team Best Practices
|
|
291
280
|
|
|
292
|
-
###
|
|
281
|
+
### Establish Conventions
|
|
293
282
|
|
|
294
|
-
-
|
|
295
|
-
-
|
|
296
|
-
-
|
|
283
|
+
- Document commit message standards
|
|
284
|
+
- Use commit linting (commitlint, husky)
|
|
285
|
+
- Review commit messages in PRs
|
|
297
286
|
|
|
298
|
-
###
|
|
287
|
+
### Communicate Releases
|
|
299
288
|
|
|
300
289
|
```yaml
|
|
301
|
-
|
|
302
|
-
rollback:
|
|
303
|
-
stage: deploy
|
|
290
|
+
notify:
|
|
304
291
|
script:
|
|
305
292
|
- |
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
293
|
+
curl -X POST "$SLACK_WEBHOOK" \
|
|
294
|
+
-d "{\"text\": \"Released $VERSION\"}"
|
|
295
|
+
rules:
|
|
296
|
+
- if: '$CI_COMMIT_TAG =~ /^v/'
|
|
310
297
|
```
|
|
311
298
|
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
### 1. Keep Documentation Updated
|
|
315
|
-
|
|
316
|
-
- **Update README** with new features
|
|
317
|
-
- **Document breaking changes** clearly
|
|
318
|
-
- **Provide examples** for common use cases
|
|
319
|
-
|
|
320
|
-
### 2. Version-Specific Documentation
|
|
321
|
-
|
|
322
|
-
```yaml
|
|
323
|
-
# ✅ Good - Generate version-specific docs
|
|
324
|
-
docs:
|
|
325
|
-
stage: deploy
|
|
326
|
-
script:
|
|
327
|
-
- |
|
|
328
|
-
echo "# Version ${VERSION}" > docs/versions/${VERSION}.md
|
|
329
|
-
echo "Released: $(date)" >> docs/versions/${VERSION}.md
|
|
330
|
-
echo "Changes: $(git tag -l -n99 ${VERSION})" >> docs/versions/${VERSION}.md
|
|
331
|
-
```
|
|
299
|
+
---
|
|
332
300
|
|
|
333
301
|
## Related Documentation
|
|
334
302
|
|
|
335
|
-
- [Getting Started](./getting-started.md)
|
|
336
|
-
- [Conventional Commits](./conventional-commits.md)
|
|
337
|
-
- [
|
|
338
|
-
- [
|
|
339
|
-
- [Troubleshooting](./troubleshooting.md) - Common issues and solutions
|
|
303
|
+
- [Getting Started](./getting-started.md) — Quick start
|
|
304
|
+
- [Conventional Commits](./conventional-commits.md) — Commit format
|
|
305
|
+
- [Installation Guide](./installation.md) — Setup
|
|
306
|
+
- [Troubleshooting](./troubleshooting.md) — Common issues
|