@wooojin/forgen 0.6.1 → 0.6.2
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/.claude-plugin/plugin.json +1 -1
- package/CHANGELOG.md +13 -0
- package/dist/core/statusline-cli.d.ts +9 -1
- package/dist/core/statusline-cli.js +22 -6
- package/package.json +1 -1
- package/plugin.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.6.2] — 2026-10-07 — statusline 이 실제로는 페이로드를 한 번도 받지 못하고 있었다 (socketpair stdin)
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
- **`forgen statusline` 이 Claude Code 가 주는 stdin JSON 을 0.5.9 부터 단 한 번도 읽지 못했다.** Claude Code(Node)는
|
|
14
|
+
statusline 을 `stdio:'pipe'` 로 띄우고 Linux 에서 그 stdin 은 UNIX **socketpair** 인데, 구현이 `fs.readFileSync('/dev/stdin')`
|
|
15
|
+
으로 읽어 소켓에서 ENXIO 로 실패 → 페이로드가 항상 `{}` → 모델명 'Claude', 세션 없음(`statusline-cache-nosession`),
|
|
16
|
+
컨텍스트·한도·소진 예측·관련 룰·세션 모델 캐시 전부 공백. 셸 파이프(`echo … | forgen statusline`)로만 검증해 v0.6.0/0.6.1
|
|
17
|
+
까지 못 잡았고, 배포 후 15시간 실사용 관측(한도 샘플 1건·세션 캐시 nosession 만 갱신)으로 드러났다. 훅과 같은 이벤트
|
|
18
|
+
기반 리더(`read-stdin.ts`, idle/timeout)로 교체. Node `spawn` 으로 socketpair 경로를 그대로 재현하는 회귀 테스트 추가
|
|
19
|
+
(지연 도착·EOF 없음·빈 페이로드 포함).
|
|
20
|
+
- 부수: 세션별 모델 캐시(`current-model-<session>.json`)가 이제야 실제로 기록되므로, 측정된 모델(Opus 4.8 등)에서
|
|
21
|
+
완료 가드가 advise 모드로 동작하는 ADR-010 W4-3 경로도 이번에 처음 live 가 된다.
|
|
22
|
+
|
|
10
23
|
## [0.6.1] — 2026-10-06 — 핫픽스: 임시 경로 예외가 CI(루트 디렉터리 부재)에서 전부 false 이던 것 · self-gate 테스트 픽스처
|
|
11
24
|
|
|
12
25
|
### Fixed
|
|
@@ -44,7 +44,15 @@ export interface StdinPayload {
|
|
|
44
44
|
exceeds_200k_tokens?: boolean;
|
|
45
45
|
[key: string]: unknown;
|
|
46
46
|
}
|
|
47
|
-
|
|
47
|
+
/**
|
|
48
|
+
* stdin 페이로드 읽기 — 훅과 같은 이벤트 기반 리더(read-stdin.ts).
|
|
49
|
+
*
|
|
50
|
+
* 2026-10-07 실사용 관측에서 발견: Claude Code(Node)는 statusline 을 `stdio:'pipe'` 로 띄우므로 stdin 이
|
|
51
|
+
* **UNIX socketpair** 다. 이전 구현의 `fs.readFileSync('/dev/stdin')` 은 소켓에서 ENXIO 로 실패해 페이로드가
|
|
52
|
+
* 항상 `{}` 였다 — 0.5.9 부터 statusline 은 세션/모델/컨텍스트/한도를 한 번도 받은 적이 없었고, 셸 파이프로만
|
|
53
|
+
* 검증해 못 잡았다. (Node spawn 재현 테스트: tests/statusline-stdin-socket.test.ts)
|
|
54
|
+
*/
|
|
55
|
+
export declare function readStdinJson(): Promise<StdinPayload>;
|
|
48
56
|
/** 1줄: 사용자 정보. 데이터 없는 세그먼트는 생략. */
|
|
49
57
|
export declare function buildUserLine(payload: StdinPayload, cwd: string, forecasts: Partial<Record<'five_hour' | 'seven_day', Forecast>>, nowMs: number): string;
|
|
50
58
|
/** 2줄: forgen 정보. 전부 실측 카운터(computeStats = status 와 같은 기준). 실패 시 생략. */
|
|
@@ -38,16 +38,32 @@ const RED = '\x1b[31m';
|
|
|
38
38
|
const BOLD = '\x1b[1m';
|
|
39
39
|
const RESET = '\x1b[0m';
|
|
40
40
|
const SEP = `${DIM} · ${RESET}`;
|
|
41
|
-
|
|
41
|
+
/**
|
|
42
|
+
* stdin 페이로드 읽기 — 훅과 같은 이벤트 기반 리더(read-stdin.ts).
|
|
43
|
+
*
|
|
44
|
+
* 2026-10-07 실사용 관측에서 발견: Claude Code(Node)는 statusline 을 `stdio:'pipe'` 로 띄우므로 stdin 이
|
|
45
|
+
* **UNIX socketpair** 다. 이전 구현의 `fs.readFileSync('/dev/stdin')` 은 소켓에서 ENXIO 로 실패해 페이로드가
|
|
46
|
+
* 항상 `{}` 였다 — 0.5.9 부터 statusline 은 세션/모델/컨텍스트/한도를 한 번도 받은 적이 없었고, 셸 파이프로만
|
|
47
|
+
* 검증해 못 잡았다. (Node spawn 재현 테스트: tests/statusline-stdin-socket.test.ts)
|
|
48
|
+
*/
|
|
49
|
+
export async function readStdinJson() {
|
|
42
50
|
if (process.stdin.isTTY)
|
|
43
51
|
return {};
|
|
44
52
|
try {
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
53
|
+
const { readStdinJSON } = await import('../hooks/shared/read-stdin.js');
|
|
54
|
+
const parsed = await readStdinJSON(1500);
|
|
55
|
+
// 부모(Claude Code)가 stdin 을 닫지 않아도 프로세스가 EOF 를 기다리며 남지 않도록 핸들을 놓는다.
|
|
56
|
+
try {
|
|
57
|
+
process.stdin.destroy();
|
|
58
|
+
}
|
|
59
|
+
catch { /* ignore */ }
|
|
60
|
+
return parsed && typeof parsed === 'object' ? parsed : {};
|
|
49
61
|
}
|
|
50
62
|
catch {
|
|
63
|
+
try {
|
|
64
|
+
process.stdin.destroy();
|
|
65
|
+
}
|
|
66
|
+
catch { /* ignore */ }
|
|
51
67
|
return {};
|
|
52
68
|
}
|
|
53
69
|
}
|
|
@@ -220,7 +236,7 @@ export function renderStatusline(payload, nowMs = Date.now(), opts = {}) {
|
|
|
220
236
|
return lines;
|
|
221
237
|
}
|
|
222
238
|
export async function handleStatusline() {
|
|
223
|
-
await handleStatuslineWith(readStdinJson());
|
|
239
|
+
await handleStatuslineWith(await readStdinJson());
|
|
224
240
|
}
|
|
225
241
|
/** stdin 읽기를 분리한 본체 — 테스트는 페이로드를 직접 넣는다. */
|
|
226
242
|
export async function handleStatuslineWith(payload, nowMs = Date.now()) {
|
package/package.json
CHANGED
package/plugin.json
CHANGED