Skip to content

docs(extensions): document custom file previews - #644

Merged
benvinegar merged 2 commits into
mainfrom
docs/extension-api-guide
Jul 30, 2026
Merged

docs(extensions): document custom file previews#644
benvinegar merged 2 commits into
mainfrom
docs/extension-api-guide

Conversation

@benvinegar

Copy link
Copy Markdown
Member

Summary

  • add a dedicated public guide for building custom file previews with hunk.registerFileView()
  • document exact-source reads, symbolic rows, hunk geometry, source bindings, inline notes, constrained JSX painters, command controls, validation, and raw-diff fallback
  • update the Extension API reference for API version 2 and ctx.fileViews
  • link file previews from the docs sidebar, Extensions guide, and docs homepage
  • cover the new documentation route in the browser smoke suite

Validation

  • bun run typecheck
  • bun run lint
  • cd website && bun run check
  • cd website && bun run build
  • website Playwright suite: 34 passed across desktop and mobile Chromium
  • bun test scripts/generate-docs.test.ts scripts/check-pack.ts
  • formatting and git diff --check

This PR description was generated by Pi using OpenAI GPT-5.2

@vercel

vercel Bot commented Jul 30, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
hunk-web Ready Ready Preview Jul 30, 2026 1:34am

Request Review

The examples are not bundled or loaded by default. Run one directly while developing:

```bash
bun run src/main.tsx -- diff --extension ./examples/extensions/rendered-markdown before.md after.md

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Example inputs are absent

The copyable launch command references before.md and after.md, but those files are not included or identified as user-provided placeholders, so running it from a repository checkout ends with a missing-file error instead of launching the example.

Knowledge Base Used: Extension System: API, Loading, and Host Integration

Prompt To Fix With AI
This is a comment left during a code review.
Path: website/src/content/docs/docs/extend/file-previews.md
Line: 199

Comment:
**Example inputs are absent**

The copyable launch command references `before.md` and `after.md`, but those files are not included or identified as user-provided placeholders, so running it from a repository checkout ends with a missing-file error instead of launching the example.

**Knowledge Base Used:** [Extension System: API, Loading, and Host Integration](https://app.greptile.com/modem/-/custom-context/knowledge-base/modem-dev/hunk/-/docs/extension-system.md)

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

@greptile-apps

greptile-apps Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds public documentation for extension API v2 custom file previews.

  • Documents registration, layout geometry, source bindings, inline-note fallback, JSX painters, command controls, and validation limits.
  • Adds navigation links from the sidebar, extension guide, API reference, and documentation homepage.
  • Adds the new documentation route to the browser smoke suite.

Confidence Score: 4/5

The PR appears safe to merge, with one non-blocking documentation issue in the example launch command.

The documented feature contract aligns with the implementation, but the copyable quick-start command references input files that are neither included nor identified as placeholders.

Files Needing Attention: website/src/content/docs/docs/extend/file-previews.md

Important Files Changed

Filename Overview
website/src/content/docs/docs/extend/file-previews.md Adds the comprehensive file-preview guide; the try-it command depends on unexplained, absent input files.
website/src/content/docs/docs/extend/extension-api.md Updates the documented API version and adds file-view registration and command-control references consistent with the public contract.
website/astro.config.mjs Adds the new guide to the Extensions sidebar.
website/tests/docs-smoke.spec.ts Adds the new documentation route to the existing route smoke test.
Prompt To Fix All With AI
### Issue 1
website/src/content/docs/docs/extend/file-previews.md:199
**Example inputs are absent**

The copyable launch command references `before.md` and `after.md`, but those files are not included or identified as user-provided placeholders, so running it from a repository checkout ends with a missing-file error instead of launching the example.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Reviews (1): Last reviewed commit: "docs(extensions): document custom file p..." | Re-trigger Greptile

@benvinegar
benvinegar enabled auto-merge (squash) July 30, 2026 01:40
@benvinegar
benvinegar merged commit 3fac32d into main Jul 30, 2026
12 checks passed
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.

1 participant