nitor 1.3.2 → 1.3.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.
- package/package.json +1 -1
- package/services/cleanup.js +12 -8
- package/services/process-commands.js +2 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nitor",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.3",
|
|
4
4
|
"description": "A comprehensive CLI toolkit for automating GitLab operations, AI-powered code review, build/deploy automation, MongoDB backup/restore, and developer productivity tools",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"author": "Nithin V <mails2nithin@gmail.com>",
|
package/services/cleanup.js
CHANGED
|
@@ -15,15 +15,15 @@ const cleanup = async () => {
|
|
|
15
15
|
|
|
16
16
|
// Get current branch
|
|
17
17
|
const currentBranch = execSync('git branch --show-current', execOptions).trim();
|
|
18
|
-
console.log(`Current branch: ${currentBranch}`);
|
|
19
18
|
|
|
20
|
-
|
|
19
|
+
console.log(`Current branch: ${currentBranch}`);
|
|
21
20
|
console.log('\nChecking out to master branch...');
|
|
22
21
|
try {
|
|
23
22
|
execSync('git checkout master', execOptionsInherit);
|
|
24
23
|
} catch (error) {
|
|
25
24
|
// Try main if master doesn't exist
|
|
26
25
|
console.log('Master branch not found, trying main...');
|
|
26
|
+
|
|
27
27
|
execSync('git checkout main', execOptionsInherit);
|
|
28
28
|
}
|
|
29
29
|
|
|
@@ -40,28 +40,32 @@ const cleanup = async () => {
|
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
console.log(`\nFound ${branches.length} branch(es) to delete:`);
|
|
43
|
-
|
|
44
|
-
// Delete each branch
|
|
45
43
|
console.log('\nDeleting branches...');
|
|
44
|
+
|
|
46
45
|
let deletedCount = 0;
|
|
47
46
|
let failedCount = 0;
|
|
48
47
|
|
|
49
48
|
for (const branch of branches) {
|
|
50
49
|
try {
|
|
51
50
|
execSync(`git branch -D ${branch}`, execOptions);
|
|
52
|
-
|
|
51
|
+
execSync(`rm -rf ~/.git/logs/refs/heads/${branch}`, execOptions);
|
|
52
|
+
execSync(`rm -rf ~/.git/refs/heads/${branch}`, execOptions);
|
|
53
|
+
|
|
54
|
+
console.log(`Deleted: ${branch}`);
|
|
55
|
+
|
|
53
56
|
deletedCount++;
|
|
54
57
|
} catch (error) {
|
|
55
|
-
console.log(`
|
|
58
|
+
console.log(`Failed to delete: ${branch}`);
|
|
59
|
+
|
|
56
60
|
failedCount++;
|
|
57
61
|
}
|
|
58
62
|
}
|
|
59
63
|
|
|
60
64
|
console.log(`\nCleanup complete!`);
|
|
61
|
-
console.log(`
|
|
65
|
+
console.log(`Deleted: ${deletedCount} branch(es)`);
|
|
62
66
|
|
|
63
67
|
if (failedCount > 0) {
|
|
64
|
-
console.log(`
|
|
68
|
+
console.log(`Failed: ${failedCount} branch(es)`);
|
|
65
69
|
}
|
|
66
70
|
} catch (error) {
|
|
67
71
|
console.error('Error during cleanup:', error.message);
|