pipecraft 0.25.0 → 0.28.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 +89 -992
- package/dist/cli/index.js +17 -4
- package/dist/cli/index.js.map +1 -1
- package/dist/generators/init.tpl.d.ts.map +1 -1
- package/dist/generators/init.tpl.js +14 -2
- package/dist/generators/init.tpl.js.map +1 -1
- package/dist/generators/workflows.tpl.d.ts +3 -1
- package/dist/generators/workflows.tpl.d.ts.map +1 -1
- package/dist/generators/workflows.tpl.js +17 -3
- package/dist/generators/workflows.tpl.js.map +1 -1
- package/dist/templates/release-it.cjs.tpl.d.ts +41 -0
- package/dist/templates/release-it.cjs.tpl.d.ts.map +1 -0
- package/dist/templates/release-it.cjs.tpl.js +149 -0
- package/dist/templates/release-it.cjs.tpl.js.map +1 -0
- package/dist/templates/workflows/enforce-pr-target.yml.tpl.d.ts +53 -0
- package/dist/templates/workflows/enforce-pr-target.yml.tpl.d.ts.map +1 -0
- package/dist/templates/workflows/enforce-pr-target.yml.tpl.js +83 -0
- package/dist/templates/workflows/enforce-pr-target.yml.tpl.js.map +1 -0
- package/dist/templates/workflows/pipeline-path-based.yml.tpl.js +14 -14
- package/dist/templates/workflows/pipeline-path-based.yml.tpl.js.map +1 -1
- package/dist/templates/workflows/pr-title-check.yml.tpl.d.ts +52 -0
- package/dist/templates/workflows/pr-title-check.yml.tpl.d.ts.map +1 -0
- package/dist/templates/workflows/pr-title-check.yml.tpl.js +123 -0
- package/dist/templates/workflows/pr-title-check.yml.tpl.js.map +1 -0
- package/dist/types/index.d.ts +9 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/utils/github-setup-v2.d.ts +15 -0
- package/dist/utils/github-setup-v2.d.ts.map +1 -0
- package/dist/utils/github-setup-v2.js +217 -0
- package/dist/utils/github-setup-v2.js.map +1 -0
- package/dist/utils/github-setup.d.ts.map +1 -1
- package/dist/utils/github-setup.js +35 -21
- package/dist/utils/github-setup.js.map +1 -1
- package/dist/utils/messaging.d.ts +92 -0
- package/dist/utils/messaging.d.ts.map +1 -0
- package/dist/utils/messaging.js +232 -0
- package/dist/utils/messaging.js.map +1 -0
- package/dist/utils/preflight.d.ts.map +1 -1
- package/dist/utils/preflight.js +48 -6
- package/dist/utils/preflight.js.map +1 -1
- package/dist/utils/versioning.d.ts.map +1 -1
- package/dist/utils/versioning.js +3 -13
- package/dist/utils/versioning.js.map +1 -1
- package/package.json +24 -5
- package/src/generators/init.tpl.ts +230 -0
- package/src/generators/workflows.tpl.ts +187 -0
package/README.md
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
# PipeCraft
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/pipecraft)
|
|
6
|
+
[](https://pipecraft.thecraftlab.dev)
|
|
6
7
|
[](https://github.com/jamesvillarrubia/pipecraft/blob/main/LICENSE)
|
|
7
8
|
[](https://www.npmjs.com/package/pipecraft)
|
|
8
9
|
[](https://nodejs.org/en/)
|
|
@@ -13,813 +14,115 @@
|
|
|
13
14
|
[](https://github.com/jamesvillarrubia/pipecraft/actions/workflows/pipeline.yml?query=branch%3Astaging)
|
|
14
15
|
[](https://github.com/jamesvillarrubia/pipecraft/actions/workflows/pipeline.yml?query=branch%3Amain)
|
|
15
16
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
## Table of Contents
|
|
19
|
-
- [Features](#features)
|
|
20
|
-
- [Prerequisites](#prerequisites)
|
|
21
|
-
- [Quick Start](#quick-start)
|
|
22
|
-
- [Installation](#installation)
|
|
23
|
-
- [Usage](#usage)
|
|
24
|
-
- [CLI Examples](#cli-examples)
|
|
25
|
-
- [Configuration](#configuration)
|
|
26
|
-
- [Commands](#commands)
|
|
27
|
-
- [Pre-Flight Checks](#pre-flight-checks)
|
|
28
|
-
- [GitHub Actions Setup](#github-actions-setup)
|
|
29
|
-
- [Configuration Options](#configuration-options)
|
|
30
|
-
- [Domain-Based Workflows](#domain-based-workflows)
|
|
31
|
-
- [Version Management](#version-management)
|
|
32
|
-
- [Examples](#examples)
|
|
33
|
-
- [Documentation](#documentation)
|
|
34
|
-
- [Roadmap & Future Features](#roadmap--future-features)
|
|
35
|
-
- [Troubleshooting](#troubleshooting)
|
|
36
|
-
- [Contributing](#contributing)
|
|
37
|
-
- [License](#license)
|
|
38
|
-
- [Acknowledgments](#acknowledgments)
|
|
39
|
-
|
|
40
|
-
## Features
|
|
41
|
-
|
|
42
|
-
- **Automatic CI/CD Pipeline Generation** - Generate GitHub Actions workflows tailored to your branch flow
|
|
43
|
-
- **Pre-Flight Checks** - Validates prerequisites before generating workflows with helpful error messages
|
|
44
|
-
- **Domain-Based Change Detection** - Smart path-based detection for monorepo architectures
|
|
45
|
-
- **Semantic Versioning** - Automatic version bumping based on conventional commits
|
|
46
|
-
- **Branch Flow Management** - Support for custom branch flows (develop → staging → main)
|
|
47
|
-
- **Fast-Forward Merging** - Automatic branch management with configurable merge strategies
|
|
48
|
-
- **Idempotent Regeneration** - Only regenerate when configuration or templates change
|
|
49
|
-
- **User Job Preservation** - Regenerates pipelines while preserving your custom jobs and comments
|
|
50
|
-
- **Customizable Actions** - Define actions per branch merge (tests, deploys, version bumps)
|
|
51
|
-
- **GitHub Setup Automation** - Automated token and repository setup validation
|
|
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
|
-
|
|
55
|
-
## Prerequisites
|
|
56
|
-
|
|
57
|
-
- **Git** - Version control system
|
|
58
|
-
- **GitHub Account** - For GitHub Actions workflows
|
|
59
|
-
- **Node.js 18.0.0 or higher** - For npm installation
|
|
17
|
+
Skip the debugging cycles. Generate battle-tested CI/CD workflows into your repository with best practices built in. Fully customizable, completely yours.
|
|
60
18
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
1. Initialize PipeCraft in your project:
|
|
64
|
-
```bash
|
|
65
|
-
npx pipecraft init
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
2. Generate your CI/CD workflows:
|
|
69
|
-
```bash
|
|
70
|
-
npx pipecraft generate
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
3. Commit the generated files:
|
|
74
|
-
```bash
|
|
75
|
-
git add .github/workflows .pipecraftrc.json
|
|
76
|
-
git commit -m "chore: add PipeCraft workflows"
|
|
77
|
-
git push
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
That's it! Your trunk-based development workflow is now automated.
|
|
81
|
-
|
|
82
|
-
## Installation
|
|
83
|
-
|
|
84
|
-
### Option 1: Using npx (recommended for trying it out)
|
|
85
|
-
|
|
86
|
-
No installation required! Just run commands with `npx`:
|
|
87
|
-
|
|
88
|
-
```bash
|
|
89
|
-
npx pipecraft init
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
### Option 2: Global installation via npm
|
|
93
|
-
|
|
94
|
-
```bash
|
|
95
|
-
npm install -g pipecraft
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
### Option 3: Local project installation
|
|
99
|
-
|
|
100
|
-
```bash
|
|
101
|
-
npm install --save-dev pipecraft
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
Then add to your `package.json` scripts:
|
|
105
|
-
|
|
106
|
-
```json
|
|
107
|
-
{
|
|
108
|
-
"scripts": {
|
|
109
|
-
"workflow:init": "pipecraft init",
|
|
110
|
-
"workflow:generate": "pipecraft generate",
|
|
111
|
-
"workflow:validate": "pipecraft validate"
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
```
|
|
115
|
-
|
|
116
|
-
## Usage
|
|
117
|
-
|
|
118
|
-
### CLI Examples
|
|
119
|
-
|
|
120
|
-
PipeCraft provides several commands to manage your trunk-based development workflows:
|
|
19
|
+
---
|
|
121
20
|
|
|
122
|
-
|
|
21
|
+
## 📚 Complete Documentation
|
|
123
22
|
|
|
124
|
-
|
|
125
|
-
```bash
|
|
126
|
-
pipecraft init
|
|
127
|
-
```
|
|
23
|
+
**[Read the full documentation at pipecraft.thecraftlab.dev →](https://pipecraft.thecraftlab.dev)**
|
|
128
24
|
|
|
129
|
-
|
|
130
|
-
```bash
|
|
131
|
-
pipecraft init --force
|
|
132
|
-
```
|
|
25
|
+
The documentation site includes comprehensive guides, real-world examples, configuration references, and troubleshooting help.
|
|
133
26
|
|
|
134
|
-
|
|
27
|
+
---
|
|
135
28
|
|
|
136
|
-
|
|
29
|
+
## What is PipeCraft?
|
|
137
30
|
|
|
138
|
-
|
|
139
|
-
```bash
|
|
140
|
-
pipecraft generate
|
|
141
|
-
```
|
|
31
|
+
Debugging CI/CD pipelines is tedious. You push a change, wait 10 minutes for the pipeline to run, discover a tiny YAML syntax error, fix it, wait another 10 minutes, find another issue. Repeat until you've wasted hours on what should be simple workflow setup.
|
|
142
32
|
|
|
143
|
-
|
|
144
|
-
- Configuration file exists and is valid
|
|
145
|
-
- Required fields are present (ciProvider, branchFlow, domains)
|
|
146
|
-
- Current directory is a git repository
|
|
147
|
-
- Git remote is configured
|
|
148
|
-
- .github/workflows directory is writable
|
|
33
|
+
PipeCraft solves this by providing battle-tested CI/CD templates that you generate into your own repository. Instead of writing GitHub Actions workflows from scratch and debugging them through trial and error, you start with proven patterns that handle common scenarios: domain-based testing for monorepos, semantic versioning, branch promotion flows, and deployment automation.
|
|
149
34
|
|
|
150
|
-
|
|
151
|
-
```
|
|
152
|
-
🔍 Running pre-flight checks...
|
|
35
|
+
The generated workflows live in your repository—you own them completely. Customize them as much as you need: add deployment steps, integrate with your tools, modify job configurations. When customizations get complex or you want to start fresh, regenerate from templates. PipeCraft preserves your customizations while updating the core workflow structure.
|
|
153
36
|
|
|
154
|
-
|
|
155
|
-
✅ Configuration is valid
|
|
156
|
-
❌ Not in a git repository
|
|
157
|
-
💡 Initialize git: 'git init' or clone an existing repository
|
|
158
|
-
```
|
|
37
|
+
This approach means you get a fully functional CI/CD pipeline with best practices built in from day one, without the debugging cycles and without the maintenance burden of keeping workflows synchronized across projects.
|
|
159
38
|
|
|
160
|
-
|
|
39
|
+
## Quick Start
|
|
161
40
|
|
|
162
|
-
|
|
163
|
-
```bash
|
|
164
|
-
pipecraft generate
|
|
165
|
-
```
|
|
166
|
-
Shows only essential information: pre-flight checks and completion status.
|
|
41
|
+
Get a working pipeline in three commands:
|
|
167
42
|
|
|
168
|
-
Verbose mode - Shows file operations:
|
|
169
43
|
```bash
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
Includes file merge status, config paths, and workflow generation details.
|
|
44
|
+
# Initialize PipeCraft in your project
|
|
45
|
+
npx pipecraft init
|
|
173
46
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
Includes everything from verbose mode plus internal debugging information like branch flow context, job ordering, and template operations.
|
|
47
|
+
# Edit the generated .pipecraftrc.json to customize:
|
|
48
|
+
# - Branch names (branchFlow, initialBranch, finalBranch)
|
|
49
|
+
# - Domain paths and configurations
|
|
50
|
+
# - CI provider and merge strategy
|
|
179
51
|
|
|
180
|
-
|
|
52
|
+
# Generate your CI/CD workflows
|
|
53
|
+
npx pipecraft generate
|
|
181
54
|
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
55
|
+
# Commit the generated files
|
|
56
|
+
git add .github/workflows .pipecraftrc.json
|
|
57
|
+
git commit -m "chore: add PipeCraft workflows"
|
|
58
|
+
git push
|
|
185
59
|
```
|
|
186
60
|
|
|
187
|
-
|
|
188
|
-
```bash
|
|
189
|
-
pipecraft generate --force
|
|
190
|
-
```
|
|
61
|
+
That's it. Your trunk-based development workflow is now automated.
|
|
191
62
|
|
|
192
|
-
|
|
193
|
-
```bash
|
|
194
|
-
pipecraft generate --dry-run
|
|
195
|
-
```
|
|
63
|
+
## Key Features
|
|
196
64
|
|
|
197
|
-
|
|
198
|
-
```bash
|
|
199
|
-
pipecraft generate --config custom-config.json --output-pipeline .github/workflows/custom.yml
|
|
200
|
-
```
|
|
65
|
+
**Smart change detection** analyzes your commits to determine which parts of your monorepo changed. When you modify your API code, only API tests run. When you change the web frontend, only web tests run. When you touch shared libraries, all dependent tests run. This intelligence is built into the generated workflows—you don't manage it yourself.
|
|
201
66
|
|
|
202
|
-
|
|
67
|
+
**Automatic semantic versioning** reads your conventional commit messages (feat:, fix:, breaking:) and calculates the next version number. No more manually deciding whether something is a major, minor, or patch release. PipeCraft handles version bumping, git tagging, and changelog generation based on your commits.
|
|
203
68
|
|
|
204
|
-
|
|
205
|
-
```bash
|
|
206
|
-
pipecraft validate
|
|
207
|
-
```
|
|
69
|
+
**Trunk-based development support** provides a complete branch flow system. Code moves through develop → staging → main automatically after passing tests at each stage. Fast-forward merging keeps git history clean. Version gating ensures only tested code promotes to production.
|
|
208
70
|
|
|
209
|
-
|
|
210
|
-
```bash
|
|
211
|
-
pipecraft validate --config custom-config.json
|
|
212
|
-
```
|
|
71
|
+
**Safe workflow regeneration** preserves your customizations when you update configuration. PipeCraft uses AST-based merging to separate managed workflow structure from your custom test and deployment commands. Add your own jobs, modify test steps, customize deployments—all survive regeneration.
|
|
213
72
|
|
|
214
|
-
|
|
73
|
+
**Pre-flight validation** catches configuration errors before they become cryptic workflow failures. PipeCraft validates your setup, checks git configuration, verifies permissions, and provides helpful error messages when something needs fixing.
|
|
215
74
|
|
|
216
|
-
|
|
217
|
-
```bash
|
|
218
|
-
pipecraft verify
|
|
219
|
-
```
|
|
75
|
+
## When to Use PipeCraft
|
|
220
76
|
|
|
221
|
-
|
|
222
|
-
- Configuration file exists and is valid
|
|
223
|
-
- GitHub Actions workflows exist (for GitHub projects)
|
|
224
|
-
- Repository structure is correct
|
|
77
|
+
**You're managing a monorepo** with multiple applications or services. Running all tests for every change wastes time and money. PipeCraft's domain-based testing ensures you only test what changed while automatically testing shared dependencies across all dependent code.
|
|
225
78
|
|
|
226
|
-
|
|
79
|
+
**You want consistent CI/CD** across multiple projects or teams. Define your organization's workflow pattern once, then generate it consistently across repos. Changes to the pattern propagate through regeneration while preserving project-specific customizations.
|
|
227
80
|
|
|
228
|
-
|
|
229
|
-
```bash
|
|
230
|
-
pipecraft version --check
|
|
231
|
-
```
|
|
81
|
+
**You're tired of maintaining YAML** with hundreds of lines of repetitive workflow configuration. PipeCraft generates the boilerplate while letting you focus on what's unique about your project—the actual test and deployment commands.
|
|
232
82
|
|
|
233
|
-
|
|
234
|
-
```bash
|
|
235
|
-
pipecraft version --bump
|
|
236
|
-
```
|
|
83
|
+
## Installation
|
|
237
84
|
|
|
238
|
-
|
|
239
|
-
```bash
|
|
240
|
-
pipecraft version --release
|
|
241
|
-
```
|
|
85
|
+
### Using npx (recommended)
|
|
242
86
|
|
|
243
|
-
|
|
87
|
+
No installation required—just run commands directly:
|
|
244
88
|
|
|
245
|
-
Create all branches defined in your branch flow:
|
|
246
89
|
```bash
|
|
247
|
-
pipecraft
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
This automatically creates and pushes all branches to your remote repository.
|
|
251
|
-
|
|
252
|
-
### Configuration
|
|
253
|
-
|
|
254
|
-
PipeCraft uses [cosmiconfig](https://github.com/davidtheclark/cosmiconfig) for flexible configuration discovery. It will look for configuration in the following order:
|
|
255
|
-
|
|
256
|
-
1. Command-line options
|
|
257
|
-
2. `.pipecraftrc.json` file
|
|
258
|
-
3. `.pipecraftrc` file
|
|
259
|
-
4. `pipecraft` key in `package.json`
|
|
260
|
-
5. Default values
|
|
261
|
-
|
|
262
|
-
Example `.pipecraftrc.json`:
|
|
263
|
-
|
|
264
|
-
```json
|
|
265
|
-
{
|
|
266
|
-
"ciProvider": "github",
|
|
267
|
-
"mergeStrategy": "fast-forward",
|
|
268
|
-
"requireConventionalCommits": true,
|
|
269
|
-
"initialBranch": "develop",
|
|
270
|
-
"finalBranch": "main",
|
|
271
|
-
"branchFlow": ["develop", "staging", "main"],
|
|
272
|
-
"semver": {
|
|
273
|
-
"bumpRules": {
|
|
274
|
-
"feat": "minor",
|
|
275
|
-
"fix": "patch",
|
|
276
|
-
"breaking": "major"
|
|
277
|
-
}
|
|
278
|
-
},
|
|
279
|
-
"domains": {
|
|
280
|
-
"api": {
|
|
281
|
-
"paths": ["apps/api/**"],
|
|
282
|
-
"description": "API application changes"
|
|
283
|
-
},
|
|
284
|
-
"web": {
|
|
285
|
-
"paths": ["apps/web/**"],
|
|
286
|
-
"description": "Web application changes"
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
}
|
|
90
|
+
npx pipecraft init
|
|
91
|
+
npx pipecraft generate
|
|
290
92
|
```
|
|
291
93
|
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
PipeCraft provides the following commands:
|
|
295
|
-
|
|
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` |
|
|
300
|
-
| `validate` | Validate configuration file | `--config` |
|
|
301
|
-
| `setup-github` | Configure GitHub Actions workflow permissions | `--apply`, `--force` |
|
|
302
|
-
| `verify` | Verify PipeCraft setup | None |
|
|
303
|
-
| `version` | Version management commands | `--check`, `--bump`, `--release` |
|
|
304
|
-
| `setup` | Create branches from branch flow | `--force` |
|
|
305
|
-
|
|
306
|
-
> **Note**: All commands support global options like `--verbose` and `--debug` for detailed output.
|
|
307
|
-
|
|
308
|
-
### Global Options
|
|
94
|
+
### Global installation
|
|
309
95
|
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
- `-c, --config <path>` - Path to config file (default: `.pipecraftrc.json`)
|
|
313
|
-
- `-p, --pipeline <path>` - Path to existing pipeline file for merging
|
|
314
|
-
- `-o, --output-pipeline <path>` - Path to output pipeline file
|
|
315
|
-
- `-v, --verbose` - Verbose output (shows file operations and merge status)
|
|
316
|
-
- `--debug` - Debug output (includes verbose output plus internal debugging details)
|
|
317
|
-
- `--force` - Force operation even if unchanged
|
|
318
|
-
- `--dry-run` - Show what would be done without making changes
|
|
319
|
-
|
|
320
|
-
### Command Examples
|
|
96
|
+
Install once, use everywhere:
|
|
321
97
|
|
|
322
98
|
```bash
|
|
323
|
-
|
|
99
|
+
npm install -g pipecraft
|
|
324
100
|
pipecraft init
|
|
325
|
-
|
|
326
|
-
# Generate workflows with custom paths
|
|
327
|
-
pipecraft generate --config .pipecraft.json --output-pipeline workflows/ci.yml
|
|
328
|
-
|
|
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
|
|
334
|
-
|
|
335
|
-
# Setup GitHub Actions permissions (interactive mode)
|
|
336
|
-
pipecraft setup-github
|
|
337
|
-
|
|
338
|
-
# Setup GitHub Actions permissions (auto-apply mode)
|
|
339
|
-
pipecraft setup-github --apply
|
|
340
|
-
|
|
341
|
-
# Validate configuration before committing
|
|
342
|
-
pipecraft validate && git commit -am "chore: update workflow config"
|
|
343
|
-
|
|
344
|
-
# Check what version would be bumped to
|
|
345
|
-
pipecraft version --check
|
|
346
|
-
|
|
347
|
-
# Bump version based on conventional commits
|
|
348
|
-
pipecraft version --bump
|
|
349
|
-
|
|
350
|
-
# Create a full release with tag and changelog
|
|
351
|
-
pipecraft version --release
|
|
352
|
-
|
|
353
|
-
# Setup all branches for new repository
|
|
354
|
-
pipecraft setup
|
|
355
|
-
```
|
|
356
|
-
|
|
357
|
-
## Pre-Flight Checks
|
|
358
|
-
|
|
359
|
-
PipeCraft includes comprehensive pre-flight validation to catch common errors before generating workflows. This helps new users avoid frustration and ensures your project is properly configured.
|
|
360
|
-
|
|
361
|
-
### What Gets Checked
|
|
362
|
-
|
|
363
|
-
When you run `pipecraft generate`, the following checks are automatically performed:
|
|
364
|
-
|
|
365
|
-
1. **Configuration File Discovery**
|
|
366
|
-
- Searches for config using [cosmiconfig](https://github.com/davidtheclark/cosmiconfig)
|
|
367
|
-
- Looks in: `.pipecraftrc.json`, `.pipecraftrc`, `package.json` (pipecraft key)
|
|
368
|
-
- Searches parent directories recursively
|
|
369
|
-
- Shows the exact path where config was found
|
|
370
|
-
|
|
371
|
-
2. **Configuration Validation**
|
|
372
|
-
- Verifies JSON syntax is valid
|
|
373
|
-
- Checks all required fields are present:
|
|
374
|
-
- `ciProvider` (github or gitlab)
|
|
375
|
-
- `branchFlow` (array of branch names)
|
|
376
|
-
- `domains` (at least one domain configured)
|
|
377
|
-
- Validates domain configuration has paths defined
|
|
378
|
-
|
|
379
|
-
3. **Git Repository Check**
|
|
380
|
-
- Verifies current directory is a git repository
|
|
381
|
-
- Suggests running `git init` if not
|
|
382
|
-
|
|
383
|
-
4. **Git Remote Check**
|
|
384
|
-
- Verifies git remote is configured
|
|
385
|
-
- Shows the remote URL
|
|
386
|
-
- Suggests adding a remote if missing
|
|
387
|
-
|
|
388
|
-
5. **Write Permissions**
|
|
389
|
-
- Tests that `.github/workflows` directory can be created/written to
|
|
390
|
-
- Checks file system permissions
|
|
391
|
-
|
|
392
|
-
### Example Pre-Flight Output
|
|
393
|
-
|
|
394
|
-
**All checks passing:**
|
|
395
|
-
```
|
|
396
|
-
🔍 Running pre-flight checks...
|
|
397
|
-
|
|
398
|
-
✅ Configuration found: /path/to/project/.pipecraftrc.json
|
|
399
|
-
✅ Configuration is valid
|
|
400
|
-
✅ Current directory is a git repository
|
|
401
|
-
✅ Git remote configured: https://github.com/user/repo.git
|
|
402
|
-
✅ .github/workflows directory is writable
|
|
403
|
-
|
|
404
|
-
✅ All pre-flight checks passed!
|
|
405
|
-
```
|
|
406
|
-
|
|
407
|
-
**Checks failing with helpful suggestions:**
|
|
408
101
|
```
|
|
409
|
-
🔍 Running pre-flight checks...
|
|
410
|
-
|
|
411
|
-
❌ No PipeCraft configuration found
|
|
412
|
-
💡 Run 'pipecraft init' to create a configuration file
|
|
413
102
|
|
|
414
|
-
|
|
415
|
-
💡 Initialize git: 'git init' or clone an existing repository
|
|
103
|
+
### Local project installation
|
|
416
104
|
|
|
417
|
-
|
|
418
|
-
💡 Add a remote: 'git remote add origin <url>'
|
|
419
|
-
|
|
420
|
-
❌ Pre-flight checks failed. Fix the issues above and try again.
|
|
421
|
-
Or use --skip-checks to bypass (not recommended)
|
|
422
|
-
```
|
|
423
|
-
|
|
424
|
-
### Skipping Pre-Flight Checks
|
|
425
|
-
|
|
426
|
-
While not recommended, you can skip pre-flight checks if needed:
|
|
105
|
+
Add to your project's dev dependencies:
|
|
427
106
|
|
|
428
107
|
```bash
|
|
429
|
-
|
|
430
|
-
```
|
|
431
|
-
|
|
432
|
-
**When you might skip checks:**
|
|
433
|
-
- CI/CD environment with non-standard setup
|
|
434
|
-
- Using PipeCraft in a script/automation
|
|
435
|
-
- Advanced users who know the risks
|
|
436
|
-
|
|
437
|
-
**Why you shouldn't skip:**
|
|
438
|
-
- Prevents cryptic errors during generation
|
|
439
|
-
- Saves time by catching issues early
|
|
440
|
-
- Provides actionable error messages
|
|
441
|
-
- Ensures consistent behavior across environments
|
|
442
|
-
|
|
443
|
-
## GitHub Actions Setup
|
|
444
|
-
|
|
445
|
-
PipeCraft requires specific GitHub Actions permissions and repository settings to function correctly. The `setup-github` command helps you configure everything automatically.
|
|
446
|
-
|
|
447
|
-
### What Gets Configured
|
|
448
|
-
|
|
449
|
-
The `setup-github` command configures:
|
|
450
|
-
|
|
451
|
-
1. **Workflow Permissions**
|
|
452
|
-
- Default workflow permissions: **write** (for creating tags and pushing changes)
|
|
453
|
-
- Can create/approve pull requests: **Yes** (for automated PR creation)
|
|
454
|
-
|
|
455
|
-
2. **Repository Auto-Merge**
|
|
456
|
-
- Enables auto-merge feature at repository level
|
|
457
|
-
- Required for automatic promotion between branches
|
|
458
|
-
|
|
459
|
-
3. **Branch Protection Rules** (for branches with auto-merge enabled)
|
|
460
|
-
- Status checks enabled (no specific checks required)
|
|
461
|
-
- Required linear history (prevents messy merges)
|
|
462
|
-
- No force pushes or branch deletion
|
|
463
|
-
- These rules are required for GitHub's auto-merge feature to work
|
|
464
|
-
|
|
465
|
-
### Usage
|
|
466
|
-
|
|
467
|
-
**Interactive Mode (Default)**
|
|
468
|
-
|
|
469
|
-
Prompts you for each permission change:
|
|
470
|
-
|
|
471
|
-
```bash
|
|
472
|
-
pipecraft setup-github
|
|
473
|
-
```
|
|
474
|
-
|
|
475
|
-
The command will:
|
|
476
|
-
1. Check your current repository permissions
|
|
477
|
-
2. Enable repository-level auto-merge if needed
|
|
478
|
-
3. Configure branch protection for branches with `autoMerge: true` in config
|
|
479
|
-
4. Prompt you to apply each change
|
|
480
|
-
5. Update the settings if you accept
|
|
481
|
-
|
|
482
|
-
**Auto-Apply Mode**
|
|
483
|
-
|
|
484
|
-
Automatically applies all required changes without prompting:
|
|
485
|
-
|
|
486
|
-
```bash
|
|
487
|
-
pipecraft setup-github --apply
|
|
488
|
-
# or
|
|
489
|
-
pipecraft setup-github --force
|
|
490
|
-
```
|
|
491
|
-
|
|
492
|
-
This mode is useful for:
|
|
493
|
-
- CI/CD pipeline setup scripts
|
|
494
|
-
- Automated repository initialization
|
|
495
|
-
- Batch configuration of multiple repositories
|
|
496
|
-
|
|
497
|
-
### Example Output
|
|
498
|
-
|
|
499
|
-
**Interactive mode:**
|
|
500
|
-
```
|
|
501
|
-
🔍 Checking GitHub repository configuration...
|
|
502
|
-
|
|
503
|
-
📦 Repository: user/repo
|
|
504
|
-
✅ GitHub token found
|
|
505
|
-
🔍 Fetching current workflow permissions...
|
|
506
|
-
|
|
507
|
-
📋 Current GitHub Actions Workflow Permissions:
|
|
508
|
-
Default permissions: read
|
|
509
|
-
Can create/approve PRs: No
|
|
510
|
-
|
|
511
|
-
⚠️ PipeCraft requires the following permissions:
|
|
512
|
-
• Default permissions: write (for creating tags and pushing)
|
|
513
|
-
• Can create/approve PRs: Yes (for automated PR creation)
|
|
514
|
-
|
|
515
|
-
? Change default workflow permissions from "read" to "write"? (Y/n) Yes
|
|
516
|
-
|
|
517
|
-
🔍 Checking auto-merge configuration...
|
|
518
|
-
✅ Enabled auto-merge for repository
|
|
519
|
-
📋 Branches with auto-merge enabled: staging
|
|
520
|
-
? Enable branch protection for 'staging' to support auto-merge? (Y/n) Yes
|
|
521
|
-
🔧 Configuring branch protection for staging...
|
|
522
|
-
✅ Branch protection enabled for staging
|
|
523
|
-
|
|
524
|
-
✨ Setup complete!
|
|
525
|
-
```
|
|
526
|
-
|
|
527
|
-
**Auto-apply mode:**
|
|
528
|
-
```
|
|
529
|
-
🔍 Checking GitHub repository configuration...
|
|
530
|
-
|
|
531
|
-
📦 Repository: user/repo
|
|
532
|
-
✅ GitHub token found
|
|
533
|
-
🔍 Fetching current workflow permissions...
|
|
534
|
-
|
|
535
|
-
✅ Workflow permissions are already configured correctly!
|
|
536
|
-
|
|
537
|
-
🔍 Checking auto-merge configuration...
|
|
538
|
-
✅ Enabled auto-merge for repository
|
|
539
|
-
📋 Branches with auto-merge enabled: staging
|
|
540
|
-
🔧 Configuring branch protection for staging...
|
|
541
|
-
✅ Branch protection enabled for staging
|
|
542
|
-
|
|
543
|
-
✨ Setup complete!
|
|
544
|
-
|
|
545
|
-
💡 You can verify the changes at:
|
|
546
|
-
https://github.com/user/repo/settings/actions
|
|
547
|
-
```
|
|
548
|
-
|
|
549
|
-
### Authentication
|
|
550
|
-
|
|
551
|
-
The command requires a GitHub token with admin access to your repository. It will automatically use:
|
|
552
|
-
|
|
553
|
-
1. `GITHUB_TOKEN` environment variable
|
|
554
|
-
2. `GH_TOKEN` environment variable
|
|
555
|
-
3. GitHub CLI (`gh`) authentication
|
|
556
|
-
|
|
557
|
-
To authenticate with GitHub CLI:
|
|
558
|
-
```bash
|
|
559
|
-
gh auth login
|
|
560
|
-
```
|
|
561
|
-
|
|
562
|
-
Or set an environment variable:
|
|
563
|
-
```bash
|
|
564
|
-
export GITHUB_TOKEN=ghp_your_token_here
|
|
565
|
-
```
|
|
566
|
-
|
|
567
|
-
### Manual Configuration
|
|
568
|
-
|
|
569
|
-
You can also configure these settings manually:
|
|
570
|
-
|
|
571
|
-
**Workflow Permissions:**
|
|
572
|
-
1. Go to your repository on GitHub
|
|
573
|
-
2. Navigate to **Settings** → **Actions** → **General**
|
|
574
|
-
3. Under "Workflow permissions":
|
|
575
|
-
- Select **Read and write permissions**
|
|
576
|
-
- Check **Allow GitHub Actions to create and approve pull requests**
|
|
577
|
-
4. Click **Save**
|
|
578
|
-
|
|
579
|
-
**Repository Auto-Merge:**
|
|
580
|
-
1. Navigate to **Settings** → **General**
|
|
581
|
-
2. Scroll to "Pull Requests"
|
|
582
|
-
3. Check **Allow auto-merge**
|
|
583
|
-
4. Click **Save**
|
|
584
|
-
|
|
585
|
-
**Branch Protection (for branches with auto-merge):**
|
|
586
|
-
1. Navigate to **Settings** → **Branches**
|
|
587
|
-
2. Click **Add branch protection rule** or edit existing rule
|
|
588
|
-
3. In "Branch name pattern", enter the branch name (e.g., `staging`)
|
|
589
|
-
4. Configure the following:
|
|
590
|
-
- Check **Require status checks to pass before merging**
|
|
591
|
-
- Leave status checks empty (or add your own)
|
|
592
|
-
- Check **Require linear history**
|
|
593
|
-
- Leave other options as needed
|
|
594
|
-
5. Click **Create** or **Save changes**
|
|
595
|
-
|
|
596
|
-
Note: Branch protection rules are required for auto-merge to work in GitHub.
|
|
597
|
-
|
|
598
|
-
## Configuration Options
|
|
599
|
-
|
|
600
|
-
### Core Configuration
|
|
601
|
-
|
|
602
|
-
| Option | Type | Required | Default | Description |
|
|
603
|
-
|--------|------|----------|---------|-------------|
|
|
604
|
-
| `ciProvider` | `'github' \| 'gitlab'` | Yes | `'github'` | CI/CD provider |
|
|
605
|
-
| `mergeStrategy` | `'fast-forward' \| 'merge'` | Yes | `'fast-forward'` | Branch merge strategy |
|
|
606
|
-
| `requireConventionalCommits` | `boolean` | No | `true` | Enforce conventional commits |
|
|
607
|
-
| `initialBranch` | `string` | Yes | `'develop'` | First branch in flow |
|
|
608
|
-
| `finalBranch` | `string` | Yes | `'main'` | Final production branch |
|
|
609
|
-
| `branchFlow` | `string[]` | Yes | - | Ordered list of branches |
|
|
610
|
-
|
|
611
|
-
### Semantic Versioning
|
|
612
|
-
|
|
613
|
-
| Option | Type | Description |
|
|
614
|
-
|--------|------|-------------|
|
|
615
|
-
| `semver.bumpRules.feat` | `'major' \| 'minor' \| 'patch'` | Version bump for features |
|
|
616
|
-
| `semver.bumpRules.fix` | `'major' \| 'minor' \| 'patch'` | Version bump for fixes |
|
|
617
|
-
| `semver.bumpRules.breaking` | `'major' \| 'minor' \| 'patch'` | Version bump for breaking changes |
|
|
618
|
-
|
|
619
|
-
### Domains (Monorepo Support)
|
|
620
|
-
|
|
621
|
-
Define multiple domains for path-based change detection:
|
|
622
|
-
|
|
623
|
-
```json
|
|
624
|
-
{
|
|
625
|
-
"domains": {
|
|
626
|
-
"api": {
|
|
627
|
-
"paths": ["apps/api/**", "libs/api-utils/**"],
|
|
628
|
-
"description": "API application and utilities"
|
|
629
|
-
},
|
|
630
|
-
"web": {
|
|
631
|
-
"paths": ["apps/web/**", "libs/ui-components/**"],
|
|
632
|
-
"description": "Web application and UI components"
|
|
633
|
-
},
|
|
634
|
-
"mobile": {
|
|
635
|
-
"paths": ["apps/mobile/**"],
|
|
636
|
-
"description": "Mobile application"
|
|
637
|
-
}
|
|
638
|
-
}
|
|
639
|
-
}
|
|
640
|
-
```
|
|
641
|
-
|
|
642
|
-
Each domain can have:
|
|
643
|
-
- `paths` (required): Array of glob patterns for file matching
|
|
644
|
-
- `description` (optional): Human-readable description
|
|
645
|
-
|
|
646
|
-
### Versioning Configuration
|
|
647
|
-
|
|
648
|
-
```json
|
|
649
|
-
{
|
|
650
|
-
"versioning": {
|
|
651
|
-
"enabled": true,
|
|
652
|
-
"releaseItConfig": ".release-it.cjs",
|
|
653
|
-
"conventionalCommits": true,
|
|
654
|
-
"autoTag": true,
|
|
655
|
-
"autoPush": true,
|
|
656
|
-
"changelog": true,
|
|
657
|
-
"bumpRules": {
|
|
658
|
-
"feat": "minor",
|
|
659
|
-
"fix": "patch",
|
|
660
|
-
"breaking": "major"
|
|
661
|
-
}
|
|
662
|
-
}
|
|
663
|
-
}
|
|
664
|
-
```
|
|
665
|
-
|
|
666
|
-
### Rebuild/Idempotency Configuration
|
|
667
|
-
|
|
668
|
-
Control when workflows are regenerated:
|
|
669
|
-
|
|
670
|
-
```json
|
|
671
|
-
{
|
|
672
|
-
"rebuild": {
|
|
673
|
-
"enabled": true,
|
|
674
|
-
"skipIfUnchanged": true,
|
|
675
|
-
"forceRegenerate": false,
|
|
676
|
-
"watchMode": false,
|
|
677
|
-
"hashAlgorithm": "sha256",
|
|
678
|
-
"cacheFile": ".pipecraft-cache.json",
|
|
679
|
-
"ignorePatterns": ["*.md", "docs/**"]
|
|
680
|
-
}
|
|
681
|
-
}
|
|
682
|
-
```
|
|
683
|
-
|
|
684
|
-
## Domain-Based Workflows
|
|
685
|
-
|
|
686
|
-
PipeCraft excels at managing monorepo workflows with multiple domains. The generated workflows automatically detect which domains have changes and run appropriate jobs.
|
|
687
|
-
|
|
688
|
-
### How It Works
|
|
689
|
-
|
|
690
|
-
1. **Change Detection**: The `changes` job uses GitHub's `paths-filter` action to detect which domains have modifications
|
|
691
|
-
2. **Conditional Jobs**: Domain-specific jobs only run if changes are detected in their paths
|
|
692
|
-
3. **Parallel Execution**: Independent domains run in parallel for faster CI times
|
|
693
|
-
4. **Dependency Management**: Jobs can depend on specific domain changes
|
|
694
|
-
|
|
695
|
-
### Example Generated Workflow
|
|
696
|
-
|
|
697
|
-
```yaml
|
|
698
|
-
name: Pipeline
|
|
699
|
-
|
|
700
|
-
on:
|
|
701
|
-
pull_request:
|
|
702
|
-
branches:
|
|
703
|
-
- develop
|
|
704
|
-
- staging
|
|
705
|
-
- main
|
|
706
|
-
|
|
707
|
-
jobs:
|
|
708
|
-
changes:
|
|
709
|
-
runs-on: ubuntu-latest
|
|
710
|
-
outputs:
|
|
711
|
-
api: ${{ steps.changes.outputs.api }}
|
|
712
|
-
web: ${{ steps.changes.outputs.web }}
|
|
713
|
-
steps:
|
|
714
|
-
- uses: actions/checkout@v4
|
|
715
|
-
- uses: dorny/paths-filter@v3
|
|
716
|
-
id: changes
|
|
717
|
-
with:
|
|
718
|
-
filters: |
|
|
719
|
-
api:
|
|
720
|
-
- 'apps/api/**'
|
|
721
|
-
web:
|
|
722
|
-
- 'apps/web/**'
|
|
723
|
-
|
|
724
|
-
test-api:
|
|
725
|
-
needs: changes
|
|
726
|
-
if: needs.changes.outputs.api == 'true'
|
|
727
|
-
runs-on: ubuntu-latest
|
|
728
|
-
steps:
|
|
729
|
-
- uses: actions/checkout@v4
|
|
730
|
-
- name: Run API tests
|
|
731
|
-
run: npm test --workspace=api
|
|
732
|
-
|
|
733
|
-
test-web:
|
|
734
|
-
needs: changes
|
|
735
|
-
if: needs.changes.outputs.web == 'true'
|
|
736
|
-
runs-on: ubuntu-latest
|
|
737
|
-
steps:
|
|
738
|
-
- uses: actions/checkout@v4
|
|
739
|
-
- name: Run Web tests
|
|
740
|
-
run: npm test --workspace=web
|
|
741
|
-
```
|
|
742
|
-
|
|
743
|
-
## Version Management
|
|
744
|
-
|
|
745
|
-
PipeCraft integrates with [release-it](https://github.com/release-it/release-it) for automated semantic versioning.
|
|
746
|
-
|
|
747
|
-
### Setup Version Management
|
|
748
|
-
|
|
749
|
-
```bash
|
|
750
|
-
pipecraft init --with-versioning
|
|
751
|
-
```
|
|
752
|
-
|
|
753
|
-
This creates:
|
|
754
|
-
- `.release-it.cjs` - Release-it configuration
|
|
755
|
-
- `commitlint.config.js` - Commit message linting
|
|
756
|
-
- `.husky/commit-msg` - Git hook for commit validation
|
|
757
|
-
|
|
758
|
-
### Version Commands
|
|
759
|
-
|
|
760
|
-
Check what the next version would be:
|
|
761
|
-
```bash
|
|
762
|
-
pipecraft version --check
|
|
763
|
-
```
|
|
764
|
-
|
|
765
|
-
Output:
|
|
766
|
-
```
|
|
767
|
-
📦 Current version: 1.2.3
|
|
768
|
-
📦 Next version: 1.3.0 (minor)
|
|
769
|
-
📝 Conventional commits: ✅ Valid
|
|
770
|
-
```
|
|
771
|
-
|
|
772
|
-
Bump version based on commits:
|
|
773
|
-
```bash
|
|
774
|
-
pipecraft version --bump
|
|
775
|
-
```
|
|
776
|
-
|
|
777
|
-
Create a full release:
|
|
778
|
-
```bash
|
|
779
|
-
pipecraft version --release
|
|
780
|
-
```
|
|
781
|
-
|
|
782
|
-
### Conventional Commits
|
|
783
|
-
|
|
784
|
-
PipeCraft works best with conventional commits:
|
|
785
|
-
|
|
786
|
-
- `feat:` - New feature (minor bump)
|
|
787
|
-
- `fix:` - Bug fix (patch bump)
|
|
788
|
-
- `feat!:` or `BREAKING CHANGE:` - Breaking change (major bump)
|
|
789
|
-
- `chore:`, `docs:`, `style:`, `refactor:`, `test:` - No version bump
|
|
790
|
-
|
|
791
|
-
Example:
|
|
792
|
-
```bash
|
|
793
|
-
git commit -m "feat: add user authentication" # Bumps to 1.3.0
|
|
794
|
-
git commit -m "fix: resolve login bug" # Bumps to 1.3.1
|
|
795
|
-
git commit -m "feat!: redesign API structure" # Bumps to 2.0.0
|
|
108
|
+
npm install --save-dev pipecraft
|
|
796
109
|
```
|
|
797
110
|
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
### Example 1: Simple Project with Linear Branch Flow
|
|
801
|
-
|
|
802
|
-
Configuration for a project with develop → main flow:
|
|
111
|
+
Then add npm scripts to your package.json:
|
|
803
112
|
|
|
804
113
|
```json
|
|
805
114
|
{
|
|
806
|
-
"
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
"branchFlow": ["develop", "main"],
|
|
811
|
-
"domains": {
|
|
812
|
-
"app": {
|
|
813
|
-
"paths": ["src/**"],
|
|
814
|
-
"description": "Application code"
|
|
815
|
-
}
|
|
115
|
+
"scripts": {
|
|
116
|
+
"workflow:init": "pipecraft init",
|
|
117
|
+
"workflow:generate": "pipecraft generate",
|
|
118
|
+
"workflow:validate": "pipecraft validate"
|
|
816
119
|
}
|
|
817
120
|
}
|
|
818
121
|
```
|
|
819
122
|
|
|
820
|
-
|
|
123
|
+
## Simple Example
|
|
821
124
|
|
|
822
|
-
|
|
125
|
+
Create a `.pipecraftrc.json` configuration describing your project:
|
|
823
126
|
|
|
824
127
|
```json
|
|
825
128
|
{
|
|
@@ -827,286 +130,80 @@ Configuration for staging environment:
|
|
|
827
130
|
"mergeStrategy": "fast-forward",
|
|
828
131
|
"requireConventionalCommits": true,
|
|
829
132
|
"initialBranch": "develop",
|
|
830
|
-
"finalBranch": "
|
|
831
|
-
"branchFlow": ["develop", "staging", "
|
|
832
|
-
"semver": {
|
|
833
|
-
"bumpRules": {
|
|
834
|
-
"feat": "minor",
|
|
835
|
-
"fix": "patch",
|
|
836
|
-
"breaking": "major"
|
|
837
|
-
}
|
|
838
|
-
},
|
|
133
|
+
"finalBranch": "main",
|
|
134
|
+
"branchFlow": ["develop", "staging", "main"],
|
|
839
135
|
"domains": {
|
|
840
136
|
"api": {
|
|
841
|
-
"paths": ["
|
|
842
|
-
"description": "API services and core
|
|
137
|
+
"paths": ["apps/api/**", "libs/api-core/**"],
|
|
138
|
+
"description": "API services and core logic"
|
|
843
139
|
},
|
|
844
140
|
"web": {
|
|
845
|
-
"paths": ["apps/web/**", "libs/ui/**"],
|
|
846
|
-
"description": "Web application and UI
|
|
847
|
-
},
|
|
848
|
-
"mobile": {
|
|
849
|
-
"paths": ["apps/mobile/**"],
|
|
850
|
-
"description": "Mobile application"
|
|
851
|
-
},
|
|
852
|
-
"shared": {
|
|
853
|
-
"paths": ["libs/shared/**", "packages/**"],
|
|
854
|
-
"description": "Shared libraries and packages"
|
|
855
|
-
}
|
|
856
|
-
},
|
|
857
|
-
"versioning": {
|
|
858
|
-
"enabled": true,
|
|
859
|
-
"conventionalCommits": true,
|
|
860
|
-
"autoTag": true,
|
|
861
|
-
"changelog": true
|
|
862
|
-
}
|
|
863
|
-
}
|
|
864
|
-
```
|
|
865
|
-
|
|
866
|
-
### Example 3: GitLab CI Project
|
|
867
|
-
|
|
868
|
-
Configuration for GitLab:
|
|
869
|
-
|
|
870
|
-
```json
|
|
871
|
-
{
|
|
872
|
-
"ciProvider": "gitlab",
|
|
873
|
-
"mergeStrategy": "merge",
|
|
874
|
-
"initialBranch": "develop",
|
|
875
|
-
"finalBranch": "main",
|
|
876
|
-
"branchFlow": ["develop", "main"],
|
|
877
|
-
"domains": {
|
|
878
|
-
"backend": {
|
|
879
|
-
"paths": ["backend/**"],
|
|
880
|
-
"description": "Backend services"
|
|
881
|
-
},
|
|
882
|
-
"frontend": {
|
|
883
|
-
"paths": ["frontend/**"],
|
|
884
|
-
"description": "Frontend application"
|
|
885
|
-
}
|
|
886
|
-
}
|
|
887
|
-
}
|
|
888
|
-
```
|
|
889
|
-
|
|
890
|
-
### Example 4: Custom Branch Names
|
|
891
|
-
|
|
892
|
-
Configuration with non-standard branch names:
|
|
893
|
-
|
|
894
|
-
```json
|
|
895
|
-
{
|
|
896
|
-
"ciProvider": "github",
|
|
897
|
-
"mergeStrategy": "fast-forward",
|
|
898
|
-
"initialBranch": "alpha",
|
|
899
|
-
"finalBranch": "release",
|
|
900
|
-
"branchFlow": ["alpha", "beta", "gamma", "release"],
|
|
901
|
-
"domains": {
|
|
902
|
-
"core": {
|
|
903
|
-
"paths": ["core/**"],
|
|
904
|
-
"description": "Core functionality"
|
|
141
|
+
"paths": ["apps/web/**", "libs/ui-components/**"],
|
|
142
|
+
"description": "Web application and UI"
|
|
905
143
|
}
|
|
906
144
|
}
|
|
907
145
|
}
|
|
908
146
|
```
|
|
909
147
|
|
|
910
|
-
|
|
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
|
-
|
|
937
|
-
## Roadmap & Future Features
|
|
148
|
+
Run `pipecraft generate` and you get a complete GitHub Actions workflow with:
|
|
938
149
|
|
|
939
|
-
|
|
150
|
+
- Change detection that identifies which domains modified
|
|
151
|
+
- Parallel test jobs for api and web (conditional on changes)
|
|
152
|
+
- Semantic versioning based on conventional commits
|
|
153
|
+
- Automatic branch promotion through your flow
|
|
154
|
+
- Version tagging and changelog generation
|
|
940
155
|
|
|
941
|
-
|
|
156
|
+
Add your specific test commands to the generated jobs, commit everything, and you're running.
|
|
942
157
|
|
|
943
|
-
|
|
158
|
+
## What Gets Generated
|
|
944
159
|
|
|
945
|
-
|
|
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
|
|
160
|
+
PipeCraft creates `.github/workflows/pipeline.yml` containing all the jobs that run when you push code. It also generates reusable actions in `.github/actions/` for common operations like change detection and version calculation.
|
|
951
161
|
|
|
952
|
-
|
|
162
|
+
The generated workflows include clearly marked sections for your customizations. Anything you add in these sections survives regeneration—PipeCraft's AST-based merging ensures your test commands, deployment scripts, and custom jobs remain intact when you update configuration.
|
|
953
163
|
|
|
954
|
-
|
|
164
|
+
See the [Getting Started guide](https://pipecraft.thecraftlab.dev/docs/intro) for a complete walkthrough with examples, or check out [What Gets Generated](https://pipecraft.thecraftlab.dev/docs/intro#what-gets-generated) for detailed workflow structure.
|
|
955
165
|
|
|
956
|
-
|
|
166
|
+
## Next Steps
|
|
957
167
|
|
|
958
|
-
|
|
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
|
|
168
|
+
**Start with the tutorial**: The [Getting Started guide](https://pipecraft.thecraftlab.dev/docs/intro) walks through setting up PipeCraft in a real monorepo with detailed explanations of each step.
|
|
963
169
|
|
|
964
|
-
|
|
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
|
|
170
|
+
**Understand your configuration**: The [Configuration Reference](https://pipecraft.thecraftlab.dev/docs/configuration-reference) explains every option with examples of when and why to use each setting.
|
|
968
171
|
|
|
969
|
-
|
|
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
|
|
172
|
+
**See real-world examples**: The [Examples page](https://pipecraft.thecraftlab.dev/docs/examples) shows configurations for different scenarios—simple web apps, full-stack monorepos, microservices, and enterprise setups.
|
|
973
173
|
|
|
974
|
-
|
|
174
|
+
**Learn the commands**: The [Commands guide](https://pipecraft.thecraftlab.dev/docs/commands) covers all CLI commands with practical usage patterns and workflows.
|
|
975
175
|
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
Have a feature request? We'd love to hear from you!
|
|
979
|
-
|
|
980
|
-
1. Check existing [feature requests](https://github.com/jamesvillarrubia/pipecraft/issues?q=is%3Aissue+is%3Aopen+label%3Aenhancement)
|
|
981
|
-
2. [Open a new feature request](https://github.com/jamesvillarrubia/pipecraft/issues/new?labels=enhancement)
|
|
982
|
-
3. Vote on existing feature requests with 👍
|
|
983
|
-
4. Consider contributing! See [Contributing](#contributing)
|
|
176
|
+
**Explore workflow patterns**: Start with [Trunk Flow](https://pipecraft.thecraftlab.dev/docs/flows/trunk-flow) to understand how code moves through branches automatically.
|
|
984
177
|
|
|
985
178
|
## Troubleshooting
|
|
986
179
|
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
#### 1. Workflows Not Generating
|
|
990
|
-
|
|
991
|
-
**Problem**: Running `pipecraft generate` doesn't create files.
|
|
992
|
-
|
|
993
|
-
**Solutions**:
|
|
994
|
-
- PipeCraft now runs automatic pre-flight checks that will catch most issues
|
|
995
|
-
- Review the pre-flight check output for specific problems
|
|
996
|
-
- Check if configuration is valid: `pipecraft validate`
|
|
997
|
-
- Use `--force` to bypass cache: `pipecraft generate --force`
|
|
998
|
-
- Use `--verbose` for detailed output: `pipecraft generate --verbose`
|
|
999
|
-
- Use `--debug` for full debugging output: `pipecraft generate --debug`
|
|
1000
|
-
- Verify file permissions in `.github/workflows/`
|
|
1001
|
-
|
|
1002
|
-
#### 2. Configuration Validation Errors
|
|
1003
|
-
|
|
1004
|
-
**Problem**: Getting validation errors when running commands.
|
|
1005
|
-
|
|
1006
|
-
**Solutions**:
|
|
1007
|
-
- Ensure all required fields are present (ciProvider, branchFlow, domains)
|
|
1008
|
-
- Check that `initialBranch` and `finalBranch` are in `branchFlow`
|
|
1009
|
-
- Verify domain paths are valid glob patterns
|
|
1010
|
-
- Use `pipecraft validate` to see specific errors
|
|
1011
|
-
|
|
1012
|
-
#### 3. Branch Flow Not Working
|
|
1013
|
-
|
|
1014
|
-
**Problem**: Branches aren't being created or fast-forwarded.
|
|
180
|
+
If you encounter issues, the [Troubleshooting guide](https://pipecraft.thecraftlab.dev/docs/troubleshooting) covers common problems with detailed solutions.
|
|
1015
181
|
|
|
1016
|
-
|
|
1017
|
-
- Run `pipecraft setup` to create missing branches
|
|
1018
|
-
- Verify GitHub token has push permissions
|
|
1019
|
-
- Check that branch protection rules allow fast-forward merges
|
|
1020
|
-
- Ensure branches exist on remote: `git push origin branch-name`
|
|
182
|
+
For questions and discussions, visit [GitHub Discussions](https://github.com/jamesvillarrubia/pipecraft/discussions).
|
|
1021
183
|
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
**Problem**: Version bumps aren't happening automatically.
|
|
1025
|
-
|
|
1026
|
-
**Solutions**:
|
|
1027
|
-
- Initialize version management: `pipecraft init --with-versioning`
|
|
1028
|
-
- Ensure commits follow conventional format
|
|
1029
|
-
- Check that `package.json` exists with version field
|
|
1030
|
-
- Verify `release-it` is configured: check `.release-it.cjs`
|
|
1031
|
-
|
|
1032
|
-
#### 5. Cache Issues
|
|
1033
|
-
|
|
1034
|
-
**Problem**: Changes not being detected after config update.
|
|
1035
|
-
|
|
1036
|
-
**Solutions**:
|
|
1037
|
-
- Force regeneration: `pipecraft generate --force`
|
|
1038
|
-
- Delete cache file: `rm .pipecraft-cache.json`
|
|
1039
|
-
- Check cache file permissions
|
|
1040
|
-
- Verify `rebuild.enabled` is `true` in config
|
|
1041
|
-
|
|
1042
|
-
### Getting Help
|
|
1043
|
-
|
|
1044
|
-
If you encounter issues not covered here:
|
|
1045
|
-
|
|
1046
|
-
1. Check the [GitHub Issues](https://github.com/jamesvillarrubia/pipecraft/issues)
|
|
1047
|
-
2. Enable verbose logging: `pipecraft generate --verbose`
|
|
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:
|
|
1051
|
-
- PipeCraft version: `pipecraft --version`
|
|
1052
|
-
- Node version: `node --version`
|
|
1053
|
-
- Your configuration (sanitized)
|
|
1054
|
-
- Full error output with `--debug`
|
|
184
|
+
To report bugs or request features, open an issue on [GitHub Issues](https://github.com/jamesvillarrubia/pipecraft/issues).
|
|
1055
185
|
|
|
1056
186
|
## Contributing
|
|
1057
187
|
|
|
1058
|
-
|
|
188
|
+
We welcome contributions! See the [Contributing guide](https://pipecraft.thecraftlab.dev/docs/contributing) for:
|
|
1059
189
|
|
|
1060
|
-
-
|
|
1061
|
-
-
|
|
1062
|
-
-
|
|
1063
|
-
-
|
|
1064
|
-
- Coding standards
|
|
190
|
+
- Development setup instructions
|
|
191
|
+
- Code architecture overview
|
|
192
|
+
- Testing guidelines
|
|
193
|
+
- Pull request process
|
|
1065
194
|
|
|
1066
|
-
|
|
195
|
+
Quick development setup:
|
|
1067
196
|
|
|
1068
197
|
```bash
|
|
1069
|
-
# Clone the repository
|
|
1070
198
|
git clone https://github.com/jamesvillarrubia/pipecraft.git
|
|
1071
199
|
cd pipecraft
|
|
1072
|
-
|
|
1073
|
-
# Install dependencies
|
|
1074
200
|
npm install
|
|
1075
|
-
|
|
1076
|
-
# Run tests
|
|
1077
201
|
npm test
|
|
1078
|
-
|
|
1079
|
-
# Run in development mode
|
|
1080
|
-
npm run dev -- init --interactive
|
|
1081
|
-
```
|
|
1082
|
-
|
|
1083
|
-
### Running Tests
|
|
1084
|
-
|
|
1085
|
-
```bash
|
|
1086
|
-
# Run all tests
|
|
1087
|
-
npm test
|
|
1088
|
-
|
|
1089
|
-
# Run with coverage
|
|
1090
|
-
npm run test:coverage
|
|
1091
|
-
|
|
1092
|
-
# Run in watch mode
|
|
1093
|
-
npm run test:watch
|
|
1094
|
-
|
|
1095
|
-
# Run specific test file
|
|
1096
|
-
npm test tests/unit/config.test.ts
|
|
1097
202
|
```
|
|
1098
203
|
|
|
1099
204
|
## License
|
|
1100
205
|
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
## Acknowledgments
|
|
1104
|
-
|
|
1105
|
-
- **PullCraft** - Sister project for automated PR generation
|
|
1106
|
-
- **Pinion** - Template generation framework by FeathersCloud
|
|
1107
|
-
- **Commander** - CLI framework
|
|
1108
|
-
- **release-it** - Version management and releases
|
|
1109
|
-
- All contributors who have helped improve PipeCraft
|
|
206
|
+
MIT License - see the [LICENSE](LICENSE) file for details.
|
|
1110
207
|
|
|
1111
208
|
---
|
|
1112
209
|
|
|
@@ -1114,6 +211,6 @@ This project is licensed under the MIT License - see the [LICENSE](https://githu
|
|
|
1114
211
|
|
|
1115
212
|
**Built with ❤️ for trunk-based development teams**
|
|
1116
213
|
|
|
1117
|
-
[
|
|
214
|
+
[Documentation](https://pipecraft.thecraftlab.dev) · [Report Bug](https://github.com/jamesvillarrubia/pipecraft/issues) · [Request Feature](https://github.com/jamesvillarrubia/pipecraft/issues)
|
|
1118
215
|
|
|
1119
216
|
</div>
|