getapo 0.3.0__tar.gz → 0.3.1__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 (176) hide show
  1. {getapo-0.3.0/src/getapo.egg-info → getapo-0.3.1}/PKG-INFO +1 -1
  2. {getapo-0.3.0 → getapo-0.3.1}/src/apo/__init__.py +1 -1
  3. {getapo-0.3.0 → getapo-0.3.1}/src/apo/db.py +87 -12
  4. {getapo-0.3.0 → getapo-0.3.1}/src/apo/web/app.py +2 -1
  5. {getapo-0.3.0 → getapo-0.3.1}/src/apo/web/static/app.js +0 -23
  6. {getapo-0.3.0 → getapo-0.3.1}/src/apo/web/templates/_attachment_composer.html +1 -2
  7. {getapo-0.3.0 → getapo-0.3.1/src/getapo.egg-info}/PKG-INFO +1 -1
  8. {getapo-0.3.0 → getapo-0.3.1}/tests/test_answering.py +20 -0
  9. {getapo-0.3.0 → getapo-0.3.1}/tests/test_browser.py +20 -0
  10. {getapo-0.3.0 → getapo-0.3.1}/tests/test_entry_points.py +1 -1
  11. {getapo-0.3.0 → getapo-0.3.1}/tests/test_folder_identity.py +131 -0
  12. {getapo-0.3.0 → getapo-0.3.1}/tests/test_wheel.py +1 -1
  13. {getapo-0.3.0 → getapo-0.3.1}/LICENSE +0 -0
  14. {getapo-0.3.0 → getapo-0.3.1}/README.md +0 -0
  15. {getapo-0.3.0 → getapo-0.3.1}/THIRD_PARTY_NOTICES.md +0 -0
  16. {getapo-0.3.0 → getapo-0.3.1}/pyproject.toml +0 -0
  17. {getapo-0.3.0 → getapo-0.3.1}/setup.cfg +0 -0
  18. {getapo-0.3.0 → getapo-0.3.1}/src/apo/__main__.py +0 -0
  19. {getapo-0.3.0 → getapo-0.3.1}/src/apo/changelog.py +0 -0
  20. {getapo-0.3.0 → getapo-0.3.1}/src/apo/claude_runtime.py +0 -0
  21. {getapo-0.3.0 → getapo-0.3.1}/src/apo/cli.py +0 -0
  22. {getapo-0.3.0 → getapo-0.3.1}/src/apo/config.py +0 -0
  23. {getapo-0.3.0 → getapo-0.3.1}/src/apo/credentials.py +0 -0
  24. {getapo-0.3.0 → getapo-0.3.1}/src/apo/installer.py +0 -0
  25. {getapo-0.3.0 → getapo-0.3.1}/src/apo/integrations/__init__.py +0 -0
  26. {getapo-0.3.0 → getapo-0.3.1}/src/apo/integrations/linear_client.py +0 -0
  27. {getapo-0.3.0 → getapo-0.3.1}/src/apo/integrations/linear_goals.py +0 -0
  28. {getapo-0.3.0 → getapo-0.3.1}/src/apo/integrations/sources.py +0 -0
  29. {getapo-0.3.0 → getapo-0.3.1}/src/apo/mcp_server.py +0 -0
  30. {getapo-0.3.0 → getapo-0.3.1}/src/apo/repo_writer.py +0 -0
  31. {getapo-0.3.0 → getapo-0.3.1}/src/apo/resources/guide.md +0 -0
  32. {getapo-0.3.0 → getapo-0.3.1}/src/apo/resources/hooks/session-decisions-nudge.sh +0 -0
  33. {getapo-0.3.0 → getapo-0.3.1}/src/apo/resources/skills/decisions/SKILL.md +0 -0
  34. {getapo-0.3.0 → getapo-0.3.1}/src/apo/transcripts.py +0 -0
  35. {getapo-0.3.0 → getapo-0.3.1}/src/apo/verify.py +0 -0
  36. {getapo-0.3.0 → getapo-0.3.1}/src/apo/web/__init__.py +0 -0
  37. {getapo-0.3.0 → getapo-0.3.1}/src/apo/web/static/app.css +0 -0
  38. {getapo-0.3.0 → getapo-0.3.1}/src/apo/web/static/fleet.js +0 -0
  39. {getapo-0.3.0 → getapo-0.3.1}/src/apo/web/static/live.js +0 -0
  40. {getapo-0.3.0 → getapo-0.3.1}/src/apo/web/static/notify.js +0 -0
  41. {getapo-0.3.0 → getapo-0.3.1}/src/apo/web/static/now.js +0 -0
  42. {getapo-0.3.0 → getapo-0.3.1}/src/apo/web/static/palette.js +0 -0
  43. {getapo-0.3.0 → getapo-0.3.1}/src/apo/web/static/round.js +0 -0
  44. {getapo-0.3.0 → getapo-0.3.1}/src/apo/web/templates/_bulk.html +0 -0
  45. {getapo-0.3.0 → getapo-0.3.1}/src/apo/web/templates/_icons.html +0 -0
  46. {getapo-0.3.0 → getapo-0.3.1}/src/apo/web/templates/_macros.html +0 -0
  47. {getapo-0.3.0 → getapo-0.3.1}/src/apo/web/templates/_merge_result.html +0 -0
  48. {getapo-0.3.0 → getapo-0.3.1}/src/apo/web/templates/_now_item.html +0 -0
  49. {getapo-0.3.0 → getapo-0.3.1}/src/apo/web/templates/_project_macros.html +0 -0
  50. {getapo-0.3.0 → getapo-0.3.1}/src/apo/web/templates/_prompt_form.html +0 -0
  51. {getapo-0.3.0 → getapo-0.3.1}/src/apo/web/templates/_resume_actions.html +0 -0
  52. {getapo-0.3.0 → getapo-0.3.1}/src/apo/web/templates/_session_card.html +0 -0
  53. {getapo-0.3.0 → getapo-0.3.1}/src/apo/web/templates/_work_location.html +0 -0
  54. {getapo-0.3.0 → getapo-0.3.1}/src/apo/web/templates/_work_main.html +0 -0
  55. {getapo-0.3.0 → getapo-0.3.1}/src/apo/web/templates/_work_status.html +0 -0
  56. {getapo-0.3.0 → getapo-0.3.1}/src/apo/web/templates/accept.html +0 -0
  57. {getapo-0.3.0 → getapo-0.3.1}/src/apo/web/templates/all_activity.html +0 -0
  58. {getapo-0.3.0 → getapo-0.3.1}/src/apo/web/templates/all_agents.html +0 -0
  59. {getapo-0.3.0 → getapo-0.3.1}/src/apo/web/templates/all_decisions.html +0 -0
  60. {getapo-0.3.0 → getapo-0.3.1}/src/apo/web/templates/all_overview.html +0 -0
  61. {getapo-0.3.0 → getapo-0.3.1}/src/apo/web/templates/all_work.html +0 -0
  62. {getapo-0.3.0 → getapo-0.3.1}/src/apo/web/templates/base.html +0 -0
  63. {getapo-0.3.0 → getapo-0.3.1}/src/apo/web/templates/decision.html +0 -0
  64. {getapo-0.3.0 → getapo-0.3.1}/src/apo/web/templates/guide.html +0 -0
  65. {getapo-0.3.0 → getapo-0.3.1}/src/apo/web/templates/now.html +0 -0
  66. {getapo-0.3.0 → getapo-0.3.1}/src/apo/web/templates/outcome.html +0 -0
  67. {getapo-0.3.0 → getapo-0.3.1}/src/apo/web/templates/project_activity.html +0 -0
  68. {getapo-0.3.0 → getapo-0.3.1}/src/apo/web/templates/project_agents.html +0 -0
  69. {getapo-0.3.0 → getapo-0.3.1}/src/apo/web/templates/project_decisions.html +0 -0
  70. {getapo-0.3.0 → getapo-0.3.1}/src/apo/web/templates/project_overview.html +0 -0
  71. {getapo-0.3.0 → getapo-0.3.1}/src/apo/web/templates/project_settings.html +0 -0
  72. {getapo-0.3.0 → getapo-0.3.1}/src/apo/web/templates/project_work.html +0 -0
  73. {getapo-0.3.0 → getapo-0.3.1}/src/apo/web/templates/projects_shell.html +0 -0
  74. {getapo-0.3.0 → getapo-0.3.1}/src/apo/web/templates/report.html +0 -0
  75. {getapo-0.3.0 → getapo-0.3.1}/src/apo/web/templates/round.html +0 -0
  76. {getapo-0.3.0 → getapo-0.3.1}/src/apo/web/templates/search.html +0 -0
  77. {getapo-0.3.0 → getapo-0.3.1}/src/apo/web/templates/session.html +0 -0
  78. {getapo-0.3.0 → getapo-0.3.1}/src/apo/web/templates/settings.html +0 -0
  79. {getapo-0.3.0 → getapo-0.3.1}/src/apo/web/templates/week.html +0 -0
  80. {getapo-0.3.0 → getapo-0.3.1}/src/getapo.egg-info/SOURCES.txt +0 -0
  81. {getapo-0.3.0 → getapo-0.3.1}/src/getapo.egg-info/dependency_links.txt +0 -0
  82. {getapo-0.3.0 → getapo-0.3.1}/src/getapo.egg-info/entry_points.txt +0 -0
  83. {getapo-0.3.0 → getapo-0.3.1}/src/getapo.egg-info/requires.txt +0 -0
  84. {getapo-0.3.0 → getapo-0.3.1}/src/getapo.egg-info/top_level.txt +0 -0
  85. {getapo-0.3.0 → getapo-0.3.1}/tests/test_action_spec_render.py +0 -0
  86. {getapo-0.3.0 → getapo-0.3.1}/tests/test_actions.py +0 -0
  87. {getapo-0.3.0 → getapo-0.3.1}/tests/test_app.py +0 -0
  88. {getapo-0.3.0 → getapo-0.3.1}/tests/test_assets.py +0 -0
  89. {getapo-0.3.0 → getapo-0.3.1}/tests/test_autonomy_rules.py +0 -0
  90. {getapo-0.3.0 → getapo-0.3.1}/tests/test_background.py +0 -0
  91. {getapo-0.3.0 → getapo-0.3.1}/tests/test_bugs.py +0 -0
  92. {getapo-0.3.0 → getapo-0.3.1}/tests/test_bulk_and_views.py +0 -0
  93. {getapo-0.3.0 → getapo-0.3.1}/tests/test_cancel_button.py +0 -0
  94. {getapo-0.3.0 → getapo-0.3.1}/tests/test_changelog.py +0 -0
  95. {getapo-0.3.0 → getapo-0.3.1}/tests/test_checklist_back.py +0 -0
  96. {getapo-0.3.0 → getapo-0.3.1}/tests/test_claude_runtime.py +0 -0
  97. {getapo-0.3.0 → getapo-0.3.1}/tests/test_cli.py +0 -0
  98. {getapo-0.3.0 → getapo-0.3.1}/tests/test_cli_hooks.py +0 -0
  99. {getapo-0.3.0 → getapo-0.3.1}/tests/test_close_rows.py +0 -0
  100. {getapo-0.3.0 → getapo-0.3.1}/tests/test_config.py +0 -0
  101. {getapo-0.3.0 → getapo-0.3.1}/tests/test_continue.py +0 -0
  102. {getapo-0.3.0 → getapo-0.3.1}/tests/test_court.py +0 -0
  103. {getapo-0.3.0 → getapo-0.3.1}/tests/test_credentials.py +0 -0
  104. {getapo-0.3.0 → getapo-0.3.1}/tests/test_cross_site.py +0 -0
  105. {getapo-0.3.0 → getapo-0.3.1}/tests/test_dashboard_cli.py +0 -0
  106. {getapo-0.3.0 → getapo-0.3.1}/tests/test_db.py +0 -0
  107. {getapo-0.3.0 → getapo-0.3.1}/tests/test_decisions_skill.py +0 -0
  108. {getapo-0.3.0 → getapo-0.3.1}/tests/test_decisions_tab.py +0 -0
  109. {getapo-0.3.0 → getapo-0.3.1}/tests/test_delivery.py +0 -0
  110. {getapo-0.3.0 → getapo-0.3.1}/tests/test_digest.py +0 -0
  111. {getapo-0.3.0 → getapo-0.3.1}/tests/test_due_stuck.py +0 -0
  112. {getapo-0.3.0 → getapo-0.3.1}/tests/test_edit_undo.py +0 -0
  113. {getapo-0.3.0 → getapo-0.3.1}/tests/test_events.py +0 -0
  114. {getapo-0.3.0 → getapo-0.3.1}/tests/test_guide.py +0 -0
  115. {getapo-0.3.0 → getapo-0.3.1}/tests/test_installer.py +0 -0
  116. {getapo-0.3.0 → getapo-0.3.1}/tests/test_item_folder.py +0 -0
  117. {getapo-0.3.0 → getapo-0.3.1}/tests/test_item_page.py +0 -0
  118. {getapo-0.3.0 → getapo-0.3.1}/tests/test_layout_fixes.py +0 -0
  119. {getapo-0.3.0 → getapo-0.3.1}/tests/test_linear_client.py +0 -0
  120. {getapo-0.3.0 → getapo-0.3.1}/tests/test_linear_goals.py +0 -0
  121. {getapo-0.3.0 → getapo-0.3.1}/tests/test_live_stream.py +0 -0
  122. {getapo-0.3.0 → getapo-0.3.1}/tests/test_mcp_instructions.py +0 -0
  123. {getapo-0.3.0 → getapo-0.3.1}/tests/test_mcp_server.py +0 -0
  124. {getapo-0.3.0 → getapo-0.3.1}/tests/test_merge_branches.py +0 -0
  125. {getapo-0.3.0 → getapo-0.3.1}/tests/test_names.py +0 -0
  126. {getapo-0.3.0 → getapo-0.3.1}/tests/test_navigation.py +0 -0
  127. {getapo-0.3.0 → getapo-0.3.1}/tests/test_new_work.py +0 -0
  128. {getapo-0.3.0 → getapo-0.3.1}/tests/test_notes_labels.py +0 -0
  129. {getapo-0.3.0 → getapo-0.3.1}/tests/test_notify.py +0 -0
  130. {getapo-0.3.0 → getapo-0.3.1}/tests/test_now.py +0 -0
  131. {getapo-0.3.0 → getapo-0.3.1}/tests/test_now_leads.py +0 -0
  132. {getapo-0.3.0 → getapo-0.3.1}/tests/test_outcome_pages.py +0 -0
  133. {getapo-0.3.0 → getapo-0.3.1}/tests/test_outcomes.py +0 -0
  134. {getapo-0.3.0 → getapo-0.3.1}/tests/test_overview_order.py +0 -0
  135. {getapo-0.3.0 → getapo-0.3.1}/tests/test_palette_js.py +0 -0
  136. {getapo-0.3.0 → getapo-0.3.1}/tests/test_poll_loop.py +0 -0
  137. {getapo-0.3.0 → getapo-0.3.1}/tests/test_preview_paths.py +0 -0
  138. {getapo-0.3.0 → getapo-0.3.1}/tests/test_priority_due.py +0 -0
  139. {getapo-0.3.0 → getapo-0.3.1}/tests/test_project_home.py +0 -0
  140. {getapo-0.3.0 → getapo-0.3.1}/tests/test_project_identity.py +0 -0
  141. {getapo-0.3.0 → getapo-0.3.1}/tests/test_project_overview.py +0 -0
  142. {getapo-0.3.0 → getapo-0.3.1}/tests/test_project_scope.py +0 -0
  143. {getapo-0.3.0 → getapo-0.3.1}/tests/test_project_settings.py +0 -0
  144. {getapo-0.3.0 → getapo-0.3.1}/tests/test_projects.py +0 -0
  145. {getapo-0.3.0 → getapo-0.3.1}/tests/test_prompt_answers.py +0 -0
  146. {getapo-0.3.0 → getapo-0.3.1}/tests/test_quiet_pages.py +0 -0
  147. {getapo-0.3.0 → getapo-0.3.1}/tests/test_rank_and_deps.py +0 -0
  148. {getapo-0.3.0 → getapo-0.3.1}/tests/test_repo_writer.py +0 -0
  149. {getapo-0.3.0 → getapo-0.3.1}/tests/test_resume_folder.py +0 -0
  150. {getapo-0.3.0 → getapo-0.3.1}/tests/test_round.py +0 -0
  151. {getapo-0.3.0 → getapo-0.3.1}/tests/test_scheduled_resume.py +0 -0
  152. {getapo-0.3.0 → getapo-0.3.1}/tests/test_schema.py +0 -0
  153. {getapo-0.3.0 → getapo-0.3.1}/tests/test_schema_upgrade.py +0 -0
  154. {getapo-0.3.0 → getapo-0.3.1}/tests/test_search.py +0 -0
  155. {getapo-0.3.0 → getapo-0.3.1}/tests/test_session_page.py +0 -0
  156. {getapo-0.3.0 → getapo-0.3.1}/tests/test_session_states.py +0 -0
  157. {getapo-0.3.0 → getapo-0.3.1}/tests/test_session_verdict.py +0 -0
  158. {getapo-0.3.0 → getapo-0.3.1}/tests/test_sessions.py +0 -0
  159. {getapo-0.3.0 → getapo-0.3.1}/tests/test_small_fixes.py +0 -0
  160. {getapo-0.3.0 → getapo-0.3.1}/tests/test_snooze.py +0 -0
  161. {getapo-0.3.0 → getapo-0.3.1}/tests/test_sources.py +0 -0
  162. {getapo-0.3.0 → getapo-0.3.1}/tests/test_station_read_api.py +0 -0
  163. {getapo-0.3.0 → getapo-0.3.1}/tests/test_status_export.py +0 -0
  164. {getapo-0.3.0 → getapo-0.3.1}/tests/test_sync_errors.py +0 -0
  165. {getapo-0.3.0 → getapo-0.3.1}/tests/test_task_attempts.py +0 -0
  166. {getapo-0.3.0 → getapo-0.3.1}/tests/test_task_effort.py +0 -0
  167. {getapo-0.3.0 → getapo-0.3.1}/tests/test_task_page.py +0 -0
  168. {getapo-0.3.0 → getapo-0.3.1}/tests/test_transcripts.py +0 -0
  169. {getapo-0.3.0 → getapo-0.3.1}/tests/test_ui_review.py +0 -0
  170. {getapo-0.3.0 → getapo-0.3.1}/tests/test_usage_limit.py +0 -0
  171. {getapo-0.3.0 → getapo-0.3.1}/tests/test_verify.py +0 -0
  172. {getapo-0.3.0 → getapo-0.3.1}/tests/test_week_and_trend.py +0 -0
  173. {getapo-0.3.0 → getapo-0.3.1}/tests/test_weekly_report.py +0 -0
  174. {getapo-0.3.0 → getapo-0.3.1}/tests/test_work_items.py +0 -0
  175. {getapo-0.3.0 → getapo-0.3.1}/tests/test_work_location.py +0 -0
  176. {getapo-0.3.0 → getapo-0.3.1}/tests/test_work_tab.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: getapo
3
- Version: 0.3.0
3
+ Version: 0.3.1
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/
@@ -1,3 +1,3 @@
1
1
  """apo (AI Project Orchestration): a local dashboard and MCP server for Claude Code."""
2
2
 
3
- __version__ = "0.3.0"
3
+ __version__ = "0.3.1"
@@ -20,7 +20,7 @@ from typing import Iterable
20
20
  from apo import config
21
21
 
22
22
 
23
- SCHEMA_VERSION = 24
23
+ SCHEMA_VERSION = 25
24
24
 
25
25
 
26
26
  def data_version(conn: sqlite3.Connection) -> int:
@@ -343,6 +343,51 @@ def _drop_home_directory_registrations(conn: sqlite3.Connection) -> None:
343
343
  conn.execute("DELETE FROM projects WHERE id = ?", (project_id,))
344
344
 
345
345
 
346
+ def _drop_folder_of_projects_registrations(conn: sqlite3.Connection) -> None:
347
+ """Undo folders of projects (~/projects) auto-registered by a session started there.
348
+ Only ones nothing was ever filed against, as for ~ at 6. Their sessions go to the
349
+ folder each one ran in, registering it as any session start would now."""
350
+ for repo in conn.execute("SELECT * FROM repositories").fetchall():
351
+ if not _is_folder_of_projects(repo["local_path"]):
352
+ continue
353
+ project_id = repo["project_id"]
354
+ on_record = conn.execute(
355
+ "SELECT 1 FROM decision_requests WHERE repository_id = ? OR project_id = ? UNION ALL "
356
+ "SELECT 1 FROM outcomes WHERE project_id = ? UNION ALL "
357
+ "SELECT 1 FROM standing_rules WHERE project_id = ? LIMIT 1",
358
+ (repo["id"], project_id, project_id, project_id),
359
+ ).fetchone()
360
+ if on_record:
361
+ continue
362
+ moving = [r["claude_session_id"] for r in conn.execute(
363
+ "SELECT claude_session_id FROM sessions WHERE repository_id = ?", (repo["id"],))]
364
+ conn.execute("UPDATE sessions SET repository_id = NULL, project_id = NULL WHERE repository_id = ?",
365
+ (repo["id"],))
366
+ conn.execute("DELETE FROM repositories WHERE id = ?", (repo["id"],))
367
+ project_gone = not conn.execute(
368
+ "SELECT 1 FROM repositories WHERE project_id = ?", (project_id,)).fetchone()
369
+ if project_gone:
370
+ moving += [r["claude_session_id"] for r in conn.execute(
371
+ "SELECT claude_session_id FROM sessions WHERE project_id = ?", (project_id,))]
372
+ conn.execute("UPDATE sessions SET repository_id = NULL, project_id = NULL WHERE project_id = ?",
373
+ (project_id,))
374
+ for claude_session_id in moving:
375
+ cwd = conn.execute("SELECT cwd FROM sessions WHERE claude_session_id = ?",
376
+ (claude_session_id,)).fetchone()["cwd"]
377
+ home = None
378
+ if cwd and Path(cwd).is_dir():
379
+ home = find_repository_by_path(conn, cwd) or _auto_register_repository_for_cwd(conn, cwd, commit=False)
380
+ if home is not None:
381
+ conn.execute("UPDATE sessions SET project_id = ?, repository_id = ? WHERE claude_session_id = ?",
382
+ (home["project_id"], home["id"], claude_session_id))
383
+ conn.execute("UPDATE events SET project_id = ? WHERE session_id = ? AND project_id = ?",
384
+ (home["project_id"] if home else None, claude_session_id, project_id))
385
+ if project_gone:
386
+ conn.execute("UPDATE events SET project_id = NULL WHERE project_id = ?", (project_id,))
387
+ conn.execute("DELETE FROM project_aliases WHERE project_id = ?", (project_id,))
388
+ conn.execute("DELETE FROM projects WHERE id = ?", (project_id,))
389
+
390
+
346
391
  def _backfill_events(conn: sqlite3.Connection) -> None:
