getapo 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 (178) hide show
  1. {getapo-0.1.0/src/getapo.egg-info → getapo-0.2.0}/PKG-INFO +1 -5
  2. {getapo-0.1.0 → getapo-0.2.0}/README.md +0 -4
  3. {getapo-0.1.0 → getapo-0.2.0}/pyproject.toml +0 -1
  4. {getapo-0.1.0 → getapo-0.2.0}/src/apo/__init__.py +1 -1
  5. {getapo-0.1.0 → getapo-0.2.0}/src/apo/cli.py +64 -10
  6. {getapo-0.1.0 → getapo-0.2.0}/src/apo/config.py +12 -44
  7. {getapo-0.1.0 → getapo-0.2.0}/src/apo/db.py +110 -2
  8. {getapo-0.1.0 → getapo-0.2.0}/src/apo/installer.py +13 -37
  9. {getapo-0.1.0 → getapo-0.2.0}/src/apo/repo_writer.py +13 -0
  10. {getapo-0.1.0 → getapo-0.2.0}/src/apo/resources/guide.md +3 -1
  11. {getapo-0.1.0 → getapo-0.2.0}/src/apo/web/app.py +14 -0
  12. {getapo-0.1.0 → getapo-0.2.0}/src/apo/web/static/app.css +4 -0
  13. {getapo-0.1.0 → getapo-0.2.0}/src/apo/web/templates/_now_item.html +2 -0
  14. {getapo-0.1.0 → getapo-0.2.0}/src/apo/web/templates/base.html +0 -6
  15. {getapo-0.1.0 → getapo-0.2.0}/src/apo/web/templates/decision.html +25 -0
  16. {getapo-0.1.0 → getapo-0.2.0}/src/apo/web/templates/project_settings.html +13 -1
  17. {getapo-0.1.0 → getapo-0.2.0/src/getapo.egg-info}/PKG-INFO +1 -5
  18. {getapo-0.1.0 → getapo-0.2.0}/src/getapo.egg-info/entry_points.txt +0 -1
  19. {getapo-0.1.0 → getapo-0.2.0}/tests/test_app.py +2 -0
  20. {getapo-0.1.0 → getapo-0.2.0}/tests/test_cancel_button.py +30 -0
  21. {getapo-0.1.0 → getapo-0.2.0}/tests/test_claude_runtime.py +1 -1
  22. {getapo-0.1.0 → getapo-0.2.0}/tests/test_cli.py +103 -0
  23. {getapo-0.1.0 → getapo-0.2.0}/tests/test_cli_hooks.py +3 -3
  24. getapo-0.2.0/tests/test_config.py +129 -0
  25. getapo-0.2.0/tests/test_entry_points.py +49 -0
  26. getapo-0.2.0/tests/test_folder_identity.py +299 -0
  27. {getapo-0.1.0 → getapo-0.2.0}/tests/test_installer.py +8 -24
  28. {getapo-0.1.0 → getapo-0.2.0}/tests/test_linear_client.py +1 -1
  29. {getapo-0.1.0 → getapo-0.2.0}/tests/test_names.py +1 -6
  30. {getapo-0.1.0 → getapo-0.2.0}/tests/test_now.py +64 -0
  31. {getapo-0.1.0 → getapo-0.2.0}/tests/test_project_settings.py +49 -0
  32. {getapo-0.1.0 → getapo-0.2.0}/tests/test_prompt_answers.py +1 -1
  33. {getapo-0.1.0 → getapo-0.2.0}/tests/test_repo_writer.py +64 -0
  34. {getapo-0.1.0 → getapo-0.2.0}/tests/test_search.py +1 -1
  35. {getapo-0.1.0 → getapo-0.2.0}/tests/test_wheel.py +2 -2
  36. getapo-0.1.0/tests/test_config.py +0 -186
  37. getapo-0.1.0/tests/test_entry_points.py +0 -70
  38. getapo-0.1.0/tests/test_folder_identity.py +0 -143
  39. {getapo-0.1.0 → getapo-0.2.0}/LICENSE +0 -0
  40. {getapo-0.1.0 → getapo-0.2.0}/THIRD_PARTY_NOTICES.md +0 -0
  41. {getapo-0.1.0 → getapo-0.2.0}/setup.cfg +0 -0
  42. {getapo-0.1.0 → getapo-0.2.0}/src/apo/__main__.py +0 -0
  43. {getapo-0.1.0 → getapo-0.2.0}/src/apo/changelog.py +0 -0
  44. {getapo-0.1.0 → getapo-0.2.0}/src/apo/claude_runtime.py +0 -0
  45. {getapo-0.1.0 → getapo-0.2.0}/src/apo/credentials.py +0 -0
  46. {getapo-0.1.0 → getapo-0.2.0}/src/apo/integrations/__init__.py +0 -0
  47. {getapo-0.1.0 → getapo-0.2.0}/src/apo/integrations/linear_client.py +0 -0
  48. {getapo-0.1.0 → getapo-0.2.0}/src/apo/integrations/linear_goals.py +0 -0
  49. {getapo-0.1.0 → getapo-0.2.0}/src/apo/integrations/sources.py +0 -0
  50. {getapo-0.1.0 → getapo-0.2.0}/src/apo/mcp_server.py +0 -0
  51. {getapo-0.1.0 → getapo-0.2.0}/src/apo/resources/hooks/session-decisions-nudge.sh +0 -0
  52. {getapo-0.1.0 → getapo-0.2.0}/src/apo/resources/skills/decisions/SKILL.md +0 -0
  53. {getapo-0.1.0 → getapo-0.2.0}/src/apo/transcripts.py +0 -0
  54. {getapo-0.1.0 → getapo-0.2.0}/src/apo/verify.py +0 -0
  55. {getapo-0.1.0 → getapo-0.2.0}/src/apo/web/__init__.py +0 -0
  56. {getapo-0.1.0 → getapo-0.2.0}/src/apo/web/static/app.js +0 -0
  57. {getapo-0.1.0 → getapo-0.2.0}/src/apo/web/static/fleet.js +0 -0
  58. {getapo-0.1.0 → getapo-0.2.0}/src/apo/web/static/live.js +0 -0
  59. {getapo-0.1.0 → getapo-0.2.0}/src/apo/web/static/notify.js +0 -0
  60. {getapo-0.1.0 → getapo-0.2.0}/src/apo/web/static/now.js +0 -0
  61. {getapo-0.1.0 → getapo-0.2.0}/src/apo/web/static/palette.js +0 -0
  62. {getapo-0.1.0 → getapo-0.2.0}/src/apo/web/static/round.js +0 -0
  63. {getapo-0.1.0 → getapo-0.2.0}/src/apo/web/templates/_attachment_composer.html +0 -0
  64. {getapo-0.1.0 → getapo-0.2.0}/src/apo/web/templates/_bulk.html +0 -0
  65. {getapo-0.1.0 → getapo-0.2.0}/src/apo/web/templates/_icons.html +0 -0
  66. {getapo-0.1.0 → getapo-0.2.0}/src/apo/web/templates/_macros.html +0 -0
  67. {getapo-0.1.0 → getapo-0.2.0}/src/apo/web/templates/_merge_result.html +0 -0
  68. {getapo-0.1.0 → getapo-0.2.0}/src/apo/web/templates/_project_macros.html +0 -0
  69. {getapo-0.1.0 → getapo-0.2.0}/src/apo/web/templates/_prompt_form.html +0 -0
  70. {getapo-0.1.0 → getapo-0.2.0}/src/apo/web/templates/_resume_actions.html +0 -0
  71. {getapo-0.1.0 → getapo-0.2.0}/src/apo/web/templates/_session_card.html +0 -0
  72. {getapo-0.1.0 → getapo-0.2.0}/src/apo/web/templates/_work_location.html +0 -0
  73. {getapo-0.1.0 → getapo-0.2.0}/src/apo/web/templates/_work_main.html +0 -0
  74. {getapo-0.1.0 → getapo-0.2.0}/src/apo/web/templates/_work_status.html +0 -0
  75. {getapo-0.1.0 → getapo-0.2.0}/src/apo/web/templates/accept.html +0 -0
  76. {getapo-0.1.0 → getapo-0.2.0}/src/apo/web/templates/all_activity.html +0 -0
  77. {getapo-0.1.0 → getapo-0.2.0}/src/apo/web/templates/all_agents.html +0 -0
  78. {getapo-0.1.0 → getapo-0.2.0}/src/apo/web/templates/all_decisions.html +0 -0
  79. {getapo-0.1.0 → getapo-0.2.0}/src/apo/web/templates/all_overview.html +0 -0
  80. {getapo-0.1.0 → getapo-0.2.0}/src/apo/web/templates/all_work.html +0 -0
  81. {getapo-0.1.0 → getapo-0.2.0}/src/apo/web/templates/guide.html +0 -0
  82. {getapo-0.1.0 → getapo-0.2.0}/src/apo/web/templates/now.html +0 -0
  83. {getapo-0.1.0 → getapo-0.2.0}/src/apo/web/templates/outcome.html +0 -0
  84. {getapo-0.1.0 → getapo-0.2.0}/src/apo/web/templates/project_activity.html +0 -0
  85. {getapo-0.1.0 → getapo-0.2.0}/src/apo/web/templates/project_agents.html +0 -0
  86. {getapo-0.1.0 → getapo-0.2.0}/src/apo/web/templates/project_decisions.html +0 -0
  87. {getapo-0.1.0 → getapo-0.2.0}/src/apo/web/templates/project_overview.html +0 -0
  88. {getapo-0.1.0 → getapo-0.2.0}/src/apo/web/templates/project_work.html +0 -0
  89. {getapo-0.1.0 → getapo-0.2.0}/src/apo/web/templates/projects_shell.html +0 -0
  90. {getapo-0.1.0 → getapo-0.2.0}/src/apo/web/templates/report.html +0 -0
  91. {getapo-0.1.0 → getapo-0.2.0}/src/apo/web/templates/round.html +0 -0
  92. {getapo-0.1.0 → getapo-0.2.0}/src/apo/web/templates/search.html +0 -0
  93. {getapo-0.1.0 → getapo-0.2.0}/src/apo/web/templates/session.html +0 -0
  94. {getapo-0.1.0 → getapo-0.2.0}/src/apo/web/templates/settings.html +0 -0
  95. {getapo-0.1.0 → getapo-0.2.0}/src/apo/web/templates/week.html +0 -0
  96. {getapo-0.1.0 → getapo-0.2.0}/src/getapo.egg-info/SOURCES.txt +0 -0
  97. {getapo-0.1.0 → getapo-0.2.0}/src/getapo.egg-info/dependency_links.txt +0 -0
  98. {getapo-0.1.0 → getapo-0.2.0}/src/getapo.egg-info/requires.txt +0 -0
  99. {getapo-0.1.0 → getapo-0.2.0}/src/getapo.egg-info/top_level.txt +0 -0
  100. {getapo-0.1.0 → getapo-0.2.0}/tests/test_action_spec_render.py +0 -0
  101. {getapo-0.1.0 → getapo-0.2.0}/tests/test_actions.py +0 -0
  102. {getapo-0.1.0 → getapo-0.2.0}/tests/test_answering.py +0 -0
  103. {getapo-0.1.0 → getapo-0.2.0}/tests/test_assets.py +0 -0
  104. {getapo-0.1.0 → getapo-0.2.0}/tests/test_autonomy_rules.py +0 -0
  105. {getapo-0.1.0 → getapo-0.2.0}/tests/test_background.py +0 -0
  106. {getapo-0.1.0 → getapo-0.2.0}/tests/test_browser.py +0 -0
  107. {getapo-0.1.0 → getapo-0.2.0}/tests/test_bugs.py +0 -0
  108. {getapo-0.1.0 → getapo-0.2.0}/tests/test_bulk_and_views.py +0 -0
  109. {getapo-0.1.0 → getapo-0.2.0}/tests/test_changelog.py +0 -0
  110. {getapo-0.1.0 → getapo-0.2.0}/tests/test_checklist_back.py +0 -0
  111. {getapo-0.1.0 → getapo-0.2.0}/tests/test_close_rows.py +0 -0
  112. {getapo-0.1.0 → getapo-0.2.0}/tests/test_continue.py +0 -0
  113. {getapo-0.1.0 → getapo-0.2.0}/tests/test_court.py +0 -0
  114. {getapo-0.1.0 → getapo-0.2.0}/tests/test_credentials.py +0 -0
  115. {getapo-0.1.0 → getapo-0.2.0}/tests/test_cross_site.py +0 -0
  116. {getapo-0.1.0 → getapo-0.2.0}/tests/test_dashboard_cli.py +0 -0
  117. {getapo-0.1.0 → getapo-0.2.0}/tests/test_db.py +0 -0
  118. {getapo-0.1.0 → getapo-0.2.0}/tests/test_decisions_skill.py +0 -0
  119. {getapo-0.1.0 → getapo-0.2.0}/tests/test_decisions_tab.py +0 -0
  120. {getapo-0.1.0 → getapo-0.2.0}/tests/test_delivery.py +0 -0
  121. {getapo-0.1.0 → getapo-0.2.0}/tests/test_digest.py +0 -0
  122. {getapo-0.1.0 → getapo-0.2.0}/tests/test_due_stuck.py +0 -0
  123. {getapo-0.1.0 → getapo-0.2.0}/tests/test_edit_undo.py +0 -0
  124. {getapo-0.1.0 → getapo-0.2.0}/tests/test_events.py +0 -0
  125. {getapo-0.1.0 → getapo-0.2.0}/tests/test_guide.py +0 -0
  126. {getapo-0.1.0 → getapo-0.2.0}/tests/test_item_folder.py +0 -0
  127. {getapo-0.1.0 → getapo-0.2.0}/tests/test_item_page.py +0 -0
  128. {getapo-0.1.0 → getapo-0.2.0}/tests/test_layout_fixes.py +0 -0
  129. {getapo-0.1.0 → getapo-0.2.0}/tests/test_linear_goals.py +0 -0
  130. {getapo-0.1.0 → getapo-0.2.0}/tests/test_live_stream.py +0 -0
  131. {getapo-0.1.0 → getapo-0.2.0}/tests/test_mcp_instructions.py +0 -0
  132. {getapo-0.1.0 → getapo-0.2.0}/tests/test_mcp_server.py +0 -0
  133. {getapo-0.1.0 → getapo-0.2.0}/tests/test_merge_branches.py +0 -0
  134. {getapo-0.1.0 → getapo-0.2.0}/tests/test_navigation.py +0 -0
  135. {getapo-0.1.0 → getapo-0.2.0}/tests/test_new_work.py +0 -0
  136. {getapo-0.1.0 → getapo-0.2.0}/tests/test_notes_labels.py +0 -0
  137. {getapo-0.1.0 → getapo-0.2.0}/tests/test_notify.py +0 -0
  138. {getapo-0.1.0 → getapo-0.2.0}/tests/test_now_leads.py +0 -0
  139. {getapo-0.1.0 → getapo-0.2.0}/tests/test_outcome_pages.py +0 -0
  140. {getapo-0.1.0 → getapo-0.2.0}/tests/test_outcomes.py +0 -0
  141. {getapo-0.1.0 → getapo-0.2.0}/tests/test_overview_order.py +0 -0
  142. {getapo-0.1.0 → getapo-0.2.0}/tests/test_palette_js.py +0 -0
  143. {getapo-0.1.0 → getapo-0.2.0}/tests/test_poll_loop.py +0 -0
  144. {getapo-0.1.0 → getapo-0.2.0}/tests/test_preview_paths.py +0 -0
  145. {getapo-0.1.0 → getapo-0.2.0}/tests/test_priority_due.py +0 -0
  146. {getapo-0.1.0 → getapo-0.2.0}/tests/test_project_home.py +0 -0
  147. {getapo-0.1.0 → getapo-0.2.0}/tests/test_project_identity.py +0 -0
  148. {getapo-0.1.0 → getapo-0.2.0}/tests/test_project_overview.py +0 -0
  149. {getapo-0.1.0 → getapo-0.2.0}/tests/test_project_scope.py +0 -0
  150. {getapo-0.1.0 → getapo-0.2.0}/tests/test_projects.py +0 -0
  151. {getapo-0.1.0 → getapo-0.2.0}/tests/test_quiet_pages.py +0 -0
  152. {getapo-0.1.0 → getapo-0.2.0}/tests/test_rank_and_deps.py +0 -0
  153. {getapo-0.1.0 → getapo-0.2.0}/tests/test_resume_folder.py +0 -0
  154. {getapo-0.1.0 → getapo-0.2.0}/tests/test_round.py +0 -0
  155. {getapo-0.1.0 → getapo-0.2.0}/tests/test_scheduled_resume.py +0 -0
  156. {getapo-0.1.0 → getapo-0.2.0}/tests/test_schema.py +0 -0
  157. {getapo-0.1.0 → getapo-0.2.0}/tests/test_schema_upgrade.py +0 -0
  158. {getapo-0.1.0 → getapo-0.2.0}/tests/test_session_page.py +0 -0
  159. {getapo-0.1.0 → getapo-0.2.0}/tests/test_session_states.py +0 -0
  160. {getapo-0.1.0 → getapo-0.2.0}/tests/test_session_verdict.py +0 -0
  161. {getapo-0.1.0 → getapo-0.2.0}/tests/test_sessions.py +0 -0
  162. {getapo-0.1.0 → getapo-0.2.0}/tests/test_small_fixes.py +0 -0
  163. {getapo-0.1.0 → getapo-0.2.0}/tests/test_snooze.py +0 -0
  164. {getapo-0.1.0 → getapo-0.2.0}/tests/test_sources.py +0 -0
  165. {getapo-0.1.0 → getapo-0.2.0}/tests/test_status_export.py +0 -0
  166. {getapo-0.1.0 → getapo-0.2.0}/tests/test_sync_errors.py +0 -0
  167. {getapo-0.1.0 → getapo-0.2.0}/tests/test_task_attempts.py +0 -0
  168. {getapo-0.1.0 → getapo-0.2.0}/tests/test_task_effort.py +0 -0
  169. {getapo-0.1.0 → getapo-0.2.0}/tests/test_task_page.py +0 -0
  170. {getapo-0.1.0 → getapo-0.2.0}/tests/test_transcripts.py +0 -0
  171. {getapo-0.1.0 → getapo-0.2.0}/tests/test_ui_review.py +0 -0
  172. {getapo-0.1.0 → getapo-0.2.0}/tests/test_usage_limit.py +0 -0
  173. {getapo-0.1.0 → getapo-0.2.0}/tests/test_verify.py +0 -0
  174. {getapo-0.1.0 → getapo-0.2.0}/tests/test_week_and_trend.py +0 -0
  175. {getapo-0.1.0 → getapo-0.2.0}/tests/test_weekly_report.py +0 -0
  176. {getapo-0.1.0 → getapo-0.2.0}/tests/test_work_items.py +0 -0
  177. {getapo-0.1.0 → getapo-0.2.0}/tests/test_work_location.py +0 -0
  178. {getapo-0.1.0 → getapo-0.2.0}/tests/test_work_tab.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: getapo
