@hyperdrive.bot/gut 0.1.4 → 0.1.6
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 +1 -779
- package/bin/run.js +5 -0
- package/package.json +10 -10
- package/bin/run +0 -5
- package/dist/base-command.d.ts +0 -21
- package/dist/base-command.js +0 -110
- package/dist/commands/add.d.ts +0 -13
- package/dist/commands/add.js +0 -73
- package/dist/commands/affected.d.ts +0 -23
- package/dist/commands/affected.js +0 -326
- package/dist/commands/audit.d.ts +0 -33
- package/dist/commands/audit.js +0 -593
- package/dist/commands/back.d.ts +0 -6
- package/dist/commands/back.js +0 -29
- package/dist/commands/commit.d.ts +0 -11
- package/dist/commands/commit.js +0 -113
- package/dist/commands/context.d.ts +0 -6
- package/dist/commands/context.js +0 -36
- package/dist/commands/contexts.d.ts +0 -7
- package/dist/commands/contexts.js +0 -92
- package/dist/commands/deps.d.ts +0 -10
- package/dist/commands/deps.js +0 -104
- package/dist/commands/entity/add.d.ts +0 -16
- package/dist/commands/entity/add.js +0 -105
- package/dist/commands/entity/clone-all.d.ts +0 -17
- package/dist/commands/entity/clone-all.js +0 -135
- package/dist/commands/entity/clone.d.ts +0 -15
- package/dist/commands/entity/clone.js +0 -109
- package/dist/commands/entity/list.d.ts +0 -11
- package/dist/commands/entity/list.js +0 -82
- package/dist/commands/entity/remove.d.ts +0 -12
- package/dist/commands/entity/remove.js +0 -58
- package/dist/commands/focus.d.ts +0 -19
- package/dist/commands/focus.js +0 -139
- package/dist/commands/graph.d.ts +0 -18
- package/dist/commands/graph.js +0 -238
- package/dist/commands/init.d.ts +0 -11
- package/dist/commands/init.js +0 -84
- package/dist/commands/insights.d.ts +0 -21
- package/dist/commands/insights.js +0 -434
- package/dist/commands/patterns.d.ts +0 -40
- package/dist/commands/patterns.js +0 -412
- package/dist/commands/pull.d.ts +0 -11
- package/dist/commands/pull.js +0 -121
- package/dist/commands/push.d.ts +0 -11
- package/dist/commands/push.js +0 -101
- package/dist/commands/quick-setup.d.ts +0 -20
- package/dist/commands/quick-setup.js +0 -422
- package/dist/commands/recent.d.ts +0 -9
- package/dist/commands/recent.js +0 -55
- package/dist/commands/related.d.ts +0 -23
- package/dist/commands/related.js +0 -257
- package/dist/commands/repos.d.ts +0 -14
- package/dist/commands/repos.js +0 -185
- package/dist/commands/stack.d.ts +0 -10
- package/dist/commands/stack.js +0 -83
- package/dist/commands/status.d.ts +0 -14
- package/dist/commands/status.js +0 -246
- package/dist/commands/sync.d.ts +0 -11
- package/dist/commands/sync.js +0 -142
- package/dist/commands/unfocus.d.ts +0 -6
- package/dist/commands/unfocus.js +0 -23
- package/dist/commands/used-by.d.ts +0 -10
- package/dist/commands/used-by.js +0 -111
- package/dist/commands/workspace.d.ts +0 -20
- package/dist/commands/workspace.js +0 -365
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -5
- package/dist/models/entity.model.d.ts +0 -81
- package/dist/models/entity.model.js +0 -2
- package/dist/services/config.service.d.ts +0 -34
- package/dist/services/config.service.js +0 -230
- package/dist/services/entity.service.d.ts +0 -19
- package/dist/services/entity.service.js +0 -130
- package/dist/services/focus.service.d.ts +0 -70
- package/dist/services/focus.service.js +0 -587
- package/dist/services/git.service.d.ts +0 -37
- package/dist/services/git.service.js +0 -180
- package/dist/utils/display.d.ts +0 -25
- package/dist/utils/display.js +0 -150
- package/dist/utils/filesystem.d.ts +0 -32
- package/dist/utils/filesystem.js +0 -220
- package/dist/utils/index.d.ts +0 -13
- package/dist/utils/index.js +0 -18
- package/dist/utils/validation.d.ts +0 -22
- package/dist/utils/validation.js +0 -196
- package/oclif.manifest.json +0 -1463
|
@@ -1,587 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FocusService = void 0;
|
|
4
|
-
const entity_service_1 = require("./entity.service");
|
|
5
|
-
class FocusService {
|
|
6
|
-
configService;
|
|
7
|
-
entityService;
|
|
8
|
-
focusStack = [];
|
|
9
|
-
constructor(configService) {
|
|
10
|
-
this.configService = configService;
|
|
11
|
-
this.entityService = new entity_service_1.EntityService(configService);
|
|
12
|
-
}
|
|
13
|
-
async getCurrentFocus() {
|
|
14
|
-
return this.configService.getFocus();
|
|
15
|
-
}
|
|
16
|
-
async getFocusedEntities() {
|
|
17
|
-
const focus = await this.getCurrentFocus();
|
|
18
|
-
if (!focus)
|
|
19
|
-
return [];
|
|
20
|
-
// Handle multi-entity focus
|
|
21
|
-
if (focus.entities && focus.entities.length > 0) {
|
|
22
|
-
return focus.entities;
|
|
23
|
-
}
|
|
24
|
-
// Handle single entity focus (backward compatibility)
|
|
25
|
-
const entity = this.entityService.findEntity(focus.name);
|
|
26
|
-
return entity ? [entity] : [];
|
|
27
|
-
}
|
|
28
|
-
async setFocus(entityNames, options = {}) {
|
|
29
|
-
if (entityNames.length === 0) {
|
|
30
|
-
throw new Error('No entities specified');
|
|
31
|
-
}
|
|
32
|
-
const entities = [];
|
|
33
|
-
for (const name of entityNames) {
|
|
34
|
-
let entity = this.entityService.findEntity(name);
|
|
35
|
-
// If entity not found and we have a type, try to find by type + name
|
|
36
|
-
if (!entity && options.entityType) {
|
|
37
|
-
entity = this.entityService.findEntityByTypeAndName(options.entityType, name);
|
|
38
|
-
}
|
|
39
|
-
if (!entity) {
|
|
40
|
-
// If still not found, suggest creating it
|
|
41
|
-
const suggestion = options.entityType
|
|
42
|
-
? `Try: gut entity add ${name} ${options.entityType} <path>`
|
|
43
|
-
: `Try: gut entity add ${name} <type> <path>`;
|
|
44
|
-
throw new Error(`Entity '${name}' not found. ${suggestion}`);
|
|
45
|
-
}
|
|
46
|
-
entities.push(entity);
|
|
47
|
-
}
|
|
48
|
-
const focus = {
|
|
49
|
-
type: entities.length === 1 ? entities[0].type : 'multiple',
|
|
50
|
-
name: entities.length === 1 ? entities[0].name : entities.map(e => e.name).join(', '),
|
|
51
|
-
path: entities.length === 1 ? entities[0].path : '.',
|
|
52
|
-
timestamp: Date.now(),
|
|
53
|
-
entities: entities,
|
|
54
|
-
mode: options.mode,
|
|
55
|
-
duration: options.duration
|
|
56
|
-
};
|
|
57
|
-
// Generate focus context for AI
|
|
58
|
-
await this.generateFocusContext(focus);
|
|
59
|
-
this.configService.saveFocus(focus);
|
|
60
|
-
}
|
|
61
|
-
async addToFocus(entityNames, options = {}) {
|
|
62
|
-
const currentFocus = await this.getCurrentFocus();
|
|
63
|
-
const currentEntities = await this.getFocusedEntities();
|
|
64
|
-
const newEntities = [];
|
|
65
|
-
for (const name of entityNames) {
|
|
66
|
-
// Skip if already in focus
|
|
67
|
-
if (currentEntities.some(e => e.name === name)) {
|
|
68
|
-
continue;
|
|
69
|
-
}
|
|
70
|
-
let entity = this.entityService.findEntity(name);
|
|
71
|
-
// If entity not found and we have a type, try to find by type + name
|
|
72
|
-
if (!entity && options.entityType) {
|
|
73
|
-
entity = this.entityService.findEntityByTypeAndName(options.entityType, name);
|
|
74
|
-
}
|
|
75
|
-
if (!entity) {
|
|
76
|
-
const suggestion = options.entityType
|
|
77
|
-
? `Try: gut entity add ${name} ${options.entityType} <path>`
|
|
78
|
-
: `Try: gut entity add ${name} <type> <path>`;
|
|
79
|
-
throw new Error(`Entity '${name}' not found. ${suggestion}`);
|
|
80
|
-
}
|
|
81
|
-
newEntities.push(entity);
|
|
82
|
-
}
|
|
83
|
-
if (newEntities.length === 0) {
|
|
84
|
-
throw new Error('All specified entities are already in focus');
|
|
85
|
-
}
|
|
86
|
-
const allEntities = [...currentEntities, ...newEntities];
|
|
87
|
-
const focus = {
|
|
88
|
-
type: allEntities.length === 1 ? allEntities[0].type : 'multiple',
|
|
89
|
-
name: allEntities.map(e => e.name).join(', '),
|
|
90
|
-
path: allEntities.length === 1 ? allEntities[0].path : '.',
|
|
91
|
-
timestamp: Date.now(),
|
|
92
|
-
entities: allEntities,
|
|
93
|
-
mode: options.mode || currentFocus?.mode,
|
|
94
|
-
duration: options.duration || currentFocus?.duration
|
|
95
|
-
};
|
|
96
|
-
// Generate focus context for AI
|
|
97
|
-
await this.generateFocusContext(focus);
|
|
98
|
-
this.configService.saveFocus(focus);
|
|
99
|
-
}
|
|
100
|
-
async clearFocus() {
|
|
101
|
-
const currentFocus = await this.getCurrentFocus();
|
|
102
|
-
if (currentFocus) {
|
|
103
|
-
// Save to history before clearing
|
|
104
|
-
this.configService.addToHistory(currentFocus);
|
|
105
|
-
}
|
|
106
|
-
this.configService.saveFocus(null);
|
|
107
|
-
}
|
|
108
|
-
async switchToPrevious() {
|
|
109
|
-
const history = this.configService.getHistory();
|
|
110
|
-
if (history.length < 2) {
|
|
111
|
-
throw new Error('No previous focus in history');
|
|
112
|
-
}
|
|
113
|
-
const previousEntry = history[1]; // Second entry is the previous (first is current)
|
|
114
|
-
// Set focus to the previous entities
|
|
115
|
-
await this.setFocus(previousEntry.entities);
|
|
116
|
-
}
|
|
117
|
-
getRecentFocus(limit = 5) {
|
|
118
|
-
const history = this.configService.getHistory();
|
|
119
|
-
return history.slice(-limit).reverse();
|
|
120
|
-
}
|
|
121
|
-
async isFocused(entityName) {
|
|
122
|
-
const focusedEntities = await this.getFocusedEntities();
|
|
123
|
-
return focusedEntities.some(e => e.name === entityName);
|
|
124
|
-
}
|
|
125
|
-
async getFocusDescription() {
|
|
126
|
-
const focus = await this.getCurrentFocus();
|
|
127
|
-
if (!focus)
|
|
128
|
-
return 'No focus set';
|
|
129
|
-
const entities = await this.getFocusedEntities();
|
|
130
|
-
if (entities.length === 0)
|
|
131
|
-
return 'Invalid focus';
|
|
132
|
-
if (entities.length === 1) {
|
|
133
|
-
const modeText = focus.mode ? ` (${focus.mode})` : '';
|
|
134
|
-
return `${entities[0].name} (${entities[0].type})${modeText}`;
|
|
135
|
-
}
|
|
136
|
-
const modeText = focus.mode ? ` (${focus.mode})` : '';
|
|
137
|
-
return `${entities.length} entities: ${entities.map(e => e.name).join(', ')}${modeText}`;
|
|
138
|
-
}
|
|
139
|
-
async pushFocusToStack() {
|
|
140
|
-
const currentFocus = await this.getCurrentFocus();
|
|
141
|
-
if (currentFocus) {
|
|
142
|
-
this.focusStack.push(currentFocus);
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
async popFocusFromStack() {
|
|
146
|
-
return this.focusStack.pop() || null;
|
|
147
|
-
}
|
|
148
|
-
getFocusStack() {
|
|
149
|
-
return [...this.focusStack];
|
|
150
|
-
}
|
|
151
|
-
async generateFocusContext(focus) {
|
|
152
|
-
const context = {
|
|
153
|
-
current_focus: focus,
|
|
154
|
-
entity_type: focus.entities?.[0]?.type,
|
|
155
|
-
entity_name: focus.entities?.[0]?.name,
|
|
156
|
-
mode: focus.mode,
|
|
157
|
-
duration: focus.duration,
|
|
158
|
-
start_time: new Date().toISOString(),
|
|
159
|
-
ai_context: await this.generateAIContext(focus)
|
|
160
|
-
};
|
|
161
|
-
// Save context to focus/context.yaml
|
|
162
|
-
await this.configService.saveFocusContext(context);
|
|
163
|
-
}
|
|
164
|
-
async generateAIContext(focus) {
|
|
165
|
-
if (!focus.entities || focus.entities.length === 0) {
|
|
166
|
-
return {};
|
|
167
|
-
}
|
|
168
|
-
const primaryEntity = focus.entities[0];
|
|
169
|
-
const persona = this.getPersonaForMode(focus.mode, primaryEntity.type);
|
|
170
|
-
// Enhanced context with learning and adaptation
|
|
171
|
-
const context = {
|
|
172
|
-
persona,
|
|
173
|
-
knowledge_scope: this.getKnowledgeScopeForMode(focus.mode, primaryEntity),
|
|
174
|
-
available_data: await this.getAvailableDataForEntity(primaryEntity),
|
|
175
|
-
suggested_actions: await this.getSuggestedActionsForMode(focus.mode, primaryEntity),
|
|
176
|
-
restricted_knowledge: this.getRestrictedKnowledgeForMode(focus.mode, primaryEntity.type),
|
|
177
|
-
// Enhanced AI features
|
|
178
|
-
context_intelligence: await this.generateContextIntelligence(focus),
|
|
179
|
-
learning_insights: await this.generateLearningInsights(primaryEntity),
|
|
180
|
-
adaptive_suggestions: await this.generateAdaptiveSuggestions(focus),
|
|
181
|
-
collaboration_context: await this.generateCollaborationContext(primaryEntity),
|
|
182
|
-
performance_context: await this.generatePerformanceContext(focus)
|
|
183
|
-
};
|
|
184
|
-
return context;
|
|
185
|
-
}
|
|
186
|
-
getPersonaForMode(mode, entityType) {
|
|
187
|
-
if (!mode)
|
|
188
|
-
return 'general_developer';
|
|
189
|
-
const personas = {
|
|
190
|
-
delivery: {
|
|
191
|
-
client: 'senior_developer_client_delivery',
|
|
192
|
-
prospect: 'technical_consultant_prospect_analysis',
|
|
193
|
-
company: 'internal_systems_developer',
|
|
194
|
-
initiative: 'project_technical_lead',
|
|
195
|
-
system: 'systems_architect',
|
|
196
|
-
delivery: 'senior_developer',
|
|
197
|
-
module: 'module_developer',
|
|
198
|
-
service: 'service_developer',
|
|
199
|
-
tool: 'tools_developer'
|
|
200
|
-
},
|
|
201
|
-
strategy: {
|
|
202
|
-
client: 'ceo_strategic_advisor',
|
|
203
|
-
prospect: 'business_development_strategist',
|
|
204
|
-
company: 'executive_strategic_planner',
|
|
205
|
-
initiative: 'strategic_initiative_leader',
|
|
206
|
-
system: 'technical_strategy_architect',
|
|
207
|
-
delivery: 'delivery_strategy_consultant',
|
|
208
|
-
module: 'module_strategy_architect',
|
|
209
|
-
service: 'service_strategy_consultant',
|
|
210
|
-
tool: 'tools_strategy_planner'
|
|
211
|
-
},
|
|
212
|
-
audit: {
|
|
213
|
-
client: 'business_auditor',
|
|
214
|
-
prospect: 'due_diligence_analyst',
|
|
215
|
-
company: 'internal_auditor',
|
|
216
|
-
initiative: 'project_auditor',
|
|
217
|
-
system: 'technical_auditor',
|
|
218
|
-
delivery: 'delivery_auditor',
|
|
219
|
-
module: 'module_auditor',
|
|
220
|
-
service: 'service_auditor',
|
|
221
|
-
tool: 'tools_auditor'
|
|
222
|
-
}
|
|
223
|
-
};
|
|
224
|
-
return personas[mode]?.[entityType] || 'general_consultant';
|
|
225
|
-
}
|
|
226
|
-
getKnowledgeScopeForMode(mode, entity) {
|
|
227
|
-
const baseScope = [`${entity.name}_complete_context`];
|
|
228
|
-
if (!mode)
|
|
229
|
-
return baseScope;
|
|
230
|
-
const modeScopes = {
|
|
231
|
-
delivery: ['technical_implementation', 'code_architecture', 'development_patterns'],
|
|
232
|
-
strategy: ['business_context', 'strategic_planning', 'cross_entity_insights'],
|
|
233
|
-
audit: ['compliance_requirements', 'security_analysis', 'performance_metrics'],
|
|
234
|
-
debug: ['error_analysis', 'system_diagnostics', 'troubleshooting_patterns'],
|
|
235
|
-
research: ['market_analysis', 'competitive_intelligence', 'technology_research'],
|
|
236
|
-
proposal: ['business_proposals', 'technical_specifications', 'pricing_strategy']
|
|
237
|
-
};
|
|
238
|
-
return [...baseScope, ...(modeScopes[mode] || [])];
|
|
239
|
-
}
|
|
240
|
-
async getAvailableDataForEntity(entity) {
|
|
241
|
-
const entityPath = this.configService.getWorkspaceRoot();
|
|
242
|
-
// Enhanced data collection
|
|
243
|
-
const data = {
|
|
244
|
-
entity_metadata: entity.metadata || {},
|
|
245
|
-
recent_activity: await this.getRecentActivity(entity),
|
|
246
|
-
team_members: await this.getTeamMembers(entity),
|
|
247
|
-
performance_metrics: await this.getPerformanceMetrics(entity),
|
|
248
|
-
// Additional context data
|
|
249
|
-
related_entities: await this.getRelatedEntities(entity),
|
|
250
|
-
recent_patterns: await this.getRecentPatterns(entity),
|
|
251
|
-
business_context: await this.getBusinessContext(entity),
|
|
252
|
-
technical_context: await this.getTechnicalContext(entity)
|
|
253
|
-
};
|
|
254
|
-
return data;
|
|
255
|
-
}
|
|
256
|
-
async getSuggestedActionsForMode(mode, entity) {
|
|
257
|
-
if (!mode)
|
|
258
|
-
return [`Review ${entity.name} status`];
|
|
259
|
-
const actionSuggestions = {
|
|
260
|
-
delivery: [
|
|
261
|
-
`Review ${entity.name} development progress`,
|
|
262
|
-
'Check for pending code reviews',
|
|
263
|
-
'Update technical documentation'
|
|
264
|
-
],
|
|
265
|
-
strategy: [
|
|
266
|
-
`Analyze ${entity.name} business performance`,
|
|
267
|
-
'Review strategic objectives',
|
|
268
|
-
'Plan next quarter initiatives'
|
|
269
|
-
],
|
|
270
|
-
audit: [
|
|
271
|
-
`Audit ${entity.name} compliance status`,
|
|
272
|
-
'Review security measures',
|
|
273
|
-
'Analyze performance metrics'
|
|
274
|
-
],
|
|
275
|
-
debug: [
|
|
276
|
-
`Investigate ${entity.name} issues`,
|
|
277
|
-
'Check error logs and monitoring',
|
|
278
|
-
'Review system diagnostics'
|
|
279
|
-
],
|
|
280
|
-
research: [
|
|
281
|
-
`Research ${entity.name} market position`,
|
|
282
|
-
'Analyze competitive landscape',
|
|
283
|
-
'Evaluate new technologies'
|
|
284
|
-
],
|
|
285
|
-
proposal: [
|
|
286
|
-
`Prepare ${entity.name} proposal materials`,
|
|
287
|
-
'Update pricing and scope',
|
|
288
|
-
'Review client requirements'
|
|
289
|
-
]
|
|
290
|
-
};
|
|
291
|
-
return actionSuggestions[mode] || [];
|
|
292
|
-
}
|
|
293
|
-
getRestrictedKnowledgeForMode(mode, entityType) {
|
|
294
|
-
// Define what knowledge should be restricted based on mode and entity type
|
|
295
|
-
const restrictions = {
|
|
296
|
-
'delivery-client': [], // Full access for client delivery work
|
|
297
|
-
'strategy-client': [], // Full access for client strategy work
|
|
298
|
-
'audit-client': [], // Full access for client audit work
|
|
299
|
-
'delivery-prospect': ['financial_details', 'internal_costs'], // Limited financial access for prospects
|
|
300
|
-
'research-prospect': ['internal_strategies', 'competitive_pricing'] // Limited strategic access for research
|
|
301
|
-
};
|
|
302
|
-
const key = mode && entityType ? `${mode}-${entityType}` : 'default';
|
|
303
|
-
return restrictions[key] || [];
|
|
304
|
-
}
|
|
305
|
-
// Enhanced AI Context Methods
|
|
306
|
-
async generateContextIntelligence(focus) {
|
|
307
|
-
const primaryEntity = focus.entities?.[0];
|
|
308
|
-
if (!primaryEntity)
|
|
309
|
-
return {};
|
|
310
|
-
return {
|
|
311
|
-
context_type: this.determineContextType(focus),
|
|
312
|
-
complexity_level: await this.assessComplexity(primaryEntity),
|
|
313
|
-
estimated_duration: this.estimateFocusDuration(focus),
|
|
314
|
-
interruption_likelihood: await this.assessInterruptionRisk(focus),
|
|
315
|
-
success_probability: await this.assessSuccessProbability(focus),
|
|
316
|
-
recommended_approach: await this.getRecommendedApproach(focus)
|
|
317
|
-
};
|
|
318
|
-
}
|
|
319
|
-
async generateLearningInsights(entity) {
|
|
320
|
-
return {
|
|
321
|
-
historical_patterns: await this.getHistoricalPatterns(entity),
|
|
322
|
-
similar_entity_lessons: await this.getSimilarEntityLessons(entity),
|
|
323
|
-
common_pitfalls: await this.getCommonPitfalls(entity),
|
|
324
|
-
success_factors: await this.getSuccessFactors(entity),
|
|
325
|
-
learning_opportunities: await this.getLearningOpportunities(entity)
|
|
326
|
-
};
|
|
327
|
-
}
|
|
328
|
-
async generateAdaptiveSuggestions(focus) {
|
|
329
|
-
const primaryEntity = focus.entities?.[0];
|
|
330
|
-
if (!primaryEntity)
|
|
331
|
-
return {};
|
|
332
|
-
const timeOfDay = new Date().getHours();
|
|
333
|
-
const dayOfWeek = new Date().getDay();
|
|
334
|
-
return {
|
|
335
|
-
time_based_suggestions: this.getTimeBasedSuggestions(timeOfDay, focus.mode),
|
|
336
|
-
day_based_suggestions: this.getDayBasedSuggestions(dayOfWeek, focus.mode),
|
|
337
|
-
context_specific_tips: await this.getContextSpecificTips(focus),
|
|
338
|
-
productivity_optimizations: await this.getProductivityOptimizations(focus),
|
|
339
|
-
workflow_suggestions: await this.getWorkflowSuggestions(primaryEntity, focus.mode)
|
|
340
|
-
};
|
|
341
|
-
}
|
|
342
|
-
async generateCollaborationContext(entity) {
|
|
343
|
-
return {
|
|
344
|
-
team_members: await this.getActiveTeamMembers(entity),
|
|
345
|
-
collaboration_patterns: await this.getCollaborationPatterns(entity),
|
|
346
|
-
communication_preferences: await this.getCommunicationPreferences(entity),
|
|
347
|
-
shared_resources: await this.getSharedResources(entity),
|
|
348
|
-
coordination_needs: await this.getCoordinationNeeds(entity)
|
|
349
|
-
};
|
|
350
|
-
}
|
|
351
|
-
async generatePerformanceContext(focus) {
|
|
352
|
-
return {
|
|
353
|
-
current_velocity: await this.getCurrentVelocity(focus),
|
|
354
|
-
performance_trends: await this.getPerformanceTrends(focus),
|
|
355
|
-
bottlenecks: await this.identifyBottlenecks(focus),
|
|
356
|
-
optimization_opportunities: await this.getOptimizationOpportunities(focus),
|
|
357
|
-
benchmarks: await this.getBenchmarks(focus)
|
|
358
|
-
};
|
|
359
|
-
}
|
|
360
|
-
// Helper methods for enhanced context
|
|
361
|
-
async getRecentActivity(entity) {
|
|
362
|
-
// Would integrate with git service to get actual activity
|
|
363
|
-
return {
|
|
364
|
-
commits_last_week: 12,
|
|
365
|
-
files_changed: 8,
|
|
366
|
-
last_commit: '2 hours ago',
|
|
367
|
-
active_branches: ['feature/new-ui', 'bugfix/auth-issue']
|
|
368
|
-
};
|
|
369
|
-
}
|
|
370
|
-
async getTeamMembers(entity) {
|
|
371
|
-
// Would integrate with team management system
|
|
372
|
-
return {
|
|
373
|
-
active_contributors: ['Alice', 'Bob', 'Charlie'],
|
|
374
|
-
recent_collaborators: ['Alice', 'Bob'],
|
|
375
|
-
expertise_areas: {
|
|
376
|
-
'Alice': ['frontend', 'ui/ux'],
|
|
377
|
-
'Bob': ['backend', 'api'],
|
|
378
|
-
'Charlie': ['devops', 'infrastructure']
|
|
379
|
-
}
|
|
380
|
-
};
|
|
381
|
-
}
|
|
382
|
-
async getPerformanceMetrics(entity) {
|
|
383
|
-
// Would integrate with actual metrics
|
|
384
|
-
return {
|
|
385
|
-
velocity: '85%',
|
|
386
|
-
quality_score: '92/100',
|
|
387
|
-
technical_debt: 'low',
|
|
388
|
-
test_coverage: '78%',
|
|
389
|
-
deployment_frequency: '2x/week'
|
|
390
|
-
};
|
|
391
|
-
}
|
|
392
|
-
async getRelatedEntities(entity) {
|
|
393
|
-
const allEntities = this.entityService.getAllEntities();
|
|
394
|
-
const related = allEntities.filter(e => e.metadata?.relationships?.similar_entities?.includes(entity.name) ||
|
|
395
|
-
e.metadata?.relationships?.dependent_systems?.includes(entity.name));
|
|
396
|
-
return related.map(e => ({
|
|
397
|
-
name: e.name,
|
|
398
|
-
type: e.type,
|
|
399
|
-
relationship: 'similar' // Would determine actual relationship
|
|
400
|
-
}));
|
|
401
|
-
}
|
|
402
|
-
async getRecentPatterns(entity) {
|
|
403
|
-
return {
|
|
404
|
-
frequent_files: ['src/components/', 'docs/', 'tests/'],
|
|
405
|
-
common_commit_patterns: ['feature', 'bugfix', 'refactor'],
|
|
406
|
-
work_rhythms: ['morning_coding', 'afternoon_reviews'],
|
|
407
|
-
collaboration_patterns: ['pair_programming', 'code_reviews']
|
|
408
|
-
};
|
|
409
|
-
}
|
|
410
|
-
async getBusinessContext(entity) {
|
|
411
|
-
const metadata = entity.metadata?.business || {};
|
|
412
|
-
return {
|
|
413
|
-
priority: metadata.priority || 'medium',
|
|
414
|
-
status: metadata.status || 'active',
|
|
415
|
-
contract_value: metadata.contract_value,
|
|
416
|
-
team_size: metadata.team_size,
|
|
417
|
-
client_satisfaction: 'high', // Would come from actual data
|
|
418
|
-
business_impact: 'medium' // Would be calculated
|
|
419
|
-
};
|
|
420
|
-
}
|
|
421
|
-
async getTechnicalContext(entity) {
|
|
422
|
-
return {
|
|
423
|
-
tech_stack: ['React', 'TypeScript', 'Node.js'], // Would be detected
|
|
424
|
-
architecture_patterns: ['component-based', 'microservices'],
|
|
425
|
-
deployment_status: 'production',
|
|
426
|
-
performance_status: 'good',
|
|
427
|
-
security_status: 'compliant'
|
|
428
|
-
};
|
|
429
|
-
}
|
|
430
|
-
// Context intelligence helpers
|
|
431
|
-
determineContextType(focus) {
|
|
432
|
-
if (focus.entities && focus.entities.length > 1)
|
|
433
|
-
return 'multi_entity';
|
|
434
|
-
if (focus.mode === 'strategy')
|
|
435
|
-
return 'strategic';
|
|
436
|
-
if (focus.mode === 'delivery')
|
|
437
|
-
return 'tactical';
|
|
438
|
-
return 'general';
|
|
439
|
-
}
|
|
440
|
-
async assessComplexity(entity) {
|
|
441
|
-
// Would analyze actual complexity metrics
|
|
442
|
-
const metadata = entity.metadata || {};
|
|
443
|
-
const hasBusinessData = !!metadata.business;
|
|
444
|
-
const hasRelationships = !!metadata.relationships;
|
|
445
|
-
if (hasBusinessData && hasRelationships)
|
|
446
|
-
return 'high';
|
|
447
|
-
if (hasBusinessData || hasRelationships)
|
|
448
|
-
return 'medium';
|
|
449
|
-
return 'low';
|
|
450
|
-
}
|
|
451
|
-
estimateFocusDuration(focus) {
|
|
452
|
-
const mode = focus.mode;
|
|
453
|
-
const durations = {
|
|
454
|
-
delivery: '90 minutes',
|
|
455
|
-
strategy: '2-3 hours',
|
|
456
|
-
audit: '60-90 minutes',
|
|
457
|
-
debug: '45-60 minutes',
|
|
458
|
-
research: '1-2 hours',
|
|
459
|
-
proposal: '2-4 hours'
|
|
460
|
-
};
|
|
461
|
-
return durations[mode || 'delivery'] || '1 hour';
|
|
462
|
-
}
|
|
463
|
-
async assessInterruptionRisk(focus) {
|
|
464
|
-
const timeOfDay = new Date().getHours();
|
|
465
|
-
const mode = focus.mode;
|
|
466
|
-
// Higher risk during business hours for strategic work
|
|
467
|
-
if (mode === 'strategy' && timeOfDay >= 9 && timeOfDay <= 17)
|
|
468
|
-
return 'high';
|
|
469
|
-
if (timeOfDay >= 14 && timeOfDay <= 16)
|
|
470
|
-
return 'medium'; // Meeting hours
|
|
471
|
-
return 'low';
|
|
472
|
-
}
|
|
473
|
-
async assessSuccessProbability(focus) {
|
|
474
|
-
// Would use actual success rate data
|
|
475
|
-
const mode = focus.mode;
|
|
476
|
-
const successRates = {
|
|
477
|
-
delivery: '85%',
|
|
478
|
-
strategy: '75%',
|
|
479
|
-
audit: '90%',
|
|
480
|
-
debug: '70%',
|
|
481
|
-
research: '80%',
|
|
482
|
-
proposal: '65%'
|
|
483
|
-
};
|
|
484
|
-
return successRates[mode || 'delivery'] || '75%';
|
|
485
|
-
}
|
|
486
|
-
async getRecommendedApproach(focus) {
|
|
487
|
-
const mode = focus.mode;
|
|
488
|
-
const approaches = {
|
|
489
|
-
delivery: ['Start with tests', 'Small incremental changes', 'Regular commits'],
|
|
490
|
-
strategy: ['Gather all context first', 'Think before acting', 'Document decisions'],
|
|
491
|
-
audit: ['Systematic review', 'Checklist approach', 'Document findings'],
|
|
492
|
-
debug: ['Reproduce issue first', 'Isolate variables', 'Test fixes thoroughly']
|
|
493
|
-
};
|
|
494
|
-
return approaches[mode || 'delivery'] || ['Focus on one thing at a time'];
|
|
495
|
-
}
|
|
496
|
-
// Additional helper methods (simplified implementations)
|
|
497
|
-
async getHistoricalPatterns(entity) {
|
|
498
|
-
return { success_rate: '85%', common_issues: ['scope_creep', 'technical_debt'] };
|
|
499
|
-
}
|
|
500
|
-
async getSimilarEntityLessons(entity) {
|
|
501
|
-
return { lessons: ['Start with MVP', 'Regular client communication'] };
|
|
502
|
-
}
|
|
503
|
-
async getCommonPitfalls(entity) {
|
|
504
|
-
return { pitfalls: ['Over-engineering', 'Insufficient testing', 'Poor documentation'] };
|
|
505
|
-
}
|
|
506
|
-
async getSuccessFactors(entity) {
|
|
507
|
-
return { factors: ['Clear requirements', 'Regular feedback', 'Good team communication'] };
|
|
508
|
-
}
|
|
509
|
-
async getLearningOpportunities(entity) {
|
|
510
|
-
return { opportunities: ['New technology adoption', 'Process improvement', 'Skill development'] };
|
|
511
|
-
}
|
|
512
|
-
getTimeBasedSuggestions(hour, mode) {
|
|
513
|
-
if (hour >= 9 && hour <= 11)
|
|
514
|
-
return ['Peak focus time - tackle complex tasks'];
|
|
515
|
-
if (hour >= 14 && hour <= 16)
|
|
516
|
-
return ['Post-lunch dip - consider lighter tasks'];
|
|
517
|
-
if (hour >= 16 && hour <= 18)
|
|
518
|
-
return ['Good time for reviews and planning'];
|
|
519
|
-
return ['Adjust work intensity based on energy levels'];
|
|
520
|
-
}
|
|
521
|
-
getDayBasedSuggestions(day, mode) {
|
|
522
|
-
const days = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
|
|
523
|
-
if (day === 1)
|
|
524
|
-
return ['Monday - good for planning and goal setting'];
|
|
525
|
-
if (day === 5)
|
|
526
|
-
return ['Friday - good for reviews and documentation'];
|
|
527
|
-
return [`${days[day]} - maintain steady progress`];
|
|
528
|
-
}
|
|
529
|
-
async getContextSpecificTips(focus) {
|
|
530
|
-
const mode = focus.mode;
|
|
531
|
-
const tips = {
|
|
532
|
-
delivery: ['Use TDD approach', 'Commit frequently', 'Write clear commit messages'],
|
|
533
|
-
strategy: ['Take breaks to think', 'Consider multiple perspectives', 'Document assumptions'],
|
|
534
|
-
audit: ['Be thorough but efficient', 'Use checklists', 'Focus on high-impact issues']
|
|
535
|
-
};
|
|
536
|
-
return tips[mode || 'delivery'] || ['Stay focused on the goal'];
|
|
537
|
-
}
|
|
538
|
-
async getProductivityOptimizations(focus) {
|
|
539
|
-
return [
|
|
540
|
-
'Minimize context switching',
|
|
541
|
-
'Use focus mode in tools',
|
|
542
|
-
'Set clear session goals',
|
|
543
|
-
'Take regular breaks'
|
|
544
|
-
];
|
|
545
|
-
}
|
|
546
|
-
async getWorkflowSuggestions(entity, mode) {
|
|
547
|
-
return [
|
|
548
|
-
'Start with quick wins',
|
|
549
|
-
'Batch similar tasks',
|
|
550
|
-
'Use time-boxing',
|
|
551
|
-
'Regular progress checks'
|
|
552
|
-
];
|
|
553
|
-
}
|
|
554
|
-
// Collaboration context helpers
|
|
555
|
-
async getActiveTeamMembers(entity) {
|
|
556
|
-
return { active: ['Alice', 'Bob'], available: ['Charlie'] };
|
|
557
|
-
}
|
|
558
|
-
async getCollaborationPatterns(entity) {
|
|
559
|
-
return { patterns: ['morning_standups', 'afternoon_reviews', 'async_communication'] };
|
|
560
|
-
}
|
|
561
|
-
async getCommunicationPreferences(entity) {
|
|
562
|
-
return { preferences: ['slack_for_quick', 'email_for_formal', 'meetings_for_complex'] };
|
|
563
|
-
}
|
|
564
|
-
async getSharedResources(entity) {
|
|
565
|
-
return { resources: ['shared_docs', 'design_system', 'api_documentation'] };
|
|
566
|
-
}
|
|
567
|
-
async getCoordinationNeeds(entity) {
|
|
568
|
-
return { needs: ['sync_with_backend_team', 'client_approval_needed'] };
|
|
569
|
-
}
|
|
570
|
-
// Performance context helpers
|
|
571
|
-
async getCurrentVelocity(focus) {
|
|
572
|
-
return { velocity: '85%', trend: 'stable' };
|
|
573
|
-
}
|
|
574
|
-
async getPerformanceTrends(focus) {
|
|
575
|
-
return { trends: ['improving_quality', 'stable_velocity', 'decreasing_bugs'] };
|
|
576
|
-
}
|
|
577
|
-
async identifyBottlenecks(focus) {
|
|
578
|
-
return { bottlenecks: ['code_review_delays', 'dependency_waiting'] };
|
|
579
|
-
}
|
|
580
|
-
async getOptimizationOpportunities(focus) {
|
|
581
|
-
return { opportunities: ['automate_testing', 'improve_ci_cd', 'reduce_technical_debt'] };
|
|
582
|
-
}
|
|
583
|
-
async getBenchmarks(focus) {
|
|
584
|
-
return { benchmarks: { velocity: '90%', quality: '95%', satisfaction: '88%' } };
|
|
585
|
-
}
|
|
586
|
-
}
|
|
587
|
-
exports.FocusService = FocusService;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { RepoStatus } from '../models/entity.model';
|
|
2
|
-
export interface GitOptions {
|
|
3
|
-
cwd?: string;
|
|
4
|
-
env?: NodeJS.ProcessEnv;
|
|
5
|
-
}
|
|
6
|
-
export interface CommitOptions {
|
|
7
|
-
all?: boolean;
|
|
8
|
-
amend?: boolean;
|
|
9
|
-
}
|
|
10
|
-
export interface PushOptions {
|
|
11
|
-
force?: boolean;
|
|
12
|
-
tags?: boolean;
|
|
13
|
-
setUpstream?: boolean;
|
|
14
|
-
}
|
|
15
|
-
export interface PullOptions {
|
|
16
|
-
rebase?: boolean;
|
|
17
|
-
noFf?: boolean;
|
|
18
|
-
strategy?: string;
|
|
19
|
-
}
|
|
20
|
-
export declare class GitService {
|
|
21
|
-
exec(args: string[], options?: GitOptions): Promise<string>;
|
|
22
|
-
execSync(args: string[], options?: GitOptions): string;
|
|
23
|
-
getStatus(repoPath: string): Promise<RepoStatus>;
|
|
24
|
-
getCurrentBranch(repoPath: string): Promise<string>;
|
|
25
|
-
add(repoPath: string, files: string[]): Promise<void>;
|
|
26
|
-
commit(repoPath: string, message: string, options?: CommitOptions): Promise<void>;
|
|
27
|
-
push(repoPath: string, options?: PushOptions): Promise<void>;
|
|
28
|
-
pull(repoPath: string, options?: PullOptions): Promise<void>;
|
|
29
|
-
fetch(repoPath: string): Promise<void>;
|
|
30
|
-
clone(url: string, destination: string, depth?: number): Promise<void>;
|
|
31
|
-
isRepository(repoPath: string): Promise<boolean>;
|
|
32
|
-
hasChanges(repoPath: string): Promise<boolean>;
|
|
33
|
-
getRemoteUrl(repoPath: string, remote?: string): Promise<string | null>;
|
|
34
|
-
hasRemote(repoPath: string, remote?: string): Promise<boolean>;
|
|
35
|
-
addRemote(repoPath: string, name: string, url: string): Promise<void>;
|
|
36
|
-
init(repoPath: string): Promise<void>;
|
|
37
|
-
}
|