@rune-kit/rune 2.1.1 → 2.2.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/README.md +40 -34
- package/compiler/__tests__/pack-split.test.js +145 -0
- package/compiler/adapters/antigravity.js +1 -1
- package/compiler/adapters/codex.js +77 -0
- package/compiler/adapters/cursor.js +1 -1
- package/compiler/adapters/generic.js +1 -1
- package/compiler/adapters/index.js +4 -0
- package/compiler/adapters/opencode.js +86 -0
- package/compiler/adapters/windsurf.js +1 -1
- package/compiler/bin/rune.js +10 -7
- package/compiler/doctor.js +42 -0
- package/compiler/emitter.js +64 -10
- package/compiler/parser.js +42 -3
- package/compiler/transformer.js +10 -6
- package/compiler/transforms/branding.js +1 -1
- package/compiler/transforms/compliance.js +40 -0
- package/extensions/ai-ml/PACK.md +38 -474
- package/extensions/ai-ml/skills/ai-agents.md +172 -0
- package/extensions/ai-ml/skills/code-sandbox.md +187 -0
- package/extensions/ai-ml/skills/deep-research.md +146 -0
- package/extensions/ai-ml/skills/embedding-search.md +66 -0
- package/extensions/ai-ml/skills/fine-tuning-guide.md +74 -0
- package/extensions/ai-ml/skills/llm-architect.md +125 -0
- package/extensions/ai-ml/skills/llm-integration.md +64 -0
- package/extensions/ai-ml/skills/prompt-patterns.md +72 -0
- package/extensions/ai-ml/skills/rag-patterns.md +66 -0
- package/extensions/ai-ml/skills/web-extraction.md +114 -0
- package/extensions/analytics/PACK.md +19 -484
- package/extensions/analytics/skills/ab-testing.md +72 -0
- package/extensions/analytics/skills/dashboard-patterns.md +83 -0
- package/extensions/analytics/skills/data-validation.md +68 -0
- package/extensions/analytics/skills/funnel-analysis.md +81 -0
- package/extensions/analytics/skills/sql-patterns.md +57 -0
- package/extensions/analytics/skills/statistical-analysis.md +79 -0
- package/extensions/analytics/skills/tracking-setup.md +71 -0
- package/extensions/backend/PACK.md +44 -618
- package/extensions/backend/skills/api-patterns.md +84 -0
- package/extensions/backend/skills/async-pipeline.md +193 -0
- package/extensions/backend/skills/auth-patterns.md +97 -0
- package/extensions/backend/skills/background-jobs.md +133 -0
- package/extensions/backend/skills/caching-patterns.md +108 -0
- package/extensions/backend/skills/cli-generation.md +133 -0
- package/extensions/backend/skills/database-patterns.md +87 -0
- package/extensions/backend/skills/middleware-patterns.md +104 -0
- package/extensions/chrome-ext/PACK.md +19 -921
- package/extensions/chrome-ext/skills/cws-preflight.md +143 -0
- package/extensions/chrome-ext/skills/cws-publish.md +104 -0
- package/extensions/chrome-ext/skills/ext-ai-integration.md +251 -0
- package/extensions/chrome-ext/skills/ext-messaging.md +139 -0
- package/extensions/chrome-ext/skills/ext-storage.md +133 -0
- package/extensions/chrome-ext/skills/mv3-scaffold.md +164 -0
- package/extensions/content/PACK.md +43 -335
- package/extensions/content/skills/blog-patterns.md +88 -0
- package/extensions/content/skills/cms-integration.md +131 -0
- package/extensions/content/skills/content-scoring.md +107 -0
- package/extensions/content/skills/i18n.md +83 -0
- package/extensions/content/skills/mdx-authoring.md +137 -0
- package/extensions/content/skills/reference.md +1014 -0
- package/extensions/content/skills/seo-patterns.md +67 -0
- package/extensions/content/skills/video-repurpose.md +153 -0
- package/extensions/devops/PACK.md +38 -457
- package/extensions/devops/skills/chaos-testing.md +67 -0
- package/extensions/devops/skills/ci-cd.md +75 -0
- package/extensions/devops/skills/docker.md +58 -0
- package/extensions/devops/skills/edge-serverless.md +163 -0
- package/extensions/devops/skills/infra-as-code.md +158 -0
- package/extensions/devops/skills/kubernetes.md +110 -0
- package/extensions/devops/skills/monitoring.md +57 -0
- package/extensions/devops/skills/server-setup.md +64 -0
- package/extensions/devops/skills/ssl-domain.md +42 -0
- package/extensions/ecommerce/PACK.md +62 -226
- package/extensions/ecommerce/skills/cart-system.md +79 -0
- package/extensions/ecommerce/skills/inventory-mgmt.md +102 -0
- package/extensions/ecommerce/skills/order-management.md +126 -0
- package/extensions/ecommerce/skills/payment-integration.md +472 -0
- package/extensions/ecommerce/skills/shopify-dev.md +69 -0
- package/extensions/ecommerce/skills/subscription-billing.md +93 -0
- package/extensions/ecommerce/skills/tax-compliance.md +117 -0
- package/extensions/gamedev/PACK.md +66 -317
- package/extensions/gamedev/skills/asset-pipeline.md +74 -0
- package/extensions/gamedev/skills/audio-system.md +129 -0
- package/extensions/gamedev/skills/camera-system.md +87 -0
- package/extensions/gamedev/skills/ecs.md +98 -0
- package/extensions/gamedev/skills/game-loops.md +72 -0
- package/extensions/gamedev/skills/input-system.md +199 -0
- package/extensions/gamedev/skills/multiplayer.md +180 -0
- package/extensions/gamedev/skills/particles.md +105 -0
- package/extensions/gamedev/skills/physics-engine.md +89 -0
- package/extensions/gamedev/skills/scene-management.md +146 -0
- package/extensions/gamedev/skills/threejs-patterns.md +90 -0
- package/extensions/gamedev/skills/webgl.md +71 -0
- package/extensions/mobile/PACK.md +56 -223
- package/extensions/mobile/skills/app-store-connect.md +152 -0
- package/extensions/mobile/skills/app-store-prep.md +66 -0
- package/extensions/mobile/skills/deep-linking.md +109 -0
- package/extensions/mobile/skills/flutter.md +60 -0
- package/extensions/mobile/skills/ios-build-pipeline.md +142 -0
- package/extensions/mobile/skills/native-bridge.md +66 -0
- package/extensions/mobile/skills/ota-updates.md +97 -0
- package/extensions/mobile/skills/push-notifications.md +111 -0
- package/extensions/mobile/skills/react-native.md +82 -0
- package/extensions/saas/PACK.md +26 -720
- package/extensions/saas/skills/billing-integration.md +121 -0
- package/extensions/saas/skills/feature-flags.md +130 -0
- package/extensions/saas/skills/multi-tenant.md +103 -0
- package/extensions/saas/skills/onboarding-flow.md +139 -0
- package/extensions/saas/skills/subscription-flow.md +95 -0
- package/extensions/saas/skills/team-management.md +144 -0
- package/extensions/security/PACK.md +10 -448
- package/extensions/security/skills/api-security.md +140 -0
- package/extensions/security/skills/compliance.md +68 -0
- package/extensions/security/skills/owasp-audit.md +64 -0
- package/extensions/security/skills/pentest-patterns.md +77 -0
- package/extensions/security/skills/secret-mgmt.md +65 -0
- package/extensions/security/skills/supply-chain.md +65 -0
- package/extensions/trading/PACK.md +18 -535
- package/extensions/trading/skills/chart-components.md +55 -0
- package/extensions/trading/skills/experiment-loop.md +125 -0
- package/extensions/trading/skills/fintech-patterns.md +47 -0
- package/extensions/trading/skills/indicator-library.md +58 -0
- package/extensions/trading/skills/quant-analysis.md +111 -0
- package/extensions/trading/skills/realtime-data.md +58 -0
- package/extensions/trading/skills/trade-logic.md +104 -0
- package/extensions/ui/PACK.md +34 -853
- package/extensions/ui/skills/a11y-audit.md +91 -0
- package/extensions/ui/skills/animation-patterns.md +106 -0
- package/extensions/ui/skills/component-patterns.md +75 -0
- package/extensions/ui/skills/design-decision.md +98 -0
- package/extensions/ui/skills/design-system.md +68 -0
- package/extensions/ui/skills/landing-patterns.md +155 -0
- package/extensions/ui/skills/palette-picker.md +162 -0
- package/extensions/ui/skills/react-health.md +90 -0
- package/extensions/ui/skills/type-system.md +125 -0
- package/extensions/ui/skills/web-vitals.md +153 -0
- package/extensions/zalo/PACK.md +117 -0
- package/extensions/zalo/skills/zalo-oa-mcp.md +317 -0
- package/extensions/zalo/skills/zalo-oa-messaging.md +429 -0
- package/extensions/zalo/skills/zalo-oa-setup.md +236 -0
- package/extensions/zalo/skills/zalo-oa-webhook.md +189 -0
- package/extensions/zalo/skills/zalo-personal-messaging.md +194 -0
- package/extensions/zalo/skills/zalo-personal-setup.md +153 -0
- package/extensions/zalo/skills/zalo-rate-guard.md +219 -0
- package/package.json +5 -2
- package/skills/brainstorm/SKILL.md +63 -1
- package/skills/cook/SKILL.md +89 -6
- package/skills/debug/SKILL.md +5 -0
- package/skills/fix/SKILL.md +5 -0
- package/skills/mcp-builder/SKILL.md +48 -1
- package/skills/neural-memory/SKILL.md +362 -0
- package/skills/plan/SKILL.md +3 -0
- package/skills/rescue/SKILL.md +5 -0
- package/skills/review/SKILL.md +44 -5
- package/skills/review-intake/SKILL.md +17 -1
- package/skills/skill-router/SKILL.md +106 -8
- package/skills/team/SKILL.md +24 -1
- package/skills/test/SKILL.md +18 -0
- package/skills/verification/SKILL.md +40 -1
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: "@rune/devops"
|
|
3
|
-
description: DevOps patterns — Docker, CI/CD pipelines, monitoring setup, server configuration,
|
|
3
|
+
description: DevOps patterns — Docker, CI/CD pipelines, monitoring setup, server configuration, SSL/domain management, edge/serverless deployment, and infrastructure-as-code.
|
|
4
4
|
metadata:
|
|
5
5
|
author: runedev
|
|
6
|
-
version: "0.
|
|
6
|
+
version: "0.3.0"
|
|
7
7
|
layer: L4
|
|
8
8
|
price: "$12"
|
|
9
9
|
target: DevOps engineers
|
|
10
|
+
format: split
|
|
10
11
|
---
|
|
11
12
|
|
|
12
13
|
# @rune/devops
|
|
13
14
|
|
|
14
15
|
## Purpose
|
|
15
16
|
|
|
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,
|
|
17
|
+
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, SSL certificates that expire silently, serverless functions that leak state across requests, and infrastructure provisioned by hand that can't be reproduced. This pack provides battle-tested patterns for containerization, continuous delivery, production observability, server hardening, edge/serverless deployment, and infrastructure-as-code — each skill detects what you have, audits it against best practices, and emits the fixed config.
|
|
17
18
|
|
|
18
19
|
## Triggers
|
|
19
20
|
|
|
@@ -23,458 +24,26 @@ Infrastructure work done without patterns leads to snowflake configs: Dockerfile
|
|
|
23
24
|
- `/rune monitoring` — set up or audit production monitoring
|
|
24
25
|
- `/rune server-setup` — audit server configuration
|
|
25
26
|
- `/rune ssl-domain` — manage SSL certificates and domain config
|
|
27
|
+
- `/rune edge-serverless` — audit and configure edge/serverless deployment
|
|
28
|
+
- `/rune infra-as-code` — audit and structure Terraform/Pulumi/CDK infrastructure
|
|
29
|
+
- `/rune chaos-testing` — design and run resilience experiments
|
|
30
|
+
- `/rune kubernetes` — audit and emit production-ready Kubernetes manifests
|
|
26
31
|
- Called by `deploy` (L2) when deployment infrastructure needs setup
|
|
27
32
|
- Called by `launch` (L1) when preparing production environment
|
|
28
33
|
|
|
29
34
|
## Skills Included
|
|
30
35
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
Dockerfile and docker-compose patterns — multi-stage builds, layer optimization, security hardening, development vs production configs.
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
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
|
-
```
|
|
36
|
+
| Skill | Model | Description |
|
|
37
|
+
|-------|-------|-------------|
|
|
38
|
+
| [docker](skills/docker.md) | sonnet | Dockerfile and docker-compose patterns — multi-stage builds, layer optimization, security hardening, development vs production configs. |
|
|
39
|
+
| [ci-cd](skills/ci-cd.md) | sonnet | CI/CD pipeline configuration — GitHub Actions, GitLab CI, build matrices, test parallelization, deployment gates, semantic release. |
|
|
40
|
+
| [monitoring](skills/monitoring.md) | sonnet | Production monitoring setup — Prometheus, Grafana, alerting rules, SLO/SLI definitions, log aggregation, distributed tracing. |
|
|
41
|
+
| [server-setup](skills/server-setup.md) | sonnet | Server configuration — Nginx/Caddy reverse proxy, systemd services, firewall rules, SSH hardening, automatic updates. |
|
|
42
|
+
| [ssl-domain](skills/ssl-domain.md) | sonnet | SSL certificate management and domain configuration — Let's Encrypt automation, DNS records, CDN setup, redirect rules. |
|
|
43
|
+
| [chaos-testing](skills/chaos-testing.md) | sonnet | Resilience testing — inject controlled failures to verify circuit breakers, retry logic, graceful degradation, and recovery procedures. |
|
|
44
|
+
| [kubernetes](skills/kubernetes.md) | sonnet | Kubernetes resource patterns — Deployments, Services, ConfigMaps, resource limits, health probes, HPA, network policies, and RBAC. |
|
|
45
|
+
| [edge-serverless](skills/edge-serverless.md) | sonnet | Edge and serverless deployment patterns — Cloudflare Workers, Vercel Edge Functions, AWS Lambda, Deno Deploy. Runtime constraints, cold starts, streaming, state management. |
|
|
46
|
+
| [infra-as-code](skills/infra-as-code.md) | sonnet | Infrastructure-as-Code patterns — Terraform, Pulumi, and CDK. State management, module organization, secret handling, drift detection, CI/CD integration. |
|
|
478
47
|
|
|
479
48
|
## Tech Stack Support
|
|
480
49
|
|
|
@@ -485,14 +54,24 @@ Called By ← cook (L1): when DevOps task detected
|
|
|
485
54
|
| Vercel | Serverless | Built-in | Built-in |
|
|
486
55
|
| DigitalOcean (Droplet/App Platform) | Docker | GitHub Actions | Nginx / Caddy |
|
|
487
56
|
| VPS (any) | Docker | GitHub Actions (self-hosted) | Nginx / Caddy |
|
|
57
|
+
| Cloudflare Workers | Wrangler | GitHub Actions / Wrangler deploy | Workers Routes |
|
|
58
|
+
| Deno Deploy | Deno runtime | deployctl / GitHub Actions | Built-in |
|
|
59
|
+
| Fly.io | Docker/Firecracker | flyctl / GitHub Actions | Fly Proxy |
|
|
488
60
|
|
|
489
|
-
##
|
|
61
|
+
## Connections
|
|
490
62
|
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
63
|
+
```
|
|
64
|
+
Calls → verification (L3): validate configs syntax and test infrastructure changes
|
|
65
|
+
Calls → sentinel (L2): security audit on server and container configuration
|
|
66
|
+
Calls → sentinel-env (L3): edge-serverless validates runtime prerequisites before deployment
|
|
67
|
+
Called By ← deploy (L2): deployment infrastructure setup
|
|
68
|
+
Called By ← launch (L1): production environment preparation
|
|
69
|
+
Called By ← cook (L1): when DevOps task detected
|
|
70
|
+
Called By ← scaffold (L1): infra-as-code generates infrastructure alongside project bootstrap
|
|
71
|
+
edge-serverless → docker: containerized apps may deploy to serverless container platforms (Cloud Run, Fly.io)
|
|
72
|
+
infra-as-code → ci-cd: IaC changes flow through CI/CD with plan-and-apply pipeline
|
|
73
|
+
infra-as-code → monitoring: IaC provisions monitoring infrastructure (alerts, dashboards)
|
|
74
|
+
```
|
|
496
75
|
|
|
497
76
|
## Sharp Edges
|
|
498
77
|
|
|
@@ -512,9 +91,11 @@ Called By ← cook (L1): when DevOps task detected
|
|
|
512
91
|
- Monitoring covers RED metrics, structured logging, and SLO-based alerting
|
|
513
92
|
- Server hardened: key-only SSH, firewall, security headers, rate limiting
|
|
514
93
|
- SSL automated with renewal verification
|
|
94
|
+
- Edge/serverless config audited: no anti-patterns (floating promises, global state, unbounded buffering), correct platform bindings, streaming patterns applied
|
|
95
|
+
- IaC structured: remote state with locking, modular layout, environment separation, CI/CD pipeline for plan/apply, `prevent_destroy` on critical resources
|
|
515
96
|
- All emitted configs tested with syntax validation commands
|
|
516
97
|
- Structured report emitted for each skill invoked
|
|
517
98
|
|
|
518
99
|
## Cost Profile
|
|
519
100
|
|
|
520
|
-
~
|
|
101
|
+
~16,000–28,000 tokens per full pack run (all 9 skills). Individual skill: ~2,000–4,500 tokens. Sonnet default. Use haiku for config detection scans; escalate to sonnet for config generation and security audit.
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: "chaos-testing"
|
|
3
|
+
pack: "@rune/devops"
|
|
4
|
+
description: "Resilience testing — inject controlled failures to verify system behavior under degraded conditions. Validates circuit breakers, retry logic, graceful degradation, and recovery procedures."
|
|
5
|
+
model: sonnet
|
|
6
|
+
tools: [Read, Edit, Write, Grep, Glob, Bash]
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# chaos-testing
|
|
10
|
+
|
|
11
|
+
Resilience testing — inject controlled failures to verify system behavior under degraded conditions. Validates circuit breakers, retry logic, graceful degradation, and recovery procedures.
|
|
12
|
+
|
|
13
|
+
#### Workflow
|
|
14
|
+
|
|
15
|
+
**Step 1 — Map failure points**
|
|
16
|
+
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.
|
|
17
|
+
|
|
18
|
+
**Step 2 — Design chaos experiments**
|
|
19
|
+
For each critical dependency, define experiments:
|
|
20
|
+
- **Latency injection**: Add 2-5s delay to responses — does the UI show loading state? Do timeouts fire correctly?
|
|
21
|
+
- **Error injection**: Return 500/503 from dependency — does the circuit breaker open? Does fallback activate?
|
|
22
|
+
- **Partition**: Dependency becomes unreachable — does the system degrade gracefully or crash?
|
|
23
|
+
- **Data corruption**: Invalid response format — does validation catch it?
|
|
24
|
+
|
|
25
|
+
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).
|
|
26
|
+
|
|
27
|
+
**Step 3 — Generate test harnesses**
|
|
28
|
+
Emit test files that simulate each failure mode:
|
|
29
|
+
- Mock-based chaos for unit/integration tests (intercept HTTP, inject errors)
|
|
30
|
+
- Environment-variable-driven chaos for staging (feature flags to enable failure injection)
|
|
31
|
+
- Health check validation (verify `/health` endpoint reports degraded state, not crash)
|
|
32
|
+
|
|
33
|
+
Save experiment plan to `.rune/chaos/<date>-experiment.md`.
|
|
34
|
+
|
|
35
|
+
#### Example
|
|
36
|
+
|
|
37
|
+
```typescript
|
|
38
|
+
// Chaos test: Redis connection failure
|
|
39
|
+
describe('Chaos: Redis unavailable', () => {
|
|
40
|
+
beforeEach(() => {
|
|
41
|
+
// Simulate Redis connection refused
|
|
42
|
+
jest.spyOn(redisClient, 'get').mockRejectedValue(
|
|
43
|
+
new Error('ECONNREFUSED 127.0.0.1:6379')
|
|
44
|
+
);
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
it('falls back to database when cache is down', async () => {
|
|
48
|
+
const result = await getUserProfile('user-123');
|
|
49
|
+
expect(result).toBeDefined(); // still works
|
|
50
|
+
expect(dbClient.query).toHaveBeenCalled(); // used DB fallback
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
it('reports degraded health status', async () => {
|
|
54
|
+
const health = await request(app).get('/health');
|
|
55
|
+
expect(health.status).toBe(200);
|
|
56
|
+
expect(health.body.cache).toBe('degraded');
|
|
57
|
+
expect(health.body.overall).toBe('degraded'); // not 'down'
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
it('circuit breaker opens after 5 failures', async () => {
|
|
61
|
+
for (let i = 0; i < 5; i++) await getUserProfile(`user-${i}`);
|
|
62
|
+
// 6th call should not even attempt Redis
|
|
63
|
+
await getUserProfile('user-6');
|
|
64
|
+
expect(redisClient.get).toHaveBeenCalledTimes(5); // not 6
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
```
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: "ci-cd"
|
|
3
|
+
pack: "@rune/devops"
|
|
4
|
+
description: "CI/CD pipeline configuration — GitHub Actions, GitLab CI, build matrices, test parallelization, deployment gates, semantic release."
|
|
5
|
+
model: sonnet
|
|
6
|
+
tools: [Read, Edit, Write, Grep, Glob, Bash]
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# ci-cd
|
|
10
|
+
|
|
11
|
+
CI/CD pipeline configuration — GitHub Actions, GitLab CI, build matrices, test parallelization, deployment gates, semantic release.
|
|
12
|
+
|
|
13
|
+
#### Workflow
|
|
14
|
+
|
|
15
|
+
**Step 1 — Detect existing pipeline**
|
|
16
|
+
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.
|
|
17
|
+
|
|
18
|
+
**Step 2 — Audit pipeline efficiency**
|
|
19
|
+
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.
|
|
20
|
+
|
|
21
|
+
**Step 3 — Emit optimized pipeline**
|
|
22
|
+
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.
|
|
23
|
+
|
|
24
|
+
#### Example
|
|
25
|
+
|
|
26
|
+
```yaml
|
|
27
|
+
# GitHub Actions — optimized Node.js pipeline
|
|
28
|
+
name: CI/CD
|
|
29
|
+
on:
|
|
30
|
+
push: { branches: [main] }
|
|
31
|
+
pull_request: { branches: [main] }
|
|
32
|
+
|
|
33
|
+
jobs:
|
|
34
|
+
quality:
|
|
35
|
+
runs-on: ubuntu-latest
|
|
36
|
+
strategy:
|
|
37
|
+
matrix:
|
|
38
|
+
check: [lint, typecheck, test]
|
|
39
|
+
steps:
|
|
40
|
+
- uses: actions/checkout@v4
|
|
41
|
+
- uses: actions/setup-node@v4
|
|
42
|
+
with: { node-version: 20, cache: 'npm' }
|
|
43
|
+
- run: npm ci
|
|
44
|
+
- run: npm run ${{ matrix.check }}
|
|
45
|
+
|
|
46
|
+
build:
|
|
47
|
+
needs: quality
|
|
48
|
+
runs-on: ubuntu-latest
|
|
49
|
+
steps:
|
|
50
|
+
- uses: actions/checkout@v4
|
|
51
|
+
- uses: actions/setup-node@v4
|
|
52
|
+
with: { node-version: 20, cache: 'npm' }
|
|
53
|
+
- run: npm ci && npm run build
|
|
54
|
+
- uses: actions/upload-artifact@v4
|
|
55
|
+
with: { name: dist, path: dist/ }
|
|
56
|
+
|
|
57
|
+
deploy-staging:
|
|
58
|
+
needs: build
|
|
59
|
+
if: github.ref == 'refs/heads/main'
|
|
60
|
+
runs-on: ubuntu-latest
|
|
61
|
+
environment: staging
|
|
62
|
+
steps:
|
|
63
|
+
- uses: actions/download-artifact@v4
|
|
64
|
+
with: { name: dist }
|
|
65
|
+
- run: echo "Deploy to staging..."
|
|
66
|
+
|
|
67
|
+
deploy-production:
|
|
68
|
+
needs: deploy-staging
|
|
69
|
+
runs-on: ubuntu-latest
|
|
70
|
+
environment: production # requires manual approval
|
|
71
|
+
steps:
|
|
72
|
+
- uses: actions/download-artifact@v4
|
|
73
|
+
with: { name: dist }
|
|
74
|
+
- run: echo "Deploy to production..."
|
|
75
|
+
```
|