bps-kit 1.0.1 → 1.0.2
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/package.json +1 -1
- package/templates/.agents/agents/backend-specialist.md +263 -0
- package/templates/.agents/agents/code-archaeologist.md +106 -0
- package/templates/.agents/agents/database-architect.md +226 -0
- package/templates/.agents/agents/debugger.md +225 -0
- package/templates/.agents/agents/devops-engineer.md +242 -0
- package/templates/.agents/agents/documentation-writer.md +104 -0
- package/templates/.agents/agents/explorer-agent.md +73 -0
- package/templates/.agents/agents/frontend-specialist.md +593 -0
- package/templates/.agents/agents/game-developer.md +162 -0
- package/templates/.agents/agents/mobile-developer.md +377 -0
- package/templates/.agents/agents/orchestrator.md +416 -0
- package/templates/.agents/agents/penetration-tester.md +188 -0
- package/templates/.agents/agents/performance-optimizer.md +187 -0
- package/templates/.agents/agents/product-manager.md +112 -0
- package/templates/.agents/agents/product-owner.md +95 -0
- package/templates/.agents/agents/project-planner.md +406 -0
- package/templates/.agents/agents/qa-automation-engineer.md +103 -0
- package/templates/.agents/agents/security-auditor.md +170 -0
- package/templates/.agents/agents/seo-specialist.md +111 -0
- package/templates/.agents/agents/test-engineer.md +158 -0
- package/templates/.agents/rules/GEMINI.md +219 -0
- package/templates/.agents/scripts/auto_preview.py +148 -0
- package/templates/.agents/scripts/checklist.py +217 -0
- package/templates/.agents/scripts/session_manager.py +120 -0
- package/templates/.agents/scripts/verify_all.py +327 -0
- package/templates/.agents/workflows/brainstorm.md +113 -0
- package/templates/.agents/workflows/create.md +59 -0
- package/templates/.agents/workflows/debug.md +103 -0
- package/templates/.agents/workflows/deploy.md +176 -0
- package/templates/.agents/workflows/enhance.md +63 -0
- package/templates/.agents/workflows/orchestrate.md +237 -0
- package/templates/.agents/workflows/plan.md +89 -0
- package/templates/.agents/workflows/preview.md +81 -0
- package/templates/.agents/workflows/setup-brain.md +39 -0
- package/templates/.agents/workflows/status.md +86 -0
- package/templates/.agents/workflows/test.md +144 -0
- package/templates/.agents/workflows/ui-ux-pro-max.md +296 -0
- package/templates/skills_normal/api-patterns/scripts/api_validator.py +211 -0
- package/templates/skills_normal/database-design/scripts/schema_validator.py +172 -0
- package/templates/skills_normal/frontend-design/scripts/accessibility_checker.py +183 -0
- package/templates/skills_normal/frontend-design/scripts/ux_audit.py +722 -0
- package/templates/skills_normal/git-pushing/scripts/smart_commit.sh +19 -0
- package/templates/skills_normal/lint-and-validate/scripts/lint_runner.py +184 -0
- package/templates/skills_normal/lint-and-validate/scripts/type_coverage.py +173 -0
- package/templates/skills_normal/performance-profiling/scripts/lighthouse_audit.py +76 -0
- package/templates/skills_normal/senior-fullstack/scripts/code_quality_analyzer.py +114 -0
- package/templates/skills_normal/senior-fullstack/scripts/fullstack_scaffolder.py +114 -0
- package/templates/skills_normal/senior-fullstack/scripts/project_scaffolder.py +114 -0
- package/templates/skills_normal/seo-fundamentals/scripts/seo_checker.py +219 -0
- package/templates/skills_normal/testing-patterns/scripts/test_runner.py +219 -0
- package/templates/skills_normal/vulnerability-scanner/scripts/security_scan.py +458 -0
- package/templates/vault/007/scripts/config.py +472 -0
- package/templates/vault/007/scripts/full_audit.py +1306 -0
- package/templates/vault/007/scripts/quick_scan.py +481 -0
- package/templates/vault/007/scripts/requirements.txt +26 -0
- package/templates/vault/007/scripts/scanners/__init__.py +0 -0
- package/templates/vault/007/scripts/scanners/dependency_scanner.py +1305 -0
- package/templates/vault/007/scripts/scanners/injection_scanner.py +1104 -0
- package/templates/vault/007/scripts/scanners/secrets_scanner.py +1008 -0
- package/templates/vault/007/scripts/score_calculator.py +693 -0
- package/templates/vault/agent-orchestrator/scripts/match_skills.py +329 -0
- package/templates/vault/agent-orchestrator/scripts/orchestrate.py +304 -0
- package/templates/vault/agent-orchestrator/scripts/requirements.txt +1 -0
- package/templates/vault/agent-orchestrator/scripts/scan_registry.py +508 -0
- package/templates/vault/ai-studio-image/scripts/config.py +613 -0
- package/templates/vault/ai-studio-image/scripts/generate.py +630 -0
- package/templates/vault/ai-studio-image/scripts/prompt_engine.py +424 -0
- package/templates/vault/ai-studio-image/scripts/requirements.txt +4 -0
- package/templates/vault/ai-studio-image/scripts/templates.py +349 -0
- package/templates/vault/android_ui_verification/scripts/verify_ui.sh +32 -0
- package/templates/vault/apify-audience-analysis/reference/scripts/run_actor.js +363 -0
- package/templates/vault/apify-brand-reputation-monitoring/reference/scripts/run_actor.js +363 -0
- package/templates/vault/apify-competitor-intelligence/reference/scripts/run_actor.js +363 -0
- package/templates/vault/apify-content-analytics/reference/scripts/run_actor.js +363 -0
- package/templates/vault/apify-ecommerce/reference/scripts/package.json +3 -0
- package/templates/vault/apify-ecommerce/reference/scripts/run_actor.js +369 -0
- package/templates/vault/apify-influencer-discovery/reference/scripts/run_actor.js +363 -0
- package/templates/vault/apify-lead-generation/reference/scripts/run_actor.js +363 -0
- package/templates/vault/apify-market-research/reference/scripts/run_actor.js +363 -0
- package/templates/vault/apify-trend-analysis/reference/scripts/run_actor.js +363 -0
- package/templates/vault/apify-ultimate-scraper/reference/scripts/run_actor.js +363 -0
- package/templates/vault/audio-transcriber/scripts/install-requirements.sh +190 -0
- package/templates/vault/audio-transcriber/scripts/transcribe.py +486 -0
- package/templates/vault/claude-monitor/scripts/api_bench.py +240 -0
- package/templates/vault/claude-monitor/scripts/config.py +69 -0
- package/templates/vault/claude-monitor/scripts/health_check.py +362 -0
- package/templates/vault/claude-monitor/scripts/monitor.py +296 -0
- package/templates/vault/content-creator/scripts/brand_voice_analyzer.py +185 -0
- package/templates/vault/content-creator/scripts/seo_optimizer.py +419 -0
- package/templates/vault/context-agent/scripts/active_context.py +227 -0
- package/templates/vault/context-agent/scripts/compressor.py +149 -0
- package/templates/vault/context-agent/scripts/config.py +69 -0
- package/templates/vault/context-agent/scripts/context_loader.py +155 -0
- package/templates/vault/context-agent/scripts/context_manager.py +302 -0
- package/templates/vault/context-agent/scripts/models.py +103 -0
- package/templates/vault/context-agent/scripts/project_registry.py +132 -0
- package/templates/vault/context-agent/scripts/requirements.txt +6 -0
- package/templates/vault/context-agent/scripts/search.py +115 -0
- package/templates/vault/context-agent/scripts/session_parser.py +206 -0
- package/templates/vault/context-agent/scripts/session_summary.py +319 -0
- package/templates/vault/context-guardian/scripts/context_snapshot.py +229 -0
- package/templates/vault/docx/ooxml/scripts/pack.py +159 -0
- package/templates/vault/docx/ooxml/scripts/unpack.py +29 -0
- package/templates/vault/docx/ooxml/scripts/validate.py +69 -0
- package/templates/vault/docx/ooxml/scripts/validation/__init__.py +15 -0
- package/templates/vault/docx/ooxml/scripts/validation/base.py +951 -0
- package/templates/vault/docx/ooxml/scripts/validation/docx.py +274 -0
- package/templates/vault/docx/ooxml/scripts/validation/pptx.py +315 -0
- package/templates/vault/docx/ooxml/scripts/validation/redlining.py +279 -0
- package/templates/vault/docx/scripts/__init__.py +1 -0
- package/templates/vault/docx/scripts/document.py +1276 -0
- package/templates/vault/docx/scripts/templates/comments.xml +3 -0
- package/templates/vault/docx/scripts/templates/commentsExtended.xml +3 -0
- package/templates/vault/docx/scripts/templates/commentsExtensible.xml +3 -0
- package/templates/vault/docx/scripts/templates/commentsIds.xml +3 -0
- package/templates/vault/docx/scripts/templates/people.xml +3 -0
- package/templates/vault/docx/scripts/utilities.py +374 -0
- package/templates/vault/docx-official/ooxml/scripts/pack.py +159 -0
- package/templates/vault/docx-official/ooxml/scripts/unpack.py +29 -0
- package/templates/vault/docx-official/ooxml/scripts/validate.py +69 -0
- package/templates/vault/docx-official/ooxml/scripts/validation/__init__.py +15 -0
- package/templates/vault/docx-official/ooxml/scripts/validation/base.py +951 -0
- package/templates/vault/docx-official/ooxml/scripts/validation/docx.py +274 -0
- package/templates/vault/docx-official/ooxml/scripts/validation/pptx.py +315 -0
- package/templates/vault/docx-official/ooxml/scripts/validation/redlining.py +279 -0
- package/templates/vault/docx-official/scripts/__init__.py +1 -0
- package/templates/vault/docx-official/scripts/document.py +1276 -0
- package/templates/vault/docx-official/scripts/templates/comments.xml +3 -0
- package/templates/vault/docx-official/scripts/templates/commentsExtended.xml +3 -0
- package/templates/vault/docx-official/scripts/templates/commentsExtensible.xml +3 -0
- package/templates/vault/docx-official/scripts/templates/commentsIds.xml +3 -0
- package/templates/vault/docx-official/scripts/templates/people.xml +3 -0
- package/templates/vault/docx-official/scripts/utilities.py +374 -0
- package/templates/vault/geo-fundamentals/scripts/geo_checker.py +289 -0
- package/templates/vault/helm-chart-scaffolding/scripts/validate-chart.sh +244 -0
- package/templates/vault/i18n-localization/scripts/i18n_checker.py +241 -0
- package/templates/vault/instagram/scripts/account_setup.py +233 -0
- package/templates/vault/instagram/scripts/analyze.py +221 -0
- package/templates/vault/instagram/scripts/api_client.py +444 -0
- package/templates/vault/instagram/scripts/auth.py +411 -0
- package/templates/vault/instagram/scripts/comments.py +160 -0
- package/templates/vault/instagram/scripts/config.py +111 -0
- package/templates/vault/instagram/scripts/db.py +467 -0
- package/templates/vault/instagram/scripts/export.py +138 -0
- package/templates/vault/instagram/scripts/governance.py +233 -0
- package/templates/vault/instagram/scripts/hashtags.py +114 -0
- package/templates/vault/instagram/scripts/insights.py +170 -0
- package/templates/vault/instagram/scripts/media.py +65 -0
- package/templates/vault/instagram/scripts/messages.py +103 -0
- package/templates/vault/instagram/scripts/profile.py +58 -0
- package/templates/vault/instagram/scripts/publish.py +449 -0
- package/templates/vault/instagram/scripts/requirements.txt +5 -0
- package/templates/vault/instagram/scripts/run_all.py +189 -0
- package/templates/vault/instagram/scripts/schedule.py +189 -0
- package/templates/vault/instagram/scripts/serve_api.py +234 -0
- package/templates/vault/instagram/scripts/templates.py +155 -0
- package/templates/vault/junta-leiloeiros/scripts/db.py +216 -0
- package/templates/vault/junta-leiloeiros/scripts/export.py +137 -0
- package/templates/vault/junta-leiloeiros/scripts/requirements.txt +15 -0
- package/templates/vault/junta-leiloeiros/scripts/run_all.py +190 -0
- package/templates/vault/junta-leiloeiros/scripts/scraper/__init__.py +4 -0
- package/templates/vault/junta-leiloeiros/scripts/scraper/base_scraper.py +209 -0
- package/templates/vault/junta-leiloeiros/scripts/scraper/generic_scraper.py +110 -0
- package/templates/vault/junta-leiloeiros/scripts/scraper/jucap.py +110 -0
- package/templates/vault/junta-leiloeiros/scripts/scraper/juceac.py +72 -0
- package/templates/vault/junta-leiloeiros/scripts/scraper/juceal.py +72 -0
- package/templates/vault/junta-leiloeiros/scripts/scraper/juceb.py +68 -0
- package/templates/vault/junta-leiloeiros/scripts/scraper/jucec.py +63 -0
- package/templates/vault/junta-leiloeiros/scripts/scraper/jucema.py +211 -0
- package/templates/vault/junta-leiloeiros/scripts/scraper/jucemg.py +218 -0
- package/templates/vault/junta-leiloeiros/scripts/scraper/jucep.py +70 -0
- package/templates/vault/junta-leiloeiros/scripts/scraper/jucepa.py +74 -0
- package/templates/vault/junta-leiloeiros/scripts/scraper/jucepar.py +80 -0
- package/templates/vault/junta-leiloeiros/scripts/scraper/jucepe.py +78 -0
- package/templates/vault/junta-leiloeiros/scripts/scraper/jucepi.py +69 -0
- package/templates/vault/junta-leiloeiros/scripts/scraper/jucer.py +256 -0
- package/templates/vault/junta-leiloeiros/scripts/scraper/jucerja.py +170 -0
- package/templates/vault/junta-leiloeiros/scripts/scraper/jucern.py +71 -0
- package/templates/vault/junta-leiloeiros/scripts/scraper/jucesc.py +89 -0
- package/templates/vault/junta-leiloeiros/scripts/scraper/jucesp.py +233 -0
- package/templates/vault/junta-leiloeiros/scripts/scraper/jucetins.py +134 -0
- package/templates/vault/junta-leiloeiros/scripts/scraper/jucis_df.py +63 -0
- package/templates/vault/junta-leiloeiros/scripts/scraper/jucisrs.py +299 -0
- package/templates/vault/junta-leiloeiros/scripts/scraper/states.py +99 -0
- package/templates/vault/junta-leiloeiros/scripts/serve_api.py +164 -0
- package/templates/vault/junta-leiloeiros/scripts/web_scraper_fallback.py +233 -0
- package/templates/vault/last30days/scripts/last30days.py +521 -0
- package/templates/vault/last30days/scripts/lib/__init__.py +1 -0
- package/templates/vault/last30days/scripts/lib/cache.py +152 -0
- package/templates/vault/last30days/scripts/lib/dates.py +124 -0
- package/templates/vault/last30days/scripts/lib/dedupe.py +120 -0
- package/templates/vault/last30days/scripts/lib/env.py +149 -0
- package/templates/vault/last30days/scripts/lib/http.py +152 -0
- package/templates/vault/last30days/scripts/lib/models.py +175 -0
- package/templates/vault/last30days/scripts/lib/normalize.py +160 -0
- package/templates/vault/last30days/scripts/lib/openai_reddit.py +230 -0
- package/templates/vault/last30days/scripts/lib/reddit_enrich.py +232 -0
- package/templates/vault/last30days/scripts/lib/render.py +383 -0
- package/templates/vault/last30days/scripts/lib/schema.py +336 -0
- package/templates/vault/last30days/scripts/lib/score.py +311 -0
- package/templates/vault/last30days/scripts/lib/ui.py +324 -0
- package/templates/vault/last30days/scripts/lib/websearch.py +401 -0
- package/templates/vault/last30days/scripts/lib/xai_x.py +217 -0
- package/templates/vault/leiloeiro-avaliacao/scripts/governance.py +106 -0
- package/templates/vault/leiloeiro-avaliacao/scripts/requirements.txt +1 -0
- package/templates/vault/leiloeiro-edital/scripts/governance.py +106 -0
- package/templates/vault/leiloeiro-edital/scripts/requirements.txt +1 -0
- package/templates/vault/leiloeiro-ia/scripts/governance.py +106 -0
- package/templates/vault/leiloeiro-ia/scripts/requirements.txt +1 -0
- package/templates/vault/leiloeiro-juridico/scripts/governance.py +106 -0
- package/templates/vault/leiloeiro-juridico/scripts/requirements.txt +1 -0
- package/templates/vault/leiloeiro-mercado/scripts/governance.py +106 -0
- package/templates/vault/leiloeiro-mercado/scripts/requirements.txt +1 -0
- package/templates/vault/leiloeiro-risco/scripts/governance.py +106 -0
- package/templates/vault/leiloeiro-risco/scripts/requirements.txt +1 -0
- package/templates/vault/loki-mode/examples/todo-app-generated/backend/src/db/database.ts +24 -0
- package/templates/vault/loki-mode/examples/todo-app-generated/backend/src/db/db.ts +35 -0
- package/templates/vault/loki-mode/examples/todo-app-generated/backend/src/db/index.ts +2 -0
- package/templates/vault/loki-mode/examples/todo-app-generated/backend/src/db/migrations.ts +31 -0
- package/templates/vault/loki-mode/examples/todo-app-generated/backend/src/db/schema.sql +8 -0
- package/templates/vault/loki-mode/examples/todo-app-generated/backend/src/index.ts +44 -0
- package/templates/vault/loki-mode/examples/todo-app-generated/backend/src/routes/todos.ts +155 -0
- package/templates/vault/loki-mode/examples/todo-app-generated/backend/src/types/index.ts +35 -0
- package/templates/vault/loki-mode/examples/todo-app-generated/frontend/src/App.css +384 -0
- package/templates/vault/loki-mode/examples/todo-app-generated/frontend/src/App.tsx +81 -0
- package/templates/vault/loki-mode/examples/todo-app-generated/frontend/src/api/todos.ts +57 -0
- package/templates/vault/loki-mode/examples/todo-app-generated/frontend/src/components/ConfirmDialog.tsx +26 -0
- package/templates/vault/loki-mode/examples/todo-app-generated/frontend/src/components/EmptyState.tsx +8 -0
- package/templates/vault/loki-mode/examples/todo-app-generated/frontend/src/components/TodoForm.tsx +43 -0
- package/templates/vault/loki-mode/examples/todo-app-generated/frontend/src/components/TodoItem.tsx +36 -0
- package/templates/vault/loki-mode/examples/todo-app-generated/frontend/src/components/TodoList.tsx +27 -0
- package/templates/vault/loki-mode/examples/todo-app-generated/frontend/src/hooks/useTodos.ts +81 -0
- package/templates/vault/loki-mode/examples/todo-app-generated/frontend/src/index.css +48 -0
- package/templates/vault/loki-mode/examples/todo-app-generated/frontend/src/main.tsx +10 -0
- package/templates/vault/loki-mode/examples/todo-app-generated/frontend/src/vite-env.d.ts +1 -0
- package/templates/vault/loki-mode/scripts/export-to-vibe-kanban.sh +178 -0
- package/templates/vault/loki-mode/scripts/loki-wrapper.sh +281 -0
- package/templates/vault/loki-mode/scripts/take-screenshots.js +55 -0
- package/templates/vault/matematico-tao/scripts/complexity_analyzer.py +544 -0
- package/templates/vault/matematico-tao/scripts/dependency_graph.py +538 -0
- package/templates/vault/mcp-builder/scripts/connections.py +151 -0
- package/templates/vault/mcp-builder/scripts/evaluation.py +373 -0
- package/templates/vault/mcp-builder/scripts/example_evaluation.xml +22 -0
- package/templates/vault/mcp-builder/scripts/requirements.txt +2 -0
- package/templates/vault/mobile-design/scripts/mobile_audit.py +670 -0
- package/templates/vault/notebooklm/scripts/__init__.py +81 -0
- package/templates/vault/notebooklm/scripts/ask_question.py +256 -0
- package/templates/vault/notebooklm/scripts/auth_manager.py +358 -0
- package/templates/vault/notebooklm/scripts/browser_session.py +255 -0
- package/templates/vault/notebooklm/scripts/browser_utils.py +107 -0
- package/templates/vault/notebooklm/scripts/cleanup_manager.py +302 -0
- package/templates/vault/notebooklm/scripts/config.py +44 -0
- package/templates/vault/notebooklm/scripts/notebook_manager.py +410 -0
- package/templates/vault/notebooklm/scripts/run.py +102 -0
- package/templates/vault/notebooklm/scripts/setup_environment.py +204 -0
- package/templates/vault/pdf/scripts/check_bounding_boxes.py +70 -0
- package/templates/vault/pdf/scripts/check_bounding_boxes_test.py +226 -0
- package/templates/vault/pdf/scripts/check_fillable_fields.py +12 -0
- package/templates/vault/pdf/scripts/convert_pdf_to_images.py +35 -0
- package/templates/vault/pdf/scripts/create_validation_image.py +41 -0
- package/templates/vault/pdf/scripts/extract_form_field_info.py +152 -0
- package/templates/vault/pdf/scripts/fill_fillable_fields.py +114 -0
- package/templates/vault/pdf/scripts/fill_pdf_form_with_annotations.py +108 -0
- package/templates/vault/pdf-official/scripts/check_bounding_boxes.py +70 -0
- package/templates/vault/pdf-official/scripts/check_bounding_boxes_test.py +226 -0
- package/templates/vault/pdf-official/scripts/check_fillable_fields.py +12 -0
- package/templates/vault/pdf-official/scripts/convert_pdf_to_images.py +35 -0
- package/templates/vault/pdf-official/scripts/create_validation_image.py +41 -0
- package/templates/vault/pdf-official/scripts/extract_form_field_info.py +152 -0
- package/templates/vault/pdf-official/scripts/fill_fillable_fields.py +114 -0
- package/templates/vault/pdf-official/scripts/fill_pdf_form_with_annotations.py +108 -0
- package/templates/vault/planning-with-files/scripts/check-complete.sh +44 -0
- package/templates/vault/planning-with-files/scripts/init-session.sh +120 -0
- package/templates/vault/pptx/ooxml/scripts/pack.py +159 -0
- package/templates/vault/pptx/ooxml/scripts/unpack.py +29 -0
- package/templates/vault/pptx/ooxml/scripts/validate.py +69 -0
- package/templates/vault/pptx/ooxml/scripts/validation/__init__.py +15 -0
- package/templates/vault/pptx/ooxml/scripts/validation/base.py +951 -0
- package/templates/vault/pptx/ooxml/scripts/validation/docx.py +274 -0
- package/templates/vault/pptx/ooxml/scripts/validation/pptx.py +315 -0
- package/templates/vault/pptx/ooxml/scripts/validation/redlining.py +279 -0
- package/templates/vault/pptx/scripts/html2pptx.js +979 -0
- package/templates/vault/pptx/scripts/inventory.py +1020 -0
- package/templates/vault/pptx/scripts/rearrange.py +231 -0
- package/templates/vault/pptx/scripts/replace.py +385 -0
- package/templates/vault/pptx/scripts/thumbnail.py +450 -0
- package/templates/vault/pptx-official/ooxml/scripts/pack.py +159 -0
- package/templates/vault/pptx-official/ooxml/scripts/unpack.py +29 -0
- package/templates/vault/pptx-official/ooxml/scripts/validate.py +69 -0
- package/templates/vault/pptx-official/ooxml/scripts/validation/__init__.py +15 -0
- package/templates/vault/pptx-official/ooxml/scripts/validation/base.py +951 -0
- package/templates/vault/pptx-official/ooxml/scripts/validation/docx.py +274 -0
- package/templates/vault/pptx-official/ooxml/scripts/validation/pptx.py +315 -0
- package/templates/vault/pptx-official/ooxml/scripts/validation/redlining.py +279 -0
- package/templates/vault/pptx-official/scripts/html2pptx.js +979 -0
- package/templates/vault/pptx-official/scripts/inventory.py +1020 -0
- package/templates/vault/pptx-official/scripts/rearrange.py +231 -0
- package/templates/vault/pptx-official/scripts/replace.py +385 -0
- package/templates/vault/pptx-official/scripts/thumbnail.py +450 -0
- package/templates/vault/product-manager-toolkit/scripts/customer_interview_analyzer.py +441 -0
- package/templates/vault/product-manager-toolkit/scripts/rice_prioritizer.py +296 -0
- package/templates/vault/prompt-engineering-patterns/scripts/optimize-prompt.py +279 -0
- package/templates/vault/scripts/.skill_cache.json +7538 -0
- package/templates/vault/scripts/skill_search.py +228 -0
- package/templates/vault/senior-architect/scripts/architecture_diagram_generator.py +114 -0
- package/templates/vault/senior-architect/scripts/dependency_analyzer.py +114 -0
- package/templates/vault/senior-architect/scripts/project_architect.py +114 -0
- package/templates/vault/shopify-development/scripts/requirements.txt +19 -0
- package/templates/vault/shopify-development/scripts/shopify_graphql.py +428 -0
- package/templates/vault/shopify-development/scripts/shopify_init.py +441 -0
- package/templates/vault/shopify-development/scripts/tests/test_shopify_init.py +379 -0
- package/templates/vault/skill-creator/scripts/init_skill.py +303 -0
- package/templates/vault/skill-creator/scripts/package_skill.py +110 -0
- package/templates/vault/skill-creator/scripts/quick_validate.py +95 -0
- package/templates/vault/skill-installer/scripts/detect_skills.py +318 -0
- package/templates/vault/skill-installer/scripts/install_skill.py +1708 -0
- package/templates/vault/skill-installer/scripts/package_skill.py +417 -0
- package/templates/vault/skill-installer/scripts/requirements.txt +1 -0
- package/templates/vault/skill-installer/scripts/validate_skill.py +430 -0
- package/templates/vault/skill-sentinel/scripts/analyzers/__init__.py +13 -0
- package/templates/vault/skill-sentinel/scripts/analyzers/code_quality.py +247 -0
- package/templates/vault/skill-sentinel/scripts/analyzers/cross_skill.py +134 -0
- package/templates/vault/skill-sentinel/scripts/analyzers/dependencies.py +121 -0
- package/templates/vault/skill-sentinel/scripts/analyzers/documentation.py +189 -0
- package/templates/vault/skill-sentinel/scripts/analyzers/governance_audit.py +153 -0
- package/templates/vault/skill-sentinel/scripts/analyzers/performance.py +164 -0
- package/templates/vault/skill-sentinel/scripts/analyzers/security.py +189 -0
- package/templates/vault/skill-sentinel/scripts/config.py +158 -0
- package/templates/vault/skill-sentinel/scripts/cost_optimizer.py +146 -0
- package/templates/vault/skill-sentinel/scripts/db.py +354 -0
- package/templates/vault/skill-sentinel/scripts/governance.py +58 -0
- package/templates/vault/skill-sentinel/scripts/recommender.py +228 -0
- package/templates/vault/skill-sentinel/scripts/report_generator.py +224 -0
- package/templates/vault/skill-sentinel/scripts/requirements.txt +1 -0
- package/templates/vault/skill-sentinel/scripts/run_audit.py +290 -0
- package/templates/vault/skill-sentinel/scripts/scanner.py +271 -0
- package/templates/vault/stability-ai/scripts/config.py +266 -0
- package/templates/vault/stability-ai/scripts/generate.py +687 -0
- package/templates/vault/stability-ai/scripts/requirements.txt +4 -0
- package/templates/vault/stability-ai/scripts/styles.py +174 -0
- package/templates/vault/telegram/assets/boilerplate/nodejs/src/bot-client.ts +86 -0
- package/templates/vault/telegram/assets/boilerplate/nodejs/src/handlers.ts +79 -0
- package/templates/vault/telegram/assets/boilerplate/nodejs/src/index.ts +32 -0
- package/templates/vault/telegram/scripts/send_message.py +143 -0
- package/templates/vault/telegram/scripts/setup_project.py +103 -0
- package/templates/vault/telegram/scripts/test_bot.py +144 -0
- package/templates/vault/typescript-expert/scripts/ts_diagnostic.py +203 -0
- package/templates/vault/ui-ux-pro-max/scripts/__pycache__/core.cpython-314.pyc +0 -0
- package/templates/vault/ui-ux-pro-max/scripts/__pycache__/design_system.cpython-314.pyc +0 -0
- package/templates/vault/ui-ux-pro-max/scripts/core.py +257 -0
- package/templates/vault/ui-ux-pro-max/scripts/design_system.py +487 -0
- package/templates/vault/ui-ux-pro-max/scripts/search.py +76 -0
- package/templates/vault/videodb/scripts/ws_listener.py +204 -0
- package/templates/vault/web-artifacts-builder/scripts/bundle-artifact.sh +54 -0
- package/templates/vault/web-artifacts-builder/scripts/init-artifact.sh +322 -0
- package/templates/vault/web-artifacts-builder/scripts/shadcn-components.tar.gz +0 -0
- package/templates/vault/webapp-testing/scripts/with_server.py +106 -0
- package/templates/vault/whatsapp-cloud-api/assets/boilerplate/nodejs/src/index.ts +125 -0
- package/templates/vault/whatsapp-cloud-api/assets/boilerplate/nodejs/src/template-manager.ts +67 -0
- package/templates/vault/whatsapp-cloud-api/assets/boilerplate/nodejs/src/types.ts +216 -0
- package/templates/vault/whatsapp-cloud-api/assets/boilerplate/nodejs/src/webhook-handler.ts +173 -0
- package/templates/vault/whatsapp-cloud-api/assets/boilerplate/nodejs/src/whatsapp-client.ts +193 -0
- package/templates/vault/whatsapp-cloud-api/scripts/send_test_message.py +137 -0
- package/templates/vault/whatsapp-cloud-api/scripts/setup_project.py +118 -0
- package/templates/vault/whatsapp-cloud-api/scripts/validate_config.py +190 -0
- package/templates/vault/youtube-summarizer/scripts/extract-transcript.py +65 -0
- package/templates/vault/youtube-summarizer/scripts/install-dependencies.sh +28 -0
|
@@ -0,0 +1,630 @@
|
|
|
1
|
+
"""
|
|
2
|
+
AI Studio Image — Gerador de Imagens (v2 — Enhanced)
|
|
3
|
+
|
|
4
|
+
Script principal que conecta com Google AI Studio (Gemini/Imagen)
|
|
5
|
+
para gerar imagens humanizadas. Suporta todos os modelos oficiais,
|
|
6
|
+
fallback automatico de API keys, e metadados completos.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
import argparse
|
|
10
|
+
import base64
|
|
11
|
+
import json
|
|
12
|
+
import re
|
|
13
|
+
import sys
|
|
14
|
+
import time
|
|
15
|
+
from datetime import datetime
|
|
16
|
+
from pathlib import Path
|
|
17
|
+
|
|
18
|
+
sys.path.insert(0, str(Path(__file__).parent))
|
|
19
|
+
from config import (
|
|
20
|
+
MODELS,
|
|
21
|
+
DEFAULT_MODEL,
|
|
22
|
+
DEFAULT_FORMAT,
|
|
23
|
+
DEFAULT_HUMANIZATION,
|
|
24
|
+
DEFAULT_MODE,
|
|
25
|
+
DEFAULT_RESOLUTION,
|
|
26
|
+
DEFAULT_PERSON_GENERATION,
|
|
27
|
+
IMAGE_FORMATS,
|
|
28
|
+
FORMAT_ALIASES,
|
|
29
|
+
OUTPUTS_DIR,
|
|
30
|
+
OUTPUT_SETTINGS,
|
|
31
|
+
get_api_key,
|
|
32
|
+
get_all_api_keys,
|
|
33
|
+
safety_check_model,
|
|
34
|
+
safety_check_daily_limit,
|
|
35
|
+
)
|
|
36
|
+
from prompt_engine import humanize_prompt, analyze_prompt, resolve_format
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def _check_dependencies():
|
|
40
|
+
"""Verifica dependencias necessarias."""
|
|
41
|
+
try:
|
|
42
|
+
import google.genai # noqa: F401
|
|
43
|
+
except ImportError:
|
|
44
|
+
print("=" * 60)
|
|
45
|
+
print(" DEPENDENCIA FALTANDO: google-genai")
|
|
46
|
+
print("=" * 60)
|
|
47
|
+
print()
|
|
48
|
+
print(" Instale com:")
|
|
49
|
+
print(" pip install google-genai Pillow python-dotenv")
|
|
50
|
+
print()
|
|
51
|
+
print(" Ou use o requirements.txt:")
|
|
52
|
+
scripts_dir = Path(__file__).parent
|
|
53
|
+
print(f" pip install -r {scripts_dir / 'requirements.txt'}")
|
|
54
|
+
print()
|
|
55
|
+
sys.exit(1)
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def _get_client(api_key: str):
|
|
59
|
+
"""Cria cliente Google GenAI."""
|
|
60
|
+
from google import genai
|
|
61
|
+
return genai.Client(api_key=api_key)
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
# =============================================================================
|
|
65
|
+
# GERACAO VIA IMAGEN (imagen-4, imagen-4-ultra, imagen-4-fast)
|
|
66
|
+
# =============================================================================
|
|
67
|
+
|
|
68
|
+
def generate_with_imagen(
|
|
69
|
+
prompt: str,
|
|
70
|
+
model_id: str,
|
|
71
|
+
aspect_ratio: str,
|
|
72
|
+
num_images: int,
|
|
73
|
+
api_key: str,
|
|
74
|
+
resolution: str = "1K",
|
|
75
|
+
person_generation: str = DEFAULT_PERSON_GENERATION,
|
|
76
|
+
) -> list[dict]:
|
|
77
|
+
"""Gera imagens usando Imagen 4."""
|
|
78
|
+
from google.genai import types
|
|
79
|
+
|
|
80
|
+
client = _get_client(api_key)
|
|
81
|
+
|
|
82
|
+
config_params = {
|
|
83
|
+
"number_of_images": num_images,
|
|
84
|
+
"aspect_ratio": aspect_ratio,
|
|
85
|
+
"output_mime_type": OUTPUT_SETTINGS["default_mime_type"],
|
|
86
|
+
"person_generation": person_generation,
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
# Resolucao (apenas Standard e Ultra suportam 2K)
|
|
90
|
+
if resolution in ("2K",) and "fast" not in model_id:
|
|
91
|
+
config_params["image_size"] = resolution
|
|
92
|
+
|
|
93
|
+
config = types.GenerateImagesConfig(**config_params)
|
|
94
|
+
|
|
95
|
+
response = client.models.generate_images(
|
|
96
|
+
model=model_id,
|
|
97
|
+
prompt=prompt,
|
|
98
|
+
config=config,
|
|
99
|
+
)
|
|
100
|
+
|
|
101
|
+
results = []
|
|
102
|
+
if response.generated_images:
|
|
103
|
+
for img in response.generated_images:
|
|
104
|
+
img_bytes = img.image.image_bytes
|
|
105
|
+
if isinstance(img_bytes, str):
|
|
106
|
+
img_bytes = base64.b64decode(img_bytes)
|
|
107
|
+
results.append({
|
|
108
|
+
"image_bytes": img_bytes,
|
|
109
|
+
"mime_type": OUTPUT_SETTINGS["default_mime_type"],
|
|
110
|
+
})
|
|
111
|
+
|
|
112
|
+
return results
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
# =============================================================================
|
|
116
|
+
# GERACAO VIA GEMINI (gemini-flash-image, gemini-pro-image)
|
|
117
|
+
# =============================================================================
|
|
118
|
+
|
|
119
|
+
def generate_with_gemini(
|
|
120
|
+
prompt: str,
|
|
121
|
+
model_id: str,
|
|
122
|
+
aspect_ratio: str,
|
|
123
|
+
api_key: str,
|
|
124
|
+
resolution: str = "1K",
|
|
125
|
+
reference_images: list[Path] | None = None,
|
|
126
|
+
) -> list[dict]:
|
|
127
|
+
"""Gera imagens usando Gemini (generateContent com modalidade IMAGE)."""
|
|
128
|
+
from google.genai import types
|
|
129
|
+
from PIL import Image
|
|
130
|
+
|
|
131
|
+
client = _get_client(api_key)
|
|
132
|
+
|
|
133
|
+
# Construir contents
|
|
134
|
+
contents = []
|
|
135
|
+
|
|
136
|
+
# Adicionar imagens de referencia (se Gemini Pro Image)
|
|
137
|
+
if reference_images:
|
|
138
|
+
for ref_path in reference_images:
|
|
139
|
+
if Path(ref_path).exists():
|
|
140
|
+
contents.append(Image.open(str(ref_path)))
|
|
141
|
+
|
|
142
|
+
contents.append(prompt)
|
|
143
|
+
|
|
144
|
+
# Alguns modelos (ex: gemini-2.0-flash-exp) nao suportam aspect_ratio/ImageConfig
|
|
145
|
+
# Verificar via config ou fallback por ID
|
|
146
|
+
supports_ar = True
|
|
147
|
+
for _mk, _mc in MODELS.items():
|
|
148
|
+
if _mc["id"] == model_id:
|
|
149
|
+
supports_ar = _mc.get("supports_aspect_ratio", True)
|
|
150
|
+
break
|
|
151
|
+
|
|
152
|
+
if not supports_ar:
|
|
153
|
+
config = types.GenerateContentConfig(
|
|
154
|
+
response_modalities=["TEXT", "IMAGE"],
|
|
155
|
+
)
|
|
156
|
+
else:
|
|
157
|
+
# Config com modalidades e aspect ratio
|
|
158
|
+
image_config = types.ImageConfig(aspect_ratio=aspect_ratio)
|
|
159
|
+
|
|
160
|
+
# Resolucao (Pro suporta ate 4K)
|
|
161
|
+
if resolution in ("2K", "4K") and "pro" in model_id.lower():
|
|
162
|
+
image_config = types.ImageConfig(
|
|
163
|
+
aspect_ratio=aspect_ratio,
|
|
164
|
+
image_size=resolution,
|
|
165
|
+
)
|
|
166
|
+
|
|
167
|
+
config = types.GenerateContentConfig(
|
|
168
|
+
response_modalities=["TEXT", "IMAGE"],
|
|
169
|
+
image_config=image_config,
|
|
170
|
+
)
|
|
171
|
+
|
|
172
|
+
response = client.models.generate_content(
|
|
173
|
+
model=model_id,
|
|
174
|
+
contents=contents,
|
|
175
|
+
config=config,
|
|
176
|
+
)
|
|
177
|
+
|
|
178
|
+
results = []
|
|
179
|
+
if response.candidates:
|
|
180
|
+
for candidate in response.candidates:
|
|
181
|
+
if candidate.content and candidate.content.parts:
|
|
182
|
+
for part in candidate.content.parts:
|
|
183
|
+
if hasattr(part, 'inline_data') and part.inline_data:
|
|
184
|
+
img_bytes = part.inline_data.data
|
|
185
|
+
if isinstance(img_bytes, str):
|
|
186
|
+
img_bytes = base64.b64decode(img_bytes)
|
|
187
|
+
results.append({
|
|
188
|
+
"image_bytes": img_bytes,
|
|
189
|
+
"mime_type": part.inline_data.mime_type or "image/png",
|
|
190
|
+
})
|
|
191
|
+
|
|
192
|
+
return results
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
# =============================================================================
|
|
196
|
+
# SALVAR IMAGEM + METADADOS
|
|
197
|
+
# =============================================================================
|
|
198
|
+
|
|
199
|
+
def save_image(
|
|
200
|
+
image_data: dict,
|
|
201
|
+
output_dir: Path,
|
|
202
|
+
mode: str,
|
|
203
|
+
template: str,
|
|
204
|
+
index: int,
|
|
205
|
+
metadata: dict,
|
|
206
|
+
) -> Path:
|
|
207
|
+
"""Salva imagem e metadados no disco."""
|
|
208
|
+
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
|
|
209
|
+
mime = image_data.get("mime_type", "image/png")
|
|
210
|
+
ext = "png" if "png" in mime else "jpg"
|
|
211
|
+
|
|
212
|
+
# Nome descritivo
|
|
213
|
+
template_clean = template.replace(" ", "-")[:20]
|
|
214
|
+
filename = f"{mode}_{template_clean}_{timestamp}_{index}.{ext}"
|
|
215
|
+
filepath = output_dir / filename
|
|
216
|
+
|
|
217
|
+
# Salvar imagem
|
|
218
|
+
filepath.write_bytes(image_data["image_bytes"])
|
|
219
|
+
|
|
220
|
+
# Salvar metadados
|
|
221
|
+
if OUTPUT_SETTINGS["save_metadata"]:
|
|
222
|
+
meta_path = output_dir / f"{filename}.meta.json"
|
|
223
|
+
meta_path.write_text(
|
|
224
|
+
json.dumps(metadata, indent=2, ensure_ascii=False, default=str),
|
|
225
|
+
encoding="utf-8",
|
|
226
|
+
)
|
|
227
|
+
|
|
228
|
+
return filepath
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
# =============================================================================
|
|
232
|
+
# FUNCAO PRINCIPAL — COM FALLBACK DE API KEYS
|
|
233
|
+
# =============================================================================
|
|
234
|
+
|
|
235
|
+
def generate(
|
|
236
|
+
prompt: str,
|
|
237
|
+
mode: str = DEFAULT_MODE,
|
|
238
|
+
format_name: str = DEFAULT_FORMAT,
|
|
239
|
+
humanization: str = DEFAULT_HUMANIZATION,
|
|
240
|
+
lighting: str | None = None,
|
|
241
|
+
model_name: str = DEFAULT_MODEL,
|
|
242
|
+
num_images: int = 1,
|
|
243
|
+
template: str = "custom",
|
|
244
|
+
template_context: str | None = None,
|
|
245
|
+
output_dir: Path | None = None,
|
|
246
|
+
skip_humanization: bool = False,
|
|
247
|
+
resolution: str = DEFAULT_RESOLUTION,
|
|
248
|
+
person_generation: str = DEFAULT_PERSON_GENERATION,
|
|
249
|
+
reference_images: list[Path] | None = None,
|
|
250
|
+
shot_type: str | None = None,
|
|
251
|
+
force_paid: bool = False,
|
|
252
|
+
) -> list[Path]:
|
|
253
|
+
"""
|
|
254
|
+
Funcao principal de geracao de imagens.
|
|
255
|
+
|
|
256
|
+
Fluxo:
|
|
257
|
+
1. Valida e tenta API keys com fallback
|
|
258
|
+
2. Humaniza o prompt (se nao skip)
|
|
259
|
+
3. Chama a API apropriada (Imagen ou Gemini)
|
|
260
|
+
4. Salva imagens + metadados completos
|
|
261
|
+
5. Retorna paths dos arquivos gerados
|
|
262
|
+
"""
|
|
263
|
+
# 0. CONTROLADOR DE SEGURANCA — verifica modelo e limite diario
|
|
264
|
+
allowed, msg = safety_check_model(model_name, force=force_paid)
|
|
265
|
+
if not allowed:
|
|
266
|
+
raise SystemExit(f"[SAFETY] {msg}")
|
|
267
|
+
print(f"[SAFETY] {msg}")
|
|
268
|
+
|
|
269
|
+
allowed, msg = safety_check_daily_limit(num_images)
|
|
270
|
+
if not allowed:
|
|
271
|
+
raise SystemExit(f"[SAFETY] {msg}")
|
|
272
|
+
print(f"[SAFETY] {msg}")
|
|
273
|
+
|
|
274
|
+
# 1. Obter API keys
|
|
275
|
+
api_keys = get_all_api_keys()
|
|
276
|
+
if not api_keys:
|
|
277
|
+
print("=" * 60)
|
|
278
|
+
print(" ERRO: Nenhuma GEMINI_API_KEY encontrada!")
|
|
279
|
+
print("=" * 60)
|
|
280
|
+
print()
|
|
281
|
+
print(" Configure de uma dessas formas:")
|
|
282
|
+
print(" 1. Variavel de ambiente: set GEMINI_API_KEY=sua-key")
|
|
283
|
+
print(" 2. Arquivo .env em: C:\\Users\\renat\\skills\\ai-studio-image\\")
|
|
284
|
+
print()
|
|
285
|
+
print(" Obtenha sua key em: https://aistudio.google.com/apikey")
|
|
286
|
+
sys.exit(1)
|
|
287
|
+
|
|
288
|
+
# 2. Resolver formato (suporta aliases)
|
|
289
|
+
format_name = resolve_format(format_name)
|
|
290
|
+
if format_name not in IMAGE_FORMATS:
|
|
291
|
+
format_name = DEFAULT_FORMAT
|
|
292
|
+
|
|
293
|
+
# 3. Humanizar prompt
|
|
294
|
+
if skip_humanization:
|
|
295
|
+
final_prompt = prompt
|
|
296
|
+
else:
|
|
297
|
+
final_prompt = humanize_prompt(
|
|
298
|
+
user_prompt=prompt,
|
|
299
|
+
mode=mode,
|
|
300
|
+
humanization=humanization,
|
|
301
|
+
lighting=lighting,
|
|
302
|
+
template_context=template_context,
|
|
303
|
+
shot_type=shot_type,
|
|
304
|
+
resolution=resolution,
|
|
305
|
+
)
|
|
306
|
+
|
|
307
|
+
# 4. Configuracoes do modelo
|
|
308
|
+
model_config = MODELS.get(model_name, MODELS[DEFAULT_MODEL])
|
|
309
|
+
format_config = IMAGE_FORMATS[format_name]
|
|
310
|
+
aspect_ratio = format_config["aspect_ratio"]
|
|
311
|
+
|
|
312
|
+
if output_dir is None:
|
|
313
|
+
output_dir = OUTPUTS_DIR
|
|
314
|
+
output_dir.mkdir(parents=True, exist_ok=True)
|
|
315
|
+
|
|
316
|
+
num_images = min(num_images, model_config["max_images"])
|
|
317
|
+
|
|
318
|
+
print("=" * 60)
|
|
319
|
+
print(" AI STUDIO IMAGE — Gerando Imagem Humanizada")
|
|
320
|
+
print("=" * 60)
|
|
321
|
+
print(f" Modelo: {model_config['id']}")
|
|
322
|
+
print(f" Tipo: {model_config['type']}")
|
|
323
|
+
print(f" Modo: {mode}")
|
|
324
|
+
print(f" Formato: {format_name} ({aspect_ratio})")
|
|
325
|
+
print(f" Humanizacao: {humanization}")
|
|
326
|
+
print(f" Resolucao: {resolution}")
|
|
327
|
+
print(f" Imagens: {num_images}")
|
|
328
|
+
if lighting:
|
|
329
|
+
print(f" Iluminacao: {lighting}")
|
|
330
|
+
if reference_images:
|
|
331
|
+
print(f" Referencias: {len(reference_images)} imagem(ns)")
|
|
332
|
+
print(f" Output: {output_dir}")
|
|
333
|
+
print("=" * 60)
|
|
334
|
+
print()
|
|
335
|
+
|
|
336
|
+
# 5. Gerar com fallback de API keys
|
|
337
|
+
images = []
|
|
338
|
+
used_key_index = 0
|
|
339
|
+
start_time = time.time()
|
|
340
|
+
|
|
341
|
+
max_retries = 3
|
|
342
|
+
retry_delay = 15 # seconds
|
|
343
|
+
|
|
344
|
+
for attempt in range(max_retries):
|
|
345
|
+
for i, api_key in enumerate(api_keys):
|
|
346
|
+
try:
|
|
347
|
+
if model_config["type"] == "imagen":
|
|
348
|
+
images = generate_with_imagen(
|
|
349
|
+
prompt=final_prompt,
|
|
350
|
+
model_id=model_config["id"],
|
|
351
|
+
aspect_ratio=aspect_ratio,
|
|
352
|
+
num_images=num_images,
|
|
353
|
+
api_key=api_key,
|
|
354
|
+
resolution=resolution,
|
|
355
|
+
person_generation=person_generation,
|
|
356
|
+
)
|
|
357
|
+
else:
|
|
358
|
+
images = generate_with_gemini(
|
|
359
|
+
prompt=final_prompt,
|
|
360
|
+
model_id=model_config["id"],
|
|
361
|
+
aspect_ratio=aspect_ratio,
|
|
362
|
+
api_key=api_key,
|
|
363
|
+
resolution=resolution,
|
|
364
|
+
reference_images=reference_images,
|
|
365
|
+
)
|
|
366
|
+
|
|
367
|
+
if images:
|
|
368
|
+
used_key_index = i
|
|
369
|
+
break
|
|
370
|
+
|
|
371
|
+
except Exception as e:
|
|
372
|
+
error_msg = str(e)
|
|
373
|
+
is_rate_limit = "429" in error_msg or "RESOURCE_EXHAUSTED" in error_msg
|
|
374
|
+
is_last_key = i >= len(api_keys) - 1
|
|
375
|
+
|
|
376
|
+
if not is_last_key:
|
|
377
|
+
print(f" Key {i+1} falhou ({error_msg[:60]}...), tentando backup...")
|
|
378
|
+
continue
|
|
379
|
+
elif is_rate_limit and attempt < max_retries - 1:
|
|
380
|
+
# Extrair delay sugerido da resposta se possivel
|
|
381
|
+
delay_match = re.search(r'retryDelay.*?(\d+)', error_msg)
|
|
382
|
+
wait_time = int(delay_match.group(1)) if delay_match else retry_delay
|
|
383
|
+
wait_time = min(wait_time + 5, 60) # cap at 60s
|
|
384
|
+
print(f" Rate limit atingido. Aguardando {wait_time}s (tentativa {attempt+1}/{max_retries})...")
|
|
385
|
+
time.sleep(wait_time)
|
|
386
|
+
break # Break inner loop to retry all keys
|
|
387
|
+
else:
|
|
388
|
+
print(f"\n ERRO: Todas as tentativas falharam.")
|
|
389
|
+
print(f" Ultimo erro: {error_msg[:200]}")
|
|
390
|
+
print()
|
|
391
|
+
if is_rate_limit:
|
|
392
|
+
print(" Rate limit esgotado. Sugestoes:")
|
|
393
|
+
print(" - Aguarde alguns minutos e tente novamente")
|
|
394
|
+
print(" - Habilite billing no Google Cloud para limites maiores")
|
|
395
|
+
print(" - Use um modelo diferente (--model imagen-4-fast)")
|
|
396
|
+
else:
|
|
397
|
+
print(" Dicas:")
|
|
398
|
+
print(" - Verifique se a API key e valida")
|
|
399
|
+
print(" - O prompt pode conter conteudo restrito")
|
|
400
|
+
print(" - Tente simplificar o prompt")
|
|
401
|
+
print(" - Verifique: https://aistudio.google.com/")
|
|
402
|
+
return []
|
|
403
|
+
|
|
404
|
+
if images:
|
|
405
|
+
break
|
|
406
|
+
|
|
407
|
+
elapsed = time.time() - start_time
|
|
408
|
+
|
|
409
|
+
if not images:
|
|
410
|
+
print("\n Nenhuma imagem gerada. Verifique o prompt e tente novamente.")
|
|
411
|
+
return []
|
|
412
|
+
|
|
413
|
+
# 6. Salvar imagens e metadados
|
|
414
|
+
metadata = {
|
|
415
|
+
"original_prompt": prompt,
|
|
416
|
+
"humanized_prompt": final_prompt,
|
|
417
|
+
"mode": mode,
|
|
418
|
+
"format": format_name,
|
|
419
|
+
"aspect_ratio": aspect_ratio,
|
|
420
|
+
"humanization": humanization,
|
|
421
|
+
"lighting": lighting,
|
|
422
|
+
"shot_type": shot_type,
|
|
423
|
+
"model": model_config["id"],
|
|
424
|
+
"model_name": model_name,
|
|
425
|
+
"model_type": model_config["type"],
|
|
426
|
+
"resolution": resolution,
|
|
427
|
+
"person_generation": person_generation,
|
|
428
|
+
"template": template,
|
|
429
|
+
"num_images_requested": num_images,
|
|
430
|
+
"num_images_generated": len(images),
|
|
431
|
+
"generation_time_seconds": round(elapsed, 2),
|
|
432
|
+
"api_key_index": used_key_index,
|
|
433
|
+
"generated_at": datetime.now().isoformat(),
|
|
434
|
+
"reference_images": [str(p) for p in (reference_images or [])],
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
saved_paths = []
|
|
438
|
+
for idx, img_data in enumerate(images):
|
|
439
|
+
filepath = save_image(
|
|
440
|
+
image_data=img_data,
|
|
441
|
+
output_dir=output_dir,
|
|
442
|
+
mode=mode,
|
|
443
|
+
template=template,
|
|
444
|
+
index=idx,
|
|
445
|
+
metadata=metadata,
|
|
446
|
+
)
|
|
447
|
+
saved_paths.append(filepath)
|
|
448
|
+
print(f" Salvo: {filepath}")
|
|
449
|
+
|
|
450
|
+
print(f"\n {len(saved_paths)} imagem(ns) gerada(s) em {elapsed:.1f}s")
|
|
451
|
+
|
|
452
|
+
# Salvar prompt humanizado para referencia
|
|
453
|
+
if OUTPUT_SETTINGS["save_prompt"]:
|
|
454
|
+
prompt_file = output_dir / f"last_prompt_{datetime.now().strftime('%Y%m%d_%H%M%S')}.txt"
|
|
455
|
+
content = f"ORIGINAL:\n{prompt}\n\nHUMANIZED:\n{final_prompt}"
|
|
456
|
+
prompt_file.write_text(content, encoding="utf-8")
|
|
457
|
+
|
|
458
|
+
return saved_paths
|
|
459
|
+
|
|
460
|
+
|
|
461
|
+
# =============================================================================
|
|
462
|
+
# CLI
|
|
463
|
+
# =============================================================================
|
|
464
|
+
|
|
465
|
+
def main():
|
|
466
|
+
parser = argparse.ArgumentParser(
|
|
467
|
+
description="Gerar imagens humanizadas via Google AI Studio",
|
|
468
|
+
formatter_class=argparse.RawDescriptionHelpFormatter,
|
|
469
|
+
epilog="""
|
|
470
|
+
Exemplos:
|
|
471
|
+
python generate.py --prompt "mulher tomando cafe" --mode influencer
|
|
472
|
+
python generate.py --prompt "professor explicando" --mode educacional --format widescreen
|
|
473
|
+
python generate.py --template cafe-lifestyle --custom "ruiva, 25 anos"
|
|
474
|
+
python generate.py --prompt "produto na mesa" --model imagen-4-ultra --resolution 2K
|
|
475
|
+
python generate.py --prompt "paisagem" --format ultrawide --lighting golden-hour
|
|
476
|
+
""",
|
|
477
|
+
)
|
|
478
|
+
|
|
479
|
+
# Prompt ou Template
|
|
480
|
+
parser.add_argument("--prompt", help="Descricao da imagem desejada")
|
|
481
|
+
parser.add_argument("--template", help="Nome do template pre-configurado")
|
|
482
|
+
parser.add_argument("--custom", help="Personalizacao sobre o template")
|
|
483
|
+
|
|
484
|
+
# Configuracoes principais
|
|
485
|
+
parser.add_argument("--mode", default=DEFAULT_MODE,
|
|
486
|
+
choices=["influencer", "educacional"])
|
|
487
|
+
parser.add_argument("--format", default=DEFAULT_FORMAT,
|
|
488
|
+
help="Formato (square, portrait, landscape, stories, widescreen, ultrawide, "
|
|
489
|
+
"ou aspect ratio como 4:5, 16:9, etc)")
|
|
490
|
+
parser.add_argument("--humanization", default=DEFAULT_HUMANIZATION,
|
|
491
|
+
choices=["ultra", "natural", "polished", "editorial"])
|
|
492
|
+
parser.add_argument("--lighting",
|
|
493
|
+
choices=["morning", "golden-hour", "midday", "overcast",
|
|
494
|
+
"night", "indoor", "blue-hour", "shade"])
|
|
495
|
+
parser.add_argument("--shot-type",
|
|
496
|
+
help="Tipo de enquadramento (close-up, medium, wide, etc)")
|
|
497
|
+
|
|
498
|
+
# Modelo e qualidade
|
|
499
|
+
parser.add_argument("--model", default=DEFAULT_MODEL,
|
|
500
|
+
choices=list(MODELS.keys()),
|
|
501
|
+
help=f"Modelo (default: {DEFAULT_MODEL})")
|
|
502
|
+
parser.add_argument("--resolution", default=DEFAULT_RESOLUTION,
|
|
503
|
+
choices=["1K", "2K", "4K"])
|
|
504
|
+
parser.add_argument("--variations", type=int, default=1,
|
|
505
|
+
help="Numero de variacoes (1-4)")
|
|
506
|
+
|
|
507
|
+
# Avancado
|
|
508
|
+
parser.add_argument("--reference-images", nargs="+", type=Path,
|
|
509
|
+
help="Imagens de referencia (apenas Gemini Pro Image)")
|
|
510
|
+
parser.add_argument("--person-generation", default=DEFAULT_PERSON_GENERATION,
|
|
511
|
+
choices=["dont_allow", "allow_adult", "allow_all"])
|
|
512
|
+
parser.add_argument("--skip-humanization", action="store_true",
|
|
513
|
+
help="Enviar prompt diretamente sem humanizacao")
|
|
514
|
+
parser.add_argument("--force-paid", action="store_true",
|
|
515
|
+
help="Permite usar modelos com custo (imagen-4, etc). USE COM CUIDADO.")
|
|
516
|
+
|
|
517
|
+
# Output
|
|
518
|
+
parser.add_argument("--output", type=Path, help="Diretorio de saida customizado")
|
|
519
|
+
|
|
520
|
+
# Utilidades
|
|
521
|
+
parser.add_argument("--analyze", action="store_true",
|
|
522
|
+
help="Apenas analisa o prompt e sugere configuracoes")
|
|
523
|
+
parser.add_argument("--list-models", action="store_true",
|
|
524
|
+
help="Lista todos os modelos disponiveis")
|
|
525
|
+
parser.add_argument("--list-formats", action="store_true",
|
|
526
|
+
help="Lista todos os formatos disponiveis")
|
|
527
|
+
parser.add_argument("--json", action="store_true")
|
|
528
|
+
|
|
529
|
+
args = parser.parse_args()
|
|
530
|
+
|
|
531
|
+
# Listar modelos
|
|
532
|
+
if args.list_models:
|
|
533
|
+
print("\nModelos disponiveis:\n")
|
|
534
|
+
for name, cfg in MODELS.items():
|
|
535
|
+
print(f" {name:25s} {cfg['description']}")
|
|
536
|
+
print(f" {'':25s} ID: {cfg['id']}")
|
|
537
|
+
print(f" {'':25s} Max imagens: {cfg['max_images']} | "
|
|
538
|
+
f"Max res: {cfg.get('max_resolution', 'N/A')}")
|
|
539
|
+
print()
|
|
540
|
+
return
|
|
541
|
+
|
|
542
|
+
# Listar formatos
|
|
543
|
+
if args.list_formats:
|
|
544
|
+
print("\nFormatos disponiveis:\n")
|
|
545
|
+
for name, cfg in IMAGE_FORMATS.items():
|
|
546
|
+
print(f" {name:20s} {cfg['aspect_ratio']:8s} {cfg['description']}")
|
|
547
|
+
print("\nAliases aceitos:\n")
|
|
548
|
+
for alias, target in sorted(FORMAT_ALIASES.items()):
|
|
549
|
+
if alias != target:
|
|
550
|
+
print(f" {alias:25s} -> {target}")
|
|
551
|
+
return
|
|
552
|
+
|
|
553
|
+
# Modo analise
|
|
554
|
+
if args.analyze:
|
|
555
|
+
if not args.prompt:
|
|
556
|
+
print("ERRO: --prompt obrigatorio com --analyze")
|
|
557
|
+
sys.exit(1)
|
|
558
|
+
analysis = analyze_prompt(args.prompt)
|
|
559
|
+
if args.json:
|
|
560
|
+
print(json.dumps(analysis, indent=2, ensure_ascii=False))
|
|
561
|
+
else:
|
|
562
|
+
print("\nAnalise do prompt:\n")
|
|
563
|
+
for k, v in analysis.items():
|
|
564
|
+
if k != "analysis":
|
|
565
|
+
print(f" {k:20s} {v or 'auto'}")
|
|
566
|
+
return
|
|
567
|
+
|
|
568
|
+
# Template ou prompt
|
|
569
|
+
template_context = None
|
|
570
|
+
if args.template:
|
|
571
|
+
from templates import get_template
|
|
572
|
+
tmpl = get_template(args.template)
|
|
573
|
+
if not tmpl:
|
|
574
|
+
print(f"ERRO: Template '{args.template}' nao encontrado")
|
|
575
|
+
print("Use: python templates.py --list")
|
|
576
|
+
sys.exit(1)
|
|
577
|
+
|
|
578
|
+
prompt = tmpl["prompt"]
|
|
579
|
+
if args.custom:
|
|
580
|
+
prompt = f"{prompt}. Additional specific details: {args.custom}"
|
|
581
|
+
template_context = tmpl.get("context", "")
|
|
582
|
+
|
|
583
|
+
if args.mode == DEFAULT_MODE and "mode" in tmpl:
|
|
584
|
+
args.mode = tmpl["mode"]
|
|
585
|
+
if args.format == DEFAULT_FORMAT and "suggested_format" in tmpl:
|
|
586
|
+
args.format = tmpl["suggested_format"]
|
|
587
|
+
if not args.lighting and "suggested_lighting" in tmpl:
|
|
588
|
+
args.lighting = tmpl["suggested_lighting"]
|
|
589
|
+
if args.humanization == DEFAULT_HUMANIZATION and "suggested_humanization" in tmpl:
|
|
590
|
+
args.humanization = tmpl["suggested_humanization"]
|
|
591
|
+
elif args.prompt:
|
|
592
|
+
prompt = args.prompt
|
|
593
|
+
else:
|
|
594
|
+
print("ERRO: Forneca --prompt ou --template")
|
|
595
|
+
print("Use --help para ver todas as opcoes")
|
|
596
|
+
sys.exit(1)
|
|
597
|
+
|
|
598
|
+
_check_dependencies()
|
|
599
|
+
|
|
600
|
+
# Gerar
|
|
601
|
+
paths = generate(
|
|
602
|
+
prompt=prompt,
|
|
603
|
+
mode=args.mode,
|
|
604
|
+
format_name=args.format,
|
|
605
|
+
humanization=args.humanization,
|
|
606
|
+
lighting=args.lighting,
|
|
607
|
+
model_name=args.model,
|
|
608
|
+
num_images=args.variations,
|
|
609
|
+
template=args.template or "custom",
|
|
610
|
+
template_context=template_context,
|
|
611
|
+
output_dir=args.output,
|
|
612
|
+
skip_humanization=args.skip_humanization,
|
|
613
|
+
resolution=args.resolution,
|
|
614
|
+
person_generation=args.person_generation,
|
|
615
|
+
reference_images=args.reference_images,
|
|
616
|
+
shot_type=args.shot_type,
|
|
617
|
+
force_paid=args.force_paid,
|
|
618
|
+
)
|
|
619
|
+
|
|
620
|
+
if args.json and paths:
|
|
621
|
+
result = {
|
|
622
|
+
"generated": [str(p) for p in paths],
|
|
623
|
+
"count": len(paths),
|
|
624
|
+
"output_dir": str(paths[0].parent) if paths else None,
|
|
625
|
+
}
|
|
626
|
+
print(json.dumps(result, indent=2, ensure_ascii=False))
|
|
627
|
+
|
|
628
|
+
|
|
629
|
+
if __name__ == "__main__":
|
|
630
|
+
main()
|