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