prizmkit 1.1.39 → 1.1.41
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/bundled/VERSION.json +3 -3
- package/bundled/dev-pipeline/SCHEMA_ANALYSIS.md +1 -1
- package/bundled/dev-pipeline/run-bugfix.sh +74 -0
- package/bundled/dev-pipeline/run-feature.sh +74 -0
- package/bundled/dev-pipeline/run-refactor.sh +74 -0
- package/bundled/dev-pipeline/scripts/generate-bootstrap-prompt.py +0 -6
- package/bundled/dev-pipeline/scripts/generate-bugfix-prompt.py +118 -1
- package/bundled/dev-pipeline/scripts/generate-refactor-prompt.py +123 -8
- package/bundled/dev-pipeline/templates/bootstrap-tier1.md +0 -23
- package/bundled/dev-pipeline/templates/bootstrap-tier2.md +0 -23
- package/bundled/dev-pipeline/templates/bootstrap-tier3.md +0 -23
- package/bundled/dev-pipeline/templates/bug-fix-list-schema.json +22 -3
- package/bundled/dev-pipeline/templates/bugfix-bootstrap-prompt.md +56 -0
- package/bundled/dev-pipeline/templates/refactor-bootstrap-prompt.md +64 -4
- package/bundled/dev-pipeline/templates/refactor-list-schema.json +22 -3
- package/bundled/dev-pipeline/tests/test-deploy-safety.sh +223 -0
- package/bundled/skills/_metadata.json +3 -3
- package/bundled/skills/app-planner/SKILL.md +0 -3
- package/bundled/skills/bugfix-pipeline-launcher/SKILL.md +34 -6
- package/bundled/skills/feature-pipeline-launcher/SKILL.md +42 -18
- package/bundled/skills/prizmkit-committer/SKILL.md +0 -1
- package/bundled/skills/prizmkit-deploy/SKILL.md +491 -209
- package/bundled/skills/prizmkit-deploy/references/cloud-platform-deploy.md +93 -0
- package/bundled/skills/prizmkit-deploy/references/deploy-config-schema.md +147 -0
- package/bundled/skills/prizmkit-deploy/references/deploy-history-schema.md +62 -0
- package/bundled/skills/prizmkit-deploy/references/docker-deploy.md +31 -0
- package/bundled/skills/prizmkit-deploy/references/nginx-blue-green.md +59 -0
- package/bundled/skills/prizmkit-init/SKILL.md +0 -2
- package/bundled/skills/prizmkit-plan/SKILL.md +0 -3
- package/bundled/skills/recovery-workflow/SKILL.md +96 -7
- package/bundled/skills/refactor-pipeline-launcher/SKILL.md +40 -9
- package/package.json +1 -1
- package/bundled/dev-pipeline/templates/sections/phase-deploy-verification.md +0 -31
- package/bundled/skills/prizmkit-deploy/assets/deploy-template.md +0 -187
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# Cloud Platform Deployment Path
|
|
2
|
+
|
|
3
|
+
Guided deployment for Vercel, Netlify, Fly.io, and similar cloud platforms. Full automation isn't available — these platforms require browser-based authentication — but the skill provides structured CLI assistance.
|
|
4
|
+
|
|
5
|
+
## Detect and Validate
|
|
6
|
+
|
|
7
|
+
1. Check if the platform CLI is installed: `vercel --version`, `netlify --version`, `fly version`.
|
|
8
|
+
2. If missing, guide the user to install: `npm install -g vercel` or link to docs.
|
|
9
|
+
3. Check authentication: `vercel whoami`, `netlify status`. If not logged in, guide the user through `vercel login`.
|
|
10
|
+
4. Read the platform config file (`vercel.json`, `netlify.toml`, `fly.toml`) to understand existing settings.
|
|
11
|
+
|
|
12
|
+
## Generate Configuration
|
|
13
|
+
|
|
14
|
+
1. If no platform config file exists, generate one based on project detection:
|
|
15
|
+
- **Next.js on Vercel**: minimal config — Vercel auto-detects Next.js. Generate `vercel.json` only if custom rewrites/redirects are needed.
|
|
16
|
+
- **Static site on Netlify**: generate `netlify.toml` with build command and publish directory.
|
|
17
|
+
- **Any on Fly.io**: generate `fly.toml` with app name, builder, and HTTP service config.
|
|
18
|
+
2. Set environment variables via the platform CLI: `vercel env add`, `netlify env:set`.
|
|
19
|
+
3. Document all env vars needed (from Discovery Step 1 scan).
|
|
20
|
+
|
|
21
|
+
## Deploy and Verify
|
|
22
|
+
|
|
23
|
+
1. Run the platform deploy command: `vercel deploy --prod`, `netlify deploy --prod`, `fly deploy`.
|
|
24
|
+
2. If the command requires interactive input, run it and show output to the user.
|
|
25
|
+
3. After deploy, run health checks against the production URL.
|
|
26
|
+
4. Write a deploy-history event recording: platform, project name, deploy URL, commit SHA, timestamp.
|
|
27
|
+
|
|
28
|
+
## Operations
|
|
29
|
+
|
|
30
|
+
| Command | Vercel | Netlify | Fly.io |
|
|
31
|
+
|---------|--------|---------|--------|
|
|
32
|
+
| status | `vercel list` | `netlify status` | `fly status` |
|
|
33
|
+
| logs | `vercel logs` | `netlify logs` | `fly logs` |
|
|
34
|
+
| rollback | `vercel rollback` | `netlify rollback` | `fly rollback` |
|
|
35
|
+
| env | `vercel env ls` | `netlify env:list` | `fly secrets list` |
|
|
36
|
+
|
|
37
|
+
Platform rollback is instant — no release-based rollback needed.
|
|
38
|
+
|
|
39
|
+
## Platform-Specific Patterns
|
|
40
|
+
|
|
41
|
+
### Vercel
|
|
42
|
+
|
|
43
|
+
Vercel auto-detects Next.js projects — no config file required for basic deployments. Generate `vercel.json` only for custom rewrites, redirects, or headers.
|
|
44
|
+
|
|
45
|
+
Key behaviors:
|
|
46
|
+
- Next.js: framework auto-detected, build command and output directory inferred automatically
|
|
47
|
+
- Static sites: set build command and output directory via `vercel.json` or CLI
|
|
48
|
+
- Env vars: `vercel env add <KEY>` (supports `production`, `preview`, `development` environments)
|
|
49
|
+
- Deploy preview: every branch gets a preview URL automatically (if connected via GitHub)
|
|
50
|
+
|
|
51
|
+
### Netlify
|
|
52
|
+
|
|
53
|
+
Netlify requires explicit build and publish configuration. Use `netlify.toml`:
|
|
54
|
+
|
|
55
|
+
```toml
|
|
56
|
+
[build]
|
|
57
|
+
command = "npm run build"
|
|
58
|
+
publish = "dist"
|
|
59
|
+
|
|
60
|
+
[[redirects]]
|
|
61
|
+
from = "/*"
|
|
62
|
+
to = "/index.html"
|
|
63
|
+
status = 200
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Key behaviors:
|
|
67
|
+
- SPA redirects: the catch-all redirect above is essential for client-side routing
|
|
68
|
+
- Env vars: `netlify env:set <KEY> <VALUE>` (per-context: `production`, `deploy-preview`, `branch-deploy`)
|
|
69
|
+
- Branch deploys: every branch gets a deploy-preview URL automatically (if connected via GitHub)
|
|
70
|
+
|
|
71
|
+
### Fly.io
|
|
72
|
+
|
|
73
|
+
Fly.io requires a `fly.toml` with app name, builder, and HTTP service config:
|
|
74
|
+
|
|
75
|
+
```toml
|
|
76
|
+
app = "<app-name>"
|
|
77
|
+
primary_region = "lhr"
|
|
78
|
+
|
|
79
|
+
[build]
|
|
80
|
+
builder = "dockerfile"
|
|
81
|
+
|
|
82
|
+
[http_service]
|
|
83
|
+
internal_port = 3000
|
|
84
|
+
force_https = true
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Key behaviors:
|
|
88
|
+
- Builder: `dockerfile` (default, uses Dockerfile) or `static` (static site hosting)
|
|
89
|
+
- Secrets: `fly secrets set <KEY>=<VALUE>` for runtime environment variables
|
|
90
|
+
- Scale: `fly scale count <N>` to adjust VM instances
|
|
91
|
+
- Volumes: for persistent data, configure `[mounts]` in fly.toml
|
|
92
|
+
|
|
93
|
+
**Note**: These are minimum-viable platform references; browser-based authentication remains a user-action step. Enriched platform coverage is planned for future iterations.
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
# deploy.config.json Schema
|
|
2
|
+
|
|
3
|
+
This file is the machine-readable deployment configuration. Always read it before executing any deploy operation.
|
|
4
|
+
|
|
5
|
+
## Top-Level Structure
|
|
6
|
+
|
|
7
|
+
```json
|
|
8
|
+
{
|
|
9
|
+
"version": 1,
|
|
10
|
+
"project": "project-name",
|
|
11
|
+
"deploymentMode": "ssh",
|
|
12
|
+
"defaults": { ... },
|
|
13
|
+
"environments": { ... },
|
|
14
|
+
"servers": [ ... ],
|
|
15
|
+
"repository": { ... },
|
|
16
|
+
"apps": [ ... ],
|
|
17
|
+
"nginx": { ... },
|
|
18
|
+
"env": { ... }
|
|
19
|
+
}
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## defaults
|
|
23
|
+
|
|
24
|
+
```json
|
|
25
|
+
{
|
|
26
|
+
"releaseRetention": 5,
|
|
27
|
+
"credentialMode": "ai-assisted|user-managed",
|
|
28
|
+
"secretStorage": "ask-every-time|encrypted-local|plaintext-local|user-managed-on-server-only",
|
|
29
|
+
"rollbackOnFailure": true,
|
|
30
|
+
"headlessDefaultEnvironment": "test"
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## environments
|
|
35
|
+
|
|
36
|
+
Keyed by environment name. Each entry:
|
|
37
|
+
```json
|
|
38
|
+
{
|
|
39
|
+
"dev": {
|
|
40
|
+
"server": "server-id",
|
|
41
|
+
"allowHeadless": true,
|
|
42
|
+
"confirmBeforeDeploy": false
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## servers
|
|
48
|
+
|
|
49
|
+
Array of server objects:
|
|
50
|
+
```json
|
|
51
|
+
{
|
|
52
|
+
"id": "prod-1",
|
|
53
|
+
"host": "IP or hostname",
|
|
54
|
+
"port": 22,
|
|
55
|
+
"bootstrapUser": "root",
|
|
56
|
+
"runtimeUser": "deploy",
|
|
57
|
+
"roles": ["web"],
|
|
58
|
+
"validated": {
|
|
59
|
+
"ssh": true|false,
|
|
60
|
+
"bootstrap": true|false,
|
|
61
|
+
"runtimeUser": true|false,
|
|
62
|
+
"tools": {
|
|
63
|
+
"node": "version",
|
|
64
|
+
"npm": "version",
|
|
65
|
+
"pm2": "version",
|
|
66
|
+
"nginx": "version",
|
|
67
|
+
"git": "version"
|
|
68
|
+
},
|
|
69
|
+
"directories": true|false,
|
|
70
|
+
"deployKey": true|false
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## repository
|
|
76
|
+
|
|
77
|
+
```json
|
|
78
|
+
{
|
|
79
|
+
"url": "git@github.com:owner/repo.git",
|
|
80
|
+
"branch": "master",
|
|
81
|
+
"auth": "deploy-key|ssh-agent|token",
|
|
82
|
+
"validated": {
|
|
83
|
+
"clone": true|false
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## apps
|
|
89
|
+
|
|
90
|
+
Array of app objects:
|
|
91
|
+
```json
|
|
92
|
+
{
|
|
93
|
+
"id": "web",
|
|
94
|
+
"path": ".",
|
|
95
|
+
"runtime": "pm2",
|
|
96
|
+
"packageManager": "npm",
|
|
97
|
+
"installCommand": "npm ci",
|
|
98
|
+
"buildCommand": "npm run build",
|
|
99
|
+
"startCommand": "npm run start",
|
|
100
|
+
"ports": {
|
|
101
|
+
"blue": 3101,
|
|
102
|
+
"green": 3102
|
|
103
|
+
},
|
|
104
|
+
"healthChecks": [
|
|
105
|
+
{ "name": "home", "url": "/", "expectedStatus": [200] },
|
|
106
|
+
{ "name": "login", "url": "/login", "expectedStatus": [200, 302] }
|
|
107
|
+
],
|
|
108
|
+
"activeColor": "blue",
|
|
109
|
+
"pm2Process": "prizm-ideas-blue"
|
|
110
|
+
}
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
## nginx
|
|
114
|
+
|
|
115
|
+
```json
|
|
116
|
+
{
|
|
117
|
+
"enabled": true,
|
|
118
|
+
"managed": true,
|
|
119
|
+
"firstChangeRequiresConfirmation": true,
|
|
120
|
+
"domain": null,
|
|
121
|
+
"ipFallback": true,
|
|
122
|
+
"currentUpstream": "127.0.0.1:3101"
|
|
123
|
+
}
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## env
|
|
127
|
+
|
|
128
|
+
```json
|
|
129
|
+
{
|
|
130
|
+
"strategy": "ai-assisted|user-managed",
|
|
131
|
+
"required": ["VAR_NAME"],
|
|
132
|
+
"secrets": ["SECRET_NAME"],
|
|
133
|
+
"validated": {
|
|
134
|
+
"allRequiredPresent": true|false
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
## Validation Rules
|
|
140
|
+
|
|
141
|
+
- `version` must be present (always 1 for first version)
|
|
142
|
+
- `servers` must have at least one entry with host and bootstrapUser
|
|
143
|
+
- `repository.url` must be present
|
|
144
|
+
- `apps` must have at least one entry
|
|
145
|
+
- `apps[*].ports.blue` and `apps[*].ports.green` must differ
|
|
146
|
+
- `apps[*].healthChecks` should have at least one entry
|
|
147
|
+
- Environment referenced in `environments` must have a matching server in `servers`
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# Deploy History Record Schema
|
|
2
|
+
|
|
3
|
+
Each event in `.prizmkit/deploy/deploy-history/<id>.json` follows this schema:
|
|
4
|
+
|
|
5
|
+
```json
|
|
6
|
+
{
|
|
7
|
+
"eventId": "<releaseId or event id>",
|
|
8
|
+
"eventType": "deploy|rollback|status|validation|failed-deploy|user-aborted|takeover|adapter-gap",
|
|
9
|
+
"timestamp": "<ISO 8601>",
|
|
10
|
+
"serverId": "<server id from deploy.config.json>",
|
|
11
|
+
"appIds": ["<app ids involved>"],
|
|
12
|
+
"branch": "<git branch>",
|
|
13
|
+
"commitSha": "<full or short commit SHA>",
|
|
14
|
+
"releasePath": "<full server path, e.g. /var/www/prizm-ideas/releases/20260430-22783a3>",
|
|
15
|
+
"previousReleasePath": "<previous release path or null for first deploy>",
|
|
16
|
+
"targetPort": 3101,
|
|
17
|
+
"targetColor": "blue|green",
|
|
18
|
+
"previousPort": 3102,
|
|
19
|
+
"phases": {
|
|
20
|
+
"preflight": "success|failed|skipped",
|
|
21
|
+
"prepareRelease": "success|failed|skipped",
|
|
22
|
+
"fetchCode": "success|failed|skipped",
|
|
23
|
+
"installDependencies": "success|failed|skipped",
|
|
24
|
+
"build": "success|failed|skipped",
|
|
25
|
+
"stageRuntime": "success|failed|skipped",
|
|
26
|
+
"healthCheck": "success|failed|skipped",
|
|
27
|
+
"switchTraffic": "success|failed|skipped",
|
|
28
|
+
"verifyLive": "success|failed|skipped",
|
|
29
|
+
"cleanupOldReleases": "success|failed|skipped",
|
|
30
|
+
"recordHistory": "success|failed|skipped"
|
|
31
|
+
},
|
|
32
|
+
"healthCheckResults": [
|
|
33
|
+
{
|
|
34
|
+
"name": "home",
|
|
35
|
+
"url": "/",
|
|
36
|
+
"expected": [200],
|
|
37
|
+
"actual": 200,
|
|
38
|
+
"pass": true
|
|
39
|
+
}
|
|
40
|
+
],
|
|
41
|
+
"rollbackResult": null,
|
|
42
|
+
"logPath": "<server log path>",
|
|
43
|
+
"operatorMode": "ai-assisted|user-managed",
|
|
44
|
+
"notes": "<human-readable summary of what happened>"
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Field Notes
|
|
49
|
+
|
|
50
|
+
- `eventId`: Use `<releaseId>` for deploy events, `<releaseId>-rollback` for rollbacks.
|
|
51
|
+
- `eventType`: Use `failed-deploy` when deploy fails before traffic switch, `deploy` when it succeeds. Use `adapter-gap` when no adapter exists for the detected project type or target — include `detectedProjectType`, `missingAdapter`, and `fallbackOutput` in the record.
|
|
52
|
+
- `phases`: Only include phases that were attempted. Skip phases that were never reached.
|
|
53
|
+
- `healthCheckResults`: Include all configured health checks. `pass` = actual status matches one of the expected status codes.
|
|
54
|
+
- `rollbackResult`: `null` for non-rollback events, `"success"` or `"failed"` for rollbacks.
|
|
55
|
+
- `notes`: Keep concise but include any anomalies or manual interventions.
|
|
56
|
+
|
|
57
|
+
## What NOT to record
|
|
58
|
+
|
|
59
|
+
- Raw secret values or API keys — never.
|
|
60
|
+
- Unsalted hashes of secret values — inferable with rainbow tables.
|
|
61
|
+
- Passphrases or decryption keys — even if hashed.
|
|
62
|
+
- Full environment variable values — presence metadata only (e.g., `{"SUPABASE_KEY": {"present": true}}`).
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Docker Deployment Path
|
|
2
|
+
|
|
3
|
+
Guided deployment when a `Dockerfile` or `docker-compose.yml` is detected, or the user requests Docker deployment.
|
|
4
|
+
|
|
5
|
+
## Detect and Configure
|
|
6
|
+
|
|
7
|
+
1. Read `Dockerfile` — extract base image, exposed ports, build steps.
|
|
8
|
+
2. Read `docker-compose.yml` if present — extract services, volumes, environment, ports.
|
|
9
|
+
3. Identify image name: from compose project name or repo directory name.
|
|
10
|
+
4. Identify port mappings: from `EXPOSE`, `ports:` in compose, or ask the user.
|
|
11
|
+
|
|
12
|
+
## Build and Deploy
|
|
13
|
+
|
|
14
|
+
1. Build: `docker build -t <project>:<releaseId> .` or `docker compose build`.
|
|
15
|
+
2. Check for running containers with the same name: `docker ps -a --filter name=<project>`.
|
|
16
|
+
3. If a previous container exists:
|
|
17
|
+
- For blue/green on a server with Nginx: start new container on different port, health check, switch upstream.
|
|
18
|
+
- For single-container setup: stop old, start new — warn about brief downtime.
|
|
19
|
+
4. Start: `docker run -d --name <project>-<releaseId> -p <port>:<port> <project>:<releaseId>` or `docker compose up -d`.
|
|
20
|
+
5. Health check the new container.
|
|
21
|
+
6. Write deploy-history event.
|
|
22
|
+
|
|
23
|
+
## Operations
|
|
24
|
+
|
|
25
|
+
| Command | Docker CLI |
|
|
26
|
+
|---------|-----------|
|
|
27
|
+
| status | `docker ps --filter name=<project>` |
|
|
28
|
+
| logs | `docker logs <container-name> --tail 100` |
|
|
29
|
+
| restart | `docker restart <container-name>` |
|
|
30
|
+
| rollback | `docker stop <new-container> && docker start <old-container>` |
|
|
31
|
+
| cleanup | `docker image prune -a --filter "label=project=<project>"` |
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# Nginx Blue/Green Configuration Template
|
|
2
|
+
|
|
3
|
+
## Server Block Template
|
|
4
|
+
|
|
5
|
+
```nginx
|
|
6
|
+
# PrizmKit Managed: <project> — DO NOT EDIT MANUALLY
|
|
7
|
+
upstream <project>_backend {
|
|
8
|
+
server 127.0.0.1:<activePort>;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
server {
|
|
12
|
+
listen 80 default_server;
|
|
13
|
+
server_name _;
|
|
14
|
+
|
|
15
|
+
# PrizmKit managed marker: <project>
|
|
16
|
+
location / {
|
|
17
|
+
proxy_pass http://<project>_backend;
|
|
18
|
+
proxy_http_version 1.1;
|
|
19
|
+
proxy_set_header Host $host;
|
|
20
|
+
proxy_set_header X-Real-IP $remote_addr;
|
|
21
|
+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
22
|
+
proxy_set_header X-Forwarded-Proto $scheme;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Traffic Switch Procedure
|
|
28
|
+
|
|
29
|
+
When switching from one color to another:
|
|
30
|
+
|
|
31
|
+
1. Update the `upstream` block: change `server 127.0.0.1:<oldPort>` to `server 127.0.0.1:<newPort>`
|
|
32
|
+
2. Run `nginx -t` to validate syntax
|
|
33
|
+
3. If syntax check passes: `systemctl reload nginx`
|
|
34
|
+
4. If syntax check fails: DO NOT reload. Abort the switch. Report the error.
|
|
35
|
+
|
|
36
|
+
## Managed Marker
|
|
37
|
+
|
|
38
|
+
All PrizmKit-generated Nginx config must contain:
|
|
39
|
+
```
|
|
40
|
+
# PrizmKit Managed: <project> — DO NOT EDIT MANUALLY
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Before modifying any server block that lacks this marker, ask for user confirmation.
|
|
44
|
+
|
|
45
|
+
## First-Time Setup
|
|
46
|
+
|
|
47
|
+
- Disable default nginx site: `rm -f /etc/nginx/sites-enabled/default`
|
|
48
|
+
- Create new config: `/etc/nginx/sites-available/<project>`
|
|
49
|
+
- Symlink: `ln -sf /etc/nginx/sites-available/<project> /etc/nginx/sites-enabled/<project>`
|
|
50
|
+
- Test: `nginx -t`
|
|
51
|
+
- Reload: `systemctl reload nginx`
|
|
52
|
+
|
|
53
|
+
## Rediscovery of Active Port
|
|
54
|
+
|
|
55
|
+
If `deploy-metadata.json` is missing, rediscover the active upstream port from Nginx config:
|
|
56
|
+
```
|
|
57
|
+
grep "server 127.0.0.1:" /etc/nginx/sites-available/<project>
|
|
58
|
+
```
|
|
59
|
+
Then match the port against configured blue/green ports to determine active color.
|
|
@@ -138,7 +138,6 @@ Detect database and deployment signals, then ask 1-2 brief questions. This phase
|
|
|
138
138
|
- **Target**: [platform name or "undecided"]
|
|
139
139
|
```
|
|
140
140
|
→ This is intentionally minimal (Quick Scan). Full conventions and deployment details will be added by app-planner or prizmkit-deploy later.
|
|
141
|
-
- Create `.prizmkit/deploy.md` skeleton from `prizmkit-deploy` template if it does not exist, pre-filling known sections (Prerequisites, basic deployment method)
|
|
142
141
|
- If user selects "Skip — decide later" for BOTH topics: write deferred marker instead:
|
|
143
142
|
```markdown
|
|
144
143
|
### Infrastructure
|
|
@@ -265,7 +264,6 @@ Infrastructure Quick Scan:
|
|
|
265
264
|
Database: PostgreSQL (Prisma) — detected from dependencies
|
|
266
265
|
Deployment: Vercel — detected from vercel.json
|
|
267
266
|
→ Written to CLAUDE.md ### Infrastructure
|
|
268
|
-
→ Created .prizmkit/deploy.md skeleton
|
|
269
267
|
|
|
270
268
|
Modules discovered:
|
|
271
269
|
src/routes/ → .prizm-docs/routes.prizm (12 files)
|
|
@@ -68,9 +68,6 @@ A universal spec + plan generator. Takes a natural-language description of ANY d
|
|
|
68
68
|
- Behavior preservation strategy (if the task modifies existing behavior — include what must remain unchanged and how to verify)
|
|
69
69
|
5. Cross-check: every goal in spec.md maps to plan components — unmapped goals = coverage gaps
|
|
70
70
|
6. Check alignment with `.prizm-docs/root.prizm` RULES section
|
|
71
|
-
7. **Deployment strategy check** (skip if no deployment impact):
|
|
72
|
-
- Read `.prizmkit/config.json` `deploy_strategy` field
|
|
73
|
-
- No strategy and new infra needed → ask user, write to config.json
|
|
74
71
|
|
|
75
72
|
### Phase 2: Task Generation (plan.md → Tasks section)
|
|
76
73
|
|
|
@@ -65,9 +65,13 @@ recovery-workflow
|
|
|
65
65
|
│ ├── Based on artifact presence → infer current phase
|
|
66
66
|
│ └── No match → reject and guide user
|
|
67
67
|
│
|
|
68
|
-
├── Phase 1:
|
|
69
|
-
│ ├──
|
|
68
|
+
├── Phase 1: Diagnose + report + user choice
|
|
69
|
+
│ ├── Check branch and working tree state
|
|
70
|
+
│ ├── Scan all pipelines for failed/in-progress tasks
|
|
71
|
+
│ ├── Find residual dev branches from failed tasks
|
|
72
|
+
│ ├── Display diagnosis + detection results
|
|
70
73
|
│ ├── If code changes exist → run test suite
|
|
74
|
+
│ ├── If multiple failed tasks → ask user which to recover
|
|
71
75
|
│ └── User chooses: run-recovery.sh (recommended) | interactive | start fresh
|
|
72
76
|
│
|
|
73
77
|
└── Phase 2: Execute remaining steps
|
|
@@ -119,9 +123,73 @@ To start a new workflow:
|
|
|
119
123
|
|
|
120
124
|
---
|
|
121
125
|
|
|
122
|
-
## Phase 1: Report + User Confirmation
|
|
123
|
-
|
|
124
|
-
**Goal**:
|
|
126
|
+
## Phase 1: Diagnose + Report + User Confirmation
|
|
127
|
+
|
|
128
|
+
**Goal**: Assess workspace health, identify failed tasks across all pipelines, and present recovery options.
|
|
129
|
+
|
|
130
|
+
### 1.0 Workspace & Failure Diagnosis
|
|
131
|
+
|
|
132
|
+
Before showing the recovery report, run a comprehensive diagnosis:
|
|
133
|
+
|
|
134
|
+
1. **Check current branch and working tree**:
|
|
135
|
+
```bash
|
|
136
|
+
git branch --show-current
|
|
137
|
+
git status --porcelain | head -10
|
|
138
|
+
```
|
|
139
|
+
Report: which branch is active, whether there are uncommitted changes.
|
|
140
|
+
|
|
141
|
+
2. **Scan all pipelines for failed/in-progress tasks**:
|
|
142
|
+
```bash
|
|
143
|
+
# Feature pipeline
|
|
144
|
+
python3 dev-pipeline/scripts/update-feature-status.py \
|
|
145
|
+
--feature-list .prizmkit/plans/feature-list.json \
|
|
146
|
+
--state-dir .prizmkit/state/features \
|
|
147
|
+
--action status 2>/dev/null
|
|
148
|
+
|
|
149
|
+
# Bugfix pipeline
|
|
150
|
+
python3 dev-pipeline/scripts/update-bug-status.py \
|
|
151
|
+
--bug-list .prizmkit/plans/bug-fix-list.json \
|
|
152
|
+
--state-dir .prizmkit/state/bugfix \
|
|
153
|
+
--action status 2>/dev/null
|
|
154
|
+
|
|
155
|
+
# Refactor pipeline
|
|
156
|
+
python3 dev-pipeline/scripts/update-refactor-status.py \
|
|
157
|
+
--refactor-list .prizmkit/plans/refactor-list.json \
|
|
158
|
+
--state-dir .prizmkit/state/refactor \
|
|
159
|
+
--action status 2>/dev/null
|
|
160
|
+
```
|
|
161
|
+
For each pipeline that has state, extract: total tasks, completed, failed, in-progress, pending.
|
|
162
|
+
|
|
163
|
+
3. **Find residual dev branches** from failed/interrupted tasks:
|
|
164
|
+
```bash
|
|
165
|
+
git branch --list 'dev/*' 'feat/*' 'fix/*' 'bugfix/*' 'refactor/*'
|
|
166
|
+
```
|
|
167
|
+
Cross-reference with failed task IDs to identify which branches belong to which failed tasks.
|
|
168
|
+
|
|
169
|
+
4. **Present diagnosis summary** — show all findings before the recovery report:
|
|
170
|
+
```
|
|
171
|
+
═══════════════════════════════════════════════════
|
|
172
|
+
Workspace Diagnosis
|
|
173
|
+
═══════════════════════════════════════════════════
|
|
174
|
+
|
|
175
|
+
Branch: fix/B-001-login-crash
|
|
176
|
+
Working tree: 3 uncommitted changes
|
|
177
|
+
|
|
178
|
+
Feature pipeline: 2 completed, 1 failed (F-003), 2 pending
|
|
179
|
+
Bugfix pipeline: 1 completed, 1 failed (B-002), 0 pending
|
|
180
|
+
Refactor pipeline: (no state found)
|
|
181
|
+
|
|
182
|
+
Residual branches:
|
|
183
|
+
dev/F-003-payment-integration-202604201030
|
|
184
|
+
fix/B-002-encoding-bug
|
|
185
|
+
|
|
186
|
+
Failed tasks:
|
|
187
|
+
F-003: Payment integration [FAILED] → branch: dev/F-003-...
|
|
188
|
+
B-002: CSV encoding bug [FAILED] → branch: fix/B-002-...
|
|
189
|
+
═══════════════════════════════════════════════════
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
If no pipelines have state and no failed tasks are found, skip to 1.1 (standard recovery report).
|
|
125
193
|
|
|
126
194
|
### 1.1 Display Detection Report
|
|
127
195
|
|
|
@@ -160,7 +228,28 @@ Include test results in the report:
|
|
|
160
228
|
- How many tests pass/fail
|
|
161
229
|
- If failures exist — which tests and why
|
|
162
230
|
|
|
163
|
-
### 1.3
|
|
231
|
+
### 1.3 Select Recovery Target (if multiple failed tasks)
|
|
232
|
+
|
|
233
|
+
If the diagnosis in 1.0 found **multiple failed/interrupted tasks** across pipelines, ask the user which one to recover first before proceeding:
|
|
234
|
+
|
|
235
|
+
```
|
|
236
|
+
AskUserQuestion:
|
|
237
|
+
question: "Multiple failed/interrupted tasks found. Which would you like to recover?"
|
|
238
|
+
header: "Target"
|
|
239
|
+
options:
|
|
240
|
+
- label: "F-003: Payment integration"
|
|
241
|
+
description: "Feature pipeline — FAILED — branch: dev/F-003-payment-integration-202604201030"
|
|
242
|
+
- label: "B-002: CSV encoding bug"
|
|
243
|
+
description: "Bugfix pipeline — FAILED — branch: fix/B-002-encoding-bug"
|
|
244
|
+
- label: "Recover all sequentially"
|
|
245
|
+
description: "Recover each failed task one by one in priority order"
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
Generate the options dynamically from the diagnosis results. Include task ID, title, pipeline type, status, and branch name.
|
|
249
|
+
|
|
250
|
+
If only one failed/interrupted task is found, skip this step — proceed directly to 1.4 with that task as the recovery target.
|
|
251
|
+
|
|
252
|
+
### 1.4 Ask User to Choose Recovery Approach
|
|
164
253
|
|
|
165
254
|
**User choice required (mandatory)** — Use `AskUserQuestion` to present interactive selectable options. **NEVER skip this step. NEVER choose for the user.**
|
|
166
255
|
|
|
@@ -208,7 +297,7 @@ End this skill.
|
|
|
208
297
|
|
|
209
298
|
**NEVER proceed to Phase 2 without explicit user selection via `AskUserQuestion`. Do NOT render options as plain text — the user must be able to click/select.**
|
|
210
299
|
|
|
211
|
-
**CHECKPOINT CP-REC-1**: User chose recovery approach.
|
|
300
|
+
**CHECKPOINT CP-REC-1**: User chose recovery target and approach.
|
|
212
301
|
|
|
213
302
|
---
|
|
214
303
|
|
|
@@ -49,10 +49,14 @@ Before any action, validate:
|
|
|
49
49
|
2. **For start**: `.prizmkit/plans/refactor-list.json` must exist in `.prizmkit/plans/` (or user-specified path)
|
|
50
50
|
3. **Dependencies**: `jq`, `python3`, AI CLI (`cbc` or `claude`) must be in PATH
|
|
51
51
|
4. **Python version**: Requires Python 3.8+ for dev-pipeline scripts
|
|
52
|
+
5. **Browser tools** (optional): If any refactor has `browser_interaction` field, check the corresponding tool is available. Refactors may specify `tool: "playwright-cli"`, `tool: "opencli"`, or `tool: "auto"` (AI chooses at runtime).
|
|
52
53
|
|
|
53
54
|
Quick check:
|
|
54
55
|
```bash
|
|
55
56
|
command -v jq && command -v python3 && (command -v cbc || command -v claude) && echo "All dependencies OK"
|
|
57
|
+
# Optional: browser interaction support (check both tools — refactors may use either)
|
|
58
|
+
command -v playwright-cli && echo "playwright-cli OK" || echo "playwright-cli not found (playwright browser verification will be skipped)"
|
|
59
|
+
command -v opencli && echo "opencli OK" || echo "opencli not found (opencli browser verification will be skipped)"
|
|
56
60
|
```
|
|
57
61
|
|
|
58
62
|
If `.prizmkit/plans/refactor-list.json` is missing, inform user:
|
|
@@ -66,6 +70,8 @@ Detect user intent from their message, then follow the corresponding workflow:
|
|
|
66
70
|
|
|
67
71
|
#### Intent A: Start Pipeline
|
|
68
72
|
|
|
73
|
+
> **Execution model**: The pipeline processes refactor tasks **sequentially** (one at a time, in priority order). The `dependencies` field in refactor-list.json is reserved for future parallel execution support and does NOT affect current execution order.
|
|
74
|
+
|
|
69
75
|
1. **Check prerequisites**:
|
|
70
76
|
```bash
|
|
71
77
|
ls .prizmkit/plans/refactor-list.json 2>/dev/null && echo "Found" || echo "Missing"
|
|
@@ -144,17 +150,37 @@ Detect user intent from their message, then follow the corresponding workflow:
|
|
|
144
150
|
- 1
|
|
145
151
|
- 5
|
|
146
152
|
|
|
147
|
-
**Question 3 —
|
|
153
|
+
**Question 3 — Strict behavior check** (multiSelect: false):
|
|
154
|
+
- On (default) — Run full test suite after each refactor task to verify behavior preservation
|
|
155
|
+
- Off — Skip post-task test verification (faster but riskier)
|
|
156
|
+
|
|
157
|
+
**Question 4 — Advanced config?** (multiSelect: false):
|
|
158
|
+
- No (default) — Use defaults for critic review, session timeout, and failure behavior
|
|
159
|
+
- Yes — Configure critic review, session timeout, and stop-on-failure options
|
|
160
|
+
|
|
161
|
+
Note: Refactor filter defaults to all refactor items (by priority order). If the user selects "Other" on any option, handle their custom input.
|
|
162
|
+
|
|
163
|
+
**If user chose "Yes" to Advanced config**, ask a second round of `AskUserQuestion`:
|
|
164
|
+
|
|
165
|
+
**Question 1 — Session timeout** (multiSelect: false):
|
|
148
166
|
- None (default) — No timeout
|
|
149
167
|
- 30 min — `SESSION_TIMEOUT=1800`
|
|
150
168
|
- 1 hour — `SESSION_TIMEOUT=3600`
|
|
151
169
|
- 2 hours — `SESSION_TIMEOUT=7200`
|
|
152
170
|
|
|
153
|
-
**Question
|
|
154
|
-
-
|
|
155
|
-
-
|
|
171
|
+
**Question 2 — Stop on failure** (multiSelect: false):
|
|
172
|
+
- Off (default) — Pipeline continues to next task after failure
|
|
173
|
+
- On — Pipeline halts immediately when a task exhausts all retries (`STOP_ON_FAILURE=1`)
|
|
156
174
|
|
|
157
|
-
|
|
175
|
+
**Question 3 — Critic review** (multiSelect: false):
|
|
176
|
+
- Off (default) — Skip adversarial review
|
|
177
|
+
- On — Enable adversarial critic review: an independent AI agent reviews the refactor plan for completeness and the implementation for regressions, missed edge cases, and behavior violations. Adds ~5-10 min per refactor task.
|
|
178
|
+
|
|
179
|
+
**Question 4 — Deploy after completion?** (multiSelect: false):
|
|
180
|
+
- No (default) — Skip deployment after pipeline completes
|
|
181
|
+
- Yes — Run /prizmkit-deploy automatically after all refactors complete successfully (`ENABLE_DEPLOY=1`). Deployment is blocked if any refactor did not complete successfully (status not 'completed' or manually 'skipped').
|
|
182
|
+
|
|
183
|
+
Default Critic to Off unless refactor items have `priority: "critical"` (in which case default to On).
|
|
158
184
|
|
|
159
185
|
**Environment variable mapping** (for translating user responses → env vars):
|
|
160
186
|
|
|
@@ -163,9 +189,12 @@ Detect user intent from their message, then follow the corresponding workflow:
|
|
|
163
189
|
| Verbose: On | `VERBOSE=1` |
|
|
164
190
|
| Verbose: Off | `VERBOSE=0` |
|
|
165
191
|
| Max retries: N | `MAX_RETRIES=N` |
|
|
166
|
-
| Timeout: value | `SESSION_TIMEOUT=<seconds>` |
|
|
167
192
|
| Strict behavior: On | `STRICT_BEHAVIOR_CHECK=1` |
|
|
168
193
|
| Strict behavior: Off | `STRICT_BEHAVIOR_CHECK=0` |
|
|
194
|
+
| Critic: On | `ENABLE_CRITIC=true` |
|
|
195
|
+
| Timeout: value | `SESSION_TIMEOUT=<seconds>` |
|
|
196
|
+
| Stop on failure: On | `STOP_ON_FAILURE=1` |
|
|
197
|
+
| Deploy: Yes | `ENABLE_DEPLOY=1` |
|
|
169
198
|
|
|
170
199
|
**Advanced environment variables** (not exposed in interactive menu, pass via `--env`):
|
|
171
200
|
|
|
@@ -179,7 +208,6 @@ Detect user intent from their message, then follow the corresponding workflow:
|
|
|
179
208
|
| `LOG_CLEANUP_ENABLED` | `1` | Run periodic log cleanup (`0` to disable) |
|
|
180
209
|
| `LOG_RETENTION_DAYS` | `14` | Delete logs older than N days |
|
|
181
210
|
| `LOG_MAX_TOTAL_MB` | `1024` | Keep total logs under N MB via oldest-first cleanup |
|
|
182
|
-
| `STOP_ON_FAILURE` | `0` | Stop pipeline when a task exhausts all retries (`1` to stop immediately) |
|
|
183
211
|
|
|
184
212
|
⚠️ STOP HERE and wait for user response before continuing to step 7.
|
|
185
213
|
|
|
@@ -191,7 +219,7 @@ Detect user intent from their message, then follow the corresponding workflow:
|
|
|
191
219
|
```
|
|
192
220
|
With all options:
|
|
193
221
|
```bash
|
|
194
|
-
VERBOSE=1 STRICT_BEHAVIOR_CHECK=1 MAX_RETRIES=5 SESSION_TIMEOUT=3600 \
|
|
222
|
+
VERBOSE=1 STRICT_BEHAVIOR_CHECK=1 MAX_RETRIES=5 SESSION_TIMEOUT=3600 ENABLE_DEPLOY=1 \
|
|
195
223
|
dev-pipeline/run-refactor.sh run .prizmkit/plans/refactor-list.json
|
|
196
224
|
```
|
|
197
225
|
|
|
@@ -202,7 +230,7 @@ Detect user intent from their message, then follow the corresponding workflow:
|
|
|
202
230
|
With all options:
|
|
203
231
|
```bash
|
|
204
232
|
dev-pipeline/launch-refactor-daemon.sh start .prizmkit/plans/refactor-list.json \
|
|
205
|
-
--env "VERBOSE=1 STRICT_BEHAVIOR_CHECK=1 MAX_RETRIES=5"
|
|
233
|
+
--env "VERBOSE=1 STRICT_BEHAVIOR_CHECK=1 MAX_RETRIES=5 ENABLE_DEPLOY=1"
|
|
206
234
|
```
|
|
207
235
|
|
|
208
236
|
**Manual mode**: Print the assembled command(s) and **stop here**. Do not execute anything. Do not proceed to step 8.
|
|
@@ -342,6 +370,9 @@ Notes:
|
|
|
342
370
|
| Launch failed (process died immediately) | Show last 20 lines of log: `tail -20 .prizmkit/state/refactor/pipeline-daemon.log` |
|
|
343
371
|
| Refactor stuck/blocked | Use `reset-refactor.sh <R-XXX> --clean --run` for a fresh retry |
|
|
344
372
|
| All refactors blocked/failed | Show status, suggest recovery: `dev-pipeline/reset-refactor.sh <R-XXX> --clean --run .prizmkit/plans/refactor-list.json` |
|
|
373
|
+
| `playwright-cli` not installed | Browser verification skipped for playwright refactors (non-blocking). Suggest: `npm install -g @playwright/cli@latest && playwright-cli install --skills` |
|
|
374
|
+
| `opencli` not installed | Browser verification skipped for opencli refactors (non-blocking). Install opencli for Chrome session-based browser verification |
|
|
375
|
+
| Deploy session failed | Pipeline completed but deploy session exited non-zero. Check `.prizmkit/state/refactor/deploy/<session_id>/logs/session.log`. Retry manually: `/prizmkit-deploy`. |
|
|
345
376
|
| Permission denied on script | Run `chmod +x dev-pipeline/launch-refactor-daemon.sh dev-pipeline/run-refactor.sh` |
|
|
346
377
|
|
|
347
378
|
### Integration Notes
|