draftify-cli 1.0.82 → 1.0.85
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 +27 -1
- package/dist/utils/api.js +2 -2
- package/dist/utils/config.js +10 -1
- 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
|
@@ -452,6 +452,32 @@ async function startRepl(initialUsername) {
|
|
|
452
452
|
ui_1.ui.info("Loading aborted.");
|
|
453
453
|
}
|
|
454
454
|
}
|
|
455
|
+
else if (cmd === "thinking-level") {
|
|
456
|
+
if (!currentModel.includes("4.8")) {
|
|
457
|
+
ui_1.ui.error("A thinking-level csak az Opus 4.8-level modellnél érhető el!");
|
|
458
|
+
continue;
|
|
459
|
+
}
|
|
460
|
+
const { Select } = require('enquirer');
|
|
461
|
+
try {
|
|
462
|
+
const prompt = new Select({
|
|
463
|
+
name: 'thinking',
|
|
464
|
+
message: 'Select the thinking level:',
|
|
465
|
+
choices: ['Low', 'Medium', 'High', 'Cancel']
|
|
466
|
+
});
|
|
467
|
+
const answer = await prompt.run();
|
|
468
|
+
if (answer !== 'Cancel') {
|
|
469
|
+
const { setThinkingLevel } = require('./utils/config');
|
|
470
|
+
setThinkingLevel(answer);
|
|
471
|
+
ui_1.ui.success(`Thinking level updated to: ${answer}`);
|
|
472
|
+
}
|
|
473
|
+
else {
|
|
474
|
+
ui_1.ui.info("Thinking level selection aborted.");
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
catch (e) {
|
|
478
|
+
ui_1.ui.info("Thinking level selection aborted.");
|
|
479
|
+
}
|
|
480
|
+
}
|
|
455
481
|
else if (cmd === "model") {
|
|
456
482
|
const newModel = parts.slice(1).join(" ").trim();
|
|
457
483
|
if (newModel) {
|
|
@@ -836,7 +862,7 @@ async function startRepl(initialUsername) {
|
|
|
836
862
|
spinner.setPrefix(`Retrying... (${retryCount}/3)`);
|
|
837
863
|
}
|
|
838
864
|
let thisAttemptText = "";
|
|
839
|
-
const attemptResult = await (0, api_1.refactorCodeApi)(requestPayloadFileName, requestPayloadCode, retryPrompt, retryHistory, currentModel, activeSkillsData, (chunk) => {
|
|
865
|
+
const attemptResult = await (0, api_1.refactorCodeApi)(requestPayloadFileName, requestPayloadCode, retryPrompt, retryHistory, currentModel, activeSkillsData, (0, config_1.getThinkingLevel)(), (chunk) => {
|
|
840
866
|
thisAttemptText += chunk;
|
|
841
867
|
currentStreamedText = partialText + thisAttemptText;
|
|
842
868
|
// 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;
|
|
@@ -49,7 +51,7 @@ function getToken() {
|
|
|
49
51
|
function getApiUrl() {
|
|
50
52
|
const config = getConfig();
|
|
51
53
|
// Fallback API URL, overrideable via config or DRAFTIFY_API_URL
|
|
52
|
-
return process.env.DRAFTIFY_API_URL || config.apiUrl || "
|
|
54
|
+
return process.env.DRAFTIFY_API_URL || config.apiUrl || "https://www.draftify.site/api/cli";
|
|
53
55
|
}
|
|
54
56
|
function getModel() {
|
|
55
57
|
const config = getConfig();
|
|
@@ -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 || [];
|