agent-devkit 0.1.5 → 0.2.0
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.
- package/README.md +14 -2
- package/package.json +1 -1
- package/runtime/README.md +127 -6
- package/runtime/agent +5 -0
- package/runtime/agents/README.md +34 -0
- package/runtime/agents/agent-devkit-agent-builder/AGENTS.md +24 -0
- package/runtime/agents/agent-devkit-agent-builder/README.md +37 -0
- package/runtime/agents/agent-devkit-agent-builder/agent.yaml +46 -0
- package/runtime/agents/agent-devkit-agent-builder/capabilities/plan-agent/capability.yaml +29 -0
- package/runtime/agents/agent-devkit-agent-builder/capabilities/plan-agent/decision-rules.md +7 -0
- package/runtime/agents/agent-devkit-agent-builder/capabilities/plan-agent/runner.py +33 -0
- package/runtime/agents/agent-devkit-agent-builder/capabilities/plan-agent/workflow.md +8 -0
- package/runtime/agents/agent-devkit-agent-builder/capabilities/scaffold-agent/capability.yaml +31 -0
- package/runtime/agents/agent-devkit-agent-builder/capabilities/scaffold-agent/decision-rules.md +9 -0
- package/runtime/agents/agent-devkit-agent-builder/capabilities/scaffold-agent/runner.py +39 -0
- package/runtime/agents/agent-devkit-agent-builder/capabilities/scaffold-agent/workflow.md +8 -0
- package/runtime/agents/agent-devkit-agent-builder/capabilities/validate-agent-contract/capability.yaml +28 -0
- package/runtime/agents/agent-devkit-agent-builder/capabilities/validate-agent-contract/decision-rules.md +6 -0
- package/runtime/agents/agent-devkit-agent-builder/capabilities/validate-agent-contract/runner.py +33 -0
- package/runtime/agents/agent-devkit-agent-builder/capabilities/validate-agent-contract/workflow.md +7 -0
- package/runtime/agents/agent-devkit-agent-builder/infra/integrations/agent-devkit/agent_builder_repository.py +527 -0
- package/runtime/agents/agent-devkit-agent-builder/knowledge/context.md +15 -0
- package/runtime/agents/agent-devkit-agent-builder/knowledge/policies.yaml +11 -0
- package/runtime/agents/agent-devkit-agent-builder/knowledge/system.md +11 -0
- package/runtime/agents/agent-devkit-agent-builder/templates/agent-plan-output.md +20 -0
- package/runtime/agents/agent-devkit-agent-builder/templates/scaffold-plan-output.md +13 -0
- package/runtime/agents/agent-devkit-agent-builder/templates/validation-report-output.md +13 -0
- package/runtime/agents/agent-devkit-agent-builder/tests/test_runners.py +188 -0
- package/runtime/agents/automation-architect/AGENTS.md +11 -0
- package/runtime/agents/automation-architect/README.md +27 -0
- package/runtime/agents/automation-architect/agent.yaml +57 -0
- package/runtime/agents/automation-architect/capabilities/classify-automation-request/capability.yaml +35 -0
- package/runtime/agents/automation-architect/capabilities/classify-automation-request/decision-rules.md +10 -0
- package/runtime/agents/automation-architect/capabilities/classify-automation-request/runner.py +37 -0
- package/runtime/agents/automation-architect/capabilities/classify-automation-request/workflow.md +7 -0
- package/runtime/agents/automation-architect/capabilities/delegate-automation-build/capability.yaml +34 -0
- package/runtime/agents/automation-architect/capabilities/delegate-automation-build/decision-rules.md +7 -0
- package/runtime/agents/automation-architect/capabilities/delegate-automation-build/runner.py +37 -0
- package/runtime/agents/automation-architect/capabilities/delegate-automation-build/workflow.md +6 -0
- package/runtime/agents/automation-architect/capabilities/plan-automation-solution/capability.yaml +35 -0
- package/runtime/agents/automation-architect/capabilities/plan-automation-solution/decision-rules.md +7 -0
- package/runtime/agents/automation-architect/capabilities/plan-automation-solution/runner.py +37 -0
- package/runtime/agents/automation-architect/capabilities/plan-automation-solution/workflow.md +7 -0
- package/runtime/agents/automation-architect/capabilities/review-automation-solution/capability.yaml +36 -0
- package/runtime/agents/automation-architect/capabilities/review-automation-solution/decision-rules.md +7 -0
- package/runtime/agents/automation-architect/capabilities/review-automation-solution/runner.py +39 -0
- package/runtime/agents/automation-architect/capabilities/review-automation-solution/workflow.md +7 -0
- package/runtime/agents/automation-architect/infra/integrations/automation-architecture/automation_architecture_repository.py +481 -0
- package/runtime/agents/automation-architect/knowledge/context.md +22 -0
- package/runtime/agents/automation-architect/knowledge/policies.yaml +20 -0
- package/runtime/agents/automation-architect/knowledge/system.md +8 -0
- package/runtime/agents/automation-architect/templates/automation-classification.md +6 -0
- package/runtime/agents/automation-architect/templates/automation-plan.md +5 -0
- package/runtime/agents/automation-architect/tests/test_runners.py +135 -0
- package/runtime/agents/aws-architecture-analyst/agent.yaml +17 -4
- package/runtime/agents/aws-cloudwatch-log-analyzer/agent.yaml +12 -2
- package/runtime/agents/aws-cloudwatch-log-analyzer/capabilities/analyze-service-error/capability.yaml +16 -0
- package/runtime/agents/aws-lambda-builder/AGENTS.md +27 -0
- package/runtime/agents/aws-lambda-builder/README.md +21 -0
- package/runtime/agents/aws-lambda-builder/agent.yaml +46 -0
- package/runtime/agents/aws-lambda-builder/capabilities/deploy-lambda-plan/capability.yaml +18 -0
- package/runtime/agents/aws-lambda-builder/capabilities/deploy-lambda-plan/decision-rules.md +6 -0
- package/runtime/agents/aws-lambda-builder/capabilities/deploy-lambda-plan/runner.py +33 -0
- package/runtime/agents/aws-lambda-builder/capabilities/deploy-lambda-plan/workflow.md +6 -0
- package/runtime/agents/aws-lambda-builder/capabilities/generate-lambda-project/capability.yaml +20 -0
- package/runtime/agents/aws-lambda-builder/capabilities/generate-lambda-project/decision-rules.md +6 -0
- package/runtime/agents/aws-lambda-builder/capabilities/generate-lambda-project/runner.py +39 -0
- package/runtime/agents/aws-lambda-builder/capabilities/generate-lambda-project/workflow.md +7 -0
- package/runtime/agents/aws-lambda-builder/capabilities/package-lambda/capability.yaml +22 -0
- package/runtime/agents/aws-lambda-builder/capabilities/package-lambda/decision-rules.md +6 -0
- package/runtime/agents/aws-lambda-builder/capabilities/package-lambda/runner.py +41 -0
- package/runtime/agents/aws-lambda-builder/capabilities/package-lambda/workflow.md +6 -0
- package/runtime/agents/aws-lambda-builder/capabilities/plan-lambda/capability.yaml +18 -0
- package/runtime/agents/aws-lambda-builder/capabilities/plan-lambda/decision-rules.md +7 -0
- package/runtime/agents/aws-lambda-builder/capabilities/plan-lambda/runner.py +33 -0
- package/runtime/agents/aws-lambda-builder/capabilities/plan-lambda/workflow.md +6 -0
- package/runtime/agents/aws-lambda-builder/capabilities/review-lambda-security/capability.yaml +18 -0
- package/runtime/agents/aws-lambda-builder/capabilities/review-lambda-security/decision-rules.md +7 -0
- package/runtime/agents/aws-lambda-builder/capabilities/review-lambda-security/runner.py +33 -0
- package/runtime/agents/aws-lambda-builder/capabilities/review-lambda-security/workflow.md +5 -0
- package/runtime/agents/aws-lambda-builder/infra/integrations/aws-lambda/aws_lambda_repository.py +688 -0
- package/runtime/agents/aws-lambda-builder/knowledge/context.md +12 -0
- package/runtime/agents/aws-lambda-builder/knowledge/policies.yaml +23 -0
- package/runtime/agents/aws-lambda-builder/knowledge/system.md +10 -0
- package/runtime/agents/aws-lambda-builder/templates/lambda-deploy-plan.md +3 -0
- package/runtime/agents/aws-lambda-builder/templates/lambda-package.md +3 -0
- package/runtime/agents/aws-lambda-builder/templates/lambda-plan.md +3 -0
- package/runtime/agents/aws-lambda-builder/templates/lambda-readme.md +3 -0
- package/runtime/agents/aws-lambda-builder/templates/lambda-security-review.md +3 -0
- package/runtime/agents/aws-lambda-builder/tests/test_runners.py +355 -0
- package/runtime/agents/aws-operations-operator/agent.yaml +18 -6
- package/runtime/agents/aws-security-governance-auditor/agent.yaml +17 -5
- package/runtime/agents/azure-devops-orchestrator/agent.yaml +15 -2
- package/runtime/agents/azure-devops-orchestrator/capabilities/read-card/capability.yaml +29 -0
- package/runtime/agents/bpo-analyser/agent.yaml +12 -2
- package/runtime/agents/bpo-analyser/knowledge/policies.yaml +2 -2
- package/runtime/agents/data-scientist-analyst/agent.yaml +16 -4
- package/runtime/agents/data-scientist-analyst/capabilities/generate-data-report/capability.yaml +1 -1
- package/runtime/agents/data-scientist-analyst/capabilities/generate-reconciliation-report/capability.yaml +1 -1
- package/runtime/agents/data-scientist-analyst/capabilities/run-data-pipeline/capability.yaml +1 -1
- package/runtime/agents/data-scientist-analyst/infra/integrations/agent-bridge/methods/analyze-sql-source.yaml +1 -1
- package/runtime/agents/data-scientist-analyst/knowledge/policies.yaml +4 -4
- package/runtime/agents/data-scientist-analyst/knowledge/system.md +1 -1
- package/runtime/agents/data-scientist-analyst/tests/test_runners.py +1 -1
- package/runtime/agents/database-change-operator/agent.yaml +12 -1
- package/runtime/agents/docker-container-builder/AGENTS.md +27 -0
- package/runtime/agents/docker-container-builder/README.md +21 -0
- package/runtime/agents/docker-container-builder/agent.yaml +52 -0
- package/runtime/agents/docker-container-builder/capabilities/analyze-containerization-target/capability.yaml +18 -0
- package/runtime/agents/docker-container-builder/capabilities/analyze-containerization-target/decision-rules.md +6 -0
- package/runtime/agents/docker-container-builder/capabilities/analyze-containerization-target/runner.py +32 -0
- package/runtime/agents/docker-container-builder/capabilities/analyze-containerization-target/workflow.md +6 -0
- package/runtime/agents/docker-container-builder/capabilities/generate-compose/capability.yaml +18 -0
- package/runtime/agents/docker-container-builder/capabilities/generate-compose/decision-rules.md +7 -0
- package/runtime/agents/docker-container-builder/capabilities/generate-compose/runner.py +32 -0
- package/runtime/agents/docker-container-builder/capabilities/generate-compose/workflow.md +6 -0
- package/runtime/agents/docker-container-builder/capabilities/generate-container-project-files/capability.yaml +20 -0
- package/runtime/agents/docker-container-builder/capabilities/generate-container-project-files/decision-rules.md +7 -0
- package/runtime/agents/docker-container-builder/capabilities/generate-container-project-files/runner.py +38 -0
- package/runtime/agents/docker-container-builder/capabilities/generate-container-project-files/workflow.md +7 -0
- package/runtime/agents/docker-container-builder/capabilities/generate-dockerfile/capability.yaml +18 -0
- package/runtime/agents/docker-container-builder/capabilities/generate-dockerfile/decision-rules.md +6 -0
- package/runtime/agents/docker-container-builder/capabilities/generate-dockerfile/runner.py +32 -0
- package/runtime/agents/docker-container-builder/capabilities/generate-dockerfile/workflow.md +7 -0
- package/runtime/agents/docker-container-builder/capabilities/plan-image-build/capability.yaml +18 -0
- package/runtime/agents/docker-container-builder/capabilities/plan-image-build/decision-rules.md +6 -0
- package/runtime/agents/docker-container-builder/capabilities/plan-image-build/runner.py +32 -0
- package/runtime/agents/docker-container-builder/capabilities/plan-image-build/workflow.md +6 -0
- package/runtime/agents/docker-container-builder/capabilities/review-docker-security/capability.yaml +21 -0
- package/runtime/agents/docker-container-builder/capabilities/review-docker-security/decision-rules.md +6 -0
- package/runtime/agents/docker-container-builder/capabilities/review-docker-security/runner.py +43 -0
- package/runtime/agents/docker-container-builder/capabilities/review-docker-security/workflow.md +5 -0
- package/runtime/agents/docker-container-builder/infra/integrations/docker-container/docker_container_repository.py +837 -0
- package/runtime/agents/docker-container-builder/knowledge/context.md +21 -0
- package/runtime/agents/docker-container-builder/knowledge/policies.yaml +13 -0
- package/runtime/agents/docker-container-builder/knowledge/system.md +21 -0
- package/runtime/agents/docker-container-builder/templates/container-plan.md +4 -0
- package/runtime/agents/docker-container-builder/templates/container-review.md +4 -0
- package/runtime/agents/docker-container-builder/templates/docker-compose.md +5 -0
- package/runtime/agents/docker-container-builder/templates/docker-readme.md +3 -0
- package/runtime/agents/docker-container-builder/templates/dockerfile.md +5 -0
- package/runtime/agents/docker-container-builder/tests/test_runners.py +255 -0
- package/runtime/agents/drawio-diagram-builder/agent.yaml +11 -2
- package/runtime/agents/drawio-diagram-builder/capabilities/execute-diagram-delivery/capability.yaml +1 -1
- package/runtime/agents/drawio-diagram-builder/capabilities/read-azure-card-context/capability.yaml +1 -1
- package/runtime/agents/elasticsearch-log-analyzer/agent.yaml +14 -2
- package/runtime/agents/elasticsearch-log-analyzer/capabilities/analyze-service-errors/capability.yaml +14 -0
- package/runtime/agents/excel-workbook-builder/agent.yaml +10 -0
- package/runtime/agents/excel-workbook-builder/capabilities/create-template/capability.yaml +1 -1
- package/runtime/agents/excel-workbook-builder/capabilities/create-template/workflow.md +1 -1
- package/runtime/agents/excel-workbook-builder/capabilities/create-template-version/capability.yaml +1 -1
- package/runtime/agents/excel-workbook-builder/capabilities/generate-template-input-file/capability.yaml +1 -2
- package/runtime/agents/excel-workbook-builder/capabilities/refine-template/capability.yaml +1 -1
- package/runtime/agents/excel-workbook-builder/capabilities/register-template/capability.yaml +1 -2
- package/runtime/agents/excel-workbook-builder/capabilities/register-template/workflow.md +1 -1
- package/runtime/agents/execution-loop-builder/AGENTS.md +24 -0
- package/runtime/agents/execution-loop-builder/README.md +19 -0
- package/runtime/agents/execution-loop-builder/agent.yaml +49 -0
- package/runtime/agents/execution-loop-builder/capabilities/generate-loop-project-files/capability.yaml +20 -0
- package/runtime/agents/execution-loop-builder/capabilities/generate-loop-project-files/decision-rules.md +6 -0
- package/runtime/agents/execution-loop-builder/capabilities/generate-loop-project-files/runner.py +38 -0
- package/runtime/agents/execution-loop-builder/capabilities/generate-loop-project-files/workflow.md +7 -0
- package/runtime/agents/execution-loop-builder/capabilities/generate-loop-runner/capability.yaml +18 -0
- package/runtime/agents/execution-loop-builder/capabilities/generate-loop-runner/decision-rules.md +5 -0
- package/runtime/agents/execution-loop-builder/capabilities/generate-loop-runner/runner.py +32 -0
- package/runtime/agents/execution-loop-builder/capabilities/generate-loop-runner/workflow.md +6 -0
- package/runtime/agents/execution-loop-builder/capabilities/plan-execution-loop/capability.yaml +18 -0
- package/runtime/agents/execution-loop-builder/capabilities/plan-execution-loop/decision-rules.md +6 -0
- package/runtime/agents/execution-loop-builder/capabilities/plan-execution-loop/runner.py +32 -0
- package/runtime/agents/execution-loop-builder/capabilities/plan-execution-loop/workflow.md +6 -0
- package/runtime/agents/execution-loop-builder/capabilities/register-loop-task/capability.yaml +19 -0
- package/runtime/agents/execution-loop-builder/capabilities/register-loop-task/decision-rules.md +6 -0
- package/runtime/agents/execution-loop-builder/capabilities/register-loop-task/runner.py +36 -0
- package/runtime/agents/execution-loop-builder/capabilities/register-loop-task/workflow.md +6 -0
- package/runtime/agents/execution-loop-builder/capabilities/review-loop-safety/capability.yaml +19 -0
- package/runtime/agents/execution-loop-builder/capabilities/review-loop-safety/decision-rules.md +6 -0
- package/runtime/agents/execution-loop-builder/capabilities/review-loop-safety/runner.py +39 -0
- package/runtime/agents/execution-loop-builder/capabilities/review-loop-safety/workflow.md +5 -0
- package/runtime/agents/execution-loop-builder/infra/integrations/execution-loop/execution_loop_repository.py +608 -0
- package/runtime/agents/execution-loop-builder/knowledge/context.md +26 -0
- package/runtime/agents/execution-loop-builder/knowledge/policies.yaml +13 -0
- package/runtime/agents/execution-loop-builder/knowledge/system.md +19 -0
- package/runtime/agents/execution-loop-builder/templates/loop-plan.md +3 -0
- package/runtime/agents/execution-loop-builder/templates/loop-readme.md +3 -0
- package/runtime/agents/execution-loop-builder/templates/loop-review.md +3 -0
- package/runtime/agents/execution-loop-builder/templates/loop-runner.py +2 -0
- package/runtime/agents/execution-loop-builder/tests/test_runners.py +274 -0
- package/runtime/agents/execution-reviewer/AGENTS.md +8 -0
- package/runtime/agents/execution-reviewer/README.md +13 -0
- package/runtime/agents/execution-reviewer/agent.yaml +27 -0
- package/runtime/agents/execution-reviewer/capabilities/review-agent-result/capability.yaml +14 -0
- package/runtime/agents/execution-reviewer/capabilities/review-agent-result/decision-rules.md +6 -0
- package/runtime/agents/execution-reviewer/capabilities/review-agent-result/workflow.md +7 -0
- package/runtime/agents/execution-reviewer/capabilities/review-final-output/capability.yaml +14 -0
- package/runtime/agents/execution-reviewer/capabilities/review-final-output/decision-rules.md +6 -0
- package/runtime/agents/execution-reviewer/capabilities/review-final-output/workflow.md +7 -0
- package/runtime/agents/execution-reviewer/capabilities/review-plan/capability.yaml +14 -0
- package/runtime/agents/execution-reviewer/capabilities/review-plan/decision-rules.md +6 -0
- package/runtime/agents/execution-reviewer/capabilities/review-plan/workflow.md +7 -0
- package/runtime/agents/execution-reviewer/infra/README.md +4 -0
- package/runtime/agents/execution-reviewer/knowledge/context.md +6 -0
- package/runtime/agents/execution-reviewer/knowledge/system.md +18 -0
- package/runtime/agents/execution-reviewer/templates/README.md +4 -0
- package/runtime/agents/figma-ui-ux-product-designer/agent.yaml +17 -5
- package/runtime/agents/figma-ui-ux-product-designer/capabilities/analyze-product-context/capability.yaml +1 -1
- package/runtime/agents/figma-ui-ux-product-designer/capabilities/conduct-design-interview/capability.yaml +1 -1
- package/runtime/agents/figma-ui-ux-product-designer/capabilities/conduct-design-review-session/capability.yaml +1 -1
- package/runtime/agents/figma-ui-ux-product-designer/capabilities/generate-dev-handoff/capability.yaml +1 -1
- package/runtime/agents/figma-ui-ux-product-designer/capabilities/generate-user-journey-diagram/capability.yaml +1 -1
- package/runtime/agents/figma-ui-ux-product-designer/capabilities/ingest-design-source/capability.yaml +1 -1
- package/runtime/agents/figma-ui-ux-product-designer/capabilities/triage-design-feedback/capability.yaml +1 -1
- package/runtime/agents/generic-agent-builder/AGENTS.md +20 -0
- package/runtime/agents/generic-agent-builder/README.md +40 -0
- package/runtime/agents/generic-agent-builder/agent.yaml +43 -0
- package/runtime/agents/generic-agent-builder/capabilities/generate-agent-instructions/capability.yaml +18 -0
- package/runtime/agents/generic-agent-builder/capabilities/generate-agent-instructions/decision-rules.md +5 -0
- package/runtime/agents/generic-agent-builder/capabilities/generate-agent-instructions/runner.py +33 -0
- package/runtime/agents/generic-agent-builder/capabilities/generate-agent-instructions/workflow.md +6 -0
- package/runtime/agents/generic-agent-builder/capabilities/generate-project-agent-files/capability.yaml +20 -0
- package/runtime/agents/generic-agent-builder/capabilities/generate-project-agent-files/decision-rules.md +6 -0
- package/runtime/agents/generic-agent-builder/capabilities/generate-project-agent-files/runner.py +39 -0
- package/runtime/agents/generic-agent-builder/capabilities/generate-project-agent-files/workflow.md +7 -0
- package/runtime/agents/generic-agent-builder/capabilities/generate-skill/capability.yaml +18 -0
- package/runtime/agents/generic-agent-builder/capabilities/generate-skill/decision-rules.md +5 -0
- package/runtime/agents/generic-agent-builder/capabilities/generate-skill/runner.py +33 -0
- package/runtime/agents/generic-agent-builder/capabilities/generate-skill/workflow.md +5 -0
- package/runtime/agents/generic-agent-builder/capabilities/plan-generic-agent/capability.yaml +18 -0
- package/runtime/agents/generic-agent-builder/capabilities/plan-generic-agent/decision-rules.md +6 -0
- package/runtime/agents/generic-agent-builder/capabilities/plan-generic-agent/runner.py +33 -0
- package/runtime/agents/generic-agent-builder/capabilities/plan-generic-agent/workflow.md +6 -0
- package/runtime/agents/generic-agent-builder/capabilities/review-generic-agent/capability.yaml +20 -0
- package/runtime/agents/generic-agent-builder/capabilities/review-generic-agent/decision-rules.md +6 -0
- package/runtime/agents/generic-agent-builder/capabilities/review-generic-agent/runner.py +40 -0
- package/runtime/agents/generic-agent-builder/capabilities/review-generic-agent/workflow.md +7 -0
- package/runtime/agents/generic-agent-builder/infra/integrations/generic-agent/generic_agent_repository.py +445 -0
- package/runtime/agents/generic-agent-builder/knowledge/context.md +11 -0
- package/runtime/agents/generic-agent-builder/knowledge/policies.yaml +12 -0
- package/runtime/agents/generic-agent-builder/knowledge/system.md +17 -0
- package/runtime/agents/generic-agent-builder/templates/generic-agent-instructions.md +17 -0
- package/runtime/agents/generic-agent-builder/templates/generic-review-report.md +13 -0
- package/runtime/agents/generic-agent-builder/templates/generic-skill.md +14 -0
- package/runtime/agents/generic-agent-builder/tests/test_runners.py +220 -0
- package/runtime/agents/github-pr-reviewer/agent.yaml +17 -5
- package/runtime/agents/github-pr-reviewer/capabilities/create-review-automation/capability.yaml +1 -1
- package/runtime/agents/github-pr-reviewer/capabilities/inspect-pr/capability.yaml +1 -1
- package/runtime/agents/github-pr-reviewer/capabilities/list-review-requests/capability.yaml +1 -1
- package/runtime/agents/github-pr-reviewer/capabilities/review-pr-diff/capability.yaml +1 -1
- package/runtime/agents/knowledge-generator/agent.yaml +13 -3
- package/runtime/agents/knowledge-generator/capabilities/generate-knowledge/capability.yaml +1 -1
- package/runtime/agents/local-llm-operator/AGENTS.md +8 -0
- package/runtime/agents/local-llm-operator/README.md +12 -0
- package/runtime/agents/local-llm-operator/agent.yaml +28 -0
- package/runtime/agents/local-llm-operator/capabilities/delegate-operational-task/capability.yaml +14 -0
- package/runtime/agents/local-llm-operator/capabilities/delegate-operational-task/decision-rules.md +6 -0
- package/runtime/agents/local-llm-operator/capabilities/delegate-operational-task/workflow.md +7 -0
- package/runtime/agents/local-llm-operator/capabilities/inspect-local-models/capability.yaml +14 -0
- package/runtime/agents/local-llm-operator/capabilities/inspect-local-models/decision-rules.md +5 -0
- package/runtime/agents/local-llm-operator/capabilities/inspect-local-models/workflow.md +6 -0
- package/runtime/agents/local-llm-operator/capabilities/select-local-worker/capability.yaml +14 -0
- package/runtime/agents/local-llm-operator/capabilities/select-local-worker/decision-rules.md +6 -0
- package/runtime/agents/local-llm-operator/capabilities/select-local-worker/workflow.md +7 -0
- package/runtime/agents/local-llm-operator/infra/README.md +4 -0
- package/runtime/agents/local-llm-operator/knowledge/context.md +6 -0
- package/runtime/agents/local-llm-operator/knowledge/system.md +18 -0
- package/runtime/agents/local-llm-operator/templates/README.md +4 -0
- package/runtime/agents/n1-support-agent/agent.yaml +40 -1
- package/runtime/agents/n2-support-agent/agent.yaml +41 -2
- package/runtime/agents/n2-support-agent/knowledge/policies.yaml +2 -2
- package/runtime/agents/notification-operator/AGENTS.md +11 -0
- package/runtime/agents/notification-operator/README.md +15 -0
- package/runtime/agents/notification-operator/agent.yaml +43 -0
- package/runtime/agents/notification-operator/capabilities/configure-notification-channel/capability.yaml +19 -0
- package/runtime/agents/notification-operator/capabilities/configure-notification-channel/decision-rules.md +6 -0
- package/runtime/agents/notification-operator/capabilities/configure-notification-channel/runner.py +33 -0
- package/runtime/agents/notification-operator/capabilities/configure-notification-channel/workflow.md +6 -0
- package/runtime/agents/notification-operator/capabilities/format-task-completion-notification/capability.yaml +25 -0
- package/runtime/agents/notification-operator/capabilities/format-task-completion-notification/decision-rules.md +7 -0
- package/runtime/agents/notification-operator/capabilities/format-task-completion-notification/runner.py +49 -0
- package/runtime/agents/notification-operator/capabilities/format-task-completion-notification/workflow.md +6 -0
- package/runtime/agents/notification-operator/capabilities/send-task-completion-notification/capability.yaml +27 -0
- package/runtime/agents/notification-operator/capabilities/send-task-completion-notification/decision-rules.md +6 -0
- package/runtime/agents/notification-operator/capabilities/send-task-completion-notification/runner.py +68 -0
- package/runtime/agents/notification-operator/capabilities/send-task-completion-notification/workflow.md +7 -0
- package/runtime/agents/notification-operator/infra/README.md +6 -0
- package/runtime/agents/notification-operator/knowledge/context.md +10 -0
- package/runtime/agents/notification-operator/knowledge/policies.yaml +9 -0
- package/runtime/agents/notification-operator/knowledge/system.md +7 -0
- package/runtime/agents/notification-operator/templates/README.md +6 -0
- package/runtime/agents/notification-operator/tests/test_runners.py +108 -0
- package/runtime/agents/playwright-automation-builder/AGENTS.md +23 -0
- package/runtime/agents/playwright-automation-builder/README.md +43 -0
- package/runtime/agents/playwright-automation-builder/agent.yaml +48 -0
- package/runtime/agents/playwright-automation-builder/capabilities/generate-playwright-project-files/capability.yaml +20 -0
- package/runtime/agents/playwright-automation-builder/capabilities/generate-playwright-project-files/decision-rules.md +6 -0
- package/runtime/agents/playwright-automation-builder/capabilities/generate-playwright-project-files/runner.py +38 -0
- package/runtime/agents/playwright-automation-builder/capabilities/generate-playwright-project-files/workflow.md +6 -0
- package/runtime/agents/playwright-automation-builder/capabilities/generate-playwright-script/capability.yaml +18 -0
- package/runtime/agents/playwright-automation-builder/capabilities/generate-playwright-script/decision-rules.md +6 -0
- package/runtime/agents/playwright-automation-builder/capabilities/generate-playwright-script/runner.py +32 -0
- package/runtime/agents/playwright-automation-builder/capabilities/generate-playwright-script/workflow.md +6 -0
- package/runtime/agents/playwright-automation-builder/capabilities/plan-playwright-automation/capability.yaml +18 -0
- package/runtime/agents/playwright-automation-builder/capabilities/plan-playwright-automation/decision-rules.md +6 -0
- package/runtime/agents/playwright-automation-builder/capabilities/plan-playwright-automation/runner.py +32 -0
- package/runtime/agents/playwright-automation-builder/capabilities/plan-playwright-automation/workflow.md +6 -0
- package/runtime/agents/playwright-automation-builder/capabilities/review-playwright-artifacts/capability.yaml +19 -0
- package/runtime/agents/playwright-automation-builder/capabilities/review-playwright-artifacts/decision-rules.md +6 -0
- package/runtime/agents/playwright-automation-builder/capabilities/review-playwright-artifacts/runner.py +33 -0
- package/runtime/agents/playwright-automation-builder/capabilities/review-playwright-artifacts/workflow.md +6 -0
- package/runtime/agents/playwright-automation-builder/capabilities/run-playwright-check/capability.yaml +22 -0
- package/runtime/agents/playwright-automation-builder/capabilities/run-playwright-check/decision-rules.md +6 -0
- package/runtime/agents/playwright-automation-builder/capabilities/run-playwright-check/runner.py +40 -0
- package/runtime/agents/playwright-automation-builder/capabilities/run-playwright-check/workflow.md +6 -0
- package/runtime/agents/playwright-automation-builder/capabilities/wrap-playwright-as-capability/capability.yaml +22 -0
- package/runtime/agents/playwright-automation-builder/capabilities/wrap-playwright-as-capability/decision-rules.md +6 -0
- package/runtime/agents/playwright-automation-builder/capabilities/wrap-playwright-as-capability/runner.py +42 -0
- package/runtime/agents/playwright-automation-builder/capabilities/wrap-playwright-as-capability/workflow.md +6 -0
- package/runtime/agents/playwright-automation-builder/infra/integrations/playwright-automation/playwright_automation_repository.py +865 -0
- package/runtime/agents/playwright-automation-builder/knowledge/context.md +19 -0
- package/runtime/agents/playwright-automation-builder/knowledge/policies.yaml +25 -0
- package/runtime/agents/playwright-automation-builder/knowledge/system.md +19 -0
- package/runtime/agents/playwright-automation-builder/templates/capability-wrapper.md +4 -0
- package/runtime/agents/playwright-automation-builder/templates/playwright-automation.py +12 -0
- package/runtime/agents/playwright-automation-builder/templates/playwright-readme.md +13 -0
- package/runtime/agents/playwright-automation-builder/templates/playwright-review-report.md +9 -0
- package/runtime/agents/playwright-automation-builder/templates/playwright-test.py +2 -0
- package/runtime/agents/playwright-automation-builder/tests/test_runners.py +261 -0
- package/runtime/agents/postgres-data-analyzer/agent.yaml +13 -2
- package/runtime/agents/presentation-deck-builder/agent.yaml +14 -3
- package/runtime/agents/presentation-deck-builder/capabilities/create-template/capability.yaml +1 -1
- package/runtime/agents/presentation-deck-builder/capabilities/create-template-version/capability.yaml +1 -1
- package/runtime/agents/presentation-deck-builder/capabilities/generate-template-input-file/capability.yaml +1 -1
- package/runtime/agents/presentation-deck-builder/capabilities/refine-template/capability.yaml +1 -1
- package/runtime/agents/presentation-deck-builder/capabilities/register-template/capability.yaml +1 -1
- package/runtime/agents/presentation-deck-builder/knowledge/prompts/create-template.md +1 -1
- package/runtime/agents/presentation-deck-builder/knowledge/prompts/generate-template-input-file.md +1 -1
- package/runtime/agents/provider-configurator/AGENTS.md +8 -0
- package/runtime/agents/provider-configurator/README.md +5 -0
- package/runtime/agents/provider-configurator/agent.yaml +27 -0
- package/runtime/agents/provider-configurator/capabilities/collect-provider-credentials/capability.yaml +14 -0
- package/runtime/agents/provider-configurator/capabilities/collect-provider-credentials/decision-rules.md +6 -0
- package/runtime/agents/provider-configurator/capabilities/collect-provider-credentials/workflow.md +7 -0
- package/runtime/agents/provider-configurator/capabilities/configure-provider-source/capability.yaml +14 -0
- package/runtime/agents/provider-configurator/capabilities/configure-provider-source/decision-rules.md +6 -0
- package/runtime/agents/provider-configurator/capabilities/configure-provider-source/workflow.md +8 -0
- package/runtime/agents/provider-configurator/capabilities/validate-provider-readiness/capability.yaml +14 -0
- package/runtime/agents/provider-configurator/capabilities/validate-provider-readiness/decision-rules.md +6 -0
- package/runtime/agents/provider-configurator/capabilities/validate-provider-readiness/workflow.md +7 -0
- package/runtime/agents/provider-configurator/infra/README.md +5 -0
- package/runtime/agents/provider-configurator/knowledge/context.md +8 -0
- package/runtime/agents/provider-configurator/knowledge/system.md +19 -0
- package/runtime/agents/provider-configurator/templates/README.md +4 -0
- package/runtime/agents/pyautogui-automation-builder/AGENTS.md +32 -0
- package/runtime/agents/pyautogui-automation-builder/README.md +44 -0
- package/runtime/agents/pyautogui-automation-builder/agent.yaml +45 -0
- package/runtime/agents/pyautogui-automation-builder/capabilities/generate-pyautogui-project-files/capability.yaml +20 -0
- package/runtime/agents/pyautogui-automation-builder/capabilities/generate-pyautogui-project-files/decision-rules.md +6 -0
- package/runtime/agents/pyautogui-automation-builder/capabilities/generate-pyautogui-project-files/runner.py +39 -0
- package/runtime/agents/pyautogui-automation-builder/capabilities/generate-pyautogui-project-files/workflow.md +7 -0
- package/runtime/agents/pyautogui-automation-builder/capabilities/generate-pyautogui-script/capability.yaml +18 -0
- package/runtime/agents/pyautogui-automation-builder/capabilities/generate-pyautogui-script/decision-rules.md +7 -0
- package/runtime/agents/pyautogui-automation-builder/capabilities/generate-pyautogui-script/runner.py +33 -0
- package/runtime/agents/pyautogui-automation-builder/capabilities/generate-pyautogui-script/workflow.md +7 -0
- package/runtime/agents/pyautogui-automation-builder/capabilities/plan-desktop-automation/capability.yaml +18 -0
- package/runtime/agents/pyautogui-automation-builder/capabilities/plan-desktop-automation/decision-rules.md +8 -0
- package/runtime/agents/pyautogui-automation-builder/capabilities/plan-desktop-automation/runner.py +33 -0
- package/runtime/agents/pyautogui-automation-builder/capabilities/plan-desktop-automation/workflow.md +9 -0
- package/runtime/agents/pyautogui-automation-builder/capabilities/review-pyautogui-script/capability.yaml +20 -0
- package/runtime/agents/pyautogui-automation-builder/capabilities/review-pyautogui-script/decision-rules.md +8 -0
- package/runtime/agents/pyautogui-automation-builder/capabilities/review-pyautogui-script/runner.py +43 -0
- package/runtime/agents/pyautogui-automation-builder/capabilities/review-pyautogui-script/workflow.md +7 -0
- package/runtime/agents/pyautogui-automation-builder/capabilities/wrap-pyautogui-as-capability/capability.yaml +22 -0
- package/runtime/agents/pyautogui-automation-builder/capabilities/wrap-pyautogui-as-capability/decision-rules.md +6 -0
- package/runtime/agents/pyautogui-automation-builder/capabilities/wrap-pyautogui-as-capability/runner.py +43 -0
- package/runtime/agents/pyautogui-automation-builder/capabilities/wrap-pyautogui-as-capability/workflow.md +7 -0
- package/runtime/agents/pyautogui-automation-builder/infra/integrations/pyautogui-automation/pyautogui_automation_repository.py +856 -0
- package/runtime/agents/pyautogui-automation-builder/knowledge/context.md +17 -0
- package/runtime/agents/pyautogui-automation-builder/knowledge/policies.yaml +24 -0
- package/runtime/agents/pyautogui-automation-builder/knowledge/system.md +13 -0
- package/runtime/agents/pyautogui-automation-builder/templates/capability-wrapper.md +3 -0
- package/runtime/agents/pyautogui-automation-builder/templates/pyautogui-automation.py +12 -0
- package/runtime/agents/pyautogui-automation-builder/templates/pyautogui-readme.md +3 -0
- package/runtime/agents/pyautogui-automation-builder/templates/pyautogui-review-report.md +3 -0
- package/runtime/agents/pyautogui-automation-builder/templates/pyautogui-test.py +2 -0
- package/runtime/agents/pyautogui-automation-builder/tests/test_runners.py +376 -0
- package/runtime/agents/python-automation-builder/AGENTS.md +25 -0
- package/runtime/agents/python-automation-builder/README.md +43 -0
- package/runtime/agents/python-automation-builder/agent.yaml +45 -0
- package/runtime/agents/python-automation-builder/capabilities/generate-automation-project-files/capability.yaml +20 -0
- package/runtime/agents/python-automation-builder/capabilities/generate-automation-project-files/decision-rules.md +6 -0
- package/runtime/agents/python-automation-builder/capabilities/generate-automation-project-files/runner.py +39 -0
- package/runtime/agents/python-automation-builder/capabilities/generate-automation-project-files/workflow.md +7 -0
- package/runtime/agents/python-automation-builder/capabilities/generate-python-automation/capability.yaml +18 -0
- package/runtime/agents/python-automation-builder/capabilities/generate-python-automation/decision-rules.md +5 -0
- package/runtime/agents/python-automation-builder/capabilities/generate-python-automation/runner.py +33 -0
- package/runtime/agents/python-automation-builder/capabilities/generate-python-automation/workflow.md +5 -0
- package/runtime/agents/python-automation-builder/capabilities/plan-python-automation/capability.yaml +18 -0
- package/runtime/agents/python-automation-builder/capabilities/plan-python-automation/decision-rules.md +6 -0
- package/runtime/agents/python-automation-builder/capabilities/plan-python-automation/runner.py +33 -0
- package/runtime/agents/python-automation-builder/capabilities/plan-python-automation/workflow.md +6 -0
- package/runtime/agents/python-automation-builder/capabilities/review-python-automation/capability.yaml +20 -0
- package/runtime/agents/python-automation-builder/capabilities/review-python-automation/decision-rules.md +6 -0
- package/runtime/agents/python-automation-builder/capabilities/review-python-automation/runner.py +43 -0
- package/runtime/agents/python-automation-builder/capabilities/review-python-automation/workflow.md +5 -0
- package/runtime/agents/python-automation-builder/capabilities/wrap-automation-as-capability/capability.yaml +22 -0
- package/runtime/agents/python-automation-builder/capabilities/wrap-automation-as-capability/decision-rules.md +6 -0
- package/runtime/agents/python-automation-builder/capabilities/wrap-automation-as-capability/runner.py +43 -0
- package/runtime/agents/python-automation-builder/capabilities/wrap-automation-as-capability/workflow.md +6 -0
- package/runtime/agents/python-automation-builder/infra/integrations/python-automation/python_automation_repository.py +717 -0
- package/runtime/agents/python-automation-builder/knowledge/context.md +15 -0
- package/runtime/agents/python-automation-builder/knowledge/policies.yaml +12 -0
- package/runtime/agents/python-automation-builder/knowledge/system.md +19 -0
- package/runtime/agents/python-automation-builder/templates/automation-readme.md +13 -0
- package/runtime/agents/python-automation-builder/templates/automation-review-report.md +13 -0
- package/runtime/agents/python-automation-builder/templates/automation-test.py +9 -0
- package/runtime/agents/python-automation-builder/templates/automation.py +19 -0
- package/runtime/agents/python-automation-builder/templates/capability-wrapper.md +4 -0
- package/runtime/agents/python-automation-builder/tests/test_runners.py +292 -0
- package/runtime/agents/selenium-automation-builder/AGENTS.md +27 -0
- package/runtime/agents/selenium-automation-builder/README.md +40 -0
- package/runtime/agents/selenium-automation-builder/agent.yaml +45 -0
- package/runtime/agents/selenium-automation-builder/capabilities/generate-selenium-project-files/capability.yaml +20 -0
- package/runtime/agents/selenium-automation-builder/capabilities/generate-selenium-project-files/decision-rules.md +6 -0
- package/runtime/agents/selenium-automation-builder/capabilities/generate-selenium-project-files/runner.py +39 -0
- package/runtime/agents/selenium-automation-builder/capabilities/generate-selenium-project-files/workflow.md +7 -0
- package/runtime/agents/selenium-automation-builder/capabilities/generate-selenium-script/capability.yaml +18 -0
- package/runtime/agents/selenium-automation-builder/capabilities/generate-selenium-script/decision-rules.md +6 -0
- package/runtime/agents/selenium-automation-builder/capabilities/generate-selenium-script/runner.py +33 -0
- package/runtime/agents/selenium-automation-builder/capabilities/generate-selenium-script/workflow.md +6 -0
- package/runtime/agents/selenium-automation-builder/capabilities/plan-selenium-automation/capability.yaml +18 -0
- package/runtime/agents/selenium-automation-builder/capabilities/plan-selenium-automation/decision-rules.md +6 -0
- package/runtime/agents/selenium-automation-builder/capabilities/plan-selenium-automation/runner.py +33 -0
- package/runtime/agents/selenium-automation-builder/capabilities/plan-selenium-automation/workflow.md +6 -0
- package/runtime/agents/selenium-automation-builder/capabilities/review-selenium-script/capability.yaml +20 -0
- package/runtime/agents/selenium-automation-builder/capabilities/review-selenium-script/decision-rules.md +6 -0
- package/runtime/agents/selenium-automation-builder/capabilities/review-selenium-script/runner.py +40 -0
- package/runtime/agents/selenium-automation-builder/capabilities/review-selenium-script/workflow.md +6 -0
- package/runtime/agents/selenium-automation-builder/capabilities/wrap-selenium-as-capability/capability.yaml +22 -0
- package/runtime/agents/selenium-automation-builder/capabilities/wrap-selenium-as-capability/decision-rules.md +6 -0
- package/runtime/agents/selenium-automation-builder/capabilities/wrap-selenium-as-capability/runner.py +43 -0
- package/runtime/agents/selenium-automation-builder/capabilities/wrap-selenium-as-capability/workflow.md +6 -0
- package/runtime/agents/selenium-automation-builder/infra/integrations/selenium-automation/selenium_automation_repository.py +793 -0
- package/runtime/agents/selenium-automation-builder/knowledge/context.md +15 -0
- package/runtime/agents/selenium-automation-builder/knowledge/policies.yaml +17 -0
- package/runtime/agents/selenium-automation-builder/knowledge/system.md +18 -0
- package/runtime/agents/selenium-automation-builder/templates/capability-wrapper.md +4 -0
- package/runtime/agents/selenium-automation-builder/templates/selenium-automation.py +20 -0
- package/runtime/agents/selenium-automation-builder/templates/selenium-readme.md +13 -0
- package/runtime/agents/selenium-automation-builder/templates/selenium-review-report.md +13 -0
- package/runtime/agents/selenium-automation-builder/templates/selenium-test.py +9 -0
- package/runtime/agents/selenium-automation-builder/tests/test_runners.py +282 -0
- package/runtime/agents/software-specification-analyst/agent.yaml +17 -4
- package/runtime/agents/software-specification-analyst/capabilities/analyze-multiple-projects/capability.yaml +1 -1
- package/runtime/agents/software-specification-analyst/capabilities/analyze-project-context/capability.yaml +1 -1
- package/runtime/agents/software-specification-analyst/capabilities/conduct-requirements-interview/capability.yaml +1 -1
- package/runtime/agents/software-specification-analyst/capabilities/create-complete-spec/capability.yaml +1 -1
- package/runtime/agents/software-specification-analyst/capabilities/create-final-spec-from-analysis/capability.yaml +1 -1
- package/runtime/agents/software-specification-analyst/capabilities/create-functional-spec/capability.yaml +11 -0
- package/runtime/agents/software-specification-analyst/capabilities/create-technical-spec/capability.yaml +12 -0
- package/runtime/agents/software-specification-analyst/capabilities/refine-analysis-with-feedback/capability.yaml +1 -1
- package/runtime/agents/software-specification-analyst/capabilities/write-user-stories/capability.yaml +12 -0
- package/runtime/agents/sqlserver-change-operator/agent.yaml +12 -1
- package/runtime/agents/sqlserver-data-analyzer/agent.yaml +13 -2
- package/runtime/agents/supabase-project-analyst/AGENTS.md +29 -0
- package/runtime/agents/supabase-project-analyst/README.md +23 -0
- package/runtime/agents/supabase-project-analyst/agent.yaml +53 -0
- package/runtime/agents/supabase-project-analyst/capabilities/audit-auth-security/capability.yaml +18 -0
- package/runtime/agents/supabase-project-analyst/capabilities/audit-auth-security/decision-rules.md +5 -0
- package/runtime/agents/supabase-project-analyst/capabilities/audit-auth-security/runner.py +32 -0
- package/runtime/agents/supabase-project-analyst/capabilities/audit-auth-security/workflow.md +6 -0
- package/runtime/agents/supabase-project-analyst/capabilities/audit-rls-policies/capability.yaml +18 -0
- package/runtime/agents/supabase-project-analyst/capabilities/audit-rls-policies/decision-rules.md +6 -0
- package/runtime/agents/supabase-project-analyst/capabilities/audit-rls-policies/runner.py +32 -0
- package/runtime/agents/supabase-project-analyst/capabilities/audit-rls-policies/workflow.md +7 -0
- package/runtime/agents/supabase-project-analyst/capabilities/audit-storage-policies/capability.yaml +18 -0
- package/runtime/agents/supabase-project-analyst/capabilities/audit-storage-policies/decision-rules.md +5 -0
- package/runtime/agents/supabase-project-analyst/capabilities/audit-storage-policies/runner.py +32 -0
- package/runtime/agents/supabase-project-analyst/capabilities/audit-storage-policies/workflow.md +6 -0
- package/runtime/agents/supabase-project-analyst/capabilities/generate-supabase-report/capability.yaml +18 -0
- package/runtime/agents/supabase-project-analyst/capabilities/generate-supabase-report/decision-rules.md +6 -0
- package/runtime/agents/supabase-project-analyst/capabilities/generate-supabase-report/runner.py +32 -0
- package/runtime/agents/supabase-project-analyst/capabilities/generate-supabase-report/workflow.md +6 -0
- package/runtime/agents/supabase-project-analyst/capabilities/inspect-supabase-project/capability.yaml +19 -0
- package/runtime/agents/supabase-project-analyst/capabilities/inspect-supabase-project/decision-rules.md +6 -0
- package/runtime/agents/supabase-project-analyst/capabilities/inspect-supabase-project/runner.py +36 -0
- package/runtime/agents/supabase-project-analyst/capabilities/inspect-supabase-project/workflow.md +7 -0
- package/runtime/agents/supabase-project-analyst/capabilities/plan-supabase-fix/capability.yaml +18 -0
- package/runtime/agents/supabase-project-analyst/capabilities/plan-supabase-fix/decision-rules.md +6 -0
- package/runtime/agents/supabase-project-analyst/capabilities/plan-supabase-fix/runner.py +32 -0
- package/runtime/agents/supabase-project-analyst/capabilities/plan-supabase-fix/workflow.md +6 -0
- package/runtime/agents/supabase-project-analyst/capabilities/review-migrations/capability.yaml +18 -0
- package/runtime/agents/supabase-project-analyst/capabilities/review-migrations/decision-rules.md +6 -0
- package/runtime/agents/supabase-project-analyst/capabilities/review-migrations/runner.py +32 -0
- package/runtime/agents/supabase-project-analyst/capabilities/review-migrations/workflow.md +5 -0
- package/runtime/agents/supabase-project-analyst/infra/integrations/supabase-project/supabase_project_repository.py +589 -0
- package/runtime/agents/supabase-project-analyst/knowledge/context.md +11 -0
- package/runtime/agents/supabase-project-analyst/knowledge/policies.yaml +24 -0
- package/runtime/agents/supabase-project-analyst/knowledge/system.md +10 -0
- package/runtime/agents/supabase-project-analyst/templates/supabase-audit.md +3 -0
- package/runtime/agents/supabase-project-analyst/templates/supabase-fix-plan.md +3 -0
- package/runtime/agents/supabase-project-analyst/templates/supabase-inspection.md +3 -0
- package/runtime/agents/supabase-project-analyst/templates/supabase-report.md +3 -0
- package/runtime/agents/supabase-project-analyst/tests/test_runners.py +239 -0
- package/runtime/agents/task-orchestrator/AGENTS.md +8 -0
- package/runtime/agents/task-orchestrator/README.md +7 -0
- package/runtime/agents/task-orchestrator/agent.yaml +53 -0
- package/runtime/agents/task-orchestrator/capabilities/coordinate-execution/capability.yaml +15 -0
- package/runtime/agents/task-orchestrator/capabilities/coordinate-execution/decision-rules.md +6 -0
- package/runtime/agents/task-orchestrator/capabilities/coordinate-execution/workflow.md +7 -0
- package/runtime/agents/task-orchestrator/capabilities/plan-task/capability.yaml +14 -0
- package/runtime/agents/task-orchestrator/capabilities/plan-task/decision-rules.md +6 -0
- package/runtime/agents/task-orchestrator/capabilities/plan-task/workflow.md +8 -0
- package/runtime/agents/task-orchestrator/capabilities/select-specialists/capability.yaml +14 -0
- package/runtime/agents/task-orchestrator/capabilities/select-specialists/decision-rules.md +6 -0
- package/runtime/agents/task-orchestrator/capabilities/select-specialists/workflow.md +7 -0
- package/runtime/agents/task-orchestrator/infra/README.md +5 -0
- package/runtime/agents/task-orchestrator/knowledge/context.md +9 -0
- package/runtime/agents/task-orchestrator/knowledge/system.md +20 -0
- package/runtime/agents/task-orchestrator/templates/README.md +4 -0
- package/runtime/agents/technical-integration-analyst/agent.yaml +15 -2
- package/runtime/agents/topdesk-orchestrator/agent.yaml +10 -2
- package/runtime/cli/README.md +76 -11
- package/runtime/cli/aikit/__init__.py +1 -1
- package/runtime/cli/aikit/acceptance.py +166 -0
- package/runtime/cli/aikit/agent_executor.py +89 -0
- package/runtime/cli/aikit/agent_registry.py +319 -0
- package/runtime/cli/aikit/app_home.py +87 -2
- package/runtime/cli/aikit/architecture.py +84 -0
- package/runtime/cli/aikit/audit.py +216 -3
- package/runtime/cli/aikit/autonomy.py +237 -0
- package/runtime/cli/aikit/capability_runtime.py +522 -0
- package/runtime/cli/aikit/catalog.py +246 -0
- package/runtime/cli/aikit/cli_dispatch.py +1078 -0
- package/runtime/cli/aikit/cli_parser.py +409 -0
- package/runtime/cli/aikit/collaboration.py +359 -0
- package/runtime/cli/aikit/configuration_orchestrator.py +52 -26
- package/runtime/cli/aikit/contribution.py +105 -0
- package/runtime/cli/aikit/control_router.py +298 -0
- package/runtime/cli/aikit/core/__init__.py +1 -0
- package/runtime/cli/aikit/core/capability_contract.py +112 -0
- package/runtime/cli/aikit/core/requests.py +69 -0
- package/runtime/cli/aikit/core/runtime.py +64 -0
- package/runtime/cli/aikit/decision_store.py +17 -0
- package/runtime/cli/aikit/diagnostics.py +10 -3
- package/runtime/cli/aikit/doctor_runtime.py +79 -0
- package/runtime/cli/aikit/errors.py +7 -0
- package/runtime/cli/aikit/eval.py +158 -0
- package/runtime/cli/aikit/execution_reviewer.py +195 -0
- package/runtime/cli/aikit/extensions.py +140 -0
- package/runtime/cli/aikit/fallback.py +1 -0
- package/runtime/cli/aikit/github_pr.py +23 -0
- package/runtime/cli/aikit/guardrails.py +25 -10
- package/runtime/cli/aikit/human_output.py +1026 -0
- package/runtime/cli/aikit/impact_map.py +294 -0
- package/runtime/cli/aikit/install.py +4 -3
- package/runtime/cli/aikit/interactive_wizard.py +79 -0
- package/runtime/cli/aikit/local_llm_operator.py +146 -0
- package/runtime/cli/aikit/lock.py +4 -1
- package/runtime/cli/aikit/main.py +11 -2561
- package/runtime/cli/aikit/mcp_manifest.py +229 -0
- package/runtime/cli/aikit/mcp_server.py +132 -0
- package/runtime/cli/aikit/mcp_tools.py +262 -0
- package/runtime/cli/aikit/mini_brain.py +227 -0
- package/runtime/cli/aikit/model_router.py +193 -20
- package/runtime/cli/aikit/module_controller.py +335 -0
- package/runtime/cli/aikit/natural_prompt_runtime.py +538 -0
- package/runtime/cli/aikit/notifications.py +716 -2
- package/runtime/cli/aikit/ollama.py +1 -0
- package/runtime/cli/aikit/orchestrator.py +1225 -0
- package/runtime/cli/aikit/output.py +63 -2
- package/runtime/cli/aikit/permissions.py +14 -4
- package/runtime/cli/aikit/prompt_injection.py +57 -0
- package/runtime/cli/aikit/review_gate.py +38 -6
- package/runtime/cli/aikit/roadmap.py +195 -0
- package/runtime/cli/aikit/roadmap_cli.py +70 -0
- package/runtime/cli/aikit/router.py +41 -12
- package/runtime/cli/aikit/router_explain.py +152 -0
- package/runtime/cli/aikit/runtime_paths.py +11 -0
- package/runtime/cli/aikit/secrets.py +113 -0
- package/runtime/cli/aikit/sessions.py +125 -2
- package/runtime/cli/aikit/setup_wizard_payload.py +32 -0
- package/runtime/cli/aikit/sources.py +298 -46
- package/runtime/cli/aikit/tasks.py +449 -21
- package/runtime/cli/aikit/wizard_state.py +517 -0
- package/runtime/cli/aikit/workflows.py +115 -0
- package/runtime/cli/aikit/write_policy.py +108 -0
- package/runtime/plugins/claude-code-ai-devkit/README.md +17 -0
- package/runtime/plugins/claude-code-ai-devkit/agents/README.md +29 -2
- package/runtime/plugins/claude-code-ai-devkit/agents/agent-devkit-db-analyst.md +44 -0
- package/runtime/plugins/claude-code-ai-devkit/agents/agent-devkit-execution-reviewer.md +38 -0
- package/runtime/plugins/claude-code-ai-devkit/agents/agent-devkit-pr-reviewer.md +42 -0
- package/runtime/plugins/claude-code-ai-devkit/agents/agent-devkit-repo-explorer.md +40 -0
- package/runtime/plugins/claude-code-ai-devkit/agents/agent-devkit-support-triage.md +43 -0
- package/runtime/plugins/claude-code-ai-devkit/plugin.json +1 -1
- package/runtime/plugins/claude-code-ai-devkit/skills/ai-devkit-router/SKILL.md +16 -0
- package/runtime/plugins/claude-skill-ai-devkit/ai-devkit/SKILL.md +1 -0
- package/runtime/plugins/claude-skill-ai-devkit/ai-devkit/references/subagents.md +21 -0
- package/runtime/plugins/claude-skill-ai-devkit/plugin.json +1 -1
- package/runtime/providers/azure-devops.yaml +9 -0
- package/runtime/providers/github.yaml +4 -0
- package/runtime/providers/local-notification.yaml +5 -2
- package/runtime/providers/local-scheduler.yaml +1 -1
- package/runtime/providers/supabase.yaml +46 -0
- package/runtime/scripts/release-catalog-snapshot.json +543 -0
- package/runtime/scripts/release-gate.py +141 -1
- package/runtime/scripts/validate-repo.py +312 -0
- package/runtime/vendor/skills/napkin/napkin.md +15 -9
|
@@ -0,0 +1,837 @@
|
|
|
1
|
+
"""Repository for deterministic Docker artifact generation and review."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import json
|
|
6
|
+
import re
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
from typing import Any
|
|
9
|
+
|
|
10
|
+
import yaml
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
SUPPORTED_LANGUAGES = {"python", "node", "go", "java", "unknown"}
|
|
14
|
+
SUPPORTED_TARGETS = {"dev", "prod", "ci"}
|
|
15
|
+
SECRET_NAME_PATTERN = re.compile(
|
|
16
|
+
r"(SECRET|TOKEN|PASSWORD|PASS|API_KEY|PRIVATE_KEY|ACCESS_KEY|SERVICE_ROLE|CONNECTION_STRING)",
|
|
17
|
+
re.IGNORECASE,
|
|
18
|
+
)
|
|
19
|
+
SECRET_ASSIGNMENT_PATTERN = re.compile(
|
|
20
|
+
r"\b(?:SECRET|TOKEN|PASSWORD|PASS|API_KEY|PRIVATE_KEY|ACCESS_KEY|SERVICE_ROLE|CONNECTION_STRING)\b\s*[:=]",
|
|
21
|
+
re.IGNORECASE,
|
|
22
|
+
)
|
|
23
|
+
PRIVATE_URL_PATTERN = re.compile(r"(postgres|mysql|mongodb|redis)://[^\s'\"<>]+", re.IGNORECASE)
|
|
24
|
+
SLUG_PATTERN = re.compile(r"[^a-z0-9]+")
|
|
25
|
+
IMAGE_REF_PATTERN = re.compile(r"^[a-z0-9][a-z0-9._/-]*(?::[a-zA-Z0-9._-]+)?$")
|
|
26
|
+
SAFE_ENV_REF_PATTERN = re.compile(r"^(\$\{[^}]+\}|env:[A-Z_][A-Z0-9_]*|<[^>]+>)$")
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class DockerContainerBuilderError(RuntimeError):
|
|
30
|
+
"""Raised when Docker artifacts cannot be generated or reviewed."""
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class DockerContainerRepository:
|
|
34
|
+
def __init__(self, root: Path | None = None) -> None:
|
|
35
|
+
self.root = root or Path(__file__).resolve().parents[5]
|
|
36
|
+
|
|
37
|
+
def analyze_containerization_target(self, *, project_path: Path) -> dict[str, Any]:
|
|
38
|
+
project_root = self.resolve_project(project_path)
|
|
39
|
+
facts = self.detect_project_facts(project_root)
|
|
40
|
+
risks = self.detect_project_risks(project_root)
|
|
41
|
+
return {
|
|
42
|
+
"kind": "containerization-analysis",
|
|
43
|
+
"status": "ok",
|
|
44
|
+
"project_path": str(project_root),
|
|
45
|
+
"write_policy": "read_only",
|
|
46
|
+
"facts": facts,
|
|
47
|
+
"risks": risks,
|
|
48
|
+
"questions": self.analysis_questions(facts),
|
|
49
|
+
"next_steps": [
|
|
50
|
+
"Review detected language and entrypoint before generating Docker artifacts.",
|
|
51
|
+
"Provide an explicit spec for target, ports, environment refs and services.",
|
|
52
|
+
],
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
def generate_dockerfile(self, *, spec_path: Path) -> dict[str, Any]:
|
|
56
|
+
plan = self.plan_container_artifacts(spec_path=spec_path)
|
|
57
|
+
if plan["status"] != "ok":
|
|
58
|
+
return plan
|
|
59
|
+
spec = self.normalize_spec(self.load_spec(spec_path))
|
|
60
|
+
content = self.render_dockerfile(spec)
|
|
61
|
+
findings = self.review_dockerfile_text(content)
|
|
62
|
+
return {
|
|
63
|
+
"kind": "dockerfile",
|
|
64
|
+
"status": "ok",
|
|
65
|
+
"artifact": "Dockerfile",
|
|
66
|
+
"content": content,
|
|
67
|
+
"bytes": len(content.encode("utf-8")),
|
|
68
|
+
"write_policy": "output_only",
|
|
69
|
+
"security_findings": findings,
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
def generate_compose(self, *, spec_path: Path) -> dict[str, Any]:
|
|
73
|
+
plan = self.plan_container_artifacts(spec_path=spec_path)
|
|
74
|
+
if plan["status"] != "ok":
|
|
75
|
+
return plan
|
|
76
|
+
spec = self.normalize_spec(self.load_spec(spec_path))
|
|
77
|
+
content = self.render_compose(spec)
|
|
78
|
+
findings = self.review_compose_text(content)
|
|
79
|
+
return {
|
|
80
|
+
"kind": "docker-compose",
|
|
81
|
+
"status": "ok",
|
|
82
|
+
"artifact": "docker-compose.yml",
|
|
83
|
+
"content": content,
|
|
84
|
+
"bytes": len(content.encode("utf-8")),
|
|
85
|
+
"write_policy": "output_only",
|
|
86
|
+
"security_findings": findings,
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
def generate_container_project_files(
|
|
90
|
+
self,
|
|
91
|
+
*,
|
|
92
|
+
spec_path: Path,
|
|
93
|
+
execute: bool = False,
|
|
94
|
+
allow_overwrite: bool = False,
|
|
95
|
+
) -> dict[str, Any]:
|
|
96
|
+
plan = self.plan_container_artifacts(spec_path=spec_path)
|
|
97
|
+
if plan["status"] != "ok":
|
|
98
|
+
return plan
|
|
99
|
+
spec = self.normalize_spec(self.load_spec(spec_path))
|
|
100
|
+
target_project = spec.get("target_project")
|
|
101
|
+
if not target_project:
|
|
102
|
+
return {
|
|
103
|
+
"kind": "container-project-files",
|
|
104
|
+
"status": "needs-input",
|
|
105
|
+
"missing_fields": ["target_project"],
|
|
106
|
+
"questions": ["Qual e o caminho do projeto destino?"],
|
|
107
|
+
}
|
|
108
|
+
target_root = Path(str(target_project)).expanduser().resolve()
|
|
109
|
+
files = self.build_container_files(spec)
|
|
110
|
+
return self.write_or_plan_files(
|
|
111
|
+
kind="container-project-files",
|
|
112
|
+
files=files,
|
|
113
|
+
target_root=target_root,
|
|
114
|
+
execute=execute,
|
|
115
|
+
allow_overwrite=allow_overwrite,
|
|
116
|
+
extra={"container": self.container_summary(spec), "write_policy": "local_write"},
|
|
117
|
+
)
|
|
118
|
+
|
|
119
|
+
def review_docker_security(
|
|
120
|
+
self,
|
|
121
|
+
*,
|
|
122
|
+
dockerfile_path: Path | None = None,
|
|
123
|
+
compose_path: Path | None = None,
|
|
124
|
+
dockerfile_text: str | None = None,
|
|
125
|
+
compose_text: str | None = None,
|
|
126
|
+
) -> dict[str, Any]:
|
|
127
|
+
findings: list[dict[str, Any]] = []
|
|
128
|
+
if dockerfile_path is not None:
|
|
129
|
+
findings.extend(self.review_dockerfile_text(dockerfile_path.read_text(encoding="utf-8", errors="replace"), source=str(dockerfile_path)))
|
|
130
|
+
if compose_path is not None:
|
|
131
|
+
findings.extend(self.review_compose_text(compose_path.read_text(encoding="utf-8", errors="replace"), source=str(compose_path)))
|
|
132
|
+
if dockerfile_text is not None:
|
|
133
|
+
findings.extend(self.review_dockerfile_text(dockerfile_text, source="<dockerfile-text>"))
|
|
134
|
+
if compose_text is not None:
|
|
135
|
+
findings.extend(self.review_compose_text(compose_text, source="<compose-text>"))
|
|
136
|
+
valid = not any(finding["severity"] in {"critical", "high"} for finding in findings)
|
|
137
|
+
return {
|
|
138
|
+
"kind": "docker-security-review",
|
|
139
|
+
"status": "ok" if valid else "failed",
|
|
140
|
+
"valid": valid,
|
|
141
|
+
"write_policy": "read_only",
|
|
142
|
+
"findings_count": len(findings),
|
|
143
|
+
"findings": self.dedupe_findings(findings),
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
def plan_image_build(self, *, spec_path: Path) -> dict[str, Any]:
|
|
147
|
+
plan = self.plan_container_artifacts(spec_path=spec_path)
|
|
148
|
+
if plan["status"] != "ok":
|
|
149
|
+
return plan
|
|
150
|
+
spec = self.normalize_spec(self.load_spec(spec_path))
|
|
151
|
+
image = spec["image_name"] or spec["project_slug"]
|
|
152
|
+
tag = spec["image_tag"] or ("dev" if spec["target"] == "dev" else "0.1.0")
|
|
153
|
+
image_ref = f"{image}:{tag}"
|
|
154
|
+
commands = [
|
|
155
|
+
f"docker build --file Dockerfile --tag {image_ref} .",
|
|
156
|
+
]
|
|
157
|
+
if spec["ports"]:
|
|
158
|
+
port_args = " ".join(f"-p {port}:{port}" for port in spec["ports"])
|
|
159
|
+
commands.append(f"docker run --rm {port_args} {image_ref}")
|
|
160
|
+
else:
|
|
161
|
+
commands.append(f"docker run --rm {image_ref}")
|
|
162
|
+
if spec.get("registry"):
|
|
163
|
+
commands.append(f"docker tag {image_ref} {spec['registry'].rstrip('/')}/{image_ref}")
|
|
164
|
+
commands.append(f"docker push {spec['registry'].rstrip('/')}/{image_ref}")
|
|
165
|
+
return {
|
|
166
|
+
"kind": "image-build-plan",
|
|
167
|
+
"status": "ok",
|
|
168
|
+
"deploy_real": False,
|
|
169
|
+
"push_real": False,
|
|
170
|
+
"write_policy": "dry_run",
|
|
171
|
+
"image": image,
|
|
172
|
+
"tag": tag,
|
|
173
|
+
"commands_to_review": commands,
|
|
174
|
+
"blocked_actions": ["docker build", "docker run", "docker compose up", "docker push", "deploy container"],
|
|
175
|
+
"pre_requisites": [
|
|
176
|
+
"Docker installed locally.",
|
|
177
|
+
"Dockerfile and .dockerignore reviewed.",
|
|
178
|
+
"Secrets provided at runtime through env/secret manager, not copied into the image.",
|
|
179
|
+
],
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
def plan_container_artifacts(self, *, spec_path: Path) -> dict[str, Any]:
|
|
183
|
+
spec = self.load_spec(spec_path)
|
|
184
|
+
result = self.validate_spec(spec)
|
|
185
|
+
if result["status"] != "ok":
|
|
186
|
+
return result
|
|
187
|
+
normalized = self.normalize_spec(spec)
|
|
188
|
+
blocked = self.detect_forbidden_spec_content(normalized)
|
|
189
|
+
if blocked:
|
|
190
|
+
return blocked
|
|
191
|
+
files = self.build_container_files(normalized)
|
|
192
|
+
return {
|
|
193
|
+
"kind": "container-artifact-plan",
|
|
194
|
+
"status": "ok",
|
|
195
|
+
"container": self.container_summary(normalized),
|
|
196
|
+
"write_policy": "read_only",
|
|
197
|
+
"planned_artifacts": self.public_file_plan(files),
|
|
198
|
+
"security_findings": [
|
|
199
|
+
*self.review_dockerfile_text(self.render_dockerfile(normalized)),
|
|
200
|
+
*self.review_compose_text(self.render_compose(normalized)),
|
|
201
|
+
],
|
|
202
|
+
"questions": self.open_questions(normalized),
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
def resolve_project(self, project_path: Path) -> Path:
|
|
206
|
+
root = project_path.expanduser().resolve()
|
|
207
|
+
if not root.exists() or not root.is_dir():
|
|
208
|
+
raise DockerContainerBuilderError(f"project path not found: {root}")
|
|
209
|
+
return root
|
|
210
|
+
|
|
211
|
+
def load_spec(self, path: Path) -> dict[str, Any]:
|
|
212
|
+
if not path.exists():
|
|
213
|
+
raise DockerContainerBuilderError(f"spec not found: {path}")
|
|
214
|
+
text = path.read_text(encoding="utf-8")
|
|
215
|
+
payload = json.loads(text) if path.suffix.lower() == ".json" else yaml.safe_load(text) or {}
|
|
216
|
+
if not isinstance(payload, dict):
|
|
217
|
+
raise DockerContainerBuilderError("spec must be a mapping")
|
|
218
|
+
return payload
|
|
219
|
+
|
|
220
|
+
def validate_spec(self, spec: dict[str, Any]) -> dict[str, Any]:
|
|
221
|
+
missing = [field for field in ("project_name", "language", "entrypoint", "target") if not spec.get(field)]
|
|
222
|
+
if missing:
|
|
223
|
+
return {
|
|
224
|
+
"kind": "container-artifact-plan",
|
|
225
|
+
"status": "needs-input",
|
|
226
|
+
"missing_fields": missing,
|
|
227
|
+
"questions": [self.question_for_missing_field(field) for field in missing],
|
|
228
|
+
}
|
|
229
|
+
language = str(spec.get("language") or "").strip().lower()
|
|
230
|
+
if language not in SUPPORTED_LANGUAGES:
|
|
231
|
+
return {
|
|
232
|
+
"kind": "container-artifact-plan",
|
|
233
|
+
"status": "blocked",
|
|
234
|
+
"reason": "unsupported_language",
|
|
235
|
+
"supported_languages": sorted(SUPPORTED_LANGUAGES),
|
|
236
|
+
}
|
|
237
|
+
target = str(spec.get("target") or "").strip().lower()
|
|
238
|
+
if target not in SUPPORTED_TARGETS:
|
|
239
|
+
return {
|
|
240
|
+
"kind": "container-artifact-plan",
|
|
241
|
+
"status": "blocked",
|
|
242
|
+
"reason": "unsupported_target",
|
|
243
|
+
"supported_targets": sorted(SUPPORTED_TARGETS),
|
|
244
|
+
}
|
|
245
|
+
for field in ("ports", "environment", "services", "tags"):
|
|
246
|
+
if spec.get(field) is not None and not isinstance(spec[field], list):
|
|
247
|
+
return {
|
|
248
|
+
"kind": "container-artifact-plan",
|
|
249
|
+
"status": "blocked",
|
|
250
|
+
"reason": "invalid_list_field",
|
|
251
|
+
"field": field,
|
|
252
|
+
"risks": [f"{field} must be a list when provided."],
|
|
253
|
+
}
|
|
254
|
+
return {"status": "ok"}
|
|
255
|
+
|
|
256
|
+
def normalize_spec(self, spec: dict[str, Any]) -> dict[str, Any]:
|
|
257
|
+
normalized = dict(spec)
|
|
258
|
+
normalized["project_name"] = " ".join(str(spec["project_name"]).split())
|
|
259
|
+
normalized["project_slug"] = self.slugify(normalized["project_name"])
|
|
260
|
+
normalized["language"] = str(spec["language"]).strip().lower()
|
|
261
|
+
normalized["target"] = str(spec["target"]).strip().lower()
|
|
262
|
+
normalized["entrypoint"] = " ".join(str(spec["entrypoint"]).split())
|
|
263
|
+
normalized["ports"] = self.normalize_ports(spec.get("ports") or [])
|
|
264
|
+
normalized["environment"] = self.normalize_environment(spec.get("environment") or [])
|
|
265
|
+
normalized["services"] = [self.normalize_service(item) for item in spec.get("services") or []]
|
|
266
|
+
normalized["base_image"] = str(spec.get("base_image") or self.default_base_image(normalized)).strip()
|
|
267
|
+
normalized["package_manager"] = str(spec.get("package_manager") or self.default_package_manager(normalized)).strip()
|
|
268
|
+
normalized["include_compose"] = bool(spec.get("include_compose", True))
|
|
269
|
+
normalized["image_name"] = str(spec.get("image_name") or normalized["project_slug"]).strip()
|
|
270
|
+
normalized["image_tag"] = str(spec.get("image_tag") or "").strip()
|
|
271
|
+
normalized["registry"] = str(spec.get("registry") or "").strip()
|
|
272
|
+
normalized["healthcheck_path"] = str(spec.get("healthcheck_path") or "/health").strip()
|
|
273
|
+
return normalized
|
|
274
|
+
|
|
275
|
+
def detect_project_facts(self, project_root: Path) -> dict[str, Any]:
|
|
276
|
+
files = {path.name for path in project_root.iterdir() if path.is_file()}
|
|
277
|
+
language = "unknown"
|
|
278
|
+
package_manager = None
|
|
279
|
+
if "pyproject.toml" in files or "requirements.txt" in files:
|
|
280
|
+
language = "python"
|
|
281
|
+
package_manager = "pip"
|
|
282
|
+
elif "package.json" in files:
|
|
283
|
+
language = "node"
|
|
284
|
+
package_manager = "npm"
|
|
285
|
+
elif "go.mod" in files:
|
|
286
|
+
language = "go"
|
|
287
|
+
package_manager = "go"
|
|
288
|
+
elif "pom.xml" in files or "build.gradle" in files or "build.gradle.kts" in files:
|
|
289
|
+
language = "java"
|
|
290
|
+
package_manager = "maven" if "pom.xml" in files else "gradle"
|
|
291
|
+
return {
|
|
292
|
+
"language": language,
|
|
293
|
+
"package_manager": package_manager,
|
|
294
|
+
"has_dockerfile": "Dockerfile" in files,
|
|
295
|
+
"has_dockerignore": ".dockerignore" in files,
|
|
296
|
+
"has_compose": "docker-compose.yml" in files or "compose.yml" in files,
|
|
297
|
+
"entrypoint_candidates": self.entrypoint_candidates(project_root, language),
|
|
298
|
+
"ports": self.detect_ports(project_root),
|
|
299
|
+
"sensitive_files": self.sensitive_files(project_root),
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
def detect_project_risks(self, project_root: Path) -> list[dict[str, Any]]:
|
|
303
|
+
risks = []
|
|
304
|
+
facts = self.detect_project_facts(project_root)
|
|
305
|
+
if facts["has_dockerfile"] and not facts["has_dockerignore"]:
|
|
306
|
+
risks.append(self.finding("medium", "missing_dockerignore", ".dockerignore is missing.", "Docker build context may include secrets or heavy caches.", "Add a .dockerignore file."))
|
|
307
|
+
if facts["sensitive_files"]:
|
|
308
|
+
risks.append(self.finding("high", "sensitive_files_in_context", "Sensitive file markers exist in the project root.", "Docker context can accidentally include secrets.", "Ensure .dockerignore excludes these files."))
|
|
309
|
+
return risks
|
|
310
|
+
|
|
311
|
+
def entrypoint_candidates(self, project_root: Path, language: str) -> list[str]:
|
|
312
|
+
candidates = {
|
|
313
|
+
"python": ["app.py", "main.py", "server.py"],
|
|
314
|
+
"node": ["server.js", "app.js", "index.js"],
|
|
315
|
+
"go": ["main.go", "cmd"],
|
|
316
|
+
"java": ["pom.xml", "build.gradle", "build.gradle.kts"],
|
|
317
|
+
}.get(language, [])
|
|
318
|
+
return [candidate for candidate in candidates if (project_root / candidate).exists()]
|
|
319
|
+
|
|
320
|
+
def detect_ports(self, project_root: Path) -> list[int]:
|
|
321
|
+
ports: set[int] = set()
|
|
322
|
+
for file_name in ("package.json", "pyproject.toml", "app.py", "main.py", "server.js", "index.js"):
|
|
323
|
+
path = project_root / file_name
|
|
324
|
+
if not path.exists() or path.stat().st_size > 512_000:
|
|
325
|
+
continue
|
|
326
|
+
text = path.read_text(encoding="utf-8", errors="replace")
|
|
327
|
+
for match in re.finditer(r"\b(?:PORT|port|listen)\D{0,20}(3000|5000|8000|8080|9000)\b", text):
|
|
328
|
+
ports.add(int(match.group(1)))
|
|
329
|
+
return sorted(ports)
|
|
330
|
+
|
|
331
|
+
def sensitive_files(self, project_root: Path) -> list[str]:
|
|
332
|
+
names = []
|
|
333
|
+
for path in project_root.iterdir():
|
|
334
|
+
if path.name.startswith(".env") or path.name in {".npmrc", ".pypirc"} or path.name.endswith((".pem", ".key", ".p12")):
|
|
335
|
+
names.append(path.name)
|
|
336
|
+
return sorted(names)
|
|
337
|
+
|
|
338
|
+
def build_container_files(self, spec: dict[str, Any]) -> list[tuple[str, str]]:
|
|
339
|
+
files = [
|
|
340
|
+
("Dockerfile", self.render_dockerfile(spec)),
|
|
341
|
+
(".dockerignore", self.render_dockerignore(spec)),
|
|
342
|
+
("README.docker.md", self.render_docker_readme(spec)),
|
|
343
|
+
]
|
|
344
|
+
if spec.get("include_compose", True):
|
|
345
|
+
files.append(("docker-compose.yml", self.render_compose(spec)))
|
|
346
|
+
return files
|
|
347
|
+
|
|
348
|
+
def render_dockerfile(self, spec: dict[str, Any]) -> str:
|
|
349
|
+
language = spec["language"]
|
|
350
|
+
if language == "python":
|
|
351
|
+
lines = [
|
|
352
|
+
f"FROM {spec['base_image']}",
|
|
353
|
+
"",
|
|
354
|
+
"ENV PYTHONDONTWRITEBYTECODE=1 \\",
|
|
355
|
+
" PYTHONUNBUFFERED=1",
|
|
356
|
+
"",
|
|
357
|
+
"WORKDIR /app",
|
|
358
|
+
"RUN useradd --create-home --shell /usr/sbin/nologin appuser",
|
|
359
|
+
"",
|
|
360
|
+
"COPY requirements*.txt ./",
|
|
361
|
+
"RUN if [ -f requirements.txt ]; then pip install --no-cache-dir -r requirements.txt; fi",
|
|
362
|
+
"",
|
|
363
|
+
"COPY . .",
|
|
364
|
+
"USER appuser",
|
|
365
|
+
*self.expose_lines(spec),
|
|
366
|
+
*self.healthcheck_lines(spec),
|
|
367
|
+
f"CMD {self.json_command(spec['entrypoint'])}",
|
|
368
|
+
]
|
|
369
|
+
return "\n".join(lines).rstrip() + "\n"
|
|
370
|
+
if language == "node":
|
|
371
|
+
lines = [
|
|
372
|
+
f"FROM {spec['base_image']}",
|
|
373
|
+
"",
|
|
374
|
+
"ENV NODE_ENV=production",
|
|
375
|
+
"WORKDIR /app",
|
|
376
|
+
"RUN groupadd --system appuser && useradd --system --gid appuser appuser",
|
|
377
|
+
"",
|
|
378
|
+
"COPY package*.json ./",
|
|
379
|
+
"RUN if [ -f package-lock.json ]; then npm ci --omit=dev; else npm install --omit=dev; fi",
|
|
380
|
+
"",
|
|
381
|
+
"COPY . .",
|
|
382
|
+
"USER appuser",
|
|
383
|
+
*self.expose_lines(spec),
|
|
384
|
+
*self.healthcheck_lines(spec),
|
|
385
|
+
f"CMD {self.json_command(spec['entrypoint'])}",
|
|
386
|
+
]
|
|
387
|
+
return "\n".join(lines).rstrip() + "\n"
|
|
388
|
+
if language == "go":
|
|
389
|
+
lines = [
|
|
390
|
+
f"FROM {spec['base_image']} AS build",
|
|
391
|
+
"WORKDIR /src",
|
|
392
|
+
"COPY go.mod go.sum* ./",
|
|
393
|
+
"RUN go mod download",
|
|
394
|
+
"COPY . .",
|
|
395
|
+
f"RUN CGO_ENABLED=0 go build -o /out/app {spec['entrypoint']}",
|
|
396
|
+
"",
|
|
397
|
+
"FROM gcr.io/distroless/static-debian12:nonroot",
|
|
398
|
+
"WORKDIR /app",
|
|
399
|
+
"COPY --from=build /out/app /app/app",
|
|
400
|
+
"USER nonroot:nonroot",
|
|
401
|
+
*self.expose_lines(spec),
|
|
402
|
+
'ENTRYPOINT ["/app/app"]',
|
|
403
|
+
]
|
|
404
|
+
return "\n".join(lines).rstrip() + "\n"
|
|
405
|
+
if language == "java":
|
|
406
|
+
lines = [
|
|
407
|
+
f"FROM {spec['base_image']} AS build",
|
|
408
|
+
"WORKDIR /src",
|
|
409
|
+
"COPY . .",
|
|
410
|
+
"RUN if [ -f mvnw ]; then ./mvnw -DskipTests package; else mvn -DskipTests package; fi",
|
|
411
|
+
"",
|
|
412
|
+
"FROM eclipse-temurin:21-jre-jammy",
|
|
413
|
+
"WORKDIR /app",
|
|
414
|
+
"RUN useradd --create-home --shell /usr/sbin/nologin appuser",
|
|
415
|
+
"COPY --from=build /src/target/*.jar /app/app.jar",
|
|
416
|
+
"USER appuser",
|
|
417
|
+
*self.expose_lines(spec),
|
|
418
|
+
*self.healthcheck_lines(spec),
|
|
419
|
+
'ENTRYPOINT ["java", "-jar", "/app/app.jar"]',
|
|
420
|
+
]
|
|
421
|
+
return "\n".join(lines).rstrip() + "\n"
|
|
422
|
+
return "\n".join([
|
|
423
|
+
"FROM alpine:3.20",
|
|
424
|
+
"WORKDIR /app",
|
|
425
|
+
"RUN adduser -D -H appuser",
|
|
426
|
+
"COPY . .",
|
|
427
|
+
"USER appuser",
|
|
428
|
+
*self.expose_lines(spec),
|
|
429
|
+
f"CMD {self.json_command(spec['entrypoint'])}",
|
|
430
|
+
]).rstrip() + "\n"
|
|
431
|
+
|
|
432
|
+
def render_dockerignore(self, _spec: dict[str, Any]) -> str:
|
|
433
|
+
return "\n".join([
|
|
434
|
+
".git",
|
|
435
|
+
".gitignore",
|
|
436
|
+
".env",
|
|
437
|
+
".env.*",
|
|
438
|
+
".ssh",
|
|
439
|
+
"*.pem",
|
|
440
|
+
"*.key",
|
|
441
|
+
"*.p12",
|
|
442
|
+
"__pycache__",
|
|
443
|
+
"*.pyc",
|
|
444
|
+
".pytest_cache",
|
|
445
|
+
".mypy_cache",
|
|
446
|
+
".ruff_cache",
|
|
447
|
+
".venv",
|
|
448
|
+
"venv",
|
|
449
|
+
"node_modules",
|
|
450
|
+
"npm-debug.log",
|
|
451
|
+
"dist",
|
|
452
|
+
"build",
|
|
453
|
+
"target",
|
|
454
|
+
".DS_Store",
|
|
455
|
+
"",
|
|
456
|
+
])
|
|
457
|
+
|
|
458
|
+
def render_compose(self, spec: dict[str, Any]) -> str:
|
|
459
|
+
service_name = spec["project_slug"].replace("-", "_")
|
|
460
|
+
named_volumes: list[str] = []
|
|
461
|
+
lines = [
|
|
462
|
+
"services:",
|
|
463
|
+
f" {service_name}:",
|
|
464
|
+
" build:",
|
|
465
|
+
" context: .",
|
|
466
|
+
" dockerfile: Dockerfile",
|
|
467
|
+
f" image: {spec['image_name']}:{spec['image_tag'] or 'dev'}",
|
|
468
|
+
]
|
|
469
|
+
if spec["ports"]:
|
|
470
|
+
lines.append(" ports:")
|
|
471
|
+
for port in spec["ports"]:
|
|
472
|
+
lines.append(f' - "{port}:{port}"')
|
|
473
|
+
if spec["environment"]:
|
|
474
|
+
lines.append(" environment:")
|
|
475
|
+
for item in spec["environment"]:
|
|
476
|
+
lines.append(f" {item['name']}: {item['value']}")
|
|
477
|
+
lines.extend(self.compose_healthcheck_lines(spec))
|
|
478
|
+
if spec["services"]:
|
|
479
|
+
lines.append(" depends_on:")
|
|
480
|
+
for service in spec["services"]:
|
|
481
|
+
lines.append(f" {service['name']}:")
|
|
482
|
+
lines.append(" condition: service_healthy")
|
|
483
|
+
for service in spec["services"]:
|
|
484
|
+
service_lines, volume = self.render_compose_service(service)
|
|
485
|
+
lines.extend(service_lines)
|
|
486
|
+
if volume:
|
|
487
|
+
named_volumes.append(volume)
|
|
488
|
+
if named_volumes:
|
|
489
|
+
lines.append("volumes:")
|
|
490
|
+
for volume in sorted(set(named_volumes)):
|
|
491
|
+
lines.append(f" {volume}:")
|
|
492
|
+
return "\n".join(lines).rstrip() + "\n"
|
|
493
|
+
|
|
494
|
+
def render_compose_service(self, service: dict[str, str]) -> tuple[list[str], str | None]:
|
|
495
|
+
lines = [
|
|
496
|
+
f" {service['name']}:",
|
|
497
|
+
f" image: {service['image']}",
|
|
498
|
+
]
|
|
499
|
+
if service.get("port"):
|
|
500
|
+
lines.extend([" expose:", f" - \"{service['port']}\""])
|
|
501
|
+
if service.get("volume"):
|
|
502
|
+
lines.extend([" volumes:", f" - {service['volume']}:/data"])
|
|
503
|
+
lines.extend([
|
|
504
|
+
" healthcheck:",
|
|
505
|
+
" test: [\"CMD\", \"true\"]",
|
|
506
|
+
" interval: 10s",
|
|
507
|
+
" timeout: 3s",
|
|
508
|
+
" retries: 5",
|
|
509
|
+
])
|
|
510
|
+
return lines, service["volume"] or None
|
|
511
|
+
|
|
512
|
+
def render_docker_readme(self, spec: dict[str, Any]) -> str:
|
|
513
|
+
image_ref = f"{spec['image_name']}:{spec['image_tag'] or ('dev' if spec['target'] == 'dev' else '0.1.0')}"
|
|
514
|
+
run_ports = " ".join(f"-p {port}:{port}" for port in spec["ports"])
|
|
515
|
+
run_command = f"docker run --rm {run_ports} {image_ref}".replace(" ", " ").strip()
|
|
516
|
+
return "\n".join([
|
|
517
|
+
f"# Docker: {spec['project_name']}",
|
|
518
|
+
"",
|
|
519
|
+
"## Build",
|
|
520
|
+
"",
|
|
521
|
+
"```sh",
|
|
522
|
+
f"docker build -t {image_ref} .",
|
|
523
|
+
"```",
|
|
524
|
+
"",
|
|
525
|
+
"## Run",
|
|
526
|
+
"",
|
|
527
|
+
"```sh",
|
|
528
|
+
run_command,
|
|
529
|
+
"```",
|
|
530
|
+
"",
|
|
531
|
+
"## Notes",
|
|
532
|
+
"",
|
|
533
|
+
"- Review `.dockerignore` before build.",
|
|
534
|
+
"- Provide secrets only at runtime through env or a secret manager.",
|
|
535
|
+
"- Do not push images before reviewing tags and registry permissions.",
|
|
536
|
+
"",
|
|
537
|
+
])
|
|
538
|
+
|
|
539
|
+
def review_dockerfile_text(self, text: str, *, source: str = "Dockerfile") -> list[dict[str, Any]]:
|
|
540
|
+
findings: list[dict[str, Any]] = []
|
|
541
|
+
lower = text.lower()
|
|
542
|
+
if "user " not in lower:
|
|
543
|
+
findings.append(self.finding("high", "missing_non_root_user", "Dockerfile does not set USER.", "Container may run as root.", "Create and use a non-root user.", source=source))
|
|
544
|
+
if re.search(r"^FROM\s+\S+:latest\b", text, re.IGNORECASE | re.MULTILINE):
|
|
545
|
+
findings.append(self.finding("medium", "base_image_latest", "Base image uses latest tag.", "Builds are not reproducible.", "Pin an explicit version tag.", source=source))
|
|
546
|
+
if re.search(r"\bCOPY\s+\. ", text, re.IGNORECASE) and ".dockerignore" not in lower:
|
|
547
|
+
findings.append(self.finding("medium", "broad_copy_requires_dockerignore", "Dockerfile copies full context.", "Secrets can enter image if .dockerignore is missing.", "Generate and review .dockerignore.", source=source))
|
|
548
|
+
if re.search(r"\bADD\s+https?://", text, re.IGNORECASE):
|
|
549
|
+
findings.append(self.finding("medium", "remote_add", "Dockerfile uses ADD from remote URL.", "Remote downloads reduce reproducibility.", "Download dependencies through package manager or verified checksums.", source=source))
|
|
550
|
+
if SECRET_ASSIGNMENT_PATTERN.search(text) or PRIVATE_URL_PATTERN.search(text):
|
|
551
|
+
findings.append(self.finding("critical", "secret_marker_in_dockerfile", "Secret marker or private URL appears in Dockerfile.", "Secrets can be baked into image layers.", "Move secrets to runtime env or secret manager.", source=source))
|
|
552
|
+
return findings
|
|
553
|
+
|
|
554
|
+
def review_compose_text(self, text: str, *, source: str = "docker-compose.yml") -> list[dict[str, Any]]:
|
|
555
|
+
findings: list[dict[str, Any]] = []
|
|
556
|
+
lower = text.lower()
|
|
557
|
+
if "privileged: true" in lower:
|
|
558
|
+
findings.append(self.finding("critical", "compose_privileged", "Compose enables privileged mode.", "Privileged containers can escape intended isolation.", "Remove privileged mode.", source=source))
|
|
559
|
+
if "network_mode: host" in lower:
|
|
560
|
+
findings.append(self.finding("high", "compose_host_network", "Compose uses host network.", "Host network broadens exposure.", "Use explicit ports and bridge networks.", source=source))
|
|
561
|
+
if re.search(r"[-:]\s*/:/", text):
|
|
562
|
+
findings.append(self.finding("critical", "compose_mounts_host_root", "Compose appears to mount host root.", "Mounting / exposes the host filesystem.", "Use named volumes or scoped bind mounts.", source=source))
|
|
563
|
+
if SECRET_ASSIGNMENT_PATTERN.search(text) or PRIVATE_URL_PATTERN.search(text):
|
|
564
|
+
findings.append(self.finding("critical", "secret_marker_in_compose", "Secret marker or private URL appears in compose.", "Secrets can leak through committed compose files.", "Use env references or secret manager integration.", source=source))
|
|
565
|
+
return findings
|
|
566
|
+
|
|
567
|
+
def detect_forbidden_spec_content(self, spec: dict[str, Any]) -> dict[str, Any] | None:
|
|
568
|
+
rendered = json.dumps(spec, ensure_ascii=False)
|
|
569
|
+
if SECRET_ASSIGNMENT_PATTERN.search(rendered) or PRIVATE_URL_PATTERN.search(rendered):
|
|
570
|
+
return {
|
|
571
|
+
"kind": "container-artifact-plan",
|
|
572
|
+
"status": "blocked",
|
|
573
|
+
"reason": "forbidden_sensitive_marker",
|
|
574
|
+
"write_policy": "read_only",
|
|
575
|
+
"risks": ["Spec contains secret assignment marker or private connection URL."],
|
|
576
|
+
}
|
|
577
|
+
for env in spec["environment"]:
|
|
578
|
+
if SECRET_NAME_PATTERN.search(env["name"]) and not SAFE_ENV_REF_PATTERN.match(env["value"]):
|
|
579
|
+
return {
|
|
580
|
+
"kind": "container-artifact-plan",
|
|
581
|
+
"status": "blocked",
|
|
582
|
+
"reason": "hardcoded_secret_env_value",
|
|
583
|
+
"field": env["name"],
|
|
584
|
+
"risks": ["Secret-like environment variable must use env:, ${...} or <placeholder> reference."],
|
|
585
|
+
}
|
|
586
|
+
return None
|
|
587
|
+
|
|
588
|
+
def write_or_plan_files(
|
|
589
|
+
self,
|
|
590
|
+
*,
|
|
591
|
+
kind: str,
|
|
592
|
+
files: list[tuple[str, str]],
|
|
593
|
+
target_root: Path,
|
|
594
|
+
execute: bool,
|
|
595
|
+
allow_overwrite: bool,
|
|
596
|
+
extra: dict[str, Any],
|
|
597
|
+
) -> dict[str, Any]:
|
|
598
|
+
if not target_root.exists() or not target_root.is_dir():
|
|
599
|
+
return {
|
|
600
|
+
"kind": kind,
|
|
601
|
+
"status": "blocked",
|
|
602
|
+
"reason": "target_project_missing",
|
|
603
|
+
"target_project": str(target_root),
|
|
604
|
+
"risks": ["target_project must exist before files can be written."],
|
|
605
|
+
}
|
|
606
|
+
checked_files = []
|
|
607
|
+
for relative_path, content in files:
|
|
608
|
+
target = (target_root / relative_path).resolve()
|
|
609
|
+
if Path(relative_path).is_absolute() or not self.is_inside(target_root, target):
|
|
610
|
+
return {
|
|
611
|
+
"kind": kind,
|
|
612
|
+
"status": "blocked",
|
|
613
|
+
"reason": "path_outside_target_project",
|
|
614
|
+
"path": relative_path,
|
|
615
|
+
"target_project": str(target_root),
|
|
616
|
+
}
|
|
617
|
+
checked_files.append((relative_path, target, content))
|
|
618
|
+
if not execute:
|
|
619
|
+
return {
|
|
620
|
+
"kind": kind,
|
|
621
|
+
"status": "planned",
|
|
622
|
+
"dry_run": True,
|
|
623
|
+
"target_project": str(target_root),
|
|
624
|
+
"planned_files": [
|
|
625
|
+
{"path": relative_path, "absolute_path": str(target), "bytes": len(content.encode("utf-8"))}
|
|
626
|
+
for relative_path, target, content in checked_files
|
|
627
|
+
],
|
|
628
|
+
**extra,
|
|
629
|
+
"next_steps": ["Rerun with --execute after reviewing the planned files."],
|
|
630
|
+
}
|
|
631
|
+
existing = [target for _relative_path, target, _content in checked_files if target.exists()]
|
|
632
|
+
if existing and not allow_overwrite:
|
|
633
|
+
return {
|
|
634
|
+
"kind": kind,
|
|
635
|
+
"status": "blocked",
|
|
636
|
+
"reason": "target_exists",
|
|
637
|
+
"target_project": str(target_root),
|
|
638
|
+
"existing_files": [str(path) for path in existing],
|
|
639
|
+
**extra,
|
|
640
|
+
"next_steps": ["Rerun with --allow-overwrite only after reviewing the existing files."],
|
|
641
|
+
}
|
|
642
|
+
written_files = []
|
|
643
|
+
for _relative_path, target, content in checked_files:
|
|
644
|
+
target.parent.mkdir(parents=True, exist_ok=True)
|
|
645
|
+
target.write_text(content, encoding="utf-8")
|
|
646
|
+
written_files.append({"path": str(target), "bytes": len(content.encode("utf-8"))})
|
|
647
|
+
return {
|
|
648
|
+
"kind": kind,
|
|
649
|
+
"status": "written",
|
|
650
|
+
"dry_run": False,
|
|
651
|
+
"target_project": str(target_root),
|
|
652
|
+
"written_files": written_files,
|
|
653
|
+
**extra,
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
def normalize_ports(self, ports: list[Any]) -> list[int]:
|
|
657
|
+
normalized: list[int] = []
|
|
658
|
+
for port in ports:
|
|
659
|
+
try:
|
|
660
|
+
value = int(port)
|
|
661
|
+
except (TypeError, ValueError) as exc:
|
|
662
|
+
raise DockerContainerBuilderError(f"invalid port: {port}") from exc
|
|
663
|
+
if value < 1 or value > 65535:
|
|
664
|
+
raise DockerContainerBuilderError(f"invalid port: {port}")
|
|
665
|
+
normalized.append(value)
|
|
666
|
+
return sorted(set(normalized))
|
|
667
|
+
|
|
668
|
+
def normalize_environment(self, environment: list[Any]) -> list[dict[str, str]]:
|
|
669
|
+
normalized = []
|
|
670
|
+
for item in environment:
|
|
671
|
+
if isinstance(item, str):
|
|
672
|
+
name = item.strip()
|
|
673
|
+
value = f"${{{name}}}"
|
|
674
|
+
elif isinstance(item, dict):
|
|
675
|
+
name = str(item.get("name") or item.get("key") or "").strip()
|
|
676
|
+
value = str(item.get("value") or f"${{{name}}}").strip()
|
|
677
|
+
else:
|
|
678
|
+
raise DockerContainerBuilderError("environment entries must be strings or mappings")
|
|
679
|
+
if not name:
|
|
680
|
+
raise DockerContainerBuilderError("environment entry missing name")
|
|
681
|
+
normalized.append({"name": name, "value": value})
|
|
682
|
+
return normalized
|
|
683
|
+
|
|
684
|
+
def normalize_service(self, item: Any) -> dict[str, str]:
|
|
685
|
+
if isinstance(item, str):
|
|
686
|
+
if not IMAGE_REF_PATTERN.match(item):
|
|
687
|
+
raise DockerContainerBuilderError(f"invalid service image: {item}")
|
|
688
|
+
name = self.slugify(item).replace("-", "_")
|
|
689
|
+
return {"name": name, "image": item, "port": "", "volume": ""}
|
|
690
|
+
if not isinstance(item, dict):
|
|
691
|
+
raise DockerContainerBuilderError("services entries must be strings or mappings")
|
|
692
|
+
name = self.slugify(str(item.get("name") or item.get("image") or "service")).replace("-", "_")
|
|
693
|
+
image = str(item.get("image") or name).strip()
|
|
694
|
+
if not IMAGE_REF_PATTERN.match(image):
|
|
695
|
+
raise DockerContainerBuilderError(f"invalid service image: {image}")
|
|
696
|
+
return {
|
|
697
|
+
"name": name,
|
|
698
|
+
"image": image,
|
|
699
|
+
"port": str(item.get("port") or "").strip(),
|
|
700
|
+
"volume": self.slugify(str(item.get("volume") or "")) if item.get("volume") else "",
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
def default_base_image(self, spec: dict[str, Any]) -> str:
|
|
704
|
+
language = spec["language"]
|
|
705
|
+
target = spec["target"]
|
|
706
|
+
if language == "python":
|
|
707
|
+
return "python:3.12-slim"
|
|
708
|
+
if language == "node":
|
|
709
|
+
return "node:20-bookworm-slim"
|
|
710
|
+
if language == "go":
|
|
711
|
+
return "golang:1.22-bookworm"
|
|
712
|
+
if language == "java":
|
|
713
|
+
return "maven:3.9-eclipse-temurin-21"
|
|
714
|
+
return "alpine:3.20" if target != "prod" else "alpine:3.20"
|
|
715
|
+
|
|
716
|
+
def default_package_manager(self, spec: dict[str, Any]) -> str:
|
|
717
|
+
return {"python": "pip", "node": "npm", "go": "go", "java": "maven"}.get(spec["language"], "unknown")
|
|
718
|
+
|
|
719
|
+
def expose_lines(self, spec: dict[str, Any]) -> list[str]:
|
|
720
|
+
return [f"EXPOSE {port}" for port in spec["ports"]]
|
|
721
|
+
|
|
722
|
+
def healthcheck_lines(self, spec: dict[str, Any]) -> list[str]:
|
|
723
|
+
if not spec["ports"] or spec["language"] == "go":
|
|
724
|
+
return []
|
|
725
|
+
port = spec["ports"][0]
|
|
726
|
+
if spec["language"] == "node":
|
|
727
|
+
return [f'HEALTHCHECK CMD node -e "require(\'http\').get(\'http://127.0.0.1:{port}{spec["healthcheck_path"]}\', r => process.exit(r.statusCode < 500 ? 0 : 1)).on(\'error\', () => process.exit(1))"']
|
|
728
|
+
return [f'HEALTHCHECK CMD python -c "import urllib.request; urllib.request.urlopen(\'http://127.0.0.1:{port}{spec["healthcheck_path"]}\', timeout=2)" || exit 1']
|
|
729
|
+
|
|
730
|
+
def compose_healthcheck_lines(self, spec: dict[str, Any]) -> list[str]:
|
|
731
|
+
if not spec["ports"]:
|
|
732
|
+
return []
|
|
733
|
+
port = spec["ports"][0]
|
|
734
|
+
if spec["language"] == "python":
|
|
735
|
+
test = f"python -c \"import urllib.request; urllib.request.urlopen('http://127.0.0.1:{port}{spec['healthcheck_path']}', timeout=2)\""
|
|
736
|
+
elif spec["language"] == "node":
|
|
737
|
+
test = f"node -e \"require('http').get('http://127.0.0.1:{port}{spec['healthcheck_path']}', r => process.exit(r.statusCode < 500 ? 0 : 1)).on('error', () => process.exit(1))\""
|
|
738
|
+
else:
|
|
739
|
+
test = "true"
|
|
740
|
+
return [
|
|
741
|
+
" healthcheck:",
|
|
742
|
+
f" test: [\"CMD-SHELL\", {json.dumps(test)}]",
|
|
743
|
+
" interval: 10s",
|
|
744
|
+
" timeout: 3s",
|
|
745
|
+
" retries: 5",
|
|
746
|
+
]
|
|
747
|
+
|
|
748
|
+
def json_command(self, command: str) -> str:
|
|
749
|
+
parts = [part for part in command.split(" ") if part]
|
|
750
|
+
return json.dumps(parts)
|
|
751
|
+
|
|
752
|
+
def container_summary(self, spec: dict[str, Any]) -> dict[str, Any]:
|
|
753
|
+
return {
|
|
754
|
+
"name": spec["project_name"],
|
|
755
|
+
"slug": spec["project_slug"],
|
|
756
|
+
"language": spec["language"],
|
|
757
|
+
"target": spec["target"],
|
|
758
|
+
"entrypoint": spec["entrypoint"],
|
|
759
|
+
"ports": spec["ports"],
|
|
760
|
+
"include_compose": spec["include_compose"],
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
def public_file_plan(self, files: list[tuple[str, str]]) -> list[dict[str, Any]]:
|
|
764
|
+
return [{"path": path, "bytes": len(content.encode("utf-8"))} for path, content in files]
|
|
765
|
+
|
|
766
|
+
def analysis_questions(self, facts: dict[str, Any]) -> list[str]:
|
|
767
|
+
questions = []
|
|
768
|
+
if facts["language"] == "unknown":
|
|
769
|
+
questions.append("Qual linguagem/runtime deve ser usado no container?")
|
|
770
|
+
if not facts["entrypoint_candidates"]:
|
|
771
|
+
questions.append("Qual comando inicia a aplicacao dentro do container?")
|
|
772
|
+
if not facts["ports"]:
|
|
773
|
+
questions.append("A aplicacao expoe alguma porta HTTP/TCP?")
|
|
774
|
+
return questions
|
|
775
|
+
|
|
776
|
+
def open_questions(self, spec: dict[str, Any]) -> list[str]:
|
|
777
|
+
questions = []
|
|
778
|
+
if spec["language"] == "unknown":
|
|
779
|
+
questions.append("A linguagem foi marcada como unknown; revise manualmente a imagem base e o entrypoint.")
|
|
780
|
+
if not spec["ports"]:
|
|
781
|
+
questions.append("Sem portas declaradas; confirme se o container e batch/worker.")
|
|
782
|
+
if not spec["environment"]:
|
|
783
|
+
questions.append("Sem environment refs; confirme se a aplicacao nao requer configuracao externa.")
|
|
784
|
+
return questions
|
|
785
|
+
|
|
786
|
+
def question_for_missing_field(self, field: str) -> str:
|
|
787
|
+
return {
|
|
788
|
+
"project_name": "Qual e o nome do projeto/container?",
|
|
789
|
+
"language": "Qual linguagem deve ser usada? python, node, go, java ou unknown.",
|
|
790
|
+
"entrypoint": "Qual comando inicia a aplicacao?",
|
|
791
|
+
"target": "O alvo e dev, prod ou ci?",
|
|
792
|
+
}.get(field, f"Informe o campo {field}.")
|
|
793
|
+
|
|
794
|
+
def finding(
|
|
795
|
+
self,
|
|
796
|
+
severity: str,
|
|
797
|
+
code: str,
|
|
798
|
+
evidence: str,
|
|
799
|
+
risk: str,
|
|
800
|
+
recommendation: str,
|
|
801
|
+
*,
|
|
802
|
+
source: str | None = None,
|
|
803
|
+
) -> dict[str, Any]:
|
|
804
|
+
return {
|
|
805
|
+
"severity": severity,
|
|
806
|
+
"code": code,
|
|
807
|
+
"source": source,
|
|
808
|
+
"evidence": self.redact_text(evidence),
|
|
809
|
+
"risk": risk,
|
|
810
|
+
"recommendation": recommendation,
|
|
811
|
+
}
|
|
812
|
+
|
|
813
|
+
def redact_text(self, text: str) -> str:
|
|
814
|
+
redacted = PRIVATE_URL_PATTERN.sub("<redacted-private-url>", text)
|
|
815
|
+
return re.sub(r"(?i)(SECRET|TOKEN|PASSWORD|PASS|API_KEY|PRIVATE_KEY|ACCESS_KEY)\s*[:=]\s*[^,\s]+", r"\1=<redacted>", redacted)
|
|
816
|
+
|
|
817
|
+
def dedupe_findings(self, findings: list[dict[str, Any]]) -> list[dict[str, Any]]:
|
|
818
|
+
seen: set[tuple[Any, ...]] = set()
|
|
819
|
+
unique = []
|
|
820
|
+
for finding in findings:
|
|
821
|
+
key = (finding.get("code"), finding.get("source"), finding.get("evidence"))
|
|
822
|
+
if key in seen:
|
|
823
|
+
continue
|
|
824
|
+
seen.add(key)
|
|
825
|
+
unique.append(finding)
|
|
826
|
+
return unique
|
|
827
|
+
|
|
828
|
+
def slugify(self, value: str) -> str:
|
|
829
|
+
slug = SLUG_PATTERN.sub("-", value.lower()).strip("-")
|
|
830
|
+
return slug or "container-app"
|
|
831
|
+
|
|
832
|
+
def is_inside(self, root: Path, target: Path) -> bool:
|
|
833
|
+
try:
|
|
834
|
+
target.relative_to(root.resolve())
|
|
835
|
+
return True
|
|
836
|
+
except ValueError:
|
|
837
|
+
return False
|