Repository navigation
clash-cli: read and edit profiles, override rules, and per-domain DNS - #102
Open
zifengjiang wants to merge 2 commits into
Open
zifengjiang wants to merge 2 commits into
zifengjiang wants to merge 2 commits into
Conversation
added 2 commits
November 16, 2026 19:44
profiles, rules append/remove and dns policy drive the App's configuration store through the new app-store-v1 controller capability.
The app-store endpoints write config inputs (override rules and the runtime DNS patch) straight into the profile store. Without this, the derived files (published rules, the resolved runtime config) are only rebuilt when the app decides to regenerate them, so an edit made over the controller stayed invisible until an unrelated change forced a rebuild. A stamp keeps a fingerprint of the inputs the published revision was built from, and the activation preflight compares it before starting.
vien97
approved these changes
Nov 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
clash-clicontrols the runtime but not the app's configuration store: a profile's override rules and per-domain DNS can only be edited in the UI. This adds the client half so those settings can be scripted, and makes the app pick the change up on the next connect without a manual rebuild.Depends on the kernel side (ProjectClash/Clash#13), which serves
/clash/v1/app/*and advertises capabilityapp-store-v1.What
New commands:
--profiledefaults to the active profile, by id or label.App side: the published config is derived from the profile store, and was only regenerated when the app decided to.
ProfileInputsStamprecords a fingerprint of the inputs a published revision was built from;prepareForStartcompares it before validating and rebuilds when it differs, so an edit made through the controller lands on the next connect. A missing stamp is treated as a change once, and recorded.Verification
go build ./... && go test ./...— 25 tests for the new commands (parsing, profile resolution, merge semantics, capability-missing path).rules appendanddns policy set, then reconnect —clash-cli rule match <domain>reports the new rule andclash-cli dns queryreturns the address from the policy's nameserver.