Entity-level code map via sem (Rust-native, for templates + token savings)

未关闭
#315 1 条评论 4 个 reaction 已指派 0 人 在 GitHub 查看

已经有一个关联 PR 被合并了。

  • #321 来自 @rs545837 —— 已合并

评估

难度
4/5
预计耗时
3-5 天
新手友好度
35/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
停滞
技术栈
rust
领域
cli

调研方向

先阅读 code2prompt 的模板和源代码树实现,然后查看 sem-core 的实体提取接口或 CLI sem entities --json。确定可选的 entity-map 模板变量应如何表示每个文件中的函数、类和方法。完成标准是:模板可以请求该结构,而无需包含每个完整的源文件。

由索引模型根据 Issue 内容生成。

描述

code2prompt's templating + source tree is a great base. A natural addition: an entity-level code map (functions, classes, methods per file) as a template variable, so prompts can include structure without dumping every full file, cutting tokens while improving navigation.

Since code2prompt is Rust, this is especially clean: sem is also Rust and exposes a sem-core crate (entity extraction across 26 languages via tree-sitter), so it can integrate as a library rather than a subprocess. There's also a CLI (sem entities <path> --json) if you'd prefer that path.

I maintain sem and would be glad to send a PR adding an optional entity-map variable. Would that fit the project?

主要语言
Rust
星标
7.8k
派生
459
平均合并
3 天 20 小时
30 天内合并 PR
1

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

mufeedvh/code2prompt 的其他 Issue

查看 mufeedvh/code2prompt 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。