vigthoria-cli 1.10.37 → 1.10.47

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 (58) hide show
  1. package/dist/commands/agent-session-menu.d.ts +19 -0
  2. package/dist/commands/agent-session-menu.js +155 -0
  3. package/dist/commands/auth.js +68 -51
  4. package/dist/commands/bridge.js +19 -12
  5. package/dist/commands/cancel.js +22 -15
  6. package/dist/commands/chat.d.ts +0 -28
  7. package/dist/commands/chat.js +407 -1254
  8. package/dist/commands/config.js +73 -33
  9. package/dist/commands/deploy.js +123 -83
  10. package/dist/commands/device.js +61 -21
  11. package/dist/commands/edit.js +39 -32
  12. package/dist/commands/explain.js +25 -18
  13. package/dist/commands/generate.js +44 -37
  14. package/dist/commands/hub.js +102 -95
  15. package/dist/commands/index.js +46 -41
  16. package/dist/commands/legion.js +186 -146
  17. package/dist/commands/review.js +36 -29
  18. package/dist/commands/security.js +12 -5
  19. package/dist/commands/wallet.js +35 -28
  20. package/dist/commands/workflow.js +20 -13
  21. package/dist/utils/brain-hub-client.js +5 -1
  22. package/dist/utils/bridge-client.js +52 -11
  23. package/dist/utils/codebase-indexer.js +41 -4
  24. package/dist/utils/context-ranker.js +21 -15
  25. package/dist/utils/files.js +42 -5
  26. package/dist/utils/logger.js +50 -42
  27. package/dist/utils/persona.js +8 -3
  28. package/dist/utils/post-write-validator.js +29 -22
  29. package/dist/utils/project-memory.js +23 -16
  30. package/dist/utils/task-display.js +20 -13
  31. package/dist/utils/workspace-brain-service.js +45 -8
  32. package/dist/utils/workspace-cache.js +26 -18
  33. package/dist/utils/workspace-stream.js +63 -21
  34. package/package.json +3 -6
  35. package/dist/commands/fork.d.ts +0 -17
  36. package/dist/commands/fork.js +0 -164
  37. package/dist/commands/history.d.ts +0 -17
  38. package/dist/commands/history.js +0 -113
  39. package/dist/commands/preview.d.ts +0 -55
  40. package/dist/commands/preview.js +0 -467
  41. package/dist/commands/replay.d.ts +0 -18
  42. package/dist/commands/replay.js +0 -156
  43. package/dist/commands/repo.d.ts +0 -97
  44. package/dist/commands/repo.js +0 -773
  45. package/dist/commands/update.d.ts +0 -9
  46. package/dist/commands/update.js +0 -201
  47. package/dist/index.d.ts +0 -21
  48. package/dist/index.js +0 -1823
  49. package/dist/utils/api.d.ts +0 -572
  50. package/dist/utils/api.js +0 -6548
  51. package/dist/utils/cli-state.d.ts +0 -54
  52. package/dist/utils/cli-state.js +0 -185
  53. package/dist/utils/config.d.ts +0 -85
  54. package/dist/utils/config.js +0 -267
  55. package/dist/utils/session.d.ts +0 -118
  56. package/dist/utils/session.js +0 -423
  57. package/dist/utils/tools.d.ts +0 -276
  58. package/dist/utils/tools.js +0 -3516
@@ -1,13 +1,19 @@
1
+ "use strict";
1
2
  /**
2
3
  * Review Command - Code review with AI
3
4
  */
