Skip to content

refactor(trpc): migrate declaration emit to tsgo and stop committing dist#1562

Merged
jeanduplessis merged 1 commit intomainfrom
refactor/eradicate-eslint-4-trpc-tsgo
Mar 26, 2026
Merged

refactor(trpc): migrate declaration emit to tsgo and stop committing dist#1562
jeanduplessis merged 1 commit intomainfrom
refactor/eradicate-eslint-4-trpc-tsgo

Conversation

@jeanduplessis
Copy link
Copy Markdown
Contributor

@jeanduplessis jeanduplessis commented Mar 25, 2026

Summary

  • Migrate the @kilocode/trpc declaration emit from tsc to tsgo for faster builds
  • Stop committing the ~16k-line generated dist/index.d.ts to avoid painful rebase conflicts whenever router types change on main; the full packages/trpc/dist/ directory is now gitignored
  • Extract the prepare lifecycle hook into scripts/prepare.sh so trpc types are auto-rebuilt after pnpm install; the script skips both husky and the trpc build in CI since they are unnecessary there
  • Add a trpc build step to the CI lint job so type-aware oxlint rules have the declaration types available
  • Fix pre-existing workspace test failures that were exposed by the packages/trpc changes triggering shared_changed in changed-workspaces.sh

Key changes:

  • packages/trpc/tsconfig.json: added explicit rootDir for tsgo 7.0 compatibility
  • packages/trpc/rollup.config.mjs: updated alias resolver with resolveDts() helper to handle tsgo's directory-style index.d.ts output (vs tsc's flat .d.ts files)
  • scripts/prepare.sh: new file with set -euo pipefail for robust error handling, CI skip via $CI env var
  • .github/workflows/ci.yml: added pnpm --filter @kilocode/trpc run build step before lint
  • scripts/changed-workspaces.sh: skip workspaces that have a test script but no actual test files
  • cloudflare-o11y/test/index.spec.ts: added created_at: expect.any(Number) to pipeline assertions
  • cloudflare-ai-attribution/jest.config.mjs: added missing jest config with ts-jest transform

Verification

  • pnpm install — prepare hook runs successfully, trpc types rebuilt
  • pnpm typecheck — passes (tsgo --noEmit)
  • pre-push hook (lint + typecheck) — passes
  • pnpm --filter cloudflare-o11y test — 61 tests pass
  • pnpm --filter cloudflare-ai-attribution test — 22 tests pass
  • Verified changed-workspaces.sh no longer includes cloudflare-images-mcp or cloudflare-db-proxy (no test files)

Visual Changes

N/A

