Commit Graph
2 Commits
Author SHA1 Message Date
Chi Zhang e2a2348529 feat: support explicit rule-provider format in rulesets
Add support for an optional `format` field in external ruleset
definitions so Clash/Mihomo rule-providers can declare their source
format explicitly.

Previously, `type = "clash-domain"`, `type = "clash-ipcidr"`, and
`type = "clash-classic"` only described the provider behavior, while the
provider format was implicitly left as the Clash/Mihomo default YAML
format. This worked for YAML rule-provider files with a top-level
`payload` field, but failed for valid text-format providers such as
domainset files that contain plain domain entries without a `payload`
wrapper.

This change allows users to configure:

    [[rulesets]]
    group = "Apple CDN"
    ruleset = "https://ruleset.skk.moe/Clash/domainset/apple_cdn.txt"
    type = "clash-domain"
    format = "text"

The generated rule-provider will now include:

    format: text

Supported values are:

    yaml
    text
    mrs

The new `format` option is only accepted for Clash/Mihomo native
rule-provider types:

    clash-domain
    clash-ipcidr
    clash-classic

For compatibility, omitting `format` preserves the previous behavior and
does not emit a `format` field, allowing Clash/Mihomo to continue using
its default YAML format.

Validation is also added to reject unsupported format values and to
prevent `format = "mrs"` from being used with `clash-classic`, since MRS
rule-sets only support domain and IP-CIDR behaviors.
2026-06-17 14:35:19 +08:00
Chi Zhang ca0921c58f fix(clash): quote VLESS Reality short-id in YAML output 2026-06-13 11:28:45 +08:00