mthds-pkg

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Manage MTHDS packages

管理MTHDS包

Initialize, configure exports, list, and validate MTHDS packages using the
mthds-agent
CLI.
使用
mthds-agent
CLI初始化、配置导出、列出和校验MTHDS包。

Process

流程

Step 0 — CLI Check (mandatory, do this FIRST)

步骤0 — CLI检查(必做,请最先执行)

Run
mthds-agent --version
. The minimum required version is 0.1.0 (declared in this skill's front matter as
min_mthds_version
).
  • If the command is not found: STOP. Do not proceed. Tell the user:
The
mthds-agent
CLI is required but not installed. Install it with:
npm install -g mthds
Then re-run this skill.
  • If the version is below 0.1.0: STOP. Do not proceed. Tell the user:
This skill requires
mthds-agent
version 0.1.0 or higher (found X.Y.Z). Upgrade with:
npm install -g mthds@latest
Then re-run this skill.
  • If the version is 0.1.0 or higher: proceed to the next step.
Do not write
.mthds
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.
No 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 — use
/pipelex-setup
when you're ready.
运行
mthds-agent --version
。最低要求版本为0.1.0(在本技能的前置元数据中声明为
min_mthds_version
)。
  • 如果未找到该命令:停止操作,不要继续。告知用户:
需要使用
mthds-agent
CLI但尚未安装。请通过以下命令安装:
npm install -g mthds
之后重新运行本技能。
  • 如果版本低于0.1.0:停止操作,不要继续。告知用户:
本技能要求
mthds-agent
版本为0.1.0或更高(当前版本为X.Y.Z)。请通过以下命令升级:
npm install -g mthds@latest
之后重新运行本技能。
  • 如果版本为0.1.0或更高:继续下一步。
请勿手动编写
.mthds
文件,请勿扫描现有方法,请勿执行任何其他操作。校验、格式化和执行都需要用到该CLI,没有它输出内容将会出错。
无需后端配置:本技能无需配置推理后端或API密钥即可使用。你可以立即开始构建/校验方法。仅当你需要通过实时推理运行方法时才需要配置后端,准备就绪后使用
/pipelex-setup
即可。

1. Initialize a package

1. 初始化包

Create a
METHODS.toml
manifest:
bash
mthds-agent package init --address <address> --version <version> --description <description> -C <pkg-dir>
Required flags:
FlagPurposeExample
--address
Package address (hostname/path format)
github.com/org/repo
--version
Package version (semver)
1.0.0
--description
Package description
"My method package"
Optional flags:
FlagPurposeExample
--authors
Comma-separated list of authors
"Alice, Bob"
--license
License identifier
MIT
--name
Method name (2-25 lowercase chars)
my-tool
--display-name
Human-readable display name (max 128 chars)
"My Tool"
--main-pipe
Main pipe code (snake_case)
extract_data
--force
Overwrite existing METHODS.toml
创建
METHODS.toml
清单:
bash
mthds-agent package init --address <address> --version <version> --description <description> -C <pkg-dir>
必填参数:
标志用途示例
--address
包地址(主机名/路径格式)
github.com/org/repo
--version
包版本(semver格式)
1.0.0
--description
包描述
"My method package"
可选参数:
标志用途示例
--authors
逗号分隔的作者列表
"Alice, Bob"
--license
许可证标识符
MIT
--name
方法名称(2-25个小写字符)
my-tool
--display-name
人类可读的展示名称(最长128字符)
"My Tool"
--main-pipe
主管道代码(snake_case格式)
extract_data
--force
覆盖已有的METHODS.toml

2. Configure exports

2. 配置导出

Exports declare which pipes the package makes available to consumers. They are organized by domain in
METHODS.toml
:
toml
[exports.restaurant_analysis]
pipes = ["present_restaurant", "extract_menu", "analyze_menu"]
To configure exports:
  1. Read the
    .mthds
    bundle(s) in the package to find the domain codes and pipe codes defined inside them
  2. Edit
    METHODS.toml
    to add an
    [exports.<domain>]
    section for each domain, listing the pipe codes to export
Rules:
  • The
    main_pipe
    of each bundle is auto-exported — you do not need to list it unless you want to be explicit
  • Concepts are always public and do not need to be listed in exports
  • Each
    [exports.<domain>]
    section requires a
    pipes
    key with a list of pipe code strings
导出声明了包可以向使用者提供哪些管道。它们在
METHODS.toml
中按领域组织:
toml
[exports.restaurant_analysis]
pipes = ["present_restaurant", "extract_menu", "analyze_menu"]
配置导出的步骤:
  1. 读取包内的
    .mthds
    包文件,找到其中定义的领域代码和管道代码
  2. 编辑
    METHODS.toml
    ,为每个领域添加
    [exports.<domain>]
    分区,列出要导出的管道代码
规则:
  • 每个包的
    main_pipe
    会自动导出——除非你想要显式声明,否则无需列出它
  • 概念始终是公开的,不需要在导出中列出
  • 每个
    [exports.<domain>]
    分区都需要有一个
    pipes
    键,对应管道代码字符串列表

3. List package manifest

3. 列出包清单

Display the current package manifest:
bash
mthds-agent package list -C <pkg-dir>
展示当前的包清单:
bash
mthds-agent package list -C <pkg-dir>

4. Validate package manifest

4. 校验包清单

Validate the
METHODS.toml
package manifest:
bash
mthds-agent package validate -C <pkg-dir>
Note:
mthds-agent package validate
validates the
METHODS.toml
package manifest. To validate
.mthds
bundle semantics, use
mthds-agent pipelex validate pipe
(see /mthds-check skill).
校验
METHODS.toml
包清单:
bash
mthds-agent package validate -C <pkg-dir>
注意
mthds-agent package validate
仅校验
METHODS.toml
包清单。如果要校验
.mthds
包的语义,请使用
mthds-agent pipelex validate pipe
(参考/mthds-check技能)。

The
-C
option

-C
选项

All
mthds-agent package
commands accept
-C <path>
(long:
--package-dir
) to target a package directory other than the shell's current working directory. This is essential when the agent's CWD differs from the package location.
bash
undefined
所有
mthds-agent package
命令都支持
-C <path>
(全写:
--package-dir
)来指定 shell 当前工作目录之外的包目录。当Agent的当前工作目录和包位置不一致时这个选项非常重要。
bash
undefined

From any directory, target a specific package

可以在任意目录下指定目标包

mthds-agent package init --address github.com/org/repo --version 1.0.0 --description "My package" -C mthds-wip/restaurant_presenter/ mthds-agent package validate -C mthds-wip/restaurant_presenter/

If `-C` is omitted, commands default to the current working directory.
mthds-agent package init --address github.com/org/repo --version 1.0.0 --description "My package" -C mthds-wip/restaurant_presenter/ mthds-agent package validate -C mthds-wip/restaurant_presenter/

如果省略`-C`,命令默认使用当前工作目录。

Common Workflows

常用工作流

Starting a new package:
  1. mthds-agent package init --address <address> --version <version> --description <desc> -C <pkg-dir>
    — create the manifest
  2. Read
    .mthds
    bundles in the package to extract domain codes and pipe codes
  3. Edit
    METHODS.toml
    to set the correct
    [exports.<domain>]
    sections
  4. mthds-agent package validate -C <pkg-dir>
    — validate the manifest
新建一个包
  1. mthds-agent package init --address <address> --version <version> --description <desc> -C <pkg-dir>
    — 创建清单
  2. 读取包内的
    .mthds
    包文件,提取领域代码和管道代码
  3. 编辑
    METHODS.toml
    ,设置正确的
    [exports.<domain>]
    分区
  4. mthds-agent package validate -C <pkg-dir>
    — 校验清单

Reference

参考

  • Error Handling — read when CLI returns an error to determine recovery
  • MTHDS Agent Guide — read for CLI command syntax or output format details
  • 错误处理 — CLI返回错误时阅读本文确定恢复方案
  • MTHDS Agent指南 — 阅读本文了解CLI命令语法或输出格式详情