@codemieai/code 0.0.16 → 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 +62 -5
- 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 +3 -32
- package/dist/agents/codemie-code/agent.js.map +1 -1
- package/dist/agents/codemie-code/tools/planning.d.ts +2 -2
- package/dist/agents/core/AgentCLI.d.ts.map +1 -1
- package/dist/agents/core/AgentCLI.js +25 -59
- package/dist/agents/core/AgentCLI.js.map +1 -1
- package/dist/agents/core/BaseAgentAdapter.d.ts +9 -1
- package/dist/agents/core/BaseAgentAdapter.d.ts.map +1 -1
- package/dist/agents/core/BaseAgentAdapter.js +103 -10
- 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 +45 -13
- 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 +0 -2
- package/dist/agents/plugins/codex.plugin.js.map +1 -1
- package/dist/agents/plugins/gemini.plugin.d.ts.map +1 -1
- package/dist/agents/plugins/gemini.plugin.js +0 -7
- 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/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/index.d.ts.map +1 -1
- package/dist/cli/commands/doctor/index.js +85 -3
- package/dist/cli/commands/doctor/index.js.map +1 -1
- package/dist/cli/commands/profile.d.ts.map +1 -1
- package/dist/cli/commands/profile.js +49 -89
- package/dist/cli/commands/profile.js.map +1 -1
- package/dist/cli/commands/setup.js +1 -21
- package/dist/cli/commands/setup.js.map +1 -1
- package/dist/cli/index.js +1 -1
- 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/index.d.ts +2 -0
- package/dist/providers/index.d.ts.map +1 -1
- package/dist/providers/index.js +2 -0
- package/dist/providers/index.js.map +1 -1
- package/dist/providers/integration/setup-ui.d.ts +1 -1
- package/dist/providers/integration/setup-ui.d.ts.map +1 -1
- package/dist/providers/integration/setup-ui.js +51 -6
- package/dist/providers/integration/setup-ui.js.map +1 -1
- 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/ollama/ollama.template.d.ts.map +1 -1
- package/dist/providers/plugins/ollama/ollama.template.js +2 -0
- package/dist/providers/plugins/ollama/ollama.template.js.map +1 -1
- package/dist/providers/plugins/sso/sso.http-client.d.ts +2 -0
- package/dist/providers/plugins/sso/sso.http-client.d.ts.map +1 -1
- package/dist/providers/plugins/sso/sso.http-client.js +9 -3
- package/dist/providers/plugins/sso/sso.http-client.js.map +1 -1
- package/dist/proxy/http-client.d.ts.map +1 -1
- package/dist/proxy/http-client.js +49 -14
- package/dist/proxy/http-client.js.map +1 -1
- 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.js +3 -0
- package/dist/proxy/plugins/header-injection.plugin.js.map +1 -1
- package/dist/proxy/plugins/index.d.ts +3 -1
- package/dist/proxy/plugins/index.d.ts.map +1 -1
- package/dist/proxy/plugins/index.js +5 -1
- package/dist/proxy/plugins/index.js.map +1 -1
- package/dist/proxy/plugins/logging.plugin.d.ts +3 -3
- package/dist/proxy/plugins/logging.plugin.js +84 -20
- package/dist/proxy/plugins/logging.plugin.js.map +1 -1
- 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 -1
- package/dist/proxy/plugins/registry.js +8 -1
- package/dist/proxy/plugins/registry.js.map +1 -1
- package/dist/proxy/plugins/types.d.ts +6 -2
- package/dist/proxy/plugins/types.d.ts.map +1 -1
- package/dist/proxy/types.d.ts +7 -0
- package/dist/proxy/types.d.ts.map +1 -1
- 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 +0 -6
- package/dist/utils/codemie-proxy.d.ts.map +1 -1
- package/dist/utils/codemie-proxy.js +46 -56
- package/dist/utils/codemie-proxy.js.map +1 -1
- package/dist/utils/config-loader.d.ts.map +1 -1
- package/dist/utils/config-loader.js +22 -6
- package/dist/utils/config-loader.js.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 -20
- 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 -280
- 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 -21
- package/dist/analytics/remote-submission/metric-transformer.d.ts.map +0 -1
- package/dist/analytics/remote-submission/metric-transformer.js +0 -82
- package/dist/analytics/remote-submission/metric-transformer.js.map +0 -1
- package/dist/analytics/remote-submission/submitter.d.ts +0 -79
- package/dist/analytics/remote-submission/submitter.d.ts.map +0 -1
- package/dist/analytics/remote-submission/submitter.js +0 -362
- package/dist/analytics/remote-submission/submitter.js.map +0 -1
- package/dist/analytics/remote-submission/types.d.ts +0 -123
- 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/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/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
|
@@ -1,748 +0,0 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
|
-
import chalk from 'chalk';
|
|
3
|
-
import Table from 'cli-table3';
|
|
4
|
-
import { loadAnalyticsConfig } from '../../analytics/config.js';
|
|
5
|
-
import { logger } from '../../utils/logger.js';
|
|
6
|
-
import { AgentRegistry } from '../../agents/registry.js';
|
|
7
|
-
import { ConfigLoader } from '../../utils/config-loader.js';
|
|
8
|
-
import { CodemieAnalyticsAggregator } from '../../analytics/aggregation/index.js';
|
|
9
|
-
import { normalizeModelName } from '../../analytics/aggregation/core/index.js';
|
|
10
|
-
export function createAnalyticsCommand() {
|
|
11
|
-
const command = new Command('analytics');
|
|
12
|
-
command
|
|
13
|
-
.description('Analytics management and insights')
|
|
14
|
-
.action(async () => {
|
|
15
|
-
try {
|
|
16
|
-
const config = loadAnalyticsConfig();
|
|
17
|
-
// Show configuration
|
|
18
|
-
console.log(chalk.bold.cyan('\n📊 Analytics Configuration\n'));
|
|
19
|
-
console.log(chalk.cyan('Status: ') + (config.enabled ? chalk.green('Enabled') : chalk.red('Disabled')));
|
|
20
|
-
console.log(chalk.cyan('Target: ') + chalk.white(config.target));
|
|
21
|
-
console.log(chalk.cyan('Local Path: ') + chalk.white(config.localPath));
|
|
22
|
-
if (config.remoteEndpoint) {
|
|
23
|
-
console.log(chalk.cyan('Remote Endpoint: ') + chalk.white(config.remoteEndpoint));
|
|
24
|
-
}
|
|
25
|
-
console.log(chalk.cyan('Flush Interval: ') + chalk.white(`${config.flushInterval}ms`));
|
|
26
|
-
console.log(chalk.cyan('Buffer Size: ') + chalk.white(`${config.maxBufferSize} events`));
|
|
27
|
-
// Show help
|
|
28
|
-
console.log(chalk.bold.cyan('\n📋 Available Commands\n'));
|
|
29
|
-
console.log(chalk.white(' codemie analytics enable ') + chalk.gray('Enable analytics collection'));
|
|
30
|
-
console.log(chalk.white(' codemie analytics disable ') + chalk.gray('Disable analytics collection'));
|
|
31
|
-
console.log(chalk.white(' codemie analytics show ') + chalk.gray('Show analytics from all agents'));
|
|
32
|
-
console.log();
|
|
33
|
-
}
|
|
34
|
-
catch (error) {
|
|
35
|
-
logger.error('Failed to show analytics configuration:', error);
|
|
36
|
-
process.exit(1);
|
|
37
|
-
}
|
|
38
|
-
})
|
|
39
|
-
.addCommand(createEnableCommand())
|
|
40
|
-
.addCommand(createDisableCommand())
|
|
41
|
-
.addCommand(createShowCommand());
|
|
42
|
-
return command;
|
|
43
|
-
}
|
|
44
|
-
function createEnableCommand() {
|
|
45
|
-
const command = new Command('enable');
|
|
46
|
-
command
|
|
47
|
-
.description('Enable analytics collection')
|
|
48
|
-
.action(async () => {
|
|
49
|
-
try {
|
|
50
|
-
await updateAnalyticsEnabled(true);
|
|
51
|
-
logger.success('Analytics enabled');
|
|
52
|
-
console.log(chalk.white('Analytics data will be collected to:'));
|
|
53
|
-
console.log(chalk.cyan(' ~/.codemie/analytics/'));
|
|
54
|
-
console.log();
|
|
55
|
-
}
|
|
56
|
-
catch (error) {
|
|
57
|
-
logger.error('Failed to enable analytics:', error);
|
|
58
|
-
process.exit(1);
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
return command;
|
|
62
|
-
}
|
|
63
|
-
function createDisableCommand() {
|
|
64
|
-
const command = new Command('disable');
|
|
65
|
-
command
|
|
66
|
-
.description('Disable analytics collection')
|
|
67
|
-
.action(async () => {
|
|
68
|
-
try {
|
|
69
|
-
await updateAnalyticsEnabled(false);
|
|
70
|
-
logger.success('Analytics disabled');
|
|
71
|
-
console.log(chalk.white('No analytics data will be collected.'));
|
|
72
|
-
console.log();
|
|
73
|
-
}
|
|
74
|
-
catch (error) {
|
|
75
|
-
logger.error('Failed to disable analytics:', error);
|
|
76
|
-
process.exit(1);
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
return command;
|
|
80
|
-
}
|
|
81
|
-
function createShowCommand() {
|
|
82
|
-
const command = new Command('show');
|
|
83
|
-
command
|
|
84
|
-
.description('Show analytics from all agents (Gemini, Claude, Codex, etc.)')
|
|
85
|
-
.option('--from <date>', 'Start date (YYYY-MM-DD)')
|
|
86
|
-
.option('--to <date>', 'End date (YYYY-MM-DD)')
|
|
87
|
-
.option('--agent <name>', 'Filter by agent (gemini|claude|codex|codemie-code)')
|
|
88
|
-
.option('--project <path>', 'Filter by project path')
|
|
89
|
-
.option('--format <format>', 'Output format (json|table)', 'table')
|
|
90
|
-
.option('--output <file>', 'Output file (for JSON format)')
|
|
91
|
-
.option('--verbose', 'Show detailed statistics with raw model names and additional metrics')
|
|
92
|
-
.action(async (options) => {
|
|
93
|
-
try {
|
|
94
|
-
// Check if analytics is disabled
|
|
95
|
-
const config = loadAnalyticsConfig();
|
|
96
|
-
if (!config.enabled) {
|
|
97
|
-
console.log(chalk.yellow('\nAnalytics is disabled. No data is being collected.\n'));
|
|
98
|
-
return;
|
|
99
|
-
}
|
|
100
|
-
console.log(chalk.bold.cyan('\n📊 CodeMie Analytics Aggregation\n'));
|
|
101
|
-
// Parse dates
|
|
102
|
-
const dateFrom = options.from ? new Date(options.from) : undefined;
|
|
103
|
-
const dateTo = options.to ? new Date(options.to) : undefined;
|
|
104
|
-
// Validate dates
|
|
105
|
-
if (dateFrom && isNaN(dateFrom.getTime())) {
|
|
106
|
-
logger.error('Invalid start date format. Use YYYY-MM-DD');
|
|
107
|
-
process.exit(1);
|
|
108
|
-
}
|
|
109
|
-
if (dateTo && isNaN(dateTo.getTime())) {
|
|
110
|
-
logger.error('Invalid end date format. Use YYYY-MM-DD');
|
|
111
|
-
process.exit(1);
|
|
112
|
-
}
|
|
113
|
-
// Validate agent if specified
|
|
114
|
-
if (options.agent) {
|
|
115
|
-
const validAgents = AgentRegistry.getAgentNames();
|
|
116
|
-
if (!validAgents.includes(options.agent)) {
|
|
117
|
-
logger.error(`Invalid agent: ${options.agent}`);
|
|
118
|
-
console.log(chalk.white('Available agents:'));
|
|
119
|
-
validAgents.forEach(name => {
|
|
120
|
-
const adapter = AgentRegistry.getAgent(name);
|
|
121
|
-
console.log(` ${chalk.cyan(name.padEnd(15))} ${chalk.white(adapter?.displayName || '')}`);
|
|
122
|
-
});
|
|
123
|
-
process.exit(1);
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
// Create aggregator and fetch sessions
|
|
127
|
-
const aggregator = new CodemieAnalyticsAggregator();
|
|
128
|
-
const sessions = await aggregator.aggregateSessions({
|
|
129
|
-
dateFrom,
|
|
130
|
-
dateTo,
|
|
131
|
-
agent: options.agent,
|
|
132
|
-
projectPath: options.project
|
|
133
|
-
});
|
|
134
|
-
if (sessions.length === 0) {
|
|
135
|
-
console.log(chalk.yellow('No sessions found matching the criteria.\n'));
|
|
136
|
-
return;
|
|
137
|
-
}
|
|
138
|
-
// Output based on format
|
|
139
|
-
if (options.format === 'json') {
|
|
140
|
-
const output = {
|
|
141
|
-
version: '1.0.0',
|
|
142
|
-
exportedAt: new Date().toISOString(),
|
|
143
|
-
filters: {
|
|
144
|
-
dateFrom: dateFrom?.toISOString(),
|
|
145
|
-
dateTo: dateTo?.toISOString(),
|
|
146
|
-
agent: options.agent,
|
|
147
|
-
projectPath: options.project
|
|
148
|
-
},
|
|
149
|
-
sessions
|
|
150
|
-
};
|
|
151
|
-
if (options.output) {
|
|
152
|
-
const { writeFile } = await import('node:fs/promises');
|
|
153
|
-
await writeFile(options.output, JSON.stringify(output, null, 2));
|
|
154
|
-
logger.success(`Exported to ${options.output}`);
|
|
155
|
-
}
|
|
156
|
-
else {
|
|
157
|
-
console.log(JSON.stringify(output, null, 2));
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
else {
|
|
161
|
-
// Table format
|
|
162
|
-
console.log(chalk.white(`Found ${chalk.cyan(sessions.length.toString())} sessions\n`));
|
|
163
|
-
// Show date range of found sessions
|
|
164
|
-
if (sessions.length > 0) {
|
|
165
|
-
const startDates = sessions.map(s => s.startTime.getTime());
|
|
166
|
-
const endDates = sessions.map(s => s.endTime?.getTime() || s.startTime.getTime());
|
|
167
|
-
const earliestDate = new Date(Math.min(...startDates));
|
|
168
|
-
const latestDate = new Date(Math.max(...endDates));
|
|
169
|
-
console.log(chalk.bold.white('📅 Date Range\n'));
|
|
170
|
-
const dateRangeTable = new Table({
|
|
171
|
-
head: [chalk.cyan('Period'), chalk.cyan('Date')],
|
|
172
|
-
style: {
|
|
173
|
-
head: [],
|
|
174
|
-
border: ['grey']
|
|
175
|
-
},
|
|
176
|
-
colWidths: [25, 60]
|
|
177
|
-
});
|
|
178
|
-
dateRangeTable.push([chalk.white('From'), chalk.white(earliestDate.toLocaleString())], [chalk.white('To'), chalk.white(latestDate.toLocaleString())]);
|
|
179
|
-
console.log(dateRangeTable.toString());
|
|
180
|
-
console.log();
|
|
181
|
-
}
|
|
182
|
-
// Calculate summary statistics
|
|
183
|
-
const totalTokens = sessions.reduce((sum, s) => sum + s.tokens.total, 0);
|
|
184
|
-
const totalInputTokens = sessions.reduce((sum, s) => sum + s.tokens.input, 0);
|
|
185
|
-
const totalOutputTokens = sessions.reduce((sum, s) => sum + s.tokens.output, 0);
|
|
186
|
-
const totalCacheRead = sessions.reduce((sum, s) => sum + s.tokens.cacheRead, 0);
|
|
187
|
-
const totalCacheCreation = sessions.reduce((sum, s) => sum + s.tokens.cacheCreation, 0);
|
|
188
|
-
const totalThoughts = sessions.reduce((sum, s) => sum + (s.tokens.thoughts || 0), 0);
|
|
189
|
-
const totalReasoning = sessions.reduce((sum, s) => sum + (s.tokens.reasoning || 0), 0);
|
|
190
|
-
const totalToolTokens = sessions.reduce((sum, s) => sum + (s.tokens.tool || 0), 0);
|
|
191
|
-
const totalToolCalls = sessions.reduce((sum, s) => sum + s.toolCallCount, 0);
|
|
192
|
-
const totalFileModifications = sessions.reduce((sum, s) => sum + s.fileModifications, 0);
|
|
193
|
-
// 1. SUMMARY - Sessions & Messages
|
|
194
|
-
console.log(chalk.bold.white('📈 Summary Statistics\n'));
|
|
195
|
-
const summaryTable = new Table({
|
|
196
|
-
head: [chalk.cyan('Metric'), chalk.cyan('Value')],
|
|
197
|
-
style: {
|
|
198
|
-
head: [],
|
|
199
|
-
border: ['grey']
|
|
200
|
-
},
|
|
201
|
-
colWidths: [25, 60]
|
|
202
|
-
});
|
|
203
|
-
const totalUserPrompts = sessions.reduce((sum, s) => sum + s.userPromptCount, 0);
|
|
204
|
-
const totalUserMessages = sessions.reduce((sum, s) => sum + s.userMessageCount, 0);
|
|
205
|
-
const totalResponses = sessions.reduce((sum, s) => sum + s.assistantMessageCount, 0);
|
|
206
|
-
// Calculate overall user prompt percentage
|
|
207
|
-
const overallUserPromptPercentage = totalUserMessages > 0
|
|
208
|
-
? (totalUserPrompts / totalUserMessages) * 100
|
|
209
|
-
: 100;
|
|
210
|
-
// Calculate system message percentage
|
|
211
|
-
const systemMessagePercentage = 100 - overallUserPromptPercentage;
|
|
212
|
-
summaryTable.push([chalk.white('Sessions'), chalk.white(sessions.length.toString())], [chalk.white('User Prompts'), chalk.white(`${totalUserPrompts.toLocaleString()} typed by user (${overallUserPromptPercentage.toFixed(1)}%)`)], [chalk.white('System Messages'), chalk.white(`${(totalUserMessages - totalUserPrompts).toLocaleString()} auto-generated (${systemMessagePercentage.toFixed(1)}%)`)], [chalk.white('Total User Messages'), chalk.white(`${totalUserMessages.toLocaleString()}`)], [chalk.white('Assistant Messages'), chalk.white(`${totalResponses.toLocaleString()}`)]);
|
|
213
|
-
console.log(summaryTable.toString());
|
|
214
|
-
console.log();
|
|
215
|
-
// 2. Code Generation Statistics
|
|
216
|
-
const sessionsWithFileStats = sessions.filter(s => s.fileStats);
|
|
217
|
-
if (sessionsWithFileStats.length > 0) {
|
|
218
|
-
const totalLinesGenerated = sessionsWithFileStats.reduce((sum, s) => sum + (s.fileStats?.totalLinesAdded || 0), 0);
|
|
219
|
-
const totalLinesRemoved = sessionsWithFileStats.reduce((sum, s) => sum + (s.fileStats?.totalLinesRemoved || 0), 0);
|
|
220
|
-
const totalFilesCreated = sessionsWithFileStats.reduce((sum, s) => sum + (s.fileStats?.filesCreated || 0), 0);
|
|
221
|
-
const totalFilesModified = sessionsWithFileStats.reduce((sum, s) => sum + (s.fileStats?.filesModified || 0), 0);
|
|
222
|
-
const netLines = totalLinesGenerated - totalLinesRemoved;
|
|
223
|
-
console.log(chalk.bold.white('📝 Code Generation\n'));
|
|
224
|
-
const codeGenTable = new Table({
|
|
225
|
-
head: [chalk.cyan('Metric'), chalk.cyan('Value')],
|
|
226
|
-
style: {
|
|
227
|
-
head: [],
|
|
228
|
-
border: ['grey']
|
|
229
|
-
},
|
|
230
|
-
colWidths: [25, 60]
|
|
231
|
-
});
|
|
232
|
-
codeGenTable.push([chalk.white('Lines Generated'), chalk.white(totalLinesGenerated.toLocaleString())]);
|
|
233
|
-
if (totalLinesRemoved > 0) {
|
|
234
|
-
codeGenTable.push([chalk.white('Lines Removed'), chalk.white(totalLinesRemoved.toLocaleString())], [chalk.white('Net Lines'), chalk.white(netLines.toLocaleString())]);
|
|
235
|
-
}
|
|
236
|
-
codeGenTable.push([chalk.white('Files Created'), chalk.white(totalFilesCreated.toString())], [chalk.white('Files Modified'), chalk.white(totalFilesModified.toString())], [chalk.white('File Modifications'), chalk.white(totalFileModifications.toString())]);
|
|
237
|
-
console.log(codeGenTable.toString());
|
|
238
|
-
console.log();
|
|
239
|
-
}
|
|
240
|
-
// 3. Token Breakdown
|
|
241
|
-
console.log(chalk.bold.white('💰 Token Usage\n'));
|
|
242
|
-
const tokenTable = new Table({
|
|
243
|
-
head: [chalk.cyan('Type'), chalk.cyan('Tokens')],
|
|
244
|
-
style: {
|
|
245
|
-
head: [],
|
|
246
|
-
border: ['grey']
|
|
247
|
-
},
|
|
248
|
-
colWidths: [25, 60]
|
|
249
|
-
});
|
|
250
|
-
tokenTable.push([chalk.white('Total'), chalk.white(totalTokens.toLocaleString())], [chalk.white('Input'), chalk.white(totalInputTokens.toLocaleString())], [chalk.white('Output'), chalk.white(totalOutputTokens.toLocaleString())], [chalk.white('Cache Read'), chalk.white(totalCacheRead.toLocaleString())]);
|
|
251
|
-
if (totalCacheCreation > 0) {
|
|
252
|
-
tokenTable.push([chalk.white('Cache Creation'), chalk.white(totalCacheCreation.toLocaleString())]);
|
|
253
|
-
}
|
|
254
|
-
if (totalThoughts > 0) {
|
|
255
|
-
tokenTable.push([chalk.white('Thoughts'), chalk.white(totalThoughts.toLocaleString())]);
|
|
256
|
-
}
|
|
257
|
-
if (totalReasoning > 0) {
|
|
258
|
-
tokenTable.push([chalk.white('Reasoning'), chalk.white(totalReasoning.toLocaleString())]);
|
|
259
|
-
}
|
|
260
|
-
if (totalToolTokens > 0) {
|
|
261
|
-
tokenTable.push([chalk.white('Tool'), chalk.white(totalToolTokens.toLocaleString())]);
|
|
262
|
-
}
|
|
263
|
-
console.log(tokenTable.toString());
|
|
264
|
-
console.log();
|
|
265
|
-
// 4. BY AGENT - Agent breakdown
|
|
266
|
-
const byAgent = {};
|
|
267
|
-
for (const session of sessions) {
|
|
268
|
-
if (!byAgent[session.agent]) {
|
|
269
|
-
const adapter = AgentRegistry.getAgent(session.agent);
|
|
270
|
-
byAgent[session.agent] = {
|
|
271
|
-
sessions: 0,
|
|
272
|
-
tokens: 0,
|
|
273
|
-
userPrompts: 0,
|
|
274
|
-
userMessages: 0,
|
|
275
|
-
apiCalls: 0,
|
|
276
|
-
displayName: adapter?.displayName || session.agent
|
|
277
|
-
};
|
|
278
|
-
}
|
|
279
|
-
byAgent[session.agent].sessions++;
|
|
280
|
-
byAgent[session.agent].tokens += session.tokens.total;
|
|
281
|
-
byAgent[session.agent].userPrompts += session.userPromptCount;
|
|
282
|
-
byAgent[session.agent].userMessages += session.userMessageCount;
|
|
283
|
-
// Count API calls from model usage
|
|
284
|
-
byAgent[session.agent].apiCalls += Object.values(session.modelUsage).reduce((sum, count) => sum + count, 0);
|
|
285
|
-
}
|
|
286
|
-
console.log(chalk.bold.white('🤖 Breakdown by Agent\n'));
|
|
287
|
-
const sortedAgents = Object.entries(byAgent)
|
|
288
|
-
.sort((a, b) => b[1].sessions - a[1].sessions);
|
|
289
|
-
// Create table for agent breakdown
|
|
290
|
-
const agentTable = new Table({
|
|
291
|
-
head: [chalk.cyan('Agent'), chalk.cyan('User Prompts'), chalk.cyan('Real Input %'), chalk.cyan('Sessions'), chalk.cyan('API Calls'), chalk.cyan('Share')],
|
|
292
|
-
style: {
|
|
293
|
-
head: [],
|
|
294
|
-
border: ['grey']
|
|
295
|
-
}
|
|
296
|
-
});
|
|
297
|
-
for (const [, stats] of sortedAgents) {
|
|
298
|
-
const sessionPercentage = ((stats.sessions / sessions.length) * 100).toFixed(1);
|
|
299
|
-
// Calculate user prompt percentage for this agent
|
|
300
|
-
const userPromptPercentage = stats.userMessages > 0
|
|
301
|
-
? ((stats.userPrompts / stats.userMessages) * 100).toFixed(1)
|
|
302
|
-
: '100.0';
|
|
303
|
-
agentTable.push([
|
|
304
|
-
chalk.white(stats.displayName),
|
|
305
|
-
chalk.white(stats.userPrompts.toString()),
|
|
306
|
-
chalk.white(`${userPromptPercentage}%`),
|
|
307
|
-
chalk.white(stats.sessions.toString()),
|
|
308
|
-
chalk.white(stats.apiCalls.toString()),
|
|
309
|
-
chalk.white(`${sessionPercentage}%`)
|
|
310
|
-
]);
|
|
311
|
-
}
|
|
312
|
-
console.log(agentTable.toString());
|
|
313
|
-
console.log();
|
|
314
|
-
// Show model usage breakdown
|
|
315
|
-
const modelBreakdown = {};
|
|
316
|
-
for (const session of sessions) {
|
|
317
|
-
for (const [modelName, count] of Object.entries(session.modelUsage)) {
|
|
318
|
-
// Normalize model names for consistent display (unless verbose mode)
|
|
319
|
-
const displayModelName = options.verbose ? modelName : normalizeModelName(modelName);
|
|
320
|
-
modelBreakdown[displayModelName] = (modelBreakdown[displayModelName] || 0) + count;
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
if (Object.keys(modelBreakdown).length > 0) {
|
|
324
|
-
const totalModelCalls = Object.values(modelBreakdown).reduce((sum, count) => sum + count, 0);
|
|
325
|
-
console.log(chalk.bold.white(options.verbose ? ' Models (Raw Format):\n' : ' Models:\n'));
|
|
326
|
-
const sortedModels = Object.entries(modelBreakdown)
|
|
327
|
-
.sort((a, b) => b[1] - a[1]);
|
|
328
|
-
// Create table for models
|
|
329
|
-
const modelTable = new Table({
|
|
330
|
-
head: [chalk.cyan('Model'), chalk.cyan('Calls'), chalk.cyan('Share')],
|
|
331
|
-
style: {
|
|
332
|
-
head: [],
|
|
333
|
-
border: ['grey']
|
|
334
|
-
},
|
|
335
|
-
colWidths: [75, 12, 12]
|
|
336
|
-
});
|
|
337
|
-
for (const [modelName, count] of sortedModels) {
|
|
338
|
-
const percentage = ((count / totalModelCalls) * 100).toFixed(1);
|
|
339
|
-
modelTable.push([
|
|
340
|
-
chalk.white(modelName),
|
|
341
|
-
chalk.white(count.toString()),
|
|
342
|
-
chalk.white(`${percentage}%`)
|
|
343
|
-
]);
|
|
344
|
-
}
|
|
345
|
-
console.log(' ' + modelTable.toString().split('\n').join('\n '));
|
|
346
|
-
console.log();
|
|
347
|
-
}
|
|
348
|
-
// 5. TOOL USAGE
|
|
349
|
-
if (totalToolCalls > 0) {
|
|
350
|
-
const toolBreakdown = {};
|
|
351
|
-
const toolStatusBreakdown = {};
|
|
352
|
-
for (const session of sessions) {
|
|
353
|
-
for (const [toolName, count] of Object.entries(session.toolUsage)) {
|
|
354
|
-
toolBreakdown[toolName] = (toolBreakdown[toolName] || 0) + count;
|
|
355
|
-
}
|
|
356
|
-
for (const [toolName, status] of Object.entries(session.toolStatus)) {
|
|
357
|
-
if (!toolStatusBreakdown[toolName]) {
|
|
358
|
-
toolStatusBreakdown[toolName] = { success: 0, failure: 0 };
|
|
359
|
-
}
|
|
360
|
-
toolStatusBreakdown[toolName].success += status.success;
|
|
361
|
-
toolStatusBreakdown[toolName].failure += status.failure;
|
|
362
|
-
}
|
|
363
|
-
}
|
|
364
|
-
if (Object.keys(toolBreakdown).length > 0) {
|
|
365
|
-
console.log(chalk.bold.white('🔧 Tool Usage\n'));
|
|
366
|
-
const sortedTools = Object.entries(toolBreakdown)
|
|
367
|
-
.sort((a, b) => b[1] - a[1]);
|
|
368
|
-
// Create table for tools
|
|
369
|
-
const toolTable = new Table({
|
|
370
|
-
head: [chalk.cyan('Tool'), chalk.cyan('Calls'), chalk.cyan('Share'), chalk.cyan('Status'), chalk.cyan('Success Rate')],
|
|
371
|
-
style: {
|
|
372
|
-
head: [],
|
|
373
|
-
border: ['grey']
|
|
374
|
-
},
|
|
375
|
-
colWidths: [20, 10, 8, 20, 15]
|
|
376
|
-
});
|
|
377
|
-
for (const [toolName, count] of sortedTools) {
|
|
378
|
-
const percentage = ((count / totalToolCalls) * 100).toFixed(1);
|
|
379
|
-
const status = toolStatusBreakdown[toolName];
|
|
380
|
-
const successRate = status ? ((status.success / count) * 100).toFixed(1) : '0.0';
|
|
381
|
-
// Build status text with color coding
|
|
382
|
-
let statusText;
|
|
383
|
-
let successRateText;
|
|
384
|
-
if (status && status.failure > 0 && status.success === 0) {
|
|
385
|
-
// Critical: 0% success rate with failures - RED
|
|
386
|
-
statusText = chalk.red(`(${status.success} ✓, ${status.failure} ✗)`);
|
|
387
|
-
successRateText = chalk.red(`${successRate}%`);
|
|
388
|
-
}
|
|
389
|
-
else if (status && status.failure > 0) {
|
|
390
|
-
// Warning: some failures but has successes - YELLOW
|
|
391
|
-
statusText = chalk.yellow(`(${status.success} ✓, ${status.failure} ✗)`);
|
|
392
|
-
successRateText = chalk.yellow(`${successRate}%`);
|
|
393
|
-
}
|
|
394
|
-
else {
|
|
395
|
-
// Success: no failures - GREEN
|
|
396
|
-
statusText = chalk.green(`(${status?.success || 0} ✓)`);
|
|
397
|
-
successRateText = chalk.green(`${successRate}%`);
|
|
398
|
-
}
|
|
399
|
-
toolTable.push([
|
|
400
|
-
chalk.white(toolName),
|
|
401
|
-
chalk.white(count.toString()),
|
|
402
|
-
chalk.white(`${percentage}%`),
|
|
403
|
-
statusText,
|
|
404
|
-
successRateText
|
|
405
|
-
]);
|
|
406
|
-
}
|
|
407
|
-
console.log(toolTable.toString());
|
|
408
|
-
console.log();
|
|
409
|
-
}
|
|
410
|
-
}
|
|
411
|
-
// 6. BREAKDOWN BY PROJECT
|
|
412
|
-
const byProject = {};
|
|
413
|
-
for (const session of sessions) {
|
|
414
|
-
const projectPath = session.projectPath || 'other';
|
|
415
|
-
if (!byProject[projectPath]) {
|
|
416
|
-
byProject[projectPath] = {
|
|
417
|
-
sessions: 0,
|
|
418
|
-
tokens: 0,
|
|
419
|
-
linesGenerated: 0,
|
|
420
|
-
filesCreated: 0,
|
|
421
|
-
filesModified: 0,
|
|
422
|
-
languageStats: {},
|
|
423
|
-
formatStats: {}
|
|
424
|
-
};
|
|
425
|
-
}
|
|
426
|
-
const project = byProject[projectPath];
|
|
427
|
-
project.sessions++;
|
|
428
|
-
project.tokens += session.tokens.total;
|
|
429
|
-
project.linesGenerated += session.fileStats?.totalLinesAdded || 0;
|
|
430
|
-
project.filesCreated += session.fileStats?.filesCreated || 0;
|
|
431
|
-
project.filesModified += session.fileStats?.filesModified || 0;
|
|
432
|
-
// Aggregate language stats for this project
|
|
433
|
-
// We track unique sessions per language using Set
|
|
434
|
-
if (session.fileStats?.byLanguage) {
|
|
435
|
-
for (const [lang, stats] of Object.entries(session.fileStats.byLanguage)) {
|
|
436
|
-
if (!project.languageStats[lang]) {
|
|
437
|
-
project.languageStats[lang] = {
|
|
438
|
-
sessionIds: new Set(),
|
|
439
|
-
tokens: 0,
|
|
440
|
-
lines: 0,
|
|
441
|
-
filesCreated: 0,
|
|
442
|
-
filesModified: 0
|
|
443
|
-
};
|
|
444
|
-
}
|
|
445
|
-
// Track unique session ID
|
|
446
|
-
project.languageStats[lang].sessionIds.add(session.sessionId);
|
|
447
|
-
// Attribute tokens proportionally based on lines generated
|
|
448
|
-
const totalLinesInSession = session.fileStats.totalLinesAdded || 1;
|
|
449
|
-
const tokenShare = (stats.linesAdded / totalLinesInSession) * session.tokens.total;
|
|
450
|
-
project.languageStats[lang].tokens += tokenShare;
|
|
451
|
-
project.languageStats[lang].lines += stats.linesAdded;
|
|
452
|
-
project.languageStats[lang].filesCreated += stats.filesCreated;
|
|
453
|
-
project.languageStats[lang].filesModified += stats.filesModified;
|
|
454
|
-
}
|
|
455
|
-
}
|
|
456
|
-
// Aggregate format stats for this project
|
|
457
|
-
if (session.fileStats?.byFormat) {
|
|
458
|
-
for (const [format, stats] of Object.entries(session.fileStats.byFormat)) {
|
|
459
|
-
if (!project.formatStats[format]) {
|
|
460
|
-
project.formatStats[format] = {
|
|
461
|
-
sessionIds: new Set(),
|
|
462
|
-
tokens: 0,
|
|
463
|
-
lines: 0,
|
|
464
|
-
filesCreated: 0,
|
|
465
|
-
filesModified: 0
|
|
466
|
-
};
|
|
467
|
-
}
|
|
468
|
-
// Track unique session ID
|
|
469
|
-
project.formatStats[format].sessionIds.add(session.sessionId);
|
|
470
|
-
// Attribute tokens proportionally based on lines generated
|
|
471
|
-
const totalLinesInSession = session.fileStats.totalLinesAdded || 1;
|
|
472
|
-
const tokenShare = (stats.linesAdded / totalLinesInSession) * session.tokens.total;
|
|
473
|
-
project.formatStats[format].tokens += tokenShare;
|
|
474
|
-
project.formatStats[format].lines += stats.linesAdded;
|
|
475
|
-
project.formatStats[format].filesCreated += stats.filesCreated;
|
|
476
|
-
project.formatStats[format].filesModified += stats.filesModified;
|
|
477
|
-
}
|
|
478
|
-
}
|
|
479
|
-
}
|
|
480
|
-
if (Object.keys(byProject).length > 0) {
|
|
481
|
-
console.log(chalk.bold.white('📁 Breakdown by Project\n'));
|
|
482
|
-
const sortedProjects = Object.entries(byProject)
|
|
483
|
-
.sort((a, b) => b[1].linesGenerated - a[1].linesGenerated);
|
|
484
|
-
for (const [projectPath, stats] of sortedProjects) {
|
|
485
|
-
const totalLinesInProjects = Object.values(byProject).reduce((sum, p) => sum + p.linesGenerated, 0);
|
|
486
|
-
const percentage = totalLinesInProjects > 0 ? ((stats.linesGenerated / totalLinesInProjects) * 100).toFixed(1) : '0.0';
|
|
487
|
-
console.log(chalk.cyan(`\n ${projectPath}\n`));
|
|
488
|
-
// Project summary table
|
|
489
|
-
const projectSummaryTable = new Table({
|
|
490
|
-
head: [chalk.cyan('Sessions'), chalk.cyan('Tokens'), chalk.cyan('Lines'), chalk.cyan('Created'), chalk.cyan('Modified'), chalk.cyan('Share')],
|
|
491
|
-
style: {
|
|
492
|
-
head: [],
|
|
493
|
-
border: ['grey']
|
|
494
|
-
},
|
|
495
|
-
colWidths: [12, 16, 10, 11, 12, 10]
|
|
496
|
-
});
|
|
497
|
-
projectSummaryTable.push([
|
|
498
|
-
chalk.white(stats.sessions.toString()),
|
|
499
|
-
chalk.white(stats.tokens.toLocaleString()),
|
|
500
|
-
chalk.white(stats.linesGenerated.toLocaleString()),
|
|
501
|
-
chalk.white(stats.filesCreated.toString()),
|
|
502
|
-
chalk.white(stats.filesModified.toString()),
|
|
503
|
-
chalk.white(`${percentage}%`)
|
|
504
|
-
]);
|
|
505
|
-
console.log(' ' + projectSummaryTable.toString().split('\n').join('\n '));
|
|
506
|
-
// Show language breakdown for this project
|
|
507
|
-
if (Object.keys(stats.languageStats).length > 0) {
|
|
508
|
-
console.log(chalk.white('\n By Language:\n'));
|
|
509
|
-
const sortedLangs = Object.entries(stats.languageStats)
|
|
510
|
-
.sort((a, b) => b[1].lines - a[1].lines)
|
|
511
|
-
.slice(0, 10);
|
|
512
|
-
const langTable = new Table({
|
|
513
|
-
head: [chalk.cyan('Language'), chalk.cyan('Sessions'), chalk.cyan('Tokens'), chalk.cyan('Lines'), chalk.cyan('Created'), chalk.cyan('Modified'), chalk.cyan('Share')],
|
|
514
|
-
style: {
|
|
515
|
-
head: [],
|
|
516
|
-
border: ['grey']
|
|
517
|
-
},
|
|
518
|
-
colWidths: [18, 12, 16, 10, 11, 12, 9]
|
|
519
|
-
});
|
|
520
|
-
for (const [lang, langStats] of sortedLangs) {
|
|
521
|
-
const langPercentage = stats.linesGenerated > 0 ? ((langStats.lines / stats.linesGenerated) * 100).toFixed(1) : '0.0';
|
|
522
|
-
const sessionCount = langStats.sessionIds.size;
|
|
523
|
-
langTable.push([
|
|
524
|
-
chalk.white(lang),
|
|
525
|
-
chalk.white(sessionCount.toString()),
|
|
526
|
-
chalk.white(Math.round(langStats.tokens).toLocaleString()),
|
|
527
|
-
chalk.white(langStats.lines.toLocaleString()),
|
|
528
|
-
chalk.white(langStats.filesCreated.toString()),
|
|
529
|
-
chalk.white(langStats.filesModified.toString()),
|
|
530
|
-
chalk.white(`${langPercentage}%`)
|
|
531
|
-
]);
|
|
532
|
-
}
|
|
533
|
-
console.log(' ' + langTable.toString().split('\n').join('\n '));
|
|
534
|
-
}
|
|
535
|
-
// Show format breakdown for this project
|
|
536
|
-
if (Object.keys(stats.formatStats).length > 0) {
|
|
537
|
-
console.log(chalk.white('\n By Format:\n'));
|
|
538
|
-
const sortedFormats = Object.entries(stats.formatStats)
|
|
539
|
-
.sort((a, b) => b[1].lines - a[1].lines)
|
|
540
|
-
.slice(0, 10);
|
|
541
|
-
const formatTable = new Table({
|
|
542
|
-
head: [chalk.cyan('Format'), chalk.cyan('Sessions'), chalk.cyan('Tokens'), chalk.cyan('Lines'), chalk.cyan('Created'), chalk.cyan('Modified'), chalk.cyan('Share')],
|
|
543
|
-
style: {
|
|
544
|
-
head: [],
|
|
545
|
-
border: ['grey']
|
|
546
|
-
},
|
|
547
|
-
colWidths: [18, 12, 16, 10, 11, 12, 9]
|
|
548
|
-
});
|
|
549
|
-
for (const [format, formatStats] of sortedFormats) {
|
|
550
|
-
const formatPercentage = stats.linesGenerated > 0 ? ((formatStats.lines / stats.linesGenerated) * 100).toFixed(1) : '0.0';
|
|
551
|
-
const sessionCount = formatStats.sessionIds.size;
|
|
552
|
-
formatTable.push([
|
|
553
|
-
chalk.white(format),
|
|
554
|
-
chalk.white(sessionCount.toString()),
|
|
555
|
-
chalk.white(Math.round(formatStats.tokens).toLocaleString()),
|
|
556
|
-
chalk.white(formatStats.lines.toLocaleString()),
|
|
557
|
-
chalk.white(formatStats.filesCreated.toString()),
|
|
558
|
-
chalk.white(formatStats.filesModified.toString()),
|
|
559
|
-
chalk.white(`${formatPercentage}%`)
|
|
560
|
-
]);
|
|
561
|
-
}
|
|
562
|
-
console.log(' ' + formatTable.toString().split('\n').join('\n '));
|
|
563
|
-
}
|
|
564
|
-
console.log();
|
|
565
|
-
}
|
|
566
|
-
}
|
|
567
|
-
// VERBOSE MODE - Additional detailed statistics
|
|
568
|
-
if (options.verbose) {
|
|
569
|
-
// Provider breakdown
|
|
570
|
-
const byProvider = {};
|
|
571
|
-
for (const session of sessions) {
|
|
572
|
-
if (!byProvider[session.provider]) {
|
|
573
|
-
byProvider[session.provider] = { sessions: 0, tokens: 0, models: new Set() };
|
|
574
|
-
}
|
|
575
|
-
byProvider[session.provider].sessions++;
|
|
576
|
-
byProvider[session.provider].tokens += session.tokens.total;
|
|
577
|
-
byProvider[session.provider].models.add(session.model);
|
|
578
|
-
}
|
|
579
|
-
if (Object.keys(byProvider).length > 0) {
|
|
580
|
-
console.log(chalk.bold.white('🔌 Breakdown by Provider\n'));
|
|
581
|
-
const sortedProviders = Object.entries(byProvider)
|
|
582
|
-
.sort((a, b) => b[1].sessions - a[1].sessions);
|
|
583
|
-
const providerTable = new Table({
|
|
584
|
-
head: [chalk.cyan('Provider'), chalk.cyan('Sessions'), chalk.cyan('Tokens'), chalk.cyan('Unique Models'), chalk.cyan('Share')],
|
|
585
|
-
style: {
|
|
586
|
-
head: [],
|
|
587
|
-
border: ['grey']
|
|
588
|
-
}
|
|
589
|
-
});
|
|
590
|
-
for (const [provider, stats] of sortedProviders) {
|
|
591
|
-
const percentage = ((stats.sessions / sessions.length) * 100).toFixed(1);
|
|
592
|
-
providerTable.push([
|
|
593
|
-
chalk.white(provider),
|
|
594
|
-
chalk.white(stats.sessions.toString()),
|
|
595
|
-
chalk.white(stats.tokens.toLocaleString()),
|
|
596
|
-
chalk.white(stats.models.size.toString()),
|
|
597
|
-
chalk.white(`${percentage}%`)
|
|
598
|
-
]);
|
|
599
|
-
}
|
|
600
|
-
console.log(providerTable.toString());
|
|
601
|
-
console.log();
|
|
602
|
-
}
|
|
603
|
-
// Session duration statistics
|
|
604
|
-
const sessionsWithDuration = sessions.filter(s => s.durationMs && s.durationMs > 0);
|
|
605
|
-
if (sessionsWithDuration.length > 0) {
|
|
606
|
-
const durations = sessionsWithDuration.map(s => s.durationMs);
|
|
607
|
-
const avgDuration = durations.reduce((sum, d) => sum + d, 0) / durations.length;
|
|
608
|
-
const maxDuration = Math.max(...durations);
|
|
609
|
-
const minDuration = Math.min(...durations);
|
|
610
|
-
console.log(chalk.bold.white('⏱️ Session Duration\n'));
|
|
611
|
-
const durationTable = new Table({
|
|
612
|
-
head: [chalk.cyan('Metric'), chalk.cyan('Value')],
|
|
613
|
-
style: {
|
|
614
|
-
head: [],
|
|
615
|
-
border: ['grey']
|
|
616
|
-
},
|
|
617
|
-
colWidths: [25, 60]
|
|
618
|
-
});
|
|
619
|
-
const formatDuration = (ms) => {
|
|
620
|
-
const seconds = Math.floor(ms / 1000);
|
|
621
|
-
const minutes = Math.floor(seconds / 60);
|
|
622
|
-
const hours = Math.floor(minutes / 60);
|
|
623
|
-
if (hours > 0)
|
|
624
|
-
return `${hours}h ${minutes % 60}m`;
|
|
625
|
-
if (minutes > 0)
|
|
626
|
-
return `${minutes}m ${seconds % 60}s`;
|
|
627
|
-
return `${seconds}s`;
|
|
628
|
-
};
|
|
629
|
-
durationTable.push([chalk.white('Sessions with duration'), chalk.white(sessionsWithDuration.length.toString())], [chalk.white('Average duration'), chalk.white(formatDuration(avgDuration))], [chalk.white('Longest session'), chalk.white(formatDuration(maxDuration))], [chalk.white('Shortest session'), chalk.white(formatDuration(minDuration))]);
|
|
630
|
-
console.log(durationTable.toString());
|
|
631
|
-
console.log();
|
|
632
|
-
}
|
|
633
|
-
// Tool breakdown by file modifications (byTool stats)
|
|
634
|
-
const toolFileModStats = {};
|
|
635
|
-
for (const session of sessions) {
|
|
636
|
-
if (session.fileStats?.byTool) {
|
|
637
|
-
for (const [toolName, stats] of Object.entries(session.fileStats.byTool)) {
|
|
638
|
-
if (!toolFileModStats[toolName]) {
|
|
639
|
-
toolFileModStats[toolName] = { count: 0, linesAdded: 0, linesRemoved: 0 };
|
|
640
|
-
}
|
|
641
|
-
toolFileModStats[toolName].count += stats.count;
|
|
642
|
-
toolFileModStats[toolName].linesAdded += stats.linesAdded;
|
|
643
|
-
toolFileModStats[toolName].linesRemoved += stats.linesRemoved;
|
|
644
|
-
}
|
|
645
|
-
}
|
|
646
|
-
}
|
|
647
|
-
if (Object.keys(toolFileModStats).length > 0) {
|
|
648
|
-
console.log(chalk.bold.white('🔧 File Modification Tools\n'));
|
|
649
|
-
const sortedTools = Object.entries(toolFileModStats)
|
|
650
|
-
.sort((a, b) => b[1].linesAdded - a[1].linesAdded);
|
|
651
|
-
const toolFileTable = new Table({
|
|
652
|
-
head: [chalk.cyan('Tool'), chalk.cyan('Uses'), chalk.cyan('Lines Added'), chalk.cyan('Lines Removed'), chalk.cyan('Net')],
|
|
653
|
-
style: {
|
|
654
|
-
head: [],
|
|
655
|
-
border: ['grey']
|
|
656
|
-
}
|
|
657
|
-
});
|
|
658
|
-
for (const [toolName, stats] of sortedTools) {
|
|
659
|
-
const net = stats.linesAdded - stats.linesRemoved;
|
|
660
|
-
toolFileTable.push([
|
|
661
|
-
chalk.white(toolName),
|
|
662
|
-
chalk.white(stats.count.toString()),
|
|
663
|
-
chalk.white(stats.linesAdded.toLocaleString()),
|
|
664
|
-
chalk.white(stats.linesRemoved.toLocaleString()),
|
|
665
|
-
chalk.white(net.toLocaleString())
|
|
666
|
-
]);
|
|
667
|
-
}
|
|
668
|
-
console.log(toolFileTable.toString());
|
|
669
|
-
console.log();
|
|
670
|
-
}
|
|
671
|
-
// Git branch statistics
|
|
672
|
-
const byBranch = {};
|
|
673
|
-
for (const session of sessions) {
|
|
674
|
-
if (session.gitBranch) {
|
|
675
|
-
byBranch[session.gitBranch] = (byBranch[session.gitBranch] || 0) + 1;
|
|
676
|
-
}
|
|
677
|
-
}
|
|
678
|
-
if (Object.keys(byBranch).length > 0) {
|
|
679
|
-
console.log(chalk.bold.white('🌿 Git Branches\n'));
|
|
680
|
-
const sortedBranches = Object.entries(byBranch)
|
|
681
|
-
.sort((a, b) => b[1] - a[1]);
|
|
682
|
-
const branchTable = new Table({
|
|
683
|
-
head: [chalk.cyan('Branch'), chalk.cyan('Sessions'), chalk.cyan('Share')],
|
|
684
|
-
style: {
|
|
685
|
-
head: [],
|
|
686
|
-
border: ['grey']
|
|
687
|
-
}
|
|
688
|
-
});
|
|
689
|
-
for (const [branch, count] of sortedBranches) {
|
|
690
|
-
const percentage = ((count / sessions.length) * 100).toFixed(1);
|
|
691
|
-
branchTable.push([
|
|
692
|
-
chalk.white(branch),
|
|
693
|
-
chalk.white(count.toString()),
|
|
694
|
-
chalk.white(`${percentage}%`)
|
|
695
|
-
]);
|
|
696
|
-
}
|
|
697
|
-
console.log(branchTable.toString());
|
|
698
|
-
console.log();
|
|
699
|
-
}
|
|
700
|
-
// Error analysis
|
|
701
|
-
const sessionsWithErrors = sessions.filter(s => s.hadErrors);
|
|
702
|
-
if (sessionsWithErrors.length > 0) {
|
|
703
|
-
console.log(chalk.bold.white('⚠️ Error Analysis\n'));
|
|
704
|
-
const errorTable = new Table({
|
|
705
|
-
head: [chalk.cyan('Metric'), chalk.cyan('Value')],
|
|
706
|
-
style: {
|
|
707
|
-
head: [],
|
|
708
|
-
border: ['grey']
|
|
709
|
-
},
|
|
710
|
-
colWidths: [25, 60]
|
|
711
|
-
});
|
|
712
|
-
const errorRate = ((sessionsWithErrors.length / sessions.length) * 100).toFixed(1);
|
|
713
|
-
const totalFailedTools = sessions.reduce((sum, s) => sum + s.failedToolCalls, 0);
|
|
714
|
-
errorTable.push([chalk.white('Sessions with errors'), chalk.white(`${sessionsWithErrors.length} (${errorRate}%)`)], [chalk.white('Total failed tool calls'), chalk.white(totalFailedTools.toString())]);
|
|
715
|
-
console.log(errorTable.toString());
|
|
716
|
-
console.log();
|
|
717
|
-
}
|
|
718
|
-
}
|
|
719
|
-
}
|
|
720
|
-
}
|
|
721
|
-
catch (error) {
|
|
722
|
-
logger.error('Failed to aggregate analytics:', error);
|
|
723
|
-
process.exit(1);
|
|
724
|
-
}
|
|
725
|
-
});
|
|
726
|
-
return command;
|
|
727
|
-
}
|
|
728
|
-
// Helper functions
|
|
729
|
-
async function updateAnalyticsEnabled(enabled) {
|
|
730
|
-
// Load current multi-provider config
|
|
731
|
-
const config = await ConfigLoader.loadMultiProviderConfig();
|
|
732
|
-
// Update or create analytics config
|
|
733
|
-
if (!config.analytics) {
|
|
734
|
-
config.analytics = {
|
|
735
|
-
enabled,
|
|
736
|
-
target: 'local',
|
|
737
|
-
localPath: '~/.codemie/analytics',
|
|
738
|
-
flushInterval: 5000,
|
|
739
|
-
maxBufferSize: 100
|
|
740
|
-
};
|
|
741
|
-
}
|
|
742
|
-
else {
|
|
743
|
-
config.analytics.enabled = enabled;
|
|
744
|
-
}
|
|
745
|
-
// Save updated config
|
|
746
|
-
await ConfigLoader.saveMultiProviderConfig(config);
|
|
747
|
-
}
|
|
748
|
-
//# sourceMappingURL=analytics.js.map
|