priorwork 0.2.3__tar.gz → 0.2.4__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 (98) hide show
  1. {priorwork-0.2.3 → priorwork-0.2.4}/PKG-INFO +1 -1
  2. {priorwork-0.2.3 → priorwork-0.2.4}/priorwork/__init__.py +1 -1
  3. {priorwork-0.2.3 → priorwork-0.2.4}/priorwork/check.py +12 -2
  4. {priorwork-0.2.3 → priorwork-0.2.4}/priorwork/cli.py +3 -1
  5. {priorwork-0.2.3 → priorwork-0.2.4}/priorwork/lang_ja.py +7 -0
  6. {priorwork-0.2.3 → priorwork-0.2.4}/priorwork/octavo.py +2 -1
  7. {priorwork-0.2.3 → priorwork-0.2.4}/priorwork/requests.py +8 -0
  8. {priorwork-0.2.3 → priorwork-0.2.4}/priorwork/survey.py +1 -1
  9. {priorwork-0.2.3 → priorwork-0.2.4}/priorwork.egg-info/PKG-INFO +1 -1
  10. {priorwork-0.2.3 → priorwork-0.2.4}/pyproject.toml +1 -1
  11. {priorwork-0.2.3 → priorwork-0.2.4}/tests/test_cli_json.py +1 -1
  12. {priorwork-0.2.3 → priorwork-0.2.4}/tests/test_octavo.py +7 -0
  13. {priorwork-0.2.3 → priorwork-0.2.4}/tests/test_worktree.py +16 -0
  14. {priorwork-0.2.3 → priorwork-0.2.4}/LICENSE +0 -0
  15. {priorwork-0.2.3 → priorwork-0.2.4}/README.md +0 -0
  16. {priorwork-0.2.3 → priorwork-0.2.4}/priorwork/__main__.py +0 -0
  17. {priorwork-0.2.3 → priorwork-0.2.4}/priorwork/ai.py +0 -0
  18. {priorwork-0.2.3 → priorwork-0.2.4}/priorwork/api.py +0 -0
  19. {priorwork-0.2.3 → priorwork-0.2.4}/priorwork/assets/en/AGENTS.md +0 -0
  20. {priorwork-0.2.3 → priorwork-0.2.4}/priorwork/assets/en/skills/priorwork/SKILL.md +0 -0
  21. {priorwork-0.2.3 → priorwork-0.2.4}/priorwork/assets/en/skills/priorwork-audit/SKILL.md +0 -0
  22. {priorwork-0.2.3 → priorwork-0.2.4}/priorwork/assets/en/skills/priorwork-check/SKILL.md +0 -0
  23. {priorwork-0.2.3 → priorwork-0.2.4}/priorwork/assets/en/skills/priorwork-derive/SKILL.md +0 -0
  24. {priorwork-0.2.3 → priorwork-0.2.4}/priorwork/assets/en/skills/priorwork-extract/SKILL.md +0 -0
  25. {priorwork-0.2.3 → priorwork-0.2.4}/priorwork/assets/en/skills/priorwork-manuscript/SKILL.md +0 -0
  26. {priorwork-0.2.3 → priorwork-0.2.4}/priorwork/assets/en/skills/priorwork-new/SKILL.md +0 -0
  27. {priorwork-0.2.3 → priorwork-0.2.4}/priorwork/assets/en/skills/priorwork-screen/SKILL.md +0 -0
  28. {priorwork-0.2.3 → priorwork-0.2.4}/priorwork/assets/en/skills/priorwork-snowball/SKILL.md +0 -0
  29. {priorwork-0.2.3 → priorwork-0.2.4}/priorwork/assets/en/templates/literature_review.md +0 -0
  30. {priorwork-0.2.3 → priorwork-0.2.4}/priorwork/assets/en/templates/manuscript.md +0 -0
  31. {priorwork-0.2.3 → priorwork-0.2.4}/priorwork/assets/en/templates/medical_review.md +0 -0
  32. {priorwork-0.2.3 → priorwork-0.2.4}/priorwork/assets/env.example +0 -0
  33. {priorwork-0.2.3 → priorwork-0.2.4}/priorwork/assets/ja/AGENTS.md +0 -0
  34. {priorwork-0.2.3 → priorwork-0.2.4}/priorwork/assets/ja/skills/priorwork/SKILL.md +0 -0
  35. {priorwork-0.2.3 → priorwork-0.2.4}/priorwork/assets/ja/skills/priorwork-audit/SKILL.md +0 -0
  36. {priorwork-0.2.3 → priorwork-0.2.4}/priorwork/assets/ja/skills/priorwork-check/SKILL.md +0 -0
  37. {priorwork-0.2.3 → priorwork-0.2.4}/priorwork/assets/ja/skills/priorwork-derive/SKILL.md +0 -0
  38. {priorwork-0.2.3 → priorwork-0.2.4}/priorwork/assets/ja/skills/priorwork-extract/SKILL.md +0 -0
  39. {priorwork-0.2.3 → priorwork-0.2.4}/priorwork/assets/ja/skills/priorwork-manuscript/SKILL.md +0 -0
  40. {priorwork-0.2.3 → priorwork-0.2.4}/priorwork/assets/ja/skills/priorwork-new/SKILL.md +0 -0
  41. {priorwork-0.2.3 → priorwork-0.2.4}/priorwork/assets/ja/skills/priorwork-screen/SKILL.md +0 -0
  42. {priorwork-0.2.3 → priorwork-0.2.4}/priorwork/assets/ja/skills/priorwork-snowball/SKILL.md +0 -0
  43. {priorwork-0.2.3 → priorwork-0.2.4}/priorwork/assets/ja/templates/literature_review.md +0 -0
  44. {priorwork-0.2.3 → priorwork-0.2.4}/priorwork/assets/ja/templates/manuscript.md +0 -0
  45. {priorwork-0.2.3 → priorwork-0.2.4}/priorwork/assets/ja/templates/medical_review.md +0 -0
  46. {priorwork-0.2.3 → priorwork-0.2.4}/priorwork/derived.py +0 -0
  47. {priorwork-0.2.3 → priorwork-0.2.4}/priorwork/docs/reference.ja.md +0 -0
  48. {priorwork-0.2.3 → priorwork-0.2.4}/priorwork/docs/reference.md +0 -0
  49. {priorwork-0.2.3 → priorwork-0.2.4}/priorwork/docsref.py +0 -0
  50. {priorwork-0.2.3 → priorwork-0.2.4}/priorwork/doctor.py +0 -0
  51. {priorwork-0.2.3 → priorwork-0.2.4}/priorwork/export.py +0 -0
  52. {priorwork-0.2.3 → priorwork-0.2.4}/priorwork/fulltext.py +0 -0
  53. {priorwork-0.2.3 → priorwork-0.2.4}/priorwork/i18n.py +0 -0
  54. {priorwork-0.2.3 → priorwork-0.2.4}/priorwork/machine.py +0 -0
  55. {priorwork-0.2.3 → priorwork-0.2.4}/priorwork/manuscript.py +0 -0
  56. {priorwork-0.2.3 → priorwork-0.2.4}/priorwork/scaffold.py +0 -0
  57. {priorwork-0.2.3 → priorwork-0.2.4}/priorwork/scan.py +0 -0
  58. {priorwork-0.2.3 → priorwork-0.2.4}/priorwork/settings.py +0 -0
  59. {priorwork-0.2.3 → priorwork-0.2.4}/priorwork/snowball.py +0 -0
  60. {priorwork-0.2.3 → priorwork-0.2.4}/priorwork/ssci.py +0 -0
  61. {priorwork-0.2.3 → priorwork-0.2.4}/priorwork/workspace.py +0 -0
  62. {priorwork-0.2.3 → priorwork-0.2.4}/priorwork/worktree.py +0 -0
  63. {priorwork-0.2.3 → priorwork-0.2.4}/priorwork/zotero.py +0 -0
  64. {priorwork-0.2.3 → priorwork-0.2.4}/priorwork.egg-info/SOURCES.txt +0 -0
  65. {priorwork-0.2.3 → priorwork-0.2.4}/priorwork.egg-info/dependency_links.txt +0 -0
  66. {priorwork-0.2.3 → priorwork-0.2.4}/priorwork.egg-info/entry_points.txt +0 -0
  67. {priorwork-0.2.3 → priorwork-0.2.4}/priorwork.egg-info/requires.txt +0 -0
  68. {priorwork-0.2.3 → priorwork-0.2.4}/priorwork.egg-info/top_level.txt +0 -0
  69. {priorwork-0.2.3 → priorwork-0.2.4}/setup.cfg +0 -0
  70. {priorwork-0.2.3 → priorwork-0.2.4}/tests/test_api.py +0 -0
  71. {priorwork-0.2.3 → priorwork-0.2.4}/tests/test_check_cards.py +0 -0
  72. {priorwork-0.2.3 → priorwork-0.2.4}/tests/test_check_citations.py +0 -0
  73. {priorwork-0.2.3 → priorwork-0.2.4}/tests/test_check_depth.py +0 -0
  74. {priorwork-0.2.3 → priorwork-0.2.4}/tests/test_check_fulltext_cli.py +0 -0
  75. {priorwork-0.2.3 → priorwork-0.2.4}/tests/test_docs_commands.py +0 -0
  76. {priorwork-0.2.3 → priorwork-0.2.4}/tests/test_doctor.py +0 -0
  77. {priorwork-0.2.3 → priorwork-0.2.4}/tests/test_english.py +0 -0
  78. {priorwork-0.2.3 → priorwork-0.2.4}/tests/test_export.py +0 -0
  79. {priorwork-0.2.3 → priorwork-0.2.4}/tests/test_extension.py +0 -0
  80. {priorwork-0.2.3 → priorwork-0.2.4}/tests/test_fulltext_reading.py +0 -0
  81. {priorwork-0.2.3 → priorwork-0.2.4}/tests/test_i18n.py +0 -0
  82. {priorwork-0.2.3 → priorwork-0.2.4}/tests/test_journal_search.py +0 -0
  83. {priorwork-0.2.3 → priorwork-0.2.4}/tests/test_machine.py +0 -0
  84. {priorwork-0.2.3 → priorwork-0.2.4}/tests/test_manuscript.py +0 -0
  85. {priorwork-0.2.3 → priorwork-0.2.4}/tests/test_manuscript_read.py +0 -0
  86. {priorwork-0.2.3 → priorwork-0.2.4}/tests/test_medical.py +0 -0
  87. {priorwork-0.2.3 → priorwork-0.2.4}/tests/test_ocr.py +0 -0
  88. {priorwork-0.2.3 → priorwork-0.2.4}/tests/test_requests_6.py +0 -0
  89. {priorwork-0.2.3 → priorwork-0.2.4}/tests/test_scaffold.py +0 -0
  90. {priorwork-0.2.3 → priorwork-0.2.4}/tests/test_search_zotero.py +0 -0
  91. {priorwork-0.2.3 → priorwork-0.2.4}/tests/test_settings.py +0 -0
  92. {priorwork-0.2.3 → priorwork-0.2.4}/tests/test_site.py +0 -0
  93. {priorwork-0.2.3 → priorwork-0.2.4}/tests/test_ssci.py +0 -0
  94. {priorwork-0.2.3 → priorwork-0.2.4}/tests/test_survey.py +0 -0
  95. {priorwork-0.2.3 → priorwork-0.2.4}/tests/test_survey_fugu.py +0 -0
  96. {priorwork-0.2.3 → priorwork-0.2.4}/tests/test_survey_notes.py +0 -0
  97. {priorwork-0.2.3 → priorwork-0.2.4}/tests/test_survey_pay.py +0 -0
  98. {priorwork-0.2.3 → priorwork-0.2.4}/tests/test_zotero_sync.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: priorwork
