|
| 1 | +import { autoSelectBranchNameFeature, stagingBehaviorFeature } from '$lib/config/uiFeatureFlags'; |
1 | 2 | import { getFilterCountMap, getStackTargetTypeCountMap, type WorkspaceRule } from '$lib/rules/rule';
|
2 | 3 | import { StackService } from '$lib/stacks/stackService.svelte';
|
3 | 4 | import { UiState } from '$lib/state/uiState.svelte';
|
4 | 5 | import { WorktreeService } from '$lib/worktree/worktreeService.svelte';
|
5 | 6 | import { InjectionToken } from '@gitbutler/shared/context';
|
| 7 | +import { get } from 'svelte/store'; |
6 | 8 | import type { Commit } from '$lib/branches/v3';
|
7 | 9 | import type { HunkAssignment } from '$lib/hunks/hunk';
|
8 | 10 | import type RulesService from '$lib/rules/rulesService.svelte';
|
@@ -85,7 +87,9 @@ export class CommitAnalytics {
|
85 | 87 | // Total number of files that have not been assigned
|
86 | 88 | totalUnassignedFiles: this.getUnassignedFiles(assignments).length,
|
87 | 89 | // Rule metrics
|
88 |
| - ...this.getRuleMetrics(rules) |
| 90 | + ...this.getRuleMetrics(rules), |
| 91 | + // Behavior metrics |
| 92 | + ...this.getBehaviorMetrics() |
89 | 93 | };
|
90 | 94 | } catch (error) {
|
91 | 95 | console.error('Failed to fetch commit analytics:', error);
|
@@ -173,6 +177,18 @@ export class CommitAnalytics {
|
173 | 177 |
|
174 | 178 | return namespaceProps(ruleMetrics, 'workspaceRules');
|
175 | 179 | }
|
| 180 | + |
| 181 | + private getBehaviorMetrics(): EventProperties { |
| 182 | + // Placeholder for future behavior metrics |
| 183 | + const stagingBehavior = get(stagingBehaviorFeature); |
| 184 | + const autoSelectBranchName = get(autoSelectBranchNameFeature); |
| 185 | + const behaviorMetrics = { |
| 186 | + stagingBehavior, |
| 187 | + autoSelectBranchName |
| 188 | + }; |
| 189 | + |
| 190 | + return namespaceProps(behaviorMetrics, 'behavior'); |
| 191 | + } |
176 | 192 | }
|
177 | 193 |
|
178 | 194 | function namespaceProps(props: EventProperties, namespace: string): EventProperties {
|
|
0 commit comments