prizmkit 1.1.159 → 1.1.160

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/bundled/VERSION.json +3 -3
  2. package/bundled/adapters/codebuddy/settings-adapter.js +76 -25
  3. package/bundled/dev-pipeline/prizmkit_runtime/gitops.py +9 -2
  4. package/bundled/dev-pipeline/prizmkit_runtime/runtime_commit.py +42 -15
  5. package/bundled/dev-pipeline/templates/bootstrap-prompt.md +1 -1
  6. package/bundled/dev-pipeline/templates/bootstrap-tier3.md +1 -1
  7. package/bundled/dev-pipeline/templates/sections/runtime-commit-handoff.md +6 -6
  8. package/bundled/dev-pipeline/tests/test_generate_bootstrap_prompt.py +4 -3
  9. package/bundled/dev-pipeline/tests/test_generate_bugfix_prompt.py +2 -2
  10. package/bundled/dev-pipeline/tests/test_generate_refactor_prompt.py +2 -2
  11. package/bundled/dev-pipeline/tests/test_runtime_commit.py +68 -13
  12. package/bundled/dev-pipeline/tests/test_unified_cli.py +10 -6
  13. package/bundled/rules/prizm/prizm-commit-workflow.md +7 -7
  14. package/bundled/rules/prizm/prizm-documentation.md +24 -65
  15. package/bundled/rules/prizm/prizm-progressive-loading.md +9 -8
  16. package/bundled/skills/_metadata.json +1 -1
  17. package/bundled/skills/prizmkit-code-review/SKILL.md +1 -1
  18. package/bundled/skills/prizmkit-committer/SKILL.md +48 -41
  19. package/bundled/skills/prizmkit-deploy/SKILL.md +172 -198
  20. package/bundled/skills/prizmkit-deploy/references/capability-contract.md +137 -0
  21. package/bundled/skills/prizmkit-deploy/references/deploy-record-schema.json +1053 -0
  22. package/bundled/skills/prizmkit-deploy/references/deployment-declaration-schema.json +291 -0
  23. package/bundled/skills/prizmkit-deploy/references/legacy-migration.md +90 -0
  24. package/bundled/skills/prizmkit-deploy/references/policy-and-execution.md +170 -0
  25. package/bundled/skills/prizmkit-deploy/references/real-resource-test-policy.md +73 -0
  26. package/bundled/skills/prizmkit-deploy/references/verification-and-recovery.md +164 -0
  27. package/bundled/skills/prizmkit-deploy/scripts/validate-deploy-artifact.py +371 -0
  28. package/bundled/skills/prizmkit-implement/SKILL.md +2 -2
  29. package/bundled/skills/prizmkit-init/SKILL.md +17 -17
  30. package/bundled/skills/prizmkit-init/references/update-supplement.md +5 -5
  31. package/bundled/skills/prizmkit-prizm-docs/SKILL.md +17 -11
  32. package/bundled/skills/prizmkit-prizm-docs/assets/prizm-docs-format.md +95 -155
  33. package/bundled/skills/prizmkit-prizm-docs/references/op-init.md +6 -5
  34. package/bundled/skills/prizmkit-prizm-docs/references/op-rebuild.md +4 -2
  35. package/bundled/skills/prizmkit-prizm-docs/references/op-status.md +9 -10
  36. package/bundled/skills/prizmkit-prizm-docs/references/op-update.md +6 -5
  37. package/bundled/skills/prizmkit-prizm-docs/references/op-validate.md +13 -12
  38. package/bundled/skills/prizmkit-retrospective/SKILL.md +3 -3
  39. package/bundled/skills/prizmkit-test/SKILL.md +26 -13
  40. package/bundled/skills/prizmkit-test/references/boundary-contract-and-test-double-guidance.md +8 -4
  41. package/bundled/skills/prizmkit-test/references/independent-test-review.md +7 -3
  42. package/bundled/skills/prizmkit-test/references/test-coverage-model.md +33 -10
  43. package/bundled/skills/prizmkit-test/references/test-report-template.md +33 -11
  44. package/bundled/skills/prizmkit-workflow/SKILL.md +5 -7
  45. package/bundled/skills/prizmkit-workflow/references/workflow-state-protocol.md +5 -6
  46. package/bundled/templates/hooks/commit-intent-status.py +9 -41
  47. package/bundled/templates/hooks/commit-intent.json +3 -3
  48. package/bundled/templates/hooks/diff-prizm-docs.py +3 -1
  49. package/bundled/templates/hooks/prizm-pre-commit.py +32 -6
  50. package/bundled/templates/hooks/run-python-hook.cjs +44 -0
  51. package/bundled/templates/hooks/validate-prizm-docs.py +399 -173
  52. package/bundled/templates/project-memory-template.md +19 -19
  53. package/package.json +1 -1
  54. package/src/clean.js +6 -7
  55. package/src/gitignore-template.js +8 -12
  56. package/src/scaffold.js +125 -71
  57. package/bundled/skills/prizmkit-deploy/assets/deploy-document-template.md +0 -89
  58. package/bundled/skills/prizmkit-deploy/references/ci-cd-workflows.md +0 -145
  59. package/bundled/skills/prizmkit-deploy/references/cloud-platform-deploy.md +0 -109
  60. package/bundled/skills/prizmkit-deploy/references/data-safety-examples.md +0 -120
  61. package/bundled/skills/prizmkit-deploy/references/database-setup.md +0 -65
  62. package/bundled/skills/prizmkit-deploy/references/deploy-config-schema.md +0 -150
  63. package/bundled/skills/prizmkit-deploy/references/deploy-history-schema.md +0 -78
  64. package/bundled/skills/prizmkit-deploy/references/deploy-metadata-schema.json +0 -49
  65. package/bundled/skills/prizmkit-deploy/references/deployment-modes.md +0 -50
  66. package/bundled/skills/prizmkit-deploy/references/direct-upload.md +0 -26
  67. package/bundled/skills/prizmkit-deploy/references/dns-setup.md +0 -42
  68. package/bundled/skills/prizmkit-deploy/references/docker-deploy.md +0 -31
  69. package/bundled/skills/prizmkit-deploy/references/firewall-setup.md +0 -37
  70. package/bundled/skills/prizmkit-deploy/references/live-validation-notes.md +0 -21
  71. package/bundled/skills/prizmkit-deploy/references/nginx-blue-green.md +0 -59
  72. package/bundled/skills/prizmkit-deploy/references/pending-input-schema.json +0 -164
  73. package/bundled/skills/prizmkit-deploy/references/ssh-adapter-flow.md +0 -221
  74. package/bundled/skills/prizmkit-deploy/references/ssh-bootstrap-flow.md +0 -49
  75. package/bundled/skills/prizmkit-deploy/references/ssh-execution-flow.md +0 -41
  76. package/bundled/skills/prizmkit-deploy/references/ssh-takeover.md +0 -20
  77. package/bundled/skills/prizmkit-deploy/references/ssl-setup.md +0 -56
@@ -1,109 +0,0 @@
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 is generated for basic deployments. When confirmed custom routing or static build settings require `vercel.json`, start from this minimal platform-native shape and include only established keys:
44
-
45
- ```json
46
- {
47
- "$schema": "https://openapi.vercel.sh/vercel.json",
48
- "buildCommand": "npm run build",
49
- "outputDirectory": "dist",
50
- "rewrites": [
51
- {
52
- "source": "/(.*)",
53
- "destination": "/index.html"
54
- }
55
- ]
56
- }
57
- ```
58
-
59
- Omit `buildCommand`/`outputDirectory` when framework detection owns them, and omit `rewrites` unless the application actually needs SPA fallback or a confirmed route. Validate generated configuration with the installed Vercel CLI before deployment.
60
-
61
- Key behaviors:
62
- - Next.js: framework auto-detected, build command and output directory inferred automatically
63
- - Static sites: set build command and output directory via `vercel.json` or CLI
64
- - Env vars: `vercel env add <KEY>` (supports `production`, `preview`, `development` environments)
65
- - Deploy preview: every branch gets a preview URL automatically (if connected via GitHub)
66
-
67
- ### Netlify
68
-
69
- Netlify requires explicit build and publish configuration. Use `netlify.toml`:
70
-
71
- ```toml
72
- [build]
73
- command = "npm run build"
74
- publish = "dist"
75
-
76
- [[redirects]]
77
- from = "/*"
78
- to = "/index.html"
79
- status = 200
80
- ```
81
-
82
- Key behaviors:
83
- - SPA redirects: the catch-all redirect above is essential for client-side routing
84
- - Env vars: `netlify env:set <KEY> <VALUE>` (per-context: `production`, `deploy-preview`, `branch-deploy`)
85
- - Branch deploys: every branch gets a deploy-preview URL automatically (if connected via GitHub)
86
-
87
- ### Fly.io
88
-
89
- Fly.io requires a `fly.toml` with app name, builder, and HTTP service config:
90
-
91
- ```toml
92
- app = "<app-name>"
93
- primary_region = "lhr"
94
-
95
- [build]
96
- dockerfile = "Dockerfile"
97
-
98
- [http_service]
99
- internal_port = 3000
100
- force_https = true
101
- ```
102
-
103
- Key behaviors:
104
- - Build source: `dockerfile = "Dockerfile"` for project-owned images, or a confirmed platform-supported image/build configuration; static sites still need a valid serving image rather than an invented `static` builder value
105
- - Secrets: `fly secrets set <KEY>=<VALUE>` for runtime environment variables
106
- - Scale: `fly scale count <N>` to adjust VM instances
107
- - Volumes: for persistent data, configure `[mounts]` in fly.toml
108
-
109
- **Note**: These are minimum-viable platform references; browser-based authentication remains a user-action step. Enriched platform coverage is planned for future iterations.
@@ -1,120 +0,0 @@
1
- # Data Safety Examples
2
-
3
- Few-shot examples for the Data Safety Gate in `/prizmkit-deploy`. Read this file when a dangerous command pattern is detected — it shows the correct confirmation flow and illustrates what happens when the gate is skipped.
4
-
5
- ## Example 1: Prisma Force Reset (the incident)
6
-
7
- **Context:** User runs `/prizmkit-deploy` to deploy a Next.js + Prisma project. During database setup, the model needs to sync the Prisma schema with the database.
8
-
9
- **Wrong — skipping the gate:**
10
- ```
11
- Model: I'll sync your database schema now.
12
- $ prisma db push --force-reset --accept-schema
13
- → All tables dropped. All production data lost. No backup. No confirmation.
14
- ```
15
- This happened in production. `--force-reset` drops and recreates every table. `--accept-schema` bypasses Prisma's own confirmation prompt. The model ran both flags without asking the user whether existing data should be preserved.
16
-
17
- **Correct — with the safety gate:**
18
- ```
19
- Model: I detected that your database needs a schema sync. However, before I do anything:
20
-
21
- WARNING: The Prisma schema has changes that could affect existing data.
22
- - New tables to create: 0
23
- - Tables that may be modified: 2 (users, orders)
24
- - If I run `prisma db push --force-reset`, ALL existing data will be DESTROYED.
25
-
26
- Options:
27
- 1. prisma db push (safe — only adds missing tables/columns, no data loss)
28
- 2. prisma db push --force-reset (DANGEROUS — drops and recreates all tables, all data lost)
29
- 3. prisma migrate dev (creates a migration file you can review first)
30
-
31
- Which approach do you want? (1/2/3)
32
- ```
33
-
34
- The `--accept-schema` flag should never be used — it suppresses Prisma's own built-in safety prompts that protect the user.
35
-
36
- ## Example 2: Prisma Migrate Reset
37
-
38
- **Context:** User wants to reset their dev database to a clean state for testing.
39
-
40
- **Correct detection and confirmation:**
41
- ```
42
- Model: `prisma migrate reset` will:
43
- - Drop the entire database
44
- - Recreate it from scratch
45
- - Run all migrations
46
-
47
- This is a DESTRUCTIVE operation. All data in the database will be permanently lost.
48
-
49
- Are you sure this is a dev/test database with no important data? (yes/no)
50
- ```
51
-
52
- In production or any environment with real data: refuse immediately. This command should only run in dev with explicit user confirmation.
53
-
54
- ## Example 3: Raw SQL Data Modification
55
-
56
- **Context:** During deployment, the model considers running a SQL command to fix a data issue.
57
-
58
- **Correct detection and confirmation:**
59
- ```
60
- Model: To fix the duplicate user records, I would run:
61
- ```sql
62
- DELETE FROM users WHERE email IS NULL AND created_at < '2025-01-01';
63
- ```
64
-
65
- This would delete approximately 340 user records. BEFORE I run this:
66
-
67
- 1. Would you like me to run a SELECT first to show you exactly which rows would be deleted?
68
- 2. Do you want to back up the users table before deletion?
69
- 3. Confirm: Delete these 340 records? (yes/no)
70
-
71
- I will not proceed without your explicit confirmation.
72
- ```
73
-
74
- ## Example 4: Overwriting Production Configuration
75
-
76
- **Context:** During bootstrap, the model needs to write an Nginx config, but one already exists at the target path.
77
-
78
- **Correct detection and confirmation:**
79
- ```
80
- Model: Found existing Nginx config at /etc/nginx/sites-enabled/myapp.
81
-
82
- This file is NOT managed by PrizmKit (no `# PrizmKit Managed:` marker).
83
- Overwriting it could break existing site configuration.
84
-
85
- Options:
86
- 1. Back up the existing config to /etc/nginx/sites-enabled/myapp.bak, then write new config
87
- 2. Create new config alongside existing one with a different name
88
- 3. Skip — keep the existing config as-is
89
-
90
- Which approach? (1/2/3)
91
- ```
92
-
93
- ## Example 5: Confirmation Dialogue Template
94
-
95
- When the gate triggers, use this dialogue structure:
96
-
97
- ```
98
- ============================================================
99
- DATA SAFETY GATE — DESTRUCTIVE OPERATION DETECTED
100
- ============================================================
101
-
102
- Command: <the dangerous command>
103
- Risk level: HIGH / CRITICAL
104
- What will be lost: <plain-language description of affected data>
105
-
106
- Current state:
107
- - Database: <name>, <size>, <table count>
108
- - Affected tables: <list>
109
- - Last backup: <date if known, or "unknown — backup recommended">
110
-
111
- Recommended safe approach:
112
- <alternative if one exists>
113
-
114
- Do you want to proceed with this destructive operation?
115
- Type "yes, I understand the data will be lost" to confirm.
116
- Any other response will abort.
117
- ============================================================
118
- ```
119
-
120
- This format forces the user to read and acknowledge the risk before proceeding.
@@ -1,65 +0,0 @@
1
- # Database Setup
2
-
3
- Read this file when Discovery detected a database driver and the user wants AI-assisted database installation on the server.
4
-
5
- ## Entry condition
6
-
7
- During Discovery Step 1 (Project Detection), database drivers were already scanned. If a driver was detected, ask after bootstrap tools are installed:
8
-
9
- > "Detected the project uses <PostgreSQL/MySQL/Redis>. Want me to install and configure it on the server?"
10
- > - **Yes** → proceed with database installation
11
- > - **No** → skip, record in deploy.md with note "database must be configured by user"
12
-
13
- ## Secrets file safety
14
-
15
- Before writing `.prizmkit/deploy/secrets.local.env`:
16
-
17
- 1. Verify `.gitignore` or an equivalent ignore rule covers the exact `.prizmkit/deploy/secrets.local.env` path or a compatible `.prizmkit/deploy/*.local.env` pattern.
18
- 2. If the ignore rule is missing, pause and add or request it before writing secrets.
19
- 3. Create/update the file with restrictive creation permissions (for example `umask 077` on POSIX), atomically replace it without widening permissions, set mode `600`, and verify it is ignored by Git.
20
- 4. Use dotenv syntax: one `KEY=value` assignment per line, UTF-8, no JSON braces or commas. Preserve unrelated existing assignments and reject malformed or duplicate keys.
21
- 5. Record only presence metadata in deploy config, docs, reports, and history. Never copy raw passwords, connection strings, passphrases, decryption keys, unsalted hashes, or full env var values into committed files.
22
-
23
- ```
24
- apt-get install -y postgresql postgresql-contrib
25
- sudo -u postgres psql -c "CREATE DATABASE <project>;"
26
- sudo -u postgres psql -c "CREATE USER <project> WITH PASSWORD '<random-password>';"
27
- sudo -u postgres psql -c "GRANT ALL ON DATABASE <project> TO <project>;"
28
- ```
29
-
30
- - Generate a cryptographically secure 32-character URL-safe password using letters, digits, `_`, and `-`, with no whitespace, quotes, `#`, or `=`.
31
- - Write or replace the single dotenv assignment `DATABASE_URL=postgresql://<project>:<password>@localhost:5432/<project>` in `.prizmkit/deploy/secrets.local.env`.
32
- - Re-verify ignore status and current-user-only permissions after atomic replacement.
33
- - In `deploy.md`, record only: "PostgreSQL connection information is stored in ignored local secret storage; raw values are not committed."
34
-
35
- ## Legacy Local-Secret Migration
36
-
37
- If `.prizmkit/deploy/secrets.local.json` already exists from an earlier installation, treat the filename as legacy input only, never as a current output:
38
-
39
- 1. Verify it is ignored by Git and restricted to the current user before reading it.
40
- 2. Detect either a JSON object containing string values or strict dotenv `KEY=value` lines; reject mixed, malformed, duplicate, or non-string content without printing values.
41
- 3. Convert the validated assignments to `.prizmkit/deploy/secrets.local.env` through the restrictive atomic-write rules above.
42
- 4. Compare key names and presence only. Remove the legacy file only after successful conversion and explicit user confirmation; otherwise leave it untouched and report migration pending.
43
-
44
- ## MySQL setup (future)
45
-
46
- Similar flow. Not implemented in first version — if project uses MySQL, direct user to documentation fallback.
47
-
48
- ## Redis setup
49
-
50
- ```
51
- apt-get install -y redis-server
52
- redis-cli CONFIG SET requirepass "<random-password>"
53
- redis-cli CONFIG REWRITE
54
- ```
55
-
56
- - Bind to localhost only (modify `/etc/redis/redis.conf` if needed).
57
- - Write or replace the single dotenv assignment `REDIS_URL=redis://:<password>@localhost:6379` in `.prizmkit/deploy/secrets.local.env` using the same URL-safe password and atomic permission rules.
58
- - Re-verify ignore status and current-user-only permissions after replacement.
59
-
60
- ## Security notes
61
-
62
- - Never write database passwords to deploy.md, because deploy.md may be committed to git and passwords would leak.
63
- - Passwords are stored only in `.prizmkit/deploy/secrets.local.env` after verifying the file is ignored by Git and locked down to current-user read/write permissions.
64
- - Default: database binds to localhost, no external access, because most indie projects only need local connections.
65
- - Record a `"database-setup"` event in deploy history (presence metadata only, no passwords).
@@ -1,150 +0,0 @@
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
- "deployStrategy": "direct-upload|ci-cd-push|ci-cd-pull",
13
- "defaults": { ... },
14
- "environments": { ... },
15
- "servers": [ ... ],
16
- "repository": { ... },
17
- "apps": [ ... ],
18
- "nginx": { ... },
19
- "env": { ... }
20
- }
21
- ```
22
-
23
- ## defaults
24
-
25
- ```json
26
- {
27
- "releaseRetention": 5,
28
- "credentialMode": "ai-assisted|user-managed",
29
- "secretStorage": "ask-every-time|ignored-local-env|user-managed-on-server-only",
30
- "rollbackOnFailure": true,
31
- "headlessDefaultEnvironment": "test"
32
- }
33
- ```
34
-
35
- `ignored-local-env` means `.prizmkit/deploy/secrets.local.env` after exact ignore and permission verification. Legacy `plaintext-local` may be migrated only through the local-secret migration contract. Legacy `encrypted-local` is unsupported because this Skill has no encryption/key-management implementation; block deployment and require the user to select a supported mode without exposing secret values.
36
-
37
- ## environments
38
-
39
- Keyed by environment name. Each entry:
40
- ```json
41
- {
42
- "dev": {
43
- "server": "server-id",
44
- "allowHeadless": true,
45
- "confirmBeforeDeploy": false
46
- }
47
- }
48
- ```
49
-
50
- ## servers
51
-
52
- Array of server objects:
53
- ```json
54
- {
55
- "id": "prod-1",
56
- "host": "IP or hostname",
57
- "port": 22,
58
- "bootstrapUser": "root",
59
- "runtimeUser": "deploy",
60
- "roles": ["web"],
61
- "validated": {
62
- "ssh": true|false,
63
- "bootstrap": true|false,
64
- "runtimeUser": true|false,
65
- "tools": {
66
- "node": "version",
67
- "npm": "version",
68
- "pm2": "version",
69
- "nginx": "version",
70
- "git": "version"
71
- },
72
- "directories": true|false,
73
- "deployKey": true|false
74
- }
75
- }
76
- ```
77
-
78
- ## repository
79
-
80
- ```json
81
- {
82
- "url": "git@github.com:owner/repo.git",
83
- "branch": "master",
84
- "auth": "deploy-key|ssh-agent|token",
85
- "validated": {
86
- "clone": true|false
87
- }
88
- }
89
- ```
90
-
91
- ## apps
92
-
93
- Array of app objects:
94
- ```json
95
- {
96
- "id": "web",
97
- "path": ".",
98
- "runtime": "pm2",
99
- "packageManager": "npm",
100
- "installCommand": "npm ci",
101
- "buildCommand": "npm run build",
102
- "startCommand": "npm run start",
103
- "ports": {
104
- "blue": 3101,
105
- "green": 3102
106
- },
107
- "healthChecks": [
108
- { "name": "home", "url": "/", "expectedStatus": [200] },
109
- { "name": "login", "url": "/login", "expectedStatus": [200, 302] }
110
- ],
111
- "activeColor": "blue",
112
- "pm2Process": "prizm-ideas-blue"
113
- }
114
- ```
115
-
116
- ## nginx
117
-
118
- ```json
119
- {
120
- "enabled": true,
121
- "managed": true,
122
- "firstChangeRequiresConfirmation": true,
123
- "domain": null,
124
- "ipFallback": true,
125
- "currentUpstream": "127.0.0.1:3101"
126
- }
127
- ```
128
-
129
- ## env
130
-
131
- ```json
132
- {
133
- "strategy": "ai-assisted|user-managed",
134
- "required": ["VAR_NAME"],
135
- "secrets": ["SECRET_NAME"],
136
- "validated": {
137
- "allRequiredPresent": true|false
138
- }
139
- }
140
- ```
141
-
142
- ## Validation Rules
143
-
144
- - `version` must be present (always 1 for first version)
145
- - `servers` must have at least one entry with host and bootstrapUser
146
- - `repository.url` must be present
147
- - `apps` must have at least one entry
148
- - `apps[*].ports.blue` and `apps[*].ports.green` must differ
149
- - `apps[*].healthChecks` should have at least one entry
150
- - Environment referenced in `environments` must have a matching server in `servers`
@@ -1,78 +0,0 @@
1
- # Deploy History Record Schema
2
-
3
- Each immutable event is written atomically to `.prizmkit/deploy/deploy-history/<eventId>.json`. The filename stem must equal the JSON `eventId` exactly.
4
-
5
- ```json
6
- {
7
- "eventId": "deploy-20260430T142233Z-22783a3",
8
- "eventType": "deploy|rollback|status|validation|failed-deploy|user-aborted|takeover|adapter-gap|database-setup",
9
- "timestamp": "<ISO 8601 UTC>",
10
- "releaseId": "20260430T142233Z-22783a3 or null",
11
- "serverId": "<server id from deploy.config.json>",
12
- "appIds": ["<app ids involved>"],
13
- "branch": "<git branch>",
14
- "commitSha": "<full or short commit SHA>",
15
- "releasePath": "<full server path, e.g. /var/www/prizm-ideas/releases/20260430T142233Z-22783a3>",
16
- "previousReleasePath": "<previous release path or null for first deploy>",
17
- "targetPort": 3101,
18
- "targetColor": "blue|green",
19
- "previousPort": 3102,
20
- "phases": {
21
- "preflight": "success|failed|skipped",
22
- "prepareRelease": "success|failed|skipped",
23
- "fetchCode": "success|failed|skipped",
24
- "installDependencies": "success|failed|skipped",
25
- "build": "success|failed|skipped",
26
- "stageRuntime": "success|failed|skipped",
27
- "healthCheck": "success|failed|skipped",
28
- "switchTraffic": "success|failed|skipped",
29
- "verifyLive": "success|failed|skipped",
30
- "cleanupOldReleases": "success|failed|skipped",
31
- "recordHistory": "success|failed|skipped"
32
- },
33
- "healthCheckResults": [
34
- {
35
- "name": "home",
36
- "url": "/",
37
- "expected": [200],
38
- "actual": 200,
39
- "pass": true
40
- }
41
- ],
42
- "rollbackResult": null,
43
- "logPath": "<server log path>",
44
- "operatorMode": "ai-assisted|user-managed",
45
- "notes": "<human-readable summary of what happened>"
46
- }
47
- ```
48
-
49
- ## Event and File Identity
50
-
51
- Generate every `eventId` as:
52
-
53
- ```text
54
- <event-type>-<UTC-compact-timestamp>-<short-sha-or-none>[-NN]
55
- ```
56
-
57
- Rules:
58
-
59
- - `UTC-compact-timestamp` is the event time formatted `YYYYMMDDTHHMMSSZ`.
60
- - `short-sha` is the lowercase 7-12 hexadecimal commit prefix when a commit exists; otherwise use literal `none`.
61
- - If the candidate filename already exists, append the lowest available two-digit suffix from `-01` through `-99`; never overwrite a history record. If all suffixes are occupied, stop with a recording error.
62
- - Use the exact event ID as the filename stem. Example: `rollback-20260430T151000Z-22783a3.json`.
63
- - `releaseId` is a separate deployment/release-directory identity. Set it to the affected release for deploy, failed-deploy, and rollback events; otherwise use `null` when no release applies.
64
-
65
- ## Field Notes
66
-
67
- - `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.
68
- - `phases`: Only include phases that were attempted. Skip phases that were never reached.
69
- - `healthCheckResults`: Include all configured health checks. `pass` = actual status matches one of the expected status codes.
70
- - `rollbackResult`: `null` for non-rollback events, `"success"` or `"failed"` for rollbacks.
71
- - `notes`: Keep concise but include any anomalies or manual interventions.
72
-
73
- ## What NOT to record
74
-
75
- - Raw secret values or API keys — never.
76
- - Unsalted hashes of secret values — inferable with rainbow tables.
77
- - Passphrases or decryption keys — even if hashed.
78
- - Full environment variable values — presence metadata only (e.g., `{"SUPABASE_KEY": {"present": true}}`).
@@ -1,49 +0,0 @@
1
- {
2
- "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "title": "PrizmKit Server Deployment Metadata",
4
- "type": "object",
5
- "additionalProperties": false,
6
- "required": [
7
- "schema_version",
8
- "activeColor",
9
- "activePort",
10
- "lastReleaseId",
11
- "lastOperationEventId",
12
- "updatedAt"
13
- ],
14
- "properties": {
15
- "schema_version": {
16
- "const": 1
17
- },
18
- "activeColor": {
19
- "enum": ["blue", "green"]
20
- },
21
- "activePort": {
22
- "type": "integer",
23
- "minimum": 1,
24
- "maximum": 65535
25
- },
26
- "lastReleaseId": {
27
- "type": "string",
28
- "pattern": "^[0-9]{8}T[0-9]{6}Z-[0-9a-f]{7,12}(?:-[0-9]{2})?$"
29
- },
30
- "lastOperationEventId": {
31
- "type": "string",
32
- "pattern": "^[a-z][a-z-]*-[0-9]{8}T[0-9]{6}Z-(?:[0-9a-f]{7,12}|none)(?:-[0-9]{2})?$"
33
- },
34
- "updatedAt": {
35
- "type": "string",
36
- "format": "date-time"
37
- }
38
- },
39
- "examples": [
40
- {
41
- "schema_version": 1,
42
- "activeColor": "blue",
43
- "activePort": 3101,
44
- "lastReleaseId": "20260430T142233Z-22783a3",
45
- "lastOperationEventId": "deploy-20260430T142233Z-22783a3",
46
- "updatedAt": "2026-04-30T14:22:33Z"
47
- }
48
- ]
49
- }
@@ -1,50 +0,0 @@
1
- # Deployment Mode Details
2
-
3
- Read this file when the user needs a detailed comparison of deployment modes during mode selection. SKILL.md contains the routing logic; this file has the full descriptions.
4
-
5
- ## Mode A — Direct Upload
6
-
7
- 1. Local build on the user's machine.
8
- 2. SCP built output + `node_modules` + `.env.production` to server.
9
- 3. PM2 start → health check → Nginx switch.
10
- 4. After success: offer to upgrade to CI/CD.
11
- 5. Bypasses: deploy key, git clone on server, server-side build.
12
-
13
- Best for: first-time deployment, getting something live fast, low-spec servers.
14
-
15
- ## Mode B1 — CI/CD Push
16
-
17
- 1. Generate `.github/workflows/deploy.yml`: checkout → install → build → SCP tarball → SSH restart.
18
- 2. Add GitHub Secrets: `SSH_HOST`, `SSH_USER`, `SSH_KEY`, `SSH_PORT`.
19
- 3. First deploy triggered by push to configured branch.
20
- 4. Server only needs Node.js runtime + PM2 — no git, no build tools needed.
21
- 5. GitHub Actions runner handles the heavy lifting.
22
-
23
- Best for: low-spec servers, heavy build processes, projects with large dependencies.
24
-
25
- ## Mode B2 — CI/CD Pull
26
-
27
- 1. Configure deploy key on server → add to GitHub.
28
- 2. Generate `.github/workflows/deploy.yml`: triggers SSH command on server.
29
- 3. Server-side deploy script: `git pull` → install → build → PM2 restart → health check.
30
- 4. Server needs full build toolchain (Node.js, npm, git).
31
- 5. Simpler workflow file, heavier server load.
32
-
33
- Best for: simple setup, servers with sufficient CPU/RAM, projects where build is fast.
34
-
35
- ## Comparison
36
-
37
- | Aspect | Push mode | Pull mode |
38
- |------|----------|----------|
39
- | Build location | GitHub Actions runner | Server (local) |
40
- | Server load | Low (runs app only) | High (build + run) |
41
- | Config complexity | Medium (needs SCP transfer) | Low (SSH-triggered script only) |
42
- | Best for | Low-spec servers, heavy builds | Simple setup, capable servers |
43
- | Deploy Key required | No | Yes |
44
- | Artifact transfer | SCP tarball | git pull (incremental) |
45
-
46
- ## Common ground between all modes
47
-
48
- - Same PM2 + Nginx blue/green strategy.
49
- - Same health check and traffic switch procedure.
50
- - Same ops commands (status/logs/restart/rollback).
@@ -1,26 +0,0 @@
1
- # Direct Upload Deployment
2
-
3
- Read this file when `deployStrategy` is `"direct-upload"`. The AI handles the build locally and transfers built artifacts to the server. No Git operations on the server.
4
-
5
- ## Build phase (local)
6
-
7
- 1. Run `<buildCommand>` locally (e.g., `npm run build`) in the project root.
8
- 2. Identify the build output directory: `.next/` for Next.js, `dist/` for Vite, `build/` for CRA.
9
- 3. Prepare a deployment tarball containing: build output + `node_modules/` + `package.json` + `package-lock.json` + any runtime config files.
10
-
11
- ## Transfer phase (SCP)
12
-
13
- ```
14
- scp -P <port> deploy-<releaseId>.tar.gz <runtimeUser>@<host>:/var/www/<project>/releases/
15
- ssh <runtimeUser>@<host> "cd /var/www/<project>/releases && mkdir <releaseId> && tar xzf deploy-<releaseId>.tar.gz -C <releaseId>"
16
- ```
17
-
18
- ## Server-side setup
19
-
20
- 1. Copy `.env.production` from `shared/` into the release directory (or SCP it alongside the tarball if first deploy).
21
- 2. No `npm install` needed — `node_modules` was transferred directly.
22
- 3. Start PM2 on the inactive port. Health checks and traffic switch follow the standard flow (Groups 3-5 in SKILL.md).
23
-
24
- ## Why transfer node_modules
25
-
26
- Direct upload is optimized for "fast first deploy." Re-running `npm ci` on a low-spec server can be slow. Transferring pre-built artifacts means the server only needs to run the app.