3
- Version: 0.1.0
3
+ Version: 0.2.0
4
4
  Summary: apo (AI Project Orchestration): a local dashboard and MCP server for Claude Code. Agents ask instead of stopping; you answer every project's questions from one queue.
5
5
  License-Expression: MIT
6
6
  Project-URL: Homepage, https://getapo.pages.dev/
@@ -108,10 +108,6 @@ There's no `apo uninstall` yet. To remove apo by hand:
108
108
  5. `pipx uninstall getapo`
109
109
  6. If you don't want the data: delete the data folder and `~/.config/apo`. Your repositories keep their `.claude/decisions/` folders, which you can delete too.
110
110
 
111
- ## Coming from ai-decision-orchestrator
112
-
113
- apo was called ai-decision-orchestrator (ADO) before 0.1.0. An existing install keeps working: the `ado` command is a deprecated alias for `apo`, `ADO_*` settings are still read, and if `~/.claude/ai-decision-orchestrator/` exists, apo keeps using the data in it and moves nothing. Run `apo init` once to replace the old MCP server, hooks and skill with apo's.
114
-
115
111
  ## Development
116
112
 
117
113
  ```
@@ -65,10 +65,6 @@ There's no `apo uninstall` yet. To remove apo by hand:
65
65
  5. `pipx uninstall getapo`
66
66
  6. If you don't want the data: delete the data folder and `~/.config/apo`. Your repositories keep their `.claude/decisions/` folders, which you can delete too.
67
67
 
68
- ## Coming from ai-decision-orchestrator
69
-
70
- apo was called ai-decision-orchestrator (ADO) before 0.1.0. An existing install keeps working: the `ado` command is a deprecated alias for `apo`, `ADO_*` settings are still read, and if `~/.claude/ai-decision-orchestrator/` exists, apo keeps using the data in it and moves nothing. Run `apo init` once to replace the old MCP server, hooks and skill with apo's.
71
-
72
68
  ## Development
73
69
 
74
70
  ```
@@ -47,7 +47,6 @@ Issues = "https://github.com/ahron-maslin/apo/issues"
47
47
 
48
48
  [project.scripts]
49
49
  apo = "apo.cli:main"
50
- ado = "apo.cli:legacy_main"
51
50
 
52
51
  [tool.setuptools.dynamic]
53
52
  version = { attr = "apo.__version__" }
@@ -1,3 +1,3 @@
1
1
  """apo (AI Project Orchestration): a local dashboard and MCP server for Claude Code."""
2
2
 
3
- __version__ = "0.1.0"
3
+ __version__ = "0.2.0"
@@ -112,7 +112,10 @@ def _cmd_answer(args: argparse.Namespace) -> None:
112
112
  if decision["repository_id"]
113
113
  else db.get_repository_for_project(conn, decision["project_id"])
114
114
  )
115
- if repository:
115
+ if repository and not os.path.isdir(repository["local_path"]):
116
+ print(f"{repository['local_path']} isn't there any more, so nothing was written to disk. "
117
+ f"If the folder moved: apo repo-move \"{repository['local_path']}\" <new path>")
118
+ elif repository:
116
119
  from apo import repo_writer
117
120
  print(f"Written to {repo_writer.decisions_dir(repository['local_path'])} — it'll be "
118
121
  "picked up next time a session starts there.")
@@ -347,6 +350,48 @@ def _cmd_move(args: argparse.Namespace) -> None:
347
350
  print(f"Moved #{args.item_id} to {target['local_path']}.")
348
351
 
349
352
 
353
+ def _cmd_repo_move(args: argparse.Namespace) -> None:
354
+ conn = db.get_connection()
355
+ folders = [dict(r) for r in conn.execute(
356
+ "SELECT repositories.*, projects.name AS project_name FROM repositories "
357
+ "JOIN projects ON projects.id = repositories.project_id ORDER BY repositories.id"
358
+ )]
359
+ if args.project:
360
+ project = db.find_project(conn, args.project)
361
+ if project is None:
362
+ print(f"No project named '{args.project}'.", file=sys.stderr)
363
+ sys.exit(1)
364
+ folders = [f for f in folders if f["project_id"] == project["id"]]
365
+ path = os.path.abspath(os.path.expanduser(args.folder)).rstrip("/") or "/"
366
+ matches = ([f for f in folders if f["local_path"].rstrip("/") == path]
367
+ or [f for f in folders if f["name"] == args.folder]
368
+ or [f for f in folders if f["name"].lower() == args.folder.lower()])
369
+ if not matches:
370
+ print(f"No registered folder at {path} or named '{args.folder}'. `apo projects` lists them.", file=sys.stderr)
371
+ sys.exit(1)
372
+ if len(matches) > 1:
373
+ print(f"'{args.folder}' matches more than one folder; give its path, or add --project:", file=sys.stderr)
374
+ for f in matches:
375
+ print(f" {f['project_name']}: {f['name']} — {f['local_path']}", file=sys.stderr)
376
+ sys.exit(1)
377
+ folder = matches[0]
378
+ try:
379
+ result = db.relocate_repository(conn, folder["id"], os.path.abspath(os.path.expanduser(args.new_path)),
380
+ by="agent" if os.environ.get("CLAUDE_CODE_SESSION_ID") else "human")
381
+ except ValueError as exc:
382
+ print(str(exc), file=sys.stderr)
383
+ sys.exit(1)
384
+ moved = result["repository"]
385
+ print(f"{folder['project_name']}'s folder {result['old_path']} is now {moved['local_path']} (named '{moved['name']}').")
386
+ if result["folded"]:
387
+ print(f"Folded in the copy already registered there: {result['decisions']} decision(s) and "
388
+ f"{result['sessions']} session(s) moved over.")
389
+ if result["written"]:
390
+ print(f"Rewrote {result['written']}.")
391
+ else:
392
+ print(f"Couldn't write {moved['local_path']}/.claude/decisions/ — see `apo sync-errors`.")
393
+
394
+
350
395
  def _cmd_pending(args: argparse.Namespace) -> None:
351
396
  conn = db.get_connection()
352
397
  if args.all:
@@ -410,6 +455,8 @@ def _cmd_archive_project(args: argparse.Namespace) -> None:
410
455
  def _cmd_projects(args: argparse.Namespace) -> None:
411
456
  conn = db.get_connection()
412
457
  counts = db.project_counts(conn)
458
+ missing = db.missing_folders(conn)
459
+ missing_paths = {f["local_path"] for f in missing}
413
460
  for project in conn.execute("SELECT * FROM projects ORDER BY name COLLATE NOCASE").fetchall():
