@hyperdrive.bot/gut 0.1.3

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.
Files changed (87) hide show
  1. package/README.md +809 -0
  2. package/bin/dev +16 -0
  3. package/bin/run +5 -0
  4. package/dist/base-command.d.ts +21 -0
  5. package/dist/base-command.js +110 -0
  6. package/dist/commands/add.d.ts +13 -0
  7. package/dist/commands/add.js +73 -0
  8. package/dist/commands/affected.d.ts +23 -0
  9. package/dist/commands/affected.js +326 -0
  10. package/dist/commands/audit.d.ts +33 -0
  11. package/dist/commands/audit.js +593 -0
  12. package/dist/commands/back.d.ts +6 -0
  13. package/dist/commands/back.js +29 -0
  14. package/dist/commands/commit.d.ts +11 -0
  15. package/dist/commands/commit.js +113 -0
  16. package/dist/commands/context.d.ts +6 -0
  17. package/dist/commands/context.js +36 -0
  18. package/dist/commands/contexts.d.ts +7 -0
  19. package/dist/commands/contexts.js +92 -0
  20. package/dist/commands/deps.d.ts +10 -0
  21. package/dist/commands/deps.js +104 -0
  22. package/dist/commands/entity/add.d.ts +16 -0
  23. package/dist/commands/entity/add.js +105 -0
  24. package/dist/commands/entity/clone-all.d.ts +17 -0
  25. package/dist/commands/entity/clone-all.js +135 -0
  26. package/dist/commands/entity/clone.d.ts +15 -0
  27. package/dist/commands/entity/clone.js +109 -0
  28. package/dist/commands/entity/list.d.ts +11 -0
  29. package/dist/commands/entity/list.js +82 -0
  30. package/dist/commands/entity/remove.d.ts +12 -0
  31. package/dist/commands/entity/remove.js +58 -0
  32. package/dist/commands/focus.d.ts +19 -0
  33. package/dist/commands/focus.js +139 -0
  34. package/dist/commands/graph.d.ts +18 -0
  35. package/dist/commands/graph.js +238 -0
  36. package/dist/commands/init.d.ts +11 -0
  37. package/dist/commands/init.js +84 -0
  38. package/dist/commands/insights.d.ts +21 -0
  39. package/dist/commands/insights.js +434 -0
  40. package/dist/commands/patterns.d.ts +40 -0
  41. package/dist/commands/patterns.js +412 -0
  42. package/dist/commands/pull.d.ts +11 -0
  43. package/dist/commands/pull.js +121 -0
  44. package/dist/commands/push.d.ts +11 -0
  45. package/dist/commands/push.js +101 -0
  46. package/dist/commands/quick-setup.d.ts +20 -0
  47. package/dist/commands/quick-setup.js +422 -0
  48. package/dist/commands/recent.d.ts +9 -0
  49. package/dist/commands/recent.js +55 -0
  50. package/dist/commands/related.d.ts +23 -0
  51. package/dist/commands/related.js +257 -0
  52. package/dist/commands/repos.d.ts +14 -0
  53. package/dist/commands/repos.js +185 -0
  54. package/dist/commands/stack.d.ts +10 -0
  55. package/dist/commands/stack.js +83 -0
  56. package/dist/commands/status.d.ts +14 -0
  57. package/dist/commands/status.js +246 -0
  58. package/dist/commands/sync.d.ts +11 -0
  59. package/dist/commands/sync.js +142 -0
  60. package/dist/commands/unfocus.d.ts +6 -0
  61. package/dist/commands/unfocus.js +23 -0
  62. package/dist/commands/used-by.d.ts +10 -0
  63. package/dist/commands/used-by.js +111 -0
  64. package/dist/commands/workspace.d.ts +20 -0
  65. package/dist/commands/workspace.js +365 -0
  66. package/dist/index.d.ts +1 -0
  67. package/dist/index.js +5 -0
  68. package/dist/models/entity.model.d.ts +81 -0
  69. package/dist/models/entity.model.js +2 -0
  70. package/dist/services/config.service.d.ts +34 -0
  71. package/dist/services/config.service.js +230 -0
  72. package/dist/services/entity.service.d.ts +19 -0
  73. package/dist/services/entity.service.js +130 -0
  74. package/dist/services/focus.service.d.ts +70 -0
  75. package/dist/services/focus.service.js +587 -0
  76. package/dist/services/git.service.d.ts +37 -0
  77. package/dist/services/git.service.js +180 -0
  78. package/dist/utils/display.d.ts +25 -0
  79. package/dist/utils/display.js +150 -0
  80. package/dist/utils/filesystem.d.ts +32 -0
  81. package/dist/utils/filesystem.js +220 -0
  82. package/dist/utils/index.d.ts +13 -0
  83. package/dist/utils/index.js +18 -0
  84. package/dist/utils/validation.d.ts +22 -0
  85. package/dist/utils/validation.js +196 -0
  86. package/oclif.manifest.json +1463 -0
  87. package/package.json +76 -0
