Skip to content

Commit 903734f

Browse files
davila7claude
andcommitted
🔧 Fix installation success count when some locations fail
- Add successfulInstallations counter to track actual successful installations - Show accurate count in summary messages instead of total attempted - Differentiate between complete success and partial success: - 🎉 Green message when all locations successful - ⚠️ Yellow message when some locations failed - ❌ Red details showing number of failed installations - Prevents misleading 'successfully installed in 4 location(s)!' when only 3 succeeded Example outputs: ✅ All successful: '🎉 Setting installed in 3 location(s)!' ⚠️ Partial success: '⚠️ Setting installed in 3 of 4 location(s).' '❌ 1 installation(s) failed due to permission or other errors.' Fixes the case where enterprise settings fail due to permission denied but user still sees success message for all locations. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 9c59450 commit 903734f

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

cli-tool/src/index.js

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -625,6 +625,7 @@ async function installIndividualSetting(settingName, targetDir, options) {
625625
}
626626

627627
// Install the setting in each selected location
628+
let successfulInstallations = 0;
628629
for (const installLocation of installLocations) {
629630
console.log(chalk.blue(`\n📍 Installing "${settingName}" in ${installLocation} settings...`));
630631

@@ -792,11 +793,20 @@ async function installIndividualSetting(settingName, targetDir, options) {
792793
merged_with_existing: Object.keys(existingConfig).length > 0,
793794
source: 'github_main'
794795
});
796+
797+
// Increment successful installations counter
798+
successfulInstallations++;
795799
}
796800

797801
// Summary after all installations
798802
if (!options.silent) {
799-
console.log(chalk.green(`\n🎉 Setting "${settingName}" successfully installed in ${installLocations.length} location(s)!`));
803+
if (successfulInstallations === installLocations.length) {
804+
console.log(chalk.green(`\n🎉 Setting "${settingName}" successfully installed in ${successfulInstallations} location(s)!`));
805+
} else {
806+
console.log(chalk.yellow(`\n⚠️ Setting "${settingName}" installed in ${successfulInstallations} of ${installLocations.length} location(s).`));
807+
const failedCount = installLocations.length - successfulInstallations;
808+
console.log(chalk.red(`❌ ${failedCount} installation(s) failed due to permission or other errors.`));
809+
}
800810
}
801811

802812
} catch (error) {
@@ -877,6 +887,7 @@ async function installIndividualHook(hookName, targetDir, options) {
877887
}
878888

879889
// Install the hook in each selected location
890+
let successfulInstallations = 0;
880891
for (const installLocation of installLocations) {
881892
console.log(chalk.blue(`\n📍 Installing "${hookName}" in ${installLocation} settings...`));
882893

@@ -1039,11 +1050,20 @@ async function installIndividualHook(hookName, targetDir, options) {
10391050
merged_with_existing: Object.keys(existingConfig).length > 0,
10401051
source: 'github_main'
10411052
});
1053+
1054+
// Increment successful installations counter
1055+
successfulInstallations++;
10421056
}
10431057

10441058
// Summary after all installations
10451059
if (!options.silent) {
1046-
console.log(chalk.green(`\n🎉 Hook "${hookName}" successfully installed in ${installLocations.length} location(s)!`));
1060+
if (successfulInstallations === installLocations.length) {
1061+
console.log(chalk.green(`\n🎉 Hook "${hookName}" successfully installed in ${successfulInstallations} location(s)!`));
1062+
} else {
1063+
console.log(chalk.yellow(`\n⚠️ Hook "${hookName}" installed in ${successfulInstallations} of ${installLocations.length} location(s).`));
1064+
const failedCount = installLocations.length - successfulInstallations;
1065+
console.log(chalk.red(`❌ ${failedCount} installation(s) failed due to permission or other errors.`));
1066+
}
10471067
}
10481068

10491069
} catch (error) {

0 commit comments

Comments
 (0)