347
392
  """Rebuild the event history from the per-decision audit log and session rows,
348
393
  in time order, so Activity isn't empty on day one."""
@@ -396,6 +441,7 @@ _DATA_MIGRATIONS = {
396
441
  12: lambda conn: conn.execute("UPDATE decision_requests SET assignee = 'human' WHERE assignee IS NULL"),
397
442
  14: lambda conn: rebuild_search_index(conn, commit=False),
398
443
  18: _square_linear_closings,
444
+ 25: _drop_folder_of_projects_registrations,
399
445
  9: lambda conn: conn.execute(
400
446
  "UPDATE decision_requests SET delivery = CASE "
401
447
  "WHEN status = 'answered' THEN 'pending' "
@@ -696,14 +742,15 @@ def find_project(conn: sqlite3.Connection, name: str) -> sqlite3.Row | None:
696
742
  return None
697
743
 
698
744
 
699
- def get_or_create_project(conn: sqlite3.Connection, name: str) -> sqlite3.Row:
745
+ def get_or_create_project(conn: sqlite3.Connection, name: str, commit: bool = True) -> sqlite3.Row:
700
746
  row = find_project(conn, name)
701
747
  if row:
702
748
  return row
703
749
  conn.execute(
704
750
  "INSERT INTO projects (name, created_at) VALUES (?, ?)", (name, _now())
705
751
  )
706
- conn.commit()
752
+ if commit:
753
+ conn.commit()
707
754
  return conn.execute("SELECT * FROM projects WHERE name = ?", (name,)).fetchone()
708
755
 
709
756
 
@@ -1637,12 +1684,15 @@ def _desc(iso_ts: str) -> tuple:
1637
1684
  return tuple(-ord(ch) for ch in iso_ts)
1638
1685
 
1639
1686
 
1640
- def create_repository(conn: sqlite3.Connection, project_id: int, name: str, local_path: str) -> sqlite3.Row:
1687
+ def create_repository(
1688
+ conn: sqlite3.Connection, project_id: int, name: str, local_path: str, commit: bool = True,
1689
+ ) -> sqlite3.Row:
1641
1690
  conn.execute(
1642
1691
  "INSERT INTO repositories (project_id, name, local_path, created_at) VALUES (?, ?, ?, ?)",
1643
1692
  (project_id, name, local_path, _now()),
1644
1693
  )
1645
- conn.commit()
1694
+ if commit:
1695
+ conn.commit()
1646
1696
  return conn.execute(
1647
1697
  "SELECT * FROM repositories WHERE project_id = ? AND name = ?", (project_id, name)
1648
1698
  ).fetchone()
@@ -3455,7 +3505,9 @@ def get_repository(conn: sqlite3.Connection, repository_id: int) -> sqlite3.Row
3455
3505
  return conn.execute("SELECT * FROM repositories WHERE id = ?", (repository_id,)).fetchone()
3456
3506
 
3457
3507
 
3458
- def get_or_create_repository(conn: sqlite3.Connection, project_id: int, local_path: str) -> sqlite3.Row:
3508
+ def get_or_create_repository(
3509
+ conn: sqlite3.Connection, project_id: int, local_path: str, commit: bool = True,
3510
+ ) -> sqlite3.Row:
3459
3511
  row = conn.execute(
3460
3512
  "SELECT * FROM repositories WHERE project_id = ? AND local_path = ?",
3461
3513
  (project_id, local_path),
@@ -3468,7 +3520,7 @@ def get_or_create_repository(conn: sqlite3.Connection, project_id: int, local_pa
3468
3520
  ).fetchone()
3469
3521
  if collision:
3470
3522
  name = local_path
3471
- return create_repository(conn, project_id, name, local_path)
3523
+ return create_repository(conn, project_id, name, local_path, commit=commit)
3472
3524
 
3473
3525
 
3474
3526
  def get_repository_for_project(conn: sqlite3.Connection, project_id: int) -> sqlite3.Row | None:
@@ -3552,7 +3604,7 @@ def ensure_repository_for_project(conn: sqlite3.Connection, project_id: int, hin
3552
3604
  owner = find_repository_by_path(conn, hint_path)
3553
3605
  if owner is not None:
3554
3606
  return owner["id"] if owner["project_id"] == project_id else None
3555
- if _is_home_or_above(hint_path):
3607
+ if _is_home_or_above(hint_path) or _is_folder_of_projects(hint_path):
3556
3608
  return None
3557
3609
  has_any_repository = conn.execute(
3558
3610
  "SELECT 1 FROM repositories WHERE project_id = ?", (project_id,)
@@ -3993,6 +4045,24 @@ def git_root(path: str) -> str | None:
3993
4045
  return None
3994
4046
 
3995
4047
 
4048
+ def _is_repository_root(folder: Path) -> bool:
4049
+ marker = folder / ".git"
4050
+ return (marker / "HEAD").is_file() or marker.is_file()
4051
+
4052
+
4053
+ def _is_folder_of_projects(path: str) -> bool:
4054
+ """A folder outside any git repository that holds git repositories (~/projects,
4055
+ ~/code) is where projects live, not one. Registered, it would claim every project
4056
+ started in it before its `git init`, and the answers to whatever those file."""
4057
+ if git_root(path) is not None:
4058
+ return False
4059
+ try:
4060
+ with os.scandir(path) as entries:
4061
+ return any(entry.is_dir() and _is_repository_root(Path(entry.path)) for entry in entries)
4062
+ except OSError:
4063
+ return False
4064
+
4065
+
3996
4066
  def find_repository_by_path(conn: sqlite3.Connection, path: str) -> dict | None:
3997
4067
  """Match a filesystem path against a registered repository's local_path, by exact
3998
4068
  match or by the repository being an ancestor directory of path — so starting a
@@ -4885,23 +4955,28 @@ def _turn_guard(event_at: str) -> tuple[str, tuple]:
4885
4955
  return "(last_stop_at IS NULL OR last_stop_at <= ?)", (event_at,)
4886
4956
 
4887
4957
 
4888
- def _auto_register_repository_for_cwd(conn: sqlite3.Connection, cwd: str) -> sqlite3.Row | None:
4958
+ def _auto_register_repository_for_cwd(
4959
+ conn: sqlite3.Connection, cwd: str, commit: bool = True,
4960
+ ) -> sqlite3.Row | None:
4889
4961
  """A session whose cwd matches no registered repository gets one created on the
4890
4962
  spot, named from the folder's own basename — the same name a human would use to
4891
4963
  refer to it — rather than sitting in the fleet view's "Unregistered" bucket
4892
4964
  forever just because nothing's filed a decision from that project yet. The folder
4893
4965
  is the git repository root when there is one (a session started in src/api is the
4894
4966
  repo's, and a worktree is its main repo's). Attaches to an existing same-name
4895
- project instead of making a duplicate. None for the home directory or above."""
4967
+ project instead of making a duplicate. None for the home directory or above, and
4968
+ for a folder of projects."""
4896
4969
  if _is_home_or_above(cwd):
4897
4970
  return None
4898
4971
  folder = git_root(cwd) or cwd.rstrip("/")
4899
4972
  repository = find_repository_by_path(conn, folder)
4900
4973
  if repository is not None:
4901
4974
  return repository
4975
+ if _is_folder_of_projects(folder):
4976
+ return None
4902
4977
  name = os.path.basename(folder) or folder
4903
- project = get_or_create_project(conn, name)
4904
- return get_or_create_repository(conn, project["id"], folder)
4978
+ project = get_or_create_project(conn, name, commit=commit)
4979
+ return get_or_create_repository(conn, project["id"], folder, commit=commit)
4905
4980
 
4906
4981
 
4907
4982
  def _repository_for_session_cwd(conn: sqlite3.Connection, cwd: str | None):
@@ -2500,7 +2500,8 @@ async def answer_decision(
2500
2500
  if not db.answer_decision_request(conn, decision_id, text, answer_kind=kind, answer_option=chosen):
2501
2501
  db.clear_undo(conn, decision_id)
2502
2502
  return RedirectResponse(back, status_code=303)
2503
- return _with_undo(RedirectResponse(back, status_code=303), decision_id, "Answer sent")
2503
+ return _with_undo(RedirectResponse(back, status_code=303), decision_id,
2504
+ "Answer sent — it's been written to the repo for the next session to pick up")
2504
2505
 
2505
2506
 
2506
2507
  def _attachment_json(attachment: dict) -> dict:
@@ -67,27 +67,6 @@
67
67
  });
68
68
  }
69
69
 
70
- // A message to show after a POST → redirect lands, keyed to the page it
71
- // should land on so an unrelated page (or an error response) never shows it.
72
- var FLASH_KEY = "apo-flash";
73
-
74
- function setFlash(message, path) {
75
- try { sessionStorage.setItem(FLASH_KEY, JSON.stringify({ message: message, path: path })); } catch (e) {}
76
- }
77
-
78
- function consumeFlash() {
79
- var raw;
80
- try {
81
- raw = sessionStorage.getItem(FLASH_KEY);
82
- sessionStorage.removeItem(FLASH_KEY);
83
- } catch (e) { return; }
84
- if (!raw) return;
85
- try {
86
- var flash = JSON.parse(raw);
87
- if (!flash.path || flash.path === location.pathname) toast(flash.message, "success");
88
- } catch (e) {}
89
- }
90
-
91
70
  // Done, Cancel, Snooze and answers leave a short-lived cookie naming the item; show an
92
71
  // Undo toast for it once, wherever the redirect landed.
93
72
  function consumeUndo() {
@@ -174,7 +153,6 @@
174
153
  // After the browser has built the form data: a button disabled during the
175
154
  // submit event is left out of it, and the clicked button IS the answer.
176
155
  setTimeout(function () { setLoading(button, opts.loadingText || form.dataset.loadingText); }, 0);
177
- if (form.dataset.flash) setFlash(form.dataset.flash, form.dataset.flashPath);
178
156
  // No preventDefault: the browser's normal POST+redirect navigation still
179
157
  // happens, this just gives the user feedback before the page unloads.
180
158
  });
@@ -1163,7 +1141,6 @@
1163
1141
  ensureLiveRegions();
1164
1142
  initThemeToggle();
1165
1143
  autoEnhance(document);
1166
- consumeFlash();
1167
1144
  consumeUndo();
1168
1145
  openHashTarget();
1169
1146
  });
