cc-md-search-cli 1.0.0 → 1.0.2

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/CHANGELOG.md ADDED
@@ -0,0 +1,62 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ ## [1.0.2] - 2026-01-17
6
+
7
+ ### Changed
8
+ - Reorganized installation section with grouped options (Bun, NPM, Clone Repository)
9
+ - Added package location paths for each installation method
10
+ - Added guidance for locating skill and rule template files
11
+ - Clarified automatic CLI registration for global installs
12
+
13
+ ### Fixed
14
+ - Fixed missing `-g` flag for npm global install command
15
+
16
+ ### Added
17
+ - Header image to README
18
+
19
+ ## [1.0.1] - 2026-01-17
20
+
21
+ ### Added
22
+ - New `outline` command - show document structure (headings only) without loading content
23
+ - New `section` command - extract specific sections by heading name
24
+ - New `grep` command alias - regex pattern matching with smart context
25
+ - Smart context extraction - preserves code blocks and respects paragraph boundaries
26
+ - Heading path display (e.g., `## Setup > ### Prerequisites`) for grep matches
27
+ - Adaptive preview lengths for search results (600/300/150 chars based on rank)
28
+ - Frontmatter filtering - only includes useful fields (title, description, tags, etc.)
29
+ - `--raw` flag to disable context optimizations when needed
30
+ - Multi-directory search support
31
+ - New `CONFIGURATION.md` guide for documentation path setup
32
+ - Cursor rules file (`rules/docs-search.mdc`) for IDE integration
33
+ - Comprehensive test suite with 1900+ lines of tests
34
+ - Test fixtures for various markdown scenarios
35
+
36
+ ### Changed
37
+ - Shebang changed from `node` to `bun` for improved performance
38
+ - Enhanced skill file with detailed usage examples and context-efficient patterns
39
+ - Expanded README with full command reference and examples
40
+ - Improved skill template for easier customization
41
+
42
+ ### Fixed
43
+ - Context deduplication for overlapping grep matches
44
+
45
+ ## [1.0.0] - 2026-01-17
46
+
47
+ ### Added
48
+ - Initial release of Claude Code Markdown Search CLI
49
+ - Fuzzy search functionality using Fuse.js for flexible text matching
50
+ - Regex pattern matching support for precise searches
51
+ - Recursive directory scanning for markdown files
52
+ - YAML frontmatter parsing via gray-matter
53
+ - Multiple output formats: `plain`, `json`, `minimal`
54
+ - Context-efficient output designed for AI assistant integration
55
+ - Support for `.md` and `.mdx` file extensions
56
+ - CLI commands: `search`, `list`, `stats`
57
+ - Configurable search options (depth, limit, threshold)
58
+ - Claude Code skill integration (`md-search`)
59
+
60
+ [1.0.2]: https://github.com/bjeber/cc-md-search-cli/compare/v1.0.1...v1.0.2
61
+ [1.0.1]: https://github.com/bjeber/cc-md-search-cli/compare/v1.0.0...v1.0.1
62
+ [1.0.0]: https://github.com/bjeber/cc-md-search-cli/releases/tag/v1.0.0
package/CONFIGURATION.md CHANGED
@@ -54,6 +54,9 @@ cp skills/SKILL.md ~/.claude/skills/md-search.md
54
54
  # Test that the CLI can find your docs
55
55
  ccmds list ./docs
56
56
 
57
+ # View document structure
58
+ ccmds outline ./docs -d 2
59
+
57
60
  # Try a search
58
61
  ccmds find "setup" ./docs -l 5
59
62
  ```
@@ -100,6 +103,35 @@ Once configured, Claude Code will **automatically search** your documentation wh
100
103
 
101
104
  **No manual path specification needed!**
102
105
 
106
+ ## Context Efficiency Features
107
+
108
+ The CLI includes several optimizations to reduce AI context usage by 30-50%:
109
+
110
+ ### Smart Context (grep)
111
+ - **Code block preservation** - Returns full code blocks when match is inside one
112
+ - **Paragraph boundaries** - Stops at blank lines instead of arbitrary line counts
113
+ - **Heading paths** - Shows `## Setup > ### Prerequisites` for each match
114
+ - **Deduplication** - Overlapping matches are merged
115
+
116
+ ### Adaptive Previews (find)
117
+ - Top 3 results: 600 characters
118
+ - Results 4-7: 300 characters
119
+ - Remaining: 150 characters
120
+
121
+ ### Frontmatter Filtering
122
+ Only includes useful fields: `title`, `description`, `tags`, `category`, `summary`, `keywords`
123
+
124
+ ### New Commands for Targeted Access
125
+ - `ccmds outline` - View structure without loading content
126
+ - `ccmds section` - Extract only the section you need
127
+
128
+ ### Opt-out with --raw
129
+ Use `--raw` flag to disable optimizations if needed:
130
+ ```bash
131
+ ccmds grep "pattern" ./docs --raw -c 3 # Line-based context
132
+ ccmds find "query" ./docs --raw # Full frontmatter, fixed previews
133
+ ```
134
+
103
135
  ## Recommended Documentation Structure
104
136
 
105
137
  Organize your docs for best search results:
package/README.md CHANGED
@@ -1,16 +1,24 @@
1
+ ![CC-MD-Search-CLI](assets/header.png)
2
+
1
3
  # CC-MD-Search-CLI
2
4
 
3
- **Claude Code Markdown Search - Efficient documentation search CLI for Claude Code integration**
5
+ **Claude Code Markdown Search - Efficient documentation search CLI for AI coding assistants**
4
6
 
5
- Fast, context-efficient markdown documentation search tool designed for [Claude Code](https://claude.ai/claude-code). Quickly find relevant information across large documentation sets without loading entire files into context.
7
+ Fast, context-efficient markdown documentation search tool designed for [Claude Code](https://claude.ai/claude-code) and [Cursor IDE](https://cursor.com). Quickly find relevant information across large documentation sets without loading entire files into context.
6
8
 
7
9
  ## Features
8
10
 
9
11
  - **Fuzzy Search** - Find relevant docs even with typos or variations
10
12
  - **Pattern/Regex Search** - Exact matches with regex support
13
+ - **Smart Context** - Paragraph and code-block aware context extraction
14
+ - **Heading Paths** - Shows parent heading hierarchy for each match
15
+ - **Document Outlines** - View document structure without content
16
+ - **Section Extraction** - Fetch specific sections by heading
11
17
  - **Frontmatter Aware** - Parses YAML metadata for better search
18
+ - **Adaptive Previews** - Top results get longer previews automatically
12
19
  - **Multiple Output Modes** - compact, detailed, files, json
13
- - **Claude Code Skill** - Pre-built skill template for AI integration
20
+ - **Claude Code Skill** - Pre-built skill template for Claude Code integration
21
+ - **Cursor Rule** - Pre-built rule template for Cursor IDE integration
14
22
  - **Context Efficient** - Minimize token usage when searching docs
15
23
 
16
24
  ## Installation
@@ -20,10 +28,29 @@ Fast, context-efficient markdown documentation search tool designed for [Claude
20
28
  - [Bun](https://bun.sh/) (recommended) or Node.js 18+
21
29
  - npm or pnpm
22
30
 
23
- ### Install
31
+ ### Option 1: Bun (Recommended)
32
+
33
+ ```bash
34
+ bun add -g cc-md-search-cli
35
+ ```
36
+
37
+ The `ccmds` command is automatically registered globally.
38
+
39
+ **Package location:** `~/.bun/install/global/node_modules/cc-md-search-cli/`
40
+
41
+ ### Option 2: NPM
42
+
43
+ ```bash
44
+ npm i -g cc-md-search-cli
45
+ ```
46
+
47
+ The `ccmds` command is automatically registered globally.
48
+
49
+ **Package location:** Run `npm root -g` to find the path (typically `/usr/local/lib/node_modules/cc-md-search-cli/` or `~/.npm-global/lib/node_modules/cc-md-search-cli/`)
50
+
51
+ ### Option 3: Clone Repository
24
52
 
25
53
  ```bash
26
- # Clone the repository
27
54
  git clone https://github.com/bjeber/cc-md-search-cli.git
28
55
  cd cc-md-search-cli
29
56
 
@@ -31,11 +58,15 @@ cd cc-md-search-cli
31
58
  bun install
32
59
  # or: npm install
33
60
 
34
- # Link the CLI globally
61
+ # Link the CLI globally (required for cloned repos)
35
62
  npm link
36
63
  ```
37
64
 
38
- After linking, the `ccmds` command will be available globally.
65
+ **Package location:** Your cloned directory
66
+
67
+ **Skill & Rule files** are located in the package directory:
68
+ - `skills/SKILL.md` - Claude Code skill template
69
+ - `rules/docs-search.mdc` - Cursor IDE rule template
39
70
 
40
71
  ## Quick Start
41
72
 
@@ -43,11 +74,29 @@ After linking, the `ccmds` command will be available globally.
43
74
  # List all markdown files in a directory
44
75
  ccmds list ./docs
45
76
 
77
+ # List files from multiple directories
78
+ ccmds list ./docs ./api/docs ./guides
79
+
46
80
  # Fuzzy search for relevant documents
47
81
  ccmds find "authentication" ./docs -l 5
48
82
 
49
- # Pattern search with regex
50
- ccmds grep "TODO|FIXME" ./docs -c 3
83
+ # Search across multiple directories
84
+ ccmds find "authentication" ./docs ./api/docs ./guides -l 5
85
+
86
+ # Pattern search with regex (smart context preserves code blocks)
87
+ ccmds grep "TODO|FIXME" ./docs
88
+
89
+ # Grep across multiple directories
90
+ ccmds grep "TODO|FIXME" ./docs ./api/docs
91
+
92
+ # View document structure without content
93
+ ccmds outline ./docs
94
+
95
+ # View structure across multiple directories
96
+ ccmds outline ./docs ./api/docs -d 2
97
+
98
+ # Extract a specific section by heading
99
+ ccmds section ./docs/setup.md "Installation"
51
100
 
52
101
  # Show a specific file
53
102
  ccmds show ./docs/api/auth.md
@@ -55,36 +104,50 @@ ccmds show ./docs/api/auth.md
55
104
 
56
105
  ## Commands
57
106
 
58
- ### `ccmds find <query> [directory]` - Fuzzy Search
107
+ ### `ccmds find <query> [directories...]` - Fuzzy Search
108
+
109
+ Find relevant documents using fuzzy matching with extended search syntax. Great for exploratory searches. Features adaptive preview lengths (top results get more content) and filtered frontmatter. Supports searching across multiple directories simultaneously.
59
110
 
60
- Find relevant documents using fuzzy matching. Great for exploratory searches.
111
+ **Extended Search Syntax:**
112
+ | Pattern | Meaning | Example |
113
+ |---------|---------|---------|
114
+ | `word1 word2` | AND (all must match) | `auth setup` |
115
+ | `word1 \| word2` | OR (either matches) | `install \| setup` |
116
+ | `'exact` | Exact substring | `'authentication` |
117
+ | `^prefix` | Starts with | `^Config` |
118
+ | `suffix$` | Ends with | `Guide$` |
61
119
 
62
120
  ```bash
63
- ccmds find "user authentication" ./docs -l 5 -o compact
64
- ccmds find "deploy production" ./docs -o files
121
+ ccmds find "authentication middleware" ./docs -l 5 # AND search
122
+ ccmds find "setup | installation" ./docs # OR search
123
+ ccmds find "'API Reference" ./docs -o files # Exact match
124
+ ccmds find "deploy" ./docs --raw # Disable optimizations
65
125
  ```
66
126
 
67
127
  **Options:**
68
128
  - `-l, --limit <number>` - Maximum results (default: 10)
69
129
  - `-o, --output <mode>` - Output format: compact, detailed, files, json
130
+ - `-r, --raw` - Disable adaptive previews and frontmatter filtering
70
131
 
71
- ### `ccmds grep <pattern> [directory]` - Pattern Search
132
+ ### `ccmds grep <pattern> [directories...]` - Pattern Search
72
133
 
73
- Search for exact text patterns with regex support.
134
+ Search for exact text patterns with regex support. Uses smart context that preserves code blocks and paragraph boundaries, and shows heading paths for each match. Supports searching across multiple directories simultaneously.
74
135
 
75
136
  ```bash
76
- ccmds grep "ERROR_[0-9]+" ./docs -c 3
137
+ ccmds grep "ERROR_[0-9]+" ./docs
77
138
  ccmds grep "GraphQL" ./docs --case-sensitive
139
+ ccmds grep "TODO" ./docs --raw -c 3 # Line-based context instead
78
140
  ```
79
141
 
80
142
  **Options:**
81
- - `-c, --context <lines>` - Lines of context around matches (default: 2)
143
+ - `-c, --context <lines>` - Lines of context around matches (default: 2, used with --raw)
82
144
  - `-s, --case-sensitive` - Case sensitive search
83
145
  - `-o, --output <mode>` - Output format
146
+ - `-r, --raw` - Disable smart context (use line-based context)
84
147
 
85
- ### `ccmds list [directory]` - List Files
148
+ ### `ccmds list [directories...]` - List Files
86
149
 
87
- List all markdown files in a directory.
150
+ List all markdown files in one or more directories.
88
151
 
89
152
  ```bash
90
153
  ccmds list ./docs
@@ -108,6 +171,35 @@ ccmds show ./docs/guide.md --body-only
108
171
  - `-f, --frontmatter-only` - Show only YAML frontmatter
109
172
  - `-b, --body-only` - Show only body content
110
173
 
174
+ ### `ccmds outline [paths...]` - Document Structure
175
+
176
+ Show document structure (headings only) without content. Great for understanding document organization. Supports files, directories, or multiple paths.
177
+
178
+ ```bash
179
+ ccmds outline ./docs/guide.md # Single file
180
+ ccmds outline ./docs # All files in directory
181
+ ccmds outline ./docs -d 2 # Limit to h1 and h2
182
+ ccmds outline ./docs -o json # JSON output
183
+ ```
184
+
185
+ **Options:**
186
+ - `-d, --depth <number>` - Maximum heading depth (default: 6)
187
+ - `-o, --output <mode>` - Output format: text, json
188
+
189
+ ### `ccmds section <file> <heading>` - Extract Section
190
+
191
+ Extract a specific section by heading text. Useful for fetching just the content you need.
192
+
193
+ ```bash
194
+ ccmds section ./docs/setup.md "Installation"
195
+ ccmds section ./docs/api.md "Authentication"
196
+ ccmds section ./docs/guide.md "Setup > Prerequisites" # Nested heading
197
+ ccmds section ./docs/api.md "Endpoints" -o json
198
+ ```
199
+
200
+ **Options:**
201
+ - `-o, --output <mode>` - Output format: text, json
202
+
111
203
  ## Claude Code Integration
112
204
 
113
205
  To use this tool with Claude Code, install the skill to your Claude Code skills directory.
@@ -147,6 +239,58 @@ The SKILL.md includes:
147
239
  - **Workflow strategies** for efficient documentation search
148
240
  - **Best practices** for context-efficient searches
149
241
 
242
+ ## Cursor Integration
243
+
244
+ To use this tool with Cursor IDE, install the rule to your project's `.cursor/rules/` directory.
245
+
246
+ ### 1. Install the Rule
247
+
248
+ ```bash
249
+ # Create the rules directory in your project
250
+ mkdir -p .cursor/rules
251
+
252
+ # Copy the rule file
253
+ cp rules/docs-search.mdc .cursor/rules/docs-search.mdc
254
+ ```
255
+
256
+ ### 2. Configure Your Docs Path
257
+
258
+ Edit `.cursor/rules/docs-search.mdc` and update the `DOCS_PATH` variable at the top:
259
+
260
+ ```markdown
261
+ ## Configuration
262
+
263
+ **DOCS_PATH**: `./docs` # Change this to your docs directory
264
+ ```
265
+
266
+ Replace `./docs` with your actual documentation path (e.g., `./documentation`, `./docs/api`, etc.).
267
+
268
+ ### 3. Use with Cursor
269
+
270
+ Once installed, Cursor will automatically include this rule when relevant (Agent Requested mode). The rule activates when you ask questions about documentation:
271
+
272
+ - "How do I set up authentication?"
273
+ - "What are the API endpoints?"
274
+ - "Where is the deployment guide?"
275
+
276
+ Cursor will use `ccmds` to search your documentation with minimal context usage.
277
+
278
+ ### 4. Rule Structure
279
+
280
+ The rule follows Cursor's `.mdc` format:
281
+
282
+ ```
283
+ .cursor/rules/
284
+ └── docs-search.mdc # Rule definition with YAML frontmatter
285
+ ```
286
+
287
+ The rule includes:
288
+ - **YAML frontmatter** with `description` for Agent Requested mode
289
+ - **Configurable DOCS_PATH** at the top for easy customization
290
+ - **Command reference** for all `ccmds` commands
291
+ - **Workflow strategies** for efficient documentation search
292
+ - **Best practices** for context-efficient searches
293
+
150
294
  ## Output Modes
151
295
 
152
296
  | Mode | Description | Use Case |
@@ -160,19 +304,34 @@ The SKILL.md includes:
160
304
 
161
305
  ### Progressive Search
162
306
 
163
- 1. Start broad with `find` to discover relevant docs
164
- 2. Narrow down with `grep` for specific patterns
165
- 3. Use `show` to read the exact file you need
307
+ 1. Start with `outline` to understand document structure
308
+ 2. Use `find` to discover relevant docs
309
+ 3. Use `section` to extract just what you need
166
310
 
167
311
  ```bash
168
- # Discover
312
+ # Understand structure
313
+ ccmds outline ./docs -d 2
314
+
315
+ # Discover relevant docs
169
316
  ccmds find "database" ./docs -o files
170
317
 
171
- # Narrow down
172
- ccmds grep "migration" ./docs/database -c 5
318
+ # Extract specific section
319
+ ccmds section ./docs/database/migrations.md "Schema Changes"
320
+ ```
173
321
 
174
- # Read specific file
175
- ccmds show ./docs/database/migrations.md
322
+ ### Smart Context Search
323
+
324
+ Grep automatically preserves code blocks and shows heading paths:
325
+
326
+ ```bash
327
+ # Search returns full code blocks when match is inside one
328
+ ccmds grep "npm install" ./docs
329
+
330
+ # Output shows heading path:
331
+ # ◆ ## Installation > ### Prerequisites (lines 10-25)
332
+ # ```bash
333
+ # npm install my-package
334
+ # ```
176
335
  ```
177
336
 
178
337
  ### Quick Lookup
@@ -180,6 +339,9 @@ ccmds show ./docs/database/migrations.md
180
339
  ```bash
181
340
  # Find and show top result
182
341
  ccmds find "installation" ./docs -l 1 -o files | xargs ccmds show
342
+
343
+ # Or extract just the installation section
344
+ ccmds section ./docs/setup.md "Installation"
183
345
  ```
184
346
 
185
347
  ## Documentation Structure (Recommended)
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cc-md-search-cli",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "Claude Code Markdown Search - Efficient documentation search CLI for Claude Code integration",
5
5
  "type": "module",
6
6
  "bin": {
@@ -8,7 +8,10 @@
8
8
  },
9
9
  "scripts": {
10
10
  "build": "echo 'No build needed for Bun'",
11
- "link": "npm link"
11
+ "link": "npm link",
12
+ "test": "bun test",
13
+ "test:coverage": "bun test --coverage",
14
+ "test:watch": "bun test --watch"
12
15
  },
13
16
  "keywords": [
14
17
  "markdown",