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 +2 -0
- package/package.json +1 -1
- package/src/index.js +50 -5
- package/test-large/package.json +1 -0
- package/test-large/src/components/Button.tsx +1 -0
- package/test-large/src/index.ts +1 -0
- package/test-small/package.json +1 -0
- package/test-small/src/index.js +1 -0
- package/vg-coder-cli-1.0.8.tgz +0 -0
- package/vg-coder-cli-1.0.9.tgz +0 -0
- package/vg-projects.txt +5 -0
package/.vgignore
CHANGED
package/package.json
CHANGED
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
|
|
72
|
+
// Check special modes
|
|
72
73
|
const clipboardMode = options.clipboardOnly || options.clipboard;
|
|
73
|
-
const
|
|
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
|
|
81
|
-
if (!
|
|
82
|
-
throw new Error('Output path is required for
|
|
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");
|
package/vg-coder-cli-1.0.8.tgz
CHANGED
|
Binary file
|
|
Binary file
|