Commit cb446a6
feat(cortex-cli): improve CLI help text and add file safety utilities (#203)
AGENT_8 CLI Help & Validation Improvements:
1. Added AFTER_HELP section to cortex-cli main.rs with:
- Environment variables documentation (CORTEX_HOME, CORTEX_API_KEY,
CORTEX_MODEL, CORTEX_LOG_LEVEL, NO_COLOR, VISUAL, EDITOR)
- Configuration paths (config, sessions, logs, agents)
- Usage examples for common commands
2. Created cortex-utils-file-safety crate with:
- validate_file_for_read() - validates files before reading
- validate_file_for_read_with_limit() - with custom size limit
- is_special_path() - quick path safety check
- FileError enum with detailed error types
- Cross-platform support (Unix + Windows)
- Protection against:
- Block/character devices
- FIFOs and sockets
- Special paths (/dev, /proc, /sys on Unix)
- DOS device names (CON, NUL, COM1, etc. on Windows)
- Files exceeding size limit (100MB default)
- Comprehensive test coverage
Note: Many improvements from IMPROVEMENTS_STATUS.md were already
implemented in the codebase:
- PR 50 (logout confirmation)
- PR 30 (built-in agent removal warning)
- PR 61 (--force data loss warning)
- PR 27 (session ID format validation)
- PR 29 (host address validation)
- PR 45 (JSON parse error handling)
Co-authored-by: Droid Agent <droid@factory.ai>1 parent c36e1f2 commit cb446a6
5 files changed
Lines changed: 412 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| 49 | + | |
49 | 50 | | |
50 | 51 | | |
51 | 52 | | |
| |||
183 | 184 | | |
184 | 185 | | |
185 | 186 | | |
| 187 | + | |
186 | 188 | | |
187 | 189 | | |
188 | 190 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
84 | 109 | | |
85 | 110 | | |
86 | 111 | | |
| |||
90 | 115 | | |
91 | 116 | | |
92 | 117 | | |
93 | | - | |
| 118 | + | |
| 119 | + | |
94 | 120 | | |
95 | 121 | | |
96 | 122 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
0 commit comments