@codewizard-dt/bootstrap 3.2.0 → 5.1.0
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/README.md +18 -60
- package/bin/cli.js +0 -5
- package/lib/hooks/README.md +14 -5
- package/lib/hooks/lib/command-parse.js +28 -0
- package/lib/hooks/package-install-consent.js +60 -2
- package/lib/prompts/README.md +0 -1
- package/lib/scripts/README.md +20 -13
- package/lib/scripts/bootstrap-prefs.js +20 -1
- package/lib/scripts/migrate-project.sh +1 -1
- package/lib/scripts/setup-project.sh +0 -1
- package/lib/scripts/sync-wiki-scaffold.sh +3 -15
- package/lib/scripts/templates/CLAUDE-wiki.md +4 -4
- package/lib/scripts/templates/bootstrap-prefs-schema.json +10 -1
- package/lib/scripts/templates/wiki/conventions.md +1 -1
- package/lib/scripts/templates/wiki/dashboard.html +2 -2
- package/lib/scripts/templates/wiki/index.md +4 -4
- package/lib/scripts/templates/wiki/work/requirements/index.md +1 -1
- package/lib/scripts/templates/wiki/work/requirements/lifecycle.md +2 -2
- package/lib/scripts/templates/wiki/work/roadmaps/index.md +1 -1
- package/lib/scripts/templates/wiki/work/roadmaps/lifecycle.md +4 -4
- package/lib/scripts/templates/wiki/work/tasks/index.md +1 -1
- package/lib/scripts/templates/wiki/work/tasks/lifecycle.md +6 -6
- package/lib/scripts/templates/wiki/work/uat/index.md +1 -1
- package/lib/scripts/templates/wiki/work/uat/lifecycle.md +4 -4
- package/lib/scripts/wiki-dashboard-server.js +1 -1
- package/lib/skills/README.md +3 -1
- package/lib/skills/architecture-audit/SKILL.md +207 -0
- package/lib/skills/bootstrap-config/SKILL.md +1 -1
- package/lib/skills/bug-assess/SKILL.md +137 -0
- package/lib/skills/bug-close/SKILL.md +2 -2
- package/lib/skills/bug-file/SKILL.md +9 -5
- package/lib/skills/decision-create/SKILL.md +5 -1
- package/lib/skills/power-mode/SKILL.md +10 -10
- package/lib/skills/primer/SKILL.md +1 -1
- package/lib/skills/req-compile/SKILL.md +2 -2
- package/lib/skills/req-create/SKILL.md +13 -9
- package/lib/skills/req-extract-decisions/SKILL.md +10 -10
- package/lib/skills/req-finalize/SKILL.md +3 -3
- package/lib/skills/req-retire/SKILL.md +10 -10
- package/lib/skills/req-update/SKILL.md +4 -4
- package/lib/skills/roadmap-assess/SKILL.md +58 -20
- package/lib/skills/roadmap-create/SKILL.md +22 -22
- package/lib/skills/roadmap-next/SKILL.md +10 -10
- package/lib/skills/security-audit/SKILL.md +3 -0
- package/lib/skills/tackle/SKILL.md +3 -3
- package/lib/skills/task-add/SKILL.md +22 -22
- package/lib/skills/task-audit/SKILL.md +2 -2
- package/lib/skills/task-trash/SKILL.md +4 -4
- package/lib/skills/uat-generate/SKILL.md +22 -22
- package/lib/skills/uat-skip/SKILL.md +21 -21
- package/lib/skills/uat-walk/UAT-CORE.md +6 -6
- package/lib/skills/wiki-lint/SKILL.md +1 -1
- package/package.json +2 -4
- package/.github/workflows/docker-harness.yml +0 -26
- package/.github/workflows/security.yml +0 -24
- package/.gitleaks.toml +0 -15
- package/lib/prompts/setup-deployment.md +0 -322
- package/lib/scripts/setup-deployment.sh +0 -113
- package/raw/guides/deployment-strategy.md +0 -448
|
@@ -1,322 +0,0 @@
|
|
|
1
|
-
Scaffold the deployment infrastructure described in the guide above for the project at: __PROJECT_DIR__
|
|
2
|
-
|
|
3
|
-
## Your task
|
|
4
|
-
|
|
5
|
-
Inspect the project's structure (directory layout, existing Dockerfiles, package.json/pyproject.toml/go.mod, existing Makefile, existing docker-compose files), then create or update the files listed below using real project values — never placeholder strings like `<ORG>`, `<PROJECT>`, or `<LABEL>`.
|
|
6
|
-
|
|
7
|
-
**If you cannot confidently identify the services, their entrypoints, or their runtimes from the files you find, stop and ask the user before creating anything.**
|
|
8
|
-
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
### Step 1 — Detect services
|
|
12
|
-
|
|
13
|
-
Identify each deployable service by scanning for directories (or the repo root for single-service repos) that contain any of:
|
|
14
|
-
|
|
15
|
-
- `package.json` — Node.js. Check `scripts.dev` / `scripts.start` for the dev command and inspect `dependencies` to identify the framework: Vite, Next.js, Express, Fastify, etc.
|
|
16
|
-
- `pyproject.toml` or `requirements.txt` — Python. Check dependencies for `fastapi`/`uvicorn`, `flask`, `django`, etc.
|
|
17
|
-
- `go.mod` — Go.
|
|
18
|
-
- `Cargo.toml` — Rust.
|
|
19
|
-
|
|
20
|
-
For each service record: **runtime · framework · dev command · port · whether it proxies to another service**.
|
|
21
|
-
|
|
22
|
-
---
|
|
23
|
-
|
|
24
|
-
### Step 2 — Create or update files
|
|
25
|
-
|
|
26
|
-
#### 1. `.github/workflows/security.yml` — always overwrite
|
|
27
|
-
Generic; no project-specific content. Include:
|
|
28
|
-
- **CodeQL** — matrix over the detected languages (use `python`, `javascript-typescript`, `go`, etc. as appropriate)
|
|
29
|
-
- **Gitleaks** secret detection with `fetch-depth: 0`
|
|
30
|
-
|
|
31
|
-
#### 2. `.github/workflows/build.yml` — create or overwrite with confirmation
|
|
32
|
-
Fill in real image names, Dockerfile paths, and runner label. If the file already exists, show the user what you plan to write and ask for confirmation before overwriting.
|
|
33
|
-
|
|
34
|
-
#### 3. `.gitleaks.toml` — create or overwrite with confirmation
|
|
35
|
-
If the file already exists, show the user what you plan to write and ask for confirmation before overwriting.
|
|
36
|
-
|
|
37
|
-
#### 4. `Makefile` — merge Docker targets if a Makefile already exists; create from scratch if not
|
|
38
|
-
Add only the targets from the guide that are not already present. Never remove or reformat existing targets.
|
|
39
|
-
Set `GITHUB_USER ?= $(shell gh api user --jq .login 2>/dev/null)` so auth resolves at runtime rather than being hardcoded.
|
|
40
|
-
|
|
41
|
-
The deploy targets **must** use this exact shape (copy verbatim, substituting the real `$(PROJECT)` variable name):
|
|
42
|
-
|
|
43
|
-
```makefile
|
|
44
|
-
## deploy — sync compose file + Makefile to VPS then restart
|
|
45
|
-
deploy: deploy-sync
|
|
46
|
-
ssh $(PROJECT) "cd /opt/$(PROJECT) && make deploy-pull"
|
|
47
|
-
|
|
48
|
-
deploy-sync:
|
|
49
|
-
ssh $(PROJECT) "mkdir -p /opt/$(PROJECT)"
|
|
50
|
-
scp docker-compose.yml Makefile $(PROJECT):/opt/$(PROJECT)/
|
|
51
|
-
scp .env.production $(PROJECT):/opt/$(PROJECT)/.env
|
|
52
|
-
scp lib/scripts/setup-runner.sh $(PROJECT):~/setup-runner.sh
|
|
53
|
-
|
|
54
|
-
## setup-runner — upload and run the runner installer on the VPS
|
|
55
|
-
## Usage: make setup-runner RUNNER_TOKEN=<token>
|
|
56
|
-
setup-runner: deploy-sync
|
|
57
|
-
ssh $(PROJECT) "RUNNER_TOKEN=$(RUNNER_TOKEN) REPO_URL=$(REPO_URL) bash ~/setup-runner.sh"
|
|
58
|
-
|
|
59
|
-
## deploy-pull — pull new images and restart (run directly on the VPS)
|
|
60
|
-
deploy-pull: up
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
#### 5. `docker-compose.yml` — create or overwrite with confirmation
|
|
64
|
-
|
|
65
|
-
If the file already exists, show the user what you plan to write and ask for confirmation before overwriting. Production-style compose file. **Hard rules:**
|
|
66
|
-
- Every service **must** use a pre-built GHCR image (`image: ghcr.io/<org>/<project>-<service>:latest`).
|
|
67
|
-
- **No `build:` blocks** — image building belongs exclusively in `docker-compose.build.yml` and the CI workflow.
|
|
68
|
-
- Set realistic `healthcheck`, `restart: unless-stopped`, and environment variables with sane defaults.
|
|
69
|
-
- Declare named volumes for any stateful services (databases, caches).
|
|
70
|
-
|
|
71
|
-
#### 6. `docker-compose.build.yml` — create or overwrite with confirmation
|
|
72
|
-
|
|
73
|
-
If the file already exists, show the user what you plan to write and ask for confirmation before overwriting.
|
|
74
|
-
Local dev overlay. Layered on top of `docker-compose.yml` via:
|
|
75
|
-
```
|
|
76
|
-
docker compose -f docker-compose.yml -f docker-compose.build.yml up --build --wait
|
|
77
|
-
```
|
|
78
|
-
For each service:
|
|
79
|
-
- Add a `build:` block pointing to the service directory and its `Dockerfile.dev`
|
|
80
|
-
- Bind-mount the full source tree into the working directory (e.g. `./backend:/app`)
|
|
81
|
-
- **Shield installed dependencies with an anonymous volume** declared immediately after the source mount. This prevents the host bind mount from overwriting the container's installed packages:
|
|
82
|
-
- Node.js: `- /app/node_modules`
|
|
83
|
-
- Python venv: `- /app/.venv`
|
|
84
|
-
- Add others (e.g. `/app/.cargo`) for any runtime that installs into a subdirectory
|
|
85
|
-
- **Override service URLs that hardcode `localhost`**: inside Docker, `localhost` resolves to the container itself. Replace with the compose service name (e.g. `DATABASE_URL: postgresql+asyncpg://postgres:postgres@db:5432/mydb`)
|
|
86
|
-
- **Vite / Node frontend proxy targets**: Vite's dev-server proxy runs server-side (Node.js), so its `target` also can't use `localhost` to reach the backend container. Pass the backend address via an env var in the compose service (e.g. `PROXY_TARGET: http://backend:8000`) and update `vite.config.ts` to read it:
|
|
87
|
-
```ts
|
|
88
|
-
target: process.env.PROXY_TARGET ?? 'http://localhost:8000',
|
|
89
|
-
```
|
|
90
|
-
- **Vite `--host` flag**: the Vite dev server binds to `127.0.0.1` by default and is unreachable via Docker port mapping. Override the container command: `command: npx vite --host` (do not bake `--host` into the Dockerfile so the image stays usable outside Docker)
|
|
91
|
-
- Wire `depends_on` with `condition: service_healthy` for any service that requires the database to be ready before starting
|
|
92
|
-
|
|
93
|
-
#### 7. `Dockerfile.dev` + `docker-entrypoint.sh` per service — create or overwrite with confirmation
|
|
94
|
-
|
|
95
|
-
If any of these files already exist, show the user what you plan to write and ask for confirmation before overwriting.
|
|
96
|
-
Minimal, fast-to-build dev image. The guiding principle: **install dependencies in the image; let source arrive via the bind mount at runtime**.
|
|
97
|
-
|
|
98
|
-
**Use a `docker-entrypoint.sh` watcher script** for Node.js and Python services so that adding or removing a dependency inside the container is not needed — the entrypoint watches the manifest file for changes and automatically reinstalls + restarts the dev server. This makes the developer workflow seamless: edit `package.json` or `pyproject.toml` on the host, save, and the container self-heals.
|
|
99
|
-
|
|
100
|
-
**Node.js entrypoint pattern** (`docker-entrypoint.sh`, place alongside `Dockerfile.dev`):
|
|
101
|
-
```sh
|
|
102
|
-
#!/bin/sh
|
|
103
|
-
set -e
|
|
104
|
-
|
|
105
|
-
npm install
|
|
106
|
-
|
|
107
|
-
HASH=$(md5sum package.json | cut -d' ' -f1)
|
|
108
|
-
APP_PID=""
|
|
109
|
-
|
|
110
|
-
start_app() {
|
|
111
|
-
npx vite --host & # or: npm run dev &, npx ts-node-dev src/index.ts &, etc.
|
|
112
|
-
APP_PID=$!
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
stop_app() {
|
|
116
|
-
if [ -n "$APP_PID" ]; then
|
|
117
|
-
kill "$APP_PID" 2>/dev/null
|
|
118
|
-
wait "$APP_PID" 2>/dev/null || true
|
|
119
|
-
APP_PID=""
|
|
120
|
-
fi
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
start_app
|
|
124
|
-
|
|
125
|
-
while sleep 3; do
|
|
126
|
-
NEW=$(md5sum package.json | cut -d' ' -f1)
|
|
127
|
-
if [ "$NEW" != "$HASH" ]; then
|
|
128
|
-
echo "[entrypoint] package.json changed — reinstalling..."
|
|
129
|
-
npm install
|
|
130
|
-
HASH=$NEW
|
|
131
|
-
stop_app
|
|
132
|
-
start_app
|
|
133
|
-
fi
|
|
134
|
-
done
|
|
135
|
-
```
|
|
136
|
-
|
|
137
|
-
**Python entrypoint pattern** (`docker-entrypoint.sh`):
|
|
138
|
-
```sh
|
|
139
|
-
#!/bin/sh
|
|
140
|
-
set -e
|
|
141
|
-
|
|
142
|
-
pip install -e ".[dev]" --quiet # or: pip install -r requirements.txt --quiet
|
|
143
|
-
|
|
144
|
-
MANIFEST=${MANIFEST_FILE:-pyproject.toml} # override to requirements.txt if needed
|
|
145
|
-
HASH=$(md5sum "$MANIFEST" | cut -d' ' -f1)
|
|
146
|
-
APP_PID=""
|
|
147
|
-
|
|
148
|
-
start_app() {
|
|
149
|
-
uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload & # adjust module path
|
|
150
|
-
APP_PID=$!
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
stop_app() {
|
|
154
|
-
if [ -n "$APP_PID" ]; then
|
|
155
|
-
kill "$APP_PID" 2>/dev/null
|
|
156
|
-
wait "$APP_PID" 2>/dev/null || true
|
|
157
|
-
APP_PID=""
|
|
158
|
-
fi
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
start_app
|
|
162
|
-
|
|
163
|
-
while sleep 3; do
|
|
164
|
-
NEW=$(md5sum "$MANIFEST" | cut -d' ' -f1)
|
|
165
|
-
if [ "$NEW" != "$HASH" ]; then
|
|
166
|
-
echo "[entrypoint] $MANIFEST changed — reinstalling..."
|
|
167
|
-
pip install -e ".[dev]" --quiet
|
|
168
|
-
HASH=$NEW
|
|
169
|
-
stop_app
|
|
170
|
-
start_app
|
|
171
|
-
fi
|
|
172
|
-
done
|
|
173
|
-
```
|
|
174
|
-
|
|
175
|
-
The `Dockerfile.dev` copies and `chmod +x`s the entrypoint, then sets it as `CMD`:
|
|
176
|
-
|
|
177
|
-
- **Node.js frontend (Vite / CRA / Next dev mode)**: `FROM node:22-alpine`, `COPY package*.json ./`, `RUN npm ci`, `COPY docker-entrypoint.sh ./`, `RUN chmod +x docker-entrypoint.sh`, `CMD ["/bin/sh", "./docker-entrypoint.sh"]`. Do not `COPY` source. Adjust the `start_app` command in the entrypoint for the framework (Vite uses `--host` in the entrypoint; remove the compose `command:` override for Vite if using the entrypoint).
|
|
178
|
-
- **Node.js backend (Express / Fastify / etc.)**: same Dockerfile pattern; update `start_app` in the entrypoint to run the server with hot-reload (e.g. `node --watch src/index.js` or `npx ts-node-dev src/index.ts`).
|
|
179
|
-
- **Python (FastAPI/uvicorn)**: `FROM python:3.11-slim`, copy the manifest (`pyproject.toml` or `requirements.txt`), install deps, copy and `chmod +x` the entrypoint, set `CMD` to run it. Adjust the uvicorn module path (`app.main:app`) and install command to match the project. Do not `COPY` source.
|
|
180
|
-
- **Go**: `FROM golang:1.22-alpine`, copy `go.mod` + `go.sum`, `RUN go mod download`, `CMD ["go", "run", "./cmd/server"]` (adjust path). Use `air` for hot-reload if the project already depends on it. No entrypoint watcher needed — Go has no install-time manifest changes that require a restart.
|
|
181
|
-
- **Other runtimes**: apply the same principle — install deps in the image; source arrives via bind mount; dev server runs with hot-reload; add an entrypoint watcher if the runtime has a lockfile-driven install step.
|
|
182
|
-
|
|
183
|
-
#### 8. Caddy reverse proxy — create or overwrite with confirmation
|
|
184
|
-
|
|
185
|
-
If any Caddy files already exist, show the user what you plan to write and ask for confirmation before overwriting. Add Caddy when the project has **both a frontend and a backend service** (i.e. two separate containers that need to be served under a single domain). Skip this section for single-service projects or projects that already have a reverse proxy configured.
|
|
186
|
-
|
|
187
|
-
**`Dockerfile.caddy`**
|
|
188
|
-
```dockerfile
|
|
189
|
-
FROM caddy:2-alpine
|
|
190
|
-
COPY Caddyfile /etc/caddy/Caddyfile
|
|
191
|
-
```
|
|
192
|
-
|
|
193
|
-
**`Caddyfile`** (production — uses real domain, TLS handled automatically by Caddy):
|
|
194
|
-
```
|
|
195
|
-
<domain> {
|
|
196
|
-
handle /api/* {
|
|
197
|
-
reverse_proxy backend:<backend-port>
|
|
198
|
-
}
|
|
199
|
-
handle {
|
|
200
|
-
reverse_proxy frontend:<frontend-port>
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
```
|
|
204
|
-
- Replace `<domain>` with the project's real domain (e.g. `myapp.example.com`)
|
|
205
|
-
- Replace `backend:<backend-port>` with the compose service name and port (e.g. `backend:8000`)
|
|
206
|
-
- Replace `frontend:<frontend-port>` with the compose service name and port (e.g. `frontend:80`)
|
|
207
|
-
- Add additional `handle` blocks if the project has more routing rules
|
|
208
|
-
|
|
209
|
-
**`Caddyfile.local`** (local dev — plain HTTP on port 80, same routing, no TLS):
|
|
210
|
-
```
|
|
211
|
-
:80 {
|
|
212
|
-
handle /api/* {
|
|
213
|
-
reverse_proxy backend:<backend-port>
|
|
214
|
-
}
|
|
215
|
-
handle {
|
|
216
|
-
reverse_proxy frontend:<frontend-port>
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
```
|
|
220
|
-
|
|
221
|
-
**Integrate Caddy into compose files** — for each file, if a `caddy` entry already exists show the user the planned change and ask for confirmation before overwriting:
|
|
222
|
-
- In `docker-compose.yml`: add a `caddy` service using the GHCR image (`ghcr.io/<org>/<project>-caddy:latest`), ports `80:80` and `443:443`, and named volumes `caddy_data` and `caddy_config`.
|
|
223
|
-
- In `docker-compose.build.yml`: add a `caddy` override with `build: { context: ., dockerfile: Dockerfile.caddy }` and bind-mount `./Caddyfile.local:/etc/caddy/Caddyfile`.
|
|
224
|
-
- In `.github/workflows/build.yml`: add `caddy` to the build matrix.
|
|
225
|
-
|
|
226
|
-
---
|
|
227
|
-
|
|
228
|
-
### Step 3 — Provision the DigitalOcean droplet and GitHub Actions runner
|
|
229
|
-
|
|
230
|
-
#### 3a. Check for an existing droplet
|
|
231
|
-
|
|
232
|
-
Look for `DROPLET_IP` in the Makefile (search for the literal string `DROPLET_IP`).
|
|
233
|
-
|
|
234
|
-
- **If `DROPLET_IP` is already set** — a droplet exists. Skip to **3c** (runner setup).
|
|
235
|
-
- **If `DROPLET_IP` is absent** — proceed to **3b**.
|
|
236
|
-
|
|
237
|
-
#### 3b. Size and create the droplet
|
|
238
|
-
|
|
239
|
-
**Assess the appropriate droplet size** by examining what the project runs:
|
|
240
|
-
|
|
241
|
-
| Signal | Minimum slug |
|
|
242
|
-
|--------|-------------|
|
|
243
|
-
| Single static site or tiny API | `s-1vcpu-1gb` |
|
|
244
|
-
| One or two lightweight services (Node/Python) | `s-1vcpu-2gb` |
|
|
245
|
-
| Two or more services with a database | `s-2vcpu-4gb` |
|
|
246
|
-
| ML inference, heavy background workers, or 3+ services | `s-4vcpu-8gb` |
|
|
247
|
-
|
|
248
|
-
Then ask the user to confirm the size before creating anything.
|
|
249
|
-
|
|
250
|
-
Once confirmed, create the droplet with `doctl`:
|
|
251
|
-
|
|
252
|
-
```bash
|
|
253
|
-
doctl compute droplet create <project>-runner \
|
|
254
|
-
--region nyc3 \
|
|
255
|
-
--image ubuntu-24-04-x64 \
|
|
256
|
-
--size <confirmed-slug> \
|
|
257
|
-
--ssh-keys $(doctl compute ssh-key list --format ID --no-header | paste -sd,) \
|
|
258
|
-
--wait \
|
|
259
|
-
--format PublicIPv4 \
|
|
260
|
-
--no-header
|
|
261
|
-
```
|
|
262
|
-
|
|
263
|
-
Record the returned IP as `DROPLET_IP`.
|
|
264
|
-
|
|
265
|
-
**Apply the general-web firewall** (the firewall named `general-web`):
|
|
266
|
-
|
|
267
|
-
```bash
|
|
268
|
-
FIREWALL_ID=$(doctl compute firewall list --format ID,Name --no-header | awk '/general-web/{print $1}')
|
|
269
|
-
DROPLET_ID=$(doctl compute droplet list --format ID,Name --no-header | awk '/<project>-runner/{print $1}')
|
|
270
|
-
doctl compute firewall add-droplets "$FIREWALL_ID" --droplet-ids "$DROPLET_ID"
|
|
271
|
-
```
|
|
272
|
-
|
|
273
|
-
**Write `DROPLET_IP` into the Makefile** immediately after the `GITHUB_USER` line:
|
|
274
|
-
|
|
275
|
-
```makefile
|
|
276
|
-
DROPLET_IP ?= <ip>
|
|
277
|
-
```
|
|
278
|
-
|
|
279
|
-
**Register the SSH alias** so subsequent `make ssh` and `make deploy` targets resolve the host:
|
|
280
|
-
|
|
281
|
-
```bash
|
|
282
|
-
make ssh-alias DROPLET_IP=<ip>
|
|
283
|
-
```
|
|
284
|
-
|
|
285
|
-
#### 3c. Walk the user through runner setup
|
|
286
|
-
|
|
287
|
-
Provide the following steps as a numbered checklist. Substitute real values — never leave placeholders.
|
|
288
|
-
|
|
289
|
-
1. **SSH into the droplet and install Docker + `gh` CLI** (if not already present):
|
|
290
|
-
```bash
|
|
291
|
-
ssh root@<DROPLET_IP>
|
|
292
|
-
curl -fsSL https://get.docker.com | sh && systemctl enable --now docker
|
|
293
|
-
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg \
|
|
294
|
-
| dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg
|
|
295
|
-
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] \
|
|
296
|
-
https://cli.github.com/packages stable main" \
|
|
297
|
-
| tee /etc/apt/sources.list.d/github-cli.list > /dev/null
|
|
298
|
-
apt update && apt install gh -y
|
|
299
|
-
```
|
|
300
|
-
|
|
301
|
-
2. **Get a runner registration token** — GitHub → repo → **Settings → Actions → Runners → New self-hosted runner** (Linux x64) and copy the `--token` value.
|
|
302
|
-
|
|
303
|
-
3. **From the local project root**, run:
|
|
304
|
-
```bash
|
|
305
|
-
make setup-runner RUNNER_TOKEN=<TOKEN>
|
|
306
|
-
```
|
|
307
|
-
This uploads `setup-runner.sh` to the VPS and runs it — creating the `runner` user, registering the runner, and starting it as a systemd service.
|
|
308
|
-
|
|
309
|
-
4. **Verify** the runner appears as **Idle** at:
|
|
310
|
-
`<REPO_URL>/settings/actions/runners`
|
|
311
|
-
|
|
312
|
-
---
|
|
313
|
-
|
|
314
|
-
### Deriving the GHCR org/repo slug
|
|
315
|
-
|
|
316
|
-
Priority order:
|
|
317
|
-
1. `name` field in `package.json` or `pyproject.toml` — strip service-specific suffixes (`-backend`, `-frontend`, `-api`) to recover the project base name
|
|
318
|
-
2. GitHub remote URL (`git remote get-url origin`) — owner becomes the org; combine with the base name above or the directory name
|
|
319
|
-
3. Project directory name as a last resort
|
|
320
|
-
|
|
321
|
-
Image naming convention: `ghcr.io/<org>/<project>-<service>`
|
|
322
|
-
Examples: `ghcr.io/acme/myapp-backend`, `ghcr.io/acme/myapp-frontend`
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
set -euo pipefail
|
|
3
|
-
|
|
4
|
-
# Deployment / CI scaffolding seam — separate from the wiki/skills/MCP sync flow.
|
|
5
|
-
# Reads raw/guides/deployment-strategy.md as a prompt template and runs Claude
|
|
6
|
-
# to scaffold .github/ workflows + Makefile + .gitleaks.toml into a target project.
|
|
7
|
-
# Also copies the guide itself into the target's wiki/guides/ (deploy-only tier
|
|
8
|
-
# — the wiki sync deliberately never ships it).
|
|
9
|
-
#
|
|
10
|
-
# Deliberately not called by setup-project.sh or update-project.sh: workflows get
|
|
11
|
-
# hand-customized per project (Dockerfile paths, runner labels, deploy steps) and
|
|
12
|
-
# must not be created or clobbered unless the user explicitly asks for deployment.
|
|
13
|
-
#
|
|
14
|
-
# Invokable standalone (`npx @codewizard-dt/bootstrap deploy`) so a project can
|
|
15
|
-
# opt into CI on demand. Claude applies copy-once semantics:
|
|
16
|
-
# - security.yml → always overwritten (generic, no project-specific content)
|
|
17
|
-
# - build.yml → created once, skipped if present
|
|
18
|
-
# - .gitleaks.toml → created once, skipped if present
|
|
19
|
-
# - Makefile → Docker targets added/merged if a Makefile already exists
|
|
20
|
-
|
|
21
|
-
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
22
|
-
. "$SCRIPT_DIR/lib.sh"
|
|
23
|
-
GUIDE="$SCRIPT_DIR/../../raw/guides/deployment-strategy.md"
|
|
24
|
-
TEMPLATE="$SCRIPT_DIR/../prompts/setup-deployment.md"
|
|
25
|
-
|
|
26
|
-
if [ ! -f "$GUIDE" ]; then
|
|
27
|
-
echo "Error: deployment guide not found at $GUIDE" >&2
|
|
28
|
-
exit 1
|
|
29
|
-
fi
|
|
30
|
-
|
|
31
|
-
if [ ! -f "$TEMPLATE" ]; then
|
|
32
|
-
echo "Error: prompt template not found at $TEMPLATE" >&2
|
|
33
|
-
exit 1
|
|
34
|
-
fi
|
|
35
|
-
|
|
36
|
-
DRY_RUN=false
|
|
37
|
-
POSITIONAL=()
|
|
38
|
-
for arg in "$@"; do
|
|
39
|
-
case "$arg" in
|
|
40
|
-
--dry-run) DRY_RUN=true ;;
|
|
41
|
-
*) POSITIONAL+=("$arg") ;;
|
|
42
|
-
esac
|
|
43
|
-
done
|
|
44
|
-
set -- "${POSITIONAL[@]}"
|
|
45
|
-
|
|
46
|
-
if [ $# -lt 1 ]; then
|
|
47
|
-
echo "Usage: $0 [--dry-run] <path-to-project> [additional context...]" >&2
|
|
48
|
-
exit 1
|
|
49
|
-
fi
|
|
50
|
-
|
|
51
|
-
PROJECT_DIR="$(resolve_project_dir "$1")" || exit 1
|
|
52
|
-
shift
|
|
53
|
-
EXTRA_CONTEXT="${*}"
|
|
54
|
-
|
|
55
|
-
if [ "$DRY_RUN" = true ]; then
|
|
56
|
-
echo "Docker and Compose files in $PROJECT_DIR:"
|
|
57
|
-
echo ""
|
|
58
|
-
echo " Dockerfiles:"
|
|
59
|
-
find "$PROJECT_DIR" \( -name node_modules -o -name .git \) -prune -o \
|
|
60
|
-
-name "Dockerfile*" -print | sort | while read -r f; do
|
|
61
|
-
echo " ${f#"$PROJECT_DIR/"}"
|
|
62
|
-
done
|
|
63
|
-
echo ""
|
|
64
|
-
echo " Docker Compose files:"
|
|
65
|
-
find "$PROJECT_DIR" \( -name node_modules -o -name .git \) -prune -o \
|
|
66
|
-
\( -name "docker-compose*.yml" -o -name "docker-compose*.yaml" \
|
|
67
|
-
-o -name "compose*.yml" -o -name "compose*.yaml" \) -print | sort | while read -r f; do
|
|
68
|
-
echo " ${f#"$PROJECT_DIR/"}"
|
|
69
|
-
done
|
|
70
|
-
exit 0
|
|
71
|
-
fi
|
|
72
|
-
|
|
73
|
-
# Deliver the deployment guide into the target (deploy-only tier — the wiki
|
|
74
|
-
# sync never ships it). Always refreshed: template-owned reference documenting
|
|
75
|
-
# the topology the scaffolded CI implements. Landed before the Claude run so
|
|
76
|
-
# it survives a timeout.
|
|
77
|
-
mkdir -p "$PROJECT_DIR/wiki/guides"
|
|
78
|
-
rsync -a --checksum --out-format=' + %n' "$GUIDE" "$PROJECT_DIR/wiki/guides/deployment-strategy.md"
|
|
79
|
-
|
|
80
|
-
TASK="$(sed "s|__PROJECT_DIR__|$PROJECT_DIR|g" "$TEMPLATE")"
|
|
81
|
-
|
|
82
|
-
PROMPT="$(cat "$GUIDE")
|
|
83
|
-
|
|
84
|
-
---
|
|
85
|
-
|
|
86
|
-
$TASK"
|
|
87
|
-
|
|
88
|
-
if [ -n "$EXTRA_CONTEXT" ]; then
|
|
89
|
-
PROMPT="$PROMPT
|
|
90
|
-
|
|
91
|
-
---
|
|
92
|
-
|
|
93
|
-
Additional context from the user:
|
|
94
|
-
$EXTRA_CONTEXT"
|
|
95
|
-
fi
|
|
96
|
-
|
|
97
|
-
echo "Scaffolding CI/CD for: $PROJECT_DIR"
|
|
98
|
-
echo " Checking for existing services and Docker configuration..."
|
|
99
|
-
cd "$PROJECT_DIR"
|
|
100
|
-
|
|
101
|
-
# --strict-mcp-config: skip global MCPs (Playwright, Brave, etc.) — prevents MCP startup hangs.
|
|
102
|
-
# < /dev/null: close stdin so no interactive prompt can block.
|
|
103
|
-
# Watchdog: kill Claude if it exceeds 5 minutes (e.g. doctl --wait or runaway tool loop).
|
|
104
|
-
TIMEOUT_SECS=300
|
|
105
|
-
claude -p --dangerously-skip-permissions --strict-mcp-config < /dev/null "$PROMPT" &
|
|
106
|
-
DEPLOY_PID=$!
|
|
107
|
-
( sleep $TIMEOUT_SECS \
|
|
108
|
-
&& echo "" >&2 \
|
|
109
|
-
&& echo " [timeout] Deployment scaffolding exceeded ${TIMEOUT_SECS}s — run 'npx bootstrap deploy' to retry." >&2 \
|
|
110
|
-
&& kill "$DEPLOY_PID" 2>/dev/null ) &
|
|
111
|
-
WATCHDOG_PID=$!
|
|
112
|
-
wait "$DEPLOY_PID" || true
|
|
113
|
-
kill "$WATCHDOG_PID" 2>/dev/null; wait "$WATCHDOG_PID" 2>/dev/null || true
|