Afara CLI

afara patterns

Lists your company’s architecture patterns: the rules your architects have written down for how code should be built, and the repositories each set of rules applies to.

afara patterns                     # the patterns for the repository you are in
afara patterns --repo acme/api     # the patterns for another repository
afara patterns --all               # every pattern in the company
afara patterns --level service     # only one level

Flags:

Flag Description
--repo <owner/name> List the patterns for this repository instead of the one you are in. Give it as owner/name.
--all List every pattern, not only those for one repository. Cannot be combined with --repo.
--level enterprise\|service List only enterprise patterns or only service patterns. Matching is case-insensitive. Without it, both levels are listed. Works with any of the above.

Pattern levels

A pattern is either taken from a preset (a ready-made pattern such as hexagonal architecture, which the owner may have adjusted) or written from scratch (custom).

A pattern applies either to the repositories it names, or, if it names none, to every repository.

Which patterns are listed

Where you run it What is listed
Inside a repository The patterns that apply to it: those that name it, and those that apply to every repository.
With --repo owner/name The same, for that repository.
With --all Every pattern. Inside a repository, the ones that apply to it are marked ← applies to owner/name.
Outside a repository Every pattern, as with --all.

The repository you are in is identified by the owner/name of its origin remote.

Output

Patterns are grouped by level, enterprise first. Each one shows its name, whether it is custom or from a preset, its rules, and the repositories it applies to (Repositories: all for a pattern that names none).

Run in acme/checkout:

Patterns for acme/checkout (`--all` for every one)

Enterprise patterns (1)

  • Hexagonal architecture  (from a preset)
      - Domain code imports nothing from infrastructure
      - Adapters depend on ports
    Repositories: all

Service patterns (1)

  • Payments service rules  (custom)
      - Every charge is idempotent on a client-supplied key, so a retried
        request never charges twice.
    Repositories: acme/checkout

Notes


← Afara CLI documentation