Docs/CLI reference

CLI reference

tama vocabulary report

Lists every keyword list still written into a repository's code or data files, grouped by the words themselves, so every copy of one list is removed in the same change.

Lists every keyword list still written into a repository's code or data files, grouped by the words themselves, so every copy of one list is removed in the same change.

#Invocation

tama vocabulary report --repo <path> [--repo <path>...] [--json]

--repo names one checkout and may be repeated. --json selects the structured report.

#Why it exists

violations find answers which files break a rule, one finding per file: the right shape for a gate and the wrong one for a repair. The same words live in several files, and fixing them one file at a time is how the copies drifted apart. This report reads what block-keyword-literals refuses — lists in code and in data files, with no declaration hiding any of them — and groups every flagged run by its word set.

#Named word sets

The report also counts one shape the gate does not refuse: words bound one by one to named constants in a file and used together as one class — a collection of the names (&[WRITE_TOOL, EDIT_TOOL]), the arms of a pattern (matches!(tool, WRITE_TOOL | EDIT_TOOL)) or a chain comparing one input with them (tool == WRITE_TOOL || tool == EDIT_TOOL). The set is reported with the words its names hold, at the line that uses them together. Moving a list's words into names renames the list without removing it, so the count does not fall for it. Names bound to something that is not a word (functions.write, a path), a name bound to two different words (a variable) and a collection that also holds a name bound to no word are not word sets. Only names bound in the same file are read.

Names are also followed across the repository. Every name a file binds to one word (pub const WINNER_PRIMARY: &str = "primary";) is looked for in every other file, through its module path or not: compared with ==, !=, === or !== (winner == crate::reconcile::WINNER_PRIMARY), an arm of a | pattern, a member of a bracketed collection, or asked for by .contains. When two or more names one file binds are decided by anywhere, that file's words are one set, reported at every deciding site in every file, so a list whose words were moved into one module's constants is counted where it still decides. A module whose only decided name holds one word is a single keyword and is not counted, and a name two files bind to different words is a variable and joins no set.

#Language and platform vocabularies

A comparison reads a value the language or the platform defines; it does not choose by keyword, so it is not the repository's list. In a JavaScript or TypeScript file, a string compared with a typeof expression (typeof value === 'string') is read from the syntax tree of the JavaScript grammar and never counted. A word set every word of which one type declaration the repository installs names — a union of quoted literals or the quoted keys of one interface in a node_modules/**/*.d.ts file, such as the DOM's HTMLElementTagNameMap and event maps in TypeScript's lib.dom.d.ts or undici's HttpMethod — holds the platform's values (an element's tag name, an event's type, a request's method) and is left out, compared without regard to case. Nothing is listed in Tama: a repository that installs no declarations has those sets counted, and a word set no declaration names in full is counted as before.

#Output and state

Text output prints one block per word set: N site(s): "word", "word", … followed by each site as path:line, then a final vocabularies: V, sites: S; platform declarations read: D. Sets written in the most places come first, then the widest sets. --json prints {vocabularies: [{words, sites, copies}], vocabularyCount, siteCount, platformDeclarations} in the same order, platformDeclarations being how many installed .d.ts files were read. Nothing is written.

#Refusals and failures

Without any --repo the usage is printed to stderr and the command exits 2; a --repo with no path after it does the same after tama vocabulary report: --repo needs a repository path after it. A --repo that names no directory — a relative path given from the wrong working directory — fails with exit 1 and tama vocabulary report: --repo "<path>" names no directory, so its vocabularies are unknown, never answering vocabularies: 0 as if every list were gone. A file or directory that cannot be read — in the checkout or in its installed node_modules declarations — fails the report with exit 1 and tama vocabulary report: cannot read <path>: <cause>, since a report that skipped it would claim every list was counted, or count as the repository's a set the platform declares; a file gone since it was listed, a file that is not text and a submodule's directory hold no list. --help prints the command's lines of the summary and exits 0. The journey tests/vocabulary-report/refusals.rs runs both refusals.

Return to the complete CLI command tree.