compilr-dev/agents-coding
GitHub: compilr-dev/agents-coding
面向 AI Agent 的多语言编码工具包,提供 Git 操作、项目检测、智能运行器和基于 AST 的代码分析能力。
Stars: 0 | Forks: 0
# @compilr-dev/agents-coding
```
\|/
╭══════════╮ ___ ___ _ __ ___ _ __ (_) |_ __
║' ▐▌ ▐▌ │ / __|/ _ \| '_ ` _ \| '_ \| | | '__|
║ │ | (__| (_) | | | | | | |_) | | | |
╰─═──────═─╯ \___|\___/|_| |_| |_| .__/|_|_|_|
\________\ | | .dev
|_| coding
```
[](https://www.npmjs.com/package/@compilr-dev/agents-coding)
[](https://fsl.software/)
[](https://compilr-dev.github.io/agents-coding/)
**[API 参考](https://compilr-dev.github.io/agents-coding/)**
面向 AI agent 的多语言编程工具 —— 带自动检测功能的主包。
## 概述
这是**主包**,为所有跨编程语言的编码工具提供了统一的接口。它会根据文件扩展名自动检测语言,并路由到相应的解析器。
## 包结构
| 包 | 描述 |
|---------|-------------|
| **@compilr-dev/agents-coding** | 主包(重新导出所有内容 + 自动检测) |
| [@compilr-dev/agents-coding-core](https://www.npmjs.com/package/@compilr-dev/agents-coding-core) | Git 工具、项目检测、智能运行器、代码搜索(30 个工具,14 项技能) |
| [@compilr-dev/agents-coding-ts](https://www.npmjs.com/package/@compilr-dev/agents-coding-ts) | TypeScript/JavaScript AST 分析(15 个工具) |
| [@compilr-dev/agents-coding-python](https://www.npmjs.com/package/@compilr-dev/agents-coding-python) | 通过 Tree-sitter 进行 Python AST 分析 |
| [@compilr-dev/agents-coding-go](https://www.npmjs.com/package/@compilr-dev/agents-coding-go) | 通过 Tree-sitter 进行 Go AST 分析 |
## 安装
```
# Umbrella package (推荐 - 包含所有内容)
npm install @compilr-dev/agents-coding @compilr-dev/agents
# 或使用单独的 packages 以实现更轻量的安装
npm install @compilr-dev/agents-coding-core @compilr-dev/agents
npm install @compilr-dev/agents-coding-ts # TypeScript analysis only
```
只需这一项安装,您即可获得:
- **核心工具** - Git 操作、项目检测、智能运行器、代码搜索
- **TypeScript/JavaScript** - 通过 TypeScript 编译器进行基于 AST 的分析
- **Python** - 通过 Tree-sitter 进行基于 AST 的分析
- **Go** - 通过 Tree-sitter 进行基于 AST 的分析
## 快速开始
```
import { Agent } from '@compilr-dev/agents';
import {
// Core tools (language-agnostic)
gitStatusTool,
gitDiffTool,
detectProjectTool,
runTestsTool,
// Unified tools with auto-detection
getFileStructureTool,
} from '@compilr-dev/agents-coding';
const agent = new Agent({
provider: yourProvider,
tools: [gitStatusTool, detectProjectTool, getFileStructureTool],
});
```
## 语言自动检测
此主包提供了可自动检测语言的统一工具:
```
import { detectLanguage, getFileStructureTool } from '@compilr-dev/agents-coding';
// Detect language from file path
detectLanguage('src/app.ts'); // 'typescript'
detectLanguage('main.py'); // 'python'
detectLanguage('cmd/server.go'); // 'go'
// Unified tool routes to correct parser
const result = await getFileStructureTool.execute({ path: 'src/app.ts' });
// Uses TypeScript parser automatically
```
## 直接语言访问
在需要时可直接访问特定语言的工具:
```
import {
ts, // TypeScript tools
python, // Python tools
go, // Go tools
} from '@compilr-dev/agents-coding';
// Use language-specific tools directly
const tsResult = await ts.getFileStructureTool.execute({ path: 'app.ts' });
const pyResult = await python.getFileStructureTool.execute({ path: 'main.py' });
const goResult = await go.getFileStructureTool.execute({ path: 'main.go' });
```
## 核心工具
所有来自 `@compilr-dev/agents-coding-core` 的语言无关工具:
### Git 工具
- `gitStatusTool` - 解析 Git 状态
- `gitDiffTool` - 结构化差异
- `gitLogTool` - 提交历史
- `gitCommitTool` - 安全提交流程
- `gitBranchTool` - 分支管理
- `gitStashTool` - 暂存操作
### 项目检测
- `detectProjectTool` - 检测项目类型、框架、工具链
- `findProjectRootTool` - 查找项目根目录
### 智能运行器
| 工具 | 支持 |
|------|-----------|
| `runTestsTool` | vitest, jest, mocha, ava, pytest, cargo test, go test, npm test, ruff |
| `runLintTool` | eslint, biome, ruff, pylint, flake8, clippy, golangci-lint, npm |
| `runBuildTool` | vite, next, tsc, webpack, rollup, esbuild, turbo, cargo, go, python, maven, gradle |
| `runFormatTool` | prettier, biome, dprint, black, ruff, rustfmt, gofmt, npm |
所有运行器均支持 `dryRun` 模式,用于在不执行的情况下进行检测。
### 代码搜索
- `findDefinitionTool` - 查找符号定义
- `findReferencesTool` - 查找符号使用情况
- `findTodosTool` - 查找 TODO/FIXME 注释
## 技能
```
import { codingSkills } from '@compilr-dev/agents-coding';
// Available skills:
// - git-workflow
// - test-driven
// - code-navigation
// - pr-workflow
// - project-onboarding
// - code-optimization
```
## 环境要求
- **Node.js** 18 或更高版本
- **@compilr-dev/agents** peer 依赖
## 相关包
- [@compilr-dev/agents](https://www.npmjs.com/package/@compilr-dev/agents) - 核心 agent 库
- [@compilr-dev/cli](https://www.npmjs.com/package/@compilr-dev/cli) - AI 驱动的 CLI 助手
## 链接
- [网站](https://compilr.dev)
- [npm 包](https://www.npmjs.com/package/@compilr-dev/agents-coding)
- [报告问题](https://github.com/compilr-dev/agents-coding/issues)
## 许可证
[FSL-1.1-MIT](https://fsl.software/) - 详情请参阅 [LICENSE](LICENSE)。每个版本在 2 年后转换为 MIT 许可证。
由 compilr.dev 精心打造
标签:AI开发工具, AI智能体, AI编程助手, CMS安全, DevTools, Git工具, GNU通用公共许可证, Go, JavaScript, MITM代理, Node.js, npm包, odt, Python, Ruby工具, Tree-sitter, TypeScript, 代码搜索, 代码解析, 多语言编程, 威胁情报, 安全插件, 开发者工具, 开源库, 抽象语法树, 搜索引擎爬虫, 无后门, 智能运行器, 暗色界面, 编译器, 自动化代码分析, 自动化编程, 项目检测