Files
mytoolkit/README.md
T
Zhengshou Lai f45b46073a feat(scaffold): redesign paper scaffold + clarify doc responsibilities
Scaffold (mytoolkit init paper):
- default to portable Elsevier elsarticle [review,3p,11pt] (was ctexart/Fandol)
- TeX Live Libertinus fonts (serif+math+mono), no system-font dependency
- xelatex one-engine via latexmk; figure/abstract/keyword frontmatter
- PDF bookmarks expand to two levels (bookmarksopenlevel=2)
- fix diffpreamble.dtx: define \DIFadd/\DIFdel (latexdiff highlighted now compiles)

Docs responsibility split:
- CLAUDE.md owns design decisions/constraints; exact scaffold specs live only
  in the generated main.tex header (self-documenting, no drift)
- README/SKILL point to those; README command table gains `voice`
- reconcile source-of-truth wording across CLAUDE.md / README / SKILL
2026-06-29 00:47:48 +08:00

136 lines
4.8 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# mytoolkit
Personal CLI toolkit — unified entry point for everyday file conversion, format wrangling, and project chores.
## Install
```bash
make install # install CLI + sync bundled Claude skill
mytoolkit --version
mytoolkit templates list # verify bundled templates are found
```
`make install` 会同时:
1. 用 editable 模式安装 `mytoolkit`
2. 生成 zsh/bash 补全;
3. 把 bundled Claude skill 同步到 `~/.claude/skills/mytoolkit/`
单独同步 skill(不重装 Python 包):
```bash
make sync-skill
```
## Update
The installed Python package and the bundled Claude skill are **not** refreshed automatically when the source tree changes. After editing source files, skill docs, or after `git pull` / `git submodule update`, rerun:
```bash
make install # or: mytoolkit update
mytoolkit --version # verify the new version is active
```
If you only changed skill files (`SKILL.md` / `references/`), `make sync-skill` is enough.
## Top-level commands
```bash
mytoolkit --help
```
| Command | What it does |
|---------|--------------|
| `convert` | Universal format conversion (md/img/pdf/eps/avi/bib → pdf/docx/tiff/mp4/md). Auto-detects from extensions. |
| `init` | Initialize projects/kits from bundled templates (`mytoolkit init paper <dir>`, `mytoolkit init journal <name>`) |
| `info` | Show bundled resource paths (`info paths`, `info docs <name>`) |
| `pdf` | `compress` / `crop` / `merge` / `bookmark` / `to-tiff` |
| `image` | `compress` / `eps-fix` / `eps-to-pdf` / `jpg-to-pdf` / `tiff-to-pdf` / `tiff-compress` / `generate` (Doubao/Seedream) |
| `latex` | `compile` / `count` |
| `bib` | `to-markdown` / `cv-update` |
| `video` | `avi-to-mp4` |
| `voice` | Text-to-speech via Volcengine/Doubao (`voice tts`, mp3/wav/pcm) |
| `webpage` | Docusaurus build/list/rebuild/push |
| `mail` | IMAP/SMTP client (read/draft/forward/reply, no auto-send) |
| `templates` | Inspect template root; external override still possible |
| `env` | Manage stored vars (api keys, paths, feishu app credentials) |
| `ssh` | `list` / `connect` / `tunnel` / `cmd` |
| `git` | `proxy` (set/unset/list/status) |
| `server` | Manage dev/serve servers |
| `update` | Reinstall from local repo |
| `uninstall` | Uninstall |
For any subcommand: `mytoolkit <cmd> --help`.
## Templates
`mytoolkit convert -t <name>` reads templates bundled with the package by default. External overrides are still supported via `mytoolkit templates register`.
Bundled layout:
```
mytoolkit/templates/md-to-pdf/<name>/template.typ
mytoolkit/templates/md-to-docx/<name>/template.docx
```
```bash
mytoolkit templates list # lists bundled templates with absolute paths
mytoolkit templates register /path/to/templates # optional external override
```
Registry is stored at `~/.mytoolkit/templates.json` (or `$MYTOOLKIT_HOME/templates.json`). When the registry is missing or invalid, mytoolkit falls back to the bundled templates.
## Project scaffolds
```bash
mytoolkit init paper <dir> # create a LaTeX paper project (Elsevier elsarticle, xelatex, fully portable)
```
This generates `main.tex`, `Makefile`, `references.bib`, `diffpreamble.dtx`, `figs/`, `analysis/`.
### Journal submission kits
```bash
mytoolkit init journal # list available kits
mytoolkit init journal elsevier # -> ./submit-elsevier/
mytoolkit init journal ieee mydir # custom target dir
```
Kits (`elsevier` / `ieee` / `springer`) are self-contained — `main.tex`, a
pdflatex+bibtex `Makefile`, and any non-bundled class files (Springer's
`sn-jnl.cls` + `bst/`). Each compiles standalone with `make`, and reuses the
current directory's `references.bib` if present.
## User config
All user-level config lives under `~/.mytoolkit/` (override with `$MYTOOLKIT_HOME`):
| File | Owner | Purpose |
|------|-------|---------|
| `env.json` | `mytoolkit env` | API keys, paths, feishu credentials (flat key/value) |
| `mail.json` | `mytoolkit mail` | IMAP/SMTP server settings |
| `templates.json` | `mytoolkit templates` | Pointer to external template root |
Manage env vars via the CLI — no need to hand-edit:
```bash
mytoolkit env list # show all (Storage path printed at top, secrets masked)
mytoolkit env get apikey_ark # read one
mytoolkit env set apikey_ark <value> # write one
mytoolkit env set apikey_ark --secret # prompt for value, hidden input
mytoolkit env remove apikey_ark # delete one
mytoolkit env export # print MYCLI_FOO=... export statements
eval "$(mytoolkit env export)" # load into current shell
```
Legacy `bin/config.json` (in the source dir) is auto-migrated to `~/.mytoolkit/env.json` on first run after upgrade.
## Uninstall
```bash
mytoolkit uninstall
# or
make uninstall
```
User config under `~/.mytoolkit/` is left in place.