@snapcommit/cli 3.8.21 → 3.8.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/cursor-style.js +49 -3
- package/dist/lib/github.js +3 -2
- package/package.json +1 -1
|
@@ -93,7 +93,7 @@ async function handleAICommand(userInput) {
|
|
|
93
93
|
// Other git commands (branch, merge, etc.)
|
|
94
94
|
if (intent.gitCommands && intent.gitCommands.length > 0) {
|
|
95
95
|
await executeGitCommands(intent.gitCommands);
|
|
96
|
-
|
|
96
|
+
// Individual commands now show their own success messages
|
|
97
97
|
}
|
|
98
98
|
else {
|
|
99
99
|
console.log(chalk_1.default.yellow('\n⚠️ No action taken\n'));
|
|
@@ -578,11 +578,57 @@ async function executeGitCommands(commands) {
|
|
|
578
578
|
for (const cmd of commands) {
|
|
579
579
|
try {
|
|
580
580
|
const output = (0, child_process_1.execSync)(cmd, { encoding: 'utf-8', stdio: 'pipe' });
|
|
581
|
-
// Show meaningful output for
|
|
582
|
-
if (cmd.includes('git
|
|
581
|
+
// Show meaningful output for specific commands
|
|
582
|
+
if (cmd.includes('git checkout -b')) {
|
|
583
|
+
// Creating a new branch
|
|
584
|
+
const branchName = cmd.split('git checkout -b ')[1]?.split(' ')[0];
|
|
585
|
+
console.log(chalk_1.default.green(`\n✓ Created and switched to branch: ${chalk_1.default.cyan(branchName)}\n`));
|
|
586
|
+
}
|
|
587
|
+
else if (cmd.includes('git checkout') || cmd.includes('git switch')) {
|
|
588
|
+
// Switching branches
|
|
589
|
+
const branchName = (0, git_1.getCurrentBranch)();
|
|
590
|
+
console.log(chalk_1.default.green(`\n✓ Switched to branch: ${chalk_1.default.cyan(branchName)}\n`));
|
|
591
|
+
}
|
|
592
|
+
else if (cmd.includes('git branch') && cmd.includes('-D')) {
|
|
593
|
+
// Deleting a branch
|
|
594
|
+
const branchName = cmd.split('-D ')[1]?.split(' ')[0];
|
|
595
|
+
console.log(chalk_1.default.green(`\n✓ Deleted branch: ${chalk_1.default.cyan(branchName)}\n`));
|
|
596
|
+
}
|
|
597
|
+
else if (cmd.includes('git branch') && !cmd.includes('-D')) {
|
|
598
|
+
// Listing branches
|
|
599
|
+
if (output.trim()) {
|
|
600
|
+
console.log(chalk_1.default.cyan('\n' + output.trim() + '\n'));
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
else if (cmd.includes('git merge')) {
|
|
604
|
+
// Merging branches
|
|
605
|
+
console.log(chalk_1.default.green('\n✓ Merge completed\n'));
|
|
606
|
+
}
|
|
607
|
+
else if (cmd.includes('git stash')) {
|
|
608
|
+
// Stashing
|
|
609
|
+
if (cmd.includes('pop') || cmd.includes('apply')) {
|
|
610
|
+
console.log(chalk_1.default.green('\n✓ Stash applied\n'));
|
|
611
|
+
}
|
|
612
|
+
else {
|
|
613
|
+
console.log(chalk_1.default.green('\n✓ Changes stashed\n'));
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
else if (cmd.includes('git reset')) {
|
|
617
|
+
// Reset
|
|
618
|
+
console.log(chalk_1.default.green('\n✓ Reset complete\n'));
|
|
619
|
+
}
|
|
620
|
+
else if (cmd.includes('git revert')) {
|
|
621
|
+
// Revert
|
|
622
|
+
console.log(chalk_1.default.green('\n✓ Commit reverted\n'));
|
|
623
|
+
}
|
|
624
|
+
else if (cmd.includes('git tag')) {
|
|
625
|
+
// Tags
|
|
583
626
|
if (output.trim()) {
|
|
584
627
|
console.log(chalk_1.default.cyan('\n' + output.trim() + '\n'));
|
|
585
628
|
}
|
|
629
|
+
else {
|
|
630
|
+
console.log(chalk_1.default.green('\n✓ Tag created\n'));
|
|
631
|
+
}
|
|
586
632
|
}
|
|
587
633
|
else if (cmd.includes('git log')) {
|
|
588
634
|
console.log(chalk_1.default.cyan('\n' + output.trim() + '\n'));
|
package/dist/lib/github.js
CHANGED
|
@@ -33,14 +33,15 @@ function getCurrentRepo() {
|
|
|
33
33
|
try {
|
|
34
34
|
const remote = (0, child_process_1.execSync)('git remote get-url origin', { encoding: 'utf-8' }).trim();
|
|
35
35
|
// Parse GitHub URL (supports both HTTPS and SSH)
|
|
36
|
+
// Updated regex to support dots, underscores, and other chars in repo names
|
|
36
37
|
let match;
|
|
37
38
|
if (remote.startsWith('https://')) {
|
|
38
39
|
// https://github.com/owner/repo.git
|
|
39
|
-
match = remote.match(/github\.com[/:]([\w-]+)\/([\w
|
|
40
|
+
match = remote.match(/github\.com[/:]([\w-]+)\/([\w.-]+?)(\.git)?$/);
|
|
40
41
|
}
|
|
41
42
|
else {
|
|
42
43
|
// git@github.com:owner/repo.git
|
|
43
|
-
match = remote.match(/github\.com[/:]([\w-]+)\/([\w
|
|
44
|
+
match = remote.match(/github\.com[/:]([\w-]+)\/([\w.-]+?)(\.git)?$/);
|
|
44
45
|
}
|
|
45
46
|
if (match) {
|
|
46
47
|
return {
|