@sejuneoh/aitop 0.29.0 → 0.31.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
@@ -36,13 +36,16 @@ aitop --doctor check which tools and logs aitop can see
36
36
  aitop --line print one short status line and exit (for tmux, e.g. $54.13 wait 2 fix-login 3m run 3 $3.1/h)
37
37
  aitop --report daily daily cost table and exit
38
38
  aitop --report monthly monthly cost table (last 12 months) and exit
39
+ aitop --report sessions yesterday's sessions with cost, for standups (--md, --json)
39
40
  aitop --help all options
40
41
  aitop --lang ko Korean screen, help, doctor and error messages (also AITOP_LANG=ko or "lang": "ko" in the config file)
41
42
  ```
42
43
 
43
44
  The language is picked from `--lang`, then `AITOP_LANG`, then `lang` in the config file, then `LC_ALL`, `LC_MESSAGES` and `LANG`: Korean when the locale starts with `ko`, English otherwise (including `C.UTF-8` and unset). If you used aitop on a `C.UTF-8` or `en_US` locale before, the screen, help and doctor output are now in English; set `AITOP_LANG=ko` to keep Korean.
44
45
 
45
- In `--json`, `phase` stays the Korean status text in every language (as does `AITOP_WAITING_FOR` for `--on-waiting`). For scripts, use `phaseKind`, a stable state name: `think`, `write`, `tool`, `team`, `waiting`, `idle`, `done`, `ended` (or `null`). Other text fields follow their own rules: with English selected, `--doctor --json` has Korean `tools.*.hint` but English `config.problems`.
46
+ To continue a session elsewhere (for example when you cannot jump to its tab, as in Windows Terminal with WSL), the detail panel shows a `Resume` command and `y` copies it to the clipboard with OSC 52: Claude `cd <dir> && claude --resume <id>`, Codex `cd <dir> && codex resume <id>`, Antigravity `cd <dir> && agy --conversation <id>` (none for Gemini CLI). A session from a data folder other than `~/.claude` / `~/.codex` (or any session while `CLAUDE_CONFIG_DIR` / `CODEX_HOME` is set) gets `CLAUDE_CONFIG_DIR=<dir>` / `CODEX_HOME=<dir>` before the tool so it finds the right history. Claude finds sessions per folder, so without a known folder no command is made; ids that are not UUIDs make none either. A short detail panel leaves the command out; use `y` or `--json` then. Paths and ids are shell quoted and control characters are stripped. Windows Terminal, WezTerm, iTerm2 and kitty accept OSC 52; tmux needs `set -g set-clipboard on`; other terminals ignore it silently, so copy the command from the panel. Nothing is sent to the session. `--json` has the same command as `resumeCmd` per session (`null` if none).
47
+
48
+ In `--json`, `phase` stays the Korean status text in every language (as does `AITOP_WAITING_FOR` for `--on-waiting`). Session `name` uses the same user-given names as the table: a Codex session's `name` changes from the folder name to its `thread_name` once it has one. For scripts, use `phaseKind`, a stable state name: `think`, `write`, `tool`, `team`, `waiting`, `idle`, `done`, `ended` (or `null`). Other text fields follow their own rules: with English selected, `--doctor --json` has Korean `tools.*.hint` but English `config.problems`.
46
49
 
47
50
  ### Daily report
48
51
 
@@ -59,6 +62,15 @@ aitop --report daily --by project --days 7
59
62
  aitop --report monthly --by model --months 6
60
63
  ```
61
64
 
