ts-lens-cli
v0.1.0
Published
CLI for querying TypeScript types, definitions, references, diagnostics, and depth-based hover expansion via tsgo LSP.
Maintainers
Readme
ts-lens-cli
ts-lens-cli installs the ts-lens command, a local TypeScript inspection CLI powered by tsgo --lsp --stdio.
It can query:
- hover types and symbol information
- definitions with source snippets
- references with grouped summaries, locations, or line previews
- current-file diagnostics
- depth-based hover expansion
- line-numbered file reads for agent workflows
Requirements
- Node.js 20+
ts-lens uses tsgo --lsp --stdio as its only semantic backend.
The package installs @typescript/native-preview and resolves tsgo from that package by default.
Install
npm install -g ts-lens-cli
ts-lens doctorQuickstart
ts-lens doctor
ts-lens daemon start
ts-lens daemon status --format json
ts-lens hover src/index.ts --line 10 --col 7
ts-lens hover src/index.ts --line 10 --name currentUser
ts-lens def src/index.ts --name currentUser
ts-lens refs src/index.ts --name currentUser --detail-level preview
ts-lens diag src/index.ts
ts-lens expand src/index.ts --name currentUser --depth 2
ts-lens read-file-with-line-numbers src/index.ts --start-line 1 --end-line 40Position modes for hover, def, refs, and expand:
--line <n> --col <n>: exact 1-based position--line <n> --name <identifier>: smart location on one line--line <n>: the unique symbol on one line--name <identifier>: the unique symbol in one file
If multiple matches are found, ts-lens returns an ambiguity error instead of guessing.
Debugging
Useful commands:
ts-lens doctor --format json
ts-lens daemon status --format json
ts-lens hover src/index.ts --line 10 --name currentUser --format json --debugRules:
- debug logs always go to
stderr - JSON results remain clean on
stdout daemon statusexposes daemon identity, compatibility, request counters, and recent events
Current Scope
Current MVP scope:
tsgo --lsp --stdioonly- no
typescript-language-serverfallback - no structured type tree
- no continuation token
- no workspace-wide diagnostics aggregation
