lemming-cli 0.8.2__tar.gz → 0.9.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (195) hide show
  1. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/PKG-INFO +25 -9
  2. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/README.md +24 -8
  3. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/SKILL.md +19 -5
  4. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/docs/HOOKS.md +11 -4
  5. lemming_cli-0.9.1/docs/WORKSPACE.md +145 -0
  6. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/pyproject.toml +1 -1
  7. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/api/tasks.py +89 -2
  8. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/api/tasks_test.py +120 -2
  9. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/cli/exec_cli.py +1 -1
  10. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/cli/exec_cli_test.py +15 -3
  11. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/cli/tasks.py +146 -34
  12. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/cli/tasks_test.py +130 -1
  13. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/models.py +6 -0
  14. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/orchestrator.py +516 -18
  15. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/orchestrator_test.py +1029 -6
  16. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/prompts/hooks/90-roadmap.md +6 -4
  17. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/prompts/taskrunner.md +13 -13
  18. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/prompts.py +12 -1
  19. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/prompts_test.py +50 -1
  20. lemming_cli-0.9.1/src/lemming/snapshots.py +501 -0
  21. lemming_cli-0.9.1/src/lemming/snapshots_test.py +512 -0
  22. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/tasks/lifecycle.py +118 -24
  23. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/tasks/lifecycle_test.py +182 -2
  24. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/tasks/operations.py +239 -2
  25. lemming_cli-0.9.1/src/lemming/tasks/operations_test.py +1076 -0
  26. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/uv.lock +1 -1
  27. lemming_cli-0.8.2/docs/WORKSPACE.md +0 -120
  28. lemming_cli-0.8.2/src/lemming/tasks/operations_test.py +0 -443
  29. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/.dockerignore +0 -0
  30. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/.github/workflows/ci.yml +0 -0
  31. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/.github/workflows/publish.yml +0 -0
  32. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/.github/workflows/screenshots.yml +0 -0
  33. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/.gitignore +0 -0
  34. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/.prettierignore +0 -0
  35. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/.prettierrc +0 -0
  36. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/Dockerfile +0 -0
  37. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/LICENSE +0 -0
  38. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/biome.json +0 -0
  39. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/docker-compose.yml +0 -0
  40. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/docs/EVALS.md +0 -0
  41. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/docs/screenshots/dashboard-desktop.png +0 -0
  42. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/docs/screenshots/dashboard-mobile.png +0 -0
  43. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/docs/screenshots/task-log-desktop.png +0 -0
  44. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/docs/screenshots/task-log-mobile.png +0 -0
  45. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/package-lock.json +0 -0
  46. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/package.json +0 -0
  47. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/playwright.config.js +0 -0
  48. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/__init__.py +0 -0
  49. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/api/__init__.py +0 -0
  50. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/api/auth.py +0 -0
  51. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/api/auth_test.py +0 -0
  52. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/api/config.py +0 -0
  53. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/api/config_test.py +0 -0
  54. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/api/conftest.py +0 -0
  55. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/api/context.py +0 -0
  56. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/api/context_test.py +0 -0
  57. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/api/directories.py +0 -0
  58. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/api/directories_test.py +0 -0
  59. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/api/files.py +0 -0
  60. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/api/files_test.py +0 -0
  61. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/api/hooks.py +0 -0
  62. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/api/hooks_test.py +0 -0
  63. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/api/logging.py +0 -0
  64. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/api/logging_test.py +0 -0
  65. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/api/loop.py +0 -0
  66. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/api/loop_test.py +0 -0
  67. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/api/main.py +0 -0
  68. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/api/main_test.py +0 -0
  69. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/artifact_test.py +0 -0
  70. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/brief_test.py +0 -0
  71. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/cli/__init__.py +0 -0
  72. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/cli/artifact.py +0 -0
  73. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/cli/brief.py +0 -0
  74. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/cli/config.py +0 -0
  75. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/cli/config_test.py +0 -0
  76. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/cli/goal.py +0 -0
  77. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/cli/goal_test.py +0 -0
  78. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/cli/hooks.py +0 -0
  79. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/cli/hooks_test.py +0 -0
  80. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/cli/machine_output_test.py +0 -0
  81. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/cli/main.py +0 -0
  82. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/cli/main_test.py +0 -0
  83. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/cli/operations.py +0 -0
  84. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/cli/operations_test.py +0 -0
  85. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/cli/progress.py +0 -0
  86. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/cli/progress_test.py +0 -0
  87. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/cli/readability_cli.py +0 -0
  88. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/cli/readability_cli_test.py +0 -0
  89. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/cli/skill.py +0 -0
  90. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/cli/skill_test.py +0 -0
  91. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/cli/stop_test.py +0 -0
  92. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/conftest.py +0 -0
  93. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/evals/__init__.py +0 -0
  94. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/evals/__main__.py +0 -0
  95. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/evals/cli.py +0 -0
  96. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/evals/cli_test.py +0 -0
  97. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/evals/container.py +0 -0
  98. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/evals/container_test.py +0 -0
  99. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/evals/fixtures.py +0 -0
  100. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/evals/fixtures_test.py +0 -0
  101. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/evals/harness.py +0 -0
  102. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/evals/harness_test.py +0 -0
  103. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/evals/metrics.py +0 -0
  104. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/evals/metrics_test.py +0 -0
  105. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/evals/projects/readability/base/README.md +0 -0
  106. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/evals/projects/readability/base/calc/__init__.py +0 -0
  107. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/evals/projects/readability/base/calc/legacy.py +0 -0
  108. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/evals/projects/readability/base/calc/ops.py +0 -0
  109. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/evals/projects/readability/base/calc/ops_test.py +0 -0
  110. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/evals/projects/readability/clean/calc/ops.py +0 -0
  111. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/evals/projects/readability/clean/calc/ops_test.py +0 -0
  112. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/evals/projects/readability/dead-code/calc/ops.py +0 -0
  113. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/evals/projects/readability/dead-code/calc/ops_test.py +0 -0
  114. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/evals/projects/readability/duplicated-behavior/calc/ops.py +0 -0
  115. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/evals/projects/readability/duplicated-behavior/calc/ops_test.py +0 -0
  116. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/evals/projects/readability/false-reuse/calc/limits.py +0 -0
  117. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/evals/projects/readability/false-reuse/calc/limits_test.py +0 -0
  118. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/evals/projects/readability/lint-debt/calc/ops.py +0 -0
  119. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/evals/projects/readability/lint-debt/calc/ops_test.py +0 -0
  120. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/evals/projects/roadmap/add-only/README.md +0 -0
  121. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/evals/projects/roadmap/add-only/calc/__init__.py +0 -0
  122. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/evals/projects/roadmap/add-only/calc/ops.py +0 -0
  123. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/evals/projects/roadmap/add-only/calc/ops_test.py +0 -0
  124. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/evals/projects/roadmap/buggy-subtract/README.md +0 -0
  125. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/evals/projects/roadmap/buggy-subtract/calc/__init__.py +0 -0
  126. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/evals/projects/roadmap/buggy-subtract/calc/ops.py +0 -0
  127. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/evals/projects/roadmap/buggy-subtract/calc/ops_test.py +0 -0
  128. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/evals/projects/roadmap/full-ops/README.md +0 -0
  129. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/evals/projects/roadmap/full-ops/calc/__init__.py +0 -0
  130. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/evals/projects/roadmap/full-ops/calc/ops.py +0 -0
  131. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/evals/projects/roadmap/full-ops/calc/ops_test.py +0 -0
  132. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/evals/projects/roadmap/unwired-cli/README.md +0 -0
  133. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/evals/projects/roadmap/unwired-cli/calc/__init__.py +0 -0
  134. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/evals/projects/roadmap/unwired-cli/calc/cli.py +0 -0
  135. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/evals/projects/roadmap/unwired-cli/calc/cli_test.py +0 -0
  136. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/evals/projects/roadmap/unwired-cli/calc/ops.py +0 -0
  137. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/evals/projects/roadmap/unwired-cli/calc/ops_test.py +0 -0
  138. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/evals/projects/task/hidden/stats/summary_hidden_test.py +0 -0
  139. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/evals/projects/task/summary/README.md +0 -0
  140. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/evals/projects/task/summary/stats/__init__.py +0 -0
  141. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/evals/projects/task/summary/stats/summary.py +0 -0
  142. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/evals/projects/task/summary/stats/summary_test.py +0 -0
  143. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/evals/readability.py +0 -0
  144. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/evals/readability_test.py +0 -0
  145. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/evals/report.py +0 -0
  146. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/evals/report_test.py +0 -0
  147. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/evals/roadmap.py +0 -0
  148. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/evals/roadmap_test.py +0 -0
  149. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/evals/scenarios.py +0 -0
  150. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/evals/scenarios_test.py +0 -0
  151. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/evals/suites.py +0 -0
  152. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/evals/task.py +0 -0
  153. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/evals/task_test.py +0 -0
  154. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/evals/trial.py +0 -0
  155. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/evals/trial_test.py +0 -0
  156. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/hooks.py +0 -0
  157. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/hooks_test.py +0 -0
  158. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/integration_test.py +0 -0
  159. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/main.py +0 -0
  160. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/main_test.py +0 -0
  161. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/models_test.py +0 -0
  162. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/paths.py +0 -0
  163. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/paths_test.py +0 -0
  164. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/persistence.py +0 -0
  165. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/persistence_test.py +0 -0
  166. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/prompts/hooks/50-readability.md +0 -0
  167. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/prompts/hooks/60-testing.md +0 -0
  168. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/prompts/hooks/70-ux.md +0 -0
  169. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/providers.py +0 -0
  170. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/providers_test.py +0 -0
  171. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/runner.py +0 -0
  172. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/runner_test.py +0 -0
  173. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/scope.py +0 -0
  174. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/scope_test.py +0 -0
  175. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/shutdown.py +0 -0
  176. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/shutdown_integration_test.py +0 -0
  177. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/shutdown_test.py +0 -0
  178. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/tasks/__init__.py +0 -0
  179. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/tasks/limits.py +0 -0
  180. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/tasks/progress.py +0 -0
  181. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/tasks/progress_test.py +0 -0
  182. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/tasks/queries.py +0 -0
  183. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/tasks/queries_test.py +0 -0
  184. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/web/dashboard.spec.js +0 -0
  185. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/web/dashboard.test.js +0 -0
  186. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/web/favicon.js +0 -0
  187. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/web/favicon.spec.js +0 -0
  188. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/web/files.html +0 -0
  189. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/web/files.spec.js +0 -0
  190. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/web/index.html +0 -0
  191. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/web/index.js +0 -0
  192. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/web/logs.html +0 -0
  193. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/web/logs.test.js +0 -0
  194. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/web/mancha.js +0 -0
  195. {lemming_cli-0.8.2 → lemming_cli-0.9.1}/src/lemming/web/screenshots.spec.js +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: lemming-cli
3
- Version: 0.8.2
3
+ Version: 0.9.1
4
4
  Summary: An autonomous, iterative task runner for AI coding agents.
5
5
  Project-URL: Homepage, https://github.com/owahltinez/lemming
6
6
  Project-URL: Repository, https://github.com/owahltinez/lemming
@@ -99,10 +99,10 @@ lemming run
99
99
  lemming run -- --model claude-3-5-sonnet
100
100
  ```
101
101
 
102
- The loop runs every task in one shared workspace, and the orchestrator never
103
- branches or commits on your behalf. Give the whole run its own branch or
104
- worktree first if you want to be able to throw it away — see
105
- [docs/WORKSPACE.md](docs/WORKSPACE.md).
102
+ The loop runs every task in one shared workspace, snapshotting the working tree
103
+ in an isolated shadow Git repository before and after each task and hook without
104
+ touching your `.git` history. Give the whole run its own branch or worktree
105
+ first when working in parallel — see [docs/WORKSPACE.md](docs/WORKSPACE.md).
106
106
 
107
107
  ---
108
108
 
@@ -249,9 +249,11 @@ loops through each pending task:
249
249
  `lemming complete` or `lemming fail`. Agents can also schedule new tasks
250
250
  with `lemming add`, breaking down complex work into smaller steps that
251
251
  Lemming will pick up automatically.
252
- 4. **Retry or advance**: On failure, Lemming retries the task up to the
253
- configured roadmap limit, with accumulated progress as context so the agent
254
- learns from previous attempts. On success, it moves to the next task.
252
+ 4. **Retry or advance**: On failure, timeout, or cancellation, Lemming saves
253
+ the discarded workspace diff as an `attempt-<N>.patch` artifact, restores
254
+ the working tree to the task's pre-run snapshot, and retries up to the
255
+ configured limit with accumulated progress as context. On success, it moves
256
+ to the next task.
255
257
  5. **Orchestration**: After each task, Lemming can run one or more
256
258
  **Orchestrator Hooks** (like the built-in `roadmap` hook) to evaluate the
257
259
  results and adapt the roadmap if needed. Hooks are enabled by default but
@@ -434,8 +436,22 @@ These come before the subcommand and apply to all of them.
434
436
 
435
437
  - **`complete <id>`**: Mark a task as successful.
436
438
  - **`fail <id>`**: Mark a task as a terminal failure (will not be retried).
437
- - **`cancel <id>`**: Stop an in-progress task (kills the runner process).
439
+ - **`reject <id> <reason>`**: Reject a finalizing task's completion from a
440
+ review hook, sending it back for a retry.
441
+ - **`cancel <id>`**: Stop an in-progress task (kills the runner process and
442
+ restores its pre-run workspace snapshot).
438
443
  - **`reset <id>`**: Clear attempts and progress to start a task fresh.
444
+ - **`diff [<id>]`**: Print the workspace diff captured for a task (defaults to
445
+ the active or most recent snapshotted task).
446
+ - `--stat`: Show diffstat summary instead of the full patch.
447
+ - `--hook <name>`: Show only the diff introduced by a specific post-run hook.
448
+ - **`rollback <id>`**: Revert a completed task's workspace changes and reset
449
+ `<id>` and subsequent tasks to pending (requires an idle loop and a clean
450
+ workspace).
451
+ - `--only`: Revert only `<id>`'s patch in place (3-way reverse apply) and
452
+ reset only `<id>`.
453
+ - `--hook <name>`: Revert only the changes made by a specific post-run hook,
454
+ keeping the task completed.
439
455
  - Superseded tasks remain visible as non-failing history; replacement tasks link
440
456
  back through their parent task ID.
441
457
  - **`logs [<id>]`**: Print a task's execution log to stdout, including retained
@@ -79,10 +79,10 @@ lemming run
79
79
  lemming run -- --model claude-3-5-sonnet
80
80
  ```
81
81
 
82
- The loop runs every task in one shared workspace, and the orchestrator never
83
- branches or commits on your behalf. Give the whole run its own branch or
84
- worktree first if you want to be able to throw it away — see
85
- [docs/WORKSPACE.md](docs/WORKSPACE.md).
82
+ The loop runs every task in one shared workspace, snapshotting the working tree
83
+ in an isolated shadow Git repository before and after each task and hook without
84
+ touching your `.git` history. Give the whole run its own branch or worktree
85
+ first when working in parallel — see [docs/WORKSPACE.md](docs/WORKSPACE.md).
86
86
 
87
87
  ---
88
88
 
@@ -229,9 +229,11 @@ loops through each pending task:
229
229
  `lemming complete` or `lemming fail`. Agents can also schedule new tasks
230
230
  with `lemming add`, breaking down complex work into smaller steps that
231
231
  Lemming will pick up automatically.
232
- 4. **Retry or advance**: On failure, Lemming retries the task up to the
233
- configured roadmap limit, with accumulated progress as context so the agent
234
- learns from previous attempts. On success, it moves to the next task.
232
+ 4. **Retry or advance**: On failure, timeout, or cancellation, Lemming saves
233
+ the discarded workspace diff as an `attempt-<N>.patch` artifact, restores
234
+ the working tree to the task's pre-run snapshot, and retries up to the
235
+ configured limit with accumulated progress as context. On success, it moves
236
+ to the next task.
235
237
  5. **Orchestration**: After each task, Lemming can run one or more
236
238
  **Orchestrator Hooks** (like the built-in `roadmap` hook) to evaluate the
237
239
  results and adapt the roadmap if needed. Hooks are enabled by default but
@@ -414,8 +416,22 @@ These come before the subcommand and apply to all of them.
414
416
 
415
417
  - **`complete <id>`**: Mark a task as successful.
416
418
  - **`fail <id>`**: Mark a task as a terminal failure (will not be retried).
417
- - **`cancel <id>`**: Stop an in-progress task (kills the runner process).
419
+ - **`reject <id> <reason>`**: Reject a finalizing task's completion from a
420
+ review hook, sending it back for a retry.
421
+ - **`cancel <id>`**: Stop an in-progress task (kills the runner process and
422
+ restores its pre-run workspace snapshot).
418
423
  - **`reset <id>`**: Clear attempts and progress to start a task fresh.
424
+ - **`diff [<id>]`**: Print the workspace diff captured for a task (defaults to
425
+ the active or most recent snapshotted task).
426
+ - `--stat`: Show diffstat summary instead of the full patch.
427
+ - `--hook <name>`: Show only the diff introduced by a specific post-run hook.
428
+ - **`rollback <id>`**: Revert a completed task's workspace changes and reset
429
+ `<id>` and subsequent tasks to pending (requires an idle loop and a clean
430
+ workspace).
431
+ - `--only`: Revert only `<id>`'s patch in place (3-way reverse apply) and
432
+ reset only `<id>`.
433
+ - `--hook <name>`: Revert only the changes made by a specific post-run hook,
434
+ keeping the task completed.
419
435
  - Superseded tasks remain visible as non-failing history; replacement tasks link
420
436
  back through their parent task ID.
421
437
  - **`logs [<id>]`**: Print a task's execution log to stdout, including retained
@@ -161,7 +161,10 @@ lemming run --until <task-id> # or stops once that task settles
161
161
 
162
162
  The loop shares one workspace across all its tasks, so isolate the **whole run**
163
163
  — one branch or worktree created before `lemming run`, driven with
164
- `lemming -C <worktree> run` — never one per task.
164
+ `lemming -C <worktree> run` — never one per task. In a greenfield directory
165
+ without a `.gitignore`, create one (or queue it as the first `--oneshot` task)
166
+ before tasks install dependencies or run builds so workspace snapshots skip
167
+ `node_modules/`, `.venv/`, and build outputs.
165
168
 
166
169
  **Mark mechanical tasks `--oneshot`.** After every other task, a roadmap hook
167
170
  may revise the queue and any enabled reviews run; each hook is a full agent
@@ -185,8 +188,13 @@ milestones instead:
185
188
  which. Add `--max-tasks N` as a budget cap when a runaway roadmap hook
186
189
  would be expensive.
187
190
  2. Between milestones, judge direction: `lemming status --brief`, then
188
- `lemming status <id>` for the tasks that matter. Re-plan with `add`, `edit`,
189
- `supersede`, or `delete`, then run the next milestone.
191
+ `lemming status <id>` for the tasks that matter. Inspect a task's changes
192
+ with `lemming diff [<id>] [--stat] [--hook <name>]`, or undo them with
193
+ `lemming rollback <id>` (rewinds from `<id>` onward),
194
+ `lemming rollback <id> --only` (reverts only `<id>`'s patch), or
195
+ `lemming rollback <id> --hook <name>` (reverts only one hook's edits).
196
+ Re-plan with `add`, `edit`, `supersede`, or `delete`, then run the next
197
+ milestone.
190
198
  3. Delegate each milestone to a subagent when one exists, so the polling and
191
199
  the log reading stay out of your context. The subagent reports back in the
192
200
  fixed shape below, nothing more.
@@ -201,6 +209,7 @@ sparingly and read the smallest thing that answers the question:
201
209
  ```sh
202
210
  lemming status --brief # one row per task, no descriptions
203
211
  lemming status <id> # Run Time against the time limit, progress entries
212
+ lemming diff [<id>] --stat # diffstat for a task (or the full patch without --stat)
204
213
  lemming logs <id> | tail -n 30 # never the whole log
205
214
  ```
206
215
 
@@ -247,8 +256,13 @@ work done adds tasks with `lemming add`; the running loop picks them up.
247
256
  - **`exec` makes one attempt by default.** `--retries N` opts into at most `N`
248
257
  total task attempts with progress carried forward. Explicit failure,
249
258
  cancellation, interruption, and failed reviews stop immediately.
250
- - **Interrupting leaves partial edits.** Nothing is restored, so there is no
251
- atomicity to rely on.
259
+ - **Failed attempts roll back automatically.** Each task snapshots the working
260
+ tree in a shadow Git repository before it starts; if an attempt fails, times
261
+ out, crashes, or is cancelled, its diff is saved under `<id>-artifacts/` and
262
+ the workspace (and host Git `HEAD`) is restored to the task's `pre_tree`.
263
+ Completed tasks (or individual hook edits) can be inspected with
264
+ `lemming diff [<id>] [--stat] [--hook <name>]` or rolled back when the loop
265
+ is idle via `lemming rollback <id> [--only] [--hook <name>]`.
252
266
  - **Concurrent runs in one checkout interleave their edits.** Give each writing
253
267
  run its own VCS-managed working copy and address it with `-C`; retain the copy
254
268
  until its result is recovered.
@@ -95,10 +95,17 @@ lemming --tasks-file <path> reject <taskid> '<reason>'
95
95
  A rejection only applies to a task that is finalizing as completed, and it
96
96
  does not change the task's status on the spot. The remaining hooks still run
97
97
  and see the task as `REJECTED` with the reason, so the roadmap hook can tell
98
- a rejected task from a finished one. Once every hook has run, the task is
99
- reverted to pending with its attempt count intact, exactly as it is when a
100
- hook process fails, and the reason is left in its progress so the next
101
- attempt starts with the diagnosis.
98
+ a rejected task from a finished one. Once every hook has run, Lemming saves the
99
+ rejected attempt's diff as an `attempt-<N>.patch` artifact, restores the
100
+ workspace to the task's `pre_tree`, and reverts the task to pending with its
101
+ attempt count intact — just as it does when a hook process fails. The rejection
102
+ reason stays in `progress` so the next attempt starts with the diagnosis.
103
+
104
+ Each hook that runs is also bracketed by its own shadow Git snapshot pair in
105
+ `hook_trees`. If an individual hook process crashes or exits non-zero, its own
106
+ workspace edits are rolled back before the task attempt is reverted. On a
107
+ completed task, you can inspect or undo a single hook's edits with
108
+ `lemming diff <id> --hook <name>` and `lemming rollback <id> --hook <name>`.
102
109
 
103
110
  Under `lemming exec` there is no second attempt: the run ends on the first
104
111
  rejection, and under `lemming run` a rejection on the task's final attempt
@@ -0,0 +1,145 @@
1
+ # Workspace Isolation 🧰
2
+
3
+ ## Lemming is VCS-Agnostic
4
+
5
+ An agent run writes to a real directory on your disk. The orchestrator never
6
+ creates a branch, a commit, or a worktree in your project's repository: the
7
+ task-runner prompt allows the agent itself to commit when that is the project's
8
+ convention, but the orchestrator neither asks for that nor relies on it.
9
+
10
+ When `git` is installed on the host, Lemming maintains an isolated **shadow Git
11
+ repository** alongside `tasks.yml` that snapshots the working tree before and
12
+ after each task runner and orchestrator hook — without touching your `.git`
13
+ index, branches, or commit history. If an attempt fails, times out, crashes, or
14
+ is cancelled, Lemming saves its changes to an `attempt-<N>.patch` artifact and
15
+ restores the workspace (and host Git `HEAD`, if the runner committed) to the
16
+ task's pre-run snapshot.
17
+
18
+ Shadow snapshots work in a Git checkout, a Mercurial repository, or a plain
19
+ directory under no version control at all, as long as `git` is on `PATH`. Even
20
+ so, concurrent writing runs still need separate working copies, and an outer
21
+ branch or worktree remains the cleanest way to isolate an entire multi-task run
22
+ from work you are doing in parallel.
23
+
24
+ ## Isolating a One-Off `exec` Run
25
+
26
+ Concurrent writing runs must not share a checkout: two agents editing one
27
+ directory interleave their edits, and neither result is reviewable. Give each
28
+ writing run its own working copy and pass it with the global `-C` option
29
+ (`lemming -C <working-copy> -v exec ...`). The full Git worktree recipe is under
30
+ "Isolate concurrent writing runs" in [SKILL.md](../SKILL.md), summarized in the
31
+ [README](../README.md#one-off-tasks-without-a-roadmap).
32
+
33
+ ## Isolating a Roadmap Loop
34
+
35
+ `lemming run` executes its tasks **sequentially in one shared workspace**. Task
36
+ 2 starts in whatever state task 1 left behind — that is the point, since tasks
37
+ build on each other. So the unit of isolation is the whole run: **one branch or
38
+ worktree for the entire loop**, created once before `lemming run`.
39
+
40
+ **Never one branch per task.** Whichever branch the last runner left checked out
41
+ would silently become the next task's baseline, and the loop's history would
42
+ fragment across branches nobody asked for. This is why the task-runner prompt
43
+ says nothing about branching: a runner has no business changing what is checked
44
+ out under it.
45
+
46
+ The minimal Git shape, from a clean tree:
47
+
48
+ ```bash
49
+ repo=$(git rev-parse --show-toplevel) || exit 1
50
+ test -z "$(git -C "$repo" status --porcelain)" || exit 1
51
+
52
+ # One worktree for the whole run, from committed HEAD.
53
+ worktree=$(mktemp -d "${TMPDIR:-/tmp}/lemming-run.XXXXXX") || exit 1
54
+ branch="lemming/$(basename "$worktree")"
55
+ git -C "$repo" worktree add -b "$branch" "$worktree" HEAD || exit 1
56
+
57
+ # Drive the loop against it; -C is a global option, before the subcommand.
58
+ lemming -C "$worktree" goal "<the long-term goal>"
59
+ lemming -C "$worktree" add "<first task>"
60
+ lemming -C "$worktree" -v run
61
+ ```
62
+
63
+ A plain branch (`git switch -c lemming/<run>`) does just as well when nothing
64
+ else needs the checkout; the worktree only buys you the original directory to
65
+ keep working in meanwhile. Either way the roadmap travels with the workspace: a
66
+ tracked `tasks.yml` is copied into the worktree and the loop's edits stay there,
67
+ and without one Lemming keeps isolated state keyed on the worktree path.
68
+
69
+ ## Inspecting Diffs and Rolling Back Tasks
70
+
71
+ Every snapshotted task records its `pre_tree`, `runner_tree`, `post_tree`, and
72
+ per-hook tree pairs (`hook_trees`), so you can inspect or undo individual tasks
73
+ and hooks without relying on the runner having made Git commits:
74
+
75
+ ```bash
76
+ lemming -C "$worktree" status # queue, attempts, diff summaries
77
+ lemming -C "$worktree" diff <id> # full patch for one task
78
+ lemming -C "$worktree" diff <id> --stat # diffstat summary
79
+ lemming -C "$worktree" diff <id> --hook <name> # changes made by one hook
80
+ lemming -C "$worktree" logs <id> # full runner and hook log
81
+ ```
82
+
83
+ When the orchestrator loop is idle and the workspace has no uncommitted manual
84
+ edits outside the latest snapshot, `lemming rollback` can revert completed work
85
+ at three granularities:
86
+
87
+ ```bash
88
+ # Rewind to <id>'s pre_tree and reset <id> and later tasks to pending
89
+ lemming -C "$worktree" rollback <id>
90
+
91
+ # Revert only <id>'s patch in place (3-way reverse apply) and reset only <id>
92
+ lemming -C "$worktree" rollback <id> --only
93
+
94
+ # Revert only one hook's changes on <id>, keeping the task completed
95
+ lemming -C "$worktree" rollback <id> --hook testing
96
+ ```
97
+
98
+ If you also created a dedicated worktree or branch before the run, you still
99
+ have standard Git commands (`git status`, `git log HEAD`, `git diff`) to review
100
+ or discard the entire branch wholesale.
101
+
102
+ Runners are also told to write verbose evidence into Lemming's per-project
103
+ scratch directory rather than into the workspace, so a failed task's notes and
104
+ `attempt-<N>.patch` artifacts survive even after a task is rolled back or you
105
+ throw the branch away. It sits under `~/.local/lemming/` (or `$LEMMING_HOME`),
106
+ named for the first 12 hex digits of the SHA-256 of the resolved tasks-file path
107
+ — or of the workspace path, when Lemming is keeping the roadmap itself. Once the
108
+ worktree is gone `-C` can no longer resolve it, and
109
+ `lemming --tasks-file <that dir>/tasks.yml logs <id>` is the way back in.
110
+
111
+ Retain a worktree until its changes have been recovered, then clean up
112
+ non-forcibly, which refuses rather than destroying uncommitted work — including
113
+ a tracked `tasks.yml` the loop has edited, which must be committed or discarded
114
+ first:
115
+
116
+ ```bash
117
+ git -C "$repo" worktree remove "$worktree"
118
+ git -C "$repo" branch -d "$branch"
119
+ ```
120
+
121
+ ## What the Runner Prompt and Snapshots Guarantee
122
+
123
+ Runners are instructed to leave a coherent workspace, to back out their own
124
+ half-applied edits before failing, and never to restore files from version
125
+ control history; the rules live in the "Workspace Hygiene" directive of
126
+ `src/lemming/taskrunner.md`, not in a copy here. Shadow Git snapshots back that
127
+ guidance up mechanically: when an attempt fails, times out, crashes, or is
128
+ cancelled, or when a post-run hook fails, Lemming restores the workspace to the
129
+ pre-attempt or pre-hook tree automatically.
130
+
131
+ ## Workspaces Not Under Version Control
132
+
133
+ Shadow Git snapshots work in a plain directory that has no `.git` of its own, as
134
+ long as the `git` binary is installed on the machine. In a greenfield directory,
135
+ create a `.gitignore` before tasks install dependencies or run builds so
136
+ snapshots skip `node_modules/`, `.venv/`, and build outputs.
137
+
138
+ If `git` is not installed on the host, snapshots are disabled silently and there
139
+ is nothing to diff against or reset; **copy the directory before the run** if
140
+ you need a rollback baseline:
141
+
142
+ ```bash
143
+ cp -a project project.bak
144
+ lemming -C project run
145
+ ```
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "lemming-cli"
7
- version = "0.8.2"
7
+ version = "0.9.1"
8
8
  description = "An autonomous, iterative task runner for AI coding agents."
9
9
  readme = "README.md"
10
10
  authors = [
@@ -3,7 +3,7 @@
3
3
  import fastapi
4
4
  import pydantic
5
5
 
6
- from .. import hooks, models, paths, persistence
6
+ from .. import hooks, models, paths, persistence, snapshots
7
7
  from ..tasks import lifecycle, operations, queries
8
8
  from . import context, loop
9
9
 
@@ -203,7 +203,9 @@ def cancel_task_endpoint(
203
203
  ):
204
204
  """Cancel a running or pending task."""
205
205
  if lifecycle.cancel_task(
206
- context.resolve_tasks_file(request.app.state, project), task_id
206
+ context.resolve_tasks_file(request.app.state, project),
207
+ task_id,
208
+ working_dir=context.resolve_project_dir(request.app.state, project),
207
209
  ):
208
210
  return {"status": "ok"}
209
211
  raise fastapi.HTTPException(404, "Task not found")
@@ -236,3 +238,88 @@ def get_task_log(
236
238
  except (ValueError, models.AmbiguousTaskIdError) as e:
237
239
  raise fastapi.HTTPException(400, str(e))
238
240
  return {"log": log_file.read_text(encoding="utf-8")}
241
+
242
+
243
+ @router.get("/api/tasks/{task_id}/diff")
244
+ def get_task_diff(
245
+ request: fastapi.Request,
246
+ task_id: str,
247
+ hook: str | None = None,
248
+ project: str | None = None,
249
+ ):
250
+ """Get the git diff and summary captured for a task."""
251
+ tasks_file = context.resolve_tasks_file(request.app.state, project)
252
+ working_dir = context.resolve_project_dir(request.app.state, project)
253
+ with persistence.read_lock_tasks(tasks_file):
254
+ data = persistence.load_tasks(tasks_file)
255
+ try:
256
+ target = queries.resolve_task(data.tasks, task_id)
257
+ except models.TaskNotFoundError as e:
258
+ raise fastapi.HTTPException(404, str(e))
259
+ except models.AmbiguousTaskIdError as e:
260
+ raise fastapi.HTTPException(400, str(e))
261
+
262
+ if hook:
263
+ pair = (target.hook_trees or {}).get(hook)
264
+ if not pair or len(pair) != 2 or not pair[0] or not pair[1]:
265
+ raise fastapi.HTTPException(
266
+ 404, f"Task {target.id} has no snapshot for hook '{hook}'"
267
+ )
268
+ h_pre, h_post = pair
269
+ return {
270
+ "diff": snapshots.diff_trees(tasks_file, h_pre, h_post),
271
+ "summary": snapshots.summarize_diff(tasks_file, h_pre, h_post),
272
+ }
273
+
274
+ if not target.pre_tree:
275
+ return {"diff": "", "summary": target.diff_summary}
276
+
277
+ end_tree = target.post_tree or target.runner_tree
278
+ if not end_tree and target.status == models.TaskStatus.IN_PROGRESS:
279
+ end_tree = snapshots.snapshot_tree(tasks_file, working_dir)
280
+ diff_text = (
281
+ snapshots.diff_trees(tasks_file, target.pre_tree, end_tree)
282
+ if end_tree
283
+ else ""
284
+ )
285
+ summary = target.diff_summary or (
286
+ snapshots.summarize_diff(tasks_file, target.pre_tree, end_tree)
287
+ if end_tree
288
+ else None
289
+ )
290
+ return {"diff": diff_text, "summary": summary}
291
+
292
+
293
+ class RollbackTaskRequest(pydantic.BaseModel):
294
+ """Request body for rolling back a task."""
295
+
296
+ only: bool = False
297
+ hook: str | None = None
298
+
299
+
300
+ @router.post("/api/tasks/{task_id}/rollback")
301
+ def rollback_task_endpoint(
302
+ request: fastapi.Request,
303
+ task_id: str,
304
+ body: RollbackTaskRequest = fastapi.Body(
305
+ default_factory=RollbackTaskRequest
306
+ ),
307
+ hook: str | None = None,
308
+ project: str | None = None,
309
+ ):
310
+ """Roll back workspace changes for a task and reset state to pending."""
311
+ tasks_file = context.resolve_tasks_file(request.app.state, project)
312
+ working_dir = context.resolve_project_dir(request.app.state, project)
313
+ try:
314
+ reset_tasks = operations.rollback_task(
315
+ tasks_file,
316
+ task_id,
317
+ only=body.only,
318
+ hook=hook if hook is not None else body.hook,
319
+ working_dir=working_dir,
320
+ )
321
+ except models.TaskNotFoundError as e:
322
+ raise fastapi.HTTPException(404, str(e))
323
+ except ValueError as e:
324
+ raise fastapi.HTTPException(400, str(e))
325
+ return {"status": "ok", "tasks": reset_tasks}
@@ -1,6 +1,6 @@
1
1
  from unittest.mock import patch
2
2
 
3
- from lemming import models, paths, persistence
3
+ from lemming import models, paths, persistence, snapshots
4
4
  from lemming.api import main
5
5
  from lemming.tasks import limits, operations, progress
6
6
 
@@ -525,10 +525,17 @@ def test_add_task_starts_loop_with_cwd(test_workspace, client):
525
525
 
526
526
 
527
527
  def test_cancel_task_endpoint(client, test_tasks):
528
- with patch("lemming.tasks.lifecycle.cancel_task", return_value=True):
528
+ with patch(
529
+ "lemming.tasks.lifecycle.cancel_task", return_value=True
530
+ ) as mock_cancel:
529
531
  response = client.post("/api/tasks/task3/cancel")
530
532
  assert response.status_code == 200
531
533
  assert response.json() == {"status": "ok"}
534
+ mock_cancel.assert_called_once_with(
535
+ test_tasks,
536
+ "task3",
537
+ working_dir=main.app.state.root,
538
+ )
532
539
 
533
540
  with patch("lemming.tasks.lifecycle.cancel_task", return_value=False):
534
541
  response = client.post("/api/tasks/nonexistent/cancel")
@@ -576,3 +583,114 @@ def test_add_task_rejects_outside_parent_tasks_file(client, test_tasks):
576
583
  def test_get_task_log_rejects_traversal(client, test_tasks):
577
584
  response = client.get("/api/tasks/..%2Fsecret/log")
578
585
  assert response.status_code in (400, 404)
586
+
587
+
588
+ def test_get_task_diff_and_rollback_endpoints(client, test_tasks, monkeypatch):
589
+ root = main.app.state.root
590
+ monkeypatch.setenv("LEMMING_HOME", str(root / "lemming_home"))
591
+ sample = root / "sample.py"
592
+ sample.write_text("before\n", encoding="utf-8")
593
+ pre_tree = snapshots.snapshot_tree(test_tasks, root)
594
+ assert pre_tree is not None
595
+
596
+ sample.write_text("after\n", encoding="utf-8")
597
+ runner_tree = snapshots.snapshot_tree(test_tasks, root)
598
+ assert runner_tree is not None
599
+
600
+ sample.write_text("after\n# formatted\n", encoding="utf-8")
601
+ post_tree = snapshots.snapshot_tree(test_tasks, root)
602
+ assert post_tree is not None
603
+ summary = snapshots.summarize_diff(test_tasks, pre_tree, post_tree)
604
+
605
+ with persistence.lock_tasks(test_tasks):
606
+ data = persistence.load_tasks(test_tasks)
607
+ task1 = next(t for t in data.tasks if t.id == "task1")
608
+ task1.pre_tree = pre_tree
609
+ task1.runner_tree = runner_tree
610
+ task1.post_tree = post_tree
611
+ task1.diff_summary = summary
612
+ task1.hook_trees = {"readability": [runner_tree, post_tree]}
613
+ persistence.save_tasks(test_tasks, data)
614
+
615
+ diff_resp = client.get("/api/tasks/task1/diff")
616
+ assert diff_resp.status_code == 200
617
+ payload = diff_resp.json()
618
+ assert "-before" in payload["diff"]
619
+ assert "+after" in payload["diff"]
620
+ assert payload["summary"] == summary
621
+
622
+ hook_diff_resp = client.get(
623
+ "/api/tasks/task1/diff", params={"hook": "readability"}
624
+ )
625
+ assert hook_diff_resp.status_code == 200
626
+ assert "+# formatted" in hook_diff_resp.json()["diff"]
627
+ assert (
628
+ client.get(
629
+ "/api/tasks/task1/diff", params={"hook": "missing"}
630
+ ).status_code
631
+ == 404
632
+ )
633
+
634
+ assert client.get("/api/tasks/nonexistent/diff").status_code == 404
635
+
636
+ with patch("lemming.tasks.lifecycle.is_loop_running", return_value=True):
637
+ busy = client.post("/api/tasks/task1/rollback", json={"only": True})
638
+ assert busy.status_code == 400
639
+
640
+ with patch("lemming.tasks.lifecycle.is_loop_running", return_value=False):
641
+ active_task_busy = client.post(
642
+ "/api/tasks/task1/rollback", json={"only": True}
643
+ )
644
+ assert active_task_busy.status_code == 400
645
+
646
+ with persistence.lock_tasks(test_tasks):
647
+ data = persistence.load_tasks(test_tasks)
648
+ task3 = next(t for t in data.tasks if t.id == "task3")
649
+ task3.status = models.TaskStatus.PENDING
650
+ task3.pid = None
651
+ task3.last_heartbeat = None
652
+ persistence.save_tasks(test_tasks, data)
653
+
654
+ combo = client.post(
655
+ "/api/tasks/task1/rollback",
656
+ json={"only": True, "hook": "readability"},
657
+ )
658
+ assert combo.status_code == 400
659
+
660
+ hook_rb = client.post(
661
+ "/api/tasks/task1/rollback", json={"hook": "readability"}
662
+ )
663
+ assert hook_rb.status_code == 200
664
+ assert sample.read_text(encoding="utf-8") == "after\n"
665
+ task1_mid = next(
666
+ t
667
+ for t in persistence.load_tasks(test_tasks).tasks
668
+ if t.id == "task1"
669
+ )
670
+ assert task1_mid.status == models.TaskStatus.COMPLETED
671
+ assert task1_mid.hook_trees is None
672
+
673
+ rb_resp = client.post("/api/tasks/task1/rollback", json={"only": True})
674
+ assert rb_resp.status_code == 200
675
+ assert sample.read_text(encoding="utf-8") == "before\n"
676
+ task1_after = next(
677
+ t
678
+ for t in persistence.load_tasks(test_tasks).tasks
679
+ if t.id == "task1"
680
+ )
681
+ assert task1_after.status == models.TaskStatus.PENDING
682
+ assert task1_after.pre_tree is None
683
+
684
+ sample.write_text("unrelated dirty edit\n", encoding="utf-8")
685
+ with persistence.lock_tasks(test_tasks):
686
+ data = persistence.load_tasks(test_tasks)
687
+ task1 = next(t for t in data.tasks if t.id == "task1")
688
+ task1.status = models.TaskStatus.CANCELLED
689
+ task1.pre_tree = pre_tree
690
+ task1.runner_tree = None
691
+ task1.post_tree = None
692
+ persistence.save_tasks(test_tasks, data)
693
+
694
+ cancelled_diff = client.get("/api/tasks/task1/diff")
695
+ assert cancelled_diff.status_code == 200
696
+ assert cancelled_diff.json() == {"diff": "", "summary": None}
@@ -283,7 +283,7 @@ def exec_command(
283
283
  working_dir = pathlib.Path.cwd().resolve()
284
284
 
285
285
  scope_text = None
286
- if reviews:
286
+ if reviews and (prompt is None or scope_values):
287
287
  try:
288
288
  entries = scope.resolve_scope(scope_values, working_dir)
289
289
  except scope.ScopeError as e:
@@ -3,6 +3,7 @@
3
3
  import json
4
4
  import os
5
5
  import subprocess
6
+ import sys
6
7
  import time
7
8
  from unittest import mock
8
9
 
@@ -312,9 +313,9 @@ def test_exec_retries_transient_runner_failures(workspace, first_result):
312
313
 
313
314
  def test_exec_retries_a_real_runner_process(workspace):
314
315
  """The CLI preserves task state across actual subprocess launches."""
315
- fake_runner = workspace / "flaky_runner.py"
316
+ fake_runner = workspace.parent / "flaky_runner.py"
316
317
  fake_runner.write_text(
317
- "#!/usr/bin/env python3\n"
318
+ f"#!{sys.executable}\n"
318
319
  "import json\n"
319
320
  "import os\n"
320
321
  "import pathlib\n"
@@ -461,6 +462,7 @@ def repo(workspace):
461
462
  _git(workspace, "init", "-q", "-b", "main")
462
463
  _git(workspace, "config", "user.email", "test@example.com")
463
464
  _git(workspace, "config", "user.name", "Test")
465
+ _git(workspace, "config", "commit.gpgsign", "false")
464
466
  (workspace / "committed.py").write_text("x = 1\n")
465
467
  _git(workspace, "add", "committed.py")
466
468
  _git(workspace, "commit", "-qm", "initial")
@@ -570,10 +572,17 @@ def test_review_rejects_an_unresolvable_scope(repo):
570
572
 
571
573
  def test_a_task_can_be_followed_by_reviews(repo):
572
574
  """Doing the work and gating it is one invocation, in order."""
575
+ (repo / "committed.py").write_text("preexisting_dirty = True\n")
573
576
  headers = []
577
+ review_prompts = []
574
578
 
575
579
  def record(cmd, tasks_file, task_id, *args, **kwargs):
576
- headers.append(kwargs.get("header"))
580
+ header = kwargs.get("header")
581
+ headers.append(header)
582
+ if header == "Task Runner":
583
+ (repo / "pagination.py").write_text("page = 1\n")
584
+ else:
585
+ review_prompts.append(cmd[-1])
577
586
  return _finish("Done.")(cmd, tasks_file, task_id, *args, **kwargs)
578
587
 
579
588
  with mock.patch("lemming.runner.run_with_heartbeat", record):
@@ -582,6 +591,9 @@ def test_a_task_can_be_followed_by_reviews(repo):
582
591
  )
583
592
 
584
593
  assert headers == ["Task Runner", "Hook: readability"]
594
+ assert len(review_prompts) == 1
595
+ assert "- pagination.py" in review_prompts[0]
596
+ assert "- committed.py" not in review_prompts[0]
585
597
 
586
598
 
587
599
  def test_a_failing_review_does_not_become_a_task_run(repo):