feat(symbols): add visibility column derived from JSDoc tags (B.7)#28
feat(symbols): add visibility column derived from JSDoc tags (B.7)#28SutuSebastian merged 1 commit intomainfrom
Conversation
Promotes JSDoc `@public` / `@private` / `@internal` / `@alpha` / `@beta` from a `LIKE '%@beta%'` regex inside the `visibility-tags` recipe to a real `symbols.visibility` TEXT column. SCHEMA_VERSION 3 → 4 (.codemap.db rebuilds automatically on mismatch via the existing createSchema flow). Parser: - New `extractVisibility(doc)` helper exported from parser.ts - Tag must start its own line (anchored on \n + optional whitespace) so backticked references inside prose like "matches @public, @Private" are correctly ignored — those are descriptions of tags, not declarations of one - First match in document order wins when multiple line-leading tags are present - Single post-processing pass on extractFileData populates symbols[].visibility from doc_comment — keeps the 8 push sites in parser.ts free of derivation logic DB: - New partial index idx_symbols_visibility(visibility, file_path, name, line_start) WHERE visibility IS NOT NULL — the common query shape is WHERE visibility = ? or WHERE visibility IN (...) - insertSymbols extends the column list + binding tuple Recipe: - `visibility-tags` SQL now `WHERE visibility IS NOT NULL`. Returns the visibility value as a column so agents can filter / group without re-parsing the doc_comment Tests: - Parser tests cover null/empty doc, each canonical tag, in-prose false negatives, ordering, look-alike rejection (@Betatwo, @publicly), and per-method override on classes - DB test inserts three symbols with mixed visibility and asserts the partial-index round-trip - Golden visibility-tags.json regenerated with the new column Adopted from docs/research/fallow.md B.7. Schema bumps justify a minor release per .agents/lessons.md "changesets bump policy (pre-v1)".
🦋 Changeset detectedLatest commit: cfbc9c8 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Warning Rate limit exceeded
To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (9)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Review rate limit: 0/1 reviews remaining, refill in 23 minutes and 16 seconds.Comment |
…ty column (#29) ## Summary The recent merges to `main` shipped: - **Tier A query flags** (PR #26): `--summary`, `--changed-since <ref>`, `--group-by owner|directory|package`, plus per-row recipe `actions`. - **B.7 — `symbols.visibility` column** (PR #28). But the bundled `templates/agents/` rule + skill (the surface installed by `codemap agents init`) didn't reference any of them. Agents installed downstream would have a stale view of the CLI surface and miss the structured-column path for visibility queries. This PR aligns four files in lockstep: | File | Audience | | --- | --- | | `templates/agents/rules/codemap.md` | **Ships to npm** — installed by `codemap agents init` | | `templates/agents/skills/codemap/SKILL.md` | **Ships to npm** | | `.agents/rules/codemap.md` | This repo's dev mirror (so my own session view stays accurate) | | `.agents/skills/codemap/SKILL.md` | Same | ## Per-rule edits - New CLI table rows for `--summary`, `--changed-since`, `--group-by` (with example commands). - One-liner about per-row recipe `actions` (json + recipe only; ad-hoc SQL never carries them). - New trigger pattern row: questions about `@internal` / `@beta` / `@alpha` / `@private` route to **`symbols.visibility`** (the parsed JSDoc tag) rather than `doc_comment LIKE '%@beta%'`. - New quick-reference query for visibility. ## Per-skill edits - New `symbols.visibility` row in the schema table. - Two new query examples in the **Basic lookups** block: `WHERE visibility IS NOT NULL` and `WHERE visibility = 'beta'`. - New **Output flags** subsection covering `--summary` / `--changed-since` / `--group-by` / per-row `actions`. - Recipe id list extended with `deprecated-symbols`, `visibility-tags`, `barrel-files`, `files-hashes` (already shipped via earlier PRs but never enumerated in the skill). ## Why patch (not minor) `templates/agents/` is the only ship-affecting surface here. The column + flags themselves were released by their respective minor / patch changesets earlier on main. Per `.agents/lessons.md` "changesets bump policy (pre-v1)", docs / template churn defaults to patch. ## Test plan - [x] `bun run check` passes locally (build, format:check, lint:ci, test, typecheck, test:golden — 19/19 golden scenarios green). - [x] Diff between dev mirror (`.agents/`) and shipped templates (`templates/agents/`) confirmed to differ only on the CLI-prefix prose (`bun src/index.ts` vs `codemap`) — same content otherwise. - [ ] CI green.
…chitecture skills (#32) Two unrelated docs changes batched: ## 1. Plan: `codemap audit --base <ref>` (B.5) Per `docs/README.md` Rule 3 (plans live in `plans/<feature-name>.md`, link from `roadmap.md`), drafts the design for **B.5** before writing any code. The research note explicitly calls this "the single highest-leverage candidate this refresh." | Decision | v1 | | --- | --- | | **Snapshot strategy** | Temp worktree + full reindex under `.codemap.audit-<sha>/` (gitignored by the existing `.codemap.*` glob). Defers caching / perf-tuning until a real consumer hits the wall. | | **Built-in deltas** | `files`, `dependencies`, `deprecated`, `visibility`, `barrels`, `hot_files`. Each wraps an existing recipe — no new analysis layer. | | **Verdict** | `pass` / `warn` / `fail` with thresholds **opt-in via `codemap.config.audit`**. v1 emits raw deltas only (default `pass`). | | **Exit codes** | `0` / `1` / `2` — mirrors `git diff --exit-code`. | | **Composition** | `--json` / `--summary` work; `--changed-since` / `--group-by` / `--save-baseline` / `--baseline` are mutex (different shapes / semantics). | | **Tracer-bullet sequence** | 7 commits: scaffold → worktree → first delta → remaining deltas → threshold config → docs+agents (Rule 10) → changeset. | Both prerequisites just merged on `main`: B.6 (PR #30) proves the snapshot-in-DB primitive; B.7 (PR #28) provides the `symbols.visibility` column the `visibility` delta needs. ## 2. Adopt two Tier 3 skills from [`mattpocock/skills`](https://github.com/mattpocock/skills) Sourced after evaluating three skills mid-thread; the two adopted ones earn their always-zero-cost slot: | Skill | What | | --- | --- | | **`grill-me`** | 8-line interview-pattern skill. Walk a design tree branch by branch, recommend an answer per question, ask one at a time. Filled the gap visible in commit 1's plan: I made many decisions by myself; `grill-me` would have surfaced them for second opinion before they crystallised. | | **`improve-codebase-architecture`** | Ousterhout-style deepening vocabulary (`module / interface / seam / adapter / depth / leverage / locality`), the deletion test, "one adapter = hypothetical seam, two = real," dependency categories (`DEEPENING.md`), and parallel-sub-agent "Design It Twice" interface exploration (`INTERFACE-DESIGN.md`). | Both are maintainer-only (under `.agents/skills/` + `.cursor/skills/` symlinks per `agents-first-convention`). **Not added to `templates/agents/`** — same precedent as PR #25 (consumer surface ships only the codemap rule + skill). ### Translation notes `improve-codebase-architecture/SKILL.md` adapted at three points to fit codemap's docs framework (the upstream version assumes `CONTEXT.md` + `docs/adr/`; we have neither): - `CONTEXT.md` references → `docs/glossary.md` (Rule 9 already enforces glossary updates per PR). - `docs/adr/` references → `docs/plans/<topic>.md` (Rule 3 — but plans are mortal; decisions of record lift to `architecture.md` per Rule 2 then the plan is deleted). - "Offer ADR on rejection" step → dropped. Codemap doesn't keep decision records; the closest is "lift to architecture.md." Companion files (`LANGUAGE.md`, `DEEPENING.md`, `INTERFACE-DESIGN.md`) ship **verbatim** — none reference `CONTEXT.md` or ADRs. `grill-me/SKILL.md` extended with two short codemap-specific notes: prefer `codemap` over `Grep` when exploring (per the `codemap` rule), and write crystallised answers into the in-flight `docs/plans/<name>.md` inline (Rule 3). ### Skipped - **`grill-with-docs`** (the third skill in the upstream "grill" family) — requires standing up CONTEXT.md / `docs/adr/` infrastructure that conflicts with the lift-to-architecture-then-delete-the-plan lifecycle codemap already runs. The salvageable ADR 3-criteria gate is recorded in this conversation; lift if codemap ever needs ADRs. ### Tier 3 list updated `.agents/rules/agents-tier-system.md` Tier 3 list extended with both new skills, and the previously-missing `docs-governance` + `docs-lifecycle-sweep` entries from PR #25. ## Test plan - [x] `bun run check` green (no behavior changed; pure docs + skills). - [x] All cross-references resolve (plan → research → architecture / lessons; skill files → glossary.md / architecture.md / codemap rule / each other). - [x] `.cursor/skills/{grill-me,improve-codebase-architecture}` symlinks resolve. - [x] Plan calls itself out as **Plan** type per `docs/README.md § Document Lifecycle` — delete on ship, lift to `architecture.md`. - [ ] CI green.
) * docs(research): refresh fallow.md + scan against current ship state fallow.md gains a "Status snapshot (as of 2026-05-01)" section that tabulates every adoption candidate's ship status — single source of truth for "what's open" without munging the original tier tables. Captures: - Tier A all shipped (PR #26) - B.5 partial (v1 in PR #33; --base <ref> + verdict deferred to v1.x) - B.6 shipped (PR #30) — table-in-DB, not parallel JSON files - B.7 shipped (PR #28) — landed on `symbols`, not `exports` - B.8 / C.9 / C.10 / C.11 / D.* still as-was - MCP server (agent-transports v1) shipped in PR #35 (adjacent — not a numbered fallow candidate but worth surfacing here) § 6 open questions: marks the 2 settled ones (actions ownership, audit verdict default) with their resolution PRs; preserves the 2 still-open ones (coverage column shape, plugin layer scope). § 3 already-shipped block: updates the visibility-tags note to acknowledge B.7 promoted it from regex to structured column instead of saying "B.7 proposes promoting" (which it doesn't anymore). competitive-scan-2026-04.md § 4: marks MCP server wrapping `query` as ✅ shipped via PR #35 with a cross-link to fallow.md's status snapshot. Other items still tracked there. No behavior change; pure docs refresh to match current reality. * docs(research): fix MD056 — D row in fallow.md status snapshot was 4 cells, header was 5 CodeRabbit caught: status-snapshot table header has 5 columns (Tier / # / Item / Status / Where) but the D.12-D.16 row only had 4 (collapsed Status + Where into one cell). Markdown parses that as a malformed table; renderers either drop the row or misalign neighbouring rows. Added the missing 5th cell pointing back at § 1's Defer / skip table for the per-row reasoning. * docs(research): align B.7 row title to shipped column name (symbols.visibility) CodeRabbit caught: Tier B table B.7 row title still said 'exports.visibility column' despite the body hedging '(or symbols)' AND the shipped column landing on symbols. Status snapshot row at L22 already says symbols. Updated the title to match shipped reality + added an explicit nod to the original hedge so the historical-record property survives.
Summary
Implements B.7 from
docs/research/fallow.md§ Tier B: promote JSDoc visibility tags from aLIKE '%@beta%'regex inside thevisibility-tagsrecipe to a realsymbols.visibilityTEXT column.SCHEMA_VERSION3 → 4..codemap.dbrebuilds automatically on next index via the existingcreateSchema()mismatch-detection path — no manual intervention.What's new
symbols.visibility TEXTcolumn. Partial indexidx_symbols_visibility(visibility, file_path, name, line_start) WHERE visibility IS NOT NULLcoversWHERE visibility = ?queries.extractVisibility(doc): string | null. Anchored on line-start (after the JSDoc*prefix), so backticked references inside prose ("matches@public,@private") intentionally don't match — those are descriptions, not declarations. First match in document order wins when multiple line-leading tags are present.visibility-tagsSQL switches toWHERE visibility IS NOT NULLand returns thevisibilityvalue as a column so agents can filter / group without re-parsing the doc_comment.@betaTwo,@publicly), and per-method override on classes. DB test inserts three symbols with mixed visibility and asserts the partial-index round-trip. Goldenvisibility-tags.jsonregenerated with the new column.Why a minor changeset
Per
.agents/lessons.md"changesets bump policy (pre-v1)" — schema bumps that force a.codemap.dbrebuild are minor, even in0.x. Same precedent as0.2.0.What's not in this PR
--group-by visibilityshortcut — no special-casing; agents already get it via SQLGROUP BY visibilityor--group-by directoryagainst thevisibility-tagsrecipe rows.exports(vssymbols) — re-exports inherit the source symbol's tag; no separate column needed today.@deprecatedpromotion — orthogonal to visibility (a deprecation is a lifecycle signal, not a visibility level). Stays on thedoc_comment LIKE '%@deprecated%'path until a separate PR justifies its own column.Test plan
bun run checkpasses locally (build, format:check, lint:ci, test, typecheck, test:golden — all 19 golden scenarios green).bun src/index.ts --fullsucceeds and reports the schema-version-mismatch rebuild path.bun src/index.ts query --json -r visibility-tagsreturns rows withvisibility: "internal"(and similar) instead of just doc_comment regex matches.bun src/index.ts query --json "SELECT visibility, COUNT(*) FROM symbols WHERE visibility IS NOT NULL GROUP BY visibility"works (uses the new partial index).@publicbecause of backticked references) is gone.