Skip to content

feat(docs): look up the API by name with appkit docs NAME... - #727

Merged
MarioCadenas merged 2 commits into
mainfrom
feat/appkit-docs-name-lookup
Nov 11, 2026
Merged

MarioCadenas merged 2 commits into
mainfrom
feat/appkit-docs-name-lookup

Conversation

@pffigueiredo

@pffigueiredo pffigueiredo commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Summary

appkit docs now answers by API name: appkit docs BarChart DataTable Select useAnalyticsQuery sql prints the props, types and defaults of each name from the installed package's docs, so an agent can look up a whole screen's API in one call instead of probing node_modules and .d.ts files. Before this, appkit docs BarChart answered No section matching "BarChart".

What a lookup prints

$ npx @databricks/appkit docs BarChart LineChart DataTable
=== BarChart (docs/api/appkit-ui/data/BarChart.md)
# BarChart
Bar Chart component for categorical comparisons.
- data?: ChartDataInput — Arrow Table or an array of row objects (interfaces and `as const` arrays too).
- colors?: string[] — Custom colors for series (overrides colorPalette) as hex, rgb() or hsl() strings, since ECharts …
- height?: number — Chart height in pixels.
…
=== LineChart (docs/api/appkit-ui/data/LineChart.md)
- showSymbol?: boolean = false — Show data point symbols
- smooth?: boolean = true — Smooth line curves
- queryKey, parameters, format, …, valueFormatter: as in BarChart
=== DataTable (docs/api/appkit-ui/data/DataTable.md)
…
  • Names resolve to component pages and their parts (SelectItem), the appkit reference pages (sql, createApp), and hooks documented in the guides (useAnalyticsQuery).
  • One name prints its page in full, examples included. Several names leave out examples, give props their summary sentence (the TSDoc convention), and refer back to a prop or note an earlier name already printed (- queryKey, … : as in BarChart, (as in BarChart)), which keeps eight names under 10K characters. Agent harnesses commonly truncate tool output around 10K.
  • An unknown name gets similar names, matched on names and on component descriptions (appkit docs DatePicker suggests Calendar). When nothing was found, it also lists the sections and exits 1.
  • Section names and ./docs/... paths behave as before. A single argument is a section query when it matches a section and isn't all documented names.

Behavior that was only in the code

Agents learned these by breaking apps, so they are now in the generated pages:

  • DataTable: which first-row keys become columns, and that every numeric-looking cell (numeric strings included) is formatted as USD or abbreviated, so ids, zip codes and years belong in a Table.
  • Chart colors and the --chart-cat-* variables must be hex, rgb() or hsl(): ECharts can't resolve var() or parse oklch() and draws them gray.
  • The valueFormatter signature, written out instead of naming ChartValueFormatter.
  • useAnalyticsQuery's own section now says to wrap parameters in useMemo, which was only in the separate Memoization section.

Each fact sits in the first sentence of its prop description, because multi-name lookups print only that sentence. The props generator now also escapes | in prop descriptions, which would otherwise split the table cell.

Testing

  • docs.test.ts covers indexing, single and multi-name output, deduplication and suggestions against a fixture docs tree.
  • Ran generate:types (no drift), check, typecheck, knip and pnpm test locally. The one failure, typecheck-vite-plugin.test.ts, passes when run on its own and doesn't touch this code.
  • Built and packed both packages, installed them into a generated app, and had a coding agent build seven apps twice each with appkit docs NAME... as its only API source. Every app typechecked and built, and the agents found what they needed in one or two lookups.

@pffigueiredo
pffigueiredo requested a review from a team as a code owner November 10, 2026 12:21
@github-actions

github-actions Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

📦 Bundle size report

Compared against bundle-size-baseline.json (main).

@databricks/appkit

npm tarball (packed): 1.3 MB — gzipped download (dist + bin; excludes release-only docs/NOTICE).

dist raw gzip
JS (runtime) 1.3 MB 478 KB
Type declarations 470 KB 169 KB
Source maps 2.6 MB 888 KB
Other 11 KB 3.7 KB
Total 4.4 MB 1.5 MB
Per-entry composition (own code — deps external (as shipped))
Entry Initial (gz) Lazy (gz) Total (gz) node_modules (min) Own code (min)
. 107 KB 2.5 KB 110 KB external 347 KB
./beta 113 KB 485 B 114 KB external 338 KB
./testing 46 KB 33 KB 79 KB external 229 KB
./tsdown 520 B 0 B 520 B external 813 B
./type-generator 26 KB 0 B 26 KB external 74 KB

Chunks:

Entry Chunk Load Size (gz)
. index.js initial 103 KB
. utils.js initial 4.6 KB
. remote-tunnel-manager.js lazy 2.5 KB
./beta beta.js initial 93 KB
./beta modular.js initial 6.0 KB
./beta stream-manager.js initial 5.9 KB
./beta service-context.js initial 4.3 KB
./beta databricks.js initial 3.3 KB
./beta client.js initial 648 B
./beta index.js initial 20 B
./beta supervisor-api.js lazy 193 B
./beta databricks.js lazy 178 B
./beta index.js lazy 114 B
./testing manifest.js initial 33 KB
./testing index.js initial 10 KB
./testing wide-event-emitter.js initial 2.9 KB
./testing index.js lazy 29 KB
./testing remote-tunnel-manager.js lazy 2.5 KB
./testing utils.js lazy 1.8 KB
./tsdown index.js initial 520 B
./type-generator index.js initial 26 KB

