Skip to content

feat(cli): analisis JS/TS lebih kuat (workspace, Nuxt, entry points, database) - #112

Merged
itsflaid merged 1 commit into
mainfrom
js-ts-analysis-enhanced
Oct 20, 2026
Merged

itsflaid merged 1 commit into
mainfrom
js-ts-analysis-enhanced

Conversation

@itsflaid

Copy link
Copy Markdown
Owner

Kenapa

Audit ke 5 repo JS/TS nyata (create-t3-turbo, Nuxt "elk", Next "commerce", citty, express) menunjukkan graph import kehilangan banyak edge di monorepo dan Nuxt, sehingga critical files, entry points, dan change impact dihitung dari graph yang hampir kosong. PR ini fokus ke ekosistem JS/TS saja; bahasa lain sengaja ditunda sampai JS/TS matang.

Hasil di repo nyata (sebelum → sesudah)

Repo Edge File source terisolasi
create-t3-turbo (monorepo) 54 → 116 43% → 14%
elk (Nuxt) 50 → 964 87% → 8%
commerce (Next) / citty / express tidak berubah tidak berubah

Perubahan

Graph

  • Workspace package diimpor lewat nama (@acme/ui, @acme/ui/button): resolusi via exports (conditions + pola *), source/module/main, lalu layout file. Output build (dist/, lib/) dipetakan balik ke src/.
  • imports di package.json (#internal/*) di-resolve di package terdekat; # lain (Nuxt #shared) jatuh ke alias.
  • Suffix query bundler (./x.ts?raw) dibuang sebelum resolusi.
  • tsconfig/jsconfig di folder level-root seperti frontend/ ikut ditemukan (sebelumnya hanya apps|packages|libs|services).
  • Nuxt: alias ~ @ ~~ @@ #shared #server (Nuxt 3, Nuxt 4 app/, srcDir custom) + edge auto-import untuk komponen, composables, utils, shared/, server/utils/, Pinia stores.

Entry points

  • Dibaca dari bin, main (root/published saja, dan hanya jika tidak diimpor file lain), target scripts, plus konvensi framework (Nuxt, SvelteKit, Remix, Next Pages Router) yang hanya dihitung selama tidak ada yang mengimpornya. File config dan root package workspace internal tidak pernah jadi entry.

Analyzer / detector

  • Export CommonJS (module.exports = {...}, exports.x =) terbaca sebagai export dan symbol.
  • Database: folder models//schemas/ saja tidak lagi dianggap Mongoose; TypeORM, Sequelize, MikroORM, Kysely, Knex, Firebase, Convex, PocketBase, MongoDB, Neon/Vercel Postgres, libSQL ditambah; store tambahan muncul di database.additional; Redis tidak pernah jadi database utama.

Dokumen: CLAUDE.md diperbarui (jumlah tes, daftar tes, tabel bahasa termasuk .java, bagian resolusi JS/TS, batasan), CHANGELOG bagian Unreleased.

Verifikasi

  • pnpm test:cli: 356 lulus (32 baru di js-ts-ecosystem.test.ts), tsc bersih, pnpm build:cli dan test:package-e2e hijau.
  • Self-analysis repo ini: entry pertama packages/cli/src/index.ts (dari bin).

Sengaja belum

Edge untuk Go/Java/C#/PHP (PSR-4), framework baru (Remix/React Router, TanStack, Hono, Expo), alias yang hanya ada di config Vite/webpack.


Generated by Claude Code

Audit of five real repos (create-t3-turbo, Nuxt "elk", Next "commerce",
citty, express) showed the import graph missing most edges in monorepos and
Nuxt apps, which skews critical files, entry points and change impact.

Graph
- Workspace packages imported by name resolve through package.json exports
  (conditions, * patterns), source/module/main, then file layout; build
  output (dist/, lib/) maps back to src/.
- package.json "imports" (#internal/*) resolve within the nearest package;
  other # specifiers (Nuxt #shared) fall through to aliases.
- Bundler query suffixes (./x.ts?raw) are stripped before resolution.
- tsconfig/jsconfig in root-level folders (frontend/, client/) are found,
  not only under apps/ and packages/.
- Nuxt: ~ @ ~~ @@ #shared #server aliases (Nuxt 3 root, Nuxt 4 app/, custom
  srcDir) and auto-import edges for components, composables, utils, shared,
  server/utils and Pinia stores.

Entry points
- Read package.json bin, published/root main and script targets; add framework
  file conventions (Nuxt, SvelteKit, Remix, Next Pages Router) that only
  count while nothing imports them. Config files and internal workspace
  package roots are never entries.

Analyzer / detectors
- CommonJS exports (module.exports, exports.x) are read as exports/symbols.
- Database detector: models/ or schemas/ alone no longer means Mongoose;
  more ORMs/BaaS/drivers; secondary stores reported as database.additional;
  a cache is never the primary database.

Effect on real projects: isolated source files 43% -> 14% (create-t3-turbo),
87% -> 8% (Nuxt). Adds 32 tests (356 total), refreshes CLAUDE.md and adds an
Unreleased changelog entry. Go/Java/C#/PHP resolution is intentionally left
for after JS/TS is mature.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019HJc4sv9pSLh7vhduSUxBE
@vercel

vercel Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
devmap-web Ready Ready Preview Oct 20, 2026 11:18am UTC

@github-actions

Copy link
Copy Markdown

✅ Welcome ke DevMap!

Terima kasih sudah buat PR. Pastikan checklist ini terpenuhi sebelum review:

  • devmap doctor lolos (tanpa error)
  • Test pnpm test:cli lolos (semua pass)
  • New commands diupdate di docs/commands.md
  • Tidak ada console.log di command files
  • Registry terms sesuai standar (baca docs/guide/05-signal-registry.md)
  • Code style match dengan CONTRIBUTING.md

CI akan jalan otomatis pada setiap update. Kalau gagal, akan muncul link run di komentar ini.

Kalau DevMap membantu, tolong star ya: https://github.com/itsflaid/devmap

Terima kasih kontribusinya! 🙏

@itsflaid
itsflaid merged commit e73f542 into main Oct 20, 2026
3 checks passed
@itsflaid
itsflaid deleted the js-ts-analysis-enhanced branch October 20, 2026 11:19
@itsflaid itsflaid mentioned this pull request Oct 20, 2026

This branch was successfully deployed

1 active deployment
Preview — eb5bc49c Deployed Oct 20, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants