draftify-cli 1.0.17 → 1.0.20
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 +21 -21
- package/package.json +1 -2
package/dist/repl.js
CHANGED
|
@@ -614,8 +614,28 @@ async function startRepl(initialUsername) {
|
|
|
614
614
|
const relative = path_1.default.relative(process.cwd(), targetPath);
|
|
615
615
|
return !relative.startsWith('..') && !path_1.default.isAbsolute(relative);
|
|
616
616
|
};
|
|
617
|
-
const
|
|
617
|
+
const deleteRegex = /<FILE_DELETE\s+path="([^"]+)"\s*\/>/g;
|
|
618
618
|
let match;
|
|
619
|
+
while ((match = deleteRegex.exec(result)) !== null) {
|
|
620
|
+
const filePath = match[1];
|
|
621
|
+
const fullPath = path_1.default.resolve(process.cwd(), filePath);
|
|
622
|
+
if (!isSafePath(fullPath)) {
|
|
623
|
+
ui_1.ui.error(`Security error: Cannot delete file outside workspace (${filePath})`);
|
|
624
|
+
displayResult = displayResult.replace(match[0], `[Blocked: ${filePath} is outside workspace]`);
|
|
625
|
+
continue;
|
|
626
|
+
}
|
|
627
|
+
if (fs_1.default.existsSync(fullPath)) {
|
|
628
|
+
try {
|
|
629
|
+
fs_1.default.unlinkSync(fullPath);
|
|
630
|
+
ui_1.ui.fileSuccess("Deleted", filePath);
|
|
631
|
+
displayResult = displayResult.replace(match[0], '');
|
|
632
|
+
}
|
|
633
|
+
catch (e) {
|
|
634
|
+
ui_1.ui.error(`Failed to delete ${filePath}: ${e.message}`);
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
const createRegex = /<FILE_CREATE\s+path="([^"]+)">([\s\S]*?)<\/FILE_CREATE>/g;
|
|
619
639
|
while ((match = createRegex.exec(result)) !== null) {
|
|
620
640
|
const filePath = match[1];
|
|
621
641
|
const fullPath = path_1.default.resolve(process.cwd(), filePath);
|
|
@@ -702,26 +722,6 @@ async function startRepl(initialUsername) {
|
|
|
702
722
|
ui_1.ui.error(`Cannot modify ${filePath}: File not found.`);
|
|
703
723
|
}
|
|
704
724
|
}
|
|
705
|
-
const deleteRegex = /<FILE_DELETE\s+path="([^"]+)"\s*\/>/g;
|
|
706
|
-
while ((match = deleteRegex.exec(result)) !== null) {
|
|
707
|
-
const filePath = match[1];
|
|
708
|
-
const fullPath = path_1.default.resolve(process.cwd(), filePath);
|
|
709
|
-
if (!isSafePath(fullPath)) {
|
|
710
|
-
ui_1.ui.error(`Security error: Cannot delete file outside workspace (${filePath})`);
|
|
711
|
-
displayResult = displayResult.replace(match[0], `[Blocked: ${filePath} is outside workspace]`);
|
|
712
|
-
continue;
|
|
713
|
-
}
|
|
714
|
-
if (fs_1.default.existsSync(fullPath)) {
|
|
715
|
-
try {
|
|
716
|
-
fs_1.default.unlinkSync(fullPath);
|
|
717
|
-
ui_1.ui.fileSuccess("Deleted", filePath);
|
|
718
|
-
displayResult = displayResult.replace(match[0], '');
|
|
719
|
-
}
|
|
720
|
-
catch (e) {
|
|
721
|
-
ui_1.ui.error(`Failed to delete ${filePath}: ${e.message}`);
|
|
722
|
-
}
|
|
723
|
-
}
|
|
724
|
-
}
|
|
725
725
|
const commandsToRun = [];
|
|
726
726
|
const runRegex = /<RUN_COMMAND>([\s\S]*?)<\/RUN_COMMAND>/g;
|
|
727
727
|
while ((match = runRegex.exec(result)) !== null) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "draftify-cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.20",
|
|
4
4
|
"description": "Draftify AI CLI tool",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -24,7 +24,6 @@
|
|
|
24
24
|
"author": "",
|
|
25
25
|
"license": "ISC",
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@google-cloud/vertexai": "^1.12.0",
|
|
28
27
|
"@google/genai": "^2.7.0",
|
|
29
28
|
"ansi-escapes": "^7.3.0",
|
|
30
29
|
"axios": "^1.7.2",
|