65
+ ### Session report
66
+
67
+ `aitop --report sessions [--since yesterday|today|Nd|YYYY-MM-DD] [--plan USD] [--md|--json] [--show-prompts]` lists every session that used tokens in the period (default: since midnight yesterday; at most 30 days back), highest cost first: tool, main model (`+N` more), project (same rule as `--by project`), session name (your `/rename` name, then the tool's title, then the folder), start and end of activity within the period, tokens, cost (API list price, `?` for unpriced models) and files changed (`-` when unknown, always for agy). A summary card on top shows the total, the share per tool and the session count; `--plan 200` adds how many times the period's share of a $200/month subscription (period days / 30) you used, still in API list price and not your bill. Claude subagents are counted in their parent session. `--md` prints Markdown you can paste (`|` and line breaks escaped), `--json` the same numbers for scripts. First prompts are hidden unless you pass `--show-prompts`, so they do not end up in shared output (session names still show).
68
+
69
+ ```
70
+ aitop --report sessions --md --plan 200
71
+ aitop --report sessions --since 7d --json
72
+ ```
73
+
62
74
  ### Notifications
63
75
 
64
76
  Off by default and only on the live screen. Sessions already waiting (or already over 90% context) when aitop starts are not reported.
@@ -75,6 +87,8 @@ aitop --on-waiting 'my-hook.sh' run a command with /bin/sh -c for the same
75
87
 
76
88
  The hook keeps its name: it gets `AITOP_EVENT` (`waiting`, `done` or `context`) plus `AITOP_TOOL`, `AITOP_PROJECT`, `AITOP_SESSION_ID`, `AITOP_CWD` and `AITOP_WAITING_FOR` in its environment. Config file: `"notify": true` or `"notify": ["waiting", "done", "context"]`, `"onWaiting": "..."` (file must be `chmod 600`), `"doneMinutes": 5`. Plain `--notify` keeps the kinds from the config `notify` list (waiting only when there is none). `--no-notify` turns off only the desktop notification: the hook still follows those kinds. `--bell` stays waiting only.
77
89
 
90
+ The notification body shows the session's own name when it has one (Claude Code `/rename`, or a name given by a peer session; Codex `thread_name`), otherwise the project. Desktop notifications can appear on the lock screen, so the name is visible there too.
91
+
78
92
  ### tmux status line
79
93
 
80
94
  `aitop --line` prints today's cost (API list price, `/$<budget>` when a daily budget is set), the sessions waiting for you with the longest waiting one's name and wait time (`wait fix-login 3m` for one, `wait 2 fix-login 3m` for more; Claude Code read live, names cut to 12 columns with `~`), the number of sessions running (`run 3`), and spend over the last hour. Items that are 0 are left out, and `--line-width N` (default 40) drops items from the end (the waiting name goes before the waiting count; with a daily budget and a waiting name, `$/h` often does not fit in 40, so raise `--line-width` to keep it). It reads only aitop's cache, so it is fast once `aitop` has run before; with no cache yet it prints `...` after about 1.5 seconds. The running count (and waiting Antigravity sessions with their names) come from a small summary that the live screen, `--once` and `--json` write to the cache; when no summary is newer than 60 seconds, `run` is left out rather than shown wrong. `--line=tmux` adds tmux colors, `NO_COLOR` turns them off.
@@ -90,6 +104,10 @@ Keys: `↑↓` select · `n` next session to check · `/` search · `s` sort ·
90
104
 
91
105
  Settings can also go in `~/.config/aitop/config.json` (`%APPDATA%\aitop\config.json` on Windows). See `aitop --help` or the [detailed manual (Korean)](https://github.com/SejuneOh/aitop/blob/main/docs/README.ko.md).
92
106
 
107
+ ### Several Claude or Codex profiles
108
+
109
+ aitop reads `~/.claude` and `~/.codex` by default. To read more profiles, list them in the config file, `"claudeDirs": ["~/.claude", "~/.claude-work"]` and `"codexHomes": ["~/.codex", "~/.codex-alt"]`, or set `AITOP_CLAUDE_DIRS` / `AITOP_CODEX_HOMES` with paths joined by `:` (`;` on Windows), for example `AITOP_CLAUDE_DIRS=~/.claude:~/.claude-work aitop`. Order: `AITOP_*` > config file > an inherited `CLAUDE_CONFIG_DIR` / `CODEX_HOME` > default, so a `CLAUDE_CONFIG_DIR` exported for Claude Code does not hide your config list; `aitop --print-config` shows which source is used. A value that is itself an existing folder is never split, so an old single path containing `:` keeps working. The same folder listed twice (also through a link) is read once, and a session log copied into two folders is counted once. For monthly reports, a month counts as complete only from the day after the oldest remaining log of the folder that was cleaned most recently, so a folder with old logs cannot make a month look complete when another folder already lost logs for it. aitop does not read look-alike folders on its own; `aitop --doctor` lists every folder it reads plus folders that hold logs but are not read (`~/.claude-*`, `~/.config/claude`, `~/.codex-*` and similar owned by you, and a `CLAUDE_CONFIG_DIR` / `CODEX_HOME` the config list left out), with how to add them.
110
+
93
111
  ## License
94
112
 
95
113
  [MIT](https://github.com/SejuneOh/aitop/blob/main/LICENSE)
package/bin/aitop.mjs CHANGED
@@ -41,7 +41,7 @@ if (line.error) {
41
41
  process.stderr.write(`aitop: ${line.error}\n`);
42
42
  process.exit(2);
43
43
  }
44
- // --report daily|monthly, --by tool|model|project, --days <N>, --months <N> 은 reportOption 이 꺼낸다.
44
+ // --report daily|monthly|sessions, --by tool|model|project, --days <N>, --months <N>, --since, --plan, --md, --show-prompts 는 reportOption 이 꺼낸다.
45
45
  const report = reportOption(line.rest);
46
46
  if (report.error) {
47
47
  process.stderr.write(`aitop: ${report.error}\n`);
@@ -83,6 +83,9 @@ process.env.AITOP_COLOR_BLIND = opt.colorBlind ? '1' : '0';
83
83
  if (config.values.icons.source === 'file') process.env.AITOP_ICONS = opt.icons;
84
84
  // 폭이 모호한 기호를 2칸으로 셀지는 글자 폭 계산(text.mjs)이 쓴다. 화면 모듈은 그릴 때마다 이 값을 본다.
85
85
  setAmbiguous(opt.ambiguous);
86
+ // 읽을 Claude·Codex 기록 폴더 목록. 기록을 읽는 모듈을 불러오기 전에 정한다 (#212).
87
+ const { setDataDirs } = await import('../src/sources/dirs.mjs');
88
+ setDataDirs({ claude: opt.claudeDirs, codex: opt.codexHomes });
86
89
  const { BRAND, userVarsSeq } = await import('../src/brand.mjs');
87
90
  const { keysText } = await import('../src/help.mjs');
88
91
  const { debug, initLog, logPath } = await import('../src/log.mjs');
@@ -150,6 +153,33 @@ if (line.mode) {
150
153
  // --report: 날짜별 사용량 표(또는 --json)를 내고 끝낸다. 실시간 화면·세션 목록은 읽지 않고 장부만 읽는다.
151
154
  // --report monthly 는 월별 보관함(monthly.mjs)과 장부를 합친다.
152
155
  // 처음 실행은 30일치(monthly 는 1년치) 기록을 읽으므로 stderr 가 터미널이면 진행률을 보이고, 시간 상한(AITOP_REPORT_MS, 기본 120초)을 넘으면 읽은 만큼 낸다.
156
+ // --report sessions: 기간 안 세션별 한 줄과 요약 카드. 진행률·시간 상한은 daily 와 같다. --md 는 Markdown, --json 은 JSON.
157
+ if (report.kind === 'sessions') {
158
+ const { collectSessions, buildSessions, formatSessions, sessionsMarkdown, sessionsJson } = await import('../src/sessions-report.mjs');
159
+ const { progressWriter, MAX_DAYS } = await import('../src/report.mjs');
160
+ const { flushCache } = await import('../src/cache.mjs');
161
+ const json = args.has('--json');
162
+ if (json && report.md) {
163
+ process.stderr.write(`aitop: ${t('opt.mdJson')}\n`);
164
+ process.exit(2);
165
+ }
166
+ if (report.capped) process.stderr.write(`aitop: ${t('sessions.capped', { n: MAX_DAYS })}\n`);
167
+ const progress = progressWriter();
168
+ const maxMs = Number(process.env.AITOP_REPORT_MS) > 0 ? Number(process.env.AITOP_REPORT_MS) : undefined;
169
+ const now = Date.now();
170
+ const got = await collectSessions({ since: report.since, now, maxMs, onProgress: progress.update });
171
+ progress.done();
172
+ flushCache();
173
+ if (got.partial && json) process.stderr.write(`aitop: ${t('report.partial')}\n`);
174
+ const r = buildSessions(got.books, { since: report.since, now, extra: got.extra, agy: got.agy, plan: report.plan });
175
+ const cols = process.stdout.isTTY ? process.stdout.columns : Number(process.env.COLUMNS) || 0;
176
+ const opts = { partial: got.partial, prompts: report.prompts };
177
+ const text = json ? JSON.stringify(sessionsJson(r, VERSION, opts), null, 2) : report.md ? sessionsMarkdown(r, opts) : formatSessions(r, { ...opts, cols });
178
+ process.stdout.on('error', (err) => process.exit(err.code === 'EPIPE' ? 0 : 1));
179
+ await new Promise((resolve) => process.stdout.write(text + '\n', resolve));
180
+ process.exit(0);
181
+ }
182
+
153
183
  if (report.kind) {
154
184
  const { buildMonthly, buildReport, collectMonthly, collectReport, fitReport, formatReport, PIPE_COLUMNS, progressWriter, reportJson, MAX_DAYS, MAX_MONTHS } = await import('../src/report.mjs');
155
185
  const { flushCache } = await import('../src/cache.mjs');
@@ -209,6 +239,7 @@ const { createAttention, updateAttention, markSeen, nextAttention, windowTitle,
209
239
  const { createNotifier } = await import('../src/notify.mjs');
210
240
  const { onKey, fixFocus } = await import('../src/keys.mjs');
211
241
  const { admit, createLoading, latchReady } = await import('../src/loading.mjs');
242
+ const { osc52, resumeCmd } = await import('../src/resume.mjs');
212
243
 
213
244
  // 요청 전체 보기는 기본으로 꺼 둔다. 켜지 않으면 상세 패널에도 --json 에도 나가지 않는다.
214
245
  const showRequests = opt.showRequests;
@@ -402,8 +433,24 @@ function keepSelectionVisible() {
402
433
  if (list.length && !list.some((s) => s.id === view.selectedId)) select(list[0].id);
403
434
  }
404
435
 
436
+ // y: 이어 여는 명령을 OSC 52 로 클립보드에 쓴다. 터미널이 아니면 아무것도 하지 않는다. 알림은 2초 보인다.
437
+ const TOAST_MS = 2000;
438
+ let toastTimer = null;
439
+ function copy(s) {
440
+ if (!out.isTTY) return;
441
+ const cmd = resumeCmd(s);
442
+ if (cmd) out.write(osc52(cmd));
443
+ view.toast = { key: cmd ? 'foot.copied' : 'foot.copyNone', until: Date.now() + TOAST_MS };
444
+ clearTimeout(toastTimer);
445
+ toastTimer = setTimeout(() => {
446
+ view.toast = null;
447
+ draw();
448
+ }, TOAST_MS);
449
+ }
450
+
405
451
  stdin.setEncoding('utf8');
406
452
  const act = {
453
+ copy,
407
454
  quit,
408
455
  refresh,
409
456
  move,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sejuneoh/aitop",
3
- "version": "0.29.0",
3
+ "version": "0.31.0",
4
4
  "description": "터미널에서 Claude Code · Codex · Antigravity · Gemini 세션과 토큰을 실시간으로 보는 읽기 전용 모니터",
5
5
  "license": "MIT",
6
6
  "type": "module",
package/src/config.mjs CHANGED
@@ -4,11 +4,12 @@
4
4
  // 화면 모듈은 불러올 때 테마·아이콘을 고르므로, 이 모듈은 화면 모듈을 불러오지 않는다 (notify.mjs 는 text·i18n 만 쓴다).
5
5
  import { closeSync, constants, fstatSync, openSync, readSync, statSync } from 'node:fs';
6
6
  import { homedir } from 'node:os';
7
- import { posix, win32 } from 'node:path';
7
+ import { join, posix, win32 } from 'node:path';
8
8
  import { appDir } from './paths.mjs';
9
9
  import { stripControl } from './text.mjs';
10
10
  import { langValue, localeLang, t } from './i18n.mjs';
11
11
  import { EVENT_KINDS } from './notify.mjs';
12
+ import { DIR_ENV, pathLike, splitPaths } from './sources/dirs.mjs';
12
13
 
13
14
  const bool = (v) => typeof v === 'boolean';
14
15
  const oneOf = (...xs) => (v) => xs.includes(v);
@@ -47,6 +48,8 @@ export function budgetDayOption(argv) {
47
48
  }
48
49
 
49
50
  const BOOL = ['true', 'false'];
51
+ // 기록 폴더 목록: 절대 경로(또는 ~ 로 시작) 문자열 배열, 1~16개.
52
+ const pathList = (v) => Array.isArray(v) && v.length > 0 && v.length <= 16 && v.every(pathLike);
50
53
  // expect, envExpect: 둘 중 하나면 [a, b], 아니면 i18n 키. 문구는 쓸 때 지금 언어로 만든다.
51
54
  const expectText = (x) => (Array.isArray(x) ? t('cfg.either', { a: x[0], b: x[1] }) : t(x));
52
55
 
@@ -74,6 +77,10 @@ export const KEYS = {
74
77
  ambiguous: { ok: oneOf('narrow', 'wide'), expect: ['narrow', 'wide'], def: 'narrow', env: ['AITOP_AMBIGUOUS', (v) => (v === 'narrow' || v === 'wide' ? v : undefined)], envProblem: true },
75
78
  // --help·--doctor·오류 문구의 언어(i18n.mjs). 기본값은 로캘(LC_ALL > LC_MESSAGES > LANG)이 ko 로 시작하면 ko, 아니면 en.
76
79
  lang: { ok: oneOf('ko', 'en'), expect: ['ko', 'en'], def: localeLang, env: ['AITOP_LANG', langValue], envProblem: true },
80
+ // 읽을 Claude 설정 폴더·Codex 홈 폴더 목록 (#212, sources/dirs.mjs). 환경 변수는 path.delimiter(: 또는 ;)로 여러 개를 잇는다.
81
+ // AITOP_CLAUDE_DIRS > 설정 파일 > 물려받은 CLAUDE_CONFIG_DIR (inherit, Claude Code 용 변수라 설정 파일보다 낮다) > ~/.claude.
82
+ claudeDirs: { ok: pathList, expect: 'cfg.paths', def: () => [join(homedir(), DIR_ENV.claude.home)], env: [DIR_ENV.claude.own, (v) => splitPaths(v)], inherit: [DIR_ENV.claude.inherited, (v) => splitPaths(v)] },
83
+ codexHomes: { ok: pathList, expect: 'cfg.paths', def: () => [join(homedir(), DIR_ENV.codex.home)], env: [DIR_ENV.codex.own, (v) => splitPaths(v)], inherit: [DIR_ENV.codex.inherited, (v) => splitPaths(v)] },
77
84
  };
78
85
 
79
86
  // Windows 는 XDG_CONFIG_HOME 이 없으면 %APPDATA%\aitop\config.json.
@@ -159,8 +166,10 @@ export function resolveConfig({ flags = {}, env = process.env, file } = {}) {
159
166
  const fromEnv = spec.env && env[spec.env[0]] != null ? spec.env[1](env[spec.env[0]]) : undefined;
160
167
  if (spec.envProblem && env[spec.env[0]] != null && fromEnv === undefined) problems.push(t('cfg.badEnv', { name: spec.env[0], value: show(env[spec.env[0]]), expect: expectText(spec.envExpect ?? spec.expect) }));
161
168
  if (flags[key] !== undefined) values[key] = { value: flags[key], source: 'flag' };
162
- else if (fromEnv !== undefined) values[key] = { value: fromEnv, source: 'env' };
169
+ else if (fromEnv !== undefined) values[key] = spec.inherit ? { value: fromEnv, source: 'env', env: spec.env[0] } : { value: fromEnv, source: 'env' };
163
170
  else if (key in file.values) values[key] = { value: file.values[key], source: 'file' };
171
+ // 물려받은 변수(CLAUDE_CONFIG_DIR 등)는 설정 파일 다음. 어느 변수에서 왔는지 env 에 남긴다.
172
+ else if (spec.inherit && spec.inherit[1](env[spec.inherit[0]]) !== undefined) values[key] = { value: spec.inherit[1](env[spec.inherit[0]]), source: 'env', env: spec.inherit[0] };
164
173
  // 기본값이 함수면 환경에서 고른다 (lang 은 로캘).
165
174
  else values[key] = { value: typeof spec.def === 'function' ? spec.def(env) : spec.def, source: 'default' };
166
175
  }
@@ -171,9 +180,9 @@ export function resolveConfig({ flags = {}, env = process.env, file } = {}) {
171
180
  export function configText(cfg) {
172
181
  const out = [t('cfg.file', { path: stripControl(cfg.path), state: t(cfg.exists ? 'cfg.exists' : 'cfg.missing') }), ''];
173
182
  for (const [key, { value, source }] of Object.entries(cfg.values)) {
174
- // 배열(notify 의 종류)은 waiting,done 처럼 쉼표로 잇는다.
175
- const v = value == null ? (key === 'theme' ? 'auto' : '-') : typeof value === 'string' ? JSON.stringify(value) : Array.isArray(value) ? value.join(',') : String(value);
176
- out.push(`${key.padEnd(14)}${v.padEnd(12)} ${source}`);
183
+ // 배열(notify 의 종류, 기록 폴더)은 waiting,done 처럼 쉼표로 잇는다.
184
+ const v = value == null ? (key === 'theme' ? 'auto' : '-') : typeof value === 'string' ? JSON.stringify(value) : Array.isArray(value) ? stripControl(value.join(',')) : String(value);
185
+ out.push(`${key.padEnd(14)}${v.padEnd(12)} ${source}${cfg.values[key].env ? ` (${cfg.values[key].env})` : ''}`);
177
186
  }
178
187
  if (cfg.problems.length) out.push('', ...cfg.problems.map((p) => `! ${stripControl(p)}`));
179
188
  return out.join('\n');
package/src/doctor.mjs CHANGED
@@ -2,7 +2,7 @@
2
2
  // 가장 최근 기록을 읽을 수 있는지. aitop --doctor, 빈 화면, --json 의 tools 가 같은 결과를 쓴다.
3
3
  // 기록 내용은 읽어 내보내지 않는다 (Gemini 는 형식 확인용으로 JSON 키 이름만 보인다).
4
4
  import { readdirSync, readFileSync, statSync, existsSync, openSync, readSync, closeSync } from 'node:fs';
5
- import { join } from 'node:path';
5
+ import { basename, join } from 'node:path';
6
6
  import { homedir, platform } from 'node:os';
7
7
  import { findProcesses, isCodex, isGemini, isAgy, canListProcesses, isAlive, isSessionAlive } from './procs.mjs';
8
8
  import { AGY_ROOT } from './sources/antigravity.mjs';
@@ -12,13 +12,12 @@ import { BRAND } from './brand.mjs';
12
12
  import { tildeIn } from './paths.mjs';
13
13
  import { findNotifier, isWsl } from './notify.mjs';
14
14
  import { getLang, t as tr } from './i18n.mjs';
15
+ import { candidateDirs, claudeDirs, codexHomes } from './sources/dirs.mjs';
15
16
 
16
17
  const UNIT = { s: '초', m: '분', h: '시간', d: '일' };
17
18
  const ago = (ms) => fmtAgo(ms).replace(/[smhd]$/, (u) => UNIT[u]);
18
19
 
19
20
  const HOME = homedir();
20
- const CLAUDE = process.env.CLAUDE_CONFIG_DIR ?? join(HOME, '.claude');
21
- const CODEX = join(process.env.CODEX_HOME ?? join(HOME, '.codex'), 'sessions');
22
21
  const GEMINI = join(process.env.GEMINI_HOME ?? join(HOME, '.gemini'), 'tmp');
23
22
 
24
23
  // Windows 는 \ 와 대소문자를 무시하고 줄인다 (paths.mjs).
@@ -112,23 +111,49 @@ function liveSessionFile(path) {
112
111
  }
113
112
  }
114
113
 
115
- function claude() {
116
- const dir = join(CLAUDE, 'projects');
117
- const files = existsSync(dir) ? walk(dir, 1, (n) => n.endsWith('.jsonl')) : null;
118
- const last = files && newest(files);
119
- const running = canListProcesses()
120
- ? ls(join(CLAUDE, 'sessions')).filter((e) => /^\d+\.json$/.test(e.name) && isAlive(Number(e.name.split('.')[0])) && liveSessionFile(join(CLAUDE, 'sessions', e.name))).length
121
- : null;
122
- if (!files) return { tool: 'claude', state: 'missing', path: tilde(dir), records: 0, lastAt: null, running, readable: null, hint: null };
123
- return { tool: 'claude', state: 'ok', path: tilde(dir), records: files.length, lastAt: last?.mtime ?? null, running, readable: last ? firstLineIsJson(last.path) : null, hint: null };
114
+ // 기록 폴더 여러 개(#212)를 한 도구 결과로 모은다. 같은 기록(key 가 같은 파일)은 한 번만 센다.
115
+ // path 는 첫 폴더(예전 모양), dirs 는 읽는 폴더마다 { path, found, records }.
116
+ function gatherDirs(roots, list) {
117
+ const dirs = [];
118
+ const byKey = new Map();
119
+ for (const root of roots) {
120
+ const files = existsSync(root) ? list(root) : null;
121
+ dirs.push({ path: tilde(root), found: Boolean(files), records: files?.length ?? 0 });
122
+ for (const f of files ?? []) if (!byKey.has(f.key)) byKey.set(f.key, f.path);
123
+ }
124
+ const found = dirs.some((d) => d.found);
125
+ const files = [...byKey.values()];
126
+ const last = found ? newest(files) : null;
127
+ return { found, path: dirs[0]?.path ?? '', dirs, records: files.length, lastAt: last?.mtime ?? null, readable: last ? firstLineIsJson(last.path) : null };
124
128
  }
125
129
 
126
- function codex() {
127
- const files = existsSync(CODEX) ? walk(CODEX, 3, (n) => n.startsWith('rollout-') && n.endsWith('.jsonl')) : null;
128
- const last = files && newest(files);
130
+ const claudeFiles = (dir) => walk(dir, 1, (n) => n.endsWith('.jsonl')).map((p) => ({ key: p.slice(dir.length), path: p }));
131
+ const codexFiles = (dir) => walk(dir, 3, (n) => n.startsWith('rollout-') && n.endsWith('.jsonl')).map((p) => ({ key: basename(p), path: p }));
132
+
133
+ // 읽지 않는 폴더 중 기록이 있는 것 (dirs.mjs candidateDirs). 기록 수만 센다.
134
+ function candidatesOf(paths, sub, list) {
135
+ return paths.map((p) => ({ path: tilde(p), records: list(join(p, sub)).length })).filter((c) => c.records > 0);
136
+ }
137
+
138
+ function claude(cand) {
139
+ const homes = claudeDirs();
140
+ const g = gatherDirs(homes.map((h) => join(h, 'projects')), claudeFiles);
141
+ let running = null;
142
+ if (canListProcesses()) {
143
+ running = 0;
144
+ for (const h of homes) running += ls(join(h, 'sessions')).filter((e) => /^\d+\.json$/.test(e.name) && isAlive(Number(e.name.split('.')[0])) && liveSessionFile(join(h, 'sessions', e.name))).length;
145
+ }
146
+ const candidates = candidatesOf(cand, 'projects', claudeFiles);
147
+ if (!g.found) return { tool: 'claude', state: 'missing', path: g.path, dirs: g.dirs, candidates, records: 0, lastAt: null, running, readable: null, hint: null };
148
+ return { tool: 'claude', state: 'ok', path: g.path, dirs: g.dirs, candidates, records: g.records, lastAt: g.lastAt, running, readable: g.readable, hint: null };
149
+ }
150
+
151
+ function codex(cand) {
152
+ const g = gatherDirs(codexHomes().map((h) => join(h, 'sessions')), codexFiles);
129
153
  const running = canListProcesses() ? findProcesses(isCodex).length : null;
130
- if (!files) return { tool: 'codex', state: 'missing', path: tilde(CODEX), records: 0, lastAt: null, running, readable: null, hint: null };
131
- return { tool: 'codex', state: 'ok', path: tilde(CODEX), records: files.length, lastAt: last?.mtime ?? null, running, readable: last ? firstLineIsJson(last.path) : null, hint: null };
154
+ const candidates = candidatesOf(cand, 'sessions', codexFiles);
155
+ if (!g.found) return { tool: 'codex', state: 'missing', path: g.path, dirs: g.dirs, candidates, records: 0, lastAt: null, running, readable: null, hint: null };
156
+ return { tool: 'codex', state: 'ok', path: g.path, dirs: g.dirs, candidates, records: g.records, lastAt: g.lastAt, running, readable: g.readable, hint: null };
132
157
  }
133
158
 
134
159
  // Gemini 는 세션 기록 형식을 아직 모른다. 프로세스만 세고, 기록 폴더가 있으면 형식 확인용 키 이름을 남긴다.
@@ -179,10 +204,12 @@ export function hintOf(r, lang = 'ko') {
179
204
  return null;
180
205
  }
181
206
 
182
- export function checkTools() {
207
+ // home: 후보 폴더를 찾을 홈 폴더 (테스트에서 바꿔 끼운다).
208
+ export function checkTools({ home = HOME } = {}) {
209
+ const cand = candidateDirs({ home });
183
210
  const tools = {};
184
211
  for (const fn of [claude, codex, gemini, agy]) {
185
- const r = fn();
212
+ const r = fn === claude ? claude(cand.claude) : fn === codex ? codex(cand.codex) : fn();
186
213
  r.hint = hintOf(r, 'ko');
187
214
  tools[r.tool] = r;
188
215
  }
@@ -232,8 +259,14 @@ export function doctorText(result, version, now = Date.now(), lang = getLang())
232
259
  for (const t of Object.values(result.tools)) {
233
260
  const d = describe(t, now, lang);
234
261
  out.push(`${d.mark} ${pad(t.tool, 7)}${pad(d.state, 10)}${d.path}`);
262
+ // 기록 폴더가 여럿이면 둘째부터 한 줄씩, 읽지 않는 후보 폴더는 넣는 방법과 함께 (#212).
263
+ for (const x of t.dirs?.slice(1) ?? []) out.push(` + ${pad('', 15)}${x.path} ${x.found ? tr('doctor.records', { n: x.records.toLocaleString('en-US') }, o) : tr('doctor.dirMissing', null, o)}`);
235
264
  out.push(` ${d.detail}`);
236
265
  if (d.hint) out.push(` → ${d.hint}`);
266
+ if (t.candidates?.length) {
267
+ for (const c of t.candidates) out.push(` ? ${tr('doctor.candidate', { path: c.path, n: c.records.toLocaleString('en-US') }, o)}`);
268
+ out.push(` → ${tr(t.tool === 'claude' ? 'doctor.candidateHintClaude' : 'doctor.candidateHintCodex', null, o)}`);
269
+ }
237
270
  }
238
271
  if ('notifier' in result) out.push('', notifierText(result.notifier, result.platform, lang));
239
272
  // 설정 파일: 무시한 키와 값, 받지 않은 onWaiting 을 알린다.
package/src/help.mjs CHANGED
@@ -33,6 +33,7 @@ export const VIEWS = {
33
33
  keys: [
34
34
  k('detail.switch', '↑↓ j k', 'switchSession', '↑↓/jk'),
35
35
  k('detail.files', 'f Tab', 'files'),
36
+ k('detail.copy', 'y', 'copy'),
36
37
  k('detail.close', 'd', 'close'),
37
38
  ],
38
39
  },
@@ -128,7 +129,7 @@ export function viewText(v, lang = getLang()) {
128
129
  // aitop --help 끝의 키 안내. 지금 언어(bin 이 정한다)로 쓴다.
129
130
  export function keysText(lang = getLang()) {
130
131
  const title = (n) => t(`view.${n}`, null, { lang });
131
- return [`${t('help.keys', null, { lang })}: ${keysLine('table', lang)} · ${keysLine('common', lang)}`, ...['files', 'diff', 'filtered', 'search'].map((n) => ` ${title(n)}: ${keysLine(n, lang)}`)].join('\n');
132
+ return [`${t('help.keys', null, { lang })}: ${keysLine('table', lang)} · ${keysLine('common', lang)}`, ...['detail', 'files', 'diff', 'filtered', 'search'].map((n) => ` ${title(n)}: ${keysLine(n, lang)}`)].join('\n');
132
133
  }
133
134
 
134
135
  // 지금 설정 값 한 줄 (예: 예산 $50 · 알림 켜짐 · 디버그 꺼짐). settings 가 없으면 null.
package/src/i18n.mjs CHANGED
@@ -67,11 +67,16 @@ const HELP_KO = `{logo} aitop - 터미널에서 Claude Code · Codex · Antigrav
67
67
  캐시만 읽는다. 캐시가 없어 1.5초 안에 못 읽으면 ... 을 낸다. 작업 중 수와 Antigravity 의 대기 수는
68
68
  1분 안에 aitop 화면·--once·--json 이 남긴 요약이 있을 때만 보인다
69
69
  aitop --json 세션 목록과 사용량 합계를 JSON 으로 한 번 출력한다 (--all 과 함께 쓸 수 있다)
70
+ 세션마다 resumeCmd 에 그 세션을 이어 여는 명령을 넣는다 (예: cd /repo && claude --resume <id>, 없으면 null)
70
71
  aitop --report daily [--by tool|model|project] [--days N] [--json] 최근 N일(기본·최대 30)의 날짜별 토큰·비용(API 정가 환산)을
71
72
  도구별·모델별·프로젝트별 표로 내고 끝낸다. 최근 날짜가 위, 맨 아래는 합계. 처음 실행은 30일치 기록을 읽느라 오래 걸릴 수 있다
72
73
  프로젝트는 작업 폴더의 마지막 이름이고, 열이 터미널 폭을 넘으면 비용이 작은 쪽을 (그 외) 로 합친다
73
74
  aitop --report monthly [--by tool|model|project] [--months N] [--json] 최근 N달(기본·최대 12)의 달별 표. 지난 날은 캐시 폴더의
74
75
  monthly.json 에 달별로 남겨 기록이 지워져도 남는다. 처음 실행은 1년치 기록을 한 번 읽는다. * 이번 달, ~ 일부만 센 달
76
+ aitop --report sessions [--since yesterday|today|Nd|YYYY-MM-DD] [--plan USD] [--md|--json] [--show-prompts]
77
+ 기간(기본: 어제 0시부터 지금까지, 최대 30일 전) 안에 사용량이 있는 세션을 비용이 큰 순서로 한 줄씩 보인다
78
+ (도구, 모델, 프로젝트, 세션 이름, 시작·끝, 토큰, API 정가 환산 비용, 고친 파일 수). 맨 위 요약 카드에 합계와 도구별 비중.
79
+ --plan 월 구독료를 주면 기간 몫의 몇 배인지 보인다. --md 는 붙여 넣을 Markdown. 첫 지시는 --show-prompts 일 때만
75
80
  aitop --doctor Claude · Codex · Antigravity · Gemini 기록과 실행 중인 프로세스, 설정 파일을 점검한다 (--json 과 함께 쓸 수 있다)
76
81
  aitop --bell 응답 대기 세션이 새로 생기면 터미널 벨을 울린다
77
82
  aitop --notify 응답 대기 세션이 새로 생기면 데스크톱 알림을 띄운다 (notify-send · osascript, 없으면 건너뜀)
@@ -98,11 +103,15 @@ const HELP_KO = `{logo} aitop - 터미널에서 Claude Code · Codex · Antigrav
98
103
  예) { "theme": "light", "icons": "plain", "bell": true, "notify": true, "onWaiting": "say 대기", "budgetDay": 50, "ambiguous": "wide", "hideIdleTools": false }
99
104
  notify 에 ["waiting", "done", "context"] 처럼 종류를 주면 그 종류만 알린다. doneMinutes: done 알림 기준 작업 시간(분, 기본 3)
100
105
  hideIdleTools: 실행 중 세션이 없고 7일 동안 쓰지 않은 도구를 헤더 아래 도구 줄에서 숨긴다 (기본 true, false 면 늘 셋 다)
106
+ claudeDirs, codexHomes: 읽을 Claude 설정 폴더·Codex 홈 목록 (예: ["~/.claude", "~/.claude-work"], 기본 ~/.claude, ~/.codex).
107
+ AITOP_CLAUDE_DIRS, AITOP_CODEX_HOMES 에 경로를 : (Windows 는 ;) 로 이어 주면 설정 파일보다 먼저 쓴다.
108
+ 설정 파일 목록이 있으면 물려받은 CLAUDE_CONFIG_DIR, CODEX_HOME 은 쓰지 않는다 (없으면 그 경로를 읽는다)
101
109
  onWaiting 은 파일 소유자가 나이고 그룹·다른 사용자가 쓸 수 없을 때(chmod 600)만 받는다.
102
110
  옵션 > 환경 변수 > 설정 파일 순서로 정한다. 잘못된 값은 무시하고 --doctor 에 알린다.
103
111
 
104
112
  {keys}
105
- 실시간 화면에서 ? 를 누르면 지금 화면의 키부터 보인다`;
113
+ 실시간 화면에서 ? 를 누르면 지금 화면의 키부터 보인다
114
+ y 는 고른 세션을 이어 여는 명령을 OSC 52 로 클립보드에 복사한다. 지원하지 않는 터미널(tmux 는 set-clipboard on 필요)은 조용히 무시하니 상세 패널의 명령을 직접 복사한다`;
106
115
 
107
116
  const HELP_EN = `{logo} aitop - watch Claude Code, Codex, Antigravity and Gemini sessions live in your terminal
108
117
 
@@ -115,12 +124,18 @@ const HELP_EN = `{logo} aitop - watch Claude Code, Codex, Antigravity and Gemini
115
124
  Reads only the cache. With no cache it prints ... after 1.5 seconds. The running count and waiting Antigravity sessions
116
125
  show only when the live screen, --once or --json left a summary in the last minute
117
126
  aitop --json print the session list and usage totals as JSON once (works with --all)
127
+ Each session has resumeCmd, the command that reopens it (e.g. cd /repo && claude --resume <id>, null if none)
118
128
  aitop --report daily [--by tool|model|project] [--days N] [--json] print daily tokens and cost (API list price) for the last N days
119
129
  (default and max 30) by tool, model or project, then exit. Newest day first, total at the bottom. The first run reads 30 days of logs and may take a while
120
130
  A project is the last folder name of the working directory. Columns beyond the terminal width are merged into (others)
121
131
  aitop --report monthly [--by tool|model|project] [--months N] [--json] the same per month for the last N months (default and max 12).
122
132
  Past days are kept per month in monthly.json in the cache folder, so they survive log cleanup. The first run reads up to a year of logs once.
123
133
  * marks this month, ~ a month only partly counted
134
+ aitop --report sessions [--since yesterday|today|Nd|YYYY-MM-DD] [--plan USD] [--md|--json] [--show-prompts]
135
+ list each session with usage in the period (default: since midnight yesterday, at most 30 days back), highest cost first
136
+ (tool, model, project, session name, start and end, tokens, API list price cost, files changed), with a summary card on top.
137
+ --plan with your monthly subscription shows how many times its share for the period you used. --md prints pasteable Markdown.
138
+ First prompts are shown only with --show-prompts
124
139
  aitop --doctor check Claude, Codex, Antigravity and Gemini logs, running processes and the config file (works with --json)
125
140
  aitop --bell ring the terminal bell when a session starts waiting for you
126
141
  aitop --notify show a desktop notification when a session starts waiting (notify-send or osascript, skipped if missing)
@@ -147,11 +162,15 @@ const HELP_EN = `{logo} aitop - watch Claude Code, Codex, Antigravity and Gemini
147
162
  e.g. { "theme": "light", "icons": "plain", "bell": true, "notify": true, "onWaiting": "say waiting", "budgetDay": 50, "ambiguous": "wide", "hideIdleTools": false, "lang": "en" }
148
163
  notify can also be a list like ["waiting", "done", "context"] to pick the kinds. doneMinutes: busy time (minutes, default 3) before a done notice
149
164
  hideIdleTools: hide tools with no running session and no use in 7 days from the tool line under the header (default true, false always shows all)
165
+ claudeDirs, codexHomes: Claude config folders and Codex homes to read (e.g. ["~/.claude", "~/.claude-work"], default ~/.claude, ~/.codex).
166
+ AITOP_CLAUDE_DIRS and AITOP_CODEX_HOMES take paths joined with : (; on Windows) and win over the config file.
167
+ With a config list, an inherited CLAUDE_CONFIG_DIR or CODEX_HOME is not used (without one, that path is read)
150
168
  onWaiting is accepted only when you own the file and no group or other user can write it (chmod 600).
151
169
  Order: option > env var > config file. Bad values are ignored and reported by --doctor.
152
170
 
153
171
  {keys}
154
- Press ? on the live screen to see the keys for the current view first`;
172
+ Press ? on the live screen to see the keys for the current view first
173
+ y copies the selected session's resume command to the clipboard with OSC 52. Terminals without it (tmux needs set-clipboard on) ignore it silently, so copy it from the detail panel`;
155
174
 
156
175
  export const STRINGS = {
157
176
  ko: {
@@ -178,6 +197,7 @@ export const STRINGS = {
178
197
  'key.back': '뒤로',
179
198
  'key.switchSession': '세션 바꾸기',
180
199
  'key.close': '닫기',
200
+ 'key.copy': '명령 복사',
181
201
  'key.pick': '고르기',
182
202
  'key.promptTab': '지시 탭',
183
203
  'key.diff': 'diff',
@@ -209,8 +229,16 @@ export const STRINGS = {
209
229
  'opt.lineBad': '--line 값 {value} 이 잘못되었습니다 (plain 또는 tmux)',
210
230
  'opt.lineWidthMissing': '--line-width 값이 없습니다 (글자 수)',
211
231
  'opt.lineWidthBad': '--line-width 값 {value} 이 잘못되었습니다 (0 보다 큰 정수)',
212
- 'opt.reportMissing': '--report 값이 없습니다 (daily 또는 monthly)',
213
- 'opt.reportBad': '--report 값 {value} 이 잘못되었습니다 (daily 또는 monthly)',
232
+ 'opt.reportMissing': '--report 값이 없습니다 (daily, monthly 또는 sessions)',
233
+ 'opt.reportBad': '--report 값 {value} 이 잘못되었습니다 (daily, monthly 또는 sessions)',
234
+ 'opt.sinceMissing': '--since 값이 없습니다 (yesterday, today, 7d 같은 일 수, 또는 YYYY-MM-DD)',
235
+ 'opt.sinceBad': '--since 값 {value} 이 잘못되었습니다 (yesterday, today, 7d 같은 일 수, 또는 YYYY-MM-DD)',
236
+ 'opt.sinceFuture': '--since 값 {value} 이 오늘보다 뒤입니다',
237
+ 'opt.planMissing': '--plan 값이 없습니다 (월 구독료, USD)',
238
+ 'opt.planBad': '--plan 값 {value} 이 잘못되었습니다 (0 보다 큰 숫자, USD)',
239
+ 'opt.sessionsOnly': '{opt} 는 --report sessions 와 함께 쓴다',
240
+ 'opt.notSessions': '{opt} 는 --report sessions 와 함께 쓸 수 없다 (기간은 --since)',
241
+ 'opt.mdJson': '--md 와 --json 은 함께 쓸 수 없다',
214
242
  'opt.byMissing': '--by 값이 없습니다 (tool, model 또는 project)',
215
243
  'opt.byBad': '--by 값 {value} 이 잘못되었습니다 (tool, model 또는 project)',
216
244
  'opt.daysMissing': '--days 값이 없습니다 (일 수)',
@@ -242,6 +270,25 @@ export const STRINGS = {
242
270
  'report.noteCurrent': '* 이번 달 (아직 진행 중)',
243
271
  'report.notePartial': '~ 일부 날만 셌습니다 (그 전 기록이 지워졌거나 보관함이 비어 있던 때)',
244
272
  'report.noteMissing': '기록 없음: 남은 기록도 보관함도 없는 달입니다 (0 이 아니라 모름)',
273
+ // 세션 리포트 (--report sessions).
274
+ 'sessions.title': '세션 리포트 · {from} ~ {to} ({days}일)',
275
+ 'sessions.cardTotal': '합계 {cost} (API 정가 환산) · 토큰 {tokens} · 세션 {n}개',
276
+ 'sessions.cardTools': '도구별 비용 비중: {tools}',
277
+ 'sessions.cardToolsTokens': '도구별 토큰 비중: {tools}',
278
+ 'sessions.cardPlan': '구독료 {plan}/월의 {days}일 몫 {prorated} 대비 {ratio} (API 정가 환산, 실제 청구액이 아님)',
279
+ 'sessions.col.tool': '도구',
280
+ 'sessions.col.model': '모델',
281
+ 'sessions.col.project': '프로젝트',
282
+ 'sessions.col.name': '세션',
283
+ 'sessions.col.start': '시작',
284
+ 'sessions.col.end': '끝',
285
+ 'sessions.col.tokens': '토큰',
286
+ 'sessions.col.cost': '비용',
287
+ 'sessions.col.files': '파일',
288
+ 'sessions.col.prompt': '첫 지시',
289
+ 'sessions.empty': '이 기간에 사용량이 있는 세션이 없습니다',
290
+ 'sessions.noteBasis': '비용은 API 정가 환산이며 실제 청구액이 아닙니다. 시작·끝은 기간 안의 활동 시각, 파일은 고친 파일 수 (- 는 모름)',
291
+ 'sessions.capped': '--since 는 장부가 남기는 {n}일 전까지만 볼 수 있어 {n}일 전으로 줄입니다',
245
292
 
246
293
  'cfg.notFile': '설정 파일이 일반 파일이 아니라 읽지 않습니다',
247
294
  'cfg.tooBig': '설정 파일이 {kb}KB 를 넘어 읽지 않습니다',
@@ -258,6 +305,7 @@ export const STRINGS = {
258
305
  'cfg.command': '실행할 명령 문자열',
259
306
  'cfg.notify': 'true, false 또는 waiting·done·context 배열',
260
307
  'cfg.positive': '0 보다 큰 수',
308
+ 'cfg.paths': '절대 경로(또는 ~/...) 문자열 배열, 1~16개',
261
309
  'cfg.file': '설정 파일: {path} ({state})',
262
310
  'cfg.exists': '있음',
263
311
  'cfg.missing': '없음',
@@ -271,6 +319,10 @@ export const STRINGS = {
271
319
  'doctor.state.limited': '일부 지원',
272
320
  'doctor.noFolder': '기록 폴더 없음',
273
321
  'doctor.records': '기록 {n}개',
322
+ 'doctor.dirMissing': '폴더 없음',
323
+ 'doctor.candidate': '읽지 않는 기록 폴더 {path} (기록 {n}개)',
324
+ 'doctor.candidateHintClaude': '읽으려면 설정 파일 claudeDirs 배열에 넣거나 AITOP_CLAUDE_DIRS 로 주세요 (예: ["~/.claude", "~/.claude-work"])',
325
+ 'doctor.candidateHintCodex': '읽으려면 설정 파일 codexHomes 배열에 넣거나 AITOP_CODEX_HOMES 로 주세요 (예: ["~/.codex", "~/.codex-alt"])',
274
326
  'doctor.last': '마지막 {ago} 전',
275
327
  'doctor.runningUnknown': '실행 수 확인 불가 (Linux·WSL·macOS 만 지원)',
276
328
  'doctor.running': '실행 {n}',
@@ -373,6 +425,8 @@ export const STRINGS = {
373
425
  'foot.showDetail': '상세 열기',
374
426
  'foot.unpin': '고정 해제',
375
427
  'foot.costMode': '비용 기준',
428
+ 'foot.copied': '이어 여는 명령을 클립보드로 보냄 (OSC 52)',
429
+ 'foot.copyNone': '이 세션은 이어 여는 명령이 없다',
376
430
  'foot.clearSearch': '검색 지우기',
377
431
 
378
432
  'help.title': '도움말 · ? 또는 Esc 로 닫기',
@@ -418,6 +472,7 @@ export const STRINGS = {
418
472
  'hk.detail.switch': '다른 세션을 고르면 상세도 따라 바뀐다',
419
473
  'hk.detail.files': '변경 파일 목록으로',
420
474
  'hk.detail.close': '상세 패널 닫기',
475
+ 'hk.detail.copy': '이어 여는 명령을 클립보드로 복사 (OSC 52, 지원하지 않는 터미널은 조용히 무시)',
421
476
  'hk.files.pick': '파일 고르기',
422
477
  'hk.files.tabs': '지시 탭: 이번 지시 · 편집이 있던 이전 지시 T번호 · 전체',
423
478
  'hk.files.diff': '고른 파일의 diff 보기',
@@ -489,6 +544,7 @@ export const STRINGS = {
489
544
  'detail.sub': ' +서브{n}',
490
545
  'detail.netTag': '캐시제외 ',
491
546
  'detail.session': '세션',
547
+ 'detail.resume': '이어 열기',
492
548
  'detail.folder': '폴더',
493
549
  'detail.branch': '브랜치',
494
550
  'detail.model': '모델',
@@ -544,6 +600,7 @@ export const STRINGS = {
544
600
  'key.back': 'back',
545
601
  'key.switchSession': 'switch session',
546
602
  'key.close': 'close',
603
+ 'key.copy': 'copy cmd',
547
604
  'key.pick': 'pick',
548
605
  'key.promptTab': 'prompt tabs',
549
606
  'key.diff': 'diff',
@@ -575,8 +632,16 @@ export const STRINGS = {
575
632
  'opt.lineBad': 'bad --line value {value} (plain or tmux)',
576
633
  'opt.lineWidthMissing': '--line-width needs a value (characters)',
577
634
  'opt.lineWidthBad': 'bad --line-width value {value} (a whole number above 0)',
578
- 'opt.reportMissing': '--report needs a value (daily or monthly)',
579
- 'opt.reportBad': 'bad --report value {value} (daily or monthly)',
635
+ 'opt.reportMissing': '--report needs a value (daily, monthly or sessions)',
636
+ 'opt.reportBad': 'bad --report value {value} (daily, monthly or sessions)',
637
+ 'opt.sinceMissing': '--since needs a value (yesterday, today, a number of days like 7d, or YYYY-MM-DD)',
638
+ 'opt.sinceBad': 'bad --since value {value} (yesterday, today, a number of days like 7d, or YYYY-MM-DD)',
639
+ 'opt.sinceFuture': '--since value {value} is after today',
640
+ 'opt.planMissing': '--plan needs a value (monthly subscription in USD)',
641
+ 'opt.planBad': 'bad --plan value {value} (a number above 0, USD)',
642
+ 'opt.sessionsOnly': '{opt} only works with --report sessions',
643
+ 'opt.notSessions': '{opt} does not work with --report sessions (use --since for the period)',
644
+ 'opt.mdJson': '--md and --json cannot be used together',
580
645
  'opt.byMissing': '--by needs a value (tool, model or project)',
581
646
  'opt.byBad': 'bad --by value {value} (tool, model or project)',
582
647
  'opt.daysMissing': '--days needs a value (number of days)',
@@ -607,6 +672,24 @@ export const STRINGS = {
607
672
  'report.noteCurrent': '* this month (still in progress)',
608
673
  'report.notePartial': '~ only some days were counted (older logs were deleted or the archive was empty then)',
609
674
  'report.noteMissing': 'no data: neither logs nor the archive cover this month (unknown, not zero)',
675
+ 'sessions.title': 'Sessions, {from} to {to} ({days} days)',
676
+ 'sessions.cardTotal': 'Total {cost} (API list price) · {tokens} tokens · {n} sessions',
677
+ 'sessions.cardTools': 'Cost share by tool: {tools}',
678
+ 'sessions.cardToolsTokens': 'Token share by tool: {tools}',
679
+ 'sessions.cardPlan': '{ratio} the {days}-day share {prorated} of a {plan}/month subscription (API list price, not your actual bill)',
680
+ 'sessions.col.tool': 'Tool',
681
+ 'sessions.col.model': 'Model',
682
+ 'sessions.col.project': 'Project',
683
+ 'sessions.col.name': 'Session',
684
+ 'sessions.col.start': 'Start',
685
+ 'sessions.col.end': 'End',
686
+ 'sessions.col.tokens': 'Tokens',
687
+ 'sessions.col.cost': 'Cost',
688
+ 'sessions.col.files': 'Files',
689
+ 'sessions.col.prompt': 'First prompt',
690
+ 'sessions.empty': 'No session used tokens in this period',
691
+ 'sessions.noteBasis': 'Cost is the API list price, not your actual bill. Start and end are activity times within the period; Files is the number of files changed (- means unknown)',
692
+ 'sessions.capped': '--since is limited to {n} days back, which the ledger keeps, using {n} days',
610
693
 
611
694
  'cfg.notFile': 'config file is not a regular file, not reading it',
612
695
  'cfg.tooBig': 'config file is over {kb}KB, not reading it',
@@ -623,6 +706,7 @@ export const STRINGS = {
623
706
  'cfg.command': 'a command string',
624
707
  'cfg.notify': 'true, false or a list of waiting, done, context',
625
708
  'cfg.positive': 'a number above 0',
709
+ 'cfg.paths': 'a list of 1 to 16 absolute paths (or ~/...)',
626
710
  'cfg.file': 'Config file: {path} ({state})',
627
711
  'cfg.exists': 'found',
628
712
  'cfg.missing': 'not found',
@@ -636,6 +720,10 @@ export const STRINGS = {
636
720
  'doctor.state.limited': { long: 'partial support', short: 'partial' },
637
721
  'doctor.noFolder': 'no log folder',
638
722
  'doctor.records': { one: '{n} log', other: '{n} logs' },
723
+ 'doctor.dirMissing': 'folder not found',
724
+ 'doctor.candidate': { one: 'not read: {path} ({n} log)', other: 'not read: {path} ({n} logs)' },
725
+ 'doctor.candidateHintClaude': 'to read it, add it to claudeDirs in the config file or AITOP_CLAUDE_DIRS (e.g. ["~/.claude", "~/.claude-work"])',
726
+ 'doctor.candidateHintCodex': 'to read it, add it to codexHomes in the config file or AITOP_CODEX_HOMES (e.g. ["~/.codex", "~/.codex-alt"])',
639
727
  'doctor.last': 'last {ago} ago',
640
728
  'doctor.runningUnknown': 'cannot count running (Linux, WSL and macOS only)',
641
729
  'doctor.running': 'running {n}',
@@ -736,6 +824,8 @@ export const STRINGS = {
736
824
  'foot.showDetail': 'show detail',
737
825
  'foot.unpin': 'unpin',
738
826
  'foot.costMode': 'cost',
827
+ 'foot.copied': 'resume command sent to clipboard (OSC 52)',
828
+ 'foot.copyNone': 'no resume command for this session',
739
829
  'foot.clearSearch': 'clear search',
740
830
 
741
831
  'help.title': 'Help · ? or Esc to close',
@@ -780,6 +870,7 @@ export const STRINGS = {
780
870
  'hk.detail.switch': 'Pick another session, the detail follows',
781
871
  'hk.detail.files': 'Open the changed files',
782
872
  'hk.detail.close': 'Close the detail panel',
873
+ 'hk.detail.copy': 'Copy the resume command to the clipboard (OSC 52, terminals without it ignore it silently)',
783
874
  'hk.files.pick': 'Pick a file',
784
875
  'hk.files.tabs': 'Prompt tabs: latest, earlier (T number), all',
785
876
  'hk.files.diff': 'View the diff of the file',
@@ -849,6 +940,7 @@ export const STRINGS = {
849
940
  'detail.sub': ' +sub{n}',
850
941
  'detail.netTag': 'no cache ',
851
942
  'detail.session': 'Session',
943
+ 'detail.resume': 'Resume',
852
944
  'detail.folder': 'Folder',
853
945
  'detail.branch': 'Branch',
854
946
  'detail.model': 'Model',