|
| 1 | +--- |
| 2 | +name: add-service |
| 3 | +description: Add new entries to Deeploy services by collecting all mandatory details, researching the right image/env inputs, updating service fields correctly, and validating the result. |
| 4 | +metadata: |
| 5 | + short-description: Add a new Deeploy service safely. |
| 6 | +--- |
| 7 | + |
| 8 | +## Purpose |
| 9 | + |
| 10 | +Use this skill when the user asks to add a new Service (or update an existing one) in this repository. |
| 11 | + |
| 12 | +## Load Context First (Progressive) |
| 13 | + |
| 14 | +Read this minimal set first: |
| 15 | + |
| 16 | +- `src/data/services.ts` |
| 17 | +- `scripts/add-service.ts` |
| 18 | +- `scripts/validate-services.ts` |
| 19 | + |
| 20 | +Then load additional files only if needed: |
| 21 | + |
| 22 | +- `src/data/SERVICES.md`: only when examples/recommendations are needed. |
| 23 | +- `src/shared/SmallTag.tsx`: only when `color` is missing/invalid/uncertain. |
| 24 | +- `src/data/dynamicEnvTypes.ts`: only when using `dynamicEnvVars`. |
| 25 | +- `src/lib/deeploy-utils.ts`: only when using advanced fields or checking payload behavior (`dynamicEnvVars`, `pipelineParams`, `pluginParams`, `buildAndRunCommands`, tunneling token keys). |
| 26 | + |
| 27 | +Use targeted search (`rg`) and read narrow snippets instead of full files whenever possible. Do not reload unchanged files unless uncertainty remains. |
| 28 | + |
| 29 | +## Canonical Service Shape |
| 30 | + |
| 31 | +From `src/data/services.ts`, a Service supports: |
| 32 | + |
| 33 | +- Mandatory: `id`, `name`, `description`, `image`, `port`, `inputs`, `logo`, `color`, `pluginSignature`, `tunnelEngine` |
| 34 | +- Optional: `envVars`, `dynamicEnvVars`, `volumes`, `fileVolumes`, `buildAndRunCommands`, `pipelineParams`, `pluginParams` |
| 35 | + |
| 36 | +Important constraints currently enforced by scripts/code: |
| 37 | + |
| 38 | +- `description` must be `<= 100` chars. |
| 39 | +- `port` must be numeric and valid for network usage. |
| 40 | +- `logo` extension must be `.svg` or `.png`. |
| 41 | +- `logo` file must exist in `public/services`. |
| 42 | +- `color` must be one of the `ColorVariant` values in `src/shared/SmallTag.tsx`. |
| 43 | +- `pluginSignature` must be `CONTAINER_APP_RUNNER` or `WORKER_APP_RUNNER`. |
| 44 | +- `tunnelEngine` must be `cloudflare` or `ngrok`. |
| 45 | +- `dynamicEnvVars` entries must use exactly 3 typed values each. |
| 46 | + |
| 47 | +Plugin-signature behavior: |
| 48 | + |
| 49 | +- `CONTAINER_APP_RUNNER`: requires a Docker image that is ready to run directly. |
| 50 | +- `WORKER_APP_RUNNER`: can be used when there is no prebuilt app image and setup must happen at runtime from source; in this mode `buildAndRunCommands` is required. |
| 51 | +- In the current repo schema, `image` is still a required Service field even for `WORKER_APP_RUNNER`, so provide a runtime/base image and pair it with `buildAndRunCommands`. |
| 52 | +- For `WORKER_APP_RUNNER` services, treat `pluginParams.VCS_DATA` as mandatory: |
| 53 | + - `VCS_DATA.REPO_URL` is required. |
| 54 | + - `VCS_DATA.USERNAME` and `VCS_DATA.TOKEN` are required when repository access is private. |
| 55 | + |
| 56 | +## Research-First Workflow (Mandatory) |
| 57 | + |
| 58 | +When the request is like "add new X service", do this order: |
| 59 | + |
| 60 | +1. Research official sources first and build a draft configuration yourself. |
| 61 | +2. Present the inferred configuration to the user with sources used. |
| 62 | +3. Ask confirmation questions only for missing, ambiguous, or low-confidence fields. |
| 63 | +4. Edit files only after the user confirms unresolved details. |
| 64 | + |
| 65 | +Do not start by asking the user every field if the service can be reliably inferred. |
| 66 | + |
| 67 | +## Mandatory Confirmation Questions |
| 68 | + |
| 69 | +After proposing the draft, ask for confirmation/inputs for unresolved required fields: |
| 70 | + |
| 71 | +1. Service display name. |
| 72 | +2. Short description (max 100 chars). |
| 73 | +3. Docker image including tag (avoid ambiguous `latest` unless user explicitly asks for it). |
| 74 | +4. Exposed container port. |
| 75 | +5. Plugin signature (`CONTAINER_APP_RUNNER` or `WORKER_APP_RUNNER`). |
| 76 | +6. Tunnel engine (`cloudflare` or `ngrok`). |
| 77 | +7. Tag color variant. |
| 78 | +8. Logo filename (`.svg` or `.png`) and whether the logo file exists in `public/services`. |
| 79 | + |
| 80 | +Also confirm these optional groups (only ask when relevant to the chosen service): |
| 81 | + |
| 82 | +1. Required user-provided inputs (`inputs`) with key, label, description, placeholder, default value. |
| 83 | +2. Static env vars (`envVars`). |
| 84 | +3. Dynamic env vars (`dynamicEnvVars`, each with exactly 3 values). |
| 85 | +4. Persistent volumes (`volumes`) and file volumes (`fileVolumes`). |
| 86 | +5. Build/start commands (`buildAndRunCommands`). |
| 87 | +6. Pipeline parameters JSON (`pipelineParams`). |
| 88 | +7. Root plugin params JSON (`pluginParams`). |
| 89 | + |
| 90 | +If any mandatory field is still uncertain, stop and ask targeted follow-up questions before editing. |
| 91 | + |
| 92 | +Conditional mandatory rule: |
| 93 | + |
| 94 | +- If `pluginSignature` is `WORKER_APP_RUNNER` and there is no prebuilt runnable app image, `buildAndRunCommands` is mandatory and must be explicitly confirmed. |
| 95 | +- If `pluginSignature` is `WORKER_APP_RUNNER`, `pluginParams.VCS_DATA.REPO_URL` is mandatory and must be explicitly confirmed. |
| 96 | +- If the repository is private, `pluginParams.VCS_DATA.USERNAME` and `pluginParams.VCS_DATA.TOKEN` are mandatory and must be explicitly confirmed. |
| 97 | + |
| 98 | +## How To Infer Configuration Reliably |
| 99 | + |
| 100 | +Use official documentation as primary sources (in priority order): |
| 101 | + |
| 102 | +1. Official product docs. |
| 103 | +2. Official Docker image documentation (publisher-maintained). |
| 104 | +3. Official source repository docs (`README`, deployment docs). |
| 105 | + |
| 106 | +Infer and prefill at least: |
| 107 | + |
| 108 | +- image + pinned/stable tag |
| 109 | +- default exposed port |
| 110 | +- required setup env vars and credentials |
| 111 | +- persistent data directories for volumes |
| 112 | +- entrypoint/build commands if worker-style setup is required |
| 113 | +- likely tunnel choice (`cloudflare` for HTTP(S), `ngrok` for non-HTTP/TCP use) |
| 114 | + |
| 115 | +Rules: |
| 116 | + |
| 117 | +1. Prefer official/maintained images and namespaces. |
| 118 | +2. Prefer stable explicit tags; never silently choose `latest`. |
| 119 | +3. Map secret/user-provided values into `inputs`. |
| 120 | +4. Map fixed defaults into `envVars`. |
| 121 | +5. Add durable storage paths into `volumes` for stateful apps. |
| 122 | +6. If two or more valid configs exist, present options and ask the user to choose. |
| 123 | +7. If choosing `WORKER_APP_RUNNER` for a source-based setup, always infer and propose `buildAndRunCommands` and verify they are sufficient to produce runnable artifacts (maybe by running a local container to test, if applicable). |
| 124 | +8. If choosing `WORKER_APP_RUNNER`, always infer and propose `VCS_DATA` with at least `REPO_URL`; include `USERNAME` and `TOKEN` when private repository access is needed. |
| 125 | + |
| 126 | +Reliability gate: |
| 127 | + |
| 128 | +- If information is not 100% reliable (conflicting docs, unclear env requirements, unclear port/storage), explicitly say what is uncertain and ask focused questions before editing. |
| 129 | + |
| 130 | +## Edit Workflow |
| 131 | + |
| 132 | +1. Ensure the logo file is present in `public/services/<logo-filename>`. |
| 133 | +2. If no suitable logo exists locally, try to download an SVG from reliable sources in this order: |
| 134 | + |
| 135 | +- official product/brand assets page |
| 136 | +- official GitHub repository assets |
| 137 | +- trusted public logo repositories (for example Simple Icons) when official assets are unavailable |
| 138 | + |
| 139 | +3. Prefer SVG over PNG, use a clearly named filename, and verify the file renders correctly. |
| 140 | +4. If a reliable logo source cannot be found with high confidence, stop and ask the user for the logo file or preferred source. |
| 141 | +5. Add/update the service object in `src/data/services.ts`. |
| 142 | +6. Set `id` to the next available integer (`max existing id + 1`) for new services. |
| 143 | +7. Keep formatting consistent with repository style. |
| 144 | +8. Include optional fields only when needed, but do not omit critical runtime fields (for example persistent `volumes` for stateful services). |
| 145 | +9. If using `npm run add-service`, review output and manually patch missing fields (notably `volumes` / `fileVolumes`) when required. |
| 146 | + |
| 147 | +## Validation Before Finishing |
| 148 | + |
| 149 | +Run and check: |
| 150 | + |
| 151 | +- `npm run validate-services` |
| 152 | +- `npm run lint` (if TypeScript files changed) |
| 153 | + |
| 154 | +If validation fails, fix issues before returning final output. |
| 155 | + |
| 156 | +## Response Contract |
| 157 | + |
| 158 | +In the final response: |
| 159 | + |
| 160 | +- List what was added/changed. |
| 161 | +- Confirm validation results. |
| 162 | +- List the sources used to infer the configuration and what each source confirmed. |
| 163 | +- Call out assumptions made. |
| 164 | +- If anything remains uncertain, ask focused follow-up questions. |
0 commit comments