@snapcommit/cli 2.3.0 → 2.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -69,23 +69,63 @@ async function handleAICommand(userInput) {
|
|
|
69
69
|
// Get AI interpretation for EVERYTHING
|
|
70
70
|
const intent = await getAIInterpretation(userInput, token);
|
|
71
71
|
if (!intent) {
|
|
72
|
-
console.log(chalk_1.default.red('❌ Could not understand command
|
|
72
|
+
console.log(chalk_1.default.red('❌ Could not understand command'));
|
|
73
|
+
console.log(chalk_1.default.gray('Tip: Try "commit and push" or "show me changes"\n'));
|
|
73
74
|
return;
|
|
74
75
|
}
|
|
76
|
+
// Debug: Show what AI understood (for now)
|
|
77
|
+
if (process.env.DEBUG) {
|
|
78
|
+
console.log(chalk_1.default.gray(`[DEBUG] Intent: ${JSON.stringify(intent, null, 2)}`));
|
|
79
|
+
}
|
|
75
80
|
// Execute based on type
|
|
76
81
|
if (intent.type === 'git') {
|
|
82
|
+
// Status check
|
|
83
|
+
if (intent.action === 'status') {
|
|
84
|
+
await showStatus();
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
77
87
|
// For commits, generate AI message first
|
|
78
88
|
if (intent.action === 'commit') {
|
|
79
89
|
await executeCommitWithAI(intent);
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
// Other git commands
|
|
93
|
+
if (intent.gitCommands && intent.gitCommands.length > 0) {
|
|
94
|
+
await executeGitCommands(intent.gitCommands);
|
|
95
|
+
console.log(chalk_1.default.green('✓ Done\n'));
|
|
80
96
|
}
|
|
81
97
|
else {
|
|
82
|
-
|
|
98
|
+
console.log(chalk_1.default.yellow('⚠️ No commands to execute\n'));
|
|
83
99
|
}
|
|
84
100
|
}
|
|
85
101
|
else if (intent.type === 'github') {
|
|
86
102
|
await executeGitHubCommand(intent);
|
|
103
|
+
console.log(chalk_1.default.green('✓ Done\n'));
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
console.log(chalk_1.default.yellow(`⚠️ Unknown intent type: ${intent.type}\n`));
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Show git status
|
|
111
|
+
*/
|
|
112
|
+
async function showStatus() {
|
|
113
|
+
const status = (0, git_1.getGitStatus)();
|
|
114
|
+
const branch = (0, git_1.getCurrentBranch)();
|
|
115
|
+
const hasChanges = status.staged > 0 || status.unstaged > 0 || status.untracked > 0;
|
|
116
|
+
console.log(chalk_1.default.blue(`\nBranch: ${branch}`));
|
|
117
|
+
if (!hasChanges) {
|
|
118
|
+
console.log(chalk_1.default.gray('✓ Branch clean - no changes\n'));
|
|
119
|
+
return;
|
|
87
120
|
}
|
|
88
|
-
console.log(chalk_1.default.
|
|
121
|
+
console.log(chalk_1.default.yellow('\nChanges detected:'));
|
|
122
|
+
if (status.unstaged > 0)
|
|
123
|
+
console.log(chalk_1.default.yellow(` • ${status.unstaged} modified`));
|
|
124
|
+
if (status.untracked > 0)
|
|
125
|
+
console.log(chalk_1.default.yellow(` • ${status.untracked} new`));
|
|
126
|
+
if (status.staged > 0)
|
|
127
|
+
console.log(chalk_1.default.green(` • ${status.staged} staged`));
|
|
128
|
+
console.log();
|
|
89
129
|
}
|
|
90
130
|
/**
|
|
91
131
|
* Execute commit with AI-generated message
|