Skip to content

fix: resolve TypeScript build errors in agents monorepo#63

Open
brawlaphant wants to merge 2 commits intoregen-network:mainfrom
brawlaphant:pr/fix-agents-typescript-build
Open

fix: resolve TypeScript build errors in agents monorepo#63
brawlaphant wants to merge 2 commits intoregen-network:mainfrom
brawlaphant:pr/fix-agents-typescript-build

Conversation

@brawlaphant
Copy link
Copy Markdown
Contributor

Summary

  • Set up proper TypeScript project references with per-package tsconfig.json files extending a shared tsconfig.base.json, enabling tsc --build to compile the monorepo cleanly
  • Add npm workspaces to the root package.json so @regen/* packages resolve through node_modules/ symlinks, replacing the pnpm-only workspace:* protocol
  • Fix a TS2352 type cast error in ooda-executor.ts by casting through unknown

Test plan

  • npm run build (tsc --build) passes with zero errors
  • npm run lint (tsc --build --noEmit) passes clean
  • npm test (vitest run) — all 27 tests pass
  • Verify npm install && npm run build works from a clean checkout

🤖 Generated with Claude Code

Set up proper TypeScript project references and npm workspaces so that
`tsc --build` compiles cleanly. Changes:

- Add `tsconfig.base.json` with shared compiler options and `composite: true`
- Add per-package `tsconfig.json` files extending the base, with project
  references matching the dependency graph
- Convert root `tsconfig.json` to solution-style (references only)
- Add npm workspaces to root `package.json` so Node module resolution
  finds `@regen/*` packages via symlinks in `node_modules/`
- Replace pnpm `workspace:*` protocol with npm-compatible `*` specifier
- Fix type cast in `ooda-executor.ts` (TS2352: cast through `unknown`)
- Update `lint` script to use `tsc --build --noEmit`

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the monorepo's build system by standardizing TypeScript configurations and integrating npm workspaces. These changes streamline the development process, improve type safety, and ensure consistent package resolution across all internal modules, leading to a more robust and maintainable codebase.

Highlights

  • TypeScript Configuration: Implemented proper TypeScript project references across the monorepo using per-package tsconfig.json files that extend a new tsconfig.base.json. This enables clean compilation with tsc --build.
  • npm Workspaces Integration: Introduced npm workspaces to the root package.json to ensure @regen/* packages resolve correctly via node_modules/ symlinks, replacing the pnpm-specific workspace:* protocol.
  • Type Safety Fix: Resolved a TS2352 type cast error in ooda-executor.ts by explicitly casting through unknown to satisfy TypeScript's stricter type checking.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the project into an npm monorepo structure, introducing workspaces in package.json and package-lock.json, along with new tsconfig.json files for each package and a base configuration. It also updates numerous dependencies to their latest versions. The review comments suggest improving consistency by using the workspace: protocol for internal package dependencies instead of * in package.json files.

Comment on lines +8 to +10
"@regen/core": "*",
"@regen/plugin-ledger-mcp": "*",
"@regen/plugin-koi-mcp": "*"
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.

medium

While using * for workspace dependencies works with npm workspaces, it's less explicit than using the workspace: protocol, which is supported by modern npm versions (v7+). The workspace: protocol ensures that the dependency is resolved from within the monorepo, which is safer and clearer.

Since you're moving to npm workspaces, I'd recommend using the workspace: protocol. For example:

"dependencies": {
  "@regen/core": "workspace:^",
  "@regen/plugin-ledger-mcp": "workspace:^",
  "@regen/plugin-koi-mcp": "workspace:^"
}

This will use the versions defined in the respective package.json files within the workspace.

Suggested change
"@regen/core": "*",
"@regen/plugin-ledger-mcp": "*",
"@regen/plugin-koi-mcp": "*"
"@regen/core": "workspace:^",
"@regen/plugin-ledger-mcp": "workspace:^",
"@regen/plugin-koi-mcp": "workspace:^"

"types": "./src/index.ts",
"dependencies": {
"@regen/core": "workspace:*"
"@regen/core": "*"
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.

medium

For consistency and to better enforce monorepo dependency resolution, it's recommended to use the workspace: protocol for internal packages.

Suggested change
"@regen/core": "*"
"@regen/core": "workspace:^"

"types": "./src/index.ts",
"dependencies": {
"@regen/core": "workspace:*"
"@regen/core": "*"
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.

medium

For consistency and to better enforce monorepo dependency resolution, it's recommended to use the workspace: protocol for internal packages.

Suggested change
"@regen/core": "*"
"@regen/core": "workspace:^"

Address gemini-code-assist review feedback — replace bare "*" with
"workspace:*" for @regen/* internal dependencies so the workspace
protocol explicitly enforces monorepo resolution.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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