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,241 +1,215 @@
1
1
  ---
2
2
  name: "prizmkit-deploy"
3
- description: "Universal deployment gateway for PrizmKit projects. Discovers project type and deployment target, then routes to SSH Linux automation, cloud platform guidance, Docker guidance, or documented fallback. Also operates existing deployments: status, logs, restart, rollback, health, history, and validate. Use whenever the user asks to deploy, host, go live, release, take live, check deployment status, view logs, restart, rollback, or troubleshoot server operations. If the user says only 'ship it', clarify whether they mean commit or deploy before invoking. (project)"
3
+ description: "Capability-driven deployment and online-operations gateway for arbitrary projects and targets. Discovers project-native evidence and real tool capabilities, classifies semantic deployment capabilities as verified, dynamic, manual, or unsupported, then compiles a risk-gated plan or collaborates at human checkpoints. Handles deploy, status, health, bounded logs, restart, rollback, history, validate, diagnose, takeover, and interrupted-session resume without promising unattended automation. If the user says only 'ship it', clarify commit versus deploy first. (project)"
4
4
  ---
5
5
 
6
- # PrizmKit Deploy — Universal Deployment Gateway
6
+ # PrizmKit Deploy — Capability-Driven Gateway
7
7
 
8
- `/prizmkit-deploy` is the deployment and operations entry point. It discovers what is being deployed, where it should run, and which adapter or fallback applies.
8
+ `/prizmkit-deploy` assesses and collaborates on deployment and online operations for the current project. It does not route by language, framework, controller, provider, tool, or operating-system name. Those names are evidence only.
9
9
 
10
- Possible outcomes:
10
+ **Universal means truthful assessment and collaboration, not guaranteed unattended automation.** A target can require login, MFA, browser approval, a manual action, or a capability the current environment cannot perform.
11
11
 
12
- 1. **Full automation** — SSH Linux server for supported Node.js apps using PM2 + Nginx blue/green.
13
- 2. **Guided setup** — cloud platforms or Docker where user CLI/account steps are required.
14
- 3. **Documented fallback** — unsupported project/target combinations get deploy documentation and an adapter-gap record.
12
+ ## Scope
15
13
 
16
- ### When to Use
17
- - User says "deploy", "go live", "take this live", "release", "deploy to Vercel", "deploy to my server"
18
- - User wants deploy status, logs, restart, rollback, health checks, history, or validation
19
- - First-time deployment configuration or existing deployment repair/takeover
20
- - Any deployment, hosting, or server operation question
14
+ Use this Skill for:
21
15
 
22
- ### When NOT to Use
23
- - User says only "ship it" clarify commit vs deploy first
24
- - Local development startup use project dev scripts or `/run`
25
- - Pure CI test failure unrelated to deployment
26
- - User wants application code changes — use `/prizmkit-plan` and `/prizmkit-implement`
16
+ - deploy and release requests;
17
+ - status, health, bounded logs, restart, stop, rollback, and history;
18
+ - configuration validation, diagnostics, and existing-deployment takeover;
19
+ - authentication checkpoints and interruption recovery related to the current deployment.
27
20
 
28
- ## Data Safety Gate
21
+ Do not use it for unrelated application implementation, general server administration, or resources outside the current project and its necessary deployment dependencies. Assume one operator. Make no concurrent-write or locking guarantee.
29
22
 
30
- Before executing any command that could irreversibly destroy, overwrite, or modify data, pause and get explicit user confirmation.
23
+ If the request is only “ship it,” clarify commit versus deployment. In a non-interactive run where that ambiguity cannot be resolved, return `BLOCKED`; never guess.
31
24
 
32
- Danger signals:
25
+ ## Semantic Protocol
33
26
 
34
- | Category | Examples | Action |
27
+ The capability vocabulary is:
28
+
29
+ ```text
30
+ discover, connect, authenticate, build, package, transfer, configure, migrate,
31
+ release, start, stop, restart, rollback, status, health, logs, history, validate,
32
+ diagnose, takeover
33
+ ```
34
+
35
+ Every applicable capability is `verified`, `dynamic`, `manual`, or `unsupported` and has evidence, preconditions, inputs, effects, risk, confirmation, execution, verification, and failure recovery. Read `${SKILL_DIR}/references/capability-contract.md` before classifying capabilities or deriving a plan.
36
+
37
+ Operation set:
38
+
39
+ ```text
40
+ deploy, status, health, logs, stop, restart, rollback, history, validate,
41
+ diagnose, takeover, resume, cancel
42
+ ```
43
+
44
+ Authentication, login, MFA, browser approval, and other user actions are checkpoints inside an operation, not target routes.
45
+
46
+ ## Managed Artifact Boundary
47
+
48
+ Prefer existing project-native deployment configuration. PrizmKit owns at most these two new artifacts:
49
+
50
+ | Identity | Role | Write rule |
35
51
  |---|---|---|
