codesummary 1.0.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.
package/features.md ADDED
@@ -0,0 +1,502 @@
1
+ # CodeSummary – Detailed Features and Functional Specification
2
+
3
+ ## 1. Overview
4
+
5
+ **CodeSummary** is a **Node.js-based, cross-platform CLI tool** (distributed via **npm**) that automatically scans a project's source code and generates a **clean, professional PDF document** containing:
6
+
7
+ - **Complete project file structure** with hierarchical organization
8
+ - **Full source code content** for all selected files (no truncation)
9
+ - **Intelligent file type detection** and user-selectable filtering
10
+ - **Clean, readable formatting** optimized for code documentation
11
+
12
+ Its primary goal is to **simplify code reviews, audits, and archival snapshots**, enabling teams and individuals to produce **self-contained, complete documentation** of their codebases with minimal setup.
13
+
14
+ > **Repository**: [https://github.com/skamoll/CodeSummary](https://github.com/skamoll/CodeSummary)
15
+ > **npm Package Name**: `codesummary`
16
+
17
+ ---
18
+
19
+ ### 1.1 Target Audience
20
+
21
+ - **Developers** needing quick overviews of large projects with complete content
22
+ - **Auditors/Consultants** requiring traceable documentation snapshots without size limits
23
+ - **Educators/Students** preparing comprehensive code handovers or learning materials
24
+ - **Teams** performing thorough code reviews or compliance checks
25
+ - **Project Managers** creating complete project documentation for stakeholders
26
+
27
+ ---
28
+
29
+ ### 1.2 Core Objectives
30
+
31
+ 1. **Complete automated documentation** — includes ALL file content without truncation
32
+ 2. **Cross-platform reliability** — identical behavior on Windows, macOS, and Linux
33
+ 3. **Advanced configurability** — user-defined filters, styles, and output preferences
34
+ 4. **Unlimited scalability** — handles projects of any size with efficient streaming
35
+ 5. **Intelligent safe defaults** — avoids binaries and unwanted files with smart filtering
36
+ 6. **Professional output** — clean, readable PDFs suitable for all professional contexts
37
+ 7. **Smart conflict handling** — automatic timestamped filenames when files are in use
38
+
39
+ ---
40
+
41
+ ### 1.3 Key Differentiators
42
+
43
+ - **No content limits** — processes files of any size completely
44
+ - **Smart file conflict resolution** — automatic timestamped fallbacks
45
+ - **Terminal compatibility** — works with all terminal types across platforms
46
+ - **Whitelist-driven filtering** with extensive language support
47
+ - **Interactive first-run setup** with persistent global configuration
48
+ - **Memory-efficient streaming** for optimal performance on large projects
49
+ - **Non-destructive scanning** with comprehensive error handling
50
+ - **Fully offline operation** with no external dependencies
51
+
52
+ ---
53
+
54
+ ### 1.4 Technology Stack
55
+
56
+ - **Node.js** ≥ 18 (for native ES modules and modern APIs)
57
+ - **PDFKit** for professional PDF generation with streaming support
58
+ - **Inquirer.js** for interactive command-line prompts
59
+ - **Chalk** for cross-platform terminal styling
60
+ - **Ora** for progress indicators and status updates
61
+ - **fs-extra** for enhanced file system operations
62
+
63
+ ---
64
+
65
+ ## 2. Functional Requirements
66
+
67
+ ### 2.1 Command-Line Interface
68
+
69
+ #### 2.1.1 Primary Commands
70
+
71
+ | Command | Description | Example |
72
+ |---------|-------------|---------|
73
+ | `codesummary` | Scan current directory and generate PDF | `codesummary` |
74
+ | `codesummary config` | Launch interactive configuration editor | `codesummary config` |
75
+ | `codesummary --show-config` | Display current configuration settings | `codesummary --show-config` |
76
+ | `codesummary --reset-config` | Reset to defaults and run setup wizard | `codesummary --reset-config` |
77
+ | `codesummary --help` | Show comprehensive help information | `codesummary --help` |
78
+
79
+ #### 2.1.2 Command-Line Options
80
+
81
+ | Option | Short | Description | Example |
82
+ |--------|-------|-------------|---------|
83
+ | `--output` | `-o` | Override output directory | `codesummary -o ./docs` |
84
+ | `--show-config` | - | Display current configuration | `codesummary --show-config` |
85
+ | `--reset-config` | - | Reset configuration to defaults | `codesummary --reset-config` |
86
+ | `--help` | `-h` | Show help message | `codesummary -h` |
87
+
88
+ #### 2.1.3 Interactive Workflow
89
+
90
+ 1. **First-Run Setup**
91
+ - Detects missing configuration automatically
92
+ - Launches interactive setup wizard
93
+ - Configures output mode (relative/fixed path)
94
+ - Creates output directory if needed
95
+ - Saves persistent global configuration
96
+
97
+ 2. **Directory Scanning**
98
+ - Recursively scans current working directory
99
+ - Applies whitelist filtering for file extensions
100
+ - Excludes common build/dependency directories
101
+ - Shows comprehensive scan summary with statistics
102
+
103
+ 3. **Extension Selection**
104
+ - Presents detected file types in checkbox format
105
+ - Shows file counts for each extension
106
+ - Allows selective inclusion/exclusion
107
+ - Pre-selects all detected extensions by default
108
+
109
+ 4. **PDF Generation**
110
+ - Processes all selected files completely (no truncation)
111
+ - Shows progress indicators for large files
112
+ - Handles file conflicts with timestamped names
113
+ - Generates clean, professional PDF output
114
+
115
+ ---
116
+
117
+ ### 2.2 Configuration Management
118
+
119
+ #### 2.2.1 Global Configuration Storage
120
+
121
+ **Storage Locations:**
122
+ - **Linux/macOS**: `~/.codesummary/config.json`
123
+ - **Windows**: `%APPDATA%\\CodeSummary\\config.json`
124
+
125
+ #### 2.2.2 Configuration Structure
126
+
127
+ ```json
128
+ {
129
+ \"output\": {
130
+ \"mode\": \"fixed\" | \"relative\",
131
+ \"fixedPath\": \"string (absolute path)\"
132
+ },
133
+ \"allowedExtensions\": [\"array of file extensions\"],
134
+ \"excludeDirs\": [\"array of directory names to exclude\"],
135
+ \"styles\": {
136
+ \"colors\": {
137
+ \"title\": \"#333353\",
138
+ \"section\": \"#00FFB9\",
139
+ \"text\": \"#333333\",
140
+ \"error\": \"#FF4D4D\",
141
+ \"footer\": \"#666666\"
142
+ },
143
+ \"layout\": {
144
+ \"marginLeft\": 40,
145
+ \"marginTop\": 40,
146
+ \"marginRight\": 40,
147
+ \"footerHeight\": 20
148
+ }
149
+ },
150
+ \"settings\": {
151
+ \"documentTitle\": \"Project Code Summary\",
152
+ \"maxFilesBeforePrompt\": 500
153
+ }
154
+ }
155
+ ```
156
+
157
+ #### 2.2.3 Configuration Features
158
+
159
+ - **Cross-platform path handling** with automatic normalization
160
+ - **Validation system** prevents invalid configurations
161
+ - **Interactive editor** for all configuration sections
162
+ - **Automatic backup and recovery** for corrupted configurations
163
+ - **Reset functionality** to restore defaults
164
+
165
+ ---
166
+
167
+ ### 2.3 File System Scanning
168
+
169
+ #### 2.3.1 Scanning Algorithm
170
+
171
+ 1. **Recursive Directory Traversal**
172
+ - Starts from current working directory
173
+ - Follows symbolic links safely
174
+ - Respects file system permissions
175
+ - Handles large directory structures efficiently
176
+
177
+ 2. **Filtering Logic**
178
+ - **Whitelist approach**: Only processes explicitly allowed extensions
179
+ - **Directory exclusions**: Skips common build/dependency directories
180
+ - **Hidden file handling**: Includes important dot files (.gitignore, .env.example)
181
+ - **Binary detection**: Automatically skips binary files
182
+
183
+ 3. **Error Handling**
184
+ - Graceful handling of permission denied errors
185
+ - Continues scanning despite individual file failures
186
+ - Logs warnings for inaccessible files
187
+ - Provides detailed error context
188
+
189
+ #### 2.3.2 Supported File Extensions
190
+
191
+ **Programming Languages:**
192
+ - JavaScript: `.js`, `.jsx`, `.mjs`
193
+ - TypeScript: `.ts`, `.tsx`, `.d.ts`
194
+ - Python: `.py`, `.pyw`, `.pyx`
195
+ - Java: `.java`
196
+ - C/C++: `.c`, `.cpp`, `.cc`, `.cxx`, `.h`, `.hpp`
197
+ - C#: `.cs`
198
+ - Go: `.go`
199
+ - Rust: `.rs`
200
+ - Swift: `.swift`
201
+ - Kotlin: `.kt`, `.kts`
202
+ - Scala: `.scala`
203
+ - PHP: `.php`, `.phtml`
204
+ - Ruby: `.rb`, `.rbw`
205
+
206
+ **Web Technologies:**
207
+ - HTML: `.html`, `.htm`
208
+ - CSS: `.css`, `.scss`, `.sass`, `.less`
209
+ - Vue.js: `.vue`
210
+ - Svelte: `.svelte`
211
+
212
+ **Data & Configuration:**
213
+ - JSON: `.json`, `.jsonc`
214
+ - XML: `.xml`, `.xsd`, `.xsl`
215
+ - YAML: `.yaml`, `.yml`
216
+ - TOML: `.toml`
217
+ - SQL: `.sql`
218
+ - GraphQL: `.graphql`, `.gql`
219
+
220
+ **Scripts & Shell:**
221
+ - Shell: `.sh`, `.bash`, `.zsh`
222
+ - Batch: `.bat`, `.cmd`
223
+ - PowerShell: `.ps1`, `.psm1`
224
+
225
+ **Documentation:**
226
+ - Markdown: `.md`, `.markdown`
227
+ - Text: `.txt`
228
+ - Dockerfile: `.dockerfile`
229
+
230
+ #### 2.3.3 Directory Exclusions
231
+
232
+ **Default Excluded Directories:**
233
+ - `node_modules` (Node.js dependencies)
234
+ - `.git` (Git version control)
235
+ - `.vscode` (VS Code settings)
236
+ - `dist`, `build` (Build outputs)
237
+ - `coverage` (Test coverage reports)
238
+ - `out` (Output directories)
239
+ - `__pycache__` (Python cache)
240
+ - `.next` (Next.js build)
241
+ - `.nuxt` (Nuxt.js build)
242
+ - `vendor` (Dependency directories)
243
+ - `.cache` (Cache directories)
244
+
245
+ ---
246
+
247
+ ### 2.4 PDF Generation
248
+
249
+ #### 2.4.1 Document Structure
250
+
251
+ **1. Project Overview Section**
252
+ - Document title (configurable)
253
+ - Project name (derived from directory)
254
+ - Generation timestamp
255
+ - List of included file types with descriptions
256
+ - Clean, professional formatting
257
+
258
+ **2. File Structure Section**
259
+ - Complete hierarchical file listing
260
+ - Organized by relative paths from project root
261
+ - Sorted alphabetically for easy navigation
262
+ - Monospace font for proper alignment
263
+
264
+ **3. File Content Section**
265
+ - **Complete source code** for each selected file
266
+ - **No truncation or size limits**
267
+ - Proper monospace formatting for code readability
268
+ - File headers with clear identification
269
+ - Natural page breaks when needed
270
+ - Error handling for unreadable files
271
+
272
+ #### 2.4.2 PDF Specifications
273
+
274
+ **Format & Layout:**
275
+ - **Paper size**: A4 (595 × 842 points)
276
+ - **Margins**: 40pt on all sides for optimal content area
277
+ - **Fonts**:
278
+ - Headers: Helvetica Bold
279
+ - Body text: Helvetica
280
+ - Code content: Courier (monospace)
281
+ - **Colors**: Professional color scheme with high contrast
282
+
283
+ **Advanced Features:**
284
+ - **Streaming generation** for memory efficiency
285
+ - **Automatic page breaks** handled by PDFKit
286
+ - **Smart file conflict handling** with timestamped names
287
+ - **Progress indicators** for large file processing
288
+ - **Error recovery** with graceful failure handling
289
+
290
+ #### 2.4.3 File Naming Convention
291
+
292
+ **Standard naming:**
293
+ ```
294
+ PROJECTNAME_code.pdf
295
+ ```
296
+
297
+ **Conflict resolution (when file is in use):**
298
+ ```
299
+ PROJECTNAME_code_YYYYMMDD_HHMMSS.pdf
300
+ ```
301
+
302
+ **Example:**
303
+ ```
304
+ MYPROJECT_code.pdf # Standard
305
+ MYPROJECT_code_20250729_141602.pdf # Timestamped fallback
306
+ ```
307
+
308
+ ---
309
+
310
+ ### 2.5 Cross-Platform Compatibility
311
+
312
+ #### 2.5.1 Operating System Support
313
+
314
+ - **Windows** (10, 11, Server 2019+)
315
+ - **macOS** (10.15+, including Apple Silicon)
316
+ - **Linux** (Ubuntu 18.04+, CentOS 7+, other major distributions)
317
+
318
+ #### 2.5.2 Terminal Compatibility
319
+
320
+ - **Universal ASCII output** - no special Unicode characters
321
+ - **Color support detection** with graceful fallbacks
322
+ - **All terminal types supported** (cmd, PowerShell, bash, zsh, fish)
323
+ - **Screen reader compatible** output format
324
+
325
+ #### 2.5.3 Path Handling
326
+
327
+ - **Automatic path normalization** across platforms
328
+ - **Unicode filename support** for international characters
329
+ - **Long path support** on Windows (>260 characters)
330
+ - **Case sensitivity handling** appropriate to each platform
331
+
332
+ ---
333
+
334
+ ### 2.6 Performance & Scalability
335
+
336
+ #### 2.6.1 Memory Management
337
+
338
+ - **Streaming file processing** to minimize memory usage
339
+ - **Efficient PDF generation** with incremental building
340
+ - **Garbage collection optimization** for large projects
341
+ - **Memory usage monitoring** with warnings for extreme cases
342
+
343
+ #### 2.6.2 Large Project Handling
344
+
345
+ - **No file size limits** - processes files of any size completely
346
+ - **Progress indicators** for files with >1000 lines
347
+ - **Configurable warning thresholds** (default: 500 files)
348
+ - **User confirmation** for very large projects
349
+ - **Streaming architecture** prevents memory overflow
350
+
351
+ #### 2.6.3 Performance Optimizations
352
+
353
+ - **Parallel file scanning** where safe
354
+ - **Efficient binary detection** to skip non-text files quickly
355
+ - **Smart caching** of file metadata
356
+ - **Optimized PDF rendering** with minimal memory footprint
357
+
358
+ ---
359
+
360
+ ### 2.7 Error Handling & Validation
361
+
362
+ #### 2.7.1 Input Validation
363
+
364
+ - **Path validation** with security checks
365
+ - **Configuration validation** with schema enforcement
366
+ - **File extension validation** with normalization
367
+ - **Permission checking** before operations
368
+
369
+ #### 2.7.2 Error Recovery
370
+
371
+ - **Graceful degradation** when files are inaccessible
372
+ - **Automatic retry** for transient failures
373
+ - **Detailed error logging** with context information
374
+ - **User-friendly error messages** with suggested solutions
375
+
376
+ #### 2.7.3 File Conflict Handling
377
+
378
+ - **Automatic detection** of files in use
379
+ - **Timestamped filename generation** for conflicts
380
+ - **User notification** of filename changes
381
+ - **Fallback mechanisms** for write failures
382
+
383
+ ---
384
+
385
+ ## 3. Technical Architecture
386
+
387
+ ### 3.1 Module Structure
388
+
389
+ ```
390
+ src/
391
+ ├── cli.js # Command-line interface and user interaction
392
+ ├── configManager.js # Global configuration management
393
+ ├── scanner.js # File system scanning and filtering
394
+ ├── pdfGenerator.js # PDF creation and formatting
395
+ └── errorHandler.js # Comprehensive error handling
396
+ ```
397
+
398
+ ### 3.2 Key Design Patterns
399
+
400
+ - **Modular architecture** with clear separation of concerns
401
+ - **Event-driven processing** for scalable file handling
402
+ - **Stream-based operations** for memory efficiency
403
+ - **Functional programming principles** where appropriate
404
+ - **Comprehensive error boundaries** with graceful recovery
405
+
406
+ ### 3.3 Dependencies
407
+
408
+ **Core Dependencies:**
409
+ - `pdfkit` - Professional PDF generation
410
+ - `inquirer` - Interactive command-line prompts
411
+ - `chalk` - Cross-platform terminal styling
412
+ - `ora` - Progress indicators and spinners
413
+ - `fs-extra` - Enhanced file system operations
414
+
415
+ **Development Dependencies:**
416
+ - Modern ES modules (Node.js 18+)
417
+ - Native Promise-based APIs
418
+ - Cross-platform path handling
419
+ - Unicode and internationalization support
420
+
421
+ ---
422
+
423
+ ## 4. Quality Assurance
424
+
425
+ ### 4.1 Testing Strategy
426
+
427
+ - **Cross-platform testing** on Windows, macOS, and Linux
428
+ - **Large project stress testing** with thousands of files
429
+ - **Memory usage profiling** for optimization
430
+ - **Terminal compatibility verification** across different environments
431
+ - **File conflict scenario testing** with various edge cases
432
+
433
+ ### 4.2 Security Considerations
434
+
435
+ - **Path traversal prevention** with input validation
436
+ - **Permission-based access control** respecting system security
437
+ - **No external network dependencies** for complete offline operation
438
+ - **Safe file handling** with proper error boundaries
439
+ - **Configuration validation** to prevent malicious settings
440
+
441
+ ### 4.3 Documentation Standards
442
+
443
+ - **Comprehensive README** with usage examples
444
+ - **Detailed feature specification** (this document)
445
+ - **Inline code documentation** with JSDoc standards
446
+ - **Error message clarity** with actionable guidance
447
+ - **Contributing guidelines** for open-source collaboration
448
+
449
+ ---
450
+
451
+ ## 5. Future Enhancements
452
+
453
+ ### 5.1 Planned Features
454
+
455
+ - **Syntax highlighting** in PDF output for better code readability
456
+ - **Clickable table of contents** with bookmarks for navigation
457
+ - **Multiple output formats** (HTML, JSON, Markdown)
458
+ - **Project metrics and statistics** (line counts, complexity analysis)
459
+ - **CI/CD integration mode** for automated documentation pipelines
460
+ - **Custom PDF themes** and styling options
461
+ - **Plugin system** for custom file processors
462
+
463
+ ### 5.2 Advanced Capabilities
464
+
465
+ - **Incremental updates** for changed files only
466
+ - **Git integration** for commit-specific documentation
467
+ - **Code annotation** system for additional context
468
+ - **Multi-language support** for international users
469
+ - **Web-based configuration** interface for easier setup
470
+ - **Integration APIs** for third-party tools
471
+
472
+ ---
473
+
474
+ ## 6. Success Metrics
475
+
476
+ ### 6.1 Performance Targets
477
+
478
+ - **Scan speed**: >1000 files per second on modern hardware
479
+ - **Memory usage**: <200MB for projects with 10,000+ files
480
+ - **PDF generation**: <30 seconds for typical projects (100 files)
481
+ - **Cross-platform consistency**: 100% feature parity across platforms
482
+
483
+ ### 6.2 Quality Targets
484
+
485
+ - **Zero data loss**: All file content included without truncation
486
+ - **Error rate**: <0.1% failure rate on valid projects
487
+ - **User satisfaction**: Clear, actionable error messages for all failure cases
488
+ - **Compatibility**: Works on 99%+ of supported platform/terminal combinations
489
+
490
+ ---
491
+
492
+ ## 7. Conclusion
493
+
494
+ CodeSummary represents a comprehensive solution for automated code documentation, combining professional-grade PDF output with intelligent file processing and cross-platform compatibility. Its focus on complete content inclusion, smart conflict handling, and terminal compatibility makes it suitable for both individual developers and enterprise environments.
495
+
496
+ The tool's architecture supports unlimited scalability while maintaining efficient resource usage, ensuring it can handle projects of any size. With its extensive language support and intelligent filtering, CodeSummary serves as a valuable tool for code reviews, audits, documentation, and archival purposes.
497
+
498
+ ---
499
+
500
+ **Document Version**: 2.0
501
+ **Last Updated**: January 2025
502
+ **Status**: Implementation Complete - Ready for Release
package/package.json ADDED
@@ -0,0 +1,84 @@
1
+ {
2
+ "name": "codesummary",
3
+ "version": "1.0.0",
4
+ "description": "Cross-platform CLI tool that automatically generates comprehensive PDF documentation from project source code with complete content processing and smart conflict handling",
5
+ "main": "src/index.js",
6
+ "type": "module",
7
+ "bin": {
8
+ "codesummary": "./bin/codesummary.js"
9
+ },
10
+ "scripts": {
11
+ "start": "node bin/codesummary.js",
12
+ "dev": "node bin/codesummary.js",
13
+ "test": "node bin/codesummary.js --help",
14
+ "lint": "eslint src/ bin/",
15
+ "format": "prettier --write .",
16
+ "prepublishOnly": "npm run test"
17
+ },
18
+ "keywords": [
19
+ "code-documentation",
20
+ "pdf-generator",
21
+ "source-code",
22
+ "cli-tool",
23
+ "code-review",
24
+ "project-documentation",
25
+ "audit-tool",
26
+ "cross-platform",
27
+ "documentation-generator",
28
+ "pdf-export",
29
+ "code-analysis",
30
+ "file-scanner",
31
+ "project-summary",
32
+ "code-archive",
33
+ "developer-tools",
34
+ "nodejs-cli",
35
+ "automatic-documentation",
36
+ "professional-pdf",
37
+ "terminal-compatible",
38
+ "streaming-processor"
39
+ ],
40
+ "author": {
41
+ "name": "CodeSummary Contributors",
42
+ "url": "https://github.com/skamoll/CodeSummary/graphs/contributors"
43
+ },
44
+ "license": "GPL-3.0",
45
+ "repository": {
46
+ "type": "git",
47
+ "url": "git+https://github.com/skamoll/CodeSummary.git"
48
+ },
49
+ "bugs": {
50
+ "url": "https://github.com/skamoll/CodeSummary/issues"
51
+ },
52
+ "homepage": "https://github.com/skamoll/CodeSummary#readme",
53
+ "engines": {
54
+ "node": ">=18.0.0",
55
+ "npm": ">=8.0.0"
56
+ },
57
+ "files": [
58
+ "bin/",
59
+ "src/",
60
+ "README.md",
61
+ "LICENSE",
62
+ "RELEASE.md",
63
+ "features.md"
64
+ ],
65
+ "preferGlobal": true,
66
+ "dependencies": {
67
+ "pdfkit": "^0.15.0",
68
+ "inquirer": "^9.2.15",
69
+ "fs-extra": "^11.2.0",
70
+ "chalk": "^5.3.0",
71
+ "ora": "^8.0.1"
72
+ },
73
+ "devDependencies": {
74
+ "eslint": "^8.57.0",
75
+ "prettier": "^3.2.5"
76
+ },
77
+ "funding": {
78
+ "type": "github",
79
+ "url": "https://github.com/sponsors/skamoll"
80
+ },
81
+ "publishConfig": {
82
+ "access": "public"
83
+ }
84
+ }