@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,291 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Metric Widget Renderer
|
|
3
|
+
* Handles METRIC_CARD widget type for displaying key metrics and statistics
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import type { UnifiedField } from "@/app/api/[locale]/system/unified-interface/shared/types/endpoint";
|
|
7
|
+
import { WidgetType } from "@/app/api/[locale]/system/unified-interface/shared/types/enums";
|
|
8
|
+
import type { MetricCardWidgetConfig } from "@/app/api/[locale]/system/unified-interface/shared/widgets/configs";
|
|
9
|
+
import {
|
|
10
|
+
extractMetricCardData,
|
|
11
|
+
formatMetricValue,
|
|
12
|
+
} from "@/app/api/[locale]/system/unified-interface/shared/widgets/logic/metric-card";
|
|
13
|
+
import type { WidgetData } from "@/app/api/[locale]/system/unified-interface/shared/widgets/types";
|
|
14
|
+
|
|
15
|
+
import { BaseWidgetRenderer } from "../core/base-renderer";
|
|
16
|
+
import type { CLIWidgetProps, WidgetRenderContext } from "../core/types";
|
|
17
|
+
|
|
18
|
+
export class MetricWidgetRenderer extends BaseWidgetRenderer<
|
|
19
|
+
typeof WidgetType.METRIC_CARD
|
|
20
|
+
> {
|
|
21
|
+
readonly widgetType = WidgetType.METRIC_CARD;
|
|
22
|
+
|
|
23
|
+
render(props: CLIWidgetProps<typeof WidgetType.METRIC_CARD, string>): string {
|
|
24
|
+
const { field, value, context } = props;
|
|
25
|
+
const config = this.getMetricConfig(field);
|
|
26
|
+
const indent = this.createIndent(context.depth, context);
|
|
27
|
+
|
|
28
|
+
// Try to extract using shared logic for standard metric card format
|
|
29
|
+
const data = extractMetricCardData(value);
|
|
30
|
+
|
|
31
|
+
if (data) {
|
|
32
|
+
// Use extracted data for standard metric card
|
|
33
|
+
const formattedValue = formatMetricValue(data.value);
|
|
34
|
+
const icon =
|
|
35
|
+
context.options.useEmojis && data.icon ? `${data.icon} ` : "";
|
|
36
|
+
return `${indent}${icon}${data.label}: ${formattedValue}`;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// Fallback to existing logic for non-standard formats
|
|
40
|
+
if (typeof value === "object" && value !== null && !Array.isArray(value)) {
|
|
41
|
+
return this.renderMetricObject(value, config, context, indent);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const label = this.formatLabel(field, context);
|
|
45
|
+
const formattedValue = this.formatMetricValueLocal(value, config, context);
|
|
46
|
+
const icon = this.getMetricIcon(config, value, context);
|
|
47
|
+
|
|
48
|
+
return `${indent}${icon}${label}: ${formattedValue}`;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
private renderMetricObject<const TKey extends string>(
|
|
52
|
+
value: { [key: string]: WidgetData },
|
|
53
|
+
config: Pick<
|
|
54
|
+
MetricCardWidgetConfig<TKey>,
|
|
55
|
+
"icon" | "unit" | "precision" | "threshold" | "format"
|
|
56
|
+
>,
|
|
57
|
+
context: WidgetRenderContext,
|
|
58
|
+
indent: string,
|
|
59
|
+
): string {
|
|
60
|
+
const lines: string[] = [];
|
|
61
|
+
|
|
62
|
+
// Special handling for lint summary object
|
|
63
|
+
if ("total" in value && "errors" in value && "warnings" in value) {
|
|
64
|
+
return this.renderLintSummary(value, context, indent);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// Generic object rendering
|
|
68
|
+
for (const [key, val] of Object.entries(value)) {
|
|
69
|
+
if (
|
|
70
|
+
typeof val === "string" ||
|
|
71
|
+
typeof val === "number" ||
|
|
72
|
+
typeof val === "boolean"
|
|
73
|
+
) {
|
|
74
|
+
const formattedKey = key.charAt(0).toUpperCase() + key.slice(1);
|
|
75
|
+
const formattedValue = this.formatMetricValueLocal(
|
|
76
|
+
val,
|
|
77
|
+
config,
|
|
78
|
+
context,
|
|
79
|
+
);
|
|
80
|
+
const icon = this.getMetricIcon(config, val, context);
|
|
81
|
+
lines.push(`${indent}${icon}${formattedKey}: ${formattedValue}`);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return lines.join("\n");
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
private renderLintSummary(
|
|
89
|
+
summary: { [key: string]: WidgetData },
|
|
90
|
+
context: WidgetRenderContext,
|
|
91
|
+
indent: string,
|
|
92
|
+
): string {
|
|
93
|
+
const errors = Number(summary.errors || 0);
|
|
94
|
+
const warnings = Number(summary.warnings || 0);
|
|
95
|
+
const info = Number(summary.info || 0);
|
|
96
|
+
const hasIssues = Boolean(summary.hasIssues);
|
|
97
|
+
if (!hasIssues) {
|
|
98
|
+
// eslint-disable-next-line i18next/no-literal-string
|
|
99
|
+
const icon = context.options.useEmojis ? "⨠" : "";
|
|
100
|
+
const text = context.t(
|
|
101
|
+
"app.api.system.unifiedInterface.cli.vibe.endpoints.renderers.cliUi.widgets.common.noIssuesFound",
|
|
102
|
+
);
|
|
103
|
+
return `${indent}${icon}${this.styleText(text, "green", context)}`;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
const parts: string[] = [];
|
|
107
|
+
|
|
108
|
+
if (errors > 0) {
|
|
109
|
+
// eslint-disable-next-line i18next/no-literal-string
|
|
110
|
+
const icon = context.options.useEmojis ? "â " : "";
|
|
111
|
+
const errorWord =
|
|
112
|
+
errors === 1
|
|
113
|
+
? context.t(
|
|
114
|
+
"app.api.system.unifiedInterface.cli.vibe.endpoints.renderers.cliUi.widgets.common.error",
|
|
115
|
+
)
|
|
116
|
+
: context.t(
|
|
117
|
+
"app.api.system.unifiedInterface.cli.vibe.endpoints.renderers.cliUi.widgets.common.errors",
|
|
118
|
+
);
|
|
119
|
+
const text = `${errors} ${errorWord}`;
|
|
120
|
+
parts.push(`${indent}${icon}${this.styleText(text, "red", context)}`);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
if (warnings > 0) {
|
|
124
|
+
// eslint-disable-next-line i18next/no-literal-string
|
|
125
|
+
const icon = context.options.useEmojis ? "â " : "";
|
|
126
|
+
const warningWord =
|
|
127
|
+
warnings === 1
|
|
128
|
+
? context.t(
|
|
129
|
+
"app.api.system.unifiedInterface.cli.vibe.endpoints.renderers.cliUi.widgets.common.warning",
|
|
130
|
+
)
|
|
131
|
+
: context.t(
|
|
132
|
+
"app.api.system.unifiedInterface.cli.vibe.endpoints.renderers.cliUi.widgets.common.warnings",
|
|
133
|
+
);
|
|
134
|
+
const text = `${warnings} ${warningWord}`;
|
|
135
|
+
parts.push(`${indent}${icon}${this.styleText(text, "yellow", context)}`);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
if (info > 0) {
|
|
139
|
+
// eslint-disable-next-line i18next/no-literal-string
|
|
140
|
+
const icon = context.options.useEmojis ? "âš " : "";
|
|
141
|
+
const text = `${info} ${context.t("app.api.system.unifiedInterface.cli.vibe.endpoints.renderers.cliUi.widgets.common.info")}`;
|
|
142
|
+
parts.push(`${indent}${icon}${this.styleText(text, "blue", context)}`);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
return parts.join("\n");
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
private getMetricConfig<const TKey extends string>(
|
|
149
|
+
field: UnifiedField<TKey>,
|
|
150
|
+
): Pick<
|
|
151
|
+
MetricCardWidgetConfig<TKey>,
|
|
152
|
+
"icon" | "unit" | "precision" | "threshold" | "format"
|
|
153
|
+
> {
|
|
154
|
+
if (field.ui.type !== WidgetType.METRIC_CARD) {
|
|
155
|
+
return {
|
|
156
|
+
format: "number",
|
|
157
|
+
precision: 2,
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
const config = field.ui;
|
|
162
|
+
|
|
163
|
+
const formatValue =
|
|
164
|
+
typeof config.format === "string" ? config.format : "number";
|
|
165
|
+
const validFormats = ["bytes", "currency", "number", "percentage"] as const;
|
|
166
|
+
const format: "bytes" | "currency" | "number" | "percentage" =
|
|
167
|
+
validFormats.includes(formatValue as (typeof validFormats)[number])
|
|
168
|
+
? (formatValue as (typeof validFormats)[number])
|
|
169
|
+
: "number";
|
|
170
|
+
|
|
171
|
+
return {
|
|
172
|
+
icon: typeof config.icon === "string" ? config.icon : undefined,
|
|
173
|
+
unit: typeof config.unit === "string" ? config.unit : undefined,
|
|
174
|
+
precision: typeof config.precision === "number" ? config.precision : 2,
|
|
175
|
+
threshold:
|
|
176
|
+
config.threshold && typeof config.threshold === "object"
|
|
177
|
+
? (config.threshold as { warning?: number; error?: number })
|
|
178
|
+
: undefined,
|
|
179
|
+
format,
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
private formatMetricValueLocal<const TKey extends string>(
|
|
184
|
+
value: WidgetData,
|
|
185
|
+
config: Pick<
|
|
186
|
+
MetricCardWidgetConfig<TKey>,
|
|
187
|
+
"icon" | "unit" | "precision" | "threshold" | "format"
|
|
188
|
+
>,
|
|
189
|
+
context: WidgetRenderContext,
|
|
190
|
+
): string {
|
|
191
|
+
if (
|
|
192
|
+
typeof value !== "string" &&
|
|
193
|
+
typeof value !== "number" &&
|
|
194
|
+
typeof value !== "boolean"
|
|
195
|
+
) {
|
|
196
|
+
return String(value);
|
|
197
|
+
}
|
|
198
|
+
if (typeof value !== "number") {
|
|
199
|
+
return String(value);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
let formatted: string;
|
|
203
|
+
|
|
204
|
+
switch (config.format) {
|
|
205
|
+
case "percentage":
|
|
206
|
+
formatted = `${(value * 100).toFixed(config.precision)}%`;
|
|
207
|
+
break;
|
|
208
|
+
case "currency":
|
|
209
|
+
// eslint-disable-next-line i18next/no-literal-string
|
|
210
|
+
formatted = `$${value.toFixed(config.precision)}`;
|
|
211
|
+
break;
|
|
212
|
+
case "bytes":
|
|
213
|
+
formatted = this.formatBytes(value);
|
|
214
|
+
break;
|
|
215
|
+
default:
|
|
216
|
+
// For integer values (like counts), don't show decimal places
|
|
217
|
+
if (Number.isInteger(value) && config.precision === 2) {
|
|
218
|
+
formatted = value.toString();
|
|
219
|
+
} else {
|
|
220
|
+
formatted = value.toFixed(config.precision);
|
|
221
|
+
}
|
|
222
|
+
if (config.unit) {
|
|
223
|
+
formatted += ` ${config.unit}`;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
// Apply threshold-based styling
|
|
228
|
+
if (config.threshold && context.options.useColors) {
|
|
229
|
+
if (config.threshold.error && value >= config.threshold.error) {
|
|
230
|
+
return this.styleText(formatted, "red", context);
|
|
231
|
+
}
|
|
232
|
+
if (config.threshold.warning && value >= config.threshold.warning) {
|
|
233
|
+
return this.styleText(formatted, "yellow", context);
|
|
234
|
+
}
|
|
235
|
+
return this.styleText(formatted, "green", context);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
return formatted;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
private getMetricIcon<const TKey extends string>(
|
|
242
|
+
config: Pick<MetricCardWidgetConfig<TKey>, "icon" | "threshold">,
|
|
243
|
+
value: WidgetData,
|
|
244
|
+
context: WidgetRenderContext,
|
|
245
|
+
): string {
|
|
246
|
+
if (
|
|
247
|
+
typeof value !== "string" &&
|
|
248
|
+
typeof value !== "number" &&
|
|
249
|
+
typeof value !== "boolean"
|
|
250
|
+
) {
|
|
251
|
+
return "";
|
|
252
|
+
}
|
|
253
|
+
if (!context.options.useEmojis) {
|
|
254
|
+
return "";
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
if (config.icon) {
|
|
258
|
+
return `${config.icon} `;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
// Default icons based on thresholds
|
|
262
|
+
if (typeof value === "number" && config.threshold) {
|
|
263
|
+
if (config.threshold.error && value >= config.threshold.error) {
|
|
264
|
+
// eslint-disable-next-line i18next/no-literal-string
|
|
265
|
+
return "đ´ ";
|
|
266
|
+
}
|
|
267
|
+
if (config.threshold.warning && value >= config.threshold.warning) {
|
|
268
|
+
// eslint-disable-next-line i18next/no-literal-string
|
|
269
|
+
return "đĄ ";
|
|
270
|
+
}
|
|
271
|
+
// eslint-disable-next-line i18next/no-literal-string
|
|
272
|
+
return "đĸ ";
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
// eslint-disable-next-line i18next/no-literal-string
|
|
276
|
+
return "đ ";
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
private formatBytes(bytes: number): string {
|
|
280
|
+
const units = ["B", "KB", "MB", "GB", "TB"];
|
|
281
|
+
let size = bytes;
|
|
282
|
+
let unitIndex = 0;
|
|
283
|
+
|
|
284
|
+
while (size >= 1024 && unitIndex < units.length - 1) {
|
|
285
|
+
size /= 1024;
|
|
286
|
+
unitIndex++;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
return `${size.toFixed(2)} ${units[unitIndex]}`;
|
|
290
|
+
}
|
|
291
|
+
}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Section Widget Renderer
|
|
3
|
+
* Handles SECTION widget type for organizing content into labeled sections
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { WidgetType } from "@/app/api/[locale]/system/unified-interface/shared/types/enums";
|
|
7
|
+
import type { WidgetData } from "@/app/api/[locale]/system/unified-interface/shared/widgets/types";
|
|
8
|
+
import { getTranslator } from "@/app/api/[locale]/system/unified-interface/shared/widgets/utils/field-helpers";
|
|
9
|
+
|
|
10
|
+
import { BaseWidgetRenderer } from "../core/base-renderer";
|
|
11
|
+
import type { CLIWidgetProps, WidgetRenderContext } from "../core/types";
|
|
12
|
+
|
|
13
|
+
export class SectionWidgetRenderer extends BaseWidgetRenderer<
|
|
14
|
+
typeof WidgetType.SECTION
|
|
15
|
+
> {
|
|
16
|
+
readonly widgetType = WidgetType.SECTION;
|
|
17
|
+
|
|
18
|
+
render(props: CLIWidgetProps<typeof WidgetType.SECTION, string>): string {
|
|
19
|
+
const { value, context } = props;
|
|
20
|
+
|
|
21
|
+
if (typeof value === "object" && value !== null && !Array.isArray(value)) {
|
|
22
|
+
return this.renderSection(value, props, context);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return JSON.stringify(value);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
private renderSection(
|
|
29
|
+
value: { [key: string]: WidgetData },
|
|
30
|
+
props: CLIWidgetProps<typeof WidgetType.SECTION, string>,
|
|
31
|
+
context: WidgetRenderContext,
|
|
32
|
+
): string {
|
|
33
|
+
const result: string[] = [];
|
|
34
|
+
const { field } = props;
|
|
35
|
+
const { title: titleKey } = field.ui;
|
|
36
|
+
const { t } = getTranslator(context);
|
|
37
|
+
|
|
38
|
+
if (this.isSectionEmpty(value)) {
|
|
39
|
+
return "";
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if (titleKey) {
|
|
43
|
+
const title = t(titleKey);
|
|
44
|
+
result.push("");
|
|
45
|
+
result.push(this.styleText(title.toUpperCase(), "bold", context));
|
|
46
|
+
result.push(this.styleText("â".repeat(50), "dim", context));
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// Render nested fields
|
|
50
|
+
for (const [key, val] of Object.entries(value)) {
|
|
51
|
+
if (val === undefined || val === null) {
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (field.type === "object" && field.children?.[key]) {
|
|
56
|
+
const childField = field.children[key];
|
|
57
|
+
const rendered = context.renderWidget(
|
|
58
|
+
childField.ui.type,
|
|
59
|
+
childField,
|
|
60
|
+
val,
|
|
61
|
+
);
|
|
62
|
+
if (rendered) {
|
|
63
|
+
result.push(rendered);
|
|
64
|
+
}
|
|
65
|
+
} else {
|
|
66
|
+
// Fallback rendering
|
|
67
|
+
result.push(this.renderSimpleField(key, val));
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return result.join("\n");
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Check if section is empty (has no meaningful content)
|
|
76
|
+
*/
|
|
77
|
+
private isSectionEmpty(value: { [key: string]: WidgetData }): boolean {
|
|
78
|
+
const entries = Object.entries(value);
|
|
79
|
+
if (entries.length === 0) {
|
|
80
|
+
return true;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// Check if all values are empty/null/undefined
|
|
84
|
+
return entries.every((entry) => {
|
|
85
|
+
const val = entry[1];
|
|
86
|
+
if (val === null || val === undefined) {
|
|
87
|
+
return true;
|
|
88
|
+
}
|
|
89
|
+
if (Array.isArray(val) && val.length === 0) {
|
|
90
|
+
return true;
|
|
91
|
+
}
|
|
92
|
+
if (typeof val === "object" && Object.keys(val).length === 0) {
|
|
93
|
+
return true;
|
|
94
|
+
}
|
|
95
|
+
return false;
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Render a simple field when no metadata is available
|
|
101
|
+
*/
|
|
102
|
+
private renderSimpleField(key: string, value: WidgetData): string {
|
|
103
|
+
if (value === null || value === undefined) {
|
|
104
|
+
return "";
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
if (Array.isArray(value)) {
|
|
108
|
+
if (value.length === 0) {
|
|
109
|
+
return "";
|
|
110
|
+
}
|
|
111
|
+
return value.map((item) => ` ${item}`).join("\n");
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
if (typeof value === "object") {
|
|
115
|
+
return JSON.stringify(value, null, 2);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
return `${key}: ${value}`;
|
|
119
|
+
}
|
|
120
|
+
}
|
package/src/app/api/[locale]/system/unified-interface/cli/widgets/implementations/stats-grid.ts
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stats Grid Widget Renderer
|
|
3
|
+
* Handles STATS_GRID widget type for displaying statistics in a grid layout
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { WidgetType } from "@/app/api/[locale]/system/unified-interface/shared/types/enums";
|
|
7
|
+
import type { WidgetData } from "@/app/api/[locale]/system/unified-interface/shared/widgets/types";
|
|
8
|
+
|
|
9
|
+
import { BaseWidgetRenderer } from "../core/base-renderer";
|
|
10
|
+
import type { CLIWidgetProps, WidgetRenderContext } from "../core/types";
|
|
11
|
+
|
|
12
|
+
export class StatsGridWidgetRenderer extends BaseWidgetRenderer<
|
|
13
|
+
typeof WidgetType.STATS_GRID
|
|
14
|
+
> {
|
|
15
|
+
readonly widgetType = WidgetType.STATS_GRID;
|
|
16
|
+
|
|
17
|
+
render(props: CLIWidgetProps<typeof WidgetType.STATS_GRID, string>): string {
|
|
18
|
+
const { field, value, context } = props;
|
|
19
|
+
const indent = this.createIndent(context.depth, context);
|
|
20
|
+
|
|
21
|
+
// Handle object with multiple stats
|
|
22
|
+
if (typeof value === "object" && value !== null && !Array.isArray(value)) {
|
|
23
|
+
return this.renderStatsGrid(value, context, indent);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// Handle single stat value
|
|
27
|
+
if (
|
|
28
|
+
typeof value === "string" ||
|
|
29
|
+
typeof value === "number" ||
|
|
30
|
+
typeof value === "boolean"
|
|
31
|
+
) {
|
|
32
|
+
const label = this.formatLabel(field, context);
|
|
33
|
+
const formattedValue = this.formatStatValue(value, context);
|
|
34
|
+
const icon = this.getStatIcon(value, context);
|
|
35
|
+
|
|
36
|
+
return `${indent}${icon}${label}: ${formattedValue}`;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const stringValue =
|
|
40
|
+
typeof value === "object" && value !== null
|
|
41
|
+
? JSON.stringify(value)
|
|
42
|
+
: String(value);
|
|
43
|
+
return `${indent}${stringValue}`;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
private renderStatsGrid(
|
|
47
|
+
value: { [key: string]: WidgetData },
|
|
48
|
+
context: WidgetRenderContext,
|
|
49
|
+
indent: string,
|
|
50
|
+
): string {
|
|
51
|
+
const lines: string[] = [];
|
|
52
|
+
const entries = Object.entries(value);
|
|
53
|
+
|
|
54
|
+
// Group stats into rows for better display
|
|
55
|
+
const columns = 3; // Display 3 stats per row
|
|
56
|
+
const rows: Array<Array<[string, WidgetData]>> = [];
|
|
57
|
+
|
|
58
|
+
for (let i = 0; i < entries.length; i += columns) {
|
|
59
|
+
rows.push(entries.slice(i, i + columns));
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
for (const row of rows) {
|
|
63
|
+
const rowItems = row
|
|
64
|
+
.filter(
|
|
65
|
+
(entry) =>
|
|
66
|
+
typeof entry[1] === "string" ||
|
|
67
|
+
typeof entry[1] === "number" ||
|
|
68
|
+
typeof entry[1] === "boolean",
|
|
69
|
+
)
|
|
70
|
+
.map(([key, val]) => {
|
|
71
|
+
const formattedValue = this.formatStatValue(val, context);
|
|
72
|
+
const icon = this.getStatIcon(val, context);
|
|
73
|
+
const label = this.formatStatLabel(key);
|
|
74
|
+
return `${icon}${label}: ${formattedValue}`;
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
// Pad items to ensure consistent spacing
|
|
78
|
+
const paddedItems = rowItems.map((item) => item.padEnd(25));
|
|
79
|
+
lines.push(`${indent}${paddedItems.join(" ")}`);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return lines.join("\n");
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
private formatStatValue(
|
|
86
|
+
value: WidgetData,
|
|
87
|
+
context: WidgetRenderContext,
|
|
88
|
+
): string {
|
|
89
|
+
if (typeof value === "number") {
|
|
90
|
+
// Format large numbers with commas
|
|
91
|
+
if (value >= 1000) {
|
|
92
|
+
return value.toLocaleString();
|
|
93
|
+
}
|
|
94
|
+
return value.toString();
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
if (typeof value === "string") {
|
|
98
|
+
return value;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
if (Array.isArray(value)) {
|
|
102
|
+
const itemsText = context.t(
|
|
103
|
+
"app.api.system.unifiedInterface.cli.vibe.endpoints.renderers.cliUi.widgets.common.items",
|
|
104
|
+
);
|
|
105
|
+
return `[${value.length} ${itemsText}]`;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
if (typeof value === "object" && value !== null) {
|
|
109
|
+
const keyCount = String(Object.keys(value).length);
|
|
110
|
+
return `{${keyCount}}`;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
return String(value);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
private formatStatLabel(key: string): string {
|
|
117
|
+
// Convert camelCase to readable format
|
|
118
|
+
const spaced = key.replaceAll(/([A-Z])/g, (match) => ` ${match}`);
|
|
119
|
+
return spaced.replace(/^./, (str) => str.toUpperCase()).trim();
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
private getStatIcon(value: WidgetData, context: WidgetRenderContext): string {
|
|
123
|
+
if (typeof value === "number") {
|
|
124
|
+
if (value === 0) {
|
|
125
|
+
// eslint-disable-next-line i18next/no-literal-string
|
|
126
|
+
return context.options.useColors ? "âĒ " : "â ";
|
|
127
|
+
}
|
|
128
|
+
if (value > 0) {
|
|
129
|
+
// eslint-disable-next-line i18next/no-literal-string
|
|
130
|
+
return context.options.useColors ? "đĸ " : "â ";
|
|
131
|
+
}
|
|
132
|
+
// eslint-disable-next-line i18next/no-literal-string
|
|
133
|
+
return context.options.useColors ? "đ´ " : "â ";
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
if (Array.isArray(value)) {
|
|
137
|
+
// eslint-disable-next-line i18next/no-literal-string
|
|
138
|
+
return context.options.useColors ? "đ " : "⥠";
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
if (typeof value === "object" && value !== null) {
|
|
142
|
+
// eslint-disable-next-line i18next/no-literal-string
|
|
143
|
+
return context.options.useColors ? "đ " : "â ";
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// eslint-disable-next-line i18next/no-literal-string
|
|
147
|
+
return context.options.useColors ? "âšī¸ " : "i ";
|
|
148
|
+
}
|
|
149
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tabs Widget Renderer
|
|
3
|
+
* Handles TABS widget type for CLI display
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { WidgetType } from "@/app/api/[locale]/system/unified-interface/shared/types/enums";
|
|
7
|
+
import {
|
|
8
|
+
extractTabsData,
|
|
9
|
+
getActiveTab,
|
|
10
|
+
} from "@/app/api/[locale]/system/unified-interface/shared/widgets/logic/tabs";
|
|
11
|
+
|
|
12
|
+
import { BaseWidgetRenderer } from "../core/base-renderer";
|
|
13
|
+
import type { CLIWidgetProps } from "../core/types";
|
|
14
|
+
|
|
15
|
+
export class TabsWidgetRenderer extends BaseWidgetRenderer<
|
|
16
|
+
typeof WidgetType.TABS
|
|
17
|
+
> {
|
|
18
|
+
readonly widgetType = WidgetType.TABS;
|
|
19
|
+
|
|
20
|
+
render(props: CLIWidgetProps<typeof WidgetType.TABS, string>): string {
|
|
21
|
+
const { value, context } = props;
|
|
22
|
+
const indent = this.createIndent(context.depth, context);
|
|
23
|
+
|
|
24
|
+
// Extract data using shared logic
|
|
25
|
+
const data = extractTabsData(value);
|
|
26
|
+
|
|
27
|
+
// Handle null case
|
|
28
|
+
if (!data) {
|
|
29
|
+
return `${indent}â`;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const lines: string[] = [];
|
|
33
|
+
|
|
34
|
+
// Tab headers
|
|
35
|
+
const headers = data.tabs.map((tab) => {
|
|
36
|
+
const isActive = tab.id === data.activeTab;
|
|
37
|
+
const label = tab.disabled
|
|
38
|
+
? this.styleText(tab.label, "dim", context)
|
|
39
|
+
: isActive
|
|
40
|
+
? this.styleText(tab.label, "bold", context)
|
|
41
|
+
: tab.label;
|
|
42
|
+
|
|
43
|
+
return isActive ? `[${label}]` : ` ${label} `;
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
lines.push(`${indent}${headers.join(" ")}`);
|
|
47
|
+
lines.push(`${indent}${this.createSeparator(60)}`);
|
|
48
|
+
|
|
49
|
+
// Active tab content
|
|
50
|
+
const activeTab = getActiveTab(data);
|
|
51
|
+
if (activeTab && activeTab.content !== null) {
|
|
52
|
+
const contentStr =
|
|
53
|
+
typeof activeTab.content === "string"
|
|
54
|
+
? activeTab.content
|
|
55
|
+
: JSON.stringify(activeTab.content);
|
|
56
|
+
lines.push(`${indent}${contentStr}`);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return lines.join("\n");
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Text Widget Renderer
|
|
3
|
+
* Handles TEXT widget type with various formatting options
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { WidgetType } from "@/app/api/[locale]/system/unified-interface/shared/types/enums";
|
|
7
|
+
import { extractTextData } from "@/app/api/[locale]/system/unified-interface/shared/widgets/logic/text";
|
|
8
|
+
|
|
9
|
+
import { BaseWidgetRenderer } from "../core/base-renderer";
|
|
10
|
+
import type { CLIWidgetProps, WidgetRenderContext } from "../core/types";
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Renders TEXT widgets with formatting options.
|
|
14
|
+
*/
|
|
15
|
+
export class TextWidgetRenderer extends BaseWidgetRenderer<
|
|
16
|
+
typeof WidgetType.TEXT
|
|
17
|
+
> {
|
|
18
|
+
readonly widgetType = WidgetType.TEXT;
|
|
19
|
+
|
|
20
|
+
render(props: CLIWidgetProps<typeof WidgetType.TEXT, string>): string {
|
|
21
|
+
const { field, value, context } = props;
|
|
22
|
+
const indent = this.createIndent(context.depth, context);
|
|
23
|
+
const label = this.formatLabel(field, context);
|
|
24
|
+
|
|
25
|
+
const data = extractTextData(value);
|
|
26
|
+
|
|
27
|
+
if (!data) {
|
|
28
|
+
return `${indent}${label}: â`;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const formattedValue = context.formatValue(field, data.text);
|
|
32
|
+
// Types flow from TextWidgetConfig - no assertions needed
|
|
33
|
+
const { multiline, emphasis, label: labelKey } = field.ui;
|
|
34
|
+
|
|
35
|
+
if (multiline) {
|
|
36
|
+
return this.renderMultilineText(formattedValue, indent, label, context);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if (emphasis) {
|
|
40
|
+
const styledValue = this.styleText(formattedValue, emphasis, context);
|
|
41
|
+
return `${indent}${label}: ${styledValue}`;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const displayValue = formattedValue === "(not set)" ? "â" : formattedValue;
|
|
45
|
+
|
|
46
|
+
if (!labelKey) {
|
|
47
|
+
return `${indent}${displayValue}`;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return `${indent}${label}: ${displayValue}`;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
private renderMultilineText(
|
|
54
|
+
value: string,
|
|
55
|
+
indent: string,
|
|
56
|
+
label: string,
|
|
57
|
+
context: WidgetRenderContext,
|
|
58
|
+
): string {
|
|
59
|
+
if (!value || typeof value !== "string") {
|
|
60
|
+
// eslint-disable-next-line i18next/no-literal-string
|
|
61
|
+
return `${indent}${label}: (empty)`;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const lines = value.split("\n");
|
|
65
|
+
const result = [`${indent}${label}:`];
|
|
66
|
+
|
|
67
|
+
for (const line of lines) {
|
|
68
|
+
const wrappedLine = this.wrapText(
|
|
69
|
+
line,
|
|
70
|
+
context.options.maxWidth - indent.length - 2,
|
|
71
|
+
`${indent} `,
|
|
72
|
+
);
|
|
73
|
+
result.push(`${indent} ${wrappedLine}`);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return result.join("\n");
|
|
77
|
+
}
|
|
78
|
+
}
|