npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

jdt-lsp-cli

v1.7.2

Published

CLI tool for Java LSP operations, enabling AI agents to call Java language features from the command line

Downloads

1,846

Readme

JDT LSP CLI

CLI tool for Java LSP operations, enabling AI agents to call Java language features from the command line

npm version License: MIT

简介

JDT LSP CLI 是一个基于 Eclipse JDT Language Server 的命令行工具,为 AI Agent 和开发者提供强大的 Java 代码分析能力:

  • 🔍 符号搜索: 跨项目搜索类、方法、字段
  • 📍 精确定位: 跳转到定义、查找引用、类型跳转
  • 🔗 调用链分析: 分析方法调用关系,支持多种模式
  • 📚 文档提取: 获取 Javadoc 和类型信息
  • 守护进程: 快速响应,性能提升 10-100 倍

快速开始

安装

npm install -g jdt-lsp-cli
jls --version

基本使用

# 启动守护进程(推荐)
jls daemon start --eager --init-project /path/to/java-project

# 搜索类
jls -p /path/to/project find SqlSession --kind Class

# 获取文件符号
jls sym src/main/java/org/example/MyClass.java --flat

# 分析调用链
jls ch src/main/java/org/example/Service.java --method processOrder -d 3

文档导航

📚 命令文档

LSP 命令

| 命令 | 别名 | 功能 | 文档 | |------|------|------|------| | find | f | 全局符号搜索 | 📖 | | symbols | sym | 获取文件符号 | 📖 | | definition | def | 跳转定义 | 📖 | | references | refs | 查找引用 | 📖 | | hover | | 悬停信息 | 📖 | | call-hierarchy | ch | 调用链分析 | 📖 | | implementations | impl | 查找实现 | 📖 | | type-definition | typedef | 类型跳转 | 📖 |

管理命令

| 命令 | 功能 | 文档 | |------|------|------| | daemon | 守护进程管理 | 📖 | | config | 配置管理 | 📖 |

🔧 参考文档

核心特性

🎯 精确定位

支持多种符号定位方式:

# 方法名定位
jls def MyClass.java --method myMethod

# 签名匹配(区分重载)
jls def MyClass.java --method process --signature "(String, int)"

# 索引选择
jls def MyClass.java --method process --index 0

# 全局搜索
jls def --global --symbol ArrayList --kind Class

⚡ 守护进程模式

# 启动并预初始化
jls daemon start --eager --init-project /path/to/project --wait

# 享受毫秒级响应
jls find MyClass          # 5-500ms(而非 30-60s)
jls sym MyClass.java      # 即时响应

🤖 AI 友好模式

call-hierarchy 命令提供多种 AI Agent 友好的查询模式:

# 惰性加载模式 - 按需探索
jls ch Service.java --method process --mode lazy

# 摘要模式 - 快速理解
jls ch Service.java --method process --mode summary

# 快照模式 - 完整存档
jls ch Service.java --method process --mode snapshot --snapshot-path ./output

📦 紧凑输出

减少 token 消耗,适合 AI Agent:

jls def MyClass.java --method myMethod --json-compact

典型工作流

# 1. 启动守护进程
jls daemon start --eager --init-project /path/to/project --wait

# 2. 搜索目标类
jls find UserService --kind Class

# 3. 查看类结构
jls sym src/main/java/com/example/UserService.java --flat

# 4. 分析方法调用链
jls ch src/main/java/com/example/UserService.java --method processOrder -d 3

# 5. 查找方法实现
jls impl src/main/java/com/example/OrderService.java --method createOrder

# 6. 获取方法文档
jls hover src/main/java/com/example/OrderService.java --method createOrder

# 7. 查找所有引用
jls refs src/main/java/com/example/UserService.java --method processOrder

性能对比

| 模式 | 首次命令 | 后续命令 | |------|----------|----------| | 守护进程模式 | 30-60s | 5-500ms | | 直接模式 | 30-60s | 30-60s |

项目结构

jdt-lsp-cli/
├── docs/                      # 文档目录
│   ├── commands/              # 各命令的详细文档
│   │   ├── find.md
│   │   ├── symbols.md
│   │   ├── definition.md
│   │   ├── references.md
│   │   ├── hover.md
│   │   ├── call-hierarchy.md
│   │   ├── implementations.md
│   │   ├── type-definition.md
│   │   ├── daemon.md
│   │   └── config.md
│   └── global-options.md      # 全局选项文档
├── src/                       # 源代码
│   ├── cli/                   # CLI 命令实现
│   ├── core/                  # 核心功能
│   ├── jdt/                   # JDT LS 集成
│   └── services/              # 服务层
└── README.md                  # 本文件(文档索引)

相关资源

License

MIT License - 详见 LICENSE 文件