promptgraph-mcp 1.5.3 → 1.5.4

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 (3) hide show
  1. package/cli.js +35 -20
  2. package/indexer.js +5 -5
  3. package/package.json +1 -1
package/cli.js CHANGED
@@ -25,61 +25,76 @@ export function banner() {
25
25
  boxen(
26
26
  colors.primary.bold('PromptGraph') + ' ' + colors.muted('v' + getVersion()) + '\n' +
27
27
  colors.muted('Semantic skill router for Claude Code'),
28
- {
29
- padding: { top: 0, bottom: 0, left: 2, right: 2 },
30
- borderStyle: 'round',
31
- borderColor: '#7C3AED',
32
- dimBorder: true,
33
- }
28
+ { padding: { top: 0, bottom: 0, left: 2, right: 2 }, borderStyle: 'round', borderColor: '#7C3AED', dimBorder: true }
34
29
  )
35
30
  );
36
31
  }
37
32
 
38
33
  export function spinner(text) {
39
- return ora({
40
- text: colors.muted(text),
41
- spinner: 'dots',
42
- color: 'magenta',
43
- });
34
+ return ora({ text: colors.muted(text), spinner: 'dots', color: 'magenta' });
44
35
  }
45
36
 
46
37
  export function success(msg) {
47
- console.log(colors.success('✓') + ' ' + msg);
38
+ console.log('\n' + colors.success('✓') + ' ' + msg);
48
39
  }
49
40
 
50
41
  export function error(msg) {
51
- console.log(colors.error('✗') + ' ' + msg);
42
+ console.log(colors.error('✗') + ' ' + msg);
52
43
  }
53
44
 
54
45
  export function info(msg) {
55
- console.log(colors.muted('·') + ' ' + msg);
46
+ console.log(colors.muted(' ' + msg));
56
47
  }
57
48
 
58
49
  export function section(title) {
59
50
  console.log('\n' + colors.primary.bold(title));
60
51
  }
61
52
 
62
- export function progress(current, total, extra = '') {
53
+ let _progressActive = false;
54
+
55
+ export function progress(current, total, { skipped = 0, eta = '?', errors = 0 } = {}) {
63
56
  const pct = Math.round(current / total * 100);
64
57
  const bar = buildBar(pct);
65
- process.stdout.write(
66
- `\r ${bar} ${colors.white.bold(pct + '%')} ${colors.muted(current + '/' + total)} ${colors.muted(extra)} `
67
- );
58
+
59
+ const stats = [
60
+ colors.white.bold(String(pct).padStart(3) + '%'),
61
+ colors.muted(current + '/' + total),
62
+ skipped > 0 ? colors.muted('skip ' + skipped) : '',
63
+ errors > 0 ? colors.error('err ' + errors) : '',
64
+ eta !== '?' ? colors.muted('eta ' + formatTime(eta)) : '',
65
+ ].filter(Boolean).join(' ');
66
+
67
+ process.stdout.write('\r ' + bar + ' ' + stats + ' ');
68
+ _progressActive = true;
69
+ }
70
+
71
+ export function progressDone() {
72
+ if (_progressActive) {
73
+ process.stdout.write('\n');
74
+ _progressActive = false;
75
+ }
68
76
  }
69
77
 
70
78
  function buildBar(pct) {
71
- const width = 20;
79
+ const width = 24;
72
80
  const filled = Math.round(pct / 100 * width);
73
81
  const empty = width - filled;
74
82
  return colors.primary('█'.repeat(filled)) + colors.muted('░'.repeat(empty));
75
83
  }
76
84
 
85
+ function formatTime(seconds) {
86
+ if (seconds < 60) return seconds + 's';
87
+ const m = Math.floor(seconds / 60);
88
+ const s = seconds % 60;
89
+ return m + 'm ' + s + 's';
90
+ }
91
+
77
92
  export function table(rows) {
78
93
  if (!rows.length) { info('No results'); return; }
79
94
  const cols = Object.keys(rows[0]);
80
95
  const widths = cols.map(c => Math.max(c.length, ...rows.map(r => String(r[c] ?? '').length)));
81
96
  const header = cols.map((c, i) => colors.muted(c.toUpperCase().padEnd(widths[i]))).join(' ');
82
- const divider = colors.muted(widths.map(w => '─'.repeat(w)).join(' '));
97
+ const divider = colors.muted(widths.map(w => '─'.repeat(w)).join('──'));
83
98
  console.log('\n' + header);
84
99
  console.log(divider);
85
100
  for (const row of rows) {
package/indexer.js CHANGED
@@ -7,7 +7,7 @@ import { getDb, skillId } from './db.js';
7
7
  import { loadConfig } from './config.js';
8
8
  import { chunkText } from './chunker.js';
9
9
  import { buildAnnIndex } from './ann.js';
10
- import { progress, success, info, spinner } from './cli.js';
10
+ import { progress, progressDone, success, info, spinner } from './cli.js';
11
11
  import chalk from 'chalk';
12
12
 
13
13
  function fileHash(filePath) {
@@ -110,7 +110,7 @@ export async function indexAll() {
110
110
  count++;
111
111
  if (count % 100 === 0) {
112
112
  const eta = count > 0 ? Math.round((total - count) * (Date.now() - start) / count / 1000) : '?';
113
- progress(count, total, `skipped: ${skipped} eta: ${eta}s`);
113
+ progress(count, total, { skipped, eta, errors });
114
114
  }
115
115
  continue;
116
116
  }
@@ -122,7 +122,7 @@ export async function indexAll() {
122
122
  count += batch.length;
123
123
  batch = [];
124
124
  const eta = count > 0 ? Math.round((total - count) * (Date.now() - start) / count / 1000) : '?';
125
- progress(count, total, `skipped: ${skipped} eta: ${eta}s`);
125
+ progress(count, total, { skipped, eta, errors });
126
126
  }
127
127
  } catch {
128
128
  errors++;
@@ -137,8 +137,8 @@ export async function indexAll() {
137
137
  // rebuild all edges for unchanged skills too (fixes edge loss bug)
138
138
  rebuildEdgesForUnchanged(db);
139
139
 
140
- progress(total, total, 'done');
141
- console.log();
140
+ progress(total, total, { skipped, errors });
141
+ progressDone();
142
142
  const spin = spinner('Building ANN index...');
143
143
  spin.start();
144
144
  await buildAnnIndex();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "promptgraph-mcp",
3
- "version": "1.5.3",
3
+ "version": "1.5.4",
4
4
  "main": "index.js",
5
5
  "type": "module",
6
6
  "bin": {