Skip to content

feat: exclude documentation files from command installation#19

Merged
hiragram merged 1 commit into
hiragram:mainfrom
syou6162:feat/add_not_include_readme
Aug 4, 2025
Merged

feat: exclude documentation files from command installation#19
hiragram merged 1 commit into
hiragram:mainfrom
syou6162:feat/add_not_include_readme

Conversation

@syou6162

@syou6162 syou6162 commented Jul 30, 2025

Copy link
Copy Markdown
Contributor

This PR adds functionality to automatically exclude documentation files (README.md and CLAUDE.md) from being installed as slash commands when using cccsc add user/repo.

Background

First of all, thank you for creating such a wonderful CLI tool. I use it daily and find it extremely helpful. I've been using it to manage my custom slash commands at https://github.com/syou6162/claude-code-commands.

The Problem

When installing slash commands with:

npx cccsc add --global syou6162/claude-code-commands

The installation succeeds, but README.md and CLAUDE.md files appear in the slash command autocomplete suggestions:

│ > /                                                                │
╰────────────────────────────────────────────────────────────────────╯
  /cccsc:syou6162:claude-code-commands:CLAUDE         CLAUDE.md (user)
  /cccsc:syou6162:claude-code-commands:estimate_pr_size    Pull Requestのサイズ見積もりと分割提案 (user)
  /cccsc:syou6162:claude-code-commands:README         claude-code-commands (user)

These documentation files are not meant to be slash commands and clutter the autocomplete list.

Changes

  • Add shouldExcludeFile utility function to identify documentation files
  • Integrate exclusion logic into findMarkdownFiles to filter out README and CLAUDE files
  • Add comprehensive test coverage for the exclusion functionality
  • Support case-insensitive matching only (no hyphen/underscore normalization)

Implementation Details

The exclusion is applied by default without requiring any configuration. The implementation:

  • Performs simple case-insensitive comparison for README and CLAUDE files
  • Excludes only README and CLAUDE files, allowing other documentation like CHANGELOG to be used as commands if needed
  • Maintains backward compatibility for existing installations

Breaking Change Consideration

This is a breaking change that alters the default behavior. I considered:

  1. Maintaining existing behavior with opt-in exclusion
  2. Adding configuration flags to control exclusion

However, given the purpose of this tool (managing Claude Code slash commands), excluding documentation files by default seems more appropriate. Documentation files are rarely, if ever, intended as executable commands.

If you prefer a non-breaking approach with configuration options, I'm happy to revise the implementation accordingly.

Testing

Added unit tests to verify:

  • README and CLAUDE files are excluded in various naming conventions
  • Command files are not affected
  • Invalid input handling works correctly

This change improves the user experience by preventing accidental installation of documentation files as commands.

@syou6162 syou6162 changed the title Feat/add not include readme feat: exclude documentation files from command installation Jul 30, 2025
Add functionality to automatically exclude README.md and CLAUDE.md files
from being installed as slash commands when using 'cccsc add user/repo'.

Changes:
- Add shouldExcludeFile function to filter documentation files
- Integrate exclusion logic into findMarkdownFiles
- Support case-insensitive matching
- Add comprehensive test coverage
- Simplify file name normalization (remove hyphen/underscore conversion)

This prevents documentation files from cluttering the slash command
autocomplete list, improving user experience.
@syou6162
syou6162 force-pushed the feat/add_not_include_readme branch from 4708fa6 to 454508c Compare July 30, 2025 22:48
@syou6162
syou6162 marked this pull request as ready for review July 30, 2025 22:53
@hiragram

hiragram commented Aug 4, 2025

Copy link
Copy Markdown
Owner

@syou6162 Thank you for your contribution!

@hiragram
hiragram merged commit 2d5ea42 into hiragram:main Aug 4, 2025
4 checks passed
@syou6162
syou6162 deleted the feat/add_not_include_readme branch August 4, 2025 14:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants