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,149 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Compressão inteligente e arquivamento de sessões antigas.
|
|
3
|
+
Mantém o histórico enxuto sem perder informação crítica.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
import shutil
|
|
7
|
+
from datetime import datetime
|
|
8
|
+
from pathlib import Path
|
|
9
|
+
|
|
10
|
+
from config import SESSIONS_DIR, ARCHIVE_DIR, ARCHIVE_AFTER_SESSIONS
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def should_archive(session_number: int, current_session: int) -> bool:
|
|
14
|
+
"""Verifica se uma sessão deve ser arquivada."""
|
|
15
|
+
return (current_session - session_number) > ARCHIVE_AFTER_SESSIONS
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def archive_session(session_path: Path):
|
|
19
|
+
"""Move sessão para archive/ com resumo compacto."""
|
|
20
|
+
ARCHIVE_DIR.mkdir(parents=True, exist_ok=True)
|
|
21
|
+
|
|
22
|
+
text = session_path.read_text(encoding="utf-8")
|
|
23
|
+
compressed = _compress_session(text)
|
|
24
|
+
|
|
25
|
+
archive_path = ARCHIVE_DIR / session_path.name
|
|
26
|
+
archive_path.write_text(compressed, encoding="utf-8")
|
|
27
|
+
|
|
28
|
+
session_path.unlink()
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def _compress_session(text: str) -> str:
|
|
32
|
+
"""Comprime uma sessão mantendo apenas informação essencial."""
|
|
33
|
+
lines = text.splitlines()
|
|
34
|
+
compressed = []
|
|
35
|
+
keep_sections = {
|
|
36
|
+
"tópicos", "decisões", "tarefas pendentes",
|
|
37
|
+
"descobertas", "erros resolvidos", "convenções",
|
|
38
|
+
}
|
|
39
|
+
skip_sections = {
|
|
40
|
+
"métricas", "arquivos modificados", "dívida técnica",
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
current_section = ""
|
|
44
|
+
keeping = True
|
|
45
|
+
|
|
46
|
+
for line in lines:
|
|
47
|
+
# Sempre manter cabeçalho
|
|
48
|
+
if line.startswith("# Sessão"):
|
|
49
|
+
compressed.append(line)
|
|
50
|
+
compressed.append("")
|
|
51
|
+
continue
|
|
52
|
+
|
|
53
|
+
if line.startswith("## "):
|
|
54
|
+
section_name = line[3:].strip().lower()
|
|
55
|
+
if section_name in skip_sections:
|
|
56
|
+
keeping = False
|
|
57
|
+
elif section_name in keep_sections:
|
|
58
|
+
keeping = True
|
|
59
|
+
compressed.append(line)
|
|
60
|
+
else:
|
|
61
|
+
keeping = False
|
|
62
|
+
current_section = section_name
|
|
63
|
+
continue
|
|
64
|
+
|
|
65
|
+
if keeping and line.strip():
|
|
66
|
+
compressed.append(line)
|
|
67
|
+
|
|
68
|
+
compressed.append("")
|
|
69
|
+
compressed.append("*[Sessão arquivada — detalhes completos removidos]*")
|
|
70
|
+
return "\n".join(compressed)
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
def compress_archive():
|
|
74
|
+
"""Consolida arquivos antigos em ARCHIVE_YYYY.md."""
|
|
75
|
+
if not ARCHIVE_DIR.exists():
|
|
76
|
+
return
|
|
77
|
+
|
|
78
|
+
year = datetime.now().strftime("%Y")
|
|
79
|
+
archive_files = sorted(ARCHIVE_DIR.glob("session-*.md"))
|
|
80
|
+
|
|
81
|
+
if len(archive_files) < 5:
|
|
82
|
+
return # Não vale consolidar com poucos arquivos
|
|
83
|
+
|
|
84
|
+
consolidated_path = ARCHIVE_DIR / f"ARCHIVE_{year}.md"
|
|
85
|
+
consolidated_lines = [
|
|
86
|
+
f"# Arquivo Consolidado — {year}",
|
|
87
|
+
"",
|
|
88
|
+
]
|
|
89
|
+
|
|
90
|
+
for af in archive_files:
|
|
91
|
+
text = af.read_text(encoding="utf-8")
|
|
92
|
+
# Extrair apenas título e decisões
|
|
93
|
+
session_header = ""
|
|
94
|
+
decisions = []
|
|
95
|
+
in_decisions = False
|
|
96
|
+
|
|
97
|
+
for line in text.splitlines():
|
|
98
|
+
if line.startswith("# Sessão"):
|
|
99
|
+
session_header = line
|
|
100
|
+
elif line.startswith("## Decisões"):
|
|
101
|
+
in_decisions = True
|
|
102
|
+
elif line.startswith("## "):
|
|
103
|
+
in_decisions = False
|
|
104
|
+
elif in_decisions and line.strip().startswith("- "):
|
|
105
|
+
decisions.append(line.strip())
|
|
106
|
+
|
|
107
|
+
if session_header:
|
|
108
|
+
consolidated_lines.append(f"### {session_header.lstrip('#').strip()}")
|
|
109
|
+
for d in decisions:
|
|
110
|
+
consolidated_lines.append(f" {d}")
|
|
111
|
+
consolidated_lines.append("")
|
|
112
|
+
|
|
113
|
+
af.unlink()
|
|
114
|
+
|
|
115
|
+
consolidated_path.write_text("\n".join(consolidated_lines), encoding="utf-8")
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
def auto_maintain(current_session: int):
|
|
119
|
+
"""Executa arquivamento e compressão automáticos."""
|
|
120
|
+
if not SESSIONS_DIR.exists():
|
|
121
|
+
return
|
|
122
|
+
|
|
123
|
+
# Arquivar sessões antigas
|
|
124
|
+
for session_file in sorted(SESSIONS_DIR.glob("session-*.md")):
|
|
125
|
+
try:
|
|
126
|
+
num = int(session_file.stem.split("-")[1])
|
|
127
|
+
except (IndexError, ValueError):
|
|
128
|
+
continue
|
|
129
|
+
|
|
130
|
+
if should_archive(num, current_session):
|
|
131
|
+
archive_session(session_file)
|
|
132
|
+
|
|
133
|
+
# Consolidar arquivo se necessário
|
|
134
|
+
compress_archive()
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
def get_archive_summary() -> str:
|
|
138
|
+
"""Retorna resumo do que está arquivado."""
|
|
139
|
+
if not ARCHIVE_DIR.exists():
|
|
140
|
+
return "Nenhuma sessão arquivada."
|
|
141
|
+
|
|
142
|
+
archive_files = list(ARCHIVE_DIR.glob("*.md"))
|
|
143
|
+
if not archive_files:
|
|
144
|
+
return "Nenhuma sessão arquivada."
|
|
145
|
+
|
|
146
|
+
lines = [f"Sessões arquivadas: {len(archive_files)} arquivo(s)"]
|
|
147
|
+
for af in sorted(archive_files):
|
|
148
|
+
lines.append(f" - {af.name}")
|
|
149
|
+
return "\n".join(lines)
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Configuração centralizada do Context Agent.
|
|
3
|
+
Todos os paths, constantes e limites usados pelos demais módulos.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
|
|
8
|
+
# ── Raízes ──────────────────────────────────────────────────────────
|
|
9
|
+
SKILLS_ROOT = Path(r"C:\Users\renat\skills")
|
|
10
|
+
CONTEXT_AGENT_ROOT = SKILLS_ROOT / "context-agent"
|
|
11
|
+
|
|
12
|
+
# ── Dados do agente ─────────────────────────────────────────────────
|
|
13
|
+
DATA_DIR = CONTEXT_AGENT_ROOT / "data"
|
|
14
|
+
SESSIONS_DIR = DATA_DIR / "sessions"
|
|
15
|
+
ARCHIVE_DIR = DATA_DIR / "archive"
|
|
16
|
+
LOGS_DIR = DATA_DIR / "logs"
|
|
17
|
+
ACTIVE_CONTEXT_PATH = DATA_DIR / "ACTIVE_CONTEXT.md"
|
|
18
|
+
PROJECT_REGISTRY_PATH = DATA_DIR / "PROJECT_REGISTRY.md"
|
|
19
|
+
DB_PATH = DATA_DIR / "context.db"
|
|
20
|
+
|
|
21
|
+
# ── Claude Code session logs ────────────────────────────────────────
|
|
22
|
+
CLAUDE_PROJECTS_DIR = Path(r"C:\Users\renat\.claude\projects")
|
|
23
|
+
CLAUDE_SESSION_DIR = CLAUDE_PROJECTS_DIR / "C--Users-renat-skills"
|
|
24
|
+
MEMORY_DIR = CLAUDE_SESSION_DIR / "memory"
|
|
25
|
+
MEMORY_MD_PATH = MEMORY_DIR / "MEMORY.md"
|
|
26
|
+
|
|
27
|
+
# ── Limites ─────────────────────────────────────────────────────────
|
|
28
|
+
MAX_ACTIVE_CONTEXT_LINES = 150 # MEMORY.md é truncado em 200 linhas
|
|
29
|
+
MAX_RECENT_SESSIONS = 5 # Sessões recentes carregadas no briefing
|
|
30
|
+
ARCHIVE_AFTER_SESSIONS = 20 # Arquivar sessões mais antigas que N
|
|
31
|
+
MAX_DECISIONS_AGE_DAYS = 30 # Decisões mais velhas são podadas
|
|
32
|
+
MAX_SEARCH_RESULTS = 10 # Resultados padrão de busca
|
|
33
|
+
|
|
34
|
+
# ── Padrões de detecção ────────────────────────────────────────────
|
|
35
|
+
# Palavras que indicam decisões no texto
|
|
36
|
+
DECISION_MARKERS_PT = [
|
|
37
|
+
"decidimos", "vamos usar", "optamos por", "escolhemos",
|
|
38
|
+
"a decisão foi", "ficou decidido", "definimos que",
|
|
39
|
+
"a abordagem será", "seguiremos com",
|
|
40
|
+
]
|
|
41
|
+
DECISION_MARKERS_EN = [
|
|
42
|
+
"we decided", "let's use", "we'll go with", "the decision is",
|
|
43
|
+
"we chose", "going with", "the approach will be", "decided to",
|
|
44
|
+
]
|
|
45
|
+
DECISION_MARKERS = DECISION_MARKERS_PT + DECISION_MARKERS_EN
|
|
46
|
+
|
|
47
|
+
# Palavras que indicam tarefas pendentes
|
|
48
|
+
PENDING_MARKERS_PT = [
|
|
49
|
+
"falta", "ainda precisa", "pendente", "todo:", "TODO:",
|
|
50
|
+
"depois vamos", "próximo passo", "faltando",
|
|
51
|
+
]
|
|
52
|
+
PENDING_MARKERS_EN = [
|
|
53
|
+
"todo:", "TODO:", "still need", "pending", "next step",
|
|
54
|
+
"remaining", "left to do", "needs to be done",
|
|
55
|
+
]
|
|
56
|
+
PENDING_MARKERS = PENDING_MARKERS_PT + PENDING_MARKERS_EN
|
|
57
|
+
|
|
58
|
+
# Ferramentas que modificam arquivos (para detectar files_modified)
|
|
59
|
+
FILE_MODIFYING_TOOLS = {"Edit", "Write", "NotebookEdit"}
|
|
60
|
+
FILE_READING_TOOLS = {"Read", "Glob", "Grep"}
|
|
61
|
+
|
|
62
|
+
# ── Projetos conhecidos ────────────────────────────────────────────
|
|
63
|
+
# Mapeamento de subdiretórios de SKILLS_ROOT para nomes de projeto
|
|
64
|
+
KNOWN_PROJECTS = {
|
|
65
|
+
"instagram": "Instagram Integration",
|
|
66
|
+
"juntas-comerciais": "Juntas Comerciais Scraper",
|
|
67
|
+
"whatsapp-cloud-api": "WhatsApp Cloud API",
|
|
68
|
+
"context-agent": "Context Agent",
|
|
69
|
+
}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Carrega contexto no início de uma nova sessão.
|
|
3
|
+
Gera briefings de diferentes níveis de detalhe.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
|
|
8
|
+
from config import SESSIONS_DIR, MAX_RECENT_SESSIONS
|
|
9
|
+
from models import SessionSummary
|
|
10
|
+
from active_context import load_active_context, ACTIVE_CONTEXT_PATH
|
|
11
|
+
from project_registry import load_registry, PROJECT_REGISTRY_PATH
|
|
12
|
+
from compressor import get_archive_summary
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def generate_briefing() -> str:
|
|
16
|
+
"""Gera briefing completo para início de sessão."""
|
|
17
|
+
sections = []
|
|
18
|
+
|
|
19
|
+
# 1. Cabeçalho
|
|
20
|
+
sections.append("# Briefing de Contexto")
|
|
21
|
+
sections.append("")
|
|
22
|
+
|
|
23
|
+
# 2. Contexto ativo
|
|
24
|
+
ctx = load_active_context()
|
|
25
|
+
if ctx.recent_sessions:
|
|
26
|
+
sections.append(f"**Total de sessões registradas:** {ctx.total_sessions}")
|
|
27
|
+
sections.append("")
|
|
28
|
+
|
|
29
|
+
# 3. Projetos ativos
|
|
30
|
+
projects = load_registry()
|
|
31
|
+
active_projects = [p for p in projects if p.status == "active"]
|
|
32
|
+
if active_projects:
|
|
33
|
+
sections.append("## Projetos Ativos")
|
|
34
|
+
for p in active_projects:
|
|
35
|
+
session_ref = f"session-{p.last_session:03d}" if p.last_session else "—"
|
|
36
|
+
actions = "; ".join(p.next_actions) if p.next_actions else "nenhuma definida"
|
|
37
|
+
sections.append(f"- **{p.name}** ({p.status}) — última: {session_ref} — próxima: {actions}")
|
|
38
|
+
sections.append("")
|
|
39
|
+
|
|
40
|
+
# 4. Tarefas pendentes de alta prioridade
|
|
41
|
+
high_tasks = [t for t in ctx.pending_tasks if t.priority == "high"]
|
|
42
|
+
if high_tasks:
|
|
43
|
+
sections.append("## Tarefas Pendentes (Alta Prioridade)")
|
|
44
|
+
for t in high_tasks:
|
|
45
|
+
src = f" (desde session-{t.source_session:03d})" if t.source_session else ""
|
|
46
|
+
sections.append(f"- {t.description}{src}")
|
|
47
|
+
sections.append("")
|
|
48
|
+
|
|
49
|
+
# 5. Todas as tarefas pendentes
|
|
50
|
+
other_tasks = [t for t in ctx.pending_tasks if t.priority != "high"]
|
|
51
|
+
if other_tasks:
|
|
52
|
+
sections.append("## Outras Tarefas Pendentes")
|
|
53
|
+
for t in other_tasks[:10]:
|
|
54
|
+
sections.append(f"- [{t.priority}] {t.description}")
|
|
55
|
+
sections.append("")
|
|
56
|
+
|
|
57
|
+
# 6. Bloqueadores
|
|
58
|
+
if ctx.active_blockers:
|
|
59
|
+
sections.append("## Bloqueadores Ativos")
|
|
60
|
+
for b in ctx.active_blockers:
|
|
61
|
+
sections.append(f"- {b}")
|
|
62
|
+
sections.append("")
|
|
63
|
+
|
|
64
|
+
# 7. Decisões recentes
|
|
65
|
+
if ctx.recent_decisions:
|
|
66
|
+
sections.append("## Decisões Recentes")
|
|
67
|
+
for d in ctx.recent_decisions[-10:]:
|
|
68
|
+
sections.append(f"- {d}")
|
|
69
|
+
sections.append("")
|
|
70
|
+
|
|
71
|
+
# 8. Convenções
|
|
72
|
+
if ctx.conventions:
|
|
73
|
+
sections.append("## Convenções do Projeto")
|
|
74
|
+
for c in ctx.conventions:
|
|
75
|
+
sections.append(f"- {c}")
|
|
76
|
+
sections.append("")
|
|
77
|
+
|
|
78
|
+
# 9. Últimas sessões (resumo)
|
|
79
|
+
recent_files = _get_recent_session_files(MAX_RECENT_SESSIONS)
|
|
80
|
+
if recent_files:
|
|
81
|
+
sections.append("## Resumo das Últimas Sessões")
|
|
82
|
+
for sf in recent_files:
|
|
83
|
+
snippet = _get_session_snippet(sf)
|
|
84
|
+
sections.append(snippet)
|
|
85
|
+
sections.append("")
|
|
86
|
+
|
|
87
|
+
# 10. Arquivo
|
|
88
|
+
archive_info = get_archive_summary()
|
|
89
|
+
if "Nenhuma" not in archive_info:
|
|
90
|
+
sections.append("## Arquivo")
|
|
91
|
+
sections.append(archive_info)
|
|
92
|
+
sections.append("")
|
|
93
|
+
|
|
94
|
+
return "\n".join(sections)
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
def get_quick_status() -> str:
|
|
98
|
+
"""Versão curta: projetos + pendências críticas."""
|
|
99
|
+
lines = ["## Status Rápido", ""]
|
|
100
|
+
|
|
101
|
+
projects = load_registry()
|
|
102
|
+
active = [p for p in projects if p.status == "active"]
|
|
103
|
+
if active:
|
|
104
|
+
lines.append("**Projetos:** " + ", ".join(p.name for p in active))
|
|
105
|
+
|
|
106
|
+
ctx = load_active_context()
|
|
107
|
+
high = [t for t in ctx.pending_tasks if t.priority == "high"]
|
|
108
|
+
if high:
|
|
109
|
+
lines.append(f"**Pendências críticas:** {len(high)}")
|
|
110
|
+
for t in high[:3]:
|
|
111
|
+
lines.append(f" - {t.description}")
|
|
112
|
+
|
|
113
|
+
total_pending = len(ctx.pending_tasks)
|
|
114
|
+
if total_pending:
|
|
115
|
+
lines.append(f"**Total de pendências:** {total_pending}")
|
|
116
|
+
|
|
117
|
+
if ctx.active_blockers:
|
|
118
|
+
lines.append(f"**Bloqueadores:** {len(ctx.active_blockers)}")
|
|
119
|
+
|
|
120
|
+
if ctx.recent_sessions:
|
|
121
|
+
lines.append(f"**Última sessão:** {ctx.recent_sessions[-1]}")
|
|
122
|
+
|
|
123
|
+
return "\n".join(lines)
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
def _get_recent_session_files(n: int) -> list[Path]:
|
|
127
|
+
"""Retorna os N arquivos de sessão mais recentes."""
|
|
128
|
+
if not SESSIONS_DIR.exists():
|
|
129
|
+
return []
|
|
130
|
+
files = sorted(SESSIONS_DIR.glob("session-*.md"), reverse=True)
|
|
131
|
+
return files[:n]
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
def _get_session_snippet(session_path: Path) -> str:
|
|
135
|
+
"""Extrai um resumo curto de um arquivo de sessão."""
|
|
136
|
+
text = session_path.read_text(encoding="utf-8")
|
|
137
|
+
lines = text.splitlines()
|
|
138
|
+
|
|
139
|
+
# Extrair cabeçalho e tópicos
|
|
140
|
+
header = ""
|
|
141
|
+
topics = []
|
|
142
|
+
in_topics = False
|
|
143
|
+
|
|
144
|
+
for line in lines:
|
|
145
|
+
if line.startswith("# Sessão"):
|
|
146
|
+
header = line.lstrip("#").strip()
|
|
147
|
+
elif line.startswith("## Tópicos"):
|
|
148
|
+
in_topics = True
|
|
149
|
+
elif line.startswith("## ") and in_topics:
|
|
150
|
+
break
|
|
151
|
+
elif in_topics and line.strip().startswith("- "):
|
|
152
|
+
topics.append(line.strip()[2:])
|
|
153
|
+
|
|
154
|
+
topic_str = "; ".join(topics[:3]) if topics else "sem tópicos registrados"
|
|
155
|
+
return f"- **{header}**: {topic_str}"
|
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
Context Manager — Entry point CLI do Context Agent.
|
|
4
|
+
Orquestra save, load, status, search, archive e maintain.
|
|
5
|
+
|
|
6
|
+
Uso:
|
|
7
|
+
python context_manager.py init # Bootstrap do sistema
|
|
8
|
+
python context_manager.py save [--session PATH] # Salvar contexto da sessão
|
|
9
|
+
python context_manager.py load # Carregar contexto (briefing)
|
|
10
|
+
python context_manager.py status # Status rápido
|
|
11
|
+
python context_manager.py search QUERY # Buscar no histórico
|
|
12
|
+
python context_manager.py briefing # Briefing completo
|
|
13
|
+
python context_manager.py archive # Arquivar sessões antigas
|
|
14
|
+
python context_manager.py maintain # Auto-manutenção
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
import argparse
|
|
18
|
+
import io
|
|
19
|
+
import sys
|
|
20
|
+
from pathlib import Path
|
|
21
|
+
|
|
22
|
+
# Fix Windows console encoding for Unicode output
|
|
23
|
+
if sys.stdout.encoding != "utf-8":
|
|
24
|
+
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding="utf-8", errors="replace")
|
|
25
|
+
if sys.stderr.encoding != "utf-8":
|
|
26
|
+
sys.stderr = io.TextIOWrapper(sys.stderr.buffer, encoding="utf-8", errors="replace")
|
|
27
|
+
|
|
28
|
+
# Adicionar diretório dos scripts ao path
|
|
29
|
+
sys.path.insert(0, str(Path(__file__).parent))
|
|
30
|
+
|
|
31
|
+
from config import (
|
|
32
|
+
DATA_DIR, SESSIONS_DIR, ARCHIVE_DIR, LOGS_DIR,
|
|
33
|
+
ACTIVE_CONTEXT_PATH, PROJECT_REGISTRY_PATH,
|
|
34
|
+
)
|
|
35
|
+
from session_parser import (
|
|
36
|
+
parse_session_file, get_latest_session_file, get_session_metadata,
|
|
37
|
+
extract_files_modified, extract_tool_calls,
|
|
38
|
+
)
|
|
39
|
+
from session_summary import (
|
|
40
|
+
generate_summary, save_session_summary, get_next_session_number,
|
|
41
|
+
)
|
|
42
|
+
from active_context import (
|
|
43
|
+
load_active_context, update_active_context,
|
|
44
|
+
save_active_context, sync_to_memory, check_drift,
|
|
45
|
+
)
|
|
46
|
+
from project_registry import (
|
|
47
|
+
load_registry, save_registry, detect_projects_from_session, update_project,
|
|
48
|
+
)
|
|
49
|
+
from compressor import auto_maintain as compress_maintain
|
|
50
|
+
from context_loader import generate_briefing, get_quick_status
|
|
51
|
+
from search import init_search_db, index_session, search as fts_search, reindex_all
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def cmd_init(args):
|
|
55
|
+
"""Bootstrap: cria diretórios e arquivos iniciais."""
|
|
56
|
+
dirs = [DATA_DIR, SESSIONS_DIR, ARCHIVE_DIR, LOGS_DIR]
|
|
57
|
+
for d in dirs:
|
|
58
|
+
d.mkdir(parents=True, exist_ok=True)
|
|
59
|
+
|
|
60
|
+
# Inicializar banco de busca
|
|
61
|
+
init_search_db()
|
|
62
|
+
|
|
63
|
+
# Criar ACTIVE_CONTEXT.md se não existir
|
|
64
|
+
if not ACTIVE_CONTEXT_PATH.exists():
|
|
65
|
+
ctx = load_active_context()
|
|
66
|
+
projects = load_registry()
|
|
67
|
+
save_active_context(ctx, projects)
|
|
68
|
+
|
|
69
|
+
# Criar PROJECT_REGISTRY.md se não existir
|
|
70
|
+
if not PROJECT_REGISTRY_PATH.exists():
|
|
71
|
+
projects = load_registry()
|
|
72
|
+
save_registry(projects)
|
|
73
|
+
|
|
74
|
+
# Sincronizar com MEMORY.md
|
|
75
|
+
sync_to_memory()
|
|
76
|
+
|
|
77
|
+
print("Context Agent inicializado com sucesso!")
|
|
78
|
+
print(f" Diretório de dados: {DATA_DIR}")
|
|
79
|
+
print(f" Sessões: {SESSIONS_DIR}")
|
|
80
|
+
print(f" Arquivo: {ARCHIVE_DIR}")
|
|
81
|
+
print(f" Contexto ativo: {ACTIVE_CONTEXT_PATH}")
|
|
82
|
+
print(f" Registro de projetos: {PROJECT_REGISTRY_PATH}")
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
def cmd_save(args):
|
|
86
|
+
"""Salva contexto da sessão atual."""
|
|
87
|
+
# Encontrar arquivo de sessão
|
|
88
|
+
if args.session:
|
|
89
|
+
session_path = Path(args.session)
|
|
90
|
+
else:
|
|
91
|
+
session_path = get_latest_session_file()
|
|
92
|
+
|
|
93
|
+
if not session_path or not session_path.exists():
|
|
94
|
+
print("Nenhum arquivo de sessão encontrado.")
|
|
95
|
+
sys.exit(1)
|
|
96
|
+
|
|
97
|
+
print(f"Processando sessão: {session_path.name}")
|
|
98
|
+
|
|
99
|
+
# 1. Parse da sessão
|
|
100
|
+
entries = parse_session_file(session_path)
|
|
101
|
+
if not entries:
|
|
102
|
+
print("Sessão vazia — nada para salvar.")
|
|
103
|
+
return
|
|
104
|
+
|
|
105
|
+
metadata = get_session_metadata(entries)
|
|
106
|
+
session_number = get_next_session_number()
|
|
107
|
+
|
|
108
|
+
print(f" Sessão #{session_number:03d} — {metadata.get('slug', '?')}")
|
|
109
|
+
print(f" {metadata.get('message_count', 0)} mensagens, {metadata.get('tool_call_count', 0)} tool calls")
|
|
110
|
+
|
|
111
|
+
# 2. Gerar resumo
|
|
112
|
+
summary = generate_summary(entries, session_number, metadata)
|
|
113
|
+
|
|
114
|
+
# 3. Detectar projetos tocados
|
|
115
|
+
files_mod = extract_files_modified(entries)
|
|
116
|
+
tool_calls = extract_tool_calls(entries)
|
|
117
|
+
projects_touched = detect_projects_from_session(files_mod, tool_calls)
|
|
118
|
+
summary.projects_touched = projects_touched
|
|
119
|
+
|
|
120
|
+
# 4. Salvar resumo da sessão
|
|
121
|
+
path = save_session_summary(summary)
|
|
122
|
+
print(f" Resumo salvo: {path}")
|
|
123
|
+
|
|
124
|
+
# 5. Atualizar registro de projetos
|
|
125
|
+
projects = load_registry()
|
|
126
|
+
for pname in projects_touched:
|
|
127
|
+
projects = update_project(
|
|
128
|
+
projects, pname,
|
|
129
|
+
last_touched=summary.date,
|
|
130
|
+
last_session=session_number,
|
|
131
|
+
status="active",
|
|
132
|
+
)
|
|
133
|
+
save_registry(projects)
|
|
134
|
+
|
|
135
|
+
# 6. Atualizar contexto ativo
|
|
136
|
+
ctx = load_active_context()
|
|
137
|
+
ctx = update_active_context(ctx, summary)
|
|
138
|
+
save_active_context(ctx, projects)
|
|
139
|
+
|
|
140
|
+
# 7. Sincronizar com MEMORY.md
|
|
141
|
+
sync_to_memory()
|
|
142
|
+
print(" MEMORY.md sincronizado")
|
|
143
|
+
|
|
144
|
+
# 8. Indexar para busca
|
|
145
|
+
init_search_db()
|
|
146
|
+
sections = {
|
|
147
|
+
"topics": "\n".join(summary.topics),
|
|
148
|
+
"decisions": "\n".join(summary.decisions),
|
|
149
|
+
"tasks_completed": "\n".join(summary.tasks_completed),
|
|
150
|
+
"tasks_pending": "\n".join(
|
|
151
|
+
t.description if hasattr(t, 'description') else str(t)
|
|
152
|
+
for t in summary.tasks_pending
|
|
153
|
+
),
|
|
154
|
+
"files_modified": "\n".join(f["path"] for f in summary.files_modified),
|
|
155
|
+
"key_findings": "\n".join(summary.key_findings),
|
|
156
|
+
"errors": "\n".join(e["error"] for e in summary.errors_resolved),
|
|
157
|
+
}
|
|
158
|
+
index_session(session_number, summary.date, sections)
|
|
159
|
+
print(" Índice de busca atualizado")
|
|
160
|
+
|
|
161
|
+
print(f"\nContexto da sessão {session_number:03d} salvo com sucesso!")
|
|
162
|
+
print(f" Tópicos: {len(summary.topics)}")
|
|
163
|
+
print(f" Decisões: {len(summary.decisions)}")
|
|
164
|
+
print(f" Tarefas completadas: {len(summary.tasks_completed)}")
|
|
165
|
+
print(f" Tarefas pendentes: {len(summary.tasks_pending)}")
|
|
166
|
+
print(f" Arquivos modificados: {len(summary.files_modified)}")
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
def cmd_load(args):
|
|
170
|
+
"""Carrega contexto — briefing completo."""
|
|
171
|
+
briefing = generate_briefing()
|
|
172
|
+
print(briefing)
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
def cmd_status(args):
|
|
176
|
+
"""Status rápido."""
|
|
177
|
+
status = get_quick_status()
|
|
178
|
+
print(status)
|
|
179
|
+
|
|
180
|
+
# Verificar drift
|
|
181
|
+
if check_drift():
|
|
182
|
+
print("\n⚠ ACTIVE_CONTEXT.md e MEMORY.md estão dessincronizados.")
|
|
183
|
+
print(" Execute: python context_manager.py maintain")
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
def cmd_search(args):
|
|
187
|
+
"""Busca no histórico."""
|
|
188
|
+
query = " ".join(args.query)
|
|
189
|
+
if not query:
|
|
190
|
+
print("Forneça um termo de busca.")
|
|
191
|
+
sys.exit(1)
|
|
192
|
+
|
|
193
|
+
init_search_db()
|
|
194
|
+
results = fts_search(query)
|
|
195
|
+
|
|
196
|
+
if not results:
|
|
197
|
+
print(f"Nenhum resultado para: {query}")
|
|
198
|
+
return
|
|
199
|
+
|
|
200
|
+
print(f"Resultados para '{query}':")
|
|
201
|
+
print()
|
|
202
|
+
for r in results:
|
|
203
|
+
print(f" [session-{r.session_number:03d}] ({r.date}) [{r.section}]")
|
|
204
|
+
print(f" {r.snippet}")
|
|
205
|
+
print()
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
def cmd_briefing(args):
|
|
209
|
+
"""Briefing detalhado."""
|
|
210
|
+
briefing = generate_briefing()
|
|
211
|
+
print(briefing)
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
def cmd_archive(args):
|
|
215
|
+
"""Arquivar sessões antigas."""
|
|
216
|
+
from session_summary import get_next_session_number
|
|
217
|
+
current = get_next_session_number() - 1
|
|
218
|
+
if current <= 0:
|
|
219
|
+
print("Nenhuma sessão para arquivar.")
|
|
220
|
+
return
|
|
221
|
+
|
|
222
|
+
compress_maintain(current)
|
|
223
|
+
print(f"Manutenção concluída. Sessão mais recente: {current:03d}")
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
def cmd_maintain(args):
|
|
227
|
+
"""Auto-manutenção: arquivar, comprimir, sincronizar."""
|
|
228
|
+
from session_summary import get_next_session_number
|
|
229
|
+
current = get_next_session_number() - 1
|
|
230
|
+
|
|
231
|
+
# 1. Arquivar sessões antigas
|
|
232
|
+
if current > 0:
|
|
233
|
+
compress_maintain(current)
|
|
234
|
+
print("Sessões antigas arquivadas.")
|
|
235
|
+
|
|
236
|
+
# 2. Verificar e corrigir drift
|
|
237
|
+
if check_drift():
|
|
238
|
+
sync_to_memory()
|
|
239
|
+
print("MEMORY.md ressincronizado.")
|
|
240
|
+
|
|
241
|
+
# 3. Reindexar busca
|
|
242
|
+
init_search_db()
|
|
243
|
+
reindex_all(SESSIONS_DIR)
|
|
244
|
+
print("Índice de busca reconstruído.")
|
|
245
|
+
|
|
246
|
+
print("\nManutenção concluída.")
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
def main():
|
|
250
|
+
parser = argparse.ArgumentParser(
|
|
251
|
+
description="Context Agent — Gerenciamento de contexto entre sessões",
|
|
252
|
+
)
|
|
253
|
+
subparsers = parser.add_subparsers(dest="command", help="Comando")
|
|
254
|
+
|
|
255
|
+
# init
|
|
256
|
+
subparsers.add_parser("init", help="Bootstrap do sistema")
|
|
257
|
+
|
|
258
|
+
# save
|
|
259
|
+
save_parser = subparsers.add_parser("save", help="Salvar contexto da sessão")
|
|
260
|
+
save_parser.add_argument("--session", help="Path para arquivo JSONL específico")
|
|
261
|
+
|
|
262
|
+
# load
|
|
263
|
+
subparsers.add_parser("load", help="Carregar contexto (briefing)")
|
|
264
|
+
|
|
265
|
+
# status
|
|
266
|
+
subparsers.add_parser("status", help="Status rápido")
|
|
267
|
+
|
|
268
|
+
# search
|
|
269
|
+
search_parser = subparsers.add_parser("search", help="Buscar no histórico")
|
|
270
|
+
search_parser.add_argument("query", nargs="+", help="Termo de busca")
|
|
271
|
+
|
|
272
|
+
# briefing
|
|
273
|
+
subparsers.add_parser("briefing", help="Briefing completo")
|
|
274
|
+
|
|
275
|
+
# archive
|
|
276
|
+
subparsers.add_parser("archive", help="Arquivar sessões antigas")
|
|
277
|
+
|
|
278
|
+
# maintain
|
|
279
|
+
subparsers.add_parser("maintain", help="Auto-manutenção")
|
|
280
|
+
|
|
281
|
+
args = parser.parse_args()
|
|
282
|
+
|
|
283
|
+
if not args.command:
|
|
284
|
+
parser.print_help()
|
|
285
|
+
sys.exit(0)
|
|
286
|
+
|
|
287
|
+
commands = {
|
|
288
|
+
"init": cmd_init,
|
|
289
|
+
"save": cmd_save,
|
|
290
|
+
"load": cmd_load,
|
|
291
|
+
"status": cmd_status,
|
|
292
|
+
"search": cmd_search,
|
|
293
|
+
"briefing": cmd_briefing,
|
|
294
|
+
"archive": cmd_archive,
|
|
295
|
+
"maintain": cmd_maintain,
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
commands[args.command](args)
|
|
299
|
+
|
|
300
|
+
|
|
301
|
+
if __name__ == "__main__":
|
|
302
|
+
main()
|