@codemieai/code 0.0.15 → 0.0.17
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/README.md +86 -14
- package/bin/agent-executor.js +7 -28
- package/bin/codemie-claude.js +18 -0
- package/bin/codemie-codex.js +18 -0
- package/bin/codemie-deepagents.js +18 -0
- package/bin/codemie-gemini.js +18 -0
- package/dist/agents/codemie-code/agent.d.ts.map +1 -1
- package/dist/agents/codemie-code/agent.js +5 -34
- package/dist/agents/codemie-code/agent.js.map +1 -1
- package/dist/agents/codemie-code/config.d.ts.map +1 -1
- package/dist/agents/codemie-code/config.js +12 -4
- package/dist/agents/codemie-code/config.js.map +1 -1
- package/dist/agents/codemie-code/tools/planning.d.ts +1 -1
- package/dist/agents/core/AgentCLI.d.ts.map +1 -1
- package/dist/agents/core/AgentCLI.js +30 -63
- package/dist/agents/core/AgentCLI.js.map +1 -1
- package/dist/agents/core/BaseAgentAdapter.d.ts +10 -6
- package/dist/agents/core/BaseAgentAdapter.d.ts.map +1 -1
- package/dist/agents/core/BaseAgentAdapter.js +108 -36
- package/dist/agents/core/BaseAgentAdapter.js.map +1 -1
- package/dist/agents/core/BaseMetricsAdapter.d.ts +64 -0
- package/dist/agents/core/BaseMetricsAdapter.d.ts.map +1 -0
- package/dist/agents/core/BaseMetricsAdapter.js +74 -0
- package/dist/agents/core/BaseMetricsAdapter.js.map +1 -0
- package/dist/agents/core/types.d.ts +1 -0
- package/dist/agents/core/types.d.ts.map +1 -1
- package/dist/agents/plugins/claude.metrics.d.ts +112 -0
- package/dist/agents/plugins/claude.metrics.d.ts.map +1 -0
- package/dist/agents/plugins/claude.metrics.js +700 -0
- package/dist/agents/plugins/claude.metrics.js.map +1 -0
- package/dist/agents/plugins/claude.plugin.d.ts +9 -0
- package/dist/agents/plugins/claude.plugin.d.ts.map +1 -1
- package/dist/agents/plugins/claude.plugin.js +52 -10
- package/dist/agents/plugins/claude.plugin.js.map +1 -1
- package/dist/agents/plugins/codemie-code.plugin.d.ts.map +1 -1
- package/dist/agents/plugins/codemie-code.plugin.js +46 -14
- package/dist/agents/plugins/codemie-code.plugin.js.map +1 -1
- package/dist/agents/plugins/codex.plugin.d.ts.map +1 -1
- package/dist/agents/plugins/codex.plugin.js +2 -4
- package/dist/agents/plugins/codex.plugin.js.map +1 -1
- package/dist/agents/plugins/deepagents.plugin.js +1 -1
- package/dist/agents/plugins/deepagents.plugin.js.map +1 -1
- package/dist/agents/plugins/gemini.plugin.d.ts.map +1 -1
- package/dist/agents/plugins/gemini.plugin.js +1 -8
- package/dist/agents/plugins/gemini.plugin.js.map +1 -1
- package/dist/agents/plugins/history-parser.d.ts +52 -0
- package/dist/agents/plugins/history-parser.d.ts.map +1 -0
- package/dist/agents/plugins/history-parser.js +155 -0
- package/dist/agents/plugins/history-parser.js.map +1 -0
- package/dist/cli/commands/analytics/aggregator.d.ts +58 -0
- package/dist/cli/commands/analytics/aggregator.d.ts.map +1 -0
- package/dist/cli/commands/analytics/aggregator.js +702 -0
- package/dist/cli/commands/analytics/aggregator.js.map +1 -0
- package/dist/cli/commands/analytics/data-loader.d.ts +84 -0
- package/dist/cli/commands/analytics/data-loader.d.ts.map +1 -0
- package/dist/cli/commands/analytics/data-loader.js +211 -0
- package/dist/cli/commands/analytics/data-loader.js.map +1 -0
- package/dist/cli/commands/analytics/exporter.d.ts +20 -0
- package/dist/cli/commands/analytics/exporter.d.ts.map +1 -0
- package/dist/cli/commands/analytics/exporter.js +103 -0
- package/dist/cli/commands/analytics/exporter.js.map +1 -0
- package/dist/cli/commands/analytics/formatter.d.ts +49 -0
- package/dist/cli/commands/analytics/formatter.d.ts.map +1 -0
- package/dist/cli/commands/analytics/formatter.js +309 -0
- package/dist/cli/commands/analytics/formatter.js.map +1 -0
- package/dist/cli/commands/analytics/index.d.ts +6 -0
- package/dist/cli/commands/analytics/index.d.ts.map +1 -0
- package/dist/cli/commands/analytics/index.js +157 -0
- package/dist/cli/commands/analytics/index.js.map +1 -0
- package/dist/cli/commands/analytics/model-normalizer.d.ts +21 -0
- package/dist/cli/commands/analytics/model-normalizer.d.ts.map +1 -0
- package/dist/cli/commands/analytics/model-normalizer.js +44 -0
- package/dist/cli/commands/analytics/model-normalizer.js.map +1 -0
- package/dist/cli/commands/analytics/types.d.ts +188 -0
- package/dist/cli/commands/analytics/types.d.ts.map +1 -0
- package/dist/cli/commands/analytics/types.js +6 -0
- package/dist/cli/commands/analytics/types.js.map +1 -0
- package/dist/cli/commands/auth.d.ts.map +1 -1
- package/dist/cli/commands/auth.js +10 -5
- package/dist/cli/commands/auth.js.map +1 -1
- package/dist/cli/commands/doctor/checks/AIConfigCheck.d.ts.map +1 -1
- package/dist/cli/commands/doctor/checks/AIConfigCheck.js +12 -5
- package/dist/cli/commands/doctor/checks/AIConfigCheck.js.map +1 -1
- package/dist/cli/commands/doctor/checks/AwsCliCheck.d.ts +9 -0
- package/dist/cli/commands/doctor/checks/AwsCliCheck.d.ts.map +1 -0
- package/dist/cli/commands/doctor/checks/AwsCliCheck.js +28 -0
- package/dist/cli/commands/doctor/checks/AwsCliCheck.js.map +1 -0
- package/dist/cli/commands/doctor/checks/PythonCheck.d.ts.map +1 -1
- package/dist/cli/commands/doctor/checks/PythonCheck.js +10 -0
- package/dist/cli/commands/doctor/checks/PythonCheck.js.map +1 -1
- package/dist/cli/commands/doctor/checks/WorkflowsCheck.d.ts.map +1 -1
- package/dist/cli/commands/doctor/checks/WorkflowsCheck.js +2 -1
- package/dist/cli/commands/doctor/checks/WorkflowsCheck.js.map +1 -1
- package/dist/cli/commands/doctor/checks/index.d.ts +1 -0
- package/dist/cli/commands/doctor/checks/index.d.ts.map +1 -1
- package/dist/cli/commands/doctor/checks/index.js +1 -0
- package/dist/cli/commands/doctor/checks/index.js.map +1 -1
- package/dist/cli/commands/doctor/formatter.d.ts +1 -1
- package/dist/cli/commands/doctor/formatter.d.ts.map +1 -1
- package/dist/cli/commands/doctor/formatter.js +1 -6
- package/dist/cli/commands/doctor/formatter.js.map +1 -1
- package/dist/cli/commands/doctor/index.d.ts.map +1 -1
- package/dist/cli/commands/doctor/index.js +107 -10
- package/dist/cli/commands/doctor/index.js.map +1 -1
- package/dist/cli/commands/doctor/type-adapters.d.ts +18 -0
- package/dist/cli/commands/doctor/type-adapters.d.ts.map +1 -0
- package/dist/cli/commands/doctor/type-adapters.js +75 -0
- package/dist/cli/commands/doctor/type-adapters.js.map +1 -0
- package/dist/cli/commands/install.d.ts.map +1 -1
- package/dist/cli/commands/install.js +1 -6
- package/dist/cli/commands/install.js.map +1 -1
- package/dist/cli/commands/list.d.ts.map +1 -1
- package/dist/cli/commands/list.js +0 -5
- package/dist/cli/commands/list.js.map +1 -1
- package/dist/cli/commands/profile.d.ts.map +1 -1
- package/dist/cli/commands/profile.js +130 -92
- package/dist/cli/commands/profile.js.map +1 -1
- package/dist/cli/commands/setup.d.ts.map +1 -1
- package/dist/cli/commands/setup.js +147 -668
- package/dist/cli/commands/setup.js.map +1 -1
- package/dist/cli/index.d.ts +1 -1
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +5 -2
- package/dist/cli/index.js.map +1 -1
- package/dist/env/types.d.ts +14 -2
- package/dist/env/types.d.ts.map +1 -1
- package/dist/env/types.js.map +1 -1
- package/dist/metrics/MetricsOrchestrator.d.ts +67 -0
- package/dist/metrics/MetricsOrchestrator.d.ts.map +1 -0
- package/dist/metrics/MetricsOrchestrator.js +287 -0
- package/dist/metrics/MetricsOrchestrator.js.map +1 -0
- package/dist/metrics/config.d.ts +38 -0
- package/dist/metrics/config.d.ts.map +1 -0
- package/dist/metrics/config.js +80 -0
- package/dist/metrics/config.js.map +1 -0
- package/dist/metrics/core/DeltaWriter.d.ts +49 -0
- package/dist/metrics/core/DeltaWriter.d.ts.map +1 -0
- package/dist/metrics/core/DeltaWriter.js +146 -0
- package/dist/metrics/core/DeltaWriter.js.map +1 -0
- package/dist/metrics/core/FileSnapshotter.d.ts +22 -0
- package/dist/metrics/core/FileSnapshotter.d.ts.map +1 -0
- package/dist/metrics/core/FileSnapshotter.js +74 -0
- package/dist/metrics/core/FileSnapshotter.js.map +1 -0
- package/dist/metrics/core/SessionCorrelator.d.ts +34 -0
- package/dist/metrics/core/SessionCorrelator.d.ts.map +1 -0
- package/dist/metrics/core/SessionCorrelator.js +115 -0
- package/dist/metrics/core/SessionCorrelator.js.map +1 -0
- package/dist/metrics/core/SyncStateManager.d.ts +69 -0
- package/dist/metrics/core/SyncStateManager.d.ts.map +1 -0
- package/dist/metrics/core/SyncStateManager.js +284 -0
- package/dist/metrics/core/SyncStateManager.js.map +1 -0
- package/dist/metrics/index.d.ts +9 -0
- package/dist/metrics/index.d.ts.map +1 -0
- package/dist/metrics/index.js +11 -0
- package/dist/metrics/index.js.map +1 -0
- package/dist/metrics/session/SessionStore.d.ts +43 -0
- package/dist/metrics/session/SessionStore.d.ts.map +1 -0
- package/dist/metrics/session/SessionStore.js +142 -0
- package/dist/metrics/session/SessionStore.js.map +1 -0
- package/dist/metrics/sync/MetricsApiClient.d.ts +32 -0
- package/dist/metrics/sync/MetricsApiClient.d.ts.map +1 -0
- package/dist/metrics/sync/MetricsApiClient.js +155 -0
- package/dist/metrics/sync/MetricsApiClient.js.map +1 -0
- package/dist/metrics/sync/aggregator.d.ts +13 -0
- package/dist/metrics/sync/aggregator.d.ts.map +1 -0
- package/dist/metrics/sync/aggregator.js +196 -0
- package/dist/metrics/sync/aggregator.js.map +1 -0
- package/dist/metrics/sync/index.d.ts +10 -0
- package/dist/metrics/sync/index.d.ts.map +1 -0
- package/dist/metrics/sync/index.js +10 -0
- package/dist/metrics/sync/index.js.map +1 -0
- package/dist/metrics/sync/jsonl-writer.d.ts +28 -0
- package/dist/metrics/sync/jsonl-writer.d.ts.map +1 -0
- package/dist/metrics/sync/jsonl-writer.js +72 -0
- package/dist/metrics/sync/jsonl-writer.js.map +1 -0
- package/dist/metrics/sync/types.d.ts +72 -0
- package/dist/metrics/sync/types.d.ts.map +1 -0
- package/dist/metrics/sync/types.js +7 -0
- package/dist/metrics/sync/types.js.map +1 -0
- package/dist/metrics/types.d.ts +308 -0
- package/dist/metrics/types.d.ts.map +1 -0
- package/dist/metrics/types.js +8 -0
- package/dist/metrics/types.js.map +1 -0
- package/dist/providers/core/base/BaseHealthCheck.d.ts +57 -0
- package/dist/providers/core/base/BaseHealthCheck.d.ts.map +1 -0
- package/dist/providers/core/base/BaseHealthCheck.js +121 -0
- package/dist/providers/core/base/BaseHealthCheck.js.map +1 -0
- package/dist/providers/core/base/BaseModelProxy.d.ts +45 -0
- package/dist/providers/core/base/BaseModelProxy.d.ts.map +1 -0
- package/dist/providers/core/base/BaseModelProxy.js +43 -0
- package/dist/providers/core/base/BaseModelProxy.js.map +1 -0
- package/dist/providers/core/base/http-client.d.ts +57 -0
- package/dist/providers/core/base/http-client.d.ts.map +1 -0
- package/dist/providers/core/base/http-client.js +240 -0
- package/dist/providers/core/base/http-client.js.map +1 -0
- package/dist/providers/core/decorators.d.ts +13 -0
- package/dist/providers/core/decorators.d.ts.map +1 -0
- package/dist/providers/core/decorators.js +15 -0
- package/dist/providers/core/decorators.js.map +1 -0
- package/dist/providers/core/index.d.ts +13 -0
- package/dist/providers/core/index.d.ts.map +1 -0
- package/dist/providers/core/index.js +14 -0
- package/dist/providers/core/index.js.map +1 -0
- package/dist/providers/core/registry.d.ts +66 -0
- package/dist/providers/core/registry.d.ts.map +1 -0
- package/dist/providers/core/registry.js +105 -0
- package/dist/providers/core/registry.js.map +1 -0
- package/dist/providers/core/types.d.ts +285 -0
- package/dist/providers/core/types.d.ts.map +1 -0
- package/dist/providers/core/types.js +7 -0
- package/dist/providers/core/types.js.map +1 -0
- package/dist/providers/index.d.ts +22 -0
- package/dist/providers/index.d.ts.map +1 -0
- package/dist/providers/index.js +24 -0
- package/dist/providers/index.js.map +1 -0
- package/dist/providers/integration/setup-ui.d.ts +76 -0
- package/dist/providers/integration/setup-ui.d.ts.map +1 -0
- package/dist/providers/integration/setup-ui.js +186 -0
- package/dist/providers/integration/setup-ui.js.map +1 -0
- package/dist/providers/plugins/bedrock/bedrock.health.d.ts +53 -0
- package/dist/providers/plugins/bedrock/bedrock.health.d.ts.map +1 -0
- package/dist/providers/plugins/bedrock/bedrock.health.js +115 -0
- package/dist/providers/plugins/bedrock/bedrock.health.js.map +1 -0
- package/dist/providers/plugins/bedrock/bedrock.models.d.ts +26 -0
- package/dist/providers/plugins/bedrock/bedrock.models.d.ts.map +1 -0
- package/dist/providers/plugins/bedrock/bedrock.models.js +89 -0
- package/dist/providers/plugins/bedrock/bedrock.models.js.map +1 -0
- package/dist/providers/plugins/bedrock/bedrock.setup-steps.d.ts +12 -0
- package/dist/providers/plugins/bedrock/bedrock.setup-steps.d.ts.map +1 -0
- package/dist/providers/plugins/bedrock/bedrock.setup-steps.js +308 -0
- package/dist/providers/plugins/bedrock/bedrock.setup-steps.js.map +1 -0
- package/dist/providers/plugins/bedrock/bedrock.template.d.ts +11 -0
- package/dist/providers/plugins/bedrock/bedrock.template.d.ts.map +1 -0
- package/dist/providers/plugins/bedrock/bedrock.template.js +85 -0
- package/dist/providers/plugins/bedrock/bedrock.template.js.map +1 -0
- package/dist/providers/plugins/bedrock/index.d.ts +11 -0
- package/dist/providers/plugins/bedrock/index.d.ts.map +1 -0
- package/dist/providers/plugins/bedrock/index.js +11 -0
- package/dist/providers/plugins/bedrock/index.js.map +1 -0
- package/dist/providers/plugins/litellm/index.d.ts +8 -0
- package/dist/providers/plugins/litellm/index.d.ts.map +1 -0
- package/dist/providers/plugins/litellm/index.js +12 -0
- package/dist/providers/plugins/litellm/index.js.map +1 -0
- package/dist/providers/plugins/litellm/litellm.models.d.ts +27 -0
- package/dist/providers/plugins/litellm/litellm.models.d.ts.map +1 -0
- package/dist/providers/plugins/litellm/litellm.models.js +48 -0
- package/dist/providers/plugins/litellm/litellm.models.js.map +1 -0
- package/dist/providers/plugins/litellm/litellm.setup-steps.d.ts +8 -0
- package/dist/providers/plugins/litellm/litellm.setup-steps.d.ts.map +1 -0
- package/dist/providers/plugins/litellm/litellm.setup-steps.js +52 -0
- package/dist/providers/plugins/litellm/litellm.setup-steps.js.map +1 -0
- package/dist/providers/plugins/litellm/litellm.template.d.ts +11 -0
- package/dist/providers/plugins/litellm/litellm.template.d.ts.map +1 -0
- package/dist/providers/plugins/litellm/litellm.template.js +59 -0
- package/dist/providers/plugins/litellm/litellm.template.js.map +1 -0
- package/dist/providers/plugins/ollama/index.d.ts +11 -0
- package/dist/providers/plugins/ollama/index.d.ts.map +1 -0
- package/dist/providers/plugins/ollama/index.js +11 -0
- package/dist/providers/plugins/ollama/index.js.map +1 -0
- package/dist/providers/plugins/ollama/ollama.health.d.ts +48 -0
- package/dist/providers/plugins/ollama/ollama.health.d.ts.map +1 -0
- package/dist/providers/plugins/ollama/ollama.health.js +87 -0
- package/dist/providers/plugins/ollama/ollama.health.js.map +1 -0
- package/dist/providers/plugins/ollama/ollama.models.d.ts +47 -0
- package/dist/providers/plugins/ollama/ollama.models.d.ts.map +1 -0
- package/dist/providers/plugins/ollama/ollama.models.js +252 -0
- package/dist/providers/plugins/ollama/ollama.models.js.map +1 -0
- package/dist/providers/plugins/ollama/ollama.setup-steps.d.ts +16 -0
- package/dist/providers/plugins/ollama/ollama.setup-steps.d.ts.map +1 -0
- package/dist/providers/plugins/ollama/ollama.setup-steps.js +164 -0
- package/dist/providers/plugins/ollama/ollama.setup-steps.js.map +1 -0
- package/dist/providers/plugins/ollama/ollama.template.d.ts +11 -0
- package/dist/providers/plugins/ollama/ollama.template.d.ts.map +1 -0
- package/dist/providers/plugins/ollama/ollama.template.js +89 -0
- package/dist/providers/plugins/ollama/ollama.template.js.map +1 -0
- package/dist/providers/plugins/sso/index.d.ts +12 -0
- package/dist/providers/plugins/sso/index.d.ts.map +1 -0
- package/dist/providers/plugins/sso/index.js +12 -0
- package/dist/providers/plugins/sso/index.js.map +1 -0
- package/dist/providers/plugins/sso/sso.auth.d.ts +50 -0
- package/dist/providers/plugins/sso/sso.auth.d.ts.map +1 -0
- package/dist/{utils/sso-auth.js → providers/plugins/sso/sso.auth.js} +37 -2
- package/dist/providers/plugins/sso/sso.auth.js.map +1 -0
- package/dist/providers/plugins/sso/sso.health.d.ts +44 -0
- package/dist/providers/plugins/sso/sso.health.d.ts.map +1 -0
- package/dist/providers/plugins/sso/sso.health.js +178 -0
- package/dist/providers/plugins/sso/sso.health.js.map +1 -0
- package/dist/providers/plugins/sso/sso.http-client.d.ts +24 -0
- package/dist/providers/plugins/sso/sso.http-client.d.ts.map +1 -0
- package/dist/providers/plugins/sso/sso.http-client.js +193 -0
- package/dist/providers/plugins/sso/sso.http-client.js.map +1 -0
- package/dist/providers/plugins/sso/sso.models.d.ts +48 -0
- package/dist/providers/plugins/sso/sso.models.d.ts.map +1 -0
- package/dist/providers/plugins/sso/sso.models.js +139 -0
- package/dist/providers/plugins/sso/sso.models.js.map +1 -0
- package/dist/providers/plugins/sso/sso.setup-steps.d.ts +16 -0
- package/dist/providers/plugins/sso/sso.setup-steps.d.ts.map +1 -0
- package/dist/providers/plugins/sso/sso.setup-steps.js +145 -0
- package/dist/providers/plugins/sso/sso.setup-steps.js.map +1 -0
- package/dist/providers/plugins/sso/sso.template.d.ts +11 -0
- package/dist/providers/plugins/sso/sso.template.d.ts.map +1 -0
- package/dist/providers/plugins/sso/sso.template.js +35 -0
- package/dist/providers/plugins/sso/sso.template.js.map +1 -0
- package/dist/proxy/errors.d.ts.map +1 -0
- package/dist/proxy/errors.js.map +1 -0
- package/dist/proxy/http-client.d.ts.map +1 -0
- package/dist/{utils/proxy → proxy}/http-client.js +50 -15
- package/dist/proxy/http-client.js.map +1 -0
- package/dist/proxy/plugins/endpoint-blocker.plugin.d.ts +19 -0
- package/dist/proxy/plugins/endpoint-blocker.plugin.d.ts.map +1 -0
- package/dist/proxy/plugins/endpoint-blocker.plugin.js +61 -0
- package/dist/proxy/plugins/endpoint-blocker.plugin.js.map +1 -0
- package/dist/proxy/plugins/header-injection.plugin.d.ts.map +1 -0
- package/dist/{utils/proxy → proxy}/plugins/header-injection.plugin.js +10 -3
- package/dist/proxy/plugins/header-injection.plugin.js.map +1 -0
- package/dist/{utils/proxy → proxy}/plugins/index.d.ts +4 -2
- package/dist/proxy/plugins/index.d.ts.map +1 -0
- package/dist/{utils/proxy → proxy}/plugins/index.js +7 -5
- package/dist/proxy/plugins/index.js.map +1 -0
- package/dist/proxy/plugins/logging.plugin.d.ts +22 -0
- package/dist/proxy/plugins/logging.plugin.d.ts.map +1 -0
- package/dist/proxy/plugins/logging.plugin.js +156 -0
- package/dist/proxy/plugins/logging.plugin.js.map +1 -0
- package/dist/proxy/plugins/metrics-sync.plugin.d.ts +33 -0
- package/dist/proxy/plugins/metrics-sync.plugin.d.ts.map +1 -0
- package/dist/proxy/plugins/metrics-sync.plugin.js +310 -0
- package/dist/proxy/plugins/metrics-sync.plugin.js.map +1 -0
- package/dist/proxy/plugins/registry.d.ts.map +1 -0
- package/dist/{utils/proxy → proxy}/plugins/registry.js +9 -2
- package/dist/proxy/plugins/registry.js.map +1 -0
- package/dist/proxy/plugins/sso-auth.plugin.d.ts.map +1 -0
- package/dist/{utils/proxy → proxy}/plugins/sso-auth.plugin.js +1 -1
- package/dist/proxy/plugins/sso-auth.plugin.js.map +1 -0
- package/dist/{utils/proxy → proxy}/plugins/types.d.ts +8 -4
- package/dist/proxy/plugins/types.d.ts.map +1 -0
- package/dist/proxy/plugins/types.js.map +1 -0
- package/dist/{utils/proxy → proxy}/types.d.ts +7 -0
- package/dist/proxy/types.d.ts.map +1 -0
- package/dist/proxy/types.js.map +1 -0
- package/dist/utils/ascii-logo.d.ts +21 -0
- package/dist/utils/ascii-logo.d.ts.map +1 -0
- package/dist/utils/ascii-logo.js +75 -0
- package/dist/utils/ascii-logo.js.map +1 -0
- package/dist/utils/codemie-proxy.d.ts +2 -7
- package/dist/utils/codemie-proxy.d.ts.map +1 -1
- package/dist/utils/codemie-proxy.js +56 -61
- package/dist/utils/codemie-proxy.js.map +1 -1
- package/dist/utils/config-loader.d.ts +1 -6
- package/dist/utils/config-loader.d.ts.map +1 -1
- package/dist/utils/config-loader.js +49 -93
- package/dist/utils/config-loader.js.map +1 -1
- package/dist/utils/credential-store.d.ts +1 -1
- package/dist/utils/credential-store.d.ts.map +1 -1
- package/dist/utils/exec.d.ts +11 -0
- package/dist/utils/exec.d.ts.map +1 -1
- package/dist/utils/exec.js +17 -1
- package/dist/utils/exec.js.map +1 -1
- package/dist/utils/goodbye-messages.d.ts +13 -0
- package/dist/utils/goodbye-messages.d.ts.map +1 -0
- package/dist/utils/goodbye-messages.js +245 -0
- package/dist/utils/goodbye-messages.js.map +1 -0
- package/dist/utils/json-parser.d.ts +52 -0
- package/dist/utils/json-parser.d.ts.map +1 -0
- package/dist/utils/json-parser.js +126 -0
- package/dist/utils/json-parser.js.map +1 -0
- package/dist/utils/logger.d.ts +37 -1
- package/dist/utils/logger.d.ts.map +1 -1
- package/dist/utils/logger.js +92 -22
- package/dist/utils/logger.js.map +1 -1
- package/dist/utils/sanitize.d.ts.map +1 -1
- package/dist/utils/sanitize.js +0 -1
- package/dist/utils/sanitize.js.map +1 -1
- package/dist/utils/which.d.ts +20 -0
- package/dist/utils/which.d.ts.map +1 -0
- package/dist/utils/which.js +47 -0
- package/dist/utils/which.js.map +1 -0
- package/package.json +10 -5
- package/dist/analytics/aggregation/adapters/claude.adapter.d.ts +0 -37
- package/dist/analytics/aggregation/adapters/claude.adapter.d.ts.map +0 -1
- package/dist/analytics/aggregation/adapters/claude.adapter.js +0 -531
- package/dist/analytics/aggregation/adapters/claude.adapter.js.map +0 -1
- package/dist/analytics/aggregation/adapters/codex.adapter.d.ts +0 -25
- package/dist/analytics/aggregation/adapters/codex.adapter.d.ts.map +0 -1
- package/dist/analytics/aggregation/adapters/codex.adapter.js +0 -396
- package/dist/analytics/aggregation/adapters/codex.adapter.js.map +0 -1
- package/dist/analytics/aggregation/adapters/gemini.adapter.d.ts +0 -36
- package/dist/analytics/aggregation/adapters/gemini.adapter.d.ts.map +0 -1
- package/dist/analytics/aggregation/adapters/gemini.adapter.js +0 -365
- package/dist/analytics/aggregation/adapters/gemini.adapter.js.map +0 -1
- package/dist/analytics/aggregation/adapters/index.d.ts +0 -7
- package/dist/analytics/aggregation/adapters/index.d.ts.map +0 -1
- package/dist/analytics/aggregation/adapters/index.js +0 -7
- package/dist/analytics/aggregation/adapters/index.js.map +0 -1
- package/dist/analytics/aggregation/aggregator.d.ts +0 -49
- package/dist/analytics/aggregation/aggregator.d.ts.map +0 -1
- package/dist/analytics/aggregation/aggregator.js +0 -239
- package/dist/analytics/aggregation/aggregator.js.map +0 -1
- package/dist/analytics/aggregation/core/BaseAnalyticsAdapter.d.ts +0 -99
- package/dist/analytics/aggregation/core/BaseAnalyticsAdapter.d.ts.map +0 -1
- package/dist/analytics/aggregation/core/BaseAnalyticsAdapter.js +0 -110
- package/dist/analytics/aggregation/core/BaseAnalyticsAdapter.js.map +0 -1
- package/dist/analytics/aggregation/core/adapter.interface.d.ts +0 -76
- package/dist/analytics/aggregation/core/adapter.interface.d.ts.map +0 -1
- package/dist/analytics/aggregation/core/adapter.interface.js +0 -9
- package/dist/analytics/aggregation/core/adapter.interface.js.map +0 -1
- package/dist/analytics/aggregation/core/aggregation-utils.d.ts +0 -86
- package/dist/analytics/aggregation/core/aggregation-utils.d.ts.map +0 -1
- package/dist/analytics/aggregation/core/aggregation-utils.js +0 -126
- package/dist/analytics/aggregation/core/aggregation-utils.js.map +0 -1
- package/dist/analytics/aggregation/core/discovery.d.ts +0 -40
- package/dist/analytics/aggregation/core/discovery.d.ts.map +0 -1
- package/dist/analytics/aggregation/core/discovery.js +0 -132
- package/dist/analytics/aggregation/core/discovery.js.map +0 -1
- package/dist/analytics/aggregation/core/file-utils.d.ts +0 -24
- package/dist/analytics/aggregation/core/file-utils.d.ts.map +0 -1
- package/dist/analytics/aggregation/core/file-utils.js +0 -143
- package/dist/analytics/aggregation/core/file-utils.js.map +0 -1
- package/dist/analytics/aggregation/core/index.d.ts +0 -14
- package/dist/analytics/aggregation/core/index.d.ts.map +0 -1
- package/dist/analytics/aggregation/core/index.js +0 -14
- package/dist/analytics/aggregation/core/index.js.map +0 -1
- package/dist/analytics/aggregation/core/project-mapping.d.ts +0 -50
- package/dist/analytics/aggregation/core/project-mapping.d.ts.map +0 -1
- package/dist/analytics/aggregation/core/project-mapping.js +0 -102
- package/dist/analytics/aggregation/core/project-mapping.js.map +0 -1
- package/dist/analytics/aggregation/core/streaming.d.ts +0 -26
- package/dist/analytics/aggregation/core/streaming.d.ts.map +0 -1
- package/dist/analytics/aggregation/core/streaming.js +0 -58
- package/dist/analytics/aggregation/core/streaming.js.map +0 -1
- package/dist/analytics/aggregation/core/user-prompt-source.d.ts +0 -81
- package/dist/analytics/aggregation/core/user-prompt-source.d.ts.map +0 -1
- package/dist/analytics/aggregation/core/user-prompt-source.js +0 -69
- package/dist/analytics/aggregation/core/user-prompt-source.js.map +0 -1
- package/dist/analytics/aggregation/core/user-prompt-sources/json.d.ts +0 -49
- package/dist/analytics/aggregation/core/user-prompt-sources/json.d.ts.map +0 -1
- package/dist/analytics/aggregation/core/user-prompt-sources/json.js +0 -66
- package/dist/analytics/aggregation/core/user-prompt-sources/json.js.map +0 -1
- package/dist/analytics/aggregation/core/user-prompt-sources/jsonl.d.ts +0 -43
- package/dist/analytics/aggregation/core/user-prompt-sources/jsonl.d.ts.map +0 -1
- package/dist/analytics/aggregation/core/user-prompt-sources/jsonl.js +0 -56
- package/dist/analytics/aggregation/core/user-prompt-sources/jsonl.js.map +0 -1
- package/dist/analytics/aggregation/index.d.ts +0 -8
- package/dist/analytics/aggregation/index.d.ts.map +0 -1
- package/dist/analytics/aggregation/index.js +0 -8
- package/dist/analytics/aggregation/index.js.map +0 -1
- package/dist/analytics/aggregation/types.d.ts +0 -278
- package/dist/analytics/aggregation/types.d.ts.map +0 -1
- package/dist/analytics/aggregation/types.js +0 -8
- package/dist/analytics/aggregation/types.js.map +0 -1
- package/dist/analytics/collector.d.ts +0 -46
- package/dist/analytics/collector.d.ts.map +0 -1
- package/dist/analytics/collector.js +0 -83
- package/dist/analytics/collector.js.map +0 -1
- package/dist/analytics/config.d.ts +0 -15
- package/dist/analytics/config.d.ts.map +0 -1
- package/dist/analytics/config.js +0 -65
- package/dist/analytics/config.js.map +0 -1
- package/dist/analytics/index.d.ts +0 -99
- package/dist/analytics/index.d.ts.map +0 -1
- package/dist/analytics/index.js +0 -288
- package/dist/analytics/index.js.map +0 -1
- package/dist/analytics/plugins/api-metrics.plugin.d.ts +0 -26
- package/dist/analytics/plugins/api-metrics.plugin.d.ts.map +0 -1
- package/dist/analytics/plugins/api-metrics.plugin.js +0 -97
- package/dist/analytics/plugins/api-metrics.plugin.js.map +0 -1
- package/dist/analytics/plugins/index.d.ts +0 -15
- package/dist/analytics/plugins/index.d.ts.map +0 -1
- package/dist/analytics/plugins/index.js +0 -15
- package/dist/analytics/plugins/index.js.map +0 -1
- package/dist/analytics/plugins/model-metrics.plugin.d.ts +0 -39
- package/dist/analytics/plugins/model-metrics.plugin.d.ts.map +0 -1
- package/dist/analytics/plugins/model-metrics.plugin.js +0 -105
- package/dist/analytics/plugins/model-metrics.plugin.js.map +0 -1
- package/dist/analytics/plugins/provider-metrics.plugin.d.ts +0 -41
- package/dist/analytics/plugins/provider-metrics.plugin.d.ts.map +0 -1
- package/dist/analytics/plugins/provider-metrics.plugin.js +0 -123
- package/dist/analytics/plugins/provider-metrics.plugin.js.map +0 -1
- package/dist/analytics/plugins/types.d.ts +0 -61
- package/dist/analytics/plugins/types.d.ts.map +0 -1
- package/dist/analytics/plugins/types.js +0 -54
- package/dist/analytics/plugins/types.js.map +0 -1
- package/dist/analytics/privacy.d.ts +0 -10
- package/dist/analytics/privacy.d.ts.map +0 -1
- package/dist/analytics/privacy.js +0 -20
- package/dist/analytics/privacy.js.map +0 -1
- package/dist/analytics/remote-submission/cursor-manager.d.ts +0 -71
- package/dist/analytics/remote-submission/cursor-manager.d.ts.map +0 -1
- package/dist/analytics/remote-submission/cursor-manager.js +0 -204
- package/dist/analytics/remote-submission/cursor-manager.js.map +0 -1
- package/dist/analytics/remote-submission/index.d.ts +0 -12
- package/dist/analytics/remote-submission/index.d.ts.map +0 -1
- package/dist/analytics/remote-submission/index.js +0 -11
- package/dist/analytics/remote-submission/index.js.map +0 -1
- package/dist/analytics/remote-submission/lock-manager.d.ts +0 -71
- package/dist/analytics/remote-submission/lock-manager.d.ts.map +0 -1
- package/dist/analytics/remote-submission/lock-manager.js +0 -238
- package/dist/analytics/remote-submission/lock-manager.js.map +0 -1
- package/dist/analytics/remote-submission/metric-transformer.d.ts +0 -49
- package/dist/analytics/remote-submission/metric-transformer.d.ts.map +0 -1
- package/dist/analytics/remote-submission/metric-transformer.js +0 -175
- package/dist/analytics/remote-submission/metric-transformer.js.map +0 -1
- package/dist/analytics/remote-submission/submitter.d.ts +0 -78
- package/dist/analytics/remote-submission/submitter.d.ts.map +0 -1
- package/dist/analytics/remote-submission/submitter.js +0 -381
- package/dist/analytics/remote-submission/submitter.js.map +0 -1
- package/dist/analytics/remote-submission/types.d.ts +0 -169
- package/dist/analytics/remote-submission/types.d.ts.map +0 -1
- package/dist/analytics/remote-submission/types.js +0 -13
- package/dist/analytics/remote-submission/types.js.map +0 -1
- package/dist/analytics/session.d.ts +0 -56
- package/dist/analytics/session.d.ts.map +0 -1
- package/dist/analytics/session.js +0 -95
- package/dist/analytics/session.js.map +0 -1
- package/dist/analytics/types.d.ts +0 -104
- package/dist/analytics/types.d.ts.map +0 -1
- package/dist/analytics/types.js +0 -15
- package/dist/analytics/types.js.map +0 -1
- package/dist/analytics/writer.d.ts +0 -18
- package/dist/analytics/writer.d.ts.map +0 -1
- package/dist/analytics/writer.js +0 -44
- package/dist/analytics/writer.js.map +0 -1
- package/dist/cli/commands/analytics.d.ts +0 -3
- package/dist/cli/commands/analytics.d.ts.map +0 -1
- package/dist/cli/commands/analytics.js +0 -748
- package/dist/cli/commands/analytics.js.map +0 -1
- package/dist/cli/commands/doctor/providers/AIRunSSOProviderCheck.d.ts +0 -11
- package/dist/cli/commands/doctor/providers/AIRunSSOProviderCheck.d.ts.map +0 -1
- package/dist/cli/commands/doctor/providers/AIRunSSOProviderCheck.js +0 -264
- package/dist/cli/commands/doctor/providers/AIRunSSOProviderCheck.js.map +0 -1
- package/dist/cli/commands/doctor/providers/BaseProviderCheck.d.ts +0 -12
- package/dist/cli/commands/doctor/providers/BaseProviderCheck.d.ts.map +0 -1
- package/dist/cli/commands/doctor/providers/BaseProviderCheck.js +0 -12
- package/dist/cli/commands/doctor/providers/BaseProviderCheck.js.map +0 -1
- package/dist/cli/commands/doctor/providers/StandardProviderCheck.d.ts +0 -11
- package/dist/cli/commands/doctor/providers/StandardProviderCheck.d.ts.map +0 -1
- package/dist/cli/commands/doctor/providers/StandardProviderCheck.js +0 -97
- package/dist/cli/commands/doctor/providers/StandardProviderCheck.js.map +0 -1
- package/dist/cli/commands/doctor/providers/index.d.ts +0 -30
- package/dist/cli/commands/doctor/providers/index.d.ts.map +0 -1
- package/dist/cli/commands/doctor/providers/index.js +0 -66
- package/dist/cli/commands/doctor/providers/index.js.map +0 -1
- package/dist/types/sso.d.ts +0 -42
- package/dist/types/sso.d.ts.map +0 -1
- package/dist/types/sso.js +0 -2
- package/dist/types/sso.js.map +0 -1
- package/dist/utils/analytics-reader.d.ts +0 -117
- package/dist/utils/analytics-reader.d.ts.map +0 -1
- package/dist/utils/analytics-reader.js +0 -421
- package/dist/utils/analytics-reader.js.map +0 -1
- package/dist/utils/async-tips.d.ts +0 -64
- package/dist/utils/async-tips.d.ts.map +0 -1
- package/dist/utils/async-tips.js +0 -203
- package/dist/utils/async-tips.js.map +0 -1
- package/dist/utils/codemie-integration-validator.d.ts +0 -18
- package/dist/utils/codemie-integration-validator.d.ts.map +0 -1
- package/dist/utils/codemie-integration-validator.js +0 -119
- package/dist/utils/codemie-integration-validator.js.map +0 -1
- package/dist/utils/codemie-model-fetcher.d.ts +0 -11
- package/dist/utils/codemie-model-fetcher.d.ts.map +0 -1
- package/dist/utils/codemie-model-fetcher.js +0 -317
- package/dist/utils/codemie-model-fetcher.js.map +0 -1
- package/dist/utils/date-formatter.d.ts +0 -88
- package/dist/utils/date-formatter.d.ts.map +0 -1
- package/dist/utils/date-formatter.js +0 -133
- package/dist/utils/date-formatter.js.map +0 -1
- package/dist/utils/health-checker.d.ts +0 -20
- package/dist/utils/health-checker.d.ts.map +0 -1
- package/dist/utils/health-checker.js +0 -172
- package/dist/utils/health-checker.js.map +0 -1
- package/dist/utils/model-fetcher.d.ts +0 -21
- package/dist/utils/model-fetcher.d.ts.map +0 -1
- package/dist/utils/model-fetcher.js +0 -148
- package/dist/utils/model-fetcher.js.map +0 -1
- package/dist/utils/proxy/errors.d.ts.map +0 -1
- package/dist/utils/proxy/errors.js.map +0 -1
- package/dist/utils/proxy/http-client.d.ts.map +0 -1
- package/dist/utils/proxy/http-client.js.map +0 -1
- package/dist/utils/proxy/plugins/analytics.plugin.d.ts +0 -19
- package/dist/utils/proxy/plugins/analytics.plugin.d.ts.map +0 -1
- package/dist/utils/proxy/plugins/analytics.plugin.js +0 -84
- package/dist/utils/proxy/plugins/analytics.plugin.js.map +0 -1
- package/dist/utils/proxy/plugins/header-injection.plugin.d.ts.map +0 -1
- package/dist/utils/proxy/plugins/header-injection.plugin.js.map +0 -1
- package/dist/utils/proxy/plugins/index.d.ts.map +0 -1
- package/dist/utils/proxy/plugins/index.js.map +0 -1
- package/dist/utils/proxy/plugins/registry.d.ts.map +0 -1
- package/dist/utils/proxy/plugins/registry.js.map +0 -1
- package/dist/utils/proxy/plugins/sso-auth.plugin.d.ts.map +0 -1
- package/dist/utils/proxy/plugins/sso-auth.plugin.js.map +0 -1
- package/dist/utils/proxy/plugins/types.d.ts.map +0 -1
- package/dist/utils/proxy/plugins/types.js.map +0 -1
- package/dist/utils/proxy/types.d.ts.map +0 -1
- package/dist/utils/proxy/types.js.map +0 -1
- package/dist/utils/sso-auth.d.ts +0 -15
- package/dist/utils/sso-auth.d.ts.map +0 -1
- package/dist/utils/sso-auth.js.map +0 -1
- package/dist/utils/tips.d.ts +0 -35
- package/dist/utils/tips.d.ts.map +0 -1
- package/dist/utils/tips.js +0 -93
- package/dist/utils/tips.js.map +0 -1
- /package/dist/{utils/proxy → proxy}/errors.d.ts +0 -0
- /package/dist/{utils/proxy → proxy}/errors.js +0 -0
- /package/dist/{utils/proxy → proxy}/http-client.d.ts +0 -0
- /package/dist/{utils/proxy → proxy}/plugins/header-injection.plugin.d.ts +0 -0
- /package/dist/{utils/proxy → proxy}/plugins/registry.d.ts +0 -0
- /package/dist/{utils/proxy → proxy}/plugins/sso-auth.plugin.d.ts +0 -0
- /package/dist/{utils/proxy → proxy}/plugins/types.js +0 -0
- /package/dist/{utils/proxy → proxy}/types.js +0 -0
|
@@ -4,47 +4,8 @@ import chalk from 'chalk';
|
|
|
4
4
|
import ora from 'ora';
|
|
5
5
|
import { ConfigLoader } from '../../utils/config-loader.js';
|
|
6
6
|
import { logger } from '../../utils/logger.js';
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { CodeMieSSO } from '../../utils/sso-auth.js';
|
|
10
|
-
import { fetchCodeMieModels } from '../../utils/codemie-model-fetcher.js';
|
|
11
|
-
import { validateCodeMieIntegrations } from '../../utils/codemie-integration-validator.js';
|
|
12
|
-
const PROVIDERS = [
|
|
13
|
-
{
|
|
14
|
-
name: 'CodeMie SSO (Recommended - Enterprise Authentication)',
|
|
15
|
-
value: 'ai-run-sso',
|
|
16
|
-
baseUrl: '', // Will be resolved from CodeMie URL
|
|
17
|
-
models: [] // Will be fetched from CodeMie /v1/llm_models endpoint
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
name: 'Google Gemini (Direct API Access)',
|
|
21
|
-
value: 'gemini',
|
|
22
|
-
baseUrl: 'https://generativelanguage.googleapis.com',
|
|
23
|
-
models: ['gemini-2.5-flash', 'gemini-2.5-pro', 'gemini-1.5-pro', 'gemini-1.5-flash']
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
name: 'LiteLLM Proxy (OpenAI-compatible Gateway)',
|
|
27
|
-
value: 'litellm',
|
|
28
|
-
baseUrl: 'https://litellm.example.com',
|
|
29
|
-
models: ['claude-4-5-sonnet', 'claude-opus-4', 'gpt-4.1', 'gpt-5']
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
name: 'AWS Bedrock (Claude via AWS)',
|
|
33
|
-
value: 'bedrock',
|
|
34
|
-
baseUrl: '',
|
|
35
|
-
models: [
|
|
36
|
-
'us.anthropic.claude-sonnet-4-5-20250929-v1:0',
|
|
37
|
-
'us.anthropic.claude-opus-4-0-20250514-v1:0',
|
|
38
|
-
'anthropic.claude-3-5-sonnet-20241022-v2:0'
|
|
39
|
-
]
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
name: 'Azure OpenAI (for GPT models and Codex)',
|
|
43
|
-
value: 'azure',
|
|
44
|
-
baseUrl: '',
|
|
45
|
-
models: []
|
|
46
|
-
}
|
|
47
|
-
];
|
|
7
|
+
import { ProviderRegistry } from '../../providers/index.js';
|
|
8
|
+
import { getAllProviderChoices, displaySetupSuccess, displaySetupError, getAllModelChoices, displaySetupInstructions } from '../../providers/integration/setup-ui.js';
|
|
48
9
|
export function createSetupCommand() {
|
|
49
10
|
const command = new Command('setup');
|
|
50
11
|
command
|
|
@@ -88,558 +49,116 @@ async function runSetupWizard(force) {
|
|
|
88
49
|
console.log(`${activeMarker}${chalk.white(name)} (${profile.provider})`);
|
|
89
50
|
});
|
|
90
51
|
console.log('');
|
|
91
|
-
|
|
92
|
-
const { action } = await inquirer.prompt([
|
|
93
|
-
{
|
|
94
|
-
type: 'list',
|
|
95
|
-
name: 'action',
|
|
96
|
-
message: 'What would you like to do?',
|
|
97
|
-
choices: [
|
|
98
|
-
{ name: 'Add a new profile', value: 'add' },
|
|
99
|
-
{ name: 'Update an existing profile', value: 'update' },
|
|
100
|
-
{ name: 'Cancel', value: 'cancel' }
|
|
101
|
-
]
|
|
102
|
-
}
|
|
103
|
-
]);
|
|
104
|
-
if (action === 'cancel') {
|
|
105
|
-
console.log(chalk.yellow('\nSetup cancelled.\n'));
|
|
106
|
-
return;
|
|
107
|
-
}
|
|
108
|
-
if (action === 'update') {
|
|
109
|
-
const { selectedProfile } = await inquirer.prompt([
|
|
52
|
+
const { action } = await inquirer.prompt([
|
|
110
53
|
{
|
|
111
54
|
type: 'list',
|
|
112
|
-
name: '
|
|
113
|
-
message: '
|
|
114
|
-
choices:
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
console.log(chalk.white(`\nUpdating profile: ${chalk.cyan(profileName)}\n`));
|
|
120
|
-
}
|
|
121
|
-
else {
|
|
122
|
-
// Adding new profile - will ask for name at the end
|
|
123
|
-
console.log(chalk.white('\nConfiguring new profile...\n'));
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
else {
|
|
127
|
-
// First time setup - will create default profile or ask for name at the end
|
|
128
|
-
console.log(chalk.white("Let's configure your AI assistant.\n"));
|
|
129
|
-
}
|
|
130
|
-
// Step 1: Choose provider (ai-run-sso is now first/default)
|
|
131
|
-
const { provider } = await inquirer.prompt([
|
|
132
|
-
{
|
|
133
|
-
type: 'list',
|
|
134
|
-
name: 'provider',
|
|
135
|
-
message: 'Choose your LLM provider:',
|
|
136
|
-
choices: PROVIDERS.map(p => ({ name: p.name, value: p.value })),
|
|
137
|
-
default: 'ai-run-sso' // Make SSO the default
|
|
138
|
-
}
|
|
139
|
-
]);
|
|
140
|
-
if (provider === 'ai-run-sso') {
|
|
141
|
-
await handleAiRunSSOSetup(profileName, isUpdate);
|
|
142
|
-
return; // Early return for SSO flow
|
|
143
|
-
}
|
|
144
|
-
const selectedProvider = PROVIDERS.find(p => p.value === provider);
|
|
145
|
-
// Step 2: Provider details
|
|
146
|
-
let baseUrl = selectedProvider.baseUrl;
|
|
147
|
-
let apiKey = '';
|
|
148
|
-
let model = selectedProvider.models[0] || '';
|
|
149
|
-
// Special handling for AWS Bedrock
|
|
150
|
-
if (provider === 'bedrock') {
|
|
151
|
-
console.log(chalk.bold.cyan('\n📝 AWS Bedrock Configuration\n'));
|
|
152
|
-
console.log(chalk.white('AWS Bedrock requires AWS access credentials and region configuration.'));
|
|
153
|
-
console.log(chalk.white('AWS credentials can be configured in multiple ways:\n'));
|
|
154
|
-
console.log(chalk.white(' 1. AWS CLI profiles (recommended): ~/.aws/credentials'));
|
|
155
|
-
console.log(chalk.white(' 2. Environment variables: AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY'));
|
|
156
|
-
console.log(chalk.white(' 3. IAM roles (for EC2/ECS instances)\n'));
|
|
157
|
-
// Check if AWS credentials might be available
|
|
158
|
-
const hasAwsCli = await (async () => {
|
|
159
|
-
try {
|
|
160
|
-
const { exec } = await import('../../utils/exec.js');
|
|
161
|
-
await exec('aws', ['--version']);
|
|
162
|
-
return true;
|
|
163
|
-
}
|
|
164
|
-
catch {
|
|
165
|
-
return false;
|
|
166
|
-
}
|
|
167
|
-
})();
|
|
168
|
-
const hasAwsEnvVars = !!(process.env.AWS_ACCESS_KEY_ID && process.env.AWS_SECRET_ACCESS_KEY);
|
|
169
|
-
if (!hasAwsCli && !hasAwsEnvVars) {
|
|
170
|
-
console.log(chalk.yellow('⚠️ AWS CLI not detected and no AWS environment variables found.\n'));
|
|
171
|
-
console.log(chalk.white('Please configure AWS credentials before proceeding:\n'));
|
|
172
|
-
console.log(chalk.cyan(' Option 1: Install and configure AWS CLI'));
|
|
173
|
-
console.log(chalk.white(' $ ') + chalk.green('aws configure'));
|
|
174
|
-
console.log(chalk.white(' Enter your AWS Access Key ID and Secret Access Key\n'));
|
|
175
|
-
console.log(chalk.cyan(' Option 2: Set environment variables'));
|
|
176
|
-
console.log(chalk.white(' $ ') + chalk.green('export AWS_ACCESS_KEY_ID="your-access-key"'));
|
|
177
|
-
console.log(chalk.white(' $ ') + chalk.green('export AWS_SECRET_ACCESS_KEY="your-secret-key"\n'));
|
|
178
|
-
const { continueAnyway } = await inquirer.prompt([
|
|
179
|
-
{
|
|
180
|
-
type: 'confirm',
|
|
181
|
-
name: 'continueAnyway',
|
|
182
|
-
message: 'Continue with Bedrock setup anyway?',
|
|
183
|
-
default: false
|
|
55
|
+
name: 'action',
|
|
56
|
+
message: 'What would you like to do?',
|
|
57
|
+
choices: [
|
|
58
|
+
{ name: 'Add a new profile', value: 'add' },
|
|
59
|
+
{ name: 'Update an existing profile', value: 'update' },
|
|
60
|
+
{ name: 'Cancel', value: 'cancel' }
|
|
61
|
+
]
|
|
184
62
|
}
|
|
185
63
|
]);
|
|
186
|
-
if (
|
|
187
|
-
console.log(chalk.yellow('\
|
|
188
|
-
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
else if (hasAwsCli) {
|
|
192
|
-
console.log(chalk.green('✓ AWS CLI detected\n'));
|
|
193
|
-
}
|
|
194
|
-
else if (hasAwsEnvVars) {
|
|
195
|
-
console.log(chalk.green('✓ AWS environment variables detected\n'));
|
|
196
|
-
}
|
|
197
|
-
// Ask for AWS configuration
|
|
198
|
-
const { awsRegion, awsProfile, useProfile } = await inquirer.prompt([
|
|
199
|
-
{
|
|
200
|
-
type: 'confirm',
|
|
201
|
-
name: 'useProfile',
|
|
202
|
-
message: 'Use AWS CLI profile?',
|
|
203
|
-
default: hasAwsCli,
|
|
204
|
-
when: hasAwsCli
|
|
205
|
-
},
|
|
206
|
-
{
|
|
207
|
-
type: 'input',
|
|
208
|
-
name: 'awsProfile',
|
|
209
|
-
message: 'AWS profile name:',
|
|
210
|
-
default: 'default',
|
|
211
|
-
when: (answers) => answers.useProfile
|
|
212
|
-
},
|
|
213
|
-
{
|
|
214
|
-
type: 'input',
|
|
215
|
-
name: 'awsRegion',
|
|
216
|
-
message: 'AWS Region:',
|
|
217
|
-
default: 'us-west-2',
|
|
218
|
-
validate: (input) => input.trim() !== '' || 'AWS region is required'
|
|
219
|
-
}
|
|
220
|
-
]);
|
|
221
|
-
// Set environment variables for Bedrock
|
|
222
|
-
process.env.AWS_REGION = awsRegion ? awsRegion.trim() : awsRegion;
|
|
223
|
-
process.env.CLAUDE_CODE_USE_BEDROCK = '1';
|
|
224
|
-
if (useProfile && awsProfile) {
|
|
225
|
-
process.env.AWS_PROFILE = awsProfile ? awsProfile.trim() : awsProfile;
|
|
226
|
-
}
|
|
227
|
-
console.log(chalk.green('\n✓ Bedrock configuration set'));
|
|
228
|
-
console.log(chalk.white(' AWS_REGION=' + (awsRegion ? awsRegion.trim() : awsRegion)));
|
|
229
|
-
if (useProfile && awsProfile) {
|
|
230
|
-
console.log(chalk.white(' AWS_PROFILE=' + (awsProfile ? awsProfile.trim() : awsProfile)));
|
|
231
|
-
}
|
|
232
|
-
console.log(chalk.white(' CLAUDE_CODE_USE_BEDROCK=1\n'));
|
|
233
|
-
// For Bedrock, we don't need base URL or API key (uses AWS credentials)
|
|
234
|
-
baseUrl = 'bedrock';
|
|
235
|
-
apiKey = 'bedrock'; // Placeholder
|
|
236
|
-
}
|
|
237
|
-
else if (!baseUrl) {
|
|
238
|
-
// Custom provider - ask for base URL
|
|
239
|
-
const answers = await inquirer.prompt([
|
|
240
|
-
{
|
|
241
|
-
type: 'input',
|
|
242
|
-
name: 'baseUrl',
|
|
243
|
-
message: 'Enter API base URL:',
|
|
244
|
-
validate: (input) => input.trim() !== '' || 'Base URL is required'
|
|
245
|
-
}
|
|
246
|
-
]);
|
|
247
|
-
baseUrl = answers.baseUrl ? answers.baseUrl.trim() : answers.baseUrl;
|
|
248
|
-
}
|
|
249
|
-
else {
|
|
250
|
-
// Prompt for base URL directly (no default)
|
|
251
|
-
const { customUrl } = await inquirer.prompt([
|
|
252
|
-
{
|
|
253
|
-
type: 'input',
|
|
254
|
-
name: 'customUrl',
|
|
255
|
-
message: `Enter base URL (default: ${baseUrl}):`,
|
|
256
|
-
validate: (input) => {
|
|
257
|
-
// Allow empty input to use default
|
|
258
|
-
if (input.trim() === '')
|
|
259
|
-
return true;
|
|
260
|
-
// Otherwise validate it's not just whitespace
|
|
261
|
-
return input.trim() !== '' || 'Base URL is required';
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
]);
|
|
265
|
-
// Use custom URL if provided, otherwise keep default
|
|
266
|
-
if (customUrl && customUrl.trim() !== '') {
|
|
267
|
-
baseUrl = customUrl.trim();
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
// API Key (skip for Bedrock as it uses AWS credentials)
|
|
271
|
-
if (provider !== 'bedrock') {
|
|
272
|
-
const { apiKeyInput } = await inquirer.prompt([
|
|
273
|
-
{
|
|
274
|
-
type: 'password',
|
|
275
|
-
name: 'apiKeyInput',
|
|
276
|
-
message: 'Enter your API key:',
|
|
277
|
-
mask: '*',
|
|
278
|
-
validate: (input) => input.trim() !== '' || 'API key is required'
|
|
64
|
+
if (action === 'cancel') {
|
|
65
|
+
console.log(chalk.yellow('\nSetup cancelled.\n'));
|
|
66
|
+
return;
|
|
279
67
|
}
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
}
|
|
283
|
-
// Step 2.5: Validate credentials and fetch models
|
|
284
|
-
let availableModels = [];
|
|
285
|
-
if (provider !== 'bedrock') {
|
|
286
|
-
const healthSpinner = ora('Validating credentials...').start();
|
|
287
|
-
try {
|
|
288
|
-
const healthCheck = await checkProviderHealth(baseUrl, apiKey);
|
|
289
|
-
if (!healthCheck.success) {
|
|
290
|
-
healthSpinner.fail(chalk.red('Validation failed'));
|
|
291
|
-
console.log(chalk.red(` Error: ${healthCheck.message}\n`));
|
|
292
|
-
const { continueAnyway } = await inquirer.prompt([
|
|
68
|
+
if (action === 'update') {
|
|
69
|
+
const { selectedProfile } = await inquirer.prompt([
|
|
293
70
|
{
|
|
294
|
-
type: '
|
|
295
|
-
name: '
|
|
296
|
-
message: '
|
|
297
|
-
|
|
71
|
+
type: 'list',
|
|
72
|
+
name: 'selectedProfile',
|
|
73
|
+
message: 'Select profile to update:',
|
|
74
|
+
choices: profiles.map(p => ({ name: p.name, value: p.name }))
|
|
298
75
|
}
|
|
299
76
|
]);
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
}
|
|
77
|
+
profileName = selectedProfile;
|
|
78
|
+
isUpdate = true;
|
|
79
|
+
console.log(chalk.white(`\nUpdating profile: ${chalk.cyan(profileName)}\n`));
|
|
304
80
|
}
|
|
305
81
|
else {
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
const modelsSpinner = ora('Fetching available models...').start();
|
|
309
|
-
try {
|
|
310
|
-
availableModels = await fetchAvailableModels({
|
|
311
|
-
provider,
|
|
312
|
-
baseUrl,
|
|
313
|
-
apiKey,
|
|
314
|
-
model: 'temp', // Temporary, not used for fetching
|
|
315
|
-
timeout: 300
|
|
316
|
-
});
|
|
317
|
-
if (availableModels.length > 0) {
|
|
318
|
-
modelsSpinner.succeed(chalk.green(`Found ${availableModels.length} available models`));
|
|
319
|
-
}
|
|
320
|
-
else {
|
|
321
|
-
modelsSpinner.warn(chalk.yellow('No models found - will use manual entry'));
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
catch {
|
|
325
|
-
modelsSpinner.warn(chalk.yellow('Could not fetch models - will use manual entry'));
|
|
326
|
-
availableModels = [];
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
catch (error) {
|
|
331
|
-
healthSpinner.fail(chalk.red('Validation error'));
|
|
332
|
-
console.log(chalk.red(` ${error instanceof Error ? error.message : String(error)}\n`));
|
|
333
|
-
const { continueAnyway } = await inquirer.prompt([
|
|
334
|
-
{
|
|
335
|
-
type: 'confirm',
|
|
336
|
-
name: 'continueAnyway',
|
|
337
|
-
message: 'Continue with setup anyway?',
|
|
338
|
-
default: false
|
|
339
|
-
}
|
|
340
|
-
]);
|
|
341
|
-
if (!continueAnyway) {
|
|
342
|
-
console.log(chalk.yellow('\nSetup cancelled.\n'));
|
|
343
|
-
return;
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
// Model selection
|
|
348
|
-
// Use fetched models if available, otherwise fall back to provider defaults
|
|
349
|
-
const modelChoices = availableModels.length > 0
|
|
350
|
-
? availableModels
|
|
351
|
-
: selectedProvider.models;
|
|
352
|
-
if (modelChoices.length > 0) {
|
|
353
|
-
// Add custom option at the end
|
|
354
|
-
const choices = [
|
|
355
|
-
...modelChoices,
|
|
356
|
-
{ name: chalk.white('Custom model (manual entry)...'), value: 'custom' }
|
|
357
|
-
];
|
|
358
|
-
const { selectedModel } = await inquirer.prompt([
|
|
359
|
-
{
|
|
360
|
-
type: 'list',
|
|
361
|
-
name: 'selectedModel',
|
|
362
|
-
message: availableModels.length > 0
|
|
363
|
-
? `Choose a model (${availableModels.length} available):`
|
|
364
|
-
: 'Choose a model:',
|
|
365
|
-
choices,
|
|
366
|
-
pageSize: 15
|
|
82
|
+
// Adding new profile - will ask for name at the end
|
|
83
|
+
console.log(chalk.white('\nConfiguring new profile...\n'));
|
|
367
84
|
}
|
|
368
|
-
]);
|
|
369
|
-
if (selectedModel === 'custom') {
|
|
370
|
-
const { customModel } = await inquirer.prompt([
|
|
371
|
-
{
|
|
372
|
-
type: 'input',
|
|
373
|
-
name: 'customModel',
|
|
374
|
-
message: 'Enter model name:',
|
|
375
|
-
validate: (input) => input.trim() !== '' || 'Model is required'
|
|
376
|
-
}
|
|
377
|
-
]);
|
|
378
|
-
model = customModel ? customModel.trim() : customModel;
|
|
379
85
|
}
|
|
380
86
|
else {
|
|
381
|
-
|
|
87
|
+
// Config file exists but no profiles - treat as fresh setup
|
|
88
|
+
console.log(chalk.white("Let's configure your AI assistant.\n"));
|
|
382
89
|
}
|
|
383
90
|
}
|
|
384
91
|
else {
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
type: 'input',
|
|
388
|
-
name: 'modelInput',
|
|
389
|
-
message: 'Enter model name:',
|
|
390
|
-
validate: (input) => input.trim() !== '' || 'Model is required'
|
|
391
|
-
}
|
|
392
|
-
]);
|
|
393
|
-
model = modelInput ? modelInput.trim() : modelInput;
|
|
394
|
-
}
|
|
395
|
-
// Step 3: Ask for profile name (if creating new)
|
|
396
|
-
if (!isUpdate && profileName === null) {
|
|
397
|
-
const profiles = await ConfigLoader.listProfiles();
|
|
398
|
-
const existingNames = profiles.map(p => p.name);
|
|
399
|
-
// Suggest a default name based on provider
|
|
400
|
-
let defaultName = 'default';
|
|
401
|
-
if (existingNames.length > 0) {
|
|
402
|
-
// If profiles exist, suggest provider-based name
|
|
403
|
-
defaultName = provider === 'ai-run-sso' ? 'codemie-sso' : provider;
|
|
404
|
-
// Make it unique if needed
|
|
405
|
-
let counter = 1;
|
|
406
|
-
let suggestedName = defaultName;
|
|
407
|
-
while (existingNames.includes(suggestedName)) {
|
|
408
|
-
suggestedName = `${defaultName}-${counter}`;
|
|
409
|
-
counter++;
|
|
410
|
-
}
|
|
411
|
-
defaultName = suggestedName;
|
|
412
|
-
}
|
|
413
|
-
const { newProfileName } = await inquirer.prompt([
|
|
414
|
-
{
|
|
415
|
-
type: 'input',
|
|
416
|
-
name: 'newProfileName',
|
|
417
|
-
message: 'Enter a name for this profile:',
|
|
418
|
-
default: defaultName,
|
|
419
|
-
validate: (input) => {
|
|
420
|
-
if (!input.trim())
|
|
421
|
-
return 'Profile name is required';
|
|
422
|
-
if (existingNames.includes(input.trim())) {
|
|
423
|
-
return 'A profile with this name already exists';
|
|
424
|
-
}
|
|
425
|
-
return true;
|
|
426
|
-
}
|
|
427
|
-
}
|
|
428
|
-
]);
|
|
429
|
-
profileName = newProfileName ? newProfileName.trim() : newProfileName;
|
|
430
|
-
}
|
|
431
|
-
// Step 4: Enable analytics by default (only for first-time setup)
|
|
432
|
-
let enableAnalytics = false;
|
|
433
|
-
if (!isUpdate) {
|
|
434
|
-
const profiles = await ConfigLoader.listProfiles();
|
|
435
|
-
const isFirstProfile = profiles.length === 0;
|
|
436
|
-
if (isFirstProfile) {
|
|
437
|
-
enableAnalytics = true;
|
|
438
|
-
}
|
|
439
|
-
}
|
|
440
|
-
// Step 5: Save configuration as profile
|
|
441
|
-
const profile = {
|
|
442
|
-
name: profileName,
|
|
443
|
-
provider,
|
|
444
|
-
baseUrl,
|
|
445
|
-
apiKey,
|
|
446
|
-
model,
|
|
447
|
-
timeout: 300,
|
|
448
|
-
debug: false
|
|
449
|
-
};
|
|
450
|
-
const spinner = ora('Saving profile...').start();
|
|
451
|
-
try {
|
|
452
|
-
await ConfigLoader.saveProfile(profileName, profile);
|
|
453
|
-
// Save analytics config if this is first profile
|
|
454
|
-
if (enableAnalytics !== false) {
|
|
455
|
-
const config = await ConfigLoader.loadMultiProviderConfig();
|
|
456
|
-
if (!config.analytics) {
|
|
457
|
-
config.analytics = {
|
|
458
|
-
enabled: enableAnalytics,
|
|
459
|
-
target: 'local',
|
|
460
|
-
localPath: '~/.codemie/analytics',
|
|
461
|
-
flushInterval: 5000,
|
|
462
|
-
maxBufferSize: 100
|
|
463
|
-
};
|
|
464
|
-
await ConfigLoader.saveMultiProviderConfig(config);
|
|
465
|
-
}
|
|
466
|
-
}
|
|
467
|
-
spinner.succeed(chalk.green(`Profile "${profileName}" saved to ~/.codemie/config.json`));
|
|
468
|
-
// If this is a new profile, ask if user wants to switch to it
|
|
469
|
-
if (!isUpdate) {
|
|
470
|
-
const activeProfile = await ConfigLoader.getActiveProfileName();
|
|
471
|
-
if (activeProfile !== profileName) {
|
|
472
|
-
const { switchToNew } = await inquirer.prompt([
|
|
473
|
-
{
|
|
474
|
-
type: 'confirm',
|
|
475
|
-
name: 'switchToNew',
|
|
476
|
-
message: `Switch to profile "${profileName}" as active?`,
|
|
477
|
-
default: true
|
|
478
|
-
}
|
|
479
|
-
]);
|
|
480
|
-
if (switchToNew) {
|
|
481
|
-
await ConfigLoader.switchProfile(profileName);
|
|
482
|
-
console.log(chalk.green(`✓ Switched to profile "${profileName}"`));
|
|
483
|
-
}
|
|
484
|
-
}
|
|
485
|
-
}
|
|
486
|
-
}
|
|
487
|
-
catch (error) {
|
|
488
|
-
spinner.fail(chalk.red('Failed to save profile'));
|
|
489
|
-
throw error;
|
|
92
|
+
// First time setup - will create default profile or ask for name at the end
|
|
93
|
+
console.log(chalk.white("Let's configure your AI assistant.\n"));
|
|
490
94
|
}
|
|
491
|
-
//
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
console.log(chalk.cyan(`📁 Config: ~/.codemie/config.json\n`));
|
|
496
|
-
console.log(chalk.bold(`🚀 Ready to use! Try: ${chalk.white('codemie-code "test task"')}\n`));
|
|
497
|
-
}
|
|
498
|
-
async function handleAiRunSSOSetup(profileName, isUpdate) {
|
|
499
|
-
console.log(chalk.bold.cyan('\n🔐 CodeMie SSO Configuration\n'));
|
|
500
|
-
// Step 1: Get CodeMie URL
|
|
501
|
-
const { codeMieUrl } = await inquirer.prompt([
|
|
95
|
+
// Step 1: Get all registered providers from ProviderRegistry
|
|
96
|
+
const registeredProviders = ProviderRegistry.getAllProviders();
|
|
97
|
+
const allProviderChoices = getAllProviderChoices(registeredProviders);
|
|
98
|
+
const { provider } = await inquirer.prompt([
|
|
502
99
|
{
|
|
503
|
-
type: '
|
|
504
|
-
name: '
|
|
505
|
-
message: '
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
return 'CodeMie URL is required';
|
|
511
|
-
if (!trimmed.startsWith('http'))
|
|
512
|
-
return 'URL must start with http:// or https://';
|
|
513
|
-
try {
|
|
514
|
-
new URL(trimmed);
|
|
515
|
-
return true;
|
|
516
|
-
}
|
|
517
|
-
catch {
|
|
518
|
-
return 'Please enter a valid URL';
|
|
519
|
-
}
|
|
520
|
-
}
|
|
100
|
+
type: 'list',
|
|
101
|
+
name: 'provider',
|
|
102
|
+
message: 'Choose your LLM provider:\n',
|
|
103
|
+
choices: allProviderChoices,
|
|
104
|
+
pageSize: 15,
|
|
105
|
+
// Default to highest priority provider (SSO has priority 0)
|
|
106
|
+
default: allProviderChoices[0]?.value
|
|
521
107
|
}
|
|
522
108
|
]);
|
|
523
|
-
//
|
|
524
|
-
const
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
109
|
+
// Get setup steps from provider registry
|
|
110
|
+
const setupSteps = ProviderRegistry.getSetupSteps(provider);
|
|
111
|
+
if (!setupSteps) {
|
|
112
|
+
throw new Error(`Provider "${provider}" does not have setup steps configured`);
|
|
113
|
+
}
|
|
114
|
+
// Use plugin-based setup flow
|
|
115
|
+
await handlePluginSetup(provider, setupSteps, profileName, isUpdate);
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Handle plugin-based setup flow
|
|
119
|
+
*
|
|
120
|
+
* Uses ProviderSetupSteps from ProviderRegistry for clean, extensible setup
|
|
121
|
+
*/
|
|
122
|
+
async function handlePluginSetup(providerName, setupSteps, profileName, isUpdate) {
|
|
530
123
|
try {
|
|
531
|
-
const
|
|
532
|
-
|
|
533
|
-
if (
|
|
534
|
-
|
|
535
|
-
console.log(chalk.red(` Error: ${authResult.error}\n`));
|
|
536
|
-
return;
|
|
124
|
+
const providerTemplate = ProviderRegistry.getProvider(providerName);
|
|
125
|
+
// Display setup instructions if available
|
|
126
|
+
if (providerTemplate) {
|
|
127
|
+
displaySetupInstructions(providerTemplate);
|
|
537
128
|
}
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
129
|
+
// Step 1: Get credentials
|
|
130
|
+
const credentials = await setupSteps.getCredentials(isUpdate);
|
|
131
|
+
// Step 2: Fetch models
|
|
132
|
+
const modelsSpinner = ora('Fetching available models...').start();
|
|
133
|
+
let models = [];
|
|
542
134
|
try {
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
integrationsSpinner.succeed(chalk.green('CodeMie integration selected'));
|
|
546
|
-
}
|
|
547
|
-
else {
|
|
548
|
-
integrationsSpinner.info(chalk.white('Continuing without integration'));
|
|
549
|
-
}
|
|
135
|
+
models = await setupSteps.fetchModels(credentials);
|
|
136
|
+
modelsSpinner.succeed(chalk.green(`Found ${models.length} available models`));
|
|
550
137
|
}
|
|
551
138
|
catch {
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
139
|
+
modelsSpinner.warn(chalk.yellow('Could not fetch models - will use manual entry'));
|
|
140
|
+
models = [];
|
|
141
|
+
}
|
|
142
|
+
// Step 3: Model selection
|
|
143
|
+
const selectedModel = await promptForModelSelection(models, providerTemplate);
|
|
144
|
+
// Step 3.5: Install model if provider supports it (e.g., Ollama)
|
|
145
|
+
if (providerTemplate?.supportsModelInstallation && setupSteps.installModel) {
|
|
146
|
+
await setupSteps.installModel(credentials, selectedModel, models);
|
|
147
|
+
}
|
|
148
|
+
// Step 4: Build configuration
|
|
149
|
+
const config = setupSteps.buildConfig(credentials, selectedModel);
|
|
150
|
+
// Step 5: Ask for profile name (if creating new)
|
|
151
|
+
let finalProfileName = profileName;
|
|
152
|
+
if (!isUpdate && profileName === null) {
|
|
153
|
+
finalProfileName = await promptForProfileName(providerName);
|
|
555
154
|
}
|
|
556
|
-
// Step
|
|
557
|
-
const
|
|
155
|
+
// Step 6: Save profile
|
|
156
|
+
const saveSpinner = ora('Saving profile...').start();
|
|
558
157
|
try {
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
// Step 6: Ask for profile name (if creating new)
|
|
564
|
-
let finalProfileName = profileName;
|
|
565
|
-
if (!isUpdate && profileName === null) {
|
|
566
|
-
const profiles = await ConfigLoader.listProfiles();
|
|
567
|
-
const existingNames = profiles.map(p => p.name);
|
|
568
|
-
// Suggest a default name
|
|
569
|
-
let defaultName = 'codemie-sso';
|
|
570
|
-
if (existingNames.length > 0) {
|
|
571
|
-
let counter = 1;
|
|
572
|
-
let suggestedName = defaultName;
|
|
573
|
-
while (existingNames.includes(suggestedName)) {
|
|
574
|
-
suggestedName = `${defaultName}-${counter}`;
|
|
575
|
-
counter++;
|
|
576
|
-
}
|
|
577
|
-
defaultName = suggestedName;
|
|
578
|
-
}
|
|
579
|
-
else {
|
|
580
|
-
defaultName = 'default';
|
|
581
|
-
}
|
|
582
|
-
const { newProfileName } = await inquirer.prompt([
|
|
583
|
-
{
|
|
584
|
-
type: 'input',
|
|
585
|
-
name: 'newProfileName',
|
|
586
|
-
message: 'Enter a name for this profile:',
|
|
587
|
-
default: defaultName,
|
|
588
|
-
validate: (input) => {
|
|
589
|
-
if (!input.trim())
|
|
590
|
-
return 'Profile name is required';
|
|
591
|
-
if (existingNames.includes(input.trim())) {
|
|
592
|
-
return 'A profile with this name already exists';
|
|
593
|
-
}
|
|
594
|
-
return true;
|
|
595
|
-
}
|
|
596
|
-
}
|
|
597
|
-
]);
|
|
598
|
-
finalProfileName = newProfileName ? newProfileName.trim() : newProfileName;
|
|
599
|
-
}
|
|
600
|
-
// Step 6.5: Enable analytics by default (only for first-time setup)
|
|
601
|
-
let enableAnalytics = false;
|
|
602
|
-
if (!isUpdate) {
|
|
603
|
-
const profiles = await ConfigLoader.listProfiles();
|
|
604
|
-
const isFirstProfile = profiles.length === 0;
|
|
605
|
-
if (isFirstProfile) {
|
|
606
|
-
enableAnalytics = true;
|
|
607
|
-
}
|
|
608
|
-
}
|
|
609
|
-
// Step 7: Save configuration as profile
|
|
610
|
-
const profile = {
|
|
611
|
-
name: finalProfileName,
|
|
612
|
-
provider: 'ai-run-sso',
|
|
613
|
-
authMethod: 'sso',
|
|
614
|
-
codeMieUrl: trimmedCodeMieUrl,
|
|
615
|
-
baseUrl: authResult.apiUrl,
|
|
616
|
-
apiKey: 'sso-authenticated',
|
|
617
|
-
model: selectedModel,
|
|
618
|
-
timeout: 300,
|
|
619
|
-
debug: false
|
|
620
|
-
};
|
|
621
|
-
// Only add integration if one was selected
|
|
622
|
-
if (selectedIntegration) {
|
|
623
|
-
profile.codeMieIntegration = selectedIntegration;
|
|
624
|
-
}
|
|
625
|
-
const saveSpinner = ora('Saving profile...').start();
|
|
626
|
-
await ConfigLoader.saveProfile(finalProfileName, profile);
|
|
627
|
-
// Save analytics config if this is first profile
|
|
628
|
-
if (enableAnalytics !== false) {
|
|
629
|
-
const config = await ConfigLoader.loadMultiProviderConfig();
|
|
630
|
-
if (!config.analytics) {
|
|
631
|
-
config.analytics = {
|
|
632
|
-
enabled: enableAnalytics,
|
|
633
|
-
target: 'local',
|
|
634
|
-
localPath: '~/.codemie/analytics',
|
|
635
|
-
flushInterval: 5000,
|
|
636
|
-
maxBufferSize: 100
|
|
637
|
-
};
|
|
638
|
-
await ConfigLoader.saveMultiProviderConfig(config);
|
|
639
|
-
}
|
|
640
|
-
}
|
|
641
|
-
saveSpinner.succeed(chalk.green(`Profile "${finalProfileName}" saved to ~/.codemie/config.json`));
|
|
642
|
-
// If this is a new profile, ask if user wants to switch to it
|
|
158
|
+
config.name = finalProfileName;
|
|
159
|
+
await ConfigLoader.saveProfile(finalProfileName, config);
|
|
160
|
+
saveSpinner.succeed(chalk.green(`Profile "${finalProfileName}" saved`));
|
|
161
|
+
// Switch to new profile if needed
|
|
643
162
|
if (!isUpdate) {
|
|
644
163
|
const activeProfile = await ConfigLoader.getActiveProfileName();
|
|
645
164
|
if (activeProfile !== finalProfileName) {
|
|
@@ -657,113 +176,68 @@ async function handleAiRunSSOSetup(profileName, isUpdate) {
|
|
|
657
176
|
}
|
|
658
177
|
}
|
|
659
178
|
}
|
|
660
|
-
//
|
|
661
|
-
|
|
662
|
-
console.log(chalk.cyan(`🔗 Connected to: ${trimmedCodeMieUrl}`));
|
|
663
|
-
console.log(chalk.cyan(`🔑 Authentication: SSO (session stored securely)`));
|
|
664
|
-
console.log(chalk.cyan(`🤖 Selected Model: ${selectedModel}`));
|
|
665
|
-
console.log(chalk.cyan(`📁 Config saved to: ~/.codemie/config.json\n`));
|
|
666
|
-
console.log(chalk.bold(`🚀 Ready to use! Try: ${chalk.white('codemie-code "test task"')}\n`));
|
|
179
|
+
// Display success
|
|
180
|
+
displaySetupSuccess(finalProfileName, providerName, selectedModel);
|
|
667
181
|
}
|
|
668
182
|
catch (error) {
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
// Continue with manual model entry
|
|
672
|
-
const { manualModel } = await inquirer.prompt([
|
|
673
|
-
{
|
|
674
|
-
type: 'input',
|
|
675
|
-
name: 'manualModel',
|
|
676
|
-
message: 'Enter model name manually:',
|
|
677
|
-
default: 'claude-4-5-sonnet',
|
|
678
|
-
validate: (input) => input.trim() !== '' || 'Model name is required'
|
|
679
|
-
}
|
|
680
|
-
]);
|
|
681
|
-
// Ask for profile name (if creating new)
|
|
682
|
-
let finalProfileName = profileName;
|
|
683
|
-
if (!isUpdate && profileName === null) {
|
|
684
|
-
const profiles = await ConfigLoader.listProfiles();
|
|
685
|
-
const existingNames = profiles.map(p => p.name);
|
|
686
|
-
let defaultName = 'codemie-sso';
|
|
687
|
-
if (existingNames.length > 0) {
|
|
688
|
-
let counter = 1;
|
|
689
|
-
let suggestedName = defaultName;
|
|
690
|
-
while (existingNames.includes(suggestedName)) {
|
|
691
|
-
suggestedName = `${defaultName}-${counter}`;
|
|
692
|
-
counter++;
|
|
693
|
-
}
|
|
694
|
-
defaultName = suggestedName;
|
|
695
|
-
}
|
|
696
|
-
else {
|
|
697
|
-
defaultName = 'default';
|
|
698
|
-
}
|
|
699
|
-
const { newProfileName } = await inquirer.prompt([
|
|
700
|
-
{
|
|
701
|
-
type: 'input',
|
|
702
|
-
name: 'newProfileName',
|
|
703
|
-
message: 'Enter a name for this profile:',
|
|
704
|
-
default: defaultName,
|
|
705
|
-
validate: (input) => {
|
|
706
|
-
if (!input.trim())
|
|
707
|
-
return 'Profile name is required';
|
|
708
|
-
if (existingNames.includes(input.trim())) {
|
|
709
|
-
return 'A profile with this name already exists';
|
|
710
|
-
}
|
|
711
|
-
return true;
|
|
712
|
-
}
|
|
713
|
-
}
|
|
714
|
-
]);
|
|
715
|
-
finalProfileName = newProfileName ? newProfileName.trim() : newProfileName;
|
|
716
|
-
}
|
|
717
|
-
// Enable analytics by default (only for first-time setup)
|
|
718
|
-
let enableAnalytics = false;
|
|
719
|
-
if (!isUpdate) {
|
|
720
|
-
const profiles = await ConfigLoader.listProfiles();
|
|
721
|
-
const isFirstProfile = profiles.length === 0;
|
|
722
|
-
if (isFirstProfile) {
|
|
723
|
-
enableAnalytics = true;
|
|
724
|
-
}
|
|
725
|
-
}
|
|
726
|
-
// Save config with manual model as profile
|
|
727
|
-
const profile = {
|
|
728
|
-
name: finalProfileName,
|
|
729
|
-
provider: 'ai-run-sso',
|
|
730
|
-
authMethod: 'sso',
|
|
731
|
-
codeMieUrl: trimmedCodeMieUrl,
|
|
732
|
-
baseUrl: authResult.apiUrl,
|
|
733
|
-
apiKey: 'sso-authenticated',
|
|
734
|
-
model: manualModel ? manualModel.trim() : manualModel,
|
|
735
|
-
timeout: 300,
|
|
736
|
-
debug: false
|
|
737
|
-
};
|
|
738
|
-
// Only add integration if one was selected
|
|
739
|
-
if (selectedIntegration) {
|
|
740
|
-
profile.codeMieIntegration = selectedIntegration;
|
|
741
|
-
}
|
|
742
|
-
await ConfigLoader.saveProfile(finalProfileName, profile);
|
|
743
|
-
// Save analytics config if this is first profile
|
|
744
|
-
if (enableAnalytics !== false) {
|
|
745
|
-
const config = await ConfigLoader.loadMultiProviderConfig();
|
|
746
|
-
if (!config.analytics) {
|
|
747
|
-
config.analytics = {
|
|
748
|
-
enabled: enableAnalytics,
|
|
749
|
-
target: 'local',
|
|
750
|
-
localPath: '~/.codemie/analytics',
|
|
751
|
-
flushInterval: 5000,
|
|
752
|
-
maxBufferSize: 100
|
|
753
|
-
};
|
|
754
|
-
await ConfigLoader.saveMultiProviderConfig(config);
|
|
755
|
-
}
|
|
756
|
-
}
|
|
757
|
-
console.log(chalk.green(`\n✅ Profile "${finalProfileName}" saved with manual model selection.\n`));
|
|
183
|
+
saveSpinner.fail(chalk.red('Failed to save profile'));
|
|
184
|
+
throw error;
|
|
758
185
|
}
|
|
759
186
|
}
|
|
760
187
|
catch (error) {
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
188
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
189
|
+
const providerTemplate = ProviderRegistry.getProvider(providerName);
|
|
190
|
+
displaySetupError(new Error(errorMessage), providerTemplate?.setupInstructions);
|
|
191
|
+
throw error;
|
|
764
192
|
}
|
|
765
193
|
}
|
|
766
|
-
|
|
194
|
+
/**
|
|
195
|
+
* Prompt for profile name
|
|
196
|
+
*
|
|
197
|
+
* Generates unique default name and validates input
|
|
198
|
+
*/
|
|
199
|
+
async function promptForProfileName(providerName) {
|
|
200
|
+
const profiles = await ConfigLoader.listProfiles();
|
|
201
|
+
const existingNames = profiles.map(p => p.name);
|
|
202
|
+
// Suggest a default name based on provider template
|
|
203
|
+
let defaultName = 'default';
|
|
204
|
+
if (existingNames.length > 0) {
|
|
205
|
+
// If profiles exist, use provider's defaultProfileName or provider name
|
|
206
|
+
const providerTemplate = ProviderRegistry.getProvider(providerName);
|
|
207
|
+
defaultName = providerTemplate?.defaultProfileName || providerName;
|
|
208
|
+
// Make it unique if needed
|
|
209
|
+
let counter = 1;
|
|
210
|
+
let suggestedName = defaultName;
|
|
211
|
+
while (existingNames.includes(suggestedName)) {
|
|
212
|
+
suggestedName = `${defaultName}-${counter}`;
|
|
213
|
+
counter++;
|
|
214
|
+
}
|
|
215
|
+
defaultName = suggestedName;
|
|
216
|
+
}
|
|
217
|
+
const { newProfileName } = await inquirer.prompt([
|
|
218
|
+
{
|
|
219
|
+
type: 'input',
|
|
220
|
+
name: 'newProfileName',
|
|
221
|
+
message: 'Enter a name for this profile:',
|
|
222
|
+
default: defaultName,
|
|
223
|
+
validate: (input) => {
|
|
224
|
+
if (!input.trim())
|
|
225
|
+
return 'Profile name is required';
|
|
226
|
+
if (existingNames.includes(input.trim())) {
|
|
227
|
+
return 'A profile with this name already exists';
|
|
228
|
+
}
|
|
229
|
+
return true;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
]);
|
|
233
|
+
return newProfileName ? newProfileName.trim() : newProfileName;
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Prompt for model selection with metadata
|
|
237
|
+
*
|
|
238
|
+
* Uses getAllModelChoices for enriched display
|
|
239
|
+
*/
|
|
240
|
+
async function promptForModelSelection(models, providerTemplate) {
|
|
767
241
|
if (models.length === 0) {
|
|
768
242
|
const { manualModel } = await inquirer.prompt([
|
|
769
243
|
{
|
|
@@ -776,9 +250,9 @@ async function promptForModelSelection(models) {
|
|
|
776
250
|
]);
|
|
777
251
|
return manualModel ? manualModel.trim() : manualModel;
|
|
778
252
|
}
|
|
779
|
-
//
|
|
253
|
+
// Use getAllModelChoices for enriched display with metadata
|
|
780
254
|
const choices = [
|
|
781
|
-
...models,
|
|
255
|
+
...getAllModelChoices(models, providerTemplate),
|
|
782
256
|
{ name: chalk.white('Custom model (manual entry)...'), value: 'custom' }
|
|
783
257
|
];
|
|
784
258
|
const { selectedModel } = await inquirer.prompt([
|
|
@@ -803,4 +277,9 @@ async function promptForModelSelection(models) {
|
|
|
803
277
|
}
|
|
804
278
|
return selectedModel;
|
|
805
279
|
}
|
|
280
|
+
/*
|
|
281
|
+
* Note: Old SSO setup function (handleAiRunSSOSetup) has been removed.
|
|
282
|
+
* It has been replaced by the plugin-based SSOSetupSteps in src/providers/plugins/sso/
|
|
283
|
+
* All SSO setup logic is now handled through the ProviderRegistry plugin system.
|
|
284
|
+
*/
|
|
806
285
|
//# sourceMappingURL=setup.js.map
|