Skip to content

feat(skills): add an Agent Skill for compiling TeX with texrun - #64

Merged
nishide-dev merged 3 commits into
mainfrom
feat/agent-skills
Oct 6, 2026
Merged

nishide-dev merged 3 commits into
mainfrom
feat/agent-skills

Conversation

@nishide-dev

@nishide-dev nishide-dev commented Oct 6, 2026 •

Copy link
Copy Markdown
Owner

概要

AI エージェントが texrun を正しく使えるよう、Agent Skill を skills/texrun/ に追加し、Claude Code の plugin marketplace としてインストールできるようにします。skill の記述が CLI の実装とずれないよう、cargo test で照合するテストも追加します。

変更内容

  • skills/texrun/(Agent Skill。英語)
    • SKILL.md: frontmatter は name: texrun、description は「LaTeX/TeX を compile・build・typeset する / LaTeX・BibTeX のエラーや警告を直す / ページの見た目を確認する」場面で発火するよう具体的に記述(三人称、1024 文字以内)。本文は約 150 行で、次を扱います。
      • 前提確認: texrun --version。無ければ setup.md の導入手順を利用者に伝えて止まる
      • backend の選び方: 信頼できない文書は --backend container
      • compile → 修正のループ(チェックリスト付き): error → outcome の順に確認し、project.root + file の line を直して再 compile。TeX は最初のエラーで止まるので 1 回の実行で直すのは 1 件、emergency_stop は無視、修正が進まなければ 5 回程度で打ち切り、エラーを握りつぶすような修正はしない
      • preview の確認: output_dir + preview.pages[].path の画像を見る、--pages / --preview-dpi、古い出力が残る点
      • exit code の表、よく使う option の表、プロジェクト構成の制約(親ディレクトリ、shell escape、パッケージは自動で入らない)
    • reference/json.md: エージェント向けに要約した JSON フィールドの表と実例。reference/errors.md: diagnostic / error / note / preview notice の各 kind の意味と直し方。reference/setup.md: 導入手順。どれも SKILL.md から必要なときだけ読む形です(progressive disclosure)
    • scripts/texrun_summary.py(Python 3 標準ライブラリのみ): JSON を 絶対パス:line: kind: message、PDF のパス、preview 画像のパスの一覧にまとめる。failed なのに error diagnostic が無いときは log を読むよう促す
  • .claude-plugin/marketplace.json と .claude-plugin/plugin.json: リポジトリ自体を marketplace texrun とし、plugin texrun(source: "./")を 1 つ持たせる。version は指定しないため、commit SHA が version になり、commit ごとに更新を受け取れます
  • apps/texrun/src/skill_docs.rs: skill と実装の整合性を確かめる unit test(後述)
  • docs/agent-skills.md: インストール方法、対応範囲、整合性チェックの仕組み。README に「Using texrun from AI agents」節を追加。CONTRIBUTING に scope skills と、CLI を変えるときは skill も更新する旨を追記

インストール方法と対応範囲

利用先 対応 方法
Claude Code(plugin) ○(推奨) /plugin marketplace add nishide-dev/texrun@v<version>(使っている texrun と同じ tag、v0.1.1 以降)→ /plugin install texrun@texrun(shell では claude plugin ...)。main から texrun を入れた場合は tag なし
Claude Code(skills ディレクトリ) ○ skills/texrun を ~/.claude/skills/ または .claude/skills/ にコピー
Claude Agent SDK ○ plugins=[{"type": "local", "path": ...}] で読み込む
Agent Skills 形式に対応した他のエージェント ○(shell と texrun があれば) skills/texrun/ を読み込ませる
Claude.ai / Claude API ×(手順のみ記載) skill は Anthropic の code execution 環境で動き、texrun と TeX Live が入っていない(API では network も package の導入も不可)ので compile できない。zip アップロード / POST /v1/skills の手順は公式ドキュメントで確認できた範囲だけ記載

整合性チェック(cargo test の skill_docs)

skill のファイルを読み、次のどれかが成り立たないと失敗します。

  • texrun ... のコマンド例を clap(Cli::try_parse_from)がそのまま受け付ける。値付きの option 例(--pages 5-8 など)も同様。code 中の --option はすべて texrun compile の option(cargo と script の option は許可リストで除外)
  • code span 内の 1 語の snake_case(output_dir、texrun_exit_code、kind、succeeded など)が、JSON の leaf・kind・enum や option の値・テスト内の小さな許可リスト(latexmk など)のいずれかに含まれる
  • 記述中の JSON フィールドパス(preview.pages[].path など)、reference/json.md の表と JSON 例、script が .get("...") で読むフィールドが、全フィールドを埋めた CompileReport を serialize した JSON に存在する
  • reference/errors.md の kind の表が、DiagnosticKind / EngineErrorKind / WorkspaceErrorKind と CLI 独自の kind / note kind / NoticeKind と完全に一致する(enum の variant と report::kind / 新設の report::note の定数はソースから抽出し、serde で妥当性も確認しているので、kind が追加されたときにも検出できます)
  • SKILL.md の exit code 表が report::exit の値と一致し、outcome それぞれへの対応が書かれている
  • frontmatter が Agent Skills の規則を守る(name は 64 文字以内の小文字・数字・ハイフンで予約語を含まない、description は 1024 文字以内で XML タグを含まない、本文は 500 行未満)。manifest の plugin 名が一致している。相対リンクが解決できる

skill をわざと壊して(存在しない option、存在しないフィールド、texrun_exit_code → texrun_exitcode、output_dir → out_dir、kind の行の削除、pub mod kind への定数追加、exit code の誤り)各テストが失敗することを確かめてから戻しました。

確認方法

  • cargo check --workspace --all-targets --all-features --locked
  • cargo fmt --all -- --check
  • cargo clippy --workspace --all-targets --all-features --locked -- -D warnings
  • cargo test --workspace --all-features --locked
  • claude plugin validate . は通過(version 未指定の warning だけ。commit ごとに更新を受け取るため意図して指定していません)
  • workflow は変更していないため actionlint は不要

skill の手順どおりに動くかの検証(macOS、host に latexmk が無いので --backend container)

  1. 手作業: \foo(未定義)と \begin{itemize} … \end{enumerate} を含む文書を texrun compile --json --backend container main.tex | python3 skills/texrun/scripts/texrun_summary.py で compile すると、.../main.tex:5: undefined_control_sequence: ... と raw excerpt が出て、ファイルと行をそのまま特定できました。修正して再 compile すると succeeded になり、output_dir + preview.pages[].path の PNG を確認できました。
  2. エージェントによる検証: claude -p --plugin-dir <worktree> で、上の文書(幅の広い表を追加したもの)を「知らない人から届いた文書なので compile できるように直してページも確認して」と依頼しました。Claude は skill texrun:texrun を起動し、自分から --backend container を選んで、summary script → \foo の修正 → itemize の修正 → 表の \resizebox → 再 compile → preview 画像の確認まで、skill の手順どおりに完了しました。
  3. インストールの確認: 利用者の設定を変えないよう CLAUDE_CODE_PLUGIN_CACHE_DIR を一時ディレクトリにし、--scope local を使いました。そのうえで claude plugin marketplace add(ローカルパスと nishide-dev/texrun@feat/agent-skills の両方)→ claude plugin install texrun@texrun が成功しました。claude plugin details には Skills (1) texrun(常時 約 175 tokens、起動時 約 2.4k tokens)と表示され、claude plugin list では Version が commit SHA になっています。

レビュー対応(1f6fa68)

  • S1: 1 語の名前の検査を追加(上記)
  • S2: README・docs/agent-skills.md・setup.md で、texrun と同じ tag に marketplace を固定する方法を推奨。SKILL.md に「食い違ったら texrun compile --help と実際の JSON が正」と追記。docs/development.md のリリース手順に skill(setup.md の版、tag の commit で skill_docs が通ること)を追加
  • nit: ${CLAUDE_SKILL_DIR} を使用(claude -p --plugin-dir で絶対パスに置換されることを確認)、summary script の堅牢化(null や dict 以外の要素、非 UTF-8 入力、ASCII の stdout、未知の severity)、CLI kind と note kind のソースからの自動抽出(note kind を report::note の定数に)、root plugin の制約の文書化、unsafe_root / broad_project_root の説明、推測を含む修正の報告を SKILL.md に追記、Agent SDK の記載

関連 Issue

Closes #63

補足

