Agent-friendly documentation: .md companions, llms.txt, coding-agent guide (HF-154)#1703
Agent-friendly documentation: .md companions, llms.txt, coding-agent guide (HF-154)#1703marcin-kordas-hoc wants to merge 23 commits into
Conversation
…cking Used by the prep-flip T2.5 tier to extract the HyperFormula public API surface at a given git ref and compare between develop and PR HEAD to detect breaking API changes (constructor arg additions, removed exports, lint-scope drift).
…int config Add scripts/*.js override to .eslintrc.js enabling node env and disabling TypeScript-specific rules that do not apply to CJS scripts. Auto-fix semicolons (project enforces no-semicolons style), rename lint_scope variable to lintScope (naming-convention), and add missing JSDoc param/returns descriptions.
Five-component design: VuePress md-companions plugin, Copy Markdown button, static setup-coding-agent page, interactive wizard, and llms.txt/robots.txt updates. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Address 5 findings grounded in VuePress core verification: - respect base '/docs/' and DOCS_DEST in all 5 components - compute Copy Markdown URL from $page.path, not window.location - forbid invented install commands; trace to published skill - token-aware container stripping with code-fence fixture test - flag robots.txt root-vs-/docs/ placement for confirmation Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Six tasks: md-companions plugin (C1), Copy Markdown button (C2), setup-coding-agent page (C3), interactive wizard (C4), llms.txt/robots (C5), and config.js integration. Install commands traced to the published handsontable/handsontable-skills repo; code-fence stripping fixture test included. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Install commands traced to handsontable/handsontable-skills; no invented commands. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…mpanions Strip.js regex was limited to tip|warning|danger|details. The ::: example container (live code runner) leaked into companion .md files. Broadened match to \w+ and strip example containers entirely (they are demo markup, not prose). Added 8th assertion to the test fixture. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…p page - require md-companions plugin, register with DOCS_HOSTNAME - globalUIComponents: ['CopyMarkdownButton'] - add 'Set up your coding agent' to Getting started sidebar Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
strip.js: - track full fence marker length (CommonMark); inner ``` no longer closes ```` - bail out verbatim on unclosed ::: container (no silent page truncation) - 9th test assertion for nested fence lengths index.js: - wrap per-page work in try/catch; one bad page warns and continues - substitute real base/hostname in corpus header (was literal <base>) CopyMarkdownButton.vue + CodingAgentWizard.vue: - clipboard fallback via document.execCommand for non-HTTPS contexts - isSecureContext guard + .catch() on Clipboard API promise - null-guard on this.current in wizard copy() setup-coding-agent.md: - relative links to llms-full.txt (../llms-full.txt) to survive any base-path edge cases in static-file link resolution Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The md-companions markdown stripper is the acceptance gate for the agent-friendly docs (per-page .md companions + llms.txt), but its test lived at docs/.vuepress/plugins/md-companions/strip.test.js — a path and suffix Jest's testMatch (`test/**/*spec.(ts|js)`) never discovers, so it never ran in CI. - Move the assertions into test/docs/md-companions-strip.spec.js as a Jest spec, where the default glob picks them up. The file is `.js`, so Karma's `.spec.ts`-only require.context skips it (the stripper is plain Node code, not part of the browser bundle). - Add an ESLint override for `**/test/**/*.spec.js` mirroring the existing `scripts/*.js` relaxations (node env, allow require of untyped modules). - Remove the orphan strip.test.js. - CHANGELOG: note the agent-friendly docs under [Unreleased] > Added. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
These are internal implementation planning docs, not user-facing documentation. VuePress builds every file under docs/ into the public site (and the md-companions plugin would emit .md + llms.txt for them), so they must not live in the public repo. They belong in the internal dev-skills workspace instead.
…rve-out scripts/extract-public-api.js was an internal helper for the prep-flip review harness (per its own header), has no consumer anywhere in this repo, and is out of scope for an agent-friendly-docs PR. Removing it also resolves the two outstanding review threads it was the sole source of: the CodeQL 'indirect uncontrolled command line' alert (execSync git show) and Cursor's regex finding in extractHyperFormulaExports. The scripts/*.js ESLint override existed only to lint this file, so it is removed too; the **/test/**/*.spec.js override stays (needed by the md-companions strip spec). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Task linked: HF-154 Agent-friendly docs |
✅ Deploy Preview for hyperformula-dev-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
e79f1a8 to
ddfa8f0
Compare
| async generated() { | ||
| const hostname = (options && options.hostname) || 'https://hyperformula.handsontable.com'; | ||
| const base = ctx.base || '/'; | ||
| const pages = ctx.pages.filter(p => /\.html$/.test(p.path) && p.path !== '/404.html'); |
There was a problem hiding this comment.
Homepage omitted from companions
Medium Severity
The md-companions build only processes pages whose path ends with .html, but VuePress gives docs/index.md the path /. That landing page is skipped, so no root index.md companion is emitted and it is missing from llms-full.txt. CopyMarkdownButton uses the same .html check, so the button never appears on the docs home page.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit ddfa8f0. Configure here.
Performance comparison of head (c0f1ac6) vs base (4e302ff) |
The docs build (`npm run docs:build`) is validated in CI on Node 22 (the build-docs workflow), but Netlify built the deploy preview on Node 18, where the build errored. Aligning the deploy runtime with the validated CI runtime. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ents - CopyMarkdownButton copies the page's .md URL (per its tooltip), so the label now reads 'Copy Markdown link' instead of 'Copy Markdown', which implied it copied the markdown content. Guide reference updated to match. - Removed the two 'AI/LLM agent index' comment lines from robots.txt: crawlers ignore comments, so they provided no machine-discoverability. llms.txt is discoverable at its well-known path; the Sitemap directive stays. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Verified the deploy-preview build output: llms-full.txt is populated (1.3 MB, page content present) and guide pages strip cleanly, but the typedoc API pages leaked ~638 inline `<Badge text="Class"/>` tags — the stripper only dropped component tags that occupied a whole line, not inline ones after heading text. Now strips inline self-closing capitalized components too; the [A-Z] guard leaves plain HTML (<br/>) alone and code fences are still preserved. +3 spec assertions (12 total). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
| mdUrl() { | ||
| const p = this.$page && this.$page.path; | ||
| if (!p || !/\.html$/.test(p)) return null; | ||
| return this.$withBase(p.replace(/\.html$/, '.md')); |
There was a problem hiding this comment.
404 page copies missing markdown
Low Severity
The global Copy Markdown link button appears on any path ending in .html, including /404.html, but the md-companions build step deliberately skips that page. Visitors on the 404 page can copy an absolute .md URL that was never published.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit f0b5b28. Configure here.
…ent tags - Extract the shared Clipboard-API-with-textarea-fallback logic from CopyMarkdownButton.vue and CodingAgentWizard.vue into a single components/clipboard.js (copyToClipboard); both now import it. - strip.js: also drop a whole-line closing tag of a paired block component (</Foo>); the opening tag and inner content were already handled, only the stray closing tag leaked. +1 spec assertion (13). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
There are 3 total unresolved issues (including 2 from previous reviews).
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit c0f1ac6. Configure here.
|
|
||
| for (const page of pages) { | ||
| try { | ||
| const clean = stripVuePressSyntax(page._strippedContent || ''); |
There was a problem hiding this comment.
Unresolved page template placeholders
Medium Severity
The md-companions build writes companions from page._strippedContent, which is raw markdown. VuePress-only tokens like {{ $page.version }} and {{ $page.functionsCount }} are not expanded, so .md companions and llms-full.txt can ship literal placeholders while the HTML site shows real values.
Reviewed by Cursor Bugbot for commit c0f1ac6. Configure here.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #1703 +/- ##
========================================
Coverage 97.14% 97.14%
========================================
Files 176 176
Lines 15333 15333
Branches 3390 3390
========================================
Hits 14895 14895
Misses 438 438 🚀 New features to boost your workflow:
|


Context
HF-154 — make the HyperFormula docs friendlier to coding agents and LLMs. On top of the existing VuePress portal this adds:
.mdcompanions — every doc page is also served as clean, VuePress-stripped markdown (a build-timemd-companionsVuePress plugin), plus an aggregatellms-full.txt.llms.txt— a top-level index pointing agents at the markdown sources.CopyMarkdownButton.vue) — copies the page's.mdURL for pasting into an agent.docs/guide/setup-coding-agent.md) plus aCodingAgentWizard.vuehelper.context7.jsonso agent doc-access tooling (Context7 / GitMCP) can discover the sources.The markdown stripper (
md-companions/strip.js) is the fidelity-critical piece: it turns VuePress-flavoured markdown (:::containers,<script>/Vue components,[[toc]], live:::exampledemos, nested code fences) into clean markdown for the.mdcompanions andllms.txt.How did you test your changes?
test/docs/md-companions-strip.spec.js— a.jsJest spec discovered by the defaulttest/**/*spec.(ts|js)glob (12 assertions, all passing). Being a.jsfile it is skipped by Karma (which only globs.spec.ts); the stripper is plain Node code, not part of the browser bundle.**/test/**/*.spec.js(node env,requireof untyped modules) so the new spec lints clean.npm run lintreports no new errors.Types of changes
Related issues:
Checklist:
Notes
hyperformula-testsrepo (lint/test/performancefailed with aget-a-repository404). This branch lives on the upstream repo so CI runs with test-repo access.scripts/extract-public-api.js(an internal review-harness helper with no consumer in this repo) and itsscripts/*.jsESLint carve-out. This also resolves the two review threads on Agent-friendly documentation: .md companions, llms.txt, coding-agent guide (HF-154) #1696 that targeted that file (the CodeQL "indirect uncontrolled command line" alert and Cursor'sextractHyperFormulaExportsregex finding).develop.Note on the Astro migration
The docs-portal Astro migration (#1686) is a separate track. If it lands first it would supersede this VuePress plumbing (the
md-companionsplugin and.vuecomponents are VuePress-specific); the agent-friendly outputs (.mdcompanions,llms.txt, coding-agent guide) would need re-homing in Astro. Flagging so the two tracks can be sequenced.Note
Low Risk
Changes are limited to documentation build, static assets, and test/lint config; the spreadsheet engine and runtime API are untouched.
Overview
Adds LLM- and coding-agent-friendly documentation on top of the existing VuePress site: a build-time
md-companionsplugin writes per-page.mdcompanions andllms-full.txt, usingstripVuePressSyntaxto remove VuePress-only syntax (containers, Vue components, live demos, etc.).Site UX: global Copy Markdown link button (absolute
.mdURL), staticllms.txtindex, new Set up your coding agent guide withCodingAgentWizard, andcontext7.jsonfor Context7 indexing. Sidebar and changelog are updated accordingly.Tooling: Jest coverage for the stripper in
test/docs/md-companions-strip.spec.js, an ESLint override for**/test/**/*.spec.js, and Netlify docs builds bumped to Node 22.Reviewed by Cursor Bugbot for commit c0f1ac6. Bugbot is set up for automated code reviews on this repo. Configure here.