@next-vibe/checker 1.0.11 → 1.0.12
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/.dist/bin/vibe-runtime.js +10 -19
- package/.dist/bin/vibe-runtime.js.map +3 -3
- package/check.config.ts +4 -4
- package/package.json +2 -9
- package/src/app/api/[locale]/LICENSE +674 -0
- package/src/app/api/[locale]/i18n/de/index.ts +13 -0
- package/src/app/api/[locale]/i18n/en/index.ts +12 -0
- package/src/app/api/[locale]/i18n/pl/index.ts +11 -0
- package/src/app/api/[locale]/shared/i18n/de/index.ts +85 -0
- package/src/app/api/[locale]/shared/i18n/en/index.ts +83 -0
- package/src/app/api/[locale]/shared/i18n/pl/index.ts +85 -0
- package/src/app/api/[locale]/shared/stats-filtering.ts +202 -0
- package/src/app/api/[locale]/shared/types/common.schema.ts +55 -0
- package/src/app/api/[locale]/shared/types/response.schema.ts +372 -0
- package/src/app/api/[locale]/shared/types/stats-filtering.schema.ts +375 -0
- package/src/app/api/[locale]/shared/types/utils.ts +190 -0
- package/src/app/api/[locale]/shared/utils/base64.ts +49 -0
- package/src/app/api/[locale]/shared/utils/env-util.ts +40 -0
- package/src/app/api/[locale]/shared/utils/i18n/de/index.ts +21 -0
- package/src/app/api/[locale]/shared/utils/i18n/en/index.ts +19 -0
- package/src/app/api/[locale]/shared/utils/i18n/pl/index.ts +21 -0
- package/src/app/api/[locale]/shared/utils/index.ts +11 -0
- package/src/app/api/[locale]/shared/utils/object-path.ts +41 -0
- package/src/app/api/[locale]/shared/utils/object.test.ts +82 -0
- package/src/app/api/[locale]/shared/utils/object.ts +75 -0
- package/src/app/api/[locale]/shared/utils/parse-error.ts +134 -0
- package/src/app/api/[locale]/shared/utils/parse-json.ts +70 -0
- package/src/app/api/[locale]/shared/utils/time.ts +53 -0
- package/src/app/api/[locale]/shared/utils/validation.ts +127 -0
- package/src/app/api/[locale]/shared/utils/zod-required-fields.ts +116 -0
- package/src/app/api/[locale]/system/builder/definition.ts +1942 -0
- package/src/app/api/[locale]/system/builder/enum.ts +77 -0
- package/src/app/api/[locale]/system/builder/i18n/de/index.ts +677 -0
- package/src/app/api/[locale]/system/builder/i18n/en/index.ts +665 -0
- package/src/app/api/[locale]/system/builder/i18n/pl/index.ts +668 -0
- package/src/app/api/[locale]/system/builder/repository/build-executor.test.ts +182 -0
- package/src/app/api/[locale]/system/builder/repository/build-executor.ts +583 -0
- package/src/app/api/[locale]/system/builder/repository/bun-compiler.ts +261 -0
- package/src/app/api/[locale]/system/builder/repository/bundle-analyzer.ts +197 -0
- package/src/app/api/[locale]/system/builder/repository/config-loader.ts +159 -0
- package/src/app/api/[locale]/system/builder/repository/config-validator.ts +97 -0
- package/src/app/api/[locale]/system/builder/repository/constants.ts +125 -0
- package/src/app/api/[locale]/system/builder/repository/error-suggester.ts +75 -0
- package/src/app/api/[locale]/system/builder/repository/file-copier.ts +98 -0
- package/src/app/api/[locale]/system/builder/repository/folder-cleaner.ts +80 -0
- package/src/app/api/[locale]/system/builder/repository/index.ts +2 -0
- package/src/app/api/[locale]/system/builder/repository/npm-package-generator.ts +146 -0
- package/src/app/api/[locale]/system/builder/repository/output-formatter.ts +104 -0
- package/src/app/api/[locale]/system/builder/repository/profile-service.ts +79 -0
- package/src/app/api/[locale]/system/builder/repository/report-generator.ts +125 -0
- package/src/app/api/[locale]/system/builder/repository/vite-compiler.ts +291 -0
- package/src/app/api/[locale]/system/builder/route.ts +21 -0
- package/src/app/api/[locale]/system/builder/test-files/file1.ts +2 -0
- package/src/app/api/[locale]/system/builder/test-files/file2.tsx +10 -0
- package/src/app/api/[locale]/system/builder/test-files/file3.tsx +16 -0
- package/src/app/api/[locale]/system/builder/test-files/folderToCopy/fileInFolder.ts +2 -0
- package/src/app/api/[locale]/system/builder/test-files/test-config.ts +38 -0
- package/src/app/api/[locale]/system/builder/test-files/test-delete-config.ts +8 -0
- package/src/app/api/[locale]/system/builder/test-files/test-project/package.json +24 -0
- package/src/app/api/[locale]/system/builder/test-files/test-project/src/constants.ts +6 -0
- package/src/app/api/[locale]/system/builder/test-files/test-project/src/greet.ts +18 -0
- package/src/app/api/[locale]/system/builder/test-files/test-project/src/index.ts +7 -0
- package/src/app/api/[locale]/system/builder/test-files/test-project/src/utils/calculate.ts +27 -0
- package/src/app/api/[locale]/system/builder/test-files/test-project/tsconfig.json +19 -0
- package/src/app/api/[locale]/system/builder/test-files/test-project/tsconfig.tsbuildinfo +1 -0
- package/src/app/api/[locale]/system/builder/test-files/test3.css +1 -0
- package/src/app/api/[locale]/system/check/config/repository.ts +819 -0
- package/src/app/api/[locale]/system/check/config/shared.ts +396 -0
- package/src/app/api/[locale]/system/check/config/types.ts +616 -0
- package/src/app/api/[locale]/system/check/config/utils.ts +171 -0
- package/src/app/api/[locale]/system/check/i18n/de/index.ts +15 -0
- package/src/app/api/[locale]/system/check/i18n/en/index.ts +14 -0
- package/src/app/api/[locale]/system/check/i18n/pl/index.ts +15 -0
- package/src/app/api/[locale]/system/check/lint/definition.ts +414 -0
- package/src/app/api/[locale]/system/check/lint/enum.ts +37 -0
- package/src/app/api/[locale]/system/check/lint/i18n/de/index.ts +164 -0
- package/src/app/api/[locale]/system/check/lint/i18n/en/index.ts +162 -0
- package/src/app/api/[locale]/system/check/lint/i18n/pl/index.ts +164 -0
- package/src/app/api/[locale]/system/check/lint/repository.ts +753 -0
- package/src/app/api/[locale]/system/check/lint/route.ts +21 -0
- package/src/app/api/[locale]/system/check/oxlint/README.md +190 -0
- package/src/app/api/[locale]/system/check/oxlint/definition.ts +414 -0
- package/src/app/api/[locale]/system/check/oxlint/enum.ts +37 -0
- package/src/app/api/[locale]/system/check/oxlint/i18n/de/index.ts +171 -0
- package/src/app/api/[locale]/system/check/oxlint/i18n/en/index.ts +168 -0
- package/src/app/api/[locale]/system/check/oxlint/i18n/pl/index.ts +172 -0
- package/src/app/api/[locale]/system/check/oxlint/plugins/i18n/src/index.ts +372 -0
- package/src/app/api/[locale]/system/check/oxlint/plugins/jsx-capitalization/README.md +246 -0
- package/src/app/api/[locale]/system/check/oxlint/plugins/jsx-capitalization/src/index.ts +583 -0
- package/src/app/api/[locale]/system/check/oxlint/plugins/restricted-syntax/src/index.ts +500 -0
- package/src/app/api/[locale]/system/check/oxlint/plugins/restricted-syntax/test.tsx +74 -0
- package/src/app/api/[locale]/system/check/oxlint/plugins/shared/config-loader.ts +305 -0
- package/src/app/api/[locale]/system/check/oxlint/repository.ts +959 -0
- package/src/app/api/[locale]/system/check/oxlint/route.ts +21 -0
- package/src/app/api/[locale]/system/check/oxlint/types.ts +193 -0
- package/src/app/api/[locale]/system/check/test-project/bun.lock +449 -0
- package/src/app/api/[locale]/system/check/test-project/check.config.ts +989 -0
- package/src/app/api/[locale]/system/check/test-project/package.json +20 -0
- package/src/app/api/[locale]/system/check/test-project/src/constants.ts +6 -0
- package/src/app/api/[locale]/system/check/test-project/src/greet.ts +18 -0
- package/src/app/api/[locale]/system/check/test-project/src/test-issues/a11y-issues.tsx +107 -0
- package/src/app/api/[locale]/system/check/test-project/src/test-issues/eslint-issues.tsx +37 -0
- package/src/app/api/[locale]/system/check/test-project/src/test-issues/general-issues.ts +137 -0
- package/src/app/api/[locale]/system/check/test-project/src/test-issues/i18n-issues.tsx +129 -0
- package/src/app/api/[locale]/system/check/test-project/src/test-issues/jsx-capitalization-issues.tsx +131 -0
- package/src/app/api/[locale]/system/check/test-project/src/test-issues/nextjs-issues.tsx +95 -0
- package/src/app/api/[locale]/system/check/test-project/src/test-issues/promise-issues.ts +76 -0
- package/src/app/api/[locale]/system/check/test-project/src/test-issues/react-issues.tsx +95 -0
- package/src/app/api/[locale]/system/check/test-project/src/test-issues/restricted-syntax-issues.tsx +61 -0
- package/src/app/api/[locale]/system/check/test-project/src/test-issues/typescript-issues.ts +80 -0
- package/src/app/api/[locale]/system/check/test-project/src/utils/calculate.ts +27 -0
- package/src/app/api/[locale]/system/check/test-project/tsconfig.json +38 -0
- package/src/app/api/[locale]/system/check/test-project/tsconfig.tsbuildinfo +1 -0
- package/src/app/api/[locale]/system/check/typecheck/definition.ts +369 -0
- package/src/app/api/[locale]/system/check/typecheck/enum.ts +37 -0
- package/src/app/api/[locale]/system/check/typecheck/i18n/de/index.ts +159 -0
- package/src/app/api/[locale]/system/check/typecheck/i18n/en/index.ts +150 -0
- package/src/app/api/[locale]/system/check/typecheck/i18n/pl/index.ts +155 -0
- package/src/app/api/[locale]/system/check/typecheck/repository.ts +919 -0
- package/src/app/api/[locale]/system/check/typecheck/route.ts +22 -0
- package/src/app/api/[locale]/system/check/typecheck/utils.ts +168 -0
- package/src/app/api/[locale]/system/check/vibe-check/definition.ts +568 -0
- package/src/app/api/[locale]/system/check/vibe-check/enum.ts +69 -0
- package/src/app/api/[locale]/system/check/vibe-check/i18n/de/index.ts +192 -0
- package/src/app/api/[locale]/system/check/vibe-check/i18n/en/index.ts +189 -0
- package/src/app/api/[locale]/system/check/vibe-check/i18n/pl/index.ts +192 -0
- package/src/app/api/[locale]/system/check/vibe-check/repository.ts +545 -0
- package/src/app/api/[locale]/system/check/vibe-check/route.test.ts +1142 -0
- package/src/app/api/[locale]/system/check/vibe-check/route.ts +21 -0
- package/src/app/api/[locale]/system/generated/endpoint.ts +313 -0
- package/src/app/api/[locale]/system/generated/endpoints.ts +156 -0
- package/src/app/api/[locale]/system/generated/route-handlers.ts +224 -0
- package/src/app/api/[locale]/system/generators/endpoint/definition.ts +193 -0
- package/src/app/api/[locale]/system/generators/endpoint/i18n/de/index.ts +48 -0
- package/src/app/api/[locale]/system/generators/endpoint/i18n/en/index.ts +48 -0
- package/src/app/api/[locale]/system/generators/endpoint/i18n/pl/index.ts +50 -0
- package/src/app/api/[locale]/system/generators/endpoint/repository.ts +291 -0
- package/src/app/api/[locale]/system/generators/endpoint/route.ts +21 -0
- package/src/app/api/[locale]/system/generators/endpoints/definition.ts +246 -0
- package/src/app/api/[locale]/system/generators/endpoints/i18n/de/index.ts +54 -0
- package/src/app/api/[locale]/system/generators/endpoints/i18n/en/index.ts +52 -0
- package/src/app/api/[locale]/system/generators/endpoints/i18n/pl/index.ts +54 -0
- package/src/app/api/[locale]/system/generators/endpoints/options-repository.ts +463 -0
- package/src/app/api/[locale]/system/generators/endpoints/repository.ts +383 -0
- package/src/app/api/[locale]/system/generators/endpoints/route.ts +18 -0
- package/src/app/api/[locale]/system/generators/endpoints-index/definition.ts +194 -0
- package/src/app/api/[locale]/system/generators/endpoints-index/i18n/de/index.ts +71 -0
- package/src/app/api/[locale]/system/generators/endpoints-index/i18n/en/index.ts +69 -0
- package/src/app/api/[locale]/system/generators/endpoints-index/i18n/pl/index.ts +71 -0
- package/src/app/api/[locale]/system/generators/endpoints-index/repository.ts +294 -0
- package/src/app/api/[locale]/system/generators/endpoints-index/route.ts +18 -0
- package/src/app/api/[locale]/system/generators/generate-all/definition.ts +355 -0
- package/src/app/api/[locale]/system/generators/generate-all/i18n/de/index.ts +96 -0
- package/src/app/api/[locale]/system/generators/generate-all/i18n/en/index.ts +94 -0
- package/src/app/api/[locale]/system/generators/generate-all/i18n/pl/index.ts +96 -0
- package/src/app/api/[locale]/system/generators/generate-all/repository.ts +257 -0
- package/src/app/api/[locale]/system/generators/generate-all/route.ts +20 -0
- package/src/app/api/[locale]/system/generators/i18n/de/index.ts +15 -0
- package/src/app/api/[locale]/system/generators/i18n/en/index.ts +14 -0
- package/src/app/api/[locale]/system/generators/i18n/pl/index.ts +15 -0
- package/src/app/api/[locale]/system/generators/route-handlers/definition.ts +198 -0
- package/src/app/api/[locale]/system/generators/route-handlers/i18n/de/index.ts +48 -0
- package/src/app/api/[locale]/system/generators/route-handlers/i18n/en/index.ts +48 -0
- package/src/app/api/[locale]/system/generators/route-handlers/i18n/pl/index.ts +50 -0
- package/src/app/api/[locale]/system/generators/route-handlers/repository.ts +277 -0
- package/src/app/api/[locale]/system/generators/route-handlers/route.ts +17 -0
- package/src/app/api/[locale]/system/generators/shared/utils.ts +233 -0
- package/src/app/api/[locale]/system/help/definition.ts +445 -0
- package/src/app/api/[locale]/system/help/i18n/de/index.ts +267 -0
- package/src/app/api/[locale]/system/help/i18n/en/index.ts +262 -0
- package/src/app/api/[locale]/system/help/i18n/pl/index.ts +265 -0
- package/src/app/api/[locale]/system/help/interactive/definition.ts +125 -0
- package/src/app/api/[locale]/system/help/interactive/i18n/de/index.ts +22 -0
- package/src/app/api/[locale]/system/help/interactive/i18n/en/index.ts +19 -0
- package/src/app/api/[locale]/system/help/interactive/i18n/pl/index.ts +22 -0
- package/src/app/api/[locale]/system/help/interactive/repository.ts +1025 -0
- package/src/app/api/[locale]/system/help/interactive/route.ts +53 -0
- package/src/app/api/[locale]/system/help/list/definition.ts +372 -0
- package/src/app/api/[locale]/system/help/list/repository.ts +110 -0
- package/src/app/api/[locale]/system/help/list/route.ts +21 -0
- package/src/app/api/[locale]/system/help/repository.ts +212 -0
- package/src/app/api/[locale]/system/help/route.ts +16 -0
- package/src/app/api/[locale]/system/i18n/de/index.ts +68 -0
- package/src/app/api/[locale]/system/i18n/en/index.ts +65 -0
- package/src/app/api/[locale]/system/i18n/pl/index.ts +66 -0
- package/src/app/api/[locale]/system/release-tool/definition.ts +3104 -0
- package/src/app/api/[locale]/system/release-tool/i18n/de/index.ts +813 -0
- package/src/app/api/[locale]/system/release-tool/i18n/en/index.ts +797 -0
- package/src/app/api/[locale]/system/release-tool/i18n/pl/index.ts +810 -0
- package/src/app/api/[locale]/system/release-tool/repository/asset-zipper.ts +128 -0
- package/src/app/api/[locale]/system/release-tool/repository/changelog-generator.ts +212 -0
- package/src/app/api/[locale]/system/release-tool/repository/ci-detector.ts +566 -0
- package/src/app/api/[locale]/system/release-tool/repository/config.ts +113 -0
- package/src/app/api/[locale]/system/release-tool/repository/constants.ts +407 -0
- package/src/app/api/[locale]/system/release-tool/repository/dependency-manager.ts +527 -0
- package/src/app/api/[locale]/system/release-tool/repository/git-service.ts +403 -0
- package/src/app/api/[locale]/system/release-tool/repository/hook-runner.ts +100 -0
- package/src/app/api/[locale]/system/release-tool/repository/index.ts +1 -0
- package/src/app/api/[locale]/system/release-tool/repository/notification-service.ts +638 -0
- package/src/app/api/[locale]/system/release-tool/repository/package-service.ts +169 -0
- package/src/app/api/[locale]/system/release-tool/repository/publisher.ts +253 -0
- package/src/app/api/[locale]/system/release-tool/repository/quality-runner.ts +428 -0
- package/src/app/api/[locale]/system/release-tool/repository/release-creator.ts +293 -0
- package/src/app/api/[locale]/system/release-tool/repository/release-executor.ts +1198 -0
- package/src/app/api/[locale]/system/release-tool/repository/snyk-service.ts +136 -0
- package/src/app/api/[locale]/system/release-tool/repository/utils.ts +642 -0
- package/src/app/api/[locale]/system/release-tool/repository/validation.ts +288 -0
- package/src/app/api/[locale]/system/release-tool/repository/version-service.ts +297 -0
- package/src/app/api/[locale]/system/release-tool/route.ts +21 -0
- package/src/app/api/[locale]/system/unified-interface/README.md +328 -0
- package/src/app/api/[locale]/system/unified-interface/cli/README.md +349 -0
- package/src/app/api/[locale]/system/unified-interface/cli/auth/cli-handler.ts +95 -0
- package/src/app/api/[locale]/system/unified-interface/cli/auth/cli-user.ts +146 -0
- package/src/app/api/[locale]/system/unified-interface/cli/auth/session-file.ts +266 -0
- package/src/app/api/[locale]/system/unified-interface/cli/env.ts +26 -0
- package/src/app/api/[locale]/system/unified-interface/cli/i18n/de/index.ts +157 -0
- package/src/app/api/[locale]/system/unified-interface/cli/i18n/en/index.ts +155 -0
- package/src/app/api/[locale]/system/unified-interface/cli/i18n/pl/index.ts +158 -0
- package/src/app/api/[locale]/system/unified-interface/cli/runtime/debug.ts +595 -0
- package/src/app/api/[locale]/system/unified-interface/cli/runtime/entry-point.ts +129 -0
- package/src/app/api/[locale]/system/unified-interface/cli/runtime/environment.ts +155 -0
- package/src/app/api/[locale]/system/unified-interface/cli/runtime/execution-errors.ts +452 -0
- package/src/app/api/[locale]/system/unified-interface/cli/runtime/parsing.ts +297 -0
- package/src/app/api/[locale]/system/unified-interface/cli/runtime/route-executor.ts +859 -0
- package/src/app/api/[locale]/system/unified-interface/cli/setup/i18n/de/index.ts +12 -0
- package/src/app/api/[locale]/system/unified-interface/cli/setup/i18n/en/index.ts +11 -0
- package/src/app/api/[locale]/system/unified-interface/cli/setup/i18n/pl/index.ts +12 -0
- package/src/app/api/[locale]/system/unified-interface/cli/setup/install/definition.ts +262 -0
- package/src/app/api/[locale]/system/unified-interface/cli/setup/install/i18n/de/index.ts +54 -0
- package/src/app/api/[locale]/system/unified-interface/cli/setup/install/i18n/en/index.ts +52 -0
- package/src/app/api/[locale]/system/unified-interface/cli/setup/install/i18n/pl/index.ts +54 -0
- package/src/app/api/[locale]/system/unified-interface/cli/setup/install/repository.ts +421 -0
- package/src/app/api/[locale]/system/unified-interface/cli/setup/install/route.ts +25 -0
- package/src/app/api/[locale]/system/unified-interface/cli/setup/status/definition.ts +181 -0
- package/src/app/api/[locale]/system/unified-interface/cli/setup/status/i18n/de/index.ts +61 -0
- package/src/app/api/[locale]/system/unified-interface/cli/setup/status/i18n/en/index.ts +59 -0
- package/src/app/api/[locale]/system/unified-interface/cli/setup/status/i18n/pl/index.ts +61 -0
- package/src/app/api/[locale]/system/unified-interface/cli/setup/status/repository.ts +195 -0
- package/src/app/api/[locale]/system/unified-interface/cli/setup/status/route.ts +22 -0
- package/src/app/api/[locale]/system/unified-interface/cli/setup/uninstall/definition.ts +188 -0
- package/src/app/api/[locale]/system/unified-interface/cli/setup/uninstall/i18n/de/index.ts +54 -0
- package/src/app/api/[locale]/system/unified-interface/cli/setup/uninstall/i18n/en/index.ts +52 -0
- package/src/app/api/[locale]/system/unified-interface/cli/setup/uninstall/i18n/pl/index.ts +54 -0
- package/src/app/api/[locale]/system/unified-interface/cli/setup/uninstall/repository.ts +209 -0
- package/src/app/api/[locale]/system/unified-interface/cli/setup/uninstall/route.ts +24 -0
- package/src/app/api/[locale]/system/unified-interface/cli/setup/update/definition.ts +200 -0
- package/src/app/api/[locale]/system/unified-interface/cli/setup/update/i18n/de/index.ts +54 -0
- package/src/app/api/[locale]/system/unified-interface/cli/setup/update/i18n/en/index.ts +52 -0
- package/src/app/api/[locale]/system/unified-interface/cli/setup/update/i18n/pl/index.ts +54 -0
- package/src/app/api/[locale]/system/unified-interface/cli/setup/update/repository.ts +113 -0
- package/src/app/api/[locale]/system/unified-interface/cli/setup/update/route.ts +22 -0
- package/src/app/api/[locale]/system/unified-interface/cli/vibe-runtime.ts +304 -0
- package/src/app/api/[locale]/system/unified-interface/cli/widgets/core/base-renderer.ts +270 -0
- package/src/app/api/[locale]/system/unified-interface/cli/widgets/core/registry.ts +309 -0
- package/src/app/api/[locale]/system/unified-interface/cli/widgets/core/types.ts +126 -0
- package/src/app/api/[locale]/system/unified-interface/cli/widgets/i18n/de/index.ts +67 -0
- package/src/app/api/[locale]/system/unified-interface/cli/widgets/i18n/en/index.ts +65 -0
- package/src/app/api/[locale]/system/unified-interface/cli/widgets/i18n/pl/index.ts +67 -0
- package/src/app/api/[locale]/system/unified-interface/cli/widgets/implementations/accordion.ts +74 -0
- package/src/app/api/[locale]/system/unified-interface/cli/widgets/implementations/avatar.ts +39 -0
- package/src/app/api/[locale]/system/unified-interface/cli/widgets/implementations/badge.ts +54 -0
- package/src/app/api/[locale]/system/unified-interface/cli/widgets/implementations/code-output.ts +298 -0
- package/src/app/api/[locale]/system/unified-interface/cli/widgets/implementations/code-quality-files.ts +89 -0
- package/src/app/api/[locale]/system/unified-interface/cli/widgets/implementations/code-quality-list.ts +298 -0
- package/src/app/api/[locale]/system/unified-interface/cli/widgets/implementations/code-quality-summary.ts +96 -0
- package/src/app/api/[locale]/system/unified-interface/cli/widgets/implementations/container.ts +186 -0
- package/src/app/api/[locale]/system/unified-interface/cli/widgets/implementations/data-card.ts +65 -0
- package/src/app/api/[locale]/system/unified-interface/cli/widgets/implementations/data-cards.ts +570 -0
- package/src/app/api/[locale]/system/unified-interface/cli/widgets/implementations/data-list.ts +80 -0
- package/src/app/api/[locale]/system/unified-interface/cli/widgets/implementations/data-table.ts +385 -0
- package/src/app/api/[locale]/system/unified-interface/cli/widgets/implementations/editable-text.ts +99 -0
- package/src/app/api/[locale]/system/unified-interface/cli/widgets/implementations/empty-state.ts +55 -0
- package/src/app/api/[locale]/system/unified-interface/cli/widgets/implementations/errors.ts +67 -0
- package/src/app/api/[locale]/system/unified-interface/cli/widgets/implementations/grouped-list.ts +729 -0
- package/src/app/api/[locale]/system/unified-interface/cli/widgets/implementations/link-card.ts +87 -0
- package/src/app/api/[locale]/system/unified-interface/cli/widgets/implementations/link-list.ts +112 -0
- package/src/app/api/[locale]/system/unified-interface/cli/widgets/implementations/link.ts +59 -0
- package/src/app/api/[locale]/system/unified-interface/cli/widgets/implementations/loading.ts +50 -0
- package/src/app/api/[locale]/system/unified-interface/cli/widgets/implementations/markdown.ts +131 -0
- package/src/app/api/[locale]/system/unified-interface/cli/widgets/implementations/metric.ts +291 -0
- package/src/app/api/[locale]/system/unified-interface/cli/widgets/implementations/section.ts +120 -0
- package/src/app/api/[locale]/system/unified-interface/cli/widgets/implementations/stats-grid.ts +149 -0
- package/src/app/api/[locale]/system/unified-interface/cli/widgets/implementations/tabs.ts +61 -0
- package/src/app/api/[locale]/system/unified-interface/cli/widgets/implementations/text.ts +78 -0
- package/src/app/api/[locale]/system/unified-interface/cli/widgets/implementations/title.ts +42 -0
- package/src/app/api/[locale]/system/unified-interface/cli/widgets/renderers/response-renderer.ts +418 -0
- package/src/app/api/[locale]/system/unified-interface/cli/widgets/renderers/schema-handler.ts +534 -0
- package/src/app/api/[locale]/system/unified-interface/i18n/de/index.ts +42 -0
- package/src/app/api/[locale]/system/unified-interface/i18n/en/index.ts +40 -0
- package/src/app/api/[locale]/system/unified-interface/i18n/pl/index.ts +43 -0
- package/src/app/api/[locale]/system/unified-interface/mcp/README.md +114 -0
- package/src/app/api/[locale]/system/unified-interface/mcp/converter.ts +146 -0
- package/src/app/api/[locale]/system/unified-interface/mcp/i18n/de/index.ts +182 -0
- package/src/app/api/[locale]/system/unified-interface/mcp/i18n/en/index.ts +179 -0
- package/src/app/api/[locale]/system/unified-interface/mcp/i18n/pl/index.ts +181 -0
- package/src/app/api/[locale]/system/unified-interface/mcp/registry.ts +343 -0
- package/src/app/api/[locale]/system/unified-interface/mcp/serve/definition.ts +147 -0
- package/src/app/api/[locale]/system/unified-interface/mcp/serve/repository.ts +38 -0
- package/src/app/api/[locale]/system/unified-interface/mcp/serve/route.ts +14 -0
- package/src/app/api/[locale]/system/unified-interface/mcp/server/protocol-handler.ts +309 -0
- package/src/app/api/[locale]/system/unified-interface/mcp/server/server.ts +154 -0
- package/src/app/api/[locale]/system/unified-interface/mcp/server/stdio-transport.ts +193 -0
- package/src/app/api/[locale]/system/unified-interface/mcp/types.ts +246 -0
- package/src/app/api/[locale]/system/unified-interface/shared/endpoints/definition/create-form.ts +1510 -0
- package/src/app/api/[locale]/system/unified-interface/shared/endpoints/definition/create.ts +581 -0
- package/src/app/api/[locale]/system/unified-interface/shared/endpoints/definition/endpoint-to-metadata.ts +52 -0
- package/src/app/api/[locale]/system/unified-interface/shared/endpoints/definition/loader.ts +152 -0
- package/src/app/api/[locale]/system/unified-interface/shared/endpoints/definitions/registry.ts +265 -0
- package/src/app/api/[locale]/system/unified-interface/shared/endpoints/permissions/registry.ts +680 -0
- package/src/app/api/[locale]/system/unified-interface/shared/endpoints/route/executor.ts +220 -0
- package/src/app/api/[locale]/system/unified-interface/shared/endpoints/route/handler.ts +325 -0
- package/src/app/api/[locale]/system/unified-interface/shared/endpoints/route/multi.ts +184 -0
- package/src/app/api/[locale]/system/unified-interface/shared/endpoints/route/request-validator.ts +201 -0
- package/src/app/api/[locale]/system/unified-interface/shared/endpoints/route/single.ts +58 -0
- package/src/app/api/[locale]/system/unified-interface/shared/env/define-env-client.ts +49 -0
- package/src/app/api/[locale]/system/unified-interface/shared/env/define-env.ts +47 -0
- package/src/app/api/[locale]/system/unified-interface/shared/env/validation-logger.ts +58 -0
- package/src/app/api/[locale]/system/unified-interface/shared/field/enum.ts +110 -0
- package/src/app/api/[locale]/system/unified-interface/shared/field/specialized.ts +339 -0
- package/src/app/api/[locale]/system/unified-interface/shared/field/utils.test.ts +408 -0
- package/src/app/api/[locale]/system/unified-interface/shared/field/utils.ts +1349 -0
- package/src/app/api/[locale]/system/unified-interface/shared/field-config/endpoint-field-types.ts +107 -0
- package/src/app/api/[locale]/system/unified-interface/shared/field-config/field-config-types.ts +268 -0
- package/src/app/api/[locale]/system/unified-interface/shared/logger/colors.ts +114 -0
- package/src/app/api/[locale]/system/unified-interface/shared/logger/endpoint.ts +169 -0
- package/src/app/api/[locale]/system/unified-interface/shared/logger/file-logger.ts +88 -0
- package/src/app/api/[locale]/system/unified-interface/shared/logger/formatters.ts +177 -0
- package/src/app/api/[locale]/system/unified-interface/shared/server-only/auth/base-auth-handler.ts +82 -0
- package/src/app/api/[locale]/system/unified-interface/shared/server-only/auth/factory.ts +33 -0
- package/src/app/api/[locale]/system/unified-interface/shared/server-only/server-only.ts +4 -0
- package/src/app/api/[locale]/system/unified-interface/shared/types/actions.ts +289 -0
- package/src/app/api/[locale]/system/unified-interface/shared/types/endpoint.ts +1167 -0
- package/src/app/api/[locale]/system/unified-interface/shared/types/enums.ts +382 -0
- package/src/app/api/[locale]/system/unified-interface/shared/types/platform.ts +34 -0
- package/src/app/api/[locale]/system/unified-interface/shared/types/types.ts +80 -0
- package/src/app/api/[locale]/system/unified-interface/shared/types/ui-config.ts +76 -0
- package/src/app/api/[locale]/system/unified-interface/shared/utils/error-types.ts +27 -0
- package/src/app/api/[locale]/system/unified-interface/shared/utils/path.ts +63 -0
- package/src/app/api/[locale]/system/unified-interface/shared/utils/scanner.ts +241 -0
- package/src/app/api/[locale]/system/unified-interface/shared/widgets/actions.ts +256 -0
- package/src/app/api/[locale]/system/unified-interface/shared/widgets/configs.ts +1158 -0
- package/src/app/api/[locale]/system/unified-interface/shared/widgets/helpers.ts +80 -0
- package/src/app/api/[locale]/system/unified-interface/shared/widgets/logic/accordion.ts +82 -0
- package/src/app/api/[locale]/system/unified-interface/shared/widgets/logic/avatar.ts +75 -0
- package/src/app/api/[locale]/system/unified-interface/shared/widgets/logic/badge.ts +89 -0
- package/src/app/api/[locale]/system/unified-interface/shared/widgets/logic/code-output.ts +302 -0
- package/src/app/api/[locale]/system/unified-interface/shared/widgets/logic/code-quality-list.ts +202 -0
- package/src/app/api/[locale]/system/unified-interface/shared/widgets/logic/container.ts +129 -0
- package/src/app/api/[locale]/system/unified-interface/shared/widgets/logic/data-card.ts +81 -0
- package/src/app/api/[locale]/system/unified-interface/shared/widgets/logic/data-cards.ts +258 -0
- package/src/app/api/[locale]/system/unified-interface/shared/widgets/logic/data-list.ts +123 -0
- package/src/app/api/[locale]/system/unified-interface/shared/widgets/logic/data-table.ts +387 -0
- package/src/app/api/[locale]/system/unified-interface/shared/widgets/logic/editable-text.ts +89 -0
- package/src/app/api/[locale]/system/unified-interface/shared/widgets/logic/empty-state.ts +78 -0
- package/src/app/api/[locale]/system/unified-interface/shared/widgets/logic/errors.ts +93 -0
- package/src/app/api/[locale]/system/unified-interface/shared/widgets/logic/grouped-list.ts +448 -0
- package/src/app/api/[locale]/system/unified-interface/shared/widgets/logic/index.ts +38 -0
- package/src/app/api/[locale]/system/unified-interface/shared/widgets/logic/link-card.ts +130 -0
- package/src/app/api/[locale]/system/unified-interface/shared/widgets/logic/link-list.ts +127 -0
- package/src/app/api/[locale]/system/unified-interface/shared/widgets/logic/link.ts +68 -0
- package/src/app/api/[locale]/system/unified-interface/shared/widgets/logic/loading.ts +81 -0
- package/src/app/api/[locale]/system/unified-interface/shared/widgets/logic/markdown.ts +176 -0
- package/src/app/api/[locale]/system/unified-interface/shared/widgets/logic/metric-card.ts +241 -0
- package/src/app/api/[locale]/system/unified-interface/shared/widgets/logic/section.ts +90 -0
- package/src/app/api/[locale]/system/unified-interface/shared/widgets/logic/stats-grid.ts +71 -0
- package/src/app/api/[locale]/system/unified-interface/shared/widgets/logic/tabs.ts +80 -0
- package/src/app/api/[locale]/system/unified-interface/shared/widgets/logic/text.ts +105 -0
- package/src/app/api/[locale]/system/unified-interface/shared/widgets/logic/title.ts +72 -0
- package/src/app/api/[locale]/system/unified-interface/shared/widgets/types.ts +240 -0
- package/src/app/api/[locale]/system/unified-interface/shared/widgets/utils/field-helpers.ts +137 -0
- package/src/app/api/[locale]/system/unified-interface/shared/widgets/utils/formatting.ts +437 -0
- package/src/app/api/[locale]/system/unified-interface/shared/widgets/utils/url.ts +40 -0
- package/src/app/api/[locale]/system/unified-interface/shared/widgets/utils/widget-helpers.ts +465 -0
- package/src/app/api/[locale]/user/auth/enum.ts +16 -0
- package/src/app/api/[locale]/user/auth/i18n/de/index.ts +227 -0
- package/src/app/api/[locale]/user/auth/i18n/en/index.ts +205 -0
- package/src/app/api/[locale]/user/auth/i18n/pl/index.ts +219 -0
- package/src/app/api/[locale]/user/auth/types.ts +110 -0
- package/src/app/api/[locale]/user/enum.ts +64 -0
- package/src/app/api/[locale]/user/private/i18n/de/index.ts +3 -0
- package/src/app/api/[locale]/user/private/i18n/en/index.ts +1 -0
- package/src/app/api/[locale]/user/private/i18n/pl/index.ts +3 -0
- package/src/app/api/[locale]/user/types.ts +118 -0
- package/src/app/api/[locale]/user/user-roles/enum.ts +112 -0
- package/src/app/api/[locale]/user/user-roles/i18n/de/index.ts +85 -0
- package/src/app/api/[locale]/user/user-roles/i18n/en/index.ts +83 -0
- package/src/app/api/[locale]/user/user-roles/i18n/pl/index.ts +86 -0
- package/src/app/api/[locale]/user/user-roles/types.ts +34 -0
- package/src/app/api/i18n/de/index.ts +6 -0
- package/src/app/api/i18n/en/index.ts +5 -0
- package/src/app/api/i18n/pl/index.ts +5 -0
- package/src/app/i18n/de/index.ts +6 -0
- package/src/app/i18n/en/index.ts +5 -0
- package/src/app/i18n/pl/index.ts +5 -0
|
@@ -0,0 +1,595 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Production-ready debug utilities for CLI performance monitoring and resource cleanup
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import type { EndpointLogger } from "@/app/api/[locale]/system/unified-interface/shared/logger/endpoint";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Internal Node.js handle type for resource monitoring
|
|
9
|
+
* These are internal APIs not in @types/node, accessed via type assertion
|
|
10
|
+
*/
|
|
11
|
+
interface InternalNodeHandle {
|
|
12
|
+
constructor: { name: string };
|
|
13
|
+
close?: () => void;
|
|
14
|
+
destroy?: () => void;
|
|
15
|
+
end?: () => void;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Extended process type with internal Node.js APIs
|
|
20
|
+
* Used for resource monitoring - these are undocumented internal APIs
|
|
21
|
+
*/
|
|
22
|
+
interface ProcessWithInternals {
|
|
23
|
+
_getActiveHandles?: () => InternalNodeHandle[];
|
|
24
|
+
_getActiveRequests?: () => never[];
|
|
25
|
+
}
|
|
26
|
+
import { createEndpointLogger } from "@/app/api/[locale]/system/unified-interface/shared/logger/endpoint";
|
|
27
|
+
import type { CountryLanguage } from "@/i18n/core/config";
|
|
28
|
+
|
|
29
|
+
import { binaryStartTime } from "../vibe-runtime";
|
|
30
|
+
import type { RouteExecutionResult } from "./route-executor";
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Safe handle types that should not be forcefully closed
|
|
34
|
+
*/
|
|
35
|
+
const WRITE_STREAM = "WriteStream";
|
|
36
|
+
const READ_STREAM = "ReadStream";
|
|
37
|
+
const TTY = "TTY";
|
|
38
|
+
const SAFE_HANDLE_TYPES = [WRITE_STREAM, READ_STREAM, TTY] as const;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Timing data structure for performance monitoring
|
|
42
|
+
*/
|
|
43
|
+
export interface TimingData {
|
|
44
|
+
binaryStart: number;
|
|
45
|
+
tsStart: number;
|
|
46
|
+
initStart: number;
|
|
47
|
+
initEnd: number;
|
|
48
|
+
parseStart: number;
|
|
49
|
+
parseEnd: number;
|
|
50
|
+
routeStart: number;
|
|
51
|
+
routeEnd: number;
|
|
52
|
+
renderStart: number;
|
|
53
|
+
renderEnd: number;
|
|
54
|
+
end: number;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Performance breakdown data
|
|
59
|
+
*/
|
|
60
|
+
export interface PerformanceBreakdown {
|
|
61
|
+
totalDuration: number;
|
|
62
|
+
binaryOverhead: number;
|
|
63
|
+
initOverhead: number;
|
|
64
|
+
parseOverhead: number;
|
|
65
|
+
routeExecution: number;
|
|
66
|
+
renderOverhead: number;
|
|
67
|
+
preRouteOverhead: number;
|
|
68
|
+
postRouteOverhead: number;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Active handle information
|
|
73
|
+
*/
|
|
74
|
+
export interface ActiveHandle {
|
|
75
|
+
type: string;
|
|
76
|
+
constructor: string;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Resource cleanup registry
|
|
81
|
+
*/
|
|
82
|
+
export class ResourceCleanupRegistry {
|
|
83
|
+
private cleanupFunctions: Array<() => void | Promise<void>> = [];
|
|
84
|
+
private timers: Set<NodeJS.Timeout> = new Set();
|
|
85
|
+
private intervals: Set<NodeJS.Timeout> = new Set();
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Register a cleanup function
|
|
89
|
+
*/
|
|
90
|
+
register(cleanup: () => void | Promise<void>): void {
|
|
91
|
+
this.cleanupFunctions.push(cleanup);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Register a timer for cleanup
|
|
96
|
+
*/
|
|
97
|
+
registerTimer(timer: NodeJS.Timeout): void {
|
|
98
|
+
this.timers.add(timer);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Register an interval for cleanup
|
|
103
|
+
*/
|
|
104
|
+
registerInterval(interval: NodeJS.Timeout): void {
|
|
105
|
+
this.intervals.add(interval);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Execute all cleanup functions
|
|
110
|
+
*/
|
|
111
|
+
async cleanup(logger: EndpointLogger): Promise<void> {
|
|
112
|
+
// Clear all timers and intervals
|
|
113
|
+
for (const timer of this.timers) {
|
|
114
|
+
clearTimeout(timer);
|
|
115
|
+
}
|
|
116
|
+
for (const interval of this.intervals) {
|
|
117
|
+
clearInterval(interval);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// Execute cleanup functions
|
|
121
|
+
for (const cleanup of this.cleanupFunctions) {
|
|
122
|
+
try {
|
|
123
|
+
await cleanup();
|
|
124
|
+
} catch (cleanupError) {
|
|
125
|
+
const error =
|
|
126
|
+
cleanupError instanceof Error
|
|
127
|
+
? { message: cleanupError.message, stack: cleanupError.stack }
|
|
128
|
+
: { message: String(cleanupError) };
|
|
129
|
+
logger.warn(
|
|
130
|
+
"app.api.system.unifiedInterface.cli.vibe.utils.debug.cleanupFunctionFailed",
|
|
131
|
+
{ cleanupError: error },
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// Clear registries
|
|
137
|
+
this.cleanupFunctions = [];
|
|
138
|
+
this.timers.clear();
|
|
139
|
+
this.intervals.clear();
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Performance monitor for CLI operations
|
|
145
|
+
*/
|
|
146
|
+
export class CliPerformanceMonitor {
|
|
147
|
+
private timings: Partial<TimingData> = {};
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Initialize timing with binary start time from environment
|
|
151
|
+
*/
|
|
152
|
+
initialize(): void {
|
|
153
|
+
this.timings = {
|
|
154
|
+
binaryStart: binaryStartTime,
|
|
155
|
+
tsStart: Date.now(),
|
|
156
|
+
initStart: Date.now(),
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Mark a timing point
|
|
162
|
+
*/
|
|
163
|
+
mark(point: keyof TimingData): void {
|
|
164
|
+
this.timings[point] = Date.now();
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Get current timings
|
|
169
|
+
*/
|
|
170
|
+
getTimings(): Partial<TimingData> {
|
|
171
|
+
return { ...this.timings };
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* Calculate performance breakdown
|
|
176
|
+
*/
|
|
177
|
+
calculateBreakdown(): PerformanceBreakdown | null {
|
|
178
|
+
const t = this.timings;
|
|
179
|
+
if (!t.binaryStart || !t.end || !t.routeStart || !t.routeEnd) {
|
|
180
|
+
return null;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
const totalDuration = t.end - t.binaryStart;
|
|
184
|
+
const binaryOverhead = (t.tsStart || t.binaryStart) - t.binaryStart;
|
|
185
|
+
const initOverhead = Math.max(0, (t.initEnd || 0) - (t.initStart || 0));
|
|
186
|
+
const parseOverhead = Math.max(0, (t.parseEnd || 0) - (t.parseStart || 0));
|
|
187
|
+
const routeExecution = t.routeEnd - t.routeStart;
|
|
188
|
+
const renderOverhead = Math.max(
|
|
189
|
+
0,
|
|
190
|
+
(t.renderEnd || 0) - (t.renderStart || 0),
|
|
191
|
+
);
|
|
192
|
+
const preRouteOverhead = Math.max(
|
|
193
|
+
0,
|
|
194
|
+
t.routeStart - (t.tsStart || t.binaryStart),
|
|
195
|
+
);
|
|
196
|
+
const postRouteOverhead = Math.max(0, t.end - t.routeEnd);
|
|
197
|
+
|
|
198
|
+
return {
|
|
199
|
+
totalDuration,
|
|
200
|
+
binaryOverhead,
|
|
201
|
+
initOverhead,
|
|
202
|
+
parseOverhead,
|
|
203
|
+
routeExecution,
|
|
204
|
+
renderOverhead,
|
|
205
|
+
preRouteOverhead,
|
|
206
|
+
postRouteOverhead,
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Resource monitor for detecting hanging handles
|
|
213
|
+
*/
|
|
214
|
+
export class ResourceMonitor {
|
|
215
|
+
/**
|
|
216
|
+
* Get active handles that might prevent process exit
|
|
217
|
+
*/
|
|
218
|
+
getActiveHandles(): ActiveHandle[] {
|
|
219
|
+
const handles: ActiveHandle[] = [];
|
|
220
|
+
|
|
221
|
+
try {
|
|
222
|
+
// Cast to access internal Node.js APIs
|
|
223
|
+
const proc = process as ProcessWithInternals;
|
|
224
|
+
if (proc._getActiveHandles) {
|
|
225
|
+
const activeHandles = proc._getActiveHandles();
|
|
226
|
+
for (const handle of activeHandles) {
|
|
227
|
+
handles.push({
|
|
228
|
+
type: handle.constructor.name,
|
|
229
|
+
constructor: handle.constructor.name,
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
} catch {
|
|
234
|
+
// Ignore errors accessing internal APIs
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
return handles;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* Get active requests count
|
|
242
|
+
*/
|
|
243
|
+
getActiveRequestsCount(): number {
|
|
244
|
+
try {
|
|
245
|
+
// Cast to access internal Node.js APIs
|
|
246
|
+
const proc = process as ProcessWithInternals;
|
|
247
|
+
if (proc._getActiveRequests) {
|
|
248
|
+
return proc._getActiveRequests().length;
|
|
249
|
+
}
|
|
250
|
+
} catch {
|
|
251
|
+
// Ignore errors accessing internal APIs
|
|
252
|
+
}
|
|
253
|
+
return 0;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
/**
|
|
257
|
+
* Check if there are problematic handles preventing exit
|
|
258
|
+
*/
|
|
259
|
+
hasProblematicHandles(): boolean {
|
|
260
|
+
const handles = this.getActiveHandles();
|
|
261
|
+
|
|
262
|
+
// Any handle that's not in the safe list is potentially problematic
|
|
263
|
+
return handles.some((handle) => {
|
|
264
|
+
const handleType = handle.type;
|
|
265
|
+
return !SAFE_HANDLE_TYPES.includes(
|
|
266
|
+
handleType as (typeof SAFE_HANDLE_TYPES)[number],
|
|
267
|
+
);
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* Force close all handles (aggressive cleanup)
|
|
273
|
+
*/
|
|
274
|
+
forceCloseHandles(): void {
|
|
275
|
+
try {
|
|
276
|
+
// Cast to access internal Node.js APIs
|
|
277
|
+
const proc = process as ProcessWithInternals;
|
|
278
|
+
if (proc._getActiveHandles) {
|
|
279
|
+
const handles = proc._getActiveHandles();
|
|
280
|
+
for (const handle of handles) {
|
|
281
|
+
try {
|
|
282
|
+
// Skip stdio handles
|
|
283
|
+
if (
|
|
284
|
+
handle.constructor.name === WRITE_STREAM ||
|
|
285
|
+
handle.constructor.name === READ_STREAM ||
|
|
286
|
+
handle.constructor.name === TTY
|
|
287
|
+
) {
|
|
288
|
+
continue;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
// Try to close the handle
|
|
292
|
+
if (typeof handle.close === "function") {
|
|
293
|
+
handle.close();
|
|
294
|
+
} else if (typeof handle.destroy === "function") {
|
|
295
|
+
handle.destroy();
|
|
296
|
+
} else if (typeof handle.end === "function") {
|
|
297
|
+
handle.end();
|
|
298
|
+
}
|
|
299
|
+
} catch {
|
|
300
|
+
// Ignore errors when force closing handles
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
} catch {
|
|
305
|
+
// Ignore errors accessing internal APIs
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* Format performance breakdown for verbose output
|
|
312
|
+
*/
|
|
313
|
+
function formatPerformanceBreakdown(breakdown: PerformanceBreakdown): string {
|
|
314
|
+
return JSON.stringify(
|
|
315
|
+
{
|
|
316
|
+
binaryStartup: `${breakdown.binaryOverhead}ms`,
|
|
317
|
+
routeDiscovery: `${Math.round(breakdown.preRouteOverhead * 0.7)}ms`,
|
|
318
|
+
cliInit: `${breakdown.initOverhead}ms`,
|
|
319
|
+
dataParsing: `${breakdown.parseOverhead}ms`,
|
|
320
|
+
routeExecution: `${breakdown.routeExecution}ms`,
|
|
321
|
+
rendering: `${breakdown.renderOverhead}ms`,
|
|
322
|
+
cleanup: `${Math.round(breakdown.postRouteOverhead)}ms`,
|
|
323
|
+
totalOverhead: `${breakdown.totalDuration - breakdown.routeExecution}ms`,
|
|
324
|
+
},
|
|
325
|
+
null,
|
|
326
|
+
2,
|
|
327
|
+
);
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
/**
|
|
331
|
+
* Format active handles for debugging
|
|
332
|
+
*/
|
|
333
|
+
function formatActiveHandles(handles: ActiveHandle[]): string {
|
|
334
|
+
const grouped = handles.reduce(
|
|
335
|
+
(acc, handle) => {
|
|
336
|
+
acc[handle.type] = (acc[handle.type] || 0) + 1;
|
|
337
|
+
return acc;
|
|
338
|
+
},
|
|
339
|
+
{} as Record<string, number>,
|
|
340
|
+
);
|
|
341
|
+
|
|
342
|
+
return Object.entries(grouped)
|
|
343
|
+
.map(([type, count]) => `${type}: ${count}`)
|
|
344
|
+
.join(", ");
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
/**
|
|
348
|
+
* Format simple execution summary for non-verbose output
|
|
349
|
+
*/
|
|
350
|
+
function formatExecutionSummary(
|
|
351
|
+
breakdown: PerformanceBreakdown,
|
|
352
|
+
performanceMetadata?: Partial<Record<string, number>>,
|
|
353
|
+
): string {
|
|
354
|
+
// Check if we have detailed performance metadata (e.g., oxlint, eslint, typecheck timings)
|
|
355
|
+
if (performanceMetadata && Object.keys(performanceMetadata).length > 0) {
|
|
356
|
+
// Build detailed timing string
|
|
357
|
+
const timingParts: string[] = [];
|
|
358
|
+
|
|
359
|
+
// Sort keys to ensure consistent order: oxlint, eslint, typecheck (exclude total - we'll add it manually)
|
|
360
|
+
const sortedKeys = Object.keys(performanceMetadata)
|
|
361
|
+
.filter((key) => !key.includes(".total"))
|
|
362
|
+
.toSorted((a, b) => {
|
|
363
|
+
const order: Record<string, number> = {
|
|
364
|
+
oxlint: 1,
|
|
365
|
+
eslint: 2,
|
|
366
|
+
typecheck: 3,
|
|
367
|
+
};
|
|
368
|
+
const aKey = a.split(".").pop() || "";
|
|
369
|
+
const bKey = b.split(".").pop() || "";
|
|
370
|
+
return (order[aKey] || 99) - (order[bKey] || 99);
|
|
371
|
+
});
|
|
372
|
+
|
|
373
|
+
for (const key of sortedKeys) {
|
|
374
|
+
const value = performanceMetadata[key];
|
|
375
|
+
if (value !== undefined) {
|
|
376
|
+
// Extract the last part of the translation key (e.g., "oxlint" from "app.api.system.check.vibeCheck.performance.oxlint")
|
|
377
|
+
const label = key.split(".").pop() || key;
|
|
378
|
+
|
|
379
|
+
// Capitalize first letter for display
|
|
380
|
+
const displayLabel =
|
|
381
|
+
label === "oxlint"
|
|
382
|
+
? "Oxlint"
|
|
383
|
+
: label === "eslint"
|
|
384
|
+
? "ESLint"
|
|
385
|
+
: label === "typecheck"
|
|
386
|
+
? "TypeScript"
|
|
387
|
+
: label.charAt(0).toUpperCase() + label.slice(1);
|
|
388
|
+
|
|
389
|
+
const seconds = (value / 1000).toFixed(2);
|
|
390
|
+
timingParts.push(`${displayLabel}: ${seconds}s`);
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
// Add total time from breakdown (complete time from first to last line of script)
|
|
395
|
+
const totalSeconds = (breakdown.totalDuration / 1000).toFixed(2);
|
|
396
|
+
timingParts.push(`Total: ${totalSeconds}s`);
|
|
397
|
+
|
|
398
|
+
if (timingParts.length > 0) {
|
|
399
|
+
return `\n${timingParts.join(" | ")}`;
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
// Fallback to simple format if no performance metadata
|
|
404
|
+
const executionSeconds = (breakdown.routeExecution / 1000).toFixed(2);
|
|
405
|
+
const totalSeconds = (breakdown.totalDuration / 1000).toFixed(2);
|
|
406
|
+
|
|
407
|
+
return `\nExecution: ${executionSeconds}s | Total: ${totalSeconds}s`;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
/**
|
|
411
|
+
* CLI resource manager for proper cleanup
|
|
412
|
+
*/
|
|
413
|
+
export class CliResourceManager {
|
|
414
|
+
private performanceMonitor = new CliPerformanceMonitor();
|
|
415
|
+
private cleanupRegistry = new ResourceCleanupRegistry();
|
|
416
|
+
private resourceMonitor = new ResourceMonitor();
|
|
417
|
+
private abortController: AbortController | null = null;
|
|
418
|
+
|
|
419
|
+
/**
|
|
420
|
+
* Initialize CLI resources and monitoring
|
|
421
|
+
*/
|
|
422
|
+
// oxlint-disable-next-line no-unused-vars
|
|
423
|
+
initialize(logger: EndpointLogger, locale: CountryLanguage): void {
|
|
424
|
+
this.performanceMonitor.initialize();
|
|
425
|
+
|
|
426
|
+
// Create AbortController for request cancellation
|
|
427
|
+
this.abortController = new AbortController();
|
|
428
|
+
|
|
429
|
+
// Register process signal handlers for graceful shutdown
|
|
430
|
+
this.setupSignalHandlers(locale);
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
/**
|
|
434
|
+
* Get abort signal for request cancellation
|
|
435
|
+
*/
|
|
436
|
+
getAbortSignal(): AbortSignal | undefined {
|
|
437
|
+
return this.abortController?.signal;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
/**
|
|
441
|
+
* Get performance monitor
|
|
442
|
+
*/
|
|
443
|
+
getPerformanceMonitor(): CliPerformanceMonitor {
|
|
444
|
+
return this.performanceMonitor;
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
/**
|
|
448
|
+
* Setup signal handlers for graceful shutdown
|
|
449
|
+
*/
|
|
450
|
+
private setupSignalHandlers(locale: CountryLanguage): void {
|
|
451
|
+
const handleShutdown = async (): Promise<void> => {
|
|
452
|
+
// Abort any ongoing requests first
|
|
453
|
+
if (this.abortController) {
|
|
454
|
+
this.abortController.abort();
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
const logger = createEndpointLogger(false, Date.now(), locale);
|
|
458
|
+
try {
|
|
459
|
+
await this.cleanupRegistry.cleanup(logger);
|
|
460
|
+
process.exit(0);
|
|
461
|
+
} catch {
|
|
462
|
+
process.exit(1);
|
|
463
|
+
}
|
|
464
|
+
};
|
|
465
|
+
|
|
466
|
+
// Handle SIGINT but do nothing - just prevent vibe-runtime from exiting
|
|
467
|
+
// The child process (dev server) will handle SIGINT and manage cleanup
|
|
468
|
+
// We need to stay alive so the child can finish its cleanup properly
|
|
469
|
+
process.on("SIGINT", () => {
|
|
470
|
+
// Do nothing - child will handle cleanup and exit
|
|
471
|
+
// We stay alive to let the child finish properly
|
|
472
|
+
});
|
|
473
|
+
|
|
474
|
+
process.on("SIGTERM", () => void handleShutdown());
|
|
475
|
+
process.on("SIGHUP", () => void handleShutdown());
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
/**
|
|
479
|
+
* Perform comprehensive cleanup and exit gracefully
|
|
480
|
+
*/
|
|
481
|
+
async cleanupAndExit(
|
|
482
|
+
logger: EndpointLogger,
|
|
483
|
+
verbose = false,
|
|
484
|
+
result: RouteExecutionResult,
|
|
485
|
+
): Promise<void> {
|
|
486
|
+
try {
|
|
487
|
+
// Mark end timing
|
|
488
|
+
this.performanceMonitor.mark("end");
|
|
489
|
+
|
|
490
|
+
// Show performance summary
|
|
491
|
+
const breakdown = this.performanceMonitor.calculateBreakdown();
|
|
492
|
+
if (breakdown) {
|
|
493
|
+
if (verbose) {
|
|
494
|
+
const totalSeconds = (breakdown.totalDuration / 1000).toFixed(2);
|
|
495
|
+
logger.info(
|
|
496
|
+
"app.api.system.unifiedInterface.cli.vibe.utils.debug.executionTime",
|
|
497
|
+
{ totalSeconds },
|
|
498
|
+
);
|
|
499
|
+
logger.info(
|
|
500
|
+
"app.api.system.unifiedInterface.cli.vibe.utils.debug.performanceBreakdown",
|
|
501
|
+
);
|
|
502
|
+
logger.info(formatPerformanceBreakdown(breakdown));
|
|
503
|
+
} else {
|
|
504
|
+
// Use console.log directly to avoid duplicate timestamp from logger
|
|
505
|
+
// The execution summary is already formatted and translated
|
|
506
|
+
// oxlint-disable-next-line no-console
|
|
507
|
+
console.log(formatExecutionSummary(breakdown, result.performance));
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
// Perform cleanup
|
|
512
|
+
await this.cleanupRegistry.cleanup(logger);
|
|
513
|
+
|
|
514
|
+
// Force close any remaining problematic handles
|
|
515
|
+
this.resourceMonitor.forceCloseHandles();
|
|
516
|
+
|
|
517
|
+
// Give a moment for cleanup to complete
|
|
518
|
+
await new Promise<void>((resolve) => {
|
|
519
|
+
setTimeout(resolve, 50);
|
|
520
|
+
});
|
|
521
|
+
|
|
522
|
+
// Check for remaining problematic handles
|
|
523
|
+
if (verbose) {
|
|
524
|
+
const handles = this.resourceMonitor.getActiveHandles();
|
|
525
|
+
const requests = this.resourceMonitor.getActiveRequestsCount();
|
|
526
|
+
|
|
527
|
+
if (handles.length > 0 || requests > 0) {
|
|
528
|
+
logger.info(
|
|
529
|
+
"app.api.system.unifiedInterface.cli.vibe.utils.debug.remainingResources",
|
|
530
|
+
);
|
|
531
|
+
logger.info(
|
|
532
|
+
"app.api.system.unifiedInterface.cli.vibe.utils.debug.activeHandles",
|
|
533
|
+
{
|
|
534
|
+
handles: formatActiveHandles(handles),
|
|
535
|
+
},
|
|
536
|
+
);
|
|
537
|
+
logger.info(
|
|
538
|
+
"app.api.system.unifiedInterface.cli.vibe.utils.debug.activeRequests",
|
|
539
|
+
{
|
|
540
|
+
requests: requests.toString(),
|
|
541
|
+
},
|
|
542
|
+
);
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
// Force garbage collection if available
|
|
547
|
+
if (global.gc) {
|
|
548
|
+
global.gc();
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
// Check if we need to force exit
|
|
552
|
+
const hasProblematic = this.resourceMonitor.hasProblematicHandles();
|
|
553
|
+
if (hasProblematic) {
|
|
554
|
+
if (verbose) {
|
|
555
|
+
logger.warn(
|
|
556
|
+
"app.api.system.unifiedInterface.cli.vibe.utils.debug.problematicHandlesDetected",
|
|
557
|
+
);
|
|
558
|
+
}
|
|
559
|
+
setTimeout(() => this.exit(result), 100);
|
|
560
|
+
} else {
|
|
561
|
+
// Clean exit
|
|
562
|
+
this.exit(result);
|
|
563
|
+
}
|
|
564
|
+
} catch (cleanupError) {
|
|
565
|
+
const error =
|
|
566
|
+
cleanupError instanceof Error
|
|
567
|
+
? { message: cleanupError.message, stack: cleanupError.stack }
|
|
568
|
+
: { message: String(cleanupError) };
|
|
569
|
+
logger.warn(
|
|
570
|
+
"app.api.system.unifiedInterface.cli.vibe.utils.debug.cleanupError",
|
|
571
|
+
{ cleanupError: error },
|
|
572
|
+
);
|
|
573
|
+
process.exit(1);
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
exit(result: RouteExecutionResult): void {
|
|
578
|
+
// Exit with error code if the result indicates failure
|
|
579
|
+
if (
|
|
580
|
+
!result.success ||
|
|
581
|
+
result.cause ||
|
|
582
|
+
result.error ||
|
|
583
|
+
result.isErrorResponse
|
|
584
|
+
) {
|
|
585
|
+
process.exit(1);
|
|
586
|
+
} else {
|
|
587
|
+
process.exit(0);
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
/**
|
|
593
|
+
* Global CLI resource manager instance
|
|
594
|
+
*/
|
|
595
|
+
export const cliResourceManager = new CliResourceManager();
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
/* eslint-disable i18next/no-literal-string */
|
|
2
|
+
/**
|
|
3
|
+
* CLI Entry Point System
|
|
4
|
+
* Core CLI execution functionality that executes routes from generated index
|
|
5
|
+
* Integrates with schema-driven handlers for enhanced CLI experience
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { parseError } from "next-vibe/shared/utils";
|
|
9
|
+
|
|
10
|
+
import type { UserRoleValue } from "@/app/api/[locale]/user/user-roles/enum";
|
|
11
|
+
import type { CountryLanguage } from "@/i18n/core/config";
|
|
12
|
+
import type { TFunction } from "@/i18n/core/static-types";
|
|
13
|
+
|
|
14
|
+
import { INTERACTIVE_MODE_ALIAS } from "../../../help/interactive/definition";
|
|
15
|
+
import type { InferJwtPayloadTypeFromRoles } from "../../shared/endpoints/route/handler";
|
|
16
|
+
import type { EndpointLogger } from "../../shared/logger/endpoint";
|
|
17
|
+
import type { CliObject } from "./parsing";
|
|
18
|
+
import type {
|
|
19
|
+
CliCompatiblePlatform,
|
|
20
|
+
CliRequestData,
|
|
21
|
+
RouteExecutionContext,
|
|
22
|
+
RouteExecutionResult,
|
|
23
|
+
} from "./route-executor";
|
|
24
|
+
import { routeDelegationHandler } from "./route-executor";
|
|
25
|
+
|
|
26
|
+
interface CliExecutionOptions {
|
|
27
|
+
data?: CliRequestData;
|
|
28
|
+
urlPathParams?: Record<string, string | number | boolean | null | undefined>;
|
|
29
|
+
cliArgs?: {
|
|
30
|
+
positionalArgs: string[];
|
|
31
|
+
namedArgs: CliObject;
|
|
32
|
+
};
|
|
33
|
+
user?: InferJwtPayloadTypeFromRoles<readonly UserRoleValue[]>;
|
|
34
|
+
locale: CountryLanguage;
|
|
35
|
+
/** Platform identifier (CLI or CLI_PACKAGE) */
|
|
36
|
+
platform: CliCompatiblePlatform;
|
|
37
|
+
dryRun?: boolean;
|
|
38
|
+
interactive?: boolean;
|
|
39
|
+
verbose?: boolean;
|
|
40
|
+
output?: "json" | "table" | "pretty";
|
|
41
|
+
userType?: string;
|
|
42
|
+
category?: string;
|
|
43
|
+
format?: string;
|
|
44
|
+
examples?: boolean;
|
|
45
|
+
parameters?: boolean;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* CLI Entry Point Class
|
|
50
|
+
* Executes routes using the generated endpoint index
|
|
51
|
+
*/
|
|
52
|
+
class CliEntryPoint {
|
|
53
|
+
/**
|
|
54
|
+
* Execute a command using the generated endpoint system
|
|
55
|
+
*/
|
|
56
|
+
async executeCommand(
|
|
57
|
+
command: string,
|
|
58
|
+
options: CliExecutionOptions,
|
|
59
|
+
logger: EndpointLogger,
|
|
60
|
+
t: TFunction,
|
|
61
|
+
locale: CountryLanguage,
|
|
62
|
+
): Promise<RouteExecutionResult> {
|
|
63
|
+
// Default to interactive mode if no command provided
|
|
64
|
+
const resolvedCommand = command || INTERACTIVE_MODE_ALIAS;
|
|
65
|
+
|
|
66
|
+
// Get CLI user for authentication if not provided
|
|
67
|
+
let cliUser = options.user;
|
|
68
|
+
|
|
69
|
+
if (!cliUser) {
|
|
70
|
+
const { getCliUser } = await import("../auth/cli-user");
|
|
71
|
+
const cliUserResult = await getCliUser(logger, options.locale);
|
|
72
|
+
|
|
73
|
+
if (cliUserResult.success) {
|
|
74
|
+
cliUser = cliUserResult.data;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const dataForContext: CliRequestData = options.data || {};
|
|
79
|
+
|
|
80
|
+
const context: RouteExecutionContext = {
|
|
81
|
+
toolName: resolvedCommand,
|
|
82
|
+
data: dataForContext,
|
|
83
|
+
urlPathParams: options.urlPathParams,
|
|
84
|
+
cliArgs: options.cliArgs,
|
|
85
|
+
user: cliUser,
|
|
86
|
+
locale: options.locale,
|
|
87
|
+
logger: logger,
|
|
88
|
+
platform: options.platform,
|
|
89
|
+
timestamp: Date.now(),
|
|
90
|
+
options: {
|
|
91
|
+
dryRun: options.dryRun,
|
|
92
|
+
interactive: options.interactive,
|
|
93
|
+
output: options.output,
|
|
94
|
+
},
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
try {
|
|
98
|
+
// Execute using route delegation handler
|
|
99
|
+
const result = await routeDelegationHandler.executeRoute(
|
|
100
|
+
resolvedCommand,
|
|
101
|
+
context,
|
|
102
|
+
logger,
|
|
103
|
+
locale,
|
|
104
|
+
);
|
|
105
|
+
|
|
106
|
+
return result;
|
|
107
|
+
} catch (error) {
|
|
108
|
+
process.stderr.write(
|
|
109
|
+
t("app.api.system.unifiedInterface.cli.vibe.errors.executionFailed", {
|
|
110
|
+
error: parseError(error).message,
|
|
111
|
+
}),
|
|
112
|
+
);
|
|
113
|
+
logger.error("Command execution failed", {
|
|
114
|
+
command: resolvedCommand,
|
|
115
|
+
error: parseError(error),
|
|
116
|
+
});
|
|
117
|
+
return {
|
|
118
|
+
success: false,
|
|
119
|
+
error:
|
|
120
|
+
"app.api.system.unifiedInterface.cli.vibe.errors.executionFailed",
|
|
121
|
+
errorParams: {
|
|
122
|
+
error: parseError(error).message,
|
|
123
|
+
},
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export const cliEntryPoint = new CliEntryPoint();
|