Turn any technical book PDF into a Claude Code skill — ready to study, reference, and use while you work.
Python agent-skillsai-agentsbook-to-skillcontext-engineeringdocument-processingedtechknowledge-baseknowledge-managementllmpdf-to-markdownragself-studystudy-tools
feat(cli): replace the ASCII banner with two quiet lines, and fund the project at the end (#153)
Virgilio Junior2fe9d8b20f41
diff --git a/book_to_skill/utils.py b/book_to_skill/utils.pyindex 34bf649..cd6e6a2 100644--- a/book_to_skill/utils.py+++ b/book_to_skill/utils.py@@ -812,14 +812,37 @@ def prepare_output_dir(path: Path) -> None:path.mkdir(parents=True, mode=0o700)-def print_banner() -> None:- """Print the attribution banner. Done here (not only in SKILL.md) so it- shows on every run regardless of how the agent invokes extraction."""- banner = Path(__file__).resolve().parent.parent / "scripts" / "banner.txt"- try:- sys.stderr.write(banner.read_text(encoding="utf-8") + "\n")- except Exception:- pass # best-effort: never block extraction on the banner+def print_intro() -> None:+ """Two lines of attribution at the start of every run.++ Printed here rather than only in SKILL.md so it shows however the agent+ invokes extraction. States who maintains the project without asking for+ anything — the ask belongs at the end, after the work is delivered.+ """+ sys.stderr.write(+ "book-to-skill · turns a document into a structured agent skill\n"+ "free and MIT-licensed · maintained in personal time · "+ "github.com/virgiliojr94/book-to-skill\n\n"+ )+++def print_support_note() -> None:+ """One closing line about funding, printed only after a successful run.++ Deliberately at the end and deliberately conditional: the reader has just+ received something that worked, and the sentence says what the money is+ for rather than asking for it. Never printed when extraction failed —+ nobody should be asked to fund what just wasted their time.++ Written to stdout, with the rest of the closing report: stderr is+ unbuffered and stdout is not when the run is piped (which is how an agent+ captures it), so mixing the two puts the closing line at the top.+ """+ print(+ "\n book-to-skill is free, and maintained in personal time."+ "\n If it saves you work, you can fund its upkeep: "+ "github.com/sponsors/virgiliojr94"+ )def print_usage() -> None:@@ -837,7 +860,7 @@ def print_usage() -> None:def main():- print_banner()+ print_intro()if any(arg in {"-h", "--help"} for arg in sys.argv[1:]):print_usage()@@ -994,3 +1017,5 @@ def main():print(f"\n WARNING: {len(errors)} source(s) skipped due to errors:")for path, err in errors:print(f" - {path.name}: {err}")+ else:+ print_support_note()diff --git a/scripts/banner.txt b/scripts/banner.txtdeleted file mode 100644index 507f14d..0000000--- a/scripts/banner.txt+++ /dev/null@@ -1,26 +0,0 @@--⠀⠀⠀⠀⠀⠀⠀⠀⢀⣀⣤⣴⣶⣶⣶⣶⣆⢰⣦⣤⣀⡀⠀⠀⠀⠀⠀⠀⠀⠀-⠀⠀⠀⠀⠀⢀⣠⣶⣿⣿⣿⣿⣿⡿⢿⣿⣿⠀⣿⣿⣿⣿⣶⣄⡀⠀⠀⠀⠀⠀-⠀⠀⠀⢀⣴⣿⣿⣿⣿⣿⣿⣿⠃⠀⣿⠿⠛⠀⠻⢿⣿⣿⣿⣿⣿⣦⠀⠀⠀⠀-⠀⠀⢠⣾⣿⣿⣿⣿⣿⣿⣿⡟⠀⠀⠃⠀⠀⠀⢠⣾⣿⣿⣿⣿⣿⣿⣷⡄⠀⠀-⠀⢠⣿⣿⣿⣿⣿⣿⣿⡟⠁⠀⠀⠀⠀⠀⠀⠀⢛⣿⣿⣿⣿⣿⣿⣿⣿⣿⡄⠀-⠀⣾⣿⣿⣿⣿⣿⠿⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⢹⣿⣿⣿⣿⣿⣿⣿⣿⣷⠀-⢸⣿⣿⣿⣿⣛⡉⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⡆⢠⡈⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇-⢸⣿⣿⣿⣿⣟⣉⣁⠀⠀⠀⠀⠀⠀⠀⠀⣻⡇⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇-⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠇⠀⠀⣠⣴⣿⣿⠈⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇-⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⠀⠀⠀⠀⠙⣿⣿⠀⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠇-⠀⢿⣿⣿⣿⣿⣿⣿⣿⣿⣷⡀⠀⠀⠀⠀⠈⠁⠀⢨⣿⣿⣿⣿⣿⣿⣿⣿⡿⠀-⠀⠈⢿⣿⣿⣿⣿⣿⠿⢿⣿⡇⠀⠀⠀⠀⠀⣤⠀⢸⣿⣿⣿⣿⣿⣿⣿⡿⠁⠀-⠀⠀⠈⢿⣿⣿⣿⠁⣴⣾⡿⠁⠀⠀⠀⠀⠀⠘⡇⢸⣿⣿⣿⣿⣿⣿⡟⠁⠀⠀-⠀⠀⠀⠀⠙⢿⣿⡀⠿⣿⡧⠀⠀⠀⠀⠀⠀⢠⡄⢸⣿⣿⣿⣿⡿⠋⠀⠀⠀⠀-⠀⠀⠀⠀⠀⠀⠙⠻⢶⣤⣤⣾⠀⠀⠀⠀⢠⣼⡇⢸⣿⡿⠟⠋⠀⠀⠀⠀⠀⠀-⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠙⠃⠀⠀⠀⠠⠿⠟⠃⠈⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀-- ██╗ ██╗██╗██████╗ ██████╗ ██╗██╗ ██╗ ██████╗ ██╗██████╗ █████╗ ██╗ ██╗- ██║ ██║██║██╔══██╗██╔════╝ ██║██║ ██║██╔═══██╗ ██║██╔══██╗██╔══██╗██║ ██║- ██║ ██║██║██████╔╝██║ ███╗██║██║ ██║██║ ██║ ██║██████╔╝╚██████║███████║- ╚██╗ ██╔╝██║██╔══██╗██║ ██║██║██║ ██║██║ ██║██ ██║██╔══██╗ ╚═══██║╚════██║- ╚████╔╝ ██║██║ ██║╚██████╔╝██║███████╗██║╚██████╔╝╚█████╔╝██║ ██║ █████╔╝ ██║- ╚═══╝ ╚═╝╚═╝ ╚═╝ ╚═════╝ ╚═╝╚══════╝╚═╝ ╚═════╝ ╚════╝ ╚═╝ ╚═╝ ╚════╝ ╚═╝-- book-to-skill · github.com/virgiliojr94/book-to-skilldiff --git a/scripts/extract.py b/scripts/extract.pyindex ca6d75e..74587bf 100644--- a/scripts/extract.py+++ b/scripts/extract.py@@ -7,8 +7,8 @@ Backward-compatible entrypoint wrapper.import osimport sys-# Force UTF-8 stdout/stderr so the attribution banner (braille art) and the-# dependency-check glyphs (✓ / ✗) don't raise UnicodeEncodeError on Windows+# Force UTF-8 stdout/stderr so extracted text, the attribution line's separators+# and the dependency-check glyphs (✓ / ✗) don't raise UnicodeEncodeError on Windows# consoles that default to a legacy code page (e.g. GBK / cp936).for _stream in (sys.stdout, sys.stderr):try:diff --git a/tests/test_intro_and_support_note.py b/tests/test_intro_and_support_note.pynew file mode 100644index 0000000..4dca702--- /dev/null+++ b/tests/test_intro_and_support_note.py@@ -0,0 +1,55 @@+"""Two quiet messages: attribution at the start, funding at the end.++The ask sits at the end on purpose — the reader has just received something+that worked — and only when the run succeeded. Asking someone to fund a tool+that just failed on their document is the fastest way to make the line+invisible.+"""++import sys+from pathlib import Path++ROOT_DIR = Path(__file__).resolve().parent.parent+sys.path.insert(0, str(ROOT_DIR))++from book_to_skill import utils+++class TestIntro:+ def test_names_the_project_and_the_licence(self, capsys):+ utils.print_intro()++ err = capsys.readouterr().err+ assert "book-to-skill" in err+ assert "MIT-licensed" in err++ def test_does_not_ask_for_money(self, capsys):+ """The start of a run has delivered nothing yet."""+ utils.print_intro()++ err = capsys.readouterr().err+ assert "sponsors" not in err.lower()+++class TestSupportNote:+ def test_points_at_the_sponsors_page(self, capsys):+ utils.print_support_note()++ out = capsys.readouterr().out+ assert "github.com/sponsors/virgiliojr94" in out++ def test_goes_to_stdout_with_the_rest_of_the_report(self, capsys):+ """stderr is unbuffered and stdout is not when piped — mixing the two+ puts the closing line at the top of the run."""+ utils.print_support_note()++ captured = capsys.readouterr()+ assert captured.out.strip()+ assert captured.err == ""++ def test_stays_short(self, capsys):+ """Two lines. A wall of text here reads as a donation banner."""+ utils.print_support_note()++ lines = [ln for ln in capsys.readouterr().out.splitlines() if ln.strip()]+ assert len(lines) <= 2