docsweep 0.2.0__tar.gz → 0.3.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 (258) hide show
  1. docsweep-0.3.0/.githooks/pre-push +44 -0
  2. docsweep-0.3.0/.github/workflows/ci.yml +40 -0
  3. {docsweep-0.2.0 → docsweep-0.3.0}/.gitignore +1 -0
  4. {docsweep-0.2.0 → docsweep-0.3.0}/CHANGELOG.md +134 -0
  5. {docsweep-0.2.0 → docsweep-0.3.0}/CLAUDE.md +39 -19
  6. {docsweep-0.2.0 → docsweep-0.3.0}/PKG-INFO +20 -2
  7. {docsweep-0.2.0 → docsweep-0.3.0}/README.md +9 -1
  8. docsweep-0.3.0/assets/screenshots/webui-archive.png +0 -0
  9. docsweep-0.3.0/assets/screenshots/webui-todo.png +0 -0
  10. {docsweep-0.2.0 → docsweep-0.3.0}/docsweep/__init__.py +1 -1
  11. {docsweep-0.2.0 → docsweep-0.3.0}/docsweep/atomic.py +6 -3
  12. {docsweep-0.2.0 → docsweep-0.3.0}/docsweep/brief/service.py +7 -5
  13. {docsweep-0.2.0 → docsweep-0.3.0}/docsweep/capture/llm.py +1 -1
  14. docsweep-0.3.0/docsweep/capture/service.py +156 -0
  15. {docsweep-0.2.0 → docsweep-0.3.0}/docsweep/claim.py +11 -7
  16. docsweep-0.3.0/docsweep/cli/__init__.py +107 -0
  17. docsweep-0.3.0/docsweep/cli/commands/__init__.py +1 -0
  18. docsweep-0.3.0/docsweep/cli/commands/completion.py +22 -0
  19. docsweep-0.3.0/docsweep/cli/commands/excluded.py +129 -0
  20. docsweep-0.3.0/docsweep/cli/commands/ics.py +22 -0
  21. docsweep-0.3.0/docsweep/cli/commands/index.py +281 -0
  22. docsweep-0.3.0/docsweep/cli/commands/init.py +76 -0
  23. docsweep-0.3.0/docsweep/cli/commands/inject.py +62 -0
  24. docsweep-0.3.0/docsweep/cli/commands/mcp.py +28 -0
  25. docsweep-0.3.0/docsweep/cli/commands/memory.py +31 -0
  26. docsweep-0.3.0/docsweep/cli/commands/notify.py +28 -0
  27. docsweep-0.3.0/docsweep/cli/commands/read.py +687 -0
  28. docsweep-0.3.0/docsweep/cli/commands/serve.py +67 -0
  29. docsweep-0.3.0/docsweep/cli/commands/write.py +394 -0
  30. docsweep-0.3.0/docsweep/cli/parser.py +562 -0
  31. {docsweep-0.2.0 → docsweep-0.3.0}/docsweep/config.py +26 -2
  32. {docsweep-0.2.0 → docsweep-0.3.0}/docsweep/context.py +4 -5
  33. docsweep-0.3.0/docsweep/cookbook.py +64 -0
  34. docsweep-0.3.0/docsweep/day.py +119 -0
  35. {docsweep-0.2.0 → docsweep-0.3.0}/docsweep/detect.py +44 -24
  36. docsweep-0.3.0/docsweep/doctor.py +289 -0
  37. {docsweep-0.2.0 → docsweep-0.3.0}/docsweep/engine.py +30 -2
  38. docsweep-0.3.0/docsweep/excluded.py +124 -0
  39. {docsweep-0.2.0 → docsweep-0.3.0}/docsweep/find.py +23 -0
  40. docsweep-0.3.0/docsweep/fix_conflict.py +153 -0
  41. {docsweep-0.2.0 → docsweep-0.3.0}/docsweep/graph/service.py +40 -10
  42. docsweep-0.3.0/docsweep/hints.py +43 -0
  43. docsweep-0.3.0/docsweep/history.py +64 -0
  44. docsweep-0.3.0/docsweep/ics_export.py +61 -0
  45. docsweep-0.3.0/docsweep/init_cmd.py +141 -0
  46. docsweep-0.3.0/docsweep/inject/__init__.py +62 -0
  47. docsweep-0.3.0/docsweep/inject/agent_claude.py +8 -0
  48. docsweep-0.3.0/docsweep/inject/agent_codex.py +42 -0
  49. docsweep-0.2.0/docsweep/inject.py → docsweep-0.3.0/docsweep/inject/api.py +66 -135
  50. docsweep-0.3.0/docsweep/inject/blocks.py +71 -0
  51. docsweep-0.3.0/docsweep/inject/manifest.py +38 -0
  52. docsweep-0.3.0/docsweep/intent.py +80 -0
  53. {docsweep-0.2.0 → docsweep-0.3.0}/docsweep/interactive.py +36 -30
  54. {docsweep-0.2.0 → docsweep-0.3.0}/docsweep/mcp_server.py +53 -1
  55. docsweep-0.3.0/docsweep/memory_scan.py +87 -0
  56. docsweep-0.3.0/docsweep/migrate.py +258 -0
  57. {docsweep-0.2.0 → docsweep-0.3.0}/docsweep/models.py +5 -0
  58. docsweep-0.3.0/docsweep/notify.py +111 -0
  59. {docsweep-0.2.0 → docsweep-0.3.0}/docsweep/related.py +4 -5
  60. {docsweep-0.2.0 → docsweep-0.3.0}/docsweep/resurrect/similarity.py +1 -1
  61. {docsweep-0.2.0 → docsweep-0.3.0}/docsweep/scan.py +18 -4
  62. docsweep-0.3.0/docsweep/secrets_guard.py +37 -0
  63. {docsweep-0.2.0 → docsweep-0.3.0}/docsweep/server/app.py +102 -18
  64. {docsweep-0.2.0 → docsweep-0.3.0}/docsweep/server/i18n.py +40 -0
  65. {docsweep-0.2.0 → docsweep-0.3.0}/docsweep/server/routes/board.py +312 -26
  66. {docsweep-0.2.0 → docsweep-0.3.0}/docsweep/server/routes/brief.py +4 -11
  67. {docsweep-0.2.0 → docsweep-0.3.0}/docsweep/server/routes/capture.py +10 -12
  68. {docsweep-0.2.0 → docsweep-0.3.0}/docsweep/server/routes/cards.py +12 -20
  69. {docsweep-0.2.0 → docsweep-0.3.0}/docsweep/server/routes/cross.py +4 -11
  70. {docsweep-0.2.0 → docsweep-0.3.0}/docsweep/server/routes/graph.py +4 -11
  71. {docsweep-0.2.0 → docsweep-0.3.0}/docsweep/server/routes/resurrect.py +4 -11
  72. docsweep-0.3.0/docsweep/server/sanitize.py +55 -0
  73. {docsweep-0.2.0 → docsweep-0.3.0}/docsweep/server/security.py +33 -0
  74. {docsweep-0.2.0 → docsweep-0.3.0}/docsweep/server/static/board.css +95 -6
  75. {docsweep-0.2.0 → docsweep-0.3.0}/docsweep/server/static/edit.js +43 -3
  76. {docsweep-0.2.0 → docsweep-0.3.0}/docsweep/server/static/i18n.js +10 -0
  77. {docsweep-0.2.0 → docsweep-0.3.0}/docsweep/server/static/keymap.js +258 -6
  78. {docsweep-0.2.0 → docsweep-0.3.0}/docsweep/server/templates/_board_body.html +40 -3
  79. {docsweep-0.2.0 → docsweep-0.3.0}/docsweep/server/templates/_card.html +14 -1
  80. {docsweep-0.2.0 → docsweep-0.3.0}/docsweep/server/templates/_edit_pane.html +2 -0
  81. {docsweep-0.2.0 → docsweep-0.3.0}/docsweep/server/templates/_settings.html +7 -0
  82. {docsweep-0.2.0 → docsweep-0.3.0}/docsweep/server/templates/board.html +36 -3
  83. {docsweep-0.2.0 → docsweep-0.3.0}/docsweep/server/templates/capture.html +6 -6
  84. {docsweep-0.2.0 → docsweep-0.3.0}/docsweep/server/templates/cross.html +1 -1
  85. {docsweep-0.2.0 → docsweep-0.3.0}/docsweep/services/content.py +6 -0
  86. {docsweep-0.2.0 → docsweep-0.3.0}/docsweep/services/due.py +12 -42
  87. {docsweep-0.2.0 → docsweep-0.3.0}/docsweep/services/frontmatter.py +79 -3
  88. {docsweep-0.2.0 → docsweep-0.3.0}/docsweep/services/status.py +1 -1
  89. docsweep-0.3.0/docsweep/similar_guard.py +39 -0
  90. {docsweep-0.2.0 → docsweep-0.3.0}/docsweep/templates_gen.py +68 -2
  91. {docsweep-0.2.0 → docsweep-0.3.0}/docsweep/timeline.py +11 -17
  92. docsweep-0.3.0/pyproject.toml +114 -0
  93. {docsweep-0.2.0 → docsweep-0.3.0}/templates/CLAUDE.md +7 -4
  94. docsweep-0.3.0/tests/test_audit_fixes_2026_07_16.py +315 -0
  95. {docsweep-0.2.0 → docsweep-0.3.0}/tests/test_c2_commands.py +54 -5
  96. docsweep-0.3.0/tests/test_cli_smoke.py +65 -0
  97. {docsweep-0.2.0 → docsweep-0.3.0}/tests/test_detect.py +81 -0
  98. docsweep-0.3.0/tests/test_doctor.py +47 -0
  99. {docsweep-0.2.0 → docsweep-0.3.0}/tests/test_engine.py +94 -0
  100. {docsweep-0.2.0 → docsweep-0.3.0}/tests/test_extras.py +22 -0
  101. docsweep-0.3.0/tests/test_init_and_undo_cli.py +46 -0
  102. docsweep-0.3.0/tests/test_mcp_tools.py +177 -0
  103. docsweep-0.3.0/tests/test_new_cli_project_dir_autodetect.py +53 -0
  104. {docsweep-0.2.0 → docsweep-0.3.0}/tests/test_server.py +2 -1
  105. docsweep-0.3.0/tests/test_server_routes_extras.py +352 -0
  106. {docsweep-0.2.0 → docsweep-0.3.0}/tests/test_services_frontmatter.py +87 -0
  107. docsweep-0.3.0/tests/test_ux_final.py +61 -0
  108. docsweep-0.3.0/tests/test_ux_remaining.py +56 -0
  109. docsweep-0.3.0/tests/test_ux_w2.py +71 -0
  110. docsweep-0.2.0/docsweep/capture/service.py +0 -79
  111. docsweep-0.2.0/docsweep/cli.py +0 -1774
  112. docsweep-0.2.0/docsweep/migrate.py +0 -167
  113. docsweep-0.2.0/docsweep/server/sanitize.py +0 -144
  114. docsweep-0.2.0/pyproject.toml +0 -82
  115. docsweep-0.2.0/tests/test_mcp_tools.py +0 -82
  116. {docsweep-0.2.0 → docsweep-0.3.0}/.docsweep.yaml +0 -0
  117. {docsweep-0.2.0 → docsweep-0.3.0}/.github/workflows/publish.yml +0 -0
  118. {docsweep-0.2.0 → docsweep-0.3.0}/AGENTS.md +0 -0
  119. {docsweep-0.2.0 → docsweep-0.3.0}/LICENSE +0 -0
  120. {docsweep-0.2.0 → docsweep-0.3.0}/NOTICES.md +0 -0
  121. {docsweep-0.2.0 → docsweep-0.3.0}/README.en.md +0 -0
  122. {docsweep-0.2.0 → docsweep-0.3.0}/archive/plan_drop-last-updated-followup.md +0 -0
  123. {docsweep-0.2.0 → docsweep-0.3.0}/archive/plan_name-docsweep-availability.md +0 -0
  124. {docsweep-0.2.0 → docsweep-0.3.0}/archive/plan_templates-drop-last-updated-line.md +0 -0
  125. {docsweep-0.2.0 → docsweep-0.3.0}/assets/icon-a-broom.svg +0 -0
  126. {docsweep-0.2.0 → docsweep-0.3.0}/assets/icon-b-doc-check.svg +0 -0
  127. {docsweep-0.2.0 → docsweep-0.3.0}/assets/icon-c-sweep-sparkle.svg +0 -0
  128. {docsweep-0.2.0 → docsweep-0.3.0}/assets/icon.svg +0 -0
  129. {docsweep-0.2.0 → docsweep-0.3.0}/assets/icons/apple-touch-icon.png +0 -0
  130. {docsweep-0.2.0 → docsweep-0.3.0}/assets/icons/favicon-16.png +0 -0
  131. {docsweep-0.2.0 → docsweep-0.3.0}/assets/icons/favicon-32.png +0 -0
  132. {docsweep-0.2.0 → docsweep-0.3.0}/assets/icons/favicon-48.png +0 -0
  133. {docsweep-0.2.0 → docsweep-0.3.0}/assets/icons/favicon.ico +0 -0
  134. {docsweep-0.2.0 → docsweep-0.3.0}/assets/icons/favicon.svg +0 -0
  135. {docsweep-0.2.0 → docsweep-0.3.0}/assets/icons/icon-192.png +0 -0
  136. {docsweep-0.2.0 → docsweep-0.3.0}/assets/icons/icon-512.png +0 -0
  137. {docsweep-0.2.0 → docsweep-0.3.0}/assets/proposals/a-broom/apple-touch-icon.png +0 -0
  138. {docsweep-0.2.0 → docsweep-0.3.0}/assets/proposals/a-broom/favicon-16.png +0 -0
  139. {docsweep-0.2.0 → docsweep-0.3.0}/assets/proposals/a-broom/favicon-32.png +0 -0
  140. {docsweep-0.2.0 → docsweep-0.3.0}/assets/proposals/a-broom/favicon-48.png +0 -0
  141. {docsweep-0.2.0 → docsweep-0.3.0}/assets/proposals/a-broom/favicon.ico +0 -0
  142. {docsweep-0.2.0 → docsweep-0.3.0}/assets/proposals/a-broom/favicon.svg +0 -0
  143. {docsweep-0.2.0 → docsweep-0.3.0}/assets/proposals/a-broom/icon-192.png +0 -0
  144. {docsweep-0.2.0 → docsweep-0.3.0}/assets/proposals/a-broom/icon-512.png +0 -0
  145. {docsweep-0.2.0 → docsweep-0.3.0}/assets/proposals/b-doc-check/apple-touch-icon.png +0 -0
  146. {docsweep-0.2.0 → docsweep-0.3.0}/assets/proposals/b-doc-check/favicon-16.png +0 -0
  147. {docsweep-0.2.0 → docsweep-0.3.0}/assets/proposals/b-doc-check/favicon-32.png +0 -0
  148. {docsweep-0.2.0 → docsweep-0.3.0}/assets/proposals/b-doc-check/favicon-48.png +0 -0
  149. {docsweep-0.2.0 → docsweep-0.3.0}/assets/proposals/b-doc-check/favicon.ico +0 -0
  150. {docsweep-0.2.0 → docsweep-0.3.0}/assets/proposals/b-doc-check/favicon.svg +0 -0
  151. {docsweep-0.2.0 → docsweep-0.3.0}/assets/proposals/b-doc-check/icon-192.png +0 -0
  152. {docsweep-0.2.0 → docsweep-0.3.0}/assets/proposals/b-doc-check/icon-512.png +0 -0
  153. {docsweep-0.2.0 → docsweep-0.3.0}/assets/proposals/c-sweep-sparkle/apple-touch-icon.png +0 -0
  154. {docsweep-0.2.0 → docsweep-0.3.0}/assets/proposals/c-sweep-sparkle/favicon-16.png +0 -0
  155. {docsweep-0.2.0 → docsweep-0.3.0}/assets/proposals/c-sweep-sparkle/favicon-32.png +0 -0
  156. {docsweep-0.2.0 → docsweep-0.3.0}/assets/proposals/c-sweep-sparkle/favicon-48.png +0 -0
  157. {docsweep-0.2.0 → docsweep-0.3.0}/assets/proposals/c-sweep-sparkle/favicon.ico +0 -0
  158. {docsweep-0.2.0 → docsweep-0.3.0}/assets/proposals/c-sweep-sparkle/favicon.svg +0 -0
  159. {docsweep-0.2.0 → docsweep-0.3.0}/assets/proposals/c-sweep-sparkle/icon-192.png +0 -0
  160. {docsweep-0.2.0 → docsweep-0.3.0}/assets/proposals/c-sweep-sparkle/icon-512.png +0 -0
  161. {docsweep-0.2.0 → docsweep-0.3.0}/docs/D-skill-update-proposal.md +0 -0
  162. {docsweep-0.2.0 → docsweep-0.3.0}/docs/ai-agent-integration.md +0 -0
  163. {docsweep-0.2.0 → docsweep-0.3.0}/docs/conventions.md +0 -0
  164. {docsweep-0.2.0 → docsweep-0.3.0}/docs/guidance-rewrite-proposal.md +0 -0
  165. {docsweep-0.2.0 → docsweep-0.3.0}/docs/mockups/dashboard_v0.1.0.html +0 -0
  166. {docsweep-0.2.0 → docsweep-0.3.0}/docs/mockups/dashboard_v0.1.0.png +0 -0
  167. {docsweep-0.2.0 → docsweep-0.3.0}/docs/mockups/mcp_usage_v0.1.0.html +0 -0
  168. {docsweep-0.2.0 → docsweep-0.3.0}/docs/okf-export-format.md +0 -0
  169. {docsweep-0.2.0 → docsweep-0.3.0}/docs/okf-mapping.md +0 -0
  170. {docsweep-0.2.0 → docsweep-0.3.0}/docs/zenn/docsweep/2026-06-22_slash-commands-p-s-d/20260622-claude-code-slash-commands.md +0 -0
  171. {docsweep-0.2.0 → docsweep-0.3.0}/docsweep/__main__.py +0 -0
  172. {docsweep-0.2.0 → docsweep-0.3.0}/docsweep/activity.py +0 -0
  173. {docsweep-0.2.0 → docsweep-0.3.0}/docsweep/aggregate_index.py +0 -0
  174. {docsweep-0.2.0 → docsweep-0.3.0}/docsweep/archive.py +0 -0
  175. {docsweep-0.2.0 → docsweep-0.3.0}/docsweep/auto_triage.py +0 -0
  176. {docsweep-0.2.0 → docsweep-0.3.0}/docsweep/brief/__init__.py +0 -0
  177. {docsweep-0.2.0 → docsweep-0.3.0}/docsweep/brief/score.py +0 -0
  178. {docsweep-0.2.0 → docsweep-0.3.0}/docsweep/capture/__init__.py +0 -0
  179. {docsweep-0.2.0 → docsweep-0.3.0}/docsweep/capture/heuristics.py +0 -0
  180. {docsweep-0.2.0 → docsweep-0.3.0}/docsweep/capture/models.py +0 -0
  181. {docsweep-0.2.0 → docsweep-0.3.0}/docsweep/completion.py +0 -0
  182. {docsweep-0.2.0 → docsweep-0.3.0}/docsweep/cross/__init__.py +0 -0
  183. {docsweep-0.2.0 → docsweep-0.3.0}/docsweep/cross/service.py +0 -0
  184. {docsweep-0.2.0 → docsweep-0.3.0}/docsweep/export.py +0 -0
  185. {docsweep-0.2.0 → docsweep-0.3.0}/docsweep/graph/__init__.py +0 -0
  186. {docsweep-0.2.0 → docsweep-0.3.0}/docsweep/index.py +0 -0
  187. {docsweep-0.2.0 → docsweep-0.3.0}/docsweep/linkcheck.py +0 -0
  188. {docsweep-0.2.0 → docsweep-0.3.0}/docsweep/presets.py +0 -0
  189. {docsweep-0.2.0 → docsweep-0.3.0}/docsweep/reports.py +0 -0
  190. {docsweep-0.2.0 → docsweep-0.3.0}/docsweep/resurrect/__init__.py +0 -0
  191. {docsweep-0.2.0 → docsweep-0.3.0}/docsweep/resurrect/embedding.py +0 -0
  192. {docsweep-0.2.0 → docsweep-0.3.0}/docsweep/resurrect/service.py +0 -0
  193. {docsweep-0.2.0 → docsweep-0.3.0}/docsweep/review.py +0 -0
  194. {docsweep-0.2.0 → docsweep-0.3.0}/docsweep/security/__init__.py +0 -0
  195. {docsweep-0.2.0 → docsweep-0.3.0}/docsweep/security/path.py +0 -0
  196. {docsweep-0.2.0 → docsweep-0.3.0}/docsweep/server/__init__.py +0 -0
  197. {docsweep-0.2.0 → docsweep-0.3.0}/docsweep/server/config_write.py +0 -0
  198. {docsweep-0.2.0 → docsweep-0.3.0}/docsweep/server/routes/__init__.py +0 -0
  199. {docsweep-0.2.0 → docsweep-0.3.0}/docsweep/server/static/dnd.js +0 -0
  200. {docsweep-0.2.0 → docsweep-0.3.0}/docsweep/server/static/htmx.min.js +0 -0
  201. {docsweep-0.2.0 → docsweep-0.3.0}/docsweep/server/static/icons/apple-touch-icon.png +0 -0
  202. {docsweep-0.2.0 → docsweep-0.3.0}/docsweep/server/static/icons/favicon.ico +0 -0
  203. {docsweep-0.2.0 → docsweep-0.3.0}/docsweep/server/static/icons/favicon.svg +0 -0
  204. {docsweep-0.2.0 → docsweep-0.3.0}/docsweep/server/static/icons/icon-192.png +0 -0
  205. {docsweep-0.2.0 → docsweep-0.3.0}/docsweep/server/static/icons/icon-512.png +0 -0
  206. {docsweep-0.2.0 → docsweep-0.3.0}/docsweep/server/templates/_change_picker.html +0 -0
  207. {docsweep-0.2.0 → docsweep-0.3.0}/docsweep/server/templates/_due_picker.html +0 -0
  208. {docsweep-0.2.0 → docsweep-0.3.0}/docsweep/server/templates/_label_picker.html +0 -0
  209. {docsweep-0.2.0 → docsweep-0.3.0}/docsweep/server/templates/_preview.html +0 -0
  210. {docsweep-0.2.0 → docsweep-0.3.0}/docsweep/server/templates/brief.html +0 -0
  211. {docsweep-0.2.0 → docsweep-0.3.0}/docsweep/server/templates/graph.html +0 -0
  212. {docsweep-0.2.0 → docsweep-0.3.0}/docsweep/server/templates/resurrect.html +0 -0
  213. {docsweep-0.2.0 → docsweep-0.3.0}/docsweep/services/__init__.py +0 -0
  214. {docsweep-0.2.0 → docsweep-0.3.0}/docsweep/services/archive.py +0 -0
  215. {docsweep-0.2.0 → docsweep-0.3.0}/docsweep/stale.py +0 -0
  216. {docsweep-0.2.0 → docsweep-0.3.0}/docsweep/state.py +0 -0
  217. {docsweep-0.2.0 → docsweep-0.3.0}/docsweep/states.py +0 -0
  218. {docsweep-0.2.0 → docsweep-0.3.0}/docsweep-ui.cmd +0 -0
  219. {docsweep-0.2.0 → docsweep-0.3.0}/docsweep-ui.command +0 -0
  220. {docsweep-0.2.0 → docsweep-0.3.0}/docsweep-ui.sh +0 -0
  221. {docsweep-0.2.0 → docsweep-0.3.0}/templates/.docsweep.yaml +0 -0
  222. {docsweep-0.2.0 → docsweep-0.3.0}/templates/.githooks/docsweep-check.py +0 -0
  223. {docsweep-0.2.0 → docsweep-0.3.0}/templates/AGENTS.md +0 -0
  224. {docsweep-0.2.0 → docsweep-0.3.0}/templates/AGENT_GUIDE.md +0 -0
  225. {docsweep-0.2.0 → docsweep-0.3.0}/templates/install-hooks.ps1 +0 -0
  226. {docsweep-0.2.0 → docsweep-0.3.0}/templates/install-hooks.sh +0 -0
  227. {docsweep-0.2.0 → docsweep-0.3.0}/tests/test_activity.py +0 -0
  228. {docsweep-0.2.0 → docsweep-0.3.0}/tests/test_atomic.py +0 -0
  229. {docsweep-0.2.0 → docsweep-0.3.0}/tests/test_audit_fixes.py +0 -0
  230. {docsweep-0.2.0 → docsweep-0.3.0}/tests/test_audit_server.py +0 -0
  231. {docsweep-0.2.0 → docsweep-0.3.0}/tests/test_brief.py +0 -0
  232. {docsweep-0.2.0 → docsweep-0.3.0}/tests/test_c5_features.py +0 -0
  233. {docsweep-0.2.0 → docsweep-0.3.0}/tests/test_capture.py +0 -0
  234. {docsweep-0.2.0 → docsweep-0.3.0}/tests/test_config_due.py +0 -0
  235. {docsweep-0.2.0 → docsweep-0.3.0}/tests/test_cross.py +0 -0
  236. {docsweep-0.2.0 → docsweep-0.3.0}/tests/test_db_index.py +0 -0
  237. {docsweep-0.2.0 → docsweep-0.3.0}/tests/test_export.py +0 -0
  238. {docsweep-0.2.0 → docsweep-0.3.0}/tests/test_githooks.py +0 -0
  239. {docsweep-0.2.0 → docsweep-0.3.0}/tests/test_index_prune.py +0 -0
  240. {docsweep-0.2.0 → docsweep-0.3.0}/tests/test_index_stats.py +0 -0
  241. {docsweep-0.2.0 → docsweep-0.3.0}/tests/test_index_vacuum.py +0 -0
  242. {docsweep-0.2.0 → docsweep-0.3.0}/tests/test_index_wal.py +0 -0
  243. {docsweep-0.2.0 → docsweep-0.3.0}/tests/test_interactive.py +0 -0
  244. {docsweep-0.2.0 → docsweep-0.3.0}/tests/test_invariants.py +0 -0
  245. {docsweep-0.2.0 → docsweep-0.3.0}/tests/test_mcp_write_tools.py +0 -0
  246. {docsweep-0.2.0 → docsweep-0.3.0}/tests/test_parser.py +0 -0
  247. {docsweep-0.2.0 → docsweep-0.3.0}/tests/test_resurrect.py +0 -0
  248. {docsweep-0.2.0 → docsweep-0.3.0}/tests/test_server_board.py +0 -0
  249. {docsweep-0.2.0 → docsweep-0.3.0}/tests/test_server_bulk.py +0 -0
  250. {docsweep-0.2.0 → docsweep-0.3.0}/tests/test_server_okf.py +0 -0
  251. {docsweep-0.2.0 → docsweep-0.3.0}/tests/test_services_archive.py +0 -0
  252. {docsweep-0.2.0 → docsweep-0.3.0}/tests/test_services_content.py +0 -0
  253. {docsweep-0.2.0 → docsweep-0.3.0}/tests/test_services_due.py +0 -0
  254. {docsweep-0.2.0 → docsweep-0.3.0}/tests/test_services_status.py +0 -0
  255. {docsweep-0.2.0 → docsweep-0.3.0}/tests/test_state.py +0 -0
  256. {docsweep-0.2.0 → docsweep-0.3.0}/tests/test_templates_gen.py +0 -0
  257. {docsweep-0.2.0 → docsweep-0.3.0}/tests/test_triage_schema.py +0 -0
  258. {docsweep-0.2.0 → docsweep-0.3.0}/tests/test_undo.py +0 -0
