@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,1025 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Interactive Mode Repository
|
|
3
|
+
* Contains all business logic for interactive file explorer mode
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import "server-only";
|
|
7
|
+
|
|
8
|
+
import { confirm, select } from "@inquirer/prompts";
|
|
9
|
+
import {
|
|
10
|
+
ErrorResponseTypes,
|
|
11
|
+
fail,
|
|
12
|
+
type ResponseType,
|
|
13
|
+
success,
|
|
14
|
+
} from "next-vibe/shared/types/response.schema";
|
|
15
|
+
import { parseError } from "next-vibe/shared/utils/parse-error";
|
|
16
|
+
import type { z } from "zod";
|
|
17
|
+
|
|
18
|
+
import type { InferJwtPayloadTypeFromRoles } from "@/app/api/[locale]/system/unified-interface/shared/endpoints/route/handler";
|
|
19
|
+
import type { EndpointLogger } from "@/app/api/[locale]/system/unified-interface/shared/logger/endpoint";
|
|
20
|
+
import {
|
|
21
|
+
UserPermissionRole,
|
|
22
|
+
type UserRoleValue,
|
|
23
|
+
} from "@/app/api/[locale]/user/user-roles/enum";
|
|
24
|
+
import type { CountryLanguage } from "@/i18n/core/config";
|
|
25
|
+
import { simpleT } from "@/i18n/core/shared";
|
|
26
|
+
|
|
27
|
+
import type {
|
|
28
|
+
CliCompatiblePlatform,
|
|
29
|
+
RouteExecutionContext,
|
|
30
|
+
} from "../../unified-interface/cli/runtime/route-executor";
|
|
31
|
+
import { routeDelegationHandler } from "../../unified-interface/cli/runtime/route-executor";
|
|
32
|
+
import { schemaUIHandler } from "../../unified-interface/cli/widgets/renderers/schema-handler";
|
|
33
|
+
import { definitionsRegistry } from "../../unified-interface/shared/endpoints/definitions/registry";
|
|
34
|
+
import type { CreateApiEndpointAny } from "../../unified-interface/shared/types/endpoint";
|
|
35
|
+
import { Platform } from "../../unified-interface/shared/types/platform";
|
|
36
|
+
import {
|
|
37
|
+
endpointToToolName,
|
|
38
|
+
splitPath,
|
|
39
|
+
} from "../../unified-interface/shared/utils/path";
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Interactive session state
|
|
43
|
+
*/
|
|
44
|
+
interface InteractiveSession {
|
|
45
|
+
user: InferJwtPayloadTypeFromRoles<readonly UserRoleValue[]>;
|
|
46
|
+
locale: CountryLanguage;
|
|
47
|
+
platform: CliCompatiblePlatform;
|
|
48
|
+
options?: {
|
|
49
|
+
verbose?: boolean;
|
|
50
|
+
output?: "json" | "table" | "pretty";
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Directory node for file explorer navigation
|
|
56
|
+
*/
|
|
57
|
+
interface DirectoryNode {
|
|
58
|
+
name: string;
|
|
59
|
+
path: string;
|
|
60
|
+
type: "directory" | "route";
|
|
61
|
+
children?: DirectoryNode[];
|
|
62
|
+
route?: CreateApiEndpointAny;
|
|
63
|
+
parent?: DirectoryNode;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Navigation breadcrumb
|
|
68
|
+
*/
|
|
69
|
+
interface NavigationBreadcrumb {
|
|
70
|
+
name: string;
|
|
71
|
+
path: string;
|
|
72
|
+
node: DirectoryNode;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export interface InteractiveRepository {
|
|
76
|
+
startInteractiveMode(
|
|
77
|
+
user: InferJwtPayloadTypeFromRoles<readonly UserRoleValue[]> | undefined,
|
|
78
|
+
locale: CountryLanguage,
|
|
79
|
+
logger: EndpointLogger,
|
|
80
|
+
platform: CliCompatiblePlatform,
|
|
81
|
+
): Promise<ResponseType<{ started: boolean }>>;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
class InteractiveRepositoryImpl implements InteractiveRepository {
|
|
85
|
+
private session!: InteractiveSession;
|
|
86
|
+
private routeTree: DirectoryNode | null = null;
|
|
87
|
+
private currentNode: DirectoryNode | null = null;
|
|
88
|
+
private breadcrumbs: NavigationBreadcrumb[] = [];
|
|
89
|
+
private logger!: EndpointLogger;
|
|
90
|
+
|
|
91
|
+
// Constants for action prefixes
|
|
92
|
+
private static readonly NAV_PREFIX = "nav:";
|
|
93
|
+
private static readonly EXEC_PREFIX = "exec:";
|
|
94
|
+
private static readonly UP_ACTION = "up";
|
|
95
|
+
private static readonly EXIT_ACTION = "exit";
|
|
96
|
+
private static readonly SETTINGS_ACTION = "settings";
|
|
97
|
+
private static readonly CURRENT_PLACEHOLDER = "{current}";
|
|
98
|
+
|
|
99
|
+
async startInteractiveMode(
|
|
100
|
+
user: InferJwtPayloadTypeFromRoles<readonly UserRoleValue[]> | undefined,
|
|
101
|
+
locale: CountryLanguage,
|
|
102
|
+
logger: EndpointLogger,
|
|
103
|
+
platform: CliCompatiblePlatform,
|
|
104
|
+
): Promise<ResponseType<{ started: boolean }>> {
|
|
105
|
+
if (!user) {
|
|
106
|
+
return fail({
|
|
107
|
+
message: "app.api.system.help.interactive.errors.unauthorized.title",
|
|
108
|
+
errorType: ErrorResponseTypes.UNAUTHORIZED,
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
try {
|
|
113
|
+
this.logger = logger;
|
|
114
|
+
this.initializeDefaultSession(locale, user, platform);
|
|
115
|
+
this.setupSignalHandlers();
|
|
116
|
+
|
|
117
|
+
const { t } = simpleT(this.getSession().locale);
|
|
118
|
+
|
|
119
|
+
// Show welcome message
|
|
120
|
+
this.logger.info(
|
|
121
|
+
t("app.api.system.unifiedInterface.cli.vibe.interactive.welcome"),
|
|
122
|
+
);
|
|
123
|
+
this.logger.info(
|
|
124
|
+
t("app.api.system.unifiedInterface.cli.vibe.help.description"),
|
|
125
|
+
);
|
|
126
|
+
this.logger.info("");
|
|
127
|
+
|
|
128
|
+
// Build route tree for file explorer navigation
|
|
129
|
+
// Use centralized endpoint adapter to get all platform-accessible endpoints
|
|
130
|
+
// (filtered by user permissions from JWT)
|
|
131
|
+
const discoveredEndpoints = definitionsRegistry.getEndpointsForUser(
|
|
132
|
+
platform,
|
|
133
|
+
user,
|
|
134
|
+
logger,
|
|
135
|
+
);
|
|
136
|
+
|
|
137
|
+
this.buildRouteTree(discoveredEndpoints);
|
|
138
|
+
|
|
139
|
+
// Start at root
|
|
140
|
+
this.currentNode = this.routeTree;
|
|
141
|
+
this.updateBreadcrumbs();
|
|
142
|
+
|
|
143
|
+
// Main navigation loop
|
|
144
|
+
await this.navigationLoop();
|
|
145
|
+
|
|
146
|
+
return success({ started: true });
|
|
147
|
+
} catch (error) {
|
|
148
|
+
logger.error("Failed to start interactive mode", parseError(error));
|
|
149
|
+
return fail({
|
|
150
|
+
message: "app.api.system.help.interactive.errors.server.title",
|
|
151
|
+
errorType: ErrorResponseTypes.INTERNAL_ERROR,
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
private getSession(): InteractiveSession {
|
|
157
|
+
if (!this.session) {
|
|
158
|
+
// This should never happen in normal flow
|
|
159
|
+
// Initialize with defaults as fallback
|
|
160
|
+
this.session = {
|
|
161
|
+
options: {
|
|
162
|
+
verbose: false,
|
|
163
|
+
output: "pretty",
|
|
164
|
+
},
|
|
165
|
+
locale: "en-GLOBAL",
|
|
166
|
+
platform: Platform.CLI,
|
|
167
|
+
user: {
|
|
168
|
+
id: "system",
|
|
169
|
+
leadId: "system",
|
|
170
|
+
isPublic: false,
|
|
171
|
+
roles: [UserPermissionRole.ADMIN],
|
|
172
|
+
},
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
return this.session;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
private setupSignalHandlers(): void {
|
|
179
|
+
process.removeAllListeners("SIGINT");
|
|
180
|
+
process.removeAllListeners("SIGTERM");
|
|
181
|
+
|
|
182
|
+
process.on("SIGINT", () => {
|
|
183
|
+
process.stdout.write("\n");
|
|
184
|
+
process.stdout.write("Goodbye!\n");
|
|
185
|
+
process.exit(0);
|
|
186
|
+
});
|
|
187
|
+
|
|
188
|
+
process.on("SIGTERM", () => {
|
|
189
|
+
process.exit(0);
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
private initializeDefaultSession(
|
|
194
|
+
locale: CountryLanguage,
|
|
195
|
+
user: InferJwtPayloadTypeFromRoles<readonly UserRoleValue[]>,
|
|
196
|
+
platform: CliCompatiblePlatform,
|
|
197
|
+
): void {
|
|
198
|
+
this.session = {
|
|
199
|
+
options: {
|
|
200
|
+
verbose: false,
|
|
201
|
+
output: "pretty",
|
|
202
|
+
},
|
|
203
|
+
locale,
|
|
204
|
+
user,
|
|
205
|
+
platform,
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
private buildRouteTree(routes: CreateApiEndpointAny[]): void {
|
|
210
|
+
const { t } = simpleT(this.getSession().locale);
|
|
211
|
+
|
|
212
|
+
this.routeTree = {
|
|
213
|
+
name: t(
|
|
214
|
+
"app.api.system.unifiedInterface.cli.vibe.interactive.navigation.rootName",
|
|
215
|
+
),
|
|
216
|
+
path: "/",
|
|
217
|
+
type: "directory",
|
|
218
|
+
children: [],
|
|
219
|
+
};
|
|
220
|
+
|
|
221
|
+
for (const route of routes) {
|
|
222
|
+
this.addRouteToTree(route);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
this.sortTree(this.routeTree);
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
private addRouteToTree(route: CreateApiEndpointAny): void {
|
|
229
|
+
if (!this.routeTree) {
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
const routePath = route.path.join("/");
|
|
234
|
+
const pathParts = splitPath(`/api/[locale]/v1/${routePath}`).slice(4);
|
|
235
|
+
|
|
236
|
+
let currentNode = this.routeTree;
|
|
237
|
+
|
|
238
|
+
for (let i = 0; i < pathParts.length; i++) {
|
|
239
|
+
const part = pathParts[i];
|
|
240
|
+
let childNode = currentNode.children?.find(
|
|
241
|
+
(child) => child.name === part,
|
|
242
|
+
);
|
|
243
|
+
|
|
244
|
+
if (!childNode) {
|
|
245
|
+
const isLastPart = i === pathParts.length - 1;
|
|
246
|
+
childNode = {
|
|
247
|
+
name: part,
|
|
248
|
+
path: `/${pathParts.slice(0, i + 1).join("/")}`,
|
|
249
|
+
type: isLastPart ? "route" : "directory",
|
|
250
|
+
children: isLastPart ? undefined : [],
|
|
251
|
+
parent: currentNode,
|
|
252
|
+
route: isLastPart ? route : undefined,
|
|
253
|
+
};
|
|
254
|
+
|
|
255
|
+
if (!currentNode.children) {
|
|
256
|
+
currentNode.children = [];
|
|
257
|
+
}
|
|
258
|
+
currentNode.children.push(childNode);
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
currentNode = childNode;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
private sortTree(node: DirectoryNode): void {
|
|
266
|
+
if (node.children) {
|
|
267
|
+
node.children.sort((a, b) => {
|
|
268
|
+
if (a.type !== b.type) {
|
|
269
|
+
return a.type === "directory" ? -1 : 1;
|
|
270
|
+
}
|
|
271
|
+
return a.name.localeCompare(b.name);
|
|
272
|
+
});
|
|
273
|
+
|
|
274
|
+
node.children.forEach((child) => this.sortTree(child));
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
private updateBreadcrumbs(): void {
|
|
279
|
+
this.breadcrumbs = [];
|
|
280
|
+
let current = this.currentNode;
|
|
281
|
+
|
|
282
|
+
while (current) {
|
|
283
|
+
this.breadcrumbs.unshift({
|
|
284
|
+
name: current.name,
|
|
285
|
+
path: current.path,
|
|
286
|
+
node: current,
|
|
287
|
+
});
|
|
288
|
+
current = current.parent || null;
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
private async showNavigationMenu(): Promise<string> {
|
|
293
|
+
if (!this.currentNode) {
|
|
294
|
+
return "exit";
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
const { t } = simpleT(this.getSession().locale);
|
|
298
|
+
|
|
299
|
+
const breadcrumbPath = this.breadcrumbs.map((b) => b.name).join(" > ");
|
|
300
|
+
this.logger.info(
|
|
301
|
+
`${t("app.api.system.unifiedInterface.cli.vibe.interactive.navigation.directoryIcon")} ${breadcrumbPath}`,
|
|
302
|
+
);
|
|
303
|
+
|
|
304
|
+
const choices: Array<{ name: string; value: string }> = [];
|
|
305
|
+
|
|
306
|
+
if (this.currentNode.parent) {
|
|
307
|
+
const upIcon = t(
|
|
308
|
+
"app.api.system.unifiedInterface.cli.vibe.interactive.navigation.upIcon",
|
|
309
|
+
);
|
|
310
|
+
const goUpText = t(
|
|
311
|
+
"app.api.system.unifiedInterface.cli.vibe.interactive.navigation.goUp",
|
|
312
|
+
);
|
|
313
|
+
const upName = `${upIcon} (${goUpText})`;
|
|
314
|
+
choices.push({
|
|
315
|
+
name: upName,
|
|
316
|
+
value: InteractiveRepositoryImpl.UP_ACTION,
|
|
317
|
+
});
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
if (this.currentNode.children) {
|
|
321
|
+
const directoryIcon = t(
|
|
322
|
+
"app.api.system.unifiedInterface.cli.vibe.interactive.navigation.directoryIcon",
|
|
323
|
+
);
|
|
324
|
+
const routeIcon = t(
|
|
325
|
+
"app.api.system.unifiedInterface.cli.vibe.interactive.navigation.routeIcon",
|
|
326
|
+
);
|
|
327
|
+
const routesText = t(
|
|
328
|
+
"app.api.system.unifiedInterface.cli.vibe.interactive.navigation.routes",
|
|
329
|
+
);
|
|
330
|
+
const noDescriptionText = t(
|
|
331
|
+
"app.api.system.unifiedInterface.cli.vibe.errors.routeNotFound",
|
|
332
|
+
);
|
|
333
|
+
|
|
334
|
+
for (const child of this.currentNode.children) {
|
|
335
|
+
if (child.type === "directory") {
|
|
336
|
+
const routeCount = this.countRoutesInDirectory(child);
|
|
337
|
+
const directoryName = `${directoryIcon} ${child.name}/ (${routeCount} ${routesText})`;
|
|
338
|
+
choices.push({
|
|
339
|
+
name: directoryName,
|
|
340
|
+
value: InteractiveRepositoryImpl.NAV_PREFIX + child.path,
|
|
341
|
+
});
|
|
342
|
+
} else if (child.type === "route" && child.route) {
|
|
343
|
+
const description = child.route.description || noDescriptionText;
|
|
344
|
+
const routeName = `${routeIcon} ${child.name} - ${description}`;
|
|
345
|
+
choices.push({
|
|
346
|
+
name: routeName,
|
|
347
|
+
value: InteractiveRepositoryImpl.EXEC_PREFIX + child.route.path,
|
|
348
|
+
});
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
if (choices.length > 0) {
|
|
354
|
+
choices.push({ name: "─────────────────────", value: "separator" });
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
const settingsIcon = t(
|
|
358
|
+
"app.api.system.unifiedInterface.cli.vibe.interactive.navigation.settingsIcon",
|
|
359
|
+
);
|
|
360
|
+
const settingsText = t(
|
|
361
|
+
"app.api.system.unifiedInterface.cli.vibe.interactive.navigation.settings",
|
|
362
|
+
);
|
|
363
|
+
const exitIcon = t(
|
|
364
|
+
"app.api.system.unifiedInterface.cli.vibe.interactive.navigation.exitIcon",
|
|
365
|
+
);
|
|
366
|
+
const exitText = t(
|
|
367
|
+
"app.api.system.unifiedInterface.cli.vibe.interactive.navigation.exit",
|
|
368
|
+
);
|
|
369
|
+
const navigateMessage = t(
|
|
370
|
+
"app.api.system.unifiedInterface.cli.vibe.interactive.navigation.navigate",
|
|
371
|
+
);
|
|
372
|
+
|
|
373
|
+
choices.push(
|
|
374
|
+
{
|
|
375
|
+
name: `${settingsIcon} ${settingsText}`,
|
|
376
|
+
value: InteractiveRepositoryImpl.SETTINGS_ACTION,
|
|
377
|
+
},
|
|
378
|
+
{
|
|
379
|
+
name: `${exitIcon} ${exitText}`,
|
|
380
|
+
value: InteractiveRepositoryImpl.EXIT_ACTION,
|
|
381
|
+
},
|
|
382
|
+
);
|
|
383
|
+
|
|
384
|
+
const action = await select({
|
|
385
|
+
message: navigateMessage,
|
|
386
|
+
choices,
|
|
387
|
+
pageSize: 15,
|
|
388
|
+
});
|
|
389
|
+
|
|
390
|
+
return action;
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
private countRoutesInDirectory(node: DirectoryNode): number {
|
|
394
|
+
let count = 0;
|
|
395
|
+
if (node.type === "route") {
|
|
396
|
+
return 1;
|
|
397
|
+
}
|
|
398
|
+
if (node.children) {
|
|
399
|
+
for (const child of node.children) {
|
|
400
|
+
count += this.countRoutesInDirectory(child);
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
return count;
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
private navigateUp(): void {
|
|
407
|
+
if (this.currentNode?.parent) {
|
|
408
|
+
this.currentNode = this.currentNode.parent;
|
|
409
|
+
this.updateBreadcrumbs();
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
private navigateToPath(targetPath: string): void {
|
|
414
|
+
if (!this.routeTree) {
|
|
415
|
+
return;
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
const targetNode = this.findNodeByPath(this.routeTree, targetPath);
|
|
419
|
+
if (targetNode) {
|
|
420
|
+
this.currentNode = targetNode;
|
|
421
|
+
this.updateBreadcrumbs();
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
private findNodeByPath(
|
|
426
|
+
node: DirectoryNode,
|
|
427
|
+
path: string,
|
|
428
|
+
): DirectoryNode | null {
|
|
429
|
+
if (node.path === path) {
|
|
430
|
+
return node;
|
|
431
|
+
}
|
|
432
|
+
if (node.children) {
|
|
433
|
+
for (const child of node.children) {
|
|
434
|
+
const found = this.findNodeByPath(child, path);
|
|
435
|
+
if (found) {
|
|
436
|
+
return found;
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
return null;
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
private async executeRouteByPath(routePath: string): Promise<void> {
|
|
444
|
+
if (!this.routeTree) {
|
|
445
|
+
return;
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
const route = this.findRouteByPath(this.routeTree, routePath);
|
|
449
|
+
if (route) {
|
|
450
|
+
await this.executeRouteWithDataDrivenUI(route);
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
private findRouteByPath(
|
|
455
|
+
node: DirectoryNode,
|
|
456
|
+
path: string,
|
|
457
|
+
): CreateApiEndpointAny | null {
|
|
458
|
+
if (node.route) {
|
|
459
|
+
const pathArray = node.route.path;
|
|
460
|
+
const routePath = Array.isArray(pathArray)
|
|
461
|
+
? pathArray.join("/")
|
|
462
|
+
: pathArray;
|
|
463
|
+
if (routePath === path) {
|
|
464
|
+
return node.route;
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
if (node.children) {
|
|
468
|
+
for (const child of node.children) {
|
|
469
|
+
const found = this.findRouteByPath(child, path);
|
|
470
|
+
if (found) {
|
|
471
|
+
return found;
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
return null;
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
private async executeRouteWithDataDrivenUI(
|
|
479
|
+
route: CreateApiEndpointAny,
|
|
480
|
+
): Promise<void> {
|
|
481
|
+
const { t } = simpleT(this.getSession().locale);
|
|
482
|
+
|
|
483
|
+
const executingText = t(
|
|
484
|
+
"app.api.system.unifiedInterface.cli.vibe.executing",
|
|
485
|
+
);
|
|
486
|
+
const routeText = t(
|
|
487
|
+
"app.api.system.unifiedInterface.cli.vibe.interactive.navigation.route",
|
|
488
|
+
);
|
|
489
|
+
const methodText = t(
|
|
490
|
+
"app.api.system.unifiedInterface.cli.vibe.interactive.navigation.method",
|
|
491
|
+
);
|
|
492
|
+
const descriptionText = t(
|
|
493
|
+
"app.api.system.unifiedInterface.cli.vibe.interactive.navigation.description",
|
|
494
|
+
);
|
|
495
|
+
|
|
496
|
+
const pathArray = route.path;
|
|
497
|
+
const routePath = Array.isArray(pathArray)
|
|
498
|
+
? pathArray.join("/")
|
|
499
|
+
: pathArray;
|
|
500
|
+
const alias =
|
|
501
|
+
route.aliases && route.aliases.length > 0 ? route.aliases[0] : undefined;
|
|
502
|
+
this.logger.info(`${executingText}: ${alias || routePath}`);
|
|
503
|
+
this.logger.info(`${routeText}: ${routePath}`);
|
|
504
|
+
this.logger.info(`${methodText}: ${route.method}`);
|
|
505
|
+
if (route.description) {
|
|
506
|
+
this.logger.info(`${descriptionText}: ${route.description}`);
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
try {
|
|
510
|
+
const endpoint = await this.getCreateApiEndpoint(route);
|
|
511
|
+
|
|
512
|
+
if (!endpoint) {
|
|
513
|
+
const noDefinitionText = t(
|
|
514
|
+
"app.api.system.unifiedInterface.cli.vibe.interactive.navigation.noDefinition",
|
|
515
|
+
);
|
|
516
|
+
this.logger.warn(noDefinitionText);
|
|
517
|
+
await this.executeRouteBasic(route);
|
|
518
|
+
return;
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
await this.generateDataDrivenForm(route, endpoint);
|
|
522
|
+
} catch (error) {
|
|
523
|
+
const executionFailedText = t(
|
|
524
|
+
"app.api.system.unifiedInterface.cli.vibe.interactive.navigation.executionFailed",
|
|
525
|
+
);
|
|
526
|
+
this.logger.error(executionFailedText, parseError(error));
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
const executeAnotherText = t(
|
|
530
|
+
"app.api.system.unifiedInterface.cli.vibe.interactive.navigation.executeAnother",
|
|
531
|
+
);
|
|
532
|
+
const shouldContinue = await confirm({
|
|
533
|
+
message: executeAnotherText,
|
|
534
|
+
default: true,
|
|
535
|
+
});
|
|
536
|
+
|
|
537
|
+
if (!shouldContinue) {
|
|
538
|
+
return;
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
private async collectLocaleSelection(): Promise<CountryLanguage> {
|
|
543
|
+
const { t } = simpleT(this.getSession().locale);
|
|
544
|
+
|
|
545
|
+
const selectLocaleText = t(
|
|
546
|
+
"app.api.system.unifiedInterface.cli.vibe.interactive.navigation.selectLocale",
|
|
547
|
+
);
|
|
548
|
+
|
|
549
|
+
const englishGlobalText = t(
|
|
550
|
+
"app.api.system.unifiedInterface.cli.vibe.interactive.navigation.englishGlobal",
|
|
551
|
+
);
|
|
552
|
+
|
|
553
|
+
const localeOptions = [
|
|
554
|
+
{ name: englishGlobalText, value: "en-GLOBAL" },
|
|
555
|
+
{ name: "German (Germany)", value: "de-DE" },
|
|
556
|
+
{ name: "Polish (Poland)", value: "pl-PL" },
|
|
557
|
+
] satisfies Array<{ name: string; value: CountryLanguage }>;
|
|
558
|
+
|
|
559
|
+
const sessionLocale = this.getSession().locale;
|
|
560
|
+
// Only use as default if it's one of the available options
|
|
561
|
+
const defaultLocale = localeOptions.some(
|
|
562
|
+
(opt) => opt.value === sessionLocale,
|
|
563
|
+
)
|
|
564
|
+
? sessionLocale
|
|
565
|
+
: undefined;
|
|
566
|
+
const locale = await select({
|
|
567
|
+
message: selectLocaleText,
|
|
568
|
+
choices: localeOptions,
|
|
569
|
+
default: defaultLocale as
|
|
570
|
+
| (typeof localeOptions)[number]["value"]
|
|
571
|
+
| undefined,
|
|
572
|
+
});
|
|
573
|
+
|
|
574
|
+
return locale as CountryLanguage;
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
private async generateDataDrivenForm(
|
|
578
|
+
route: CreateApiEndpointAny,
|
|
579
|
+
endpoint: {
|
|
580
|
+
title?: string;
|
|
581
|
+
description?: string;
|
|
582
|
+
requestSchema?: z.ZodTypeAny;
|
|
583
|
+
requestUrlPathParamsSchema?: z.ZodTypeAny;
|
|
584
|
+
},
|
|
585
|
+
): Promise<void> {
|
|
586
|
+
const routePath = route.path.join("/");
|
|
587
|
+
const alias =
|
|
588
|
+
route.aliases && route.aliases.length > 0 ? route.aliases[0] : undefined;
|
|
589
|
+
const title = endpoint.title || alias || routePath;
|
|
590
|
+
|
|
591
|
+
this.logger.info(title);
|
|
592
|
+
if (endpoint.description) {
|
|
593
|
+
this.logger.info(endpoint.description);
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
const selectedLocale = await this.collectLocaleSelection();
|
|
597
|
+
this.getSession().locale = selectedLocale;
|
|
598
|
+
|
|
599
|
+
const { t: tSelected } = simpleT(selectedLocale);
|
|
600
|
+
|
|
601
|
+
let requestData = {};
|
|
602
|
+
if (endpoint.requestSchema && !this.isEmptySchema(endpoint.requestSchema)) {
|
|
603
|
+
const requestDataText = tSelected(
|
|
604
|
+
"app.api.system.unifiedInterface.cli.vibe.interactive.navigation.requestData",
|
|
605
|
+
);
|
|
606
|
+
this.logger.info(requestDataText);
|
|
607
|
+
requestData = await this.generateFormFromSchema(
|
|
608
|
+
endpoint.requestSchema,
|
|
609
|
+
requestDataText,
|
|
610
|
+
);
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
let urlPathParams = {};
|
|
614
|
+
if (
|
|
615
|
+
endpoint.requestUrlPathParamsSchema &&
|
|
616
|
+
!this.isEmptySchema(endpoint.requestUrlPathParamsSchema)
|
|
617
|
+
) {
|
|
618
|
+
const urlParametersText = tSelected(
|
|
619
|
+
"app.api.system.unifiedInterface.cli.vibe.interactive.navigation.urlParameters",
|
|
620
|
+
);
|
|
621
|
+
this.logger.info(urlParametersText);
|
|
622
|
+
urlPathParams = await this.generateFormFromSchema(
|
|
623
|
+
endpoint.requestUrlPathParamsSchema,
|
|
624
|
+
urlParametersText,
|
|
625
|
+
);
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
if (
|
|
629
|
+
Object.keys(requestData).length > 0 ||
|
|
630
|
+
Object.keys(urlPathParams).length > 0
|
|
631
|
+
) {
|
|
632
|
+
const previewText = tSelected(
|
|
633
|
+
"app.api.system.unifiedInterface.cli.vibe.interactive.navigation.preview",
|
|
634
|
+
);
|
|
635
|
+
const requestDataText = tSelected(
|
|
636
|
+
"app.api.system.unifiedInterface.cli.vibe.interactive.navigation.requestData",
|
|
637
|
+
);
|
|
638
|
+
const urlParametersText = tSelected(
|
|
639
|
+
"app.api.system.unifiedInterface.cli.vibe.interactive.navigation.urlParameters",
|
|
640
|
+
);
|
|
641
|
+
const executeWithParamsText = tSelected(
|
|
642
|
+
"app.api.system.unifiedInterface.cli.vibe.interactive.navigation.executeWithParams",
|
|
643
|
+
);
|
|
644
|
+
|
|
645
|
+
this.logger.info(previewText);
|
|
646
|
+
if (Object.keys(requestData).length > 0) {
|
|
647
|
+
this.logger.info(
|
|
648
|
+
`${requestDataText}: ${JSON.stringify(requestData, null, 2)}`,
|
|
649
|
+
);
|
|
650
|
+
}
|
|
651
|
+
if (Object.keys(urlPathParams).length > 0) {
|
|
652
|
+
this.logger.info(
|
|
653
|
+
`${urlParametersText}: ${JSON.stringify(urlPathParams, null, 2)}`,
|
|
654
|
+
);
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
const shouldExecute = await confirm({
|
|
658
|
+
message: executeWithParamsText,
|
|
659
|
+
default: true,
|
|
660
|
+
});
|
|
661
|
+
|
|
662
|
+
if (!shouldExecute) {
|
|
663
|
+
return;
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
await this.executeRouteWithData(route, requestData, urlPathParams);
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
private async generateFormFromSchema(
|
|
671
|
+
schema: z.ZodTypeAny,
|
|
672
|
+
title: string,
|
|
673
|
+
): Promise<Record<string, string | number | boolean>> {
|
|
674
|
+
try {
|
|
675
|
+
const fields = schemaUIHandler.parseSchema(schema);
|
|
676
|
+
const config = {
|
|
677
|
+
title,
|
|
678
|
+
fields,
|
|
679
|
+
};
|
|
680
|
+
|
|
681
|
+
const result = await schemaUIHandler.generateForm(config);
|
|
682
|
+
return result as Record<string, string | number | boolean>;
|
|
683
|
+
} catch (error) {
|
|
684
|
+
this.logger.warn(`Failed to generate form for ${title}`, {
|
|
685
|
+
errorMessage: parseError(error).message,
|
|
686
|
+
});
|
|
687
|
+
return {};
|
|
688
|
+
}
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
private isEmptySchema(schema: z.ZodTypeAny | undefined): boolean {
|
|
692
|
+
if (!schema) {
|
|
693
|
+
return true;
|
|
694
|
+
}
|
|
695
|
+
|
|
696
|
+
const schemaWithDef = schema as {
|
|
697
|
+
_def?: { typeName?: string; shape?: Record<string, z.ZodTypeAny> };
|
|
698
|
+
};
|
|
699
|
+
const typeName = schemaWithDef._def?.typeName;
|
|
700
|
+
if (typeName === "ZodUndefined" || typeName === "ZodVoid") {
|
|
701
|
+
return true;
|
|
702
|
+
}
|
|
703
|
+
|
|
704
|
+
if (typeName === "ZodObject") {
|
|
705
|
+
const shape = schemaWithDef._def?.shape || {};
|
|
706
|
+
return Object.keys(shape).length === 0;
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
return false;
|
|
710
|
+
}
|
|
711
|
+
|
|
712
|
+
private async getCreateApiEndpoint(
|
|
713
|
+
route: CreateApiEndpointAny,
|
|
714
|
+
): Promise<CreateApiEndpointAny | null> {
|
|
715
|
+
const { definitionLoader } =
|
|
716
|
+
await import("../../unified-interface/shared/endpoints/definition/loader");
|
|
717
|
+
|
|
718
|
+
const routePath = route.path.join("/");
|
|
719
|
+
const alias =
|
|
720
|
+
route.aliases && route.aliases.length > 0 ? route.aliases[0] : undefined;
|
|
721
|
+
const resolvedCommand = alias || routePath;
|
|
722
|
+
const result = await definitionLoader.load({
|
|
723
|
+
identifier: resolvedCommand,
|
|
724
|
+
platform: this.session.platform,
|
|
725
|
+
user: this.session.user,
|
|
726
|
+
logger: this.logger,
|
|
727
|
+
});
|
|
728
|
+
|
|
729
|
+
if (!result.success) {
|
|
730
|
+
this.logger.warn(`Failed to load endpoint definition for ${routePath}`, {
|
|
731
|
+
error: result.message,
|
|
732
|
+
});
|
|
733
|
+
return null;
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
return result.data;
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
private async executeRouteWithData(
|
|
740
|
+
route: CreateApiEndpointAny,
|
|
741
|
+
requestData: Record<string, string | number | boolean>,
|
|
742
|
+
urlPathParams: Record<string, string | number | boolean>,
|
|
743
|
+
): Promise<void> {
|
|
744
|
+
const session = this.getSession();
|
|
745
|
+
// resolvedCommand can be either the alias or the full toolName
|
|
746
|
+
const toolName = endpointToToolName(route);
|
|
747
|
+
const resolvedCommand = (route.aliases && route.aliases[0]) || toolName;
|
|
748
|
+
const context: RouteExecutionContext = {
|
|
749
|
+
toolName: resolvedCommand,
|
|
750
|
+
data: requestData,
|
|
751
|
+
urlPathParams: urlPathParams,
|
|
752
|
+
user: session.user,
|
|
753
|
+
locale: session.locale,
|
|
754
|
+
timestamp: Date.now(),
|
|
755
|
+
options: session.options,
|
|
756
|
+
logger: this.logger,
|
|
757
|
+
platform: session.platform,
|
|
758
|
+
};
|
|
759
|
+
|
|
760
|
+
try {
|
|
761
|
+
const result = await routeDelegationHandler.executeRoute(
|
|
762
|
+
resolvedCommand,
|
|
763
|
+
context,
|
|
764
|
+
this.logger,
|
|
765
|
+
session.locale,
|
|
766
|
+
);
|
|
767
|
+
|
|
768
|
+
const endpointDefinition = await this.getCreateApiEndpoint(route);
|
|
769
|
+
|
|
770
|
+
const formattedResult = routeDelegationHandler.formatResult(
|
|
771
|
+
result,
|
|
772
|
+
session.options?.output || "pretty",
|
|
773
|
+
endpointDefinition,
|
|
774
|
+
session.locale,
|
|
775
|
+
session.options?.verbose || false,
|
|
776
|
+
this.logger,
|
|
777
|
+
);
|
|
778
|
+
|
|
779
|
+
this.logger.info(formattedResult);
|
|
780
|
+
} catch (error) {
|
|
781
|
+
const { t } = simpleT(session.locale);
|
|
782
|
+
const executionFailedText = t(
|
|
783
|
+
"app.api.system.unifiedInterface.cli.vibe.interactive.navigation.executionFailed",
|
|
784
|
+
);
|
|
785
|
+
this.logger.error(executionFailedText, parseError(error));
|
|
786
|
+
}
|
|
787
|
+
}
|
|
788
|
+
|
|
789
|
+
private async executeRouteBasic(route: CreateApiEndpointAny): Promise<void> {
|
|
790
|
+
const session = this.getSession();
|
|
791
|
+
// resolvedCommand can be either the alias or the full toolName
|
|
792
|
+
const toolName = endpointToToolName(route);
|
|
793
|
+
const resolvedCommand = (route.aliases && route.aliases[0]) || toolName;
|
|
794
|
+
const context: RouteExecutionContext = {
|
|
795
|
+
toolName: resolvedCommand,
|
|
796
|
+
data: {},
|
|
797
|
+
user: session.user,
|
|
798
|
+
locale: session.locale,
|
|
799
|
+
timestamp: Date.now(),
|
|
800
|
+
options: session.options,
|
|
801
|
+
logger: this.logger,
|
|
802
|
+
platform: session.platform,
|
|
803
|
+
};
|
|
804
|
+
|
|
805
|
+
try {
|
|
806
|
+
const result = await routeDelegationHandler.executeRoute(
|
|
807
|
+
resolvedCommand,
|
|
808
|
+
context,
|
|
809
|
+
this.logger,
|
|
810
|
+
session.locale,
|
|
811
|
+
);
|
|
812
|
+
|
|
813
|
+
const endpointDefinition = await this.getCreateApiEndpoint(route);
|
|
814
|
+
|
|
815
|
+
const formattedResult = routeDelegationHandler.formatResult(
|
|
816
|
+
result,
|
|
817
|
+
session.options?.output || "pretty",
|
|
818
|
+
endpointDefinition,
|
|
819
|
+
session.locale,
|
|
820
|
+
session.options?.verbose || false,
|
|
821
|
+
this.logger,
|
|
822
|
+
);
|
|
823
|
+
|
|
824
|
+
this.logger.info(formattedResult);
|
|
825
|
+
} catch (error) {
|
|
826
|
+
const { t } = simpleT(session.locale);
|
|
827
|
+
const executionFailedText = t(
|
|
828
|
+
"app.api.system.unifiedInterface.cli.vibe.interactive.navigation.executionFailed",
|
|
829
|
+
);
|
|
830
|
+
this.logger.error(executionFailedText, parseError(error));
|
|
831
|
+
}
|
|
832
|
+
}
|
|
833
|
+
|
|
834
|
+
private async navigationLoop(): Promise<void> {
|
|
835
|
+
while (true) {
|
|
836
|
+
try {
|
|
837
|
+
const action = await this.showNavigationMenu();
|
|
838
|
+
|
|
839
|
+
if (action === InteractiveRepositoryImpl.EXIT_ACTION) {
|
|
840
|
+
const { t } = simpleT(this.getSession().locale);
|
|
841
|
+
const goodbyeText = t(
|
|
842
|
+
"app.api.system.unifiedInterface.cli.vibe.interactive.goodbye",
|
|
843
|
+
);
|
|
844
|
+
this.logger.info(goodbyeText);
|
|
845
|
+
break;
|
|
846
|
+
} else if (action === "separator") {
|
|
847
|
+
continue;
|
|
848
|
+
} else if (action === InteractiveRepositoryImpl.SETTINGS_ACTION) {
|
|
849
|
+
await this.showSettingsMenu();
|
|
850
|
+
} else if (action === InteractiveRepositoryImpl.UP_ACTION) {
|
|
851
|
+
this.navigateUp();
|
|
852
|
+
} else if (action.startsWith(InteractiveRepositoryImpl.NAV_PREFIX)) {
|
|
853
|
+
const targetPath = action.replace(
|
|
854
|
+
InteractiveRepositoryImpl.NAV_PREFIX,
|
|
855
|
+
"",
|
|
856
|
+
);
|
|
857
|
+
this.navigateToPath(targetPath);
|
|
858
|
+
} else if (action.startsWith(InteractiveRepositoryImpl.EXEC_PREFIX)) {
|
|
859
|
+
const routePath = action.replace(
|
|
860
|
+
InteractiveRepositoryImpl.EXEC_PREFIX,
|
|
861
|
+
"",
|
|
862
|
+
);
|
|
863
|
+
await this.executeRouteByPath(routePath);
|
|
864
|
+
}
|
|
865
|
+
} catch (error) {
|
|
866
|
+
const { t } = simpleT(this.getSession().locale);
|
|
867
|
+
const navigationErrorText = t(
|
|
868
|
+
"app.api.system.unifiedInterface.cli.vibe.interactive.navigation.navigationError",
|
|
869
|
+
);
|
|
870
|
+
this.logger.error(navigationErrorText, parseError(error));
|
|
871
|
+
}
|
|
872
|
+
}
|
|
873
|
+
}
|
|
874
|
+
|
|
875
|
+
private async showSettingsMenu(): Promise<void> {
|
|
876
|
+
const session = this.getSession();
|
|
877
|
+
const { t } = simpleT(session.locale);
|
|
878
|
+
|
|
879
|
+
const chooseSettingText = t(
|
|
880
|
+
"app.api.system.unifiedInterface.cli.vibe.interactive.navigation.chooseSettingToModify",
|
|
881
|
+
);
|
|
882
|
+
const outputFormatText = t(
|
|
883
|
+
"app.api.system.unifiedInterface.cli.vibe.interactive.navigation.outputFormatCurrent",
|
|
884
|
+
);
|
|
885
|
+
const verboseModeText = t(
|
|
886
|
+
"app.api.system.unifiedInterface.cli.vibe.interactive.navigation.verboseModeCurrent",
|
|
887
|
+
);
|
|
888
|
+
const localeText = t(
|
|
889
|
+
"app.api.system.unifiedInterface.cli.vibe.interactive.navigation.localeCurrent",
|
|
890
|
+
);
|
|
891
|
+
const backToMainMenuText = t(
|
|
892
|
+
"app.api.system.unifiedInterface.cli.vibe.interactive.navigation.backToMainMenu",
|
|
893
|
+
);
|
|
894
|
+
|
|
895
|
+
const setting = await select({
|
|
896
|
+
message: chooseSettingText,
|
|
897
|
+
choices: [
|
|
898
|
+
{
|
|
899
|
+
name: outputFormatText.replace(
|
|
900
|
+
InteractiveRepositoryImpl.CURRENT_PLACEHOLDER,
|
|
901
|
+
session.options?.output || "",
|
|
902
|
+
),
|
|
903
|
+
value: "output",
|
|
904
|
+
},
|
|
905
|
+
{
|
|
906
|
+
name: verboseModeText.replace(
|
|
907
|
+
InteractiveRepositoryImpl.CURRENT_PLACEHOLDER,
|
|
908
|
+
String(session.options?.verbose || false),
|
|
909
|
+
),
|
|
910
|
+
value: "verbose",
|
|
911
|
+
},
|
|
912
|
+
{
|
|
913
|
+
name: localeText.replace(
|
|
914
|
+
InteractiveRepositoryImpl.CURRENT_PLACEHOLDER,
|
|
915
|
+
session.locale || "",
|
|
916
|
+
),
|
|
917
|
+
value: "locale",
|
|
918
|
+
},
|
|
919
|
+
{ name: backToMainMenuText, value: "back" },
|
|
920
|
+
],
|
|
921
|
+
});
|
|
922
|
+
|
|
923
|
+
if (setting === "back") {
|
|
924
|
+
return;
|
|
925
|
+
}
|
|
926
|
+
|
|
927
|
+
await this.updateSetting(setting);
|
|
928
|
+
}
|
|
929
|
+
|
|
930
|
+
private async updateSetting(setting: string): Promise<void> {
|
|
931
|
+
const session = this.getSession();
|
|
932
|
+
|
|
933
|
+
switch (setting) {
|
|
934
|
+
case "output": {
|
|
935
|
+
const { t } = simpleT(session.locale);
|
|
936
|
+
const chooseOutputFormatText = t(
|
|
937
|
+
"app.api.system.unifiedInterface.cli.vibe.interactive.navigation.chooseOutputFormat",
|
|
938
|
+
);
|
|
939
|
+
const prettyFormattedText = t(
|
|
940
|
+
"app.api.system.unifiedInterface.cli.vibe.interactive.navigation.prettyFormatted",
|
|
941
|
+
);
|
|
942
|
+
const jsonRawText = t(
|
|
943
|
+
"app.api.system.unifiedInterface.cli.vibe.interactive.navigation.jsonRaw",
|
|
944
|
+
);
|
|
945
|
+
|
|
946
|
+
const output = await select({
|
|
947
|
+
message: chooseOutputFormatText,
|
|
948
|
+
choices: [
|
|
949
|
+
{ name: prettyFormattedText, value: "pretty" },
|
|
950
|
+
{ name: jsonRawText, value: "json" },
|
|
951
|
+
],
|
|
952
|
+
default: session.options?.output,
|
|
953
|
+
});
|
|
954
|
+
session.options = {
|
|
955
|
+
...session.options,
|
|
956
|
+
output: output as "json" | "pretty",
|
|
957
|
+
};
|
|
958
|
+
break;
|
|
959
|
+
}
|
|
960
|
+
|
|
961
|
+
case "verbose": {
|
|
962
|
+
const { t } = simpleT(session.locale);
|
|
963
|
+
const enableVerboseOutputText = t(
|
|
964
|
+
"app.api.system.unifiedInterface.cli.vibe.interactive.navigation.enableVerboseOutput",
|
|
965
|
+
);
|
|
966
|
+
|
|
967
|
+
const verbose = await confirm({
|
|
968
|
+
message: enableVerboseOutputText,
|
|
969
|
+
default: session.options?.verbose,
|
|
970
|
+
});
|
|
971
|
+
session.options = {
|
|
972
|
+
...session.options,
|
|
973
|
+
verbose: verbose,
|
|
974
|
+
};
|
|
975
|
+
break;
|
|
976
|
+
}
|
|
977
|
+
|
|
978
|
+
case "locale": {
|
|
979
|
+
const { t } = simpleT(session.locale);
|
|
980
|
+
const chooseLocaleText = t(
|
|
981
|
+
"app.api.system.unifiedInterface.cli.vibe.interactive.navigation.chooseLocale",
|
|
982
|
+
);
|
|
983
|
+
const englishGlobalText = t(
|
|
984
|
+
"app.api.system.unifiedInterface.cli.vibe.interactive.navigation.englishGlobal",
|
|
985
|
+
);
|
|
986
|
+
const germanText = t(
|
|
987
|
+
"app.api.system.unifiedInterface.cli.vibe.interactive.navigation.german",
|
|
988
|
+
);
|
|
989
|
+
const polishText = t(
|
|
990
|
+
"app.api.system.unifiedInterface.cli.vibe.interactive.navigation.polish",
|
|
991
|
+
);
|
|
992
|
+
|
|
993
|
+
const localeChoices = [
|
|
994
|
+
{ name: englishGlobalText, value: "en-GLOBAL" },
|
|
995
|
+
{ name: germanText, value: "de-DE" },
|
|
996
|
+
{ name: polishText, value: "pl-PL" },
|
|
997
|
+
] satisfies Array<{ name: string; value: CountryLanguage }>;
|
|
998
|
+
// Only use as default if it's one of the available options
|
|
999
|
+
const defaultLocale = localeChoices.some(
|
|
1000
|
+
(opt) => opt.value === session.locale,
|
|
1001
|
+
)
|
|
1002
|
+
? session.locale
|
|
1003
|
+
: undefined;
|
|
1004
|
+
const locale = await select({
|
|
1005
|
+
message: chooseLocaleText,
|
|
1006
|
+
choices: localeChoices,
|
|
1007
|
+
default: defaultLocale as
|
|
1008
|
+
| (typeof localeChoices)[number]["value"]
|
|
1009
|
+
| undefined,
|
|
1010
|
+
});
|
|
1011
|
+
session.locale = locale as CountryLanguage;
|
|
1012
|
+
break;
|
|
1013
|
+
}
|
|
1014
|
+
}
|
|
1015
|
+
|
|
1016
|
+
const { t } = simpleT(session.locale);
|
|
1017
|
+
const settingUpdatedText = t(
|
|
1018
|
+
"app.api.system.unifiedInterface.cli.vibe.interactive.navigation.settingUpdated",
|
|
1019
|
+
);
|
|
1020
|
+
this.logger.info(settingUpdatedText);
|
|
1021
|
+
}
|
|
1022
|
+
}
|
|
1023
|
+
|
|
1024
|
+
export const interactiveRepository: InteractiveRepository =
|
|
1025
|
+
new InteractiveRepositoryImpl();
|