36
- | Database reset/loss | `prisma migrate reset`, `DROP TABLE`, `TRUNCATE`, broad `DELETE`/`UPDATE` | Explain data loss and require clear yes/no confirmation |
37
- | File/system overwrite | `rm -rf`, writes under `/etc/`, overwriting existing config without backup | Confirm and back up when applicable |
38
- | Cloud/resource deletion | `terraform destroy`, `kubectl delete`, bucket/resource deletion | Confirm exact resources and impact |
39
- | Production traffic switch | first production deploy, rollback, Nginx upstream change | Confirm target environment and rollback plan |
52
+ | `.prizmkit/deploy/deploy.json` | Sole local non-sensitive deployment record | Validate with `${SKILL_DIR}/references/deploy-record-schema.json` plus the semantic validator; atomically replace only after the applicable plan confirmation |
53
+ | `prizmkit.deploy.json` | Optional version-controlled non-sensitive declaration | Create or modify only after showing an exact complete file preview and receiving explicit confirmation; validate with `${SKILL_DIR}/references/deployment-declaration-schema.json` plus the semantic validator |
40
54
 
41
- If a destructive data operation is detected in headless mode, refuse with `DATA_SAFETY_DENIED`; unattended pipelines must not destroy data.
55
+ Do not create a PrizmKit state, config, template, document, script, pending-input file, metadata file, or history file per language, framework, target, capability, phase, release, or event. Do not create local Secret storage. Secret values stay in user- or target-owned Secret systems; the local record and optional declaration store references and presence only.
42
56
 
43
- Read `${SKILL_DIR}/references/data-safety-examples.md` when concrete examples are needed.
57
+ The optional declaration is advisory evidence. It never proves that a tool is installed, authentication is current, the target is authorized, a command is safe, or deployment is approved.
44
58
 
45
- ## Discovery
59
+ ### Managed Artifact Validation
46
60
 
47
- Before deploying, discover project and target.
61
+ Before trusting an existing managed artifact or accepting a complete write candidate, require both schema validation and semantic validation:
48
62
 
49
- ### Project Detection
63
+ 1. validate the complete object with its matching Draft 2020-12 schema;
64
+ 2. run `python3 ${SKILL_DIR}/scripts/validate-deploy-artifact.py --kind <record|declaration> <path>` against the exact regular file without following a symlink;
65
+ 3. require exit zero and exactly `{"valid":true,"errors":[]}` before using managed fields or replacing/confirming the artifact;
66
+ 4. on failure, retain the original/candidate evidence, report only bounded error codes and JSON paths, and return `BLOCKED` before execution or `FAILED` after a confirmed live write as applicable.
50
67
 
51
- Scan build/package files and classify:
68
+ The shipped script is a read-only semantic companion, not a schema replacement. It checks duplicate keys, canonical project-relative paths, profile identity/references, the exact verification-layer set, success consistency, and forbidden sensitive/raw-output field shapes without displaying values. If either validation capability is unavailable, do not guess, drop unknown data, or accept the managed artifact.
52
69
 
53
- | Signal | Classification |
54
- |---|---|
55
- | `package.json` with `next` | Next.js |
56
- | `package.json` with `vite` | Vite frontend |
57
- | generic `package.json` | Node.js |
58
- | `requirements.txt` / `pyproject.toml` | Python |
59
- | `go.mod` | Go |
60
- | `Cargo.toml` | Rust |
61
- | `Dockerfile` | Docker image |
62
- | `docker-compose.yml` | Docker Compose |
70
+ ### Sole-Record Update Policy
63
71
 
64
- Also detect:
65
- - environment variables referenced in source
66
- - ports/listen calls
67
- - database dependencies
68
- - existing deployment config at `.prizmkit/deploy/deploy.config.json`
72
+ For every confirmed `deploy.json` write:
69
73
 
70
- ### Target Detection
74
+ 1. read and validate the existing record without following a symlink or dropping unknown data;
75
+ 2. build one complete candidate, preserving fields not intentionally changed by the confirmed plan;
76
+ 3. update `current` only from verified live/release/health/rollback evidence, set the complete `latest_result`, append one concise redacted `history` summary, retain only the newest 50 summaries, and set or clear minimal `recovery` according to the terminal state;
77
+ 4. reject Secret-like values, raw command output, full logs, duplicate profile identities, and dangling profile references;
78
+ 5. write the complete candidate to a temporary regular file in the same directory, run its schema and semantic validations, close it, atomically replace the record, then read back and repeat both validations against exact content;
79
+ 6. if replacement or read-back validation fails, return `FAILED`, report target-live/local-record-stale when applicable, and rediscover target state before any repair.
71
80
 
