@zenrick/zenkit 0.0.0-stage → 0.5.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/.claude-plugin/marketplace.json +19 -0
- package/.cursor-plugin/marketplace.json +22 -0
- package/INSTALL.md +73 -0
- package/LICENSE +202 -0
- package/NOTICE +5 -0
- package/README.md +69 -3
- package/TERMS.md +48 -0
- package/THIRD-PARTY-NOTICES.md +109 -0
- package/kit/agents/backend-specialist.md +263 -0
- package/kit/agents/code-archaeologist.md +106 -0
- package/kit/agents/database-architect.md +226 -0
- package/kit/agents/debugger.md +226 -0
- package/kit/agents/devops-engineer.md +242 -0
- package/kit/agents/documentation-writer.md +104 -0
- package/kit/agents/explorer-agent.md +73 -0
- package/kit/agents/frontend-specialist.md +593 -0
- package/kit/agents/game-developer.md +162 -0
- package/kit/agents/mobile-developer.md +377 -0
- package/kit/agents/orchestrator.md +489 -0
- package/kit/agents/penetration-tester.md +188 -0
- package/kit/agents/performance-optimizer.md +187 -0
- package/kit/agents/product-manager.md +112 -0
- package/kit/agents/product-owner.md +95 -0
- package/kit/agents/project-planner.md +409 -0
- package/kit/agents/qa-automation-engineer.md +103 -0
- package/kit/agents/security-auditor.md +170 -0
- package/kit/agents/seo-specialist.md +111 -0
- package/kit/agents/test-engineer.md +158 -0
- package/kit/bundles/agent-building.yaml +26 -0
- package/kit/bundles/backend-data.yaml +14 -0
- package/kit/bundles/base.yaml +10 -0
- package/kit/bundles/core.yaml +21 -0
- package/kit/bundles/kit-engenharia.yaml +8 -0
- package/kit/bundles/kit-lite.yaml +9 -0
- package/kit/bundles/security.yaml +11 -0
- package/kit/bundles/ship-run.yaml +16 -0
- package/kit/bundles/web-ui.yaml +18 -0
- package/kit/commands/docs.md +33 -0
- package/kit/commands/explain.md +41 -0
- package/kit/commands/fix.md +65 -0
- package/kit/commands/implement.md +35 -0
- package/kit/commands/refactor.md +59 -0
- package/kit/commands/review.md +55 -0
- package/kit/commands/test.md +63 -0
- package/kit/modules/bridge/rules/cross-ide-bridge.mdc +73 -0
- package/kit/modules/bridge/zenkit-layer.yaml +1 -0
- package/kit/modules/nexuscore/sections/convivencia.md +12 -0
- package/kit/modules/nexuscore/sections/memoria.md +9 -0
- package/kit/modules/nexuscore/skills/quadro-agentes/SKILL.md +186 -0
- package/kit/modules/nexuscore/zenkit-layer.yaml +1 -0
- package/kit/rules/ZENKIT.mdc +294 -0
- package/kit/rules/git.mdc +51 -0
- package/kit/rules/karpathy-guidelines.mdc +70 -0
- package/kit/rules/model-routing.mdc +89 -0
- package/kit/rules/security-headers.mdc +41 -0
- package/kit/rules/social-automation.mdc +69 -0
- package/kit/rules/toc.mdc +40 -0
- package/kit/skills/api-patterns/SKILL.md +95 -0
- package/kit/skills/api-patterns/api-style.md +42 -0
- package/kit/skills/api-patterns/auth.md +24 -0
- package/kit/skills/api-patterns/documentation.md +26 -0
- package/kit/skills/api-patterns/graphql.md +41 -0
- package/kit/skills/api-patterns/rate-limiting.md +31 -0
- package/kit/skills/api-patterns/references/backend/backend-api-design.md +495 -0
- package/kit/skills/api-patterns/references/backend/backend-architecture.md +454 -0
- package/kit/skills/api-patterns/references/backend/backend-authentication.md +338 -0
- package/kit/skills/api-patterns/references/backend/backend-code-quality.md +659 -0
- package/kit/skills/api-patterns/references/backend/backend-debugging.md +904 -0
- package/kit/skills/api-patterns/references/backend/backend-devops.md +494 -0
- package/kit/skills/api-patterns/references/backend/backend-mindset.md +387 -0
- package/kit/skills/api-patterns/references/backend/backend-performance.md +397 -0
- package/kit/skills/api-patterns/references/backend/backend-security.md +290 -0
- package/kit/skills/api-patterns/references/backend/backend-technologies.md +256 -0
- package/kit/skills/api-patterns/references/backend/backend-testing.md +429 -0
- package/kit/skills/api-patterns/response.md +37 -0
- package/kit/skills/api-patterns/rest.md +40 -0
- package/kit/skills/api-patterns/scripts/api_validator.py +211 -0
- package/kit/skills/api-patterns/security-testing.md +122 -0
- package/kit/skills/api-patterns/trpc.md +41 -0
- package/kit/skills/api-patterns/versioning.md +22 -0
- package/kit/skills/app-builder/SKILL.md +76 -0
- package/kit/skills/app-builder/agent-coordination.md +71 -0
- package/kit/skills/app-builder/feature-building.md +53 -0
- package/kit/skills/app-builder/project-detection.md +34 -0
- package/kit/skills/app-builder/scaffolding.md +118 -0
- package/kit/skills/app-builder/tech-stack.md +41 -0
- package/kit/skills/app-builder/templates/SKILL.md +39 -0
- package/kit/skills/app-builder/templates/astro-static/TEMPLATE.md +76 -0
- package/kit/skills/app-builder/templates/chrome-extension/TEMPLATE.md +92 -0
- package/kit/skills/app-builder/templates/cli-tool/TEMPLATE.md +88 -0
- package/kit/skills/app-builder/templates/electron-desktop/TEMPLATE.md +88 -0
- package/kit/skills/app-builder/templates/express-api/TEMPLATE.md +83 -0
- package/kit/skills/app-builder/templates/flutter-app/TEMPLATE.md +90 -0
- package/kit/skills/app-builder/templates/monorepo-turborepo/TEMPLATE.md +90 -0
- package/kit/skills/app-builder/templates/nextjs-fullstack/TEMPLATE.md +122 -0
- package/kit/skills/app-builder/templates/nextjs-saas/TEMPLATE.md +122 -0
- package/kit/skills/app-builder/templates/nextjs-static/TEMPLATE.md +169 -0
- package/kit/skills/app-builder/templates/nuxt-app/TEMPLATE.md +134 -0
- package/kit/skills/app-builder/templates/python-fastapi/TEMPLATE.md +83 -0
- package/kit/skills/app-builder/templates/react-native-app/TEMPLATE.md +119 -0
- package/kit/skills/architecture/SKILL.md +56 -0
- package/kit/skills/architecture/context-discovery.md +43 -0
- package/kit/skills/architecture/examples.md +94 -0
- package/kit/skills/architecture/pattern-selection.md +68 -0
- package/kit/skills/architecture/patterns-reference.md +50 -0
- package/kit/skills/architecture/trade-off-analysis.md +77 -0
- package/kit/skills/bash-linux/SKILL.md +203 -0
- package/kit/skills/batch-operations/SKILL.md +112 -0
- package/kit/skills/behavioral-modes/SKILL.md +255 -0
- package/kit/skills/brainstorming/SKILL.md +189 -0
- package/kit/skills/brainstorming/dynamic-questioning.md +350 -0
- package/kit/skills/brainstorming/references/problem-solving/attribution.md +69 -0
- package/kit/skills/brainstorming/references/problem-solving/collision-zone-thinking.md +79 -0
- package/kit/skills/brainstorming/references/problem-solving/inversion-exercise.md +91 -0
- package/kit/skills/brainstorming/references/problem-solving/meta-pattern-recognition.md +87 -0
- package/kit/skills/brainstorming/references/problem-solving/scale-game.md +95 -0
- package/kit/skills/brainstorming/references/problem-solving/simplification-cascades.md +80 -0
- package/kit/skills/brainstorming/references/problem-solving/when-stuck.md +72 -0
- package/kit/skills/claude-exec/SKILL.md +185 -0
- package/kit/skills/clean-code/SKILL.md +210 -0
- package/kit/skills/code-review-checklist/SKILL.md +115 -0
- package/kit/skills/code-review-graph/SKILL.md +50 -0
- package/kit/skills/code-review-graph/references/alternatives-comparison.md +12 -0
- package/kit/skills/code-review-graph/references/best-practices.md +9 -0
- package/kit/skills/code-review-graph/references/configuration.md +43 -0
- package/kit/skills/code-review-graph/references/core-workflows.md +61 -0
- package/kit/skills/code-review-graph/references/how-it-works-4-layers.md +20 -0
- package/kit/skills/code-review-graph/references/installation.md +67 -0
- package/kit/skills/code-review-graph/references/integration-with-zenkit.md +23 -0
- package/kit/skills/code-review-graph/references/known-limitations.md +13 -0
- package/kit/skills/code-review-graph/references/when-to-use-vs-when-to-skip.md +21 -0
- package/kit/skills/codex-exec/SKILL.md +161 -0
- package/kit/skills/context-compression/SKILL.md +145 -0
- package/kit/skills/coordinator-mode/SKILL.md +215 -0
- package/kit/skills/cursor-exec/SKILL.md +152 -0
- package/kit/skills/database-design/SKILL.md +53 -0
- package/kit/skills/database-design/database-selection.md +43 -0
- package/kit/skills/database-design/indexing.md +39 -0
- package/kit/skills/database-design/migrations.md +48 -0
- package/kit/skills/database-design/optimization.md +36 -0
- package/kit/skills/database-design/orm-selection.md +30 -0
- package/kit/skills/database-design/schema-design.md +56 -0
- package/kit/skills/database-design/scripts/schema_validator.py +172 -0
- package/kit/skills/deployment-procedures/SKILL.md +242 -0
- package/kit/skills/deprecation-and-migration/SKILL.md +149 -0
- package/kit/skills/documentation-templates/SKILL.md +195 -0
- package/kit/skills/entrega-com-agentes/SKILL.md +177 -0
- package/kit/skills/frontend-design/NOTICE.md +6 -0
- package/kit/skills/frontend-design/SKILL.md +456 -0
- package/kit/skills/frontend-design/animation-guide.md +331 -0
- package/kit/skills/frontend-design/color-system.md +311 -0
- package/kit/skills/frontend-design/decision-trees.md +418 -0
- package/kit/skills/frontend-design/motion-graphics.md +306 -0
- package/kit/skills/frontend-design/references/aesthetic/design-guideline-template.md +163 -0
- package/kit/skills/frontend-design/references/aesthetic/design-principles.md +62 -0
- package/kit/skills/frontend-design/references/aesthetic/design-resources.md +75 -0
- package/kit/skills/frontend-design/references/aesthetic/design-story-template.md +135 -0
- package/kit/skills/frontend-design/references/aesthetic/micro-interactions.md +53 -0
- package/kit/skills/frontend-design/references/aesthetic/storytelling-design.md +50 -0
- package/kit/skills/frontend-design/scripts/accessibility_checker.py +183 -0
- package/kit/skills/frontend-design/scripts/ux_audit.py +722 -0
- package/kit/skills/frontend-design/typography-system.md +345 -0
- package/kit/skills/frontend-design/ux-psychology.md +1116 -0
- package/kit/skills/frontend-design/visual-effects.md +383 -0
- package/kit/skills/game-development/2d-games/SKILL.md +119 -0
- package/kit/skills/game-development/3d-games/SKILL.md +135 -0
- package/kit/skills/game-development/SKILL.md +168 -0
- package/kit/skills/game-development/game-art/SKILL.md +185 -0
- package/kit/skills/game-development/game-audio/SKILL.md +190 -0
- package/kit/skills/game-development/game-design/SKILL.md +129 -0
- package/kit/skills/game-development/mobile-games/SKILL.md +108 -0
- package/kit/skills/game-development/multiplayer/SKILL.md +132 -0
- package/kit/skills/game-development/pc-games/SKILL.md +144 -0
- package/kit/skills/game-development/vr-ar/SKILL.md +123 -0
- package/kit/skills/game-development/web-games/SKILL.md +150 -0
- package/kit/skills/gemini-exec/SKILL.md +80 -0
- package/kit/skills/geo-fundamentals/SKILL.md +157 -0
- package/kit/skills/geo-fundamentals/scripts/geo_checker.py +289 -0
- package/kit/skills/git-worktrees/SKILL.md +107 -0
- package/kit/skills/i18n-localization/SKILL.md +145 -0
- package/kit/skills/i18n-localization/scripts/i18n_checker.py +241 -0
- package/kit/skills/intelligent-routing/SKILL.md +128 -0
- package/kit/skills/intelligent-routing/references/4-response-format.md +16 -0
- package/kit/skills/intelligent-routing/references/complexity-assessment.md +29 -0
- package/kit/skills/intelligent-routing/references/debug-intelligent-routing.md +9 -0
- package/kit/skills/intelligent-routing/references/debugging-agent-selection.md +7 -0
- package/kit/skills/intelligent-routing/references/domain-detection-rules.md +29 -0
- package/kit/skills/intelligent-routing/references/edge-cases.md +29 -0
- package/kit/skills/intelligent-routing/references/implementation-rules.md +35 -0
- package/kit/skills/intelligent-routing/references/integration-with-existing-workflows.md +21 -0
- package/kit/skills/intelligent-routing/references/performance-considerations.md +14 -0
- package/kit/skills/intelligent-routing/references/summary.md +16 -0
- package/kit/skills/intelligent-routing/references/testing-the-system.md +36 -0
- package/kit/skills/intelligent-routing/references/tier-0-automatic-analysis-always-active.md +27 -0
- package/kit/skills/intelligent-routing/references/user-education.md +12 -0
- package/kit/skills/karpathy-guidelines/SKILL.md +67 -0
- package/kit/skills/karpathy-guidelines/references/EXAMPLES.md +522 -0
- package/kit/skills/lint-and-validate/SKILL.md +46 -0
- package/kit/skills/lint-and-validate/scripts/lint_runner.py +184 -0
- package/kit/skills/lint-and-validate/scripts/type_coverage.py +173 -0
- package/kit/skills/mcp-atuacao/SKILL.md +238 -0
- package/kit/skills/mcp-builder/NOTICE.md +6 -0
- package/kit/skills/mcp-builder/SKILL.md +259 -0
- package/kit/skills/memory-system/SKILL.md +181 -0
- package/kit/skills/mobile-design/SKILL.md +395 -0
- package/kit/skills/mobile-design/decision-trees.md +516 -0
- package/kit/skills/mobile-design/mobile-backend.md +491 -0
- package/kit/skills/mobile-design/mobile-color-system.md +420 -0
- package/kit/skills/mobile-design/mobile-debugging.md +122 -0
- package/kit/skills/mobile-design/mobile-design-thinking.md +357 -0
- package/kit/skills/mobile-design/mobile-navigation.md +458 -0
- package/kit/skills/mobile-design/mobile-performance.md +767 -0
- package/kit/skills/mobile-design/mobile-testing.md +356 -0
- package/kit/skills/mobile-design/mobile-typography.md +433 -0
- package/kit/skills/mobile-design/platform-android.md +666 -0
- package/kit/skills/mobile-design/platform-ios.md +561 -0
- package/kit/skills/mobile-design/scripts/mobile_audit.py +670 -0
- package/kit/skills/mobile-design/touch-psychology.md +537 -0
- package/kit/skills/negocio-agente-conversa/SKILL.md +168 -0
- package/kit/skills/negocio-atendimento/SKILL.md +134 -0
- package/kit/skills/negocio-linguagem/SKILL.md +166 -0
- package/kit/skills/negocio-preco/SKILL.md +174 -0
- package/kit/skills/negocio-preco/scripts/preco.mjs +160 -0
- package/kit/skills/negocio-qualificacao/SKILL.md +140 -0
- package/kit/skills/nextjs-react-expert/1-async-eliminating-waterfalls.md +351 -0
- package/kit/skills/nextjs-react-expert/2-bundle-bundle-size-optimization.md +240 -0
- package/kit/skills/nextjs-react-expert/3-server-server-side-performance.md +490 -0
- package/kit/skills/nextjs-react-expert/4-client-client-side-data-fetching.md +264 -0
- package/kit/skills/nextjs-react-expert/5-rerender-re-render-optimization.md +581 -0
- package/kit/skills/nextjs-react-expert/6-rendering-rendering-performance.md +432 -0
- package/kit/skills/nextjs-react-expert/7-js-javascript-performance.md +684 -0
- package/kit/skills/nextjs-react-expert/8-advanced-advanced-patterns.md +150 -0
- package/kit/skills/nextjs-react-expert/9-cache-components.md +103 -0
- package/kit/skills/nextjs-react-expert/SKILL.md +308 -0
- package/kit/skills/nextjs-react-expert/resources/app-patterns/common-patterns.md +331 -0
- package/kit/skills/nextjs-react-expert/resources/app-patterns/complete-examples.md +872 -0
- package/kit/skills/nextjs-react-expert/resources/app-patterns/component-patterns.md +502 -0
- package/kit/skills/nextjs-react-expert/resources/app-patterns/data-fetching.md +767 -0
- package/kit/skills/nextjs-react-expert/resources/app-patterns/file-organization.md +502 -0
- package/kit/skills/nextjs-react-expert/resources/app-patterns/loading-and-error-states.md +501 -0
- package/kit/skills/nextjs-react-expert/resources/app-patterns/performance.md +406 -0
- package/kit/skills/nextjs-react-expert/resources/app-patterns/routing-guide.md +364 -0
- package/kit/skills/nextjs-react-expert/resources/app-patterns/styling-guide.md +428 -0
- package/kit/skills/nextjs-react-expert/resources/app-patterns/typescript-standards.md +418 -0
- package/kit/skills/nextjs-react-expert/scripts/convert_rules.py +222 -0
- package/kit/skills/nextjs-react-expert/scripts/react_performance_checker.py +252 -0
- package/kit/skills/nodejs-best-practices/SKILL.md +78 -0
- package/kit/skills/nodejs-best-practices/references/10-anti-patterns-to-avoid.md +21 -0
- package/kit/skills/nodejs-best-practices/references/11-decision-checklist.md +14 -0
- package/kit/skills/nodejs-best-practices/references/2-runtime-considerations-2025.md +36 -0
- package/kit/skills/nodejs-best-practices/references/3-architecture-principles.md +35 -0
- package/kit/skills/nodejs-best-practices/references/4-error-handling-principles.md +42 -0
- package/kit/skills/nodejs-best-practices/references/5-async-patterns-principles.md +35 -0
- package/kit/skills/nodejs-best-practices/references/6-validation-principles.md +29 -0
- package/kit/skills/nodejs-best-practices/references/7-security-principles.md +29 -0
- package/kit/skills/nodejs-best-practices/references/8-testing-principles.md +28 -0
- package/kit/skills/observability-and-instrumentation/SKILL.md +150 -0
- package/kit/skills/opencode-go-exec/SKILL.md +101 -0
- package/kit/skills/parallel-agents/SKILL.md +184 -0
- package/kit/skills/performance-profiling/SKILL.md +145 -0
- package/kit/skills/performance-profiling/scripts/lighthouse_audit.py +76 -0
- package/kit/skills/plan-writing/SKILL.md +213 -0
- package/kit/skills/powershell-windows/SKILL.md +196 -0
- package/kit/skills/provider-orchestration/SKILL.md +269 -0
- package/kit/skills/python-patterns/SKILL.md +80 -0
- package/kit/skills/python-patterns/references/10-decision-checklist.md +14 -0
- package/kit/skills/python-patterns/references/11-anti-patterns-to-avoid.md +20 -0
- package/kit/skills/python-patterns/references/2-async-vs-sync-decision.md +44 -0
- package/kit/skills/python-patterns/references/3-type-hints-strategy.md +56 -0
- package/kit/skills/python-patterns/references/4-project-structure-principles.md +56 -0
- package/kit/skills/python-patterns/references/5-django-principles-2025.md +40 -0
- package/kit/skills/python-patterns/references/6-fastapi-principles.md +50 -0
- package/kit/skills/python-patterns/references/7-background-tasks.md +31 -0
- package/kit/skills/python-patterns/references/8-error-handling-principles.md +29 -0
- package/kit/skills/python-patterns/references/9-testing-principles.md +37 -0
- package/kit/skills/red-team-tactics/SKILL.md +201 -0
- package/kit/skills/research/SKILL.md +166 -0
- package/kit/skills/rust-pro/SKILL.md +177 -0
- package/kit/skills/seo-fundamentals/SKILL.md +130 -0
- package/kit/skills/seo-fundamentals/scripts/seo_checker.py +219 -0
- package/kit/skills/sequential-thinking/.env.example +8 -0
- package/kit/skills/sequential-thinking/README.md +183 -0
- package/kit/skills/sequential-thinking/SKILL.md +95 -0
- package/kit/skills/sequential-thinking/package.json +31 -0
- package/kit/skills/sequential-thinking/references/advanced-strategies.md +79 -0
- package/kit/skills/sequential-thinking/references/advanced-techniques.md +76 -0
- package/kit/skills/sequential-thinking/references/core-patterns.md +95 -0
- package/kit/skills/sequential-thinking/references/examples-api.md +88 -0
- package/kit/skills/sequential-thinking/references/examples-architecture.md +94 -0
- package/kit/skills/sequential-thinking/references/examples-debug.md +90 -0
- package/kit/skills/sequential-thinking/scripts/format-thought.js +159 -0
- package/kit/skills/sequential-thinking/scripts/process-thought.js +236 -0
- package/kit/skills/server-management/SKILL.md +162 -0
- package/kit/skills/simplify-code/SKILL.md +133 -0
- package/kit/skills/skillify/SKILL.md +116 -0
- package/kit/skills/system-design-interview/SKILL.md +268 -0
- package/kit/skills/systematic-debugging/SKILL.md +110 -0
- package/kit/skills/tailwind-patterns/SKILL.md +283 -0
- package/kit/skills/tailwind-patterns/references/shadcn-ui/canvas-design-system.md +320 -0
- package/kit/skills/tailwind-patterns/references/shadcn-ui/shadcn-accessibility.md +471 -0
- package/kit/skills/tailwind-patterns/references/shadcn-ui/shadcn-components.md +424 -0
- package/kit/skills/tailwind-patterns/references/shadcn-ui/shadcn-theming.md +373 -0
- package/kit/skills/tailwind-patterns/references/shadcn-ui/tailwind-customization.md +483 -0
- package/kit/skills/tailwind-patterns/references/shadcn-ui/tailwind-responsive.md +382 -0
- package/kit/skills/tailwind-patterns/references/shadcn-ui/tailwind-utilities.md +455 -0
- package/kit/skills/tdd-workflow/SKILL.md +150 -0
- package/kit/skills/testing-patterns/SKILL.md +196 -0
- package/kit/skills/testing-patterns/scripts/test_runner.py +219 -0
- package/kit/skills/ui-ux-pro-max/SKILL.md +135 -0
- package/kit/skills/verify-changes/SKILL.md +125 -0
- package/kit/skills/vulnerability-scanner/SKILL.md +278 -0
- package/kit/skills/vulnerability-scanner/checklists.md +121 -0
- package/kit/skills/vulnerability-scanner/scripts/security_scan.py +458 -0
- package/kit/skills/web-design-guidelines/SKILL.md +58 -0
- package/kit/skills/webapp-testing/NOTICE.md +6 -0
- package/kit/skills/webapp-testing/SKILL.md +188 -0
- package/kit/skills/webapp-testing/scripts/playwright_runner.py +173 -0
- package/kit/workflows/brainstorm.md +113 -0
- package/kit/workflows/coordinate.md +72 -0
- package/kit/workflows/create.md +59 -0
- package/kit/workflows/debug.md +103 -0
- package/kit/workflows/deploy.md +176 -0
- package/kit/workflows/enhance.md +63 -0
- package/kit/workflows/orchestrate.md +237 -0
- package/kit/workflows/plan.md +89 -0
- package/kit/workflows/preview.md +81 -0
- package/kit/workflows/remember.md +67 -0
- package/kit/workflows/status.md +86 -0
- package/kit/workflows/test.md +144 -0
- package/kit/workflows/ui-ux-pro-max.md +296 -0
- package/kit/workflows/verify.md +72 -0
- package/licenses/Apache-2.0.txt +202 -0
- package/package.json +60 -6
- package/scripts/avaliar-vigilancia-mandato.mjs +38 -0
- package/scripts/bundle.mjs +158 -0
- package/scripts/check-deps.mjs +178 -0
- package/scripts/check-models.mjs +150 -0
- package/scripts/cli.mjs +295 -0
- package/scripts/continuidade-mandato.mjs +47 -0
- package/scripts/discriminar-turno.mjs +191 -0
- package/scripts/doctor.mjs +615 -0
- package/scripts/generate.mjs +676 -0
- package/scripts/install.mjs +11 -0
- package/scripts/layer-remote.mjs +344 -0
- package/scripts/layers.mjs +208 -0
- package/scripts/marketplace.mjs +77 -0
- package/scripts/product.mjs +32 -0
- package/scripts/ruleset-core.mjs +68 -0
- package/scripts/social-hooks.mjs +293 -0
- package/scripts/social-pacer.mjs +219 -0
- package/scripts/validate-bundles.mjs +14 -0
- package/scripts/validate-skills.mjs +174 -0
- package/scripts/zenkit-daemon-task.cmd +3 -0
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* check-models.mjs — finds LLM model ids hard-coded in a repository and checks
|
|
4
|
+
* each one against the provider's live model list, so a retired model is
|
|
5
|
+
* reported here instead of as a 404 in production (DEM-ZNK-DEP-01).
|
|
6
|
+
*
|
|
7
|
+
* Usage: node scripts/check-models.mjs [--json] [repoDir...]
|
|
8
|
+
* Keys (optional, read from env, never printed): ANTHROPIC_API_KEY,
|
|
9
|
+
* OPENAI_API_KEY, GEMINI_API_KEY, DEEPSEEK_API_KEY, MOONSHOT_API_KEY.
|
|
10
|
+
* A provider without a key is reported as "unverified", not as a failure.
|
|
11
|
+
*/
|
|
12
|
+
import { readFileSync, readdirSync, statSync } from "node:fs";
|
|
13
|
+
import { extname, join, relative, resolve } from "node:path";
|
|
14
|
+
import { pathToFileURL } from "node:url";
|
|
15
|
+
|
|
16
|
+
// Tests carry made-up ids on purpose (pricing tables, parser fixtures); only shipped code can 404.
|
|
17
|
+
const SKIP_DIRS = new Set(["node_modules", ".git", "dist", "build", ".venv", "venv", "__pycache__", "coverage", "tests", "test", "__tests__", "fixtures"]);
|
|
18
|
+
const TEST_FILE = /(^test_.*\.py$|_test\.py$|\.(test|spec)\.[cm]?[jt]sx?$)/;
|
|
19
|
+
const SCAN_EXT = new Set([".ts", ".tsx", ".js", ".mjs", ".cjs", ".py", ".json", ".yaml", ".yml", ".toml", ".env", ".example", ".sh"]);
|
|
20
|
+
const SKIP_FILES = /(package-lock\.json|pnpm-lock\.yaml|yarn\.lock|uv\.lock|poetry\.lock|CHANGELOG)/;
|
|
21
|
+
const MAX_FILE_BYTES = 512 * 1024;
|
|
22
|
+
|
|
23
|
+
export const PROVIDERS = {
|
|
24
|
+
anthropic: {
|
|
25
|
+
pattern: /\bclaude-(?:(?:opus|sonnet|haiku|fable)-)?\d[0-9a-z.-]*/g,
|
|
26
|
+
key: "ANTHROPIC_API_KEY",
|
|
27
|
+
list: async (key) =>
|
|
28
|
+
(await getJson("https://api.anthropic.com/v1/models?limit=1000", {
|
|
29
|
+
"x-api-key": key,
|
|
30
|
+
"anthropic-version": "2023-06-01",
|
|
31
|
+
})).data.map((m) => m.id),
|
|
32
|
+
},
|
|
33
|
+
openai: {
|
|
34
|
+
pattern: /\bgpt-\d[0-9a-z.-]*/g,
|
|
35
|
+
key: "OPENAI_API_KEY",
|
|
36
|
+
list: async (key) =>
|
|
37
|
+
(await getJson("https://api.openai.com/v1/models", { authorization: `Bearer ${key}` })).data.map((m) => m.id),
|
|
38
|
+
},
|
|
39
|
+
google: {
|
|
40
|
+
pattern: /\bgemini-\d[0-9a-z.-]*/g,
|
|
41
|
+
key: "GEMINI_API_KEY",
|
|
42
|
+
list: async (key) =>
|
|
43
|
+
(await getJson("https://generativelanguage.googleapis.com/v1beta/models?pageSize=1000", {
|
|
44
|
+
"x-goog-api-key": key,
|
|
45
|
+
})).models.map((m) => m.name.replace(/^models\//, "")),
|
|
46
|
+
},
|
|
47
|
+
deepseek: {
|
|
48
|
+
pattern: /\bdeepseek-(?:chat|reasoner|coder|v\d)[0-9a-z.-]*/g,
|
|
49
|
+
key: "DEEPSEEK_API_KEY",
|
|
50
|
+
list: async (key) =>
|
|
51
|
+
(await getJson("https://api.deepseek.com/models", { authorization: `Bearer ${key}` })).data.map((m) => m.id),
|
|
52
|
+
},
|
|
53
|
+
moonshot: {
|
|
54
|
+
pattern: /\b(?:kimi-k\d[0-9a-z.-]*|moonshot-v1-[0-9a-z-]+)/g,
|
|
55
|
+
key: "MOONSHOT_API_KEY",
|
|
56
|
+
list: async (key) =>
|
|
57
|
+
(await getJson("https://api.moonshot.ai/v1/models", { authorization: `Bearer ${key}` })).data.map((m) => m.id),
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
async function getJson(url, headers) {
|
|
62
|
+
const res = await fetch(url, { headers, signal: AbortSignal.timeout(20_000) });
|
|
63
|
+
if (!res.ok) throw new Error(`HTTP ${res.status}`);
|
|
64
|
+
return res.json();
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/** Model ids per provider found in a text blob (trailing separators trimmed). */
|
|
68
|
+
export function extractModelIds(text) {
|
|
69
|
+
const found = {};
|
|
70
|
+
for (const [name, p] of Object.entries(PROVIDERS)) {
|
|
71
|
+
for (const m of text.matchAll(p.pattern)) {
|
|
72
|
+
const id = m[0].replace(/[.-]+$/, "");
|
|
73
|
+
(found[name] ??= new Set()).add(id);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return found;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/** An alias like claude-haiku-4-5 is live when a dated id extends it. */
|
|
80
|
+
export function isListed(id, listed) {
|
|
81
|
+
return listed.some((l) => l === id || l.startsWith(`${id}-`));
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function* files(dir) {
|
|
85
|
+
for (const n of readdirSync(dir)) {
|
|
86
|
+
if (SKIP_DIRS.has(n)) continue;
|
|
87
|
+
const full = join(dir, n);
|
|
88
|
+
const st = statSync(full);
|
|
89
|
+
if (st.isDirectory()) yield* files(full);
|
|
90
|
+
else if (st.size <= MAX_FILE_BYTES && !SKIP_FILES.test(n) && !TEST_FILE.test(n) && (SCAN_EXT.has(extname(n)) || n.startsWith(".env"))) yield full;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/** { provider: { id: [file, ...] } } for one repository. */
|
|
95
|
+
export function scanRepo(root) {
|
|
96
|
+
const usage = {};
|
|
97
|
+
for (const f of files(root)) {
|
|
98
|
+
const ids = extractModelIds(readFileSync(f, "utf8"));
|
|
99
|
+
for (const [prov, set] of Object.entries(ids)) {
|
|
100
|
+
for (const id of set) ((usage[prov] ??= {})[id] ??= []).push(relative(root, f));
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
return usage;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export async function checkModels(roots, env = process.env, listFn = (p, key) => PROVIDERS[p].list(key)) {
|
|
107
|
+
const usage = {};
|
|
108
|
+
for (const root of roots) {
|
|
109
|
+
for (const [prov, ids] of Object.entries(scanRepo(root))) {
|
|
110
|
+
for (const [id, fs] of Object.entries(ids)) {
|
|
111
|
+
((usage[prov] ??= {})[id] ??= []).push(...fs.map((f) => `${root}:${f}`));
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
const report = { retired: [], unverified: [], ok: [] };
|
|
116
|
+
for (const [prov, ids] of Object.entries(usage)) {
|
|
117
|
+
const key = env[PROVIDERS[prov].key];
|
|
118
|
+
let listed = null;
|
|
119
|
+
let reason = `no ${PROVIDERS[prov].key}`;
|
|
120
|
+
if (key) {
|
|
121
|
+
try {
|
|
122
|
+
listed = await listFn(prov, key);
|
|
123
|
+
} catch (e) {
|
|
124
|
+
reason = `model list failed: ${e.message}`;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
for (const [id, where] of Object.entries(ids)) {
|
|
128
|
+
const row = { provider: prov, id, where: [...new Set(where)].slice(0, 5) };
|
|
129
|
+
if (!listed) report.unverified.push({ ...row, reason });
|
|
130
|
+
else if (isListed(id, listed)) report.ok.push(row);
|
|
131
|
+
else report.retired.push(row);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
return report;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
if (import.meta.url === pathToFileURL(process.argv[1] ?? "").href) {
|
|
138
|
+
const args = process.argv.slice(2);
|
|
139
|
+
const json = args.includes("--json");
|
|
140
|
+
const targets = args.filter((a) => a !== "--json");
|
|
141
|
+
const report = await checkModels((targets.length ? targets : ["."]).map((t) => resolve(t)));
|
|
142
|
+
if (json) {
|
|
143
|
+
console.log(JSON.stringify(report, null, 2));
|
|
144
|
+
} else {
|
|
145
|
+
for (const r of report.retired) console.error(` ⛔ ${r.provider} ${r.id} — not in the provider list (${r.where.join(", ")})`);
|
|
146
|
+
for (const r of report.unverified) console.warn(` ⚠️ ${r.provider} ${r.id} — unverified: ${r.reason}`);
|
|
147
|
+
console.log(`models: ${report.ok.length} live, ${report.retired.length} retired, ${report.unverified.length} unverified`);
|
|
148
|
+
}
|
|
149
|
+
process.exit(report.retired.length > 0 ? 1 : 0);
|
|
150
|
+
}
|
package/scripts/cli.mjs
ADDED
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* zenkit — um comando. Sem caminho absoluto, sem saber qual script chamar.
|
|
4
|
+
*
|
|
5
|
+
* npx /caminho/para/zenkit # init Kit Lite no cwd
|
|
6
|
+
* zenkit init --into . --bundle kit-engenharia
|
|
7
|
+
* zenkit init --plugin # Cursor local + Claude plugin-dir
|
|
8
|
+
* zenkit doctor
|
|
9
|
+
* zenkit bundles
|
|
10
|
+
* zenkit generate --plugins
|
|
11
|
+
*
|
|
12
|
+
* scripts/install.mjs continua: mesmo init, para quem já tinha o comando antigo.
|
|
13
|
+
*/
|
|
14
|
+
import { promises as fs } from "node:fs";
|
|
15
|
+
import os from "node:os";
|
|
16
|
+
import path from "node:path";
|
|
17
|
+
import { fileURLToPath } from "node:url";
|
|
18
|
+
import { generateKit, emitPluginPackage, emitStorefrontPlugins } from "./generate.mjs";
|
|
19
|
+
import { loadBundleFiles, resolveBundle } from "./bundle.mjs";
|
|
20
|
+
import { writeMarketplaces } from "./marketplace.mjs";
|
|
21
|
+
import {
|
|
22
|
+
MAX_ARCHIVE_BYTES,
|
|
23
|
+
isRemoteSpec,
|
|
24
|
+
listRemoteLayers,
|
|
25
|
+
packLayer,
|
|
26
|
+
pullLayer,
|
|
27
|
+
pushLayer,
|
|
28
|
+
} from "./layer-remote.mjs";
|
|
29
|
+
import { pluginId, ROOT, storefrontBundles } from "./product.mjs";
|
|
30
|
+
|
|
31
|
+
const USAGE = `zenkit — instala o kit no seu projeto
|
|
32
|
+
|
|
33
|
+
Uso:
|
|
34
|
+
zenkit init [--into DIR] [--bundle kit-lite] [--plugin] [--layer DIR]...
|
|
35
|
+
zenkit doctor
|
|
36
|
+
zenkit bundles
|
|
37
|
+
zenkit generate [--target DIR] [--bundle NOME] [--plugins] [--layer DIR]...
|
|
38
|
+
zenkit layer push DIR
|
|
39
|
+
zenkit layer pull NOME [--version N] [--into DIR]
|
|
40
|
+
zenkit layer list
|
|
41
|
+
zenkit layer pack DIR --out ARQUIVO
|
|
42
|
+
|
|
43
|
+
--layer soma uma camada (diretório com zenkit-layer.yaml) por cima do núcleo;
|
|
44
|
+
repita para empilhar, da mais geral para a mais específica. Sem --layer, vale
|
|
45
|
+
ZENKIT_LAYERS (caminhos separados pelo separador do sistema).
|
|
46
|
+
--layer nexuscore:NOME[@VERSÃO] usa a sua camada privada guardada no NexusCore
|
|
47
|
+
(baixada para ~/.zenkit/layers; sem rede, usa a última do cache).
|
|
48
|
+
--layer archive:URL#sha256=HASH usa uma camada em arquivo, baixada por https e
|
|
49
|
+
conferida pelo sha256 (token, se houver: ZENKIT_ARCHIVE_TOKEN ou
|
|
50
|
+
ZENKIT_ARCHIVE_TOKEN_FILE).
|
|
51
|
+
|
|
52
|
+
layer push publica uma nova versão da camada no NexusCore (recusa segredo).
|
|
53
|
+
NexusCore: ZENKIT_NEXUS_URL e ZENKIT_NEXUS_KEY (ou ZENKIT_NEXUS_KEY_FILE).
|
|
54
|
+
layer pack gera o arquivo de uma camada (recusa segredo) e mostra o sha256.
|
|
55
|
+
|
|
56
|
+
Sem comando: init no diretório atual (Kit Lite).
|
|
57
|
+
O default copia o recorte para .cursor, .claude e .agents (Codex/Gemini).
|
|
58
|
+
--plugin instala como plugin nativo (Cursor em ~/.cursor/plugins/local,
|
|
59
|
+
Claude via --plugin-dir). Não mistura os dois modos: o Cursor carregaria
|
|
60
|
+
a skill duas vezes.
|
|
61
|
+
`;
|
|
62
|
+
|
|
63
|
+
const layerArg = (value) => (isRemoteSpec(value) ? value : path.resolve(value));
|
|
64
|
+
|
|
65
|
+
export async function runLayer(argv, { env = process.env, fetch, out = process.stdout } = {}) {
|
|
66
|
+
const [sub, ...rest] = argv;
|
|
67
|
+
if (sub === "push" && rest.length === 1) {
|
|
68
|
+
const res = await pushLayer(path.resolve(rest[0]), { env, fetch });
|
|
69
|
+
out.write(
|
|
70
|
+
res.reaproveitado
|
|
71
|
+
? `camada '${res.nome}' já estava publicada (v${res.versao}, sem mudança)\n`
|
|
72
|
+
: `camada '${res.nome}' publicada: v${res.versao}, ${res.arquivos} arquivos, ${res.bytes} bytes\n`,
|
|
73
|
+
);
|
|
74
|
+
return res;
|
|
75
|
+
}
|
|
76
|
+
if (sub === "pull" && rest.length >= 1) {
|
|
77
|
+
const [name, ...flags] = rest;
|
|
78
|
+
let version;
|
|
79
|
+
let into;
|
|
80
|
+
for (let i = 0; i < flags.length; i++) {
|
|
81
|
+
if (flags[i] === "--version" && flags[i + 1]) version = Number(flags[++i]);
|
|
82
|
+
else if (flags[i] === "--into" && flags[i + 1]) into = path.resolve(flags[++i]);
|
|
83
|
+
else throw new Error(`flag desconhecida: ${flags[i]}`);
|
|
84
|
+
}
|
|
85
|
+
const res = await pullLayer(name, { version, into, env, fetch });
|
|
86
|
+
out.write(`camada '${name}' v${res.version} em ${res.dir}\n`);
|
|
87
|
+
return res;
|
|
88
|
+
}
|
|
89
|
+
if (sub === "pack" && rest.length === 3 && rest[1] === "--out") {
|
|
90
|
+
const out_ = path.resolve(rest[2]);
|
|
91
|
+
const packed = await packLayer(path.resolve(rest[0]), { maxBytes: MAX_ARCHIVE_BYTES });
|
|
92
|
+
await fs.mkdir(path.dirname(out_), { recursive: true });
|
|
93
|
+
await fs.writeFile(out_, packed.bytes);
|
|
94
|
+
out.write(
|
|
95
|
+
`camada '${packed.name}' empacotada em ${out_}: ${packed.files} arquivos, ${packed.bytes.length} bytes\n` +
|
|
96
|
+
`sha256: ${packed.sha256}\n` +
|
|
97
|
+
`publique o arquivo por https e use: --layer archive:<url-do-arquivo>#sha256=${packed.sha256}\n`,
|
|
98
|
+
);
|
|
99
|
+
return packed;
|
|
100
|
+
}
|
|
101
|
+
if (sub === "list" && rest.length === 0) {
|
|
102
|
+
const layers = await listRemoteLayers({ env, fetch });
|
|
103
|
+
if (layers.length === 0) out.write("nenhuma camada no NexusCore\n");
|
|
104
|
+
for (const l of layers) out.write(`${l.nome.padEnd(24)} v${l.versao} ${l.bytes} bytes ${l.criado_em}\n`);
|
|
105
|
+
return layers;
|
|
106
|
+
}
|
|
107
|
+
throw new Error(
|
|
108
|
+
`uso: zenkit layer push DIR | pull NOME [--version N] [--into DIR] | list | pack DIR --out ARQUIVO\n${USAGE}`,
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
function isKitRoot(dir) {
|
|
113
|
+
return path.resolve(dir) === ROOT;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function parseInitFlags(argv) {
|
|
117
|
+
let into = null;
|
|
118
|
+
let bundle = "kit-lite";
|
|
119
|
+
let plugin = false;
|
|
120
|
+
const layers = [];
|
|
121
|
+
for (let i = 0; i < argv.length; i++) {
|
|
122
|
+
if (argv[i] === "--into" && argv[i + 1]) {
|
|
123
|
+
into = path.resolve(argv[++i]);
|
|
124
|
+
} else if (argv[i] === "--bundle" && argv[i + 1]) {
|
|
125
|
+
bundle = argv[++i];
|
|
126
|
+
} else if (argv[i] === "--layer" && argv[i + 1]) {
|
|
127
|
+
layers.push(layerArg(argv[++i]));
|
|
128
|
+
} else if (argv[i] === "--plugin") {
|
|
129
|
+
plugin = true;
|
|
130
|
+
} else if (argv[i] === "--help" || argv[i] === "-h") {
|
|
131
|
+
return { help: true };
|
|
132
|
+
} else if (argv[i].startsWith("-")) {
|
|
133
|
+
throw new Error(`flag desconhecida: ${argv[i]}`);
|
|
134
|
+
} else {
|
|
135
|
+
throw new Error(`argumento inesperado: ${argv[i]}`);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
return { into, bundle, plugin, layers, help: false };
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
async function replaceSymlink(linkPath, target) {
|
|
142
|
+
await fs.mkdir(path.dirname(linkPath), { recursive: true });
|
|
143
|
+
try {
|
|
144
|
+
await fs.lstat(linkPath);
|
|
145
|
+
await fs.rm(linkPath, { recursive: true, force: true });
|
|
146
|
+
} catch {
|
|
147
|
+
/* ainda não existe */
|
|
148
|
+
}
|
|
149
|
+
await fs.symlink(target, linkPath, "dir");
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
export async function runInit({ into, bundle, plugin, layers = [] }) {
|
|
153
|
+
const target = into || process.cwd();
|
|
154
|
+
if (isKitRoot(target) && !plugin) {
|
|
155
|
+
const err = new Error(
|
|
156
|
+
"init recusou gravar no repositório do kit.\n" +
|
|
157
|
+
"Passe o projeto: zenkit init --into /caminho/do/projeto",
|
|
158
|
+
);
|
|
159
|
+
err.exitCode = 2;
|
|
160
|
+
throw err;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
const byName = await loadBundleFiles();
|
|
164
|
+
const meta = resolveBundle(bundle, byName);
|
|
165
|
+
|
|
166
|
+
if (plugin) {
|
|
167
|
+
const dest = path.join(os.homedir(), ".zenkit", "plugins", bundle);
|
|
168
|
+
const result = await emitPluginPackage({ dest, bundle });
|
|
169
|
+
const local = path.join(
|
|
170
|
+
os.homedir(),
|
|
171
|
+
".cursor",
|
|
172
|
+
"plugins",
|
|
173
|
+
"local",
|
|
174
|
+
result.id,
|
|
175
|
+
);
|
|
176
|
+
await replaceSymlink(local, result.cursorDest);
|
|
177
|
+
process.stdout.write(
|
|
178
|
+
`ZenKit ${meta.title} instalado como plugin (${result.id}).\n` +
|
|
179
|
+
` Cursor: ${local}\n` +
|
|
180
|
+
` Recarregue a janela (Developer: Reload Window).\n` +
|
|
181
|
+
` Claude: claude --plugin-dir ${result.claudeDest}\n` +
|
|
182
|
+
` Pacote: ${dest}\n`,
|
|
183
|
+
);
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
await generateKit({ target, bundle, layers });
|
|
188
|
+
process.stdout.write(
|
|
189
|
+
`ZenKit instalado em ${target} (bundle ${bundle}).\n` +
|
|
190
|
+
"Pastas: .cursor (Cursor), .claude (Claude Code), .agents/skills (Codex e o padrão aberto).\n" +
|
|
191
|
+
"Plugin nativo: zenkit init --plugin --bundle " +
|
|
192
|
+
bundle +
|
|
193
|
+
"\n" +
|
|
194
|
+
"Conferir: zenkit doctor\n",
|
|
195
|
+
);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
async function runBundles() {
|
|
199
|
+
const byName = await loadBundleFiles();
|
|
200
|
+
const list = storefrontBundles(byName);
|
|
201
|
+
for (const b of list) {
|
|
202
|
+
const resolved = resolveBundle(b.name, byName);
|
|
203
|
+
process.stdout.write(
|
|
204
|
+
`${b.name.padEnd(18)} ${pluginId(b.name).padEnd(20)} ${b.title} — ${resolved.skills.size} skills\n`,
|
|
205
|
+
);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
async function runGenerate(argv) {
|
|
210
|
+
let target = null;
|
|
211
|
+
let bundle = null;
|
|
212
|
+
let plugins = false;
|
|
213
|
+
const layers = [];
|
|
214
|
+
for (let i = 0; i < argv.length; i++) {
|
|
215
|
+
if (argv[i] === "--target" && argv[i + 1]) {
|
|
216
|
+
target = path.resolve(argv[++i]);
|
|
217
|
+
} else if (argv[i] === "--bundle" && argv[i + 1]) {
|
|
218
|
+
bundle = argv[++i];
|
|
219
|
+
} else if (argv[i] === "--layer" && argv[i + 1]) {
|
|
220
|
+
layers.push(layerArg(argv[++i]));
|
|
221
|
+
} else if (argv[i] === "--plugins") {
|
|
222
|
+
plugins = true;
|
|
223
|
+
} else if (argv[i].startsWith("-")) {
|
|
224
|
+
throw new Error(`flag desconhecida: ${argv[i]}`);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
if (plugins) {
|
|
228
|
+
await writeMarketplaces();
|
|
229
|
+
if (bundle) {
|
|
230
|
+
await emitPluginPackage({
|
|
231
|
+
dest: path.join(ROOT, "plugins", bundle),
|
|
232
|
+
bundle,
|
|
233
|
+
});
|
|
234
|
+
process.stdout.write(`plugin ${bundle} em plugins/${bundle}\n`);
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
237
|
+
await emitStorefrontPlugins();
|
|
238
|
+
return;
|
|
239
|
+
}
|
|
240
|
+
await generateKit({ target: target || path.join(ROOT, ".preview"), bundle, layers });
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
export async function runCli(argv) {
|
|
244
|
+
const [cmd, ...rest] = argv;
|
|
245
|
+
if (!cmd || cmd === "init" || cmd.startsWith("-")) {
|
|
246
|
+
const flags = parseInitFlags(cmd === "init" ? rest : argv);
|
|
247
|
+
if (flags.help) {
|
|
248
|
+
process.stdout.write(USAGE);
|
|
249
|
+
return;
|
|
250
|
+
}
|
|
251
|
+
await runInit(flags);
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
254
|
+
if (cmd === "--help" || cmd === "-h" || cmd === "help") {
|
|
255
|
+
process.stdout.write(USAGE);
|
|
256
|
+
return;
|
|
257
|
+
}
|
|
258
|
+
if (cmd === "doctor") {
|
|
259
|
+
const { spawn } = await import("node:child_process");
|
|
260
|
+
const child = spawn(process.execPath, [path.join(ROOT, "scripts", "doctor.mjs")], {
|
|
261
|
+
stdio: "inherit",
|
|
262
|
+
});
|
|
263
|
+
const code = await new Promise((resolve) => child.on("close", resolve));
|
|
264
|
+
if (code !== 0) {
|
|
265
|
+
const err = new Error("doctor reprovou");
|
|
266
|
+
err.exitCode = code;
|
|
267
|
+
throw err;
|
|
268
|
+
}
|
|
269
|
+
return;
|
|
270
|
+
}
|
|
271
|
+
if (cmd === "bundles") {
|
|
272
|
+
await runBundles();
|
|
273
|
+
return;
|
|
274
|
+
}
|
|
275
|
+
if (cmd === "generate") {
|
|
276
|
+
await runGenerate(rest);
|
|
277
|
+
return;
|
|
278
|
+
}
|
|
279
|
+
if (cmd === "layer") {
|
|
280
|
+
await runLayer(rest);
|
|
281
|
+
return;
|
|
282
|
+
}
|
|
283
|
+
throw new Error(`comando desconhecido: ${cmd}\n${USAGE}`);
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
const invokedDirectly =
|
|
287
|
+
Boolean(process.argv[1]) &&
|
|
288
|
+
path.resolve(process.argv[1]) === fileURLToPath(import.meta.url);
|
|
289
|
+
|
|
290
|
+
if (invokedDirectly) {
|
|
291
|
+
runCli(process.argv.slice(2)).catch((e) => {
|
|
292
|
+
process.stderr.write(String(e?.message || e) + "\n");
|
|
293
|
+
process.exit(e.exitCode || 1);
|
|
294
|
+
});
|
|
295
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Monorepo entry for DEM-ZEN-BUG-142 — implementation lives in the npm-packaged bridge.
|
|
4
|
+
*/
|
|
5
|
+
export {
|
|
6
|
+
executorTerminoComprovado,
|
|
7
|
+
reservaDesconhecida,
|
|
8
|
+
reservaVerificada,
|
|
9
|
+
reidratacaoVerificada,
|
|
10
|
+
sessaoPermiteNovoExecutor,
|
|
11
|
+
liberarNovoExecutor,
|
|
12
|
+
reidratarHandoff,
|
|
13
|
+
avaliarContinuidadeMandato,
|
|
14
|
+
} from "../packages/zenkit-bridge/scripts/continuidade-mandato.mjs";
|
|
15
|
+
|
|
16
|
+
import { spawnSync } from "node:child_process";
|
|
17
|
+
import { dirname, join } from "node:path";
|
|
18
|
+
import { fileURLToPath } from "node:url";
|
|
19
|
+
|
|
20
|
+
const impl = join(
|
|
21
|
+
dirname(fileURLToPath(import.meta.url)),
|
|
22
|
+
"..",
|
|
23
|
+
"packages",
|
|
24
|
+
"zenkit-bridge",
|
|
25
|
+
"scripts",
|
|
26
|
+
"continuidade-mandato.mjs",
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
function isMain() {
|
|
30
|
+
try {
|
|
31
|
+
const u = new URL(import.meta.url);
|
|
32
|
+
const a = process.argv[1];
|
|
33
|
+
if (!a) return false;
|
|
34
|
+
return u.pathname.endsWith(a.replace(/\\/g, "/").split("/").pop());
|
|
35
|
+
} catch {
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (import.meta.url === `file://${process.argv[1]?.replace(/\\/g, "/")}` || isMain()) {
|
|
41
|
+
const r = spawnSync(process.execPath, [impl, ...process.argv.slice(2)], {
|
|
42
|
+
stdio: "inherit",
|
|
43
|
+
env: process.env,
|
|
44
|
+
windowsHide: true,
|
|
45
|
+
});
|
|
46
|
+
process.exit(r.status ?? 1);
|
|
47
|
+
}
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* discriminar-turno.mjs — discriminador mecânico do estado de um turno (DEM-NEX-DEB-33).
|
|
4
|
+
*
|
|
5
|
+
* POR QUE ISTO EXISTE
|
|
6
|
+
* Em 2026-10-22 o coordenador abortou 12 turnos usando "completedAt=null +
|
|
7
|
+
* idade>20min + busy" como sinal de travamento. Três turnos tinham a tool
|
|
8
|
+
* `question` PENDENTE esperando resposta do humano — o abort converteu em
|
|
9
|
+
* MessageAbortedError e matou o seletor. O sinal de travamento não distingue
|
|
10
|
+
* "laço" de "espera por humano". Regra do operador: sessão parada NÃO é
|
|
11
|
+
* alvo de abort; abort é exceção em três casos apenas.
|
|
12
|
+
*
|
|
13
|
+
* CONTRATO DE ENTRADA (pinado no storage local do OpenCode, 2026-10-23)
|
|
14
|
+
* {
|
|
15
|
+
* parada?: { suspeita: boolean } // suspeita de travamento (caller)
|
|
16
|
+
* messages: [
|
|
17
|
+
* {
|
|
18
|
+
* role: "assistant" | "user",
|
|
19
|
+
* parts: [ // PARTS NO TOPO da mensagem — nunca
|
|
20
|
+
* { type: "text", text: "..." }, // dentro de `info`; se não estiver no
|
|
21
|
+
* { // topo, o dado é insuficiente — ver
|
|
22
|
+
* type: "tool", // `dados_insuficientes` abaixo.
|
|
23
|
+
* tool: "question",
|
|
24
|
+
* state: { status: "pending" | "running" | "completed" | "error", ... }
|
|
25
|
+
* },
|
|
26
|
+
* ],
|
|
27
|
+
* },
|
|
28
|
+
* ...
|
|
29
|
+
* ],
|
|
30
|
+
* }
|
|
31
|
+
*
|
|
32
|
+
* MATRIZ DE DECISÃO (≡ regra do operador)
|
|
33
|
+
* espera_humana tool `question` com `state.status` pending/error na
|
|
34
|
+
* ÚLTIMA mensagem assistant → NUNCA abortar, qualquer
|
|
35
|
+
* que seja a idade. Espera por humano não é travamento.
|
|
36
|
+
* em_progresso sem suspeita de parada → nada a fazer.
|
|
37
|
+
* dados_insuficientes `parts` ausente do topo da última mensagem assistant →
|
|
38
|
+
* re-ler a mensagem; nunca abortar com dado faltando.
|
|
39
|
+
* loop texto idêntico repetido na ÚLTIMA mensagem assistant
|
|
40
|
+
* (mesma frase ≥3×) ou nas últimas 3 mensagens
|
|
41
|
+
* assistant intercaladas → abort AUTORIZADO.
|
|
42
|
+
* falha_tecnica ≥2 partes tool com `state.status` "error" na última
|
|
43
|
+
* mensagem assistant → abort AUTORIZADO.
|
|
44
|
+
* parado stalled sem question, sem loop, sem falha → orientar
|
|
45
|
+
* OU mandar handoff; NUNCA abortar.
|
|
46
|
+
*
|
|
47
|
+
* USO CLI
|
|
48
|
+
* node scripts/discriminar-turno.mjs <messages.json | -> # lê o JSON do arquivo ou stdin
|
|
49
|
+
*
|
|
50
|
+
* Regra de ouro: dúvida não autoriza abort. Só loop e falha técnica autorizam.
|
|
51
|
+
*/
|
|
52
|
+
import { readFileSync } from "node:fs";
|
|
53
|
+
|
|
54
|
+
export function discriminarTurno(entrada) {
|
|
55
|
+
const msgs = Array.isArray(entrada?.messages) ? entrada.messages : [];
|
|
56
|
+
const parada = entrada?.parada?.suspeita === true;
|
|
57
|
+
const evidencia = [];
|
|
58
|
+
|
|
59
|
+
const assistants = msgs.filter((m) => m && m.role === "assistant");
|
|
60
|
+
const ultima = assistants[assistants.length - 1];
|
|
61
|
+
|
|
62
|
+
if (!ultima)
|
|
63
|
+
return {
|
|
64
|
+
decisao: parada ? "dados_insuficientes" : "em_progresso",
|
|
65
|
+
abortAutorizado: false,
|
|
66
|
+
parada,
|
|
67
|
+
evidencia: ["nenhuma mensagem assistant"],
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
// Contrato: parts NO TOPO. parts dentro de info é o defeito do incidente
|
|
71
|
+
// (o diagnóstico lia info.parts, sempre vazio, e declarava inconclusivo).
|
|
72
|
+
if (!Array.isArray(ultima.parts)) {
|
|
73
|
+
const temArmadilha = ultima?.info && Array.isArray(ultima.info.parts);
|
|
74
|
+
evidencia.push(
|
|
75
|
+
temArmadilha
|
|
76
|
+
? "armadilha do incidente: parts está dentro de info, não no topo da mensagem"
|
|
77
|
+
: "última mensagem assistant sem parts no topo"
|
|
78
|
+
);
|
|
79
|
+
return { decisao: "dados_insuficientes", abortAutorizado: false, parada, evidencia };
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// Espera humana: question pendente/com-erro na última assistant — vale
|
|
83
|
+
// independentemente de suspeita de parada, de idade ou de sessionStatus.
|
|
84
|
+
const questionPendente = ultima.parts.find(
|
|
85
|
+
(p) =>
|
|
86
|
+
p?.type === "tool" &&
|
|
87
|
+
p?.tool === "question" &&
|
|
88
|
+
p?.state &&
|
|
89
|
+
(p.state.status === "pending" || p.state.status === "error")
|
|
90
|
+
);
|
|
91
|
+
if (questionPendente) {
|
|
92
|
+
evidencia.push(
|
|
93
|
+
`tool question com state.status "${questionPendente.state.status}" na última mensagem assistant`
|
|
94
|
+
);
|
|
95
|
+
return {
|
|
96
|
+
decisao: "espera_humana",
|
|
97
|
+
abortAutorizado: false,
|
|
98
|
+
parada,
|
|
99
|
+
question: { tool: "question", status: questionPendente.state.status },
|
|
100
|
+
evidencia,
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
if (!parada) return { decisao: "em_progresso", abortAutorizado: false, parada, evidencia };
|
|
105
|
+
|
|
106
|
+
// Loop: mesma frase ≥3× na mesma mensagem (o incidente descreveu isso).
|
|
107
|
+
const textoUltima = ultima.parts
|
|
108
|
+
.filter((p) => p?.type === "text" && typeof p.text === "string")
|
|
109
|
+
.map((p) => normalizar(p.text))
|
|
110
|
+
.filter(Boolean)
|
|
111
|
+
.join("\n");
|
|
112
|
+
|
|
113
|
+
if (fraseRepetida(textoUltima)) {
|
|
114
|
+
evidencia.push("mesma frase repetida ≥3× na última mensagem assistant");
|
|
115
|
+
return { decisao: "loop", abortAutorizado: true, parada, evidencia };
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// Loop entre mensagens: últimas 3 assistant com o MESMO texto normalizado.
|
|
119
|
+
const ultimas3 = assistants
|
|
120
|
+
.slice(-3)
|
|
121
|
+
.map((m) => {
|
|
122
|
+
if (!Array.isArray(m.parts)) return null;
|
|
123
|
+
return m.parts
|
|
124
|
+
.filter((p) => p?.type === "text" && typeof p.text === "string")
|
|
125
|
+
.map((p) => normalizar(p.text))
|
|
126
|
+
.filter(Boolean)
|
|
127
|
+
.join("\n");
|
|
128
|
+
})
|
|
129
|
+
.filter(Boolean);
|
|
130
|
+
|
|
131
|
+
if (
|
|
132
|
+
ultimas3.length >= 3 &&
|
|
133
|
+
ultimas3[0] === ultimas3[1] &&
|
|
134
|
+
ultimas3[1] === ultimas3[2]
|
|
135
|
+
) {
|
|
136
|
+
evidencia.push("3 mensagens assistant consecutivas com texto idêntico");
|
|
137
|
+
return { decisao: "loop", abortAutorizado: true, parada, evidencia };
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// Falha técnica: ≥2 tools em erro na última assistant (tool quebrada em série).
|
|
141
|
+
const toolsEmErro = ultima.parts.filter(
|
|
142
|
+
(p) => p?.type === "tool" && p?.state?.status === "error"
|
|
143
|
+
);
|
|
144
|
+
if (toolsEmErro.length >= 2) {
|
|
145
|
+
evidencia.push(`${toolsEmErro.length} partes tool com state.status "error" na última mensagem assistant`);
|
|
146
|
+
return { decisao: "falha_tecnica", abortAutorizado: true, parada, evidencia };
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// Parado sem sinais: orientar ou handoff — nunca abortar.
|
|
150
|
+
evidencia.push("parada sem question pendente, sem loop, sem falha em série");
|
|
151
|
+
return { decisao: "parado", abortAutorizado: false, parada, evidencia };
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
function normalizar(texto) {
|
|
155
|
+
return texto.replace(/\s+/g, " ").trim().toLowerCase();
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/** Mesma frase (≥ 24 chars após normalizar) repetida ≥3 vezes no mesmo texto. */
|
|
159
|
+
function fraseRepetida(texto) {
|
|
160
|
+
if (!texto || texto.length < 24) return false;
|
|
161
|
+
const frases = texto.split(/(?<=[.!?])\s+|\n+/).filter(Boolean);
|
|
162
|
+
const contagem = new Map();
|
|
163
|
+
for (const f of frases) {
|
|
164
|
+
if (f.length < 24) continue;
|
|
165
|
+
contagem.set(f, (contagem.get(f) || 0) + 1);
|
|
166
|
+
}
|
|
167
|
+
for (const n of contagem.values()) if (n >= 3) return true;
|
|
168
|
+
return false;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
// CLI: lê JSON de arquivo ou stdin, imprime a classificação.
|
|
172
|
+
if (import.meta.url === `file://${process.argv[1]}`) {
|
|
173
|
+
(async () => {
|
|
174
|
+
try {
|
|
175
|
+
const src = process.argv[2];
|
|
176
|
+
const raw =
|
|
177
|
+
src && src !== "-"
|
|
178
|
+
? readFileSync(src, "utf8")
|
|
179
|
+
: await new Promise((resolve, reject) => {
|
|
180
|
+
const chunks = [];
|
|
181
|
+
process.stdin.on("data", (c) => chunks.push(c));
|
|
182
|
+
process.stdin.on("end", () => resolve(chunks.join("")));
|
|
183
|
+
process.stdin.on("error", reject);
|
|
184
|
+
});
|
|
185
|
+
console.log(JSON.stringify(discriminarTurno(JSON.parse(raw)), null, 2));
|
|
186
|
+
} catch (e) {
|
|
187
|
+
console.error(`uso: node scripts/discriminar-turno.mjs <file.json | - : ${e.message}`);
|
|
188
|
+
process.exit(2);
|
|
189
|
+
}
|
|
190
|
+
})();
|
|
191
|
+
}
|