terrylica/cc-skills

terminal-print

Print iTerm2 terminal output to network printer.

Zobacz źródło

Jak używać

  1. Skopiuj polecenie instalacji i sprawdź źródła przed instalacją we własnym środowisku agenta.
  2. W oryginale sprawdź wymagane narzędzia, dane dostępowe i obsługiwane środowiska.
  3. Opisz dane wejściowe i oczekiwany rezultat; porównaj wynik ze źródłami.
npx skills add https://github.com/terrylica/cc-skills --skill terminal-print

Przed rozpoczęciem

  • Instalacja nie obejmuje subskrypcji modelu, limitu API ani uprawnień do plików.
  • Gwiazdki i instalacje pokazują aktywność, a nie niezależny test jakości lub bezpieczeństwa.
Oryginalny dokument Skill

Treść z repozytorium z zachowaniem nagłówków, przykładów, kodu, tabel, linków i obrazów.

Terminal Print

Print terminal output from iTerm2 to your HP network printer with a single command.

Self-Evolving Skill: This skill improves through use. If instructions are wrong, parameters drifted, or a workaround was needed — fix this file immediately, don't defer. Only update for real, reproducible issues.

When to Use This Skill

Use this skill when:

  • Printing terminal output to a network printer
  • Creating PDF copies of command-line session output
  • Archiving terminal logs in print-friendly format
  • Sharing terminal output in meetings or documentation

Quick Start

  1. Copy terminal output in iTerm2 (Cmd+C)
  2. Invoke this skill
  3. Review PDF preview, press Enter to print

How It Works

Clipboard → Strip ANSI → Markdown code block → pandoc/xelatex → PDF → Preview → Print
  • ANSI codes stripped: Colors and escape sequences removed for clean B&W output
  • Monospace font: DejaVu Sans Mono for proper character alignment
  • Landscape orientation: Fits ~120 characters per line
  • US Letter paper: Auto-detected from printer settings

Execution

bash
/usr/bin/env bash << 'PRINT_EOF'
SKILL_DIR="$(cc-plugin-root doc-tools)/skills/terminal-print"
bash "$SKILL_DIR/assets/print-terminal.sh"
PRINT_EOF

Options

Run with arguments by modifying the execution block:

bash
/usr/bin/env bash << 'PRINT_EOF'
SKILL_DIR="$(cc-plugin-root doc-tools)/skills/terminal-print"
bash "$SKILL_DIR/assets/print-terminal.sh" --no-preview
PRINT_EOF
FlagDescription
--file FILERead from file instead of clipboard
--no-previewSkip PDF preview, print directly
--no-printGenerate PDF only, don't send to printer
--printer NAMEOverride target printer queue (default: system default)
--bypass-airprintUse socket-9100 + PostScript queue. Workaround for HP LaserJet Pro MFP 3101/3108/3201/3208/3301/3308 AirPrint blank pages.
-h, --helpShow help message

Examples

Print from clipboard (default)

bash
# Copy terminal output in iTerm2, then:
/usr/bin/env bash << 'EOF'
bash "$(cc-plugin-root doc-tools)/skills/terminal-print/assets/print-terminal.sh"
EOF

Print from file

bash
/usr/bin/env bash << 'EOF'
bash "$(cc-plugin-root doc-tools)/skills/terminal-print/assets/print-terminal.sh" --file ~/session.log
EOF

Generate PDF only (no print)

bash
/usr/bin/env bash << 'EOF'
bash "$(cc-plugin-root doc-tools)/skills/terminal-print/assets/print-terminal.sh" --no-print
EOF

Prerequisites

All dependencies are already available on macOS with MacTeX:

ToolPurposeStatus
pandocMarkdown to PDFRequired
xelatexPDF engineRequired (MacTeX)
pbpasteClipboard accessBuilt-in
lprCUPS printingBuilt-in

Output

  • PDF location: /tmp/terminal-output-YYYYMMDD_HHMMSS.pdf
  • Markdown source: /tmp/terminal-YYYYMMDD_HHMMSS.md
  • Cleanup: macOS automatically cleans /tmp periodically

Troubleshooting

"No text in clipboard"

Copy terminal output first using Cmd+C in iTerm2.

"Missing pandoc" or "Missing xelatex"

Install MacTeX: brew install --cask mactex

Printer not found

Check printer status: lpstat -p -d

The script auto-detects the system default printer. Override with --printer NAME or set TERMINAL_PRINT_PRINTER in the environment.

Blank page came out (or lpr reported success but nothing printed)

Strong fingerprint of the HP LaserJet Pro MFP 3101/3108/3201/3208/3301/3308 AirPrint blank-page bug — the printer's IPP-Everywhere PDF interpreter silently drops jobs while CUPS reports completed. Confirmed with this exact symptom on 2026-05-09.

Quick fix:

bash
# 1. One-time setup of bypass queue (socket-9100 + Generic PostScript PPD)
"$(cc-plugin-root doc-tools)/skills/terminal-print/assets/setup-socket-9100-queue.sh"

# 2. Reprint with --bypass-airprint
bash "$(cc-plugin-root doc-tools)/skills/terminal-print/assets/print-terminal.sh" --bypass-airprint

Full diagnostic playbook with command sequences and decision tree: see airprint-blank-page-troubleshooting.md.

Key takeaway: do not trust lpstat -o or job-state=completed — query the printer's own job ledger via ipptool -tv ipp://<printer>.local.:631/ipp/print for job-impressions-completed and job-media-sheets-completed. CUPS lies; the printer (mostly) tells the truth.

Related Skills

Post-Execution Reflection

After this skill completes, check before closing:

  1. Did the command succeed? — If not, fix the instruction or error table that caused the failure.
  2. Did parameters or output change? — If the underlying tool's interface drifted, update Usage examples and Parameters table to match.
  3. Was a workaround needed? — If you had to improvise (different flags, extra steps), update this SKILL.md so the next invocation doesn't need the same workaround.

Only update if the issue is real and reproducible — not speculative.

z tego samego repozytorium

Więcej Skills

Wszystkie Skills
terrylica
Społeczność

academic-pdf-to-gfm

Convert academic PDF papers to GitHub-renderable GFM markdown with math equations. TRIGGERS - PDF, GitHub markdown, math

Instalacje / 1h
1
GitHub Stars
2
Aktualizacja
5 lis
terrylica
Społeczność

adr-code-traceability

Add ADR references to code for traceability. TRIGGERS - ADR traceability, code reference, document decision in code.

Instalacje / 1h
1
GitHub Stars
2
Aktualizacja
5 lis
terrylica
Społeczność

arxiv-source-first-paper-ingest

Read an arXiv paper faithfully by fetching the authors' own LaTeX source instead of OCR-ing the PDF. Extracts every display equation with its label, environment and enclosing proposition, renders each to MathML, and proves usability by compiling each formula with a real TeX engine. Use when you need a paper's formulas exactly — to replicate a method, implement a loss function or custom objective, verify a quoted number, or check a claim against what the authors actually wrote. TRIGGERS - read th

Instalacje / 1h
1
GitHub Stars
2
Aktualizacja
5 lis
terrylica
Społeczność

azure-provision

Bootstrap Azure automation when interactive az login is blocked by a Conditional Access policy (error 530035, "Device state: Unregistered"). Mints a service principal through the Azure Portal session ONCE — using Microsoft Graph over a captured token, not DOM clicking — then provisions resource groups, Cognitive Services / AI Language / Speech resources and their keys entirely via az/REST, writing key AND endpoint together into the SCS vault. Use when az login fails but the portal works, when mo

Instalacje / 1h
1
GitHub Stars
2
Aktualizacja
5 lis