vigthoria-cli 1.10.47 → 1.10.48

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.
Files changed (55) hide show
  1. package/dist/commands/auth.js +51 -68
  2. package/dist/commands/bridge.js +12 -19
  3. package/dist/commands/cancel.js +15 -22
  4. package/dist/commands/chat.d.ts +28 -0
  5. package/dist/commands/config.js +33 -73
  6. package/dist/commands/deploy.js +83 -123
  7. package/dist/commands/device.js +21 -61
  8. package/dist/commands/edit.js +32 -39
  9. package/dist/commands/explain.js +18 -25
  10. package/dist/commands/fork.d.ts +17 -0
  11. package/dist/commands/fork.js +164 -0
  12. package/dist/commands/generate.js +37 -44
  13. package/dist/commands/history.d.ts +17 -0
  14. package/dist/commands/history.js +113 -0
  15. package/dist/commands/hub.js +95 -102
  16. package/dist/commands/index.js +41 -46
  17. package/dist/commands/legion.js +146 -186
  18. package/dist/commands/preview.d.ts +55 -0
  19. package/dist/commands/preview.js +467 -0
  20. package/dist/commands/replay.d.ts +18 -0
  21. package/dist/commands/replay.js +156 -0
  22. package/dist/commands/repo.d.ts +97 -0
  23. package/dist/commands/repo.js +773 -0
  24. package/dist/commands/review.js +29 -36
  25. package/dist/commands/security.js +5 -12
  26. package/dist/commands/update.d.ts +9 -0
  27. package/dist/commands/update.js +201 -0
  28. package/dist/commands/wallet.js +28 -35
  29. package/dist/commands/workflow.js +13 -20
  30. package/dist/index.d.ts +21 -0
  31. package/dist/index.js +1826 -0
  32. package/dist/utils/api.d.ts +572 -0
  33. package/dist/utils/api.js +6629 -0
  34. package/dist/utils/brain-hub-client.js +1 -5
  35. package/dist/utils/bridge-client.js +11 -52
  36. package/dist/utils/cli-state.d.ts +54 -0
  37. package/dist/utils/cli-state.js +185 -0
  38. package/dist/utils/codebase-indexer.js +4 -41
  39. package/dist/utils/config.d.ts +85 -0
  40. package/dist/utils/config.js +267 -0
  41. package/dist/utils/context-ranker.js +15 -21
  42. package/dist/utils/files.js +5 -42
  43. package/dist/utils/logger.js +42 -50
  44. package/dist/utils/persona.js +3 -8
  45. package/dist/utils/post-write-validator.js +22 -29
  46. package/dist/utils/project-memory.js +16 -23
  47. package/dist/utils/session.d.ts +118 -0
  48. package/dist/utils/session.js +423 -0
  49. package/dist/utils/task-display.js +13 -20
  50. package/dist/utils/tools.d.ts +276 -0
  51. package/dist/utils/tools.js +3522 -0
  52. package/dist/utils/workspace-brain-service.js +8 -45
  53. package/dist/utils/workspace-cache.js +18 -26
  54. package/dist/utils/workspace-stream.js +21 -63
  55. package/package.json +1 -1
@@ -1,46 +1,10 @@
1
- "use strict";
2
1
  /**
3
2
  * Workspace Brain — local codebase index + Brain Hub sync for CLI.
4
3
  */
5
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
- if (k2 === undefined) k2 = k;
7
- var desc = Object.getOwnPropertyDescriptor(m, k);
8
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
- desc = { enumerable: true, get: function() { return m[k]; } };
10
- }
11
- Object.defineProperty(o, k2, desc);
12
- }) : (function(o, m, k, k2) {
13
- if (k2 === undefined) k2 = k;
14
- o[k2] = m[k];
15
- }));
16
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17
- Object.defineProperty(o, "default", { enumerable: true, value: v });
18
- }) : function(o, v) {
19
- o["default"] = v;
20
- });
21
- var __importStar = (this && this.__importStar) || (function () {
22
- var ownKeys = function(o) {
23
- ownKeys = Object.getOwnPropertyNames || function (o) {
24
- var ar = [];
25
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
26
- return ar;
27
- };
28
- return ownKeys(o);
29
- };
30
- return function (mod) {
31
- if (mod && mod.__esModule) return mod;
32
- var result = {};
33
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
34
- __setModuleDefault(result, mod);
35
- return result;
36
- };
37
- })();
38
- Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.WorkspaceBrainService = void 0;
40
- const path = __importStar(require("path"));
41
- const brain_hub_client_js_1 = require("./brain-hub-client.js");
42
- const codebase_indexer_js_1 = require("./codebase-indexer.js");
43
- class WorkspaceBrainService {
4
+ import * as path from 'path';
5
+ import { BrainHubClient } from './brain-hub-client.js';
6
+ import { CodebaseIndexer } from './codebase-indexer.js';
7
+ export class WorkspaceBrainService {
44
8
  workspacePath;
45
9
  indexer;
46
10
  brainClient;
@@ -49,8 +13,8 @@ class WorkspaceBrainService {
49
13
  accountContextCache = null;
50
14
  constructor(options) {
51
15
  this.workspacePath = path.resolve(options.workspacePath);
52
- this.indexer = new codebase_indexer_js_1.CodebaseIndexer(this.workspacePath);
53
- this.brainClient = new brain_hub_client_js_1.BrainHubClient({
16
+ this.indexer = new CodebaseIndexer(this.workspacePath);
17
+ this.brainClient = new BrainHubClient({
54
18
  apiBase: options.apiBase,
55
19
  getAuthToken: options.getAuthToken,
56
20
  });
@@ -67,7 +31,7 @@ class WorkspaceBrainService {
67
31
  indexedFileCount: status.indexedFileCount,
68
32
  totalChunks: status.totalChunks,
69
33
  isIndexing: status.isIndexing,
70
- meta: codebase_indexer_js_1.CodebaseIndexer.loadMeta(this.workspacePath),
34
+ meta: CodebaseIndexer.loadMeta(this.workspacePath),
71
35
  };
72
36
  }
73
37
  async ensureIndexed(options = {}) {
@@ -77,7 +41,7 @@ class WorkspaceBrainService {
77
41
  return { indexed: true, fileCount: meta.indexedFileCount, chunkCount: meta.totalChunks };
78
42
  }
79
43
  if (this.indexer.hasLocalIndex()) {
80
- const meta = codebase_indexer_js_1.CodebaseIndexer.loadMeta(this.workspacePath);
44
+ const meta = CodebaseIndexer.loadMeta(this.workspacePath);
81
45
  return {
82
46
  indexed: true,
83
47
  fileCount: meta?.indexedFileCount || this.indexer.getStatus().indexedFileCount,
@@ -155,4 +119,3 @@ class WorkspaceBrainService {
155
119
  }).catch(() => undefined);
156
120
  }
157
121
  }
158
- exports.WorkspaceBrainService = WorkspaceBrainService;
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  /**
3
2
  * Vigthoria CLI — Workspace Hash Cache
4
3
  *
@@ -7,24 +6,17 @@
7
6
  * - Changed/new files → sent first (highest budget priority)
8
7
  * - Unchanged files → sent last (trimmed by budget if token limit reached)
9
8
  */
10
- var __importDefault = (this && this.__importDefault) || function (mod) {
11
- return (mod && mod.__esModule) ? mod : { "default": mod };
12
- };
13
- Object.defineProperty(exports, "__esModule", { value: true });
14
- exports.getChangedFiles = getChangedFiles;
15
- exports.updateWorkspaceCache = updateWorkspaceCache;
16
- exports.summarizeChanges = summarizeChanges;
17
- const node_crypto_1 = require("node:crypto");
18
- const node_fs_1 = __importDefault(require("node:fs"));
19
- const node_path_1 = __importDefault(require("node:path"));
9
+ import { createHash } from 'node:crypto';
10
+ import fs from 'node:fs';
11
+ import path from 'node:path';
20
12
  const CACHE_SUBDIR = '.vigthoria';
21
13
  const CACHE_FILENAME = 'file-hashes.json';
22
14
  function getCachePath(workspacePath) {
23
- return node_path_1.default.join(workspacePath, CACHE_SUBDIR, CACHE_FILENAME);
15
+ return path.join(workspacePath, CACHE_SUBDIR, CACHE_FILENAME);
24
16
  }
25
17
  function hashFile(absPath) {
26
18
  try {
27
- return (0, node_crypto_1.createHash)('sha256').update(node_fs_1.default.readFileSync(absPath)).digest('hex');
19
+ return createHash('sha256').update(fs.readFileSync(absPath)).digest('hex');
28
20
  }
29
21
  catch {
30
22
  return '';
@@ -32,7 +24,7 @@ function hashFile(absPath) {
32
24
  }
33
25
  function loadCache(workspacePath) {
34
26
  try {
35
- return JSON.parse(node_fs_1.default.readFileSync(getCachePath(workspacePath), 'utf-8'));
27
+ return JSON.parse(fs.readFileSync(getCachePath(workspacePath), 'utf-8'));
36
28
  }
37
29
  catch {
38
30
  return {};
@@ -40,10 +32,10 @@ function loadCache(workspacePath) {
40
32
  }
41
33
  function persistCache(workspacePath, hashes) {
42
34
  try {
43
- const cacheDir = node_path_1.default.join(workspacePath, CACHE_SUBDIR);
44
- if (!node_fs_1.default.existsSync(cacheDir))
45
- node_fs_1.default.mkdirSync(cacheDir, { recursive: true });
46
- node_fs_1.default.writeFileSync(getCachePath(workspacePath), JSON.stringify(hashes, null, 2), 'utf-8');
35
+ const cacheDir = path.join(workspacePath, CACHE_SUBDIR);
36
+ if (!fs.existsSync(cacheDir))
37
+ fs.mkdirSync(cacheDir, { recursive: true });
38
+ fs.writeFileSync(getCachePath(workspacePath), JSON.stringify(hashes, null, 2), 'utf-8');
47
39
  }
48
40
  catch { /* non-fatal */ }
49
41
  }
@@ -53,13 +45,13 @@ function persistCache(workspacePath, hashes) {
53
45
  * @param workspacePath Absolute project root.
54
46
  * @param relativePaths Workspace-relative (or absolute) file paths to check.
55
47
  */
56
- function getChangedFiles(workspacePath, relativePaths) {
48
+ export function getChangedFiles(workspacePath, relativePaths) {
57
49
  const cache = loadCache(workspacePath);
58
50
  const changed = [];
59
51
  const unchanged = [];
60
52
  for (const rel of relativePaths) {
61
- const abs = node_path_1.default.isAbsolute(rel) ? rel : node_path_1.default.join(workspacePath, rel);
62
- const key = node_path_1.default.relative(workspacePath, abs).replace(/\\/g, '/');
53
+ const abs = path.isAbsolute(rel) ? rel : path.join(workspacePath, rel);
54
+ const key = path.relative(workspacePath, abs).replace(/\\/g, '/');
63
55
  const currentHash = hashFile(abs);
64
56
  if (!currentHash || cache[key] !== currentHash) {
65
57
  changed.push(rel);
@@ -74,13 +66,13 @@ function getChangedFiles(workspacePath, relativePaths) {
74
66
  * Write current hashes for the given files into the persistent cache.
75
67
  * Call this after an agent run completes successfully.
76
68
  */
77
- function updateWorkspaceCache(workspacePath, relativePaths) {
78
- if (!workspacePath || !node_fs_1.default.existsSync(workspacePath))
69
+ export function updateWorkspaceCache(workspacePath, relativePaths) {
70
+ if (!workspacePath || !fs.existsSync(workspacePath))
79
71
  return;
80
72
  const cache = loadCache(workspacePath);
81
73
  for (const rel of relativePaths) {
82
- const abs = node_path_1.default.isAbsolute(rel) ? rel : node_path_1.default.join(workspacePath, rel);
83
- const key = node_path_1.default.relative(workspacePath, abs).replace(/\\/g, '/');
74
+ const abs = path.isAbsolute(rel) ? rel : path.join(workspacePath, rel);
75
+ const key = path.relative(workspacePath, abs).replace(/\\/g, '/');
84
76
  const hash = hashFile(abs);
85
77
  if (hash)
86
78
  cache[key] = hash;
@@ -90,7 +82,7 @@ function updateWorkspaceCache(workspacePath, relativePaths) {
90
82
  /**
91
83
  * Return a human-readable summary of changes since last cache update.
92
84
  */
93
- function summarizeChanges(workspacePath, relativePaths) {
85
+ export function summarizeChanges(workspacePath, relativePaths) {
94
86
  const { changed, unchanged, total } = getChangedFiles(workspacePath, relativePaths);
95
87
  return `${changed.length} changed, ${unchanged.length} unchanged of ${total} files tracked`;
96
88
  }
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  /**
3
2
  * Workspace Stream — Real-time bidirectional file sync between CLI and V3.
4
3
  *
@@ -18,51 +17,12 @@
18
17
  * {"type": "file_sync", "path": "rel/path", "content": "...", "action": "write"|"delete"}
19
18
  * {"type": "file_batch", "files": [{path, content}, ...]}
20
19
  */
21
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
22
- if (k2 === undefined) k2 = k;
23
- var desc = Object.getOwnPropertyDescriptor(m, k);
24
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
25
- desc = { enumerable: true, get: function() { return m[k]; } };
26
- }
27
- Object.defineProperty(o, k2, desc);
28
- }) : (function(o, m, k, k2) {
29
- if (k2 === undefined) k2 = k;
30
- o[k2] = m[k];
31
- }));
32
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
33
- Object.defineProperty(o, "default", { enumerable: true, value: v });
34
- }) : function(o, v) {
35
- o["default"] = v;
36
- });
37
- var __importStar = (this && this.__importStar) || (function () {
38
- var ownKeys = function(o) {
39
- ownKeys = Object.getOwnPropertyNames || function (o) {
40
- var ar = [];
41
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
42
- return ar;
43
- };
44
- return ownKeys(o);
45
- };
46
- return function (mod) {
47
- if (mod && mod.__esModule) return mod;
48
- var result = {};
49
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
50
- __setModuleDefault(result, mod);
51
- return result;
52
- };
53
- })();
54
- var __importDefault = (this && this.__importDefault) || function (mod) {
55
- return (mod && mod.__esModule) ? mod : { "default": mod };
56
- };
57
- Object.defineProperty(exports, "__esModule", { value: true });
58
- exports.WorkspaceWSClient = exports.WorkspaceWatcher = void 0;
59
- exports.applyFileMutation = applyFileMutation;
60
- const chokidar = __importStar(require("chokidar"));
61
- const fs_1 = __importDefault(require("fs"));
62
- const path_1 = __importDefault(require("path"));
63
- const ws_1 = __importDefault(require("ws"));
64
- const logger_js_1 = require("./logger.js");
65
- const logger = new logger_js_1.Logger();
20
+ import * as chokidar from 'chokidar';
21
+ import fs from 'fs';
22
+ import path from 'path';
23
+ import WebSocket from 'ws';
24
+ import { Logger } from './logger.js';
25
+ const logger = new Logger();
66
26
  logger.setVerbose(!!process.env.VIGTHORIA_DEBUG);
67
27
  // Files/dirs to ignore in the watcher
68
28
  const IGNORE_PATTERNS = [
@@ -109,27 +69,27 @@ const _v3MuteTimeout = 2000; // 2s mute window after V3 writes a file
109
69
  * Apply a file_mutation event from V3's SSE stream to the local workspace.
110
70
  * Call this from the SSE event handler for real-time file application.
111
71
  */
112
- function applyFileMutation(event, workspaceRoot) {
72
+ export function applyFileMutation(event, workspaceRoot) {
113
73
  if (event.type !== 'file_mutation')
114
74
  return false;
115
75
  if (!event.path || !workspaceRoot)
116
76
  return false;
117
- const absPath = path_1.default.resolve(workspaceRoot, event.path);
77
+ const absPath = path.resolve(workspaceRoot, event.path);
118
78
  // Safety: ensure the resolved path is within the workspace
119
- if (!absPath.startsWith(path_1.default.resolve(workspaceRoot) + path_1.default.sep) && absPath !== path_1.default.resolve(workspaceRoot)) {
79
+ if (!absPath.startsWith(path.resolve(workspaceRoot) + path.sep) && absPath !== path.resolve(workspaceRoot)) {
120
80
  logger.warn(`Refusing to apply mutation outside workspace: ${event.path}`);
121
81
  return false;
122
82
  }
123
83
  try {
124
84
  if (event.action === 'delete') {
125
- if (fs_1.default.existsSync(absPath)) {
126
- fs_1.default.unlinkSync(absPath);
85
+ if (fs.existsSync(absPath)) {
86
+ fs.unlinkSync(absPath);
127
87
  logger.debug(`Deleted: ${event.path}`);
128
88
  }
129
89
  }
130
90
  else if (typeof event.content === 'string') {
131
- fs_1.default.mkdirSync(path_1.default.dirname(absPath), { recursive: true });
132
- fs_1.default.writeFileSync(absPath, event.content, 'utf8');
91
+ fs.mkdirSync(path.dirname(absPath), { recursive: true });
92
+ fs.writeFileSync(absPath, event.content, 'utf8');
133
93
  // Mute the watcher for this file to prevent echo
134
94
  _v3MutatedFiles.add(absPath);
135
95
  setTimeout(() => _v3MutatedFiles.delete(absPath), _v3MuteTimeout);
@@ -142,13 +102,13 @@ function applyFileMutation(event, workspaceRoot) {
142
102
  return false;
143
103
  }
144
104
  }
145
- class WorkspaceWatcher {
105
+ export class WorkspaceWatcher {
146
106
  watcher = null;
147
107
  workspaceRoot;
148
108
  onFileChange;
149
109
  _ready = false;
150
110
  constructor(options) {
151
- this.workspaceRoot = path_1.default.resolve(options.workspaceRoot);
111
+ this.workspaceRoot = path.resolve(options.workspaceRoot);
152
112
  this.onFileChange = options.onFileChange;
153
113
  }
154
114
  start() {
@@ -213,10 +173,10 @@ class WorkspaceWatcher {
213
173
  // Skip if this file was just written by V3 (echo prevention)
214
174
  if (_v3MutatedFiles.has(filePath))
215
175
  return;
216
- const ext = path_1.default.extname(filePath).toLowerCase();
176
+ const ext = path.extname(filePath).toLowerCase();
217
177
  if (BINARY_EXTENSIONS.has(ext))
218
178
  return;
219
- const relativePath = path_1.default.relative(this.workspaceRoot, filePath);
179
+ const relativePath = path.relative(this.workspaceRoot, filePath);
220
180
  if (relativePath.startsWith('..'))
221
181
  return; // safety
222
182
  if (action === 'delete') {
@@ -224,10 +184,10 @@ class WorkspaceWatcher {
224
184
  return;
225
185
  }
226
186
  try {
227
- const stat = fs_1.default.statSync(filePath);
187
+ const stat = fs.statSync(filePath);
228
188
  if (stat.size > MAX_SYNC_FILE_BYTES)
229
189
  return;
230
- const content = fs_1.default.readFileSync(filePath, 'utf8');
190
+ const content = fs.readFileSync(filePath, 'utf8');
231
191
  this.onFileChange?.(relativePath, content, 'write');
232
192
  }
233
193
  catch {
@@ -235,8 +195,7 @@ class WorkspaceWatcher {
235
195
  }
236
196
  }
237
197
  }
238
- exports.WorkspaceWatcher = WorkspaceWatcher;
239
- class WorkspaceWSClient {
198
+ export class WorkspaceWSClient {
240
199
  ws = null;
241
200
  opts;
242
201
  reconnectTimer = null;
@@ -250,7 +209,7 @@ class WorkspaceWSClient {
250
209
  if (this.ws)
251
210
  return;
252
211
  const url = `${this.opts.serverUrl}/ws/workspace`;
253
- this.ws = new ws_1.default(url);
212
+ this.ws = new WebSocket(url);
254
213
  this.ws.on('open', () => {
255
214
  this._connected = true;
256
215
  this._send({
@@ -343,4 +302,3 @@ class WorkspaceWSClient {
343
302
  }
344
303
  }
345
304
  }
346
- exports.WorkspaceWSClient = WorkspaceWSClient;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vigthoria-cli",
3
- "version": "1.10.47",
3
+ "version": "1.10.48",
4
4
  "description": "Vigthoria Coder CLI - AI-powered terminal coding assistant",
5
5
  "main": "dist/index.js",
6
6
  "files": [