bindery-cli 0.58.0__tar.gz → 0.59.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. {bindery_cli-0.58.0 → bindery_cli-0.59.0}/AGENTS.md +23 -4
  2. {bindery_cli-0.58.0 → bindery_cli-0.59.0}/PKG-INFO +1 -1
  3. {bindery_cli-0.58.0 → bindery_cli-0.59.0}/patchnotes.md +49 -0
  4. {bindery_cli-0.58.0 → bindery_cli-0.59.0}/pyproject.toml +1 -1
  5. {bindery_cli-0.58.0 → bindery_cli-0.59.0}/roadmap.md +1 -0
  6. {bindery_cli-0.58.0 → bindery_cli-0.59.0}/spec.md +29 -4
  7. {bindery_cli-0.58.0 → bindery_cli-0.59.0}/src/bindery/__init__.py +1 -1
  8. {bindery_cli-0.58.0 → bindery_cli-0.59.0}/src/bindery/cli.py +17 -0
  9. {bindery_cli-0.58.0 → bindery_cli-0.59.0}/src/bindery/epub.py +211 -0
  10. {bindery_cli-0.58.0 → bindery_cli-0.59.0}/tests/test_epub.py +254 -0
  11. {bindery_cli-0.58.0 → bindery_cli-0.59.0}/tests/test_flags_real_core.py +29 -0
  12. {bindery_cli-0.58.0 → bindery_cli-0.59.0}/tests/test_flags_wiring.py +1 -0
  13. {bindery_cli-0.58.0 → bindery_cli-0.59.0}/uv.lock +1 -1
  14. {bindery_cli-0.58.0 → bindery_cli-0.59.0}/.github/FUNDING.yml +0 -0
  15. {bindery_cli-0.58.0 → bindery_cli-0.59.0}/.github/workflows/ci.yml +0 -0
  16. {bindery_cli-0.58.0 → bindery_cli-0.59.0}/.github/workflows/publish.yml +0 -0
  17. {bindery_cli-0.58.0 → bindery_cli-0.59.0}/.gitignore +0 -0
  18. {bindery_cli-0.58.0 → bindery_cli-0.59.0}/LICENSE +0 -0
  19. {bindery_cli-0.58.0 → bindery_cli-0.59.0}/OBSERVE-RESEARCH.md +0 -0
  20. {bindery_cli-0.58.0 → bindery_cli-0.59.0}/README.md +0 -0
  21. {bindery_cli-0.58.0 → bindery_cli-0.59.0}/docs/screenshots/library-sweep.png +0 -0
  22. {bindery_cli-0.58.0 → bindery_cli-0.59.0}/logo.svg +0 -0
  23. {bindery_cli-0.58.0 → bindery_cli-0.59.0}/plugin/__init__.py +0 -0
  24. {bindery_cli-0.58.0 → bindery_cli-0.59.0}/project.done +0 -0
  25. {bindery_cli-0.58.0 → bindery_cli-0.59.0}/run_tests.sh +0 -0
  26. {bindery_cli-0.58.0 → bindery_cli-0.59.0}/scripts/FastSweep.java +0 -0
  27. {bindery_cli-0.58.0 → bindery_cli-0.59.0}/scripts/build_plugin.py +0 -0
  28. {bindery_cli-0.58.0 → bindery_cli-0.59.0}/scripts/fast_sweep.py +0 -0
  29. {bindery_cli-0.58.0 → bindery_cli-0.59.0}/src/bindery/__main__.py +0 -0
  30. {bindery_cli-0.58.0 → bindery_cli-0.59.0}/src/bindery/audit.py +0 -0
  31. {bindery_cli-0.58.0 → bindery_cli-0.59.0}/src/bindery/library.py +0 -0
  32. {bindery_cli-0.58.0 → bindery_cli-0.59.0}/src/bindery/observe.py +0 -0
  33. {bindery_cli-0.58.0 → bindery_cli-0.59.0}/src/bindery/pagination.py +0 -0
  34. {bindery_cli-0.58.0 → bindery_cli-0.59.0}/src/bindery/reserialize.py +0 -0
  35. {bindery_cli-0.58.0 → bindery_cli-0.59.0}/src/bindery/transforms.py +0 -0
  36. {bindery_cli-0.58.0 → bindery_cli-0.59.0}/src/bindery/validate.py +0 -0
  37. {bindery_cli-0.58.0 → bindery_cli-0.59.0}/src/bindery/watermark.py +0 -0
  38. {bindery_cli-0.58.0 → bindery_cli-0.59.0}/tests/test_audit.py +0 -0
  39. {bindery_cli-0.58.0 → bindery_cli-0.59.0}/tests/test_cli.py +0 -0
  40. {bindery_cli-0.58.0 → bindery_cli-0.59.0}/tests/test_comment_hyphens.py +0 -0
  41. {bindery_cli-0.58.0 → bindery_cli-0.59.0}/tests/test_contamination.py +0 -0
  42. {bindery_cli-0.58.0 → bindery_cli-0.59.0}/tests/test_cover_tocdrift.py +0 -0
  43. {bindery_cli-0.58.0 → bindery_cli-0.59.0}/tests/test_help.py +0 -0
  44. {bindery_cli-0.58.0 → bindery_cli-0.59.0}/tests/test_library.py +0 -0
  45. {bindery_cli-0.58.0 → bindery_cli-0.59.0}/tests/test_matcher_hardening.py +0 -0
  46. {bindery_cli-0.58.0 → bindery_cli-0.59.0}/tests/test_observe.py +0 -0
  47. {bindery_cli-0.58.0 → bindery_cli-0.59.0}/tests/test_pagination.py +0 -0
  48. {bindery_cli-0.58.0 → bindery_cli-0.59.0}/tests/test_plugin.py +0 -0
  49. {bindery_cli-0.58.0 → bindery_cli-0.59.0}/tests/test_reserialize.py +0 -0
  50. {bindery_cli-0.58.0 → bindery_cli-0.59.0}/tests/test_space_renames.py +0 -0
  51. {bindery_cli-0.58.0 → bindery_cli-0.59.0}/tests/test_spine_guard.py +0 -0
  52. {bindery_cli-0.58.0 → bindery_cli-0.59.0}/tests/test_transforms.py +0 -0
  53. {bindery_cli-0.58.0 → bindery_cli-0.59.0}/tests/test_validate.py +0 -0
  54. {bindery_cli-0.58.0 → bindery_cli-0.59.0}/tests/test_version.py +0 -0
  55. {bindery_cli-0.58.0 → bindery_cli-0.59.0}/tests/test_watermark.py +0 -0
  56. {bindery_cli-0.58.0 → bindery_cli-0.59.0}/tests/test_xml_hardening.py +0 -0
@@ -30,13 +30,13 @@ Born from the 2026 library audit (see the user memory `calibre-library-epubcheck
30
30
  `xmlns`, bare `&`, named entities, void self-closing), the NCX pipeline, and the
31
31
  mimetype fix (added/normalized/first-stored, epub.py's archive rewrite); every core
32
32
  fix must render identically to the author's intent: never add, remove, or reorder
33
- visible content. The canonical opt-in inventory lives in spec.md: twenty-five structural
33
+ visible content. The canonical opt-in inventory lives in spec.md: twenty-six structural
34
34
  repairs, four lossy strips, four safe opt-ins, plus `--reserialize`.
35
35
  * **Structural repairs** (`--fix-empty-body`, `--fix-missing-title`, `--fix-id-colons`,
36
36
  `--fix-page-map`, `--strip-epub3-attrs`, `--downgrade-epub3-tags`,
37
37
  `--unwrap-block-in-inline`, `--strip-invalid-value`, `--unwrap-illegal-tags`,
38
38
  `--prune-missing-resources`, `--declare-missing-items`, `--strip-broken-anchors`,
39
- `--encode-url-spaces`,
39
+ `--prune-dangling-ncx-targets`, `--encode-url-spaces`,
40
40
  `--fix-container`, `--fix-media-types`, `--fix-cover`,
41
41
  `--fix-comment-double-hyphen`, `--fix-svg-dup-ids`, `--fix-duplicate-ids`,
42
42
  `--fix-cdata-terminator`,
@@ -129,6 +129,25 @@ Born from the 2026 library audit (see the user memory `calibre-library-epubcheck
129
129
  `--fix-media-types` (font/* blessed on both package versions, magic
130
130
  confirmed, `.eot` never touched) with the flag accepted under `no_worse`
131
131
  (its gain sits on the INFO axis).
132
+ The v0.59.0 one (issue #23, the dangling-NCX class): `--prune-dangling-ncx-targets`
133
+ removes navPoint/pageTarget/navTarget elements whose `<content src>` names a
134
+ document absent from the archive (RSC-007 at toc.ncx; the OPF never declared the
135
+ dropped file, so `--prune-missing-resources` has no item to prune and the navPoint
136
+ survived `--all` as "no applicable fixes"). Node-exact rule over a balanced
137
+ stack scanner (`strip_ncx_dangling_targets`, quote-aware possessive token regex,
138
+ navTarget legacy spelling included): a dead node whose whole subtree dies with it
139
+ drops as one span; a dead node above surviving descendants is SPLICED (tags plus
140
+ its own navLabel/dead `<content>` header go, children re-homed one level up --
141
+ dropping live navigation to repair a dead label is no repair); scheme URLs,
142
+ bare fragments, contentless nodes, and comment-hidden elements are never this
143
+ class; the token walk tracks the navMap/pageList containers too, so an
144
+ unbalanced walk (stray close, wrapper crossing a node's span) aborts AND a
145
+ prune that would empty a container refuses (the NCX wants navPoint+/pageTarget+;
146
+ an empty navMap is itself RSC-005 per epubcheck 5.3, so the gate would otherwise
147
+ apply a TOC-less NCX). When it fires, the
148
+ contract-gated playOrder pass re-runs in the same branch (the survivors' values
149
+ start gapped; the fixture went 0f/1e/0w -> 0f/0e/0w in one gate, one navPoint
150
+ pruned, 389 playOrder values re-sequenced); normal `gate`.
132
151
  They alter markup structure or fabricate minimal content. v0.14–v0.16 ran these unconditionally, which broke this rule;
133
152
  v0.17.0 restored it. `--unwrap-illegal-tags` additionally protects any illegal-tag
134
153
  name that an EPUB stylesheet styles as an element selector (`css_protected_tags`,
@@ -207,7 +226,7 @@ Born from the 2026 library audit (see the user memory `calibre-library-epubcheck
207
226
  - `src/bindery/watermark.py`: the opt-in lossy watermark strip (anchored and anchorless signature removal).
208
227
  - `src/bindery/reserialize.py`: structural repair via `html5lib`.
209
228
  - `src/bindery/audit.py`: read-only body-text audits (`content`, `pagenumbers`, `emptytext`, `ocr`, `monolithic` since v0.21.0 with `--max-doc-chars N`, and `completeness` since v0.36.0) behind the `audit` subcommand (v0.15.0). Since v0.18.0 library mode resolves EPUB paths through `cquarry.get_format_path()` and can apply a tag to flagged books via `cquarry.write.WritableCalibreDB` (only with explicit `--tag`; the only sanctioned write path). Since v0.19.0 `audit --id BOOK_ID` audits a single library book through cquarry's single-entity `get_book()` fetch (no library-wide cache; supports `--tag`; incompatible with the directory argument; comma lists since v0.23.0). Since v0.22.0 every archive entry is fully read (CRC + decompression) before analysis (a damaged entry reports its own CORRUPT verdict instead of feeding emptytext) and manifest/NCX references to absent files classify as `convention` (bloated ToC, consecutive span) or `fragment` (broken span). Hazard: the scan loop reuses `tag` as its per-book display column, so the `--tag` argument is captured as `audit_tag` at function entry; do not collapse them again. Since v0.29.0 `audit --json FILE` writes per-file analyzer verdicts in the `library --json` shape (directory, library, and single-book modes; with `--id`, exactly one id; emptytext omitted from a record when the archive verdict owns the body-text story). Since v0.44.0 two more advisory analyzers ride the single pass: `cover` (the EPUB3 `properties~="cover-image"` slice of the ruled hybrid: dangling EPUB2 meta, EPUB3 declaration, cover-file presence) and `tocdrift` (the NCX navMap vs EPUB3 nav toc structural diff, fragments included; audit-only, ToC synthesis out of charter permanently); the loader now exposes the parsed OPF, the NCX text, and the nav HTML on `Book`. Since v0.50.0 a ninth analyzer, `contamination` (issue #8, the judge-and-import class, advisory by contract like completeness/cover/tocdrift, never moves the exit code): foreign-title template stamps (head `<title>` repeats or a volume/book marker with named words in front of it, judged against the OPF's own title/creator/publisher/series with a marker-stripped comparison; a part label whose marker leads never flags), fan-bundle ad signatures (jnovels, kokoro connect, zerobooks, a light-novel plug), and review-paste fingerprints (strong flags alone, weak needs corroboration) in the first five content docs; its corpus is spine PLUS `Book.extra_docs` (the archive's non-spine html, retained by the loader in archive order under a 64 MiB cap, because a broken manifest can leave the junk entirely off the spine: Hothouse). Since v0.50.0 `run_directory`/`run_single` dispatch analyzers through `_dir_dispatch` (one entry per ALL key; the old if/elif chain's `else` ran ocr for cover/tocdrift in those modes since v0.44.0) and `tests/test_contamination.py` pins the map's key set to ALL. Since v0.36.0 the completeness analyzer (Phase 15) reports the phase-1 spot-check per book: spine/prose-doc counts (prose = >= 400 visible chars), first/middle/last prose-doc opening/closing excerpts, trailing-ToC classification (`_trailing_toc`: short link lines dominate, no paragraph-length blocks), and the unreadable fraction. It is ADVISORY by contract (problem always False; ADVISORY on a trailing ToC or unreadable fraction >= 10%), never moves the exit code, and is skipped like emptytext when the archive verdict owns the book. Since v0.38.0 the archive verdict distinguishes font obfuscation from DRM (`OBFUSCATION_ALGOS`: IDPF 2008/embedding + both Adobe URIs; readable obfuscated entries are the benign OBFUSCATED advisory, an unreadable one is CORRUPT, and only non-obfuscation algorithms give ENCRYPTED). Since v0.43.0 untrusted metadata XML is parsed through `_safe_xml_parse` (DOCTYPE/ENTITY declarations refused before xml.etree sees them; the stdlib shape of defusedxml's entity protection) and single entries above `_MAX_ENTRY_BYTES` (32 MB) are refused before decompression; a refused metadata file returns the shell book. Since v0.40.0 the vir-tui console renderer loads through the module-level `_LazyUI` proxy (a plain `import vir_tui as ui` at module level would make 3.12/3.13 installs unimportable now that the stack is marker-gated; LOAD_GLOBAL never consults module `__getattr__`, so a proxy object is the lazy shape that works).
210
- - `src/bindery/epub.py`: archive rewrite, NCX uid sync, RepairReport, mismatch detection, and the opt-in structural-repair plumbing (including the CSS precondition scan). Since v0.58.0 (issue #18) the copy loop hands every `zout.writestr` a PRIVATE ZipInfo (`copy.copy(item)`, a fresh one on a rename) and the media-type `peek` catches `zipfile.BadZipFile` too. HAZARD: `writestr` STAMPS the ZipInfo it is handed with the DESTINATION offsets (header_offset, sizes land on it for the central directory); sharing the source's info repointed zin's own name lookups into the output file mid-loop, and one drifted probe killed whole books as "unreadable" -- 56 books "Bad magic number for file header" plus the "possible zip bomb" Development as Freedom (the drifted offset landed on a valid header whose data overlaps its neighbor), all one root cause. Since v0.58.0 (issue #21) `strip_broken_guide_fragments` gives the OPF guide the NCX fragment-strip's document-precision fallback, and the NCX branch re-runs `fix_ncx_playorder` after the anchor pass fires (the pre-strip sequence goes stale when fragments collapse onto their document). Since v0.58.0 (issue #20) `_resolve_href` decodes the five predefined XML entities plus numeric
229
+ - `src/bindery/epub.py`: archive rewrite, NCX uid sync, RepairReport, mismatch detection, and the opt-in structural-repair plumbing (including the CSS precondition scan). Since v0.59.0 (issue #23) `strip_ncx_dangling_targets` is the NCX dangling-target prune (`--prune-dangling-ncx-targets`): a balanced stack scanner over navPoint/navTarget/pageTarget tokens (quote-aware possessive regex, `_NcxTargetNode` tree, iterative post-order survival pass; header_end delimits the node's own navLabel+`<content>` so a splice removes the tags AND the dead header while the children re-home; an unbalanced walk aborts the part unchanged) and the NCX branch re-runs `fix_ncx_playorder` when it fires, alongside the anchor pass's own re-run. Since v0.58.0 (issue #18) the copy loop hands every `zout.writestr` a PRIVATE ZipInfo (`copy.copy(item)`, a fresh one on a rename) and the media-type `peek` catches `zipfile.BadZipFile` too. HAZARD: `writestr` STAMPS the ZipInfo it is handed with the DESTINATION offsets (header_offset, sizes land on it for the central directory); sharing the source's info repointed zin's own name lookups into the output file mid-loop, and one drifted probe killed whole books as "unreadable" -- 56 books "Bad magic number for file header" plus the "possible zip bomb" Development as Freedom (the drifted offset landed on a valid header whose data overlaps its neighbor), all one root cause. Since v0.58.0 (issue #21) `strip_broken_guide_fragments` gives the OPF guide the NCX fragment-strip's document-precision fallback, and the NCX branch re-runs `fix_ncx_playorder` after the anchor pass fires (the pre-strip sequence goes stale when fragments collapse onto their document). Since v0.58.0 (issue #20) `_resolve_href` decodes the five predefined XML entities plus numeric
211
230
  character references before the fragment split (attribute text arrives
212
231
  escaped; entries are raw; decoding first keeps the `#` inside `&#38;`
213
232
  from cutting the target), `_ITEM_TAG_RE`/`_SPINE_ITEM_RE`/`_GUIDE_REF_RE`/prune_dangling_edges' matcher accept an optional ns prefix (`<opf:item>`), and the renamed-reference spellings percent-encode `[`/`]` (`_encode_ref_path`). Since v0.52.0 (issue #10): `spine_dangles(src)` walks itemref -> manifest item -> archive entry through `_resolve_href`+`_norm_path` (None on an unreadable package: the veto needs evidence, never fires on a probe failure), and `prune_missing_manifest_items` derives its spine protection from the text it prunes (no snapshot parameter: fix_manifest_ids renames ids ahead of it, and the existence set it checks against must be the layout its hrefs are written in — `present_src` when space renames are active, matching the content-doc prune). Since v0.46.0 the opt-in selection is the `RepairFlags` dataclass (one field per flag, all off by default; the all-off instance IS the default pass): `repair_epub(src, dst, flags)` and `process_book(..., flags)` take one object instead of a ~25-kwarg signature, the EPUB2-targeted fixes' version gate swaps in a `dataclasses.replace` copy (never mutating the caller's instance), and the plugin's bare `repair_epub(src, dst)` call constructs exactly the all-off default pass. Since v0.55.0 (issue #16) the RSC-008 half lives beside the prune: `collect_undeclared_resources` (one whole-book census: content img/link, inline `<style>` url(), stylesheet url(), OPF guide refs) + `declare_missing_manifest_items` (sorted `bindery-dN` items before `</manifest>`, `_DECLARE_MEDIA_TYPES` blessed extensions only), gated and threaded through `RepairFlags.declare_missing`. Since v0.38.0/v0.39.0 (Phase 16): `generate_container` + the `--fix-container` gateway (insert after mimetype when missing, replace in-loop when stale; constant-epoch timestamp keeps bytes deterministic), `prune_dangling_edges` (prune_missing_manifest_items returns the pruned ids and the edges that pointed at them (spine@toc, media-overlay, fallback, EPUB2 cover meta) are rewritten so pruning cannot manufacture the regression the gate rejects), and `fix_manifest_media_types` (extension map + magic-byte confirmation via a `peek` callable over the open source zip; jpg/png/gif only), and `fix_cover_meta` (the ruling's deterministic half: dangling EPUB2 cover meta re-pointed from the guide's cover reference when exactly one manifest item carries that file, removed otherwise; accepted under no_worse like the lossy strips because cover wiring is invisible to epubcheck).
@@ -217,7 +236,7 @@ Born from the 2026 library audit (see the user memory `calibre-library-epubcheck
217
236
  custom-rendered and colors itself with the CPython 3.14 argparse theme,
218
237
  gated by argparse's own _colorize detection so the levels always agree) and the repair-flag inventory is one table: `_REPAIR_FLAG_TABLE` (dest + one-line short help + long reference text) registers the compact grouped `--help` (argparse argument groups, hand-short usage line) and `--help-repairs` renders the long descriptions (a custom argparse Action, deliberately NOT store_true so the wiring test's selection count ignores it); adding a flag means adding a table row. Since v0.48.0 the metadata.db doors are enforced: `_require_closed_calibre` (pgrep fail-closed, exit 1) guards `audit --tag` and `library --apply --install-to-calibre` (run phase3 transitively), and `--help-json` (a custom argparse Action like --help-repairs, never colored) dumps the per-verb exit contract and the door list; since v0.48.1 the per-verb exit contracts tell the code's truth (repair: 0 probed/written incl. partial / 1 trouble, never 2; audit: 0/1/2 plus 3 for findings+write-failure; library and the run slices: the unified 0/2/1); since v0.49.0 the single-file verb's no-output form is a probe (the gate runs, the record's `output` is null and `applied` false, nothing is written anywhere; the old implicit `(repaired).epub` sibling was issue #7's import litter in a vetted tree, and writing now needs an explicit DST). `library --workers N` (v0.30.0) parallelizes only the sweep's candidate pass, in windows of N consumed in order so `--limit` stays lazy; the repair phase is never parallel (shared workdir, atomic-replacement contract). Since v0.40.0 `main()` guards the VirInvictus stack: a `ModuleNotFoundError` naming `vir_tui`/`cquarry` (marker-gated to 3.14+ on the 3.12 floor) becomes one stderr line and trouble exit 2 instead of a traceback; anything else missing still raises.
219
238
  - `plugin/__init__.py` + `scripts/build_plugin.py`: the Bindery Repair Calibre plugin (v0.37.0; identity `Bindery Repair` / `bindery_repair`, approved and built per the scoped spec in roadmap.md Phase 3). The builder vendors `transforms.py`, `epub.py`, `pagination.py`, `watermark.py`, `reserialize.py` byte-identically into the zip (the zip root is a package, so their relative imports resolve unchanged; the suite's drift test pins the equality) with the version tuple substituted from the single-source VERSION; `publish.yml` attaches `BinderyRepair-v<VERSION>.zip` to each release. The plugin runs ONLY the default pass (epubcheck cannot gate inside Calibre), never raises, is byte-idempotent (zero fixes returns the original path), testzip()-verifies its output, logs one line per book, and takes JSON config via `site_customization` (`log`, `log_path`, `max_size_mb` default 150, `max_log_mb` rotation cap default 2, `epubcheck_path` experimental validation default OFF). Load it in tests through the `tests/test_plugin.py` stubs: the calibre namespace is installed in sys.modules and the package loads with a two-dir `__path__` (plugin dir first, then src/bindery) exactly like calibre's zipplugin loader shape. **Plugin/interpreter compatibility (v0.40.0):** v0.39.0 shipped PEP 758 unparenthesized except tuples, and the plugin died with a bare SyntaxError on every released Calibre (7.x and the whole 8.x series embed Python 3.11, 9.0+ embeds 3.14; from calibre's bypy sources.json, checked against the upstream clone). The core is now grammar-pinned: parenthesized except tuples everywhere, `ruff`'s `target-version = "py312"` pin (inference from requires-python would rewrite the parens back off), `tests/test_version.py`'s parse guard, and CI's `plugin-compat` job byte-compiling the built zip under 3.11/3.12/3.13/3.14. `minimum_calibre_version` is (7, 0, 0): the oldest series whose interpreter CI covers, replacing the hollow (2, 0, 0); `supported_platforms` stays `["linux"]` (developed and tested on Linux only). Any new syntax in the vendored modules must clear the guard before it ships.
220
- - `tests/`: transforms (including the shared duplicate-id rename), end-to-end repair, atomic replace, pagination, watermarks, the audit analyzers (content/pagenumbers/emptytext/ocr/monolithic/completeness, archive integrity, spine classification, contamination since v0.50.0), the library sweep and `CalibreIdResolver`, validate, reserialize, CLI wiring, the version pin and the syntax-floor grammar guard, and the Calibre plugin (build drift + run behavior under calibre stubs). Since the v0.46.0 follow-ups: `tests/test_flags_wiring.py` reflectively pins the RepairFlags inventory to the argparse dests and `_flags_from_args` mapping (a flag added without a field, a field without a flag, or a remapped line fails there), the all-off defaults, and the version gate's caller-immutability contract (test_epub's `TestVersionGateKeepsFlagsIntact`); `tests/test_comment_hyphens.py` carries the RSC-016 fix; `tests/test_flags_real_core.py` drives every repair flag from argv through the unmocked core (--no-validate; the gate itself stays pinned by the mocked-oracle tests and runs for real wherever epubcheck exists). `tests/test_contamination.py` (v0.50.0) carries the three contamination sweeps, the advisory contract, the `_dir_dispatch` key pin, and the cover-routing regression. The v0.46.0 trio (test_flags_wiring, test_comment_hyphens, test_flags_real_core) rides CI's core-compat 3.12/3.13 leg; the hand-listed module list there must gain an entry for every new stack-free test module (audit-side test modules like test_contamination stay on the 3.14 leg by convention). The v0.55.0 batch (issues #11-#16): `tests/test_validate.py` pins the size-scaled timeout and the retry-then-OracleTimeout contract, `tests/test_observe.py` the v2 line format (`CODE:messages:occurrences`), the renamed codes block, the counting envelope, and v1 `--against` acceptance, `tests/test_epub.py::TestDeclareMissingItems` the RSC-008 declarer (sorted deterministic items, blessed media types only, id collisions prefixed, schemes/fragments/spaces/declared skipped), `tests/test_transforms.py::TestFixDuplicateIds` the content-doc rename, and `tests/test_flags_real_core.py` drives `--fix-duplicate-ids`, `--declare-missing-items`, and the extended `--strip-epub3-attrs` set through the real argv-to-fix path.
239
+ - `tests/`: transforms (including the shared duplicate-id rename), end-to-end repair, atomic replace, pagination, watermarks, the audit analyzers (content/pagenumbers/emptytext/ocr/monolithic/completeness, archive integrity, spine classification, contamination since v0.50.0), the library sweep and `CalibreIdResolver`, validate, reserialize, CLI wiring, the version pin and the syntax-floor grammar guard, and the Calibre plugin (build drift + run behavior under calibre stubs). Since the v0.46.0 follow-ups: `tests/test_flags_wiring.py` reflectively pins the RepairFlags inventory to the argparse dests and `_flags_from_args` mapping (a flag added without a field, a field without a flag, or a remapped line fails there), the all-off defaults, and the version gate's caller-immutability contract (test_epub's `TestVersionGateKeepsFlagsIntact`); `tests/test_comment_hyphens.py` carries the RSC-016 fix; `tests/test_flags_real_core.py` drives every repair flag from argv through the unmocked core (--no-validate; the gate itself stays pinned by the mocked-oracle tests and runs for real wherever epubcheck exists). `tests/test_contamination.py` (v0.50.0) carries the three contamination sweeps, the advisory contract, the `_dir_dispatch` key pin, and the cover-routing regression. The v0.46.0 trio (test_flags_wiring, test_comment_hyphens, test_flags_real_core) rides CI's core-compat 3.12/3.13 leg; the hand-listed module list there must gain an entry for every new stack-free test module (audit-side test modules like test_contamination stay on the 3.14 leg by convention). The v0.55.0 batch (issues #11-#16): `tests/test_validate.py` pins the size-scaled timeout and the retry-then-OracleTimeout contract, `tests/test_observe.py` the v2 line format (`CODE:messages:occurrences`), the renamed codes block, the counting envelope, and v1 `--against` acceptance, `tests/test_epub.py::TestDeclareMissingItems` the RSC-008 declarer (sorted deterministic items, blessed media types only, id collisions prefixed, schemes/fragments/spaces/declared skipped), `tests/test_transforms.py::TestFixDuplicateIds` the content-doc rename, and `tests/test_flags_real_core.py` drives `--fix-duplicate-ids`, `--declare-missing-items`, and the extended `--strip-epub3-attrs` set through the real argv-to-fix path. The v0.59.0 addition (issue #23): `tests/test_epub.py::TestPruneDanglingNcxTargets` pins the node-exact prune rule (dead leaf dropped, dead parent spliced above live children, dead subtree one span, scheme/bare-fragment/contentless/comment-hidden untouched, escaped-ampersand src resolves, pageTarget and legacy navTarget covered, wrapper-crossing and unclosed walks abort, a wholesale-dead container refuses) plus the end-to-end prune+resequence, and `tests/test_flags_real_core.py` drives `--prune-dangling-ncx-targets` through argv.
221
240
 
222
241
  ## Conventions
223
242
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: bindery-cli
3
- Version: 0.58.0
3
+ Version: 0.59.0
4
4
  Summary: Audit EPUB body text and repair broken EPUBs with deterministic, epubcheck-gated fixes; atomic in-place replacement in a Calibre library.
5
5
  Project-URL: Homepage, https://github.com/VirInvictus/bindery-cli
6
6
  Project-URL: Repository, https://github.com/VirInvictus/bindery-cli
@@ -1,5 +1,54 @@
1
1
  # bindery-cli Patch Notes
2
2
 
3
+ ## v0.59.0 (2026-10-28)
4
+
5
+ ### Issue #23: the dangling NCX navPoint, pruned and re-sequenced in one gate
6
+
7
+ `--prune-dangling-ncx-targets` is the twenty-sixth structural repair. The
8
+ class: an NCX navPoint (or pageTarget) whose `<content src>` names a document
9
+ the archive never contained. epubcheck answers RSC-007 from toc.ncx, and
10
+ nothing reached it: `--prune-missing-resources` prunes manifest items whose
11
+ FILE is absent, and a producer that drops the document without declaring it
12
+ leaves no item to prune, so the navPoint survived `--all` with "no applicable
13
+ fixes" (the Splintered Harmony fixture, 0f/1e/0w). Hand removal works but
14
+ cascades: every surviving playOrder then reads as starting at 2 (391 RSC-005s
15
+ on the live book), naive renumbering splits the navPoint/pageTarget
16
+ same-target contract (79 more), and the working rescue was a second `--all`
17
+ run to let the contract-gated playOrder pass heal the survivors. The new flag
18
+ folds that whole recipe into one gate.
19
+
20
+ The rule is node-exact, over a balanced stack scanner that tracks navPoint,
21
+ the legacy navTarget spelling, and pageTarget as one family: a navPoint dies
22
+ when its OWN target document is absent from the archive. A dead node whose
23
+ whole subtree dies with it is removed as one element; a dead node above
24
+ surviving descendants is spliced (its tags, its navLabel, and its dead
25
+ `<content>` go; the children are re-homed one level up), because dropping
26
+ live navigation to repair a dead label is no repair. Scheme URLs, bare
27
+ fragments, contentless nodes, comment-hidden elements, and escaped-ampersand
28
+ srcs that resolve (the issue #20 decoder) are never this class. The token
29
+ walk tracks the navMap/pageList containers too: an unbalanced walk (a stray
30
+ close, a wrapper crossing a node's span) aborts the pass unchanged, and so
31
+ does a prune that would EMPTY a container, because the NCX requires
32
+ navPoint+/pageTarget+ and an empty navMap is itself one RSC-005 (verified
33
+ against epubcheck 5.3): without the rule, the gate would happily apply a
34
+ TOC-less NCX, and a wholly dead TOC is the manual list's finding, not a
35
+ repair. When the prune fires, the
36
+ contract-gated playOrder pass re-runs in the same branch, the fragment
37
+ strip's v0.58.0 pattern. On the fixture the one run went 0f/1e/0w to
38
+ 0f/0e/0w: one navPoint pruned, 389 playOrder values re-sequenced across
39
+ navMap and pageList, epubcheck clean, and a second probe reports no
40
+ applicable fixes.
41
+
42
+ Wiring follows the house pattern: the `RepairFlags.prune_ncx_targets` field,
43
+ the `_REPAIR_FLAG_TABLE` row (compact `--help` and `--help-repairs`), the
44
+ `_flags_from_args` mapping, `--all` enabled like every structural flag, and
45
+ the wiring test's dest-to-field pin. Tests: `TestPruneDanglingNcxTargets`
46
+ pins the node-exact rule end to end (dead leaf, splice, dead subtree,
47
+ refusals, the unbalanced abort, the container-emptying refusal, the
48
+ escaped-ampersand resolve, pageTarget and navTarget, and the resequence
49
+ through `repair_epub`), and the real-core
50
+ suite drives the flag through argv. Suite: 820 tests.
51
+
3
52
  ## v0.58.0 (2026-10-26)
4
53
 
5
54
  ### Issues #18-#21: the structural dry run's four rejects, read to the root
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "bindery-cli"
7
- version = "0.58.0"
7
+ version = "0.59.0"
8
8
  description = "Audit EPUB body text and repair broken EPUBs with deterministic, epubcheck-gated fixes; atomic in-place replacement in a Calibre library."
9
9
  readme = "README.md"
10
10
  classifiers = [
@@ -52,6 +52,7 @@ The plugin vendors the core and never gates (the epubcheck latency ruling).
52
52
  | 0.56 | The boxed recipes, built same-day on the follow-up call: `--fix-unique-identifier` (the OPF-030 recipe: wire the package's named id onto the first dc:identifier, refuses every ambiguous shape, and predicts the post-wiring uid so the NCX sync the broken wiring was masking fires in the same run -- eagle 2e -> 1e accept) and the CSS-007 font half inside `--fix-media-types` (font/* blessed on both package versions, magic confirmed, .eot never touched; accepted under no_worse because the gain sits on the INFO axis -- Brave New World 8 fonts normalized, CSS-007 cleared) | v0.56.0 |
53
53
  | 0.57 | The embed scar's element half and the end of the silent equal (issue #22): `--fix-unbound-prefix` now binds an unbound ELEMENT prefix inline (the 9.7.0 writer self-declares xmlns:dc on every dc: element but one; rule 2 for a literal dc: element resolves to the DC namespace itself; Hackers 1f/1e -> 0f/1e with both binds in one run, and the half-repaired intermediate that read equal now repairs), and the masked-axis reclassification generalizes from the v0.51.0 NCX sync to every fired fix: a gate noop on a book that started and stayed fatal reads partial (the manual list) instead of a silent equal; the specimen's residual ncx:-prefixed dtb:uid gap shipped as the v0.57.1 patch (both matchers read a prefixed `<ncx:meta>` carrier; Hackers fully clean 0f/0e/0w) | v0.57.0-v0.57.1 |
54
54
  | 0.58 | The structural dry run's four rejects (issues #18-#21), each bisected to the root on its specimens: the private-ZipInfo write contract (issue #18: writestr stamps the info it is handed with the DESTINATION offsets, one shared info repointed zin's own lookups into the output file -- all 57 "unreadable" books, the "possible zip bomb" included, were this one bug; the peek also catches BadZipFile per the issue), bracket-encoded renamed references plus the start-tag/PI anchor on both reference rewriters (issue #19: raw brackets are RSC-020 path-illegal -- IJ 108e -> 22e -- and the unanchored regex corrupted display text that teaches HTML -- Hacking's two RSC-016 fatals), the entity-decoding href resolver and prefix-tolerant OPF matchers (issue #20: `&amp;` hrefs vs raw-`&` entries made prune and declare swap the same items on the D&D four, and `<opf:item>` blindness duplicated whole manifests on the Sony three), and the three #21 mechanisms (guide-fragment strip, the post-anchor playOrder re-run, the comment-blind duplicate-id rename) | v0.58.0 |
55
+ | 0.59 | The dangling-NCX prune (issue #23): `--prune-dangling-ncx-targets` removes navPoint/pageTarget elements whose `<content src>` names a document the archive never contained (RSC-007 the manifest prune cannot reach: no item exists for a file the OPF never declared), node-exact over a balanced stack scanner (dead subtree drops as one span, dead parent spliced above live children, scheme/bare-fragment/comment-hidden/contentless refused, unbalanced walk aborts), with the contract-gated playOrder pass re-run in the same branch -- the hand-surgery-plus-second-run rescue is one gate (fixture 0f/1e/0w -> 0f/0e/0w: one navPoint pruned, 389 playOrder values re-sequenced) | v0.59.0 |
55
56
 
56
57
  ## Open work
57
58
 
@@ -13,12 +13,12 @@ restyle, re-compress, or restructure content, and it does not attempt to fix arb
13
13
  schema (RSC-005) violations, which are usually harmless to readers and not safely
14
14
  mechanizable.
15
15
 
16
- The deliberate exceptions to "semantics-preserving" come in opt-in groups. The twenty-five
16
+ The deliberate exceptions to "semantics-preserving" come in opt-in groups. The twenty-six
17
17
  **structural repairs** (`--fix-empty-body`, `--fix-missing-title`, `--fix-id-colons`,
18
18
  `--fix-page-map`, `--strip-epub3-attrs`, `--downgrade-epub3-tags`,
19
19
  `--unwrap-block-in-inline`, `--strip-invalid-value`, `--unwrap-illegal-tags`,
20
20
  `--prune-missing-resources`, `--declare-missing-items`, `--strip-broken-anchors`,
21
- `--encode-url-spaces`,
21
+ `--prune-dangling-ncx-targets`, `--encode-url-spaces`,
22
22
  `--fix-container`, `--fix-media-types`, `--fix-cover`, `--fix-comment-double-hyphen`,
23
23
  `--fix-svg-dup-ids`, `--fix-duplicate-ids`, `--fix-cdata-terminator`,
24
24
  `--fix-misnested-inline`,
@@ -147,7 +147,7 @@ byte-for-byte. The normal gate applies.
147
147
 
148
148
  ### Opt-in: structural repairs
149
149
 
150
- Twenty-five repairs go past well-formedness and therefore require their own flag; none is ever
150
+ Twenty-six repairs go past well-formedness and therefore require their own flag; none is ever
151
151
  part of the default pipeline:
152
152
 
153
153
  - **`--fix-empty-body`**: `&nbsp;` inside a strictly empty `<body></body>` ("body
@@ -257,6 +257,31 @@ every EPUB3 book in an `--all` sweep taking exactly that damage).
257
257
  spine-integrity report. href values carrying a scheme no reader resolves
258
258
  (`kindle:embed:`, `file:`, ...) are stripped under the same flag; the resolvable set
259
259
  is fixed (`http`, `https`, `mailto`) and extends only with a named finding.
260
+ - **`--prune-dangling-ncx-targets`** (v0.59.0, issue #23): remove NCX
261
+ `navPoint`/`pageTarget` elements whose `<content src>` names a document the archive
262
+ does not contain (RSC-007 raised from toc.ncx). This is the class the prune flag
263
+ cannot reach (`--prune-missing-resources` prunes manifest items whose FILE is
264
+ absent; a producer that drops the document without declaring it leaves no item and
265
+ the navPoint survived `--all` as "no applicable fixes") and the class hand removal
266
+ breaks (every surviving playOrder reads as starting at 2, and naive renumbering
267
+ splits the navPoint/pageTarget same-target contract -- the live case ended at
268
+ 391 RSC-005s before the rescue). The rule is node-exact: a navPoint dies when its
269
+ OWN target document is absent; a dead node whose whole subtree dies with it is
270
+ removed as one element, and a dead node above surviving descendants is spliced (its
271
+ tags, label, and dead `<content>` go; the children are re-homed one level up),
272
+ because dropping live navigation to repair a dead label is no repair. Scheme URLs,
273
+ bare fragments, comment-hidden elements, and contentless nodes are never touched,
274
+ and the token walk tracks the navMap/pageList containers: an unbalanced walk (a
275
+ stray close, a wrapper crossing a node's span) aborts the pass unchanged, and so
276
+ does a prune that would EMPTY a container -- the NCX requires navPoint+/pageTarget+
277
+ and trading a wholly dead TOC for no TOC is the manual list's call (an empty navMap
278
+ is itself one RSC-005, verified against epubcheck 5.3, so the gate would happily
279
+ apply the amputation). When the prune fires, the
280
+ always-on playOrder pass re-runs on the final navMap (the same contract-gated
281
+ re-sequencing the fragment strip uses), so the rescue that took hand surgery plus a
282
+ second `--all` run is one gate here. The live specimen went 0f/1e/0w to 0f/0e/0w in
283
+ one run (one navPoint pruned, 389 playOrder values re-sequenced across navMap and
284
+ pageList, epubcheck clean).
260
285
  - **`--encode-url-spaces`**: repairs raw-space URLs two ways. The reference half
261
286
  percent-encodes raw spaces in `src`/`href` attribute values across the package
262
287
  (OPF manifest, NCX `content src`, content documents): a URL with a literal space is
@@ -406,7 +431,7 @@ leftovers whose failing OPF is a stale non-rootfile are unreachable by construct
406
431
  byte-identical. Runs on the OPF only: content documents have the
407
432
  invalid-attribute drop (`--strip-bad-attrs`) for the same defect class.
408
433
 
409
- Twenty-three of the twenty-five are evaluated by the normal `gate`: unlike the lossy strips,
434
+ Twenty-three of the twenty-six are evaluated by the normal `gate`: unlike the lossy strips,
410
435
  their benefit is visible to epubcheck (they clear errors), so a run with no measurable
411
436
  improvement is a noop and nothing is applied. The three exceptions are `--fix-cover`, `--encode-url-spaces`, and
412
437
  `--fix-media-types` (whose gains sit on axes epubcheck's counts do not measure:
@@ -11,7 +11,7 @@ Calibre plugin built from this core.
11
11
  Single source of truth for the version. pyproject.toml must match VERSION below.
12
12
  """
13
13
 
14
- VERSION = "0.58.0"
14
+ VERSION = "0.59.0"
15
15
  __version__ = VERSION
16
16
 
17
17
  from .epub import RepairReport, repair_epub # noqa: E402
@@ -95,6 +95,7 @@ def _flags_from_args(args: argparse.Namespace) -> RepairFlags:
95
95
  prune_missing=args.prune_missing_resources or all_,
96
96
  declare_missing=args.declare_missing_items or all_,
97
97
  strip_anchors=args.strip_broken_anchors or all_,
98
+ prune_ncx_targets=args.prune_dangling_ncx_targets or all_,
98
99
  url_spaces=args.encode_url_spaces or all_,
99
100
  fix_container=args.fix_container or all_,
100
101
  fix_media_types=args.fix_media_types or all_,
@@ -1800,6 +1801,22 @@ _REPAIR_FLAG_TABLE: dict[str, list[tuple[str, str, str]]] = {
1800
1801
  "two fragments onto one document cannot leave the same-target-"
1801
1802
  "shares-one-value contract violated.",
1802
1803
  ),
1804
+ (
1805
+ "prune_dangling_ncx_targets",
1806
+ "remove NCX navPoints/pageTargets whose content src is absent (RSC-007)",
1807
+ "remove NCX navPoint/pageTarget elements whose <content src> names a "
1808
+ "document the archive does not contain (RSC-007; issue #23) -- the "
1809
+ "class --prune-missing-resources cannot reach, because the OPF never "
1810
+ "declared the dropped file, and whose hand removal breaks the "
1811
+ "playOrder contract (every survivor's value reads as starting at 2). "
1812
+ "A dead navPoint whose whole subtree dies with it is removed as one "
1813
+ "element; a dead navPoint above surviving descendants is spliced: "
1814
+ "its tags go and the children are re-homed one level up, because "
1815
+ "dropping live navigation to repair a dead label is no repair. "
1816
+ "When the prune fires, the always-on playOrder pass re-runs on the "
1817
+ "final navMap, so the rescue that took hand surgery plus a second "
1818
+ "--all run is one gate here.",
1819
+ ),
1803
1820
  (
1804
1821
  "encode_url_spaces",
1805
1822
  "encode raw spaces in URLs; rename space-bearing entries (PKG-010)",
@@ -290,6 +290,7 @@ class RepairFlags:
290
290
  prune_missing: bool = False
291
291
  declare_missing: bool = False
292
292
  strip_anchors: bool = False
293
+ prune_ncx_targets: bool = False
293
294
  url_spaces: bool = False
294
295
  fix_container: bool = False
295
296
  fix_media_types: bool = False
@@ -1610,6 +1611,192 @@ def strip_ncx_broken_fragments(
1610
1611
  return outside_protected_map(ncx_text, fix)
1611
1612
 
1612
1613
 
1614
+ # --prune-dangling-ncx-targets (issue #23) token set: navPoint, its legacy
1615
+ # navTarget spelling, and pageTarget share one element family, so the
1616
+ # scanner tracks them together. Quote-aware possessive start tags (the
1617
+ # house matcher: the overlapping [^>] branch makes a plain greedy loop
1618
+ # re-partition exponentially on failing candidates) and the optional
1619
+ # namespace prefix, matching the OPF matchers' issue #20 tolerance.
1620
+ _NCXP_TOKEN_RE = re.compile(
1621
+ r"""<(?:[\w.-]+:)?(navPoint|navTarget|pageTarget)\b(?:"[^"]*"|'[^']*'|[^>])*+>"""
1622
+ r"""|</(?:[\w.-]+:)?(navPoint|navTarget|pageTarget)\s*>"""
1623
+ r"""|<(?:[\w.-]+:)?(navMap|pageList)\b(?:"[^"]*"|'[^']*'|[^>])*+>"""
1624
+ r"""|</(?:[\w.-]+:)?(navMap|pageList)\s*>""",
1625
+ re.IGNORECASE,
1626
+ )
1627
+
1628
+
1629
+ @dataclass
1630
+ class _NcxTargetNode:
1631
+ """One navPoint/navTarget/pageTarget element located in the NCX text.
1632
+
1633
+ Spans index the tags for the edit pass; `header_end` is where the
1634
+ node's own header (navLabel, then the `<content>` that `own_src` came
1635
+ from) ends and the first navPoint-family child or the node's own end
1636
+ tag begins -- the splice edit removes [open_start, header_end) so the
1637
+ dead label and dead target go with the tags while the children stay.
1638
+ The survival pass fills `action`: "drop" removes the whole span,
1639
+ "splice" removes the tags plus that header, None keeps the node."""
1640
+
1641
+ name: str
1642
+ open_start: int
1643
+ open_end: int
1644
+ header_end: int = -1
1645
+ close_start: int = -1
1646
+ close_end: int = -1
1647
+ own_src: str | None = None
1648
+ children: list[_NcxTargetNode] = field(default_factory=list)
1649
+ keeps: bool = True
1650
+ action: str | None = None
1651
+
1652
+
1653
+ def strip_ncx_dangling_targets(
1654
+ ncx_text: str, ncx_dir: str, present: frozenset[str]
1655
+ ) -> tuple[str, int]:
1656
+ """Remove navPoint/pageTarget elements whose `<content src>` names a
1657
+ document the archive does not contain (RSC-007 at toc.ncx, issue #23).
1658
+
1659
+ `--prune-missing-resources` cannot reach this class: the OPF never
1660
+ declared the dropped file, so there is no manifest item to prune and
1661
+ the navPoint survived `--all` ("no applicable fixes"), while hand
1662
+ removal breaks the playOrder contract (every survivor's value reads as
1663
+ starting at 2). The wiring therefore re-runs the contract-gated
1664
+ playOrder pass the moment this fires.
1665
+
1666
+ The rule is node-exact: a navPoint dies when ITS OWN target document is
1667
+ absent. A dead node whose whole subtree dies with it is removed as one
1668
+ span; a dead node above surviving descendants is spliced (its tags,
1669
+ label, and dead `<content>` go, the children are re-homed one level up),
1670
+ because dropping live navigation to repair a dead label is no repair.
1671
+ Scheme URLs (kindle:, https:) and bare-fragment targets are never this
1672
+ class, a node with no `<content>` of its own is left alone. The walk
1673
+ tracks the navMap/pageList containers as tokens too: an unbalanced walk
1674
+ (a stray close, a wrapper crossing a node's span) aborts the pass
1675
+ unchanged, and so does a prune that would EMPTY a container -- the NCX
1676
+ requires navPoint+/pageTarget+ and trading a wholly dead TOC for no TOC
1677
+ is the manual list's call (verified against epubcheck 5.3: an empty
1678
+ navMap is itself one RSC-005, so the gate would happily apply the
1679
+ amputation). This is text surgery over a possibly-broken book; the gate
1680
+ is the safety net behind it."""
1681
+
1682
+ def prune(text: str) -> tuple[str, int]:
1683
+ tokens = list(_NCXP_TOKEN_RE.finditer(text))
1684
+ # top-level family nodes bucket per container; `bare` holds nodes
1685
+ # outside any navMap/pageList (DTD-invalid but seen in the wild)
1686
+ containers: list[tuple[str, list[_NcxTargetNode]]] = []
1687
+ bare: list[_NcxTargetNode] = []
1688
+ stack: list[_NcxTargetNode] = []
1689
+ cur_name: str | None = None
1690
+ cur_bucket: list[_NcxTargetNode] = []
1691
+
1692
+ def bucket() -> list[_NcxTargetNode]:
1693
+ if stack:
1694
+ return stack[-1].children
1695
+ return cur_bucket if cur_name else bare
1696
+
1697
+ for i, m in enumerate(tokens):
1698
+ if m.group(1) is not None: # navPoint/navTarget/pageTarget open
1699
+ if m.group(0).endswith("/>"):
1700
+ # self-closing: complete leaf, no <content> child
1701
+ bucket().append(
1702
+ _NcxTargetNode(
1703
+ name=m.group(1).lower(),
1704
+ open_start=m.start(),
1705
+ open_end=m.end(),
1706
+ )
1707
+ )
1708
+ continue
1709
+ node = _NcxTargetNode(
1710
+ name=m.group(1).lower(), open_start=m.start(), open_end=m.end()
1711
+ )
1712
+ node.header_end = (
1713
+ tokens[i + 1].start() if i + 1 < len(tokens) else len(text)
1714
+ )
1715
+ sm = _NCX_CONTENT_SRC_RE.search(text, node.open_end, node.header_end)
1716
+ node.own_src = sm.group(3) if sm else None
1717
+ stack.append(node)
1718
+ elif m.group(2) is not None: # family close
1719
+ if not stack or stack[-1].name != m.group(2).lower():
1720
+ return text, 0 # unbalanced tree: never guess
1721
+ node = stack.pop()
1722
+ # the parent AFTER the pop: the closed node joins its
1723
+ # parent's children, never its own
1724
+ bucket().append(node)
1725
+ node.close_start, node.close_end = m.start(), m.end()
1726
+ elif m.group(3) is not None: # navMap/pageList open
1727
+ if stack or cur_name is not None:
1728
+ return text, 0 # a container inside a node or container
1729
+ if not m.group(0).endswith("/>"):
1730
+ cur_name, cur_bucket = m.group(3).lower(), []
1731
+ else: # container close
1732
+ if stack or cur_name != m.group(4).lower():
1733
+ return text, 0 # a node still open under the container
1734
+ containers.append((cur_name, cur_bucket))
1735
+ cur_name, cur_bucket = None, []
1736
+ if stack or cur_name is not None:
1737
+ return text, 0 # unclosed element at end of part: same refusal
1738
+
1739
+ # Survival, children before parents (every node lands after its
1740
+ # parent in the pre-order flat list, so the reversed walk is
1741
+ # post-order): a dead node keeps only what survives beneath it.
1742
+ flat: list[_NcxTargetNode] = []
1743
+ work: list[_NcxTargetNode] = list(bare)
1744
+ for _, b in containers:
1745
+ work.extend(b)
1746
+ while work:
1747
+ n = work.pop()
1748
+ flat.append(n)
1749
+ work.extend(n.children)
1750
+ for n in reversed(flat):
1751
+ resolved = _resolve_href(ncx_dir, n.own_src) if n.own_src else None
1752
+ # None covers a missing <content>, an external scheme, and a
1753
+ # bare fragment (it would resolve inside the NCX itself): none
1754
+ # of those is the absent-document class
1755
+ if resolved is None or resolved in present:
1756
+ continue
1757
+ child_keeps = any(c.keeps for c in n.children)
1758
+ n.action = "splice" if child_keeps else "drop"
1759
+ n.keeps = child_keeps
1760
+ for _, b in containers:
1761
+ if b and not any(n.keeps for n in b):
1762
+ return text, 0 # the prune would empty a required container
1763
+
1764
+ tops: list[_NcxTargetNode] = list(bare)
1765
+ for _, b in containers:
1766
+ tops.extend(b)
1767
+ edits: list[tuple[int, int]] = []
1768
+ count = 0
1769
+ work = [(n, False) for n in tops] # (node, inside a dropped span)
1770
+ while work:
1771
+ n, buried = work.pop()
1772
+ if buried or n.action is None:
1773
+ work.extend((c, buried or n.action == "drop") for c in n.children)
1774
+ continue
1775
+ if n.action == "drop":
1776
+ edits.append((n.open_start, n.close_end))
1777
+ count += 1
1778
+ work.extend((c, True) for c in n.children)
1779
+ else:
1780
+ # splice: the tags AND the dead node's own header (its
1781
+ # navLabel and its dead <content>) go; only the children
1782
+ # survive, re-homed one level up
1783
+ edits.append((n.open_start, n.header_end))
1784
+ edits.append((n.close_start, n.close_end))
1785
+ count += 1
1786
+ work.extend((c, False) for c in n.children)
1787
+ if not edits:
1788
+ return text, 0
1789
+ out: list[str] = []
1790
+ pos = 0
1791
+ for start, end in sorted(edits):
1792
+ out.append(text[pos:start])
1793
+ pos = end
1794
+ out.append(text[pos:])
1795
+ return "".join(out), count
1796
+
1797
+ return outside_protected_map(ncx_text, prune)
1798
+
1799
+
1613
1800
  def strip_broken_guide_fragments(
1614
1801
  opf_text: str, opf_dir: str, ids_by_doc: dict[str, frozenset[str]]
1615
1802
  ) -> tuple[str, int]:
@@ -1841,6 +2028,11 @@ def repair_epub(
1841
2028
  target document does not define (RSC-020/RSC-012; NCX navTargets keep the document
1842
2029
  target) and non-resolvable URI schemes (kindle:, file:). Anchor text is always
1843
2030
  preserved byte-for-byte.
2031
+ With `prune_ncx_targets`, remove NCX navPoint/pageTarget elements whose
2032
+ <content src> names a document the archive does not contain (RSC-007; issue #23),
2033
+ re-homing the surviving children of a dead navPoint one level up, and re-run the
2034
+ contract-gated playOrder pass so the survivors' values stay contiguous in the
2035
+ same run.
1844
2036
  With `url_spaces`, repair raw-space URLs two ways: percent-encode raw spaces
1845
2037
  in src/href attribute values across the package (OPF href, NCX src, content
1846
2038
  src/href; a literal space is not a valid URL, RSC-020), and RENAME the
@@ -2037,6 +2229,7 @@ def repair_epub(
2037
2229
  or flags.strip_anchors
2038
2230
  or flags.fix_media_types
2039
2231
  or flags.declare_missing
2232
+ or flags.prune_ncx_targets
2040
2233
  ):
2041
2234
  for n in zin.namelist():
2042
2235
  norm_to_raw.setdefault(_norm_path(space_renames.get(n, n)), n)
@@ -2291,6 +2484,24 @@ def repair_epub(
2291
2484
  counts["fix_ncx_playorder"] = (
2292
2485
  counts.get("fix_ncx_playorder", 0) + n2
2293
2486
  )
2487
+ if flags.prune_ncx_targets:
2488
+ text, n = strip_ncx_dangling_targets(
2489
+ text, posixpath.dirname(out_item.filename), present
2490
+ )
2491
+ if n:
2492
+ counts["ncx_dangling_targets_pruned"] = n
2493
+ # The prune leaves the survivors' playOrder values
2494
+ # gapped (and pageTargets' shared values without
2495
+ # their navPoint anchors): the same contract
2496
+ # violation the fragment strip manufactures. The
2497
+ # pass is contract-gated, so a still-valid NCX
2498
+ # re-runs as a no-op (issue #23's hand-rescue
2499
+ # recipe, one gate).
2500
+ text, n2 = fix_ncx_playorder(text)
2501
+ if n2:
2502
+ counts["fix_ncx_playorder"] = (
2503
+ counts.get("fix_ncx_playorder", 0) + n2
2504
+ )
2294
2505
  synced = False
2295
2506
  sync_uid = uid if uid else wired_uid
2296
2507
  if sync_uid:
@@ -24,6 +24,7 @@ from bindery.epub import (
24
24
  package_version,
25
25
  repair_epub,
26
26
  strip_epub3_attributes,
27
+ strip_ncx_dangling_targets,
27
28
  strip_page_map,
28
29
  sync_ncx_uid,
29
30
  )
@@ -1471,6 +1472,259 @@ class TestStripBrokenAnchors(unittest.TestCase):
1471
1472
  self.assertIn("<a>jump</a>", out)
1472
1473
 
1473
1474
 
1475
+ class TestPruneDanglingNcxTargets(unittest.TestCase):
1476
+ """--prune-dangling-ncx-targets (issue #23): navPoints/pageTargets whose
1477
+ <content src> names a document absent from the archive are removed and
1478
+ the playOrder pass re-sequences the survivors. Node-exact: live
1479
+ navigation is never dropped to repair a dead label."""
1480
+
1481
+ PRESENT = frozenset({"OEBPS/a.xhtml", "OEBPS/b.xhtml"})
1482
+
1483
+ def _prune(self, ncx: str) -> tuple[str, int]:
1484
+ return strip_ncx_dangling_targets(ncx, "OEBPS", self.PRESENT)
1485
+
1486
+ def test_dead_leaf_is_dropped_live_sibling_kept(self):
1487
+ ncx = (
1488
+ "<navMap>"
1489
+ '<navPoint id="nav0" playOrder="1"><navLabel><text>Cover</text></navLabel>'
1490
+ '<content src="c0.xhtml"/></navPoint>'
1491
+ '<navPoint id="nav1" playOrder="2"><navLabel><text>A</text></navLabel>'
1492
+ '<content src="a.xhtml"/></navPoint>'
1493
+ "</navMap>"
1494
+ )
1495
+ out, n = self._prune(ncx)
1496
+ self.assertEqual(n, 1)
1497
+ self.assertNotIn('id="nav0"', out)
1498
+ self.assertNotIn("c0.xhtml", out)
1499
+ self.assertIn('<navPoint id="nav1" playOrder="2">', out)
1500
+
1501
+ def test_dead_parent_with_live_children_is_spliced(self):
1502
+ ncx = (
1503
+ "<navMap>"
1504
+ '<navPoint id="p" playOrder="1"><navLabel><text>Part</text></navLabel>'
1505
+ '<content src="gone.xhtml"/>'
1506
+ '<navPoint id="c1" playOrder="2"><navLabel><text>One</text></navLabel>'
1507
+ '<content src="a.xhtml"/></navPoint>'
1508
+ '<navPoint id="c2" playOrder="3"><navLabel><text>Two</text></navLabel>'
1509
+ '<content src="b.xhtml"/></navPoint>'
1510
+ "</navPoint>"
1511
+ "</navMap>"
1512
+ )
1513
+ out, n = self._prune(ncx)
1514
+ self.assertEqual(n, 1)
1515
+ # the dead parent's tags go; both live children stay, re-homed
1516
+ self.assertEqual(out.count("<navPoint"), 2)
1517
+ self.assertIn('<navPoint id="c1"', out)
1518
+ self.assertIn('<navPoint id="c2"', out)
1519
+ self.assertIn("<text>One</text>", out)
1520
+ self.assertIn("<text>Two</text>", out)
1521
+ self.assertNotIn("<text>Part</text>", out)
1522
+ # still balanced: every opened navPoint closes
1523
+ self.assertEqual(out.count("<navPoint"), out.count("</navPoint>"))
1524
+
1525
+ def test_dead_subtree_dropped_as_one_span(self):
1526
+ ncx = (
1527
+ "<navMap>"
1528
+ '<navPoint id="p" playOrder="1"><navLabel><text>Part</text></navLabel>'
1529
+ '<content src="gone.xhtml"/>'
1530
+ '<navPoint id="c" playOrder="2"><navLabel><text>Child</text></navLabel>'
1531
+ '<content src="also-gone.xhtml"/></navPoint>'
1532
+ "</navPoint>"
1533
+ '<navPoint id="n1" playOrder="3"><navLabel><text>A</text></navLabel>'
1534
+ '<content src="a.xhtml"/></navPoint>'
1535
+ "</navMap>"
1536
+ )
1537
+ out, n = self._prune(ncx)
1538
+ self.assertEqual(n, 1) # the maximal dead subtree counts once
1539
+ self.assertNotIn("gone.xhtml", out)
1540
+ self.assertNotIn("also-gone.xhtml", out)
1541
+ self.assertIn('<navPoint id="n1"', out)
1542
+
1543
+ def test_scheme_bare_fragment_and_contentless_nodes_survive(self):
1544
+ ncx = (
1545
+ "<navMap>"
1546
+ '<navPoint id="s" playOrder="1"><navLabel><text>K</text></navLabel>'
1547
+ '<content src="kindle:embed:0003?mime=image/jpg"/></navPoint>'
1548
+ '<navPoint id="f" playOrder="2"><navLabel><text>F</text></navLabel>'
1549
+ '<content src="#here"/></navPoint>'
1550
+ '<navPoint id="x" playOrder="3"><navLabel><text>X</text></navLabel>'
1551
+ "</navPoint>"
1552
+ "</navMap>"
1553
+ )
1554
+ out, n = self._prune(ncx)
1555
+ self.assertEqual((out, n), (ncx, 0))
1556
+
1557
+ def test_escaped_ampersand_src_resolves_to_its_entry(self):
1558
+ # issue #20's decode: src="a&amp;b.xhtml" names the raw entry a&b.xhtml
1559
+ ncx = (
1560
+ "<navMap>"
1561
+ '<navPoint id="n" playOrder="1"><navLabel><text>A</text></navLabel>'
1562
+ '<content src="a&amp;b.xhtml"/></navPoint>'
1563
+ "</navMap>"
1564
+ )
1565
+ out, n = strip_ncx_dangling_targets(
1566
+ ncx, "OEBPS", frozenset({"OEBPS/a&b.xhtml"})
1567
+ )
1568
+ self.assertEqual((out, n), (ncx, 0))
1569
+
1570
+ def test_dead_pagetarget_and_legacy_navtarget_are_dropped(self):
1571
+ ncx = (
1572
+ '<pageList class="pages">'
1573
+ '<pageTarget id="pg1" playOrder="1"><navLabel><text>1</text></navLabel>'
1574
+ '<content src="a.xhtml"/></pageTarget>'
1575
+ '<pageTarget id="pg2" playOrder="2"><navLabel><text>2</text></navLabel>'
1576
+ '<content src="gone.xhtml"/></pageTarget>'
1577
+ "</pageList>"
1578
+ )
1579
+ out, n = self._prune(ncx)
1580
+ self.assertEqual(n, 1)
1581
+ self.assertNotIn("pg2", out)
1582
+ self.assertIn("pg1", out)
1583
+ # the legacy navTarget spelling, with a live sibling so the
1584
+ # container never empties (the wholesale-dead rule refuses first)
1585
+ navtarget = (
1586
+ "<navMap>"
1587
+ '<navPoint id="n0" playOrder="1"><navLabel><text>A</text></navLabel>'
1588
+ '<content src="a.xhtml"/></navPoint>'
1589
+ '<navTarget id="t1" playOrder="2"><navLabel><text>B</text></navLabel>'
1590
+ '<content src="gone.xhtml"/></navTarget>'
1591
+ "</navMap>"
1592
+ )
1593
+ out, n = self._prune(navtarget)
1594
+ self.assertEqual(n, 1)
1595
+ self.assertNotIn("t1", out)
1596
+ self.assertIn("n0", out)
1597
+
1598
+ def test_comment_hidden_navpoints_are_untouched(self):
1599
+ ncx = (
1600
+ "<navMap>"
1601
+ "<!-- <navPoint id=\"dead\"><content src='gone.xhtml'/></navPoint> -->"
1602
+ '<navPoint id="n1" playOrder="1"><navLabel><text>A</text></navLabel>'
1603
+ '<content src="a.xhtml"/></navPoint>'
1604
+ "</navMap>"
1605
+ )
1606
+ out, n = self._prune(ncx)
1607
+ self.assertEqual((out, n), (ncx, 0))
1608
+
1609
+ def test_unbalanced_ncx_aborts_unchanged(self):
1610
+ # dead src on purpose: with a live one the unchanged result would
1611
+ # come from the keep path, not from either abort branch
1612
+ wrapper_crossed = (
1613
+ "<navMap>"
1614
+ '<navPoint id="n1" playOrder="1"><navLabel><text>A</text></navLabel>'
1615
+ '<content src="gone.xhtml"/>'
1616
+ "</navMap></navPoint>"
1617
+ )
1618
+ out, n = self._prune(wrapper_crossed)
1619
+ self.assertEqual((out, n), (wrapper_crossed, 0))
1620
+ unclosed = (
1621
+ "<navMap>"
1622
+ '<navPoint id="n1" playOrder="1"><navLabel><text>A</text></navLabel>'
1623
+ '<content src="gone.xhtml"/>'
1624
+ "</navMap>"
1625
+ )
1626
+ out, n = self._prune(unclosed)
1627
+ self.assertEqual((out, n), (unclosed, 0))
1628
+
1629
+ def test_prune_that_would_empty_a_container_refuses(self):
1630
+ # every navPoint dead: epubcheck wants navPoint+ in navMap, so the
1631
+ # prune would trade a dead TOC for a TOC-less NCX; the manual list
1632
+ # keeps the book instead (verified: an empty navMap is itself RSC-005)
1633
+ dead_navmap = (
1634
+ "<navMap>"
1635
+ '<navPoint id="n1" playOrder="1"><navLabel><text>A</text></navLabel>'
1636
+ '<content src="gone1.xhtml"/></navPoint>'
1637
+ '<navPoint id="n2" playOrder="2"><navLabel><text>B</text></navLabel>'
1638
+ '<content src="gone2.xhtml"/></navPoint>'
1639
+ "</navMap>"
1640
+ )
1641
+ out, n = self._prune(dead_navmap)
1642
+ self.assertEqual((out, n), (dead_navmap, 0))
1643
+ # same rule per container: navMap lives, pageList dies wholesale
1644
+ dead_pagelist = (
1645
+ "<navMap>"
1646
+ '<navPoint id="n1" playOrder="1"><navLabel><text>A</text></navLabel>'
1647
+ '<content src="a.xhtml"/></navPoint>'
1648
+ "</navMap>"
1649
+ '<pageList class="pages">'
1650
+ '<pageTarget id="pg" playOrder="1"><navLabel><text>1</text></navLabel>'
1651
+ '<content src="gone.xhtml"/></pageTarget>'
1652
+ "</pageList>"
1653
+ )
1654
+ out, n = self._prune(dead_pagelist)
1655
+ self.assertEqual((out, n), (dead_pagelist, 0))
1656
+ # an ALREADY-empty container is not the prune's doing: bare navMap
1657
+ # with live content in another container still prunes there
1658
+ live_elsewhere = (
1659
+ "<navMap></navMap>"
1660
+ '<pageList class="pages">'
1661
+ '<pageTarget id="pg1" playOrder="1"><navLabel><text>1</text></navLabel>'
1662
+ '<content src="a.xhtml"/></pageTarget>'
1663
+ '<pageTarget id="pg2" playOrder="2"><navLabel><text>2</text></navLabel>'
1664
+ '<content src="gone.xhtml"/></pageTarget>'
1665
+ "</pageList>"
1666
+ )
1667
+ out, n = self._prune(live_elsewhere)
1668
+ self.assertEqual(n, 1)
1669
+ self.assertNotIn("pg2", out)
1670
+ self.assertIn("pg1", out)
1671
+
1672
+ def test_repair_epub_prunes_and_resequences_playorder(self):
1673
+ # the issue #23 shape end to end: the dead Cover navPoint carries
1674
+ # playOrder 1, so the survivors' values start at 2 until the
1675
+ # contract-gated re-run heals them in the same pass
1676
+ opf = (
1677
+ '<?xml version="1.0"?>'
1678
+ '<package xmlns="http://www.idpf.org/2007/opf" '
1679
+ 'unique-identifier="bookid">'
1680
+ '<metadata xmlns:dc="http://purl.org/dc/elements/1.1/">'
1681
+ '<dc:identifier id="bookid">urn:uuid:U</dc:identifier>'
1682
+ "</metadata>"
1683
+ "<manifest>"
1684
+ '<item href="a.xhtml" id="a" media-type="application/xhtml+xml"/>'
1685
+ '<item href="toc.ncx" id="ncx" media-type="application/x-dtbncx+xml"/>'
1686
+ "</manifest>"
1687
+ '<spine><itemref idref="a"/></spine>'
1688
+ "</package>"
1689
+ )
1690
+ ncx = (
1691
+ '<?xml version="1.0"?>'
1692
+ '<ncx xmlns="http://www.daisy.org/z3986/2005/ncx/" version="2005-1">'
1693
+ "<head>"
1694
+ '<meta name="dtb:uid" content="urn:uuid:U"/>'
1695
+ "</head>"
1696
+ "<docTitle><text>t</text></docTitle>"
1697
+ "<navMap>"
1698
+ '<navPoint id="nav0" playOrder="1"><navLabel><text>Cover</text></navLabel>'
1699
+ '<content src="c0.xhtml"/></navPoint>'
1700
+ '<navPoint id="nav1" playOrder="2"><navLabel><text>A</text></navLabel>'
1701
+ '<content src="a.xhtml"/></navPoint>'
1702
+ "</navMap></ncx>"
1703
+ )
1704
+ with tempfile.TemporaryDirectory() as td:
1705
+ src, dst = Path(td) / "in.epub", Path(td) / "out.epub"
1706
+ with zipfile.ZipFile(src, "w", zipfile.ZIP_DEFLATED) as z:
1707
+ z.writestr("mimetype", "application/epub+zip")
1708
+ z.writestr("OEBPS/content.opf", opf)
1709
+ z.writestr(
1710
+ "OEBPS/a.xhtml",
1711
+ '<?xml version="1.0"?>'
1712
+ '<html xmlns="http://www.w3.org/1999/xhtml">'
1713
+ "<head><title>t</title></head><body><p>x</p></body></html>",
1714
+ )
1715
+ z.writestr("OEBPS/toc.ncx", ncx)
1716
+ report = repair_epub(src, dst, RepairFlags(prune_ncx_targets=True))
1717
+ self.assertEqual(report.fixes.get("ncx_dangling_targets_pruned"), 1)
1718
+ self.assertGreater(report.fixes.get("fix_ncx_playorder", 0), 0)
1719
+ with zipfile.ZipFile(dst) as z:
1720
+ out = z.read("OEBPS/toc.ncx").decode()
1721
+ self.assertNotIn('id="nav0"', out)
1722
+ self.assertNotIn("c0.xhtml", out)
1723
+ self.assertIn('playOrder="1"', out)
1724
+ self.assertNotIn('playOrder="2"', out)
1725
+ ET.fromstring(out)
1726
+
1727
+
1474
1728
  class TestEncodeUrlSpacesEpub(unittest.TestCase):
1475
1729
  """--encode-url-spaces: raw spaces in src/href attribute values are
1476
1730
  percent-encoded across the package, and entries whose names carry raw
@@ -245,6 +245,27 @@ def _fixtures() -> dict:
245
245
  },
246
246
  "broken_fragment_hrefs_stripped",
247
247
  ),
248
+ "--prune-dangling-ncx-targets": (
249
+ {
250
+ "OEBPS/content.opf": _opf(
251
+ [c1, _item("n", "toc.ncx", "application/x-dtbncx+xml")], [r1]
252
+ ),
253
+ "OEBPS/c1.xhtml": plain,
254
+ "OEBPS/toc.ncx": (
255
+ '<?xml version="1.0"?>'
256
+ '<ncx xmlns="http://www.daisy.org/z3986/2005/ncx/" version="2005-1">'
257
+ "<head/><docTitle><text>t</text></docTitle><navMap>"
258
+ '<navPoint id="nav0" playOrder="1">'
259
+ "<navLabel><text>Cover</text></navLabel>"
260
+ '<content src="c0.xhtml"/></navPoint>'
261
+ '<navPoint id="nav1" playOrder="2">'
262
+ "<navLabel><text>One</text></navLabel>"
263
+ '<content src="c1.xhtml"/></navPoint>'
264
+ "</navMap></ncx>"
265
+ ),
266
+ },
267
+ "ncx_dangling_targets_pruned",
268
+ ),
248
269
  "--encode-url-spaces": (
249
270
  {
250
271
  "OEBPS/content.opf": _opf(
@@ -563,6 +584,14 @@ class FlagEndToEndTests(unittest.TestCase):
563
584
  1,
564
585
  )
565
586
 
587
+ def test_prune_dangling_ncx_targets(self):
588
+ self.assertGreaterEqual(
589
+ self._fixes_for("--prune-dangling-ncx-targets")[
590
+ "ncx_dangling_targets_pruned"
591
+ ],
592
+ 1,
593
+ )
594
+
566
595
  def test_encode_url_spaces(self):
567
596
  self.assertGreaterEqual(
568
597
  self._fixes_for("--encode-url-spaces")["entries_renamed"], 1
@@ -37,6 +37,7 @@ DEST_TO_FIELD = {
37
37
  "prune_missing_resources": "prune_missing",
38
38
  "declare_missing_items": "declare_missing",
39
39
  "strip_broken_anchors": "strip_anchors",
40
+ "prune_dangling_ncx_targets": "prune_ncx_targets",
40
41
  "encode_url_spaces": "url_spaces",
41
42
  "fix_container": "fix_container",
42
43
  "fix_media_types": "fix_media_types",
@@ -8,7 +8,7 @@ resolution-markers = [
8
8
 
9
9
  [[package]]
10
10
  name = "bindery-cli"
11
- version = "0.58.0"
11
+ version = "0.59.0"
12
12
  source = { editable = "." }
13
13
  dependencies = [
14
14
  { name = "cquarry", marker = "python_full_version >= '3.14'" },
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes