@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/installation.md
CHANGED
|
@@ -1,163 +1,301 @@
|
|
|
1
|
-
# Installation
|
|
1
|
+
# Installation Guide
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
AgileFlow requires no installation for local use — just run it with npx. For CI/CD integration, you'll configure a workflow that creates version tags, which then trigger your build and deploy pipelines.
|
|
4
4
|
|
|
5
5
|
## Prerequisites
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
- **Node.js 14+** (or a Node.js CI image)
|
|
8
|
+
- **Git repository** with commit history
|
|
9
|
+
- **Access token** with permission to create tags
|
|
8
10
|
|
|
9
|
-
|
|
10
|
-
- **GitLab Access**: Access to modify `.gitlab-ci.yml` files and CI/CD variables
|
|
11
|
-
- **Basic Knowledge**: Understanding of Git, CI/CD, and Docker concepts
|
|
11
|
+
## Local Usage
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
Preview your next version without any setup:
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
```bash
|
|
16
|
+
npx @logickernel/agileflow
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Or install globally:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npm install -g @logickernel/agileflow
|
|
23
|
+
agileflow
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## Architecture Overview
|
|
29
|
+
|
|
30
|
+
AgileFlow uses a **decoupled two-step approach**:
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
┌─────────────────┐ ┌─────────────────┐
|
|
34
|
+
│ Merge to main │ │ Tag: v1.2.3 │
|
|
35
|
+
│ │ ──────▶ │ │
|
|
36
|
+
│ (AgileFlow │ │ (Your build/ │
|
|
37
|
+
│ creates tag) │ │ deploy runs) │
|
|
38
|
+
└─────────────────┘ └─────────────────┘
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
1. **Versioning workflow**: Runs AgileFlow on merge to main → creates version tag
|
|
42
|
+
2. **Release workflow**: Triggered by tag creation → builds and deploys
|
|
16
43
|
|
|
17
|
-
|
|
44
|
+
This separation keeps versioning independent from your build/deploy process.
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## GitHub Actions
|
|
49
|
+
|
|
50
|
+
### Step 1: Create an Access Token
|
|
51
|
+
|
|
52
|
+
1. Go to **Settings → Developer settings → Personal access tokens → Fine-grained tokens**
|
|
53
|
+
2. Click **Generate new token**
|
|
54
|
+
3. Configure:
|
|
55
|
+
- **Name**: `AgileFlow`
|
|
56
|
+
- **Repository access**: Select your repositories
|
|
57
|
+
- **Permissions**: `Contents: Read and write`
|
|
58
|
+
4. Copy the token
|
|
59
|
+
|
|
60
|
+
### Step 2: Add the Token as a Secret
|
|
61
|
+
|
|
62
|
+
1. Go to your repository's **Settings → Secrets and variables → Actions**
|
|
63
|
+
2. Click **New repository secret**
|
|
64
|
+
3. Add:
|
|
65
|
+
- **Name**: `AGILEFLOW_TOKEN`
|
|
66
|
+
- **Value**: Your token
|
|
67
|
+
|
|
68
|
+
### Step 3: Create the Versioning Workflow
|
|
69
|
+
|
|
70
|
+
Create `.github/workflows/version.yml`:
|
|
18
71
|
|
|
19
72
|
```yaml
|
|
20
|
-
|
|
21
|
-
|
|
73
|
+
name: Version
|
|
74
|
+
on:
|
|
75
|
+
push:
|
|
76
|
+
branches: [main]
|
|
77
|
+
|
|
78
|
+
jobs:
|
|
79
|
+
version:
|
|
80
|
+
runs-on: ubuntu-latest
|
|
81
|
+
steps:
|
|
82
|
+
- uses: actions/checkout@v4
|
|
83
|
+
with:
|
|
84
|
+
fetch-depth: 0 # Required for commit history
|
|
85
|
+
|
|
86
|
+
- uses: actions/setup-node@v4
|
|
87
|
+
with:
|
|
88
|
+
node-version: '20'
|
|
89
|
+
|
|
90
|
+
- name: Create version tag
|
|
91
|
+
env:
|
|
92
|
+
AGILEFLOW_TOKEN: ${{ secrets.AGILEFLOW_TOKEN }}
|
|
93
|
+
run: npx @logickernel/agileflow github
|
|
22
94
|
```
|
|
23
95
|
|
|
24
|
-
### Step
|
|
96
|
+
### Step 4: Create the Release Workflow
|
|
25
97
|
|
|
26
|
-
|
|
98
|
+
Create `.github/workflows/release.yml` to handle builds triggered by tags:
|
|
27
99
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
100
|
+
```yaml
|
|
101
|
+
name: Release
|
|
102
|
+
on:
|
|
103
|
+
push:
|
|
104
|
+
tags:
|
|
105
|
+
- 'v*'
|
|
106
|
+
|
|
107
|
+
jobs:
|
|
108
|
+
build:
|
|
109
|
+
runs-on: ubuntu-latest
|
|
110
|
+
steps:
|
|
111
|
+
- uses: actions/checkout@v4
|
|
112
|
+
|
|
113
|
+
- name: Get version from tag
|
|
114
|
+
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
|
|
115
|
+
|
|
116
|
+
- name: Build
|
|
117
|
+
run: |
|
|
118
|
+
echo "Building version $VERSION"
|
|
119
|
+
docker build -t myapp:$VERSION .
|
|
120
|
+
docker push myapp:$VERSION
|
|
121
|
+
|
|
122
|
+
deploy-staging:
|
|
123
|
+
needs: build
|
|
124
|
+
runs-on: ubuntu-latest
|
|
125
|
+
environment: staging
|
|
126
|
+
steps:
|
|
127
|
+
- name: Deploy to staging
|
|
128
|
+
run: kubectl set image deployment/myapp myapp=myapp:$VERSION
|
|
129
|
+
|
|
130
|
+
deploy-production:
|
|
131
|
+
needs: build
|
|
132
|
+
runs-on: ubuntu-latest
|
|
133
|
+
environment: production
|
|
134
|
+
steps:
|
|
135
|
+
- name: Deploy to production
|
|
136
|
+
run: kubectl set image deployment/myapp myapp=myapp:$VERSION
|
|
137
|
+
```
|
|
32
138
|
|
|
33
|
-
|
|
34
|
-
|----------|-------|------|---------|------|
|
|
35
|
-
| `AGILEFLOW_TOKEN` | Your GitLab API token | Variable | Yes | No |
|
|
139
|
+
### Step 5: Test the Setup
|
|
36
140
|
|
|
37
|
-
|
|
141
|
+
1. Push a commit with conventional format:
|
|
142
|
+
```bash
|
|
143
|
+
git commit -m "feat: add new feature"
|
|
144
|
+
git push
|
|
145
|
+
```
|
|
146
|
+
2. The version workflow creates a tag (e.g., `v1.2.3`)
|
|
147
|
+
3. The tag triggers the release workflow
|
|
148
|
+
4. Build and deploy jobs run automatically
|
|
149
|
+
|
|
150
|
+
---
|
|
38
151
|
|
|
39
|
-
|
|
152
|
+
## GitLab CI
|
|
40
153
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
- **
|
|
154
|
+
### Step 1: Create an Access Token
|
|
155
|
+
|
|
156
|
+
**Option A: Project Access Token (Recommended)**
|
|
157
|
+
1. Go to project **Settings → Access tokens**
|
|
158
|
+
2. Create:
|
|
159
|
+
- **Name**: `AgileFlow`
|
|
160
|
+
- **Role**: `Maintainer`
|
|
47
161
|
- **Scopes**: `api`
|
|
48
|
-
3. Copy the
|
|
162
|
+
3. Copy the token
|
|
49
163
|
|
|
50
|
-
**Option
|
|
51
|
-
1. Go to
|
|
52
|
-
2. Create
|
|
53
|
-
- **Name**: `AgileFlow
|
|
54
|
-
- **Description**: `Token for AgileFlow automatic versioning`
|
|
164
|
+
**Option B: Personal Access Token**
|
|
165
|
+
1. Go to user **Settings → Access tokens**
|
|
166
|
+
2. Create:
|
|
167
|
+
- **Name**: `AgileFlow`
|
|
55
168
|
- **Scopes**: `api`
|
|
56
|
-
3. Copy the
|
|
169
|
+
3. Copy the token
|
|
170
|
+
|
|
171
|
+
### Step 2: Add the Token as a CI/CD Variable
|
|
172
|
+
|
|
173
|
+
1. Go to project **Settings → CI/CD → Variables**
|
|
174
|
+
2. Add:
|
|
175
|
+
- **Key**: `AGILEFLOW_TOKEN`
|
|
176
|
+
- **Value**: Your token
|
|
177
|
+
- **Flags**: Protected, Masked
|
|
57
178
|
|
|
58
|
-
### Step 3:
|
|
179
|
+
### Step 3: Configure Your Pipeline
|
|
59
180
|
|
|
60
|
-
|
|
181
|
+
Update `.gitlab-ci.yml`:
|
|
61
182
|
|
|
62
183
|
```yaml
|
|
184
|
+
stages:
|
|
185
|
+
- version
|
|
186
|
+
- build
|
|
187
|
+
- deploy
|
|
188
|
+
|
|
189
|
+
# Versioning job - runs on merge to main
|
|
190
|
+
agileflow:
|
|
191
|
+
stage: version
|
|
192
|
+
image: node:20-alpine
|
|
193
|
+
script:
|
|
194
|
+
- npx @logickernel/agileflow gitlab
|
|
195
|
+
rules:
|
|
196
|
+
- if: '$CI_COMMIT_BRANCH == "main"'
|
|
197
|
+
|
|
198
|
+
# Build job - runs on tag creation
|
|
63
199
|
build:
|
|
64
200
|
stage: build
|
|
65
201
|
script:
|
|
66
|
-
- echo "Building version $
|
|
67
|
-
- docker build -t myapp:$
|
|
68
|
-
- docker push myapp:$
|
|
69
|
-
|
|
70
|
-
-
|
|
202
|
+
- echo "Building version $CI_COMMIT_TAG"
|
|
203
|
+
- docker build -t myapp:$CI_COMMIT_TAG .
|
|
204
|
+
- docker push myapp:$CI_COMMIT_TAG
|
|
205
|
+
rules:
|
|
206
|
+
- if: '$CI_COMMIT_TAG =~ /^v/'
|
|
207
|
+
|
|
208
|
+
# Deploy jobs - run on tag creation
|
|
209
|
+
deploy-staging:
|
|
210
|
+
stage: deploy
|
|
211
|
+
script:
|
|
212
|
+
- kubectl set image deployment/myapp myapp=myapp:$CI_COMMIT_TAG
|
|
213
|
+
environment:
|
|
214
|
+
name: staging
|
|
215
|
+
rules:
|
|
216
|
+
- if: '$CI_COMMIT_TAG =~ /^v/'
|
|
217
|
+
|
|
218
|
+
deploy-production:
|
|
219
|
+
stage: deploy
|
|
220
|
+
script:
|
|
221
|
+
- kubectl set image deployment/myapp myapp=myapp:$CI_COMMIT_TAG
|
|
222
|
+
environment:
|
|
223
|
+
name: production
|
|
224
|
+
rules:
|
|
225
|
+
- if: '$CI_COMMIT_TAG =~ /^v/'
|
|
226
|
+
when: manual
|
|
71
227
|
```
|
|
72
228
|
|
|
73
|
-
### Step 4: Test the
|
|
229
|
+
### Step 4: Test the Setup
|
|
74
230
|
|
|
75
|
-
1.
|
|
231
|
+
1. Push a commit with conventional format:
|
|
76
232
|
```bash
|
|
77
|
-
git add
|
|
78
|
-
git commit -m "feat: add AgileFlow CI/CD pipeline"
|
|
233
|
+
git commit -m "feat: add new feature"
|
|
79
234
|
git push
|
|
80
235
|
```
|
|
236
|
+
2. The `agileflow` job creates a tag
|
|
237
|
+
3. A new pipeline starts for the tag
|
|
238
|
+
4. Build and deploy jobs run
|
|
81
239
|
|
|
82
|
-
|
|
83
|
-
3. The `agileflow` job should complete successfully and generate a version
|
|
84
|
-
4. Subsequent jobs should have access to the `${VERSION}` variable
|
|
240
|
+
---
|
|
85
241
|
|
|
86
|
-
##
|
|
242
|
+
## Other CI/CD Platforms
|
|
87
243
|
|
|
88
|
-
|
|
244
|
+
For platforms without native API integration, use the `push` command:
|
|
89
245
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
-
|
|
246
|
+
```yaml
|
|
247
|
+
version:
|
|
248
|
+
script:
|
|
249
|
+
- git config user.name "CI Bot"
|
|
250
|
+
- git config user.email "ci@example.com"
|
|
251
|
+
- npx @logickernel/agileflow push
|
|
252
|
+
```
|
|
94
253
|
|
|
95
|
-
|
|
96
|
-
1. **Analyzes commit history** on the main branch
|
|
97
|
-
2. **Calculates next semantic version** based on conventional commits
|
|
98
|
-
3. **Creates version tag** via GitLab API (not git push)
|
|
99
|
-
4. **Makes VERSION variable available** to all subsequent pipeline stages
|
|
254
|
+
Then configure your platform to trigger pipelines on tag creation.
|
|
100
255
|
|
|
101
|
-
|
|
102
|
-
- **No repository write permissions** needed for CI/CD jobs
|
|
103
|
-
- **More secure** - uses API tokens instead of git credentials
|
|
104
|
-
- **Works with protected branches** without special permissions
|
|
105
|
-
- **Consistent behavior** across all GitLab instances
|
|
256
|
+
---
|
|
106
257
|
|
|
107
|
-
##
|
|
258
|
+
## How It Works
|
|
108
259
|
|
|
109
|
-
|
|
260
|
+
AgileFlow uses platform APIs to create version tags:
|
|
110
261
|
|
|
111
|
-
|
|
262
|
+
1. **Analyzes commits** since the last version tag
|
|
263
|
+
2. **Calculates version** based on conventional commits
|
|
264
|
+
3. **Creates tag** via API (GitHub/GitLab) or git push
|
|
265
|
+
4. **Tag triggers** your build/deploy workflows
|
|
112
266
|
|
|
113
|
-
|
|
267
|
+
### Benefits
|
|
114
268
|
|
|
115
|
-
**
|
|
116
|
-
-
|
|
117
|
-
-
|
|
118
|
-
-
|
|
119
|
-
- Confirm the token is for the correct project/user
|
|
269
|
+
- **No repository write permissions** for CI jobs (uses API tokens)
|
|
270
|
+
- **Decoupled architecture** — versioning separate from builds
|
|
271
|
+
- **Works with protected branches**
|
|
272
|
+
- **Any process can hook into tag creation**
|
|
120
273
|
|
|
121
|
-
|
|
274
|
+
---
|
|
122
275
|
|
|
123
|
-
|
|
276
|
+
## Troubleshooting
|
|
124
277
|
|
|
125
|
-
|
|
126
|
-
- Check network connectivity to `code.logickernel.com`
|
|
127
|
-
- Verify the remote URL is accessible from your GitLab instance
|
|
128
|
-
- Check firewall rules and network policies
|
|
129
|
-
- Use a local copy of the template if remote access is restricted
|
|
278
|
+
### Token Permission Errors
|
|
130
279
|
|
|
131
|
-
|
|
280
|
+
**GitHub**: Ensure token has `contents: write` permission.
|
|
132
281
|
|
|
133
|
-
**
|
|
282
|
+
**GitLab**: Ensure token has `api` scope and `Maintainer` role.
|
|
134
283
|
|
|
135
|
-
|
|
136
|
-
- Ensure the `agileflow` job completed successfully
|
|
137
|
-
- Check that your jobs have `needs: - agileflow` dependency
|
|
138
|
-
- Verify the dotenv artifact is properly configured
|
|
139
|
-
- Check the `agileflow` job logs for errors
|
|
284
|
+
### Tag Not Created
|
|
140
285
|
|
|
141
|
-
|
|
286
|
+
- Check you're pushing to the main branch
|
|
287
|
+
- Verify conventional commit format
|
|
288
|
+
- Check pipeline logs for errors
|
|
142
289
|
|
|
143
|
-
|
|
290
|
+
### Build Not Triggered
|
|
144
291
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
stage: build
|
|
148
|
-
script:
|
|
149
|
-
- echo "VERSION: ${VERSION}"
|
|
150
|
-
- echo "CI_COMMIT_REF_NAME: ${CI_COMMIT_REF_NAME}"
|
|
151
|
-
- echo "CI_COMMIT_SHA: ${CI_COMMIT_SHA}"
|
|
152
|
-
needs:
|
|
153
|
-
- agileflow
|
|
154
|
-
```
|
|
292
|
+
- Ensure release workflow is configured for tag events
|
|
293
|
+
- Check tag pattern matches (`v*` for GitHub, `/^v/` for GitLab)
|
|
155
294
|
|
|
156
|
-
|
|
295
|
+
---
|
|
157
296
|
|
|
158
|
-
|
|
297
|
+
## Next Steps
|
|
159
298
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
4. **Check [Troubleshooting](./troubleshooting.md)** if you encounter issues
|
|
299
|
+
- [Getting Started](./getting-started.md) — Quick start guide
|
|
300
|
+
- [CLI Reference](./cli-reference.md) — Commands and options
|
|
301
|
+
- [Troubleshooting](./troubleshooting.md) — Common issues
|