@logickernel/agileflow 0.4.2 → 0.13.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/README.md CHANGED
@@ -80,9 +80,9 @@ jobs:
80
80
  **GitLab CI** (`.gitlab-ci.yml`):
81
81
  ```yaml
82
82
  agileflow:
83
- stage: version
84
- image: node:20-alpine
83
+ image: node:20
85
84
  script:
85
+ - npm install -g @logickernel/agileflow
86
86
  - npx @logickernel/agileflow gitlab
87
87
  rules:
88
88
  - if: '$CI_COMMIT_BRANCH == "main"'
@@ -161,11 +161,7 @@ AgileFlow analyzes commits since the last version tag to determine the appropria
161
161
  | Breaking change | `feat!: redesign API` | **Minor** (0.1.0 → 0.2.0) | **Major** (1.0.0 → 2.0.0) |
162
162
  | Feature | `feat: add login` | **Minor** | **Minor** |
163
163
  | Fix | `fix: resolve crash` | **Patch** | **Patch** |
164
- | Performance | `perf: optimize query` | **Patch** | **Patch** |
165
- | Refactor | `refactor: simplify logic` | **Patch** | **Patch** |
166
- | Build/CI | `build: update deps` | **Patch** | **Patch** |
167
- | Docs only | `docs: update README` | No bump | No bump |
168
- | Style changes | `style: update variable name` | No bump | No bump |
164
+ | Everything else | `docs: update README` | No bump | No bump |
169
165
 
170
166
  ---
171
167
 
@@ -189,8 +189,6 @@ AgileFlow determines version bumps from commits:
189
189
  ```bash
190
190
  # Patch bump (v1.0.0 → v1.0.1)
191
191
  fix: resolve login bug
192
- perf: optimize queries
193
- refactor: simplify logic
194
192
 
195
193
  # Minor bump (v1.0.0 → v1.1.0)
196
194
  feat: add user dashboard
@@ -199,6 +197,8 @@ feat: add user dashboard
199
197
  feat!: remove deprecated API
200
198
 
201
199
  # No bump
200
+ perf: optimize queries
201
+ refactor: simplify logic
202
202
  docs: update README
203
203
  chore: update dependencies
204
204
  ```
@@ -29,14 +29,14 @@ type(scope): description
29
29
 
30
30
  | Type | Description | 1.0.0+ | 0.x.x |
31
31
  |------|-------------|--------|-------|
32
- | `feat` | New features | Minor | Patch |
32
+ | `feat` | New features | Minor | Minor |
33
33
  | `fix` | Bug fixes | Patch | Patch |
34
- | `perf` | Performance improvements | Patch | Patch |
35
- | `refactor` | Code refactoring | Patch | Patch |
36
- | `build` | Build system changes | Patch | Patch |
37
- | `ci` | CI/CD changes | Patch | Patch |
38
- | `test` | Test changes | Patch | Patch |
39
- | `revert` | Revert commits | Patch | Patch |
34
+ | `perf` | Performance improvements | None | None |
35
+ | `refactor` | Code refactoring | None | None |
36
+ | `build` | Build system changes | None | None |
37
+ | `ci` | CI/CD changes | None | None |
38
+ | `test` | Test changes | None | None |
39
+ | `revert` | Revert commits | None | None |
40
40
  | `docs` | Documentation | None | None |
41
41
  | `style` | Code style | None | None |
42
42
  | `chore` | Maintenance | None | None |
@@ -123,9 +123,9 @@ chore: update development dependencies
123
123
  When multiple commits exist, the highest priority wins:
124
124
 
125
125
  1. **Breaking changes** → Major (or Minor for 0.x.x)
126
- 2. **Features** → Minor (or Patch for 0.x.x)
127
- 3. **Fixes, Performance, etc.** → Patch
128
- 4. **Docs, Style, Chore** → No bump
126
+ 2. **Features** → Minor
127
+ 3. **Fixes** → Patch
128
+ 4. **Everything else** → No bump
129
129
 
130
130
  ### Example
131
131
 
@@ -190,7 +190,7 @@ docs: internal notes [skip release]
190
190
  ## Non-Conventional Commits
191
191
 
192
192
  Commits not following the format:
193
- - Trigger **patch bump** by default
193
+ - Trigger **no bump** by default
194
194
  - Appear under "Other changes" in release notes
195
195
  - Use `[skip release]` to prevent bump
196
196
 
@@ -121,9 +121,9 @@ jobs:
121
121
  ```yaml
