Skip to content

chore(ai): format the files Claude Code edits with oxfmt - #12887

Merged
slorber merged 1 commit into
claude/harness-shared-settingsfrom
claude/harness-format-hook
Nov 6, 2026
Merged

slorber merged 1 commit into
claude/harness-shared-settingsfrom
claude/harness-format-hook

Conversation

@slorber

@slorber slorber commented Nov 6, 2026 •

Copy link
Copy Markdown
Collaborator

Motivation

Agents format files only at commit time (lint-staged), or not at all when they don't commit, so formatting churn ends up in diffs and Lint AutoFix commits.

This adds a PostToolUse hook (admin/scripts/claude/formatEditedFile.js) that runs oxfmt on each file Claude Code edits or writes:

  • It skips files outside the project. oxfmt itself skips the files it doesn't support or ignores, so it formats exactly what pnpm format would.
  • Its output and errors are ignored: it never makes the edit fail.
  • No eslint --fix: too slow for every edit, and lint-staged still runs it at commit time.

Test Plan

Piped sample hook payloads into the script:

  • An unformatted .ts file is reformatted in about 50-90ms.
  • A file outside the project is left alone.
  • LICENSE, the ignored website/versions.json, a missing file and an empty or missing file_path are skipped with exit 0.

Caveat: in a worktree without node_modules (before pnpm install), the hook can't find oxfmt and shows a non-blocking hook error on each edit.

Test links

Deploy preview: https://deploy-preview-12887--docusaurus-2.netlify.app/

🤖 Generated with Claude Code

@slorber
slorber requested a review from Josh-Cena as a code owner November 6, 2026 14:40
@slorber slorber added the pr: ignore This PR is not meaningful enough to appear in the changelog. label Nov 6, 2026
@coderabbitai

coderabbitai Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 6 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 10 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: f487e3fa-c45c-44aa-a5a1-713ec67b9a37
Commits

Reviewing files that changed from the base of the PR and between 1292142 and 66a6599.

Files selected for processing: 2

  • .claude/settings.json
  • admin/scripts/claude/formatEditedFile.js
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

@meta-cla meta-cla Bot added the CLA Signed Signed Facebook CLA label Nov 6, 2026
@slorber
slorber added this pull request to stack #12890 November 6, 2026 14:41
@netlify

netlify Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

✅ [V2]

Name Link
🔨 Latest commit 66a6599
🔍 Latest deploy log https://app.netlify.com/projects/docusaurus-2/deploys/6aee0e73ec1092b698d76e69
😎 Deploy Preview https://deploy-preview-12887--docusaurus-2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions

github-actions Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

⚡️ Lighthouse report for the deploy preview of this PR

URL Performance Accessibility Best Practices SEO Report
/ 🟠 57 🟢 98 🟢 100 🟢 100 Report
/docs/installation 🟠 58 🟢 97 🟢 100 🟢 100 Report
/docs/category/getting-started 🟠 70 🟢 100 🟢 100 🟠 86 Report
/blog 🟠 69 🟢 96 🟢 100 🟠 86 Report
/blog/preparing-your-site-for-docusaurus-v3 🟠 65 🟢 92 🟢 100 🟢 100 Report
/blog/tags/release 🟠 68 🟢 96 🟢 100 🟠 86 Report
/blog/tags 🟠 68 🟢 100 🟢 100 🟠 86 Report

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@slorber
slorber force-pushed the claude/harness-format-hook branch from 2171935 to 66a6599 Compare November 6, 2026 17:29
@slorber slorber changed the title chore(ai): format the files Claude Code edits with oxfmt (AI-assisted) chore(ai): format the files Claude Code edits with oxfmt Nov 6, 2026
@slorber
slorber merged commit bd5a733 into main Nov 6, 2026
18 of 27 checks passed
@slorber
slorber deleted the claude/harness-format-hook branch November 6, 2026 17:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed Signed Facebook CLA pr: ignore This PR is not meaningful enough to appear in the changelog.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant