ankor 0.2.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 (278) hide show
  1. ankor-0.2.1/.claude/hooks/after_edit.py +49 -0
  2. ankor-0.2.1/.claude/hooks/before_stop.py +48 -0
  3. ankor-0.2.1/.claude/hooks/check_commit_message.py +62 -0
  4. ankor-0.2.1/.claude/settings.json +21 -0
  5. ankor-0.2.1/.github/dependabot.yml +20 -0
  6. ankor-0.2.1/.github/workflows/ci.yml +75 -0
  7. ankor-0.2.1/.github/workflows/docs.yml +45 -0
  8. ankor-0.2.1/.github/workflows/release.yml +85 -0
  9. ankor-0.2.1/.github/workflows/weekly.yml +32 -0
  10. ankor-0.2.1/.gitignore +28 -0
  11. ankor-0.2.1/.pre-commit-config.yaml +54 -0
  12. ankor-0.2.1/.python-version +1 -0
  13. ankor-0.2.1/AGENTS.md +26 -0
  14. ankor-0.2.1/CHANGELOG.md +168 -0
  15. ankor-0.2.1/CLAUDE.md +1 -0
  16. ankor-0.2.1/CONTRIBUTING.md +144 -0
  17. ankor-0.2.1/LICENSE +202 -0
  18. ankor-0.2.1/NOTICE +5 -0
  19. ankor-0.2.1/PKG-INFO +123 -0
  20. ankor-0.2.1/README.md +92 -0
  21. ankor-0.2.1/cliff.toml +82 -0
  22. ankor-0.2.1/docs/README.md +14 -0
  23. ankor-0.2.1/docs/explanation/adr/0001-languages-of-generated-projects.md +73 -0
  24. ankor-0.2.1/docs/explanation/adr/0002-type-of-generated-java-application.md +73 -0
  25. ankor-0.2.1/docs/explanation/adr/0003-role-of-the-agent.md +73 -0
  26. ankor-0.2.1/docs/explanation/adr/0004-implementation-language-of-the-harness.md +71 -0
  27. ankor-0.2.1/docs/explanation/adr/0005-command-line-library.md +71 -0
  28. ankor-0.2.1/docs/explanation/adr/0006-installation-and-dependency-management.md +72 -0
  29. ankor-0.2.1/docs/explanation/adr/0007-python-version.md +69 -0
  30. ankor-0.2.1/docs/explanation/adr/0008-code-organisation.md +71 -0
  31. ankor-0.2.1/docs/explanation/adr/0009-pack-configuration-format.md +71 -0
  32. ankor-0.2.1/docs/explanation/adr/0010-pack-validation.md +71 -0
  33. ankor-0.2.1/docs/explanation/adr/0011-dependency-version-constraints-for-users.md +69 -0
  34. ankor-0.2.1/docs/explanation/adr/0012-role-of-the-llm-in-project-creation.md +70 -0
  35. ankor-0.2.1/docs/explanation/adr/0013-template-engine.md +68 -0
  36. ankor-0.2.1/docs/explanation/adr/0014-interaction-model-of-ankor-new.md +70 -0
  37. ankor-0.2.1/docs/explanation/adr/0015-prompts-and-terminal-output.md +68 -0
  38. ankor-0.2.1/docs/explanation/adr/0016-steps-of-ankor-new.md +70 -0
  39. ankor-0.2.1/docs/explanation/adr/0017-isolated-environment.md +77 -0
  40. ankor-0.2.1/docs/explanation/adr/0018-base-image.md +69 -0
  41. ankor-0.2.1/docs/explanation/adr/0019-configurable-java-version.md +57 -0
  42. ankor-0.2.1/docs/explanation/adr/0020-docker-compose.md +63 -0
  43. ankor-0.2.1/docs/explanation/adr/0021-branching-model.md +75 -0
  44. ankor-0.2.1/docs/explanation/adr/0022-agents-invoking-ankor-task.md +68 -0
  45. ankor-0.2.1/docs/explanation/adr/0023-how-agents-discover-and-use-the-harness.md +69 -0
  46. ankor-0.2.1/docs/explanation/adr/0024-commit-messages.md +69 -0
  47. ankor-0.2.1/docs/explanation/adr/0025-versioning.md +67 -0
  48. ankor-0.2.1/docs/explanation/adr/0026-changelog.md +68 -0
  49. ankor-0.2.1/docs/explanation/adr/0027-pull-request-and-issue-templates.md +69 -0
  50. ankor-0.2.1/docs/explanation/adr/0028-licence-and-visibility.md +77 -0
  51. ankor-0.2.1/docs/explanation/adr/0029-structure-of-the-generated-java-project.md +67 -0
  52. ankor-0.2.1/docs/explanation/adr/0030-java-artifact-format.md +70 -0
  53. ankor-0.2.1/docs/explanation/adr/0031-dependency-updates.md +69 -0
  54. ankor-0.2.1/docs/explanation/adr/0032-policy-when-an-update-breaks-the-build.md +69 -0
  55. ankor-0.2.1/docs/explanation/adr/0033-java-test-framework-and-libraries.md +69 -0
  56. ankor-0.2.1/docs/explanation/adr/0034-who-writes-the-tests.md +68 -0
  57. ankor-0.2.1/docs/explanation/adr/0035-test-coverage.md +68 -0
  58. ankor-0.2.1/docs/explanation/adr/0036-setting-coverage-thresholds-at-project-creation.md +68 -0
  59. ankor-0.2.1/docs/explanation/adr/0037-mutation-testing.md +68 -0
  60. ankor-0.2.1/docs/explanation/adr/0038-testing-the-harness-itself.md +70 -0
  61. ankor-0.2.1/docs/explanation/adr/0039-java-static-analysis-tools.md +74 -0
  62. ankor-0.2.1/docs/explanation/adr/0040-static-analysis-profiles.md +69 -0
  63. ankor-0.2.1/docs/explanation/adr/0041-tool-conflicts-and-tested-combinations.md +69 -0
  64. ankor-0.2.1/docs/explanation/adr/0042-python-quality-tools-for-the-harness.md +68 -0
  65. ankor-0.2.1/docs/explanation/adr/0043-pre-commit-hooks.md +69 -0
  66. ankor-0.2.1/docs/explanation/adr/0044-behaviour-of-ankor-check.md +69 -0
  67. ankor-0.2.1/docs/explanation/adr/0045-ci-platform.md +67 -0
  68. ankor-0.2.1/docs/explanation/adr/0046-ci-workflows-and-jobs.md +68 -0
  69. ankor-0.2.1/docs/explanation/adr/0047-ci-caching.md +69 -0
  70. ankor-0.2.1/docs/explanation/adr/0048-releases-of-generated-projects.md +69 -0
  71. ankor-0.2.1/docs/explanation/adr/0049-releasing-and-distributing-the-harness.md +69 -0
  72. ankor-0.2.1/docs/explanation/adr/0050-checks-performed-by-ankor-doctor.md +70 -0
  73. ankor-0.2.1/docs/explanation/adr/0051-logging-verbose-and-debug-modes.md +67 -0
  74. ankor-0.2.1/docs/explanation/adr/0052-profiling.md +68 -0
  75. ankor-0.2.1/docs/explanation/adr/0053-supported-agents.md +68 -0
  76. ankor-0.2.1/docs/explanation/adr/0054-headless-mode-and-task-input.md +63 -0
  77. ankor-0.2.1/docs/explanation/adr/0055-attempt-limit-and-task-completion.md +69 -0
  78. ankor-0.2.1/docs/explanation/adr/0056-agent-credentials-in-the-container.md +69 -0
  79. ankor-0.2.1/docs/explanation/adr/0057-agent-permissions.md +70 -0
  80. ankor-0.2.1/docs/explanation/adr/0058-claude-code-hooks.md +69 -0
  81. ankor-0.2.1/docs/explanation/adr/0059-content-of-agents-md.md +69 -0
  82. ankor-0.2.1/docs/explanation/adr/0060-agent-task-records.md +68 -0
  83. ankor-0.2.1/docs/explanation/adr/0061-documentation-of-generated-files.md +69 -0
  84. ankor-0.2.1/docs/explanation/adr/0062-adr-template.md +69 -0
  85. ankor-0.2.1/docs/explanation/adr/0063-readme-template.md +67 -0
  86. ankor-0.2.1/docs/explanation/adr/0064-general-documentation-and-architecture.md +68 -0
  87. ankor-0.2.1/docs/explanation/adr/0065-agent-access-to-environment-configuration.md +62 -0
  88. ankor-0.2.1/docs/explanation/adr/0066-documentation-language.md +51 -0
  89. ankor-0.2.1/docs/explanation/adr/0067-language-of-cli-messages-values-and-source-code.md +62 -0
  90. ankor-0.2.1/docs/explanation/adr/0068-time-and-cost-limits-per-task.md +71 -0
  91. ankor-0.2.1/docs/explanation/adr/0069-minimal-content-of-the-python-pack.md +70 -0
  92. ankor-0.2.1/docs/explanation/adr/0070-user-pack-directory.md +71 -0
  93. ankor-0.2.1/docs/explanation/adr/0071-adopting-existing-projects-with-ankor-init.md +71 -0
  94. ankor-0.2.1/docs/explanation/adr/0072-additional-commands.md +69 -0
  95. ankor-0.2.1/docs/explanation/adr/0073-location-of-packs-in-the-installed-harness.md +71 -0
  96. ankor-0.2.1/docs/explanation/adr/0074-documentation-site.md +70 -0
  97. ankor-0.2.1/docs/explanation/adr/0075-dogfooding-the-harness-manages-its-own-repository.md +71 -0
  98. ankor-0.2.1/docs/explanation/adr/0076-pull-request-merge-method.md +59 -0
  99. ankor-0.2.1/docs/explanation/adr/0077-branch-protection-of-main.md +72 -0
  100. ankor-0.2.1/docs/explanation/adr/0078-product-name.md +80 -0
  101. ankor-0.2.1/docs/explanation/adr/0079-git-hooks-for-the-harness-repository.md +75 -0
  102. ankor-0.2.1/docs/explanation/adr/0080-verification-of-the-task-agent-from-the-host.md +66 -0
  103. ankor-0.2.1/docs/explanation/adr/0081-security-boundary-of-the-task-agent.md +68 -0
  104. ankor-0.2.1/docs/explanation/adr/0082-content-of-the-python-pack.md +68 -0
  105. ankor-0.2.1/docs/explanation/adr/0083-documentation-site-built-with-zensical.md +70 -0
  106. ankor-0.2.1/docs/explanation/adr/0084-publishing-the-harness-on-pypi.md +62 -0
  107. ankor-0.2.1/docs/explanation/adr/README.md +95 -0
  108. ankor-0.2.1/docs/explanation/adr/template.md +48 -0
  109. ankor-0.2.1/docs/explanation/architecture.md +156 -0
  110. ankor-0.2.1/docs/explanation/limitations.md +50 -0
  111. ankor-0.2.1/docs/explanation/requirements.md +14 -0
  112. ankor-0.2.1/docs/how-to/README.md +9 -0
  113. ankor-0.2.1/docs/how-to/change-coverage-and-analysis.md +32 -0
  114. ankor-0.2.1/docs/how-to/fix-a-breaking-dependency-update.md +13 -0
  115. ankor-0.2.1/docs/how-to/log-the-agent-in.md +37 -0
  116. ankor-0.2.1/docs/how-to/release-a-version.md +21 -0
  117. ankor-0.2.1/docs/how-to/run-an-agent-task.md +34 -0
  118. ankor-0.2.1/docs/reference/ankor-yaml.md +66 -0
  119. ankor-0.2.1/docs/reference/commands.md +80 -0
  120. ankor-0.2.1/docs/reference/files/README.md +31 -0
  121. ankor-0.2.1/docs/reference/files/agents-md.md +43 -0
  122. ankor-0.2.1/docs/reference/files/ankor-agent-settings.md +44 -0
  123. ankor-0.2.1/docs/reference/files/ankor-generated-folders.md +38 -0
  124. ankor-0.2.1/docs/reference/files/ankor-prompts.md +34 -0
  125. ankor-0.2.1/docs/reference/files/ankor-yaml.md +38 -0
  126. ankor-0.2.1/docs/reference/files/changelog.md +36 -0
  127. ankor-0.2.1/docs/reference/files/checkstyle-xml.md +42 -0
  128. ankor-0.2.1/docs/reference/files/claude-dir.md +38 -0
  129. ankor-0.2.1/docs/reference/files/claude-md.md +31 -0
  130. ankor-0.2.1/docs/reference/files/compose-yaml.md +59 -0
  131. ankor-0.2.1/docs/reference/files/dependabot-yml.md +40 -0
  132. ankor-0.2.1/docs/reference/files/devcontainer-json.md +38 -0
  133. ankor-0.2.1/docs/reference/files/dockerfile.md +51 -0
  134. ankor-0.2.1/docs/reference/files/docs-adr.md +32 -0
  135. ankor-0.2.1/docs/reference/files/env.md +34 -0
  136. ankor-0.2.1/docs/reference/files/gitignore.md +33 -0
  137. ankor-0.2.1/docs/reference/files/license.md +33 -0
  138. ankor-0.2.1/docs/reference/files/maven-wrapper.md +34 -0
  139. ankor-0.2.1/docs/reference/files/pom-xml.md +88 -0
  140. ankor-0.2.1/docs/reference/files/pre-commit-config.md +52 -0
  141. ankor-0.2.1/docs/reference/files/readme.md +35 -0
  142. ankor-0.2.1/docs/reference/files/templates-pr-issues.md +34 -0
  143. ankor-0.2.1/docs/reference/files/workflows.md +47 -0
  144. ankor-0.2.1/docs/reference/generated-project.md +74 -0
  145. ankor-0.2.1/docs/roadmap.md +93 -0
  146. ankor-0.2.1/docs/tutorial/README.md +106 -0
  147. ankor-0.2.1/mkdocs.yml +40 -0
  148. ankor-0.2.1/pyproject.toml +92 -0
  149. ankor-0.2.1/scripts/check_commit_message.py +60 -0
  150. ankor-0.2.1/src/ankor/__init__.py +23 -0
  151. ankor-0.2.1/src/ankor/__main__.py +12 -0
  152. ankor-0.2.1/src/ankor/agents/claude.yaml +33 -0
  153. ankor-0.2.1/src/ankor/cli.py +297 -0
  154. ankor-0.2.1/src/ankor/commands/__init__.py +8 -0
  155. ankor-0.2.1/src/ankor/commands/agent.py +50 -0
  156. ankor-0.2.1/src/ankor/commands/check.py +223 -0
  157. ankor-0.2.1/src/ankor/commands/common.py +80 -0
  158. ankor-0.2.1/src/ankor/commands/doctor.py +272 -0
  159. ankor-0.2.1/src/ankor/commands/new.py +511 -0
  160. ankor-0.2.1/src/ankor/commands/run.py +73 -0
  161. ankor-0.2.1/src/ankor/commands/shell.py +30 -0
  162. ankor-0.2.1/src/ankor/commands/task.py +482 -0
  163. ankor-0.2.1/src/ankor/errors.py +25 -0
  164. ankor-0.2.1/src/ankor/licenses/README.md +5 -0
  165. ankor-0.2.1/src/ankor/licenses/apache-2.0.txt +201 -0
  166. ankor-0.2.1/src/ankor/licenses/gpl-3.0.txt +674 -0
  167. ankor-0.2.1/src/ankor/licenses/mit.txt +21 -0
  168. ankor-0.2.1/src/ankor/models/__init__.py +7 -0
  169. ankor-0.2.1/src/ankor/models/agent.py +41 -0
  170. ankor-0.2.1/src/ankor/models/pack.py +184 -0
  171. ankor-0.2.1/src/ankor/models/project_config.py +69 -0
  172. ankor-0.2.1/src/ankor/options.py +56 -0
  173. ankor-0.2.1/src/ankor/packs/java/pack.yaml +95 -0
  174. ankor-0.2.1/src/ankor/packs/java/template/.ankor/prompts/task.md.j2 +10 -0
  175. ankor-0.2.1/src/ankor/packs/java/template/.claude/commands/check.md +5 -0
  176. ankor-0.2.1/src/ankor/packs/java/template/.claude/commands/task.md +6 -0
  177. ankor-0.2.1/src/ankor/packs/java/template/.claude/skills/ankor/SKILL.md +25 -0
  178. ankor-0.2.1/src/ankor/packs/java/template/.devcontainer/devcontainer.json.j2 +25 -0
  179. ankor-0.2.1/src/ankor/packs/java/template/.dockerignore +4 -0
  180. ankor-0.2.1/src/ankor/packs/java/template/.github/ISSUE_TEMPLATE/bug_report.yml +45 -0
  181. ankor-0.2.1/src/ankor/packs/java/template/.github/ISSUE_TEMPLATE/feature_request.yml +20 -0
  182. ankor-0.2.1/src/ankor/packs/java/template/.github/dependabot.yml +26 -0
  183. ankor-0.2.1/src/ankor/packs/java/template/.github/pull_request_template.md +13 -0
  184. ankor-0.2.1/src/ankor/packs/java/template/.github/workflows/ci.yml +56 -0
  185. ankor-0.2.1/src/ankor/packs/java/template/.github/workflows/release.yml +65 -0
  186. ankor-0.2.1/src/ankor/packs/java/template/.gitignore +18 -0
  187. ankor-0.2.1/src/ankor/packs/java/template/.mvn/wrapper/maven-wrapper.properties +3 -0
  188. ankor-0.2.1/src/ankor/packs/java/template/.pre-commit-config.yaml +60 -0
  189. ankor-0.2.1/src/ankor/packs/java/template/AGENTS.md.j2 +91 -0
  190. ankor-0.2.1/src/ankor/packs/java/template/CLAUDE.md +1 -0
  191. ankor-0.2.1/src/ankor/packs/java/template/Dockerfile.j2 +55 -0
  192. ankor-0.2.1/src/ankor/packs/java/template/README.md.j2 +32 -0
  193. ankor-0.2.1/src/ankor/packs/java/template/cliff.toml +79 -0
  194. ankor-0.2.1/src/ankor/packs/java/template/compose.yaml.j2 +41 -0
  195. ankor-0.2.1/src/ankor/packs/java/template/config/checkstyle.xml +319 -0
  196. ankor-0.2.1/src/ankor/packs/java/template/docs/adr/0001-use-markdown-architectural-decision-records.md.j2 +31 -0
  197. ankor-0.2.1/src/ankor/packs/java/template/docs/adr/template.md +74 -0
  198. ankor-0.2.1/src/ankor/packs/java/template/mvnw +295 -0
  199. ankor-0.2.1/src/ankor/packs/java/template/mvnw.cmd +189 -0
  200. ankor-0.2.1/src/ankor/packs/java/template/pom.xml.j2 +355 -0
  201. ankor-0.2.1/src/ankor/packs/java/template/src/main/java/{{ package_path }}/{{ class_name }}.java.j2 +30 -0
  202. ankor-0.2.1/src/ankor/packs/java/template/src/test/java/{{ package_path }}/{{ class_name }}Test.java.j2 +32 -0
  203. ankor-0.2.1/src/ankor/packs/python/pack.yaml +63 -0
  204. ankor-0.2.1/src/ankor/packs/python/template/.ankor/prompts/task.md.j2 +10 -0
  205. ankor-0.2.1/src/ankor/packs/python/template/.claude/commands/check.md +5 -0
  206. ankor-0.2.1/src/ankor/packs/python/template/.claude/commands/task.md +6 -0
  207. ankor-0.2.1/src/ankor/packs/python/template/.claude/skills/ankor/SKILL.md +25 -0
  208. ankor-0.2.1/src/ankor/packs/python/template/.devcontainer/devcontainer.json.j2 +25 -0
  209. ankor-0.2.1/src/ankor/packs/python/template/.dockerignore +4 -0
  210. ankor-0.2.1/src/ankor/packs/python/template/.github/ISSUE_TEMPLATE/bug_report.yml +45 -0
  211. ankor-0.2.1/src/ankor/packs/python/template/.github/ISSUE_TEMPLATE/feature_request.yml +20 -0
  212. ankor-0.2.1/src/ankor/packs/python/template/.github/dependabot.yml +26 -0
  213. ankor-0.2.1/src/ankor/packs/python/template/.github/pull_request_template.md +13 -0
  214. ankor-0.2.1/src/ankor/packs/python/template/.github/workflows/ci.yml +56 -0
  215. ankor-0.2.1/src/ankor/packs/python/template/.github/workflows/release.yml +63 -0
  216. ankor-0.2.1/src/ankor/packs/python/template/.gitignore +29 -0
  217. ankor-0.2.1/src/ankor/packs/python/template/.pre-commit-config.yaml +60 -0
  218. ankor-0.2.1/src/ankor/packs/python/template/.python-version +1 -0
  219. ankor-0.2.1/src/ankor/packs/python/template/AGENTS.md.j2 +79 -0
  220. ankor-0.2.1/src/ankor/packs/python/template/CLAUDE.md +1 -0
  221. ankor-0.2.1/src/ankor/packs/python/template/Dockerfile.j2 +67 -0
  222. ankor-0.2.1/src/ankor/packs/python/template/README.md.j2 +33 -0
  223. ankor-0.2.1/src/ankor/packs/python/template/cliff.toml +79 -0
  224. ankor-0.2.1/src/ankor/packs/python/template/compose.yaml.j2 +44 -0
  225. ankor-0.2.1/src/ankor/packs/python/template/docs/adr/0001-use-markdown-architectural-decision-records.md.j2 +31 -0
  226. ankor-0.2.1/src/ankor/packs/python/template/docs/adr/template.md +74 -0
  227. ankor-0.2.1/src/ankor/packs/python/template/pyproject.toml.j2 +51 -0
  228. ankor-0.2.1/src/ankor/packs/python/template/src/{{ module_name }}/__init__.py.j2 +16 -0
  229. ankor-0.2.1/src/ankor/packs/python/template/tests/test_{{ module_name }}.py.j2 +15 -0
  230. ankor-0.2.1/src/ankor/services/__init__.py +7 -0
  231. ankor-0.2.1/src/ankor/services/agent_settings.py +120 -0
  232. ankor-0.2.1/src/ankor/services/agents.py +115 -0
  233. ankor-0.2.1/src/ankor/services/config_files.py +76 -0
  234. ankor-0.2.1/src/ankor/services/docker.py +98 -0
  235. ankor-0.2.1/src/ankor/services/git.py +147 -0
  236. ankor-0.2.1/src/ankor/services/github.py +138 -0
  237. ankor-0.2.1/src/ankor/services/hooks.py +26 -0
  238. ankor-0.2.1/src/ankor/services/host_user.py +61 -0
  239. ankor-0.2.1/src/ankor/services/licenses.py +26 -0
  240. ankor-0.2.1/src/ankor/services/logs.py +79 -0
  241. ankor-0.2.1/src/ankor/services/output.py +138 -0
  242. ankor-0.2.1/src/ankor/services/packs.py +122 -0
  243. ankor-0.2.1/src/ankor/services/process.py +120 -0
  244. ankor-0.2.1/src/ankor/services/prompts.py +35 -0
  245. ankor-0.2.1/src/ankor/services/protected_files.py +179 -0
  246. ankor-0.2.1/src/ankor/services/templates.py +114 -0
  247. ankor-0.2.1/tests/conftest.py +52 -0
  248. ankor-0.2.1/tests/e2e/test_java_project.py +130 -0
  249. ankor-0.2.1/tests/e2e/test_python_project.py +100 -0
  250. ankor-0.2.1/tests/integration/test_git_service.py +43 -0
  251. ankor-0.2.1/tests/integration/test_new_command.py +315 -0
  252. ankor-0.2.1/tests/integration/test_new_python.py +124 -0
  253. ankor-0.2.1/tests/integration/test_task.py +253 -0
  254. ankor-0.2.1/tests/unit/.gitkeep +0 -0
  255. ankor-0.2.1/tests/unit/test_agents.py +186 -0
  256. ankor-0.2.1/tests/unit/test_check.py +265 -0
  257. ankor-0.2.1/tests/unit/test_cli.py +113 -0
  258. ankor-0.2.1/tests/unit/test_commit_message_script.py +71 -0
  259. ankor-0.2.1/tests/unit/test_config_files.py +75 -0
  260. ankor-0.2.1/tests/unit/test_docker.py +61 -0
  261. ankor-0.2.1/tests/unit/test_doctor.py +132 -0
  262. ankor-0.2.1/tests/unit/test_git_username.py +64 -0
  263. ankor-0.2.1/tests/unit/test_github.py +102 -0
  264. ankor-0.2.1/tests/unit/test_host_user.py +53 -0
  265. ankor-0.2.1/tests/unit/test_licenses.py +39 -0
  266. ankor-0.2.1/tests/unit/test_logs.py +60 -0
  267. ankor-0.2.1/tests/unit/test_models.py +163 -0
  268. ankor-0.2.1/tests/unit/test_new.py +171 -0
  269. ankor-0.2.1/tests/unit/test_new_finish_setup.py +208 -0
  270. ankor-0.2.1/tests/unit/test_output.py +104 -0
  271. ankor-0.2.1/tests/unit/test_packs.py +90 -0
  272. ankor-0.2.1/tests/unit/test_process.py +54 -0
  273. ankor-0.2.1/tests/unit/test_protected_files.py +169 -0
  274. ankor-0.2.1/tests/unit/test_run_and_shell.py +123 -0
  275. ankor-0.2.1/tests/unit/test_task_commit_message.py +59 -0
  276. ankor-0.2.1/tests/unit/test_templates.py +94 -0
  277. ankor-0.2.1/tests/unit/test_workflow_actions.py +45 -0
  278. ankor-0.2.1/uv.lock +989 -0
@@ -0,0 +1,49 @@
1
+ """Claude Code hook (PostToolUse): format and lint every Python file right after it is edited.
2
+
3
+ Claude Code runs this script after each Edit/Write/MultiEdit tool call and passes a
4
+ JSON description of the call on standard input. The script:
5
+
6
+ 1. reads the path of the edited file from that JSON;
7
+ 2. if it is a Python file, runs `ruff format` (rewrites the formatting) and
8
+ `ruff check --fix` (fixes what can be fixed automatically, reports the rest);
9
+ 3. exits with code 2 and prints the remaining problems on stderr when ruff still
10
+ reports errors — Claude Code shows that output to the agent, so it fixes them
11
+ immediately instead of discovering them at the end.
12
+
13
+ Exit code 0 means "nothing to report".
14
+ """
15
+
16
+ import json
17
+ import subprocess
18
+ import sys
19
+ from pathlib import Path
20
+
21
+
22
+ def main() -> int:
23
+ # The hook input looks like {"tool_name": "Edit", "tool_input": {"file_path": "..."}, ...}.
24
+ event = json.load(sys.stdin)
25
+ file_path = event.get("tool_input", {}).get("file_path", "")
26
+ if not file_path.endswith(".py") or not Path(file_path).exists():
27
+ return 0 # only Python files are checked
28
+
29
+ # `uv run` executes ruff from the project's virtual environment (pinned version).
30
+ # Security note (ruff S603/S607): the command is a fixed list without a shell, and
31
+ # `uv` is deliberately looked up in PATH; the only variable part is a file path.
32
+ subprocess.run( # noqa: S603
33
+ ["uv", "run", "--quiet", "ruff", "format", "--quiet", file_path], # noqa: S607
34
+ check=False,
35
+ )
36
+ lint = subprocess.run( # noqa: S603
37
+ ["uv", "run", "--quiet", "ruff", "check", "--fix", "--quiet", file_path], # noqa: S607
38
+ capture_output=True,
39
+ text=True,
40
+ check=False,
41
+ )
42
+ if lint.returncode != 0:
43
+ print(f"ruff found problems in {file_path}:\n{lint.stdout}{lint.stderr}", file=sys.stderr)
44
+ return 2 # exit code 2 = feed this message back to the agent
45
+ return 0
46
+
47
+
48
+ if __name__ == "__main__":
49
+ sys.exit(main())
@@ -0,0 +1,48 @@
1
+ """Claude Code hook (Stop): the agent may only finish when every check passes.
2
+
3
+ Claude Code runs this script when the agent is about to end its turn. It runs the
4
+ same checks as CI (ruff, mypy, pytest) — the repository's definition of done.
5
+ If any check fails, the script exits with code 2 and explains why on stderr:
6
+ Claude Code then keeps the agent working instead of letting it stop.
7
+
8
+ To avoid an endless loop, when Claude Code reports that the agent is already
9
+ continuing because of this hook (`stop_hook_active`), the script lets it stop;
10
+ the failure was already reported once and must be addressed or explained.
11
+ """
12
+
13
+ import json
14
+ import subprocess
15
+ import sys
16
+
17
+ # (name shown in messages, command) — run from the repository root.
18
+ CHECKS = [
19
+ ("formatting", ["uv", "run", "--quiet", "ruff", "format", "--check", "."]),
20
+ ("lint", ["uv", "run", "--quiet", "ruff", "check", "."]),
21
+ ("types", ["uv", "run", "--quiet", "mypy"]),
22
+ ("tests", ["uv", "run", "--quiet", "pytest", "-q"]),
23
+ ]
24
+
25
+
26
+ def main() -> int:
27
+ event = json.load(sys.stdin)
28
+ if event.get("stop_hook_active"):
29
+ return 0 # already asked to continue once; do not block forever
30
+
31
+ failures = []
32
+ for name, command in CHECKS:
33
+ # Security note (ruff S603): the commands are the fixed lists in CHECKS, run
34
+ # without a shell; nothing comes from user input.
35
+ result = subprocess.run(command, capture_output=True, text=True, check=False) # noqa: S603
36
+ if result.returncode != 0:
37
+ # Keep only the end of the output: it contains the summary of the failure.
38
+ tail = "\n".join((result.stdout + result.stderr).strip().splitlines()[-15:])
39
+ failures.append(f"✗ {name}:\n{tail}")
40
+
41
+ if failures:
42
+ print("The checks must pass before finishing:\n\n" + "\n\n".join(failures), file=sys.stderr)
43
+ return 2 # exit code 2 = do not stop; show this to the agent
44
+ return 0
45
+
46
+
47
+ if __name__ == "__main__":
48
+ sys.exit(main())
@@ -0,0 +1,62 @@
1
+ """Claude Code hook (PreToolUse on Bash): block commits whose message breaks Conventional Commits.
2
+
3
+ Claude Code runs this script before every shell command the agent wants to run.
4
+ When the command is a `git commit -m "<message>"`, the script checks the first
5
+ line of the message against the Conventional Commits format (ADR-0024) and blocks
6
+ the command (exit code 2, reason on stderr) if it does not match.
7
+
8
+ Commands that are not commits, or whose message cannot be read from the command
9
+ line (for example an editor-based commit), are allowed; the CI check still applies.
10
+ """
11
+
12
+ import json
13
+ import re
14
+ import shlex
15
+ import sys
16
+
17
+ # type, optional (scope), optional "!" for breaking changes, ": ", then a summary.
18
+ PATTERN = re.compile(
19
+ r"^(feat|fix|docs|test|refactor|build|ci|chore|perf|style|revert)(\([\w./-]+\))?!?: \S"
20
+ )
21
+
22
+
23
+ def commit_message(command: str) -> str | None:
24
+ """Return the message passed with -m/--message to `git commit`, if any."""
25
+ if "git commit" not in command:
26
+ return None
27
+ try:
28
+ words = shlex.split(command) # splits the command like the shell would
29
+ except ValueError:
30
+ return None # unbalanced quotes etc.: let git handle it
31
+ for index, word in enumerate(words):
32
+ if word in ("-m", "--message") and index + 1 < len(words):
33
+ return words[index + 1]
34
+ if (
35
+ word.startswith("-")
36
+ and not word.startswith("--")
37
+ and word.endswith("m")
38
+ and index + 1 < len(words)
39
+ ):
40
+ return words[index + 1] # combined short flags such as -qm or -am
41
+ return None
42
+
43
+
44
+ def main() -> int:
45
+ event = json.load(sys.stdin)
46
+ command = event.get("tool_input", {}).get("command", "")
47
+ message = commit_message(command)
48
+ if message is None:
49
+ return 0
50
+ first_line = message.splitlines()[0] if message else ""
51
+ if not PATTERN.match(first_line):
52
+ print(
53
+ f'Commit message "{first_line}" does not follow Conventional Commits '
54
+ "(<type>(<scope>): <summary>). See CONTRIBUTING.md.",
55
+ file=sys.stderr,
56
+ )
57
+ return 2 # exit code 2 = block the command and tell the agent why
58
+ return 0
59
+
60
+
61
+ if __name__ == "__main__":
62
+ sys.exit(main())
@@ -0,0 +1,21 @@
1
+ {
2
+ "hooks": {
3
+ "PostToolUse": [
4
+ {
5
+ "matcher": "Edit|Write|MultiEdit",
6
+ "hooks": [{ "type": "command", "command": "python3 \"$CLAUDE_PROJECT_DIR\"/.claude/hooks/after_edit.py" }]
7
+ }
8
+ ],
9
+ "PreToolUse": [
10
+ {
11
+ "matcher": "Bash",
12
+ "hooks": [{ "type": "command", "command": "python3 \"$CLAUDE_PROJECT_DIR\"/.claude/hooks/check_commit_message.py" }]
13
+ }
14
+ ],
15
+ "Stop": [
16
+ {
17
+ "hooks": [{ "type": "command", "command": "cd \"$CLAUDE_PROJECT_DIR\" && python3 .claude/hooks/before_stop.py" }]
18
+ }
19
+ ]
20
+ }
21
+ }
@@ -0,0 +1,20 @@
1
+ # Dependabot opens pull requests that update Ankor's dependencies (ADR-0031):
2
+ # the Python packages in uv.lock and the GitHub Actions used by the workflows,
3
+ # including the actions pinned to commit SHAs. Minor and patch updates are grouped
4
+ # into one weekly pull request per ecosystem; major updates come one by one.
5
+ version: 2
6
+ updates:
7
+ - package-ecosystem: uv
8
+ directory: /
9
+ schedule:
10
+ interval: weekly
11
+ groups:
12
+ minor-and-patch:
13
+ update-types: [minor, patch]
14
+ - package-ecosystem: github-actions
15
+ directory: /
16
+ schedule:
17
+ interval: weekly
18
+ groups:
19
+ minor-and-patch:
20
+ update-types: [minor, patch]
@@ -0,0 +1,75 @@
1
+ # Continuous integration for Ankor itself.
2
+ #
3
+ # These checks run ruff, mypy and pytest directly; they never go through
4
+ # `ankor check`, so a defect in Ankor cannot hide itself (ADR-0075).
5
+ name: ci
6
+
7
+ # When the workflow runs: on every pull request and on every push to `main`.
8
+
9
+ on:
10
+ pull_request:
11
+ push:
12
+ branches: [main]
13
+
14
+ # A new push to the same branch cancels the run still in progress (saves CI minutes).
15
+ concurrency:
16
+ group: ci-${{ github.ref }}
17
+ cancel-in-progress: true
18
+
19
+ jobs:
20
+ quality:
21
+ name: lint, types and tests (Python ${{ matrix.python }})
22
+ runs-on: ubuntu-latest
23
+ # The job runs once per Python version in the matrix (ADR-0007, ADR-0046).
24
+ strategy:
25
+ fail-fast: false
26
+ matrix:
27
+ python: ["3.12", "3.13"]
28
+ steps:
29
+ - uses: actions/checkout@v7
30
+ with:
31
+ fetch-depth: 0 # full history, so the version can be derived from Git tags
32
+ # Installs uv and the requested Python version, caching downloaded packages.
33
+ - uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7.6.0
34
+ with:
35
+ enable-cache: true
36
+ python-version: ${{ matrix.python }}
37
+ # Installs exactly the versions in uv.lock; fails if the lockfile is out of date.
38
+ - run: uv sync --locked
39
+ # Formatting, lint and security rules, types, and tests.
40
+ - run: uv run ruff format --check .
41
+ - run: uv run ruff check .
42
+ - run: uv run mypy
43
+ - run: uv run pytest
44
+
45
+ # Generates a real project with the `recommended` profile, checks that it starts
46
+ # green and that every tool catches a deliberate mistake (ADR-0038). Slower
47
+ # than the job above (Docker images and Maven downloads), so it runs separately.
48
+ e2e:
49
+ name: end-to-end (recommended)
50
+ runs-on: ubuntu-latest
51
+ steps:
52
+ - uses: actions/checkout@v7
53
+ with:
54
+ fetch-depth: 0
55
+ - uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7.6.0
56
+ with:
57
+ enable-cache: true
58
+ - run: uv sync --locked
59
+ - run: uv run pytest -m e2e tests/e2e
60
+ env:
61
+ ANKOR_E2E: "1"
62
+ ANKOR_E2E_PROFILES: recommended
63
+
64
+ # Builds the documentation site with Zensical in strict mode, which fails on a
65
+ # link to a missing page or anchor (ADR-0083).
66
+ docs:
67
+ name: documentation site
68
+ runs-on: ubuntu-latest
69
+ steps:
70
+ - uses: actions/checkout@v7
71
+ - uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7.6.0
72
+ with:
73
+ enable-cache: true
74
+ - run: uv sync --locked --only-group docs
75
+ - run: uv run --only-group docs zensical build --strict
@@ -0,0 +1,45 @@
1
+ # Publishes the documentation site to GitHub Pages (ADR-0083).
2
+ #
3
+ # It only runs while the repository is public: a private repository keeps its
4
+ # documentation private too. Pages must be enabled once in the repository's
5
+ # settings, with "GitHub Actions" as the source.
6
+ name: docs
7
+
8
+ on:
9
+ push:
10
+ branches: [main]
11
+ workflow_dispatch:
12
+
13
+ permissions:
14
+ contents: read
15
+
16
+ # One publication at a time; a newer one waits instead of cancelling.
17
+ concurrency:
18
+ group: pages
19
+ cancel-in-progress: false
20
+
21
+ jobs:
22
+ build:
23
+ if: ${{ !github.event.repository.private }}
24
+ runs-on: ubuntu-latest
25
+ steps:
26
+ - uses: actions/checkout@v7
27
+ - uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7.6.0
28
+ - run: uv sync --locked --only-group docs
29
+ - run: uv run --only-group docs zensical build --strict
30
+ - uses: actions/upload-pages-artifact@v5
31
+ with:
32
+ path: site
33
+
34
+ deploy:
35
+ needs: build
36
+ runs-on: ubuntu-latest
37
+ permissions:
38
+ pages: write # publish to Pages
39
+ id-token: write # prove the publication comes from this workflow
40
+ environment:
41
+ name: github-pages
42
+ url: ${{ steps.deployment.outputs.page_url }}
43
+ steps:
44
+ - id: deployment
45
+ uses: actions/deploy-pages@v5
@@ -0,0 +1,85 @@
1
+ # Release of Ankor itself (ADR-0049, ADR-0084).
2
+ #
3
+ # Pushing a tag vX.Y.Z (after the release pull request with CHANGELOG.md is
4
+ # merged, see CONTRIBUTING.md) builds the wheel and the source archive with the
5
+ # version taken from the tag, and publishes a GitHub release with:
6
+ # - ankor-X.Y.Z-py3-none-any.whl and ankor-X.Y.Z.tar.gz;
7
+ # - SHA256SUMS, to verify the downloads (`sha256sum -c SHA256SUMS`);
8
+ # - release notes generated by git-cliff from the Conventional Commits.
9
+ # The release is named "Ankor X.Y.Z". Generated projects install Ankor from this
10
+ # wheel in their CI. When the repository is public, a build provenance
11
+ # attestation is added. The `pypi` job then publishes the same two files on PyPI.
12
+ name: release
13
+
14
+ on:
15
+ push:
16
+ tags: ["v*"]
17
+
18
+ permissions:
19
+ contents: write # create the release
20
+ id-token: write # sign the provenance attestation
21
+ attestations: write # store the attestation
22
+
23
+ jobs:
24
+ release:
25
+ runs-on: ubuntu-latest
26
+ steps:
27
+ - uses: actions/checkout@v7
28
+ with:
29
+ fetch-depth: 0 # the version comes from the tag (hatch-vcs) and notes need history
30
+
31
+ # Third-party actions are pinned to a commit SHA, because a tag can be moved
32
+ # to other code; this workflow can publish and sign. Dependabot updates them.
33
+ - uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7.6.0
34
+
35
+ - name: Build the wheel and the source archive
36
+ run: |
37
+ uv build
38
+ (cd dist && sha256sum ./* > SHA256SUMS)
39
+
40
+ - name: Write the release notes
41
+ uses: orhun/git-cliff-action@a9a95522b26fe6403f7bb24031f21fb573d0f5ff # v4.9.1
42
+ with:
43
+ args: --latest --strip header
44
+ env:
45
+ OUTPUT: RELEASE_NOTES.md
46
+
47
+ - name: Attest build provenance (public repositories only)
48
+ if: ${{ !github.event.repository.private }}
49
+ uses: actions/attest-build-provenance@v4
50
+ with:
51
+ subject-path: dist/*
52
+
53
+ - name: Publish the release
54
+ env:
55
+ GH_TOKEN: ${{ github.token }}
56
+ run: |
57
+ gh release create "$GITHUB_REF_NAME" dist/* \
58
+ --title "Ankor ${GITHUB_REF_NAME#v}" --notes-file RELEASE_NOTES.md
59
+
60
+ # Hands the wheel and the source archive to the `pypi` job.
61
+ - uses: actions/upload-artifact@v7
62
+ with:
63
+ name: dist
64
+ path: |
65
+ dist/*.whl
66
+ dist/*.tar.gz
67
+
68
+ # Publishes the wheel and the source archive on PyPI with trusted publishing:
69
+ # PyPI accepts the upload because GitHub proves it comes from this workflow,
70
+ # in this repository, in the `pypi` environment, so no token is stored
71
+ # anywhere. The publisher is configured once on pypi.org (CONTRIBUTING.md).
72
+ pypi:
73
+ needs: release
74
+ runs-on: ubuntu-latest
75
+ environment:
76
+ name: pypi
77
+ url: https://pypi.org/project/ankor/
78
+ permissions:
79
+ id-token: write # the proof PyPI checks
80
+ steps:
81
+ - uses: actions/download-artifact@v8
82
+ with:
83
+ name: dist
84
+ path: dist
85
+ - uses: pypa/gh-action-pypi-publish@7245906fb61fa33a13554f9d5fb856fe61758086 # v1.14.3
@@ -0,0 +1,32 @@
1
+ # Weekly end-to-end run of every analysis profile (ADR-0038, ADR-0046).
2
+ #
3
+ # Pull requests only test the `recommended` profile, to stay fast; this workflow
4
+ # makes sure `basic` and `strict` still work, at most a week after something
5
+ # breaks them. It can also be started by hand from the Actions tab.
6
+ name: weekly
7
+
8
+ on:
9
+ schedule:
10
+ - cron: "0 6 * * 1" # every Monday at 06:00 UTC
11
+ workflow_dispatch:
12
+
13
+ jobs:
14
+ e2e:
15
+ name: end-to-end (${{ matrix.profile }})
16
+ runs-on: ubuntu-latest
17
+ strategy:
18
+ fail-fast: false
19
+ matrix:
20
+ profile: [basic, recommended, strict]
21
+ steps:
22
+ - uses: actions/checkout@v7
23
+ with:
24
+ fetch-depth: 0
25
+ - uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7.6.0
26
+ with:
27
+ enable-cache: true
28
+ - run: uv sync --locked
29
+ - run: uv run pytest -m e2e tests/e2e
30
+ env:
31
+ ANKOR_E2E: "1"
32
+ ANKOR_E2E_PROFILES: ${{ matrix.profile }}
ankor-0.2.1/.gitignore ADDED
@@ -0,0 +1,28 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ .venv/
5
+ dist/
6
+ build/
7
+ *.egg-info/
8
+
9
+ # Tool caches
10
+ .pytest_cache/
11
+ .mypy_cache/
12
+ .ruff_cache/
13
+ .coverage
14
+ htmlcov/
15
+
16
+ # Documentation site build output
17
+ site/
18
+
19
+ # Harness runtime output
20
+ .harness/logs/
21
+ .harness/tasks/
22
+ .harness/profiles/
23
+
24
+ # Secrets
25
+ .env
26
+
27
+ # Graphify knowledge graph (local tooling output)
28
+ graphify-out/
@@ -0,0 +1,54 @@
1
+ # Git hooks for this repository, managed with pre-commit (ADR-0079).
2
+ #
3
+ # Install them once per clone: uv run pre-commit install
4
+ # Run them on every file: uv run pre-commit run --all-files
5
+ #
6
+ # All hooks are "local": they run the tools already installed in the project's
7
+ # virtual environment with `uv run`, so the versions are the ones pinned in uv.lock
8
+ # and CI, the hooks and every developer use exactly the same ruff and mypy.
9
+
10
+ # `pre-commit install` installs all three kinds of hook, not only pre-commit.
11
+ default_install_hook_types: [pre-commit, commit-msg, pre-push]
12
+ # Hooks without their own `stages` run only before a commit; without this line
13
+ # they would also run again at the commit-msg and pre-push stages.
14
+ default_stages: [pre-commit]
15
+
16
+ repos:
17
+ - repo: local
18
+ hooks:
19
+ # Before each commit, on the staged Python files.
20
+ - id: ruff-format
21
+ name: ruff format
22
+ entry: uv run ruff format
23
+ language: system
24
+ types: [python]
25
+ - id: ruff-check
26
+ name: ruff check
27
+ entry: uv run ruff check --fix
28
+ language: system
29
+ types: [python]
30
+ # mypy checks the whole project at once (types cross files), so it ignores
31
+ # the list of changed files and only runs when some Python file changed.
32
+ - id: mypy
33
+ name: mypy
34
+ entry: uv run mypy
35
+ language: system
36
+ types: [python]
37
+ pass_filenames: false
38
+
39
+ # After the message is written: Conventional Commits.
40
+ - id: conventional-commit-message
41
+ name: commit message follows Conventional Commits
42
+ entry: uv run python scripts/check_commit_message.py
43
+ language: system
44
+ stages: [commit-msg]
45
+
46
+ # Before each push: the whole test suite. Kept out of the commit hook so
47
+ # committing stays fast; CI runs it again on every pull request.
48
+ - id: pytest
49
+ name: pytest
50
+ entry: uv run pytest -q
51
+ language: system
52
+ pass_filenames: false
53
+ always_run: true
54
+ stages: [pre-push]
@@ -0,0 +1 @@
1
+ 3.12.16
ankor-0.2.1/AGENTS.md ADDED
@@ -0,0 +1,26 @@
1
+ # Instructions for AI coding agents
2
+
3
+ These instructions apply to any AI agent working on this repository (the harness itself). Until the harness can generate this file for its own repository ([ADR-0075](docs/explanation/adr/0075-dogfooding-the-harness-manages-its-own-repository.md)), it is maintained by hand.
4
+
5
+ ## Before you start
6
+
7
+ 1. Read [`CONTRIBUTING.md`](CONTRIBUTING.md): workflow, commit messages, code conventions and testing rules.
8
+ 2. Read [`docs/explanation/architecture.md`](docs/explanation/architecture.md) and any ADR related to the code you are changing ([index](docs/explanation/adr/README.md)).
9
+ 3. If a change contradicts an accepted ADR, stop and say so instead of changing the behaviour silently.
10
+
11
+ ## Rules
12
+
13
+ - Work on a branch and open a pull request; never commit code directly to `main`.
14
+ - Keep the layering: `cli` → `commands` → `services`. Only `services` may call external tools.
15
+ - Type-annotate all code; keep `ruff` and `mypy` clean.
16
+ - Add tests for new code. Never delete, weaken or skip a test to make it pass.
17
+ - Never call a real AI agent from automated tests.
18
+ - Load YAML only with `yaml.safe_load`. Justify every `subprocess` call flagged by ruff in a comment.
19
+ - Do not modify CI workflows, `CONTRIBUTING.md`, this file or `CLAUDE.md` unless the task explicitly asks for it.
20
+ - Write code, messages and documentation in English.
21
+
22
+ ## Definition of done
23
+
24
+ - `uv run ruff format --check .`, `uv run ruff check .`, `uv run mypy` and `uv run pytest` pass.
25
+ - Documentation and reference pages are updated when behaviour or generated files change.
26
+ - The pull request description explains what changed, why, and how it was verified.