@logickernel/agileflow 0.1.0 → 0.2.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/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
 
@@ -1,110 +1,281 @@
1
1
  # CLI Reference
2
2
 
3
- AgileFlow provides a simple command-line interface for CI/CD operations. The CLI is designed to be lightweight and focused on specific CI/CD tasks.
3
+ AgileFlow provides a simple command-line interface for automatic semantic versioning and changelog generation.
4
4
 
5
5
  ## Installation
6
6
 
7
- The AgileFlow CLI is included in the Docker image and is automatically available when using the GitLab CI template. For local development, you can run the CLI directly from the scripts directory.
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 <command> [options]
23
+ agileflow [options]
24
+ agileflow <command>
13
25
  ```
14
26
 
15
27
  ## Commands
16
28
 
17
- ### gitlab-ci
29
+ ### Default (no command)
18
30
 
19
- Configures git, computes semantic version tags from the release branch, and pushes to GitLab.
31
+ Analyzes the current branch and displays version information without creating any tags.
20
32
 
21
33
  ```bash
22
- agileflow gitlab-ci
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
- **What it does:**
26
- - Configures git user with environment variables
27
- - Analyzes commit history to determine next semantic version
28
- - Generates comprehensive release notes from conventional commits
29
- - Creates and pushes version tags to the repository
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
- **Environment Variables Required:**
33
- - `GITLAB_USER_NAME` - GitLab username for commit authorship
34
- - `GITLAB_USER_EMAIL` - GitLab email for commit authorship
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` - GitLab project path
37
- - `AGILEFLOW_TOKEN` - GitLab access token with API permissions
82
+ - `CI_PROJECT_PATH` - Project path (e.g., "group/project")
83
+ - `CI_COMMIT_SHA` - Current commit SHA
38
84
 
39
- **Output:**
40
- - Creates a `VERSION` file with the generated version
41
- - Pushes version tag to the repository
42
- - Provides version information via dotenv artifacts
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
- export GITLAB_USER_NAME="AgileFlow Bot"
47
- export GITLAB_USER_EMAIL="agileflow@example.com"
48
- export CI_SERVER_HOST="gitlab.example.com"
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
- agileflow gitlab-ci
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
- ## Help
141
+ ### --help, -h
56
142
 
57
- Get help information:
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
- The CLI provides detailed error messages for common issues:
166
+ AgileFlow provides detailed error messages for common issues:
68
167
 
69
- - **Missing environment variables** - Clear indication of what's required
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
- ## Integration
170
+ **GitLab:**
171
+ ```
172
+ AGILEFLOW_TOKEN environment variable is required but not set.
75
173
 
76
- The CLI is primarily designed for use within GitLab CI pipelines via the AgileFlow template. It automatically handles:
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
- - Git configuration
79
- - Version calculation
80
- - Tag creation and pushing
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
- ## Troubleshooting
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
- ### Common CLI Issues
194
+ ### Git Repository Errors
87
195
 
88
- **Permission Denied Errors**
89
- - Ensure the `AGILEFLOW_TOKEN` has sufficient permissions
90
- - Check that the token has "api" scope and maintainer role
91
- - Verify the token hasn't expired
196
+ ```
197
+ Current directory is not a git repository (missing .git directory).
198
+ ```
92
199
 
93
- **Git Configuration Errors**
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
- **Version Calculation Issues**
99
- - Check that conventional commit format is being used
100
- - Ensure there are commits since the last version tag
101
- - Verify the repository has proper tag history
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
- For more detailed troubleshooting, see the [Troubleshooting Guide](./troubleshooting.md).
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