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 @@
1
+ """Target adapters — compile canonical IR into native platform artifacts."""
@@ -0,0 +1,160 @@
1
+ """
2
+ Agent Plugins 1.0 target adapter — portable plugin format.
3
+
4
+ Compiles canonical IR into Agent Plugins 1.0 compliant bundles:
5
+ plugins/<product-id>/plugin.json — manifest with $schema
6
+ plugins/<product-id>/skills/<name>/SKILL.md
7
+ plugins/<product-id>/mcp.json — if product includes MCP
8
+ plugins/<product-id>/com.anthropic.claude-code/ — extension dir (agents/hooks)
9
+
10
+ Spec: https://agent-plugins.org/ + https://github.com/agentplugins/agent-plugins-spec
11
+ Clients: Cursor, VS Code, GitHub Copilot, ChatGPT/Codex, Kiro — NOT Claude Code (legacy .claude-plugin kept).
12
+
13
+ This adapter is the source of truth for the plugin root manifest; bump-version preserves $schema.
14
+ """
15
+
16
+ from __future__ import annotations
17
+
18
+ import json
19
+ from pathlib import Path
20
+
21
+ from agent_toolkit.compiler.model import CanonicalGraph, CompilationResult, Product, Skill
22
+ from agent_toolkit.compiler.targets.base import TargetAdapter
23
+
24
+
25
+ class AgentPluginsAdapter(TargetAdapter):
26
+ """Compiles products into Agent Plugins 1.0 portable bundles."""
27
+
28
+ target_id = "agent-plugins"
29
+ package_type = "plugin"
30
+ maturity = "stable"
31
+
32
+ def compile(
33
+ self,
34
+ graph: CanonicalGraph,
35
+ product: Product,
36
+ *,
37
+ emit_registries: bool = False,
38
+ ) -> CompilationResult:
39
+ result = CompilationResult(target=self.target_id, product=product.id)
40
+ out_dir = self.output_root / product.id
41
+
42
+ # 1. Emit portable manifest at plugin root
43
+ plugin_json = self._build_plugin_json(product)
44
+ self._write_file(
45
+ out_dir / "plugin.json",
46
+ json.dumps(plugin_json, indent=2) + "\n",
47
+ result,
48
+ )
49
+ result.emitted.append("plugin-manifest")
50
+
51
+ # 2. Emit skills (Agent Skills spec, immediate children of skills/)
52
+ for skill_id in product.included_skills:
53
+ skill = graph.skills.get(skill_id)
54
+ if skill is None:
55
+ result.warnings.append(f"Skill '{skill_id}' not found — skipping")
56
+ result.omitted.append(f"skill:{skill_id}")
57
+ continue
58
+ self._emit_skill(skill, out_dir, result)
59
+
60
+ # 3. Emit MCP if included
61
+ from agent_toolkit.compiler.registry_emit import (
62
+ mcp_json_text_agent_plugins,
63
+ resolve_mcp_ids,
64
+ )
65
+
66
+ # We need to support both legacy mcp registry and new agent-plugins mcp.json
67
+ # For now, emit mcp.json if product has mcp
68
+ try:
69
+ mcp_ids = resolve_mcp_ids(
70
+ product.included_mcp,
71
+ target_id=self.target_id,
72
+ registry_dir=self.repo_root / "mcp" / "registry",
73
+ emit_registries=emit_registries,
74
+ )
75
+ if mcp_ids:
76
+ mcp_text = mcp_json_text_agent_plugins(
77
+ mcp_ids, self.repo_root / "mcp" / "registry", self.target_id
78
+ )
79
+ if mcp_text:
80
+ self._write_file(out_dir / "mcp.json", mcp_text, result)
81
+ result.emitted.append("mcp")
82
+ except Exception as e:
83
+ result.warnings.append(f"MCP emit failed: {e}")
84
+
85
+ # 4. Document non-portable components (agents/hooks) as extension
86
+ if product.included_agents or product.included_hooks:
87
+ result.unsupported.append(
88
+ "agents/hooks are not portable in Agent Plugins 1.0 — emitted via com.anthropic.claude-code/ extension (ignored by portable clients)"
89
+ )
90
+
91
+ return result
92
+
93
+ def _build_plugin_json(self, product: Product) -> dict:
94
+ try:
95
+ from agent_toolkit import __version__
96
+
97
+ version = __version__
98
+ except ImportError:
99
+ version = "1.0.0"
100
+
101
+ # Map product id to keywords
102
+ keywords = ["agent-toolkit", product.id.replace("agent-toolkit-", "")]
103
+ if product.id == "agent-toolkit-core":
104
+ keywords = ["agent-toolkit", "core", "skills", "agents"]
105
+ elif product.id == "agent-toolkit-complete":
106
+ keywords = ["agent-toolkit", "complete", "skills", "agents", "mcp"]
107
+
108
+ return {
109
+ "$schema": "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json",
110
+ "name": product.id,
111
+ "version": version,
112
+ "description": product.description,
113
+ "author": {
114
+ "name": "ulises-jeremias",
115
+ "url": "https://github.com/ulises-jeremias/agent-toolkit",
116
+ },
117
+ "homepage": "https://github.com/ulises-jeremias/agent-toolkit",
118
+ "repository": "https://github.com/ulises-jeremias/agent-toolkit",
119
+ "license": "MIT",
120
+ "keywords": keywords,
121
+ "extensions": {
122
+ "com.anthropic.claude-code": {
123
+ "agents": "agents/",
124
+ "hooks": "hooks/",
125
+ "skills": "skills/",
126
+ },
127
+ "com.agent-toolkit.cli": {
128
+ "product": product.id,
129
+ "stability": product.stability.value
130
+ if hasattr(product.stability, "value")
131
+ else str(product.stability),
132
+ },
133
+ },
134
+ }
135
+
136
+ def _emit_skill(self, skill: Skill, out_dir: Path, result: CompilationResult) -> None:
137
+ if not skill.source_path.exists():
138
+ result.warnings.append(f"Skill source not found: {skill.source_path}")
139
+ result.omitted.append(f"skill:{skill.id}")
140
+ return
141
+ dst = out_dir / "skills" / skill.name
142
+ dst.mkdir(parents=True, exist_ok=True)
143
+ content = skill.source_path.read_text(encoding="utf-8", errors="replace")
144
+ self._write_file(dst / "SKILL.md", content, result)
145
+ self._copy_skill_references(skill, dst, result)
146
+ result.emitted.append(f"skill:{skill.id}")
147
+
148
+ def _copy_skill_references(
149
+ self, skill: Skill, dst: Path, result: CompilationResult, *, text_mode: bool = False
150
+ ) -> None:
151
+ # Copy references/ if present (text_mode kept for base compatibility)
152
+ src_ref = skill.source_path.parent / "references"
153
+ if src_ref.is_dir():
154
+ import shutil
155
+
156
+ dst_ref = dst / "references"
157
+ if dst_ref.exists():
158
+ shutil.rmtree(dst_ref)
159
+ shutil.copytree(src_ref, dst_ref)
160
+ result.emitted.append(f"skill:{skill.id}:references")
@@ -0,0 +1,229 @@
1
+ """Abstract base for target adapters."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import re
6
+ import tempfile
7
+ from abc import ABC, abstractmethod
8
+ from pathlib import Path
9
+
10
+ from agent_toolkit.compiler.model import CanonicalGraph, CompilationResult, Product, Skill
11
+ from agent_toolkit.compiler.provenance import ArtifactRecord, file_digest, write_provenance
12
+
13
+
14
+ class PathEscapeError(ValueError):
15
+ """Raised when a path resolves outside its containment root."""
16
+
17
+
18
+ # Private LAN markers for public plugin/package manifests.
19
+ # Use IP regexes (not bare "10.") so semver like 1.10.0 does not false-positive.
20
+ _PRIVATE_IPV4_10 = re.compile(r"\b10\.\d{1,3}\.\d{1,3}\.\d{1,3}\b")
21
+ _PRIVATE_IPV4_192 = re.compile(r"\b192\.168\.\d{1,3}\.\d{1,3}\b")
22
+ _PRIVATE_IPV4_172 = re.compile(r"\b172\.(?:1[6-9]|2\d|3[0-1])\.\d{1,3}\.\d{1,3}\b")
23
+ _LOCAL_HOSTNAME = re.compile(r"(?:https?://[^\s\"']*|\b)[a-z0-9-]+\.local\b", re.I)
24
+
25
+
26
+ def private_network_leak_errors(text: str, *, context: str) -> list[str]:
27
+ """Return error messages when *text* embeds private hostnames/IPs."""
28
+ errors: list[str] = []
29
+ if _PRIVATE_IPV4_10.search(text):
30
+ errors.append(
31
+ f"Possible private hostname '10.x' in {context} — "
32
+ "public distributions must never contain machine-specific URLs"
33
+ )
34
+ if _PRIVATE_IPV4_192.search(text):
35
+ errors.append(
36
+ f"Possible private hostname '192.168.x' in {context} — "
37
+ "public distributions must never contain machine-specific URLs"
38
+ )
39
+ if _PRIVATE_IPV4_172.search(text):
40
+ errors.append(
41
+ f"Possible private hostname '172.16-31.x' in {context} — "
42
+ "public distributions must never contain machine-specific URLs"
43
+ )
44
+ if _LOCAL_HOSTNAME.search(text):
45
+ errors.append(
46
+ f"Possible private hostname '.local' in {context} — "
47
+ "public distributions must never contain machine-specific URLs"
48
+ )
49
+ return errors
50
+
51
+
52
+ class TargetAdapter(ABC):
53
+ """Base class for all target adapters."""
54
+
55
+ target_id: str = ""
56
+ package_type: str = ""
57
+ maturity: str = "stable"
58
+
59
+ def __init__(self, output_root: Path, repo_root: Path):
60
+ self.output_root = output_root
61
+ self.repo_root = repo_root
62
+ self._provenance_records: list[ArtifactRecord] = []
63
+
64
+ @abstractmethod
65
+ def compile(
66
+ self,
67
+ graph: CanonicalGraph,
68
+ product: Product,
69
+ ) -> CompilationResult:
70
+ """Compile canonical IR into target-specific artifacts."""
71
+
72
+ def check(self, graph: CanonicalGraph, product: Product) -> CompilationResult:
73
+ """Dry-run: validate without writing any files to disk."""
74
+ with tempfile.TemporaryDirectory(prefix="agent-toolkit-check-") as tmpdir:
75
+ real_output_root = self.output_root
76
+ self.output_root = Path(tmpdir)
77
+ self._provenance_records = []
78
+ try:
79
+ result = self.compile(graph, product)
80
+ finally:
81
+ self.output_root = real_output_root
82
+ self._provenance_records = []
83
+ result.artifacts.clear()
84
+ return result
85
+
86
+ def _write_file(
87
+ self,
88
+ path: Path,
89
+ content: str,
90
+ result: CompilationResult,
91
+ *,
92
+ source_file: str | Path | None = None,
93
+ ) -> None:
94
+ """Write content to path and record it in result.artifacts (+ provenance)."""
95
+ path.parent.mkdir(parents=True, exist_ok=True)
96
+ path.write_text(content, encoding="utf-8")
97
+ result.artifacts.append(path)
98
+ source = str(source_file) if source_file is not None else "generated"
99
+ try:
100
+ rel = str(path.relative_to(self.output_root))
101
+ except ValueError:
102
+ rel = path.name
103
+ src_path = Path(source_file) if source_file is not None else None
104
+ self._provenance_records.append(
105
+ ArtifactRecord(
106
+ path=rel,
107
+ source_file=source,
108
+ source_digest=file_digest(src_path) if src_path and src_path.exists() else "n/a",
109
+ generated_digest=file_digest(path),
110
+ )
111
+ )
112
+
113
+ def _finalize_provenance(self, product: Product, result: CompilationResult) -> None:
114
+ """Write .provenance.json under the product output directory (#67)."""
115
+ out_dir = self.output_root / product.id
116
+ if not out_dir.exists():
117
+ return
118
+ path = write_provenance(
119
+ out_dir,
120
+ product.id,
121
+ self.target_id,
122
+ list(self._provenance_records),
123
+ )
124
+ result.artifacts.append(path)
125
+ result.emitted.append("provenance")
126
+ self._provenance_records = []
127
+
128
+ def _cleanup_stale_artifacts(self, product: Product, result: CompilationResult) -> None:
129
+ """Remove files under product output that were not emitted this compile (#69)."""
130
+ out_dir = self.output_root / product.id
131
+ if not out_dir.is_dir():
132
+ return
133
+ keep = {p.resolve() for p in result.artifacts if p.exists()}
134
+ removed = 0
135
+ for path in sorted(out_dir.rglob("*"), reverse=True):
136
+ if not path.is_file():
137
+ continue
138
+ if path.resolve() in keep:
139
+ continue
140
+ path.unlink(missing_ok=True)
141
+ removed += 1
142
+ for path in sorted(out_dir.rglob("*"), reverse=True):
143
+ if path.is_dir():
144
+ try:
145
+ path.rmdir()
146
+ except OSError:
147
+ pass
148
+ if removed:
149
+ result.emitted.append(f"stale-cleaned:{removed}")
150
+
151
+ def _safe_relpath(self, file: Path, root: Path) -> Path:
152
+ """Return *file* relative to *root* after resolving symlinks.
153
+
154
+ Raises PathEscapeError when the resolved path is not under *root*.
155
+ """
156
+ root_resolved = root.resolve()
157
+ file_resolved = file.resolve()
158
+ try:
159
+ return file_resolved.relative_to(root_resolved)
160
+ except ValueError as exc:
161
+ raise PathEscapeError(
162
+ f"Path escapes containment root {root}: {file} -> {file_resolved}"
163
+ ) from exc
164
+
165
+ def _iter_contained_files(
166
+ self,
167
+ root: Path,
168
+ result: CompilationResult,
169
+ *,
170
+ label: str = "",
171
+ ) -> list[Path]:
172
+ """List files under *root*, skipping entries that escape after symlink resolution."""
173
+ if not root.is_dir():
174
+ return []
175
+
176
+ root_resolved = root.resolve()
177
+ prefix = f"{label}: " if label else ""
178
+ safe: list[Path] = []
179
+
180
+ for path in sorted(root.rglob("*")):
181
+ if path.is_dir():
182
+ continue
183
+ try:
184
+ resolved = path.resolve()
185
+ except OSError as exc:
186
+ result.errors.append(f"{prefix}cannot resolve {path}: {exc}")
187
+ continue
188
+ if not resolved.is_file():
189
+ continue
190
+ try:
191
+ resolved.relative_to(root_resolved)
192
+ except ValueError:
193
+ result.errors.append(f"{prefix}reference escapes containment root {root}: {path}")
194
+ continue
195
+ safe.append(path)
196
+
197
+ return safe
198
+
199
+ def _copy_skill_references(
200
+ self,
201
+ skill: Skill,
202
+ dst: Path,
203
+ result: CompilationResult,
204
+ *,
205
+ text_mode: bool = False,
206
+ ) -> None:
207
+ """Copy skill ``references/`` into *dst* with path containment checks."""
208
+ refs_src = skill.source_path.parent / "references"
209
+ if not refs_src.is_dir():
210
+ return
211
+
212
+ skill_root = skill.source_path.parent
213
+ label = f"skill:{skill.id}"
214
+
215
+ for ref_file in self._iter_contained_files(refs_src, result, label=label):
216
+ try:
217
+ rel = self._safe_relpath(ref_file, skill_root)
218
+ except PathEscapeError as exc:
219
+ result.errors.append(f"{label}: {exc}")
220
+ continue
221
+
222
+ ref_dst = dst / rel
223
+ if text_mode:
224
+ ref_content = ref_file.read_text(encoding="utf-8", errors="replace")
225
+ self._write_file(ref_dst, ref_content, result, source_file=ref_file)
226
+ else:
227
+ ref_dst.parent.mkdir(parents=True, exist_ok=True)
228
+ ref_dst.write_bytes(ref_file.read_bytes())
229
+ result.artifacts.append(ref_dst)
@@ -0,0 +1,241 @@
1
+ """
2
+ Claude Code target adapter.
3
+
4
+ Compiles canonical IR into Claude Code plugin bundles:
5
+ plugins/<product-id>/.claude-plugin/plugin.json
6
+ plugins/<product-id>/skills/<name>/SKILL.md
7
+ plugins/<product-id>/agents/<name>/AGENT.md
8
+ plugins/<product-id>/.mcp.json (TODO: from MCP registry)
9
+ plugins/<product-id>/hooks/hooks.json (TODO: from hooks model)
10
+
11
+ Official docs: https://code.claude.com/docs/en/plugins
12
+ """
13
+
14
+ from __future__ import annotations
15
+
16
+ import json
17
+ from pathlib import Path
18
+
19
+ from agent_toolkit.compiler.model import (
20
+ Agent,
21
+ CanonicalGraph,
22
+ CompilationResult,
23
+ Product,
24
+ Skill,
25
+ )
26
+ from agent_toolkit.compiler.targets.base import TargetAdapter
27
+
28
+ FORBIDDEN_SETTINGS = {
29
+ "skipDangerousModePermissionPrompt",
30
+ "autoAcceptPermissions",
31
+ "disablePermissionPrompts",
32
+ }
33
+
34
+
35
+ class ClaudeCodeAdapter(TargetAdapter):
36
+ """Compiles agent-toolkit products into Claude Code plugin bundles."""
37
+
38
+ target_id = "claude-code"
39
+ package_type = "plugin"
40
+ maturity = "stable"
41
+
42
+ def compile(
43
+ self,
44
+ graph: CanonicalGraph,
45
+ product: Product,
46
+ *,
47
+ emit_registries: bool = False,
48
+ ) -> CompilationResult:
49
+ result = CompilationResult(target=self.target_id, product=product.id)
50
+ out_dir = self.output_root / product.id
51
+ hooks_dir = self.repo_root / "capabilities" / "hooks"
52
+ mcp_dir = self.repo_root / "mcp" / "registry"
53
+
54
+ # Emit plugin.json
55
+ plugin_json = self._build_plugin_json(product, graph)
56
+ self._write_file(
57
+ out_dir / ".claude-plugin" / "plugin.json",
58
+ json.dumps(plugin_json, indent=2) + "\n",
59
+ result,
60
+ )
61
+ result.emitted.append("plugin-manifest")
62
+
63
+ # Emit skills
64
+ for skill_id in product.included_skills:
65
+ skill = graph.skills.get(skill_id)
66
+ if skill is None:
67
+ result.warnings.append(f"Skill '{skill_id}' not found — skipping")
68
+ result.omitted.append(f"skill:{skill_id}")
69
+ continue
70
+ self._emit_skill(skill, out_dir, result)
71
+
72
+ # Emit agents
73
+ for agent_id in product.included_agents:
74
+ agent = graph.agents.get(agent_id)
75
+ if agent is None:
76
+ result.warnings.append(f"Agent '{agent_id}' not found — skipping")
77
+ result.omitted.append(f"agent:{agent_id}")
78
+ continue
79
+ self._emit_agent(agent, out_dir, result)
80
+
81
+ from agent_toolkit.compiler.registry_emit import (
82
+ hooks_json_text,
83
+ mcp_json_text,
84
+ resolve_hook_ids,
85
+ resolve_mcp_ids,
86
+ )
87
+
88
+ hook_ids = resolve_hook_ids(
89
+ product.included_hooks,
90
+ target_id=self.target_id,
91
+ hooks_dir=hooks_dir,
92
+ emit_registries=emit_registries,
93
+ )
94
+ self._emit_hook_scripts(hook_ids, hooks_dir, out_dir, result)
95
+ hooks_text = hooks_json_text(
96
+ hook_ids,
97
+ hooks_dir,
98
+ self.target_id,
99
+ bundle_relative=True,
100
+ )
101
+ if hooks_text:
102
+ self._write_file(out_dir / "hooks" / "hooks.json", hooks_text, result)
103
+ result.emitted.append("hooks")
104
+
105
+ mcp_ids = resolve_mcp_ids(
106
+ product.included_mcp,
107
+ target_id=self.target_id,
108
+ registry_dir=mcp_dir,
109
+ emit_registries=emit_registries,
110
+ )
111
+ mcp_text = mcp_json_text(mcp_ids, mcp_dir, self.target_id)
112
+ if mcp_text:
113
+ self._write_file(out_dir / ".mcp.json", mcp_text, result)
114
+ result.emitted.append("mcp")
115
+
116
+ pending: list[str] = []
117
+ if not hook_ids:
118
+ pending.append("hooks (hooks/hooks.json — none included for this product)")
119
+ if not mcp_ids:
120
+ pending.append(".mcp.json (none included for this product)")
121
+ result.unsupported.extend(pending)
122
+
123
+ return result
124
+
125
+ def _build_plugin_json(self, product: Product, graph: CanonicalGraph) -> dict:
126
+ """Build the .claude-plugin/plugin.json manifest."""
127
+
128
+ # Import version from package
129
+ try:
130
+ from agent_toolkit import __version__
131
+
132
+ version = __version__
133
+ except ImportError:
134
+ version = "1.0.0"
135
+
136
+ return {
137
+ "name": product.id,
138
+ "version": version,
139
+ "description": product.description,
140
+ "author": {
141
+ "name": "ulises-jeremias",
142
+ "email": "ulisescf.24@gmail.com",
143
+ },
144
+ "homepage": "https://github.com/ulises-jeremias/agent-toolkit",
145
+ "repository": "https://github.com/ulises-jeremias/agent-toolkit",
146
+ "license": "MIT",
147
+ "keywords": ["agent-toolkit", product.id.replace("agent-toolkit-", "")],
148
+ }
149
+
150
+ def _emit_skill(self, skill: Skill, out_dir: Path, result: CompilationResult) -> None:
151
+ """Copy skill SKILL.md to plugin bundle skills/ directory."""
152
+ if not skill.source_path.exists():
153
+ result.warnings.append(f"Skill source not found: {skill.source_path}")
154
+ result.omitted.append(f"skill:{skill.id}")
155
+ return
156
+
157
+ # Claude Code discovers skills at <plugin-root>/skills/<name>/SKILL.md
158
+ dst = out_dir / "skills" / skill.name
159
+ dst.mkdir(parents=True, exist_ok=True)
160
+
161
+ # Copy SKILL.md
162
+ content = skill.source_path.read_text(encoding="utf-8", errors="replace")
163
+ self._write_file(dst / "SKILL.md", content, result)
164
+
165
+ # Copy references/ directory if present
166
+ self._copy_skill_references(skill, dst, result)
167
+
168
+ result.emitted.append(f"skill:{skill.id}")
169
+
170
+ def _emit_agent(self, agent: Agent, out_dir: Path, result: CompilationResult) -> None:
171
+ """Copy agent AGENT.md to plugin bundle agents/ directory."""
172
+ if not agent.source_path.exists():
173
+ result.warnings.append(f"Agent source not found: {agent.source_path}")
174
+ result.omitted.append(f"agent:{agent.id}")
175
+ return
176
+
177
+ dst = out_dir / "agents" / agent.name
178
+ dst.mkdir(parents=True, exist_ok=True)
179
+
180
+ content = agent.source_path.read_text(encoding="utf-8", errors="replace")
181
+ self._write_file(dst / "AGENT.md", content, result)
182
+ result.emitted.append(f"agent:{agent.id}")
183
+
184
+ def _emit_hook_scripts(
185
+ self,
186
+ hook_ids: list[str],
187
+ hooks_dir: Path,
188
+ out_dir: Path,
189
+ result: CompilationResult,
190
+ ) -> None:
191
+ """Copy hook handler scripts into the plugin bundle for bundle-relative commands."""
192
+ from agent_toolkit.compiler.hook_registry import load_hooks
193
+ from agent_toolkit.compiler.registry_emit import (
194
+ hook_script_basename,
195
+ hook_script_source,
196
+ )
197
+
198
+ registry, _errors = load_hooks(hooks_dir)
199
+ scripts_dir = out_dir / "hooks" / "scripts"
200
+ copied: set[str] = set()
201
+
202
+ for hook_id in hook_ids:
203
+ hook = registry.get(hook_id)
204
+ if hook is None or hook.handler_type != "command" or not hook.command:
205
+ continue
206
+ script_name = hook_script_basename(hook.command)
207
+ if script_name is None or script_name in copied:
208
+ continue
209
+ src = hook_script_source(hook.command, self.repo_root)
210
+ if src is None:
211
+ result.warnings.append(f"Hook '{hook_id}' script not found: {hook.command[-1]}")
212
+ continue
213
+ scripts_dir.mkdir(parents=True, exist_ok=True)
214
+ dst = scripts_dir / script_name
215
+ dst.write_bytes(src.read_bytes())
216
+ dst.chmod(dst.stat().st_mode | 0o111)
217
+ result.artifacts.append(dst)
218
+ copied.add(script_name)
219
+ result.emitted.append(f"hook-script:{script_name}")
220
+
221
+ @staticmethod
222
+ def validate_settings(settings: dict) -> list[str]:
223
+ """Validate a settings.json for forbidden fields."""
224
+ return [
225
+ f"Forbidden setting: {k} — must not ship in public plugin defaults"
226
+ for k in FORBIDDEN_SETTINGS
227
+ if k in settings
228
+ ]
229
+
230
+ @staticmethod
231
+ def parity_notes() -> str:
232
+ """Return honest parity notes for certification docs."""
233
+ return (
234
+ "Claude Code plugin bundles emit skills, agents, and plugin.json under "
235
+ ".claude-plugin/. Hooks and .mcp.json are not generated yet — reported as "
236
+ "unsupported until the canonical hook model and MCP registry are wired in.\n"
237
+ "\n"
238
+ "Never ship or overwrite ~/.claude/settings.json from public profiles. "
239
+ "Plugin settings are plugin-local; users enable marketplace plugins in their "
240
+ "own settings file."
241
+ )