Conversation
Encode 512px AVIF (q55) and JPEG (q88) directly from the eight PNG sources. Serve via <picture> with AVIF preferred and JPEG fallback for older clients. Removes ~127MB of 4096px PNGs from the repo.
Drop landing-page.tsx (superseded by landing-page-new), its header hero and installation sections, React Flow micropayment demo, and lazy wrapper dead code. Remove OnChainTrust-only AVIF/JPEG assets and unused global button styles.
Remove unused server actions (apps, conversations), legacy login/error pages, orphan organization encryption repository, legacy plugin-assistant tree (superseded by plugin-cloud-bootstrap), one-off scripts and Storybook scaffold under packages/ui/src/stories, and unused ai-elements connection/edge shims. Add packages/scripts/dead-code-reachability.ts for static import-graph audits. Update README tree to reference plugin-cloud-bootstrap. Made-with: Cursor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Pull request overview
Cleans up unused/dead code and assets across the repo (Storybook example content, legacy landing/auth components, old scripts/plugins), and adds a lightweight internal script to audit static import reachability.
Changes:
- Removed legacy Storybook example components/assets and related CSS.
- Removed deprecated UI/landing/auth code paths, internal helper scripts, and an unused plugin-assistant implementation.
- Added
packages/scripts/dead-code-reachability.tsto statically audit reachability from entry points.
Reviewed changes
Copilot reviewed 47 out of 71 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| public/cloud-agent-samples/1.png | Removed unused sample image asset |
| public/cloud-agent-samples/2.png | Removed unused sample image asset |
| public/cloud-agent-samples/3.png | Removed unused sample image asset |
| public/cloud-agent-samples/4.png | Removed unused sample image asset |
| public/cloud-agent-samples/5.png | Removed unused sample image asset |
| public/cloud-agent-samples/6.png | Removed unused sample image asset |
| public/cloud-agent-samples/7.png | Removed unused sample image asset |
| public/cloud-agent-samples/8.png | Removed unused sample image asset |
| packages/ui/src/stories/page.css | Removed unused Storybook example stylesheet |
| packages/ui/src/stories/header.css | Removed unused Storybook example stylesheet |
| packages/ui/src/stories/button.css | Removed unused Storybook example stylesheet |
| packages/ui/src/stories/assets/youtube.svg | Removed unused Storybook example asset |
| packages/ui/src/stories/assets/tutorials.svg | Removed unused Storybook example asset |
| packages/ui/src/stories/assets/github.svg | Removed unused Storybook example asset |
| packages/ui/src/stories/assets/discord.svg | Removed unused Storybook example asset |
| packages/ui/src/stories/assets/accessibility.svg | Removed unused Storybook example asset |
| packages/ui/src/stories/assets/theming.png | Removed unused Storybook example asset |
| packages/ui/src/stories/assets/testing.png | Removed unused Storybook example asset |
| packages/ui/src/stories/assets/styling.png | Removed unused Storybook example asset |
| packages/ui/src/stories/assets/share.png | Removed unused Storybook example asset |
| packages/ui/src/stories/assets/figma-plugin.png | Removed unused Storybook example asset |
| packages/ui/src/stories/assets/docs.png | Removed unused Storybook example asset |
| packages/ui/src/stories/assets/context.png | Removed unused Storybook example asset |
| packages/ui/src/stories/assets/avif-test-image.avif | Removed unused Storybook example asset |
| packages/ui/src/stories/assets/assets.png | Removed unused Storybook example asset |
| packages/ui/src/stories/assets/addon-library.png | Removed unused Storybook example asset |
| packages/ui/src/stories/assets/accessibility.png | Removed unused Storybook example asset |
| packages/ui/src/stories/Page.tsx | Removed unused Storybook example component |
| packages/ui/src/stories/Page.stories.ts | Removed unused Storybook example story |
| packages/ui/src/stories/Header.tsx | Removed unused Storybook example component |
| packages/ui/src/stories/Header.stories.ts | Removed unused Storybook example story |
| packages/ui/src/stories/Configure.mdx | Removed unused Storybook example docs page |
| packages/ui/src/stories/Button.tsx | Removed unused Storybook example component |
| packages/ui/src/stories/Button.stories.ts | Removed unused Storybook example story |
| packages/ui/src/components/layout/landing-header-old.tsx | Removed deprecated landing header implementation |
| packages/ui/src/components/landing/landing-page.tsx | Removed deprecated landing page implementation |
| packages/ui/src/components/landing/TopHero.tsx | Removed deprecated landing hero section |
| packages/ui/src/components/landing/OnChainTrust.tsx | Removed deprecated landing trust section |
| packages/ui/src/components/landing/MicropaymentNetworkLazy.tsx | Removed deprecated landing visualization wrapper |
| packages/ui/src/components/landing/MicropaymentNetwork.tsx | Removed deprecated landing visualization |
| packages/ui/src/components/landing/Installation.tsx | Removed deprecated landing installation section |
| packages/ui/src/components/landing/BayerDitheringBackgroundLazy.tsx | Removed deprecated lazy loader wrapper |
| packages/ui/src/components/ai-elements/edge.tsx | Removed unused React Flow edge component |
| packages/ui/src/components/ai-elements/connection.tsx | Removed unused React Flow connection component |
| packages/scripts/test-image-simple.ts | Removed unused dev/test script |
| packages/scripts/restore-ai-element-imports.ts | Removed one-off repair script |
| packages/scripts/remove-hubspot-connections.ts | Removed one-off maintenance script |
| packages/scripts/migrate-encrypt-user-database-uris.ts | Removed one-off migration script |
| packages/scripts/lib/env-utils.ts | Removed unused env utility module |
| packages/scripts/fix-ai-elements-v4.ts | Removed one-off code mod script |
| packages/scripts/fix-ai-elements-v3.ts | Removed one-off code mod script |
| packages/scripts/fix-ai-element-imports.ts | Removed one-off code mod script |
| packages/scripts/fix-ai-element-imports-2.ts | Removed one-off code mod script |
| packages/scripts/debug-auth.ts | Removed unused debug script |
| packages/scripts/backfill-metrics.ts | Removed one-off backfill script |
| packages/scripts/backfill-agent-usernames.ts | Removed one-off backfill script |
| packages/scripts/dead-code-reachability.ts | Added static reachability audit script for dead-code detection |
| packages/lib/eliza/plugin-assistant/providers/providers.ts | Removed unused assistant plugin provider implementation |
| packages/lib/eliza/plugin-assistant/providers/current-run-context.ts | Removed unused assistant plugin provider implementation |
| packages/lib/eliza/plugin-assistant/providers/actions.ts | Removed unused assistant plugin provider implementation |
| packages/lib/eliza/plugin-assistant/prompts/chat-assistant-prompts.ts | Removed unused assistant plugin prompt templates |
| packages/lib/eliza/plugin-assistant/index.ts | Removed unused assistant plugin entry |
| packages/lib/eliza/plugin-assistant/handler.ts | Removed unused assistant plugin message handler |
| packages/lib/eliza/plugin-assistant/actions/image-generation.ts | Removed unused assistant plugin image action |
| packages/db/repositories/organization-encryption-keys.ts | Removed unused repository wrapper (no remaining references found) |
| app/login/page-old.tsx | Removed unused legacy login page variant |
| app/auth/error/page-old.tsx | Removed unused legacy auth error page variant |
| app/actions/conversations.ts | Removed unused server actions module |
| app/actions/apps.ts | Removed unused server actions module |
| app/globals.css | Removed unused landing-page hover style |
| README.md | Updated docs path reference to plugin-cloud-bootstrap/ |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| `${basePath}.mts`, | ||
| join(basePath, "index.ts"), | ||
| join(basePath, "index.tsx"), |
There was a problem hiding this comment.
tryResolveFile() doesn’t include .cts (and similarly misses index.mts/cts), but the script’s source/entry regexes treat .cts as an in-scope extension. That mismatch can cause the reachability graph to miss edges for .cts modules and over-report “dead” files. Suggest adding .cts/index.mts/index.cts to the resolution candidates, or removing .cts from the in-scope extensions to keep behavior consistent.
| `${basePath}.mts`, | |
| join(basePath, "index.ts"), | |
| join(basePath, "index.tsx"), | |
| `${basePath}.mts`, | |
| `${basePath}.cts`, | |
| join(basePath, "index.ts"), | |
| join(basePath, "index.tsx"), | |
| join(basePath, "index.mts"), | |
| join(basePath, "index.cts"), |
Code Review: Dead Code Cleanup (PR 419)Overall: Solid cleanup PR. Removing 5,350 lines while adding a useful 340-line audit tool is a net positive. The new dead-code-reachability.ts script is the right direction for ongoing dead code detection. A few things worth verifying before merging. Potential IssuesMedium - Public static assets not covered by the reachability audit The 8 deleted public/cloud-agent-samples PNG files are referenced in JSX/HTML via string paths, not import statements. The static import graph cannot trace those. Confirm no component still references them before merging: grep -r "cloud-agent-samples" app/ packages/ui/src/ -- if any do, users will see broken images with no build error. Medium - organization-encryption-keys.ts repository deletion The repository wrapper is removed but the Drizzle schema table (organizationEncryptionKeys) likely still exists. Two things to verify: (1) nothing in agent-server, gateway-discord, or operator imports this repository since those services may not be fully covered by the reachability script entry points; (2) if the schema table is now orphaned, follow up with a migration to drop it. Check: grep -r "organizationEncryptionKeys" packages/ services/ Low - migrate-encrypt-user-database-uris.ts deletion Fine to delete once the migration has run in production for all environments. Worth a note in the PR description for the ops trail. New Script: dead-code-reachability.tsWell-structured and the documented limitations (dynamic imports, require variable) are appropriately honest. Minor notes: (1) The header says BFS but bfs() uses queue.pop() which is stack-based DFS - functionally equivalent for reachability but the naming is misleading. (2) The hardcoded alias table in mapSpecifierToPath must stay in sync with tsconfig.json paths as the project evolves. (3) tryResolveFile skips .js/.jsx extension candidates - fine for an all-TypeScript codebase today. Deletions that look clean
Bottom line: Verify the two medium items (static image references + encryption key repo) and this is merge-ready. The reachability tool is a valuable addition to the toolchain. |
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (1)
README.md (1)
218-218: Fix incorrect plugin identifier mapping in docs.Line 218 claims
plugin-cloud-bootstrap/maps to@eliza-cloud/plugin-assistant, but the implementation exportscloudBootstrapPlugin(name: "cloud-bootstrap") inpackages/lib/eliza/plugin-cloud-bootstrap/index.ts(Lines 170-193). This is a stale/incorrect identifier reference and can misdirect integrations.Proposed doc fix
-│ │ └── plugin-cloud-bootstrap/ # Cloud bootstrap plugin (`@eliza-cloud/plugin-assistant` id) +│ │ └── plugin-cloud-bootstrap/ # Cloud bootstrap plugin (name: "cloud-bootstrap")🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@README.md` at line 218, Update the README entry that maps plugin directories to package identifiers: replace the incorrect mapping of plugin-cloud-bootstrap/ -> `@eliza-cloud/plugin-assistant` with the actual exported identifier used in code; reference the exported symbol cloudBootstrapPlugin (name: "cloud-bootstrap") from packages/lib/eliza/plugin-cloud-bootstrap/index.ts and update the docs to point to the cloud-bootstrap identifier (or the correct package name matching cloudBootstrapPlugin) so integrations are directed to the correct plugin.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/scripts/dead-code-reachability.ts`:
- Around line 150-158: The current resolver accepts any specifier starting with
"@elizaos/" but only maps "@elizaos/cloud-ui", causing other workspace packages
to be dropped; update the import resolution in the block handling trimmed to
either (a) explicitly map each supported workspace package (e.g., add cases for
"@elizaos/<pkg>" and "@elizaos/<pkg>/" to return join(ROOT, "packages/<pkg>/src"
or "packages/<pkg>/src/index.ts")) or (b) tighten the guard so only
"@elizaos/cloud-ui" is accepted (change the initial if that checks
trimmed.startsWith("@elizaos/") to only allow "@elizaos/cloud-ui"), using the
same join(ROOT, ...) pattern shown for cloud-ui to ensure all valid "@elizaos/*"
imports resolve into the graph.
- Around line 236-240: The code currently swallows readFileSync errors by using
a try/catch that does "continue", producing incomplete graphs; replace the
silent continue with a fail-fast throw that includes the failing file path and
the original error (e.g., catch (err) { throw new Error(`Failed to read ${file}:
${err}`); }) so that the readFileSync/file failure surfaces immediately and
aborts processing instead of continuing with a partial result.
---
Nitpick comments:
In `@README.md`:
- Line 218: Update the README entry that maps plugin directories to package
identifiers: replace the incorrect mapping of plugin-cloud-bootstrap/ ->
`@eliza-cloud/plugin-assistant` with the actual exported identifier used in code;
reference the exported symbol cloudBootstrapPlugin (name: "cloud-bootstrap")
from packages/lib/eliza/plugin-cloud-bootstrap/index.ts and update the docs to
point to the cloud-bootstrap identifier (or the correct package name matching
cloudBootstrapPlugin) so integrations are directed to the correct plugin.
🪄 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: 609446e5-cfa0-415a-bff7-79d61e24921b
⛔ Files ignored due to path filters (23)
packages/ui/src/stories/assets/accessibility.pngis excluded by!**/*.pngpackages/ui/src/stories/assets/accessibility.svgis excluded by!**/*.svgpackages/ui/src/stories/assets/addon-library.pngis excluded by!**/*.pngpackages/ui/src/stories/assets/assets.pngis excluded by!**/*.pngpackages/ui/src/stories/assets/context.pngis excluded by!**/*.pngpackages/ui/src/stories/assets/discord.svgis excluded by!**/*.svgpackages/ui/src/stories/assets/docs.pngis excluded by!**/*.pngpackages/ui/src/stories/assets/figma-plugin.pngis excluded by!**/*.pngpackages/ui/src/stories/assets/github.svgis excluded by!**/*.svgpackages/ui/src/stories/assets/share.pngis excluded by!**/*.pngpackages/ui/src/stories/assets/styling.pngis excluded by!**/*.pngpackages/ui/src/stories/assets/testing.pngis excluded by!**/*.pngpackages/ui/src/stories/assets/theming.pngis excluded by!**/*.pngpackages/ui/src/stories/assets/tutorials.svgis excluded by!**/*.svgpackages/ui/src/stories/assets/youtube.svgis excluded by!**/*.svgpublic/cloud-agent-samples/1.pngis excluded by!**/*.pngpublic/cloud-agent-samples/2.pngis excluded by!**/*.pngpublic/cloud-agent-samples/3.pngis excluded by!**/*.pngpublic/cloud-agent-samples/4.pngis excluded by!**/*.pngpublic/cloud-agent-samples/5.pngis excluded by!**/*.pngpublic/cloud-agent-samples/6.pngis excluded by!**/*.pngpublic/cloud-agent-samples/7.pngis excluded by!**/*.pngpublic/cloud-agent-samples/8.pngis excluded by!**/*.png
📒 Files selected for processing (48)
README.mdapp/actions/apps.tsapp/actions/conversations.tsapp/auth/error/page-old.tsxapp/globals.cssapp/login/page-old.tsxpackages/db/repositories/organization-encryption-keys.tspackages/lib/eliza/plugin-assistant/actions/image-generation.tspackages/lib/eliza/plugin-assistant/handler.tspackages/lib/eliza/plugin-assistant/index.tspackages/lib/eliza/plugin-assistant/prompts/chat-assistant-prompts.tspackages/lib/eliza/plugin-assistant/providers/actions.tspackages/lib/eliza/plugin-assistant/providers/current-run-context.tspackages/lib/eliza/plugin-assistant/providers/providers.tspackages/scripts/backfill-agent-usernames.tspackages/scripts/backfill-metrics.tspackages/scripts/dead-code-reachability.tspackages/scripts/debug-auth.tspackages/scripts/fix-ai-element-imports-2.tspackages/scripts/fix-ai-element-imports.tspackages/scripts/fix-ai-elements-v3.tspackages/scripts/fix-ai-elements-v4.tspackages/scripts/lib/env-utils.tspackages/scripts/migrate-encrypt-user-database-uris.tspackages/scripts/remove-hubspot-connections.tspackages/scripts/restore-ai-element-imports.tspackages/scripts/test-image-simple.tspackages/ui/src/components/ai-elements/connection.tsxpackages/ui/src/components/ai-elements/edge.tsxpackages/ui/src/components/landing/BayerDitheringBackgroundLazy.tsxpackages/ui/src/components/landing/Installation.tsxpackages/ui/src/components/landing/MicropaymentNetwork.tsxpackages/ui/src/components/landing/MicropaymentNetworkLazy.tsxpackages/ui/src/components/landing/OnChainTrust.tsxpackages/ui/src/components/landing/TopHero.tsxpackages/ui/src/components/landing/landing-page.tsxpackages/ui/src/components/layout/landing-header-old.tsxpackages/ui/src/stories/Button.stories.tspackages/ui/src/stories/Button.tsxpackages/ui/src/stories/Configure.mdxpackages/ui/src/stories/Header.stories.tspackages/ui/src/stories/Header.tsxpackages/ui/src/stories/Page.stories.tspackages/ui/src/stories/Page.tsxpackages/ui/src/stories/assets/avif-test-image.avifpackages/ui/src/stories/button.csspackages/ui/src/stories/header.csspackages/ui/src/stories/page.css
💤 Files with no reviewable changes (45)
- app/globals.css
- packages/ui/src/components/landing/MicropaymentNetworkLazy.tsx
- packages/ui/src/stories/header.css
- packages/lib/eliza/plugin-assistant/providers/providers.ts
- packages/ui/src/stories/button.css
- packages/scripts/remove-hubspot-connections.ts
- packages/scripts/restore-ai-element-imports.ts
- packages/ui/src/components/landing/Installation.tsx
- packages/lib/eliza/plugin-assistant/providers/actions.ts
- packages/ui/src/components/ai-elements/connection.tsx
- packages/ui/src/stories/page.css
- packages/scripts/fix-ai-element-imports.ts
- packages/scripts/backfill-metrics.ts
- packages/scripts/fix-ai-elements-v4.ts
- packages/ui/src/components/landing/BayerDitheringBackgroundLazy.tsx
- packages/ui/src/stories/Button.stories.ts
- packages/lib/eliza/plugin-assistant/index.ts
- packages/ui/src/stories/Page.tsx
- packages/scripts/test-image-simple.ts
- packages/scripts/fix-ai-element-imports-2.ts
- packages/ui/src/stories/Button.tsx
- packages/scripts/backfill-agent-usernames.ts
- packages/ui/src/components/landing/OnChainTrust.tsx
- packages/ui/src/components/layout/landing-header-old.tsx
- packages/scripts/fix-ai-elements-v3.ts
- packages/lib/eliza/plugin-assistant/providers/current-run-context.ts
- packages/ui/src/components/landing/landing-page.tsx
- packages/scripts/debug-auth.ts
- app/login/page-old.tsx
- packages/ui/src/stories/Header.stories.ts
- packages/ui/src/stories/Configure.mdx
- packages/ui/src/components/landing/TopHero.tsx
- packages/ui/src/components/landing/MicropaymentNetwork.tsx
- app/actions/apps.ts
- packages/lib/eliza/plugin-assistant/prompts/chat-assistant-prompts.ts
- packages/ui/src/stories/Page.stories.ts
- app/actions/conversations.ts
- packages/ui/src/stories/Header.tsx
- packages/lib/eliza/plugin-assistant/handler.ts
- packages/db/repositories/organization-encryption-keys.ts
- packages/scripts/lib/env-utils.ts
- packages/scripts/migrate-encrypt-user-database-uris.ts
- app/auth/error/page-old.tsx
- packages/lib/eliza/plugin-assistant/actions/image-generation.ts
- packages/ui/src/components/ai-elements/edge.tsx
| const rel = relative(ROOT, abs); | ||
| if (st.isDirectory()) walkDirs(abs, pred, acc); |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
python - <<'PY'
import ntpath
root = r"C:\repo"
app_file = r"C:\repo\app\demo\page.tsx"
test_file = r"C:\repo\packages\lib\__tests__\sample.ts"
rel_app = ntpath.relpath(app_file, root)
rel_test = ntpath.relpath(test_file, root)
base = app_file[:-4] # strip ".tsx"
print("rel_app =", rel_app)
print('rel_app.startswith("app/") ->', rel_app.startswith("app/"))
print("rel_test =", rel_test)
print('"__tests__/" in rel_test ->', "__tests__/" in rel_test)
print('base.split("/")[-1] ->', base.split("/")[-1])
print("ntpath.basename(base) ->", ntpath.basename(base))
PYRepository: elizaOS/cloud
Length of output: 273
🏁 Script executed:
head -100 packages/scripts/dead-code-reachability.ts | tail -50Repository: elizaOS/cloud
Length of output: 1747
🏁 Script executed:
cat -n packages/scripts/dead-code-reachability.ts | sed -n '90,110p'Repository: elizaOS/cloud
Length of output: 860
🏁 Script executed:
cat -n packages/scripts/dead-code-reachability.ts | sed -n '260,290p'Repository: elizaOS/cloud
Length of output: 1180
🏁 Script executed:
cat -n packages/scripts/dead-code-reachability.ts | sed -n '300,315p'Repository: elizaOS/cloud
Length of output: 863
🏁 Script executed:
cat -n packages/scripts/dead-code-reachability.ts | sed -n '1,50p'Repository: elizaOS/cloud
Length of output: 1492
🏁 Script executed:
cat -n packages/scripts/dead-code-reachability.ts | sed -n '230,245p'Repository: elizaOS/cloud
Length of output: 575
Normalize repo-relative paths to POSIX format before slash-based matching.
relative() returns backslashes on Windows, breaking the checks at lines 96, 277, 282, 287, 309 (startsWith("app/"), includes("__tests__/"), includes("/tests__/")) and the basename extraction at line 98 (split("/").pop()). This causes false negatives/positives in test/route detection and the audit report. Use relative() output with .replaceAll("\\", "/") once, then match against normalized strings.
Also applies to lines 62-69, 95-99, 262-263, 272-287, 307-309.
Additionally, replace the try/catch at lines 237-240 with fail-fast: these are internal file paths, not user-supplied data. Use expect/throw pattern instead of silently continuing on read failures.
| if (!trimmed.startsWith(".") && !trimmed.startsWith("@/") && !trimmed.startsWith("@elizaos/")) { | ||
| return null; | ||
| } | ||
| if (trimmed === "@elizaos/cloud-ui") { | ||
| return join(ROOT, "packages/ui/src/index.ts"); | ||
| } | ||
| if (trimmed.startsWith("@elizaos/cloud-ui/")) { | ||
| return join(ROOT, "packages/ui/src", trimmed.slice("@elizaos/cloud-ui/".length)); | ||
| } |
There was a problem hiding this comment.
@elizaos/* imports are only partially resolved.
Line 150 admits every @elizaos/ specifier, but the resolver only handles @elizaos/cloud-ui. Any other workspace package import gets dropped from the graph, so files reachable only through those imports can be reported as dead. Either add the missing package mappings or narrow the accepted alias set.
Minimal guard if @elizaos/cloud-ui is the only supported workspace alias
- if (!trimmed.startsWith(".") && !trimmed.startsWith("@/") && !trimmed.startsWith("@elizaos/")) {
+ const isSupportedWorkspaceAlias =
+ trimmed === "@elizaos/cloud-ui" || trimmed.startsWith("@elizaos/cloud-ui/");
+ if (!trimmed.startsWith(".") && !trimmed.startsWith("@/") && !isSupportedWorkspaceAlias) {
return null;
}📝 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.
| if (!trimmed.startsWith(".") && !trimmed.startsWith("@/") && !trimmed.startsWith("@elizaos/")) { | |
| return null; | |
| } | |
| if (trimmed === "@elizaos/cloud-ui") { | |
| return join(ROOT, "packages/ui/src/index.ts"); | |
| } | |
| if (trimmed.startsWith("@elizaos/cloud-ui/")) { | |
| return join(ROOT, "packages/ui/src", trimmed.slice("@elizaos/cloud-ui/".length)); | |
| } | |
| const isSupportedWorkspaceAlias = | |
| trimmed === "@elizaos/cloud-ui" || trimmed.startsWith("@elizaos/cloud-ui/"); | |
| if (!trimmed.startsWith(".") && !trimmed.startsWith("@/") && !isSupportedWorkspaceAlias) { | |
| return null; | |
| } | |
| if (trimmed === "@elizaos/cloud-ui") { | |
| return join(ROOT, "packages/ui/src/index.ts"); | |
| } | |
| if (trimmed.startsWith("@elizaos/cloud-ui/")) { | |
| return join(ROOT, "packages/ui/src", trimmed.slice("@elizaos/cloud-ui/".length)); | |
| } |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@packages/scripts/dead-code-reachability.ts` around lines 150 - 158, The
current resolver accepts any specifier starting with "@elizaos/" but only maps
"@elizaos/cloud-ui", causing other workspace packages to be dropped; update the
import resolution in the block handling trimmed to either (a) explicitly map
each supported workspace package (e.g., add cases for "@elizaos/<pkg>" and
"@elizaos/<pkg>/" to return join(ROOT, "packages/<pkg>/src" or
"packages/<pkg>/src/index.ts")) or (b) tighten the guard so only
"@elizaos/cloud-ui" is accepted (change the initial if that checks
trimmed.startsWith("@elizaos/") to only allow "@elizaos/cloud-ui"), using the
same join(ROOT, ...) pattern shown for cloud-ui to ensure all valid "@elizaos/*"
imports resolve into the graph.
| let source: string; | ||
| try { | ||
| source = readFileSync(file, "utf8"); | ||
| } catch { | ||
| continue; |
There was a problem hiding this comment.
Fail fast when a module can't be read.
Skipping unreadable files silently gives you a partial graph and false dead-code results. This utility should surface the failing path and abort instead of continue.
Minimal fix
- let source: string;
- try {
- source = readFileSync(file, "utf8");
- } catch {
- continue;
- }
+ const source = readFileSync(file, "utf8");Based on learnings: Applies to **/*.{ts,tsx}: "Use expect/throw pattern for error handling; always aim to catch errors and throw instead of hiding errors and falling back" and "Do not use try/catch blocks unless absolutely necessary or handling user-supplied data; avoid defensive programming and implement clean code with fail-fast patterns".
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@packages/scripts/dead-code-reachability.ts` around lines 236 - 240, The code
currently swallows readFileSync errors by using a try/catch that does
"continue", producing incomplete graphs; replace the silent continue with a
fail-fast throw that includes the failing file path and the original error
(e.g., catch (err) { throw new Error(`Failed to read ${file}: ${err}`); }) so
that the readFileSync/file failure surfaces immediately and aborts processing
instead of continuing with a partial result.
Note
Medium Risk
Broad deletion of old Next.js pages, server actions, scripts, and a plugin could break builds or runtime flows if any of these were still referenced dynamically. Risk is moderated by the change being primarily removals plus an additive audit script.
Overview
Removes a large set of unused code paths across the app and packages, including legacy Next.js pages (
page-old.tsx), server actions for apps/conversations, deprecated UI landing components, Storybook template files, and thepackages/lib/eliza/plugin-assistantimplementation.Cleans up ancillary dead utilities/scripts (metrics backfill, auth debug, env utils, migration helpers) and deletes a small unused CSS rule.
Adds
packages/scripts/dead-code-reachability.ts, a standalone static import-graph BFS tool that audits which TS/TSX files are unreachable from production/test entry points, and updates the README to reflect the plugin directory rename (plugin-cloud-bootstrap).Written by Cursor Bugbot for commit 01327e8. This will update automatically on new commits. Configure here.
Summary by CodeRabbit
Release Notes
Documentation
Removals
Chores