pi-cicd 1.0.0 → 1.0.2

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 ADDED
@@ -0,0 +1,15 @@
1
+ # Changelog
2
+
3
+ ## 1.0.2 (2026-05-13)
4
+
5
+ ### Fixed
6
+ - Add proper peerDependencies for @earendil-works/pi-coding-agent
7
+ - Add tsconfig.json for TypeScript support
8
+
9
+ ## 1.0.1 (2026-05-13)
10
+
11
+ ### Added
12
+ - Comprehensive documentation
13
+
14
+ ## 1.0.0 (Earlier)
15
+ - Initial release
package/README.md ADDED
@@ -0,0 +1,56 @@
1
+ # pi-cicd
2
+
3
+ CI/CD workflow automation extension for Pi coding agents.
4
+
5
+ ## Features
6
+
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
14
+
15
+ ## Install
16
+
17
+ ```bash
18
+ pi install npm:pi-cicd
19
+ ```
20
+
21
+ ## Quick Start
22
+
23
+ ### Run Pipeline
24
+ ```bash
25
+ /ci run production
26
+ ```
27
+
28
+ ### Check Status
29
+ ```bash
30
+ /ci status
31
+ ```
32
+
33
+ ### Deploy Canary
34
+ ```bash
35
+ /ci canary deploy --percentage 10
36
+ ```
37
+
38
+ ## Commands
39
+
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 |
47
+
48
+ ## Verify
49
+
50
+ ```bash
51
+ pi list
52
+ ```
53
+
54
+ ## License
55
+
56
+ MIT
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
+ ```
@@ -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
+ ```
@@ -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)
@@ -0,0 +1,99 @@
1
+ # Quick Start - pi-cicd
2
+
3
+ ## Installation
4
+
5
+ ```bash
6
+ pi install npm:pi-cicd
7
+ ```
8
+
9
+ ## Basic Usage
10
+
11
+ ### 1. Run Pipeline
12
+
13
+ ```bash
14
+ # Run default pipeline
15
+ /ci run
16
+
17
+ # Run specific environment
18
+ /ci run production
19
+
20
+ # Run with variables
21
+ /ci run staging --var=VERSION=1.2.3
22
+ ```
23
+
24
+ ### 2. Check Status
25
+
26
+ ```bash
27
+ # Check current run status
28
+ /ci status
29
+
30
+ # Check specific run
31
+ /ci status --run-id=abc123
32
+ ```
33
+
34
+ ### 3. Deploy
35
+
36
+ ```bash
37
+ # Deploy to environment
38
+ /ci deploy production
39
+
40
+ # Deploy with confirmation
41
+ /ci deploy staging --confirm
42
+ ```
43
+
44
+ ### 4. Canary Deployment
45
+
46
+ ```bash
47
+ # Start canary (10% traffic)
48
+ /ci canary deploy --percentage 10
49
+
50
+ # Increase canary
51
+ /ci canary promote --percentage 25
52
+
53
+ # Rollback canary
54
+ /ci canary rollback
55
+ ```
56
+
57
+ ## Examples
58
+
59
+ ### Example: Production Deploy
60
+
61
+ ```
62
+ /ci run production
63
+
64
+ Output:
65
+ ## CI/CD Pipeline: production
66
+
67
+ ### Stage: build
68
+ ✅ npm install (23s)
69
+ ✅ npm run build (45s)
70
+
71
+ ### Stage: test
72
+ ✅ Unit tests (89 tests, 12s)
73
+ ✅ Integration tests (34 tests, 28s)
74
+
75
+ ### Stage: deploy
76
+ 🚀 Deploying to production...
77
+
78
+ ✅ Pipeline complete (2m 34s)
79
+ ```
80
+
81
+ ### Example: Headless CI
82
+
83
+ ```bash
84
+ # In GitHub Actions
85
+ - name: Run Pi CI
86
+ run: |
87
+ pi ci run --headless --exit-code
88
+ ```
89
+
90
+ ## Exit Codes
91
+
92
+ | Code | Meaning |
93
+ |------|---------|
94
+ | 0 | Success |
95
+ | 1 | General error |
96
+ | 2 | Timeout |
97
+ | 10 | Blocked (verification failed) |
98
+ | 11 | Cancelled |
99
+ | 12 | Deployment failed |