72
- Priority:
81
+ Trimming the bounded new-record history is part of this disclosed update policy; it never deletes or alters legacy evidence. This atomic replacement contract assumes one operator and makes no concurrent-write claim.
73
82
 
74
- 1. User-specified target: Vercel, own server, Docker, etc.
75
- 2. Existing config: `.prizmkit/deploy/deploy.config.json`
76
- 3. Project files: `vercel.json`, `netlify.toml`, `fly.toml`, `Dockerfile`, `docker-compose.yml`, GitHub deploy workflow, `app.yaml`, `serverless.yml`
77
- 4. Interactive question: ask where the project should be deployed
78
- 5. Headless with missing target: exit `NEEDS_INPUT` and atomically write `.prizmkit/deploy/pending-input.json` conforming to `${SKILL_DIR}/references/pending-input-schema.json`
83
+ When an existing `.prizmkit/deploy/` directory contains legacy artifacts, read `${SKILL_DIR}/references/legacy-migration.md` before any managed write. Preserve uncertain evidence and stop all legacy write patterns.
79
84
 
80
- ## Adapter Routing
85
+ ## Workflow
81
86
 
82
- | Target | Route | Reference |
83
- |---|---|---|
84
- | SSH Linux server + Node.js project | Full automation | `references/ssh-adapter-flow.md` |
85
- | Vercel / Netlify / Fly.io | Guided CLI setup | `references/cloud-platform-deploy.md` |
86
- | Docker / Docker Compose | Guided build/run | `references/docker-deploy.md` |
87
- | Unsupported target or project type | Documented fallback | §Unsupported Fallback |
87
+ ### 1. Normalize Intent and Boundary
88
+
89
+ 1. Resolve one operation from the operation set.
90
+ 2. Bind the current project root and requested target/profile. Reject traversal into unrelated projects or infrastructure.
91
+ 3. Separate read-only discovery from possible writes.
92
+ 4. For a real-resource test request, stop ordinary flow and apply `${SKILL_DIR}/references/real-resource-test-policy.md`.
93
+ 5. If `deploy.json` exists, run its schema and semantic validations before using any field. Unknown schema versions, malformed objects, unsafe paths/references, incomplete terminal evidence, or Secret-like values block managed writes; do not “repair” by dropping unknown data.
94
+
95
+ No-argument behavior: assess a deploy if target evidence exists; otherwise perform read-only discovery and return `WAITING_USER` with the missing non-secret target decision. A no-argument invocation is not plan confirmation.
96
+
97
+ ### 2. Discover Evidence Read-Only
98
+
99
+ Read only what is needed:
100
+
101
+ - project-native manifests, build/release/runtime configuration, health definitions, deployment files, and source references needed to identify commands and ports;
102
+ - the sole local record and optional declaration, if present and valid;
103
+ - target facts supplied by the user or observed through proven read-only inspection;
104
+ - installed-tool version/help/capability output and current authentication identity, using non-mutating probes;
105
+ - official documentation for the detected language, framework, target, and tool versions when dynamic derivation is needed.
106
+
107
+ Record evidence origin, observation, freshness, and whether it was read directly or user-supplied. A filename or target label alone is not proof. Respect actual connection and service ports; never substitute a conventional or fixed port.
108
+
109
+ Do not expose Secret values discovered in files, command output, environment, URLs, headers, or logs. Retain only a Secret name/reference and presence state.
110
+
111
+ ### 3. Build the Capability Matrix
112
+
113
+ Use the capability contract to classify every capability required by the operation:
88
114
 
89
- Compatibility check before SSH: the full SSH adapter currently requires a Node.js project with `package.json`. Non-Node Linux server targets route to Unsupported Fallback with an adapter-gap note.
115
+ - prefer a verified recipe only when its complete evidence fingerprint still matches;
116
+ - otherwise derive a dynamic plan only from current project evidence, real installed-tool capability, and official documentation;
117
+ - use `manual` when a human must act, and state the exact action plus revalidation;
118
+ - use `unsupported` when evidence or executable capability is absent, and report the gap and safe alternatives.
90
119
 
91
- ## Mode Detection
120
+ Dynamic is not a weaker safety mode. Dynamic, verified, and mixed plans pass the same policy and confirmation gates. Never turn guidance copied from memory or an unofficial example into executable evidence.
92
121
 
93
- Interactive mode:
94
- - May ask questions and request approvals.
95
- - May deploy to dev, test, or production.
96
- - Production requires explicit confirmation before execution.
122
+ ### 4. Choose Read-Only Execution or Compile a Plan
97
123
 
