zotcli 0.1.3__tar.gz → 0.2.2__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 (123) hide show
  1. {zotcli-0.1.3 → zotcli-0.2.2}/.gitignore +6 -0
  2. zotcli-0.2.2/CHANGELOG.md +139 -0
  3. {zotcli-0.1.3 → zotcli-0.2.2}/PKG-INFO +202 -148
  4. zotcli-0.2.2/PLAN_WRITE.md +883 -0
  5. {zotcli-0.1.3 → zotcli-0.2.2}/README.md +189 -146
  6. zotcli-0.2.2/SKILL.md +335 -0
  7. zotcli-0.2.2/docs/architecture-write.md +221 -0
  8. zotcli-0.2.2/docs/commands.md +539 -0
  9. {zotcli-0.1.3 → zotcli-0.2.2}/docs/getting_started.md +8 -0
  10. zotcli-0.2.2/docs/images/fulltext-auth-flow.png +0 -0
  11. {zotcli-0.1.3 → zotcli-0.2.2}/docs/index.md +1 -0
  12. {zotcli-0.1.3 → zotcli-0.2.2}/pyproject.toml +6 -3
  13. {zotcli-0.1.3 → zotcli-0.2.2}/src/zotcli/__init__.py +1 -1
  14. zotcli-0.2.2/src/zotcli/cli/add.py +2267 -0
  15. {zotcli-0.1.3 → zotcli-0.2.2}/src/zotcli/cli/collections.py +41 -0
  16. zotcli-0.2.2/src/zotcli/cli/config_cmd.py +101 -0
  17. {zotcli-0.1.3 → zotcli-0.2.2}/src/zotcli/cli/items.py +74 -4
  18. zotcli-0.2.2/src/zotcli/cli/main.py +142 -0
  19. zotcli-0.2.2/src/zotcli/config.py +329 -0
  20. zotcli-0.2.2/src/zotcli/logging_setup.py +108 -0
  21. zotcli-0.2.2/src/zotcli/paths.py +100 -0
  22. zotcli-0.2.2/src/zotcli/queries/search.py +292 -0
  23. zotcli-0.2.2/src/zotcli/write/__init__.py +5 -0
  24. zotcli-0.2.2/src/zotcli/write/browser.py +321 -0
  25. zotcli-0.2.2/src/zotcli/write/citation_pipeline.py +228 -0
  26. zotcli-0.2.2/src/zotcli/write/collection_assign.py +57 -0
  27. zotcli-0.2.2/src/zotcli/write/connector_client.py +529 -0
  28. zotcli-0.2.2/src/zotcli/write/credentials.py +162 -0
  29. zotcli-0.2.2/src/zotcli/write/csl_json.py +268 -0
  30. zotcli-0.2.2/src/zotcli/write/dedup.py +186 -0
  31. zotcli-0.2.2/src/zotcli/write/identifiers.py +225 -0
  32. zotcli-0.2.2/src/zotcli/write/pdf.py +190 -0
  33. zotcli-0.2.2/src/zotcli/write/preflight.py +81 -0
  34. zotcli-0.2.2/src/zotcli/write/recognize.py +92 -0
  35. zotcli-0.2.2/src/zotcli/write/resolvers/__init__.py +65 -0
  36. zotcli-0.2.2/src/zotcli/write/resolvers/arxiv.py +174 -0
  37. zotcli-0.2.2/src/zotcli/write/resolvers/crossref.py +237 -0
  38. zotcli-0.2.2/src/zotcli/write/resolvers/ieee.py +220 -0
  39. zotcli-0.2.2/src/zotcli/write/resolvers/openalex.py +275 -0
  40. zotcli-0.2.2/src/zotcli/write/resolvers/openlibrary.py +153 -0
  41. zotcli-0.2.2/src/zotcli/write/resolvers/pubmed.py +229 -0
  42. zotcli-0.2.2/src/zotcli/write/resolvers/sciencedirect.py +173 -0
  43. zotcli-0.2.2/src/zotcli/write/resolvers/semantic_scholar.py +135 -0
  44. zotcli-0.2.2/src/zotcli/write/resolvers/unpaywall.py +144 -0
  45. zotcli-0.2.2/src/zotcli/write/session.py +255 -0
  46. {zotcli-0.1.3 → zotcli-0.2.2}/tests/conftest.py +7 -0
  47. zotcli-0.2.2/tests/fixtures/csl/crossref_numpy.json +52 -0
  48. zotcli-0.2.2/tests/fixtures/sample.bib +11 -0
  49. zotcli-0.2.2/tests/fixtures/sample.epub +0 -0
  50. zotcli-0.2.2/tests/fixtures/sample.pdf +25 -0
  51. zotcli-0.2.2/tests/fixtures/sample.ris +14 -0
  52. zotcli-0.2.2/tests/integration/__init__.py +0 -0
  53. zotcli-0.2.2/tests/integration/test_add_cite.py +316 -0
  54. zotcli-0.2.2/tests/integration/test_add_file.py +340 -0
  55. zotcli-0.2.2/tests/integration/test_add_import.py +388 -0
  56. zotcli-0.2.2/tests/integration/test_add_pipeline.py +522 -0
  57. zotcli-0.2.2/tests/integration/test_add_url.py +343 -0
  58. zotcli-0.2.2/tests/integration/test_auto_detect.py +339 -0
  59. zotcli-0.2.2/tests/integration/test_batch.py +335 -0
  60. zotcli-0.2.2/tests/integration/test_connector_client.py +115 -0
  61. zotcli-0.2.2/tests/integration/test_verbose.py +210 -0
  62. zotcli-0.2.2/tests/integration/test_with_pdf.py +382 -0
  63. {zotcli-0.1.3 → zotcli-0.2.2}/tests/test_cli.py +40 -2
  64. {zotcli-0.1.3 → zotcli-0.2.2}/tests/test_queries.py +63 -3
  65. zotcli-0.2.2/tests/unit/__init__.py +0 -0
  66. zotcli-0.2.2/tests/unit/test_browser_optional_dep.py +139 -0
  67. zotcli-0.2.2/tests/unit/test_citation_pipeline.py +368 -0
  68. zotcli-0.2.2/tests/unit/test_config_write_section.py +148 -0
  69. zotcli-0.2.2/tests/unit/test_credentials.py +178 -0
  70. zotcli-0.2.2/tests/unit/test_csl_json.py +309 -0
  71. zotcli-0.2.2/tests/unit/test_dedup.py +360 -0
  72. zotcli-0.2.2/tests/unit/test_identifiers.py +304 -0
  73. zotcli-0.2.2/tests/unit/test_logging_setup.py +143 -0
  74. zotcli-0.2.2/tests/unit/test_paths.py +199 -0
  75. zotcli-0.2.2/tests/unit/test_pdf.py +262 -0
  76. zotcli-0.2.2/tests/unit/test_recognize.py +216 -0
  77. zotcli-0.2.2/tests/unit/test_resolvers/__init__.py +0 -0
  78. zotcli-0.2.2/tests/unit/test_resolvers/test_arxiv.py +136 -0
  79. zotcli-0.2.2/tests/unit/test_resolvers/test_crossref.py +103 -0
  80. zotcli-0.2.2/tests/unit/test_resolvers/test_crossref_search.py +135 -0
  81. zotcli-0.2.2/tests/unit/test_resolvers/test_ieee.py +217 -0
  82. zotcli-0.2.2/tests/unit/test_resolvers/test_openalex.py +171 -0
  83. zotcli-0.2.2/tests/unit/test_resolvers/test_openlibrary.py +96 -0
  84. zotcli-0.2.2/tests/unit/test_resolvers/test_pubmed.py +126 -0
  85. zotcli-0.2.2/tests/unit/test_resolvers/test_sciencedirect.py +174 -0
  86. zotcli-0.2.2/tests/unit/test_resolvers/test_semantic_scholar.py +169 -0
  87. zotcli-0.2.2/tests/unit/test_resolvers/test_unpaywall.py +235 -0
  88. zotcli-0.1.3/SKILL.md +0 -228
  89. zotcli-0.1.3/docs/commands.md +0 -182
  90. zotcli-0.1.3/src/zotcli/cli/main.py +0 -71
  91. zotcli-0.1.3/src/zotcli/config.py +0 -78
  92. zotcli-0.1.3/src/zotcli/queries/search.py +0 -133
  93. {zotcli-0.1.3 → zotcli-0.2.2}/.github/workflows/docs.yml +0 -0
  94. {zotcli-0.1.3 → zotcli-0.2.2}/.github/workflows/publish.yml +0 -0
  95. {zotcli-0.1.3 → zotcli-0.2.2}/docs/api_reference.md +0 -0
  96. {zotcli-0.1.3 → zotcli-0.2.2}/docs/cli_reference.md +0 -0
  97. {zotcli-0.1.3 → zotcli-0.2.2}/docs/data_models.md +0 -0
  98. {zotcli-0.1.3 → zotcli-0.2.2}/mkdocs.yml +0 -0
  99. {zotcli-0.1.3 → zotcli-0.2.2}/src/zotcli/__main__.py +0 -0
  100. {zotcli-0.1.3 → zotcli-0.2.2}/src/zotcli/cli/__init__.py +0 -0
  101. {zotcli-0.1.3 → zotcli-0.2.2}/src/zotcli/cli/attachments.py +0 -0
  102. {zotcli-0.1.3 → zotcli-0.2.2}/src/zotcli/cli/export.py +0 -0
  103. {zotcli-0.1.3 → zotcli-0.2.2}/src/zotcli/cli/render.py +0 -0
  104. {zotcli-0.1.3 → zotcli-0.2.2}/src/zotcli/cli/search.py +0 -0
  105. {zotcli-0.1.3 → zotcli-0.2.2}/src/zotcli/cli/stats.py +0 -0
  106. {zotcli-0.1.3 → zotcli-0.2.2}/src/zotcli/db.py +0 -0
  107. {zotcli-0.1.3 → zotcli-0.2.2}/src/zotcli/export/__init__.py +0 -0
  108. {zotcli-0.1.3 → zotcli-0.2.2}/src/zotcli/export/bibtex.py +0 -0
  109. {zotcli-0.1.3 → zotcli-0.2.2}/src/zotcli/export/csv_.py +0 -0
  110. {zotcli-0.1.3 → zotcli-0.2.2}/src/zotcli/export/json_.py +0 -0
  111. {zotcli-0.1.3 → zotcli-0.2.2}/src/zotcli/export/markdown.py +0 -0
  112. {zotcli-0.1.3 → zotcli-0.2.2}/src/zotcli/models.py +0 -0
  113. {zotcli-0.1.3 → zotcli-0.2.2}/src/zotcli/queries/__init__.py +0 -0
  114. {zotcli-0.1.3 → zotcli-0.2.2}/src/zotcli/queries/attachments.py +0 -0
  115. {zotcli-0.1.3 → zotcli-0.2.2}/src/zotcli/queries/collections.py +0 -0
  116. {zotcli-0.1.3 → zotcli-0.2.2}/src/zotcli/queries/items.py +0 -0
  117. {zotcli-0.1.3 → zotcli-0.2.2}/src/zotcli/queries/tags.py +0 -0
  118. {zotcli-0.1.3 → zotcli-0.2.2}/test_script.py +0 -0
  119. {zotcli-0.1.3 → zotcli-0.2.2}/tests/__init__.py +0 -0
  120. {zotcli-0.1.3 → zotcli-0.2.2}/tests/test_db.py +0 -0
  121. {zotcli-0.1.3 → zotcli-0.2.2}/tests/test_export.py +0 -0
  122. {zotcli-0.1.3 → zotcli-0.2.2}/zot.png +0 -0
  123. {zotcli-0.1.3 → zotcli-0.2.2}/zotcli.code-workspace +0 -0