3
- Version: 0.2.3
3
+ Version: 0.2.4
4
4
  Summary: Build literature reviews for the social sciences and clinical research in conversation with an AI agent (Semantic Scholar + OpenAlex + PubMed)
5
5
  Author: yoshida-kd
6
6
  License-Expression: MIT
@@ -1,3 +1,3 @@
1
1
  """priorwork — build literature reviews for the social sciences and clinical research in conversation with an AI agent."""
2
2
 
3
- __version__ = "0.2.3"
3
+ __version__ = "0.2.4"
@@ -635,7 +635,12 @@ def _check_one_octavo(survey: Survey, md: str, info: dict) -> List[Finding]:
635
635
  theirs = info["zotero_collections"]
636
636
  ours = survey.zotero_collection.get("name", "")
637
637
  shown = ", ".join(f'"{c}"' for c in theirs)
638
- if theirs and ours and not any(within_collection(ours, c) for c in theirs):
638
+ # Octavo の zotero_linked(サーベイごとのコレクション): .bib には入らないが、`octavo bib tidy` が引用された論文を
639
+ # 主のコレクションに足す
640
+ linked = bool(ours) and any(within_collection(ours, c) for c in info.get("zotero_linked") or [])
641
+ if linked:
642
+ pass
643
+ elif theirs and ours and not any(within_collection(ours, c) for c in theirs):
639
644
  findings.append((WARN, t("The Zotero collection of the survey (\"{ours}\") is not among those the Octavo "
640
645
  "project {project} pulls its .bib from ({theirs}), nor under them, so its papers will "
641
646
  "not reach the .bib. Add it in Octavo (Choose the Zotero Collection), or link the "
@@ -661,7 +666,12 @@ def _check_one_octavo(survey: Survey, md: str, info: dict) -> List[Finding]:
661
666
  except RuntimeError:
662
667
  cited = set()
663
668
  in_text = [e for e in absent if e["key"] in cited]
664
- if in_text:
669
+ if in_text and linked:
670
+ findings.append((WARN, t("The text written for the Octavo project {project} cites {n|# paper|# papers} not in "
671
+ "its .bib: {numbers}. The survey's collection is linked there, so in Octavo run "
672
+ "`octavo bib tidy --apply` (it adds cited papers to the main collection), then "
673
+ "`octavo bib pull`", project=project, n=len(in_text), numbers=_numbers(in_text))))
674
+ elif in_text:
665
675
  findings.append((WARN, t("The text written for the Octavo project {project} cites {n|# paper|# papers} not in "
666
676
  "its .bib: {numbers}. Add {n|it|them} to its Zotero collection, then `octavo bib pull`",
667
677
  project=project, n=len(in_text), numbers=_numbers(in_text))))
@@ -491,7 +491,9 @@ def cmd_status(args, client):
491
491
  for p in s.octavo_projects:
492
492
  print(t("Octavo project: {root} | .bib: {bib} | Zotero collections: {collections}", root=p["root"],
493
493
  bib=(Path(p["bib"]).name if p["bib"] else "-") + ("" if p["bib_exists"] else " " + t("(not there yet)")),
494
- collections=", ".join(p["zotero_collections"]) or t("(not set)")))
494
+ collections=", ".join(p["zotero_collections"]) or t("(not set)"))
495
+ + (" | " + t("linked: {collections}", collections=", ".join(p["zotero_linked"]))
496
+ if p.get("zotero_linked") else ""))
495
497
  roots = {p["root"] for p in s.octavo_projects}
496
498
  if roots:
497
499
  others = [o for o in Survey.list_all() if o.name != s.name and roots & {p["root"] for p in o.octavo_projects}]
@@ -960,6 +960,13 @@ MESSAGES = {
960
960
  "サーベイをそのどれかに結び付けてください(`priorwork zotero {name} --collection \"<パス>\"`)",
961
961
  "The sections on the literature (theories, methods, debates, gaps) are not written yet":
962
962
  "先行研究のまとめの節(学説・手法・論争・空白)がまだ書かれていません",
963
+ "The text written for the Octavo project {project} cites {n|# paper|# papers} not in its .bib: {numbers}. The "
964
+ "survey's collection is linked there, so in Octavo run `octavo bib tidy --apply` (it adds cited papers to the main "
965
+ "collection), then `octavo bib pull`":
966
+ "Octavo のプロジェクト {project} 用の文章が、その .bib に無い論文を {n} 本引いています: {numbers}。"
967
+ "サーベイのコレクションはそのプロジェクトに結び付いている(zotero_linked)ので、Octavo で `octavo bib tidy --apply`"
968
+ "(引用された論文を主のコレクションに足す)を実行してから `octavo bib pull` を実行してください",
969
+ "linked: {collections}": "結び付いたもの: {collections}",
963
970
  "The text written for the Octavo project {project} cites {n|# paper|# papers} not in its .bib: {numbers}. Add "
964
971
  "{n|it|them} to its Zotero collection, then `octavo bib pull`":
965
972
  "Octavo のプロジェクト {project} 用の文章が、その .bib に無い論文を {n} 本引いています: {numbers}。"
@@ -108,7 +108,8 @@ def project_info(root: Path) -> Dict[str, Any]:
108
108
  cfg = read_config(root)
109
109
  bib = root / (cfg.get("bib_file") or DEFAULT_BIB)
110
110
  return {"root": str(root), "name": root.name, "bib": str(bib), "bib_exists": bib.is_file(),
111
- "zotero_collections": collections_of(cfg.get("zotero_collection"))}
111
+ "zotero_collections": collections_of(cfg.get("zotero_collection")),
112
+ "zotero_linked": collections_of(cfg.get("zotero_linked"))}
112
113
 
113
114
 
114
115
  def within_collection(ours: str, theirs: str) -> bool:
@@ -31,6 +31,14 @@ class RequestError(Exception):
31
31
 
32
32
 
33
33
  def requests_dir(root: Path) -> Path:
34
+ """受け取り場所。ワークスペースに 1 つで、サーベイの worktree の中からも本体のものを見る(Git に入らないので、
35
+ worktree には無い)。"""
36
+ if (root / ".git").is_file(): # worktree(.git がファイル)
37
+ from .worktree import WorktreeError, main_root
38
+ try:
39
+ root = main_root(root)
40
+ except WorktreeError:
41
+ pass
34
42
  return meta_dir(root) / "requests"
35
43
 
36
44
 
@@ -731,7 +731,7 @@ class Survey:
731
731
  path = self.root / rel
732
732
  found = octavo.find_project(path) if path.exists() else None
733
733
  info = octavo.project_info(found) if found else {"root": str(path), "name": Path(rel).name, "bib": "",
734
- "bib_exists": False, "zotero_collections": [],
734
+ "bib_exists": False, "zotero_collections": [], "zotero_linked": [],
735
735
  "missing": True}
736
736
  if all(info["root"] != o["root"] for o in out):
737
737
  out.append({**info, "manuscript": False})
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: priorwork
3
- Version: 0.2.3
3
+ Version: 0.2.4
4
4
  Summary: Build literature reviews for the social sciences and clinical research in conversation with an AI agent (Semantic Scholar + OpenAlex + PubMed)
5
5
  Author: yoshida-kd
6
6
  License-Expression: MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "priorwork"
7
- version = "0.2.3"
7
+ version = "0.2.4"
8
8
  description = "Build literature reviews for the social sciences and clinical research in conversation with an AI agent (Semantic Scholar + OpenAlex + PubMed)"
9
9
  readme = "README.md"
10
10
  license = "MIT"
@@ -120,7 +120,7 @@ def test_the_extension_reads_only_keys_the_cli_writes():
120
120
  "zotero_collection", "archived", "counts", "searches"},
121
121
  "SurveyDetail": {"scope", "unfilled", "zotero_missing", "zotero_write", "zotero_written", "written_by", "audits", "octavo", "octavo_projects",
122
122
  "sync", "next"},
123
- "OctavoProject": {"root", "name", "bib", "bib_exists", "zotero_collections", "manuscript", "missing"},
123
+ "OctavoProject": {"root", "name", "bib", "bib_exists", "zotero_collections", "zotero_linked", "manuscript", "missing"},
124
124
  "Audit": {"at", "by", "note", "included"},
125
125
  "ZoteroCollectionLink": {"key", "name"},
126
126
  "ZoteroCollections": {"collections"},
@@ -143,6 +143,13 @@ def test_check_compares_the_zotero_collections(ws, tmp_path): # noqa: F811
143
143
  s.save()
144
144
  found = [m for lvl, m in cli.check_survey(Survey.load("mw"), None)]
145
145
  assert any("Minimum wages" in m and "Other" in m for m in found), found
146
+ # Octavo の zotero_linked にあれば(サーベイごとのコレクション)、食い違いではない
147
+ cfg = tmp_path / "proj" / "octavo.config.py"
148
+ cfg.write_text(cfg.read_text().replace("'zotero_collection': 'Minimum wages'",
149
+ "'zotero_collection': 'Minimum wages', 'zotero_linked': ['Other']"))
150
+ assert Survey.load("mw").octavo["zotero_linked"] == ["Other"]
151
+ found = [m for lvl, m in cli.check_survey(Survey.load("mw"), None)]
152
+ assert not any("Minimum wages" in m and "Other" in m for m in found), found
146
153
 
