Repository navigation
build(dprint): format Markdown with dprint instead of prettierd - #438
Conversation
prettierd starts a never-exiting daemon per cwd and leaves orphans. dprint-plugin-markdown now supports listIndentKind (#176), so use it with pythonMarkdown for four-space nested lists. - add the markdown plugin and md includes to dprint.json and lefthook - use dprint for markdown in conform.nvim - remove prettierd, ~/.prettierrc and prettier/ - migrate tests/esa/format.bats to dprint - reformat tracked Markdown (list continuation indent 2 -> 4) - update agent-config to pick up the dprint-based hook Closes #435 Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
|
@codex review |
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
| formatters_by_ft = { | ||
| -- Text files: CJK spacing then structure formatting | ||
| markdown = { "autocorrect", "prettierd" }, | ||
| markdown = { "autocorrect", "dprint" }, |
There was a problem hiding this comment.
P2: The removed prettierd override was there so that files outside ~ still got the global config. esa edit creates its buffers under tempfile.mkdtemp() ($TMPDIR/esa-edit.*/post.md, see zsh/esa.py:101). conform runs dprint fmt --stdin $FILENAME with cwd set to the nearest dprint.json. For a file in $TMPDIR no dprint.json is found. Even if dprint falls back to ~/dprint.json, the absolute path /var/folders/.../post.md is outside that config's base, so the **/*.{json,toml,md} includes probably won't match. dprint then returns the input unchanged, or errors. I didn't run this, so please confirm it. If it holds, esa articles would quietly stop being formatted.
The new bats test passes the relative name article.md with an explicit --config, so it doesn't cover this path. Possible fixes: pass --config ~/dprint.json through a formatters.dprint override, or add a test that formats a file under $BATS_TEST_TMPDIR using the nvim/conform path.
|
Review summary I found nothing blocking (no P0 or P1). The dprint config, the lefthook glob, the Nix cleanup, and the Markdown reformat all look consistent. The reformat only changes continuation-line indentation, so the rendered output stays the same.
Also, I couldn't check that |
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
|
@codex review |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
| if has_project_config then | ||
| return { "fmt", "--stdin", "$FILENAME" } | ||
| end | ||
| return { "fmt", "--config", vim.fn.expand("~/dprint.json"), "--stdin", "$FILENAME" } |
There was a problem hiding this comment.
P2: The $TMPDIR fallback may silently leave the file unformatted. Conform passes $FILENAME as an absolute path. For example, the esa editor uses tempfile.mkdtemp(prefix="esa-edit.")/post.md (zsh/esa.py:101), which on macOS is under /var/folders/.... I believe that when dprint fmt --stdin gets a full path, it checks it against the config's includes/excludes. Those patterns (**/*.{json,toml,md}) are resolved relative to the config's directory (~). If so, a file outside ~ does not match, and dprint returns the input unchanged with exit 0. esa posts would then get no structure formatting, which prettierd did provide before. I could not run dprint here to confirm this.
The new bats test calls --stdin article.md with a bare filename, which skips that check, so it does not exercise this path. Two possible fixes: pass only the basename (e.g. vim.fn.fnamemodify(ctx.filename, ":t")) in the fallback branch, or add a test that formats an absolute path outside $REPO_ROOT.
|
Review summary I found no P0 or P1 issues. The dprint config, lefthook glob, CI coverage of Markdown, prettierd removal and Markdown reformatting look consistent.
Blocking findings: 0 |
… directory Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
|
Re P2 (nvim |
|
@codex review |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Review summary (read-only): no findings. Checked: dprint markdown plugin config (hash-pinned, Blocking findings (P0/P1): 0 🤖 Generated with Claude Code |
## 概要 CI の `bats-tests` ジョブが bats ファイルを 3 件だけ列挙していたため,残りが CI で走っていなかった.探索ベースに変更し,新しい bats ファイルが黙って漏れないようにする. ## 設計 - CI(ubuntu): `bats --recursive --filter-tags '!macos' tests` - Mac(ローカル): 従来どおり `bats --recursive tests` で全件 - macOS 専用テストは別ファイルに分け,先頭に `# macOS only: <理由>` と `# bats file_tags=macos`(bats 1.12 のファイルタグ)を置く.混在ファイルは `<name>_macos.bats` に分割する(`tests/zsh/startup.bats` の 1 件を `startup_macos.bats` へ) - 印の付け忘れは Linux CI で落ちるため,macOS 専用かどうかの判断が強制される - テストごとの `require_macos` ヘルパーは採用しない(印が散らばるため) - macOS ランナーの追加はこの PR の範囲外(必要になったら別 Issue で実測してから判断する) ## 変更 - `.github/workflows/ci.yml`: `bats-tests` を探索実行 + `--filter-tags '!macos'` に変更 - macOS 専用ファイルにタグと理由を追加.`tests/zsh/startup.bats` から macOS 専用の 1 件を `startup_macos.bats` に分割.`tests/zsh/ssh_agent.bats` は `.zshrc` が `OSTYPE=darwin` でのみ動くため,全件が Linux では空振りになるのでファイル全体を macos タグにした - `tests/ssh-agent/load_identity.bats`: BSD 専用の `stat -f` を `find -perm 0700` に置き換え,Linux でも実行 - `tests/esa/nvim.bats`: リポジトリの `nvim` を `runtimepath` に追加(`~/.config/nvim` が無い環境でも動く).dev shell に `neovim` を追加 - README: `macos` タグの意味と CI での除外を追記 #438 はマージ済みで,`tests/esa/format.bats` は dprint で Linux 上で実行される. ## 分類(19 ファイル + 分割 1 件) | ファイル | 分類 | 根拠 | |---|---|---| | tests/codex/update_codex.bats | linux | モックのみ | | tests/esa/format.bats | linux | dprint(dev shell 提供) | | tests/esa/nvim.bats | linux | headless nvim と esa モック | | tests/esa/zsh.bats | linux | モックのみ | | tests/herdr/herdr_command.bats | macos | aarch64-darwin の Home Manager をビルド | | tests/hister/server_launcher.bats | linux | モックのみ | | tests/moshi/lifecycle.bats | linux | モックのみ | | tests/moshi/update_moshi_hook.bats | linux | モックのみ | | tests/nix/agent_hook.bats | macos | darwin の activationPackage をビルド | | tests/nix/codex_notification.bats | macos | darwin 向け codex パッケージをビルド | | tests/nix/configuration.bats | macos | `checks.aarch64-darwin` をビルド | | tests/nvim/lspmux.bats | linux | headless nvim | | tests/ssh-agent/load_identity.bats | linux | `find -perm` に置き換えて Linux 対応 | | tests/ssh-agent/sign_ssh.bats | linux | モックのみ | | tests/terminal-browser/terminal_browser.bats | macos | darwin-arm64 バイナリを実行 | | tests/zsh/cache.bats | linux | モックのみ | | tests/zsh/repository_search.bats | linux | モックのみ | | tests/zsh/ssh_agent.bats | macos | `OSTYPE=darwin` 限定のロジックで,Linux では全件が空振りになる | | tests/zsh/startup.bats | linux | 10 件 | | tests/zsh/startup_macos.bats(新規) | macos | darwin の Home Manager をビルド 1 件 | ローカル(`bats --count`): 全 90 件,`--filter-tags '!macos'` で 72 件,macOS 専用 18 件. Closes #440 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: furedea <[email protected]> Co-authored-by: Claude Sonnet 5.5 <[email protected]>
Closes #435
概要
Markdown の formatter を
prettierdからdprint(listIndentKind: pythonMarkdown,textWrap: maintain)へ戻し,prettierdを削除する.変更
dprint/dprint.jsonに markdown プラグイン(hash 固定)とmdの includes を追加.lefthook の glob もmdを含めるautocorrect→dprintに変更し,prettierdの override を削除prettierd,prettier/.prettierrc,~/.prettierrcリンクと関連 TODO を削除tests/esa/format.batsをdprint fmt --stdinに移行し,散文の改行保持とネストリスト 4 スペースを検証agent-configinput を 68dfcf6 に更新(hook が dprint を使う版)確認
bats tests,autocorrect --lint,stylua --check,nixfmt --check,nix flake checkが通過ユーザー作業
darwin-rebuild switch後,Markdown を hook と nvim で整形し,pgrep prettierdが空であることを確認する.レビュー指摘への対応
~外の絶対パスで~/dprint.jsonが効かない懸念)は,dprint 0.64.3 での実測により否定された.dprint fmt --config <dir>/dprint.json --stdin /other/abs/post.mdは rc=0 で整形され(ネストリストは 4 スペース),相対名と同じ結果になる.tests/esa/format.batsに回帰テストを追加した(8fb462d).なおeb75105の--configフォールバックは,プロジェクト設定が無いバッファ向けの保険として残す.🤖 Generated with Claude Code