@logickernel/agileflow 0.2.2 → 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.
@@ -1,163 +1,301 @@
1
- # Installation & Setup Guide
1
+ # Installation Guide
2
2
 
3
- This guide covers installing and setting up AgileFlow for different platforms and use cases.
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
- Before installing AgileFlow, ensure you have:
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
- - **Git Repository**: A Git repository with GitLab CI/CD enabled
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
- ## GitLab CI Installation
13
+ Preview your next version without any setup:
14
14
 
15
- ### Step 1: Include the AgileFlow Template
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
- Add this line to the top of your `.gitlab-ci.yml` file:
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
- include:
21
- - remote: https://code.logickernel.com/kernel/agileflow/-/raw/main/templates/AgileFlow.gitlab-ci.yml
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 2: Configure the AGILEFLOW_TOKEN
96
+ ### Step 4: Create the Release Workflow
25
97
 
26
- AgileFlow needs a GitLab access token to create version tags via the API. Set this in your GitLab project's CI/CD variables:
98
+ Create `.github/workflows/release.yml` to handle builds triggered by tags:
27
99
 
28
- 1. Go to your GitLab project
29
- 2. Navigate to **Settings > CI/CD**
30
- 3. Expand **Variables**
31
- 4. Add the `AGILEFLOW_TOKEN` variable:
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
- | Variable | Value | Type | Protect | Mask |
34
- |----------|-------|------|---------|------|
35
- | `AGILEFLOW_TOKEN` | Your GitLab API token | Variable | Yes | No |
139
+ ### Step 5: Test the Setup
36
140
 
37
- #### Creating the AGILEFLOW_TOKEN
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
- You need a GitLab access token with API permissions. You can create either:
152
+ ## GitLab CI
40
153
 
41
- **Option 1: Project Access Token (Recommended)**
42
- 1. Go to your project's **Settings > Access Tokens**
43
- 2. Create a new token with:
44
- - **Name**: `AgileFlow Bot`
45
- - **Description**: `Token for AgileFlow automatic versioning`
46
- - **Role**: `maintainer` or higher
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 generated token
162
+ 3. Copy the token
49
163
 
50
- **Option 2: Personal Access Token**
51
- 1. Go to your user **Settings > Access Tokens**
52
- 2. Create a new token with:
53
- - **Name**: `AgileFlow Bot`
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 generated token
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: Add Your First Job
179
+ ### Step 3: Configure Your Pipeline
59
180
 
60
- Below the include statement, add a simple build job to test the setup:
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 ${VERSION}"
67
- - docker build -t myapp:${VERSION} .
68
- - docker push myapp:${VERSION}
69
- needs:
70
- - agileflow
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 Installation
229
+ ### Step 4: Test the Setup
74
230
 
75
- 1. Commit and push your changes:
231
+ 1. Push a commit with conventional format:
76
232
  ```bash
77
- git add .gitlab-ci.yml
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
- 2. Check your GitLab CI pipeline - it should automatically start
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
- ## How It Works
242
+ ## Other CI/CD Platforms
87
243
 
88
- AgileFlow uses a different approach than traditional CI/CD tools:
244
+ For platforms without native API integration, use the `push` command:
89
245
 
90
- ### No Git Push Required
91
- - **AgileFlow does NOT push tags to your repository** using git commands
92
- - **Instead, it uses the GitLab API** to create tags remotely
93
- - **This eliminates the need** for job token permissions to push to the repository
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
- ### Version Generation Process
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
- ### Benefits of This Approach
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
- ## Troubleshooting Installation
258
+ ## How It Works
108
259
 
109
- ### Common Issues
260
+ AgileFlow uses platform APIs to create version tags:
110
261
 
111
- #### AGILEFLOW_TOKEN Permission Errors
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
- **Problem**: Token permission denied errors.
267
+ ### Benefits
114
268
 
115
- **Solutions**:
116
- - Ensure the token has `api` scope
117
- - Verify the token has `maintainer` role or higher
118
- - Check that the token hasn't expired
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
- #### Template Include Fails
274
+ ---
122
275
 
123
- **Problem**: The AgileFlow template include statement fails.
276
+ ## Troubleshooting
124
277
 
125
- **Solutions**:
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
- #### VERSION Variable Not Available
280
+ **GitHub**: Ensure token has `contents: write` permission.
132
281
 
133
- **Problem**: The `${VERSION}` variable is not available in subsequent pipeline stages.
282
+ **GitLab**: Ensure token has `api` scope and `Maintainer` role.
134
283
 
135
- **Solutions**:
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
- ### Debug Configuration
286
+ - Check you're pushing to the main branch
287
+ - Verify conventional commit format
288
+ - Check pipeline logs for errors
142
289
 
143
- Add a debug job to verify the setup:
290
+ ### Build Not Triggered
144
291
 
145
- ```yaml
146
- debug-version:
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
- ## Next Steps
295
+ ---
157
296
 
158
- After successful installation:
297
+ ## Next Steps
159
298
 
160
- 1. **Read the [Getting Started Guide](./getting-started.md)** for your first pipeline
161
- 2. **Explore [Conventional Commits](./conventional-commits.md)** for proper commit formatting
162
- 3. **Review [GitLab CI Template Reference](./gitlab-ci-template.md)** for advanced configuration
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