draftify-cli 1.0.37 → 1.0.41
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/repl.js +13 -21
- package/dist/utils/ui.js +27 -13
- package/package.json +1 -1
package/dist/repl.js
CHANGED
|
@@ -773,34 +773,19 @@ async function startRepl(initialUsername) {
|
|
|
773
773
|
if (createMatch) {
|
|
774
774
|
const filePath = createMatch[1];
|
|
775
775
|
const actionKey = `create:${filePath}`;
|
|
776
|
-
|
|
777
|
-
activeActions.add(actionKey);
|
|
778
|
-
spinner.stop();
|
|
779
|
-
ui_1.ui.fileCreate(filePath);
|
|
780
|
-
spinner.start();
|
|
781
|
-
}
|
|
776
|
+
activeActions.add(actionKey);
|
|
782
777
|
spinner.setPrefix(`Creating ${filePath}...`);
|
|
783
778
|
}
|
|
784
779
|
else if (modifyMatch) {
|
|
785
780
|
const filePath = modifyMatch[1];
|
|
786
781
|
const actionKey = `modify:${filePath}`;
|
|
787
|
-
|
|
788
|
-
activeActions.add(actionKey);
|
|
789
|
-
spinner.stop();
|
|
790
|
-
ui_1.ui.fileModify(filePath);
|
|
791
|
-
spinner.start();
|
|
792
|
-
}
|
|
782
|
+
activeActions.add(actionKey);
|
|
793
783
|
spinner.setPrefix(`Modifying ${filePath}...`);
|
|
794
784
|
}
|
|
795
785
|
else if (deleteMatch) {
|
|
796
786
|
const filePath = deleteMatch[1];
|
|
797
787
|
const actionKey = `delete:${filePath}`;
|
|
798
|
-
|
|
799
|
-
activeActions.add(actionKey);
|
|
800
|
-
spinner.stop();
|
|
801
|
-
ui_1.ui.fileDelete(filePath);
|
|
802
|
-
spinner.start();
|
|
803
|
-
}
|
|
788
|
+
activeActions.add(actionKey);
|
|
804
789
|
spinner.setPrefix(`Deleting ${filePath}...`);
|
|
805
790
|
}
|
|
806
791
|
else if (currentStreamedText.length > 10) {
|
|
@@ -816,7 +801,14 @@ async function startRepl(initialUsername) {
|
|
|
816
801
|
}
|
|
817
802
|
if (spinner)
|
|
818
803
|
spinner.stop();
|
|
819
|
-
|
|
804
|
+
let errStr = e.message || String(e);
|
|
805
|
+
const statusMatch = errStr.match(/\b([45]\d{2})\b/);
|
|
806
|
+
if (statusMatch) {
|
|
807
|
+
errStr = statusMatch[1];
|
|
808
|
+
}
|
|
809
|
+
else if (errStr.length > 50) {
|
|
810
|
+
errStr = errStr.substring(0, 50) + "...";
|
|
811
|
+
}
|
|
820
812
|
// Only print error code / concise message
|
|
821
813
|
ui_1.ui.error(`API Error: ${errStr}. (Attempt ${retryCount + 1}/3)`);
|
|
822
814
|
retryCount++;
|
|
@@ -920,7 +912,7 @@ async function startRepl(initialUsername) {
|
|
|
920
912
|
const items = fs_1.default.readdirSync(fullPath, { withFileTypes: true });
|
|
921
913
|
const list = items.map((item) => `${item.isDirectory() ? '[DIR]' : '[FILE]'} ${item.name}`).join('\n');
|
|
922
914
|
autoExplorationOutputs.push(`Directory contents of ${dirPath}:\n${list}`);
|
|
923
|
-
ui_1.ui.
|
|
915
|
+
ui_1.ui.fileRead(dirPath);
|
|
924
916
|
}
|
|
925
917
|
else {
|
|
926
918
|
autoExplorationOutputs.push(`Directory ${dirPath} not found.`);
|
|
@@ -941,7 +933,7 @@ async function startRepl(initialUsername) {
|
|
|
941
933
|
if (fs_1.default.existsSync(fullPath)) {
|
|
942
934
|
const content = fs_1.default.readFileSync(fullPath, 'utf-8');
|
|
943
935
|
autoExplorationOutputs.push(`File: ${filePath}\n\`\`\`\n${content}\n\`\`\``);
|
|
944
|
-
ui_1.ui.
|
|
936
|
+
ui_1.ui.fileRead(filePath);
|
|
945
937
|
}
|
|
946
938
|
else {
|
|
947
939
|
autoExplorationOutputs.push(`File ${filePath} not found.`);
|
package/dist/utils/ui.js
CHANGED
|
@@ -7,45 +7,57 @@ exports.ui = void 0;
|
|
|
7
7
|
exports.createSpinner = createSpinner;
|
|
8
8
|
const kleur_1 = require("kleur");
|
|
9
9
|
const ora_1 = __importDefault(require("ora"));
|
|
10
|
+
let lastWasInline = false;
|
|
11
|
+
function inlineLog(text) {
|
|
12
|
+
if (lastWasInline) {
|
|
13
|
+
process.stdout.write('\x1b[1A\x1b[2K'); // Move up 1 line, clear line
|
|
14
|
+
}
|
|
15
|
+
console.log(text);
|
|
16
|
+
lastWasInline = true;
|
|
17
|
+
}
|
|
18
|
+
function resetInline() {
|
|
19
|
+
lastWasInline = false;
|
|
20
|
+
}
|
|
10
21
|
// Bento-style minimalist & Claude-style orange UI
|
|
11
22
|
exports.ui = {
|
|
12
|
-
header: (text) => console.log(`\n${(0, kleur_1.bold)(text)}`),
|
|
13
|
-
step: (text) => console.log(` ${(0, kleur_1.dim)("│")} ${text}`),
|
|
14
|
-
info: (text) => console.log(` ${(0, kleur_1.dim)("│")} ${(0, kleur_1.dim)(text)}`),
|
|
15
|
-
success: (text) => console.log(` ${(0, kleur_1.dim)("└")} ${(0, kleur_1.bold)(text)}\n`),
|
|
16
|
-
error: (text) => console.log(`\n ${(0, kleur_1.bold)("x")} ${text}\n`),
|
|
23
|
+
header: (text) => { resetInline(); console.log(`\n${(0, kleur_1.bold)(text)}`); },
|
|
24
|
+
step: (text) => { resetInline(); console.log(` ${(0, kleur_1.dim)("│")} ${text}`); },
|
|
25
|
+
info: (text) => { resetInline(); console.log(` ${(0, kleur_1.dim)("│")} ${(0, kleur_1.dim)(text)}`); },
|
|
26
|
+
success: (text) => { resetInline(); console.log(` ${(0, kleur_1.dim)("└")} ${(0, kleur_1.bold)(text)}\n`); },
|
|
27
|
+
error: (text) => { resetInline(); console.log(`\n ${(0, kleur_1.bold)("x")} ${text}\n`); },
|
|
17
28
|
fileAction: (text) => {
|
|
18
29
|
const greenCheck = `\x1b[32m✓\x1b[0m`;
|
|
19
|
-
|
|
30
|
+
inlineLog(` ${greenCheck} ${text}`);
|
|
20
31
|
},
|
|
21
32
|
fileRead: (filePath) => {
|
|
22
33
|
const icon = `\x1b[36m›\x1b[0m`;
|
|
23
34
|
const gray = (s) => `\x1b[90m${s}\x1b[0m`;
|
|
24
|
-
|
|
35
|
+
inlineLog(` ${icon} ${gray("Reading:")} ${filePath}`);
|
|
25
36
|
},
|
|
26
37
|
fileCreate: (filePath) => {
|
|
27
38
|
const icon = `\x1b[32m+\x1b[0m`;
|
|
28
39
|
const gray = (s) => `\x1b[90m${s}\x1b[0m`;
|
|
29
|
-
|
|
40
|
+
inlineLog(` ${icon} ${gray("Creating:")} \x1b[32m${filePath}\x1b[0m`);
|
|
30
41
|
},
|
|
31
42
|
fileModify: (filePath) => {
|
|
32
43
|
const icon = `\x1b[33m~\x1b[0m`;
|
|
33
44
|
const gray = (s) => `\x1b[90m${s}\x1b[0m`;
|
|
34
|
-
|
|
45
|
+
inlineLog(` ${icon} ${gray("Modifying:")} \x1b[33m${filePath}\x1b[0m`);
|
|
35
46
|
},
|
|
36
47
|
fileDelete: (filePath) => {
|
|
37
48
|
const icon = `\x1b[31m-\x1b[0m`;
|
|
38
49
|
const gray = (s) => `\x1b[90m${s}\x1b[0m`;
|
|
39
|
-
|
|
50
|
+
inlineLog(` ${icon} ${gray("Deleting:")} \x1b[31m${filePath}\x1b[0m`);
|
|
40
51
|
},
|
|
41
52
|
fileSuccess: (action, filePath) => {
|
|
42
53
|
const check = `\x1b[32m✓\x1b[0m`;
|
|
43
|
-
|
|
54
|
+
inlineLog(` ${check} ${action}: ${filePath}`);
|
|
44
55
|
},
|
|
45
|
-
divider: () => console.log((0, kleur_1.dim)("──────────────────────────────────────────")),
|
|
46
|
-
blank: () => console.log(""),
|
|
56
|
+
divider: () => { resetInline(); console.log((0, kleur_1.dim)("──────────────────────────────────────────")); },
|
|
57
|
+
blank: () => { resetInline(); console.log(""); },
|
|
47
58
|
// Claude Code style orange box with terminal-width-aware wrapping
|
|
48
59
|
box: (title, lines) => {
|
|
60
|
+
resetInline();
|
|
49
61
|
const terminalWidth = process.stdout.columns || 80;
|
|
50
62
|
const maxBoxWidth = Math.max(40, Math.min(100, terminalWidth - 8));
|
|
51
63
|
const stripAnsi = (str) => str.replace(/\u001b\[[0-9;]*m/g, '');
|
|
@@ -90,10 +102,12 @@ exports.ui = {
|
|
|
90
102
|
},
|
|
91
103
|
// Minimalist status line for REPL
|
|
92
104
|
statusLine: (repoName, model) => {
|
|
105
|
+
resetInline();
|
|
93
106
|
const text = `Draftify Scale | Engine: ${model} | Repo: ${repoName}`;
|
|
94
107
|
console.log(`\n ${(0, kleur_1.dim)(`[${text}]`)}`);
|
|
95
108
|
},
|
|
96
109
|
welcomeScreen: (repoName, model, username, plan = "Draftify Scale", thinkingLevel = "Medium") => {
|
|
110
|
+
resetInline();
|
|
97
111
|
// Borderless Claude Code style with strong orange logo
|
|
98
112
|
const orange = (s) => `\x1b[38;5;208m${s}\x1b[0m`;
|
|
99
113
|
const gray = (s) => `\x1b[90m${s}\x1b[0m`;
|