4
- import chalk from 'chalk';
5
- import { Marked } from 'marked';
6
- import { markedTerminal } from 'marked-terminal';
7
- import { createSpinner, CH } from '../utils/logger.js';
8
- import { APIClient, CLIError, classifyError, formatCLIError } from '../utils/api.js';
9
- import { FileUtils } from '../utils/files.js';
10
- export class ReviewCommand {
5
+ var __importDefault = (this && this.__importDefault) || function (mod) {
6
+ return (mod && mod.__esModule) ? mod : { "default": mod };
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.ReviewCommand = void 0;
10
+ const chalk_1 = __importDefault(require("chalk"));
11
+ const marked_1 = require("marked");
12
+ const marked_terminal_1 = require("marked-terminal");
13
+ const logger_js_1 = require("../utils/logger.js");
14
+ const api_js_1 = require("../utils/api.js");
15
+ const files_js_1 = require("../utils/files.js");
16
+ class ReviewCommand {
11
17
  config;
12
18
  logger;
13
19
  api;
@@ -16,10 +22,10 @@ export class ReviewCommand {
16
22
  constructor(config, logger) {
17
23
  this.config = config;
18
24
  this.logger = logger;
19
- this.api = new APIClient(config, logger);
20
- this.fileUtils = new FileUtils(process.cwd(), config.get('project').ignorePatterns);
21
- this.marked = new Marked();
22
- this.marked.use(markedTerminal({
25
+ this.api = new api_js_1.APIClient(config, logger);
26
+ this.fileUtils = new files_js_1.FileUtils(process.cwd(), config.get('project').ignorePatterns);
27
+ this.marked = new marked_1.Marked();
28
+ this.marked.use((0, marked_terminal_1.markedTerminal)({
23
29
  showSectionPrefix: false,
24
30
  tab: 2,
25
31
  width: 80,
@@ -45,9 +51,9 @@ export class ReviewCommand {
45
51
  return;
46
52
  }
47
53
  this.logger.section(`Reviewing: ${file.relativePath}`);
48
- console.log(chalk.gray(`Language: ${file.language} | Lines: ${file.lines}`));
54
+ console.log(chalk_1.default.gray(`Language: ${file.language} | Lines: ${file.lines}`));
49
55
  console.log();
50
- const spinner = createSpinner({
56
+ const spinner = (0, logger_js_1.createSpinner)({
51
57
  text: 'Analyzing code quality...',
52
58
  spinner: 'dots',
53
59
  }).start();
@@ -70,15 +76,15 @@ export class ReviewCommand {
70
76
  }
71
77
  catch (error) {
72
78
  spinner.stop();
73
- const cliErr = error instanceof CLIError ? error : classifyError(error);
74
- this.logger.error(formatCLIError(cliErr));
79
+ const cliErr = error instanceof api_js_1.CLIError ? error : (0, api_js_1.classifyError)(error);
80
+ this.logger.error((0, api_js_1.formatCLIError)(cliErr));
75
81
  }
76
82
  }
77
83
  printTextReview(review) {
78
84
  // Score
79
- const scoreColor = review.score >= 80 ? chalk.green : review.score >= 60 ? chalk.yellow : chalk.red;
85
+ const scoreColor = review.score >= 80 ? chalk_1.default.green : review.score >= 60 ? chalk_1.default.yellow : chalk_1.default.red;
80
86
  console.log();
81
- console.log(chalk.bold('Quality Score: ') + scoreColor(`${review.score}/100`));
87
+ console.log(chalk_1.default.bold('Quality Score: ') + scoreColor(`${review.score}/100`));
82
88
  console.log(this.renderScoreBar(review.score));
83
89
  console.log();
84
90
  // Issues
@@ -88,7 +94,7 @@ export class ReviewCommand {
88
94
  const severityIcon = this.getSeverityIcon(issue.severity);
89
95
  const severityColor = this.getSeverityColor(issue.severity);
90
96
  console.log(severityColor(`${severityIcon} [${issue.type}]`) +
91
- chalk.gray(` Line ${issue.line}:`) +
97
+ chalk_1.default.gray(` Line ${issue.line}:`) +
92
98
  ` ${issue.message}`);
93
99
  });
94
100
  console.log();
@@ -100,7 +106,7 @@ export class ReviewCommand {
100
106
  if (review.suggestions.length > 0) {
101
107
  this.logger.section('Suggestions');
102
108
  review.suggestions.forEach((suggestion, i) => {
103
- console.log(chalk.cyan(`${i + 1}.`) + ` ${suggestion}`);
109
+ console.log(chalk_1.default.cyan(`${i + 1}.`) + ` ${suggestion}`);
104
110
  });
105
111
  console.log();
106
112
  }
@@ -127,10 +133,10 @@ export class ReviewCommand {
127
133
  const width = 30;
128
134
  const filled = Math.round((score / 100) * width);
129
135
  const empty = width - filled;
130
- const color = score >= 80 ? chalk.green : score >= 60 ? chalk.yellow : chalk.red;
136
+ const color = score >= 80 ? chalk_1.default.green : score >= 60 ? chalk_1.default.yellow : chalk_1.default.red;
131
137
  const filledChar = process.platform === 'win32' ? '#' : '\u2588';
132
138
  const emptyChar = process.platform === 'win32' ? '.' : '\u2591';
133
- return color(filledChar.repeat(filled)) + chalk.gray(emptyChar.repeat(empty));
139
+ return color(filledChar.repeat(filled)) + chalk_1.default.gray(emptyChar.repeat(empty));
134
140
  }
135
141
  /**
136
142
  * Clean marked-terminal output for release-grade CLI presentation.
@@ -151,25 +157,26 @@ export class ReviewCommand {
151
157
  getSeverityIcon(severity) {
152
158
  switch (severity.toLowerCase()) {
153
159
  case 'error':
154
- return CH.error;
160
+ return logger_js_1.CH.error;
155
161
  case 'warning':
156
- return CH.warn;
162
+ return logger_js_1.CH.warn;
157
163
  case 'info':
158
- return CH.info;
164
+ return logger_js_1.CH.info;
159
165
  default:
160
- return CH.bullet;
166
+ return logger_js_1.CH.bullet;
161
167
  }
162
168
  }
163
169
  getSeverityColor(severity) {
164
170
  switch (severity.toLowerCase()) {
165
171
  case 'error':
166
- return chalk.red;
172
+ return chalk_1.default.red;
167
173
  case 'warning':
168
- return chalk.yellow;
174
+ return chalk_1.default.yellow;
169
175
  case 'info':
170
- return chalk.blue;
176
+ return chalk_1.default.blue;
171
177
  default:
172
- return chalk.white;
178
+ return chalk_1.default.white;
173
179
  }
174
180
  }
175
181
  }
182
+ exports.ReviewCommand = ReviewCommand;
@@ -1,6 +1,12 @@
1
- import axios from 'axios';
2
- import path from 'path';
3
- export class SecurityCommand {
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.SecurityCommand = void 0;
7
+ const axios_1 = __importDefault(require("axios"));
8
+ const path_1 = __importDefault(require("path"));
9
+ class SecurityCommand {
4
10
  config;
5
11
  logger;
6
12
  constructor(config, logger) {
@@ -15,11 +21,11 @@ export class SecurityCommand {
15
21
  return 'http://127.0.0.1:4008';
16
22
  }
17
23
  resolveDir(dir) {
18
- return path.resolve(dir || process.cwd());
24
+ return path_1.default.resolve(dir || process.cwd());
19
25
  }
20
26
  async execute(tool, parameters) {
21
27
  const baseUrl = this.getMcpBaseUrl();
22
- const response = await axios.post(`${baseUrl}/mcp/execute`, {
28
+ const response = await axios_1.default.post(`${baseUrl}/mcp/execute`, {
23
29
  tool,
24
30
  parameters,
25
31
  context: {
@@ -89,3 +95,4 @@ export class SecurityCommand {
89
95
  }
90
96
  }
91
97
  }
98
+ exports.SecurityCommand = SecurityCommand;
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  /**
2
3
  * wallet.ts — VigCoin wallet management for Vigthoria CLI.
3
4
  *
@@ -5,15 +6,20 @@
5
6
  * vigthoria wallet history [--n 20] — recent transactions
6
7
  * vigthoria wallet cloud-status — show cloud access and model pricing
7
8
  */
8
- import chalk from 'chalk';
9
- import { Config } from '../utils/config.js';
10
- import { Logger } from '../utils/logger.js';
11
- export class WalletCommand {
9
+ var __importDefault = (this && this.__importDefault) || function (mod) {
10
+ return (mod && mod.__esModule) ? mod : { "default": mod };
11
+ };
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.WalletCommand = void 0;
14
+ const chalk_1 = __importDefault(require("chalk"));
15
+ const config_js_1 = require("../utils/config.js");
16
+ const logger_js_1 = require("../utils/logger.js");
17
+ class WalletCommand {
12
18
  config;
13
19
  logger;
14
20
  constructor() {
15
- this.config = new Config();
16
- this.logger = new Logger();
21
+ this.config = new config_js_1.Config();
22
+ this.logger = new logger_js_1.Logger();
17
23
  }
18
24
  getBaseUrl() {
19
25
  return String(this.config.get('apiUrl') || 'https://coder.vigthoria.io').replace(/\/$/, '');
@@ -99,16 +105,16 @@ export class WalletCommand {
99
105
  return;
100
106
  }
101
107
  console.log('');
102
- console.log(chalk.bold.cyan(' VigCoin Wallet'));
103
- console.log(chalk.gray(' ─────────────────────────────'));
104
- console.log(` Balance: ${chalk.bold.yellow(data.balance.toLocaleString())} ⓥ`);
105
- console.log(` Lifetime earned: ${chalk.green(data.lifetimeEarned.toLocaleString())} ⓥ`);
106
- console.log(` Lifetime spent: ${chalk.red(data.lifetimeSpent.toLocaleString())} ⓥ`);
108
+ console.log(chalk_1.default.bold.cyan(' VigCoin Wallet'));
109
+ console.log(chalk_1.default.gray(' ─────────────────────────────'));
110
+ console.log(` Balance: ${chalk_1.default.bold.yellow(data.balance.toLocaleString())} ⓥ`);
111
+ console.log(` Lifetime earned: ${chalk_1.default.green(data.lifetimeEarned.toLocaleString())} ⓥ`);
112
+ console.log(` Lifetime spent: ${chalk_1.default.red(data.lifetimeSpent.toLocaleString())} ⓥ`);
107
113
  if (data.lastUpdated) {
108
- console.log(` Last updated: ${chalk.gray(new Date(data.lastUpdated).toLocaleString())}`);
114
+ console.log(` Last updated: ${chalk_1.default.gray(new Date(data.lastUpdated).toLocaleString())}`);
109
115
  }
110
116
  console.log('');
111
- console.log(chalk.gray(' Top up at: https://hub.vigthoria.io/credits'));
117
+ console.log(chalk_1.default.gray(' Top up at: https://hub.vigthoria.io/credits'));
112
118
  console.log('');
113
119
  }
114
120
  catch (err) {
@@ -126,17 +132,17 @@ export class WalletCommand {
126
132
  }
127
133
  const txs = data.transactions || [];
128
134
  console.log('');
129
- console.log(chalk.bold.cyan(` VigCoin Transaction History (last ${txs.length})`));
130
- console.log(chalk.gray(' ──────────────────────────────────────────────────────────'));
135
+ console.log(chalk_1.default.bold.cyan(` VigCoin Transaction History (last ${txs.length})`));
136
+ console.log(chalk_1.default.gray(' ──────────────────────────────────────────────────────────'));
131
137
  if (txs.length === 0) {
132
- console.log(chalk.gray(' No transactions found.'));
138
+ console.log(chalk_1.default.gray(' No transactions found.'));
133
139
  }
134
140
  else {
135
141
  for (const tx of txs) {
136
- const sign = tx.amount >= 0 ? chalk.green(`+${tx.amount}`) : chalk.red(String(tx.amount));
142
+ const sign = tx.amount >= 0 ? chalk_1.default.green(`+${tx.amount}`) : chalk_1.default.red(String(tx.amount));
137
143
  const date = new Date(tx.created_at).toLocaleString();
138
144
  const desc = tx.description || tx.action || tx.type;
139
- console.log(` ${chalk.gray(date)} ${sign.padStart(8)} ⓥ ${chalk.gray(`→`)} ${chalk.yellow(tx.balance_after)} ⓥ ${desc}`);
145
+ console.log(` ${chalk_1.default.gray(date)} ${sign.padStart(8)} ⓥ ${chalk_1.default.gray(`→`)} ${chalk_1.default.yellow(tx.balance_after)} ⓥ ${desc}`);
140
146
  }
141
147
  }
142
148
  console.log('');
@@ -154,32 +160,32 @@ export class WalletCommand {
154
160
  return;
155
161
  }
156
162
  console.log('');
157
- console.log(chalk.bold.cyan(' Cloud Access Status'));
158
- console.log(chalk.gray(' ─────────────────────────────'));
163
+ console.log(chalk_1.default.bold.cyan(' Cloud Access Status'));
164
+ console.log(chalk_1.default.gray(' ─────────────────────────────'));
159
165
  if (data.isMasterAdmin) {
160
- console.log(` Access: ${chalk.bold.green('Master Admin — unlimited cloud access')}`);
166
+ console.log(` Access: ${chalk_1.default.bold.green('Master Admin — unlimited cloud access')}`);
161
167
  }
162
168
  else if (data.hasGrant) {
163
169
  const models = data.grantDetails?.allowedModels === '*' ? 'All models' : data.grantDetails?.allowedModels;
164
170
  const exp = data.grantDetails?.expiresAt ? ` (expires ${new Date(data.grantDetails.expiresAt).toLocaleDateString()})` : '';
165
- console.log(` Access: ${chalk.green(`Granted — ${models}${exp}`)}`);
171
+ console.log(` Access: ${chalk_1.default.green(`Granted — ${models}${exp}`)}`);
166
172
  }
167
173
  else if (data.cloudAccessAllowed) {
168
- console.log(` Access: ${chalk.yellow('Enabled — pay per request with VigCoins')}`);
174
+ console.log(` Access: ${chalk_1.default.yellow('Enabled — pay per request with VigCoins')}`);
169
175
  }
170
176
  else {
171
- console.log(` Access: ${chalk.red('Not enabled — contact admin to request cloud access')}`);
177
+ console.log(` Access: ${chalk_1.default.red('Not enabled — contact admin to request cloud access')}`);
172
178
  }
173
179
  console.log('');
174
180
  if (data.cloudModels) {
175
- console.log(chalk.bold(' Cloud Model Pricing'));
176
- console.log(chalk.gray(' ─────────────────────────────'));
181
+ console.log(chalk_1.default.bold(' Cloud Model Pricing'));
182
+ console.log(chalk_1.default.gray(' ─────────────────────────────'));
177
183
  for (const [alias, cost] of Object.entries(data.cloudModels)) {
178
184
  const displayName = alias.replace('vigthoria-cloud-', '').replace(/\b\w/g, c => c.toUpperCase());
179
- console.log(` ${chalk.cyan(`vigthoria-cloud-${displayName.toLowerCase()}`).padEnd(36)} ${chalk.yellow(String(cost))} credits minimum reserve, then token-priced`);
185
+ console.log(` ${chalk_1.default.cyan(`vigthoria-cloud-${displayName.toLowerCase()}`).padEnd(36)} ${chalk_1.default.yellow(String(cost))} credits minimum reserve, then token-priced`);
180
186
  }
181
187
  console.log('');
182
- console.log(chalk.gray(' Use --model vigthoria-cloud-fast|balanced|code|power|maximum in vigthoria chat'));
188
+ console.log(chalk_1.default.gray(' Use --model vigthoria-cloud-fast|balanced|code|power|maximum in vigthoria chat'));
183
189
  }
184
190
  console.log('');
185
191
  }
@@ -189,3 +195,4 @@ export class WalletCommand {
189
195
  }
190
196
  }
191
197
  }
198
+ exports.WalletCommand = WalletCommand;
@@ -1,14 +1,20 @@
1
- import chalk from 'chalk';
2
- import { APIClient, } from '../utils/api.js';
3
- import { ProjectMemoryService } from '../utils/project-memory.js';
4
- export class WorkflowCommand {
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.WorkflowCommand = void 0;
7
+ const chalk_1 = __importDefault(require("chalk"));
8
+ const api_js_1 = require("../utils/api.js");
9
+ const project_memory_js_1 = require("../utils/project-memory.js");
10
+ class WorkflowCommand {
5
11
  config;
6
12
  logger;
7
13
  api;
8
14
  constructor(config, logger) {
9
15
  this.config = config;
10
16
  this.logger = logger;
11
- this.api = new APIClient(config, logger);
17
+ this.api = new api_js_1.APIClient(config, logger);
12
18
  }
13
19
  ensureAuthenticated(json = false) {
14
20
  if (this.config.isAuthenticated()) {
@@ -42,7 +48,7 @@ export class WorkflowCommand {
42
48
  console.log(JSON.stringify(payload, null, 2));
43
49
  }
44
50
  createProjectMemory() {
45
- return new ProjectMemoryService(process.cwd());
51
+ return new project_memory_js_1.ProjectMemoryService(process.cwd());
46
52
  }
47
53
  buildBrainPayload(workflowId, data) {
48
54
  const memory = this.createProjectMemory();
@@ -97,7 +103,7 @@ export class WorkflowCommand {
97
103
  }
98
104
  this.logger.section('Workflow Templates');
99
105
  if (templates.length === 0) {
100
- console.log(chalk.yellow('No templates matched your filters.'));
106
+ console.log(chalk_1.default.yellow('No templates matched your filters.'));
101
107
  return;
102
108
  }
103
109
  this.logger.table(['ID', 'Name', 'Category', 'Tags'], templates.map((template) => [
@@ -132,7 +138,7 @@ export class WorkflowCommand {
132
138
  }
133
139
  this.logger.section('Workflows');
134
140
  if (workflows.length === 0) {
135
- console.log(chalk.yellow('No workflows found for this account.'));
141
+ console.log(chalk_1.default.yellow('No workflows found for this account.'));
136
142
  return;
137
143
  }
138
144
  this.logger.table(['ID', 'Name', 'Nodes', 'Runs', 'Updated'], workflows.map((workflow) => [
@@ -155,9 +161,9 @@ export class WorkflowCommand {
155
161
  return;
156
162
  }
157
163
  this.logger.success(`Created workflow ${workflow.name}`);
158
- console.log(chalk.gray(`Workflow ID: ${workflow.id}`));
164
+ console.log(chalk_1.default.gray(`Workflow ID: ${workflow.id}`));
159
165
  if (workflow.fromTemplate) {
160
- console.log(chalk.gray(`Template: ${workflow.fromTemplate}`));
166
+ console.log(chalk_1.default.gray(`Template: ${workflow.fromTemplate}`));
161
167
  }
162
168
  }
163
169
  async run(workflowId, options) {
@@ -178,10 +184,10 @@ export class WorkflowCommand {
178
184
  return;
179
185
  }
180
186
  this.logger.success(`Workflow execution ${execution.status}`);
181
- console.log(chalk.gray(`Execution ID: ${execution.executionId}`));
182
- console.log(chalk.gray(`Nodes executed: ${execution.nodesExecuted ?? 0}`));
187
+ console.log(chalk_1.default.gray(`Execution ID: ${execution.executionId}`));
188
+ console.log(chalk_1.default.gray(`Nodes executed: ${execution.nodesExecuted ?? 0}`));
183
189
  if (execution.error) {
184
- console.log(chalk.red(execution.error));
190
+ console.log(chalk_1.default.red(execution.error));
185
191
  }
186
192
  }
187
193
  async status(executionId, options) {
@@ -204,3 +210,4 @@ export class WorkflowCommand {
204
210
  ].join('\n'), 'Workflow Status');
205
211
  }
206
212
  }
213
+ exports.WorkflowCommand = WorkflowCommand;
@@ -1,8 +1,11 @@
1
+ "use strict";
1
2
  /**
2
3
  * Brain Hub client — sync workspace index + fetch account brain context
3
4
  * via coder.vigthoria.io (JWT-authenticated).
4
5
  */
5
- export class BrainHubClient {
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.BrainHubClient = void 0;
8
+ class BrainHubClient {
6
9
  apiBase;
7
10
  getAuthToken;
8
11
  constructor(options) {
@@ -46,3 +49,4 @@ export class BrainHubClient {
46
49
  return data;
47
50
  }
48
51
  }
52
+ exports.BrainHubClient = BrainHubClient;
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  /**
2
3
  * Vigthoria CLI → DevTools Bridge Telemetry Client
3
4
  *
@@ -11,18 +12,57 @@
11
12
  * - Opt-in via --bridge <url> flag
12
13
  * - Sensitive data (API keys, tokens) is never transmitted
13
14
  */
14
- import WebSocket from 'ws';
15
- import * as os from 'os';
16
- import chalk from 'chalk';
17
- import { CH } from './logger.js';
15
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
16
+ if (k2 === undefined) k2 = k;
17
+ var desc = Object.getOwnPropertyDescriptor(m, k);
18
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
19
+ desc = { enumerable: true, get: function() { return m[k]; } };
20
+ }
21
+ Object.defineProperty(o, k2, desc);
22
+ }) : (function(o, m, k, k2) {
23
+ if (k2 === undefined) k2 = k;
24
+ o[k2] = m[k];
25
+ }));
26
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
27
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
28
+ }) : function(o, v) {
29
+ o["default"] = v;
30
+ });
31
+ var __importStar = (this && this.__importStar) || (function () {
32
+ var ownKeys = function(o) {
33
+ ownKeys = Object.getOwnPropertyNames || function (o) {
34
+ var ar = [];
35
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
36
+ return ar;
37
+ };
38
+ return ownKeys(o);
39
+ };
40
+ return function (mod) {
41
+ if (mod && mod.__esModule) return mod;
42
+ var result = {};
43
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
44
+ __setModuleDefault(result, mod);
45
+ return result;
46
+ };
47
+ })();
48
+ var __importDefault = (this && this.__importDefault) || function (mod) {
49
+ return (mod && mod.__esModule) ? mod : { "default": mod };
50
+ };
51
+ Object.defineProperty(exports, "__esModule", { value: true });
52
+ exports.BridgeClient = void 0;
53
+ exports.getBridgeClient = getBridgeClient;
54
+ const ws_1 = __importDefault(require("ws"));
55
+ const os = __importStar(require("os"));
56
+ const chalk_1 = __importDefault(require("chalk"));
57
+ const logger_js_1 = require("./logger.js");
18
58
  // ── Singleton accessor ───────────────────────────────────────────────
19
59
  let _instance = null;
20
60
  /** Get the active bridge client (may be null if --bridge was not used). */
21
- export function getBridgeClient() {
61
+ function getBridgeClient() {
22
62
  return _instance;
23
63
  }
24
64
  // ── BridgeClient ─────────────────────────────────────────────────────
25
- export class BridgeClient {
65
+ class BridgeClient {
26
66
  ws = null;
27
67
  url;
28
68
  apiKey;
@@ -53,7 +93,7 @@ export class BridgeClient {
53
93
  return;
54
94
  return new Promise((resolve) => {
55
95
  try {
56
- this.ws = new WebSocket(this.url, { handshakeTimeout: 8000 });
96
+ this.ws = new ws_1.default(this.url, { handshakeTimeout: 8000 });
57
97
  this.ws.on('open', () => {
58
98
  this.connected = true;
59
99
  this.reconnectDelay = 2000;
@@ -97,7 +137,7 @@ export class BridgeClient {
97
137
  this.stopHeartbeat();
98
138
  this.scheduleReconnect();
99
139
  if (process.env.DEBUG || process.env.VIGTHORIA_DEBUG) {
100
- console.log(chalk.yellow(`${CH.warn} Bridge: connection failed, will retry in background.`));
140
+ console.log(chalk_1.default.yellow(`${logger_js_1.CH.warn} Bridge: connection failed, will retry in background.`));
101
141
  }
102
142
  resolve(); // resolve even on failure – must never block CLI
103
143
  });
@@ -185,7 +225,7 @@ export class BridgeClient {
185
225
  clientId: this.clientId,
186
226
  };
187
227
  const json = JSON.stringify(event);
188
- if (this.connected && this.ws?.readyState === WebSocket.OPEN) {
228
+ if (this.connected && this.ws?.readyState === ws_1.default.OPEN) {
189
229
  try {
190
230
  this.ws.send(json);
191
231
  }
@@ -198,7 +238,7 @@ export class BridgeClient {
198
238
  }
199
239
  }
200
240
  sendRaw(obj) {
201
- if (this.ws?.readyState === WebSocket.OPEN) {
241
+ if (this.ws?.readyState === ws_1.default.OPEN) {
202
242
  this.ws.send(JSON.stringify(obj));
203
243
  }
204
244
  }
@@ -209,7 +249,7 @@ export class BridgeClient {
209
249
  this.queue.push(json);
210
250
  }
211
251
  flushQueue() {
212
- while (this.queue.length > 0 && this.ws?.readyState === WebSocket.OPEN) {
252
+ while (this.queue.length > 0 && this.ws?.readyState === ws_1.default.OPEN) {
213
253
  const msg = this.queue.shift();
214
254
  try {
215
255
  this.ws.send(msg);
@@ -240,3 +280,4 @@ export class BridgeClient {
240
280
  }
241
281
  }
242
282
  }
283
+ exports.BridgeClient = BridgeClient;
@@ -1,10 +1,46 @@
1
+ "use strict";
1
2
  /**
2
3
  * Local TF-IDF codebase indexer for CLI (mirrors Vigthoria Code extension indexer).
3
4
  */
4
- import * as crypto from 'crypto';
5
- import * as fs from 'fs';
6
- import * as path from 'path';
7
- export class CodebaseIndexer {
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.CodebaseIndexer = void 0;
40
+ const crypto = __importStar(require("crypto"));
41
+ const fs = __importStar(require("fs"));
42
+ const path = __importStar(require("path"));
43
+ class CodebaseIndexer {
8
44
  workspaceRoot;
9
45
  index = new Map();
10
46
  invertedIndex = new Map();
@@ -312,3 +348,4 @@ export class CodebaseIndexer {
312
348
  return this.ignorePatterns.some((pattern) => lowerPath.includes(pattern));
313
349
  }
314
350
  }
351
+ exports.CodebaseIndexer = CodebaseIndexer;