agent-devkit 0.1.6 → 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 +13 -1
- package/package.json +1 -1
- package/runtime/README.md +53 -1
- package/runtime/agent +5 -0
- package/runtime/agents/README.md +26 -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/agent.yaml +6 -4
- package/runtime/agents/execution-reviewer/capabilities/review-agent-result/capability.yaml +1 -2
- package/runtime/agents/execution-reviewer/capabilities/review-final-output/capability.yaml +1 -2
- package/runtime/agents/execution-reviewer/capabilities/review-plan/capability.yaml +1 -2
- 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/agent.yaml +6 -4
- package/runtime/agents/local-llm-operator/capabilities/delegate-operational-task/capability.yaml +1 -2
- package/runtime/agents/local-llm-operator/capabilities/inspect-local-models/capability.yaml +1 -2
- package/runtime/agents/local-llm-operator/capabilities/select-local-worker/capability.yaml +1 -2
- 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/agent.yaml +6 -4
- package/runtime/agents/provider-configurator/capabilities/collect-provider-credentials/capability.yaml +1 -2
- package/runtime/agents/provider-configurator/capabilities/configure-provider-source/capability.yaml +1 -2
- package/runtime/agents/provider-configurator/capabilities/validate-provider-readiness/capability.yaml +1 -2
- 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/agent.yaml +25 -3
- package/runtime/agents/task-orchestrator/capabilities/plan-task/capability.yaml +1 -2
- package/runtime/agents/task-orchestrator/capabilities/select-specialists/capability.yaml +1 -2
- package/runtime/agents/technical-integration-analyst/agent.yaml +15 -2
- package/runtime/agents/topdesk-orchestrator/agent.yaml +10 -2
- package/runtime/cli/aikit/__init__.py +1 -1
- package/runtime/cli/aikit/acceptance.py +166 -0
- package/runtime/cli/aikit/agent_executor.py +26 -3
- package/runtime/cli/aikit/agent_registry.py +244 -5
- package/runtime/cli/aikit/architecture.py +84 -0
- package/runtime/cli/aikit/audit.py +172 -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/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/diagnostics.py +8 -2
- 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 +21 -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/interactive_wizard.py +79 -0
- package/runtime/cli/aikit/local_llm_operator.py +35 -1
- package/runtime/cli/aikit/main.py +9 -2834
- 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 +182 -18
- 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 +809 -119
- 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 +88 -2
- package/runtime/cli/aikit/setup_wizard_payload.py +32 -0
- package/runtime/cli/aikit/sources.py +298 -50
- package/runtime/cli/aikit/tasks.py +449 -21
- package/runtime/cli/aikit/wizard_state.py +15 -1
- 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,865 @@
|
|
|
1
|
+
"""Repository for deterministic Playwright automation generation."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import json
|
|
6
|
+
import re
|
|
7
|
+
import subprocess
|
|
8
|
+
import sys
|
|
9
|
+
import tempfile
|
|
10
|
+
from pathlib import Path
|
|
11
|
+
from typing import Any
|
|
12
|
+
|
|
13
|
+
import yaml
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
REQUIRED_SPEC_FIELDS = (
|
|
17
|
+
"automation_name",
|
|
18
|
+
"purpose",
|
|
19
|
+
"browser",
|
|
20
|
+
"selectors",
|
|
21
|
+
"steps",
|
|
22
|
+
"assertions",
|
|
23
|
+
"auth_strategy",
|
|
24
|
+
"side_effects",
|
|
25
|
+
)
|
|
26
|
+
BROWSERS = {"chromium", "firefox", "webkit"}
|
|
27
|
+
AUTH_STRATEGIES = {"none", "env", "manual", "storage-state"}
|
|
28
|
+
SIDE_EFFECTS = {"read-only", "form-submit", "external-write", "destructive"}
|
|
29
|
+
ARTIFACTS = {"screenshot", "trace", "video", "console-log", "network-summary", "report"}
|
|
30
|
+
SELECTOR_KINDS = {"role", "label", "text", "test_id", "css"}
|
|
31
|
+
STABLE_SELECTOR_KINDS = {"role", "label", "text", "test_id"}
|
|
32
|
+
FORBIDDEN_MARKER_PATTERN = re.compile(r"\b(?:SECRET|TOKEN|PASSWORD|API_KEY|PRIVATE_KEY)\b\s*[:=]", re.IGNORECASE)
|
|
33
|
+
KEBAB_CASE = re.compile(r"^[a-z0-9]+(?:-[a-z0-9]+)*$")
|
|
34
|
+
SLUG_PATTERN = re.compile(r"[^a-z0-9]+")
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
class PlaywrightAutomationError(RuntimeError):
|
|
38
|
+
"""Raised when the builder cannot read or process an input spec."""
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
class PlaywrightAutomationRepository:
|
|
42
|
+
def __init__(self, root: Path | None = None) -> None:
|
|
43
|
+
self.root = root or Path(__file__).resolve().parents[5]
|
|
44
|
+
|
|
45
|
+
def plan_playwright_automation(self, *, spec_path: Path) -> dict[str, Any]:
|
|
46
|
+
spec = self.load_spec(spec_path)
|
|
47
|
+
spec_result = self.validate_spec(spec)
|
|
48
|
+
if spec_result["status"] != "ok":
|
|
49
|
+
return spec_result
|
|
50
|
+
|
|
51
|
+
normalized = self.normalize_spec(spec)
|
|
52
|
+
blocked = self.detect_forbidden_content(normalized)
|
|
53
|
+
if blocked:
|
|
54
|
+
return blocked
|
|
55
|
+
|
|
56
|
+
files = self.build_playwright_files(normalized)
|
|
57
|
+
return {
|
|
58
|
+
"kind": "playwright-automation-plan",
|
|
59
|
+
"status": "ok",
|
|
60
|
+
"automation": self.automation_summary(normalized),
|
|
61
|
+
"browser": normalized["browser"],
|
|
62
|
+
"auth_strategy": normalized["auth_strategy"],
|
|
63
|
+
"side_effects": normalized["side_effects"],
|
|
64
|
+
"write_policy": "read_only",
|
|
65
|
+
"planned_artifacts": self.public_file_plan(files),
|
|
66
|
+
"runtime_artifacts": self.runtime_artifacts(normalized),
|
|
67
|
+
"guardrails": self.side_effect_guardrails(normalized["side_effects"]),
|
|
68
|
+
"selector_warnings": self.selector_warnings(normalized["selectors"]),
|
|
69
|
+
"questions": self.open_questions(normalized),
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
def generate_playwright_script(self, *, spec_path: Path) -> dict[str, Any]:
|
|
73
|
+
plan = self.plan_playwright_automation(spec_path=spec_path)
|
|
74
|
+
if plan["status"] != "ok":
|
|
75
|
+
return plan
|
|
76
|
+
|
|
77
|
+
spec = self.normalize_spec(self.load_spec(spec_path))
|
|
78
|
+
content = self.render_playwright_script(spec)
|
|
79
|
+
return {
|
|
80
|
+
"kind": "playwright-script",
|
|
81
|
+
"status": "ok",
|
|
82
|
+
"automation": self.automation_summary(spec),
|
|
83
|
+
"artifact": "playwright_automation.py",
|
|
84
|
+
"content": content,
|
|
85
|
+
"bytes": len(content.encode("utf-8")),
|
|
86
|
+
"write_policy": "output_only",
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
def generate_playwright_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_playwright_automation(spec_path=spec_path)
|
|
97
|
+
if plan["status"] != "ok":
|
|
98
|
+
return plan
|
|
99
|
+
|
|
100
|
+
spec = self.normalize_spec(self.load_spec(spec_path))
|
|
101
|
+
target_project = spec.get("target_project")
|
|
102
|
+
if not target_project:
|
|
103
|
+
return {
|
|
104
|
+
"kind": "playwright-project-files",
|
|
105
|
+
"status": "needs-input",
|
|
106
|
+
"missing_fields": ["target_project"],
|
|
107
|
+
"questions": ["Qual e o caminho do projeto destino?"],
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
target_root = Path(str(target_project)).expanduser().resolve()
|
|
111
|
+
files = self.build_playwright_files(spec, base_dir=spec["automation_slug"])
|
|
112
|
+
return self.write_or_plan_files(
|
|
113
|
+
kind="playwright-project-files",
|
|
114
|
+
files=files,
|
|
115
|
+
target_root=target_root,
|
|
116
|
+
execute=execute,
|
|
117
|
+
allow_overwrite=allow_overwrite,
|
|
118
|
+
extra={"automation": self.automation_summary(spec), "side_effects": spec["side_effects"]},
|
|
119
|
+
)
|
|
120
|
+
|
|
121
|
+
def run_playwright_check(
|
|
122
|
+
self,
|
|
123
|
+
*,
|
|
124
|
+
spec_path: Path,
|
|
125
|
+
execute: bool = False,
|
|
126
|
+
confirm: bool = False,
|
|
127
|
+
headless: bool = True,
|
|
128
|
+
) -> dict[str, Any]:
|
|
129
|
+
plan = self.plan_playwright_automation(spec_path=spec_path)
|
|
130
|
+
if plan["status"] != "ok":
|
|
131
|
+
return plan
|
|
132
|
+
|
|
133
|
+
spec = self.normalize_spec(self.load_spec(spec_path))
|
|
134
|
+
if not execute:
|
|
135
|
+
return {
|
|
136
|
+
"kind": "playwright-check",
|
|
137
|
+
"status": "planned",
|
|
138
|
+
"dry_run": True,
|
|
139
|
+
"automation": self.automation_summary(spec),
|
|
140
|
+
"command": "python playwright_automation.py --execute --headless",
|
|
141
|
+
"write_policy": "dry_run",
|
|
142
|
+
"next_steps": ["Review the dry-run plan before running with --execute."],
|
|
143
|
+
}
|
|
144
|
+
if spec["side_effects"] != "read-only" and not confirm:
|
|
145
|
+
return {
|
|
146
|
+
"kind": "playwright-check",
|
|
147
|
+
"status": "blocked",
|
|
148
|
+
"reason": "confirmation_required",
|
|
149
|
+
"side_effects": spec["side_effects"],
|
|
150
|
+
"risks": ["Playwright automation with side effects requires --confirm."],
|
|
151
|
+
"write_policy": "confirm",
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
with tempfile.TemporaryDirectory() as tmpdir:
|
|
155
|
+
script_path = Path(tmpdir) / "playwright_automation.py"
|
|
156
|
+
script_path.write_text(self.render_playwright_script(spec), encoding="utf-8")
|
|
157
|
+
args = [sys.executable, str(script_path), "--execute"]
|
|
158
|
+
if confirm:
|
|
159
|
+
args.append("--confirm")
|
|
160
|
+
if headless:
|
|
161
|
+
args.append("--headless")
|
|
162
|
+
process = subprocess.run(
|
|
163
|
+
args,
|
|
164
|
+
cwd=tmpdir,
|
|
165
|
+
check=False,
|
|
166
|
+
text=True,
|
|
167
|
+
stdout=subprocess.PIPE,
|
|
168
|
+
stderr=subprocess.PIPE,
|
|
169
|
+
timeout=120,
|
|
170
|
+
)
|
|
171
|
+
return {
|
|
172
|
+
"kind": "playwright-check",
|
|
173
|
+
"status": "ok" if process.returncode == 0 else "failed",
|
|
174
|
+
"dry_run": False,
|
|
175
|
+
"exit_code": process.returncode,
|
|
176
|
+
"stdout": safe_tail(process.stdout),
|
|
177
|
+
"stderr": safe_tail(process.stderr),
|
|
178
|
+
"write_policy": "confirm",
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
def review_playwright_artifacts(self, *, paths: list[Path], text: str | None = None) -> dict[str, Any]:
|
|
182
|
+
findings: list[str] = []
|
|
183
|
+
artifacts: list[dict[str, Any]] = []
|
|
184
|
+
for path in paths:
|
|
185
|
+
resolved = path.expanduser().resolve()
|
|
186
|
+
item = {
|
|
187
|
+
"path": str(resolved),
|
|
188
|
+
"exists": resolved.exists(),
|
|
189
|
+
"suffix": resolved.suffix.lower(),
|
|
190
|
+
"sensitive": self.artifact_may_be_sensitive(resolved),
|
|
191
|
+
}
|
|
192
|
+
if not resolved.exists():
|
|
193
|
+
findings.append(f"artifact missing: {path}")
|
|
194
|
+
artifacts.append(item)
|
|
195
|
+
if text is not None:
|
|
196
|
+
findings.extend(self.review_playwright_script(text=text, side_effects="read-only")["findings"])
|
|
197
|
+
if not artifacts and text is None:
|
|
198
|
+
findings.append("no artifacts or script text provided")
|
|
199
|
+
return {
|
|
200
|
+
"kind": "playwright-artifact-review",
|
|
201
|
+
"status": "ok" if not findings else "failed",
|
|
202
|
+
"valid": not findings,
|
|
203
|
+
"artifacts": artifacts,
|
|
204
|
+
"findings": findings,
|
|
205
|
+
"write_policy": "read_only",
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
def review_playwright_script(self, *, text: str, side_effects: str = "read-only") -> dict[str, Any]:
|
|
209
|
+
normalized_side_effects = str(side_effects or "read-only").strip()
|
|
210
|
+
findings: list[str] = []
|
|
211
|
+
lower_text = text.lower()
|
|
212
|
+
if not text.strip():
|
|
213
|
+
findings.append("playwright script is empty")
|
|
214
|
+
if "sync_playwright" not in text:
|
|
215
|
+
findings.append("playwright script must use Playwright sync API or clearly equivalent runtime")
|
|
216
|
+
for flag in ("--dry-run", "--execute", "--headless", "--browser", "--timeout", "--screenshot-dir", "--trace-dir"):
|
|
217
|
+
if flag not in text:
|
|
218
|
+
findings.append(f"playwright script must expose {flag}")
|
|
219
|
+
if "screenshot(" not in lower_text:
|
|
220
|
+
findings.append("playwright script must capture screenshots")
|
|
221
|
+
if "tracing.start" not in lower_text or "tracing.stop" not in lower_text:
|
|
222
|
+
findings.append("playwright script should support traces")
|
|
223
|
+
if "time.sleep" in lower_text:
|
|
224
|
+
findings.append("playwright script must not use time.sleep as primary waiting")
|
|
225
|
+
if normalized_side_effects != "read-only" and "--confirm" not in text:
|
|
226
|
+
findings.append("playwright script with side effects must require --confirm")
|
|
227
|
+
if "return 0" not in text and "sys.exit(0)" not in text:
|
|
228
|
+
findings.append("playwright script should return a predictable success exit code")
|
|
229
|
+
if self.detect_text_forbidden_content(text):
|
|
230
|
+
findings.append("playwright script contains a secret marker")
|
|
231
|
+
valid = not findings
|
|
232
|
+
return {
|
|
233
|
+
"kind": "playwright-review",
|
|
234
|
+
"status": "ok" if valid else "failed",
|
|
235
|
+
"valid": valid,
|
|
236
|
+
"side_effects": normalized_side_effects,
|
|
237
|
+
"findings": findings,
|
|
238
|
+
"write_policy": "read_only",
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
def wrap_playwright_as_capability(
|
|
242
|
+
self,
|
|
243
|
+
*,
|
|
244
|
+
spec_path: Path,
|
|
245
|
+
agent_id: str,
|
|
246
|
+
capability_id: str,
|
|
247
|
+
execute: bool = False,
|
|
248
|
+
allow_overwrite: bool = False,
|
|
249
|
+
) -> dict[str, Any]:
|
|
250
|
+
plan = self.plan_playwright_automation(spec_path=spec_path)
|
|
251
|
+
if plan["status"] != "ok":
|
|
252
|
+
return plan
|
|
253
|
+
|
|
254
|
+
if not KEBAB_CASE.match(agent_id):
|
|
255
|
+
return {
|
|
256
|
+
"kind": "playwright-capability-wrapper",
|
|
257
|
+
"status": "blocked",
|
|
258
|
+
"reason": "invalid_agent_id",
|
|
259
|
+
"risks": ["agent-id must be kebab-case."],
|
|
260
|
+
}
|
|
261
|
+
if not KEBAB_CASE.match(capability_id):
|
|
262
|
+
return {
|
|
263
|
+
"kind": "playwright-capability-wrapper",
|
|
264
|
+
"status": "blocked",
|
|
265
|
+
"reason": "invalid_capability_id",
|
|
266
|
+
"risks": ["capability-id must be kebab-case."],
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
spec = self.normalize_spec(self.load_spec(spec_path))
|
|
270
|
+
target_project = spec.get("target_project")
|
|
271
|
+
if not target_project:
|
|
272
|
+
return {
|
|
273
|
+
"kind": "playwright-capability-wrapper",
|
|
274
|
+
"status": "needs-input",
|
|
275
|
+
"missing_fields": ["target_project"],
|
|
276
|
+
"questions": ["Qual e o caminho do projeto destino?"],
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
target_root = Path(str(target_project)).expanduser().resolve()
|
|
280
|
+
files = self.build_capability_wrapper_files(spec, agent_id=agent_id, capability_id=capability_id)
|
|
281
|
+
return self.write_or_plan_files(
|
|
282
|
+
kind="playwright-capability-wrapper",
|
|
283
|
+
files=files,
|
|
284
|
+
target_root=target_root,
|
|
285
|
+
execute=execute,
|
|
286
|
+
allow_overwrite=allow_overwrite,
|
|
287
|
+
extra={
|
|
288
|
+
"agent_id": agent_id,
|
|
289
|
+
"capability_id": capability_id,
|
|
290
|
+
"capability_write_policy": self.capability_write_policy(spec["side_effects"]),
|
|
291
|
+
},
|
|
292
|
+
)
|
|
293
|
+
|
|
294
|
+
def load_spec(self, path: Path) -> dict[str, Any]:
|
|
295
|
+
if not path.exists():
|
|
296
|
+
raise PlaywrightAutomationError(f"spec not found: {path}")
|
|
297
|
+
text = path.read_text(encoding="utf-8")
|
|
298
|
+
if path.suffix.lower() == ".json":
|
|
299
|
+
payload = json.loads(text)
|
|
300
|
+
else:
|
|
301
|
+
payload = yaml.safe_load(text) or {}
|
|
302
|
+
if not isinstance(payload, dict):
|
|
303
|
+
raise PlaywrightAutomationError("spec must be a mapping")
|
|
304
|
+
return payload
|
|
305
|
+
|
|
306
|
+
def validate_spec(self, spec: dict[str, Any]) -> dict[str, Any]:
|
|
307
|
+
missing = [
|
|
308
|
+
field
|
|
309
|
+
for field in REQUIRED_SPEC_FIELDS
|
|
310
|
+
if field not in spec or spec.get(field) is None or spec.get(field) == ""
|
|
311
|
+
]
|
|
312
|
+
if not spec.get("target_url") and not spec.get("target_description"):
|
|
313
|
+
missing.append("target_url_or_description")
|
|
314
|
+
if missing:
|
|
315
|
+
return {
|
|
316
|
+
"kind": "playwright-automation-plan",
|
|
317
|
+
"status": "needs-input",
|
|
318
|
+
"missing_fields": missing,
|
|
319
|
+
"questions": [self.question_for_missing_field(field) for field in missing],
|
|
320
|
+
}
|
|
321
|
+
for field in ("selectors", "steps", "assertions", "artifacts", "quality_gates"):
|
|
322
|
+
if spec.get(field) is not None and not isinstance(spec[field], list):
|
|
323
|
+
return {
|
|
324
|
+
"kind": "playwright-automation-plan",
|
|
325
|
+
"status": "blocked",
|
|
326
|
+
"reason": "invalid_list_field",
|
|
327
|
+
"field": field,
|
|
328
|
+
"risks": [f"{field} must be a list when provided."],
|
|
329
|
+
}
|
|
330
|
+
browser = str(spec.get("browser") or "").strip().lower()
|
|
331
|
+
if browser not in BROWSERS:
|
|
332
|
+
return {
|
|
333
|
+
"kind": "playwright-automation-plan",
|
|
334
|
+
"status": "blocked",
|
|
335
|
+
"reason": "unsupported_browser",
|
|
336
|
+
"supported_values": sorted(BROWSERS),
|
|
337
|
+
}
|
|
338
|
+
auth_strategy = str(spec.get("auth_strategy") or "").strip()
|
|
339
|
+
if auth_strategy not in AUTH_STRATEGIES:
|
|
340
|
+
return {
|
|
341
|
+
"kind": "playwright-automation-plan",
|
|
342
|
+
"status": "blocked",
|
|
343
|
+
"reason": "unsupported_auth_strategy",
|
|
344
|
+
"supported_values": sorted(AUTH_STRATEGIES),
|
|
345
|
+
}
|
|
346
|
+
side_effects = str(spec.get("side_effects") or "").strip()
|
|
347
|
+
if side_effects not in SIDE_EFFECTS:
|
|
348
|
+
return {
|
|
349
|
+
"kind": "playwright-automation-plan",
|
|
350
|
+
"status": "blocked",
|
|
351
|
+
"reason": "invalid_side_effects",
|
|
352
|
+
"supported_values": sorted(SIDE_EFFECTS),
|
|
353
|
+
}
|
|
354
|
+
return {"status": "ok"}
|
|
355
|
+
|
|
356
|
+
def normalize_spec(self, spec: dict[str, Any]) -> dict[str, Any]:
|
|
357
|
+
normalized = dict(spec)
|
|
358
|
+
normalized["automation_name"] = " ".join(str(spec["automation_name"]).split())
|
|
359
|
+
normalized["automation_slug"] = self.slugify(normalized["automation_name"])
|
|
360
|
+
normalized["purpose"] = " ".join(str(spec["purpose"]).split())
|
|
361
|
+
normalized["target_url"] = str(spec.get("target_url") or "").strip()
|
|
362
|
+
normalized["target_description"] = " ".join(str(spec.get("target_description") or "").split())
|
|
363
|
+
normalized["browser"] = str(spec["browser"]).strip().lower()
|
|
364
|
+
normalized["auth_strategy"] = str(spec["auth_strategy"]).strip()
|
|
365
|
+
normalized["side_effects"] = str(spec["side_effects"]).strip()
|
|
366
|
+
normalized["storage_state_env"] = str(spec.get("storage_state_env") or "").strip()
|
|
367
|
+
normalized["selectors"] = [self.normalize_selector(item) for item in spec.get("selectors") or []]
|
|
368
|
+
normalized["steps"] = [str(item).strip() for item in spec.get("steps") or []]
|
|
369
|
+
normalized["assertions"] = [str(item).strip() for item in spec.get("assertions") or []]
|
|
370
|
+
normalized["artifacts"] = self.normalize_artifacts(spec.get("artifacts") or ["screenshot", "trace", "report"])
|
|
371
|
+
normalized["quality_gates"] = [str(item).strip() for item in spec.get("quality_gates") or []]
|
|
372
|
+
if spec.get("target_project"):
|
|
373
|
+
normalized["target_project"] = str(spec["target_project"]).strip()
|
|
374
|
+
return normalized
|
|
375
|
+
|
|
376
|
+
def detect_forbidden_content(self, spec: dict[str, Any]) -> dict[str, Any] | None:
|
|
377
|
+
for key, value in self.iter_key_values(spec):
|
|
378
|
+
if key in {"target_url", "storage_state_env"}:
|
|
379
|
+
continue
|
|
380
|
+
if isinstance(value, str) and self.detect_text_forbidden_content(value):
|
|
381
|
+
return {
|
|
382
|
+
"kind": "playwright-automation-plan",
|
|
383
|
+
"status": "blocked",
|
|
384
|
+
"reason": "forbidden_sensitive_marker",
|
|
385
|
+
"risks": ["Spec contains text that looks like a hardcoded secret."],
|
|
386
|
+
}
|
|
387
|
+
return None
|
|
388
|
+
|
|
389
|
+
def detect_text_forbidden_content(self, value: str) -> bool:
|
|
390
|
+
return bool(FORBIDDEN_MARKER_PATTERN.search(value))
|
|
391
|
+
|
|
392
|
+
def build_playwright_files(self, spec: dict[str, Any], *, base_dir: str = "") -> list[tuple[str, str]]:
|
|
393
|
+
prefix = f"{base_dir}/" if base_dir else ""
|
|
394
|
+
return [
|
|
395
|
+
(f"{prefix}playwright_automation.py", self.render_playwright_script(spec)),
|
|
396
|
+
(f"{prefix}README.md", self.render_readme(spec)),
|
|
397
|
+
(f"{prefix}requirements.txt", "playwright>=1.44\n"),
|
|
398
|
+
(f"{prefix}tests/test_playwright_automation.py", self.render_playwright_test(spec)),
|
|
399
|
+
]
|
|
400
|
+
|
|
401
|
+
def build_capability_wrapper_files(
|
|
402
|
+
self,
|
|
403
|
+
spec: dict[str, Any],
|
|
404
|
+
*,
|
|
405
|
+
agent_id: str,
|
|
406
|
+
capability_id: str,
|
|
407
|
+
) -> list[tuple[str, str]]:
|
|
408
|
+
base = f"agents/{agent_id}/capabilities/{capability_id}"
|
|
409
|
+
return [
|
|
410
|
+
(f"{base}/capability.yaml", self.render_capability_yaml(spec, agent_id=agent_id, capability_id=capability_id)),
|
|
411
|
+
(f"{base}/workflow.md", self.render_capability_workflow(spec, capability_id=capability_id)),
|
|
412
|
+
(f"{base}/decision-rules.md", self.render_capability_decision_rules(spec)),
|
|
413
|
+
(f"{base}/runner.py", self.render_playwright_script(spec)),
|
|
414
|
+
]
|
|
415
|
+
|
|
416
|
+
def write_or_plan_files(
|
|
417
|
+
self,
|
|
418
|
+
*,
|
|
419
|
+
kind: str,
|
|
420
|
+
files: list[tuple[str, str]],
|
|
421
|
+
target_root: Path,
|
|
422
|
+
execute: bool,
|
|
423
|
+
allow_overwrite: bool,
|
|
424
|
+
extra: dict[str, Any],
|
|
425
|
+
) -> dict[str, Any]:
|
|
426
|
+
if not target_root.exists() or not target_root.is_dir():
|
|
427
|
+
return {
|
|
428
|
+
"kind": kind,
|
|
429
|
+
"status": "blocked",
|
|
430
|
+
"reason": "target_project_missing",
|
|
431
|
+
"target_project": str(target_root),
|
|
432
|
+
"risks": ["target_project must exist before files can be written."],
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
checked_files = []
|
|
436
|
+
for relative_path, content in files:
|
|
437
|
+
target = (target_root / relative_path).resolve()
|
|
438
|
+
if Path(relative_path).is_absolute() or not self.is_inside(target_root, target):
|
|
439
|
+
return {
|
|
440
|
+
"kind": kind,
|
|
441
|
+
"status": "blocked",
|
|
442
|
+
"reason": "path_outside_target_project",
|
|
443
|
+
"path": relative_path,
|
|
444
|
+
"target_project": str(target_root),
|
|
445
|
+
}
|
|
446
|
+
checked_files.append((relative_path, target, content))
|
|
447
|
+
|
|
448
|
+
if not execute:
|
|
449
|
+
return {
|
|
450
|
+
"kind": kind,
|
|
451
|
+
"status": "planned",
|
|
452
|
+
"dry_run": True,
|
|
453
|
+
"target_project": str(target_root),
|
|
454
|
+
"planned_files": [
|
|
455
|
+
{"path": relative_path, "absolute_path": str(target), "bytes": len(content.encode("utf-8"))}
|
|
456
|
+
for relative_path, target, content in checked_files
|
|
457
|
+
],
|
|
458
|
+
**extra,
|
|
459
|
+
"next_steps": ["Rerun with --execute after reviewing the planned files."],
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
existing = [target for _relative_path, target, _content in checked_files if target.exists()]
|
|
463
|
+
if existing and not allow_overwrite:
|
|
464
|
+
return {
|
|
465
|
+
"kind": kind,
|
|
466
|
+
"status": "blocked",
|
|
467
|
+
"reason": "target_exists",
|
|
468
|
+
"target_project": str(target_root),
|
|
469
|
+
"existing_files": [str(path) for path in existing],
|
|
470
|
+
**extra,
|
|
471
|
+
"next_steps": ["Rerun with --allow-overwrite only after reviewing existing files."],
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
written_files = []
|
|
475
|
+
for _relative_path, target, content in checked_files:
|
|
476
|
+
target.parent.mkdir(parents=True, exist_ok=True)
|
|
477
|
+
target.write_text(content, encoding="utf-8")
|
|
478
|
+
written_files.append({"path": str(target), "bytes": len(content.encode("utf-8"))})
|
|
479
|
+
|
|
480
|
+
return {"kind": kind, "status": "written", "dry_run": False, "target_project": str(target_root), "written_files": written_files, **extra}
|
|
481
|
+
|
|
482
|
+
def render_playwright_script(self, spec: dict[str, Any]) -> str:
|
|
483
|
+
selectors = [
|
|
484
|
+
{
|
|
485
|
+
"name": selector["name"],
|
|
486
|
+
"kind": selector["kind"],
|
|
487
|
+
"value": selector["value"],
|
|
488
|
+
"name_value": selector.get("name_value") or "",
|
|
489
|
+
}
|
|
490
|
+
for selector in spec["selectors"]
|
|
491
|
+
]
|
|
492
|
+
needs_confirmation = spec["side_effects"] != "read-only"
|
|
493
|
+
confirmation_block = [
|
|
494
|
+
" if args.execute and not args.confirm:",
|
|
495
|
+
" logger.error(\"real Playwright side effects require --confirm after reviewing --dry-run output\")",
|
|
496
|
+
" return 2",
|
|
497
|
+
]
|
|
498
|
+
if not needs_confirmation:
|
|
499
|
+
confirmation_block = [
|
|
500
|
+
" if args.execute and not args.confirm:",
|
|
501
|
+
" logger.info(\"--confirm not required for read-only Playwright automation\")",
|
|
502
|
+
]
|
|
503
|
+
|
|
504
|
+
return "\n".join(
|
|
505
|
+
[
|
|
506
|
+
"#!/usr/bin/env python3",
|
|
507
|
+
f'"""Playwright automation: {spec["automation_name"]}."""',
|
|
508
|
+
"",
|
|
509
|
+
"from __future__ import annotations",
|
|
510
|
+
"",
|
|
511
|
+
"import argparse",
|
|
512
|
+
"import json",
|
|
513
|
+
"import logging",
|
|
514
|
+
"import os",
|
|
515
|
+
"from pathlib import Path",
|
|
516
|
+
"",
|
|
517
|
+
f"TARGET_URL = {spec['target_url']!r}",
|
|
518
|
+
f"SELECTORS = {selectors!r}",
|
|
519
|
+
f"STORAGE_STATE_ENV = {spec['storage_state_env']!r}",
|
|
520
|
+
"",
|
|
521
|
+
"",
|
|
522
|
+
"def build_parser() -> argparse.ArgumentParser:",
|
|
523
|
+
f" parser = argparse.ArgumentParser(description={spec['purpose']!r})",
|
|
524
|
+
" parser.add_argument(\"--dry-run\", action=\"store_true\", help=\"show planned browser actions without opening a browser\")",
|
|
525
|
+
" parser.add_argument(\"--execute\", action=\"store_true\", help=\"open browser and run the automation\")",
|
|
526
|
+
" parser.add_argument(\"--confirm\", action=\"store_true\", help=\"confirm real browser side effects after dry-run review\")",
|
|
527
|
+
" parser.add_argument(\"--headless\", action=\"store_true\", help=\"run browser headless\")",
|
|
528
|
+
f" parser.add_argument(\"--browser\", choices={sorted(BROWSERS)!r}, default={spec['browser']!r})",
|
|
529
|
+
" parser.add_argument(\"--timeout\", type=int, default=20)",
|
|
530
|
+
" parser.add_argument(\"--screenshot-dir\", default=\"playwright-artifacts/screenshots\")",
|
|
531
|
+
" parser.add_argument(\"--trace-dir\", default=\"playwright-artifacts/traces\")",
|
|
532
|
+
" parser.add_argument(\"--storage-state\", help=\"optional path to local Playwright storage state\")",
|
|
533
|
+
" return parser",
|
|
534
|
+
"",
|
|
535
|
+
"",
|
|
536
|
+
"def planned_actions(args: argparse.Namespace) -> dict:",
|
|
537
|
+
" return {",
|
|
538
|
+
f" \"automation\": {spec['automation_slug']!r},",
|
|
539
|
+
" \"browser\": args.browser,",
|
|
540
|
+
" \"target_url\": TARGET_URL or \"<target-description-only>\",",
|
|
541
|
+
" \"selectors\": [selector[\"name\"] for selector in SELECTORS],",
|
|
542
|
+
f" \"side_effects\": {spec['side_effects']!r},",
|
|
543
|
+
f" \"artifacts\": {spec['artifacts']!r},",
|
|
544
|
+
" }",
|
|
545
|
+
"",
|
|
546
|
+
"",
|
|
547
|
+
"def playwright_imports():",
|
|
548
|
+
" from playwright.sync_api import expect, sync_playwright",
|
|
549
|
+
" return expect, sync_playwright",
|
|
550
|
+
"",
|
|
551
|
+
"",
|
|
552
|
+
"def selector_locator(page, selector: dict):",
|
|
553
|
+
" kind = selector[\"kind\"]",
|
|
554
|
+
" value = selector[\"value\"]",
|
|
555
|
+
" accessible_name = selector.get(\"name_value\") or None",
|
|
556
|
+
" if kind == \"role\":",
|
|
557
|
+
" return page.get_by_role(value, name=accessible_name)",
|
|
558
|
+
" if kind == \"label\":",
|
|
559
|
+
" return page.get_by_label(value)",
|
|
560
|
+
" if kind == \"text\":",
|
|
561
|
+
" return page.get_by_text(value)",
|
|
562
|
+
" if kind == \"test_id\":",
|
|
563
|
+
" return page.get_by_test_id(value)",
|
|
564
|
+
" return page.locator(value)",
|
|
565
|
+
"",
|
|
566
|
+
"",
|
|
567
|
+
"def storage_state_path(args: argparse.Namespace) -> str | None:",
|
|
568
|
+
" candidate = args.storage_state or (os.environ.get(STORAGE_STATE_ENV) if STORAGE_STATE_ENV else None)",
|
|
569
|
+
" return candidate or None",
|
|
570
|
+
"",
|
|
571
|
+
"",
|
|
572
|
+
"def run_browser(args: argparse.Namespace) -> dict:",
|
|
573
|
+
" expect, sync_playwright = playwright_imports()",
|
|
574
|
+
" screenshot_dir = Path(args.screenshot_dir)",
|
|
575
|
+
" trace_dir = Path(args.trace_dir)",
|
|
576
|
+
" screenshot_dir.mkdir(parents=True, exist_ok=True)",
|
|
577
|
+
" trace_dir.mkdir(parents=True, exist_ok=True)",
|
|
578
|
+
" with sync_playwright() as playwright:",
|
|
579
|
+
" browser_type = getattr(playwright, args.browser)",
|
|
580
|
+
" browser = browser_type.launch(headless=args.headless)",
|
|
581
|
+
" context_kwargs = {}",
|
|
582
|
+
" state = storage_state_path(args)",
|
|
583
|
+
" if state:",
|
|
584
|
+
" context_kwargs[\"storage_state\"] = state",
|
|
585
|
+
" context = browser.new_context(**context_kwargs)",
|
|
586
|
+
" context.tracing.start(screenshots=True, snapshots=True, sources=False)",
|
|
587
|
+
" page = context.new_page()",
|
|
588
|
+
" page.set_default_timeout(args.timeout * 1000)",
|
|
589
|
+
" try:",
|
|
590
|
+
" if TARGET_URL:",
|
|
591
|
+
" page.goto(TARGET_URL, wait_until=\"domcontentloaded\")",
|
|
592
|
+
" checked = []",
|
|
593
|
+
" for selector in SELECTORS:",
|
|
594
|
+
" locator = selector_locator(page, selector)",
|
|
595
|
+
" expect(locator.first).to_be_visible()",
|
|
596
|
+
" checked.append(selector[\"name\"])",
|
|
597
|
+
" screenshot = screenshot_dir / \"success.png\"",
|
|
598
|
+
" page.screenshot(path=str(screenshot), full_page=True)",
|
|
599
|
+
" trace = trace_dir / \"trace.zip\"",
|
|
600
|
+
" context.tracing.stop(path=str(trace))",
|
|
601
|
+
" return {\"status\": \"ok\", \"checked_selectors\": checked, \"screenshot\": str(screenshot), \"trace\": str(trace)}",
|
|
602
|
+
" except Exception as exc:",
|
|
603
|
+
" screenshot = screenshot_dir / \"failure.png\"",
|
|
604
|
+
" page.screenshot(path=str(screenshot), full_page=True)",
|
|
605
|
+
" trace = trace_dir / \"failure-trace.zip\"",
|
|
606
|
+
" context.tracing.stop(path=str(trace))",
|
|
607
|
+
" return {\"status\": \"failed\", \"error\": str(exc), \"screenshot\": str(screenshot), \"trace\": str(trace)}",
|
|
608
|
+
" finally:",
|
|
609
|
+
" context.close()",
|
|
610
|
+
" browser.close()",
|
|
611
|
+
"",
|
|
612
|
+
"",
|
|
613
|
+
"def main(argv: list[str] | None = None) -> int:",
|
|
614
|
+
" parser = build_parser()",
|
|
615
|
+
" args = parser.parse_args(argv)",
|
|
616
|
+
" logging.basicConfig(level=logging.INFO, format=\"%(levelname)s %(message)s\")",
|
|
617
|
+
" logger = logging.getLogger(\"playwright-automation\")",
|
|
618
|
+
" if args.execute and args.dry_run:",
|
|
619
|
+
" logger.error(\"choose either --dry-run or --execute\")",
|
|
620
|
+
" return 2",
|
|
621
|
+
*confirmation_block,
|
|
622
|
+
" if not args.execute:",
|
|
623
|
+
" print(json.dumps({\"dry_run\": True, \"plan\": planned_actions(args)}, indent=2))",
|
|
624
|
+
" return 0",
|
|
625
|
+
" result = run_browser(args)",
|
|
626
|
+
" print(json.dumps(result, indent=2))",
|
|
627
|
+
" return 0 if result.get(\"status\") == \"ok\" else 1",
|
|
628
|
+
"",
|
|
629
|
+
"",
|
|
630
|
+
"if __name__ == \"__main__\":",
|
|
631
|
+
" raise SystemExit(main())",
|
|
632
|
+
"",
|
|
633
|
+
]
|
|
634
|
+
)
|
|
635
|
+
|
|
636
|
+
def render_readme(self, spec: dict[str, Any]) -> str:
|
|
637
|
+
selectors = self.markdown_list([selector["name"] for selector in spec["selectors"]], fallback="No selectors.")
|
|
638
|
+
assertions = self.markdown_list(spec["assertions"], fallback="Review generated assertions.")
|
|
639
|
+
artifacts = self.markdown_list(spec["artifacts"], fallback="No artifacts.")
|
|
640
|
+
return "\n".join(
|
|
641
|
+
[
|
|
642
|
+
f"# {spec['automation_name']}",
|
|
643
|
+
"",
|
|
644
|
+
spec["purpose"],
|
|
645
|
+
"",
|
|
646
|
+
"## Usage",
|
|
647
|
+
"",
|
|
648
|
+
"```bash",
|
|
649
|
+
"python playwright_automation.py --dry-run",
|
|
650
|
+
"python playwright_automation.py --execute --headless",
|
|
651
|
+
"```",
|
|
652
|
+
"",
|
|
653
|
+
"## Selectors",
|
|
654
|
+
"",
|
|
655
|
+
selectors,
|
|
656
|
+
"",
|
|
657
|
+
"## Assertions",
|
|
658
|
+
"",
|
|
659
|
+
assertions,
|
|
660
|
+
"",
|
|
661
|
+
"## Artifacts",
|
|
662
|
+
"",
|
|
663
|
+
artifacts,
|
|
664
|
+
"",
|
|
665
|
+
"## Guardrails",
|
|
666
|
+
"",
|
|
667
|
+
"- Prefer role, label, text or test id selectors.",
|
|
668
|
+
"- Capture screenshot and trace for review.",
|
|
669
|
+
"- Do not hardcode credentials.",
|
|
670
|
+
"- Use Selenium only when WebDriver/Grid compatibility is required.",
|
|
671
|
+
"",
|
|
672
|
+
]
|
|
673
|
+
)
|
|
674
|
+
|
|
675
|
+
def render_playwright_test(self, spec: dict[str, Any]) -> str:
|
|
676
|
+
return "\n".join(
|
|
677
|
+
[
|
|
678
|
+
"import json",
|
|
679
|
+
"import subprocess",
|
|
680
|
+
"import sys",
|
|
681
|
+
"from pathlib import Path",
|
|
682
|
+
"",
|
|
683
|
+
"",
|
|
684
|
+
"def test_playwright_automation_dry_run_returns_plan_without_browser():",
|
|
685
|
+
" script = Path(__file__).resolve().parents[1] / \"playwright_automation.py\"",
|
|
686
|
+
" result = subprocess.run([sys.executable, str(script), \"--dry-run\"], text=True, capture_output=True, check=False)",
|
|
687
|
+
" assert result.returncode == 0, result.stderr",
|
|
688
|
+
" payload = json.loads(result.stdout)",
|
|
689
|
+
" assert payload[\"dry_run\"] is True",
|
|
690
|
+
f" assert payload[\"plan\"][\"automation\"] == {spec['automation_slug']!r}",
|
|
691
|
+
"",
|
|
692
|
+
]
|
|
693
|
+
)
|
|
694
|
+
|
|
695
|
+
def render_capability_yaml(self, spec: dict[str, Any], *, agent_id: str, capability_id: str) -> str:
|
|
696
|
+
payload = {
|
|
697
|
+
"id": f"{agent_id}.{capability_id}",
|
|
698
|
+
"kind": "capability",
|
|
699
|
+
"name": self.title_from_id(capability_id),
|
|
700
|
+
"version": "0.1.0",
|
|
701
|
+
"status": "draft",
|
|
702
|
+
"purpose": spec["purpose"],
|
|
703
|
+
"entrypoint": {"runner": "runner.py", "workflow": "workflow.md"},
|
|
704
|
+
"inputs": {"required": [], "optional": ["dry-run", "execute", "confirm", "headless", "browser"]},
|
|
705
|
+
"outputs": {"artifacts": ["playwright-result.json", "success.png", "failure.png", "trace.zip"]},
|
|
706
|
+
"write_policy": self.capability_write_policy(spec["side_effects"]),
|
|
707
|
+
}
|
|
708
|
+
return yaml.safe_dump(payload, sort_keys=False, allow_unicode=False)
|
|
709
|
+
|
|
710
|
+
def render_capability_workflow(self, spec: dict[str, Any], *, capability_id: str) -> str:
|
|
711
|
+
return "\n".join(
|
|
712
|
+
[
|
|
713
|
+
"# Workflow",
|
|
714
|
+
"",
|
|
715
|
+
f"1. Executar `{capability_id}` em dry-run por padrao.",
|
|
716
|
+
"2. Revisar target, seletores, assertions e artifacts.",
|
|
717
|
+
"3. Executar com `--execute --confirm` apenas quando houver autorizacao para side effects.",
|
|
718
|
+
"4. Retornar JSON, screenshot e trace.",
|
|
719
|
+
"",
|
|
720
|
+
]
|
|
721
|
+
)
|
|
722
|
+
|
|
723
|
+
def render_capability_decision_rules(self, spec: dict[str, Any]) -> str:
|
|
724
|
+
return "\n".join(
|
|
725
|
+
[
|
|
726
|
+
"# Decision Rules",
|
|
727
|
+
"",
|
|
728
|
+
f"- Side effects classificados como `{spec['side_effects']}`.",
|
|
729
|
+
"- Preferir seletores por role, label, text ou test id.",
|
|
730
|
+
"- Storage state sensivel nao deve ser versionado.",
|
|
731
|
+
"- Escrita, submit ou alteracao externa exige confirmacao.",
|
|
732
|
+
"- Selenium deve ser usado apenas com requisito WebDriver/Grid/legado.",
|
|
733
|
+
"",
|
|
734
|
+
]
|
|
735
|
+
)
|
|
736
|
+
|
|
737
|
+
def normalize_selector(self, value: Any) -> dict[str, str]:
|
|
738
|
+
if not isinstance(value, dict):
|
|
739
|
+
return {"name": "invalid", "kind": "css", "value": str(value), "name_value": ""}
|
|
740
|
+
selector = {
|
|
741
|
+
"name": str(value.get("name") or "selector").strip(),
|
|
742
|
+
"kind": str(value.get("kind") or value.get("by") or "css").strip(),
|
|
743
|
+
"value": str(value.get("value") or "").strip(),
|
|
744
|
+
"name_value": str(value.get("name_value") or value.get("accessible_name") or "").strip(),
|
|
745
|
+
}
|
|
746
|
+
if selector["kind"] not in SELECTOR_KINDS:
|
|
747
|
+
selector["kind"] = "css"
|
|
748
|
+
return selector
|
|
749
|
+
|
|
750
|
+
def normalize_artifacts(self, values: Any) -> list[str]:
|
|
751
|
+
raw = values if isinstance(values, list) else []
|
|
752
|
+
normalized: list[str] = []
|
|
753
|
+
for item in raw:
|
|
754
|
+
value = str(item or "").strip()
|
|
755
|
+
if value in ARTIFACTS and value not in normalized:
|
|
756
|
+
normalized.append(value)
|
|
757
|
+
return normalized or ["screenshot", "trace", "report"]
|
|
758
|
+
|
|
759
|
+
def selector_warnings(self, selectors: list[dict[str, str]]) -> list[str]:
|
|
760
|
+
warnings = []
|
|
761
|
+
for selector in selectors:
|
|
762
|
+
if selector["kind"] not in STABLE_SELECTOR_KINDS:
|
|
763
|
+
warnings.append(f"selector {selector['name']} uses {selector['kind']}; prefer role, label, text or test_id")
|
|
764
|
+
if selector["kind"] == "css" and re.search(r"\.[a-z0-9_-]{12,}", selector["value"], re.IGNORECASE):
|
|
765
|
+
warnings.append(f"selector {selector['name']} may use a generated class")
|
|
766
|
+
return warnings
|
|
767
|
+
|
|
768
|
+
def runtime_artifacts(self, spec: dict[str, Any]) -> list[dict[str, Any]]:
|
|
769
|
+
sensitive = spec["auth_strategy"] in {"manual", "storage-state"}
|
|
770
|
+
return [
|
|
771
|
+
{"path": "playwright-artifacts/screenshots/*.png", "kind": "screenshot", "sensitive": sensitive},
|
|
772
|
+
{"path": "playwright-artifacts/traces/*.zip", "kind": "trace", "sensitive": sensitive},
|
|
773
|
+
{"path": "playwright-result.json", "kind": "json", "sensitive": sensitive},
|
|
774
|
+
]
|
|
775
|
+
|
|
776
|
+
def artifact_may_be_sensitive(self, path: Path) -> bool:
|
|
777
|
+
lower = str(path).lower()
|
|
778
|
+
return any(marker in lower for marker in ("storage", "state", "trace", "screenshot", "auth", "login"))
|
|
779
|
+
|
|
780
|
+
def capability_write_policy(self, side_effects: str) -> str:
|
|
781
|
+
mapping = {
|
|
782
|
+
"read-only": "read_only",
|
|
783
|
+
"form-submit": "confirm",
|
|
784
|
+
"external-write": "confirm",
|
|
785
|
+
"destructive": "blocked_by_default",
|
|
786
|
+
}
|
|
787
|
+
return mapping[side_effects]
|
|
788
|
+
|
|
789
|
+
def side_effect_guardrails(self, side_effects: str) -> list[str]:
|
|
790
|
+
guardrails = {
|
|
791
|
+
"read-only": ["Dry-run shows target and selectors without opening browser."],
|
|
792
|
+
"form-submit": ["Require --execute --confirm after dry-run review."],
|
|
793
|
+
"external-write": ["Require explicit runtime confirmation and external approval."],
|
|
794
|
+
"destructive": ["Blocked by default; require separate risk decision."],
|
|
795
|
+
}
|
|
796
|
+
return guardrails[side_effects]
|
|
797
|
+
|
|
798
|
+
def automation_summary(self, spec: dict[str, Any]) -> dict[str, Any]:
|
|
799
|
+
return {
|
|
800
|
+
"name": spec["automation_name"],
|
|
801
|
+
"slug": spec["automation_slug"],
|
|
802
|
+
"purpose": spec["purpose"],
|
|
803
|
+
"target": spec["target_url"] or spec["target_description"],
|
|
804
|
+
}
|
|
805
|
+
|
|
806
|
+
def public_file_plan(self, files: list[tuple[str, str]]) -> list[dict[str, Any]]:
|
|
807
|
+
return [{"path": path, "bytes": len(content.encode("utf-8"))} for path, content in files]
|
|
808
|
+
|
|
809
|
+
def open_questions(self, spec: dict[str, Any]) -> list[str]:
|
|
810
|
+
questions: list[str] = []
|
|
811
|
+
if spec["auth_strategy"] in {"env", "storage-state"}:
|
|
812
|
+
questions.append("Quais env vars ou storage state local serao referenciados sem expor valores?")
|
|
813
|
+
if spec["side_effects"] != "read-only":
|
|
814
|
+
questions.append("Qual ambiente sandbox confirma que a automacao nao afetara dados reais?")
|
|
815
|
+
if self.selector_warnings(spec["selectors"]):
|
|
816
|
+
questions.append("Ha seletores por role, label, text ou test id que substituam CSS fragil?")
|
|
817
|
+
return questions
|
|
818
|
+
|
|
819
|
+
def question_for_missing_field(self, field: str) -> str:
|
|
820
|
+
questions = {
|
|
821
|
+
"automation_name": "Qual sera o nome da automacao Playwright?",
|
|
822
|
+
"purpose": "Qual tarefa web a automacao deve resolver?",
|
|
823
|
+
"target_url_or_description": "Qual URL ou descricao do alvo Playwright?",
|
|
824
|
+
"browser": "Qual browser Playwright sera usado?",
|
|
825
|
+
"selectors": "Quais seletores estaveis serao usados?",
|
|
826
|
+
"steps": "Quais passos a automacao executa?",
|
|
827
|
+
"assertions": "Quais assertions verificam sucesso?",
|
|
828
|
+
"auth_strategy": "Qual estrategia de autenticacao sera usada?",
|
|
829
|
+
"side_effects": "Qual classificacao de side effects se aplica?",
|
|
830
|
+
}
|
|
831
|
+
return questions.get(field, f"Informe o campo obrigatorio {field}.")
|
|
832
|
+
|
|
833
|
+
def markdown_list(self, values: list[str], *, fallback: str) -> str:
|
|
834
|
+
if not values:
|
|
835
|
+
return f"- {fallback}"
|
|
836
|
+
return "\n".join(f"- {value}" for value in values)
|
|
837
|
+
|
|
838
|
+
def slugify(self, value: str) -> str:
|
|
839
|
+
slug = SLUG_PATTERN.sub("-", value.strip().lower()).strip("-")
|
|
840
|
+
return slug or "playwright-automation"
|
|
841
|
+
|
|
842
|
+
def title_from_id(self, value: str) -> str:
|
|
843
|
+
return " ".join(part.capitalize() for part in value.split("-"))
|
|
844
|
+
|
|
845
|
+
def iter_key_values(self, value: Any, *, parent_key: str = ""):
|
|
846
|
+
if isinstance(value, dict):
|
|
847
|
+
for key, item in value.items():
|
|
848
|
+
yield from self.iter_key_values(item, parent_key=str(key))
|
|
849
|
+
elif isinstance(value, list):
|
|
850
|
+
for item in value:
|
|
851
|
+
yield from self.iter_key_values(item, parent_key=parent_key)
|
|
852
|
+
else:
|
|
853
|
+
yield parent_key, value
|
|
854
|
+
|
|
855
|
+
def is_inside(self, root: Path, target: Path) -> bool:
|
|
856
|
+
try:
|
|
857
|
+
target.relative_to(root)
|
|
858
|
+
return True
|
|
859
|
+
except ValueError:
|
|
860
|
+
return False
|
|
861
|
+
|
|
862
|
+
|
|
863
|
+
def safe_tail(value: str, limit: int = 2000) -> str:
|
|
864
|
+
text = value or ""
|
|
865
|
+
return text[-limit:]
|