Skip to content

Commit 0b6d34d

Browse files
authored
ci: scope checks and worker deployments (#55)
## Summary - Route CI by changed surface and workspace dependency closure. - Preserve one required `static-checks` result while skipping inapplicable jobs. - Skip unchanged Cloudflare Workers and rely on Vercel native monorepo skipping. - Declare shared TypeScript configuration dependencies explicitly. ## Decisions - Core agent, webhooks, and gateway Workers deploy as one release set because readiness requires a shared SHA. - The preview proxy is independent and can deploy alone. - Missing or inconsistent release metadata fails safe by redeploying the relevant set. - Root build configuration changes retain the complete validation gate. ## Validation - [x] Actionlint and ShellCheck - [x] Biome lint - [x] TypeScript typecheck - [x] Dependency-cruiser architecture check - [x] Knip dead-code check - [x] Production build - [x] Root Trivy lockfile scan - [x] Scoped Knip checks for web, Worker, and sandbox runtime - [x] Historical frontend/backend dependency-routing checks ## Review order 1. `.github/workflows/static-checks.yml` 2. `scripts/deploy-cloudflare.ts` 3. Workspace manifest dependency declarations and README
1 parent e79f54f commit 0b6d34d

30 files changed

Lines changed: 735 additions & 75 deletions

File tree

.github/workflows/static-checks.yml

Lines changed: 412 additions & 40 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -91,18 +91,28 @@ pnpm cloudflare:set-hyperdrive -- \
9191

9292
## Production deployment
9393

94-
The GitHub static-check workflow runs lint, typecheck, and build gates on pull
95-
requests and `main`. Vercel's Git integration deploys `apps/web` from the
96-
repository. Deploy the Cloudflare backend Workers from a reviewed checkout with:
94+
The required `static-checks` workflow classifies each change before allocating
95+
the heavier runners. It runs dependency-aware lint, typecheck, build,
96+
architecture, dead-code, workflow, and lockfile checks only for affected
97+
surfaces and their workspace dependents. Root build configuration changes still
98+
run the complete gate.
99+
100+
Vercel's Git integration deploys `apps/web` from the repository. Its native
101+
monorepo dependency graph skips builds when neither the web app nor one of its
102+
declared workspace dependencies changed. Deploy the Cloudflare backend Workers
103+
from a clean reviewed checkout with:
97104

98105
```bash
99106
pnpm cloudflare:deploy
100107
```
101108

102-
The deploy command refuses a dirty tree, a non-`main` branch, or a checkout that
103-
does not exactly match `origin/main`. It injects that immutable commit SHA into
104-
every Worker and deploys the gateway last, after its agent and webhooks service
105-
dependencies share the same release identity.
109+
The deploy command refuses a dirty tree, reads the release SHA currently bound
110+
to each Worker, and uses the same workspace graph to deploy only affected
111+
Workers. The agent, webhooks, and gateway Workers remain an atomic release set
112+
because gateway readiness requires one shared release identity; the gateway is
113+
deployed last. The independent preview proxy deploys only when its dependency
114+
closure changed. If Cloudflare release metadata is unavailable or inconsistent,
115+
the command safely redeploys the relevant set instead of guessing.
106116

107117
There is no second release orchestrator, compatibility deploy command, or hidden
108118
workspace-reconciliation command. Schema migrations, Worker deployment, and

apps/agent-worker/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
"zod": "catalog:"
3232
},
3333
"devDependencies": {
34+
"@cheatcode/tsconfig": "workspace:*",
3435
"@cloudflare/workers-types": "catalog:",
3536
"typescript": "catalog:",
3637
"wrangler": "catalog:"

apps/gateway-worker/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
"zod": "catalog:"
2626
},
2727
"devDependencies": {
28+
"@cheatcode/tsconfig": "workspace:*",
2829
"@cloudflare/workers-types": "catalog:",
2930
"typescript": "catalog:",
3031
"wrangler": "catalog:"

apps/preview-proxy/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"zod": "catalog:"
2121
},
2222
"devDependencies": {
23+
"@cheatcode/tsconfig": "workspace:*",
2324
"@cloudflare/workers-types": "catalog:",
2425
"typescript": "catalog:",
2526
"wrangler": "catalog:"

apps/web/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
"zustand": "catalog:"
4343
},
4444
"devDependencies": {
45+
"@cheatcode/tsconfig": "workspace:*",
4546
"@tailwindcss/postcss": "catalog:",
4647
"@types/node": "catalog:",
4748
"@types/react": "catalog:",

apps/webhooks-worker/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
"zod": "catalog:"
2727
},
2828
"devDependencies": {
29+
"@cheatcode/tsconfig": "workspace:*",
2930
"@cloudflare/workers-types": "catalog:",
3031
"typescript": "catalog:",
3132
"wrangler": "catalog:"

knip.jsonc

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
{
22
"$schema": "./node_modules/knip/schema.json",
3-
// CLI launched by operational TypeScript through `pnpm exec wrangler`; Knip
4-
// cannot infer child-process binary dependencies from argument arrays.
5-
"ignoreDependencies": ["cloudflare", "wrangler"],
3+
// The shared compiler config is declared for the workspace graph but loaded
4+
// through tsconfig `extends` paths. Cloudflare CLIs are launched by operational
5+
// TypeScript. Knip cannot infer either dependency shape.
6+
"ignoreDependencies": ["@cheatcode/tsconfig", "cloudflare", "wrangler"],
67
"workspaces": {
78
".": {
89
// Skill TypeScript files are executable snapshot entrypoints discovered by
@@ -16,14 +17,16 @@
1617
"entry": ["drizzle.config.ts", "src/schema/drizzle.ts"]
1718
},
1819
"infra/containers/sandbox/browser-driver": {
19-
// Stagehand resolves these peer packages dynamically for its local
20-
// Playwright backend, so no source-level import is visible to Knip.
20+
// The snapshot launches this service from start-browser-driver.sh.
21+
"entry": ["server.js"],
22+
// Stagehand resolves these peer packages dynamically inside the snapshot,
23+
// so a clean root-only CI install exposes no source-level import to Knip.
2124
"ignoreDependencies": ["playwright-core", "zod"]
2225
},
2326
"infra/containers/sandbox/skill-runtime": {
2427
"entry": ["bin/*.mjs"],
2528
// Snapshot launchers resolve these executables by installed binary name;
26-
// Knip cannot infer dependencies or binaries passed to child_process.
29+
// a root-only install cannot expose those child-process edges to Knip.
2730
"ignoreDependencies": ["agent-browser", "tsx"],
2831
"ignoreBinaries": ["agent-browser"]
2932
}

packages/agent-core/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
"zod": "catalog:"
3939
},
4040
"devDependencies": {
41+
"@cheatcode/tsconfig": "workspace:*",
4142
"typescript": "catalog:"
4243
}
4344
}

packages/auth/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
"zod": "catalog:"
2323
},
2424
"devDependencies": {
25+
"@cheatcode/tsconfig": "workspace:*",
2526
"typescript": "catalog:"
2627
}
2728
}

0 commit comments

Comments
 (0)