draftify-cli 1.0.84 → 1.0.86
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/commands/refactor.js +2 -1
- package/dist/repl.js +30 -3
- package/dist/utils/api.js +2 -2
- package/dist/utils/config.js +9 -0
- package/dist/utils/ui.js +3 -2
- package/package.json +1 -1
|
@@ -47,7 +47,8 @@ async function refactorCommand(file, options) {
|
|
|
47
47
|
}
|
|
48
48
|
const spinner = (0, ui_1.createSpinner)("Analyzing and refactoring...").start();
|
|
49
49
|
try {
|
|
50
|
-
const result = await (0, api_1.refactorCodeApi)(path_1.default.basename(file), code, instruction, [], (0, config_1.getModel)(), []
|
|
50
|
+
const result = await (0, api_1.refactorCodeApi)(path_1.default.basename(file), code, instruction, [], (0, config_1.getModel)(), [], // empty skills array
|
|
51
|
+
(0, config_1.getThinkingLevel)());
|
|
51
52
|
spinner.stop();
|
|
52
53
|
ui_1.ui.success("Refactoring complete");
|
|
53
54
|
ui_1.ui.divider();
|
package/dist/repl.js
CHANGED
|
@@ -275,7 +275,7 @@ async function startRepl(initialUsername) {
|
|
|
275
275
|
}
|
|
276
276
|
const renderWelcome = () => {
|
|
277
277
|
console.clear();
|
|
278
|
-
ui_1.ui.welcomeScreen(repoName, currentModel, username, plan);
|
|
278
|
+
ui_1.ui.welcomeScreen(repoName, currentModel, username, plan, (0, config_1.getThinkingLevel)());
|
|
279
279
|
};
|
|
280
280
|
renderWelcome();
|
|
281
281
|
let conversationHistory = [];
|
|
@@ -291,7 +291,7 @@ async function startRepl(initialUsername) {
|
|
|
291
291
|
ui_1.ui.info(`Answers automatically sent to the AI.`);
|
|
292
292
|
}
|
|
293
293
|
else {
|
|
294
|
-
const commandsList = ['/new-chat', '/chats', '/skills', '/model', '/usage', '/login', '/logout', '/help', '/exit', '/quit'];
|
|
294
|
+
const commandsList = ['/new-chat', '/chats', '/skills', '/model', '/thinking-level', '/usage', '/login', '/logout', '/help', '/exit', '/quit'];
|
|
295
295
|
ui_1.ui.divider();
|
|
296
296
|
let answer = await getInteractiveInput((0, kleur_1.dim)("> "), commandsList);
|
|
297
297
|
ui_1.ui.divider();
|
|
@@ -377,6 +377,7 @@ async function startRepl(initialUsername) {
|
|
|
377
377
|
console.log(` ${(0, kleur_1.cyan)("/chats")} - List and load previous chats`);
|
|
378
378
|
console.log(` ${(0, kleur_1.cyan)("/skills")} - Manage and configure skills`);
|
|
379
379
|
console.log(` ${(0, kleur_1.cyan)("/model")} - Switch model (e.g., /model Opus 4.8-level)`);
|
|
380
|
+
console.log(` ${(0, kleur_1.cyan)("/thinking-level")} - Set thinking level for Opus 4.8-level`);
|
|
380
381
|
console.log(` ${(0, kleur_1.cyan)("/login")} - Log in to your Draftify account`);
|
|
381
382
|
console.log(` ${(0, kleur_1.cyan)("/logout")} - Log out of your account`);
|
|
382
383
|
console.log(` ${(0, kleur_1.cyan)("/usage")} - Show your token usage and quota`);
|
|
@@ -452,6 +453,32 @@ async function startRepl(initialUsername) {
|
|
|
452
453
|
ui_1.ui.info("Loading aborted.");
|
|
453
454
|
}
|
|
454
455
|
}
|
|
456
|
+
else if (cmd === "thinking-level") {
|
|
457
|
+
if (!currentModel.includes("4.8")) {
|
|
458
|
+
ui_1.ui.error("A thinking-level csak az Opus 4.8-level modellnél érhető el!");
|
|
459
|
+
continue;
|
|
460
|
+
}
|
|
461
|
+
const { Select } = require('enquirer');
|
|
462
|
+
try {
|
|
463
|
+
const prompt = new Select({
|
|
464
|
+
name: 'thinking',
|
|
465
|
+
message: 'Select the thinking level:',
|
|
466
|
+
choices: ['Low', 'Medium', 'High', 'Cancel']
|
|
467
|
+
});
|
|
468
|
+
const answer = await prompt.run();
|
|
469
|
+
if (answer !== 'Cancel') {
|
|
470
|
+
const { setThinkingLevel } = require('./utils/config');
|
|
471
|
+
setThinkingLevel(answer);
|
|
472
|
+
ui_1.ui.success(`Thinking level updated to: ${answer}`);
|
|
473
|
+
}
|
|
474
|
+
else {
|
|
475
|
+
ui_1.ui.info("Thinking level selection aborted.");
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
catch (e) {
|
|
479
|
+
ui_1.ui.info("Thinking level selection aborted.");
|
|
480
|
+
}
|
|
481
|
+
}
|
|
455
482
|
else if (cmd === "model") {
|
|
456
483
|
const newModel = parts.slice(1).join(" ").trim();
|
|
457
484
|
if (newModel) {
|
|
@@ -836,7 +863,7 @@ async function startRepl(initialUsername) {
|
|
|
836
863
|
spinner.setPrefix(`Retrying... (${retryCount}/3)`);
|
|
837
864
|
}
|
|
838
865
|
let thisAttemptText = "";
|
|
839
|
-
const attemptResult = await (0, api_1.refactorCodeApi)(requestPayloadFileName, requestPayloadCode, retryPrompt, retryHistory, currentModel, activeSkillsData, (chunk) => {
|
|
866
|
+
const attemptResult = await (0, api_1.refactorCodeApi)(requestPayloadFileName, requestPayloadCode, retryPrompt, retryHistory, currentModel, activeSkillsData, (0, config_1.getThinkingLevel)(), (chunk) => {
|
|
840
867
|
thisAttemptText += chunk;
|
|
841
868
|
currentStreamedText = partialText + thisAttemptText;
|
|
842
869
|
// Find the last opened tag that hasn't been closed yet
|
package/dist/utils/api.js
CHANGED
|
@@ -9,7 +9,7 @@ exports.getUserUsage = getUserUsage;
|
|
|
9
9
|
const config_1 = require("./config");
|
|
10
10
|
const dotenv_1 = __importDefault(require("dotenv"));
|
|
11
11
|
dotenv_1.default.config();
|
|
12
|
-
async function refactorCodeApi(fileName, code, instruction, history, modelName, skillsData, onChunk, abortSignal) {
|
|
12
|
+
async function refactorCodeApi(fileName, code, instruction, history, modelName, skillsData, thinkingLevel, onChunk, abortSignal) {
|
|
13
13
|
const token = (0, config_1.getToken)();
|
|
14
14
|
if (!token) {
|
|
15
15
|
throw new Error("No token found. Please run 'draftify login' first.");
|
|
@@ -21,7 +21,7 @@ async function refactorCodeApi(fileName, code, instruction, history, modelName,
|
|
|
21
21
|
"Content-Type": "application/json",
|
|
22
22
|
Authorization: `Bearer ${token}`
|
|
23
23
|
},
|
|
24
|
-
body: JSON.stringify({ fileName, code, instruction: `[SYSTEM NOTE: You are the ${modelName} model. If asked about your identity, you MUST state exactly: "Én a ${modelName} modell vagyok a Draftify platformon."]\n\n` + instruction, history, modelName, skillsData }),
|
|
24
|
+
body: JSON.stringify({ fileName, code, instruction: `[SYSTEM NOTE: You are the ${modelName} model. If asked about your identity, you MUST state exactly: "Én a ${modelName} modell vagyok a Draftify platformon."]\n\n` + instruction, history, modelName, skillsData, thinkingLevel }),
|
|
25
25
|
signal: abortSignal
|
|
26
26
|
});
|
|
27
27
|
if (!response.ok) {
|
package/dist/utils/config.js
CHANGED
|
@@ -9,6 +9,8 @@ exports.getToken = getToken;
|
|
|
9
9
|
exports.getApiUrl = getApiUrl;
|
|
10
10
|
exports.getModel = getModel;
|
|
11
11
|
exports.setModel = setModel;
|
|
12
|
+
exports.getThinkingLevel = getThinkingLevel;
|
|
13
|
+
exports.setThinkingLevel = setThinkingLevel;
|
|
12
14
|
exports.getSkills = getSkills;
|
|
13
15
|
exports.setSkills = setSkills;
|
|
14
16
|
exports.getGeminiApiKey = getGeminiApiKey;
|
|
@@ -58,6 +60,13 @@ function getModel() {
|
|
|
58
60
|
function setModel(modelName) {
|
|
59
61
|
saveConfig({ model: modelName });
|
|
60
62
|
}
|
|
63
|
+
function getThinkingLevel() {
|
|
64
|
+
const config = getConfig();
|
|
65
|
+
return config.thinkingLevel || "Medium";
|
|
66
|
+
}
|
|
67
|
+
function setThinkingLevel(level) {
|
|
68
|
+
saveConfig({ thinkingLevel: level });
|
|
69
|
+
}
|
|
61
70
|
function getSkills() {
|
|
62
71
|
const config = getConfig();
|
|
63
72
|
return config.skills || [];
|
package/dist/utils/ui.js
CHANGED
|
@@ -106,7 +106,7 @@ exports.ui = {
|
|
|
106
106
|
const text = `Draftify Scale | Engine: ${model} | Repo: ${repoName}`;
|
|
107
107
|
console.log(`\n ${(0, kleur_1.dim)(`[${text}]`)}`);
|
|
108
108
|
},
|
|
109
|
-
welcomeScreen: (repoName, model, username, plan = "Draftify Scale") => {
|
|
109
|
+
welcomeScreen: (repoName, model, username, plan = "Draftify Scale", thinkingLevel) => {
|
|
110
110
|
resetInline();
|
|
111
111
|
// Borderless Claude Code style with strong orange logo
|
|
112
112
|
const orange = (s) => `\x1b[38;5;208m${s}\x1b[0m`;
|
|
@@ -114,9 +114,10 @@ exports.ui = {
|
|
|
114
114
|
const white = (s) => `\x1b[37m${s}\x1b[0m`;
|
|
115
115
|
console.log("");
|
|
116
116
|
const greeting = username ? `Welcome ${username} to Draftify Code!` : "Welcome to Draftify Code!";
|
|
117
|
+
const modelStr = model.includes("4.8") && thinkingLevel ? `${model} (Thinking: ${thinkingLevel})` : model;
|
|
117
118
|
console.log(` ${orange("█ █ █ █")} ${white(greeting)}`);
|
|
118
119
|
console.log(` ${orange("█████████")} ${white("Draftify Code ")}${gray("v1.0.0")}`);
|
|
119
|
-
console.log(` ${orange("█ █████ █")} ${gray(`${
|
|
120
|
+
console.log(` ${orange("█ █████ █")} ${gray(`${modelStr} [${plan}]`)}`);
|
|
120
121
|
console.log(` ${orange("█████████")} ${gray(process.cwd())}`);
|
|
121
122
|
console.log(` ${orange(" █ █ ")}`);
|
|
122
123
|
console.log("");
|