nexrall-code 0.5.81 → 0.5.83
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 +48 -11
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -54619,6 +54619,12 @@ function padVis(s2, n) {
|
|
|
54619
54619
|
const pad = n - visibleLen(s2);
|
|
54620
54620
|
return pad > 0 ? s2 + " ".repeat(pad) : s2;
|
|
54621
54621
|
}
|
|
54622
|
+
function ruleWidth(max = 50, columns = process.stdout.columns || 80) {
|
|
54623
|
+
const MIN = 20;
|
|
54624
|
+
const indent = 2;
|
|
54625
|
+
const available = columns - indent;
|
|
54626
|
+
return Math.max(MIN, Math.min(max, available));
|
|
54627
|
+
}
|
|
54622
54628
|
var MarkdownStreamRenderer = class {
|
|
54623
54629
|
_buf = "";
|
|
54624
54630
|
// incomplete trailing chunk
|
|
@@ -54660,7 +54666,7 @@ var MarkdownStreamRenderer = class {
|
|
|
54660
54666
|
this._buf = "";
|
|
54661
54667
|
}
|
|
54662
54668
|
if (this._inCode) {
|
|
54663
|
-
console.log(source_default.dim(" \u2514" + "\u2500".repeat(48)));
|
|
54669
|
+
console.log(source_default.dim(" \u2514" + "\u2500".repeat(ruleWidth(48))));
|
|
54664
54670
|
this._inCode = false;
|
|
54665
54671
|
}
|
|
54666
54672
|
this._flushTable();
|
|
@@ -54713,10 +54719,10 @@ var MarkdownStreamRenderer = class {
|
|
|
54713
54719
|
this._inCode = true;
|
|
54714
54720
|
this._codeLang = raw.slice(3).trim();
|
|
54715
54721
|
const label = this._codeLang ? source_default.dim(` ${this._codeLang}`) : "";
|
|
54716
|
-
console.log("\n" + source_default.dim(" \u250C" + "\u2500".repeat(48)) + label);
|
|
54722
|
+
console.log("\n" + source_default.dim(" \u250C" + "\u2500".repeat(ruleWidth(48))) + label);
|
|
54717
54723
|
} else {
|
|
54718
54724
|
this._inCode = false;
|
|
54719
|
-
console.log(source_default.dim(" \u2514" + "\u2500".repeat(48)) + "\n");
|
|
54725
|
+
console.log(source_default.dim(" \u2514" + "\u2500".repeat(ruleWidth(48))) + "\n");
|
|
54720
54726
|
}
|
|
54721
54727
|
return;
|
|
54722
54728
|
}
|
|
@@ -54735,7 +54741,7 @@ var MarkdownStreamRenderer = class {
|
|
|
54735
54741
|
}
|
|
54736
54742
|
this._flushTable();
|
|
54737
54743
|
if (/^[-*_]{3,}\s*$/.test(raw)) {
|
|
54738
|
-
console.log("\n" + source_default.dim(" " + "\u2500".repeat(50)) + "\n");
|
|
54744
|
+
console.log("\n" + source_default.dim(" " + "\u2500".repeat(ruleWidth(50))) + "\n");
|
|
54739
54745
|
return;
|
|
54740
54746
|
}
|
|
54741
54747
|
if (raw.startsWith("#### ")) {
|
|
@@ -55919,7 +55925,7 @@ function renderBanner(info) {
|
|
|
55919
55925
|
const PAD = 1;
|
|
55920
55926
|
const CHROME = 3 + 4 * PAD;
|
|
55921
55927
|
const LOGO_W = Math.max(...NEX_LOGO.map(visibleLen));
|
|
55922
|
-
const termW = process.stdout.columns
|
|
55928
|
+
const termW = info.columns ?? process.stdout.columns ?? 100;
|
|
55923
55929
|
const totalW = Math.max(LOGO_W + CHROME + 24, termW - 1);
|
|
55924
55930
|
const headerText = `Nexrall Code v${info.version}`;
|
|
55925
55931
|
const LEFT_W = Math.max(LOGO_W, visibleLen(headerText));
|
|
@@ -64939,11 +64945,14 @@ function repaintAfterResizeSettle() {
|
|
|
64939
64945
|
if (inkInstance !== instance)
|
|
64940
64946
|
return;
|
|
64941
64947
|
process.stdout.write("\x1B[0J");
|
|
64948
|
+
forceFullRedrawRef?.();
|
|
64942
64949
|
});
|
|
64943
64950
|
}
|
|
64951
|
+
var forceFullRedrawRef = null;
|
|
64944
64952
|
var DEFAULT_PROMPT = colors.primary.bold("> ");
|
|
64945
64953
|
var App2 = ({ onReady }) => {
|
|
64946
64954
|
const [items, setItems] = (0, import_react35.useState)([]);
|
|
64955
|
+
const [staticKey, setStaticKey] = (0, import_react35.useState)(0);
|
|
64947
64956
|
const [footer, setFooterState] = (0, import_react35.useState)({ mode: "auto", autoApprove: false });
|
|
64948
64957
|
const [busy, setBusyState] = (0, import_react35.useState)(false);
|
|
64949
64958
|
const [line, setLineState] = (0, import_react35.useState)("");
|
|
@@ -64973,8 +64982,12 @@ var App2 = ({ onReady }) => {
|
|
|
64973
64982
|
setQuitArmedState(at);
|
|
64974
64983
|
}, []);
|
|
64975
64984
|
const [live, setLiveState] = (0, import_react35.useState)("");
|
|
64976
|
-
const print = (0, import_react35.useCallback)((text) => {
|
|
64977
|
-
setItems((prev) => [...prev, { id: idCounter++, content: text }]);
|
|
64985
|
+
const print = (0, import_react35.useCallback)((text, opts) => {
|
|
64986
|
+
setItems((prev) => [...prev, { id: idCounter++, content: text, isBanner: opts?.isBanner }]);
|
|
64987
|
+
}, []);
|
|
64988
|
+
const bannerRegeneratorRef = (0, import_react35.useRef)(null);
|
|
64989
|
+
const setBannerRegenerator = (0, import_react35.useCallback)((fn) => {
|
|
64990
|
+
bannerRegeneratorRef.current = fn;
|
|
64978
64991
|
}, []);
|
|
64979
64992
|
const setFooter = (0, import_react35.useCallback)((info) => setFooterState(info), []);
|
|
64980
64993
|
const setLive = (0, import_react35.useCallback)((text) => setLiveState(text), []);
|
|
@@ -65109,10 +65122,28 @@ var App2 = ({ onReady }) => {
|
|
|
65109
65122
|
return s2.slice(0, pos) + char + s2.slice(pos);
|
|
65110
65123
|
});
|
|
65111
65124
|
});
|
|
65125
|
+
const forceFullRedraw = (0, import_react35.useCallback)(() => {
|
|
65126
|
+
process.stdout.write("\x1B[2J\x1B[H");
|
|
65127
|
+
const regen = bannerRegeneratorRef.current;
|
|
65128
|
+
if (regen) {
|
|
65129
|
+
const columns = process.stdout.columns || 80;
|
|
65130
|
+
setItems((prev) => prev.map(
|
|
65131
|
+
(it) => it.isBanner ? { ...it, content: regen(columns) } : it
|
|
65132
|
+
));
|
|
65133
|
+
}
|
|
65134
|
+
setStaticKey((k) => k + 1);
|
|
65135
|
+
}, []);
|
|
65136
|
+
import_react35.default.useEffect(() => {
|
|
65137
|
+
forceFullRedrawRef = forceFullRedraw;
|
|
65138
|
+
return () => {
|
|
65139
|
+
forceFullRedrawRef = null;
|
|
65140
|
+
};
|
|
65141
|
+
}, [forceFullRedraw]);
|
|
65112
65142
|
import_react35.default.useEffect(() => {
|
|
65113
65143
|
onReady({
|
|
65114
65144
|
print,
|
|
65115
65145
|
setFooter,
|
|
65146
|
+
setBannerRegenerator,
|
|
65116
65147
|
setLive,
|
|
65117
65148
|
askLine,
|
|
65118
65149
|
onLine,
|
|
@@ -65124,7 +65155,7 @@ var App2 = ({ onReady }) => {
|
|
|
65124
65155
|
});
|
|
65125
65156
|
}, []);
|
|
65126
65157
|
const slices = renderInputSlices(line, cursorPos);
|
|
65127
|
-
return /* @__PURE__ */ import_react35.default.createElement(Box_default, { flexDirection: "column" }, /* @__PURE__ */ import_react35.default.createElement(Static, { items }, (item) => /* @__PURE__ */ import_react35.default.createElement(Text, { key: item.id }, item.content)), live ? /* @__PURE__ */ import_react35.default.createElement(Text, null, live) : null, /* @__PURE__ */ import_react35.default.createElement(
|
|
65158
|
+
return /* @__PURE__ */ import_react35.default.createElement(Box_default, { flexDirection: "column" }, /* @__PURE__ */ import_react35.default.createElement(Static, { items, key: staticKey }, (item) => /* @__PURE__ */ import_react35.default.createElement(Text, { key: item.id }, item.content)), live ? /* @__PURE__ */ import_react35.default.createElement(Text, null, live) : null, /* @__PURE__ */ import_react35.default.createElement(
|
|
65128
65159
|
Box_default,
|
|
65129
65160
|
{
|
|
65130
65161
|
borderStyle: "single",
|
|
@@ -65134,7 +65165,7 @@ var App2 = ({ onReady }) => {
|
|
|
65134
65165
|
borderRight: false,
|
|
65135
65166
|
borderDimColor: true
|
|
65136
65167
|
}
|
|
65137
|
-
), /* @__PURE__ */ import_react35.default.createElement(Box_default, null, /* @__PURE__ */ import_react35.default.createElement(Text, null, prompt2), /* @__PURE__ */ import_react35.default.createElement(Text, null, slices.before), /* @__PURE__ */ import_react35.default.createElement(Text, { inverse: true }, slices.atCursor), /* @__PURE__ */ import_react35.default.createElement(Text, null, slices.after)), /* @__PURE__ */ import_react35.default.createElement(
|
|
65168
|
+
), /* @__PURE__ */ import_react35.default.createElement(Box_default, null, /* @__PURE__ */ import_react35.default.createElement(Text, null, /* @__PURE__ */ import_react35.default.createElement(Text, null, prompt2), /* @__PURE__ */ import_react35.default.createElement(Text, null, slices.before), /* @__PURE__ */ import_react35.default.createElement(Text, { inverse: true }, slices.atCursor), /* @__PURE__ */ import_react35.default.createElement(Text, null, slices.after))), /* @__PURE__ */ import_react35.default.createElement(
|
|
65138
65169
|
Box_default,
|
|
65139
65170
|
{
|
|
65140
65171
|
borderStyle: "single",
|
|
@@ -65980,14 +66011,20 @@ Set ${TRUST_ENV_VAR}=1 to confirm non-interactively, or run \`nex\` interactivel
|
|
|
65980
66011
|
if (branch) {
|
|
65981
66012
|
tips.push(`On branch ${branch}${changedLines > 0 ? ` (${changedLines} changed)` : ""}.`);
|
|
65982
66013
|
}
|
|
65983
|
-
|
|
66014
|
+
const bannerInfo = {
|
|
65984
66015
|
version: CLI_VERSION,
|
|
65985
66016
|
userLabel: currentUserLabel(),
|
|
65986
66017
|
modelLabel: resolveModelLabel(modelAlias),
|
|
65987
66018
|
workDir,
|
|
65988
66019
|
nexrallMdLoaded: !!nexrallMd,
|
|
65989
66020
|
tips
|
|
65990
|
-
}
|
|
66021
|
+
};
|
|
66022
|
+
if (interactive) {
|
|
66023
|
+
getInkTerminal().print(renderBanner({ ...bannerInfo, columns: process.stdout.columns ?? 80 }), { isBanner: true });
|
|
66024
|
+
getInkTerminal().setBannerRegenerator((columns) => renderBanner({ ...bannerInfo, columns }));
|
|
66025
|
+
} else {
|
|
66026
|
+
console.log(renderBanner({ ...bannerInfo, columns: process.stdout.columns ?? 80 }));
|
|
66027
|
+
}
|
|
65991
66028
|
console.log();
|
|
65992
66029
|
}
|
|
65993
66030
|
let messages = [];
|