@gabrihhh/jarvis 2.5.0 → 2.6.0

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.
package/README.md CHANGED
@@ -22,7 +22,7 @@ Reinicie o Claude Code após o setup.
22
22
  | Comando | Descrição |
23
23
  |---|---|
24
24
  | `jarvis` | Mostra a versão |
25
- | `jarvis --usage` | Dashboard completo de uso (tokens, custo, contexto) |
25
+ | `jarvis --usage` | Dashboard completo de uso (tokens e custo) |
26
26
  | `jarvis --watch` | Dashboard com auto-refresh a cada 30s |
27
27
  | `jarvis --setup` | Configura status bar, instala slash commands e define trigger padrão |
28
28
  | `jarvis --graph` | Abre o Neo4j Browser em localhost:7474 |
@@ -30,6 +30,10 @@ Reinicie o Claude Code após o setup.
30
30
  | `jarvis --trigger session` | Hook de memória roda uma vez por sessão *(padrão)* |
31
31
  | `jarvis --trigger prompt` | Hook de memória roda a cada prompt |
32
32
  | `jarvis --trigger off` | Desativa o carregamento automático de memória |
33
+ | `jarvis --theme` | Mostra o tema atual da status bar |
34
+ | `jarvis --theme <name>:<#hex>` | Define a cor de um box (`context`, `trigger`, `memory`) |
35
+ | `jarvis --theme <name>:reset` | Reseta a cor de um box para o padrão |
36
+ | `jarvis --theme reset` | Reseta todas as cores para o padrão |
33
37
  | `jarvis --line` | Saída de uma linha usada internamente pela status bar |
34
38
  | `jarvis --help` | Lista todos os comandos |
35
39
 
@@ -62,13 +66,6 @@ Reinicie o Claude Code após o setup.
62
66
  │ │
63
67
  ├──────────────────────────────────────────────────────────────┤
64
68
  │ │
65
- │ ⬡ Context Window (current session) │
66
- │ │
67
- │ ████████████░░░░░░░░░░░░ 52% 103.6K / 200.0K │
68
- │ 146 turns · model: sonnet-4-6 │
69
- │ │
70
- ├──────────────────────────────────────────────────────────────┤
71
- │ │
72
69
  │ Monthly breakdown │
73
70
  │ Input: 62.5K Output: 1.53M │
74
71
  │ Cache read: 232.48M Cache write: 11.25M │
package/bin/jarvis.js CHANGED
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { run } from '../src/index.js';
3
3
  import { renderLine } from '../src/statusline.js';
4
+ import { readTheme, writeTheme, isValidHex, DEFAULT_COLORS, VALID_NAMES, THEME_PATH } from '../src/theme.js';
4
5
  import { readFileSync, writeFileSync, existsSync, mkdirSync, copyFileSync } from 'fs';
5
6
  import { join, dirname } from 'path';
6
7
  import { homedir } from 'os';
@@ -76,6 +77,10 @@ if (args.includes('--help') || args.includes('-h')) {
76
77
  jarvis --trigger session Hook runs once per session (default)
77
78
  jarvis --trigger prompt Hook runs on every prompt
78
79
  jarvis --trigger off Disable automatic memory loading
80
+ jarvis --theme Show current statusline theme
81
+ jarvis --theme <name>:<hex> Set a box color (context, trigger, memory)
82
+ jarvis --theme <name>:reset Reset a single box to default color
83
+ jarvis --theme reset Reset all colors to default
79
84
  jarvis --help Show this help
80
85
 
81
86
  Slash commands (inside Claude Code):
@@ -189,6 +194,65 @@ if (args.includes('--graph')) {
189
194
  if (mode !== 'off') console.log(` Hook configured in ~/.claude/settings.json`);
190
195
  else console.log(` Hook removed from ~/.claude/settings.json`);
191
196
  console.log(`\n Restart Claude Code to activate.\n`);
197
+ } else if (args.includes('--theme')) {
198
+ const { Chalk } = await import('chalk');
199
+ const chalk = new Chalk({ level: 3 });
200
+ const value = args[args.indexOf('--theme') + 1];
201
+
202
+ // jarvis --theme → mostra tema atual
203
+ if (!value || value.startsWith('--')) {
204
+ const theme = readTheme();
205
+ console.log('\n Current theme:\n');
206
+ for (const name of VALID_NAMES) {
207
+ const hex = theme[name];
208
+ const isDefault = hex === DEFAULT_COLORS[name];
209
+ const tag = isDefault ? chalk.dim(' (default)') : '';
210
+ console.log(` ${chalk.bold(name.padEnd(8))} ${chalk.hex(hex).bold('██')} ${hex}${tag}`);
211
+ }
212
+ console.log(`\n Config: ${THEME_PATH}\n`);
213
+ process.exit(0);
214
+ }
215
+
216
+ // jarvis --theme reset → reseta tudo
217
+ if (value === 'reset') {
218
+ writeTheme({ ...DEFAULT_COLORS });
219
+ console.log('\n ✓ Theme reset to defaults\n');
220
+ process.exit(0);
221
+ }
222
+
223
+ // jarvis --theme name:value
224
+ const sep = value.indexOf(':');
225
+ if (sep === -1) {
226
+ console.error(`\n ✗ Invalid format. Use: jarvis --theme <context|trigger|memory>:<#hexcolor|reset>\n`);
227
+ process.exit(1);
228
+ }
229
+
230
+ const name = value.slice(0, sep);
231
+ const color = value.slice(sep + 1);
232
+
233
+ if (!VALID_NAMES.includes(name)) {
234
+ console.error(`\n ✗ Unknown name "${name}". Valid names: ${VALID_NAMES.join(', ')}\n`);
235
+ process.exit(1);
236
+ }
237
+
238
+ const theme = readTheme();
239
+
240
+ if (color === 'reset') {
241
+ theme[name] = DEFAULT_COLORS[name];
242
+ writeTheme(theme);
243
+ console.log(`\n ✓ ${name} reset to default (${DEFAULT_COLORS[name]})\n`);
244
+ process.exit(0);
245
+ }
246
+
247
+ if (!isValidHex(color)) {
248
+ console.error(`\n ✗ Invalid hex color "${color}". Use format: #rgb or #rrggbb\n`);
249
+ process.exit(1);
250
+ }
251
+
252
+ theme[name] = color;
253
+ writeTheme(theme);
254
+ console.log(`\n ✓ ${name} set to ${chalk.hex(color).bold(color)}\n`);
255
+ process.exit(0);
192
256
  } else if (args.includes('--query')) {
193
257
  try {
194
258
  const { queryByPath } = await import('../src/memory/query-by-path.js');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gabrihhh/jarvis",
3
- "version": "2.5.0",
3
+ "version": "2.6.0",
4
4
  "description": "Claude Code terminal dashboard + semantic memory graph via Neo4j",
5
5
  "bin": {
6
6
  "jarvis": "bin/jarvis.js",
package/src/statusline.js CHANGED
@@ -4,13 +4,10 @@ import { join } from 'path';
4
4
  import { homedir, tmpdir } from 'os';
5
5
  import { readAllUsage, getCurrentSessionFile, readCurrentSessionUsage } from './reader.js';
6
6
  import { aggregateStats, aggregateSession } from './calculator.js';
7
+ import { readTheme } from './theme.js';
7
8
 
8
9
  const chalk = new Chalk({ level: 3 });
9
10
 
10
- const PINK = '#f472b6';
11
- const CYAN = '#22d3ee';
12
- const GREEN = '#4ade80';
13
-
14
11
  function bar(percent, width = 8) {
15
12
  const filled = Math.round((percent / 100) * width);
16
13
  const empty = width - filled;
@@ -57,23 +54,24 @@ function isMemoryLoaded(sessionId) {
57
54
 
58
55
  export function renderLine() {
59
56
  const mode = readTriggerMode();
57
+ const theme = readTheme();
60
58
 
61
59
  const sessionMeta = getCurrentSessionFile();
62
60
  const sessionId = sessionMeta?.sessionId;
63
61
  const loaded = isMemoryLoaded(sessionId);
64
- const loadedBox = loaded ? buildBox(' ⬡ ', GREEN, 4) : null;
62
+ const loadedBox = loaded ? buildBox(' ⬡ ', theme.memory, 4) : null;
65
63
 
66
64
  const allEntries = readAllUsage();
67
65
 
68
66
  const boxes = (contextBox) => {
69
67
  const toJoin = [contextBox];
70
- if (mode !== 'off') toJoin.push(buildBox(` TRIGGER ${mode.toUpperCase()} `, PINK));
68
+ if (mode !== 'off') toJoin.push(buildBox(` TRIGGER ${mode.toUpperCase()} `, theme.trigger));
71
69
  if (loadedBox) toJoin.push(loadedBox);
72
70
  return joinBoxes(...toJoin);
73
71
  };
74
72
 
75
73
  if (!allEntries.length) {
76
- const contextBox = buildBox(` CONTEXT ${'░'.repeat(8)} 0% `, CYAN);
74
+ const contextBox = buildBox(` CONTEXT ${'░'.repeat(8)} 0% `, theme.context);
77
75
  process.stdout.write(boxes(contextBox));
78
76
  return;
79
77
  }
@@ -82,11 +80,11 @@ export function renderLine() {
82
80
  const session = aggregateSession(sessionEntries);
83
81
 
84
82
  if (!session) {
85
- const contextBox = buildBox(` CONTEXT ${'░'.repeat(8)} 0% `, CYAN);
83
+ const contextBox = buildBox(` CONTEXT ${'░'.repeat(8)} 0% `, theme.context);
86
84
  process.stdout.write(boxes(contextBox));
87
85
  return;
88
86
  }
89
87
 
90
- const contextBox = buildBox(` CONTEXT ${bar(session.percent)} ${session.percent}% `, CYAN);
88
+ const contextBox = buildBox(` CONTEXT ${bar(session.percent)} ${session.percent}% `, theme.context);
91
89
  process.stdout.write(boxes(contextBox));
92
90
  }
package/src/theme.js ADDED
@@ -0,0 +1,30 @@
1
+ import { readFileSync, writeFileSync, existsSync } from 'fs';
2
+ import { join } from 'path';
3
+ import { homedir } from 'os';
4
+
5
+ export const THEME_PATH = join(homedir(), '.claude', 'jarvis-theme.json');
6
+
7
+ export const DEFAULT_COLORS = {
8
+ context: '#22d3ee',
9
+ trigger: '#f472b6',
10
+ memory: '#4ade80',
11
+ };
12
+
13
+ export const VALID_NAMES = Object.keys(DEFAULT_COLORS);
14
+
15
+ export function readTheme() {
16
+ try {
17
+ const raw = JSON.parse(readFileSync(THEME_PATH, 'utf8'));
18
+ return { ...DEFAULT_COLORS, ...raw };
19
+ } catch {
20
+ return { ...DEFAULT_COLORS };
21
+ }
22
+ }
23
+
24
+ export function writeTheme(theme) {
25
+ writeFileSync(THEME_PATH, JSON.stringify(theme, null, 2));
26
+ }
27
+
28
+ export function isValidHex(value) {
29
+ return /^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/.test(value);
30
+ }