@logickernel/agileflow 0.1.0 → 0.2.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/docs/README.md +0 -1
- package/docs/cli-reference.md +231 -60
- package/docs/getting-started.md +144 -160
- package/package.json +1 -1
- package/src/git-push.js +26 -0
- package/src/github-push.js +156 -0
- package/src/gitlab-push.js +136 -0
- package/src/index.js +93 -29
- package/src/utils.js +117 -104
- package/docs/gitlab-ci-template.md +0 -324
- package/src/git-utils.js +0 -57
- package/src/local.js +0 -17
- package/templates/agileflow-tagged.gitlab-ci.yml +0 -66
- package/templates/agileflow.gitlab-ci.yml +0 -64
package/docs/README.md
CHANGED
|
@@ -22,7 +22,6 @@ Welcome to the AgileFlow documentation! This folder contains detailed guides and
|
|
|
22
22
|
- **[Release Management](./release-management.md)** - How to manage releases and versions effectively
|
|
23
23
|
|
|
24
24
|
### Reference
|
|
25
|
-
- **[GitLab CI Template](./gitlab-ci-template.md)** - Complete reference for the AgileFlow GitLab CI template
|
|
26
25
|
- **[CLI Reference](./cli-reference.md)** - Command-line interface documentation
|
|
27
26
|
- **[Configuration](./configuration.md)** - Configuration options and environment variables
|
|
28
27
|
|
package/docs/cli-reference.md
CHANGED
|
@@ -1,110 +1,281 @@
|
|
|
1
1
|
# CLI Reference
|
|
2
2
|
|
|
3
|
-
AgileFlow provides a simple command-line interface for
|
|
3
|
+
AgileFlow provides a simple command-line interface for automatic semantic versioning and changelog generation.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
AgileFlow can be 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
|
+
```
|
|
8
19
|
|
|
9
20
|
## Usage
|
|
10
21
|
|
|
11
22
|
```bash
|
|
12
|
-
agileflow
|
|
23
|
+
agileflow [options]
|
|
24
|
+
agileflow <command>
|
|
13
25
|
```
|
|
14
26
|
|
|
15
27
|
## Commands
|
|
16
28
|
|
|
17
|
-
###
|
|
29
|
+
### Default (no command)
|
|
18
30
|
|
|
19
|
-
|
|
31
|
+
Analyzes the current branch and displays version information without creating any tags.
|
|
20
32
|
|
|
21
33
|
```bash
|
|
22
|
-
agileflow
|
|
34
|
+
agileflow
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
**Output:**
|
|
23
38
|
```
|
|
39
|
+
Current version: v1.2.3
|
|
40
|
+
Next version: v1.2.4
|
|
41
|
+
Commits since current version: 3
|
|
42
|
+
|
|
43
|
+
Changelog:
|
|
44
|
+
### fix
|
|
45
|
+
- resolve authentication issue
|
|
46
|
+
|
|
47
|
+
### feat
|
|
48
|
+
- add new login flow
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### push
|
|
52
|
+
|
|
53
|
+
Creates an annotated git tag and pushes it to the origin remote using native git commands.
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
agileflow push
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
**Requirements:**
|
|
60
|
+
- Git credentials configured for push access
|
|
61
|
+
- No additional environment variables needed
|
|
24
62
|
|
|
25
|
-
**
|
|
26
|
-
-
|
|
27
|
-
-
|
|
28
|
-
-
|
|
29
|
-
-
|
|
30
|
-
- Outputs version information for CI/CD pipeline consumption
|
|
63
|
+
**Behavior:**
|
|
64
|
+
- Calculates the next version
|
|
65
|
+
- Creates an annotated tag with the changelog as the message
|
|
66
|
+
- Pushes the tag to origin
|
|
67
|
+
- If no version bump is needed, skips tag creation
|
|
31
68
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
69
|
+
### gitlab
|
|
70
|
+
|
|
71
|
+
Creates a version tag via the GitLab API. Designed for use in GitLab CI pipelines.
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
agileflow gitlab
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
**Required Environment Variable:**
|
|
78
|
+
- `AGILEFLOW_TOKEN` - GitLab access token with `api` scope
|
|
79
|
+
|
|
80
|
+
**Auto-provided by GitLab CI:**
|
|
35
81
|
- `CI_SERVER_HOST` - GitLab server hostname
|
|
36
|
-
- `CI_PROJECT_PATH` -
|
|
37
|
-
- `
|
|
82
|
+
- `CI_PROJECT_PATH` - Project path (e.g., "group/project")
|
|
83
|
+
- `CI_COMMIT_SHA` - Current commit SHA
|
|
38
84
|
|
|
39
|
-
**
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
85
|
+
**Example GitLab CI job:**
|
|
86
|
+
```yaml
|
|
87
|
+
agileflow:
|
|
88
|
+
stage: version
|
|
89
|
+
image: node:20-alpine
|
|
90
|
+
script:
|
|
91
|
+
- npx @logickernel/agileflow gitlab
|
|
92
|
+
only:
|
|
93
|
+
- main
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### github
|
|
97
|
+
|
|
98
|
+
Creates a version tag via the GitHub API. Designed for use in GitHub Actions workflows.
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
agileflow github
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
**Required Environment Variable:**
|
|
105
|
+
- `AGILEFLOW_TOKEN` - GitHub Personal Access Token with `contents: write` permission
|
|
106
|
+
|
|
107
|
+
**Auto-provided by GitHub Actions:**
|
|
108
|
+
- `GITHUB_REPOSITORY` - Repository name (e.g., "owner/repo")
|
|
109
|
+
- `GITHUB_SHA` - Current commit SHA
|
|
110
|
+
|
|
111
|
+
**Example GitHub Actions step:**
|
|
112
|
+
```yaml
|
|
113
|
+
- name: Create version tag
|
|
114
|
+
env:
|
|
115
|
+
AGILEFLOW_TOKEN: ${{ secrets.AGILEFLOW_TOKEN }}
|
|
116
|
+
run: npx @logickernel/agileflow github
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
## Options
|
|
120
|
+
|
|
121
|
+
### --quiet
|
|
122
|
+
|
|
123
|
+
Only output the next version string. Useful for capturing the version in scripts.
|
|
43
124
|
|
|
44
|
-
**Example:**
|
|
45
125
|
```bash
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
export CI_PROJECT_PATH="group/project"
|
|
50
|
-
export AGILEFLOW_TOKEN="glpat-xxxxxxxxxxxxxxxxxxxx"
|
|
126
|
+
agileflow --quiet
|
|
127
|
+
# Output: v1.2.4
|
|
128
|
+
```
|
|
51
129
|
|
|
52
|
-
|
|
130
|
+
If no version bump is needed, outputs nothing.
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
VERSION=$(npx @logickernel/agileflow --quiet)
|
|
134
|
+
if [ -n "$VERSION" ]; then
|
|
135
|
+
echo "New version: $VERSION"
|
|
136
|
+
else
|
|
137
|
+
echo "No version bump needed"
|
|
138
|
+
fi
|
|
53
139
|
```
|
|
54
140
|
|
|
55
|
-
|
|
141
|
+
### --help, -h
|
|
56
142
|
|
|
57
|
-
|
|
143
|
+
Display help information.
|
|
58
144
|
|
|
59
145
|
```bash
|
|
60
146
|
agileflow --help
|
|
61
|
-
agileflow -h
|
|
62
|
-
agileflow help
|
|
63
147
|
```
|
|
64
148
|
|
|
149
|
+
### --version, -v
|
|
150
|
+
|
|
151
|
+
Display the AgileFlow CLI version.
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
agileflow --version
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
## Exit Codes
|
|
158
|
+
|
|
159
|
+
| Code | Meaning |
|
|
160
|
+
|------|---------|
|
|
161
|
+
| 0 | Success |
|
|
162
|
+
| 1 | Error (missing token, git error, API error, etc.) |
|
|
163
|
+
|
|
65
164
|
## Error Handling
|
|
66
165
|
|
|
67
|
-
|
|
166
|
+
AgileFlow provides detailed error messages for common issues:
|
|
68
167
|
|
|
69
|
-
|
|
70
|
-
- **Git repository issues** - Helpful messages for git-related problems
|
|
71
|
-
- **API authentication failures** - Specific guidance for token issues
|
|
72
|
-
- **Network problems** - Clear error messages for connectivity issues
|
|
168
|
+
### Authentication Errors
|
|
73
169
|
|
|
74
|
-
|
|
170
|
+
**GitLab:**
|
|
171
|
+
```
|
|
172
|
+
AGILEFLOW_TOKEN environment variable is required but not set.
|
|
75
173
|
|
|
76
|
-
|
|
174
|
+
To fix this:
|
|
175
|
+
1. Create a project access token: https://gitlab.com/your/project/-/settings/access_tokens
|
|
176
|
+
- Name: AgileFlow Bot
|
|
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)
|
|
182
|
+
```
|
|
77
183
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
- Release note generation
|
|
82
|
-
- CI/CD pipeline integration
|
|
184
|
+
**GitHub:**
|
|
185
|
+
```
|
|
186
|
+
AGILEFLOW_TOKEN environment variable is required but not set.
|
|
83
187
|
|
|
84
|
-
|
|
188
|
+
To fix this:
|
|
189
|
+
1. Create a Personal Access Token with "contents: write" permission
|
|
190
|
+
2. Add it as a repository secret named AGILEFLOW_TOKEN
|
|
191
|
+
3. In your workflow, add: env: AGILEFLOW_TOKEN: ${{ secrets.AGILEFLOW_TOKEN }}
|
|
192
|
+
```
|
|
85
193
|
|
|
86
|
-
###
|
|
194
|
+
### Git Repository Errors
|
|
87
195
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
- Verify the token hasn't expired
|
|
196
|
+
```
|
|
197
|
+
Current directory is not a git repository (missing .git directory).
|
|
198
|
+
```
|
|
92
199
|
|
|
93
|
-
|
|
94
|
-
- Ensure `GITLAB_USER_NAME` and `GITLAB_USER_EMAIL` are set
|
|
95
|
-
- Check that the git repository is properly initialized
|
|
96
|
-
- Verify write access to the repository
|
|
200
|
+
### Detached HEAD State
|
|
97
201
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
202
|
+
```
|
|
203
|
+
Repository is in a detached HEAD state. Please check out a branch and try again.
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
## Examples
|
|
207
|
+
|
|
208
|
+
### Preview Version Locally
|
|
209
|
+
|
|
210
|
+
```bash
|
|
211
|
+
cd my-project
|
|
212
|
+
npx @logickernel/agileflow
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
### Get Version for Use in Scripts
|
|
216
|
+
|
|
217
|
+
```bash
|
|
218
|
+
VERSION=$(npx @logickernel/agileflow --quiet)
|
|
219
|
+
docker build -t myapp:$VERSION .
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
### GitLab CI Pipeline
|
|
223
|
+
|
|
224
|
+
```yaml
|
|
225
|
+
stages:
|
|
226
|
+
- version
|
|
227
|
+
- build
|
|
228
|
+
- deploy
|
|
102
229
|
|
|
103
|
-
|
|
230
|
+
agileflow:
|
|
231
|
+
stage: version
|
|
232
|
+
image: node:20-alpine
|
|
233
|
+
script:
|
|
234
|
+
- VERSION=$(npx @logickernel/agileflow gitlab --quiet)
|
|
235
|
+
- echo "VERSION=$VERSION" >> version.env
|
|
236
|
+
artifacts:
|
|
237
|
+
reports:
|
|
238
|
+
dotenv: version.env
|
|
239
|
+
only:
|
|
240
|
+
- main
|
|
241
|
+
|
|
242
|
+
build:
|
|
243
|
+
stage: build
|
|
244
|
+
script:
|
|
245
|
+
- docker build -t myapp:$VERSION .
|
|
246
|
+
needs:
|
|
247
|
+
- agileflow
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
### GitHub Actions Workflow
|
|
251
|
+
|
|
252
|
+
```yaml
|
|
253
|
+
name: Release
|
|
254
|
+
on:
|
|
255
|
+
push:
|
|
256
|
+
branches: [main]
|
|
257
|
+
|
|
258
|
+
jobs:
|
|
259
|
+
release:
|
|
260
|
+
runs-on: ubuntu-latest
|
|
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
|
|
274
|
+
```
|
|
104
275
|
|
|
105
276
|
## Related Documentation
|
|
106
277
|
|
|
107
278
|
- [Getting Started](./getting-started.md) - Quick start guide
|
|
108
|
-
- [GitLab CI Template](./gitlab-ci-template.md) - CI/CD integration
|
|
109
279
|
- [Conventional Commits](./conventional-commits.md) - Commit message format
|
|
280
|
+
- [Version-Centric CI/CD](./version-centric-cicd.md) - Methodology overview
|
|
110
281
|
- [Troubleshooting](./troubleshooting.md) - Common issues and solutions
|