@@ -0,0 +1,412 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const core_1 = require("@oclif/core");
5
+ const base_command_1 = require("../base-command");
6
+ const chalk_1 = tslib_1.__importDefault(require("chalk"));
7
+ class Patterns extends base_command_1.BaseCommand {
8
+ static description = 'Show learned patterns for current context or entities';
9
+ static examples = [
10
+ '<%= config.bin %> <%= command.id %>',
11
+ '<%= config.bin %> <%= command.id %> --entity mindtools',
12
+ '<%= config.bin %> <%= command.id %> --type client',
13
+ '<%= config.bin %> <%= command.id %> --mode strategy',
14
+ ];
15
+ static flags = {
16
+ entity: core_1.Flags.string({
17
+ char: 'e',
18
+ description: 'show patterns for specific entity',
19
+ }),
20
+ type: core_1.Flags.string({
21
+ char: 't',
22
+ description: 'show patterns for entity type',
23
+ options: ['client', 'prospect', 'company', 'initiative', 'system'],
24
+ }),
25
+ mode: core_1.Flags.string({
26
+ char: 'm',
27
+ description: 'show patterns for focus mode',
28
+ options: ['delivery', 'strategy', 'audit', 'debug', 'research', 'proposal'],
29
+ }),
30
+ json: core_1.Flags.boolean({
31
+ description: 'output as JSON',
32
+ default: false,
33
+ }),
34
+ };
35
+ async run() {
36
+ const { flags } = await this.parse(Patterns);
37
+ const currentFocus = await this.focusService.getCurrentFocus();
38
+ const focusedEntities = await this.focusService.getFocusedEntities();
39
+ // Determine what patterns to analyze
40
+ let targetEntity = null;
41
+ let targetType = flags.type;
42
+ let targetMode = flags.mode || currentFocus?.mode;
43
+ if (flags.entity) {
44
+ targetEntity = this.entityService.findEntity(flags.entity);
45
+ if (!targetEntity) {
46
+ this.error(`Entity '${flags.entity}' not found`);
47
+ }
48
+ }
49
+ else if (focusedEntities.length > 0) {
50
+ targetEntity = focusedEntities[0]; // Use first focused entity
51
+ targetType = targetType || targetEntity.type;
52
+ }
53
+ const patterns = await this.analyzePatterns(targetEntity, targetType, targetMode);
54
+ if (flags.json) {
55
+ this.log(JSON.stringify(patterns, null, 2));
56
+ return;
57
+ }
58
+ this.displayPatterns(patterns, targetEntity, targetType, targetMode);
59
+ }
60
+ async analyzePatterns(entity, type, mode) {
61
+ const allEntities = this.entityService.getAllEntities();
62
+ const patterns = {
63
+ entity_patterns: {},
64
+ type_patterns: {},
65
+ mode_patterns: {},
66
+ cross_entity_patterns: {},
67
+ temporal_patterns: {},
68
+ productivity_patterns: {}
69
+ };
70
+ // Entity-specific patterns
71
+ if (entity) {
72
+ patterns.entity_patterns = await this.analyzeEntityPatterns(entity);
73
+ }
74
+ // Type-based patterns
75
+ if (type) {
76
+ const entitiesOfType = allEntities.filter(e => e.type === type);
77
+ patterns.type_patterns = await this.analyzeTypePatterns(entitiesOfType, type);
78
+ }
79
+ // Mode-based patterns
80
+ if (mode) {
81
+ patterns.mode_patterns = await this.analyzeModePatterns(mode);
82
+ }
83
+ // Cross-entity patterns
84
+ patterns.cross_entity_patterns = await this.analyzeCrossEntityPatterns(allEntities);
85
+ // Temporal patterns (simulated - would come from actual usage data)
86
+ patterns.temporal_patterns = this.generateTemporalPatterns();
87
+ // Productivity patterns (simulated - would come from focus analytics)
88
+ patterns.productivity_patterns = this.generateProductivityPatterns(entity, type, mode);
89
+ return patterns;
90
+ }
91
+ async analyzeEntityPatterns(entity) {
92
+ const metadata = entity.metadata || {};
93
+ return {
94
+ working_patterns: metadata.working_patterns || {},
95
+ relationships: metadata.relationships || {},
96
+ focus_intelligence: metadata.focus_intelligence || {},
97
+ common_workflows: [
98
+ 'Focus → Edit → Commit → Push',
99
+ 'Research → Document → Review',
100
+ 'Debug → Fix → Test → Deploy'
101
+ ],
102
+ file_patterns: this.analyzeFilePatterns(entity),
103
+ collaboration_patterns: this.analyzeCollaborationPatterns(entity)
104
+ };
105
+ }
106
+ async analyzeTypePatterns(entities, type) {
107
+ const commonPatterns = {
108
+ typical_duration: this.calculateTypicalDuration(entities, type),
109
+ common_modes: this.getCommonModes(type),
110
+ relationship_patterns: this.analyzeRelationshipPatterns(entities),
111
+ success_metrics: this.getSuccessMetrics(type)
112
+ };
113
+ return commonPatterns;
114
+ }
115
+ async analyzeModePatterns(mode) {
116
+ return {
117
+ typical_activities: this.getTypicalActivities(mode),
118
+ optimal_duration: this.getOptimalDuration(mode),
119
+ common_tools: this.getCommonTools(mode),
120
+ success_indicators: this.getSuccessIndicators(mode),
121
+ transition_patterns: this.getTransitionPatterns(mode)
122
+ };
123
+ }
124
+ async analyzeCrossEntityPatterns(entities) {
125
+ return {
126
+ dependency_chains: this.findDependencyChains(entities),
127
+ similar_entity_clusters: this.findSimilarClusters(entities),
128
+ shared_systems: this.findSharedSystems(entities),
129
+ workflow_similarities: this.findWorkflowSimilarities(entities)
130
+ };
131
+ }
132
+ generateTemporalPatterns() {
133
+ return {
134
+ peak_productivity_hours: ['9-11am', '2-4pm'],
135
+ optimal_session_length: '90 minutes',
136
+ context_switch_cost: '8-12 minutes',
137
+ weekly_patterns: {
138
+ monday: 'Planning and strategy',
139
+ tuesday: 'Deep development work',
140
+ wednesday: 'Collaboration and reviews',
141
+ thursday: 'Implementation and testing',
142
+ friday: 'Documentation and cleanup'
143
+ },
144
+ seasonal_patterns: {
145
+ q1: 'Planning and architecture',
146
+ q2: 'Development and implementation',
147
+ q3: 'Testing and optimization',
148
+ q4: 'Documentation and review'
149
+ }
150
+ };
151
+ }
152
+ generateProductivityPatterns(entity, type, mode) {
153
+ const basePatterns = {
154
+ high_productivity_indicators: [
155
+ 'Focused sessions > 60 minutes',
156
+ 'Minimal context switching',
157
+ 'Clear objectives set',
158
+ 'Distraction-free environment'
159
+ ],
160
+ productivity_killers: [
161
+ 'Frequent interruptions',
162
+ 'Unclear requirements',
163
+ 'Technical debt',
164
+ 'Missing dependencies'
165
+ ],
166
+ optimization_suggestions: []
167
+ };
168
+ // Add context-specific suggestions
169
+ if (mode === 'strategy') {
170
+ basePatterns.optimization_suggestions = [
171
+ ...basePatterns.optimization_suggestions,
172
+ 'Schedule 2+ hour blocks for strategic thinking',
173
+ 'Minimize technical distractions',
174
+ 'Include business context in focus'
175
+ ];
176
+ }
177
+ else if (mode === 'delivery') {
178
+ basePatterns.optimization_suggestions = [
179
+ ...basePatterns.optimization_suggestions,
180
+ 'Use 90-minute focused coding sessions',
181
+ 'Have clear technical requirements',
182
+ 'Minimize meeting interruptions'
183
+ ];
184
+ }
185
+ if (type === 'client') {
186
+ basePatterns.optimization_suggestions = [
187
+ ...basePatterns.optimization_suggestions,
188
+ 'Batch client communication',
189
+ 'Maintain business context awareness',
190
+ 'Regular stakeholder alignment'
191
+ ];
192
+ }
193
+ return basePatterns;
194
+ }
195
+ displayPatterns(patterns, entity, type, mode) {
196
+ this.log(chalk_1.default.bold('\nšŸ” Pattern Analysis'));
197
+ this.log(chalk_1.default.dim('─'.repeat(50)));
198
+ // Context header
199
+ const context = [];
200
+ if (entity)
201
+ context.push(`Entity: ${chalk_1.default.cyan(entity.name)}`);
202
+ if (type)
203
+ context.push(`Type: ${chalk_1.default.yellow(type)}`);
204
+ if (mode)
205
+ context.push(`Mode: ${chalk_1.default.green(mode)}`);
206
+ if (context.length > 0) {
207
+ this.log(`šŸ“ Context: ${context.join(' | ')}`);
208
+ this.log('');
209
+ }
210
+ // Entity patterns
211
+ if (patterns.entity_patterns && Object.keys(patterns.entity_patterns).length > 0) {
212
+ this.log(chalk_1.default.bold('šŸŽÆ Entity-Specific Patterns:'));
213
+ this.displayEntityPatterns(patterns.entity_patterns);
214
+ this.log('');
215
+ }
216
+ // Type patterns
217
+ if (patterns.type_patterns && Object.keys(patterns.type_patterns).length > 0) {
218
+ this.log(chalk_1.default.bold('šŸ“Š Type-Based Patterns:'));
219
+ this.displayTypePatterns(patterns.type_patterns);
220
+ this.log('');
221
+ }
222
+ // Mode patterns
223
+ if (patterns.mode_patterns && Object.keys(patterns.mode_patterns).length > 0) {
224
+ this.log(chalk_1.default.bold('āš™ļø Mode-Specific Patterns:'));
225
+ this.displayModePatterns(patterns.mode_patterns);
226
+ this.log('');
227
+ }
228
+ // Productivity patterns
229
+ if (patterns.productivity_patterns) {
230
+ this.log(chalk_1.default.bold('šŸ“ˆ Productivity Patterns:'));
231
+ this.displayProductivityPatterns(patterns.productivity_patterns);
232
+ this.log('');
233
+ }
234
+ // Temporal patterns
235
+ if (patterns.temporal_patterns) {
236
+ this.log(chalk_1.default.bold('ā° Temporal Patterns:'));
237
+ this.displayTemporalPatterns(patterns.temporal_patterns);
238
+ }
239
+ }
240
+ displayEntityPatterns(patterns) {
241
+ if (patterns.common_workflows) {
242
+ this.log(` ${chalk_1.default.cyan('Common Workflows:')}`);
243
+ patterns.common_workflows.forEach((workflow) => {
244
+ this.log(` • ${workflow}`);
245
+ });
246
+ }
247
+ if (patterns.working_patterns?.typical_focus_duration) {
248
+ this.log(` ${chalk_1.default.cyan('Typical Focus Duration:')} ${patterns.working_patterns.typical_focus_duration}`);
249
+ }
250
+ if (patterns.relationships?.similar_entities?.length > 0) {
251
+ this.log(` ${chalk_1.default.cyan('Similar Entities:')} ${patterns.relationships.similar_entities.join(', ')}`);
252
+ }
253
+ }
254
+ displayTypePatterns(patterns) {
255
+ if (patterns.typical_duration) {
256
+ this.log(` ${chalk_1.default.cyan('Typical Duration:')} ${patterns.typical_duration}`);
257
+ }
258
+ if (patterns.common_modes?.length > 0) {
259
+ this.log(` ${chalk_1.default.cyan('Common Modes:')} ${patterns.common_modes.join(', ')}`);
260
+ }
261
+ if (patterns.success_metrics?.length > 0) {
262
+ this.log(` ${chalk_1.default.cyan('Success Metrics:')}`);
263
+ patterns.success_metrics.forEach((metric) => {
264
+ this.log(` • ${metric}`);
265
+ });
266
+ }
267
+ }
268
+ displayModePatterns(patterns) {
269
+ if (patterns.typical_activities?.length > 0) {
270
+ this.log(` ${chalk_1.default.cyan('Typical Activities:')}`);
271
+ patterns.typical_activities.forEach((activity) => {
272
+ this.log(` • ${activity}`);
273
+ });
274
+ }
275
+ if (patterns.optimal_duration) {
276
+ this.log(` ${chalk_1.default.cyan('Optimal Duration:')} ${patterns.optimal_duration}`);
277
+ }
278
+ }
279
+ displayProductivityPatterns(patterns) {
280
+ if (patterns.high_productivity_indicators?.length > 0) {
281
+ this.log(` ${chalk_1.default.green('High Productivity Indicators:')}`);
282
+ patterns.high_productivity_indicators.forEach((indicator) => {
283
+ this.log(` āœ“ ${indicator}`);
284
+ });
285
+ }
286
+ if (patterns.optimization_suggestions?.length > 0) {
287
+ this.log(` ${chalk_1.default.yellow('Optimization Suggestions:')}`);
288
+ patterns.optimization_suggestions.forEach((suggestion) => {
289
+ this.log(` šŸ’” ${suggestion}`);
290
+ });
291
+ }
292
+ }
293
+ displayTemporalPatterns(patterns) {
294
+ if (patterns.peak_productivity_hours) {
295
+ this.log(` ${chalk_1.default.cyan('Peak Hours:')} ${patterns.peak_productivity_hours.join(', ')}`);
296
+ }
297
+ if (patterns.optimal_session_length) {
298
+ this.log(` ${chalk_1.default.cyan('Optimal Session:')} ${patterns.optimal_session_length}`);
299
+ }
300
+ if (patterns.context_switch_cost) {
301
+ this.log(` ${chalk_1.default.cyan('Context Switch Cost:')} ${patterns.context_switch_cost}`);
302
+ }
303
+ }
304
+ // Helper methods for pattern analysis
305
+ analyzeFilePatterns(entity) {
306
+ // Would analyze actual file patterns from git history
307
+ return ['src/', 'docs/', 'tests/'];
308
+ }
309
+ analyzeCollaborationPatterns(entity) {
310
+ // Would analyze commit patterns, PR patterns, etc.
311
+ return ['solo_work', 'pair_programming', 'code_review'];
312
+ }
313
+ calculateTypicalDuration(entities, type) {
314
+ // Would calculate from actual usage data
315
+ const durations = {
316
+ client: '2 hours',
317
+ prospect: '1 hour',
318
+ company: '3 hours',
319
+ initiative: '2.5 hours',
320
+ system: '1.5 hours'
321
+ };
322
+ return durations[type] || '1 hour';
323
+ }
324
+ getCommonModes(type) {
325
+ const modes = {
326
+ client: ['delivery', 'strategy', 'audit'],
327
+ prospect: ['research', 'proposal'],
328
+ company: ['strategy', 'audit'],
329
+ initiative: ['strategy', 'delivery'],
330
+ system: ['delivery', 'debug']
331
+ };
332
+ return modes[type] || ['delivery'];
333
+ }
334
+ analyzeRelationshipPatterns(entities) {
335
+ // Would analyze actual relationship patterns
336
+ return {
337
+ common_dependencies: ['systems/api', 'shared/design-system'],
338
+ typical_cluster_size: 3
339
+ };
340
+ }
341
+ getSuccessMetrics(type) {
342
+ const metrics = {
343
+ client: ['Client satisfaction', 'Delivery velocity', 'Code quality'],
344
+ prospect: ['Proposal quality', 'Response time', 'Conversion rate'],
345
+ company: ['Strategic alignment', 'Operational efficiency', 'Growth metrics'],
346
+ initiative: ['Milestone completion', 'Cross-team adoption', 'Impact measurement'],
347
+ system: ['Performance metrics', 'Reliability', 'Developer experience']
348
+ };
349
+ return metrics[type] || [];
350
+ }
351
+ getTypicalActivities(mode) {
352
+ const activities = {
353
+ delivery: ['Coding', 'Testing', 'Code review', 'Documentation'],
354
+ strategy: ['Planning', 'Analysis', 'Decision making', 'Roadmap creation'],
355
+ audit: ['Review', 'Compliance check', 'Risk assessment', 'Documentation'],
356
+ debug: ['Issue investigation', 'Log analysis', 'Testing fixes', 'Root cause analysis'],
357
+ research: ['Market analysis', 'Technology evaluation', 'Competitive research', 'Documentation'],
358
+ proposal: ['Requirements gathering', 'Solution design', 'Pricing', 'Presentation creation']
359
+ };
360
+ return activities[mode] || [];
361
+ }
362
+ getOptimalDuration(mode) {
363
+ const durations = {
364
+ delivery: '90 minutes',
365
+ strategy: '2-3 hours',
366
+ audit: '60-90 minutes',
367
+ debug: '45-60 minutes',
368
+ research: '1-2 hours',
369
+ proposal: '2-4 hours'
370
+ };
371
+ return durations[mode] || '1 hour';
372
+ }
373
+ getCommonTools(mode) {
374
+ // Would return actual tool usage patterns
375
+ return ['VS Code', 'Git', 'Browser', 'Terminal'];
376
+ }
377
+ getSuccessIndicators(mode) {
378
+ const indicators = {
379
+ delivery: ['Code committed', 'Tests passing', 'Features completed'],
380
+ strategy: ['Decisions made', 'Plans documented', 'Alignment achieved'],
381
+ audit: ['Issues identified', 'Compliance verified', 'Risks assessed'],
382
+ debug: ['Issues resolved', 'Root cause found', 'Fix verified'],
383
+ research: ['Insights gathered', 'Options identified', 'Recommendations made'],
384
+ proposal: ['Requirements clarified', 'Solution designed', 'Proposal completed']
385
+ };
386
+ return indicators[mode] || [];
387
+ }
388
+ getTransitionPatterns(mode) {
389
+ // Would analyze actual transition patterns
390
+ return {
391
+ common_next_modes: ['delivery', 'strategy'],
392
+ transition_triggers: ['completion', 'interruption', 'scheduled']
393
+ };
394
+ }
395
+ findDependencyChains(entities) {
396
+ // Would analyze actual dependency chains
397
+ return ['client → system → shared'];
398
+ }
399
+ findSimilarClusters(entities) {
400
+ // Would find clusters of similar entities
401
+ return [['mindtools', 'vixting'], ['api', 'shared']];
402
+ }
403
+ findSharedSystems(entities) {
404
+ // Would find commonly used systems
405
+ return ['systems/api', 'shared/design-system'];
406
+ }
407
+ findWorkflowSimilarities(entities) {
408
+ // Would analyze workflow similarities
409
+ return ['React development pattern', 'API integration pattern'];
410
+ }
411
+ }
412
+ exports.default = Patterns;
@@ -0,0 +1,11 @@
1
+ import { BaseCommand } from '../base-command';
2
+ export default class Pull extends BaseCommand {
3
+ static description: string;
4
+ static examples: string[];
5
+ static flags: {
6
+ rebase: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
7
+ all: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
8
+ 'no-commit': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
9
+ };
10
+ run(): Promise<void>;
11
+ }
@@ -0,0 +1,121 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const core_1 = require("@oclif/core");
5
+ const base_command_1 = require("../base-command");
6
+ const chalk_1 = tslib_1.__importDefault(require("chalk"));
7
+ const ora_1 = tslib_1.__importDefault(require("ora"));
8
+ class Pull extends base_command_1.BaseCommand {
9
+ static description = 'Pull changes from remote repositories';
10
+ static examples = [
11
+ '<%= config.bin %> <%= command.id %>',
12
+ '<%= config.bin %> <%= command.id %> --rebase',
13
+ '<%= config.bin %> <%= command.id %> --all',
14
+ ];
15
+ static flags = {
16
+ rebase: core_1.Flags.boolean({
17
+ char: 'r',
18
+ description: 'Rebase instead of merge',
19
+ default: false,
20
+ }),
21
+ all: core_1.Flags.boolean({
22
+ description: 'Fetch all remotes',
23
+ default: false,
24
+ }),
25
+ 'no-commit': core_1.Flags.boolean({
26
+ description: 'Perform merge but do not commit',
27
+ default: false,
28
+ }),
29
+ };
30
+ async run() {
31
+ const { flags } = await this.parse(Pull);
32
+ const focusedEntities = await this.focusService.getFocusedEntities();
33
+ if (focusedEntities.length === 0) {
34
+ this.error('No entities are focused. Use "gut focus <entity>" first.');
35
+ }
36
+ this.log(chalk_1.default.bold('\nā¬‡ļø Pulling from remote repositories\n'));
37
+ const results = {
38
+ success: [],
39
+ failed: [],
40
+ upToDate: [],
41
+ conflicts: [],
42
+ };
43
+ for (const entity of focusedEntities) {
44
+ const spinner = (0, ora_1.default)(`Pulling ${chalk_1.default.cyan(entity.name)}`).start();
45
+ try {
46
+ // Check if there's a remote configured
47
+ const remoteOutput = await this.gitService.exec(['remote', '-v'], { cwd: entity.path });
48
+ if (!remoteOutput || remoteOutput.trim().length === 0) {
49
+ spinner.warn(chalk_1.default.yellow(`${entity.name}: No remote configured`));
50
+ results.failed.push({ repo: entity.name, error: 'No remote configured' });
51
+ continue;
52
+ }
53
+ // Check for uncommitted changes
54
+ const status = await this.gitService.getStatus(entity.path);
55
+ const hasUncommitted = status.changes.length > 0;
56
+ if (hasUncommitted && !flags['no-commit']) {
57
+ spinner.warn(chalk_1.default.yellow(`${entity.name}: Has uncommitted changes`));
58
+ results.failed.push({ repo: entity.name, error: 'Uncommitted changes. Commit or stash first' });
59
+ continue;
60
+ }
61
+ // Build pull options
62
+ const options = {
63
+ rebase: flags.rebase,
64
+ noFf: flags['no-commit'],
65
+ };
66
+ await this.gitService.pull(entity.path, options);
67
+ spinner.succeed(chalk_1.default.green(`āœ“ ${entity.name}: Pulled successfully`));
68
+ results.success.push(entity.name);
69
+ }
70
+ catch (error) {
71
+ const errorMessage = error.message || error.toString();
72
+ if (errorMessage.includes('Already up to date') || errorMessage.includes('Already up-to-date')) {
73
+ spinner.info(chalk_1.default.blue(`${entity.name}: Already up-to-date`));
74
+ results.upToDate.push(entity.name);
75
+ }
76
+ else if (errorMessage.includes('CONFLICT')) {
77
+ spinner.fail(chalk_1.default.red(`āœ— ${entity.name}: Merge conflicts detected`));
78
+ results.conflicts.push(entity.name);
79
+ }
80
+ else if (errorMessage.includes('no tracking information')) {
81
+ spinner.fail(chalk_1.default.red(`āœ— ${entity.name}: No tracking branch configured`));
82
+ results.failed.push({ repo: entity.name, error: 'No tracking branch. Set upstream first' });
83
+ }
84
+ else if (errorMessage.includes('diverged')) {
85
+ spinner.fail(chalk_1.default.red(`āœ— ${entity.name}: Branches have diverged`));
86
+ results.failed.push({ repo: entity.name, error: 'Branches diverged. Use --rebase or resolve manually' });
87
+ }
88
+ else {
89
+ spinner.fail(chalk_1.default.red(`āœ— ${entity.name}: ${errorMessage}`));
90
+ results.failed.push({ repo: entity.name, error: errorMessage });
91
+ }
92
+ }
93
+ }
94
+ // Summary
95
+ this.log(chalk_1.default.bold('\nšŸ“Š Pull Summary'));
96
+ this.log(chalk_1.default.dim('─'.repeat(50)));
97
+ if (results.success.length > 0) {
98
+ this.log(chalk_1.default.green(`āœ“ Updated: ${results.success.length} entities`));
99
+ }
100
+ if (results.upToDate.length > 0) {
101
+ this.log(chalk_1.default.blue(`ā—‹ Up-to-date: ${results.upToDate.length} entities`));
102
+ }
103
+ if (results.conflicts.length > 0) {
104
+ this.log(chalk_1.default.yellow(`⚠ Conflicts: ${results.conflicts.length} entities`));
105
+ this.log(chalk_1.default.dim(' Resolve conflicts manually in:'));
106
+ for (const repo of results.conflicts) {
107
+ this.log(chalk_1.default.dim(` - ${repo}`));
108
+ }
109
+ }
110
+ if (results.failed.length > 0) {
111
+ this.log(chalk_1.default.red(`āœ— Failed: ${results.failed.length} entities`));
112
+ for (const failure of results.failed) {
113
+ this.log(chalk_1.default.red(` - ${failure.repo}: ${failure.error}`));
114
+ }
115
+ }
116
+ if (results.success.length > 0) {
117
+ this.log(chalk_1.default.dim('\nTip: Use "gut status" to see the current state'));
118
+ }
119
+ }
120
+ }
121
+ exports.default = Pull;
@@ -0,0 +1,11 @@
1
+ import { BaseCommand } from '../base-command';
2
+ export default class Push extends BaseCommand {
3
+ static description: string;
4
+ static examples: string[];
5
+ static flags: {
6
+ force: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
7
+ 'set-upstream': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
8
+ tags: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
9
+ };
10
+ run(): Promise<void>;
11
+ }
@@ -0,0 +1,101 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const core_1 = require("@oclif/core");
5
+ const base_command_1 = require("../base-command");
6
+ const chalk_1 = tslib_1.__importDefault(require("chalk"));
7
+ const ora_1 = tslib_1.__importDefault(require("ora"));
8
+ class Push extends base_command_1.BaseCommand {
9
+ static description = 'Push commits to remote repositories';
10
+ static examples = [
11
+ '<%= config.bin %> <%= command.id %>',
12
+ '<%= config.bin %> <%= command.id %> --force',
13
+ '<%= config.bin %> <%= command.id %> --set-upstream',
14
+ ];
15
+ static flags = {
16
+ force: core_1.Flags.boolean({
17
+ char: 'f',
18
+ description: 'Force push (use with caution)',
19
+ default: false,
20
+ }),
21
+ 'set-upstream': core_1.Flags.boolean({
22
+ char: 'u',
23
+ description: 'Set upstream branch',
24
+ default: false,
25
+ }),
26
+ tags: core_1.Flags.boolean({
27
+ description: 'Push tags',
28
+ default: false,
29
+ }),
30
+ };
31
+ async run() {
32
+ const { flags } = await this.parse(Push);
33
+ const focusedEntities = await this.focusService.getFocusedEntities();
34
+ if (focusedEntities.length === 0) {
35
+ this.error('No entities are focused. Use "gut focus <entity>" first.');
36
+ }
37
+ this.log(chalk_1.default.bold('\nšŸš€ Pushing to remote repositories\n'));
38
+ const results = {
39
+ success: [],
40
+ failed: [],
41
+ upToDate: [],
42
+ };
43
+ for (const entity of focusedEntities) {
44
+ const spinner = (0, ora_1.default)(`Pushing ${chalk_1.default.cyan(entity.name)}`).start();
45
+ try {
46
+ // Check if there's a remote configured
47
+ const remoteOutput = await this.gitService.exec(['remote', '-v'], { cwd: entity.path });
48
+ if (!remoteOutput || remoteOutput.trim().length === 0) {
49
+ spinner.warn(chalk_1.default.yellow(`${entity.name}: No remote configured`));
50
+ results.failed.push({ repo: entity.name, error: 'No remote configured' });
51
+ continue;
52
+ }
53
+ // Build push options
54
+ const options = {
55
+ force: flags.force,
56
+ tags: flags.tags,
57
+ setUpstream: flags['set-upstream'],
58
+ };
59
+ await this.gitService.push(entity.path, options);
60
+ spinner.succeed(chalk_1.default.green(`āœ“ ${entity.name}: Pushed successfully`));
61
+ results.success.push(entity.name);
62
+ }
63
+ catch (error) {
64
+ const errorMessage = error.message || error.toString();
65
+ if (errorMessage.includes('Everything up-to-date')) {
66
+ spinner.info(chalk_1.default.blue(`${entity.name}: Already up-to-date`));
67
+ results.upToDate.push(entity.name);
68
+ }
69
+ else if (errorMessage.includes('no upstream branch')) {
70
+ spinner.fail(chalk_1.default.red(`āœ— ${entity.name}: No upstream branch. Use --set-upstream`));
71
+ results.failed.push({ repo: entity.name, error: 'No upstream branch configured' });
72
+ }
73
+ else if (errorMessage.includes('rejected')) {
74
+ spinner.fail(chalk_1.default.red(`āœ— ${entity.name}: Push rejected (remote has changes)`));
75
+ results.failed.push({ repo: entity.name, error: 'Remote has changes. Pull first or use --force' });
76
+ }
77
+ else {
78
+ spinner.fail(chalk_1.default.red(`āœ— ${entity.name}: ${errorMessage}`));
79
+ results.failed.push({ repo: entity.name, error: errorMessage });
80
+ }
81
+ }
82
+ }
83
+ // Summary
84
+ this.log(chalk_1.default.bold('\nšŸ“Š Push Summary'));
85
+ this.log(chalk_1.default.dim('─'.repeat(50)));
86
+ if (results.success.length > 0) {
87
+ this.log(chalk_1.default.green(`āœ“ Pushed: ${results.success.length} entities`));
88
+ }
89
+ if (results.upToDate.length > 0) {
90
+ this.log(chalk_1.default.blue(`ā—‹ Up-to-date: ${results.upToDate.length} entities`));
91
+ }
92
+ if (results.failed.length > 0) {
93
+ this.log(chalk_1.default.red(`āœ— Failed: ${results.failed.length} entities`));
94
+ for (const failure of results.failed) {
95
+ this.log(chalk_1.default.red(` - ${failure.repo}: ${failure.error}`));
96
+ }
97
+ this.log(chalk_1.default.dim('\nTip: Use "gut pull" to sync with remote first'));
98
+ }
99
+ }
100
+ }
101
+ exports.default = Push;
@@ -0,0 +1,20 @@
1
+ import BaseCommand from '../base-command';
2
+ export default class QuickSetup extends BaseCommand {
3
+ static description: string;
4
+ static examples: string[];
5
+ static flags: {
6
+ auto: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
7
+ profile: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
8
+ 'scan-depth': import("@oclif/core/lib/interfaces").OptionFlag<number, import("@oclif/core/lib/interfaces").CustomOptions>;
9
+ 'clone-missing': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
10
+ };
11
+ private profiles;
12
+ run(): Promise<void>;
13
+ private scanWorkspace;
14
+ private detectProfile;
15
+ private categorizeEntities;
16
+ private findMissingEntities;
17
+ private printDetectedEntities;
18
+ private printSetupSummary;
19
+ private printNextSteps;
20
+ }