検証中に、この PR の範囲外の問題を 2 つ見つけました(別 Issue にするのがよさそうです)。

  • engine image 0.1.0 では itemize を含むだけの文書が compile できない: \begin{itemize}\item one\end{itemize} だけの文書で !pdfTeX error: pdflatex (file tcrm1000): Font tcrm1000 at 600 not found になります(\textbullet に使う TS1 フォント tcrm1000 が image に無く、bitmap の生成もできないため)。cm-super などのフォントを image に入れる必要がありそうです。
  • 上記の !pdfTeX error: が diagnostic にならない: outcome: failed なのに error diagnostic が 1 件も出ません(emergency_stop すら出ない)。log parser が !pdfTeX error: 形式を拾えていないようです。skill 側では「error diagnostic が無い failed は log を読む」手順を入れ、summary script もそう表示するようにしました。

🤖 Generated with Claude Code

nishide-dev and others added 2 commits October 7, 2026 06:56
Add skills/texrun (SKILL.md, reference files and a summary script) and
a Claude Code plugin marketplace in .claude-plugin/, with unit tests that
check the skill against the CLI options, the JSON fields and the kinds.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Add docs/agent-skills.md (Claude Code plugin and skills directory
installs, other agents, why Claude.ai and the Claude API are not
supported, and the consistency tests), a README section and
CONTRIBUTING notes. Tell the agent to read the log when a failed
compile has no recognized error.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@nishide-dev nishide-dev left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Verdict: CHANGES_REQUESTED

skill の内容、progressive disclosure、manifest はどれも公式の規約とベストプラクティスに沿っていて、実際に使っても skill の手順どおりに動きました。should-fix が 2 件あるので CHANGES_REQUESTED にしています。どちらも小さな変更で直せます。

確認したこと

  • ゲート(clone した PR ブランチ c58eff1 で実行): cargo check --workspace --all-targets --all-features --locked、cargo fmt --all -- --check、cargo clippy ... -D warnings、cargo test --workspace --all-features --locked はすべて通過しました(skill_docs の 6 件も含む)。CI もすべて green です。
  • claude plugin validate .(Claude Code 2.1.289)は Validation passed with warnings で、warning は version 未指定の 1 件だけでした。
  • 公式ドキュメント(Agent Skills overview / best practices、Claude Code の skills / plugin manifest / marketplace / plugin loading)と照らし合わせました。
    • frontmatter の制約(name は 64 文字以内で予約語を含まない、description は 1024 文字以内で XML タグを含まない)を満たしています。
    • description は三人称で、何をするか(what)といつ使うか(when)が具体的に書かれています。
    • 本文は 500 行未満、参照は SKILL.md から 1 段で、100 行を超える json.md には目次があります。
    • チェックリスト付きのフィードバックループがあり、script は「実行する」と明示されています。
    • marketplace の source: "./" と entry 名 = manifest 名もドキュメントの規則どおりです。
  • Claude.ai / API を「非対応」とした判断と docs の記述は、overview の Runtime environment constraints(API は network なし・package の導入なし、skill は Anthropic の code execution 環境で動く)や、claude.ai の Settings > Features と対象プランの記述と一致しています。

実際に使った結果(claude -p --plugin-dir <clone>、host に latexmk なし、OrbStack)

テスト文書は \foo{}(未定義)、\cite{knuth84}(bib のキーは knuth1984)、\ref{sec:method}(label なし)、\rule{1.3\textwidth}、ハイフネーションできない長い単語を含みます。

  1. 「メールで知らない人から送られてきた LaTeX 論文 main.tex がうまくコンパイルできないらしい。直して PDF を作って、ページの見た目も確認して。」
    • texrun:texrun が発火し、Claude が自分で --backend container を選びました。
    • summary script で main.tex:5: undefined_control_sequence を確認し、\foo、cite キー、\rule を直して再 compile すると succeeded になりました。
    • preview/page-001.png を開いて見た目を確認しました。
    • 残った undefined_reference(Method の節が無い)と overfull の長い単語は、勝手に直さず利用者に確認を求めました。
    • 12 turns、約 $0.37 でした。
  2. 「この論文の PDF を作って。」(LaTeX という語なし、itemize を追加)
    • skill が発火しました。
    • 最初は host で実行して error.kind: unavailable になり、手順どおり container で再試行しました。
    • \foo と cite キーを直した後、#65 の TS1 フォント不足で failed になりました。summary script は「errors: none recognized; read the log」と表示し、Claude は log を grep して !pdfTeX error: ... tcrm1000 を見つけました。
    • 文書を書き換えて回避しようとはせず、「環境側の問題」として報告しました。導入コマンドは提示しただけで、実行していません(setup.md の指示どおり)。
  3. 「LaTeX で分数と総和記号を書く方法を一行で教えて。」では skill は発火しませんでした。発火条件は過剰にも過少にもなっていないと思います。

should-fix

1. 整合性テストが 1 語のフィールド名(output_dir、texrun_exit_code など)を検査していない

is_field_path は . を含むパスしか対象にしません。このため、ループの中心で使う 1 語のフィールド(output_dir、texrun_exit_code、outcome、raw_excerpt、file、line、error など)は、名前が変わっても検出されません。

SKILL.md で次の 3 か所を書き換えても、cargo test -p texrun skill_docs は 6 件とも通りました。

  • texrun_exit_code → texrun_exitcode
  • project.root + / + file → + path
  • output_dir → out_dir

docs/agent-skills.md と PR 本文の「JSON field path ... が無いと失敗する」という説明は、実際よりも強く読めます。

修正案: backtick 内の ^[a-z][a-z0-9_]*$ に一致する語は、次の和集合のどれかに含まれることを要求してください。

  • field_paths(full_document()) の各 leaf
  • 各 kind の集合(すでに抽出済み)
  • CompileOutcome、severity、preview.status、artifacts[].kind、error.stage / category の値
  • 小さな許可リスト(texlive、mupdf など)

kind の名前は大半が _ を含むので、誤検出は少ないはずです。最低限、SKILL.md と json.md の本文だけでも対象にすると効果が大きいと思います。

2. plugin は main を、texrun 本体はリリースタグを追うため、両者がずれる

marketplace の plugin は version を指定していないので、main の commit を追います。一方、setup.md は cargo install ... --tag v0.1.0(最新のリリースタグ)を案内しています。今は main = v0.1.0 + CI の変更だけなので問題ありません。しかし main に CLI の変更(option や kind の追加・改名)が入ると、その時点から、リリース版の texrun を使う利用者に「まだ存在しない option」を教える skill が配られます。skill_docs のテストは同じ commit の CLI としか照合しないので、このずれは検出できません。docs の「keep texrun itself up to date too」も、タグから入れる限り満たせません。

修正案(どれか、または組み合わせ):

  • docs/agent-skills.md と README で、使っている texrun と同じタグの marketplace を追加する方法を推奨する。例: claude plugin marketplace add nishide-dev/[email protected](owner/repo@ref 形式は公式に対応しています)。main を追う方法は「main から texrun を入れた場合」として扱う。
  • SKILL.md の「Before you start」に一文足す。例: 「If texrun rejects an option or prints a field this skill does not mention, texrun compile --help and the JSON are authoritative; the installed texrun may be older or newer than this skill.」

nit

  1. script のパス: python3 scripts/texrun_summary.py は skill ディレクトリからの相対パスです。実際の run では、Claude が base directory から ../../texrun/skills/texrun/scripts/... や絶対パスを自分で組み立てていました。動きはしますが、Claude Code では ${CLAUDE_SKILL_DIR}/scripts/texrun_summary.py(公式の skills ドキュメントにある置換変数で、personal / project / plugin のどれでも解決されます)を使うほうが確実です。他のエージェントでも使えるよう、「(${CLAUDE_SKILL_DIR} is this skill's directory in Claude Code)」と併記する形がよいと思います。

  2. texrun_summary.py の堅牢性: 不正 JSON、ファイルが無い、ディレクトリを渡した場合はいずれも exit 2 で適切なメッセージが出ました。一方で次の場合は traceback(exit 1)になります。

    • "notes": null や、diagnostics の要素が dict でない JSON
    • 非 UTF-8 の stdin(PYTHONIOENCODING=ascii で日本語を含む JSON を渡すと UnicodeDecodeError)

    また、未知の severity を持つ diagnostic は --all でも表示されずに消えます。修正案: sys.stdin.buffer.read().decode("utf-8", "replace") で読み、sys.stdout.reconfigure(errors="backslashreplace") で書く。report.get(x) or [] と isinstance(d, dict) で守る。by_severity の未知のキーは info と一緒に表示する。

  3. kind の抽出の一部が手書き: CLI 独自の error kind(kind::USAGE など 8 件)と note kind 3 件は、テスト内に手書きされています。pub mod kind に定数を足したり、新しい note kind を足したりしても検出されません。report.rs の pub mod kind { ... } から pub const ...: &str = "..." を抽出すれば、enum と同じように自動で追従できます。note kind も定数にしておくと同じ仕組みで扱えます。docs の「list exactly the ... kinds of the implementation」は、そうしてから書くのが正確です。

  4. リポジトリ root を plugin にすることの影響: install 時には tracked file 全体(現在 274 files、約 2 MB、Rust のソースや docs を含む)が cache/texrun/texrun/<sha>/ にコピーされます。また、今後 root に hooks/、agents/、commands/、bin/、.mcp.json、settings.json などを置くと、それが plugin の component として利用者の環境で読み込まれます(bin/ があると claude.ai / Cowork では install されなくなる、とも書かれています)。現状は問題ありませんが、この制約を CONTRIBUTING か docs/agent-skills.md に一文残しておくとよいと思います。version を指定しない判断(commit を追う。third-party の marketplace は auto-update が既定で off なので、docs の「enable auto-update」の案内も正確)には同意します。

  5. errors.md の unsafe_root と broad_project_root: どちらも「$HOME か一時ディレクトリ」と書かれていて紛らわしいです。実装(check_root)では、暗黙の root なら error、--root で明示すれば note です。unsafe_root の行を「The implicit project root (the entrypoint's directory) would be /, $HOME or a temporary directory ...」とするとわかりやすくなります。

  6. 修正の報告: 2 回の run でどちらも Claude は \foo{} を削除し、cite キーを推測で変えていました。どちらも最終報告で明示していたので問題ありません。ただ、Fix の節に「Tell the user about every change that guesses the author's intent (removed macros, renamed keys)」と一文あると、モデルによって振る舞いがぶれにくくなると思います。

  7. docs/agent-skills.md: 「Claude API で作るアプリケーションからは自前の tool で texrun を呼ぶ」に加えて、Claude Agent SDK ならこの plugin をそのまま読み込める(plugins option / .claude/skills)ことも書いておくと、選択肢として役立ちます。

…release

- Check every single snake_case word in the skill's code spans against
  the JSON fields, kinds and enum and option values; read the CLI's error
  kinds and the new note kind constants from the source.
- Recommend adding the marketplace at the tag of the installed texrun,
  and say that --help and the JSON win over the skill.
- Use ${CLAUDE_SKILL_DIR} for the summary script, harden the script
  against odd input and encodings, and ask the agent to report guessed
  fixes.
- Document the Agent SDK, the constraints of the root plugin and the
  skill in the release steps; clarify unsafe_root.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@nishide-dev nishide-dev left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Verdict: APPROVE

1f6fa68 で、前回の should-fix 2 件と nit 7 件がすべて解消されていることを確認しました。残っているのは軽微な nit だけです。

確認したこと(head 1f6fa68)

  • ゲート: cargo check --workspace --all-targets --all-features --locked、cargo fmt --all -- --check、cargo clippy ... -D warnings、cargo test --workspace --all-features --locked はすべて通過しました。skill_docs の 7 件(新しい single_word_names_exist を含む)も通っています。
  • claude plugin validate .(Claude Code 2.1.289)は Validation passed with warnings で、warning は意図どおりの version 未指定の 1 件だけでした。
  • 前回わざと壊したケースと、追加のケースを再確認しました。どれも該当するテストが失敗し、git checkout で戻すと通ります。
    • texrun_exit_code → texrun_exitcode、file → path_x、output_dir → out_dir(前回は検出できなかったもの): SKILL.md: `...` is not a JSON field, kind or value of texrun で検出されました。
    • 存在しない option(--preview-dpix 200)、存在しないフィールドのパス(preview.page[].page)、errors.md から bibtex_failed の行を削除、exit code 表の 4 を 5 に変更: いずれも検出されました。
    • report.rs の pub mod kind に NEW_KIND を追加、pub mod note に NEW_NOTE を追加: errors.md の表との不一致として検出されました。前回は検出できなかったケースです。
  • texrun_summary.py: 前回 traceback になった入力を再確認しました。
    • 不正 JSON、空入力、配列、\xff、引数 2 個: exit 2 とメッセージ。
    • null 値や dict 以外の要素: 無視して続行。
    • 未知の severity: --all で info and other に [fatal] 付きで表示。
    • PYTHONIOENCODING=ascii で日本語を含む入力: 論... と escape して exit 0。
  • 発火の確認(claude -p --plugin-dir): 「ダウンロードしてきた main.tex をビルドして、エラーがあれば直して。」と依頼しました。
    • texrun:texrun が発火し、Claude は「Downloaded document → container backend」として --backend container を選びました。
    • ${CLAUDE_SKILL_DIR} は絶対パスに置換され、summary script がそのまま動きました。
    • main.tex:3 の \foo を直して再 compile すると succeeded になり、preview の PNG も確認しました。
    • 最終報告で「これは作者の意図を推測した変更」と明示していて、追加した一文が効いていると思います(9 turns、約 $0.31)。

nit(任意)

  1. v0.1.1 が出るまでの導入手順: README、docs/agent-skills.md、setup.md は nishide-dev/texrun@v<version> を案内し、「releases from v0.1.1 contain the plugin」と書いています。ただ、現時点の最新リリースは v0.1.0 で、.claude-plugin/ を含みません。このため、v0.1.0 を入れた利用者が手順どおり @v0.1.0 を指定すると、marketplace の追加に失敗します。v0.1.1 のリリースまでの間、「v0.1.0 では tag なし(nishide-dev/texrun)で追加する(main の CLI は v0.1.0 と同じ)」と一文あると親切です。v0.1.1 をすぐ切る予定なら不要です。
  2. 出力の空白: texrun_summary.py --all の未知 severity の行が [fatal] (no file: ...) と 2 つの空白で始まります(print(..., end="") の後の print_diagnostic が先頭に空白を 2 つ付けるため)。見た目だけの問題です。

@nishide-dev
nishide-dev merged commit 6837ce0 into main Oct 6, 2026
12 checks passed
@nishide-dev
nishide-dev deleted the feat/agent-skills branch October 6, 2026 22:29
nishide-dev added a commit that referenced this pull request Oct 6, 2026
## 概要

pdfTeX が自分で出す致命的エラー(`!pdfTeX error: ...`。font や画像を読めないときなど)を log parser
が拾わず、`outcome: failed` なのに `diagnostics: []` になっていた問題を直す。あわせて、失敗した
compile には必ず error diagnostic が 1 件以上付くようにする。

## 変更内容

- `texrun-latex-log`
- `!pdfTeX error: ...`(`!` の後に空白がなく、`-file-line-error` でも `file:line:`
にならず、`l.<n>` もない)を error / `other` として報告する。直後の空白始まりの ` ==> Fatal error
occurred, ...` は、TeX エラー後の stop と同じく `emergency_stop` の `info` として扱う(#40
の方針どおり、error の数が直すべき問題の数)
- pdfTeX は位置を出さず、font のように input を読み終えて PDF を書く段階で落ちることも多いので、`file` /
`line` は常に `None`(file stack の推測もしない。message に font 名や画像名が入る)
- `unexplained_failure(log)` を公開:失敗したのに error が見つからないとき用に、log 末尾(最後の 16
KiB のうち非空行を最大 12 行)を `raw_excerpt` に持つ error / `other` を返す。末尾に `!`
行があればそれを message に引用する。計算量は log サイズに依らず定数、message / excerpt は既存と同じ上限と
sanitize を通す
- `texrun-texlive`:`outcome: failed` で error diagnostic が 0
件のとき(log・texrun・BibTeX のどれも error を出さなかったとき)だけ、上記の error を追加する。log
の読み込みは既存の 1 回分を使い回す
- kind は新設せず `other` にした。`! pdfTeX error (ext4): ...` のように TeX
のエラールーチン経由の pdfTeX エラーは従来から `other` で、同じ pdfTeX 由来のエラーで kind
が分かれるのを避けるため。新設は必要になったら後から足せる(未知の kind は `other` として deserialize される)
- 実ログ fixture(dev コンテナで生成、`regenerate.sh` に追加)
- `pdftex-missing-font`:T1 の `ecrm1000`(`MKTEXPK=0`、TeX Live engine
と同じ設定)→ `!pdfTeX error: pdflatex (file ecrm1000): Font ecrm1000 at 600
not found`(#66 の再現)
- `pdftex-missing-image`:`\pdfximage{nosuch.png}` → `!pdfTeX error:
pdflatex: cannot find image file nosuch.png`
- `pdftex-error-ext`:`\pdfendlink` だけ → `./main.tex:5: pdfTeX error
(ext4): ...`(従来どおり位置付きの `other`)
- `capacity-exceeded`(`TeX capacity
exceeded`)、`cannot-write`(`openout_any=p` で `I can't write on
file`)、`interruption`(SIGINT で `Interruption.`):いずれも既に `file:line:` 形式の
TeX エラーとして拾えていたことを固定する回帰テスト
- skill(`skills/texrun/SKILL.md`、`reference/errors.md`)を更新
- docs/cli.md の Diagnostics 節に、pdfTeX エラーの扱いと「失敗時は必ず error
がある」ことを追記。crate docs の表も更新

## 確認方法

- [x] `cargo check --workspace --all-targets --all-features --locked`
- [x] `cargo fmt --all -- --check`
- [x] `cargo clippy --workspace --all-targets --all-features --locked --
-D warnings`
- [x] `cargo test --workspace --all-features --locked`(macOS host)
- [x] dev コンテナで `TEXRUN_REQUIRE_TEXLIVE=1 TEXRUN_REQUIRE_PREVIEW_TOOLS=1
cargo test --workspace --all-features --locked`
- [x] dev コンテナで実際に `texrun compile` して確認:T1 font の文書は `error: pdfTeX
error: pdflatex (file ecrm1000): Font ecrm1000 at 600 not found`(1
error)、`\pdfximage` の文書は `error: pdfTeX error: pdflatex: cannot find
image file nosuch.png`
- 追加テスト:実ログ 4 件(`real_logs.rs`)、pdfTeX エラーが後続の偽 `l.<n>` や file stack
から位置を取らないこと(`synthetic.rs`)、`unexplained_failure` の上限・sanitize・`!`
行の引用(unit)、fake latexmk で「認識できるエラーなら追加しない / 未知形式・log
なしなら追加する」(`engine.rs`)

## 関連 Issue

Closes #66

## 補足

- PR #64(skill)の merge 後に rebase し、同じ PR で skill を更新:`SKILL.md`
の「`failed` なのに error がなければ log を読む」という暫定案内を、位置なしの `other` error(pdfTeX の
font / 画像エラー、または log 末尾の抜粋付きの原因不明エラー)の読み方に置き換え、`reference/errors.md` の
`other` 行に対処を追記。kind は追加していないので `skill_docs`
の整合性テストはそのまま通る。`scripts/texrun_summary.py` の「error が無い」分岐は古い texrun
向けに残した
- `unexplained_failure` は latexmk 自体の失敗(TeX は成功したが latexmk が非 0
で終了など)でも出るが、latexmk の stdout は JSON に出していないので、その場合は TeX log の末尾しか示せない
- 他の engine(XeTeX / LuaTeX)の `!` 直後に空白がない独自形式は未対応だが、その場合も
`unexplained_failure` がその `!` 行を message に引用する

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
@nishide-dev nishide-dev mentioned this pull request Oct 6, 2026
2 tasks done
nishide-dev added a commit that referenced this pull request Oct 6, 2026
## 概要

v0.1.1 を公開するため、版を 0.1.1 に上げます。

## 変更内容

- `Cargo.toml` の workspace と内部 crate の版を 0.1.1 に(`Cargo.lock` も更新)
- README、docs/engine-image.md、skills/texrun/reference/setup.md の版表記を
0.1.1 に(docs/development.md のリリース手順の版表記も)

v0.1.1 に含まれる主な変更:
- engine image / dev image に Type1
font(cm-super、lmodern、texlive-fonts-recommended)を追加し、itemize や T1
を使う一般的な文書が compile できるように(#65、PR #67)
- `!pdfTeX error:` を error diagnostic として報告し、失敗した compile には必ず error
を返す(#66、PR #68)
- Agent Skill と Claude Code の plugin marketplace(#63、PR #64)

## 確認方法

- [x] `cargo test --workspace --all-features --locked`
- [x] `git grep -n '0\.1\.0' -- README.md docs/ skills/`
で残りは履歴・説明上の記述のみ(release notes の初版の例、engine image 0.1.0 の不具合の説明)

## 補足

merge 後に main へ `v0.1.1` の tag を push し、engine image と release(notes
付き)を自動公開します。texrun 0.1.0 は既定で engine image 0.1.0 を使うため、font の修正を得るには
texrun を 0.1.1 に上げる必要があります(release notes に追記予定)。

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5.5 <[email protected]>
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.

Provide Agent Skills for using texrun from AI agents

1 participant