Skip to content

Generale improv - #5

Merged
abdelkabirouadoukou merged 10 commits into
mainfrom
generale-improv
Jul 27, 2026
Merged

abdelkabirouadoukou merged 10 commits into
mainfrom
generale-improv

Conversation

@abdelkabirouadoukou

@abdelkabirouadoukou abdelkabirouadoukou commented Jul 27, 2026 •

Copy link
Copy Markdown
Member

Summary by CodeRabbit

  • New Features
    • Updated CLI workflow with x dev, x build, and x start, plus improved help/version and project discovery.
    • Added client-side navigation with link interception, prefetching, caching, and smoother history transitions.
    • Enhanced example apps with new pages/routes, richer UI component library, and Tailwind-based global styling.
    • Introduced environment variable validation utilities.
  • Bug Fixes
    • Improved session/auth behavior using token-based cookies, plus more resilient handling for missing directories/static assets.
  • Documentation
    • Expanded quick-start and production build/start instructions in the guide/README.

- Updated RootLayout component to improve navigation links and styling.
- Added a new CSS file for basic styling in the example app.
- Enhanced CLI with post-install script for linking.
- Improved build process to use a unified server entry point.
- Introduced a default 404 Not Found page component.
- Implemented client-side navigation script for better user experience.
- Added support for serving static assets and improved error handling.
- Updated rendering functions to include optional stylesheet support.
- Enhanced test cases to validate new build and routing features.
- Removed old routes and components for HomePage, LoginPage, and PostPage.
- Introduced new API endpoints for authentication (login/logout).
- Implemented session management with SQLite for user authentication.
- Added new components for Head, Image, and Link for better UI structure.
- Created a new layout for the main application structure.
- Updated routing to support separate directories for pages, layouts, and API.
- Enhanced the dashboard with server functions and user greeting feature.
- Added a custom 404 page and a static About page.
- Introduced environment validation package for better configuration management.
@coderabbitai

coderabbitai Bot commented Jul 27, 2026 •

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@abdelkabirouadoukou, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 5 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 4552503d-4ba7-47ef-9d39-076097eef9b9

📥 Commits

Reviewing files that changed from the base of the PR and between 3eb217b and e613720.

⛔ Files ignored due to path filters (1)
  • bun.lock is excluded by !**/*.lock
📒 Files selected for processing (94)
  • README.md
  • examples/basic/public/styles.css
  • examples/basic/src/api/placeholder/comments.ts
  • examples/basic/src/api/placeholder/posts.ts
  • examples/basic/src/api/placeholder/todos.ts
  • examples/basic/src/components/Head.tsx
  • examples/basic/src/components/Link.tsx
  • examples/basic/src/components/ui/badge.tsx
  • examples/basic/src/components/ui/button.tsx
  • examples/basic/src/components/ui/card.tsx
  • examples/basic/src/components/ui/input.tsx
  • examples/basic/src/layouts/main.tsx
  • examples/basic/src/lib/auth.ts
  • examples/basic/src/lib/placeholder-data.ts
  • examples/basic/src/lib/utils.ts
  • examples/basic/src/pages/_404.tsx
  • examples/basic/src/pages/about.tsx
  • examples/basic/src/pages/blog.tsx
  • examples/basic/src/pages/dashboard/index.tsx
  • examples/basic/src/pages/index.tsx
  • examples/basic/src/pages/login.tsx
  • examples/basic/src/pages/placeholder.tsx
  • examples/basic/src/pages/posts/[id].tsx
  • examples/basic/src/styles/globals.css
  • examples/blog/components.json
  • examples/blog/src/components/ui/avatar.tsx
  • examples/blog/src/components/ui/badge.tsx
  • examples/blog/src/components/ui/button.tsx
  • examples/blog/src/components/ui/card.tsx
  • examples/blog/src/components/ui/input.tsx
  • examples/blog/src/layouts/blog.tsx
  • examples/blog/src/layouts/main.tsx
  • examples/blog/src/lib/utils.ts
  • examples/blog/src/pages/about.tsx
  • examples/blog/src/pages/blog/[slug].tsx
  • examples/blog/src/pages/blog/index.tsx
  • examples/blog/src/pages/index.tsx
  • examples/blog/src/styles/globals.css
  • examples/blog/x.config.ts
  • examples/landing/components.json
  • examples/landing/src/components/code-block.tsx
  • examples/landing/src/components/ui/avatar.tsx
  • examples/landing/src/components/ui/badge.tsx
  • examples/landing/src/components/ui/button.tsx
  • examples/landing/src/components/ui/card.tsx
  • examples/landing/src/components/ui/input.tsx
  • examples/landing/src/layouts/main.tsx
  • examples/landing/src/lib/syntax.tsx
  • examples/landing/src/lib/utils.ts
  • examples/landing/src/pages/contact.tsx
  • examples/landing/src/pages/docs/_layout.tsx
  • examples/landing/src/pages/docs/api-routes.tsx
  • examples/landing/src/pages/docs/build-deploy.tsx
  • examples/landing/src/pages/docs/configuration.tsx
  • examples/landing/src/pages/docs/content-collections.tsx
  • examples/landing/src/pages/docs/data-layer.tsx
  • examples/landing/src/pages/docs/getting-started.tsx
  • examples/landing/src/pages/docs/index.tsx
  • examples/landing/src/pages/docs/layouts.tsx
  • examples/landing/src/pages/docs/middleware.tsx
  • examples/landing/src/pages/docs/pages.tsx
  • examples/landing/src/pages/docs/routing.tsx
  • examples/landing/src/pages/docs/server-functions.tsx
  • examples/landing/src/pages/features.tsx
  • examples/landing/src/pages/index.tsx
  • examples/landing/src/styles/globals.css
  • examples/saas/components.json
  • examples/saas/src/actions/dashboard.ts
  • examples/saas/src/components/ui/avatar.tsx
  • examples/saas/src/components/ui/badge.tsx
  • examples/saas/src/components/ui/button.tsx
  • examples/saas/src/components/ui/card.tsx
  • examples/saas/src/components/ui/input.tsx
  • examples/saas/src/layouts/dashboard.tsx
  • examples/saas/src/layouts/main.tsx
  • examples/saas/src/lib/auth.ts
  • examples/saas/src/lib/utils.ts
  • examples/saas/src/pages/dashboard/_middleware.ts
  • examples/saas/src/pages/dashboard/analytics.tsx
  • examples/saas/src/pages/dashboard/index.tsx
  • examples/saas/src/pages/dashboard/settings.tsx
  • examples/saas/src/pages/index.tsx
  • examples/saas/src/pages/login.tsx
  • examples/saas/src/pages/pricing.tsx
  • examples/saas/src/styles/globals.css
  • examples/saas/x.config.ts
  • packages/cli/src/index.ts
  • packages/core/src/build.ts
  • packages/core/src/content.ts
  • packages/core/src/createApp.ts
  • packages/core/src/router.ts
  • packages/env/src/index.ts
  • packages/env/src/validators.ts
  • scripts/convert-code-blocks.mjs
📝 Walkthrough

Walkthrough

The pull request adds CLI-driven development and production commands, split-directory route discovery, static assets, custom 404 handling, client navigation, an environment validation package, and expanded basic, blog, landing, and SaaS examples.

Changes

Framework runtime and tooling

Layer / File(s) Summary
CLI, routing, and runtime rendering
packages/cli/src/index.ts, packages/core/src/{build,createApp,render,router,client-nav}.ts, packages/core/src/not-found.tsx
Adds CLI command handling, .x/ builds, split-directory discovery, static assets, custom 404 rendering, live reload, client navigation, stylesheet injection, and action-module registration.
Environment schema and validation
packages/env/*
Adds typed string, number, boolean, enum, and URL validators plus createEnv with client-prefix filtering and aggregated errors.
Documentation conversion automation
scripts/convert-code-blocks.mjs
Adds configured string-replacement processing for landing documentation code blocks.

Example applications

Layer / File(s) Summary
Basic example application
examples/basic/*
Adds CLI configuration, pages, layouts, authentication updates, actions, placeholder APIs, UI components, content loading, route metadata, and Tailwind styling.
Blog example
examples/blog/*
Adds blog content, layouts, typed routes, content-driven loaders, pages, UI components, and styling.
Landing and SaaS examples
examples/landing/*, examples/saas/*
Adds landing pages and documentation, syntax highlighting, SaaS pages and dashboards, authentication, UI components, and project configuration.

Estimated code review effort: 5 (Critical) | ~120 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 2.60% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title is too vague and does not describe the main changes in the pull request. Replace it with a concise, specific summary of the primary change, such as the new CLI-driven build and example app updates.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
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 unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch generale-improv

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

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

@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: 11

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (3)
packages/cli/src/index.ts (1)

100-113: 🗄️ Data Integrity & Integration | 🔴 Critical | 🏗️ Heavy lift

Split-directory config fields are defined but never read by the CLI.

examples/basic/x.config.ts defines pagesDir/layoutsDir/apiDir/actionsDir (the schema createApp/build expect), but packages/cli/src/index.ts's detectOptions() only reads routesDir/contentDir/port from the config and cmdBuild only forwards routesDir into build(). The root cause is the CLI's config type/logic, which wasn't updated when split-directory support was added.

  • packages/cli/src/index.ts#L100-L113: update detectOptions()'s config type/fallback and cmdBuild's buildOpts (and the equivalent path in cmdDev) to read and forward pagesDir/apiDir/layoutsDir/actionsDir from the loaded config, not just routesDir.
  • examples/basic/x.config.ts#L1-L10: no change needed here — kept for context; once the CLI reads these fields, x build/x dev will correctly discover examples/basic's src/pages/src/api/src/actions routes instead of silently finding none.
🤖 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/cli/src/index.ts` around lines 100 - 113, Update
packages/cli/src/index.ts lines 100-113: extend detectOptions()’s config type
and fallback handling to read pagesDir, apiDir, layoutsDir, and actionsDir, then
forward all four fields through buildOpts in cmdBuild and the equivalent cmdDev
path alongside routesDir. Leave examples/basic/x.config.ts lines 1-10 unchanged;
it is corrected by the CLI configuration fix.
packages/core/src/build.ts (1)

76-84: 🎯 Functional Correctness | 🔴 Critical | 🏗️ Heavy lift

findLayoutChain can never resolve layouts when layoutsDir differs from pagesDir.

findLayoutChain walks ancestors of the route's own directory (always under pagesDir) and matches them against layouts[i].dirPath (populated from scanLayouts(layoutsDir), i.e. always under layoutsDir). When layoutsDir and pagesDir are separate sibling directories — exactly what examples/basic/x.config.ts configures (pagesDir: "src/pages", layoutsDir: "src/layouts") — no ancestor of a page's directory will ever equal a layout's directory, so chain is always empty and no layout, including the root layout, is ever applied. This is a regression newly exposed by this PR's split-directory support (previously layoutsDir always equaled the single routesDir, so the match always worked).

Separately, createApp.ts passes layoutsDir as the boundary here (findLayoutChain(route.filePath, layouts, layoutsDir)) while this call passes pagesDir — neither actually fixes the mismatch, but the inconsistency is worth reconciling once the underlying resolution is fixed (e.g. by mapping each route's pagesDir-relative subpath onto layoutsDir when the two roots differ).

🤖 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/build.ts` around lines 76 - 84, Update findLayoutChain and
its callers to resolve layouts by mapping each route’s pagesDir-relative
directory onto layoutsDir when the roots differ, so sibling layouts—including
the root layout—are discovered. Reconcile the inconsistent boundary argument
between the build.ts call and createApp.ts, using the same layout-root
resolution behavior throughout.
examples/basic/src/x-routes.ts (1)

2-11: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Align RouteMap with the API route paths and client fetch URLs.

scanRoutes maps examples/basic/src/api/auth/login.ts to "/auth/login" (not "/api/auth/login"), so the generated RouteMap is consistent with the route files. Update examples/basic/src/pages/login.tsx and the logout fetch in examples/basic/src/pages/dashboard/index.tsx to use "/auth/login" / "/auth/logout" instead of the /api/... URLs.

🤖 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 `@examples/basic/src/x-routes.ts` around lines 2 - 11, Update the login request
in the login page and the logout fetch in the dashboard page to use the route
paths "/auth/login" and "/auth/logout" respectively, matching the existing
RouteMap entries and scanRoutes output; leave RouteMap unchanged.
🧹 Nitpick comments (7)
packages/core/src/build.test.ts (1)

101-103: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

No test coverage for the new split-directory build options.

All build() calls in this file still use the legacy single routesDir option; nothing exercises pagesDir/apiDir/layoutsDir together (e.g. with layoutsDir pointing to a sibling directory of pagesDir). A fixture covering that combination would have caught the findLayoutChain resolution gap flagged in packages/core/src/build.ts.

🤖 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/build.test.ts` around lines 101 - 103, Add coverage in the
build tests for the split-directory options by calling build with pagesDir,
apiDir, and layoutsDir together, using a fixture where layoutsDir is a sibling
of pagesDir. Assert the generated output includes the expected app, server,
routes, and layout behavior so findLayoutChain resolves layouts from the
separate directory.
package.json (2)

7-13: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Global bun link --force runs on every install.

Root postinstall unconditionally mutates the user's global bun bin directory on every bun install, including CI/sandboxed/read-only environments. The || fallback avoids a hard failure, but the side effect (and warning noise) still fires every time. Consider skipping it when CI/non-interactive is detected, or only running it as an explicit opt-in (bun run link).

♻️ Suggested guard
-    "postinstall": "cd packages/cli && bun link --force && echo '[x] \"x\" CLI linked globally. Make sure ~/.bun/bin is in your PATH.' || echo '[x] Could not link globally. Use \"bun run dev\" in the example instead.'"
+    "postinstall": "if [ -z \"$CI\" ]; then cd packages/cli && bun link --force && echo '[x] \"x\" CLI linked globally. Make sure ~/.bun/bin is in your PATH.' || echo '[x] Could not link globally. Use \"bun run dev\" in the example instead.'; fi"
🤖 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 `@package.json` around lines 7 - 13, Update the root package.json postinstall
script to avoid running the global bun link operation during CI or
non-interactive installs, while preserving the existing link behavior for
supported interactive installs. Keep the fallback messaging scoped to an actual
attempted link and use the existing packages/cli linking command.

6-6: 🔒 Security & Privacy | 🔵 Trivial | 💤 Low value

Remove the unused trustedDependencies entry.

packages/cli/package.json only sets bin and dependencies, so there is no CLI lifecycle script that would need trustedDependencies; keeping this entry adds no value.

🤖 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 `@package.json` at line 6, Remove the unused trustedDependencies entry from the
package configuration, leaving the existing bin and dependencies settings
unchanged.
packages/core/src/createApp.ts (2)

535-569: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

prodFetch duplicates devFetch almost verbatim.

Both functions share the revalidation → server-fn → static-asset → handlers → content → 404 pipeline. Extracting a shared createFetchHandler(development: boolean) would avoid future drift between the two paths (e.g. the layout/watcher issues above would only need fixing once).

Separately, replacing the previous precomputed routeMap with a per-request linear scan over handlers/contentHandlers (Lines 549-560) trades O(1) lookup for O(n) per request in production — likely negligible for small route counts but worth keeping in mind if the app grows many routes.

🤖 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/createApp.ts` around lines 535 - 569, Refactor the
duplicated prodFetch/devFetch request pipeline into a shared
createFetchHandler(development: boolean) helper, preserving the existing
revalidation, server-function, static-asset, route-handler, content-handler, and
404 ordering while allowing development-specific behavior. Replace both fetch
implementations with handlers created through this helper; retain the current
production route matching behavior unless an existing shared lookup abstraction
is required.

82-84: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Fragile project-root inference.

projectRootFromRoutesDir assumes pagesDir is always exactly two levels below the project root (e.g. <root>/src/pages). If a user configures pagesDir with a different nesting depth (e.g. flat "pages" or "app/routes/pages"), this silently resolves to the wrong directory, and publicDir/stylesheetHref detection at Lines 213-217 will silently fail to find public/ (no error, just no static assets/stylesheet served).

Consider adding an explicit publicDir/rootDir option to CreateAppOptions instead of inferring it from pagesDir's relative depth.

🤖 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/createApp.ts` around lines 82 - 84, Replace the fragile
project-root inference in projectRootFromRoutesDir with an explicit publicDir or
rootDir option on CreateAppOptions. Update createApp and the
publicDir/stylesheetHref detection to use that configured directory, while
preserving the existing default behavior when no option is provided. Avoid
deriving the root from pagesDir nesting depth.
examples/basic/public/styles.css (1)

8-25: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add blank line before font-family per Stylelint.

Stylelint flags a missing empty line before the declaration at line 20.

🎨 Proposed fix
   --success: `#3fb950`;
+
   font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
🤖 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 `@examples/basic/public/styles.css` around lines 8 - 25, Update the :root rule
in styles.css by adding a blank line before the font-family declaration,
preserving all existing declarations and values.

Source: Linters/SAST tools

packages/core/src/render.ts (1)

38-40: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

Consider serving CLIENT_NAV_SCRIPT as a cached static file instead of inlining it on every response.

buildNavScriptTag embeds the full script text into every renderPage/renderStaticPage/renderStreamingPage response. Since the script never varies per-page, serving it from a fixed URL (e.g. /_x/nav.js) would let browsers cache it across full page loads instead of re-downloading it on every navigation/reload.

♻️ Sketch of the change
-function buildNavScriptTag(clientNav: boolean | undefined): string {
-  return clientNav === false ? "" : `\n    <script>${CLIENT_NAV_SCRIPT}</script>`;
-}
+function buildNavScriptTag(clientNav: boolean | undefined): string {
+  return clientNav === false ? "" : `\n    <script src="/_x/nav.js" defer></script>`;
+}

Serve CLIENT_NAV_SCRIPT as static content at /_x/nav.js (e.g. in createApp.ts's static-asset handling) with long-lived cache headers.

Also applies to: 64-107, 110-164

🤖 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/render.ts` around lines 38 - 40, Replace the inline
CLIENT_NAV_SCRIPT output produced by buildNavScriptTag with a reference to a
fixed static URL such as /_x/nav.js, while preserving the clientNav === false
behavior. Add static-asset handling in the app setup (for example createApp) to
serve CLIENT_NAV_SCRIPT at that URL with long-lived cache headers, and ensure
all renderPage, renderStaticPage, and renderStreamingPage paths use the cached
script reference.
🤖 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 `@examples/basic/src/components/Head.tsx`:
- Around line 1-31: Replace the useEffect-based document title and metadata
updates in Head with declarative React 19 head elements rendered by the
component, including title, description, Open Graph tags, and any children.
Preserve optional-field behavior while ensuring the elements are available
during SSR and streaming, and remove the now-unneeded effect and DOM-query
logic.

In `@examples/basic/src/components/Link.tsx`:
- Around line 10-20: Update the Link component’s prefetch handling so
prefetch={false} disables only hover prefetch, not client-side click navigation:
use the separate data-no-prefetch marker for this prop instead of data-no-nav,
and update isEligibleLink in client-nav.ts so the mouseover/prefetch path checks
data-no-prefetch while data-no-nav continues to opt out of SPA navigation
entirely.

In `@examples/basic/src/lib/auth.ts`:
- Around line 15-19: Move the existing 001_create_sessions.sql migration
directory and file from the data location to examples/basic/src/lib/migrations,
matching the path passed by getDb to runSQLiteMigrations. Preserve the migration
filename and contents so the sessions table is created before session inserts.

In `@packages/core/src/build.ts`:
- Around line 162-163: Update BuildOptions and the buildServerEntry generation
flow in build() to accept and forward apiDir, layoutsDir, and actionsDir into
the generated createApp configuration, alongside the existing
routesDir/contentDir/port/development values. Propagate actionsDir from the
build call site as well, so production uses the same split-directory route and
action locations scanned during the build.
- Around line 38-54: Guard the scanLayouts call in the build flow so scanLayouts
is invoked only when layoutsDir is non-empty and exists, matching the existing
scanPages protection. Preserve normal layout scanning when the directory is
valid and use an empty layout result when no layouts directory is configured.

In `@packages/core/src/createApp.ts`:
- Around line 226-236: Fix the layout-root mismatch across createApp,
scanLayouts, and findLayoutChain: ensure route directories under pagesDir are
correctly mapped to layoutsDir while walking layout chains, and update the
root-layout lookup around rootLayout accordingly so split roots apply
_layout.tsx entries to generated pages; otherwise explicitly enforce layoutsDir
=== pagesDir.
- Around line 192-211: Remove the individual named-export auto-registration loop
in the actionsDir handling of createApp, including its Object.entries traversal
and registerServerFunctions call. Only register server actions when an action
module explicitly provides the actions export, preserving the existing actions
object flow.
- Line 488: Update the dev watcher setup around watch and scheduleRebuild to
watch every configured source directory—primaryDir, apiDir, layoutsDir, and
actionsDir—instead of only primaryDir, while preserving the existing rebuild
callback and avoiding duplicate watchers when directories overlap.

In `@packages/core/src/render.ts`:
- Around line 42-62: Update htmlShell in packages/core/src/render.ts at lines
42-62 to place propsScript and island script tags inside the root div, matching
the existing placement in packages/core/src/render.ts lines 121-127. Leave the
streaming placement unchanged; packages/core/src/client-nav.ts lines 93-129
require no direct change.

In `@packages/env/src/index.ts`:
- Around line 35-45: Update the client-schema loop in the environment parsing
flow to reject any key also declared in the server schema before calling
validator.parse. Record a validation error for the duplicate and skip parsing or
assigning that client value, preserving the existing handling for
non-overlapping client keys.

In `@packages/env/src/validators.ts`:
- Around line 18-20: Update the numeric validation logic around the input
conversion to reject blank or whitespace-only strings and any non-finite result,
while continuing to return valid finite numbers. Preserve the existing error
behavior and message style for invalid inputs.

---

Outside diff comments:
In `@examples/basic/src/x-routes.ts`:
- Around line 2-11: Update the login request in the login page and the logout
fetch in the dashboard page to use the route paths "/auth/login" and
"/auth/logout" respectively, matching the existing RouteMap entries and
scanRoutes output; leave RouteMap unchanged.

In `@packages/cli/src/index.ts`:
- Around line 100-113: Update packages/cli/src/index.ts lines 100-113: extend
detectOptions()’s config type and fallback handling to read pagesDir, apiDir,
layoutsDir, and actionsDir, then forward all four fields through buildOpts in
cmdBuild and the equivalent cmdDev path alongside routesDir. Leave
examples/basic/x.config.ts lines 1-10 unchanged; it is corrected by the CLI
configuration fix.

In `@packages/core/src/build.ts`:
- Around line 76-84: Update findLayoutChain and its callers to resolve layouts
by mapping each route’s pagesDir-relative directory onto layoutsDir when the
roots differ, so sibling layouts—including the root layout—are discovered.
Reconcile the inconsistent boundary argument between the build.ts call and
createApp.ts, using the same layout-root resolution behavior throughout.

---

Nitpick comments:
In `@examples/basic/public/styles.css`:
- Around line 8-25: Update the :root rule in styles.css by adding a blank line
before the font-family declaration, preserving all existing declarations and
values.

In `@package.json`:
- Around line 7-13: Update the root package.json postinstall script to avoid
running the global bun link operation during CI or non-interactive installs,
while preserving the existing link behavior for supported interactive installs.
Keep the fallback messaging scoped to an actual attempted link and use the
existing packages/cli linking command.
- Line 6: Remove the unused trustedDependencies entry from the package
configuration, leaving the existing bin and dependencies settings unchanged.

In `@packages/core/src/build.test.ts`:
- Around line 101-103: Add coverage in the build tests for the split-directory
options by calling build with pagesDir, apiDir, and layoutsDir together, using a
fixture where layoutsDir is a sibling of pagesDir. Assert the generated output
includes the expected app, server, routes, and layout behavior so
findLayoutChain resolves layouts from the separate directory.

In `@packages/core/src/createApp.ts`:
- Around line 535-569: Refactor the duplicated prodFetch/devFetch request
pipeline into a shared createFetchHandler(development: boolean) helper,
preserving the existing revalidation, server-function, static-asset,
route-handler, content-handler, and 404 ordering while allowing
development-specific behavior. Replace both fetch implementations with handlers
created through this helper; retain the current production route matching
behavior unless an existing shared lookup abstraction is required.
- Around line 82-84: Replace the fragile project-root inference in
projectRootFromRoutesDir with an explicit publicDir or rootDir option on
CreateAppOptions. Update createApp and the publicDir/stylesheetHref detection to
use that configured directory, while preserving the existing default behavior
when no option is provided. Avoid deriving the root from pagesDir nesting depth.

In `@packages/core/src/render.ts`:
- Around line 38-40: Replace the inline CLIENT_NAV_SCRIPT output produced by
buildNavScriptTag with a reference to a fixed static URL such as /_x/nav.js,
while preserving the clientNav === false behavior. Add static-asset handling in
the app setup (for example createApp) to serve CLIENT_NAV_SCRIPT at that URL
with long-lived cache headers, and ensure all renderPage, renderStaticPage, and
renderStreamingPage paths use the cached script reference.
🪄 Autofix (Beta)

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: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 46a4fe5c-505c-4e72-9915-45cd99a256df

📥 Commits

Reviewing files that changed from the base of the PR and between df5fddb and 3adb7c0.

📒 Files selected for processing (41)
  • README.md
  • examples/basic/package.json
  • examples/basic/public/styles.css
  • examples/basic/server.ts
  • examples/basic/src/actions/dashboard/greet.ts
  • examples/basic/src/api/auth/login.ts
  • examples/basic/src/api/auth/logout.ts
  • examples/basic/src/components/Head.tsx
  • examples/basic/src/components/Image.tsx
  • examples/basic/src/components/Link.tsx
  • examples/basic/src/layouts/main.tsx
  • examples/basic/src/lib/auth.ts
  • examples/basic/src/pages/_404.tsx
  • examples/basic/src/pages/about.tsx
  • examples/basic/src/pages/blog.tsx
  • examples/basic/src/pages/dashboard/_middleware.ts
  • examples/basic/src/pages/dashboard/index.tsx
  • examples/basic/src/pages/index.tsx
  • examples/basic/src/pages/login.tsx
  • examples/basic/src/pages/posts/[id].tsx
  • examples/basic/src/routes/_layout.tsx
  • examples/basic/src/routes/blog.tsx
  • examples/basic/src/routes/dashboard/greet.ts
  • examples/basic/src/routes/dashboard/index.tsx
  • examples/basic/src/routes/login.tsx
  • examples/basic/src/x-routes.ts
  • examples/basic/x.config.ts
  • package.json
  • packages/cli/src/index.ts
  • packages/core/src/build.test.ts
  • packages/core/src/build.ts
  • packages/core/src/client-nav.ts
  • packages/core/src/createApp.ts
  • packages/core/src/index.ts
  • packages/core/src/island.tsx
  • packages/core/src/not-found.tsx
  • packages/core/src/render.ts
  • packages/core/src/router.ts
  • packages/env/package.json
  • packages/env/src/index.ts
  • packages/env/src/validators.ts
💤 Files with no reviewable changes (5)
  • examples/basic/src/routes/_layout.tsx
  • examples/basic/src/routes/dashboard/index.tsx
  • examples/basic/src/routes/dashboard/greet.ts
  • examples/basic/src/routes/login.tsx
  • examples/basic/src/routes/blog.tsx

Comment thread examples/basic/src/components/Head.tsx Resolved
Comment on lines +10 to +20
export default function Link({ href, children, className, prefetch = true }: LinkProps) {
return (
<a
href={href}
className={className}
data-no-nav={prefetch ? undefined : ""}
>
{children}
</a>
);
}

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

prefetch={false} also disables client-side click navigation, not just hover-prefetch.

data-no-nav is checked by isEligibleLink in packages/core/src/client-nav.ts for both the mouseover prefetch handler and the click navigate handler. Setting prefetch={false} on Link therefore silently forces a full page reload on click too, which is surprising given the prop name.

🔧 Suggested fix: separate the two concerns
-      data-no-nav={prefetch ? undefined : ""}
+      data-no-prefetch={prefetch ? undefined : ""}

And in client-nav.ts, only gate the mouseover/prefetch path on data-no-prefetch, keeping data-no-nav (if still needed) solely for opting a link out of SPA navigation entirely.

🤖 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 `@examples/basic/src/components/Link.tsx` around lines 10 - 20, Update the Link
component’s prefetch handling so prefetch={false} disables only hover prefetch,
not client-side click navigation: use the separate data-no-prefetch marker for
this prop instead of data-no-nav, and update isEligibleLink in client-nav.ts so
the mouseover/prefetch path checks data-no-prefetch while data-no-nav continues
to opt out of SPA navigation entirely.

Comment on lines 15 to 19
function getDb() {
const dbPath = join(import.meta.dir, "..", "..", "data", "dev.db");
const db = connectSQLite({ path: dbPath });
runSQLiteMigrations(db, join(import.meta.dir, "..", "..", "data", "migrations"));
runSQLiteMigrations(db, join(import.meta.dir, "migrations"));
return db;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
fd -t d migrations examples/basic
fd . examples/basic/src/lib/migrations 2>/dev/null || echo "examples/basic/src/lib/migrations not found"

Repository: abdelkabirouadoukou/x

Length of output: 235


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== candidate files =="
git ls-files | rg '(^examples/basic/src/lib/auth\.ts$|^examples/basic/src/lib|migrations\.ts$)' | sed -n '1,120p'

echo
echo "== auth.ts =="
cat -n examples/basic/src/lib/auth.ts 2>/dev/null || true

echo
echo "== data/migrations files =="
find examples/basic/data -maxdepth 3 -type f -print | sort
find examples/basic/src/lib -maxdepth 3 -type f -print 2>/_dev/null || true

echo
echo "== sql references =="
rg -n "CREATE TABLE.*(sessions|token)|alter table|add column|create.*sessions|sessions" examples/basic -S || true

Repository: abdelkabirouadoukou/x

Length of output: 3632


Move the migrations source before changing the load path.

auth.ts now loads migrations from examples/basic/src/lib/migrations, but the only migration file is still at examples/basic/data/migrations/001_create_sessions.sql. Move/rename that migration directory and file to the new path so runSQLiteMigrations() can create the sessions table; otherwise session inserts will fail.

🤖 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 `@examples/basic/src/lib/auth.ts` around lines 15 - 19, Move the existing
001_create_sessions.sql migration directory and file from the data location to
examples/basic/src/lib/migrations, matching the path passed by getDb to
runSQLiteMigrations. Preserve the migration filename and contents so the
sessions table is created before session inserts.

Comment thread packages/core/src/build.ts Resolved
Comment thread packages/core/src/build.ts Resolved
Comment thread packages/core/src/createApp.ts Resolved
Comment thread packages/core/src/createApp.ts Resolved
Comment thread packages/core/src/render.ts Resolved
Comment thread packages/env/src/index.ts
Comment on lines +35 to +45
if (schema.client) {
const prefix = schema.clientPrefix ?? "";
for (const [key, validator] of Object.entries(schema.client)) {
if (!key.startsWith(prefix)) {
errors.push(`client.${key}: must start with prefix "${prefix}"`);
continue;
}
try {
result[key] = validator.parse(schema.runtimeEnv[key]);
} catch (err) {
errors.push(`client.${key}: ${err instanceof Error ? err.message : String(err)}`);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Reject keys declared in both schemas.

A duplicate key is parsed twice and the client value overwrites the server value. For incompatible validators, the declared return type becomes an intersection (for example number & string) while runtime returns only the client value. Detect overlap before parsing the client entry.

Proposed fix
     const prefix = schema.clientPrefix ?? "";
     for (const [key, validator] of Object.entries(schema.client)) {
+      if (schema.server && Object.prototype.hasOwnProperty.call(schema.server, key)) {
+        errors.push(`client.${key}: must not be declared in both server and client`);
+        continue;
+      }
       if (!key.startsWith(prefix)) {
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if (schema.client) {
const prefix = schema.clientPrefix ?? "";
for (const [key, validator] of Object.entries(schema.client)) {
if (!key.startsWith(prefix)) {
errors.push(`client.${key}: must start with prefix "${prefix}"`);
continue;
}
try {
result[key] = validator.parse(schema.runtimeEnv[key]);
} catch (err) {
errors.push(`client.${key}: ${err instanceof Error ? err.message : String(err)}`);
if (schema.client) {
const prefix = schema.clientPrefix ?? "";
for (const [key, validator] of Object.entries(schema.client)) {
if (schema.server && Object.prototype.hasOwnProperty.call(schema.server, key)) {
errors.push(`client.${key}: must not be declared in both server and client`);
continue;
}
if (!key.startsWith(prefix)) {
errors.push(`client.${key}: must start with prefix "${prefix}"`);
continue;
}
try {
result[key] = validator.parse(schema.runtimeEnv[key]);
} catch (err) {
errors.push(`client.${key}: ${err instanceof Error ? err.message : String(err)}`);
🤖 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/env/src/index.ts` around lines 35 - 45, Update the client-schema
loop in the environment parsing flow to reject any key also declared in the
server schema before calling validator.parse. Record a validation error for the
duplicate and skip parsing or assigning that client value, preserving the
existing handling for non-overlapping client keys.

Comment on lines +18 to +20
const n = Number(input);
if (Number.isNaN(n)) throw new Error(`Expected a number, got "${input}"`);
return n;

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 | 🟡 Minor | ⚡ Quick win

Reject blank and non-finite numeric values.

Number("") becomes 0 and Number("Infinity") passes the isNaN check, silently misconfiguring numeric settings such as ports or timeouts. Require a non-empty, finite number.

Proposed fix
-      const n = Number(input);
-      if (Number.isNaN(n)) throw new Error(`Expected a number, got "${input}"`);
+      const value = input.trim();
+      if (value === "") throw new Error("Expected a number, got an empty string");
+      const n = Number(value);
+      if (!Number.isFinite(n)) throw new Error(`Expected a finite number, got "${input}"`);
       return n;
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const n = Number(input);
if (Number.isNaN(n)) throw new Error(`Expected a number, got "${input}"`);
return n;
const value = input.trim();
if (value === "") throw new Error("Expected a number, got an empty string");
const n = Number(value);
if (!Number.isFinite(n)) throw new Error(`Expected a finite number, got "${input}"`);
return n;
🤖 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/env/src/validators.ts` around lines 18 - 20, Update the numeric
validation logic around the input conversion to reject blank or whitespace-only
strings and any non-finite result, while continuing to return valid finite
numbers. Preserve the existing error behavior and message style for invalid
inputs.

Added scanLayoutsDir function to support dedicated layouts directory.

Updated createApp to combine layouts from dedicated and nested directories.

Improved action registration to derive parent-level route paths.

Enhanced API route scanning to prefix paths with /api.

Implemented file watching for additional directories (layouts, actions).

Introduced new components: Badge, Button, Card, Input with styling.

Created placeholder API endpoints for posts, comments, todos, and users.

Added global styles and utility functions for class name merging.

Established a basic example application structure with a placeholder page.

@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: 11

🧹 Nitpick comments (5)
examples/basic/src/pages/placeholder.tsx (2)

71-72: 🚀 Performance & Scalability | 🔵 Trivial | 💤 Low value

Serializing the payload three times per response.

JSON.stringify(json, null, 2) runs twice here plus once at line 63; for the 500-comment payload this is noticeable. Compute once and reuse.

♻️ Proposed fix
+          var pretty = JSON.stringify(json, null, 2);
           log(
             "\\u2714 " + url + "\\n" +
             "Status: 200 OK\\n" +
             "Time:   " + fmt(elapsed) + "\\n" +
             "Size:   " + (size / 1024).toFixed(1) + " KB\\n" +
             "Items:  " + (Array.isArray(json) ? json.length : json.data ? json.data.length : 1) + "\\n\\n" +
-            JSON.stringify(json, null, 2).slice(0, 2000) +
-            (JSON.stringify(json, null, 2).length > 2000 ? "\\n..." : "")
+            pretty.slice(0, 2000) +
+            (pretty.length > 2000 ? "\\n..." : "")
           );
🤖 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 `@examples/basic/src/pages/placeholder.tsx` around lines 71 - 72, In the
response formatting flow around JSON.stringify, serialize json once into a local
value and reuse it for both the truncated output and length check, while also
replacing the earlier serialization near line 63 with that same value so each
response performs only one serialization.

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

Unused variable with an unguarded deref chain.

label is never read, yet btn.parentElement.previousElementSibling.textContent will throw if the DOM shape ever changes. Drop the line.

🧹 Proposed fix
-          var label = btn.parentElement.previousElementSibling.textContent.trim();
🤖 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 `@examples/basic/src/pages/placeholder.tsx` at line 64, Remove the unused label
declaration from the button-handling logic; specifically delete the var label
assignment and its unguarded parentElement/previousElementSibling dereference.
examples/basic/public/styles.css (1)

1-3: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Committed Tailwind build artifact is linted and will drift from src/styles/globals.css.

All Stylelint errors reported for this file are in generated output (value-keyword-case, declaration-empty-line-before, appearance: button) — not hand-written code. Either generate this file during the example's build step, or add it to .stylelintignore / the Stylelint ignoreFiles config so CI isn't flagging Tailwind's emitted CSS.

Note the duplication risk: the :root token block at lines 1034-1066 is a copy of the one in src/styles/globals.css; editing one won't update the other unless this file is regenerated.

🤖 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 `@examples/basic/public/styles.css` around lines 1 - 3, Handle the generated
Tailwind output represented by examples/basic/public/styles.css rather than
editing its emitted declarations: either regenerate it as part of the example
build so it stays synchronized with src/styles/globals.css, or exclude the
generated file from Stylelint via .stylelintignore or the ignoreFiles
configuration. Ensure CI no longer lints this committed artifact and avoid
maintaining duplicated token definitions manually.

Source: Linters/SAST tools

examples/basic/src/lib/placeholder-data.ts (1)

64-69: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Replace the dead placeholder image host.

via.placeholder.com now returns an empty reply for these photo URLs, so rendered images can break. Consider using https://picsum.photos/... or local placeholder assets instead.

🤖 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 `@examples/basic/src/lib/placeholder-data.ts` around lines 64 - 69, Update the
photo URL templates in the photos array to use a functioning image source
instead of via.placeholder.com, while preserving distinct full-size and
thumbnail URLs and the existing per-photo variation based on i.
packages/cli/src/index.ts (1)

110-129: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

Tailwind compile in cmdDev runs once, without --watch.

CSS changes to src/styles/globals.css (or content files) after the initial dev-server start won't be recompiled — the user would need to restart bun run dev to see style updates. @tailwindcss/cli supports a --watch flag for exactly this purpose.

♻️ Suggested direction
-    const r = spawnSync("bunx", ["tailwindcss", "-i", twInput, "-o", twOutput], { cwd: projectDir });
-    if (r.status !== 0) console.warn("[x] Tailwind compilation failed, serving raw CSS.");
+    const { spawn } = await import("node:child_process");
+    spawn("bunx", ["tailwindcss", "-i", twInput, "-o", twOutput, "--watch"], {
+      cwd: projectDir,
+      stdio: "inherit",
+    });

Please confirm --watch behaves as expected with the installed @tailwindcss/cli@^4.3.3 version pinned in examples/basic/package.json before adopting this change.

🤖 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/cli/src/index.ts` around lines 110 - 129, Update the Tailwind
compilation flow in cmdDev to run the CLI with --watch so changes to globals.css
and referenced content files are rebuilt during development. Ensure the watcher
remains active while the Bun dev server runs, and verify compatibility with the
pinned `@tailwindcss/cli` version before finalizing.
🤖 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 `@examples/basic/.gitignore`:
- Line 5: Decide whether server.ts is a maintained entry point or disposable
artifact, then make all three configuration sites consistent:
examples/basic/.gitignore lines 5-5 must stop ignoring it if maintained;
examples/basic/package.json lines 6-10 must remove dev:direct if it is not
maintained; and examples/basic/tsconfig.json lines 4-10 must include server.ts
when dev:direct continues using it.

In `@examples/basic/src/api/placeholder/comments.ts`:
- Line 11: Apply the Biome formatter to all three placeholder endpoints:
reformat the paginated Response.json return in
examples/basic/src/api/placeholder/comments.ts (lines 11-11) and
examples/basic/src/api/placeholder/posts.ts (lines 14-14) into multi-line form,
and reformat both the completed filter if statement and Response.json return in
examples/basic/src/api/placeholder/todos.ts (lines 9-14) to satisfy the
configured line width.

In `@examples/basic/src/components/Head.tsx`:
- Around line 13-17: Update the Open Graph meta elements in the Head component
to use the property attribute for og:title, og:description, og:image, and
og:type. Keep the standard description element using name, and preserve the
existing conditional rendering and values.

In `@examples/basic/src/lib/migrations/001_create_sessions.sql`:
- Around line 1-9: Rename the sessions column from token to token_hash in the
migration, then update the session creation and lookup logic in auth.ts to hash
bearer tokens before inserting or querying. Ensure all references to the raw
token column use the hashed value while preserving the existing session
authentication behavior.

In `@examples/basic/src/lib/placeholder-data.ts`:
- Around line 40-44: Update the comments initializer in the comments array so
the constant body text uses a regular quoted string instead of a template
literal, while preserving the existing text and generated comment data.
- Around line 51-58: Remove the non-null assertions from the user data
construction in the users initializer, replacing indexed firstNames, lastNames,
and emails access with the existing pick helper, which already returns T.
Preserve the current generated values and structure while ensuring the file
complies with Biome’s noNonNullAssertion rule.

In `@examples/basic/src/lib/utils.ts`:
- Around line 1-6: Resolve the Biome violations across the listed example UI
files: in examples/basic/src/lib/utils.ts lines 1-6, organize the clsx value and
type specifiers; in examples/basic/src/components/ui/button.tsx lines 1-58 and
badge.tsx lines 1-52, apply Biome import organization and formatting; in
card.tsx lines 1-103, convert the React import to type-only and format the file;
and in input.tsx lines 1-20, convert the React import to type-only, organize
imports, and apply formatting.

In `@examples/basic/src/pages/placeholder.tsx`:
- Line 25: Update the button markup and handler targeting around the `fetch-all`
element so `#fetch-all` is excluded from the generic `.fetch-btn` listener,
while preserving its dedicated Fetch All behavior. Ensure the generic handler
only processes buttons with a valid `data-url`, preventing `/null` requests and
label updates from affecting `#fetch-all` or the benchmark results.

In `@examples/basic/src/styles/globals.css`:
- Line 78: In the :root declarations, rename the duplicate --sidebar-foreground
property to --sidebar-accent-foreground, and add the missing
--destructive-foreground token or remove its corresponding `@theme` inline
mapping; update both affected sites in examples/basic/src/styles/globals.css
(anchor 78-78 and sibling 22-22).

In `@packages/cli/src/index.ts`:
- Around line 60-80: Update detectOptionsFromConfig to provide the same
src/pages and src/routes fallback used by detectDefaultOptions when cfg.pagesDir
and cfg.routesDir are omitted, while preserving explicitly configured directory
values and existing contentDir behavior. Ensure the returned options always
include a usable pagesDir or routesDir so downstream build and createApp
scanning is not skipped.

In `@packages/core/src/router.ts`:
- Around line 125-139: Update scanLayoutsDir to retain the statSync result and
return the existing empty entries array unless layoutsDir is a directory, before
calling readdirSync. Preserve the current behavior for missing paths and
continue scanning valid directories unchanged.

---

Nitpick comments:
In `@examples/basic/public/styles.css`:
- Around line 1-3: Handle the generated Tailwind output represented by
examples/basic/public/styles.css rather than editing its emitted declarations:
either regenerate it as part of the example build so it stays synchronized with
src/styles/globals.css, or exclude the generated file from Stylelint via
.stylelintignore or the ignoreFiles configuration. Ensure CI no longer lints
this committed artifact and avoid maintaining duplicated token definitions
manually.

In `@examples/basic/src/lib/placeholder-data.ts`:
- Around line 64-69: Update the photo URL templates in the photos array to use a
functioning image source instead of via.placeholder.com, while preserving
distinct full-size and thumbnail URLs and the existing per-photo variation based
on i.

In `@examples/basic/src/pages/placeholder.tsx`:
- Around line 71-72: In the response formatting flow around JSON.stringify,
serialize json once into a local value and reuse it for both the truncated
output and length check, while also replacing the earlier serialization near
line 63 with that same value so each response performs only one serialization.
- Line 64: Remove the unused label declaration from the button-handling logic;
specifically delete the var label assignment and its unguarded
parentElement/previousElementSibling dereference.

In `@packages/cli/src/index.ts`:
- Around line 110-129: Update the Tailwind compilation flow in cmdDev to run the
CLI with --watch so changes to globals.css and referenced content files are
rebuilt during development. Ensure the watcher remains active while the Bun dev
server runs, and verify compatibility with the pinned `@tailwindcss/cli` version
before finalizing.
🪄 Autofix (Beta)

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: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 1e207a4e-04f3-4d72-88d6-2f095e6e568c

📥 Commits

Reviewing files that changed from the base of the PR and between 3adb7c0 and bf029e1.

⛔ Files ignored due to path filters (1)
  • bun.lock is excluded by !**/*.lock
