fix
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseFix MTHDS bundles
修复MTHDS包
Automatically fix issues in MTHDS method bundles.
自动修复MTHDS方法包中的问题。
Process
流程
Prerequisite: See CLI Prerequisites
前提条件:查看CLI 前提条件
Step 1: Validate and Identify Errors
步骤1:验证并识别错误
Always use pointing to the bundle's own directory to avoid namespace collisions:
-Lbash
mthds-agent pipelex validate <file>.mthds -L <bundle-directory>/Parse the JSON output:
- If — nothing to fix, report clean status
success: true - If — iterate through
error_type: "ValidateBundleError"array and fix each (Step 2)validation_errors - If model/config error — see Error Handling Reference (cannot be fixed by editing the .mthds file)
始终使用指向包自身的目录,以避免命名空间冲突:
-Lbash
mthds-agent pipelex validate <file>.mthds -L <bundle-directory>/解析JSON输出:
- 如果— 无需修复,报告状态正常
success: true - 如果— 遍历
error_type: "ValidateBundleError"数组并逐个修复(步骤2)validation_errors - 如果是模型/配置错误 — 查看错误处理参考(无法通过编辑.mthds文件修复)
Step 2: Fix .mthds Validation Errors
步骤2:修复.mthds验证错误
Use the field from each validation error to determine the fix:
error_type| Error Type | Fix Strategy |
|---|---|
| Add the missing variable(s) to the parent pipe's |
| Remove the unused variable(s) from the pipe's |
| Correct the concept type in |
| Change the |
| Add or remove |
| Restructure the method to break the cycle |
| Use PipeImgGen instead of PipeLLM for image generation |
| Ensure PipeImgGen input is text-based (use |
| Rename the pipe to valid snake_case |
| Add the concept definition to the bundle, or fix the typo |
| Rename |
For error type descriptions, see Error Handling — Validation Error Types.
使用每个验证错误中的字段确定修复方案:
error_type| 错误类型 | 修复策略 |
|---|---|
| 将缺失的变量添加到父管道的 |
| 从管道的 |
| 修正 |
| 将 |
| 为输出概念添加或移除 |
| 重构方法以打破循环依赖 |
| 使用PipeImgGen而非PipeLLM进行图像生成 |
| 确保PipeImgGen的输入为文本格式(使用 |
| 将管道重命名为有效的蛇形命名法(snake_case) |
| 向包中添加概念定义,或修正拼写错误 |
| 将 |
有关错误类型的说明,请查看错误处理 — 验证错误类型。
Step 3: Fix TOML Formatting Issues
步骤3:修复TOML格式问题
These aren't always reported by validation but cause problems:
Multi-line inputs — must be on a single line:
toml
undefined这些问题并非总会被验证工具报告,但会引发异常:
多行输入 — 必须放在单行中:
toml
undefinedWRONG
错误示例
inputs = {
a = "A",
b = "B"
}
inputs = {
a = "A",
b = "B"
}
CORRECT
正确示例
inputs = { a = "A", b = "B" }
**Pipe ordering** — controllers before sub-pipes:
```tomlinputs = { a = "A", b = "B" }
**管道顺序** — 控制器管道优先于子管道:
```tomlCORRECT: main pipe first, then sub-pipes in execution order
正确示例:主管道在前,子管道按执行顺序排列
[pipe.main_workflow]
type = "PipeSequence"
steps = [
{ pipe = "step_one", result = "intermediate" },
{ pipe = "step_two", result = "final" }
]
[pipe.step_one]
...
[pipe.step_two]
...
**Missing required fields** — add with sensible defaults:
- `description` on every pipe and concept
- `type` on every pipe
- `output` on every pipe[pipe.main_workflow]
type = "PipeSequence"
steps = [
{ pipe = "step_one", result = "intermediate" },
{ pipe = "step_two", result = "final" }
]
[pipe.step_one]
...
[pipe.step_two]
...
**缺失必填字段** — 添加合理的默认值:
- 每个管道和概念都要有`description`
- 每个管道都要有`type`
- 每个管道都要有`output`Step 4: Re-validate
步骤4:重新验证
After applying fixes, re-validate:
bash
mthds-agent pipelex validate <file>.mthds -L <bundle-directory>/Continue the fix-validate loop until is returned. Some fixes reveal new issues — for example, fixing a may expose an on the newly added input.
success: truemissing_input_variableinput_stuff_spec_mismatchIf the fix-validate loop gets stuck or errors are unclear, re-run with for additional context:
--log-level debugbash
mthds-agent --log-level debug pipelex validate <file>.mthds -L <bundle-directory>/应用修复后,重新验证:
bash
mthds-agent pipelex validate <file>.mthds -L <bundle-directory>/重复“修复-验证”循环,直到返回。部分修复可能会暴露新问题 — 例如,修复可能会在新添加的输入上暴露。
success: truemissing_input_variableinput_stuff_spec_mismatch如果“修复-验证”循环陷入停滞或错误不明确,使用重新运行以获取更多上下文:
--log-level debugbash
mthds-agent --log-level debug pipelex validate <file>.mthds -L <bundle-directory>/Step 5: Report Results
步骤5:报告结果
- List all changes made (which pipes were modified and how)
- Show the final validation result
- Flag any remaining warnings or suggestions
- 列出所有已做的更改(修改了哪些管道以及修改方式)
- 展示最终的验证结果
- 标记任何剩余的警告或建议
Reference
参考资料
- CLI Prerequisites — read at skill start to check CLI availability
- Error Handling — read when CLI returns an error to determine recovery
- MTHDS Agent Guide — read for CLI command syntax or output format details
- MTHDS Language Reference — read when writing or modifying .mthds TOML syntax
- Native Content Types — read when fixing type mismatches involving native concepts, to verify available attributes
- CLI 前提条件 — 技能启动时阅读,检查CLI可用性
- 错误处理 — 当CLI返回错误时阅读,以确定恢复方案
- MTHDS Agent 指南 — 阅读以了解CLI命令语法或输出格式细节
- MTHDS 语言参考 — 编写或修改.mthds TOML语法时阅读
- 原生内容类型 — 修复涉及原生概念的类型不匹配问题时阅读,以验证可用属性