@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,155 @@
|
|
|
1
|
+
import { existsSync } from "node:fs";
|
|
2
|
+
import { dirname, join, resolve } from "node:path";
|
|
3
|
+
|
|
4
|
+
import { config } from "dotenv";
|
|
5
|
+
|
|
6
|
+
import { Platform } from "../../shared/types/platform";
|
|
7
|
+
|
|
8
|
+
/** CLI-specific platforms (subset of Platform that applies to CLI environments) */
|
|
9
|
+
export type CliPlatform = typeof Platform.CLI | typeof Platform.CLI_PACKAGE;
|
|
10
|
+
|
|
11
|
+
/** Result of environment loading */
|
|
12
|
+
export interface EnvironmentResult {
|
|
13
|
+
/** Detected platform - always CLI or CLI_PACKAGE in CLI runtime */
|
|
14
|
+
platform: CliPlatform;
|
|
15
|
+
/** Path to .env file if found */
|
|
16
|
+
envPath: string | null;
|
|
17
|
+
/** Path to project root if found */
|
|
18
|
+
projectRoot: string | null;
|
|
19
|
+
/** Whether running from npm package */
|
|
20
|
+
isPackage: boolean;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** Global storage for environment result (set once at startup) */
|
|
24
|
+
let cachedEnvironmentResult: EnvironmentResult | null = null;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Detect if running from npm package vs local development
|
|
28
|
+
* Checks:
|
|
29
|
+
* 1. If script path contains node_modules
|
|
30
|
+
* 2. If we're in a next-vibe project structure
|
|
31
|
+
*/
|
|
32
|
+
function detectIsPackage(): boolean {
|
|
33
|
+
// Check if the main script is running from node_modules
|
|
34
|
+
const mainScript = process.argv[1] || "";
|
|
35
|
+
if (mainScript.includes("node_modules")) {
|
|
36
|
+
return true;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// Check if we're in the next-vibe project (has src/app/api structure)
|
|
40
|
+
const cwd = process.cwd();
|
|
41
|
+
const localVibeStructure = join(cwd, "src/app/api/[locale]");
|
|
42
|
+
if (existsSync(localVibeStructure)) {
|
|
43
|
+
return false; // Local development
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// Check if script is running from .dist/bin in a non-project context
|
|
47
|
+
if (mainScript.includes(".dist/bin/vibe-runtime")) {
|
|
48
|
+
// Could be local dist or package dist - check for src folder
|
|
49
|
+
const scriptDir = dirname(mainScript);
|
|
50
|
+
const projectRoot = resolve(scriptDir, "../..");
|
|
51
|
+
const srcPath = join(projectRoot, "src/app/api/[locale]");
|
|
52
|
+
if (!existsSync(srcPath)) {
|
|
53
|
+
return true; // Running from package
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Load environment variables and detect platform
|
|
62
|
+
* Returns the detected platform for use in CLI initialization
|
|
63
|
+
*/
|
|
64
|
+
export function loadEnvironment(): EnvironmentResult {
|
|
65
|
+
// Return cached result if already loaded
|
|
66
|
+
if (cachedEnvironmentResult) {
|
|
67
|
+
return cachedEnvironmentResult;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const envFileName = ".env";
|
|
71
|
+
let envPath: string | null = null;
|
|
72
|
+
let projectRoot: string | null = null;
|
|
73
|
+
|
|
74
|
+
// Detect if running from package
|
|
75
|
+
const isPackage = detectIsPackage();
|
|
76
|
+
|
|
77
|
+
// Strategy 1: Look for .env file starting from current directory and going up
|
|
78
|
+
let currentDir = process.cwd();
|
|
79
|
+
while (currentDir !== dirname(currentDir)) {
|
|
80
|
+
const potentialEnvPath = join(currentDir, envFileName);
|
|
81
|
+
if (existsSync(potentialEnvPath)) {
|
|
82
|
+
envPath = potentialEnvPath;
|
|
83
|
+
projectRoot = currentDir;
|
|
84
|
+
break;
|
|
85
|
+
}
|
|
86
|
+
currentDir = dirname(currentDir);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// Strategy 2: If not found, look for package.json to identify project root
|
|
90
|
+
// This handles cases where MCP Inspector starts the process from a different directory
|
|
91
|
+
if (!envPath) {
|
|
92
|
+
let searchDir = process.cwd();
|
|
93
|
+
while (searchDir !== dirname(searchDir)) {
|
|
94
|
+
const packageJsonPath = join(searchDir, "package.json");
|
|
95
|
+
if (existsSync(packageJsonPath)) {
|
|
96
|
+
// Found package.json, this is likely the project root
|
|
97
|
+
projectRoot = searchDir;
|
|
98
|
+
const potentialEnvPath = join(searchDir, envFileName);
|
|
99
|
+
if (existsSync(potentialEnvPath)) {
|
|
100
|
+
envPath = potentialEnvPath;
|
|
101
|
+
break;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
searchDir = dirname(searchDir);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// Strategy 3: Try common project locations relative to node_modules
|
|
109
|
+
if (!envPath) {
|
|
110
|
+
// If this script is in node_modules or installed globally, try to find project root
|
|
111
|
+
const possibleRoots = [
|
|
112
|
+
resolve(process.cwd(), ".."),
|
|
113
|
+
resolve(process.cwd(), "../.."),
|
|
114
|
+
resolve(process.cwd(), "../../.."),
|
|
115
|
+
];
|
|
116
|
+
|
|
117
|
+
for (const root of possibleRoots) {
|
|
118
|
+
const potentialEnvPath = join(root, envFileName);
|
|
119
|
+
if (existsSync(potentialEnvPath)) {
|
|
120
|
+
envPath = potentialEnvPath;
|
|
121
|
+
projectRoot = root;
|
|
122
|
+
break;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// Load the .env file if found
|
|
128
|
+
if (envPath) {
|
|
129
|
+
config({ path: envPath, quiet: true });
|
|
130
|
+
} else {
|
|
131
|
+
// Fallback to default dotenv behavior
|
|
132
|
+
config({ quiet: true });
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// Determine platform based on detection
|
|
136
|
+
const platform = isPackage ? Platform.CLI_PACKAGE : Platform.CLI;
|
|
137
|
+
|
|
138
|
+
// Cache and return result
|
|
139
|
+
cachedEnvironmentResult = {
|
|
140
|
+
platform,
|
|
141
|
+
envPath,
|
|
142
|
+
projectRoot,
|
|
143
|
+
isPackage,
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
return cachedEnvironmentResult;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Get the cached environment result
|
|
151
|
+
* Must be called after loadEnvironment()
|
|
152
|
+
*/
|
|
153
|
+
export function getEnvironmentResult(): EnvironmentResult | null {
|
|
154
|
+
return cachedEnvironmentResult;
|
|
155
|
+
}
|
|
@@ -0,0 +1,452 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Production-ready error handling for Vibe CLI
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import type { EndpointLogger } from "../../shared/logger/endpoint";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Error context type
|
|
9
|
+
*/
|
|
10
|
+
interface ErrorContext {
|
|
11
|
+
[key: string]:
|
|
12
|
+
| string
|
|
13
|
+
| number
|
|
14
|
+
| boolean
|
|
15
|
+
| string[]
|
|
16
|
+
| undefined
|
|
17
|
+
| Record<string, never>;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Unknown error type for error handling
|
|
22
|
+
*/
|
|
23
|
+
type UnknownError = Error | CliError | Record<string, never>;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Base CLI error class
|
|
27
|
+
*/
|
|
28
|
+
export abstract class CliError extends Error {
|
|
29
|
+
abstract readonly code: string;
|
|
30
|
+
abstract readonly statusCode: number;
|
|
31
|
+
readonly timestamp: Date;
|
|
32
|
+
readonly context?: ErrorContext;
|
|
33
|
+
|
|
34
|
+
constructor(message: string, context?: ErrorContext) {
|
|
35
|
+
super(message);
|
|
36
|
+
this.name = this.constructor.name;
|
|
37
|
+
this.timestamp = new Date();
|
|
38
|
+
this.context = context;
|
|
39
|
+
|
|
40
|
+
// Maintain proper stack trace
|
|
41
|
+
if (Error.captureStackTrace) {
|
|
42
|
+
Error.captureStackTrace(this, this.constructor);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Safely get a string value from context
|
|
48
|
+
*/
|
|
49
|
+
protected getContextString(key: string, fallback = "unknown"): string {
|
|
50
|
+
const value = this.context?.[key];
|
|
51
|
+
if (typeof value === "string") {
|
|
52
|
+
return value;
|
|
53
|
+
}
|
|
54
|
+
if (typeof value === "number" || typeof value === "boolean") {
|
|
55
|
+
return String(value);
|
|
56
|
+
}
|
|
57
|
+
return fallback;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Convert error to JSON for logging/serialization
|
|
62
|
+
*/
|
|
63
|
+
toJSON(): Record<string, string | number | ErrorContext | undefined> {
|
|
64
|
+
return {
|
|
65
|
+
name: this.name,
|
|
66
|
+
code: this.code,
|
|
67
|
+
message: this.message,
|
|
68
|
+
statusCode: this.statusCode,
|
|
69
|
+
timestamp: this.timestamp.toISOString(),
|
|
70
|
+
context: this.context,
|
|
71
|
+
stack: this.stack,
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Get user-friendly error message
|
|
77
|
+
*/
|
|
78
|
+
getUserMessage(): string {
|
|
79
|
+
return this.message;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Command not found error
|
|
85
|
+
*/
|
|
86
|
+
export class CommandNotFoundError extends CliError {
|
|
87
|
+
readonly code = "COMMAND_NOT_FOUND";
|
|
88
|
+
readonly statusCode = 404;
|
|
89
|
+
|
|
90
|
+
constructor(command: string, availableCommands?: string[]) {
|
|
91
|
+
// eslint-disable-next-line i18next/no-literal-string
|
|
92
|
+
const message = `Command '${command}' not found`;
|
|
93
|
+
super(message, { command, availableCommands });
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
getUserMessage(): string {
|
|
97
|
+
// Type guard for availableCommands
|
|
98
|
+
const commands = this.context?.availableCommands;
|
|
99
|
+
const isStringArray =
|
|
100
|
+
Array.isArray(commands) &&
|
|
101
|
+
commands.every((cmd) => typeof cmd === "string");
|
|
102
|
+
|
|
103
|
+
/* eslint-disable i18next/no-literal-string */
|
|
104
|
+
const suggestions = isStringArray
|
|
105
|
+
? `\n\nAvailable commands:\n${commands
|
|
106
|
+
.slice(0, 10)
|
|
107
|
+
.map((cmd) => ` - ${cmd}`)
|
|
108
|
+
.join("\n")}`
|
|
109
|
+
: "";
|
|
110
|
+
|
|
111
|
+
return `❌ ${this.message}${suggestions}`;
|
|
112
|
+
/* eslint-enable i18next/no-literal-string */
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Route execution error
|
|
118
|
+
*/
|
|
119
|
+
export class RouteExecutionError extends CliError {
|
|
120
|
+
readonly code = "ROUTE_EXECUTION_ERROR";
|
|
121
|
+
readonly statusCode = 500;
|
|
122
|
+
|
|
123
|
+
constructor(route: string, originalError: Error, context?: ErrorContext) {
|
|
124
|
+
// eslint-disable-next-line i18next/no-literal-string
|
|
125
|
+
const message = `Failed to execute route '${route}': ${originalError.message}`;
|
|
126
|
+
super(message, { route, originalError: originalError.message, ...context });
|
|
127
|
+
|
|
128
|
+
// Preserve original stack trace
|
|
129
|
+
if (originalError.stack) {
|
|
130
|
+
this.stack = originalError.stack;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
getUserMessage(): string {
|
|
135
|
+
const route = this.getContextString("route");
|
|
136
|
+
const error = this.getContextString("originalError");
|
|
137
|
+
// eslint-disable-next-line i18next/no-literal-string
|
|
138
|
+
return `❌ Route execution failed: ${route}\n ${error}`;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Validation error
|
|
144
|
+
*/
|
|
145
|
+
export class ValidationError extends CliError {
|
|
146
|
+
readonly code = "VALIDATION_ERROR";
|
|
147
|
+
readonly statusCode = 400;
|
|
148
|
+
|
|
149
|
+
constructor(
|
|
150
|
+
field: string,
|
|
151
|
+
value: string | number | boolean | undefined,
|
|
152
|
+
expectedType: string,
|
|
153
|
+
details?: string,
|
|
154
|
+
) {
|
|
155
|
+
// eslint-disable-next-line i18next/no-literal-string
|
|
156
|
+
const message = `Validation failed for field '${field}': expected ${expectedType}, got ${typeof value}`;
|
|
157
|
+
super(message, { field, value, expectedType, details });
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
getUserMessage(): string {
|
|
161
|
+
const field = this.getContextString("field");
|
|
162
|
+
const expectedType = this.getContextString("expectedType");
|
|
163
|
+
const detailsValue = this.getContextString("details", "");
|
|
164
|
+
// eslint-disable-next-line i18next/no-literal-string
|
|
165
|
+
const details = detailsValue ? ` (${detailsValue})` : "";
|
|
166
|
+
// eslint-disable-next-line i18next/no-literal-string
|
|
167
|
+
return `❌ Invalid input for '${field}': expected ${expectedType}${details}`;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Configuration error
|
|
173
|
+
*/
|
|
174
|
+
export class ConfigurationError extends CliError {
|
|
175
|
+
readonly code = "CONFIGURATION_ERROR";
|
|
176
|
+
readonly statusCode = 500;
|
|
177
|
+
|
|
178
|
+
constructor(configKey: string, issue: string, context?: ErrorContext) {
|
|
179
|
+
// eslint-disable-next-line i18next/no-literal-string
|
|
180
|
+
const message = `Configuration error for '${configKey}': ${issue}`;
|
|
181
|
+
super(message, { configKey, issue, ...context });
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
getUserMessage(): string {
|
|
185
|
+
const issue = this.getContextString("issue");
|
|
186
|
+
// eslint-disable-next-line i18next/no-literal-string
|
|
187
|
+
return `❌ Configuration error: ${issue}`;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* Route discovery error
|
|
193
|
+
*/
|
|
194
|
+
export class RouteDiscoveryError extends CliError {
|
|
195
|
+
readonly code = "ROUTE_DISCOVERY_ERROR";
|
|
196
|
+
readonly statusCode = 500;
|
|
197
|
+
|
|
198
|
+
constructor(directory: string, originalError: Error) {
|
|
199
|
+
// eslint-disable-next-line i18next/no-literal-string
|
|
200
|
+
const message = `Failed to discover routes in '${directory}': ${originalError.message}`;
|
|
201
|
+
super(message, { directory, originalError: originalError.message });
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
getUserMessage(): string {
|
|
205
|
+
const directory = this.getContextString("directory");
|
|
206
|
+
// eslint-disable-next-line i18next/no-literal-string
|
|
207
|
+
return `❌ Failed to discover routes in: ${directory}`;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Timeout error
|
|
213
|
+
*/
|
|
214
|
+
export class TimeoutError extends CliError {
|
|
215
|
+
readonly code = "TIMEOUT_ERROR";
|
|
216
|
+
readonly statusCode = 408;
|
|
217
|
+
|
|
218
|
+
constructor(operation: string, timeout: number) {
|
|
219
|
+
// eslint-disable-next-line i18next/no-literal-string
|
|
220
|
+
const message = `Operation '${operation}' timed out after ${timeout}ms`;
|
|
221
|
+
super(message, { operation, timeout });
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
getUserMessage(): string {
|
|
225
|
+
const operation = this.getContextString("operation");
|
|
226
|
+
const timeout = this.getContextString("timeout");
|
|
227
|
+
// eslint-disable-next-line i18next/no-literal-string
|
|
228
|
+
return `❌ Operation timed out: ${operation} (${timeout}ms)`;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* Permission error
|
|
234
|
+
*/
|
|
235
|
+
export class PermissionError extends CliError {
|
|
236
|
+
readonly code = "PERMISSION_ERROR";
|
|
237
|
+
readonly statusCode = 403;
|
|
238
|
+
|
|
239
|
+
constructor(resource: string, action: string, context?: ErrorContext) {
|
|
240
|
+
// eslint-disable-next-line i18next/no-literal-string
|
|
241
|
+
const message = `Permission denied: cannot ${action} ${resource}`;
|
|
242
|
+
super(message, { resource, action, ...context });
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
getUserMessage(): string {
|
|
246
|
+
const action = this.getContextString("action");
|
|
247
|
+
const resource = this.getContextString("resource");
|
|
248
|
+
// eslint-disable-next-line i18next/no-literal-string
|
|
249
|
+
return `❌ Permission denied: cannot ${action} ${resource}`;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* Resource not found error
|
|
255
|
+
*/
|
|
256
|
+
export class ResourceNotFoundError extends CliError {
|
|
257
|
+
readonly code = "RESOURCE_NOT_FOUND";
|
|
258
|
+
readonly statusCode = 404;
|
|
259
|
+
|
|
260
|
+
constructor(
|
|
261
|
+
resourceType: string,
|
|
262
|
+
identifier: string,
|
|
263
|
+
context?: ErrorContext,
|
|
264
|
+
) {
|
|
265
|
+
// eslint-disable-next-line i18next/no-literal-string
|
|
266
|
+
const message = `${resourceType} '${identifier}' not found`;
|
|
267
|
+
super(message, { resourceType, identifier, ...context });
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
getUserMessage(): string {
|
|
271
|
+
// eslint-disable-next-line i18next/no-literal-string
|
|
272
|
+
const resourceType = this.getContextString("resourceType", "Resource");
|
|
273
|
+
const identifier = this.getContextString("identifier");
|
|
274
|
+
// eslint-disable-next-line i18next/no-literal-string
|
|
275
|
+
return `❌ ${resourceType} not found: ${identifier}`;
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
* Error handler utility
|
|
281
|
+
*/
|
|
282
|
+
export namespace ErrorHandler {
|
|
283
|
+
/**
|
|
284
|
+
* Safely convert error to string
|
|
285
|
+
*/
|
|
286
|
+
function errorToString(error: UnknownError): string {
|
|
287
|
+
if (error instanceof Error) {
|
|
288
|
+
return error.message;
|
|
289
|
+
}
|
|
290
|
+
if (typeof error === "string") {
|
|
291
|
+
return error;
|
|
292
|
+
}
|
|
293
|
+
if (typeof error === "object" && error !== null) {
|
|
294
|
+
return JSON.stringify(error);
|
|
295
|
+
}
|
|
296
|
+
return String(error);
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* Handle and format error for CLI output
|
|
301
|
+
*/
|
|
302
|
+
export function handleError(
|
|
303
|
+
error: UnknownError,
|
|
304
|
+
logger: EndpointLogger,
|
|
305
|
+
): {
|
|
306
|
+
message: string;
|
|
307
|
+
exitCode: number;
|
|
308
|
+
shouldExit: boolean;
|
|
309
|
+
} {
|
|
310
|
+
if (error instanceof CliError) {
|
|
311
|
+
return {
|
|
312
|
+
message: logger.isDebugEnabled
|
|
313
|
+
? formatVerboseError(error)
|
|
314
|
+
: error.getUserMessage(),
|
|
315
|
+
exitCode: getExitCode(error.statusCode),
|
|
316
|
+
shouldExit: true,
|
|
317
|
+
};
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
if (error instanceof Error) {
|
|
321
|
+
const cliError = new RouteExecutionError("unknown", error);
|
|
322
|
+
return {
|
|
323
|
+
message: logger.isDebugEnabled
|
|
324
|
+
? formatVerboseError(cliError)
|
|
325
|
+
: cliError.getUserMessage(),
|
|
326
|
+
exitCode: 1,
|
|
327
|
+
shouldExit: true,
|
|
328
|
+
};
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
// Unknown error type
|
|
332
|
+
// eslint-disable-next-line i18next/no-literal-string
|
|
333
|
+
const message = `❌ Unknown error: ${errorToString(error)}`;
|
|
334
|
+
return {
|
|
335
|
+
message: logger.isDebugEnabled
|
|
336
|
+
? // eslint-disable-next-line i18next/no-literal-string
|
|
337
|
+
`${message}\n${JSON.stringify(error, null, 2)}`
|
|
338
|
+
: message,
|
|
339
|
+
exitCode: 1,
|
|
340
|
+
shouldExit: true,
|
|
341
|
+
};
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
/**
|
|
345
|
+
* Format error with full details for verbose output
|
|
346
|
+
*/
|
|
347
|
+
function formatVerboseError(error: CliError): string {
|
|
348
|
+
// eslint-disable-next-line i18next/no-literal-string
|
|
349
|
+
let output = `❌ ${error.name}: ${error.message}\n`;
|
|
350
|
+
// eslint-disable-next-line i18next/no-literal-string
|
|
351
|
+
output += ` Code: ${error.code}\n`;
|
|
352
|
+
// eslint-disable-next-line i18next/no-literal-string
|
|
353
|
+
output += ` Status: ${error.statusCode}\n`;
|
|
354
|
+
// eslint-disable-next-line i18next/no-literal-string
|
|
355
|
+
output += ` Time: ${error.timestamp.toISOString()}\n`;
|
|
356
|
+
|
|
357
|
+
if (error.context && Object.keys(error.context).length > 0) {
|
|
358
|
+
// eslint-disable-next-line i18next/no-literal-string
|
|
359
|
+
output += ` Context: ${JSON.stringify(error.context, null, 4)}\n`;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
if (error.stack) {
|
|
363
|
+
// eslint-disable-next-line i18next/no-literal-string
|
|
364
|
+
output += ` Stack Trace:\n${error.stack}`;
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
return output;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
/**
|
|
371
|
+
* Convert HTTP status code to process exit code
|
|
372
|
+
*/
|
|
373
|
+
function getExitCode(statusCode: number): number {
|
|
374
|
+
if (statusCode >= 400 && statusCode < 500) {
|
|
375
|
+
return 2; // Client error
|
|
376
|
+
}
|
|
377
|
+
if (statusCode >= 500) {
|
|
378
|
+
return 3; // Server error
|
|
379
|
+
}
|
|
380
|
+
return 1; // General error
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
/**
|
|
384
|
+
* Create error from unknown value
|
|
385
|
+
*/
|
|
386
|
+
export function createError(
|
|
387
|
+
error: UnknownError,
|
|
388
|
+
context?: ErrorContext,
|
|
389
|
+
): CliError {
|
|
390
|
+
if (error instanceof CliError) {
|
|
391
|
+
return error;
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
if (error instanceof Error) {
|
|
395
|
+
return new RouteExecutionError("unknown", error, context);
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
return new RouteExecutionError(
|
|
399
|
+
"unknown",
|
|
400
|
+
new Error(errorToString(error)),
|
|
401
|
+
context,
|
|
402
|
+
);
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
/**
|
|
406
|
+
* Wrap async function with error handling
|
|
407
|
+
*/
|
|
408
|
+
export async function withErrorHandling<T>(
|
|
409
|
+
fn: () => Promise<T>,
|
|
410
|
+
context?: ErrorContext,
|
|
411
|
+
): Promise<T> {
|
|
412
|
+
try {
|
|
413
|
+
return await fn();
|
|
414
|
+
} catch (error) {
|
|
415
|
+
// eslint-disable-next-line oxlint-plugin-restricted/restricted-syntax -- Infrastructure code requires throwing for system-level errors and initialization failures
|
|
416
|
+
throw createError(error as UnknownError, context);
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
/**
|
|
421
|
+
* Check if error is recoverable
|
|
422
|
+
*/
|
|
423
|
+
export function isRecoverable(error: CliError): boolean {
|
|
424
|
+
const recoverableCodes = [
|
|
425
|
+
"VALIDATION_ERROR",
|
|
426
|
+
"COMMAND_NOT_FOUND",
|
|
427
|
+
"RESOURCE_NOT_FOUND",
|
|
428
|
+
];
|
|
429
|
+
|
|
430
|
+
return recoverableCodes.includes(error.code);
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
/**
|
|
435
|
+
* Global error handler for unhandled errors
|
|
436
|
+
*/
|
|
437
|
+
export function setupGlobalErrorHandlers(logger: EndpointLogger): void {
|
|
438
|
+
process.on("uncaughtException", (error: Error): void => {
|
|
439
|
+
const handled = ErrorHandler.handleError(error, logger);
|
|
440
|
+
logger.error(handled.message);
|
|
441
|
+
process.exit(handled.exitCode);
|
|
442
|
+
});
|
|
443
|
+
|
|
444
|
+
process.on(
|
|
445
|
+
"unhandledRejection",
|
|
446
|
+
(reason: Error | Record<string, never>): void => {
|
|
447
|
+
const handled = ErrorHandler.handleError(reason, logger);
|
|
448
|
+
logger.error(handled.message);
|
|
449
|
+
process.exit(handled.exitCode);
|
|
450
|
+
},
|
|
451
|
+
);
|
|
452
|
+
}
|