Skip to content

chore: use TypeScript project references - #1056

Merged
ocavue merged 13 commits into
masterfrom
tsconfig-project-references
Aug 6, 2026
Merged

ocavue merged 13 commits into
masterfrom
tsconfig-project-references

Conversation

@ocavue

@ocavue ocavue commented Aug 6, 2026 •

Copy link
Copy Markdown
Contributor

Replace the hand-rolled tsconfig.base.json with @ocavue/tsconfig bases and TypeScript project references, so pnpm typecheck is a single incremental tsc -b (meowdown's setup).

Summary by CodeRabbit

  • Improvements
    • Improved TypeScript validation across the desktop app, browser extension, and shared packages.
    • Added project references for more reliable cross-package builds and type checking.
    • Strengthened compiler checks to catch unused parameters, unsafe indexed access, and incomplete optional properties.
    • Updated React compilation and browser testing configuration for more consistent development and test behavior.
    • Exposed typed note-search tool schemas for improved integration and type safety.

@coderabbitai

coderabbitai Bot commented Aug 6, 2026 •

Copy link
Copy Markdown

Review Change Stack

Walkthrough

The workspace migrates to shared TypeScript project configurations and direct project-build checks. Desktop React compiler integration now uses explicit React and Rolldown Babel plugins. Core AI tool schemas and return types are explicit. Vitest and module-resolution settings receive small updates.

Changes

Workspace project-check configuration

Layer / File(s) Summary
Shared project-check configuration
tsconfig.json, tsconfig.*, apps/*/tsconfig.json, packages/*/tsconfig.json, package.json, apps/*/package.json, packages/*/package.json, turbo.json
Shared TypeScript presets and project references replace the deleted base configuration. Package type checks use tsc -b, and Turbo no longer defines a typecheck task.

React compiler integration

Layer / File(s) Summary
React compiler integration
apps/desktop/vite.config.ts, apps/desktop/vitest.shared.ts, apps/desktop/package.json
Desktop build and test configurations use @vitejs/plugin-react with @rolldown/plugin-babel and reactCompilerPreset(). The custom compiler helper is removed. Tauri HMR settings are conditionally configured.

Explicit AI tool contracts

Layer / File(s) Summary
Explicit AI tool contracts
packages/core/src/ai/chat/tools.ts
Note input schemas are exported. NoteTools explicitly maps all five tool names to their AI SDK tool types and outputs.

Test and module adjustments

Layer / File(s) Summary
Test and module adjustments
apps/desktop/vitest.browser.config.ts, packages/core/vitest.*.config.ts, apps/extension/wxt.config.ts
Chromium-only clipboard permissions are conditionally added. Vitest slow-test thresholds are removed. The WXT command import uses an explicit .ts extension.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: migrating the repository to TypeScript project references.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch tsconfig-project-references

Comment @coderabbitai help to get the list of available commands.

@ocavue ocavue changed the title chore: adopt @ocavue/tsconfig with project references and tsc -b chore: use TypeScript project references Aug 6, 2026
@ocavue
ocavue force-pushed the tsconfig-project-references branch from 9d8e144 to 9f8110c Compare August 6, 2026 06:27
@ocavue
ocavue marked this pull request as ready for review August 6, 2026 06:32

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (3)
apps/desktop/vitest.shared.ts (1)

6-9: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Document the exported defineDesktopProject contract.

defineDesktopProject is exported and used by apps/desktop/vitest.browser.config.ts, but its plugin and test-configuration behavior is not documented. The parameter object is also defined inline. Add a DesktopProjectOptions interface and document that shared React/Babel plugins are prepended and project.test overrides shared defaults.

As per coding guidelines, exported APIs must be documented and object definitions should prefer interfaces.

Proposed refactor
+interface DesktopProjectOptions {
+  readonly plugins?: ViteUserConfig['plugins']
+  readonly test: NonNullable<ViteUserConfig['test']>
+}
+
+/**
+ * Creates the shared desktop Vitest configuration.
+ * Project plugins are appended after the React Compiler plugins.
+ * Project test options override shared defaults.
+ */
-export function defineDesktopProject(project: {
-  plugins?: ViteUserConfig['plugins']
-  test: NonNullable<ViteUserConfig['test']>
-}): ViteUserConfig {
+export function defineDesktopProject(
+  project: DesktopProjectOptions,
+): ViteUserConfig {
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/desktop/vitest.shared.ts` around lines 6 - 9, Introduce an exported
DesktopProjectOptions interface for the defineDesktopProject parameter,
preserving its plugins and required test configuration types. Add API
documentation for defineDesktopProject describing that shared React/Babel
plugins are prepended and project.test overrides shared defaults, and update the
function signature to use the interface.

Source: Coding guidelines

packages/core/src/ai/chat/tools.ts (2)

269-275: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Use an interface for NoteTools.

NoteTools is a public object-shaped contract. Declare it as export interface NoteTools instead of a type literal.

Proposed change
-export type NoteTools = {
+export interface NoteTools {
   ...
-}
+}

As per coding guidelines, “Prefer interfaces for object definitions; use type aliases for unions, intersections, and mapped types.”

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/core/src/ai/chat/tools.ts` around lines 269 - 275, Change the public
object-shaped NoteTools contract from an exported type alias to an exported
interface, preserving all existing tool properties and their types.

Source: Coding guidelines


91-99: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Document the newly exported schemas.

searchNotesInput, listRecentNotesInput, and listDailyNotesInput are now public APIs, but they have no JSDoc. Add a short comment before each export. Keep .describe() for runtime schema metadata.

Proposed documentation
+/** Validates arguments for the `search_notes` tool. */
 export const searchNotesInput = ...

+/** Validates arguments for the `list_recent_notes` tool. */
 export const listRecentNotesInput = ...

+/** Validates arguments for the `list_daily_notes` tool. */
 export const listDailyNotesInput = ...

As per coding guidelines, “Always document public APIs.”

Also applies to: 102-116, 121-123

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/core/src/ai/chat/tools.ts` around lines 91 - 99, Add concise JSDoc
comments immediately before the exported schemas searchNotesInput,
listRecentNotesInput, and listDailyNotesInput to document their public API
purpose. Keep the existing Zod .describe() metadata unchanged.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/desktop/vite.config.ts`:
- Around line 68-74: Update the Vite server configuration around the
host-conditional options so server.port remains 1420 and the WebSocket settings
are nested under server.ws. Preserve the existing conditional behavior for host,
including protocol, host, and port 1421 values.

---

Nitpick comments:
In `@apps/desktop/vitest.shared.ts`:
- Around line 6-9: Introduce an exported DesktopProjectOptions interface for the
defineDesktopProject parameter, preserving its plugins and required test
configuration types. Add API documentation for defineDesktopProject describing
that shared React/Babel plugins are prepended and project.test overrides shared
defaults, and update the function signature to use the interface.

In `@packages/core/src/ai/chat/tools.ts`:
- Around line 269-275: Change the public object-shaped NoteTools contract from
an exported type alias to an exported interface, preserving all existing tool
properties and their types.
- Around line 91-99: Add concise JSDoc comments immediately before the exported
schemas searchNotesInput, listRecentNotesInput, and listDailyNotesInput to
document their public API purpose. Keep the existing Zod .describe() metadata
unchanged.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 56b35f98-e8e8-4210-b5f9-0ae6261a1be9

📥 Commits

Reviewing files that changed from the base of the PR and between 7c9347c and 9f8110c.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (22)
  • apps/desktop/package.json
  • apps/desktop/react-compiler-plugin.ts
  • apps/desktop/tsconfig.json
  • apps/desktop/vite.config.ts
  • apps/desktop/vitest.browser.config.ts
  • apps/desktop/vitest.shared.ts
  • apps/extension/package.json
  • apps/extension/tsconfig.json
  • apps/extension/wxt.config.ts
  • package.json
  • packages/core/package.json
  • packages/core/src/ai/chat/tools.ts
  • packages/core/tsconfig.json
  • packages/core/vitest.browser.config.ts
  • packages/core/vitest.node.config.ts
  • packages/db/package.json
  • packages/db/tsconfig.json
  • packages/utils/package.json
  • packages/utils/tsconfig.json
  • tsconfig.base.json
  • tsconfig.json
  • turbo.json
💤 Files with no reviewable changes (5)
  • packages/core/vitest.node.config.ts
  • turbo.json
  • apps/desktop/react-compiler-plugin.ts
  • packages/core/vitest.browser.config.ts
  • tsconfig.base.json

Comment on lines +68 to +74
...(host
? {
protocol: 'ws',
host,
port: 1421,
}
: undefined,
: {}),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

config='apps/desktop/vite.config.ts'

rg -n 'server:|ws:|hmr:|protocol:|port: 1420|port: 1421' "$config"

if rg -q -P -U '\?\s*\{\s*\n\s*protocol:' "$config"; then
  echo "WebSocket options are still flattened into server" >&2
  exit 1
fi

rg -q -P -U 'ws:\s*\{\s*\n\s*protocol:' "$config"

Repository: team-reflect/reflect-open

Length of output: 301


🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

printf '%s\n' '--- vite config ---'
cat -n apps/desktop/vite.config.ts

printf '%s\n' '--- package metadata containing Vite/Tauri ---'
rg -n -C 3 '"(vite|`@vitejs/plugin-`|`@tauri-apps/cli`|`@tauri-apps/api`)"' \
  package.json apps/desktop/package.json pnpm-lock.yaml 2>/dev/null || true

printf '%s\n' '--- related host and port references ---'
rg -n -C 3 'TAURI_DEV_HOST|1420|1421|server\.hmr|server\.ws|hmr:|ws:' \
  apps package.json 2>/dev/null || true

printf '%s\n' '--- tracked config files ---'
git ls-files '*vite*' '*tauri*' | head -80

Repository: team-reflect/reflect-open

Length of output: 40099


🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

python3 - <<'PY'
from collections import OrderedDict

base_server = OrderedDict([
    ("port", 1420),
    ("host", False),
])
host = "dev.example.test"

result = OrderedDict(base_server)
if host:
    result.update({
        "protocol": "ws",
        "host": host,
        "port": 1421,
    })

print("flattened server:", dict(result))
print("HTTP server port:", result["port"])
print("top-level protocol:", result.get("protocol"))
print("nested ws:", result.get("ws"))
print("nested hmr:", result.get("hmr"))

nested_ws = OrderedDict(base_server)
if host:
    nested_ws["ws"] = {
        "protocol": "ws",
        "host": host,
        "port": 1421,
    }
print("nested ws server:", dict(nested_ws))
print("nested ws HTTP port:", nested_ws["port"])

nested_hmr = OrderedDict(base_server)
if host:
    nested_hmr["hmr"] = {
        "protocol": "ws",
        "host": host,
        "port": 1421,
    }
print("nested hmr server:", dict(nested_hmr))
print("nested hmr HTTP port:", nested_hmr["port"])
PY

Repository: team-reflect/reflect-open

Length of output: 608


🌐 Web query:

Vite 8.2 server hmr protocol host port server.ws configuration options

💡 Result:

In Vite 8.2, the WebSocket configuration options that were previously located under server.hmr have been migrated to a new server.ws configuration object [1][2][3]. While the previous options under server.hmr (including protocol, host, port, path, clientPort, timeout, and server) remain supported for backward compatibility, they are now deprecated [1][4][3]. You should update your configuration to use the server.ws namespace [1][3]. The available configuration options under server.ws are [3]: - protocol: Sets the WebSocket protocol used for the HMR connection (e.g., 'ws' or 'wss'). - host: Specifies the WebSocket server host. - port: Specifies the WebSocket server port. - clientPort: An advanced option that overrides the port on the client side, allowing the WebSocket to be served on a different port than the one the client code expects [5][3]. - path: Sets the WebSocket path. - timeout: Defines the connection timeout in milliseconds (default: 30000). - server: Allows providing a custom HTTP server for WebSocket connections [5][3]. The server.hmr object still exists but is now primarily used for HMR-specific behavior, such as the overlay option (e.g., server.hmr.overlay: false) [1][3]. If you continue using the deprecated options, they will be automatically synced with server.ws, but you will receive deprecation warnings [1][6][3].

Citations:


Nest the WebSocket options under server.ws.

When TAURI_DEV_HOST is set, the current spread changes the HTTP port from 1420 to 1421 and leaves protocol at an unsupported level. Preserve server.port: 1420 and move these options into server.ws.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/desktop/vite.config.ts` around lines 68 - 74, Update the Vite server
configuration around the host-conditional options so server.port remains 1420
and the WebSocket settings are nested under server.ws. Preserve the existing
conditional behavior for host, including protocol, host, and port 1421 values.

@ocavue
ocavue merged commit dac9d78 into master Aug 6, 2026
14 checks passed
@ocavue
ocavue deleted the tsconfig-project-references branch August 6, 2026 07:32
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.

1 participant