Files
mytoolkit/README.md
T
Zhengshou Lai 9174708d10 feat(init): add LaTeX manual scaffold and 'init manual' command
- scaffolds/manual/: ctexart+xelatex manual template (cover, TOC, colored
  headings, four callout boxes, listings code, booktabs three-line tables),
  visually aligned with Typst md-to-pdf/manual template
- commands/init.py: extract _init_scaffold() shared by paper/manual
- sync README/AGENTS/skill references; document templates-vs-scaffolds-vs-journals taxonomy
2026-07-18 09:44:17 +08:00

147 lines
5.6 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 agent skill
mytoolkit --version
mytoolkit templates list # verify bundled templates are found
```
`make install` 会同时:
1. 用 editable 模式安装 `mytoolkit`
2. 自动安装 zsh/bash 补全到当前 Python prefix 的共享目录;
3. 把 bundled agent skill 同步到 `~/.agents/skills/mytoolkit/`
补全由 `mytoolkit` 自己管理,无需手动写 `~/.local/bin/completions`,也无需在 `.zshrc``eval`。首次运行任意 `mytoolkit` 命令时会自动补齐;也可以手动检查状态:
```bash
mytoolkit completion doctor
mytoolkit completion install # 手动重装补全
mytoolkit completion zsh # 打印 zsh 补全脚本
```
单独同步 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|manual <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 |
| `completion` | Install/inspect shell tab-completion scripts (`install` / `uninstall` / `doctor` / `zsh` / `bash`) |
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)
mytoolkit init manual <dir> # create a LaTeX manual project (technical/user docs, same style as md-to-pdf/manual)
```
`init paper` generates `main.tex`, `Makefile`, `references.bib`, `diffpreamble.dtx`, `figs/`.
`init manual` generates `main.tex` (cover + TOC + callout boxes + code listing + three-line tables), `Makefile`, `README.md`.
### 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 |
|------|-------|---------|
| `config.json` | `mytoolkit env` | API keys, paths, feishu credentials (keys.* namespace) |
| `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 `~/.mytoolkit/env.json` is auto-migrated into `~/.mytoolkit/config.json` (keys.* format) on first load after upgrade.
## Uninstall
```bash
mytoolkit uninstall
# or
make uninstall
```
User config under `~/.mytoolkit/` is left in place.