0
54
近 7 天 12
28.5
生态多维模型
1 个月前
2026-07-05
快速安装与配置
opencode.json写入当前项目的 opencode.json,只对这个仓库生效。
opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["@jorgelorenz/opencode-latex-pdf-review@1.1.0"]
}写入 ~/.config/opencode/opencode.json,对所有项目生效。
~/.config/opencode/opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["@jorgelorenz/opencode-latex-pdf-review@1.1.0"]
}若你要在本地改造这个插件,先装到项目里再从本地路径引用。
shell
pnpm add -D @jorgelorenz/opencode-latex-pdf-reviewopencode 启动时会通过内嵌运行时自动加载 npm 依赖并缓存至本地目录,无需手动在全局环境执行安装。
OpenCode plugin for PDF <-> LaTeX synchronized review using SyncTeX.
The plugin opens a local split-view UI: PDF on the left, LaTeX source on the right. Clicking in the PDF resolves the source line with SyncTeX, and review comments are submitted to the active OpenCode session.
Install
Add the package to your OpenCode config:
{
"plugins": [
"@jorgelorenz/opencode-latex-pdf-review"
]
}
No manual copying into .opencode/plugins is required.
Prerequisites
- OpenCode runtime with Bun-enabled plugins
- Bun installed and available on
PATH - SyncTeX binary (
synctex) available onPATH - A PDF compiled with SyncTeX enabled
Compile with SyncTeX (examples):
pdflatex --synctex=1 main.tex
latexmk -pdf -synctex=1 main.tex
Both main.pdf and main.synctex.gz (or main.synctex) must exist.
Usage
Run in OpenCode:
/latex-pdf-review
Or with an explicit PDF path:
/latex-pdf-review chapters/chapter1.pdf
Supported Operating Systems
- Linux
- macOS
- Windows
- WSL
The plugin uses Bun APIs and spawn-style process execution (no shell-specific script dependency at runtime).
Startup Validation
On startup, the plugin validates:
- Bun runtime is available
bunexecutable exists onPATHsynctexexecutable exists onPATH- target PDF exists
.synctex.gz/.synctexexists, or attempts safe auto-compile
Validation failures return clear, user-facing error messages in OpenCode.
Security
The local HTTP server is hardened for local-only usage:
- binds to
127.0.0.1only - validates API input payloads
- rejects path traversal and blocks filesystem access outside workspace
- serves only known UI assets and explicit workspace files
- uses a random per-session token for API authorization
Troubleshooting
synctex not found:
- Install TeX Live (Linux/macOS/WSL) or MiKTeX (Windows)
- Verify with:
synctex --version
PDF found but no SyncTeX mapping:
- Recompile with
--synctex=1 - Confirm
.synctex.gzexists next to the PDF
Browser UI does not open automatically:
- Copy the URL from the OpenCode toast and open it manually
Development
bun install
bun run typecheck
bun run lint
bun run build
Release
Publishing is automated with GitHub Actions on version tags:
git tag v1.0.0
git push origin v1.0.0
The workflow runs typecheck, lint, build, and then publishes to npm.
License
MIT