@@ -37,8 +37,7 @@
37
37
  {% if composer_thumb_compact %}data-thumb-size="compact"{% endif %}>
38
38
  {% if composer_editable %}
39
39
  <form method="post" action="/decisions/{{ composer_decision_id }}/answer" data-enhance="indicate" data-secret-check
40
- data-loading-text="Sending…" data-flash="Answer sent — it's been written to the repo for the next session to pick up."
41
- data-flash-path="/decisions/{{ composer_decision_id }}">
40
+ data-loading-text="Sending…">
42
41
  {% if composer_next %}<input type="hidden" name="next" value="{{ composer_next }}">{% endif %}
43
42
  {% set d = composer_decision %}
44
43
  {% set is_action_composer = d and d.kind == "action" %}
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: getapo
3
- Version: 0.3.0
3
+ Version: 0.3.1
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/
@@ -119,6 +119,26 @@ def test_the_server_refuses_a_secret_shaped_answer_unless_confirmed(db_path):
119
119
  assert db.get_decision_request(conn, decision_id)["answer_text"].startswith("sk_live_")
120
120
 
121
121
 
122
+ def test_an_answer_leaves_one_undo_toast_that_says_where_it_went(db_path):
123
+ """The Undo toast is the only confirmation: the form no longer queues a second one."""
124
+ import json
125
+ from urllib.parse import unquote
126
+
127
+ from fastapi.testclient import TestClient
128
+
129
+ from apo.web import app
130
+
131
+ client = TestClient(app.app)
132
+ conn = db.get_connection()
133
+ decision_id = _decision(conn)
134
+ page = client.get(f"/decisions/{decision_id}").text
135
+ assert "data-flash=" not in page
136
+
137
+ r = client.post(f"/decisions/{decision_id}/answer", data={"answer_text": "Postgres"}, follow_redirects=False)
138
+ label = json.loads(unquote(r.cookies["apo_undo"]))["label"]
139
+ assert label.startswith("Answer sent") and "written to the repo" in label
140
+
141
+
122
142
  def test_answer_forms_carry_the_secret_check(db_path):
123
143
  from fastapi.testclient import TestClient
124
144
 
@@ -125,6 +125,26 @@ def test_clicking_the_first_option_answers_with_it(server, tmp_path):
125
125
  assert db.get_decision_request(db.get_connection(), decision_id)["answer_text"].startswith("Chose option 1: Postgres")
126
126
 
127
127
 
128
+ def test_answering_shows_one_toast_with_the_full_message_and_undo(server, tmp_path):
129
+ """The form queued its own "Answer sent — written to the repo" toast and the server
130
+ sent an "Answer sent." Undo toast, so every answer showed two."""
131
+ conn = db.get_connection()
132
+ decision_id = db.create_decision_request(conn, project_id=_project(conn, tmp_path)["id"], title="Queue",
133
+ question="Which?", options=[{"label": "Postgres"}, {"label": "SQLite"}])
134
+
135
+ async def act(js):
136
+ await js('document.querySelector(\'button[name="option"][value="0"]\').click()')
137
+ await asyncio.sleep(2)
138
+ return await js("Array.from(document.querySelectorAll('#app-toast-stack .toast'))"
139
+ ".map(t => ({text: t.querySelector('.toast-msg').textContent, undo: !!t.querySelector('.toast-undo')}))")
140
+
141
+ toasts = _in_browser(f"{server}/decisions/{decision_id}", 'button[name="option"][value="0"]', act)
142
+
143
+ assert len(toasts) == 1, toasts
144
+ assert toasts[0]["undo"]
145
+ assert "written to the repo" in toasts[0]["text"]
146
+
147
+
128
148
  def test_clicking_done_on_an_action_marks_it_done(server, tmp_path):
129
149
  conn = db.get_connection()
130
150
  action_id = db.create_action_request(conn, project_id=_project(conn, tmp_path)["id"], title="Add DNS",
@@ -27,7 +27,7 @@ def test_version(db_path):
27
27
  result = _run(["-m", "apo", "--version"], _env(db_path))
28
28
 
29
29
  assert result.stdout.strip() == f"apo {apo.__version__}"
30
- assert apo.__version__ == "0.3.0"
30
+ assert apo.__version__ == "0.3.1"
31
31
 
32
32
 
33
33
  def test_there_is_no_ado_command_any_more():
@@ -148,6 +148,137 @@ def test_upgrading_drops_a_home_directory_registration_with_no_decisions(db_path
148
148
  assert session["project_id"] is None and session["repository_id"] is None
149
149
 
150
150
 
151
+ # --- A folder of projects ---
152
+ #
153
+ # Live incident: one session run in ~/projects registered it as a project named
154
+ # "projects". A session started later in ~/projects/third-temple-blender, before its
155
+ # `git init`, matched it as a subfolder and was filed under "projects". A decision
156
+ # filed from such a session lands in ~/projects/.claude/decisions/, where its own
157
+ # folder never sees the answer.
158
+
159
+
160
+ def _folder_of_projects(tmp_path):
161
+ folder = tmp_path / "projects"
162
+ _git_repo(folder / "older")
163
+ return folder
164
+
165
+
166
+ def _session_row(conn, claude_session_id):
167
+ return conn.execute(
168
+ "SELECT sessions.project_id, sessions.repository_id, projects.name AS project_name FROM sessions "
169
+ "LEFT JOIN projects ON projects.id = sessions.project_id WHERE claude_session_id = ?",
170
+ (claude_session_id,),
171
+ ).fetchone()
172
+
173
+
174
+ def test_a_folder_of_projects_is_never_registered_as_a_project(db_path, tmp_path):
175
+ folder = _folder_of_projects(tmp_path)
176
+ conn = db.get_connection()
177
+
178
+ db.register_session(conn, "in-folder", str(folder))
179
+
180
+ assert _session_row(conn, "in-folder")["project_id"] is None
181
+ assert conn.execute("SELECT COUNT(*) FROM repositories").fetchone()[0] == 0
182
+
183
+
184
+ def test_a_new_folder_next_to_other_projects_is_its_own_project(db_path, tmp_path):
185
+ folder = _folder_of_projects(tmp_path)
186
+ (folder / "newthing").mkdir()
187
+ conn = db.get_connection()
188
+ db.register_session(conn, "in-folder", str(folder))
189
+
190
+ db.register_session(conn, "in-new", str(folder / "newthing"))
191
+
192
+ assert _session_row(conn, "in-new")["project_name"] == "newthing"
193
+ repo = db.find_repository_by_path(conn, str(folder / "newthing"))
194
+ assert repo["local_path"] == str(folder / "newthing")
195
+
196
+
197
+ def test_filing_from_a_folder_of_projects_does_not_register_it(db_path, tmp_path):
198
+ folder = _folder_of_projects(tmp_path)
199
+ conn = db.get_connection()
200
+ project = db.get_or_create_project(conn, "acme")
201
+
202
+ assert db.ensure_repository_for_project(conn, project["id"], str(folder)) is None
203
+ assert db.find_repository_by_path(conn, str(folder / "newthing")) is None
204
+
205
+
206
+ def test_a_plain_folder_with_no_repositories_inside_is_still_a_project(db_path, tmp_path):
207
+ notes = tmp_path / "notes"
208
+ (notes / "drafts").mkdir(parents=True)
209
+ conn = db.get_connection()
210
+
211
+ db.register_session(conn, "in-notes", str(notes))
212
+
213
+ assert _session_row(conn, "in-notes")["project_name"] == "notes"
214
+
215
+
216
+ def _registered_folder_of_projects(conn, folder):
217
+ project = db.get_or_create_project(conn, "projects")
218
+ repo = db.create_repository(conn, project["id"], "projects", str(folder))
219
+ return project, repo
220
+
221
+
222
+ def _old_session(conn, claude_session_id, project, repo, cwd):
223
+ conn.execute(
224
+ "INSERT INTO sessions (claude_session_id, project_id, repository_id, cwd, status, started_at, last_seen_at) "
225
+ "VALUES (?, ?, ?, ?, 'ended', '2026-11-28T00:00:00+00:00', '2026-11-28T00:00:00+00:00')",
226
+ (claude_session_id, project["id"], repo["id"], cwd),
227
+ )
228
+ conn.execute(
229
+ "INSERT INTO events (occurred_at, verb, actor, project_id, session_id, summary) "
230
+ "VALUES ('2026-11-28T00:00:00+00:00', 'session.started', 'agent', ?, ?, 'Session started')",
231
+ (project["id"], claude_session_id),
232
+ )
233
+
234
+
235
+ def _upgrade(conn):
236
+ conn.execute("PRAGMA user_version = 24")
237
+ conn.commit()
238
+ return db.get_connection()
239
+
240
+
241
+ def test_upgrading_drops_a_folder_of_projects_and_moves_its_sessions_to_their_own_folders(db_path, tmp_path):
242
+ folder = _folder_of_projects(tmp_path)
243
+ (folder / "newthing").mkdir()
244
+ conn = db.get_connection()
245
+ project, repo = _registered_folder_of_projects(conn, folder)
246
+ older = db.get_or_create_project(conn, "older")
247
+ db.create_repository(conn, older["id"], "older", str(folder / "older"))
248
+ _old_session(conn, "in-new", project, repo, str(folder / "newthing"))
249
+ _old_session(conn, "in-older", project, repo, str(folder / "older"))
250
+ _old_session(conn, "in-folder", project, repo, str(folder))
251
+ _old_session(conn, "in-gone", project, repo, str(folder / "deleted-since"))
252
+
253
+ conn = _upgrade(conn)
254
+
255
+ assert "projects" not in {r["name"] for r in conn.execute("SELECT name FROM projects")}
256
+ assert db.find_repository_by_path(conn, str(folder)) is None
257
+ assert _session_row(conn, "in-new")["project_name"] == "newthing"
258
+ assert _session_row(conn, "in-older")["project_name"] == "older"
259
+ for stranded in ("in-folder", "in-gone"):
260
+ row = _session_row(conn, stranded)
261
+ assert row["project_id"] is None and row["repository_id"] is None, stranded
262
+ events = dict(conn.execute("SELECT session_id, project_id FROM events WHERE verb = 'session.started'").fetchall())
263
+ assert events["in-new"] == _session_row(conn, "in-new")["project_id"]
264
+ assert events["in-folder"] is None
265
+
266
+
267
+ @pytest.mark.parametrize("on_record", ["decision", "goal"])
268
+ def test_upgrading_keeps_a_folder_of_projects_with_something_on_record(db_path, tmp_path, on_record):
269
+ folder = _folder_of_projects(tmp_path)
270
+ conn = db.get_connection()
271
+ project, repo = _registered_folder_of_projects(conn, folder)
272
+ if on_record == "decision":
273
+ db.create_decision_request(conn, project_id=project["id"], repository_id=repo["id"], title="Q", question="Q?")
274
+ else:
275
+ db.create_outcome(conn, project_id=project["id"], title="Ship it")
276
+
277
+ conn = _upgrade(conn)
278
+
279
+ assert db.find_repository_by_path(conn, str(folder))["id"] == repo["id"]
280
+
281
+
151
282
  # --- A folder that was renamed or moved ---
152
283
  #
153
284
  # Live incident: ~/projects/passiveIncome2 was renamed to ~/projects/basari. Its row
@@ -68,7 +68,7 @@ def test_the_wheel_carries_the_package_data(wheel):
68
68
  assert path in names, path
69
69
  assert not any(n.startswith(("tests/", "docs/", "scripts/", "site/")) for n in names)
70
70
  metadata = zipfile.ZipFile(wheel).read(next(n for n in names if n.endswith("METADATA"))).decode()
71
- assert "Name: getapo" in metadata and "Version: 0.3.0" in metadata
71
+ assert "Name: getapo" in metadata and "Version: 0.3.1" in metadata
72
72
  assert "License-Expression: MIT" in metadata
73
73
  assert {n.rsplit("/", 1)[-1] for n in names if "/licenses/" in n} == {"LICENSE", "THIRD_PARTY_NOTICES.md"}
74
74
  entry_points = zipfile.ZipFile(wheel).read(next(n for n in names if n.endswith("entry_points.txt"))).decode()
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
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
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
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
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes