aidx 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.
Files changed (2) hide show
  1. package/dist/index.js +19 -11
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -10,14 +10,14 @@ const METADATA = {
10
10
  name: "aidx",
11
11
  description: "A CLI bridge between local code and LLMs.",
12
12
  author: "rx76d",
13
- version: "1.0.5",
13
+ version: "1.0.6",
14
14
  license: "MIT",
15
15
  github: "https://github.com/rx76d/aidx"
16
16
  };
17
17
  const CONFIG_FILE = '.aidxrc.json';
18
18
  const MAX_FILE_SIZE = 1.5 * 1024 * 1024; // 1.5MB Limit
19
19
  const SECRET_REGEX = /(?:sk-[a-zA-Z0-9]{32,})|(?:AKIA[0-9A-Z]{16})|(?:[a-zA-Z0-9+/]{40,}=)/;
20
- // --- UTILS: NATIVE COLORS ---
20
+ // --- UTILS: NATIVE COLORS (Replaces Chalk) ---
21
21
  const colors = {
22
22
  reset: "\x1b[0m",
23
23
  red: (t) => `\x1b[31m${t}\x1b[0m`,
@@ -31,11 +31,12 @@ const colors = {
31
31
  bgRed: (t) => `\x1b[41m${t}\x1b[0m`,
32
32
  bgGreen: (t) => `\x1b[42m\x1b[30m${t}\x1b[0m`
33
33
  };
34
- // --- UTILS: NATIVE FILE SCANNER ---
34
+ // --- UTILS: NATIVE FILE SCANNER (Replaces fast-glob) ---
35
+ // This recursively walks directories but explicitly skips ignored folders for speed.
35
36
  async function scanFiles(startDir) {
36
37
  const ignoredFolders = new Set([
37
38
  'node_modules', '.git', '.vscode', '.idea', 'dist', 'build', '.next',
38
- '__pycache__', 'venv', 'env', 'target', 'bin', 'obj', 'vendor',
39
+ '__pycache__', 'venv', 'env', '.venv', 'target', 'bin', 'obj', 'vendor',
39
40
  'Application Data', 'Cookies', 'Local Settings', 'Recent', 'Start Menu'
40
41
  ]);
41
42
  const ignoredExts = new Set([
@@ -49,18 +50,23 @@ async function scanFiles(startDir) {
49
50
  for (const entry of entries) {
50
51
  const fullPath = path.join(dir, entry.name);
51
52
  if (entry.isDirectory()) {
52
- if (!ignoredFolders.has(entry.name))
53
+ // Optimization: Don't enter ignored folders
54
+ if (!ignoredFolders.has(entry.name)) {
53
55
  await walk(fullPath);
56
+ }
54
57
  }
55
58
  else {
56
59
  const ext = path.extname(entry.name).toLowerCase();
57
60
  if (!ignoredExts.has(ext)) {
61
+ // Store relative path
58
62
  results.push(path.relative(startDir, fullPath));
59
63
  }
60
64
  }
61
65
  }
62
66
  }
63
- catch (e) { /* Suppress EPERM */ }
67
+ catch (e) {
68
+ // Suppress permission errors (EPERM) just like suppressErrors: true
69
+ }
64
70
  }
65
71
  await walk(startDir);
66
72
  return results;
@@ -89,7 +95,8 @@ async function getBackupStatus() {
89
95
  }
90
96
  }
91
97
  async function setBackupStatus(enabled) {
92
- await fsPromises.writeFile(path.resolve(process.cwd(), CONFIG_FILE), JSON.stringify({ backup: enabled }, null, 2));
98
+ const configPath = path.resolve(process.cwd(), CONFIG_FILE);
99
+ await fsPromises.writeFile(configPath, JSON.stringify({ backup: enabled }, null, 2));
93
100
  }
94
101
  // --- PROTOCOLS ---
95
102
  const SYSTEM_HEADER = `
@@ -116,10 +123,11 @@ console.log("Full code here...");
116
123
  </file>
117
124
  ================================================================
118
125
  `;
119
- // --- MAIN CLI LOGIC ---
126
+ // --- MAIN CLI LOGIC (Replaces Commander) ---
120
127
  async function main() {
121
128
  const args = process.argv.slice(2);
122
129
  const command = args[0] || 'menu';
130
+ // Router
123
131
  switch (command) {
124
132
  case 'copy':
125
133
  await runCopy();
@@ -166,7 +174,7 @@ async function showMenu() {
166
174
  console.log(`\nRun ${colors.dim('npx aidx copy')} to start.\n`);
167
175
  }
168
176
  function runSTL() {
169
- console.log('\n' + colors.bold('AI Model Context Limits (2025 Reference)'));
177
+ console.log('\n' + colors.bold('AI Model Context Limits (2026 Reference)'));
170
178
  console.log(colors.dim('--------------------------------------------------'));
171
179
  const models = [
172
180
  { name: "Gemini 3 Pro", limit: "2,000,000+", type: "Huge" },
@@ -261,7 +269,7 @@ async function runCopy() {
261
269
  }
262
270
  output += XML_SCHEMA_INSTRUCTION;
263
271
  try {
264
- await clipboardy.write(output); // Uses robust library
272
+ await clipboardy.write(output);
265
273
  const tokens = estimateTokens(output);
266
274
  const finalCount = selectedFiles.length - skippedCount;
267
275
  const tokenColor = tokens > 100000 ? colors.red : tokens > 30000 ? colors.yellow : colors.green;
@@ -279,7 +287,7 @@ async function runApply() {
279
287
  try {
280
288
  content = await clipboardy.read();
281
289
  }
282
- catch (e) { // Uses robust library
290
+ catch (e) {
283
291
  console.log(colors.red(`Error: Could not read clipboard.`));
284
292
  return;
285
293
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aidx",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
4
  "description": "A CLI bridge between local code and LLMs. Copy context to clipboard and apply AI changes safely with diffs.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",