Skip to content

Scaffold and organize JavaScript workspace packages#109

Open
omarluq wants to merge 2 commits intomainfrom
add-boilerplate-js-libs
Open

Scaffold and organize JavaScript workspace packages#109
omarluq wants to merge 2 commits intomainfrom
add-boilerplate-js-libs

Conversation

@omarluq
Copy link
Owner

@omarluq omarluq commented Feb 28, 2026

Summary

  • scaffolded the multi-package JavaScript workspace structure
  • grouped framework adapters under javascript/framework/*
  • grouped starters under javascript/starter/*
  • grouped native targets under javascript/native/{platform}/{arch}/{libc?}
  • removed TanStack adapter/starter from the plan and workspace
  • updated workspace globs, TS path mappings, and lockfile

Validation

  • bun install
  • bun run js:typecheck
  • bun run --cwd javascript/create-tui typecheck
  • starter package typechecks (next, nuxt, sveltekit)

@netlify
Copy link

netlify bot commented Feb 28, 2026

Deploy Preview for termisu canceled.

Name Link
🔨 Latest commit f87cdb2
🔍 Latest deploy log https://app.netlify.com/projects/termisu/deploys/69b601cdfc17db000865b282

@coderabbitai
Copy link

coderabbitai bot commented Feb 28, 2026

📝 Walkthrough

Summary by CodeRabbit

Release Notes

  • New Features

    • Introduced CLI scaffolder for creating Termisu projects with multiple starter templates (Next.js, Nuxt, SvelteKit)
    • Added framework adapters for React, Vue, Svelte, and Solid
    • Expanded cross-platform native support (Linux, macOS, FreeBSD with multiple architectures)
  • Documentation

    • Added comprehensive architecture documentation
    • Provided workspace organization guides for JavaScript packages

Walkthrough

This PR establishes a comprehensive JavaScript workspace for Termisu, adding 20+ packages including framework adapters (React, Vue, Svelte, Solid), starter templates (Next, Nuxt, SvelteKit), native platform distributions across multiple OS/architectures, and core utilities (platform, reconciler, runtime, create-tui). It includes architecture documentation and updates root configuration for workspace management.

Changes

Cohort / File(s) Summary
Architecture Documentation
architecture/README.md, architecture/core-architecture.md, architecture/js-runtime-ffi-architecture.md
Adds comprehensive system architecture documentation covering Termisu core design, lifecycle, rendering/event pipelines, platform backends, FFI boundaries, JS runtime topology, native library loading flow, and responsibility matrices with Mermaid diagrams.
Root Configuration
.gitignore, package.json, tsconfig.base.json
Updates workspace root: adds nested node_modules ignore pattern, expands workspace glob patterns to include all JS packages (frameworks, natives, starters), and introduces TypeScript path aliasing for @termisu/* modules.
Platform Package
javascript/platform/.gitignore, javascript/platform/README.md, javascript/platform/package.json, javascript/platform/src/index.ts, javascript/platform/tsconfig.json
Implements platform detection and native package resolution with PlatformTarget union type, detectTarget() function, and nativePackageByTarget mapping supporting 8 platform targets across Linux/Darwin/FreeBSD.
Runtime Package
javascript/runtime/.gitignore, javascript/runtime/README.md, javascript/runtime/package.json, javascript/runtime/src/index.ts, javascript/runtime/tsconfig.json
Adds runtime orchestration package exporting RuntimeOptions type with optional libraryPath and createRuntime() factory function returning kind identifier and options.
Reconciler Package
javascript/reconciler/.gitignore, javascript/reconciler/README.md, javascript/reconciler/package.json, javascript/reconciler/src/index.ts, javascript/reconciler/tsconfig.json
Introduces reconciliation primitives with ReconcilerOptions type and createReconciler() factory that returns a kind-labeled object.
Create-TUI Package
javascript/create-tui/.gitignore, javascript/create-tui/README.md, javascript/create-tui/package.json, javascript/create-tui/src/cli.ts, javascript/create-tui/src/index.ts, javascript/create-tui/tsconfig.json
CLI scaffolder package with starterIds constant ["sveltekit", "next", "nuxt"], binary entry create-termisu, and cli.ts printing available starters.
Framework Adapters
javascript/framework/react/*, javascript/framework/vue/*, javascript/framework/svelte/*, javascript/framework/solid/*
Four identical-pattern framework adapter packages, each with .gitignore, README, package.json, src/index.ts (exporting packageId), and tsconfig.json. All depend on @termisu/reconciler and @termisu/runtime.
Starter Templates
javascript/starter/next/*, javascript/starter/nuxt/*, javascript/starter/sveltekit/*
Three starter packages following consistent pattern with .gitignore, README, package.json, src/index.ts (exporting starterId), and tsconfig.json. Next depends on @termisu/react, Nuxt on @termisu/vue, SvelteKit on @termisu/svelte.
Native Packages
javascript/native/darwin/{arm64,x64}/*, javascript/native/freebsd/{arm64,x64}/*, javascript/native/linux/{arm64,x64}/{{gnu,musl}}/*
Eight prebuilt native platform packages spanning macOS (arm64, x64), FreeBSD (arm64, x64), and Linux (arm64/x64 with gnu/musl). Each contains manifest.json, package.json (with platform constraints and "./manifest" export), and README.md.
JavaScript Workspace Root
javascript/README.md
Workspace overview documenting 20 packages with table mapping each to source paths including core, runtime, reconciler, platform, framework adapters, starters, and native distributions.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Possibly related PRs

Poem

🐰 Hoppy workspace now takes flight,
Twenty packages, shining bright!
Frameworks dance—React, Vue, and more,
Native lands from darwin's shore.
From Linux's gnu to musl's embrace,
Each starter finds its perfect place! 🎉

🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The PR title accurately describes the main change: scaffolding and organizing JavaScript workspace packages with a clear, concise, and specific summary.
Description check ✅ Passed The PR description is directly related to the changeset, providing a detailed summary of the scaffolded structure, validation steps performed, and confirming all changes are accounted for.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch add-boilerplate-js-libs
📝 Coding Plan
  • Generate coding plan for human review comments

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

Tip

You can make CodeRabbit's review stricter and more nitpicky using the `assertive` profile, if that's what you prefer.

Change the reviews.profile setting to assertive to make CodeRabbit's nitpick more issues in your PRs.

@omarluq omarluq force-pushed the add-boilerplate-js-libs branch 2 times, most recently from dd4a33b to ecb57d9 Compare March 8, 2026 06:46
@omarluq omarluq force-pushed the add-boilerplate-js-libs branch from ecb57d9 to f87cdb2 Compare March 15, 2026 00:48
@omarluq omarluq marked this pull request as ready for review March 15, 2026 00:48
Copilot AI review requested due to automatic review settings March 15, 2026 00:48
@sonarqubecloud
Copy link

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Scaffolds a multi-package JavaScript workspace for Termisu, reorganizing adapters/starters/native targets into a consistent package topology and updating workspace + TS configuration to support it.

Changes:

  • Expanded Bun workspaces to include framework adapters, starters, and native target packages.
  • Added scaffolding packages for @termisu/runtime, @termisu/reconciler, @termisu/platform, framework adapters, starters, and native target manifests.
  • Added architecture documentation describing the intended JS runtime + FFI package topology.

Reviewed changes

Copilot reviewed 86 out of 88 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
tsconfig.base.json Adds TS baseUrl + paths mappings for workspace imports.
package.json Updates workspace globs to include newly scaffolded packages.
javascript/starter/sveltekit/tsconfig.json Adds TS config for sveltekit starter package.
javascript/starter/sveltekit/src/index.ts Adds starter scaffold export.
javascript/starter/sveltekit/package.json Adds starter package manifest + scripts.
javascript/starter/sveltekit/README.md Adds starter README.
javascript/starter/sveltekit/.gitignore Ignores build output.
javascript/starter/nuxt/tsconfig.json Adds TS config for nuxt starter package.
javascript/starter/nuxt/src/index.ts Adds starter scaffold export.
javascript/starter/nuxt/package.json Adds starter package manifest + scripts.
javascript/starter/nuxt/README.md Adds starter README.
javascript/starter/nuxt/.gitignore Ignores build output.
javascript/starter/next/tsconfig.json Adds TS config for next starter package.
javascript/starter/next/src/index.ts Adds starter scaffold export.
javascript/starter/next/package.json Adds starter package manifest + scripts.
javascript/starter/next/README.md Adds starter README.
javascript/starter/next/.gitignore Ignores build output.
javascript/runtime/tsconfig.json Adds TS config for runtime package.
javascript/runtime/src/index.ts Adds runtime scaffold API surface.
javascript/runtime/package.json Adds runtime package manifest + scripts.
javascript/runtime/README.md Adds runtime README.
javascript/runtime/.gitignore Ignores build output.
javascript/reconciler/tsconfig.json Adds TS config for reconciler package.
javascript/reconciler/src/index.ts Adds reconciler scaffold API surface.
javascript/reconciler/package.json Adds reconciler package manifest + scripts.
javascript/reconciler/README.md Adds reconciler README.
javascript/reconciler/.gitignore Ignores build output.
javascript/platform/tsconfig.json Adds TS config for platform resolver package.
javascript/platform/src/index.ts Adds target detection + native package mapping.
javascript/platform/package.json Adds platform package manifest + optional native deps.
javascript/platform/README.md Adds platform README.
javascript/platform/.gitignore Ignores build output.
javascript/native/linux/x64/musl/package.json Adds linux x64 musl native target package scaffold.
javascript/native/linux/x64/musl/manifest.json Adds linux x64 musl target metadata.
javascript/native/linux/x64/musl/README.md Adds native target README.
javascript/native/linux/x64/gnu/package.json Adds linux x64 glibc native target package scaffold.
javascript/native/linux/x64/gnu/manifest.json Adds linux x64 glibc target metadata.
javascript/native/linux/x64/gnu/README.md Adds native target README.
javascript/native/linux/arm64/musl/package.json Adds linux arm64 musl native target package scaffold.
javascript/native/linux/arm64/musl/manifest.json Adds linux arm64 musl target metadata.
javascript/native/linux/arm64/musl/README.md Adds native target README.
javascript/native/linux/arm64/gnu/package.json Adds linux arm64 glibc native target package scaffold.
javascript/native/linux/arm64/gnu/manifest.json Adds linux arm64 glibc target metadata.
javascript/native/linux/arm64/gnu/README.md Adds native target README.
javascript/native/freebsd/x64/package.json Adds freebsd x64 native target package scaffold.
javascript/native/freebsd/x64/manifest.json Adds freebsd x64 target metadata.
javascript/native/freebsd/x64/README.md Adds native target README.
javascript/native/freebsd/arm64/package.json Adds freebsd arm64 native target package scaffold.
javascript/native/freebsd/arm64/manifest.json Adds freebsd arm64 target metadata.
javascript/native/freebsd/arm64/README.md Adds native target README.
javascript/native/darwin/x64/package.json Adds darwin x64 native target package scaffold.
javascript/native/darwin/x64/manifest.json Adds darwin x64 target metadata.
javascript/native/darwin/x64/README.md Adds native target README.
javascript/native/darwin/arm64/package.json Adds darwin arm64 native target package scaffold.
javascript/native/darwin/arm64/manifest.json Adds darwin arm64 target metadata.
javascript/native/darwin/arm64/README.md Adds native target README.
javascript/framework/vue/tsconfig.json Adds TS config for Vue adapter package.
javascript/framework/vue/src/index.ts Adds Vue adapter scaffold export.
javascript/framework/vue/package.json Adds Vue adapter package manifest + scripts.
javascript/framework/vue/README.md Adds adapter README.
javascript/framework/vue/.gitignore Ignores build output.
javascript/framework/svelte/tsconfig.json Adds TS config for Svelte adapter package.
javascript/framework/svelte/src/index.ts Adds Svelte adapter scaffold export.
javascript/framework/svelte/package.json Adds Svelte adapter package manifest + scripts.
javascript/framework/svelte/README.md Adds adapter README.
javascript/framework/svelte/.gitignore Ignores build output.
javascript/framework/solid/tsconfig.json Adds TS config for Solid adapter package.
javascript/framework/solid/src/index.ts Adds Solid adapter scaffold export.
javascript/framework/solid/package.json Adds Solid adapter package manifest + scripts.
javascript/framework/solid/README.md Adds adapter README.
javascript/framework/solid/.gitignore Ignores build output.
javascript/framework/react/tsconfig.json Adds TS config for React adapter package.
javascript/framework/react/src/index.ts Adds React adapter scaffold export.
javascript/framework/react/package.json Adds React adapter package manifest + scripts.
javascript/framework/react/README.md Adds adapter README.
javascript/framework/react/.gitignore Ignores build output.
javascript/create-tui/tsconfig.json Adds TS config for scaffolder CLI package.
javascript/create-tui/src/index.ts Adds starter ID list scaffold.
javascript/create-tui/src/cli.ts Adds CLI entrypoint scaffold + starter listing.
javascript/create-tui/package.json Adds CLI package manifest with bin entry.
javascript/create-tui/README.md Adds CLI README.
javascript/create-tui/.gitignore Ignores build output.
javascript/README.md Documents JS workspace packages and paths.
bun.lock Updates lockfile for new workspace topology/packages.
architecture/js-runtime-ffi-architecture.md Adds JS runtime + FFI architecture plan and package topology.
architecture/core-architecture.md Adds Crystal core architecture documentation.
architecture/README.md Adds index for architecture docs.
.gitignore Ignores nested javascript/**/node_modules.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

@@ -0,0 +1,11 @@
{
"extends": "../../tsconfig.base.json",
Comment on lines +11 to +22
export const detectTarget = (): PlatformTarget | null => {
const platform = process.platform;
const arch = process.arch;

if (platform === "linux" && arch === "x64") return "linux-x64-gnu";
if (platform === "linux" && arch === "arm64") return "linux-arm64-gnu";
if (platform === "darwin" && arch === "x64") return "darwin-x64";
if (platform === "darwin" && arch === "arm64") return "darwin-arm64";
if (platform === "freebsd" && arch === "x64") return "freebsd-x64";
if (platform === "freebsd" && arch === "arm64") return "freebsd-arm64";

return null;
Comment on lines +195 to +206
- [src/termisu/render_state.cr](/home/omar/sandbox/crystal/termisu/src/termisu/render_state.cr)
- [src/termisu/event/loop.cr](/home/omar/sandbox/crystal/termisu/src/termisu/event/loop.cr)
- [src/termisu/event/source/input.cr](/home/omar/sandbox/crystal/termisu/src/termisu/event/source/input.cr)
- [src/termisu/event/source/resize.cr](/home/omar/sandbox/crystal/termisu/src/termisu/event/source/resize.cr)
- [src/termisu/event/source/timer.cr](/home/omar/sandbox/crystal/termisu/src/termisu/event/source/timer.cr)
- [src/termisu/event/source/system_timer.cr](/home/omar/sandbox/crystal/termisu/src/termisu/event/source/system_timer.cr)
- [src/termisu/event/poller.cr](/home/omar/sandbox/crystal/termisu/src/termisu/event/poller.cr)
- [src/termisu/ffi/exports.cr](/home/omar/sandbox/crystal/termisu/src/termisu/ffi/exports.cr)
- [src/termisu/ffi/core.cr](/home/omar/sandbox/crystal/termisu/src/termisu/ffi/core.cr)
- [src/termisu/ffi/runtime.cr](/home/omar/sandbox/crystal/termisu/src/termisu/ffi/runtime.cr)
- [src/termisu/ffi/layout.cr](/home/omar/sandbox/crystal/termisu/src/termisu/ffi/layout.cr)
- [include/termisu/ffi.h](/home/omar/sandbox/crystal/termisu/include/termisu/ffi.h)
@@ -0,0 +1,11 @@
{
"extends": "../../tsconfig.base.json",
Comment on lines +1 to +3
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
Comment on lines +5 to +6
| Package | Path |
| ---------------------------------- | ------------------------------------ |
Comment on lines +164 to +175
- [src/termisu/event/poller.cr](/home/omar/sandbox/crystal/termisu/src/termisu/event/poller.cr)
- [src/termisu/event/poller/linux.cr](/home/omar/sandbox/crystal/termisu/src/termisu/event/poller/linux.cr)
- [src/termisu/event/poller/kqueue.cr](/home/omar/sandbox/crystal/termisu/src/termisu/event/poller/kqueue.cr)
- [src/termisu/event/poller/poll.cr](/home/omar/sandbox/crystal/termisu/src/termisu/event/poller/poll.cr)
- [src/termisu/tty.cr](/home/omar/sandbox/crystal/termisu/src/termisu/tty.cr)
- [src/termisu/terminal/backend.cr](/home/omar/sandbox/crystal/termisu/src/termisu/terminal/backend.cr)
- [src/termisu/ffi/exports.cr](/home/omar/sandbox/crystal/termisu/src/termisu/ffi/exports.cr)
- [src/termisu/ffi/layout.cr](/home/omar/sandbox/crystal/termisu/src/termisu/ffi/layout.cr)
- [javascript/core/src/native.ts](/home/omar/sandbox/crystal/termisu/javascript/core/src/native.ts)
- [javascript/core/src/termisu.ts](/home/omar/sandbox/crystal/termisu/javascript/core/src/termisu.ts)
- [javascript/platform/src/index.ts](/home/omar/sandbox/crystal/termisu/javascript/platform/src/index.ts)
- [javascript/runtime/src/index.ts](/home/omar/sandbox/crystal/termisu/javascript/runtime/src/index.ts)
Comment on lines +6 to +13
"baseUrl": ".",
"paths": {
"@termisu/*": [
"javascript/*/src/index.ts",
"javascript/framework/*/src/index.ts",
"javascript/starter/*/src/index.ts"
]
},
@@ -0,0 +1,11 @@
{
"extends": "../../tsconfig.base.json",
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 17

🧹 Nitpick comments (4)
javascript/framework/react/tsconfig.json (1)

10-10: Consider including .tsx files for React adapter.

The include pattern only covers .ts files. If this React adapter will contain JSX components, you'll need to also include .tsx files.

📝 Suggested change
-  "include": ["src/**/*.ts"]
+  "include": ["src/**/*.ts", "src/**/*.tsx"]
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@javascript/framework/react/tsconfig.json` at line 10, The tsconfig.json
include pattern currently only matches TypeScript files ("include":
["src/**/*.ts"]); update the tsconfig.json include setting used by the React
adapter to also match TSX files by adding the .tsx glob (e.g., include both
"src/**/*.ts" and "src/**/*.tsx" or a combined pattern like "src/**/*.{ts,tsx}")
so React components with JSX are compiled; modify the "include" array in
tsconfig.json accordingly.
javascript/native/linux/x64/gnu/package.json (1)

6-7: Add explicit publish access for scoped package.

Line 6 marks the package as publishable, but scoped packages can still publish as restricted by default. Set publishConfig.access explicitly to avoid release-time surprises.

Suggested change
   "private": false,
+  "publishConfig": {
+    "access": "public"
+  },
   "os": ["linux"],
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@javascript/native/linux/x64/gnu/package.json` around lines 6 - 7, The
package.json currently sets "private": false but doesn't specify publish access
for a scoped package; add an explicit publishConfig object with "access":
"public" (i.e., set publishConfig.access) to ensure the package can be published
as public rather than defaulting to restricted for scoped packages—edit
package.json to include publishConfig with access set to "public".
javascript/create-tui/package.json (1)

25-29: Consider if starter dependencies should be devDependencies.

The dependencies on starter packages (@termisu/next-starter, @termisu/nuxt-starter, @termisu/sveltekit-starter) are listed as runtime dependencies. If the CLI only reads template files or metadata from these packages at scaffold-time (rather than bundling them into the output), they could be devDependencies to reduce install footprint for end users.

However, if the starters are dynamically resolved/imported at runtime, keeping them as dependencies is correct.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@javascript/create-tui/package.json` around lines 25 - 29, The package.json
currently lists the starter packages "@termisu/next-starter",
"@termisu/nuxt-starter", and "@termisu/sveltekit-starter" under "dependencies"
but they may only be used at scaffold-time; determine whether these packages are
imported/required at runtime (search for dynamic imports or require calls of
those exact package names in your CLI code) — if they are only used during
development/scaffolding, move them from "dependencies" to "devDependencies" in
package.json to reduce the runtime install footprint; if they are resolved or
imported dynamically at runtime, leave them in "dependencies" and ensure any
runtime import logic (the code that references these package names) handles
missing packages gracefully.
javascript/starter/sveltekit/package.json (1)

16-24: Missing devDependencies for build tooling.

The clean script uses rimraf and build:types/typecheck use tsc, but neither rimraf nor typescript are declared as dependencies. While these may be hoisted from the workspace root, explicitly declaring them ensures the package can be built in isolation and documents the actual requirements.

📦 Proposed addition
   "dependencies": {
     "@termisu/svelte": "workspace:*"
   },
+  "devDependencies": {
+    "rimraf": "^6.0.0",
+    "typescript": "^5.9.0"
+  },
   "license": "MIT"
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@javascript/starter/sveltekit/package.json` around lines 16 - 24, Add missing
devDependencies used by the package scripts: declare "rimraf" and "typescript"
under devDependencies so the "clean" script (rimraf) and
"build:types"/"typecheck" (tsc) work when the package is built in isolation;
update package.json's devDependencies to include rimraf and typescript (matching
the versions used in the workspace or a compatible semver) and keep the existing
script names ("clean", "build:types", "typecheck") unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@architecture/core-architecture.md`:
- Line 154: Change the phrase "FreeBSD/OpenBSD specific" to the hyphenated
compound adjective "FreeBSD/OpenBSD-specific" where it describes the TTY open
mode branch (the sentence mentioning `TTY` uses a FreeBSD/OpenBSD specific open
mode branch) to correct compound modifier style.
- Around line 192-206: The listed links use local absolute paths and must be
converted to repo-relative links so they work for all readers: update each link
(e.g., src/termisu.cr, src/termisu/terminal.cr, src/termisu/buffer.cr,
src/termisu/render_state.cr, src/termisu/event/loop.cr,
src/termisu/event/source/input.cr, src/termisu/event/source/resize.cr,
src/termisu/event/source/timer.cr, src/termisu/event/source/system_timer.cr,
src/termisu/event/poller.cr, src/termisu/ffi/exports.cr,
src/termisu/ffi/core.cr, src/termisu/ffi/runtime.cr, src/termisu/ffi/layout.cr,
include/termisu/ffi.h) to use repository-relative paths (e.g.,
[src/termisu.cr](src/termisu.cr)) instead of /home/omar/... so the links resolve
correctly for everyone.

In `@architecture/js-runtime-ffi-architecture.md`:
- Around line 164-175: The documentation contains absolute local paths like
/home/omar/sandbox/crystal/termisu/... which will not resolve for other
contributors; update the links on the referenced block to use
repository-relative paths instead (e.g., src/termisu/event/poller.cr,
src/termisu/event/poller/linux.cr, src/termisu/event/poller/kqueue.cr,
src/termisu/event/poller/poll.cr, src/termisu/tty.cr,
src/termisu/terminal/backend.cr, src/termisu/ffi/exports.cr,
src/termisu/ffi/layout.cr, javascript/core/src/native.ts,
javascript/core/src/termisu.ts, javascript/platform/src/index.ts,
javascript/runtime/src/index.ts) so they point to the files relative to the repo
root (or to the correct GitHub paths) rather than the local /home/omar/...
absolute paths.

In `@javascript/create-tui/src/cli.ts`:
- Around line 1-3: The import in cli.ts uses a relative import without a .js
extension which will break under Node ESM output; update the import that
references the symbol starterIds to use an explicit .js extension (import from
"./index.js") and scan other relative imports in the same module for the same
issue so the built ESM output from bun works in Node.

In `@javascript/framework/solid/tsconfig.json`:
- Line 2: The "extends" entry in the tsconfig.json currently points to
"../../tsconfig.base.json" which resolves to a non-existent
javascript/tsconfig.base.json; update the "extends" value (key: extends) in
javascript/framework/solid/tsconfig.json from "../../tsconfig.base.json" to
"../../../tsconfig.base.json" so it correctly resolves to the repository root
tsconfig.base.json and allows the project to inherit the shared base config.

In `@javascript/framework/svelte/tsconfig.json`:
- Line 2: The extends path in javascript/framework/svelte/tsconfig.json is
incorrect and points to a non-existent javascript/tsconfig.base.json; update the
"extends" property in that tsconfig.json to reference the shared root
tsconfig.base.json by climbing three directory levels from the Svelte package
(i.e., change the extends value to point to the root-level tsconfig.base.json)
so it matches other packages at the same depth (like javascript/starter/next and
javascript/starter/nuxt).

In `@javascript/native/darwin/x64/README.md`:
- Around line 3-5: The first line "Native target package scaffold for - OS:
darwin" mixes prose and the first bullet; split the heading/prose ("Native
target package scaffold for") onto its own line, add a blank line, and place
each list item on its own line as separate bullets ("- OS: darwin", "- CPU:
x64", "- libc: n/a") so the markdown renders correctly.

In `@javascript/native/freebsd/arm64/README.md`:
- Around line 3-5: The README's target summary mixes prose and list dashes
("Native target package scaffold for - OS: freebsd"), breaking the bullet list;
update the block so the opening sentence is separate and the OS/CPU/libc lines
are proper list items (e.g., a sentence "Native target package scaffold for:"
followed by three bullet lines "OS: freebsd", "CPU: arm64", "libc: n/a") to fix
the malformed markdown list formatting.

In `@javascript/native/freebsd/x64/README.md`:
- Around line 3-5: The README currently has a malformed list where the line
"Native target package scaffold for - OS: freebsd" combines prose with the first
bullet; split the header/prose from the bullet list and format the items as
separate bullets by moving "OS: freebsd" onto its own line prefixed with a
hyphen and ensuring "CPU: x64" and "libc: n/a" are each on their own
hyphen-prefixed lines (look for the exact strings "Native target package
scaffold for - OS: freebsd", "CPU: x64", and "libc: n/a" and correct them to a
header or sentence followed by a three-item bullet list).

In `@javascript/native/linux/arm64/gnu/README.md`:
- Around line 3-5: The README line mixes prose and list syntax; change the
heading sentence "Native target package scaffold for" to a standalone sentence
or header (e.g., "Native target package scaffold") and convert the combined "-
OS: linux - CPU: arm64 - libc: glibc" into a proper Markdown bullet list with
each item on its own line prefixed by "- " (e.g., "- OS: linux", "- CPU: arm64",
"- libc: glibc") so the intro and bullets are clearly separated; update the top
text that currently reads "Native target package scaffold for - OS: linux - CPU:
arm64 - libc: glibc" accordingly.

In `@javascript/native/linux/arm64/musl/README.md`:
- Around line 3-5: The README's first line merges the intro with a list item
("Native target package scaffold for - OS: linux"), breaking Markdown list
rendering; split that into an intro sentence and a proper bullet list by moving
the dash off the intro line so the file reads something like a standalone intro
line (e.g., "Native target package scaffold for:") followed by separate lines
beginning with "- OS: linux", "- CPU: arm64", "- libc: musl" to restore correct
Markdown list formatting.

In `@javascript/native/linux/x64/gnu/README.md`:
- Around line 3-5: The intro line "Native target package scaffold for - OS:
linux" is malformed—replace it with a proper sentence or header (e.g., "Native
target package scaffold for:") and convert the following lines into a Markdown
list of items ("- OS: linux", "- CPU: x64", "- libc: glibc") so the header and
list are separated and render correctly; locate the text "Native target package
scaffold for - OS: linux" in the README.md and update it accordingly.

In `@javascript/platform/package.json`:
- Around line 22-31: The package.json currently contains "workspace:*" entries
in optionalDependencies which will be published as-is and break npm consumers;
update the release process to either use bun publish or add a prepublish (or
prepack) script that rewrites all "workspace:*" values in optionalDependencies
to concrete semver versions (resolving them from your workspace manifests or
lockfile) before npm publish, and verify the generated tarball (npm pack)
contains resolved versions rather than workspace:*.

In `@javascript/platform/src/index.ts`:
- Around line 11-23: detectTarget currently always returns "gnu" Linux variants,
causing musl-based systems to get wrong packages; update detectTarget to detect
the libc family (use detect-libc's familySync) when platform === "linux" and
choose "musl" vs "gnu" accordingly so it returns "linux-x64-musl" or
"linux-x64-gnu" (and same for arm64). Modify import/usage to call familySync()
and map its result into the target string used by detectTarget; ensure the
returned values match the existing PlatformTarget/nativePackageByTarget keys.

In `@javascript/reconciler/package.json`:
- Line 17: The reconciler package.json build script currently sets the Bun build
target to "--target bun"; update the "build" npm script (the "build" entry in
javascript/reconciler/package.json) to use "--target node" instead of "--target
bun" so consumers match framework adapters, and apply the same change to the
equivalent "build" script in javascript/runtime/package.json to keep runtime
consistent.

In `@javascript/runtime/package.json`:
- Line 17: The build scripts for the runtime and reconciler packages currently
use "--target bun"; update the "build" script in both package.json files for the
runtime and reconciler packages to use "--target node" instead of "--target bun"
so the produced artifacts match the frameworks that target Node; locate the
"build" npm script entries (the "build" key) in each package.json and replace
the target flag, then run the package builds to verify no Bun-specific APIs are
required.

In `@javascript/runtime/src/index.ts`:
- Around line 5-9: The returned object from createRuntime currently exposes the
caller's options object directly (options), allowing external mutation; fix this
by returning a copy instead (e.g., shallow-clone the options object) so the
runtime retains its own immutable config snapshot—update createRuntime to assign
options: { ...options } (or a deep clone if nested mutability is a concern) so
callers cannot mutate the runtime via the original options reference.

---

Nitpick comments:
In `@javascript/create-tui/package.json`:
- Around line 25-29: The package.json currently lists the starter packages
"@termisu/next-starter", "@termisu/nuxt-starter", and
"@termisu/sveltekit-starter" under "dependencies" but they may only be used at
scaffold-time; determine whether these packages are imported/required at runtime
(search for dynamic imports or require calls of those exact package names in
your CLI code) — if they are only used during development/scaffolding, move them
from "dependencies" to "devDependencies" in package.json to reduce the runtime
install footprint; if they are resolved or imported dynamically at runtime,
leave them in "dependencies" and ensure any runtime import logic (the code that
references these package names) handles missing packages gracefully.

In `@javascript/framework/react/tsconfig.json`:
- Line 10: The tsconfig.json include pattern currently only matches TypeScript
files ("include": ["src/**/*.ts"]); update the tsconfig.json include setting
used by the React adapter to also match TSX files by adding the .tsx glob (e.g.,
include both "src/**/*.ts" and "src/**/*.tsx" or a combined pattern like
"src/**/*.{ts,tsx}") so React components with JSX are compiled; modify the
"include" array in tsconfig.json accordingly.

In `@javascript/native/linux/x64/gnu/package.json`:
- Around line 6-7: The package.json currently sets "private": false but doesn't
specify publish access for a scoped package; add an explicit publishConfig
object with "access": "public" (i.e., set publishConfig.access) to ensure the
package can be published as public rather than defaulting to restricted for
scoped packages—edit package.json to include publishConfig with access set to
"public".

In `@javascript/starter/sveltekit/package.json`:
- Around line 16-24: Add missing devDependencies used by the package scripts:
declare "rimraf" and "typescript" under devDependencies so the "clean" script
(rimraf) and "build:types"/"typecheck" (tsc) work when the package is built in
isolation; update package.json's devDependencies to include rimraf and
typescript (matching the versions used in the workspace or a compatible semver)
and keep the existing script names ("clean", "build:types", "typecheck")
unchanged.
🪄 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: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 30ea9254-3283-4c93-b984-0df35edd6d4e

📥 Commits

Reviewing files that changed from the base of the PR and between 4940270 and f87cdb2.

⛔ Files ignored due to path filters (1)
  • bun.lock is excluded by !**/*.lock
📒 Files selected for processing (87)
  • .gitignore
  • architecture/README.md
  • architecture/core-architecture.md
  • architecture/js-runtime-ffi-architecture.md
  • javascript/README.md
  • javascript/create-tui/.gitignore
  • javascript/create-tui/README.md
  • javascript/create-tui/package.json
  • javascript/create-tui/src/cli.ts
  • javascript/create-tui/src/index.ts
  • javascript/create-tui/tsconfig.json
  • javascript/framework/react/.gitignore
  • javascript/framework/react/README.md
  • javascript/framework/react/package.json
  • javascript/framework/react/src/index.ts
  • javascript/framework/react/tsconfig.json
  • javascript/framework/solid/.gitignore
  • javascript/framework/solid/README.md
  • javascript/framework/solid/package.json
  • javascript/framework/solid/src/index.ts
  • javascript/framework/solid/tsconfig.json
  • javascript/framework/svelte/.gitignore
  • javascript/framework/svelte/README.md
  • javascript/framework/svelte/package.json
  • javascript/framework/svelte/src/index.ts
  • javascript/framework/svelte/tsconfig.json
  • javascript/framework/vue/.gitignore
  • javascript/framework/vue/README.md
  • javascript/framework/vue/package.json
  • javascript/framework/vue/src/index.ts
  • javascript/framework/vue/tsconfig.json
  • javascript/native/darwin/arm64/README.md
  • javascript/native/darwin/arm64/manifest.json
  • javascript/native/darwin/arm64/package.json
  • javascript/native/darwin/x64/README.md
  • javascript/native/darwin/x64/manifest.json
  • javascript/native/darwin/x64/package.json
  • javascript/native/freebsd/arm64/README.md
  • javascript/native/freebsd/arm64/manifest.json
  • javascript/native/freebsd/arm64/package.json
  • javascript/native/freebsd/x64/README.md
  • javascript/native/freebsd/x64/manifest.json
  • javascript/native/freebsd/x64/package.json
  • javascript/native/linux/arm64/gnu/README.md
  • javascript/native/linux/arm64/gnu/manifest.json
  • javascript/native/linux/arm64/gnu/package.json
  • javascript/native/linux/arm64/musl/README.md
  • javascript/native/linux/arm64/musl/manifest.json
  • javascript/native/linux/arm64/musl/package.json
  • javascript/native/linux/x64/gnu/README.md
  • javascript/native/linux/x64/gnu/manifest.json
  • javascript/native/linux/x64/gnu/package.json
  • javascript/native/linux/x64/musl/README.md
  • javascript/native/linux/x64/musl/manifest.json
  • javascript/native/linux/x64/musl/package.json
  • javascript/platform/.gitignore
  • javascript/platform/README.md
  • javascript/platform/package.json
  • javascript/platform/src/index.ts
  • javascript/platform/tsconfig.json
  • javascript/reconciler/.gitignore
  • javascript/reconciler/README.md
  • javascript/reconciler/package.json
  • javascript/reconciler/src/index.ts
  • javascript/reconciler/tsconfig.json
  • javascript/runtime/.gitignore
  • javascript/runtime/README.md
  • javascript/runtime/package.json
  • javascript/runtime/src/index.ts
  • javascript/runtime/tsconfig.json
  • javascript/starter/next/.gitignore
  • javascript/starter/next/README.md
  • javascript/starter/next/package.json
  • javascript/starter/next/src/index.ts
  • javascript/starter/next/tsconfig.json
  • javascript/starter/nuxt/.gitignore
  • javascript/starter/nuxt/README.md
  • javascript/starter/nuxt/package.json
  • javascript/starter/nuxt/src/index.ts
  • javascript/starter/nuxt/tsconfig.json
  • javascript/starter/sveltekit/.gitignore
  • javascript/starter/sveltekit/README.md
  • javascript/starter/sveltekit/package.json
  • javascript/starter/sveltekit/src/index.ts
  • javascript/starter/sveltekit/tsconfig.json
  • package.json
  • tsconfig.base.json

```

Other platform branches:
- `TTY` uses a FreeBSD/OpenBSD specific open mode branch.
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Use hyphenated compound modifier.

Line 154 should use “FreeBSD/OpenBSD-specific” for correct compound adjective style.

🧰 Tools
🪛 LanguageTool

[grammar] ~154-~154: Use a hyphen to join words.
Context: ...branches: - TTY uses a FreeBSD/OpenBSD specific open mode branch. - terminal si...

(QB_NEW_EN_HYPHEN)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@architecture/core-architecture.md` at line 154, Change the phrase
"FreeBSD/OpenBSD specific" to the hyphenated compound adjective
"FreeBSD/OpenBSD-specific" where it describes the TTY open mode branch (the
sentence mentioning `TTY` uses a FreeBSD/OpenBSD specific open mode branch) to
correct compound modifier style.

Comment on lines +192 to +206
- [src/termisu.cr](/home/omar/sandbox/crystal/termisu/src/termisu.cr)
- [src/termisu/terminal.cr](/home/omar/sandbox/crystal/termisu/src/termisu/terminal.cr)
- [src/termisu/buffer.cr](/home/omar/sandbox/crystal/termisu/src/termisu/buffer.cr)
- [src/termisu/render_state.cr](/home/omar/sandbox/crystal/termisu/src/termisu/render_state.cr)
- [src/termisu/event/loop.cr](/home/omar/sandbox/crystal/termisu/src/termisu/event/loop.cr)
- [src/termisu/event/source/input.cr](/home/omar/sandbox/crystal/termisu/src/termisu/event/source/input.cr)
- [src/termisu/event/source/resize.cr](/home/omar/sandbox/crystal/termisu/src/termisu/event/source/resize.cr)
- [src/termisu/event/source/timer.cr](/home/omar/sandbox/crystal/termisu/src/termisu/event/source/timer.cr)
- [src/termisu/event/source/system_timer.cr](/home/omar/sandbox/crystal/termisu/src/termisu/event/source/system_timer.cr)
- [src/termisu/event/poller.cr](/home/omar/sandbox/crystal/termisu/src/termisu/event/poller.cr)
- [src/termisu/ffi/exports.cr](/home/omar/sandbox/crystal/termisu/src/termisu/ffi/exports.cr)
- [src/termisu/ffi/core.cr](/home/omar/sandbox/crystal/termisu/src/termisu/ffi/core.cr)
- [src/termisu/ffi/runtime.cr](/home/omar/sandbox/crystal/termisu/src/termisu/ffi/runtime.cr)
- [src/termisu/ffi/layout.cr](/home/omar/sandbox/crystal/termisu/src/termisu/ffi/layout.cr)
- [include/termisu/ffi.h](/home/omar/sandbox/crystal/termisu/include/termisu/ffi.h)
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Replace local absolute paths with repo-relative links.

Lines 192-206 currently point to local machine paths, so links will break for all other readers.

Suggested change
-- [src/termisu.cr](/home/omar/sandbox/crystal/termisu/src/termisu.cr)
-- [src/termisu/terminal.cr](/home/omar/sandbox/crystal/termisu/src/termisu/terminal.cr)
-- [src/termisu/buffer.cr](/home/omar/sandbox/crystal/termisu/src/termisu/buffer.cr)
-- [src/termisu/render_state.cr](/home/omar/sandbox/crystal/termisu/src/termisu/render_state.cr)
-- [src/termisu/event/loop.cr](/home/omar/sandbox/crystal/termisu/src/termisu/event/loop.cr)
-- [src/termisu/event/source/input.cr](/home/omar/sandbox/crystal/termisu/src/termisu/event/source/input.cr)
-- [src/termisu/event/source/resize.cr](/home/omar/sandbox/crystal/termisu/src/termisu/event/source/resize.cr)
-- [src/termisu/event/source/timer.cr](/home/omar/sandbox/crystal/termisu/src/termisu/event/source/timer.cr)
-- [src/termisu/event/source/system_timer.cr](/home/omar/sandbox/crystal/termisu/src/termisu/event/source/system_timer.cr)
-- [src/termisu/event/poller.cr](/home/omar/sandbox/crystal/termisu/src/termisu/event/poller.cr)
-- [src/termisu/ffi/exports.cr](/home/omar/sandbox/crystal/termisu/src/termisu/ffi/exports.cr)
-- [src/termisu/ffi/core.cr](/home/omar/sandbox/crystal/termisu/src/termisu/ffi/core.cr)
-- [src/termisu/ffi/runtime.cr](/home/omar/sandbox/crystal/termisu/src/termisu/ffi/runtime.cr)
-- [src/termisu/ffi/layout.cr](/home/omar/sandbox/crystal/termisu/src/termisu/ffi/layout.cr)
-- [include/termisu/ffi.h](/home/omar/sandbox/crystal/termisu/include/termisu/ffi.h)
+- [src/termisu.cr](../src/termisu.cr)
+- [src/termisu/terminal.cr](../src/termisu/terminal.cr)
+- [src/termisu/buffer.cr](../src/termisu/buffer.cr)
+- [src/termisu/render_state.cr](../src/termisu/render_state.cr)
+- [src/termisu/event/loop.cr](../src/termisu/event/loop.cr)
+- [src/termisu/event/source/input.cr](../src/termisu/event/source/input.cr)
+- [src/termisu/event/source/resize.cr](../src/termisu/event/source/resize.cr)
+- [src/termisu/event/source/timer.cr](../src/termisu/event/source/timer.cr)
+- [src/termisu/event/source/system_timer.cr](../src/termisu/event/source/system_timer.cr)
+- [src/termisu/event/poller.cr](../src/termisu/event/poller.cr)
+- [src/termisu/ffi/exports.cr](../src/termisu/ffi/exports.cr)
+- [src/termisu/ffi/core.cr](../src/termisu/ffi/core.cr)
+- [src/termisu/ffi/runtime.cr](../src/termisu/ffi/runtime.cr)
+- [src/termisu/ffi/layout.cr](../src/termisu/ffi/layout.cr)
+- [include/termisu/ffi.h](../include/termisu/ffi.h)
📝 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
- [src/termisu.cr](/home/omar/sandbox/crystal/termisu/src/termisu.cr)
- [src/termisu/terminal.cr](/home/omar/sandbox/crystal/termisu/src/termisu/terminal.cr)
- [src/termisu/buffer.cr](/home/omar/sandbox/crystal/termisu/src/termisu/buffer.cr)
- [src/termisu/render_state.cr](/home/omar/sandbox/crystal/termisu/src/termisu/render_state.cr)
- [src/termisu/event/loop.cr](/home/omar/sandbox/crystal/termisu/src/termisu/event/loop.cr)
- [src/termisu/event/source/input.cr](/home/omar/sandbox/crystal/termisu/src/termisu/event/source/input.cr)
- [src/termisu/event/source/resize.cr](/home/omar/sandbox/crystal/termisu/src/termisu/event/source/resize.cr)
- [src/termisu/event/source/timer.cr](/home/omar/sandbox/crystal/termisu/src/termisu/event/source/timer.cr)
- [src/termisu/event/source/system_timer.cr](/home/omar/sandbox/crystal/termisu/src/termisu/event/source/system_timer.cr)
- [src/termisu/event/poller.cr](/home/omar/sandbox/crystal/termisu/src/termisu/event/poller.cr)
- [src/termisu/ffi/exports.cr](/home/omar/sandbox/crystal/termisu/src/termisu/ffi/exports.cr)
- [src/termisu/ffi/core.cr](/home/omar/sandbox/crystal/termisu/src/termisu/ffi/core.cr)
- [src/termisu/ffi/runtime.cr](/home/omar/sandbox/crystal/termisu/src/termisu/ffi/runtime.cr)
- [src/termisu/ffi/layout.cr](/home/omar/sandbox/crystal/termisu/src/termisu/ffi/layout.cr)
- [include/termisu/ffi.h](/home/omar/sandbox/crystal/termisu/include/termisu/ffi.h)
- [src/termisu.cr](../src/termisu.cr)
- [src/termisu/terminal.cr](../src/termisu/terminal.cr)
- [src/termisu/buffer.cr](../src/termisu/buffer.cr)
- [src/termisu/render_state.cr](../src/termisu/render_state.cr)
- [src/termisu/event/loop.cr](../src/termisu/event/loop.cr)
- [src/termisu/event/source/input.cr](../src/termisu/event/source/input.cr)
- [src/termisu/event/source/resize.cr](../src/termisu/event/source/resize.cr)
- [src/termisu/event/source/timer.cr](../src/termisu/event/source/timer.cr)
- [src/termisu/event/source/system_timer.cr](../src/termisu/event/source/system_timer.cr)
- [src/termisu/event/poller.cr](../src/termisu/event/poller.cr)
- [src/termisu/ffi/exports.cr](../src/termisu/ffi/exports.cr)
- [src/termisu/ffi/core.cr](../src/termisu/ffi/core.cr)
- [src/termisu/ffi/runtime.cr](../src/termisu/ffi/runtime.cr)
- [src/termisu/ffi/layout.cr](../src/termisu/ffi/layout.cr)
- [include/termisu/ffi.h](../include/termisu/ffi.h)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@architecture/core-architecture.md` around lines 192 - 206, The listed links
use local absolute paths and must be converted to repo-relative links so they
work for all readers: update each link (e.g., src/termisu.cr,
src/termisu/terminal.cr, src/termisu/buffer.cr, src/termisu/render_state.cr,
src/termisu/event/loop.cr, src/termisu/event/source/input.cr,
src/termisu/event/source/resize.cr, src/termisu/event/source/timer.cr,
src/termisu/event/source/system_timer.cr, src/termisu/event/poller.cr,
src/termisu/ffi/exports.cr, src/termisu/ffi/core.cr, src/termisu/ffi/runtime.cr,
src/termisu/ffi/layout.cr, include/termisu/ffi.h) to use repository-relative
paths (e.g., [src/termisu.cr](src/termisu.cr)) instead of /home/omar/... so the
links resolve correctly for everyone.

Comment on lines +164 to +175
- [src/termisu/event/poller.cr](/home/omar/sandbox/crystal/termisu/src/termisu/event/poller.cr)
- [src/termisu/event/poller/linux.cr](/home/omar/sandbox/crystal/termisu/src/termisu/event/poller/linux.cr)
- [src/termisu/event/poller/kqueue.cr](/home/omar/sandbox/crystal/termisu/src/termisu/event/poller/kqueue.cr)
- [src/termisu/event/poller/poll.cr](/home/omar/sandbox/crystal/termisu/src/termisu/event/poller/poll.cr)
- [src/termisu/tty.cr](/home/omar/sandbox/crystal/termisu/src/termisu/tty.cr)
- [src/termisu/terminal/backend.cr](/home/omar/sandbox/crystal/termisu/src/termisu/terminal/backend.cr)
- [src/termisu/ffi/exports.cr](/home/omar/sandbox/crystal/termisu/src/termisu/ffi/exports.cr)
- [src/termisu/ffi/layout.cr](/home/omar/sandbox/crystal/termisu/src/termisu/ffi/layout.cr)
- [javascript/core/src/native.ts](/home/omar/sandbox/crystal/termisu/javascript/core/src/native.ts)
- [javascript/core/src/termisu.ts](/home/omar/sandbox/crystal/termisu/javascript/core/src/termisu.ts)
- [javascript/platform/src/index.ts](/home/omar/sandbox/crystal/termisu/javascript/platform/src/index.ts)
- [javascript/runtime/src/index.ts](/home/omar/sandbox/crystal/termisu/javascript/runtime/src/index.ts)
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Replace absolute local source links with repository-relative paths.

On Line 164 through Line 175, links point to /home/omar/..., which won’t resolve for other contributors or on GitHub.

🛠️ Proposed doc-link fix
-- [src/termisu/event/poller.cr](/home/omar/sandbox/crystal/termisu/src/termisu/event/poller.cr)
-- [src/termisu/event/poller/linux.cr](/home/omar/sandbox/crystal/termisu/src/termisu/event/poller/linux.cr)
-- [src/termisu/event/poller/kqueue.cr](/home/omar/sandbox/crystal/termisu/src/termisu/event/poller/kqueue.cr)
-- [src/termisu/event/poller/poll.cr](/home/omar/sandbox/crystal/termisu/src/termisu/event/poller/poll.cr)
-- [src/termisu/tty.cr](/home/omar/sandbox/crystal/termisu/src/termisu/tty.cr)
-- [src/termisu/terminal/backend.cr](/home/omar/sandbox/crystal/termisu/src/termisu/terminal/backend.cr)
-- [src/termisu/ffi/exports.cr](/home/omar/sandbox/crystal/termisu/src/termisu/ffi/exports.cr)
-- [src/termisu/ffi/layout.cr](/home/omar/sandbox/crystal/termisu/src/termisu/ffi/layout.cr)
-- [javascript/core/src/native.ts](/home/omar/sandbox/crystal/termisu/javascript/core/src/native.ts)
-- [javascript/core/src/termisu.ts](/home/omar/sandbox/crystal/termisu/javascript/core/src/termisu.ts)
-- [javascript/platform/src/index.ts](/home/omar/sandbox/crystal/termisu/javascript/platform/src/index.ts)
-- [javascript/runtime/src/index.ts](/home/omar/sandbox/crystal/termisu/javascript/runtime/src/index.ts)
+- [src/termisu/event/poller.cr](../src/termisu/event/poller.cr)
+- [src/termisu/event/poller/linux.cr](../src/termisu/event/poller/linux.cr)
+- [src/termisu/event/poller/kqueue.cr](../src/termisu/event/poller/kqueue.cr)
+- [src/termisu/event/poller/poll.cr](../src/termisu/event/poller/poll.cr)
+- [src/termisu/tty.cr](../src/termisu/tty.cr)
+- [src/termisu/terminal/backend.cr](../src/termisu/terminal/backend.cr)
+- [src/termisu/ffi/exports.cr](../src/termisu/ffi/exports.cr)
+- [src/termisu/ffi/layout.cr](../src/termisu/ffi/layout.cr)
+- [javascript/core/src/native.ts](../javascript/core/src/native.ts)
+- [javascript/core/src/termisu.ts](../javascript/core/src/termisu.ts)
+- [javascript/platform/src/index.ts](../javascript/platform/src/index.ts)
+- [javascript/runtime/src/index.ts](../javascript/runtime/src/index.ts)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@architecture/js-runtime-ffi-architecture.md` around lines 164 - 175, The
documentation contains absolute local paths like
/home/omar/sandbox/crystal/termisu/... which will not resolve for other
contributors; update the links on the referenced block to use
repository-relative paths instead (e.g., src/termisu/event/poller.cr,
src/termisu/event/poller/linux.cr, src/termisu/event/poller/kqueue.cr,
src/termisu/event/poller/poll.cr, src/termisu/tty.cr,
src/termisu/terminal/backend.cr, src/termisu/ffi/exports.cr,
src/termisu/ffi/layout.cr, javascript/core/src/native.ts,
javascript/core/src/termisu.ts, javascript/platform/src/index.ts,
javascript/runtime/src/index.ts) so they point to the files relative to the repo
root (or to the correct GitHub paths) rather than the local /home/omar/...
absolute paths.

Comment on lines +1 to +3
#!/usr/bin/env node

import { starterIds } from "./index";
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "Inspect create-tui package runtime fields:"
rg -n '"name"|"type"|"bin"|"main"|"exports"' javascript/create-tui/package.json -C1

echo
echo "Inspect create-tui tsconfig module settings:"
rg -n '"module"|"moduleResolution"|"outDir"' javascript/create-tui/tsconfig.json -C1 || true

echo
echo "Find extensionless relative imports in create-tui source:"
rg -nP --type=ts 'from\s+"\.\/[^".]+"' javascript/create-tui/src

Repository: omarluq/termisu

Length of output: 699


🏁 Script executed:

cat -n javascript/create-tui/tsconfig.json

Repository: omarluq/termisu

Length of output: 363


🏁 Script executed:

head -20 javascript/create-tui/dist/cli.js 2>/dev/null || echo "dist/ directory may not exist in sandbox"

Repository: omarluq/termisu

Length of output: 99


🏁 Script executed:

ls -la javascript/create-tui/dist/ 2>/dev/null || echo "No dist directory found"

Repository: omarluq/termisu

Length of output: 82


🏁 Script executed:

fd -e ts javascript/create-tui/src/ | head -20

Repository: omarluq/termisu

Length of output: 468


🏁 Script executed:

cat -n javascript/create-tui/tsconfig.base.json 2>/dev/null || cat -n tsconfig.base.json

Repository: omarluq/termisu

Length of output: 589


🏁 Script executed:

fd . javascript/create-tui/src/ --extension ts

Repository: omarluq/termisu

Length of output: 126


🏁 Script executed:

rg -n "moduleResolution|module|" javascript/create-tui/tsconfig.base.json

Repository: omarluq/termisu

Length of output: 139


🏁 Script executed:

rg -n "rewriteImportExtensions|emitDeclarationOnly|declaration" javascript/create-tui/tsconfig.json javascript/create-tui/tsconfig.base.json

Repository: omarluq/termisu

Length of output: 286


🏁 Script executed:

rg -A5 '"scripts"' javascript/create-tui/package.json

Repository: omarluq/termisu

Length of output: 361


🏁 Script executed:

fd -t f javascript/create-tui -name "esbuild*" -o -name "rollup*" -o -name ".swcrc"

Repository: omarluq/termisu

Length of output: 289


🌐 Web query:

Bun bundler --target node --format esm relative imports .js extension

💡 Result:

When you run bun build --target node --format esm, you’re generating Node ESM, where relative import specifiers must include a file extension (e.g. ./foo.js, not ./foo). This is a Node ESM rule (same as browsers). [2][3]

Can Bun “add .js extensions” for relative imports?

  • Not as a dedicated flag/option. Bun’s bundler docs list many CLI options (including --target, --format, --splitting, --no-bundle), but there’s no documented “rewrite specifiers / add extensions” option. [1]

What to do instead (practical options)

  • Best practice: write source imports with .js already (even in TS), so the emitted JS is Node-valid. [2][3]
  • If you are transpiling without bundling (bun build --no-bundle), Bun will “transpile only” and you should expect to need Node-valid specifiers in the emitted files (so: use .js in source or run a post-step rewrite). [1]
  • If you bundle into a single file, the extension issue typically disappears because there are no runtime relative imports left.
  • If you use code-splitting (--splitting), Bun will emit chunk files with .js names (and the generated cross-chunk imports are handled by the bundler). [1]

Sources: Bun bundler docs [1]; Node ESM extension requirement references [2][3].


Use explicit .js extension for Node ESM relative import.

The build process uses bun build --target node --format esm, which produces Node ESM code. Node ESM strictly requires explicit .js extensions for relative imports; Bun does not automatically rewrite these. Line 3 will fail at runtime without the extension.

Proposed fix
- import { starterIds } from "./index";
+ import { starterIds } from "./index.js";
📝 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
#!/usr/bin/env node
import { starterIds } from "./index";
#!/usr/bin/env node
import { starterIds } from "./index.js";
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@javascript/create-tui/src/cli.ts` around lines 1 - 3, The import in cli.ts
uses a relative import without a .js extension which will break under Node ESM
output; update the import that references the symbol starterIds to use an
explicit .js extension (import from "./index.js") and scan other relative
imports in the same module for the same issue so the built ESM output from bun
works in Node.

@@ -0,0 +1,11 @@
{
"extends": "../../tsconfig.base.json",
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

python - <<'PY'
import json
from pathlib import Path

p = Path("javascript/framework/solid/tsconfig.json")
cfg = json.loads(p.read_text())
ext = cfg.get("extends")
resolved = (p.parent / ext).resolve()
print("extends =", ext)
print("resolved =", resolved)
print("exists   =", resolved.exists())
PY

echo
echo "== tsconfig.base.json files in repo =="
fd -a tsconfig.base.json

Repository: omarluq/termisu

Length of output: 248


Fix incorrect extends path to resolve to root-level tsconfig.base.json.

The current path ../../tsconfig.base.json resolves to javascript/tsconfig.base.json, which does not exist. The base config is located at the repository root. Update to ../../../tsconfig.base.json to correctly resolve from javascript/framework/solid/:

Suggested fix
-  "extends": "../../tsconfig.base.json",
+  "extends": "../../../tsconfig.base.json",

Without this fix, the typecheck/build will fail to inherit the shared tsconfig settings.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@javascript/framework/solid/tsconfig.json` at line 2, The "extends" entry in
the tsconfig.json currently points to "../../tsconfig.base.json" which resolves
to a non-existent javascript/tsconfig.base.json; update the "extends" value
(key: extends) in javascript/framework/solid/tsconfig.json from
"../../tsconfig.base.json" to "../../../tsconfig.base.json" so it correctly
resolves to the repository root tsconfig.base.json and allows the project to
inherit the shared base config.

Comment on lines +22 to +31
"optionalDependencies": {
"@termisu/native-darwin-arm64": "workspace:*",
"@termisu/native-darwin-x64": "workspace:*",
"@termisu/native-freebsd-arm64": "workspace:*",
"@termisu/native-freebsd-x64": "workspace:*",
"@termisu/native-linux-arm64-gnu": "workspace:*",
"@termisu/native-linux-arm64-musl": "workspace:*",
"@termisu/native-linux-x64-gnu": "workspace:*",
"@termisu/native-linux-x64-musl": "workspace:*"
},
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

for pkg in \
  javascript/platform \
  javascript/runtime \
  javascript/reconciler \
  javascript/framework/react \
  javascript/framework/solid
do
  echo "=== $pkg ==="
  tarball=$(npm pack "$pkg" --silent)
  tar -xOf "$tarball" package/package.json | jq -r '
    .name as $name |
    "package=\($name)",
    "dependencies=" + ((.dependencies // {})|tojson),
    "optionalDependencies=" + ((.optionalDependencies // {})|tojson)
  '
  rm -f "$tarball"
done

Repository: omarluq/termisu

Length of output: 88


🏁 Script executed:

#!/bin/bash
# Explore repository structure
echo "=== Repository root structure ==="
git ls-files | head -30

echo -e "\n=== Package.json files ==="
find . -name "package.json" -type f | grep -E "(javascript|package\.json$)" | head -20

Repository: omarluq/termisu

Length of output: 1662


🏁 Script executed:

#!/bin/bash
# Check if workspace protocol is handled during packing
echo "=== Looking for packing/build configuration ==="
grep -r "workspace:" . --include="*.json" --include="*.js" --include="*.ts" 2>/dev/null | head -20

echo -e "\n=== Check root package.json for workspace config ==="
cat package.json 2>/dev/null | head -50

Repository: omarluq/termisu

Length of output: 3420


🏁 Script executed:

#!/bin/bash
# Read the specific package.json mentioned in the review
echo "=== javascript/platform/package.json ==="
cat javascript/platform/package.json 2>/dev/null

echo -e "\n=== Check if there's a build or pack script ==="
grep -A 5 '"scripts"' javascript/platform/package.json 2>/dev/null

Repository: omarluq/termisu

Length of output: 1575


🏁 Script executed:

#!/bin/bash
# Check the publish workflow
echo "=== publish-core.yml ==="
cat .github/workflows/publish-core.yml 2>/dev/null | head -100

echo -e "\n=== Check for publishConfig ==="
grep -r "publishConfig" . --include="*.json" 2>/dev/null

echo -e "\n=== Check native packages for version info ==="
cat javascript/native/darwin/arm64/package.json 2>/dev/null

Repository: omarluq/termisu

Length of output: 2784


🏁 Script executed:

#!/bin/bash
# Search for any build or packing logic that handles workspace:*
echo "=== Look for version rewriting or workspace handling ==="
grep -r "workspace:\|publishConfig\|version.*rewrite" javascript/ --include="*.json" --include="*.ts" --include="*.js" 2>/dev/null | head -20

echo -e "\n=== Check bun.lock or lockfile for version info ==="
ls -la | grep -E "lock|bun"

Repository: omarluq/termisu

Length of output: 1859


🏁 Script executed:

#!/bin/bash
# Check for .npmrc or bun configuration
echo "=== .npmrc and bun config ==="
cat .npmrc 2>/dev/null || echo "No .npmrc"
cat .bunrc 2>/dev/null || echo "No .bunrc"
cat bunfig.toml 2>/dev/null || echo "No bunfig.toml"

echo -e "\n=== Check javascript/core package.json (published package) ==="
cat javascript/core/package.json 2>/dev/null | head -40

echo -e "\n=== Check javascript/runtime package.json ==="
cat javascript/runtime/package.json 2>/dev/null

Repository: omarluq/termisu

Length of output: 2131


🌐 Web query:

bun workspace:* protocol npm publish rewritten

💡 Result:

workspace:* is the workspace protocol (popularized by pnpm/Yarn) and npm does not support it—so if you publish a package.json that still contains workspace:*, consumers installing with npm can fail (e.g., unsupported protocol). [2]

With Bun, this is handled for you: bun publish packs your package and automatically strips workspace: (and catalog:) protocols from the package.json, resolving them to real versions as needed in what gets published. Use bun publish --dry-run to verify the rewritten package.json before actually publishing. [1]

Sources: [1] Bun bun publish docs, [2] Andrew Nesbitt (Jan 18, 2026) on workspace protocol + npm limitations.


🌐 Web query:

npm workspace protocol optionalDependencies published package

💡 Result:

  • The workspace: protocol (e.g. workspace:*, workspace:^) is not supported by npm. If a published package’s package.json contains workspace: in any dependency field (including optionalDependencies), consumers installing with npm will typically fail with npm ERR! Unsupported URL Type "workspace:" (EUNSUPPORTEDPROTOCOL). [1][2][3]
  • npm does not automatically rewrite workspace: specifiers to real semver versions at publish time (unlike pnpm, which explicitly rewrites workspace: during pack/publish). [4]
  • If you rely on Yarn/pnpm to rewrite workspace ranges, be aware there have been edge cases/bugs (e.g., Yarn Berry historically not replacing workspace: for optionalDependencies when packing/publishing). [5]

What to do for publishable packages

  1. Ensure published package.json contains only real, registry-resolvable versions (no workspace:), including in optionalDependencies.
  2. Add a publish check: npm publish --dry-run (or npm pack) and inspect the tarball’s package/package.json to confirm no workspace: remains.
  3. If you want workspace convenience in-repo, use a tool/workflow that rewrites versions before publish (pnpm pack/publish rewrite behavior, or a prepack/prepublish script that replaces workspace: with actual versions). [4]

Sources:
[1] npm error example showing Unsupported URL Type "workspace:" (EUNSUPPORTEDPROTOCOL) https://dev-solve.com/posts/42036ca
[2] Overview noting npm doesn’t support the workspace protocol https://nesbitt.io/2026/01/18/workspaces-and-monorepos-in-package-managers.html
[3] npm workspaces docs (feature exists; distinct from workspace: protocol) https://docs.npmjs.com/cli/v8/using-npm/workspaces/
[4] pnpm docs: workspace: dependencies are replaced with real versions when packed/published https://cuyl.github.io/pnpm.github.io/next/workspaces
[5] Yarn Berry issue: workspace protocol not replaced for optionalDependencies yarnpkg/berry#4080


Verify and rewrite workspace:* before npm publishing.

The repository uses Bun locally but publishes via npm. Bun's automatic workspace protocol rewriting only applies to bun publish, not npm publish. Without explicit rewriting, workspace:* in optionalDependencies (lines 22–31) will leak into the published package, breaking npm consumers with EUNSUPPORTEDPROTOCOL errors.

Either use bun publish instead of npm-publish, or add a prepublish script to replace workspace:* with resolved versions. Verify the tarball contains concrete versions before publishing.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@javascript/platform/package.json` around lines 22 - 31, The package.json
currently contains "workspace:*" entries in optionalDependencies which will be
published as-is and break npm consumers; update the release process to either
use bun publish or add a prepublish (or prepack) script that rewrites all
"workspace:*" values in optionalDependencies to concrete semver versions
(resolving them from your workspace manifests or lockfile) before npm publish,
and verify the generated tarball (npm pack) contains resolved versions rather
than workspace:*.

Comment on lines +11 to +23
export const detectTarget = (): PlatformTarget | null => {
const platform = process.platform;
const arch = process.arch;

if (platform === "linux" && arch === "x64") return "linux-x64-gnu";
if (platform === "linux" && arch === "arm64") return "linux-arm64-gnu";
if (platform === "darwin" && arch === "x64") return "darwin-x64";
if (platform === "darwin" && arch === "arm64") return "darwin-arm64";
if (platform === "freebsd" && arch === "x64") return "freebsd-x64";
if (platform === "freebsd" && arch === "arm64") return "freebsd-arm64";

return null;
};
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🌐 Web query:

How to detect musl vs glibc libc in Node.js?

💡 Result:

Recommended (robust): use detect-libc

import { familySync, versionSync } from 'detect-libc';

const family = familySync();          // 'glibc' | 'musl' | null
const version = versionSync();        // e.g. '2.31' or '1.2.4' (or null)

console.log({ family, version });

detect-libc is specifically meant to detect glibc vs musl (and versions) on Linux. [1]

DIY (no dependency): check Node’s diagnostic report (glibc only)

On glibc systems, Node’s diagnostic report header includes glibcVersionRuntime. [2]

function libcFamily() {
  if (process.platform !== 'linux') return null;

  const report = process.report?.getReport?.();
  if (report?.header?.glibcVersionRuntime) return 'glibc';
  return 'musl'; // heuristic: if Linux and no glibc version, assume musl
}

console.log(libcFamily());

Safer DIY fallback: look for musl loader / libc filenames

A common heuristic is to scan for filenames like libc.musl- or ld-musl- (present on musl-based distros). [3]

import { readdirSync } from 'node:fs';

function looksLikeMusl() {
  for (const dir of ['/lib', '/usr/lib', '/lib64', '/usr/lib64']) {
    try {
      if (readdirSync(dir).some(f => f.includes('libc.musl-') || f.includes('ld-musl-'))) {
        return true;
      }
    } catch {}
  }
  return false;
}

Sources: detect-libc package docs [1], Node.js diagnostic report docs showing glibcVersionRuntime [2], example musl filename heuristic used in tooling [3].

[1] (npmjs.com)
[2] (nodejs.org)
[3] (fossies.org)

Citations:


🏁 Script executed:

# Find the type definition for PlatformTarget
fd -e ts -e tsx | head -20 | xargs grep -l "PlatformTarget"

Repository: omarluq/termisu

Length of output: 43


🏁 Script executed:

# Search for PlatformTarget type definition and nativePackageByTarget
rg "type PlatformTarget|PlatformTarget\s*=" -A 5 javascript/platform/src/

Repository: omarluq/termisu

Length of output: 388


🏁 Script executed:

# Check for nativePackageByTarget
rg "nativePackageByTarget" javascript/platform/src/ -A 15

Repository: omarluq/termisu

Length of output: 878


Linux musl detection is missing — Alpine and other musl-based systems will receive incorrect packages.

The detectTarget() function always returns gnu variants for Linux, but musl variants exist in both PlatformTarget and nativePackageByTarget. Users on musl-based systems (Alpine Linux, Void Linux musl, etc.) will be directed to glibc packages that won't work.

Detect the libc variant using the detect-libc npm package (industry standard):

import { familySync } from 'detect-libc';

const libc = familySync(); // 'glibc' | 'musl' | null

Then apply to Linux detection:

if (platform === "linux" && arch === "x64") {
  const libc = familySync() === "musl" ? "musl" : "gnu";
  return `linux-x64-${libc}`;
}

Alternatively, DIY approaches: check process.report?.getReport?.()?.header?.glibcVersionRuntime or scan /lib for ld-musl-* filenames.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@javascript/platform/src/index.ts` around lines 11 - 23, detectTarget
currently always returns "gnu" Linux variants, causing musl-based systems to get
wrong packages; update detectTarget to detect the libc family (use detect-libc's
familySync) when platform === "linux" and choose "musl" vs "gnu" accordingly so
it returns "linux-x64-musl" or "linux-x64-gnu" (and same for arm64). Modify
import/usage to call familySync() and map its result into the target string used
by detectTarget; ensure the returned values match the existing
PlatformTarget/nativePackageByTarget keys.

},
"files": ["dist", "README.md"],
"scripts": {
"build": "bun run clean && bun build src/index.ts --outdir dist --target bun --format esm && bun run build:types",
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# First, understand the reconciler package structure
echo "=== Reconciler package.json ==="
cat javascript/reconciler/package.json

echo -e "\n=== Finding references to reconciler ==="
rg "reconciler" --type js --type ts --type json -l | head -20

Repository: omarluq/termisu

Length of output: 1112


🏁 Script executed:

#!/bin/bash
# Check what packages depend on reconciler
echo "=== Search for reconciler imports ==="
rg "from ['\"].*reconciler" --type js --type ts -A 2 | head -50

echo -e "\n=== Look for package dependencies on reconciler ==="
find . -name "package.json" -type f | xargs grep -l "reconciler" | head -10

Repository: omarluq/termisu

Length of output: 353


🏁 Script executed:

#!/bin/bash
# Understand the package structure and consumers
echo "=== Check runtime package for comparison ==="
if [ -f "javascript/runtime/package.json" ]; then
  cat javascript/runtime/package.json
fi

echo -e "\n=== Search adapter packages ==="
find javascript -name "package.json" -type f | xargs grep -l "adapter" -l 2>/dev/null | head -5

Repository: omarluq/termisu

Length of output: 1078


🏁 Script executed:

#!/bin/bash
# Find all adapters and their dependencies
echo "=== Find adapter directories ==="
find javascript -type d -name "*adapter*" | head -10

echo -e "\n=== Check adapter package.json files ==="
find javascript -path "*/adapter*/package.json" -type f | head -5 | xargs cat

Repository: omarluq/termisu

Length of output: 133


🏁 Script executed:

#!/bin/bash
# Search for actual imports of reconciler in adapter code
echo "=== Reconciler imports in JavaScript/TypeScript files ==="
rg "reconciler" javascript --type js --type ts -B 2 -A 2 | grep -E "(import|from|require)" -A 1 -B 1 | head -40

echo -e "\n=== Check if reconciler is exported from runtime ==="
rg "reconciler" javascript/runtime --type js --type ts -B 2 -A 2 | head -30

Repository: omarluq/termisu

Length of output: 170


🏁 Script executed:

#!/bin/bash
# Check what target the framework packages build for
echo "=== Framework package.json build scripts ==="
for pkg in javascript/framework/*/package.json; do
  echo "--- $(dirname $pkg) ---"
  grep -A 2 '"build"' "$pkg" | head -3
done

echo -e "\n=== Check for any Node-specific target patterns ==="
find javascript -name "package.json" -type f | xargs grep -h "\-\-target" | sort | uniq -c

Repository: omarluq/termisu

Length of output: 1561


🏁 Script executed:

#!/bin/bash
# Check if there's any documentation about runtime targets
echo "=== Look for README or docs about runtime compatibility ==="
find javascript -name "README*" -type f | head -5 | xargs cat 2>/dev/null | head -50

echo -e "\n=== Check root-level documentation ==="
if [ -f "README.md" ]; then
  cat README.md | head -80
fi

Repository: omarluq/termisu

Length of output: 6236


🏁 Script executed:

#!/bin/bash
# Check the reconciler source to understand its purpose
echo "=== Reconciler source files ==="
ls -la javascript/reconciler/src/

echo -e "\n=== Reconciler main index file ==="
head -30 javascript/reconciler/src/index.ts

echo -e "\n=== Check runtime source ==="
ls -la javascript/runtime/src/

Repository: omarluq/termisu

Length of output: 743


Change reconciler build target to --target node for consistency with framework consumers.

Line 17: All framework adapters (react, solid, svelte, vue) that depend on this package use --target node, but the reconciler builds with --target bun. This creates a runtime target mismatch. Switch to --target node.

Note: The runtime package has the same issue The runtime dependency (javascript/runtime/package.json) also uses `--target bun` and should be updated to `--target node` for the same reason.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@javascript/reconciler/package.json` at line 17, The reconciler package.json
build script currently sets the Bun build target to "--target bun"; update the
"build" npm script (the "build" entry in javascript/reconciler/package.json) to
use "--target node" instead of "--target bun" so consumers match framework
adapters, and apply the same change to the equivalent "build" script in
javascript/runtime/package.json to keep runtime consistent.

},
"files": ["dist", "README.md"],
"scripts": {
"build": "bun run clean && bun build src/index.ts --outdir dist --target bun --format esm && bun run build:types",
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "=== Build target scan ==="
rg -nP '"build":\s*".*--target\s+(bun|node)' \
  javascript/runtime/package.json \
  javascript/reconciler/package.json \
  javascript/framework/react/package.json \
  javascript/framework/solid/package.json

echo "=== Bun-specific API usage scan ==="
rg -nP --type=ts '\bBun\.' javascript/runtime/src javascript/reconciler/src || true

Repository: omarluq/termisu

Length of output: 757


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "=== Framework dependencies ==="
echo "=== React framework dependencies ==="
cat javascript/framework/react/package.json | jq '.dependencies,.devDependencies' 2>/dev/null || grep -E '"(reconciler|runtime)"' javascript/framework/react/package.json || echo "No reconciler/runtime deps found"

echo ""
echo "=== Solid framework dependencies ==="
cat javascript/framework/solid/package.json | jq '.dependencies,.devDependencies' 2>/dev/null || grep -E '"(reconciler|runtime)"' javascript/framework/solid/package.json || echo "No reconciler/runtime deps found"

echo ""
echo "=== Reconciler dependencies ==="
cat javascript/reconciler/package.json | jq '.dependencies,.devDependencies' 2>/dev/null || grep -E '"runtime"' javascript/reconciler/package.json || echo "No runtime deps found"

Repository: omarluq/termisu

Length of output: 412


Both runtime and reconciler packages build with --target bun while downstream frameworks target Node.

The mismatch is broader than runtime alone: both javascript/runtime/package.json (line 17) and javascript/reconciler/package.json (line 17) use --target bun, while the frameworks that depend on them (javascript/framework/react and javascript/framework/solid) build with --target node. Since the frameworks consume reconciler and reconciler consumes runtime, the build targets should align to node for consistent Node compatibility across the dependency chain.

No Bun-specific APIs were detected in the source code, so the issue is build configuration rather than runtime API usage. However, misaligned targets can result in suboptimal or inconsistent output for Node environments.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@javascript/runtime/package.json` at line 17, The build scripts for the
runtime and reconciler packages currently use "--target bun"; update the "build"
script in both package.json files for the runtime and reconciler packages to use
"--target node" instead of "--target bun" so the produced artifacts match the
frameworks that target Node; locate the "build" npm script entries (the "build"
key) in each package.json and replace the target flag, then run the package
builds to verify no Bun-specific APIs are required.

Comment on lines +5 to +9
export const createRuntime = (options: RuntimeOptions = {}) => {
return {
kind: "termisu-runtime" as const,
options,
};
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Avoid exposing a mutable alias of caller-provided options.

On Line 8, returning the same options object means external code can mutate runtime config after creation.

🔧 Proposed fix
 export const createRuntime = (options: RuntimeOptions = {}) => {
+  const runtimeOptions: RuntimeOptions = { ...options };
   return {
     kind: "termisu-runtime" as const,
-    options,
+    options: runtimeOptions,
   };
 };
📝 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
export const createRuntime = (options: RuntimeOptions = {}) => {
return {
kind: "termisu-runtime" as const,
options,
};
export const createRuntime = (options: RuntimeOptions = {}) => {
const runtimeOptions: RuntimeOptions = { ...options };
return {
kind: "termisu-runtime" as const,
options: runtimeOptions,
};
};
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@javascript/runtime/src/index.ts` around lines 5 - 9, The returned object from
createRuntime currently exposes the caller's options object directly (options),
allowing external mutation; fix this by returning a copy instead (e.g.,
shallow-clone the options object) so the runtime retains its own immutable
config snapshot—update createRuntime to assign options: { ...options } (or a
deep clone if nested mutability is a concern) so callers cannot mutate the
runtime via the original options reference.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants