devstuff 2.26.0__tar.gz → 2.27.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (284) hide show
  1. {devstuff-2.26.0 → devstuff-2.27.0}/CHANGELOG.md +11 -0
  2. {devstuff-2.26.0 → devstuff-2.27.0}/CLAUDE.md +11 -2
  3. {devstuff-2.26.0 → devstuff-2.27.0}/PKG-INFO +1 -1
  4. {devstuff-2.26.0 → devstuff-2.27.0}/docs/specs/plan-and-progress/specifications.md +12 -2
  5. {devstuff-2.26.0 → devstuff-2.27.0}/pyproject.toml +1 -1
  6. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/commands/install_cmd.py +15 -1
  7. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/commands/list_cmd.py +6 -2
  8. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/commands/remove_cmd.py +6 -2
  9. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/commands/update_cmd.py +4 -1
  10. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/generic.py +302 -24
  11. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/tools.yaml +160 -93
  12. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/ui.py +18 -2
  13. {devstuff-2.26.0 → devstuff-2.27.0}/tests/test_generic.py +116 -0
  14. {devstuff-2.26.0 → devstuff-2.27.0}/tests/test_lifecycle_cmds.py +10 -1
  15. {devstuff-2.26.0 → devstuff-2.27.0}/tests/test_ui.py +44 -1
  16. {devstuff-2.26.0 → devstuff-2.27.0}/uv.lock +1 -1
  17. {devstuff-2.26.0 → devstuff-2.27.0}/.claude/skills/run-stuff/SKILL.md +0 -0
  18. {devstuff-2.26.0 → devstuff-2.27.0}/.claude/skills/run-stuff/smoke.sh +0 -0
  19. {devstuff-2.26.0 → devstuff-2.27.0}/.github/codex/review.md +0 -0
  20. {devstuff-2.26.0 → devstuff-2.27.0}/.github/workflows/agent.yml +0 -0
  21. {devstuff-2.26.0 → devstuff-2.27.0}/.github/workflows/bump.yml +0 -0
  22. {devstuff-2.26.0 → devstuff-2.27.0}/.github/workflows/ci.yml +0 -0
  23. {devstuff-2.26.0 → devstuff-2.27.0}/.github/workflows/publish.yml +0 -0
  24. {devstuff-2.26.0 → devstuff-2.27.0}/.github/workflows/test-installs.yml +0 -0
  25. {devstuff-2.26.0 → devstuff-2.27.0}/.gitignore +0 -0
  26. {devstuff-2.26.0 → devstuff-2.27.0}/AGENTS.md +0 -0
  27. {devstuff-2.26.0 → devstuff-2.27.0}/README.md +0 -0
  28. {devstuff-2.26.0 → devstuff-2.27.0}/dev/Dockerfile +0 -0
  29. {devstuff-2.26.0 → devstuff-2.27.0}/dev/Dockerfile.ci +0 -0
  30. {devstuff-2.26.0 → devstuff-2.27.0}/dev/Makefile +0 -0
  31. {devstuff-2.26.0 → devstuff-2.27.0}/dev/docker-compose.yml +0 -0
  32. {devstuff-2.26.0 → devstuff-2.27.0}/devstuff +0 -0
  33. {devstuff-2.26.0 → devstuff-2.27.0}/docs/ROADMAP.md +0 -0
  34. {devstuff-2.26.0 → devstuff-2.27.0}/docs/github-agent.md +0 -0
  35. {devstuff-2.26.0 → devstuff-2.27.0}/docs/specs/README.md +0 -0
  36. {devstuff-2.26.0 → devstuff-2.27.0}/docs/specs/agent/development-plan.md +0 -0
  37. {devstuff-2.26.0 → devstuff-2.27.0}/docs/specs/agent/specifications.md +0 -0
  38. {devstuff-2.26.0 → devstuff-2.27.0}/docs/specs/agent/stack-decisions.md +0 -0
  39. {devstuff-2.26.0 → devstuff-2.27.0}/docs/specs/ansible-config/development-plan.md +0 -0
  40. {devstuff-2.26.0 → devstuff-2.27.0}/docs/specs/ansible-config/specifications.md +0 -0
  41. {devstuff-2.26.0 → devstuff-2.27.0}/docs/specs/ansible-config/stack-decisions.md +0 -0
  42. {devstuff-2.26.0 → devstuff-2.27.0}/docs/specs/bat-config/development-plan.md +0 -0
  43. {devstuff-2.26.0 → devstuff-2.27.0}/docs/specs/bat-config/specifications.md +0 -0
  44. {devstuff-2.26.0 → devstuff-2.27.0}/docs/specs/bat-config/stack-decisions.md +0 -0
  45. {devstuff-2.26.0 → devstuff-2.27.0}/docs/specs/btop-config/development-plan.md +0 -0
  46. {devstuff-2.26.0 → devstuff-2.27.0}/docs/specs/btop-config/specifications.md +0 -0
  47. {devstuff-2.26.0 → devstuff-2.27.0}/docs/specs/btop-config/stack-decisions.md +0 -0
  48. {devstuff-2.26.0 → devstuff-2.27.0}/docs/specs/commitizen-config/development-plan.md +0 -0
  49. {devstuff-2.26.0 → devstuff-2.27.0}/docs/specs/commitizen-config/specifications.md +0 -0
  50. {devstuff-2.26.0 → devstuff-2.27.0}/docs/specs/commitizen-config/stack-decisions.md +0 -0
  51. {devstuff-2.26.0 → devstuff-2.27.0}/docs/specs/docker-config/development-plan.md +0 -0
  52. {devstuff-2.26.0 → devstuff-2.27.0}/docs/specs/docker-config/specifications.md +0 -0
  53. {devstuff-2.26.0 → devstuff-2.27.0}/docs/specs/docker-config/stack-decisions.md +0 -0
  54. {devstuff-2.26.0 → devstuff-2.27.0}/docs/specs/fmhy-picks/development-plan.md +0 -0
  55. {devstuff-2.26.0 → devstuff-2.27.0}/docs/specs/fmhy-picks/specifications.md +0 -0
  56. {devstuff-2.26.0 → devstuff-2.27.0}/docs/specs/fmhy-picks/stack-decisions.md +0 -0
  57. {devstuff-2.26.0 → devstuff-2.27.0}/docs/specs/lazygit-config/development-plan.md +0 -0
  58. {devstuff-2.26.0 → devstuff-2.27.0}/docs/specs/lazygit-config/specifications.md +0 -0
  59. {devstuff-2.26.0 → devstuff-2.27.0}/docs/specs/lazygit-config/stack-decisions.md +0 -0
  60. {devstuff-2.26.0 → devstuff-2.27.0}/docs/specs/managed-by/development-plan.md +0 -0
  61. {devstuff-2.26.0 → devstuff-2.27.0}/docs/specs/managed-by/specifications.md +0 -0
  62. {devstuff-2.26.0 → devstuff-2.27.0}/docs/specs/managed-by/stack-decisions.md +0 -0
  63. {devstuff-2.26.0 → devstuff-2.27.0}/docs/specs/mcp/development-plan.md +0 -0
  64. {devstuff-2.26.0 → devstuff-2.27.0}/docs/specs/mcp/specifications.md +0 -0
  65. {devstuff-2.26.0 → devstuff-2.27.0}/docs/specs/mcp/stack-decisions.md +0 -0
  66. {devstuff-2.26.0 → devstuff-2.27.0}/docs/specs/outdated/development-plan.md +0 -0
  67. {devstuff-2.26.0 → devstuff-2.27.0}/docs/specs/outdated/specifications.md +0 -0
  68. {devstuff-2.26.0 → devstuff-2.27.0}/docs/specs/outdated/stack-decisions.md +0 -0
  69. {devstuff-2.26.0 → devstuff-2.27.0}/docs/specs/precommit-config/development-plan.md +0 -0
  70. {devstuff-2.26.0 → devstuff-2.27.0}/docs/specs/precommit-config/specifications.md +0 -0
  71. {devstuff-2.26.0 → devstuff-2.27.0}/docs/specs/precommit-config/stack-decisions.md +0 -0
  72. {devstuff-2.26.0 → devstuff-2.27.0}/docs/specs/profile/development-plan.md +0 -0
  73. {devstuff-2.26.0 → devstuff-2.27.0}/docs/specs/profile/specifications.md +0 -0
  74. {devstuff-2.26.0 → devstuff-2.27.0}/docs/specs/profile/stack-decisions.md +0 -0
  75. {devstuff-2.26.0 → devstuff-2.27.0}/docs/specs/profile-apply/development-plan.md +0 -0
  76. {devstuff-2.26.0 → devstuff-2.27.0}/docs/specs/profile-apply/specifications.md +0 -0
  77. {devstuff-2.26.0 → devstuff-2.27.0}/docs/specs/profile-apply/stack-decisions.md +0 -0
  78. {devstuff-2.26.0 → devstuff-2.27.0}/docs/specs/starship-config/development-plan.md +0 -0
  79. {devstuff-2.26.0 → devstuff-2.27.0}/docs/specs/starship-config/specifications.md +0 -0
  80. {devstuff-2.26.0 → devstuff-2.27.0}/docs/specs/starship-config/stack-decisions.md +0 -0
  81. {devstuff-2.26.0 → devstuff-2.27.0}/docs/specs/syncthing-config/development-plan.md +0 -0
  82. {devstuff-2.26.0 → devstuff-2.27.0}/docs/specs/syncthing-config/specifications.md +0 -0
  83. {devstuff-2.26.0 → devstuff-2.27.0}/docs/specs/syncthing-config/stack-decisions.md +0 -0
  84. {devstuff-2.26.0 → devstuff-2.27.0}/docs/specs/uv-backbone/development-plan.md +0 -0
  85. {devstuff-2.26.0 → devstuff-2.27.0}/docs/specs/uv-backbone/specifications.md +0 -0
  86. {devstuff-2.26.0 → devstuff-2.27.0}/docs/specs/uv-backbone/stack-decisions.md +0 -0
  87. {devstuff-2.26.0 → devstuff-2.27.0}/docs/specs/verbose-mode/development-plan.md +0 -0
  88. {devstuff-2.26.0 → devstuff-2.27.0}/docs/specs/verbose-mode/specifications.md +0 -0
  89. {devstuff-2.26.0 → devstuff-2.27.0}/docs/specs/verbose-mode/stack-decisions.md +0 -0
  90. {devstuff-2.26.0 → devstuff-2.27.0}/install.sh +0 -0
  91. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/__init__.py +0 -0
  92. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/__main__.py +0 -0
  93. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/agent/__init__.py +0 -0
  94. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/agent/approval.py +0 -0
  95. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/agent/bridges.py +0 -0
  96. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/agent/catalog.py +0 -0
  97. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/agent/completion.py +0 -0
  98. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/agent/config.py +0 -0
  99. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/agent/loop.py +0 -0
  100. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/agent/ollama.py +0 -0
  101. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/agent/preflight.py +0 -0
  102. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/agent/primitives.py +0 -0
  103. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/agent/registry.py +0 -0
  104. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/agent/sandbox.py +0 -0
  105. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/agent/session.py +0 -0
  106. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/agent/transcript.py +0 -0
  107. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/agent/wizard.py +0 -0
  108. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/agent_tools.schema.json +0 -0
  109. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/agent_tools.yaml +0 -0
  110. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/apply_exec.py +0 -0
  111. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/apply_plan.py +0 -0
  112. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/base.py +0 -0
  113. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/bundles/ai-agents.yaml +0 -0
  114. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/bundles/ai-local.yaml +0 -0
  115. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/bundles/devops.yaml +0 -0
  116. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/bundles/essentials.yaml +0 -0
  117. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/bundles/languages.yaml +0 -0
  118. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/bundles/python.yaml +0 -0
  119. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/bundles.py +0 -0
  120. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/catalog.py +0 -0
  121. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/cli.py +0 -0
  122. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/commands/__init__.py +0 -0
  123. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/commands/_plan.py +0 -0
  124. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/commands/add_cmd.py +0 -0
  125. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/commands/agent_cmd.py +0 -0
  126. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/commands/catalog_cmd.py +0 -0
  127. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/commands/configure_cmd.py +0 -0
  128. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/commands/delete_cmd.py +0 -0
  129. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/commands/docs_cmd.py +0 -0
  130. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/commands/doctor_cmd.py +0 -0
  131. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/commands/functions_cmd.py +0 -0
  132. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/commands/help_cmd.py +0 -0
  133. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/commands/links_cmd.py +0 -0
  134. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/commands/mcp_cmd.py +0 -0
  135. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/commands/outdated_cmd.py +0 -0
  136. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/commands/profile_cmd.py +0 -0
  137. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/commands/run_cmd.py +0 -0
  138. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/commands/skills_cmd.py +0 -0
  139. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/configure/__init__.py +0 -0
  140. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/configure/ansible/__init__.py +0 -0
  141. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/configure/ansible/detect.py +0 -0
  142. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/configure/ansible/model.py +0 -0
  143. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/configure/ansible/render.py +0 -0
  144. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/configure/ansible/validate.py +0 -0
  145. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/configure/ansible/wizard.py +0 -0
  146. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/configure/bat/__init__.py +0 -0
  147. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/configure/bat/detect.py +0 -0
  148. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/configure/bat/model.py +0 -0
  149. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/configure/bat/preview.py +0 -0
  150. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/configure/bat/render.py +0 -0
  151. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/configure/bat/wizard.py +0 -0
  152. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/configure/btop/__init__.py +0 -0
  153. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/configure/btop/capability.py +0 -0
  154. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/configure/btop/detect.py +0 -0
  155. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/configure/btop/model.py +0 -0
  156. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/configure/btop/render.py +0 -0
  157. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/configure/btop/validate.py +0 -0
  158. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/configure/btop/wizard.py +0 -0
  159. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/configure/commitizen/__init__.py +0 -0
  160. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/configure/commitizen/detect.py +0 -0
  161. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/configure/commitizen/model.py +0 -0
  162. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/configure/commitizen/render.py +0 -0
  163. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/configure/commitizen/validate.py +0 -0
  164. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/configure/commitizen/wizard.py +0 -0
  165. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/configure/docker/__init__.py +0 -0
  166. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/configure/docker/detect.py +0 -0
  167. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/configure/docker/model.py +0 -0
  168. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/configure/docker/render.py +0 -0
  169. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/configure/docker/validate.py +0 -0
  170. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/configure/docker/wizard.py +0 -0
  171. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/configure/lazygit/__init__.py +0 -0
  172. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/configure/lazygit/detect.py +0 -0
  173. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/configure/lazygit/model.py +0 -0
  174. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/configure/lazygit/render.py +0 -0
  175. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/configure/lazygit/validate.py +0 -0
  176. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/configure/lazygit/wizard.py +0 -0
  177. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/configure/precommit/__init__.py +0 -0
  178. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/configure/precommit/detect.py +0 -0
  179. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/configure/precommit/model.py +0 -0
  180. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/configure/precommit/render.py +0 -0
  181. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/configure/precommit/validate.py +0 -0
  182. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/configure/precommit/wizard.py +0 -0
  183. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/configure/reptyr/__init__.py +0 -0
  184. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/configure/reptyr/wizard.py +0 -0
  185. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/configure/starship/__init__.py +0 -0
  186. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/configure/starship/fonts.py +0 -0
  187. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/configure/starship/icons.py +0 -0
  188. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/configure/starship/model.py +0 -0
  189. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/configure/starship/preview.py +0 -0
  190. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/configure/starship/render.py +0 -0
  191. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/configure/starship/wizard.py +0 -0
  192. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/configure/syncthing/__init__.py +0 -0
  193. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/configure/syncthing/api.py +0 -0
  194. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/configure/syncthing/detect.py +0 -0
  195. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/configure/syncthing/model.py +0 -0
  196. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/configure/syncthing/wizard.py +0 -0
  197. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/doctor.py +0 -0
  198. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/function_runner.py +0 -0
  199. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/functions.schema.json +0 -0
  200. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/functions.yaml +0 -0
  201. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/functions_catalog.py +0 -0
  202. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/functions_registry.py +0 -0
  203. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/links.schema.json +0 -0
  204. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/links.yaml +0 -0
  205. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/links_catalog.py +0 -0
  206. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/links_registry.py +0 -0
  207. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/managers.py +0 -0
  208. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/mcp/__init__.py +0 -0
  209. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/mcp/core.py +0 -0
  210. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/mcp/http.py +0 -0
  211. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/mcp/openapi.py +0 -0
  212. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/mcp/printconfig.py +0 -0
  213. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/mcp/process.py +0 -0
  214. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/mcp/stdio.py +0 -0
  215. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/mcp/token.py +0 -0
  216. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/profile.py +0 -0
  217. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/registry.py +0 -0
  218. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/snapshot.py +0 -0
  219. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/updates.py +0 -0
  220. {devstuff-2.26.0 → devstuff-2.27.0}/src/dev_setup/verbose.py +0 -0
  221. {devstuff-2.26.0 → devstuff-2.27.0}/tests/__init__.py +0 -0
  222. {devstuff-2.26.0 → devstuff-2.27.0}/tests/integration/__init__.py +0 -0
  223. {devstuff-2.26.0 → devstuff-2.27.0}/tests/integration/conftest.py +0 -0
  224. {devstuff-2.26.0 → devstuff-2.27.0}/tests/integration/test_agent_smoke.py +0 -0
  225. {devstuff-2.26.0 → devstuff-2.27.0}/tests/integration/test_agent_tui.py +0 -0
  226. {devstuff-2.26.0 → devstuff-2.27.0}/tests/integration/test_commitizen_config.py +0 -0
  227. {devstuff-2.26.0 → devstuff-2.27.0}/tests/integration/test_mcp_claude.py +0 -0
  228. {devstuff-2.26.0 → devstuff-2.27.0}/tests/integration/test_mcp_conformance.py +0 -0
  229. {devstuff-2.26.0 → devstuff-2.27.0}/tests/integration/test_profile_apply.py +0 -0
  230. {devstuff-2.26.0 → devstuff-2.27.0}/tests/integration/test_tools.py +0 -0
  231. {devstuff-2.26.0 → devstuff-2.27.0}/tests/mcp_http_support.py +0 -0
  232. {devstuff-2.26.0 → devstuff-2.27.0}/tests/mcp_process_support.py +0 -0
  233. {devstuff-2.26.0 → devstuff-2.27.0}/tests/test_agent.py +0 -0
  234. {devstuff-2.26.0 → devstuff-2.27.0}/tests/test_agent_bridges.py +0 -0
  235. {devstuff-2.26.0 → devstuff-2.27.0}/tests/test_agent_completion.py +0 -0
  236. {devstuff-2.26.0 → devstuff-2.27.0}/tests/test_agent_loop.py +0 -0
  237. {devstuff-2.26.0 → devstuff-2.27.0}/tests/test_agent_sandbox.py +0 -0
  238. {devstuff-2.26.0 → devstuff-2.27.0}/tests/test_agent_tools.py +0 -0
  239. {devstuff-2.26.0 → devstuff-2.27.0}/tests/test_agent_wizard.py +0 -0
  240. {devstuff-2.26.0 → devstuff-2.27.0}/tests/test_apply_exec.py +0 -0
  241. {devstuff-2.26.0 → devstuff-2.27.0}/tests/test_apply_plan.py +0 -0
  242. {devstuff-2.26.0 → devstuff-2.27.0}/tests/test_apply_run.py +0 -0
  243. {devstuff-2.26.0 → devstuff-2.27.0}/tests/test_bundles.py +0 -0
  244. {devstuff-2.26.0 → devstuff-2.27.0}/tests/test_catalog.py +0 -0
  245. {devstuff-2.26.0 → devstuff-2.27.0}/tests/test_catalog_scripts.py +0 -0
  246. {devstuff-2.26.0 → devstuff-2.27.0}/tests/test_configure_ansible.py +0 -0
  247. {devstuff-2.26.0 → devstuff-2.27.0}/tests/test_configure_bat.py +0 -0
  248. {devstuff-2.26.0 → devstuff-2.27.0}/tests/test_configure_btop.py +0 -0
  249. {devstuff-2.26.0 → devstuff-2.27.0}/tests/test_configure_commitizen.py +0 -0
  250. {devstuff-2.26.0 → devstuff-2.27.0}/tests/test_configure_docker.py +0 -0
  251. {devstuff-2.26.0 → devstuff-2.27.0}/tests/test_configure_lazygit.py +0 -0
  252. {devstuff-2.26.0 → devstuff-2.27.0}/tests/test_configure_precommit.py +0 -0
  253. {devstuff-2.26.0 → devstuff-2.27.0}/tests/test_configure_reptyr.py +0 -0
  254. {devstuff-2.26.0 → devstuff-2.27.0}/tests/test_configure_starship.py +0 -0
  255. {devstuff-2.26.0 → devstuff-2.27.0}/tests/test_configure_syncthing.py +0 -0
  256. {devstuff-2.26.0 → devstuff-2.27.0}/tests/test_doctor.py +0 -0
  257. {devstuff-2.26.0 → devstuff-2.27.0}/tests/test_functions.py +0 -0
  258. {devstuff-2.26.0 → devstuff-2.27.0}/tests/test_installed_version.py +0 -0
  259. {devstuff-2.26.0 → devstuff-2.27.0}/tests/test_links.py +0 -0
  260. {devstuff-2.26.0 → devstuff-2.27.0}/tests/test_managers.py +0 -0
  261. {devstuff-2.26.0 → devstuff-2.27.0}/tests/test_mcp_classify.py +0 -0
  262. {devstuff-2.26.0 → devstuff-2.27.0}/tests/test_mcp_core.py +0 -0
  263. {devstuff-2.26.0 → devstuff-2.27.0}/tests/test_mcp_http.py +0 -0
  264. {devstuff-2.26.0 → devstuff-2.27.0}/tests/test_mcp_http_cmd.py +0 -0
  265. {devstuff-2.26.0 → devstuff-2.27.0}/tests/test_mcp_openapi.py +0 -0
  266. {devstuff-2.26.0 → devstuff-2.27.0}/tests/test_mcp_printconfig.py +0 -0
  267. {devstuff-2.26.0 → devstuff-2.27.0}/tests/test_mcp_process.py +0 -0
  268. {devstuff-2.26.0 → devstuff-2.27.0}/tests/test_mcp_stdio.py +0 -0
  269. {devstuff-2.26.0 → devstuff-2.27.0}/tests/test_mcp_token.py +0 -0
  270. {devstuff-2.26.0 → devstuff-2.27.0}/tests/test_outdated_cmd.py +0 -0
  271. {devstuff-2.26.0 → devstuff-2.27.0}/tests/test_pin_support.py +0 -0
  272. {devstuff-2.26.0 → devstuff-2.27.0}/tests/test_plan_and_select.py +0 -0
  273. {devstuff-2.26.0 → devstuff-2.27.0}/tests/test_profile.py +0 -0
  274. {devstuff-2.26.0 → devstuff-2.27.0}/tests/test_profile_apply_cmd.py +0 -0
  275. {devstuff-2.26.0 → devstuff-2.27.0}/tests/test_profile_diff.py +0 -0
  276. {devstuff-2.26.0 → devstuff-2.27.0}/tests/test_profile_diff_cmd.py +0 -0
  277. {devstuff-2.26.0 → devstuff-2.27.0}/tests/test_profile_snapshot_cmd.py +0 -0
  278. {devstuff-2.26.0 → devstuff-2.27.0}/tests/test_registry.py +0 -0
  279. {devstuff-2.26.0 → devstuff-2.27.0}/tests/test_snapshot.py +0 -0
  280. {devstuff-2.26.0 → devstuff-2.27.0}/tests/test_update_checker_parity.py +0 -0
  281. {devstuff-2.26.0 → devstuff-2.27.0}/tests/test_update_notes.py +0 -0
  282. {devstuff-2.26.0 → devstuff-2.27.0}/tests/test_updates.py +0 -0
  283. {devstuff-2.26.0 → devstuff-2.27.0}/tests/test_uv_probes.py +0 -0
  284. {devstuff-2.26.0 → devstuff-2.27.0}/tests/test_verbose.py +0 -0
@@ -1,3 +1,14 @@
1
+ ## v2.27.0 (2026-11-16)
2
+
3
+ ### Features
4
+
5
+ - **list**: tag tools as sudo-required vs user-level installs
6
+
7
+ ### Bug Fixes
8
+
9
+ - **install**: dedupe apt refreshes, fix catalog install/update defects
10
+ - **install**: harden installs against hangs, add subprocess logging
11
+
1
12
  ## v2.26.0 (2026-10-19)
2
13
 
3
14
  ### Features
@@ -253,9 +253,18 @@ under a live checklist, and end a multi-package run in a summary. Things that ar
253
253
  message that really contains a closing-tag-shaped string, or it passes whatever the code does.
254
254
  - **`task_view` is inert unless it is a live terminal.** It degrades to `verbose.step` under `-v` or off a TTY, which
255
255
  is why `--json` and `profile apply` are unaffected. `_run` therefore has three output modes (feed the view, stream
256
- raw, capture-and-surface-on-failure) — keep a new subprocess call going through it. A partial line (a `sudo`
256
+ raw, capture-and-surface-on-failure) — keep a new subprocess call going through it. A partial line (a `read`
257
257
  prompt, a curl bar) is fed to the tail while the process waits; line iteration would leave it in the pipe and the
258
- terminal looking hung.
258
+ terminal looking hung. Everything under the view also goes to `~/.local/state/devstuff/install.log`, whose path
259
+ is printed under any failure.
260
+ - **sudo prompts never appear mid-view — `_sudo_session` pre-validates them.** sudo writes its prompt to `/dev/tty`,
261
+ which bypasses the pipe entirely: under the live region it is invisible and repainted over, so a mid-install sudo
262
+ reads exactly like a hang (the docker freeze). `install`/`remove`/`update` wrap the view in `_sudo_session`: when
263
+ `_may_need_sudo` guesses the action elevates (apt, a greppable `sudo` in the script bodies, `script` type assumed),
264
+ `sudo -v` runs on the plain terminal first, then a thread refreshes `sudo -n -v` every 60s so the timestamp can't
265
+ expire mid-run. Two related hang guards inside `_run`: children get `DEBIAN_FRONTEND=noninteractive` (debconf
266
+ dialogs can't open on the tty either), and the piped read is `select`-polled with a fixed post-exit drain window —
267
+ a detached grandchild holding stdout can't keep EOF, and the install, open forever.
259
268
  - **Every install type needs a `_PLANNERS` entry** (`test_every_install_type_has_a_planner`): without one the plan is
260
269
  a generic note and the bar shows no phases.
261
270
  - **Picker titles are plain strings.** A questionary token-list title is emitted verbatim and never gets
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: devstuff
3
- Version: 2.26.0
3
+ Version: 2.27.0
4
4
  Summary: Development environment setup CLI for Linux
5
5
  Project-URL: Repository, https://github.com/thesawdawg/dev-setup-py
6
6
  Author-email: Sawyer <sawyerksu@gmail.com>
@@ -57,8 +57,17 @@ Each is covered by a test in `tests/test_lifecycle_cmds.py`, `tests/test_plan_an
57
57
  - **FR-12** The view degrades to the plain `verbose.step` line when `-v` is on or the console is not
58
58
  a terminal. `_run` then has three modes: feed the view; stream raw (verbose); capture and surface
59
59
  the output as the error message on failure.
60
- - **FR-13** A partial line (a `sudo` password prompt, a curl progress bar) is pushed to the tail while
61
- the process still waits, so a prompt is visible rather than the terminal looking hung.
60
+ - **FR-13** A partial line (a `read` prompt, a curl progress bar) is pushed to the tail while
61
+ the process still waits, so a prompt is visible rather than the terminal looking hung. A `sudo`
62
+ prompt is the exception — it goes to `/dev/tty`, not the pipe, so the tail can never show it;
63
+ `_sudo_session` validates credentials before the view opens instead (F-8).
64
+ - **FR-13a** The piped read is `select`-polled, not EOF-bound: after the main process exits the pipe
65
+ gets a fixed ~2s drain window, then remaining writers are treated as detached grandchildren and
66
+ dropped. `read1`-to-EOF hangs whenever a script leaves a background process holding stdout.
67
+ - **FR-13b** Everything `_run` runs appends to `~/.local/state/devstuff/install.log`; install,
68
+ remove and update print its path under a failure.
69
+ - **FR-13c** `_run` children get `DEBIAN_FRONTEND=noninteractive` and, in the no-view capture mode,
70
+ `stdin=/dev/null` — a hidden prompt fails fast instead of hanging on input nobody can see.
62
71
  - **FR-14** Every install type has a `_PLANNERS` entry. Without one the plan is a generic note and
63
72
  the bar shows no phases.
64
73
 
@@ -98,6 +107,7 @@ has just asked about, and plain-string picker titles), and the four configurator
98
107
  | F-5 | **A missing requirement asks three questions.** `install pkg` with `dep` missing asks `Install Pkg?`, then `Pkg requires dep — install them first?`, then `Install Dep?` (the requirement's own plan). | Current behaviour, not pinned by a test. A candidate to tighten: the second answer already implies the third. |
99
108
  | F-6 | **The step counter changes once the type is known** (`step 1/7`, then `2/8`) because the type-specific steps only count after a type is chosen. | Cosmetic; left as is. |
100
109
  | F-7 | `profile apply`-style "stuck" prompts under a pty harness were the *harness*: `prompt_toolkit` asks the terminal for the cursor position (`ESC[6n`) and waits. Not a product defect. | Recorded because it cost a false alarm: a pty driver for these commands must answer it. |
110
+ | F-8 | **Big installs froze with a live view showing.** Reported 2026-11-15 against docker. Three independent causes, all reproduced: (1) `sudo` prompts on `/dev/tty`, bypassing the pipe — invisible under the view and overwritten by repaints, and the timestamp could expire mid-download so a *later* sudo in the same script hung too; (2) `read1`-to-EOF waits on every pipe writer — a detached grandchild holding stdout (e.g. `daemon &`) keeps EOF open after the script exits; (3) `bash -lc` probes before the view ran `~/.profile` unbounded. | `_sudo_session` (pre-validate `sudo -v` on the plain terminal + 60s `sudo -n -v` keepalive), the `select` drain window, `DEBIAN_FRONTEND=noninteractive`, DEVNULL stdin off-tty, 15s probe timeouts, and `install.log`. FR-13/13a/13b/13c. |
101
111
 
102
112
  ## 5. Tests
103
113
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "devstuff"
3
- version = "2.26.0"
3
+ version = "2.27.0"
4
4
  description = "Development environment setup CLI for Linux"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.11"
@@ -7,7 +7,7 @@ import click
7
7
  import questionary
8
8
  from rich.markup import escape
9
9
 
10
- from dev_setup import managers, registry, ui
10
+ from dev_setup import generic, managers, registry, ui
11
11
  from dev_setup.base import Tool
12
12
  from dev_setup.commands._plan import plan_for, plan_summary
13
13
 
@@ -112,6 +112,13 @@ def _install_one(
112
112
  status, detail = _install_one(dep, yes=yes) if dep else ("fail", "")
113
113
  if status == "fail":
114
114
  return "fail", f"required tool {dep_key} failed"
115
+ # A required tool's install can already provide this tool
116
+ # (ansible-vault is bundled with ansible) — re-check before doing
117
+ # the work a second time.
118
+ if tool.is_installed():
119
+ version = tool.get_version()
120
+ ui.success(f"{tool.name} is already installed: {version}")
121
+ return "skip", f"already installed{': ' + version if version else ''}"
115
122
  else:
116
123
  ui.error(f"Cannot install {tool.name} — missing: {', '.join(missing)}")
117
124
  return "fail", "declined required tools"
@@ -128,7 +135,12 @@ def _install_one(
128
135
  ui.success(msg)
129
136
  except Exception as exc:
130
137
  ui.error(f"Failed to install {tool.name}: {escape(str(exc))}")
138
+ ui.dim(f" full output: {generic.run_log_path()}")
131
139
  return "fail", str(exc).splitlines()[-1][:120]
140
+ finally:
141
+ # An installer — even a failed one — may have changed the machine (added
142
+ # an apt repo, dropped a binary); the next tool's probes must re-read it.
143
+ generic.forget_probes()
132
144
 
133
145
  # A freshly installed tool with a setup wizard is the moment to mention it.
134
146
  from dev_setup.commands.configure_cmd import offer_after_install
@@ -196,6 +208,8 @@ def _install_interactive(*, yes: bool) -> None:
196
208
  suffix, disabled_override = (
197
209
  managers.picker_hint(note, t) if note is not None else ("", None)
198
210
  )
211
+ if not is_inst:
212
+ suffix += " · sudo" if generic.needs_sudo(t) else " · user"
199
213
  desc = t.description
200
214
  room = max(10, desc_width - len(suffix))
201
215
  if len(desc) > room:
@@ -4,7 +4,7 @@ from concurrent.futures import ThreadPoolExecutor
4
4
 
5
5
  import click
6
6
 
7
- from dev_setup import managers, registry, ui
7
+ from dev_setup import generic, managers, registry, ui
8
8
  from dev_setup.base import Tool
9
9
 
10
10
  _MAX_WORKERS = 8
@@ -75,7 +75,11 @@ def list_cmd(show_filter: str, category: str) -> None:
75
75
  line = managers.list_line(note, tool)
76
76
  if line:
77
77
  desc += f"\n{line}"
78
- tbl.add_row(icon, tool.key, desc, tool.install_type, version)
78
+ sudo_tag = "sudo" if generic.needs_sudo(tool) else "user"
79
+ tbl.add_row(
80
+ icon, tool.key, desc,
81
+ f"{tool.install_type} [{ui.GRAY}]· {sudo_tag}[/]", version,
82
+ )
79
83
 
80
84
  ui.console.print(tbl)
81
85
  ui.console.print()
@@ -7,7 +7,7 @@ import click
7
7
  import questionary
8
8
  from rich.markup import escape
9
9
 
10
- from dev_setup import registry, ui
10
+ from dev_setup import generic, registry, ui
11
11
  from dev_setup.base import Tool
12
12
  from dev_setup.commands._plan import plan_for, plan_summary
13
13
 
@@ -87,7 +87,10 @@ def _remove_one(
87
87
  return "ok", "removed"
88
88
  except Exception as exc:
89
89
  ui.error(f"Failed to remove {tool.name}: {escape(str(exc))}")
90
+ ui.dim(f" full output: {generic.run_log_path()}")
90
91
  return "fail", str(exc).splitlines()[-1][:120]
92
+ finally:
93
+ generic.forget_probes()
91
94
 
92
95
 
93
96
  def _confirm_plan(tool: Tool) -> bool:
@@ -127,9 +130,10 @@ def _remove_interactive(*, yes: bool) -> None:
127
130
  for t in sorted(installed, key=lambda t: t.key):
128
131
  deps = registry.dependents(t.key)
129
132
  annotation = f" ⚠ required by: {', '.join(deps)}" if deps else ""
133
+ sudo_tag = " · sudo" if generic.needs_sudo(t, "remove") else " · user"
130
134
  # Plain-string title: a token list would render verbatim and never pick
131
135
  # up the `highlighted` style, leaving the cursor invisible.
132
- title = f"{t.key:<{key_width}}{t.description}{annotation}"
136
+ title = f"{t.key:<{key_width}}{t.description}{annotation}{sudo_tag}"
133
137
  choices.append(questionary.Choice(title=title, value=t.key, checked=False))
134
138
 
135
139
  selected = ui.checkbox(
@@ -6,7 +6,7 @@ import click
6
6
  import questionary
7
7
  from rich.markup import escape
8
8
 
9
- from dev_setup import registry, ui
9
+ from dev_setup import generic, registry, ui
10
10
  from dev_setup.base import Tool
11
11
  from dev_setup.commands._plan import plan_for, plan_summary
12
12
  from dev_setup.updates import collect_candidates
@@ -113,7 +113,10 @@ def _update_one(
113
113
  return "ok", "updated"
114
114
  except Exception as exc:
115
115
  ui.error(f"Failed to update {tool.name}: {escape(str(exc))}")
116
+ ui.dim(f" full output: {generic.run_log_path()}")
116
117
  return "fail", str(exc).splitlines()[-1][:120]
118
+ finally:
119
+ generic.forget_probes()
117
120
 
118
121
 
119
122
  def _confirm_plan(tool: Tool, version: str | None) -> bool:
@@ -5,11 +5,15 @@ import functools
5
5
  import hashlib
6
6
  import os
7
7
  import re
8
+ import select
8
9
  import shlex
9
10
  import shutil
10
11
  import subprocess
12
+ import sys
11
13
  import threading
12
- from collections.abc import Callable
14
+ import time
15
+ from collections.abc import Callable, Generator
16
+ from contextlib import contextmanager
13
17
  from dataclasses import dataclass, fields
14
18
  from pathlib import Path
15
19
  from typing import NamedTuple, TypeVar
@@ -49,13 +53,53 @@ class UpdateStatus:
49
53
  note: str = ""
50
54
 
51
55
 
56
+ def run_log_path() -> Path:
57
+ """The append-only log of state-changing subprocess output."""
58
+ state = os.environ.get("XDG_STATE_HOME") or str(Path.home() / ".local" / "state")
59
+ return Path(state) / "devstuff" / "install.log"
60
+
61
+
62
+ def _open_run_log(cmd: list, cwd: Path | None):
63
+ """Open the run log and write a header for this command. Never raises —
64
+ logging must not be able to break an install."""
65
+ try:
66
+ path = run_log_path()
67
+ path.parent.mkdir(parents=True, exist_ok=True)
68
+ f = path.open("a", encoding="utf-8", errors="replace")
69
+ stamp = time.strftime("%Y-%m-%d %H:%M:%S")
70
+ where = f" (in {cwd})" if cwd else ""
71
+ f.write(f"\n=== {stamp} $ {shlex.join(str(c) for c in cmd)}{where} ===\n")
72
+ f.flush()
73
+ return f
74
+ except OSError:
75
+ return None
76
+
77
+
78
+ def _run_env() -> dict[str, str]:
79
+ """Child env for state-changing commands. `DEBIAN_FRONTEND=noninteractive`
80
+ keeps debconf frontends — a dpkg conffile question, needrestart — from
81
+ opening a prompt on the tty mid-install, which nothing could see under the
82
+ live view and which reads as a hang."""
83
+ return {**os.environ, "DEBIAN_FRONTEND": "noninteractive"}
84
+
85
+
86
+ # Poll cadence for the piped read, and the drain window after the main process
87
+ # exits. A detached grandchild that inherits stdout (a `foo &` or a daemonized
88
+ # installer) would otherwise hold EOF — and the read — open forever after the
89
+ # script itself has exited. The window is fixed, not idle-reset: a daemon that
90
+ # keeps writing must not keep the install running either.
91
+ _PIPE_POLL_S = 0.2
92
+ _ORPHAN_PIPE_GRACE_S = 2.0
93
+
94
+
52
95
  def _run(cmd: list, *, cwd: Path | None = None) -> None:
53
96
  """Run a state-changing command (install/remove/update). Raises RuntimeError on failure.
54
97
 
55
98
  Three output modes: streams raw when verbose; feeds the live tail of the
56
99
  active task view when there is one; otherwise captures — discarded on success
57
100
  and surfaced as the exception message on failure, which is the only reason
58
- quiet mode can say anything useful about what went wrong.
101
+ quiet mode can say anything useful about what went wrong. All modes write
102
+ the captured output to `run_log_path()`.
59
103
  """
60
104
  from dev_setup import ui
61
105
 
@@ -68,8 +112,11 @@ def _run(cmd: list, *, cwd: Path | None = None) -> None:
68
112
  cwd=cwd,
69
113
  stdout=subprocess.PIPE,
70
114
  stderr=subprocess.STDOUT,
71
- # stdin stays inherited — sudo-style password prompts inside
72
- # installers open /dev/tty directly, so they still work.
115
+ env=_run_env(),
116
+ # stdin stays inherited: a `read`-style prompt inside an
117
+ # installer shows in the tail (a partial line) and can be
118
+ # answered on the terminal. sudo never reaches here prompting —
119
+ # _sudo_session validates credentials before the view opens.
73
120
  )
74
121
  except OSError as e:
75
122
  raise RuntimeError(str(e)) from e
@@ -80,33 +127,208 @@ def _run(cmd: list, *, cwd: Path | None = None) -> None:
80
127
  # the terminal looks hung. \r counts as a display boundary too, and
81
128
  # the trailing partial line is pushed to the tail so the prompt is
82
129
  # visible while the process is still waiting.
130
+ #
131
+ # The read is select()-polled so EOF is not required for exit: once the
132
+ # main process is dead the pipe gets a short drain window, then remaining
133
+ # writers are detached grandchildren we must not wait on — whether the
134
+ # pipe is quiet or a daemon is still streaming into it.
83
135
  decoder = codecs.getincrementaldecoder("utf-8")(errors="replace")
84
136
  buf = ""
85
- while chunk := proc.stdout.read1(4096):
86
- buf += decoder.decode(chunk)
87
- *done, buf = re.split(r"\r\n|\r|\n", buf)
88
- for line in done:
89
- view.feed(line)
137
+ log = _open_run_log(cmd, cwd)
138
+ try:
139
+ drain_until: float | None = None
140
+ while True:
141
+ ready = select.select([proc.stdout], [], [], _PIPE_POLL_S)[0]
142
+ if proc.poll() is not None:
143
+ # Main process dead — the drain deadline is checked every
144
+ # pass, not only on a quiet pipe, so a detached writer that
145
+ # keeps select() ready still can't hold the loop open.
146
+ if drain_until is None:
147
+ drain_until = time.monotonic() + _ORPHAN_PIPE_GRACE_S
148
+ elif time.monotonic() > drain_until:
149
+ break
150
+ if not ready:
151
+ continue
152
+ chunk = proc.stdout.read1(65536)
153
+ if not chunk:
154
+ break # EOF — every writer closed the pipe
155
+ text = decoder.decode(chunk)
156
+ if log is not None:
157
+ try:
158
+ log.write(text)
159
+ log.flush()
160
+ except OSError:
161
+ # logging must never break the install
162
+ try:
163
+ log.close()
164
+ except OSError:
165
+ pass
166
+ log = None
167
+ buf += text
168
+ *done, buf = re.split(r"\r\n|\r|\n", buf)
169
+ for line in done:
170
+ view.feed(line)
171
+ if buf:
172
+ view.feed(buf, partial=True)
90
173
  if buf:
91
- view.feed(buf, partial=True)
92
- if buf:
93
- view.feed(buf)
94
- rc = proc.wait()
174
+ view.feed(buf)
175
+ rc = proc.wait()
176
+ except BaseException:
177
+ # Ctrl+C or a render error must not leave the installer running
178
+ # detached with a pipe nobody reads.
179
+ proc.kill()
180
+ proc.wait()
181
+ raise
182
+ finally:
183
+ if log is not None:
184
+ try:
185
+ log.close()
186
+ except OSError:
187
+ pass
95
188
  if rc != 0:
96
189
  raise RuntimeError(view.error_output() or f"exit code {rc}")
97
190
  elif verbose.enabled():
98
191
  try:
99
- subprocess.run(cmd, check=True, cwd=cwd)
192
+ subprocess.run(cmd, check=True, cwd=cwd, env=_run_env())
100
193
  except subprocess.CalledProcessError as e:
101
194
  # The output already streamed past; repeating the whole argv in the error
102
195
  # adds nothing the user can't see directly above it.
103
196
  raise RuntimeError(f"exit code {e.returncode}") from e
104
197
  else:
198
+ log = _open_run_log(cmd, cwd)
105
199
  try:
106
- subprocess.run(cmd, check=True, capture_output=True, text=True, cwd=cwd)
200
+ done = subprocess.run(
201
+ cmd,
202
+ check=True,
203
+ capture_output=True,
204
+ text=True,
205
+ cwd=cwd,
206
+ # No view means no way to surface a prompt — a child that
207
+ # reads stdin gets EOF and fails fast instead of hanging.
208
+ stdin=subprocess.DEVNULL,
209
+ env=_run_env(),
210
+ )
211
+ if log is not None:
212
+ try:
213
+ log.write(done.stdout or "")
214
+ log.write(done.stderr or "")
215
+ except OSError:
216
+ pass
107
217
  except subprocess.CalledProcessError as e:
218
+ if log is not None:
219
+ try:
220
+ log.write(e.stdout or "")
221
+ log.write(e.stderr or "")
222
+ except OSError:
223
+ pass
108
224
  msg = e.stderr.strip() if e.stderr else f"exit code {e.returncode}"
109
225
  raise RuntimeError(msg) from e
226
+ finally:
227
+ if log is not None:
228
+ try:
229
+ log.close()
230
+ except OSError:
231
+ pass
232
+
233
+
234
+ # How long a single sudo timestamp is kept alive between refreshes. Well under
235
+ # sudo's default 15-minute timestamp_timeout so a long `sudo sh installer.sh`
236
+ # can't expire it before the script's next sudo call.
237
+ _SUDO_KEEPALIVE_S = 60.0
238
+
239
+
240
+ def _may_need_sudo(tool: GenericTool, action: str) -> bool:
241
+ """Best-effort: will this action reach sudo? The same guess `profile apply`'s
242
+ plan warning makes — apt always does, script bodies are grepped. A `script`
243
+ tool's install/update body isn't known until after the download — inside
244
+ the view, too late — so it's assumed to elevate; its remove runs the
245
+ greppable `remove_script` like everyone else's."""
246
+ if tool.install_type == "apt":
247
+ return True
248
+ if tool.install_type == "script" and action != "remove":
249
+ return True
250
+ # getattr: needs_sudo is Tool-typed for callers; non-script Tool
251
+ # implementations have no script fields to grep.
252
+ scripts = {
253
+ "install": (
254
+ getattr(tool, "install_script", ""),
255
+ getattr(tool, "git_install_cmd", ""),
256
+ ),
257
+ "remove": (
258
+ getattr(tool, "remove_script", ""),
259
+ getattr(tool, "git_remove_cmd", ""),
260
+ ),
261
+ # update for script/bash is a reinstall of the install path
262
+ "update": (
263
+ getattr(tool, "install_script", ""),
264
+ getattr(tool, "git_install_cmd", ""),
265
+ ),
266
+ }.get(action, ())
267
+ return any("sudo" in s for s in scripts if s)
268
+
269
+
270
+ def needs_sudo(tool: Tool, action: str = "install") -> bool:
271
+ """Public read of _may_need_sudo for UI tags (`list`, the install picker).
272
+
273
+ Same best-effort guess: it tags what installing *would* do, so a bash tool
274
+ whose script greps clean reads "user" even on a host that has sudo."""
275
+ return _may_need_sudo(tool, action)
276
+
277
+
278
+ @contextmanager
279
+ def _sudo_session(tool: GenericTool, action: str) -> Generator[None, None, None]:
280
+ """Cache sudo credentials before the live task view owns the terminal, then
281
+ keep the timestamp fresh for the run.
282
+
283
+ sudo writes its password prompt to /dev/tty, not the subprocess pipe — under
284
+ the live view the prompt is invisible and overwritten by repaints, so a
285
+ mid-install sudo reads exactly like a hang. Validating first moves the one
286
+ prompt to the plain terminal where it can be answered; the keepalive thread
287
+ stops the timestamp expiring during a long install. Passwordless or
288
+ already-cached sudo needs no prompt at all.
289
+ """
290
+ if not _may_need_sudo(tool, action) or not shutil.which("sudo"):
291
+ yield
292
+ return
293
+ cached = (
294
+ subprocess.run(["sudo", "-n", "-v"], capture_output=True).returncode == 0
295
+ )
296
+ if not cached:
297
+ if not sys.stdin.isatty():
298
+ # Nowhere to ask — a child sudo either is passwordless (already
299
+ # answered above) or fails fast with "a password is required".
300
+ yield
301
+ return
302
+ # stderr, not ui.dim on the stdout console: `profile apply --json` can
303
+ # reach this with stdout piped, and a chatter line there breaks the
304
+ # data contract. The sudo prompt itself is on /dev/tty either way.
305
+ from rich.console import Console
306
+ err = Console(stderr=True, highlight=False)
307
+ err.print(
308
+ f" {tool.name} needs sudo — the password prompt comes before "
309
+ "the progress view:",
310
+ style="dim",
311
+ )
312
+ if subprocess.run(["sudo", "-v"]).returncode != 0:
313
+ err.print(
314
+ " sudo credentials not cached — if the installer asks, the "
315
+ "prompt appears directly on the terminal.",
316
+ style="bold yellow",
317
+ )
318
+ yield
319
+ return
320
+ stop = threading.Event()
321
+
322
+ def _keepalive() -> None:
323
+ while not stop.wait(_SUDO_KEEPALIVE_S):
324
+ subprocess.run(["sudo", "-n", "-v"], capture_output=True)
325
+
326
+ ticker = threading.Thread(target=_keepalive, daemon=True, name="sudo-keepalive")
327
+ ticker.start()
328
+ try:
329
+ yield
330
+ finally:
331
+ stop.set()
110
332
 
111
333
 
112
334
  def _probe(cmd: list, *, log_at: int = verbose.TRACE, **kwargs) -> subprocess.CompletedProcess:
@@ -226,7 +448,7 @@ class GenericTool(Tool):
226
448
  if installer is None:
227
449
  raise RuntimeError(f"Unsupported install type: {self.install_type!r}")
228
450
  from dev_setup import ui
229
- with ui.task_view(
451
+ with _sudo_session(self, "install"), ui.task_view(
230
452
  f"Installing {self.name}", total=len(self.plan_items("install")) + 1
231
453
  ):
232
454
  installer(self)
@@ -239,7 +461,9 @@ class GenericTool(Tool):
239
461
  if remover is None:
240
462
  raise RuntimeError(f"Unsupported remove type: {self.install_type!r}")
241
463
  from dev_setup import ui
242
- with ui.task_view(f"Removing {self.name}", total=len(self.plan_items("remove"))):
464
+ with _sudo_session(self, "remove"), ui.task_view(
465
+ f"Removing {self.name}", total=len(self.plan_items("remove"))
466
+ ):
243
467
  remover(self)
244
468
 
245
469
  def update(self, version: str | None = None) -> str | None:
@@ -248,7 +472,7 @@ class GenericTool(Tool):
248
472
  if updater is None:
249
473
  raise RuntimeError(f"Unsupported update type: {self.install_type!r}")
250
474
  from dev_setup import ui
251
- with ui.task_view(
475
+ with _sudo_session(self, "update"), ui.task_view(
252
476
  f"Updating {self.name}", total=len(self.plan_items("update", version)) + 1
253
477
  ):
254
478
  updater(self, version)
@@ -272,8 +496,24 @@ class GenericTool(Tool):
272
496
  self.check_cmd if _is_simple_command(self.check_cmd or "") else ""
273
497
  ) or _type_cmd(self)
274
498
 
499
+ # A version_cmd with arguments is the whole probe, run verbatim
500
+ # (`version_cmd: /usr/local/go/bin/go version` — go's version printer
501
+ # is a subcommand).
502
+ if cmd and not _is_simple_command(cmd):
503
+ try:
504
+ r = _probe(shlex.split(cmd), capture_output=True, text=True, timeout=5)
505
+ if r.returncode == 0 and r.stdout.strip():
506
+ return r.stdout.strip().splitlines()[0]
507
+ except Exception:
508
+ pass
509
+ return "installed"
510
+
275
511
  if cmd and shutil.which(cmd):
276
- for flag in ["--version", "-v", "version"]:
512
+ # No bare `version` positional here: a binary that treats it as
513
+ # input has side effects — `mkcert version` parses it as a
514
+ # hostname and generates cert files in the CWD. Subcommand-style
515
+ # version printers must use an argumented version_cmd instead.
516
+ for flag in ["--version", "-v"]:
277
517
  try:
278
518
  r = _probe([cmd, flag], capture_output=True, text=True, timeout=5)
279
519
  if r.returncode == 0 and r.stdout.strip():
@@ -565,8 +805,11 @@ def forget_probes() -> None:
565
805
  """Drop every memoised probe, so the next read of the machine is a fresh one.
566
806
 
567
807
  Call it after anything that installs, updates or removes a tool and before reading state
568
- that the change could have affected.
808
+ that the change could have affected. Also drops the apt-lists freshness memo — a script
809
+ may have added a repo, which the next apt install can only see after a real update.
569
810
  """
811
+ global _apt_refreshed_at
812
+ _apt_refreshed_at = 0.0
570
813
  for memo in _MEMOS:
571
814
  memo.cache_clear() # type: ignore[attr-defined]
572
815
 
@@ -1042,23 +1285,49 @@ def _npm_global_installed(pkg: str) -> bool:
1042
1285
  ["bash", "-lc", f"{_npm_init()} && npm list -g --depth=0 {shlex.quote(pkg)}"],
1043
1286
  capture_output=True,
1044
1287
  text=True,
1288
+ timeout=30,
1045
1289
  )
1046
1290
  return pkg in r.stdout
1047
1291
  except Exception:
1048
1292
  return False
1049
1293
 
1050
1294
 
1295
+ # Last successful `apt-get update` this process. Batch installs used to refresh
1296
+ # the lists once per apt tool — N packages cost N updates at 5-30s each. Lists
1297
+ # younger than this are fresh enough for anything the same command run installs.
1298
+ _APT_REFRESH_MIN_S = 600.0
1299
+ _apt_refreshed_at: float = 0.0
1300
+
1301
+
1051
1302
  def _run_apt_update() -> None:
1052
1303
  """Refresh apt's package lists. Deliberately non-fatal: a failing mirror shouldn't
1053
- stop an install of a package that may already be cached."""
1304
+ stop an install of a package that may already be cached. Skipped if the lists
1305
+ were refreshed within this process in the last few minutes."""
1306
+ global _apt_refreshed_at
1054
1307
  from dev_setup import ui
1308
+ if time.monotonic() - _apt_refreshed_at < _APT_REFRESH_MIN_S:
1309
+ verbose.log("apt-get update skipped — lists refreshed moments ago")
1310
+ view = ui.current_view()
1311
+ if view is not None:
1312
+ view.feed("package lists already fresh — skipping update")
1313
+ return
1055
1314
  if ui.current_view() is not None:
1056
1315
  try:
1057
1316
  _run(["sudo", "apt-get", "update", "-q"])
1317
+ _apt_refreshed_at = time.monotonic()
1058
1318
  except RuntimeError:
1059
1319
  pass
1060
1320
  else:
1061
- _probe(["sudo", "apt-get", "update", "-q"], log_at=verbose.VERBOSE)
1321
+ try:
1322
+ r = _probe(
1323
+ ["sudo", "apt-get", "update", "-q"],
1324
+ log_at=verbose.VERBOSE,
1325
+ timeout=180,
1326
+ )
1327
+ if r.returncode == 0:
1328
+ _apt_refreshed_at = time.monotonic()
1329
+ except Exception:
1330
+ pass
1062
1331
 
1063
1332
 
1064
1333
  def _npm_init() -> str:
@@ -1131,7 +1400,9 @@ def _is_simple_command(cmd: str) -> bool:
1131
1400
 
1132
1401
 
1133
1402
  def _bash_version(key: str) -> str:
1134
- for flag in ["--version", "-v", "version"]:
1403
+ # See get_version: no bare `version` positional — `mkcert version` would
1404
+ # generate cert files.
1405
+ for flag in ["--version", "-v"]:
1135
1406
  try:
1136
1407
  r = _probe(
1137
1408
  [
@@ -1148,6 +1419,10 @@ def _bash_version(key: str) -> str:
1148
1419
 
1149
1420
 
1150
1421
  def _check_cmd_installed(cmd: str, *, install_type: str = "") -> bool:
1422
+ # `bash -lc` sources ~/.profile — an interactive command there (ssh-add,
1423
+ # keychain, read) would hang the CLI with no output and no task view yet.
1424
+ # The timeout bounds that at 15s; a `command -v` never legitimately takes
1425
+ # that long, and a timeout reads as "not installed", not a crash.
1151
1426
  if _is_simple_command(cmd):
1152
1427
  if shutil.which(cmd) is not None:
1153
1428
  return True
@@ -1157,6 +1432,7 @@ def _check_cmd_installed(cmd: str, *, install_type: str = "") -> bool:
1157
1432
  return _probe(
1158
1433
  ["bash", "-lc", f"{prefix}command -v {cmd} >/dev/null 2>&1"],
1159
1434
  capture_output=True,
1435
+ timeout=15,
1160
1436
  ).returncode == 0
1161
1437
  except Exception:
1162
1438
  return False
@@ -1167,6 +1443,8 @@ def _check_cmd_installed(cmd: str, *, install_type: str = "") -> bool:
1167
1443
  # immediately after installing successfully.
1168
1444
  prefix = f"{_npm_init()} && " if install_type == "npm" else ""
1169
1445
  try:
1170
- return _probe(["bash", "-lc", f"{prefix}{cmd}"], capture_output=True).returncode == 0
1446
+ return _probe(
1447
+ ["bash", "-lc", f"{prefix}{cmd}"], capture_output=True, timeout=15
1448
+ ).returncode == 0
1171
1449
  except Exception:
1172
1450
  return False