Skip to content

Commit e16d5b3

Browse files
semsem
authored andcommitted
feat: Add visual status indicators to list and status commands
- Added colored dots to show hook status (enabled/disabled/not installed) - Enhanced list command with visual indicators - Improved status command with detailed counts by state - Added status indicators to interactive menu selections - Better visual feedback for hook management
1 parent f5fdfdb commit e16d5b3

5 files changed

Lines changed: 68 additions & 12 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
![npm version](https://img.shields.io/npm/v/claude-code-hooks.svg)
55
![npm downloads](https://img.shields.io/npm/dm/claude-code-hooks.svg)
6-
![Version](https://img.shields.io/badge/version-2.2.0-blue.svg)
6+
![Version](https://img.shields.io/badge/version-2.2.1-blue.svg)
77
![License](https://img.shields.io/badge/license-MIT-green.svg)
88
![Hooks](https://img.shields.io/badge/hooks-17-orange.svg)
99
![Python](https://img.shields.io/badge/python-3.6+-blue.svg)

docs/CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,22 @@ All notable changes to Claude Code Hooks will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [2.2.1] - 2025-01-03
9+
10+
### 🎨 UI Enhancements
11+
12+
### Added
13+
- Visual status indicators in `list` command showing enabled/disabled/not installed hooks
14+
- 🟢 Green dot for enabled hooks
15+
- 🔴 Red dot for disabled hooks
16+
- ⚪ Gray circle for not installed hooks
17+
- Enhanced `status` command with detailed hook counts by state
18+
- Status indicators in interactive menu selections
19+
20+
### Improved
21+
- Better visual feedback for hook management
22+
- Clearer understanding of which hooks are active
23+
824
## [2.2.0] - 2025-01-03
925

1026
### 🛠️ Complete Hook Management Suite

index.js

Lines changed: 48 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -291,15 +291,32 @@ async function promptToContinue() {
291291
}
292292

293293
async function selectAndShowHookInfo() {
294+
const hooksDir = path.join(process.env.HOME, '.claude', 'hooks');
295+
294296
const { hookName } = await inquirer.prompt([
295297
{
296298
type: 'list',
297299
name: 'hookName',
298300
message: 'Select a hook to learn more:',
299-
choices: Object.keys(hooks).map(name => ({
300-
name: `${name} - ${hooks[name].description}`,
301-
value: name
302-
}))
301+
choices: Object.keys(hooks).map(name => {
302+
// Check status
303+
const hookPath = path.join(hooksDir, `${name}.py`);
304+
const disabledPath = path.join(hooksDir, `${name}.py.disabled`);
305+
306+
let status = '';
307+
if (fs.existsSync(hookPath)) {
308+
status = chalk.green('●') + ' ';
309+
} else if (fs.existsSync(disabledPath)) {
310+
status = chalk.red('●') + ' ';
311+
} else {
312+
status = chalk.gray('○') + ' ';
313+
}
314+
315+
return {
316+
name: `${status}${name} - ${hooks[name].description}`,
317+
value: name
318+
};
319+
})
303320
}
304321
]);
305322

@@ -430,9 +447,27 @@ async function selectAndRemoveHook() {
430447

431448
function listHooks() {
432449
console.log(chalk.cyan('\nAvailable Claude Code Hooks:\n'));
450+
451+
const hooksDir = path.join(process.env.HOME, '.claude', 'hooks');
452+
433453
Object.entries(hooks).forEach(([name, info]) => {
434-
console.log(chalk.yellow(` ${name}.py`.padEnd(35)) + chalk.gray(info.description));
454+
// Check if hook is enabled or disabled
455+
const hookPath = path.join(hooksDir, `${name}.py`);
456+
const disabledPath = path.join(hooksDir, `${name}.py.disabled`);
457+
458+
let status = '';
459+
if (fs.existsSync(hookPath)) {
460+
status = chalk.green('●') + ' '; // Green dot for enabled
461+
} else if (fs.existsSync(disabledPath)) {
462+
status = chalk.red('●') + ' '; // Red dot for disabled
463+
} else {
464+
status = chalk.gray('○') + ' '; // Gray circle for not installed
465+
}
466+
467+
console.log(` ${status}${chalk.yellow(`${name}.py`.padEnd(33))} ${chalk.gray(info.description)}`);
435468
});
469+
470+
console.log('\n' + chalk.gray(' ● Enabled ● Disabled ○ Not Installed'));
436471
console.log();
437472
}
438473

@@ -484,9 +519,14 @@ async function showStatus() {
484519
if (fs.existsSync(hooksDir)) {
485520
console.log(chalk.green('✅ Hooks directory exists'));
486521

487-
// Count installed hooks
488-
const installedHooks = fs.readdirSync(hooksDir).filter(f => f.endsWith('.py'));
489-
console.log(chalk.gray(` ${installedHooks.length} hooks installed`));
522+
// Count hooks by status
523+
const allFiles = fs.readdirSync(hooksDir);
524+
const enabledHooks = allFiles.filter(f => f.endsWith('.py') && !f.endsWith('.disabled'));
525+
const disabledHooks = allFiles.filter(f => f.endsWith('.py.disabled'));
526+
527+
console.log(chalk.gray(` ${chalk.green('●')} ${enabledHooks.length} hooks enabled`));
528+
console.log(chalk.gray(` ${chalk.red('●')} ${disabledHooks.length} hooks disabled`));
529+
console.log(chalk.gray(` ${enabledHooks.length + disabledHooks.length} total hooks installed`));
490530
} else {
491531
console.log(chalk.red('❌ Hooks directory not found'));
492532
console.log(chalk.gray(' Run "claude-hooks install" to set up'));

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "claude-code-hooks",
3-
"version": "2.2.0",
3+
"version": "2.2.1",
44
"description": "A comprehensive collection of hooks for Claude Code that enforce coding standards, maintain consistency, and automate workflow tasks",
55
"main": "index.js",
66
"bin": {

0 commit comments

Comments
 (0)