展示 HN:具有原生 Tree-sitter 知识图谱的 LuckyCLI 终端编码助手

1作者: Fenix4624 天前原帖
我正在构建LuckyCLI,一个基于终端的AI编码助手,使用TypeScript编写。这个核心想法源于一种挫败感:大多数助手要么将你锁定在一个提供者上,要么在你切换时失去上下文。 我专注于两个我没有在其他地方看到过的结合点: 知识图谱与tree-sitter — LuckyCLI并不是简单地将原始文件放入上下文中,而是构建了一个你代码库的结构化图谱(函数、类、导入、调用关系)。助手查询这个图谱,以决定在发送任何内容给模型之前,哪些信息实际上是相关的。系统提示经过专门调整,以便与这种表示方式配合使用,因此模型能够推理结构,而不仅仅是文本。 会话中切换提供者 — 如果你已经通过多个提供者(如Claude、ChatGPT、Gemini、Ollama等)进行了身份验证,你可以在会话中切换,而不会丢失对话或项目的上下文。身份验证通过浏览器OAuth处理,因此对于基于订阅的提供者不需要API密钥。 最近的工作:修复了TUI(之前很粗糙,现在很稳定),改进了工具调用处理,并优化了提供者切换流程,使其真正感觉无缝。 GitHub: [https://github.com/Fenix46/LuckyCLI](https://github.com/Fenix46/LuckyCLI) 欢迎就架构、知识图谱设计或OAuth方法(我知道这是一个值得公开讨论的灰色领域)提问。
查看原文
I&#x27;ve been building LuckyCLI, a terminal-based AI coding agent written in TypeScript. The core idea started from a frustration: most agents either lock you to one provider or lose context the moment you switch. Two things I focused on that I haven&#x27;t seen combined elsewhere: Knowledge graph with tree-sitter — instead of dumping raw files into context, LuckyCLI builds a structured graph of your codebase (functions, classes, imports, call relationships). The agent queries the graph to decide what&#x27;s actually relevant before sending anything to the model. System prompts are tuned specifically to work with this representation, so the model reasons about structure, not just text. Mid-chat provider switching — if you&#x27;re already authenticated with multiple providers (Claude, ChatGPT, Gemini, Ollama, and others), you can switch mid-session without losing the conversation or project context. Auth is handled via browser OAuth, so no API key required for the subscription-based providers. Recent work: fixed the TUI (it was rough, now it&#x27;s solid), improved tool call handling, and polished the provider-switching flow so it actually feels seamless. GitHub: <a href="https:&#x2F;&#x2F;github.com&#x2F;Fenix46&#x2F;LuckyCLI" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;Fenix46&#x2F;LuckyCLI</a> Happy to answer questions about the architecture, the knowledge graph design, or the OAuth approach (which I know is a grey area worth discussing openly).