vg-coder-cli 1.0.8 → 1.0.9

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/.vgignore CHANGED
@@ -3,6 +3,8 @@
3
3
  coverage/
4
4
  vg-output/
5
5
  test-small/
6
+ test-large/
7
+ vg-projects.txt
6
8
 
7
9
  # Additional ignores for VG Coder
8
10
  *.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vg-coder-cli",
3
- "version": "1.0.8",
3
+ "version": "1.0.9",
4
4
  "description": "šŸš€ CLI tool to analyze projects, concatenate source files, count tokens, and export HTML with syntax highlighting and copy functionality",
5
5
  "main": "src/index.js",
6
6
  "bin": {
package/src/index.js CHANGED
@@ -42,6 +42,7 @@ class VGCoderCLI {
42
42
  .option('--theme <theme>', 'Theme cho syntax highlighting', 'github')
43
43
  .option('--clipboard-only', 'Copy content to clipboard without creating files')
44
44
  .option('--clipboard', 'Alias for --clipboard-only')
45
+ .option('--save-txt', 'Save AI-friendly content to vg-projects.txt file')
45
46
  .action(this.handleAnalyze.bind(this));
46
47
 
47
48
  // Info command
@@ -68,18 +69,20 @@ class VGCoderCLI {
68
69
  // Resolve project path
69
70
  projectPath = path.resolve(projectPath || process.cwd());
70
71
 
71
- // Check if clipboard-only mode
72
+ // Check special modes
72
73
  const clipboardMode = options.clipboardOnly || options.clipboard;
73
- const outputPath = clipboardMode ? null : path.resolve(options.output || './vg-output');
74
+ const saveTxtMode = options.saveTxt;
75
+ const specialMode = clipboardMode || saveTxtMode;
76
+ const outputPath = specialMode ? null : path.resolve(options.output || './vg-output');
74
77
 
75
78
  // Validate project path
76
79
  if (!await fs.pathExists(projectPath)) {
77
80
  throw new Error(`Project path does not exist: ${projectPath}`);
78
81
  }
79
82
 
80
- // Validate output path for non-clipboard mode
81
- if (!clipboardMode && !outputPath) {
82
- throw new Error('Output path is required for non-clipboard mode');
83
+ // Validate output path for normal mode
84
+ if (!specialMode && !outputPath) {
85
+ throw new Error('Output path is required for normal mode');
83
86
  }
84
87
 
85
88
  spinner.text = 'Detecting project type...';
@@ -167,6 +170,48 @@ class VGCoderCLI {
167
170
  return; // Exit early for clipboard mode
168
171
  }
169
172
 
173
+ if (saveTxtMode) {
174
+ // Save-txt mode: create AI-friendly content and save to vg-projects.txt
175
+ spinner.text = 'Creating AI-friendly content...';
176
+
177
+ const aiContent = await scanner.createCombinedContentForAI(scanResult.files, {
178
+ includeStats: false,
179
+ includeTree: false,
180
+ preserveLineNumbers: true
181
+ });
182
+
183
+ spinner.text = 'Saving to vg-projects.txt...';
184
+
185
+ const outputFilePath = path.resolve('vg-projects.txt');
186
+
187
+ // Ensure file is deleted first
188
+ try {
189
+ await fs.unlink(outputFilePath);
190
+ } catch (error) {
191
+ // File doesn't exist, that's fine
192
+ }
193
+
194
+ await fs.writeFile(outputFilePath, aiContent, 'utf8');
195
+ const contentInfo = ClipboardManager.getContentInfo(aiContent);
196
+
197
+ // Cleanup
198
+ tokenManager.cleanup();
199
+
200
+ spinner.succeed('Content saved to vg-projects.txt successfully!');
201
+
202
+ console.log(chalk.green('\nšŸ“„ File Content:'));
203
+ console.log(`Output: ${chalk.cyan(outputFilePath)}`);
204
+ console.log(`Files: ${chalk.cyan(scanResult.files.length)}`);
205
+ console.log(`Lines: ${chalk.cyan(contentInfo.lines.toLocaleString())}`);
206
+ console.log(`Characters: ${chalk.cyan(contentInfo.characters.toLocaleString())}`);
207
+ console.log(`Size: ${chalk.cyan(contentInfo.size)}`);
208
+
209
+ console.log(chalk.blue('\nšŸ’” Ready for AI analysis!'));
210
+ console.log('Content is now saved in vg-projects.txt and ready for AI tools.');
211
+
212
+ return; // Exit early for save-txt mode
213
+ }
214
+
170
215
  // Normal mode: create HTML output
171
216
  const combinedContent = await scanner.createCombinedContent(scanResult.files);
172
217
 
@@ -0,0 +1 @@
1
+ {"name": "test-large", "version": "1.0.0", "dependencies": {"react": "^18.0.0"}}
@@ -0,0 +1 @@
1
+ export const Button = () => <button>Click me</button>;
@@ -0,0 +1 @@
1
+ import { Button } from "./components/Button"; export default Button;
@@ -0,0 +1 @@
1
+ {"name": "test-small", "version": "1.0.0"}
@@ -0,0 +1 @@
1
+ console.log("Hello World");
Binary file
Binary file
@@ -0,0 +1,5 @@
1
+ // ===== FILE: package.json =====
2
+ {"name": "test-small", "version": "1.0.0"}
3
+
4
+ // ===== FILE: src/index.js =====
5
+ console.log("Hello World");