Administrators
Team rules (.versora.yml)
10 min read
.versora.yml keeps a team's rules inside the repository itself. It goes in a commit, like the rest of the code, and applies to everyone who opens the repository in Versora. Whoever changes a rule changes the file, and the change goes through the usual review.
The file covers:
- the commit message: title length, title pattern, Conventional Commits and allowed types;
- required Signed-off-by, which Versora adds on its own;
- the co-author trailer for AI-written code: off, suggested or required;
- protected branches, with a warning or with a block;
- team commands, which appear in the palette and in the menus.
The company (computer) policy takes precedence and can tighten these rules. See Company policy.
- Menu: Preferences › Policy and team, Team rules in ‹repository› group, Create .versora.yml from a template button (it appears when the file doesn't exist)
- Palette (Ctrl+P): "Company policy and team rules"
- Open the repository in a tab.
- Go to Preferences › Policy and team. The file's line shows
.versora.yml"doesn't exist" and the explanation: ".versora.yml keeps the team rules in the repository itself: commit message, Signed-off-by, AI trailer, protected branches and commands." - Click Create .versora.yml from a template.
- The notice confirms: ".versora.yml created at the repository root. Review it and include it in a commit so it applies to the team."
- Edit the file in your editor. Everything is optional: delete what you don't want.
- Commit and push the file.
The button never overwrites a file that already exists: "the repository already has a .versora.yml".
# Team rules for Versora. This file lives in the repository and applies to
# everyone who opens it in Versora. Everything is optional: delete what you don't want.
# Your company's (computer) policy can be stricter and wins.
version: 1
commit:
# Maximum and minimum length of the message's first line.
title_max: 72
# title_min: 10
# Expression the first line must match, and the hint shown when it doesn't.
# pattern: '^[A-Z]+-\d+ '
# pattern_hint: 'Start with the issue key (e.g. PROJ-12)'
# Require Conventional Commits and the allowed types.
conventional: false
# types: [feat, fix, docs, refactor, test, chore]
# Require Signed-off-by (Versora adds it when committing).
signoff: false
# Co-author trailer for AI-written code: off, suggested or required.
ai_coauthor: off
# ai_trailer: 'Co-authored-by: AI Assistant <[email protected]>'
branches:
# Direct commits and pushes to these branches ask for confirmation (warn) or are refused (block).
protected: [main]
protected_mode: warn
# Team commands. Nothing runs without each person's confirmation, and a changed
# command asks again. Variables: {repo}, {branch}, {sha}, {short_sha}, {remote}.
# The program runs directly, without a shell: for a pipeline, call a script.
# where: palette, repo, branch, commit.
commands:
# - name: Run the tests
# run: npm test
# where: [palette, repo]
# - name: Branch log
# run: git log --oneline -20 {branch}
# where: [branch]
Delete the file or revert the commit that created it. Without the file, the team rules stop applying right away.
- Name:
.versora.ymlat the root of the working copy..versora.yamlis also accepted. - Reading: on every check, from the working copy, cached by modification date. A
git pullthat brings a new rule already applies on the next commit. - Size: up to 512 KB.
- Syntax error: turns off all the team rules. The page shows "has an error: the team rules aren't in effect" and the message.
- Error in a key: turns off only that key. The reason appears in the list of warnings, for example "commit.title_max: invalid value (a whole number from 10 to 500); the key was ignored".
- Unknown key: "unknown key: … (ignored)". The
$schema,schema,descriptionandcommentkeys at the top are accepted and ignored.
Always 1. Any other value produces the warning "version: only version 1 exists".
| Key | Type | What it does |
|---|---|---|
title_max | number from 10 to 500 | Maximum length of the first line. |
title_min | number from 1 to 200 | Minimum length of the first line. |
pattern | text (regular expression) | Expression the first line must match. |
pattern_hint | text | The hint shown when the title doesn't match the pattern. |
conventional | true or false | Require Conventional Commits: type(scope): description. |
types | list | The allowed types, such as [feat, fix]. Only letters, digits, _ and -. |
signoff | true or false | Require Signed-off-by. Versora adds the line on commit. |
ai_coauthor | off, suggested or required | The AI co-author trailer. true counts as required, and false, as off. |
ai_trailer | text or list | The trailer text, in the Key: value format. With a list, the person chooses; the first is the default. |
Besides true and false, the on/off keys accept required, yes, on, no and off.
About pattern. It only applies to the title. The syntax is the common regular expression one (close to RE2), without backreferences. To check the whole message, use the push rules, which live in .versora/push-rules.json and keep applying together with .versora.yml.
About types. The list is checked whenever the title has the Conventional Commits form, even without conventional: true.
Messages git writes itself (merge, revert, fixup!…) pass without being checked.
| Key | Type | What it does |
|---|---|---|
protected | list | The protected branches. Accepts *, which matches any sequence, including /: release/* protects release/1.4. |
protected_mode | warn or block | warn (default): direct commit and push ask for confirmation. block: direct commit and push are refused. |
protected_mode also applies to the branches protected by the company policy.
The list of team commands, up to 50. The full format, with the parameter types, is in Custom commands. In short:
| Key | Type | What it does |
|---|---|---|
name | text, up to 80 characters | The name in the palette and the menu. It can use variables, such as Log of {branch}. Required. |
id | text | Stable identifier. It's the shortcut's id (custom:team:<id>). Without it, the id comes from the name. |
description | text | A line of explanation. |
run | text or list | The program and the arguments. Runs without a shell. Required. |
where | list | Where it appears: palette, repo, branch, commit, file, selection. Without it, only in the palette. |
params | list | Values asked for in a form before running. |
undo | hard, soft, mixed or off | How Ctrl+Z undoes what the command changed in branches, tags and HEAD. Default: hard. |
snapshot | true or false | Keeps a copy of the files before running. |
Variables. {repo}, {branch}, {sha}, {short_sha} and {remote} work everywhere (in a branch's menu, {sha} is its tip). {file} only in the file menu. {shas} (one argument per commit, from oldest to newest), {oldest_sha} and {newest_sha} only in the commit and selection menus. The values also arrive as VERSORA_* environment variables, and each parameter becomes {key} in run and VERSORA_PARAM_<KEY> in the environment.
No shell. The program (the first word of run) is executed directly and can't come from a variable. For a pipeline, call a script from the repository. In a .cmd, .bat, PowerShell or another shell, typed values can only contain letters, digits and ._/@+=,:~#-; the script reads the full value from the environment variable.
Confirmation. Nothing runs without each person's confirmation. Before running, Versora shows the exact command and the notice "This command comes from this repository's .versora.yml. Check it first: it runs with your permissions, on your computer." The person chooses:
- Run just this once;
- Trust and run: the trust applies to that repository and to that content (name, program, places and parameters). If the command changes in the file, in a pull for example, Versora asks again.
The trust is kept inside the repository's .git folder, never in the versioned file. A fetch or pull doesn't change it, and it doesn't go into "Export settings": a settings file doesn't bring pre-approved commands.
version: 1
commit:
title_max: 72 # first line with at most 72 characters
title_min: 10 # and at least 10
pattern: '^[A-Z]+-\d+ ' # the title starts with the issue key
pattern_hint: 'Start with the issue key (e.g. PROJ-12)'
conventional: true # type(scope): description
types: [feat, fix, docs, refactor, test, chore]
signoff: true # Versora adds the Signed-off-by
ai_coauthor: required # off | suggested | required
ai_trailer: # the person chooses which one (the first is the default)
- 'Co-authored-by: Assistant A <[email protected]>'
- 'Co-authored-by: Assistant B <[email protected]>'
branches:
protected: [main, 'release/*']
protected_mode: block # warn = asks for confirmation; block = refuses direct commit and push
commands: # nothing runs without each person's confirmation
- name: Run the tests
description: Unit tests
run: npm test # no shell: program + arguments
where: [palette, repo]
- name: Log of {branch}
run: git log --oneline -20 {branch}
where: [branch]
- name: Show commit
run: [git, show, --stat, '{sha}']
where: [commit]
- name: New feature from {branch}
id: new-feature # stable: it's the shortcut's id (custom:team:new-feature)
run: git switch -c feature/{name} {base}
where: [palette, branch]
params:
- key: name
type: text
label: Feature name
pattern: '^[a-z0-9-]+$'
hint: Only lowercase letters, digits and hyphens
- key: base
type: branch
label: Starting from
default: '{branch}'
- type: confirm
message: Create feature/{name} from {base}?
With rules in effect, the commit box gets the Rules for this repository bar, for example "title up to 72 · Conventional Commits · types: feat, fix, docs", with the See rules link.
The commit doesn't happen. The The message doesn't follow the rules window says "Fix the message and commit again:" and lists what's missing, with each rule's source:
- "The title has 81 characters; the maximum is 72."
- "The title has 6 characters; the minimum is 10."
- "Start with the issue key (e.g. PROJ-12) (pattern: …)", with the
patternexpression in place of the ellipsis. Withoutpattern_hint: "The title doesn't follow the pattern …". - "The title doesn't follow Conventional Commits (type(scope): description)."
- "The type feature isn't one of the allowed ones: feat, fix, docs."
The only button is Fix the message. There's no "Commit anyway": these are rules, not warnings.
With signoff: true, the bar says "Signed-off-by will be added (…)." On commit, Versora adds Signed-off-by: Name <email> with the identity of whoever commits, without repeating an identical line that's already in the message.
git interpret-trailers --if-exists addIfDifferent --trailer "Signed-off-by: Ana Souza <[email protected]>"
With no identity in git, the commit is canceled: "No git identity (user.name and user.email): Signed-off-by can't be written."
Versora has no way to know whether there's AI-written code, so it asks:
suggested: the bar shows the "Has code written with AI help" box. When checked, the trailer goes into the message. With more than one text inai_trailer, an AI trailer picker chooses which one.required: the bar asks "AI-written code?" with Yes and No and the reminder "answer before committing". If the person commits without answering, the AI-written code? window asks: "This commit has to say whether it has code written with AI help (…). The answer becomes a co-author trailer in the message." The options are "No, no AI code" and "Yes — ‹trailer›". The button is Commit.
If the trailer is already written in the message, the bar says "The AI trailer is already in the message." and nothing is asked. With no ai_trailer anywhere, Co-authored-by: AI Assistant <[email protected]> applies.
warn: direct commit and push on a protected branch go through the usual protected branch confirmation. See Protected branch.block: the commit is refused in the Protected branch window: "main is protected and doesn't accept direct commits (team rule (.versora.yml)). Create a branch for your work and open a merge request." So is the direct push: "origin/main is protected and doesn't accept direct pushes (…). Push your branch and open a merge request." The button is Got it.
In Preferences › Policy and team, the Team rules in ‹repository› group shows:
- the file's line and its state: "doesn't exist", "in effect" or "has an error: the team rules aren't in effect";
- the warnings about ignored keys;
- Rules in effect, already combined with the company policy, each with the Company or Team badge. With none: "No commit or branch rules are in effect in this repository.";
- the
.versora/push-rules.jsonline with Open Push rules; - Team commands: each command with its
run, "Shown in: …", the "trusted" or "asks first" badge and the Run… and Stop trusting buttons.
Combinations that don't make sense also appear there:
- "the minimum title length (…) is greater than the maximum (…)";
- "none of the team's types is allowed by the company: no conventional message will pass";
- "no AI trailer text was set; using the default".
- In Preferences › Policy and team, find the command with the "trusted" badge.
- Click Stop trusting.
- The notice confirms: ""Run the tests" will ask for confirmation again."
- The company policy sets the floor:
commit_title_max,commit_conventional,commit_types,commit_signoff,ai_coauthor,ai_trailerandprotected_branches. See Policy keys. team_commands: denyturns off all the.versora.ymlcommands. The list shows "Team commands were turned off by your company's policy."- Each person can also have their own commands, in the same format, in Preferences › Custom commands. The editor's Show as YAML generates the item ready to paste here.