vigthoria-cli 1.6.1 → 1.6.4
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/README.md +52 -1
- package/dist/commands/chat.d.ts +31 -45
- package/dist/commands/chat.d.ts.map +1 -1
- package/dist/commands/chat.js +374 -855
- package/dist/commands/chat.js.map +1 -1
- package/dist/commands/repo.d.ts +10 -0
- package/dist/commands/repo.d.ts.map +1 -1
- package/dist/commands/repo.js +215 -97
- package/dist/commands/repo.js.map +1 -1
- package/dist/index.js +32 -4
- package/dist/index.js.map +1 -1
- package/dist/utils/api.d.ts +8 -0
- package/dist/utils/api.d.ts.map +1 -1
- package/dist/utils/api.js +183 -42
- package/dist/utils/api.js.map +1 -1
- package/dist/utils/config.d.ts.map +1 -1
- package/dist/utils/config.js +2 -1
- package/dist/utils/config.js.map +1 -1
- package/dist/utils/tools.d.ts +3 -0
- package/dist/utils/tools.d.ts.map +1 -1
- package/dist/utils/tools.js +252 -14
- package/dist/utils/tools.js.map +1 -1
- package/package.json +13 -2
- package/install.ps1 +0 -290
- package/install.sh +0 -307
- package/src/commands/auth.ts +0 -226
- package/src/commands/chat.ts +0 -1101
- package/src/commands/config.ts +0 -306
- package/src/commands/deploy.ts +0 -609
- package/src/commands/edit.ts +0 -310
- package/src/commands/explain.ts +0 -115
- package/src/commands/generate.ts +0 -222
- package/src/commands/hub.ts +0 -382
- package/src/commands/repo.ts +0 -742
- package/src/commands/review.ts +0 -186
- package/src/index.ts +0 -601
- package/src/types/marked-terminal.d.ts +0 -31
- package/src/utils/api.ts +0 -526
- package/src/utils/config.ts +0 -241
- package/src/utils/files.ts +0 -273
- package/src/utils/logger.ts +0 -130
- package/src/utils/session.ts +0 -179
- package/src/utils/tools.ts +0 -1964
- package/test-parse.js +0 -105
- package/test-parse2.js +0 -35
- package/tsconfig.json +0 -20
package/test-parse.js
DELETED
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
const { AgenticTools } = require("./dist/utils/tools.js");
|
|
2
|
-
|
|
3
|
-
// Test with multi-line write_file content - matching what AI actually outputs
|
|
4
|
-
const text = `Here is the code I created:
|
|
5
|
-
|
|
6
|
-
{"tool": "write_file", "args": {"path": "test.jsx", "content": "import React from 'react';
|
|
7
|
-
|
|
8
|
-
export function Test() {
|
|
9
|
-
return <div>Hello</div>;
|
|
10
|
-
}"}}
|
|
11
|
-
|
|
12
|
-
And then:
|
|
13
|
-
{"tool": "bash", "args": {"command": "npm test"}}
|
|
14
|
-
`;
|
|
15
|
-
|
|
16
|
-
console.log("Input text:");
|
|
17
|
-
console.log(text);
|
|
18
|
-
console.log("\n" + "=".repeat(50) + "\n");
|
|
19
|
-
|
|
20
|
-
// Debug: test the balanced extractor directly
|
|
21
|
-
function extractBalancedJson(str, startIdx) {
|
|
22
|
-
if (str[startIdx] !== '{') return null;
|
|
23
|
-
let braceCount = 0;
|
|
24
|
-
let inString = false;
|
|
25
|
-
let escapeNext = false;
|
|
26
|
-
|
|
27
|
-
for (let i = startIdx; i < str.length; i++) {
|
|
28
|
-
const char = str[i];
|
|
29
|
-
|
|
30
|
-
if (escapeNext) {
|
|
31
|
-
escapeNext = false;
|
|
32
|
-
continue;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
if (char === '\\') {
|
|
36
|
-
escapeNext = true;
|
|
37
|
-
continue;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
if (char === '"') {
|
|
41
|
-
inString = !inString;
|
|
42
|
-
continue;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
if (!inString) {
|
|
46
|
-
if (char === '{') braceCount++;
|
|
47
|
-
else if (char === '}') {
|
|
48
|
-
braceCount--;
|
|
49
|
-
if (braceCount === 0) {
|
|
50
|
-
return str.substring(startIdx, i + 1);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
return null;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
function fixJson(jsonStr) {
|
|
59
|
-
return jsonStr
|
|
60
|
-
.replace(/'/g, '"')
|
|
61
|
-
.replace(/([{,]\s*)(\w+):/g, '$1"$2":')
|
|
62
|
-
.replace(/:\s*'([^']*)'\s*([,}])/g, ': "$1"$2')
|
|
63
|
-
.replace(/\n/g, '\\n')
|
|
64
|
-
.replace(/\r/g, '')
|
|
65
|
-
.replace(/\t/g, '\\t')
|
|
66
|
-
.replace(/,\s*}/g, '}')
|
|
67
|
-
.replace(/,\s*]/g, ']');
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
// Find the write_file call
|
|
71
|
-
const regex = /\{"tool"\s*:/g;
|
|
72
|
-
let match;
|
|
73
|
-
while ((match = regex.exec(text)) !== null) {
|
|
74
|
-
const extracted = extractBalancedJson(text, match.index);
|
|
75
|
-
if (extracted && extracted.includes("write_file")) {
|
|
76
|
-
console.log("Extracted write_file JSON:");
|
|
77
|
-
console.log(extracted);
|
|
78
|
-
console.log("\n--- After fixJson: ---");
|
|
79
|
-
const fixed = fixJson(extracted);
|
|
80
|
-
console.log(fixed);
|
|
81
|
-
console.log("\n--- Trying to parse: ---");
|
|
82
|
-
try {
|
|
83
|
-
const parsed = JSON.parse(fixed);
|
|
84
|
-
console.log("SUCCESS:", parsed.tool);
|
|
85
|
-
} catch (e) {
|
|
86
|
-
console.log("FAILED:", e.message);
|
|
87
|
-
|
|
88
|
-
// Try aggressive fix
|
|
89
|
-
console.log("\n--- Aggressive fix: ---");
|
|
90
|
-
const aggressive = extracted
|
|
91
|
-
.replace(/[\x00-\x1F]/g, (c) => '\\u' + c.charCodeAt(0).toString(16).padStart(4, '0'))
|
|
92
|
-
.replace(/'/g, '"');
|
|
93
|
-
console.log(aggressive.substring(0, 200));
|
|
94
|
-
try {
|
|
95
|
-
const parsed2 = JSON.parse(aggressive);
|
|
96
|
-
console.log("AGGRESSIVE SUCCESS:", parsed2.tool);
|
|
97
|
-
} catch (e2) {
|
|
98
|
-
console.log("AGGRESSIVE FAILED:", e2.message);
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
const calls = AgenticTools.parseToolCalls(text);
|
|
105
|
-
console.log("\n\nFinal result:", calls.length, "tool calls found");
|
package/test-parse2.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
const { AgenticTools } = require("./dist/utils/tools.js");
|
|
2
|
-
|
|
3
|
-
// Test with complex multi-line content
|
|
4
|
-
const text = `Here is the code:
|
|
5
|
-
|
|
6
|
-
{"tool": "write_file", "args": {"path": "src/App.jsx", "content": "import React from 'react';
|
|
7
|
-
|
|
8
|
-
function App() {
|
|
9
|
-
const [count, setCount] = useState(0);
|
|
10
|
-
|
|
11
|
-
return (
|
|
12
|
-
<div>
|
|
13
|
-
<h1>Hello World</h1>
|
|
14
|
-
<button onClick={() => setCount(c => c + 1)}>
|
|
15
|
-
Count: {count}
|
|
16
|
-
</button>
|
|
17
|
-
</div>
|
|
18
|
-
);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export default App;"}}
|
|
22
|
-
|
|
23
|
-
And run:
|
|
24
|
-
{"tool": "bash", "args": {"command": "npm run dev"}}
|
|
25
|
-
`;
|
|
26
|
-
|
|
27
|
-
const calls = AgenticTools.parseToolCalls(text);
|
|
28
|
-
console.log("Found", calls.length, "tool calls:");
|
|
29
|
-
for (const call of calls) {
|
|
30
|
-
console.log("\n Tool:", call.tool);
|
|
31
|
-
console.log(" Path:", call.args.path || call.args.command);
|
|
32
|
-
if (call.args.content) {
|
|
33
|
-
console.log(" Content preview:", call.args.content.substring(0, 80) + "...");
|
|
34
|
-
}
|
|
35
|
-
}
|
package/tsconfig.json
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ES2022",
|
|
4
|
-
"module": "NodeNext",
|
|
5
|
-
"moduleResolution": "NodeNext",
|
|
6
|
-
"lib": ["ES2022"],
|
|
7
|
-
"outDir": "./dist",
|
|
8
|
-
"rootDir": "./src",
|
|
9
|
-
"strict": true,
|
|
10
|
-
"esModuleInterop": true,
|
|
11
|
-
"skipLibCheck": true,
|
|
12
|
-
"forceConsistentCasingInFileNames": true,
|
|
13
|
-
"resolveJsonModule": true,
|
|
14
|
-
"declaration": true,
|
|
15
|
-
"declarationMap": true,
|
|
16
|
-
"sourceMap": true
|
|
17
|
-
},
|
|
18
|
-
"include": ["src/**/*"],
|
|
19
|
-
"exclude": ["node_modules", "dist"]
|
|
20
|
-
}
|