Reviewer Notes

  • The resolveDts() helper in rollup.config.mjs is needed because tsgo preserves path aliases differently from tsc — it may emit foo/index.d.ts instead of foo.d.ts. The helper tries both forms.
  • The ${CI:-} syntax in prepare.sh is required because set -u treats unset variables as errors; $CI is unset in local dev environments.
  • The 4 workspace test failures were pre-existing on main but hidden because the workspace-tests CI matrix was always empty on main pushes (no changed workspaces). This branch triggered shared_changed=true (via packages/trpc/**), which runs all workspaces with a test script.

Comment thread packages/trpc/dist/index.d.ts Outdated
Comment thread packages/trpc/dist/index.d.ts Outdated
Comment thread packages/trpc/dist/index.d.ts Outdated
@kilo-code-bot
Copy link
Copy Markdown
Contributor

kilo-code-bot Bot commented Mar 25, 2026

Code Review Summary

Status: 2 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 2
SUGGESTION 0

Fix these issues in Kilo Cloud

Issue Details (click to expand)

WARNING

File Line Issue
scripts/changed-workspaces.sh 56 `find ...
Other Observations (not in diff)

Issues found in unchanged code that cannot receive inline comments:

File Line Issue
kiloclaw/src/routes/controller.ts 163 Transient Hyperdrive/Postgres failures skip the daily PostHog event instead of falling back to userId as the existing distinctId default
Files Reviewed (3 files)
  • cloudflare-ai-attribution/jest.config.mjs
  • cloudflare-o11y/test/index.spec.ts
  • scripts/changed-workspaces.sh - 1 issue

Reviewed by gpt-5.4-20260305 · 583,370 tokens

@jeanduplessis jeanduplessis force-pushed the refactor/eradicate-eslint-4-trpc-tsgo branch from c1a9e78 to 0a0b131 Compare March 25, 2026 21:33
@jeanduplessis jeanduplessis force-pushed the refactor/eradicate-eslint-3-email branch from 7a13ba8 to 2c3cd6d Compare March 25, 2026 21:33
@jeanduplessis jeanduplessis force-pushed the refactor/eradicate-eslint-4-trpc-tsgo branch from 0a0b131 to b33a798 Compare March 25, 2026 21:41
Comment thread packages/trpc/dist/index.d.ts Outdated
Base automatically changed from refactor/eradicate-eslint-3-email to main March 26, 2026 00:09
@jeanduplessis jeanduplessis enabled auto-merge March 26, 2026 00:09
@jeanduplessis jeanduplessis disabled auto-merge March 26, 2026 00:11
@jeanduplessis jeanduplessis enabled auto-merge March 26, 2026 00:11
auto-merge was automatically disabled March 26, 2026 00:11

Pull request was closed

@jeanduplessis jeanduplessis reopened this Mar 26, 2026
@jeanduplessis jeanduplessis enabled auto-merge March 26, 2026 00:12
auto-merge was automatically disabled March 26, 2026 00:18

Pull request was closed

@jeanduplessis jeanduplessis reopened this Mar 26, 2026
@jeanduplessis jeanduplessis reopened this Mar 26, 2026
@jeanduplessis jeanduplessis force-pushed the refactor/eradicate-eslint-4-trpc-tsgo branch from 81f59e8 to 32d0499 Compare March 26, 2026 07:59
@jeanduplessis jeanduplessis changed the title perf(trpc): migrate declaration emit from tsc to tsgo (4 of 4) refactor(trpc): migrate declaration emit to tsgo and stop committing dist Mar 26, 2026
@jeanduplessis jeanduplessis force-pushed the refactor/eradicate-eslint-4-trpc-tsgo branch from 32d0499 to 2360311 Compare March 26, 2026 08:03
…dist

- Replace tsc with tsgo for the @kilocode/trpc build step for faster
  declaration emit
- Add rootDir to tsconfig.json for tsgo 7.0 compatibility
- Update rollup alias resolver with resolveDts() helper to handle
  tsgo's directory-style index.d.ts output
- Stop committing the 16k-line generated dist/index.d.ts to avoid
  rebase conflicts; gitignore the full packages/trpc/dist/ directory
- Extract the prepare lifecycle hook into scripts/prepare.sh with
  set -euo pipefail; auto-rebuild trpc after pnpm install; skip in CI
- Add trpc build step to CI lint job for type-aware oxlint rules
- Fix pre-existing workspace test failures exposed by shared_changed:
  skip workspaces with no test files in changed-workspaces.sh,
  add created_at to cloudflare-o11y pipeline assertions,
  add jest.config.mjs for cloudflare-ai-attribution ts-jest transform
@jeanduplessis jeanduplessis force-pushed the refactor/eradicate-eslint-4-trpc-tsgo branch from 2360311 to 8a62d0a Compare March 26, 2026 08:20
@jeanduplessis jeanduplessis merged commit d452163 into main Mar 26, 2026
26 checks passed
@jeanduplessis jeanduplessis deleted the refactor/eradicate-eslint-4-trpc-tsgo branch March 26, 2026 08:25
[ -n "$has_test" ] || continue

# Skip workspaces whose test script exists but has no test files
test_file_count=$(find "$dir" -type f \( -name '*.test.ts' -o -name '*.test.tsx' -o -name '*.test.js' -o -name '*.test.jsx' -o -name '*.spec.ts' -o -name '*.spec.tsx' -o -name '*.spec.js' -o -name '*.spec.jsx' \) -not -path '*/node_modules/*' 2>/dev/null | head -1)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WARNING: This pipeline can terminate the script as soon as a workspace has multiple tests

Because the script runs under set -euo pipefail, find ... | head -1 returns a non-zero status when head closes the pipe after the first match. Packages like cloud-agent and kiloclaw already have multiple matching test files, so the matrix generation can exit here instead of returning JSON. Use find ... -print -quit (or add || true) to probe for one match without tripping pipefail.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants