commands-frontmatter-adapter
Parse Claude command frontmatter and expose body/meta for Codex CLI.
安装与使用
请根据来源仓库和你的 AI 工具说明安装此技能。先阅读技能文件和依赖要求,再添加到工作流。
查看来源 ↗使用指南技能说明
Commands Frontmatter Adapter
Extract frontmatter and body from Claude-style command files so Codex CLI can consume the body as a prompt while still exposing metadata as JSON.
Usage
- By command name (from the scripts directory):
./adapter.py --command diary --pretty - By explicit file (from anywhere):
/abs/path/to/adapter.py --file /abs/path/to/src/.claude/commands/diary.md
Note: The script resolves src/.claude/commands relative to the skill location, so symlinked global installs work without depending on the current working directory. Use --file if your commands live elsewhere.
Options
-
--body-onlyOutput body only (paste into prompt) -
--frontmatter-onlyOutput parsed frontmatter as JSON -
--raw-frontmatterOutput raw frontmatter block -
--prettyPretty-print JSON
Behavior
- Treat the first
---...---block as frontmatter. - Try
yaml.safe_load; if PyYAML is missing or fails, fall back to a minimal parser (key/value and bullet lists). - JSON output structure:
-
file: target file path -
frontmatter: parsed metadata (dict or null) -
frontmatter_raw: raw text -
body: body text
-
Known frontmatter keys (current commands)
-
description: short summary shown in command picker. -
argument-hint: usage hint for$ARGUMENTS. -
allowed-tools: tool whitelist string (pass-through; no validation here).
The adapter performs parsing only; interpretation or enforcement of these keys is left to the caller (e.g., Codex CLI prompt wrappers).
Tips
- Prefer
--body-onlywhen piping into Codex CLI prompts. - Manually respect metadata such as
allowed-toolsas needed in your session. - If a file has no frontmatter, only the body is returned.
使用示例
查看来源仓库中的使用示例与配置说明。
查看来源 ↗来源历史
- 收录时间
- 2026-01-20
- 索引更新时间
- 2026-01-26
- Branch
- main
收录与同步日期属于本站记录。源码修改历史请查看来源仓库。
GitHub ↗chat Comments (0)
Sign in to join the discussion and leave a comment.
No comments yet. Be the first to share your thoughts!