Improve first-run and channel setup for non-technical users: detect newer Gemini key formats, pin Node 22.22.3, add Control Panel Telegram approve flow, and keep channels/models when config is rewritten. Persist uclaw wizard state via uclaw-meta.json so restarts skip language/persona prompts. Co-authored-by: Cursor <cursoragent@cursor.com>
1.9 KiB
1.9 KiB
name, description, metadata
| name | description | metadata | ||||
|---|---|---|---|---|---|---|
| pdf-toolkit | PDF toolkit - merge, split, extract text, convert to images. Runs locally. |
|
PDF Toolkit
Common operations on local PDF files: merge, split, extract text, convert. Prefers
tools already on the system, otherwise uses Python's pypdf (lightweight, pure
Python, installed on first use with pip install pypdf).
Everything runs on this machine. Nothing is uploaded.
What it does
- Merge: combine several PDFs into one
- Split: break into pages, or pull out a page range
- Extract text: export contents as plain text for summarising or searching
- Inspect: page count and document metadata
How to run it
Use the Bash tool. These examples use pypdf — cross-platform, no Office or
Acrobat needed.
# Ensure the dependency (first run only)
python -c "import pypdf" 2>/dev/null || pip install -q pypdf
# Merge a.pdf and b.pdf into merged.pdf
python - <<'PY'
from pypdf import PdfWriter
w = PdfWriter()
for f in ["a.pdf", "b.pdf"]:
w.append(f)
w.write("merged.pdf"); w.close()
print("merged -> merged.pdf")
PY
# Extract all text
python - <<'PY'
from pypdf import PdfReader
r = PdfReader("input.pdf")
print("\n".join((p.extract_text() or "") for p in r.pages))
PY
# Pull out pages 1-3 into sub.pdf
python - <<'PY'
from pypdf import PdfReader, PdfWriter
r = PdfReader("input.pdf"); w = PdfWriter()
for i in range(0, 3):
w.add_page(r.pages[i])
w.write("sub.pdf"); w.close()
print("extracted pages 1-3 -> sub.pdf")
PY
Working notes
- Check the file exists first with
ls, and get the page count withpython -c "from pypdf import PdfReader; print(len(PdfReader('x.pdf').pages))" - Scanned PDFs are images — text extraction returning nothing is expected. Tell the user it needs OCR rather than reporting an empty result as success.
- Write output next to the source file, and tell the user the filename you created.