@codemieai/code 0.0.24 → 0.0.26
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 +35 -23
- package/dist/agents/codemie-code/config.d.ts.map +1 -1
- package/dist/agents/codemie-code/config.js +7 -3
- package/dist/agents/codemie-code/config.js.map +1 -1
- package/dist/agents/codemie-code/tools/index.d.ts.map +1 -1
- package/dist/agents/codemie-code/tools/index.js +6 -5
- package/dist/agents/codemie-code/tools/index.js.map +1 -1
- package/dist/agents/codemie-code/types.d.ts +4 -0
- package/dist/agents/codemie-code/types.d.ts.map +1 -1
- package/dist/agents/codemie-code/types.js.map +1 -1
- package/dist/agents/core/AgentCLI.d.ts.map +1 -1
- package/dist/agents/core/AgentCLI.js +21 -0
- package/dist/agents/core/AgentCLI.js.map +1 -1
- package/dist/agents/core/BaseAgentAdapter.d.ts +54 -3
- package/dist/agents/core/BaseAgentAdapter.d.ts.map +1 -1
- package/dist/agents/core/BaseAgentAdapter.js +135 -21
- package/dist/agents/core/BaseAgentAdapter.js.map +1 -1
- package/dist/agents/core/BaseMetricsAdapter.d.ts +88 -6
- package/dist/agents/core/BaseMetricsAdapter.d.ts.map +1 -1
- package/dist/agents/core/BaseMetricsAdapter.js +174 -16
- package/dist/agents/core/BaseMetricsAdapter.js.map +1 -1
- package/dist/agents/core/lifecycle-helpers.d.ts +111 -0
- package/dist/agents/core/lifecycle-helpers.d.ts.map +1 -0
- package/dist/agents/core/lifecycle-helpers.js +189 -0
- package/dist/agents/core/lifecycle-helpers.js.map +1 -0
- package/dist/agents/core/metrics/MetricsOrchestrator.d.ts.map +1 -0
- package/dist/{metrics → agents/core/metrics}/MetricsOrchestrator.js +76 -12
- package/dist/agents/core/metrics/MetricsOrchestrator.js.map +1 -0
- package/dist/agents/core/metrics/core/DeltaWriter.d.ts.map +1 -0
- package/dist/{metrics → agents/core/metrics}/core/DeltaWriter.js +3 -3
- package/dist/agents/core/metrics/core/DeltaWriter.js.map +1 -0
- package/dist/agents/core/metrics/core/FileSnapshotter.d.ts.map +1 -0
- package/dist/{metrics → agents/core/metrics}/core/FileSnapshotter.js +1 -1
- package/dist/agents/core/metrics/core/FileSnapshotter.js.map +1 -0
- package/dist/agents/core/metrics/core/SessionCorrelator.d.ts.map +1 -0
- package/dist/agents/core/metrics/core/SessionCorrelator.js +157 -0
- package/dist/agents/core/metrics/core/SessionCorrelator.js.map +1 -0
- package/dist/agents/core/metrics/core/SyncStateManager.d.ts.map +1 -0
- package/dist/{metrics → agents/core/metrics}/core/SyncStateManager.js +2 -2
- package/dist/agents/core/metrics/core/SyncStateManager.js.map +1 -0
- package/dist/agents/core/metrics/index.d.ts.map +1 -0
- package/dist/agents/core/metrics/index.js.map +1 -0
- package/dist/agents/core/metrics/session/SessionStore.d.ts.map +1 -0
- package/dist/{metrics → agents/core/metrics}/session/SessionStore.js +3 -3
- package/dist/agents/core/metrics/session/SessionStore.js.map +1 -0
- package/dist/agents/core/metrics/types.d.ts.map +1 -0
- package/dist/agents/core/metrics/types.js.map +1 -0
- package/dist/{metrics/config.d.ts → agents/core/metrics-config.d.ts} +1 -1
- package/dist/agents/core/metrics-config.d.ts.map +1 -0
- package/dist/{metrics/config.js → agents/core/metrics-config.js} +5 -3
- package/dist/agents/core/metrics-config.js.map +1 -0
- package/dist/agents/core/types.d.ts +112 -6
- package/dist/agents/core/types.d.ts.map +1 -1
- package/dist/agents/plugins/claude.metrics.d.ts +4 -2
- package/dist/agents/plugins/claude.metrics.d.ts.map +1 -1
- package/dist/agents/plugins/claude.metrics.js +33 -11
- package/dist/agents/plugins/claude.metrics.js.map +1 -1
- package/dist/agents/plugins/claude.plugin.d.ts +1 -1
- package/dist/agents/plugins/claude.plugin.d.ts.map +1 -1
- package/dist/agents/plugins/claude.plugin.js +3 -33
- 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 +12 -5
- 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 +133 -33
- package/dist/agents/plugins/codex.plugin.js.map +1 -1
- package/dist/agents/plugins/gemini.metrics.d.ts +10 -3
- package/dist/agents/plugins/gemini.metrics.d.ts.map +1 -1
- package/dist/agents/plugins/gemini.metrics.js +69 -17
- package/dist/agents/plugins/gemini.metrics.js.map +1 -1
- package/dist/agents/plugins/gemini.plugin.d.ts +1 -1
- package/dist/agents/plugins/gemini.plugin.d.ts.map +1 -1
- package/dist/agents/plugins/gemini.plugin.js +15 -24
- package/dist/agents/plugins/gemini.plugin.js.map +1 -1
- package/dist/agents/plugins/history-parser.d.ts +1 -1
- package/dist/agents/plugins/history-parser.d.ts.map +1 -1
- package/dist/cli/commands/analytics/data-loader.d.ts +1 -1
- package/dist/cli/commands/analytics/data-loader.d.ts.map +1 -1
- package/dist/cli/commands/analytics/types.d.ts +2 -2
- package/dist/cli/commands/analytics/types.d.ts.map +1 -1
- package/dist/cli/commands/analytics/types.js +1 -1
- package/dist/cli/commands/profile/auth.d.ts +5 -0
- package/dist/cli/commands/profile/auth.d.ts.map +1 -0
- package/dist/cli/commands/profile/auth.js +120 -0
- package/dist/cli/commands/profile/auth.js.map +1 -0
- package/dist/cli/commands/{profile.d.ts → profile/index.d.ts} +1 -1
- package/dist/cli/commands/profile/index.d.ts.map +1 -0
- package/dist/cli/commands/{profile.js → profile/index.js} +81 -46
- package/dist/cli/commands/profile/index.js.map +1 -0
- package/dist/cli/index.js +1 -3
- package/dist/cli/index.js.map +1 -1
- package/dist/providers/core/auth-validation.d.ts +20 -0
- package/dist/providers/core/auth-validation.d.ts.map +1 -0
- package/dist/providers/core/auth-validation.js +27 -0
- package/dist/providers/core/auth-validation.js.map +1 -0
- package/dist/providers/core/types.d.ts +51 -0
- package/dist/providers/core/types.d.ts.map +1 -1
- package/dist/providers/plugins/sso/index.d.ts +3 -0
- package/dist/providers/plugins/sso/index.d.ts.map +1 -1
- package/dist/providers/plugins/sso/index.js +4 -0
- package/dist/providers/plugins/sso/index.js.map +1 -1
- package/dist/{metrics/sync/jsonl-writer.d.ts → providers/plugins/sso/metrics/sync/sso.jsonl-writer.d.ts} +2 -2
- package/dist/providers/plugins/sso/metrics/sync/sso.jsonl-writer.d.ts.map +1 -0
- package/dist/{metrics/sync/jsonl-writer.js → providers/plugins/sso/metrics/sync/sso.jsonl-writer.js} +2 -2
- package/dist/providers/plugins/sso/metrics/sync/sso.jsonl-writer.js.map +1 -0
- package/dist/providers/plugins/sso/metrics/sync/sso.lifecycle-handler.d.ts +62 -0
- package/dist/providers/plugins/sso/metrics/sync/sso.lifecycle-handler.d.ts.map +1 -0
- package/dist/providers/plugins/sso/metrics/sync/sso.lifecycle-handler.js +157 -0
- package/dist/providers/plugins/sso/metrics/sync/sso.lifecycle-handler.js.map +1 -0
- package/dist/{metrics/sync/aggregator.d.ts → providers/plugins/sso/metrics/sync/sso.metrics-aggregator.d.ts} +4 -4
- package/dist/providers/plugins/sso/metrics/sync/sso.metrics-aggregator.d.ts.map +1 -0
- package/dist/{metrics/sync/aggregator.js → providers/plugins/sso/metrics/sync/sso.metrics-aggregator.js} +5 -4
- package/dist/providers/plugins/sso/metrics/sync/sso.metrics-aggregator.js.map +1 -0
- package/dist/{metrics/sync/MetricsApiClient.d.ts → providers/plugins/sso/metrics/sync/sso.metrics-api-client.d.ts} +2 -2
- package/dist/providers/plugins/sso/metrics/sync/sso.metrics-api-client.d.ts.map +1 -0
- package/dist/{metrics/sync/MetricsApiClient.js → providers/plugins/sso/metrics/sync/sso.metrics-api-client.js} +9 -5
- package/dist/providers/plugins/sso/metrics/sync/sso.metrics-api-client.js.map +1 -0
- package/dist/{metrics/sync/post-processor.d.ts → providers/plugins/sso/metrics/sync/sso.metrics-post-processor.d.ts} +3 -3
- package/dist/providers/plugins/sso/metrics/sync/sso.metrics-post-processor.d.ts.map +1 -0
- package/dist/{metrics/sync/post-processor.js → providers/plugins/sso/metrics/sync/sso.metrics-post-processor.js} +3 -3
- package/dist/providers/plugins/sso/metrics/sync/sso.metrics-post-processor.js.map +1 -0
- package/dist/providers/plugins/sso/metrics/sync/sso.metrics-sender.d.ts +104 -0
- package/dist/providers/plugins/sso/metrics/sync/sso.metrics-sender.d.ts.map +1 -0
- package/dist/providers/plugins/sso/metrics/sync/sso.metrics-sender.js +258 -0
- package/dist/providers/plugins/sso/metrics/sync/sso.metrics-sender.js.map +1 -0
- package/dist/{proxy/plugins/metrics-sync.plugin.d.ts → providers/plugins/sso/metrics/sync/sso.metrics-sync.plugin.d.ts} +9 -6
- package/dist/providers/plugins/sso/metrics/sync/sso.metrics-sync.plugin.d.ts.map +1 -0
- package/dist/{proxy/plugins/metrics-sync.plugin.js → providers/plugins/sso/metrics/sync/sso.metrics-sync.plugin.js} +42 -60
- package/dist/providers/plugins/sso/metrics/sync/sso.metrics-sync.plugin.js.map +1 -0
- package/dist/{metrics/sync/types.d.ts → providers/plugins/sso/metrics/sync/sso.metrics-types.d.ts} +6 -2
- package/dist/providers/plugins/sso/metrics/sync/sso.metrics-types.d.ts.map +1 -0
- package/dist/{metrics/sync/types.js → providers/plugins/sso/metrics/sync/sso.metrics-types.js} +1 -1
- package/dist/providers/plugins/sso/metrics/sync/sso.metrics-types.js.map +1 -0
- package/dist/providers/plugins/sso/proxy/plugins/endpoint-blocker.plugin.d.ts.map +1 -0
- package/dist/{proxy → providers/plugins/sso/proxy}/plugins/endpoint-blocker.plugin.js +1 -1
- package/dist/providers/plugins/sso/proxy/plugins/endpoint-blocker.plugin.js.map +1 -0
- package/dist/providers/plugins/sso/proxy/plugins/header-injection.plugin.d.ts.map +1 -0
- package/dist/{proxy → providers/plugins/sso/proxy}/plugins/header-injection.plugin.js +2 -2
- package/dist/providers/plugins/sso/proxy/plugins/header-injection.plugin.js.map +1 -0
- package/dist/{proxy → providers/plugins/sso/proxy}/plugins/index.d.ts +2 -2
- package/dist/providers/plugins/sso/proxy/plugins/index.d.ts.map +1 -0
- package/dist/{proxy → providers/plugins/sso/proxy}/plugins/index.js +4 -3
- package/dist/providers/plugins/sso/proxy/plugins/index.js.map +1 -0
- package/dist/providers/plugins/sso/proxy/plugins/logging.plugin.d.ts.map +1 -0
- package/dist/{proxy → providers/plugins/sso/proxy}/plugins/logging.plugin.js +1 -1
- package/dist/providers/plugins/sso/proxy/plugins/logging.plugin.js.map +1 -0
- package/dist/providers/plugins/sso/proxy/plugins/registry.d.ts.map +1 -0
- package/dist/{proxy → providers/plugins/sso/proxy}/plugins/registry.js +1 -1
- package/dist/providers/plugins/sso/proxy/plugins/registry.js.map +1 -0
- package/dist/providers/plugins/sso/proxy/plugins/sso-auth.plugin.d.ts.map +1 -0
- package/dist/{proxy → providers/plugins/sso/proxy}/plugins/sso-auth.plugin.js +1 -1
- package/dist/providers/plugins/sso/proxy/plugins/sso-auth.plugin.js.map +1 -0
- package/dist/{proxy → providers/plugins/sso/proxy}/plugins/types.d.ts +4 -4
- package/dist/providers/plugins/sso/proxy/plugins/types.d.ts.map +1 -0
- package/dist/providers/plugins/sso/proxy/plugins/types.js.map +1 -0
- package/dist/{proxy/errors.d.ts → providers/plugins/sso/proxy/proxy-errors.d.ts} +1 -1
- package/dist/providers/plugins/sso/proxy/proxy-errors.d.ts.map +1 -0
- package/dist/{proxy/errors.js → providers/plugins/sso/proxy/proxy-errors.js} +1 -1
- package/dist/providers/plugins/sso/proxy/proxy-errors.js.map +1 -0
- package/dist/{proxy/http-client.d.ts → providers/plugins/sso/proxy/proxy-http-client.d.ts} +1 -1
- package/dist/providers/plugins/sso/proxy/proxy-http-client.d.ts.map +1 -0
- package/dist/{proxy/http-client.js → providers/plugins/sso/proxy/proxy-http-client.js} +3 -3
- package/dist/providers/plugins/sso/proxy/proxy-http-client.js.map +1 -0
- package/dist/{proxy/types.d.ts → providers/plugins/sso/proxy/proxy-types.d.ts} +2 -2
- package/dist/providers/plugins/sso/proxy/proxy-types.d.ts.map +1 -0
- package/dist/{proxy/types.js → providers/plugins/sso/proxy/proxy-types.js} +1 -1
- package/dist/providers/plugins/sso/proxy/proxy-types.js.map +1 -0
- package/dist/{utils/codemie-proxy.d.ts → providers/plugins/sso/proxy/sso.proxy.d.ts} +3 -3
- package/dist/providers/plugins/sso/proxy/sso.proxy.d.ts.map +1 -0
- package/dist/{utils/codemie-proxy.js → providers/plugins/sso/proxy/sso.proxy.js} +11 -11
- package/dist/providers/plugins/sso/proxy/sso.proxy.js.map +1 -0
- package/dist/providers/plugins/sso/sso.auth.d.ts +7 -3
- package/dist/providers/plugins/sso/sso.auth.d.ts.map +1 -1
- package/dist/providers/plugins/sso/sso.auth.js +40 -7
- package/dist/providers/plugins/sso/sso.auth.js.map +1 -1
- package/dist/providers/plugins/sso/sso.health.d.ts.map +1 -1
- package/dist/providers/plugins/sso/sso.health.js +6 -4
- package/dist/providers/plugins/sso/sso.health.js.map +1 -1
- package/dist/providers/plugins/sso/sso.models.d.ts +6 -0
- package/dist/providers/plugins/sso/sso.models.d.ts.map +1 -1
- package/dist/providers/plugins/sso/sso.models.js +15 -6
- package/dist/providers/plugins/sso/sso.models.js.map +1 -1
- package/dist/providers/plugins/sso/sso.setup-steps.d.ts.map +1 -1
- package/dist/providers/plugins/sso/sso.setup-steps.js +116 -1
- package/dist/providers/plugins/sso/sso.setup-steps.js.map +1 -1
- package/dist/providers/plugins/sso/sso.template.d.ts.map +1 -1
- package/dist/providers/plugins/sso/sso.template.js +51 -0
- package/dist/providers/plugins/sso/sso.template.js.map +1 -1
- package/dist/utils/credential-store.d.ts +9 -3
- package/dist/utils/credential-store.d.ts.map +1 -1
- package/dist/utils/credential-store.js +43 -18
- package/dist/utils/credential-store.js.map +1 -1
- package/dist/utils/exec.d.ts +1 -1
- package/dist/utils/exec.d.ts.map +1 -1
- package/dist/utils/exec.js +9 -5
- package/dist/utils/exec.js.map +1 -1
- package/dist/utils/first-time.js +1 -1
- package/dist/utils/first-time.js.map +1 -1
- package/dist/{metrics/utils → utils}/git.d.ts +1 -1
- package/dist/utils/git.d.ts.map +1 -0
- package/dist/{metrics/utils → utils}/git.js +2 -2
- package/dist/utils/git.js.map +1 -0
- package/dist/utils/npm.d.ts.map +1 -1
- package/dist/utils/npm.js +16 -5
- package/dist/utils/npm.js.map +1 -1
- package/dist/utils/path-utils.d.ts +195 -0
- package/dist/utils/path-utils.d.ts.map +1 -0
- package/dist/utils/path-utils.js +267 -0
- package/dist/utils/path-utils.js.map +1 -0
- package/dist/utils/profile-display.d.ts +41 -0
- package/dist/utils/profile-display.d.ts.map +1 -0
- package/dist/utils/profile-display.js +90 -0
- package/dist/utils/profile-display.js.map +1 -0
- package/dist/utils/profile.d.ts +12 -1
- package/dist/utils/profile.d.ts.map +1 -1
- package/dist/utils/profile.js +52 -9
- package/dist/utils/profile.js.map +1 -1
- package/dist/utils/which.d.ts.map +1 -1
- package/dist/utils/which.js +10 -3
- package/dist/utils/which.js.map +1 -1
- package/package.json +1 -1
- package/dist/cli/commands/auth.d.ts +0 -3
- package/dist/cli/commands/auth.d.ts.map +0 -1
- package/dist/cli/commands/auth.js +0 -184
- package/dist/cli/commands/auth.js.map +0 -1
- package/dist/cli/commands/profile.d.ts.map +0 -1
- package/dist/cli/commands/profile.js.map +0 -1
- package/dist/metrics/MetricsOrchestrator.d.ts.map +0 -1
- package/dist/metrics/MetricsOrchestrator.js.map +0 -1
- package/dist/metrics/config.d.ts.map +0 -1
- package/dist/metrics/config.js.map +0 -1
- package/dist/metrics/core/DeltaWriter.d.ts.map +0 -1
- package/dist/metrics/core/DeltaWriter.js.map +0 -1
- package/dist/metrics/core/FileSnapshotter.d.ts.map +0 -1
- package/dist/metrics/core/FileSnapshotter.js.map +0 -1
- package/dist/metrics/core/SessionCorrelator.d.ts.map +0 -1
- package/dist/metrics/core/SessionCorrelator.js +0 -115
- package/dist/metrics/core/SessionCorrelator.js.map +0 -1
- package/dist/metrics/core/SyncStateManager.d.ts.map +0 -1
- package/dist/metrics/core/SyncStateManager.js.map +0 -1
- package/dist/metrics/index.d.ts.map +0 -1
- package/dist/metrics/index.js.map +0 -1
- package/dist/metrics/session/SessionStore.d.ts.map +0 -1
- package/dist/metrics/session/SessionStore.js.map +0 -1
- package/dist/metrics/sync/MetricsApiClient.d.ts.map +0 -1
- package/dist/metrics/sync/MetricsApiClient.js.map +0 -1
- package/dist/metrics/sync/aggregator.d.ts.map +0 -1
- package/dist/metrics/sync/aggregator.js.map +0 -1
- package/dist/metrics/sync/index.d.ts +0 -10
- package/dist/metrics/sync/index.d.ts.map +0 -1
- package/dist/metrics/sync/index.js +0 -10
- package/dist/metrics/sync/index.js.map +0 -1
- package/dist/metrics/sync/jsonl-writer.d.ts.map +0 -1
- package/dist/metrics/sync/jsonl-writer.js.map +0 -1
- package/dist/metrics/sync/post-processor.d.ts.map +0 -1
- package/dist/metrics/sync/post-processor.js.map +0 -1
- package/dist/metrics/sync/types.d.ts.map +0 -1
- package/dist/metrics/sync/types.js.map +0 -1
- package/dist/metrics/types.d.ts.map +0 -1
- package/dist/metrics/types.js.map +0 -1
- package/dist/metrics/utils/git.d.ts.map +0 -1
- package/dist/metrics/utils/git.js.map +0 -1
- package/dist/proxy/errors.d.ts.map +0 -1
- package/dist/proxy/errors.js.map +0 -1
- package/dist/proxy/http-client.d.ts.map +0 -1
- package/dist/proxy/http-client.js.map +0 -1
- package/dist/proxy/plugins/endpoint-blocker.plugin.d.ts.map +0 -1
- package/dist/proxy/plugins/endpoint-blocker.plugin.js.map +0 -1
- package/dist/proxy/plugins/header-injection.plugin.d.ts.map +0 -1
- package/dist/proxy/plugins/header-injection.plugin.js.map +0 -1
- package/dist/proxy/plugins/index.d.ts.map +0 -1
- package/dist/proxy/plugins/index.js.map +0 -1
- package/dist/proxy/plugins/logging.plugin.d.ts.map +0 -1
- package/dist/proxy/plugins/logging.plugin.js.map +0 -1
- package/dist/proxy/plugins/metrics-sync.plugin.d.ts.map +0 -1
- package/dist/proxy/plugins/metrics-sync.plugin.js.map +0 -1
- package/dist/proxy/plugins/registry.d.ts.map +0 -1
- package/dist/proxy/plugins/registry.js.map +0 -1
- package/dist/proxy/plugins/sso-auth.plugin.d.ts.map +0 -1
- package/dist/proxy/plugins/sso-auth.plugin.js.map +0 -1
- package/dist/proxy/plugins/types.d.ts.map +0 -1
- package/dist/proxy/plugins/types.js.map +0 -1
- package/dist/proxy/types.d.ts.map +0 -1
- package/dist/proxy/types.js.map +0 -1
- package/dist/utils/codemie-proxy.d.ts.map +0 -1
- package/dist/utils/codemie-proxy.js.map +0 -1
- /package/dist/{metrics → agents/core/metrics}/MetricsOrchestrator.d.ts +0 -0
- /package/dist/{metrics → agents/core/metrics}/core/DeltaWriter.d.ts +0 -0
- /package/dist/{metrics → agents/core/metrics}/core/FileSnapshotter.d.ts +0 -0
- /package/dist/{metrics → agents/core/metrics}/core/SessionCorrelator.d.ts +0 -0
- /package/dist/{metrics → agents/core/metrics}/core/SyncStateManager.d.ts +0 -0
- /package/dist/{metrics → agents/core/metrics}/index.d.ts +0 -0
- /package/dist/{metrics → agents/core/metrics}/index.js +0 -0
- /package/dist/{metrics → agents/core/metrics}/session/SessionStore.d.ts +0 -0
- /package/dist/{metrics → agents/core/metrics}/types.d.ts +0 -0
- /package/dist/{metrics → agents/core/metrics}/types.js +0 -0
- /package/dist/{proxy → providers/plugins/sso/proxy}/plugins/endpoint-blocker.plugin.d.ts +0 -0
- /package/dist/{proxy → providers/plugins/sso/proxy}/plugins/header-injection.plugin.d.ts +0 -0
- /package/dist/{proxy → providers/plugins/sso/proxy}/plugins/logging.plugin.d.ts +0 -0
- /package/dist/{proxy → providers/plugins/sso/proxy}/plugins/registry.d.ts +0 -0
- /package/dist/{proxy → providers/plugins/sso/proxy}/plugins/sso-auth.plugin.d.ts +0 -0
- /package/dist/{proxy → providers/plugins/sso/proxy}/plugins/types.js +0 -0
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cross-Platform Path Utilities
|
|
3
|
+
*
|
|
4
|
+
* Provides platform-agnostic path operations that work consistently
|
|
5
|
+
* across Windows, macOS, and Linux by normalizing all paths to forward slashes.
|
|
6
|
+
*
|
|
7
|
+
* This module consolidates all path-related logic including:
|
|
8
|
+
* - Path normalization and splitting
|
|
9
|
+
* - Path structure validation
|
|
10
|
+
* - Security checks (directory traversal prevention)
|
|
11
|
+
* - UUID validation for session files
|
|
12
|
+
* - File extension validation
|
|
13
|
+
*/
|
|
14
|
+
import path from 'path';
|
|
15
|
+
import { homedir } from 'os';
|
|
16
|
+
/**
|
|
17
|
+
* Normalize path separators to forward slashes for cross-platform consistency
|
|
18
|
+
*
|
|
19
|
+
* This function converts all backslashes to forward slashes, allowing the code
|
|
20
|
+
* to handle both Windows (C:\path\to\file) and Unix (/path/to/file) paths
|
|
21
|
+
* uniformly on any platform.
|
|
22
|
+
*
|
|
23
|
+
* @param filePath - Path with either forward slashes or backslashes
|
|
24
|
+
* @returns Path with only forward slashes
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* normalizePathSeparators('C:\\Users\\john\\.claude\\projects\\abc\\file.jsonl')
|
|
28
|
+
* // Returns: 'C:/Users/john/.claude/projects/abc/file.jsonl'
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* normalizePathSeparators('/home/user/.claude/projects/abc/file.jsonl')
|
|
32
|
+
* // Returns: '/home/user/.claude/projects/abc/file.jsonl' (unchanged)
|
|
33
|
+
*/
|
|
34
|
+
export function normalizePathSeparators(filePath) {
|
|
35
|
+
return filePath.replaceAll('\\', '/');
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Split path into parts using forward slash as separator
|
|
39
|
+
*
|
|
40
|
+
* Works consistently across all platforms by first normalizing separators.
|
|
41
|
+
*
|
|
42
|
+
* @param filePath - Path with either forward slashes or backslashes
|
|
43
|
+
* @returns Array of path segments
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* splitPath('C:\\Users\\john\\.claude\\projects\\abc\\file.jsonl')
|
|
47
|
+
* // Returns: ['C:', 'Users', 'john', '.claude', 'projects', 'abc', 'file.jsonl']
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* splitPath('/home/user/.claude/projects/abc/file.jsonl')
|
|
51
|
+
* // Returns: ['', 'home', 'user', '.claude', 'projects', 'abc', 'file.jsonl']
|
|
52
|
+
*/
|
|
53
|
+
export function splitPath(filePath) {
|
|
54
|
+
const normalized = normalizePathSeparators(filePath);
|
|
55
|
+
return normalized.split('/');
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Get the filename from a path (last segment)
|
|
59
|
+
*
|
|
60
|
+
* @param filePath - Full path
|
|
61
|
+
* @returns Filename with extension
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* getFilename('C:\\Users\\john\\.claude\\projects\\abc\\file.jsonl')
|
|
65
|
+
* // Returns: 'file.jsonl'
|
|
66
|
+
*/
|
|
67
|
+
export function getFilename(filePath) {
|
|
68
|
+
const parts = splitPath(filePath);
|
|
69
|
+
return parts.at(-1) || '';
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Find the index of a base directory in a path (internal helper)
|
|
73
|
+
*
|
|
74
|
+
* @param parts - Path segments from splitPath()
|
|
75
|
+
* @param baseDirName - Base directory name to find
|
|
76
|
+
* @returns Index of the directory, or -1 if not found
|
|
77
|
+
* @internal
|
|
78
|
+
*/
|
|
79
|
+
function findBaseIndex(parts, baseDirName) {
|
|
80
|
+
return parts.findIndex(part => part === baseDirName);
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Check if a path matches a specific structure
|
|
84
|
+
*
|
|
85
|
+
* Validates that a path follows the pattern: {prefix}/{dir1}/{dir2}/{...}/{filename}
|
|
86
|
+
* where the structure is relative to a base directory.
|
|
87
|
+
*
|
|
88
|
+
* @param filePath - Path to validate
|
|
89
|
+
* @param baseDirName - Base directory name to find (e.g., '.claude')
|
|
90
|
+
* @param expectedStructure - Array of directory names that should follow the base directory
|
|
91
|
+
* @returns true if path matches structure, false otherwise
|
|
92
|
+
*
|
|
93
|
+
* @example
|
|
94
|
+
* matchesPathStructure(
|
|
95
|
+
* 'C:\\Users\\john\\.claude\\projects\\abc\\file.jsonl',
|
|
96
|
+
* '.claude',
|
|
97
|
+
* ['projects'] // expects: .claude/projects/{hash}/{file}
|
|
98
|
+
* )
|
|
99
|
+
* // Returns: true (has .claude/projects structure)
|
|
100
|
+
*
|
|
101
|
+
* @example
|
|
102
|
+
* matchesPathStructure(
|
|
103
|
+
* '/home/user/.claude/sessions/abc/file.jsonl',
|
|
104
|
+
* '.claude',
|
|
105
|
+
* ['projects']
|
|
106
|
+
* )
|
|
107
|
+
* // Returns: false (has 'sessions' instead of 'projects')
|
|
108
|
+
*/
|
|
109
|
+
export function matchesPathStructure(filePath, baseDirName, expectedStructure) {
|
|
110
|
+
const parts = splitPath(filePath);
|
|
111
|
+
const baseIndex = findBaseIndex(parts, baseDirName);
|
|
112
|
+
if (baseIndex === -1) {
|
|
113
|
+
return false;
|
|
114
|
+
}
|
|
115
|
+
// Check if expected directories follow the base directory
|
|
116
|
+
for (let i = 0; i < expectedStructure.length; i++) {
|
|
117
|
+
const expectedIndex = baseIndex + 1 + i;
|
|
118
|
+
if (expectedIndex >= parts.length || parts[expectedIndex] !== expectedStructure[i]) {
|
|
119
|
+
return false;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
return true;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Validate path depth relative to a base directory
|
|
126
|
+
*
|
|
127
|
+
* Checks that there are exactly N segments after the base directory.
|
|
128
|
+
*
|
|
129
|
+
* @param filePath - Path to validate
|
|
130
|
+
* @param baseDirName - Base directory name
|
|
131
|
+
* @param expectedDepth - Number of segments expected after base directory
|
|
132
|
+
* @returns true if depth matches, false otherwise
|
|
133
|
+
*
|
|
134
|
+
* @example
|
|
135
|
+
* validatePathDepth(
|
|
136
|
+
* 'C:\\Users\\john\\.claude\\projects\\abc\\file.jsonl',
|
|
137
|
+
* '.claude',
|
|
138
|
+
* 3 // expects: .claude/{dir1}/{dir2}/{file}
|
|
139
|
+
* )
|
|
140
|
+
* // Returns: true (has 'projects', 'abc', 'file.jsonl' = 3 segments after .claude)
|
|
141
|
+
*/
|
|
142
|
+
export function validatePathDepth(filePath, baseDirName, expectedDepth) {
|
|
143
|
+
const parts = splitPath(filePath);
|
|
144
|
+
const baseIndex = findBaseIndex(parts, baseDirName);
|
|
145
|
+
if (baseIndex === -1) {
|
|
146
|
+
return false;
|
|
147
|
+
}
|
|
148
|
+
const actualDepth = parts.length - baseIndex - 1;
|
|
149
|
+
return actualDepth === expectedDepth;
|
|
150
|
+
}
|
|
151
|
+
// ============================================================================
|
|
152
|
+
// Security Utilities
|
|
153
|
+
// ============================================================================
|
|
154
|
+
/**
|
|
155
|
+
* Check if a resolved path is within a working directory boundary
|
|
156
|
+
*
|
|
157
|
+
* Uses path.relative() to prevent directory traversal attacks.
|
|
158
|
+
* This is safer than simple string prefix matching which can be bypassed
|
|
159
|
+
* by paths like: /home/user/project-attacker when checking /home/user/project
|
|
160
|
+
*
|
|
161
|
+
* @param workingDir - The working directory boundary
|
|
162
|
+
* @param resolvedPath - The resolved absolute path to check
|
|
163
|
+
* @returns true if path is within workingDir, false otherwise
|
|
164
|
+
*
|
|
165
|
+
* @example
|
|
166
|
+
* isPathWithinDirectory('/home/user/project', '/home/user/project/file.txt')
|
|
167
|
+
* // Returns: true
|
|
168
|
+
*
|
|
169
|
+
* @example
|
|
170
|
+
* isPathWithinDirectory('/home/user/project', '/home/user/project-other/file.txt')
|
|
171
|
+
* // Returns: false (prevented directory traversal)
|
|
172
|
+
*
|
|
173
|
+
* @example
|
|
174
|
+
* isPathWithinDirectory('C:\\Users\\project', 'C:\\Users\\project\\..\\..\\etc\\passwd')
|
|
175
|
+
* // Returns: false (prevented traversal attack)
|
|
176
|
+
*/
|
|
177
|
+
export function isPathWithinDirectory(workingDir, resolvedPath) {
|
|
178
|
+
const relative = path.relative(workingDir, resolvedPath);
|
|
179
|
+
// If path starts with '..' or is an absolute path, it's outside workingDir
|
|
180
|
+
return !relative.startsWith('..') && !path.isAbsolute(relative);
|
|
181
|
+
}
|
|
182
|
+
// ============================================================================
|
|
183
|
+
// UUID Validation Utilities
|
|
184
|
+
// ============================================================================
|
|
185
|
+
/**
|
|
186
|
+
* UUID regex pattern (any version)
|
|
187
|
+
* Format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
|
|
188
|
+
* where x is any hexadecimal digit
|
|
189
|
+
*/
|
|
190
|
+
const UUID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
191
|
+
/**
|
|
192
|
+
* Validate if a string matches UUID format (any version)
|
|
193
|
+
*
|
|
194
|
+
* Supports all UUID versions (v1, v2, v3, v4, v5) with case-insensitive matching.
|
|
195
|
+
*
|
|
196
|
+
* @param str - String to validate
|
|
197
|
+
* @returns true if valid UUID, false otherwise
|
|
198
|
+
*
|
|
199
|
+
* @example
|
|
200
|
+
* isValidUuid('f52d1386-9d4c-4671-a31e-62dd6600a759')
|
|
201
|
+
* // Returns: true
|
|
202
|
+
*
|
|
203
|
+
* @example
|
|
204
|
+
* isValidUuid('F52D1386-9D4C-4671-A31E-62DD6600A759')
|
|
205
|
+
* // Returns: true (case-insensitive)
|
|
206
|
+
*
|
|
207
|
+
* @example
|
|
208
|
+
* isValidUuid('not-a-uuid')
|
|
209
|
+
* // Returns: false
|
|
210
|
+
*/
|
|
211
|
+
export function isValidUuid(str) {
|
|
212
|
+
return UUID_PATTERN.test(str);
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Validate if a filename has a valid UUID format with specific extension
|
|
216
|
+
*
|
|
217
|
+
* Checks that the filename (without extension) is a valid UUID.
|
|
218
|
+
*
|
|
219
|
+
* @param filename - Filename to validate (e.g., 'abc123.jsonl')
|
|
220
|
+
* @param extension - Required extension (e.g., '.jsonl')
|
|
221
|
+
* @returns true if filename is UUID with correct extension, false otherwise
|
|
222
|
+
*
|
|
223
|
+
* @example
|
|
224
|
+
* isValidUuidFilename('f52d1386-9d4c-4671-a31e-62dd6600a759.jsonl', '.jsonl')
|
|
225
|
+
* // Returns: true
|
|
226
|
+
*
|
|
227
|
+
* @example
|
|
228
|
+
* isValidUuidFilename('f52d1386-9d4c-4671-a31e-62dd6600a759.json', '.jsonl')
|
|
229
|
+
* // Returns: false (wrong extension)
|
|
230
|
+
*
|
|
231
|
+
* @example
|
|
232
|
+
* isValidUuidFilename('not-a-uuid.jsonl', '.jsonl')
|
|
233
|
+
* // Returns: false (invalid UUID)
|
|
234
|
+
*/
|
|
235
|
+
export function isValidUuidFilename(filename, extension) {
|
|
236
|
+
if (!filename.endsWith(extension)) {
|
|
237
|
+
return false;
|
|
238
|
+
}
|
|
239
|
+
const nameWithoutExt = filename.slice(0, -extension.length);
|
|
240
|
+
return isValidUuid(nameWithoutExt);
|
|
241
|
+
}
|
|
242
|
+
// ============================================================================
|
|
243
|
+
// Home Directory Utilities
|
|
244
|
+
// ============================================================================
|
|
245
|
+
/**
|
|
246
|
+
* Resolve a path relative to the user's home directory
|
|
247
|
+
*
|
|
248
|
+
* Joins the user's home directory with the provided relative path.
|
|
249
|
+
* Useful for agent data directories like '.claude', '.codex', '.gemini', etc.
|
|
250
|
+
*
|
|
251
|
+
* @param relativePath - Relative path from home directory (e.g., '.claude', '.codex')
|
|
252
|
+
* @returns Absolute path in user's home directory
|
|
253
|
+
*
|
|
254
|
+
* @example
|
|
255
|
+
* resolveHomeDir('.claude')
|
|
256
|
+
* // Returns: '/Users/john/.claude' (on macOS)
|
|
257
|
+
* // Returns: 'C:\\Users\\john\\.claude' (on Windows)
|
|
258
|
+
* // Returns: '/home/user/.claude' (on Linux)
|
|
259
|
+
*
|
|
260
|
+
* @example
|
|
261
|
+
* resolveHomeDir('.codex/auth.json')
|
|
262
|
+
* // Returns: '/Users/john/.codex/auth.json'
|
|
263
|
+
*/
|
|
264
|
+
export function resolveHomeDir(relativePath) {
|
|
265
|
+
return path.join(homedir(), relativePath);
|
|
266
|
+
}
|
|
267
|
+
//# sourceMappingURL=path-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"path-utils.js","sourceRoot":"","sources":["../../src/utils/path-utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAE7B;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,uBAAuB,CAAC,QAAgB;IACtD,OAAO,QAAQ,CAAC,UAAU,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;AACxC,CAAC;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,SAAS,CAAC,QAAgB;IACxC,MAAM,UAAU,GAAG,uBAAuB,CAAC,QAAQ,CAAC,CAAC;IACrD,OAAO,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;AAC/B,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,WAAW,CAAC,QAAgB;IAC1C,MAAM,KAAK,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;IAClC,OAAO,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;AAC5B,CAAC;AAED;;;;;;;GAOG;AACH,SAAS,aAAa,CAAC,KAAe,EAAE,WAAmB;IACzD,OAAO,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,KAAK,WAAW,CAAC,CAAC;AACvD,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,UAAU,oBAAoB,CAClC,QAAgB,EAChB,WAAmB,EACnB,iBAA2B;IAE3B,MAAM,KAAK,GAAG,SAAS,CAAC,QAAQ,CAAC,CA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,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;AAClE,CAAC;AAED,+EAA+E;AAC/E,4BAA4B;AAC5B,+EAA+E;AAE/E;;;;GAIG;AACH,MAAM,YAAY,GAAG,iEAAiE,CAAC;AAEvF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,WAAW,CAAC,GAAW;IACrC,OAAO,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAChC,CAAC;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,mBAAmB,CAAC,QAAgB,EAAE,SAAiB;IACrE,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;QAClC,OAAO,KAAK,CAAC;IACf,CAAC;IACD,MAAM,cAAc,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IAC5D,OAAO,WAAW,CAAC,cAAc,CAAC,CAAC;AACrC,CAAC;AAGD,+EAA+E;AAC/E,2BAA2B;AAC3B,+EAA+E;AAE/E;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,cAAc,CAAC,YAAoB;IACjD,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,YAAY,CAAC,CAAC;AAC5C,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Profile Display Utility
|
|
3
|
+
*
|
|
4
|
+
* Reusable profile formatting for consistent display across commands.
|
|
5
|
+
*/
|
|
6
|
+
import type { CodeMieConfigOptions } from '../env/types.js';
|
|
7
|
+
import type { AuthStatus } from '../providers/core/types.js';
|
|
8
|
+
/**
|
|
9
|
+
* Profile information for display
|
|
10
|
+
*/
|
|
11
|
+
export interface ProfileInfo {
|
|
12
|
+
name: string;
|
|
13
|
+
active: boolean;
|
|
14
|
+
profile: CodeMieConfigOptions;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Profile display utility class
|
|
18
|
+
*/
|
|
19
|
+
export declare class ProfileDisplay {
|
|
20
|
+
/**
|
|
21
|
+
* Format a single profile
|
|
22
|
+
*
|
|
23
|
+
* @param info - Profile information
|
|
24
|
+
* @returns Formatted string
|
|
25
|
+
*/
|
|
26
|
+
static format(info: ProfileInfo): string;
|
|
27
|
+
/**
|
|
28
|
+
* Display list of profiles
|
|
29
|
+
*
|
|
30
|
+
* @param profiles - Array of profile information
|
|
31
|
+
*/
|
|
32
|
+
static formatList(profiles: ProfileInfo[]): void;
|
|
33
|
+
/**
|
|
34
|
+
* Display profile with authentication status
|
|
35
|
+
*
|
|
36
|
+
* @param info - Profile information
|
|
37
|
+
* @param authStatus - Authentication status (optional)
|
|
38
|
+
*/
|
|
39
|
+
static formatStatus(info: ProfileInfo, authStatus?: AuthStatus): void;
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=profile-display.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profile-display.d.ts","sourceRoot":"","sources":["../../src/utils/profile-display.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAC5D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAG7D;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,oBAAoB,CAAC;CAC/B;AAGD;;GAEG;AACH,qBAAa,cAAc;IACzB;;;;;OAKG;IACH,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,WAAW,GAAG,MAAM;IAYxC;;;;OAIG;IACH,MAAM,CAAC,UAAU,CAAC,QAAQ,EAAE,WAAW,EAAE,GAAG,IAAI;IA6BhD;;;;;OAKG;IACH,MAAM,CAAC,YAAY,CAAC,IAAI,EAAE,WAAW,EAAE,UAAU,CAAC,EAAE,UAAU,GAAG,IAAI;CAgCtE"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Profile Display Utility
|
|
3
|
+
*
|
|
4
|
+
* Reusable profile formatting for consistent display across commands.
|
|
5
|
+
*/
|
|
6
|
+
import chalk from 'chalk';
|
|
7
|
+
import { renderProfileInfo } from './profile.js';
|
|
8
|
+
/**
|
|
9
|
+
* Profile display utility class
|
|
10
|
+
*/
|
|
11
|
+
export class ProfileDisplay {
|
|
12
|
+
/**
|
|
13
|
+
* Format a single profile
|
|
14
|
+
*
|
|
15
|
+
* @param info - Profile information
|
|
16
|
+
* @returns Formatted string
|
|
17
|
+
*/
|
|
18
|
+
static format(info) {
|
|
19
|
+
const { name, active, profile } = info;
|
|
20
|
+
return renderProfileInfo({
|
|
21
|
+
profile: name,
|
|
22
|
+
provider: profile.provider || 'N/A',
|
|
23
|
+
model: profile.model || 'N/A',
|
|
24
|
+
codeMieUrl: profile.codeMieUrl,
|
|
25
|
+
isActive: active
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Display list of profiles
|
|
30
|
+
*
|
|
31
|
+
* @param profiles - Array of profile information
|
|
32
|
+
*/
|
|
33
|
+
static formatList(profiles) {
|
|
34
|
+
if (profiles.length === 0) {
|
|
35
|
+
console.log(chalk.yellow('\nNo profiles found. Run "codemie setup" to create one.\n'));
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
console.log(chalk.bold.cyan('\n📋 All Profiles:\n'));
|
|
39
|
+
profiles.forEach((profile, index) => {
|
|
40
|
+
const formatted = this.format(profile);
|
|
41
|
+
console.log(formatted);
|
|
42
|
+
// Add separator between profiles except for the last one
|
|
43
|
+
if (index < profiles.length - 1) {
|
|
44
|
+
console.log(chalk.dim('─'.repeat(50)));
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
console.log(chalk.dim('─'.repeat(50)));
|
|
48
|
+
console.log(chalk.bold(' Next Steps:'));
|
|
49
|
+
console.log('');
|
|
50
|
+
console.log(' ' + chalk.white('• Switch active profile:') + ' ' + chalk.cyan('codemie profile switch'));
|
|
51
|
+
console.log(' ' + chalk.white('• View profile status:') + ' ' + chalk.cyan('codemie profile status'));
|
|
52
|
+
console.log(' ' + chalk.white('• Create new profile:') + ' ' + chalk.cyan('codemie setup'));
|
|
53
|
+
console.log(' ' + chalk.white('• Remove a profile:') + ' ' + chalk.cyan('codemie profile delete'));
|
|
54
|
+
console.log(' ' + chalk.white('• Explore more:') + ' ' + chalk.cyan('codemie --help'));
|
|
55
|
+
console.log('');
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Display profile with authentication status
|
|
59
|
+
*
|
|
60
|
+
* @param info - Profile information
|
|
61
|
+
* @param authStatus - Authentication status (optional)
|
|
62
|
+
*/
|
|
63
|
+
static formatStatus(info, authStatus) {
|
|
64
|
+
console.log(chalk.bold.cyan('\n📋 Profile Status:\n'));
|
|
65
|
+
const { name, active, profile } = info;
|
|
66
|
+
// Convert AuthStatus to AuthStatusDisplay
|
|
67
|
+
const authStatusDisplay = authStatus
|
|
68
|
+
? {
|
|
69
|
+
authenticated: authStatus.authenticated,
|
|
70
|
+
expiresAt: authStatus.expiresAt,
|
|
71
|
+
apiUrl: authStatus.apiUrl
|
|
72
|
+
}
|
|
73
|
+
: undefined;
|
|
74
|
+
const formatted = renderProfileInfo({
|
|
75
|
+
profile: name,
|
|
76
|
+
provider: profile.provider || 'N/A',
|
|
77
|
+
model: profile.model || 'N/A',
|
|
78
|
+
codeMieUrl: profile.codeMieUrl,
|
|
79
|
+
authStatus: authStatusDisplay,
|
|
80
|
+
isActive: active
|
|
81
|
+
});
|
|
82
|
+
console.log(formatted);
|
|
83
|
+
// Show login hint if not authenticated
|
|
84
|
+
if (authStatus && !authStatus.authenticated) {
|
|
85
|
+
console.log(chalk.yellow('💡 Run: codemie profile login'));
|
|
86
|
+
console.log('');
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=profile-display.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profile-display.js","sourceRoot":"","sources":["../../src/utils/profile-display.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,iBAAiB,EAA0B,MAAM,cAAc,CAAC;AAYzE;;GAEG;AACH,MAAM,OAAO,cAAc;IACzB;;;;;OAKG;IACH,MAAM,CAAC,MAAM,CAAC,IAAiB;QAC7B,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;QAEvC,OAAO,iBAAiB,CAAC;YACvB,OAAO,EAAE,IAAI;YACb,QAAQ,EAAE,OAAO,CAAC,QAAQ,IAAI,KAAK;YACnC,KAAK,EAAE,OAAO,CAAC,KAAK,IAAI,KAAK;YAC7B,UAAU,EAAE,OAAO,CAAC,UAAU;YAC9B,QAAQ,EAAE,MAAM;SACjB,CAAC,CAAC;IACL,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,UAAU,CAAC,QAAuB;QACvC,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC1B,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,2DAA2D,CAAC,CAAC,CAAC;YACvF,OAAO;QACT,CAAC;QAED,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC,CAAC;QAErD,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE;YAClC,MAAM,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;YACvC,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;YAEvB,yDAAyD;YACzD,IAAI,KAAK,GAAG,QAAQ,CAAC,MAAM,GAAG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CAAC,YAAY,CAAC,IAAiB,EAAE,UAAuB;QAC5D,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC,CAAC;QAEvD,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;QAEvC,0CAA0C;QAC1C,MAAM,iBAAiB,GAAkC,UAAU;YACjE,CAAC,CAAC;gBACE,aAAa,EAAE,UAAU,CAAC,aAAa;gBACvC,SAAS,EAAE,UAAU,CAAC,SAAS;gBAC/B,MAAM,EAAE,UAAU,CAAC,MAAM;aAC1B;YACH,CAAC,CAAC,SAAS,CAAC;QAEd,MAAM,SAAS,GAAG,iBAAiB,CAAC;YAClC,OAAO,EAAE,IAAI;YACb,QAAQ,EAAE,OAAO,CAAC,QAAQ,IAAI,KAAK;YACnC,KAAK,EAAE,OAAO,CAAC,KAAK,IAAI,KAAK;YAC7B,UAAU,EAAE,OAAO,CAAC,UAAU;YAC9B,UAAU,EAAE,iBAAiB;YAC7B,QAAQ,EAAE,MAAM;SACjB,CAAC,CAAC;QAEH,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QAEvB,uCAAuC;QACvC,IAAI,UAAU,IAAI,CAAC,UAAU,CAAC,aAAa,EAAE,CAAC;YAC5C,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,+BAA+B,CAAC,CAAC,CAAC;YAC3D,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAClB,CAAC;IACH,CAAC;CAEF"}
|
package/dist/utils/profile.d.ts
CHANGED
|
@@ -1,14 +1,25 @@
|
|
|
1
1
|
import { type ErrorContext } from './error-context.js';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Authentication status for display
|
|
4
|
+
*/
|
|
5
|
+
export interface AuthStatusDisplay {
|
|
6
|
+
authenticated: boolean;
|
|
7
|
+
expiresAt?: number;
|
|
8
|
+
apiUrl?: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Renders the CodeMie profile information in a unified table format
|
|
4
12
|
*/
|
|
5
13
|
export declare function renderProfileInfo(config: {
|
|
6
14
|
profile?: string;
|
|
7
15
|
provider?: string;
|
|
8
16
|
model?: string;
|
|
17
|
+
codeMieUrl?: string;
|
|
18
|
+
authStatus?: AuthStatusDisplay;
|
|
9
19
|
agent?: string;
|
|
10
20
|
cliVersion?: string;
|
|
11
21
|
sessionId?: string;
|
|
22
|
+
isActive?: boolean;
|
|
12
23
|
}): string;
|
|
13
24
|
/**
|
|
14
25
|
* Display a non-blocking warning message after profile info
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profile.d.ts","sourceRoot":"","sources":["../../src/utils/profile.ts"],"names":[],"mappings":"AACA,OAAO,EAA8B,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGnF;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE;IACxC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"profile.d.ts","sourceRoot":"","sources":["../../src/utils/profile.ts"],"names":[],"mappings":"AACA,OAAO,EAA8B,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGnF;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,aAAa,EAAE,OAAO,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE;IACxC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,iBAAiB,CAAC;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,GAAG,MAAM,CA2ET;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,OAAO,EACd,cAAc,CAAC,EAAE,YAAY,CAAC,SAAS,CAAC,EACxC,OAAO,GAAE;IACP,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,EAAE,SAAS,GAAG,OAAO,GAAG,MAAM,CAAC;CACpC,GACL,IAAI,CAuDN;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC/B,IAAI,CAcN"}
|
package/dist/utils/profile.js
CHANGED
|
@@ -2,34 +2,77 @@ import chalk from 'chalk';
|
|
|
2
2
|
import { formatErrorWithExplanation } from './error-context.js';
|
|
3
3
|
import { logger } from './logger.js';
|
|
4
4
|
/**
|
|
5
|
-
* Renders the CodeMie
|
|
5
|
+
* Renders the CodeMie profile information in a unified table format
|
|
6
6
|
*/
|
|
7
7
|
export function renderProfileInfo(config) {
|
|
8
8
|
// Build complete output with logo and info
|
|
9
9
|
const outputLines = [];
|
|
10
10
|
outputLines.push(''); // Empty line for spacing
|
|
11
|
+
// Helper to format a row with colored label and value
|
|
12
|
+
const formatRow = (label, value, valueColor) => {
|
|
13
|
+
const colorFn = valueColor || chalk.white;
|
|
14
|
+
return chalk.cyan(label.padEnd(13) + '│ ') + colorFn(value);
|
|
15
|
+
};
|
|
11
16
|
// Configuration details
|
|
12
17
|
if (config.cliVersion) {
|
|
13
|
-
outputLines.push(
|
|
18
|
+
outputLines.push(formatRow('CLI Version', config.cliVersion));
|
|
14
19
|
}
|
|
15
20
|
if (config.profile) {
|
|
16
|
-
|
|
21
|
+
// Highlight active profile with explicit "Active" label in green bold
|
|
22
|
+
if (config.isActive) {
|
|
23
|
+
outputLines.push(chalk.cyan('Profile'.padEnd(13) + '│ ') + chalk.white(config.profile) + ' ' + chalk.green.bold('(Active)'));
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
outputLines.push(formatRow('Profile', config.profile));
|
|
27
|
+
}
|
|
17
28
|
}
|
|
18
29
|
if (config.provider) {
|
|
19
|
-
outputLines.push(
|
|
30
|
+
outputLines.push(formatRow('Provider', config.provider));
|
|
20
31
|
}
|
|
21
32
|
if (config.model) {
|
|
22
|
-
outputLines.push(
|
|
33
|
+
outputLines.push(formatRow('Model', config.model));
|
|
34
|
+
}
|
|
35
|
+
if (config.codeMieUrl) {
|
|
36
|
+
outputLines.push(formatRow('CodeMie URL', config.codeMieUrl));
|
|
37
|
+
}
|
|
38
|
+
// Auth status inline
|
|
39
|
+
if (config.authStatus) {
|
|
40
|
+
const { authenticated, expiresAt, apiUrl } = config.authStatus;
|
|
41
|
+
if (authenticated) {
|
|
42
|
+
let statusText = '✓ Authenticated';
|
|
43
|
+
let isExpired = false;
|
|
44
|
+
if (expiresAt) {
|
|
45
|
+
const expiresIn = Math.max(0, expiresAt - Date.now());
|
|
46
|
+
const hours = Math.floor(expiresIn / (1000 * 60 * 60));
|
|
47
|
+
const minutes = Math.floor((expiresIn % (1000 * 60 * 60)) / (1000 * 60));
|
|
48
|
+
if (expiresIn > 0) {
|
|
49
|
+
statusText += ` (expires in ${hours}h ${minutes}m)`;
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
statusText = '✗ Expired';
|
|
53
|
+
isExpired = true;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
if (apiUrl) {
|
|
57
|
+
outputLines.push(formatRow('Auth Status', statusText, isExpired ? chalk.red : chalk.green));
|
|
58
|
+
outputLines.push(formatRow('API URL', apiUrl));
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
outputLines.push(formatRow('Auth Status', statusText, isExpired ? chalk.red : chalk.green));
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
outputLines.push(formatRow('Auth Status', '✗ Not authenticated', chalk.red));
|
|
66
|
+
}
|
|
23
67
|
}
|
|
24
68
|
if (config.agent) {
|
|
25
|
-
outputLines.push(
|
|
69
|
+
outputLines.push(formatRow('Agent', config.agent));
|
|
26
70
|
}
|
|
27
71
|
if (config.sessionId) {
|
|
28
|
-
outputLines.push(
|
|
72
|
+
outputLines.push(formatRow('Session', config.sessionId));
|
|
29
73
|
}
|
|
30
74
|
outputLines.push(''); // Empty line for spacing
|
|
31
|
-
|
|
32
|
-
return chalk.cyan(outputLines.join('\n'));
|
|
75
|
+
return outputLines.join('\n');
|
|
33
76
|
}
|
|
34
77
|
/**
|
|
35
78
|
* Display a non-blocking warning message after profile info
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profile.js","sourceRoot":"","sources":["../../src/utils/profile.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,0BAA0B,EAAqB,MAAM,oBAAoB,CAAC;AACnF,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"profile.js","sourceRoot":"","sources":["../../src/utils/profile.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,0BAA0B,EAAqB,MAAM,oBAAoB,CAAC;AACnF,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAWrC;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAAC,MAUjC;IACC,2CAA2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AO,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;YAC/C,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,GAAG,KAAK,KAAK,EAAE,CAAC,CAAC,CAAC;QACpD,CAAC,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,UAAU;IAE1B,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;AAClC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"which.d.ts","sourceRoot":"","sources":["../../src/utils/which.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH;;;;;GAKG;AACH,wBAAsB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"which.d.ts","sourceRoot":"","sources":["../../src/utils/which.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH;;;;;GAKG;AACH,wBAAsB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAWrE;AAED;;;;;GAKG;AACH,wBAAsB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAuB5E"}
|
package/dist/utils/which.js
CHANGED
|
@@ -14,7 +14,8 @@ import { exec } from './exec.js';
|
|
|
14
14
|
export async function commandExists(command) {
|
|
15
15
|
try {
|
|
16
16
|
const isWindows = os.platform() === 'win32';
|
|
17
|
-
|
|
17
|
+
// On Windows, use full path to where.exe to avoid shell: true deprecation (DEP0190)
|
|
18
|
+
const whichCommand = isWindows ? 'C:\\Windows\\System32\\where.exe' : 'which';
|
|
18
19
|
const result = await exec(whichCommand, [command]);
|
|
19
20
|
return result.code === 0;
|
|
20
21
|
}
|
|
@@ -31,11 +32,17 @@ export async function commandExists(command) {
|
|
|
31
32
|
export async function getCommandPath(command) {
|
|
32
33
|
try {
|
|
33
34
|
const isWindows = os.platform() === 'win32';
|
|
34
|
-
|
|
35
|
+
// On Windows, use full path to where.exe to avoid shell: true deprecation (DEP0190)
|
|
36
|
+
const whichCommand = isWindows ? 'C:\\Windows\\System32\\where.exe' : 'which';
|
|
35
37
|
const result = await exec(whichCommand, [command]);
|
|
36
38
|
if (result.code === 0) {
|
|
37
39
|
// On Windows, 'where' can return multiple paths, take the first one
|
|
38
|
-
|
|
40
|
+
// Split by any line ending (\n, \r\n, or \r) for maximum compatibility
|
|
41
|
+
// This handles Unix (\n), Windows (\r\n), and old Mac (\r) line endings
|
|
42
|
+
const paths = result.stdout
|
|
43
|
+
.split(/\r?\n|\r/) // Split by \r\n, \n, or \r
|
|
44
|
+
.map(p => p.trim())
|
|
45
|
+
.filter(p => p);
|
|
39
46
|
return paths[0] || null;
|
|
40
47
|
}
|
|
41
48
|
return null;
|
package/dist/utils/which.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"which.js","sourceRoot":"","sources":["../../src/utils/which.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,OAAe;IACjD,IAAI,CAAC;QACH,MAAM,SAAS,GAAG,EAAE,CAAC,QAAQ,EAAE,KAAK,OAAO,CAAC;QAC5C,MAAM,YAAY,GAAG,SAAS,CAAC,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"which.js","sourceRoot":"","sources":["../../src/utils/which.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC;;;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OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codemieai/code",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.26",
|
|
4
4
|
"description": "Unified AI coding assistant CLI - Manage Claude Code, Codex, Gemini & custom agents. Multi-provider support (OpenAI, Azure, LiteLLM, SSO). Built-in LangGraph agent with file operations & git integration.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AASpC,wBAAgB,iBAAiB,IAAI,OAAO,CA+D3C"}
|