texfleet 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. texfleet-0.1.0/.gitignore +3 -0
  2. texfleet-0.1.0/LICENSE +21 -0
  3. texfleet-0.1.0/Makefile +28 -0
  4. texfleet-0.1.0/PKG-INFO +202 -0
  5. texfleet-0.1.0/README.md +176 -0
  6. texfleet-0.1.0/docs/README.zh-CN.md +165 -0
  7. texfleet-0.1.0/pyproject.toml +45 -0
  8. texfleet-0.1.0/scripts/vendor.sh +38 -0
  9. texfleet-0.1.0/tests/test_texfleet.py +305 -0
  10. texfleet-0.1.0/texfleet/__init__.py +3 -0
  11. texfleet-0.1.0/texfleet/__main__.py +3 -0
  12. texfleet-0.1.0/texfleet/cli.py +343 -0
  13. texfleet-0.1.0/texfleet/config.py +151 -0
  14. texfleet-0.1.0/texfleet/files.py +265 -0
  15. texfleet-0.1.0/texfleet/latex.py +555 -0
  16. texfleet-0.1.0/texfleet/projects.py +283 -0
  17. texfleet-0.1.0/texfleet/remote.py +249 -0
  18. texfleet-0.1.0/texfleet/server.py +578 -0
  19. texfleet-0.1.0/texfleet/static/app.css +343 -0
  20. texfleet-0.1.0/texfleet/static/favicon.svg +1 -0
  21. texfleet-0.1.0/texfleet/static/index.html +32 -0
  22. texfleet-0.1.0/texfleet/static/js/api.js +50 -0
  23. texfleet-0.1.0/texfleet/static/js/app.js +129 -0
  24. texfleet-0.1.0/texfleet/static/js/home.js +202 -0
  25. texfleet-0.1.0/texfleet/static/js/pdfview.js +307 -0
  26. texfleet-0.1.0/texfleet/static/js/util.js +223 -0
  27. texfleet-0.1.0/texfleet/static/js/workspace.js +1242 -0
  28. texfleet-0.1.0/texfleet/static/vendor/VERSIONS +2 -0
  29. texfleet-0.1.0/texfleet/static/vendor/codemirror/LICENSE +21 -0
  30. texfleet-0.1.0/texfleet/static/vendor/codemirror/codemirror.bundle.css +384 -0
  31. texfleet-0.1.0/texfleet/static/vendor/codemirror/codemirror.bundle.js +17520 -0
  32. texfleet-0.1.0/texfleet/static/vendor/codemirror/vim.js +5978 -0
  33. texfleet-0.1.0/texfleet/static/vendor/pdfjs/LICENSE +177 -0
  34. texfleet-0.1.0/texfleet/static/vendor/pdfjs/pdf.min.mjs +21 -0
  35. texfleet-0.1.0/texfleet/static/vendor/pdfjs/pdf.worker.min.mjs +21 -0
@@ -0,0 +1,3 @@
1
+ __pycache__/
2
+ *.pyc
3
+ dist/
texfleet-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Xiaoguang Wang
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,28 @@
1
+ # texfleet: build the single-file zipapp, install it, run the tests.
2
+ PY ?= python3
3
+ SOURCES := $(shell find texfleet -type f -not -path '*/__pycache__/*' -not -name '*.pyc')
4
+
5
+ .PHONY: all dist install test vendor clean
6
+
7
+ all: dist
8
+
9
+ dist: dist/texfleet
10
+
11
+ dist/texfleet: $(SOURCES)
12
+ @mkdir -p dist
13
+ $(PY) -c "import sys; sys.path.insert(0, '.'); from texfleet.remote import package_bytes; open('dist/texfleet', 'wb').write(package_bytes())"
14
+ @chmod 755 dist/texfleet
15
+ @echo "built dist/texfleet ($$(du -h dist/texfleet | cut -f1))"
16
+
17
+ install:
18
+ $(PY) -m texfleet install
19
+
20
+ test:
21
+ $(PY) -m unittest discover -s tests
22
+
23
+ vendor:
24
+ ./scripts/vendor.sh
25
+
26
+ clean:
27
+ rm -rf dist
28
+ find . -name __pycache__ -type d -prune -exec rm -rf {} +
@@ -0,0 +1,202 @@
1
+ Metadata-Version: 2.5
2
+ Name: texfleet
3
+ Version: 0.1.0
4
+ Summary: A lightweight web editor for LaTeX papers on your local and remote machines: browse projects, edit, compile and preview with SyncTeX, over ssh or Tailscale.
5
+ Project-URL: Homepage, https://github.com/xjtuwxg/texfleet
6
+ Project-URL: Documentation, https://github.com/xjtuwxg/texfleet#readme
7
+ Project-URL: Issues, https://github.com/xjtuwxg/texfleet/issues
8
+ Project-URL: Changelog, https://github.com/xjtuwxg/texfleet/releases
9
+ Author: Xiaoguang Wang
10
+ License-Expression: MIT
11
+ License-File: LICENSE
12
+ License-File: texfleet/static/vendor/codemirror/LICENSE
13
+ License-File: texfleet/static/vendor/pdfjs/LICENSE
14
+ Keywords: editor,latex,paper,pdf,remote,research,ssh,synctex,tailscale,tex
15
+ Classifier: Development Status :: 4 - Beta
16
+ Classifier: Environment :: Web Environment
17
+ Classifier: Intended Audience :: Science/Research
18
+ Classifier: Operating System :: MacOS
19
+ Classifier: Operating System :: POSIX :: Linux
20
+ Classifier: Programming Language :: Python :: 3
21
+ Classifier: Programming Language :: Python :: 3 :: Only
22
+ Classifier: Topic :: Text Editors
23
+ Classifier: Topic :: Text Processing :: Markup :: LaTeX
24
+ Requires-Python: >=3.9
25
+ Description-Content-Type: text/markdown
26
+
27
+ <div align="center">
28
+
29
+ # texfleet
30
+
31
+ **Your LaTeX papers on every machine, in one browser tab.**
32
+
33
+ Browse projects across your servers, edit the paper, compile it where TeX lives,<br>
34
+ and read the PDF side by side, with two-way SyncTeX. Built for research repos where an AI agent co-writes the paper.
35
+
36
+ [![PyPI](https://img.shields.io/pypi/v/texfleet?color=2f5d8a)](https://pypi.org/project/texfleet/)
37
+ [![Python](https://img.shields.io/pypi/pyversions/texfleet?color=2f5d8a)](https://pypi.org/project/texfleet/)
38
+ [![Tests](https://github.com/xjtuwxg/texfleet/actions/workflows/test.yml/badge.svg)](https://github.com/xjtuwxg/texfleet/actions/workflows/test.yml)
39
+ [![License: MIT](https://img.shields.io/badge/license-MIT-2f5d8a)](https://github.com/xjtuwxg/texfleet/blob/main/LICENSE)
40
+
41
+ **English** · [简体中文](https://github.com/xjtuwxg/texfleet/blob/main/docs/README.zh-CN.md)
42
+
43
+ <picture>
44
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/xjtuwxg/texfleet/main/docs/images/workspace-dark.jpg">
45
+ <img alt="texfleet workspace: file tree, LaTeX editor and PDF preview with a SyncTeX highlight" src="https://raw.githubusercontent.com/xjtuwxg/texfleet/main/docs/images/workspace-light.jpg" width="100%">
46
+ </picture>
47
+
48
+ </div>
49
+
50
+ ## Highlights
51
+
52
+ - **One dashboard for all your machines.** Projects on your laptop, lab server and GPU box, with
53
+ their papers, git status, and the tmux sessions working in them.
54
+ - **Write where the data is.** Edit and compile on the remote machine over `ssh` (Tailscale names work).
55
+ Nothing is exposed to the network, and nothing has to be installed by hand on the remote.
56
+ - **Live with your AI agent.** Edits made on disk appear in place with the changed lines highlighted.
57
+ Conflicts with your unsaved edits are caught, not overwritten, and the PDF rebuilds when paper files change.
58
+ - **A real LaTeX loop.** `latexmk` builds, a clickable problems list, `⌘J` to find the cursor in the PDF,
59
+ and double-click the PDF to jump back to the source.
60
+ - **Tiny.** Pure Python standard library, ~800 KB, no Node and no database. Runs on Linux and macOS.
61
+
62
+ ## Install
63
+
64
+ ```sh
65
+ uv tool install texfleet # or: pipx install texfleet · pip install texfleet
66
+ ```
67
+
68
+ Prefer a single file? Every [release](https://github.com/xjtuwxg/texfleet/releases) ships a standalone zipapp:
69
+
70
+ ```sh
71
+ curl -fLo ~/.local/bin/texfleet https://github.com/xjtuwxg/texfleet/releases/latest/download/texfleet
72
+ chmod +x ~/.local/bin/texfleet
73
+ ```
74
+
75
+ Requires Python 3.9+. To compile papers, the machine that builds them needs TeX Live (`latexmk`, `synctex`).
76
+
77
+ ## Quick start
78
+
79
+ ```sh
80
+ texfleet open # start in the background and open the browser
81
+ ```
82
+
83
+ Add your other machines, then reload the dashboard:
84
+
85
+ ```sh
86
+ texfleet add-machine lab --ssh lab-server # any ssh alias or Tailscale hostname
87
+ texfleet add-machine gpu --ssh gpu-box
88
+ texfleet stop && texfleet open
89
+ ```
90
+
91
+ If texfleet isn't installed on a remote, the dashboard offers **Install texfleet**, which copies itself over `ssh`.
92
+
93
+ <div align="center">
94
+ <picture>
95
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/xjtuwxg/texfleet/main/docs/images/dashboard-dark.jpg">
96
+ <img alt="texfleet dashboard listing projects on two machines" src="https://raw.githubusercontent.com/xjtuwxg/texfleet/main/docs/images/dashboard-light.jpg" width="100%">
97
+ </picture>
98
+ </div>
99
+
100
+ ## How it works
101
+
102
+ ```
103
+ browser ──► texfleet (your laptop) ──ssh -L──► texfleet on lab-server (edits, latexmk, synctex)
104
+ localhost:7878 └─ssh -L──► texfleet on gpu-box
105
+ ```
106
+
107
+ Every machine runs the same `texfleet`. Your local one starts the others with
108
+ `ssh HOST texfleet ensure` and talks to them through `ssh -L` tunnels. You can also expose
109
+ one server on your tailnet directly with `texfleet serve --bind 127.0.0.1 --bind tailscale`.
110
+
111
+ ## Features
112
+
113
+ | | |
114
+ |---|---|
115
+ | **Projects** | Git repos and paper folders found under your roots · pin, filter, add folders · git branch and changes · tmux sessions per project |
116
+ | **Editor** | CodeMirror with LaTeX highlighting · tabs, autosave, spell check, Vim keys · quick open, project search · outline with `\todo` items and word count |
117
+ | **Build** | `latexmk` with pdfLaTeX, XeLaTeX or LuaLaTeX, or your own command · errors and warnings mapped to files and lines |
118
+ | **PDF** | pdf.js viewer with text selection and links · pinch zoom · SyncTeX in both directions |
119
+ | **Data** | CSV/TSV as tables · images · per-file `git diff` · drag-and-drop upload |
120
+
121
+ <details>
122
+ <summary><b>Keyboard shortcuts</b></summary>
123
+
124
+ | macOS | Linux | |
125
+ |---|---|---|
126
+ | `⌘S` | `Ctrl-S` | save (and build) |
127
+ | `⌘↵` | `Ctrl-Enter` | build (`⇧` forces a full rebuild) |
128
+ | `⌘P` | `Ctrl-P` | go to file |
129
+ | `⇧⌘F` | `Ctrl-Shift-F` | search project |
130
+ | `⌘J` | `Ctrl-J` | show cursor position in the PDF |
131
+ | `⌘/` · `⌘B` · `⌘I` | `Ctrl-/` · `Ctrl-B` · `Ctrl-I` | comment · `\textbf` · `\emph` |
132
+ | double-click PDF | | jump to the source line |
133
+
134
+ </details>
135
+
136
+ <details>
137
+ <summary><b>Configuration</b></summary>
138
+
139
+ `~/.config/texfleet/config.json`. Every key is optional:
140
+
141
+ ```json
142
+ {
143
+ "name": "laptop",
144
+ "roots": ["~/workspace"],
145
+ "port": 7878,
146
+ "bind": ["127.0.0.1"],
147
+ "machines": [
148
+ {"name": "lab", "ssh": "lab-server"},
149
+ {"name": "gpu", "ssh": "gpu-box", "command": "/opt/bin/texfleet"}
150
+ ]
151
+ }
152
+ ```
153
+
154
+ Per-paper build settings go in `.texfleet.json` next to the main `.tex` file:
155
+
156
+ ```json
157
+ { "engine": "lualatex", "args": ["-shell-escape"] }
158
+ ```
159
+
160
+ or `{ "command": "make" }` to run your own build. Add `-synctex=1` to a custom build
161
+ command to keep source↔PDF jumps. Without a config file, texfleet runs
162
+ `latexmk -pdf -synctex=1`, and `% !TeX program = xelatex` picks the engine.
163
+
164
+ Run `texfleet service install` to start texfleet at login (systemd user unit on Linux, launchd on macOS).
165
+
166
+ </details>
167
+
168
+ <details>
169
+ <summary><b>Security</b></summary>
170
+
171
+ - Listens on `127.0.0.1` by default and reaches remotes only through `ssh`.
172
+ - Every request needs a random access token, sent as an HttpOnly, SameSite=Strict cookie or a Bearer header.
173
+ Write requests also need a custom header, which blocks cross-site requests.
174
+ - File access is limited to your configured roots. Raw files are served with a sandboxing CSP.
175
+ - Builds run `latexmk` as you. Shell escape stays off unless you enable it.
176
+
177
+ </details>
178
+
179
+ ## Tips for research projects
180
+
181
+ - Keep one git repo per project on its **home machine**, the one with the data and the runs, and
182
+ put each paper version in its own folder: `paper/<venue>/main.tex` with one file per section.
183
+ - **Name tmux sessions after projects.** The dashboard shows where each agent is running, and a
184
+ click copies the attach command.
185
+ - Generate tables and figures from `results/` with scripts. Then neither you nor the agent
186
+ hand-edits numbers.
187
+
188
+ ## Development
189
+
190
+ ```sh
191
+ git clone https://github.com/xjtuwxg/texfleet && cd texfleet
192
+ python3 -m texfleet serve --open # run from source
193
+ make test # python3 -m unittest discover -s tests
194
+ make dist # build the single-file zipapp in dist/texfleet
195
+ ```
196
+
197
+ The UI is vanilla ES modules with vendored [CodeMirror 5](https://codemirror.net/5/) (MIT) and
198
+ [pdf.js](https://mozilla.github.io/pdf.js/) (Apache-2.0); see `scripts/vendor.sh`.
199
+
200
+ ## License
201
+
202
+ [MIT](https://github.com/xjtuwxg/texfleet/blob/main/LICENSE)
@@ -0,0 +1,176 @@
1
+ <div align="center">
2
+
3
+ # texfleet
4
+
5
+ **Your LaTeX papers on every machine, in one browser tab.**
6
+
7
+ Browse projects across your servers, edit the paper, compile it where TeX lives,<br>
8
+ and read the PDF side by side, with two-way SyncTeX. Built for research repos where an AI agent co-writes the paper.
9
+
10
+ [![PyPI](https://img.shields.io/pypi/v/texfleet?color=2f5d8a)](https://pypi.org/project/texfleet/)
11
+ [![Python](https://img.shields.io/pypi/pyversions/texfleet?color=2f5d8a)](https://pypi.org/project/texfleet/)
12
+ [![Tests](https://github.com/xjtuwxg/texfleet/actions/workflows/test.yml/badge.svg)](https://github.com/xjtuwxg/texfleet/actions/workflows/test.yml)
13
+ [![License: MIT](https://img.shields.io/badge/license-MIT-2f5d8a)](https://github.com/xjtuwxg/texfleet/blob/main/LICENSE)
14
+
15
+ **English** · [简体中文](https://github.com/xjtuwxg/texfleet/blob/main/docs/README.zh-CN.md)
16
+
17
+ <picture>
18
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/xjtuwxg/texfleet/main/docs/images/workspace-dark.jpg">
19
+ <img alt="texfleet workspace: file tree, LaTeX editor and PDF preview with a SyncTeX highlight" src="https://raw.githubusercontent.com/xjtuwxg/texfleet/main/docs/images/workspace-light.jpg" width="100%">
20
+ </picture>
21
+
22
+ </div>
23
+
24
+ ## Highlights
25
+
26
+ - **One dashboard for all your machines.** Projects on your laptop, lab server and GPU box, with
27
+ their papers, git status, and the tmux sessions working in them.
28
+ - **Write where the data is.** Edit and compile on the remote machine over `ssh` (Tailscale names work).
29
+ Nothing is exposed to the network, and nothing has to be installed by hand on the remote.
30
+ - **Live with your AI agent.** Edits made on disk appear in place with the changed lines highlighted.
31
+ Conflicts with your unsaved edits are caught, not overwritten, and the PDF rebuilds when paper files change.
32
+ - **A real LaTeX loop.** `latexmk` builds, a clickable problems list, `⌘J` to find the cursor in the PDF,
33
+ and double-click the PDF to jump back to the source.
34
+ - **Tiny.** Pure Python standard library, ~800 KB, no Node and no database. Runs on Linux and macOS.
35
+
36
+ ## Install
37
+
38
+ ```sh
39
+ uv tool install texfleet # or: pipx install texfleet · pip install texfleet
40
+ ```
41
+
42
+ Prefer a single file? Every [release](https://github.com/xjtuwxg/texfleet/releases) ships a standalone zipapp:
43
+
44
+ ```sh
45
+ curl -fLo ~/.local/bin/texfleet https://github.com/xjtuwxg/texfleet/releases/latest/download/texfleet
46
+ chmod +x ~/.local/bin/texfleet
47
+ ```
48
+
49
+ Requires Python 3.9+. To compile papers, the machine that builds them needs TeX Live (`latexmk`, `synctex`).
50
+
51
+ ## Quick start
52
+
53
+ ```sh
54
+ texfleet open # start in the background and open the browser
55
+ ```
56
+
57
+ Add your other machines, then reload the dashboard:
58
+
59
+ ```sh
60
+ texfleet add-machine lab --ssh lab-server # any ssh alias or Tailscale hostname
61
+ texfleet add-machine gpu --ssh gpu-box
62
+ texfleet stop && texfleet open
63
+ ```
64
+
65
+ If texfleet isn't installed on a remote, the dashboard offers **Install texfleet**, which copies itself over `ssh`.
66
+
67
+ <div align="center">
68
+ <picture>
69
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/xjtuwxg/texfleet/main/docs/images/dashboard-dark.jpg">
70
+ <img alt="texfleet dashboard listing projects on two machines" src="https://raw.githubusercontent.com/xjtuwxg/texfleet/main/docs/images/dashboard-light.jpg" width="100%">
71
+ </picture>
72
+ </div>
73
+
74
+ ## How it works
75
+
76
+ ```
77
+ browser ──► texfleet (your laptop) ──ssh -L──► texfleet on lab-server (edits, latexmk, synctex)
78
+ localhost:7878 └─ssh -L──► texfleet on gpu-box
79
+ ```
80
+
81
+ Every machine runs the same `texfleet`. Your local one starts the others with
82
+ `ssh HOST texfleet ensure` and talks to them through `ssh -L` tunnels. You can also expose
83
+ one server on your tailnet directly with `texfleet serve --bind 127.0.0.1 --bind tailscale`.
84
+
85
+ ## Features
86
+
87
+ | | |
88
+ |---|---|
89
+ | **Projects** | Git repos and paper folders found under your roots · pin, filter, add folders · git branch and changes · tmux sessions per project |
90
+ | **Editor** | CodeMirror with LaTeX highlighting · tabs, autosave, spell check, Vim keys · quick open, project search · outline with `\todo` items and word count |
91
+ | **Build** | `latexmk` with pdfLaTeX, XeLaTeX or LuaLaTeX, or your own command · errors and warnings mapped to files and lines |
92
+ | **PDF** | pdf.js viewer with text selection and links · pinch zoom · SyncTeX in both directions |
93
+ | **Data** | CSV/TSV as tables · images · per-file `git diff` · drag-and-drop upload |
94
+
95
+ <details>
96
+ <summary><b>Keyboard shortcuts</b></summary>
97
+
98
+ | macOS | Linux | |
99
+ |---|---|---|
100
+ | `⌘S` | `Ctrl-S` | save (and build) |
101
+ | `⌘↵` | `Ctrl-Enter` | build (`⇧` forces a full rebuild) |
102
+ | `⌘P` | `Ctrl-P` | go to file |
103
+ | `⇧⌘F` | `Ctrl-Shift-F` | search project |
104
+ | `⌘J` | `Ctrl-J` | show cursor position in the PDF |
105
+ | `⌘/` · `⌘B` · `⌘I` | `Ctrl-/` · `Ctrl-B` · `Ctrl-I` | comment · `\textbf` · `\emph` |
106
+ | double-click PDF | | jump to the source line |
107
+
108
+ </details>
109
+
110
+ <details>
111
+ <summary><b>Configuration</b></summary>
112
+
113
+ `~/.config/texfleet/config.json`. Every key is optional:
114
+
115
+ ```json
116
+ {
117
+ "name": "laptop",
118
+ "roots": ["~/workspace"],
119
+ "port": 7878,
120
+ "bind": ["127.0.0.1"],
121
+ "machines": [
122
+ {"name": "lab", "ssh": "lab-server"},
123
+ {"name": "gpu", "ssh": "gpu-box", "command": "/opt/bin/texfleet"}
124
+ ]
125
+ }
126
+ ```
127
+
128
+ Per-paper build settings go in `.texfleet.json` next to the main `.tex` file:
129
+
130
+ ```json
131
+ { "engine": "lualatex", "args": ["-shell-escape"] }
132
+ ```
133
+
134
+ or `{ "command": "make" }` to run your own build. Add `-synctex=1` to a custom build
135
+ command to keep source↔PDF jumps. Without a config file, texfleet runs
136
+ `latexmk -pdf -synctex=1`, and `% !TeX program = xelatex` picks the engine.
137
+
138
+ Run `texfleet service install` to start texfleet at login (systemd user unit on Linux, launchd on macOS).
139
+
140
+ </details>
141
+
142
+ <details>
143
+ <summary><b>Security</b></summary>
144
+
145
+ - Listens on `127.0.0.1` by default and reaches remotes only through `ssh`.
146
+ - Every request needs a random access token, sent as an HttpOnly, SameSite=Strict cookie or a Bearer header.
147
+ Write requests also need a custom header, which blocks cross-site requests.
148
+ - File access is limited to your configured roots. Raw files are served with a sandboxing CSP.
149
+ - Builds run `latexmk` as you. Shell escape stays off unless you enable it.
150
+
151
+ </details>
152
+
153
+ ## Tips for research projects
154
+
155
+ - Keep one git repo per project on its **home machine**, the one with the data and the runs, and
156
+ put each paper version in its own folder: `paper/<venue>/main.tex` with one file per section.
157
+ - **Name tmux sessions after projects.** The dashboard shows where each agent is running, and a
158
+ click copies the attach command.
159
+ - Generate tables and figures from `results/` with scripts. Then neither you nor the agent
160
+ hand-edits numbers.
161
+
162
+ ## Development
163
+
164
+ ```sh
165
+ git clone https://github.com/xjtuwxg/texfleet && cd texfleet
166
+ python3 -m texfleet serve --open # run from source
167
+ make test # python3 -m unittest discover -s tests
168
+ make dist # build the single-file zipapp in dist/texfleet
169
+ ```
170
+
171
+ The UI is vanilla ES modules with vendored [CodeMirror 5](https://codemirror.net/5/) (MIT) and
172
+ [pdf.js](https://mozilla.github.io/pdf.js/) (Apache-2.0); see `scripts/vendor.sh`.
173
+
174
+ ## License
175
+
176
+ [MIT](https://github.com/xjtuwxg/texfleet/blob/main/LICENSE)
@@ -0,0 +1,165 @@
1
+ <div align="center">
2
+
3
+ # texfleet
4
+
5
+ **在一个浏览器标签页里,管理你所有机器上的 LaTeX 论文。**
6
+
7
+ 浏览各台服务器上的项目,在线编辑论文,在装有 TeX 的机器上编译,左右对照阅读 PDF,并支持双向 SyncTeX。<br>
8
+ 为“研究代码仓库 + AI 助手一起写论文”的工作流而设计。
9
+
10
+ [![PyPI](https://img.shields.io/pypi/v/texfleet?color=2f5d8a)](https://pypi.org/project/texfleet/)
11
+ [![Python](https://img.shields.io/pypi/pyversions/texfleet?color=2f5d8a)](https://pypi.org/project/texfleet/)
12
+ [![Tests](https://github.com/xjtuwxg/texfleet/actions/workflows/test.yml/badge.svg)](https://github.com/xjtuwxg/texfleet/actions/workflows/test.yml)
13
+ [![License: MIT](https://img.shields.io/badge/license-MIT-2f5d8a)](https://github.com/xjtuwxg/texfleet/blob/main/LICENSE)
14
+
15
+ [English](https://github.com/xjtuwxg/texfleet/blob/main/README.md) · **简体中文**
16
+
17
+ <picture>
18
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/xjtuwxg/texfleet/main/docs/images/workspace-dark.jpg">
19
+ <img alt="texfleet 工作区:文件树、LaTeX 编辑器和带 SyncTeX 高亮的 PDF 预览" src="https://raw.githubusercontent.com/xjtuwxg/texfleet/main/docs/images/workspace-light.jpg" width="100%">
20
+ </picture>
21
+
22
+ </div>
23
+
24
+ ## 亮点
25
+
26
+ - **一个面板看全部机器**:笔记本、实验室服务器、GPU 服务器上的项目一目了然,包括其中的论文、git 状态,以及正在这些项目里运行的 tmux 会话。
27
+ - **在数据所在的机器上写作**:通过 `ssh`(支持 Tailscale 主机名)远程编辑和编译。不对外暴露任何端口,远程机器也不需要手动安装。
28
+ - **与 AI 助手协同**:磁盘上的修改会直接刷新到编辑器并高亮改动行;与你未保存的修改冲突时会提示,而不是直接覆盖;论文文件一变就自动重新编译 PDF。
29
+ - **完整的 LaTeX 工作流**:`latexmk` 编译、可点击跳转的错误列表、`⌘J` 定位光标在 PDF 中的位置、双击 PDF 跳回源码。
30
+ - **轻量**:纯 Python 标准库实现,约 800 KB,不依赖 Node 和数据库,支持 Linux 与 macOS。
31
+
32
+ ## 安装
33
+
34
+ ```sh
35
+ uv tool install texfleet # 或:pipx install texfleet · pip install texfleet
36
+ ```
37
+
38
+ 更喜欢单文件?每个 [release](https://github.com/xjtuwxg/texfleet/releases) 都附带一个独立的 zipapp:
39
+
40
+ ```sh
41
+ curl -fLo ~/.local/bin/texfleet https://github.com/xjtuwxg/texfleet/releases/latest/download/texfleet
42
+ chmod +x ~/.local/bin/texfleet
43
+ ```
44
+
45
+ 需要 Python 3.9+。用来编译论文的机器需要安装 TeX Live(`latexmk`、`synctex`)。
46
+
47
+ ## 快速开始
48
+
49
+ ```sh
50
+ texfleet open # 后台启动并打开浏览器
51
+ ```
52
+
53
+ 添加其他机器,然后刷新面板:
54
+
55
+ ```sh
56
+ texfleet add-machine lab --ssh lab-server # 任意 ssh 别名或 Tailscale 主机名
57
+ texfleet add-machine gpu --ssh gpu-box
58
+ texfleet stop && texfleet open
59
+ ```
60
+
61
+ 如果某台远程机器还没装 texfleet,面板上会出现 **Install texfleet** 按钮,点一下即可通过 `ssh` 自动复制过去。
62
+
63
+ <div align="center">
64
+ <picture>
65
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/xjtuwxg/texfleet/main/docs/images/dashboard-dark.jpg">
66
+ <img alt="texfleet 面板:列出两台机器上的项目" src="https://raw.githubusercontent.com/xjtuwxg/texfleet/main/docs/images/dashboard-light.jpg" width="100%">
67
+ </picture>
68
+ </div>
69
+
70
+ ## 工作原理
71
+
72
+ ```
73
+ 浏览器 ──► texfleet(你的笔记本) ──ssh -L──► lab-server 上的 texfleet (编辑、latexmk、synctex)
74
+ localhost:7878 └─ssh -L──► gpu-box 上的 texfleet
75
+ ```
76
+
77
+ 每台机器运行的是同一个 `texfleet`。本地的 texfleet 通过 `ssh HOST texfleet ensure` 拉起远程实例,再经由 `ssh -L` 隧道与之通信。
78
+ 你也可以用 `texfleet serve --bind 127.0.0.1 --bind tailscale` 把某台服务器直接开放到自己的 tailnet 上。
79
+
80
+ ## 功能
81
+
82
+ | | |
83
+ |---|---|
84
+ | **项目** | 自动发现根目录下的 git 仓库和论文目录 · 置顶、筛选、手动添加 · git 分支与改动 · 每个项目的 tmux 会话 |
85
+ | **编辑器** | CodeMirror,LaTeX 语法高亮 · 标签页、自动保存、拼写检查、Vim 键位 · 快速打开、全项目搜索 · 带 `\todo` 和字数统计的大纲 |
86
+ | **编译** | `latexmk`(pdfLaTeX / XeLaTeX / LuaLaTeX)或自定义命令 · 错误与警告定位到文件和行 |
87
+ | **PDF** | 基于 pdf.js,支持文字选择和链接 · 双指缩放 · 双向 SyncTeX |
88
+ | **数据** | CSV/TSV 表格视图 · 图片预览 · 单文件 `git diff` · 拖拽上传 |
89
+
90
+ <details>
91
+ <summary><b>快捷键</b></summary>
92
+
93
+ | macOS | Linux | |
94
+ |---|---|---|
95
+ | `⌘S` | `Ctrl-S` | 保存(并编译) |
96
+ | `⌘↵` | `Ctrl-Enter` | 编译(加 `⇧` 强制完整重编) |
97
+ | `⌘P` | `Ctrl-P` | 跳转到文件 |
98
+ | `⇧⌘F` | `Ctrl-Shift-F` | 全项目搜索 |
99
+ | `⌘J` | `Ctrl-J` | 在 PDF 中定位光标 |
100
+ | `⌘/` · `⌘B` · `⌘I` | `Ctrl-/` · `Ctrl-B` · `Ctrl-I` | 注释 · `\textbf` · `\emph` |
101
+ | 双击 PDF | | 跳转到对应源码行 |
102
+
103
+ </details>
104
+
105
+ <details>
106
+ <summary><b>配置</b></summary>
107
+
108
+ 配置文件为 `~/.config/texfleet/config.json`,所有字段都是可选的:
109
+
110
+ ```json
111
+ {
112
+ "name": "laptop",
113
+ "roots": ["~/workspace"],
114
+ "port": 7878,
115
+ "bind": ["127.0.0.1"],
116
+ "machines": [
117
+ {"name": "lab", "ssh": "lab-server"},
118
+ {"name": "gpu", "ssh": "gpu-box", "command": "/opt/bin/texfleet"}
119
+ ]
120
+ }
121
+ ```
122
+
123
+ 单篇论文的编译设置写在主 `.tex` 文件旁的 `.texfleet.json` 中:
124
+
125
+ ```json
126
+ { "engine": "lualatex", "args": ["-shell-escape"] }
127
+ ```
128
+
129
+ 也可以写 `{ "command": "make" }` 使用自定义编译命令;自定义命令请加上 `-synctex=1`,否则源码与 PDF 之间无法互相跳转。
130
+ 没有配置文件时默认运行 `latexmk -pdf -synctex=1`,也可以用 `% !TeX program = xelatex` 指定引擎。
131
+
132
+ 运行 `texfleet service install` 可设置开机/登录自启(Linux 为 systemd 用户服务,macOS 为 launchd)。
133
+
134
+ </details>
135
+
136
+ <details>
137
+ <summary><b>安全</b></summary>
138
+
139
+ - 默认只监听 `127.0.0.1`,远程机器只通过 `ssh` 访问。
140
+ - 每个请求都需要随机访问令牌(HttpOnly、SameSite=Strict 的 cookie 或 Bearer 头);写操作还要求带自定义请求头,从而拦截跨站请求。
141
+ - 文件访问仅限于配置的根目录;原始文件响应带有沙箱 CSP。
142
+ - 编译以当前用户身份运行 `latexmk`;除非你主动开启,否则 shell escape 保持关闭。
143
+
144
+ </details>
145
+
146
+ ## 科研项目组织建议
147
+
148
+ - 每个项目一个 git 仓库,放在它的**主机器**上(也就是存放数据、跑实验的那台);每个版本的论文放在单独的目录里,例如 `paper/<会议>/main.tex`,每节一个文件。
149
+ - **用项目名命名 tmux 会话**:面板会显示 AI 助手在哪里运行,点一下即可复制 attach 命令。
150
+ - 用脚本从 `results/` 生成表格和图片,这样无论你还是 AI 助手都不需要手动改数字。
151
+
152
+ ## 开发
153
+
154
+ ```sh
155
+ git clone https://github.com/xjtuwxg/texfleet && cd texfleet
156
+ python3 -m texfleet serve --open # 从源码运行
157
+ make test # python3 -m unittest discover -s tests
158
+ make dist # 在 dist/texfleet 生成单文件 zipapp
159
+ ```
160
+
161
+ 前端为原生 ES 模块,内置 [CodeMirror 5](https://codemirror.net/5/)(MIT)和 [pdf.js](https://mozilla.github.io/pdf.js/)(Apache-2.0),见 `scripts/vendor.sh`。
162
+
163
+ ## 许可证
164
+
165
+ [MIT](https://github.com/xjtuwxg/texfleet/blob/main/LICENSE)
@@ -0,0 +1,45 @@
1
+ [build-system]
2
+ requires = ["hatchling>=1.27"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "texfleet"
7
+ dynamic = ["version"]
8
+ description = "A lightweight web editor for LaTeX papers on your local and remote machines: browse projects, edit, compile and preview with SyncTeX, over ssh or Tailscale."
9
+ readme = "README.md"
10
+ requires-python = ">=3.9"
11
+ license = "MIT"
12
+ license-files = ["LICENSE", "texfleet/static/vendor/*/LICENSE"]
13
+ authors = [{ name = "Xiaoguang Wang" }]
14
+ keywords = ["latex", "tex", "editor", "synctex", "pdf", "ssh", "tailscale", "research", "paper", "remote"]
15
+ classifiers = [
16
+ "Development Status :: 4 - Beta",
17
+ "Environment :: Web Environment",
18
+ "Intended Audience :: Science/Research",
19
+ "Operating System :: MacOS",
20
+ "Operating System :: POSIX :: Linux",
21
+ "Programming Language :: Python :: 3",
22
+ "Programming Language :: Python :: 3 :: Only",
23
+ "Topic :: Text Editors",
24
+ "Topic :: Text Processing :: Markup :: LaTeX",
25
+ ]
26
+ dependencies = []
27
+
28
+ [project.urls]
29
+ Homepage = "https://github.com/xjtuwxg/texfleet"
30
+ Documentation = "https://github.com/xjtuwxg/texfleet#readme"
31
+ Issues = "https://github.com/xjtuwxg/texfleet/issues"
32
+ Changelog = "https://github.com/xjtuwxg/texfleet/releases"
33
+
34
+ [project.scripts]
35
+ texfleet = "texfleet.cli:main"
36
+
37
+ [tool.hatch.version]
38
+ path = "texfleet/__init__.py"
39
+
40
+ [tool.hatch.build.targets.wheel]
41
+ packages = ["texfleet"]
42
+
43
+ [tool.hatch.build.targets.sdist]
44
+ include = ["texfleet", "tests", "scripts", "docs", "README.md", "LICENSE", "Makefile"]
45
+ exclude = ["docs/images"]