@rune-kit/rune 2.1.1
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/LICENSE +21 -0
- package/README.md +357 -0
- package/agents/.gitkeep +0 -0
- package/agents/architect.md +29 -0
- package/agents/asset-creator.md +11 -0
- package/agents/audit.md +11 -0
- package/agents/autopsy.md +11 -0
- package/agents/brainstorm.md +11 -0
- package/agents/browser-pilot.md +11 -0
- package/agents/coder.md +29 -0
- package/agents/completion-gate.md +11 -0
- package/agents/constraint-check.md +11 -0
- package/agents/context-engine.md +11 -0
- package/agents/cook.md +11 -0
- package/agents/db.md +11 -0
- package/agents/debug.md +11 -0
- package/agents/dependency-doctor.md +11 -0
- package/agents/deploy.md +11 -0
- package/agents/design.md +11 -0
- package/agents/docs-seeker.md +11 -0
- package/agents/fix.md +11 -0
- package/agents/hallucination-guard.md +11 -0
- package/agents/incident.md +11 -0
- package/agents/integrity-check.md +11 -0
- package/agents/journal.md +11 -0
- package/agents/launch.md +11 -0
- package/agents/logic-guardian.md +11 -0
- package/agents/marketing.md +11 -0
- package/agents/onboard.md +11 -0
- package/agents/perf.md +11 -0
- package/agents/plan.md +11 -0
- package/agents/preflight.md +11 -0
- package/agents/problem-solver.md +11 -0
- package/agents/rescue.md +11 -0
- package/agents/research.md +11 -0
- package/agents/researcher.md +29 -0
- package/agents/review-intake.md +11 -0
- package/agents/review.md +11 -0
- package/agents/reviewer.md +28 -0
- package/agents/safeguard.md +11 -0
- package/agents/sast.md +11 -0
- package/agents/scanner.md +28 -0
- package/agents/scope-guard.md +11 -0
- package/agents/scout.md +11 -0
- package/agents/sentinel.md +11 -0
- package/agents/sequential-thinking.md +11 -0
- package/agents/session-bridge.md +11 -0
- package/agents/skill-forge.md +11 -0
- package/agents/skill-router.md +11 -0
- package/agents/surgeon.md +11 -0
- package/agents/team.md +11 -0
- package/agents/test.md +11 -0
- package/agents/trend-scout.md +11 -0
- package/agents/verification.md +11 -0
- package/agents/video-creator.md +11 -0
- package/agents/watchdog.md +11 -0
- package/agents/worktree.md +11 -0
- package/commands/.gitkeep +0 -0
- package/commands/rune.md +168 -0
- package/compiler/__tests__/openclaw-adapter.test.js +140 -0
- package/compiler/__tests__/parser.test.js +55 -0
- package/compiler/adapters/antigravity.js +59 -0
- package/compiler/adapters/claude.js +37 -0
- package/compiler/adapters/cursor.js +67 -0
- package/compiler/adapters/generic.js +60 -0
- package/compiler/adapters/index.js +45 -0
- package/compiler/adapters/openclaw.js +150 -0
- package/compiler/adapters/windsurf.js +60 -0
- package/compiler/bin/rune.js +288 -0
- package/compiler/doctor.js +153 -0
- package/compiler/emitter.js +240 -0
- package/compiler/parser.js +208 -0
- package/compiler/transformer.js +69 -0
- package/compiler/transforms/branding.js +27 -0
- package/compiler/transforms/cross-references.js +29 -0
- package/compiler/transforms/frontmatter.js +38 -0
- package/compiler/transforms/hooks.js +68 -0
- package/compiler/transforms/subagents.js +36 -0
- package/compiler/transforms/tool-names.js +60 -0
- package/contexts/dev.md +34 -0
- package/contexts/research.md +43 -0
- package/contexts/review.md +55 -0
- package/extensions/ai-ml/PACK.md +517 -0
- package/extensions/analytics/PACK.md +557 -0
- package/extensions/backend/PACK.md +678 -0
- package/extensions/chrome-ext/PACK.md +995 -0
- package/extensions/content/PACK.md +381 -0
- package/extensions/devops/PACK.md +520 -0
- package/extensions/ecommerce/PACK.md +280 -0
- package/extensions/gamedev/PACK.md +393 -0
- package/extensions/mobile/PACK.md +273 -0
- package/extensions/saas/PACK.md +805 -0
- package/extensions/security/PACK.md +536 -0
- package/extensions/trading/PACK.md +597 -0
- package/extensions/ui/PACK.md +947 -0
- package/package.json +47 -0
- package/skills/.gitkeep +0 -0
- package/skills/adversary/SKILL.md +271 -0
- package/skills/asset-creator/SKILL.md +157 -0
- package/skills/audit/SKILL.md +466 -0
- package/skills/autopsy/SKILL.md +200 -0
- package/skills/ba/SKILL.md +279 -0
- package/skills/brainstorm/SKILL.md +266 -0
- package/skills/browser-pilot/SKILL.md +168 -0
- package/skills/completion-gate/SKILL.md +151 -0
- package/skills/constraint-check/SKILL.md +165 -0
- package/skills/context-engine/SKILL.md +176 -0
- package/skills/cook/SKILL.md +636 -0
- package/skills/db/SKILL.md +256 -0
- package/skills/debug/SKILL.md +240 -0
- package/skills/dependency-doctor/SKILL.md +235 -0
- package/skills/deploy/SKILL.md +174 -0
- package/skills/design/DESIGN-REFERENCE.md +365 -0
- package/skills/design/SKILL.md +462 -0
- package/skills/doc-processor/SKILL.md +254 -0
- package/skills/docs/SKILL.md +336 -0
- package/skills/docs-seeker/SKILL.md +166 -0
- package/skills/fix/SKILL.md +192 -0
- package/skills/git/SKILL.md +285 -0
- package/skills/hallucination-guard/SKILL.md +204 -0
- package/skills/incident/SKILL.md +241 -0
- package/skills/integrity-check/SKILL.md +169 -0
- package/skills/journal/SKILL.md +190 -0
- package/skills/launch/SKILL.md +330 -0
- package/skills/logic-guardian/SKILL.md +240 -0
- package/skills/marketing/SKILL.md +229 -0
- package/skills/mcp-builder/SKILL.md +311 -0
- package/skills/onboard/SKILL.md +298 -0
- package/skills/perf/SKILL.md +297 -0
- package/skills/plan/SKILL.md +520 -0
- package/skills/preflight/SKILL.md +231 -0
- package/skills/problem-solver/SKILL.md +284 -0
- package/skills/rescue/SKILL.md +434 -0
- package/skills/research/SKILL.md +122 -0
- package/skills/review/SKILL.md +354 -0
- package/skills/review-intake/SKILL.md +222 -0
- package/skills/safeguard/SKILL.md +188 -0
- package/skills/sast/SKILL.md +190 -0
- package/skills/scaffold/SKILL.md +276 -0
- package/skills/scope-guard/SKILL.md +150 -0
- package/skills/scout/SKILL.md +232 -0
- package/skills/sentinel/SKILL.md +320 -0
- package/skills/sentinel-env/SKILL.md +226 -0
- package/skills/sequential-thinking/SKILL.md +234 -0
- package/skills/session-bridge/SKILL.md +287 -0
- package/skills/skill-forge/SKILL.md +317 -0
- package/skills/skill-router/SKILL.md +267 -0
- package/skills/surgeon/SKILL.md +203 -0
- package/skills/team/SKILL.md +397 -0
- package/skills/test/SKILL.md +271 -0
- package/skills/trend-scout/SKILL.md +145 -0
- package/skills/verification/SKILL.md +201 -0
- package/skills/video-creator/SKILL.md +201 -0
- package/skills/watchdog/SKILL.md +166 -0
- package/skills/worktree/SKILL.md +140 -0
|
@@ -0,0 +1,520 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: "@rune/devops"
|
|
3
|
+
description: DevOps patterns — Docker, CI/CD pipelines, monitoring setup, server configuration, and SSL/domain management.
|
|
4
|
+
metadata:
|
|
5
|
+
author: runedev
|
|
6
|
+
version: "0.2.0"
|
|
7
|
+
layer: L4
|
|
8
|
+
price: "$12"
|
|
9
|
+
target: DevOps engineers
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# @rune/devops
|
|
13
|
+
|
|
14
|
+
## Purpose
|
|
15
|
+
|
|
16
|
+
Infrastructure work done without patterns leads to snowflake configs: Dockerfiles that rebuild entire node_modules on every code change, CI pipelines that run 40 minutes because nothing is cached, servers with no monitoring until the first outage, and SSL certificates that expire silently. This pack provides battle-tested patterns for containerization, continuous delivery, production observability, and server hardening — each skill detects what you have, audits it against best practices, and emits the fixed config.
|
|
17
|
+
|
|
18
|
+
## Triggers
|
|
19
|
+
|
|
20
|
+
- Auto-trigger: when `Dockerfile`, `docker-compose.yml`, `.github/workflows/`, `.gitlab-ci.yml`, `nginx.conf`, `Caddyfile` detected in project
|
|
21
|
+
- `/rune docker` — audit and optimize container configuration
|
|
22
|
+
- `/rune ci-cd` — audit and optimize CI/CD pipeline
|
|
23
|
+
- `/rune monitoring` — set up or audit production monitoring
|
|
24
|
+
- `/rune server-setup` — audit server configuration
|
|
25
|
+
- `/rune ssl-domain` — manage SSL certificates and domain config
|
|
26
|
+
- Called by `deploy` (L2) when deployment infrastructure needs setup
|
|
27
|
+
- Called by `launch` (L1) when preparing production environment
|
|
28
|
+
|
|
29
|
+
## Skills Included
|
|
30
|
+
|
|
31
|
+
### docker
|
|
32
|
+
|
|
33
|
+
Dockerfile and docker-compose patterns — multi-stage builds, layer optimization, security hardening, development vs production configs.
|
|
34
|
+
|
|
35
|
+
#### Workflow
|
|
36
|
+
|
|
37
|
+
**Step 1 — Detect container configuration**
|
|
38
|
+
Use Glob to find `Dockerfile*`, `docker-compose*.yml`, `.dockerignore`. Read each file to understand: base images used, build stages, exposed ports, volume mounts, environment variables, and health checks.
|
|
39
|
+
|
|
40
|
+
**Step 2 — Audit against best practices**
|
|
41
|
+
Check for: non-multi-stage builds (large images), `npm install` without `--omit=dev` in production stage, missing `.dockerignore` (bloated context), running as root (security risk), `latest` tag on base images (non-reproducible), missing `HEALTHCHECK`, `COPY . .` before dependency install (cache invalidation). Flag each with severity and fix.
|
|
42
|
+
|
|
43
|
+
**Step 3 — Emit optimized Dockerfile**
|
|
44
|
+
Rewrite or patch the Dockerfile: multi-stage build (deps → build → production), distroless or Alpine final image, non-root user, pinned base image versions, proper layer ordering, health check, and `.dockerignore` covering `node_modules`, `.git`, `*.md`.
|
|
45
|
+
|
|
46
|
+
#### Example
|
|
47
|
+
|
|
48
|
+
```dockerfile
|
|
49
|
+
# BEFORE: single stage, root user, no cache optimization
|
|
50
|
+
FROM node:20
|
|
51
|
+
WORKDIR /app
|
|
52
|
+
COPY . .
|
|
53
|
+
RUN npm install
|
|
54
|
+
EXPOSE 3000
|
|
55
|
+
CMD ["node", "server.js"]
|
|
56
|
+
|
|
57
|
+
# AFTER: multi-stage, non-root, optimized layers
|
|
58
|
+
FROM node:20-alpine AS deps
|
|
59
|
+
WORKDIR /app
|
|
60
|
+
COPY package.json package-lock.json ./
|
|
61
|
+
RUN npm ci --omit=dev
|
|
62
|
+
|
|
63
|
+
FROM node:20-alpine AS build
|
|
64
|
+
WORKDIR /app
|
|
65
|
+
COPY package.json package-lock.json ./
|
|
66
|
+
RUN npm ci
|
|
67
|
+
COPY . .
|
|
68
|
+
RUN npm run build
|
|
69
|
+
|
|
70
|
+
FROM node:20-alpine AS production
|
|
71
|
+
RUN addgroup -S app && adduser -S app -G app
|
|
72
|
+
WORKDIR /app
|
|
73
|
+
COPY --from=deps /app/node_modules ./node_modules
|
|
74
|
+
COPY --from=build /app/dist ./dist
|
|
75
|
+
COPY package.json ./
|
|
76
|
+
USER app
|
|
77
|
+
EXPOSE 3000
|
|
78
|
+
HEALTHCHECK --interval=30s --timeout=3s CMD wget -qO- http://localhost:3000/health || exit 1
|
|
79
|
+
CMD ["node", "dist/server.js"]
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
### ci-cd
|
|
85
|
+
|
|
86
|
+
CI/CD pipeline configuration — GitHub Actions, GitLab CI, build matrices, test parallelization, deployment gates, semantic release.
|
|
87
|
+
|
|
88
|
+
#### Workflow
|
|
89
|
+
|
|
90
|
+
**Step 1 — Detect existing pipeline**
|
|
91
|
+
Use Glob to find `.github/workflows/*.yml`, `.gitlab-ci.yml`, `Jenkinsfile`, `bitbucket-pipelines.yml`. Read each config to understand: triggers, jobs, caching strategy, test execution, deployment steps, and secrets usage.
|
|
92
|
+
|
|
93
|
+
**Step 2 — Audit pipeline efficiency**
|
|
94
|
+
Check for: no dependency caching (slow installs every run), sequential jobs that could parallelize, missing test matrix for multiple Node/Python versions, no deployment gates (staging → production), secrets referenced without environment protection, missing artifact upload for build outputs. Flag with estimated time savings.
|
|
95
|
+
|
|
96
|
+
**Step 3 — Emit optimized pipeline**
|
|
97
|
+
Rewrite or patch the pipeline: dependency caching (npm/pnpm/pip cache), parallel job graph (lint + typecheck + test), build matrix for LTS versions, deployment gates with manual approval for production, status checks required before merge, artifact persistence for deploy stage.
|
|
98
|
+
|
|
99
|
+
#### Example
|
|
100
|
+
|
|
101
|
+
```yaml
|
|
102
|
+
# GitHub Actions — optimized Node.js pipeline
|
|
103
|
+
name: CI/CD
|
|
104
|
+
on:
|
|
105
|
+
push: { branches: [main] }
|
|
106
|
+
pull_request: { branches: [main] }
|
|
107
|
+
|
|
108
|
+
jobs:
|
|
109
|
+
quality:
|
|
110
|
+
runs-on: ubuntu-latest
|
|
111
|
+
strategy:
|
|
112
|
+
matrix:
|
|
113
|
+
check: [lint, typecheck, test]
|
|
114
|
+
steps:
|
|
115
|
+
- uses: actions/checkout@v4
|
|
116
|
+
- uses: actions/setup-node@v4
|
|
117
|
+
with: { node-version: 20, cache: 'npm' }
|
|
118
|
+
- run: npm ci
|
|
119
|
+
- run: npm run ${{ matrix.check }}
|
|
120
|
+
|
|
121
|
+
build:
|
|
122
|
+
needs: quality
|
|
123
|
+
runs-on: ubuntu-latest
|
|
124
|
+
steps:
|
|
125
|
+
- uses: actions/checkout@v4
|
|
126
|
+
- uses: actions/setup-node@v4
|
|
127
|
+
with: { node-version: 20, cache: 'npm' }
|
|
128
|
+
- run: npm ci && npm run build
|
|
129
|
+
- uses: actions/upload-artifact@v4
|
|
130
|
+
with: { name: dist, path: dist/ }
|
|
131
|
+
|
|
132
|
+
deploy-staging:
|
|
133
|
+
needs: build
|
|
134
|
+
if: github.ref == 'refs/heads/main'
|
|
135
|
+
runs-on: ubuntu-latest
|
|
136
|
+
environment: staging
|
|
137
|
+
steps:
|
|
138
|
+
- uses: actions/download-artifact@v4
|
|
139
|
+
with: { name: dist }
|
|
140
|
+
- run: echo "Deploy to staging..."
|
|
141
|
+
|
|
142
|
+
deploy-production:
|
|
143
|
+
needs: deploy-staging
|
|
144
|
+
runs-on: ubuntu-latest
|
|
145
|
+
environment: production # requires manual approval
|
|
146
|
+
steps:
|
|
147
|
+
- uses: actions/download-artifact@v4
|
|
148
|
+
with: { name: dist }
|
|
149
|
+
- run: echo "Deploy to production..."
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
|
|
154
|
+
### monitoring
|
|
155
|
+
|
|
156
|
+
Production monitoring setup — Prometheus, Grafana, alerting rules, SLO/SLI definitions, log aggregation, distributed tracing.
|
|
157
|
+
|
|
158
|
+
#### Workflow
|
|
159
|
+
|
|
160
|
+
**Step 1 — Detect monitoring stack**
|
|
161
|
+
Use Grep to find monitoring libraries (`prom-client`, `opentelemetry`, `winston`, `pino`, `morgan`, `dd-trace`, `@sentry/node`). Check for existing Prometheus config, Grafana dashboards, or alerting rules. Read the main server file for existing metrics/logging middleware.
|
|
162
|
+
|
|
163
|
+
**Step 2 — Audit observability gaps**
|
|
164
|
+
Check the four pillars: metrics (RED metrics — Rate, Errors, Duration), logs (structured JSON, correlation IDs), traces (distributed tracing spans), alerts (SLO-based alerting, not just threshold). Flag missing pillars with priority: metrics and alerts first, structured logs second, tracing third.
|
|
165
|
+
|
|
166
|
+
**Step 3 — Emit monitoring configuration**
|
|
167
|
+
Based on detected stack, emit: Prometheus metrics middleware (HTTP request duration histogram, error counter, active connections gauge), structured logger configuration (JSON, request ID, log levels), Grafana dashboard JSON, and Prometheus alerting rules for SLO (99.9% availability = error budget of 43 min/month).
|
|
168
|
+
|
|
169
|
+
#### Example
|
|
170
|
+
|
|
171
|
+
```typescript
|
|
172
|
+
// Prometheus metrics middleware (prom-client)
|
|
173
|
+
import { Counter, Histogram, Gauge, register } from 'prom-client';
|
|
174
|
+
|
|
175
|
+
const httpDuration = new Histogram({
|
|
176
|
+
name: 'http_request_duration_seconds',
|
|
177
|
+
help: 'HTTP request duration in seconds',
|
|
178
|
+
labelNames: ['method', 'route', 'status'],
|
|
179
|
+
buckets: [0.01, 0.05, 0.1, 0.5, 1, 5],
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
const httpErrors = new Counter({
|
|
183
|
+
name: 'http_errors_total',
|
|
184
|
+
help: 'Total HTTP errors',
|
|
185
|
+
labelNames: ['method', 'route', 'status'],
|
|
186
|
+
});
|
|
187
|
+
|
|
188
|
+
const metricsMiddleware = (req, res, next) => {
|
|
189
|
+
const end = httpDuration.startTimer({ method: req.method, route: req.route?.path || req.path });
|
|
190
|
+
res.on('finish', () => {
|
|
191
|
+
end({ status: res.statusCode });
|
|
192
|
+
if (res.statusCode >= 400) httpErrors.inc({ method: req.method, route: req.route?.path, status: res.statusCode });
|
|
193
|
+
});
|
|
194
|
+
next();
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
// GET /metrics endpoint
|
|
198
|
+
app.get('/metrics', async (req, res) => {
|
|
199
|
+
res.set('Content-Type', register.contentType);
|
|
200
|
+
res.end(await register.metrics());
|
|
201
|
+
});
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
---
|
|
205
|
+
|
|
206
|
+
### server-setup
|
|
207
|
+
|
|
208
|
+
Server configuration — Nginx/Caddy reverse proxy, systemd services, firewall rules, SSH hardening, automatic updates.
|
|
209
|
+
|
|
210
|
+
#### Workflow
|
|
211
|
+
|
|
212
|
+
**Step 1 — Detect server environment**
|
|
213
|
+
Check for `nginx.conf`, `Caddyfile`, `*.service` (systemd), `ufw` or `iptables` rules, `sshd_config` presence. Identify the reverse proxy, process manager, and OS-level security configuration.
|
|
214
|
+
|
|
215
|
+
**Step 2 — Audit server hardening**
|
|
216
|
+
Check for: SSH password auth enabled (should be key-only), root SSH login enabled (should be disabled), no firewall rules (should allow only 22, 80, 443), no rate limiting on Nginx, missing security headers (`X-Frame-Options`, `X-Content-Type-Options`, `Strict-Transport-Security`), process running as root.
|
|
217
|
+
|
|
218
|
+
**Step 3 — Emit hardened configuration**
|
|
219
|
+
Emit the corrected configs: Nginx with security headers, rate limiting, and gzip; systemd service with `User=`, `Restart=`, and resource limits; SSH hardening (`PermitRootLogin no`, `PasswordAuthentication no`); firewall rules allowing only necessary ports.
|
|
220
|
+
|
|
221
|
+
#### Example
|
|
222
|
+
|
|
223
|
+
```nginx
|
|
224
|
+
# Nginx reverse proxy — hardened
|
|
225
|
+
server {
|
|
226
|
+
listen 80;
|
|
227
|
+
server_name example.com;
|
|
228
|
+
return 301 https://$host$request_uri;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
server {
|
|
232
|
+
listen 443 ssl http2;
|
|
233
|
+
server_name example.com;
|
|
234
|
+
|
|
235
|
+
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
|
|
236
|
+
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
|
|
237
|
+
|
|
238
|
+
# Security headers
|
|
239
|
+
add_header X-Frame-Options DENY always;
|
|
240
|
+
add_header X-Content-Type-Options nosniff always;
|
|
241
|
+
add_header Strict-Transport-Security "max-age=63072000; includeSubDomains" always;
|
|
242
|
+
add_header Referrer-Policy strict-origin-when-cross-origin always;
|
|
243
|
+
|
|
244
|
+
# Rate limiting
|
|
245
|
+
limit_req_zone $binary_remote_addr zone=api:10m rate=10r/s;
|
|
246
|
+
|
|
247
|
+
location /api/ {
|
|
248
|
+
limit_req zone=api burst=20 nodelay;
|
|
249
|
+
proxy_pass http://127.0.0.1:3000;
|
|
250
|
+
proxy_set_header X-Real-IP $remote_addr;
|
|
251
|
+
proxy_set_header X-Request-Id $request_id;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
location / {
|
|
255
|
+
root /var/www/app/dist;
|
|
256
|
+
try_files $uri $uri/ /index.html;
|
|
257
|
+
gzip on;
|
|
258
|
+
gzip_types text/plain text/css application/json application/javascript;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
---
|
|
264
|
+
|
|
265
|
+
### ssl-domain
|
|
266
|
+
|
|
267
|
+
SSL certificate management and domain configuration — Let's Encrypt automation, DNS records, CDN setup, redirect rules.
|
|
268
|
+
|
|
269
|
+
#### Workflow
|
|
270
|
+
|
|
271
|
+
**Step 1 — Detect current SSL/domain setup**
|
|
272
|
+
Check for existing certificates (`/etc/letsencrypt/`, Cloudflare config), DNS provider configuration, CDN integration (Cloudflare, AWS CloudFront), and redirect rules. Read Nginx/Caddy config for SSL settings.
|
|
273
|
+
|
|
274
|
+
**Step 2 — Audit SSL configuration**
|
|
275
|
+
Check for: expired or soon-to-expire certificates, TLS version below 1.2, weak cipher suites, missing HSTS header, no auto-renewal configured, mixed content (HTTP resources on HTTPS page), missing www-to-apex redirect (or vice versa).
|
|
276
|
+
|
|
277
|
+
**Step 3 — Emit SSL automation**
|
|
278
|
+
Emit: certbot installation and auto-renewal cron, DNS record recommendations (A, CNAME, CAA), Cloudflare/CDN integration if applicable, redirect rules for www normalization, and SSL test verification command.
|
|
279
|
+
|
|
280
|
+
#### Example
|
|
281
|
+
|
|
282
|
+
```bash
|
|
283
|
+
# Let's Encrypt automation with auto-renewal
|
|
284
|
+
sudo apt install certbot python3-certbot-nginx -y
|
|
285
|
+
sudo certbot --nginx -d example.com -d www.example.com --non-interactive --agree-tos -m admin@example.com
|
|
286
|
+
|
|
287
|
+
# Verify auto-renewal
|
|
288
|
+
sudo certbot renew --dry-run
|
|
289
|
+
|
|
290
|
+
# DNS records (for provider dashboard)
|
|
291
|
+
# A example.com → 203.0.113.1
|
|
292
|
+
# CNAME www.example.com → example.com
|
|
293
|
+
# CAA example.com → 0 issue "letsencrypt.org"
|
|
294
|
+
|
|
295
|
+
# Test SSL configuration
|
|
296
|
+
curl -sI https://example.com | grep -i strict-transport
|
|
297
|
+
# Expected: strict-transport-security: max-age=63072000; includeSubDomains
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
---
|
|
301
|
+
|
|
302
|
+
### chaos-testing
|
|
303
|
+
|
|
304
|
+
Resilience testing — inject controlled failures to verify system behavior under degraded conditions. Validates circuit breakers, retry logic, graceful degradation, and recovery procedures.
|
|
305
|
+
|
|
306
|
+
#### Workflow
|
|
307
|
+
|
|
308
|
+
**Step 1 — Map failure points**
|
|
309
|
+
Scan the codebase for: external API calls (HTTP clients, SDK calls), database connections, message queues, cache layers, file system operations, and third-party services. For each dependency, identify: timeout configuration, retry logic, circuit breaker presence, fallback behavior. Build a dependency map with failure modes.
|
|
310
|
+
|
|
311
|
+
**Step 2 — Design chaos experiments**
|
|
312
|
+
For each critical dependency, define experiments:
|
|
313
|
+
- **Latency injection**: Add 2-5s delay to responses — does the UI show loading state? Do timeouts fire correctly?
|
|
314
|
+
- **Error injection**: Return 500/503 from dependency — does the circuit breaker open? Does fallback activate?
|
|
315
|
+
- **Partition**: Dependency becomes unreachable — does the system degrade gracefully or crash?
|
|
316
|
+
- **Data corruption**: Invalid response format — does validation catch it?
|
|
317
|
+
|
|
318
|
+
Each experiment has: hypothesis ("If Redis is down, the app serves stale cache for 5 minutes"), blast radius (which users/features affected), rollback procedure (how to stop the experiment).
|
|
319
|
+
|
|
320
|
+
**Step 3 — Generate test harnesses**
|
|
321
|
+
Emit test files that simulate each failure mode:
|
|
322
|
+
- Mock-based chaos for unit/integration tests (intercept HTTP, inject errors)
|
|
323
|
+
- Environment-variable-driven chaos for staging (feature flags to enable failure injection)
|
|
324
|
+
- Health check validation (verify `/health` endpoint reports degraded state, not crash)
|
|
325
|
+
|
|
326
|
+
Save experiment plan to `.rune/chaos/<date>-experiment.md`.
|
|
327
|
+
|
|
328
|
+
#### Example
|
|
329
|
+
|
|
330
|
+
```typescript
|
|
331
|
+
// Chaos test: Redis connection failure
|
|
332
|
+
describe('Chaos: Redis unavailable', () => {
|
|
333
|
+
beforeEach(() => {
|
|
334
|
+
// Simulate Redis connection refused
|
|
335
|
+
jest.spyOn(redisClient, 'get').mockRejectedValue(
|
|
336
|
+
new Error('ECONNREFUSED 127.0.0.1:6379')
|
|
337
|
+
);
|
|
338
|
+
});
|
|
339
|
+
|
|
340
|
+
it('falls back to database when cache is down', async () => {
|
|
341
|
+
const result = await getUserProfile('user-123');
|
|
342
|
+
expect(result).toBeDefined(); // still works
|
|
343
|
+
expect(dbClient.query).toHaveBeenCalled(); // used DB fallback
|
|
344
|
+
});
|
|
345
|
+
|
|
346
|
+
it('reports degraded health status', async () => {
|
|
347
|
+
const health = await request(app).get('/health');
|
|
348
|
+
expect(health.status).toBe(200);
|
|
349
|
+
expect(health.body.cache).toBe('degraded');
|
|
350
|
+
expect(health.body.overall).toBe('degraded'); // not 'down'
|
|
351
|
+
});
|
|
352
|
+
|
|
353
|
+
it('circuit breaker opens after 5 failures', async () => {
|
|
354
|
+
for (let i = 0; i < 5; i++) await getUserProfile(`user-${i}`);
|
|
355
|
+
// 6th call should not even attempt Redis
|
|
356
|
+
await getUserProfile('user-6');
|
|
357
|
+
expect(redisClient.get).toHaveBeenCalledTimes(5); // not 6
|
|
358
|
+
});
|
|
359
|
+
});
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
---
|
|
363
|
+
|
|
364
|
+
### kubernetes
|
|
365
|
+
|
|
366
|
+
Kubernetes resource patterns — Deployments, Services, ConfigMaps, resource limits, health probes, HPA, network policies, and RBAC.
|
|
367
|
+
|
|
368
|
+
#### Workflow
|
|
369
|
+
|
|
370
|
+
**Step 1 — Detect Kubernetes configuration**
|
|
371
|
+
Use Glob to find `k8s/`, `kubernetes/`, `manifests/`, `helm/`, `kustomize/`, or any `.yaml` files with `apiVersion: apps/v1`. Read existing manifests to understand: workload types, resource limits, probe configuration, service exposure, and secret management.
|
|
372
|
+
|
|
373
|
+
**Step 2 — Audit against production readiness**
|
|
374
|
+
Check for: missing resource requests/limits (noisy neighbor risk), no readiness/liveness probes (unhealthy pods receive traffic), `latest` image tag (non-reproducible), missing PodDisruptionBudget (risky rolling updates), no NetworkPolicy (unrestricted pod-to-pod traffic), secrets in plain ConfigMap (should use Secrets or external vault), no HPA (can't auto-scale), privileged containers.
|
|
375
|
+
|
|
376
|
+
**Step 3 — Emit production-ready manifests**
|
|
377
|
+
Generate or patch manifests: Deployment with resource limits, probes, and anti-affinity; Service with proper selector; HPA with CPU/memory targets; NetworkPolicy restricting ingress; PDB for safe rollouts; Kustomize overlays for dev/staging/prod environments.
|
|
378
|
+
|
|
379
|
+
#### Example
|
|
380
|
+
|
|
381
|
+
```yaml
|
|
382
|
+
# Production-ready Deployment
|
|
383
|
+
apiVersion: apps/v1
|
|
384
|
+
kind: Deployment
|
|
385
|
+
metadata:
|
|
386
|
+
name: api-server
|
|
387
|
+
labels:
|
|
388
|
+
app: api-server
|
|
389
|
+
spec:
|
|
390
|
+
replicas: 3
|
|
391
|
+
selector:
|
|
392
|
+
matchLabels:
|
|
393
|
+
app: api-server
|
|
394
|
+
template:
|
|
395
|
+
metadata:
|
|
396
|
+
labels:
|
|
397
|
+
app: api-server
|
|
398
|
+
spec:
|
|
399
|
+
containers:
|
|
400
|
+
- name: api
|
|
401
|
+
image: registry.example.com/api:v1.4.2 # pinned tag
|
|
402
|
+
resources:
|
|
403
|
+
requests:
|
|
404
|
+
cpu: 100m
|
|
405
|
+
memory: 256Mi
|
|
406
|
+
limits:
|
|
407
|
+
cpu: 500m
|
|
408
|
+
memory: 512Mi
|
|
409
|
+
readinessProbe:
|
|
410
|
+
httpGet:
|
|
411
|
+
path: /health
|
|
412
|
+
port: 3000
|
|
413
|
+
initialDelaySeconds: 5
|
|
414
|
+
periodSeconds: 10
|
|
415
|
+
livenessProbe:
|
|
416
|
+
httpGet:
|
|
417
|
+
path: /health
|
|
418
|
+
port: 3000
|
|
419
|
+
initialDelaySeconds: 15
|
|
420
|
+
periodSeconds: 20
|
|
421
|
+
env:
|
|
422
|
+
- name: DATABASE_URL
|
|
423
|
+
valueFrom:
|
|
424
|
+
secretKeyRef:
|
|
425
|
+
name: api-secrets
|
|
426
|
+
key: database-url
|
|
427
|
+
affinity:
|
|
428
|
+
podAntiAffinity:
|
|
429
|
+
preferredDuringSchedulingIgnoredDuringExecution:
|
|
430
|
+
- weight: 100
|
|
431
|
+
podAffinityTerm:
|
|
432
|
+
labelSelector:
|
|
433
|
+
matchLabels:
|
|
434
|
+
app: api-server
|
|
435
|
+
topologyKey: kubernetes.io/hostname
|
|
436
|
+
---
|
|
437
|
+
apiVersion: policy/v1
|
|
438
|
+
kind: PodDisruptionBudget
|
|
439
|
+
metadata:
|
|
440
|
+
name: api-server-pdb
|
|
441
|
+
spec:
|
|
442
|
+
minAvailable: 2
|
|
443
|
+
selector:
|
|
444
|
+
matchLabels:
|
|
445
|
+
app: api-server
|
|
446
|
+
---
|
|
447
|
+
apiVersion: autoscaling/v2
|
|
448
|
+
kind: HorizontalPodAutoscaler
|
|
449
|
+
metadata:
|
|
450
|
+
name: api-server-hpa
|
|
451
|
+
spec:
|
|
452
|
+
scaleTargetRef:
|
|
453
|
+
apiVersion: apps/v1
|
|
454
|
+
kind: Deployment
|
|
455
|
+
name: api-server
|
|
456
|
+
minReplicas: 3
|
|
457
|
+
maxReplicas: 10
|
|
458
|
+
metrics:
|
|
459
|
+
- type: Resource
|
|
460
|
+
resource:
|
|
461
|
+
name: cpu
|
|
462
|
+
target:
|
|
463
|
+
type: Utilization
|
|
464
|
+
averageUtilization: 70
|
|
465
|
+
```
|
|
466
|
+
|
|
467
|
+
---
|
|
468
|
+
|
|
469
|
+
## Connections
|
|
470
|
+
|
|
471
|
+
```
|
|
472
|
+
Calls → verification (L3): validate configs syntax and test infrastructure changes
|
|
473
|
+
Calls → sentinel (L2): security audit on server and container configuration
|
|
474
|
+
Called By ← deploy (L2): deployment infrastructure setup
|
|
475
|
+
Called By ← launch (L1): production environment preparation
|
|
476
|
+
Called By ← cook (L1): when DevOps task detected
|
|
477
|
+
```
|
|
478
|
+
|
|
479
|
+
## Tech Stack Support
|
|
480
|
+
|
|
481
|
+
| Platform | Container | CI/CD | Reverse Proxy |
|
|
482
|
+
|----------|-----------|-------|---------------|
|
|
483
|
+
| AWS (EC2/ECS/Lambda) | Docker | GitHub Actions | Nginx / ALB |
|
|
484
|
+
| GCP (Cloud Run/GKE) | Docker | Cloud Build / GitHub Actions | Caddy / Cloud LB |
|
|
485
|
+
| Vercel | Serverless | Built-in | Built-in |
|
|
486
|
+
| DigitalOcean (Droplet/App Platform) | Docker | GitHub Actions | Nginx / Caddy |
|
|
487
|
+
| VPS (any) | Docker | GitHub Actions (self-hosted) | Nginx / Caddy |
|
|
488
|
+
|
|
489
|
+
## Constraints
|
|
490
|
+
|
|
491
|
+
1. MUST pin base image versions in Dockerfiles — never use `latest` tag in production.
|
|
492
|
+
2. MUST NOT include secrets in CI/CD config files — use encrypted secrets or environment variables.
|
|
493
|
+
3. MUST emit both development and production configs when containerizing — never use dev config in production.
|
|
494
|
+
4. MUST include rollback strategy for every deployment change — no one-way changes.
|
|
495
|
+
5. MUST test configuration changes in staging before production — emit staging config alongside production.
|
|
496
|
+
|
|
497
|
+
## Sharp Edges
|
|
498
|
+
|
|
499
|
+
| Failure Mode | Severity | Mitigation |
|
|
500
|
+
|---|---|---|
|
|
501
|
+
| Docker multi-stage build references wrong stage name causing empty final image | HIGH | Validate `COPY --from=` stage names match defined stages; emit build test command |
|
|
502
|
+
| CI caching key uses lockfile that doesn't exist (e.g., `pnpm-lock.yaml` when using npm) | HIGH | Detect actual package manager from lockfile presence before emitting cache config |
|
|
503
|
+
| Monitoring metrics have high cardinality labels (user ID as label) causing Prometheus OOM | CRITICAL | Constrain label values to bounded sets (method, route, status) — never use IDs as labels |
|
|
504
|
+
| SSH hardening locks out user (key-only auth before key is added) | CRITICAL | Emit config change AND key setup in correct order; include rollback instructions |
|
|
505
|
+
| SSL certificate renewal fails silently after initial setup | HIGH | Emit renewal test command (`certbot renew --dry-run`) and cron verification |
|
|
506
|
+
| Nginx config syntax error takes down production proxy | HIGH | Always emit `nginx -t` test command before reload; suggest blue-green proxy config |
|
|
507
|
+
|
|
508
|
+
## Done When
|
|
509
|
+
|
|
510
|
+
- Dockerfile emits multi-stage, non-root, health-checked, layer-optimized build
|
|
511
|
+
- CI/CD pipeline has caching, parallelization, deployment gates, and status checks
|
|
512
|
+
- Monitoring covers RED metrics, structured logging, and SLO-based alerting
|
|
513
|
+
- Server hardened: key-only SSH, firewall, security headers, rate limiting
|
|
514
|
+
- SSL automated with renewal verification
|
|
515
|
+
- All emitted configs tested with syntax validation commands
|
|
516
|
+
- Structured report emitted for each skill invoked
|
|
517
|
+
|
|
518
|
+
## Cost Profile
|
|
519
|
+
|
|
520
|
+
~10,000–18,000 tokens per full pack run (all 5 skills). Individual skill: ~2,000–4,000 tokens. Sonnet default. Use haiku for config detection scans; escalate to sonnet for config generation and security audit.
|