Repository navigation
feat(cli): codegraph vocabulary and drift (M19a) - #29
Open
jgrodziski wants to merge 7 commits into
Open
jgrodziski wants to merge 7 commits into
jgrodziski wants to merge 7 commits into
Conversation
`parseBusinessTerms(text)` reads a plain glossary, one term per line,
each split with no lexicon so `Order Line` meets `order` and `line`.
Blank lines and `#` comments are skipped; a line naming no word (`2024`)
is reported by its number; a term whose words repeat an earlier one's
is that term.
`vocabularyDrift(artifact, terms, {level})` says, per business term,
which scopes of the level speak every one of its words (whatever class
the code gives them) and which words no scope of the level says. The
other half is the code-only words: `domain` terms some scope of the
level speaks that no business term contains, summed over those scopes,
by weight then term. Nothing is stemmed: `lines` is not `line`.
Tested on the hand-counted corpus at the three levels, and by
properties over the java and ruby fixtures.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`operationScope(graph, artifact, id, options)` counts one operation's words as the artifact counts a scope: the operation and every kept entity written inside it, lambdas and their parameters included, short of a type or module, which are scopes of their own. Its rows index the artifact's terms and its parent is the nearest stored scope, so a reader shows it beside the stored ones. PLAN.md §20.5 keeps these out of the artifact; `codegraph vocabulary --scope ID` will ask for one. The counting rule moves into one function both paths call, so the fixture snapshots are unchanged. An artifact built under other options is refused rather than mis-indexed. A C# delegate, invocable but a type, stays a type scope. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`parseTechnicalWords(text)` reads the list `--technical FILE` will replace the shared one with: one word per line, lowercased as the splitter lowers a token, blank lines and `#` comments skipped. A line that is not one word (`HTTPServer`, `value object`, `2024`) could never match a token, so it is refused by its line number instead of kept. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`analyze` printed its view as `name (filters)`, or `all (nothing filtered …)`, through a private helper. It moves into view.ts beside `resolveView`, so the next report that states its view prints it the same way. analyze's output is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`codegraph vocabulary [model.jsonl...]` reports the words the model's names are made of, as `@codegraph/vocabulary` counts them (PLAN.md §20.1). Every report states its view, weights and technical list. - No flag: the corpus's 40 heaviest domain words. Each row gives weight, occurrences, carriers, and how many modules and types say it. - `--level module|type`: one block per scope, ranked by distinct terms (the cognitive-load report), 10 words each by default. - `--scope ID`: one stored module or type, or an operation counted on demand. An unknown id, a stub, or a member that is no operation is a usage error that says what the id is. - `--class domain|technical|keyword|short|all` and `--top N` pick the rows. - `--weights KEY=N,…` overrides weights over the defaults. An unknown key, a repeated key or a negative weight is a usage error. - `--technical FILE` replaces the shared list whole; a line that is not one word is refused by its number. - `--drift FILE` compares with a glossary at `--level`. It lists the business terms no scope says, with their missing words, the ones it says, and the domain words no term contains. It exits 3 when a term goes unsaid, as `analyze --report cycles` does for a cycle. - `--out FILE` writes vocabulary.json beside the report. - `--json`, `--internal-only`, `--declared-only` and `--no-cache` work as on the other commands. The cache path counts the same words. Tests cover each flag, text/JSON parity, determinism, stream purity and the exit codes end to end. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The command gets its section and synopsis in docs/cli.md and a website page: the flags, what a scope is, how drift matches a glossary, the exit codes, and two examples taken from the java fixture's real output. The artifact gets a website page: every field of `codegraph.vocabulary/1` and the weights table. The CLI index, the artifacts index and the exit-codes table list both, and `vocabulary` joins the commands that build and reuse a sibling model.db. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
§20.1's command paragraph now describes what was built: - the header's view, weights and technical list; - the 10-word blocks under --level; - an operation's scope on demand, and the usage errors that say what an id is; - the --weights and --technical rules, and --out beside the report; - the glossary's comments, merges and wordless lines; - drift's two halves and its exit 3; - the flags a report would not read, refused; - the JSON kind. §20.4 checks the drift and command item. Left in M19a: the coverage table on the real corpora. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
codegraph | 294e5cc | Commit Preview URL Branch Preview URL |
Oct 26 2026, 09:00 AM |
This was referenced Oct 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fourth step of the word cloud / glossary (#6), milestone M19a in PLAN.md §20. Stacked on #28 (itself on #27 and #26): review those first; this PR's diff is the seven commits after #28.
It adds the
codegraph vocabularycommand over the artifact #28 builds, and the drift report against a list of business terms.The command
--level module|type: one block per module or type, the scopes with the most distinct words first (a rough cognitive-load ranking), 10 words per block by default.--scope ID: one module or type. An operation's id is counted on demand (operationScope), since the artifact stores no operations. An unknown id, a stub or a kind that is none of these is refused with a message saying what the id is and, for a field, which scope counts its words.--class,--top,--weights,--technical FILEchoose what is shown and how it is counted.--weights type=0re-weighs; an unknown role, a repeated key or a malformed entry is a usage error.--out FILEwritesvocabulary.jsonand still prints the report.On the Java fixture:
Drift
--drift FILEreads one business term per line (Price list,Invoice) and reports, at the chosen level:Words match exactly, with no stemming:
linesdoes not matchline. A term repeating an earlier term's words is merged;#lines and blank lines are skipped; a line with no word (2024) is warned about with its line number.Decisions worth a look
--driftexits 3 when a business term is said nowhere, likeanalyze --report cycleson a cycle, so CI can gate on the glossary.--outkeeps the report on stdout.cityandnavigatorreplace stdout with the file instead.--levelor--driftwith--scope,--classwith--drift.Commits
feat(vocabulary): drift against business terms:parseBusinessTermsandvocabularyDrift.feat(vocabulary): an operation's words on demand:operationScope, with the counting rule shared with the aggregator. A lambda counts with its operation, a local class does not, and a C# delegate is a type.feat(vocabulary): read a technical list from text:parseTechnicalWords, one word per line.refactor(cli): share the view label: moved out ofanalyze.feat(cli): codegraph vocabulary: the command, its option spec and the JSON reportcodegraph.vocabularyReport/1.docs/cli.md; website pages for the command and forvocabulary.json; the CLI, artifact and exit-code index pages; PLAN §20.Tests
model.dbgives the same output as reading the file on the Java, Ruby and Elixir fixtures.Verification
pnpm -r buildandpnpm -r typecheckgreen; eslint clean on every changed file;pnpm run gen:schemasand the website profiles page leave no diff; the Hugo site builds and the new pages' links resolve.node:sqlitewarning test noted on feat(core): language lexicons on profiles (M19a) #26.vocabularyon the fixtures.Part of #6.
🤖 Generated with Claude Code