@luanpdd/kit-mcp 1.35.0 → 1.36.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.
Files changed (117) hide show
  1. package/bin/cli.js +2 -2
  2. package/bin/mcp.js +6 -6
  3. package/bin/ui.js +74 -74
  4. package/gates/ai-prompt-stability.md +120 -120
  5. package/gates/budget-description.md +68 -68
  6. package/gates/confidence.md +29 -29
  7. package/gates/dependency-check.md +33 -33
  8. package/gates/dept-cycle-prevention.md +179 -179
  9. package/gates/golden-signals-coverage.md +133 -133
  10. package/gates/legacy-refactor-safety.md +178 -178
  11. package/gates/multi-tenant-rls-coverage.md +102 -102
  12. package/gates/no-personal-uuid.md +72 -72
  13. package/gates/obs-agents-mcp-supabase.md +86 -86
  14. package/gates/obs-skills-frontmatter.md +76 -76
  15. package/gates/observability-coverage.md +151 -151
  16. package/gates/omm-no-regression.md +83 -83
  17. package/gates/postmortem-template-required.md +127 -127
  18. package/gates/prr-checklist-coverage.md +128 -128
  19. package/gates/regression.md +32 -32
  20. package/gates/release-pipeline-policy.md +132 -132
  21. package/gates/secrets-scan.md +33 -33
  22. package/gates/service-role-not-in-user-facing.md +113 -113
  23. package/gates/skill-must-include.md +71 -71
  24. package/gates/sync-idempotent.md +62 -62
  25. package/gates/verify-phase-goal.md +34 -34
  26. package/kit/agents/designer-ui.md +216 -216
  27. package/kit/agents/workflow-generator.md +537 -167
  28. package/kit/commands/adicionar-backlog.md +1 -1
  29. package/kit/commands/adicionar-fase.md +1 -1
  30. package/kit/commands/adicionar-tarefa.md +1 -1
  31. package/kit/commands/auditar-observabilidade.md +103 -103
  32. package/kit/commands/auditar-toil.md +129 -129
  33. package/kit/commands/caracterizar-prompt.md +195 -195
  34. package/kit/commands/criar-workflow.md +158 -158
  35. package/kit/commands/definir-perfil.md +1 -1
  36. package/kit/commands/definir-slo.md +108 -108
  37. package/kit/commands/fio.md +1 -1
  38. package/kit/commands/golden-signals.md +142 -142
  39. package/kit/commands/instrumentar-fase.md +200 -200
  40. package/kit/commands/investigar-producao.md +162 -162
  41. package/kit/commands/observabilidade.md +118 -118
  42. package/kit/commands/postmortem.md +179 -179
  43. package/kit/commands/prr.md +205 -205
  44. package/kit/commands/publicar-rapido.md +207 -207
  45. package/kit/commands/risk-budget.md +220 -220
  46. package/kit/commands/sre.md +230 -230
  47. package/kit/file-manifest.json +424 -424
  48. package/kit/framework/references/output-style.md +22 -22
  49. package/kit/hooks/post-apply-migration.js +199 -199
  50. package/kit/hooks/sidecar-tool-publisher.js +210 -210
  51. package/kit/skills/_shared-dados-distribuidos/glossary.md +224 -224
  52. package/kit/skills/_shared-legacy/glossary.md +389 -389
  53. package/kit/skills/_shared-multi-tenant/glossary.md +186 -186
  54. package/kit/skills/_shared-observability/glossary.md +396 -396
  55. package/kit/skills/_shared-sre/glossary.md +712 -712
  56. package/kit/skills/_shared-supabase/glossary.md +234 -234
  57. package/kit/skills/blameless-postmortems/SKILL.md +340 -340
  58. package/kit/skills/burn-rate-alerting/SKILL.md +258 -258
  59. package/kit/skills/cascading-failures/SKILL.md +311 -311
  60. package/kit/skills/core-analysis-loop/SKILL.md +352 -352
  61. package/kit/skills/distributed-tracing/SKILL.md +362 -362
  62. package/kit/skills/dynamic-workflow-authoring/SKILL.md +327 -223
  63. package/kit/skills/eliminating-toil/SKILL.md +243 -243
  64. package/kit/skills/event-based-slos/SKILL.md +296 -296
  65. package/kit/skills/four-golden-signals/SKILL.md +314 -314
  66. package/kit/skills/hermetic-builds/SKILL.md +323 -323
  67. package/kit/skills/legacy-monster-methods/SKILL.md +444 -444
  68. package/kit/skills/llm-as-dependency/SKILL.md +436 -436
  69. package/kit/skills/load-shedding-graceful-degradation/SKILL.md +396 -396
  70. package/kit/skills/observability-driven-development/SKILL.md +315 -315
  71. package/kit/skills/observability-maturity-model/SKILL.md +222 -222
  72. package/kit/skills/opentelemetry-standard/SKILL.md +351 -351
  73. package/kit/skills/production-readiness-review/SKILL.md +305 -305
  74. package/kit/skills/release-engineering/SKILL.md +367 -367
  75. package/kit/skills/retry-strategies/SKILL.md +372 -372
  76. package/kit/skills/sre-risk-management/SKILL.md +221 -221
  77. package/kit/skills/structured-events/SKILL.md +265 -265
  78. package/kit/skills/supabase-cron-queues/SKILL.md +275 -275
  79. package/kit/skills/supabase-database-functions/SKILL.md +332 -332
  80. package/kit/skills/supabase-declarative-schema/SKILL.md +183 -183
  81. package/kit/skills/supabase-pgvector-rag/SKILL.md +253 -253
  82. package/kit/skills/supabase-postgres-style/SKILL.md +138 -138
  83. package/kit/skills/supabase-storage/SKILL.md +234 -234
  84. package/kit/skills/telemetry-pipelines/SKILL.md +259 -259
  85. package/kit/skills/telemetry-sampling/SKILL.md +256 -256
  86. package/kit/skills/ui-anti-padroes-ia/SKILL.md +261 -261
  87. package/kit/skills/ui-contexto-produto/SKILL.md +248 -248
  88. package/kit/skills/ui-cor-estrategia/SKILL.md +213 -213
  89. package/kit/skills/ui-critica-auditoria/SKILL.md +260 -260
  90. package/kit/skills/ui-motion-funcional/SKILL.md +264 -264
  91. package/kit/skills/ui-ritmo-espacial/SKILL.md +259 -259
  92. package/kit/skills/ui-tipografia/SKILL.md +211 -211
  93. package/package.json +1 -1
  94. package/src/cli/index.js +1114 -1114
  95. package/src/cli/render.js +194 -194
  96. package/src/cli/upgrade-check.js +135 -135
  97. package/src/core/error-redaction.js +76 -76
  98. package/src/core/failures.js +153 -153
  99. package/src/core/gate-runner.js +205 -205
  100. package/src/core/gates.js +82 -82
  101. package/src/core/logger.js +170 -170
  102. package/src/core/manifest-verify.js +174 -174
  103. package/src/core/metrics.js +268 -268
  104. package/src/core/notify.js +60 -60
  105. package/src/core/path-safety.js +141 -141
  106. package/src/core/replays.js +120 -120
  107. package/src/core/ui.js +185 -185
  108. package/src/mcp-server/install.js +149 -149
  109. package/src/mcp-server/roots.js +124 -124
  110. package/src/ui/auto-spawn.js +113 -113
  111. package/src/ui/browser.js +78 -78
  112. package/src/ui/client.js +130 -130
  113. package/src/ui/events.js +65 -65
  114. package/src/ui/lockfile.js +191 -191
  115. package/src/ui/port.js +67 -67
  116. package/src/ui/server.js +547 -547
  117. package/src/ui/wrapper.js +129 -129
