pi-cicd 0.3.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -0
- package/README.md +34 -40
- package/docs/API.md +61 -0
- package/docs/COMMANDS.md +138 -0
- package/docs/CONFIG.md +123 -0
- package/docs/GUIDE.md +171 -0
- package/docs/PATTERNS.md +49 -0
- package/docs/QUICKSTART.md +99 -0
- package/{dist/index.d.ts → index.ts} +26 -4
- package/install.mjs +34 -0
- package/package.json +21 -21
- package/skills/intelligent-deploy/SKILL.md +229 -0
- package/src/ci/pipeline.ts +130 -0
- package/src/ci/pr-creator.ts +74 -0
- package/src/ci/report.ts +65 -0
- package/src/ci/test-runner.ts +129 -0
- package/src/config.ts +99 -0
- package/src/deploy/canary-deploy.ts +211 -0
- package/src/deploy/landing-queue.ts +222 -0
- package/src/headless/answer-injector.ts +99 -0
- package/src/headless/exit-codes.ts +32 -0
- package/src/headless/idle-detector.ts +76 -0
- package/src/headless/jsonl-stream.ts +90 -0
- package/src/headless/orchestrator.ts +207 -0
- package/{dist/index.js → src/index.ts} +30 -9
- package/src/tools/ci_status.ts +137 -0
- package/src/types.ts +149 -0
- package/src/workflow/deployment-workflow.ts +153 -0
- package/dist/ci/pipeline.d.ts +0 -43
- package/dist/ci/pipeline.d.ts.map +0 -1
- package/dist/ci/pipeline.js +0 -107
- package/dist/ci/pipeline.js.map +0 -1
- package/dist/ci/pr-creator.d.ts +0 -17
- package/dist/ci/pr-creator.d.ts.map +0 -1
- package/dist/ci/pr-creator.js +0 -67
- package/dist/ci/pr-creator.js.map +0 -1
- package/dist/ci/report.d.ts +0 -14
- package/dist/ci/report.d.ts.map +0 -1
- package/dist/ci/report.js +0 -51
- package/dist/ci/report.js.map +0 -1
- package/dist/ci/test-runner.d.ts +0 -10
- package/dist/ci/test-runner.d.ts.map +0 -1
- package/dist/ci/test-runner.js +0 -111
- package/dist/ci/test-runner.js.map +0 -1
- package/dist/config.d.ts +0 -33
- package/dist/config.d.ts.map +0 -1
- package/dist/config.js +0 -67
- package/dist/config.js.map +0 -1
- package/dist/deploy/canary-deploy.d.ts +0 -80
- package/dist/deploy/canary-deploy.d.ts.map +0 -1
- package/dist/deploy/canary-deploy.js +0 -145
- package/dist/deploy/canary-deploy.js.map +0 -1
- package/dist/deploy/landing-queue.d.ts +0 -83
- package/dist/deploy/landing-queue.d.ts.map +0 -1
- package/dist/deploy/landing-queue.js +0 -172
- package/dist/deploy/landing-queue.js.map +0 -1
- package/dist/headless/answer-injector.d.ts +0 -27
- package/dist/headless/answer-injector.d.ts.map +0 -1
- package/dist/headless/answer-injector.js +0 -80
- package/dist/headless/answer-injector.js.map +0 -1
- package/dist/headless/exit-codes.d.ts +0 -13
- package/dist/headless/exit-codes.d.ts.map +0 -1
- package/dist/headless/exit-codes.js +0 -29
- package/dist/headless/exit-codes.js.map +0 -1
- package/dist/headless/idle-detector.d.ts +0 -32
- package/dist/headless/idle-detector.d.ts.map +0 -1
- package/dist/headless/idle-detector.js +0 -62
- package/dist/headless/idle-detector.js.map +0 -1
- package/dist/headless/jsonl-stream.d.ts +0 -28
- package/dist/headless/jsonl-stream.d.ts.map +0 -1
- package/dist/headless/jsonl-stream.js +0 -65
- package/dist/headless/jsonl-stream.js.map +0 -1
- package/dist/headless/orchestrator.d.ts +0 -63
- package/dist/headless/orchestrator.d.ts.map +0 -1
- package/dist/headless/orchestrator.js +0 -156
- package/dist/headless/orchestrator.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/tools/ci_status.d.ts +0 -40
- package/dist/tools/ci_status.d.ts.map +0 -1
- package/dist/tools/ci_status.js +0 -110
- package/dist/tools/ci_status.js.map +0 -1
- package/dist/types.d.ts +0 -93
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -17
- package/dist/types.js.map +0 -1
- package/dist/workflow/deployment-workflow.d.ts +0 -56
- package/dist/workflow/deployment-workflow.d.ts.map +0 -1
- package/dist/workflow/deployment-workflow.js +0 -95
- package/dist/workflow/deployment-workflow.js.map +0 -1
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.4.1 (2026-05-13)
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
- Comprehensive documentation
|
|
7
|
+
- Improved canary deployment
|
|
8
|
+
|
|
9
|
+
## 0.4.0 (2026-05-12)
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
- Pipeline Orchestration
|
|
13
|
+
- Headless Mode with exit codes
|
|
14
|
+
- Canary Deployments
|
|
15
|
+
- Landing Queue
|
|
16
|
+
- Event Streaming
|
|
17
|
+
|
|
18
|
+
## 0.3.0 (Earlier)
|
|
19
|
+
- Initial release
|
package/README.md
CHANGED
|
@@ -1,61 +1,55 @@
|
|
|
1
1
|
# pi-cicd
|
|
2
2
|
|
|
3
|
-
CI/CD workflow automation
|
|
3
|
+
CI/CD workflow automation extension for Pi coding agents.
|
|
4
4
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
7
|
-
- **
|
|
8
|
-
- **
|
|
9
|
-
- **
|
|
10
|
-
- **
|
|
11
|
-
- **
|
|
7
|
+
- **Pipeline Orchestration** - Define and run CI/CD pipelines
|
|
8
|
+
- **Headless Mode** - Run in CI environments with exit codes
|
|
9
|
+
- **Exit Codes** - Structured exit codes (0=success, 1=error, 10=blocked, 11=cancelled)
|
|
10
|
+
- **Answer Injection** - Provide answers non-interactively
|
|
11
|
+
- **Event Streaming** - JSONL output for CI integration
|
|
12
|
+
- **Canary Deployments** - Progressive deployment with health checks
|
|
13
|
+
- **Landing Queue** - Queue deployments with rollback capability
|
|
12
14
|
|
|
13
|
-
##
|
|
15
|
+
## Install
|
|
14
16
|
|
|
15
17
|
```bash
|
|
16
|
-
|
|
18
|
+
pi install npm:pi-cicd
|
|
17
19
|
```
|
|
18
20
|
|
|
19
|
-
##
|
|
21
|
+
## Quick Start
|
|
20
22
|
|
|
21
|
-
###
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
- `/rollback` - Rollback to previous version
|
|
26
|
-
- `/pr [type]` - Create pull request
|
|
27
|
-
|
|
28
|
-
### Deployment Workflow
|
|
23
|
+
### Run Pipeline
|
|
24
|
+
```bash
|
|
25
|
+
/ci run production
|
|
26
|
+
```
|
|
29
27
|
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
### Check Status
|
|
29
|
+
```bash
|
|
30
|
+
/ci status
|
|
31
|
+
```
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
});
|
|
33
|
+
### Deploy Canary
|
|
34
|
+
```bash
|
|
35
|
+
/ci canary deploy --percentage 10
|
|
37
36
|
```
|
|
38
37
|
|
|
39
|
-
##
|
|
38
|
+
## Commands
|
|
40
39
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
├── automation/
|
|
49
|
-
│ ├── pr-creator.ts # PR generation
|
|
50
|
-
│ └── pipeline.ts # Pipeline automation
|
|
51
|
-
└── index.ts
|
|
52
|
-
```
|
|
40
|
+
| Command | Description |
|
|
41
|
+
|---------|-------------|
|
|
42
|
+
| `/ci` | CI/CD main command |
|
|
43
|
+
| `/ci run` | Run pipeline |
|
|
44
|
+
| `/ci status` | Check status |
|
|
45
|
+
| `/ci deploy` | Deploy |
|
|
46
|
+
| `/ci canary` | Canary deployment |
|
|
53
47
|
|
|
54
|
-
##
|
|
48
|
+
## Verify
|
|
55
49
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
50
|
+
```bash
|
|
51
|
+
pi list
|
|
52
|
+
```
|
|
59
53
|
|
|
60
54
|
## License
|
|
61
55
|
|
package/docs/API.md
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# pi-cicd API Reference
|
|
2
|
+
|
|
3
|
+
## Deployment Workflow
|
|
4
|
+
|
|
5
|
+
```typescript
|
|
6
|
+
import { createDeploymentWorkflow } from 'pi-cicd';
|
|
7
|
+
|
|
8
|
+
const workflow = createDeploymentWorkflow({
|
|
9
|
+
name: 'my-deploy',
|
|
10
|
+
stages: ['build', 'test', 'staging', 'production'],
|
|
11
|
+
canary: {
|
|
12
|
+
initial: 10,
|
|
13
|
+
increment: 20,
|
|
14
|
+
interval: 60000,
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
await workflow.execute();
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Canary Deployment
|
|
22
|
+
|
|
23
|
+
```typescript
|
|
24
|
+
import { CanaryDeployment } from 'pi-cicd';
|
|
25
|
+
|
|
26
|
+
const canary = new CanaryDeployment({
|
|
27
|
+
initialPercent: 10,
|
|
28
|
+
maxPercent: 100,
|
|
29
|
+
increment: 20,
|
|
30
|
+
checkInterval: 60000,
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
await canary.start();
|
|
34
|
+
await canary.promote();
|
|
35
|
+
await canary.complete();
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Landing Queue
|
|
39
|
+
|
|
40
|
+
```typescript
|
|
41
|
+
import { LandingQueue } from 'pi-cicd';
|
|
42
|
+
|
|
43
|
+
const queue = new LandingQueue({
|
|
44
|
+
maxConcurrent: 2,
|
|
45
|
+
backoffMs: 30000,
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
await queue.enqueue(deployment);
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Test Runner
|
|
52
|
+
|
|
53
|
+
```typescript
|
|
54
|
+
import { TestRunner } from 'pi-cicd';
|
|
55
|
+
|
|
56
|
+
const runner = new TestRunner();
|
|
57
|
+
const result = await runner.run({
|
|
58
|
+
framework: 'vitest',
|
|
59
|
+
patterns: ['test/**/*.test.ts'],
|
|
60
|
+
});
|
|
61
|
+
```
|
package/docs/COMMANDS.md
ADDED
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
# Command Reference - pi-cicd
|
|
2
|
+
|
|
3
|
+
## Slash Commands
|
|
4
|
+
|
|
5
|
+
### /ci
|
|
6
|
+
Main CI/CD command.
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
/ci <subcommand> [options]
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
### /ci run
|
|
13
|
+
Run pipeline.
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
/ci run [environment] [options]
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
#### Options
|
|
20
|
+
|
|
21
|
+
| Option | Description | Default |
|
|
22
|
+
|--------|-------------|---------|
|
|
23
|
+
| `--env` | Environment | default |
|
|
24
|
+
| `--var` | Variables | - |
|
|
25
|
+
| `--headless` | CI mode | false |
|
|
26
|
+
| `--stream` | Output format | text |
|
|
27
|
+
| `--timeout` | Max runtime | 1h |
|
|
28
|
+
|
|
29
|
+
### /ci status
|
|
30
|
+
Check status.
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
/ci status [options]
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
#### Options
|
|
37
|
+
|
|
38
|
+
| Option | Description |
|
|
39
|
+
|--------|-------------|
|
|
40
|
+
| `--run-id` | Specific run |
|
|
41
|
+
| `--watch` | Live updates |
|
|
42
|
+
|
|
43
|
+
### /ci deploy
|
|
44
|
+
Deploy.
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
/ci deploy <environment> [options]
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
#### Options
|
|
51
|
+
|
|
52
|
+
| Option | Description |
|
|
53
|
+
|--------|-------------|
|
|
54
|
+
| `--confirm` | Require confirmation |
|
|
55
|
+
| `--strategy` | Deployment type |
|
|
56
|
+
| `--var` | Variables |
|
|
57
|
+
|
|
58
|
+
### /ci canary
|
|
59
|
+
Canary deployment.
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
/ci canary <action> [options]
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
#### Actions
|
|
66
|
+
|
|
67
|
+
| Action | Description |
|
|
68
|
+
|--------|-------------|
|
|
69
|
+
| `deploy` | Start canary |
|
|
70
|
+
| `promote` | Increase traffic |
|
|
71
|
+
| `rollback` | Revert canary |
|
|
72
|
+
| `status` | Check status |
|
|
73
|
+
|
|
74
|
+
#### Options
|
|
75
|
+
|
|
76
|
+
| Option | Description |
|
|
77
|
+
|--------|-------------|
|
|
78
|
+
| `--percentage` | Traffic % |
|
|
79
|
+
| `--service` | Service name |
|
|
80
|
+
|
|
81
|
+
### /ci queue
|
|
82
|
+
Landing queue.
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
/ci queue <action> [options]
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Tools
|
|
89
|
+
|
|
90
|
+
### ci_run
|
|
91
|
+
|
|
92
|
+
```javascript
|
|
93
|
+
ci_run({
|
|
94
|
+
environment: "production",
|
|
95
|
+
variables: { VERSION: "1.2.3" },
|
|
96
|
+
headless: false,
|
|
97
|
+
stream: "text"
|
|
98
|
+
})
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### ci_status
|
|
102
|
+
|
|
103
|
+
```javascript
|
|
104
|
+
ci_status({ runId: "abc123" })
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### ci_deploy
|
|
108
|
+
|
|
109
|
+
```javascript
|
|
110
|
+
ci_deploy({
|
|
111
|
+
environment: "production",
|
|
112
|
+
strategy: "canary",
|
|
113
|
+
confirm: true
|
|
114
|
+
})
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### ci_canary
|
|
118
|
+
|
|
119
|
+
```javascript
|
|
120
|
+
ci_canary({
|
|
121
|
+
action: "deploy",
|
|
122
|
+
service: "api",
|
|
123
|
+
percentage: 10
|
|
124
|
+
})
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
## Exit Codes
|
|
128
|
+
|
|
129
|
+
| Code | Name | Description |
|
|
130
|
+
|------|------|-------------|
|
|
131
|
+
| 0 | SUCCESS | Pipeline completed |
|
|
132
|
+
| 1 | ERROR | General error |
|
|
133
|
+
| 2 | TIMEOUT | Exceeded timeout |
|
|
134
|
+
| 10 | BLOCKED | Gate verification failed |
|
|
135
|
+
| 11 | CANCELLED | User cancelled |
|
|
136
|
+
| 12 | DEPLOY_FAILED | Deployment error |
|
|
137
|
+
| 13 | HEALTH_CHECK_FAILED | Health check failed |
|
|
138
|
+
| 14 | ROLLBACK | Rolled back |
|
package/docs/CONFIG.md
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# Configuration - pi-cicd
|
|
2
|
+
|
|
3
|
+
## Configuration File
|
|
4
|
+
|
|
5
|
+
Create `pi-cicd.yaml` or `pi-cicd.json`:
|
|
6
|
+
|
|
7
|
+
```yaml
|
|
8
|
+
name: my-app
|
|
9
|
+
version: 1.0
|
|
10
|
+
|
|
11
|
+
# Pipeline definition
|
|
12
|
+
pipeline:
|
|
13
|
+
stages:
|
|
14
|
+
- name: build
|
|
15
|
+
steps:
|
|
16
|
+
- run: npm install
|
|
17
|
+
- run: npm run build
|
|
18
|
+
|
|
19
|
+
- name: test
|
|
20
|
+
steps:
|
|
21
|
+
- run: npm test
|
|
22
|
+
timeout: 10m
|
|
23
|
+
|
|
24
|
+
- name: deploy
|
|
25
|
+
steps:
|
|
26
|
+
- run: ./deploy.sh
|
|
27
|
+
conditions:
|
|
28
|
+
- if: test.success
|
|
29
|
+
|
|
30
|
+
# Environments
|
|
31
|
+
environments:
|
|
32
|
+
production:
|
|
33
|
+
cluster: prod-us-east
|
|
34
|
+
namespace: production
|
|
35
|
+
replicas: 10
|
|
36
|
+
|
|
37
|
+
staging:
|
|
38
|
+
cluster: staging-us-east
|
|
39
|
+
namespace: staging
|
|
40
|
+
replicas: 3
|
|
41
|
+
|
|
42
|
+
# Canary config
|
|
43
|
+
canary:
|
|
44
|
+
initialPercentage: 10
|
|
45
|
+
incrementPercentage: 25
|
|
46
|
+
healthCheckEndpoint: /health
|
|
47
|
+
interval: 30s
|
|
48
|
+
autoPromote: true
|
|
49
|
+
|
|
50
|
+
# Landing queue
|
|
51
|
+
queue:
|
|
52
|
+
maxConcurrent: 1
|
|
53
|
+
priorityLevels:
|
|
54
|
+
- critical
|
|
55
|
+
- high
|
|
56
|
+
- normal
|
|
57
|
+
- low
|
|
58
|
+
|
|
59
|
+
# Headless mode
|
|
60
|
+
headless:
|
|
61
|
+
exitCode: true
|
|
62
|
+
streamFormat: jsonl
|
|
63
|
+
failOn:
|
|
64
|
+
- gate_failure
|
|
65
|
+
- deployment_failure
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## JSON Config
|
|
69
|
+
|
|
70
|
+
```json
|
|
71
|
+
{
|
|
72
|
+
"name": "my-app",
|
|
73
|
+
"pipeline": {
|
|
74
|
+
"stages": [...]
|
|
75
|
+
},
|
|
76
|
+
"environments": {
|
|
77
|
+
"production": {...}
|
|
78
|
+
},
|
|
79
|
+
"canary": {
|
|
80
|
+
"initialPercentage": 10
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Environment Variables
|
|
86
|
+
|
|
87
|
+
| Variable | Description | Default |
|
|
88
|
+
|----------|-------------|---------|
|
|
89
|
+
| `PI_CI_ENV` | Default environment | default |
|
|
90
|
+
| `PI_CI_TIMEOUT` | Default timeout | 1h |
|
|
91
|
+
| `PI_CI_HEADLESS` | Headless mode | false |
|
|
92
|
+
| `CI` | CI environment flag | false |
|
|
93
|
+
|
|
94
|
+
## Per-Command Options
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
# Timeout override
|
|
98
|
+
/ci run --timeout=30m
|
|
99
|
+
|
|
100
|
+
# Variables
|
|
101
|
+
/ci run --var=VERSION=1.2.3 --var=ENV=prod
|
|
102
|
+
|
|
103
|
+
# Stream format
|
|
104
|
+
/ci run --stream=jsonl
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## Secrets Management
|
|
108
|
+
|
|
109
|
+
Store in environment or secrets manager:
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
export PI_CI_SECRET_API_KEY=xxx
|
|
113
|
+
export PI_CI_SECRET_DEPLOY_TOKEN=xxx
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
Reference in pipeline:
|
|
117
|
+
|
|
118
|
+
```yaml
|
|
119
|
+
steps:
|
|
120
|
+
- run: deploy.sh
|
|
121
|
+
env:
|
|
122
|
+
API_KEY: ${SECRET:API_KEY}
|
|
123
|
+
```
|
package/docs/GUIDE.md
ADDED
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
# User Guide - pi-cicd
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
pi-cicd brings CI/CD capabilities to Pi coding agents with structured pipelines, exit codes, and deployment strategies.
|
|
6
|
+
|
|
7
|
+
## Pipeline Structure
|
|
8
|
+
|
|
9
|
+
### Define Pipeline
|
|
10
|
+
|
|
11
|
+
Create `pi-cicd.yaml`:
|
|
12
|
+
|
|
13
|
+
```yaml
|
|
14
|
+
name: my-app
|
|
15
|
+
version: 1.0
|
|
16
|
+
|
|
17
|
+
stages:
|
|
18
|
+
- name: build
|
|
19
|
+
steps:
|
|
20
|
+
- run: npm install
|
|
21
|
+
- run: npm run build
|
|
22
|
+
|
|
23
|
+
- name: test
|
|
24
|
+
steps:
|
|
25
|
+
- run: npm test
|
|
26
|
+
- run: npm run lint
|
|
27
|
+
|
|
28
|
+
- name: deploy
|
|
29
|
+
steps:
|
|
30
|
+
- run: ./deploy.sh production
|
|
31
|
+
conditions:
|
|
32
|
+
- if: stage(build).success
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Pipeline Execution
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
/ci run [--env=<env>] [--var=<key>=<value>]
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Deployment Strategies
|
|
42
|
+
|
|
43
|
+
### Canary Deployment
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
# Deploy to 10% of traffic
|
|
47
|
+
/ci canary deploy --service=api --percentage=10
|
|
48
|
+
|
|
49
|
+
# Monitor health
|
|
50
|
+
/ci canary status
|
|
51
|
+
|
|
52
|
+
# Promote to 50%
|
|
53
|
+
/ci canary promote --percentage=50
|
|
54
|
+
|
|
55
|
+
# Full rollout
|
|
56
|
+
/ci canary promote --percentage=100
|
|
57
|
+
|
|
58
|
+
# Or rollback
|
|
59
|
+
/ci canary rollback
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Blue-Green Deployment
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
/ci deploy blue-green --service=api
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Rolling Deployment
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
/ci deploy rolling --service=api --batchSize=25%
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Headless Mode
|
|
75
|
+
|
|
76
|
+
For CI environments:
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
/ci run --headless
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Output Format
|
|
83
|
+
|
|
84
|
+
```
|
|
85
|
+
## STAGE: build
|
|
86
|
+
action=start stage=build
|
|
87
|
+
action=complete stage=build duration=23s
|
|
88
|
+
## STAGE: test
|
|
89
|
+
action=start stage=test
|
|
90
|
+
action=complete stage=test duration=45s passed=123 failed=0
|
|
91
|
+
## RESULT
|
|
92
|
+
action=complete status=success duration=1m 8s
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Event Streaming
|
|
96
|
+
|
|
97
|
+
JSONL output for tooling:
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
/ci run --stream=jsonl
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Output:
|
|
104
|
+
```jsonl
|
|
105
|
+
{"event":"stage_start","stage":"build"}
|
|
106
|
+
{"event":"step_start","stage":"build","step":"npm install"}
|
|
107
|
+
{"event":"step_complete","stage":"build","step":"npm install","duration":23}
|
|
108
|
+
{"event":"stage_complete","stage":"build","duration":23}
|
|
109
|
+
{"event":"pipeline_complete","status":"success","duration":68}
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## Landing Queue
|
|
113
|
+
|
|
114
|
+
Queue deployments with safety:
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
# Add to queue
|
|
118
|
+
/ci queue add production --priority=high
|
|
119
|
+
|
|
120
|
+
# View queue
|
|
121
|
+
/ci queue list
|
|
122
|
+
|
|
123
|
+
# Process queue
|
|
124
|
+
/ci queue process
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Features:
|
|
128
|
+
- Priority ordering
|
|
129
|
+
- Automatic rollback on failure
|
|
130
|
+
- Health check gates
|
|
131
|
+
- Concurrency limits
|
|
132
|
+
|
|
133
|
+
## Verification Gates
|
|
134
|
+
|
|
135
|
+
```yaml
|
|
136
|
+
gates:
|
|
137
|
+
- name: tests-pass
|
|
138
|
+
check: test-results.success
|
|
139
|
+
|
|
140
|
+
- name: security-scan
|
|
141
|
+
check: security-report.critical == 0
|
|
142
|
+
|
|
143
|
+
- name: manual-approval
|
|
144
|
+
check: approval.authorized
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
## Environment Configuration
|
|
148
|
+
|
|
149
|
+
### Environments
|
|
150
|
+
|
|
151
|
+
```yaml
|
|
152
|
+
environments:
|
|
153
|
+
production:
|
|
154
|
+
cluster: prod-us-east
|
|
155
|
+
replicas: 10
|
|
156
|
+
healthCheck: /health
|
|
157
|
+
|
|
158
|
+
staging:
|
|
159
|
+
cluster: staging-us-east
|
|
160
|
+
replicas: 3
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
### Variables
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
# Set variables
|
|
167
|
+
/ci var set DATABASE_URL=postgres://...
|
|
168
|
+
|
|
169
|
+
# Use in pipeline
|
|
170
|
+
/ci run --var=DATABASE_URL=...
|
|
171
|
+
```
|
package/docs/PATTERNS.md
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Patterns Applied to pi-cicd
|
|
2
|
+
|
|
3
|
+
This document lists all research patterns applied to this extension during development.
|
|
4
|
+
|
|
5
|
+
## Research Sources
|
|
6
|
+
|
|
7
|
+
- gstack (persistent daemon, design system, boil the lake)
|
|
8
|
+
- gsd-2 (ADR, multi-model, branchless worktree)
|
|
9
|
+
- pi-crew (hooks, metrics, correlation, UI patterns)
|
|
10
|
+
- pi-hermes-memory (memory categories, learn command)
|
|
11
|
+
- beads (hash IDs, graph memory, memory decay)
|
|
12
|
+
- context-mode (BM25 search, context sandbox)
|
|
13
|
+
- everything-claude-code (quality gates, agent shield)
|
|
14
|
+
- vetc-dev-kit (SDLC router, systematic debugging)
|
|
15
|
+
- caveman (token compression)
|
|
16
|
+
- And more...
|
|
17
|
+
|
|
18
|
+
## Patterns Implemented
|
|
19
|
+
|
|
20
|
+
### Core Patterns
|
|
21
|
+
|
|
22
|
+
| Pattern | Source | Description |
|
|
23
|
+
|---------|--------|-------------|
|
|
24
|
+
| DeploymentWorkflow | pi-crew | Declarative deployment with stages |
|
|
25
|
+
| LandingQueue | gstack | Managed deployment queue with backoff |
|
|
26
|
+
| CanaryDeployment | custom | Gradual rollout with traffic shifting |
|
|
27
|
+
| TestRunner | vetc-dev-kit | Automated test execution |
|
|
28
|
+
| PRCreator | custom | Automated pull request generation |
|
|
29
|
+
|
|
30
|
+
## Implementation Notes
|
|
31
|
+
|
|
32
|
+
All patterns were researched from 52 source repositories and applied following the pi-crew delegation patterns skill.
|
|
33
|
+
|
|
34
|
+
### Research Process
|
|
35
|
+
|
|
36
|
+
1. Read source repositories (bare git repos in `source/`)
|
|
37
|
+
2. Extract patterns applicable to this extension
|
|
38
|
+
3. Implement patterns with tests
|
|
39
|
+
4. Verify with 100% test coverage
|
|
40
|
+
|
|
41
|
+
### Test Coverage
|
|
42
|
+
|
|
43
|
+
All new patterns include comprehensive unit tests to ensure correctness.
|
|
44
|
+
|
|
45
|
+
## References
|
|
46
|
+
|
|
47
|
+
- [Research Index](../research-findings/00-index.md)
|
|
48
|
+
- [API Reference](API.md)
|
|
49
|
+
- [Quick Start](QUICKSTART.md)
|