draftwatch 0.1.0__tar.gz → 0.2.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 (25) hide show
  1. draftwatch-0.2.0/PKG-INFO +127 -0
  2. draftwatch-0.2.0/README.md +105 -0
  3. {draftwatch-0.1.0 → draftwatch-0.2.0}/draftwatch/app.py +649 -40
  4. draftwatch-0.2.0/draftwatch/assets/codemirror.js +28 -0
  5. draftwatch-0.2.0/draftwatch/assets/xterm.css +218 -0
  6. draftwatch-0.2.0/draftwatch/assets/xterm.js +9 -0
  7. draftwatch-0.2.0/draftwatch/term.py +246 -0
  8. draftwatch-0.2.0/draftwatch.egg-info/PKG-INFO +127 -0
  9. {draftwatch-0.1.0 → draftwatch-0.2.0}/draftwatch.egg-info/SOURCES.txt +4 -1
  10. {draftwatch-0.1.0 → draftwatch-0.2.0}/pyproject.toml +1 -1
  11. draftwatch-0.1.0/PKG-INFO +0 -112
  12. draftwatch-0.1.0/README.md +0 -90
  13. draftwatch-0.1.0/draftwatch/assets/codemirror.js +0 -28
  14. draftwatch-0.1.0/draftwatch.egg-info/PKG-INFO +0 -112
  15. {draftwatch-0.1.0 → draftwatch-0.2.0}/LICENSE +0 -0
  16. {draftwatch-0.1.0 → draftwatch-0.2.0}/draftwatch/__init__.py +0 -0
  17. {draftwatch-0.1.0 → draftwatch-0.2.0}/draftwatch/__main__.py +0 -0
  18. {draftwatch-0.1.0 → draftwatch-0.2.0}/draftwatch/assets/marked.js +0 -0
  19. {draftwatch-0.1.0 → draftwatch-0.2.0}/draftwatch/assets/purify.js +0 -0
  20. {draftwatch-0.1.0 → draftwatch-0.2.0}/draftwatch/assets/turndown.js +0 -0
  21. {draftwatch-0.1.0 → draftwatch-0.2.0}/draftwatch.egg-info/dependency_links.txt +0 -0
  22. {draftwatch-0.1.0 → draftwatch-0.2.0}/draftwatch.egg-info/entry_points.txt +0 -0
  23. {draftwatch-0.1.0 → draftwatch-0.2.0}/draftwatch.egg-info/requires.txt +0 -0
  24. {draftwatch-0.1.0 → draftwatch-0.2.0}/draftwatch.egg-info/top_level.txt +0 -0
  25. {draftwatch-0.1.0 → draftwatch-0.2.0}/setup.cfg +0 -0
@@ -0,0 +1,127 @@
1
+ Metadata-Version: 2.4
2
+ Name: draftwatch
3
+ Version: 0.2.0
4
+ Summary: Review an AI agent's edits to your writing files as a real git word-diff — keep or revert changes hunk by hunk, then commit.
5
+ Author: Mike Konczal
6
+ License: MIT
7
+ Keywords: git,diff,writing,review,ai,agent,markdown
8
+ Classifier: Development Status :: 4 - Beta
9
+ Classifier: Environment :: Web Environment
10
+ Classifier: Intended Audience :: End Users/Desktop
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Operating System :: OS Independent
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Topic :: Text Editors
15
+ Classifier: Topic :: Software Development :: Version Control :: Git
16
+ Requires-Python: >=3.9
17
+ Description-Content-Type: text/markdown
18
+ License-File: LICENSE
19
+ Provides-Extra: app
20
+ Requires-Dist: pywebview>=4.0; extra == "app"
21
+ Dynamic: license-file
22
+
23
+ # Draftwatch
24
+
25
+ Draftwatch is a lightweight IDE for writers. You can use it to create and format new Markdown documents from scratch, or use it to review an AI agent's edits to your writing exactly the way a developer reviews a pull request.
26
+
27
+ When reviewing AI edits, instead of guessing what an LLM changed in your document, Draftwatch shows you the exact, git-backed word-diff. You can step through, keep or revert each change individually, and commit when you're done.
28
+
29
+ Crucially, the diff comes from your local git—not from the AI vendor and not from a JavaScript approximation. You get absolute, independent verification of what the agent or script actually did.
30
+
31
+ Python 3.9+ and git are the only requirements. The front-end libraries (CodeMirror 6, marked, DOMPurify, Turndown, xterm.js) are vendored and served locally, so Draftwatch works completely offline and binds to localhost only.
32
+
33
+ ## Install
34
+
35
+ Draftwatch is available on PyPI. You can install or run it using your preferred Python package manager:
36
+
37
+ ```bash
38
+ # pipx
39
+ pipx install draftwatch
40
+
41
+ # uv
42
+ uv tool install draftwatch
43
+
44
+ # standard pip
45
+ pip install draftwatch
46
+ ```
47
+
48
+ ## Usage
49
+
50
+ Run it from inside a git repository you write in:
51
+
52
+ ```bash
53
+ draftwatch
54
+ ```
55
+
56
+ Or to start with a specific file:
57
+
58
+ ```bash
59
+ draftwatch draft.md
60
+ ```
61
+
62
+ You can also run it outside any git repository. Draftwatch starts in
63
+ **write-only mode** — the editor, preview, and saving all work, but the review
64
+ loop (diffs, revert, commit) is off because there's no git to compare against.
65
+ The right panel offers a one-click **initialize git here** to turn the folder
66
+ into a repo and switch on the full review loop.
67
+
68
+ Starting a second instance while one is already running just works: if the
69
+ default port is busy, Draftwatch picks a free one and prints the URL.
70
+
71
+ Draftwatch opens a two-panel review window: your source on the left (a real editor with markdown highlighting, search, and a live preview), the diff against your baseline on the right. Review the changes, revert the ones you don't want, apply, then commit. Committing advances the baseline, so the next agent pass starts clean.
72
+
73
+ Start without a file (`draftwatch`) to pick one in the window.
74
+
75
+ ### Options
76
+
77
+ ```
78
+ draftwatch [target] [--port 8787] [--no-open] [--no-terminal] [--app | --no-app]
79
+ ```
80
+
81
+ - `target`: file to watch. Optional; omit it to pick one in the UI.
82
+ - `--port`: default `8787`. If omitted and the default is busy, Draftwatch
83
+ picks a free port automatically; pass `--port` to pin an exact one (it then
84
+ fails loudly if that port is taken).
85
+ - `--no-open`: don't auto-open a window (useful headless or over SSH).
86
+ - `--no-terminal`: disable the embedded terminal panel entirely (its routes are removed from the server, not just hidden in the UI).
87
+ - `--app` / `--no-app`: force or disable the native window. It is on by default when pywebview is installed and falls back to the browser otherwise.
88
+
89
+ ## The terminal panel
90
+
91
+ Click **terminal** in the toolbar to open a third panel running a real shell in your repo (macOS/Linux). Launch `claude`, `codex`, or any command there: when the agent edits the file you're watching, the diff panel lights up live — prompt on the right, review in the middle, write on the left. **hide** collapses the panel and leaves the shell running (an agent mid-task keeps working); **end session** kills the shell and everything it started. No snapshots are taken when you run commands — edits accumulate against whatever baseline you've selected, and you review them on your schedule. On Windows the panel is unavailable and Draftwatch simply runs without it.
92
+
93
+ ## Features
94
+
95
+ - Real git word-diffs, so what you see is exactly what git sees.
96
+ - Keep or revert changes one hunk at a time, or all at once, then commit from the UI.
97
+ - Switchable baseline: last push, HEAD, or an earlier commit.
98
+ - Jump between changes or collapse to a changes-only view for long documents.
99
+ - Editable markdown preview alongside the raw source.
100
+ - You and the agent can both edit; your unsaved work is never clobbered when the file changes on disk.
101
+ - Embedded terminal panel (macOS/Linux): run your agent next to the diff without leaving the window.
102
+ - Resizable panels: drag the dividers to change the split (double-click to reset).
103
+
104
+ ## Security
105
+
106
+ Draftwatch binds `127.0.0.1` only — there is deliberately no option to bind another interface, so the tool is never exposed on your network. Every request carries a per-session token, the Host and Origin headers are validated to defeat DNS-rebinding, and the markdown preview is sanitized with DOMPurify before rendering. The tool never talks to any LLM.
107
+
108
+ The terminal panel is a real shell, so it gets extra care: its input routes accept the session token **only** as a request header (keystrokes never appear in URLs, browser history, or logs), the server pipes bytes to the PTY without ever parsing them, ending a session kills the shell's whole process group, and no shell outlives Draftwatch. `--no-terminal` removes the feature from the server entirely.
109
+
110
+ ## Tests
111
+
112
+ ```bash
113
+ python3 testing/test_reconstruct.py # reconstruction invariants
114
+ python3 testing/test_acceptance.py # end-to-end server tests
115
+ ```
116
+
117
+ ## Development
118
+
119
+ The front-end libraries are vendored into `draftwatch/assets/` and committed, so end users never need Node. To rebuild them: `npm install && npm run build:vendor`.
120
+
121
+ ## Author
122
+
123
+ Built by Mike Konczal. Vibe-coded with Fable 5.
124
+
125
+ ## License
126
+
127
+ MIT. See `LICENSE`.
@@ -0,0 +1,105 @@
1
+ # Draftwatch
2
+
3
+ Draftwatch is a lightweight IDE for writers. You can use it to create and format new Markdown documents from scratch, or use it to review an AI agent's edits to your writing exactly the way a developer reviews a pull request.
4
+
5
+ When reviewing AI edits, instead of guessing what an LLM changed in your document, Draftwatch shows you the exact, git-backed word-diff. You can step through, keep or revert each change individually, and commit when you're done.
6
+
7
+ Crucially, the diff comes from your local git—not from the AI vendor and not from a JavaScript approximation. You get absolute, independent verification of what the agent or script actually did.
8
+
9
+ Python 3.9+ and git are the only requirements. The front-end libraries (CodeMirror 6, marked, DOMPurify, Turndown, xterm.js) are vendored and served locally, so Draftwatch works completely offline and binds to localhost only.
10
+
11
+ ## Install
12
+
13
+ Draftwatch is available on PyPI. You can install or run it using your preferred Python package manager:
14
+
15
+ ```bash
16
+ # pipx
17
+ pipx install draftwatch
18
+
19
+ # uv
20
+ uv tool install draftwatch
21
+
22
+ # standard pip
23
+ pip install draftwatch
24
+ ```
25
+
26
+ ## Usage
27
+
28
+ Run it from inside a git repository you write in:
29
+
30
+ ```bash
31
+ draftwatch
32
+ ```
33
+
34
+ Or to start with a specific file:
35
+
36
+ ```bash
37
+ draftwatch draft.md
38
+ ```
39
+
40
+ You can also run it outside any git repository. Draftwatch starts in
41
+ **write-only mode** — the editor, preview, and saving all work, but the review
42
+ loop (diffs, revert, commit) is off because there's no git to compare against.
43
+ The right panel offers a one-click **initialize git here** to turn the folder
44
+ into a repo and switch on the full review loop.
45
+
46
+ Starting a second instance while one is already running just works: if the
47
+ default port is busy, Draftwatch picks a free one and prints the URL.
48
+
49
+ Draftwatch opens a two-panel review window: your source on the left (a real editor with markdown highlighting, search, and a live preview), the diff against your baseline on the right. Review the changes, revert the ones you don't want, apply, then commit. Committing advances the baseline, so the next agent pass starts clean.
50
+
51
+ Start without a file (`draftwatch`) to pick one in the window.
52
+
53
+ ### Options
54
+
55
+ ```
56
+ draftwatch [target] [--port 8787] [--no-open] [--no-terminal] [--app | --no-app]
57
+ ```
58
+
59
+ - `target`: file to watch. Optional; omit it to pick one in the UI.
60
+ - `--port`: default `8787`. If omitted and the default is busy, Draftwatch
61
+ picks a free port automatically; pass `--port` to pin an exact one (it then
62
+ fails loudly if that port is taken).
63
+ - `--no-open`: don't auto-open a window (useful headless or over SSH).
64
+ - `--no-terminal`: disable the embedded terminal panel entirely (its routes are removed from the server, not just hidden in the UI).
65
+ - `--app` / `--no-app`: force or disable the native window. It is on by default when pywebview is installed and falls back to the browser otherwise.
66
+
67
+ ## The terminal panel
68
+
69
+ Click **terminal** in the toolbar to open a third panel running a real shell in your repo (macOS/Linux). Launch `claude`, `codex`, or any command there: when the agent edits the file you're watching, the diff panel lights up live — prompt on the right, review in the middle, write on the left. **hide** collapses the panel and leaves the shell running (an agent mid-task keeps working); **end session** kills the shell and everything it started. No snapshots are taken when you run commands — edits accumulate against whatever baseline you've selected, and you review them on your schedule. On Windows the panel is unavailable and Draftwatch simply runs without it.
70
+
71
+ ## Features
72
+
73
+ - Real git word-diffs, so what you see is exactly what git sees.
74
+ - Keep or revert changes one hunk at a time, or all at once, then commit from the UI.
75
+ - Switchable baseline: last push, HEAD, or an earlier commit.
76
+ - Jump between changes or collapse to a changes-only view for long documents.
77
+ - Editable markdown preview alongside the raw source.
78
+ - You and the agent can both edit; your unsaved work is never clobbered when the file changes on disk.
79
+ - Embedded terminal panel (macOS/Linux): run your agent next to the diff without leaving the window.
80
+ - Resizable panels: drag the dividers to change the split (double-click to reset).
81
+
82
+ ## Security
83
+
84
+ Draftwatch binds `127.0.0.1` only — there is deliberately no option to bind another interface, so the tool is never exposed on your network. Every request carries a per-session token, the Host and Origin headers are validated to defeat DNS-rebinding, and the markdown preview is sanitized with DOMPurify before rendering. The tool never talks to any LLM.
85
+
86
+ The terminal panel is a real shell, so it gets extra care: its input routes accept the session token **only** as a request header (keystrokes never appear in URLs, browser history, or logs), the server pipes bytes to the PTY without ever parsing them, ending a session kills the shell's whole process group, and no shell outlives Draftwatch. `--no-terminal` removes the feature from the server entirely.
87
+
88
+ ## Tests
89
+
90
+ ```bash
91
+ python3 testing/test_reconstruct.py # reconstruction invariants
92
+ python3 testing/test_acceptance.py # end-to-end server tests
93
+ ```
94
+
95
+ ## Development
96
+
97
+ The front-end libraries are vendored into `draftwatch/assets/` and committed, so end users never need Node. To rebuild them: `npm install && npm run build:vendor`.
98
+
99
+ ## Author
100
+
101
+ Built by Mike Konczal. Vibe-coded with Fable 5.
102
+
103
+ ## License
104
+
105
+ MIT. See `LICENSE`.