📒 Files selected for processing (36)
  • examples/basic/.gitignore
  • examples/basic/components.json
  • examples/basic/package.json
  • examples/basic/public/styles.css
  • examples/basic/server.ts
  • examples/basic/src/api/placeholder/comments.ts
  • examples/basic/src/api/placeholder/posts.ts
  • examples/basic/src/api/placeholder/todos.ts
  • examples/basic/src/api/placeholder/users.ts
  • examples/basic/src/components/Head.tsx
  • examples/basic/src/components/ui/badge.tsx
  • examples/basic/src/components/ui/button.tsx
  • examples/basic/src/components/ui/card.tsx
  • examples/basic/src/components/ui/input.tsx
  • examples/basic/src/layouts/main.tsx
  • examples/basic/src/lib/migrations/001_create_sessions.sql
  • examples/basic/src/lib/placeholder-data.ts
  • examples/basic/src/lib/utils.ts
  • examples/basic/src/pages/_404.tsx
  • examples/basic/src/pages/about.tsx
  • examples/basic/src/pages/blog.tsx
  • examples/basic/src/pages/dashboard/index.tsx
  • examples/basic/src/pages/index.tsx
  • examples/basic/src/pages/login.tsx
  • examples/basic/src/pages/placeholder.tsx
  • examples/basic/src/pages/posts/[id].tsx
  • examples/basic/src/styles/globals.css
  • examples/basic/src/x-routes.ts
  • examples/basic/tsconfig.json
  • packages/cli/src/index.ts
  • packages/core/src/build.test.ts
  • packages/core/src/build.ts
  • packages/core/src/createApp.ts
  • packages/core/src/index.ts
  • packages/core/src/render.ts
  • packages/core/src/router.ts
💤 Files with no reviewable changes (1)
  • examples/basic/server.ts
🚧 Files skipped from review as they are similar to previous changes (11)
  • examples/basic/src/pages/posts/[id].tsx
  • examples/basic/src/pages/index.tsx
  • examples/basic/src/pages/about.tsx
  • examples/basic/src/pages/_404.tsx
  • packages/core/src/build.test.ts
  • examples/basic/src/pages/login.tsx
  • examples/basic/src/pages/blog.tsx
  • packages/core/src/render.ts
  • packages/core/src/build.ts
  • packages/core/src/index.ts
  • packages/core/src/createApp.ts

Comment thread examples/basic/.gitignore
.x/
data/
public/styles.css
server.ts

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

server.ts's lifecycle is inconsistent across config files. package.json's dev:direct script still runs bun --hot server.ts, but .gitignore ignores server.ts and tsconfig.json's include no longer covers it — decide whether server.ts is a maintained, tracked entry point or a disposable/generated artifact, and make these three files consistent.

  • examples/basic/.gitignore#L5: remove the server.ts ignore entry if it's meant to be a committed, maintained fallback script for dev:direct.
  • examples/basic/package.json#L6-L10: if server.ts is intentionally no longer maintained, drop the dev:direct script instead of pointing it at an ignored/untyped file.
  • examples/basic/tsconfig.json#L4-L10: add server.ts back to include if it should stay type-checked while dev:direct still depends on it.
📍 Affects 3 files
  • examples/basic/.gitignore#L5-L5 (this comment)
  • examples/basic/package.json#L6-L10
  • examples/basic/tsconfig.json#L4-L10
🤖 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 `@examples/basic/.gitignore` at line 5, Decide whether server.ts is a
maintained entry point or disposable artifact, then make all three configuration
sites consistent: examples/basic/.gitignore lines 5-5 must stop ignoring it if
maintained; examples/basic/package.json lines 6-10 must remove dev:direct if it
is not maintained; and examples/basic/tsconfig.json lines 4-10 must include
server.ts when dev:direct continues using it.

Comment thread examples/basic/src/components/Head.tsx Resolved
Comment on lines +1 to +9
CREATE TABLE IF NOT EXISTS sessions (
id TEXT PRIMARY KEY,
token TEXT NOT NULL UNIQUE,
user_id TEXT NOT NULL,
username TEXT NOT NULL,
created_at TEXT DEFAULT (datetime('now'))
);

CREATE INDEX IF NOT EXISTS idx_sessions_token ON sessions(token);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Store a token hash, not the bearer token.

Line 3 persists the raw credential that authenticates a session. A database disclosure would allow direct session hijacking. Rename this column to token_hash and hash tokens before insert and lookup in examples/basic/src/lib/auth.ts.

Proposed schema change
-  token TEXT NOT NULL UNIQUE,
+  token_hash TEXT NOT NULL UNIQUE,
🤖 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 `@examples/basic/src/lib/migrations/001_create_sessions.sql` around lines 1 -
9, Rename the sessions column from token to token_hash in the migration, then
update the session creation and lookup logic in auth.ts to hash bearer tokens
before inserting or querying. Ensure all references to the raw token column use
the hashed value while preserving the existing session authentication behavior.

Comment thread examples/basic/src/lib/utils.ts Resolved
--sidebar-primary: oklch(0.488 0.243 264.376);
--sidebar-primary-foreground: oklch(0.985 0 0);
--sidebar-accent: oklch(0.269 0 0);
--sidebar-foreground: oklch(0.985 0 0);

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 | 🟡 Minor | ⚡ Quick win

