@logickernel/agileflow 0.16.1 → 0.17.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 +54 -127
- package/docs/guides/github-actions.md +110 -0
- package/docs/guides/gitlab-ci.md +128 -0
- package/docs/guides/other-ci.md +93 -0
- package/docs/index.md +58 -0
- package/docs/reference/cli.md +124 -0
- package/docs/reference/conventional-commits.md +133 -0
- package/docs/start-here/getting-started.md +83 -0
- package/package.json +1 -1
- package/src/git-push.js +2 -4
- package/src/github-push.js +2 -4
- package/src/gitlab-push.js +3 -5
- package/src/index.js +20 -43
- package/src/utils.js +56 -3
- package/docs/README.md +0 -60
- package/docs/best-practices.md +0 -306
- package/docs/branching-strategy.md +0 -347
- package/docs/cli-reference.md +0 -301
- package/docs/configuration.md +0 -217
- package/docs/conventional-commits.md +0 -252
- package/docs/getting-started.md +0 -231
- package/docs/installation.md +0 -300
- package/docs/migration-guide.md +0 -303
- package/docs/release-management.md +0 -309
- package/docs/troubleshooting.md +0 -367
- package/docs/version-centric-cicd.md +0 -289
package/docs/cli-reference.md
DELETED
|
@@ -1,301 +0,0 @@
|
|
|
1
|
-
# CLI Reference
|
|
2
|
-
|
|
3
|
-
AgileFlow provides a simple command-line interface for automatic semantic versioning and changelog generation.
|
|
4
|
-
|
|
5
|
-
## Installation
|
|
6
|
-
|
|
7
|
-
Run directly with npx (no installation required):
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
npx @logickernel/agileflow
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
Or install globally:
|
|
14
|
-
|
|
15
|
-
```bash
|
|
16
|
-
npm install -g @logickernel/agileflow
|
|
17
|
-
agileflow
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
---
|
|
21
|
-
|
|
22
|
-
## Commands
|
|
23
|
-
|
|
24
|
-
### Default (no command)
|
|
25
|
-
|
|
26
|
-
Analyzes the repository and displays version information without creating tags.
|
|
27
|
-
|
|
28
|
-
```bash
|
|
29
|
-
agileflow
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
**Output:**
|
|
33
|
-
```
|
|
34
|
-
Current version: v1.2.3
|
|
35
|
-
Next version: v1.2.4
|
|
36
|
-
Commits since current version: 3
|
|
37
|
-
|
|
38
|
-
Changelog:
|
|
39
|
-
### fix
|
|
40
|
-
- resolve authentication issue
|
|
41
|
-
|
|
42
|
-
### feat
|
|
43
|
-
- add new login flow
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
### push
|
|
47
|
-
|
|
48
|
-
Creates an annotated git tag and pushes it to the origin remote.
|
|
49
|
-
|
|
50
|
-
```bash
|
|
51
|
-
agileflow push
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
**Requirements:**
|
|
55
|
-
- Git credentials configured for push access
|
|
56
|
-
|
|
57
|
-
**Behavior:**
|
|
58
|
-
- Calculates the next version
|
|
59
|
-
- Creates an annotated tag with the changelog as the message
|
|
60
|
-
- Pushes the tag to origin
|
|
61
|
-
- Skips if no version bump is needed
|
|
62
|
-
|
|
63
|
-
### gitlab
|
|
64
|
-
|
|
65
|
-
Creates a version tag via the GitLab API. Designed for GitLab CI pipelines.
|
|
66
|
-
|
|
67
|
-
```bash
|
|
68
|
-
agileflow gitlab
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
**Required Environment Variable:**
|
|
72
|
-
- `AGILEFLOW_TOKEN` — GitLab access token with `api` scope
|
|
73
|
-
|
|
74
|
-
**Auto-provided by GitLab CI:**
|
|
75
|
-
- `CI_SERVER_HOST` — GitLab server hostname
|
|
76
|
-
- `CI_PROJECT_PATH` — Project path (e.g., `group/project`)
|
|
77
|
-
- `CI_COMMIT_SHA` — Current commit SHA
|
|
78
|
-
|
|
79
|
-
**Example:**
|
|
80
|
-
```yaml
|
|
81
|
-
agileflow:
|
|
82
|
-
stage: version
|
|
83
|
-
image: node:20-alpine
|
|
84
|
-
script:
|
|
85
|
-
- npx @logickernel/agileflow gitlab
|
|
86
|
-
only:
|
|
87
|
-
- main
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
### github
|
|
91
|
-
|
|
92
|
-
Creates a version tag via the GitHub API. Designed for GitHub Actions workflows.
|
|
93
|
-
|
|
94
|
-
```bash
|
|
95
|
-
agileflow github
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
**Required Environment Variable:**
|
|
99
|
-
- `AGILEFLOW_TOKEN` — GitHub Personal Access Token with `contents: write` permission
|
|
100
|
-
|
|
101
|
-
**Auto-provided by GitHub Actions:**
|
|
102
|
-
- `GITHUB_REPOSITORY` — Repository name (e.g., `owner/repo`)
|
|
103
|
-
- `GITHUB_SHA` — Current commit SHA
|
|
104
|
-
|
|
105
|
-
**Example:**
|
|
106
|
-
```yaml
|
|
107
|
-
- name: Create version tag
|
|
108
|
-
env:
|
|
109
|
-
AGILEFLOW_TOKEN: ${{ secrets.AGILEFLOW_TOKEN }}
|
|
110
|
-
run: npx @logickernel/agileflow github
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
---
|
|
114
|
-
|
|
115
|
-
## Options
|
|
116
|
-
|
|
117
|
-
### --quiet
|
|
118
|
-
|
|
119
|
-
Output only the next version string. Useful for capturing in scripts.
|
|
120
|
-
|
|
121
|
-
```bash
|
|
122
|
-
agileflow --quiet
|
|
123
|
-
# Output: v1.2.4
|
|
124
|
-
```
|
|
125
|
-
|
|
126
|
-
If no version bump is needed, outputs nothing.
|
|
127
|
-
|
|
128
|
-
```bash
|
|
129
|
-
VERSION=$(npx @logickernel/agileflow --quiet)
|
|
130
|
-
if [ -n "$VERSION" ]; then
|
|
131
|
-
echo "New version: $VERSION"
|
|
132
|
-
else
|
|
133
|
-
echo "No version bump needed"
|
|
134
|
-
fi
|
|
135
|
-
```
|
|
136
|
-
|
|
137
|
-
### --help, -h
|
|
138
|
-
|
|
139
|
-
Display help information.
|
|
140
|
-
|
|
141
|
-
```bash
|
|
142
|
-
agileflow --help
|
|
143
|
-
```
|
|
144
|
-
|
|
145
|
-
### --version, -v
|
|
146
|
-
|
|
147
|
-
Display the AgileFlow CLI version.
|
|
148
|
-
|
|
149
|
-
```bash
|
|
150
|
-
agileflow --version
|
|
151
|
-
```
|
|
152
|
-
|
|
153
|
-
---
|
|
154
|
-
|
|
155
|
-
## Exit Codes
|
|
156
|
-
|
|
157
|
-
| Code | Meaning |
|
|
158
|
-
|------|---------|
|
|
159
|
-
| 0 | Success |
|
|
160
|
-
| 1 | Error (missing token, git error, API error, etc.) |
|
|
161
|
-
|
|
162
|
-
---
|
|
163
|
-
|
|
164
|
-
## Error Messages
|
|
165
|
-
|
|
166
|
-
### Authentication Errors
|
|
167
|
-
|
|
168
|
-
**GitLab:**
|
|
169
|
-
```
|
|
170
|
-
AGILEFLOW_TOKEN environment variable is required but not set.
|
|
171
|
-
|
|
172
|
-
To fix this:
|
|
173
|
-
1. Create a project access token with 'api' scope and 'Maintainer' role
|
|
174
|
-
2. Add it as a CI/CD variable named AGILEFLOW_TOKEN
|
|
175
|
-
```
|
|
176
|
-
|
|
177
|
-
**GitHub:**
|
|
178
|
-
```
|
|
179
|
-
AGILEFLOW_TOKEN environment variable is required but not set.
|
|
180
|
-
|
|
181
|
-
To fix this:
|
|
182
|
-
1. Create a Personal Access Token with 'contents: write' permission
|
|
183
|
-
2. Add it as a repository secret named AGILEFLOW_TOKEN
|
|
184
|
-
3. Pass it via env: AGILEFLOW_TOKEN: ${{ secrets.AGILEFLOW_TOKEN }}
|
|
185
|
-
```
|
|
186
|
-
|
|
187
|
-
### Git Repository Errors
|
|
188
|
-
|
|
189
|
-
```
|
|
190
|
-
Current directory is not a git repository (missing .git directory).
|
|
191
|
-
```
|
|
192
|
-
|
|
193
|
-
### Detached HEAD State
|
|
194
|
-
|
|
195
|
-
```
|
|
196
|
-
Repository is in a detached HEAD state. Please check out a branch and try again.
|
|
197
|
-
```
|
|
198
|
-
|
|
199
|
-
---
|
|
200
|
-
|
|
201
|
-
## Examples
|
|
202
|
-
|
|
203
|
-
### Preview Version Locally
|
|
204
|
-
|
|
205
|
-
```bash
|
|
206
|
-
cd my-project
|
|
207
|
-
npx @logickernel/agileflow
|
|
208
|
-
```
|
|
209
|
-
|
|
210
|
-
### Get Version for Scripts
|
|
211
|
-
|
|
212
|
-
```bash
|
|
213
|
-
VERSION=$(npx @logickernel/agileflow --quiet)
|
|
214
|
-
docker build -t myapp:$VERSION .
|
|
215
|
-
```
|
|
216
|
-
|
|
217
|
-
### GitHub Actions Workflow
|
|
218
|
-
|
|
219
|
-
```yaml
|
|
220
|
-
name: Release
|
|
221
|
-
on:
|
|
222
|
-
push:
|
|
223
|
-
branches: [main]
|
|
224
|
-
|
|
225
|
-
jobs:
|
|
226
|
-
release:
|
|
227
|
-
runs-on: ubuntu-latest
|
|
228
|
-
outputs:
|
|
229
|
-
version: ${{ steps.version.outputs.version }}
|
|
230
|
-
steps:
|
|
231
|
-
- uses: actions/checkout@v4
|
|
232
|
-
with:
|
|
233
|
-
fetch-depth: 0
|
|
234
|
-
|
|
235
|
-
- uses: actions/setup-node@v4
|
|
236
|
-
with:
|
|
237
|
-
node-version: '20'
|
|
238
|
-
|
|
239
|
-
- name: Create version tag
|
|
240
|
-
id: version
|
|
241
|
-
env:
|
|
242
|
-
AGILEFLOW_TOKEN: ${{ secrets.AGILEFLOW_TOKEN }}
|
|
243
|
-
run: |
|
|
244
|
-
VERSION=$(npx @logickernel/agileflow github --quiet)
|
|
245
|
-
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
|
246
|
-
|
|
247
|
-
build:
|
|
248
|
-
needs: release
|
|
249
|
-
if: needs.release.outputs.version != ''
|
|
250
|
-
runs-on: ubuntu-latest
|
|
251
|
-
steps:
|
|
252
|
-
- uses: actions/checkout@v4
|
|
253
|
-
- run: docker build -t myapp:${{ needs.release.outputs.version }} .
|
|
254
|
-
```
|
|
255
|
-
|
|
256
|
-
### GitLab CI Pipeline
|
|
257
|
-
|
|
258
|
-
```yaml
|
|
259
|
-
stages:
|
|
260
|
-
- version
|
|
261
|
-
- build
|
|
262
|
-
- deploy
|
|
263
|
-
|
|
264
|
-
agileflow:
|
|
265
|
-
stage: version
|
|
266
|
-
image: node:20-alpine
|
|
267
|
-
script:
|
|
268
|
-
- VERSION=$(npx @logickernel/agileflow gitlab --quiet)
|
|
269
|
-
- echo "VERSION=$VERSION" >> version.env
|
|
270
|
-
artifacts:
|
|
271
|
-
reports:
|
|
272
|
-
dotenv: version.env
|
|
273
|
-
only:
|
|
274
|
-
- main
|
|
275
|
-
|
|
276
|
-
build:
|
|
277
|
-
stage: build
|
|
278
|
-
script:
|
|
279
|
-
- docker build -t myapp:$VERSION .
|
|
280
|
-
needs:
|
|
281
|
-
- agileflow
|
|
282
|
-
|
|
283
|
-
deploy:
|
|
284
|
-
stage: deploy
|
|
285
|
-
script:
|
|
286
|
-
- kubectl set image deployment/myapp myapp=myapp:$VERSION
|
|
287
|
-
environment:
|
|
288
|
-
name: production
|
|
289
|
-
when: manual
|
|
290
|
-
needs:
|
|
291
|
-
- build
|
|
292
|
-
```
|
|
293
|
-
|
|
294
|
-
---
|
|
295
|
-
|
|
296
|
-
## Related Documentation
|
|
297
|
-
|
|
298
|
-
- [Getting Started](./getting-started.md) — Quick start guide
|
|
299
|
-
- [Installation Guide](./installation.md) — Setup instructions
|
|
300
|
-
- [Conventional Commits](./conventional-commits.md) — Commit message format
|
|
301
|
-
- [Troubleshooting](./troubleshooting.md) — Common issues and solutions
|
package/docs/configuration.md
DELETED
|
@@ -1,217 +0,0 @@
|
|
|
1
|
-
# Configuration Guide
|
|
2
|
-
|
|
3
|
-
AgileFlow uses environment variables for configuration. Most variables are automatically provided by your CI/CD platform.
|
|
4
|
-
|
|
5
|
-
## Environment Variables
|
|
6
|
-
|
|
7
|
-
### Required for CI/CD
|
|
8
|
-
|
|
9
|
-
#### AGILEFLOW_TOKEN
|
|
10
|
-
|
|
11
|
-
The access token used to create version tags via the platform API.
|
|
12
|
-
|
|
13
|
-
| Platform | Token Type | Required Permissions |
|
|
14
|
-
|----------|------------|---------------------|
|
|
15
|
-
| GitHub | Personal Access Token | `contents: write` |
|
|
16
|
-
| GitLab | Project or Personal Access Token | `api` scope, `Maintainer` role |
|
|
17
|
-
|
|
18
|
-
**GitHub Actions:**
|
|
19
|
-
```yaml
|
|
20
|
-
env:
|
|
21
|
-
AGILEFLOW_TOKEN: ${{ secrets.AGILEFLOW_TOKEN }}
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
**GitLab CI:**
|
|
25
|
-
```yaml
|
|
26
|
-
# Set via Settings → CI/CD → Variables
|
|
27
|
-
# Key: AGILEFLOW_TOKEN
|
|
28
|
-
# Flags: Protected, Masked
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
### Auto-Provided Variables
|
|
32
|
-
|
|
33
|
-
These are automatically set by your CI/CD platform:
|
|
34
|
-
|
|
35
|
-
#### GitHub Actions
|
|
36
|
-
|
|
37
|
-
| Variable | Description | Example |
|
|
38
|
-
|----------|-------------|---------|
|
|
39
|
-
| `GITHUB_REPOSITORY` | Repository name | `owner/repo` |
|
|
40
|
-
| `GITHUB_SHA` | Current commit SHA | `abc123...` |
|
|
41
|
-
|
|
42
|
-
#### GitLab CI
|
|
43
|
-
|
|
44
|
-
| Variable | Description | Example |
|
|
45
|
-
|----------|-------------|---------|
|
|
46
|
-
| `CI_SERVER_HOST` | GitLab server hostname | `gitlab.com` |
|
|
47
|
-
| `CI_PROJECT_PATH` | Project path | `group/project` |
|
|
48
|
-
| `CI_COMMIT_SHA` | Current commit SHA | `abc123...` |
|
|
49
|
-
|
|
50
|
-
---
|
|
51
|
-
|
|
52
|
-
## Platform Configuration
|
|
53
|
-
|
|
54
|
-
### GitHub Actions
|
|
55
|
-
|
|
56
|
-
```yaml
|
|
57
|
-
name: Release
|
|
58
|
-
on:
|
|
59
|
-
push:
|
|
60
|
-
branches: [main]
|
|
61
|
-
|
|
62
|
-
jobs:
|
|
63
|
-
version:
|
|
64
|
-
runs-on: ubuntu-latest
|
|
65
|
-
steps:
|
|
66
|
-
- uses: actions/checkout@v4
|
|
67
|
-
with:
|
|
68
|
-
fetch-depth: 0 # Required for full commit history
|
|
69
|
-
|
|
70
|
-
- uses: actions/setup-node@v4
|
|
71
|
-
with:
|
|
72
|
-
node-version: '20'
|
|
73
|
-
|
|
74
|
-
- name: Create version tag
|
|
75
|
-
env:
|
|
76
|
-
AGILEFLOW_TOKEN: ${{ secrets.AGILEFLOW_TOKEN }}
|
|
77
|
-
run: agileflow github
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
### GitLab CI
|
|
81
|
-
|
|
82
|
-
```yaml
|
|
83
|
-
agileflow:
|
|
84
|
-
image: node:20
|
|
85
|
-
script:
|
|
86
|
-
- npm install -g @logickernel/agileflow
|
|
87
|
-
- agileflow gitlab
|
|
88
|
-
rules:
|
|
89
|
-
- if: '$CI_COMMIT_BRANCH == "main"'
|
|
90
|
-
tags:
|
|
91
|
-
- agileflow
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
---
|
|
95
|
-
|
|
96
|
-
## Setting Up Tokens
|
|
97
|
-
|
|
98
|
-
### GitHub Personal Access Token
|
|
99
|
-
|
|
100
|
-
1. Go to **Settings → Developer settings → Personal access tokens → Fine-grained tokens**
|
|
101
|
-
2. Click **Generate new token**
|
|
102
|
-
3. Configure:
|
|
103
|
-
- **Name**: `AgileFlow`
|
|
104
|
-
- **Repository access**: Select your repositories
|
|
105
|
-
- **Permissions**: `Contents: Read and write`
|
|
106
|
-
4. Copy the token
|
|
107
|
-
|
|
108
|
-
Add as a repository secret:
|
|
109
|
-
1. Go to repository **Settings → Secrets and variables → Actions**
|
|
110
|
-
2. Click **New repository secret**
|
|
111
|
-
3. Name: `AGILEFLOW_TOKEN`, Value: your token
|
|
112
|
-
|
|
113
|
-
### GitLab Project Access Token
|
|
114
|
-
|
|
115
|
-
1. Go to project **Settings → Access tokens**
|
|
116
|
-
2. Create new token:
|
|
117
|
-
- **Name**: `AgileFlow`
|
|
118
|
-
- **Role**: `Maintainer`
|
|
119
|
-
- **Scopes**: `api`
|
|
120
|
-
3. Copy the token
|
|
121
|
-
|
|
122
|
-
Add as a CI/CD variable:
|
|
123
|
-
1. Go to project **Settings → CI/CD → Variables**
|
|
124
|
-
2. Add variable:
|
|
125
|
-
- **Key**: `AGILEFLOW_TOKEN`
|
|
126
|
-
- **Value**: your token
|
|
127
|
-
- **Flags**: Protected, Masked
|
|
128
|
-
|
|
129
|
-
---
|
|
130
|
-
|
|
131
|
-
## Security Best Practices
|
|
132
|
-
|
|
133
|
-
### Token Security
|
|
134
|
-
|
|
135
|
-
- **Use project tokens** over personal tokens when possible
|
|
136
|
-
- **Enable protection** for sensitive variables
|
|
137
|
-
- **Limit scope** to only required permissions
|
|
138
|
-
- **Rotate tokens** regularly
|
|
139
|
-
- **Use masked variables** to hide values in logs
|
|
140
|
-
|
|
141
|
-
### Access Control
|
|
142
|
-
|
|
143
|
-
- **Minimal permissions** — Use tokens with only required access
|
|
144
|
-
- **Protected branches** — Limit who can push to main
|
|
145
|
-
- **Audit access** — Regularly review token usage
|
|
146
|
-
|
|
147
|
-
### Example: Protected Variable
|
|
148
|
-
|
|
149
|
-
**GitHub:**
|
|
150
|
-
- Repository secrets are automatically protected
|
|
151
|
-
- Only workflows triggered from the default branch can access them
|
|
152
|
-
|
|
153
|
-
**GitLab:**
|
|
154
|
-
```yaml
|
|
155
|
-
# Variable settings:
|
|
156
|
-
# - Protected: Yes (only available on protected branches)
|
|
157
|
-
# - Masked: Yes (hidden in job logs)
|
|
158
|
-
```
|
|
159
|
-
|
|
160
|
-
---
|
|
161
|
-
|
|
162
|
-
## Troubleshooting Configuration
|
|
163
|
-
|
|
164
|
-
### Token Permission Errors
|
|
165
|
-
|
|
166
|
-
**GitHub:**
|
|
167
|
-
```
|
|
168
|
-
Error: Resource not accessible by integration
|
|
169
|
-
```
|
|
170
|
-
- Ensure token has `contents: write` permission
|
|
171
|
-
- Check repository access is granted
|
|
172
|
-
|
|
173
|
-
**GitLab:**
|
|
174
|
-
```
|
|
175
|
-
Error: 403 Forbidden
|
|
176
|
-
```
|
|
177
|
-
- Ensure token has `api` scope
|
|
178
|
-
- Verify `Maintainer` role or higher
|
|
179
|
-
- Check token hasn't expired
|
|
180
|
-
|
|
181
|
-
### Missing Environment Variables
|
|
182
|
-
|
|
183
|
-
```
|
|
184
|
-
Error: AGILEFLOW_TOKEN environment variable is required but not set.
|
|
185
|
-
```
|
|
186
|
-
- Verify the variable is configured in your CI/CD settings
|
|
187
|
-
- Check variable protection settings match your branch
|
|
188
|
-
|
|
189
|
-
### Debug Configuration
|
|
190
|
-
|
|
191
|
-
Add a debug step to verify configuration:
|
|
192
|
-
|
|
193
|
-
**GitHub Actions:**
|
|
194
|
-
```yaml
|
|
195
|
-
- name: Debug
|
|
196
|
-
run: |
|
|
197
|
-
echo "Repository: $GITHUB_REPOSITORY"
|
|
198
|
-
echo "SHA: $GITHUB_SHA"
|
|
199
|
-
echo "Token set: ${{ secrets.AGILEFLOW_TOKEN != '' }}"
|
|
200
|
-
```
|
|
201
|
-
|
|
202
|
-
**GitLab CI:**
|
|
203
|
-
```yaml
|
|
204
|
-
debug:
|
|
205
|
-
script:
|
|
206
|
-
- echo "Server: $CI_SERVER_HOST"
|
|
207
|
-
- echo "Project: $CI_PROJECT_PATH"
|
|
208
|
-
- echo "Token set: ${AGILEFLOW_TOKEN:+yes}"
|
|
209
|
-
```
|
|
210
|
-
|
|
211
|
-
---
|
|
212
|
-
|
|
213
|
-
## Related Documentation
|
|
214
|
-
|
|
215
|
-
- [Installation Guide](./installation.md) — Complete setup instructions
|
|
216
|
-
- [CLI Reference](./cli-reference.md) — Command-line options
|
|
217
|
-
- [Troubleshooting](./troubleshooting.md) — Common issues and solutions
|