@ginkoai/cli 1.7.2 → 1.8.0
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/insights/index.d.ts +12 -0
- package/dist/commands/insights/index.d.ts.map +1 -0
- package/dist/commands/insights/index.js +12 -0
- package/dist/commands/insights/index.js.map +1 -0
- package/dist/commands/insights/insights-command.d.ts +20 -0
- package/dist/commands/insights/insights-command.d.ts.map +1 -0
- package/dist/commands/insights/insights-command.js +331 -0
- package/dist/commands/insights/insights-command.js.map +1 -0
- package/dist/commands/start/start-reflection.d.ts.map +1 -1
- package/dist/commands/start/start-reflection.js +50 -13
- package/dist/commands/start/start-reflection.js.map +1 -1
- package/dist/index.js +30 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/insights/analyzers/anti-patterns.d.ts +32 -0
- package/dist/lib/insights/analyzers/anti-patterns.d.ts.map +1 -0
- package/dist/lib/insights/analyzers/anti-patterns.js +302 -0
- package/dist/lib/insights/analyzers/anti-patterns.js.map +1 -0
- package/dist/lib/insights/analyzers/efficiency.d.ts +22 -0
- package/dist/lib/insights/analyzers/efficiency.d.ts.map +1 -0
- package/dist/lib/insights/analyzers/efficiency.js +311 -0
- package/dist/lib/insights/analyzers/efficiency.js.map +1 -0
- package/dist/lib/insights/analyzers/index.d.ts +24 -0
- package/dist/lib/insights/analyzers/index.d.ts.map +1 -0
- package/dist/lib/insights/analyzers/index.js +37 -0
- package/dist/lib/insights/analyzers/index.js.map +1 -0
- package/dist/lib/insights/analyzers/patterns.d.ts +21 -0
- package/dist/lib/insights/analyzers/patterns.d.ts.map +1 -0
- package/dist/lib/insights/analyzers/patterns.js +327 -0
- package/dist/lib/insights/analyzers/patterns.js.map +1 -0
- package/dist/lib/insights/analyzers/quality.d.ts +29 -0
- package/dist/lib/insights/analyzers/quality.d.ts.map +1 -0
- package/dist/lib/insights/analyzers/quality.js +366 -0
- package/dist/lib/insights/analyzers/quality.js.map +1 -0
- package/dist/lib/insights/data-collector.d.ts +68 -0
- package/dist/lib/insights/data-collector.d.ts.map +1 -0
- package/dist/lib/insights/data-collector.js +467 -0
- package/dist/lib/insights/data-collector.js.map +1 -0
- package/dist/lib/insights/index.d.ts +14 -0
- package/dist/lib/insights/index.d.ts.map +1 -0
- package/dist/lib/insights/index.js +17 -0
- package/dist/lib/insights/index.js.map +1 -0
- package/dist/lib/insights/types.d.ts +216 -0
- package/dist/lib/insights/types.d.ts.map +1 -0
- package/dist/lib/insights/types.js +12 -0
- package/dist/lib/insights/types.js.map +1 -0
- package/dist/templates/ai-instructions-template.d.ts +1 -0
- package/dist/templates/ai-instructions-template.d.ts.map +1 -1
- package/dist/templates/ai-instructions-template.js +51 -0
- package/dist/templates/ai-instructions-template.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileType: command-index
|
|
3
|
+
* @status: current
|
|
4
|
+
* @updated: 2025-12-15
|
|
5
|
+
* @tags: [cli, insights, coaching, command]
|
|
6
|
+
* @related: [insights-command.ts, ../../lib/insights/]
|
|
7
|
+
* @priority: high
|
|
8
|
+
* @complexity: low
|
|
9
|
+
* @dependencies: []
|
|
10
|
+
*/
|
|
11
|
+
export { insightsCommand } from './insights-command.js';
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/insights/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileType: command-index
|
|
3
|
+
* @status: current
|
|
4
|
+
* @updated: 2025-12-15
|
|
5
|
+
* @tags: [cli, insights, coaching, command]
|
|
6
|
+
* @related: [insights-command.ts, ../../lib/insights/]
|
|
7
|
+
* @priority: high
|
|
8
|
+
* @complexity: low
|
|
9
|
+
* @dependencies: []
|
|
10
|
+
*/
|
|
11
|
+
export { insightsCommand } from './insights-command.js';
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/insights/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileType: command
|
|
3
|
+
* @status: current
|
|
4
|
+
* @updated: 2025-12-15
|
|
5
|
+
* @tags: [cli, insights, coaching, analysis]
|
|
6
|
+
* @related: [../../lib/insights/, ../status.ts]
|
|
7
|
+
* @priority: high
|
|
8
|
+
* @complexity: medium
|
|
9
|
+
* @dependencies: [chalk, commander]
|
|
10
|
+
*/
|
|
11
|
+
export interface InsightsOptions {
|
|
12
|
+
detailed?: boolean;
|
|
13
|
+
category?: string;
|
|
14
|
+
json?: boolean;
|
|
15
|
+
sync?: boolean;
|
|
16
|
+
days?: number;
|
|
17
|
+
}
|
|
18
|
+
export declare function insightsCommand(options?: InsightsOptions): Promise<void>;
|
|
19
|
+
export default insightsCommand;
|
|
20
|
+
//# sourceMappingURL=insights-command.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"insights-command.d.ts","sourceRoot":"","sources":["../../../src/commands/insights/insights-command.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAmBH,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAgCD,wBAAsB,eAAe,CAAC,OAAO,GAAE,eAAoB,GAAG,OAAO,CAAC,IAAI,CAAC,CA4BlF;AAuTD,eAAe,eAAe,CAAC"}
|
|
@@ -0,0 +1,331 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileType: command
|
|
3
|
+
* @status: current
|
|
4
|
+
* @updated: 2025-12-15
|
|
5
|
+
* @tags: [cli, insights, coaching, analysis]
|
|
6
|
+
* @related: [../../lib/insights/, ../status.ts]
|
|
7
|
+
* @priority: high
|
|
8
|
+
* @complexity: medium
|
|
9
|
+
* @dependencies: [chalk, commander]
|
|
10
|
+
*/
|
|
11
|
+
import chalk from 'chalk';
|
|
12
|
+
import { collectInsightData, getAllAnalyzers, getAnalyzer, } from '../../lib/insights/index.js';
|
|
13
|
+
// ============================================================================
|
|
14
|
+
// Constants
|
|
15
|
+
// ============================================================================
|
|
16
|
+
const SEVERITY_ICONS = {
|
|
17
|
+
info: '○',
|
|
18
|
+
suggestion: '◐',
|
|
19
|
+
warning: '⚠️',
|
|
20
|
+
critical: '🚨',
|
|
21
|
+
};
|
|
22
|
+
const CATEGORY_DISPLAY_NAMES = {
|
|
23
|
+
efficiency: 'Session Efficiency',
|
|
24
|
+
patterns: 'Pattern Adoption',
|
|
25
|
+
quality: 'Collaboration Quality',
|
|
26
|
+
'anti-patterns': 'Anti-Patterns',
|
|
27
|
+
};
|
|
28
|
+
const SCORE_RATINGS = [
|
|
29
|
+
{ min: 90, label: 'Excellent', color: chalk.green },
|
|
30
|
+
{ min: 75, label: 'Good', color: chalk.cyan },
|
|
31
|
+
{ min: 60, label: 'Fair', color: chalk.yellow },
|
|
32
|
+
{ min: 40, label: 'Needs Improvement', color: chalk.hex('#FFA500') },
|
|
33
|
+
{ min: 0, label: 'Critical', color: chalk.red },
|
|
34
|
+
];
|
|
35
|
+
// ============================================================================
|
|
36
|
+
// Main Command
|
|
37
|
+
// ============================================================================
|
|
38
|
+
export async function insightsCommand(options = {}) {
|
|
39
|
+
try {
|
|
40
|
+
const days = options.days ?? 30;
|
|
41
|
+
// Collect data
|
|
42
|
+
console.log(chalk.dim(`Analyzing ${days} days of activity...`));
|
|
43
|
+
const data = await collectInsightData({ days });
|
|
44
|
+
// Run analysis
|
|
45
|
+
const report = await generateReport(data, options.category);
|
|
46
|
+
// Output based on format
|
|
47
|
+
if (options.json) {
|
|
48
|
+
outputJson(report);
|
|
49
|
+
}
|
|
50
|
+
else if (options.detailed) {
|
|
51
|
+
outputDetailed(report);
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
outputSummary(report);
|
|
55
|
+
}
|
|
56
|
+
// Sync to Supabase if requested
|
|
57
|
+
if (options.sync) {
|
|
58
|
+
await syncToSupabase(report);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
catch (error) {
|
|
62
|
+
console.error(chalk.red('Error running insights analysis:'), error instanceof Error ? error.message : String(error));
|
|
63
|
+
process.exit(1);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
// ============================================================================
|
|
67
|
+
// Report Generation
|
|
68
|
+
// ============================================================================
|
|
69
|
+
async function generateReport(data, categoryFilter) {
|
|
70
|
+
const analyzers = categoryFilter
|
|
71
|
+
? [getAnalyzer(categoryFilter)].filter(Boolean)
|
|
72
|
+
: getAllAnalyzers();
|
|
73
|
+
if (analyzers.length === 0) {
|
|
74
|
+
throw new Error(`Unknown category: ${categoryFilter}. Valid categories: efficiency, patterns, quality, anti-patterns`);
|
|
75
|
+
}
|
|
76
|
+
// Run all analyzers
|
|
77
|
+
const allInsights = [];
|
|
78
|
+
for (const analyzer of analyzers) {
|
|
79
|
+
if (analyzer) {
|
|
80
|
+
const insights = await analyzer.analyze(data);
|
|
81
|
+
allInsights.push(...insights);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
// Calculate category scores
|
|
85
|
+
const categoryScores = calculateCategoryScores(allInsights);
|
|
86
|
+
// Calculate overall score
|
|
87
|
+
const overallScore = calculateOverallScore(categoryScores);
|
|
88
|
+
// Generate summary
|
|
89
|
+
const summary = generateSummary(allInsights, overallScore);
|
|
90
|
+
return {
|
|
91
|
+
userId: data.userId,
|
|
92
|
+
projectId: data.projectId,
|
|
93
|
+
runAt: new Date(),
|
|
94
|
+
period: data.period,
|
|
95
|
+
overallScore,
|
|
96
|
+
categoryScores,
|
|
97
|
+
insights: allInsights,
|
|
98
|
+
summary,
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
function calculateCategoryScores(insights) {
|
|
102
|
+
const categories = ['efficiency', 'patterns', 'quality', 'anti-patterns'];
|
|
103
|
+
const scores = [];
|
|
104
|
+
for (const category of categories) {
|
|
105
|
+
const categoryInsights = insights.filter(i => i.category === category);
|
|
106
|
+
const baseScore = 75; // Start with a base score
|
|
107
|
+
// Calculate adjustments from insights
|
|
108
|
+
const adjustments = categoryInsights.reduce((sum, insight) => sum + insight.scoreImpact, 0);
|
|
109
|
+
// Clamp score between 0 and 100
|
|
110
|
+
const score = Math.max(0, Math.min(100, baseScore + adjustments));
|
|
111
|
+
scores.push({
|
|
112
|
+
category,
|
|
113
|
+
score: Math.round(score),
|
|
114
|
+
baseScore,
|
|
115
|
+
adjustments,
|
|
116
|
+
insightCount: categoryInsights.length,
|
|
117
|
+
criticalCount: categoryInsights.filter(i => i.severity === 'critical').length,
|
|
118
|
+
warningCount: categoryInsights.filter(i => i.severity === 'warning').length,
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
return scores;
|
|
122
|
+
}
|
|
123
|
+
function calculateOverallScore(categoryScores) {
|
|
124
|
+
if (categoryScores.length === 0)
|
|
125
|
+
return 75;
|
|
126
|
+
// Weight categories (efficiency and quality slightly higher)
|
|
127
|
+
const weights = {
|
|
128
|
+
efficiency: 0.3,
|
|
129
|
+
patterns: 0.2,
|
|
130
|
+
quality: 0.3,
|
|
131
|
+
'anti-patterns': 0.2,
|
|
132
|
+
};
|
|
133
|
+
let weightedSum = 0;
|
|
134
|
+
let totalWeight = 0;
|
|
135
|
+
for (const cs of categoryScores) {
|
|
136
|
+
const weight = weights[cs.category] || 0.25;
|
|
137
|
+
weightedSum += cs.score * weight;
|
|
138
|
+
totalWeight += weight;
|
|
139
|
+
}
|
|
140
|
+
return Math.round(weightedSum / totalWeight);
|
|
141
|
+
}
|
|
142
|
+
function generateSummary(insights, score) {
|
|
143
|
+
const criticalCount = insights.filter(i => i.severity === 'critical').length;
|
|
144
|
+
const warningCount = insights.filter(i => i.severity === 'warning').length;
|
|
145
|
+
const positiveCount = insights.filter(i => i.scoreImpact > 0).length;
|
|
146
|
+
if (criticalCount > 0) {
|
|
147
|
+
return `${criticalCount} critical issues require immediate attention.`;
|
|
148
|
+
}
|
|
149
|
+
else if (warningCount > 0) {
|
|
150
|
+
return `${warningCount} areas could be improved. ${positiveCount} metrics are performing well.`;
|
|
151
|
+
}
|
|
152
|
+
else if (score >= 90) {
|
|
153
|
+
return `Excellent performance across all metrics. Keep up the great work!`;
|
|
154
|
+
}
|
|
155
|
+
else if (score >= 75) {
|
|
156
|
+
return `Good overall performance with ${positiveCount} strong areas.`;
|
|
157
|
+
}
|
|
158
|
+
else {
|
|
159
|
+
return `Several areas need attention to improve your development workflow.`;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
// ============================================================================
|
|
163
|
+
// Output Formatters
|
|
164
|
+
// ============================================================================
|
|
165
|
+
function outputSummary(report) {
|
|
166
|
+
// Header
|
|
167
|
+
console.log('');
|
|
168
|
+
console.log(chalk.bold(`Coaching Insights`) + chalk.dim(` | ${report.userId} | ${report.projectId}`));
|
|
169
|
+
console.log(chalk.dim(`Analysis period: ${report.period.days} days`));
|
|
170
|
+
console.log('');
|
|
171
|
+
// Category summaries
|
|
172
|
+
for (const categoryScore of report.categoryScores) {
|
|
173
|
+
const displayName = CATEGORY_DISPLAY_NAMES[categoryScore.category];
|
|
174
|
+
const categoryInsights = report.insights.filter(i => i.category === categoryScore.category);
|
|
175
|
+
// Skip empty categories
|
|
176
|
+
if (categoryInsights.length === 0)
|
|
177
|
+
continue;
|
|
178
|
+
console.log(chalk.cyan.bold(displayName));
|
|
179
|
+
// Show top 2 insights per category
|
|
180
|
+
const topInsights = categoryInsights.slice(0, 2);
|
|
181
|
+
for (const insight of topInsights) {
|
|
182
|
+
const icon = SEVERITY_ICONS[insight.severity];
|
|
183
|
+
const titleColor = insight.scoreImpact > 0 ? chalk.green : insight.severity === 'warning' ? chalk.yellow : chalk.white;
|
|
184
|
+
console.log(` ${icon} ${titleColor(insight.title)}`);
|
|
185
|
+
if (insight.description && insight.description.length < 80) {
|
|
186
|
+
console.log(chalk.dim(` ${insight.description}`));
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
if (categoryInsights.length > 2) {
|
|
190
|
+
console.log(chalk.dim(` +${categoryInsights.length - 2} more insights`));
|
|
191
|
+
}
|
|
192
|
+
console.log('');
|
|
193
|
+
}
|
|
194
|
+
// Overall score
|
|
195
|
+
const rating = getScoreRating(report.overallScore);
|
|
196
|
+
console.log(chalk.bold('Overall Score: ') + rating.color(`${report.overallScore}/100 (${rating.label})`));
|
|
197
|
+
console.log(chalk.dim(report.summary));
|
|
198
|
+
console.log('');
|
|
199
|
+
console.log(chalk.dim(`Run ${chalk.cyan('ginko insights --detailed')} for full analysis`));
|
|
200
|
+
}
|
|
201
|
+
function outputDetailed(report) {
|
|
202
|
+
// Header
|
|
203
|
+
console.log('');
|
|
204
|
+
console.log(chalk.bold.green('Coaching Insights Report'));
|
|
205
|
+
console.log(chalk.dim('═'.repeat(60)));
|
|
206
|
+
console.log(`User: ${report.userId}`);
|
|
207
|
+
console.log(`Project: ${report.projectId}`);
|
|
208
|
+
console.log(`Period: ${report.period.start.toLocaleDateString()} - ${report.period.end.toLocaleDateString()} (${report.period.days} days)`);
|
|
209
|
+
console.log(`Generated: ${report.runAt.toLocaleString()}`);
|
|
210
|
+
console.log(chalk.dim('═'.repeat(60)));
|
|
211
|
+
console.log('');
|
|
212
|
+
// Category details
|
|
213
|
+
for (const categoryScore of report.categoryScores) {
|
|
214
|
+
const displayName = CATEGORY_DISPLAY_NAMES[categoryScore.category];
|
|
215
|
+
const categoryInsights = report.insights.filter(i => i.category === categoryScore.category);
|
|
216
|
+
if (categoryInsights.length === 0)
|
|
217
|
+
continue;
|
|
218
|
+
const scoreRating = getScoreRating(categoryScore.score);
|
|
219
|
+
console.log(chalk.cyan.bold(`${displayName}`) + chalk.dim(` | Score: `) + scoreRating.color(`${categoryScore.score}/100`));
|
|
220
|
+
console.log(chalk.dim('─'.repeat(50)));
|
|
221
|
+
for (const insight of categoryInsights) {
|
|
222
|
+
const icon = SEVERITY_ICONS[insight.severity];
|
|
223
|
+
const severityColor = getSeverityColor(insight.severity);
|
|
224
|
+
console.log(` ${icon} ${severityColor.bold(insight.title)}`);
|
|
225
|
+
console.log(` ${insight.description}`);
|
|
226
|
+
// Show metric if available
|
|
227
|
+
if (insight.metricValue !== undefined) {
|
|
228
|
+
const metricStr = `${insight.metricName}: ${insight.metricValue}${insight.metricUnit || ''}`;
|
|
229
|
+
const targetStr = insight.metricTarget !== undefined ? ` (target: ${insight.metricTarget}${insight.metricUnit || ''})` : '';
|
|
230
|
+
console.log(chalk.dim(` Metric: ${metricStr}${targetStr}`));
|
|
231
|
+
}
|
|
232
|
+
// Show evidence
|
|
233
|
+
if (insight.evidence.length > 0) {
|
|
234
|
+
console.log(chalk.dim(` Evidence:`));
|
|
235
|
+
for (const ev of insight.evidence.slice(0, 3)) {
|
|
236
|
+
console.log(chalk.dim(` - ${ev.description}`));
|
|
237
|
+
}
|
|
238
|
+
if (insight.evidence.length > 3) {
|
|
239
|
+
console.log(chalk.dim(` ... and ${insight.evidence.length - 3} more`));
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
// Show recommendations
|
|
243
|
+
if (insight.recommendations.length > 0) {
|
|
244
|
+
console.log(chalk.yellow.dim(` Recommendations:`));
|
|
245
|
+
for (const rec of insight.recommendations) {
|
|
246
|
+
console.log(chalk.yellow.dim(` - ${rec}`));
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
console.log('');
|
|
250
|
+
}
|
|
251
|
+
console.log('');
|
|
252
|
+
}
|
|
253
|
+
// Overall summary
|
|
254
|
+
console.log(chalk.dim('═'.repeat(60)));
|
|
255
|
+
const rating = getScoreRating(report.overallScore);
|
|
256
|
+
console.log(chalk.bold('Overall Score: ') + rating.color(`${report.overallScore}/100 (${rating.label})`));
|
|
257
|
+
console.log('');
|
|
258
|
+
console.log(chalk.bold('Summary: ') + report.summary);
|
|
259
|
+
console.log('');
|
|
260
|
+
// Score breakdown
|
|
261
|
+
console.log(chalk.bold('Category Breakdown:'));
|
|
262
|
+
for (const cs of report.categoryScores) {
|
|
263
|
+
const displayName = CATEGORY_DISPLAY_NAMES[cs.category];
|
|
264
|
+
const rating = getScoreRating(cs.score);
|
|
265
|
+
const bar = generateScoreBar(cs.score);
|
|
266
|
+
console.log(` ${displayName.padEnd(22)} ${bar} ${rating.color(String(cs.score).padStart(3))}`);
|
|
267
|
+
}
|
|
268
|
+
console.log('');
|
|
269
|
+
}
|
|
270
|
+
function outputJson(report) {
|
|
271
|
+
const output = {
|
|
272
|
+
...report,
|
|
273
|
+
runAt: report.runAt.toISOString(),
|
|
274
|
+
period: {
|
|
275
|
+
...report.period,
|
|
276
|
+
start: report.period.start.toISOString(),
|
|
277
|
+
end: report.period.end.toISOString(),
|
|
278
|
+
},
|
|
279
|
+
};
|
|
280
|
+
console.log(JSON.stringify(output, null, 2));
|
|
281
|
+
}
|
|
282
|
+
// ============================================================================
|
|
283
|
+
// Supabase Sync
|
|
284
|
+
// ============================================================================
|
|
285
|
+
async function syncToSupabase(report) {
|
|
286
|
+
console.log(chalk.dim('\nSyncing to Supabase...'));
|
|
287
|
+
// TODO: Implement Supabase sync when API is ready
|
|
288
|
+
// This would POST to the dashboard API endpoint:
|
|
289
|
+
// POST /api/v1/insights/sync
|
|
290
|
+
// {
|
|
291
|
+
// userId: report.userId,
|
|
292
|
+
// projectId: report.projectId,
|
|
293
|
+
// overallScore: report.overallScore,
|
|
294
|
+
// categoryScores: report.categoryScores,
|
|
295
|
+
// insights: report.insights,
|
|
296
|
+
// }
|
|
297
|
+
console.log(chalk.yellow('Supabase sync not yet implemented (requires API endpoint)'));
|
|
298
|
+
console.log(chalk.dim('Results saved locally only'));
|
|
299
|
+
}
|
|
300
|
+
// ============================================================================
|
|
301
|
+
// Helper Functions
|
|
302
|
+
// ============================================================================
|
|
303
|
+
function getScoreRating(score) {
|
|
304
|
+
for (const rating of SCORE_RATINGS) {
|
|
305
|
+
if (score >= rating.min) {
|
|
306
|
+
return rating;
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
return SCORE_RATINGS[SCORE_RATINGS.length - 1];
|
|
310
|
+
}
|
|
311
|
+
function getSeverityColor(severity) {
|
|
312
|
+
switch (severity) {
|
|
313
|
+
case 'critical':
|
|
314
|
+
return chalk.red;
|
|
315
|
+
case 'warning':
|
|
316
|
+
return chalk.yellow;
|
|
317
|
+
case 'suggestion':
|
|
318
|
+
return chalk.cyan;
|
|
319
|
+
case 'info':
|
|
320
|
+
default:
|
|
321
|
+
return chalk.white;
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
function generateScoreBar(score, width = 20) {
|
|
325
|
+
const filled = Math.round((score / 100) * width);
|
|
326
|
+
const empty = width - filled;
|
|
327
|
+
const rating = getScoreRating(score);
|
|
328
|
+
return rating.color('█'.repeat(filled)) + chalk.dim('░'.repeat(empty));
|
|
329
|
+
}
|
|
330
|
+
export default insightsCommand;
|
|
331
|
+
//# sourceMappingURL=insights-command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"insights-command.js","sourceRoot":"","sources":["../../../src/commands/insights/insights-command.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,WAAW,GAOZ,MAAM,6BAA6B,CAAC;AAcrC,+EAA+E;AAC/E,YAAY;AACZ,+EAA+E;AAE/E,M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AAG,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;AACzE,CAAC;AAED,eAAe,eAAe,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"start-reflection.d.ts","sourceRoot":"","sources":["../../../src/commands/start/start-reflection.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AA8BrE;;;GAGG;AACH,qBAAa,sBAAuB,SAAQ,iBAAiB;IAC3D,OAAO,CAAC,cAAc,CAAuB;;IAQ7C;;OAEG;IACH,OAAO,CAAC,WAAW;IAQnB;;;;OAIG;IACH,OAAO,CAAC,6BAA6B;IA8ErC;;OAEG;IACG,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,GAAE,GAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"start-reflection.d.ts","sourceRoot":"","sources":["../../../src/commands/start/start-reflection.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AA8BrE;;;GAGG;AACH,qBAAa,sBAAuB,SAAQ,iBAAiB;IAC3D,OAAO,CAAC,cAAc,CAAuB;;IAQ7C;;OAEG;IACH,OAAO,CAAC,WAAW;IAQnB;;;;OAIG;IACH,OAAO,CAAC,6BAA6B;IA8ErC;;OAEG;IACG,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,GAAE,GAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IA4Q/D;;;;;OAKG;YACW,kBAAkB;IA6VhC;;OAEG;IACG,YAAY,IAAI,OAAO,CAAC,GAAG,CAAC;IA+BlC;;OAEG;IACG,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,GAAG,OAAO,CAAC,MAAM,CAAC;IAsDlF;;OAEG;YACW,WAAW;IAuBzB;;OAEG;YACW,0BAA0B;IA2DxC;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAqB1B;;OAEG;YACW,aAAa;IAM3B;;OAEG;YACW,iBAAiB;IAU/B;;OAEG;YACW,WAAW;IAKzB;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAW5B;;OAEG;IACH,OAAO,CAAC,4BAA4B;IA6BpC;;OAEG;IACH,OAAO,CAAC,iBAAiB;IA4CzB;;OAEG;IACH,OAAO,CAAC,sBAAsB;IA2B9B;;OAEG;IACG,aAAa,CAAC,YAAY,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;IAmCpD;;OAEG;IACH,OAAO,CAAC,mBAAmB,CAAC,CAI1B;IAEF;;;;;OAKG;YACW,iBAAiB;IAwI/B;;;;;OAKG;YACW,cAAc;IAuI5B;;;;;OAKG;IACH,OAAO,CAAC,oBAAoB;IAM5B;;;;OAIG;YACW,cAAc;IAa5B;;OAEG;YACW,oBAAoB;CAqBnC;AAGD,eAAe,sBAAsB,CAAC"}
|
|
@@ -155,33 +155,70 @@ export class StartReflectionCommand extends ReflectionCommand {
|
|
|
155
155
|
const sessionDir = path.join(ginkoDir, 'sessions', userSlug);
|
|
156
156
|
const projectRoot = await getProjectRoot();
|
|
157
157
|
// Load sprint checklist for session context
|
|
158
|
-
//
|
|
159
|
-
//
|
|
158
|
+
// Strategy: Load both local and graph, use the more complete/current one
|
|
159
|
+
// Local file is authoritative for solo work; graph is authoritative for team collaboration
|
|
160
160
|
let sprintChecklist = null;
|
|
161
161
|
let sprintSource = 'local';
|
|
162
|
+
// Always load local sprint first (fast, authoritative for file-based workflows)
|
|
163
|
+
const localSprint = await loadSprintChecklist(projectRoot);
|
|
164
|
+
// Try to load from graph if authenticated
|
|
165
|
+
let graphSprint = null;
|
|
162
166
|
if (await isAuthenticated() && await isGraphInitialized()) {
|
|
163
167
|
try {
|
|
164
|
-
spinner.text = '
|
|
168
|
+
spinner.text = 'Checking graph for sprint updates...';
|
|
165
169
|
const graphId = await getGraphId();
|
|
166
170
|
if (graphId) {
|
|
167
171
|
const client = new GraphApiClient();
|
|
168
|
-
const
|
|
169
|
-
|
|
170
|
-
sprintChecklist = this.convertGraphSprintToChecklist(graphSprint);
|
|
171
|
-
sprintSource = 'graph';
|
|
172
|
-
spinner.text = `Sprint loaded from graph (${graphSprint.meta?.executionTime || 0}ms)`;
|
|
172
|
+
const graphResponse = await client.getActiveSprint(graphId);
|
|
173
|
+
graphSprint = this.convertGraphSprintToChecklist(graphResponse);
|
|
173
174
|
}
|
|
174
175
|
}
|
|
175
176
|
catch (error) {
|
|
176
|
-
// Graph unavailable -
|
|
177
|
-
spinner.text = 'Graph unavailable,
|
|
177
|
+
// Graph unavailable - use local only
|
|
178
|
+
spinner.text = 'Graph unavailable, using local sprint file';
|
|
178
179
|
}
|
|
179
180
|
}
|
|
180
|
-
//
|
|
181
|
-
|
|
182
|
-
|
|
181
|
+
// Compare and choose the more complete/current sprint
|
|
182
|
+
// Priority: Local file is source of truth - it represents what the user is actively working on
|
|
183
|
+
// Graph data may be stale (e.g., still showing Sprint 1 when user moved to Sprint 2)
|
|
184
|
+
if (localSprint && graphSprint) {
|
|
185
|
+
// If the sprints are different (different names), always use local
|
|
186
|
+
// This handles the case where graph hasn't been synced with new sprint
|
|
187
|
+
const localName = localSprint.name?.toLowerCase() || '';
|
|
188
|
+
const graphName = graphSprint.name?.toLowerCase() || '';
|
|
189
|
+
const sprintsAreDifferent = localName !== graphName &&
|
|
190
|
+
!localName.includes(graphName) &&
|
|
191
|
+
!graphName.includes(localName);
|
|
192
|
+
if (sprintsAreDifferent) {
|
|
193
|
+
// Local file is the source of truth for which sprint we're on
|
|
194
|
+
sprintChecklist = localSprint;
|
|
195
|
+
sprintSource = 'local';
|
|
196
|
+
}
|
|
197
|
+
else {
|
|
198
|
+
// Same sprint - prefer local if it has more tasks OR higher completion count
|
|
199
|
+
// This handles case where graph has stale/test data
|
|
200
|
+
const localTotal = localSprint.progress?.total || 0;
|
|
201
|
+
const graphTotal = graphSprint.progress?.total || 0;
|
|
202
|
+
const localProgress = localSprint.progress?.complete || 0;
|
|
203
|
+
const graphProgress = graphSprint.progress?.complete || 0;
|
|
204
|
+
if (localTotal > graphTotal || localProgress > graphProgress) {
|
|
205
|
+
sprintChecklist = localSprint;
|
|
206
|
+
sprintSource = 'local';
|
|
207
|
+
}
|
|
208
|
+
else {
|
|
209
|
+
sprintChecklist = graphSprint;
|
|
210
|
+
sprintSource = 'graph';
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
else if (localSprint) {
|
|
215
|
+
sprintChecklist = localSprint;
|
|
183
216
|
sprintSource = 'local';
|
|
184
217
|
}
|
|
218
|
+
else if (graphSprint) {
|
|
219
|
+
sprintChecklist = graphSprint;
|
|
220
|
+
sprintSource = 'graph';
|
|
221
|
+
}
|
|
185
222
|
// Load session log content before archiving
|
|
186
223
|
const previousSessionLog = await SessionLogManager.loadSessionLog(sessionDir);
|
|
187
224
|
const hasLog = previousSessionLog.length > 100; // Non-empty log
|