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/README.md ADDED
@@ -0,0 +1,370 @@
1
+ # CodeSummary
2
+
3
+ [![npm version](https://badge.fury.io/js/codesummary.svg)](https://badge.fury.io/js/codesummary)
4
+ [![Node.js Version](https://img.shields.io/badge/node-%3E%3D18.0.0-brightgreen.svg)](https://nodejs.org/)
5
+ [![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)
6
+ [![Cross-Platform](https://img.shields.io/badge/platform-Windows%20%7C%20macOS%20%7C%20Linux-lightgrey)](#)
7
+
8
+ A **cross-platform CLI tool** that automatically scans project source code and generates **clean, professional PDF documentation** containing file structures and complete formatted code content. Perfect for code reviews, audits, project documentation, and archival snapshots.
9
+
10
+ ## 🚀 Key Features
11
+
12
+ - **🔍 Intelligent Scanning**: Recursively scans project directories with configurable file type filtering
13
+ - **📄 Clean PDF Output**: Generates well-structured A4 PDFs with optimized formatting and complete content flow
14
+ - **📝 Complete Content**: Includes ALL file content without truncation - no size limits
15
+ - **⚙️ Global Configuration**: One-time setup with persistent cross-platform user preferences
16
+ - **🎯 Interactive Selection**: Choose which file types to include via intuitive checkbox prompts
17
+ - **🛡️ Safe & Smart**: Whitelist-driven approach prevents binary files, with intelligent fallbacks
18
+ - **🌍 Cross-Platform**: Works identically on Windows, macOS, and Linux with terminal compatibility
19
+ - **📊 Smart Filtering**: Automatically excludes build directories, dependencies, and temporary files
20
+ - **⚡ Performance Optimized**: Efficient memory usage and streaming for large projects
21
+ - **🔄 File Conflict Handling**: Automatic timestamped filenames when original files are in use
22
+
23
+ ## 📦 Installation
24
+
25
+ ```bash
26
+ npm install -g codesummary
27
+ ```
28
+
29
+ **Requirements**: Node.js ≥ 18.0.0
30
+
31
+ ## 🎯 Quick Start
32
+
33
+ 1. **First-time setup** (interactive wizard):
34
+ ```bash
35
+ codesummary
36
+ ```
37
+
38
+ 2. **Generate PDF for current project**:
39
+ ```bash
40
+ cd /path/to/your/project
41
+ codesummary
42
+ ```
43
+
44
+ 3. **Override output location**:
45
+ ```bash
46
+ codesummary --output ./documentation
47
+ ```
48
+
49
+ ## 📖 Usage
50
+
51
+ ### Interactive Workflow
52
+
53
+ #### 1. First Run Setup
54
+
55
+ ```bash
56
+ $ codesummary
57
+ Welcome to CodeSummary!
58
+ No configuration found. Starting setup...
59
+
60
+ Where should the PDF be generated by default?
61
+ > [ ] Current working directory (relative mode)
62
+ > [x] Fixed folder (absolute mode)
63
+
64
+ Enter absolute path for fixed folder:
65
+ > ~/Desktop/CodeSummaries
66
+ ```
67
+
68
+ #### 2. Extension Selection
69
+
70
+ ```bash
71
+ Scanning directory: /path/to/project
72
+
73
+ Scan Summary:
74
+ Extensions found: .js, .ts, .md, .json
75
+ Total files: 127
76
+ Total size: 2.4 MB
77
+
78
+ Select file extensions to include:
79
+ [x] .js → JavaScript (42 files)
80
+ [x] .ts → TypeScript (28 files)
81
+ [x] .md → Markdown (5 files)
82
+ [ ] .json → JSON (52 files)
83
+ ```
84
+
85
+ #### 3. Generation Complete
86
+
87
+ ```bash
88
+ SUCCESS: PDF generation completed successfully!
89
+
90
+ Summary:
91
+ Output: ~/Desktop/CodeSummaries/MYPROJECT_code.pdf
92
+ Extensions: .js, .ts, .md
93
+ Total files: 75
94
+ PDF size: 2.3 MB
95
+ ```
96
+
97
+ ### Command Reference
98
+
99
+ | Command | Description |
100
+ | ---------------------------- | --------------------------------------- |
101
+ | `codesummary` | Scan current directory and generate PDF |
102
+ | `codesummary config` | Edit configuration settings |
103
+ | `codesummary --show-config` | Display current configuration |
104
+ | `codesummary --reset-config` | Reset configuration to defaults |
105
+ | `codesummary --help` | Show help information |
106
+
107
+ ### Command Line Options
108
+
109
+ | Option | Description |
110
+ | --------------------- | ---------------------------------------- |
111
+ | `-o, --output <path>` | Override output directory for this run |
112
+ | `--show-config` | Display current configuration |
113
+ | `--reset-config` | Reset configuration and run setup wizard |
114
+ | `-h, --help` | Show help message |
115
+
116
+ ### Examples
117
+
118
+ ```bash
119
+ # Generate PDF with default settings
120
+ codesummary
121
+
122
+ # Save PDF to specific directory
123
+ codesummary --output ~/Documents/CodeReviews
124
+
125
+ # Edit configuration
126
+ codesummary config
127
+
128
+ # View current settings
129
+ codesummary --show-config
130
+ ```
131
+
132
+ ## ⚙️ Configuration
133
+
134
+ CodeSummary stores global configuration in:
135
+
136
+ - **Linux/macOS**: `~/.codesummary/config.json`
137
+ - **Windows**: `%APPDATA%\\CodeSummary\\config.json`
138
+
139
+ ### Default Configuration
140
+
141
+ ```json
142
+ {
143
+ \"output\": {
144
+ \"mode\": \"fixed\",
145
+ \"fixedPath\": \"~/Desktop/CodeSummaries\"
146
+ },
147
+ \"allowedExtensions\": [
148
+ \".json\", \".ts\", \".js\", \".jsx\", \".tsx\", \".xml\", \".html\",
149
+ \".css\", \".scss\", \".md\", \".txt\", \".py\", \".java\", \".cs\",
150
+ \".cpp\", \".c\", \".h\", \".yaml\", \".yml\", \".sh\", \".bat\",
151
+ \".ps1\", \".php\", \".rb\", \".go\", \".rs\", \".swift\", \".kt\",
152
+ \".scala\", \".vue\", \".svelte\", \".dockerfile\", \".sql\", \".graphql\"
153
+ ],
154
+ \"excludeDirs\": [
155
+ \"node_modules\", \".git\", \".vscode\", \"dist\", \"build\",
156
+ \"coverage\", \"out\", \"__pycache__\", \".next\", \".nuxt\"
157
+ ],
158
+ \"styles\": {
159
+ \"colors\": {
160
+ \"title\": \"#333353\",
161
+ \"section\": \"#00FFB9\",
162
+ \"text\": \"#333333\",
163
+ \"error\": \"#FF4D4D\",
164
+ \"footer\": \"#666666\"
165
+ },
166
+ \"layout\": {
167
+ \"marginLeft\": 40,
168
+ \"marginTop\": 40,
169
+ \"marginRight\": 40,
170
+ \"footerHeight\": 20
171
+ }
172
+ },
173
+ \"settings\": {
174
+ \"documentTitle\": \"Project Code Summary\",
175
+ \"maxFilesBeforePrompt\": 500
176
+ }
177
+ }
178
+ ```
179
+
180
+ ## 📋 PDF Structure
181
+
182
+ Generated PDFs use **A4 format** with optimized margins and contain three main sections:
183
+
184
+ ### 1. Project Overview
185
+ - Document title and project name
186
+ - Generation timestamp
187
+ - List of included file types with descriptions
188
+
189
+ ### 2. File Structure
190
+ - Complete hierarchical listing of all included files
191
+ - Organized by relative paths from project root
192
+ - Sorted alphabetically for easy navigation
193
+
194
+ ### 3. File Content
195
+ - **Complete source code** for each file (no truncation)
196
+ - Proper formatting with monospace fonts for code
197
+ - Intelligent text wrapping without overlap
198
+ - Natural page breaks when needed
199
+ - Error handling for unreadable files
200
+
201
+ ## 🔧 Advanced Features
202
+
203
+ ### Smart File Conflict Handling
204
+
205
+ When the target PDF file is in use (e.g., open in a PDF viewer), CodeSummary automatically creates a timestamped version:
206
+
207
+ ```bash
208
+ # Original filename
209
+ MYPROJECT_code.pdf
210
+
211
+ # If file is in use, creates:
212
+ MYPROJECT_code_20250729_141602.pdf
213
+ ```
214
+
215
+ ### Large File Processing
216
+
217
+ - **No file size limits**: Processes files of any size completely
218
+ - **Progress indicators**: Shows processing status for large files
219
+ - **Memory efficient**: Uses streaming for optimal performance
220
+ - **Smart warnings**: Informs about large files being processed
221
+
222
+ ### Terminal Compatibility
223
+
224
+ - **Universal compatibility**: Works with all terminal types and operating systems
225
+ - **No special characters**: Uses standard ASCII text for maximum compatibility
226
+ - **Clear output**: Color-coded messages with fallback text indicators
227
+
228
+ ## 🎨 Supported File Types
229
+
230
+ CodeSummary supports an extensive range of text-based file formats:
231
+
232
+ | Extension | Language/Type | Extension | Language/Type |
233
+ | --------- | -------------- | ------------ | ----------------- |
234
+ | `.js` | JavaScript | `.py` | Python |
235
+ | `.ts` | TypeScript | `.java` | Java |
236
+ | `.jsx` | React JSX | `.cs` | C# |
237
+ | `.tsx` | TypeScript JSX | `.cpp` | C++ |
238
+ | `.json` | JSON | `.c` | C |
239
+ | `.xml` | XML | `.h` | Header |
240
+ | `.html` | HTML | `.yaml/.yml` | YAML |
241
+ | `.css` | CSS | `.sh` | Shell Script |
242
+ | `.scss` | SCSS | `.bat` | Batch File |
243
+ | `.md` | Markdown | `.ps1` | PowerShell |
244
+ | `.txt` | Plain Text | `.php` | PHP |
245
+ | `.go` | Go | `.rb` | Ruby |
246
+ | `.rs` | Rust | `.swift` | Swift |
247
+ | `.kt` | Kotlin | `.scala` | Scala |
248
+ | `.vue` | Vue.js | `.svelte` | Svelte |
249
+ | `.sql` | SQL | `.graphql` | GraphQL |
250
+
251
+ ## 🛠️ Development
252
+
253
+ ### Project Structure
254
+
255
+ ```
256
+ codesummary/
257
+ ├── bin/
258
+ │ └── codesummary.js # Global executable entry point
259
+ ├── src/
260
+ │ ├── cli.js # Command line interface
261
+ │ ├── configManager.js # Global configuration management
262
+ │ ├── scanner.js # File system scanning and filtering
263
+ │ ├── pdfGenerator.js # PDF creation and formatting
264
+ │ └── errorHandler.js # Comprehensive error handling
265
+ ├── package.json
266
+ ├── README.md
267
+ └── features.md
268
+ ```
269
+
270
+ ### Building from Source
271
+
272
+ ```bash
273
+ # Clone repository
274
+ git clone https://github.com/skamoll/CodeSummary.git
275
+ cd CodeSummary
276
+
277
+ # Install dependencies
278
+ npm install
279
+
280
+ # Test the CLI
281
+ node bin/codesummary.js --help
282
+
283
+ # Run locally without global install
284
+ node bin/codesummary.js
285
+ ```
286
+
287
+ ## 🔍 Troubleshooting
288
+
289
+ ### Common Issues
290
+
291
+ **Configuration not found**
292
+ - Run `codesummary` to trigger first-time setup
293
+ - Check file permissions in config directory
294
+
295
+ **PDF generation fails**
296
+ - Verify output directory permissions
297
+ - Ensure Node.js version ≥18.0.0
298
+ - Close any open PDF viewers on the target file
299
+
300
+ **Files not showing up**
301
+ - Check that file extensions are in `allowedExtensions`
302
+ - Verify directories aren't in `excludeDirs` list
303
+ - Ensure files are text-based (not binary)
304
+
305
+ **Large project performance**
306
+ - Adjust `maxFilesBeforePrompt` in configuration
307
+ - Use extension filtering to reduce file count
308
+ - CodeSummary handles large files efficiently with streaming
309
+
310
+ ### Getting Help
311
+
312
+ 1. Run `codesummary --help` for usage information
313
+ 2. Check configuration with `codesummary --show-config`
314
+ 3. Reset configuration with `codesummary --reset-config`
315
+ 4. Open an issue on [GitHub](https://github.com/skamoll/CodeSummary/issues)
316
+
317
+ ## 🤝 Contributing
318
+
319
+ We welcome contributions! Please see our [Contributing Guidelines](CONTRIBUTING.md) for details.
320
+
321
+ ### Development Setup
322
+
323
+ 1. Fork the repository
324
+ 2. Clone your fork: `git clone https://github.com/yourusername/CodeSummary.git`
325
+ 3. Install dependencies: `npm install`
326
+ 4. Create a feature branch: `git checkout -b feature-name`
327
+ 5. Make your changes and test thoroughly
328
+ 6. Submit a pull request
329
+
330
+ ## 📄 License
331
+
332
+ This project is licensed under the GNU General Public License v3.0 - see the [LICENSE](LICENSE) file for details.
333
+
334
+ ### License Summary
335
+
336
+ - ✅ Commercial use permitted
337
+ - ✅ Modification allowed
338
+ - ✅ Distribution allowed
339
+ - ✅ Private use allowed
340
+ - ❗ Copyleft: derivative works must use GPL-3.0
341
+ - ❗ Must include license and copyright notice
342
+
343
+ ## 🙏 Acknowledgments
344
+
345
+ - Built with [PDFKit](https://pdfkit.org/) for PDF generation
346
+ - Uses [Inquirer.js](https://github.com/SBoudrias/Inquirer.js) for interactive prompts
347
+ - Styled with [Chalk](https://github.com/chalk/chalk) for colorful console output
348
+ - Uses [Ora](https://github.com/sindresorhus/ora) for progress indicators
349
+
350
+ ## 📊 Roadmap
351
+
352
+ ### Future Enhancements
353
+
354
+ - [ ] Syntax highlighting in PDF output
355
+ - [ ] Clickable table of contents with bookmarks
356
+ - [ ] Multiple output formats (HTML, JSON, Markdown)
357
+ - [ ] Project metrics and code statistics
358
+ - [ ] CI/CD integration mode for automated documentation
359
+ - [ ] Custom PDF themes and styling options
360
+ - [ ] Plugin system for custom processors
361
+
362
+ ## 📞 Support
363
+
364
+ - 📧 Report bugs: [GitHub Issues](https://github.com/skamoll/CodeSummary/issues)
365
+ - 💬 Ask questions: [GitHub Discussions](https://github.com/skamoll/CodeSummary/discussions)
366
+ - 📖 Documentation: [Wiki](https://github.com/skamoll/CodeSummary/wiki)
367
+
368
+ ---
369
+
370
+ **Made with ❤️ for developers worldwide**