avana-cli 2.11.0

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.
Files changed (100) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/LICENSE +21 -0
  3. package/README.md +584 -0
  4. package/dist/cli.d.ts +7 -0
  5. package/dist/cli.d.ts.map +1 -0
  6. package/dist/cli.js +153 -0
  7. package/dist/cli.js.map +1 -0
  8. package/dist/commands/install.d.ts +6 -0
  9. package/dist/commands/install.d.ts.map +1 -0
  10. package/dist/commands/install.js +101 -0
  11. package/dist/commands/install.js.map +1 -0
  12. package/dist/commands/scan.d.ts +19 -0
  13. package/dist/commands/scan.d.ts.map +1 -0
  14. package/dist/commands/scan.js +383 -0
  15. package/dist/commands/scan.js.map +1 -0
  16. package/dist/commands/uninstall.d.ts +6 -0
  17. package/dist/commands/uninstall.d.ts.map +1 -0
  18. package/dist/commands/uninstall.js +80 -0
  19. package/dist/commands/uninstall.js.map +1 -0
  20. package/dist/index.d.ts +97 -0
  21. package/dist/index.d.ts.map +1 -0
  22. package/dist/index.js +475 -0
  23. package/dist/index.js.map +1 -0
  24. package/dist/rules/additional-patterns.d.ts +12 -0
  25. package/dist/rules/additional-patterns.d.ts.map +1 -0
  26. package/dist/rules/additional-patterns.js +170 -0
  27. package/dist/rules/additional-patterns.js.map +1 -0
  28. package/dist/rules/code-patterns.d.ts +26 -0
  29. package/dist/rules/code-patterns.d.ts.map +1 -0
  30. package/dist/rules/code-patterns.js +220 -0
  31. package/dist/rules/code-patterns.js.map +1 -0
  32. package/dist/rules/secret-patterns.d.ts +28 -0
  33. package/dist/rules/secret-patterns.d.ts.map +1 -0
  34. package/dist/rules/secret-patterns.js +1729 -0
  35. package/dist/rules/secret-patterns.js.map +1 -0
  36. package/dist/scanners/secret-scanner.d.ts +34 -0
  37. package/dist/scanners/secret-scanner.d.ts.map +1 -0
  38. package/dist/scanners/secret-scanner.js +281 -0
  39. package/dist/scanners/secret-scanner.js.map +1 -0
  40. package/dist/types/index.d.ts +116 -0
  41. package/dist/types/index.d.ts.map +1 -0
  42. package/dist/types/index.js +7 -0
  43. package/dist/types/index.js.map +1 -0
  44. package/dist/utils/error-handler.d.ts +126 -0
  45. package/dist/utils/error-handler.d.ts.map +1 -0
  46. package/dist/utils/error-handler.js +222 -0
  47. package/dist/utils/error-handler.js.map +1 -0
  48. package/dist/utils/exit-codes.d.ts +52 -0
  49. package/dist/utils/exit-codes.d.ts.map +1 -0
  50. package/dist/utils/exit-codes.js +89 -0
  51. package/dist/utils/exit-codes.js.map +1 -0
  52. package/dist/utils/file-stream-scanner.d.ts +31 -0
  53. package/dist/utils/file-stream-scanner.d.ts.map +1 -0
  54. package/dist/utils/file-stream-scanner.js +159 -0
  55. package/dist/utils/file-stream-scanner.js.map +1 -0
  56. package/dist/utils/file-type-detector.d.ts +45 -0
  57. package/dist/utils/file-type-detector.d.ts.map +1 -0
  58. package/dist/utils/file-type-detector.js +237 -0
  59. package/dist/utils/file-type-detector.js.map +1 -0
  60. package/dist/utils/ignore-pattern-manager.d.ts +61 -0
  61. package/dist/utils/ignore-pattern-manager.d.ts.map +1 -0
  62. package/dist/utils/ignore-pattern-manager.js +204 -0
  63. package/dist/utils/ignore-pattern-manager.js.map +1 -0
  64. package/dist/utils/json-output-formatter.d.ts +232 -0
  65. package/dist/utils/json-output-formatter.d.ts.map +1 -0
  66. package/dist/utils/json-output-formatter.js +367 -0
  67. package/dist/utils/json-output-formatter.js.map +1 -0
  68. package/dist/utils/logger.d.ts +181 -0
  69. package/dist/utils/logger.d.ts.map +1 -0
  70. package/dist/utils/logger.js +414 -0
  71. package/dist/utils/logger.js.map +1 -0
  72. package/dist/utils/markdown-output-formatter.d.ts +65 -0
  73. package/dist/utils/markdown-output-formatter.d.ts.map +1 -0
  74. package/dist/utils/markdown-output-formatter.js +316 -0
  75. package/dist/utils/markdown-output-formatter.js.map +1 -0
  76. package/dist/utils/memory-manager.d.ts +77 -0
  77. package/dist/utils/memory-manager.d.ts.map +1 -0
  78. package/dist/utils/memory-manager.js +157 -0
  79. package/dist/utils/memory-manager.js.map +1 -0
  80. package/dist/utils/parallel-scanner-worker.d.ts +19 -0
  81. package/dist/utils/parallel-scanner-worker.d.ts.map +1 -0
  82. package/dist/utils/parallel-scanner-worker.js +51 -0
  83. package/dist/utils/parallel-scanner-worker.js.map +1 -0
  84. package/dist/utils/parallel-scanner.d.ts +82 -0
  85. package/dist/utils/parallel-scanner.d.ts.map +1 -0
  86. package/dist/utils/parallel-scanner.js +229 -0
  87. package/dist/utils/parallel-scanner.js.map +1 -0
  88. package/dist/utils/pattern-validator.d.ts +108 -0
  89. package/dist/utils/pattern-validator.d.ts.map +1 -0
  90. package/dist/utils/pattern-validator.js +315 -0
  91. package/dist/utils/pattern-validator.js.map +1 -0
  92. package/dist/utils/progress-reporter.d.ts +68 -0
  93. package/dist/utils/progress-reporter.d.ts.map +1 -0
  94. package/dist/utils/progress-reporter.js +194 -0
  95. package/dist/utils/progress-reporter.js.map +1 -0
  96. package/dist/utils/result-cache.d.ts +99 -0
  97. package/dist/utils/result-cache.d.ts.map +1 -0
  98. package/dist/utils/result-cache.js +335 -0
  99. package/dist/utils/result-cache.js.map +1 -0
  100. package/package.json +80 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,32 @@
