vg-coder-cli 1.0.5 → 1.0.6

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 ADDED
@@ -0,0 +1,10 @@
1
+ # VG Coder specific ignores
2
+ *.tgz
3
+ coverage/
4
+ vg-output/
5
+ test-small/
6
+
7
+ # Additional ignores for VG Coder
8
+ *.map
9
+ *.min.js
10
+ *.min.css
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vg-coder-cli",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
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": {
@@ -19,6 +19,8 @@ class IgnoreManager {
19
19
  return [
20
20
  // Node.js
21
21
  'node_modules/',
22
+ 'package-lock.json',
23
+ 'yarn.lock',
22
24
  'npm-debug.log*',
23
25
  'yarn-debug.log*',
24
26
  'yarn-error.log*',
@@ -126,17 +128,17 @@ class IgnoreManager {
126
128
  // Thêm default ignores
127
129
  ig.add(this.defaultIgnores);
128
130
 
129
- // Đọc .gitignore từ root đến thư mục hiện tại
131
+ // Đọc .gitignore và .vgignore từ root đến thư mục hiện tại
130
132
  const pathParts = relativePath ? relativePath.split(path.sep) : [];
131
133
  let currentPath = this.projectPath;
132
-
133
- // Đọc .gitignore từ root
134
- await this.addGitignoreFromPath(ig, currentPath);
135
-
136
- // Đọc .gitignore từ các thư mục con theo thứ tự
134
+
135
+ // Đọc .gitignore và .vgignore từ root
136
+ await this.addIgnoreFromPath(ig, currentPath);
137
+
138
+ // Đọc .gitignore và .vgignore từ các thư mục con theo thứ tự
137
139
  for (const part of pathParts) {
138
140
  currentPath = path.join(currentPath, part);
139
- await this.addGitignoreFromPath(ig, currentPath);
141
+ await this.addIgnoreFromPath(ig, currentPath);
140
142
  }
141
143
 
142
144
  this.ignoreInstances.set(cacheKey, ig);
@@ -144,26 +146,38 @@ class IgnoreManager {
144
146
  }
145
147
 
146
148
  /**
147
- * Thêm patterns từ .gitignore file
149
+ * Thêm patterns từ .gitignore và .vgignore files
148
150
  */
149
- async addGitignoreFromPath(ig, dirPath) {
151
+ async addIgnoreFromPath(ig, dirPath) {
152
+ // Đọc .gitignore
150
153
  const gitignorePath = path.join(dirPath, '.gitignore');
151
-
152
154
  try {
153
155
  if (await fs.pathExists(gitignorePath)) {
154
156
  const content = await fs.readFile(gitignorePath, 'utf8');
155
- const patterns = this.parseGitignoreContent(content, dirPath);
157
+ const patterns = this.parseIgnoreContent(content, dirPath);
156
158
  ig.add(patterns);
157
159
  }
158
160
  } catch (error) {
159
161
  // Ignore errors reading .gitignore files
160
162
  }
163
+
164
+ // Đọc .vgignore (có priority cao hơn .gitignore)
165
+ const vgignorePath = path.join(dirPath, '.vgignore');
166
+ try {
167
+ if (await fs.pathExists(vgignorePath)) {
168
+ const content = await fs.readFile(vgignorePath, 'utf8');
169
+ const patterns = this.parseIgnoreContent(content, dirPath);
170
+ ig.add(patterns);
171
+ }
172
+ } catch (error) {
173
+ // Ignore errors reading .vgignore files
174
+ }
161
175
  }
162
176
 
163
177
  /**
164
- * Parse nội dung .gitignore
178
+ * Parse nội dung .gitignore và .vgignore
165
179
  */
166
- parseGitignoreContent(content, basePath) {
180
+ parseIgnoreContent(content, basePath) {
167
181
  const lines = content.split('\n');
168
182
  const patterns = [];
169
183
 
@@ -247,17 +247,15 @@ class TokenManager {
247
247
  let currentTokens = 0;
248
248
  let chunkIndex = 0;
249
249
 
250
- // Thêm header cho file
251
- const header = `\n=== Large File: ${filePath} (Part {part}) ===\n`;
252
-
250
+ // Không thêm header "Large File" nữa để UI sạch hơn
251
+
253
252
  for (const line of lines) {
254
253
  const lineTokens = this.countTokens(line + '\n');
255
-
256
- if (currentTokens + lineTokens > this.options.maxTokens - 100 && currentChunk) { // Reserve 100 tokens for header
257
- const partHeader = header.replace('{part}', (chunkIndex + 1).toString());
254
+
255
+ if (currentTokens + lineTokens > this.options.maxTokens && currentChunk) {
258
256
  chunks.push({
259
- content: partHeader + currentChunk.trim(),
260
- tokens: this.countTokens(partHeader + currentChunk.trim()),
257
+ content: currentChunk.trim(),
258
+ tokens: this.countTokens(currentChunk.trim()),
261
259
  chunkIndex: chunkIndex++,
262
260
  totalChunks: 0,
263
261
  metadata: {
@@ -277,10 +275,9 @@ class TokenManager {
277
275
 
278
276
  // Thêm chunk cuối cùng
279
277
  if (currentChunk.trim()) {
280
- const partHeader = header.replace('{part}', (chunkIndex + 1).toString());
281
278
  chunks.push({
282
- content: partHeader + currentChunk.trim(),
283
- tokens: this.countTokens(partHeader + currentChunk.trim()),
279
+ content: currentChunk.trim(),
280
+ tokens: this.countTokens(currentChunk.trim()),
284
281
  chunkIndex: chunkIndex++,
285
282
  totalChunks: 0,
286
283
  metadata: {
@@ -0,0 +1 @@
1
+ {"name": "test-large", "version": "1.0.0"}
Binary file