@thanhvn14/csvibe 0.1.3 → 0.1.5
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/.github/agents/schemas/base-output.schema.json +88 -0
- package/.github/agents/schemas/brainstorm-output.schema.json +88 -0
- package/.github/agents/schemas/scout-output.schema.json +60 -0
- package/.github/agents/scripts/fetch-copilot-tools.js +245 -0
- package/.github/agents/scripts/lib/parse-agent-file.js +275 -0
- package/.github/agents/scripts/package-lock.json +78 -0
- package/.github/agents/scripts/package.json +22 -0
- package/.github/agents/scripts/schemas/agent-frontmatter.schema.json +83 -0
- package/.github/agents/scripts/validate-agent-all.js +157 -0
- package/.github/agents/scripts/validate-agent-frontmatter.js +96 -0
- package/.github/agents/scripts/validate-agent-handoffs.js +169 -0
- package/.github/agents/scripts/validate-agent-output.js +157 -0
- package/.github/agents/scripts/validate-agent-tools.js +278 -0
- package/.github/skills/.env.example +100 -0
- package/.github/skills/.install-state.json +23 -0
- package/.github/skills/README.md +149 -0
- package/.github/skills/ai-multimodal/.env.example +204 -0
- package/.github/skills/ai-multimodal/scripts/.coverage +0 -0
- package/.github/skills/ai-multimodal/scripts/check_setup.py +305 -0
- package/.github/skills/ai-multimodal/scripts/document_converter.py +395 -0
- package/.github/skills/ai-multimodal/scripts/gemini_batch_process.py +1184 -0
- package/.github/skills/ai-multimodal/scripts/media_optimizer.py +506 -0
- package/.github/skills/ai-multimodal/scripts/requirements.txt +26 -0
- package/.github/skills/better-auth/scripts/.coverage +0 -0
- package/.github/skills/better-auth/scripts/better_auth_init.py +521 -0
- package/.github/skills/better-auth/scripts/requirements.txt +15 -0
- package/.github/skills/chrome-devtools/scripts/README.md +272 -0
- package/.github/skills/chrome-devtools/scripts/__tests__/selector.test.js +210 -0
- package/.github/skills/chrome-devtools/scripts/aria-snapshot.js +362 -0
- package/.github/skills/chrome-devtools/scripts/click.js +83 -0
- package/.github/skills/chrome-devtools/scripts/console.js +79 -0
- package/.github/skills/chrome-devtools/scripts/evaluate.js +53 -0
- package/.github/skills/chrome-devtools/scripts/fill.js +76 -0
- package/.github/skills/chrome-devtools/scripts/inject-auth.js +229 -0
- package/.github/skills/chrome-devtools/scripts/install-deps.sh +181 -0
- package/.github/skills/chrome-devtools/scripts/install.sh +83 -0
- package/.github/skills/chrome-devtools/scripts/lib/browser.js +318 -0
- package/.github/skills/chrome-devtools/scripts/lib/selector.js +178 -0
- package/.github/skills/chrome-devtools/scripts/navigate.js +54 -0
- package/.github/skills/chrome-devtools/scripts/network.js +106 -0
- package/.github/skills/chrome-devtools/scripts/package-lock.json +1589 -0
- package/.github/skills/chrome-devtools/scripts/package.json +16 -0
- package/.github/skills/chrome-devtools/scripts/performance.js +149 -0
- package/.github/skills/chrome-devtools/scripts/screenshot.js +198 -0
- package/.github/skills/chrome-devtools/scripts/select-ref.js +131 -0
- package/.github/skills/chrome-devtools/scripts/snapshot.js +135 -0
- package/.github/skills/common/README.md +120 -0
- package/.github/skills/common/api_key_helper.py +411 -0
- package/.github/skills/common/api_key_rotator.py +248 -0
- package/.github/skills/databases/scripts/.coverage +0 -0
- package/.github/skills/databases/scripts/db_backup.py +502 -0
- package/.github/skills/databases/scripts/db_migrate.py +425 -0
- package/.github/skills/databases/scripts/db_performance_check.py +456 -0
- package/.github/skills/databases/scripts/requirements.txt +20 -0
- package/.github/skills/debugging/scripts/find-polluter.sh +63 -0
- package/.github/skills/devops/.env.example +76 -0
- package/.github/skills/devops/scripts/cloudflare_deploy.py +269 -0
- package/.github/skills/devops/scripts/docker_optimize.py +331 -0
- package/.github/skills/devops/scripts/requirements.txt +20 -0
- package/.github/skills/docs-seeker/.env.example +15 -0
- package/.github/skills/docs-seeker/package.json +25 -0
- package/.github/skills/docs-seeker/scripts/analyze-llms-txt.js +211 -0
- package/.github/skills/docs-seeker/scripts/detect-topic.js +172 -0
- package/.github/skills/docs-seeker/scripts/fetch-docs.js +213 -0
- package/.github/skills/docs-seeker/scripts/utils/env-loader.js +94 -0
- package/.github/skills/document-skills/docx/LICENSE.txt +30 -0
- package/.github/skills/document-skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-chart.xsd +1499 -0
- package/.github/skills/document-skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-chartDrawing.xsd +146 -0
- package/.github/skills/document-skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-diagram.xsd +1085 -0
- package/.github/skills/document-skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-lockedCanvas.xsd +11 -0
- package/.github/skills/document-skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-main.xsd +3081 -0
- package/.github/skills/document-skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-picture.xsd +23 -0
- package/.github/skills/document-skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-spreadsheetDrawing.xsd +185 -0
- package/.github/skills/document-skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-wordprocessingDrawing.xsd +287 -0
- package/.github/skills/document-skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/pml.xsd +1676 -0
- package/.github/skills/document-skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-additionalCharacteristics.xsd +28 -0
- package/.github/skills/document-skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-bibliography.xsd +144 -0
- package/.github/skills/document-skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-commonSimpleTypes.xsd +174 -0
- package/.github/skills/document-skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-customXmlDataProperties.xsd +25 -0
- package/.github/skills/document-skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-customXmlSchemaProperties.xsd +18 -0
- package/.github/skills/document-skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesCustom.xsd +59 -0
- package/.github/skills/document-skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesExtended.xsd +56 -0
- package/.github/skills/document-skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesVariantTypes.xsd +195 -0
- package/.github/skills/document-skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-math.xsd +582 -0
- package/.github/skills/document-skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-relationshipReference.xsd +25 -0
- package/.github/skills/document-skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/sml.xsd +4439 -0
- package/.github/skills/document-skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/vml-main.xsd +570 -0
- package/.github/skills/document-skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/vml-officeDrawing.xsd +509 -0
- package/.github/skills/document-skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/vml-presentationDrawing.xsd +12 -0
- package/.github/skills/document-skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/vml-spreadsheetDrawing.xsd +108 -0
- package/.github/skills/document-skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/vml-wordprocessingDrawing.xsd +96 -0
- package/.github/skills/document-skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/wml.xsd +3646 -0
- package/.github/skills/document-skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/xml.xsd +116 -0
- package/.github/skills/document-skills/docx/ooxml/schemas/ecma/fouth-edition/opc-contentTypes.xsd +42 -0
- package/.github/skills/document-skills/docx/ooxml/schemas/ecma/fouth-edition/opc-coreProperties.xsd +50 -0
- package/.github/skills/document-skills/docx/ooxml/schemas/ecma/fouth-edition/opc-digSig.xsd +49 -0
- package/.github/skills/document-skills/docx/ooxml/schemas/ecma/fouth-edition/opc-relationships.xsd +33 -0
- package/.github/skills/document-skills/docx/ooxml/schemas/mce/mc.xsd +75 -0
- package/.github/skills/document-skills/docx/ooxml/schemas/microsoft/wml-2010.xsd +560 -0
- package/.github/skills/document-skills/docx/ooxml/schemas/microsoft/wml-2012.xsd +67 -0
- package/.github/skills/document-skills/docx/ooxml/schemas/microsoft/wml-2018.xsd +14 -0
- package/.github/skills/document-skills/docx/ooxml/schemas/microsoft/wml-cex-2018.xsd +20 -0
- package/.github/skills/document-skills/docx/ooxml/schemas/microsoft/wml-cid-2016.xsd +13 -0
- package/.github/skills/document-skills/docx/ooxml/schemas/microsoft/wml-sdtdatahash-2020.xsd +4 -0
- package/.github/skills/document-skills/docx/ooxml/schemas/microsoft/wml-symex-2015.xsd +8 -0
- package/.github/skills/document-skills/docx/ooxml/scripts/pack.py +159 -0
- package/.github/skills/document-skills/docx/ooxml/scripts/unpack.py +29 -0
- package/.github/skills/document-skills/docx/ooxml/scripts/validate.py +69 -0
- package/.github/skills/document-skills/docx/ooxml/scripts/validation/__init__.py +15 -0
- package/.github/skills/document-skills/docx/ooxml/scripts/validation/base.py +951 -0
- package/.github/skills/document-skills/docx/ooxml/scripts/validation/docx.py +274 -0
- package/.github/skills/document-skills/docx/ooxml/scripts/validation/pptx.py +315 -0
- package/.github/skills/document-skills/docx/ooxml/scripts/validation/redlining.py +279 -0
- package/.github/skills/document-skills/docx/scripts/__init__.py +1 -0
- package/.github/skills/document-skills/docx/scripts/document.py +1276 -0
- package/.github/skills/document-skills/docx/scripts/templates/comments.xml +3 -0
- package/.github/skills/document-skills/docx/scripts/templates/commentsExtended.xml +3 -0
- package/.github/skills/document-skills/docx/scripts/templates/commentsExtensible.xml +3 -0
- package/.github/skills/document-skills/docx/scripts/templates/commentsIds.xml +3 -0
- package/.github/skills/document-skills/docx/scripts/templates/people.xml +3 -0
- package/.github/skills/document-skills/docx/scripts/utilities.py +374 -0
- package/.github/skills/document-skills/pdf/LICENSE.txt +30 -0
- package/.github/skills/document-skills/pdf/scripts/check_bounding_boxes.py +70 -0
- package/.github/skills/document-skills/pdf/scripts/check_bounding_boxes_test.py +226 -0
- package/.github/skills/document-skills/pdf/scripts/check_fillable_fields.py +12 -0
- package/.github/skills/document-skills/pdf/scripts/convert_pdf_to_images.py +35 -0
- package/.github/skills/document-skills/pdf/scripts/create_validation_image.py +41 -0
- package/.github/skills/document-skills/pdf/scripts/extract_form_field_info.py +152 -0
- package/.github/skills/document-skills/pdf/scripts/fill_fillable_fields.py +114 -0
- package/.github/skills/document-skills/pdf/scripts/fill_pdf_form_with_annotations.py +108 -0
- package/.github/skills/document-skills/pptx/LICENSE.txt +30 -0
- package/.github/skills/document-skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-chart.xsd +1499 -0
- package/.github/skills/document-skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-chartDrawing.xsd +146 -0
- package/.github/skills/document-skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-diagram.xsd +1085 -0
- package/.github/skills/document-skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-lockedCanvas.xsd +11 -0
- package/.github/skills/document-skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-main.xsd +3081 -0
- package/.github/skills/document-skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-picture.xsd +23 -0
- package/.github/skills/document-skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-spreadsheetDrawing.xsd +185 -0
- package/.github/skills/document-skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-wordprocessingDrawing.xsd +287 -0
- package/.github/skills/document-skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/pml.xsd +1676 -0
- package/.github/skills/document-skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-additionalCharacteristics.xsd +28 -0
- package/.github/skills/document-skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-bibliography.xsd +144 -0
- package/.github/skills/document-skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-commonSimpleTypes.xsd +174 -0
- package/.github/skills/document-skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-customXmlDataProperties.xsd +25 -0
- package/.github/skills/document-skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-customXmlSchemaProperties.xsd +18 -0
- package/.github/skills/document-skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesCustom.xsd +59 -0
- package/.github/skills/document-skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesExtended.xsd +56 -0
- package/.github/skills/document-skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesVariantTypes.xsd +195 -0
- package/.github/skills/document-skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-math.xsd +582 -0
- package/.github/skills/document-skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-relationshipReference.xsd +25 -0
- package/.github/skills/document-skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/sml.xsd +4439 -0
- package/.github/skills/document-skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/vml-main.xsd +570 -0
- package/.github/skills/document-skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/vml-officeDrawing.xsd +509 -0
- package/.github/skills/document-skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/vml-presentationDrawing.xsd +12 -0
- package/.github/skills/document-skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/vml-spreadsheetDrawing.xsd +108 -0
- package/.github/skills/document-skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/vml-wordprocessingDrawing.xsd +96 -0
- package/.github/skills/document-skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/wml.xsd +3646 -0
- package/.github/skills/document-skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/xml.xsd +116 -0
- package/.github/skills/document-skills/pptx/ooxml/schemas/ecma/fouth-edition/opc-contentTypes.xsd +42 -0
- package/.github/skills/document-skills/pptx/ooxml/schemas/ecma/fouth-edition/opc-coreProperties.xsd +50 -0
- package/.github/skills/document-skills/pptx/ooxml/schemas/ecma/fouth-edition/opc-digSig.xsd +49 -0
- package/.github/skills/document-skills/pptx/ooxml/schemas/ecma/fouth-edition/opc-relationships.xsd +33 -0
- package/.github/skills/document-skills/pptx/ooxml/schemas/mce/mc.xsd +75 -0
- package/.github/skills/document-skills/pptx/ooxml/schemas/microsoft/wml-2010.xsd +560 -0
- package/.github/skills/document-skills/pptx/ooxml/schemas/microsoft/wml-2012.xsd +67 -0
- package/.github/skills/document-skills/pptx/ooxml/schemas/microsoft/wml-2018.xsd +14 -0
- package/.github/skills/document-skills/pptx/ooxml/schemas/microsoft/wml-cex-2018.xsd +20 -0
- package/.github/skills/document-skills/pptx/ooxml/schemas/microsoft/wml-cid-2016.xsd +13 -0
- package/.github/skills/document-skills/pptx/ooxml/schemas/microsoft/wml-sdtdatahash-2020.xsd +4 -0
- package/.github/skills/document-skills/pptx/ooxml/schemas/microsoft/wml-symex-2015.xsd +8 -0
- package/.github/skills/document-skills/pptx/ooxml/scripts/pack.py +159 -0
- package/.github/skills/document-skills/pptx/ooxml/scripts/unpack.py +29 -0
- package/.github/skills/document-skills/pptx/ooxml/scripts/validate.py +69 -0
- package/.github/skills/document-skills/pptx/ooxml/scripts/validation/__init__.py +15 -0
- package/.github/skills/document-skills/pptx/ooxml/scripts/validation/base.py +951 -0
- package/.github/skills/document-skills/pptx/ooxml/scripts/validation/docx.py +274 -0
- package/.github/skills/document-skills/pptx/ooxml/scripts/validation/pptx.py +315 -0
- package/.github/skills/document-skills/pptx/ooxml/scripts/validation/redlining.py +279 -0
- package/.github/skills/document-skills/pptx/scripts/html2pptx.js +979 -0
- package/.github/skills/document-skills/pptx/scripts/inventory.py +1020 -0
- package/.github/skills/document-skills/pptx/scripts/rearrange.py +231 -0
- package/.github/skills/document-skills/pptx/scripts/replace.py +385 -0
- package/.github/skills/document-skills/pptx/scripts/thumbnail.py +450 -0
- package/.github/skills/document-skills/xlsx/LICENSE.txt +30 -0
- package/.github/skills/document-skills/xlsx/recalc.py +190 -0
- package/.github/skills/install.ps1 +1220 -0
- package/.github/skills/install.sh +1032 -0
- package/.github/skills/markdown-novel-viewer/assets/directory-browser.css +215 -0
- package/.github/skills/markdown-novel-viewer/assets/favicon.png +0 -0
- package/.github/skills/markdown-novel-viewer/assets/novel-theme.css +818 -0
- package/.github/skills/markdown-novel-viewer/assets/reader.js +262 -0
- package/.github/skills/markdown-novel-viewer/assets/template.html +80 -0
- package/.github/skills/markdown-novel-viewer/package-lock.json +146 -0
- package/.github/skills/markdown-novel-viewer/package.json +15 -0
- package/.github/skills/markdown-novel-viewer/scripts/lib/http-server.cjs +434 -0
- package/.github/skills/markdown-novel-viewer/scripts/lib/markdown-renderer.cjs +272 -0
- package/.github/skills/markdown-novel-viewer/scripts/lib/plan-navigator.cjs +509 -0
- package/.github/skills/markdown-novel-viewer/scripts/lib/port-finder.cjs +48 -0
- package/.github/skills/markdown-novel-viewer/scripts/lib/process-mgr.cjs +150 -0
- package/.github/skills/markdown-novel-viewer/scripts/server.cjs +411 -0
- package/.github/skills/mcp-builder/LICENSE.txt +202 -0
- package/.github/skills/mcp-builder/scripts/connections.py +151 -0
- package/.github/skills/mcp-builder/scripts/evaluation.py +373 -0
- package/.github/skills/mcp-builder/scripts/example_evaluation.xml +22 -0
- package/.github/skills/mcp-builder/scripts/requirements.txt +2 -0
- package/.github/skills/mcp-management/README.md +219 -0
- package/.github/skills/mcp-management/assets/tools.json +3146 -0
- package/.github/skills/mcp-management/package-lock.json +6 -0
- package/.github/skills/mcp-management/scripts/.env.example +10 -0
- package/.github/skills/mcp-management/scripts/cli.ts +195 -0
- package/.github/skills/mcp-management/scripts/dist/analyze-tools.js +70 -0
- package/.github/skills/mcp-management/scripts/dist/cli.js +160 -0
- package/.github/skills/mcp-management/scripts/dist/mcp-client.js +183 -0
- package/.github/skills/mcp-management/scripts/mcp-client.ts +230 -0
- package/.github/skills/mcp-management/scripts/package.json +20 -0
- package/.github/skills/media-processing/scripts/README.md +111 -0
- package/.github/skills/media-processing/scripts/batch-remove-background.sh +124 -0
- package/.github/skills/media-processing/scripts/batch_resize.py +342 -0
- package/.github/skills/media-processing/scripts/media_convert.py +311 -0
- package/.github/skills/media-processing/scripts/remove-background.sh +96 -0
- package/.github/skills/media-processing/scripts/remove-bg-node.js +158 -0
- package/.github/skills/media-processing/scripts/requirements.txt +24 -0
- package/.github/skills/media-processing/scripts/video_optimize.py +414 -0
- package/.github/skills/payment-integration/README.md +185 -0
- package/.github/skills/payment-integration/scripts/.env.example +20 -0
- package/.github/skills/payment-integration/scripts/checkout-helper.js +244 -0
- package/.github/skills/payment-integration/scripts/package.json +17 -0
- package/.github/skills/payment-integration/scripts/polar-webhook-verify.js +202 -0
- package/.github/skills/payment-integration/scripts/sepay-webhook-verify.js +193 -0
- package/.github/skills/payment-integration/scripts/test-scripts.js +237 -0
- package/.github/skills/plans-kanban/assets/dashboard-template.html +119 -0
- package/.github/skills/plans-kanban/assets/dashboard.css +1594 -0
- package/.github/skills/plans-kanban/assets/dashboard.js +596 -0
- package/.github/skills/plans-kanban/assets/favicon.png +0 -0
- package/.github/skills/plans-kanban/package-lock.json +123 -0
- package/.github/skills/plans-kanban/package.json +13 -0
- package/.github/skills/plans-kanban/scripts/lib/dashboard-renderer.cjs +884 -0
- package/.github/skills/plans-kanban/scripts/lib/http-server.cjs +310 -0
- package/.github/skills/plans-kanban/scripts/lib/plan-metadata-extractor.cjs +489 -0
- package/.github/skills/plans-kanban/scripts/lib/plan-parser.cjs +175 -0
- package/.github/skills/plans-kanban/scripts/lib/plan-scanner.cjs +272 -0
- package/.github/skills/plans-kanban/scripts/lib/port-finder.cjs +48 -0
- package/.github/skills/plans-kanban/scripts/lib/process-mgr.cjs +128 -0
- package/.github/skills/plans-kanban/scripts/server.cjs +260 -0
- package/.github/skills/repomix/scripts/.coverage +0 -0
- package/.github/skills/repomix/scripts/README.md +179 -0
- package/.github/skills/repomix/scripts/repomix_batch.py +455 -0
- package/.github/skills/repomix/scripts/repos.example.json +15 -0
- package/.github/skills/repomix/scripts/requirements.txt +15 -0
- package/.github/skills/scout-validation/scripts/lib/broad-pattern-detector.cjs +124 -0
- package/.github/skills/scout-validation/scripts/lib/path-checker.cjs +66 -0
- package/.github/skills/scout-validation/scripts/lib/schema-validator.cjs +45 -0
- package/.github/skills/scout-validation/scripts/package.json +11 -0
- package/.github/skills/scout-validation/scripts/validate-scout-output.cjs +219 -0
- package/.github/skills/scout-validation/test/broad-pattern-output.json +18 -0
- package/.github/skills/scout-validation/test/invalid-path-output.json +18 -0
- package/.github/skills/scout-validation/test/valid-scout-output.json +26 -0
- package/.github/skills/sequential-thinking/.env.example +8 -0
- package/.github/skills/sequential-thinking/README.md +183 -0
- package/.github/skills/sequential-thinking/package.json +31 -0
- package/.github/skills/sequential-thinking/scripts/format-thought.js +159 -0
- package/.github/skills/sequential-thinking/scripts/process-thought.js +236 -0
- package/.github/skills/shopify/README.md +66 -0
- package/.github/skills/shopify/scripts/.coverage +0 -0
- package/.github/skills/shopify/scripts/requirements.txt +19 -0
- package/.github/skills/shopify/scripts/shopify_init.py +423 -0
- package/.github/skills/skill-creator/LICENSE.txt +202 -0
- package/.github/skills/skill-creator/scripts/init_skill.py +303 -0
- package/.github/skills/skill-creator/scripts/package_skill.py +110 -0
- package/.github/skills/skill-creator/scripts/quick_validate.py +65 -0
- package/.github/skills/ui-styling/LICENSE.txt +202 -0
- package/.github/skills/ui-styling/canvas-fonts/ArsenalSC-OFL.txt +93 -0
- package/.github/skills/ui-styling/canvas-fonts/ArsenalSC-Regular.ttf +0 -0
- package/.github/skills/ui-styling/canvas-fonts/BigShoulders-Bold.ttf +0 -0
- package/.github/skills/ui-styling/canvas-fonts/BigShoulders-OFL.txt +93 -0
- package/.github/skills/ui-styling/canvas-fonts/BigShoulders-Regular.ttf +0 -0
- package/.github/skills/ui-styling/canvas-fonts/Boldonse-OFL.txt +93 -0
- package/.github/skills/ui-styling/canvas-fonts/Boldonse-Regular.ttf +0 -0
- package/.github/skills/ui-styling/canvas-fonts/BricolageGrotesque-Bold.ttf +0 -0
- package/.github/skills/ui-styling/canvas-fonts/BricolageGrotesque-OFL.txt +93 -0
- package/.github/skills/ui-styling/canvas-fonts/BricolageGrotesque-Regular.ttf +0 -0
- package/.github/skills/ui-styling/canvas-fonts/CrimsonPro-Bold.ttf +0 -0
- package/.github/skills/ui-styling/canvas-fonts/CrimsonPro-Italic.ttf +0 -0
- package/.github/skills/ui-styling/canvas-fonts/CrimsonPro-OFL.txt +93 -0
- package/.github/skills/ui-styling/canvas-fonts/CrimsonPro-Regular.ttf +0 -0
- package/.github/skills/ui-styling/canvas-fonts/DMMono-OFL.txt +93 -0
- package/.github/skills/ui-styling/canvas-fonts/DMMono-Regular.ttf +0 -0
- package/.github/skills/ui-styling/canvas-fonts/EricaOne-OFL.txt +94 -0
- package/.github/skills/ui-styling/canvas-fonts/EricaOne-Regular.ttf +0 -0
- package/.github/skills/ui-styling/canvas-fonts/GeistMono-Bold.ttf +0 -0
- package/.github/skills/ui-styling/canvas-fonts/GeistMono-OFL.txt +93 -0
- package/.github/skills/ui-styling/canvas-fonts/GeistMono-Regular.ttf +0 -0
- package/.github/skills/ui-styling/canvas-fonts/Gloock-OFL.txt +93 -0
- package/.github/skills/ui-styling/canvas-fonts/Gloock-Regular.ttf +0 -0
- package/.github/skills/ui-styling/canvas-fonts/IBMPlexMono-Bold.ttf +0 -0
- package/.github/skills/ui-styling/canvas-fonts/IBMPlexMono-OFL.txt +93 -0
- package/.github/skills/ui-styling/canvas-fonts/IBMPlexMono-Regular.ttf +0 -0
- package/.github/skills/ui-styling/canvas-fonts/IBMPlexSerif-Bold.ttf +0 -0
- package/.github/skills/ui-styling/canvas-fonts/IBMPlexSerif-BoldItalic.ttf +0 -0
- package/.github/skills/ui-styling/canvas-fonts/IBMPlexSerif-Italic.ttf +0 -0
- package/.github/skills/ui-styling/canvas-fonts/IBMPlexSerif-Regular.ttf +0 -0
- package/.github/skills/ui-styling/canvas-fonts/InstrumentSans-Bold.ttf +0 -0
- package/.github/skills/ui-styling/canvas-fonts/InstrumentSans-BoldItalic.ttf +0 -0
- package/.github/skills/ui-styling/canvas-fonts/InstrumentSans-Italic.ttf +0 -0
- package/.github/skills/ui-styling/canvas-fonts/InstrumentSans-OFL.txt +93 -0
- package/.github/skills/ui-styling/canvas-fonts/InstrumentSans-Regular.ttf +0 -0
- package/.github/skills/ui-styling/canvas-fonts/InstrumentSerif-Italic.ttf +0 -0
- package/.github/skills/ui-styling/canvas-fonts/InstrumentSerif-Regular.ttf +0 -0
- package/.github/skills/ui-styling/canvas-fonts/Italiana-OFL.txt +93 -0
- package/.github/skills/ui-styling/canvas-fonts/Italiana-Regular.ttf +0 -0
- package/.github/skills/ui-styling/canvas-fonts/JetBrainsMono-Bold.ttf +0 -0
- package/.github/skills/ui-styling/canvas-fonts/JetBrainsMono-OFL.txt +93 -0
- package/.github/skills/ui-styling/canvas-fonts/JetBrainsMono-Regular.ttf +0 -0
- package/.github/skills/ui-styling/canvas-fonts/Jura-Light.ttf +0 -0
- package/.github/skills/ui-styling/canvas-fonts/Jura-Medium.ttf +0 -0
- package/.github/skills/ui-styling/canvas-fonts/Jura-OFL.txt +93 -0
- package/.github/skills/ui-styling/canvas-fonts/LibreBaskerville-OFL.txt +93 -0
- package/.github/skills/ui-styling/canvas-fonts/LibreBaskerville-Regular.ttf +0 -0
- package/.github/skills/ui-styling/canvas-fonts/Lora-Bold.ttf +0 -0
- package/.github/skills/ui-styling/canvas-fonts/Lora-BoldItalic.ttf +0 -0
- package/.github/skills/ui-styling/canvas-fonts/Lora-Italic.ttf +0 -0
- package/.github/skills/ui-styling/canvas-fonts/Lora-OFL.txt +93 -0
- package/.github/skills/ui-styling/canvas-fonts/Lora-Regular.ttf +0 -0
- package/.github/skills/ui-styling/canvas-fonts/NationalPark-Bold.ttf +0 -0
- package/.github/skills/ui-styling/canvas-fonts/NationalPark-OFL.txt +93 -0
- package/.github/skills/ui-styling/canvas-fonts/NationalPark-Regular.ttf +0 -0
- package/.github/skills/ui-styling/canvas-fonts/NothingYouCouldDo-OFL.txt +93 -0
- package/.github/skills/ui-styling/canvas-fonts/NothingYouCouldDo-Regular.ttf +0 -0
- package/.github/skills/ui-styling/canvas-fonts/Outfit-Bold.ttf +0 -0
- package/.github/skills/ui-styling/canvas-fonts/Outfit-OFL.txt +93 -0
- package/.github/skills/ui-styling/canvas-fonts/Outfit-Regular.ttf +0 -0
- package/.github/skills/ui-styling/canvas-fonts/PixelifySans-Medium.ttf +0 -0
- package/.github/skills/ui-styling/canvas-fonts/PixelifySans-OFL.txt +93 -0
- package/.github/skills/ui-styling/canvas-fonts/PoiretOne-OFL.txt +93 -0
- package/.github/skills/ui-styling/canvas-fonts/PoiretOne-Regular.ttf +0 -0
- package/.github/skills/ui-styling/canvas-fonts/RedHatMono-Bold.ttf +0 -0
- package/.github/skills/ui-styling/canvas-fonts/RedHatMono-OFL.txt +93 -0
- package/.github/skills/ui-styling/canvas-fonts/RedHatMono-Regular.ttf +0 -0
- package/.github/skills/ui-styling/canvas-fonts/Silkscreen-OFL.txt +93 -0
- package/.github/skills/ui-styling/canvas-fonts/Silkscreen-Regular.ttf +0 -0
- package/.github/skills/ui-styling/canvas-fonts/SmoochSans-Medium.ttf +0 -0
- package/.github/skills/ui-styling/canvas-fonts/SmoochSans-OFL.txt +93 -0
- package/.github/skills/ui-styling/canvas-fonts/Tektur-Medium.ttf +0 -0
- package/.github/skills/ui-styling/canvas-fonts/Tektur-OFL.txt +93 -0
- package/.github/skills/ui-styling/canvas-fonts/Tektur-Regular.ttf +0 -0
- package/.github/skills/ui-styling/canvas-fonts/WorkSans-Bold.ttf +0 -0
- package/.github/skills/ui-styling/canvas-fonts/WorkSans-BoldItalic.ttf +0 -0
- package/.github/skills/ui-styling/canvas-fonts/WorkSans-Italic.ttf +0 -0
- package/.github/skills/ui-styling/canvas-fonts/WorkSans-OFL.txt +93 -0
- package/.github/skills/ui-styling/canvas-fonts/WorkSans-Regular.ttf +0 -0
- package/.github/skills/ui-styling/canvas-fonts/YoungSerif-OFL.txt +93 -0
- package/.github/skills/ui-styling/canvas-fonts/YoungSerif-Regular.ttf +0 -0
- package/.github/skills/ui-styling/scripts/.coverage +0 -0
- package/.github/skills/ui-styling/scripts/requirements.txt +17 -0
- package/.github/skills/ui-styling/scripts/shadcn_add.py +292 -0
- package/.github/skills/ui-styling/scripts/tailwind_config_gen.py +456 -0
- package/.github/skills/ui-ux-pro-max/data/charts.csv +26 -0
- package/.github/skills/ui-ux-pro-max/data/colors.csv +97 -0
- package/.github/skills/ui-ux-pro-max/data/landing.csv +31 -0
- package/.github/skills/ui-ux-pro-max/data/products.csv +97 -0
- package/.github/skills/ui-ux-pro-max/data/prompts.csv +24 -0
- package/.github/skills/ui-ux-pro-max/data/stacks/flutter.csv +53 -0
- package/.github/skills/ui-ux-pro-max/data/stacks/html-tailwind.csv +51 -0
- package/.github/skills/ui-ux-pro-max/data/stacks/nextjs.csv +53 -0
- package/.github/skills/ui-ux-pro-max/data/stacks/react-native.csv +52 -0
- package/.github/skills/ui-ux-pro-max/data/stacks/react.csv +54 -0
- package/.github/skills/ui-ux-pro-max/data/stacks/svelte.csv +54 -0
- package/.github/skills/ui-ux-pro-max/data/stacks/swiftui.csv +51 -0
- package/.github/skills/ui-ux-pro-max/data/stacks/vue.csv +50 -0
- package/.github/skills/ui-ux-pro-max/data/styles.csv +59 -0
- package/.github/skills/ui-ux-pro-max/data/typography.csv +58 -0
- package/.github/skills/ui-ux-pro-max/data/ux-guidelines.csv +100 -0
- package/.github/skills/ui-ux-pro-max/scripts/core.py +236 -0
- package/.github/skills/ui-ux-pro-max/scripts/search.py +76 -0
- package/.github/skills/web-frameworks/scripts/.coverage +0 -0
- package/.github/skills/web-frameworks/scripts/__init__.py +0 -0
- package/.github/skills/web-frameworks/scripts/nextjs_init.py +547 -0
- package/.github/skills/web-frameworks/scripts/requirements.txt +16 -0
- package/.github/skills/web-frameworks/scripts/turborepo_migrate.py +394 -0
- package/dist/config/constants.d.ts +3 -0
- package/dist/config/constants.d.ts.map +1 -1
- package/dist/config/constants.js +5 -1
- package/dist/config/constants.js.map +1 -1
- package/dist/domains/github/github-client.d.ts +5 -0
- package/dist/domains/github/github-client.d.ts.map +1 -1
- package/dist/domains/github/github-client.js +44 -0
- package/dist/domains/github/github-client.js.map +1 -1
- package/dist/utils/downloader.d.ts +3 -1
- package/dist/utils/downloader.d.ts.map +1 -1
- package/dist/utils/downloader.js +48 -11
- package/dist/utils/downloader.js.map +1 -1
- package/dist/utils/scaffolder.d.ts.map +1 -1
- package/dist/utils/scaffolder.js +2 -0
- package/dist/utils/scaffolder.js.map +1 -1
- package/package.json +3 -1
|
@@ -0,0 +1,456 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
Database performance analysis tool for MongoDB and PostgreSQL.
|
|
4
|
+
Analyzes slow queries, recommends indexes, and generates reports.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
import argparse
|
|
8
|
+
import json
|
|
9
|
+
import sys
|
|
10
|
+
from dataclasses import dataclass, asdict
|
|
11
|
+
from datetime import datetime
|
|
12
|
+
from pathlib import Path
|
|
13
|
+
from typing import Dict, List, Optional
|
|
14
|
+
|
|
15
|
+
# Windows UTF-8 compatibility
|
|
16
|
+
sys.path.insert(0, str(Path.home() / '.claude' / 'scripts'))
|
|
17
|
+
try:
|
|
18
|
+
from win_compat import ensure_utf8_stdout
|
|
19
|
+
ensure_utf8_stdout()
|
|
20
|
+
except ImportError:
|
|
21
|
+
if sys.platform == 'win32':
|
|
22
|
+
import io
|
|
23
|
+
if hasattr(sys.stdout, 'buffer'):
|
|
24
|
+
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
|
|
25
|
+
|
|
26
|
+
try:
|
|
27
|
+
from pymongo import MongoClient
|
|
28
|
+
MONGO_AVAILABLE = True
|
|
29
|
+
except ImportError:
|
|
30
|
+
MONGO_AVAILABLE = False
|
|
31
|
+
|
|
32
|
+
try:
|
|
33
|
+
import psycopg2
|
|
34
|
+
from psycopg2.extras import RealDictCursor
|
|
35
|
+
POSTGRES_AVAILABLE = True
|
|
36
|
+
except ImportError:
|
|
37
|
+
POSTGRES_AVAILABLE = False
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
@dataclass
|
|
41
|
+
class SlowQuery:
|
|
42
|
+
"""Represents a slow query."""
|
|
43
|
+
|
|
44
|
+
query: str
|
|
45
|
+
execution_time_ms: float
|
|
46
|
+
count: int
|
|
47
|
+
collection_or_table: Optional[str] = None
|
|
48
|
+
index_used: Optional[str] = None
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
@dataclass
|
|
52
|
+
class IndexRecommendation:
|
|
53
|
+
"""Index recommendation."""
|
|
54
|
+
|
|
55
|
+
collection_or_table: str
|
|
56
|
+
fields: List[str]
|
|
57
|
+
reason: str
|
|
58
|
+
estimated_benefit: str
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
@dataclass
|
|
62
|
+
class PerformanceReport:
|
|
63
|
+
"""Performance analysis report."""
|
|
64
|
+
|
|
65
|
+
database_type: str
|
|
66
|
+
database_name: str
|
|
67
|
+
timestamp: datetime
|
|
68
|
+
slow_queries: List[SlowQuery]
|
|
69
|
+
index_recommendations: List[IndexRecommendation]
|
|
70
|
+
database_metrics: Dict[str, any]
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
class PerformanceAnalyzer:
|
|
74
|
+
"""Analyzes database performance."""
|
|
75
|
+
|
|
76
|
+
def __init__(self, db_type: str, connection_string: str, threshold_ms: int = 100):
|
|
77
|
+
"""
|
|
78
|
+
Initialize performance analyzer.
|
|
79
|
+
|
|
80
|
+
Args:
|
|
81
|
+
db_type: Database type ('mongodb' or 'postgres')
|
|
82
|
+
connection_string: Database connection string
|
|
83
|
+
threshold_ms: Slow query threshold in milliseconds
|
|
84
|
+
"""
|
|
85
|
+
self.db_type = db_type.lower()
|
|
86
|
+
self.connection_string = connection_string
|
|
87
|
+
self.threshold_ms = threshold_ms
|
|
88
|
+
|
|
89
|
+
self.client = None
|
|
90
|
+
self.db = None
|
|
91
|
+
self.conn = None
|
|
92
|
+
|
|
93
|
+
def connect(self) -> bool:
|
|
94
|
+
"""Connect to database."""
|
|
95
|
+
try:
|
|
96
|
+
if self.db_type == "mongodb":
|
|
97
|
+
if not MONGO_AVAILABLE:
|
|
98
|
+
print("Error: pymongo not installed")
|
|
99
|
+
return False
|
|
100
|
+
self.client = MongoClient(self.connection_string)
|
|
101
|
+
self.db = self.client.get_default_database()
|
|
102
|
+
self.client.server_info()
|
|
103
|
+
return True
|
|
104
|
+
|
|
105
|
+
elif self.db_type == "postgres":
|
|
106
|
+
if not POSTGRES_AVAILABLE:
|
|
107
|
+
print("Error: psycopg2 not installed")
|
|
108
|
+
return False
|
|
109
|
+
self.conn = psycopg2.connect(self.connection_string)
|
|
110
|
+
return True
|
|
111
|
+
|
|
112
|
+
else:
|
|
113
|
+
print(f"Error: Unsupported database type: {self.db_type}")
|
|
114
|
+
return False
|
|
115
|
+
|
|
116
|
+
except Exception as e:
|
|
117
|
+
print(f"Connection error: {e}")
|
|
118
|
+
return False
|
|
119
|
+
|
|
120
|
+
def disconnect(self):
|
|
121
|
+
"""Disconnect from database."""
|
|
122
|
+
try:
|
|
123
|
+
if self.client:
|
|
124
|
+
self.client.close()
|
|
125
|
+
if self.conn:
|
|
126
|
+
self.conn.close()
|
|
127
|
+
except Exception as e:
|
|
128
|
+
print(f"Disconnect error: {e}")
|
|
129
|
+
|
|
130
|
+
def analyze(self) -> Optional[PerformanceReport]:
|
|
131
|
+
"""
|
|
132
|
+
Analyze database performance.
|
|
133
|
+
|
|
134
|
+
Returns:
|
|
135
|
+
PerformanceReport if successful, None otherwise
|
|
136
|
+
"""
|
|
137
|
+
try:
|
|
138
|
+
if self.db_type == "mongodb":
|
|
139
|
+
return self._analyze_mongodb()
|
|
140
|
+
elif self.db_type == "postgres":
|
|
141
|
+
return self._analyze_postgres()
|
|
142
|
+
else:
|
|
143
|
+
return None
|
|
144
|
+
|
|
145
|
+
except Exception as e:
|
|
146
|
+
print(f"Analysis error: {e}")
|
|
147
|
+
return None
|
|
148
|
+
|
|
149
|
+
def _analyze_mongodb(self) -> PerformanceReport:
|
|
150
|
+
"""Analyze MongoDB performance."""
|
|
151
|
+
slow_queries = []
|
|
152
|
+
index_recommendations = []
|
|
153
|
+
|
|
154
|
+
# Enable profiling if not enabled
|
|
155
|
+
profiling_level = self.db.command("profile", -1)
|
|
156
|
+
if profiling_level.get("was", 0) == 0:
|
|
157
|
+
self.db.command("profile", 1, slowms=self.threshold_ms)
|
|
158
|
+
|
|
159
|
+
# Get slow queries from system.profile
|
|
160
|
+
for doc in self.db.system.profile.find(
|
|
161
|
+
{"millis": {"$gte": self.threshold_ms}},
|
|
162
|
+
limit=50
|
|
163
|
+
).sort("millis", -1):
|
|
164
|
+
|
|
165
|
+
query_str = json.dumps(doc.get("command", {}), default=str)
|
|
166
|
+
|
|
167
|
+
slow_queries.append(SlowQuery(
|
|
168
|
+
query=query_str,
|
|
169
|
+
execution_time_ms=doc.get("millis", 0),
|
|
170
|
+
count=1,
|
|
171
|
+
collection_or_table=doc.get("ns", "").split(".")[-1] if "ns" in doc else None,
|
|
172
|
+
index_used=doc.get("planSummary")
|
|
173
|
+
))
|
|
174
|
+
|
|
175
|
+
# Analyze collections for index recommendations
|
|
176
|
+
for coll_name in self.db.list_collection_names():
|
|
177
|
+
if coll_name.startswith("system."):
|
|
178
|
+
continue
|
|
179
|
+
|
|
180
|
+
coll = self.db[coll_name]
|
|
181
|
+
|
|
182
|
+
# Check for collections scans
|
|
183
|
+
stats = coll.aggregate([
|
|
184
|
+
{"$collStats": {"storageStats": {}}}
|
|
185
|
+
]).next()
|
|
186
|
+
|
|
187
|
+
# Check if collection has indexes
|
|
188
|
+
indexes = list(coll.list_indexes())
|
|
189
|
+
|
|
190
|
+
if len(indexes) <= 1: # Only _id index
|
|
191
|
+
# Recommend indexes based on common patterns
|
|
192
|
+
# Sample documents to find frequently queried fields
|
|
193
|
+
sample = list(coll.find().limit(100))
|
|
194
|
+
|
|
195
|
+
if sample:
|
|
196
|
+
# Find fields that appear in most documents
|
|
197
|
+
field_freq = {}
|
|
198
|
+
for doc in sample:
|
|
199
|
+
for field in doc.keys():
|
|
200
|
+
if field != "_id":
|
|
201
|
+
field_freq[field] = field_freq.get(field, 0) + 1
|
|
202
|
+
|
|
203
|
+
# Recommend index on most common field
|
|
204
|
+
if field_freq:
|
|
205
|
+
top_field = max(field_freq.items(), key=lambda x: x[1])[0]
|
|
206
|
+
index_recommendations.append(IndexRecommendation(
|
|
207
|
+
collection_or_table=coll_name,
|
|
208
|
+
fields=[top_field],
|
|
209
|
+
reason="Frequently queried field without index",
|
|
210
|
+
estimated_benefit="High"
|
|
211
|
+
))
|
|
212
|
+
|
|
213
|
+
# Get database metrics
|
|
214
|
+
server_status = self.client.admin.command("serverStatus")
|
|
215
|
+
db_stats = self.db.command("dbStats")
|
|
216
|
+
|
|
217
|
+
metrics = {
|
|
218
|
+
"connections": server_status.get("connections", {}).get("current", 0),
|
|
219
|
+
"operations_per_sec": server_status.get("opcounters", {}).get("query", 0),
|
|
220
|
+
"database_size_mb": db_stats.get("dataSize", 0) / (1024 * 1024),
|
|
221
|
+
"index_size_mb": db_stats.get("indexSize", 0) / (1024 * 1024),
|
|
222
|
+
"collections": db_stats.get("collections", 0)
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
return PerformanceReport(
|
|
226
|
+
database_type="mongodb",
|
|
227
|
+
database_name=self.db.name,
|
|
228
|
+
timestamp=datetime.now(),
|
|
229
|
+
slow_queries=slow_queries[:10], # Top 10
|
|
230
|
+
index_recommendations=index_recommendations,
|
|
231
|
+
database_metrics=metrics
|
|
232
|
+
)
|
|
233
|
+
|
|
234
|
+
def _analyze_postgres(self) -> PerformanceReport:
|
|
235
|
+
"""Analyze PostgreSQL performance."""
|
|
236
|
+
slow_queries = []
|
|
237
|
+
index_recommendations = []
|
|
238
|
+
|
|
239
|
+
with self.conn.cursor(cursor_factory=RealDictCursor) as cur:
|
|
240
|
+
# Check if pg_stat_statements extension is available
|
|
241
|
+
cur.execute("""
|
|
242
|
+
SELECT EXISTS (
|
|
243
|
+
SELECT 1 FROM pg_extension WHERE extname = 'pg_stat_statements'
|
|
244
|
+
) AS has_extension
|
|
245
|
+
""")
|
|
246
|
+
has_pg_stat_statements = cur.fetchone()["has_extension"]
|
|
247
|
+
|
|
248
|
+
if has_pg_stat_statements:
|
|
249
|
+
# Get slow queries from pg_stat_statements
|
|
250
|
+
cur.execute("""
|
|
251
|
+
SELECT
|
|
252
|
+
query,
|
|
253
|
+
mean_exec_time,
|
|
254
|
+
calls,
|
|
255
|
+
total_exec_time
|
|
256
|
+
FROM pg_stat_statements
|
|
257
|
+
WHERE mean_exec_time >= %s
|
|
258
|
+
ORDER BY mean_exec_time DESC
|
|
259
|
+
LIMIT 10
|
|
260
|
+
""", (self.threshold_ms,))
|
|
261
|
+
|
|
262
|
+
for row in cur.fetchall():
|
|
263
|
+
slow_queries.append(SlowQuery(
|
|
264
|
+
query=row["query"],
|
|
265
|
+
execution_time_ms=row["mean_exec_time"],
|
|
266
|
+
count=row["calls"]
|
|
267
|
+
))
|
|
268
|
+
|
|
269
|
+
# Find tables with sequential scans (potential index candidates)
|
|
270
|
+
cur.execute("""
|
|
271
|
+
SELECT
|
|
272
|
+
schemaname,
|
|
273
|
+
tablename,
|
|
274
|
+
seq_scan,
|
|
275
|
+
seq_tup_read,
|
|
276
|
+
idx_scan
|
|
277
|
+
FROM pg_stat_user_tables
|
|
278
|
+
WHERE seq_scan > 1000
|
|
279
|
+
AND (idx_scan IS NULL OR seq_scan > idx_scan * 2)
|
|
280
|
+
ORDER BY seq_tup_read DESC
|
|
281
|
+
LIMIT 10
|
|
282
|
+
""")
|
|
283
|
+
|
|
284
|
+
for row in cur.fetchall():
|
|
285
|
+
index_recommendations.append(IndexRecommendation(
|
|
286
|
+
collection_or_table=f"{row['schemaname']}.{row['tablename']}",
|
|
287
|
+
fields=["<analyze query patterns>"],
|
|
288
|
+
reason=f"High sequential scans ({row['seq_scan']}) vs index scans ({row['idx_scan'] or 0})",
|
|
289
|
+
estimated_benefit="High" if row["seq_tup_read"] > 100000 else "Medium"
|
|
290
|
+
))
|
|
291
|
+
|
|
292
|
+
# Find unused indexes
|
|
293
|
+
cur.execute("""
|
|
294
|
+
SELECT
|
|
295
|
+
schemaname,
|
|
296
|
+
tablename,
|
|
297
|
+
indexname,
|
|
298
|
+
idx_scan
|
|
299
|
+
FROM pg_stat_user_indexes
|
|
300
|
+
WHERE idx_scan = 0
|
|
301
|
+
AND indexname NOT LIKE '%_pkey'
|
|
302
|
+
ORDER BY pg_relation_size(indexrelid) DESC
|
|
303
|
+
""")
|
|
304
|
+
|
|
305
|
+
unused_indexes = []
|
|
306
|
+
for row in cur.fetchall():
|
|
307
|
+
unused_indexes.append(
|
|
308
|
+
f"{row['schemaname']}.{row['tablename']}.{row['indexname']}"
|
|
309
|
+
)
|
|
310
|
+
|
|
311
|
+
# Database metrics
|
|
312
|
+
cur.execute("""
|
|
313
|
+
SELECT
|
|
314
|
+
sum(numbackends) AS connections,
|
|
315
|
+
sum(xact_commit) AS commits,
|
|
316
|
+
sum(xact_rollback) AS rollbacks
|
|
317
|
+
FROM pg_stat_database
|
|
318
|
+
WHERE datname = current_database()
|
|
319
|
+
""")
|
|
320
|
+
stats = cur.fetchone()
|
|
321
|
+
|
|
322
|
+
cur.execute("""
|
|
323
|
+
SELECT pg_database_size(current_database()) AS db_size
|
|
324
|
+
""")
|
|
325
|
+
db_size = cur.fetchone()["db_size"]
|
|
326
|
+
|
|
327
|
+
cur.execute("""
|
|
328
|
+
SELECT
|
|
329
|
+
sum(heap_blks_hit) / NULLIF(sum(heap_blks_hit) + sum(heap_blks_read), 0) AS cache_hit_ratio
|
|
330
|
+
FROM pg_statio_user_tables
|
|
331
|
+
""")
|
|
332
|
+
cache_ratio = cur.fetchone()["cache_hit_ratio"] or 0
|
|
333
|
+
|
|
334
|
+
metrics = {
|
|
335
|
+
"connections": stats["connections"],
|
|
336
|
+
"commits": stats["commits"],
|
|
337
|
+
"rollbacks": stats["rollbacks"],
|
|
338
|
+
"database_size_mb": db_size / (1024 * 1024),
|
|
339
|
+
"cache_hit_ratio": float(cache_ratio),
|
|
340
|
+
"unused_indexes": unused_indexes
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
return PerformanceReport(
|
|
344
|
+
database_type="postgres",
|
|
345
|
+
database_name=self.conn.info.dbname,
|
|
346
|
+
timestamp=datetime.now(),
|
|
347
|
+
slow_queries=slow_queries,
|
|
348
|
+
index_recommendations=index_recommendations,
|
|
349
|
+
database_metrics=metrics
|
|
350
|
+
)
|
|
351
|
+
|
|
352
|
+
def print_report(self, report: PerformanceReport):
|
|
353
|
+
"""Print performance report."""
|
|
354
|
+
print("=" * 80)
|
|
355
|
+
print(f"Database Performance Report - {report.database_type.upper()}")
|
|
356
|
+
print(f"Database: {report.database_name}")
|
|
357
|
+
print(f"Timestamp: {report.timestamp}")
|
|
358
|
+
print("=" * 80)
|
|
359
|
+
|
|
360
|
+
print("\n## Database Metrics")
|
|
361
|
+
print("-" * 80)
|
|
362
|
+
for key, value in report.database_metrics.items():
|
|
363
|
+
if isinstance(value, float):
|
|
364
|
+
print(f"{key}: {value:.2f}")
|
|
365
|
+
else:
|
|
366
|
+
print(f"{key}: {value}")
|
|
367
|
+
|
|
368
|
+
print("\n## Slow Queries")
|
|
369
|
+
print("-" * 80)
|
|
370
|
+
if report.slow_queries:
|
|
371
|
+
for i, query in enumerate(report.slow_queries, 1):
|
|
372
|
+
print(f"\n{i}. Execution Time: {query.execution_time_ms:.2f}ms | Count: {query.count}")
|
|
373
|
+
if query.collection_or_table:
|
|
374
|
+
print(f" Collection/Table: {query.collection_or_table}")
|
|
375
|
+
if query.index_used:
|
|
376
|
+
print(f" Index Used: {query.index_used}")
|
|
377
|
+
print(f" Query: {query.query[:200]}...")
|
|
378
|
+
else:
|
|
379
|
+
print("No slow queries found")
|
|
380
|
+
|
|
381
|
+
print("\n## Index Recommendations")
|
|
382
|
+
print("-" * 80)
|
|
383
|
+
if report.index_recommendations:
|
|
384
|
+
for i, rec in enumerate(report.index_recommendations, 1):
|
|
385
|
+
print(f"\n{i}. {rec.collection_or_table}")
|
|
386
|
+
print(f" Fields: {', '.join(rec.fields)}")
|
|
387
|
+
print(f" Reason: {rec.reason}")
|
|
388
|
+
print(f" Estimated Benefit: {rec.estimated_benefit}")
|
|
389
|
+
|
|
390
|
+
if report.database_type == "mongodb":
|
|
391
|
+
index_spec = {field: 1 for field in rec.fields}
|
|
392
|
+
print(f" Command: db.{rec.collection_or_table}.createIndex({json.dumps(index_spec)})")
|
|
393
|
+
elif report.database_type == "postgres":
|
|
394
|
+
fields_str = ", ".join(rec.fields)
|
|
395
|
+
print(f" Command: CREATE INDEX idx_{rec.collection_or_table.replace('.', '_')}_{rec.fields[0]} ON {rec.collection_or_table}({fields_str});")
|
|
396
|
+
else:
|
|
397
|
+
print("No index recommendations")
|
|
398
|
+
|
|
399
|
+
print("\n" + "=" * 80)
|
|
400
|
+
|
|
401
|
+
def save_report(self, report: PerformanceReport, filename: str):
|
|
402
|
+
"""Save report to JSON file."""
|
|
403
|
+
# Convert dataclasses to dict
|
|
404
|
+
report_dict = {
|
|
405
|
+
"database_type": report.database_type,
|
|
406
|
+
"database_name": report.database_name,
|
|
407
|
+
"timestamp": report.timestamp.isoformat(),
|
|
408
|
+
"slow_queries": [asdict(q) for q in report.slow_queries],
|
|
409
|
+
"index_recommendations": [asdict(r) for r in report.index_recommendations],
|
|
410
|
+
"database_metrics": report.database_metrics
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
with open(filename, "w") as f:
|
|
414
|
+
json.dump(report_dict, f, indent=2, default=str)
|
|
415
|
+
|
|
416
|
+
print(f"\nReport saved to: {filename}")
|
|
417
|
+
|
|
418
|
+
|
|
419
|
+
def main():
|
|
420
|
+
"""Main entry point."""
|
|
421
|
+
parser = argparse.ArgumentParser(description="Database performance analysis tool")
|
|
422
|
+
parser.add_argument("--db", required=True, choices=["mongodb", "postgres"],
|
|
423
|
+
help="Database type")
|
|
424
|
+
parser.add_argument("--uri", required=True, help="Database connection string")
|
|
425
|
+
parser.add_argument("--threshold", type=int, default=100,
|
|
426
|
+
help="Slow query threshold in milliseconds (default: 100)")
|
|
427
|
+
parser.add_argument("--output", help="Save report to JSON file")
|
|
428
|
+
|
|
429
|
+
args = parser.parse_args()
|
|
430
|
+
|
|
431
|
+
analyzer = PerformanceAnalyzer(args.db, args.uri, args.threshold)
|
|
432
|
+
|
|
433
|
+
if not analyzer.connect():
|
|
434
|
+
sys.exit(1)
|
|
435
|
+
|
|
436
|
+
try:
|
|
437
|
+
print(f"Analyzing {args.db} performance (threshold: {args.threshold}ms)...")
|
|
438
|
+
report = analyzer.analyze()
|
|
439
|
+
|
|
440
|
+
if report:
|
|
441
|
+
analyzer.print_report(report)
|
|
442
|
+
|
|
443
|
+
if args.output:
|
|
444
|
+
analyzer.save_report(report, args.output)
|
|
445
|
+
|
|
446
|
+
sys.exit(0)
|
|
447
|
+
else:
|
|
448
|
+
print("Analysis failed")
|
|
449
|
+
sys.exit(1)
|
|
450
|
+
|
|
451
|
+
finally:
|
|
452
|
+
analyzer.disconnect()
|
|
453
|
+
|
|
454
|
+
|
|
455
|
+
if __name__ == "__main__":
|
|
456
|
+
main()
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Databases Skill Dependencies
|
|
2
|
+
# Python 3.10+ required
|
|
3
|
+
|
|
4
|
+
# No Python package dependencies - uses only standard library
|
|
5
|
+
|
|
6
|
+
# Testing dependencies (dev)
|
|
7
|
+
pytest>=8.0.0
|
|
8
|
+
pytest-cov>=4.1.0
|
|
9
|
+
pytest-mock>=3.12.0
|
|
10
|
+
|
|
11
|
+
# Note: This skill requires database CLI tools:
|
|
12
|
+
#
|
|
13
|
+
# PostgreSQL:
|
|
14
|
+
# - psql CLI (comes with PostgreSQL)
|
|
15
|
+
# - Ubuntu/Debian: sudo apt-get install postgresql-client
|
|
16
|
+
# - macOS: brew install postgresql
|
|
17
|
+
#
|
|
18
|
+
# MongoDB:
|
|
19
|
+
# - mongosh CLI: https://www.mongodb.com/try/download/shell
|
|
20
|
+
# - mongodump/mongorestore: https://www.mongodb.com/try/download/database-tools
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Bisection script to find which test creates unwanted files/state
|
|
3
|
+
# Usage: ./find-polluter.sh <file_or_dir_to_check> <test_pattern>
|
|
4
|
+
# Example: ./find-polluter.sh '.git' 'src/**/*.test.ts'
|
|
5
|
+
|
|
6
|
+
set -e
|
|
7
|
+
|
|
8
|
+
if [ $# -ne 2 ]; then
|
|
9
|
+
echo "Usage: $0 <file_to_check> <test_pattern>"
|
|
10
|
+
echo "Example: $0 '.git' 'src/**/*.test.ts'"
|
|
11
|
+
exit 1
|
|
12
|
+
fi
|
|
13
|
+
|
|
14
|
+
POLLUTION_CHECK="$1"
|
|
15
|
+
TEST_PATTERN="$2"
|
|
16
|
+
|
|
17
|
+
echo "🔍 Searching for test that creates: $POLLUTION_CHECK"
|
|
18
|
+
echo "Test pattern: $TEST_PATTERN"
|
|
19
|
+
echo ""
|
|
20
|
+
|
|
21
|
+
# Get list of test files
|
|
22
|
+
TEST_FILES=$(find . -path "$TEST_PATTERN" | sort)
|
|
23
|
+
TOTAL=$(echo "$TEST_FILES" | wc -l | tr -d ' ')
|
|
24
|
+
|
|
25
|
+
echo "Found $TOTAL test files"
|
|
26
|
+
echo ""
|
|
27
|
+
|
|
28
|
+
COUNT=0
|
|
29
|
+
for TEST_FILE in $TEST_FILES; do
|
|
30
|
+
COUNT=$((COUNT + 1))
|
|
31
|
+
|
|
32
|
+
# Skip if pollution already exists
|
|
33
|
+
if [ -e "$POLLUTION_CHECK" ]; then
|
|
34
|
+
echo "⚠️ Pollution already exists before test $COUNT/$TOTAL"
|
|
35
|
+
echo " Skipping: $TEST_FILE"
|
|
36
|
+
continue
|
|
37
|
+
fi
|
|
38
|
+
|
|
39
|
+
echo "[$COUNT/$TOTAL] Testing: $TEST_FILE"
|
|
40
|
+
|
|
41
|
+
# Run the test
|
|
42
|
+
npm test "$TEST_FILE" > /dev/null 2>&1 || true
|
|
43
|
+
|
|
44
|
+
# Check if pollution appeared
|
|
45
|
+
if [ -e "$POLLUTION_CHECK" ]; then
|
|
46
|
+
echo ""
|
|
47
|
+
echo "🎯 FOUND POLLUTER!"
|
|
48
|
+
echo " Test: $TEST_FILE"
|
|
49
|
+
echo " Created: $POLLUTION_CHECK"
|
|
50
|
+
echo ""
|
|
51
|
+
echo "Pollution details:"
|
|
52
|
+
ls -la "$POLLUTION_CHECK"
|
|
53
|
+
echo ""
|
|
54
|
+
echo "To investigate:"
|
|
55
|
+
echo " npm test $TEST_FILE # Run just this test"
|
|
56
|
+
echo " cat $TEST_FILE # Review test code"
|
|
57
|
+
exit 1
|
|
58
|
+
fi
|
|
59
|
+
done
|
|
60
|
+
|
|
61
|
+
echo ""
|
|
62
|
+
echo "✅ No polluter found - all tests clean!"
|
|
63
|
+
exit 0
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# DevOps Skill - Environment Variables
|
|
2
|
+
|
|
3
|
+
# =============================================================================
|
|
4
|
+
# Cloudflare Configuration
|
|
5
|
+
# =============================================================================
|
|
6
|
+
# Get these from: https://dash.cloudflare.com
|
|
7
|
+
# API Token: Profile -> API Tokens -> Create Token
|
|
8
|
+
# Account ID: Overview -> Account ID (right sidebar)
|
|
9
|
+
|
|
10
|
+
CLOUDFLARE_API_TOKEN=your_cloudflare_api_token_here
|
|
11
|
+
CLOUDFLARE_ACCOUNT_ID=your_cloudflare_account_id_here
|
|
12
|
+
|
|
13
|
+
# Optional: Specific zone configuration
|
|
14
|
+
# CLOUDFLARE_ZONE_ID=your_zone_id_here
|
|
15
|
+
|
|
16
|
+
# =============================================================================
|
|
17
|
+
# Google Cloud Configuration
|
|
18
|
+
# =============================================================================
|
|
19
|
+
# Authentication via service account key file or gcloud CLI
|
|
20
|
+
# Download from: IAM & Admin -> Service Accounts -> Create Key
|
|
21
|
+
|
|
22
|
+
# Option 1: Service account key file path
|
|
23
|
+
GOOGLE_APPLICATION_CREDENTIALS=/path/to/service-account-key.json
|
|
24
|
+
|
|
25
|
+
# Option 2: Project configuration
|
|
26
|
+
# GCP_PROJECT_ID=your-project-id
|
|
27
|
+
# GCP_REGION=us-central1
|
|
28
|
+
# GCP_ZONE=us-central1-a
|
|
29
|
+
|
|
30
|
+
# =============================================================================
|
|
31
|
+
# Docker Configuration
|
|
32
|
+
# =============================================================================
|
|
33
|
+
# Optional: Docker registry authentication
|
|
34
|
+
|
|
35
|
+
# Docker Hub
|
|
36
|
+
# DOCKER_USERNAME=your_docker_username
|
|
37
|
+
# DOCKER_PASSWORD=your_docker_password
|
|
38
|
+
|
|
39
|
+
# Google Container Registry (GCR)
|
|
40
|
+
# GCR_HOSTNAME=gcr.io
|
|
41
|
+
# GCR_PROJECT_ID=your-project-id
|
|
42
|
+
|
|
43
|
+
# AWS ECR
|
|
44
|
+
# AWS_ACCOUNT_ID=123456789012
|
|
45
|
+
# AWS_REGION=us-east-1
|
|
46
|
+
|
|
47
|
+
# =============================================================================
|
|
48
|
+
# CI/CD Configuration
|
|
49
|
+
# =============================================================================
|
|
50
|
+
# Optional: For automated deployments
|
|
51
|
+
|
|
52
|
+
# GitHub Actions
|
|
53
|
+
# GITHUB_TOKEN=your_github_token
|
|
54
|
+
|
|
55
|
+
# GitLab CI
|
|
56
|
+
# GITLAB_TOKEN=your_gitlab_token
|
|
57
|
+
|
|
58
|
+
# =============================================================================
|
|
59
|
+
# Monitoring & Logging
|
|
60
|
+
# =============================================================================
|
|
61
|
+
# Optional: For observability
|
|
62
|
+
|
|
63
|
+
# Sentry
|
|
64
|
+
# SENTRY_DSN=your_sentry_dsn
|
|
65
|
+
|
|
66
|
+
# Datadog
|
|
67
|
+
# DD_API_KEY=your_datadog_api_key
|
|
68
|
+
|
|
69
|
+
# =============================================================================
|
|
70
|
+
# Notes
|
|
71
|
+
# =============================================================================
|
|
72
|
+
# 1. Copy this file to .env and fill in your actual values
|
|
73
|
+
# 2. Never commit .env file to version control
|
|
74
|
+
# 3. Use different credentials for dev/staging/production
|
|
75
|
+
# 4. Rotate credentials regularly
|
|
76
|
+
# 5. Use least-privilege principle for API tokens
|