sidequestor 0.2.0__tar.gz → 0.2.2__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 (251) hide show
  1. sidequestor-0.2.2/MANIFEST.in +4 -0
  2. {sidequestor-0.2.0/src/sidequestor.egg-info → sidequestor-0.2.2}/PKG-INFO +30 -7
  3. {sidequestor-0.2.0 → sidequestor-0.2.2}/README.md +29 -6
  4. {sidequestor-0.2.0 → sidequestor-0.2.2}/pyproject.toml +1 -1
  5. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/__init__.py +1 -1
  6. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/cli.py +102 -16
  7. sidequestor-0.2.2/src/sidequestor/credential_setup.py +155 -0
  8. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/dashboard.py +95 -28
  9. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/launchd.py +86 -2
  10. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/package_data/env.example +5 -2
  11. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/dashboard.html +6 -6
  12. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/checkers/reactions.py +45 -7
  13. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/ops/dashboard-server.py +15 -0
  14. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/reaction_config.py +4 -0
  15. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/reaction_lifecycle.py +5 -1
  16. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/skills/yaas-onboarding/SKILL.md +27 -7
  17. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/skills/yaas-ops/SKILL.md +1 -1
  18. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/skills/yaas-quest-creation/SKILL.md +1 -1
  19. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/skills/yaas-reactions/SKILL.md +50 -2
  20. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/skills/yaas-slack-channel/SKILL.md +5 -0
  21. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/surfaces/client.py +48 -3
  22. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/surfaces/react-lifecycle.py +1 -1
  23. sidequestor-0.2.2/src/sidequestor/runtime/yaas-triage/surfaces/slack-expand.py +252 -0
  24. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/system_health.py +34 -9
  25. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/tick.py +56 -3
  26. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/setup.py +16 -4
  27. sidequestor-0.2.2/src/sidequestor/setup_worker.py +251 -0
  28. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/upgrade.py +1 -1
  29. sidequestor-0.2.2/src/sidequestor/worker_readiness.py +171 -0
  30. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/workspace.py +89 -19
  31. {sidequestor-0.2.0 → sidequestor-0.2.2/src/sidequestor.egg-info}/PKG-INFO +30 -7
  32. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor.egg-info/SOURCES.txt +9 -0
  33. {sidequestor-0.2.0 → sidequestor-0.2.2}/tests/dashboard_review_preview.cjs +8 -2
  34. {sidequestor-0.2.0 → sidequestor-0.2.2}/tests/test_cli_lifecycle.py +62 -0
  35. {sidequestor-0.2.0 → sidequestor-0.2.2}/tests/test_connector_policy.py +2 -0
  36. sidequestor-0.2.2/tests/test_credential_setup.py +251 -0
  37. sidequestor-0.2.2/tests/test_dashboard_ports.py +134 -0
  38. sidequestor-0.2.2/tests/test_default_workspace.py +88 -0
  39. {sidequestor-0.2.0 → sidequestor-0.2.2}/tests/test_initial_run_gate.py +7 -0
  40. sidequestor-0.2.2/tests/test_install_script.py +84 -0
  41. {sidequestor-0.2.0 → sidequestor-0.2.2}/tests/test_job_path.py +1 -0
  42. {sidequestor-0.2.0 → sidequestor-0.2.2}/tests/test_launchd_lifecycle.py +57 -1
  43. {sidequestor-0.2.0 → sidequestor-0.2.2}/tests/test_onboarding.py +1 -0
  44. {sidequestor-0.2.0 → sidequestor-0.2.2}/tests/test_reaction_config.py +6 -1
  45. {sidequestor-0.2.0 → sidequestor-0.2.2}/tests/test_reaction_lifecycle.py +20 -0
  46. {sidequestor-0.2.0 → sidequestor-0.2.2}/tests/test_reaction_pending.py +80 -2
  47. {sidequestor-0.2.0 → sidequestor-0.2.2}/tests/test_setup.py +2 -1
  48. {sidequestor-0.2.0 → sidequestor-0.2.2}/tests/test_slack_channel.py +40 -0
  49. sidequestor-0.2.2/tests/test_slack_expand.py +188 -0
  50. {sidequestor-0.2.0 → sidequestor-0.2.2}/tests/test_system_health.py +26 -2
  51. sidequestor-0.2.2/tests/test_worker_readiness.py +135 -0
  52. sidequestor-0.2.0/MANIFEST.in +0 -1
  53. sidequestor-0.2.0/tests/test_dashboard_ports.py +0 -77
  54. {sidequestor-0.2.0 → sidequestor-0.2.2}/LICENSE +0 -0
  55. {sidequestor-0.2.0 → sidequestor-0.2.2}/setup.cfg +0 -0
  56. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/__main__.py +0 -0
  57. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/build_info.py +0 -0
  58. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/isolated.py +0 -0
  59. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/job_path.py +0 -0
  60. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/migrations.py +0 -0
  61. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/native.py +0 -0
  62. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/onboarding.py +0 -0
  63. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/package_data/OPERATING.md +0 -0
  64. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/package_data/settings.json.example +0 -0
  65. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/quest_terminal.py +0 -0
  66. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/resources.py +0 -0
  67. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/approval_state.py +0 -0
  68. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/approval_store.py +0 -0
  69. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/assets/sidequestor-knows-its-pretty-thank-you.png +0 -0
  70. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/assets/sidequestor-mark.png +0 -0
  71. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/checkers/approval.py +0 -0
  72. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/checkers/approval.watch.json +0 -0
  73. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/checkers/cron-due.py +0 -0
  74. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/checkers/email.lag +0 -0
  75. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/checkers/email.py +0 -0
  76. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/checkers/email.watch.json +0 -0
  77. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/checkers/github.py +0 -0
  78. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/checkers/github_issue.lag +0 -0
  79. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/checkers/github_issue.py +0 -0
  80. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/checkers/github_issue.watch.json +0 -0
  81. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/checkers/github_pr.lag +0 -0
  82. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/checkers/github_pr.py +0 -0
  83. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/checkers/github_pr.watch.json +0 -0
  84. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/checkers/health_issue.py +0 -0
  85. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/checkers/health_issue.watch.json +0 -0
  86. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/checkers/jira.lag +0 -0
  87. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/checkers/jira.py +0 -0
  88. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/checkers/jira.watch.json +0 -0
  89. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/checkers/notion.py +0 -0
  90. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/checkers/notion_comments.py +0 -0
  91. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/checkers/notion_comments.watch.json +0 -0
  92. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/checkers/notion_data_source.py +0 -0
  93. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/checkers/notion_data_source.watch.json +0 -0
  94. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/checkers/notion_page.py +0 -0
  95. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/checkers/notion_page.watch.json +0 -0
  96. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/checkers/notion_store.py +0 -0
  97. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/checkers/notion_tree.py +0 -0
  98. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/checkers/result.py +0 -0
  99. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/checkers/schedule.py +0 -0
  100. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/checkers/schedule.watch.json +0 -0
  101. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/checkers/slack_channel.py +0 -0
  102. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/checkers/slack_channel.watch.json +0 -0
  103. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/checkers/slack_dm.py +0 -0
  104. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/checkers/slack_dm.watch.json +0 -0
  105. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/checkers/slack_mention.lag +0 -0
  106. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/checkers/slack_mention.py +0 -0
  107. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/checkers/slack_mention.watch.json +0 -0
  108. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/checkers/slack_thread.py +0 -0
  109. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/checkers/slack_thread.watch.json +0 -0
  110. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/checkers/slack_utils.py +0 -0
  111. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/checkers/telegram.py +0 -0
  112. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/checkers/telegram_chat.lag +0 -0
  113. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/checkers/telegram_chat.py +0 -0
  114. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/checkers/telegram_chat.watch.json +0 -0
  115. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/checkers/telegram_search.lag +0 -0
  116. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/checkers/telegram_search.py +0 -0
  117. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/checkers/telegram_search.watch.json +0 -0
  118. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/checkers/x.py +0 -0
  119. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/checkers/x_dm.lag +0 -0
  120. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/checkers/x_dm.py +0 -0
  121. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/checkers/x_dm.watch.json +0 -0
  122. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/checkers/x_home.lag +0 -0
  123. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/checkers/x_home.py +0 -0
  124. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/checkers/x_home.watch.json +0 -0
  125. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/checkers/x_mentions.lag +0 -0
  126. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/checkers/x_mentions.py +0 -0
  127. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/checkers/x_mentions.watch.json +0 -0
  128. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/checkers/x_search.lag +0 -0
  129. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/checkers/x_search.py +0 -0
  130. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/checkers/x_search.watch.json +0 -0
  131. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/checkers/x_user_posts.lag +0 -0
  132. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/checkers/x_user_posts.py +0 -0
  133. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/checkers/x_user_posts.watch.json +0 -0
  134. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/dispatch/dispatch-agent.sh +0 -0
  135. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/dispatch/extract-tokens.py +0 -0
  136. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/dispatch/fake-worker.py +0 -0
  137. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/dispatch/format-stream.py +0 -0
  138. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/dispatch/plan.py +0 -0
  139. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/dispatch/run-agent.py +0 -0
  140. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/dispatch/slack-read-health.py +0 -0
  141. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/dispatch/spend-window.py +0 -0
  142. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/dispatch/translate-stream.py +0 -0
  143. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/dispatch/worker.mcp.json +0 -0
  144. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/inbox.py +0 -0
  145. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/ledger/ack-watch.py +0 -0
  146. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/ledger/add-watch.py +0 -0
  147. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/ledger/approval-helper.py +0 -0
  148. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/ledger/checker-health.py +0 -0
  149. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/ledger/commit.py +0 -0
  150. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/ledger/ensure-watch-ids.py +0 -0
  151. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/ledger/housekeep.py +0 -0
  152. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/ledger/watch-guard.py +0 -0
  153. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/ops/dashboard-start.sh +0 -0
  154. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/ops/doctor.sh +0 -0
  155. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/ops/health-monitor.py +0 -0
  156. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/ops/heartbeat-loop.sh +0 -0
  157. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/ops/notify.py +0 -0
  158. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/ops/rotate-logs.py +0 -0
  159. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/ops/sync-yaas-v2.sh +0 -0
  160. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/setup/com.yaas.dashboard.plist.template +0 -0
  161. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/setup/com.yaas.heartbeat.plist.template +0 -0
  162. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/setup/com.yaas.triage.plist.template +0 -0
  163. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/setup/init-yaas-v2-tracking.sh +0 -0
  164. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/setup/install-launchd-common.sh +0 -0
  165. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/setup/install-launchd-dashboard.sh +0 -0
  166. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/setup/install-launchd-heartbeat.sh +0 -0
  167. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/setup/install-launchd.sh +0 -0
  168. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/setup/setup.sh +0 -0
  169. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/setup/yaas-app-config.json +0 -0
  170. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/skills/yaas-action-closure/SKILL.md +0 -0
  171. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/skills/yaas-answering-quality/SKILL.md +0 -0
  172. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/skills/yaas-checker-authoring/SKILL.md +0 -0
  173. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/skills/yaas-draft-readiness/SKILL.md +0 -0
  174. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/skills/yaas-gdoc-anchored-comments/SKILL.md +0 -0
  175. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/skills/yaas-gdoc-anchored-comments/gdoc-comment.py +0 -0
  176. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/skills/yaas-gmail-reply/SKILL.md +0 -0
  177. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/skills/yaas-gmail-reply/gmail-reply.py +0 -0
  178. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/skills/yaas-gmail-reply/gmail_policy.py +0 -0
  179. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/skills/yaas-gmail-reply/send_fresh.py +0 -0
  180. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/skills/yaas-quest-creation/new-quest.py +0 -0
  181. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/skills/yaas-quest-dispatch/SKILL.md +0 -0
  182. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/skills/yaas-slack-file/SKILL.md +0 -0
  183. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/skills/yaas-slack-interface/SKILL.md +0 -0
  184. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/surfaces/credential_store.py +0 -0
  185. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/surfaces/jira-call.sh +0 -0
  186. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/surfaces/keychain-helper.c +0 -0
  187. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/surfaces/log-event.py +0 -0
  188. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/surfaces/mcp-call.sh +0 -0
  189. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/surfaces/notion-call.py +0 -0
  190. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/surfaces/notion-state.py +0 -0
  191. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/surfaces/slack-channel.py +0 -0
  192. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/surfaces/slack-file.py +0 -0
  193. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/surfaces/slack-react.sh +0 -0
  194. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/surfaces/slack-send.py +0 -0
  195. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/surfaces/slack_credentials.py +0 -0
  196. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/surfaces/slack_files.py +0 -0
  197. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/surfaces/telegram-call.py +0 -0
  198. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/surfaces/telegram-send.py +0 -0
  199. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/surfaces/telegram_credentials.py +0 -0
  200. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/surfaces/timeline_io.py +0 -0
  201. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/surfaces/x-call.py +0 -0
  202. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/surfaces/x-send.py +0 -0
  203. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/surfaces/x_credentials.py +0 -0
  204. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/tick_check.py +0 -0
  205. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/tick_dispatch.py +0 -0
  206. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/tick_state.py +0 -0
  207. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/runtime/yaas-triage/triage-loop.sh +0 -0
  208. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/update_check.py +0 -0
  209. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor/upgrade_job.py +0 -0
  210. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor.egg-info/dependency_links.txt +0 -0
  211. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor.egg-info/entry_points.txt +0 -0
  212. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor.egg-info/requires.txt +0 -0
  213. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/sidequestor.egg-info/top_level.txt +0 -0
  214. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/yaas_triage/__init__.py +0 -0
  215. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/yaas_triage/__main__.py +0 -0
  216. {sidequestor-0.2.0 → sidequestor-0.2.2}/src/yaas_triage/cli.py +0 -0
  217. {sidequestor-0.2.0 → sidequestor-0.2.2}/tests/test_approval_failure.py +0 -0
  218. {sidequestor-0.2.0 → sidequestor-0.2.2}/tests/test_build_info.py +0 -0
  219. {sidequestor-0.2.0 → sidequestor-0.2.2}/tests/test_checker_connector_gates.py +0 -0
  220. {sidequestor-0.2.0 → sidequestor-0.2.2}/tests/test_credential_state_root.py +0 -0
  221. {sidequestor-0.2.0 → sidequestor-0.2.2}/tests/test_dashboard_composer_persistence.py +0 -0
  222. {sidequestor-0.2.0 → sidequestor-0.2.2}/tests/test_dashboard_review_preview.py +0 -0
  223. {sidequestor-0.2.0 → sidequestor-0.2.2}/tests/test_dispatch_manifest.py +0 -0
  224. {sidequestor-0.2.0 → sidequestor-0.2.2}/tests/test_gdoc_comment.py +0 -0
  225. {sidequestor-0.2.0 → sidequestor-0.2.2}/tests/test_gmail_reply.py +0 -0
  226. {sidequestor-0.2.0 → sidequestor-0.2.2}/tests/test_gmail_send.py +0 -0
  227. {sidequestor-0.2.0 → sidequestor-0.2.2}/tests/test_jira_checker.py +0 -0
  228. {sidequestor-0.2.0 → sidequestor-0.2.2}/tests/test_notion_checkers.py +0 -0
  229. {sidequestor-0.2.0 → sidequestor-0.2.2}/tests/test_notion_tree.py +0 -0
  230. {sidequestor-0.2.0 → sidequestor-0.2.2}/tests/test_quest_creation_handoff.py +0 -0
  231. {sidequestor-0.2.0 → sidequestor-0.2.2}/tests/test_quest_terminal.py +0 -0
  232. {sidequestor-0.2.0 → sidequestor-0.2.2}/tests/test_runtime_config.py +0 -0
  233. {sidequestor-0.2.0 → sidequestor-0.2.2}/tests/test_runtime_docs.py +0 -0
  234. {sidequestor-0.2.0 → sidequestor-0.2.2}/tests/test_runtime_imports.py +0 -0
  235. {sidequestor-0.2.0 → sidequestor-0.2.2}/tests/test_slack_file.py +0 -0
  236. {sidequestor-0.2.0 → sidequestor-0.2.2}/tests/test_slack_parser.py +0 -0
  237. {sidequestor-0.2.0 → sidequestor-0.2.2}/tests/test_slack_search.py +0 -0
  238. {sidequestor-0.2.0 → sidequestor-0.2.2}/tests/test_slack_send.py +0 -0
  239. {sidequestor-0.2.0 → sidequestor-0.2.2}/tests/test_telegram_send.py +0 -0
  240. {sidequestor-0.2.0 → sidequestor-0.2.2}/tests/test_telegram_x_checkers.py +0 -0
  241. {sidequestor-0.2.0 → sidequestor-0.2.2}/tests/test_triage_liveness.py +0 -0
  242. {sidequestor-0.2.0 → sidequestor-0.2.2}/tests/test_unacked_prune.py +0 -0
  243. {sidequestor-0.2.0 → sidequestor-0.2.2}/tests/test_update_check.py +0 -0
  244. {sidequestor-0.2.0 → sidequestor-0.2.2}/tests/test_upgrade.py +0 -0
  245. {sidequestor-0.2.0 → sidequestor-0.2.2}/tests/test_upgrade_job.py +0 -0
  246. {sidequestor-0.2.0 → sidequestor-0.2.2}/tests/test_version.py +0 -0
  247. {sidequestor-0.2.0 → sidequestor-0.2.2}/tests/test_watch_activity.py +0 -0
  248. {sidequestor-0.2.0 → sidequestor-0.2.2}/tests/test_watcher_status_dashboard.py +0 -0
  249. {sidequestor-0.2.0 → sidequestor-0.2.2}/tests/test_x_send.py +0 -0
  250. {sidequestor-0.2.0 → sidequestor-0.2.2}/tests/test_x_user_auth.py +0 -0
  251. {sidequestor-0.2.0 → sidequestor-0.2.2}/tests/test_x_user_checkers.py +0 -0
@@ -0,0 +1,4 @@
1
+ include tests/dashboard_review_preview.cjs
2
+ exclude install-circle.sh.in
3
+ exclude install-circle.sh
4
+ exclude .circle-installer.env
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sidequestor
3
- Version: 0.2.0
3
+ Version: 0.2.2
4
4
  Summary: Sidequestor workspace and triage command shell
5
5
  License-Expression: Apache-2.0
6
6
  Requires-Python: >=3.11
@@ -31,8 +31,9 @@ A short checklist, so nothing surprises you halfway through:
31
31
  (`brew install uv` or `brew install pipx`). uv also downloads Python ≥ 3.11 when the Mac does
32
32
  not have it.
33
33
  - The command-line tools `jq`, `curl`, `openssl`, `security` and `open`.
34
- - An authenticated `claude`, `codex`, **or** `cursor-agent` CLI before workers start. Setup can
35
- offer to install a missing Claude Code or Codex CLI if npm is available; Sidequestor never logs in for you.
34
+ - A `claude`, `codex`, **or** `cursor-agent` CLI before workers start. Setup can
35
+ offer to install a missing Claude Code or Codex CLI if npm is available, and guides
36
+ you through the selected CLI's login when needed.
36
37
 
37
38
  Telegram user-session watches require the optional `sidequestor[telegram]` extra. The Slack setup
38
39
  script checks the command-line tools it needs before it runs, and
@@ -60,6 +61,13 @@ sq setup
60
61
  sq start
61
62
  ```
62
63
 
64
+ The repository also includes `install.sh` for a fresh macOS install. It installs the
65
+ PyPI package with uv when needed, creates `~/sidequestor` only when no workspace is
66
+ registered, runs `sq setup`, and opens the dashboard. A separate `install-circle.sh.in`
67
+ template is rendered for the personal Circle mirror; it supplies non-secret Slack app
68
+ identifiers so colleagues do not have to paste an `.env` block. The template itself
69
+ contains placeholders and is not the Circle installer.
70
+
63
71
  Nothing of yours is moved or overwritten: `sidequestor init .` only adds `.yaas` metadata alongside your existing files. `sq`, `sidequestor`, and `yaas` are all available aliases. The dashboard workspace label opens the current workspace in Cursor when available, or in macOS’s default IDE/file opener. Set `SIDEQUESTOR_IDE_APP` to prefer another application.
64
72
 
65
73
  One installation serves every workspace, and `sq` works in any new terminal without activating
@@ -71,12 +79,16 @@ A workspace-local virtualenv still works if you prefer one: `python3 -m venv .ve
71
79
  `source .venv/bin/activate`, then `python -m pip install sidequestor`. Its commands are available
72
80
  only while that environment is active, or by full path such as `.venv/bin/sq`.
73
81
 
82
+ `sq start`, `sq stop`, and `sq dashboard` use your saved default workspace from any terminal directory. The first sole valid workspace is adopted automatically in the existing `~/.config/yaas/instances.json` registry (or the configured config home); no files are moved. With multiple workspaces, run `sq setup --select-workspace` once. Explicit `--workspace PATH` or `--instance ID` overrides the default. The selected workspace path is printed on lifecycle commands. `sq status` shows its path, saved dashboard address, and connection issues. `sq dashboard` opens the running dashboard; `sq dashboard url` prints its URL for scripts.
83
+
84
+ The dashboard defaults to **http://localhost:8877**. Its port is saved in `.yaas/instance.json`; existing published addresses are retained on upgrade. Starting again reuses running jobs. A port conflict is reported without silently choosing 8878 or 8879. Stop Sidequestor before explicitly changing its port with `sq start --dashboard-port PORT`. Missing AI login or confirmed Claude MCP authentication failures pause affected dispatches without adding quest no-progress backoff; rerun `sq setup` to verify and resume.
85
+
74
86
  Background jobs record the PATH of the terminal that runs `sq start`, with the installation's own
75
87
  `bin` first, and `sq start` prints the agent CLI they will use. If it reports the CLI as missing,
76
88
  install it or set `SIDEQUESTOR_PATH` in the workspace `.env` to a PATH that contains it, then run
77
89
  `sq start` again.
78
90
 
79
- Commands use the current directory when it is an initialized workspace. From elsewhere, pass `--workspace PATH` or set `SIDEQUESTOR_WORKSPACE`; the legacy `YAAS_WORKSPACE` name remains accepted.
91
+ Commands use your saved default workspace. Explicit `--workspace PATH`, `--instance ID`, or `SIDEQUESTOR_WORKSPACE` selects another workspace; the legacy `YAAS_WORKSPACE` name remains accepted. Ordinary starts preserve the workspace’s registered Python runtime. Setup and upgrades can refresh that binding explicitly.
80
92
 
81
93
  ## How do I set up the Slack app?
82
94
 
@@ -95,7 +107,7 @@ for public-channel management/invitations; these are not needed to create the pr
95
107
  onboarding interface. Sidequestor's channel-creation helper still creates private channels
96
108
  only. File uploads need `files:write`; attachment downloads need `files:read`.
97
109
 
98
- The wizard never overwrites real values. It fills only blank or placeholder settings, and `sq setup --instructions` never edits files. The selected backend is `codex` by default; the default Codex model is `gpt-6.1-sol` at `high` effort. Setup checks both the Codex and Claude Code CLIs and offers an npm installation for either missing CLI when Codex or Claude is selected. It checks `cursor-agent` when Cursor is selected. npm installation requires Node.js; the Claude Code npm package requires Node.js 22 or later. Installation is optional, but the selected worker CLI must be available before setup starts jobs. CLI login remains a separate step. You can select `cursor` to use the authenticated `cursor-agent` CLI; leave `SIDEQUESTOR_CURSOR_MODEL` unset to use Cursor's default model, or set it to pin a model.
110
+ The wizard never overwrites real values. It fills only blank or placeholder settings, and `sq setup --instructions` never edits files. The selected backend is `codex` by default; the default Codex model is `gpt-6.1-sol` at `high` effort. Setup checks both the Codex and Claude Code CLIs and offers an npm installation for either missing CLI when Codex or Claude is selected. It checks `cursor-agent` when Cursor is selected. npm installation requires Node.js; the Claude Code npm package requires Node.js 22 or later. Installation is optional, but the selected worker CLI must be available before setup starts jobs. Setup guides CLI login, verifies the selected model, and checks the Slack connection used by workers. Claude’s native Slack MCP authorization is separate from Sidequestor Slack OAuth; setup verifies both. Rerun `sq setup` to reconnect after credentials expire. Setup offers a CLI update; startup checks only advise and never install updates. You can select `cursor` to use the authenticated `cursor-agent` CLI; leave `SIDEQUESTOR_CURSOR_MODEL` unset to use Cursor's default model, or set it to pin a model.
99
111
 
100
112
  ## How do I get guided onboarding?
101
113
 
@@ -111,8 +123,10 @@ sq onboard --terminal [--codex|--claude|--cursor]
111
123
  ```
112
124
 
113
125
  Running either command again resumes the same quest and switches its channel. The onboarding quest
114
- starts in your Slack DM and offers to create a private channel such as
115
- `#alex-sidequestor-interface`. If you accept, it continues there and sets up a separate
126
+ starts in your Slack DM and checks whether your current Slack connection can create a private
127
+ channel. If it can, onboarding offers a channel such as `#alex-sidequestor-interface`.
128
+ If that permission is absent, onboarding continues in your DM or terminal without asking you to
129
+ reauthorize Slack. If you accept the available channel offer, it continues there and sets up a separate
116
130
  ongoing interface quest, so you can manage Sidequestor in plain language after onboarding
117
131
  ends. You approve the channel name and any required review in the dashboard; the agent
118
132
  performs the technical steps. No terminal is needed for routine use.
@@ -189,6 +203,13 @@ Optional `NOTION_KEYCHAIN_SERVICE`, `NOTION_KEYCHAIN_ACCOUNT`, and `NOTION_KEYCH
189
203
  select another Keychain item. If no service is configured and the default is missing,
190
204
  the original `sidequestor-notion-test` item is accepted as a compatibility fallback. No Notion connector or Python dependency is required.
191
205
 
206
+ To store or replace the token without it appearing in shell history, run
207
+ `sq credentials set-token notion` in a terminal and paste it at the hidden prompt. It
208
+ updates the item the checkers already read (honouring the optional selectors above) and
209
+ creates `sidequestor-notion` only when none exists. `sq credentials set-token jira` does
210
+ the same for the Jira token (service `jira-api-token`, account `yaas`). Neither command
211
+ changes any setting names, so existing setups need no changes.
212
+
192
213
  | Watch type | Required target | Coverage |
193
214
  |---|---|---|
194
215
  | `notion_page` | `page_id` UUID | Root page properties/content, nested blocks, and comments/replies on the page and blocks. New blocks enroll automatically. |
@@ -590,6 +611,8 @@ If the installed command itself is broken, upgrade with the installing tool dire
590
611
 
591
612
  Reaction defaults use standard names: `robot_face`, `hourglass_flowing_sand`, and `white_check_mark`. Pickup is queued before harness launch; durable status delivery retries Slack failures without repeating completed actions. Blocked work shows `warning` (configurable with `SIDEQUESTOR_REACTION_BLOCKED_EMOJI`); exhausted retries create an Inbox review. Conscious no-action outcomes show done. Save reactions remain silent. Existing historical loading-only orphans are not automatically replayed. To retain a custom set, pin `SIDEQUESTOR_REACTION_PROCESS_EMOJI`, `SIDEQUESTOR_REACTION_LOADING_EMOJI`, and `SIDEQUESTOR_REACTION_DONE_EMOJI`.
592
613
 
614
+ The configurable `expand` reaction defaults to 🪄 (`magic_wand`). Its first scan leaves pre-existing wand reactions alone, so upgrading does not turn old reactions into edit requests. It expands your own Slack message in place, then carries out its explicit requests or creates a quest for ongoing work. It uses the same processing/done/blocked lifecycle as other action reactions. The edit helper verifies ownership, checks for intervening edits, and retains a separate edit receipt so retries do not expand a completed edit again. Set `SIDEQUESTOR_REACTION_EXPAND_EMOJI` to choose another trigger.
615
+
593
616
  ## Something looks wrong. Now what?
594
617
 
595
618
  Start with `sq doctor` — it is the cheapest question you can ask. Include its build line when reporting a problem. `sq start` prints the dashboard URL and records it in `state/dashboard-url.txt`; `sq dashboard url` retrieves it later. `sq dashboard serve` remains available as a foreground developer escape hatch, but the normal persistent lifecycle is `sq start` and `sq stop`. Job errors are in `logs/package-*.err.log`.
@@ -19,8 +19,9 @@ A short checklist, so nothing surprises you halfway through:
19
19
  (`brew install uv` or `brew install pipx`). uv also downloads Python ≥ 3.11 when the Mac does
20
20
  not have it.
21
21
  - The command-line tools `jq`, `curl`, `openssl`, `security` and `open`.
22
- - An authenticated `claude`, `codex`, **or** `cursor-agent` CLI before workers start. Setup can
23
- offer to install a missing Claude Code or Codex CLI if npm is available; Sidequestor never logs in for you.
22
+ - A `claude`, `codex`, **or** `cursor-agent` CLI before workers start. Setup can
23
+ offer to install a missing Claude Code or Codex CLI if npm is available, and guides
24
+ you through the selected CLI's login when needed.
24
25
 
25
26
  Telegram user-session watches require the optional `sidequestor[telegram]` extra. The Slack setup
26
27
  script checks the command-line tools it needs before it runs, and
@@ -48,6 +49,13 @@ sq setup
48
49
  sq start
49
50
  ```
50
51
 
52
+ The repository also includes `install.sh` for a fresh macOS install. It installs the
53
+ PyPI package with uv when needed, creates `~/sidequestor` only when no workspace is
54
+ registered, runs `sq setup`, and opens the dashboard. A separate `install-circle.sh.in`
55
+ template is rendered for the personal Circle mirror; it supplies non-secret Slack app
56
+ identifiers so colleagues do not have to paste an `.env` block. The template itself
57
+ contains placeholders and is not the Circle installer.
58
+
51
59
  Nothing of yours is moved or overwritten: `sidequestor init .` only adds `.yaas` metadata alongside your existing files. `sq`, `sidequestor`, and `yaas` are all available aliases. The dashboard workspace label opens the current workspace in Cursor when available, or in macOS’s default IDE/file opener. Set `SIDEQUESTOR_IDE_APP` to prefer another application.
