@next-vibe/checker 1.0.11 → 1.0.13
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 +26 -22
- package/.dist/bin/vibe-runtime.js.map +5 -5
- package/.dist/oxlint-plugins/i18n.js +4 -0
- package/.dist/oxlint-plugins/i18n.js.map +1 -0
- package/.dist/oxlint-plugins/jsx-capitalization.js +4 -0
- package/.dist/oxlint-plugins/jsx-capitalization.js.map +1 -0
- package/.dist/oxlint-plugins/restricted-syntax.js +4 -0
- package/.dist/oxlint-plugins/restricted-syntax.js.map +1 -0
- package/check.config.ts +4 -12
- 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 +78 -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 +886 -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 +532 -0
- package/src/app/api/[locale]/system/check/test-project/check.config.ts +981 -0
- package/src/app/api/[locale]/system/check/test-project/package.json +12 -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 +34 -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,859 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI Route Executor
|
|
3
|
+
* Thin adapter that parses CLI input and delegates to central executor
|
|
4
|
+
* Handles CLI-specific concerns: argument parsing, interactive forms, output formatting
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import type { ErrorResponseType } from "next-vibe/shared/types/response.schema";
|
|
8
|
+
import { parseError } from "next-vibe/shared/utils";
|
|
9
|
+
|
|
10
|
+
import type { WidgetData } from "@/app/api/[locale]/system/unified-interface/shared/widgets/types";
|
|
11
|
+
import { type UserRoleValue } from "@/app/api/[locale]/user/user-roles/enum";
|
|
12
|
+
import type { CountryLanguage } from "@/i18n/core/config";
|
|
13
|
+
import type { TranslatedKeyType } from "@/i18n/core/scoped-translation";
|
|
14
|
+
import { simpleT } from "@/i18n/core/shared";
|
|
15
|
+
import type {
|
|
16
|
+
TFunction,
|
|
17
|
+
TParams,
|
|
18
|
+
TranslationKey,
|
|
19
|
+
} from "@/i18n/core/static-types";
|
|
20
|
+
|
|
21
|
+
import { isEmptySchema } from "../../../../shared/utils/validation";
|
|
22
|
+
import { definitionLoader } from "../../shared/endpoints/definition/loader";
|
|
23
|
+
import type { BaseExecutionContext } from "../../shared/endpoints/route/executor";
|
|
24
|
+
import { routeExecutionExecutor } from "../../shared/endpoints/route/executor";
|
|
25
|
+
import type { InferJwtPayloadTypeFromRoles } from "../../shared/endpoints/route/handler";
|
|
26
|
+
import type { EndpointLogger } from "../../shared/logger/endpoint";
|
|
27
|
+
import type {
|
|
28
|
+
CreateApiEndpointAny,
|
|
29
|
+
UnifiedField,
|
|
30
|
+
} from "../../shared/types/endpoint";
|
|
31
|
+
import type { Platform } from "../../shared/types/platform";
|
|
32
|
+
import { getCliUser } from "../auth/cli-user";
|
|
33
|
+
import { modularCLIResponseRenderer } from "../widgets/renderers/response-renderer";
|
|
34
|
+
import { schemaUIHandler } from "../widgets/renderers/schema-handler";
|
|
35
|
+
import type { CliObject } from "./parsing";
|
|
36
|
+
|
|
37
|
+
// Input data interfaces
|
|
38
|
+
interface InputData {
|
|
39
|
+
[key: string]:
|
|
40
|
+
| string
|
|
41
|
+
| number
|
|
42
|
+
| boolean
|
|
43
|
+
| null
|
|
44
|
+
| undefined
|
|
45
|
+
| InputData
|
|
46
|
+
| InputData[]
|
|
47
|
+
| Array<string | number | boolean | null | undefined>;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
interface CollectedInputData {
|
|
51
|
+
data?: Partial<InputData>;
|
|
52
|
+
urlPathParams?: Partial<InputData>;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// CLI data types
|
|
56
|
+
export interface CliRequestData {
|
|
57
|
+
[key: string]:
|
|
58
|
+
| string
|
|
59
|
+
| number
|
|
60
|
+
| boolean
|
|
61
|
+
| null
|
|
62
|
+
| undefined
|
|
63
|
+
| CliRequestData
|
|
64
|
+
| CliRequestData[];
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
interface CliUrlParams {
|
|
68
|
+
[key: string]: string | number | boolean | null | undefined;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// Use CliObject from parsing.ts for type-safe nested object support
|
|
72
|
+
type CliNamedArgs = CliObject;
|
|
73
|
+
|
|
74
|
+
interface CliResponseData {
|
|
75
|
+
[key: string]:
|
|
76
|
+
| string
|
|
77
|
+
| number
|
|
78
|
+
| boolean
|
|
79
|
+
| null
|
|
80
|
+
| undefined
|
|
81
|
+
| CliResponseData
|
|
82
|
+
| CliResponseData[];
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/** CLI-compatible platforms for type assertions */
|
|
86
|
+
export type CliCompatiblePlatform =
|
|
87
|
+
| typeof Platform.CLI
|
|
88
|
+
| typeof Platform.CLI_PACKAGE
|
|
89
|
+
| typeof Platform.AI
|
|
90
|
+
| typeof Platform.MCP;
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Route execution context
|
|
94
|
+
* Extends BaseExecutionContext with CLI-specific fields
|
|
95
|
+
*/
|
|
96
|
+
export interface RouteExecutionContext extends Omit<
|
|
97
|
+
BaseExecutionContext<InputData>,
|
|
98
|
+
"user"
|
|
99
|
+
> {
|
|
100
|
+
/** URL path parameters */
|
|
101
|
+
urlPathParams?: CliUrlParams;
|
|
102
|
+
|
|
103
|
+
/** CLI-specific arguments */
|
|
104
|
+
cliArgs?: {
|
|
105
|
+
positionalArgs: string[];
|
|
106
|
+
namedArgs: CliNamedArgs;
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
/** More specific user type for CLI */
|
|
110
|
+
user: InferJwtPayloadTypeFromRoles<readonly UserRoleValue[]> | undefined;
|
|
111
|
+
|
|
112
|
+
/** CLI-specific options */
|
|
113
|
+
options?: {
|
|
114
|
+
verbose?: boolean;
|
|
115
|
+
dryRun?: boolean;
|
|
116
|
+
interactive?: boolean;
|
|
117
|
+
output?: "json" | "table" | "pretty";
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
/** Timestamp of execution */
|
|
121
|
+
timestamp: number;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Route execution result
|
|
126
|
+
* Extends BaseExecutionResult with CLI-specific fields
|
|
127
|
+
*/
|
|
128
|
+
export interface RouteExecutionResult {
|
|
129
|
+
success: boolean;
|
|
130
|
+
/** CLI response data */
|
|
131
|
+
data?: CliResponseData;
|
|
132
|
+
|
|
133
|
+
/** Error message (translation key or plain text) */
|
|
134
|
+
error?: TranslationKey;
|
|
135
|
+
|
|
136
|
+
/** Error parameters for translation */
|
|
137
|
+
errorParams?: TParams;
|
|
138
|
+
|
|
139
|
+
/** CLI-specific metadata */
|
|
140
|
+
metadata?: {
|
|
141
|
+
executionTime: number;
|
|
142
|
+
endpointPath: string;
|
|
143
|
+
method?: string;
|
|
144
|
+
route?: string;
|
|
145
|
+
resolvedCommand?: string;
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
/** Performance metadata from route execution (translation keys as keys) */
|
|
149
|
+
performance?: Partial<Record<TranslationKey, number>>;
|
|
150
|
+
|
|
151
|
+
/** Error cause chain for debugging - reuses ErrorResponseType */
|
|
152
|
+
cause?: ErrorResponseType;
|
|
153
|
+
|
|
154
|
+
/** Formatted output string ready for display */
|
|
155
|
+
formattedOutput?: string;
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Indicates that this is a logical error response (e.g., operation failed)
|
|
159
|
+
* even though success: true was returned. Used for CLI exit code handling.
|
|
160
|
+
*/
|
|
161
|
+
isErrorResponse?: true;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* CLI Route Executor
|
|
166
|
+
* Thin adapter: parses CLI input → calls central executor → formats CLI output
|
|
167
|
+
*/
|
|
168
|
+
export class RouteDelegationHandler {
|
|
169
|
+
/**
|
|
170
|
+
* Execute a route - delegates to central executor
|
|
171
|
+
*/
|
|
172
|
+
async executeRoute(
|
|
173
|
+
resolvedCommand: string,
|
|
174
|
+
context: RouteExecutionContext,
|
|
175
|
+
logger: EndpointLogger,
|
|
176
|
+
locale: CountryLanguage,
|
|
177
|
+
): Promise<RouteExecutionResult> {
|
|
178
|
+
const startTime = Date.now();
|
|
179
|
+
|
|
180
|
+
try {
|
|
181
|
+
// 1. Get CLI user (fallback to getCliUser if not provided)
|
|
182
|
+
// Note: Auth will be handled again by shared handler, this is just for endpoint loading
|
|
183
|
+
let cliUser = context.user;
|
|
184
|
+
if (!cliUser) {
|
|
185
|
+
const cliUserResult = await getCliUser(logger, context.locale);
|
|
186
|
+
if (cliUserResult.success) {
|
|
187
|
+
cliUser = cliUserResult.data;
|
|
188
|
+
} else {
|
|
189
|
+
// If auth fails, still try to load endpoint - shared handler will re-auth properly
|
|
190
|
+
cliUser = {
|
|
191
|
+
isPublic: true,
|
|
192
|
+
leadId: "temp-for-loading",
|
|
193
|
+
} as InferJwtPayloadTypeFromRoles<readonly UserRoleValue[]>;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
// 2. Get endpoint definition for CLI-specific features (interactive forms, arg parsing)
|
|
198
|
+
const endpointResult = await definitionLoader.load<CreateApiEndpointAny>({
|
|
199
|
+
identifier: resolvedCommand,
|
|
200
|
+
platform: context.platform,
|
|
201
|
+
user: cliUser,
|
|
202
|
+
logger,
|
|
203
|
+
});
|
|
204
|
+
const endpoint = endpointResult.success ? endpointResult.data : null;
|
|
205
|
+
|
|
206
|
+
// 3. CLI-specific: Collect input data (parse CLI args, interactive forms)
|
|
207
|
+
const inputData = await this.collectInputData(endpoint, context, logger);
|
|
208
|
+
|
|
209
|
+
// 4. CLI-specific: Handle dry run
|
|
210
|
+
if (context.options?.dryRun) {
|
|
211
|
+
logger.info("🔍 Dry run - would execute with:");
|
|
212
|
+
logger.info(
|
|
213
|
+
JSON.stringify(
|
|
214
|
+
{ data: inputData.data, urlPathParams: inputData.urlPathParams },
|
|
215
|
+
null,
|
|
216
|
+
2,
|
|
217
|
+
),
|
|
218
|
+
);
|
|
219
|
+
return {
|
|
220
|
+
success: true,
|
|
221
|
+
data: {
|
|
222
|
+
dryRun: true,
|
|
223
|
+
data: inputData.data as CliResponseData,
|
|
224
|
+
urlPathParams: inputData.urlPathParams as CliResponseData,
|
|
225
|
+
} as CliResponseData,
|
|
226
|
+
metadata: {
|
|
227
|
+
executionTime: Date.now() - startTime,
|
|
228
|
+
endpointPath: resolvedCommand,
|
|
229
|
+
resolvedCommand,
|
|
230
|
+
},
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
// 5. CLI-specific: Show execution info if verbose
|
|
235
|
+
if (context.options?.verbose) {
|
|
236
|
+
logger.info(`🎯 Executing route: ${resolvedCommand}`);
|
|
237
|
+
logger.info(`Data: ${JSON.stringify(inputData.data, null, 2)}`);
|
|
238
|
+
if (
|
|
239
|
+
inputData.urlPathParams &&
|
|
240
|
+
Object.keys(inputData.urlPathParams).length > 0
|
|
241
|
+
) {
|
|
242
|
+
logger.info(
|
|
243
|
+
`URL Params: ${JSON.stringify(inputData.urlPathParams, null, 2)}`,
|
|
244
|
+
);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
// 6. Delegate to shared generic handler executor
|
|
249
|
+
let result = await routeExecutionExecutor.executeGenericHandler({
|
|
250
|
+
toolName: resolvedCommand,
|
|
251
|
+
data: (inputData.data || {}) as Record<string, never>,
|
|
252
|
+
urlPathParams: (inputData.urlPathParams || {}) as Record<string, never>,
|
|
253
|
+
user: cliUser,
|
|
254
|
+
locale,
|
|
255
|
+
logger,
|
|
256
|
+
platform: context.platform,
|
|
257
|
+
});
|
|
258
|
+
|
|
259
|
+
// 7. Convert ResponseType to RouteExecutionResult
|
|
260
|
+
const routeResult: RouteExecutionResult = {
|
|
261
|
+
success: result.success,
|
|
262
|
+
data: result.success
|
|
263
|
+
? (result.data as CliResponseData | undefined)
|
|
264
|
+
: undefined,
|
|
265
|
+
error: result.success ? undefined : result.message,
|
|
266
|
+
errorParams: result.success ? undefined : result.messageParams,
|
|
267
|
+
metadata: {
|
|
268
|
+
executionTime: Date.now() - startTime,
|
|
269
|
+
endpointPath: resolvedCommand,
|
|
270
|
+
method: "",
|
|
271
|
+
resolvedCommand,
|
|
272
|
+
},
|
|
273
|
+
// Pass through isErrorResponse from API response for CLI exit code handling
|
|
274
|
+
// Note: isErrorResponse can be true even when result.success is true (e.g., vibe check found errors)
|
|
275
|
+
isErrorResponse:
|
|
276
|
+
"isErrorResponse" in result && result.isErrorResponse
|
|
277
|
+
? true
|
|
278
|
+
: undefined,
|
|
279
|
+
// Pass through performance metadata from API response for execution summary
|
|
280
|
+
performance:
|
|
281
|
+
"performance" in result && result.performance
|
|
282
|
+
? result.performance
|
|
283
|
+
: undefined,
|
|
284
|
+
};
|
|
285
|
+
|
|
286
|
+
// 8. Format result for CLI output
|
|
287
|
+
const formattedOutput = this.formatResult(
|
|
288
|
+
routeResult,
|
|
289
|
+
context.options?.output || "pretty",
|
|
290
|
+
endpoint, // Pass endpoint definition for widget-based formatting
|
|
291
|
+
locale,
|
|
292
|
+
context.options?.verbose || false,
|
|
293
|
+
logger,
|
|
294
|
+
);
|
|
295
|
+
|
|
296
|
+
// 9. Return result with formatted output
|
|
297
|
+
return {
|
|
298
|
+
...routeResult,
|
|
299
|
+
formattedOutput,
|
|
300
|
+
};
|
|
301
|
+
} catch (error) {
|
|
302
|
+
const errorResult: RouteExecutionResult = {
|
|
303
|
+
success: false,
|
|
304
|
+
error:
|
|
305
|
+
"app.api.system.unifiedInterface.cli.vibe.errors.executionFailed",
|
|
306
|
+
errorParams: {
|
|
307
|
+
error: parseError(error).message,
|
|
308
|
+
},
|
|
309
|
+
metadata: {
|
|
310
|
+
executionTime: Date.now() - startTime,
|
|
311
|
+
endpointPath: resolvedCommand,
|
|
312
|
+
method: "",
|
|
313
|
+
},
|
|
314
|
+
};
|
|
315
|
+
|
|
316
|
+
// Format error result
|
|
317
|
+
const formattedOutput = this.formatResult(
|
|
318
|
+
errorResult,
|
|
319
|
+
context.options?.output || "pretty",
|
|
320
|
+
null, // endpoint definition not needed for formatting
|
|
321
|
+
locale,
|
|
322
|
+
context.options?.verbose || false,
|
|
323
|
+
logger,
|
|
324
|
+
);
|
|
325
|
+
|
|
326
|
+
return {
|
|
327
|
+
...errorResult,
|
|
328
|
+
formattedOutput,
|
|
329
|
+
};
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
/**
|
|
334
|
+
* Collect input data using schema-driven UI
|
|
335
|
+
* Now delegates validation to registry
|
|
336
|
+
*/
|
|
337
|
+
private async collectInputData(
|
|
338
|
+
endpoint: CreateApiEndpointAny | null,
|
|
339
|
+
context: RouteExecutionContext,
|
|
340
|
+
logger: EndpointLogger,
|
|
341
|
+
): Promise<CollectedInputData> {
|
|
342
|
+
const inputData: CollectedInputData = {};
|
|
343
|
+
|
|
344
|
+
// Always try to build data from CLI arguments first
|
|
345
|
+
const cliData = this.buildDataFromCliArgs(endpoint, context);
|
|
346
|
+
|
|
347
|
+
// Merge CLI data with provided data using registry
|
|
348
|
+
const contextData = context.data;
|
|
349
|
+
if (contextData || (cliData && Object.keys(cliData).length > 0)) {
|
|
350
|
+
const mergedData = routeExecutionExecutor.mergeData(
|
|
351
|
+
contextData || {},
|
|
352
|
+
cliData || {},
|
|
353
|
+
);
|
|
354
|
+
// mergedData is Partial<InputData>, which is compatible with InputData for our purposes
|
|
355
|
+
inputData.data = mergedData;
|
|
356
|
+
|
|
357
|
+
// Check if all required fields are satisfied using registry
|
|
358
|
+
const missingRequired = routeExecutionExecutor.getMissingRequiredFields(
|
|
359
|
+
inputData.data,
|
|
360
|
+
endpoint?.requestSchema,
|
|
361
|
+
logger,
|
|
362
|
+
);
|
|
363
|
+
|
|
364
|
+
if (
|
|
365
|
+
missingRequired.length > 0 &&
|
|
366
|
+
context.options?.interactive &&
|
|
367
|
+
!contextData &&
|
|
368
|
+
endpoint
|
|
369
|
+
) {
|
|
370
|
+
// Some required fields missing AND no data was provided, use interactive mode
|
|
371
|
+
logger.info("📝 Request Data:");
|
|
372
|
+
logger.warn(
|
|
373
|
+
`⚠️ Missing required fields: ${missingRequired.join(", ")}`,
|
|
374
|
+
);
|
|
375
|
+
inputData.data = await this.generateFormFromEndpoint(
|
|
376
|
+
endpoint,
|
|
377
|
+
"request",
|
|
378
|
+
);
|
|
379
|
+
}
|
|
380
|
+
} else if (
|
|
381
|
+
endpoint?.requestSchema &&
|
|
382
|
+
context.options?.interactive !== false
|
|
383
|
+
) {
|
|
384
|
+
// No data provided and interactive mode allowed
|
|
385
|
+
logger.info("📝 Request Data:");
|
|
386
|
+
inputData.data = await this.generateFormFromEndpoint(endpoint, "request");
|
|
387
|
+
} else {
|
|
388
|
+
// No CLI data and interactive mode disabled - use empty data
|
|
389
|
+
inputData.data = {};
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
// Collect URL parameters if needed
|
|
393
|
+
if (endpoint?.requestUrlPathParamsSchema && !context.urlPathParams) {
|
|
394
|
+
// Check if schema is empty
|
|
395
|
+
if (!isEmptySchema(endpoint.requestUrlPathParamsSchema)) {
|
|
396
|
+
logger.info("🔗 URL Parameters:");
|
|
397
|
+
inputData.urlPathParams = await this.generateFormFromEndpoint(
|
|
398
|
+
endpoint,
|
|
399
|
+
"urlPathParams",
|
|
400
|
+
);
|
|
401
|
+
}
|
|
402
|
+
} else if (context.urlPathParams) {
|
|
403
|
+
inputData.urlPathParams = context.urlPathParams;
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
return inputData;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
/**
|
|
410
|
+
* Generate form from endpoint using schema UI handler
|
|
411
|
+
*/
|
|
412
|
+
private async generateFormFromEndpoint(
|
|
413
|
+
endpoint: CreateApiEndpointAny,
|
|
414
|
+
formType: "request" | "urlPathParams" = "request",
|
|
415
|
+
): Promise<InputData> {
|
|
416
|
+
const schema =
|
|
417
|
+
formType === "request"
|
|
418
|
+
? endpoint.requestSchema
|
|
419
|
+
: endpoint.requestUrlPathParamsSchema;
|
|
420
|
+
|
|
421
|
+
if (!schema) {
|
|
422
|
+
return {};
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
const fields = schemaUIHandler.parseSchema(schema);
|
|
426
|
+
const config = {
|
|
427
|
+
title: `${endpoint.method} ${endpoint.path.join("/")}`,
|
|
428
|
+
description: endpoint.description || endpoint.title,
|
|
429
|
+
fields,
|
|
430
|
+
};
|
|
431
|
+
|
|
432
|
+
const result = await schemaUIHandler.generateForm(config);
|
|
433
|
+
return result as InputData;
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
/**
|
|
437
|
+
* Format execution result for display with enhanced rendering
|
|
438
|
+
*/
|
|
439
|
+
formatResult(
|
|
440
|
+
result: RouteExecutionResult,
|
|
441
|
+
outputFormat = "pretty",
|
|
442
|
+
endpointDefinition: CreateApiEndpointAny | null,
|
|
443
|
+
locale: CountryLanguage,
|
|
444
|
+
verbose = false,
|
|
445
|
+
logger: EndpointLogger,
|
|
446
|
+
): string {
|
|
447
|
+
if (!result.success) {
|
|
448
|
+
// Translate error message if it's a translation key
|
|
449
|
+
const { t } = simpleT(locale);
|
|
450
|
+
let errorMessage = t(
|
|
451
|
+
result.error ||
|
|
452
|
+
"app.api.system.unifiedInterface.cli.vibe.errors.unknownError",
|
|
453
|
+
result.errorParams,
|
|
454
|
+
);
|
|
455
|
+
|
|
456
|
+
// Build detailed error message with errorParams
|
|
457
|
+
let detailedError = errorMessage;
|
|
458
|
+
|
|
459
|
+
// Always show error details from errorParams, even in non-verbose mode
|
|
460
|
+
if (result.errorParams && Object.keys(result.errorParams).length > 0) {
|
|
461
|
+
// eslint-disable-next-line i18next/no-literal-string
|
|
462
|
+
detailedError += "\n\nDetails:";
|
|
463
|
+
for (const [key, value] of Object.entries(result.errorParams)) {
|
|
464
|
+
// eslint-disable-next-line i18next/no-literal-string
|
|
465
|
+
detailedError += `\n ${key}: ${value}`;
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
// Handle error cause chain
|
|
470
|
+
const causeChain = this.formatErrorCauseChain(result, t, verbose);
|
|
471
|
+
if (causeChain) {
|
|
472
|
+
detailedError += causeChain;
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
if (verbose) {
|
|
476
|
+
// eslint-disable-next-line i18next/no-literal-string
|
|
477
|
+
return `❌ Error: ${detailedError}\n\nFull Response:\n${JSON.stringify(
|
|
478
|
+
result,
|
|
479
|
+
null,
|
|
480
|
+
2,
|
|
481
|
+
)}`;
|
|
482
|
+
}
|
|
483
|
+
// eslint-disable-next-line i18next/no-literal-string
|
|
484
|
+
return `❌ Error: ${detailedError}`;
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
let output = "";
|
|
488
|
+
|
|
489
|
+
// Only show metadata in verbose mode
|
|
490
|
+
if (verbose) {
|
|
491
|
+
// Add success indicator
|
|
492
|
+
// eslint-disable-next-line i18next/no-literal-string
|
|
493
|
+
output += "✅ Success\n";
|
|
494
|
+
|
|
495
|
+
// Add execution metadata if available
|
|
496
|
+
if (result.metadata) {
|
|
497
|
+
if (result.metadata.route) {
|
|
498
|
+
// eslint-disable-next-line i18next/no-literal-string
|
|
499
|
+
output += `🛣️ Route: ${result.metadata.method} ${result.metadata.route}\n`;
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
output += "\n";
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
// Format data based on output format
|
|
506
|
+
if (result.data) {
|
|
507
|
+
output += "\n";
|
|
508
|
+
|
|
509
|
+
switch (outputFormat) {
|
|
510
|
+
case "json":
|
|
511
|
+
// eslint-disable-next-line i18next/no-literal-string
|
|
512
|
+
output += "📊 Result (JSON):\n";
|
|
513
|
+
output += JSON.stringify(result.data, null, 2);
|
|
514
|
+
break;
|
|
515
|
+
case "pretty":
|
|
516
|
+
default:
|
|
517
|
+
// Always use enhanced renderer for pretty format
|
|
518
|
+
if (endpointDefinition) {
|
|
519
|
+
output += this.formatWithEnhancedRenderer(
|
|
520
|
+
result.data,
|
|
521
|
+
|
|
522
|
+
endpointDefinition,
|
|
523
|
+
locale,
|
|
524
|
+
logger,
|
|
525
|
+
);
|
|
526
|
+
} else {
|
|
527
|
+
// Fallback to JSON without endpoint definition
|
|
528
|
+
if (typeof result.data === "object") {
|
|
529
|
+
output += JSON.stringify(result.data, null, 2);
|
|
530
|
+
} else {
|
|
531
|
+
output += String(result.data);
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
break;
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
return output;
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
/**
|
|
542
|
+
* Format error cause chain recursively
|
|
543
|
+
*/
|
|
544
|
+
private formatErrorCauseChain(
|
|
545
|
+
result: RouteExecutionResult,
|
|
546
|
+
t: TFunction,
|
|
547
|
+
verbose: boolean,
|
|
548
|
+
depth = 0,
|
|
549
|
+
): string {
|
|
550
|
+
if (!result.cause || depth > 10) {
|
|
551
|
+
// Prevent infinite recursion (increased limit for deep error chains)
|
|
552
|
+
return "";
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
const indent = " ".repeat(depth + 1);
|
|
556
|
+
let output = "";
|
|
557
|
+
|
|
558
|
+
// Format cause error message - ErrorResponseType uses 'message' field
|
|
559
|
+
const causeTranslationKey: TranslationKey =
|
|
560
|
+
result.cause.message ||
|
|
561
|
+
"app.api.system.unifiedInterface.cli.vibe.errors.unknownError";
|
|
562
|
+
|
|
563
|
+
const causeMessage = t(causeTranslationKey, result.cause.messageParams);
|
|
564
|
+
|
|
565
|
+
// Show error type in verbose mode or for root cause
|
|
566
|
+
const errorTypeInfo =
|
|
567
|
+
verbose || !result.cause.cause
|
|
568
|
+
? ` [${result.cause.errorType.errorKey}]`
|
|
569
|
+
: "";
|
|
570
|
+
|
|
571
|
+
// eslint-disable-next-line i18next/no-literal-string
|
|
572
|
+
output += `\n\n${indent}↳ Caused by${errorTypeInfo}: ${causeMessage}`;
|
|
573
|
+
|
|
574
|
+
// Add cause error params - ErrorResponseType uses 'messageParams' field
|
|
575
|
+
if (
|
|
576
|
+
result.cause.messageParams &&
|
|
577
|
+
Object.keys(result.cause.messageParams).length > 0
|
|
578
|
+
) {
|
|
579
|
+
for (const [key, value] of Object.entries(result.cause.messageParams)) {
|
|
580
|
+
// eslint-disable-next-line i18next/no-literal-string
|
|
581
|
+
output += `\n${indent} • ${key}: ${value}`;
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
// Recursively format nested causes
|
|
586
|
+
if (result.cause.cause) {
|
|
587
|
+
// Create a temporary RouteExecutionResult to continue recursion
|
|
588
|
+
const nestedResult: RouteExecutionResult = {
|
|
589
|
+
success: false,
|
|
590
|
+
cause: result.cause.cause,
|
|
591
|
+
};
|
|
592
|
+
output += this.formatErrorCauseChain(nestedResult, t, verbose, depth + 1);
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
return output;
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
/**
|
|
599
|
+
* Sanitize data for renderer to match expected type
|
|
600
|
+
*/
|
|
601
|
+
private sanitizeDataForRenderer(
|
|
602
|
+
data: CliResponseData,
|
|
603
|
+
): Record<string, WidgetData> {
|
|
604
|
+
if (typeof data !== "object" || data === null) {
|
|
605
|
+
return { result: String(data) };
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
const sanitizeValue = (
|
|
609
|
+
value:
|
|
610
|
+
| CliResponseData
|
|
611
|
+
| CliResponseData[]
|
|
612
|
+
| string
|
|
613
|
+
| number
|
|
614
|
+
| boolean
|
|
615
|
+
| null
|
|
616
|
+
| undefined,
|
|
617
|
+
): WidgetData => {
|
|
618
|
+
if (value === undefined || value === null) {
|
|
619
|
+
return undefined;
|
|
620
|
+
}
|
|
621
|
+
if (typeof value === "string") {
|
|
622
|
+
return value;
|
|
623
|
+
}
|
|
624
|
+
if (typeof value === "number") {
|
|
625
|
+
return value;
|
|
626
|
+
}
|
|
627
|
+
if (typeof value === "boolean") {
|
|
628
|
+
return value;
|
|
629
|
+
}
|
|
630
|
+
if (Array.isArray(value)) {
|
|
631
|
+
return value.map(sanitizeValue) as WidgetData[];
|
|
632
|
+
}
|
|
633
|
+
if (typeof value === "object") {
|
|
634
|
+
const sanitizedObj: { [key: string]: WidgetData } = {};
|
|
635
|
+
for (const [k, v] of Object.entries(value)) {
|
|
636
|
+
sanitizedObj[k] = sanitizeValue(v);
|
|
637
|
+
}
|
|
638
|
+
return sanitizedObj;
|
|
639
|
+
}
|
|
640
|
+
return String(value);
|
|
641
|
+
};
|
|
642
|
+
|
|
643
|
+
const sanitized: Record<string, WidgetData> = {};
|
|
644
|
+
for (const [key, value] of Object.entries(data)) {
|
|
645
|
+
sanitized[key] = sanitizeValue(value);
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
return sanitized;
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
/**
|
|
652
|
+
* Extract response fields from endpoint definition
|
|
653
|
+
*/
|
|
654
|
+
private extractResponseFields<const TKey extends string>(
|
|
655
|
+
endpointDefinition: CreateApiEndpointAny,
|
|
656
|
+
): Array<[string, UnifiedField<TKey>]> {
|
|
657
|
+
// Type guard: check if it's a valid endpoint with fields
|
|
658
|
+
if (
|
|
659
|
+
!endpointDefinition ||
|
|
660
|
+
typeof endpointDefinition !== "object" ||
|
|
661
|
+
!("fields" in endpointDefinition)
|
|
662
|
+
) {
|
|
663
|
+
return [];
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
const fields = endpointDefinition.fields;
|
|
667
|
+
|
|
668
|
+
// Check if fields is an ObjectField with children
|
|
669
|
+
if (
|
|
670
|
+
!fields ||
|
|
671
|
+
typeof fields !== "object" ||
|
|
672
|
+
!("children" in fields) ||
|
|
673
|
+
typeof fields.children !== "object" ||
|
|
674
|
+
fields.children === null
|
|
675
|
+
) {
|
|
676
|
+
return [];
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
const children = fields.children as Record<string, UnifiedField<TKey>>;
|
|
680
|
+
const responseFields: Array<[string, UnifiedField<TKey>]> = [];
|
|
681
|
+
|
|
682
|
+
// Extract fields that have usage.response = true
|
|
683
|
+
for (const [fieldName, fieldDef] of Object.entries(children)) {
|
|
684
|
+
if (
|
|
685
|
+
"usage" in fieldDef &&
|
|
686
|
+
typeof fieldDef.usage === "object" &&
|
|
687
|
+
fieldDef.usage !== null
|
|
688
|
+
) {
|
|
689
|
+
const usage = fieldDef.usage;
|
|
690
|
+
let hasResponse = false;
|
|
691
|
+
|
|
692
|
+
if ("response" in usage) {
|
|
693
|
+
hasResponse = usage.response === true;
|
|
694
|
+
} else {
|
|
695
|
+
// Check each method's usage for response field
|
|
696
|
+
const usageValues = Object.values(usage);
|
|
697
|
+
hasResponse = usageValues.some(
|
|
698
|
+
(methodUsage) =>
|
|
699
|
+
typeof methodUsage === "object" &&
|
|
700
|
+
methodUsage !== null &&
|
|
701
|
+
"response" in methodUsage &&
|
|
702
|
+
methodUsage.response === true,
|
|
703
|
+
);
|
|
704
|
+
}
|
|
705
|
+
|
|
706
|
+
if (hasResponse) {
|
|
707
|
+
responseFields.push([fieldName, fieldDef]);
|
|
708
|
+
}
|
|
709
|
+
}
|
|
710
|
+
}
|
|
711
|
+
|
|
712
|
+
return responseFields;
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
/**
|
|
716
|
+
* Format result using enhanced CLI response renderer
|
|
717
|
+
*/
|
|
718
|
+
private formatWithEnhancedRenderer(
|
|
719
|
+
data: CliResponseData,
|
|
720
|
+
endpointDefinition: CreateApiEndpointAny,
|
|
721
|
+
locale: CountryLanguage,
|
|
722
|
+
logger: EndpointLogger,
|
|
723
|
+
): string {
|
|
724
|
+
try {
|
|
725
|
+
// Extract response fields from endpoint definition
|
|
726
|
+
const fields = this.extractResponseFields(endpointDefinition);
|
|
727
|
+
|
|
728
|
+
// Use enhanced modular renderer with locale
|
|
729
|
+
return modularCLIResponseRenderer.render(
|
|
730
|
+
this.sanitizeDataForRenderer(data),
|
|
731
|
+
fields,
|
|
732
|
+
locale,
|
|
733
|
+
endpointDefinition.scopedTranslation.scopedT,
|
|
734
|
+
);
|
|
735
|
+
} catch (error) {
|
|
736
|
+
// Fallback to basic formatting
|
|
737
|
+
logger.warn("Enhanced rendering failed, falling back to basic format:", {
|
|
738
|
+
error: parseError(error),
|
|
739
|
+
});
|
|
740
|
+
// eslint-disable-next-line i18next/no-literal-string
|
|
741
|
+
return `📊 Result:\n${this.formatPretty(data, locale, endpointDefinition.scopedTranslation.scopedT)}`;
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
|
|
745
|
+
/**
|
|
746
|
+
* Format data in pretty format using enhanced renderer
|
|
747
|
+
*/
|
|
748
|
+
private formatPretty(
|
|
749
|
+
data: CliResponseData,
|
|
750
|
+
locale: CountryLanguage,
|
|
751
|
+
scopedT: (locale: CountryLanguage) => {
|
|
752
|
+
t: (key: string, params?: TParams) => TranslatedKeyType;
|
|
753
|
+
},
|
|
754
|
+
): string {
|
|
755
|
+
// Use the enhanced modular CLI response renderer for pretty formatting
|
|
756
|
+
try {
|
|
757
|
+
return modularCLIResponseRenderer.render(
|
|
758
|
+
this.sanitizeDataForRenderer(data),
|
|
759
|
+
[],
|
|
760
|
+
locale,
|
|
761
|
+
scopedT,
|
|
762
|
+
);
|
|
763
|
+
} catch {
|
|
764
|
+
// Fallback to JSON if enhanced rendering fails
|
|
765
|
+
if (typeof data === "object") {
|
|
766
|
+
return JSON.stringify(data, null, 2);
|
|
767
|
+
}
|
|
768
|
+
return String(data);
|
|
769
|
+
}
|
|
770
|
+
}
|
|
771
|
+
|
|
772
|
+
/**
|
|
773
|
+
* Build data object from CLI arguments
|
|
774
|
+
*/
|
|
775
|
+
private buildDataFromCliArgs(
|
|
776
|
+
endpoint: CreateApiEndpointAny | null,
|
|
777
|
+
context: RouteExecutionContext,
|
|
778
|
+
): InputData | null {
|
|
779
|
+
if (!context.cliArgs) {
|
|
780
|
+
return null;
|
|
781
|
+
}
|
|
782
|
+
|
|
783
|
+
const { positionalArgs, namedArgs } = context.cliArgs;
|
|
784
|
+
const data: InputData = {};
|
|
785
|
+
|
|
786
|
+
// Handle firstCliArgKey mapping - safely access nested properties
|
|
787
|
+
const cliConfig =
|
|
788
|
+
endpoint && typeof endpoint === "object" && "cli" in endpoint
|
|
789
|
+
? endpoint.cli
|
|
790
|
+
: null;
|
|
791
|
+
const firstCliArgKey =
|
|
792
|
+
cliConfig &&
|
|
793
|
+
typeof cliConfig === "object" &&
|
|
794
|
+
"firstCliArgKey" in cliConfig
|
|
795
|
+
? cliConfig.firstCliArgKey
|
|
796
|
+
: null;
|
|
797
|
+
|
|
798
|
+
if (
|
|
799
|
+
firstCliArgKey &&
|
|
800
|
+
typeof firstCliArgKey === "string" &&
|
|
801
|
+
positionalArgs.length > 0
|
|
802
|
+
) {
|
|
803
|
+
// If there's only one positional arg, use it as a string for backward compatibility
|
|
804
|
+
// If there are multiple positional args, use them as an array
|
|
805
|
+
const firstArg = positionalArgs[0];
|
|
806
|
+
if (positionalArgs.length === 1 && firstArg !== undefined) {
|
|
807
|
+
data[firstCliArgKey] = firstArg;
|
|
808
|
+
} else {
|
|
809
|
+
// Pass positional args as a simple string array
|
|
810
|
+
// Explicitly type as array of strings (which is compatible with InputData value types)
|
|
811
|
+
data[firstCliArgKey] = positionalArgs as Array<
|
|
812
|
+
string | number | boolean | null | undefined
|
|
813
|
+
>;
|
|
814
|
+
}
|
|
815
|
+
}
|
|
816
|
+
|
|
817
|
+
// Map named arguments to data fields (convert kebab-case to camelCase)
|
|
818
|
+
for (const [key, value] of Object.entries(namedArgs)) {
|
|
819
|
+
// Convert kebab-case to camelCase (e.g., skip-generation -> skipGeneration)
|
|
820
|
+
const camelCaseKey = key.replaceAll(
|
|
821
|
+
/-([a-z])/g,
|
|
822
|
+
// oxlint-disable-next-line no-unused-vars
|
|
823
|
+
(_, letter: string): string => letter.toUpperCase(),
|
|
824
|
+
);
|
|
825
|
+
|
|
826
|
+
// Convert string boolean values to actual booleans if not already parsed
|
|
827
|
+
let convertedValue:
|
|
828
|
+
| string
|
|
829
|
+
| number
|
|
830
|
+
| boolean
|
|
831
|
+
| null
|
|
832
|
+
| undefined
|
|
833
|
+
| InputData
|
|
834
|
+
| InputData[] = value;
|
|
835
|
+
if (typeof value === "string") {
|
|
836
|
+
const lowerValue = value.toLowerCase();
|
|
837
|
+
if (lowerValue === "true") {
|
|
838
|
+
convertedValue = true;
|
|
839
|
+
} else if (lowerValue === "false") {
|
|
840
|
+
convertedValue = false;
|
|
841
|
+
}
|
|
842
|
+
// Note: Numbers should already be parsed by the CLI argument parser
|
|
843
|
+
}
|
|
844
|
+
|
|
845
|
+
data[camelCaseKey] = convertedValue as
|
|
846
|
+
| string
|
|
847
|
+
| number
|
|
848
|
+
| boolean
|
|
849
|
+
| null
|
|
850
|
+
| undefined
|
|
851
|
+
| InputData
|
|
852
|
+
| InputData[]
|
|
853
|
+
| Array<string | number | boolean | null | undefined>;
|
|
854
|
+
}
|
|
855
|
+
return Object.keys(data).length > 0 ? data : null;
|
|
856
|
+
}
|
|
857
|
+
}
|
|
858
|
+
|
|
859
|
+
export const routeDelegationHandler = new RouteDelegationHandler();
|