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.
- agent_toolkit/__init__.py +4 -0
- agent_toolkit/__main__.py +5 -0
- agent_toolkit/_paths.py +145 -0
- agent_toolkit/bin/.gitkeep +0 -0
- agent_toolkit/bin/agent-toolkit.exe +0 -0
- agent_toolkit/cli/__init__.py +0 -0
- agent_toolkit/cli/__main__.py +5 -0
- agent_toolkit/cli/build.py +278 -0
- agent_toolkit/cli/completion.py +297 -0
- agent_toolkit/cli/context_budget.py +455 -0
- agent_toolkit/cli/devcompanion.py +923 -0
- agent_toolkit/cli/devcompanion_queue.py +235 -0
- agent_toolkit/cli/diff.py +176 -0
- agent_toolkit/cli/doctor.py +1052 -0
- agent_toolkit/cli/insights.py +771 -0
- agent_toolkit/cli/install.py +706 -0
- agent_toolkit/cli/main.py +171 -0
- agent_toolkit/cli/mcp.py +537 -0
- agent_toolkit/cli/memory.py +739 -0
- agent_toolkit/cli/plugin.py +224 -0
- agent_toolkit/cli/project.py +459 -0
- agent_toolkit/cli/release.py +178 -0
- agent_toolkit/cli/skills.py +461 -0
- agent_toolkit/cli/uninstall.py +166 -0
- agent_toolkit/cli/update.py +298 -0
- agent_toolkit/cli/workspace.py +1713 -0
- agent_toolkit/compiler/hook_registry.py +110 -0
- agent_toolkit/compiler/loader.py +338 -0
- agent_toolkit/compiler/mcp_registry.py +87 -0
- agent_toolkit/compiler/model.py +182 -0
- agent_toolkit/compiler/provenance.py +140 -0
- agent_toolkit/compiler/registry_emit.py +263 -0
- agent_toolkit/compiler/target_registry.py +122 -0
- agent_toolkit/compiler/targets/__init__.py +1 -0
- agent_toolkit/compiler/targets/agent_plugins.py +160 -0
- agent_toolkit/compiler/targets/base.py +229 -0
- agent_toolkit/compiler/targets/claude_code.py +241 -0
- agent_toolkit/compiler/targets/codex.py +261 -0
- agent_toolkit/compiler/targets/copilot.py +275 -0
- agent_toolkit/compiler/targets/cursor.py +207 -0
- agent_toolkit/compiler/targets/gemini_cli.py +213 -0
- agent_toolkit/compiler/targets/muse_code.py +113 -0
- agent_toolkit/compiler/targets/opencode.py +204 -0
- agent_toolkit/compiler/targets/pi.py +263 -0
- agent_toolkit/compiler/targets/windsurf.py +267 -0
- agent_toolkit/compiler/tool_mapping.py +83 -0
- agent_toolkit/data/.gitignore +4 -0
- agent_toolkit/data/__init__.py +1 -0
- agent_toolkit/data/agents/agentic-security-reviewer/AGENT.md +60 -0
- agent_toolkit/data/agents/architect/AGENT.md +30 -0
- agent_toolkit/data/agents/assistant/AGENT.md +59 -0
- agent_toolkit/data/agents/build-error-resolver/AGENT.md +30 -0
- agent_toolkit/data/agents/client-workflow-bootstrap/AGENT.md +60 -0
- agent_toolkit/data/agents/code-reviewer/AGENT.md +49 -0
- agent_toolkit/data/agents/database-reviewer/AGENT.md +44 -0
- agent_toolkit/data/agents/docs-lookup/AGENT.md +28 -0
- agent_toolkit/data/agents/e2e-runner/AGENT.md +38 -0
- agent_toolkit/data/agents/performance-optimizer/AGENT.md +52 -0
- agent_toolkit/data/agents/planner/AGENT.md +41 -0
- agent_toolkit/data/agents/refactor-cleaner/AGENT.md +43 -0
- agent_toolkit/data/agents/reference-lookup/AGENT.md +33 -0
- agent_toolkit/data/agents/security-reviewer/AGENT.md +47 -0
- agent_toolkit/data/agents/tdd-guide/AGENT.md +58 -0
- agent_toolkit/data/agents/tech-assistant/AGENT.md +11 -0
- agent_toolkit/data/agents/typescript-reviewer/AGENT.md +61 -0
- agent_toolkit/data/capabilities/hooks/README.md +6 -0
- agent_toolkit/data/capabilities/hooks/pre-commit-validate.yaml +26 -0
- agent_toolkit/data/capabilities/hooks/scripts/pre-commit-validate.sh +41 -0
- agent_toolkit/data/capabilities/hooks/scripts/session-start-context.sh +11 -0
- agent_toolkit/data/capabilities/hooks/session-start-context.yaml +23 -0
- agent_toolkit/data/capabilities/targets/registry.yaml +90 -0
- agent_toolkit/data/capabilities/upstream.lock +118 -0
- agent_toolkit/data/catalogs/agent-catalog.yaml +81 -0
- agent_toolkit/data/catalogs/loop-catalog.yaml +55 -0
- agent_toolkit/data/catalogs/skill-catalog.yaml +520 -0
- agent_toolkit/data/catalogs/skills-layout.json +391 -0
- agent_toolkit/data/distributions/products.yaml +190 -0
- agent_toolkit/data/distributions/targets/claude-code.yaml +47 -0
- agent_toolkit/data/distributions/targets/cursor.yaml +42 -0
- agent_toolkit/data/distributions/targets/opencode.yaml +55 -0
- agent_toolkit/data/loops/changelog-drafter/loop.yaml +40 -0
- agent_toolkit/data/loops/ci-sweeper/loop.yaml +53 -0
- agent_toolkit/data/loops/daily-triage/loop.yaml +47 -0
- agent_toolkit/data/loops/dep-sweeper/loop.yaml +46 -0
- agent_toolkit/data/loops/issue-triage/loop.yaml +40 -0
- agent_toolkit/data/loops/oss-daily-briefing/loop.yaml +65 -0
- agent_toolkit/data/loops/oss-pr-monitor/loop.yaml +86 -0
- agent_toolkit/data/loops/oss-triage/loop.yaml +67 -0
- agent_toolkit/data/loops/post-merge-cleanup/loop.yaml +44 -0
- agent_toolkit/data/loops/pr-babysitter/loop.yaml +46 -0
- agent_toolkit/data/mcp/registry/chrome-devtools.yaml +61 -0
- agent_toolkit/data/mcp/registry/clickup.yaml +48 -0
- agent_toolkit/data/mcp/registry/figma.yaml +44 -0
- agent_toolkit/data/mcp/registry/github.yaml +52 -0
- agent_toolkit/data/mcp/registry/linear.yaml +47 -0
- agent_toolkit/data/mcp/registry/notion.yaml +48 -0
- agent_toolkit/data/mcp/registry/slack.yaml +46 -0
- agent_toolkit/data/mcp/templates/chrome-devtools/README.md +57 -0
- agent_toolkit/data/mcp/templates/chrome-devtools/config.template.json +6 -0
- agent_toolkit/data/mcp/templates/clickup/README.md +45 -0
- agent_toolkit/data/mcp/templates/clickup/config.template.json +8 -0
- agent_toolkit/data/mcp/templates/clickup/wrapper.sh +23 -0
- agent_toolkit/data/mcp/templates/figma/README.md +54 -0
- agent_toolkit/data/mcp/templates/figma/config.template.json +9 -0
- agent_toolkit/data/mcp/templates/github/README.md +16 -0
- agent_toolkit/data/mcp/templates/github/config.template.json +15 -0
- agent_toolkit/data/mcp/templates/github/wrapper.sh +6 -0
- agent_toolkit/data/mcp/templates/linear/README.md +49 -0
- agent_toolkit/data/mcp/templates/linear/config.template.json +10 -0
- agent_toolkit/data/mcp/templates/notion/README.md +7 -0
- agent_toolkit/data/mcp/templates/notion/config.template.json +8 -0
- agent_toolkit/data/mcp/templates/notion/wrapper.sh +23 -0
- agent_toolkit/data/mcp/templates/slack/README.md +8 -0
- agent_toolkit/data/mcp/templates/slack/config.template.json +9 -0
- agent_toolkit/data/mcp/templates/slack/wrapper.sh +23 -0
- agent_toolkit/data/packs/README.md +66 -0
- agent_toolkit/data/packs/agentic-security/README.md +19 -0
- agent_toolkit/data/packs/agentic-security/config.yaml +25 -0
- agent_toolkit/data/packs/architecture/README.md +22 -0
- agent_toolkit/data/packs/architecture/config.yaml +27 -0
- agent_toolkit/data/packs/code-quality/README.md +19 -0
- agent_toolkit/data/packs/code-quality/config.yaml +21 -0
- agent_toolkit/data/packs/delivery-discipline/README.md +19 -0
- agent_toolkit/data/packs/delivery-discipline/config.yaml +42 -0
- agent_toolkit/data/packs/design-engineering/README.md +19 -0
- agent_toolkit/data/packs/design-engineering/config.yaml +41 -0
- agent_toolkit/data/packs/engineering-workflow/README.md +21 -0
- agent_toolkit/data/packs/engineering-workflow/config.yaml +57 -0
- agent_toolkit/data/packs/oss-maintenance/README.md +245 -0
- agent_toolkit/data/packs/oss-maintenance/config.yaml +75 -0
- agent_toolkit/data/profiles/claude-code/CLAUDE.md +110 -0
- agent_toolkit/data/profiles/claude-code/agents/assistant.md +59 -0
- agent_toolkit/data/profiles/claude-code/agents/build-error-resolver.md +30 -0
- agent_toolkit/data/profiles/claude-code/agents/client-workflow-bootstrap.md +60 -0
- agent_toolkit/data/profiles/claude-code/agents/contribution-planner.md +39 -0
- agent_toolkit/data/profiles/claude-code/agents/database-reviewer.md +44 -0
- agent_toolkit/data/profiles/claude-code/agents/docs-lookup.md +28 -0
- agent_toolkit/data/profiles/claude-code/agents/e2e-runner.md +38 -0
- agent_toolkit/data/profiles/claude-code/agents/performance-optimizer.md +52 -0
- agent_toolkit/data/profiles/claude-code/agents/planner.md +41 -0
- agent_toolkit/data/profiles/claude-code/agents/refactor-cleaner.md +43 -0
- agent_toolkit/data/profiles/claude-code/agents/reference-lookup.md +33 -0
- agent_toolkit/data/profiles/claude-code/agents/security-reviewer.md +47 -0
- agent_toolkit/data/profiles/claude-code/agents/tdd-guide.md +58 -0
- agent_toolkit/data/profiles/claude-code/agents/typescript-reviewer.md +61 -0
- agent_toolkit/data/profiles/claude-code/settings.json +86 -0
- agent_toolkit/data/profiles/copilot/copilot-instructions.md +15 -0
- agent_toolkit/data/profiles/cursor/README.md +33 -0
- agent_toolkit/data/profiles/cursor/rules/architect.mdc +23 -0
- agent_toolkit/data/profiles/cursor/rules/assistant.mdc +61 -0
- agent_toolkit/data/profiles/cursor/rules/build-error-resolver.mdc +20 -0
- agent_toolkit/data/profiles/cursor/rules/code-reviewer.mdc +21 -0
- agent_toolkit/data/profiles/cursor/rules/database-reviewer.mdc +29 -0
- agent_toolkit/data/profiles/cursor/rules/docs-lookup.mdc +15 -0
- agent_toolkit/data/profiles/cursor/rules/e2e-runner.mdc +30 -0
- agent_toolkit/data/profiles/cursor/rules/performance-optimizer.mdc +27 -0
- agent_toolkit/data/profiles/cursor/rules/planner.mdc +28 -0
- agent_toolkit/data/profiles/cursor/rules/refactor-cleaner.mdc +26 -0
- agent_toolkit/data/profiles/cursor/rules/reference-lookup.mdc +20 -0
- agent_toolkit/data/profiles/cursor/rules/security-reviewer.mdc +20 -0
- agent_toolkit/data/profiles/cursor/rules/tdd-guide.mdc +26 -0
- agent_toolkit/data/profiles/cursor/rules/typescript-reviewer.mdc +28 -0
- agent_toolkit/data/profiles/muse-code/README.md +35 -0
- agent_toolkit/data/profiles/opencode/README.md +44 -0
- agent_toolkit/data/profiles/opencode/agents/architect.md +30 -0
- agent_toolkit/data/profiles/opencode/agents/assistant.md +96 -0
- agent_toolkit/data/profiles/opencode/agents/build-error-resolver.md +31 -0
- agent_toolkit/data/profiles/opencode/agents/client-workflow-bootstrap.md +66 -0
- agent_toolkit/data/profiles/opencode/agents/code-reviewer.md +47 -0
- agent_toolkit/data/profiles/opencode/agents/contribution-planner.md +44 -0
- agent_toolkit/data/profiles/opencode/agents/database-reviewer.md +43 -0
- agent_toolkit/data/profiles/opencode/agents/docs-lookup.md +28 -0
- agent_toolkit/data/profiles/opencode/agents/e2e-runner.md +33 -0
- agent_toolkit/data/profiles/opencode/agents/performance-optimizer.md +34 -0
- agent_toolkit/data/profiles/opencode/agents/planner.md +27 -0
- agent_toolkit/data/profiles/opencode/agents/refactor-cleaner.md +27 -0
- agent_toolkit/data/profiles/opencode/agents/reference-lookup.md +27 -0
- agent_toolkit/data/profiles/opencode/agents/security-reviewer.md +27 -0
- agent_toolkit/data/profiles/opencode/agents/tdd-guide.md +27 -0
- agent_toolkit/data/profiles/opencode/agents/typescript-reviewer.md +30 -0
- agent_toolkit/data/profiles/opencode/opencode.json +3 -0
- agent_toolkit/data/profiles/pi/skills/architect/skill.md +5 -0
- agent_toolkit/data/profiles/pi/skills/assistant/skill.md +3 -0
- agent_toolkit/data/profiles/pi/skills/code-reviewer/skill.md +5 -0
- agent_toolkit/data/profiles/pi/skills/planner/skill.md +3 -0
- agent_toolkit/data/profiles/pi/skills/security-reviewer/skill.md +3 -0
- agent_toolkit/data/profiles/windsurf/memories/global_rules.md +114 -0
- agent_toolkit/data/profiles/windsurf/rules/architect.mdc +23 -0
- agent_toolkit/data/profiles/windsurf/rules/assistant.mdc +61 -0
- agent_toolkit/data/profiles/windsurf/rules/build-error-resolver.mdc +20 -0
- agent_toolkit/data/profiles/windsurf/rules/code-reviewer.mdc +21 -0
- agent_toolkit/data/profiles/windsurf/rules/database-reviewer.mdc +29 -0
- agent_toolkit/data/profiles/windsurf/rules/docs-lookup.mdc +15 -0
- agent_toolkit/data/profiles/windsurf/rules/e2e-runner.mdc +30 -0
- agent_toolkit/data/profiles/windsurf/rules/performance-optimizer.mdc +27 -0
- agent_toolkit/data/profiles/windsurf/rules/planner.mdc +28 -0
- agent_toolkit/data/profiles/windsurf/rules/refactor-cleaner.mdc +26 -0
- agent_toolkit/data/profiles/windsurf/rules/reference-lookup.mdc +20 -0
- agent_toolkit/data/profiles/windsurf/rules/security-reviewer.mdc +20 -0
- agent_toolkit/data/profiles/windsurf/rules/tdd-guide.mdc +26 -0
- agent_toolkit/data/profiles/windsurf/rules/typescript-reviewer.mdc +28 -0
- agent_toolkit/data/skills/accessibility/review/SKILL.md +116 -0
- agent_toolkit/data/skills/accessibility/review/references/a11y-checklist.md +25 -0
- agent_toolkit/data/skills/accessibility/review/references/a11y-findings-template.md +56 -0
- agent_toolkit/data/skills/accessibility/review/references/research.md +47 -0
- agent_toolkit/data/skills/agentic-security/mcp-audit/SKILL.md +116 -0
- agent_toolkit/data/skills/agentic-security/mcp-audit/references/mcp-audit-template.md +51 -0
- agent_toolkit/data/skills/agentic-security/owasp-agentic-review/SKILL.md +73 -0
- agent_toolkit/data/skills/agentic-security/owasp-agentic-review/references/owasp-agentic-template.md +32 -0
- agent_toolkit/data/skills/agentic-security/supply-chain-audit/SKILL.md +142 -0
- agent_toolkit/data/skills/agentic-security/threat-modeling/SKILL.md +100 -0
- agent_toolkit/data/skills/agentic-security/threat-modeling/references/threat-model-template.md +55 -0
- agent_toolkit/data/skills/architecture/c4-model/SKILL.md +49 -0
- agent_toolkit/data/skills/cloud/aws-well-architected-review/SKILL.md +37 -0
- agent_toolkit/data/skills/cloud/cloud-design-patterns/SKILL.md +38 -0
- agent_toolkit/data/skills/core/assistant/SKILL.md +216 -0
- agent_toolkit/data/skills/core/assistant/references/AGENTS_TEMPLATE.md +0 -0
- agent_toolkit/data/skills/core/assistant/references/ORCHESTRATION.md +0 -0
- agent_toolkit/data/skills/core/assistant/references/REPO_INSPECTION.md +0 -0
- agent_toolkit/data/skills/core/dev-companion/SKILL.md +65 -0
- agent_toolkit/data/skills/core/dev-companion/references/LOOP_GUARDRAILS.md +0 -0
- agent_toolkit/data/skills/core/onboarding/SKILL.md +122 -0
- agent_toolkit/data/skills/core/output-handshake/SKILL.md +26 -0
- agent_toolkit/data/skills/core/pr-fallback/SKILL.md +35 -0
- agent_toolkit/data/skills/core/pr-fallback/references/pr-body-default.md +0 -0
- agent_toolkit/data/skills/core/project/SKILL.md +89 -0
- agent_toolkit/data/skills/core/workspace/SKILL.md +103 -0
- agent_toolkit/data/skills/core/workspace-knowledge-sync/SKILL.md +140 -0
- agent_toolkit/data/skills/data/dbt-validation/SKILL.md +41 -0
- agent_toolkit/data/skills/data/snowflake-validation/SKILL.md +38 -0
- agent_toolkit/data/skills/delivery/adr/SKILL.md +56 -0
- agent_toolkit/data/skills/delivery/adr/references/default-template.md +35 -0
- agent_toolkit/data/skills/delivery/adr/references/example-001-graphql-adoption.md +66 -0
- agent_toolkit/data/skills/delivery/agreement/SKILL.md +24 -0
- agent_toolkit/data/skills/delivery/agreement/references/default-template.md +17 -0
- agent_toolkit/data/skills/delivery/agreement/references/example-api-versioning.md +29 -0
- agent_toolkit/data/skills/delivery/bug/SKILL.md +26 -0
- agent_toolkit/data/skills/delivery/bug/references/default-template.md +26 -0
- agent_toolkit/data/skills/delivery/bug/references/example-search-filter-bug.md +58 -0
- agent_toolkit/data/skills/delivery/decision-log/SKILL.md +28 -0
- agent_toolkit/data/skills/delivery/decision-log/references/default-template.md +17 -0
- agent_toolkit/data/skills/delivery/decision-log/references/example-repository-pattern.md +27 -0
- agent_toolkit/data/skills/delivery/development-workflow/SKILL.md +34 -0
- agent_toolkit/data/skills/delivery/development-workflow/references/default-workflow-checklist.md +44 -0
- agent_toolkit/data/skills/delivery/epic/SKILL.md +22 -0
- agent_toolkit/data/skills/delivery/epic/references/default-template.md +26 -0
- agent_toolkit/data/skills/delivery/epic/references/example-unified-dashboard.md +40 -0
- agent_toolkit/data/skills/delivery/incident/SKILL.md +24 -0
- agent_toolkit/data/skills/delivery/incident/references/default-template.md +29 -0
- agent_toolkit/data/skills/delivery/incident/references/example-payment-outage.md +62 -0
- agent_toolkit/data/skills/delivery/management-unit-assessment/SKILL.md +104 -0
- agent_toolkit/data/skills/delivery/management-unit-assessment/references/default-template.md +24 -0
- agent_toolkit/data/skills/delivery/management-unit-assessment/references/example-team-assessment.md +126 -0
- agent_toolkit/data/skills/delivery/meeting-minutes/SKILL.md +25 -0
- agent_toolkit/data/skills/delivery/meeting-minutes/references/default-template.md +22 -0
- agent_toolkit/data/skills/delivery/meeting-minutes/references/example-weekly-sync.md +72 -0
- agent_toolkit/data/skills/delivery/planning/SKILL.md +31 -0
- agent_toolkit/data/skills/delivery/planning/references/default-template.md +25 -0
- agent_toolkit/data/skills/delivery/planning/references/example-sprint-planning.md +62 -0
- agent_toolkit/data/skills/delivery/prd/SKILL.md +46 -0
- agent_toolkit/data/skills/delivery/prd/references/default-template.md +31 -0
- agent_toolkit/data/skills/delivery/prd/references/example-unified-api.md +71 -0
- agent_toolkit/data/skills/delivery/project-assessment/SKILL.md +90 -0
- agent_toolkit/data/skills/delivery/project-assessment/references/default-template.md +26 -0
- agent_toolkit/data/skills/delivery/project-assessment/references/example-platform-assessment.md +122 -0
- agent_toolkit/data/skills/delivery/project-assessment-evidence/SKILL.md +88 -0
- agent_toolkit/data/skills/delivery/project-assessment-evidence/references/default-template.md +24 -0
- agent_toolkit/data/skills/delivery/project-assessment-evidence/references/example-evidence-map.md +46 -0
- agent_toolkit/data/skills/delivery/spike/SKILL.md +24 -0
- agent_toolkit/data/skills/delivery/spike/references/default-template.md +29 -0
- agent_toolkit/data/skills/delivery/spike/references/example-graphql-federation.md +79 -0
- agent_toolkit/data/skills/delivery/task/SKILL.md +21 -0
- agent_toolkit/data/skills/delivery/task/references/default-template.md +21 -0
- agent_toolkit/data/skills/delivery/task/references/example-nav-system.md +33 -0
- agent_toolkit/data/skills/delivery/technical-unit-assessment/SKILL.md +58 -0
- agent_toolkit/data/skills/delivery/technical-unit-assessment/references/default-template.md +26 -0
- agent_toolkit/data/skills/delivery/technical-unit-assessment/references/example-frontend-assessment.md +112 -0
- agent_toolkit/data/skills/delivery/technical-unit-assessment/references/indicator-groups.md +65 -0
- agent_toolkit/data/skills/delivery/trd/SKILL.md +49 -0
- agent_toolkit/data/skills/delivery/trd/references/default-template.md +31 -0
- agent_toolkit/data/skills/delivery/trd/references/example-api-migration.md +122 -0
- agent_toolkit/data/skills/delivery/user-story/SKILL.md +21 -0
- agent_toolkit/data/skills/delivery/user-story/references/default-template.md +21 -0
- agent_toolkit/data/skills/delivery/user-story/references/example-advanced-filtering.md +37 -0
- agent_toolkit/data/skills/delivery/work-item/SKILL.md +31 -0
- agent_toolkit/data/skills/delivery/work-item/references/default-template.md +21 -0
- agent_toolkit/data/skills/delivery/work-item/references/example-routing-dashboard.md +23 -0
- agent_toolkit/data/skills/delivery/workflow-client-bootstrap/SKILL.md +148 -0
- agent_toolkit/data/skills/delivery/workflow-client-bootstrap/questions.yaml +165 -0
- agent_toolkit/data/skills/delivery/workflow-generic-project/SKILL.md +79 -0
- agent_toolkit/data/skills/design/design-assessment/SKILL.md +150 -0
- agent_toolkit/data/skills/design/design-assessment/references/design-scorecard-template.md +78 -0
- agent_toolkit/data/skills/design/design-improvement/SKILL.md +167 -0
- agent_toolkit/data/skills/design/design-improvement/references/improvement-plan-template.md +113 -0
- agent_toolkit/data/skills/design/figma/LICENSE.txt +2 -0
- agent_toolkit/data/skills/design/figma/NOTICE.txt +25 -0
- agent_toolkit/data/skills/design/figma/SKILL.md +98 -0
- agent_toolkit/data/skills/design/figma/references/figma-mcp-config.md +82 -0
- agent_toolkit/data/skills/design/figma/references/figma-tools-and-prompts.md +34 -0
- agent_toolkit/data/skills/design/figma-code-connect-components/LICENSE.txt +2 -0
- agent_toolkit/data/skills/design/figma-code-connect-components/NOTICE.txt +18 -0
- agent_toolkit/data/skills/design/figma-code-connect-components/SKILL.md +354 -0
- agent_toolkit/data/skills/design/figma-code-connect-components/references/mapping-checklist.md +7 -0
- agent_toolkit/data/skills/design/figma-code-connect-components/scripts/normalize_node_id.py +25 -0
- agent_toolkit/data/skills/design/figma-create-design-system-rules/LICENSE.txt +2 -0
- agent_toolkit/data/skills/design/figma-create-design-system-rules/NOTICE.txt +19 -0
- agent_toolkit/data/skills/design/figma-create-design-system-rules/SKILL.md +554 -0
- agent_toolkit/data/skills/design/figma-create-design-system-rules/references/rule-template.md +15 -0
- agent_toolkit/data/skills/design/figma-create-design-system-rules/scripts/check_agents_md.sh +9 -0
- agent_toolkit/data/skills/design/figma-create-new-file/LICENSE.txt +2 -0
- agent_toolkit/data/skills/design/figma-create-new-file/NOTICE.txt +17 -0
- agent_toolkit/data/skills/design/figma-create-new-file/SKILL.md +72 -0
- agent_toolkit/data/skills/design/figma-implement-design/LICENSE.txt +2 -0
- agent_toolkit/data/skills/design/figma-implement-design/NOTICE.txt +19 -0
- agent_toolkit/data/skills/design/figma-implement-design/SKILL.md +268 -0
- agent_toolkit/data/skills/design/frontend-design/LICENSE.txt +177 -0
- agent_toolkit/data/skills/design/frontend-design/SKILL.md +82 -0
- agent_toolkit/data/skills/design/frontend-design/UPSTREAM.md +14 -0
- agent_toolkit/data/skills/design/frontend-design-review/LICENSE +21 -0
- agent_toolkit/data/skills/design/frontend-design-review/SKILL.md +194 -0
- agent_toolkit/data/skills/design/frontend-design-review/references/pattern-examples.md +21 -0
- agent_toolkit/data/skills/design/frontend-design-review/references/quick-checklist.md +38 -0
- agent_toolkit/data/skills/design/frontend-design-review/references/review-output-format.md +68 -0
- agent_toolkit/data/skills/design/frontend-design-review/references/review-type-modifiers.md +31 -0
- agent_toolkit/data/skills/design/web-design-guidelines/SKILL.md +78 -0
- agent_toolkit/data/skills/design/web-design-guidelines/references/LICENSE +21 -0
- agent_toolkit/data/skills/design/web-design-guidelines/references/web-interface-guidelines.md +180 -0
- agent_toolkit/data/skills/forge/gh-address-comments/LICENSE.txt +202 -0
- agent_toolkit/data/skills/forge/gh-address-comments/NOTICE.txt +20 -0
- agent_toolkit/data/skills/forge/gh-address-comments/SKILL.md +72 -0
- agent_toolkit/data/skills/forge/gh-address-comments/scripts/fetch_comments.py +239 -0
- agent_toolkit/data/skills/forge/gh-contribution-planner/SKILL.md +160 -0
- agent_toolkit/data/skills/forge/gh-contribution-planner/scripts/inspect_contributions.py +818 -0
- agent_toolkit/data/skills/forge/gh-fix-ci/LICENSE.txt +201 -0
- agent_toolkit/data/skills/forge/gh-fix-ci/NOTICE.txt +20 -0
- agent_toolkit/data/skills/forge/gh-fix-ci/SKILL.md +74 -0
- agent_toolkit/data/skills/forge/gh-fix-ci/scripts/inspect_pr_checks.py +509 -0
- agent_toolkit/data/skills/forge/github-cli-workflow/SKILL.md +49 -0
- agent_toolkit/data/skills/forge/gitlab-cli-workflow/SKILL.md +44 -0
- agent_toolkit/data/skills/forge/workflow-client-bootstrap/SKILL.md +14 -0
- agent_toolkit/data/skills/forge/workflow-generic-project/SKILL.md +14 -0
- agent_toolkit/data/skills/forge/worktree/SKILL.md +113 -0
- agent_toolkit/data/skills/integrations/clickup-cli/SKILL.md +78 -0
- agent_toolkit/data/skills/integrations/clickup-cli/references/docs-management.md +57 -0
- agent_toolkit/data/skills/integrations/clickup-cli/references/task-management.md +131 -0
- agent_toolkit/data/skills/integrations/clickup-cli/references/time-tracking.md +38 -0
- agent_toolkit/data/skills/integrations/linear/LICENSE.txt +202 -0
- agent_toolkit/data/skills/integrations/linear/NOTICE.txt +23 -0
- agent_toolkit/data/skills/integrations/linear/SKILL.md +134 -0
- agent_toolkit/data/skills/integrations/mcp/SKILL.md +88 -0
- agent_toolkit/data/skills/integrations/slack-assistant/SKILL.md +138 -0
- agent_toolkit/data/skills/integrations/slack-cli/SKILL.md +109 -0
- agent_toolkit/data/skills/integrations/slack-cli/references/INSTALLATION.md +42 -0
- agent_toolkit/data/skills/loops/loop-runner/SKILL.md +92 -0
- agent_toolkit/data/skills/ops/docs-generator/SKILL.md +120 -0
- agent_toolkit/data/skills/ops/llm-cost-advisor/SKILL.md +87 -0
- agent_toolkit/data/skills/ops/swarm/SKILL.md +108 -0
- agent_toolkit/data/skills/ops/swarm-handoff/SKILL.md +112 -0
- agent_toolkit/data/skills/ops/swarm-observer/SKILL.md +102 -0
- agent_toolkit/data/skills/ops/triage/SKILL.md +119 -0
- agent_toolkit/data/skills/quality/codeql/SKILL.md +106 -0
- agent_toolkit/data/skills/quality/codeql/references/codeql-queries.md +43 -0
- agent_toolkit/data/skills/quality/megalinter/SKILL.md +162 -0
- agent_toolkit/data/skills/quality/megalinter/references/megalinter-images.md +36 -0
- agent_toolkit/data/skills/quality/megalinter/references/megalinter-license.md +41 -0
- agent_toolkit/data/skills/quality/megalinter/references/megalinter-targets.md +66 -0
- agent_toolkit/data/skills/tooling/chrome-devtools/SKILL.md +146 -0
- agent_toolkit/data/skills/tooling/herdr/SKILL.md +109 -0
- agent_toolkit/data/skills/tooling/inventory/SKILL.md +81 -0
- agent_toolkit/data/skills/tooling/jupyter-notebook/LICENSE.txt +201 -0
- agent_toolkit/data/skills/tooling/jupyter-notebook/NOTICE.txt +27 -0
- agent_toolkit/data/skills/tooling/jupyter-notebook/SKILL.md +145 -0
- agent_toolkit/data/skills/tooling/jupyter-notebook/assets/experiment-template.ipynb +117 -0
- agent_toolkit/data/skills/tooling/jupyter-notebook/assets/tutorial-template.ipynb +115 -0
- agent_toolkit/data/skills/tooling/jupyter-notebook/references/experiment-patterns.md +10 -0
- agent_toolkit/data/skills/tooling/jupyter-notebook/references/notebook-structure.md +17 -0
- agent_toolkit/data/skills/tooling/jupyter-notebook/references/quality-checklist.md +11 -0
- agent_toolkit/data/skills/tooling/jupyter-notebook/references/tutorial-patterns.md +9 -0
- agent_toolkit/data/skills/tooling/jupyter-notebook/scripts/new_notebook.py +132 -0
- agent_toolkit/data/skills/tooling/mermaid/SKILL.md +36 -0
- agent_toolkit/data/skills/tooling/playwright-cli/LICENSE.txt +201 -0
- agent_toolkit/data/skills/tooling/playwright-cli/NOTICE.txt +29 -0
- agent_toolkit/data/skills/tooling/playwright-cli/SKILL.md +154 -0
- agent_toolkit/data/skills/tooling/playwright-cli/references/cli.md +116 -0
- agent_toolkit/data/skills/tooling/playwright-cli/references/workflows.md +98 -0
- agent_toolkit/data/skills/tooling/playwright-cli/scripts/executable_playwright_cli.sh +25 -0
- agent_toolkit/data_cache.py +79 -0
- agent_toolkit/data_sync.py +144 -0
- agent_toolkit/installer/__init__.py +0 -0
- agent_toolkit/installer/merge.py +59 -0
- agent_toolkit/installer/receipt.py +89 -0
- agent_toolkit/installer/sources.py +92 -0
- agent_toolkit/installer/tracking.py +63 -0
- agent_toolkit/launcher.py +69 -0
- agent_toolkit/loop/__init__.py +0 -0
- agent_toolkit/loop/budget.py +107 -0
- agent_toolkit/loop/gh_gate.py +923 -0
- agent_toolkit/loop/loop-gh-gate +923 -0
- agent_toolkit/loop/pack.py +65 -0
- agent_toolkit/loop/runner.py +2722 -0
- agent_toolkit/runner/__init__.py +0 -0
- agent_toolkit/runner/dispatcher.py +163 -0
- agent_toolkit/runner/policy.py +356 -0
- agent_toolkit/runner/providers/__init__.py +21 -0
- agent_toolkit/runner/providers/anthropic_provider.py +109 -0
- agent_toolkit/runner/providers/base.py +53 -0
- agent_toolkit/runner/providers/ollama_provider.py +108 -0
- agent_toolkit/runner/providers/openai_provider.py +103 -0
- agent_toolkit/runner/providers/opencode_provider.py +127 -0
- agent_toolkit/swarm/__init__.py +5 -0
- agent_toolkit/swarm/approvals.py +121 -0
- agent_toolkit/swarm/backends/__init__.py +596 -0
- agent_toolkit/swarm/budget.py +83 -0
- agent_toolkit/swarm/cli.py +2448 -0
- agent_toolkit/swarm/config.py +351 -0
- agent_toolkit/swarm/handoff.py +174 -0
- agent_toolkit/swarm/models.py +230 -0
- agent_toolkit/swarm/prompts.py +177 -0
- agent_toolkit/swarm/recipes.py +304 -0
- agent_toolkit/swarm/runner.py +267 -0
- agent_toolkit/swarm/state.py +93 -0
- agent_toolkit/swarm/store.py +148 -0
- agent_toolkit/swarm/worktree.py +105 -0
- agent_toolkit/templates/workspace/.gitignore +19 -0
- agent_toolkit/templates/workspace/AGENTS.md +82 -0
- agent_toolkit/templates/workspace/knowledge/README.md +22 -0
- agent_toolkit/templates/workspace/knowledge/learnings/general.md +3 -0
- agent_toolkit/templates/workspace/knowledge/todos/pending.md +7 -0
- agent_toolkit/templates/workspace/packs/README.md +24 -0
- agent_toolkit/templates/workspace/personas/architect.md +12 -0
- agent_toolkit/templates/workspace/personas/implementer.md +12 -0
- agent_toolkit/templates/workspace/personas/researcher.md +12 -0
- agent_toolkit/templates/workspace/personas/reviewer.md +12 -0
- agent_toolkit_cli-1.11.0.dist-info/METADATA +363 -0
- agent_toolkit_cli-1.11.0.dist-info/RECORD +438 -0
- agent_toolkit_cli-1.11.0.dist-info/WHEEL +4 -0
- agent_toolkit_cli-1.11.0.dist-info/entry_points.txt +4 -0
- agent_toolkit_cli-1.11.0.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Base interface for LLM providers.
|
|
3
|
+
|
|
4
|
+
All providers must implement this interface to be used by the dev-companion runner.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from abc import ABC, abstractmethod
|
|
8
|
+
from dataclasses import dataclass
|
|
9
|
+
from pathlib import Path
|
|
10
|
+
from typing import Optional
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
@dataclass
|
|
14
|
+
class LLMResponse:
|
|
15
|
+
content: str
|
|
16
|
+
model: str
|
|
17
|
+
provider: str
|
|
18
|
+
tokens_used: Optional[int] = None
|
|
19
|
+
duration_sec: Optional[float] = None
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class LLMProvider(ABC):
|
|
23
|
+
name: str
|
|
24
|
+
is_local: bool = False
|
|
25
|
+
is_free: bool = False
|
|
26
|
+
|
|
27
|
+
@abstractmethod
|
|
28
|
+
def is_available(self) -> bool:
|
|
29
|
+
"""Check if the provider is available (installed, configured, etc.)"""
|
|
30
|
+
pass
|
|
31
|
+
|
|
32
|
+
@abstractmethod
|
|
33
|
+
def generate(
|
|
34
|
+
self,
|
|
35
|
+
prompt: str,
|
|
36
|
+
system_prompt: Optional[str] = None,
|
|
37
|
+
repo_path: Optional[Path] = None,
|
|
38
|
+
timeout_sec: int = 300,
|
|
39
|
+
) -> LLMResponse:
|
|
40
|
+
"""Generate a response from the LLM"""
|
|
41
|
+
pass
|
|
42
|
+
|
|
43
|
+
def get_priority(self) -> int:
|
|
44
|
+
"""Lower = higher priority. Local free providers should have priority over cloud paid ones."""
|
|
45
|
+
return 100
|
|
46
|
+
|
|
47
|
+
def supports_directory_context(self) -> bool:
|
|
48
|
+
"""Whether the provider can operate in a specific directory context"""
|
|
49
|
+
return False
|
|
50
|
+
|
|
51
|
+
def get_model_name(self) -> str:
|
|
52
|
+
"""Return the model name used by this provider"""
|
|
53
|
+
return "unknown"
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Ollama provider for dev-companion.
|
|
3
|
+
|
|
4
|
+
Uses ollama CLI to generate responses with locally running models.
|
|
5
|
+
Requires: ollama installed and running with models (e.g., llama3.2, mistral).
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
import json
|
|
9
|
+
import subprocess
|
|
10
|
+
import time
|
|
11
|
+
from pathlib import Path
|
|
12
|
+
from typing import Optional
|
|
13
|
+
|
|
14
|
+
from .base import LLMProvider, LLMResponse
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class OllamaProvider(LLMProvider):
|
|
18
|
+
name = "ollama"
|
|
19
|
+
is_local = True
|
|
20
|
+
is_free = True
|
|
21
|
+
|
|
22
|
+
def __init__(self, model: str = "llama3.2"):
|
|
23
|
+
self.model = model
|
|
24
|
+
|
|
25
|
+
def is_available(self) -> bool:
|
|
26
|
+
try:
|
|
27
|
+
result = subprocess.run(
|
|
28
|
+
["ollama", "list"],
|
|
29
|
+
capture_output=True,
|
|
30
|
+
text=True,
|
|
31
|
+
timeout=5,
|
|
32
|
+
)
|
|
33
|
+
if result.returncode != 0:
|
|
34
|
+
return False
|
|
35
|
+
return self.model in result.stdout
|
|
36
|
+
except (FileNotFoundError, subprocess.TimeoutExpired):
|
|
37
|
+
return False
|
|
38
|
+
|
|
39
|
+
def supports_directory_context(self) -> bool:
|
|
40
|
+
return False
|
|
41
|
+
|
|
42
|
+
def get_model_name(self) -> str:
|
|
43
|
+
return self.model
|
|
44
|
+
|
|
45
|
+
def get_priority(self) -> int:
|
|
46
|
+
return 2
|
|
47
|
+
|
|
48
|
+
def generate(
|
|
49
|
+
self,
|
|
50
|
+
prompt: str,
|
|
51
|
+
system_prompt: Optional[str] = None,
|
|
52
|
+
repo_path: Optional[Path] = None,
|
|
53
|
+
timeout_sec: int = 300,
|
|
54
|
+
) -> LLMResponse:
|
|
55
|
+
start_time = time.time()
|
|
56
|
+
|
|
57
|
+
messages = []
|
|
58
|
+
if system_prompt:
|
|
59
|
+
messages.append({"role": "system", "content": system_prompt})
|
|
60
|
+
messages.append({"role": "user", "content": prompt})
|
|
61
|
+
|
|
62
|
+
input_data = {
|
|
63
|
+
"model": self.model,
|
|
64
|
+
"messages": messages,
|
|
65
|
+
"stream": False,
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
try:
|
|
69
|
+
result = subprocess.run(
|
|
70
|
+
["ollama", "api", "chat", "-"],
|
|
71
|
+
input=json.dumps(input_data),
|
|
72
|
+
capture_output=True,
|
|
73
|
+
text=True,
|
|
74
|
+
timeout=timeout_sec,
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
duration = time.time() - start_time
|
|
78
|
+
|
|
79
|
+
if result.returncode != 0:
|
|
80
|
+
return LLMResponse(
|
|
81
|
+
content=f"Error: {result.stderr}",
|
|
82
|
+
model=self.model,
|
|
83
|
+
provider=self.name,
|
|
84
|
+
duration_sec=duration,
|
|
85
|
+
)
|
|
86
|
+
|
|
87
|
+
try:
|
|
88
|
+
response_data = json.loads(result.stdout)
|
|
89
|
+
content = response_data.get("message", {}).get("content", "")
|
|
90
|
+
if not content:
|
|
91
|
+
content = str(response_data)
|
|
92
|
+
except json.JSONDecodeError:
|
|
93
|
+
content = result.stdout
|
|
94
|
+
|
|
95
|
+
return LLMResponse(
|
|
96
|
+
content=content,
|
|
97
|
+
model=self.model,
|
|
98
|
+
provider=self.name,
|
|
99
|
+
duration_sec=duration,
|
|
100
|
+
)
|
|
101
|
+
|
|
102
|
+
except subprocess.TimeoutExpired:
|
|
103
|
+
return LLMResponse(
|
|
104
|
+
content=f"Timeout after {timeout_sec} seconds",
|
|
105
|
+
model=self.model,
|
|
106
|
+
provider=self.name,
|
|
107
|
+
duration_sec=timeout_sec,
|
|
108
|
+
)
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"""
|
|
2
|
+
OpenAI provider for dev-companion.
|
|
3
|
+
|
|
4
|
+
Uses OpenAI API as optional paid provider.
|
|
5
|
+
Requires: OPENAI_API_KEY environment variable.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
import json
|
|
9
|
+
import os
|
|
10
|
+
import time
|
|
11
|
+
from pathlib import Path
|
|
12
|
+
from typing import Optional
|
|
13
|
+
|
|
14
|
+
from .base import LLMProvider, LLMResponse
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class OpenAIProvider(LLMProvider):
|
|
18
|
+
name = "openai"
|
|
19
|
+
is_local = False
|
|
20
|
+
is_free = False
|
|
21
|
+
|
|
22
|
+
def __init__(self, model: str = "gpt-4o-mini"):
|
|
23
|
+
self.model = model
|
|
24
|
+
|
|
25
|
+
def is_available(self) -> bool:
|
|
26
|
+
return bool(os.environ.get("OPENAI_API_KEY"))
|
|
27
|
+
|
|
28
|
+
def supports_directory_context(self) -> bool:
|
|
29
|
+
return False
|
|
30
|
+
|
|
31
|
+
def get_model_name(self) -> str:
|
|
32
|
+
return self.model
|
|
33
|
+
|
|
34
|
+
def get_priority(self) -> int:
|
|
35
|
+
return 20
|
|
36
|
+
|
|
37
|
+
def generate(
|
|
38
|
+
self,
|
|
39
|
+
prompt: str,
|
|
40
|
+
system_prompt: Optional[str] = None,
|
|
41
|
+
repo_path: Optional[Path] = None,
|
|
42
|
+
timeout_sec: int = 300,
|
|
43
|
+
) -> LLMResponse:
|
|
44
|
+
import urllib.error
|
|
45
|
+
import urllib.request
|
|
46
|
+
|
|
47
|
+
start_time = time.time()
|
|
48
|
+
|
|
49
|
+
headers = {
|
|
50
|
+
"Content-Type": "application/json",
|
|
51
|
+
"Authorization": f"Bearer {os.environ['OPENAI_API_KEY']}",
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
messages = []
|
|
55
|
+
if system_prompt:
|
|
56
|
+
messages.append({"role": "system", "content": system_prompt})
|
|
57
|
+
messages.append({"role": "user", "content": prompt})
|
|
58
|
+
|
|
59
|
+
data = {
|
|
60
|
+
"model": self.model,
|
|
61
|
+
"messages": messages,
|
|
62
|
+
"max_tokens": 4096,
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
try:
|
|
66
|
+
req = urllib.request.Request(
|
|
67
|
+
"https://api.openai.com/v1/chat/completions",
|
|
68
|
+
data=json.dumps(data).encode(),
|
|
69
|
+
headers=headers,
|
|
70
|
+
method="POST",
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
with urllib.request.urlopen(req, timeout=timeout_sec) as response:
|
|
74
|
+
result = json.loads(response.read().decode())
|
|
75
|
+
|
|
76
|
+
duration = time.time() - start_time
|
|
77
|
+
|
|
78
|
+
content = result.get("choices", [{}])[0].get("message", {}).get("content", "")
|
|
79
|
+
usage = result.get("usage", {})
|
|
80
|
+
|
|
81
|
+
return LLMResponse(
|
|
82
|
+
content=content,
|
|
83
|
+
model=self.model,
|
|
84
|
+
provider=self.name,
|
|
85
|
+
tokens_used=usage.get("total_tokens"),
|
|
86
|
+
duration_sec=duration,
|
|
87
|
+
)
|
|
88
|
+
|
|
89
|
+
except urllib.error.HTTPError as e:
|
|
90
|
+
body = e.read().decode() if e.fp else ""
|
|
91
|
+
return LLMResponse(
|
|
92
|
+
content=f"HTTP Error: {e.code} - {e.reason}\n{body}",
|
|
93
|
+
model=self.model,
|
|
94
|
+
provider=self.name,
|
|
95
|
+
duration_sec=time.time() - start_time,
|
|
96
|
+
)
|
|
97
|
+
except Exception as e:
|
|
98
|
+
return LLMResponse(
|
|
99
|
+
content=f"Error: {str(e)}",
|
|
100
|
+
model=self.model,
|
|
101
|
+
provider=self.name,
|
|
102
|
+
duration_sec=time.time() - start_time,
|
|
103
|
+
)
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
"""
|
|
2
|
+
OpenCode provider for dev-companion.
|
|
3
|
+
|
|
4
|
+
Uses opencode run command to generate responses.
|
|
5
|
+
Default model: big-pickle (free, local).
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
import json
|
|
9
|
+
import subprocess
|
|
10
|
+
import time
|
|
11
|
+
from pathlib import Path
|
|
12
|
+
from typing import Optional
|
|
13
|
+
|
|
14
|
+
from .base import LLMProvider, LLMResponse
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class OpenCodeProvider(LLMProvider):
|
|
18
|
+
name = "opencode"
|
|
19
|
+
is_local = True
|
|
20
|
+
is_free = True
|
|
21
|
+
|
|
22
|
+
def __init__(self, model: str = "opencode/big-pickle"):
|
|
23
|
+
self.model = model
|
|
24
|
+
|
|
25
|
+
def is_available(self) -> bool:
|
|
26
|
+
try:
|
|
27
|
+
result = subprocess.run(
|
|
28
|
+
["opencode", "--version"],
|
|
29
|
+
capture_output=True,
|
|
30
|
+
timeout=5,
|
|
31
|
+
)
|
|
32
|
+
return result.returncode == 0
|
|
33
|
+
except (FileNotFoundError, subprocess.TimeoutExpired):
|
|
34
|
+
return False
|
|
35
|
+
|
|
36
|
+
def supports_directory_context(self) -> bool:
|
|
37
|
+
return True
|
|
38
|
+
|
|
39
|
+
def get_model_name(self) -> str:
|
|
40
|
+
return self.model
|
|
41
|
+
|
|
42
|
+
def get_priority(self) -> int:
|
|
43
|
+
return 1
|
|
44
|
+
|
|
45
|
+
def generate(
|
|
46
|
+
self,
|
|
47
|
+
prompt: str,
|
|
48
|
+
system_prompt: Optional[str] = None,
|
|
49
|
+
repo_path: Optional[Path] = None,
|
|
50
|
+
timeout_sec: int = 300,
|
|
51
|
+
) -> LLMResponse:
|
|
52
|
+
start_time = time.time()
|
|
53
|
+
|
|
54
|
+
cmd = [
|
|
55
|
+
"opencode",
|
|
56
|
+
"run",
|
|
57
|
+
"--model",
|
|
58
|
+
self.model,
|
|
59
|
+
"--format",
|
|
60
|
+
"json",
|
|
61
|
+
]
|
|
62
|
+
|
|
63
|
+
if repo_path:
|
|
64
|
+
cmd.extend(["--dir", str(repo_path)])
|
|
65
|
+
|
|
66
|
+
full_prompt = prompt
|
|
67
|
+
if system_prompt:
|
|
68
|
+
full_prompt = f"{system_prompt}\n\n---\n\n{prompt}"
|
|
69
|
+
|
|
70
|
+
cmd.append(full_prompt)
|
|
71
|
+
|
|
72
|
+
try:
|
|
73
|
+
result = subprocess.run(
|
|
74
|
+
cmd,
|
|
75
|
+
capture_output=True,
|
|
76
|
+
text=True,
|
|
77
|
+
timeout=timeout_sec,
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
duration = time.time() - start_time
|
|
81
|
+
|
|
82
|
+
if result.returncode != 0:
|
|
83
|
+
return LLMResponse(
|
|
84
|
+
content=f"Error: {result.stderr}",
|
|
85
|
+
model=self.model,
|
|
86
|
+
provider=self.name,
|
|
87
|
+
duration_sec=duration,
|
|
88
|
+
)
|
|
89
|
+
|
|
90
|
+
try:
|
|
91
|
+
lines = result.stdout.strip().split("\n")
|
|
92
|
+
text_parts = []
|
|
93
|
+
for line in lines:
|
|
94
|
+
try:
|
|
95
|
+
data = json.loads(line)
|
|
96
|
+
if data.get("type") == "text":
|
|
97
|
+
part = data.get("part", {})
|
|
98
|
+
if isinstance(part, dict) and "text" in part:
|
|
99
|
+
text_parts.append(part.get("text", ""))
|
|
100
|
+
elif "text" in data:
|
|
101
|
+
text_parts.append(data.get("text", ""))
|
|
102
|
+
except json.JSONDecodeError:
|
|
103
|
+
continue
|
|
104
|
+
if text_parts:
|
|
105
|
+
content = "\n".join(text_parts)
|
|
106
|
+
else:
|
|
107
|
+
content = result.stdout
|
|
108
|
+
except Exception:
|
|
109
|
+
content = result.stdout
|
|
110
|
+
|
|
111
|
+
return LLMResponse(
|
|
112
|
+
content=content,
|
|
113
|
+
model=self.model,
|
|
114
|
+
provider=self.name,
|
|
115
|
+
duration_sec=duration,
|
|
116
|
+
)
|
|
117
|
+
|
|
118
|
+
except subprocess.TimeoutExpired:
|
|
119
|
+
return LLMResponse(
|
|
120
|
+
content=f"Timeout after {timeout_sec} seconds",
|
|
121
|
+
model=self.model,
|
|
122
|
+
provider=self.name,
|
|
123
|
+
duration_sec=timeout_sec,
|
|
124
|
+
)
|
|
125
|
+
|
|
126
|
+
def _extract_content(self, response_data) -> str:
|
|
127
|
+
return ""
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
"""Swarm approvals — gates for plan, architecture, cost, final."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import json
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
from typing import Any
|
|
8
|
+
|
|
9
|
+
from .store import append_trace, atomic_write_json, now_ts
|
|
10
|
+
|
|
11
|
+
GATE_DESCRIPTIONS = {
|
|
12
|
+
"plan": "Plan approval: review task contract, acceptance criteria, risk assessment before implementation.",
|
|
13
|
+
"architecture": "Architecture decision approval: public contract changes or migration requires human decision.",
|
|
14
|
+
"cost_escalation": "Cost escalation approval: raising budget or switching to expensive model requires approval.",
|
|
15
|
+
"final": "Final integration approval: changes must be approved before base-branch merge.",
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def default_gates_for_recipe(recipe: dict[str, Any]) -> list[dict[str, Any]]:
|
|
20
|
+
spec = recipe.get("spec", {}) if isinstance(recipe, dict) else {}
|
|
21
|
+
gates_cfg = spec.get("gates", {}) if isinstance(spec.get("gates"), dict) else {}
|
|
22
|
+
gates: list[dict[str, Any]] = []
|
|
23
|
+
if gates_cfg.get("require_plan_approval"):
|
|
24
|
+
gates.append(
|
|
25
|
+
{
|
|
26
|
+
"id": "plan",
|
|
27
|
+
"description": GATE_DESCRIPTIONS["plan"],
|
|
28
|
+
"required": True,
|
|
29
|
+
"approved": False,
|
|
30
|
+
}
|
|
31
|
+
)
|
|
32
|
+
# architecture gate is on-demand, not default
|
|
33
|
+
# cost gate is on-demand
|
|
34
|
+
if gates_cfg.get("require_final_approval", True):
|
|
35
|
+
gates.append(
|
|
36
|
+
{
|
|
37
|
+
"id": "final",
|
|
38
|
+
"description": GATE_DESCRIPTIONS["final"],
|
|
39
|
+
"required": True,
|
|
40
|
+
"approved": False,
|
|
41
|
+
}
|
|
42
|
+
)
|
|
43
|
+
return gates
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def approvals_path(run_dir: Path) -> Path:
|
|
47
|
+
return run_dir / "approvals.json"
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def load_approvals(run_dir: Path) -> list[dict[str, Any]]:
|
|
51
|
+
p = approvals_path(run_dir)
|
|
52
|
+
if not p.is_file():
|
|
53
|
+
return []
|
|
54
|
+
try:
|
|
55
|
+
data = json.loads(p.read_text(encoding="utf-8"))
|
|
56
|
+
if isinstance(data, list):
|
|
57
|
+
return data
|
|
58
|
+
if isinstance(data, dict) and "gates" in data:
|
|
59
|
+
return data["gates"] # type: ignore
|
|
60
|
+
return []
|
|
61
|
+
except Exception:
|
|
62
|
+
return []
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
def save_approvals(run_dir: Path, gates: list[dict[str, Any]]) -> None:
|
|
66
|
+
atomic_write_json(approvals_path(run_dir), gates)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def request_approval(run_dir: Path, gate_id: str, description: str | None = None) -> dict[str, Any]:
|
|
70
|
+
gates = load_approvals(run_dir)
|
|
71
|
+
for g in gates:
|
|
72
|
+
if g.get("id") == gate_id:
|
|
73
|
+
return g
|
|
74
|
+
gate = {
|
|
75
|
+
"id": gate_id,
|
|
76
|
+
"description": description or GATE_DESCRIPTIONS.get(gate_id, gate_id),
|
|
77
|
+
"required": True,
|
|
78
|
+
"approved": False,
|
|
79
|
+
"requested_at": now_ts(),
|
|
80
|
+
}
|
|
81
|
+
gates.append(gate)
|
|
82
|
+
save_approvals(run_dir, gates)
|
|
83
|
+
append_trace(run_dir, {"ts": now_ts(), "kind": "approval_requested", "gate": gate_id})
|
|
84
|
+
return gate
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
def approve_gate(run_dir: Path, gate_id: str) -> dict[str, Any] | None:
|
|
88
|
+
gates = load_approvals(run_dir)
|
|
89
|
+
for g in gates:
|
|
90
|
+
if g.get("id") == gate_id:
|
|
91
|
+
g["approved"] = True
|
|
92
|
+
g["approved_at"] = now_ts()
|
|
93
|
+
save_approvals(run_dir, gates)
|
|
94
|
+
append_trace(run_dir, {"ts": now_ts(), "kind": "approval_granted", "gate": gate_id})
|
|
95
|
+
return g
|
|
96
|
+
return None
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
def reject_gate(run_dir: Path, gate_id: str, reason: str) -> dict[str, Any] | None:
|
|
100
|
+
gates = load_approvals(run_dir)
|
|
101
|
+
for g in gates:
|
|
102
|
+
if g.get("id") == gate_id:
|
|
103
|
+
g["approved"] = False
|
|
104
|
+
g["rejected"] = True
|
|
105
|
+
g["reason"] = reason
|
|
106
|
+
g["rejected_at"] = now_ts()
|
|
107
|
+
save_approvals(run_dir, gates)
|
|
108
|
+
append_trace(
|
|
109
|
+
run_dir,
|
|
110
|
+
{"ts": now_ts(), "kind": "approval_rejected", "gate": gate_id, "reason": reason},
|
|
111
|
+
)
|
|
112
|
+
return g
|
|
113
|
+
return None
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
def all_required_approved(run_dir: Path) -> bool:
|
|
117
|
+
gates = load_approvals(run_dir)
|
|
118
|
+
for g in gates:
|
|
119
|
+
if g.get("required") and not g.get("approved"):
|
|
120
|
+
return False
|
|
121
|
+
return True
|