@ginkoai/cli 2.1.0 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/graph/api-client.d.ts +12 -1
- package/dist/commands/graph/api-client.d.ts.map +1 -1
- package/dist/commands/graph/api-client.js +16 -2
- package/dist/commands/graph/api-client.js.map +1 -1
- package/dist/commands/handoff.d.ts +3 -3
- package/dist/commands/handoff.d.ts.map +1 -1
- package/dist/commands/handoff.js +32 -3
- package/dist/commands/handoff.js.map +1 -1
- package/dist/commands/nudging/index.d.ts +24 -0
- package/dist/commands/nudging/index.d.ts.map +1 -0
- package/dist/commands/nudging/index.js +175 -0
- package/dist/commands/nudging/index.js.map +1 -0
- package/dist/commands/sprint/create.d.ts +26 -0
- package/dist/commands/sprint/create.d.ts.map +1 -0
- package/dist/commands/sprint/create.js +269 -0
- package/dist/commands/sprint/create.js.map +1 -0
- package/dist/commands/sprint/index.d.ts.map +1 -1
- package/dist/commands/sprint/index.js +24 -0
- package/dist/commands/sprint/index.js.map +1 -1
- package/dist/commands/sprint/quick-fix.d.ts +25 -0
- package/dist/commands/sprint/quick-fix.d.ts.map +1 -0
- package/dist/commands/sprint/quick-fix.js +151 -0
- package/dist/commands/sprint/quick-fix.js.map +1 -0
- package/dist/commands/sprint/sprint-pipeline-enhanced.d.ts.map +1 -1
- package/dist/commands/sprint/sprint-pipeline-enhanced.js +37 -0
- package/dist/commands/sprint/sprint-pipeline-enhanced.js.map +1 -1
- package/dist/commands/sprint/status.d.ts.map +1 -1
- package/dist/commands/sprint/status.js +21 -1
- package/dist/commands/sprint/status.js.map +1 -1
- package/dist/commands/start/start-reflection.d.ts +14 -0
- package/dist/commands/start/start-reflection.d.ts.map +1 -1
- package/dist/commands/start/start-reflection.js +180 -9
- package/dist/commands/start/start-reflection.js.map +1 -1
- package/dist/commands/task/status.d.ts +3 -0
- package/dist/commands/task/status.d.ts.map +1 -1
- package/dist/commands/task/status.js +48 -1
- package/dist/commands/task/status.js.map +1 -1
- package/dist/commands/team/index.d.ts +5 -0
- package/dist/commands/team/index.d.ts.map +1 -1
- package/dist/commands/team/index.js +28 -0
- package/dist/commands/team/index.js.map +1 -1
- package/dist/commands/team/status.d.ts +16 -0
- package/dist/commands/team/status.d.ts.map +1 -0
- package/dist/commands/team/status.js +180 -0
- package/dist/commands/team/status.js.map +1 -0
- package/dist/index.js +10 -3
- package/dist/index.js.map +1 -1
- package/dist/lib/adoption-score.d.ts +69 -0
- package/dist/lib/adoption-score.d.ts.map +1 -0
- package/dist/lib/adoption-score.js +206 -0
- package/dist/lib/adoption-score.js.map +1 -0
- package/dist/lib/coaching-level.d.ts +127 -0
- package/dist/lib/coaching-level.d.ts.map +1 -0
- package/dist/lib/coaching-level.js +406 -0
- package/dist/lib/coaching-level.js.map +1 -0
- package/dist/lib/event-logger.d.ts +42 -0
- package/dist/lib/event-logger.d.ts.map +1 -1
- package/dist/lib/event-logger.js +77 -0
- package/dist/lib/event-logger.js.map +1 -1
- package/dist/lib/planning-menu.d.ts +69 -0
- package/dist/lib/planning-menu.d.ts.map +1 -0
- package/dist/lib/planning-menu.js +342 -0
- package/dist/lib/planning-menu.js.map +1 -0
- package/dist/lib/targeted-coaching.d.ts +71 -0
- package/dist/lib/targeted-coaching.d.ts.map +1 -0
- package/dist/lib/targeted-coaching.js +318 -0
- package/dist/lib/targeted-coaching.js.map +1 -0
- package/dist/lib/task-parser.d.ts +2 -0
- package/dist/lib/task-parser.d.ts.map +1 -1
- package/dist/lib/task-parser.js +23 -0
- package/dist/lib/task-parser.js.map +1 -1
- package/dist/lib/user-sprint.d.ts +53 -0
- package/dist/lib/user-sprint.d.ts.map +1 -1
- package/dist/lib/user-sprint.js +137 -2
- package/dist/lib/user-sprint.js.map +1 -1
- package/dist/lib/work-reconciliation.d.ts +59 -0
- package/dist/lib/work-reconciliation.d.ts.map +1 -0
- package/dist/lib/work-reconciliation.js +267 -0
- package/dist/lib/work-reconciliation.js.map +1 -0
- package/dist/utils/version-check.d.ts +26 -0
- package/dist/utils/version-check.d.ts.map +1 -0
- package/dist/utils/version-check.js +186 -0
- package/dist/utils/version-check.js.map +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileType: utility
|
|
3
|
+
* @status: current
|
|
4
|
+
* @updated: 2026-01-26
|
|
5
|
+
* @tags: [coaching, insights, adaptive, epic-016-s05]
|
|
6
|
+
* @related: [adoption-score.ts, planning-menu.ts, api-client.ts]
|
|
7
|
+
* @priority: high
|
|
8
|
+
* @complexity: medium
|
|
9
|
+
* @dependencies: [fs-extra, path]
|
|
10
|
+
*/
|
|
11
|
+
import { QuietingLevel } from './adoption-score.js';
|
|
12
|
+
export type CoachingLevel = 'minimal' | 'standard' | 'supportive';
|
|
13
|
+
export interface CoachingContext {
|
|
14
|
+
overallScore: number;
|
|
15
|
+
metrics: {
|
|
16
|
+
sessionEfficiency: number;
|
|
17
|
+
patternAdoption: number;
|
|
18
|
+
collaborationQuality: number;
|
|
19
|
+
antiPatterns: number;
|
|
20
|
+
};
|
|
21
|
+
level: CoachingLevel;
|
|
22
|
+
override: CoachingLevel | null;
|
|
23
|
+
source: 'dashboard' | 'cache' | 'adoption_fallback';
|
|
24
|
+
cacheAge?: number;
|
|
25
|
+
}
|
|
26
|
+
export interface InsightScores {
|
|
27
|
+
overallScore: number;
|
|
28
|
+
categoryScores: {
|
|
29
|
+
efficiency: number;
|
|
30
|
+
patterns: number;
|
|
31
|
+
quality: number;
|
|
32
|
+
'anti-patterns': number;
|
|
33
|
+
};
|
|
34
|
+
fetchedAt: string;
|
|
35
|
+
periodDays: number;
|
|
36
|
+
}
|
|
37
|
+
export interface CoachingConfig {
|
|
38
|
+
override: CoachingLevel | null;
|
|
39
|
+
overrideSetAt: string | null;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Get cache age in minutes
|
|
43
|
+
*/
|
|
44
|
+
declare function getCacheAgeMinutes(fetchedAt: string): number;
|
|
45
|
+
/**
|
|
46
|
+
* Load coaching config (manual overrides)
|
|
47
|
+
*/
|
|
48
|
+
export declare function loadCoachingConfig(): Promise<CoachingConfig>;
|
|
49
|
+
/**
|
|
50
|
+
* Save coaching config
|
|
51
|
+
*/
|
|
52
|
+
export declare function saveCoachingConfig(config: CoachingConfig): Promise<void>;
|
|
53
|
+
/**
|
|
54
|
+
* Set manual coaching level override
|
|
55
|
+
*/
|
|
56
|
+
export declare function setCoachingOverride(level: CoachingLevel | 'auto'): Promise<void>;
|
|
57
|
+
/**
|
|
58
|
+
* Calculate coaching level from overall score
|
|
59
|
+
*/
|
|
60
|
+
export declare function calculateCoachingLevel(score: number): CoachingLevel;
|
|
61
|
+
/**
|
|
62
|
+
* Convert adoption QuietingLevel to CoachingLevel
|
|
63
|
+
*/
|
|
64
|
+
declare function adoptionLevelToCoachingLevel(quieting: QuietingLevel): CoachingLevel;
|
|
65
|
+
/**
|
|
66
|
+
* Estimate score from adoption level for fallback
|
|
67
|
+
*/
|
|
68
|
+
declare function adoptionLevelToScore(quieting: QuietingLevel): number;
|
|
69
|
+
/**
|
|
70
|
+
* Get coaching context for current session
|
|
71
|
+
*
|
|
72
|
+
* Priority:
|
|
73
|
+
* 1. Manual override (if set)
|
|
74
|
+
* 2. Dashboard insight scores (if available)
|
|
75
|
+
* 3. Cached scores (if within TTL)
|
|
76
|
+
* 4. Adoption score fallback (if offline)
|
|
77
|
+
*/
|
|
78
|
+
export declare function getCoachingContext(graphId?: string): Promise<CoachingContext>;
|
|
79
|
+
/**
|
|
80
|
+
* Get coaching level for quick checks
|
|
81
|
+
* Simplified version that just returns the level
|
|
82
|
+
*/
|
|
83
|
+
export declare function getCoachingLevel(graphId?: string): Promise<CoachingLevel>;
|
|
84
|
+
/**
|
|
85
|
+
* Check if a specific metric is low and needs targeted coaching
|
|
86
|
+
*/
|
|
87
|
+
export declare function isMetricLow(value: number, threshold?: number): boolean;
|
|
88
|
+
/**
|
|
89
|
+
* Get targeted coaching suggestions based on low metrics
|
|
90
|
+
*/
|
|
91
|
+
export declare function getTargetedCoachingSuggestions(context: CoachingContext): string[];
|
|
92
|
+
export interface PromptVariants {
|
|
93
|
+
minimal: string;
|
|
94
|
+
standard: string;
|
|
95
|
+
supportive: string;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Get the appropriate prompt variant based on coaching level
|
|
99
|
+
*/
|
|
100
|
+
export declare function selectPrompt<T extends string>(variants: Record<CoachingLevel, T>, level: CoachingLevel): T;
|
|
101
|
+
/**
|
|
102
|
+
* Standard prompt variants for common scenarios
|
|
103
|
+
*/
|
|
104
|
+
export declare const PROMPT_VARIANTS: {
|
|
105
|
+
readonly noStructure: {
|
|
106
|
+
readonly minimal: "No active sprint. [a] Epic [b] Sprint [c] Quick [d] Ad-hoc";
|
|
107
|
+
readonly standard: "You have no planned work. What would you like to work on?\n\n[a] New Epic - Large initiative with multiple sprints\n[b] New Feature Sprint - Focused work with clear goals\n[c] Quick fix / Bug fix - Single task, minimal overhead\n[d] Something else - Explore, research, or work ad-hoc";
|
|
108
|
+
readonly supportive: "I notice you're not currently in a sprint. Sprints help track progress and maintain focus.\n\nWhat would you like to work on?\n\n[a] New Epic (Recommended)\n For large initiatives that need multiple sprints to complete.\n Example: \"Implement user authentication system\"\n\n[b] New Feature Sprint\n For focused work with a clear goal that can be done in ~1 week.\n Example: \"Add dark mode toggle\"\n\n[c] Quick fix / Bug fix\n For small, single tasks that don't need sprint overhead.\n Example: \"Fix login button alignment\"\n\n[d] Something else\n For exploration, research, or ad-hoc work.\n\nTip: Structured work (options a-c) improves your collaboration insights!";
|
|
109
|
+
};
|
|
110
|
+
readonly sprintComplete: {
|
|
111
|
+
readonly minimal: "Sprint done! [a] Next sprint [b] New epic [c] Ad-hoc";
|
|
112
|
+
readonly standard: "🎉 Sprint complete! All tasks finished.\n\nWhat's next?\n[a] Start next sprint\n[b] Create new epic\n[c] Work on something else";
|
|
113
|
+
readonly supportive: "🎉 Great work! You've completed all tasks in this sprint.\n\nWhat would you like to do next?\n\n[a] Start next sprint\n Continue momentum with the next planned sprint.\n\n[b] Create new epic\n Begin a new large initiative.\n\n[c] Work on something else\n Take a break or explore other work.\n\nTip: Completing sprints contributes to your pattern adoption score!";
|
|
114
|
+
};
|
|
115
|
+
};
|
|
116
|
+
export declare const __testing: {
|
|
117
|
+
LEVEL_THRESHOLDS: {
|
|
118
|
+
minimal: number;
|
|
119
|
+
standard: number;
|
|
120
|
+
};
|
|
121
|
+
CACHE_TTL_HOURS: number;
|
|
122
|
+
adoptionLevelToCoachingLevel: typeof adoptionLevelToCoachingLevel;
|
|
123
|
+
adoptionLevelToScore: typeof adoptionLevelToScore;
|
|
124
|
+
getCacheAgeMinutes: typeof getCacheAgeMinutes;
|
|
125
|
+
};
|
|
126
|
+
export {};
|
|
127
|
+
//# sourceMappingURL=coaching-level.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coaching-level.d.ts","sourceRoot":"","sources":["../../src/lib/coaching-level.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAuBH,OAAO,EAAoB,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAMtE,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,UAAU,GAAG,YAAY,CAAC;AAElE,MAAM,WAAW,eAAe;IAC9B,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE;QACP,iBAAiB,EAAE,MAAM,CAAC;QAC1B,eAAe,EAAE,MAAM,CAAC;QACxB,oBAAoB,EAAE,MAAM,CAAC;QAC7B,YAAY,EAAE,MAAM,CAAC;KACtB,CAAC;IACF,KAAK,EAAE,aAAa,CAAC;IACrB,QAAQ,EAAE,aAAa,GAAG,IAAI,CAAC;IAC/B,MAAM,EAAE,WAAW,GAAG,OAAO,GAAG,mBAAmB,CAAC;IACpD,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,aAAa;IAC5B,YAAY,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,OAAO,CAE1E;AAED;;GAEG;AACH,wBAAgB,8BAA8B,CAAC,OAAO,EAAE,eAAe,GAAG,MAAM,EAAE,CAqBjF;AAMD,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,CAAC,SAAS,MAAM,EAC3C,QAAQ,EAAE,MAAM,CAAC,aAAa,EAAE,CAAC,CAAC,EAClC,KAAK,EAAE,aAAa,GACnB,CAAC,CAEH;AAED;;GAEG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;CAsDlB,CAAC;AAMX,eAAO,MAAM,SAAS;;;;;;;;;CAMrB,CAAC"}
|
|
@@ -0,0 +1,406 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileType: utility
|
|
3
|
+
* @status: current
|
|
4
|
+
* @updated: 2026-01-26
|
|
5
|
+
* @tags: [coaching, insights, adaptive, epic-016-s05]
|
|
6
|
+
* @related: [adoption-score.ts, planning-menu.ts, api-client.ts]
|
|
7
|
+
* @priority: high
|
|
8
|
+
* @complexity: medium
|
|
9
|
+
* @dependencies: [fs-extra, path]
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Adaptive Coaching Level (EPIC-016 Sprint 5 Task 1)
|
|
13
|
+
*
|
|
14
|
+
* Coaching adapts to user's insight scores—more help when struggling, quieter when thriving.
|
|
15
|
+
*
|
|
16
|
+
* Score Thresholds (based on 7-day overall score):
|
|
17
|
+
* | Overall Score | Coaching Level | Behavior |
|
|
18
|
+
* |---------------|----------------|-----------------------------------|
|
|
19
|
+
* | ≥75 | Minimal | Brief prompts, assume competence |
|
|
20
|
+
* | 60-74 | Standard | Normal prompts with guidance |
|
|
21
|
+
* | <60 | Supportive | Detailed prompts, more examples |
|
|
22
|
+
*
|
|
23
|
+
* Data Flow:
|
|
24
|
+
* 1. Fetch insight scores from dashboard API at session start
|
|
25
|
+
* 2. Cache locally with 4-hour TTL
|
|
26
|
+
* 3. Fall back to local adoption score if offline
|
|
27
|
+
*/
|
|
28
|
+
import fs from 'fs-extra';
|
|
29
|
+
import path from 'path';
|
|
30
|
+
import { getUserEmail, getGinkoDir } from '../utils/helpers.js';
|
|
31
|
+
import { getAdoptionScore } from './adoption-score.js';
|
|
32
|
+
// =============================================================================
|
|
33
|
+
// Constants
|
|
34
|
+
// =============================================================================
|
|
35
|
+
const CACHE_FILE = 'insights-cache.json';
|
|
36
|
+
const CONFIG_FILE = 'coaching-config.json';
|
|
37
|
+
const CACHE_TTL_HOURS = 4;
|
|
38
|
+
const CACHE_TTL_MS = CACHE_TTL_HOURS * 60 * 60 * 1000;
|
|
39
|
+
const LEVEL_THRESHOLDS = {
|
|
40
|
+
minimal: 75, // ≥75: assume competence
|
|
41
|
+
standard: 60, // 60-74: balanced guidance
|
|
42
|
+
// <60: supportive
|
|
43
|
+
};
|
|
44
|
+
// =============================================================================
|
|
45
|
+
// File Paths
|
|
46
|
+
// =============================================================================
|
|
47
|
+
async function getUserSessionDir() {
|
|
48
|
+
const ginkoDir = await getGinkoDir();
|
|
49
|
+
const userEmail = await getUserEmail();
|
|
50
|
+
const userSlug = userEmail.replace('@', '-at-').replace(/\./g, '-');
|
|
51
|
+
return path.join(ginkoDir, 'sessions', userSlug);
|
|
52
|
+
}
|
|
53
|
+
async function getCacheFilePath() {
|
|
54
|
+
const sessionDir = await getUserSessionDir();
|
|
55
|
+
return path.join(sessionDir, CACHE_FILE);
|
|
56
|
+
}
|
|
57
|
+
async function getConfigFilePath() {
|
|
58
|
+
const sessionDir = await getUserSessionDir();
|
|
59
|
+
return path.join(sessionDir, CONFIG_FILE);
|
|
60
|
+
}
|
|
61
|
+
// =============================================================================
|
|
62
|
+
// Cache Management
|
|
63
|
+
// =============================================================================
|
|
64
|
+
/**
|
|
65
|
+
* Load cached insight scores
|
|
66
|
+
*/
|
|
67
|
+
async function loadCachedScores() {
|
|
68
|
+
const cachePath = await getCacheFilePath();
|
|
69
|
+
try {
|
|
70
|
+
if (await fs.pathExists(cachePath)) {
|
|
71
|
+
const data = await fs.readJSON(cachePath);
|
|
72
|
+
const fetchedAt = new Date(data.fetchedAt).getTime();
|
|
73
|
+
const now = Date.now();
|
|
74
|
+
// Check if cache is still valid
|
|
75
|
+
if (now - fetchedAt < CACHE_TTL_MS) {
|
|
76
|
+
return data;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
catch {
|
|
81
|
+
// Cache corrupted or invalid
|
|
82
|
+
}
|
|
83
|
+
return null;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Save insight scores to cache
|
|
87
|
+
*/
|
|
88
|
+
async function saveCachedScores(scores) {
|
|
89
|
+
const cachePath = await getCacheFilePath();
|
|
90
|
+
await fs.ensureDir(path.dirname(cachePath));
|
|
91
|
+
await fs.writeJSON(cachePath, scores, { spaces: 2 });
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Get cache age in minutes
|
|
95
|
+
*/
|
|
96
|
+
function getCacheAgeMinutes(fetchedAt) {
|
|
97
|
+
const fetchedTime = new Date(fetchedAt).getTime();
|
|
98
|
+
const now = Date.now();
|
|
99
|
+
return Math.round((now - fetchedTime) / (1000 * 60));
|
|
100
|
+
}
|
|
101
|
+
// =============================================================================
|
|
102
|
+
// Config Management
|
|
103
|
+
// =============================================================================
|
|
104
|
+
/**
|
|
105
|
+
* Load coaching config (manual overrides)
|
|
106
|
+
*/
|
|
107
|
+
export async function loadCoachingConfig() {
|
|
108
|
+
const configPath = await getConfigFilePath();
|
|
109
|
+
try {
|
|
110
|
+
if (await fs.pathExists(configPath)) {
|
|
111
|
+
return await fs.readJSON(configPath);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
catch {
|
|
115
|
+
// Config corrupted
|
|
116
|
+
}
|
|
117
|
+
return {
|
|
118
|
+
override: null,
|
|
119
|
+
overrideSetAt: null,
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Save coaching config
|
|
124
|
+
*/
|
|
125
|
+
export async function saveCoachingConfig(config) {
|
|
126
|
+
const configPath = await getConfigFilePath();
|
|
127
|
+
await fs.ensureDir(path.dirname(configPath));
|
|
128
|
+
await fs.writeJSON(configPath, config, { spaces: 2 });
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Set manual coaching level override
|
|
132
|
+
*/
|
|
133
|
+
export async function setCoachingOverride(level) {
|
|
134
|
+
const config = await loadCoachingConfig();
|
|
135
|
+
if (level === 'auto') {
|
|
136
|
+
config.override = null;
|
|
137
|
+
config.overrideSetAt = null;
|
|
138
|
+
}
|
|
139
|
+
else {
|
|
140
|
+
config.override = level;
|
|
141
|
+
config.overrideSetAt = new Date().toISOString();
|
|
142
|
+
}
|
|
143
|
+
await saveCoachingConfig(config);
|
|
144
|
+
}
|
|
145
|
+
// =============================================================================
|
|
146
|
+
// API Integration
|
|
147
|
+
// =============================================================================
|
|
148
|
+
/**
|
|
149
|
+
* Fetch insight scores from dashboard API
|
|
150
|
+
* Non-blocking with 2-second timeout
|
|
151
|
+
*/
|
|
152
|
+
async function fetchInsightScores(graphId) {
|
|
153
|
+
// Import dynamically to avoid circular dependencies
|
|
154
|
+
const { GraphApiClient } = await import('../commands/graph/api-client.js');
|
|
155
|
+
const { isAuthenticated } = await import('../utils/auth-storage.js');
|
|
156
|
+
if (!await isAuthenticated()) {
|
|
157
|
+
return null;
|
|
158
|
+
}
|
|
159
|
+
const client = new GraphApiClient();
|
|
160
|
+
try {
|
|
161
|
+
// Use AbortController for timeout
|
|
162
|
+
const controller = new AbortController();
|
|
163
|
+
const timeoutId = setTimeout(() => controller.abort(), 2000);
|
|
164
|
+
const response = await client.request('GET', `/api/v1/insights/sync?graphId=${encodeURIComponent(graphId)}&days=7`);
|
|
165
|
+
clearTimeout(timeoutId);
|
|
166
|
+
if (response.report) {
|
|
167
|
+
const categoryMap = {};
|
|
168
|
+
for (const cat of response.report.categoryScores) {
|
|
169
|
+
categoryMap[cat.category] = cat.score;
|
|
170
|
+
}
|
|
171
|
+
const scores = {
|
|
172
|
+
overallScore: response.trendScores?.day7?.score ?? response.report.overallScore,
|
|
173
|
+
categoryScores: {
|
|
174
|
+
efficiency: categoryMap['efficiency'] ?? 70,
|
|
175
|
+
patterns: categoryMap['patterns'] ?? 70,
|
|
176
|
+
quality: categoryMap['quality'] ?? 70,
|
|
177
|
+
'anti-patterns': categoryMap['anti-patterns'] ?? 70,
|
|
178
|
+
},
|
|
179
|
+
fetchedAt: new Date().toISOString(),
|
|
180
|
+
periodDays: 7,
|
|
181
|
+
};
|
|
182
|
+
await saveCachedScores(scores);
|
|
183
|
+
return scores;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
catch {
|
|
187
|
+
// API unavailable - will use cache or fallback
|
|
188
|
+
}
|
|
189
|
+
return null;
|
|
190
|
+
}
|
|
191
|
+
// =============================================================================
|
|
192
|
+
// Level Calculation
|
|
193
|
+
// =============================================================================
|
|
194
|
+
/**
|
|
195
|
+
* Calculate coaching level from overall score
|
|
196
|
+
*/
|
|
197
|
+
export function calculateCoachingLevel(score) {
|
|
198
|
+
if (score >= LEVEL_THRESHOLDS.minimal)
|
|
199
|
+
return 'minimal';
|
|
200
|
+
if (score >= LEVEL_THRESHOLDS.standard)
|
|
201
|
+
return 'standard';
|
|
202
|
+
return 'supportive';
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Convert adoption QuietingLevel to CoachingLevel
|
|
206
|
+
*/
|
|
207
|
+
function adoptionLevelToCoachingLevel(quieting) {
|
|
208
|
+
switch (quieting) {
|
|
209
|
+
case 'minimal':
|
|
210
|
+
return 'minimal';
|
|
211
|
+
case 'light':
|
|
212
|
+
return 'standard';
|
|
213
|
+
case 'full':
|
|
214
|
+
default:
|
|
215
|
+
return 'supportive';
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* Estimate score from adoption level for fallback
|
|
220
|
+
*/
|
|
221
|
+
function adoptionLevelToScore(quieting) {
|
|
222
|
+
switch (quieting) {
|
|
223
|
+
case 'minimal':
|
|
224
|
+
return 80; // High adopters
|
|
225
|
+
case 'light':
|
|
226
|
+
return 68; // Medium adopters
|
|
227
|
+
case 'full':
|
|
228
|
+
default:
|
|
229
|
+
return 50; // New users
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
// =============================================================================
|
|
233
|
+
// Main Functions
|
|
234
|
+
// =============================================================================
|
|
235
|
+
/**
|
|
236
|
+
* Get coaching context for current session
|
|
237
|
+
*
|
|
238
|
+
* Priority:
|
|
239
|
+
* 1. Manual override (if set)
|
|
240
|
+
* 2. Dashboard insight scores (if available)
|
|
241
|
+
* 3. Cached scores (if within TTL)
|
|
242
|
+
* 4. Adoption score fallback (if offline)
|
|
243
|
+
*/
|
|
244
|
+
export async function getCoachingContext(graphId) {
|
|
245
|
+
const config = await loadCoachingConfig();
|
|
246
|
+
// Try to get scores in order of preference
|
|
247
|
+
let scores = null;
|
|
248
|
+
let source = 'adoption_fallback';
|
|
249
|
+
let cacheAge;
|
|
250
|
+
// 1. Try fresh API fetch if we have graphId
|
|
251
|
+
if (graphId) {
|
|
252
|
+
scores = await fetchInsightScores(graphId);
|
|
253
|
+
if (scores) {
|
|
254
|
+
source = 'dashboard';
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
// 2. Fall back to cache
|
|
258
|
+
if (!scores) {
|
|
259
|
+
scores = await loadCachedScores();
|
|
260
|
+
if (scores) {
|
|
261
|
+
source = 'cache';
|
|
262
|
+
cacheAge = getCacheAgeMinutes(scores.fetchedAt);
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
// 3. Fall back to adoption score
|
|
266
|
+
if (!scores) {
|
|
267
|
+
const adoption = await getAdoptionScore();
|
|
268
|
+
const estimatedScore = adoptionLevelToScore(adoption.level);
|
|
269
|
+
scores = {
|
|
270
|
+
overallScore: estimatedScore,
|
|
271
|
+
categoryScores: {
|
|
272
|
+
efficiency: estimatedScore,
|
|
273
|
+
patterns: estimatedScore,
|
|
274
|
+
quality: estimatedScore,
|
|
275
|
+
'anti-patterns': estimatedScore,
|
|
276
|
+
},
|
|
277
|
+
fetchedAt: new Date().toISOString(),
|
|
278
|
+
periodDays: 7,
|
|
279
|
+
};
|
|
280
|
+
source = 'adoption_fallback';
|
|
281
|
+
}
|
|
282
|
+
// Calculate level (or use override)
|
|
283
|
+
const calculatedLevel = calculateCoachingLevel(scores.overallScore);
|
|
284
|
+
const effectiveLevel = config.override ?? calculatedLevel;
|
|
285
|
+
return {
|
|
286
|
+
overallScore: scores.overallScore,
|
|
287
|
+
metrics: {
|
|
288
|
+
sessionEfficiency: scores.categoryScores.efficiency,
|
|
289
|
+
patternAdoption: scores.categoryScores.patterns,
|
|
290
|
+
collaborationQuality: scores.categoryScores.quality,
|
|
291
|
+
antiPatterns: scores.categoryScores['anti-patterns'],
|
|
292
|
+
},
|
|
293
|
+
level: effectiveLevel,
|
|
294
|
+
override: config.override,
|
|
295
|
+
source,
|
|
296
|
+
cacheAge,
|
|
297
|
+
};
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* Get coaching level for quick checks
|
|
301
|
+
* Simplified version that just returns the level
|
|
302
|
+
*/
|
|
303
|
+
export async function getCoachingLevel(graphId) {
|
|
304
|
+
const context = await getCoachingContext(graphId);
|
|
305
|
+
return context.level;
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
* Check if a specific metric is low and needs targeted coaching
|
|
309
|
+
*/
|
|
310
|
+
export function isMetricLow(value, threshold = 70) {
|
|
311
|
+
return value < threshold;
|
|
312
|
+
}
|
|
313
|
+
/**
|
|
314
|
+
* Get targeted coaching suggestions based on low metrics
|
|
315
|
+
*/
|
|
316
|
+
export function getTargetedCoachingSuggestions(context) {
|
|
317
|
+
const suggestions = [];
|
|
318
|
+
const threshold = 70;
|
|
319
|
+
if (isMetricLow(context.metrics.sessionEfficiency, threshold)) {
|
|
320
|
+
suggestions.push('Consider using `ginko handoff` to preserve context between sessions');
|
|
321
|
+
}
|
|
322
|
+
if (isMetricLow(context.metrics.patternAdoption, threshold)) {
|
|
323
|
+
suggestions.push('Try organizing work into Epic→Sprint→Task structure for better tracking');
|
|
324
|
+
}
|
|
325
|
+
if (isMetricLow(context.metrics.collaborationQuality, threshold)) {
|
|
326
|
+
suggestions.push('Log more decisions with `ginko log` to improve collaboration quality');
|
|
327
|
+
}
|
|
328
|
+
if (isMetricLow(context.metrics.antiPatterns, threshold)) {
|
|
329
|
+
suggestions.push('Review recent gotcha warnings - you may be hitting known issues');
|
|
330
|
+
}
|
|
331
|
+
return suggestions;
|
|
332
|
+
}
|
|
333
|
+
/**
|
|
334
|
+
* Get the appropriate prompt variant based on coaching level
|
|
335
|
+
*/
|
|
336
|
+
export function selectPrompt(variants, level) {
|
|
337
|
+
return variants[level];
|
|
338
|
+
}
|
|
339
|
+
/**
|
|
340
|
+
* Standard prompt variants for common scenarios
|
|
341
|
+
*/
|
|
342
|
+
export const PROMPT_VARIANTS = {
|
|
343
|
+
noStructure: {
|
|
344
|
+
minimal: 'No active sprint. [a] Epic [b] Sprint [c] Quick [d] Ad-hoc',
|
|
345
|
+
standard: `You have no planned work. What would you like to work on?
|
|
346
|
+
|
|
347
|
+
[a] New Epic - Large initiative with multiple sprints
|
|
348
|
+
[b] New Feature Sprint - Focused work with clear goals
|
|
349
|
+
[c] Quick fix / Bug fix - Single task, minimal overhead
|
|
350
|
+
[d] Something else - Explore, research, or work ad-hoc`,
|
|
351
|
+
supportive: `I notice you're not currently in a sprint. Sprints help track progress and maintain focus.
|
|
352
|
+
|
|
353
|
+
What would you like to work on?
|
|
354
|
+
|
|
355
|
+
[a] New Epic (Recommended)
|
|
356
|
+
For large initiatives that need multiple sprints to complete.
|
|
357
|
+
Example: "Implement user authentication system"
|
|
358
|
+
|
|
359
|
+
[b] New Feature Sprint
|
|
360
|
+
For focused work with a clear goal that can be done in ~1 week.
|
|
361
|
+
Example: "Add dark mode toggle"
|
|
362
|
+
|
|
363
|
+
[c] Quick fix / Bug fix
|
|
364
|
+
For small, single tasks that don't need sprint overhead.
|
|
365
|
+
Example: "Fix login button alignment"
|
|
366
|
+
|
|
367
|
+
[d] Something else
|
|
368
|
+
For exploration, research, or ad-hoc work.
|
|
369
|
+
|
|
370
|
+
Tip: Structured work (options a-c) improves your collaboration insights!`,
|
|
371
|
+
},
|
|
372
|
+
sprintComplete: {
|
|
373
|
+
minimal: 'Sprint done! [a] Next sprint [b] New epic [c] Ad-hoc',
|
|
374
|
+
standard: `🎉 Sprint complete! All tasks finished.
|
|
375
|
+
|
|
376
|
+
What's next?
|
|
377
|
+
[a] Start next sprint
|
|
378
|
+
[b] Create new epic
|
|
379
|
+
[c] Work on something else`,
|
|
380
|
+
supportive: `🎉 Great work! You've completed all tasks in this sprint.
|
|
381
|
+
|
|
382
|
+
What would you like to do next?
|
|
383
|
+
|
|
384
|
+
[a] Start next sprint
|
|
385
|
+
Continue momentum with the next planned sprint.
|
|
386
|
+
|
|
387
|
+
[b] Create new epic
|
|
388
|
+
Begin a new large initiative.
|
|
389
|
+
|
|
390
|
+
[c] Work on something else
|
|
391
|
+
Take a break or explore other work.
|
|
392
|
+
|
|
393
|
+
Tip: Completing sprints contributes to your pattern adoption score!`,
|
|
394
|
+
},
|
|
395
|
+
};
|
|
396
|
+
// =============================================================================
|
|
397
|
+
// Exports for Testing
|
|
398
|
+
// =============================================================================
|
|
399
|
+
export const __testing = {
|
|
400
|
+
LEVEL_THRESHOLDS,
|
|
401
|
+
CACHE_TTL_HOURS,
|
|
402
|
+
adoptionLevelToCoachingLevel,
|
|
403
|
+
adoptionLevelToScore,
|
|
404
|
+
getCacheAgeMinutes,
|
|
405
|
+
};
|
|
406
|
+
//# sourceMappingURL=coaching-level.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coaching-level.js","sourceRoot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IAED,IAAI,WAAW,CAAC,OAAO,CAAC,OAAO,CAAC,oBAAoB,EAAE,SAAS,CAAC,EAAE,CAAC;QACjE,WAAW,CAAC,IAAI,CAAC,sEAAsE,CAAC,CAAC;IAC3F,CAAC;IAED,IAAI,WAAW,CAAC,OAAO,CAAC,OAAO,CAAC,YAAY,EAAE,SAAS,CAAC,EAAE,CAAC;QACzD,WAAW,CAAC,IAAI,CAAC,iEAAiE,CAAC,CAAC;IACtF,CAAC;IAED,OAAO,WAAW,CAAC;AACrB,CAAC;AAYD;;GAEG;AACH,MAAM,UAAU,YAAY,CAC1B,QAAkC,EAClC,KAAoB;IAEpB,OAAO,QAAQ,CAAC,KAAK,CAAC,CAAC;AACzB,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,WAAW,EAAE;QACX,OAAO,EAAE,4DAA4D;QACrE,QAAQ,EAAE;;;;;uDAKyC;QACnD,UAAU,EAAE;;;;;;;;;;;;;;;;;;;yEAmByD;KACtE;IAED,cAAc,EAAE;QACd,OAAO,EAAE,sDAAsD;QAC/D,QAAQ,EAAE;;;;;2BAKa;QACvB,UAAU,EAAE;;;;;;;;;;;;;oEAaoD;KACjE;CACO,CAAC;AAEX,gFAAgF;AAChF,sBAAsB;AACtB,gFAAgF;AAEhF,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,gBAAgB;IAChB,eAAe;IACf,4BAA4B;IAC5B,oBAAoB;IACpB,kBAAkB;CACnB,CAAC"}
|
|
@@ -72,4 +72,46 @@ export declare function getUnsyncedEvents(): Promise<Event[]>;
|
|
|
72
72
|
* Clear events file (for testing)
|
|
73
73
|
*/
|
|
74
74
|
export declare function clearEvents(): Promise<void>;
|
|
75
|
+
/**
|
|
76
|
+
* Coaching event types for tracking interactions
|
|
77
|
+
*/
|
|
78
|
+
export type CoachingEventType = 'planning_menu_shown' | 'planning_menu_selection' | 'coaching_level_auto' | 'coaching_level_override' | 'targeted_tip_shown' | 'session_with_structure' | 'session_without_structure';
|
|
79
|
+
/**
|
|
80
|
+
* Coaching event data for analytics
|
|
81
|
+
*/
|
|
82
|
+
export interface CoachingEventData {
|
|
83
|
+
type: CoachingEventType;
|
|
84
|
+
coachingLevel?: 'minimal' | 'standard' | 'supportive';
|
|
85
|
+
overallScore?: number;
|
|
86
|
+
selection?: string;
|
|
87
|
+
tipId?: string;
|
|
88
|
+
metric?: string;
|
|
89
|
+
sessionHadStructure?: boolean;
|
|
90
|
+
override?: boolean;
|
|
91
|
+
previousLevel?: string;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Log a coaching interaction event (EPIC-016 Sprint 5 Task 5)
|
|
95
|
+
*
|
|
96
|
+
* Tracks coaching interactions for future analysis:
|
|
97
|
+
* - Planning menu selections over time
|
|
98
|
+
* - Time from "no structure" to "structured work"
|
|
99
|
+
* - User override patterns
|
|
100
|
+
* - Correlation between coaching level and adoption
|
|
101
|
+
*
|
|
102
|
+
* @param data - Coaching event data
|
|
103
|
+
*/
|
|
104
|
+
export declare function logCoachingEvent(data: CoachingEventData): Promise<void>;
|
|
105
|
+
/**
|
|
106
|
+
* Log planning menu interaction
|
|
107
|
+
*/
|
|
108
|
+
export declare function logPlanningMenuEvent(selection: string, coachingLevel: 'minimal' | 'standard' | 'supportive', overallScore?: number): Promise<void>;
|
|
109
|
+
/**
|
|
110
|
+
* Log coaching level change
|
|
111
|
+
*/
|
|
112
|
+
export declare function logCoachingLevelChange(newLevel: 'minimal' | 'standard' | 'supportive', isOverride: boolean, overallScore?: number, previousLevel?: string): Promise<void>;
|
|
113
|
+
/**
|
|
114
|
+
* Log targeted tip shown
|
|
115
|
+
*/
|
|
116
|
+
export declare function logTargetedTipShown(tipId: string, metric: string, coachingLevel: 'minimal' | 'standard' | 'supportive'): Promise<void>;
|
|
75
117
|
//# sourceMappingURL=event-logger.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event-logger.d.ts","sourceRoot":"","sources":["../../src/l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