Skip to content
Versora

Manual

Administrators

Team rules (.versora.yml)

10 min read

On this page

.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.

Create the file

Where to find it

  • 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"

Step by step

  1. Open the repository in a tab.
  2. 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."
  3. Click Create .versora.yml from a template.
  4. The notice confirms: ".versora.yml created at the repository root. Review it and include it in a commit so it applies to the team."
  5. Edit the file in your editor. Everything is optional: delete what you don't want.
  6. Commit and push the file.

The button never overwrites a file that already exists: "the repository already has a .versora.yml".

The template created

YAML
# 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]

How to undo

Delete the file or revert the commit that created it. Without the file, the team rules stop applying right away.

Where the file lives and how it's read

  • Name: .versora.yml at the root of the working copy. .versora.yaml is also accepted.
  • Reading: on every check, from the working copy, cached by modification date. A git pull that 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, description and comment keys at the top are accepted and ignored.

Key reference

Always 1. Any other value produces the warning "version: only version 1 exists".

KeyTypeWhat it does
title_maxnumber from 10 to 500Maximum length of the first line.
title_minnumber from 1 to 200Minimum length of the first line.
patterntext (regular expression)Expression the first line must match.
pattern_hinttextThe hint shown when the title doesn't match the pattern.
conventionaltrue or falseRequire Conventional Commits: type(scope): description.
typeslistThe allowed types, such as [feat, fix]. Only letters, digits, _ and -.
signofftrue or falseRequire Signed-off-by. Versora adds the line on commit.
ai_coauthoroff, suggested or requiredThe AI co-author trailer. true counts as required, and false, as off.
ai_trailertext or listThe 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.

branches

KeyTypeWhat it does
protectedlistThe protected branches. Accepts *, which matches any sequence, including /: release/* protects release/1.4.
protected_modewarn or blockwarn (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.

commands

The list of team commands, up to 50. The full format, with the parameter types, is in Custom commands. In short:

KeyTypeWhat it does
nametext, up to 80 charactersThe name in the palette and the menu. It can use variables, such as Log of {branch}. Required.
idtextStable identifier. It's the shortcut's id (custom:team:<id>). Without it, the id comes from the name.
descriptiontextA line of explanation.
runtext or listThe program and the arguments. Runs without a shell. Required.
wherelistWhere it appears: palette, repo, branch, commit, file, selection. Without it, only in the palette.
paramslistValues asked for in a form before running.
undohard, soft, mixed or offHow Ctrl+Z undoes what the command changed in branches, tags and HEAD. Default: hard.
snapshottrue or falseKeeps 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.

Complete example

YAML
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}?

What the person sees when committing

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.

Message outside the rules

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 pattern expression in place of the ellipsis. Without pattern_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.

Signed-off-by

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.

bash
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."

AI trailer

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 in ai_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.

Protected branch

  • 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.

The rules in effect

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.json line 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".

Stop trusting a command

  1. In Preferences › Policy and team, find the command with the "trusted" badge.
  2. Click Stop trusting.
  3. 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_trailer and protected_branches. See Policy keys.
  • team_commands: deny turns off all the .versora.yml commands. 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.

See also