ai-context 1.5.0 → 1.6.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/COMMANDS.md +371 -0
- package/README.md +48 -200
- package/bin/cx.js +7 -45
- package/lib/argumentParser.js +36 -14
- package/lib/changeTracker.js +387 -0
- package/lib/cleanupUtils.js +1 -2
- package/lib/configHandler.js +188 -10
- package/lib/contextGenerator.js +120 -46
- package/lib/cursorRulesHandler.js +34 -23
- package/lib/directoryTree.js +2 -91
- package/lib/exclusionManager.js +113 -322
- package/lib/fileUtils.js +26 -1
- package/lib/helpHandler.js +141 -28
- package/lib/ignoreCommands.js +12 -10
- package/lib/includeCommands.js +101 -0
- package/lib/pathUtils.js +27 -33
- package/lib/templateHandler.js +350 -1
- package/lib/treeCommands.js +1 -42
- package/package.json +1 -1
- package/lib/argumentValidator.js +0 -49
package/COMMANDS.md
ADDED
|
@@ -0,0 +1,371 @@
|
|
|
1
|
+
# AIContext CLI Reference
|
|
2
|
+
|
|
3
|
+
Complete command reference for the `cx` CLI tool.
|
|
4
|
+
|
|
5
|
+
## Table of Contents
|
|
6
|
+
|
|
7
|
+
- [Quick Start](#quick-start)
|
|
8
|
+
- [Basic Commands](#basic-commands)
|
|
9
|
+
- [Output Options](#output-options)
|
|
10
|
+
- [Output Formats](#output-formats)
|
|
11
|
+
- [Incremental Mode](#incremental-mode)
|
|
12
|
+
- [File Filtering](#file-filtering)
|
|
13
|
+
- [Ignore Patterns](#ignore-patterns)
|
|
14
|
+
- [Include Patterns](#include-patterns)
|
|
15
|
+
- [Snapshots](#snapshots)
|
|
16
|
+
- [Configuration](#configuration)
|
|
17
|
+
- [Advanced Options](#advanced-options)
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Quick Start
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
# Install globally
|
|
25
|
+
npm install -g ai-context
|
|
26
|
+
|
|
27
|
+
# Generate context from current directory
|
|
28
|
+
cx
|
|
29
|
+
|
|
30
|
+
# Generate from specific directory
|
|
31
|
+
cx ./src
|
|
32
|
+
|
|
33
|
+
# Generate with a message
|
|
34
|
+
cx -m "feature update"
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## Basic Commands
|
|
40
|
+
|
|
41
|
+
| Command | Description |
|
|
42
|
+
|---------|-------------|
|
|
43
|
+
| `cx` | Generate context from current directory |
|
|
44
|
+
| `cx <path>` | Generate context from specific path |
|
|
45
|
+
| `cx <path1> <path2>` | Generate context from multiple paths |
|
|
46
|
+
| `cx -h` | Show basic help |
|
|
47
|
+
| `cx -h --more` | Show detailed help |
|
|
48
|
+
| `cx -v` | Show version |
|
|
49
|
+
|
|
50
|
+
### Examples
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
cx # Current directory
|
|
54
|
+
cx ./src # Specific directory
|
|
55
|
+
cx ./lib ./src/main.js # Multiple paths
|
|
56
|
+
cx ./src -m "auth api" # With descriptive message
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## Output Options
|
|
62
|
+
|
|
63
|
+
| Option | Description |
|
|
64
|
+
|--------|-------------|
|
|
65
|
+
| `-o` | Output to screen (stdout) instead of file |
|
|
66
|
+
| `-t, --tree` | Display directory tree only |
|
|
67
|
+
| `--no-clipboard` | Skip copying to clipboard |
|
|
68
|
+
| `--verbose` | Show detailed progress |
|
|
69
|
+
|
|
70
|
+
### Examples
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
cx -o # Print to screen
|
|
74
|
+
cx -o | head -100 # Pipe to other commands
|
|
75
|
+
cx -t # Show tree only
|
|
76
|
+
cx -t ./src ./lib # Show trees for multiple paths
|
|
77
|
+
cx --verbose # See detailed progress
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## Output Formats
|
|
83
|
+
|
|
84
|
+
Generate context in different formats using `-f` or `--format`.
|
|
85
|
+
|
|
86
|
+
| Format | Extension | Description |
|
|
87
|
+
|--------|-----------|-------------|
|
|
88
|
+
| `text` | `.txt` | Plain text (default) |
|
|
89
|
+
| `md` | `.md` | Markdown with tables and code blocks |
|
|
90
|
+
| `json` | `.json` | Structured JSON for programmatic use |
|
|
91
|
+
| `xml` | `.xml` | XML format with CDATA sections |
|
|
92
|
+
|
|
93
|
+
### Examples
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
cx -f text # Plain text (default)
|
|
97
|
+
cx -f md # Markdown format
|
|
98
|
+
cx -f json # JSON format
|
|
99
|
+
cx -f xml # XML format
|
|
100
|
+
cx ./src -f md -m "docs" # Markdown with message
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### Format Details
|
|
104
|
+
|
|
105
|
+
**Markdown (`-f md`)**
|
|
106
|
+
- Tables for metadata and file info
|
|
107
|
+
- Fenced code blocks with syntax highlighting
|
|
108
|
+
- Clean, readable structure
|
|
109
|
+
|
|
110
|
+
**JSON (`-f json`)**
|
|
111
|
+
- Structured data with metadata
|
|
112
|
+
- File array with content and stats
|
|
113
|
+
- Ideal for programmatic processing
|
|
114
|
+
|
|
115
|
+
**XML (`-f xml`)**
|
|
116
|
+
- Valid XML with proper encoding
|
|
117
|
+
- CDATA sections for code content
|
|
118
|
+
- Supports XML-based toolchains
|
|
119
|
+
|
|
120
|
+
---
|
|
121
|
+
|
|
122
|
+
## Incremental Mode
|
|
123
|
+
|
|
124
|
+
Only include files that changed since a specific time or git reference.
|
|
125
|
+
|
|
126
|
+
| Option | Description |
|
|
127
|
+
|--------|-------------|
|
|
128
|
+
| `--since <time>` | Files changed since time expression |
|
|
129
|
+
| `--git-diff <ref>` | Files changed vs git reference |
|
|
130
|
+
| `--changed` | Files changed since last `cx` run |
|
|
131
|
+
|
|
132
|
+
### Time Expressions
|
|
133
|
+
|
|
134
|
+
| Expression | Meaning |
|
|
135
|
+
|------------|---------|
|
|
136
|
+
| `30m` | 30 minutes ago |
|
|
137
|
+
| `2h` | 2 hours ago |
|
|
138
|
+
| `1d` | 1 day ago |
|
|
139
|
+
| `1w` | 1 week ago |
|
|
140
|
+
| `2024-01-15` | Since specific date |
|
|
141
|
+
|
|
142
|
+
### Examples
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
cx --since 2h # Changed in last 2 hours
|
|
146
|
+
cx --since 1d # Changed in last day
|
|
147
|
+
cx --since 2024-01-15 # Changed since date
|
|
148
|
+
cx --git-diff main # Changed vs main branch
|
|
149
|
+
cx --git-diff HEAD~5 # Changed in last 5 commits
|
|
150
|
+
cx --changed # Changed since last cx run
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### Use Cases
|
|
154
|
+
|
|
155
|
+
- **Daily standups**: `cx --since 1d` - What changed today
|
|
156
|
+
- **PR reviews**: `cx --git-diff main` - Changes in feature branch
|
|
157
|
+
- **Quick updates**: `cx --changed` - Only new changes
|
|
158
|
+
|
|
159
|
+
---
|
|
160
|
+
|
|
161
|
+
## File Filtering
|
|
162
|
+
|
|
163
|
+
### Ignore Patterns
|
|
164
|
+
|
|
165
|
+
Exclude files matching glob patterns.
|
|
166
|
+
|
|
167
|
+
| Command | Description |
|
|
168
|
+
|---------|-------------|
|
|
169
|
+
| `cx ignore <pattern>` | Add ignore pattern |
|
|
170
|
+
| `cx ignore rm <pattern>` | Remove pattern |
|
|
171
|
+
| `cx ignore show` | List all patterns |
|
|
172
|
+
| `cx ignore clear` | Remove all patterns |
|
|
173
|
+
| `cx ignore test` | Preview excluded files |
|
|
174
|
+
|
|
175
|
+
### Examples
|
|
176
|
+
|
|
177
|
+
```bash
|
|
178
|
+
cx ignore "*.log" # Exclude log files
|
|
179
|
+
cx ignore "dist/**" # Exclude dist directory
|
|
180
|
+
cx ignore "**/*.test.js" # Exclude test files
|
|
181
|
+
cx ignore rm "*.log" # Remove pattern
|
|
182
|
+
cx ignore show # List patterns
|
|
183
|
+
cx ignore test # Preview exclusions
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
### Include Patterns
|
|
187
|
+
|
|
188
|
+
Whitelist files - only matching files are processed.
|
|
189
|
+
|
|
190
|
+
| Command | Description |
|
|
191
|
+
|---------|-------------|
|
|
192
|
+
| `cx include <pattern>` | Add include pattern |
|
|
193
|
+
| `cx include rm <pattern>` | Remove pattern |
|
|
194
|
+
| `cx include show` | List all patterns |
|
|
195
|
+
| `cx include clear` | Remove all patterns |
|
|
196
|
+
|
|
197
|
+
### Examples
|
|
198
|
+
|
|
199
|
+
```bash
|
|
200
|
+
cx include "src/**/*.ts" # Only TypeScript in src/
|
|
201
|
+
cx include "*.js" # Only JavaScript files
|
|
202
|
+
cx include "lib/**" # Only files in lib/
|
|
203
|
+
cx include rm "*.js" # Remove pattern
|
|
204
|
+
cx include show # List patterns
|
|
205
|
+
cx include clear # Reset to include all
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
### Pattern Syntax
|
|
209
|
+
|
|
210
|
+
| Pattern | Matches |
|
|
211
|
+
|---------|---------|
|
|
212
|
+
| `*.js` | All .js files |
|
|
213
|
+
| `**/*.ts` | All .ts files (recursive) |
|
|
214
|
+
| `src/**` | Everything in src/ |
|
|
215
|
+
| `*.{js,ts}` | .js and .ts files |
|
|
216
|
+
| `!*.test.js` | Negation (exclude) |
|
|
217
|
+
|
|
218
|
+
### How Filtering Works
|
|
219
|
+
|
|
220
|
+
**Precedence Rules:**
|
|
221
|
+
1. System exclusions always apply first (node_modules, .git, binaries)
|
|
222
|
+
2. `.gitignore` patterns are applied next
|
|
223
|
+
3. **Include patterns** act as a whitelist (if defined)
|
|
224
|
+
4. **Ignore patterns** exclude from the remaining files
|
|
225
|
+
|
|
226
|
+
**In Practice:**
|
|
227
|
+
- If **no include patterns**: all non-excluded files are processed
|
|
228
|
+
- If **include patterns defined**: only matching files are considered
|
|
229
|
+
- **Ignore patterns** can then further exclude from included files
|
|
230
|
+
- Files must match include AND not match ignore to be processed
|
|
231
|
+
|
|
232
|
+
**Example:**
|
|
233
|
+
```bash
|
|
234
|
+
cx include "src/**" # Only files in src/
|
|
235
|
+
cx ignore "**/*.test.js" # But exclude test files
|
|
236
|
+
# Result: All files in src/ except test files
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
---
|
|
240
|
+
|
|
241
|
+
## Snapshots
|
|
242
|
+
|
|
243
|
+
Create point-in-time captures of your codebase.
|
|
244
|
+
|
|
245
|
+
| Option | Description |
|
|
246
|
+
|--------|-------------|
|
|
247
|
+
| `-s, --snap` | Create a snapshot |
|
|
248
|
+
|
|
249
|
+
### Examples
|
|
250
|
+
|
|
251
|
+
```bash
|
|
252
|
+
cx -s # Create snapshot
|
|
253
|
+
cx -s -m "before refactor" # Snapshot with message
|
|
254
|
+
cx -s -f json # Snapshot in JSON format
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
### Storage
|
|
258
|
+
|
|
259
|
+
- Regular context: `.aicontext/code/`
|
|
260
|
+
- Snapshots: `.aicontext/snapshots/`
|
|
261
|
+
- Latest file: `.aicontext/latest-context.txt`
|
|
262
|
+
|
|
263
|
+
---
|
|
264
|
+
|
|
265
|
+
## Configuration
|
|
266
|
+
|
|
267
|
+
### Commands
|
|
268
|
+
|
|
269
|
+
| Command | Description |
|
|
270
|
+
|---------|-------------|
|
|
271
|
+
| `cx configure` | Interactive configuration |
|
|
272
|
+
| `cx show` | Show current settings |
|
|
273
|
+
|
|
274
|
+
### Settings
|
|
275
|
+
|
|
276
|
+
| Setting | Description | Default |
|
|
277
|
+
|---------|-------------|---------|
|
|
278
|
+
| Auto-clipboard | Copy to clipboard automatically | Off |
|
|
279
|
+
| Timeout | File search timeout | 30s |
|
|
280
|
+
| Max file size | Maximum file size to include | 1MB |
|
|
281
|
+
|
|
282
|
+
### Examples
|
|
283
|
+
|
|
284
|
+
```bash
|
|
285
|
+
cx configure # Interactive setup
|
|
286
|
+
cx show # View current config
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
### Configuration Files
|
|
290
|
+
|
|
291
|
+
| File | Purpose |
|
|
292
|
+
|------|---------|
|
|
293
|
+
| `~/.aicontext/config.json` | Global settings |
|
|
294
|
+
| `.aicontext/ignore.json` | Project patterns |
|
|
295
|
+
|
|
296
|
+
---
|
|
297
|
+
|
|
298
|
+
## Advanced Options
|
|
299
|
+
|
|
300
|
+
| Option | Description | Default |
|
|
301
|
+
|--------|-------------|---------|
|
|
302
|
+
| `--timeout <sec>` | File search timeout | 30 |
|
|
303
|
+
| `--max-size <MB>` | Max file size | 1 |
|
|
304
|
+
| `--clear` | Remove generated context files | - |
|
|
305
|
+
| `--clear-all` | Remove ALL context files (with confirmation) | - |
|
|
306
|
+
|
|
307
|
+
### Examples
|
|
308
|
+
|
|
309
|
+
```bash
|
|
310
|
+
cx --timeout 60 # Longer timeout for large projects
|
|
311
|
+
cx --max-size 5 # Include larger files
|
|
312
|
+
cx --clear # Clean up code/ directory
|
|
313
|
+
cx --clear-all # Clean up everything
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
---
|
|
317
|
+
|
|
318
|
+
## Default Exclusions
|
|
319
|
+
|
|
320
|
+
These are automatically excluded:
|
|
321
|
+
|
|
322
|
+
- **Directories**: `node_modules`, `.git`, `dist`, `build`, `coverage`, etc.
|
|
323
|
+
- **Files**: Lock files, OS files (`.DS_Store`), IDE configs
|
|
324
|
+
- **Binary files**: Images, executables, archives, media files
|
|
325
|
+
- **Large files**: Files exceeding max-size limit
|
|
326
|
+
|
|
327
|
+
---
|
|
328
|
+
|
|
329
|
+
## Tips
|
|
330
|
+
|
|
331
|
+
1. **Add `.aicontext` to `.gitignore`** to keep generated files local
|
|
332
|
+
2. **Use snapshots** before major refactors
|
|
333
|
+
3. **Combine filters**: `cx --since 1d -f md` for daily markdown reports
|
|
334
|
+
4. **Use include patterns** for focused context on specific file types
|
|
335
|
+
5. **Use `cx -o | head`** to preview output before generating
|
|
336
|
+
|
|
337
|
+
---
|
|
338
|
+
|
|
339
|
+
## Quick Reference Card
|
|
340
|
+
|
|
341
|
+
```bash
|
|
342
|
+
# Core
|
|
343
|
+
cx # Generate from current dir
|
|
344
|
+
cx ./src # Generate from path
|
|
345
|
+
cx -m "message" # Add filename message
|
|
346
|
+
|
|
347
|
+
# Output
|
|
348
|
+
cx -o # To screen
|
|
349
|
+
cx -t # Tree only
|
|
350
|
+
cx -f md # Markdown format
|
|
351
|
+
cx -f json # JSON format
|
|
352
|
+
|
|
353
|
+
# Incremental
|
|
354
|
+
cx --since 2h # Last 2 hours
|
|
355
|
+
cx --git-diff main # Vs main branch
|
|
356
|
+
cx --changed # Since last run
|
|
357
|
+
|
|
358
|
+
# Filtering
|
|
359
|
+
cx ignore "*.log" # Exclude pattern
|
|
360
|
+
cx include "*.ts" # Include only pattern
|
|
361
|
+
cx ignore show # List ignore patterns
|
|
362
|
+
cx include show # List include patterns
|
|
363
|
+
|
|
364
|
+
# Snapshots
|
|
365
|
+
cx -s # Create snapshot
|
|
366
|
+
cx -s -m "backup" # With message
|
|
367
|
+
|
|
368
|
+
# Config
|
|
369
|
+
cx configure # Setup
|
|
370
|
+
cx show # View settings
|
|
371
|
+
```
|
package/README.md
CHANGED
|
@@ -3,243 +3,91 @@
|
|
|
3
3
|
<h3>Context Management for AI-Assisted Development</h3>
|
|
4
4
|
</div>
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
[](TESTS.md)
|
|
11
|
-
[](TESTS.md)
|
|
12
|
-
[](https://www.npmjs.com/package/ai-context)
|
|
13
|
-
[](LICENSE)
|
|
14
|
-
[](package.json)
|
|
15
|
-
|
|
16
|
-
Last tested: 02/03/2026, 09:40 America/Los_Angeles
|
|
6
|
+
[](TESTS.md)
|
|
7
|
+
[](https://www.npmjs.com/package/ai-context)
|
|
8
|
+
[](package.json)
|
|
9
|
+
[](LICENSE)
|
|
17
10
|
|
|
18
11
|
## What is AIContext?
|
|
19
12
|
|
|
20
|
-
A CLI tool that generates structured context from your codebase for AI tools.
|
|
21
|
-
|
|
22
|
-
Run `cx` in your project:
|
|
13
|
+
A CLI tool that generates structured context from your codebase for AI tools. Scans your project, filters out noise, and creates formatted output ready for Claude, ChatGPT, or any AI assistant.
|
|
23
14
|
|
|
24
15
|
<div align="center">
|
|
25
16
|
<img src="static/cx-example.gif" alt="AI Context Example" width="600" height="auto">
|
|
26
17
|
</div>
|
|
27
18
|
|
|
28
|
-
##
|
|
29
|
-
|
|
30
|
-
- Automatically excludes binary files, build artifacts, and other non-essential files
|
|
31
|
-
- Create point-in-time snapshots of your codebase
|
|
32
|
-
- Easily exclude specific files or directories with glob patterns
|
|
33
|
-
- Automatically copy context to clipboard (configurable)
|
|
34
|
-
- Includes a visual representation of your project structure
|
|
19
|
+
## Quick Start
|
|
35
20
|
|
|
36
|
-
## 🚀 Quick Start
|
|
37
|
-
|
|
38
|
-
Install globally
|
|
39
21
|
```bash
|
|
40
22
|
npm install -g ai-context
|
|
41
|
-
```
|
|
42
|
-
or force the latest
|
|
43
|
-
```bash
|
|
44
|
-
npm install -g ai-context@latest
|
|
45
|
-
```
|
|
46
|
-
Generate context from current directory
|
|
47
|
-
```bash
|
|
48
23
|
cx
|
|
49
24
|
```
|
|
50
|
-
Generate context from specific directory with a message
|
|
51
|
-
```bash
|
|
52
|
-
cx ./src -m "authentication api"
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
The output will be copied to your clipboard and saved to a context file, ready to paste into your AI tool of choice.
|
|
56
25
|
|
|
57
|
-
##
|
|
26
|
+
## Core Commands
|
|
58
27
|
|
|
59
|
-
```
|
|
60
|
-
|
|
28
|
+
```bash
|
|
29
|
+
cx # Generate from current directory
|
|
30
|
+
cx ./src # Generate from path
|
|
31
|
+
cx -m "feature" # Add filename message
|
|
32
|
+
cx -o # Output to screen
|
|
33
|
+
cx -t # Tree only
|
|
34
|
+
cx -s # Create snapshot
|
|
61
35
|
```
|
|
62
36
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
| Option | Description |
|
|
66
|
-
|--------|-------------|
|
|
67
|
-
| `-h, --help` | Show help information. Use `-h --more` for detailed help |
|
|
68
|
-
| `configure` | Configure settings |
|
|
69
|
-
| `show` | Show current configuration |
|
|
70
|
-
| `ignore` | Manage ignore patterns |
|
|
71
|
-
| `-v, --version` | Show the current version of the tool |
|
|
72
|
-
| `--clear` | Remove all generated context files inside the ./code folder |
|
|
73
|
-
| `--clear-all` | Remove ALL context files and directories (with confirmation) |
|
|
74
|
-
|
|
75
|
-
### Context Generation Options
|
|
76
|
-
|
|
77
|
-
| Option | Description |
|
|
78
|
-
|--------|-------------|
|
|
79
|
-
| `-m, --message "text"` | Add a descriptive message to the context file name |
|
|
80
|
-
| `-s, --snap` | Create a snapshot in the .aicontext/snapshots directory |
|
|
81
|
-
| `-o` | Output directly to screen (supports piping, bypasses file creation) |
|
|
82
|
-
| `-t, --tree` | Display directory tree only |
|
|
83
|
-
| `--verbose` | Show detailed progress during execution |
|
|
84
|
-
| `--no-clipboard` | Skip copying content to clipboard |
|
|
85
|
-
|
|
86
|
-
### File Filtering Options
|
|
87
|
-
|
|
88
|
-
| Option | Description |
|
|
89
|
-
|--------|-------------|
|
|
90
|
-
| `ignore <pattern>` | Add a glob pattern to exclude files/directories |
|
|
91
|
-
| `ignore rm <pattern>` | Remove an exclusion pattern |
|
|
92
|
-
| `ignore show` | Display all current exclusion patterns |
|
|
93
|
-
| `ignore clear` | Remove all exclusion patterns |
|
|
94
|
-
| `ignore test` | Test the exclusions by showing directory tree |
|
|
95
|
-
| `--timeout <seconds>` | Set a custom timeout (default: 10 seconds) |
|
|
96
|
-
| `--max-size <MB>` | Set a custom maximum file size (default: 1 MB) |
|
|
97
|
-
|
|
98
|
-
### Examples
|
|
37
|
+
## Output Formats
|
|
99
38
|
|
|
100
39
|
```bash
|
|
101
|
-
#
|
|
102
|
-
cx
|
|
103
|
-
cx
|
|
104
|
-
cx
|
|
105
|
-
|
|
106
|
-
# Direct output and piping
|
|
107
|
-
cx -o # Output directly to screen
|
|
108
|
-
cx ./src -o # Output specific directory to screen
|
|
109
|
-
cx ./src -o | grep "func" # Pipe output to grep for filtering
|
|
110
|
-
cx -o | head -n 50 # Show first 50 lines of context
|
|
111
|
-
|
|
112
|
-
# Snapshots
|
|
113
|
-
cx ./src -s # Create a snapshot
|
|
114
|
-
cx -s -m "before refactor" # Create snapshot with message
|
|
115
|
-
|
|
116
|
-
# Directory tree
|
|
117
|
-
cx -t # Show directory tree for current directory
|
|
118
|
-
cx -t ./src ./lib # Show trees for multiple paths
|
|
119
|
-
|
|
120
|
-
# Configuration and ignore patterns
|
|
121
|
-
cx configure # Configure settings
|
|
122
|
-
cx show # Show current configuration
|
|
123
|
-
cx ignore "*.log" # Add ignore pattern
|
|
124
|
-
cx ignore rm "*.log" # Remove ignore pattern
|
|
125
|
-
cx ignore show # Show all patterns
|
|
126
|
-
cx ignore clear # Remove all patterns
|
|
127
|
-
|
|
128
|
-
# Performance options
|
|
129
|
-
cx --verbose # Show detailed progress
|
|
130
|
-
cx --timeout 10 # Set a shorter timeout of 10 seconds
|
|
131
|
-
cx --max-size 20 # Set a custom maximum file size of 20 MB
|
|
132
|
-
cx --no-clipboard # Skip clipboard operations
|
|
133
|
-
|
|
134
|
-
# Clean up
|
|
135
|
-
cx --clear # Remove all generated context files (except snapshots)
|
|
136
|
-
cx --clear-all # Remove ALL context files and directories (with confirmation)
|
|
40
|
+
cx -f text # Plain text (default)
|
|
41
|
+
cx -f md # Markdown
|
|
42
|
+
cx -f json # JSON
|
|
43
|
+
cx -f xml # XML
|
|
137
44
|
```
|
|
138
45
|
|
|
139
|
-
##
|
|
140
|
-
|
|
141
|
-
Use `cx configure` to set up your preferences for a customized experience:
|
|
142
|
-
|
|
143
|
-
### Available Configuration Options:
|
|
144
|
-
|
|
145
|
-
| Setting | Description |
|
|
146
|
-
|---------|-------------|
|
|
147
|
-
| **Auto-clipboard copy** | Enable/disable automatic copying of generated context to clipboard |
|
|
148
|
-
| **Default timeout** | Set the default timeout in seconds for scanning directories (default: 10s) |
|
|
149
|
-
| **Max file size** | Set the maximum file size in MB to include in context (default: 1MB) |
|
|
150
|
-
|
|
151
|
-
These settings help you customize how AIContext operates to match your workflow. For example, disabling clipboard copy can speed up execution, while adjusting timeout and file size limits can help with larger projects.
|
|
152
|
-
|
|
153
|
-
View your current configuration with `cx show`.
|
|
46
|
+
## Incremental Mode
|
|
154
47
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
## 🚫 File Exclusions & Ignore Patterns
|
|
158
|
-
|
|
159
|
-
AIContext intelligently manages which files to include in your context:
|
|
160
|
-
|
|
161
|
-
### Default Exclusions
|
|
162
|
-
|
|
163
|
-
The following are automatically excluded:
|
|
164
|
-
- Binary files (executables, object files, media files)
|
|
165
|
-
- Common build directories (`node_modules`, `dist`, `.git`, etc.)
|
|
166
|
-
- Files larger than the configured size limit (default: 1MB)
|
|
167
|
-
- Compressed archives (`.zip`, `.tar.gz`, etc.)
|
|
168
|
-
|
|
169
|
-
### Managing Custom Exclusions
|
|
170
|
-
|
|
171
|
-
Use the `ignore` command to manage your exclusion patterns:
|
|
48
|
+
Only include changed files:
|
|
172
49
|
|
|
173
50
|
```bash
|
|
174
|
-
#
|
|
175
|
-
cx
|
|
176
|
-
cx
|
|
177
|
-
cx
|
|
178
|
-
|
|
179
|
-
# Remove a pattern
|
|
180
|
-
cx ignore rm "*.log" # Remove the *.log pattern
|
|
181
|
-
|
|
182
|
-
# View and manage patterns
|
|
183
|
-
cx ignore show # List current patterns
|
|
184
|
-
cx ignore test # Preview what will be excluded
|
|
185
|
-
cx ignore clear # Remove all patterns
|
|
51
|
+
cx --since 2h # Last 2 hours
|
|
52
|
+
cx --since 1d # Last day
|
|
53
|
+
cx --git-diff main # vs main branch
|
|
54
|
+
cx --changed # Since last run
|
|
186
55
|
```
|
|
187
56
|
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
- **Simple patterns**: `*.log`, `*.tmp`
|
|
191
|
-
- **Directory patterns**: `build/**`, `temp/*`
|
|
192
|
-
- **Path-based**: `./src/tests/**`
|
|
193
|
-
- **Multiple extensions**: `*.{jpg,png,gif}`
|
|
194
|
-
|
|
195
|
-
### Configuration Files
|
|
196
|
-
|
|
197
|
-
- Project-specific exclusions: `.aicontext/ignore.json`
|
|
198
|
-
- Global exclusions: `~/.aicontext/config.json`
|
|
199
|
-
|
|
200
|
-
Tip: Add `.aicontext` to your `.gitignore` if you don't want to share exclusion patterns with your team.
|
|
57
|
+
## File Filtering
|
|
201
58
|
|
|
202
|
-
## 💡 Best Practices
|
|
203
|
-
|
|
204
|
-
1. Add the 'context' folder to your .gitignore file
|
|
205
|
-
2. Use meaningful messages for better organization
|
|
206
|
-
3. Create snapshots before major changes
|
|
207
|
-
4. Clear old context files regularly with `cx --clear`
|
|
208
|
-
5. Use the latest-context.txt file for AI tools integration
|
|
209
|
-
|
|
210
|
-
## 📝 Updates
|
|
211
|
-
|
|
212
|
-
See [UPDATES.md](UPDATES.md) for a history of changes and new features.
|
|
213
|
-
|
|
214
|
-
## 🤝 Need Help?
|
|
215
|
-
|
|
216
|
-
AIContext includes several ways to get help:
|
|
217
|
-
|
|
218
|
-
### Built-in Help
|
|
219
59
|
```bash
|
|
220
|
-
#
|
|
221
|
-
cx
|
|
60
|
+
# Exclude patterns
|
|
61
|
+
cx ignore "*.log"
|
|
62
|
+
cx ignore show
|
|
222
63
|
|
|
223
|
-
#
|
|
224
|
-
cx
|
|
64
|
+
# Include patterns (whitelist)
|
|
65
|
+
cx include "src/**/*.ts"
|
|
66
|
+
cx include show
|
|
225
67
|
```
|
|
226
68
|
|
|
227
|
-
|
|
228
|
-
|
|
69
|
+
## Configuration
|
|
70
|
+
|
|
229
71
|
```bash
|
|
230
|
-
cx
|
|
72
|
+
cx configure # Setup
|
|
73
|
+
cx show # View settings
|
|
231
74
|
```
|
|
232
75
|
|
|
233
|
-
|
|
234
|
-
|
|
76
|
+
## Full Documentation
|
|
77
|
+
|
|
78
|
+
**[COMMANDS.md](COMMANDS.md)** - Complete CLI reference with all options, examples, and patterns.
|
|
79
|
+
|
|
80
|
+
## Help
|
|
81
|
+
|
|
235
82
|
```bash
|
|
236
|
-
cx
|
|
83
|
+
cx -h # Basic help
|
|
84
|
+
cx -h --more # Detailed help
|
|
237
85
|
```
|
|
238
86
|
|
|
239
|
-
|
|
240
|
-
-
|
|
241
|
-
-
|
|
87
|
+
- [Updates](UPDATES.md) - Version history
|
|
88
|
+
- [Issues](https://github.com/csanz/aicontext/issues) - Report bugs
|
|
89
|
+
- [Discussions](https://github.com/csanz/aicontext/discussions) - Questions
|
|
242
90
|
|
|
243
|
-
##
|
|
91
|
+
## License
|
|
244
92
|
|
|
245
93
|
MIT
|