98
- Headless mode:
99
- - Never wait for user input.
100
- - May target only dev or test environments.
101
- - Reject production with `ENVIRONMENT_DENIED`.
102
- - If required info is missing, exit `NEEDS_INPUT` and atomically write `.prizmkit/deploy/pending-input.json` from `${SKILL_DIR}/references/pending-input-schema.json`. Include only unanswered non-secret configuration questions, replace stale pending content on each attempt, and delete the file after those inputs are resolved and persisted.
103
- - Never request passwords, tokens, private keys, connection strings, or other secret values through `pending-input.json`.
104
- - Perform only actions already authorized by `deploy.config.json`.
124
+ Read-only, project-scoped discovery, status, health, bounded logs, history, validation, and diagnostics may execute directly when every selected command is proven read-only. Report their evidence without mutating the target or local record.
105
125
 
106
- ## Command Routing
126
+ A diagnostic command that may write, restart, install, repair, rotate, prune, migrate, or change authentication is not read-only and must enter the plan.
107
127
 
108
- Determine intent from the first word after `/prizmkit-deploy`:
128
+ For deploy or any mutating operation, read `${SKILL_DIR}/references/policy-and-execution.md` and compile the complete immutable plan. Every step must contain:
109
129
 
110
130
  ```text
111
- /prizmkit-deploy -> deploy if config exists, otherwise configure
112
- /prizmkit-deploy configure -> first-run or repair configuration wizard
113
- /prizmkit-deploy deploy -> full deployment pipeline
114
- /prizmkit-deploy status -> show runtime and active release status
115
- /prizmkit-deploy logs --app <id> -> show recent logs
116
- /prizmkit-deploy restart --app <id> -> restart active app process and health check
117
- /prizmkit-deploy rollback --app <id> [--to <releaseId>] -> rollback
118
- /prizmkit-deploy health --app <id> -> run health checks
119
- /prizmkit-deploy history -> list deploy history
120
- /prizmkit-deploy validate -> validate config and target without deploying
131
+ capability, availability, evidence, preconditions, inputs, effects, risk,
132
+ confirmation, execution, verification, failure_handling, idempotency, retry,
133
+ unknown_outcome_inspection
121
134
  ```
122
135
 
123
- No-arg behavior:
124
- - If config is missing, start configuration.
125
- - If config exists and validates, show deployment summary and ask for environment.
126
- - If config exists but is incomplete or stale, enter repair flow.
136
+ Bind the plan to project root, target identity, release input, ordered steps, command arguments/actions, effects, and risk. Show the complete plan before requesting confirmation. A request to deploy is not itself confirmation of the compiled plan; silence, an old approval, or approval of a different plan is not confirmation.
127
137
 
128
- ## Artifact Structure
138
+ ### 5. Apply Confirmation Policy
129
139
 
130
- Managed deployment artifacts live under `.prizmkit/deploy/`:
140
+ - **Direct:** proven read-only, project-scoped actions.
141
+ - **Complete-plan confirmation:** ordinary reversible writes, including the planned atomic local-record update.
142
+ - **Dedicated confirmation:** project/source file creation or modification; privileged/global or compatibility-sensitive install/upgrade; destructive or irreversible migration; shared infrastructure; plan expansion; replay after an unknown write outcome; or deployment without reliable rollback.
143
+
144
+ A missing rollback mechanism does not automatically block deployment. Continue only after an exact dedicated risk-acceptance confirmation that identifies live-state risk and manual recovery. Store the fact and scope of confirmation, never credentials or unrelated conversation.
145
+
146
+ Any changed target, command, argument, input, effect, scope, evidence assumption, or risk invalidates confirmation. Compile and preview a new plan.
147
+
148
+ ### 6. Execute with Progress and Human Checkpoints
149
+
150
+ Execute the confirmed plan in order. Before each step, recheck preconditions and confirmation validity. Report the capability, step state, and bounded evidence; do not promise a universal duration.
151
+
152
+ - Never silently install, upgrade, overwrite, delete, expand scope, or replay a write.
153
+ - Only proven read-only or idempotent operations may use the plan's bounded retry.
154
+ - On timeout/disconnect after a possible write, mark the outcome unknown and inspect before replay.
155
+ - Analyze every database migration for reversibility, locking/downtime, data impact, backup/restore evidence, sequencing, and recovery conditions.
156
+ - Bound logs by time and/or line count and redact before display or persistence.
157
+
158
+ For login, MFA, browser approval, or manual action:
159
+
160
+ 1. stop before dependent execution;
161
+ 2. report `WAITING_USER` and the exact non-secret action;
162
+ 3. store only the plan digest, last proven step, minimal confirmation receipts, pending checkpoint, and bounded observations in `deploy.json` when that write was confirmed;
163
+ 4. after the user acts, revalidate target identity, authentication/authorization, capability evidence, and the expected postcondition;
164
+ 5. resume only if the immutable plan still matches; otherwise compile a new plan.
165
+
166
+ `cancel` stops future steps, performs only already-confirmed safe cleanup, records residual resources, and returns `CANCELLED`.
167
+
168
+ ### 7. Verify, Recover, and Report
169
+
170
+ Read `${SKILL_DIR}/references/verification-and-recovery.md` before deciding an outcome. Check every applicable layer:
171
+
172
+ 1. command or target-control result;
173
+ 2. process, service, container, or release state;
174
+ 3. configured health boundary;
175
+ 4. external URL;
176
+ 5. bounded startup logs.
177
+
178
+ Each layer is `PASSED`, `FAILED`, `INACCESSIBLE`, or `NOT_APPLICABLE`. Inaccessible and inapplicable are not passes. A required failed or inaccessible layer prevents `SUCCEEDED`; command exit alone is never sufficient.
179
+
180
+ On failure or interruption, observe current state before action. Offer rollback only when the rollback mechanism and target release are verified. Without verified rollback, report live state, residual resources, and manual recovery explicitly.
181
+
182
+ Terminal status is exactly one of:
131
183
 
132
184
  ```text
133
- .prizmkit/deploy/
134
- deploy.md
135
- deploy.config.json
136
- pending-input.json # present only while non-secret input is unresolved
137
- deploy-history/
138
- secrets.local.env # optional, ignored, permission-restricted dotenv data
185
+ SUCCEEDED, FAILED, BLOCKED, WAITING_USER, CANCELLED
139
186
  ```
140
187
 
141
- Read `${SKILL_DIR}/references/deploy-config-schema.md` when writing or validating config, `${SKILL_DIR}/references/deploy-history-schema.md` when writing history records, `${SKILL_DIR}/references/pending-input-schema.json` when writing unresolved questions, and `${SKILL_DIR}/assets/deploy-document-template.md` whenever creating or updating `deploy.md`.
142
-
143
- `secrets.local.env` contains dotenv `KEY=value` lines, never JSON. Verify an exact ignore rule and current-user-only permissions before writing it. Encrypted-secret files and generated deployment scripts are not supported artifacts; do not advertise or create them.
144
-
145
- Other files are generated only through these explicit target-native contracts:
146
-
147
- | Output | Naming/content contract |
148
- |---|---|
149
- | `.github/workflows/deploy.yml` | `references/ci-cd-workflows.md` |
150
- | `vercel.json`, `netlify.toml`, `fly.toml` | `references/cloud-platform-deploy.md`; generate only the selected platform file |
151
- | `deploy-<releaseId>.tar.gz` | `references/direct-upload.md` or CI workflow template |
152
- | `/etc/nginx/sites-available/<project>` | `references/nginx-blue-green.md` managed template and marker |
153
- | `<server-project>/shared/.env.production` | strict permission-restricted dotenv contract in `references/ssh-adapter-flow.md` |
154
- | `<server-project>/shared/deploy-metadata.json` | `references/deploy-metadata-schema.json` |
155
-
156
- Do not generate another framework-owned deployment file until its deterministic identity, writer, update/overwrite policy, secret boundary, and complete content contract are added here.
157
-
158
- Reference index:
159
- - `references/ssh-adapter-flow.md` — load when routing to SSH Linux full automation.
160
- - `references/deployment-modes.md` load when the user needs push/pull/direct-upload comparison.
161
- - `references/ssh-bootstrap-flow.md`, `references/firewall-setup.md`, `references/database-setup.md` — load during SSH bootstrap branches.
162
- - `references/direct-upload.md`, `references/ci-cd-workflows.md` — load for strategy-specific setup.
163
- - `references/dns-setup.md`, `references/ssl-setup.md` — load for domain and HTTPS setup.
164
- - `references/ssh-execution-flow.md`, `references/nginx-blue-green.md`, `references/ssh-takeover.md` — load for deploy execution, traffic switching, rollback, or takeover.
165
- - `references/cloud-platform-deploy.md`, `references/docker-deploy.md` — load for non-SSH guided routes.
166
- - `references/pending-input-schema.json`, `assets/deploy-document-template.md` load for managed pending-input and deployment-document writes.
167
- - `references/deploy-metadata-schema.json` load for atomic server active-slot metadata writes after verified SSH deploy/rollback operations.
168
- - `references/live-validation-notes.md` — load when troubleshooting bootstrap or deploy failures.
169
-
170
- Never record raw secret values in config, docs, or history. Secret presence metadata is allowed; raw values and unsalted hashes are not.
171
-
172
- ## SSH Automation Route
173
-
174
- When routing to SSH Linux full automation, read `${SKILL_DIR}/references/ssh-adapter-flow.md` first. That reference coordinates the detailed SSH sub-procedures:
175
-
176
- - deployment mode selection and first-run wizard
177
- - server model and directory layout
178
- - bootstrap and privileged action safety
179
- - direct upload vs CI/CD push vs CI/CD pull
180
- - DNS and SSL guidance
181
- - PM2 + Nginx blue/green execution
182
- - rollback and operations commands
183
- - secrets and multi-app coordination
184
-
185
- Key invariants:
186
- - Present privileged bootstrap plans before execution.
187
- - Back up existing config before modification.
188
- - Run `nginx -t` before reload.
189
- - Do not switch traffic until staged health checks pass.
190
- - If failure happens before traffic switch, leave the live version unchanged.
191
- - Preserve failed releases/logs for debugging.
192
-
193
- ## Cloud and Docker Routes
194
-
195
- Cloud platforms:
196
- - Read `references/cloud-platform-deploy.md`.
197
- - Detect required CLI/account steps.
198
- - Generate or update config and render `deploy.md` from `${SKILL_DIR}/assets/deploy-document-template.md` without duplicate headings.
199
- - Guide the user through interactive login or dashboard steps when needed.
200
-
201
- Docker:
202
- - Read `references/docker-deploy.md`.
203
- - Detect Dockerfile/Compose configuration.
204
- - Build/run/validate with explicit environment and volume handling.
205
- - For destructive volume or database operations, apply the Data Safety Gate.
206
-
207
- ## Unsupported Fallback
208
-
209
- When no adapter covers the detected target/project type:
210
-
211
- 1. Detect what you can: language, framework, build/start commands, env vars, port usage, databases.
212
- 2. Render `.prizmkit/deploy/deploy.md` from `${SKILL_DIR}/assets/deploy-document-template.md`, filling prerequisites, environment-variable names, build/start instructions, health checks, rollback limits, and manual actions.
213
- 3. Record adapter gap in deploy history using the event identity and content contract in `${SKILL_DIR}/references/deploy-history-schema.md`: missing adapter, detected project type, target, and fallback output.
214
- 4. Offer to generate basic CI/CD config when applicable.
215
-
216
- ## Validation
217
-
218
- Before production deploy, validate:
219
-
220
- - target connectivity
221
- - required tools
222
- - repository or artifact availability
223
- - port availability
224
- - required environment variables
225
- - process manager/runtime config
226
- - Nginx syntax when applicable
227
- - health check routes
228
- - rollback readiness
229
-
230
- Persist validation results in `deploy.config.json` under the relevant `validated` fields.
231
-
232
- ## Output
233
-
234
- Report:
235
- - detected project and target
236
- - selected adapter or fallback
237
- - environment and deploy strategy
238
- - actions performed
239
- - validation/health results
240
- - deploy history record path
241
- - next recommended action
188
+ ## Secret and Output Rules
189
+
190
+ Before display or persistence, redact credentials in URLs, authorization headers, tokens, keys, cookies, connection strings, environment assignments, and user-identified sensitive patterns. Prefer omission over masking when context is unnecessary. Do not persist raw command output or full logs.
191
+
192
+ The final result includes:
193
+
194
+ - terminal status and operation;
195
+ - target/profile and live state;
196
+ - release identity, if established;
197
+ - rollback availability;
198
+ - every verification layer and evidence boundary;
199
+ - residual resources and partial effects;
200
+ - local-record update result;
201
+ - recovery guidance and relevant next operations.
202
+
203
+ If the live change succeeded but a required health check or local-record update failed, return `FAILED` and describe the actual live state. Never label partial completion as success.
204
+
205
+ ## Reference Loading
206
+
207
+ Load only what the current operation needs:
208
+
209
+ - capability assessment or dynamic derivation → `${SKILL_DIR}/references/capability-contract.md`
210
+ - local record read/write → `${SKILL_DIR}/references/deploy-record-schema.json` and `${SKILL_DIR}/scripts/validate-deploy-artifact.py`
211
+ - optional declaration preview/write → `${SKILL_DIR}/references/deployment-declaration-schema.json` and `${SKILL_DIR}/scripts/validate-deploy-artifact.py`
212
+ - first use with legacy evidence → `${SKILL_DIR}/references/legacy-migration.md`
213
+ - any mutating plan `${SKILL_DIR}/references/policy-and-execution.md`
214
+ - verification, failure, rollback, interruption, or resume `${SKILL_DIR}/references/verification-and-recovery.md`
215
+ - any proposed external-resource test → `${SKILL_DIR}/references/real-resource-test-policy.md`
@@ -0,0 +1,137 @@
1
+ # Deployment Capability Contract
2
+
3
+ Use this contract to convert current project and target evidence into semantic deployment capabilities. Capability names are protocol identifiers; product, language, framework, controller, tool, provider, and operating-system names are not.
4
+
5
+ ## Capability Vocabulary
6
+
7
+ | Capability | Semantic outcome |
8
+ |---|---|
9
+ | `discover` | Establish project, target, release, configuration, dependency, and health evidence. |
10
+ | `connect` | Reach the intended target through an identified, authorized transport or control boundary. |
11
+ | `authenticate` | Establish and revalidate the operator identity and authorization needed by later actions. |
12
+ | `build` | Transform source into a verified build output using project-native instructions. |
13
+ | `package` | Produce or select a transferable/releasable artifact with identity and integrity evidence. |
14
+ | `transfer` | Move an artifact or source input across the required boundary without assuming compatibility of dependency directories. |
15
+ | `configure` | Apply project-scoped runtime, routing, environment, or target configuration. |
16
+ | `migrate` | Apply an analyzed data/schema/state transition. |
17
+ | `release` | Create, select, promote, or activate an identifiable release. |
18
+ | `start` | Start the project-owned runtime unit. |
19
+ | `stop` | Stop the project-owned runtime unit. |
20
+ | `restart` | Restart the project-owned runtime unit and verify recovery. |
21
+ | `rollback` | Restore a verified prior release/configuration/data state. |
22
+ | `status` | Observe current release and runtime state. |
23
+ | `health` | Evaluate the configured health boundary. |
24
+ | `logs` | Read bounded project-owned operational output. |
25
+ | `history` | Read concise local and target-native operation/release evidence. |
26
+ | `validate` | Check configuration, prerequisites, authorization, and plan consistency without deployment writes. |
27
+ | `diagnose` | Gather bounded project-scoped evidence for a deployment or runtime problem. |
28
+ | `takeover` | Discover ownership, coexistence, backup, and rollback boundaries before adopting an existing deployment. |
29
+
30
+ Select only capabilities applicable to the requested operation, but never omit a prerequisite merely because automation is unavailable.
31
+
32
+ ## Availability
33
+
34
+ Exactly one value applies to each selected capability:
35
+
36
+ | Availability | Required basis | Permitted behavior |
37
+ |---|---|---|
38
+ | `verified` | A maintained recipe plus a complete current evidence fingerprint matching all recipe constraints. | Compile the recipe's actions, still applying current policy, confirmation, and verification. |
39
+ | `dynamic` | Current project evidence, actual installed-tool capability, and applicable official documentation agree on a safe action. | Derive explicit actions and pass them through the same policy gate as a verified recipe. |
40
+ | `manual` | Automation ends at a user-controlled, credential, approval, UI, physical, or unavailable execution boundary. | State the exact user action, expected postcondition, and revalidation; return `WAITING_USER` when reached. |
41
+ | `unsupported` | Required evidence, access, compatible capability, or a safe execution method is absent. | Report the gap and safe alternatives; do not fabricate commands, mark completion, or promise support. |
42
+
43
+ `verified` describes evidence, not low risk. `dynamic` does not authorize experimentation. `manual` does not mean complete. An operation with a required `unsupported` capability is `BLOCKED` unless the user chooses an in-scope alternative plan.
44
+
45
+ ## Descriptor
46
+
47
+ Every selected capability descriptor contains all fields below. Empty lists are explicit; no field is omitted.
48
+
49
+ | Field | Contract |
50
+ |---|---|
51
+ | `name` | One capability from the vocabulary. |
52
+ | `availability` | `verified`, `dynamic`, `manual`, or `unsupported`. |
53
+ | `evidence` | Bounded observations with origin, observed fact, observation method, freshness, and relevance. No Secret values. |
54
+ | `preconditions` | Conditions that must be true immediately before execution. |
55
+ | `inputs` | Non-sensitive values/references bound into the action; Secret references identify an external source, never a value. |
56
+ | `effects` | Project, target, data, traffic, cost, credential, and residual-resource effects. |
57
+ | `risk` | `read_only`, `reversible_write`, `high_impact`, or `destructive`, with a plain-language reason. |
58
+ | `confirmation` | `none`, `complete_plan`, or one or more dedicated confirmation reasons. |
59
+ | `execution` | Exact executable plus argument array, target-native action, or human action. No incomplete shell fragment. |
60
+ | `verification` | Observable postconditions and whether each is required or optional. |
61
+ | `failure_recovery` | Stop condition, safe cleanup, inspection, rollback eligibility, and manual recovery when rollback is absent. |
62
+
63
+ Execution stays data-shaped where possible: executable and arguments are separate, the working directory is project-relative, and Secret material is injected by the user/target-owned system. Never interpolate an untrusted value into an opaque shell command.
64
+
65
+ ## Evidence Precedence and Conflict
66
+
67
+ Use the strongest current evidence, in this order:
68
+
69
+ 1. directly observed project-native configuration and target state;
70
+ 2. real installed-tool version/help/capability/authentication output;
71
+ 3. official documentation applicable to the observed version and target;
72
+ 4. the validated optional project declaration;
73
+ 5. the validated local record and preserved legacy evidence;
74
+ 6. user-supplied statements, labeled as such.
75
+
76
+ Lower evidence may identify what to inspect but does not override a current direct observation. On conflict, show the conflicting facts and use the safer state. A conflict affecting identity, effects, authorization, command shape, migration, health, or rollback blocks execution until resolved.
77
+
78
+ Evidence expires when the target identity, project revision, tool/runtime version, authentication identity, native configuration, health boundary, or release input changes. Re-observe affected descriptors before execution or resume.
79
+
80
+ ## Verified Recipe Gate
81
+
82
+ A recipe is eligible only when all of these match current evidence:
83
+
84
+ - project-native build/start/release interface and working directory;
85
+ - artifact format and controller/target compatibility;
86
+ - installed tool/runtime and relevant feature versions;
87
+ - target type, identity, transport, and authorization boundary;
88
+ - configuration ownership and actual connection/service ports;
89
+ - health boundary and required verification layers;
90
+ - rollback mechanism and release identity semantics;
91
+ - migration and persistent-data assumptions;
92
+ - declared effects and confirmation class.
93
+
94
+ The recipe records the evidence fingerprint used for the match. Partial matches, inferred defaults, stale versions, or a matching product name are not sufficient. When any required fingerprint field is missing or mismatched, reject the recipe and consider `dynamic`, `manual`, or `unsupported`.
95
+
96
+ A verified recipe never bypasses confirmation, Secret handling, data analysis, unknown-outcome inspection, or layered verification.
97
+
98
+ ## Dynamic Derivation Gate
99
+
100
+ A dynamic capability is permitted only when all three evidence sources are present and consistent:
101
+
102
+ 1. **Current project evidence:** native configuration or source establishes the intended command/action and inputs.
103
+ 2. **Real capability evidence:** the installed tool or reachable target exposes the required function and applicable version; a filename or remembered CLI is insufficient.
104
+ 3. **Official documentation:** documentation for the observed language/framework/target/tool version supports the exact action and semantics.
105
+
106
+ Then:
107
+
108
+ - construct a complete descriptor;
109
+ - classify every effect and confirmation boundary;
110
+ - use actual ports/endpoints and target identity;
111
+ - identify idempotency and unknown-outcome inspection;
112
+ - pass the step through the same immutable plan policy as a verified recipe;
113
+ - mark any remaining human boundary `manual` rather than hiding it inside a command.
114
+
115
+ If official documentation cannot be accessed, do not improvise a write. Read-only assessment may continue; the write is `manual` or `unsupported` with the missing evidence stated.
116
+
117
+ ## Availability Transitions
118
+
119
+ - `manual` → `verified` or `dynamic` only after the user action is complete and its postcondition, identity, and authorization are revalidated.
120
+ - `unsupported` → another state only after new evidence is observed; user optimism alone is not evidence.
121
+ - `verified` → `dynamic`, `manual`, or `unsupported` whenever its fingerprint no longer matches.
122
+ - Any state → blocked execution when preconditions, confirmation, or required verification cannot be established.
123
+
124
+ Record transition evidence in the operation result, not as an unbounded transcript.
125
+
126
+ ## Capability Dependencies by Intent
127
+
128
+ These are semantic starting points, not fixed routes:
129
+
130
+ - `deploy`: always `discover`, `validate`, `release`, and `health`; add connect/authenticate/build/package/transfer/configure/migrate/start/stop/rollback according to evidence and effects.
131
+ - `status`, `health`, `logs`, `history`: discover and connect/authenticate only when needed; remain read-only.
132
+ - `restart`, `stop`, `rollback`: discover current live/release state first, mutate only the current project's runtime/release, then verify health/live state.
133
+ - `validate`, `diagnose`: read-only by default; any repair or invasive probe becomes a separately confirmed mutating plan.
134
+ - `takeover`: discover ownership and conflicts, inspect backup/rollback/coexistence boundaries, and require a new plan before any adoption write.
135
+ - `resume`: rediscover all evidence referenced by the stored plan before continuing.
136
+
137
+ Required unavailable dependencies stay visible in the matrix. Do not collapse a partially assessable operation into a generic fallback success.