docs(HF-282): auto-derive function & language counts in docs - #1715
Conversation
✅ Deploy Preview for hyperformula-dev-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Performance comparison of head (ea8e6a4) vs base (f9c50c1) |
|
bugbot run |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 9974cda. Configure here.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 717e7f4. Configure here.
The function count already auto-derived via {{ $page.functionsCount }};
add a parallel {{ $page.languagesCount }} sourced from the i18n export
barrel (src/i18n/languages/index.ts), and swap the remaining hardcoded
counts to the interpolated variables.
- config.js: derive languagesCount once at module load from the barrel
(whitespace-tolerant regex + fail-loud guard so a barrel reformat can
never silently publish "0 languages"); inject $page.languagesCount.
- docs: ~400/400+ -> {{ $page.functionsCount }} (index, ai-sdk,
mcp-server, langchain); 17/18 -> {{ $page.languagesCount }}
(index, built-in-functions, i18n-features, localizing-functions).
- README (not a VuePress page): manual "over 400" + "18" (drift-resistant).
Verified via docs:build: renders 418 functions / 18 languages, incl.
inside markdown link text, with no un-rendered mustache in dist.
Docs-only + docs-build-config: no CHANGELOG per DEV_DOCS DoD.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The companion resolver added in #1703 substitutes `{{ $page.* }}` only for an allowlist of injected keys. `languagesCount` was not on it, so the built `.md` companions and `llms-full.txt` shipped the raw mustache while the HTML rendered the number -- visible only after rebasing onto develop, which is where the resolver came from. Verified on a full docs:build: no `$page.` remains anywhere in dist; index.md, localizing-functions.md, i18n-features.md, built-in-functions.md and llms-full.txt all carry the resolved count. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The root README.md is rendered by GitHub and npm, not VuePress, so it cannot use
the `{{ $page.languagesCount }}` interpolation and states the count literally.
That number already rotted once: the Indonesian pack (#1674) left the README
saying 17.
Check it at config load against the same barrel the interpolation derives from,
and fail the docs build on a mismatch or on the phrase disappearing. The function
count needs no equivalent check -- "over 400" stays true as functions are added.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
474c21a to
3b4fda3
Compare
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
hyperformula-docs | ea8e6a4 | Commit Preview URL Branch Preview URL |
Sep 02 2026, 02:16 PM |
|
Task linked: HF-249 HF function documentation available via API |
Use getAvailableFunctions() instead of getRegisteredFunctionNames() to derive the function count in config.js for consistency with the docs generation script (generate-builtin-functions-doc.ts). Both methods return the same count (423), but getAvailableFunctions is the recommended metadata API and ensures the count source stays aligned with the built-in functions page table generator. Co-authored-by: Kuba Sekowski <sequba@users.noreply.github.com>
Conflict: README.md features list. develop (#1751) rewrote every docs URL to include the /docs/ base; this branch changed two counts in the same lines ("~400" -> "over 400", 17 -> 18 built-in languages). Resolved by taking develop's URLs with this branch's counts. The 18 is required by the assertion in docs/.vuepress/config.js, which checks README.md against src/i18n/languages/index.ts; develop's 17 was stale (the Indonesian pack landed in #1674). Verified with a full `npm run docs:build`: exit 0, index/guide pages and the .md companions render 423 functions / 18 languages, and no unresolved `{{ $page.* }}` remains in the built HTML, .md or llms-full.txt. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QYPSYJTXUDSqycT2HtX3zV
Brings in #1733 (AVERAGEIF zero results). No conflict — it touches CHANGELOG.md and src/interpreter/plugin/ConditionalAggregationPlugin.ts, neither of which this branch changes. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QYPSYJTXUDSqycT2HtX3zV
… README check
Four review fixes to the count derivation, all in docs build config.
Language count no longer depends on how the i18n barrel is punctuated. It was
matched with /^export \{\s*default as \w+\}/gm, which tolerates whitespace after
the brace but not before it: `export { default as ukUA }` is the same export to
TypeScript, yet the regex missed it and the total silently stayed at 18 while 19
shipped. Nothing caught that -- the zero-check only trips at zero, and README
still agreed with the wrong number. No object-curly-spacing rule exists to keep
the spacing uniform either. Counted by listing src/i18n/languages instead, which
no formatting can change.
Because listing the directory counts what is present rather than what ships, the
opposite error becomes possible -- a module nobody re-exported would overstate
the total -- so the codes are cross-checked against the barrel by name (no brace
matching) and a missing export now fails the build with the codes named.
README assertion anchored on the features bullet that links to the i18n guide,
and fenced blocks skipped. `String.match` without /g returns the first hit
anywhere in the file, so a fenced example or a sentence about an older release
won the match and the error then reported a count from a line that was never the
claim, sending the reader to correct text that was already right.
The engine behind functionsCount is built once at config load rather than inside
extendPageData, which runs per page; the count is invariant. Its comment now
also records why the license key is named, pointing at the fuller note in
generate-builtin-functions-doc.ts.
Two comments in script/ described the total as coming from the global registry
"computed independently" of the generator. Since it moved to
getAvailableFunctions that is no longer what happens, and the thing worth
flagging is what remains true: the two engines are separate call sites whose
options have to stay in step.
Verified: `npm run docs:build` exits 0; index and guide pages, the .md
companions and llms-full.txt all render 423 functions / 18 languages, with the
generated table at 423 rows and no unresolved mustaches in the output. The new
counting logic was exercised against compact, spaced and multi-line barrels
(18 each), an unexported module and an empty directory (both throw). The two
README cases that previously mis-blamed a correct line now load, while a
genuinely stale bullet and a removed phrase both still fail.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QYPSYJTXUDSqycT2HtX3zV
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #1715 +/- ##
========================================
Coverage 97.32% 97.32%
========================================
Files 195 195
Lines 15739 15739
Branches 3390 3390
========================================
Hits 15318 15318
Misses 421 421 🚀 New features to boost your workflow:
|

What & why
The docs stated a hardcoded count of built-in functions ("~400"/"400+") and languages ("17"/"18") that drifts from reality. The function count already auto-derived via
{{ $page.functionsCount }}; this adds the parallel{{ $page.languagesCount }}and swaps the remaining hardcoded counts to the interpolated variables.How
docs/.vuepress/config.js: derivelanguagesCountonce at config load from the i18n export barrelsrc/i18n/languages/index.ts(whitespace-tolerant regex + fail-loud guard so a barrel reformat can never silently publish "0 languages"); inject$page.languagesCount.~400/400+→{{ $page.functionsCount }}(index, ai-sdk, mcp-server, langchain);17/18→{{ $page.languagesCount }}(index, built-in-functions, i18n-features, localizing-functions).README.md(not a VuePress page, so no interpolation possible): manualover 400+18, with the language count now asserted against the same i18n barrel at config load (3b4fda30f) so it fails the docs build instead of rotting silently.docs/.vuepress/plugins/md-companions/index.js: registerlanguagesCountwith the companion{{ $page.* }}resolver (3ef3fdddc). The resolver arrived with Agent-friendly documentation: .md companions, llms.txt, coding-agent guide (HF-154) #1703 and substitutes an allowlist of injected keys, so without this the built.mdcompanions andllms-full.txtshipped the raw mustache while the HTML rendered the number.Verification
docs:buildrenders the real counts (functions / languages), including inside markdown link text, with no un-rendered{{ }}in the built output. Docs-only + docs-build-config → no CHANGELOG per DEV_DOCS DoD.Known nuance
README.mdcounts stay hand-edited — it is rendered by GitHub and npm, neither of which runs VuePress, so{{ $page.* }}would publish literally. The language count is therefore guarded rather than interpolated: the docs build fails if README disagrees with the barrel, or if the<n> built-in languagesphrase disappears. Verified both failure modes. The function count needs no guard — "over 400" is chosen so the line does not restale as functions grow. Thelocalizing-functions.mdlanguage table rows remain hand-maintained.The guard couples the docs build to
README.md, which is a deliberate trade: the alternative was generating README as a build product, and it is a file people edit directly.ClickUp task: https://app.clickup.com/t/9015210959/HF-282
Update (28.08 rebase):
developreplaceddocs/guide/built-in-functions.mdwith a generated page (templatedocs/guide/built-in-functions.tmpl.md+ generator, HF-249/#1692). This PR's one-line change to that page now lives in the template — the generator copies prose verbatim, andnpm run docs:buildrenders{{ $page.languagesCount }}correctly in the generated output (verified: zero unrendered mustaches indist/). Commit SHAs in this description refer to the rebased branch.Note
Low Risk
Docs and VuePress build configuration only; no runtime library or API behavior changes.
Overview
Stops hardcoded function and language totals in docs and the root README from drifting when the catalogue or i18n packs change.
VuePress now derives
languagesCountat config load fromsrc/i18n/languages(with a barrel re-export check) and injects{{ $page.languagesCount }}alongside the existing function count. The function total is computed once viagetAvailableFunctions()on a default-config engine—the same approach asscript/generate-builtin-functions-doc.ts—instead ofgetRegisteredFunctionNames, so the headline number matches the generated built-in-functions table. Guide pages, index, and integration previews swap~400/400+and17/18for{{ $page.functionsCount }}and{{ $page.languagesCount }}; the md-companions allowlist resolveslanguagesCountin shipped.md/llms-full.txt.README.md (GitHub/npm, no VuePress) is updated manually to over 400 functions and 18 languages; the docs build fails if the i18n features bullet’s language number disagrees with the derived count.
Reviewed by Cursor Bugbot for commit ea8e6a4. Bugbot is set up for automated code reviews on this repo. Configure here.