@litfamily/litmuse 0.1.20 → 0.1.21

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/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.21 — 2026-11-25
4
+
5
+ - `litmuse status --card` and `--watch` draw a framed card in a dark truecolor terminal of 64 columns or more (it was 90): workflow and state on the top edge, a stage map with the current stage as a pill, the plan or goal with a gauge and the next row, the tool that finished last, aligned rows for threads and child agents, skill chips, and context, git branch, plan file and time on the bottom edge. A part with no record is left out. The version moved from the pill to the bottom edge, and a finished plan shows `DONE ✓` there in place of the `✨` line. `--json`, a pipe, `NO_COLOR`, 256 or fewer colours, a light background and narrower terminals print what they did before.
6
+ - The context figure is Muse's own estimate of its last prompt, as a share of the model catalog's window when every listed model has the same one.
7
+ - One rule decides round or square ends for the card and the installer: `LITMUSE_GLYPHS` (`round` or `basic`), then the terminal, then, off SSH, whether an icon font is installed. The card no longer shows `[ ]` gauges.
8
+ - `litmuse install` centres the mark over its cards, shows the work in one card that folds to a single row, and closes with one card of what was installed and what comes next. The approvals question shows a count; `l` prints every hook and agent before you answer. A failed install names the stage, the reason and the next step. The questions, their order, their defaults and the stored answers are unchanged, and the plain lines of `--yes`, `--dry-run`, a pipe, CI and small windows are too.
9
+ - The README cover is a new loop: a terminal in the sunset look with the watched status card, a pixel LITFAMILY wordmark and a striped half-sunk sun, in place of the seven robot panels. The still for reduced motion is its first frame; the packed files are smaller.
10
+ - The README demo is a new silent loop of one request with the watched status card in its own pane (plan and goal counts, lanes, `DONE ✓`, the sunset), replacing the old still of three commands; the Korean page has its own copy, kept out of the package. The Muse screen around the card is redrawn.
11
+ - At a terminal, `litmuse install`, `update` and `uninstall` draw the plan, the questions, each finished step and the closing summary as cards. A question card names its step, says what Yes does and what No leaves alone, and marks the default: `y` or `n` answers at once, the arrow keys or Tab move, Enter takes the highlight, Esc answers nothing. The questions, their order, their defaults and the stored answers are unchanged, and Ctrl+C still ends with the same message and exit code 1.
12
+ - A failed install shows what went wrong in a red card, with the remedy below it as text you can copy. The `muse plugins approve` lines stay one per line too.
13
+ - `NO_COLOR` keeps the cards without colour; a locale without UTF-8 draws them in ASCII. `--yes`, `--dry-run`, `TERM=dumb`, `LITMUSE_AGENT_FILE`, a pipe, CI and a window under 40 columns or 12 rows print exactly what they printed before.
14
+ - No hook or context file changed, so Muse asks for no new hook approval.
15
+ - The test suite runs in a throwaway home; before, a SessionStart test could claim the waiting first-session notice in the real `~/.local/share/litmuse`.
16
+
3
17
  ## 0.1.20 — 2026-11-25
4
18
 
5
19
  - `litmuse status --card` shows a sunset beside the words in a truecolor terminal of 90 columns or more: a half-sunk sun, stars and a sea, drawn only in cells that hold no text. It is dim with no route, amber on `YOUR TURN` and rainbow for `lit-adhd`. The version pill runs orange to pink there, thread branches turn neon and the current stage is filled violet to cyan. Row count, words and widths are unchanged, and a pipe, `--json`, `NO_COLOR`, 256 or fewer colours, a light background (`COLORFGBG`) and narrower terminals print what they did before.
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- <p align="center"><picture><source media="(prefers-reduced-motion: reduce)" srcset="./docs/assets/cover-motion-still.webp" /><img src="./docs/assets/cover-motion.webp" width="100%" alt="LitFamily motion cover: seven armored robots power on one by one, the LitMuse robot in the sixth bay wakes with a lime visor and a lit frame, then LITFAMILY and KEEP THE WORK LIT. light up." /></picture></p>
1
+ <p align="center"><picture><source media="(prefers-reduced-motion: reduce)" srcset="./docs/assets/cover-motion-still.webp" /><img src="./docs/assets/cover-motion.webp" width="100%" alt="LitFamily motion cover: a terminal in a sunset look. The round-cornered card of litmuse status --card for a start-work route frames the screen with its stage map, task gauge, skill pills and lanes, a pixel LITFAMILY wordmark and a striped half-sunk sun fill the middle, the row of seven product names lights LITMUSE, and a shell prompt holds the command at the bottom." /></picture></p>
2
2
 
3
3
  <h1 align="center">LitMuse</h1>
4
4
  <p align="center"><strong>Keep the work lit.</strong></p>
@@ -93,7 +93,11 @@ it does loads lit-plan, reads the repo, writes plans/todo-app.md with ordere
93
93
  it ends "Plan saved. Run /start-work when you are happy with it."
94
94
  ```
95
95
 
96
- <p align="center"><img src="./docs/assets/readme/demo.webp" width="960" alt="Terminal card of three real commands in a test project. muse --version prints Muse Code 1.4.14. litmuse status --card shows the lit-plan route active for 30s with plan 0/2 in plans/todo-app.md and next row 1, Add the shout flag. litmuse models lists muse-spark-1.3 (default) and muse-spark-1.2 with their effort levels." /></p>
96
+ Muse draws no card of its own, so LitMuse's card runs in a second pane: `litmuse status --card --watch`. In the loop below one request goes through it. The route lights up, the plan and the goal show their counts, two lanes run, the plan rows get ticked, and at 3/3 `DONE ✓` sits on the card's top edge.
97
+
98
+ <p align="center"><img src="./docs/assets/readme/demo.webp" width="960" alt="A silent loop of Muse Code with a second pane running `litmuse status --card --watch`. After the prompt &quot;lit add a --shout flag that prints the greeting in capitals, with a test&quot;, the card shows lit-loop active, plan 0/3 and goal 0/1, two running lanes, lit-executor and lit-verifier, and the plan rows being ticked. At 3/3 DONE ✓ sits on the card's top edge; fifteen minutes later the card idles under a dimmed sunset." /></p>
99
+
100
+ <p align="center"><sub>The card is LitMuse's own output; the Muse screen around it is redrawn. The last scene is fifteen minutes later.</sub></p>
97
101
 
98
102
  Headless runs work the same way: `muse exec --json "lit plan a tiny todo app" < /dev/null`.
99
103
 
@@ -173,6 +177,8 @@ The bottom row of the picture covers why an update may ask again, what install l
173
177
 
174
178
  `install`, `update`, `doctor` and `--help` open with the synthwave LIT mark, so you can tell at a glance which tool is talking. It is drawn for the terminal it lands in: full colour in a truecolor or 256-colour terminal, the same picture without colour when colour is off (`NO_COLOR`, `TERM=dumb`, an 8-colour terminal), and the single line `LIT · muse code` when the output goes to a pipe, a log or the model's bash tool, or the window is narrower than 24 columns. `doctor --json` prints no mark.
175
179
 
180
+ In a terminal window of at least 40 columns and 12 rows, the plan, the questions, the work and the closing summary are drawn as cards. A question names its step (`LIT 1/2`), says in one sentence what Yes does and what No leaves alone, and marks the default: press `y` or `n`, or move with the arrow keys or `Tab` and press Enter. In the approvals question, `l` prints all the hooks and agents before you answer. Esc answers nothing, and Ctrl+C stops the installer. `NO_COLOR` keeps the cards without colour and a locale without UTF-8 draws them in ASCII. With `--yes`, `--dry-run`, `TERM=dumb`, `LITMUSE_AGENT_FILE` set, a pipe or CI, the same text prints as plain lines.
181
+
176
182
  <details>
177
183
  <summary>Install switches</summary>
178
184
 
@@ -208,27 +214,27 @@ Use only the official npm package @litfamily/litmuse. Show me your plan and wait
208
214
 
209
215
  Muse's `/hud` is a fixed list of on/off fields, so plugins add nothing to it. LitMuse keeps its own live record of the route, the plan progress and the child agents running right now, and `/lit-status` and `litmuse status --card` show it. The recommended `/hud` and theme preset for the terminal chrome around the card lives in [docs/hud-preset.md](./docs/hud-preset.md).
210
216
 
211
- Read the card from top to bottom. The first line names the workflow and how long it has run, or says no route is active in this workspace; a second line names the plan file with ticked and total rows and the next open row. A lanes line names each running tool with its elapsed time, then each finished lane.
217
+ In a dark truecolor terminal of 64 columns or more the card is framed. The top edge names the workflow and, on the right, its state (`RED ●`, `YOUR TURN ●`, `DONE ✓`, `idle`). Under it come the stages of the run with the current one as a pill, then the plan or goal with a gauge and the next open row, then the tool that finished last. Each thread and child agent has a row with its own gauge or clock, and the planned skills stand under them. The bottom edge holds how full the context is, the git branch, the plan file and how long the run has lasted. A part LitMuse has no record for is left out. Elsewhere the card is plain text: the workflow and its time, the plan with its ticked and total rows and the next open row, and the lanes.
212
218
 
213
- At rest the card reports no active route:
219
+ At rest the card is dim and says there is no active route:
214
220
 
215
- <p align="center"><img src="./docs/assets/card/idle.webp" width="960" alt="Terminal card of litmuse status --card with no route running: LIT, no active route in this workspace, plan 0/2 in plans/todo-app.md, next row 1, Add the shout flag. A dimmed half-sunk sun with stars and a sea sits to the right of the words." /></p>
221
+ <p align="center"><img src="./docs/assets/card/idle.webp" width="960" alt="Framed terminal card of litmuse status --card with no route running, dimmed: LIT, ready, READY, task 0/2 with a gauge, next 1. Add the shout flag, the branch main and the plan file on the bottom edge, and a dim half-sunk sun." /></p>
216
222
 
217
- While a plan runs, the card names the route, the plan file, and the next open row:
223
+ While a plan runs, the card names the route, its stage, and the next open row:
218
224
 
219
- <p align="center"><img src="./docs/assets/card/working.webp" width="960" alt="Terminal card of litmuse status --card while lit-plan runs: LIT, lit-plan, active 30s, one lit-plan thread running, plan 0/2 in plans/todo-app.md, next row 1, Add the shout flag. A bright sunset over a sea sits to the right of the words." /></p>
225
+ <p align="center"><img src="./docs/assets/card/working.webp" width="960" alt="Framed terminal card of litmuse status --card while lit-plan runs: the state PLAN on the top edge, the stage map with plan as a pill, task 0/2 with a gauge, next 1. Add the shout flag, one lit-plan thread running, the lit-plan skill chip, and a bright sunset." /></p>
220
226
 
221
227
  Ticking a row moves the count and the next-row pointer:
222
228
 
223
- <p align="center"><img src="./docs/assets/card/after.webp" width="960" alt="The same card after row 1 is ticked: plan 1/2 in plans/todo-app.md, next row 2, Write the tests." /></p>
229
+ <p align="center"><img src="./docs/assets/card/after.webp" width="960" alt="The same card after row 1 is ticked: task 1/2 with a half-filled gauge, next 2. Write the tests." /></p>
224
230
 
225
- Run in a terminal, `litmuse status --card` also puts the mark above the card, and a truecolor terminal gets a gradient `🔥LIT v<version>` pill at the start of its first line. A truecolor terminal of 90 columns or more also gets a sunset beside the words: a half-sunk sun with stars above it and a sea running out from it. It uses only cells that hold no text and adds no row, so on a card full of long rows it moves up or stays away. The sun is dim while no route runs, amber while the card says `YOUR TURN`, and rainbow during `lit-adhd`. When `/lit-status` has the model run the card through its bash tool, or colour is off, the card keeps its plain `LIT ·` headline, and `--json` prints only the record.
231
+ Run in a terminal, `litmuse status --card` also puts the mark above the card. In the framed card a half-sunk sun with stars above it and a sea running out from it fills cells that hold no text; a card with no room for it grows a row or two. The sun is dim while no route runs, amber while the card waits for you, and rainbow during `lit-adhd`. Pills and gauges have round ends when your terminal or an installed icon font can draw them, and are square everywhere otherwise; `LITMUSE_GLYPHS=round` or `basic` decides it. When `/lit-status` has the model run the card through its bash tool, or colour is off, the card keeps its plain `LIT ·` headline, and `--json` prints only the record.
226
232
 
227
- To keep the card open beside your work, add `--watch`. It fills the terminal, puts a neon frame around the card and, while your Muse session is working, lets the sea flow, the stars twinkle and light run across the sun. When the session stops, or nothing has happened for 15 minutes, the picture holds still and only the words and times keep up. Press `q` or Ctrl+C and your terminal comes back as it was.
233
+ To keep the card open beside your work, add `--watch`. It takes over the terminal and, while your Muse session is working, lets the sea flow, the stars twinkle and light run across the sun and the pills. When the session stops, or nothing has happened for 15 minutes, the picture holds still and only the words and times keep up. Press `q` or Ctrl+C and your terminal comes back as it was.
228
234
 
229
- <p align="center"><picture><source media="(prefers-reduced-motion: reduce)" srcset="./docs/assets/card/watch-still.webp" /><img src="./docs/assets/card/watch.webp" width="960" alt="Moving terminal card of litmuse status --card --watch while lit-plan runs: a neon frame from pink through violet to cyan around the card, with the sea flowing out from a half-sunk sun and stars twinkling above it." /></picture></p>
235
+ <p align="center"><picture><source media="(prefers-reduced-motion: reduce)" srcset="./docs/assets/card/watch-still.webp" /><img src="./docs/assets/card/watch.webp" width="960" alt="Moving framed card of litmuse status --card --watch while lit-plan runs: a neon frame from pink through violet to cyan, light running across the plan pill and the skill chip, a sea flowing out from a half-sunk sun and stars twinkling above it." /></picture></p>
230
236
 
231
- This runs in your own shell, in a second window or pane, because Muse draws no plugin text inside its screen. `LITMUSE_MOTION=off` keeps the scene and stops the motion; `NO_COLOR`, fewer colours, or under 90 columns show the plain card, kept up to date.
237
+ This runs in your own shell, in a second window or pane, because Muse draws no plugin text inside its screen. `LITMUSE_MOTION=off` keeps the scene and stops the motion; `NO_COLOR`, fewer colours, a light background, or under 64 columns show the plain card, kept up to date.
232
238
 
233
239
  The card reads the hook-kept state under `~/.local/state/litmuse/`, outside the project. How it lists other sessions is in [the reference](./docs/reference.md#the-live-record-behind-the-card).
234
240
 
@@ -432,7 +438,7 @@ The installer writes to `~/.local/share/litmuse/` and, through the `muse` CLI, t
432
438
 
433
439
  ## Family
434
440
 
435
- LitMuse is one of the seven LitFamily packages, and the seven armored robots on the cover stand for them. Each package brings the same way of working to one coding agent and installs and runs on its own, so you only need the one for the agent you use.
441
+ LitMuse is one of the seven LitFamily packages, and the row of product names on the cover lists all seven. Each package brings the same way of working to one coding agent and installs and runs on its own, so you only need the one for the agent you use.
436
442
 
437
443
  ## License
438
444
 
package/README_ko-KR.md CHANGED
@@ -1,4 +1,4 @@
1
- <p align="center"><picture><source media="(prefers-reduced-motion: reduce)" srcset="./docs/assets/cover-motion-still.webp" /><img src="./docs/assets/cover-motion.webp" width="100%" alt="LitFamily 모션 커버: 일곱 로봇 패널이 차례로 켜지고, 여섯 번째 칸의 LitMuse 로봇이 라임색 바이저와 테두리를 밝힌 뒤 LITFAMILY와 KEEP THE WORK LIT. 문구가 밝아지는 영상" /></picture></p>
1
+ <p align="center"><picture><source media="(prefers-reduced-motion: reduce)" srcset="./docs/assets/cover-motion-still.webp" /><img src="./docs/assets/cover-motion.webp" width="100%" alt="LitFamily 모션 커버: 노을빛 터미널 화면입니다. litmuse status --card가 그린 start-work 경로의 모서리가 둥근 카드가 단계 지도, 작업 게이지, 스킬 알약, 레인과 함께 화면을 두르고, 가운데는 픽셀 글자 LITFAMILY와 줄무늬 해가 채우며 일곱 제품 이름 줄에서 LITMUSE가 켜지고, 아래에서는 셸 프롬프트에 그 명령이 놓여 있습니다." /></picture></p>
2
2
 
3
3
  <h1 align="center">LitMuse</h1>
4
4
  <p align="center"><strong>Keep the work lit.</strong></p>
@@ -84,7 +84,11 @@ npx @litfamily/litmuse doctor
84
84
  마무리 "계획을 저장했습니다. 괜찮으면 /start-work를 실행하세요."
85
85
  ```
86
86
 
87
- <p align="center"><img src="./docs/assets/readme/demo.webp" width="960" alt="테스트 프로젝트에서 실행한 실제 명령 세 개의 터미널 카드. muse --version은 Muse Code 1.4.14를 출력합니다. litmuse status --card는 lit-plan 경로가 30초째 활성이고 plans/todo-app.md 계획이 0/2이며 다음 행이 1. Add the shout flag임을 보여 줍니다. litmuse models는 muse-spark-1.3(기본)과 muse-spark-1.2, 각 모델의 effort 단계를 보여 줍니다." /></p>
87
+ Muse 안에는 카드를 그릴 자리가 없어서 LitMuse의 카드는 둘째 창에서 돕니다: `litmuse status --card --watch`. 아래 영상은 요청 하나가 카드를 지나가는 모습입니다. 경로가 켜지고, 계획과 목표가 개수를 보여 주고, 레인 두 개가 돌고, 계획 행이 하나씩 체크되며, 3/3이 되면 `DONE ✓`가 카드 윗줄에 놓입니다.
88
+
89
+ <p align="center"><img src="./docs/assets/readme/demo-ko.webp" width="960" alt="Muse Code 옆 창에서 `litmuse status --card --watch`를 돌리는 무음 반복 영상입니다. 프롬프트 &quot;lit add a --shout flag that prints the greeting in capitals, with a test&quot; 뒤에 카드는 lit-loop 활성, 계획 0/3, 목표 0/1, 실행 중인 lit-executor와 lit-verifier 두 레인, 하나씩 체크되는 계획 행을 보여 줍니다. 3/3이 되면 DONE ✓가 카드 윗줄에 놓이고, 15분 뒤 카드는 어두워진 노을 아래서 쉽니다." /></p>
90
+
91
+ <p align="center"><sub>카드는 LitMuse가 직접 만든 출력이고, 그 주변의 Muse 화면은 다시 그린 것입니다. 마지막 장면은 15분 뒤입니다.</sub></p>
88
92
 
89
93
  헤드리스 실행도 같습니다: `muse exec --json "lit plan a tiny todo app" < /dev/null`.
90
94
 
@@ -164,6 +168,8 @@ npx @litfamily/litmuse doctor
164
168
 
165
169
  `install`, `update`, `doctor`, `--help`는 맨 위에 신스웨이브 LIT 마크를 찍어서, 어느 도구가 말하는지 한눈에 보이게 합니다. 마크는 출력되는 터미널에 맞춰 그려집니다. truecolor나 256색 터미널에서는 컬러로, 색이 꺼져 있으면(`NO_COLOR`, `TERM=dumb`, 8색 터미널) 같은 그림이 색 없이 나옵니다. 출력이 파이프나 로그, 모델의 bash 도구로 가거나 창 폭이 24칸보다 좁으면 `LIT · muse code` 한 줄만 나옵니다. `doctor --json`에는 마크가 없습니다.
166
170
 
171
+ 40칸 12줄 이상인 터미널 창에서는 설치 계획, 질문, 진행 상황, 마지막 요약이 카드로 나옵니다. 질문 카드는 몇 번째 질문인지(`LIT 1/2`) 알려 주고, 예라고 하면 무엇을 하고 아니요라고 하면 무엇을 그대로 두는지 한 문장으로 말하며, 기본값을 표시합니다. `y`나 `n`을 누르면 바로 답이 되고, 화살표 키나 `Tab`으로 옮긴 뒤 Enter를 눌러도 됩니다. 승인 질문에서 `l`을 누르면 답하기 전에 훅과 에이전트를 모두 볼 수 있습니다. Esc는 아무 답도 하지 않고, Ctrl+C는 설치를 멈춥니다. `NO_COLOR`를 설정하면 색 없는 카드가, UTF-8이 아닌 로캘에서는 ASCII 카드가 나옵니다. `--yes`, `--dry-run`, `TERM=dumb`, `LITMUSE_AGENT_FILE`을 쓰거나 파이프, CI에서 실행하면 같은 내용이 일반 텍스트로 나옵니다.
172
+
167
173
  <details>
168
174
  <summary>설치 옵션</summary>
169
175
 
@@ -199,27 +205,27 @@ Meta Muse Code용 LitFamily 플러그인인 LitMuse를 설치해 줘.
199
205
 
200
206
  Muse의 `/hud`는 켜고 끄는 고정 항목 목록이라서 플러그인 글은 올릴 수 없습니다. 그래서 LitMuse는 경로, 계획 진행, 지금 돌고 있는 자식 에이전트를 담은 자체 실시간 기록을 두고, `/lit-status`와 `litmuse status --card`로 보여 줍니다. 카드 주변 터미널 모양의 추천 `/hud`와 테마 프리셋은 [docs/hud-preset.md](./docs/hud-preset.md)에 있습니다.
201
207
 
202
- 카드는 위에서 아래로 읽습니다. 첫 줄은 워크플로 이름과 실행 시간을 적고, 활성 경로가 없으면 없다고 적습니다. 둘째 줄은 계획 파일 이름과 체크한 행 수, 전체 행 수, 다음으로 풀 행을 적고, 레인 줄은 실행 중인 도구와 경과 시간, 끝난 레인을 적습니다.
208
+ 어두운 truecolor 터미널이 64칸 이상이면 카드에 테두리가 생깁니다. 위쪽 테두리 왼쪽에는 워크플로 이름, 오른쪽에는 상태(`RED ●`, `YOUR TURN ●`, `DONE ✓`, `idle`)가 있습니다. 그 아래로 단계가 이어지고 지금 단계는 알약으로 보이며, 다음 줄에 계획이나 목표의 게이지와 다음 행, 방금 끝난 도구가 나옵니다. 스레드와 자식 에이전트는 한 줄씩 게이지나 시간을 달고, 그 밑에 쓰기로 한 스킬이 있습니다. 아래쪽 테두리에는 컨텍스트가 찬 정도, git 브랜치, 계획 파일, 실행 시간이 적힙니다. 기록이 없는 항목은 나오지 않습니다. 다른 터미널에서는 글로만 된 카드가 나옵니다. 워크플로와 실행 시간, 체크한 행과 전체 행과 다음 행, 레인을 적습니다.
203
209
 
204
210
  쉴 때 카드는 활성 경로가 없다고 알립니다.
205
211
 
206
- <p align="center"><img src="./docs/assets/card/idle.webp" width="960" alt="실행 중인 경로가 없을 때의 litmuse status --card 터미널 카드. 이 워크스페이스에 활성 경로가 없고, plans/todo-app.md 계획은 0/2, 다음 행은 1. Add the shout flag입니다. 글 오른쪽에 어두운 반쯤 잠긴 해와 별, 바다가 있습니다." /></p>
212
+ <p align="center"><img src="./docs/assets/card/idle.webp" width="960" alt="실행 중인 경로가 없을 때의 litmuse status --card 테두리 카드. 어두운 색으로 LIT, ready, READY, 게이지가 달린 task 0/2, 다음 행 1. Add the shout flag, 아래 테두리의 main 브랜치와 계획 파일, 어두운 반쯤 잠긴 해가 보입니다." /></p>
207
213
 
208
214
  계획이 돌 때 카드는 경로와 계획 파일, 다음 행을 보여 줍니다.
209
215
 
210
- <p align="center"><img src="./docs/assets/card/working.webp" width="960" alt="lit-plan이 실행 중일 때의 litmuse status --card 터미널 카드. lit-plan이 30초째 활성이고 lit-plan 스레드 하나가 실행 중이며, plans/todo-app.md 계획은 0/2, 다음 행은 1. Add the shout flag입니다. 글 오른쪽에 밝은 노을과 바다가 있습니다." /></p>
216
+ <p align="center"><img src="./docs/assets/card/working.webp" width="960" alt="lit-plan이 실행 중일 때의 litmuse status --card 테두리 카드. 위 테두리에 PLAN, 단계 줄에는 plan이 알약으로 있고, 게이지가 달린 task 0/2, 다음 행 1. Add the shout flag, 실행 중인 lit-plan 스레드, lit-plan 스킬 칩, 밝은 노을이 보입니다." /></p>
211
217
 
212
218
  행에 체크하면 개수와 다음 행 표시가 바뀝니다.
213
219
 
214
- <p align="center"><img src="./docs/assets/card/after.webp" width="960" alt="1번 행을 체크한 뒤의 같은 카드. plans/todo-app.md 계획이 1/2가 되고 다음 행은 2. Write the tests입니다." /></p>
220
+ <p align="center"><img src="./docs/assets/card/after.webp" width="960" alt="1번 행을 체크한 뒤의 같은 카드. task 1/2 게이지가 반쯤 차고 다음 행은 2. Write the tests입니다." /></p>
215
221
 
216
- 터미널에서 `litmuse status --card`를 실행하면 카드 위에 마크가 붙고, truecolor 터미널이면 첫 줄 맨 앞에 그라데이션 `🔥LIT v<버전>` 알약도 붙습니다. 90칸 이상인 truecolor 터미널에서는 글 옆에 노을도 나옵니다. 반쯤 잠긴 해 위에 별이 있고, 해에서 바다가 퍼져 나갑니다. 글이 없는 칸에만 그리고 줄을 늘리지 않으므로, 긴 줄이 많으면 위로 옮겨 가거나 나오지 않습니다. 해는 활성 경로가 없으면 어둡고, 카드에 `YOUR TURN`이 뜨면 호박색, `lit-adhd` 때는 무지개색입니다. `/lit-status`가 모델의 bash 도구로 카드를 돌릴 때나 색이 꺼져 있을 때는 원래의 `LIT ·` 머리줄이 그대로 남고, `--json`은 기록만 출력합니다.
222
+ 터미널에서 `litmuse status --card`를 실행하면 카드 위에 마크도 붙습니다. 테두리 카드에서는 반쯤 잠긴 해와 그 위의 별, 해에서 퍼지는 바다가 글이 없는 칸을 채우고, 자리가 없으면 카드가 한두 줄 늘어납니다. 해는 활성 경로가 없으면 어둡고, 카드가 사용자를 기다리면 호박색, `lit-adhd` 때는 무지개색입니다. 터미널이나 설치된 아이콘 글꼴이 둥근 끝을 그릴 수 있으면 알약과 게이지가 모두 둥글고, 아니면 모두 네모입니다. `LITMUSE_GLYPHS=round`나 `basic`으로 직접 정할 수 있습니다. `/lit-status`가 모델의 bash 도구로 카드를 돌릴 때나 색이 꺼져 있을 때는 원래의 `LIT ·` 머리줄이 그대로 남고, `--json`은 기록만 출력합니다.
217
223
 
218
- 카드를 작업 옆에 계속 띄워 두려면 `--watch`를 붙입니다. 카드가 터미널을 채우고 네온 테두리가 생기며, Muse 세션이 일하는 동안 바다가 흐르고 별이 반짝이고 해 위로 빛이 지나갑니다. 세션이 멈추거나 15분 동안 아무 일이 없으면 그림은 멈추고 글과 시간만 갱신됩니다. `q`나 Ctrl+C를 누르면 터미널이 원래대로 돌아옵니다.
224
+ 카드를 작업 옆에 계속 띄워 두려면 `--watch`를 붙입니다. 카드가 터미널을 차지하고, Muse 세션이 일하는 동안 바다가 흐르고 별이 반짝이고 해와 알약 위로 빛이 지나갑니다. 세션이 멈추거나 15분 동안 아무 일이 없으면 그림은 멈추고 글과 시간만 갱신됩니다. `q`나 Ctrl+C를 누르면 터미널이 원래대로 돌아옵니다.
219
225
 
220
- <p align="center"><picture><source media="(prefers-reduced-motion: reduce)" srcset="./docs/assets/card/watch-still.webp" /><img src="./docs/assets/card/watch.webp" width="960" alt="lit-plan이 실행 중일 때 움직이는 litmuse status --card --watch 터미널 카드. 분홍에서 보라, 하늘색으로 이어지는 네온 테두리 안에서 반쯤 잠긴 해로부터 바다가 흐르고 위에서 별이 반짝입니다." /></picture></p>
226
+ <p align="center"><picture><source media="(prefers-reduced-motion: reduce)" srcset="./docs/assets/card/watch-still.webp" /><img src="./docs/assets/card/watch.webp" width="960" alt="lit-plan이 실행 중일 때 움직이는 litmuse status --card --watch 테두리 카드. 분홍에서 보라, 하늘색으로 이어지는 네온 테두리 안에서 plan 알약과 스킬 칩 위로 빛이 지나가고, 반쯤 잠긴 해에서 바다가 흐르며 별이 반짝입니다." /></picture></p>
221
227
 
222
- Muse는 자기 화면 안에 플러그인 글을 그리지 않으므로, 이 카드는 다른 창이나 분할 창에 연 셸에서 실행합니다. `LITMUSE_MOTION=off`면 장면은 그대로 두고 움직임만 멈춥니다. `NO_COLOR`, 색이 적은 터미널, 90칸 미만에서는 계속 갱신되는 일반 카드를 보여 줍니다.
228
+ Muse는 자기 화면 안에 플러그인 글을 그리지 않으므로, 이 카드는 다른 창이나 분할 창에 연 셸에서 실행합니다. `LITMUSE_MOTION=off`면 장면은 그대로 두고 움직임만 멈춥니다. `NO_COLOR`, 색이 적은 터미널, 밝은 배경, 64칸 미만에서는 계속 갱신되는 일반 카드를 보여 줍니다.
223
229
 
224
230
  카드는 프로젝트 밖에 있는 `~/.local/state/litmuse/` 아래 훅 기록을 읽습니다. 다른 세션을 어떻게 보여 주는지는 [참고 자료](./docs/reference_ko-KR.md#카드-뒤의-실시간-기록)에 있습니다.
225
231
 
@@ -423,7 +429,7 @@ npx @litfamily/litmuse extensions prune-backups --older-than 30 --yes
423
429
 
424
430
  ## 패밀리
425
431
 
426
- LitMuse는 LitFamily 패키지 일곱 개 가운데 하나이고, 표지의 로봇 일곱이 그 일곱 패키지입니다. 패키지마다 코딩 에이전트 하나에 같은 작업 방식을 들여오며 각자 따로 설치되어 동작하므로, 쓰는 에이전트에 맞는 하나만 설치하면 됩니다.
432
+ LitMuse는 LitFamily 패키지 일곱 개 가운데 하나이고, 표지의 제품 이름 줄이 그 일곱 패키지를 모두 보여 줍니다. 패키지마다 코딩 에이전트 하나에 같은 작업 방식을 들여오며 각자 따로 설치되어 동작하므로, 쓰는 에이전트에 맞는 하나만 설치하면 됩니다.
427
433
 
428
434
  ## 라이선스
429
435
 
package/bin/litmuse.mjs CHANGED
@@ -17,6 +17,7 @@ import { styleCommand } from '../lib/style.mjs';
17
17
  import { runRewindCli } from '../plugin/lib/rewind/collect.mjs';
18
18
  import { extensionsCommand } from '../lib/extensions.mjs';
19
19
  import { markFor } from '../lib/mark.mjs';
20
+ import { cardsFor } from '../lib/install-cards.mjs';
20
21
 
21
22
  const HELP = `LitMuse ${packageVersion()}: LitFamily workflows for Meta's Muse Code
22
23
 
@@ -107,11 +108,13 @@ async function main() {
107
108
  }
108
109
  switch (command) {
109
110
  case 'install':
110
- case 'update':
111
- print(markFor({ env }));
112
- return install({ env, flags, interactive, ask, print });
111
+ case 'update': {
112
+ const cards = cardsFor({ env, flags });
113
+ if (!cards) print(markFor({ env }));
114
+ return install({ env, flags, interactive, ask: cards?.ask ?? ask, print, cards });
115
+ }
113
116
  case 'uninstall':
114
- return uninstall({ env, flags, interactive, print });
117
+ return uninstall({ env, flags, interactive, print, cards: cardsFor({ env, flags }) });
115
118
  case 'doctor':
116
119
  if (!flags.json) print(markFor({ env }));
117
120
  return doctor({ env, flags, print });
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -22,6 +22,13 @@ const BLOCK_FILE = join(dirname(fileURLToPath(import.meta.url)), 'agent-file-blo
22
22
  const CONFIG_CMD = 'npx @litfamily/litmuse config agentFile';
23
23
  const QUESTION = 'Add the short LitFamily block to your Muse user rules file? Your own text stays as it is. [Y/n] ';
24
24
 
25
+ const CARD = {
26
+ title: 'Rules file',
27
+ note: 'Adds the short LitFamily block to your Muse user rules file. Your own text stays as it is; No leaves the file alone, and later installs stop asking.',
28
+ yes: 'add',
29
+ no: 'off',
30
+ };
31
+
25
32
  export const agentFileBody = () => readFileSync(BLOCK_FILE, 'utf8');
26
33
 
27
34
  function readConfig(env) {
@@ -160,8 +167,15 @@ export function agentFilePlan({ env, flags }) {
160
167
  return `Would add the LitFamily block to ${path} (asks first; --yes adds it, --no-agent-file skips)`;
161
168
  }
162
169
 
170
+ /** True when the install step would ask about the block (a rules file LitMuse cannot write is reported, never asked about). */
171
+ export function agentFileAsks({ env, flags, interactive, ask, version }) {
172
+ const { mode, stored } = readAgentFileSetting(env);
173
+ if (flags.noAgentFile || mode === 'off' || flags.yes || stored === 'on' || !interactive || !ask) return false;
174
+ return agentFileState({ path: paths(env).museRules, version }) === 'absent';
175
+ }
176
+
163
177
  /** The install step: adds or refreshes the block when the setting and the user's answer allow it. Returns the paths it wrote. */
164
- export async function installAgentFile({ env, flags, interactive, ask, print, version, backupDir }) {
178
+ export async function installAgentFile({ env, flags, interactive, ask, print, version, backupDir, tag }) {
165
179
  const path = paths(env).museRules;
166
180
  const { mode, stored } = readAgentFileSetting(env);
167
181
  if (flags.noAgentFile) {
@@ -183,7 +197,7 @@ export async function installAgentFile({ env, flags, interactive, ask, print, ve
183
197
  print(`AGENT_FILE: skipped (add the LitFamily block to ${path}: ${CONFIG_CMD} on)`);
184
198
  return [];
185
199
  }
186
- if (!(await ask(QUESTION, { defaultYes: true }))) {
200
+ if (!(await ask(QUESTION, { defaultYes: true, card: { ...CARD, tag } }))) {
187
201
  writeAgentFileSetting(env, 'off');
188
202
  print(`AGENT_FILE: off (turn on later: ${CONFIG_CMD} on)`);
189
203
  return [];
@@ -0,0 +1,109 @@
1
+ // What the framed card shows beyond the status record: the planned skills, the git branch, the tool that ran last
2
+ // and how full the context is. All of it is read from records that already exist (LitMuse's own stage record
3
+ // and ledger, Muse's session log and model catalog, .git/HEAD); anything missing stays null and is left out.
4
+ import { closeSync, constants, existsSync, fstatSync, lstatSync, openSync, readFileSync, readSync, readdirSync, statSync } from 'node:fs';
5
+ import { homedir } from 'node:os';
6
+ import { dirname, isAbsolute, join, resolve } from 'node:path';
7
+ import { loadStage } from './stage-card.mjs';
8
+ import { paths } from './paths.mjs';
9
+ import { STACK_DROP_MS, readStack } from '../plugin/hooks/lib/workflow-stack.mjs';
10
+
11
+ const TAIL_BYTES = 256 * 1024;
12
+ const RAN_LATELY_MS = 15 * 60 * 1000;
13
+
14
+ // The parsed lines at the end of a JSON-lines file; a link, a missing file or a cut line reads as nothing.
15
+ function tailLines(path, bytes) {
16
+ let fd;
17
+ try {
18
+ if (!lstatSync(path).isFile()) return [];
19
+ fd = openSync(path, constants.O_RDONLY | (constants.O_NOFOLLOW ?? 0));
20
+ const { size } = fstatSync(fd);
21
+ const buffer = Buffer.alloc(Math.min(size, bytes));
22
+ readSync(fd, buffer, 0, buffer.length, size - buffer.length);
23
+ return buffer.toString('utf8').split('\n').flatMap((line) => {
24
+ try {
25
+ const parsed = JSON.parse(line);
26
+ return parsed && typeof parsed === 'object' ? [parsed] : [];
27
+ } catch {
28
+ return [];
29
+ }
30
+ });
31
+ } catch {
32
+ return [];
33
+ } finally {
34
+ if (fd !== undefined) closeSync(fd);
35
+ }
36
+ }
37
+
38
+ // Muse files a session under the day its id was made; the id's first 48 bits are that time.
39
+ function sessionLog(session, env) {
40
+ const hex = /^([0-9a-f]{8})-([0-9a-f]{4})-7/i.exec(session ?? '');
41
+ if (!hex) return null;
42
+ const made = Number.parseInt(hex[1] + hex[2], 16);
43
+ const store = env.LITMUSE_SESSION_STORE || join(env.XDG_DATA_HOME || join(env.HOME || homedir(), '.local', 'share'), 'muse', 'sessions');
44
+ for (const days of [0, -1, 1]) {
45
+ const day = new Date(made + days * 86_400_000).toISOString().slice(0, 10).split('-');
46
+ const path = join(store, ...day, session, 'session.jsonl');
47
+ if (existsSync(path)) return path;
48
+ }
49
+ return null;
50
+ }
51
+
52
+ // The session log does not name its model, so the window is known only when every listed chat model has the same one.
53
+ function contextWindow(env) {
54
+ try {
55
+ const dir = paths(env).museCatalogDir;
56
+ const rows = readdirSync(dir).filter((file) => file.endsWith('.json')).flatMap((file) => JSON.parse(readFileSync(join(dir, file), 'utf8')).rows ?? []);
57
+ const sizes = new Set(rows.filter((row) => row.visibility === 'visible' && row.context_limit).map((row) => row.context_limit));
58
+ return sizes.size === 1 ? [...sizes][0] : null;
59
+ } catch {
60
+ return null;
61
+ }
62
+ }
63
+
64
+ // How full the context is: Muse's own estimate of the prompt of its last model call. The call's raw counters are not
65
+ // used, because providers differ on whether cached tokens are inside them.
66
+ function contextNow(lines, env) {
67
+ const used = lines.findLast((line) => line.payload?.kind === 'run' && line.payload.event?.kind === 'model_completed')?.payload.event.estimated_prompt_tokens;
68
+ if (!Number.isInteger(used) || used <= 0) return null;
69
+ const limit = contextWindow(env);
70
+ return { used, percent: limit ? Math.min(100, Math.round((used / limit) * 100)) : null };
71
+ }
72
+
73
+ // The last tool call that ended. The ledger is written after each call, so a call still running is not in it.
74
+ function lastTool(ledger, now) {
75
+ const last = ledger.findLast((entry) => /^PostToolUse/.test(entry.event ?? '') && typeof entry.tool === 'string');
76
+ const ms = last ? now - Date.parse(last.ts) : NaN;
77
+ return ms <= RAN_LATELY_MS ? { name: last.tool, ms, ok: last.ok !== false } : null;
78
+ }
79
+
80
+ export function gitBranch(cwd) {
81
+ try {
82
+ for (let dir = resolve(cwd); ; dir = dirname(dir)) {
83
+ const git = join(dir, '.git');
84
+ if (existsSync(git)) {
85
+ const link = statSync(git).isFile() ? /^gitdir: (.+)$/m.exec(readFileSync(git, 'utf8'))?.[1].trim() : git;
86
+ const head = readFileSync(join(isAbsolute(link) ? link : resolve(dir, link), 'HEAD'), 'utf8').slice(0, 300).trim();
87
+ return /^ref: refs\/heads\/(.+)$/.exec(head)?.[1] ?? (/^[0-9a-f]{7,}$/i.test(head) ? head.slice(0, 7) : null);
88
+ }
89
+ if (dir === dirname(dir)) return null;
90
+ }
91
+ } catch {
92
+ return null;
93
+ }
94
+ }
95
+
96
+ export function cardFacts({ cwd = process.cwd(), card, env = process.env, now = Date.now() }) {
97
+ const rec = loadStage({ cwd, session: card.session ?? undefined, env });
98
+ const log = card.session ? sessionLog(card.session, env) : null;
99
+ const id = String(card.session ?? '').replace(/[^A-Za-z0-9_-]/g, '_');
100
+ const ledger = id ? tailLines(join(rec?.cwd ?? cwd, '.litmuse', 'ledger', `${id}.jsonl`), 16 * 1024) : [];
101
+ const planned = Array.isArray(rec?.skills) ? rec.skills.map(String) : [];
102
+ return {
103
+ frames: card.session ? readStack(cwd, card.session).frames.filter((f) => f.stage && now - Date.parse(f.at) <= STACK_DROP_MS) : [],
104
+ skills: card.active ? [...new Set([card.route, ...planned])] : [],
105
+ tool: card.active ? lastTool(ledger, now) : null,
106
+ ctx: log ? contextNow(tailLines(log, TAIL_BYTES), env) : null,
107
+ branch: gitBranch(cwd),
108
+ };
109
+ }
package/lib/card-view.mjs CHANGED
@@ -1,97 +1,58 @@
1
- // The status card as a person's terminal shows it: one print with the sunset beside the words, or, with --watch, a
2
- // full-screen card that moves while work goes on. A pipe, --json, NO_COLOR, fewer colours, a light background and a
3
- // narrow terminal never reach the scene.
4
- import { buildCard, cardLight, cardWorking, renderCard } from './stage-card.mjs';
5
- import { colourDepth, litPill, markFor, pillLabel, pillWidth, termColumns } from './mark.mjs';
6
- import { BRAND, MAX_WIDTH, STILL_T, SUN_ROWS, SUN_W, gradedPill, ink, mix, motionOff, neon, paint, paintRows, place, roundCaps, rowCells, sceneOn, wrapRow } from './sunset.mjs';
1
+ // The status card as a person's terminal shows it: one print, or, with --watch, a full-screen card that moves while work
2
+ // goes on. A dark truecolor terminal with room gets the framed card; a pipe, --json, NO_COLOR, fewer colours, a light
3
+ // background and a narrow terminal get the plain one.
4
+ import { buildCard, cardWorking, renderCard } from './stage-card.mjs';
5
+ import { cardFacts } from './card-facts.mjs';
6
+ import { cardLines, composeCard } from './framed-card.mjs';
7
+ import { roundGlyphs } from './glyphs.mjs';
8
+ import { colourDepth, litPill, markFor, pillWidth, termColumns } from './mark.mjs';
9
+ import { MAX_WIDTH, STILL_T, motionOff, sceneOn, wrapRow } from './sunset.mjs';
7
10
 
8
11
  const ESC = '\u001b';
9
12
  export const READ_MS = 1000;
10
13
  export const FRAME_MS = 125;
11
14
 
12
- // The terminal as the card sees it. `scene` is off wherever today's output must stay as it is.
15
+ // The terminal as the card sees it. `framed` is off wherever the plain card must stay as it is.
13
16
  const terminal = (env, stream) => {
14
17
  const tty = stream?.isTTY === true;
15
18
  const depth = colourDepth({ env, isTTY: tty });
16
19
  const cols = termColumns({ env, stream });
17
- return { tty, depth, cols, scene: sceneOn({ depth, env, cols }), caps: roundCaps(env) };
20
+ // The last column stays empty: some terminals wrap on it.
21
+ return { tty, depth, cols, framed: sceneOn({ depth, env, cols }), width: Math.min(MAX_WIDTH, cols - 1) };
18
22
  };
19
23
 
20
- const cardRows = (card, term, version, cols = term.cols) => {
21
- const pill = !term.tty ? null : term.scene ? gradedPill(pillLabel(version), BRAND, term.caps) : litPill(version, term.depth);
22
- return renderCard(card, {
23
- badge: pill && { text: pill, width: pillWidth(version) }, cols, dress: term.scene ? { caps: term.caps } : null,
24
- }).split('\n');
24
+ const plainRows = (card, term, version) => {
25
+ const pill = term.tty ? litPill(version, term.depth) : null;
26
+ return renderCard(card, { badge: pill && { text: pill, width: pillWidth(version) }, cols: term.cols }).split('\n');
25
27
  };
26
28
 
27
- // `litmuse status --card`. The mark's tagline and the blank row under it lend the sun room over a short card.
28
- export function cardText(card, { env = process.env, stream = process.stdout, version }) {
29
+ const framed = (card, term, { env, cwd, version, now, working }) => composeCard(card, cardFacts({ cwd, card, env, now }), { width: term.width, round: roundGlyphs(env), working, version });
30
+
31
+ // `litmuse status --card`.
32
+ export function cardText(card, { env = process.env, stream = process.stdout, cwd = process.cwd(), version, now = card.now ?? Date.now() }) {
29
33
  const term = terminal(env, stream);
30
34
  const mark = term.tty ? `${markFor({ env, stream })}\n`.split('\n').slice(0, -1) : [];
31
- const rows = cardRows(card, term, version);
32
- const light = term.scene ? cardLight(card) : null;
33
- if (!light) return [...mark, ...rows].join('\n');
34
- const art = mark.slice(0, -2);
35
- // The last column stays empty: some terminals wrap on it.
36
- const width = Math.min(MAX_WIDTH, term.cols - 1);
37
- return [...art, ...paintRows([...mark.slice(-2), ...rows], width, { ...light, t: light.dim ? null : STILL_T })].join('\n');
38
- }
39
-
40
- // The watched card inside its neon frame, laid out once per state: the headline sits in the top rule, at least three
41
- // rows of body give the sun its place. frame(t) paints it for one moment.
42
- function framed(rows, width, light) {
43
- const inner = width - 4;
44
- const title = rowCells(rows[0]) <= inner - 4 ? rows[0] : '';
45
- const body = (title ? rows.slice(1) : rows).flatMap((row) => wrapRow(row, inner));
46
- while (body.length < SUN_ROWS) body.push('');
47
- const spot = place(body, inner);
48
- const sunMid = 2 + spot.at + SUN_W / 2;
49
- const lit = light && spot.top !== null && spot.sea === body.length - 1;
50
- const rule = (x, r, t) => {
51
- const i = Math.floor(x / 4) * 4;
52
- let hue = neon(Math.min(1, i / width + r * 0.02));
53
- if (t !== null) hue = mix(hue, '#ffffff', 0.15 + 0.15 * Math.sin((t / 2.4) * Math.PI * 2));
54
- if (r === 2 && lit) {
55
- const near = Math.max(0, 1 - Math.abs(i - sunMid) / 26);
56
- const ring = 0.5 + 0.5 * Math.sin(Math.abs(i - sunMid) * 0.55 - (t ?? 0) * 2.6);
57
- hue = mix(hue, near > 0.6 ? '#ffd24a' : '#ff8f3c', Math.min(1, near * (0.45 + 0.85 * ring)));
58
- }
59
- return light?.dim ? mix(hue, '#30363d', 0.45) : hue;
60
- };
61
- const line = (from, chars, r, t) => ink([...chars].map((ch, i) => (ch === ' ' ? null : { ch, fg: rule(from + i, r, t) })));
62
- // Side walls are placed by column, so a character the terminal draws wider than expected cannot bend the frame.
63
- const wall = (t) => [line(0, '│', 1, t), `${ESC}[${width}G${line(width - 1, '│', 1, t)}`];
64
- const lead = title ? 4 + rowCells(title) : 0;
65
- return (t) => {
66
- const tails = light ? paint(spot, { ...light, t }) : new Map();
67
- const [left, right] = wall(t);
68
- const top = title
69
- ? `${line(0, '╭─ ', 0, t)}${title}${line(lead - 1, ` ${'─'.repeat(width - lead - 1)}╮`, 0, t)}`
70
- : line(0, `╭${'─'.repeat(width - 2)}╮`, 0, t);
71
- return [
72
- top,
73
- ...body.map((text, r) => `${left} ${text}${tails.has(r) ? ink(tails.get(r).slice(Math.min(inner, spot.ends[r]))) : `${ESC}[K`}${right}`),
74
- line(0, `╰${'─'.repeat(width - 2)}╯`, 2, t),
75
- ];
76
- };
35
+ if (!term.framed) return [...mark, ...plainRows(card, term, version)].join('\n');
36
+ const working = cardWorking(card, { env, now });
37
+ const view = framed(card, term, { env, cwd, version, now, working });
38
+ return [...mark, ...cardLines(view.grid(working ? STILL_T : null), term.width)].join('\n');
77
39
  }
78
40
 
79
41
  // What --watch shows for this state and terminal size. `moving` is false whenever the picture cannot change by itself.
80
- export function watchView(card, { env = process.env, stream = process.stdout, version, now = Date.now() }) {
42
+ export function watchView(card, { env = process.env, stream = process.stdout, cwd = process.cwd(), version, now = Date.now() }) {
81
43
  const term = terminal(env, stream);
82
44
  const height = Number(stream.rows) || 24;
83
- const width = Math.min(MAX_WIDTH, term.cols - 1);
84
- let draw;
85
- if (term.scene) {
86
- draw = framed(cardRows(card, term, version, width - 8), width, cardLight(card));
87
- } else {
88
- const rows = cardRows(card, term, version).flatMap((row) => wrapRow(row, term.cols));
89
- draw = () => rows;
45
+ if (!term.framed) {
46
+ const mark = markFor({ env, stream }).split('\n');
47
+ const rows = plainRows(card, term, version).flatMap((row) => wrapRow(row, term.cols));
48
+ const all = mark.length + rows.length <= height ? [...mark, ...rows] : rows;
49
+ return { moving: false, frame: () => all.slice(0, height) };
90
50
  }
91
- const mark = markFor({ env, stream }).split('\n');
92
- const above = mark.length + draw(null).length <= height ? mark : [];
93
- const moving = term.scene && !motionOff(env) && cardWorking(card, { env, now });
94
- return { moving, frame: (t) => [...above, ...draw(t)].slice(0, height) };
51
+ const working = cardWorking(card, { env, now });
52
+ const view = framed(card, term, { env, cwd, version, now, working });
53
+ // A pane too short for the card loses rows from the bottom of its body, never its frame.
54
+ const fit = (grid) => (grid.length > height ? [...grid.slice(0, Math.max(1, height - 1)), grid.at(-1)].slice(0, height) : grid);
55
+ return { moving: working && !motionOff(env), frame: (t) => cardLines(fit(view.grid(t)), term.width) };
95
56
  }
96
57
 
97
58
  /**
@@ -119,7 +80,7 @@ export function watchCard({ cwd = process.cwd(), env = process.env, out = proces
119
80
  if (bytes) out.write(bytes);
120
81
  };
121
82
  const compose = () => {
122
- view = watchView(card, { env, stream: out, version, now: now() });
83
+ view = watchView(card, { env, stream: out, cwd, version, now: now() });
123
84
  };
124
85
  const tick = () => {
125
86
  if (now() - readAt >= READ_MS) {