122
122
  # Runs on merge to main - creates the tag
123
123
  agileflow:
124
- stage: version
125
- image: node:20-alpine
124
+ image: node:20
126
125
  script:
126
+ - npm install -g @logickernel/agileflow
127
127
  - npx @logickernel/agileflow gitlab
128
128
  rules:
129
129
  - if: '$CI_COMMIT_BRANCH == "main"'
@@ -154,19 +154,12 @@ This creates an annotated tag and pushes it. Configure your CI to trigger on tag
154
154
 
155
155
  AgileFlow analyzes commit messages to determine the bump:
156
156
 
157
- | Commit Type | Example | Version Bump |
158
- |-------------|---------|--------------|
159
- | Breaking change | `feat!: redesign API` | **Major** (1.0.0 → 2.0.0) |
160
- | Feature | `feat: add login` | **Minor** (1.0.0 1.1.0) |
161
- | Fix | `fix: resolve crash` | **Patch** (1.0.0 1.0.1) |
162
- | Performance | `perf: optimize query` | **Patch** |
163
- | Docs only | `docs: update README` | No bump |
164
-
165
- ### Pre-1.0.0 Behavior
166
-
167
- During initial development (0.x.x):
168
- - Features and fixes → **patch** bump
169
- - Breaking changes → **minor** bump
157
+ | Commit Type | Example | 0.x.x | 1.0.0+ |
158
+ |-------------|---------|-------|--------|
159
+ | Breaking change | `feat!: redesign API` | **Minor** (0.1.0 → 0.2.0) | **Major** (1.0.0 → 2.0.0) |
160
+ | Feature | `feat: add login` | **Minor** | **Minor** |
161
+ | Fix | `fix: resolve crash` | **Patch** | **Patch** |
162
+ | Everything else | `docs: update README` | No bump | No bump |
170
163
 
171
164
  ### No Bump Needed
172
165
 
@@ -226,7 +219,7 @@ Yes! Running `npx @logickernel/agileflow` without a command shows the next versi
226
219
 
227
220
  ### No Version Bump Detected
228
221
  - Use conventional commit format (`type: description`)
229
- - Include bump-triggering types: `feat`, `fix`, `perf`, etc.
222
+ - Include bump-triggering types: `feat` (minor) or `fix` (patch)
230
223
 
231
224
  ---
232
225
 
@@ -189,8 +189,9 @@ stages:
189
189
  # Versioning job - runs on merge to main
190
190
  agileflow:
191
191
  stage: version
192
- image: node:20-alpine
192
+ image: node:20
193
193
  script:
194
+ - npm install @logickernel/agileflow
194
195
  - npx @logickernel/agileflow gitlab
195
196
  rules:
196
197
  - if: '$CI_COMMIT_BRANCH == "main"'
@@ -199,9 +200,7 @@ agileflow:
199
200
  build:
200
201
  stage: build
201
202
  script:
202
- - echo "Building version $CI_COMMIT_TAG"
203
- - docker build -t myapp:$CI_COMMIT_TAG .
204
- - docker push myapp:$CI_COMMIT_TAG
203
+ # Script to build your software, usually a docker image that is pulled to a registry
205
204
  rules:
206
205
  - if: '$CI_COMMIT_TAG =~ /^v/'
207
206
 
@@ -209,7 +208,7 @@ build:
209
208
  deploy-staging:
210
209
  stage: deploy
211
210
  script:
212
- - kubectl set image deployment/myapp myapp=myapp:$CI_COMMIT_TAG
211
+ # Script to deploy your software in staging
213
212
  environment:
214
213
  name: staging
215
214
  rules:
@@ -218,7 +217,7 @@ deploy-staging:
218
217
  deploy-production:
219
218
  stage: deploy
220
219
  script:
221
- - kubectl set image deployment/myapp myapp=myapp:$CI_COMMIT_TAG
220
+ # Script to deploy your software in production
222
221
  environment:
223
222
  name: production
224
223
  rules:
@@ -30,13 +30,12 @@ MAJOR.MINOR.PATCH
30
30
 
31
31
  ### Automatic Version Calculation
32
32
 
33
- | Commit Type | Example | Version Bump |
34
- |-------------|---------|--------------|
35
- | Breaking | `feat!: remove API` | Major |
36
- | Feature | `feat: add login` | Minor |
37
- | Fix | `fix: resolve crash` | Patch |
38
- | Performance | `perf: optimize` | Patch |
39
- | No bump | `docs: update README` | None |
33
+ | Commit Type | Example | 0.x.x | 1.0.0+ |
34
+ |-------------|---------|-------|--------|
35
+ | Breaking change | `feat!: redesign API` | **Minor** (0.1.0 → 0.2.0) | **Major** (1.0.0 → 2.0.0) |
36
+ | Feature | `feat: add login` | **Minor** | **Minor** |
37
+ | Fix | `fix: resolve crash` | **Patch** | **Patch** |
38
+ | Everything else | `docs: update README` | No bump | No bump |
40
39
 
41
40
  ---
42
41
 
@@ -170,7 +169,8 @@ git tag -l -n99 v1.2.4
170
169
 
171
170
  New projects start at v0.0.0:
172
171
 
173
- - Features/fixesPatch bump (0.0.0 → 0.0.1)
172
+ - Features → Minor bump (0.0.0 → 0.1.0)
173
+ - Fixes → Patch bump (0.0.0 → 0.0.1)
174
174
  - Breaking changes → Minor bump (0.0.0 → 0.1.0)
175
175
 
176
176
  ---
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@logickernel/agileflow",
3
- "version": "0.4.2",
3
+ "version": "0.13.0",
4
4
  "description": "Automatic semantic versioning and changelog generation based on conventional commits",
5
5
  "main": "src/index.js",
6
6
  "bin": {
@@ -35,6 +35,6 @@
35
35
  "type": "git",
36
36
  "url": "git@code.logickernel.com:kernel/agileflow.git"
37
37
  },
38
- "author": "Víctor H. Valle <victor.valle@logickernel.com>",
38
+ "author": "Víctor Valle <victor.valle@logickernel.com>",
39
39
  "license": "ISC"
40
40
  }