@@ -0,0 +1,44 @@
1
+ #!/bin/sh
2
+ # docsweep 開発者向け pre-push フック — push 前に pytest 全走行して失敗を止める。
3
+ #
4
+ # 目的: 2026-07-16 の v0.3.0 release cascade(初回 CI で 5 連続失敗)の教訓。
5
+ # ローカルで pytest を走らせずに push すると、リモート CI で latent bug が一気に発火する。
6
+ # push 前に自動で pytest -q を走らせて、失敗なら push をブロックする(緊急時は --no-verify で回避可)。
7
+ #
8
+ # 有効化: リポジトリを clone した直後に 1 度だけ以下を実行:
9
+ # git config core.hooksPath .githooks
10
+ #
11
+ # 対応: docs/local/plan_audit-recommendations-phase2_2026-07-16.md 続きの CI 予防策。
12
+
13
+ set -e
14
+
15
+ # pytest が入っていない環境(本 hook 無関係の別プロジェクト clone 直後等)はスキップ。
16
+ if ! command -v python >/dev/null 2>&1 && ! command -v python3 >/dev/null 2>&1; then
17
+ echo "[pre-push] python が見つかりません。skip します。"
18
+ exit 0
19
+ fi
20
+
21
+ # Python 実行ファイルを解決(Windows は python.exe が優先・POSIX は python3 優先)。
22
+ if command -v python >/dev/null 2>&1; then
23
+ PY=python
24
+ else
25
+ PY=python3
26
+ fi
27
+
28
+ # pytest 未導入なら skip(`pip install -e .[dev]` を促す WARN のみ)。
29
+ if ! "$PY" -c "import pytest" 2>/dev/null; then
30
+ echo "[pre-push] pytest 未導入のため skip します。"
31
+ echo "[pre-push] 有効化には: pip install -e '.[dev]'"
32
+ exit 0
33
+ fi
34
+
35
+ echo "[pre-push] pytest -q を実行中(push 前検証)..."
36
+ if ! "$PY" -m pytest -q; then
37
+ echo ""
38
+ echo "[pre-push] pytest が失敗しました。push を中止します。"
39
+ echo "[pre-push] 修正して再 push するか、緊急時は --no-verify で回避してください。"
40
+ exit 1
41
+ fi
42
+
43
+ echo "[pre-push] pytest OK。push を許可します。"
44
+ exit 0
@@ -0,0 +1,40 @@
1
+ # Continuous Integration
2
+ #
3
+ # トリガー: 全 push / pull_request
4
+ # 目的: lint (ruff) / test (pytest) / typecheck (mypy) を回して
5
+ # リグレッションを PR 段階で検出する。
6
+ # 段階導入: mypy は初回 continue-on-error(赤許容)。ruff / pytest は fail on error。
7
+
8
+ name: CI
9
+
10
+ on: [push, pull_request]
11
+
12
+ jobs:
13
+ test:
14
+ name: Test (Python ${{ matrix.python-version }})
15
+ runs-on: ubuntu-latest
16
+ strategy:
17
+ fail-fast: false
18
+ matrix:
19
+ python-version: ["3.10", "3.12"]
20
+ steps:
21
+ - uses: actions/checkout@v4
22
+
23
+ - uses: actions/setup-python@v5
24
+ with:
25
+ python-version: ${{ matrix.python-version }}
26
+
27
+ - name: Install package with dev extras
28
+ # resurrect は torch を引きずるので省く。watch は Windows 限定の watchdog なので省く。
29
+ run: pip install -e ".[dev,web,mcp,review]"
30
+
31
+ - name: Run pytest
32
+ run: pytest -q
33
+
34
+ - name: Run ruff
35
+ run: ruff check docsweep tests
36
+
37
+ - name: Run mypy
38
+ # 段階導入: 初回は赤許容(continue-on-error)。将来的に外す。
39
+ continue-on-error: true
40
+ run: mypy docsweep
@@ -57,6 +57,7 @@ id_ed25519
57
57
  *.env
58
58
  secrets.*
59
59
  *secret*
60
+ !docsweep/secrets_guard.py
60
61
  *credential*
61
62
  *token*
62
63
  .netrc
@@ -3,6 +3,140 @@
3
3
  本ファイルは [Keep a Changelog](https://keepachangelog.com/ja/1.1.0/) の考え方を緩く参照しています。
4
4
  バージョニングは [SemVer](https://semver.org/lang/ja/) に従います。
5
5
 
6
+ ## [Unreleased]
7
+
8
+ ## [0.3.0] - 2026-07-16
9
+
10
+ 2026-07-16 の ai-audit-prompts / ultracode 監査(52 findings 検出)と、その進言事項 15 件を
11
+ 全消化した「監査シリーズ完結版」。critical / high の security fix、Cookie 認証への移行、
12
+ `cli.py` / `inject.py` の分割 refactor を含む minor bump。互換性維持: URL クエリ認証は
13
+ hybrid 経路として残る(v0.4.x で廃止予定)。
14
+
15
+ ### Security
16
+
17
+ - **[critical]** capture 経路(`POST /api/capture/save` と MCP `capture_save`)の任意ファイル
18
+ 書き込みを塞いだ。`save_drafts` に `target_dir` のスキャンルート境界チェックと
19
+ `suggested_filename` の basename 化・`.md` 拡張子検証を導入し、`../evil.md` 系の
20
+ トラバーサルと絶対パス書き込みを拒否する(`CaptureScopeError`)。**トークン漏洩時に
21
+ スタートアップ / 認証情報 / cron 等へ任意書き込みできた実質 RCE 経路を除去**。
22
+ - **[medium]** capture 画面(`server/templates/capture.html`)の innerHTML 経路で
23
+ `d.kind` / `d.suggested_filename` を `escapeHtml` 未通しだった箇所を修正(XSS 除去)。
24
+ - Web UI 認証を **HttpOnly / SameSite=Strict Cookie と `x-docsweep-token` ヘッダへ移行**。
25
+ 初回の `?token=` 付き URL は Cookie へ交換後に token 無し URL へ redirect する
26
+ hybrid モード(URL クエリ認証は v0.4.x で完全廃止予定・本版はその告知フェーズ)。
27
+ - `POST /api/config/roots` を `--allow-root-mutation` 起動フラグで守るようになった。
28
+ 未指定なら 403、指定時も `/`・`C:\`・HOME 直下の追加は allowlist で常時拒否
29
+ (トークン漏洩時のスキャン範囲拡張=任意 .md 読取/書換の連鎖を防ぐ)。
30
+ - `docsweep/server/sanitize.py` の stdlib HTMLParser フォールバック(88 行)を削除し、
31
+ `nh3` を `web` extras の必須依存に。パーサ実装差に依存した bypass 余地を除去。
32
+
33
+ ### Added
34
+
35
+ - **CI ワークフロー**(`.github/workflows/ci.yml`)を新設。Python 3.10 / 3.12 マトリクスで
36
+ `pytest` / `ruff check` / `mypy` を回す。mypy は段階導入のため `continue-on-error` で
37
+ 警告扱い(既存コードでの初回真っ赤を回避)。
38
+ - `--allow-root-mutation` CLI フラグ(上記 Security の項参照)。
39
+ - `[project.optional-dependencies].all-lite` extras 新設。`resurrect`(torch/CUDA を
40
+ 引きずる GB 級)を除いた実用最小構成(`web,review,mcp,watch`)。大半のユーザーは
41
+ こちらで足りる想定。
42
+ - `services/frontmatter.py` に `read_frontmatter(path)` / `read_frontmatter_text(text)` の
43
+ read API を追加。既存 9 モジュールに散っていた `_FRONTMATTER_RE` 直接利用を services
44
+ 内に集約するための基盤(下記 Refactor 参照)。
45
+ - `services/frontmatter.py` に `FrontmatterBlockStyleError` を追加し、手書き block-style
46
+ list(`tags:\n - a\n - b`)を検出したら書き換えを拒否(フロー記法前提の 1 行置換で
47
+ 継続行が孤立し YAML パースが壊れる事故を予防)。
48
+ - `migrate-frontmatter` を「素の md を OKF 形式に整えるフォーマッタ」へ一般化。従来は
49
+ frontmatter が 1 行でもあると無条件スキップだったが、OKF キー(type/status/tags/owner/
50
+ review_status/related/last_reviewed)が欠けている md へ**不足キーだけを追記**する
51
+ mode=`upgrade` を追加(`due:` だけの部分 frontmatter 等が対象。既存キーの値・行は不変・
52
+ H1 温存の不変条件は維持)。JSON 出力と CLI 表示に `mode` を追加。
53
+ - inject の導線(グローバル / プロジェクト)に「新規 md の作成(OKF frontmatter 必須)」節を追加
54
+ (`GUIDANCE_VERSION` 3 → 4)。AI が `docsweep new` を通さず手書きすると `due:` だけの
55
+ 最小 frontmatter になり OKF フィールドが欠落する穴を、docsweep 自身の注入ルールで塞ぐ
56
+ (特定の AI ツールに依存しない)。反映には `docsweep inject --global` の再実行が必要。
57
+ - pytest を `--strict-markers --strict-config` で厳格化。未宣言 marker と設定ミスを即エラー化。
58
+ - `[tool.mypy]` セクション追加(`ignore_missing_imports = true` / `warn_unused_ignores = true`)。
59
+ - `[tool.ruff.lint].select` を `E,F,I,UP,B,SIM,RUF` に拡張(バグ検出系 PLE/PIE は次版で
60
+ 段階導入予定)。
61
+
62
+ ### Fixed
63
+
64
+ 以下は 2026-07-16 監査で確定した finding のうち、最小修正で対応可能なもの 12 件。
65
+
66
+ - `engine.relabel_file` を `write_atomic` 経由へ寄せて、atomic.py の宣言(「全ての書き込み
67
+ API はこのヘルパ経由で MD を更新する」)と整合。バックアップと原子的差し替えが効くように
68
+ なり、Web UI 編集中の md を CLI/MCP 側から書き換える race が壊れにくくなる。(A-01)
69
+ - `config.load_config` が `postpone_warn_threshold` に文字列や null が入った YAML を読ませ
70
+ られると `ValueError` で全コマンドが起動不能になっていたのを、`_safe_int` フォールバック
71
+ に修正(既定値 3 / 5 へ落とす)。(A-02)
72
+ - `docsweep auto-triage --apply` が対象 JSON の欠損や破損で生の traceback を吐いていたのを、
73
+ `FileNotFoundError` / `JSONDecodeError` / `UnicodeDecodeError` を捕捉して exit 2 に修正。
74
+ (A-03)
75
+ - 空 `due:` 行(値なし)を含む md への `update_due` で `due:` キーが重複挿入され YAML
76
+ パーサ依存の last-wins になっていたのを、`_DUE_LINE_RE` を `[ \t]` 空白限定に修正して
77
+ 1 本置換に。(B-01)
78
+ - `inject.save_manifest` を tmp → `os.replace` のアトミック書き込みに変更。inject/eject 中の
79
+ プロセス停止で `injected.json` が truncate → 全プロジェクトの注入履歴(block ハッシュ・
80
+ preset_version)が事実上失われる事故を防止。(B-04)
81
+ - `graph` の node id で複数プロジェクトの同名 md(例: 各プロジェクトの `plan_v0.1.md`)が
82
+ basename 衝突していたのを、**衝突時のみ** `project/basename` の複合キーに昇格させる部分
83
+ 互換方式で修正(衝突なしの通常ケースは basename のまま・後方互換)。(C-02)
84
+ - `brief` の `yesterday_done` が age_days 降順(=古い順)になっていたのを mtime 降順
85
+ (=新しい順)に修正。24h ウィンドウ内での自然な並び順に。(C-03)
86
+ - `timeline._resolve_date` が `rec.mtime` None のレコード 1 件で TypeError → timeline 全体が
87
+ 落ちていたのを、`("", "unknown")` フォールバックに修正。(C-04)
88
+ - 対話 `triage --review` を Ctrl+C で中断すると蓄積した判定が全ロスしていたのを、
89
+ `KeyboardInterrupt` を捕捉してここまでの pairs を dispatch するよう修正
90
+ (EOFError と対称の挙動に)。(C-05)
91
+ - `atomic.backup` のファイル名 suffix を `time.time()` → `time.time_ns()` に上げ、同一秒内
92
+ 2 回書きで前世代を上書きする問題を修正。(A-05)
93
+
94
+ ### Changed / Refactor
95
+
96
+ - `docsweep/cli.py`(2311 行)を `docsweep/cli/` パッケージに分割。`cli/parser.py`
97
+ (argparse 定義)と `cli/commands/*.py`(読取系 / 書込系 / 特殊系)に責務分離。
98
+ 公開エントリ `docsweep.cli:main` と既存 `from docsweep.cli import ...` は `__init__.py`
99
+ の re-export で完全互換。(M-06)
100
+ - `docsweep/inject.py`(828 行)を `docsweep/inject/` パッケージに分割。`blocks.py` /
101
+ `manifest.py` / `agent_claude.py` / `agent_codex.py` / `api.py` の 5 モジュールへ責務分離。
102
+ 公開 API(`inject` / `eject` / `inject_global` / `eject_global` / `MANIFEST_PATH` / etc)は
103
+ `__init__.py` から re-export され後方互換 100%。(M-10)
104
+ - **frontmatter 読み書き API を `services/frontmatter.py` に一本化**。9 モジュール
105
+ (`claim.py` / `context.py` / `related.py` / `migrate.py` / `timeline.py` / `fix_conflict.py` /
106
+ `services/due.py` 他)に散っていた `_FRONTMATTER_RE` 直接利用を services 内に集約。
107
+ `services/due._replace_or_insert_due` は廃し、`services/frontmatter.update_frontmatter_field`
108
+ に統合。9 箇所の drift(`migrate.py:32` が「厳密版が必要」と告白していた既知の負債)を
109
+ 解消。(M-07 / M-08)
110
+
111
+ ### Tests
112
+
113
+ - 97 テスト追加(既存 535 → 632)。内訳:
114
+ - `tests/test_audit_fixes_2026_07_16.py`(16 件): 上記 Fixed の再現テスト
115
+ - `tests/test_server_routes_extras.py`(17 件): `/graph` `/resurrect` `/brief` `/cross`
116
+ `/capture` の 200 / 401 / エラー系 smoke
117
+ - `tests/test_cli_smoke.py`(55 件): 全 CLI サブコマンドの `--help` exit 0 smoke
118
+ - `tests/test_mcp_tools.py` に read 系 smoke 7 件追記
119
+ (`route_intent` / `doctor` / `day` / `list_projects` / `set_project_enabled` /
120
+ `inject_global` / `eject_global`)
121
+ - `tests/test_services_frontmatter.py` に block 記法検出テスト 2 件追記
122
+ - Phase 2 (L-01/02/03/04/05) の追加分と合わせて最終 **650 テスト green**。
123
+
124
+ ## [0.2.1] - 2026-07-04
125
+
126
+ ### Fixed
127
+
128
+ - `serve` を Ctrl+C で停止した際に KeyboardInterrupt のスタックトレースが出ていたのを
129
+ 1 行の停止メッセージに変更(Python 3.14 の asyncio.runners 再送出を捕捉)。
130
+ - frontmatter と H1 ラベルの status 食い違い warning が Web UI の描画のたびに
131
+ 繰り返し出力されていたのを、同一 (path, message) につきプロセス内 1 回に抑制
132
+ (矛盾自体は従来どおり needs_fix フラグで可視化され続ける)。
133
+ - 看板左上のロゴがファビコンと異なる「DS」テキストアイコンだったのを、
134
+ favicon.svg と同一画像に統一。
135
+ - 狭幅ウィンドウ(埋め込みブラウザ等)でトップバーの「再スキャン」ボタンや編集ペインの
136
+ 「プレビュー/編集」タブに `white-space: nowrap` が無く、文字が折り返して縦積みに
137
+ なっていたのを修正。900px 以下では看板と編集ペインを上下 2 段に、640px 以下では
138
+ 3 列カードを 1 列に切り替えるレスポンシブ対応も追加。
139
+
6
140
  ## [0.2.0] - 2026-07-03
7
141
 
8
142
  ### Added
@@ -16,7 +16,7 @@
16
16
  陳腐化を「要判断」フラグで可視化し、複数プロジェクトを横断 INDEX で一望できるようにする。
17
17
 
18
18
  - GitHub リポジトリ名: `docsweep`
19
- - 配布: `pip install docsweep` + 単体バイナリ(PyInstaller)、Win / Mac / Linux 対応
19
+ - 配布: PyPI(`pip install docsweep`、extras: `web` / `review` / `mcp` / `watch` / `resurrect` / `all`)、Win / Mac / Linux 対応。単体バイナリ(PyInstaller)は現時点で未提供
20
20
  - 設計の正本: [docs/local/plan_v0.1.0-product-requirements.md](docs/local/plan_v0.1.0-product-requirements.md)
21
21
  および [docs/local/plan_state-tag-orthogonalization.md](docs/local/plan_state-tag-orthogonalization.md)
22
22
 
@@ -37,28 +37,32 @@ docsweep は **自分自身のルールでドッグフーディング** する
37
37
  - 規約を変更するときは `templates/CLAUDE.md`(正本)→ `docs/conventions.md`(解説)の
38
38
  順で更新し、両者をズラさない
39
39
 
40
- ## 技術スタック(予定)
40
+ ## 技術スタック
41
41
 
42
42
  | レイヤ | 採用 |
43
43
  |------|------|
44
- | 言語 | Python(クロスプラットフォーム) |
44
+ | 言語 | Python >= 3.10(クロスプラットフォーム・core 依存は PyYAML のみ) |
45
45
  | パッケージ | `docsweep/`(`pip install docsweep`) |
46
- | CLI | サブコマンド + フラグ(`--auto` / `--dry-run` / `--review` / `--json` / `--report` / `--summary` / `new`) |
47
- | インタラクティブ UI | `InquirerPy` / `questionary`(`--review` のチェックリスト専用) |
46
+ | CLI | サブコマンド式(`triage` / `apply` / `sweep` / `serve` / `index` / `summary` / `new` / `inject` / `mcp` 等)+ `--json` / `--dry-run` / `--auto` |
47
+ | Web UI | FastAPI + Jinja2/htmx(`docsweep serve`、extras `web`) |
48
+ | インタラクティブ UI | `questionary`(`review` サブコマンド専用、extras `review`) |
48
49
  | 設定 | YAML(`~/.docsweep/config.yaml` / プロジェクトの `.docsweep.yaml`) |
49
- | 単体配布 | PyInstaller |
50
50
 
51
- ## リポジトリ構成(予定)
51
+ ## リポジトリ構成
52
52
 
53
53
  ```
54
54
  docsweep/
55
- ├─ docsweep/ # Python ツール本体(CLI・コアエンジン・Web UI)
55
+ ├─ docsweep/ # Python ツール本体(CLI・コアエンジン・MCP・Web UI: server/)
56
56
  ├─ templates/ # 配布物(採用者が取り込む)
57
- │ ├─ CLAUDE.md # Claude Code 向けルールの正本テンプレ
58
- │ ├─ AGENTS.md # Codex 向けの薄いポインタ
59
- │ └─ .docsweep.yaml# 設定サンプル
57
+ │ ├─ CLAUDE.md # AI 作業ドキュメント運用ルールの正本テンプレ
58
+ │ ├─ AGENTS.md # Codex 等他エージェント向けの薄いポインタ
59
+ │ ├─ AGENT_GUIDE.md # AI エージェント向け docsweep 操作ガイド
60
+ │ ├─ .docsweep.yaml # 設定サンプル
61
+ │ └─ .githooks/ + install-hooks.{sh,ps1} # opt-in pre-commit hook
62
+ ├─ tests/ # pytest
60
63
  ├─ docs/
61
64
  │ ├─ conventions.md # 命名・ステータス規約の人間向け解説
65
+ │ ├─ okf-mapping.md # OKF 語彙と内部 state の対応
62
66
  │ ├─ mockups/ # Web UI モックアップ
63
67
  │ └─ local/ # 設計書・作業ログ(非公開・gitignore)
64
68
  └─ CLAUDE.md / AGENTS.md # ← 本ファイル(リポジトリ開発者向け)
@@ -73,15 +77,31 @@ docsweep/
73
77
  - **インタラクティブ UI は `--review` 専用**。`--auto` / `--json` は非対話を厳守
74
78
  (cron・CI・AI エージェント委譲向け。プロンプトを出さない)。
75
79
 
76
- ## 作業運用ルール(AI 共通)
80
+ ## AI 作業共通ルール
77
81
 
78
- - **ビルド・パッケージング・公開・コミット・プッシュは全てユーザーが行う**。
79
- AI からは自動実行も提案もしない(確認質問も出さない)。
80
- - 例外: ユーザーが明示的に「ビルドして」「`pip install -e .` 走らせて」「コミットして」等と
81
- 指示した場合のみ。
82
- - 対象: `pyinstaller` / `pip install` / `pnpm publish` / `git commit` / `git push` / `git tag` 等。
83
- - 型チェック・テスト実行(`pytest` / `ruff` / `mypy` 等、コードの正しさ確認)は本ルールの対象外。
84
- - 完了報告では「公開しますか?」のような提案を出さず、コード変更の要約だけ伝える。
82
+ ビルド・コミット禁止、secrets-scan 責務、plan/bugfix/pending md の作成ルール等の
83
+ AI 作業共通ルールは、各利用者のグローバル AI 設定に従う
84
+ (作者環境の例: `~/.claude/CLAUDE.md` および `~/.claude/guides/`)。
85
+
86
+ - このリポジトリでの適用注: `pyinstaller` / `pip install -e .` もビルド・パッケージング扱い
87
+ (ユーザー指示があるまで実行しない)。`pytest` / `ruff` / `mypy` 等の正しさ確認は対象外。
88
+
89
+ ## 開発者向け git hook(推奨)
90
+
91
+ `.githooks/pre-push` が用意されている。push 前に自動で `pytest -q` を走らせて失敗を
92
+ 止めるためのフック。2026-07-16 v0.3.0 release で「ローカル pytest せず push → リモート
93
+ CI で 5 連続失敗」の cascade があった教訓から追加。
94
+
95
+ **有効化**(clone 後 1 回だけ):
96
+
97
+ ```bash
98
+ git config core.hooksPath .githooks
99
+ ```
100
+
101
+ - pytest 未導入や python 不在の環境では自動 skip(既存 clone に影響なし)
102
+ - 緊急時は `git push --no-verify` で回避可
103
+ - `git config` は per-clone の設定なので、リポに commit されない。clone した各自が
104
+ 上記コマンドを 1 回だけ実行する。
85
105
 
86
106
  ## 公開・配布の方針
87
107
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: docsweep
3
- Version: 0.2.0
3
+ Version: 0.3.0
4
4
  Summary: Sweep, triage and archive AI coding agents' plan/bugfix/pending Markdown across projects.
5
5
  Project-URL: Homepage, https://github.com/ishizakahiroshi/docsweep
6
6
  Project-URL: Repository, https://github.com/ishizakahiroshi/docsweep
@@ -29,6 +29,16 @@ Requires-Dist: questionary>=2.0; extra == 'all'
29
29
  Requires-Dist: sentence-transformers>=2.0; extra == 'all'
30
30
  Requires-Dist: uvicorn>=0.29; extra == 'all'
31
31
  Requires-Dist: watchdog>=4.0; extra == 'all'
32
+ Provides-Extra: all-lite
33
+ Requires-Dist: fastapi>=0.110; extra == 'all-lite'
34
+ Requires-Dist: jinja2>=3.1; extra == 'all-lite'
35
+ Requires-Dist: markdown>=3.6; extra == 'all-lite'
36
+ Requires-Dist: mcp>=1.0; extra == 'all-lite'
37
+ Requires-Dist: nh3>=0.2; extra == 'all-lite'
38
+ Requires-Dist: python-multipart>=0.0.18; extra == 'all-lite'
39
+ Requires-Dist: questionary>=2.0; extra == 'all-lite'
40
+ Requires-Dist: uvicorn>=0.29; extra == 'all-lite'
41
+ Requires-Dist: watchdog>=4.0; extra == 'all-lite'
32
42
  Provides-Extra: dev
33
43
  Requires-Dist: mypy>=1.10; extra == 'dev'
34
44
  Requires-Dist: pytest>=8.0; extra == 'dev'
@@ -336,13 +346,21 @@ python -m docsweep eject --global
336
346
 
337
347
  python -m docsweep list # 注入済み(プロジェクト+グローバル)一覧
338
348
 
339
- # Web UI(UX 主役・127.0.0.1・トークン付き URL)。注入/解除もダッシュボードから(プレビュー必須)
349
+ # Web UI(UX 主役・127.0.0.1・初回だけ ?token= 付き URL、以降は Cookie で /board を直接開ける)。注入/解除もダッシュボードから(プレビュー必須)
340
350
  python -m docsweep serve --root ~/dev
341
351
 
342
352
  # MCP サーバー(AI エージェント面・stdio)
343
353
  python -m docsweep mcp
344
354
  ```
345
355
 
356
+ Web UI(看板)はこんな見た目です。
357
+
358
+ ![やり忘れ列](assets/screenshots/webui-todo.png)
359
+
360
+ 「完了」「廃止」になったカードは archive 候補列にまとまり、まとめて archive へ送れます。
361
+
362
+ ![archive 候補列](assets/screenshots/webui-archive.png)
363
+
346
364
  ## 状態モデル(一直線・単一正本)
347
365
 
348
366
  ```
@@ -284,13 +284,21 @@ python -m docsweep eject --global
284
284
 
285
285
  python -m docsweep list # 注入済み(プロジェクト+グローバル)一覧
286
286
 
287
- # Web UI(UX 主役・127.0.0.1・トークン付き URL)。注入/解除もダッシュボードから(プレビュー必須)
287
+ # Web UI(UX 主役・127.0.0.1・初回だけ ?token= 付き URL、以降は Cookie で /board を直接開ける)。注入/解除もダッシュボードから(プレビュー必須)
288
288
  python -m docsweep serve --root ~/dev
289
289
 
290
290
  # MCP サーバー(AI エージェント面・stdio)
291
291
  python -m docsweep mcp
292
292
  ```
293
293
 
294
+ Web UI(看板)はこんな見た目です。
295
+
296
+ ![やり忘れ列](assets/screenshots/webui-todo.png)
297
+
298
+ 「完了」「廃止」になったカードは archive 候補列にまとまり、まとめて archive へ送れます。
299
+
300
+ ![archive 候補列](assets/screenshots/webui-archive.png)
301
+
294
302
  ## 状態モデル(一直線・単一正本)
295
303
 
296
304
  ```
@@ -1,3 +1,3 @@
1
1
  """docsweep — AI 作業ドキュメント(plan/bugfix/pending)の横断スキャン・判定・archive 移送ツール。"""
2
2
 
3
- __version__ = "0.2.0"
3
+ __version__ = "0.3.0"
@@ -63,16 +63,19 @@ def backup_dir_for(path: Path) -> Path:
63
63
 
64
64
 
65
65
  def backup(path: Path) -> Path | None:
66
- """書き込み直前に呼ぶ。``.docsweep/backup/<filename>.<unix_ts>`` へコピー。
66
+ """書き込み直前に呼ぶ。``.docsweep/backup/<filename>.<unix_ns>`` へコピー。
67
67
 
68
68
  対象が存在しない(新規作成)場合は何もしないで None を返す。古いバックアップは
69
69
  呼び出しのついでに掃除する(30 日超で自動削除)。
70
+
71
+ サフィックスは秒精度だと sweep が同一ファイルを短時間に 2 回書くケース(relabel →
72
+ archive 移送)で前世代を上書きしてしまうため、``time.time_ns()`` のナノ秒精度に上げる。
70
73
  """
71
74
  if not path.is_file():
72
75
  return None
73
76
  dst_dir = backup_dir_for(path)
74
77
  dst_dir.mkdir(parents=True, exist_ok=True)
75
- ts = int(time.time())
78
+ ts = time.time_ns()
76
79
  dst = dst_dir / f"{path.name}.{ts}"
77
80
  shutil.copy2(str(path), str(dst))
78
81
  _cleanup_backups(dst_dir)
@@ -149,7 +152,7 @@ def update_line(
149
152
  actual = _mtime(path)
150
153
  if not _mtime_close(actual, expected_mtime):
151
154
  raise ConflictError(path, expected_mtime, actual)
152
- text = path.read_text(encoding="utf-8", newline="")
155
+ text = path.open("r", encoding="utf-8", newline="").read()
153
156
  new_text = transform(text)
154
157
  if new_text == text:
155
158
  # 変更なし。書き込みも backup も省略する。
@@ -125,14 +125,16 @@ def _build_for_project(
125
125
  watchouts = watchouts[:5]
126
126
 
127
127
  start, end = _yesterday_window(now)
128
- yesterday: list[dict] = []
128
+ yesterday: list[tuple[float, dict]] = []
129
129
  for rec in records:
130
130
  if rec.state not in {"done", "discarded"}:
131
131
  continue
132
132
  if rec.mtime and start <= rec.mtime <= end:
133
- yesterday.append(_short_record(rec))
134
- yesterday.sort(key=lambda d: -(d.get("age_days") or 0))
135
- yesterday = yesterday[:5]
133
+ yesterday.append((rec.mtime, _short_record(rec)))
134
+ # 「昨日終わったこと」は新しい順に見せる意図。以前は age_days 降順(=古い順)で
135
+ # 直感と逆になっていた。24h ウィンドウ内では mtime 降順が最も自然。
136
+ yesterday.sort(key=lambda pair: -pair[0])
137
+ yesterday_dicts = [d for _, d in yesterday[:5]]
136
138
 
137
139
  stale_count = sum(1 for r in open_recs if Flag.STALE.value in (r.flags or []))
138
140
 
@@ -141,7 +143,7 @@ def _build_for_project(
141
143
  today_pick=today_pick,
142
144
  co_running=co_running,
143
145
  watchouts=watchouts,
144
- yesterday_done=yesterday,
146
+ yesterday_done=yesterday_dicts,
145
147
  open_count=len(open_recs),
146
148
  stale_count=stale_count,
147
149
  )
@@ -38,7 +38,7 @@ class MockLLM:
38
38
 
39
39
  def extract(self, request: LLMRequest) -> list[Draft]:
40
40
  drafts: list[Draft] = []
41
- for i, line in enumerate(request.conversation.splitlines()[:20]):
41
+ for _i, line in enumerate(request.conversation.splitlines()[:20]):
42
42
  stripped = line.strip()
43
43
  if not stripped:
44
44
  continue
@@ -0,0 +1,156 @@
1
+ """capture の orchestration: 抽出 + 保存。CLI / Web / MCP がすべてここを呼ぶ。"""
2
+
3
+ from __future__ import annotations
4
+
5
+ import os
6
+ import re
7
+ from pathlib import Path
8
+
9
+ from ..config import Config
10
+ from .heuristics import extract_drafts_heuristic
11
+ from .llm import LLMRequest, get_llm
12
+ from .models import Draft
13
+
14
+
15
+ class CaptureScopeError(PermissionError):
16
+ """target_dir が config.roots 配下でない、または suggested_filename が不正なとき発生。
17
+
18
+ Web / MCP どちらの capture 経路も外部由来(AI / ユーザー貼り付け)の out_dir と
19
+ suggested_filename を扱うため、書き込み境界を service 層で単一化する(層を上位に
20
+ 分散すると片方が抜けたときに任意ファイル書き込みへ発展する)。
21
+ """
22
+
23
+
24
+ _SAFE_FILENAME_RE = re.compile(r"^[\w\-.]+\.md\Z")
25
+
26
+
27
+ def _sanitize_filename(name: str) -> str:
28
+ """``suggested_filename`` を basename のみ・``.md`` のみへ正規化する。
29
+
30
+ ``../evil.md`` / ``a/b.md`` / ``foo.txt`` / 空文字 / ``None`` はすべて拒否。
31
+ Windows のディレクトリ区切り ``\\`` も拒否。
32
+ """
33
+ if not name or not isinstance(name, str):
34
+ raise CaptureScopeError(f"suggested_filename が空または不正です: {name!r}")
35
+ # パスセパレータを含む入力は明示拒否(Path.name で吸収せず「意図」を弾く)。
36
+ if "/" in name or "\\" in name or name in (".", ".."):
37
+ raise CaptureScopeError(f"suggested_filename にパスを含めることはできません: {name!r}")
38
+ if not _SAFE_FILENAME_RE.match(name):
39
+ raise CaptureScopeError(
40
+ f"suggested_filename は英数字・ハイフン・アンダースコア・ドットのみで .md 拡張子必須: {name!r}"
41
+ )
42
+ return name
43
+
44
+
45
+ def _target_under_roots(target: Path, roots: list[Path]) -> bool:
46
+ """``target`` が ``roots`` のいずれかの配下(realpath 解決後)であれば True。
47
+
48
+ Windows の大小文字差は ``os.path.normcase`` で吸収する。
49
+ """
50
+ try:
51
+ target_real = os.path.realpath(str(target))
52
+ except OSError:
53
+ return False
54
+ tnorm = os.path.normcase(target_real)
55
+ for root in roots:
56
+ try:
57
+ root_real = os.path.realpath(str(root))
58
+ except OSError:
59
+ continue
60
+ rnorm = os.path.normcase(root_real)
61
+ try:
62
+ Path(tnorm).relative_to(Path(rnorm))
63
+ return True
64
+ except ValueError:
65
+ continue
66
+ return False
67
+
68
+
69
+ def extract_drafts(
70
+ text: str,
71
+ *,
72
+ config: Config,
73
+ project: str | None = None,
74
+ max_drafts: int = 5,
75
+ use_llm: bool = False,
76
+ ) -> list[Draft]:
77
+ """会話履歴 ``text`` から Draft 候補のリストを返す。
78
+
79
+ Args:
80
+ text: 会話履歴(クリップボード / ファイル / stdin / Web 貼付け)
81
+ config: ロード済み Config(LLM 設定を参照)
82
+ project: 配置先プロジェクト名(None なら cwd プロジェクト推定)
83
+ max_drafts: 候補上限
84
+ use_llm: True で LLM 経路(config.capture_llm_provider を使う)
85
+
86
+ Returns:
87
+ 抽出された Draft のリスト(空でも可)。
88
+ """
89
+ if use_llm:
90
+ provider = getattr(config, "capture_llm_provider", None) or "mock"
91
+ client = get_llm(provider)
92
+ request = LLMRequest(
93
+ conversation=text, project_hint=project, max_drafts=max_drafts,
94
+ )
95
+ return client.extract(request)
96
+
97
+ return extract_drafts_heuristic(text, project=project, max_drafts=max_drafts)
98
+
99
+
100
+ def save_drafts(
101
+ drafts: list[Draft],
102
+ *,
103
+ config: Config,
104
+ target_dir: Path,
105
+ overwrite: bool = False,
106
+ ) -> list[Path]:
107
+ """採用された Draft を ``target_dir`` 配下に書き出す。
108
+
109
+ Args:
110
+ drafts: 採用された Draft のリスト
111
+ config: ロード済み Config(owner / lang などを参照する余地)
112
+ target_dir: 書き出し先(プロジェクトの ``docs/local/`` を想定)
113
+ overwrite: 既存ファイルを上書きしてよいか
114
+
115
+ Returns:
116
+ 書き出されたファイルのパスリスト。
117
+
118
+ Raises:
119
+ CaptureScopeError: ``target_dir`` が ``config.roots`` 配下でない、または
120
+ いずれかの draft の ``suggested_filename`` が不正(パスセパレータ含む /
121
+ ``.md`` 以外 / 空 / 記号混入)のとき。
122
+ """
123
+ # 書き込み境界: roots が設定されているなら target_dir は必ずその配下でなければならない。
124
+ # roots 未設定の場合(config 無しでの単発呼び出し・テスト等)は cwd フォールバックに委ねる。
125
+ if config.roots and not _target_under_roots(target_dir, config.roots):
126
+ raise CaptureScopeError(
127
+ f"target_dir はスキャンルート配下である必要があります: {target_dir}"
128
+ )
129
+ # basename・.md 限定の filename 検証は全 draft を先に走らせて、部分書き込みを避ける。
130
+ safe_names = [_sanitize_filename(d.suggested_filename) for d in drafts]
131
+
132
+ target_dir.mkdir(parents=True, exist_ok=True)
133
+ written: list[Path] = []
134
+ for d, safe_name in zip(drafts, safe_names, strict=True):
135
+ path = target_dir / safe_name
136
+ if path.exists() and not overwrite:
137
+ # 番号サフィックスで衝突回避
138
+ stem = path.stem
139
+ suffix = path.suffix
140
+ n = 2
141
+ while True:
142
+ cand = path.with_name(f"{stem}_{n}{suffix}")
143
+ if not cand.exists():
144
+ path = cand
145
+ break
146
+ n += 1
147
+ try:
148
+ from ..secrets_guard import format_warnings, scan_secrets
149
+ for w in format_warnings(scan_secrets(d.body)):
150
+ import sys
151
+ print(f"warn: {path.name}: {w}", file=sys.stderr)
152
+ except Exception:
153
+ pass
154
+ path.write_text(d.body, encoding="utf-8")
155
+ written.append(path)
156
+ return written