@krishivpb60/aether-ai-cli 1.1.5 → 1.1.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/package.json +1 -1
- package/src/chat.js +2 -1
- package/src/cli.js +2 -1
- package/src/ui/theme.js +21 -0
- package/test/ux.test.js +12 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@krishivpb60/aether-ai-cli",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.6",
|
|
4
4
|
"description": "Aether Core AI — A cyberpunk command-line AI assistant with multi-mode reasoning, 12-node failover mesh, file context injection, and offline fallbacks.",
|
|
5
5
|
"main": "src/cli.js",
|
|
6
6
|
"bin": {
|
package/src/chat.js
CHANGED
|
@@ -21,6 +21,7 @@ import {
|
|
|
21
21
|
modeBadge,
|
|
22
22
|
clearStreamedText,
|
|
23
23
|
StreamFilter,
|
|
24
|
+
stripCodeFences,
|
|
24
25
|
getActiveTheme,
|
|
25
26
|
setTheme,
|
|
26
27
|
getThemesList
|
|
@@ -305,7 +306,7 @@ export async function startChat(options = {}) {
|
|
|
305
306
|
let match;
|
|
306
307
|
const fileWrites = [];
|
|
307
308
|
while ((match = writeRegex.exec(result.text)) !== null) {
|
|
308
|
-
fileWrites.push({ path: match[1].trim(), content: match[2] });
|
|
309
|
+
fileWrites.push({ path: match[1].trim(), content: stripCodeFences(match[2]) });
|
|
309
310
|
}
|
|
310
311
|
|
|
311
312
|
if (fileWrites.length > 0) {
|
package/src/cli.js
CHANGED
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
bullet,
|
|
20
20
|
clearStreamedText,
|
|
21
21
|
StreamFilter,
|
|
22
|
+
stripCodeFences,
|
|
22
23
|
getActiveTheme,
|
|
23
24
|
setTheme,
|
|
24
25
|
getThemesList,
|
|
@@ -328,7 +329,7 @@ async function handleAsk(prompt, opts) {
|
|
|
328
329
|
let match;
|
|
329
330
|
const fileWrites = [];
|
|
330
331
|
while ((match = writeRegex.exec(result.text)) !== null) {
|
|
331
|
-
fileWrites.push({ path: match[1].trim(), content: match[2] });
|
|
332
|
+
fileWrites.push({ path: match[1].trim(), content: stripCodeFences(match[2]) });
|
|
332
333
|
}
|
|
333
334
|
|
|
334
335
|
if (fileWrites.length > 0) {
|
package/src/ui/theme.js
CHANGED
|
@@ -268,3 +268,24 @@ export function setTheme(themeName) {
|
|
|
268
268
|
export function getThemesList() {
|
|
269
269
|
return Object.keys(THEMES);
|
|
270
270
|
}
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* Strips markdown code block fences (```lang ... ```) from a string if present.
|
|
274
|
+
* @param {string} content - Raw content extracted from file write blocks
|
|
275
|
+
* @returns {string} Cleaned content
|
|
276
|
+
*/
|
|
277
|
+
export function stripCodeFences(content) {
|
|
278
|
+
let cleaned = content.trim();
|
|
279
|
+
if (cleaned.startsWith("```")) {
|
|
280
|
+
const firstNewline = cleaned.indexOf("\n");
|
|
281
|
+
if (firstNewline !== -1) {
|
|
282
|
+
cleaned = cleaned.slice(firstNewline + 1);
|
|
283
|
+
} else {
|
|
284
|
+
cleaned = cleaned.slice(3);
|
|
285
|
+
}
|
|
286
|
+
if (cleaned.endsWith("```")) {
|
|
287
|
+
cleaned = cleaned.slice(0, -3);
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
return cleaned.trim();
|
|
291
|
+
}
|
package/test/ux.test.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { test, beforeEach, afterEach } from "node:test";
|
|
2
2
|
import assert from "node:assert";
|
|
3
|
-
import { separator, clearStreamedText, StreamFilter, getActiveTheme, setTheme, getThemesList } from "../src/ui/theme.js";
|
|
3
|
+
import { separator, clearStreamedText, StreamFilter, stripCodeFences, getActiveTheme, setTheme, getThemesList } from "../src/ui/theme.js";
|
|
4
4
|
import { createSpinner } from "../src/ui/spinner.js";
|
|
5
5
|
import { routePrompt } from "../src/ai/router.js";
|
|
6
6
|
import { getModeByName, MODES } from "../src/modes.js";
|
|
@@ -167,4 +167,15 @@ test("Cyberpunk UX and Streaming Suite", async (t) => {
|
|
|
167
167
|
assert.ok(output.includes("File creation request: test.txt"));
|
|
168
168
|
assert.ok(!output.includes("This content is hidden"));
|
|
169
169
|
});
|
|
170
|
+
|
|
171
|
+
await t.test("stripCodeFences should clean code blocks with backticks", () => {
|
|
172
|
+
const jsBlock = "```javascript\nconsole.log('hi');\n```";
|
|
173
|
+
assert.strictEqual(stripCodeFences(jsBlock), "console.log('hi');");
|
|
174
|
+
|
|
175
|
+
const htmlBlock = "```html\n<div>hello</div>\n```";
|
|
176
|
+
assert.strictEqual(stripCodeFences(htmlBlock), "<div>hello</div>");
|
|
177
|
+
|
|
178
|
+
const noFenceBlock = "console.log('hi');";
|
|
179
|
+
assert.strictEqual(stripCodeFences(noFenceBlock), "console.log('hi');");
|
|
180
|
+
});
|
|
170
181
|
});
|