@sejuneoh/aitop 0.22.0 → 0.24.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 +16 -2
- package/bin/aitop.mjs +51 -46
- package/package.json +3 -3
- package/src/cache.mjs +2 -1
- package/src/config.mjs +33 -25
- package/src/doctor.mjs +45 -24
- package/src/help.mjs +87 -58
- package/src/i18n.mjs +850 -0
- package/src/json.mjs +8 -2
- package/src/line.mjs +4 -2
- package/src/notify.mjs +14 -8
- package/src/order.mjs +4 -3
- package/src/pricing.mjs +25 -3
- package/src/report.mjs +179 -0
- package/src/sources/agy-ledger.mjs +14 -12
- package/src/sources/antigravity.mjs +16 -15
- package/src/sources/claude-ledger.mjs +38 -17
- package/src/sources/claude-tracker.mjs +4 -4
- package/src/sources/claude.mjs +10 -10
- package/src/sources/codex-ledger.mjs +13 -12
- package/src/sources/codex.mjs +5 -5
- package/src/sources/common.mjs +13 -0
- package/src/sources/gemini.mjs +1 -1
- package/src/ui/chrome.mjs +62 -54
- package/src/ui/detail.mjs +49 -42
- package/src/ui/table.mjs +35 -33
- package/src/ui.mjs +4 -3
package/README.md
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
- **Changed files and diffs** per session and per prompt
|
|
12
12
|
- **Read-only**: no network, no ports, no dependencies. It only reads the session logs each CLI already writes
|
|
13
13
|
|
|
14
|
-
> The
|
|
14
|
+
> The UI follows your locale: English by default, Korean when the locale starts with `ko`. Set `AITOP_LANG=ko|en` (or `--lang`) to pick one. This covers the live screen, `--once`, `--help`, `--doctor`, error messages and desktop notifications. Keys and options work the same in both.
|
|
15
15
|
|
|
16
16
|
## Install
|
|
17
17
|
|
|
@@ -30,12 +30,26 @@ aitop --all include sessions that ended in the last 24 hours
|
|
|
30
30
|
aitop --json print a snapshot as JSON and exit
|
|
31
31
|
aitop --doctor check which tools and logs aitop can see
|
|
32
32
|
aitop --line print one short status line and exit (for tmux, e.g. $54.13/$50 wait 2 $3.1/h)
|
|
33
|
+
aitop --report daily daily cost table and exit
|
|
33
34
|
aitop --help all options
|
|
35
|
+
aitop --lang ko Korean screen, help, doctor and error messages (also AITOP_LANG=ko or "lang": "ko" in the config file)
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
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.
|
|
39
|
+
|
|
40
|
+
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`.
|
|
41
|
+
|
|
42
|
+
### Daily report
|
|
43
|
+
|
|
44
|
+
`aitop --report daily` prints tokens and cost (API list price, like the header) per day, newest first, with a total row, then exits. Columns are per tool by default or per model with `--by model`; `--days N` goes back up to 30 days, and `--json` gives the same numbers for scripts. The first run reads up to 30 days of logs, so it can take a while (progress shows on stderr); later runs use the cache.
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
aitop --report daily --by model --days 14
|
|
34
48
|
```
|
|
35
49
|
|
|
36
50
|
### tmux status line
|
|
37
51
|
|
|
38
|
-
`aitop --line` prints today's cost (API list price, `/$<budget>` when a daily budget is set), the number of Claude Code sessions waiting for you, and spend over the last hour. Items that are 0 are left out, and `--line-width N` (default 40) drops items from the end. 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. `--line=tmux` adds tmux
|
|
52
|
+
`aitop --line` prints today's cost (API list price, `/$<budget>` when a daily budget is set), the number of Claude Code sessions waiting for you, and spend over the last hour. Items that are 0 are left out, and `--line-width N` (default 40) drops items from the end. 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. `--line=tmux` adds tmux colors, `NO_COLOR` turns them off.
|
|
39
53
|
|
|
40
54
|
```tmux
|
|
41
55
|
set -g status-right '#(aitop --line=tmux)'
|
package/bin/aitop.mjs
CHANGED
|
@@ -1,16 +1,29 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { readFileSync } from 'node:fs';
|
|
3
|
-
import { budgetDayOption, configJson, configText, resolveConfig } from '../src/config.mjs';
|
|
3
|
+
import { budgetDayOption, configJson, configPath, configText, readConfigFile, resolveConfig } from '../src/config.mjs';
|
|
4
|
+
import { langOption, pickLang, setLang, t } from '../src/i18n.mjs';
|
|
4
5
|
import { notifyOptions } from '../src/notify.mjs';
|
|
5
6
|
import { lineOption } from '../src/line.mjs';
|
|
7
|
+
import { reportOption } from '../src/report.mjs';
|
|
6
8
|
import { mask, setAmbiguous, stripControl } from '../src/text.mjs';
|
|
7
9
|
|
|
8
10
|
const KNOWN = new Set(['-h', '--help', '-v', '--version', '--once', '--all', '--json', '--doctor', '--bell', '--show-requests', '--print-config', '--no-bell', '--no-all', '--no-show-requests', '--debug', '--no-debug', '--color-blind', '--no-color-blind']);
|
|
9
11
|
const THEMES = ['light', 'dark'];
|
|
10
12
|
const VERSION = JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8')).version;
|
|
11
13
|
|
|
14
|
+
// 언어는 다른 옵션의 오류 문구보다 먼저 정한다: --lang > AITOP_LANG > 설정 파일 lang > LC_ALL > LC_MESSAGES > LANG.
|
|
15
|
+
// 설정 파일의 문제 문구는 읽을 때 만들어지므로(처음엔 한국어) 언어가 한국어가 아니면 한 번 더 읽는다.
|
|
16
|
+
const langOpt = langOption(process.argv.slice(2));
|
|
17
|
+
const cfgPath = configPath();
|
|
18
|
+
let cfgFile = readConfigFile(cfgPath);
|
|
19
|
+
if (setLang(pickLang({ flag: langOpt.value, file: cfgFile.values.lang })) !== 'ko') cfgFile = readConfigFile(cfgPath);
|
|
20
|
+
if (langOpt.error) {
|
|
21
|
+
process.stderr.write(`aitop: ${t(...langOpt.error)}\n`);
|
|
22
|
+
process.exit(2);
|
|
23
|
+
}
|
|
24
|
+
|
|
12
25
|
// --notify, --no-notify, --on-waiting, --no-on-waiting 은 notifyOptions 한 곳에서 해석한다. 여기서는 명령줄에서 준 값만 본다.
|
|
13
|
-
const cliArgs =
|
|
26
|
+
const cliArgs = langOpt.rest;
|
|
14
27
|
const cli = notifyOptions(cliArgs);
|
|
15
28
|
if (cli.error) {
|
|
16
29
|
process.stderr.write(`aitop: ${cli.error}\n`);
|
|
@@ -28,10 +41,16 @@ if (line.error) {
|
|
|
28
41
|
process.stderr.write(`aitop: ${line.error}\n`);
|
|
29
42
|
process.exit(2);
|
|
30
43
|
}
|
|
44
|
+
// --report daily, --by tool|model, --days <N> 은 reportOption 이 꺼낸다.
|
|
45
|
+
const report = reportOption(line.rest);
|
|
46
|
+
if (report.error) {
|
|
47
|
+
process.stderr.write(`aitop: ${report.error}\n`);
|
|
48
|
+
process.exit(2);
|
|
49
|
+
}
|
|
31
50
|
// 사용자가 준 NO_COLOR. 아래에서 파이프 출력이면 NO_COLOR 를 켜므로 그 전에 읽어 둔다 (tmux 의 #() 는 TTY 가 아니다).
|
|
32
51
|
const userNoColor = Boolean(process.env.NO_COLOR);
|
|
33
52
|
// --theme light, --theme=light 처럼 값을 받는 옵션은 따로 꺼낸다.
|
|
34
|
-
const argv =
|
|
53
|
+
const argv = report.rest;
|
|
35
54
|
let theme = null;
|
|
36
55
|
const rest = [];
|
|
37
56
|
for (let i = 0; i < argv.length; i++) {
|
|
@@ -52,7 +71,7 @@ const flag = (name) => {
|
|
|
52
71
|
const notifyFlag = cli.notify ? true : notifyOptions(cliArgs, { notify: true }).notify ? undefined : false;
|
|
53
72
|
// onWaiting 은 --on-waiting 이 뒤에 오면 그 명령, --no-on-waiting 이 뒤에 오면 null(끔), 둘 다 없으면 정하지 않은 것이다.
|
|
54
73
|
const onWaitingFlag = cli.onWaiting ?? (notifyOptions(cliArgs, { onWaiting: 'x' }).onWaiting === null ? null : undefined);
|
|
55
|
-
const config = resolveConfig({ flags: { theme: THEMES.includes(theme) ? theme : undefined, colorBlind: flag('color-blind'), bell: flag('bell'), showRequests: flag('show-requests'), all: flag('all'), debug: flag('debug'), notify: notifyFlag, onWaiting: onWaitingFlag, budgetDay: budget.value } });
|
|
74
|
+
const config = resolveConfig({ flags: { theme: THEMES.includes(theme) ? theme : undefined, colorBlind: flag('color-blind'), bell: flag('bell'), showRequests: flag('show-requests'), all: flag('all'), debug: flag('debug'), notify: notifyFlag, onWaiting: onWaitingFlag, budgetDay: budget.value, lang: langOpt.value }, file: cfgFile });
|
|
56
75
|
const opt = Object.fromEntries(Object.entries(config.values).map(([k, v]) => [k, v.value]));
|
|
57
76
|
// 알림은 설정 파일 값(onWaiting 은 권한 검사를 통과한 것만)을 깔고 명령줄 옵션이 덮는다.
|
|
58
77
|
const fromFile = (k) => (config.values[k].source === 'file' ? config.values[k].value : undefined);
|
|
@@ -75,55 +94,21 @@ process.on('unhandledRejection', (reason) => {
|
|
|
75
94
|
restore();
|
|
76
95
|
} catch {}
|
|
77
96
|
const why = reason instanceof Error ? reason.message : String(reason);
|
|
78
|
-
process.stderr.write(`aitop:
|
|
97
|
+
process.stderr.write(`aitop: ${t('cli.unhandled', { why: stripControl(mask(why)).slice(0, 200) })}\n`);
|
|
79
98
|
process.exit(1);
|
|
80
99
|
});
|
|
81
100
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
aitop 실시간 화면
|
|
85
|
-
aitop --once 현재 상태를 한 번 출력하고 끝낸다
|
|
86
|
-
aitop --all 종료된 세션(24시간 이내)도 함께 본다
|
|
87
|
-
aitop --line 오늘 비용·응답 대기 수·시간당 지출을 한 줄로 내고 끝낸다 (tmux 상태줄용, 예: $54.13/$50 wait 2 $3.1/h)
|
|
88
|
-
--line=tmux 는 tmux 색 서식(#[fg=...])을 넣는다. --line-width <N> 폭 상한(기본 40, 넘으면 뒤 항목부터 뺀다)
|
|
89
|
-
장부 캐시만 읽는다. 캐시가 없어 1.5초 안에 못 읽으면 ... 을 낸다. 응답 대기 수는 Claude Code 세션만 센다
|
|
90
|
-
aitop --json 세션 목록과 사용량 합계를 JSON 으로 한 번 출력한다 (--all 과 함께 쓸 수 있다)
|
|
91
|
-
aitop --doctor Claude · Codex · Antigravity · Gemini 기록과 실행 중인 프로세스, 설정 파일을 점검한다 (--json 과 함께 쓸 수 있다)
|
|
92
|
-
aitop --bell 응답 대기 세션이 새로 생기면 터미널 벨을 울린다
|
|
93
|
-
aitop --notify 응답 대기 세션이 새로 생기면 데스크톱 알림을 띄운다 (notify-send · osascript, 없으면 건너뜀)
|
|
94
|
-
aitop --on-waiting <명령> 응답 대기 세션이 새로 생기면 /bin/sh -c 로 명령을 실행한다 (내 권한으로 실행, 10초 제한)
|
|
95
|
-
세션 정보는 환경변수로만: AITOP_TOOL AITOP_PROJECT AITOP_SESSION_ID AITOP_CWD AITOP_WAITING_FOR
|
|
96
|
-
aitop --show-requests 응답 대기 요청 전체를 상세 패널·--json 에 보인다 (AITOP_SHOW_REQUESTS=1). 비밀값 가림은 최선일 뿐이라 명령 속 비밀값이 보일 수 있다
|
|
97
|
-
aitop --budget-day <달러> 하루 예산. 헤더에 오늘 $12.30/$50 처럼 보이고, 오늘 끝 예상 비용(오늘 + 최근 속도 × 자정까지, 늘 API 환산)이
|
|
98
|
-
80% 를 넘으면 '예상 $45', 100% 를 넘으면 '예상 $60!' 로 알린다 (AITOP_BUDGET_DAY, 설정 파일 budgetDay)
|
|
99
|
-
aitop --theme light|dark 밝은 배경 / 어두운 배경 색 (없으면 COLORFGBG 로 고른다)
|
|
100
|
-
aitop --color-blind 적록 색약용 색. 응답 대기·돈·경고·diff 를 노랑·파랑 계열로 가른다 (AITOP_COLOR_BLIND=1, 설정 파일 colorBlind). --theme 과 함께 쓴다
|
|
101
|
-
aitop --no-bell · --no-all · --no-show-requests · --no-notify · --no-on-waiting · --no-budget-day · --no-debug · --no-color-blind 설정 파일에서 켠 값을 이번 실행만 끈다
|
|
102
|
-
aitop --debug 디버그 로그를 남긴다 (AITOP_DEBUG=1, 설정 파일 debug). 기록 형식이 바뀌어 값이 빌 때 원인 확인용
|
|
103
|
-
${logPath()} (1MB 넘으면 .1 로 하나만 남김, 오류 이름·파일 이름만 쓰고 비밀값은 가림)
|
|
104
|
-
aitop --print-config 설정 값마다 값과 출처(flag/env/file/default), 설정 파일 위치를 보인다 (--json 과 함께 쓸 수 있다)
|
|
105
|
-
aitop --version 설치된 버전을 보인다
|
|
106
|
-
|
|
107
|
-
AITOP_ICONS=plain 창 제목의 Nerd Font 아이콘과 WezTerm 탭 값을 끈다 (ascii 면 로고도 ASCII)
|
|
108
|
-
AITOP_AMBIGUOUS=wide ·, →, ─, ● 같은 폭이 모호한 기호를 2칸으로 그리는 터미널(동아시아 폭 설정)용. 표·상자 기호를 1칸 기호로 바꿔 줄이 밀리지 않게 한다 (설정 파일 ambiguous)
|
|
109
|
-
|
|
110
|
-
설정 파일: ${config.path}
|
|
111
|
-
예) { "theme": "light", "icons": "plain", "bell": true, "notify": true, "onWaiting": "say 대기", "budgetDay": 50, "ambiguous": "wide", "hideIdleTools": false }
|
|
112
|
-
hideIdleTools: 실행 중 세션이 없고 7일 동안 쓰지 않은 도구를 헤더 아래 도구 줄에서 숨긴다 (기본 true, false 면 늘 셋 다)
|
|
113
|
-
onWaiting 은 파일 소유자가 나이고 그룹·다른 사용자가 쓸 수 없을 때(chmod 600)만 받는다.
|
|
114
|
-
옵션 > 환경 변수 > 설정 파일 순서로 정한다. 잘못된 값은 무시하고 --doctor 에 알린다.
|
|
115
|
-
|
|
116
|
-
${keysText().replace(/^/gm, ' ')}
|
|
117
|
-
실시간 화면에서 ? 를 누르면 지금 화면의 키부터 보인다`;
|
|
101
|
+
// --help 문구는 i18n.mjs 의 help.usage 표에 있다.
|
|
102
|
+
const HELP = t('help.usage', { logo: BRAND.logo, logPath: logPath(), configPath: config.path, keys: keysText().replace(/^/gm, ' ') });
|
|
118
103
|
|
|
119
104
|
if (theme === '') {
|
|
120
|
-
process.stderr.write(`aitop:
|
|
105
|
+
process.stderr.write(`aitop: ${t('cli.themeMissing')}\n`);
|
|
121
106
|
process.exit(2);
|
|
122
107
|
}
|
|
123
108
|
const unknown = [...args].filter((a) => !KNOWN.has(a));
|
|
124
109
|
if (theme != null && !THEMES.includes(theme)) unknown.push(`--theme ${theme}`);
|
|
125
110
|
if (unknown.length) {
|
|
126
|
-
process.stderr.write(`aitop:
|
|
111
|
+
process.stderr.write(`aitop: ${t('cli.unknown', { opts: unknown.join(' ') })}\n\n${HELP}\n`);
|
|
127
112
|
process.exit(2);
|
|
128
113
|
}
|
|
129
114
|
if (args.has('-h') || args.has('--help')) {
|
|
@@ -141,7 +126,7 @@ if (args.has('--print-config')) {
|
|
|
141
126
|
|
|
142
127
|
// 디버그 로그는 켰을 때만 파일을 만든다. --help·--version·--print-config 처럼 바로 끝나는 경우에는 만들지 않는다.
|
|
143
128
|
const log = initLog({ enabled: opt.debug, version: VERSION });
|
|
144
|
-
if (opt.debug && !log.on) process.stderr.write(`aitop:
|
|
129
|
+
if (opt.debug && !log.on) process.stderr.write(`aitop: ${t('cli.logOff', { path: log.path })}\n`);
|
|
145
130
|
|
|
146
131
|
// --line: 세션 화면·프로세스 목록 없이 장부 캐시만 읽어 한 줄을 내고 끝낸다. 실패해도 tmux 에 오류를 남기지 않게 0 으로 끝낸다.
|
|
147
132
|
if (line.mode) {
|
|
@@ -161,6 +146,26 @@ if (line.mode) {
|
|
|
161
146
|
process.exit(0);
|
|
162
147
|
}
|
|
163
148
|
|
|
149
|
+
// --report: 날짜별 사용량 표(또는 --json)를 내고 끝낸다. 실시간 화면·세션 목록은 읽지 않고 장부만 읽는다.
|
|
150
|
+
// 처음 실행은 30일치 기록을 읽으므로 stderr 가 터미널이면 진행률을 보이고, 시간 상한(AITOP_REPORT_MS, 기본 120초)을 넘으면 읽은 만큼 낸다.
|
|
151
|
+
if (report.kind) {
|
|
152
|
+
const { buildReport, collectReport, formatReport, progressWriter, reportJson, MAX_DAYS } = await import('../src/report.mjs');
|
|
153
|
+
const { flushCache } = await import('../src/cache.mjs');
|
|
154
|
+
if (report.capped) process.stderr.write(`aitop: ${t('report.capped', { n: MAX_DAYS })}\n`);
|
|
155
|
+
const progress = progressWriter();
|
|
156
|
+
const maxMs = Number(process.env.AITOP_REPORT_MS) > 0 ? Number(process.env.AITOP_REPORT_MS) : undefined;
|
|
157
|
+
const now = Date.now();
|
|
158
|
+
const got = await collectReport({ days: report.days, maxMs, now, onProgress: progress.update });
|
|
159
|
+
progress.done();
|
|
160
|
+
flushCache();
|
|
161
|
+
if (got.partial && args.has('--json')) process.stderr.write(`aitop: ${t('report.partial')}\n`);
|
|
162
|
+
const r = buildReport(got.books, { by: report.by, days: report.days, now });
|
|
163
|
+
const text = args.has('--json') ? JSON.stringify(reportJson(r, VERSION, { partial: got.partial }), null, 2) : formatReport(r, { partial: got.partial });
|
|
164
|
+
process.stdout.on('error', (err) => process.exit(err.code === 'EPIPE' ? 0 : 1));
|
|
165
|
+
await new Promise((resolve) => process.stdout.write(text + '\n', resolve));
|
|
166
|
+
process.exit(0);
|
|
167
|
+
}
|
|
168
|
+
|
|
164
169
|
// 파이프나 파일로 받을 때는 색 코드를 넣지 않는다. 화면 모듈이 불러올 때 NO_COLOR 를 읽으므로 그 전에 정한다.
|
|
165
170
|
const forced = process.env.FORCE_COLOR != null && !['', '0', 'false'].includes(process.env.FORCE_COLOR);
|
|
166
171
|
if (!process.stdout.isTTY && !forced && !process.env.NO_COLOR) process.env.NO_COLOR = '1';
|
|
@@ -175,7 +180,7 @@ const printAndExit = async (text) => {
|
|
|
175
180
|
|
|
176
181
|
// 알림은 실시간 화면에서만 동작한다.
|
|
177
182
|
if ((cli.notify || cli.onWaiting) && (args.has('--once') || args.has('--json') || args.has('--doctor') || !process.stdout.isTTY)) {
|
|
178
|
-
process.stderr.write(
|
|
183
|
+
process.stderr.write(`aitop: ${t('cli.notifyLiveOnly')}\n`);
|
|
179
184
|
}
|
|
180
185
|
|
|
181
186
|
const { checkTools, doctorText, toolsJson } = await import('../src/doctor.mjs');
|
|
@@ -223,7 +228,7 @@ function refresh() {
|
|
|
223
228
|
view.tab = 'now';
|
|
224
229
|
}
|
|
225
230
|
updateAttention(attention, data.sessions, view.selectedId);
|
|
226
|
-
data.sessions = data.sessions.map((s) => (attention.unseen.has(s.id) ? { ...s, unseen: true, phase: { kind: 'unseen'
|
|
231
|
+
data.sessions = data.sessions.map((s) => (attention.unseen.has(s.id) ? { ...s, unseen: true, phase: { kind: 'unseen' }, plain: s } : s));
|
|
227
232
|
// 도구별 점검은 기록 폴더를 훑으므로 30초에 한 번만 한다.
|
|
228
233
|
if (!tools || Date.now() - tools.at > 30_000) tools = { at: Date.now(), result: checkTools() };
|
|
229
234
|
data.tools = tools.result;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sejuneoh/aitop",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.24.0",
|
|
4
4
|
"description": "터미널에서 Claude Code · Codex · Antigravity · Gemini 세션과 토큰을 실시간으로 보는 읽기 전용 모니터",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
},
|
|
33
33
|
"scripts": {
|
|
34
34
|
"start": "node bin/aitop.mjs",
|
|
35
|
-
"test": "node --test test/*.test.mjs",
|
|
36
|
-
"test:e2e": "node --test test/e2e/*.e2e.mjs"
|
|
35
|
+
"test": "AITOP_LANG=ko node --test test/*.test.mjs",
|
|
36
|
+
"test:e2e": "AITOP_LANG=ko node --test test/e2e/*.e2e.mjs"
|
|
37
37
|
}
|
|
38
38
|
}
|
package/src/cache.mjs
CHANGED
|
@@ -8,7 +8,8 @@ import { PRICE_TAG } from './pricing.mjs';
|
|
|
8
8
|
import { debug, debugIo } from './log.mjs';
|
|
9
9
|
|
|
10
10
|
// 캐시 형식이 바뀌면 VERSION 을, 가격표가 바뀌면 PRICE_TAG 가 폴더 이름을 바꿔서 예전 캐시를 버린다.
|
|
11
|
-
|
|
11
|
+
// 14: 장부의 하루 합계에 모델별 몫(models)을 더하고, 날짜를 10일이 아니라 30일 남긴다 (#128).
|
|
12
|
+
const VERSION = 14;
|
|
12
13
|
const ROOT = join(process.env.XDG_CACHE_HOME ?? join(homedir(), '.cache'), 'aitop');
|
|
13
14
|
const NAME = `v${VERSION}-${PRICE_TAG}`;
|
|
14
15
|
const DIR = join(ROOT, NAME);
|
package/src/config.mjs
CHANGED
|
@@ -6,6 +6,7 @@ import { closeSync, constants, fstatSync, openSync, readSync, statSync } from 'n
|
|
|
6
6
|
import { homedir } from 'node:os';
|
|
7
7
|
import { isAbsolute, join } from 'node:path';
|
|
8
8
|
import { stripControl } from './text.mjs';
|
|
9
|
+
import { langValue, localeLang, t } from './i18n.mjs';
|
|
9
10
|
|
|
10
11
|
const bool = (v) => typeof v === 'boolean';
|
|
11
12
|
const oneOf = (...xs) => (v) => xs.includes(v);
|
|
@@ -37,31 +38,37 @@ export function budgetDayOption(argv) {
|
|
|
37
38
|
const next = argv[i + 1];
|
|
38
39
|
const raw = m[1] ?? (next == null || (next.startsWith('-') && !/^-[\d.]/.test(next)) ? '' : argv[++i]);
|
|
39
40
|
const n = usd(raw);
|
|
40
|
-
if (n == null) error ??= raw === '' ? '
|
|
41
|
+
if (n == null) error ??= raw === '' ? t('opt.budgetMissing') : t('opt.budgetBad', { value: JSON.stringify(raw) });
|
|
41
42
|
else value = n;
|
|
42
43
|
}
|
|
43
44
|
return { value, rest, error };
|
|
44
45
|
}
|
|
45
46
|
|
|
47
|
+
const BOOL = ['true', 'false'];
|
|
48
|
+
// expect, envExpect: 둘 중 하나면 [a, b], 아니면 i18n 키. 문구는 쓸 때 지금 언어로 만든다.
|
|
49
|
+
const expectText = (x) => (Array.isArray(x) ? t('cfg.either', { a: x[0], b: x[1] }) : t(x));
|
|
50
|
+
|
|
46
51
|
// env: 환경 변수 이름과 그 값을 옵션 값으로 바꾸는 함수 (undefined 면 설정하지 않은 것으로 본다).
|
|
47
52
|
// envProblem: 환경 변수 값이 잘못되면 무시하고 problems 에 남긴다 (--doctor, --print-config 가 보인다).
|
|
48
53
|
// notify, onWaiting 은 응답 대기 알림(notify.mjs)이 쓴다. debug 는 디버그 로그(log.mjs)를 켠다. budgetDay 는 하루 예산(달러)으로, 헤더와 --json 의 예상 비용 경고(budget.mjs)가 쓴다.
|
|
49
54
|
export const KEYS = {
|
|
50
|
-
theme: { ok: oneOf('light', 'dark'), expect: 'light
|
|
51
|
-
icons: { ok: oneOf('plain', 'ascii'), expect: 'plain
|
|
52
|
-
bell: { ok: bool, expect:
|
|
53
|
-
showRequests: { ok: bool, expect:
|
|
54
|
-
all: { ok: bool, expect:
|
|
55
|
-
notify: { ok: bool, expect:
|
|
56
|
-
onWaiting: { ok: (v) => typeof v === 'string' && v.trim() !== '', expect: '
|
|
57
|
-
debug: { ok: bool, expect:
|
|
58
|
-
budgetDay: { ok: (v) => typeof v === 'number' && Number.isFinite(v) && v > 0, expect: '
|
|
55
|
+
theme: { ok: oneOf('light', 'dark'), expect: ['light', 'dark'], def: null, env: ['AITOP_THEME', (v) => (v === 'light' || v === 'dark' ? v : undefined)] },
|
|
56
|
+
icons: { ok: oneOf('plain', 'ascii'), expect: ['plain', 'ascii'], def: 'full', env: ['AITOP_ICONS', (v) => (v === 'plain' || v === 'ascii' ? v : undefined)] },
|
|
57
|
+
bell: { ok: bool, expect: BOOL, def: false },
|
|
58
|
+
showRequests: { ok: bool, expect: BOOL, def: false, env: ['AITOP_SHOW_REQUESTS', (v) => (v === '1' ? true : v === '0' ? false : undefined)] },
|
|
59
|
+
all: { ok: bool, expect: BOOL, def: false },
|
|
60
|
+
notify: { ok: bool, expect: BOOL, def: false },
|
|
61
|
+
onWaiting: { ok: (v) => typeof v === 'string' && v.trim() !== '', expect: 'cfg.command', def: null },
|
|
62
|
+
debug: { ok: bool, expect: BOOL, def: false, env: ['AITOP_DEBUG', (v) => (v === '1' ? true : v === '0' ? false : undefined)], envProblem: true, envExpect: ['1', '0'] },
|
|
63
|
+
budgetDay: { ok: (v) => typeof v === 'number' && Number.isFinite(v) && v > 0, expect: 'cfg.positive', def: null, env: ['AITOP_BUDGET_DAY', (v) => usd(v) ?? undefined], envProblem: true },
|
|
59
64
|
// colorBlind 는 적록 색약 팔레트(ui/theme.mjs)를 고른다. theme(밝기)과 따로 정한다.
|
|
60
|
-
colorBlind: { ok: bool, expect:
|
|
65
|
+
colorBlind: { ok: bool, expect: BOOL, def: false, env: ['AITOP_COLOR_BLIND', (v) => (v === '1' ? true : v === '0' ? false : undefined)], envProblem: true, envExpect: ['1', '0'] },
|
|
61
66
|
// 실행 중 세션이 없고 7일 동안 쓰지 않은 도구를 도구 줄에서 숨긴다. false 면 늘 셋 다 보인다.
|
|
62
|
-
hideIdleTools: { ok: bool, expect:
|
|
67
|
+
hideIdleTools: { ok: bool, expect: BOOL, def: true },
|
|
63
68
|
// 폭이 모호한 기호(·, →, ─, ● 등)를 2칸으로 그리는 터미널이면 wide. 표 칸이 밀리지 않게 1칸 기호로 바꾸고 폭을 2칸으로 센다.
|
|
64
|
-
ambiguous: { ok: oneOf('narrow', 'wide'), expect: 'narrow
|
|
69
|
+
ambiguous: { ok: oneOf('narrow', 'wide'), expect: ['narrow', 'wide'], def: 'narrow', env: ['AITOP_AMBIGUOUS', (v) => (v === 'narrow' || v === 'wide' ? v : undefined)], envProblem: true },
|
|
70
|
+
// --help·--doctor·오류 문구의 언어(i18n.mjs). 기본값은 로캘(LC_ALL > LC_MESSAGES > LANG)이 ko 로 시작하면 ko, 아니면 en.
|
|
71
|
+
lang: { ok: oneOf('ko', 'en'), expect: ['ko', 'en'], def: localeLang, env: ['AITOP_LANG', langValue], envProblem: true },
|
|
65
72
|
};
|
|
66
73
|
|
|
67
74
|
export function configPath(env = process.env, home = homedir()) {
|
|
@@ -80,8 +87,8 @@ export function readConfigFile(path, { uid = process.getuid?.() } = {}) {
|
|
|
80
87
|
let fd;
|
|
81
88
|
let text;
|
|
82
89
|
let st;
|
|
83
|
-
const notFile = () => res.problems.push('
|
|
84
|
-
const tooBig = () => res.problems.push(
|
|
90
|
+
const notFile = () => res.problems.push(t('cfg.notFile'));
|
|
91
|
+
const tooBig = () => res.problems.push(t('cfg.tooBig', { kb: MAX_BYTES / 1024 }));
|
|
85
92
|
try {
|
|
86
93
|
// FIFO 나 장치 파일을 열면 멈출 수 있으므로 열기 전에 확인하고, 열 때도 기다리지 않게 연다.
|
|
87
94
|
st = statSync(path);
|
|
@@ -101,7 +108,7 @@ export function readConfigFile(path, { uid = process.getuid?.() } = {}) {
|
|
|
101
108
|
} catch (err) {
|
|
102
109
|
if (err.code !== 'ENOENT') {
|
|
103
110
|
res.exists = err.code !== 'ENOTDIR';
|
|
104
|
-
res.problems.push(
|
|
111
|
+
res.problems.push(t('cfg.unreadable', { code: err.code ?? err.message }));
|
|
105
112
|
}
|
|
106
113
|
return res;
|
|
107
114
|
} finally {
|
|
@@ -112,17 +119,17 @@ export function readConfigFile(path, { uid = process.getuid?.() } = {}) {
|
|
|
112
119
|
obj = JSON.parse(text);
|
|
113
120
|
} catch (err) {
|
|
114
121
|
// 오류 문구에 파일 내용 일부가 들어가므로 제어문자를 지우고 줄인다.
|
|
115
|
-
res.problems.push(
|
|
122
|
+
res.problems.push(t('cfg.badJson', { why: stripControl(err.message).slice(0, 120) }));
|
|
116
123
|
return res;
|
|
117
124
|
}
|
|
118
125
|
if (!obj || typeof obj !== 'object' || Array.isArray(obj)) {
|
|
119
|
-
res.problems.push(
|
|
126
|
+
res.problems.push(t('cfg.notObject'));
|
|
120
127
|
return res;
|
|
121
128
|
}
|
|
122
129
|
for (const [key, value] of Object.entries(obj)) {
|
|
123
130
|
const spec = Object.hasOwn(KEYS, key) ? KEYS[key] : null;
|
|
124
|
-
if (!spec) res.problems.push(
|
|
125
|
-
else if (!spec.ok(value)) res.problems.push(
|
|
131
|
+
if (!spec) res.problems.push(t('cfg.unknownKey', { key: show(key) }));
|
|
132
|
+
else if (!spec.ok(value)) res.problems.push(t('cfg.badValue', { key, value: show(value), expect: expectText(spec.expect) }));
|
|
126
133
|
else res.values[key] = value;
|
|
127
134
|
}
|
|
128
135
|
// 응답 대기 때 실행할 명령은 다른 사용자가 바꿀 수 없는 파일에서만 받는다.
|
|
@@ -131,8 +138,8 @@ export function readConfigFile(path, { uid = process.getuid?.() } = {}) {
|
|
|
131
138
|
const shared = (st.mode & 0o022) !== 0;
|
|
132
139
|
if (!mine || shared) {
|
|
133
140
|
delete res.values.onWaiting;
|
|
134
|
-
const why = [!mine && '
|
|
135
|
-
res.problems.push(
|
|
141
|
+
const why = [!mine && t('cfg.notMine'), shared && t('cfg.shared', { mode: (st.mode & 0o777).toString(8).padStart(3, '0') })].filter(Boolean).join(', ');
|
|
142
|
+
res.problems.push(t('cfg.onWaitingIgnored', { why }));
|
|
136
143
|
}
|
|
137
144
|
}
|
|
138
145
|
return res;
|
|
@@ -145,18 +152,19 @@ export function resolveConfig({ flags = {}, env = process.env, file } = {}) {
|
|
|
145
152
|
const problems = [...file.problems];
|
|
146
153
|
for (const [key, spec] of Object.entries(KEYS)) {
|
|
147
154
|
const fromEnv = spec.env && env[spec.env[0]] != null ? spec.env[1](env[spec.env[0]]) : undefined;
|
|
148
|
-
if (spec.envProblem && env[spec.env[0]] != null && fromEnv === undefined) problems.push(
|
|
155
|
+
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) }));
|
|
149
156
|
if (flags[key] !== undefined) values[key] = { value: flags[key], source: 'flag' };
|
|
150
157
|
else if (fromEnv !== undefined) values[key] = { value: fromEnv, source: 'env' };
|
|
151
158
|
else if (key in file.values) values[key] = { value: file.values[key], source: 'file' };
|
|
152
|
-
|
|
159
|
+
// 기본값이 함수면 환경에서 고른다 (lang 은 로캘).
|
|
160
|
+
else values[key] = { value: typeof spec.def === 'function' ? spec.def(env) : spec.def, source: 'default' };
|
|
153
161
|
}
|
|
154
162
|
return { path: file.path, exists: file.exists, values, problems };
|
|
155
163
|
}
|
|
156
164
|
|
|
157
165
|
// --print-config 의 사람용 출력.
|
|
158
166
|
export function configText(cfg) {
|
|
159
|
-
const out = [
|
|
167
|
+
const out = [t('cfg.file', { path: stripControl(cfg.path), state: t(cfg.exists ? 'cfg.exists' : 'cfg.missing') }), ''];
|
|
160
168
|
for (const [key, { value, source }] of Object.entries(cfg.values)) {
|
|
161
169
|
const v = value == null ? (key === 'theme' ? 'auto' : '-') : typeof value === 'string' ? JSON.stringify(value) : String(value);
|
|
162
170
|
out.push(`${key.padEnd(14)}${v.padEnd(12)} ${source}`);
|
package/src/doctor.mjs
CHANGED
|
@@ -10,6 +10,7 @@ import { loadSqlite, openReadOnly } from './sqlite.mjs';
|
|
|
10
10
|
import { fmtAgo, pad, stripControl } from './text.mjs';
|
|
11
11
|
import { BRAND } from './brand.mjs';
|
|
12
12
|
import { findNotifier, isWsl } from './notify.mjs';
|
|
13
|
+
import { getLang, t as tr } from './i18n.mjs';
|
|
13
14
|
|
|
14
15
|
const UNIT = { s: '초', m: '분', h: '시간', d: '일' };
|
|
15
16
|
const ago = (ms) => fmtAgo(ms).replace(/[smhd]$/, (u) => UNIT[u]);
|
|
@@ -106,7 +107,7 @@ function claude() {
|
|
|
106
107
|
const running = canListProcesses()
|
|
107
108
|
? ls(join(CLAUDE, 'sessions')).filter((e) => /^\d+\.json$/.test(e.name) && isAlive(Number(e.name.split('.')[0]))).length
|
|
108
109
|
: null;
|
|
109
|
-
if (!files) return { tool: 'claude', state: 'missing', path: tilde(dir), records: 0, lastAt: null, running, readable: null, hint:
|
|
110
|
+
if (!files) return { tool: 'claude', state: 'missing', path: tilde(dir), records: 0, lastAt: null, running, readable: null, hint: null };
|
|
110
111
|
return { tool: 'claude', state: 'ok', path: tilde(dir), records: files.length, lastAt: last?.mtime ?? null, running, readable: last ? firstLineIsJson(last.path) : null, hint: null };
|
|
111
112
|
}
|
|
112
113
|
|
|
@@ -114,7 +115,7 @@ function codex() {
|
|
|
114
115
|
const files = existsSync(CODEX) ? walk(CODEX, 3, (n) => n.startsWith('rollout-') && n.endsWith('.jsonl')) : null;
|
|
115
116
|
const last = files && newest(files);
|
|
116
117
|
const running = canListProcesses() ? findProcesses(isCodex).length : null;
|
|
117
|
-
if (!files) return { tool: 'codex', state: 'missing', path: tilde(CODEX), records: 0, lastAt: null, running, readable: null, hint:
|
|
118
|
+
if (!files) return { tool: 'codex', state: 'missing', path: tilde(CODEX), records: 0, lastAt: null, running, readable: null, hint: null };
|
|
118
119
|
return { tool: 'codex', state: 'ok', path: tilde(CODEX), records: files.length, lastAt: last?.mtime ?? null, running, readable: last ? firstLineIsJson(last.path) : null, hint: null };
|
|
119
120
|
}
|
|
120
121
|
|
|
@@ -132,7 +133,7 @@ function gemini() {
|
|
|
132
133
|
running: canListProcesses() ? findProcesses(isGemini).length : null,
|
|
133
134
|
readable: null,
|
|
134
135
|
keys: last ? topKeys(last.path) : [],
|
|
135
|
-
hint:
|
|
136
|
+
hint: null,
|
|
136
137
|
};
|
|
137
138
|
}
|
|
138
139
|
|
|
@@ -141,9 +142,9 @@ function agy() {
|
|
|
141
142
|
const dir = join(AGY_ROOT, 'conversations');
|
|
142
143
|
const running = canListProcesses() ? findProcesses(isAgy).length : null;
|
|
143
144
|
const files = existsSync(dir) ? walk(dir, 0, (n) => n.endsWith('.db')) : null;
|
|
144
|
-
if (!files) return { tool: 'agy', state: 'missing', path: tilde(AGY_ROOT), records: 0, lastAt: null, running, readable: null, hint:
|
|
145
|
+
if (!files) return { tool: 'agy', state: 'missing', path: tilde(AGY_ROOT), records: 0, lastAt: null, running, readable: null, hint: null };
|
|
145
146
|
const last = newest(files.flatMap((f) => [f, `${f}-wal`]).filter((f) => existsSync(f)));
|
|
146
|
-
if (!loadSqlite()) return { tool: 'agy', state: 'limited', path: tilde(AGY_ROOT), records: files.length, lastAt: last?.mtime ?? null, running, readable: null, hint:
|
|
147
|
+
if (!loadSqlite()) return { tool: 'agy', state: 'limited', path: tilde(AGY_ROOT), records: files.length, lastAt: last?.mtime ?? null, running, readable: null, hint: null };
|
|
147
148
|
let readable = false;
|
|
148
149
|
let db;
|
|
149
150
|
try {
|
|
@@ -157,10 +158,20 @@ function agy() {
|
|
|
157
158
|
return { tool: 'agy', state: 'ok', path: tilde(AGY_ROOT), records: files.length, lastAt: last?.mtime ?? null, running, readable, hint: null };
|
|
158
159
|
}
|
|
159
160
|
|
|
161
|
+
// 도구별 안내 한 줄. 없으면 null. 점검 결과(--json 의 tools.*.hint)에는 예전처럼 한국어로 넣고, --doctor 글은 지금 언어로 다시 만든다.
|
|
162
|
+
export function hintOf(r, lang = 'ko') {
|
|
163
|
+
const o = { lang };
|
|
164
|
+
if (r.tool === 'gemini') return tr('doctor.hint.gemini', null, o);
|
|
165
|
+
if (r.state === 'missing') return r.tool === 'agy' ? tr('doctor.hint.agyMissing', null, o) : tr('doctor.hint.missing', { tool: r.tool }, o);
|
|
166
|
+
if (r.tool === 'agy' && r.state === 'limited') return tr('doctor.hint.agyNode', { node: process.versions.node }, o);
|
|
167
|
+
return null;
|
|
168
|
+
}
|
|
169
|
+
|
|
160
170
|
export function checkTools() {
|
|
161
171
|
const tools = {};
|
|
162
172
|
for (const fn of [claude, codex, gemini, agy]) {
|
|
163
173
|
const r = fn();
|
|
174
|
+
r.hint = hintOf(r, 'ko');
|
|
164
175
|
tools[r.tool] = r;
|
|
165
176
|
}
|
|
166
177
|
const n = findNotifier();
|
|
@@ -168,11 +179,12 @@ export function checkTools() {
|
|
|
168
179
|
}
|
|
169
180
|
|
|
170
181
|
// --notify 에 쓸 데스크톱 알림 도구.
|
|
171
|
-
export function notifierText(n, plat = platform()) {
|
|
172
|
-
|
|
182
|
+
export function notifierText(n, plat = platform(), lang = getLang()) {
|
|
183
|
+
const o = { lang };
|
|
184
|
+
if (n) return tr('doctor.notifier', { kind: n.kind, path: n.path }, o);
|
|
173
185
|
const want = plat === 'darwin' ? 'osascript' : 'notify-send';
|
|
174
|
-
const wsl = plat === 'linux' && isWsl() ? '
|
|
175
|
-
return
|
|
186
|
+
const wsl = plat === 'linux' && isWsl() ? tr('doctor.wsl', null, o) : '';
|
|
187
|
+
return tr('doctor.noNotifier', { want, wsl }, o);
|
|
176
188
|
}
|
|
177
189
|
|
|
178
190
|
// JSON 용: 시각은 ISO 문자열로.
|
|
@@ -185,34 +197,43 @@ export function toolsJson(tools) {
|
|
|
185
197
|
export const MARK = { ok: '✓', missing: '✗', limited: '○' };
|
|
186
198
|
export const STATE_TEXT = { ok: '찾음', missing: '없음', limited: '일부 지원' };
|
|
187
199
|
|
|
188
|
-
|
|
200
|
+
// lang: 빈 화면(세션 없을 때의 점검 줄)과 --doctor 모두 지금 언어가 기본이다.
|
|
201
|
+
export function describe(t, now = Date.now(), lang = getLang()) {
|
|
202
|
+
const o = { lang };
|
|
189
203
|
const parts = [];
|
|
190
|
-
if (t.found === false && t.state === 'limited') parts.push('
|
|
191
|
-
else if (t.state !== 'missing') parts.push(
|
|
192
|
-
if (t.lastAt) parts.push(
|
|
193
|
-
parts.push(t.running == null ? '
|
|
194
|
-
if (t.readable === false) parts.push('
|
|
195
|
-
if (t.keys?.length) parts.push(
|
|
196
|
-
|
|
204
|
+
if (t.found === false && t.state === 'limited') parts.push(tr('doctor.noFolder', null, o));
|
|
205
|
+
else if (t.state !== 'missing') parts.push(tr('doctor.records', { n: t.records.toLocaleString('en-US') }, o));
|
|
206
|
+
if (t.lastAt) parts.push(tr('doctor.last', { ago: lang === 'ko' ? ago(now - t.lastAt) : fmtAgo(now - t.lastAt) }, o));
|
|
207
|
+
parts.push(t.running == null ? tr('doctor.runningUnknown', null, o) : tr('doctor.running', { n: t.running }, o));
|
|
208
|
+
if (t.readable === false) parts.push(tr('doctor.unreadable', null, o));
|
|
209
|
+
if (t.keys?.length) parts.push(tr('doctor.keys', { keys: t.keys.join(', ') }, o));
|
|
210
|
+
// 한국어 안내는 점검 결과에 든 그대로, 다른 언어는 같은 조건으로 다시 만든다.
|
|
211
|
+
const hint = lang === 'ko' || !t.hint ? t.hint : (hintOf(t, lang) ?? t.hint);
|
|
212
|
+
return { mark: MARK[t.state], state: lang === 'ko' ? STATE_TEXT[t.state] : tr(`doctor.state.${t.state}`, null, { lang, short: true }), path: t.path, detail: parts.join(' · '), hint };
|
|
197
213
|
}
|
|
198
214
|
|
|
199
215
|
// aitop --doctor 의 사람용 출력.
|
|
200
|
-
export function doctorText(result, version, now = Date.now()) {
|
|
201
|
-
const
|
|
202
|
-
const
|
|
216
|
+
export function doctorText(result, version, now = Date.now(), lang = getLang()) {
|
|
217
|
+
const o = { lang };
|
|
218
|
+
const os = tr('doctor.os', { platform: result.platform, state: tr(result.processes ? 'doctor.procsOk' : 'doctor.procsNo', null, o) }, o);
|
|
219
|
+
const out = [tr('doctor.title', { logo: BRAND.logo, version, os }, o), ''];
|
|
203
220
|
for (const t of Object.values(result.tools)) {
|
|
204
|
-
const d = describe(t, now);
|
|
221
|
+
const d = describe(t, now, lang);
|
|
205
222
|
out.push(`${d.mark} ${pad(t.tool, 7)}${pad(d.state, 10)}${d.path}`);
|
|
206
223
|
out.push(` ${d.detail}`);
|
|
207
224
|
if (d.hint) out.push(` → ${d.hint}`);
|
|
208
225
|
}
|
|
209
|
-
if ('notifier' in result) out.push('', notifierText(result.notifier, result.platform));
|
|
226
|
+
if ('notifier' in result) out.push('', notifierText(result.notifier, result.platform, lang));
|
|
210
227
|
// 설정 파일: 무시한 키와 값, 받지 않은 onWaiting 을 알린다.
|
|
211
228
|
const cfg = result.config;
|
|
212
229
|
if (cfg) {
|
|
213
|
-
|
|
230
|
+
const state = pad(tr(cfg.exists ? 'doctor.configExists' : 'doctor.configMissing', null, o), 10);
|
|
231
|
+
out.push('', tr('doctor.config', { mark: cfg.problems.length ? '!' : '✓', state, path: tilde(cfg.path) }, o));
|
|
214
232
|
for (const p of cfg.problems) out.push(` ! ${p}`);
|
|
215
233
|
}
|
|
216
|
-
if (result.log)
|
|
234
|
+
if (result.log) {
|
|
235
|
+
const on = result.log.on;
|
|
236
|
+
out.push('', tr('doctor.debug', { mark: on ? '✓' : '○', state: pad(tr(on ? 'doctor.debugOn' : 'doctor.debugOff', null, o), 10), path: tilde(result.log.path), tail: on ? '' : tr('doctor.debugTail', null, o) }, o));
|
|
237
|
+
}
|
|
217
238
|
return stripControl(out.join('\n'));
|
|
218
239
|
}
|