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,58 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Visualização e gestão do perfil Instagram.
|
|
3
|
+
|
|
4
|
+
Uso:
|
|
5
|
+
python scripts/profile.py --view # Ver perfil completo
|
|
6
|
+
python scripts/profile.py --json # Saída JSON
|
|
7
|
+
"""
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
import argparse
|
|
11
|
+
import asyncio
|
|
12
|
+
import json
|
|
13
|
+
import sys
|
|
14
|
+
from pathlib import Path
|
|
15
|
+
|
|
16
|
+
sys.path.insert(0, str(Path(__file__).parent))
|
|
17
|
+
|
|
18
|
+
from api_client import InstagramAPI
|
|
19
|
+
from auth import auto_refresh_if_needed
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
async def view_profile(as_json: bool = False) -> None:
|
|
23
|
+
"""Busca e exibe perfil do Instagram."""
|
|
24
|
+
await auto_refresh_if_needed()
|
|
25
|
+
|
|
26
|
+
api = InstagramAPI()
|
|
27
|
+
profile = await api.get_user_profile()
|
|
28
|
+
await api.close()
|
|
29
|
+
|
|
30
|
+
if as_json:
|
|
31
|
+
print(json.dumps(profile, indent=2, ensure_ascii=False))
|
|
32
|
+
return
|
|
33
|
+
|
|
34
|
+
print()
|
|
35
|
+
print("=" * 50)
|
|
36
|
+
print(f" @{profile.get('username', '?')}")
|
|
37
|
+
print("=" * 50)
|
|
38
|
+
print(f" Nome: {profile.get('name', '-')}")
|
|
39
|
+
print(f" Tipo: {profile.get('account_type', '-')}")
|
|
40
|
+
print(f" Bio: {profile.get('biography', '-')}")
|
|
41
|
+
print(f" Website: {profile.get('website', '-')}")
|
|
42
|
+
print(f" Seguidores: {profile.get('followers_count', 0):,}")
|
|
43
|
+
print(f" Seguindo: {profile.get('follows_count', 0):,}")
|
|
44
|
+
print(f" Posts: {profile.get('media_count', 0):,}")
|
|
45
|
+
print("=" * 50)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def main():
|
|
49
|
+
parser = argparse.ArgumentParser(description="Perfil Instagram")
|
|
50
|
+
parser.add_argument("--view", action="store_true", default=True, help="Ver perfil")
|
|
51
|
+
parser.add_argument("--json", action="store_true", help="Saída em JSON")
|
|
52
|
+
args = parser.parse_args()
|
|
53
|
+
|
|
54
|
+
asyncio.run(view_profile(as_json=args.json))
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
if __name__ == "__main__":
|
|
58
|
+
main()
|
|
@@ -0,0 +1,449 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Publicação de conteúdo no Instagram.
|
|
3
|
+
|
|
4
|
+
Suporta: foto, vídeo, reel, story, carrossel.
|
|
5
|
+
Upload local automático via Imgur.
|
|
6
|
+
Pipeline de conteúdo: draft → approved → published.
|
|
7
|
+
|
|
8
|
+
Uso:
|
|
9
|
+
python scripts/publish.py --type photo --image foto.jpg --caption "Texto"
|
|
10
|
+
python scripts/publish.py --type video --video video.mp4 --caption "Vídeo"
|
|
11
|
+
python scripts/publish.py --type reel --video reel.mp4 --caption "Reel!"
|
|
12
|
+
python scripts/publish.py --type story --image story.jpg
|
|
13
|
+
python scripts/publish.py --type carousel --images img1.jpg img2.jpg --caption "Carrossel"
|
|
14
|
+
python scripts/publish.py --type photo --image foto.jpg --caption "Texto" --draft
|
|
15
|
+
python scripts/publish.py --approve --id 5
|
|
16
|
+
python scripts/publish.py --template promo --vars produto=Tênis desconto=30 --type photo --image foto.jpg
|
|
17
|
+
python scripts/publish.py --confirm yes --action-id abc123
|
|
18
|
+
"""
|
|
19
|
+
from __future__ import annotations
|
|
20
|
+
|
|
21
|
+
import argparse
|
|
22
|
+
import asyncio
|
|
23
|
+
import json
|
|
24
|
+
import os
|
|
25
|
+
import sys
|
|
26
|
+
from pathlib import Path
|
|
27
|
+
from typing import Optional
|
|
28
|
+
|
|
29
|
+
sys.path.insert(0, str(Path(__file__).parent))
|
|
30
|
+
|
|
31
|
+
from api_client import InstagramAPI
|
|
32
|
+
from auth import auto_refresh_if_needed
|
|
33
|
+
from db import Database
|
|
34
|
+
from governance import GovernanceManager
|
|
35
|
+
|
|
36
|
+
db = Database()
|
|
37
|
+
db.init()
|
|
38
|
+
gov = GovernanceManager(db)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def _is_local_file(path: str) -> bool:
|
|
42
|
+
"""Verifica se é um arquivo local (não URL)."""
|
|
43
|
+
return not path.startswith(("http://", "https://")) and os.path.exists(path)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def _convert_to_jpeg(path: str) -> str:
|
|
47
|
+
"""Converte imagem para JPEG se necessário."""
|
|
48
|
+
if path.lower().endswith((".jpg", ".jpeg")):
|
|
49
|
+
return path
|
|
50
|
+
try:
|
|
51
|
+
from PIL import Image
|
|
52
|
+
img = Image.open(path)
|
|
53
|
+
if img.mode in ("RGBA", "P"):
|
|
54
|
+
img = img.convert("RGB")
|
|
55
|
+
jpeg_path = Path(path).with_suffix(".jpg")
|
|
56
|
+
img.save(str(jpeg_path), "JPEG", quality=95)
|
|
57
|
+
print(f"Convertido para JPEG: {jpeg_path}")
|
|
58
|
+
return str(jpeg_path)
|
|
59
|
+
except ImportError:
|
|
60
|
+
print("AVISO: Pillow não instalado. Não foi possível converter a imagem.")
|
|
61
|
+
return path
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
async def upload_if_local(api: InstagramAPI, path: str) -> str:
|
|
65
|
+
"""Se for arquivo local, faz upload no Imgur e retorna URL pública."""
|
|
66
|
+
if _is_local_file(path):
|
|
67
|
+
path = _convert_to_jpeg(path)
|
|
68
|
+
print(f"Fazendo upload de {path} para Imgur...")
|
|
69
|
+
url = await api.upload_to_imgur(path)
|
|
70
|
+
print(f"Upload concluído: {url}")
|
|
71
|
+
return url
|
|
72
|
+
return path
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
async def publish_photo(
|
|
76
|
+
api: InstagramAPI,
|
|
77
|
+
image: str,
|
|
78
|
+
caption: Optional[str] = None,
|
|
79
|
+
location_id: Optional[str] = None,
|
|
80
|
+
as_draft: bool = False,
|
|
81
|
+
) -> dict:
|
|
82
|
+
"""Publica uma foto."""
|
|
83
|
+
image_url = await upload_if_local(api, image)
|
|
84
|
+
|
|
85
|
+
if as_draft:
|
|
86
|
+
post_id = db.insert_post({
|
|
87
|
+
"account_id": api.account_id,
|
|
88
|
+
"media_type": "PHOTO",
|
|
89
|
+
"media_url": image_url,
|
|
90
|
+
"local_path": image if _is_local_file(image) else None,
|
|
91
|
+
"caption": caption,
|
|
92
|
+
"status": "draft",
|
|
93
|
+
})
|
|
94
|
+
return {"status": "draft", "post_id": post_id, "message": "Rascunho criado"}
|
|
95
|
+
|
|
96
|
+
# Confirmação
|
|
97
|
+
if gov.requires_confirmation("publish_photo"):
|
|
98
|
+
confirmation = gov.create_confirmation_request(
|
|
99
|
+
"publish_photo",
|
|
100
|
+
{"caption": caption, "image": image, "image_url": image_url},
|
|
101
|
+
api.account_id,
|
|
102
|
+
)
|
|
103
|
+
return confirmation
|
|
104
|
+
|
|
105
|
+
return await _do_publish_photo(api, image_url, caption, location_id, image)
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
async def _do_publish_photo(
|
|
109
|
+
api: InstagramAPI,
|
|
110
|
+
image_url: str,
|
|
111
|
+
caption: Optional[str],
|
|
112
|
+
location_id: Optional[str],
|
|
113
|
+
local_path: Optional[str] = None,
|
|
114
|
+
) -> dict:
|
|
115
|
+
"""Executa a publicação de foto (2-step)."""
|
|
116
|
+
# Step 1: Criar container
|
|
117
|
+
container = await api.create_media_container(
|
|
118
|
+
media_type="IMAGE",
|
|
119
|
+
image_url=image_url,
|
|
120
|
+
caption=caption,
|
|
121
|
+
location_id=location_id,
|
|
122
|
+
)
|
|
123
|
+
container_id = container["id"]
|
|
124
|
+
|
|
125
|
+
# Salvar no banco com status container_created (para recovery)
|
|
126
|
+
post_id = db.insert_post({
|
|
127
|
+
"account_id": api.account_id,
|
|
128
|
+
"media_type": "PHOTO",
|
|
129
|
+
"media_url": image_url,
|
|
130
|
+
"local_path": local_path,
|
|
131
|
+
"caption": caption,
|
|
132
|
+
"status": "container_created",
|
|
133
|
+
"ig_container_id": container_id,
|
|
134
|
+
})
|
|
135
|
+
|
|
136
|
+
# Step 2: Publicar
|
|
137
|
+
result = await api.publish_media(container_id)
|
|
138
|
+
ig_media_id = result.get("id")
|
|
139
|
+
|
|
140
|
+
# Buscar permalink
|
|
141
|
+
details = await api.get_media_details(ig_media_id)
|
|
142
|
+
permalink = details.get("permalink", "")
|
|
143
|
+
|
|
144
|
+
# Atualizar banco
|
|
145
|
+
db.update_post_status(
|
|
146
|
+
post_id, "published",
|
|
147
|
+
ig_media_id=ig_media_id,
|
|
148
|
+
permalink=permalink,
|
|
149
|
+
published_at=details.get("timestamp", ""),
|
|
150
|
+
)
|
|
151
|
+
|
|
152
|
+
gov.log_action(
|
|
153
|
+
"publish_photo",
|
|
154
|
+
params={"caption": caption, "image_url": image_url},
|
|
155
|
+
result={"ig_media_id": ig_media_id, "permalink": permalink},
|
|
156
|
+
account_id=api.account_id,
|
|
157
|
+
)
|
|
158
|
+
|
|
159
|
+
return {
|
|
160
|
+
"status": "published",
|
|
161
|
+
"ig_media_id": ig_media_id,
|
|
162
|
+
"permalink": permalink,
|
|
163
|
+
"post_id": post_id,
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
async def publish_video(
|
|
168
|
+
api: InstagramAPI,
|
|
169
|
+
video: str,
|
|
170
|
+
caption: Optional[str] = None,
|
|
171
|
+
media_type: str = "VIDEO",
|
|
172
|
+
cover_url: Optional[str] = None,
|
|
173
|
+
as_draft: bool = False,
|
|
174
|
+
) -> dict:
|
|
175
|
+
"""Publica vídeo, reel ou story de vídeo."""
|
|
176
|
+
video_url = await upload_if_local(api, video)
|
|
177
|
+
|
|
178
|
+
if as_draft:
|
|
179
|
+
post_id = db.insert_post({
|
|
180
|
+
"account_id": api.account_id,
|
|
181
|
+
"media_type": media_type.upper(),
|
|
182
|
+
"media_url": video_url,
|
|
183
|
+
"local_path": video if _is_local_file(video) else None,
|
|
184
|
+
"caption": caption,
|
|
185
|
+
"status": "draft",
|
|
186
|
+
})
|
|
187
|
+
return {"status": "draft", "post_id": post_id}
|
|
188
|
+
|
|
189
|
+
action_name = f"publish_{media_type.lower()}"
|
|
190
|
+
if gov.requires_confirmation(action_name):
|
|
191
|
+
return gov.create_confirmation_request(
|
|
192
|
+
action_name,
|
|
193
|
+
{"caption": caption, "video": video, "type": media_type},
|
|
194
|
+
api.account_id,
|
|
195
|
+
)
|
|
196
|
+
|
|
197
|
+
# Step 1: Container
|
|
198
|
+
ig_type = {"VIDEO": "VIDEO", "REEL": "REELS", "STORY": "STORIES"}[media_type.upper()]
|
|
199
|
+
container = await api.create_media_container(
|
|
200
|
+
media_type=ig_type,
|
|
201
|
+
video_url=video_url,
|
|
202
|
+
caption=caption,
|
|
203
|
+
cover_url=cover_url,
|
|
204
|
+
)
|
|
205
|
+
container_id = container["id"]
|
|
206
|
+
|
|
207
|
+
post_id = db.insert_post({
|
|
208
|
+
"account_id": api.account_id,
|
|
209
|
+
"media_type": media_type.upper(),
|
|
210
|
+
"media_url": video_url,
|
|
211
|
+
"caption": caption,
|
|
212
|
+
"status": "container_created",
|
|
213
|
+
"ig_container_id": container_id,
|
|
214
|
+
})
|
|
215
|
+
|
|
216
|
+
# Aguardar processamento do vídeo
|
|
217
|
+
print("Aguardando processamento do vídeo...")
|
|
218
|
+
for _ in range(60): # max 5 min (60 * 5s)
|
|
219
|
+
status = await api.check_container_status(container_id)
|
|
220
|
+
code = status.get("status_code", "")
|
|
221
|
+
if code == "FINISHED":
|
|
222
|
+
break
|
|
223
|
+
if code == "ERROR":
|
|
224
|
+
error_msg = status.get("status", "Erro desconhecido")
|
|
225
|
+
db.update_post_status(post_id, "failed", error_msg=error_msg)
|
|
226
|
+
return {"status": "failed", "error": error_msg}
|
|
227
|
+
await asyncio.sleep(5)
|
|
228
|
+
|
|
229
|
+
# Step 2: Publicar
|
|
230
|
+
result = await api.publish_media(container_id)
|
|
231
|
+
ig_media_id = result.get("id")
|
|
232
|
+
details = await api.get_media_details(ig_media_id)
|
|
233
|
+
permalink = details.get("permalink", "")
|
|
234
|
+
|
|
235
|
+
db.update_post_status(
|
|
236
|
+
post_id, "published",
|
|
237
|
+
ig_media_id=ig_media_id,
|
|
238
|
+
permalink=permalink,
|
|
239
|
+
published_at=details.get("timestamp", ""),
|
|
240
|
+
)
|
|
241
|
+
|
|
242
|
+
gov.log_action(
|
|
243
|
+
action_name,
|
|
244
|
+
params={"caption": caption, "type": media_type},
|
|
245
|
+
result={"ig_media_id": ig_media_id, "permalink": permalink},
|
|
246
|
+
account_id=api.account_id,
|
|
247
|
+
)
|
|
248
|
+
|
|
249
|
+
return {"status": "published", "ig_media_id": ig_media_id, "permalink": permalink}
|
|
250
|
+
|
|
251
|
+
|
|
252
|
+
async def publish_carousel(
|
|
253
|
+
api: InstagramAPI,
|
|
254
|
+
images: list,
|
|
255
|
+
caption: Optional[str] = None,
|
|
256
|
+
as_draft: bool = False,
|
|
257
|
+
) -> dict:
|
|
258
|
+
"""Publica carrossel de imagens."""
|
|
259
|
+
if len(images) < 2 or len(images) > 10:
|
|
260
|
+
return {"status": "error", "message": "Carrossel precisa de 2-10 imagens"}
|
|
261
|
+
|
|
262
|
+
if as_draft:
|
|
263
|
+
post_id = db.insert_post({
|
|
264
|
+
"account_id": api.account_id,
|
|
265
|
+
"media_type": "CAROUSEL",
|
|
266
|
+
"caption": caption,
|
|
267
|
+
"status": "draft",
|
|
268
|
+
})
|
|
269
|
+
return {"status": "draft", "post_id": post_id}
|
|
270
|
+
|
|
271
|
+
if gov.requires_confirmation("publish_carousel"):
|
|
272
|
+
return gov.create_confirmation_request(
|
|
273
|
+
"publish_carousel",
|
|
274
|
+
{"caption": caption, "images": images, "count": len(images)},
|
|
275
|
+
api.account_id,
|
|
276
|
+
)
|
|
277
|
+
|
|
278
|
+
# Upload cada imagem e criar containers filhos
|
|
279
|
+
children_ids = []
|
|
280
|
+
for img in images:
|
|
281
|
+
img_url = await upload_if_local(api, img)
|
|
282
|
+
child = await api.create_media_container(
|
|
283
|
+
media_type="IMAGE", image_url=img_url, is_carousel_item=True,
|
|
284
|
+
)
|
|
285
|
+
children_ids.append(child["id"])
|
|
286
|
+
|
|
287
|
+
# Container do carrossel
|
|
288
|
+
container = await api.create_media_container(
|
|
289
|
+
media_type="CAROUSEL", caption=caption, children=children_ids,
|
|
290
|
+
)
|
|
291
|
+
container_id = container["id"]
|
|
292
|
+
|
|
293
|
+
post_id = db.insert_post({
|
|
294
|
+
"account_id": api.account_id,
|
|
295
|
+
"media_type": "CAROUSEL",
|
|
296
|
+
"caption": caption,
|
|
297
|
+
"status": "container_created",
|
|
298
|
+
"ig_container_id": container_id,
|
|
299
|
+
})
|
|
300
|
+
|
|
301
|
+
# Publicar
|
|
302
|
+
result = await api.publish_media(container_id)
|
|
303
|
+
ig_media_id = result.get("id")
|
|
304
|
+
details = await api.get_media_details(ig_media_id)
|
|
305
|
+
permalink = details.get("permalink", "")
|
|
306
|
+
|
|
307
|
+
db.update_post_status(
|
|
308
|
+
post_id, "published",
|
|
309
|
+
ig_media_id=ig_media_id, permalink=permalink,
|
|
310
|
+
published_at=details.get("timestamp", ""),
|
|
311
|
+
)
|
|
312
|
+
|
|
313
|
+
gov.log_action(
|
|
314
|
+
"publish_carousel",
|
|
315
|
+
params={"caption": caption, "images_count": len(images)},
|
|
316
|
+
result={"ig_media_id": ig_media_id, "permalink": permalink},
|
|
317
|
+
account_id=api.account_id,
|
|
318
|
+
)
|
|
319
|
+
|
|
320
|
+
return {"status": "published", "ig_media_id": ig_media_id, "permalink": permalink}
|
|
321
|
+
|
|
322
|
+
|
|
323
|
+
async def approve_post(post_id: int) -> dict:
|
|
324
|
+
"""Aprova um rascunho para publicação."""
|
|
325
|
+
post = db.get_post_by_id(post_id)
|
|
326
|
+
if not post:
|
|
327
|
+
return {"status": "error", "message": f"Post {post_id} não encontrado"}
|
|
328
|
+
if post["status"] != "draft":
|
|
329
|
+
return {"status": "error", "message": f"Post {post_id} não é rascunho (status: {post['status']})"}
|
|
330
|
+
db.update_post_status(post_id, "approved")
|
|
331
|
+
return {"status": "approved", "post_id": post_id, "message": "Post aprovado. Use schedule.py --process para publicar."}
|
|
332
|
+
|
|
333
|
+
|
|
334
|
+
async def do_confirmed_publish(
|
|
335
|
+
action: str, details: dict,
|
|
336
|
+
) -> dict:
|
|
337
|
+
"""Executa publicação após confirmação do usuário."""
|
|
338
|
+
await auto_refresh_if_needed()
|
|
339
|
+
api = InstagramAPI()
|
|
340
|
+
|
|
341
|
+
try:
|
|
342
|
+
if action == "publish_photo":
|
|
343
|
+
result = await _do_publish_photo(
|
|
344
|
+
api,
|
|
345
|
+
details.get("image_url", ""),
|
|
346
|
+
details.get("caption"),
|
|
347
|
+
details.get("location_id"),
|
|
348
|
+
details.get("local_path"),
|
|
349
|
+
)
|
|
350
|
+
else:
|
|
351
|
+
result = {"status": "error", "message": f"Ação confirmada não reconhecida: {action}"}
|
|
352
|
+
finally:
|
|
353
|
+
await api.close()
|
|
354
|
+
|
|
355
|
+
return result
|
|
356
|
+
|
|
357
|
+
|
|
358
|
+
def _apply_template(caption: str, variables: dict) -> str:
|
|
359
|
+
"""Aplica variáveis a um template de caption."""
|
|
360
|
+
try:
|
|
361
|
+
return caption.format(**variables)
|
|
362
|
+
except KeyError as e:
|
|
363
|
+
print(f"AVISO: Variável {e} não fornecida no template")
|
|
364
|
+
return caption
|
|
365
|
+
|
|
366
|
+
|
|
367
|
+
async def run(args) -> None:
|
|
368
|
+
await auto_refresh_if_needed()
|
|
369
|
+
|
|
370
|
+
# Aprovar post
|
|
371
|
+
if args.approve:
|
|
372
|
+
result = await approve_post(args.id)
|
|
373
|
+
print(json.dumps(result, indent=2, ensure_ascii=False))
|
|
374
|
+
return
|
|
375
|
+
|
|
376
|
+
# Publicação confirmada
|
|
377
|
+
if args.confirm:
|
|
378
|
+
result = await do_confirmed_publish(args.confirm_action or "", args.__dict__)
|
|
379
|
+
print(json.dumps(result, indent=2, ensure_ascii=False))
|
|
380
|
+
return
|
|
381
|
+
|
|
382
|
+
api = InstagramAPI()
|
|
383
|
+
|
|
384
|
+
try:
|
|
385
|
+
caption = args.caption
|
|
386
|
+
|
|
387
|
+
# Aplicar template se especificado
|
|
388
|
+
if args.template:
|
|
389
|
+
from db import Database
|
|
390
|
+
tpl = Database().get_template_by_name(args.template)
|
|
391
|
+
if tpl:
|
|
392
|
+
caption = tpl["caption_template"]
|
|
393
|
+
if tpl.get("hashtag_set"):
|
|
394
|
+
hashtags = json.loads(tpl["hashtag_set"]) if isinstance(tpl["hashtag_set"], str) else tpl["hashtag_set"]
|
|
395
|
+
caption = f"{caption}\n\n{' '.join(hashtags)}"
|
|
396
|
+
if args.vars:
|
|
397
|
+
variables = dict(v.split("=", 1) for v in args.vars)
|
|
398
|
+
caption = _apply_template(caption, variables)
|
|
399
|
+
|
|
400
|
+
media_type = args.type.upper()
|
|
401
|
+
|
|
402
|
+
if media_type == "PHOTO":
|
|
403
|
+
result = await publish_photo(api, args.image, caption, as_draft=args.draft)
|
|
404
|
+
elif media_type in ("VIDEO", "REEL", "STORY"):
|
|
405
|
+
media = args.video or args.image
|
|
406
|
+
if not media:
|
|
407
|
+
print("ERRO: --video ou --image é obrigatório")
|
|
408
|
+
return
|
|
409
|
+
result = await publish_video(api, media, caption, media_type=media_type, as_draft=args.draft)
|
|
410
|
+
elif media_type == "CAROUSEL":
|
|
411
|
+
if not args.images or len(args.images) < 2:
|
|
412
|
+
print("ERRO: --images precisa de 2-10 arquivos")
|
|
413
|
+
return
|
|
414
|
+
result = await publish_carousel(api, args.images, caption, as_draft=args.draft)
|
|
415
|
+
else:
|
|
416
|
+
result = {"status": "error", "message": f"Tipo desconhecido: {args.type}"}
|
|
417
|
+
|
|
418
|
+
print(json.dumps(result, indent=2, ensure_ascii=False))
|
|
419
|
+
|
|
420
|
+
finally:
|
|
421
|
+
await api.close()
|
|
422
|
+
|
|
423
|
+
|
|
424
|
+
def main():
|
|
425
|
+
parser = argparse.ArgumentParser(description="Publicar no Instagram")
|
|
426
|
+
parser.add_argument("--type", choices=["photo", "video", "reel", "story", "carousel"],
|
|
427
|
+
help="Tipo de conteúdo")
|
|
428
|
+
parser.add_argument("--image", help="Caminho da imagem ou URL")
|
|
429
|
+
parser.add_argument("--video", help="Caminho do vídeo ou URL")
|
|
430
|
+
parser.add_argument("--images", nargs="+", help="Imagens do carrossel")
|
|
431
|
+
parser.add_argument("--caption", help="Legenda do post")
|
|
432
|
+
parser.add_argument("--draft", action="store_true", help="Criar como rascunho")
|
|
433
|
+
parser.add_argument("--approve", action="store_true", help="Aprovar rascunho")
|
|
434
|
+
parser.add_argument("--id", type=int, help="ID do post (para --approve)")
|
|
435
|
+
parser.add_argument("--template", help="Nome do template a usar")
|
|
436
|
+
parser.add_argument("--vars", nargs="+", help="Variáveis do template (key=value)")
|
|
437
|
+
parser.add_argument("--confirm", help="Confirmar ação (yes/no)")
|
|
438
|
+
parser.add_argument("--confirm-action", dest="confirm_action", help="Ação a confirmar")
|
|
439
|
+
parser.add_argument("--action-id", help="ID da ação a confirmar")
|
|
440
|
+
args = parser.parse_args()
|
|
441
|
+
|
|
442
|
+
if not args.approve and not args.confirm and not args.type:
|
|
443
|
+
parser.error("--type é obrigatório para publicação")
|
|
444
|
+
|
|
445
|
+
asyncio.run(run(args))
|
|
446
|
+
|
|
447
|
+
|
|
448
|
+
if __name__ == "__main__":
|
|
449
|
+
main()
|