Skip to content

Conversation

@k0d13
Copy link
Owner

@k0d13 k0d13 commented Jul 19, 2025

Summary by CodeRabbit

New Features

  • Introduced a modular code execution system with refined runtime metadata and execution result schemas.
  • Enhanced playground URL generation using compressed state and environment-based URLs.
  • Added improved runtime fetching, searching, and selection utilities with fuzzy search and caching.

Bug Fixes

  • Prevented unintended closure of mobile playground sheets by refining event propagation handling.
  • Improved runtime search and selection consistency across user interfaces.

Refactor

  • Migrated from legacy runtime and execution modules to new modular packages with updated type schemas.
  • Streamlined file handling, form data preparation, and code execution logic in editor and extension components.
  • Updated imports and types to use stricter runtime definitions and new execution APIs.
  • Removed change tracking and unload prevention logic in explorer component.

Style

  • Unified and updated stylesheets and CSS import paths across applications, removing deprecated style imports.

Chores

  • Replaced deprecated internal dependencies with new workspace packages (@evaluate/execute, @evaluate/logger, @evaluate/runtimes, @evaluate/style).
  • Added new packages for execution, runtimes, fetch, and logger; removed legacy packages and related documentation.
  • Updated package manifests, workspace configurations, and GitHub label definitions for improved maintainability.

@vercel
Copy link

vercel bot commented Jul 19, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
evaluate ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 19, 2025 6:01pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 19, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

This update migrates all apps and packages from the legacy engine, helpers, and shapes modules to a new modular architecture using @evaluate/execute, @evaluate/logger, @evaluate/runtimes, and @evaluate/style. It refactors types, runtime fetching, code execution, and URL helpers, and removes deprecated files and dependencies.

Changes

Files/Paths Change Summary
apps/browser-extension/*, apps/discord-bot/*, apps/website/* Migrated imports and logic from @evaluate/engine, @evaluate/helpers, @evaluate/shapes, and @evaluate/styles to new packages: @evaluate/execute, @evaluate/logger, @evaluate/runtimes, and @evaluate/style. Updated types from PartialRuntime to Runtime, and execution logic to new API. Adjusted runtime fetching, searching, and result handling accordingly.
apps/browser-extension/src/helpers/make-url.ts, apps/discord-bot/src/utilities/make-url.ts Deleted legacy URL helper modules; replaced with new URL helpers from @evaluate/execute.
apps/browser-extension/src/styles.css, apps/website/src/styles.css Removed old style import files; replaced with new style.css referencing @evaluate/style.
apps/browser-extension/src/style.css, apps/website/src/style.css Added new style entrypoints importing @evaluate/style and related CSS.
packages/engine/*, packages/helpers/*, packages/shapes/* Deleted deprecated packages and all related source, type, and documentation files. Removed all exports, schemas, and helper utilities related to execution, runtimes, and logging.
packages/execute/*, packages/fetch/*, packages/logger/*, packages/runtimes/*, packages/style/* Introduced new modular packages:
  • @evaluate/execute: Handles code execution, schemas, compression, and URL helpers.
  • @evaluate/fetch: Provides enhanced fetch with retry logic.
  • @evaluate/logger: Exports a default logger utility.
  • @evaluate/runtimes: Fetches, searches, and provides metadata for runtimes.
  • @evaluate/style: Renamed from @evaluate/styles for style imports.
    Updated package manifests, exports, and types accordingly. |
    | biome.json, pnpm-workspace.yaml | Updated linter config to disable noStaticElementInteractions; allowed unused patches in workspace config. |

Sequence Diagram(s)

sequenceDiagram
    participant UI as App UI (Browser/Discord/Web)
    participant Runtimes as @evaluate/runtimes
    participant Execute as @evaluate/execute
    participant Logger as @evaluate/logger
    participant Fetch as @evaluate/fetch
    participant API as Remote Execution API

    UI->>Runtimes: fetchAllRuntimes() / searchForRuntimes()
    Runtimes->>Fetch: fetch(Piston API)
    Fetch-->>Runtimes: runtimes[]
    Runtimes-->>UI: runtimes[]

    UI->>Execute: executeCode(runtime, options)
    Execute->>Fetch: fetch(API endpoint, payload)
    Fetch-->>Execute: execution result
    Execute-->>UI: [result, options]

    UI->>Logger: createLogger().log(event)
Loading

Suggested labels

packages:hooks

Poem

🐇
A hop and a skip, the codebase renews,
Old engines and helpers bid fond adieus.
Modular bunnies bring runtimes and flair,
With style and with logger, they're light as the air.
Now code executes with a whisk of delight—
The garden is tidy, the future is bright!
🌱✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ecb474c and 431c088.

📒 Files selected for processing (1)
  • packages/execute/src/shapes.ts (1 hunks)
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 9

♻️ Duplicate comments (1)
apps/discord-bot/src/events/application-authorised.ts (1)

6-6: Same alias assurance for ~/helpers/session-context

As above, make sure the path alias is present; otherwise builds will fail only in this file.

🧹 Nitpick comments (8)
biome.json (1)

25-26: Disabling two a11y rules weakens baseline accessibility

Turning off useSemanticElements and noStaticElementInteractions removes safeguards that normally catch keyboard-navigation and semantics regressions.
If the rules are too noisy, consider narrowing their scope with overrides or allow lists rather than a blanket disable.

packages/fetch/package.json (1)

1-14: Provide an explicit main/module target or rely solely on `"exports"?

Node ≤16 and some tooling still fall back to "main" when "exports" is present but empty for require calls. If CJS support is intentionally dropped, note this in the README; otherwise add:

   "exports": {
     ".": {
       "import": "./dist/index.js",
       "types": "./dist/index.d.ts"
+      ,"require": "./dist/index.cjs"
     }
   },
+  "main": "./dist/index.cjs",

Also remember to add any runtime deps (cross-fetch, etc.) once implementation lands.

apps/website/src/style.css (1)

1-1: Confirm style package export name

@evaluate/style replaces @evaluate/styles; ensure the new package actually re-exports a root CSS entry (some bundlers require an explicit "style" export in the package’s package.json).

apps/browser-extension/src/content-script/execution/result.tsx (1)

49-79: Simplify conditional rendering logic.

The options.code check is redundant - you can wrap both buttons in a single conditional block since they both require options.code.

 <div className="flex justify-end gap-2">
-  {options.code && (
+  {options.code && (
+    <>
     <Button variant="secondary" asChild>
       <a
         target="_blank"
         rel="noreferrer noopener"
         href={new URL(
           makePickRuntimePathname(options),
           env.VITE_PUBLIC_WEBSITE_URL,
         ).toString()}
       >
         <span>Change Runtime</span>
         <ExternalLinkIcon size={16} className="ml-1" />
       </a>
     </Button>
-  )}
-
-  {options.code && runtime && (
+    {runtime && (
     <Button variant="secondary" asChild>
       <a
         target="_blank"
         rel="noreferrer noopener"
         href={new URL(
           makeEditCodePathname(runtime, options),
           env.VITE_PUBLIC_WEBSITE_URL,
         ).toString()}
       >
         <span>Edit Code</span>
         <ExternalLinkIcon size={16} className="ml-1" />
       </a>
     </Button>
+    )}
+    </>
   )}
 </div>
packages/runtimes/src/getters.ts (2)

79-85: Consider making the icon base URL configurable.

The icon URL is hardcoded to a specific commit. While this ensures stability, it might be better to make this configurable or use a stable branch reference.

+const ICON_BASE_URL = process.env.ICON_BASE_URL || 'https://raw.githubusercontent.com/PKief/vscode-material-icon-theme/940f2ea7a6fcdc0221ab9a8fc9454cc585de11f0/icons';
+
 export function getRuntimeIconUrl(id: string) {
   if (!isRuntimeId(id)) return null;
   const slug = RuntimeIcons[id];
   if (!slug) return null;
-  return `https://raw.githubusercontent.com/PKief/vscode-material-icon-theme/940f2ea7a6fcdc0221ab9a8fc9454cc585de11f0/icons/${slug}.svg`;
+  return `${ICON_BASE_URL}/${slug}.svg`;
 }

88-92: Fix typo in function name.

The function name should follow camelCase convention with 'Id' capitalised.

-export function getRuntimeidFromExtension(extension: string) {
+export function getRuntimeIdFromExtension(extension: string) {
packages/execute/src/shapes.ts (2)

42-44: Consider improving the error message for clarity.

The current error message could be more descriptive.

   .refine((o) => o.entry in o.files, {
-    error: 'Entry file does not exist',
+    message: 'Entry file must exist in the files map',
   });

113-113: Consider clarifying the output selection logic.

The condition (r.compile?.code || 0) > 0 might be unclear. Consider making it more explicit.

-    output: (r.compile?.code || 0) > 0 ? r.compile?.output : r.run?.output,
+    output: r.compile && r.compile.code !== 0 ? r.compile.output : r.run.output,

This makes it clearer that we're checking for a non-zero compile exit code (indicating compilation failure).

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 43bc693 and f3aec7b.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (73)
  • apps/browser-extension/package.json (1 hunks)
  • apps/browser-extension/src/background/index.ts (4 hunks)
  • apps/browser-extension/src/content-script/execution/dialog.tsx (3 hunks)
  • apps/browser-extension/src/content-script/execution/index.tsx (2 hunks)
  • apps/browser-extension/src/content-script/execution/result.tsx (2 hunks)
  • apps/browser-extension/src/content-script/index.tsx (2 hunks)
  • apps/browser-extension/src/helpers/make-url.ts (0 hunks)
  • apps/browser-extension/src/services/posthog.ts (1 hunks)
  • apps/browser-extension/src/style.css (1 hunks)
  • apps/browser-extension/src/styles.css (0 hunks)
  • apps/discord-bot/package.json (1 hunks)
  • apps/discord-bot/src/commands/evaluate.ts (3 hunks)
  • apps/discord-bot/src/components/edit-evaluation-button.ts (1 hunks)
  • apps/discord-bot/src/components/evaluate-modal.ts (2 hunks)
  • apps/discord-bot/src/components/open-evaluation-button.ts (1 hunks)
  • apps/discord-bot/src/env.ts (1 hunks)
  • apps/discord-bot/src/events/application-authorised.ts (1 hunks)
  • apps/discord-bot/src/handlers/evaluate.ts (5 hunks)
  • apps/discord-bot/src/services/posthog.ts (1 hunks)
  • apps/discord-bot/src/utilities/make-url.ts (0 hunks)
  • apps/website/next.config.js (2 hunks)
  • apps/website/package.json (1 hunks)
  • apps/website/src/app/(editor)/playgrounds/[playground]/page.tsx (3 hunks)
  • apps/website/src/app/(editor)/playgrounds/[playground]/wrapper/mobile.tsx (2 hunks)
  • apps/website/src/app/(playgrounds)/playgrounds/page.tsx (2 hunks)
  • apps/website/src/app/(playgrounds)/playgrounds/playground-card-list.tsx (2 hunks)
  • apps/website/src/app/(playgrounds)/playgrounds/playground-card.tsx (4 hunks)
  • apps/website/src/app/layout.tsx (1 hunks)
  • apps/website/src/app/sitemap.ts (2 hunks)
  • apps/website/src/components/editor/execute-bar/index.tsx (6 hunks)
  • apps/website/src/components/editor/index.tsx (1 hunks)
  • apps/website/src/components/explorer/use.tsx (4 hunks)
  • apps/website/src/components/terminal/index.tsx (2 hunks)
  • apps/website/src/components/terminal/use.tsx (1 hunks)
  • apps/website/src/services/posthog.ts (1 hunks)
  • apps/website/src/style.css (1 hunks)
  • biome.json (1 hunks)
  • packages/components/package.json (1 hunks)
  • packages/engine/package.json (0 hunks)
  • packages/engine/readme.md (0 hunks)
  • packages/engine/src/execute/fetch.ts (0 hunks)
  • packages/engine/src/execute/index.ts (0 hunks)
  • packages/engine/src/runtimes/data/extensions.json (0 hunks)
  • packages/engine/src/runtimes/fetch.ts (0 hunks)
  • packages/engine/src/runtimes/getters.ts (0 hunks)
  • packages/engine/src/runtimes/identifier.ts (0 hunks)
  • packages/execute/package.json (1 hunks)
  • packages/execute/src/arguments.ts (1 hunks)
  • packages/execute/src/fetch.ts (1 hunks)
  • packages/execute/src/index.ts (1 hunks)
  • packages/execute/src/shapes.ts (1 hunks)
  • packages/execute/src/url.ts (1 hunks)
  • packages/fetch/package.json (1 hunks)
  • packages/fetch/src/index.ts (2 hunks)
  • packages/helpers/package.json (0 hunks)
  • packages/helpers/readme.md (0 hunks)
  • packages/helpers/src/better-fetch/index.ts (0 hunks)
  • packages/helpers/src/create-logger/index.ts (0 hunks)
  • packages/logger/package.json (1 hunks)
  • packages/logger/src/index.ts (1 hunks)
  • packages/runtimes/package.json (2 hunks)
  • packages/runtimes/src/data/extensions.json (1 hunks)
  • packages/runtimes/src/fetch.ts (1 hunks)
  • packages/runtimes/src/getters.ts (1 hunks)
  • packages/runtimes/src/index.ts (1 hunks)
  • packages/runtimes/src/shapes.ts (1 hunks)
  • packages/runtimes/tsconfig.json (1 hunks)
  • packages/shapes/readme.md (0 hunks)
  • packages/shapes/src/execute.ts (0 hunks)
  • packages/shapes/src/index.ts (0 hunks)
  • packages/shapes/src/runtime.ts (0 hunks)
  • packages/style/package.json (1 hunks)
  • pnpm-workspace.yaml (1 hunks)
💤 Files with no reviewable changes (19)
  • packages/helpers/readme.md
  • packages/shapes/readme.md
  • apps/browser-extension/src/styles.css
  • packages/helpers/src/create-logger/index.ts
  • packages/engine/src/execute/index.ts
  • packages/engine/readme.md
  • packages/helpers/src/better-fetch/index.ts
  • packages/shapes/src/index.ts
  • packages/helpers/package.json
  • packages/engine/package.json
  • packages/engine/src/runtimes/data/extensions.json
  • apps/browser-extension/src/helpers/make-url.ts
  • packages/engine/src/execute/fetch.ts
  • packages/engine/src/runtimes/identifier.ts
  • packages/engine/src/runtimes/fetch.ts
  • apps/discord-bot/src/utilities/make-url.ts
  • packages/shapes/src/runtime.ts
  • packages/shapes/src/execute.ts
  • packages/engine/src/runtimes/getters.ts
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: apteryxxyz
PR: apteryxxyz/Evaluate#95
File: apps/browser-extension/vite-plugins.ts:50-86
Timestamp: 2025-07-16T23:10:36.498Z
Learning: User apteryxxyz prefers if statements without braces when there's a single statement, formatting them as:
if (condition)
  statement;
instead of using curly braces around the statement.
packages/execute/package.json (1)
Learnt from: apteryxxyz
PR: apteryxxyz/Evaluate#95
File: apps/browser-extension/vite-plugins.ts:69-69
Timestamp: 2025-07-16T23:10:33.941Z
Learning: In the Evaluate codebase, apteryxxyz prefers to let errors throw naturally in internal Vite plugins rather than adding explicit error handling, as it's acceptable for development tooling to fail fast and surface errors clearly.
🧬 Code Graph Analysis (13)
apps/website/src/app/sitemap.ts (1)
packages/runtimes/src/fetch.ts (1)
  • fetchAllRuntimes (14-39)
apps/website/src/app/(playgrounds)/playgrounds/page.tsx (1)
packages/runtimes/src/fetch.ts (1)
  • fetchAllRuntimes (14-39)
apps/website/src/app/(playgrounds)/playgrounds/playground-card-list.tsx (1)
packages/runtimes/src/shapes.ts (2)
  • Runtime (3-10)
  • Runtime (11-11)
apps/website/src/components/terminal/index.tsx (1)
packages/runtimes/src/shapes.ts (2)
  • Runtime (3-10)
  • Runtime (11-11)
apps/browser-extension/src/content-script/execution/index.tsx (2)
packages/runtimes/src/shapes.ts (2)
  • Runtime (3-10)
  • Runtime (11-11)
packages/execute/src/url.ts (1)
  • makePickRuntimePathname (9-12)
apps/website/next.config.js (1)
packages/runtimes/src/fetch.ts (1)
  • fetchAllRuntimes (14-39)
packages/fetch/src/index.ts (1)
packages/fetch/src/http-error.ts (1)
  • HttpError (4-16)
apps/browser-extension/src/content-script/execution/dialog.tsx (1)
packages/runtimes/src/shapes.ts (2)
  • Runtime (3-10)
  • Runtime (11-11)
apps/website/src/app/(editor)/playgrounds/[playground]/page.tsx (1)
packages/runtimes/src/fetch.ts (2)
  • fetchAllRuntimes (14-39)
  • fetchRuntimeById (60-63)
apps/website/src/components/editor/index.tsx (1)
packages/runtimes/src/shapes.ts (2)
  • Runtime (3-10)
  • Runtime (11-11)
apps/website/src/app/(playgrounds)/playgrounds/playground-card.tsx (3)
packages/runtimes/src/shapes.ts (2)
  • Runtime (3-10)
  • Runtime (11-11)
packages/runtimes/src/getters.ts (1)
  • getRuntimeIconUrl (80-85)
packages/components/src/card.tsx (1)
  • CardDescription (76-76)
packages/execute/src/url.ts (3)
packages/execute/src/shapes.ts (6)
  • CodeOptions (6-27)
  • CodeOptions (29-29)
  • FilesOptions (31-44)
  • FilesOptions (46-46)
  • ExecuteOptions (48-86)
  • ExecuteOptions (88-88)
packages/execute/src/compress.ts (1)
  • compress (11-15)
packages/runtimes/src/shapes.ts (2)
  • Runtime (3-10)
  • Runtime (11-11)
apps/website/src/components/explorer/use.tsx (5)
packages/runtimes/src/shapes.ts (2)
  • Runtime (3-10)
  • Runtime (11-11)
apps/website/src/hooks/hash-fragment.ts (1)
  • useHashFragment (19-37)
packages/runtimes/src/getters.ts (1)
  • getRuntimeExamples (74-77)
packages/execute/src/compress.ts (2)
  • compress (11-15)
  • decompress (22-25)
packages/execute/src/shapes.ts (4)
  • ExecuteOptions (48-86)
  • ExecuteOptions (88-88)
  • FilesOptions (31-44)
  • FilesOptions (46-46)
🔇 Additional comments (85)
pnpm-workspace.yaml (1)

7-8: allowUnusedPatches might not be a recognised pnpm-workspace.yaml field – please verify

pnpm-workspace.yaml officially supports just a handful of top-level keys (packages, dependenciesMeta, neverBuiltDependencies, etc.). I’m not finding any documentation that allowUnusedPatches is parsed from this file. If the intent is to suppress errors about stale patch files, the supported mechanism (as of pnpm 8/9) is an .npmrc entry:

allow-unused-patches = true

or using the CLI flag --allow-unused-patches.

Placing it here may be silently ignored, leaving the problem unresolved. Could you double-check with the current pnpm docs or run pnpm config get allow-unused-patches to confirm?

apps/website/src/services/posthog.ts (1)

1-1: Confirm @evaluate/logger exposes a default export

The previous helper exposed createLogger as a named export. Please double-check that the new @evaluate/logger package ships a default export or update the import to import { createLogger } from … to avoid a runtime undefined is not a function error in browsers that don’t fail fast at build-time.

packages/style/package.json (1)

2-8: Package rename: publish & migration checklist

Renaming to @evaluate/style and moving the CSS entry point means:

  1. Consumers must update their package.json and any import '@evaluate/styles/... statements; ensure every downstream package was migrated (CI search recommended).
  2. If the old name was already published, publish a stub package that re-exports the new one to prevent breaking external users.

No action needed if the lib is private.

packages/components/package.json (1)

7-8: Path now points to style.css – verify the file actually exists

"./src/style.css" must be generated or copied to the package root during npm publish; otherwise downstream bundlers will error at resolve time.
CI can catch this with a simple npm pack && tar -tf check.

apps/website/src/app/layout.tsx (1)

9-9: No residual styles.css imports found

A repo-wide rg --context 1 "styles\.css" only returned external references to sonner/dist/styles.css (in your CSS and a commented TSX import), so there are no leftover imports of the old local styles.css.

apps/discord-bot/src/components/open-evaluation-button.ts (1)

3-3: Alias mapping for “~/helpers/resolve-emoji” confirmed

• tsconfig.base.json defines
"paths": { "~/*": ["src/*"] }
so ~/helpers/resolve-emoji resolves to src/helpers/resolve-emoji.
• The TypeScript transform plugin (typescript-transform-paths) is enabled in tsconfig, ensuring imports are rewritten at compile time.
• No Vite configuration exists in apps/discord-bot (this is a Node/TS-built package), so bundler-level aliases aren’t required.

apps/discord-bot/src/env.ts (1)

2-2: Confirm default export in zod/v4
I wasn’t able to locate a local node_modules/zod install to verify, so please ensure your dependencies are installed and then double-check that the module or main entry in node_modules/zod/package.json actually points to a build that uses

export default 

or

module.exports = 

If it doesn’t, import z from 'zod/v4' will fail at compile‐time (TS1192) and at runtime.
• Verify the module and main fields in node_modules/zod/package.json
• Inspect the target files for a default export or CommonJS export
• Otherwise switch to the named import:

import { z } from 'zod';
apps/discord-bot/src/services/posthog.ts (1)

1-1: Import update LGTM

Switching to @evaluate/logger keeps the file in sync with the new package split. Assuming @evaluate/logger’s default export really is createLogger, nothing else to flag.

apps/browser-extension/src/services/posthog.ts (1)

1-1: Consistent logger import – looks good

Mirrors the Discord-bot change. No further action required.

apps/discord-bot/src/components/edit-evaluation-button.ts (1)

2-4: Verify new helper paths

Just sanity-check that the moved helpers (~/helpers/...) are re-exported with the exact same names; otherwise the class will fail at runtime.

apps/website/src/components/terminal/use.tsx (1)

3-3: Type import updated correctly

Importing ExecuteResult from @evaluate/execute aligns with the package split. No issues spotted.

packages/runtimes/tsconfig.json (1)

1-1: LGTM! Clean and appropriate TypeScript configuration.

The minimal configuration extending from the base tsconfig is perfect for a new package.

apps/website/src/app/sitemap.ts (2)

3-3: Correct migration to the new runtimes package.

The import change from @evaluate/engine/runtimes to @evaluate/runtimes aligns with the package restructuring.


27-27: Function name change improves clarity.

The change from fetchRuntimes() to fetchAllRuntimes() is more descriptive and clearly indicates that all available runtimes are being fetched.

apps/website/src/app/(playgrounds)/playgrounds/page.tsx (2)

1-1: Consistent migration to the new runtimes package.

The import change follows the same pattern as other migrated files, correctly updating from @evaluate/engine/runtimes to @evaluate/runtimes.


10-10: Function call correctly updated.

The change from fetchRuntimes() to fetchAllRuntimes() maintains the same functionality while using the new API.

apps/browser-extension/src/style.css (1)

1-4: Well-structured style imports for the browser extension.

The imports correctly aggregate styles from the updated style package, component library, and external dependencies. The @source directive appropriately sets the source directory.

packages/runtimes/src/index.ts (1)

3-3: Completes the public API for the runtimes package.

Adding the export for shapes functionality correctly consolidates all runtime-related exports in one place, supporting the migration from the deprecated @evaluate/shapes package.

packages/execute/src/index.ts (1)

1-4: Clean and well-structured entry point.

The re-export pattern is appropriate for a package entry point, and the use of .js extensions aligns with ES module standards. The modular structure with separate concerns (compress, fetch, shapes, url) promotes maintainability.

apps/browser-extension/package.json (1)

17-20: Dependency migration looks good.

The updated package names provide clearer separation of concerns and align with the modular architecture refactoring described in the PR objectives.

apps/website/package.json (1)

16-20: Consistent dependency migration across apps.

The dependency updates match the browser extension changes, maintaining consistency across the monorepo during the modular architecture migration.

apps/browser-extension/src/content-script/index.tsx (3)

3-3: Appropriate removal of inline Sonner CSS.

Commenting out the Sonner CSS import suggests it's now handled globally through the new style package, which is a cleaner approach than inline imports.


7-7: Correct import path update.

The import path change from styles.css to style.css aligns with the package rename from @evaluate/styles to @evaluate/style.


36-36: Consistent removal of Sonner styling.

Commenting out the Sonner CSS reference in the styles object is consistent with the import change and maintains clean separation of concerns.

apps/website/src/components/terminal/index.tsx (2)

25-25: Type annotation correctly updated.

The props interface type change from PartialRuntime to Runtime is consistent with the import change and maintains type safety.


11-11: Runtime type migration complete and verified

No remaining references to PartialRuntime were found across .ts and .tsx files. The update from PartialRuntime to Runtime in apps/website/src/components/terminal/index.tsx aligns with the migration to @evaluate/runtimes, and all existing usages (e.g. runtime.id) remain valid. Approving these changes.

apps/website/next.config.js (1)

3-3: Migration to new runtime package looks good.

The import update from @evaluate/engine/runtimes to @evaluate/runtimes and the corresponding function name change from fetchRuntimes to fetchAllRuntimes is consistent with the broader package restructuring.

Also applies to: 18-18

apps/website/src/app/(playgrounds)/playgrounds/playground-card-list.tsx (1)

15-15: Type migration to new runtime package is correct.

The update from PartialRuntime to Runtime type from @evaluate/runtimes maintains compatibility as all used properties (id, name, aliases, tags, popularity) are present in the new type definition.

Also applies to: 31-31

apps/discord-bot/src/components/evaluate-modal.ts (2)

9-9: Import path reorganization looks correct.

The update from ~/utilities/session-context to ~/helpers/session-context reflects the codebase reorganization.


42-42: handleEvaluating signature is consistent across the codebase
All calls to the updated handleEvaluating(interaction, runtimeResolvable, options) match its definition in src/handlers/evaluate.ts. No mismatches or remaining call sites with the old signature were found.

• Definition: export async function handleEvaluating(interaction, runtimeResolvable: string, options: CodeOptions) (apps/discord-bot/src/handlers/evaluate.ts)
• Calls:
– apps/discord-bot/src/components/evaluate-modal.ts: handleEvaluating(submit, runtime, { code, args, input })
– apps/discord-bot/src/commands/evaluate.ts: handleEvaluating(use, runtime, { code, args, input })

apps/discord-bot/package.json (1)

21-29: Dependency migration to new package architecture is correct.

The removal of legacy packages (@evaluate/engine, @evaluate/helpers, @evaluate/shapes) and addition of new modular packages (@evaluate/execute, @evaluate/logger, @evaluate/runtimes) aligns with the broader restructuring. The change to caret version ranges for external dependencies (@buape/carbon, zod) is also a good practice.

packages/runtimes/package.json (1)

2-2: Package rename from shapes to runtimes is consistent with migration.

The name change from @evaluate/shapes to @evaluate/runtimes correctly reflects the package's new focused responsibility for runtime management.

packages/execute/src/arguments.ts (1)

1-1: Removal of longShortStrategy has no downstream impact – safe to proceed.

  • No occurrences of longShortStrategy found elsewhere in the repo.
  • No references to “unordered” parsing patterns detected.
  • parseArguments is only used in packages/execute/src/fetch.ts, so the change is isolated.

Ensure that the default (ordered-only) parsing behaviour fulfils all existing requirements; otherwise, no further action is needed.

apps/website/src/components/editor/index.tsx (1)

6-6: Confirm data-fetching functions return full Runtime shape
The <Editor> and <Terminal> components now require the strict Runtime type (fields: id, version, name, aliases, popularity, tags) instead of the old PartialRuntime. Please verify that the data-fetching functions you’re using—namely fetchAllRuntimes and fetchRuntime in
apps/website/src/app/(editor)/playgrounds/[playground]/page.tsx—indeed return objects with all of those required fields.

• Affected call sites:
– apps/website/src/app/(editor)/playgrounds/[playground]/page.tsx
tsx const runtimes = await fetchAllRuntimes(); … <Editor runtime={runtime} /> <Terminal runtime={runtime} />
• Runtime type definition for reference:
– packages/runtimes/src/shapes.ts

apps/browser-extension/src/content-script/execution/index.tsx (2)

2-3: LGTM! Package migration aligned with codebase refactoring.

The import and type updates correctly align with the migration from @evaluate/shapes and @evaluate/engine to the new @evaluate/runtimes and @evaluate/execute packages. The stricter Runtime type ensures consistent data structure.

Also applies to: 6-6, 11-11


20-23: Environment variable VITE_PUBLIC_WEBSITE_URL is correctly defined and validated

  • Located in apps/browser-extension/src/env.ts (via createEnv) with a Zod z.url().transform(v ⇒ new URL(v)) schema
  • Runtime import (import.meta.env.VITE_PUBLIC_WEBSITE_URL) ensures the value is passed through to the extension
  • makePickRuntimePathname simply returns a path fragment and is used correctly in the new URL(...) call

No further action required.

packages/execute/package.json (1)

1-25: Confirm the rationale for using the scoped lexure fork

It appears that npm:@apteryxxyz/lexure@^0.17.0 is a community-maintained fork of the original lexure (which hasn’t been updated since 2020) and likely includes bug fixes or enhancements. Please:

  • Verify which specific modifications or fixes this fork provides and whether they’re required by @evaluate/execute.
  • Document the reasons for choosing this fork, or consider migrating to the official lexure package if it meets your needs.
apps/website/src/app/(editor)/playgrounds/[playground]/wrapper/mobile.tsx (1)

23-29: LGTM! Event isolation improves mobile user experience.

The addition of stopPropagation() event handlers correctly prevents unintended sheet closures when users interact with the explorer and terminal content areas. This is a solid UX improvement for mobile interactions.

Also applies to: 41-47

apps/browser-extension/src/content-script/execution/dialog.tsx (3)

14-15: LGTM! Package migration aligns with new modular architecture.

The import changes properly migrate from the deprecated @evaluate/shapes package to the new focused packages (@evaluate/execute for execution types and @evaluate/runtimes for runtime types). This improves separation of concerns and package modularity.


29-29: Good migration to stricter Runtime type.

The change from PartialRuntime[] to Runtime[] improves type safety by using the complete runtime schema from @evaluate/runtimes. This ensures all required fields (id, version, name, aliases, popularity, tags) are present, which aligns with the new modular architecture.


72-72: Correct adaptation to updated ResultDialog API.

The change to pass options={{ code }} instead of code directly aligns with the updated ResultDialog component signature from the new execution package. This maintains the same functionality while conforming to the new component interface.

packages/runtimes/src/shapes.ts (4)

3-11: Well-structured Runtime schema definition.

The Runtime schema provides a comprehensive model with appropriate types for all necessary runtime metadata:

  • Unique identification (id, version, name)
  • Discoverability (aliases, tags)
  • Ranking capability (popularity)

The use of zod for validation and type inference ensures type safety throughout the codebase.


13-19: Appropriate schema for external API data.

The PistonRuntime schema correctly models the external Piston API response structure with optional runtime field and required language metadata. This provides a clear separation between external API data format and internal Runtime representation.


11-11: Proper zod type inference pattern.

The type exports using z.infer<typeof Schema> follow zod best practices, providing both runtime validation schemas and compile-time TypeScript types for consumers.

Also applies to: 19-19


1-1: Import path ‘zod/v4’ is valid.

The zod 4 subpath is officially exported in the package.json (see exports["./v4"]), so import z from 'zod/v4' will resolve correctly. No changes required.

packages/logger/src/index.ts (2)

31-36: Good API simplification with default export.

Converting to a default export and inlining the options type simplifies the package interface while maintaining full functionality. The updated JSDoc clearly documents the purpose and the inline type definition reduces API surface area.


37-42: Implementation correctly preserved.

The function logic remains unchanged, ensuring existing functionality is maintained while benefiting from the simplified API structure.

apps/website/src/app/(editor)/playgrounds/[playground]/page.tsx (4)

1-1: Proper migration to new runtimes package.

The import update correctly migrates to @evaluate/runtimes with more descriptive function names (fetchAllRuntimes, fetchRuntimeById). The memoized implementations should improve performance compared to the previous functions.


13-13: Correct function call update in generateStaticParams.

The change to fetchAllRuntimes() maintains the same functionality while using the new memoized implementation, which should improve build performance when generating static params.


19-19: Appropriate function call update in generateMetadata.

The change to fetchRuntimeById() correctly maintains the same parameter passing and error handling while benefiting from the memoized implementation.


32-32: Consistent function call update in EditorPage.

The change to fetchRuntimeById() maintains consistency with the generateMetadata function and benefits from memoization when the same runtime is accessed multiple times during rendering.

packages/fetch/src/index.ts (6)

3-3: Good practice to avoid shadowing global fetch.

Caching globalThis.fetch as FETCH prevents shadowing issues when the exported function is also named fetch, ensuring the original global API is always used internally.


5-5: Improved function signature aligns with native fetch.

The default export and parameter names (input, init) now match the native fetch API signature exactly, making this a proper drop-in replacement with enhanced retry logic.


9-9: Correct usage of cached fetch reference.

Using FETCH(input, init) correctly avoids shadowing while maintaining the same functionality with the updated parameter names.


29-31: Better structured logging for retry attempts.

The simplified warning message with structured parameter logging ({ input, init }) provides better debugging information and follows modern logging practices.


32-32: Minor style improvement with shortened parameter name.

The shortened callback parameter r is a common pattern for simple Promise resolvers and maintains readability.


39-39: Improved error context with response as cause.

Using the response object as the error cause provides more useful debugging information (status, headers, etc.) compared to the generic error, especially for HTTP-related failures.

packages/runtimes/src/data/extensions.json (2)

1-88: JSON structure looks well-organised and comprehensive.

The file provides a comprehensive mapping of runtime identifiers to their associated file extensions, supporting the migration from the legacy engine package structure.


28-28: Empty string extension for “file” is intentional and correctly handled

The empty-string entry in extensions.json is used by getRuntimeidFromExtension to map files without any extension to the “file” runtime. Since Array.includes only matches exact elements:

  • Only the “file” runtime has "" in its extensions array, so there’s no ambiguity.
  • No other code paths assume a non-empty extension for this runtime.
  • fetch.ts and getRuntimeDefaultFileName work off example filenames, not extensions.

No further changes required.

apps/discord-bot/src/commands/evaluate.ts (3)

8-8: Import update aligns with package migration.

The import change from @evaluate/engine/runtimes to @evaluate/runtimes correctly reflects the new modular package structure.


50-50: Runtime function signatures verified

Both searchForRuntimes and fetchAllRuntimes in packages/runtimes/src/fetch.ts are exported as memoized async functions and correctly return Promise<PistonRuntime[]>, matching the original behaviour and return types. No further changes required.


73-73: Verified handleEvaluating signature match

The handler in apps/discord-bot/src/handlers/evaluate.ts is declared as:

export async function handleEvaluating(
  interaction: CommandInteraction | ModalInteraction,
  runtimeResolvable: string,
  options: CodeOptions,
) {  }

and the call in apps/discord-bot/src/commands/evaluate.ts:

return handleEvaluating(use, runtime, { code, args, input });

correctly passes the interaction, runtimeResolvable and options parameters. No changes required.

packages/execute/src/fetch.ts (2)

53-62: Excellent timeout and error handling implementation.

The AbortController usage for request timeout and the error handling with cause attachment are well implemented.


22-29: Good file normalisation logic.

The logic to rename 'file.code' to the runtime's default filename and set the entry point is well thought out and handles edge cases properly.

apps/website/src/app/(playgrounds)/playgrounds/playground-card.tsx (4)

10-10: Good migration to centralised runtime utilities.

The import change from PartialRuntime to Runtime and addition of getRuntimeIconUrl aligns well with the new package structure and improves type safety.


30-30: Improved type safety with stricter Runtime type.

Using the Runtime type instead of PartialRuntime provides better type safety and ensures all required runtime properties are available.


60-60: Excellent simplification of icon URL handling.

Replacing the local helper with getRuntimeIconUrl(runtime.id) centralises the logic and maintains proper fallback behaviour with the empty string default.


72-72: Good simplification of version display.

The change from runtime.versions.at(-1)! to runtime.version simplifies the version access and aligns with the new Runtime schema that has a single version property.

packages/execute/src/url.ts (3)

9-12: Well-designed pathname generation for runtime selection.

The makePickRuntimePathname function correctly normalises options and compresses state for the playground URL. The pathname-only approach provides good flexibility for different base URLs.


14-20: Excellent code execution URL generation.

The makeEditCodePathname function properly incorporates the runtime ID into the pathname and maintains consistent state compression. The as const return type provides good type safety.


1-7: Good modular imports and type usage.

The imports correctly reference the new package structure and utilise the appropriate types from the shapes module.

apps/browser-extension/src/content-script/execution/result.tsx (1)

54-57: Add error handling for URL construction.

The URL construction could throw if env.VITE_PUBLIC_WEBSITE_URL is not a valid URL. Consider wrapping in a try-catch or validating the base URL.

+const baseUrl = env.VITE_PUBLIC_WEBSITE_URL;
+if (!baseUrl) {
+  console.error('Website URL not configured');
+  return null; // Or handle appropriately
+}

 href={new URL(
   makePickRuntimePathname(options),
-  env.VITE_PUBLIC_WEBSITE_URL,
+  baseUrl,
 ).toString()}

Also applies to: 70-73

⛔ Skipped due to learnings
Learnt from: apteryxxyz
PR: apteryxxyz/Evaluate#95
File: apps/browser-extension/vite-plugins.ts:69-69
Timestamp: 2025-07-16T23:10:33.941Z
Learning: In the Evaluate codebase, apteryxxyz prefers to let errors throw naturally in internal Vite plugins rather than adding explicit error handling, as it's acceptable for development tooling to fail fast and surface errors clearly.
apps/website/src/components/editor/execute-bar/index.tsx (2)

52-57: Consider the impact of reducing the entry file selection timeout.

Reducing the timeout from 1000ms to 500ms might cause issues on slower systems where files take longer to load. This could result in no entry file being selected.

Has this timeout reduction been tested across different system speeds and file counts?


61-80: Well-implemented mutation configuration.

The mutation is properly configured with the new API, includes proper error handling, and captures relevant telemetry data.

apps/browser-extension/src/background/index.ts (1)

78-84: Consider error handling strategy for multiple runtime executions.

Re-throwing the error after sending the message might prevent other runtime executions from completing when using Promise.all. Consider whether you want fail-fast behaviour or to collect all results.

       .catch((error) => {
         const message =
           error instanceof Error ? error.message : 'Unknown error';
         sendMessage('executionFailed', { errorMessage: message }, endpoint);
-        throw error;
+        return { error: message }; // Return error result instead of throwing
       });
apps/website/src/components/explorer/use.tsx (4)

4-11: Import changes look good!

The migration to the new @evaluate/execute and @evaluate/runtimes packages is correctly implemented.


34-41: Runtime integration implemented correctly.

Good use of optional chaining to handle the null case from getRuntimeExamples.


44-57: Root folder initialization logic is well-structured.

Good defensive programming by checking for special files before adding them.


59-67: URL saving implementation is correct.

The migration to use encodeExplorer maintains the same functionality with the new architecture.

apps/discord-bot/src/handlers/evaluate.ts (3)

11-24: Import updates align with the new package architecture.

Clean migration to the new @evaluate/execute and @evaluate/runtimes packages.


51-117: Evaluation handler successfully migrated to new API.

Good error handling for runtime lookup and proper use of the new execute API that returns both result and options.


119-167: Payload creation properly adapted to new data structures.

The function correctly extracts data from the new ExecuteOptions format and handles special files appropriately.

packages/execute/src/shapes.ts (3)

6-29: Well-designed CodeOptions schema with useful conversion method.

The static from method provides a clean API for converting between option formats.


48-88: Excellent implementation of ExecuteOptions with metadata calculation.

The transform elegantly computes aggregate metrics, and the from method provides seamless conversion from CodeOptions.


90-102: Clean implementation of execution phase results.

Good use of transformations to derive meaningful flags from raw execution data.

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
packages/execute/src/shapes.ts (1)

6-27: Solid implementation with minor type safety consideration

The CodeOptions schema and static method are well-designed. The from method correctly handles the union type conversion.

Consider adding return type annotation for better type safety:

-    from(value: CodeOptions | FilesOptions): CodeOptions {
+    from(value: CodeOptions | FilesOptions): z.infer<typeof CodeOptions> {
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cc5281b and ecb474c.

📒 Files selected for processing (4)
  • apps/website/src/components/explorer/use.tsx (4 hunks)
  • packages/execute/src/arguments.ts (1 hunks)
  • packages/execute/src/fetch.ts (1 hunks)
  • packages/execute/src/shapes.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/execute/src/fetch.ts
  • apps/website/src/components/explorer/use.tsx
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: apteryxxyz
PR: apteryxxyz/Evaluate#95
File: apps/browser-extension/vite-plugins.ts:50-86
Timestamp: 2025-07-16T23:10:36.498Z
Learning: User apteryxxyz prefers if statements without braces when there's a single statement, formatting them as:
if (condition)
  statement;
instead of using curly braces around the statement.
🔇 Additional comments (5)
packages/execute/src/shapes.ts (4)

1-2: LGTM: Clean imports with good library choices

Good use of es-toolkit for utilities and standard Zod import pattern.


31-44: Excellent validation with comprehensive refinements

The FilesOptions schema properly validates the structure and includes a critical refinement to ensure the entry file exists in the files object. The use of catchall(z.string()) for additional files is well thought out.


96-107: Good transformation logic with proper boolean derivation

The ExecutionPhaseResult schema correctly derives success and expired flags from the raw execution data. The output trimming with fallback to undefined is a nice touch for clean data handling.


110-122: Robust result aggregation with sound logic

The ExecuteResult schema properly aggregates compilation and runtime results. The success condition logic (r.run.success && (!r.compile || r.compile.success)) correctly handles optional compilation phases. The output selection priority (compilation errors over runtime output) makes sense.

packages/execute/src/arguments.ts (1)

1-6: Well-configured lexer with good quote support

The lexer configuration properly supports both standard (") and curly ("") quotes, which improves usability for different input sources.

@k0d13 k0d13 merged commit be953ad into main Jul 19, 2025
2 of 4 checks passed
@k0d13 k0d13 deleted the refactor/package-dx branch July 19, 2025 18:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants