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,444 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Cliente da Instagram Graph API com retry, rate limiting e logging integrados.
|
|
3
|
+
|
|
4
|
+
Uso:
|
|
5
|
+
from api_client import InstagramAPI
|
|
6
|
+
|
|
7
|
+
api = InstagramAPI()
|
|
8
|
+
profile = await api.get_user_profile()
|
|
9
|
+
media = await api.get_user_media(limit=10)
|
|
10
|
+
await api.close()
|
|
11
|
+
"""
|
|
12
|
+
from __future__ import annotations
|
|
13
|
+
|
|
14
|
+
import asyncio
|
|
15
|
+
import json
|
|
16
|
+
import logging
|
|
17
|
+
import sys
|
|
18
|
+
from pathlib import Path
|
|
19
|
+
from typing import Any, Dict, List, Optional
|
|
20
|
+
|
|
21
|
+
sys.path.insert(0, str(Path(__file__).parent))
|
|
22
|
+
|
|
23
|
+
import httpx
|
|
24
|
+
|
|
25
|
+
from config import (
|
|
26
|
+
GRAPH_API_BASE,
|
|
27
|
+
IMGUR_CLIENT_ID,
|
|
28
|
+
IMGUR_UPLOAD_URL,
|
|
29
|
+
MAX_RETRIES,
|
|
30
|
+
REQUEST_TIMEOUT,
|
|
31
|
+
RETRY_BACKOFF_BASE,
|
|
32
|
+
)
|
|
33
|
+
from db import Database
|
|
34
|
+
from governance import GovernanceManager, RateLimitExceeded
|
|
35
|
+
|
|
36
|
+
logger = logging.getLogger(__name__)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
class InstagramAPIError(Exception):
|
|
40
|
+
"""Erro da Instagram Graph API."""
|
|
41
|
+
|
|
42
|
+
def __init__(self, message: str, code: Optional[int] = None, subcode: Optional[int] = None):
|
|
43
|
+
self.code = code
|
|
44
|
+
self.subcode = subcode
|
|
45
|
+
super().__init__(message)
|
|
46
|
+
|
|
47
|
+
def is_rate_limit(self) -> bool:
|
|
48
|
+
return self.code in (4, 17, 32)
|
|
49
|
+
|
|
50
|
+
def is_permission_error(self) -> bool:
|
|
51
|
+
return self.code in (10, 200, 190)
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
class InstagramAPI:
|
|
55
|
+
"""Wrapper da Instagram Graph API com governança integrada."""
|
|
56
|
+
|
|
57
|
+
def __init__(
|
|
58
|
+
self,
|
|
59
|
+
account_id: Optional[int] = None,
|
|
60
|
+
db: Optional[Database] = None,
|
|
61
|
+
governance: Optional[GovernanceManager] = None,
|
|
62
|
+
):
|
|
63
|
+
self._db = db or Database()
|
|
64
|
+
self._db.init()
|
|
65
|
+
self._gov = governance or GovernanceManager(self._db)
|
|
66
|
+
self._client: Optional[httpx.AsyncClient] = None
|
|
67
|
+
|
|
68
|
+
# Carregar conta
|
|
69
|
+
if account_id:
|
|
70
|
+
self._account = self._db.get_account_by_id(account_id)
|
|
71
|
+
else:
|
|
72
|
+
self._account = self._db.get_active_account()
|
|
73
|
+
|
|
74
|
+
if not self._account:
|
|
75
|
+
raise ValueError(
|
|
76
|
+
"Nenhuma conta Instagram configurada. Execute: python scripts/auth.py --setup"
|
|
77
|
+
)
|
|
78
|
+
|
|
79
|
+
self.account_id = self._account["id"]
|
|
80
|
+
self.ig_user_id = self._account["ig_user_id"]
|
|
81
|
+
self.access_token = self._account["access_token"]
|
|
82
|
+
|
|
83
|
+
async def _get_client(self) -> httpx.AsyncClient:
|
|
84
|
+
if self._client is None or self._client.is_closed:
|
|
85
|
+
self._client = httpx.AsyncClient(timeout=REQUEST_TIMEOUT)
|
|
86
|
+
return self._client
|
|
87
|
+
|
|
88
|
+
async def close(self) -> None:
|
|
89
|
+
if self._client and not self._client.is_closed:
|
|
90
|
+
await self._client.aclose()
|
|
91
|
+
|
|
92
|
+
# ── Core Request ──────────────────────────────────────────────────────────
|
|
93
|
+
|
|
94
|
+
async def _request(
|
|
95
|
+
self,
|
|
96
|
+
method: str,
|
|
97
|
+
endpoint: str,
|
|
98
|
+
params: Optional[Dict] = None,
|
|
99
|
+
data: Optional[Dict] = None,
|
|
100
|
+
action_name: str = "api_call",
|
|
101
|
+
) -> Dict[str, Any]:
|
|
102
|
+
"""
|
|
103
|
+
Faz request à Graph API com retry, rate limiting e logging.
|
|
104
|
+
"""
|
|
105
|
+
# Verificar rate limit
|
|
106
|
+
self._gov.check_rate_limit(action_name, self.account_id)
|
|
107
|
+
|
|
108
|
+
url = f"{GRAPH_API_BASE}/{endpoint}" if not endpoint.startswith("http") else endpoint
|
|
109
|
+
params = params or {}
|
|
110
|
+
params["access_token"] = self.access_token
|
|
111
|
+
|
|
112
|
+
client = await self._get_client()
|
|
113
|
+
|
|
114
|
+
for attempt in range(1, MAX_RETRIES + 1):
|
|
115
|
+
try:
|
|
116
|
+
if method.upper() == "POST":
|
|
117
|
+
resp = await client.post(url, params=params, data=data)
|
|
118
|
+
elif method.upper() == "DELETE":
|
|
119
|
+
resp = await client.delete(url, params=params)
|
|
120
|
+
else:
|
|
121
|
+
resp = await client.get(url, params=params)
|
|
122
|
+
|
|
123
|
+
# Parse response
|
|
124
|
+
result = resp.json()
|
|
125
|
+
|
|
126
|
+
# Verificar erro da API
|
|
127
|
+
if "error" in result:
|
|
128
|
+
error = result["error"]
|
|
129
|
+
api_error = InstagramAPIError(
|
|
130
|
+
message=error.get("message", "Unknown error"),
|
|
131
|
+
code=error.get("code"),
|
|
132
|
+
subcode=error.get("error_subcode"),
|
|
133
|
+
)
|
|
134
|
+
if api_error.is_rate_limit():
|
|
135
|
+
logger.warning("Rate limit da API atingido (code %s). Aguardando...", api_error.code)
|
|
136
|
+
if attempt < MAX_RETRIES:
|
|
137
|
+
await asyncio.sleep(60) # espera 1 min para rate limits da API
|
|
138
|
+
continue
|
|
139
|
+
if api_error.is_permission_error():
|
|
140
|
+
raise api_error # não faz retry para erros de permissão
|
|
141
|
+
if attempt < MAX_RETRIES:
|
|
142
|
+
await asyncio.sleep(RETRY_BACKOFF_BASE ** attempt)
|
|
143
|
+
continue
|
|
144
|
+
raise api_error
|
|
145
|
+
|
|
146
|
+
resp.raise_for_status()
|
|
147
|
+
|
|
148
|
+
# Log da ação
|
|
149
|
+
self._gov.log_action(
|
|
150
|
+
action=action_name,
|
|
151
|
+
params={"endpoint": endpoint, "method": method},
|
|
152
|
+
result={"status": resp.status_code},
|
|
153
|
+
account_id=self.account_id,
|
|
154
|
+
)
|
|
155
|
+
|
|
156
|
+
return result
|
|
157
|
+
|
|
158
|
+
except httpx.HTTPStatusError as exc:
|
|
159
|
+
logger.warning(
|
|
160
|
+
"HTTP %s em %s (tentativa %d/%d)",
|
|
161
|
+
exc.response.status_code, url, attempt, MAX_RETRIES,
|
|
162
|
+
)
|
|
163
|
+
if attempt < MAX_RETRIES:
|
|
164
|
+
await asyncio.sleep(RETRY_BACKOFF_BASE ** attempt)
|
|
165
|
+
else:
|
|
166
|
+
raise
|
|
167
|
+
|
|
168
|
+
except (httpx.RequestError, httpx.TimeoutException) as exc:
|
|
169
|
+
logger.warning(
|
|
170
|
+
"Erro de request em %s: %s (tentativa %d/%d)",
|
|
171
|
+
url, exc, attempt, MAX_RETRIES,
|
|
172
|
+
)
|
|
173
|
+
if attempt < MAX_RETRIES:
|
|
174
|
+
await asyncio.sleep(RETRY_BACKOFF_BASE ** attempt)
|
|
175
|
+
else:
|
|
176
|
+
raise
|
|
177
|
+
|
|
178
|
+
raise InstagramAPIError("Falha após todas as tentativas")
|
|
179
|
+
|
|
180
|
+
async def get(self, endpoint: str, params: Optional[Dict] = None, action: str = "api_get") -> Dict:
|
|
181
|
+
return await self._request("GET", endpoint, params=params, action_name=action)
|
|
182
|
+
|
|
183
|
+
async def post(self, endpoint: str, data: Optional[Dict] = None, params: Optional[Dict] = None, action: str = "api_post") -> Dict:
|
|
184
|
+
return await self._request("POST", endpoint, params=params, data=data, action_name=action)
|
|
185
|
+
|
|
186
|
+
async def delete(self, endpoint: str, params: Optional[Dict] = None, action: str = "api_delete") -> Dict:
|
|
187
|
+
return await self._request("DELETE", endpoint, params=params, action_name=action)
|
|
188
|
+
|
|
189
|
+
# ── User / Profile ────────────────────────────────────────────────────────
|
|
190
|
+
|
|
191
|
+
async def get_user_profile(self) -> Dict[str, Any]:
|
|
192
|
+
"""Busca informações do perfil da conta Instagram."""
|
|
193
|
+
return await self.get(
|
|
194
|
+
f"{self.ig_user_id}",
|
|
195
|
+
params={
|
|
196
|
+
"fields": "id,username,name,account_type,profile_picture_url,"
|
|
197
|
+
"biography,followers_count,follows_count,media_count,website",
|
|
198
|
+
},
|
|
199
|
+
action="get_profile",
|
|
200
|
+
)
|
|
201
|
+
|
|
202
|
+
# ── Media ─────────────────────────────────────────────────────────────────
|
|
203
|
+
|
|
204
|
+
async def get_user_media(
|
|
205
|
+
self, limit: int = 25, after: Optional[str] = None,
|
|
206
|
+
) -> Dict[str, Any]:
|
|
207
|
+
"""Lista mídia do usuário com paginação."""
|
|
208
|
+
params = {
|
|
209
|
+
"fields": "id,caption,media_type,media_url,thumbnail_url,permalink,"
|
|
210
|
+
"timestamp,like_count,comments_count",
|
|
211
|
+
"limit": str(limit),
|
|
212
|
+
}
|
|
213
|
+
if after:
|
|
214
|
+
params["after"] = after
|
|
215
|
+
return await self.get(f"{self.ig_user_id}/media", params=params, action="get_media")
|
|
216
|
+
|
|
217
|
+
async def get_media_details(self, media_id: str) -> Dict[str, Any]:
|
|
218
|
+
"""Busca detalhes de uma mídia específica."""
|
|
219
|
+
return await self.get(
|
|
220
|
+
media_id,
|
|
221
|
+
params={
|
|
222
|
+
"fields": "id,caption,media_type,media_url,thumbnail_url,permalink,"
|
|
223
|
+
"timestamp,like_count,comments_count,children{id,media_type,media_url}",
|
|
224
|
+
},
|
|
225
|
+
action="get_media_details",
|
|
226
|
+
)
|
|
227
|
+
|
|
228
|
+
# ── Publishing (2-step) ───────────────────────────────────────────────────
|
|
229
|
+
|
|
230
|
+
async def create_media_container(
|
|
231
|
+
self,
|
|
232
|
+
media_type: str = "IMAGE",
|
|
233
|
+
image_url: Optional[str] = None,
|
|
234
|
+
video_url: Optional[str] = None,
|
|
235
|
+
caption: Optional[str] = None,
|
|
236
|
+
location_id: Optional[str] = None,
|
|
237
|
+
user_tags: Optional[List[Dict]] = None,
|
|
238
|
+
is_carousel_item: bool = False,
|
|
239
|
+
cover_url: Optional[str] = None,
|
|
240
|
+
share_to_feed: bool = True,
|
|
241
|
+
children: Optional[List[str]] = None,
|
|
242
|
+
) -> Dict[str, Any]:
|
|
243
|
+
"""Cria container de mídia (step 1 do publish)."""
|
|
244
|
+
data: Dict[str, Any] = {}
|
|
245
|
+
|
|
246
|
+
if media_type == "IMAGE":
|
|
247
|
+
data["image_url"] = image_url
|
|
248
|
+
elif media_type == "VIDEO":
|
|
249
|
+
data["media_type"] = "VIDEO"
|
|
250
|
+
data["video_url"] = video_url
|
|
251
|
+
elif media_type == "REELS":
|
|
252
|
+
data["media_type"] = "REELS"
|
|
253
|
+
data["video_url"] = video_url
|
|
254
|
+
if cover_url:
|
|
255
|
+
data["cover_url"] = cover_url
|
|
256
|
+
data["share_to_feed"] = str(share_to_feed).lower()
|
|
257
|
+
elif media_type == "STORIES":
|
|
258
|
+
if image_url:
|
|
259
|
+
data["image_url"] = image_url
|
|
260
|
+
elif video_url:
|
|
261
|
+
data["video_url"] = video_url
|
|
262
|
+
data["media_type"] = "VIDEO"
|
|
263
|
+
elif media_type == "CAROUSEL":
|
|
264
|
+
data["media_type"] = "CAROUSEL"
|
|
265
|
+
if children:
|
|
266
|
+
data["children"] = ",".join(children)
|
|
267
|
+
|
|
268
|
+
if caption and not is_carousel_item:
|
|
269
|
+
data["caption"] = caption
|
|
270
|
+
if location_id:
|
|
271
|
+
data["location_id"] = location_id
|
|
272
|
+
if user_tags:
|
|
273
|
+
data["user_tags"] = json.dumps(user_tags)
|
|
274
|
+
if is_carousel_item:
|
|
275
|
+
data["is_carousel_item"] = "true"
|
|
276
|
+
|
|
277
|
+
return await self.post(
|
|
278
|
+
f"{self.ig_user_id}/media",
|
|
279
|
+
data=data,
|
|
280
|
+
action=f"create_container_{media_type.lower()}",
|
|
281
|
+
)
|
|
282
|
+
|
|
283
|
+
async def check_container_status(self, container_id: str) -> Dict[str, Any]:
|
|
284
|
+
"""Verifica status de um container (usado para vídeos que precisam processar)."""
|
|
285
|
+
return await self.get(
|
|
286
|
+
container_id,
|
|
287
|
+
params={"fields": "status_code,status"},
|
|
288
|
+
action="check_container",
|
|
289
|
+
)
|
|
290
|
+
|
|
291
|
+
async def publish_media(self, container_id: str) -> Dict[str, Any]:
|
|
292
|
+
"""Publica um container (step 2 do publish)."""
|
|
293
|
+
return await self.post(
|
|
294
|
+
f"{self.ig_user_id}/media_publish",
|
|
295
|
+
data={"creation_id": container_id},
|
|
296
|
+
action="publish_media",
|
|
297
|
+
)
|
|
298
|
+
|
|
299
|
+
# ── Comments ──────────────────────────────────────────────────────────────
|
|
300
|
+
|
|
301
|
+
async def get_comments(
|
|
302
|
+
self, media_id: str, limit: int = 50, after: Optional[str] = None,
|
|
303
|
+
) -> Dict[str, Any]:
|
|
304
|
+
params = {
|
|
305
|
+
"fields": "id,text,username,timestamp,replies{id,text,username,timestamp}",
|
|
306
|
+
"limit": str(limit),
|
|
307
|
+
}
|
|
308
|
+
if after:
|
|
309
|
+
params["after"] = after
|
|
310
|
+
return await self.get(f"{media_id}/comments", params=params, action="get_comments")
|
|
311
|
+
|
|
312
|
+
async def reply_to_comment(self, comment_id: str, text: str) -> Dict[str, Any]:
|
|
313
|
+
return await self.post(
|
|
314
|
+
f"{comment_id}/replies",
|
|
315
|
+
data={"message": text},
|
|
316
|
+
action="reply_comment",
|
|
317
|
+
)
|
|
318
|
+
|
|
319
|
+
async def delete_comment(self, comment_id: str) -> Dict[str, Any]:
|
|
320
|
+
return await self.delete(comment_id, action="delete_comment")
|
|
321
|
+
|
|
322
|
+
async def get_mentions(self, limit: int = 25) -> Dict[str, Any]:
|
|
323
|
+
return await self.get(
|
|
324
|
+
f"{self.ig_user_id}/tags",
|
|
325
|
+
params={"fields": "id,caption,media_type,permalink,timestamp", "limit": str(limit)},
|
|
326
|
+
action="get_mentions",
|
|
327
|
+
)
|
|
328
|
+
|
|
329
|
+
# ── Insights ──────────────────────────────────────────────────────────────
|
|
330
|
+
|
|
331
|
+
async def get_media_insights(
|
|
332
|
+
self, media_id: str, metrics: Optional[List[str]] = None,
|
|
333
|
+
) -> Dict[str, Any]:
|
|
334
|
+
if not metrics:
|
|
335
|
+
metrics = ["impressions", "reach", "engagement", "saved", "shares"]
|
|
336
|
+
return await self.get(
|
|
337
|
+
f"{media_id}/insights",
|
|
338
|
+
params={"metric": ",".join(metrics)},
|
|
339
|
+
action="get_media_insights",
|
|
340
|
+
)
|
|
341
|
+
|
|
342
|
+
async def get_user_insights(
|
|
343
|
+
self,
|
|
344
|
+
period: str = "day",
|
|
345
|
+
metrics: Optional[List[str]] = None,
|
|
346
|
+
since: Optional[str] = None,
|
|
347
|
+
until: Optional[str] = None,
|
|
348
|
+
) -> Dict[str, Any]:
|
|
349
|
+
if not metrics:
|
|
350
|
+
metrics = ["impressions", "reach", "follower_count", "profile_views"]
|
|
351
|
+
params: Dict[str, str] = {
|
|
352
|
+
"metric": ",".join(metrics),
|
|
353
|
+
"period": period,
|
|
354
|
+
}
|
|
355
|
+
if since:
|
|
356
|
+
params["since"] = since
|
|
357
|
+
if until:
|
|
358
|
+
params["until"] = until
|
|
359
|
+
return await self.get(
|
|
360
|
+
f"{self.ig_user_id}/insights",
|
|
361
|
+
params=params,
|
|
362
|
+
action="get_user_insights",
|
|
363
|
+
)
|
|
364
|
+
|
|
365
|
+
# ── Hashtags ──────────────────────────────────────────────────────────────
|
|
366
|
+
|
|
367
|
+
async def search_hashtag(self, hashtag: str) -> Dict[str, Any]:
|
|
368
|
+
"""Busca o ID de uma hashtag."""
|
|
369
|
+
return await self.get(
|
|
370
|
+
"ig_hashtag_search",
|
|
371
|
+
params={"q": hashtag, "user_id": self.ig_user_id},
|
|
372
|
+
action="search_hashtag",
|
|
373
|
+
)
|
|
374
|
+
|
|
375
|
+
async def get_hashtag_recent_media(
|
|
376
|
+
self, hashtag_id: str, limit: int = 25,
|
|
377
|
+
) -> Dict[str, Any]:
|
|
378
|
+
return await self.get(
|
|
379
|
+
f"{hashtag_id}/recent_media",
|
|
380
|
+
params={
|
|
381
|
+
"user_id": self.ig_user_id,
|
|
382
|
+
"fields": "id,caption,media_type,permalink,timestamp,like_count,comments_count",
|
|
383
|
+
"limit": str(limit),
|
|
384
|
+
},
|
|
385
|
+
action="get_hashtag_media",
|
|
386
|
+
)
|
|
387
|
+
|
|
388
|
+
async def get_hashtag_top_media(
|
|
389
|
+
self, hashtag_id: str, limit: int = 25,
|
|
390
|
+
) -> Dict[str, Any]:
|
|
391
|
+
return await self.get(
|
|
392
|
+
f"{hashtag_id}/top_media",
|
|
393
|
+
params={
|
|
394
|
+
"user_id": self.ig_user_id,
|
|
395
|
+
"fields": "id,caption,media_type,permalink,timestamp,like_count,comments_count",
|
|
396
|
+
"limit": str(limit),
|
|
397
|
+
},
|
|
398
|
+
action="get_hashtag_top",
|
|
399
|
+
)
|
|
400
|
+
|
|
401
|
+
# ── Messaging ─────────────────────────────────────────────────────────────
|
|
402
|
+
|
|
403
|
+
async def send_message(self, recipient_id: str, text: str) -> Dict[str, Any]:
|
|
404
|
+
return await self.post(
|
|
405
|
+
f"{self.ig_user_id}/messages",
|
|
406
|
+
data={
|
|
407
|
+
"recipient": json.dumps({"id": recipient_id}),
|
|
408
|
+
"message": json.dumps({"text": text}),
|
|
409
|
+
},
|
|
410
|
+
action="send_dm",
|
|
411
|
+
)
|
|
412
|
+
|
|
413
|
+
async def get_conversations(self, limit: int = 20) -> Dict[str, Any]:
|
|
414
|
+
return await self.get(
|
|
415
|
+
f"{self.ig_user_id}/conversations",
|
|
416
|
+
params={
|
|
417
|
+
"fields": "id,participants,updated_time",
|
|
418
|
+
"limit": str(limit),
|
|
419
|
+
"platform": "instagram",
|
|
420
|
+
},
|
|
421
|
+
action="get_conversations",
|
|
422
|
+
)
|
|
423
|
+
|
|
424
|
+
# ── Imgur Upload (mídia local → URL pública) ──────────────────────────────
|
|
425
|
+
|
|
426
|
+
async def upload_to_imgur(self, file_path: str) -> str:
|
|
427
|
+
"""
|
|
428
|
+
Faz upload de arquivo local para o Imgur (anônimo).
|
|
429
|
+
Retorna a URL pública da imagem.
|
|
430
|
+
"""
|
|
431
|
+
client = await self._get_client()
|
|
432
|
+
with open(file_path, "rb") as f:
|
|
433
|
+
resp = await client.post(
|
|
434
|
+
IMGUR_UPLOAD_URL,
|
|
435
|
+
headers={"Authorization": f"Client-ID {IMGUR_CLIENT_ID}"},
|
|
436
|
+
files={"image": f},
|
|
437
|
+
)
|
|
438
|
+
resp.raise_for_status()
|
|
439
|
+
data = resp.json()
|
|
440
|
+
if data.get("success"):
|
|
441
|
+
url = data["data"]["link"]
|
|
442
|
+
logger.info("Upload Imgur: %s → %s", file_path, url)
|
|
443
|
+
return url
|
|
444
|
+
raise InstagramAPIError(f"Imgur upload falhou: {data}")
|