@theme inline maps tokens that :root never defines. The @theme inline block references --sidebar-accent-foreground and --destructive-foreground, but the :root block at lines 48-81 defines neither — and the apparent typo at line 78 (a second --sidebar-foreground) is what Stylelint reports as a duplicate custom property.

  • examples/basic/src/styles/globals.css#L78-L78: rename the duplicate declaration to --sidebar-accent-foreground: oklch(0.985 0 0);.
  • examples/basic/src/styles/globals.css#L22-L22: add --destructive-foreground to :root, or remove this mapping.
🧰 Tools
🪛 Stylelint (17.14.0)

[error] 78-78: Duplicate custom property "--sidebar-foreground" (declaration-block-no-duplicate-custom-properties)

(declaration-block-no-duplicate-custom-properties)

📍 Affects 1 file
  • examples/basic/src/styles/globals.css#L78-L78 (this comment)
  • examples/basic/src/styles/globals.css#L22-L22
🤖 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 `@examples/basic/src/styles/globals.css` at line 78, In the :root declarations,
rename the duplicate --sidebar-foreground property to
--sidebar-accent-foreground, and add the missing --destructive-foreground token
or remove its corresponding `@theme` inline mapping; update both affected sites in
examples/basic/src/styles/globals.css (anchor 78-78 and sibling 22-22).

Source: Linters/SAST tools

Comment thread packages/cli/src/index.ts Resolved
Comment thread packages/core/src/router.ts Resolved
- Implemented a reusable Input component for form handling.
- Created a DashboardLayout component with a sidebar for navigation and user information.
- Added MainLayout for general page structure.
- Introduced authentication logic with session management in auth.ts.
- Created SQL migration for sessions table.
- Developed middleware for session validation on dashboard routes.
- Implemented analytics and dashboard pages with user data and statistics.
- Added settings page for user profile management.
- Created pricing and login pages with respective UI components.
- Established global CSS styles for consistent theming.
- Configured routing and TypeScript settings for the application.

@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: 13

Note

Due to the large number of review comments, Critical, Major severity comments were prioritized as inline comments.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
packages/cli/src/index.ts (1)

253-261: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Unknown command should still exit non-zero.

Per the described change, the unknown-command branch now logs the error and prints help but no longer sets a non-zero exit code (only the "undefined/missing command" branch does). This means x some-typo will exit 0, silently breaking CI/scripts that check the exit status of CLI invocations.

🤖 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/cli/src/index.ts` around lines 253 - 261, Update the default branch
of the command dispatch alongside printHelp() so unknown commands set a non-zero
process.exitCode, matching the existing missing-command behavior while
preserving the error message and help output.
packages/core/src/content.ts (1)

84-90: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Fallback array split leaves per-element quotes intact.

When JSON.parse fails on a bracketed value, the fallback splits on commas but doesn't strip quotes from individual elements (only the earlier whole-value quote check at lines 81-83 does that). A value like [foo, "bar"] becomes ['foo', '"bar"'], with "bar" keeping its literal quotes.

🐛 Proposed fix
       } catch {
-        value = (value as string).slice(1, -1).split(",").map((s) => s.trim()).filter(Boolean);
+        value = (value as string)
+          .slice(1, -1)
+          .split(",")
+          .map((s) => s.trim().replace(/^["']|["']$/g, ""))
+          .filter(Boolean);
       }
🤖 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/content.ts` around lines 84 - 90, Update the
bracketed-string fallback in the value parsing logic to remove surrounding
quotes from each comma-separated element before trimming and filtering. Preserve
the existing JSON.parse path and ensure inputs such as `[foo, "bar"]` produce
unquoted element values.
♻️ Duplicate comments (2)
packages/core/src/createApp.ts (2)

219-232: 🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Named-export auto-registration still exposes arbitrary functions as RPCs.

This still registers every non-default/actions function export from an actions file directly as a callable server action, exactly as flagged in a prior review. A helper accidentally re-exported from an action file (e.g. a shared validator) becomes reachable via POST /__x/actions/....

🔒 Suggested fix
         if (actions) {
           registerServerFunctions(parentPath, actionFile.paramNames, actions);
         }
-        // Individual named exports — each function is an action under parent path
-        for (const [key, value] of Object.entries(mod)) {
-          if (key === "default" || key === "actions" || typeof value !== "function") continue;
-          registerServerFunctions(parentPath, actionFile.paramNames, {
-            [key]: value as (...args: unknown[]) => Promise<unknown>,
-          });
-        }
+        // Only explicit `export const actions = {...}` is registered; arbitrary
+        // named exports are not implicitly exposed as network-callable RPCs.
🤖 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/createApp.ts` around lines 219 - 232, Remove the individual
named-export auto-registration loop in the action-loading flow around
registerServerFunctions; only register the explicitly grouped mod.actions
export. Ensure helper or other function exports from an actions file are not
exposed as RPC endpoints.

251-259: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Custom root layout still isn't applied to the 404 page in split layoutsDir configs.

rootLayout here is looked up as layouts.find((l) => l.dirPath === pagesDir). This is the exact lookup that a prior review flagged as broken when layoutsDir !== pagesDir (marked addressed in a later commit). That fix (lines 340-346) correctly unshifts dedicatedLayouts into the layout chain for regular routes, but this notFoundLayout derivation was not updated the same way — dedicatedLayouts entries have dirPath under layoutsDir, so they never match pagesDir, and the custom root layout silently fails to wrap the generated 404 page.

🐛 Suggested fix
-    const rootLayout = layouts.find((l) => l.dirPath === pagesDir);
+    const rootLayout = layouts.find(
+      (l) => l.dirPath === pagesDir || l.dirPath === layoutsDir,
+    );
🤖 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/createApp.ts` around lines 251 - 259, Update the
notFoundLayout derivation in the createApp flow to resolve the root layout from
the dedicatedLayouts entries used when layoutsDir differs from pagesDir, rather
than matching only layouts by pagesDir. Preserve the existing default-component
import and undefined behavior when no dedicated root layout exists, while
keeping the regular route layout-chain handling unchanged.
🟡 Minor comments (10)
examples/landing/.gitignore-5-5 (1)

5-5: 🔒 Security & Privacy | 🟡 Minor | ⚡ Quick win

Ignore local environment-file variants.

.env.local, .env.development, etc. can be accidentally committed.

Proposed fix
-.env
+.env*
+!.env.example
🤖 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 `@examples/landing/.gitignore` at line 5, Update the ignore rules in the
landing example’s .gitignore to cover the .env file and all local or
environment-specific variants, including names such as .env.local and
.env.development.
examples/landing/src/pages/docs/server-functions.tsx-14-29 (1)

14-29: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Align the server-function signature documentation.

Update the prose to say that exported functions receive the arguments you pass, not a Request; the dispatcher parses the POST body and calls fn(...args), and the examples already omit a request parameter.

🤖 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 `@examples/landing/src/pages/docs/server-functions.tsx` around lines 14 - 29,
Update the explanatory paragraph under “Defining server functions” to remove the
claim that each function receives a Request object and state that functions
receive the arguments passed by the caller. Keep the existing examples and their
argument signatures unchanged.
examples/landing/src/pages/docs/api-routes.tsx-76-76 (1)

76-76: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Fix the misspelled Tailwind utility.

examples/landing/src/pages/docs/api-routes.tsx:76 uses tracking-tip, which is not a Tailwind spacing utility, so the heading loses the intended letter spacing. Use tracking-tight to match the nearby docs headings.

Proposed fix
-      <h2 className="mt-12 text-xl font-bold tracking-tip">Process sharing</h2>
+      <h2 className="mt-12 text-xl font-bold tracking-tight">Process sharing</h2>
🤖 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 `@examples/landing/src/pages/docs/api-routes.tsx` at line 76, Update the
className on the “Process sharing” h2 heading to replace the invalid
tracking-tip utility with tracking-tight, matching the intended letter-spacing
styling of nearby documentation headings.
examples/landing/src/styles/globals.css-1-1 (1)

1-1: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Use the configured @import notation.

Stylelint rejects the url(...) form here, causing this stylesheet to fail linting.

-@import url('https://fonts.googleapis.com/css2?family=Instrument+Sans:ital,wght@0,400;0,500;0,600;0,700&family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;500&display=swap');
+@import 'https://fonts.googleapis.com/css2?family=Instrument+Sans:ital,wght@0,400;0,500;0,600;0,700&family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;500&display=swap';
🤖 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 `@examples/landing/src/styles/globals.css` at line 1, Update the Google Fonts
import at the stylesheet’s top-level `@import` declaration to use the configured
import notation instead of the url(...) form, while preserving the existing font
families, weights, and display parameter.

Source: Linters/SAST tools

examples/landing/src/lib/syntax.tsx-161-164 (1)

161-164: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Emit /> once and consume both characters.

Line 162 adds a trailing space and Line 163 advances only past /, so every self-closing tag renders as /> >.

Proposed fix
-      tokens.push(<span key={key++} className="text-[`#ffa657`]">{"/> "}</span>);
-      i += 1;
+      tokens.push(<span key={key++} className="text-[`#ffa657`]">{"/>"}</span>);
+      i += 2;
🤖 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 `@examples/landing/src/lib/syntax.tsx` around lines 161 - 164, Update the
self-closing tag handling in the syntax tokenizer to emit exactly “/>” without a
trailing space and advance the index past both slash and greater-than
characters. Preserve the existing tokenization flow and continue behavior in the
surrounding parsing loop.
examples/landing/src/lib/syntax.tsx-37-39 (1)

37-39: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Fix the unreachable indented-output branch.

trimStart() has already removed leading spaces, so trimmed.startsWith(" ") can never be true. CLI output lines remain unstyled.

-    if (trimmed.startsWith("  ")) {
+    if (line.startsWith("  ")) {
🤖 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 `@examples/landing/src/lib/syntax.tsx` around lines 37 - 39, Update the
line-rendering logic in the syntax highlighting function to detect indentation
from the original line rather than the already trimStart()-processed trimmed
value. Preserve the indented-output styling and ensure lines beginning with two
spaces reach the block text span branch.
examples/landing/src/lib/syntax.tsx-50-54 (1)

50-54: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Preserve indentation for tree comments.

Using s strips leading whitespace before splitting the comment, misaligning commented entries in nested file trees.

-    const commentIdx = s.indexOf("//");
+    const commentIdx = line.indexOf("//");
     if (commentIdx !== -1) {
-      const before = s.slice(0, commentIdx);
-      const after = s.slice(commentIdx);
+      const before = line.slice(0, commentIdx);
+      const after = line.slice(commentIdx);
🤖 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 `@examples/landing/src/lib/syntax.tsx` around lines 50 - 54, Update the
comment-rendering logic in the syntax highlighting flow to detect and split `//`
from the original line content while preserving its leading indentation. Ensure
tree comments retain their existing whitespace alignment, while the comment
portion continues using the current muted styling.
examples/saas/src/pages/login.tsx-46-50 (1)

46-50: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Point “Register” at a real registration flow.

The link targets /login, so users without an account are returned to the same page. The supplied SaaS routes do not include a registration page.

🤖 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 `@examples/saas/src/pages/login.tsx` around lines 46 - 50, Update the
“Register” anchor in the login page to point to an actual registration flow
instead of `/login`; use the existing supplied SaaS route or registration
destination, and ensure users without accounts are navigated there.
examples/saas/src/pages/pricing.tsx-78-89 (1)

78-89: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Route Enterprise users to sales.

The Enterprise CTA says “Contact Sales” but routes to /login, identical to self-service tiers. Link this tier to a sales/contact flow or change the CTA text.

🤖 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 `@examples/saas/src/pages/pricing.tsx` around lines 78 - 89, Update the CTA
link in the pricing tier rendering so the Enterprise tier’s “Contact Sales”
action routes to the sales/contact flow instead of /login; preserve /login for
self-service tiers, using the tier-specific data such as tier name or CTA to
distinguish Enterprise.
examples/saas/src/pages/pricing.tsx-73-73 (1)

73-73: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Use the Tailwind v4 shrink utility.

flex-shrink-0 is a legacy class in Tailwind v4; replace it with shrink-0 so this works across generated Tailwind output.

Proposed fix
- <Check className="h-4 w-4 text-primary flex-shrink-0" />
+ <Check className="h-4 w-4 text-primary shrink-0" />
🤖 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 `@examples/saas/src/pages/pricing.tsx` at line 73, Update the Check component’s
Tailwind className in the pricing page to replace the legacy flex-shrink-0
utility with shrink-0, preserving the existing sizing and text styling.
🧹 Nitpick comments (3)
examples/saas/src/lib/auth.ts (1)

66-68: 🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick win

Session cookie is missing Secure.

setSessionCookie omits the Secure attribute, so the session cookie can be sent over plain HTTP once deployed, weakening session confidentiality.

🔒 Suggested fix
 export function setSessionCookie(token: string): string {
-  return `${SESSION_COOKIE}=${token}; HttpOnly; SameSite=Lax; Path=/; Max-Age=${SESSION_MAX_AGE}`;
+  return `${SESSION_COOKIE}=${token}; HttpOnly; Secure; SameSite=Lax; Path=/; Max-Age=${SESSION_MAX_AGE}`;
 }
🤖 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 `@examples/saas/src/lib/auth.ts` around lines 66 - 68, Update setSessionCookie
to include the Secure attribute in the returned session cookie string, while
preserving the existing HttpOnly, SameSite, Path, and Max-Age attributes.
examples/saas/src/pages/dashboard/index.tsx (1)

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

Duplicated session-loading logic across three dashboard pages. index.tsx, analytics.tsx, and settings.tsx each define an identical loader() that dynamically imports lib/auth, parses the session cookie, and falls back to "User". Extract a single shared helper (e.g. getLoaderUsername(request) in examples/saas/src/lib/auth.ts) and call it from each loader.

  • examples/saas/src/pages/dashboard/index.tsx#L4-L9: replace the inline loader body with a call to the shared helper.
  • examples/saas/src/pages/dashboard/analytics.tsx#L4-L9: replace the inline loader body with a call to the shared helper.
  • examples/saas/src/pages/dashboard/settings.tsx#L4-L9: replace the inline loader body with a call to the shared helper.
🤖 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 `@examples/saas/src/pages/dashboard/index.tsx` around lines 4 - 9, Extract the
duplicated session username logic into a shared getLoaderUsername(request)
helper in examples/saas/src/lib/auth.ts, preserving the existing cookie parsing,
session lookup, and "User" fallback. Update the loaders in
examples/saas/src/pages/dashboard/index.tsx (lines 4-9),
examples/saas/src/pages/dashboard/analytics.tsx (lines 4-9), and
examples/saas/src/pages/dashboard/settings.tsx (lines 4-9) to call the helper
and return its username result.
packages/core/src/createApp.ts (1)

601-629: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

Production dispatch now does O(n) linear route matching per request.

The prior routeMap exact-match optimization was removed in favor of iterating all handlers on every request (mirroring dev). The accompanying comment explains this unifies behavior with dev (fixing middleware/layout/static-asset consistency), which is a reasonable correctness tradeoff, but it does reintroduce a linear scan on the production hot path for every request. For apps with many routes this adds unnecessary overhead compared to an exact-match lookup for static (non-dynamic) routes.

Consider maintaining a Map<string, RouteHandler> for routes without dynamic segments, checked first, falling back to iteration only over the remaining dynamic-segment handlers.

🤖 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/createApp.ts` around lines 601 - 629, Optimize production
dispatch in prodFetch by maintaining a Map keyed by exact route paths for
handlers without dynamic segments, checking that map before scanning dynamic
handlers. Keep dynamic matching through the existing extractParams flow and
preserve the current ordering and behavior for revalidation, server functions,
static assets, content handlers, and 404 responses.
🤖 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 `@examples/blog/src/pages/blog/`[slug].tsx:
- Around line 50-52: Sanitize the HTML produced by renderMarkdown before
assigning it to dangerouslySetInnerHTML in the blog post rendering component.
Add the project’s established rehype-sanitize integration or a restrictive fixed
allowlist, ensuring raw HTML injection is disabled while preserving the intended
Markdown formatting.

In `@examples/blog/src/pages/blog/index.tsx`:
- Around line 17-27: Update the `routePath` mapping in the `loader` function so
each content entry uses the `/blog/<slug>` route expected by the detail page,
rather than the root-level path returned by `scanContent`. Preserve the existing
title, description, date, and tags mappings.

In `@examples/blog/src/pages/index.tsx`:
- Around line 40-48: Wire the email input and Subscribe button into an actual
submission flow by adding a form submission handler or action that processes the
entered email and prevents the default submission behavior as appropriate.
Ensure the controls provide submission feedback and validation, or
remove/disable the CTA if no subscription backend is available.

In `@examples/landing/src/pages/contact.tsx`:
- Around line 32-54: The contact form in the page containing the “Send message”
button currently posts to an unhandled route. Add validated POST handling for
the submitted name, email, subject, and message fields via a server action or
API endpoint, then connect the form to it and render a user-visible success or
error state based on the result.

In `@examples/landing/src/pages/docs/middleware.tsx`:
- Around line 77-89: Validate redirectTo in the middleware example before using
it in the final redirect response. Only allow local path targets (not absolute
URLs or external origins), and fall back to "/" for invalid or missing values
while preserving valid local redirects.

In `@examples/saas/.gitignore`:
- Line 4: Add a gitignore pattern covering SQLite shared-memory sidecar files
such as dev.db-shm alongside the existing *.db rule, and remove the tracked
examples/saas/data/dev.db-shm artifact from the change.

In `@examples/saas/data/dev.db-shm`:
- Line 1: Remove the committed SQLite shared-memory artifact and update the
repository ignore rules to exclude data/*.db, data/*.db-shm, and data/*.db-wal;
verify the runtime database files used by auth.ts remain untracked, and purge
this artifact from history if it contains real session tokens.

In `@examples/saas/src/lib/auth.ts`:
- Around line 15-20: Update getDb to cache and reuse a single SQLite connection,
running runSQLiteMigrations only when that connection is first initialized.
Ensure createSession, getSession, and deleteSession continue using the shared
handle without reconnecting or re-running migrations on each call, and preserve
existing database path behavior.

In `@examples/saas/src/pages/login.tsx`:
- Around line 16-45: The login form in the page component needs to submit
credentials through the existing authentication flow. Update the form to use the
actual login action or endpoint with method="post", and add stable name
attributes to the email and password inputs so both values are submitted.

In `@examples/saas/src/styles/globals.css`:
- Around line 73-80: In the sidebar color variable declarations, remove the
duplicate --sidebar-foreground entry and declare --sidebar-accent-foreground
with the intended accent foreground value so the `@theme` inline mapping resolves
correctly and the duplicate declaration is eliminated.

In `@packages/cli/src/index.ts`:
- Around line 126-138: Wrap the Tailwind watcher setup in the dev startup flow
around the watch call in a try/catch, using the existing cmdDev context and
fallback-warning behavior from createApp.ts. If recursive watch initialization
throws, log a warning and continue startup without CSS hot-recompilation;
preserve the existing debounce and recompilation callback when watch succeeds.

In `@packages/core/src/createApp.ts`:
- Around line 526-543: Replace the hardcoded srcDir derivation in the
file-watching setup with a path derived from the configured directories or an
existing project-root convention that supports custom pagesDir/routesDir
layouts. Before watching, retain only directories that exist, and isolate each
watch(dir, ...) call so a missing or invalid directory is skipped without
aborting watching for the remaining directories; preserve the existing filename
filters and rebuild scheduling.

In `@scripts/convert-code-blocks.mjs`:
- Around line 331-363: Update the replacement loop in the fileReplacements
processing block to use idx and match the complete normalized oldStr against
content with whitespace alignment, rather than selecting the first matching
opening line. Require exactly one match for each replacement, replace the full
original block using its actual span, and throw on missing or ambiguous matches
before writeFileSync is called.

---

Outside diff comments:
In `@packages/cli/src/index.ts`:
- Around line 253-261: Update the default branch of the command dispatch
alongside printHelp() so unknown commands set a non-zero process.exitCode,
matching the existing missing-command behavior while preserving the error
message and help output.

In `@packages/core/src/content.ts`:
- Around line 84-90: Update the bracketed-string fallback in the value parsing
logic to remove surrounding quotes from each comma-separated element before
trimming and filtering. Preserve the existing JSON.parse path and ensure inputs
such as `[foo, "bar"]` produce unquoted element values.

---

Minor comments:
In `@examples/landing/.gitignore`:
- Line 5: Update the ignore rules in the landing example’s .gitignore to cover
the .env file and all local or environment-specific variants, including names
such as .env.local and .env.development.

In `@examples/landing/src/lib/syntax.tsx`:
- Around line 161-164: Update the self-closing tag handling in the syntax
tokenizer to emit exactly “/>” without a trailing space and advance the index
past both slash and greater-than characters. Preserve the existing tokenization
flow and continue behavior in the surrounding parsing loop.
- Around line 37-39: Update the line-rendering logic in the syntax highlighting
function to detect indentation from the original line rather than the already
trimStart()-processed trimmed value. Preserve the indented-output styling and
ensure lines beginning with two spaces reach the block text span branch.
- Around line 50-54: Update the comment-rendering logic in the syntax
highlighting flow to detect and split `//` from the original line content while
preserving its leading indentation. Ensure tree comments retain their existing
whitespace alignment, while the comment portion continues using the current
muted styling.

In `@examples/landing/src/pages/docs/api-routes.tsx`:
- Line 76: Update the className on the “Process sharing” h2 heading to replace
the invalid tracking-tip utility with tracking-tight, matching the intended
letter-spacing styling of nearby documentation headings.

In `@examples/landing/src/pages/docs/server-functions.tsx`:
- Around line 14-29: Update the explanatory paragraph under “Defining server
functions” to remove the claim that each function receives a Request object and
state that functions receive the arguments passed by the caller. Keep the
existing examples and their argument signatures unchanged.

In `@examples/landing/src/styles/globals.css`:
- Line 1: Update the Google Fonts import at the stylesheet’s top-level `@import`
declaration to use the configured import notation instead of the url(...) form,
while preserving the existing font families, weights, and display parameter.

In `@examples/saas/src/pages/login.tsx`:
- Around line 46-50: Update the “Register” anchor in the login page to point to
an actual registration flow instead of `/login`; use the existing supplied SaaS
route or registration destination, and ensure users without accounts are
navigated there.

In `@examples/saas/src/pages/pricing.tsx`:
- Around line 78-89: Update the CTA link in the pricing tier rendering so the
Enterprise tier’s “Contact Sales” action routes to the sales/contact flow
instead of /login; preserve /login for self-service tiers, using the
tier-specific data such as tier name or CTA to distinguish Enterprise.
- Line 73: Update the Check component’s Tailwind className in the pricing page
to replace the legacy flex-shrink-0 utility with shrink-0, preserving the
existing sizing and text styling.

---

Duplicate comments:
In `@packages/core/src/createApp.ts`:
- Around line 219-232: Remove the individual named-export auto-registration loop
in the action-loading flow around registerServerFunctions; only register the
explicitly grouped mod.actions export. Ensure helper or other function exports
from an actions file are not exposed as RPC endpoints.
- Around line 251-259: Update the notFoundLayout derivation in the createApp
flow to resolve the root layout from the dedicatedLayouts entries used when
layoutsDir differs from pagesDir, rather than matching only layouts by pagesDir.
Preserve the existing default-component import and undefined behavior when no
dedicated root layout exists, while keeping the regular route layout-chain
handling unchanged.

---

Nitpick comments:
In `@examples/saas/src/lib/auth.ts`:
- Around line 66-68: Update setSessionCookie to include the Secure attribute in
the returned session cookie string, while preserving the existing HttpOnly,
SameSite, Path, and Max-Age attributes.

In `@examples/saas/src/pages/dashboard/index.tsx`:
- Around line 4-9: Extract the duplicated session username logic into a shared
getLoaderUsername(request) helper in examples/saas/src/lib/auth.ts, preserving
the existing cookie parsing, session lookup, and "User" fallback. Update the
loaders in examples/saas/src/pages/dashboard/index.tsx (lines 4-9),
examples/saas/src/pages/dashboard/analytics.tsx (lines 4-9), and
examples/saas/src/pages/dashboard/settings.tsx (lines 4-9) to call the helper
and return its username result.

In `@packages/core/src/createApp.ts`:
- Around line 601-629: Optimize production dispatch in prodFetch by maintaining
a Map keyed by exact route paths for handlers without dynamic segments, checking
that map before scanning dynamic handlers. Keep dynamic matching through the
existing extractParams flow and preserve the current ordering and behavior for
revalidation, server functions, static assets, content handlers, and 404
responses.
🪄 Autofix (Beta)

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: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: fd246fd8-c4ed-4c2f-a61e-1fe9624857ab

📥 Commits

Reviewing files that changed from the base of the PR and between bf029e1 and 3eb217b.

⛔ Files ignored due to path filters (5)
  • bun.lock is excluded by !**/*.lock
  • examples/basic/public/favicon.ico is excluded by !**/*.ico
  • examples/blog/public/favicon.ico is excluded by !**/*.ico
  • examples/landing/public/favicon.ico is excluded by !**/*.ico
  • examples/saas/public/favicon.ico is excluded by !**/*.ico
📒 Files selected for processing (89)
  • examples/blog/.gitignore
  • examples/blog/components.json
  • examples/blog/content/posts/getting-started.md
  • examples/blog/content/posts/hello-world.md
  • examples/blog/content/posts/tailwind-v4.md
  • examples/blog/package.json
  • examples/blog/src/components/ui/avatar.tsx
  • examples/blog/src/components/ui/badge.tsx
  • examples/blog/src/components/ui/button.tsx
  • examples/blog/src/components/ui/card.tsx
  • examples/blog/src/components/ui/input.tsx
  • examples/blog/src/layouts/blog.tsx
  • examples/blog/src/layouts/main.tsx
  • examples/blog/src/lib/utils.ts
  • examples/blog/src/pages/about.tsx
  • examples/blog/src/pages/blog/[slug].tsx
  • examples/blog/src/pages/blog/index.tsx
  • examples/blog/src/pages/index.tsx
  • examples/blog/src/styles/globals.css
  • examples/blog/src/x-routes.ts
  • examples/blog/tsconfig.json
  • examples/blog/x.config.ts
  • examples/landing/.gitignore
  • examples/landing/components.json
  • examples/landing/package.json
  • examples/landing/src/components/code-block.tsx
  • examples/landing/src/components/ui/avatar.tsx
  • examples/landing/src/components/ui/badge.tsx
  • examples/landing/src/components/ui/button.tsx
  • examples/landing/src/components/ui/card.tsx
  • examples/landing/src/components/ui/input.tsx
  • examples/landing/src/layouts/main.tsx
  • examples/landing/src/lib/syntax.tsx
  • examples/landing/src/lib/utils.ts
  • examples/landing/src/pages/contact.tsx
  • examples/landing/src/pages/docs/_layout.tsx
  • examples/landing/src/pages/docs/api-routes.tsx
  • examples/landing/src/pages/docs/build-deploy.tsx
  • examples/landing/src/pages/docs/configuration.tsx
  • examples/landing/src/pages/docs/content-collections.tsx
  • examples/landing/src/pages/docs/data-layer.tsx
  • examples/landing/src/pages/docs/getting-started.tsx
  • examples/landing/src/pages/docs/index.tsx
  • examples/landing/src/pages/docs/layouts.tsx
  • examples/landing/src/pages/docs/middleware.tsx
  • examples/landing/src/pages/docs/pages.tsx
  • examples/landing/src/pages/docs/routing.tsx
  • examples/landing/src/pages/docs/server-functions.tsx
  • examples/landing/src/pages/features.tsx
  • examples/landing/src/pages/index.tsx
  • examples/landing/src/styles/globals.css
  • examples/landing/src/x-routes.ts
  • examples/landing/tsconfig.json
  • examples/landing/x.config.ts
  • examples/saas/.gitignore
  • examples/saas/components.json
  • examples/saas/data/dev.db-shm
  • examples/saas/data/dev.db-wal
  • examples/saas/package.json
  • examples/saas/src/actions/dashboard.ts
  • examples/saas/src/components/ui/avatar.tsx
  • examples/saas/src/components/ui/badge.tsx
  • examples/saas/src/components/ui/button.tsx
  • examples/saas/src/components/ui/card.tsx
  • examples/saas/src/components/ui/input.tsx
  • examples/saas/src/layouts/dashboard.tsx
  • examples/saas/src/layouts/main.tsx
  • examples/saas/src/lib/auth.ts
  • examples/saas/src/lib/migrations/001_create_sessions.sql
  • examples/saas/src/lib/utils.ts
  • examples/saas/src/pages/dashboard/_middleware.ts
  • examples/saas/src/pages/dashboard/analytics.tsx
  • examples/saas/src/pages/dashboard/index.tsx
  • examples/saas/src/pages/dashboard/settings.tsx
  • examples/saas/src/pages/index.tsx
  • examples/saas/src/pages/login.tsx
  • examples/saas/src/pages/pricing.tsx
  • examples/saas/src/styles/globals.css
  • examples/saas/src/x-routes.ts
  • examples/saas/tsconfig.json
  • examples/saas/x.config.ts
  • packages/cli/src/index.ts
  • packages/core/src/build.test.ts
  • packages/core/src/build.ts
  • packages/core/src/content.ts
  • packages/core/src/createApp.ts
  • packages/core/src/live-reload.ts
  • packages/core/src/render.ts
  • scripts/convert-code-blocks.mjs
💤 Files with no reviewable changes (2)
  • packages/core/src/build.test.ts
  • packages/core/src/build.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/core/src/render.ts

Comment on lines +50 to +52
<div
className="prose prose-invert mt-8 max-w-none prose-headings:scroll-m-20 prose-headings:font-semibold prose-headings:tracking-tight prose-h1:text-3xl prose-h2:text-2xl prose-h3:text-xl prose-a:text-primary prose-a:no-underline hover:prose-a:underline prose-code:rounded prose-code:bg-muted prose-code:px-1.5 prose-code:py-0.5 prose-code:text-sm prose-pre:rounded-xl prose-pre:border prose-pre:border-border prose-pre:bg-card prose-img:rounded-xl"
dangerouslySetInnerHTML={{ __html: html }}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔒 Security & Privacy | 🔴 Critical | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Inspect the implementation and callers of the Markdown renderer.
ast-grep outline packages/core/src/content.ts --items all
rg -n -C5 'renderMarkdown|sanitize|DOMPurify|rehype-sanitize|html' packages/core/src/content.ts

Repository: abdelkabirouadoukou/x

Length of output: 1960


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "## content.ts renderMarkdown"
sed -n '96,135p' packages/core/src/content.ts

echo
echo "## imports/patterns in blog slug page"
sed -n '1,90p' 'examples/blog/src/pages/blog/[slug].tsx'

echo
echo "## content rendering usages"
rg -n "renderMarkdown\\(" .

Repository: abdelkabirouadoukou/x

Length of output: 4531


Sanitize Markdown before rendering raw HTML.

renderMarkdown converts content to formatted markup and still allows raw HTML blocks while escaping inline code; that output is then passed through dangerouslySetInnerHTML. Disable/support raw HTML injection only after sanitization, for example with rehype-sanitize or a fixed allowlist before this sink.

🧰 Tools
🪛 ast-grep (0.44.1)

[warning] 51-51: Usage of dangerouslySetInnerHTML detected. This bypasses React's built-in XSS protection. Always sanitize HTML content using libraries like DOMPurify before injecting it into the DOM to prevent XSS attacks.
Context: dangerouslySetInnerHTML
Note: [CWE-79] Improper Neutralization of Input During Web Page Generation

(react-unsafe-html-injection)

🤖 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 `@examples/blog/src/pages/blog/`[slug].tsx around lines 50 - 52, Sanitize the
HTML produced by renderMarkdown before assigning it to dangerouslySetInnerHTML
in the blog post rendering component. Add the project’s established
rehype-sanitize integration or a restrictive fixed allowlist, ensuring raw HTML
injection is disabled while preserving the intended Markdown formatting.

Source: Linters/SAST tools

Comment on lines +17 to +27
export async function loader(_args: LoaderArgs) {
const contentDir = join(import.meta.dir, "..", "..", "..", "content");
const entries = scanContent(contentDir);
return {
entries: entries.map((e) => ({
routePath: e.routePath,
title: e.frontmatter.title ?? e.slug,
description: (e.frontmatter.description as string) ?? "",
date: (e.frontmatter.date as string) ?? "",
tags: Array.isArray(e.frontmatter.tags) ? e.frontmatter.tags as string[] : [],
})),

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:

#!/bin/bash
# Inspect how content route paths are derived and compare them with blog routes.
ast-grep outline packages/core/src/content.ts --items all
rg -n -C4 'routePath|slug' packages/core/src/content.ts
rg -n -C3 'routePath|href=' examples/blog/src/pages/blog

Repository: abdelkabirouadoukou/x

Length of output: 3201


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Read the relevant content helper and blog page section.
sed -n '1,80p' packages/core/src/content.ts
printf '\n--- blog page ---\n'
sed -n '1,75p' examples/blog/src/pages/blog/index.tsx

# Behavioral probe: infer routePath produced by scanContent's relative-directory mapping
# against the files under examples/blog/content/posts, without executing repository code.
python3 - <<'PY'
from pathlib import PurePath
import os

# Approximate the filesystem-relative mapping from scanContent content.ts:
# rel = relative(rootDir, full).replace(CONTENT_FILE, "")
# slug = name.replace(CONTENT_FILE, "")
# routePath = toContentRoutePath(rel)
content_dir = PurePath("examples/blog/content")
posts_dir = content_dir / "posts"
# Include representative existing/content-like files if present.
for path in sorted(posts_dir.rglob("*")):
    if not path.suffix.lower() in {".md", ".mdx"}:
        continue
    name = path.name
    slug = PurePath(name).with_suffix("").name
    rel = path.relative_to(content_dir).with_suffix("").as_posix()
    # Show path shapes around the /posts segment that would be passed to toContentRoutePath.
    print(f"file={path} slug={slug} path_to_toContentRoutePath_arg=/posts/{rel}")
PY

Repository: abdelkabirouadoukou/x

Length of output: 5002


🏁 Script executed:

#!/bin/bash
set -euo pipefail

python3 - <<'PY'
from pathlib import Path

content_dir = Path("examples/blog/content/posts")
print("content/posts directory exists:", content_dir.is_dir(), "entries:", list(content_dir.iterdir())[:10] if content_dir.is_dir() else None)

# Compute the exact routePath value for each content file using the helper's mapping.
for path in sorted(content_dir.rglob("*")) if content_dir.is_dir() else []:
    if not path.suffix.lower() in {".md", ".mdx"}:
        continue
    rel = path.relative_to(content_dir).with_suffix("").as_posix()
    # Node Path.sep is "/" on Windows and POSIX; Path.posix.sep is always "/".
    seg = "/".join(s for s in rel.split("/") if s != "index")
    route_path = "/" + seg if seg else "/"
    print(f"file={path.parent / path.name} rel={rel} routePath={route_path}")
PY

# Route path contract check: report whether every generated path under content/posts
# starts with /blog, which is required for this page's href.
python3 - <<'PY'
from pathlib import Path
import json, sys

root = Path("examples/blog/content/posts")
mismatches = []
paths = []
if root.is_dir():
    for path in sorted(root.rglob("*")):
        if path.suffix.lower() not in {".md", ".mdx"}:
            continue
        rel = path.relative_to(root).with_suffix("").as_posix()
        segment = "/".join(s for s in rel.split("/") if s != "index")
        route_path = "/" + segment if segment else "/"
        paths.append({"file": str(path), "rel": rel, "route_path": route_path, "is_blog": route_path.startswith("/blog/")})
        if not route_path.startswith("/blog/"):
            mismatches.append({"file": str(path), "rel": rel, "route_path": route_path})

print(json.dumps({"total": len(paths), "all_blog": all(p["is_blog"] for p in paths), "route_paths": [p["route_path"] for p in paths], "mismatches": mismatches}, indent=2))
PY

# Also inspect the available blog route files/routes to determine what detail links are valid.
fd -a '.*' examples/blog/src/pages 2>/dev/null || find examples/blog/src/pages -maxdepth 5 -type f 2>/dev/null

Repository: abdelkabirouadoukou/x

Length of output: 1493


Correct the content route paths to /blog/<slug>.

scanContent("examples/blog/content") turns posts under content/posts/*.md into /getting-started, /hello-world, and /tailwind-v4, but the detail route is /blog/[slug]. The post cards therefore link away from the blog detail page instead of to it.

🤖 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 `@examples/blog/src/pages/blog/index.tsx` around lines 17 - 27, Update the
`routePath` mapping in the `loader` function so each content entry uses the
`/blog/<slug>` route expected by the detail page, rather than the root-level
path returned by `scanContent`. Preserve the existing title, description, date,
and tags mappings.

Comment on lines +40 to +48
<div className="mx-auto mt-6 flex max-w-md gap-3">
<input
type="email"
placeholder="Enter your email"
className="flex-1 rounded-lg border border-input bg-background px-4 py-2.5 text-sm text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring"
/>
<button className="rounded-lg bg-primary px-6 py-2.5 text-sm font-medium text-primary-foreground transition-colors hover:bg-primary/90">
Subscribe
</button>

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 | 🏗️ Heavy lift

Wire the Subscribe CTA to an actual submission flow.

These controls have neither a form action nor a handler, so clicking Subscribe cannot subscribe the visitor. Implement the submission flow or remove/disable this CTA until it exists.

🤖 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 `@examples/blog/src/pages/index.tsx` around lines 40 - 48, Wire the email input
and Subscribe button into an actual submission flow by adding a form submission
handler or action that processes the entered email and prevents the default
submission behavior as appropriate. Ensure the controls provide submission
feedback and validation, or remove/disable the CTA if no subscription backend is
available.

Comment on lines +32 to +54
<form className="space-y-5 sm:col-span-3" method="POST" action="/contact">
<div className="grid gap-5 sm:grid-cols-2">
<div>
<label htmlFor="name" className="block text-sm font-medium mb-2">Name</label>
<input id="name" name="name" required className="w-full rounded-xl border border-input bg-card px-4 py-2.5 text-sm text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring" placeholder="Your name" />
</div>
<div>
<label htmlFor="email" className="block text-sm font-medium mb-2">Email</label>
<input id="email" name="email" type="email" required className="w-full rounded-xl border border-input bg-card px-4 py-2.5 text-sm text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring" placeholder="you@example.com" />
</div>
</div>
<div>
<label htmlFor="subject" className="block text-sm font-medium mb-2">Subject</label>
<input id="subject" name="subject" required className="w-full rounded-xl border border-input bg-card px-4 py-2.5 text-sm text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring" placeholder="How can we help?" />
</div>
<div>
<label htmlFor="message" className="block text-sm font-medium mb-2">Message</label>
<textarea id="message" name="message" rows={5} required className="w-full resize-none rounded-xl border border-input bg-card px-4 py-2.5 text-sm text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring" placeholder="Tell us more..." />
</div>
<button type="submit" className="inline-flex h-11 items-center gap-2 rounded-xl bg-primary px-6 text-sm font-semibold text-primary-foreground shadow-lg shadow-primary/25 transition-all hover:bg-primary/90">
Send message <Send className="h-4 w-4" />
</button>
</form>

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 | 🏗️ Heavy lift

Implement the contact form’s POST handling.

This page has no action/endpoint that consumes the submitted fields; the /contact route is only a page route, so “Send message” currently just posts and discards the message. Add a validated server action or API endpoint and return a user-visible success/error state.

🤖 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 `@examples/landing/src/pages/contact.tsx` around lines 32 - 54, The contact
form in the page containing the “Send message” button currently posts to an
unhandled route. Add validated POST handling for the submitted name, email,
subject, and message fields via a server action or API endpoint, then connect
the form to it and render a user-visible success or error state based on the
result.

Comment on lines +16 to +45
<form className="space-y-5">
<div>
<label htmlFor="email" className="block text-sm font-medium text-card-foreground mb-1.5">
Email
</label>
<input
id="email"
type="email"
placeholder="you@example.com"
className="w-full rounded-xl border border-input bg-background px-4 py-2.5 text-sm text-foreground placeholder:text-muted-foreground focus:border-ring focus:outline-none focus:ring-2 focus:ring-ring/20"
/>
</div>
<div>
<label htmlFor="password" className="block text-sm font-medium text-card-foreground mb-1.5">
Password
</label>
<input
id="password"
type="password"
placeholder="••••••••"
className="w-full rounded-xl border border-input bg-background px-4 py-2.5 text-sm text-foreground placeholder:text-muted-foreground focus:border-ring focus:outline-none focus:ring-2 focus:ring-ring/20"
/>
</div>
<button
type="submit"
className="w-full rounded-xl bg-primary px-4 py-2.5 text-sm font-semibold text-primary-foreground shadow-lg shadow-primary/20 transition-all hover:bg-primary/90 hover:shadow-xl hover:shadow-primary/25"
>
Sign in
</button>
</form>

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 | 🏗️ Heavy lift

Wire the login form to authentication.

This form has no submission handler/action, and its fields have no names. Clicking “Sign in” only performs the browser’s default submission to the current page; no credentials reach the authentication layer.

Bind it to the actual login action or endpoint, use method="post", and provide named fields.

🤖 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 `@examples/saas/src/pages/login.tsx` around lines 16 - 45, The login form in
the page component needs to submit credentials through the existing
authentication flow. Update the form to use the actual login action or endpoint
with method="post", and add stable name attributes to the email and password
inputs so both values are submitted.

Comment on lines +73 to +80
--sidebar: oklch(0.205 0 0);
--sidebar-foreground: oklch(0.985 0 0);
--sidebar-primary: oklch(0.488 0.243 264.376);
--sidebar-primary-foreground: oklch(0.985 0 0);
--sidebar-accent: oklch(0.269 0 0);
--sidebar-foreground: oklch(0.985 0 0);
--sidebar-border: oklch(1 0 0 / 10%);
--sidebar-ring: oklch(0.556 0 0);

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

Missing --sidebar-accent-foreground; --sidebar-foreground is duplicated instead.

The @theme inline block maps --color-sidebar-accent-foreground to var(--sidebar-accent-foreground), but that variable is never declared in :root. Line 78 instead redefines --sidebar-foreground a second time (Stylelint flags this duplicate declaration). Any element using text-sidebar-accent-foreground will resolve to an unset value.

🐛 Suggested fix
   --sidebar-accent: oklch(0.269 0 0);
-  --sidebar-foreground: oklch(0.985 0 0);
+  --sidebar-accent-foreground: oklch(0.985 0 0);
   --sidebar-border: oklch(1 0 0 / 10%);
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
--sidebar: oklch(0.205 0 0);
--sidebar-foreground: oklch(0.985 0 0);
--sidebar-primary: oklch(0.488 0.243 264.376);
--sidebar-primary-foreground: oklch(0.985 0 0);
--sidebar-accent: oklch(0.269 0 0);
--sidebar-foreground: oklch(0.985 0 0);
--sidebar-border: oklch(1 0 0 / 10%);
--sidebar-ring: oklch(0.556 0 0);
--sidebar: oklch(0.205 0 0);
--sidebar-foreground: oklch(0.985 0 0);
--sidebar-primary: oklch(0.488 0.243 264.376);
--sidebar-primary-foreground: oklch(0.985 0 0);
--sidebar-accent: oklch(0.269 0 0);
--sidebar-accent-foreground: oklch(0.985 0 0);
--sidebar-border: oklch(1 0 0 / 10%);
--sidebar-ring: oklch(0.556 0 0);
🧰 Tools
🪛 Stylelint (17.14.0)

[error] 78-78: Duplicate custom property "--sidebar-foreground" (declaration-block-no-duplicate-custom-properties)

(declaration-block-no-duplicate-custom-properties)

🤖 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 `@examples/saas/src/styles/globals.css` around lines 73 - 80, In the sidebar
color variable declarations, remove the duplicate --sidebar-foreground entry and
declare --sidebar-accent-foreground with the intended accent foreground value so
the `@theme` inline mapping resolves correctly and the duplicate declaration is
eliminated.

Source: Linters/SAST tools

Comment thread packages/cli/src/index.ts
Comment on lines +126 to +138
// Watch for CSS changes and recompile Tailwind
const twSrc = join(projectDir, "src/styles");
if (existsSync(twSrc)) {
const { watch } = await import("node:fs");
let twTimeout: ReturnType<typeof setTimeout> | null = null;
watch(twSrc, { recursive: true }, () => {
if (twTimeout) clearTimeout(twTimeout);
twTimeout = setTimeout(() => {
console.log("[x] recompiling Tailwind CSS...");
spawnSync("bunx", ["tailwindcss", "-i", twInput, "-o", twOutput], { cwd: projectDir });
}, 200);
});
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Unguarded watch() call can crash x dev.

Unlike the multi-directory watcher in createApp.ts (wrapped in try/catch with a fallback warning), this Tailwind CSS watcher calls watch(twSrc, { recursive: true }, ...) directly. Recursive fs.watch support is platform-dependent; if it throws (e.g., unsupported platform), the exception is unhandled and will crash the entire cmdDev startup instead of just disabling CSS hot-recompilation.

🔧 Proposed fix
   const twSrc = join(projectDir, "src/styles");
   if (existsSync(twSrc)) {
-    const { watch } = await import("node:fs");
-    let twTimeout: ReturnType<typeof setTimeout> | null = null;
-    watch(twSrc, { recursive: true }, () => {
-      if (twTimeout) clearTimeout(twTimeout);
-      twTimeout = setTimeout(() => {
-        console.log("[x] recompiling Tailwind CSS...");
-        spawnSync("bunx", ["tailwindcss", "-i", twInput, "-o", twOutput], { cwd: projectDir });
-      }, 200);
-    });
+    try {
+      const { watch } = await import("node:fs");
+      let twTimeout: ReturnType<typeof setTimeout> | null = null;
+      watch(twSrc, { recursive: true }, () => {
+        if (twTimeout) clearTimeout(twTimeout);
+        twTimeout = setTimeout(() => {
+          console.log("[x] recompiling Tailwind CSS...");
+          spawnSync("bunx", ["tailwindcss", "-i", twInput, "-o", twOutput], { cwd: projectDir });
+        }, 200);
+      });
+    } catch {
+      console.warn("[x] Tailwind file watching not available on this platform");
+    }
   }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// Watch for CSS changes and recompile Tailwind
const twSrc = join(projectDir, "src/styles");
if (existsSync(twSrc)) {
const { watch } = await import("node:fs");
let twTimeout: ReturnType<typeof setTimeout> | null = null;
watch(twSrc, { recursive: true }, () => {
if (twTimeout) clearTimeout(twTimeout);
twTimeout = setTimeout(() => {
console.log("[x] recompiling Tailwind CSS...");
spawnSync("bunx", ["tailwindcss", "-i", twInput, "-o", twOutput], { cwd: projectDir });
}, 200);
});
}
// Watch for CSS changes and recompile Tailwind
const twSrc = join(projectDir, "src/styles");
if (existsSync(twSrc)) {
try {
const { watch } = await import("node:fs");
let twTimeout: ReturnType<typeof setTimeout> | null = null;
watch(twSrc, { recursive: true }, () => {
if (twTimeout) clearTimeout(twTimeout);
twTimeout = setTimeout(() => {
console.log("[x] recompiling Tailwind CSS...");
spawnSync("bunx", ["tailwindcss", "-i", twInput, "-o", twOutput], { cwd: projectDir });
}, 200);
});
} catch {
console.warn("[x] Tailwind file watching not available on this platform");
}
}
🤖 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/cli/src/index.ts` around lines 126 - 138, Wrap the Tailwind watcher
setup in the dev startup flow around the watch call in a try/catch, using the
existing cmdDev context and fallback-warning behavior from createApp.ts. If
recursive watch initialization throws, log a warning and continue startup
without CSS hot-recompilation; preserve the existing debounce and recompilation
callback when watch succeeds.

Comment on lines +526 to +543
const srcDir = join(primaryDir, "..", "..", "src");
const watchDirs = [...new Set([
primaryDir,
options.apiDir,
options.layoutsDir,
options.actionsDir,
srcDir,
].filter(Boolean))] as string[];
for (const dir of watchDirs) {
watch(dir, { recursive: true }, (_eventType: unknown, filename: unknown) => {
if (!filename) return;
const name = typeof filename === "string" ? filename : (filename as Buffer).toString();
if (name.startsWith(".") || name.startsWith("_")) return;
if (name === "x-routes.ts") return;
if (!/\.(tsx|ts|css)$/.test(name)) return;
scheduleRebuild();
});
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Fragile srcDir computation and shared failure mode across all watched directories.

Two related problems:

  1. srcDir = join(primaryDir, "..", "..", "src") hardcodes a <root>/src/<pagesBasename> convention. For custom pagesDir/routesDir configs that don't follow this layout (e.g. legacy routesDir at the project root), this resolves to a nonexistent or unrelated path.
  2. None of apiDir/layoutsDir/actionsDir/srcDir are checked with existsSync before calling watch(), and each watch() call isn't individually wrapped. If any single directory in watchDirs doesn't exist, watch() throws, aborting the for loop and disabling watching for every directory (caught by the outer try/catch with a misleading "file watching not available on this platform" message) — not just the missing one.
🔧 Suggested fix
-      const srcDir = join(primaryDir, "..", "..", "src");
-      const watchDirs = [...new Set([
-        primaryDir,
-        options.apiDir,
-        options.layoutsDir,
-        options.actionsDir,
-        srcDir,
-      ].filter(Boolean))] as string[];
-      for (const dir of watchDirs) {
-        watch(dir, { recursive: true }, (_eventType: unknown, filename: unknown) => {
-          if (!filename) return;
-          const name = typeof filename === "string" ? filename : (filename as Buffer).toString();
-          if (name.startsWith(".") || name.startsWith("_")) return;
-          if (name === "x-routes.ts") return;
-          if (!/\.(tsx|ts|css)$/.test(name)) return;
-          scheduleRebuild();
-        });
-      }
+      const watchDirs = [...new Set([
+        primaryDir,
+        options.apiDir,
+        options.layoutsDir,
+        options.actionsDir,
+      ].filter(Boolean))] as string[];
+      const watchCallback = (_eventType: unknown, filename: unknown) => {
+        if (!filename) return;
+        const name = typeof filename === "string" ? filename : (filename as Buffer).toString();
+        if (name.startsWith(".") || name.startsWith("_")) return;
+        if (name === "x-routes.ts") return;
+        if (!/\.(tsx|ts|css)$/.test(name)) return;
+        scheduleRebuild();
+      };
+      for (const dir of watchDirs) {
+        if (!existsSync(dir)) continue;
+        try {
+          watch(dir, { recursive: true }, watchCallback);
+        } catch {
+          console.warn(`[x] could not watch ${dir}`);
+        }
+      }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const srcDir = join(primaryDir, "..", "..", "src");
const watchDirs = [...new Set([
primaryDir,
options.apiDir,
options.layoutsDir,
options.actionsDir,
srcDir,
].filter(Boolean))] as string[];
for (const dir of watchDirs) {
watch(dir, { recursive: true }, (_eventType: unknown, filename: unknown) => {
if (!filename) return;
const name = typeof filename === "string" ? filename : (filename as Buffer).toString();
if (name.startsWith(".") || name.startsWith("_")) return;
if (name === "x-routes.ts") return;
if (!/\.(tsx|ts|css)$/.test(name)) return;
scheduleRebuild();
});
}
const watchDirs = [...new Set([
primaryDir,
options.apiDir,
options.layoutsDir,
options.actionsDir,
].filter(Boolean))] as string[];
const watchCallback = (_eventType: unknown, filename: unknown) => {
if (!filename) return;
const name = typeof filename === "string" ? filename : (filename as Buffer).toString();
if (name.startsWith(".") || name.startsWith("_")) return;
if (name === "x-routes.ts") return;
if (!/\.(tsx|ts|css)$/.test(name)) return;
scheduleRebuild();
};
for (const dir of watchDirs) {
if (!existsSync(dir)) continue;
try {
watch(dir, { recursive: true }, watchCallback);
} catch {
console.warn(`[x] could not watch ${dir}`);
}
}
🤖 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/createApp.ts` around lines 526 - 543, Replace the hardcoded
srcDir derivation in the file-watching setup with a path derived from the
configured directories or an existing project-root convention that supports
custom pagesDir/routesDir layouts. Before watching, retain only directories that
exist, and isolate each watch(dir, ...) call so a missing or invalid directory
is skipped without aborting watching for the remaining directories; preserve the
existing filename filters and rebuild scheduling.

Comment on lines +331 to +363
for (const [oldStr, newStr] of fileReplacements) {
// Normalize both strings - remove extra indentation for matching
const normalizedOld = oldStr.replace(/\n\s+/g, '\n').trim();
const normalizedContent = content.replace(/\n\s+/g, '\n')
const idx = normalizedContent.indexOf(normalizedOld);

if (idx === -1) {
console.log(` MISSED in ${file}:`, normalizedOld.substring(0, 60));
continue;
}

// Find the actual content by aligning line counts
const oldLines = normalizedOld.split('\n').length;
const contentLines = content.split('\n');
let matchFound = false;

// Try to find the actual match in original content
for (let i = 0; i < contentLines.length; i++) {
const startIdx = content.indexOf(oldStr.replace(/\n\s+/g, '\n').trim().split('\n')[0].trim(), i);
if (startIdx >= 0) {
content = content.slice(0, startIdx) + newStr + content.slice(startIdx + oldStr.length);
matchFound = true;
break;
}
}

if (!matchFound) {
console.log(` FAILED in ${file}`);
}
}

writeFileSync(filePath, content, 'utf-8');
console.log(` Updated ${file}`);

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

Match and replace the exact block atomically.

idx is ignored: the loop always selects the first matching opening line, so replacements with the same <div> prefix can overwrite a different block. Because the slice uses oldStr.length without validating the full match, this can corrupt the page. Match the complete whitespace-tolerant block exactly once, and throw before writing when any replacement is missing or ambiguous.

🤖 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 `@scripts/convert-code-blocks.mjs` around lines 331 - 363, Update the
replacement loop in the fileReplacements processing block to use idx and match
the complete normalized oldStr against content with whitespace alignment, rather
than selecting the first matching opening line. Require exactly one match for
each replacement, replace the full original block using its actual span, and
throw on missing or ambiguous matches before writeFileSync is called.

@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.

Caution

Inline review comments failed to post. This is likely due to GitHub's internal server error or limits when posting large numbers of comments. If you are seeing this consistently it is likely a permissions issue. Please check "Moderation" -> "Code review limits" under your organization settings.

Actionable comments posted: 13

Note

Due to the large number of review comments, Critical, Major severity comments were prioritized as inline comments.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
packages/cli/src/index.ts (1)

253-261: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Unknown command should still exit non-zero.

Per the described change, the unknown-command branch now logs the error and prints help but no longer sets a non-zero exit code (only the "undefined/missing command" branch does). This means x some-typo will exit 0, silently breaking CI/scripts that check the exit status of CLI invocations.

🤖 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/cli/src/index.ts` around lines 253 - 261, Update the default branch
of the command dispatch alongside printHelp() so unknown commands set a non-zero
process.exitCode, matching the existing missing-command behavior while
preserving the error message and help output.
packages/core/src/content.ts (1)

84-90: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Fallback array split leaves per-element quotes intact.

When JSON.parse fails on a bracketed value, the fallback splits on commas but doesn't strip quotes from individual elements (only the earlier whole-value quote check at lines 81-83 does that). A value like [foo, "bar"] becomes ['foo', '"bar"'], with "bar" keeping its literal quotes.

🐛 Proposed fix
       } catch {
-        value = (value as string).slice(1, -1).split(",").map((s) => s.trim()).filter(Boolean);
+        value = (value as string)
+          .slice(1, -1)
+          .split(",")
+          .map((s) => s.trim().replace(/^["']|["']$/g, ""))
+          .filter(Boolean);
       }
🤖 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/content.ts` around lines 84 - 90, Update the
bracketed-string fallback in the value parsing logic to remove surrounding
quotes from each comma-separated element before trimming and filtering. Preserve
the existing JSON.parse path and ensure inputs such as `[foo, "bar"]` produce
unquoted element values.
♻️ Duplicate comments (2)
packages/core/src/createApp.ts (2)

219-232: 🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Named-export auto-registration still exposes arbitrary functions as RPCs.

This still registers every non-default/actions function export from an actions file directly as a callable server action, exactly as flagged in a prior review. A helper accidentally re-exported from an action file (e.g. a shared validator) becomes reachable via POST /__x/actions/....

🔒 Suggested fix
         if (actions) {
           registerServerFunctions(parentPath, actionFile.paramNames, actions);
         }
-        // Individual named exports — each function is an action under parent path
-        for (const [key, value] of Object.entries(mod)) {
-          if (key === "default" || key === "actions" || typeof value !== "function") continue;
-          registerServerFunctions(parentPath, actionFile.paramNames, {
-            [key]: value as (...args: unknown[]) => Promise<unknown>,
-          });
-        }
+        // Only explicit `export const actions = {...}` is registered; arbitrary
+        // named exports are not implicitly exposed as network-callable RPCs.
🤖 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/createApp.ts` around lines 219 - 232, Remove the individual
named-export auto-registration loop in the action-loading flow around
registerServerFunctions; only register the explicitly grouped mod.actions
export. Ensure helper or other function exports from an actions file are not
exposed as RPC endpoints.

251-259: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Custom root layout still isn't applied to the 404 page in split layoutsDir configs.

rootLayout here is looked up as layouts.find((l) => l.dirPath === pagesDir). This is the exact lookup that a prior review flagged as broken when layoutsDir !== pagesDir (marked addressed in a later commit). That fix (lines 340-346) correctly unshifts dedicatedLayouts into the layout chain for regular routes, but this notFoundLayout derivation was not updated the same way — dedicatedLayouts entries have dirPath under layoutsDir, so they never match pagesDir, and the custom root layout silently fails to wrap the generated 404 page.

🐛 Suggested fix
-    const rootLayout = layouts.find((l) => l.dirPath === pagesDir);
+    const rootLayout = layouts.find(
+      (l) => l.dirPath === pagesDir || l.dirPath === layoutsDir,
+    );
🤖 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/createApp.ts` around lines 251 - 259, Update the
notFoundLayout derivation in the createApp flow to resolve the root layout from
the dedicatedLayouts entries used when layoutsDir differs from pagesDir, rather
than matching only layouts by pagesDir. Preserve the existing default-component
import and undefined behavior when no dedicated root layout exists, while
keeping the regular route layout-chain handling unchanged.
🟡 Minor comments (10)
examples/landing/.gitignore-5-5 (1)

5-5: 🔒 Security & Privacy | 🟡 Minor | ⚡ Quick win

Ignore local environment-file variants.

.env.local, .env.development, etc. can be accidentally committed.

Proposed fix
-.env
+.env*
+!.env.example
🤖 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 `@examples/landing/.gitignore` at line 5, Update the ignore rules in the
landing example’s .gitignore to cover the .env file and all local or
environment-specific variants, including names such as .env.local and
.env.development.
examples/landing/src/pages/docs/server-functions.tsx-14-29 (1)

14-29: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Align the server-function signature documentation.

Update the prose to say that exported functions receive the arguments you pass, not a Request; the dispatcher parses the POST body and calls fn(...args), and the examples already omit a request parameter.

🤖 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 `@examples/landing/src/pages/docs/server-functions.tsx` around lines 14 - 29,
Update the explanatory paragraph under “Defining server functions” to remove the
claim that each function receives a Request object and state that functions
receive the arguments passed by the caller. Keep the existing examples and their
argument signatures unchanged.
examples/landing/src/pages/docs/api-routes.tsx-76-76 (1)

76-76: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Fix the misspelled Tailwind utility.

examples/landing/src/pages/docs/api-routes.tsx:76 uses tracking-tip, which is not a Tailwind spacing utility, so the heading loses the intended letter spacing. Use tracking-tight to match the nearby docs headings.

Proposed fix
-      <h2 className="mt-12 text-xl font-bold tracking-tip">Process sharing</h2>
+      <h2 className="mt-12 text-xl font-bold tracking-tight">Process sharing</h2>
🤖 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 `@examples/landing/src/pages/docs/api-routes.tsx` at line 76, Update the
className on the “Process sharing” h2 heading to replace the invalid
tracking-tip utility with tracking-tight, matching the intended letter-spacing
styling of nearby documentation headings.
examples/landing/src/styles/globals.css-1-1 (1)

1-1: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Use the configured @import notation.

Stylelint rejects the url(...) form here, causing this stylesheet to fail linting.

-@import url('https://fonts.googleapis.com/css2?family=Instrument+Sans:ital,wght@0,400;0,500;0,600;0,700&family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;500&display=swap');
+@import 'https://fonts.googleapis.com/css2?family=Instrument+Sans:ital,wght@0,400;0,500;0,600;0,700&family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;500&display=swap';
🤖 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 `@examples/landing/src/styles/globals.css` at line 1, Update the Google Fonts
import at the stylesheet’s top-level `@import` declaration to use the configured
import notation instead of the url(...) form, while preserving the existing font
families, weights, and display parameter.

Source: Linters/SAST tools

examples/landing/src/lib/syntax.tsx-161-164 (1)

161-164: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Emit /> once and consume both characters.

Line 162 adds a trailing space and Line 163 advances only past /, so every self-closing tag renders as /> >.

Proposed fix
-      tokens.push(<span key={key++} className="text-[`#ffa657`]">{"/> "}</span>);
-      i += 1;
+      tokens.push(<span key={key++} className="text-[`#ffa657`]">{"/>"}</span>);
+      i += 2;
🤖 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 `@examples/landing/src/lib/syntax.tsx` around lines 161 - 164, Update the
self-closing tag handling in the syntax tokenizer to emit exactly “/>” without a
trailing space and advance the index past both slash and greater-than
characters. Preserve the existing tokenization flow and continue behavior in the
surrounding parsing loop.
examples/landing/src/lib/syntax.tsx-37-39 (1)

37-39: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Fix the unreachable indented-output branch.

trimStart() has already removed leading spaces, so trimmed.startsWith(" ") can never be true. CLI output lines remain unstyled.

-    if (trimmed.startsWith("  ")) {
+    if (line.startsWith("  ")) {
🤖 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 `@examples/landing/src/lib/syntax.tsx` around lines 37 - 39, Update the
line-rendering logic in the syntax highlighting function to detect indentation
from the original line rather than the already trimStart()-processed trimmed
value. Preserve the indented-output styling and ensure lines beginning with two
spaces reach the block text span branch.
examples/landing/src/lib/syntax.tsx-50-54 (1)

50-54: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Preserve indentation for tree comments.

Using s strips leading whitespace before splitting the comment, misaligning commented entries in nested file trees.

-    const commentIdx = s.indexOf("//");
+    const commentIdx = line.indexOf("//");
     if (commentIdx !== -1) {
-      const before = s.slice(0, commentIdx);
-      const after = s.slice(commentIdx);
+      const before = line.slice(0, commentIdx);
+      const after = line.slice(commentIdx);
🤖 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 `@examples/landing/src/lib/syntax.tsx` around lines 50 - 54, Update the
comment-rendering logic in the syntax highlighting flow to detect and split `//`
from the original line content while preserving its leading indentation. Ensure
tree comments retain their existing whitespace alignment, while the comment
portion continues using the current muted styling.
examples/saas/src/pages/login.tsx-46-50 (1)

46-50: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Point “Register” at a real registration flow.

The link targets /login, so users without an account are returned to the same page. The supplied SaaS routes do not include a registration page.

🤖 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 `@examples/saas/src/pages/login.tsx` around lines 46 - 50, Update the
“Register” anchor in the login page to point to an actual registration flow
instead of `/login`; use the existing supplied SaaS route or registration
destination, and ensure users without accounts are navigated there.
examples/saas/src/pages/pricing.tsx-78-89 (1)

78-89: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Route Enterprise users to sales.

The Enterprise CTA says “Contact Sales” but routes to /login, identical to self-service tiers. Link this tier to a sales/contact flow or change the CTA text.

🤖 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 `@examples/saas/src/pages/pricing.tsx` around lines 78 - 89, Update the CTA
link in the pricing tier rendering so the Enterprise tier’s “Contact Sales”
action routes to the sales/contact flow instead of /login; preserve /login for
self-service tiers, using the tier-specific data such as tier name or CTA to
distinguish Enterprise.
examples/saas/src/pages/pricing.tsx-73-73 (1)

73-73: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Use the Tailwind v4 shrink utility.

flex-shrink-0 is a legacy class in Tailwind v4; replace it with shrink-0 so this works across generated Tailwind output.

Proposed fix
- <Check className="h-4 w-4 text-primary flex-shrink-0" />
+ <Check className="h-4 w-4 text-primary shrink-0" />
🤖 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 `@examples/saas/src/pages/pricing.tsx` at line 73, Update the Check component’s
Tailwind className in the pricing page to replace the legacy flex-shrink-0
utility with shrink-0, preserving the existing sizing and text styling.
🧹 Nitpick comments (3)
examples/saas/src/lib/auth.ts (1)

66-68: 🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick win

Session cookie is missing Secure.

setSessionCookie omits the Secure attribute, so the session cookie can be sent over plain HTTP once deployed, weakening session confidentiality.

🔒 Suggested fix
 export function setSessionCookie(token: string): string {
-  return `${SESSION_COOKIE}=${token}; HttpOnly; SameSite=Lax; Path=/; Max-Age=${SESSION_MAX_AGE}`;
+  return `${SESSION_COOKIE}=${token}; HttpOnly; Secure; SameSite=Lax; Path=/; Max-Age=${SESSION_MAX_AGE}`;
 }
🤖 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 `@examples/saas/src/lib/auth.ts` around lines 66 - 68, Update setSessionCookie
to include the Secure attribute in the returned session cookie string, while
preserving the existing HttpOnly, SameSite, Path, and Max-Age attributes.
examples/saas/src/pages/dashboard/index.tsx (1)

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

Duplicated session-loading logic across three dashboard pages. index.tsx, analytics.tsx, and settings.tsx each define an identical loader() that dynamically imports lib/auth, parses the session cookie, and falls back to "User". Extract a single shared helper (e.g. getLoaderUsername(request) in examples/saas/src/lib/auth.ts) and call it from each loader.

  • examples/saas/src/pages/dashboard/index.tsx#L4-L9: replace the inline loader body with a call to the shared helper.
  • examples/saas/src/pages/dashboard/analytics.tsx#L4-L9: replace the inline loader body with a call to the shared helper.
  • examples/saas/src/pages/dashboard/settings.tsx#L4-L9: replace the inline loader body with a call to the shared helper.
🤖 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 `@examples/saas/src/pages/dashboard/index.tsx` around lines 4 - 9, Extract the
duplicated session username logic into a shared getLoaderUsername(request)
helper in examples/saas/src/lib/auth.ts, preserving the existing cookie parsing,
session lookup, and "User" fallback. Update the loaders in
examples/saas/src/pages/dashboard/index.tsx (lines 4-9),
examples/saas/src/pages/dashboard/analytics.tsx (lines 4-9), and
examples/saas/src/pages/dashboard/settings.tsx (lines 4-9) to call the helper
and return its username result.
packages/core/src/createApp.ts (1)

601-629: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

Production dispatch now does O(n) linear route matching per request.

The prior routeMap exact-match optimization was removed in favor of iterating all handlers on every request (mirroring dev). The accompanying comment explains this unifies behavior with dev (fixing middleware/layout/static-asset consistency), which is a reasonable correctness tradeoff, but it does reintroduce a linear scan on the production hot path for every request. For apps with many routes this adds unnecessary overhead compared to an exact-match lookup for static (non-dynamic) routes.

Consider maintaining a Map<string, RouteHandler> for routes without dynamic segments, checked first, falling back to iteration only over the remaining dynamic-segment handlers.

🤖 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/createApp.ts` around lines 601 - 629, Optimize production
dispatch in prodFetch by maintaining a Map keyed by exact route paths for
handlers without dynamic segments, checking that map before scanning dynamic
handlers. Keep dynamic matching through the existing extractParams flow and
preserve the current ordering and behavior for revalidation, server functions,
static assets, content handlers, and 404 responses.
🤖 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 `@examples/blog/src/pages/blog/`[slug].tsx:
- Around line 50-52: Sanitize the HTML produced by renderMarkdown before
assigning it to dangerouslySetInnerHTML in the blog post rendering component.
Add the project’s established rehype-sanitize integration or a restrictive fixed
allowlist, ensuring raw HTML injection is disabled while preserving the intended
Markdown formatting.

In `@examples/blog/src/pages/blog/index.tsx`:
- Around line 17-27: Update the `routePath` mapping in the `loader` function so
each content entry uses the `/blog/<slug>` route expected by the detail page,
rather than the root-level path returned by `scanContent`. Preserve the existing
title, description, date, and tags mappings.

In `@examples/blog/src/pages/index.tsx`:
- Around line 40-48: Wire the email input and Subscribe button into an actual
submission flow by adding a form submission handler or action that processes the
entered email and prevents the default submission behavior as appropriate.
Ensure the controls provide submission feedback and validation, or
remove/disable the CTA if no subscription backend is available.

In `@examples/landing/src/pages/contact.tsx`:
- Around line 32-54: The contact form in the page containing the “Send message”
button currently posts to an unhandled route. Add validated POST handling for
the submitted name, email, subject, and message fields via a server action or
API endpoint, then connect the form to it and render a user-visible success or
error state based on the result.

In `@examples/landing/src/pages/docs/middleware.tsx`:
- Around line 77-89: Validate redirectTo in the middleware example before using
it in the final redirect response. Only allow local path targets (not absolute
URLs or external origins), and fall back to "/" for invalid or missing values
while preserving valid local redirects.

In `@examples/saas/.gitignore`:
- Line 4: Add a gitignore pattern covering SQLite shared-memory sidecar files
such as dev.db-shm alongside the existing *.db rule, and remove the tracked
examples/saas/data/dev.db-shm artifact from the change.

In `@examples/saas/data/dev.db-shm`:
- Line 1: Remove the committed SQLite shared-memory artifact and update the
repository ignore rules to exclude data/*.db, data/*.db-shm, and data/*.db-wal;
verify the runtime database files used by auth.ts remain untracked, and purge
this artifact from history if it contains real session tokens.

In `@examples/saas/src/lib/auth.ts`:
- Around line 15-20: Update getDb to cache and reuse a single SQLite connection,
running runSQLiteMigrations only when that connection is first initialized.
Ensure createSession, getSession, and deleteSession continue using the shared
handle without reconnecting or re-running migrations on each call, and preserve
existing database path behavior.

In `@examples/saas/src/pages/login.tsx`:
- Around line 16-45: The login form in the page component needs to submit
credentials through the existing authentication flow. Update the form to use the
actual login action or endpoint with method="post", and add stable name
attributes to the email and password inputs so both values are submitted.

In `@examples/saas/src/styles/globals.css`:
- Around line 73-80: In the sidebar color variable declarations, remove the
duplicate --sidebar-foreground entry and declare --sidebar-accent-foreground
with the intended accent foreground value so the `@theme` inline mapping resolves
correctly and the duplicate declaration is eliminated.

In `@packages/cli/src/index.ts`:
- Around line 126-138: Wrap the Tailwind watcher setup in the dev startup flow
around the watch call in a try/catch, using the existing cmdDev context and
fallback-warning behavior from createApp.ts. If recursive watch initialization
throws, log a warning and continue startup without CSS hot-recompilation;
preserve the existing debounce and recompilation callback when watch succeeds.

In `@packages/core/src/createApp.ts`:
- Around line 526-543: Replace the hardcoded srcDir derivation in the
file-watching setup with a path derived from the configured directories or an
existing project-root convention that supports custom pagesDir/routesDir
layouts. Before watching, retain only directories that exist, and isolate each
watch(dir, ...) call so a missing or invalid directory is skipped without
aborting watching for the remaining directories; preserve the existing filename
filters and rebuild scheduling.

In `@scripts/convert-code-blocks.mjs`:
- Around line 331-363: Update the replacement loop in the fileReplacements
processing block to use idx and match the complete normalized oldStr against
content with whitespace alignment, rather than selecting the first matching
opening line. Require exactly one match for each replacement, replace the full
original block using its actual span, and throw on missing or ambiguous matches
before writeFileSync is called.

---

Outside diff comments:
In `@packages/cli/src/index.ts`:
- Around line 253-261: Update the default branch of the command dispatch
alongside printHelp() so unknown commands set a non-zero process.exitCode,
matching the existing missing-command behavior while preserving the error
message and help output.

In `@packages/core/src/content.ts`:
- Around line 84-90: Update the bracketed-string fallback in the value parsing
logic to remove surrounding quotes from each comma-separated element before
trimming and filtering. Preserve the existing JSON.parse path and ensure inputs
such as `[foo, "bar"]` produce unquoted element values.

---

Minor comments:
In `@examples/landing/.gitignore`:
- Line 5: Update the ignore rules in the landing example’s .gitignore to cover
the .env file and all local or environment-specific variants, including names
such as .env.local and .env.development.

In `@examples/landing/src/lib/syntax.tsx`:
- Around line 161-164: Update the self-closing tag handling in the syntax
tokenizer to emit exactly “/>” without a trailing space and advance the index
past both slash and greater-than characters. Preserve the existing tokenization
flow and continue behavior in the surrounding parsing loop.
- Around line 37-39: Update the line-rendering logic in the syntax highlighting
function to detect indentation from the original line rather than the already
trimStart()-processed trimmed value. Preserve the indented-output styling and
ensure lines beginning with two spaces reach the block text span branch.
- Around line 50-54: Update the comment-rendering logic in the syntax
highlighting flow to detect and split `//` from the original line content while
preserving its leading indentation. Ensure tree comments retain their existing
whitespace alignment, while the comment portion continues using the current
muted styling.

In `@examples/landing/src/pages/docs/api-routes.tsx`:
- Line 76: Update the className on the “Process sharing” h2 heading to replace
the invalid tracking-tip utility with tracking-tight, matching the intended
letter-spacing styling of nearby documentation headings.

In `@examples/landing/src/pages/docs/server-functions.tsx`:
- Around line 14-29: Update the explanatory paragraph under “Defining server
functions” to remove the claim that each function receives a Request object and
state that functions receive the arguments passed by the caller. Keep the
existing examples and their argument signatures unchanged.

In `@examples/landing/src/styles/globals.css`:
- Line 1: Update the Google Fonts import at the stylesheet’s top-level `@import`
declaration to use the configured import notation instead of the url(...) form,
while preserving the existing font families, weights, and display parameter.

In `@examples/saas/src/pages/login.tsx`:
- Around line 46-50: Update the “Register” anchor in the login page to point to
an actual registration flow instead of `/login`; use the existing supplied SaaS
route or registration destination, and ensure users without accounts are
navigated there.

In `@examples/saas/src/pages/pricing.tsx`:
- Around line 78-89: Update the CTA link in the pricing tier rendering so the
Enterprise tier’s “Contact Sales” action routes to the sales/contact flow
instead of /login; preserve /login for self-service tiers, using the
tier-specific data such as tier name or CTA to distinguish Enterprise.
- Line 73: Update the Check component’s Tailwind className in the pricing page
to replace the legacy flex-shrink-0 utility with shrink-0, preserving the
existing sizing and text styling.

---

Duplicate comments:
In `@packages/core/src/createApp.ts`:
- Around line 219-232: Remove the individual named-export auto-registration loop
in the action-loading flow around registerServerFunctions; only register the
explicitly grouped mod.actions export. Ensure helper or other function exports
from an actions file are not exposed as RPC endpoints.
- Around line 251-259: Update the notFoundLayout derivation in the createApp
flow to resolve the root layout from the dedicatedLayouts entries used when
layoutsDir differs from pagesDir, rather than matching only layouts by pagesDir.
Preserve the existing default-component import and undefined behavior when no
dedicated root layout exists, while keeping the regular route layout-chain
handling unchanged.

---

Nitpick comments:
In `@examples/saas/src/lib/auth.ts`:
- Around line 66-68: Update setSessionCookie to include the Secure attribute in
the returned session cookie string, while preserving the existing HttpOnly,
SameSite, Path, and Max-Age attributes.

In `@examples/saas/src/pages/dashboard/index.tsx`:
- Around line 4-9: Extract the duplicated session username logic into a shared
getLoaderUsername(request) helper in examples/saas/src/lib/auth.ts, preserving
the existing cookie parsing, session lookup, and "User" fallback. Update the
loaders in examples/saas/src/pages/dashboard/index.tsx (lines 4-9),
examples/saas/src/pages/dashboard/analytics.tsx (lines 4-9), and
examples/saas/src/pages/dashboard/settings.tsx (lines 4-9) to call the helper
and return its username result.

In `@packages/core/src/createApp.ts`:
- Around line 601-629: Optimize production dispatch in prodFetch by maintaining
a Map keyed by exact route paths for handlers without dynamic segments, checking
that map before scanning dynamic handlers. Keep dynamic matching through the
existing extractParams flow and preserve the current ordering and behavior for
revalidation, server functions, static assets, content handlers, and 404
responses.
🪄 Autofix (Beta)

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: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: fd246fd8-c4ed-4c2f-a61e-1fe9624857ab

📥 Commits

Reviewing files that changed from the base of the PR and between bf029e1 and 3eb217b.

⛔ Files ignored due to path filters (5)
  • bun.lock is excluded by !**/*.lock
  • examples/basic/public/favicon.ico is excluded by !**/*.ico
  • examples/blog/public/favicon.ico is excluded by !**/*.ico
  • examples/landing/public/favicon.ico is excluded by !**/*.ico
  • examples/saas/public/favicon.ico is excluded by !**/*.ico
📒 Files selected for processing (89)
  • examples/blog/.gitignore
  • examples/blog/components.json
  • examples/blog/content/posts/getting-started.md
  • examples/blog/content/posts/hello-world.md
  • examples/blog/content/posts/tailwind-v4.md
  • examples/blog/package.json
  • examples/blog/src/components/ui/avatar.tsx
  • examples/blog/src/components/ui/badge.tsx
  • examples/blog/src/components/ui/button.tsx
  • examples/blog/src/components/ui/card.tsx
  • examples/blog/src/components/ui/input.tsx
  • examples/blog/src/layouts/blog.tsx
  • examples/blog/src/layouts/main.tsx
  • examples/blog/src/lib/utils.ts
  • examples/blog/src/pages/about.tsx
  • examples/blog/src/pages/blog/[slug].tsx
  • examples/blog/src/pages/blog/index.tsx
  • examples/blog/src/pages/index.tsx
  • examples/blog/src/styles/globals.css
  • examples/blog/src/x-routes.ts
  • examples/blog/tsconfig.json
  • examples/blog/x.config.ts
  • examples/landing/.gitignore
  • examples/landing/components.json
  • examples/landing/package.json
  • examples/landing/src/components/code-block.tsx
  • examples/landing/src/components/ui/avatar.tsx
  • examples/landing/src/components/ui/badge.tsx
  • examples/landing/src/components/ui/button.tsx
  • examples/landing/src/components/ui/card.tsx
  • examples/landing/src/components/ui/input.tsx
  • examples/landing/src/layouts/main.tsx
  • examples/landing/src/lib/syntax.tsx
  • examples/landing/src/lib/utils.ts
  • examples/landing/src/pages/contact.tsx
  • examples/landing/src/pages/docs/_layout.tsx
  • examples/landing/src/pages/docs/api-routes.tsx
  • examples/landing/src/pages/docs/build-deploy.tsx
  • examples/landing/src/pages/docs/configuration.tsx
  • examples/landing/src/pages/docs/content-collections.tsx
  • examples/landing/src/pages/docs/data-layer.tsx
  • examples/landing/src/pages/docs/getting-started.tsx
  • examples/landing/src/pages/docs/index.tsx
  • examples/landing/src/pages/docs/layouts.tsx
  • examples/landing/src/pages/docs/middleware.tsx
  • examples/landing/src/pages/docs/pages.tsx
  • examples/landing/src/pages/docs/routing.tsx
  • examples/landing/src/pages/docs/server-functions.tsx
  • examples/landing/src/pages/features.tsx
  • examples/landing/src/pages/index.tsx
  • examples/landing/src/styles/globals.css
  • examples/landing/src/x-routes.ts
  • examples/landing/tsconfig.json
  • examples/landing/x.config.ts
  • examples/saas/.gitignore
  • examples/saas/components.json
  • examples/saas/data/dev.db-shm
  • examples/saas/data/dev.db-wal
  • examples/saas/package.json
  • examples/saas/src/actions/dashboard.ts
  • examples/saas/src/components/ui/avatar.tsx
  • examples/saas/src/components/ui/badge.tsx
  • examples/saas/src/components/ui/button.tsx
  • examples/saas/src/components/ui/card.tsx
  • examples/saas/src/components/ui/input.tsx
  • examples/saas/src/layouts/dashboard.tsx
  • examples/saas/src/layouts/main.tsx
  • examples/saas/src/lib/auth.ts
  • examples/saas/src/lib/migrations/001_create_sessions.sql
  • examples/saas/src/lib/utils.ts
  • examples/saas/src/pages/dashboard/_middleware.ts
  • examples/saas/src/pages/dashboard/analytics.tsx
  • examples/saas/src/pages/dashboard/index.tsx
  • examples/saas/src/pages/dashboard/settings.tsx
  • examples/saas/src/pages/index.tsx
  • examples/saas/src/pages/login.tsx
  • examples/saas/src/pages/pricing.tsx
  • examples/saas/src/styles/globals.css
  • examples/saas/src/x-routes.ts
  • examples/saas/tsconfig.json
  • examples/saas/x.config.ts
  • packages/cli/src/index.ts
  • packages/core/src/build.test.ts
  • packages/core/src/build.ts
  • packages/core/src/content.ts
  • packages/core/src/createApp.ts
  • packages/core/src/live-reload.ts
  • packages/core/src/render.ts
  • scripts/convert-code-blocks.mjs
💤 Files with no reviewable changes (2)
  • packages/core/src/build.test.ts
  • packages/core/src/build.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/core/src/render.ts
🛑 Comments failed to post (1)
examples/saas/data/dev.db-shm (1)

1-1: 🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Don't commit SQLite runtime artifacts.

This is a SQLite -shm (shared-memory/WAL) file — a transient runtime artifact, not source. It appears to belong to the data/dev.db used by examples/saas/src/lib/auth.ts for session storage, so it may contain snapshots of session data. Runtime DB files should never be committed; add data/*.db, data/*.db-shm, data/*.db-wal to .gitignore and remove this file from the repo (and history if it contains real session tokens).

🤖 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 `@examples/saas/data/dev.db-shm` at line 1, Remove the committed SQLite
shared-memory artifact and update the repository ignore rules to exclude
data/*.db, data/*.db-shm, and data/*.db-wal; verify the runtime database files
used by auth.ts remain untracked, and purge this artifact from history if it
contains real session tokens.

- Reordered and grouped imports for better readability in dashboard, main, analytics, index, settings, and login pages.
- Removed unnecessary blank lines in auth and utils files.
- Enhanced code formatting for better consistency in various components.
- Updated middleware to maintain import order.
- Improved readability by adding line breaks in JSX elements and ensuring consistent indentation.
- Adjusted CSS styles for better organization.
- Updated configuration files for clarity.
- Enhanced error messages in CLI and build scripts for better debugging.
@abdelkabirouadoukou
abdelkabirouadoukou merged commit 88d4a26 into main Jul 27, 2026
1 of 2 checks passed
@abdelkabirouadoukou
abdelkabirouadoukou deleted the generale-improv branch August 1, 2026 04:37
@coderabbitai coderabbitai Bot mentioned this pull request Aug 8, 2026
8 of 11 tasks
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