vigthoria-cli 1.6.38 → 1.6.39

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.
@@ -15,6 +15,12 @@ export declare class ExplainCommand {
15
15
  private marked;
16
16
  constructor(config: Config, logger: Logger);
17
17
  run(filePath: string, options: ExplainOptions): Promise<void>;
18
+ /**
19
+ * Clean marked-terminal output for release-grade CLI presentation.
20
+ * De-indents bullets, normalises bullet characters, and removes stray
21
+ * ANSI-only lines that marked-terminal inserts between sub-items.
22
+ */
23
+ private cleanTerminalOutput;
18
24
  private formatExplanation;
19
25
  }
20
26
  export {};
@@ -25,7 +25,12 @@ class ExplainCommand {
25
25
  this.api = new api_js_1.APIClient(config, logger);
26
26
  this.fileUtils = new files_js_1.FileUtils(process.cwd(), config.get('project').ignorePatterns);
27
27
  this.marked = new marked_1.Marked();
28
- this.marked.use((0, marked_terminal_1.markedTerminal)());
28
+ this.marked.use((0, marked_terminal_1.markedTerminal)({
29
+ showSectionPrefix: false,
30
+ tab: 2,
31
+ width: 80,
32
+ reflowText: true,
33
+ }));
29
34
  }
30
35
  async run(filePath, options) {
31
36
  // Check auth
@@ -77,7 +82,7 @@ class ExplainCommand {
77
82
  // Format based on detail level
78
83
  const formattedExplanation = this.formatExplanation(explanation, options.detail);
79
84
  this.logger.section('Explanation');
80
- console.log(this.marked.parse(formattedExplanation));
85
+ console.log(this.cleanTerminalOutput(this.marked.parse(formattedExplanation)));
81
86
  }
82
87
  catch (error) {
83
88
  spinner.stop();
@@ -85,6 +90,28 @@ class ExplainCommand {
85
90
  this.logger.error((0, api_js_1.formatCLIError)(cliErr));
86
91
  }
87
92
  }
93
+ /**
94
+ * Clean marked-terminal output for release-grade CLI presentation.
95
+ * De-indents bullets, normalises bullet characters, and removes stray
96
+ * ANSI-only lines that marked-terminal inserts between sub-items.
97
+ */
98
+ cleanTerminalOutput(raw) {
99
+ let out = raw;
100
+ // De-indent top-level bullets: ' * text' → '- text'
101
+ out = out.replace(/^ \* /gm, '- ');
102
+ // De-indent sub-level bullets: ' * text' → ' - text'
103
+ out = out.replace(/^ \* /gm, ' - ');
104
+ // Remove lines that are only whitespace + ANSI (no visible text)
105
+ const stripAnsi = (s) => s.replace(/\x1b\[[0-9;]*m/g, '');
106
+ out = out.split('\n').filter(line => {
107
+ if (line === '')
108
+ return true;
109
+ return stripAnsi(line).trim().length > 0;
110
+ }).join('\n');
111
+ // Collapse 3+ consecutive newlines to 2
112
+ out = out.replace(/\n{3,}/g, '\n\n');
113
+ return out;
114
+ }
88
115
  formatExplanation(explanation, detail) {
89
116
  // Normalize formatting: convert any numbered lists to bullet lists
90
117
  // to prevent broken nested numbering in terminal rendering.
@@ -17,6 +17,10 @@ export declare class ReviewCommand {
17
17
  private printTextReview;
18
18
  private printMarkdownReview;
19
19
  private renderScoreBar;
20
+ /**
21
+ * Clean marked-terminal output for release-grade CLI presentation.
22
+ */
23
+ private cleanTerminalOutput;
20
24
  private getSeverityIcon;
21
25
  private getSeverityColor;
22
26
  }
@@ -25,7 +25,12 @@ class ReviewCommand {
25
25
  this.api = new api_js_1.APIClient(config, logger);
26
26
  this.fileUtils = new files_js_1.FileUtils(process.cwd(), config.get('project').ignorePatterns);
27
27
  this.marked = new marked_1.Marked();
28
- this.marked.use((0, marked_terminal_1.markedTerminal)());
28
+ this.marked.use((0, marked_terminal_1.markedTerminal)({
29
+ showSectionPrefix: false,
30
+ tab: 2,
31
+ width: 80,
32
+ reflowText: true,
33
+ }));
29
34
  }
30
35
  async run(filePath, options) {
31
36
  // Check auth
@@ -122,14 +127,32 @@ class ReviewCommand {
122
127
  markdown += `${i + 1}. ${s}\n`;
123
128
  });
124
129
  }
125
- console.log(this.marked.parse(markdown));
130
+ console.log(this.cleanTerminalOutput(this.marked.parse(markdown)));
126
131
  }
127
132
  renderScoreBar(score) {
128
133
  const width = 30;
129
134
  const filled = Math.round((score / 100) * width);
130
135
  const empty = width - filled;
131
136
  const color = score >= 80 ? chalk_1.default.green : score >= 60 ? chalk_1.default.yellow : chalk_1.default.red;
132
- return color(''.repeat(filled)) + chalk_1.default.gray(''.repeat(empty));
137
+ const filledChar = process.platform === 'win32' ? '#' : '\u2588';
138
+ const emptyChar = process.platform === 'win32' ? '.' : '\u2591';
139
+ return color(filledChar.repeat(filled)) + chalk_1.default.gray(emptyChar.repeat(empty));
140
+ }
141
+ /**
142
+ * Clean marked-terminal output for release-grade CLI presentation.
143
+ */
144
+ cleanTerminalOutput(raw) {
145
+ let out = raw;
146
+ out = out.replace(/^ \* /gm, '- ');
147
+ out = out.replace(/^ \* /gm, ' - ');
148
+ const stripAnsi = (s) => s.replace(/\x1b\[[0-9;]*m/g, '');
149
+ out = out.split('\n').filter(line => {
150
+ if (line === '')
151
+ return true;
152
+ return stripAnsi(line).trim().length > 0;
153
+ }).join('\n');
154
+ out = out.replace(/\n{3,}/g, '\n\n');
155
+ return out;
133
156
  }
134
157
  getSeverityIcon(severity) {
135
158
  switch (severity.toLowerCase()) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vigthoria-cli",
3
- "version": "1.6.38",
3
+ "version": "1.6.39",
4
4
  "description": "Vigthoria Coder CLI - AI-powered terminal coding assistant",
5
5
  "main": "dist/index.js",
6
6
  "files": [