javi-forge 0.1.0
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/.gitignore.template +105 -0
- package/.releaserc +44 -0
- package/README.md +45 -0
- package/ai-config/.skillignore +15 -0
- package/ai-config/AUTO_INVOKE.md +300 -0
- package/ai-config/agents/_TEMPLATE.md +93 -0
- package/ai-config/agents/business/api-designer.md +1657 -0
- package/ai-config/agents/business/business-analyst.md +1331 -0
- package/ai-config/agents/business/product-strategist.md +206 -0
- package/ai-config/agents/business/project-manager.md +178 -0
- package/ai-config/agents/business/requirements-analyst.md +1277 -0
- package/ai-config/agents/business/technical-writer.md +1679 -0
- package/ai-config/agents/creative/ux-designer.md +205 -0
- package/ai-config/agents/data-ai/ai-engineer.md +487 -0
- package/ai-config/agents/data-ai/analytics-engineer.md +953 -0
- package/ai-config/agents/data-ai/data-engineer.md +173 -0
- package/ai-config/agents/data-ai/data-scientist.md +672 -0
- package/ai-config/agents/data-ai/mlops-engineer.md +814 -0
- package/ai-config/agents/data-ai/prompt-engineer.md +772 -0
- package/ai-config/agents/development/angular-expert.md +620 -0
- package/ai-config/agents/development/backend-architect.md +795 -0
- package/ai-config/agents/development/database-specialist.md +212 -0
- package/ai-config/agents/development/frontend-specialist.md +686 -0
- package/ai-config/agents/development/fullstack-engineer.md +668 -0
- package/ai-config/agents/development/golang-pro.md +338 -0
- package/ai-config/agents/development/java-enterprise.md +400 -0
- package/ai-config/agents/development/javascript-pro.md +422 -0
- package/ai-config/agents/development/nextjs-pro.md +474 -0
- package/ai-config/agents/development/python-pro.md +570 -0
- package/ai-config/agents/development/react-pro.md +487 -0
- package/ai-config/agents/development/rust-pro.md +246 -0
- package/ai-config/agents/development/spring-boot-4-expert.md +326 -0
- package/ai-config/agents/development/typescript-pro.md +336 -0
- package/ai-config/agents/development/vue-specialist.md +605 -0
- package/ai-config/agents/infrastructure/cloud-architect.md +472 -0
- package/ai-config/agents/infrastructure/deployment-manager.md +358 -0
- package/ai-config/agents/infrastructure/devops-engineer.md +455 -0
- package/ai-config/agents/infrastructure/incident-responder.md +519 -0
- package/ai-config/agents/infrastructure/kubernetes-expert.md +705 -0
- package/ai-config/agents/infrastructure/monitoring-specialist.md +674 -0
- package/ai-config/agents/infrastructure/performance-engineer.md +658 -0
- package/ai-config/agents/orchestrator.md +241 -0
- package/ai-config/agents/quality/accessibility-auditor.md +1204 -0
- package/ai-config/agents/quality/code-reviewer-compact.md +123 -0
- package/ai-config/agents/quality/code-reviewer.md +363 -0
- package/ai-config/agents/quality/dependency-manager.md +743 -0
- package/ai-config/agents/quality/e2e-test-specialist.md +1005 -0
- package/ai-config/agents/quality/performance-tester.md +1086 -0
- package/ai-config/agents/quality/security-auditor.md +133 -0
- package/ai-config/agents/quality/test-engineer.md +453 -0
- package/ai-config/agents/specialists/api-designer.md +87 -0
- package/ai-config/agents/specialists/backend-architect.md +73 -0
- package/ai-config/agents/specialists/code-reviewer.md +77 -0
- package/ai-config/agents/specialists/db-optimizer.md +75 -0
- package/ai-config/agents/specialists/devops-engineer.md +83 -0
- package/ai-config/agents/specialists/documentation-writer.md +78 -0
- package/ai-config/agents/specialists/frontend-developer.md +75 -0
- package/ai-config/agents/specialists/performance-analyst.md +82 -0
- package/ai-config/agents/specialists/refactor-specialist.md +74 -0
- package/ai-config/agents/specialists/security-auditor.md +74 -0
- package/ai-config/agents/specialists/test-engineer.md +81 -0
- package/ai-config/agents/specialists/ux-consultant.md +76 -0
- package/ai-config/agents/specialized/agent-generator.md +1190 -0
- package/ai-config/agents/specialized/blockchain-developer.md +149 -0
- package/ai-config/agents/specialized/code-migrator.md +892 -0
- package/ai-config/agents/specialized/context-manager.md +978 -0
- package/ai-config/agents/specialized/documentation-writer.md +1078 -0
- package/ai-config/agents/specialized/ecommerce-expert.md +1756 -0
- package/ai-config/agents/specialized/embedded-engineer.md +1714 -0
- package/ai-config/agents/specialized/error-detective.md +1034 -0
- package/ai-config/agents/specialized/fintech-specialist.md +1659 -0
- package/ai-config/agents/specialized/freelance-project-planner-v2.md +1988 -0
- package/ai-config/agents/specialized/freelance-project-planner-v3.md +2136 -0
- package/ai-config/agents/specialized/freelance-project-planner-v4.md +4503 -0
- package/ai-config/agents/specialized/freelance-project-planner.md +722 -0
- package/ai-config/agents/specialized/game-developer.md +1963 -0
- package/ai-config/agents/specialized/healthcare-dev.md +1620 -0
- package/ai-config/agents/specialized/mobile-developer.md +188 -0
- package/ai-config/agents/specialized/parallel-plan-executor.md +506 -0
- package/ai-config/agents/specialized/plan-executor.md +485 -0
- package/ai-config/agents/specialized/solo-dev-planner-modular/00-INDEX.md +485 -0
- package/ai-config/agents/specialized/solo-dev-planner-modular/01-CORE.md +3493 -0
- package/ai-config/agents/specialized/solo-dev-planner-modular/02-SELF-CORRECTION.md +778 -0
- package/ai-config/agents/specialized/solo-dev-planner-modular/03-PROGRESSIVE-SETUP.md +918 -0
- package/ai-config/agents/specialized/solo-dev-planner-modular/04-DEPLOYMENT.md +1537 -0
- package/ai-config/agents/specialized/solo-dev-planner-modular/05-TESTING.md +2633 -0
- package/ai-config/agents/specialized/solo-dev-planner-modular/06-OPERATIONS.md +5610 -0
- package/ai-config/agents/specialized/solo-dev-planner-modular/INSTALL.md +335 -0
- package/ai-config/agents/specialized/solo-dev-planner-modular/QUICK-REFERENCE.txt +215 -0
- package/ai-config/agents/specialized/solo-dev-planner-modular/README.md +260 -0
- package/ai-config/agents/specialized/solo-dev-planner-modular/START-HERE.md +379 -0
- package/ai-config/agents/specialized/solo-dev-planner-modular/WORKFLOW-DIAGRAM.md +355 -0
- package/ai-config/agents/specialized/solo-dev-planner-modular/solo-dev-planner.md +279 -0
- package/ai-config/agents/specialized/template-writer.md +347 -0
- package/ai-config/agents/specialized/test-runner.md +99 -0
- package/ai-config/agents/specialized/vibekanban-smart-worker.md +244 -0
- package/ai-config/agents/specialized/wave-executor.md +138 -0
- package/ai-config/agents/specialized/workflow-optimizer.md +1114 -0
- package/ai-config/commands/git/changelog.md +32 -0
- package/ai-config/commands/git/ci-local.md +70 -0
- package/ai-config/commands/git/commit.md +35 -0
- package/ai-config/commands/git/fix-issue.md +23 -0
- package/ai-config/commands/git/pr-create.md +42 -0
- package/ai-config/commands/git/pr-review.md +50 -0
- package/ai-config/commands/git/worktree.md +39 -0
- package/ai-config/commands/refactoring/cleanup.md +24 -0
- package/ai-config/commands/refactoring/dead-code.md +40 -0
- package/ai-config/commands/refactoring/extract.md +31 -0
- package/ai-config/commands/testing/e2e.md +30 -0
- package/ai-config/commands/testing/tdd.md +36 -0
- package/ai-config/commands/testing/test-coverage.md +30 -0
- package/ai-config/commands/testing/test-fix.md +24 -0
- package/ai-config/commands/workflow/generate-agents-md.md +85 -0
- package/ai-config/commands/workflow/planning.md +47 -0
- package/ai-config/commands/workflows/compound.md +89 -0
- package/ai-config/commands/workflows/plan.md +77 -0
- package/ai-config/commands/workflows/review.md +78 -0
- package/ai-config/commands/workflows/work.md +75 -0
- package/ai-config/config.yaml +18 -0
- package/ai-config/hooks/_TEMPLATE.md +96 -0
- package/ai-config/hooks/block-dangerous-commands.md +75 -0
- package/ai-config/hooks/commit-guard.md +90 -0
- package/ai-config/hooks/context-loader.md +73 -0
- package/ai-config/hooks/improve-prompt.md +91 -0
- package/ai-config/hooks/learning-log.md +72 -0
- package/ai-config/hooks/model-router.md +86 -0
- package/ai-config/hooks/secret-scanner.md +64 -0
- package/ai-config/hooks/skill-validator.md +102 -0
- package/ai-config/hooks/task-artifact.md +114 -0
- package/ai-config/hooks/validate-workflow.md +100 -0
- package/ai-config/prompts/base.md +71 -0
- package/ai-config/prompts/modes/debug.md +34 -0
- package/ai-config/prompts/modes/deploy.md +40 -0
- package/ai-config/prompts/modes/research.md +32 -0
- package/ai-config/prompts/modes/review.md +33 -0
- package/ai-config/prompts/review-policy.md +79 -0
- package/ai-config/skills/_TEMPLATE.md +157 -0
- package/ai-config/skills/backend/api-gateway/SKILL.md +254 -0
- package/ai-config/skills/backend/bff-concepts/SKILL.md +239 -0
- package/ai-config/skills/backend/bff-spring/SKILL.md +364 -0
- package/ai-config/skills/backend/chi-router/SKILL.md +396 -0
- package/ai-config/skills/backend/error-handling/SKILL.md +255 -0
- package/ai-config/skills/backend/exceptions-spring/SKILL.md +323 -0
- package/ai-config/skills/backend/fastapi/SKILL.md +302 -0
- package/ai-config/skills/backend/gateway-spring/SKILL.md +390 -0
- package/ai-config/skills/backend/go-backend/SKILL.md +457 -0
- package/ai-config/skills/backend/gradle-multimodule/SKILL.md +274 -0
- package/ai-config/skills/backend/graphql-concepts/SKILL.md +352 -0
- package/ai-config/skills/backend/graphql-spring/SKILL.md +398 -0
- package/ai-config/skills/backend/grpc-concepts/SKILL.md +283 -0
- package/ai-config/skills/backend/grpc-spring/SKILL.md +445 -0
- package/ai-config/skills/backend/jwt-auth/SKILL.md +412 -0
- package/ai-config/skills/backend/notifications-concepts/SKILL.md +259 -0
- package/ai-config/skills/backend/recommendations-concepts/SKILL.md +261 -0
- package/ai-config/skills/backend/search-concepts/SKILL.md +263 -0
- package/ai-config/skills/backend/search-spring/SKILL.md +375 -0
- package/ai-config/skills/backend/spring-boot-4/SKILL.md +172 -0
- package/ai-config/skills/backend/websockets/SKILL.md +532 -0
- package/ai-config/skills/data-ai/ai-ml/SKILL.md +423 -0
- package/ai-config/skills/data-ai/analytics-concepts/SKILL.md +195 -0
- package/ai-config/skills/data-ai/analytics-spring/SKILL.md +340 -0
- package/ai-config/skills/data-ai/duckdb-analytics/SKILL.md +440 -0
- package/ai-config/skills/data-ai/langchain/SKILL.md +238 -0
- package/ai-config/skills/data-ai/mlflow/SKILL.md +302 -0
- package/ai-config/skills/data-ai/onnx-inference/SKILL.md +290 -0
- package/ai-config/skills/data-ai/powerbi/SKILL.md +352 -0
- package/ai-config/skills/data-ai/pytorch/SKILL.md +274 -0
- package/ai-config/skills/data-ai/scikit-learn/SKILL.md +321 -0
- package/ai-config/skills/data-ai/vector-db/SKILL.md +301 -0
- package/ai-config/skills/database/graph-databases/SKILL.md +218 -0
- package/ai-config/skills/database/graph-spring/SKILL.md +361 -0
- package/ai-config/skills/database/pgx-postgres/SKILL.md +512 -0
- package/ai-config/skills/database/redis-cache/SKILL.md +343 -0
- package/ai-config/skills/database/sqlite-embedded/SKILL.md +388 -0
- package/ai-config/skills/database/timescaledb/SKILL.md +320 -0
- package/ai-config/skills/docs/api-documentation/SKILL.md +293 -0
- package/ai-config/skills/docs/docs-spring/SKILL.md +377 -0
- package/ai-config/skills/docs/mustache-templates/SKILL.md +190 -0
- package/ai-config/skills/docs/technical-docs/SKILL.md +447 -0
- package/ai-config/skills/frontend/astro-ssr/SKILL.md +441 -0
- package/ai-config/skills/frontend/frontend-design/SKILL.md +54 -0
- package/ai-config/skills/frontend/frontend-web/SKILL.md +368 -0
- package/ai-config/skills/frontend/mantine-ui/SKILL.md +396 -0
- package/ai-config/skills/frontend/tanstack-query/SKILL.md +439 -0
- package/ai-config/skills/frontend/zod-validation/SKILL.md +417 -0
- package/ai-config/skills/frontend/zustand-state/SKILL.md +350 -0
- package/ai-config/skills/infrastructure/chaos-engineering/SKILL.md +244 -0
- package/ai-config/skills/infrastructure/chaos-spring/SKILL.md +378 -0
- package/ai-config/skills/infrastructure/devops-infra/SKILL.md +435 -0
- package/ai-config/skills/infrastructure/docker-containers/SKILL.md +420 -0
- package/ai-config/skills/infrastructure/kubernetes/SKILL.md +456 -0
- package/ai-config/skills/infrastructure/opentelemetry/SKILL.md +546 -0
- package/ai-config/skills/infrastructure/traefik-proxy/SKILL.md +474 -0
- package/ai-config/skills/infrastructure/woodpecker-ci/SKILL.md +315 -0
- package/ai-config/skills/mobile/ionic-capacitor/SKILL.md +504 -0
- package/ai-config/skills/mobile/mobile-ionic/SKILL.md +448 -0
- package/ai-config/skills/prompt-improver/SKILL.md +125 -0
- package/ai-config/skills/quality/ghagga-review/SKILL.md +216 -0
- package/ai-config/skills/references/hooks-patterns/SKILL.md +238 -0
- package/ai-config/skills/references/mcp-servers/SKILL.md +275 -0
- package/ai-config/skills/references/plugins-reference/SKILL.md +110 -0
- package/ai-config/skills/references/skills-reference/SKILL.md +420 -0
- package/ai-config/skills/references/subagent-templates/SKILL.md +193 -0
- package/ai-config/skills/systems-iot/modbus-protocol/SKILL.md +410 -0
- package/ai-config/skills/systems-iot/mqtt-rumqttc/SKILL.md +408 -0
- package/ai-config/skills/systems-iot/rust-systems/SKILL.md +386 -0
- package/ai-config/skills/systems-iot/tokio-async/SKILL.md +324 -0
- package/ai-config/skills/testing/playwright-e2e/SKILL.md +289 -0
- package/ai-config/skills/testing/testcontainers/SKILL.md +299 -0
- package/ai-config/skills/testing/vitest-testing/SKILL.md +381 -0
- package/ai-config/skills/workflow/ci-local-guide/SKILL.md +118 -0
- package/ai-config/skills/workflow/claude-automation-recommender/SKILL.md +299 -0
- package/ai-config/skills/workflow/claude-md-improver/SKILL.md +158 -0
- package/ai-config/skills/workflow/finishing-a-development-branch/SKILL.md +117 -0
- package/ai-config/skills/workflow/git-github/SKILL.md +334 -0
- package/ai-config/skills/workflow/git-github/references/examples.md +160 -0
- package/ai-config/skills/workflow/git-workflow/SKILL.md +214 -0
- package/ai-config/skills/workflow/ide-plugins/SKILL.md +277 -0
- package/ai-config/skills/workflow/ide-plugins-intellij/SKILL.md +401 -0
- package/ai-config/skills/workflow/obsidian-brain-workflow/SKILL.md +199 -0
- package/ai-config/skills/workflow/using-git-worktrees/SKILL.md +100 -0
- package/ai-config/skills/workflow/verification-before-completion/SKILL.md +73 -0
- package/ai-config/skills/workflow/wave-workflow/SKILL.md +178 -0
- package/ci-local/README.md +170 -0
- package/ci-local/ci-local.sh +297 -0
- package/ci-local/hooks/commit-msg +74 -0
- package/ci-local/hooks/pre-commit +162 -0
- package/ci-local/hooks/pre-push +41 -0
- package/ci-local/install.sh +49 -0
- package/ci-local/semgrep.yml +214 -0
- package/dist/commands/analyze.d.ts +9 -0
- package/dist/commands/analyze.d.ts.map +1 -0
- package/dist/commands/analyze.js +55 -0
- package/dist/commands/analyze.js.map +1 -0
- package/dist/commands/analyze.test.d.ts +2 -0
- package/dist/commands/analyze.test.d.ts.map +1 -0
- package/dist/commands/analyze.test.js +145 -0
- package/dist/commands/analyze.test.js.map +1 -0
- package/dist/commands/doctor.d.ts +7 -0
- package/dist/commands/doctor.d.ts.map +1 -0
- package/dist/commands/doctor.js +158 -0
- package/dist/commands/doctor.js.map +1 -0
- package/dist/commands/doctor.test.d.ts +2 -0
- package/dist/commands/doctor.test.d.ts.map +1 -0
- package/dist/commands/doctor.test.js +200 -0
- package/dist/commands/doctor.test.js.map +1 -0
- package/dist/commands/init.d.ts +9 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +283 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/init.test.d.ts +2 -0
- package/dist/commands/init.test.d.ts.map +1 -0
- package/dist/commands/init.test.js +271 -0
- package/dist/commands/init.test.js.map +1 -0
- package/dist/commands/sync.d.ts +8 -0
- package/dist/commands/sync.d.ts.map +1 -0
- package/dist/commands/sync.js +201 -0
- package/dist/commands/sync.js.map +1 -0
- package/dist/constants.d.ts +21 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +57 -0
- package/dist/constants.js.map +1 -0
- package/dist/e2e/aggressive.e2e.test.d.ts +2 -0
- package/dist/e2e/aggressive.e2e.test.d.ts.map +1 -0
- package/dist/e2e/aggressive.e2e.test.js +350 -0
- package/dist/e2e/aggressive.e2e.test.js.map +1 -0
- package/dist/e2e/commands.e2e.test.d.ts +2 -0
- package/dist/e2e/commands.e2e.test.d.ts.map +1 -0
- package/dist/e2e/commands.e2e.test.js +213 -0
- package/dist/e2e/commands.e2e.test.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +82 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/common.d.ts +17 -0
- package/dist/lib/common.d.ts.map +1 -0
- package/dist/lib/common.js +111 -0
- package/dist/lib/common.js.map +1 -0
- package/dist/lib/common.test.d.ts +2 -0
- package/dist/lib/common.test.d.ts.map +1 -0
- package/dist/lib/common.test.js +316 -0
- package/dist/lib/common.test.js.map +1 -0
- package/dist/lib/frontmatter.d.ts +18 -0
- package/dist/lib/frontmatter.d.ts.map +1 -0
- package/dist/lib/frontmatter.js +61 -0
- package/dist/lib/frontmatter.js.map +1 -0
- package/dist/lib/frontmatter.test.d.ts +2 -0
- package/dist/lib/frontmatter.test.d.ts.map +1 -0
- package/dist/lib/frontmatter.test.js +257 -0
- package/dist/lib/frontmatter.test.js.map +1 -0
- package/dist/lib/template.d.ts +24 -0
- package/dist/lib/template.d.ts.map +1 -0
- package/dist/lib/template.js +78 -0
- package/dist/lib/template.js.map +1 -0
- package/dist/lib/template.test.d.ts +2 -0
- package/dist/lib/template.test.d.ts.map +1 -0
- package/dist/lib/template.test.js +201 -0
- package/dist/lib/template.test.js.map +1 -0
- package/dist/types/index.d.ts +48 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +2 -0
- package/dist/types/index.js.map +1 -0
- package/dist/ui/AnalyzeUI.d.ts +7 -0
- package/dist/ui/AnalyzeUI.d.ts.map +1 -0
- package/dist/ui/AnalyzeUI.js +100 -0
- package/dist/ui/AnalyzeUI.js.map +1 -0
- package/dist/ui/App.d.ts +13 -0
- package/dist/ui/App.d.ts.map +1 -0
- package/dist/ui/App.js +100 -0
- package/dist/ui/App.js.map +1 -0
- package/dist/ui/CIContext.d.ts +9 -0
- package/dist/ui/CIContext.d.ts.map +1 -0
- package/dist/ui/CIContext.js +9 -0
- package/dist/ui/CIContext.js.map +1 -0
- package/dist/ui/CISelector.d.ts +8 -0
- package/dist/ui/CISelector.d.ts.map +1 -0
- package/dist/ui/CISelector.js +45 -0
- package/dist/ui/CISelector.js.map +1 -0
- package/dist/ui/Doctor.d.ts +3 -0
- package/dist/ui/Doctor.d.ts.map +1 -0
- package/dist/ui/Doctor.js +89 -0
- package/dist/ui/Doctor.js.map +1 -0
- package/dist/ui/Header.d.ts +8 -0
- package/dist/ui/Header.d.ts.map +1 -0
- package/dist/ui/Header.js +30 -0
- package/dist/ui/Header.js.map +1 -0
- package/dist/ui/MemorySelector.d.ts +8 -0
- package/dist/ui/MemorySelector.d.ts.map +1 -0
- package/dist/ui/MemorySelector.js +46 -0
- package/dist/ui/MemorySelector.js.map +1 -0
- package/dist/ui/NameInput.d.ts +8 -0
- package/dist/ui/NameInput.d.ts.map +1 -0
- package/dist/ui/NameInput.js +69 -0
- package/dist/ui/NameInput.js.map +1 -0
- package/dist/ui/OptionSelector.d.ts +12 -0
- package/dist/ui/OptionSelector.d.ts.map +1 -0
- package/dist/ui/OptionSelector.js +69 -0
- package/dist/ui/OptionSelector.js.map +1 -0
- package/dist/ui/Progress.d.ts +11 -0
- package/dist/ui/Progress.d.ts.map +1 -0
- package/dist/ui/Progress.js +58 -0
- package/dist/ui/Progress.js.map +1 -0
- package/dist/ui/StackSelector.d.ts +9 -0
- package/dist/ui/StackSelector.d.ts.map +1 -0
- package/dist/ui/StackSelector.js +65 -0
- package/dist/ui/StackSelector.js.map +1 -0
- package/dist/ui/Summary.d.ts +12 -0
- package/dist/ui/Summary.d.ts.map +1 -0
- package/dist/ui/Summary.js +114 -0
- package/dist/ui/Summary.js.map +1 -0
- package/dist/ui/SyncUI.d.ts +10 -0
- package/dist/ui/SyncUI.d.ts.map +1 -0
- package/dist/ui/SyncUI.js +64 -0
- package/dist/ui/SyncUI.js.map +1 -0
- package/dist/ui/Welcome.d.ts +7 -0
- package/dist/ui/Welcome.d.ts.map +1 -0
- package/dist/ui/Welcome.js +45 -0
- package/dist/ui/Welcome.js.map +1 -0
- package/dist/ui/theme.d.ts +10 -0
- package/dist/ui/theme.d.ts.map +1 -0
- package/dist/ui/theme.js +9 -0
- package/dist/ui/theme.js.map +1 -0
- package/modules/engram/.gitignore-snippet.txt +6 -0
- package/modules/engram/.mcp-config-snippet.json +11 -0
- package/modules/engram/README.md +146 -0
- package/modules/engram/install-engram.sh +216 -0
- package/modules/ghagga/.env.example +43 -0
- package/modules/ghagga/README.md +153 -0
- package/modules/ghagga/docker-compose.yml +80 -0
- package/modules/ghagga/setup-ghagga.sh +139 -0
- package/modules/memory-simple/.project/NOTES.md +22 -0
- package/modules/memory-simple/README.md +23 -0
- package/modules/obsidian-brain/.obsidian/app.json +23 -0
- package/modules/obsidian-brain/.obsidian/appearance.json +5 -0
- package/modules/obsidian-brain/.obsidian/bookmarks.json +34 -0
- package/modules/obsidian-brain/.obsidian/community-plugins.json +1 -0
- package/modules/obsidian-brain/.obsidian/core-plugins-migration.json +21 -0
- package/modules/obsidian-brain/.obsidian/core-plugins.json +18 -0
- package/modules/obsidian-brain/.obsidian/daily-notes.json +5 -0
- package/modules/obsidian-brain/.obsidian/graph.json +37 -0
- package/modules/obsidian-brain/.obsidian/hotkeys.json +14 -0
- package/modules/obsidian-brain/.obsidian/plugins/dataview/data.json +25 -0
- package/modules/obsidian-brain/.obsidian/plugins/obsidian-kanban/data.json +29 -0
- package/modules/obsidian-brain/.obsidian/plugins/templater-obsidian/data.json +18 -0
- package/modules/obsidian-brain/.obsidian/snippets/project-memory.css +71 -0
- package/modules/obsidian-brain/.obsidian-gitignore-snippet.txt +8 -0
- package/modules/obsidian-brain/.project/Attachments/.gitkeep +0 -0
- package/modules/obsidian-brain/.project/Memory/BLOCKERS.md +78 -0
- package/modules/obsidian-brain/.project/Memory/CONTEXT.md +102 -0
- package/modules/obsidian-brain/.project/Memory/DASHBOARD.md +73 -0
- package/modules/obsidian-brain/.project/Memory/DECISIONS.md +87 -0
- package/modules/obsidian-brain/.project/Memory/KANBAN.md +15 -0
- package/modules/obsidian-brain/.project/Memory/README.md +61 -0
- package/modules/obsidian-brain/.project/Memory/WAVES.md +78 -0
- package/modules/obsidian-brain/.project/Sessions/TEMPLATE.md +99 -0
- package/modules/obsidian-brain/.project/Templates/ADR.md +33 -0
- package/modules/obsidian-brain/.project/Templates/Blocker.md +21 -0
- package/modules/obsidian-brain/.project/Templates/Session.md +88 -0
- package/modules/obsidian-brain/README.md +268 -0
- package/modules/obsidian-brain/new-wave.sh +182 -0
- package/package.json +51 -0
- package/schemas/agent.schema.json +34 -0
- package/schemas/ai-config.schema.json +28 -0
- package/schemas/skill.schema.json +44 -0
- package/src/commands/analyze.test.ts +145 -0
- package/src/commands/analyze.ts +69 -0
- package/src/commands/doctor.test.ts +208 -0
- package/src/commands/doctor.ts +163 -0
- package/src/commands/init.test.ts +298 -0
- package/src/commands/init.ts +285 -0
- package/src/constants.ts +69 -0
- package/src/e2e/aggressive.e2e.test.ts +557 -0
- package/src/e2e/commands.e2e.test.ts +298 -0
- package/src/index.tsx +106 -0
- package/src/lib/common.test.ts +318 -0
- package/src/lib/common.ts +127 -0
- package/src/lib/frontmatter.test.ts +291 -0
- package/src/lib/frontmatter.ts +77 -0
- package/src/lib/template.test.ts +226 -0
- package/src/lib/template.ts +99 -0
- package/src/types/index.ts +53 -0
- package/src/ui/AnalyzeUI.tsx +133 -0
- package/src/ui/App.tsx +175 -0
- package/src/ui/CIContext.tsx +25 -0
- package/src/ui/CISelector.tsx +72 -0
- package/src/ui/Doctor.tsx +122 -0
- package/src/ui/Header.tsx +48 -0
- package/src/ui/MemorySelector.tsx +73 -0
- package/src/ui/NameInput.tsx +82 -0
- package/src/ui/OptionSelector.tsx +100 -0
- package/src/ui/Progress.tsx +88 -0
- package/src/ui/StackSelector.tsx +101 -0
- package/src/ui/Summary.tsx +134 -0
- package/src/ui/Welcome.tsx +54 -0
- package/src/ui/theme.ts +10 -0
- package/stryker.config.json +19 -0
- package/tasks/_TEMPLATE/files-edited.md +3 -0
- package/tasks/_TEMPLATE/plan.md +3 -0
- package/tasks/_TEMPLATE/research.md +3 -0
- package/tasks/_TEMPLATE/verification.md +5 -0
- package/templates/common/dependabot/cargo.yml +11 -0
- package/templates/common/dependabot/github-actions.yml +16 -0
- package/templates/common/dependabot/gomod.yml +15 -0
- package/templates/common/dependabot/gradle.yml +15 -0
- package/templates/common/dependabot/header.yml +3 -0
- package/templates/common/dependabot/maven.yml +15 -0
- package/templates/common/dependabot/npm.yml +20 -0
- package/templates/common/dependabot/pip.yml +11 -0
- package/templates/dependabot.yml +162 -0
- package/templates/github/ci-go.yml +41 -0
- package/templates/github/ci-java.yml +45 -0
- package/templates/github/ci-monorepo.yml +150 -0
- package/templates/github/ci-node.yml +42 -0
- package/templates/github/ci-python.yml +42 -0
- package/templates/github/ci-rust.yml +42 -0
- package/templates/github/dependabot-automerge.yml +40 -0
- package/templates/gitlab/gitlab-ci-go.yml +88 -0
- package/templates/gitlab/gitlab-ci-java.yml +79 -0
- package/templates/gitlab/gitlab-ci-monorepo.yml +126 -0
- package/templates/gitlab/gitlab-ci-node.yml +63 -0
- package/templates/gitlab/gitlab-ci-python.yml +147 -0
- package/templates/gitlab/gitlab-ci-rust.yml +67 -0
- package/templates/global/claude-settings.json +98 -0
- package/templates/global/codex-config.toml +8 -0
- package/templates/global/copilot-instructions/base-rules.instructions.md +13 -0
- package/templates/global/copilot-instructions/sdd-orchestrator.instructions.md +37 -0
- package/templates/global/gemini-commands/cleanup.toml +20 -0
- package/templates/global/gemini-commands/commit.toml +15 -0
- package/templates/global/gemini-commands/dead-code.toml +22 -0
- package/templates/global/gemini-commands/plan.toml +30 -0
- package/templates/global/gemini-commands/review.toml +17 -0
- package/templates/global/gemini-commands/sdd-apply.toml +22 -0
- package/templates/global/gemini-commands/sdd-ff.toml +14 -0
- package/templates/global/gemini-commands/sdd-new.toml +21 -0
- package/templates/global/gemini-commands/sdd-verify.toml +21 -0
- package/templates/global/gemini-commands/tdd.toml +26 -0
- package/templates/global/gemini-settings.json +8 -0
- package/templates/global/opencode-config.json +44 -0
- package/templates/global/sdd-instructions.md +47 -0
- package/templates/global/sdd-orchestrator-claude.md +46 -0
- package/templates/global/sdd-orchestrator-copilot.md +34 -0
- package/templates/renovate.json +69 -0
- package/templates/woodpecker/monorepo/backend.yml +34 -0
- package/templates/woodpecker/monorepo/frontend.yml +34 -0
- package/templates/woodpecker/monorepo/summary.yml +25 -0
- package/templates/woodpecker/woodpecker-go.yml +51 -0
- package/templates/woodpecker/woodpecker-java.yml +67 -0
- package/templates/woodpecker/woodpecker-node.yml +47 -0
- package/templates/woodpecker/woodpecker-python.yml +108 -0
- package/templates/woodpecker/woodpecker-rust.yml +57 -0
- package/tsconfig.json +19 -0
- package/vitest.config.ts +16 -0
- package/workflows/reusable-build-go.yml +111 -0
- package/workflows/reusable-build-java.yml +120 -0
- package/workflows/reusable-build-node.yml +145 -0
- package/workflows/reusable-build-python.yml +159 -0
- package/workflows/reusable-build-rust.yml +135 -0
- package/workflows/reusable-docker.yml +120 -0
- package/workflows/reusable-ghagga-review.yml +165 -0
- package/workflows/reusable-release.yml +91 -0
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: mlflow
|
|
3
|
+
description: >
|
|
4
|
+
ML experiment tracking, model registry, and deployment with MLflow.
|
|
5
|
+
Trigger: mlflow, experiment tracking, model registry, mlops, model versioning
|
|
6
|
+
tools:
|
|
7
|
+
- Read
|
|
8
|
+
- Write
|
|
9
|
+
- Bash
|
|
10
|
+
- Grep
|
|
11
|
+
metadata:
|
|
12
|
+
author: plataforma-industrial
|
|
13
|
+
version: "2.0"
|
|
14
|
+
tags: [mlflow, mlops, experiment-tracking, model-registry]
|
|
15
|
+
updated: "2026-02"
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
# MLflow Skill
|
|
19
|
+
|
|
20
|
+
ML experiment tracking, model registry, and deployment.
|
|
21
|
+
|
|
22
|
+
## Stack
|
|
23
|
+
|
|
24
|
+
```yaml
|
|
25
|
+
mlflow: 2.10+
|
|
26
|
+
mlflow-skinny: 2.10+ # client only
|
|
27
|
+
boto3: 1.34+ # S3 artifacts
|
|
28
|
+
psycopg2: 2.9+ # PostgreSQL backend
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Docker Setup
|
|
32
|
+
|
|
33
|
+
```yaml
|
|
34
|
+
# docker-compose.mlflow.yml
|
|
35
|
+
services:
|
|
36
|
+
mlflow:
|
|
37
|
+
image: ghcr.io/mlflow/mlflow:v2.10.0
|
|
38
|
+
ports:
|
|
39
|
+
- "5000:5000"
|
|
40
|
+
environment:
|
|
41
|
+
- MLFLOW_BACKEND_STORE_URI=postgresql://mlflow:mlflow@postgres:5432/mlflow
|
|
42
|
+
- MLFLOW_DEFAULT_ARTIFACT_ROOT=s3://mlflow-artifacts
|
|
43
|
+
command: >
|
|
44
|
+
mlflow server
|
|
45
|
+
--backend-store-uri postgresql://mlflow:mlflow@postgres:5432/mlflow
|
|
46
|
+
--default-artifact-root s3://mlflow-artifacts
|
|
47
|
+
--host 0.0.0.0 --port 5000
|
|
48
|
+
depends_on:
|
|
49
|
+
- postgres
|
|
50
|
+
|
|
51
|
+
postgres:
|
|
52
|
+
image: postgres:16-alpine
|
|
53
|
+
environment:
|
|
54
|
+
POSTGRES_USER: mlflow
|
|
55
|
+
POSTGRES_PASSWORD: mlflow
|
|
56
|
+
POSTGRES_DB: mlflow
|
|
57
|
+
volumes:
|
|
58
|
+
- mlflow_db:/var/lib/postgresql/data
|
|
59
|
+
|
|
60
|
+
volumes:
|
|
61
|
+
mlflow_db:
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Client Configuration
|
|
65
|
+
|
|
66
|
+
```python
|
|
67
|
+
import os
|
|
68
|
+
import mlflow
|
|
69
|
+
|
|
70
|
+
def setup_mlflow():
|
|
71
|
+
mlflow.set_tracking_uri(os.getenv("MLFLOW_TRACKING_URI", "http://localhost:5000"))
|
|
72
|
+
mlflow.set_experiment("my-project")
|
|
73
|
+
mlflow.sklearn.autolog() # Enable autologging
|
|
74
|
+
mlflow.pytorch.autolog()
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Experiment Tracking
|
|
78
|
+
|
|
79
|
+
```python
|
|
80
|
+
import mlflow
|
|
81
|
+
from mlflow.models import infer_signature
|
|
82
|
+
from datetime import datetime
|
|
83
|
+
|
|
84
|
+
def train_with_tracking(model, X_train, y_train, X_test, y_test, model_name: str, tags: dict = None):
|
|
85
|
+
with mlflow.start_run(run_name=f"{model_name}_{datetime.now().strftime('%Y%m%d_%H%M')}"):
|
|
86
|
+
# Tags
|
|
87
|
+
mlflow.set_tags({
|
|
88
|
+
"model_type": model_name,
|
|
89
|
+
"environment": os.getenv("ENVIRONMENT", "dev"),
|
|
90
|
+
**(tags or {})
|
|
91
|
+
})
|
|
92
|
+
|
|
93
|
+
# Parameters
|
|
94
|
+
if hasattr(model, 'get_params'):
|
|
95
|
+
mlflow.log_params(model.get_params())
|
|
96
|
+
|
|
97
|
+
# Train
|
|
98
|
+
model.fit(X_train, y_train)
|
|
99
|
+
y_pred = model.predict(X_test)
|
|
100
|
+
|
|
101
|
+
# Metrics
|
|
102
|
+
from sklearn.metrics import accuracy_score, f1_score, precision_score, recall_score
|
|
103
|
+
mlflow.log_metrics({
|
|
104
|
+
"accuracy": accuracy_score(y_test, y_pred),
|
|
105
|
+
"f1_score": f1_score(y_test, y_pred, average='weighted'),
|
|
106
|
+
"precision": precision_score(y_test, y_pred, average='weighted'),
|
|
107
|
+
"recall": recall_score(y_test, y_pred, average='weighted'),
|
|
108
|
+
})
|
|
109
|
+
|
|
110
|
+
# Log model with signature
|
|
111
|
+
signature = infer_signature(X_train, y_pred)
|
|
112
|
+
mlflow.sklearn.log_model(model, "model", signature=signature, registered_model_name=model_name)
|
|
113
|
+
|
|
114
|
+
# Log confusion matrix
|
|
115
|
+
log_confusion_matrix(y_test, y_pred)
|
|
116
|
+
|
|
117
|
+
return mlflow.active_run().info.run_id
|
|
118
|
+
|
|
119
|
+
def log_confusion_matrix(y_true, y_pred):
|
|
120
|
+
import matplotlib.pyplot as plt
|
|
121
|
+
import seaborn as sns
|
|
122
|
+
from sklearn.metrics import confusion_matrix
|
|
123
|
+
|
|
124
|
+
cm = confusion_matrix(y_true, y_pred)
|
|
125
|
+
fig, ax = plt.subplots(figsize=(8, 6))
|
|
126
|
+
sns.heatmap(cm, annot=True, fmt='d', ax=ax)
|
|
127
|
+
ax.set_xlabel('Predicted')
|
|
128
|
+
ax.set_ylabel('Actual')
|
|
129
|
+
plt.savefig('/tmp/confusion_matrix.png')
|
|
130
|
+
mlflow.log_artifact('/tmp/confusion_matrix.png')
|
|
131
|
+
plt.close()
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
## PyTorch Lightning Integration
|
|
135
|
+
|
|
136
|
+
```python
|
|
137
|
+
import lightning as L
|
|
138
|
+
from lightning.pytorch.loggers import MLFlowLogger
|
|
139
|
+
from lightning.pytorch.callbacks import ModelCheckpoint, EarlyStopping
|
|
140
|
+
|
|
141
|
+
def train_with_lightning(model: L.LightningModule, datamodule: L.LightningDataModule, experiment_name: str):
|
|
142
|
+
mlflow_logger = MLFlowLogger(
|
|
143
|
+
experiment_name=experiment_name,
|
|
144
|
+
tracking_uri=os.getenv("MLFLOW_TRACKING_URI"),
|
|
145
|
+
log_model=True
|
|
146
|
+
)
|
|
147
|
+
|
|
148
|
+
trainer = L.Trainer(
|
|
149
|
+
max_epochs=100,
|
|
150
|
+
accelerator="auto",
|
|
151
|
+
logger=mlflow_logger,
|
|
152
|
+
callbacks=[
|
|
153
|
+
ModelCheckpoint(monitor="val_loss", mode="min", save_top_k=3),
|
|
154
|
+
EarlyStopping(monitor="val_loss", patience=10)
|
|
155
|
+
]
|
|
156
|
+
)
|
|
157
|
+
|
|
158
|
+
mlflow_logger.log_hyperparams(model.hparams)
|
|
159
|
+
trainer.fit(model, datamodule)
|
|
160
|
+
trainer.test(model, datamodule)
|
|
161
|
+
return mlflow_logger.run_id
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
## Model Registry
|
|
165
|
+
|
|
166
|
+
```python
|
|
167
|
+
from mlflow.tracking import MlflowClient
|
|
168
|
+
|
|
169
|
+
def register_model(run_id: str, model_name: str, description: str = None, tags: dict = None):
|
|
170
|
+
client = MlflowClient()
|
|
171
|
+
model_uri = f"runs:/{run_id}/model"
|
|
172
|
+
result = mlflow.register_model(model_uri, model_name)
|
|
173
|
+
|
|
174
|
+
if description:
|
|
175
|
+
client.update_registered_model(name=model_name, description=description)
|
|
176
|
+
|
|
177
|
+
if tags:
|
|
178
|
+
for key, value in tags.items():
|
|
179
|
+
client.set_model_version_tag(name=model_name, version=result.version, key=key, value=value)
|
|
180
|
+
|
|
181
|
+
print(f"Registered {model_name} v{result.version}")
|
|
182
|
+
return result.version
|
|
183
|
+
|
|
184
|
+
def promote_model(model_name: str, version: int, stage: str): # "Staging", "Production", "Archived"
|
|
185
|
+
client = MlflowClient()
|
|
186
|
+
client.transition_model_version_stage(
|
|
187
|
+
name=model_name,
|
|
188
|
+
version=version,
|
|
189
|
+
stage=stage,
|
|
190
|
+
archive_existing_versions=(stage == "Production")
|
|
191
|
+
)
|
|
192
|
+
|
|
193
|
+
def get_production_model(model_name: str):
|
|
194
|
+
client = MlflowClient()
|
|
195
|
+
versions = client.get_latest_versions(model_name, stages=["Production"])
|
|
196
|
+
if not versions:
|
|
197
|
+
raise ValueError(f"No production version for {model_name}")
|
|
198
|
+
return versions[0]
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
## Model Loading
|
|
202
|
+
|
|
203
|
+
```python
|
|
204
|
+
def load_model(model_name: str, stage: str = "Production"):
|
|
205
|
+
return mlflow.sklearn.load_model(f"models:/{model_name}/{stage}")
|
|
206
|
+
|
|
207
|
+
def load_model_version(model_name: str, version: int):
|
|
208
|
+
return mlflow.sklearn.load_model(f"models:/{model_name}/{version}")
|
|
209
|
+
|
|
210
|
+
class CachedModelLoader:
|
|
211
|
+
def __init__(self):
|
|
212
|
+
self._cache = {}
|
|
213
|
+
self._client = MlflowClient()
|
|
214
|
+
|
|
215
|
+
def get_model(self, model_name: str, stage: str = "Production"):
|
|
216
|
+
cache_key = f"{model_name}:{stage}"
|
|
217
|
+
versions = self._client.get_latest_versions(model_name, stages=[stage])
|
|
218
|
+
if not versions:
|
|
219
|
+
raise ValueError(f"No {stage} version for {model_name}")
|
|
220
|
+
|
|
221
|
+
current_version = versions[0].version
|
|
222
|
+
if cache_key in self._cache:
|
|
223
|
+
cached_version, model = self._cache[cache_key]
|
|
224
|
+
if cached_version == current_version:
|
|
225
|
+
return model
|
|
226
|
+
|
|
227
|
+
model = load_model(model_name, stage)
|
|
228
|
+
self._cache[cache_key] = (current_version, model)
|
|
229
|
+
return model
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
## Model Comparison
|
|
233
|
+
|
|
234
|
+
```python
|
|
235
|
+
import pandas as pd
|
|
236
|
+
|
|
237
|
+
def compare_runs(experiment_name: str, metric: str = "f1_score", top_n: int = 10) -> pd.DataFrame:
|
|
238
|
+
client = MlflowClient()
|
|
239
|
+
experiment = client.get_experiment_by_name(experiment_name)
|
|
240
|
+
|
|
241
|
+
runs = client.search_runs(
|
|
242
|
+
experiment_ids=[experiment.experiment_id],
|
|
243
|
+
order_by=[f"metrics.{metric} DESC"],
|
|
244
|
+
max_results=top_n
|
|
245
|
+
)
|
|
246
|
+
|
|
247
|
+
data = []
|
|
248
|
+
for run in runs:
|
|
249
|
+
row = {
|
|
250
|
+
"run_id": run.info.run_id,
|
|
251
|
+
"run_name": run.info.run_name,
|
|
252
|
+
"duration_min": (run.info.end_time - run.info.start_time) / 60000 if run.info.end_time else None,
|
|
253
|
+
}
|
|
254
|
+
row.update(run.data.params)
|
|
255
|
+
row.update(run.data.metrics)
|
|
256
|
+
data.append(row)
|
|
257
|
+
|
|
258
|
+
return pd.DataFrame(data)
|
|
259
|
+
|
|
260
|
+
def get_best_run(experiment_name: str, metric: str = "f1_score", mode: str = "max") -> str:
|
|
261
|
+
client = MlflowClient()
|
|
262
|
+
experiment = client.get_experiment_by_name(experiment_name)
|
|
263
|
+
order = "DESC" if mode == "max" else "ASC"
|
|
264
|
+
|
|
265
|
+
runs = client.search_runs(
|
|
266
|
+
experiment_ids=[experiment.experiment_id],
|
|
267
|
+
order_by=[f"metrics.{metric} {order}"],
|
|
268
|
+
max_results=1
|
|
269
|
+
)
|
|
270
|
+
return runs[0].info.run_id if runs else None
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
## Serving
|
|
274
|
+
|
|
275
|
+
```bash
|
|
276
|
+
# REST API serving
|
|
277
|
+
mlflow models serve -m "models:/anomaly_detector/Production" -p 5001
|
|
278
|
+
|
|
279
|
+
# Docker deployment
|
|
280
|
+
mlflow models build-docker -m "models:/anomaly_detector/Production" -n ml-model
|
|
281
|
+
docker run -p 5001:8080 ml-model
|
|
282
|
+
|
|
283
|
+
# Request prediction
|
|
284
|
+
curl -X POST http://localhost:5001/invocations \
|
|
285
|
+
-H "Content-Type: application/json" \
|
|
286
|
+
-d '{"inputs": [[1.0, 2.0, 3.0, 4.0, 5.0]]}'
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
## Best Practices
|
|
290
|
+
|
|
291
|
+
1. **Always use experiments** - `mlflow.set_experiment("project-name")`
|
|
292
|
+
2. **Log everything** - params, metrics, artifacts, model signature
|
|
293
|
+
3. **Use signatures** - `infer_signature(X_train, y_pred)` for input validation
|
|
294
|
+
4. **Tag runs** - model_type, dataset_version, author for filtering
|
|
295
|
+
5. **Version artifacts** - `mlflow.log_artifact("config.yaml", artifact_path="config")`
|
|
296
|
+
|
|
297
|
+
## Related Skills
|
|
298
|
+
|
|
299
|
+
- `pytorch`: Deep learning experiments
|
|
300
|
+
- `scikit-learn`: Classical ML experiments
|
|
301
|
+
- `kubernetes`: Model deployment at scale
|
|
302
|
+
- `docker-containers`: Containerized tracking
|
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: onnx-inference
|
|
3
|
+
description: >
|
|
4
|
+
Deploy ML models with ONNX Runtime for cross-platform inference (Python, Rust, Go).
|
|
5
|
+
Trigger: onnx, model deployment, inference, edge ml, quantization
|
|
6
|
+
tools:
|
|
7
|
+
- Read
|
|
8
|
+
- Write
|
|
9
|
+
- Bash
|
|
10
|
+
- Grep
|
|
11
|
+
metadata:
|
|
12
|
+
author: plataforma-industrial
|
|
13
|
+
version: "2.0"
|
|
14
|
+
tags: [onnx, ml, inference, edge, deployment]
|
|
15
|
+
updated: "2026-02"
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
# ONNX Inference Skill
|
|
19
|
+
|
|
20
|
+
Deploy ML models with ONNX Runtime for cross-platform, high-performance inference.
|
|
21
|
+
|
|
22
|
+
## Stack
|
|
23
|
+
|
|
24
|
+
```yaml
|
|
25
|
+
# Python
|
|
26
|
+
onnx: 1.15+
|
|
27
|
+
onnxruntime: 1.17+
|
|
28
|
+
torch: 2.2+
|
|
29
|
+
|
|
30
|
+
# Rust
|
|
31
|
+
ort: 2.0+
|
|
32
|
+
|
|
33
|
+
# Go
|
|
34
|
+
onnxruntime_go: 1.17+
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Model Export
|
|
38
|
+
|
|
39
|
+
### PyTorch to ONNX
|
|
40
|
+
|
|
41
|
+
```python
|
|
42
|
+
import torch
|
|
43
|
+
import torch.onnx
|
|
44
|
+
|
|
45
|
+
def export_model(model: torch.nn.Module, output_path: str, input_shape: tuple):
|
|
46
|
+
model.eval()
|
|
47
|
+
dummy_input = torch.randn(*input_shape)
|
|
48
|
+
|
|
49
|
+
torch.onnx.export(
|
|
50
|
+
model,
|
|
51
|
+
dummy_input,
|
|
52
|
+
output_path,
|
|
53
|
+
export_params=True,
|
|
54
|
+
opset_version=17,
|
|
55
|
+
do_constant_folding=True,
|
|
56
|
+
input_names=['input'],
|
|
57
|
+
output_names=['output'],
|
|
58
|
+
dynamic_axes={
|
|
59
|
+
'input': {0: 'batch_size'},
|
|
60
|
+
'output': {0: 'batch_size'}
|
|
61
|
+
}
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
# Validate
|
|
65
|
+
def validate_model(model_path: str):
|
|
66
|
+
import onnx
|
|
67
|
+
model = onnx.load(model_path)
|
|
68
|
+
onnx.checker.check_model(model)
|
|
69
|
+
print(f"Inputs: {[i.name for i in model.graph.input]}")
|
|
70
|
+
print(f"Outputs: {[o.name for o in model.graph.output]}")
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Scikit-learn to ONNX
|
|
74
|
+
|
|
75
|
+
```python
|
|
76
|
+
from skl2onnx import convert_sklearn
|
|
77
|
+
from skl2onnx.common.data_types import FloatTensorType
|
|
78
|
+
|
|
79
|
+
def export_sklearn(model, output_path: str, input_features: int):
|
|
80
|
+
initial_type = [('input', FloatTensorType([None, input_features]))]
|
|
81
|
+
onnx_model = convert_sklearn(
|
|
82
|
+
model,
|
|
83
|
+
initial_types=initial_type,
|
|
84
|
+
target_opset=17,
|
|
85
|
+
options={id(model): {'zipmap': False}}
|
|
86
|
+
)
|
|
87
|
+
with open(output_path, 'wb') as f:
|
|
88
|
+
f.write(onnx_model.SerializeToString())
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Python Inference
|
|
92
|
+
|
|
93
|
+
```python
|
|
94
|
+
import onnxruntime as ort
|
|
95
|
+
import numpy as np
|
|
96
|
+
|
|
97
|
+
class ONNXPredictor:
|
|
98
|
+
def __init__(self, model_path: str, providers: list = None):
|
|
99
|
+
if providers is None:
|
|
100
|
+
providers = ['CUDAExecutionProvider', 'CPUExecutionProvider']
|
|
101
|
+
|
|
102
|
+
sess_options = ort.SessionOptions()
|
|
103
|
+
sess_options.graph_optimization_level = ort.GraphOptimizationLevel.ORT_ENABLE_ALL
|
|
104
|
+
sess_options.intra_op_num_threads = 4
|
|
105
|
+
|
|
106
|
+
self.session = ort.InferenceSession(model_path, sess_options, providers=providers)
|
|
107
|
+
self.input_name = self.session.get_inputs()[0].name
|
|
108
|
+
self.output_names = [o.name for o in self.session.get_outputs()]
|
|
109
|
+
|
|
110
|
+
def predict(self, data: np.ndarray) -> np.ndarray:
|
|
111
|
+
if data.dtype != np.float32:
|
|
112
|
+
data = data.astype(np.float32)
|
|
113
|
+
outputs = self.session.run(self.output_names, {self.input_name: data})
|
|
114
|
+
return outputs[0]
|
|
115
|
+
|
|
116
|
+
def predict_batch(self, data: np.ndarray, batch_size: int = 32) -> np.ndarray:
|
|
117
|
+
results = []
|
|
118
|
+
for i in range(0, len(data), batch_size):
|
|
119
|
+
batch = data[i:i + batch_size]
|
|
120
|
+
results.append(self.predict(batch))
|
|
121
|
+
return np.concatenate(results, axis=0)
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## Rust Inference
|
|
125
|
+
|
|
126
|
+
```rust
|
|
127
|
+
// Cargo.toml: ort = { version = "2.0", features = ["load-dynamic"] }
|
|
128
|
+
use ort::{Environment, Session, SessionBuilder, Value};
|
|
129
|
+
use ndarray::{Array3, ArrayD, IxDyn};
|
|
130
|
+
use std::sync::Arc;
|
|
131
|
+
|
|
132
|
+
pub struct Predictor {
|
|
133
|
+
session: Session,
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
impl Predictor {
|
|
137
|
+
pub fn new(model_path: &str) -> Result<Self, ort::Error> {
|
|
138
|
+
let environment = Arc::new(
|
|
139
|
+
Environment::builder()
|
|
140
|
+
.with_name("inference")
|
|
141
|
+
.with_execution_providers([ort::ExecutionProvider::CPU(Default::default())])
|
|
142
|
+
.build()?
|
|
143
|
+
);
|
|
144
|
+
|
|
145
|
+
let session = SessionBuilder::new(&environment)?
|
|
146
|
+
.with_optimization_level(ort::GraphOptimizationLevel::Level3)?
|
|
147
|
+
.with_intra_threads(4)?
|
|
148
|
+
.with_model_from_file(model_path)?;
|
|
149
|
+
|
|
150
|
+
Ok(Self { session })
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
pub fn predict(&self, input: Array3<f32>) -> Result<Vec<f32>, ort::Error> {
|
|
154
|
+
let shape = input.shape().to_vec();
|
|
155
|
+
let data: Vec<f32> = input.into_iter().collect();
|
|
156
|
+
let tensor = Value::from_array(
|
|
157
|
+
self.session.allocator(),
|
|
158
|
+
&ArrayD::from_shape_vec(IxDyn(&shape), data)?
|
|
159
|
+
)?;
|
|
160
|
+
|
|
161
|
+
let outputs = self.session.run(vec![tensor])?;
|
|
162
|
+
let result: ArrayD<f32> = outputs[0].try_extract()?.view().to_owned();
|
|
163
|
+
Ok(result.into_iter().collect())
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
## Go Inference
|
|
169
|
+
|
|
170
|
+
```go
|
|
171
|
+
package ml
|
|
172
|
+
|
|
173
|
+
import "github.com/yalue/onnxruntime_go"
|
|
174
|
+
|
|
175
|
+
type Predictor struct {
|
|
176
|
+
session *onnxruntime_go.AdvancedSession
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
func NewPredictor(modelPath string) (*Predictor, error) {
|
|
180
|
+
onnxruntime_go.InitializeEnvironment()
|
|
181
|
+
session, err := onnxruntime_go.NewAdvancedSession(
|
|
182
|
+
modelPath,
|
|
183
|
+
[]string{"input"},
|
|
184
|
+
[]string{"output"},
|
|
185
|
+
nil,
|
|
186
|
+
)
|
|
187
|
+
if err != nil {
|
|
188
|
+
return nil, err
|
|
189
|
+
}
|
|
190
|
+
return &Predictor{session: session}, nil
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
func (p *Predictor) Predict(input []float32, shape []int64) ([]float32, error) {
|
|
194
|
+
inputTensor, _ := onnxruntime_go.NewTensor(onnxruntime_go.NewShape(shape...), input)
|
|
195
|
+
defer inputTensor.Destroy()
|
|
196
|
+
|
|
197
|
+
outputSize := int64(1)
|
|
198
|
+
for _, d := range shape[1:] { outputSize *= d }
|
|
199
|
+
outputData := make([]float32, outputSize)
|
|
200
|
+
outputTensor, _ := onnxruntime_go.NewTensor(onnxruntime_go.NewShape(shape[0], outputSize), outputData)
|
|
201
|
+
defer outputTensor.Destroy()
|
|
202
|
+
|
|
203
|
+
p.session.Run()
|
|
204
|
+
return outputTensor.GetData(), nil
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
func (p *Predictor) Close() {
|
|
208
|
+
p.session.Destroy()
|
|
209
|
+
onnxruntime_go.DestroyEnvironment()
|
|
210
|
+
}
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
## Model Optimization
|
|
214
|
+
|
|
215
|
+
### Quantization
|
|
216
|
+
|
|
217
|
+
```python
|
|
218
|
+
from onnxruntime.quantization import quantize_dynamic, QuantType
|
|
219
|
+
|
|
220
|
+
def quantize_model(input_path: str, output_path: str):
|
|
221
|
+
quantize_dynamic(input_path, output_path, weight_type=QuantType.QInt8)
|
|
222
|
+
|
|
223
|
+
def optimize_model(input_path: str, output_path: str):
|
|
224
|
+
import onnxoptimizer
|
|
225
|
+
import onnx
|
|
226
|
+
|
|
227
|
+
model = onnx.load(input_path)
|
|
228
|
+
passes = [
|
|
229
|
+
'eliminate_identity',
|
|
230
|
+
'eliminate_deadend',
|
|
231
|
+
'fuse_bn_into_conv',
|
|
232
|
+
'fuse_matmul_add_bias_into_gemm',
|
|
233
|
+
]
|
|
234
|
+
optimized = onnxoptimizer.optimize(model, passes)
|
|
235
|
+
onnx.save(optimized, output_path)
|
|
236
|
+
|
|
237
|
+
# Full pipeline
|
|
238
|
+
def prepare_for_edge(model_path: str):
|
|
239
|
+
base = model_path.replace('.onnx', '')
|
|
240
|
+
optimize_model(model_path, f"{base}_optimized.onnx")
|
|
241
|
+
quantize_model(f"{base}_optimized.onnx", f"{base}_quantized.onnx")
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
## Model Registry
|
|
245
|
+
|
|
246
|
+
```python
|
|
247
|
+
import hashlib
|
|
248
|
+
import json
|
|
249
|
+
from pathlib import Path
|
|
250
|
+
from datetime import datetime
|
|
251
|
+
|
|
252
|
+
class ModelRegistry:
|
|
253
|
+
def __init__(self, registry_path: str = "models/registry.json"):
|
|
254
|
+
self.path = Path(registry_path)
|
|
255
|
+
self.registry = json.loads(self.path.read_text()) if self.path.exists() else {"models": {}}
|
|
256
|
+
|
|
257
|
+
def register(self, name: str, model_path: str, version: str, metrics: dict = None):
|
|
258
|
+
model_hash = hashlib.sha256(Path(model_path).read_bytes()).hexdigest()[:16]
|
|
259
|
+
if name not in self.registry["models"]:
|
|
260
|
+
self.registry["models"][name] = {"versions": {}}
|
|
261
|
+
|
|
262
|
+
self.registry["models"][name]["versions"][version] = {
|
|
263
|
+
"path": model_path,
|
|
264
|
+
"hash": model_hash,
|
|
265
|
+
"registered_at": datetime.utcnow().isoformat(),
|
|
266
|
+
"metrics": metrics or {}
|
|
267
|
+
}
|
|
268
|
+
self.registry["models"][name]["latest"] = version
|
|
269
|
+
self.path.write_text(json.dumps(self.registry, indent=2))
|
|
270
|
+
|
|
271
|
+
def get_path(self, name: str, version: str = "latest") -> str:
|
|
272
|
+
if version == "latest":
|
|
273
|
+
version = self.registry["models"][name]["latest"]
|
|
274
|
+
return self.registry["models"][name]["versions"][version]["path"]
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
## Best Practices
|
|
278
|
+
|
|
279
|
+
1. **Dynamic axes** - Enable batch dimension flexibility
|
|
280
|
+
2. **Quantize for edge** - INT8 reduces size ~4x with minimal accuracy loss
|
|
281
|
+
3. **Validate exports** - Always run `onnx.checker.check_model()`
|
|
282
|
+
4. **Use execution providers** - CUDA > TensorRT > CPU fallback
|
|
283
|
+
5. **Version models** - Track hash, metrics, and metadata
|
|
284
|
+
|
|
285
|
+
## Related Skills
|
|
286
|
+
|
|
287
|
+
- `pytorch`: Model training source
|
|
288
|
+
- `scikit-learn`: Classical ML models
|
|
289
|
+
- `ai-ml`: Full pipeline patterns
|
|
290
|
+
- `fastapi`: Model serving API
|