52
60
 
53
61
  One installation serves every workspace, and `sq` works in any new terminal without activating
@@ -59,12 +67,16 @@ A workspace-local virtualenv still works if you prefer one: `python3 -m venv .ve
59
67
  `source .venv/bin/activate`, then `python -m pip install sidequestor`. Its commands are available
60
68
  only while that environment is active, or by full path such as `.venv/bin/sq`.
61
69
 
70
+ `sq start`, `sq stop`, and `sq dashboard` use your saved default workspace from any terminal directory. The first sole valid workspace is adopted automatically in the existing `~/.config/yaas/instances.json` registry (or the configured config home); no files are moved. With multiple workspaces, run `sq setup --select-workspace` once. Explicit `--workspace PATH` or `--instance ID` overrides the default. The selected workspace path is printed on lifecycle commands. `sq status` shows its path, saved dashboard address, and connection issues. `sq dashboard` opens the running dashboard; `sq dashboard url` prints its URL for scripts.
71
+
72
+ The dashboard defaults to **http://localhost:8877**. Its port is saved in `.yaas/instance.json`; existing published addresses are retained on upgrade. Starting again reuses running jobs. A port conflict is reported without silently choosing 8878 or 8879. Stop Sidequestor before explicitly changing its port with `sq start --dashboard-port PORT`. Missing AI login or confirmed Claude MCP authentication failures pause affected dispatches without adding quest no-progress backoff; rerun `sq setup` to verify and resume.
73
+
62
74
  Background jobs record the PATH of the terminal that runs `sq start`, with the installation's own
63
75
  `bin` first, and `sq start` prints the agent CLI they will use. If it reports the CLI as missing,
64
76
  install it or set `SIDEQUESTOR_PATH` in the workspace `.env` to a PATH that contains it, then run
65
77
  `sq start` again.
66
78
 
67
- Commands use the current directory when it is an initialized workspace. From elsewhere, pass `--workspace PATH` or set `SIDEQUESTOR_WORKSPACE`; the legacy `YAAS_WORKSPACE` name remains accepted.
79
+ Commands use your saved default workspace. Explicit `--workspace PATH`, `--instance ID`, or `SIDEQUESTOR_WORKSPACE` selects another workspace; the legacy `YAAS_WORKSPACE` name remains accepted. Ordinary starts preserve the workspace’s registered Python runtime. Setup and upgrades can refresh that binding explicitly.
68
80
 
69
81
  ## How do I set up the Slack app?
70
82
 
@@ -83,7 +95,7 @@ for public-channel management/invitations; these are not needed to create the pr
83
95
  onboarding interface. Sidequestor's channel-creation helper still creates private channels
84
96
  only. File uploads need `files:write`; attachment downloads need `files:read`.
85
97
 
86
- The wizard never overwrites real values. It fills only blank or placeholder settings, and `sq setup --instructions` never edits files. The selected backend is `codex` by default; the default Codex model is `gpt-6.1-sol` at `high` effort. Setup checks both the Codex and Claude Code CLIs and offers an npm installation for either missing CLI when Codex or Claude is selected. It checks `cursor-agent` when Cursor is selected. npm installation requires Node.js; the Claude Code npm package requires Node.js 22 or later. Installation is optional, but the selected worker CLI must be available before setup starts jobs. CLI login remains a separate step. You can select `cursor` to use the authenticated `cursor-agent` CLI; leave `SIDEQUESTOR_CURSOR_MODEL` unset to use Cursor's default model, or set it to pin a model.
98
+ The wizard never overwrites real values. It fills only blank or placeholder settings, and `sq setup --instructions` never edits files. The selected backend is `codex` by default; the default Codex model is `gpt-6.1-sol` at `high` effort. Setup checks both the Codex and Claude Code CLIs and offers an npm installation for either missing CLI when Codex or Claude is selected. It checks `cursor-agent` when Cursor is selected. npm installation requires Node.js; the Claude Code npm package requires Node.js 22 or later. Installation is optional, but the selected worker CLI must be available before setup starts jobs. Setup guides CLI login, verifies the selected model, and checks the Slack connection used by workers. Claude’s native Slack MCP authorization is separate from Sidequestor Slack OAuth; setup verifies both. Rerun `sq setup` to reconnect after credentials expire. Setup offers a CLI update; startup checks only advise and never install updates. You can select `cursor` to use the authenticated `cursor-agent` CLI; leave `SIDEQUESTOR_CURSOR_MODEL` unset to use Cursor's default model, or set it to pin a model.
87
99
 
88
100
  ## How do I get guided onboarding?
89
101
 
@@ -99,8 +111,10 @@ sq onboard --terminal [--codex|--claude|--cursor]
99
111
  ```
100
112
 
101
113
  Running either command again resumes the same quest and switches its channel. The onboarding quest
102
- starts in your Slack DM and offers to create a private channel such as
103
- `#alex-sidequestor-interface`. If you accept, it continues there and sets up a separate
114
+ starts in your Slack DM and checks whether your current Slack connection can create a private
115
+ channel. If it can, onboarding offers a channel such as `#alex-sidequestor-interface`.
116
+ If that permission is absent, onboarding continues in your DM or terminal without asking you to
117
+ reauthorize Slack. If you accept the available channel offer, it continues there and sets up a separate
104
118
  ongoing interface quest, so you can manage Sidequestor in plain language after onboarding
105
119
  ends. You approve the channel name and any required review in the dashboard; the agent
106
120
  performs the technical steps. No terminal is needed for routine use.
@@ -177,6 +191,13 @@ Optional `NOTION_KEYCHAIN_SERVICE`, `NOTION_KEYCHAIN_ACCOUNT`, and `NOTION_KEYCH
177
191
  select another Keychain item. If no service is configured and the default is missing,
178
192
  the original `sidequestor-notion-test` item is accepted as a compatibility fallback. No Notion connector or Python dependency is required.
179
193
 
194
+ To store or replace the token without it appearing in shell history, run
195
+ `sq credentials set-token notion` in a terminal and paste it at the hidden prompt. It
196
+ updates the item the checkers already read (honouring the optional selectors above) and
197
+ creates `sidequestor-notion` only when none exists. `sq credentials set-token jira` does
198
+ the same for the Jira token (service `jira-api-token`, account `yaas`). Neither command
199
+ changes any setting names, so existing setups need no changes.
200
+
180
201
  | Watch type | Required target | Coverage |
181
202
  |---|---|---|
182
203
  | `notion_page` | `page_id` UUID | Root page properties/content, nested blocks, and comments/replies on the page and blocks. New blocks enroll automatically. |
@@ -578,6 +599,8 @@ If the installed command itself is broken, upgrade with the installing tool dire
578
599
 
579
600
  Reaction defaults use standard names: `robot_face`, `hourglass_flowing_sand`, and `white_check_mark`. Pickup is queued before harness launch; durable status delivery retries Slack failures without repeating completed actions. Blocked work shows `warning` (configurable with `SIDEQUESTOR_REACTION_BLOCKED_EMOJI`); exhausted retries create an Inbox review. Conscious no-action outcomes show done. Save reactions remain silent. Existing historical loading-only orphans are not automatically replayed. To retain a custom set, pin `SIDEQUESTOR_REACTION_PROCESS_EMOJI`, `SIDEQUESTOR_REACTION_LOADING_EMOJI`, and `SIDEQUESTOR_REACTION_DONE_EMOJI`.
580
601
 
602
+ The configurable `expand` reaction defaults to 🪄 (`magic_wand`). Its first scan leaves pre-existing wand reactions alone, so upgrading does not turn old reactions into edit requests. It expands your own Slack message in place, then carries out its explicit requests or creates a quest for ongoing work. It uses the same processing/done/blocked lifecycle as other action reactions. The edit helper verifies ownership, checks for intervening edits, and retains a separate edit receipt so retries do not expand a completed edit again. Set `SIDEQUESTOR_REACTION_EXPAND_EMOJI` to choose another trigger.
603
+
581
604
  ## Something looks wrong. Now what?
582
605
 
583
606
  Start with `sq doctor` — it is the cheapest question you can ask. Include its build line when reporting a problem. `sq start` prints the dashboard URL and records it in `state/dashboard-url.txt`; `sq dashboard url` retrieves it later. `sq dashboard serve` remains available as a foreground developer escape hatch, but the normal persistent lifecycle is `sq start` and `sq stop`. Job errors are in `logs/package-*.err.log`.
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "sidequestor"
7
- version = "0.2.0"
7
+ version = "0.2.2"
8
8
  description = "Sidequestor workspace and triage command shell"
9
9
  readme = "README.md"
10
10
  license = "Apache-2.0"
@@ -1,3 +1,3 @@
1
1
  """Sidequestor package shell for the YAAS-compatible triage engine."""
2
2
 
3
- __version__ = "0.2.0"
3
+ __version__ = "0.2.2"
@@ -34,7 +34,7 @@ from .launchd import (
34
34
  )
35
35
  from .launchd import render, status as launchd_status, uninstall as uninstall_jobs
36
36
  from .migrations import migrate_workspace
37
- from . import onboarding, quest_terminal
37
+ from . import credential_setup, onboarding, quest_terminal
38
38
  from .resources import ENGINE_VERSION, current_engine_version, sync_resources
39
39
  from .setup import configured_agent, print_worker_instructions, run_setup
40
40
  from .upgrade import run_upgrade
@@ -48,6 +48,8 @@ from .workspace import (
48
48
  list_instances,
49
49
  load_workspace,
50
50
  register_workspace,
51
+ default_workspace,
52
+ set_default_workspace,
51
53
  rekey_workspace,
52
54
  validate_workspace,
53
55
  )
@@ -66,10 +68,11 @@ COMMANDS = {
66
68
  "loop": "run the paced triage loop",
67
69
  "dashboard": "serve or inspect the dashboard",
68
70
  "doctor": "validate a workspace and its engine",
71
+ "status": "show the default workspace, jobs, dashboard and worker readiness",
69
72
  "migrate": "apply workspace schema migrations",
70
73
  "sync-resources": "refresh managed engine resources",
71
74
  "upgrade": "upgrade the package and refresh resources when in a workspace",
72
- "credentials": "inspect or repair the stable macOS Keychain helper",
75
+ "credentials": "inspect or repair the Keychain helper, or store a Jira/Notion token",
73
76
  "new-quest": "scaffold a quest folder from a JSON spec",
74
77
  "watch": "manage watches",
75
78
  "ack": "acknowledge dispatched work",
@@ -134,7 +137,7 @@ def _command_help(command: str) -> str:
134
137
  examples = {
135
138
  "init": "sidequestor init PATH [--name NAME]",
136
139
  "instances": "sidequestor instances list [--all]|doctor|register [PATH]|rekey [PATH]",
137
- "setup": "sidequestor [--workspace PATH] setup [--instructions|--manifest|--production] [--non-interactive|--render-only|install|status|uninstall]",
140
+ "setup": "sidequestor [--workspace PATH] setup [--select-workspace|--instructions|--manifest|--production] [--non-interactive|--render-only|install|status|uninstall]",
138
141
  "onboard": "sidequestor [--workspace PATH] onboard [--slack|--slack-dm|--slack-channel CHANNEL_ID|--terminal] [--codex|--claude|--cursor]",
139
142
  "start": "sidequestor [--workspace PATH] start [--dashboard-port PORT]",
140
143
  "stop": "sidequestor [--workspace PATH] stop [INSTANCE_ID]",
@@ -142,10 +145,10 @@ def _command_help(command: str) -> str:
142
145
  "resume": "sidequestor [--workspace PATH] resume [--dashboard-port PORT]",
143
146
  "tick": "sidequestor [--workspace PATH] tick [--dry-run|--isolated [--fake-worker]]",
144
147
  "loop": "sidequestor [--workspace PATH] loop [--max-ticks N]",
145
- "dashboard": "sidequestor [--workspace PATH] dashboard serve|url",
148
+ "dashboard": "sidequestor [--workspace PATH] dashboard [open|serve|url]",
146
149
  "migrate": "sidequestor [--workspace PATH] migrate [NAME|--name NAME]",
147
150
  "upgrade": "sidequestor [--workspace PATH] upgrade [--source GITHUB_URL --ref REF] [--pre] [--yes] [--no-restart]",
148
- "credentials": "sidequestor [--workspace PATH] credentials status|repair-keychain",
151
+ "credentials": "sidequestor [--workspace PATH] credentials status|repair-keychain\n sidequestor [--workspace PATH] credentials set-token jira|notion",
149
152
  "watch": "sidequestor [--workspace PATH] watch [--allow-dormant] QUEST_ID WATCH_JSON\n sidequestor [--workspace PATH] watch retire QUEST_ID WATCH_ID REASON",
150
153
  "new-quest": "sidequestor [--workspace PATH] new-quest [--allow-dormant] SPEC_JSON",
151
154
  "slack-channel": "sidequestor [--workspace PATH] slack-channel create|invite|topic|purpose|approval-spec '<json>'",
@@ -204,7 +207,12 @@ def _workspace(workspace_path: str | None, instance: str | None) -> Workspace:
204
207
  inherited = _workspace_from_environment()
205
208
  if inherited:
206
209
  return find_workspace(inherited)
207
- return find_workspace()
210
+ default = default_workspace()
211
+ if default is not None:
212
+ return default
213
+ workspace = find_workspace()
214
+ register_workspace(workspace)
215
+ return workspace
208
216
 
209
217
 
210
218
  def _cmd_init(args: list[str]) -> int:
@@ -311,6 +319,11 @@ def _cmd_doctor(workspace: Workspace) -> int:
311
319
  name, binary = agent
312
320
  print(f"agent: ok ({binary})" if binary else
313
321
  f"agent: warning ({name} CLI is not on the PATH recorded for background jobs)")
322
+ from .worker_readiness import current_state
323
+ worker = current_state(workspace)
324
+ for scope in ("blocked", "slack"):
325
+ if worker.get(scope):
326
+ print(f"worker: paused — {worker[scope]}")
314
327
  print(f"sidequestor {info['version']}{suffix}")
315
328
  # Advisory, from the heartbeat's cached check; doctor itself never touches the network.
316
329
  update = (available_update(read_update_status(workspace.root), info["version"])
@@ -336,7 +349,7 @@ def _cmd_setup(workspace: Workspace, args: list[str]) -> int:
336
349
  helper_code = _ensure_keychain_helper(workspace)
337
350
  if helper_code:
338
351
  return helper_code
339
- manifest = install_production(workspace, Path(sys.executable))
352
+ manifest = install_production(workspace, Path(sys.executable), replace_runtime=True)
340
353
  print(f"installed production jobs for {manifest['workspace']}")
341
354
  for name, job in manifest["jobs"].items():
342
355
  print(f"{name}: {job['label']}")
@@ -429,6 +442,15 @@ def _ensure_keychain_helper(workspace: Workspace) -> int:
429
442
 
430
443
 
431
444
  def _cmd_credentials(workspace: Workspace, args: list[str]) -> int:
445
+ if args and args[0] == "set-token":
446
+ # Parsed by hand: argparse echoes unrecognized arguments, which would print
447
+ # a token someone pasted on the command line.
448
+ if len(args) != 2 or args[1] not in credential_setup.INTEGRATIONS:
449
+ print("usage: sidequestor credentials set-token jira|notion\n"
450
+ "The token is read from a hidden prompt, never from arguments.",
451
+ file=sys.stderr)
452
+ return 2
453
+ return credential_setup.set_token(args[1], _environment(workspace))
432
454
  parser = argparse.ArgumentParser(prog="sidequestor credentials")
433
455
  parser.add_argument("action", choices=("status", "repair-keychain"))
434
456
  values = parser.parse_args(args)
@@ -481,12 +503,18 @@ def _cmd_start(workspace: Workspace, args: list[str] | None = None) -> int:
481
503
  values = parser.parse_args(args or [])
482
504
  if values.dashboard_port is not None and not 1 <= values.dashboard_port <= 65535:
483
505
  parser.error("--dashboard-port must be between 1 and 65535")
506
+ from .setup_worker import report_worker_version
507
+ report_worker_version(workspace, Path(sys.executable))
484
508
  helper_code = _ensure_keychain_helper(workspace)
485
509
  if helper_code:
486
510
  return helper_code
487
- manifest = install_production(
488
- workspace, Path(sys.executable), values.dashboard_port or 0,
489
- )
511
+ try:
512
+ manifest = install_production(
513
+ workspace, Path(sys.executable), values.dashboard_port or 0,
514
+ )
515
+ except LaunchdLifecycleError as exc:
516
+ print(str(exc), file=sys.stderr)
517
+ return 1
490
518
  print(f"started Sidequestor instance {workspace.instance_id}")
491
519
  for name, job in manifest["jobs"].items():
492
520
  print(f"{name}: {job['label']}")
@@ -540,7 +568,7 @@ def _cmd_stop(workspace: Workspace) -> int:
540
568
  stopped_foreground = stop_dashboard_process(workspace)
541
569
  if not stopped_production and not stopped_foreground:
542
570
  print(f"no production jobs installed for instance {workspace.instance_id}")
543
- return 1
571
+ return 0
544
572
  except LaunchdLifecycleError as exc:
545
573
  print(f"could not stop Sidequestor instance {workspace.instance_id}: {exc}", file=sys.stderr)
546
574
  return 1
@@ -616,15 +644,25 @@ def _cmd_tick(workspace: Workspace, args: list[str]) -> int:
616
644
 
617
645
 
618
646
  def _cmd_dashboard(workspace: Workspace, args: list[str]) -> int:
619
- # Inspection is safe by default; foreground serving is an explicit escape hatch.
620
- action = args[0] if args else "url"
621
- if action == "url":
647
+ action = args[0] if args else "open"
648
+ if action in {"url", "open"}:
622
649
  url = read_dashboard_url(workspace)
623
- print(url or "dashboard is not running")
650
+ print(url or "dashboard is not running (run sq start)")
651
+ if action == "open" and url:
652
+ if read_dashboard_port(workspace) is None:
653
+ raise SystemExit("Dashboard URL is not a valid loopback address. Run sq setup.")
654
+ try:
655
+ if sys.platform == "darwin":
656
+ return subprocess.run(["open", url], check=False).returncode
657
+ import webbrowser
658
+ return 0 if webbrowser.open(url) else 1
659
+ except OSError as exc:
660
+ print(f"Could not open the dashboard: {exc}", file=sys.stderr)
661
+ return 1
624
662
  return 0 if url else 1
625
663
  if action == "serve":
626
664
  parser = argparse.ArgumentParser(prog="yaas dashboard serve")
627
- parser.add_argument("port", nargs="?", type=int, default=8877)
665
+ parser.add_argument("port", nargs="?", type=int, default=0)
628
666
  parser.add_argument("--port", dest="named_port", type=int)
629
667
  values = parser.parse_args(args[1:])
630
668
  return serve_dashboard(workspace, values.named_port if values.named_port is not None else values.port)
@@ -679,7 +717,55 @@ def _dispatch(command: str, args: list[str], workspace_path: str | None, instanc
679
717
  if (command == "upgrade" and not (workspace_path or instance or _workspace_from_environment())
680
718
  and find_workspace_root() is None):
681
719
  return run_upgrade(None, args)
720
+ if command == "setup" and args == ["--select-workspace"]:
721
+ rows = list_instances()
722
+ if not rows:
723
+ raise SystemExit("No registered workspaces. Run sq --workspace PATH setup.")
724
+ for index, row in enumerate(rows, 1):
725
+ print(f"{index}. {row.get('display_name')} ({row.get('path')})")
726
+ try:
727
+ choice = int(input("Default workspace number: "))
728
+ if not 1 <= choice <= len(rows):
729
+ raise ValueError()
730
+ selected = load_workspace(rows[choice - 1]["path"])
731
+ except (ValueError, EOFError):
732
+ raise SystemExit("No default selected.")
733
+ set_default_workspace(selected)
734
+ print(f"Default workspace: {selected.root}")
735
+ return 0
682
736
  workspace = _workspace(workspace_path, instance)
737
+ register_workspace(workspace)
738
+ if command in {"start", "stop", "setup", "doctor", "status", "dashboard"}:
739
+ print(f"Workspace: {workspace.display_name} ({workspace.root})",
740
+ file=sys.stderr if command == "dashboard" else sys.stdout)
741
+ if command in {"start", "upgrade"} or (command == "setup" and args in ([], ["--non-interactive"])):
742
+ from .launchd import start_executable, runtime_environment
743
+ try:
744
+ registered = start_executable(workspace, Path(sys.executable))
745
+ except LaunchdLifecycleError as exc:
746
+ if command != "setup":
747
+ print(str(exc), file=sys.stderr)
748
+ return 1
749
+ print("Setup will repair this workspace's unavailable runtime using the current installation.")
750
+ registered = Path(os.path.abspath(sys.executable))
751
+ forwarded_key = workspace.instance_id + ":" + str(registered)
752
+ # Interpreter launchers may report a different sys.executable spelling.
753
+ # Do not collapse symlinks across distinct venvs; forward at most once.
754
+ if (str(registered) != os.path.abspath(sys.executable) and
755
+ os.environ.get("SIDEQUESTOR_RUNTIME_FORWARDED") != forwarded_key):
756
+ from .dashboard import saved_dashboard_port
757
+ forwarded = list(args)
758
+ if command == "start" and not any(arg == "--dashboard-port" or arg.startswith("--dashboard-port=") for arg in forwarded):
759
+ forwarded.extend(["--dashboard-port", str(saved_dashboard_port(workspace))])
760
+ environment = runtime_environment()
761
+ environment["SIDEQUESTOR_RUNTIME_FORWARDED"] = forwarded_key
762
+ return subprocess.run([str(registered), "-P", "-m", "sidequestor", "--workspace", str(workspace.root),
763
+ command, *forwarded], env=environment, check=False).returncode
764
+ if command == "status":
765
+ print("Jobs: running" if production_is_running(workspace) else "Jobs: stopped")
766
+ from .dashboard import saved_dashboard_port
767
+ print(f"Dashboard: http://localhost:{saved_dashboard_port(workspace)}")
768
+ return _cmd_doctor(workspace)
683
769
  if command == "doctor":
684
770
  return _cmd_doctor(workspace)
685
771
  if command == "sync-resources":
@@ -0,0 +1,155 @@
1
+ """Store a Jira or Notion API token in the Keychain item the runtime already reads.
2
+
3
+ This only writes. It resolves the same location the 0.2.0 readers use
4
+ (``surfaces/client.py`` for Jira, ``surfaces/notion-call.py`` for Notion) and never
5
+ renames, relocates or recreates other records. The token is read from a hidden
6
+ terminal prompt and handed to ``security`` on stdin, so it never appears in argv,
7
+ the environment, output, logs or temporary files.
8
+ """
9
+
10
+ from __future__ import annotations
11
+
12
+ import getpass
13
+ import os
14
+ import re
15
+ import subprocess
16
+ import sys
17
+ import warnings
18
+ from dataclasses import dataclass
19
+ from typing import Callable, Mapping
20
+
21
+ SECURITY = "/usr/bin/security"
22
+ INTEGRATIONS = ("jira", "notion")
23
+ JIRA_SERVICE, JIRA_ACCOUNT = "jira-api-token", "yaas"
24
+ NOTION_SERVICES = ("sidequestor-notion", "sidequestor-notion-test")
25
+ NOTION_ACCOUNT = "sidequestor"
26
+ # `security -i` tokenizes its stdin like a shell line. Restricting values to
27
+ # characters that need no escaping keeps the secret out of argv without a parser.
28
+ TOKEN_PATTERN = re.compile(r"[A-Za-z0-9._~+/=:-]+")
29
+ SAFE_FIELD = re.compile(r'[^"\\\n\r]*')
30
+ NOT_FOUND = 44
31
+
32
+
33
+ class SetupError(Exception):
34
+ pass
35
+
36
+
37
+ @dataclass(frozen=True)
38
+ class Location:
39
+ service: str
40
+ account: str
41
+ path: str | None = None
42
+ exists: bool = False
43
+
44
+ def describe(self) -> str:
45
+ where = f"service={self.service}, account={self.account}"
46
+ return where + (f", keychain={self.path}" if self.path else "")
47
+
48
+
49
+ def _lookup(service: str, account: str, path: str | None, run) -> bool:
50
+ # No -w: this checks presence without ever reading the secret.
51
+ args = [SECURITY, "find-generic-password", "-s", service, "-a", account]
52
+ if path:
53
+ args.append(path)
54
+ try:
55
+ proc = run(args, capture_output=True, text=True, timeout=30)
56
+ except (OSError, subprocess.TimeoutExpired) as exc:
57
+ raise SetupError("macOS Keychain is unavailable") from exc
58
+ if proc.returncode == 0:
59
+ return True
60
+ if proc.returncode == NOT_FOUND:
61
+ return False
62
+ raise SetupError("could not inspect the Keychain (is it locked?); nothing was changed")
63
+
64
+
65
+ def resolve(integration: str, environment: Mapping[str, str], run=subprocess.run) -> Location:
66
+ """Return the Keychain item the runtime reads for ``integration``."""
67
+ if integration == "jira":
68
+ # client.py reads this fixed item from the default keychain search list.
69
+ return Location(JIRA_SERVICE, JIRA_ACCOUNT,
70
+ exists=_lookup(JIRA_SERVICE, JIRA_ACCOUNT, None, run))
71
+ if integration != "notion":
72
+ raise SetupError(f"unsupported integration; choose one of: {', '.join(INTEGRATIONS)}")
73
+ # Mirror notion-call.py exactly: an explicitly empty account stays empty.
74
+ account = environment.get("NOTION_KEYCHAIN_ACCOUNT", NOTION_ACCOUNT)
75
+ path = environment.get("NOTION_KEYCHAIN_PATH")
76
+ path = os.path.expanduser(path) if path else None
77
+ configured = environment.get("NOTION_KEYCHAIN_SERVICE")
78
+ services = [configured] if configured else list(NOTION_SERVICES)
79
+ # Update whichever item notion-call.py would read first; create the documented
80
+ # default only when none exists.
81
+ for service in services:
82
+ if _lookup(service, account, path, run):
83
+ return Location(service, account, path, exists=True)
84
+ return Location(services[0], account, path, exists=False)
85
+
86
+
87
+ def write(location: Location, token: str, run=subprocess.run) -> None:
88
+ fields = [location.service, location.account] + ([location.path] if location.path else [])
89
+ if not all(SAFE_FIELD.fullmatch(field) for field in fields):
90
+ raise SetupError("Keychain service, account or path contains unsupported characters")
91
+ # -U updates the existing item in place, keeping its access list, so headless
92
+ # reads by `security find-generic-password` keep working without new prompts.
93
+ command = f'add-generic-password -U -s "{location.service}" -a "{location.account}" -w "{token}"'
94
+ if location.path:
95
+ command += f' "{location.path}"'
96
+ try:
97
+ proc = run([SECURITY, "-i"], input=command + "\n", capture_output=True,
98
+ text=True, timeout=120)
99
+ except (OSError, subprocess.TimeoutExpired) as exc:
100
+ raise SetupError("macOS Keychain write did not complete; the existing token is unchanged") from exc
101
+ if proc.returncode:
102
+ raise SetupError("macOS Keychain refused the write (locked or cancelled); "
103
+ "the existing token is unchanged")
104
+
105
+
106
+ def hidden_prompt(text: str) -> str:
107
+ # getpass warns and then reads with echo on when it cannot disable terminal echo.
108
+ # Turning that warning into an error stops before anything is read or shown.
109
+ with warnings.catch_warnings():
110
+ warnings.simplefilter("error", getpass.GetPassWarning)
111
+ try:
112
+ return getpass.getpass(text)
113
+ except getpass.GetPassWarning as exc:
114
+ raise SetupError("this terminal cannot hide input; nothing was changed") from exc
115
+
116
+
117
+ def set_token(integration: str, environment: Mapping[str, str], *,
118
+ prompt: Callable[[str], str] = hidden_prompt,
119
+ is_tty: Callable[[], bool] = lambda: sys.stdin.isatty(),
120
+ run=subprocess.run) -> int:
121
+ if integration not in INTEGRATIONS:
122
+ print(f"error: choose one of: {', '.join(INTEGRATIONS)}", file=sys.stderr)
123
+ return 2
124
+ if not is_tty():
125
+ # getpass falls back to echoing input without a terminal.
126
+ print("error: run this in an interactive terminal; tokens are not read from "
127
+ "pipes or arguments", file=sys.stderr)
128
+ return 2
129
+ try:
130
+ location = resolve(integration, environment, run)
131
+ label = "Jira API token" if integration == "jira" else "Notion integration token"
132
+ action = "replace the existing" if location.exists else "create a new"
133
+ print(f"This will {action} Keychain item ({location.describe()}).")
134
+ try:
135
+ token = prompt(f"{label} (input hidden, empty to cancel): ").strip()
136
+ except (EOFError, KeyboardInterrupt):
137
+ print("\nCancelled; nothing was changed.", file=sys.stderr)
138
+ return 130
139
+ if not token:
140
+ print("Cancelled; nothing was changed.", file=sys.stderr)
141
+ return 1
142
+ if not TOKEN_PATTERN.fullmatch(token):
143
+ print("error: that does not look like an API token (unexpected characters); "
144
+ "nothing was changed", file=sys.stderr)
145
+ return 2
146
+ write(location, token, run)
147
+ except SetupError as exc:
148
+ print(f"error: {exc}", file=sys.stderr)
149
+ return 1
150
+ print(f"Saved {label} to Keychain ({location.describe()}).")
151
+ if integration == "notion" and environment.get("NOTION_TOKEN", "").strip():
152
+ print("Note: NOTION_TOKEN is set and still takes precedence over the Keychain item.")
153
+ if integration == "jira" and not (environment.get("JIRA_EMAIL") and environment.get("JIRA_BASE_URL")):
154
+ print("Note: also set JIRA_EMAIL and JIRA_BASE_URL in the workspace .env.")
155
+ return 0