vigthoria-cli 1.10.36 → 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 (62) 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 -22
  7. package/dist/commands/chat.js +402 -1084
  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.d.ts +32 -0
  22. package/dist/utils/brain-hub-client.js +52 -0
  23. package/dist/utils/bridge-client.js +52 -11
  24. package/dist/utils/codebase-indexer.d.ts +59 -0
  25. package/dist/utils/codebase-indexer.js +351 -0
  26. package/dist/utils/context-ranker.js +21 -15
  27. package/dist/utils/files.js +42 -5
  28. package/dist/utils/logger.js +50 -42
  29. package/dist/utils/persona.js +8 -3
  30. package/dist/utils/post-write-validator.js +29 -22
  31. package/dist/utils/project-memory.js +23 -16
  32. package/dist/utils/task-display.js +20 -13
  33. package/dist/utils/workspace-brain-service.d.ts +43 -0
  34. package/dist/utils/workspace-brain-service.js +158 -0
  35. package/dist/utils/workspace-cache.js +26 -18
  36. package/dist/utils/workspace-stream.js +63 -21
  37. package/package.json +3 -6
  38. package/scripts/release/validate-no-go-gates.sh +1 -1
  39. package/dist/commands/fork.d.ts +0 -17
  40. package/dist/commands/fork.js +0 -164
  41. package/dist/commands/history.d.ts +0 -17
  42. package/dist/commands/history.js +0 -113
  43. package/dist/commands/preview.d.ts +0 -55
  44. package/dist/commands/preview.js +0 -467
  45. package/dist/commands/replay.d.ts +0 -18
  46. package/dist/commands/replay.js +0 -156
  47. package/dist/commands/repo.d.ts +0 -97
  48. package/dist/commands/repo.js +0 -773
  49. package/dist/commands/update.d.ts +0 -9
  50. package/dist/commands/update.js +0 -201
  51. package/dist/index.d.ts +0 -21
  52. package/dist/index.js +0 -1823
  53. package/dist/utils/api.d.ts +0 -572
  54. package/dist/utils/api.js +0 -6548
  55. package/dist/utils/cli-state.d.ts +0 -54
  56. package/dist/utils/cli-state.js +0 -185
  57. package/dist/utils/config.d.ts +0 -85
  58. package/dist/utils/config.js +0 -267
  59. package/dist/utils/session.d.ts +0 -118
  60. package/dist/utils/session.js +0 -423
  61. package/dist/utils/tools.d.ts +0 -274
  62. package/dist/utils/tools.js +0 -3502
@@ -1,8 +1,15 @@
1
+ "use strict";
1
2
  /**
2
3
  * Logger utility for Vigthoria CLI
3
4
  */
4
- import chalk from 'chalk';
5
- import ora from 'ora';
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.Logger = exports.CH = void 0;
10
+ exports.createSpinner = createSpinner;
11
+ const chalk_1 = __importDefault(require("chalk"));
12
+ const ora_1 = __importDefault(require("ora"));
6
13
  /**
7
14
  * Platform-aware character map.
8
15
  *
@@ -14,7 +21,7 @@ import ora from 'ora';
14
21
  * monospace rendering can break.
15
22
  */
16
23
  const isWin = process.platform === 'win32';
17
- export const CH = {
24
+ exports.CH = {
18
25
  info: 'ℹ',
19
26
  warn: '⚠',
20
27
  error: '✗',
@@ -57,67 +64,67 @@ export const CH = {
57
64
  * Prefer: spinner.stop() then Logger.error(msg) — which writes to
58
65
  * stdout — instead of spinner.fail(msg).
59
66
  */
60
- export function createSpinner(textOrOpts) {
67
+ function createSpinner(textOrOpts) {
61
68
  const opts = typeof textOrOpts === 'string' ? { text: textOrOpts } : textOrOpts;
62
69
  // Suppress spinner animation when stderr is not a TTY (piped output,
63
70
  // CI, non-interactive terminals). The spinner object still works — its
64
71
  // .start()/.stop()/.succeed() methods are no-ops — so callers don't
65
72
  // need conditional logic.
66
73
  const isSilent = !process.stderr.isTTY;
67
- return ora({ ...opts, stream: process.stderr, isSilent });
74
+ return (0, ora_1.default)({ ...opts, stream: process.stderr, isSilent });
68
75
  }
69
- export class Logger {
76
+ class Logger {
70
77
  verbose = false;
71
78
  setVerbose(verbose) {
72
79
  this.verbose = verbose;
73
80
  }
74
81
  debug(...args) {
75
82
  if (this.verbose) {
76
- console.log(chalk.gray('[DEBUG]'), ...args);
83
+ console.log(chalk_1.default.gray('[DEBUG]'), ...args);
77
84
  }
78
85
  }
79
86
  info(...args) {
80
- console.log(chalk.blue(CH.info), ...args);
87
+ console.log(chalk_1.default.blue(exports.CH.info), ...args);
81
88
  }
82
89
  warn(...args) {
83
- console.log(chalk.yellow(CH.warn), ...args);
90
+ console.log(chalk_1.default.yellow(exports.CH.warn), ...args);
84
91
  }
85
92
  error(...args) {
86
93
  // Write error messages to stdout (not stderr) to avoid triggering
87
94
  // PowerShell NativeCommandError styling. The red ✗ prefix already
88
95
  // signals an error visually; stderr redirection is unnecessary.
89
- console.log(chalk.red(CH.error), ...args);
96
+ console.log(chalk_1.default.red(exports.CH.error), ...args);
90
97
  }
91
98
  success(...args) {
92
- console.log(chalk.green(CH.success), ...args);
99
+ console.log(chalk_1.default.green(exports.CH.success), ...args);
93
100
  }
94
101
  // AI response formatting
95
102
  ai(message) {
96
- console.log(chalk.cyan(CH.ai), message);
103
+ console.log(chalk_1.default.cyan(exports.CH.ai), message);
97
104
  }
98
105
  // User input formatting
99
106
  user(message) {
100
- console.log(chalk.white(CH.user), message);
107
+ console.log(chalk_1.default.white(exports.CH.user), message);
101
108
  }
102
109
  // Code block
103
110
  code(code, language) {
104
- console.log(chalk.gray(CH.hLine.repeat(60)));
105
- console.log(chalk.yellow(code));
106
- console.log(chalk.gray(CH.hLine.repeat(60)));
111
+ console.log(chalk_1.default.gray(exports.CH.hLine.repeat(60)));
112
+ console.log(chalk_1.default.yellow(code));
113
+ console.log(chalk_1.default.gray(exports.CH.hLine.repeat(60)));
107
114
  }
108
115
  // Diff output - enhanced with syntax-highlighted unified diff
109
116
  diff(added, removed) {
110
- removed.forEach(line => console.log(chalk.red(`- ${line}`)));
111
- added.forEach(line => console.log(chalk.green(`+ ${line}`)));
117
+ removed.forEach(line => console.log(chalk_1.default.red(`- ${line}`)));
118
+ added.forEach(line => console.log(chalk_1.default.green(`+ ${line}`)));
112
119
  }
113
120
  // Unified diff display with file context
114
121
  unifiedDiff(filePath, oldText, newText) {
115
122
  const oldLines = oldText.split('\n');
116
123
  const newLines = newText.split('\n');
117
124
  const fileName = filePath.split('/').pop() || filePath;
118
- console.log(chalk.bold.white(`\n ${CH.hLine.repeat(3)} ${fileName} ${CH.hLine.repeat(Math.max(1, 50 - fileName.length))}`));
119
- console.log(chalk.gray(` --- a/${filePath}`));
120
- console.log(chalk.gray(` +++ b/${filePath}`));
125
+ console.log(chalk_1.default.bold.white(`\n ${exports.CH.hLine.repeat(3)} ${fileName} ${exports.CH.hLine.repeat(Math.max(1, 50 - fileName.length))}`));
126
+ console.log(chalk_1.default.gray(` --- a/${filePath}`));
127
+ console.log(chalk_1.default.gray(` +++ b/${filePath}`));
121
128
  // Find diff ranges with context
122
129
  const contextLines = 3;
123
130
  let i = 0;
@@ -133,18 +140,18 @@ export class Logger {
133
140
  const startNew = Math.max(0, j - contextLines);
134
141
  // Context before
135
142
  for (let c = startOld; c < i; c++) {
136
- console.log(chalk.gray(` ${String(c + 1).padStart(4)} │ ${oldLines[c] || ''}`));
143
+ console.log(chalk_1.default.gray(` ${String(c + 1).padStart(4)} │ ${oldLines[c] || ''}`));
137
144
  }
138
145
  // Removed lines
139
146
  while (i < oldLines.length && (j >= newLines.length || oldLines[i] !== newLines[j])) {
140
- console.log(chalk.red(` ${String(i + 1).padStart(4)} │-${oldLines[i]}`));
147
+ console.log(chalk_1.default.red(` ${String(i + 1).padStart(4)} │-${oldLines[i]}`));
141
148
  i++;
142
149
  if (j < newLines.length && (i >= oldLines.length || oldLines[i] === newLines[j]))
143
150
  break;
144
151
  }
145
152
  // Added lines
146
153
  while (j < newLines.length && (i >= oldLines.length || oldLines[i] !== newLines[j])) {
147
- console.log(chalk.green(` ${String(j + 1).padStart(4)} │+${newLines[j]}`));
154
+ console.log(chalk_1.default.green(` ${String(j + 1).padStart(4)} │+${newLines[j]}`));
148
155
  j++;
149
156
  if (i < oldLines.length && oldLines[i] === newLines[j])
150
157
  break;
@@ -152,23 +159,23 @@ export class Logger {
152
159
  // Context after
153
160
  const endCtx = Math.min(oldLines.length, i + contextLines);
154
161
  for (let c = i; c < endCtx && c < oldLines.length && j < newLines.length && oldLines[c] === newLines[j]; c++) {
155
- console.log(chalk.gray(` ${String(c + 1).padStart(4)} │ ${oldLines[c] || ''}`));
162
+ console.log(chalk_1.default.gray(` ${String(c + 1).padStart(4)} │ ${oldLines[c] || ''}`));
156
163
  i = c + 1;
157
164
  j++;
158
165
  }
159
- console.log(chalk.gray(` ${CH.hLine.repeat(55)}`));
166
+ console.log(chalk_1.default.gray(` ${exports.CH.hLine.repeat(55)}`));
160
167
  }
161
168
  console.log();
162
169
  }
163
170
  // Section header
164
171
  section(title) {
165
172
  console.log();
166
- console.log(chalk.bold.cyan(`${CH.hDouble.repeat(3)} ${title} ${CH.hDouble.repeat(3)}`));
173
+ console.log(chalk_1.default.bold.cyan(`${exports.CH.hDouble.repeat(3)} ${title} ${exports.CH.hDouble.repeat(3)}`));
167
174
  console.log();
168
175
  }
169
176
  // Progress
170
177
  progress(message) {
171
- process.stdout.write(chalk.gray(`${message}\r`));
178
+ process.stdout.write(chalk_1.default.gray(`${message}\r`));
172
179
  }
173
180
  // Clear line
174
181
  clearLine() {
@@ -181,18 +188,18 @@ export class Logger {
181
188
  const stripAnsi = (str) => str.replace(/\x1B\[[0-9;]*[a-zA-Z]/g, '');
182
189
  const maxLen = Math.max(...lines.map(l => stripAnsi(l).length), title?.length || 0);
183
190
  const width = maxLen + 4;
184
- console.log(chalk.cyan(CH.tl + CH.hLine.repeat(width - 2) + CH.tr));
191
+ console.log(chalk_1.default.cyan(exports.CH.tl + exports.CH.hLine.repeat(width - 2) + exports.CH.tr));
185
192
  if (title) {
186
- console.log(chalk.cyan(CH.vLine + ' ') + chalk.bold.white(title.padEnd(width - 4)) + chalk.cyan(' ' + CH.vLine));
187
- console.log(chalk.cyan(CH.teeR + CH.hLine.repeat(width - 2) + CH.teeL));
193
+ console.log(chalk_1.default.cyan(exports.CH.vLine + ' ') + chalk_1.default.bold.white(title.padEnd(width - 4)) + chalk_1.default.cyan(' ' + exports.CH.vLine));
194
+ console.log(chalk_1.default.cyan(exports.CH.teeR + exports.CH.hLine.repeat(width - 2) + exports.CH.teeL));
188
195
  }
189
196
  lines.forEach(line => {
190
197
  // Calculate visible length and pad accordingly
191
198
  const visibleLen = stripAnsi(line).length;
192
199
  const padding = ' '.repeat(Math.max(0, width - 4 - visibleLen));
193
- console.log(chalk.cyan(CH.vLine + ' ') + line + padding + chalk.cyan(' ' + CH.vLine));
200
+ console.log(chalk_1.default.cyan(exports.CH.vLine + ' ') + line + padding + chalk_1.default.cyan(' ' + exports.CH.vLine));
194
201
  });
195
- console.log(chalk.cyan(CH.bl + CH.hLine.repeat(width - 2) + CH.br));
202
+ console.log(chalk_1.default.cyan(exports.CH.bl + exports.CH.hLine.repeat(width - 2) + exports.CH.br));
196
203
  }
197
204
  // Table output
198
205
  table(headers, rows) {
@@ -201,18 +208,19 @@ export class Logger {
201
208
  return Math.max(h.length, maxData);
202
209
  });
203
210
  // Header
204
- console.log(chalk.gray(CH.vLine + ' ') +
205
- headers.map((h, i) => chalk.bold(h.padEnd(colWidths[i]))).join(chalk.gray(' ' + CH.vLine + ' ')) +
206
- chalk.gray(' ' + CH.vLine));
211
+ console.log(chalk_1.default.gray(exports.CH.vLine + ' ') +
212
+ headers.map((h, i) => chalk_1.default.bold(h.padEnd(colWidths[i]))).join(chalk_1.default.gray(' ' + exports.CH.vLine + ' ')) +
213
+ chalk_1.default.gray(' ' + exports.CH.vLine));
207
214
  // Separator
208
- console.log(chalk.gray(CH.teeR + CH.hLine) +
209
- colWidths.map(w => CH.hLine.repeat(w)).join(chalk.gray(CH.hLine + CH.cross + CH.hLine)) +
210
- chalk.gray(CH.hLine + CH.teeL));
215
+ console.log(chalk_1.default.gray(exports.CH.teeR + exports.CH.hLine) +
216
+ colWidths.map(w => exports.CH.hLine.repeat(w)).join(chalk_1.default.gray(exports.CH.hLine + exports.CH.cross + exports.CH.hLine)) +
217
+ chalk_1.default.gray(exports.CH.hLine + exports.CH.teeL));
211
218
  // Rows
212
219
  rows.forEach(row => {
213
- console.log(chalk.gray(CH.vLine + ' ') +
214
- row.map((cell, i) => (cell || '').padEnd(colWidths[i])).join(chalk.gray(' ' + CH.vLine + ' ')) +
215
- chalk.gray(' ' + CH.vLine));
220
+ console.log(chalk_1.default.gray(exports.CH.vLine + ' ') +
221
+ row.map((cell, i) => (cell || '').padEnd(colWidths[i])).join(chalk_1.default.gray(' ' + exports.CH.vLine + ' ')) +
222
+ chalk_1.default.gray(' ' + exports.CH.vLine));
216
223
  });
217
224
  }
218
225
  }
226
+ exports.Logger = Logger;
@@ -1,3 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.normalizePersonaMode = normalizePersonaMode;
4
+ exports.isToneDownPrompt = isToneDownPrompt;
5
+ exports.buildPersonaOverlay = buildPersonaOverlay;
1
6
  const WIENER_GRANT_PROMPT = [
2
7
  'Optional persona overlay: Wiener Grantler mode.',
3
8
  'You remain Vigthoria: technically precise, helpful, safe, and comprehensive.',
@@ -13,7 +18,7 @@ const TONE_DOWN_PROMPT = [
13
18
  'Tone-down rule active: this request appears safety-sensitive, destructive, auth/billing-related, security-related, legal/medical/financial, or production-critical.',
14
19
  'Use only a very light flavor line if appropriate, then prioritize plain clarity, caution, and exact steps.',
15
20
  ].join('\n');
16
- export function normalizePersonaMode(value) {
21
+ function normalizePersonaMode(value) {
17
22
  const normalized = String(value || '').trim().toLowerCase().replace(/_/g, '-');
18
23
  if (!normalized || normalized === 'default' || normalized === 'off' || normalized === 'none')
19
24
  return 'default';
@@ -21,10 +26,10 @@ export function normalizePersonaMode(value) {
21
26
  return 'wiener_grant';
22
27
  return null;
23
28
  }
24
- export function isToneDownPrompt(prompt) {
29
+ function isToneDownPrompt(prompt) {
25
30
  return /\b(delete|drop|destroy|wipe|rm\s+-rf|format|credential|secret|token|auth|login|billing|payment|wallet|security|vulnerability|exploit|incident|production|prod|deploy|legal|medical|financial|bank|tax)\b/i.test(prompt);
26
31
  }
27
- export function buildPersonaOverlay(mode, prompt = '') {
32
+ function buildPersonaOverlay(mode, prompt = '') {
28
33
  if (mode !== 'wiener_grant')
29
34
  return '';
30
35
  const parts = [WIENER_GRANT_PROMPT];
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  /**
2
3
  * Vigthoria CLI — Post-Write Validator / Self-Healing Layer
3
4
  *
@@ -8,12 +9,18 @@
8
9
  *
9
10
  * Used by runSelfHealingCycle in api.ts to send targeted correction prompts.
10
11
  */
11
- import { execFileSync } from 'node:child_process';
12
- import fs from 'node:fs';
13
- import path from 'node:path';
12
+ var __importDefault = (this && this.__importDefault) || function (mod) {
13
+ return (mod && mod.__esModule) ? mod : { "default": mod };
14
+ };
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.runPostWriteValidation = runPostWriteValidation;
17
+ exports.formatValidationErrors = formatValidationErrors;
18
+ const node_child_process_1 = require("node:child_process");
19
+ const node_fs_1 = __importDefault(require("node:fs"));
20
+ const node_path_1 = __importDefault(require("node:path"));
14
21
  function commandExists(cmd, args = ['--version']) {
15
22
  try {
16
- execFileSync(cmd, args, { stdio: 'pipe', timeout: 4000, windowsHide: true });
23
+ (0, node_child_process_1.execFileSync)(cmd, args, { stdio: 'pipe', timeout: 4000, windowsHide: true });
17
24
  return true;
18
25
  }
19
26
  catch {
@@ -21,23 +28,23 @@ function commandExists(cmd, args = ['--version']) {
21
28
  }
22
29
  }
23
30
  function hasTsConfig(dir) {
24
- return fs.existsSync(path.join(dir, 'tsconfig.json'));
31
+ return node_fs_1.default.existsSync(node_path_1.default.join(dir, 'tsconfig.json'));
25
32
  }
26
33
  /**
27
34
  * Resolve the best available tsc binary for the project.
28
35
  * Prefers local node_modules/.bin/tsc over npx to avoid network fetches.
29
36
  */
30
37
  function resolveTscBin(workspacePath) {
31
- const localTsc = path.join(workspacePath, 'node_modules', '.bin', 'tsc');
32
- if (fs.existsSync(localTsc))
38
+ const localTsc = node_path_1.default.join(workspacePath, 'node_modules', '.bin', 'tsc');
39
+ if (node_fs_1.default.existsSync(localTsc))
33
40
  return { cmd: localTsc, args: ["--noEmit", "--skipLibCheck"] };
34
41
  try {
35
- execFileSync("npx", ["--version"], { stdio: "pipe", timeout: 4000, windowsHide: true });
42
+ (0, node_child_process_1.execFileSync)("npx", ["--version"], { stdio: "pipe", timeout: 4000, windowsHide: true });
36
43
  return { cmd: "npx", args: ["tsc", "--noEmit", "--skipLibCheck"] };
37
44
  }
38
45
  catch { /* npx not available */ }
39
46
  try {
40
- execFileSync("tsc", ["--version"], { stdio: "pipe", timeout: 4000, windowsHide: true });
47
+ (0, node_child_process_1.execFileSync)("tsc", ["--version"], { stdio: "pipe", timeout: 4000, windowsHide: true });
41
48
  return { cmd: "tsc", args: ["--noEmit", "--skipLibCheck"] };
42
49
  }
43
50
  catch { /* tsc not available */ }
@@ -45,10 +52,10 @@ function resolveTscBin(workspacePath) {
45
52
  }
46
53
  function hasRealTestScript(dir) {
47
54
  try {
48
- const pkgPath = path.join(dir, 'package.json');
49
- if (!fs.existsSync(pkgPath))
55
+ const pkgPath = node_path_1.default.join(dir, 'package.json');
56
+ if (!node_fs_1.default.existsSync(pkgPath))
50
57
  return false;
51
- const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf-8'));
58
+ const pkg = JSON.parse(node_fs_1.default.readFileSync(pkgPath, 'utf-8'));
52
59
  const script = pkg.scripts?.test ?? '';
53
60
  return typeof script === 'string' && script.length > 0
54
61
  && !script.startsWith('echo "Error: no test specified"');
@@ -61,8 +68,8 @@ function hasRealTestScript(dir) {
61
68
  * Run post-write validation in the project directory.
62
69
  * Each check is time-bounded to avoid blocking the CLI.
63
70
  */
64
- export async function runPostWriteValidation(workspacePath) {
65
- if (!workspacePath || !fs.existsSync(workspacePath))
71
+ async function runPostWriteValidation(workspacePath) {
72
+ if (!workspacePath || !node_fs_1.default.existsSync(workspacePath))
66
73
  return [];
67
74
  const results = [];
68
75
  const opts = { cwd: workspacePath, stdio: 'pipe', windowsHide: true };
@@ -70,7 +77,7 @@ export async function runPostWriteValidation(workspacePath) {
70
77
  const tscBin = hasTsConfig(workspacePath) ? resolveTscBin(workspacePath) : null;
71
78
  if (tscBin) {
72
79
  try {
73
- execFileSync(tscBin.cmd, tscBin.args, { ...opts, timeout: 45_000 });
80
+ (0, node_child_process_1.execFileSync)(tscBin.cmd, tscBin.args, { ...opts, timeout: 45_000 });
74
81
  results.push({ ran: true, tool: 'tsc', passed: true, output: '' });
75
82
  }
76
83
  catch (err) {
@@ -81,7 +88,7 @@ export async function runPostWriteValidation(workspacePath) {
81
88
  // 2. npm test
82
89
  if (hasRealTestScript(workspacePath) && commandExists('npm')) {
83
90
  try {
84
- execFileSync('npm', ['test', '--', '--passWithNoTests'], { ...opts, timeout: 90_000 });
91
+ (0, node_child_process_1.execFileSync)('npm', ['test', '--', '--passWithNoTests'], { ...opts, timeout: 90_000 });
85
92
  results.push({ ran: true, tool: 'npm test', passed: true, output: '' });
86
93
  }
87
94
  catch (err) {
@@ -90,13 +97,13 @@ export async function runPostWriteValidation(workspacePath) {
90
97
  }
91
98
  }
92
99
  // 3. Python syntax check
93
- const hasPy = fs.existsSync(path.join(workspacePath, 'requirements.txt'))
94
- || fs.existsSync(path.join(workspacePath, 'setup.py'))
95
- || fs.existsSync(path.join(workspacePath, 'pyproject.toml'));
100
+ const hasPy = node_fs_1.default.existsSync(node_path_1.default.join(workspacePath, 'requirements.txt'))
101
+ || node_fs_1.default.existsSync(node_path_1.default.join(workspacePath, 'setup.py'))
102
+ || node_fs_1.default.existsSync(node_path_1.default.join(workspacePath, 'pyproject.toml'));
96
103
  if (hasPy && commandExists('python3', ['-c', 'import ast'])) {
97
104
  const pyFiles = [];
98
105
  try {
99
- const entries = fs.readdirSync(workspacePath, { withFileTypes: true });
106
+ const entries = node_fs_1.default.readdirSync(workspacePath, { withFileTypes: true });
100
107
  for (const e of entries) {
101
108
  if (e.isFile() && e.name.endsWith('.py'))
102
109
  pyFiles.push(e.name);
@@ -107,7 +114,7 @@ export async function runPostWriteValidation(workspacePath) {
107
114
  let pyOut = '';
108
115
  for (const pyFile of pyFiles.slice(0, 20)) {
109
116
  try {
110
- execFileSync('python3', ['-m', 'py_compile', pyFile], { ...opts, timeout: 10_000 });
117
+ (0, node_child_process_1.execFileSync)('python3', ['-m', 'py_compile', pyFile], { ...opts, timeout: 10_000 });
111
118
  }
112
119
  catch (err) {
113
120
  pyPassed = false;
@@ -123,7 +130,7 @@ export async function runPostWriteValidation(workspacePath) {
123
130
  /**
124
131
  * Build a clear error summary string from failed validation results.
125
132
  */
126
- export function formatValidationErrors(results) {
133
+ function formatValidationErrors(results) {
127
134
  return results
128
135
  .filter((r) => r.ran && !r.passed)
129
136
  .map((r) => `[${r.tool}]\n${r.output.trim()}`)
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  /**
2
3
  * Vigthoria Project Memory Service
3
4
  *
@@ -5,9 +6,14 @@
5
6
  * compact facts that can be retrieved for follow-up prompts without replaying
6
7
  * full chat history or noisy tool traces.
7
8
  */
8
- import fs from 'node:fs';
9
- import path from 'node:path';
10
- import { createHash } from 'node:crypto';
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.ProjectMemoryService = void 0;
14
+ const node_fs_1 = __importDefault(require("node:fs"));
15
+ const node_path_1 = __importDefault(require("node:path"));
16
+ const node_crypto_1 = require("node:crypto");
11
17
  const MAX_ITEMS = 240;
12
18
  const MAX_TEXT_LENGTH = 320;
13
19
  const MAX_CONTEXT_ITEMS = 14;
@@ -29,7 +35,7 @@ function clampText(value, max = MAX_TEXT_LENGTH) {
29
35
  return normalized.length > max ? `${normalized.slice(0, max - 3)}...` : normalized;
30
36
  }
31
37
  function slugHash(value) {
32
- return createHash('sha1').update(value).digest('hex').slice(0, 12);
38
+ return (0, node_crypto_1.createHash)('sha1').update(value).digest('hex').slice(0, 12);
33
39
  }
34
40
  function tokenize(value) {
35
41
  return Array.from(new Set(String(value || '')
@@ -59,22 +65,22 @@ function inferTags(text) {
59
65
  tags.add('validation');
60
66
  return Array.from(tags).slice(0, 8);
61
67
  }
62
- export class ProjectMemoryService {
68
+ class ProjectMemoryService {
63
69
  workspacePath;
64
70
  memoryDir;
65
71
  brainPath;
66
72
  constructor(workspacePath = process.cwd()) {
67
- this.workspacePath = path.resolve(workspacePath || process.cwd());
68
- this.memoryDir = path.join(this.workspacePath, '.vigthoria', 'memory');
69
- this.brainPath = path.join(this.memoryDir, 'brain.json');
73
+ this.workspacePath = node_path_1.default.resolve(workspacePath || process.cwd());
74
+ this.memoryDir = node_path_1.default.join(this.workspacePath, '.vigthoria', 'memory');
75
+ this.brainPath = node_path_1.default.join(this.memoryDir, 'brain.json');
70
76
  }
71
77
  getMemoryDir() {
72
78
  return this.memoryDir;
73
79
  }
74
80
  loadBrain() {
75
81
  try {
76
- if (fs.existsSync(this.brainPath)) {
77
- const parsed = JSON.parse(fs.readFileSync(this.brainPath, 'utf8'));
82
+ if (node_fs_1.default.existsSync(this.brainPath)) {
83
+ const parsed = JSON.parse(node_fs_1.default.readFileSync(this.brainPath, 'utf8'));
78
84
  if (parsed && parsed.version === 1 && Array.isArray(parsed.items)) {
79
85
  return parsed;
80
86
  }
@@ -85,21 +91,21 @@ export class ProjectMemoryService {
85
91
  }
86
92
  return {
87
93
  version: 1,
88
- workspaceName: path.basename(this.workspacePath),
94
+ workspaceName: node_path_1.default.basename(this.workspacePath),
89
95
  updatedAt: nowIso(),
90
96
  items: [],
91
97
  };
92
98
  }
93
99
  saveBrain(brain) {
94
100
  try {
95
- fs.mkdirSync(this.memoryDir, { recursive: true });
101
+ node_fs_1.default.mkdirSync(this.memoryDir, { recursive: true });
96
102
  const normalized = {
97
103
  ...brain,
98
- workspaceName: brain.workspaceName || path.basename(this.workspacePath),
104
+ workspaceName: brain.workspaceName || node_path_1.default.basename(this.workspacePath),
99
105
  updatedAt: nowIso(),
100
106
  items: this.dedupeAndTrim(brain.items || []),
101
107
  };
102
- fs.writeFileSync(this.brainPath, JSON.stringify(normalized, null, 2) + '\n', 'utf8');
108
+ node_fs_1.default.writeFileSync(this.brainPath, JSON.stringify(normalized, null, 2) + '\n', 'utf8');
103
109
  this.writeMarkdownViews(normalized);
104
110
  }
105
111
  catch {
@@ -270,10 +276,10 @@ export class ProjectMemoryService {
270
276
  continue;
271
277
  const heading = this.headingForType(type);
272
278
  const lines = [`# ${heading}`, '', ...items.map((item) => `- ${item.text}`)];
273
- fs.writeFileSync(path.join(this.memoryDir, `${type}s.md`), lines.join('\n') + '\n', 'utf8');
279
+ node_fs_1.default.writeFileSync(node_path_1.default.join(this.memoryDir, `${type}s.md`), lines.join('\n') + '\n', 'utf8');
274
280
  allLines.push(`## ${heading}`, '', ...items.slice(-40).map((item) => `- ${item.text}`), '');
275
281
  }
276
- fs.writeFileSync(path.join(this.memoryDir, 'README.md'), allLines.join('\n').trimEnd() + '\n', 'utf8');
282
+ node_fs_1.default.writeFileSync(node_path_1.default.join(this.memoryDir, 'README.md'), allLines.join('\n').trimEnd() + '\n', 'utf8');
277
283
  }
278
284
  headingForType(type) {
279
285
  switch (type) {
@@ -287,3 +293,4 @@ export class ProjectMemoryService {
287
293
  }
288
294
  }
289
295
  }
296
+ exports.ProjectMemoryService = ProjectMemoryService;
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  /**
2
3
  * Vigthoria CLI — Multi-Step Terminal Task Display
3
4
  *
@@ -6,22 +7,27 @@
6
7
  *
7
8
  * Only activates when stderr is a real TTY; JSON mode and piped output stay clean.
8
9
  */
9
- import chalk from 'chalk';
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.TaskDisplay = void 0;
15
+ const chalk_1 = __importDefault(require("chalk"));
10
16
  const ICONS = {
11
- pending: chalk.gray('○'),
12
- running: chalk.cyan('⟳'),
13
- done: chalk.green('✓'),
14
- error: chalk.red('✗'),
15
- skipped: chalk.gray('\u2013'),
17
+ pending: chalk_1.default.gray('○'),
18
+ running: chalk_1.default.cyan('⟳'),
19
+ done: chalk_1.default.green('✓'),
20
+ error: chalk_1.default.red('✗'),
21
+ skipped: chalk_1.default.gray('\u2013'),
16
22
  };
17
23
  const LABEL_FN = {
18
- pending: (s) => chalk.gray(s),
19
- running: (s) => chalk.cyan.bold(s),
20
- done: (s) => chalk.gray(s),
21
- error: (s) => chalk.red(s),
22
- skipped: (s) => chalk.gray(s),
24
+ pending: (s) => chalk_1.default.gray(s),
25
+ running: (s) => chalk_1.default.cyan.bold(s),
26
+ done: (s) => chalk_1.default.gray(s),
27
+ error: (s) => chalk_1.default.red(s),
28
+ skipped: (s) => chalk_1.default.gray(s),
23
29
  };
24
- export class TaskDisplay {
30
+ class TaskDisplay {
25
31
  tasks = [];
26
32
  linesRendered = 0;
27
33
  enabled;
@@ -38,7 +44,7 @@ export class TaskDisplay {
38
44
  return this.tasks.map((t) => {
39
45
  const icon = ICONS[t.status];
40
46
  const label = LABEL_FN[t.status](t.label);
41
- const detail = t.detail ? chalk.gray(` \u2014 ${t.detail.slice(0, 60)}`) : '';
47
+ const detail = t.detail ? chalk_1.default.gray(` \u2014 ${t.detail.slice(0, 60)}`) : '';
42
48
  return ` ${icon} ${label}${detail}`;
43
49
  });
44
50
  }
@@ -106,3 +112,4 @@ export class TaskDisplay {
106
112
  return this.enabled;
107
113
  }
108
114
  }
115
+ exports.TaskDisplay = TaskDisplay;
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Workspace Brain — local codebase index + Brain Hub sync for CLI.
3
+ */
4
+ import { CodebaseIndexer, IndexMeta } from './codebase-indexer.js';
5
+ export type WorkspaceBrainOptions = {
6
+ workspacePath: string;
7
+ apiBase?: string;
8
+ getAuthToken: () => string | null | Promise<string | null>;
9
+ autoIndex?: boolean;
10
+ brainSyncEnabled?: boolean;
11
+ };
12
+ export type EnsureIndexedResult = {
13
+ indexed: boolean;
14
+ fileCount: number;
15
+ chunkCount: number;
16
+ prompted?: 'index_now' | 'later' | 'skipped';
17
+ };
18
+ export declare class WorkspaceBrainService {
19
+ private workspacePath;
20
+ private indexer;
21
+ private brainClient;
22
+ private autoIndex;
23
+ private brainSyncEnabled;
24
+ private accountContextCache;
25
+ constructor(options: WorkspaceBrainOptions);
26
+ getIndexer(): CodebaseIndexer;
27
+ getStatus(): {
28
+ workspacePath: string;
29
+ indexedFileCount: number;
30
+ totalChunks: number;
31
+ isIndexing: boolean;
32
+ meta: IndexMeta | null;
33
+ };
34
+ ensureIndexed(options?: {
35
+ promptIfMissing?: boolean;
36
+ askToIndex?: (fileCount: number, workspaceName: string) => Promise<'index_now' | 'later'>;
37
+ }): Promise<EnsureIndexedResult>;
38
+ reindexWorkspace(): Promise<IndexMeta>;
39
+ buildCodebaseContext(prompt: string): string;
40
+ searchCodebase(query: string, maxResults?: number): string;
41
+ fetchAccountBrainContext(force?: boolean): Promise<string>;
42
+ private syncIndexToHub;
43
+ }