refactor: restructure repo into apps/services/packages monorepo#1315
refactor: restructure repo into apps/services/packages monorepo#1315jeanduplessis merged 3 commits intomainfrom
Conversation
Code Review SummaryStatus: 5 Issues Found | Recommendation: Address before merge Overview
Fix these issues in Kilo Cloud Issue Details (click to expand)WARNING
Other Observations (not in diff)Issues found in unchanged code that cannot receive inline comments:
Files Reviewed (1 files)
Reviewed by gpt-5.4-20260305 · 239,962 tokens |
93f834f to
b1f9903
Compare
d8ae97a to
d1fc06a
Compare
Add a detailed restructure plan (plans/monorepo-restructure.md) covering the migration from a flat repo layout to a standard pnpm monorepo with apps/, packages/, and services/ directories.
64f4503 to
fbd56ba
Compare
Migrate from a flat layout (root = pnpm workspace root AND Next.js app) to a standard pnpm monorepo: - apps/web: Next.js app with its own package.json (split from root) - apps/storybook: moved from storybook/ - apps/mobile: moved from kilo-app/ - packages/: shared libraries (db, trpc, encryption, worker-utils, etc.) - services/: Cloudflare Workers and other backend services Key changes: - Root package.json slimmed to lean workspace root (kilocode-monorepo) - pnpm-workspace.yaml switched to glob patterns (apps/*, packages/*, etc.) - All GitHub Actions workflows updated for new directory structure - scripts/changed-workspaces.sh and lint-all.sh rewritten for glob-aware workspace discovery via pnpm ls - trpc rollup config updated for new tsgo output paths - Relative imports in services/deploy-infra/builder fixed for new depth - .oxlintrc.json override globs and ignorePatterns updated - Missing direct dependencies added (zod, dotenv, @jest/globals, etc.) - CI changes job given pnpm setup for workspace discovery
fbd56ba to
8ec0258
Compare
| | `cloudflare-deploy-infra/` | `services/deploy-infra/` | | ||
| | `cloudflare-o11y/` | `services/o11y/` | | ||
| | `cloudflare-<name>/` | `services/<name>/` | | ||
| | `kiloclaw/` | `services/kiloclaw/` | |
There was a problem hiding this comment.
WARNING: The generic kiloclaw/ mapping can swallow the nested secret-catalog package
Anything that applies this table as prefix substitutions will map kiloclaw/packages/secret-catalog/... to services/kiloclaw/packages/secret-catalog/... before it ever reaches the more specific row below. Reordering these entries or explicitly saying that the longest matching prefix wins avoids migrating that workspace into the wrong location.
| -e '\.dev-port' \ | ||
| -e '\.env\.local' \ | ||
| -e 'kilo-app/' \ | ||
| -e 'cloud-agent/' \ |
There was a problem hiding this comment.
WARNING: The stale-path scan misses cloud-agent-next/ references
cloud-agent-next/ is one of the renamed top-level directories in the mapping table, but this rg command never searches for it. A migration can therefore leave old cloud-agent-next/... paths behind without tripping the verification step.
Summary
Restructures the repository from a flat layout (where the root is both the pnpm workspace root AND the Next.js app) into a standard pnpm monorepo with
apps/,services/, andpackages/directories.Directory changes:
src/,public/,tests/,dev/→apps/web/storybook/→apps/storybook/kilo-app/→apps/mobile/cloudflare-*workers →services/*(prefix stripped)cloud-agent/,cloud-agent-next/→services/kiloclaw/→services/kiloclaw/kiloclaw/packages/secret-catalog/→packages/kiloclaw-secret-catalog/Root package.json split: The root (
kilocode-monorepo) is now a lean workspace host withhusky,oxlint,oxfmt, andtypescript. All Next.js dependencies live inapps/web(package name:web).pnpm-workspace.yaml: Replaced 30+ explicit entries with glob patterns (
apps/*,services/*,packages/*plus nested workspace overrides).Scripts rewritten:
lint-all.sh,changed-workspaces.sh, andtypecheck-all.shnow resolve workspaces viapnpm ls --jsoninstead of parsingpnpm-workspace.yamlliterally.dev.shwrites.dev-portto the repo root.All 8 CI workflows updated for the new directory structure (path filters, working directories, cache paths, sparse-checkout).
Review fixes included: CI change filter for moved web config files, deploy-production env path for Drizzle migrations, dev/local
findRepoRoot()package name, broken relative imports inservices/deploy-infra/builder, missingzoddependency,.oxlintrc.jsonoverride globs forservices/paths, storybook tsconfig test exclusions and missing deps,.kilocodeignoremigration path correction.Verification
pnpm install— workspace resolution workspnpm --filter web typecheck— passpnpm --filter kilo-app typecheck— passpnpm --filter cloud-agent-next typecheck— passpnpm --filter @kilocode-backend/storybook typecheck— passpnpm --filter @kilocode/db typecheck— passscripts/typecheck-all.sh --changes-only— pass (all 29 workspace packages)scripts/lint-all.sh— pass (0 errors, 4620 files)pnpm format:check— passscripts/changed-workspaces.sh --exclude services/cloud-agent --exclude services/cloud-agent-next --exclude apps/web— correct JSON outputVisual Changes
N/A
Reviewer Notes
apps/webforkilocode-app,kilocode-global-app, andkilocode-gatewayprojects. Update EAS project config if it references oldkilo-app/paths. Check Sentry source map paths.services/gmail-pushhas a targeted override disablingno-unsafe-call/no-unsafe-member-accessbecause oxlint's type resolution forconsolefails under concurrent execution with typecheck. The rules still apply to all other services.plans/monorepo-restructure-summary.mdfile documents the full implementation details for reference.