pipecraft 0.0.0-releaseit → 0.26.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.
Files changed (183) hide show
  1. package/README.md +126 -108
  2. package/dist/cli/index.d.ts +69 -0
  3. package/dist/cli/index.d.ts.map +1 -1
  4. package/dist/cli/index.js +94 -22
  5. package/dist/cli/index.js.map +1 -1
  6. package/dist/generators/init.tpl.d.ts +70 -0
  7. package/dist/generators/init.tpl.d.ts.map +1 -1
  8. package/dist/generators/init.tpl.js +100 -8
  9. package/dist/generators/init.tpl.js.map +1 -1
  10. package/dist/generators/workflows.tpl.d.ts +86 -0
  11. package/dist/generators/workflows.tpl.d.ts.map +1 -1
  12. package/dist/generators/workflows.tpl.js +101 -9
  13. package/dist/generators/workflows.tpl.js.map +1 -1
  14. package/dist/templates/actions/calculate-version.yml.tpl.d.ts +47 -0
  15. package/dist/templates/actions/calculate-version.yml.tpl.d.ts.map +1 -1
  16. package/dist/templates/actions/calculate-version.yml.tpl.js +72 -3
  17. package/dist/templates/actions/calculate-version.yml.tpl.js.map +1 -1
  18. package/dist/templates/actions/create-pr.yml.tpl.d.ts +14 -0
  19. package/dist/templates/actions/create-pr.yml.tpl.d.ts.map +1 -1
  20. package/dist/templates/actions/create-pr.yml.tpl.js +22 -2
  21. package/dist/templates/actions/create-pr.yml.tpl.js.map +1 -1
  22. package/dist/templates/actions/create-release.yml.tpl.d.ts +18 -0
  23. package/dist/templates/actions/create-release.yml.tpl.d.ts.map +1 -0
  24. package/dist/templates/actions/create-release.yml.tpl.js +141 -0
  25. package/dist/templates/actions/create-release.yml.tpl.js.map +1 -0
  26. package/dist/templates/actions/create-tag.yml.tpl.d.ts +14 -0
  27. package/dist/templates/actions/create-tag.yml.tpl.d.ts.map +1 -1
  28. package/dist/templates/actions/create-tag.yml.tpl.js +22 -2
  29. package/dist/templates/actions/create-tag.yml.tpl.js.map +1 -1
  30. package/dist/templates/actions/detect-changes.yml.tpl.d.ts +70 -0
  31. package/dist/templates/actions/detect-changes.yml.tpl.d.ts.map +1 -1
  32. package/dist/templates/actions/detect-changes.yml.tpl.js +98 -2
  33. package/dist/templates/actions/detect-changes.yml.tpl.js.map +1 -1
  34. package/dist/templates/actions/manage-branch.yml.tpl.d.ts +14 -0
  35. package/dist/templates/actions/manage-branch.yml.tpl.d.ts.map +1 -1
  36. package/dist/templates/actions/manage-branch.yml.tpl.js +22 -2
  37. package/dist/templates/actions/manage-branch.yml.tpl.js.map +1 -1
  38. package/dist/templates/actions/promote-branch.yml.tpl.d.ts +14 -0
  39. package/dist/templates/actions/promote-branch.yml.tpl.d.ts.map +1 -1
  40. package/dist/templates/actions/promote-branch.yml.tpl.js +50 -7
  41. package/dist/templates/actions/promote-branch.yml.tpl.js.map +1 -1
  42. package/dist/templates/workflows/pipeline-path-based.yml.tpl.d.ts +114 -1
  43. package/dist/templates/workflows/pipeline-path-based.yml.tpl.d.ts.map +1 -1
  44. package/dist/templates/workflows/pipeline-path-based.yml.tpl.js +479 -74
  45. package/dist/templates/workflows/pipeline-path-based.yml.tpl.js.map +1 -1
  46. package/dist/types/index.d.ts +231 -8
  47. package/dist/types/index.d.ts.map +1 -1
  48. package/dist/types/index.js +9 -0
  49. package/dist/types/index.js.map +1 -1
  50. package/dist/utils/ast-path-operations.d.ts.map +1 -1
  51. package/dist/utils/ast-path-operations.js +24 -11
  52. package/dist/utils/ast-path-operations.js.map +1 -1
  53. package/dist/utils/config.d.ts +63 -0
  54. package/dist/utils/config.d.ts.map +1 -1
  55. package/dist/utils/config.js +71 -0
  56. package/dist/utils/config.js.map +1 -1
  57. package/dist/utils/github-setup.d.ts +323 -2
  58. package/dist/utils/github-setup.d.ts.map +1 -1
  59. package/dist/utils/github-setup.js +551 -23
  60. package/dist/utils/github-setup.js.map +1 -1
  61. package/dist/utils/idempotency.d.ts +147 -7
  62. package/dist/utils/idempotency.d.ts.map +1 -1
  63. package/dist/utils/idempotency.js +143 -15
  64. package/dist/utils/idempotency.js.map +1 -1
  65. package/dist/utils/logger.d.ts +134 -0
  66. package/dist/utils/logger.d.ts.map +1 -0
  67. package/dist/utils/logger.js +153 -0
  68. package/dist/utils/logger.js.map +1 -0
  69. package/dist/utils/preflight.d.ts +223 -12
  70. package/dist/utils/preflight.d.ts.map +1 -1
  71. package/dist/utils/preflight.js +216 -16
  72. package/dist/utils/preflight.js.map +1 -1
  73. package/dist/utils/versioning.d.ts +160 -8
  74. package/dist/utils/versioning.d.ts.map +1 -1
  75. package/dist/utils/versioning.js +179 -15
  76. package/dist/utils/versioning.js.map +1 -1
  77. package/package.json +26 -5
  78. package/.claude/settings.local.json +0 -35
  79. package/.github/actions/calculate-version/action.yml +0 -106
  80. package/.github/actions/create-pr/action.yml +0 -122
  81. package/.github/actions/create-release/action.yml +0 -74
  82. package/.github/actions/create-tag/action.yml +0 -94
  83. package/.github/actions/detect-changes/action.yml +0 -62
  84. package/.github/actions/manage-branch/action.yml +0 -113
  85. package/.github/actions/promote-branch/action.yml +0 -352
  86. package/.github/example/workflows/job.analyze.code.yml +0 -26
  87. package/.github/example/workflows/job.analyze.docker.yml +0 -32
  88. package/.github/example/workflows/job.app.api.deploy.yml +0 -127
  89. package/.github/example/workflows/job.app.api.test.yml +0 -102
  90. package/.github/example/workflows/job.app.docs.deploy.yml +0 -40
  91. package/.github/example/workflows/job.app.docs.test.yml +0 -50
  92. package/.github/example/workflows/job.app.web.deploy.yml +0 -96
  93. package/.github/example/workflows/job.app.web.test.yml +0 -49
  94. package/.github/example/workflows/job.changes.yml +0 -82
  95. package/.github/example/workflows/job.create-pr.yml +0 -96
  96. package/.github/example/workflows/job.env-check.yml +0 -43
  97. package/.github/example/workflows/job.fast-forward.yml +0 -103
  98. package/.github/example/workflows/job.lint.yml +0 -64
  99. package/.github/example/workflows/job.pr-name.yml +0 -70
  100. package/.github/example/workflows/job.pr-squash-name.yml +0 -27
  101. package/.github/example/workflows/job.tag.yml +0 -38
  102. package/.github/example/workflows/job.version.yml +0 -99
  103. package/.github/example/workflows/lib.plugin-base.publish.yml +0 -59
  104. package/.github/example/workflows/pipe.yml +0 -178
  105. package/.github/example/workflows/scripts/fastforward.sh +0 -51
  106. package/.github/example/workflows/scripts/pipe-cleaner.sh +0 -70
  107. package/.github/scripts/fastforward.sh +0 -51
  108. package/.github/scripts/pipe-cleaner.sh +0 -70
  109. package/.github/workflows/pipeline.yml +0 -220
  110. package/.github/workflows/pr-title-check.yml +0 -70
  111. package/.github/workflows/publish.yml +0 -39
  112. package/.pipecraftrc.json +0 -78
  113. package/.release-it.cjs +0 -71
  114. package/PIPELINE_TESTING_PLAN.md +0 -499
  115. package/TRUNK_FLOW_PLAN.md +0 -401
  116. package/assets/logo_banner.png +0 -0
  117. package/assets/logo_banner.webp +0 -0
  118. package/docs/USER_JOURNEY_ERRORS.md +0 -352
  119. package/eslint.config.js +0 -77
  120. package/examples/basic-config.json +0 -41
  121. package/examples/monorepo-config.json +0 -49
  122. package/examples/usage.md +0 -289
  123. package/scripts/debug-workflows.sh +0 -339
  124. package/scripts/parse-pipeline.js +0 -29
  125. package/scripts/test-job-order.cjs +0 -140
  126. package/scripts/validate-pipeline.cjs +0 -379
  127. package/scripts/verify-job-order.sh +0 -30
  128. package/src/cli/index.ts +0 -414
  129. package/src/generators/init.tpl.ts +0 -126
  130. package/src/generators/workflows.tpl.ts +0 -80
  131. package/src/templates/actions/calculate-version.yml.tpl.ts +0 -124
  132. package/src/templates/actions/create-pr.yml.tpl.ts +0 -147
  133. package/src/templates/actions/create-tag.yml.tpl.ts +0 -112
  134. package/src/templates/actions/detect-changes.yml.tpl.ts +0 -87
  135. package/src/templates/actions/manage-branch.yml.tpl.ts +0 -132
  136. package/src/templates/actions/promote-branch.yml.tpl.ts +0 -364
  137. package/src/templates/workflows/pipeline-path-based.yml.tpl.ts +0 -706
  138. package/src/types/index.ts +0 -64
  139. package/src/utils/README-ast-path-operations.md +0 -390
  140. package/src/utils/ast-path-operations.ts +0 -581
  141. package/src/utils/config.ts +0 -64
  142. package/src/utils/github-setup.ts +0 -558
  143. package/src/utils/idempotency.ts +0 -215
  144. package/src/utils/preflight.ts +0 -306
  145. package/src/utils/versioning.ts +0 -244
  146. package/tests/README.md +0 -229
  147. package/tests/TEST_STRUCTURE.md +0 -256
  148. package/tests/act/run-act-tests.sh +0 -345
  149. package/tests/debugging/debug-utils.ts +0 -538
  150. package/tests/debugging/debug-workflow.test.ts +0 -339
  151. package/tests/debugging/debug-workflows.sh +0 -339
  152. package/tests/debugging/iterative-debug.ts +0 -652
  153. package/tests/debugging/run-debug-tests.sh +0 -431
  154. package/tests/fixtures/basic-config.json +0 -51
  155. package/tests/fixtures/invalid-config.json +0 -9
  156. package/tests/fixtures/pipeline-generated.yml +0 -235
  157. package/tests/fixtures/pipeline-preserve-comments.yml +0 -245
  158. package/tests/fixtures/pipeline-user-modified.yml +0 -245
  159. package/tests/fixtures/test-config.json +0 -58
  160. package/tests/github-live/README.md +0 -250
  161. package/tests/github-local/JOB_WORKFLOW_TESTS.md +0 -296
  162. package/tests/github-local/README.md +0 -240
  163. package/tests/github-local/run-all-tests.sh +0 -422
  164. package/tests/github-local/test-job-workflows.sh +0 -631
  165. package/tests/github-local/test-pipeline-workflow.sh +0 -440
  166. package/tests/integration/generators.test.ts +0 -578
  167. package/tests/integration/path-based-template.test.ts +0 -510
  168. package/tests/integration/simple-path-based.test.ts +0 -415
  169. package/tests/setup.ts +0 -56
  170. package/tests/unit/ast-path-operations-extended.test.ts +0 -302
  171. package/tests/unit/cli.test.ts +0 -541
  172. package/tests/unit/config-extended.test.ts +0 -412
  173. package/tests/unit/config.test.ts +0 -152
  174. package/tests/unit/github-setup.test.ts +0 -189
  175. package/tests/unit/idempotency-isolated.test.ts +0 -297
  176. package/tests/unit/job-order.test.ts +0 -157
  177. package/tests/unit/pipeline-path-based.test.ts +0 -511
  178. package/tests/unit/validate-pipeline.test.ts +0 -384
  179. package/tests/unit/versioning-extended.test.ts +0 -279
  180. package/tests/unit/versioning.test.ts +0 -241
  181. package/tsconfig.debug.json +0 -17
  182. package/tsconfig.json +0 -28
  183. package/vitest.config.ts +0 -51
package/README.md CHANGED
@@ -1,11 +1,11 @@
1
- <img src="./assets/logo_banner.png" alt="PipeCraft Logo" width="auto">
1
+ <img src="https://raw.githubusercontent.com/jamesvillarrubia/pipecraft/main/assets/logo_banner.png" alt="PipeCraft Logo" width="auto">
2
2
 
3
3
  # PipeCraft
4
4
 
5
- [![npm version](https://badge.fury.io/js/pipecraft.svg)](https://badge.fury.io/js/pipecraft)
5
+ [![npm version](https://badge.fury.io/js/pipecraft.svg)](https://www.npmjs.com/package/pipecraft)
6
6
  [![License](https://img.shields.io/npm/l/pipecraft.svg)](https://github.com/jamesvillarrubia/pipecraft/blob/main/LICENSE)
7
7
  [![NPM downloads](https://img.shields.io/npm/dm/pipecraft.svg)](https://www.npmjs.com/package/pipecraft)
8
- [![Node.js Version](https://img.shields.io/node/v/pipecraft.svg)](https://nodejs.org/en/)
8
+ [![Node.js Version](https://img.shields.io/badge/node-%3E%3D18.0.0-brightgreen)](https://nodejs.org/en/)
9
9
  [![codecov](https://codecov.io/gh/jamesvillarrubia/pipecraft/branch/main/graph/badge.svg)](https://codecov.io/gh/jamesvillarrubia/pipecraft)
10
10
 
11
11
  **Pipeline Status:**
@@ -30,6 +30,7 @@ PipeCraft is a powerful CLI tool for automating trunk-based development workflow
30
30
  - [Domain-Based Workflows](#domain-based-workflows)
31
31
  - [Version Management](#version-management)
32
32
  - [Examples](#examples)
33
+ - [Documentation](#documentation)
33
34
  - [Roadmap & Future Features](#roadmap--future-features)
34
35
  - [Troubleshooting](#troubleshooting)
35
36
  - [Contributing](#contributing)
@@ -45,21 +46,23 @@ PipeCraft is a powerful CLI tool for automating trunk-based development workflow
45
46
  - **Branch Flow Management** - Support for custom branch flows (develop → staging → main)
46
47
  - **Fast-Forward Merging** - Automatic branch management with configurable merge strategies
47
48
  - **Idempotent Regeneration** - Only regenerate when configuration or templates change
48
- - **GitLab Support** - Works with both GitHub Actions and GitLab CI (configurable)
49
+ - **User Job Preservation** - Regenerates pipelines while preserving your custom jobs and comments
49
50
  - **Customizable Actions** - Define actions per branch merge (tests, deploys, version bumps)
50
51
  - **GitHub Setup Automation** - Automated token and repository setup validation
51
52
 
53
+ > **Note**: This release focuses on GitHub Actions workflows. GitLab CI/CD support is [planned](#roadmap--future-features) for a future release. Currently, the `ciProvider` field accepts `'gitlab'` but generates GitHub Actions syntax.
54
+
52
55
  ## Prerequisites
53
56
 
54
- - Git
55
- - A GitHub or GitLab account
56
- - Node.js 18+ (for npm installation)
57
+ - **Git** - Version control system
58
+ - **GitHub Account** - For GitHub Actions workflows
59
+ - **Node.js 18.0.0 or higher** - For npm installation
57
60
 
58
61
  ## Quick Start
59
62
 
60
63
  1. Initialize PipeCraft in your project:
61
64
  ```bash
62
- npx pipecraft init --interactive
65
+ npx pipecraft init
63
66
  ```
64
67
 
65
68
  2. Generate your CI/CD workflows:
@@ -118,20 +121,17 @@ PipeCraft provides several commands to manage your trunk-based development workf
118
121
 
119
122
  #### 1. Initialize Configuration
120
123
 
121
- Start with an interactive setup wizard:
124
+ Create a basic configuration with default settings:
122
125
  ```bash
123
- pipecraft init --interactive
126
+ pipecraft init
124
127
  ```
125
128
 
126
- Or create a basic configuration:
129
+ Force overwrite existing configuration:
127
130
  ```bash
128
- pipecraft init --ci-provider github --initial-branch develop --final-branch main
131
+ pipecraft init --force
129
132
  ```
130
133
 
131
- Include version management setup:
132
- ```bash
133
- pipecraft init --with-versioning
134
- ```
134
+ > **Note**: The `init` command currently generates a default configuration file with standard trunk flow settings (develop → staging → main). You can then edit the `.pipecraftrc.json` file to customize branch names, domains, and other settings.
135
135
 
136
136
  #### 2. Generate Workflows
137
137
 
@@ -157,6 +157,28 @@ If any check fails, you'll see helpful error messages with suggestions. Example
157
157
  💡 Initialize git: 'git init' or clone an existing repository
158
158
  ```
159
159
 
160
+ **Output verbosity levels:**
161
+
162
+ Normal mode (default) - Clean, actionable output:
163
+ ```bash
164
+ pipecraft generate
165
+ ```
166
+ Shows only essential information: pre-flight checks and completion status.
167
+
168
+ Verbose mode - Shows file operations:
169
+ ```bash
170
+ pipecraft generate --verbose
171
+ ```
172
+ Includes file merge status, config paths, and workflow generation details.
173
+
174
+ Debug mode - Full internal details:
175
+ ```bash
176
+ pipecraft generate --debug
177
+ ```
178
+ Includes everything from verbose mode plus internal debugging information like branch flow context, job ordering, and template operations.
179
+
180
+ **Other options:**
181
+
160
182
  Skip pre-flight checks (not recommended):
161
183
  ```bash
162
184
  pipecraft generate --skip-checks
@@ -254,10 +276,6 @@ Example `.pipecraftrc.json`:
254
276
  "breaking": "major"
255
277
  }
256
278
  },
257
- "actions": {
258
- "onDevelopMerge": ["runTests", "fastForwardToStaging"],
259
- "onStagingMerge": ["runTests", "calculateVersion", "createOrFastForwardToMain"]
260
- },
261
279
  "domains": {
262
280
  "api": {
263
281
  "paths": ["apps/api/**"],
@@ -275,17 +293,18 @@ Example `.pipecraftrc.json`:
275
293
 
276
294
  PipeCraft provides the following commands:
277
295
 
278
- | Command | Description | Options |
279
- |---------|-------------|---------|
280
- | `init` | Initialize PipeCraft configuration | `--interactive`, `--force`, `--with-versioning`, `--ci-provider`, `--merge-strategy`, `--initial-branch`, `--final-branch` |
281
- | `generate` | Generate CI/CD workflows with pre-flight checks | `--skip-checks`, `--force`, `--dry-run`, `--config`, `--output-pipeline`, `--verbose` |
296
+ | Command | Description | Key Options |
297
+ |---------|-------------|-------------|
298
+ | `init` | Initialize PipeCraft configuration | `--force` |
299
+ | `generate` | Generate CI/CD workflows with pre-flight checks | `--skip-checks`, `--force`, `--dry-run`, `--config`, `--output-pipeline`, `--verbose`, `--debug` |
282
300
  | `validate` | Validate configuration file | `--config` |
283
- | `validate:pipeline` | Validate generated pipeline files | `--strict` |
284
301
  | `setup-github` | Configure GitHub Actions workflow permissions | `--apply`, `--force` |
285
302
  | `verify` | Verify PipeCraft setup | None |
286
303
  | `version` | Version management commands | `--check`, `--bump`, `--release` |
287
304
  | `setup` | Create branches from branch flow | `--force` |
288
305
 
306
+ > **Note**: All commands support global options like `--verbose` and `--debug` for detailed output.
307
+
289
308
  ### Global Options
290
309
 
291
310
  Available for all commands:
@@ -293,21 +312,25 @@ Available for all commands:
293
312
  - `-c, --config <path>` - Path to config file (default: `.pipecraftrc.json`)
294
313
  - `-p, --pipeline <path>` - Path to existing pipeline file for merging
295
314
  - `-o, --output-pipeline <path>` - Path to output pipeline file
296
- - `-v, --verbose` - Verbose output
315
+ - `-v, --verbose` - Verbose output (shows file operations and merge status)
316
+ - `--debug` - Debug output (includes verbose output plus internal debugging details)
297
317
  - `--force` - Force operation even if unchanged
298
318
  - `--dry-run` - Show what would be done without making changes
299
319
 
300
320
  ### Command Examples
301
321
 
302
322
  ```bash
303
- # Initialize with all options
304
- pipecraft init --interactive --with-versioning --ci-provider github
323
+ # Initialize configuration (creates .pipecraftrc.json with defaults)
324
+ pipecraft init
305
325
 
306
326
  # Generate workflows with custom paths
307
327
  pipecraft generate --config .pipecraft.json --output-pipeline workflows/ci.yml
308
328
 
309
- # Validate pipeline files
310
- pipecraft validate:pipeline
329
+ # Generate with verbose output to see file operations
330
+ pipecraft generate --verbose
331
+
332
+ # Generate with debug output to see internal details
333
+ pipecraft generate --debug
311
334
 
312
335
  # Setup GitHub Actions permissions (interactive mode)
313
336
  pipecraft setup-github
@@ -315,12 +338,16 @@ pipecraft setup-github
315
338
  # Setup GitHub Actions permissions (auto-apply mode)
316
339
  pipecraft setup-github --apply
317
340
 
318
- # Validate before committing
341
+ # Validate configuration before committing
319
342
  pipecraft validate && git commit -am "chore: update workflow config"
320
343
 
321
- # Check version and create release
344
+ # Check what version would be bumped to
322
345
  pipecraft version --check
346
+
347
+ # Bump version based on conventional commits
323
348
  pipecraft version --bump
349
+
350
+ # Create a full release with tag and changelog
324
351
  pipecraft version --release
325
352
 
326
353
  # Setup all branches for new repository
@@ -589,33 +616,6 @@ Note: Branch protection rules are required for auto-merge to work in GitHub.
589
616
  | `semver.bumpRules.fix` | `'major' \| 'minor' \| 'patch'` | Version bump for fixes |
590
617
  | `semver.bumpRules.breaking` | `'major' \| 'minor' \| 'patch'` | Version bump for breaking changes |
591
618
 
592
- ### Actions
593
-
594
- Define what happens on branch merges:
595
-
596
- ```json
597
- {
598
- "actions": {
599
- "onDevelopMerge": [
600
- "runTests",
601
- "fastForwardToStaging"
602
- ],
603
- "onStagingMerge": [
604
- "runTests",
605
- "calculateVersion",
606
- "createOrFastForwardToMain"
607
- ]
608
- }
609
- }
610
- ```
611
-
612
- Available actions:
613
- - `runTests` - Run test suite
614
- - `fastForwardToStaging` - Fast-forward develop to staging
615
- - `calculateVersion` - Calculate next semantic version
616
- - `createOrFastForwardToMain` - Merge or fast-forward to main
617
- - `deploy` - Run deployment steps
618
-
619
619
  ### Domains (Monorepo Support)
620
620
 
621
621
  Define multiple domains for path-based change detection:
@@ -836,12 +836,6 @@ Configuration for staging environment:
836
836
  "breaking": "major"
837
837
  }
838
838
  },
839
- "actions": {
840
- "onDevelopMerge": ["runTests", "fastForwardToStaging"],
841
- "onStagingMerge": ["runTests", "deployToStaging"],
842
- "onUatMerge": ["runTests", "calculateVersion", "deployToUat"],
843
- "onProductionMerge": ["runTests", "deployToProduction", "createRelease"]
844
- },
845
839
  "domains": {
846
840
  "api": {
847
841
  "paths": ["services/api/**", "libs/api-core/**"],
@@ -913,49 +907,71 @@ Configuration with non-standard branch names:
913
907
  }
914
908
  ```
915
909
 
910
+ ## Documentation
911
+
912
+ PipeCraft provides comprehensive documentation for different aspects of the project:
913
+
914
+ ### Core Documentation
915
+
916
+ - **[ARCHITECTURE.md](./docs/ARCHITECTURE.md)** - System architecture overview, design patterns, and component interactions
917
+ - **[CURRENT_TRUNK_FLOW.md](./docs/CURRENT_TRUNK_FLOW.md)** - Current implemented trunk-based development workflow
918
+ - **[ERROR_HANDLING.md](./docs/ERROR_HANDLING.md)** - Error handling strategies and common error scenarios
919
+ - **[TESTING_GUIDE.md](./TESTING_GUIDE.md)** - Complete testing guide with examples and best practices
920
+
921
+ ### Development Documentation
922
+
923
+ - **[tests/README.md](./tests/README.md)** - Test structure and organization
924
+ - **[docs/REPO_CLEANUP_PLAN.md](./docs/REPO_CLEANUP_PLAN.md)** - Repository organization and structure
925
+
926
+ ### Planning Documents
927
+
928
+ - **[TRUNK_FLOW_PLAN.md](./TRUNK_FLOW_PLAN.md)** - Future roadmap for trunk flow variations *(future plans, not current implementation)*
929
+
930
+ ### Quick Links
931
+
932
+ - **Architecture**: Understand how PipeCraft works internally
933
+ - **Current Trunk Flow**: See what's implemented in this release
934
+ - **Testing Guide**: Learn how to test PipeCraft or contribute tests
935
+ - **Error Handling**: Debug issues and understand error messages
936
+
916
937
  ## Roadmap & Future Features
917
938
 
918
- PipeCraft is actively being developed with plans for additional features and improvements:
939
+ PipeCraft is actively being developed with plans for additional features and improvements.
940
+
941
+ ### Current Release (v1.x)
942
+
943
+ This release focuses on a **solid, working trunk-based development workflow** for GitHub Actions with:
944
+
945
+ ✅ **Develop → Staging → Main** branch flow
946
+ ✅ **Domain-based change detection** for monorepos
947
+ ✅ **Semantic versioning** with conventional commits
948
+ ✅ **User job preservation** during regeneration
949
+ ✅ **Pre-flight checks** for smooth setup
950
+ ✅ **Comprehensive documentation** and testing
951
+
952
+ See [CURRENT_TRUNK_FLOW.md](./docs/CURRENT_TRUNK_FLOW.md) for details on what's implemented.
919
953
 
920
954
  ### Planned Features
921
955
 
922
- #### Enhanced GitLab Support
923
- - Full GitLab CI/CD pipeline generation (currently basic support)
924
- - GitLab-specific features (includes, extends, etc.)
925
- - GitLab merge request automation
926
- - GitLab runner configuration
927
-
928
- #### Additional Workflow Patterns
929
- - Feature branch workflows (Gitflow alternative)
930
- - Release branch workflows
931
- - Hotfix workflows
932
- - Custom workflow patterns via plugins
933
-
934
- #### Advanced Branch Management
935
- - Automatic conflict resolution strategies
936
- - Branch protection rule setup
937
- - PR template generation
938
- - Code review automation
939
-
940
- #### Extended CI/CD Providers
941
- - Azure DevOps Pipelines
942
- - Jenkins pipeline generation
943
- - CircleCI configuration
944
- - Bitbucket Pipelines
945
-
946
- #### Improved Developer Experience
947
- - Interactive CLI improvements
948
- - Better error messages and diagnostics
949
- - Configuration migration tools
950
- - Visual workflow editor (web-based)
951
- - Real-time workflow preview
952
-
953
- #### Enterprise Features
954
- - Team configuration templates
955
- - Organization-wide policy enforcement
956
- - Audit logging
957
- - RBAC integration
958
- - Self-hosted runner configuration
956
+ The roadmap is documented in [TRUNK_FLOW_PLAN.md](./TRUNK_FLOW_PLAN.md). Key planned features include:
957
+
958
+ #### Short Term (v2.x)
959
+ - **Enhanced GitLab Support** - Full GitLab CI/CD pipeline generation
960
+ - **Interactive Configuration** - Interactive `init` command with prompts
961
+ - **Additional Flow Variations** - Gitflow, release branches, hotfix workflows
962
+ - **CLI Improvements** - Better error messages, configuration migration tools
963
+
964
+ #### Medium Term (v3.x)
965
+ - **Extended CI/CD Providers** - Azure DevOps, Jenkins, CircleCI, Bitbucket
966
+ - **Advanced Branch Management** - Conflict resolution, PR templates
967
+ - **Visual Workflow Editor** - Web-based workflow configuration tool
968
+
969
+ #### Long Term (v4.x+)
970
+ - **Enterprise Features** - Team templates, policy enforcement, audit logging
971
+ - **Plugin System** - Custom workflow patterns and extensions
972
+ - **Multi-Repository** Support - Manage pipelines across multiple repos
973
+
974
+ For the complete roadmap and feature comparison, see [TRUNK_FLOW_PLAN.md](./TRUNK_FLOW_PLAN.md).
959
975
 
960
976
  ### Contributing to the Roadmap
961
977
 
@@ -980,6 +996,7 @@ Have a feature request? We'd love to hear from you!
980
996
  - Check if configuration is valid: `pipecraft validate`
981
997
  - Use `--force` to bypass cache: `pipecraft generate --force`
982
998
  - Use `--verbose` for detailed output: `pipecraft generate --verbose`
999
+ - Use `--debug` for full debugging output: `pipecraft generate --debug`
983
1000
  - Verify file permissions in `.github/workflows/`
984
1001
 
985
1002
  #### 2. Configuration Validation Errors
@@ -1028,16 +1045,17 @@ If you encounter issues not covered here:
1028
1045
 
1029
1046
  1. Check the [GitHub Issues](https://github.com/jamesvillarrubia/pipecraft/issues)
1030
1047
  2. Enable verbose logging: `pipecraft generate --verbose`
1031
- 3. Validate your configuration: `pipecraft validate`
1032
- 4. [Open a new issue](https://github.com/jamesvillarrubia/pipecraft/issues/new) with:
1048
+ 3. Enable debug logging for more detail: `pipecraft generate --debug`
1049
+ 4. Validate your configuration: `pipecraft validate`
1050
+ 5. [Open a new issue](https://github.com/jamesvillarrubia/pipecraft/issues/new) with:
1033
1051
  - PipeCraft version: `pipecraft --version`
1034
1052
  - Node version: `node --version`
1035
1053
  - Your configuration (sanitized)
1036
- - Full error output with `--verbose`
1054
+ - Full error output with `--debug`
1037
1055
 
1038
1056
  ## Contributing
1039
1057
 
1040
- Contributions are welcome! Please see [CONTRIBUTING.md](./CONTRIBUTING.md) for details on:
1058
+ Contributions are welcome! Please see [CONTRIBUTING.md](https://github.com/jamesvillarrubia/pipecraft/blob/main/CONTRIBUTING.md) for details on:
1041
1059
 
1042
1060
  - Code of conduct
1043
1061
  - Development setup
@@ -1080,7 +1098,7 @@ npm test tests/unit/config.test.ts
1080
1098
 
1081
1099
  ## License
1082
1100
 
1083
- This project is licensed under the MIT License - see the [LICENSE](./LICENSE) file for details.
1101
+ This project is licensed under the MIT License - see the [LICENSE](https://github.com/jamesvillarrubia/pipecraft/blob/main/LICENSE) file for details.
1084
1102
 
1085
1103
  ## Acknowledgments
1086
1104
 
@@ -1,3 +1,72 @@
1
1
  #!/usr/bin/env node
2
+ /**
3
+ * PipeCraft Command-Line Interface
4
+ *
5
+ * Main CLI entry point for PipeCraft - automated CI/CD pipeline generator for
6
+ * trunk-based development workflows. This CLI provides commands for:
7
+ *
8
+ * - **init**: Initialize PipeCraft configuration interactively or with flags
9
+ * - **generate**: Generate GitHub Actions workflows from configuration
10
+ * - **validate**: Validate existing workflows and configuration
11
+ * - **verify**: Verify pipeline structure and job order
12
+ * - **setup**: Configure GitHub repository permissions and settings
13
+ * - **version**: Display version information
14
+ *
15
+ * ## Command Overview
16
+ *
17
+ * ### init
18
+ * Creates .pipecraftrc.json configuration file with project settings.
19
+ * Can run interactively or accept flags for automation.
20
+ *
21
+ * ### generate
22
+ * Generates GitHub Actions workflows based on configuration:
23
+ * - Main pipeline workflow (.github/workflows/pipeline.yml)
24
+ * - Reusable actions (.github/actions/*)
25
+ * - Idempotent regeneration (only when config/templates change)
26
+ *
27
+ * ### validate
28
+ * Validates workflow YAML syntax and structure, checks for common issues.
29
+ *
30
+ * ### verify
31
+ * Verifies pipeline job order and dependencies are correct.
32
+ *
33
+ * ### setup
34
+ * Configures GitHub repository:
35
+ * - Workflow permissions (read/write)
36
+ * - Branch protection rules
37
+ * - Auto-merge settings
38
+ *
39
+ * ## Global Options
40
+ * - `-c, --config <path>`: Path to config file (default: .pipecraftrc.json)
41
+ * - `-v, --verbose`: Verbose output
42
+ * - `--debug`: Debug output (maximum detail)
43
+ * - `--force`: Force regeneration even if unchanged
44
+ * - `--dry-run`: Show what would be done without making changes
45
+ *
46
+ * ## Examples
47
+ *
48
+ * ```bash
49
+ * # Initialize configuration interactively
50
+ * pipecraft init --interactive
51
+ *
52
+ * # Generate workflows
53
+ * pipecraft generate
54
+ *
55
+ * # Generate with version management
56
+ * pipecraft init --with-versioning
57
+ * pipecraft generate
58
+ *
59
+ * # Validate existing workflows
60
+ * pipecraft validate
61
+ *
62
+ * # Setup GitHub repository
63
+ * pipecraft setup --verify
64
+ *
65
+ * # Debug mode
66
+ * pipecraft generate --debug
67
+ * ```
68
+ *
69
+ * @module cli
70
+ */
2
71
  export {};
3
72
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoEG"}
package/dist/cli/index.js CHANGED
@@ -1,6 +1,73 @@
1
1
  #!/usr/bin/env node
2
- // PipeCraft CLI - Automated CI/CD pipeline generator
3
- // Test change for deploy flow validation
2
+ /**
3
+ * PipeCraft Command-Line Interface
4
+ *
5
+ * Main CLI entry point for PipeCraft - automated CI/CD pipeline generator for
6
+ * trunk-based development workflows. This CLI provides commands for:
7
+ *
8
+ * - **init**: Initialize PipeCraft configuration interactively or with flags
9
+ * - **generate**: Generate GitHub Actions workflows from configuration
10
+ * - **validate**: Validate existing workflows and configuration
11
+ * - **verify**: Verify pipeline structure and job order
12
+ * - **setup**: Configure GitHub repository permissions and settings
13
+ * - **version**: Display version information
14
+ *
15
+ * ## Command Overview
16
+ *
17
+ * ### init
18
+ * Creates .pipecraftrc.json configuration file with project settings.
19
+ * Can run interactively or accept flags for automation.
20
+ *
21
+ * ### generate
22
+ * Generates GitHub Actions workflows based on configuration:
23
+ * - Main pipeline workflow (.github/workflows/pipeline.yml)
24
+ * - Reusable actions (.github/actions/*)
25
+ * - Idempotent regeneration (only when config/templates change)
26
+ *
27
+ * ### validate
28
+ * Validates workflow YAML syntax and structure, checks for common issues.
29
+ *
30
+ * ### verify
31
+ * Verifies pipeline job order and dependencies are correct.
32
+ *
33
+ * ### setup
34
+ * Configures GitHub repository:
35
+ * - Workflow permissions (read/write)
36
+ * - Branch protection rules
37
+ * - Auto-merge settings
38
+ *
39
+ * ## Global Options
40
+ * - `-c, --config <path>`: Path to config file (default: .pipecraftrc.json)
41
+ * - `-v, --verbose`: Verbose output
42
+ * - `--debug`: Debug output (maximum detail)
43
+ * - `--force`: Force regeneration even if unchanged
44
+ * - `--dry-run`: Show what would be done without making changes
45
+ *
46
+ * ## Examples
47
+ *
48
+ * ```bash
49
+ * # Initialize configuration interactively
50
+ * pipecraft init --interactive
51
+ *
52
+ * # Generate workflows
53
+ * pipecraft generate
54
+ *
55
+ * # Generate with version management
56
+ * pipecraft init --with-versioning
57
+ * pipecraft generate
58
+ *
59
+ * # Validate existing workflows
60
+ * pipecraft validate
61
+ *
62
+ * # Setup GitHub repository
63
+ * pipecraft setup --verify
64
+ *
65
+ * # Debug mode
66
+ * pipecraft generate --debug
67
+ * ```
68
+ *
69
+ * @module cli
70
+ */
4
71
  import { Command } from 'commander';
5
72
  import { cosmiconfigSync } from 'cosmiconfig';
6
73
  import { runModule, prompt } from '@featherscloud/pinion';
@@ -12,6 +79,7 @@ import { VersionManager } from '../utils/versioning.js';
12
79
  import { loadConfig, validateConfig } from '../utils/config.js';
13
80
  import { setupGitHubPermissions } from '../utils/github-setup.js';
14
81
  import { runPreflightChecks, formatPreflightResults } from '../utils/preflight.js';
82
+ import { logger } from '../utils/logger.js';
15
83
  const __filename = fileURLToPath(import.meta.url);
16
84
  const __dirname = dirname(__filename);
17
85
  const program = new Command();
@@ -27,6 +95,7 @@ program
27
95
  .option('-p, --pipeline <path>', 'path to existing pipeline file for merging', '.github/workflows/pipeline.yml')
28
96
  .option('-o, --output-pipeline <path>', 'path to output pipeline file (for testing)', '.github/workflows/pipeline.yml')
29
97
  .option('-v, --verbose', 'verbose output')
98
+ .option('--debug', 'debug output (includes all verbose output plus additional debugging info)')
30
99
  .option('--force', 'force regeneration even if files unchanged')
31
100
  .option('--dry-run', 'show what would be done without making changes');
32
101
  // Init command - Initialize configuration
@@ -91,44 +160,47 @@ program
91
160
  const configPath = globalOptions.config;
92
161
  const pipelinePath = globalOptions.pipeline;
93
162
  const outputPipelinePath = globalOptions.outputPipeline;
163
+ // Set logger level based on flags
164
+ if (globalOptions.debug) {
165
+ logger.setLevel('debug');
166
+ }
167
+ else if (globalOptions.verbose) {
168
+ logger.setLevel('verbose');
169
+ }
94
170
  // Run pre-flight checks unless skipped
95
171
  if (!options.skipChecks) {
96
- console.log('🔍 Running pre-flight checks...\n');
172
+ logger.info('🔍 Running pre-flight checks...\n');
97
173
  const checks = runPreflightChecks();
98
174
  const { allPassed, output, nextSteps } = formatPreflightResults(checks);
99
- console.log(output);
100
- console.log();
175
+ logger.info(output);
176
+ logger.info('');
101
177
  if (!allPassed) {
102
- console.error('❌ Pre-flight checks failed. Fix the issues above and try again.');
103
- console.error(' Or use --skip-checks to bypass (not recommended)\n');
178
+ logger.error('❌ Pre-flight checks failed. Fix the issues above and try again.');
179
+ logger.error(' Or use --skip-checks to bypass (not recommended)\n');
104
180
  process.exit(1);
105
181
  }
106
- console.log('✅ All pre-flight checks passed!');
182
+ logger.info('✅ All pre-flight checks passed!');
107
183
  // Store next steps for later display (after successful generation)
108
184
  if (nextSteps) {
109
185
  options._nextSteps = nextSteps;
110
186
  }
111
- console.log();
112
- }
113
- if (globalOptions.verbose) {
114
- console.log(`📖 Reading config from: ${configPath}`);
115
- console.log(`📖 Reading pipeline from: ${pipelinePath}`);
187
+ logger.info('');
116
188
  }
189
+ logger.verbose(`📖 Reading config from: ${configPath}`);
190
+ logger.verbose(`📖 Reading pipeline from: ${pipelinePath}`);
117
191
  // Load configuration
118
192
  const config = loadConfig(configPath);
119
193
  // Check idempotency if not forcing
120
194
  if (!globalOptions.force && !globalOptions.dryRun) {
121
195
  const idempotencyManager = new IdempotencyManager(config);
122
196
  if (!(await idempotencyManager.hasChanges())) {
123
- console.log('â„šī¸ No changes detected. Use --force to regenerate anyway.');
197
+ logger.info('â„šī¸ No changes detected. Use --force to regenerate anyway.');
124
198
  return;
125
199
  }
126
- if (globalOptions.verbose) {
127
- console.log('🔄 Changes detected, regenerating workflows...');
128
- }
200
+ logger.verbose('🔄 Changes detected, regenerating workflows...');
129
201
  }
130
202
  if (globalOptions.dryRun) {
131
- console.log('🔍 Dry run mode - would generate workflows');
203
+ logger.info('🔍 Dry run mode - would generate workflows');
132
204
  return;
133
205
  }
134
206
  await runModule(join(__dirname, '../generators/workflows.tpl.js'), {
@@ -158,16 +230,16 @@ program
158
230
  // Update idempotency cache
159
231
  const idempotencyManager = new IdempotencyManager(config);
160
232
  await idempotencyManager.updateCache();
161
- console.log(`✅ Generated workflows in: ${options.output}`);
233
+ logger.success(`✅ Generated workflows in: ${options.output}`);
162
234
  // Display next steps if available
163
235
  if (options._nextSteps) {
164
- console.log();
236
+ logger.info('');
165
237
  const steps = options._nextSteps;
166
- steps.forEach((step) => console.log(step));
238
+ steps.forEach((step) => logger.info(step));
167
239
  }
168
240
  }
169
241
  catch (error) {
170
- console.error('❌ Failed to generate workflows:', error.message);
242
+ logger.error('❌ Failed to generate workflows:', error.message);
171
243
  process.exit(1);
172
244
  }
173
245
  });