Stage 1 flags the living documents a pull request makes stale (no model, nothing sent). Stage 2, on repositories that opt in with drafter: claude, has Claude Code draft the edits in a sandboxed copy of the tree and opens them as a pull request into the feature branch. A monthly pass re-reads the top-level documents against the whole repository. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
commit
ade847ba5b
38 files changed
+4286
No files matched your search
@@ -0,0 +1,52 @@
|
||||
import unittest
|
||||
|
||||
from docs_review.changes import Change, changed_names, parse_name_status
|
||||
|
||||
|
||||
class ParseNameStatusTests(unittest.TestCase):
|
||||
def test_statuses(self):
|
||||
text = "A\ta.R\nM\tb.R\nD\tc.R\nR087\told.R\tnew.R\nC100\tx.R\ty.R\nT\tz.R\n"
|
||||
self.assertEqual(
|
||||
parse_name_status(text),
|
||||
(
|
||||
Change("A", "a.R", None),
|
||||
Change("M", "b.R", None),
|
||||
Change("D", "c.R", None),
|
||||
Change("R", "new.R", "old.R"),
|
||||
Change("M", "y.R", None),
|
||||
Change("M", "z.R", None),
|
||||
),
|
||||
)
|
||||
|
||||
def test_blank_lines_ignored(self):
|
||||
self.assertEqual(parse_name_status("\n\n"), ())
|
||||
|
||||
|
||||
class ChangedNamesTests(unittest.TestCase):
|
||||
def test_changed_names_are_net(self):
|
||||
diff = (
|
||||
"diff --git a/R/a.R b/R/a.R\n--- a/R/a.R\n+++ b/R/a.R\n"
|
||||
"-fit_old <- function(x) {\n+fit_new <- function(x) {\n"
|
||||
"-keep_me <- function() 1\n+keep_me <- function() 2\n"
|
||||
)
|
||||
self.assertEqual(
|
||||
changed_names(diff), (frozenset({"fit_new"}), frozenset({"fit_old"}))
|
||||
)
|
||||
|
||||
def test_targets_config_and_ignored_files(self):
|
||||
diff = (
|
||||
"diff --git a/_targets.R b/_targets.R\n--- a/_targets.R\n+++ b/_targets.R\n"
|
||||
"+ tar_target(fresh_table, 1)\n"
|
||||
"+ab = function() 1\n"
|
||||
"diff --git a/config.yml b/config.yml\n--- a/config.yml\n+++ b/config.yml\n"
|
||||
"+top_key: 1\n- nested_key: 2\n"
|
||||
"diff --git a/notes.py b/notes.py\n--- a/notes.py\n+++ b/notes.py\n"
|
||||
"+other_name <- function() 1\n"
|
||||
)
|
||||
self.assertEqual(
|
||||
changed_names(diff), (frozenset({"fresh_table", "top_key"}), frozenset())
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in new issue
Block a user