cc-md-search-cli 1.0.0 → 1.0.1

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,47 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ ## [1.0.1] - 2026-01-17
6
+
7
+ ### Added
8
+ - New `outline` command - show document structure (headings only) without loading content
9
+ - New `section` command - extract specific sections by heading name
10
+ - New `grep` command alias - regex pattern matching with smart context
11
+ - Smart context extraction - preserves code blocks and respects paragraph boundaries
12
+ - Heading path display (e.g., `## Setup > ### Prerequisites`) for grep matches
13
+ - Adaptive preview lengths for search results (600/300/150 chars based on rank)
14
+ - Frontmatter filtering - only includes useful fields (title, description, tags, etc.)
15
+ - `--raw` flag to disable context optimizations when needed
16
+ - Multi-directory search support
17
+ - New `CONFIGURATION.md` guide for documentation path setup
18
+ - Cursor rules file (`rules/docs-search.mdc`) for IDE integration
19
+ - Comprehensive test suite with 1900+ lines of tests
20
+ - Test fixtures for various markdown scenarios
21
+
22
+ ### Changed
23
+ - Shebang changed from `node` to `bun` for improved performance
24
+ - Enhanced skill file with detailed usage examples and context-efficient patterns
25
+ - Expanded README with full command reference and examples
26
+ - Improved skill template for easier customization
27
+
28
+ ### Fixed
29
+ - Context deduplication for overlapping grep matches
30
+
31
+ ## [1.0.0] - 2026-01-17
32
+
33
+ ### Added
34
+ - Initial release of Claude Code Markdown Search CLI
35
+ - Fuzzy search functionality using Fuse.js for flexible text matching
36
+ - Regex pattern matching support for precise searches
37
+ - Recursive directory scanning for markdown files
38
+ - YAML frontmatter parsing via gray-matter
39
+ - Multiple output formats: `plain`, `json`, `minimal`
40
+ - Context-efficient output designed for AI assistant integration
41
+ - Support for `.md` and `.mdx` file extensions
42
+ - CLI commands: `search`, `list`, `stats`
43
+ - Configurable search options (depth, limit, threshold)
44
+ - Claude Code skill integration (`md-search`)
45
+
46
+ [1.0.1]: https://github.com/bjeber/cc-md-search-cli/compare/v1.0.0...v1.0.1
47
+ [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,22 @@
1
1
  # CC-MD-Search-CLI
2
2
 
3
- **Claude Code Markdown Search - Efficient documentation search CLI for Claude Code integration**
3
+ **Claude Code Markdown Search - Efficient documentation search CLI for AI coding assistants**
4
4
 
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.
5
+ 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
6
 
7
7
  ## Features
8
8
 
9
9
  - **Fuzzy Search** - Find relevant docs even with typos or variations
10
10
  - **Pattern/Regex Search** - Exact matches with regex support
11
+ - **Smart Context** - Paragraph and code-block aware context extraction
12
+ - **Heading Paths** - Shows parent heading hierarchy for each match
13
+ - **Document Outlines** - View document structure without content
14
+ - **Section Extraction** - Fetch specific sections by heading
11
15
  - **Frontmatter Aware** - Parses YAML metadata for better search
16
+ - **Adaptive Previews** - Top results get longer previews automatically
12
17
  - **Multiple Output Modes** - compact, detailed, files, json
13
- - **Claude Code Skill** - Pre-built skill template for AI integration
18
+ - **Claude Code Skill** - Pre-built skill template for Claude Code integration
19
+ - **Cursor Rule** - Pre-built rule template for Cursor IDE integration
14
20
  - **Context Efficient** - Minimize token usage when searching docs
15
21
 
16
22
  ## Installation
@@ -43,11 +49,29 @@ After linking, the `ccmds` command will be available globally.
43
49
  # List all markdown files in a directory
44
50
  ccmds list ./docs
45
51
 
52
+ # List files from multiple directories
53
+ ccmds list ./docs ./api/docs ./guides
54
+
46
55
  # Fuzzy search for relevant documents
47
56
  ccmds find "authentication" ./docs -l 5
48
57
 
49
- # Pattern search with regex
50
- ccmds grep "TODO|FIXME" ./docs -c 3
58
+ # Search across multiple directories
59
+ ccmds find "authentication" ./docs ./api/docs ./guides -l 5
60
+
61
+ # Pattern search with regex (smart context preserves code blocks)
62
+ ccmds grep "TODO|FIXME" ./docs
63
+
64
+ # Grep across multiple directories
65
+ ccmds grep "TODO|FIXME" ./docs ./api/docs
66
+
67
+ # View document structure without content
68
+ ccmds outline ./docs
69
+
70
+ # View structure across multiple directories
71
+ ccmds outline ./docs ./api/docs -d 2
72
+
73
+ # Extract a specific section by heading
74
+ ccmds section ./docs/setup.md "Installation"
51
75
 
52
76
  # Show a specific file
53
77
  ccmds show ./docs/api/auth.md
@@ -55,36 +79,50 @@ ccmds show ./docs/api/auth.md
55
79
 
56
80
  ## Commands
57
81
 
58
- ### `ccmds find <query> [directory]` - Fuzzy Search
82
+ ### `ccmds find <query> [directories...]` - Fuzzy Search
59
83
 
60
- Find relevant documents using fuzzy matching. Great for exploratory searches.
84
+ 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.
85
+
86
+ **Extended Search Syntax:**
87
+ | Pattern | Meaning | Example |
88
+ |---------|---------|---------|
89
+ | `word1 word2` | AND (all must match) | `auth setup` |
90
+ | `word1 \| word2` | OR (either matches) | `install \| setup` |
91
+ | `'exact` | Exact substring | `'authentication` |
92
+ | `^prefix` | Starts with | `^Config` |
93
+ | `suffix$` | Ends with | `Guide$` |
61
94
 
62
95
  ```bash
63
- ccmds find "user authentication" ./docs -l 5 -o compact
64
- ccmds find "deploy production" ./docs -o files
96
+ ccmds find "authentication middleware" ./docs -l 5 # AND search
97
+ ccmds find "setup | installation" ./docs # OR search
98
+ ccmds find "'API Reference" ./docs -o files # Exact match
99
+ ccmds find "deploy" ./docs --raw # Disable optimizations
65
100
  ```
66
101
 
67
102
  **Options:**
68
103
  - `-l, --limit <number>` - Maximum results (default: 10)
69
104
  - `-o, --output <mode>` - Output format: compact, detailed, files, json
105
+ - `-r, --raw` - Disable adaptive previews and frontmatter filtering
70
106
 
71
- ### `ccmds grep <pattern> [directory]` - Pattern Search
107
+ ### `ccmds grep <pattern> [directories...]` - Pattern Search
72
108
 
73
- Search for exact text patterns with regex support.
109
+ 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
110
 
75
111
  ```bash
76
- ccmds grep "ERROR_[0-9]+" ./docs -c 3
112
+ ccmds grep "ERROR_[0-9]+" ./docs
77
113
  ccmds grep "GraphQL" ./docs --case-sensitive
114
+ ccmds grep "TODO" ./docs --raw -c 3 # Line-based context instead
78
115
  ```
79
116
 
80
117
  **Options:**
81
- - `-c, --context <lines>` - Lines of context around matches (default: 2)
118
+ - `-c, --context <lines>` - Lines of context around matches (default: 2, used with --raw)
82
119
  - `-s, --case-sensitive` - Case sensitive search
83
120
  - `-o, --output <mode>` - Output format
121
+ - `-r, --raw` - Disable smart context (use line-based context)
84
122
 
85
- ### `ccmds list [directory]` - List Files
123
+ ### `ccmds list [directories...]` - List Files
86
124
 
87
- List all markdown files in a directory.
125
+ List all markdown files in one or more directories.
88
126
 
89
127
  ```bash
90
128
  ccmds list ./docs
@@ -108,6 +146,35 @@ ccmds show ./docs/guide.md --body-only
108
146
  - `-f, --frontmatter-only` - Show only YAML frontmatter
109
147
  - `-b, --body-only` - Show only body content
110
148
 
149
+ ### `ccmds outline [paths...]` - Document Structure
150
+
151
+ Show document structure (headings only) without content. Great for understanding document organization. Supports files, directories, or multiple paths.
152
+
153
+ ```bash
154
+ ccmds outline ./docs/guide.md # Single file
155
+ ccmds outline ./docs # All files in directory
156
+ ccmds outline ./docs -d 2 # Limit to h1 and h2
157
+ ccmds outline ./docs -o json # JSON output
158
+ ```
159
+
160
+ **Options:**
161
+ - `-d, --depth <number>` - Maximum heading depth (default: 6)
162
+ - `-o, --output <mode>` - Output format: text, json
163
+
164
+ ### `ccmds section <file> <heading>` - Extract Section
165
+
166
+ Extract a specific section by heading text. Useful for fetching just the content you need.
167
+
168
+ ```bash
169
+ ccmds section ./docs/setup.md "Installation"
170
+ ccmds section ./docs/api.md "Authentication"
171
+ ccmds section ./docs/guide.md "Setup > Prerequisites" # Nested heading
172
+ ccmds section ./docs/api.md "Endpoints" -o json
173
+ ```
174
+
175
+ **Options:**
176
+ - `-o, --output <mode>` - Output format: text, json
177
+
111
178
  ## Claude Code Integration
112
179
 
113
180
  To use this tool with Claude Code, install the skill to your Claude Code skills directory.
@@ -147,6 +214,58 @@ The SKILL.md includes:
147
214
  - **Workflow strategies** for efficient documentation search
148
215
  - **Best practices** for context-efficient searches
149
216
 
217
+ ## Cursor Integration
218
+
219
+ To use this tool with Cursor IDE, install the rule to your project's `.cursor/rules/` directory.
220
+
221
+ ### 1. Install the Rule
222
+
223
+ ```bash
224
+ # Create the rules directory in your project
225
+ mkdir -p .cursor/rules
226
+
227
+ # Copy the rule file
228
+ cp rules/docs-search.mdc .cursor/rules/docs-search.mdc
229
+ ```
230
+
231
+ ### 2. Configure Your Docs Path
232
+
233
+ Edit `.cursor/rules/docs-search.mdc` and update the `DOCS_PATH` variable at the top:
234
+
235
+ ```markdown
236
+ ## Configuration
237
+
238
+ **DOCS_PATH**: `./docs` # Change this to your docs directory
239
+ ```
240
+
241
+ Replace `./docs` with your actual documentation path (e.g., `./documentation`, `./docs/api`, etc.).
242
+
243
+ ### 3. Use with Cursor
244
+
245
+ Once installed, Cursor will automatically include this rule when relevant (Agent Requested mode). The rule activates when you ask questions about documentation:
246
+
247
+ - "How do I set up authentication?"
248
+ - "What are the API endpoints?"
249
+ - "Where is the deployment guide?"
250
+
251
+ Cursor will use `ccmds` to search your documentation with minimal context usage.
252
+
253
+ ### 4. Rule Structure
254
+
255
+ The rule follows Cursor's `.mdc` format:
256
+
257
+ ```
258
+ .cursor/rules/
259
+ └── docs-search.mdc # Rule definition with YAML frontmatter
260
+ ```
261
+
262
+ The rule includes:
263
+ - **YAML frontmatter** with `description` for Agent Requested mode
264
+ - **Configurable DOCS_PATH** at the top for easy customization
265
+ - **Command reference** for all `ccmds` commands
266
+ - **Workflow strategies** for efficient documentation search
267
+ - **Best practices** for context-efficient searches
268
+
150
269
  ## Output Modes
151
270
 
152
271
  | Mode | Description | Use Case |
@@ -160,19 +279,34 @@ The SKILL.md includes:
160
279
 
161
280
  ### Progressive Search
162
281
 
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
282
+ 1. Start with `outline` to understand document structure
283
+ 2. Use `find` to discover relevant docs
284
+ 3. Use `section` to extract just what you need
166
285
 
167
286
  ```bash
168
- # Discover
287
+ # Understand structure
288
+ ccmds outline ./docs -d 2
289
+
290
+ # Discover relevant docs
169
291
  ccmds find "database" ./docs -o files
170
292
 
171
- # Narrow down
172
- ccmds grep "migration" ./docs/database -c 5
293
+ # Extract specific section
294
+ ccmds section ./docs/database/migrations.md "Schema Changes"
295
+ ```
296
+
297
+ ### Smart Context Search
173
298
 
174
- # Read specific file
175
- ccmds show ./docs/database/migrations.md
299
+ Grep automatically preserves code blocks and shows heading paths:
300
+
301
+ ```bash
302
+ # Search returns full code blocks when match is inside one
303
+ ccmds grep "npm install" ./docs
304
+
305
+ # Output shows heading path:
306
+ # ◆ ## Installation > ### Prerequisites (lines 10-25)
307
+ # ```bash
308
+ # npm install my-package
309
+ # ```
176
310
  ```
177
311
 
178
312
  ### Quick Lookup
@@ -180,6 +314,9 @@ ccmds show ./docs/database/migrations.md
180
314
  ```bash
181
315
  # Find and show top result
182
316
  ccmds find "installation" ./docs -l 1 -o files | xargs ccmds show
317
+
318
+ # Or extract just the installation section
319
+ ccmds section ./docs/setup.md "Installation"
183
320
  ```
184
321
 
185
322
  ## Documentation Structure (Recommended)
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.1",
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",