nexrall-code 0.5.36 → 0.5.38
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/dist/index.js +89 -25
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -62067,8 +62067,6 @@ var use_app_default = useApp;
|
|
|
62067
62067
|
|
|
62068
62068
|
// ../../node_modules/.pnpm/ink@7.1.1_@types+react@19.2.18_react@19.2.8/node_modules/ink/build/hooks/use-stdout.js
|
|
62069
62069
|
var import_react25 = __toESM(require_react(), 1);
|
|
62070
|
-
var useStdout = () => (0, import_react25.useContext)(StdoutContext_default);
|
|
62071
|
-
var use_stdout_default = useStdout;
|
|
62072
62070
|
|
|
62073
62071
|
// ../../node_modules/.pnpm/ink@7.1.1_@types+react@19.2.18_react@19.2.8/node_modules/ink/build/hooks/use-stderr.js
|
|
62074
62072
|
var import_react26 = __toESM(require_react(), 1);
|
|
@@ -62094,6 +62092,69 @@ var import_react32 = __toESM(require_react(), 1);
|
|
|
62094
62092
|
// ../../node_modules/.pnpm/ink@7.1.1_@types+react@19.2.18_react@19.2.8/node_modules/ink/build/hooks/use-box-metrics.js
|
|
62095
62093
|
var import_react33 = __toESM(require_react(), 1);
|
|
62096
62094
|
|
|
62095
|
+
// src/ui/imeBuffer.ts
|
|
62096
|
+
function isImeLikeInput(input) {
|
|
62097
|
+
if (!input)
|
|
62098
|
+
return false;
|
|
62099
|
+
if (input.length === 1 && input.charCodeAt(0) < 128)
|
|
62100
|
+
return false;
|
|
62101
|
+
if (Buffer.byteLength(input, "utf8") > input.length)
|
|
62102
|
+
return true;
|
|
62103
|
+
if (/[\u0300-\u036F]/.test(input))
|
|
62104
|
+
return true;
|
|
62105
|
+
return false;
|
|
62106
|
+
}
|
|
62107
|
+
var ImeCompositionBuffer = class {
|
|
62108
|
+
buf = "";
|
|
62109
|
+
timer = null;
|
|
62110
|
+
timeoutMs;
|
|
62111
|
+
onFlush;
|
|
62112
|
+
constructor(options) {
|
|
62113
|
+
this.timeoutMs = options.timeoutMs ?? 50;
|
|
62114
|
+
this.onFlush = options.onFlush;
|
|
62115
|
+
}
|
|
62116
|
+
/** Buffer a chunk of IME-like input, (re)starting the auto-flush timer. */
|
|
62117
|
+
add(chunk) {
|
|
62118
|
+
this.buf += chunk;
|
|
62119
|
+
this.restartTimer();
|
|
62120
|
+
}
|
|
62121
|
+
/** Remove the last character from the buffer (used for IME backspace). */
|
|
62122
|
+
backspace() {
|
|
62123
|
+
if (!this.buf)
|
|
62124
|
+
return false;
|
|
62125
|
+
this.buf = this.buf.slice(0, -1);
|
|
62126
|
+
this.restartTimer();
|
|
62127
|
+
return true;
|
|
62128
|
+
}
|
|
62129
|
+
hasContent() {
|
|
62130
|
+
return this.buf.length > 0;
|
|
62131
|
+
}
|
|
62132
|
+
/** Flush immediately (used when an unambiguous non-IME key arrives). */
|
|
62133
|
+
flush() {
|
|
62134
|
+
this.clearTimer();
|
|
62135
|
+
if (!this.buf)
|
|
62136
|
+
return;
|
|
62137
|
+
const text = this.buf;
|
|
62138
|
+
this.buf = "";
|
|
62139
|
+
this.onFlush(text);
|
|
62140
|
+
}
|
|
62141
|
+
/** Cancel the timer without flushing (used on unmount). */
|
|
62142
|
+
destroy() {
|
|
62143
|
+
this.clearTimer();
|
|
62144
|
+
this.buf = "";
|
|
62145
|
+
}
|
|
62146
|
+
restartTimer() {
|
|
62147
|
+
this.clearTimer();
|
|
62148
|
+
this.timer = setTimeout(() => this.flush(), this.timeoutMs);
|
|
62149
|
+
}
|
|
62150
|
+
clearTimer() {
|
|
62151
|
+
if (this.timer !== null) {
|
|
62152
|
+
clearTimeout(this.timer);
|
|
62153
|
+
this.timer = null;
|
|
62154
|
+
}
|
|
62155
|
+
}
|
|
62156
|
+
};
|
|
62157
|
+
|
|
62097
62158
|
// src/ui/inkTerminal.tsx
|
|
62098
62159
|
function footerText(info) {
|
|
62099
62160
|
const modeLabel = info.autoApprove ? "yolo mode on" : info.mode === "plan" ? "plan mode on" : info.mode === "edit" ? "edit mode on" : info.mode === "ask" ? "ask mode on" : "auto mode on";
|
|
@@ -62132,6 +62193,16 @@ var App2 = ({ onReady }) => {
|
|
|
62132
62193
|
const onLine = (0, import_react34.useCallback)((cb) => {
|
|
62133
62194
|
onLineRef.current = cb;
|
|
62134
62195
|
}, []);
|
|
62196
|
+
const imeBufferRef = (0, import_react34.useRef)(null);
|
|
62197
|
+
if (imeBufferRef.current === null) {
|
|
62198
|
+
imeBufferRef.current = new ImeCompositionBuffer({
|
|
62199
|
+
onFlush: (text) => setLine((s2) => s2 + text)
|
|
62200
|
+
});
|
|
62201
|
+
}
|
|
62202
|
+
import_react34.default.useEffect(() => {
|
|
62203
|
+
const buf = imeBufferRef.current;
|
|
62204
|
+
return () => buf?.destroy();
|
|
62205
|
+
}, []);
|
|
62135
62206
|
use_input_default((char, key) => {
|
|
62136
62207
|
if (!inputEnabled)
|
|
62137
62208
|
return;
|
|
@@ -62140,10 +62211,15 @@ var App2 = ({ onReady }) => {
|
|
|
62140
62211
|
return;
|
|
62141
62212
|
}
|
|
62142
62213
|
if (key.backspace || key.delete) {
|
|
62214
|
+
if (imeBufferRef.current?.hasContent()) {
|
|
62215
|
+
imeBufferRef.current.backspace();
|
|
62216
|
+
return;
|
|
62217
|
+
}
|
|
62143
62218
|
setLine((s2) => s2.slice(0, -1));
|
|
62144
62219
|
return;
|
|
62145
62220
|
}
|
|
62146
62221
|
if (key.upArrow || key.downArrow || key.leftArrow || key.rightArrow || key.tab) {
|
|
62222
|
+
imeBufferRef.current?.flush();
|
|
62147
62223
|
return;
|
|
62148
62224
|
}
|
|
62149
62225
|
const newlineIdx = char.search(/[\r\n]/);
|
|
@@ -62151,6 +62227,7 @@ var App2 = ({ onReady }) => {
|
|
|
62151
62227
|
if (hasNewline) {
|
|
62152
62228
|
const before = newlineIdx === -1 ? char : char.slice(0, newlineIdx);
|
|
62153
62229
|
const after = newlineIdx === -1 ? "" : char.slice(newlineIdx + 1).replace(/^[\r\n]/, "");
|
|
62230
|
+
imeBufferRef.current?.flush();
|
|
62154
62231
|
const submitted = line + before;
|
|
62155
62232
|
setLine(after);
|
|
62156
62233
|
print(prompt2 + submitted);
|
|
@@ -62163,21 +62240,17 @@ var App2 = ({ onReady }) => {
|
|
|
62163
62240
|
}
|
|
62164
62241
|
return;
|
|
62165
62242
|
}
|
|
62243
|
+
if (isImeLikeInput(char)) {
|
|
62244
|
+
imeBufferRef.current?.add(char);
|
|
62245
|
+
return;
|
|
62246
|
+
}
|
|
62247
|
+
imeBufferRef.current?.flush();
|
|
62166
62248
|
setLine((s2) => s2 + char);
|
|
62167
62249
|
});
|
|
62168
62250
|
import_react34.default.useEffect(() => {
|
|
62169
62251
|
onReady({ print, setFooter, setLive, askLine, onLine, setInputEnabled, close: () => exit() });
|
|
62170
62252
|
}, []);
|
|
62171
|
-
|
|
62172
|
-
const [rows, setRows] = (0, import_react34.useState)(stdout.rows || 24);
|
|
62173
|
-
(0, import_react34.useEffect)(() => {
|
|
62174
|
-
const onResize = () => setRows(stdout.rows || 24);
|
|
62175
|
-
stdout.on("resize", onResize);
|
|
62176
|
-
return () => {
|
|
62177
|
-
stdout.off("resize", onResize);
|
|
62178
|
-
};
|
|
62179
|
-
}, [stdout]);
|
|
62180
|
-
return /* @__PURE__ */ import_react34.default.createElement(Box_default, { flexDirection: "column", height: rows }, /* @__PURE__ */ import_react34.default.createElement(Static, { items }, (item) => /* @__PURE__ */ import_react34.default.createElement(Text, { key: item.id }, item.content)), /* @__PURE__ */ import_react34.default.createElement(Box_default, { flexDirection: "column", flexGrow: 1, justifyContent: "flex-end" }, live ? /* @__PURE__ */ import_react34.default.createElement(Text, null, live) : null, /* @__PURE__ */ import_react34.default.createElement(Text, { dimColor: true }, "\u2500".repeat(process.stdout.columns || 80)), inputEnabled ? /* @__PURE__ */ import_react34.default.createElement(Box_default, null, /* @__PURE__ */ import_react34.default.createElement(Text, null, prompt2), /* @__PURE__ */ import_react34.default.createElement(Text, null, line), /* @__PURE__ */ import_react34.default.createElement(Text, { inverse: true }, " ")) : /* @__PURE__ */ import_react34.default.createElement(Text, { dimColor: true }, " (working\u2026)"), /* @__PURE__ */ import_react34.default.createElement(Text, { dimColor: true }, footerText(footer))));
|
|
62253
|
+
return /* @__PURE__ */ import_react34.default.createElement(Box_default, { flexDirection: "column" }, /* @__PURE__ */ import_react34.default.createElement(Static, { items }, (item) => /* @__PURE__ */ import_react34.default.createElement(Text, { key: item.id }, item.content)), live ? /* @__PURE__ */ import_react34.default.createElement(Text, null, live) : null, /* @__PURE__ */ import_react34.default.createElement(Text, { dimColor: true }, "\u2500".repeat(process.stdout.columns || 80)), inputEnabled ? /* @__PURE__ */ import_react34.default.createElement(Box_default, null, /* @__PURE__ */ import_react34.default.createElement(Text, null, prompt2), /* @__PURE__ */ import_react34.default.createElement(Text, null, line), /* @__PURE__ */ import_react34.default.createElement(Text, { inverse: true }, " ")) : /* @__PURE__ */ import_react34.default.createElement(Text, { dimColor: true }, " (working\u2026)"), /* @__PURE__ */ import_react34.default.createElement(Text, { dimColor: true }, footerText(footer)));
|
|
62181
62254
|
};
|
|
62182
62255
|
function startInkTerminal() {
|
|
62183
62256
|
if (handle)
|
|
@@ -62247,7 +62320,7 @@ var InkReadlineAdapter = class extends EventEmitter3 {
|
|
|
62247
62320
|
};
|
|
62248
62321
|
|
|
62249
62322
|
// src/commands/chat.ts
|
|
62250
|
-
var CLI_VERSION = "0.5.
|
|
62323
|
+
var CLI_VERSION = "0.5.38";
|
|
62251
62324
|
var MODEL_LABELS = {
|
|
62252
62325
|
turbo: "Nexrall Turbo",
|
|
62253
62326
|
pro: "Nexrall Pro",
|
|
@@ -63068,11 +63141,7 @@ ${summaryText}` }] },
|
|
|
63068
63141
|
case "/init": {
|
|
63069
63142
|
const nexrallMdPath = path3.join(workDir, "nexrall.md");
|
|
63070
63143
|
if (fs7.existsSync(nexrallMdPath)) {
|
|
63071
|
-
const
|
|
63072
|
-
const answer = await new Promise((resolve3) => rl2.question(source_default.yellow(" nexrall.md already exists. Overwrite? [y/n] "), (a) => {
|
|
63073
|
-
rl2.close();
|
|
63074
|
-
resolve3(a.trim());
|
|
63075
|
-
}));
|
|
63144
|
+
const answer = await new Promise((resolve3) => rl.question(source_default.yellow(" nexrall.md already exists. Overwrite? [y/n] "), (a) => resolve3(a.trim())));
|
|
63076
63145
|
if (answer !== "y" && answer !== "yes") {
|
|
63077
63146
|
console.log(source_default.dim(" Cancelled."));
|
|
63078
63147
|
rl.prompt();
|
|
@@ -63129,13 +63198,8 @@ ${dirList}`;
|
|
|
63129
63198
|
const wantsClear = memArgs.includes("clear");
|
|
63130
63199
|
const memScope = wantsGlobalOnly ? "global" : "project";
|
|
63131
63200
|
if (wantsClear) {
|
|
63132
|
-
rl.pause();
|
|
63133
|
-
const rl2 = readline3.createInterface({ input: process.stdin, output: process.stdout });
|
|
63134
63201
|
const label = memScope === "global" ? "GLOBAL" : "this PROJECT's";
|
|
63135
|
-
const answer = await new Promise((resolve3) =>
|
|
63136
|
-
rl2.close();
|
|
63137
|
-
resolve3(a.trim());
|
|
63138
|
-
}));
|
|
63202
|
+
const answer = await new Promise((resolve3) => rl.question(source_default.yellow(` Clear ${label} memory? This cannot be undone. [y/n] `), (a) => resolve3(a.trim())));
|
|
63139
63203
|
if (answer === "y" || answer === "yes") {
|
|
63140
63204
|
(0, import_code_core3.clearMemory)(memScope, workDir);
|
|
63141
63205
|
console.log(source_default.green(` ${memScope === "global" ? "Global" : "Project"} memory cleared.`));
|
|
@@ -63662,7 +63726,7 @@ function pluginListCommand() {
|
|
|
63662
63726
|
|
|
63663
63727
|
// src/index.ts
|
|
63664
63728
|
var program2 = new Command();
|
|
63665
|
-
program2.name("nex").description("Nexrall Code \u2014 AI coding assistant (powered by Nexrall)").version("0.5.
|
|
63729
|
+
program2.name("nex").description("Nexrall Code \u2014 AI coding assistant (powered by Nexrall)").version("0.5.38");
|
|
63666
63730
|
program2.command("auth").description("Login to your Nexrall account").action(authCommand);
|
|
63667
63731
|
program2.command("logout").description("Log out of your Nexrall account").action(logoutCommand);
|
|
63668
63732
|
program2.command("update").description("Update nex to the latest version").option("-c, --check", "Check for updates without installing").option("-y, --yes", "Skip confirmation prompt").action(async (opts) => {
|