@@ -4,6 +4,12 @@
4
4
  PLAN.md
5
5
  Instructions.md
6
6
 
7
+ # Research checkout — Zotero upstream sources used only for lookup
8
+ zotero-sources-lookup/
9
+
10
+ # Self-contained zotcli runtime data (config / cookies / cache / logs)
11
+ .zotcli/
12
+
7
13
  site/
8
14
 
9
15
  tests/__pycache__/*
@@ -0,0 +1,139 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ ## [0.2.2] — 2026-05-19
6
+
7
+ ### Added
8
+
9
+ - **`zot items fulltext`** — retrieve item full text with a tiered fallback strategy: direct network access (DOI/URL) → configured library credentials → Playwright interactive auth → local Zotero fulltext index → metadata fallback (title/abstract/notes). Supports `--offline`, `--playwright-auth/--no-playwright-auth`, `--max-chars`.
10
+ - **`zot config library-auth`** — store or display per-library institution/username/password credentials used by `zot items fulltext` for paywalled retrieval. Credentials persist under `[library_auth.<id>]` in `config.toml`.
11
+ - **Fulltext search** — `zot search "query" --fulltext` searches against the local Zotero fulltext index.
12
+
13
+ ### Fixed
14
+
15
+ - **`save_config` crashed on `None` values** — when calling `tomli_w.dump`, `None` defaults (e.g. `database.path = None`) raised `TypeError: Object of type 'NoneType' is not TOML serializable`. Now strips `None` entries before serialising.
16
+
17
+ ### Merged
18
+
19
+ - Combined `feat/write-capability` (M1–M6 write subsystem) with PR #1 (network-first fulltext retrieval) onto a single linear history on `master`.
20
+
21
+ ## [0.2.1] — 2026-05-17
22
+
23
+ ### Added
24
+
25
+ - **`zot collections assign`** — assign an existing item to a collection. Writes a single row to the `collectionItems` join table (no sync-critical metadata involved; safe while Zotero is open).
26
+ - **Collection membership check** — `zot collections show` now indicates whether a given item belongs to the collection.
27
+
28
+ ### Fixed
29
+
30
+ - `updateSession` payload — connector requires `target` as a flat string, not a wrapped object; saveItems calls with an empty body no longer fail.
31
+
32
+ ## [0.2.0] — 2026-05-10
33
+
34
+ ### Added
35
+
36
+ - **`zot add` command group** — adds items to Zotero via its local connector HTTP server (port 23119). Zotero must be running; `zotero.sqlite` is never modified directly.
37
+ - **Smart auto-detect dispatcher** — bare `zot add "<anything>"` identifies DOI, arXiv ID, PMID, ISBN, IEEE/ScienceDirect URL, citation string, or local file path automatically.
38
+ - **`zot add doi`** — resolve via Crossref, send to Zotero. Supports `--collection`, `--tag`, `--dry-run`, `--with-pdf`, `--on-duplicate`.
39
+ - **`zot add arxiv`** — resolve via arXiv Atom feed → CSL-JSON.
40
+ - **`zot add pmid`** — resolve via NCBI eutils.
41
+ - **`zot add isbn`** — resolve via OpenLibrary (Google Books fallback).
42
+ - **`zot add cite`** — free-text citation string → Crossref bibliographic search → DOI; fallback OpenAlex then Semantic Scholar. Interactive disambiguation table when confidence is low. `--file` for batch citation files.
43
+ - **`zot add url`** — auto-routes arXiv/PubMed/IEEE/ScienceDirect/doi.org URLs to the relevant resolver; generic URLs fall back to `saveSnapshot`.
44
+ - **`zot add file`** — stream a local PDF or EPUB to `/connector/saveStandaloneAttachment`; polls for Zotero's `RecognizeDocument` result (configurable timeout, default 30 s).
45
+ - **`zot add import`** — POST raw RIS / BibTeX / CSL-JSON bytes to `/connector/import`.
46
+ - **`zot add batch`** — process a file of mixed inputs (one per line); summary table at end; non-zero exit if any line failed.
47
+ - **`zot add login`** — manage service credentials: Unpaywall (email), IEEE Xplore (browser SSO), ScienceDirect (browser SSO). `--reset` to clear. `--install-browser` for first-time Playwright Chromium install.
48
+ - **`--with-pdf` flag** on doi/arxiv/pmid/isbn/cite/url — attach an open-access PDF using Unpaywall; fall back to publisher cookies (IEEE/Elsevier) if browser-authenticated.
49
+ - **`zot add status`** — preflight check: reports Zotero reachability, selected collection, and connector URL.
50
+ - **`zot config` command group** — `get`, `set`, `path` subcommands for reading and writing `<zotcli-home>/config.toml`.
51
+ - **Self-contained data directory** (`<zotcli-home>`) — resolved via `ZOTCLI_HOME` env → SKILL.md sibling search → `~/.zotcli`. Holds `config.toml`, `credentials.json`, `cookies/`, `cache/`, `logs/`.
52
+ - **Write gate** — `write.enabled = false` by default. Enable once with `zot config set write.enabled true`, or pass `--allow-write` / set `ZOTCLI_ALLOW_WRITE=1` per command.
53
+ - **Duplicate detection** (report-only by default) — on duplicate DOI/arXiv, prints existing item key + title and exits 0; no mutation.
54
+ - **`--dry-run`** on all add subcommands — resolves metadata and prints the payload that would be sent, without contacting the connector.
55
+ - **`-v` / `--verbose`** — echoes every HTTP request and response to stderr.
56
+ - **`--non-interactive`** — suppresses all prompts; used in scripts and agent contexts.
57
+ - **Rotating log** at `<zotcli-home>/logs/zot.log` (1 MB × 3 backups).
58
+ - **Optional dependency groups**: `write = ["httpx>=0.27"]`, `browser = ["playwright>=1.40"]`, `all` aggregates all extras.
59
+ - **441 unit + integration tests** (up from 40 in v0.1.3). e2e tests are opt-in (`pytest -m e2e`).
60
+ - **`docs/architecture-write.md`** — maintainer-facing overview of the write-path design.
61
+
62
+ ### Changed
63
+
64
+ - `README.md` and `SKILL.md` updated to document write capability and correct the "never writes" framing. The accurate framing is: default is strictly read-only; writes require opt-in and go through Zotero's connector.
65
+ - `pyproject.toml` description updated; version bumped to 0.2.0.
66
+ - `docs/commands.md` extended with full `zot add` and `zot config` reference.
67
+ - SKILL.md `description:` frontmatter now advertises both reading and writing.
68
+
69
+ ### Fixed
70
+
71
+ - Click 8.2 `mix_stderr` keyword removal (M5 fix).
72
+ - `RotatingFileHandler` lock-pairing bug in logging setup (M5 fix).
73
+ - `updateSession` target correctly sent as flat string, not nested object (M2 fix).
74
+
75
+ ### Deferred to v0.3
76
+
77
+ - Edit / delete existing items — blocked on Zotero local API not yet supporting writes, or requires shipping a `.xpi` plugin. Tracked in `PLAN_WRITE.md §12`.
78
+ - Parallel connector calls in `zot add batch` (`--jobs N` accepted but no-op; sequential connector calls are safe; parallel resolver lookups deferred).
79
+ - Group library targeting beyond current-selection default.
80
+
81
+ ### Manual smoke test
82
+
83
+ Run the following commands against a live Zotero instance before tagging v0.2.0:
84
+
85
+ ```bash
86
+ # Sanity
87
+ zot --version
88
+ zot stats
89
+
90
+ # Write gate
91
+ zot config set write.enabled true
92
+ zot config get write.enabled # should print "true"
93
+ zot config path # should print <zotcli-home>
94
+
95
+ # Preflight
96
+ zot add status # should report Zotero as reachable
97
+
98
+ # Add by identifier
99
+ zot add doi 10.1038/s41586-020-2649-2 --collection Inbox --dry-run
100
+ zot add doi 10.1038/s41586-020-2649-2 --collection Inbox --tag smoke-test
101
+ zot add arxiv 2401.12345 --collection Preprints
102
+ zot add pmid 31452104
103
+ zot add isbn 978-0-262-03384-8 --collection Books
104
+
105
+ # Add by URL
106
+ zot add url https://ieeexplore.ieee.org/document/9876543
107
+ zot add url https://www.sciencedirect.com/science/article/pii/S2352467725000102
108
+
109
+ # Free-text citation
110
+ zot add cite "Zhang, J., Geth, F., Heidari, R., Verbič, G. (2025) Beyond simplifications: Evaluating assumptions for low-voltage network modelling in the DER era."
111
+
112
+ # Local file
113
+ zot add file ./paper.pdf --collection Inbox
114
+
115
+ # Import
116
+ zot add import refs.bib --collection "Imports/test"
117
+
118
+ # Batch
119
+ printf '10.1109/TPWRS.2023.1234567\n2401.12345\n' > /tmp/papers.txt
120
+ zot add batch /tmp/papers.txt --collection "Batch Test"
121
+
122
+ # Paywalled PDF (optional: requires prior login)
123
+ zot add login --service unpaywall
124
+ zot add doi 10.1038/s41586-020-2649-2 --with-pdf
125
+ ```
126
+
127
+ ---
128
+
129
+ ## [0.1.3] — 2026-04-13
130
+
131
+ ### Added
132
+
133
+ - Item export command (`zot export`) with JSON, CSV, BibTeX, and Markdown formats.
134
+ - Collection display improvements and recursive collection traversal.
135
+
136
+ ### Fixed
137
+
138
+ - Removed unsupported schema version warnings from schema validation.
139
+ - Database path auto-detection clarified for Linux, macOS, and Windows.