技能湖修复
- 作者仓库星标 435
- 作者仓库 nvim
- 领域
- 工程开发
- 作者声明的智能体
- 未找到明确声明;不据此推断已兼容或已测试
- 静态检查
- 88 / 100 · 启发式扫描,不代表运行安全
- 运行环境证据
- 未执行;当前没有隔离运行测试证据
- 作者 / 版本 / 许可证
- @benbrastmckie · 未声明许可证
- 上下文用量评级
- 低消耗
- 接入复杂程度
- 需简单配置
- 是否需要外部接口密钥
- 不需要
- 兼容的系统
- 未声明(默认跨平台)
- 运行环境要求
- 未检出明确要求
- 检测到的文件与系统行为
-
- 只读
- 允许写入 / 修改
- 命令执行
- 网络行为
- 仅限本地
- 安装命令数
- 无(仅作为资料)
需要注意: 未声明工具权限范围;实际权限由运行环境决定。
第 6 步:对错误进行分类
错误模式·修复类型 缺失案例·missing_cases 未使用的变量·unused_variable 未使用的导入·unused_import 所有其他·UNFIXABLE
第 7 步:应用修复
缺失案例修复 添加带有抱歉占位符的匹配案例。未使用的变量修复通过添加下划线前缀重命名:`{name}` -> `_{name}`未使用的导入修复
第 8 步:最终报告
循环退出后:
# Lake Repair Skill (Direct Execution)
Direct execution skill for automated Lean build repair. Runs `lake build`, parses errors, and automatically fixes common mechanical errors in an iterative loop.
This skill executes inline without spawning a subagent.
## Execution
### Step 1: Parse Arguments
Extract flags from command input:
- `--clean`: Run `lake clean` before building
- `--max-retries N`: Maximum fix iterations (default: 3)
- `--dry-run`: Preview fixes without applying
- `--module NAME`: Build specific module only
```bash
clean=false
max_retries=3
dry_run=false
module=""
for arg in "$@"; do
case "$arg" in
--clean) clean=true ;;
--dry-run) dry_run=true ;;
--max-retries=*) max_retries="${arg#*=}" ;;
--module=*) module="${arg#*=}" ;;
esac
done
```
---
### Step 2: Initial Clean (Optional)
If `--clean` flag is set:
```bash
if [ "$clean" = true ]; then
echo "Running lake clean..."
lake clean
fi
```
---
### Step 3: Build Loop
Initialize tracking variables:
- `retry_count=0`
- `previous_errors=""` (for cycle detection)
- `total_fixes=0`
---
### Step 4: Run Build
Attempt to build the project:
```bash
if [ -n "$module" ]; then
build_output=$(lake build "$module" 2>&1)
else
build_output=$(lake build 2>&1)
fi
build_exit_code=$?
```
---
### Step 5: Parse Build Errors
Extract errors and warnings from build output using regex pattern:
```
Pattern: ^(.+\.lean):(\d+):(\d+): (error|warning): (.+)$
```
---
### Step 6: Classify Errors
| Error Pattern | Fix Type |
|---------------|----------|
| Missing cases | missing_cases |
| Unused variable | unused_variable |
| Unused import | unused_import |
| All other | UNFIXABLE |
---
### Step 7: Apply Fixes
#### Missing Cases Fix
Add match cases with sorry placeholders.
#### Unused Variable Fix
Rename by adding underscore prefix: `{name}` -> `_{name}`
#### Unused Import Fix
Remove the import line (only clean single-import lines).
---
### Step 8: Final Report
After loop exits:
```
Lake Build Complete
===================
Build succeeded after {retry_count} iterations.
Fixes applied:
- {file}:{line} - {description}
All modules built successfully.
```
---
## Error Handling
### MCP Tool Failure
Fall back to `lake build` via Bash.
### File Read/Write Failure
Skip that particular fix, continue with others.
### Parse Failure
Treat as unfixable error.
---
## Safety Measures
### Conservative Fixes
- All missing case fixes use `sorry` placeholders
- Unused variable fixes only add underscore prefix
- Unused import removal is cautious (single-import lines only)
### Cycle Prevention
- Track error signatures between iterations
- Stop if same errors recur
- Hard limit via max_retries (default 3)
章节与文件索引
按说明文件中的顺序排列。
第 1 步:解析参数
第 2 步:初始清洁(可选)
第 3 步:构建循环
第 4 步:运行构建
第5步:解析构建错误
文件/命令 -> lake build · --clean · lake clean · --max-retries N · --dry-run · --module NAME · retry_count=0 · previous_errors=""
内容校验值 -> db8ba0af0a9a
当前原文的自动摘译,尚未人工审校。
第 1 步:解析参数
从命令输入中提取标志:
--clean:在构建之前运行lake clean--max-retries N:最大修复迭代(默认:3)--dry-run:预览修复而不应用--module NAME:仅构建特定模块第 2 步:初始清洁(可选)
如果设置了
--clean标志:第 3 步:构建循环
初始化跟踪变量:
retry_count=0``previous_errors=""(用于循环检测)total_fixes=0第 4 步:运行构建
尝试构建项目:
第5步:解析构建错误
使用正则表达式模式从构建输出中提取错误和警告: