Pular para o conteúdo
EN · PT

anchors map

Operate the dependency map (anchors.graph.yaml).

Terminal window
anchors map

Build the dependency map from the project.

Walks the project reading TEXT (never parsing code) and infers the
map's edges by co-location (file names) and by scenario code
(the stable identity that crosses spec→feature→test). Writes anchors.graph.yaml.
Terminal window
anchors map build [flags]
Flag Padrão O que faz
--out output path (default: /anchors.graph.yaml)
--root . project root to scan

The dependency tree of a file: what it uses, or who uses it (–up).

Prints the dependency tree of a file, by the depends-on edges of the map — the ones the
code's `@dep:` flags declare:
anchors map deps TOKNS — what the file of code TOKNS uses, down the tree
anchors map deps src/theme/tokens.ts --up — who uses it, up the tree
anchors map deps ARSCR --depth 2 — two levels
anchors map deps --kind db — each database resource the code reaches, and the files
that reach it (`@dep[db]: <name>`)
Terminal window
anchors map deps <CODE|file> | --kind <kind> [flags]
Flag Padrão O que faz
--depth 0 levels to print (0 = all)
--kind list the resources of a kind (db, api…) and the files that reach each
--root . project root
--up who uses the file, instead of what it uses

Map merge driver: unites the stamps from both sides (git merge=anchors-map).

Resolves the merge of `anchors.graph.yaml` by uniting the judgment stamps
from both sides, instead of merging text.
Not meant to be run by hand. Configure git to call it:
# .gitattributes (in the repository)
anchors.graph.yaml merge=anchors-map
# once per clone
git config merge.anchors-map.name "anchors: unites the map's stamps"
git config merge.anchors-map.driver "anchors map merge %O %A %B"
WHY: the map is derived, and git treats it as text. Measured: a conflict-free merge
erased 62 judgment stamps — the report of each one lives in the command that wrote it, not
in the file, and redoing an adversarial review is expensive.
The result is written to <ours>, which is what git expects.
Terminal window
anchors map merge <base> <ours> <theirs>

The app’s navigation: which screen leads to which.

Prints the navigation between the app's screens — the screens' Out tables and the
code's `@navigates:` flags:
anchors map nav — every screen and where it leads
anchors map nav GoalEdit — one screen: where it comes from and where it leads
Terminal window
anchors map nav [screen] [flags]
Flag Padrão O que faz
--root . project root

Query the map: a node’s neighbourhood, orphans, statistics.

Inspects the dependency map:
anchors map show <file> — the node's neighbourhood (in ↑ / out ↓)
anchors map show --orphans — nodes with no edge at all (islands)
anchors map show --stats — summary (nodes by kind, edges by type)
Terminal window
anchors map show [file] [flags]
Flag Padrão O que faz
--map path to the map
--orphans lists nodes without edges (islands)
--pending with –worklist: only the files that HAVE pending items (failing gates)
--root . project root
--stats graph summary
--worklist lists the nodes in TOPOLOGICAL order (parents/rulers before the governed) — for batch fixing without rework

Comandos da mesma família — o que distingue cada um:

Comando O que faz
anchors map Operate the dependency map (anchors.graph.yaml)
anchors ingest Ingest test signals (JUnit/lcov) the project generated and bind them to the map
anchors test Run the test suites declared in anchors.yaml and ingest the reports
anchors mutation Run the mutation suites declared in anchors.yaml and ingest the reports
anchors keep-evidence Declare that a change proves nothing new, keeping the files’ evidence fresh
anchors stamp Write the missing @contract stamps on test doubles (never rewrites an existing one)
anchors recode Rename an identity code and propagate it across the project
anchors renumber Renumber the revisions this branch added when the base already took their number
anchors generated-paths The paths of DERIVED files — whoever conflicts in them rebuilds
anchors merge-progress Progress merge driver: unites both sides, [x] beats [ ]





O mapa de dependências do Anchors (anchors.graph.yaml) modela todo o repositório como um Grafo Acíclico Dirigido (DAG).


Terminal window
# Reconstrói o grafo de dependências a partir dos arquivos em disco
anchors map build
# Exibe o resumo do grafo e métricas dos nós
anchors map show
# Checa se há ciclos de dependência no projeto
anchors map circular

Antes de alterar uma spec ou entidade central de domínio, calcule o raio de alcance:

Terminal window
anchors impact src/domain/user.spec.md

Saída:

  • Dependentes Diretos: Serviços e handlers que importam ou usam esta unidade.
  • Impacto Downstream: Testes de integração e contratos que ficarão obsoletos (stale).
  • Escopo Recomendado de Testes: Conjunto mínimo de testes a rodar para validar a alteração.

3. Renomeação Atômica de Códigos (anchors recode)

Seção intitulada “3. Renomeação Atômica de Códigos (anchors recode)”

Precisa renomear ou reorganizar o prefixo de um módulo de USER para ACC?

Terminal window
anchors recode USER-B01 ACC-B01

O comando renomeia o código atomicamente na spec, na feature, nos testes, no código fonte e no grafo de dependências de uma só vez.