@@ -1,323 +1,323 @@
1
- ---
2
- name: hermetic-builds
3
- description: Use ao desenhar/auditar pipeline de build — reproducibility + isolation + provenance + lockfiles + frozen-install + SLSA framework. Cap 8 livro Google SRE.
4
- ---
5
-
6
- # SRE — Hermetic Builds
7
-
8
- ## Quando usar
9
-
10
- LLM carrega esta skill ao desenhar/auditar CI/CD ou ao investigar discrepância "no meu ambiente roda". Trigger phrases:
11
-
12
- - "hermetic build", "reproducible build"
13
- - "build cache", "lockfile"
14
- - "frozen-lockfile", "npm ci", "pnpm install --frozen-lockfile"
15
- - "build provenance", "SLSA"
16
- - "config drift entre environments"
17
- - "cap 8 Google SRE"
18
-
19
- ## Regras absolutas
20
-
21
- - **Hermetic = mesmo input → mesmo output, qualquer máquina, qualquer momento.** Sem essa propriedade, build não é determinístico → forensics impossível.
22
- - **Lockfile commitado SEMPRE.** `package-lock.json`, `pnpm-lock.yaml`, `deno.lock`, `Cargo.lock`, `go.sum`, `Pipfile.lock`. Sem lockfile = não-reproducible.
23
- - **CI usa `frozen-lockfile` mode.** `npm ci` (não `npm install`), `pnpm install --frozen-lockfile`, `cargo install --locked`, `pip install --require-hashes`. Modo CI FALHA se lockfile não-sincronizado.
24
- - **Sem network durante build (após install step).** Build hermético: depois de baixar deps, build OFFLINE. Network durante build = não-reprodutível.
25
- - **Sem timestamps em output.** `--no-timestamps` em compilers; SOURCE_DATE_EPOCH em outros. Output bit-idêntico entre runs.
26
- - **Build provenance gerada (SLSA framework).** Metadata: commit SHA + builder ID + deps versions + signatures. Cada artefato tem proveniência.
27
- - **Build cache require hermeticidade.** Cache hit baseado em hash de input; só funciona se output é determinístico.
28
-
29
- ## Patterns canônicos
30
-
31
- ### Pattern 1: Lockfile workflow canônico (JS/TS)
32
-
33
- ```bash
34
- # DEV — adicionando dep
35
- pnpm add zod # atualiza package.json + lockfile
36
- git add package.json pnpm-lock.yaml
37
- git commit -m "deps: add zod"
38
-
39
- # CI — install
40
- pnpm install --frozen-lockfile # falha se lockfile dessincronizado
41
- # (= alguém esqueceu de commitar lockfile)
42
-
43
- # OUTROS LOCKS canônicos:
44
- # Node/npm: npm ci (npm 7+, requer package-lock.json)
45
- # Node/yarn: yarn install --immutable (yarn 2+)
46
- # Node/pnpm: pnpm install --frozen-lockfile
47
- # Deno: deno install --frozen
48
- # Python/pip: pip install --require-hashes -r requirements.txt
49
- # Python/poetry: poetry install --no-interaction
50
- # Rust: cargo install --locked (locked == respect Cargo.lock)
51
- # Go: go mod download (go.sum acts como lockfile)
52
- # Ruby: bundle install --frozen
53
- ```
54
-
55
- ### Pattern 2: GitHub Actions hermetic recipe
56
-
57
- ```yaml
58
- # .github/workflows/build.yml — hermetic build
59
- name: Build & Test
60
- on: [push, pull_request]
61
-
62
- jobs:
63
- build:
64
- runs-on: ubuntu-latest
65
- steps:
66
- - uses: actions/checkout@v6
67
- with:
68
- # PT-BR: full clone para git provenance
69
- fetch-depth: 0
70
-
71
- - uses: actions/setup-node@v6
72
- with:
73
- node-version: '24' # ← VERSÃO PINADA
74
- cache: 'pnpm'
75
-
76
- # PT-BR: pnpm cache sincronizado com lockfile hash
77
- - uses: pnpm/action-setup@v4
78
- with:
79
- version: 9.15.0 # ← VERSÃO PINADA
80
-
81
- # PT-BR: install com frozen-lockfile (falha se desync)
82
- - run: pnpm install --frozen-lockfile
83
-
84
- # PT-BR: build OFFLINE — sem rede após install
85
- - run: pnpm build
86
- env:
87
- # disable any network call
88
- NODE_OPTIONS: '--no-network-family-autoselection'
89
-
90
- # PT-BR: tests
91
- - run: pnpm test
92
-
93
- # PT-BR: provenance attestation (SLSA Level 3)
94
- - uses: actions/attest-build-provenance@v3
95
- if: github.event_name == 'push'
96
- with:
97
- subject-path: 'dist/**/*'
98
- ```
99
-
100
- ### Pattern 3: Dockerfile hermetic
101
-
102
- ```dockerfile
103
- # PT-BR: Dockerfile reprodutível
104
- # Versão de base PINADA por hash, não por tag mutável
105
- FROM node:24-alpine@sha256:abc123def456...
106
-
107
- WORKDIR /app
108
-
109
- # PT-BR: lockfile copiado primeiro para cache hit
110
- COPY package.json pnpm-lock.yaml ./
111
-
112
- # PT-BR: install determinístico
113
- RUN corepack enable && \
114
- pnpm install --frozen-lockfile --prod
115
-
116
- # PT-BR: copiar source DEPOIS para cache de install
117
- COPY . .
118
-
119
- # PT-BR: build sem timestamps
120
- ENV SOURCE_DATE_EPOCH=0
121
- RUN pnpm build
122
-
123
- # Runtime stage
124
- FROM node:24-alpine@sha256:abc123def456...
125
- COPY --from=0 /app/dist /app/dist
126
- COPY --from=0 /app/node_modules /app/node_modules
127
- COPY --from=0 /app/package.json /app/
128
-
129
- CMD ["node", "/app/dist/index.js"]
130
- ```
131
-
132
- **Key:** image base PINADA por SHA, não tag. Tag `node:24-alpine` muta; SHA é imutável.
133
-
134
- ### Pattern 4: Build provenance via SLSA
135
-
136
- SLSA (Supply chain Levels for Software Artifacts) tem 4 níveis:
137
-
138
- ```text
139
- SLSA Level 1 — basic
140
- - source/build documentado
141
- - provenance gerada (algum metadata)
142
-
143
- SLSA Level 2 — hosted build
144
- - build em CI hosted (não local)
145
- - provenance assinada por builder
146
- - source version controlled
147
-
148
- SLSA Level 3 — non-falsifiable provenance
149
- - builder isolado, não controlável por dev
150
- - provenance includes: source SHA, build env, deps
151
- - cryptographically signed
152
-
153
- SLSA Level 4 — hermetic + 2-party review
154
- - hermetic build (esta skill)
155
- - 2 reviewers required
156
- - reproducible: 2 builders independentes produzem hash igual
157
- ```
158
-
159
- GitHub Actions tem `actions/attest-build-provenance` para SLSA Level 3.
160
-
161
- ### Pattern 5: Detectando builds não-hermético
162
-
163
- Heurísticas para detectar:
164
-
165
- ```bash
166
- # 1. Build referencia variáveis de tempo
167
- grep -rE "Date\.now|new Date|time\.Now|datetime\.now" Dockerfile build.sh
168
- # OK em runtime; problema se em build step (timestamp em output)
169
-
170
- # 2. Build faz network calls após install
171
- strace -f -e trace=network make build 2>&1 | grep -E "connect|sendto"
172
- # Esperado: zero output após "install" step
173
-
174
- # 3. Build depende de env var não-pinada
175
- env | grep -E "BUILD_|RELEASE_" | grep -v -E "VERSION=|HASH="
176
- # Vars dinâmicas = build difere entre runs
177
-
178
- # 4. Lockfile dessincronizado
179
- pnpm install --frozen-lockfile --offline
180
- # Falha se lockfile desync; sucesso = OK
181
-
182
- # 5. 2 builds consecutivos produzem mesmo hash?
183
- hash1=$(make build && sha256sum dist/main.js)
184
- make clean && hash2=$(make build && sha256sum dist/main.js)
185
- [ "$hash1" = "$hash2" ] && echo "hermetic" || echo "non-hermetic"
186
- ```
187
-
188
- ### Pattern 6: Common pitfalls
189
-
190
- ```text
191
- PITFALL 1: Floating tags em base images
192
- FROM node:latest ← muta toda hora
193
- FROM node:24 ← muta minor versions
194
- FROM node:24-alpine ← muta patch versions
195
- FROM node:24-alpine@sha256:abc... ← imutável (DESEJADO)
196
-
197
- PITFALL 2: env vars dinâmicas em build
198
- RUN echo "BUILD_TIME=$(date)" > /app/build-info ← timestamp variável
199
- RUN echo "BUILD_TIME=$BUILD_TIME" > /app/build-info ← OK se passa em arg pinado
200
-
201
- PITFALL 3: random ports/UUIDs em build
202
- RUN node -e "fs.writeFileSync('id.txt', crypto.randomUUID())"
203
- ← cada build = id diferente. Anti-hermético.
204
-
205
- PITFALL 4: dependências baixadas em build, não install
206
- RUN apk add curl && curl https://example.com/script.sh | sh
207
- ← não-deterministic. Vendor pode mudar script.
208
-
209
- PITFALL 5: __pycache__ / .DS_Store em image
210
- ← pode invalidar cache; varia entre OS de dev
211
- ```
212
-
213
- ### Pattern 7: Build cache (hermetic permits caching)
214
-
215
- ```text
216
- Build cache só funciona com hermeticidade:
217
-
218
- cache_key = hash(source_files + deps_lockfile + build_config)
219
-
220
- Se hermético:
221
- same input → same output
222
- cache_key colide → reuse output (10-100× faster)
223
-
224
- Se não-hermético:
225
- same input → different output
226
- cache cant be trusted; always rebuild
227
-
228
- GitHub Actions cache action exemplo:
229
- - uses: actions/cache@v4
230
- with:
231
- path: |
232
- ~/.pnpm-store
233
- node_modules
234
- key: ${{ runner.os }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
235
- restore-keys: |
236
- ${{ runner.os }}-pnpm-
237
- ```
238
-
239
- ## Anti-patterns
240
-
241
- ### ANTI: lockfile não commitado
242
-
243
- ```text
244
- ANTI: pnpm-lock.yaml em .gitignore. "Cada dev resolve sozinho".
245
-
246
- PROBLEMA: builds não-reprodutíveis. Bugs irrelacionáveis ao código.
247
- "No meu ambiente funciona" eternal.
248
-
249
- CERTO: lockfile SEMPRE commitado. Single source of truth de dep
250
- versions. CI valida sincronia via --frozen-lockfile.
251
- ```
252
-
253
- ### ANTI: `npm install` em CI
254
-
255
- ```text
256
- ANTI: CI roda `npm install` (não `npm ci`).
257
-
258
- PROBLEMA: install pode resolver versions diferentemente entre CI runs.
259
- Bug que aparece "às vezes".
260
-
261
- CERTO: `npm ci` (CI mode) — falha se lockfile desync; install
262
- puramente determinístico.
263
- ```
264
-
265
- ### ANTI: image base por tag mutável
266
-
267
- ```text
268
- ANTI: FROM node:24-alpine
269
-
270
- PROBLEMA: cada rebuild puxa versão diferente quando Alpine atualiza.
271
- Build de hoje !== build de amanhã.
272
-
273
- CERTO: FROM node:24-alpine@sha256:abc...
274
- Imutável. Update explicitamente trocando SHA.
275
- ```
276
-
277
- ### ANTI: build sem provenance
278
-
279
- ```text
280
- ANTI: artefato em prod sem metadata sobre origem.
281
-
282
- PROBLEMA: incident — qual commit? que deps? quem buildou? Sem provenance,
283
- forensics chaves manuais.
284
-
285
- CERTO: attest-build-provenance ativa SLSA. Cada artefato tem JSON
286
- attestado: source SHA, build env, deps, signatures.
287
- ```
288
-
289
- ### ANTI: build cache em ambiente não-hermético
290
-
291
- ```text
292
- ANTI: cache hit em build não-deterministic. Output cacheado pode estar
293
- bugged.
294
-
295
- PROBLEMA: bug "cacheado", aparece intermitente.
296
-
297
- CERTO: hermeticidade primeiro, cache depois. Se 2 builds não produzem
298
- mesmo hash, cache é inválido.
299
- ```
300
-
301
- ## Verificação
302
-
303
- 1. Lockfile commitado para cada package manager usado
304
- 2. CI usa frozen-lockfile mode (`npm ci`, `--frozen-lockfile`, `--locked`, `--require-hashes`)
305
- 3. Image base pinada por SHA (não tag mutável)
306
- 4. Sem network calls após install step
307
- 5. Sem timestamps/UUIDs/random gerados em build
308
- 6. SOURCE_DATE_EPOCH=0 ou similar em compilers
309
- 7. Build provenance gerada (SLSA Level 3 mínimo)
310
- 8. 2 builds consecutivos produzem hash igual
311
-
312
- ---
313
-
314
- ## Ver também
315
-
316
- - [`_shared-sre/glossary.md`](../_shared-sre/glossary.md) — vocabulário (hermetic, lockfile, SLSA, etc.)
317
- - [`release-engineering`](../release-engineering/SKILL.md) (v1.11) — pipeline orchestration; hermetic é fundação
318
- - [`production-readiness-review`](../production-readiness-review/SKILL.md) (v1.10) — PRR Axe 5 verifica hermeticidade
319
- - [`prr-conductor`](../../agents/prr-conductor.md) (v1.10 + patch v1.11) — Axe 5 ganha checks de hermeticidade
320
- - [`release-pipeline-auditor`](../../agents/release-pipeline-auditor.md) (v1.11) — agent que audita
321
- - [`/auditar-release`](../../commands/auditar-release.md) (v1.11) — comando
322
-
323
- *Material-fonte: Site Reliability Engineering — Beyer/Jones/Petoff/Murphy (Google/O'Reilly, 2016) — Cap 8 (subsection sobre hermetic builds, build orchestration). Plus SLSA framework (slsa.dev).*
1
+ ---
2
+ name: hermetic-builds
3
+ description: Use ao desenhar/auditar pipeline de build — reproducibility + isolation + provenance + lockfiles + frozen-install + SLSA framework. Cap 8 livro Google SRE.
4
+ ---
5
+
6
+ # SRE — Hermetic Builds
7
+
8
+ ## Quando usar
9
+
10
+ LLM carrega esta skill ao desenhar/auditar CI/CD ou ao investigar discrepância "no meu ambiente roda". Trigger phrases:
11
+
12
+ - "hermetic build", "reproducible build"
13
+ - "build cache", "lockfile"
14
+ - "frozen-lockfile", "npm ci", "pnpm install --frozen-lockfile"
15
+ - "build provenance", "SLSA"
16
+ - "config drift entre environments"
17
+ - "cap 8 Google SRE"
18
+
19
+ ## Regras absolutas
20
+
21
+ - **Hermetic = mesmo input → mesmo output, qualquer máquina, qualquer momento.** Sem essa propriedade, build não é determinístico → forensics impossível.
22
+ - **Lockfile commitado SEMPRE.** `package-lock.json`, `pnpm-lock.yaml`, `deno.lock`, `Cargo.lock`, `go.sum`, `Pipfile.lock`. Sem lockfile = não-reproducible.
23
+ - **CI usa `frozen-lockfile` mode.** `npm ci` (não `npm install`), `pnpm install --frozen-lockfile`, `cargo install --locked`, `pip install --require-hashes`. Modo CI FALHA se lockfile não-sincronizado.
24
+ - **Sem network durante build (após install step).** Build hermético: depois de baixar deps, build OFFLINE. Network durante build = não-reprodutível.
25
+ - **Sem timestamps em output.** `--no-timestamps` em compilers; SOURCE_DATE_EPOCH em outros. Output bit-idêntico entre runs.
26
+ - **Build provenance gerada (SLSA framework).** Metadata: commit SHA + builder ID + deps versions + signatures. Cada artefato tem proveniência.
27
+ - **Build cache require hermeticidade.** Cache hit baseado em hash de input; só funciona se output é determinístico.
28
+
29
+ ## Patterns canônicos
30
+
31
+ ### Pattern 1: Lockfile workflow canônico (JS/TS)
32
+
33
+ ```bash
34
+ # DEV — adicionando dep
35
+ pnpm add zod # atualiza package.json + lockfile
36
+ git add package.json pnpm-lock.yaml
37
+ git commit -m "deps: add zod"
38
+
39
+ # CI — install
40
+ pnpm install --frozen-lockfile # falha se lockfile dessincronizado
41
+ # (= alguém esqueceu de commitar lockfile)
42
+
43
+ # OUTROS LOCKS canônicos:
44
+ # Node/npm: npm ci (npm 7+, requer package-lock.json)
45
+ # Node/yarn: yarn install --immutable (yarn 2+)
46
+ # Node/pnpm: pnpm install --frozen-lockfile
47
+ # Deno: deno install --frozen
48
+ # Python/pip: pip install --require-hashes -r requirements.txt
49
+ # Python/poetry: poetry install --no-interaction
50
+ # Rust: cargo install --locked (locked == respect Cargo.lock)
51
+ # Go: go mod download (go.sum acts como lockfile)
52
+ # Ruby: bundle install --frozen
53
+ ```
54
+
55
+ ### Pattern 2: GitHub Actions hermetic recipe
56
+
57
+ ```yaml
58
+ # .github/workflows/build.yml — hermetic build
59
+ name: Build & Test
60
+ on: [push, pull_request]
61
+
62
+ jobs:
63
+ build:
64
+ runs-on: ubuntu-latest
65
+ steps:
66
+ - uses: actions/checkout@v6
67
+ with:
68
+ # PT-BR: full clone para git provenance
69
+ fetch-depth: 0
70
+
71
+ - uses: actions/setup-node@v6
72
+ with:
73
+ node-version: '24' # ← VERSÃO PINADA
74
+ cache: 'pnpm'
75
+
76
+ # PT-BR: pnpm cache sincronizado com lockfile hash
77
+ - uses: pnpm/action-setup@v4
78
+ with:
79
+ version: 9.15.0 # ← VERSÃO PINADA
80
+
81
+ # PT-BR: install com frozen-lockfile (falha se desync)
82
+ - run: pnpm install --frozen-lockfile
83
+
84
+ # PT-BR: build OFFLINE — sem rede após install
85
+ - run: pnpm build
86
+ env:
87
+ # disable any network call
88
+ NODE_OPTIONS: '--no-network-family-autoselection'
89
+
90
+ # PT-BR: tests
91
+ - run: pnpm test
92
+
93
+ # PT-BR: provenance attestation (SLSA Level 3)
94
+ - uses: actions/attest-build-provenance@v3
95
+ if: github.event_name == 'push'
96
+ with:
97
+ subject-path: 'dist/**/*'
98
+ ```
99
+
100
+ ### Pattern 3: Dockerfile hermetic
101
+
102
+ ```dockerfile
103
+ # PT-BR: Dockerfile reprodutível
104
+ # Versão de base PINADA por hash, não por tag mutável
105
+ FROM node:24-alpine@sha256:abc123def456...
106
+
107
+ WORKDIR /app
108
+
109
+ # PT-BR: lockfile copiado primeiro para cache hit
110
+ COPY package.json pnpm-lock.yaml ./
111
+
112
+ # PT-BR: install determinístico
113
+ RUN corepack enable && \
114
+ pnpm install --frozen-lockfile --prod
115
+
116
+ # PT-BR: copiar source DEPOIS para cache de install
117
+ COPY . .
118
+
119
+ # PT-BR: build sem timestamps
120
+ ENV SOURCE_DATE_EPOCH=0
121
+ RUN pnpm build
122
+
123
+ # Runtime stage
124
+ FROM node:24-alpine@sha256:abc123def456...
125
+ COPY --from=0 /app/dist /app/dist
126
+ COPY --from=0 /app/node_modules /app/node_modules
127
+ COPY --from=0 /app/package.json /app/
128
+
129
+ CMD ["node", "/app/dist/index.js"]
130
+ ```
131
+
132
+ **Key:** image base PINADA por SHA, não tag. Tag `node:24-alpine` muta; SHA é imutável.
133
+
134
+ ### Pattern 4: Build provenance via SLSA
135
+
136
+ SLSA (Supply chain Levels for Software Artifacts) tem 4 níveis:
137
+
138
+ ```text
139
+ SLSA Level 1 — basic
140
+ - source/build documentado
141
+ - provenance gerada (algum metadata)
142
+
143
+ SLSA Level 2 — hosted build
144
+ - build em CI hosted (não local)
145
+ - provenance assinada por builder
146
+ - source version controlled
147
+
148
+ SLSA Level 3 — non-falsifiable provenance
149
+ - builder isolado, não controlável por dev
150
+ - provenance includes: source SHA, build env, deps
151
+ - cryptographically signed
152
+
153
+ SLSA Level 4 — hermetic + 2-party review
154
+ - hermetic build (esta skill)
155
+ - 2 reviewers required
156
+ - reproducible: 2 builders independentes produzem hash igual
157
+ ```
158
+
159
+ GitHub Actions tem `actions/attest-build-provenance` para SLSA Level 3.
160
+
161
+ ### Pattern 5: Detectando builds não-hermético
162
+
163
+ Heurísticas para detectar:
164
+
165
+ ```bash
166
+ # 1. Build referencia variáveis de tempo
167
+ grep -rE "Date\.now|new Date|time\.Now|datetime\.now" Dockerfile build.sh
168
+ # OK em runtime; problema se em build step (timestamp em output)
169
+
170
+ # 2. Build faz network calls após install
171
+ strace -f -e trace=network make build 2>&1 | grep -E "connect|sendto"
172
+ # Esperado: zero output após "install" step
173
+
174
+ # 3. Build depende de env var não-pinada
175
+ env | grep -E "BUILD_|RELEASE_" | grep -v -E "VERSION=|HASH="
176
+ # Vars dinâmicas = build difere entre runs
177
+
178
+ # 4. Lockfile dessincronizado
179
+ pnpm install --frozen-lockfile --offline
180
+ # Falha se lockfile desync; sucesso = OK
181
+
182
+ # 5. 2 builds consecutivos produzem mesmo hash?
183
+ hash1=$(make build && sha256sum dist/main.js)
184
+ make clean && hash2=$(make build && sha256sum dist/main.js)
185
+ [ "$hash1" = "$hash2" ] && echo "hermetic" || echo "non-hermetic"
186
+ ```
187
+
188
+ ### Pattern 6: Common pitfalls
189
+
190
+ ```text
191
+ PITFALL 1: Floating tags em base images
192
+ FROM node:latest ← muta toda hora
193
+ FROM node:24 ← muta minor versions
194
+ FROM node:24-alpine ← muta patch versions
195
+ FROM node:24-alpine@sha256:abc... ← imutável (DESEJADO)
196
+
197
+ PITFALL 2: env vars dinâmicas em build
198
+ RUN echo "BUILD_TIME=$(date)" > /app/build-info ← timestamp variável
199
+ RUN echo "BUILD_TIME=$BUILD_TIME" > /app/build-info ← OK se passa em arg pinado
200
+
201
+ PITFALL 3: random ports/UUIDs em build
202
+ RUN node -e "fs.writeFileSync('id.txt', crypto.randomUUID())"
203
+ ← cada build = id diferente. Anti-hermético.
204
+
205
+ PITFALL 4: dependências baixadas em build, não install
206
+ RUN apk add curl && curl https://example.com/script.sh | sh
207
+ ← não-deterministic. Vendor pode mudar script.
208
+
209
+ PITFALL 5: __pycache__ / .DS_Store em image
210
+ ← pode invalidar cache; varia entre OS de dev
211
+ ```
212
+
213
+ ### Pattern 7: Build cache (hermetic permits caching)
214
+
215
+ ```text
216
+ Build cache só funciona com hermeticidade:
217
+
218
+ cache_key = hash(source_files + deps_lockfile + build_config)
219
+
220
+ Se hermético:
221
+ same input → same output
222
+ cache_key colide → reuse output (10-100× faster)
223
+
224
+ Se não-hermético:
225
+ same input → different output
226
+ cache cant be trusted; always rebuild
227
+
228
+ GitHub Actions cache action exemplo:
229
+ - uses: actions/cache@v4
230
+ with:
231
+ path: |
232
+ ~/.pnpm-store
233
+ node_modules
234
+ key: ${{ runner.os }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
235
+ restore-keys: |
236
+ ${{ runner.os }}-pnpm-
237
+ ```
238
+
239
+ ## Anti-patterns
240
+
241
+ ### ANTI: lockfile não commitado
242
+
243
+ ```text
244
+ ANTI: pnpm-lock.yaml em .gitignore. "Cada dev resolve sozinho".
245
+
246
+ PROBLEMA: builds não-reprodutíveis. Bugs irrelacionáveis ao código.
247
+ "No meu ambiente funciona" eternal.
248
+
249
+ CERTO: lockfile SEMPRE commitado. Single source of truth de dep
250
+ versions. CI valida sincronia via --frozen-lockfile.
251
+ ```
252
+
253
+ ### ANTI: `npm install` em CI
254
+
255
+ ```text
256
+ ANTI: CI roda `npm install` (não `npm ci`).
257
+
258
+ PROBLEMA: install pode resolver versions diferentemente entre CI runs.
259
+ Bug que aparece "às vezes".
260
+
261
+ CERTO: `npm ci` (CI mode) — falha se lockfile desync; install
262
+ puramente determinístico.
263
+ ```
264
+
265
+ ### ANTI: image base por tag mutável
266
+
267
+ ```text
268
+ ANTI: FROM node:24-alpine
269
+
270
+ PROBLEMA: cada rebuild puxa versão diferente quando Alpine atualiza.
271
+ Build de hoje !== build de amanhã.
272
+
273
+ CERTO: FROM node:24-alpine@sha256:abc...
274
+ Imutável. Update explicitamente trocando SHA.
275
+ ```
276
+
277
+ ### ANTI: build sem provenance
278
+
279
+ ```text
280
+ ANTI: artefato em prod sem metadata sobre origem.
281
+
282
+ PROBLEMA: incident — qual commit? que deps? quem buildou? Sem provenance,
283
+ forensics chaves manuais.
284
+
285
+ CERTO: attest-build-provenance ativa SLSA. Cada artefato tem JSON
286
+ attestado: source SHA, build env, deps, signatures.
287
+ ```
288
+
289
+ ### ANTI: build cache em ambiente não-hermético
290
+
291
+ ```text
292
+ ANTI: cache hit em build não-deterministic. Output cacheado pode estar
293
+ bugged.
294
+
295
+ PROBLEMA: bug "cacheado", aparece intermitente.
296
+
297
+ CERTO: hermeticidade primeiro, cache depois. Se 2 builds não produzem
298
+ mesmo hash, cache é inválido.
299
+ ```
300
+
301
+ ## Verificação
302
+
303
+ 1. Lockfile commitado para cada package manager usado
304
+ 2. CI usa frozen-lockfile mode (`npm ci`, `--frozen-lockfile`, `--locked`, `--require-hashes`)
305
+ 3. Image base pinada por SHA (não tag mutável)
306
+ 4. Sem network calls após install step
307
+ 5. Sem timestamps/UUIDs/random gerados em build
308
+ 6. SOURCE_DATE_EPOCH=0 ou similar em compilers
309
+ 7. Build provenance gerada (SLSA Level 3 mínimo)
310
+ 8. 2 builds consecutivos produzem hash igual
311
+
312
+ ---
313
+
314
+ ## Ver também
315
+
316
+ - [`_shared-sre/glossary.md`](../_shared-sre/glossary.md) — vocabulário (hermetic, lockfile, SLSA, etc.)
317
+ - [`release-engineering`](../release-engineering/SKILL.md) (v1.11) — pipeline orchestration; hermetic é fundação
318
+ - [`production-readiness-review`](../production-readiness-review/SKILL.md) (v1.10) — PRR Axe 5 verifica hermeticidade
319
+ - [`prr-conductor`](../../agents/prr-conductor.md) (v1.10 + patch v1.11) — Axe 5 ganha checks de hermeticidade
320
+ - [`release-pipeline-auditor`](../../agents/release-pipeline-auditor.md) (v1.11) — agent que audita
321
+ - [`/auditar-release`](../../commands/auditar-release.md) (v1.11) — comando
322
+
323
+ *Material-fonte: Site Reliability Engineering — Beyer/Jones/Petoff/Murphy (Google/O'Reilly, 2016) — Cap 8 (subsection sobre hermetic builds, build orchestration). Plus SLSA framework (slsa.dev).*