@databricks/appkit-ui

npm tarball (packed): 406 KB (+1.1 KB) — gzipped download (dist + bin; excludes release-only docs/NOTICE).

dist raw gzip
JS (runtime) 436 KB (+508 B) 150 KB (+281 B)
Type declarations 271 KB (+977 B) 100 KB (+460 B)
Source maps 862 KB (+1.0 KB) 291 KB (+472 B)
CSS 16 KB 3.2 KB
Total 1.5 MB (+2.5 KB) 544 KB (+1.2 KB)
Per-entry composition (consumer bundle — deps bundled, peerDeps external)
Entry Initial (gz) Lazy (gz) Total (gz) node_modules (min) Own code (min)
./js 5.3 KB 49 KB 55 KB 208 KB 14 KB
./js/beta 2.1 KB 0 B 2.1 KB 0 B 5.0 KB
./react 440 KB 49 KB 489 KB 1.4 MB 178 KB
./react/beta 14 KB 0 B 14 KB 25 KB 16 KB

Chunks:

Entry Chunk Load Size (gz)
./js index.js initial 5.2 KB
./js chunk initial 120 B
./js apache-arrow lazy 49 KB
./js/beta beta.js initial 2.1 KB
./react index.js initial 438 KB
./react tslib initial 2.1 KB
./react apache-arrow lazy 49 KB
./react/beta beta.js initial 14 KB

@github-actions

github-actions Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

🤖 AppKit PR bot

🔬 Run evals

Start an eval for this PR from the evals-monitor app: Go to Evals Monitor →

📦 Try this PR's app template

Scaffolds a new app from this PR's SDK build. Run it in any folder (requires the GitHub CLI — gh auth login — and the Databricks CLI):

gh run download 43041592607 -R databricks/appkit -n appkit-template-0.93.0-pr.58ce45a-feat-appkit-docs-name-lookup-727 -D appkit-pr-727 \
  && unzip -o "appkit-pr-727/appkit-template-0.93.0-pr.58ce45a-feat-appkit-docs-name-lookup-727.zip" -d "appkit-pr-727" \
  && databricks apps init --template "appkit-pr-727"

The template pins @databricks/appkit and @databricks/appkit-ui to tarballs built from this branch, so the scaffolded app runs against this PR's code.

Agents writing AppKit apps need a component's props before they write code, but
`appkit docs` only navigated sections and file paths: `appkit docs BarChart`
answered "No section matching", so agents probed `node_modules` and `.d.ts`
files instead.

`appkit docs BarChart DataTable Select useAnalyticsQuery sql` now prints each
name's page, part, hook section or reference page, with props one per line and
no table chrome. A multi-name lookup leaves out examples and prints a prop or
note that an earlier name already showed only by name, so a screen's worth of
names stays short (about 9K characters for ten). An unknown name gets similar
names, by name and by component description (DatePicker suggests Calendar).

Some behavior was documented only in code, so agents learned it by breaking
apps. The docs now state DataTable's column keys and cell formatting, which
colors ECharts can draw, the `valueFormatter` signature, the chart `data` row
type, and `useMemo` for `useAnalyticsQuery` parameters.

Signed-off-by: Pedro Figueiredo <pedro.figueiredo@databricks.com>
Each documented name is classified once, as a component page, a reference page or
a guide, and each file is read once with every line marked as code or not. The
docs layout used to be matched in four places, and code fences were tracked in
three (not at all while indexing).

This fixes lookups that misread the layout:
- `appkit docs Plugin` printed one `void` for five Returns sections: repeated
  lines are now only collapsed on component pages, where the generator repeats a
  page's intro and the charts share notes.
- `appkit docs Sidebar` answered with styling.md's color section: only
  `api/appkit-ui/<group>/<Name>.md` files are component pages.
- A single unknown name (`appkit docs DatePicker`) went to the section index and
  never got suggestions; it now gets them, and lists the sections and exits 1
  when no name was found.
- A `#` line in a code block ended a section.

A later name refers back to repeated prose ("(as in BarChart)") as it already
did for props, replacing a 100-character threshold. The generator escapes all
props-table cells in one place and notes that `appkit docs` parses the table.

Signed-off-by: Pedro Figueiredo <pedro.figueiredo@databricks.com>
@pffigueiredo
pffigueiredo force-pushed the feat/appkit-docs-name-lookup branch from fe9ded0 to 3912bbd Compare November 11, 2026 14:45
@pffigueiredo
pffigueiredo enabled auto-merge (squash) November 11, 2026 14:54
@MarioCadenas
MarioCadenas merged commit ac4263a into main Nov 11, 2026
70 of 77 checks passed
@MarioCadenas
MarioCadenas deleted the feat/appkit-docs-name-lookup branch November 11, 2026 16:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants