@logickernel/agileflow 0.1.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.
@@ -0,0 +1,448 @@
1
+ # Branching Strategy Guide
2
+
3
+ AgileFlow introduces a simplified, yet powerful branching strategy that eliminates the complexity of traditional multi-branch workflows while maintaining flexibility for development teams.
4
+
5
+ ## Overview
6
+
7
+ Unlike traditional Git workflows that rely on multiple long-lived branches for different environments, AgileFlow uses a **main-branch-first approach** where:
8
+
9
+ - **Main branch** is the single source of truth for all releases
10
+ - **Development branches** are short-lived and focused on specific changes
11
+ - **All versions** are created from the same branch, ensuring consistency
12
+ - **Environment management** is handled through configuration, not branches
13
+
14
+ ## Core Principles
15
+
16
+ ### 1. Main Branch as Release Source
17
+
18
+ The main branch (or master) serves as the foundation for all releases:
19
+
20
+ ```mermaid
21
+ graph LR
22
+ A[main branch] --> B[v1.0.0]
23
+ A --> C[v1.0.1]
24
+ A --> D[v1.1.0]
25
+ A --> E[v2.0.0]
26
+
27
+ F[feature branch] --> A
28
+ G[bugfix branch] --> A
29
+ H[hotfix branch] --> A
30
+ ```
31
+
32
+ **Key Benefits:**
33
+ - **Single Version Sequence**: All versions share the same lineage
34
+ - **Consistent History**: Every release builds on the same foundation
35
+ - **Simplified Rollbacks**: Easy to revert to any previous version
36
+ - **No Branch Drift**: All environments can run identical versions
37
+
38
+ ### 2. Short-Lived Development Branches
39
+
40
+ Development branches are created for specific purposes and merged back quickly:
41
+
42
+ - **Purpose**: Implement features, fix bugs, or make improvements
43
+ - **Lifespan**: Days to weeks, not months
44
+ - **Target**: Always merge back to main when complete
45
+ - **Naming**: Descriptive names that indicate purpose
46
+
47
+ ### 3. Version-Centric Deployments
48
+
49
+ Instead of branch-based environments, AgileFlow uses version-based deployments:
50
+
51
+ ```mermaid
52
+ graph LR
53
+ A[Version v1.2.3] --> B[Staging Environment]
54
+ A --> C[Production Environment]
55
+ A --> D[Testing Environment]
56
+
57
+ E[Version v1.2.2] --> F[Previous Production]
58
+ ```
59
+
60
+ ## Branch Types and Naming
61
+
62
+ ### Feature Branches
63
+
64
+ For new features and enhancements:
65
+
66
+ ```bash
67
+ # Branch naming patterns
68
+ git checkout -b feat/user-authentication
69
+ git checkout -b feat/api-rate-limiting
70
+ git checkout -b feat/dark-mode-ui
71
+ ```
72
+
73
+ **When to use:**
74
+ - Adding new functionality
75
+ - Implementing user stories
76
+ - Creating new API endpoints
77
+ - Adding new UI components
78
+
79
+ **Workflow:**
80
+ 1. Create branch from main
81
+ 2. Implement feature with conventional commits
82
+ 3. Test thoroughly
83
+ 4. Create merge request
84
+ 5. Merge to main (triggers version bump)
85
+
86
+ ### Bug Fix Branches
87
+
88
+ For fixing bugs and issues:
89
+
90
+ ```bash
91
+ # Branch naming patterns
92
+ git checkout -b fix/login-validation-error
93
+ git checkout -b fix/api-timeout-issue
94
+ git checkout -b fix/memory-leak
95
+ ```
96
+
97
+ **When to use:**
98
+ - Fixing production bugs
99
+ - Resolving test failures
100
+ - Addressing security issues
101
+ - Fixing performance problems
102
+
103
+ **Workflow:**
104
+ 1. Create branch from main
105
+ 2. Fix the issue with conventional commits
106
+ 3. Add tests to prevent regression
107
+ 4. Create merge request
108
+ 5. Merge to main (triggers patch version)
109
+
110
+ ### Hotfix Branches
111
+
112
+ For urgent production fixes:
113
+
114
+ ```bash
115
+ # Branch naming patterns
116
+ git checkout -b hotfix/critical-security-patch
117
+ git checkout -b hotfix/database-connection-fix
118
+ git checkout -b hotfix/urgent-performance-fix
119
+ ```
120
+
121
+ **When to use:**
122
+ - Critical production issues
123
+ - Security vulnerabilities
124
+ - Data corruption issues
125
+ - Service outages
126
+
127
+ **Workflow:**
128
+ 1. Create branch from main
129
+ 2. Implement minimal fix
130
+ 3. Test thoroughly
131
+ 4. Create merge request
132
+ 5. Merge to main (triggers immediate patch version)
133
+ 6. Deploy immediately
134
+
135
+ ### Refactor Branches
136
+
137
+ For code improvements and technical debt:
138
+
139
+ ```bash
140
+ # Branch naming patterns
141
+ git checkout -b refactor/auth-service
142
+ git checkout -b refactor/database-layer
143
+ git checkout -b refactor/api-structure
144
+ ```
145
+
146
+ **When to use:**
147
+ - Improving code structure
148
+ - Reducing technical debt
149
+ - Optimizing performance
150
+ - Modernizing dependencies
151
+
152
+ **Workflow:**
153
+ 1. Create branch from main
154
+ 2. Implement refactoring
155
+ 3. Ensure all tests pass
156
+ 4. Create merge request
157
+ 5. Merge to main (triggers patch version)
158
+
159
+ ## Branch Lifecycle
160
+
161
+ ### 1. Creation
162
+
163
+ ```bash
164
+ # Always start from main
165
+ git checkout main
166
+ git pull origin main
167
+
168
+ # Create new branch
169
+ git checkout -b feat/new-feature
170
+ ```
171
+
172
+ **Best Practices:**
173
+ - Always start from an up-to-date main branch
174
+ - Use descriptive branch names
175
+ - Include type prefix (feat/, fix/, refactor/, etc.)
176
+
177
+ ### 2. Development
178
+
179
+ ```bash
180
+ # Make changes with conventional commits
181
+ git add .
182
+ git commit -m "feat: implement user authentication system"
183
+ git commit -m "test: add authentication unit tests"
184
+ git commit -m "docs: update API documentation"
185
+ ```
186
+
187
+ **Best Practices:**
188
+ - Use conventional commits consistently
189
+ - Make small, focused commits
190
+ - Include tests for new functionality
191
+ - Update documentation as needed
192
+
193
+ ### 3. Integration
194
+
195
+ ```bash
196
+ # Keep branch up to date with main
197
+ git checkout main
198
+ git pull origin main
199
+ git checkout feat/new-feature
200
+ git rebase main
201
+ ```
202
+
203
+ **Best Practices:**
204
+ - Rebase regularly to avoid conflicts
205
+ - Resolve conflicts during rebase
206
+ - Keep commits clean and logical
207
+
208
+ ### 4. Completion
209
+
210
+ ```bash
211
+ # Push branch and create merge request
212
+ git push origin feat/new-feature
213
+ ```
214
+
215
+ **Best Practices:**
216
+ - Ensure all tests pass
217
+ - Code review completed
218
+ - Documentation updated
219
+ - Ready for production
220
+
221
+ ### 5. Merge and Cleanup
222
+
223
+ ```bash
224
+ # After merge request is approved and merged
225
+ git checkout main
226
+ git pull origin main
227
+ git branch -d feat/new-feature
228
+ git push origin --delete feat/new-feature
229
+ ```
230
+
231
+ **Best Practices:**
232
+ - Delete local branch after merge
233
+ - Delete remote branch after merge
234
+ - Keep repository clean
235
+
236
+ ## Version Management
237
+
238
+ ### Automatic Version Bumping
239
+
240
+ AgileFlow automatically determines version bumps based on commit types:
241
+
242
+ ```bash
243
+ # Patch version (v1.0.0 → v1.0.1)
244
+ fix: resolve login bug
245
+ refactor: improve error handling
246
+ perf: optimize database queries
247
+ build: update dependencies
248
+ ci: fix pipeline configuration
249
+ revert: "feat: add experimental feature"
250
+
251
+ # No version bump
252
+ docs: update README
253
+ style: fix code formatting
254
+ chore: update dependencies
255
+
256
+ # Minor version (v1.0.0 → v1.1.0)
257
+ feat: add user authentication
258
+ perf: optimize database queries
259
+
260
+ # Major version (v1.0.0 → v2.0.0)
261
+ feat!: remove deprecated API
262
+ BREAKING CHANGE: change database schema
263
+ ```
264
+
265
+ ### Version Tags
266
+
267
+ Every merge to main creates a new version tag:
268
+
269
+ ```bash
270
+ # View all versions
271
+ git tag --sort=-version:refname
272
+
273
+ # Checkout specific version
274
+ git checkout v1.2.3
275
+
276
+ # View version details
277
+ git show v1.2.3
278
+ ```
279
+
280
+ ## Environment Management
281
+
282
+ ### Configuration Over Code
283
+
284
+ Instead of different branches for different environments, use configuration:
285
+
286
+ ```yaml
287
+ # .gitlab-ci.yml
288
+ deploy-staging:
289
+ stage: deploy
290
+ script:
291
+ - kubectl set image deployment/myapp myapp=myapp:${VERSION}
292
+ environment:
293
+ name: staging
294
+ variables:
295
+ DATABASE_URL: "staging-db.example.com"
296
+ LOG_LEVEL: "debug"
297
+
298
+ deploy-production:
299
+ stage: deploy
300
+ script:
301
+ - kubectl set image deployment/myapp myapp=myapp:${VERSION}
302
+ environment:
303
+ name: production
304
+ variables:
305
+ DATABASE_URL: "prod-db.example.com"
306
+ LOG_LEVEL: "info"
307
+ ```
308
+
309
+ ### Environment-Specific Configs
310
+
311
+ ```yaml
312
+ # config/staging.yaml
313
+ database:
314
+ host: staging-db.example.com
315
+ port: 5432
316
+ ssl: false
317
+
318
+ # config/production.yaml
319
+ database:
320
+ host: prod-db.example.com
321
+ port: 5432
322
+ ssl: true
323
+ ```
324
+
325
+ ## Best Practices
326
+
327
+ ### 1. Keep Branches Small and Focused
328
+
329
+ ```bash
330
+ # ✅ Good - Single purpose
331
+ git checkout -b feat/user-login
332
+ git checkout -b fix/password-validation
333
+
334
+ # ❌ Bad - Multiple unrelated changes
335
+ git checkout -b feature-and-bugfixes
336
+ ```
337
+
338
+ ### 2. Use Conventional Commits
339
+
340
+ ```bash
341
+ # ✅ Good
342
+ feat(auth): add OAuth2 login support
343
+ fix(api): handle null user ID gracefully
344
+ refactor(db): normalize user table schema
345
+
346
+ # ❌ Bad
347
+ add oauth login
348
+ fix bug
349
+ refactor stuff
350
+ ```
351
+
352
+ ### 3. Regular Integration
353
+
354
+ ```bash
355
+ # Rebase weekly to avoid large conflicts
356
+ git checkout main
357
+ git pull origin main
358
+ git checkout your-branch
359
+ git rebase main
360
+ ```
361
+
362
+ ### 4. Clean Merge History
363
+
364
+ ```bash
365
+ # Use rebase and merge for clean history
366
+ git checkout main
367
+ git pull origin main
368
+ git checkout feature-branch
369
+ git rebase main
370
+ git checkout main
371
+ git merge --ff-only feature-branch
372
+ ```
373
+
374
+ ### 5. Immediate Cleanup
375
+
376
+ ```bash
377
+ # Delete branches after merge
378
+ git branch -d feature-branch
379
+ git push origin --delete feature-branch
380
+ ```
381
+
382
+ ## Migration from Traditional Workflows
383
+
384
+ ### From GitFlow
385
+
386
+ If you're currently using GitFlow:
387
+
388
+ 1. **Stop creating release branches** - use main for all releases
389
+ 2. **Eliminate develop branch** - work directly from main
390
+ 3. **Convert hotfix branches** to hotfix/ branches that merge to main
391
+ 4. **Use feature branches** as before, but merge to main
392
+ 5. **Implement AgileFlow** for version management
393
+
394
+ ### From GitHub Flow
395
+
396
+ If you're using GitHub Flow:
397
+
398
+ 1. **Keep main branch** as your primary branch
399
+ 2. **Continue using feature branches** for development
400
+ 3. **Add AgileFlow** for automatic versioning
401
+ 4. **Use version-based deployments** instead of branch-based
402
+
403
+ ### From Trunk-Based Development
404
+
405
+ If you're using trunk-based development:
406
+
407
+ 1. **Continue working on main** for small changes
408
+ 2. **Use feature branches** for larger changes
409
+ 3. **Add AgileFlow** for version management
410
+ 4. **Implement conventional commits** for automatic versioning
411
+
412
+ ## Troubleshooting
413
+
414
+ ### Common Issues
415
+
416
+ **Merge Conflicts**
417
+ - Rebase regularly to minimize conflicts
418
+ - Resolve conflicts during rebase, not merge
419
+ - Keep branches small and focused
420
+
421
+ **Branch Divergence**
422
+ - Always start from up-to-date main
423
+ - Rebase instead of merge when updating
424
+ - Delete branches after merge
425
+
426
+ **Version Conflicts**
427
+ - Ensure conventional commits are used
428
+ - Check that AgileFlow is properly configured
429
+ - Verify merge request process
430
+
431
+ ### Getting Help
432
+
433
+ - **Documentation**: Check other guides in this documentation
434
+ - **Examples**: Review the getting started guide
435
+ - **Community**: Join discussions in the community forum
436
+ - **Issues**: Open an issue in the project repository
437
+
438
+ ## Conclusion
439
+
440
+ AgileFlow's branching strategy provides a simplified, yet powerful approach to Git workflow management. By focusing on the main branch as the single source of truth and using short-lived development branches, teams can:
441
+
442
+ - **Reduce complexity** in their Git workflow
443
+ - **Maintain consistency** across all environments
444
+ - **Automate versioning** through conventional commits
445
+ - **Simplify deployments** with version-based releases
446
+ - **Improve collaboration** with clear branch purposes
447
+
448
+ This approach transforms complex multi-branch workflows into a streamlined, version-centric process that scales from small teams to large enterprises.
@@ -0,0 +1,110 @@
1
+ # CLI Reference
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.
4
+
5
+ ## Installation
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.
8
+
9
+ ## Usage
10
+
11
+ ```bash
12
+ agileflow <command> [options]
13
+ ```
14
+
15
+ ## Commands
16
+
17
+ ### gitlab-ci
18
+
19
+ Configures git, computes semantic version tags from the release branch, and pushes to GitLab.
20
+
21
+ ```bash
22
+ agileflow gitlab-ci
23
+ ```
24
+
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
31
+
32
+ **Environment Variables Required:**
33
+ - `GITLAB_USER_NAME` - GitLab username for commit authorship
34
+ - `GITLAB_USER_EMAIL` - GitLab email for commit authorship
35
+ - `CI_SERVER_HOST` - GitLab server hostname
36
+ - `CI_PROJECT_PATH` - GitLab project path
37
+ - `AGILEFLOW_TOKEN` - GitLab access token with API permissions
38
+
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
43
+
44
+ **Example:**
45
+ ```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"
51
+
52
+ agileflow gitlab-ci
53
+ ```
54
+
55
+ ## Help
56
+
57
+ Get help information:
58
+
59
+ ```bash
60
+ agileflow --help
61
+ agileflow -h
62
+ agileflow help
63
+ ```
64
+
65
+ ## Error Handling
66
+
67
+ The CLI provides detailed error messages for common issues:
68
+
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
73
+
74
+ ## Integration
75
+
76
+ The CLI is primarily designed for use within GitLab CI pipelines via the AgileFlow template. It automatically handles:
77
+
78
+ - Git configuration
79
+ - Version calculation
80
+ - Tag creation and pushing
81
+ - Release note generation
82
+ - CI/CD pipeline integration
83
+
84
+ ## Troubleshooting
85
+
86
+ ### Common CLI Issues
87
+
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
92
+
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
97
+
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
102
+
103
+ For more detailed troubleshooting, see the [Troubleshooting Guide](./troubleshooting.md).
104
+
105
+ ## Related Documentation
106
+
107
+ - [Getting Started](./getting-started.md) - Quick start guide
108
+ - [GitLab CI Template](./gitlab-ci-template.md) - CI/CD integration
109
+ - [Conventional Commits](./conventional-commits.md) - Commit message format
110
+ - [Troubleshooting](./troubleshooting.md) - Common issues and solutions