414
461
  repos = [r["local_path"] for r in conn.execute(
415
462
  "SELECT local_path FROM repositories WHERE project_id = ? ORDER BY id", (project["id"],)
@@ -421,7 +468,7 @@ def _cmd_projects(args: argparse.Namespace) -> None:
421
468
  archived = " [archived]" if project["archived_at"] else ""
422
469
  print(f"{project['name']}{archived} — {c['total']} decision(s), {c['open']} open")
423
470
  for path in repos:
424
- print(f" {path}")
471
+ print(f" {path}{' (missing on disk)' if path in missing_paths else ''}")
425
472
  if aliases:
426
473
  print(f" also known as: {', '.join(aliases)}")
427
474
  shared = db.projects_sharing_a_folder(conn)
@@ -432,6 +479,11 @@ def _cmd_projects(args: argparse.Namespace) -> None:
432
479
  print(f" {entry['path']}: {', '.join(entry['projects'])}")
433
480
  for retire in (n for n in entry["projects"] if n != keep):
434
481
  print(f" suggested (keeps the newest name): apo project-merge --from \"{retire}\" --into \"{keep}\"")
482
+ if missing:
483
+ print("\nFolders missing on disk (renamed, moved or deleted; nothing is written to them until fixed):")
484
+ for folder in missing:
485
+ print(f" {folder['local_path']}: {folder['project_name']}")
486
+ print(f" if it moved: apo repo-move \"{folder['local_path']}\" <new path>")
435
487
 
436
488
 
437
489
  def _cmd_project_merge(args: argparse.Namespace) -> None:
@@ -1039,7 +1091,8 @@ def main(argv: list[str] | None = None) -> None:
1039
1091
  archive.set_defaults(func=_cmd_archive_project)
1040
1092
 
1041
1093
  projects_p = sub.add_parser(
1042
- "projects", help="List projects with their folders and aliases, and flag folders shared by two projects",
1094
+ "projects",
1095
+ help="List projects with their folders and aliases, and flag folders shared by two projects or missing on disk",
1043
1096
  )
1044
1097
  projects_p.set_defaults(func=_cmd_projects)
1045
1098
 
@@ -1118,6 +1171,14 @@ def main(argv: list[str] | None = None) -> None:
1118
1171
  move_p.add_argument("folder", help="A folder path, or its name as `apo projects` shows it")
1119
1172
  move_p.set_defaults(func=_cmd_move)
1120
1173
 
1174
+ repo_move = sub.add_parser(
1175
+ "repo-move", help="A folder was renamed or moved on disk: point it at its new path (decisions and sessions follow)",
1176
+ )
1177
+ repo_move.add_argument("folder", help="Its old path, or its name as `apo projects` shows it")
1178
+ repo_move.add_argument("new_path", help="Where the folder is now")
1179
+ repo_move.add_argument("--project", default=None, help="Only look at this project's folders (when a name is ambiguous)")
1180
+ repo_move.set_defaults(func=_cmd_repo_move)
1181
+
1121
1182
  resolve = sub.add_parser(
1122
1183
  "resolve", help="Mark an answered decision resolved once its work is done",
1123
1184
  )
@@ -1183,12 +1244,5 @@ def main(argv: list[str] | None = None) -> None:
1183
1244
  args.func(args)
1184
1245
 
1185
1246
 
1186
- def legacy_main() -> None:
1187
- """`ado`, the old name, kept for a release or two so existing hooks and habits keep
1188
- working. The notice goes to stderr: a hook's stdout is what Claude Code reads."""
1189
- print("ado is deprecated and will be removed; use apo instead.", file=sys.stderr)
1190
- main()
1191
-
1192
-
1193
1247
  if __name__ == "__main__":
1194
1248
  main()
@@ -1,19 +1,15 @@
1
1
  """Where apo keeps its data, and its settings.
2
2
 
3
3
  Every setting is read when it's asked for, never at import: first from the
4
- environment, then from the settings file `apo init` writes (`config_file()`), then
5
- from the .env an older install wrote into ~/.claude/ai-decision-orchestrator/. Each
6
- setting is named APO_*, and still answers to the ADO_* name it had before the rename.
7
- A long-running process or a test sees a change at once, with nothing to re-import.
4
+ environment, then from the settings file `apo init` writes (`config_file()`). Each
5
+ setting is named APO_*. A long-running process or a test sees a change at once, with nothing to re-import.
8
6
  """
9
7
  import os
10
- import sys
11
8
  from pathlib import Path
12
9
 
13
10
  import platformdirs
14
11
 
15
12
  APP_NAME = "apo"
16
- LEGACY_NAME = "ai-decision-orchestrator"
17
13
 
18
14
  _FALSE = ("", "0", "false", "False", "no")
19
15
 
@@ -22,21 +18,9 @@ def default_data_dir() -> Path:
22
18
  return Path(platformdirs.user_data_dir(APP_NAME, appauthor=False))
23
19
 
24
20
 
25
- def legacy_data_dir() -> Path:
26
- return Path.home() / ".claude" / LEGACY_NAME
27
-
28
-
29
21
  def data_dir() -> Path:
30
- """The platform data folder, unless an older install's
31
- ~/.claude/ai-decision-orchestrator exists and the new folder has no database yet:
32
- then the old one, so an existing install keeps its DB, key and attachments
33
- together. Nothing is ever moved. (On macOS the new folder doubles as the config
34
- folder, so it can exist without holding any data.)"""
35
- new = default_data_dir()
36
- legacy = legacy_data_dir()
37
- if legacy.is_dir() and not (new / "orchestrator.db").exists():
38
- return legacy
39
- return new
22
+ """The platform data folder. (On macOS it doubles as the config folder.)"""
23
+ return default_data_dir()
40
24
 
41
25
 
42
26
  def config_dir() -> Path:
@@ -48,12 +32,7 @@ def config_file() -> Path:
48
32
  return config_dir() / "config.env"
49
33
 
50
34
 
51
- def legacy_env_file() -> Path:
52
- return legacy_data_dir() / ".env"
53
-
54
-
55
35
  _file_cache: dict[Path, tuple[tuple[int, int], dict[str, str]]] = {}
56
- _warned: set[str] = set()
57
36
 
58
37
 
59
38
  def read_env_file(path: Path) -> dict[str, str]:
@@ -81,31 +60,20 @@ def read_env_file(path: Path) -> dict[str, str]:
81
60
 
82
61
 
83
62
  def setting(name: str, default: str | None = None, bare: bool = False) -> str | None:
84
- """The first of APO_<name>, ADO_<name> and, with `bare`, plain <name> that is set:
85
- in the environment, then the settings file, then the old .env. A name that is set
86
- but blank still counts, so a blank APO_X hides every fallback."""
87
- names = (f"APO_{name}", f"ADO_{name}") + ((name,) if bare else ())
63
+ """The first of APO_<name> and, with `bare`, plain <name> that is set: in the
64
+ environment, then the settings file. A name that is set but blank still counts, so
65
+ a blank APO_X hides the fallback."""
66
+ names = (f"APO_{name}",) + ((name,) if bare else ())
88
67
  for key in names:
89
68
  if key in os.environ:
90
- if key != names[0]:
91
- _deprecated(key, names[0])
92
69
  return os.environ[key]
93
- for path in (config_file(), legacy_env_file()):
94
- values = read_env_file(path)
95
- for key in names:
96
- if key in values:
97
- return values[key]
70
+ values = read_env_file(config_file())
71
+ for key in names:
72
+ if key in values:
73
+ return values[key]
98
74
  return default
99
75
 
100
76
 
101
- def _deprecated(old: str, new: str) -> None:
102
- """On stderr, never stdout: a hook's stdout is what Claude Code reads."""
103
- if old in _warned:
104
- return
105
- _warned.add(old)
106
- print(f"apo: {old} is deprecated; set {new} instead.", file=sys.stderr)
107
-
108
-
109
77
  def _flag(name: str) -> bool:
110
78
  return (setting(name) or "").strip() not in _FALSE
111
79
 
@@ -3580,6 +3580,103 @@ def projects_sharing_a_folder(conn: sqlite3.Connection) -> list[dict]:
3580
3580
  ]
3581
3581
 
3582
3582
 
3583
+ def missing_folders(conn: sqlite3.Connection) -> list[dict]:
3584
+ """Registered folders that aren't on disk: renamed, moved or deleted. Each one a
3585
+ candidate for `apo repo-move`."""
3586
+ rows = conn.execute(
3587
+ "SELECT repositories.*, projects.name AS project_name, projects.archived_at FROM repositories "
3588
+ "JOIN projects ON projects.id = repositories.project_id ORDER BY repositories.id"
3589
+ ).fetchall()
3590
+ return [dict(r) for r in rows if not os.path.isdir(r["local_path"])]
3591
+
3592
+
3593
+ def relocate_repository(conn: sqlite3.Connection, repository_id: int, new_path: str, *,
3594
+ project_id: int | None = None, by: str = "human", source: str = "cli") -> dict:
3595
+ """Point a registered folder at where it lives now, after it was renamed or moved on
3596
+ disk. The row keeps its id, so its decisions and sessions stay with it. A folder a
3597
+ session already registered at the new path, in the same project, is folded in:
3598
+ its decisions and sessions move over and its row is deleted (first, so
3599
+ UNIQUE(project_id, name) can't block taking its name). .claude/decisions/ is then
3600
+ rewritten once, at the new path only. project_id, when given, is the project the
3601
+ folder must belong to."""
3602
+ from apo import repo_writer
3603
+
3604
+ if project_id is not None:
3605
+ repo = _project_repository(conn, project_id, repository_id)
3606
+ else:
3607
+ repo = get_repository(conn, repository_id)
3608
+ if repo is None:
3609
+ raise ValueError(f"No folder #{repository_id} is registered.")
3610
+ new_path = os.path.expanduser((new_path or "").strip())
3611
+ if not os.path.isabs(new_path):
3612
+ raise ValueError("Give the folder's full new path, like ~/projects/acme.")
3613
+ new_path = _normalized_path(os.path.normpath(new_path))
3614
+ old_path = repo["local_path"]
3615
+ if new_path == _normalized_path(old_path):
3616
+ raise ValueError(f"{repo['name']} is already registered at {new_path}.")
3617
+ if not os.path.isdir(new_path):
3618
+ raise ValueError(f"{new_path} isn't a folder on this computer.")
3619
+ if _is_home_or_above(new_path):
3620
+ raise ValueError(f"{new_path} is your home folder or above it, which can't be a project's folder.")
3621
+
3622
+ project_id = repo["project_id"]
3623
+ name = os.path.basename(new_path) or new_path
3624
+ moved = {"decision_requests": 0, "sessions": 0}
3625
+ if conn.in_transaction:
3626
+ conn.commit()
3627
+ conn.execute("BEGIN IMMEDIATE")
3628
+ try:
3629
+ twins = [r for r in conn.execute("SELECT * FROM repositories WHERE id != ?", (repository_id,))
3630
+ if _normalized_path(r["local_path"]) == new_path]
3631
+ for twin in twins:
3632
+ if twin["project_id"] != project_id:
3633
+ raise ValueError(
3634
+ f"{new_path} already belongs to {get_project_name(conn, twin['project_id'])}. Merge the two "
3635
+ "projects first (apo project-merge), or pick another folder."
3636
+ )
3637
+ for twin in twins:
3638
+ for table in moved:
3639
+ moved[table] += conn.execute(
3640
+ f"UPDATE {table} SET repository_id = ? WHERE repository_id = ?", (repository_id, twin["id"]),
3641
+ ).rowcount
3642
+ conn.execute("DELETE FROM repositories WHERE id = ?", (twin["id"],))
3643
+ clash = conn.execute(
3644
+ "SELECT 1 FROM repositories WHERE project_id = ? AND name = ? AND id != ?", (project_id, name, repository_id),
3645
+ ).fetchone()
3646
+ conn.execute("UPDATE repositories SET local_path = ?, name = ? WHERE id = ?",
3647
+ (new_path, new_path if clash else name, repository_id))
3648
+ _insert_event(conn, verb="folder.moved", actor=by, source=source, project_id=project_id,
3649
+ summary=f"Folder {old_path} is now {new_path}")
3650
+ conn.commit()
3651
+ except BaseException:
3652
+ conn.rollback()
3653
+ raise
3654
+
3655
+ relocated = dict(get_repository(conn, repository_id))
3656
+ started = _now()
3657
+ written = None
3658
+ try:
3659
+ written = repo_writer.sync_repository(conn, relocated)
3660
+ except Exception as exc: # noqa: BLE001
3661
+ record_sync_error(conn, "repo_writer", None, str(exc))
3662
+ else:
3663
+ # What failed while the folder was missing has landed now.
3664
+ conn.execute(
3665
+ "UPDATE sync_errors SET resolved_at = ? WHERE resolved_at IS NULL AND source = 'repo_writer' "
3666
+ "AND occurred_at < ? AND (instr(message, ?) > 0 OR decision_request_id IN "
3667
+ "(SELECT id FROM decision_requests WHERE project_id = ?))",
3668
+ (_now(), started, old_path, project_id),
3669
+ )
3670
+ conn.commit()
3671
+ try:
3672
+ repo_writer.write_policy(new_path, get_project_name(conn, project_id), list_standing_rules(conn, project_id))
3673
+ except OSError as exc:
3674
+ record_sync_error(conn, "repo_writer", None, f"POLICY.md in {new_path}: {exc}")
3675
+ return {"repository": relocated, "old_path": old_path, "folded": len(twins),
3676
+ "decisions": moved["decision_requests"], "sessions": moved["sessions"],
3677
+ "written": str(written.parent) if written else None}
3678
+
3679
+
3583
3680
  def merge_projects(conn: sqlite3.Connection, from_project_id: int, into_project_id: int) -> dict:
3584
3681
  """Fold one project into another: decisions, sessions, repositories and aliases
3585
3682
  move; the same folder registered under both collapses to one repository; the
@@ -3705,7 +3802,8 @@ def take_answers_for_session(conn: sqlite3.Connection, claude_session_id: str) -
3705
3802
  def list_in_transit(conn: sqlite3.Connection) -> list[dict]:
3706
3803
  """Answered but not applied yet. stuck: answered over STUCK_AFTER_HOURS ago with no
3707
3804
  live session in its repo — nothing will pick it up until the human starts one,
3708
- which is what resume_command is for."""
3805
+ which is what resume_command is for. A decline is never stuck: it asks nothing
3806
+ more of anyone, so it can wait for whichever session next opens there."""
3709
3807
  import shlex
3710
3808
 
3711
3809
  from apo import repo_writer
@@ -3729,7 +3827,8 @@ def list_in_transit(conn: sqlite3.Connection) -> list[dict]:
3729
3827
  live = live_row["claude_session_id"] if live_row else None
3730
3828
  decision["live_session"] = live
3731
3829
  decision["dispatched"] = (decision["dispatched_at"] or "") > cutoff
3732
- decision["stuck"] = live is None and not decision["dispatched"] and (decision["answered_at"] or "") < cutoff
3830
+ decision["stuck"] = (live is None and not decision["dispatched"] and decision["answer_kind"] != "decline"
3831
+ and (decision["answered_at"] or "") < cutoff)
3733
3832
  decision["needs_approval"] = (decision["answer_source"] or "") not in LOCAL_ANSWER_SOURCES
3734
3833
  decision["resume_command"] = None
3735
3834
  if repository is not None:
@@ -4134,6 +4233,8 @@ def now_queue(conn: sqlite3.Connection, project_id: int | None = None) -> dict:
4134
4233
  else:
4135
4234
  reason = ("Applying in background" if t["dispatched"]
4136
4235
  else "Delivered to the session that asked" if t["delivery"] == "delivered"
4236
+ else "Declined — the agent sees it when a session next opens in that repo"
4237
+ if t["answer_kind"] == "decline"
4137
4238
  else "Waiting for a session in that repo to pick it up")
4138
4239
  in_transit.append({**item, "reason": reason})
4139
4240
 
@@ -4146,6 +4247,13 @@ def now_queue(conn: sqlite3.Connection, project_id: int | None = None) -> dict:
4146
4247
  problems.append({"key": f"folder:{shared['path']}", "kind": "folder", "project_name": None,
4147
4248
  "title": "Two projects share one folder",
4148
4249
  "reason": f"{', '.join(shared['projects'])} at {shared['path']}", "since": None})
4250
+ for folder in missing_folders(conn):
4251
+ if folder["archived_at"] or not mine(folder["project_id"]):
4252
+ continue
4253
+ problems.append({"key": f"missing:{folder['id']}", "kind": "missing_folder", "project_name": folder["project_name"],
4254
+ "project_id": folder["project_id"], "title": "A project folder is missing",
4255
+ "reason": f"{folder['local_path']} isn't there any more, so nothing is written to it. "
4256
+ "If it was renamed or moved, give its new path.", "since": None})
4149
4257
 
4150
4258
  for outcome in list_outcomes(conn, project_id=project_id, statuses=("active",)):
4151
4259
  if outcome["progress"]["ready_to_close"]:
@@ -5,10 +5,9 @@ It creates the data folder, saves the answers it asks for in the settings file
5
5
  (CLAUDE_CONFIG_DIR, else ~/.claude): registers the MCP server `apo` at user scope,
6
6
  adds the hooks that call the installed `apo`, and copies in the `/decisions` skill.
7
7
 
8
- Run again, it replaces its own entries rather than adding more, and that includes the
9
- ones an older install left under the old names (the `ai-decision-orchestrator` MCP
10
- server, `ado session-*` hooks, the hook script and skill linked from a checkout). It
11
- never touches a hook, a skill or a setting it didn't write.
8
+ Run again, it replaces its own entries rather than adding more, wherever an earlier
9
+ install put them (a hook script or skill linked from a checkout included). It never
10
+ touches a hook, a skill or a setting it didn't write.
12
11
  """
13
12
  import getpass
14
13
  import json
@@ -25,7 +24,6 @@ import apo
25
24
  from apo import claude_runtime, config
26
25
 
27
26
  MCP_NAME = "apo"
28
- LEGACY_MCP_NAME = "ai-decision-orchestrator"
29
27
  NUDGE_SCRIPT = "session-decisions-nudge.sh"
30
28
  SKILL_MARK = "<!-- Installed by apo"
31
29
 
@@ -117,15 +115,15 @@ def _backup(path: Path) -> Path:
117
115
 
118
116
 
119
117
  def is_our_hook(command: str) -> bool:
120
- """A hook this installer, or an older one under the old name, wrote: the nudge
121
- script, or `apo`/`ado` with one of the session subcommands, at any path."""
118
+ """A hook this installer wrote: the nudge script, or `apo` with one of the session
119
+ subcommands, at any path."""
122
120
  try:
123
121
  parts = shlex.split(command)
124
122
  except ValueError:
125
123
  return False
126
124
  if len(parts) == 1:
127
125
  return Path(parts[0]).name == NUDGE_SCRIPT
128
- return len(parts) == 2 and Path(parts[0]).name in ("apo", "ado") and parts[1] in _OUR_SUBCOMMANDS
126
+ return len(parts) == 2 and Path(parts[0]).name == "apo" and parts[1] in _OUR_SUBCOMMANDS
129
127
 
130
128
 
131
129
  def _hook_entry(command: str, timeout: int | None = None, run_async: bool = False,
@@ -142,7 +140,7 @@ def _hook_entry(command: str, timeout: int | None = None, run_async: bool = Fals
142
140
 
143
141
 
144
142
  def merge_hooks(settings: dict, apo_bin: str, nudge_path: Path) -> dict:
145
- """`settings` with every hook of ours (by is_our_hook, any path, either name)
143
+ """`settings` with every hook of ours (by is_our_hook, any path)
146
144
  removed and the current set added once. Everyone else's hooks stay as they were."""
147
145
  hooks = settings.setdefault("hooks", {})
148
146
  for event in list(hooks):
@@ -164,25 +162,8 @@ def merge_hooks(settings: dict, apo_bin: str, nudge_path: Path) -> dict:
164
162
  return settings
165
163
 
166
164
 
167
- def rename_permissions(settings: dict) -> dict:
168
- """Allow-list entries for the old server's tools, moved to the new name."""
169
- permissions = settings.get("permissions")
170
- allow = permissions.get("allow") if isinstance(permissions, dict) else None
171
- if not isinstance(allow, list):
172
- return settings
173
- old = f"mcp__{LEGACY_MCP_NAME}"
174
- renamed = []
175
- for rule in allow:
176
- if isinstance(rule, str) and (rule == old or rule.startswith(old + "__")):
177
- rule = f"mcp__{MCP_NAME}" + rule[len(old):]
178
- if rule not in renamed:
179
- renamed.append(rule)
180
- permissions["allow"] = renamed
181
- return settings
182
-
183
-
184
165
  def install_hooks(settings_path: Path, apo_bin: str, nudge_path: Path) -> str:
185
- """Rewrites settings.json with our hooks and renamed permissions: backed up once
166
+ """Rewrites settings.json with our hooks: backed up once
186
167
  before the first change, written atomically, and left alone if it isn't JSON."""
187
168
  before_text = settings_path.read_text() if settings_path.exists() else None
188
169
  try:
@@ -192,7 +173,7 @@ def install_hooks(settings_path: Path, apo_bin: str, nudge_path: Path) -> str:
192
173
  if not isinstance(settings, dict):
193
174
  return f"skipped: {settings_path} doesn't hold a JSON object"
194
175
  before = json.loads(json.dumps(settings))
195
- after = rename_permissions(merge_hooks(settings, apo_bin, nudge_path))
176
+ after = merge_hooks(settings, apo_bin, nudge_path)
196
177
  if after == before:
197
178
  return f"already up to date in {settings_path}"
198
179
  backup = _backup(settings_path) if before_text is not None else None
@@ -247,24 +228,19 @@ def _manual_mcp_command(apo_bin: str) -> str:
247
228
 
248
229
  def register_mcp_server(apo_bin: str) -> tuple[bool, str]:
249
230
  """`claude mcp add apo --scope user -- <apo> mcp`, after removing any earlier
250
- registration under either name, so a re-run or a moved install updates the entry
251
- instead of failing on it. Never raises: a missing `claude` or a failed add comes
231
+ registration, so a re-run or a moved install updates the entry instead of failing
232
+ on it. Never raises: a missing `claude` or a failed add comes
252
233
  back as a message."""
253
234
  claude = shutil.which(config.claude_bin())
254
235
  if claude is None:
255
236
  return False, f"`claude` isn't on PATH. Register the MCP server yourself:\n {_manual_mcp_command(apo_bin)}"
256
- replaced = []
257
- for name in (LEGACY_MCP_NAME, MCP_NAME):
258
- removed = subprocess.run([claude, "mcp", "remove", name, "--scope", "user"], capture_output=True, text=True)
259
- if removed.returncode == 0 and name == LEGACY_MCP_NAME:
260
- replaced.append(name)
237
+ subprocess.run([claude, "mcp", "remove", MCP_NAME, "--scope", "user"], capture_output=True, text=True)
261
238
  result = subprocess.run([claude, "mcp", "add", MCP_NAME, "--scope", "user", "--", apo_bin, "mcp"],
262
239
  capture_output=True, text=True)
263
240
  if result.returncode != 0:
264
241
  detail = result.stderr.strip() or "claude mcp add failed"
265
242
  return False, f"{detail}\nRegister it yourself:\n {_manual_mcp_command(apo_bin)}"
266
- note = f" (replacing the old {replaced[0]} entry)" if replaced else ""
267
- return True, f"registered as `{MCP_NAME}` at user scope{note}"
243
+ return True, f"registered as `{MCP_NAME}` at user scope"
268
244
 
269
245
 
270
246
  def _ask(prompt: str, args) -> str:
@@ -38,6 +38,16 @@ def decisions_dir(local_path: str) -> Path:
38
38
  return Path(local_path) / DECISIONS_SUBDIR
39
39
 
40
40
 
41
+ def _require_folder(local_path: str) -> None:
42
+ """A registered folder that isn't there was renamed, moved or deleted. Writing
43
+ into it would recreate it, and the answer would land where no session looks."""
44
+ if not Path(local_path).is_dir():
45
+ raise FileNotFoundError(
46
+ f"{local_path} isn't there any more, so nothing was written to it. "
47
+ f"If it moved: apo repo-move \"{local_path}\" <new path>"
48
+ )
49
+
50
+
41
51
  def sync_decision(conn: sqlite3.Connection, decision_id: int) -> Path | None:
42
52
  """Rewrite the projection for whichever repository owns this decision. Only this
43
53
  decision's own file is re-rendered — every other decision in the project keeps
@@ -97,6 +107,7 @@ def sync_repository(
97
107
  summary["blocked_by"] = db.open_blockers(conn, summary["id"])
98
108
  project_name = ", ".join(sorted(set(project_names.values())))
99
109
 
110
+ _require_folder(repository["local_path"])
100
111
  target = decisions_dir(repository["local_path"])
101
112
  target.mkdir(parents=True, exist_ok=True)
102
113
 
@@ -152,6 +163,7 @@ def _copy_attachments(conn: sqlite3.Connection, decision_id: int, local_path: st
152
163
  for attachment in attachments:
153
164
  source = config.get_attachments_dir() / str(decision_id) / attachment["stored_name"]
154
165
  try:
166
+ _require_folder(local_path)
155
167
  target_dir.mkdir(parents=True, exist_ok=True)
156
168
  shutil.copyfile(source, target_dir / attachment["stored_name"])
157
169
  except OSError as exc:
@@ -355,6 +367,7 @@ def write_policy(local_path: str, project_name: str, rules: list[dict]) -> None:
355
367
  if path.exists() and path.read_text().startswith(_POLICY_MARKS):
356
368
  path.unlink()
357
369
  return
370
+ _require_folder(local_path)
358
371
  lines = [f"{_POLICY_MARK}; edit the rules on the project's Overview. -->",
359
372
  f"# Standing rules for {project_name}", "",
360
373
  "Read these before filing a decision. If a rule answers the question, follow it instead of "
@@ -203,7 +203,7 @@ Your answer is written into the repository at `.claude/decisions/` (an `INDEX.md
203
203
 
204
204
  1. **The session that asked hears it** on your next prompt there. You'll see "Answered #31: …" in its context. Say "go" there and it applies it.
205
205
  2. **Any other session in that repo** is told at start-up that answers are waiting. Run `/decisions` in it to apply them.
206
- 3. **If nothing is running in that repo**, the item says so. After an hour it comes back to Your move as *answered, but nothing will pick it up*. Then:
206
+ 3. **If nothing is running in that repo**, the item says so. After an hour it comes back to Your move as *answered, but nothing will pick it up* — unless you declined it, which asks nothing more of you: that stays in transit until a session next opens there. Then:
207
207
  - **Apply in background** starts a session for you (below).
208
208
  - Or copy the **resume command** and run it yourself.
209
209
 
@@ -328,6 +328,8 @@ Any of them can go under one of the project's goals and have a due date. On All
328
328
 
329
329
  When a project has more than one folder (say a root folder and a `dashboard` subfolder), New work and the goal page's **Add a step** ask which **Folder** the work belongs in. It starts on the folder a session last worked in. Agents only see work through a folder's `.claude/decisions/INDEX.md`, so this decides which sessions find it. To move an item later, use **Move to folder** under **Manage** on its page, or `apo move <id> <folder>` (a path, or the folder's name). An item with no folder shows **No folder** on its page and "no folder chosen" in `apo pending --all`.
330
330
 
331
+ If a folder is renamed or moved on disk, give apo its new path: **Moved or renamed it?** under **Folders** in the project's settings, or `apo repo-move <old path or name> <new path>`. Its items and sessions follow it, and a copy a session already registered at the new path is folded in. Until then nothing is written to the missing folder: Now lists it as a problem, and `apo projects` flags it.
332
+
331
333
  **Decisions** has what's waiting on you, each row with its own **Accept** (saying what you'd accept and how sure the agent is) or **Done** for an action, so you can answer without opening it; then the **decision log**: every answered decision with its question, the answer, when, and who answered. Filter it with `/`. It's how you avoid deciding something twice.
332
334
 
333
335
  **Agents** has the project's session cards with their checklists, and sessions that ended recently. To start a session, use New work on the Work tab.
@@ -987,6 +987,7 @@ def project_settings_page(request: Request, project_id: int, choose_linear: int
987
987
  "linear_goals": _linear_goals_panel(conn, _project_row(conn, project_id), choose_linear),
988
988
  "rules": db.list_standing_rules(conn, project_id),
989
989
  "rule_suggestion": db.rule_suggestion(conn, project_id),
990
+ "missing_folder_ids": {f["id"] for f in db.missing_folders(conn) if f["project_id"] == project_id},
990
991
  })
991
992
 
992
993
 
@@ -1659,6 +1660,19 @@ def add_rule_route(project_id: int, text: str = Form(""), source_decision_id: st
1659
1660
  return RedirectResponse(back, status_code=303)
1660
1661
 
1661
1662
 
1663
+ @app.post("/projects/{project_id}/folders/{repository_id}/path")
1664
+ def relocate_folder_route(project_id: int, repository_id: int, path: str = Form("")):
1665
+ """A folder renamed or moved on disk, pointed at where it is now."""
1666
+ conn = db.get_connection()
1667
+ _project_row(conn, project_id)
1668
+ back = f"/projects/{project_id}/settings#folders"
1669
+ try:
1670
+ db.relocate_repository(conn, repository_id, path, project_id=project_id, source="dashboard")
1671
+ except ValueError as exc:
1672
+ return _with_param(back, "error", str(exc))
1673
+ return RedirectResponse(back, status_code=303)
1674
+
1675
+
1662
1676
  @app.post("/projects/{project_id}/rules/{rule_id}/retire")
1663
1677
  def retire_rule_route(project_id: int, rule_id: int):
1664
1678
  conn = db.get_connection()
@@ -1420,6 +1420,10 @@ form.settings-body { padding: 0; margin: 0; }
1420
1420
  .settings-inline .input { width: auto; min-width: 14rem; }
1421
1421
  .folder-list { list-style: none; margin: 0; padding: var(--s-2) var(--s-4); display: flex; flex-direction: column; gap: var(--s-1); }
1422
1422
  .folder-name { font-weight: 500; }
1423
+ .folder-list > li { display: flex; flex-direction: column; gap: var(--s-1); padding: var(--s-1) 0; overflow-wrap: anywhere; }
1424
+ .folder-move > summary { font-size: var(--fs-sm); color: var(--text-3); }
1425
+ .folder-move > form { margin-top: var(--s-2); }
1426
+ .folder-move .field-hint { margin: var(--s-1) 0 0; }
1423
1427
  .rule-nudge { display: flex; align-items: center; gap: var(--s-2); padding: var(--s-2) var(--s-4); margin: 0 0 var(--s-5); font-size: var(--fs-sm); border-color: var(--accent-border); }
1424
1428
  @media (max-width: 720px) { .settings-row { grid-template-columns: minmax(0, 1fr); } }
1425
1429
  .linear-goals h3, .subsection-title { font-size: var(--fs-sm); font-weight: 600; margin: 0 0 var(--s-2); }
@@ -127,6 +127,8 @@
127
127
  <a class="section-link" href="/settings">{{ icon("plug") }}Check the connection</a>
128
128
  {% elif item.kind == "folder" %}
129
129
  <p class="hint">Run <code>apo projects</code> for the merge command.</p>
130
+ {% elif item.kind == "missing_folder" %}
131
+ <a class="section-link" href="/projects/{{ item.project_id }}/settings#folders">{{ icon("folder") }}Set its new path</a>
130
132
  {% endif %}
131
133
 
132
134
  {% if item.kind == "transit" and not item.decision.live_session and not item.decision.dispatched and item.decision.repository_id is not none %}