mthds-fix
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseFix MTHDS bundles
修复MTHDS bundles
Automatically fix issues in MTHDS method bundles.
自动修复MTHDS方法包中的问题。
Process
流程
Step 0 — CLI Check (mandatory, do this FIRST)
步骤0 — CLI检查(强制要求,优先执行)
Run . The minimum required version is 0.1.0 (declared in this skill's front matter as ).
mthds-agent --versionmin_mthds_version- If the command is not found: STOP. Do not proceed. Tell the user:
TheCLI is required but not installed. Install it with:mthds-agentnpm install -g mthdsThen re-run this skill.
- If the version is below 0.1.0: STOP. Do not proceed. Tell the user:
This skill requiresversion 0.1.0 or higher (found X.Y.Z). Upgrade with:mthds-agentnpm install -g mthds@latestThen re-run this skill.
- If the version is 0.1.0 or higher: proceed to the next step.
Do not write files manually, do not scan for existing methods, do not do any other work. The CLI is required for validation, formatting, and execution — without it the output will be broken.
.mthdsNo backend setup needed: This skill works without configuring inference backends or API keys. You can start building/validating methods right away. Backend configuration is only needed to run methods with live inference — usewhen you're ready./pipelex-setup
运行。最低要求版本为0.1.0(在本技能的前置信息中声明为)。
mthds-agent --versionmin_mthds_version- 如果未找到该命令:停止操作,不要继续,告知用户:
需要CLI但尚未安装。请使用以下命令安装:mthds-agentnpm install -g mthds安装完成后重新运行本技能。
- 如果版本低于0.1.0:停止操作,不要继续,告知用户:
本技能要求版本为0.1.0或更高(当前版本为X.Y.Z)。请使用以下命令升级:mthds-agentnpm install -g mthds@latest升级完成后重新运行本技能。
- 如果版本为0.1.0或更高:继续执行下一步。
不要手动编写文件,不要扫描现有方法,不要执行任何其他操作。校验、格式化和执行都需要用到CLI,没有它输出内容会出错。
.mthds无需后端配置:本技能无需配置推理后端或API密钥即可运行,你可以立即开始构建/校验方法。仅当需要通过实时推理运行方法时才需要配置后端,准备就绪后可使用命令配置。/pipelex-setup
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 pipe <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 pipe <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 pipe <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 pipe <file>.mthds -L <bundle-directory>/应用修复后,重新执行校验:
bash
mthds-agent pipelex validate pipe <file>.mthds -L <bundle-directory>/持续执行“修复-校验”循环,直到返回。部分修复可能会暴露新问题:例如修复后,新添加的输入可能会出现错误。
success: truemissing_input_variableinput_stuff_spec_mismatch如果“修复-校验”循环陷入僵局,或错误信息不明确,可以添加参数重新运行获取更多上下文:
--log-level debugbash
mthds-agent --log-level debug pipelex validate pipe <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
参考
- 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返回错误时阅读,确定恢复方案
- MTHDS Agent指南 — 阅读了解CLI命令语法或输出格式详情
- MTHDS语言参考 — 编写或修改.mthds TOML语法时阅读
- 原生内容类型 — 修复涉及原生概念的类型不匹配问题时阅读,确认可用属性