vigthoria-cli 1.6.9 → 1.6.13
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 +1 -1
- package/dist/commands/chat.d.ts +32 -2
- package/dist/commands/chat.js +666 -49
- package/dist/index.js +21 -9
- package/dist/utils/api.d.ts +12 -1
- package/dist/utils/api.js +966 -62
- package/dist/utils/config.d.ts +1 -0
- package/dist/utils/config.js +7 -1
- package/dist/utils/tools.js +33 -6
- package/package.json +3 -2
package/dist/utils/config.d.ts
CHANGED
package/dist/utils/config.js
CHANGED
|
@@ -23,7 +23,7 @@ const defaultConfig = {
|
|
|
23
23
|
expiresAt: null,
|
|
24
24
|
},
|
|
25
25
|
preferences: {
|
|
26
|
-
defaultModel: '
|
|
26
|
+
defaultModel: 'code',
|
|
27
27
|
theme: 'dark',
|
|
28
28
|
autoApplyFixes: false,
|
|
29
29
|
showDiffs: true,
|
|
@@ -193,8 +193,14 @@ class Config {
|
|
|
193
193
|
/all files/i, /whole.*codebase/i, /implement.*feature/i,
|
|
194
194
|
/create.*system/i, /build.*from.*scratch/i,
|
|
195
195
|
/analyze.*project/i, /review.*codebase/i,
|
|
196
|
+
/audit.*project/i, /audit.*workspace/i,
|
|
197
|
+
/full overview/i, /analyse.*workspace/i,
|
|
198
|
+
/analy[sz]e.*entire/i, /deep audit/i,
|
|
196
199
|
];
|
|
197
200
|
return complexIndicators.some(pattern => pattern.test(prompt));
|
|
198
201
|
}
|
|
202
|
+
shouldUseCloudForHeavyTask(prompt) {
|
|
203
|
+
return this.hasOperatorAccess() && this.hasCloudAccess() && this.isComplexTask(prompt);
|
|
204
|
+
}
|
|
199
205
|
}
|
|
200
206
|
exports.Config = Config;
|
package/dist/utils/tools.js
CHANGED
|
@@ -781,7 +781,8 @@ class AgenticTools {
|
|
|
781
781
|
const placeholderPatterns = [
|
|
782
782
|
/\.\.\.\s*(rest|more)/i,
|
|
783
783
|
/implementation goes here/i,
|
|
784
|
-
/placeholder/i,
|
|
784
|
+
/replace (?:this|the) placeholder/i,
|
|
785
|
+
/placeholder (?:text|content|copy|image)/i,
|
|
785
786
|
/todo:/i,
|
|
786
787
|
/all the .* from earlier/i,
|
|
787
788
|
];
|
|
@@ -1547,21 +1548,47 @@ class AgenticTools {
|
|
|
1547
1548
|
* SECURITY: All paths MUST stay within the workspace (cwd)
|
|
1548
1549
|
*/
|
|
1549
1550
|
resolvePath(p) {
|
|
1551
|
+
const normalizedInput = String(p || '').trim().replace(/\\/g, '/');
|
|
1552
|
+
const workspaceRoot = path.normalize(this.cwd);
|
|
1553
|
+
const workspaceRootPosix = workspaceRoot.replace(/\\/g, '/').replace(/\/+$/g, '');
|
|
1554
|
+
const workspaceBase = path.posix.basename(workspaceRootPosix);
|
|
1555
|
+
const stripWorkspacePrefix = (value) => {
|
|
1556
|
+
let candidate = String(value || '').trim().replace(/\\/g, '/').replace(/^\.\//, '');
|
|
1557
|
+
if (!candidate) {
|
|
1558
|
+
return candidate;
|
|
1559
|
+
}
|
|
1560
|
+
const normalizedRootNoSlash = workspaceRootPosix.replace(/^\//, '');
|
|
1561
|
+
const prefixes = [
|
|
1562
|
+
`${workspaceRootPosix}/`,
|
|
1563
|
+
`${normalizedRootNoSlash}/`,
|
|
1564
|
+
`${workspaceBase}/`,
|
|
1565
|
+
];
|
|
1566
|
+
for (const prefix of prefixes) {
|
|
1567
|
+
if (candidate.startsWith(prefix)) {
|
|
1568
|
+
candidate = candidate.slice(prefix.length);
|
|
1569
|
+
}
|
|
1570
|
+
}
|
|
1571
|
+
const embeddedWorkspacePrefix = `/${workspaceBase}/`;
|
|
1572
|
+
const embeddedIndex = candidate.indexOf(embeddedWorkspacePrefix);
|
|
1573
|
+
if (embeddedIndex >= 0) {
|
|
1574
|
+
candidate = candidate.slice(embeddedIndex + embeddedWorkspacePrefix.length);
|
|
1575
|
+
}
|
|
1576
|
+
return candidate.replace(/^\//, '');
|
|
1577
|
+
};
|
|
1550
1578
|
// Resolve the full path (handles both relative and absolute)
|
|
1551
1579
|
let resolvedPath;
|
|
1552
|
-
if (path.isAbsolute(
|
|
1553
|
-
resolvedPath = path.normalize(
|
|
1580
|
+
if (path.isAbsolute(normalizedInput)) {
|
|
1581
|
+
resolvedPath = path.normalize(normalizedInput);
|
|
1554
1582
|
}
|
|
1555
1583
|
else {
|
|
1556
|
-
resolvedPath = path.normalize(path.join(this.cwd,
|
|
1584
|
+
resolvedPath = path.normalize(path.join(this.cwd, stripWorkspacePrefix(normalizedInput)));
|
|
1557
1585
|
}
|
|
1558
1586
|
// SECURITY CHECK: Ensure path is within workspace
|
|
1559
|
-
const workspaceRoot = path.normalize(this.cwd);
|
|
1560
1587
|
if (!resolvedPath.startsWith(workspaceRoot + path.sep) && resolvedPath !== workspaceRoot) {
|
|
1561
1588
|
// Path is outside workspace - force it back to workspace
|
|
1562
1589
|
this.logger.warn(`Security: Blocked access to path outside workspace: ${p}`);
|
|
1563
1590
|
// Return the sanitized relative path within workspace
|
|
1564
|
-
const basename = path.basename(
|
|
1591
|
+
const basename = path.basename(stripWorkspacePrefix(normalizedInput) || normalizedInput);
|
|
1565
1592
|
return path.join(this.cwd, basename);
|
|
1566
1593
|
}
|
|
1567
1594
|
return resolvedPath;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vigthoria-cli",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.13",
|
|
4
4
|
"description": "Vigthoria Coder CLI - AI-powered terminal coding assistant",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"files": [
|
|
@@ -16,12 +16,13 @@
|
|
|
16
16
|
},
|
|
17
17
|
"scripts": {
|
|
18
18
|
"clean": "node -e \"require('fs').rmSync('dist', { recursive: true, force: true })\"",
|
|
19
|
-
"build": "npm run clean && tsc",
|
|
19
|
+
"build": "npm run clean && tsc && node -e \"const fs=require('fs'); try { fs.chmodSync('dist/index.js', 0o755); } catch (error) { if (!error || error.code !== 'ENOENT') throw error; }\"",
|
|
20
20
|
"start": "node dist/index.js",
|
|
21
21
|
"dev": "ts-node src/index.ts",
|
|
22
22
|
"test": "npm run test:cli",
|
|
23
23
|
"test:cli": "npm run build && node scripts/test-cli-suite.js",
|
|
24
24
|
"test:agent:smoke": "npm run build && node scripts/test-agent-smoke.js",
|
|
25
|
+
"test:agent:routing": "npm run build && node scripts/test-agent-routing-policy.js",
|
|
25
26
|
"test:agent:context": "npm run build && node scripts/test-agent-context-trace-e2e.js",
|
|
26
27
|
"test:mcp:context": "npm run build && node scripts/test-mcp-context-session-e2e.js",
|
|
27
28
|
"test:workflow:surface": "npm run build && node scripts/test-workflow-surface-e2e.js",
|