Rules
Rules connect a repository fact to a profile. They are the decision layer: a rule only selects which profile a repository should use — applying it stays with the normal switching pipeline.
What a rule is
A rule has a name, a single condition, and a target profile. A condition is three parts:
- a subject — the repository fact to inspect,
- an operator — how to compare it,
- a value — what to compare against.
When the condition holds for a repository, the rule's target profile is the one selected.
Conditions: subjects and operators
The supported subjects are:
- Repository path — the folder path on disk.
- Repository name — the repository's name.
- Remote URL — the full
originURL. - Remote host — the host parsed from the remote, e.g.
github.com. - Owner — the owner/organization parsed from the remote, e.g.
my-company.
The supported operators are:
- Contains
- Starts with
- Ends with
- Equals
Host and owner are derived by parsing the remote URL, and GitPersona understands both SSH (git@github.com:owner/repo.git) and HTTPS (https://github.com/owner/repo.git) forms.
How rules are evaluated
Rules are ordered by priority and evaluated from highest priority downward. The first rule that matches wins, and its target profile is selected; no further rules are considered. A rule with an empty value never matches.
Individual rules can be enabled or disabled, and you can reorder them to change priority. Disabled rules are skipped during evaluation.
Previewing a rule
You can preview which rule would match a hypothetical repository by describing its path, name, and remote URL. The preview reports the matching rule and a human-readable reason — and never triggers an actual switch. Use it to sanity-check ordering before relying on Smart Switching.
Managing rules
- Create, edit, duplicate, and delete rules.
- Enable or disable a single rule, or toggle all at once.
- Reorder rules to set evaluation priority.
- Export your rule set to a file and import it on another machine.