cli-atom 0.2.3 → 0.2.5
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/atom.js +17 -5
- package/package.json +2 -2
package/atom.js
CHANGED
|
@@ -39,7 +39,7 @@ const IGNORE_EXTS = [".png", ".jpg", ".jpeg", ".gif", ".ico", ".svg", ".woff", "
|
|
|
39
39
|
const MAX_FILE_SIZE = 15_000;
|
|
40
40
|
let MODEL = "z-ai/glm-5-turbo";
|
|
41
41
|
let MODEL_LABEL = "glm-5-turbo";
|
|
42
|
-
const VERSION = "0.2.
|
|
42
|
+
const VERSION = "0.2.5";
|
|
43
43
|
|
|
44
44
|
const MODELS = [
|
|
45
45
|
{ id: "z-ai/glm-5-turbo", label: "glm-5-turbo" },
|
|
@@ -178,17 +178,21 @@ function elapsed() {
|
|
|
178
178
|
return s < 60 ? `${s}s` : `${Math.floor(s / 60)}m ${s % 60}s`;
|
|
179
179
|
}
|
|
180
180
|
|
|
181
|
-
|
|
181
|
+
const MAX_FILES = 50;
|
|
182
|
+
const MAX_CONTEXT_CHARS = 60_000;
|
|
183
|
+
|
|
184
|
+
function scanDir(dirPath, prefix = "", _count = { n: 0 }) {
|
|
182
185
|
let tree = "";
|
|
183
186
|
let files = [];
|
|
184
187
|
try {
|
|
185
188
|
const entries = fs.readdirSync(dirPath, { withFileTypes: true });
|
|
186
189
|
for (const entry of entries) {
|
|
190
|
+
if (_count.n >= MAX_FILES) break;
|
|
187
191
|
if (IGNORE_DIRS.includes(entry.name)) continue;
|
|
188
192
|
const fullPath = path.join(dirPath, entry.name);
|
|
189
193
|
if (entry.isDirectory()) {
|
|
190
194
|
tree += `${prefix}${entry.name}/\n`;
|
|
191
|
-
const sub = scanDir(fullPath, prefix + " ");
|
|
195
|
+
const sub = scanDir(fullPath, prefix + " ", _count);
|
|
192
196
|
tree += sub.tree;
|
|
193
197
|
files.push(...sub.files);
|
|
194
198
|
} else {
|
|
@@ -201,6 +205,7 @@ function scanDir(dirPath, prefix = "") {
|
|
|
201
205
|
? fs.readFileSync(fullPath, "utf-8")
|
|
202
206
|
: "[file too large — truncated]";
|
|
203
207
|
files.push({ path: fullPath.replace(/\\/g, "/"), content });
|
|
208
|
+
_count.n++;
|
|
204
209
|
} catch { /* skip unreadable files */ }
|
|
205
210
|
}
|
|
206
211
|
}
|
|
@@ -240,9 +245,16 @@ function buildContext() {
|
|
|
240
245
|
|
|
241
246
|
let ctx = `\n--- PROJECT CONTEXT (${cwd}) ---\n`;
|
|
242
247
|
ctx += `File tree:\n${tree}\n`;
|
|
248
|
+
let totalChars = ctx.length;
|
|
243
249
|
for (const f of files) {
|
|
244
250
|
const rel = path.relative(cwd, f.path).replace(/\\/g, "/");
|
|
245
|
-
|
|
251
|
+
const block = `--- ${rel} ---\n${f.content}\n--- end ${rel} ---\n\n`;
|
|
252
|
+
if (totalChars + block.length > MAX_CONTEXT_CHARS) {
|
|
253
|
+
ctx += `[context limit reached — ${files.length} files total, showing partial]\n`;
|
|
254
|
+
break;
|
|
255
|
+
}
|
|
256
|
+
ctx += block;
|
|
257
|
+
totalChars += block.length;
|
|
246
258
|
}
|
|
247
259
|
ctx += `--- END PROJECT CONTEXT ---\n`;
|
|
248
260
|
|
|
@@ -642,7 +654,7 @@ async function handleInput(raw) {
|
|
|
642
654
|
const masked = config.apiKey ? config.apiKey.slice(0, 10) + "..." + config.apiKey.slice(-6) : "none";
|
|
643
655
|
console.log(`\n ${t.violet}API Key${t.reset}`);
|
|
644
656
|
console.log(` ${t.muted}current: ${masked}${t.reset}`);
|
|
645
|
-
console.log(` ${t.dim}To change your key, type ${t.accent}/login${t.dim}
|
|
657
|
+
console.log(` ${t.dim}To change your key, type ${t.accent}/login${t.dim}.${t.reset}\n`);
|
|
646
658
|
askPrompt();
|
|
647
659
|
return;
|
|
648
660
|
}
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cli-atom",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.5",
|
|
4
4
|
"description": "ATOM - Coding Agent",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"author": "Redwxll",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"main": "atom.js",
|
|
9
9
|
"bin": {
|
|
10
|
-
"atom": "
|
|
10
|
+
"atom": "atom.js"
|
|
11
11
|
},
|
|
12
12
|
"scripts": {
|
|
13
13
|
"test": "mocha test/**/*.js"
|