Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ sourceMapSupport.install();
export default function cli() {
process.on("unhandledRejection", console.log);
yargs(hideBin(process.argv))
.usage("$0 <cmd> [args]")
.usage("👻 $0 <cmd> [args]\n\nGhouls - Remove those pesky dead branches")
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would restore this to the way it was

.demandCommand()
.command(prunePullRequestsCommand)
.command(pruneLocalBranchesCommand)
Expand Down
4 changes: 2 additions & 2 deletions src/commands/PruneAll.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const pruneAllCommand: CommandModule = {
// but the actual API calls are made within the individual command handlers
createOctokitPlus();

console.log("🚀 Starting combined branch cleanup...\n");
console.log("👻 Starting combined branch cleanup...\n");

let remoteSuccess = false;
let localSuccess = false;
Expand Down Expand Up @@ -82,7 +82,7 @@ export const pruneAllCommand: CommandModule = {
console.log("\n⚠️ Cleanup completed with some errors.");
process.exit(0);
} else {
console.log("\n All cleanup operations completed successfully!");
console.log("\n👻 All cleanup operations completed successfully! 🎃");
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't use pumpkin. the theme is ghosts and death not Halloween

}
},
command: "all [--dry-run] [--force] [repo]",
Expand Down
14 changes: 7 additions & 7 deletions src/commands/PruneLocalBranches.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ describe('PruneLocalBranches', () => {

await pruneLocalBranchesCommand.handler!({ dryRun: false, _: [], $0: 'ghouls' });

expect(consoleLogSpy).toHaveBeenCalledWith('No local branches found.');
expect(consoleLogSpy).toHaveBeenCalledWith('👻 No local branches found.');
});

it('should handle no safe branches to delete', async () => {
Expand All @@ -340,7 +340,7 @@ describe('PruneLocalBranches', () => {

await pruneLocalBranchesCommand.handler!({ dryRun: false, _: [], $0: 'ghouls' });

expect(consoleLogSpy).toHaveBeenCalledWith('\nNo branches are safe to delete.');
expect(consoleLogSpy).toHaveBeenCalledWith('\n👻 No branches are safe to delete.');
expect(consoleLogSpy).toHaveBeenCalledWith('\nSkipping unsafe branches:');
expect(consoleLogSpy).toHaveBeenCalledWith(' - main (current branch)');
expect(consoleLogSpy).toHaveBeenCalledWith(' - develop (protected branch)');
Expand Down Expand Up @@ -373,8 +373,8 @@ describe('PruneLocalBranches', () => {

expect(mockedDeleteLocalBranch).toHaveBeenCalledWith('feature-1');
expect(mockedDeleteLocalBranch).toHaveBeenCalledWith('feature-2');
expect(consoleLogSpy).toHaveBeenCalledWith('Deleted: feature-1 (#1)');
expect(consoleLogSpy).toHaveBeenCalledWith('Deleted: feature-2 (#2)');
expect(consoleLogSpy).toHaveBeenCalledWith('💀 Deleted: feature-1 (#1)');
expect(consoleLogSpy).toHaveBeenCalledWith('💀 Deleted: feature-2 (#2)');
});

it('should simulate deletion in dry-run mode', async () => {
Expand Down Expand Up @@ -447,7 +447,7 @@ describe('PruneLocalBranches', () => {
await pruneLocalBranchesCommand.handler!({ dryRun: false, _: [], $0: 'ghouls' });

expect(consoleLogSpy).toHaveBeenCalledWith('Error deleting feature-1: Git deletion failed');
expect(consoleLogSpy).toHaveBeenCalledWith(' Successfully deleted: 0 branches');
expect(consoleLogSpy).toHaveBeenCalledWith(' 👻 Successfully deleted: 0 branches');
expect(consoleLogSpy).toHaveBeenCalledWith(' Errors: 1');
});

Expand Down Expand Up @@ -540,8 +540,8 @@ describe('PruneLocalBranches', () => {
// Verify the regular console.log calls still happen (for non-progress messages)
expect(consoleLogSpy).toHaveBeenCalledWith('\nScanning for local branches that can be safely deleted...');
expect(consoleLogSpy).toHaveBeenCalledWith('Found 1 local branches');
expect(consoleLogSpy).toHaveBeenCalledWith('\nDeleting 1 branch:');
expect(consoleLogSpy).toHaveBeenCalledWith(' Successfully deleted: 1 branch');
expect(consoleLogSpy).toHaveBeenCalledWith('\n💀 Deleting 1 branch:');
expect(consoleLogSpy).toHaveBeenCalledWith(' 👻 Successfully deleted: 1 branch');
});
});
});
Expand Down
14 changes: 7 additions & 7 deletions src/commands/PruneLocalBranches.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ class PruneLocalBranches {
console.log(`Found ${localBranches.length} local branches`);

if (localBranches.length === 0) {
console.log("No local branches found.");
console.log("👻 No local branches found.");
return;
}

Expand All @@ -135,7 +135,7 @@ class PruneLocalBranches {
}

if (safeBranches.length === 0) {
console.log("\nNo branches are safe to delete.");
console.log("\n👻 No branches are safe to delete.");
return;
}

Expand All @@ -158,14 +158,14 @@ class PruneLocalBranches {
{
type: 'checkbox',
name: 'selectedBranches',
message: 'Select branches to delete:',
message: '👻 Select branches to delete:',
choices,
pageSize: 20
}
]);

if (selectedBranches.length === 0) {
console.log("\nNo branches selected for deletion.");
console.log("\n👻 No branches selected for deletion.");
return;
}

Expand All @@ -175,7 +175,7 @@ class PruneLocalBranches {
}

// Show what will be deleted
console.log(`\n${this.dryRun ? 'Would delete' : 'Deleting'} ${branchesToDelete.length} branch${branchesToDelete.length === 1 ? '' : 'es'}:`);
console.log(`\n💀 ${this.dryRun ? 'Would delete' : 'Deleting'} ${branchesToDelete.length} branch${branchesToDelete.length === 1 ? '' : 'es'}:`);

// Use progress bar only if we have a TTY, otherwise use simple logging
const isTTY = process.stderr.isTTY;
Expand Down Expand Up @@ -209,7 +209,7 @@ class PruneLocalBranches {
}
} else {
deleteLocalBranch(branch.name);
const message = `Deleted: ${branch.name} (${prInfo})`;
const message = `💀 Deleted: ${branch.name} (${prInfo})`;
if (bar) {
bar.interrupt(message);
} else {
Expand Down Expand Up @@ -238,7 +238,7 @@ class PruneLocalBranches {
if (this.dryRun) {
console.log(` Would delete: ${deletedCount} branch${deletedCount === 1 ? '' : 'es'}`);
} else {
console.log(` Successfully deleted: ${deletedCount} branch${deletedCount === 1 ? '' : 'es'}`);
console.log(` 👻 Successfully deleted: ${deletedCount} branch${deletedCount === 1 ? '' : 'es'}`);
}

if (errorCount > 0) {
Expand Down
12 changes: 6 additions & 6 deletions src/commands/PrunePullRequests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class PrunePullRequest {
const branchesToDelete = await this.collectDeletableBranches();

if (branchesToDelete.length === 0) {
console.log("\nNo branches found that can be safely deleted.");
console.log("\n👻 No branches found that can be safely deleted.");
return;
}

Expand All @@ -123,14 +123,14 @@ class PrunePullRequest {
{
type: 'checkbox',
name: 'selected',
message: 'Select remote branches to delete:',
message: '👻 Select remote branches to delete:',
choices,
pageSize: 20
}
]);

if (selected.length === 0) {
console.log("\nNo branches selected for deletion.");
console.log("\n👻 No branches selected for deletion.");
return;
}

Expand All @@ -140,7 +140,7 @@ class PrunePullRequest {
}

// Delete selected branches
console.log(`\n${this.dryRun ? 'Would delete' : 'Deleting'} ${selectedBranches.length} branch${selectedBranches.length === 1 ? '' : 'es'}:`);
console.log(`\n💀 ${this.dryRun ? 'Would delete' : 'Deleting'} ${selectedBranches.length} branch${selectedBranches.length === 1 ? '' : 'es'}:`);

const bar = new ProgressBar(":bar :branch (:current/:total)", {
total: selectedBranches.length,
Expand All @@ -158,7 +158,7 @@ class PrunePullRequest {
bar.interrupt(`[DRY RUN] Would delete: ${ref} (PR #${pr.number})`);
} else {
await this.octokitPlus.deleteReference(pr.head);
bar.interrupt(`Deleted: ${ref} (PR #${pr.number})`);
bar.interrupt(`💀 Deleted: ${ref} (PR #${pr.number})`);
}
deletedCount++;
} catch (error) {
Expand All @@ -175,7 +175,7 @@ class PrunePullRequest {
if (this.dryRun) {
console.log(` Would delete: ${deletedCount} branch${deletedCount === 1 ? '' : 'es'}`);
} else {
console.log(` Successfully deleted: ${deletedCount} branch${deletedCount === 1 ? '' : 'es'}`);
console.log(` 👻 Successfully deleted: ${deletedCount} branch${deletedCount === 1 ? '' : 'es'}`);
}

if (errorCount > 0) {
Expand Down