@logickernel/agileflow 0.4.0 → 0.4.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/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/src/utils.js +23 -6
package/docs/cli-reference.md
CHANGED
|
@@ -4,7 +4,7 @@ AgileFlow provides a simple command-line interface for automatic semantic versio
|
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Run directly with npx (no installation required):
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
10
|
npx @logickernel/agileflow
|
|
@@ -17,18 +17,13 @@ npm install -g @logickernel/agileflow
|
|
|
17
17
|
agileflow
|
|
18
18
|
```
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
```bash
|
|
23
|
-
agileflow [options]
|
|
24
|
-
agileflow <command>
|
|
25
|
-
```
|
|
20
|
+
---
|
|
26
21
|
|
|
27
22
|
## Commands
|
|
28
23
|
|
|
29
24
|
### Default (no command)
|
|
30
25
|
|
|
31
|
-
Analyzes the
|
|
26
|
+
Analyzes the repository and displays version information without creating tags.
|
|
32
27
|
|
|
33
28
|
```bash
|
|
34
29
|
agileflow
|
|
@@ -50,7 +45,7 @@ Changelog:
|
|
|
50
45
|
|
|
51
46
|
### push
|
|
52
47
|
|
|
53
|
-
Creates an annotated git tag and pushes it to the origin remote
|
|
48
|
+
Creates an annotated git tag and pushes it to the origin remote.
|
|
54
49
|
|
|
55
50
|
```bash
|
|
56
51
|
agileflow push
|
|
@@ -58,31 +53,30 @@ agileflow push
|
|
|
58
53
|
|
|
59
54
|
**Requirements:**
|
|
60
55
|
- Git credentials configured for push access
|
|
61
|
-
- No additional environment variables needed
|
|
62
56
|
|
|
63
57
|
**Behavior:**
|
|
64
58
|
- Calculates the next version
|
|
65
59
|
- Creates an annotated tag with the changelog as the message
|
|
66
60
|
- Pushes the tag to origin
|
|
67
|
-
-
|
|
61
|
+
- Skips if no version bump is needed
|
|
68
62
|
|
|
69
63
|
### gitlab
|
|
70
64
|
|
|
71
|
-
Creates a version tag via the GitLab API. Designed for
|
|
65
|
+
Creates a version tag via the GitLab API. Designed for GitLab CI pipelines.
|
|
72
66
|
|
|
73
67
|
```bash
|
|
74
68
|
agileflow gitlab
|
|
75
69
|
```
|
|
76
70
|
|
|
77
71
|
**Required Environment Variable:**
|
|
78
|
-
- `AGILEFLOW_TOKEN`
|
|
72
|
+
- `AGILEFLOW_TOKEN` — GitLab access token with `api` scope
|
|
79
73
|
|
|
80
74
|
**Auto-provided by GitLab CI:**
|
|
81
|
-
- `CI_SERVER_HOST`
|
|
82
|
-
- `CI_PROJECT_PATH`
|
|
83
|
-
- `CI_COMMIT_SHA`
|
|
75
|
+
- `CI_SERVER_HOST` — GitLab server hostname
|
|
76
|
+
- `CI_PROJECT_PATH` — Project path (e.g., `group/project`)
|
|
77
|
+
- `CI_COMMIT_SHA` — Current commit SHA
|
|
84
78
|
|
|
85
|
-
**Example
|
|
79
|
+
**Example:**
|
|
86
80
|
```yaml
|
|
87
81
|
agileflow:
|
|
88
82
|
stage: version
|
|
@@ -95,20 +89,20 @@ agileflow:
|
|
|
95
89
|
|
|
96
90
|
### github
|
|
97
91
|
|
|
98
|
-
Creates a version tag via the GitHub API. Designed for
|
|
92
|
+
Creates a version tag via the GitHub API. Designed for GitHub Actions workflows.
|
|
99
93
|
|
|
100
94
|
```bash
|
|
101
95
|
agileflow github
|
|
102
96
|
```
|
|
103
97
|
|
|
104
98
|
**Required Environment Variable:**
|
|
105
|
-
- `AGILEFLOW_TOKEN`
|
|
99
|
+
- `AGILEFLOW_TOKEN` — GitHub Personal Access Token with `contents: write` permission
|
|
106
100
|
|
|
107
101
|
**Auto-provided by GitHub Actions:**
|
|
108
|
-
- `GITHUB_REPOSITORY`
|
|
109
|
-
- `GITHUB_SHA`
|
|
102
|
+
- `GITHUB_REPOSITORY` — Repository name (e.g., `owner/repo`)
|
|
103
|
+
- `GITHUB_SHA` — Current commit SHA
|
|
110
104
|
|
|
111
|
-
**Example
|
|
105
|
+
**Example:**
|
|
112
106
|
```yaml
|
|
113
107
|
- name: Create version tag
|
|
114
108
|
env:
|
|
@@ -116,11 +110,13 @@ agileflow github
|
|
|
116
110
|
run: npx @logickernel/agileflow github
|
|
117
111
|
```
|
|
118
112
|
|
|
113
|
+
---
|
|
114
|
+
|
|
119
115
|
## Options
|
|
120
116
|
|
|
121
117
|
### --quiet
|
|
122
118
|
|
|
123
|
-
|
|
119
|
+
Output only the next version string. Useful for capturing in scripts.
|
|
124
120
|
|
|
125
121
|
```bash
|
|
126
122
|
agileflow --quiet
|
|
@@ -154,6 +150,8 @@ Display the AgileFlow CLI version.
|
|
|
154
150
|
agileflow --version
|
|
155
151
|
```
|
|
156
152
|
|
|
153
|
+
---
|
|
154
|
+
|
|
157
155
|
## Exit Codes
|
|
158
156
|
|
|
159
157
|
| Code | Meaning |
|
|
@@ -161,9 +159,9 @@ agileflow --version
|
|
|
161
159
|
| 0 | Success |
|
|
162
160
|
| 1 | Error (missing token, git error, API error, etc.) |
|
|
163
161
|
|
|
164
|
-
|
|
162
|
+
---
|
|
165
163
|
|
|
166
|
-
|
|
164
|
+
## Error Messages
|
|
167
165
|
|
|
168
166
|
### Authentication Errors
|
|
169
167
|
|
|
@@ -172,13 +170,8 @@ AgileFlow provides detailed error messages for common issues:
|
|
|
172
170
|
AGILEFLOW_TOKEN environment variable is required but not set.
|
|
173
171
|
|
|
174
172
|
To fix this:
|
|
175
|
-
1. Create a project access token
|
|
176
|
-
|
|
177
|
-
- Role: maintainer
|
|
178
|
-
- Scopes: api
|
|
179
|
-
2. Add it as a CI/CD variable: https://gitlab.com/your/project/-/settings/ci_cd
|
|
180
|
-
- Variable key: AGILEFLOW_TOKEN
|
|
181
|
-
- Protect variable: Yes (recommended)
|
|
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
|
|
182
175
|
```
|
|
183
176
|
|
|
184
177
|
**GitHub:**
|
|
@@ -186,9 +179,9 @@ To fix this:
|
|
|
186
179
|
AGILEFLOW_TOKEN environment variable is required but not set.
|
|
187
180
|
|
|
188
181
|
To fix this:
|
|
189
|
-
1. Create a Personal Access Token with
|
|
182
|
+
1. Create a Personal Access Token with 'contents: write' permission
|
|
190
183
|
2. Add it as a repository secret named AGILEFLOW_TOKEN
|
|
191
|
-
3.
|
|
184
|
+
3. Pass it via env: AGILEFLOW_TOKEN: ${{ secrets.AGILEFLOW_TOKEN }}
|
|
192
185
|
```
|
|
193
186
|
|
|
194
187
|
### Git Repository Errors
|
|
@@ -203,6 +196,8 @@ Current directory is not a git repository (missing .git directory).
|
|
|
203
196
|
Repository is in a detached HEAD state. Please check out a branch and try again.
|
|
204
197
|
```
|
|
205
198
|
|
|
199
|
+
---
|
|
200
|
+
|
|
206
201
|
## Examples
|
|
207
202
|
|
|
208
203
|
### Preview Version Locally
|
|
@@ -212,13 +207,52 @@ cd my-project
|
|
|
212
207
|
npx @logickernel/agileflow
|
|
213
208
|
```
|
|
214
209
|
|
|
215
|
-
### Get Version for
|
|
210
|
+
### Get Version for Scripts
|
|
216
211
|
|
|
217
212
|
```bash
|
|
218
213
|
VERSION=$(npx @logickernel/agileflow --quiet)
|
|
219
214
|
docker build -t myapp:$VERSION .
|
|
220
215
|
```
|
|
221
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
|
+
|
|
222
256
|
### GitLab CI Pipeline
|
|
223
257
|
|
|
224
258
|
```yaml
|
|
@@ -245,37 +279,23 @@ build:
|
|
|
245
279
|
- docker build -t myapp:$VERSION .
|
|
246
280
|
needs:
|
|
247
281
|
- agileflow
|
|
248
|
-
```
|
|
249
|
-
|
|
250
|
-
### GitHub Actions Workflow
|
|
251
282
|
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
steps:
|
|
262
|
-
- uses: actions/checkout@v4
|
|
263
|
-
with:
|
|
264
|
-
fetch-depth: 0
|
|
265
|
-
|
|
266
|
-
- uses: actions/setup-node@v4
|
|
267
|
-
with:
|
|
268
|
-
node-version: '20'
|
|
269
|
-
|
|
270
|
-
- name: Create version tag
|
|
271
|
-
env:
|
|
272
|
-
AGILEFLOW_TOKEN: ${{ secrets.AGILEFLOW_TOKEN }}
|
|
273
|
-
run: npx @logickernel/agileflow github
|
|
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
|
|
274
292
|
```
|
|
275
293
|
|
|
294
|
+
---
|
|
295
|
+
|
|
276
296
|
## Related Documentation
|
|
277
297
|
|
|
278
|
-
- [Getting Started](./getting-started.md)
|
|
279
|
-
- [
|
|
280
|
-
- [
|
|
281
|
-
- [Troubleshooting](./troubleshooting.md)
|
|
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
CHANGED
|
@@ -1,232 +1,219 @@
|
|
|
1
1
|
# Configuration Guide
|
|
2
2
|
|
|
3
|
-
AgileFlow uses environment variables for configuration
|
|
3
|
+
AgileFlow uses environment variables for configuration. Most variables are automatically provided by your CI/CD platform.
|
|
4
4
|
|
|
5
5
|
## Environment Variables
|
|
6
6
|
|
|
7
|
-
### Required
|
|
7
|
+
### Required for CI/CD
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
#### AGILEFLOW_TOKEN
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
The access token used to create version tags via the platform API.
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
- **`CI_SERVER_HOST`** - GitLab server hostname
|
|
24
|
-
- **Example**: `gitlab.example.com`
|
|
25
|
-
- **Purpose**: Used for generating commit pipeline URLs and API calls
|
|
26
|
-
- **Required**: Yes
|
|
27
|
-
|
|
28
|
-
- **`CI_PROJECT_PATH`** - GitLab project path (group/project)
|
|
29
|
-
- **Example**: `mygroup/myproject`
|
|
30
|
-
- **Purpose**: Used for API calls and URL generation
|
|
31
|
-
- **Required**: Yes
|
|
32
|
-
|
|
33
|
-
- **`AGILEFLOW_TOKEN`** - GitLab access token with API permissions
|
|
34
|
-
- **Example**: `glpat-xxxxxxxxxxxxxxxxxxxx`
|
|
35
|
-
- **Purpose**: Authenticates API calls for tag creation and repository access
|
|
36
|
-
- **Required**: Yes
|
|
37
|
-
- **Scopes**: `api` access required
|
|
38
|
-
- **Role**: `maintainer` or higher recommended
|
|
18
|
+
**GitHub Actions:**
|
|
19
|
+
```yaml
|
|
20
|
+
env:
|
|
21
|
+
AGILEFLOW_TOKEN: ${{ secrets.AGILEFLOW_TOKEN }}
|
|
22
|
+
```
|
|
39
23
|
|
|
40
|
-
|
|
24
|
+
**GitLab CI:**
|
|
25
|
+
```yaml
|
|
26
|
+
# Set via Settings → CI/CD → Variables
|
|
27
|
+
# Key: AGILEFLOW_TOKEN
|
|
28
|
+
# Flags: Protected, Masked
|
|
29
|
+
```
|
|
41
30
|
|
|
42
|
-
|
|
31
|
+
### Auto-Provided Variables
|
|
43
32
|
|
|
44
|
-
|
|
33
|
+
These are automatically set by your CI/CD platform:
|
|
45
34
|
|
|
46
|
-
|
|
47
|
-
- **Default**: `50`
|
|
48
|
-
- **Example**: `100`
|
|
49
|
-
- **Purpose**: Controls the length of generated release notes
|
|
35
|
+
#### GitHub Actions
|
|
50
36
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
37
|
+
| Variable | Description | Example |
|
|
38
|
+
|----------|-------------|---------|
|
|
39
|
+
| `GITHUB_REPOSITORY` | Repository name | `owner/repo` |
|
|
40
|
+
| `GITHUB_SHA` | Current commit SHA | `abc123...` |
|
|
55
41
|
|
|
56
|
-
####
|
|
42
|
+
#### GitLab CI
|
|
57
43
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
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...` |
|
|
62
49
|
|
|
63
|
-
|
|
64
|
-
- **Default**: Uses `GITLAB_USER_EMAIL`
|
|
65
|
-
- **Example**: `ci@example.com`
|
|
66
|
-
- **Purpose**: Sets the committer email for git operations
|
|
50
|
+
---
|
|
67
51
|
|
|
68
|
-
## Configuration
|
|
52
|
+
## Platform Configuration
|
|
69
53
|
|
|
70
|
-
###
|
|
54
|
+
### GitHub Actions
|
|
71
55
|
|
|
72
56
|
```yaml
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
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: npx @logickernel/agileflow github
|
|
89
78
|
```
|
|
90
79
|
|
|
91
|
-
###
|
|
80
|
+
### GitLab CI
|
|
92
81
|
|
|
93
82
|
```yaml
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
GITLAB_USER_EMAIL: "agileflow@example.com"
|
|
98
|
-
CI_SERVER_HOST: "gitlab.example.com"
|
|
99
|
-
CI_PROJECT_PATH: "mygroup/myproject"
|
|
100
|
-
AGILEFLOW_MAX_COMMIT_LINES: "100"
|
|
101
|
-
AGILEFLOW_INCLUDE_MERGE_COMMITS: "false"
|
|
102
|
-
|
|
103
|
-
include:
|
|
104
|
-
- local: templates/AgileFlow.gitlab-ci.yml
|
|
105
|
-
|
|
106
|
-
build:
|
|
107
|
-
stage: build
|
|
83
|
+
agileflow:
|
|
84
|
+
stage: version
|
|
85
|
+
image: node:20-alpine
|
|
108
86
|
script:
|
|
109
|
-
-
|
|
110
|
-
|
|
111
|
-
|
|
87
|
+
- VERSION=$(npx @logickernel/agileflow gitlab --quiet)
|
|
88
|
+
- echo "VERSION=$VERSION" >> version.env
|
|
89
|
+
artifacts:
|
|
90
|
+
reports:
|
|
91
|
+
dotenv: version.env
|
|
92
|
+
only:
|
|
93
|
+
- main
|
|
112
94
|
```
|
|
113
95
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
```yaml
|
|
117
|
-
# .gitlab-ci.yml
|
|
118
|
-
include:
|
|
119
|
-
- local: templates/AgileFlow.gitlab-ci.yml
|
|
120
|
-
|
|
121
|
-
# Development environment
|
|
122
|
-
build-dev:
|
|
123
|
-
stage: build
|
|
124
|
-
variables:
|
|
125
|
-
AGILEFLOW_MAX_COMMIT_LINES: "25"
|
|
126
|
-
script:
|
|
127
|
-
- echo "Building dev version ${VERSION}"
|
|
128
|
-
needs:
|
|
129
|
-
- agileflow
|
|
130
|
-
|
|
131
|
-
# Production environment
|
|
132
|
-
build-prod:
|
|
133
|
-
stage: build
|
|
134
|
-
variables:
|
|
135
|
-
AGILEFLOW_MAX_COMMIT_LINES: "100"
|
|
136
|
-
script:
|
|
137
|
-
- echo "Building production version ${VERSION}"
|
|
138
|
-
needs:
|
|
139
|
-
- agileflow
|
|
140
|
-
```
|
|
96
|
+
---
|
|
141
97
|
|
|
142
|
-
## Setting
|
|
98
|
+
## Setting Up Tokens
|
|
143
99
|
|
|
144
|
-
###
|
|
100
|
+
### GitHub Personal Access Token
|
|
145
101
|
|
|
146
|
-
1. Go to
|
|
147
|
-
2.
|
|
148
|
-
3.
|
|
149
|
-
|
|
150
|
-
- **
|
|
151
|
-
- **
|
|
152
|
-
|
|
153
|
-
- **Environment scope**: All (default)
|
|
154
|
-
- **Protect variable**: Yes (recommended)
|
|
155
|
-
- **Mask variable**: No
|
|
102
|
+
1. Go to **Settings → Developer settings → Personal access tokens → Fine-grained tokens**
|
|
103
|
+
2. Click **Generate new token**
|
|
104
|
+
3. Configure:
|
|
105
|
+
- **Name**: `AgileFlow`
|
|
106
|
+
- **Repository access**: Select your repositories
|
|
107
|
+
- **Permissions**: `Contents: Read and write`
|
|
108
|
+
4. Copy the token
|
|
156
109
|
|
|
157
|
-
|
|
110
|
+
Add as a repository secret:
|
|
111
|
+
1. Go to repository **Settings → Secrets and variables → Actions**
|
|
112
|
+
2. Click **New repository secret**
|
|
113
|
+
3. Name: `AGILEFLOW_TOKEN`, Value: your token
|
|
158
114
|
|
|
159
|
-
|
|
115
|
+
### GitLab Project Access Token
|
|
160
116
|
|
|
161
|
-
1. Go to
|
|
162
|
-
2.
|
|
163
|
-
|
|
164
|
-
|
|
117
|
+
1. Go to project **Settings → Access tokens**
|
|
118
|
+
2. Create new token:
|
|
119
|
+
- **Name**: `AgileFlow`
|
|
120
|
+
- **Role**: `Maintainer`
|
|
121
|
+
- **Scopes**: `api`
|
|
122
|
+
3. Copy the token
|
|
165
123
|
|
|
166
|
-
|
|
124
|
+
Add as a CI/CD variable:
|
|
125
|
+
1. Go to project **Settings → CI/CD → Variables**
|
|
126
|
+
2. Add variable:
|
|
127
|
+
- **Key**: `AGILEFLOW_TOKEN`
|
|
128
|
+
- **Value**: your token
|
|
129
|
+
- **Flags**: Protected, Masked
|
|
167
130
|
|
|
168
|
-
|
|
131
|
+
---
|
|
169
132
|
|
|
170
|
-
|
|
171
|
-
2. Expand **Variables**
|
|
172
|
-
3. Add instance-wide defaults
|
|
173
|
-
|
|
174
|
-
## Security Considerations
|
|
133
|
+
## Security Best Practices
|
|
175
134
|
|
|
176
135
|
### Token Security
|
|
177
136
|
|
|
178
|
-
- **
|
|
179
|
-
- **
|
|
180
|
-
- **
|
|
181
|
-
- **Rotate tokens
|
|
137
|
+
- **Use project tokens** over personal tokens when possible
|
|
138
|
+
- **Enable protection** for sensitive variables
|
|
139
|
+
- **Limit scope** to only required permissions
|
|
140
|
+
- **Rotate tokens** regularly
|
|
141
|
+
- **Use masked variables** to hide values in logs
|
|
182
142
|
|
|
183
143
|
### Access Control
|
|
184
144
|
|
|
185
|
-
- **Minimal permissions
|
|
186
|
-
- **
|
|
187
|
-
- **Audit access
|
|
145
|
+
- **Minimal permissions** — Use tokens with only required access
|
|
146
|
+
- **Protected branches** — Limit who can push to main
|
|
147
|
+
- **Audit access** — Regularly review token usage
|
|
148
|
+
|
|
149
|
+
### Example: Protected Variable
|
|
150
|
+
|
|
151
|
+
**GitHub:**
|
|
152
|
+
- Repository secrets are automatically protected
|
|
153
|
+
- Only workflows triggered from the default branch can access them
|
|
154
|
+
|
|
155
|
+
**GitLab:**
|
|
156
|
+
```yaml
|
|
157
|
+
# Variable settings:
|
|
158
|
+
# - Protected: Yes (only available on protected branches)
|
|
159
|
+
# - Masked: Yes (hidden in job logs)
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
---
|
|
188
163
|
|
|
189
164
|
## Troubleshooting Configuration
|
|
190
165
|
|
|
191
|
-
###
|
|
166
|
+
### Token Permission Errors
|
|
192
167
|
|
|
193
|
-
**
|
|
168
|
+
**GitHub:**
|
|
194
169
|
```
|
|
195
|
-
Error:
|
|
170
|
+
Error: Resource not accessible by integration
|
|
196
171
|
```
|
|
197
|
-
|
|
172
|
+
- Ensure token has `contents: write` permission
|
|
173
|
+
- Check repository access is granted
|
|
198
174
|
|
|
199
|
-
**
|
|
175
|
+
**GitLab:**
|
|
200
176
|
```
|
|
201
|
-
Error:
|
|
177
|
+
Error: 403 Forbidden
|
|
202
178
|
```
|
|
203
|
-
|
|
179
|
+
- Ensure token has `api` scope
|
|
180
|
+
- Verify `Maintainer` role or higher
|
|
181
|
+
- Check token hasn't expired
|
|
182
|
+
|
|
183
|
+
### Missing Environment Variables
|
|
204
184
|
|
|
205
|
-
**Invalid Project Path**
|
|
206
185
|
```
|
|
207
|
-
Error:
|
|
186
|
+
Error: AGILEFLOW_TOKEN environment variable is required but not set.
|
|
208
187
|
```
|
|
209
|
-
|
|
188
|
+
- Verify the variable is configured in your CI/CD settings
|
|
189
|
+
- Check variable protection settings match your branch
|
|
210
190
|
|
|
211
191
|
### Debug Configuration
|
|
212
192
|
|
|
213
|
-
Add a debug
|
|
193
|
+
Add a debug step to verify configuration:
|
|
194
|
+
|
|
195
|
+
**GitHub Actions:**
|
|
196
|
+
```yaml
|
|
197
|
+
- name: Debug
|
|
198
|
+
run: |
|
|
199
|
+
echo "Repository: $GITHUB_REPOSITORY"
|
|
200
|
+
echo "SHA: $GITHUB_SHA"
|
|
201
|
+
echo "Token set: ${{ secrets.AGILEFLOW_TOKEN != '' }}"
|
|
202
|
+
```
|
|
214
203
|
|
|
204
|
+
**GitLab CI:**
|
|
215
205
|
```yaml
|
|
216
|
-
debug
|
|
217
|
-
stage: build
|
|
206
|
+
debug:
|
|
218
207
|
script:
|
|
219
|
-
- echo "
|
|
220
|
-
- echo "
|
|
221
|
-
- echo "
|
|
222
|
-
- echo "AGILEFLOW_TOKEN: ${AGILEFLOW_TOKEN:0:10}..."
|
|
223
|
-
needs:
|
|
224
|
-
- agileflow
|
|
208
|
+
- echo "Server: $CI_SERVER_HOST"
|
|
209
|
+
- echo "Project: $CI_PROJECT_PATH"
|
|
210
|
+
- echo "Token set: ${AGILEFLOW_TOKEN:+yes}"
|
|
225
211
|
```
|
|
226
212
|
|
|
213
|
+
---
|
|
214
|
+
|
|
227
215
|
## Related Documentation
|
|
228
216
|
|
|
229
|
-
- [Installation Guide](./installation.md)
|
|
230
|
-
- [
|
|
231
|
-
- [Troubleshooting](./troubleshooting.md)
|
|
232
|
-
- [CLI Reference](./cli-reference.md) - Command-line configuration
|
|
217
|
+
- [Installation Guide](./installation.md) — Complete setup instructions
|
|
218
|
+
- [CLI Reference](./cli-reference.md) — Command-line options
|
|
219
|
+
- [Troubleshooting](./troubleshooting.md) — Common issues and solutions
|