1
+ # Changelog
2
+
3
+ All notable changes to Avana will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ ### Added
11
+ - Initial release of Avana
12
+ - 80+ secret detection patterns
13
+ - CLI interface with scan command
14
+ - Security score calculation
15
+ - Smart ignore patterns
16
+ - CI/CD integration support
17
+ - Comprehensive test suite
18
+ - Full TypeScript support
19
+
20
+ ## [1.0.0] - 2026-01-16
21
+
22
+ ### Added
23
+ - Core scanning engine
24
+ - Secret pattern detection
25
+ - File system traversal
26
+ - Security scoring algorithm
27
+ - CLI command interface
28
+ - Error handling and validation
29
+ - Documentation and examples
30
+
31
+ [Unreleased]: https://github.com/yourusername/avana/compare/v1.0.0...HEAD
32
+ [1.0.0]: https://github.com/yourusername/avana/releases/tag/v1.0.0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Avana Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,584 @@
1
+ # Avana ๐Ÿ”’
2
+
3
+ **A robust, production-ready CLI tool for detecting secrets and credentials in your codebase**
4
+
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
6
+ [![Node.js Version](https://img.shields.io/badge/node-%3E%3D18.0.0-brightgreen)](https://nodejs.org/)
7
+ [![TypeScript](https://img.shields.io/badge/TypeScript-5.0-blue)](https://www.typescriptlang.org/)
8
+
9
+ ---
10
+
11
+ ## ๐ŸŽฏ Overview
12
+
13
+ Avana prevents costly security breaches by detecting hardcoded secrets, API keys, and credentials before they reach your repository. With 100+ detection patterns, robust file handling, and comprehensive testing, Avana is the security scanner you can trust.
14
+
15
+ ### Why Avana?
16
+
17
+ - **100+ Detection Patterns**: Comprehensive coverage for all major services (AWS, OpenAI, Stripe, GitHub, Web3, and more)
18
+ - **High Performance**: Scans 10,000+ files in under 10 seconds with parallel processing
19
+ - **Robust File Handling**: Binary detection, encoding support, large file streaming (>10MB)
20
+ - **Smart Ignore System**: Respects .gitignore, .avanaignore, and custom patterns
21
+ - **Multiple Output Formats**: Console, JSON, and Markdown reports
22
+ - **CI/CD Ready**: Standard exit codes and structured output for pipeline integration
23
+ - **Production-Ready**: Comprehensive error handling, memory management, and property-based testing
24
+
25
+ ---
26
+
27
+ ## ๐Ÿš€ Quick Start
28
+
29
+ ### Installation
30
+
31
+ ```bash
32
+ # Install globally
33
+ npm install -g avana
34
+
35
+ # Or use with npx (no installation required)
36
+ npx avana scan
37
+ ```
38
+
39
+ ### Basic Usage
40
+
41
+ ```bash
42
+ # Scan current directory
43
+ npm run scan
44
+
45
+ # Scan with verbose output
46
+ npm run scan:verbose
47
+
48
+ # Scan specific path
49
+ avana scan --path ./my-project
50
+
51
+ # Scan with JSON output
52
+ avana scan --json
53
+
54
+ # Scan with custom ignore patterns
55
+ avana scan --ignore "**/*.md" --ignore "tests/**"
56
+
57
+ # Scan with memory and worker limits
58
+ avana scan --max-memory 1000 --workers 4
59
+
60
+ # Install Git pre-commit hooks
61
+ avana install
62
+
63
+ # Remove Git hooks
64
+ avana uninstall
65
+ ```
66
+
67
+ ### Git Hook Integration
68
+
69
+ Avana can automatically scan your code before each commit to prevent secrets from being committed:
70
+
71
+ ```bash
72
+ # Install pre-commit hook
73
+ avana install
74
+
75
+ # Now every commit will be scanned automatically
76
+ git add .
77
+ git commit -m "feat: add new feature"
78
+ # ๐Ÿ”’ Running Avana security scan...
79
+ # โœ… No security issues found in staged files
80
+ ```
81
+
82
+ **What happens:**
83
+ - Before each commit, Avana scans only your staged files (fast!)
84
+ - Commits with critical or high severity issues are blocked
85
+ - You get clear error messages with file locations and fix suggestions
86
+ - Scans complete in under 2 seconds
87
+
88
+ **To bypass** (not recommended):
89
+ ```bash
90
+ git commit --no-verify
91
+ ```
92
+
93
+ ### Example Output
94
+
95
+ ```
96
+ ๐Ÿ” Scanning project for security issues...
97
+ ๐Ÿ“ Path: ./my-project
98
+
99
+ โœ… Scan complete in 1234ms
100
+
101
+ ๐Ÿšจ SECURITY ISSUES FOUND
102
+
103
+ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
104
+ โ”‚ ๐Ÿ”ด Critical: 2 โ”‚
105
+ โ”‚ ๐ŸŸ  High: 1 โ”‚
106
+ โ”‚ ๐ŸŸก Medium: 0 โ”‚
107
+ โ”‚ ๐ŸŸข Low: 0 โ”‚
108
+ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
109
+
110
+ ๐Ÿ”ด OpenAI API Key
111
+ File: src/config.ts:12
112
+ OpenAI API key detected
113
+ โœ… Fix: Move to environment variable: OPENAI_API_KEY
114
+
115
+ ๐Ÿ“Š Security Score: 60/100
116
+ ```
117
+
118
+ ---
119
+
120
+ ## โœจ Features
121
+
122
+ ### Comprehensive Detection
123
+
124
+ Avana detects 100+ types of secrets across major services:
125
+
126
+ - **AI/ML APIs**: OpenAI, Anthropic, Hugging Face, Cohere
127
+ - **Cloud Providers**: AWS, Azure, GCP, DigitalOcean
128
+ - **Payment Processors**: Stripe, PayPal, Square, Adyen
129
+ - **Web3/Blockchain**: Ethereum, Bitcoin, Solana, Polygon, DeFi protocols
130
+ - **Version Control**: GitHub, GitLab, Bitbucket tokens
131
+ - **Communication**: Slack, Discord, Telegram, Twilio, WhatsApp
132
+ - **Email Services**: SendGrid, Mailgun, Mailchimp, Postmark
133
+ - **Databases**: PostgreSQL, MongoDB, Redis connection strings
134
+ - **Private Keys**: RSA, SSH, PGP, EC keys, JWT secrets
135
+ - **OAuth Providers**: Google, Microsoft, Apple, Facebook, Twitter
136
+ - **And 70+ more patterns**
137
+
138
+ ### Insecure Code Pattern Detection
139
+
140
+ Avana also detects insecure coding patterns that could lead to vulnerabilities:
141
+
142
+ - **Code Execution**: `eval()`, Function constructor
143
+ - **SQL Injection**: String concatenation in SQL queries
144
+ - **Command Injection**: Unsafe `exec()` usage
145
+ - **Weak Cryptography**: MD5, SHA1, insecure random
146
+ - **Path Traversal**: `../` patterns, unsafe file operations
147
+ - **XSS Vulnerabilities**: Unsafe `innerHTML` usage
148
+ - **Deserialization**: Unsafe YAML/pickle loading
149
+ - **Configuration Issues**: Hardcoded URLs, CORS wildcards
150
+ - **And 20+ more patterns**
151
+
152
+ ### Smart Ignore System
153
+
154
+ Automatically skips:
155
+ - **Dependencies**: `node_modules`, `vendor`, `bower_components`
156
+ - **Build outputs**: `dist`, `build`, `out`, `.next`, `target`
157
+ - **Version control**: `.git`, `.svn`, `.hg`
158
+ - **IDE files**: `.vscode`, `.idea`, `*.swp`
159
+ - **Test coverage**: `coverage`, `.nyc_output`
160
+ - **Lock files**: `package-lock.json`, `yarn.lock`, `Cargo.lock`
161
+ - **Binary files**: Images, executables, archives
162
+ - **Cache directories**: `.cache`, `tmp`, `temp`
163
+
164
+ ### Custom Ignore Patterns
165
+
166
+ Create a `.avanaignore` file in your project root:
167
+
168
+ ```gitignore
169
+ # Custom ignore patterns
170
+ docs/**
171
+ *.md
172
+ test-fixtures/**
173
+ legacy-code/**
174
+
175
+ # Comments are supported
176
+ # Glob patterns work: *, **, ?
177
+ **/*.backup
178
+ temp-*
179
+ ```
180
+
181
+ ### Performance Features
182
+
183
+ - **Parallel Processing**: Multi-threaded scanning with configurable worker count
184
+ - **Memory Management**: Automatic garbage collection and configurable memory limits
185
+ - **Large File Streaming**: Efficient handling of files >10MB with chunked processing
186
+ - **Result Caching**: 24-hour cache with file modification tracking
187
+ - **Binary Detection**: Smart binary file exclusion to avoid false positives
188
+ - **Progress Reporting**: Real-time progress with ETA calculation
189
+
190
+ ### Security Score
191
+
192
+ - Starts at 100 (perfect)
193
+ - Critical: -20 points each
194
+ - High: -10 points each
195
+ - Medium: -5 points each
196
+ - Low: -2 points each
197
+
198
+ ---
199
+
200
+ ## ๐Ÿ“– Documentation
201
+
202
+ ### Command Line Options
203
+
204
+ ```bash
205
+ # Scan command
206
+ avana scan [options]
207
+
208
+ Options:
209
+ --path <path> Path to scan (default: current directory)
210
+ --staged Scan only Git staged files (for pre-commit hooks)
211
+ --verbose, -v Show detailed output
212
+ --debug Show debug information
213
+ --quiet Show minimal output
214
+ --json Save results to JSON file
215
+ --output-json Save results to JSON file (alias for --json)
216
+ --output-md Save results to Markdown file
217
+ --no-progress Disable progress bar
218
+ --fail-on-high Exit with code 1 on high severity issues
219
+ --max-memory <mb> Set memory limit in MB (default: 500)
220
+ --workers <count> Set number of worker threads (default: CPU count - 1)
221
+ --ignore <pattern> Ignore files matching pattern (can be used multiple times)
222
+ --help, -h Show help message
223
+
224
+ # Git hook commands
225
+ avana install Install Git pre-commit hooks
226
+ avana uninstall Remove Git pre-commit hooks
227
+
228
+ # Examples
229
+ avana scan
230
+ avana scan --path ./my-project
231
+ avana scan --staged
232
+ avana scan --verbose --debug
233
+ avana scan --json --output-md
234
+ avana scan --fail-on-high
235
+ avana scan --max-memory 1000 --workers 4
236
+ avana scan --ignore "**/*.md" --ignore "tests/**"
237
+ ```
238
+
239
+ ### Exit Codes
240
+
241
+ Avana uses standard exit codes for CI/CD integration:
242
+
243
+ - **0**: No critical or high severity issues found (success)
244
+ - **1**: Critical or high severity issues detected (blocks CI/CD and commits)
245
+ - **2**: Invalid arguments or configuration error
246
+ - **3**: Unexpected error occurred (system error)
247
+
248
+ ### Output Formats
249
+
250
+ #### Console Output (Default)
251
+ ```
252
+ ๐Ÿ” Scanning project for security issues...
253
+ ๐Ÿ“ Path: ./my-project
254
+
255
+ โœ… Scan complete in 1234ms
256
+
257
+ ๐Ÿšจ SECURITY ISSUES FOUND
258
+
259
+ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
260
+ โ”‚ ๐Ÿ”ด Critical: 2 โ”‚
261
+ โ”‚ ๐ŸŸ  High: 1 โ”‚
262
+ โ”‚ ๐ŸŸก Medium: 0 โ”‚
263
+ โ”‚ ๐ŸŸข Low: 0 โ”‚
264
+ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
265
+
266
+ ๐Ÿ”ด OpenAI API Key
267
+ File: src/config.ts:12
268
+ OpenAI API key detected
269
+ โœ… Fix: Move to environment variable: OPENAI_API_KEY
270
+
271
+ ๐Ÿ“Š Security Score: 60/100
272
+ ```
273
+
274
+ #### JSON Output (--json)
275
+ ```json
276
+ {
277
+ "success": false,
278
+ "timestamp": "2024-01-17T10:30:00.000Z",
279
+ "duration": 1234,
280
+ "filesScanned": 150,
281
+ "securityScore": 60,
282
+ "issues": [
283
+ {
284
+ "id": "openai-api-key-001",
285
+ "type": "OpenAI API Key",
286
+ "severity": "critical",
287
+ "message": "OpenAI API key detected",
288
+ "file": "src/config.ts",
289
+ "line": 12,
290
+ "match": "sk-1234567890abcdef",
291
+ "confidence": 0.95,
292
+ "rule": {
293
+ "id": "openai-api-key",
294
+ "name": "OpenAI API Key"
295
+ }
296
+ }
297
+ ],
298
+ "summary": {
299
+ "total": 3,
300
+ "critical": 2,
301
+ "high": 1,
302
+ "medium": 0,
303
+ "low": 0,
304
+ "byType": {
305
+ "OpenAI API Key": 2,
306
+ "AWS Access Key": 1
307
+ },
308
+ "byFile": {
309
+ "src/config.ts": 2,
310
+ "src/aws.ts": 1
311
+ }
312
+ }
313
+ }
314
+ ```
315
+
316
+ #### Markdown Output (--output-md)
317
+ Generates a detailed markdown report saved to `scan-reports/avana-security-report-YYYY-MM-DD.md`
318
+
319
+ ### Git Hook Behavior
320
+
321
+ When using `avana install`:
322
+ - **Blocks commits** with critical or high severity issues
323
+ - **Allows commits** with only medium or low severity issues (with warning)
324
+ - Scans only staged files for speed (< 2 seconds)
325
+ - Provides clear error messages with fix suggestions
326
+ - Uses `--fail-on-high` flag by default for stricter security
327
+
328
+ ### Troubleshooting
329
+
330
+ #### Common Issues
331
+
332
+ **Memory Issues**
333
+ ```bash
334
+ # Increase memory limit
335
+ avana scan --max-memory 1000
336
+
337
+ # Reduce worker count
338
+ avana scan --workers 2
339
+ ```
340
+
341
+ **Performance Issues**
342
+ ```bash
343
+ # Add ignore patterns for large directories
344
+ avana scan --ignore "node_modules/**" --ignore "dist/**"
345
+
346
+ # Use .avanaignore file for persistent patterns
347
+ echo "large-data/**" >> .avanaignore
348
+ ```
349
+
350
+ **False Positives**
351
+ ```bash
352
+ # Use ignore patterns for test files
353
+ avana scan --ignore "**/*.test.ts" --ignore "fixtures/**"
354
+
355
+ # Check pattern confidence scores in JSON output
356
+ avana scan --json
357
+ ```
358
+
359
+ **Binary File Warnings**
360
+ ```bash
361
+ # Enable debug mode to see file processing details
362
+ avana scan --debug
363
+
364
+ # Binary files are automatically skipped
365
+ ```
366
+
367
+ #### Performance Characteristics
368
+
369
+ - **Small projects** (< 100 files): < 1 second
370
+ - **Medium projects** (100-1,000 files): 1-3 seconds
371
+ - **Large projects** (1,000-10,000 files): 3-10 seconds
372
+ - **Very large projects** (> 10,000 files): 10+ seconds
373
+
374
+ Memory usage typically stays under 200MB for most projects, with a default limit of 500MB.
375
+
376
+ ### CI/CD Integration
377
+
378
+ #### GitHub Actions
379
+
380
+ ```yaml
381
+ name: Security Scan
382
+ on: [push, pull_request]
383
+
384
+ jobs:
385
+ security:
386
+ runs-on: ubuntu-latest
387
+ steps:
388
+ - uses: actions/checkout@v3
389
+ - uses: actions/setup-node@v3
390
+ with:
391
+ node-version: '18'
392
+ - name: Run Avana Security Scan
393
+ run: npx avana scan --json
394
+ - name: Upload scan results
395
+ if: always()
396
+ uses: actions/upload-artifact@v3
397
+ with:
398
+ name: security-scan-results
399
+ path: scan-reports/
400
+ ```
401
+
402
+ #### GitLab CI
403
+
404
+ ```yaml
405
+ security_scan:
406
+ stage: test
407
+ script:
408
+ - npx avana scan --json --fail-on-high
409
+ artifacts:
410
+ when: always
411
+ paths:
412
+ - scan-reports/
413
+ reports:
414
+ junit: scan-reports/*.json
415
+ only:
416
+ - merge_requests
417
+ - main
418
+ ```
419
+
420
+ #### Jenkins Pipeline
421
+
422
+ ```groovy
423
+ pipeline {
424
+ agent any
425
+ stages {
426
+ stage('Security Scan') {
427
+ steps {
428
+ sh 'npx avana scan --json'
429
+ archiveArtifacts artifacts: 'scan-reports/*', allowEmptyArchive: true
430
+ publishHTML([
431
+ allowMissing: false,
432
+ alwaysLinkToLastBuild: true,
433
+ keepAll: true,
434
+ reportDir: 'scan-reports',
435
+ reportFiles: '*.html',
436
+ reportName: 'Security Scan Report'
437
+ ])
438
+ }
439
+ }
440
+ }
441
+ post {
442
+ always {
443
+ cleanWs()
444
+ }
445
+ }
446
+ }
447
+ ```
448
+
449
+ ---
450
+
451
+ ## ๐Ÿ—๏ธ Development
452
+
453
+ ### Prerequisites
454
+
455
+ - Node.js 18+
456
+ - npm or yarn
457
+
458
+ ### Setup
459
+
460
+ ```bash
461
+ # Clone repository
462
+ git clone https://github.com/yourusername/avana.git
463
+ cd avana
464
+
465
+ # Install dependencies
466
+ npm install
467
+
468
+ # Build
469
+ npm run build
470
+
471
+ # Run tests
472
+ npm test
473
+
474
+ # Run with coverage
475
+ npm run test:coverage
476
+ ```
477
+
478
+ ### Project Structure
479
+
480
+ ```
481
+ avana/
482
+ โ”œโ”€โ”€ src/
483
+ โ”‚ โ”œโ”€โ”€ types/ # TypeScript type definitions
484
+ โ”‚ โ”œโ”€โ”€ rules/ # Secret detection patterns
485
+ โ”‚ โ”œโ”€โ”€ scanners/ # File scanning logic
486
+ โ”‚ โ”œโ”€โ”€ commands/ # CLI commands
487
+ โ”‚ โ”œโ”€โ”€ index.ts # Main engine
488
+ โ”‚ โ””โ”€โ”€ cli.ts # CLI entry point
489
+ โ”œโ”€โ”€ tests/ # Test files
490
+ โ”œโ”€โ”€ .kiro/ # Kiro CLI configuration
491
+ โ”‚ โ”œโ”€โ”€ specs/ # Feature specifications
492
+ โ”‚ โ”œโ”€โ”€ steering/ # Development guidelines
493
+ โ”‚ โ””โ”€โ”€ DEVLOG.md # Development log
494
+ โ”œโ”€โ”€ README.md
495
+ โ”œโ”€โ”€ LICENSE
496
+ โ””โ”€โ”€ package.json
497
+ ```
498
+
499
+ ---
500
+
501
+ ## ๐Ÿงช Testing
502
+
503
+ Avana includes comprehensive testing with property-based testing:
504
+
505
+ - **Unit Tests**: Core functionality and edge cases
506
+ - **Property-Based Tests**: 15 properties with 100+ iterations each using fast-check
507
+ - **Integration Tests**: End-to-end workflows and CLI integration
508
+ - **Performance Tests**: Memory usage and scan speed validation
509
+
510
+ ```bash
511
+ # Run all tests
512
+ npm test
513
+
514
+ # Run with coverage
515
+ npm run test:coverage
516
+
517
+ # Run property-based tests only
518
+ npm test -- --grep "property"
519
+
520
+ # Run integration tests only
521
+ npm test -- --grep "integration"
522
+
523
+ # Watch mode for development
524
+ npm run test:watch
525
+ ```
526
+
527
+ #### Property-Based Testing
528
+
529
+ Avana uses property-based testing to validate correctness across thousands of generated inputs:
530
+
531
+ - **Binary File Exclusion**: Ensures binary files are never scanned
532
+ - **Large File Streaming**: Validates chunked processing for files >10MB
533
+ - **Encoding Handling**: Tests UTF-8, UTF-16, Latin-1, and ASCII support
534
+ - **Memory Limit Enforcement**: Verifies memory usage stays within bounds
535
+ - **Parallel Scan Equivalence**: Ensures parallel and sequential scans produce identical results
536
+ - **Cache Correctness**: Validates cache hits/misses and expiration
537
+ - **Pattern Compilation**: Tests all 100+ regex patterns for correctness
538
+ - **And 8 more properties** covering error recovery, progress reporting, and output formatting
539
+
540
+ ---
541
+
542
+ ## ๐Ÿค Contributing
543
+
544
+ Contributions are welcome! Please read our [Contributing Guidelines](CONTRIBUTING.md) first.
545
+
546
+ 1. Fork the repository
547
+ 2. Create a feature branch (`git checkout -b feature/amazing-feature`)
548
+ 3. Make your changes
549
+ 4. Write tests
550
+ 5. Commit your changes (`git commit -m 'feat: add amazing feature'`)
551
+ 6. Push to the branch (`git push origin feature/amazing-feature`)
552
+ 7. Open a Pull Request
553
+
554
+ ---
555
+
556
+ ## ๐Ÿ“„ License
557
+
558
+ MIT License - see [LICENSE](LICENSE) file for details.
559
+
560
+ ---
561
+
562
+ ## ๐Ÿ™ Acknowledgments
563
+
564
+ - Built with [Kiro CLI](https://kiro.dev) - AI-powered development assistant
565
+ - Inspired by security best practices from the developer community
566
+ - Pattern database curated from real-world security incidents
567
+
568
+ ---
569
+
570
+ ## ๐Ÿ“ž Support
571
+
572
+ - **Issues**: [GitHub Issues](https://github.com/yourusername/avana/issues)
573
+ - **Discussions**: [GitHub Discussions](https://github.com/yourusername/avana/discussions)
574
+ - **Email**: inno.okeke@github.com
575
+
576
+ ---
577
+
578
+ <div align="center">
579
+
580
+ **Prevent security breaches before they happen**
581
+
582
+ *Built with โค๏ธ for developers who care about security*
583
+
584
+ </div>
package/dist/cli.d.ts ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Avana CLI
4
+ * Command-line interface for security scanning
5
+ */
6
+ export {};
7
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA;;;GAGG"}