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,296 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
RICE Prioritization Framework
|
|
4
|
+
Calculates RICE scores for feature prioritization
|
|
5
|
+
RICE = (Reach x Impact x Confidence) / Effort
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
import json
|
|
9
|
+
import csv
|
|
10
|
+
from typing import List, Dict, Tuple
|
|
11
|
+
import argparse
|
|
12
|
+
|
|
13
|
+
class RICECalculator:
|
|
14
|
+
"""Calculate RICE scores for feature prioritization"""
|
|
15
|
+
|
|
16
|
+
def __init__(self):
|
|
17
|
+
self.impact_map = {
|
|
18
|
+
'massive': 3.0,
|
|
19
|
+
'high': 2.0,
|
|
20
|
+
'medium': 1.0,
|
|
21
|
+
'low': 0.5,
|
|
22
|
+
'minimal': 0.25
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
self.confidence_map = {
|
|
26
|
+
'high': 100,
|
|
27
|
+
'medium': 80,
|
|
28
|
+
'low': 50
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
self.effort_map = {
|
|
32
|
+
'xl': 13,
|
|
33
|
+
'l': 8,
|
|
34
|
+
'm': 5,
|
|
35
|
+
's': 3,
|
|
36
|
+
'xs': 1
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
def calculate_rice(self, reach: int, impact: str, confidence: str, effort: str) -> float:
|
|
40
|
+
"""
|
|
41
|
+
Calculate RICE score
|
|
42
|
+
|
|
43
|
+
Args:
|
|
44
|
+
reach: Number of users/customers affected per quarter
|
|
45
|
+
impact: massive/high/medium/low/minimal
|
|
46
|
+
confidence: high/medium/low (percentage)
|
|
47
|
+
effort: xl/l/m/s/xs (person-months)
|
|
48
|
+
"""
|
|
49
|
+
impact_score = self.impact_map.get(impact.lower(), 1.0)
|
|
50
|
+
confidence_score = self.confidence_map.get(confidence.lower(), 50) / 100
|
|
51
|
+
effort_score = self.effort_map.get(effort.lower(), 5)
|
|
52
|
+
|
|
53
|
+
if effort_score == 0:
|
|
54
|
+
return 0
|
|
55
|
+
|
|
56
|
+
rice_score = (reach * impact_score * confidence_score) / effort_score
|
|
57
|
+
return round(rice_score, 2)
|
|
58
|
+
|
|
59
|
+
def prioritize_features(self, features: List[Dict]) -> List[Dict]:
|
|
60
|
+
"""
|
|
61
|
+
Calculate RICE scores and rank features
|
|
62
|
+
|
|
63
|
+
Args:
|
|
64
|
+
features: List of feature dictionaries with RICE components
|
|
65
|
+
"""
|
|
66
|
+
for feature in features:
|
|
67
|
+
feature['rice_score'] = self.calculate_rice(
|
|
68
|
+
feature.get('reach', 0),
|
|
69
|
+
feature.get('impact', 'medium'),
|
|
70
|
+
feature.get('confidence', 'medium'),
|
|
71
|
+
feature.get('effort', 'm')
|
|
72
|
+
)
|
|
73
|
+
|
|
74
|
+
# Sort by RICE score descending
|
|
75
|
+
return sorted(features, key=lambda x: x['rice_score'], reverse=True)
|
|
76
|
+
|
|
77
|
+
def analyze_portfolio(self, features: List[Dict]) -> Dict:
|
|
78
|
+
"""
|
|
79
|
+
Analyze the feature portfolio for balance and insights
|
|
80
|
+
"""
|
|
81
|
+
if not features:
|
|
82
|
+
return {}
|
|
83
|
+
|
|
84
|
+
total_effort = sum(
|
|
85
|
+
self.effort_map.get(f.get('effort', 'm').lower(), 5)
|
|
86
|
+
for f in features
|
|
87
|
+
)
|
|
88
|
+
|
|
89
|
+
total_reach = sum(f.get('reach', 0) for f in features)
|
|
90
|
+
|
|
91
|
+
effort_distribution = {}
|
|
92
|
+
impact_distribution = {}
|
|
93
|
+
|
|
94
|
+
for feature in features:
|
|
95
|
+
effort = feature.get('effort', 'm').lower()
|
|
96
|
+
impact = feature.get('impact', 'medium').lower()
|
|
97
|
+
|
|
98
|
+
effort_distribution[effort] = effort_distribution.get(effort, 0) + 1
|
|
99
|
+
impact_distribution[impact] = impact_distribution.get(impact, 0) + 1
|
|
100
|
+
|
|
101
|
+
# Calculate quick wins (high impact, low effort)
|
|
102
|
+
quick_wins = [
|
|
103
|
+
f for f in features
|
|
104
|
+
if f.get('impact', '').lower() in ['massive', 'high']
|
|
105
|
+
and f.get('effort', '').lower() in ['xs', 's']
|
|
106
|
+
]
|
|
107
|
+
|
|
108
|
+
# Calculate big bets (high impact, high effort)
|
|
109
|
+
big_bets = [
|
|
110
|
+
f for f in features
|
|
111
|
+
if f.get('impact', '').lower() in ['massive', 'high']
|
|
112
|
+
and f.get('effort', '').lower() in ['l', 'xl']
|
|
113
|
+
]
|
|
114
|
+
|
|
115
|
+
return {
|
|
116
|
+
'total_features': len(features),
|
|
117
|
+
'total_effort_months': total_effort,
|
|
118
|
+
'total_reach': total_reach,
|
|
119
|
+
'average_rice': round(sum(f['rice_score'] for f in features) / len(features), 2),
|
|
120
|
+
'effort_distribution': effort_distribution,
|
|
121
|
+
'impact_distribution': impact_distribution,
|
|
122
|
+
'quick_wins': len(quick_wins),
|
|
123
|
+
'big_bets': len(big_bets),
|
|
124
|
+
'quick_wins_list': quick_wins[:3], # Top 3 quick wins
|
|
125
|
+
'big_bets_list': big_bets[:3] # Top 3 big bets
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
def generate_roadmap(self, features: List[Dict], team_capacity: int = 10) -> List[Dict]:
|
|
129
|
+
"""
|
|
130
|
+
Generate a quarterly roadmap based on team capacity
|
|
131
|
+
|
|
132
|
+
Args:
|
|
133
|
+
features: Prioritized feature list
|
|
134
|
+
team_capacity: Person-months available per quarter
|
|
135
|
+
"""
|
|
136
|
+
quarters = []
|
|
137
|
+
current_quarter = {
|
|
138
|
+
'quarter': 1,
|
|
139
|
+
'features': [],
|
|
140
|
+
'capacity_used': 0,
|
|
141
|
+
'capacity_available': team_capacity
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
for feature in features:
|
|
145
|
+
effort = self.effort_map.get(feature.get('effort', 'm').lower(), 5)
|
|
146
|
+
|
|
147
|
+
if current_quarter['capacity_used'] + effort <= team_capacity:
|
|
148
|
+
current_quarter['features'].append(feature)
|
|
149
|
+
current_quarter['capacity_used'] += effort
|
|
150
|
+
else:
|
|
151
|
+
# Move to next quarter
|
|
152
|
+
current_quarter['capacity_available'] = team_capacity - current_quarter['capacity_used']
|
|
153
|
+
quarters.append(current_quarter)
|
|
154
|
+
|
|
155
|
+
current_quarter = {
|
|
156
|
+
'quarter': len(quarters) + 1,
|
|
157
|
+
'features': [feature],
|
|
158
|
+
'capacity_used': effort,
|
|
159
|
+
'capacity_available': team_capacity - effort
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
if current_quarter['features']:
|
|
163
|
+
current_quarter['capacity_available'] = team_capacity - current_quarter['capacity_used']
|
|
164
|
+
quarters.append(current_quarter)
|
|
165
|
+
|
|
166
|
+
return quarters
|
|
167
|
+
|
|
168
|
+
def format_output(features: List[Dict], analysis: Dict, roadmap: List[Dict]) -> str:
|
|
169
|
+
"""Format the results for display"""
|
|
170
|
+
output = ["=" * 60]
|
|
171
|
+
output.append("RICE PRIORITIZATION RESULTS")
|
|
172
|
+
output.append("=" * 60)
|
|
173
|
+
|
|
174
|
+
# Top prioritized features
|
|
175
|
+
output.append("\n📊 TOP PRIORITIZED FEATURES\n")
|
|
176
|
+
for i, feature in enumerate(features[:10], 1):
|
|
177
|
+
output.append(f"{i}. {feature.get('name', 'Unnamed')}")
|
|
178
|
+
output.append(f" RICE Score: {feature['rice_score']}")
|
|
179
|
+
output.append(f" Reach: {feature.get('reach', 0)} | Impact: {feature.get('impact', 'medium')} | "
|
|
180
|
+
f"Confidence: {feature.get('confidence', 'medium')} | Effort: {feature.get('effort', 'm')}")
|
|
181
|
+
output.append("")
|
|
182
|
+
|
|
183
|
+
# Portfolio analysis
|
|
184
|
+
output.append("\n📈 PORTFOLIO ANALYSIS\n")
|
|
185
|
+
output.append(f"Total Features: {analysis.get('total_features', 0)}")
|
|
186
|
+
output.append(f"Total Effort: {analysis.get('total_effort_months', 0)} person-months")
|
|
187
|
+
output.append(f"Total Reach: {analysis.get('total_reach', 0):,} users")
|
|
188
|
+
output.append(f"Average RICE Score: {analysis.get('average_rice', 0)}")
|
|
189
|
+
|
|
190
|
+
output.append(f"\n🎯 Quick Wins: {analysis.get('quick_wins', 0)} features")
|
|
191
|
+
for qw in analysis.get('quick_wins_list', []):
|
|
192
|
+
output.append(f" • {qw.get('name', 'Unnamed')} (RICE: {qw['rice_score']})")
|
|
193
|
+
|
|
194
|
+
output.append(f"\n🚀 Big Bets: {analysis.get('big_bets', 0)} features")
|
|
195
|
+
for bb in analysis.get('big_bets_list', []):
|
|
196
|
+
output.append(f" • {bb.get('name', 'Unnamed')} (RICE: {bb['rice_score']})")
|
|
197
|
+
|
|
198
|
+
# Roadmap
|
|
199
|
+
output.append("\n\n📅 SUGGESTED ROADMAP\n")
|
|
200
|
+
for quarter in roadmap:
|
|
201
|
+
output.append(f"\nQ{quarter['quarter']} - Capacity: {quarter['capacity_used']}/{quarter['capacity_used'] + quarter['capacity_available']} person-months")
|
|
202
|
+
for feature in quarter['features']:
|
|
203
|
+
output.append(f" • {feature.get('name', 'Unnamed')} (RICE: {feature['rice_score']})")
|
|
204
|
+
|
|
205
|
+
return "\n".join(output)
|
|
206
|
+
|
|
207
|
+
def load_features_from_csv(filepath: str) -> List[Dict]:
|
|
208
|
+
"""Load features from CSV file"""
|
|
209
|
+
features = []
|
|
210
|
+
with open(filepath, 'r') as f:
|
|
211
|
+
reader = csv.DictReader(f)
|
|
212
|
+
for row in reader:
|
|
213
|
+
feature = {
|
|
214
|
+
'name': row.get('name', ''),
|
|
215
|
+
'reach': int(row.get('reach', 0)),
|
|
216
|
+
'impact': row.get('impact', 'medium'),
|
|
217
|
+
'confidence': row.get('confidence', 'medium'),
|
|
218
|
+
'effort': row.get('effort', 'm'),
|
|
219
|
+
'description': row.get('description', '')
|
|
220
|
+
}
|
|
221
|
+
features.append(feature)
|
|
222
|
+
return features
|
|
223
|
+
|
|
224
|
+
def create_sample_csv(filepath: str):
|
|
225
|
+
"""Create a sample CSV file for testing"""
|
|
226
|
+
sample_features = [
|
|
227
|
+
['name', 'reach', 'impact', 'confidence', 'effort', 'description'],
|
|
228
|
+
['User Dashboard Redesign', '5000', 'high', 'high', 'l', 'Complete redesign of user dashboard'],
|
|
229
|
+
['Mobile Push Notifications', '10000', 'massive', 'medium', 'm', 'Add push notification support'],
|
|
230
|
+
['Dark Mode', '8000', 'medium', 'high', 's', 'Implement dark mode theme'],
|
|
231
|
+
['API Rate Limiting', '2000', 'low', 'high', 'xs', 'Add rate limiting to API'],
|
|
232
|
+
['Social Login', '12000', 'high', 'medium', 'm', 'Add Google/Facebook login'],
|
|
233
|
+
['Export to PDF', '3000', 'medium', 'low', 's', 'Export reports as PDF'],
|
|
234
|
+
['Team Collaboration', '4000', 'massive', 'low', 'xl', 'Real-time collaboration features'],
|
|
235
|
+
['Search Improvements', '15000', 'high', 'high', 'm', 'Enhance search functionality'],
|
|
236
|
+
['Onboarding Flow', '20000', 'massive', 'high', 's', 'Improve new user onboarding'],
|
|
237
|
+
['Analytics Dashboard', '6000', 'high', 'medium', 'l', 'Advanced analytics for users'],
|
|
238
|
+
]
|
|
239
|
+
|
|
240
|
+
with open(filepath, 'w', newline='') as f:
|
|
241
|
+
writer = csv.writer(f)
|
|
242
|
+
writer.writerows(sample_features)
|
|
243
|
+
|
|
244
|
+
print(f"Sample CSV created at: {filepath}")
|
|
245
|
+
|
|
246
|
+
def main():
|
|
247
|
+
parser = argparse.ArgumentParser(description='RICE Framework for Feature Prioritization')
|
|
248
|
+
parser.add_argument('input', nargs='?', help='CSV file with features or "sample" to create sample')
|
|
249
|
+
parser.add_argument('--capacity', type=int, default=10, help='Team capacity per quarter (person-months)')
|
|
250
|
+
parser.add_argument('--output', choices=['text', 'json', 'csv'], default='text', help='Output format')
|
|
251
|
+
|
|
252
|
+
args = parser.parse_args()
|
|
253
|
+
|
|
254
|
+
# Create sample if requested
|
|
255
|
+
if args.input == 'sample':
|
|
256
|
+
create_sample_csv('sample_features.csv')
|
|
257
|
+
return
|
|
258
|
+
|
|
259
|
+
# Use sample data if no input provided
|
|
260
|
+
if not args.input:
|
|
261
|
+
features = [
|
|
262
|
+
{'name': 'User Dashboard', 'reach': 5000, 'impact': 'high', 'confidence': 'high', 'effort': 'l'},
|
|
263
|
+
{'name': 'Push Notifications', 'reach': 10000, 'impact': 'massive', 'confidence': 'medium', 'effort': 'm'},
|
|
264
|
+
{'name': 'Dark Mode', 'reach': 8000, 'impact': 'medium', 'confidence': 'high', 'effort': 's'},
|
|
265
|
+
{'name': 'API Rate Limiting', 'reach': 2000, 'impact': 'low', 'confidence': 'high', 'effort': 'xs'},
|
|
266
|
+
{'name': 'Social Login', 'reach': 12000, 'impact': 'high', 'confidence': 'medium', 'effort': 'm'},
|
|
267
|
+
]
|
|
268
|
+
else:
|
|
269
|
+
features = load_features_from_csv(args.input)
|
|
270
|
+
|
|
271
|
+
# Calculate RICE scores
|
|
272
|
+
calculator = RICECalculator()
|
|
273
|
+
prioritized = calculator.prioritize_features(features)
|
|
274
|
+
analysis = calculator.analyze_portfolio(prioritized)
|
|
275
|
+
roadmap = calculator.generate_roadmap(prioritized, args.capacity)
|
|
276
|
+
|
|
277
|
+
# Output results
|
|
278
|
+
if args.output == 'json':
|
|
279
|
+
result = {
|
|
280
|
+
'features': prioritized,
|
|
281
|
+
'analysis': analysis,
|
|
282
|
+
'roadmap': roadmap
|
|
283
|
+
}
|
|
284
|
+
print(json.dumps(result, indent=2))
|
|
285
|
+
elif args.output == 'csv':
|
|
286
|
+
# Output prioritized features as CSV
|
|
287
|
+
if prioritized:
|
|
288
|
+
keys = prioritized[0].keys()
|
|
289
|
+
print(','.join(keys))
|
|
290
|
+
for feature in prioritized:
|
|
291
|
+
print(','.join(str(feature.get(k, '')) for k in keys))
|
|
292
|
+
else:
|
|
293
|
+
print(format_output(prioritized, analysis, roadmap))
|
|
294
|
+
|
|
295
|
+
if __name__ == "__main__":
|
|
296
|
+
main()
|
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
Prompt Optimization Script
|
|
4
|
+
|
|
5
|
+
Automatically test and optimize prompts using A/B testing and metrics tracking.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
import json
|
|
9
|
+
import time
|
|
10
|
+
from typing import List, Dict, Any
|
|
11
|
+
from dataclasses import dataclass
|
|
12
|
+
from concurrent.futures import ThreadPoolExecutor
|
|
13
|
+
import numpy as np
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
@dataclass
|
|
17
|
+
class TestCase:
|
|
18
|
+
input: Dict[str, Any]
|
|
19
|
+
expected_output: str
|
|
20
|
+
metadata: Dict[str, Any] = None
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class PromptOptimizer:
|
|
24
|
+
def __init__(self, llm_client, test_suite: List[TestCase]):
|
|
25
|
+
self.client = llm_client
|
|
26
|
+
self.test_suite = test_suite
|
|
27
|
+
self.results_history = []
|
|
28
|
+
self.executor = ThreadPoolExecutor()
|
|
29
|
+
|
|
30
|
+
def shutdown(self):
|
|
31
|
+
"""Shutdown the thread pool executor."""
|
|
32
|
+
self.executor.shutdown(wait=True)
|
|
33
|
+
|
|
34
|
+
def evaluate_prompt(self, prompt_template: str, test_cases: List[TestCase] = None) -> Dict[str, float]:
|
|
35
|
+
"""Evaluate a prompt template against test cases in parallel."""
|
|
36
|
+
if test_cases is None:
|
|
37
|
+
test_cases = self.test_suite
|
|
38
|
+
|
|
39
|
+
metrics = {
|
|
40
|
+
'accuracy': [],
|
|
41
|
+
'latency': [],
|
|
42
|
+
'token_count': [],
|
|
43
|
+
'success_rate': []
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
def process_test_case(test_case):
|
|
47
|
+
start_time = time.time()
|
|
48
|
+
|
|
49
|
+
# Render prompt with test case inputs
|
|
50
|
+
prompt = prompt_template.format(**test_case.input)
|
|
51
|
+
|
|
52
|
+
# Get LLM response
|
|
53
|
+
response = self.client.complete(prompt)
|
|
54
|
+
|
|
55
|
+
# Measure latency
|
|
56
|
+
latency = time.time() - start_time
|
|
57
|
+
|
|
58
|
+
# Calculate individual metrics
|
|
59
|
+
token_count = len(prompt.split()) + len(response.split())
|
|
60
|
+
success = 1 if response else 0
|
|
61
|
+
accuracy = self.calculate_accuracy(response, test_case.expected_output)
|
|
62
|
+
|
|
63
|
+
return {
|
|
64
|
+
'latency': latency,
|
|
65
|
+
'token_count': token_count,
|
|
66
|
+
'success_rate': success,
|
|
67
|
+
'accuracy': accuracy
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
# Run test cases in parallel
|
|
71
|
+
results = list(self.executor.map(process_test_case, test_cases))
|
|
72
|
+
|
|
73
|
+
# Aggregate metrics
|
|
74
|
+
for result in results:
|
|
75
|
+
metrics['latency'].append(result['latency'])
|
|
76
|
+
metrics['token_count'].append(result['token_count'])
|
|
77
|
+
metrics['success_rate'].append(result['success_rate'])
|
|
78
|
+
metrics['accuracy'].append(result['accuracy'])
|
|
79
|
+
|
|
80
|
+
return {
|
|
81
|
+
'avg_accuracy': np.mean(metrics['accuracy']),
|
|
82
|
+
'avg_latency': np.mean(metrics['latency']),
|
|
83
|
+
'p95_latency': np.percentile(metrics['latency'], 95),
|
|
84
|
+
'avg_tokens': np.mean(metrics['token_count']),
|
|
85
|
+
'success_rate': np.mean(metrics['success_rate'])
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
def calculate_accuracy(self, response: str, expected: str) -> float:
|
|
89
|
+
"""Calculate accuracy score between response and expected output."""
|
|
90
|
+
# Simple exact match
|
|
91
|
+
if response.strip().lower() == expected.strip().lower():
|
|
92
|
+
return 1.0
|
|
93
|
+
|
|
94
|
+
# Partial match using word overlap
|
|
95
|
+
response_words = set(response.lower().split())
|
|
96
|
+
expected_words = set(expected.lower().split())
|
|
97
|
+
|
|
98
|
+
if not expected_words:
|
|
99
|
+
return 0.0
|
|
100
|
+
|
|
101
|
+
overlap = len(response_words & expected_words)
|
|
102
|
+
return overlap / len(expected_words)
|
|
103
|
+
|
|
104
|
+
def optimize(self, base_prompt: str, max_iterations: int = 5) -> Dict[str, Any]:
|
|
105
|
+
"""Iteratively optimize a prompt."""
|
|
106
|
+
current_prompt = base_prompt
|
|
107
|
+
best_prompt = base_prompt
|
|
108
|
+
best_score = 0
|
|
109
|
+
current_metrics = None
|
|
110
|
+
|
|
111
|
+
for iteration in range(max_iterations):
|
|
112
|
+
print(f"\nIteration {iteration + 1}/{max_iterations}")
|
|
113
|
+
|
|
114
|
+
# Evaluate current prompt
|
|
115
|
+
# Bolt Optimization: Avoid re-evaluating if we already have metrics from previous iteration
|
|
116
|
+
if current_metrics:
|
|
117
|
+
metrics = current_metrics
|
|
118
|
+
else:
|
|
119
|
+
metrics = self.evaluate_prompt(current_prompt)
|
|
120
|
+
|
|
121
|
+
print(f"Accuracy: {metrics['avg_accuracy']:.2f}, Latency: {metrics['avg_latency']:.2f}s")
|
|
122
|
+
|
|
123
|
+
# Track results
|
|
124
|
+
self.results_history.append({
|
|
125
|
+
'iteration': iteration,
|
|
126
|
+
'prompt': current_prompt,
|
|
127
|
+
'metrics': metrics
|
|
128
|
+
})
|
|
129
|
+
|
|
130
|
+
# Update best if improved
|
|
131
|
+
if metrics['avg_accuracy'] > best_score:
|
|
132
|
+
best_score = metrics['avg_accuracy']
|
|
133
|
+
best_prompt = current_prompt
|
|
134
|
+
|
|
135
|
+
# Stop if good enough
|
|
136
|
+
if metrics['avg_accuracy'] > 0.95:
|
|
137
|
+
print("Achieved target accuracy!")
|
|
138
|
+
break
|
|
139
|
+
|
|
140
|
+
# Generate variations for next iteration
|
|
141
|
+
variations = self.generate_variations(current_prompt, metrics)
|
|
142
|
+
|
|
143
|
+
# Test variations and pick best
|
|
144
|
+
best_variation = current_prompt
|
|
145
|
+
best_variation_score = metrics['avg_accuracy']
|
|
146
|
+
best_variation_metrics = metrics
|
|
147
|
+
|
|
148
|
+
for variation in variations:
|
|
149
|
+
var_metrics = self.evaluate_prompt(variation)
|
|
150
|
+
if var_metrics['avg_accuracy'] > best_variation_score:
|
|
151
|
+
best_variation_score = var_metrics['avg_accuracy']
|
|
152
|
+
best_variation = variation
|
|
153
|
+
best_variation_metrics = var_metrics
|
|
154
|
+
|
|
155
|
+
current_prompt = best_variation
|
|
156
|
+
current_metrics = best_variation_metrics
|
|
157
|
+
|
|
158
|
+
return {
|
|
159
|
+
'best_prompt': best_prompt,
|
|
160
|
+
'best_score': best_score,
|
|
161
|
+
'history': self.results_history
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
def generate_variations(self, prompt: str, current_metrics: Dict) -> List[str]:
|
|
165
|
+
"""Generate prompt variations to test."""
|
|
166
|
+
variations = []
|
|
167
|
+
|
|
168
|
+
# Variation 1: Add explicit format instruction
|
|
169
|
+
variations.append(prompt + "\n\nProvide your answer in a clear, concise format.")
|
|
170
|
+
|
|
171
|
+
# Variation 2: Add step-by-step instruction
|
|
172
|
+
variations.append("Let's solve this step by step.\n\n" + prompt)
|
|
173
|
+
|
|
174
|
+
# Variation 3: Add verification step
|
|
175
|
+
variations.append(prompt + "\n\nVerify your answer before responding.")
|
|
176
|
+
|
|
177
|
+
# Variation 4: Make more concise
|
|
178
|
+
concise = self.make_concise(prompt)
|
|
179
|
+
if concise != prompt:
|
|
180
|
+
variations.append(concise)
|
|
181
|
+
|
|
182
|
+
# Variation 5: Add examples (if none present)
|
|
183
|
+
if "example" not in prompt.lower():
|
|
184
|
+
variations.append(self.add_examples(prompt))
|
|
185
|
+
|
|
186
|
+
return variations[:3] # Return top 3 variations
|
|
187
|
+
|
|
188
|
+
def make_concise(self, prompt: str) -> str:
|
|
189
|
+
"""Remove redundant words to make prompt more concise."""
|
|
190
|
+
replacements = [
|
|
191
|
+
("in order to", "to"),
|
|
192
|
+
("due to the fact that", "because"),
|
|
193
|
+
("at this point in time", "now"),
|
|
194
|
+
("in the event that", "if"),
|
|
195
|
+
]
|
|
196
|
+
|
|
197
|
+
result = prompt
|
|
198
|
+
for old, new in replacements:
|
|
199
|
+
result = result.replace(old, new)
|
|
200
|
+
|
|
201
|
+
return result
|
|
202
|
+
|
|
203
|
+
def add_examples(self, prompt: str) -> str:
|
|
204
|
+
"""Add example section to prompt."""
|
|
205
|
+
return f"""{prompt}
|
|
206
|
+
|
|
207
|
+
Example:
|
|
208
|
+
Input: Sample input
|
|
209
|
+
Output: Sample output
|
|
210
|
+
"""
|
|
211
|
+
|
|
212
|
+
def compare_prompts(self, prompt_a: str, prompt_b: str) -> Dict[str, Any]:
|
|
213
|
+
"""A/B test two prompts."""
|
|
214
|
+
print("Testing Prompt A...")
|
|
215
|
+
metrics_a = self.evaluate_prompt(prompt_a)
|
|
216
|
+
|
|
217
|
+
print("Testing Prompt B...")
|
|
218
|
+
metrics_b = self.evaluate_prompt(prompt_b)
|
|
219
|
+
|
|
220
|
+
return {
|
|
221
|
+
'prompt_a_metrics': metrics_a,
|
|
222
|
+
'prompt_b_metrics': metrics_b,
|
|
223
|
+
'winner': 'A' if metrics_a['avg_accuracy'] > metrics_b['avg_accuracy'] else 'B',
|
|
224
|
+
'improvement': abs(metrics_a['avg_accuracy'] - metrics_b['avg_accuracy'])
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
def export_results(self, filename: str):
|
|
228
|
+
"""Export optimization results to JSON."""
|
|
229
|
+
with open(filename, 'w') as f:
|
|
230
|
+
json.dump(self.results_history, f, indent=2)
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
def main():
|
|
234
|
+
# Example usage
|
|
235
|
+
test_suite = [
|
|
236
|
+
TestCase(
|
|
237
|
+
input={'text': 'This movie was amazing!'},
|
|
238
|
+
expected_output='Positive'
|
|
239
|
+
),
|
|
240
|
+
TestCase(
|
|
241
|
+
input={'text': 'Worst purchase ever.'},
|
|
242
|
+
expected_output='Negative'
|
|
243
|
+
),
|
|
244
|
+
TestCase(
|
|
245
|
+
input={'text': 'It was okay, nothing special.'},
|
|
246
|
+
expected_output='Neutral'
|
|
247
|
+
)
|
|
248
|
+
]
|
|
249
|
+
|
|
250
|
+
# Mock LLM client for demonstration
|
|
251
|
+
class MockLLMClient:
|
|
252
|
+
def complete(self, prompt):
|
|
253
|
+
# Simulate LLM response
|
|
254
|
+
if 'amazing' in prompt:
|
|
255
|
+
return 'Positive'
|
|
256
|
+
elif 'worst' in prompt.lower():
|
|
257
|
+
return 'Negative'
|
|
258
|
+
else:
|
|
259
|
+
return 'Neutral'
|
|
260
|
+
|
|
261
|
+
optimizer = PromptOptimizer(MockLLMClient(), test_suite)
|
|
262
|
+
|
|
263
|
+
try:
|
|
264
|
+
base_prompt = "Classify the sentiment of: {text}\nSentiment:"
|
|
265
|
+
|
|
266
|
+
results = optimizer.optimize(base_prompt)
|
|
267
|
+
|
|
268
|
+
print("\n" + "="*50)
|
|
269
|
+
print("Optimization Complete!")
|
|
270
|
+
print(f"Best Accuracy: {results['best_score']:.2f}")
|
|
271
|
+
print(f"Best Prompt:\n{results['best_prompt']}")
|
|
272
|
+
|
|
273
|
+
optimizer.export_results('optimization_results.json')
|
|
274
|
+
finally:
|
|
275
|
+
optimizer.shutdown()
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+
if __name__ == '__main__':
|
|
279
|
+
main()
|