@@ -91,7 +91,7 @@ function createTagViaAPI(tagName, message, projectPath, serverHost, accessToken,
91
91
  * @param {string} message - The tag message
92
92
  * @returns {Promise<void>}
93
93
  */
94
- async function pushTag(tagName, message) {
94
+ async function pushTag(tagName, message, quiet = false) {
95
95
  const accessToken = process.env.AGILEFLOW_TOKEN;
96
96
  const serverHost = process.env.CI_SERVER_HOST;
97
97
  const projectPath = process.env.CI_PROJECT_PATH;
@@ -128,6 +128,11 @@ async function pushTag(tagName, message) {
128
128
  }
129
129
 
130
130
  await createTagViaAPI(tagName, message || tagName, projectPath, serverHost, accessToken, commitSha);
131
+
132
+ if (!quiet) {
133
+ const commitUrl = `https://${process.env.CI_SERVER_HOST}/${process.env.CI_PROJECT_PATH}/-/commit/${process.env.CI_COMMIT_SHA}/pipelines`;
134
+ console.log(`Tag ${tagName} created and pushed successfully.\nView the build pipelines at: ${commitUrl}`);
135
+ }
131
136
  }
132
137
 
133
138
  module.exports = {
package/src/utils.js CHANGED
@@ -72,8 +72,7 @@ function getCurrentBranch() {
72
72
  }
73
73
 
74
74
  // Conventional commit type configuration
75
- const TYPE_ORDER = ['feat', 'fix', 'perf', 'refactor', 'style', 'test', 'docs', 'build', 'ci', 'chore', 'revert'];
76
- const PATCH_TYPES = ['fix', 'perf', 'refactor', 'test', 'build', 'ci', 'revert'];
75
+ const TYPE_ORDER = ['feat', 'fix', 'perf', 'refactor', 'style', 'test', 'build', 'ci', 'docs', 'chore', 'revert'];
77
76
  const SEMVER_PATTERN = /^v(\d+)\.(\d+)\.(\d+)(-[a-zA-Z0-9.-]+)?$/;
78
77
 
79
78
  // Friendly header names for changelog
@@ -208,19 +207,19 @@ function parseVersion(version) {
208
207
 
209
208
  /**
210
209
  * Determines version bump type based on commit analysis.
211
- * @param {{hasBreaking: boolean, hasFeat: boolean, hasPatchTypes: boolean}} analysis
210
+ * @param {{hasBreaking: boolean, hasFeat: boolean, hasFix: boolean}} analysis
212
211
  * @param {boolean} isPreOneZero - Whether current version is 0.x.x
213
212
  * @returns {'major'|'minor'|'patch'|'none'}
214
213
  */
215
214
  function determineVersionBumpType(analysis, isPreOneZero) {
216
- const { hasBreaking, hasFeat, hasPatchTypes } = analysis;
215
+ const { hasBreaking, hasFeat, hasFix } = analysis;
217
216
  if (isPreOneZero) {
218
217
  if (hasBreaking || hasFeat) return 'minor';
219
- if (hasPatchTypes) return 'patch';
218
+ if (hasFix) return 'patch';
220
219
  } else {
221
220
  if (hasBreaking) return 'major';
222
221
  if (hasFeat) return 'minor';
223
- if (hasPatchTypes) return 'patch';
222
+ if (hasFix) return 'patch';
224
223
  }
225
224
  return 'none';
226
225
  }
@@ -255,12 +254,12 @@ function isBreakingChange(commit, parsed) {
255
254
  /**
256
255
  * Analyzes commits to determine version bump requirements.
257
256
  * @param {Array} commits - Array of commit objects
258
- * @returns {{hasBreaking: boolean, hasFeat: boolean, hasPatchTypes: boolean, commitsByType: Object, breakingCommits: Array}}
257
+ * @returns {{hasBreaking: boolean, hasFeat: boolean, hasFix: boolean, commitsByType: Object, breakingCommits: Array}}
259
258
  */
260
259
  function analyzeCommitsForVersioning(commits) {
261
260
  const commitsByType = Object.fromEntries(TYPE_ORDER.map(t => [t, []]));
262
261
  const breakingCommits = [];
263
- let hasBreaking = false, hasFeat = false, hasPatchTypes = false;
262
+ let hasBreaking = false, hasFeat = false, hasFix = false;
264
263
 
265
264
  for (const commit of commits) {
266
265
  const parsed = parseConventionalCommit(commit.message);
@@ -275,7 +274,7 @@ function analyzeCommitsForVersioning(commits) {
275
274
  } else {
276
275
  // Only add to type sections if not breaking
277
276
  if (type === 'feat') hasFeat = true;
278
- else if (PATCH_TYPES.includes(type)) hasPatchTypes = true;
277
+ else if (type === 'fix') hasFix = true;
279
278
 
280
279
  if (commitsByType[type]) {
281
280
  commitsByType[type].push(commit);
@@ -283,7 +282,7 @@ function analyzeCommitsForVersioning(commits) {
283
282
  }
284
283
  }
285
284
 
286
- return { hasBreaking, hasFeat, hasPatchTypes, commitsByType, breakingCommits };
285
+ return { hasBreaking, hasFeat, hasFix, commitsByType, breakingCommits };
287
286
  }
288
287
 
289
288
  /**