antgroup / antgroup/YASA-Engine

[OSS26] 列出类的全部方法 list_methods_by_class_name

Open
#138 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

OSS26-中等难度
Dominant language
TypeScript
Stars
323
Forks
40
PR merge metrics
No merged PRs in 30d

Description

接口介绍

给定类全限定名,一次性返回该类的所有方法清单(签名、可见性、起止行号、注解),可选附带方法源码或仅返回签名;支持是否包含从父类/接口继承的方法。

工具名

list_methods_by_class_name

背景与目标

LLM Agent 经常需要"扫一遍某个类全貌"才能决定下一步看哪个方法。文件级读 + 自己拆方法 token 太重。这个工具把类的方法清单作为一次性结构化输出返回,是上层链路的目录级入口。

输入参数
参数 类型 必填 说明
class_full_name string 类全限定名
repository_path string 仓库本地绝对路径
include_inherited bool 默认 false。true 时把继承自父类/接口的方法也列出(不返 source,只返签名)
include_private bool 默认 true
include_source bool 默认 true。false 时只返签名,适合先打目录再按需取源码
输出结构
{
  "class_full_name": "com.example.UserController",
  "file_path": "src/main/java/com/example/UserController.java",
  "class_start_line": 14,
  "class_end_line": 312,
  "extends_class": "com.example.BaseController",
  "implements_interfaces": ["com.example.RequestValidator"],
  "total_methods": 8,
  "methods": [
    {
      "method_signature": "getUser(HttpServletRequest, String): ResponseEntity<User>",
      "method_short_name": "getUser",
      "visibility": "public",
      "is_static": false,
      "is_abstract": false,
      "start_line": 87,
      "end_line": 105,
      "annotations": ["@GetMapping(\"/users/{id}\")"],
      "source": "@GetMapping(\"/users/{id}\")\npublic ResponseEntity<User> getUser(...) { ... }",
      "inherited_from": null
    }
  ]
}
验收标准
  • 正确处理嵌套类:返回当前类的方法,不串到内部类
  • 继承方法标识 inherited_from 字段
  • 构造器、静态初始化块作为特殊条目返回
  • include_source=false 时返回不带 source 的轻量版
  • 单元测试覆盖:重载、抽象方法、内部类干扰、空类
  • 中等仓库响应 < 3s
预估工作量

2-3 人日

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the TypeScript entry point for list_methods_by_class_name and inspect how the repository’s UAST represents classes, methods, inheritance, and nested classes. Add focused unit tests for overloads, abstract methods, inner-class isolation, empty classes, constructors, static blocks, and include_source=false; done means the documented output is produced within the stated performance target.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
devtools, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.