agent-toolkit-cli 1.11.0__py3-none-win_amd64.whl

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 (438) hide show
  1. agent_toolkit/__init__.py +4 -0
  2. agent_toolkit/__main__.py +5 -0
  3. agent_toolkit/_paths.py +145 -0
  4. agent_toolkit/bin/.gitkeep +0 -0
  5. agent_toolkit/bin/agent-toolkit.exe +0 -0
  6. agent_toolkit/cli/__init__.py +0 -0
  7. agent_toolkit/cli/__main__.py +5 -0
  8. agent_toolkit/cli/build.py +278 -0
  9. agent_toolkit/cli/completion.py +297 -0
  10. agent_toolkit/cli/context_budget.py +455 -0
  11. agent_toolkit/cli/devcompanion.py +923 -0
  12. agent_toolkit/cli/devcompanion_queue.py +235 -0
  13. agent_toolkit/cli/diff.py +176 -0
  14. agent_toolkit/cli/doctor.py +1052 -0
  15. agent_toolkit/cli/insights.py +771 -0
  16. agent_toolkit/cli/install.py +706 -0
  17. agent_toolkit/cli/main.py +171 -0
  18. agent_toolkit/cli/mcp.py +537 -0
  19. agent_toolkit/cli/memory.py +739 -0
  20. agent_toolkit/cli/plugin.py +224 -0
  21. agent_toolkit/cli/project.py +459 -0
  22. agent_toolkit/cli/release.py +178 -0
  23. agent_toolkit/cli/skills.py +461 -0
  24. agent_toolkit/cli/uninstall.py +166 -0
  25. agent_toolkit/cli/update.py +298 -0
  26. agent_toolkit/cli/workspace.py +1713 -0
  27. agent_toolkit/compiler/hook_registry.py +110 -0
  28. agent_toolkit/compiler/loader.py +338 -0
  29. agent_toolkit/compiler/mcp_registry.py +87 -0
  30. agent_toolkit/compiler/model.py +182 -0
  31. agent_toolkit/compiler/provenance.py +140 -0
  32. agent_toolkit/compiler/registry_emit.py +263 -0
  33. agent_toolkit/compiler/target_registry.py +122 -0
  34. agent_toolkit/compiler/targets/__init__.py +1 -0
  35. agent_toolkit/compiler/targets/agent_plugins.py +160 -0
  36. agent_toolkit/compiler/targets/base.py +229 -0
  37. agent_toolkit/compiler/targets/claude_code.py +241 -0
  38. agent_toolkit/compiler/targets/codex.py +261 -0
  39. agent_toolkit/compiler/targets/copilot.py +275 -0
  40. agent_toolkit/compiler/targets/cursor.py +207 -0
  41. agent_toolkit/compiler/targets/gemini_cli.py +213 -0
  42. agent_toolkit/compiler/targets/muse_code.py +113 -0
  43. agent_toolkit/compiler/targets/opencode.py +204 -0
  44. agent_toolkit/compiler/targets/pi.py +263 -0
  45. agent_toolkit/compiler/targets/windsurf.py +267 -0
  46. agent_toolkit/compiler/tool_mapping.py +83 -0
  47. agent_toolkit/data/.gitignore +4 -0
  48. agent_toolkit/data/__init__.py +1 -0
  49. agent_toolkit/data/agents/agentic-security-reviewer/AGENT.md +60 -0
  50. agent_toolkit/data/agents/architect/AGENT.md +30 -0
  51. agent_toolkit/data/agents/assistant/AGENT.md +59 -0
  52. agent_toolkit/data/agents/build-error-resolver/AGENT.md +30 -0
  53. agent_toolkit/data/agents/client-workflow-bootstrap/AGENT.md +60 -0
  54. agent_toolkit/data/agents/code-reviewer/AGENT.md +49 -0
  55. agent_toolkit/data/agents/database-reviewer/AGENT.md +44 -0
  56. agent_toolkit/data/agents/docs-lookup/AGENT.md +28 -0
  57. agent_toolkit/data/agents/e2e-runner/AGENT.md +38 -0
  58. agent_toolkit/data/agents/performance-optimizer/AGENT.md +52 -0
  59. agent_toolkit/data/agents/planner/AGENT.md +41 -0
  60. agent_toolkit/data/agents/refactor-cleaner/AGENT.md +43 -0
  61. agent_toolkit/data/agents/reference-lookup/AGENT.md +33 -0
  62. agent_toolkit/data/agents/security-reviewer/AGENT.md +47 -0
  63. agent_toolkit/data/agents/tdd-guide/AGENT.md +58 -0
  64. agent_toolkit/data/agents/tech-assistant/AGENT.md +11 -0
  65. agent_toolkit/data/agents/typescript-reviewer/AGENT.md +61 -0
  66. agent_toolkit/data/capabilities/hooks/README.md +6 -0
  67. agent_toolkit/data/capabilities/hooks/pre-commit-validate.yaml +26 -0
  68. agent_toolkit/data/capabilities/hooks/scripts/pre-commit-validate.sh +41 -0
  69. agent_toolkit/data/capabilities/hooks/scripts/session-start-context.sh +11 -0
  70. agent_toolkit/data/capabilities/hooks/session-start-context.yaml +23 -0
  71. agent_toolkit/data/capabilities/targets/registry.yaml +90 -0
  72. agent_toolkit/data/capabilities/upstream.lock +118 -0
  73. agent_toolkit/data/catalogs/agent-catalog.yaml +81 -0
  74. agent_toolkit/data/catalogs/loop-catalog.yaml +55 -0
  75. agent_toolkit/data/catalogs/skill-catalog.yaml +520 -0
  76. agent_toolkit/data/catalogs/skills-layout.json +391 -0
  77. agent_toolkit/data/distributions/products.yaml +190 -0
  78. agent_toolkit/data/distributions/targets/claude-code.yaml +47 -0
  79. agent_toolkit/data/distributions/targets/cursor.yaml +42 -0
  80. agent_toolkit/data/distributions/targets/opencode.yaml +55 -0
  81. agent_toolkit/data/loops/changelog-drafter/loop.yaml +40 -0
  82. agent_toolkit/data/loops/ci-sweeper/loop.yaml +53 -0
  83. agent_toolkit/data/loops/daily-triage/loop.yaml +47 -0
  84. agent_toolkit/data/loops/dep-sweeper/loop.yaml +46 -0
  85. agent_toolkit/data/loops/issue-triage/loop.yaml +40 -0
  86. agent_toolkit/data/loops/oss-daily-briefing/loop.yaml +65 -0
  87. agent_toolkit/data/loops/oss-pr-monitor/loop.yaml +86 -0
  88. agent_toolkit/data/loops/oss-triage/loop.yaml +67 -0
  89. agent_toolkit/data/loops/post-merge-cleanup/loop.yaml +44 -0
  90. agent_toolkit/data/loops/pr-babysitter/loop.yaml +46 -0
  91. agent_toolkit/data/mcp/registry/chrome-devtools.yaml +61 -0
  92. agent_toolkit/data/mcp/registry/clickup.yaml +48 -0
  93. agent_toolkit/data/mcp/registry/figma.yaml +44 -0
  94. agent_toolkit/data/mcp/registry/github.yaml +52 -0
  95. agent_toolkit/data/mcp/registry/linear.yaml +47 -0
  96. agent_toolkit/data/mcp/registry/notion.yaml +48 -0
  97. agent_toolkit/data/mcp/registry/slack.yaml +46 -0
  98. agent_toolkit/data/mcp/templates/chrome-devtools/README.md +57 -0
  99. agent_toolkit/data/mcp/templates/chrome-devtools/config.template.json +6 -0
  100. agent_toolkit/data/mcp/templates/clickup/README.md +45 -0
  101. agent_toolkit/data/mcp/templates/clickup/config.template.json +8 -0
  102. agent_toolkit/data/mcp/templates/clickup/wrapper.sh +23 -0
  103. agent_toolkit/data/mcp/templates/figma/README.md +54 -0
  104. agent_toolkit/data/mcp/templates/figma/config.template.json +9 -0
  105. agent_toolkit/data/mcp/templates/github/README.md +16 -0
  106. agent_toolkit/data/mcp/templates/github/config.template.json +15 -0
  107. agent_toolkit/data/mcp/templates/github/wrapper.sh +6 -0
  108. agent_toolkit/data/mcp/templates/linear/README.md +49 -0
  109. agent_toolkit/data/mcp/templates/linear/config.template.json +10 -0
  110. agent_toolkit/data/mcp/templates/notion/README.md +7 -0
  111. agent_toolkit/data/mcp/templates/notion/config.template.json +8 -0
  112. agent_toolkit/data/mcp/templates/notion/wrapper.sh +23 -0
  113. agent_toolkit/data/mcp/templates/slack/README.md +8 -0
  114. agent_toolkit/data/mcp/templates/slack/config.template.json +9 -0
  115. agent_toolkit/data/mcp/templates/slack/wrapper.sh +23 -0
  116. agent_toolkit/data/packs/README.md +66 -0
  117. agent_toolkit/data/packs/agentic-security/README.md +19 -0
  118. agent_toolkit/data/packs/agentic-security/config.yaml +25 -0
  119. agent_toolkit/data/packs/architecture/README.md +22 -0
  120. agent_toolkit/data/packs/architecture/config.yaml +27 -0
  121. agent_toolkit/data/packs/code-quality/README.md +19 -0
  122. agent_toolkit/data/packs/code-quality/config.yaml +21 -0
  123. agent_toolkit/data/packs/delivery-discipline/README.md +19 -0
  124. agent_toolkit/data/packs/delivery-discipline/config.yaml +42 -0
  125. agent_toolkit/data/packs/design-engineering/README.md +19 -0
  126. agent_toolkit/data/packs/design-engineering/config.yaml +41 -0
  127. agent_toolkit/data/packs/engineering-workflow/README.md +21 -0
  128. agent_toolkit/data/packs/engineering-workflow/config.yaml +57 -0
  129. agent_toolkit/data/packs/oss-maintenance/README.md +245 -0
  130. agent_toolkit/data/packs/oss-maintenance/config.yaml +75 -0
  131. agent_toolkit/data/profiles/claude-code/CLAUDE.md +110 -0
  132. agent_toolkit/data/profiles/claude-code/agents/assistant.md +59 -0
  133. agent_toolkit/data/profiles/claude-code/agents/build-error-resolver.md +30 -0
  134. agent_toolkit/data/profiles/claude-code/agents/client-workflow-bootstrap.md +60 -0
  135. agent_toolkit/data/profiles/claude-code/agents/contribution-planner.md +39 -0
  136. agent_toolkit/data/profiles/claude-code/agents/database-reviewer.md +44 -0
  137. agent_toolkit/data/profiles/claude-code/agents/docs-lookup.md +28 -0
  138. agent_toolkit/data/profiles/claude-code/agents/e2e-runner.md +38 -0
  139. agent_toolkit/data/profiles/claude-code/agents/performance-optimizer.md +52 -0
  140. agent_toolkit/data/profiles/claude-code/agents/planner.md +41 -0
  141. agent_toolkit/data/profiles/claude-code/agents/refactor-cleaner.md +43 -0
  142. agent_toolkit/data/profiles/claude-code/agents/reference-lookup.md +33 -0
  143. agent_toolkit/data/profiles/claude-code/agents/security-reviewer.md +47 -0
  144. agent_toolkit/data/profiles/claude-code/agents/tdd-guide.md +58 -0
  145. agent_toolkit/data/profiles/claude-code/agents/typescript-reviewer.md +61 -0
  146. agent_toolkit/data/profiles/claude-code/settings.json +86 -0
  147. agent_toolkit/data/profiles/copilot/copilot-instructions.md +15 -0
  148. agent_toolkit/data/profiles/cursor/README.md +33 -0
  149. agent_toolkit/data/profiles/cursor/rules/architect.mdc +23 -0
  150. agent_toolkit/data/profiles/cursor/rules/assistant.mdc +61 -0
  151. agent_toolkit/data/profiles/cursor/rules/build-error-resolver.mdc +20 -0
  152. agent_toolkit/data/profiles/cursor/rules/code-reviewer.mdc +21 -0
  153. agent_toolkit/data/profiles/cursor/rules/database-reviewer.mdc +29 -0
  154. agent_toolkit/data/profiles/cursor/rules/docs-lookup.mdc +15 -0
  155. agent_toolkit/data/profiles/cursor/rules/e2e-runner.mdc +30 -0
  156. agent_toolkit/data/profiles/cursor/rules/performance-optimizer.mdc +27 -0
  157. agent_toolkit/data/profiles/cursor/rules/planner.mdc +28 -0
  158. agent_toolkit/data/profiles/cursor/rules/refactor-cleaner.mdc +26 -0
  159. agent_toolkit/data/profiles/cursor/rules/reference-lookup.mdc +20 -0
  160. agent_toolkit/data/profiles/cursor/rules/security-reviewer.mdc +20 -0
  161. agent_toolkit/data/profiles/cursor/rules/tdd-guide.mdc +26 -0
  162. agent_toolkit/data/profiles/cursor/rules/typescript-reviewer.mdc +28 -0
  163. agent_toolkit/data/profiles/muse-code/README.md +35 -0
  164. agent_toolkit/data/profiles/opencode/README.md +44 -0
  165. agent_toolkit/data/profiles/opencode/agents/architect.md +30 -0
  166. agent_toolkit/data/profiles/opencode/agents/assistant.md +96 -0
  167. agent_toolkit/data/profiles/opencode/agents/build-error-resolver.md +31 -0
  168. agent_toolkit/data/profiles/opencode/agents/client-workflow-bootstrap.md +66 -0
  169. agent_toolkit/data/profiles/opencode/agents/code-reviewer.md +47 -0
  170. agent_toolkit/data/profiles/opencode/agents/contribution-planner.md +44 -0
  171. agent_toolkit/data/profiles/opencode/agents/database-reviewer.md +43 -0
  172. agent_toolkit/data/profiles/opencode/agents/docs-lookup.md +28 -0
  173. agent_toolkit/data/profiles/opencode/agents/e2e-runner.md +33 -0
  174. agent_toolkit/data/profiles/opencode/agents/performance-optimizer.md +34 -0
  175. agent_toolkit/data/profiles/opencode/agents/planner.md +27 -0
  176. agent_toolkit/data/profiles/opencode/agents/refactor-cleaner.md +27 -0
  177. agent_toolkit/data/profiles/opencode/agents/reference-lookup.md +27 -0
  178. agent_toolkit/data/profiles/opencode/agents/security-reviewer.md +27 -0
  179. agent_toolkit/data/profiles/opencode/agents/tdd-guide.md +27 -0
  180. agent_toolkit/data/profiles/opencode/agents/typescript-reviewer.md +30 -0
  181. agent_toolkit/data/profiles/opencode/opencode.json +3 -0
  182. agent_toolkit/data/profiles/pi/skills/architect/skill.md +5 -0
  183. agent_toolkit/data/profiles/pi/skills/assistant/skill.md +3 -0
  184. agent_toolkit/data/profiles/pi/skills/code-reviewer/skill.md +5 -0
  185. agent_toolkit/data/profiles/pi/skills/planner/skill.md +3 -0
  186. agent_toolkit/data/profiles/pi/skills/security-reviewer/skill.md +3 -0
  187. agent_toolkit/data/profiles/windsurf/memories/global_rules.md +114 -0
  188. agent_toolkit/data/profiles/windsurf/rules/architect.mdc +23 -0
  189. agent_toolkit/data/profiles/windsurf/rules/assistant.mdc +61 -0
  190. agent_toolkit/data/profiles/windsurf/rules/build-error-resolver.mdc +20 -0
  191. agent_toolkit/data/profiles/windsurf/rules/code-reviewer.mdc +21 -0
  192. agent_toolkit/data/profiles/windsurf/rules/database-reviewer.mdc +29 -0
  193. agent_toolkit/data/profiles/windsurf/rules/docs-lookup.mdc +15 -0
  194. agent_toolkit/data/profiles/windsurf/rules/e2e-runner.mdc +30 -0
  195. agent_toolkit/data/profiles/windsurf/rules/performance-optimizer.mdc +27 -0
  196. agent_toolkit/data/profiles/windsurf/rules/planner.mdc +28 -0
  197. agent_toolkit/data/profiles/windsurf/rules/refactor-cleaner.mdc +26 -0
  198. agent_toolkit/data/profiles/windsurf/rules/reference-lookup.mdc +20 -0
  199. agent_toolkit/data/profiles/windsurf/rules/security-reviewer.mdc +20 -0
  200. agent_toolkit/data/profiles/windsurf/rules/tdd-guide.mdc +26 -0
  201. agent_toolkit/data/profiles/windsurf/rules/typescript-reviewer.mdc +28 -0
  202. agent_toolkit/data/skills/accessibility/review/SKILL.md +116 -0
  203. agent_toolkit/data/skills/accessibility/review/references/a11y-checklist.md +25 -0
  204. agent_toolkit/data/skills/accessibility/review/references/a11y-findings-template.md +56 -0
  205. agent_toolkit/data/skills/accessibility/review/references/research.md +47 -0
  206. agent_toolkit/data/skills/agentic-security/mcp-audit/SKILL.md +116 -0
  207. agent_toolkit/data/skills/agentic-security/mcp-audit/references/mcp-audit-template.md +51 -0
  208. agent_toolkit/data/skills/agentic-security/owasp-agentic-review/SKILL.md +73 -0
  209. agent_toolkit/data/skills/agentic-security/owasp-agentic-review/references/owasp-agentic-template.md +32 -0
  210. agent_toolkit/data/skills/agentic-security/supply-chain-audit/SKILL.md +142 -0
  211. agent_toolkit/data/skills/agentic-security/threat-modeling/SKILL.md +100 -0
  212. agent_toolkit/data/skills/agentic-security/threat-modeling/references/threat-model-template.md +55 -0
  213. agent_toolkit/data/skills/architecture/c4-model/SKILL.md +49 -0
  214. agent_toolkit/data/skills/cloud/aws-well-architected-review/SKILL.md +37 -0
  215. agent_toolkit/data/skills/cloud/cloud-design-patterns/SKILL.md +38 -0
  216. agent_toolkit/data/skills/core/assistant/SKILL.md +216 -0
  217. agent_toolkit/data/skills/core/assistant/references/AGENTS_TEMPLATE.md +0 -0
  218. agent_toolkit/data/skills/core/assistant/references/ORCHESTRATION.md +0 -0
  219. agent_toolkit/data/skills/core/assistant/references/REPO_INSPECTION.md +0 -0
  220. agent_toolkit/data/skills/core/dev-companion/SKILL.md +65 -0
  221. agent_toolkit/data/skills/core/dev-companion/references/LOOP_GUARDRAILS.md +0 -0
  222. agent_toolkit/data/skills/core/onboarding/SKILL.md +122 -0
  223. agent_toolkit/data/skills/core/output-handshake/SKILL.md +26 -0
  224. agent_toolkit/data/skills/core/pr-fallback/SKILL.md +35 -0
  225. agent_toolkit/data/skills/core/pr-fallback/references/pr-body-default.md +0 -0
  226. agent_toolkit/data/skills/core/project/SKILL.md +89 -0
  227. agent_toolkit/data/skills/core/workspace/SKILL.md +103 -0
  228. agent_toolkit/data/skills/core/workspace-knowledge-sync/SKILL.md +140 -0
  229. agent_toolkit/data/skills/data/dbt-validation/SKILL.md +41 -0
  230. agent_toolkit/data/skills/data/snowflake-validation/SKILL.md +38 -0
  231. agent_toolkit/data/skills/delivery/adr/SKILL.md +56 -0
  232. agent_toolkit/data/skills/delivery/adr/references/default-template.md +35 -0
  233. agent_toolkit/data/skills/delivery/adr/references/example-001-graphql-adoption.md +66 -0
  234. agent_toolkit/data/skills/delivery/agreement/SKILL.md +24 -0
  235. agent_toolkit/data/skills/delivery/agreement/references/default-template.md +17 -0
  236. agent_toolkit/data/skills/delivery/agreement/references/example-api-versioning.md +29 -0
  237. agent_toolkit/data/skills/delivery/bug/SKILL.md +26 -0
  238. agent_toolkit/data/skills/delivery/bug/references/default-template.md +26 -0
  239. agent_toolkit/data/skills/delivery/bug/references/example-search-filter-bug.md +58 -0
  240. agent_toolkit/data/skills/delivery/decision-log/SKILL.md +28 -0
  241. agent_toolkit/data/skills/delivery/decision-log/references/default-template.md +17 -0
  242. agent_toolkit/data/skills/delivery/decision-log/references/example-repository-pattern.md +27 -0
  243. agent_toolkit/data/skills/delivery/development-workflow/SKILL.md +34 -0
  244. agent_toolkit/data/skills/delivery/development-workflow/references/default-workflow-checklist.md +44 -0
  245. agent_toolkit/data/skills/delivery/epic/SKILL.md +22 -0
  246. agent_toolkit/data/skills/delivery/epic/references/default-template.md +26 -0
  247. agent_toolkit/data/skills/delivery/epic/references/example-unified-dashboard.md +40 -0
  248. agent_toolkit/data/skills/delivery/incident/SKILL.md +24 -0
  249. agent_toolkit/data/skills/delivery/incident/references/default-template.md +29 -0
  250. agent_toolkit/data/skills/delivery/incident/references/example-payment-outage.md +62 -0
  251. agent_toolkit/data/skills/delivery/management-unit-assessment/SKILL.md +104 -0
  252. agent_toolkit/data/skills/delivery/management-unit-assessment/references/default-template.md +24 -0
  253. agent_toolkit/data/skills/delivery/management-unit-assessment/references/example-team-assessment.md +126 -0
  254. agent_toolkit/data/skills/delivery/meeting-minutes/SKILL.md +25 -0
  255. agent_toolkit/data/skills/delivery/meeting-minutes/references/default-template.md +22 -0
  256. agent_toolkit/data/skills/delivery/meeting-minutes/references/example-weekly-sync.md +72 -0
  257. agent_toolkit/data/skills/delivery/planning/SKILL.md +31 -0
  258. agent_toolkit/data/skills/delivery/planning/references/default-template.md +25 -0
  259. agent_toolkit/data/skills/delivery/planning/references/example-sprint-planning.md +62 -0
  260. agent_toolkit/data/skills/delivery/prd/SKILL.md +46 -0
  261. agent_toolkit/data/skills/delivery/prd/references/default-template.md +31 -0
  262. agent_toolkit/data/skills/delivery/prd/references/example-unified-api.md +71 -0
  263. agent_toolkit/data/skills/delivery/project-assessment/SKILL.md +90 -0
  264. agent_toolkit/data/skills/delivery/project-assessment/references/default-template.md +26 -0
  265. agent_toolkit/data/skills/delivery/project-assessment/references/example-platform-assessment.md +122 -0
  266. agent_toolkit/data/skills/delivery/project-assessment-evidence/SKILL.md +88 -0
  267. agent_toolkit/data/skills/delivery/project-assessment-evidence/references/default-template.md +24 -0
  268. agent_toolkit/data/skills/delivery/project-assessment-evidence/references/example-evidence-map.md +46 -0
  269. agent_toolkit/data/skills/delivery/spike/SKILL.md +24 -0
  270. agent_toolkit/data/skills/delivery/spike/references/default-template.md +29 -0
  271. agent_toolkit/data/skills/delivery/spike/references/example-graphql-federation.md +79 -0
  272. agent_toolkit/data/skills/delivery/task/SKILL.md +21 -0
  273. agent_toolkit/data/skills/delivery/task/references/default-template.md +21 -0
  274. agent_toolkit/data/skills/delivery/task/references/example-nav-system.md +33 -0
  275. agent_toolkit/data/skills/delivery/technical-unit-assessment/SKILL.md +58 -0
  276. agent_toolkit/data/skills/delivery/technical-unit-assessment/references/default-template.md +26 -0
  277. agent_toolkit/data/skills/delivery/technical-unit-assessment/references/example-frontend-assessment.md +112 -0
  278. agent_toolkit/data/skills/delivery/technical-unit-assessment/references/indicator-groups.md +65 -0
  279. agent_toolkit/data/skills/delivery/trd/SKILL.md +49 -0
  280. agent_toolkit/data/skills/delivery/trd/references/default-template.md +31 -0
  281. agent_toolkit/data/skills/delivery/trd/references/example-api-migration.md +122 -0
  282. agent_toolkit/data/skills/delivery/user-story/SKILL.md +21 -0
  283. agent_toolkit/data/skills/delivery/user-story/references/default-template.md +21 -0
  284. agent_toolkit/data/skills/delivery/user-story/references/example-advanced-filtering.md +37 -0
  285. agent_toolkit/data/skills/delivery/work-item/SKILL.md +31 -0
  286. agent_toolkit/data/skills/delivery/work-item/references/default-template.md +21 -0
  287. agent_toolkit/data/skills/delivery/work-item/references/example-routing-dashboard.md +23 -0
  288. agent_toolkit/data/skills/delivery/workflow-client-bootstrap/SKILL.md +148 -0
  289. agent_toolkit/data/skills/delivery/workflow-client-bootstrap/questions.yaml +165 -0
  290. agent_toolkit/data/skills/delivery/workflow-generic-project/SKILL.md +79 -0
  291. agent_toolkit/data/skills/design/design-assessment/SKILL.md +150 -0
  292. agent_toolkit/data/skills/design/design-assessment/references/design-scorecard-template.md +78 -0
  293. agent_toolkit/data/skills/design/design-improvement/SKILL.md +167 -0
  294. agent_toolkit/data/skills/design/design-improvement/references/improvement-plan-template.md +113 -0
  295. agent_toolkit/data/skills/design/figma/LICENSE.txt +2 -0
  296. agent_toolkit/data/skills/design/figma/NOTICE.txt +25 -0
  297. agent_toolkit/data/skills/design/figma/SKILL.md +98 -0
  298. agent_toolkit/data/skills/design/figma/references/figma-mcp-config.md +82 -0
  299. agent_toolkit/data/skills/design/figma/references/figma-tools-and-prompts.md +34 -0
  300. agent_toolkit/data/skills/design/figma-code-connect-components/LICENSE.txt +2 -0
  301. agent_toolkit/data/skills/design/figma-code-connect-components/NOTICE.txt +18 -0
  302. agent_toolkit/data/skills/design/figma-code-connect-components/SKILL.md +354 -0
  303. agent_toolkit/data/skills/design/figma-code-connect-components/references/mapping-checklist.md +7 -0
  304. agent_toolkit/data/skills/design/figma-code-connect-components/scripts/normalize_node_id.py +25 -0
  305. agent_toolkit/data/skills/design/figma-create-design-system-rules/LICENSE.txt +2 -0
  306. agent_toolkit/data/skills/design/figma-create-design-system-rules/NOTICE.txt +19 -0
  307. agent_toolkit/data/skills/design/figma-create-design-system-rules/SKILL.md +554 -0
  308. agent_toolkit/data/skills/design/figma-create-design-system-rules/references/rule-template.md +15 -0
  309. agent_toolkit/data/skills/design/figma-create-design-system-rules/scripts/check_agents_md.sh +9 -0
  310. agent_toolkit/data/skills/design/figma-create-new-file/LICENSE.txt +2 -0
  311. agent_toolkit/data/skills/design/figma-create-new-file/NOTICE.txt +17 -0
  312. agent_toolkit/data/skills/design/figma-create-new-file/SKILL.md +72 -0
  313. agent_toolkit/data/skills/design/figma-implement-design/LICENSE.txt +2 -0
  314. agent_toolkit/data/skills/design/figma-implement-design/NOTICE.txt +19 -0
  315. agent_toolkit/data/skills/design/figma-implement-design/SKILL.md +268 -0
  316. agent_toolkit/data/skills/design/frontend-design/LICENSE.txt +177 -0
  317. agent_toolkit/data/skills/design/frontend-design/SKILL.md +82 -0
  318. agent_toolkit/data/skills/design/frontend-design/UPSTREAM.md +14 -0
  319. agent_toolkit/data/skills/design/frontend-design-review/LICENSE +21 -0
  320. agent_toolkit/data/skills/design/frontend-design-review/SKILL.md +194 -0
  321. agent_toolkit/data/skills/design/frontend-design-review/references/pattern-examples.md +21 -0
  322. agent_toolkit/data/skills/design/frontend-design-review/references/quick-checklist.md +38 -0
  323. agent_toolkit/data/skills/design/frontend-design-review/references/review-output-format.md +68 -0
  324. agent_toolkit/data/skills/design/frontend-design-review/references/review-type-modifiers.md +31 -0
  325. agent_toolkit/data/skills/design/web-design-guidelines/SKILL.md +78 -0
  326. agent_toolkit/data/skills/design/web-design-guidelines/references/LICENSE +21 -0
  327. agent_toolkit/data/skills/design/web-design-guidelines/references/web-interface-guidelines.md +180 -0
  328. agent_toolkit/data/skills/forge/gh-address-comments/LICENSE.txt +202 -0
  329. agent_toolkit/data/skills/forge/gh-address-comments/NOTICE.txt +20 -0
  330. agent_toolkit/data/skills/forge/gh-address-comments/SKILL.md +72 -0
  331. agent_toolkit/data/skills/forge/gh-address-comments/scripts/fetch_comments.py +239 -0
  332. agent_toolkit/data/skills/forge/gh-contribution-planner/SKILL.md +160 -0
  333. agent_toolkit/data/skills/forge/gh-contribution-planner/scripts/inspect_contributions.py +818 -0
  334. agent_toolkit/data/skills/forge/gh-fix-ci/LICENSE.txt +201 -0
  335. agent_toolkit/data/skills/forge/gh-fix-ci/NOTICE.txt +20 -0
  336. agent_toolkit/data/skills/forge/gh-fix-ci/SKILL.md +74 -0
  337. agent_toolkit/data/skills/forge/gh-fix-ci/scripts/inspect_pr_checks.py +509 -0
  338. agent_toolkit/data/skills/forge/github-cli-workflow/SKILL.md +49 -0
  339. agent_toolkit/data/skills/forge/gitlab-cli-workflow/SKILL.md +44 -0
  340. agent_toolkit/data/skills/forge/workflow-client-bootstrap/SKILL.md +14 -0
  341. agent_toolkit/data/skills/forge/workflow-generic-project/SKILL.md +14 -0
  342. agent_toolkit/data/skills/forge/worktree/SKILL.md +113 -0
  343. agent_toolkit/data/skills/integrations/clickup-cli/SKILL.md +78 -0
  344. agent_toolkit/data/skills/integrations/clickup-cli/references/docs-management.md +57 -0
  345. agent_toolkit/data/skills/integrations/clickup-cli/references/task-management.md +131 -0
  346. agent_toolkit/data/skills/integrations/clickup-cli/references/time-tracking.md +38 -0
  347. agent_toolkit/data/skills/integrations/linear/LICENSE.txt +202 -0
  348. agent_toolkit/data/skills/integrations/linear/NOTICE.txt +23 -0
  349. agent_toolkit/data/skills/integrations/linear/SKILL.md +134 -0
  350. agent_toolkit/data/skills/integrations/mcp/SKILL.md +88 -0
  351. agent_toolkit/data/skills/integrations/slack-assistant/SKILL.md +138 -0
  352. agent_toolkit/data/skills/integrations/slack-cli/SKILL.md +109 -0
  353. agent_toolkit/data/skills/integrations/slack-cli/references/INSTALLATION.md +42 -0
  354. agent_toolkit/data/skills/loops/loop-runner/SKILL.md +92 -0
  355. agent_toolkit/data/skills/ops/docs-generator/SKILL.md +120 -0
  356. agent_toolkit/data/skills/ops/llm-cost-advisor/SKILL.md +87 -0
  357. agent_toolkit/data/skills/ops/swarm/SKILL.md +108 -0
  358. agent_toolkit/data/skills/ops/swarm-handoff/SKILL.md +112 -0
  359. agent_toolkit/data/skills/ops/swarm-observer/SKILL.md +102 -0
  360. agent_toolkit/data/skills/ops/triage/SKILL.md +119 -0
  361. agent_toolkit/data/skills/quality/codeql/SKILL.md +106 -0
  362. agent_toolkit/data/skills/quality/codeql/references/codeql-queries.md +43 -0
  363. agent_toolkit/data/skills/quality/megalinter/SKILL.md +162 -0
  364. agent_toolkit/data/skills/quality/megalinter/references/megalinter-images.md +36 -0
  365. agent_toolkit/data/skills/quality/megalinter/references/megalinter-license.md +41 -0
  366. agent_toolkit/data/skills/quality/megalinter/references/megalinter-targets.md +66 -0
  367. agent_toolkit/data/skills/tooling/chrome-devtools/SKILL.md +146 -0
  368. agent_toolkit/data/skills/tooling/herdr/SKILL.md +109 -0
  369. agent_toolkit/data/skills/tooling/inventory/SKILL.md +81 -0
  370. agent_toolkit/data/skills/tooling/jupyter-notebook/LICENSE.txt +201 -0
  371. agent_toolkit/data/skills/tooling/jupyter-notebook/NOTICE.txt +27 -0
  372. agent_toolkit/data/skills/tooling/jupyter-notebook/SKILL.md +145 -0
  373. agent_toolkit/data/skills/tooling/jupyter-notebook/assets/experiment-template.ipynb +117 -0
  374. agent_toolkit/data/skills/tooling/jupyter-notebook/assets/tutorial-template.ipynb +115 -0
  375. agent_toolkit/data/skills/tooling/jupyter-notebook/references/experiment-patterns.md +10 -0
  376. agent_toolkit/data/skills/tooling/jupyter-notebook/references/notebook-structure.md +17 -0
  377. agent_toolkit/data/skills/tooling/jupyter-notebook/references/quality-checklist.md +11 -0
  378. agent_toolkit/data/skills/tooling/jupyter-notebook/references/tutorial-patterns.md +9 -0
  379. agent_toolkit/data/skills/tooling/jupyter-notebook/scripts/new_notebook.py +132 -0
  380. agent_toolkit/data/skills/tooling/mermaid/SKILL.md +36 -0
  381. agent_toolkit/data/skills/tooling/playwright-cli/LICENSE.txt +201 -0
  382. agent_toolkit/data/skills/tooling/playwright-cli/NOTICE.txt +29 -0
  383. agent_toolkit/data/skills/tooling/playwright-cli/SKILL.md +154 -0
  384. agent_toolkit/data/skills/tooling/playwright-cli/references/cli.md +116 -0
  385. agent_toolkit/data/skills/tooling/playwright-cli/references/workflows.md +98 -0
  386. agent_toolkit/data/skills/tooling/playwright-cli/scripts/executable_playwright_cli.sh +25 -0
  387. agent_toolkit/data_cache.py +79 -0
  388. agent_toolkit/data_sync.py +144 -0
  389. agent_toolkit/installer/__init__.py +0 -0
  390. agent_toolkit/installer/merge.py +59 -0
  391. agent_toolkit/installer/receipt.py +89 -0
  392. agent_toolkit/installer/sources.py +92 -0
  393. agent_toolkit/installer/tracking.py +63 -0
  394. agent_toolkit/launcher.py +69 -0
  395. agent_toolkit/loop/__init__.py +0 -0
  396. agent_toolkit/loop/budget.py +107 -0
  397. agent_toolkit/loop/gh_gate.py +923 -0
  398. agent_toolkit/loop/loop-gh-gate +923 -0
  399. agent_toolkit/loop/pack.py +65 -0
  400. agent_toolkit/loop/runner.py +2722 -0
  401. agent_toolkit/runner/__init__.py +0 -0
  402. agent_toolkit/runner/dispatcher.py +163 -0
  403. agent_toolkit/runner/policy.py +356 -0
  404. agent_toolkit/runner/providers/__init__.py +21 -0
  405. agent_toolkit/runner/providers/anthropic_provider.py +109 -0
  406. agent_toolkit/runner/providers/base.py +53 -0
  407. agent_toolkit/runner/providers/ollama_provider.py +108 -0
  408. agent_toolkit/runner/providers/openai_provider.py +103 -0
  409. agent_toolkit/runner/providers/opencode_provider.py +127 -0
  410. agent_toolkit/swarm/__init__.py +5 -0
  411. agent_toolkit/swarm/approvals.py +121 -0
  412. agent_toolkit/swarm/backends/__init__.py +596 -0
  413. agent_toolkit/swarm/budget.py +83 -0
  414. agent_toolkit/swarm/cli.py +2448 -0
  415. agent_toolkit/swarm/config.py +351 -0
  416. agent_toolkit/swarm/handoff.py +174 -0
  417. agent_toolkit/swarm/models.py +230 -0
  418. agent_toolkit/swarm/prompts.py +177 -0
  419. agent_toolkit/swarm/recipes.py +304 -0
  420. agent_toolkit/swarm/runner.py +267 -0
  421. agent_toolkit/swarm/state.py +93 -0
  422. agent_toolkit/swarm/store.py +148 -0
  423. agent_toolkit/swarm/worktree.py +105 -0
  424. agent_toolkit/templates/workspace/.gitignore +19 -0
  425. agent_toolkit/templates/workspace/AGENTS.md +82 -0
  426. agent_toolkit/templates/workspace/knowledge/README.md +22 -0
  427. agent_toolkit/templates/workspace/knowledge/learnings/general.md +3 -0
  428. agent_toolkit/templates/workspace/knowledge/todos/pending.md +7 -0
  429. agent_toolkit/templates/workspace/packs/README.md +24 -0
  430. agent_toolkit/templates/workspace/personas/architect.md +12 -0
  431. agent_toolkit/templates/workspace/personas/implementer.md +12 -0
  432. agent_toolkit/templates/workspace/personas/researcher.md +12 -0
  433. agent_toolkit/templates/workspace/personas/reviewer.md +12 -0
  434. agent_toolkit_cli-1.11.0.dist-info/METADATA +363 -0
  435. agent_toolkit_cli-1.11.0.dist-info/RECORD +438 -0
  436. agent_toolkit_cli-1.11.0.dist-info/WHEEL +4 -0
  437. agent_toolkit_cli-1.11.0.dist-info/entry_points.txt +4 -0
  438. agent_toolkit_cli-1.11.0.dist-info/licenses/LICENSE +21 -0
@@ -0,0 +1,182 @@
1
+ """
2
+ Canonical intermediate representation for agent-toolkit capabilities.
3
+
4
+ This module defines the platform-neutral capability model that all canonical
5
+ sources (SKILL.md, AGENT.md, loop.yaml, etc.) are parsed into before being
6
+ compiled into target-specific artifacts.
7
+ """
8
+
9
+ from __future__ import annotations
10
+
11
+ from dataclasses import dataclass, field
12
+ from enum import Enum
13
+ from pathlib import Path
14
+ from typing import Any
15
+
16
+
17
+ class Stability(str, Enum):
18
+ STABLE = "stable"
19
+ EXPERIMENTAL = "experimental"
20
+ DEPRECATED = "deprecated"
21
+
22
+
23
+ class ModelClass(str, Enum):
24
+ """Abstract model tier — target adapters map to platform-specific models."""
25
+
26
+ FAST = "fast"
27
+ BALANCED = "balanced"
28
+ DEEP = "deep"
29
+ INHERIT = "inherit"
30
+
31
+
32
+ class AbstractTool(str, Enum):
33
+ """Platform-neutral tool vocabulary. Adapters map to native tool names."""
34
+
35
+ FS_READ = "fs.read"
36
+ FS_SEARCH = "fs.search"
37
+ FS_WRITE = "fs.write"
38
+ SHELL_READONLY = "shell.readonly"
39
+ SHELL_EXECUTE = "shell.execute"
40
+ GIT_READ = "git.read"
41
+ GIT_WRITE = "git.write"
42
+ WEB_SEARCH = "web.search"
43
+ WEB_FETCH = "web.fetch"
44
+ AGENT_DELEGATE = "agent.delegate"
45
+ USER_ASK = "user.ask"
46
+
47
+
48
+ @dataclass
49
+ class Requirement:
50
+ """A runtime requirement for a capability."""
51
+
52
+ name: str
53
+ description: str
54
+ install_url: str = ""
55
+ required: bool = False
56
+ env_var: str = "" # if env-var based, not binary
57
+
58
+
59
+ @dataclass
60
+ class SecurityPolicy:
61
+ approval_required: bool = False
62
+ default_enabled: bool = True
63
+ rationale: str = ""
64
+ no_dangerous_bypass: bool = True
65
+
66
+
67
+ @dataclass
68
+ class Provenance:
69
+ """Tracks the source of a capability for audit."""
70
+
71
+ source_path: Path
72
+ source_hash: str = ""
73
+ generated_by: str = "agent-toolkit"
74
+ generator_version: str = ""
75
+
76
+
77
+ @dataclass
78
+ class Skill:
79
+ """A canonical skill parsed from skills/<domain>/<name>/SKILL.md."""
80
+
81
+ id: str # e.g. "core/assistant"
82
+ name: str # must match directory name
83
+ domain: str # e.g. "core"
84
+ description: str
85
+ stability: Stability = Stability.STABLE
86
+ source_path: Path = field(default_factory=Path)
87
+ tags: list[str] = field(default_factory=list)
88
+ requires: list[Requirement] = field(default_factory=list)
89
+ compatibility: str = "" # human-readable compat note
90
+ metadata: dict[str, Any] = field(default_factory=dict)
91
+ provenance: Provenance | None = None
92
+
93
+
94
+ @dataclass
95
+ class Agent:
96
+ """A canonical agent persona parsed from agents/<name>/AGENT.md."""
97
+
98
+ id: str
99
+ name: str
100
+ description: str
101
+ instructions: str # body of AGENT.md
102
+ model_class: ModelClass = ModelClass.INHERIT
103
+ max_turns: int = 0 # 0 = platform default
104
+ allowed_tools: list[AbstractTool] = field(default_factory=list)
105
+ denied_tools: list[AbstractTool] = field(default_factory=list)
106
+ delegates_to: list[str] = field(default_factory=list)
107
+ read_only: bool = False
108
+ background_eligible: bool = False
109
+ dependent_skills: list[str] = field(default_factory=list)
110
+ dependent_mcp: list[str] = field(default_factory=list)
111
+ stability: Stability = Stability.STABLE
112
+ source_path: Path = field(default_factory=Path)
113
+ metadata: dict[str, Any] = field(default_factory=dict)
114
+ provenance: Provenance | None = None
115
+
116
+
117
+ @dataclass
118
+ class Product:
119
+ """A distributable plugin/bundle product parsed from distributions/products.yaml."""
120
+
121
+ id: str
122
+ name: str
123
+ description: str
124
+ stability: Stability = Stability.STABLE
125
+ included_skills: list[str] = field(default_factory=list) # skill IDs
126
+ included_agents: list[str] = field(default_factory=list) # agent IDs
127
+ included_hooks: list[str] = field(default_factory=list) # hook IDs
128
+ included_mcp: list[str] = field(default_factory=list) # MCP provider IDs
129
+ excluded: list[str] = field(default_factory=list)
130
+ requires: list[Requirement] = field(default_factory=list)
131
+ security: SecurityPolicy = field(default_factory=SecurityPolicy)
132
+ target_overrides: dict[str, Any] = field(default_factory=dict)
133
+
134
+
135
+ @dataclass
136
+ class CanonicalGraph:
137
+ """The resolved capability graph — all canonical sources loaded and validated."""
138
+
139
+ skills: dict[str, Skill] = field(default_factory=dict) # id → Skill
140
+ agents: dict[str, Agent] = field(default_factory=dict) # id → Agent
141
+ products: dict[str, Product] = field(default_factory=dict) # id → Product
142
+ errors: list[str] = field(default_factory=list)
143
+ warnings: list[str] = field(default_factory=list)
144
+
145
+ @property
146
+ def is_valid(self) -> bool:
147
+ return len(self.errors) == 0
148
+
149
+
150
+ @dataclass
151
+ class CompilationResult:
152
+ """Result from a target adapter compilation."""
153
+
154
+ target: str
155
+ product: str
156
+ emitted: list[str] = field(default_factory=list) # capability IDs
157
+ transformed: list[str] = field(default_factory=list) # with degradation
158
+ omitted: list[str] = field(default_factory=list) # safely dropped
159
+ unsupported: list[str] = field(default_factory=list) # not supported
160
+ warnings: list[str] = field(default_factory=list)
161
+ errors: list[str] = field(default_factory=list)
162
+ artifacts: list[Path] = field(default_factory=list)
163
+
164
+ @property
165
+ def is_valid(self) -> bool:
166
+ return len(self.errors) == 0
167
+
168
+ def report(self) -> str:
169
+ lines = [f"Target: {self.target} Product: {self.product}"]
170
+ if self.emitted:
171
+ lines.append(f" ✓ emitted: {', '.join(self.emitted)}")
172
+ if self.transformed:
173
+ lines.append(f" ~ transformed: {', '.join(self.transformed)}")
174
+ if self.omitted:
175
+ lines.append(f" - omitted: {', '.join(self.omitted)}")
176
+ if self.unsupported:
177
+ lines.append(f" ✗ unsupported: {', '.join(self.unsupported)}")
178
+ for w in self.warnings:
179
+ lines.append(f" ⚠ {w}")
180
+ for e in self.errors:
181
+ lines.append(f" ✗ ERROR: {e}")
182
+ return "\n".join(lines)
@@ -0,0 +1,140 @@
1
+ """
2
+ Provenance tracking for generated compiler artifacts.
3
+
4
+ Every generated plugin bundle gets a .provenance.json sidecar that records:
5
+ - Generator version
6
+ - Source file paths and digests for each artifact
7
+ - Build metadata (no timestamps in reproducible content)
8
+
9
+ This enables drift detection: agent-toolkit plugin check compares
10
+ artifact digests against provenance to catch manual edits.
11
+ """
12
+
13
+ from __future__ import annotations
14
+
15
+ import hashlib
16
+ import json
17
+ from dataclasses import dataclass, field
18
+ from pathlib import Path
19
+
20
+
21
+ @dataclass
22
+ class ArtifactRecord:
23
+ """Provenance record for a single generated file."""
24
+
25
+ path: str # relative path from plugin root
26
+ source_file: str # canonical source (e.g. skills/core/assistant/SKILL.md)
27
+ source_digest: str # SHA256[:12] of source content
28
+ generated_digest: str # SHA256[:12] of generated content
29
+
30
+
31
+ @dataclass
32
+ class ProvenanceManifest:
33
+ """Provenance manifest for a complete plugin bundle."""
34
+
35
+ generator_version: str
36
+ product: str
37
+ target: str
38
+ artifacts: list[ArtifactRecord] = field(default_factory=list)
39
+
40
+ def to_dict(self) -> dict:
41
+ return {
42
+ "generatorVersion": self.generator_version,
43
+ "product": self.product,
44
+ "target": self.target,
45
+ "artifacts": [
46
+ {
47
+ "path": a.path,
48
+ "sourceFile": a.source_file,
49
+ "sourceDigest": a.source_digest,
50
+ "generatedDigest": a.generated_digest,
51
+ }
52
+ for a in self.artifacts
53
+ ],
54
+ }
55
+
56
+ def to_json(self) -> str:
57
+ return json.dumps(self.to_dict(), indent=2) + "\n"
58
+
59
+
60
+ def file_digest(path: Path) -> str:
61
+ """SHA256[:12] of file content."""
62
+ if not path.exists():
63
+ return "missing"
64
+ return hashlib.sha256(path.read_bytes()).hexdigest()[:12]
65
+
66
+
67
+ def write_provenance(
68
+ out_dir: Path,
69
+ product_id: str,
70
+ target_id: str,
71
+ artifact_records: list[ArtifactRecord],
72
+ ) -> Path:
73
+ """Write .provenance.json to the plugin bundle root."""
74
+ try:
75
+ from agent_toolkit import __version__
76
+
77
+ version = __version__
78
+ except ImportError:
79
+ version = "unknown"
80
+
81
+ manifest = ProvenanceManifest(
82
+ generator_version=version,
83
+ product=product_id,
84
+ target=target_id,
85
+ artifacts=artifact_records,
86
+ )
87
+ provenance_path = out_dir / ".provenance.json"
88
+ provenance_path.write_text(manifest.to_json(), encoding="utf-8")
89
+ return provenance_path
90
+
91
+
92
+ def load_provenance(path: Path) -> ProvenanceManifest | None:
93
+ """Load a .provenance.json manifest. Returns None if missing or invalid."""
94
+ if not path.is_file():
95
+ return None
96
+ try:
97
+ data = json.loads(path.read_text(encoding="utf-8"))
98
+ except (OSError, json.JSONDecodeError):
99
+ return None
100
+
101
+ artifacts = [
102
+ ArtifactRecord(
103
+ path=item["path"],
104
+ source_file=item["sourceFile"],
105
+ source_digest=item["sourceDigest"],
106
+ generated_digest=item["generatedDigest"],
107
+ )
108
+ for item in data.get("artifacts", [])
109
+ ]
110
+ return ProvenanceManifest(
111
+ generator_version=data.get("generatorVersion", "unknown"),
112
+ product=data.get("product", ""),
113
+ target=data.get("target", ""),
114
+ artifacts=artifacts,
115
+ )
116
+
117
+
118
+ def verify_generated_digests(
119
+ plugins_dir: Path,
120
+ provenance_path: Path,
121
+ ) -> list[str]:
122
+ """Compare recorded generatedDigest values to current artifact content.
123
+
124
+ Artifact paths in the manifest are relative to *plugins_dir* (compiler
125
+ output root). Returns human-readable drift messages (empty when in sync).
126
+ """
127
+ manifest = load_provenance(provenance_path)
128
+ if manifest is None:
129
+ return []
130
+
131
+ errors: list[str] = []
132
+ for record in manifest.artifacts:
133
+ artifact_path = plugins_dir / record.path
134
+ current = file_digest(artifact_path)
135
+ if current != record.generated_digest:
136
+ errors.append(
137
+ f"provenance digest drift: {record.path} "
138
+ f"(expected {record.generated_digest}, got {current})"
139
+ )
140
+ return errors
@@ -0,0 +1,263 @@
1
+ """Emit hooks and MCP configurations from canonical registries into target formats."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import json
6
+ from pathlib import Path
7
+
8
+ from agent_toolkit.compiler.hook_registry import HookDefinition, load_hooks
9
+ from agent_toolkit.compiler.mcp_registry import McpProvider, load_registry
10
+
11
+ _BUNDLE_SCRIPTS_PREFIX = "hooks/scripts"
12
+
13
+ # Canonical event → Claude Code hook event name
14
+ _CLAUDE_HOOK_EVENTS: dict[str, str] = {
15
+ "session.start": "SessionStart",
16
+ "session.end": "SessionEnd",
17
+ "tool.before": "PreToolUse",
18
+ "tool.after": "PostToolUse",
19
+ "prompt.before_submit": "UserPromptSubmit",
20
+ }
21
+
22
+
23
+ def _hooks_dict(hooks_dir: Path) -> dict[str, HookDefinition]:
24
+ hooks, _errors = load_hooks(hooks_dir)
25
+ return hooks
26
+
27
+
28
+ def _mcp_dict(registry_dir: Path) -> dict[str, McpProvider]:
29
+ providers, _errors = load_registry(registry_dir)
30
+ return providers
31
+
32
+
33
+ def resolve_hook_ids(
34
+ product_hooks: list[str],
35
+ *,
36
+ target_id: str,
37
+ hooks_dir: Path,
38
+ emit_registries: bool = False,
39
+ ) -> list[str]:
40
+ """Return hook IDs to emit for a product/target."""
41
+ registry = _hooks_dict(hooks_dir)
42
+ if product_hooks:
43
+ return [hid for hid in product_hooks if hid in registry]
44
+ if not emit_registries:
45
+ return []
46
+ return [hook.id for hook in registry.values() if hook.is_supported_for(target_id)]
47
+
48
+
49
+ def resolve_mcp_ids(
50
+ product_mcp: list[str],
51
+ *,
52
+ target_id: str,
53
+ registry_dir: Path,
54
+ emit_registries: bool = False,
55
+ ) -> list[str]:
56
+ """Return MCP provider IDs to emit for a product/target."""
57
+ registry = _mcp_dict(registry_dir)
58
+ if product_mcp:
59
+ return [pid for pid in product_mcp if pid in registry]
60
+ if not emit_registries:
61
+ return []
62
+ return [provider.id for provider in registry.values() if provider.is_supported_for(target_id)]
63
+
64
+
65
+ def hook_script_basename(command: list[str]) -> str | None:
66
+ """Return the script filename from a command handler, if present."""
67
+ if len(command) < 2:
68
+ return None
69
+ script = command[-1]
70
+ if script.endswith((".sh", ".py", ".bash")):
71
+ return Path(script).name
72
+ return None
73
+
74
+
75
+ def hook_script_source(command: list[str], repo_root: Path) -> Path | None:
76
+ """Resolve the repo-relative script path referenced by a hook command."""
77
+ if len(command) < 2:
78
+ return None
79
+ script = Path(command[-1])
80
+ if script.is_absolute():
81
+ return script if script.is_file() else None
82
+ candidate = repo_root / script
83
+ return candidate if candidate.is_file() else None
84
+
85
+
86
+ def rewrite_hook_command_for_bundle(
87
+ command: list[str],
88
+ *,
89
+ bundle_scripts_prefix: str = _BUNDLE_SCRIPTS_PREFIX,
90
+ ) -> list[str]:
91
+ """Rewrite repo-relative script paths to plugin-bundle-relative paths."""
92
+ if len(command) < 2:
93
+ return command
94
+ script = command[-1]
95
+ if script.startswith("/") or "://" in script:
96
+ return command
97
+ if "/" not in script and not script.endswith((".sh", ".py", ".bash")):
98
+ return command
99
+ name = Path(script).name
100
+ return [*command[:-1], f"{bundle_scripts_prefix}/{name}"]
101
+
102
+
103
+ def emit_claude_hooks_json(
104
+ hook_ids: list[str],
105
+ hooks_dir: Path,
106
+ target_id: str = "claude-code",
107
+ *,
108
+ bundle_relative: bool = False,
109
+ ) -> dict | None:
110
+ """Build Claude Code hooks/hooks.json content from canonical hook IDs."""
111
+ registry = _hooks_dict(hooks_dir)
112
+ hooks_block: dict[str, list[dict]] = {}
113
+
114
+ for hook_id in hook_ids:
115
+ hook = registry.get(hook_id)
116
+ if hook is None or not hook.is_supported_for(target_id):
117
+ continue
118
+ event_name = _CLAUDE_HOOK_EVENTS.get(hook.event, hook.event)
119
+ if hook.handler_type != "command" or not hook.command:
120
+ continue
121
+ command = rewrite_hook_command_for_bundle(hook.command) if bundle_relative else hook.command
122
+ entry = {
123
+ "type": "command",
124
+ "command": " ".join(command),
125
+ "timeout": hook.timeout_ms,
126
+ }
127
+ hooks_block.setdefault(event_name, []).append(entry)
128
+
129
+ if not hooks_block:
130
+ return None
131
+ return {"hooks": hooks_block}
132
+
133
+
134
+ def emit_claude_mcp_json(
135
+ provider_ids: list[str],
136
+ registry_dir: Path,
137
+ target_id: str = "claude-code",
138
+ ) -> dict | None:
139
+ """Build Claude Code .mcp.json content from canonical MCP provider IDs."""
140
+ registry = _mcp_dict(registry_dir)
141
+ servers: dict[str, dict] = {}
142
+
143
+ for provider_id in provider_ids:
144
+ provider = registry.get(provider_id)
145
+ if provider is None or not provider.is_supported_for(target_id):
146
+ continue
147
+ env = {var: f"${{{var}}}" for var in provider.env_vars}
148
+ if provider.package.startswith("@"):
149
+ servers[provider_id] = {
150
+ "command": "npx",
151
+ "args": ["-y", provider.package],
152
+ "env": env,
153
+ }
154
+ else:
155
+ servers[provider_id] = {
156
+ "command": provider.package or provider_id,
157
+ "env": env,
158
+ }
159
+
160
+ if not servers:
161
+ return None
162
+ return {"mcpServers": servers}
163
+
164
+
165
+ def hooks_json_text(
166
+ hook_ids: list[str],
167
+ hooks_dir: Path,
168
+ target_id: str = "claude-code",
169
+ *,
170
+ bundle_relative: bool = False,
171
+ ) -> str | None:
172
+ payload = emit_claude_hooks_json(
173
+ hook_ids,
174
+ hooks_dir,
175
+ target_id,
176
+ bundle_relative=bundle_relative,
177
+ )
178
+ if payload is None:
179
+ return None
180
+ return json.dumps(payload, indent=2) + "\n"
181
+
182
+
183
+ def mcp_json_text(
184
+ provider_ids: list[str],
185
+ registry_dir: Path,
186
+ target_id: str = "claude-code",
187
+ ) -> str | None:
188
+ payload = emit_claude_mcp_json(provider_ids, registry_dir, target_id)
189
+ if payload is None:
190
+ return None
191
+ return json.dumps(payload, indent=2) + "\n"
192
+
193
+
194
+ def emit_agent_plugins_mcp_json(
195
+ provider_ids: list[str],
196
+ registry_dir: Path,
197
+ target_id: str = "agent-plugins",
198
+ ) -> dict | None:
199
+ """Build Agent Plugins 1.0 mcp.json content per spec §7.2.
200
+
201
+ Uses stdio transport with PLUGIN_ROOT/PLUGIN_DATA aware cwd/env.
202
+ """
203
+ registry = _mcp_dict(registry_dir)
204
+ servers: dict[str, dict] = {}
205
+
206
+ for provider_id in provider_ids:
207
+ provider = registry.get(provider_id)
208
+ if provider is None:
209
+ continue
210
+ # Only emit if provider has some tool definition (avoid empty)
211
+ # Use docker for ghcr, npx for npm packages
212
+ # Use strict host check to avoid substring bypass (CodeQL: py/incomplete-url-substring-sanitization)
213
+ if provider.package.split("/", 1)[0] == "ghcr.io":
214
+ servers[provider_id] = {
215
+ "type": "stdio",
216
+ "command": "docker",
217
+ "args": [
218
+ "run",
219
+ "-i",
220
+ "--rm",
221
+ "-e",
222
+ provider.env_vars[0] if provider.env_vars else "TOKEN",
223
+ provider.package,
224
+ ],
225
+ "cwd": "${PLUGIN_ROOT}",
226
+ }
227
+ if provider.env_vars:
228
+ servers[provider_id]["env"] = {var: f"${{{var}}}" for var in provider.env_vars}
229
+ elif provider.package.startswith("@"):
230
+ servers[provider_id] = {
231
+ "type": "stdio",
232
+ "command": "npx",
233
+ "args": ["-y", provider.package],
234
+ "cwd": "${PLUGIN_ROOT}",
235
+ }
236
+ if provider.env_vars:
237
+ servers[provider_id]["env"] = {var: f"${{{var}}}" for var in provider.env_vars}
238
+ else:
239
+ servers[provider_id] = {
240
+ "type": "stdio",
241
+ "command": provider.package or provider_id,
242
+ "cwd": "${PLUGIN_ROOT}",
243
+ }
244
+ if provider.env_vars:
245
+ servers[provider_id]["env"] = {var: f"${{{var}}}" for var in provider.env_vars}
246
+
247
+ if not servers:
248
+ return None
249
+ return {
250
+ "$schema": "https://agent-plugins.org/schemas/1.0.0/mcp.schema.json",
251
+ "mcpServers": servers,
252
+ }
253
+
254
+
255
+ def mcp_json_text_agent_plugins(
256
+ provider_ids: list[str],
257
+ registry_dir: Path,
258
+ target_id: str = "agent-plugins",
259
+ ) -> str | None:
260
+ payload = emit_agent_plugins_mcp_json(provider_ids, registry_dir, target_id)
261
+ if payload is None:
262
+ return None
263
+ return json.dumps(payload, indent=2) + "\n"
@@ -0,0 +1,122 @@
1
+ """Load declarative compile-target registry from capabilities/targets/registry.yaml."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import importlib
6
+ from dataclasses import dataclass
7
+ from pathlib import Path
8
+ from typing import Any
9
+
10
+ import yaml
11
+
12
+ from agent_toolkit._paths import toolkit_root
13
+
14
+
15
+ @dataclass(frozen=True)
16
+ class TargetSpec:
17
+ id: str
18
+ adapter: str
19
+ aliases: tuple[str, ...]
20
+ build: bool
21
+ diff: bool
22
+ release: bool
23
+
24
+
25
+ _REGISTRY_REL_PATHS = (
26
+ Path("capabilities/targets/registry.yaml"),
27
+ Path("schemas/targets-registry.yaml"),
28
+ )
29
+
30
+
31
+ def _repo_root(repo_root: Path | None = None) -> Path:
32
+ if repo_root is not None:
33
+ return repo_root
34
+ root = toolkit_root()
35
+ for rel in _REGISTRY_REL_PATHS:
36
+ if (root / rel).is_file():
37
+ return root
38
+ if (root.parent / rel).is_file():
39
+ return root.parent
40
+ return root
41
+
42
+
43
+ def _registry_path(repo_root: Path) -> Path:
44
+ for rel in _REGISTRY_REL_PATHS:
45
+ path = repo_root / rel
46
+ if path.is_file():
47
+ return path
48
+ raise FileNotFoundError(
49
+ "Target registry not found. Expected one of: "
50
+ + ", ".join(str(p) for p in _REGISTRY_REL_PATHS)
51
+ )
52
+
53
+
54
+ def _parse_target(raw: dict[str, Any]) -> TargetSpec:
55
+ commands = raw.get("commands") or {}
56
+ adapter = raw.get("adapter")
57
+ if not adapter and raw.get("adapter_module") and raw.get("adapter_class"):
58
+ adapter = f"{raw['adapter_module']}.{raw['adapter_class']}"
59
+ if not adapter:
60
+ raise ValueError(f"Target {raw.get('id')!r} missing adapter path")
61
+ return TargetSpec(
62
+ id=str(raw["id"]),
63
+ adapter=str(adapter),
64
+ aliases=tuple(str(a) for a in (raw.get("aliases") or [])),
65
+ build=bool(commands.get("build", True)),
66
+ diff=bool(commands.get("diff", False)),
67
+ release=bool(commands.get("release", True)),
68
+ )
69
+
70
+
71
+ def load_target_registry(repo_root: Path | None = None) -> list[TargetSpec]:
72
+ root = _repo_root(repo_root)
73
+ data = yaml.safe_load(_registry_path(root).read_text(encoding="utf-8")) or {}
74
+ return [_parse_target(entry) for entry in data.get("targets") or []]
75
+
76
+
77
+ def registry_by_id(registry: list[TargetSpec] | None = None) -> dict[str, TargetSpec]:
78
+ specs = registry or load_target_registry()
79
+ out: dict[str, TargetSpec] = {}
80
+ for spec in specs:
81
+ out[spec.id] = spec
82
+ for alias in spec.aliases:
83
+ out[alias] = spec
84
+ return out
85
+
86
+
87
+ def resolve_target_id(target_id: str, registry: list[TargetSpec] | None = None) -> str:
88
+ by_id = registry_by_id(registry)
89
+ spec = by_id.get(target_id)
90
+ return spec.id if spec else target_id
91
+
92
+
93
+ def target_ids_for(command: str, registry: list[TargetSpec] | None = None) -> list[str]:
94
+ specs = registry or load_target_registry()
95
+ attr = {"build": "build", "diff": "diff", "release": "release"}[command]
96
+ return [spec.id for spec in specs if getattr(spec, attr)]
97
+
98
+
99
+ def available_target_ids(
100
+ repo_root: Path | None = None,
101
+ *,
102
+ command: str = "build",
103
+ ) -> list[str]:
104
+ return target_ids_for(command, load_target_registry(repo_root))
105
+
106
+
107
+ def adapter_import_path(spec: TargetSpec) -> str:
108
+ return spec.adapter
109
+
110
+
111
+ def resolve_adapter_class(target_id: str, repo_root: Path | None = None):
112
+ """Import and return adapter class for target id or alias."""
113
+ by_id = registry_by_id(load_target_registry(repo_root))
114
+ spec = by_id.get(target_id)
115
+ if spec is None:
116
+ return None
117
+ module_path, cls_name = spec.adapter.rsplit(".", 1)
118
+ try:
119
+ mod = importlib.import_module(module_path)
120
+ return getattr(mod, cls_name)
121
+ except (ImportError, AttributeError):
122
+ return None