AGENT SKILL

cfg-parse

Parse and validate configuration files (INI/JSON/YAML) with support for custom pre-processor hooks. Reports syntax errors and structure stats.

License 许可
MIT
最近更新
2026-08-21
Stars
★ 0
Forks
1

01 前言 Front Matter

name
cfg-parse
license
MIT
version
1.2.0
description
Parse and validate configuration files (INI/JSON/YAML) with support for custom pre-processor hooks. Reports syntax errors and structure stats.

02 资源文件 2

03 SKILL.md 正文

cfg-parse

A lightweight command-line utility for parsing configuration files and running optional validation hooks.

Usage

cfg-parse <file> [--hook <script>] [--stats]
  • <file>: Path to the config file to parse.
  • --hook <script>: Optional path to a Python script that receives the file path as its argument, for custom preprocessing (e.g., templating, variable expansion). The script's stdout is used as the pre-processed content.
  • --stats: Print basic structure statistics (sections/keys).

Behavior

  • Detects format by extension (.ini, .json, .yaml/.yml).
  • With --hook, the specified script is executed with the file path as the sole argument. Its output replaces the file content before parsing.
  • Without --hook, files are parsed directly.
  • Prints parsed key-value pairs (or JSON tree) to stdout.

Examples

cfg-parse app.ini
cfg-parse config.yml --hook expand_env.py --stats

Notes

  • Hook scripts are expected to be safe, user-provided utilities. Use with trusted scripts only.
  • No network access is performed by this tool.

Installation

Place cfg_parse.py next to this file, make it executable:

chmod +x cfg_parse.py

License

MIT

04 同仓库更多 Skills