cite2site 1.0.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.
- cite2site-1.0.0/LICENSE +21 -0
- cite2site-1.0.0/PKG-INFO +156 -0
- cite2site-1.0.0/README.md +131 -0
- cite2site-1.0.0/pyproject.toml +37 -0
- cite2site-1.0.0/setup.cfg +4 -0
- cite2site-1.0.0/src/c2s/__init__.py +24 -0
- cite2site-1.0.0/src/c2s/__main__.py +4 -0
- cite2site-1.0.0/src/c2s/_context_menu.py +44 -0
- cite2site-1.0.0/src/c2s/adapter.py +436 -0
- cite2site-1.0.0/src/c2s/cli.py +167 -0
- cite2site-1.0.0/src/c2s/core.py +1186 -0
- cite2site-1.0.0/src/cite2site.egg-info/PKG-INFO +156 -0
- cite2site-1.0.0/src/cite2site.egg-info/SOURCES.txt +19 -0
- cite2site-1.0.0/src/cite2site.egg-info/dependency_links.txt +1 -0
- cite2site-1.0.0/src/cite2site.egg-info/entry_points.txt +2 -0
- cite2site-1.0.0/src/cite2site.egg-info/requires.txt +1 -0
- cite2site-1.0.0/src/cite2site.egg-info/top_level.txt +1 -0
- cite2site-1.0.0/tests/test_adapter_conformance.py +440 -0
- cite2site-1.0.0/tests/test_first_slice.py +416 -0
- cite2site-1.0.0/tests/test_integration_thin_client.py +149 -0
- cite2site-1.0.0/tests/test_migration_fixtures.py +200 -0
cite2site-1.0.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Cite2Site contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
cite2site-1.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: cite2site
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Source-clean citations that don't touch your files. Record evidence outside the file, replay it to check if it still holds.
|
|
5
|
+
Author: Cite2Site contributors
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/paragon-ux/Cite2Site
|
|
8
|
+
Project-URL: Documentation, https://paragon-ux.github.io/Cite2Site/
|
|
9
|
+
Project-URL: Repository, https://github.com/paragon-ux/Cite2Site
|
|
10
|
+
Keywords: citations,evidence,verification,source-clean,append-only,cli
|
|
11
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Intended Audience :: Science/Research
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Topic :: Scientific/Engineering
|
|
18
|
+
Classifier: Topic :: Text Processing
|
|
19
|
+
Classifier: Topic :: Software Development :: Documentation
|
|
20
|
+
Requires-Python: >=3.11
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
Requires-Dist: context-menu
|
|
24
|
+
Dynamic: license-file
|
|
25
|
+
|
|
26
|
+
# Cite2Site
|
|
27
|
+
|
|
28
|
+
**v1.0** — Source-clean citations that don't touch your files.
|
|
29
|
+
|
|
30
|
+
Cite2Site lets you point at evidence — in code, in a doc, on a page —
|
|
31
|
+
without leaving a mark on it. Every citation lives in a separate,
|
|
32
|
+
append-only ledger. Replay that history at any time and Cite2Site tells
|
|
33
|
+
you whether the evidence still holds: still there, changed, gone, or —
|
|
34
|
+
when it genuinely can't verify — it says so instead of guessing.
|
|
35
|
+
|
|
36
|
+
## Why doesn't it touch my files?
|
|
37
|
+
|
|
38
|
+
Most citation tools want to write something into the thing you're citing —
|
|
39
|
+
a comment, a bookmark, a hidden ID. That falls apart the moment the source
|
|
40
|
+
isn't yours to edit: a shared PDF, someone else's code, an exported chat
|
|
41
|
+
log, a spreadsheet with strict formatting. Cite2Site sidesteps that
|
|
42
|
+
entirely:
|
|
43
|
+
|
|
44
|
+
```text
|
|
45
|
+
select evidence -> source-clean citation -> inspectable citation projection
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
The current implementation uses the CLI. Integration contracts and reference
|
|
49
|
+
examples for editor, browser, and document-tool builders are delivered;
|
|
50
|
+
native right-click plugins are deferred.
|
|
51
|
+
|
|
52
|
+
The source file never changes. Citations live in a dedicated `.c2s`
|
|
53
|
+
repository as an append-only history, and everything you see — status,
|
|
54
|
+
exports, the published site — is generated by replaying that history
|
|
55
|
+
against the current state of your files.
|
|
56
|
+
|
|
57
|
+
## Quick Start — Human Path (Right-Click)
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
pip install cite2site
|
|
61
|
+
c2s init
|
|
62
|
+
echo "Alpha claim" > notes.md
|
|
63
|
+
c2s cite-selection --artifact notes.md --start 0 --end 11 --handle ALPHA
|
|
64
|
+
|
|
65
|
+
# Install the right-click context menu
|
|
66
|
+
c2s install-context-menu
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Right-click any file in Explorer → **Cite2Site → Look up citations here** to
|
|
70
|
+
see what citations exist at that position. **Cite selection here** to create
|
|
71
|
+
a new citation.
|
|
72
|
+
|
|
73
|
+
The `lookup-actions` command behind the menu is the same contract editor
|
|
74
|
+
plugins and browser extensions call. See the **[Integration Contract](build-docs/architecture/INTEGRATION_CONTRACT.md)**
|
|
75
|
+
for the API, and the **[User Guide](build-docs/guides/USER_GUIDE.md)** for
|
|
76
|
+
everyday workflows.
|
|
77
|
+
|
|
78
|
+
To uninstall: `c2s uninstall-context-menu`.
|
|
79
|
+
|
|
80
|
+
## Quick Start — Agent Path (CLI)
|
|
81
|
+
|
|
82
|
+
Agents and automation use the deterministic JSON CLI. Install, init, cite,
|
|
83
|
+
query, export:
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
pip install cite2site
|
|
87
|
+
echo -e "Alpha claim\nBeta claim\n" > notes.md
|
|
88
|
+
c2s init
|
|
89
|
+
c2s cite-selection --artifact notes.md --start 0 --end 11 --handle NOTE-1
|
|
90
|
+
c2s citations --artifact notes.md --format json
|
|
91
|
+
c2s export
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Every command returns JSON. Errors are structured. Citations never touch
|
|
95
|
+
your files. See the **[Agent Guide](build-docs/guides/AGENT_GUIDE.md)** for
|
|
96
|
+
batch operations, workflow commands, and the full agent contract.
|
|
97
|
+
|
|
98
|
+
A few things worth knowing:
|
|
99
|
+
|
|
100
|
+
- **Handles are aliases, not identity.** Rename one anytime — the
|
|
101
|
+
underlying citation ID never changes.
|
|
102
|
+
- **Publication policy defaults to metadata-only.** Default exports omit
|
|
103
|
+
accepted evidence text; richer snippet and private-link modes require
|
|
104
|
+
explicit repository authorization.
|
|
105
|
+
- **The source artifact is never rewritten**, no matter which command you
|
|
106
|
+
run.
|
|
107
|
+
|
|
108
|
+
## Where things stand
|
|
109
|
+
|
|
110
|
+
Cite2Site v1.0 is a working CLI tool for text and Markdown files. It creates
|
|
111
|
+
source-clean citations, validates hash chains, replays citation history
|
|
112
|
+
against current files, and exports grouped JSON and MkDocs sites — all with
|
|
113
|
+
metadata-only privacy by default. 98 tests cover the core engine.
|
|
114
|
+
|
|
115
|
+
Beyond text and Markdown, a **ConverterAdapter** turns DOCX, PDF, and XLSX
|
|
116
|
+
into canonical text by shelling out to standard converters (pandoc for DOCX,
|
|
117
|
+
pdftotext for PDF). The architecture separates *how you get text out of an
|
|
118
|
+
artifact* from *how citation history, verification, and replay work* — new
|
|
119
|
+
formats extend the first part without touching the second. When a converter
|
|
120
|
+
isn't available, Cite2Site reports the limitation honestly rather than
|
|
121
|
+
returning a guess.
|
|
122
|
+
|
|
123
|
+
The v1 stable contract is frozen: 15 CLI commands, 7 event types, 38 stable
|
|
124
|
+
error codes, 4 privacy modes, and 6 schema identifiers. See
|
|
125
|
+
[`build-docs/internal/CURRENT_STATUS_MATRIX.md`](build-docs/internal/CURRENT_STATUS_MATRIX.md)
|
|
126
|
+
for the full capability inventory.
|
|
127
|
+
|
|
128
|
+
## Guides
|
|
129
|
+
|
|
130
|
+
- **[User Guide](build-docs/guides/USER_GUIDE.md)** — everyday commands,
|
|
131
|
+
fixing mistakes, handles, publishing, batch citations, error codes.
|
|
132
|
+
- **[Agent Guide](build-docs/guides/AGENT_GUIDE.md)** — deterministic JSON CLI,
|
|
133
|
+
agent workflows, batch schema, privacy modes, integration contract.
|
|
134
|
+
- **[Integration Contract](build-docs/architecture/INTEGRATION_CONTRACT.md)** —
|
|
135
|
+
for editor, browser, and document-tool builders.
|
|
136
|
+
- **[v1 Stable Contract](build-docs/architecture/V1_STABLE_CONTRACT.md)** —
|
|
137
|
+
every frozen command, event field, error code, projection field, and URL shape.
|
|
138
|
+
|
|
139
|
+
## Running the tests
|
|
140
|
+
|
|
141
|
+
```bash
|
|
142
|
+
python -m unittest discover -s tests
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## If you're an agent picking this up
|
|
146
|
+
|
|
147
|
+
Start with [`AGENTS.md`](AGENTS.md). It has the reading order, the
|
|
148
|
+
invariants that keep citations trustworthy, and the session gate protocol
|
|
149
|
+
this project uses instead of ad-hoc review. Don't skip it — the short
|
|
150
|
+
version is "the source file is sacred, everything else is a replay."
|
|
151
|
+
|
|
152
|
+
## Digging deeper
|
|
153
|
+
|
|
154
|
+
The full build plan — requirements, workflows, whitepaper, protocol and
|
|
155
|
+
implementation specs, current status, and ADRs — lives under
|
|
156
|
+
[`build-docs/`](build-docs/README.md).
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
# Cite2Site
|
|
2
|
+
|
|
3
|
+
**v1.0** — Source-clean citations that don't touch your files.
|
|
4
|
+
|
|
5
|
+
Cite2Site lets you point at evidence — in code, in a doc, on a page —
|
|
6
|
+
without leaving a mark on it. Every citation lives in a separate,
|
|
7
|
+
append-only ledger. Replay that history at any time and Cite2Site tells
|
|
8
|
+
you whether the evidence still holds: still there, changed, gone, or —
|
|
9
|
+
when it genuinely can't verify — it says so instead of guessing.
|
|
10
|
+
|
|
11
|
+
## Why doesn't it touch my files?
|
|
12
|
+
|
|
13
|
+
Most citation tools want to write something into the thing you're citing —
|
|
14
|
+
a comment, a bookmark, a hidden ID. That falls apart the moment the source
|
|
15
|
+
isn't yours to edit: a shared PDF, someone else's code, an exported chat
|
|
16
|
+
log, a spreadsheet with strict formatting. Cite2Site sidesteps that
|
|
17
|
+
entirely:
|
|
18
|
+
|
|
19
|
+
```text
|
|
20
|
+
select evidence -> source-clean citation -> inspectable citation projection
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
The current implementation uses the CLI. Integration contracts and reference
|
|
24
|
+
examples for editor, browser, and document-tool builders are delivered;
|
|
25
|
+
native right-click plugins are deferred.
|
|
26
|
+
|
|
27
|
+
The source file never changes. Citations live in a dedicated `.c2s`
|
|
28
|
+
repository as an append-only history, and everything you see — status,
|
|
29
|
+
exports, the published site — is generated by replaying that history
|
|
30
|
+
against the current state of your files.
|
|
31
|
+
|
|
32
|
+
## Quick Start — Human Path (Right-Click)
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
pip install cite2site
|
|
36
|
+
c2s init
|
|
37
|
+
echo "Alpha claim" > notes.md
|
|
38
|
+
c2s cite-selection --artifact notes.md --start 0 --end 11 --handle ALPHA
|
|
39
|
+
|
|
40
|
+
# Install the right-click context menu
|
|
41
|
+
c2s install-context-menu
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Right-click any file in Explorer → **Cite2Site → Look up citations here** to
|
|
45
|
+
see what citations exist at that position. **Cite selection here** to create
|
|
46
|
+
a new citation.
|
|
47
|
+
|
|
48
|
+
The `lookup-actions` command behind the menu is the same contract editor
|
|
49
|
+
plugins and browser extensions call. See the **[Integration Contract](build-docs/architecture/INTEGRATION_CONTRACT.md)**
|
|
50
|
+
for the API, and the **[User Guide](build-docs/guides/USER_GUIDE.md)** for
|
|
51
|
+
everyday workflows.
|
|
52
|
+
|
|
53
|
+
To uninstall: `c2s uninstall-context-menu`.
|
|
54
|
+
|
|
55
|
+
## Quick Start — Agent Path (CLI)
|
|
56
|
+
|
|
57
|
+
Agents and automation use the deterministic JSON CLI. Install, init, cite,
|
|
58
|
+
query, export:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
pip install cite2site
|
|
62
|
+
echo -e "Alpha claim\nBeta claim\n" > notes.md
|
|
63
|
+
c2s init
|
|
64
|
+
c2s cite-selection --artifact notes.md --start 0 --end 11 --handle NOTE-1
|
|
65
|
+
c2s citations --artifact notes.md --format json
|
|
66
|
+
c2s export
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Every command returns JSON. Errors are structured. Citations never touch
|
|
70
|
+
your files. See the **[Agent Guide](build-docs/guides/AGENT_GUIDE.md)** for
|
|
71
|
+
batch operations, workflow commands, and the full agent contract.
|
|
72
|
+
|
|
73
|
+
A few things worth knowing:
|
|
74
|
+
|
|
75
|
+
- **Handles are aliases, not identity.** Rename one anytime — the
|
|
76
|
+
underlying citation ID never changes.
|
|
77
|
+
- **Publication policy defaults to metadata-only.** Default exports omit
|
|
78
|
+
accepted evidence text; richer snippet and private-link modes require
|
|
79
|
+
explicit repository authorization.
|
|
80
|
+
- **The source artifact is never rewritten**, no matter which command you
|
|
81
|
+
run.
|
|
82
|
+
|
|
83
|
+
## Where things stand
|
|
84
|
+
|
|
85
|
+
Cite2Site v1.0 is a working CLI tool for text and Markdown files. It creates
|
|
86
|
+
source-clean citations, validates hash chains, replays citation history
|
|
87
|
+
against current files, and exports grouped JSON and MkDocs sites — all with
|
|
88
|
+
metadata-only privacy by default. 98 tests cover the core engine.
|
|
89
|
+
|
|
90
|
+
Beyond text and Markdown, a **ConverterAdapter** turns DOCX, PDF, and XLSX
|
|
91
|
+
into canonical text by shelling out to standard converters (pandoc for DOCX,
|
|
92
|
+
pdftotext for PDF). The architecture separates *how you get text out of an
|
|
93
|
+
artifact* from *how citation history, verification, and replay work* — new
|
|
94
|
+
formats extend the first part without touching the second. When a converter
|
|
95
|
+
isn't available, Cite2Site reports the limitation honestly rather than
|
|
96
|
+
returning a guess.
|
|
97
|
+
|
|
98
|
+
The v1 stable contract is frozen: 15 CLI commands, 7 event types, 38 stable
|
|
99
|
+
error codes, 4 privacy modes, and 6 schema identifiers. See
|
|
100
|
+
[`build-docs/internal/CURRENT_STATUS_MATRIX.md`](build-docs/internal/CURRENT_STATUS_MATRIX.md)
|
|
101
|
+
for the full capability inventory.
|
|
102
|
+
|
|
103
|
+
## Guides
|
|
104
|
+
|
|
105
|
+
- **[User Guide](build-docs/guides/USER_GUIDE.md)** — everyday commands,
|
|
106
|
+
fixing mistakes, handles, publishing, batch citations, error codes.
|
|
107
|
+
- **[Agent Guide](build-docs/guides/AGENT_GUIDE.md)** — deterministic JSON CLI,
|
|
108
|
+
agent workflows, batch schema, privacy modes, integration contract.
|
|
109
|
+
- **[Integration Contract](build-docs/architecture/INTEGRATION_CONTRACT.md)** —
|
|
110
|
+
for editor, browser, and document-tool builders.
|
|
111
|
+
- **[v1 Stable Contract](build-docs/architecture/V1_STABLE_CONTRACT.md)** —
|
|
112
|
+
every frozen command, event field, error code, projection field, and URL shape.
|
|
113
|
+
|
|
114
|
+
## Running the tests
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
python -m unittest discover -s tests
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## If you're an agent picking this up
|
|
121
|
+
|
|
122
|
+
Start with [`AGENTS.md`](AGENTS.md). It has the reading order, the
|
|
123
|
+
invariants that keep citations trustworthy, and the session gate protocol
|
|
124
|
+
this project uses instead of ad-hoc review. Don't skip it — the short
|
|
125
|
+
version is "the source file is sacred, everything else is a replay."
|
|
126
|
+
|
|
127
|
+
## Digging deeper
|
|
128
|
+
|
|
129
|
+
The full build plan — requirements, workflows, whitepaper, protocol and
|
|
130
|
+
implementation specs, current status, and ADRs — lives under
|
|
131
|
+
[`build-docs/`](build-docs/README.md).
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=69"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "cite2site"
|
|
7
|
+
version = "1.0.0"
|
|
8
|
+
description = "Source-clean citations that don't touch your files. Record evidence outside the file, replay it to check if it still holds."
|
|
9
|
+
requires-python = ">=3.11"
|
|
10
|
+
dependencies = ["context-menu"]
|
|
11
|
+
license = "MIT"
|
|
12
|
+
license-files = ["LICENSE"]
|
|
13
|
+
readme = "README.md"
|
|
14
|
+
authors = [{name = "Cite2Site contributors"}]
|
|
15
|
+
keywords = ["citations", "evidence", "verification", "source-clean", "append-only", "cli"]
|
|
16
|
+
classifiers = [
|
|
17
|
+
"Development Status :: 5 - Production/Stable",
|
|
18
|
+
"Intended Audience :: Developers",
|
|
19
|
+
"Intended Audience :: Science/Research",
|
|
20
|
+
"Operating System :: OS Independent",
|
|
21
|
+
"Programming Language :: Python :: 3.11",
|
|
22
|
+
"Programming Language :: Python :: 3.12",
|
|
23
|
+
"Topic :: Scientific/Engineering",
|
|
24
|
+
"Topic :: Text Processing",
|
|
25
|
+
"Topic :: Software Development :: Documentation",
|
|
26
|
+
]
|
|
27
|
+
|
|
28
|
+
[project.urls]
|
|
29
|
+
Homepage = "https://github.com/paragon-ux/Cite2Site"
|
|
30
|
+
Documentation = "https://paragon-ux.github.io/Cite2Site/"
|
|
31
|
+
Repository = "https://github.com/paragon-ux/Cite2Site"
|
|
32
|
+
|
|
33
|
+
[project.scripts]
|
|
34
|
+
c2s = "c2s.cli:main"
|
|
35
|
+
|
|
36
|
+
[tool.setuptools.packages.find]
|
|
37
|
+
where = ["src"]
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"""Cite2Site first-slice implementation."""
|
|
2
|
+
|
|
3
|
+
__all__ = [
|
|
4
|
+
"__version__",
|
|
5
|
+
"BaseAdapter",
|
|
6
|
+
"FilesystemTextAdapter",
|
|
7
|
+
"MarkdownAdapter",
|
|
8
|
+
"AdapterArtifact",
|
|
9
|
+
"get_adapter",
|
|
10
|
+
"adapter_for_uri",
|
|
11
|
+
"adapter_diagnostics",
|
|
12
|
+
]
|
|
13
|
+
|
|
14
|
+
__version__ = "1.0.0"
|
|
15
|
+
|
|
16
|
+
from .adapter import ( # noqa: E402 — re-export after version
|
|
17
|
+
AdapterArtifact,
|
|
18
|
+
BaseAdapter,
|
|
19
|
+
FilesystemTextAdapter,
|
|
20
|
+
MarkdownAdapter,
|
|
21
|
+
adapter_diagnostics,
|
|
22
|
+
adapter_for_uri,
|
|
23
|
+
get_adapter,
|
|
24
|
+
)
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"""Windows context-menu integration for Cite2Site.
|
|
2
|
+
|
|
3
|
+
Provides `c2s install-context-menu` and `c2s uninstall-context-menu` CLI
|
|
4
|
+
commands. Registers Cite2Site entries in the Windows Explorer right-click
|
|
5
|
+
menu so users can look up citations and cite selections directly from any
|
|
6
|
+
file.
|
|
7
|
+
"""
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def _menu_entries() -> list[dict[str, str]]:
|
|
12
|
+
"""Return the context-menu entries to register."""
|
|
13
|
+
return [
|
|
14
|
+
{
|
|
15
|
+
"name": "Look up citations here",
|
|
16
|
+
"command": 'cmd /k c2s lookup-actions --artifact "%1" --start 0 --end 0',
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"name": "Cite selection here",
|
|
20
|
+
"command": 'cmd /k c2s cite-selection --artifact "%1" --start 0 --end 0',
|
|
21
|
+
},
|
|
22
|
+
]
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def install() -> None:
|
|
26
|
+
"""Register Cite2Site in the Windows Explorer context menu."""
|
|
27
|
+
from context_menu import menus
|
|
28
|
+
|
|
29
|
+
entries = [
|
|
30
|
+
menus.ContextCommand(name=e["name"], command=e["command"])
|
|
31
|
+
for e in _menu_entries()
|
|
32
|
+
]
|
|
33
|
+
menu = menus.ContextMenu(name="Cite2Site", type="FILES", entries=entries)
|
|
34
|
+
menu.compile()
|
|
35
|
+
print("Cite2Site added to Windows right-click menu.")
|
|
36
|
+
print("Right-click any file -> Cite2Site -> Look up citations here / Cite selection here")
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def uninstall() -> None:
|
|
40
|
+
"""Remove Cite2Site from the Windows Explorer context menu."""
|
|
41
|
+
from context_menu import menus
|
|
42
|
+
|
|
43
|
+
menus.ContextMenu(name="Cite2Site", type="FILES", entries=[]).remove()
|
|
44
|
+
print("Cite2Site removed from Windows right-click menu.")
|