147
154
 
148
155
  def test_a_manuscript_outside_the_workspace_is_kept_relative(tmp_path):
@@ -183,3 +183,19 @@ def test_without_git_it_is_made_here(tmp_path):
183
183
  done = pw(root, "new", "T", "--slug", "nogit", "--json")
184
184
  assert "worktree" not in json.loads(done.stdout) and "not in a worktree" in done.stderr
185
185
  assert pw(root, "new", "T", "--slug", "nogit2", "--worktree", ok=False).returncode != 0
186
+
187
+
188
+ def test_a_request_from_octavo_is_closed_from_the_worktree(ws):
189
+ """Octavo の依頼はワークスペースの本体に置かれる(Git に入らない)。worktree のサーベイで閉じられる。"""
190
+ fixture = json.loads((Path(__file__).parent / "fixtures" / "request.json").read_text(encoding="utf-8"))
191
+ inbox = ws / ".priorwork" / "requests"
192
+ inbox.mkdir(parents=True, exist_ok=True)
193
+ (inbox / f"{fixture['id']}.json").write_text(json.dumps(fixture), encoding="utf-8")
194
+ out = made(ws)
195
+ tree = Path(out["worktree"])
196
+ listed = json.loads(pw(tree, "requests", "--json").stdout)["requests"]
197
+ assert [r["id"] for r in listed] == [fixture["id"]]
198
+ pw(tree, "requests", fixture["id"], "--done", "--survey", out["name"])
199
+ closed = json.loads((inbox / f"{fixture['id']}.json").read_text(encoding="utf-8"))
200
+ assert closed["status"] == "done" and closed["survey"] == out["name"]
201
+ assert not (tree / ".priorwork" / "requests").exists()
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes