@litfamily/litclaude 1.0.48 → 1.0.49
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 +31 -0
- package/README.md +8 -8
- package/README_ko-KR.md +8 -8
- package/docs/assets/readme/badge-version.svg +1 -1
- package/docs/hooks.md +45 -13
- package/package.json +1 -1
- package/plugins/litclaude/.claude-plugin/plugin.json +1 -1
- package/plugins/litclaude/agents/lit-executor.md +13 -9
- package/plugins/litclaude/bin/litclaude-hook.js +76 -21
- package/plugins/litclaude/bin/litclaude-mcp.js +1 -1
- package/plugins/litclaude/commands/lit-adhd.md +17 -11
- package/plugins/litclaude/commands/lit-loop.md +6 -5
- package/plugins/litclaude/commands/lit-rewind.md +17 -11
- package/plugins/litclaude/commands/start-work.md +16 -7
- package/plugins/litclaude/lib/canonical-skill-resources.mjs +6 -5
- package/plugins/litclaude/lib/mod/state.mjs +8 -2
- package/plugins/litclaude/lib/mod/workflow.mjs +2 -1
- package/plugins/litclaude/lib/rewind/board.mjs +408 -0
- package/plugins/litclaude/lib/rewind/brief.mjs +6 -6
- package/plugins/litclaude/lib/rewind/collect.mjs +57 -7
- package/plugins/litclaude/lib/start-work-cli.mjs +1 -1
- package/plugins/litclaude/lib/start-work-lifecycle.mjs +331 -100
- package/plugins/litclaude/skills/lit-adhd/SKILL.md +56 -16
- package/plugins/litclaude/skills/lit-adhd/references/card-examples.md +107 -0
- package/plugins/litclaude/skills/lit-adhd/references/status-taxonomy.md +17 -2
- package/plugins/litclaude/skills/lit-loop/SKILL.md +8 -5
- package/plugins/litclaude/skills/lit-plan/SKILL.md +2 -1
- package/plugins/litclaude/skills/start-work/SKILL.md +23 -11
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
description: "Alias of lit-adhd: cross-session
|
|
2
|
+
description: "Alias of lit-adhd: the cross-session KPI board with one thing to do now; detail on request."
|
|
3
3
|
argument-hint: '<--here, --since 7d, --max 12, --en>'
|
|
4
4
|
---
|
|
5
5
|
|
|
@@ -56,8 +56,9 @@ Reader mode is the default conversational projection: return the result, materia
|
|
|
56
56
|
risk, required action, and explicitly requested detail. Keep detailed DoneClaims,
|
|
57
57
|
evidence, ledgers, and handoffs internal; material failure, risk, or uncertainty
|
|
58
58
|
always remains visible. Technical and audit detail is included only when the
|
|
59
|
-
current authoritative request asks for it. The
|
|
60
|
-
content, not an invitation to append unrelated
|
|
59
|
+
current authoritative request asks for it. The board's six sections (and, on request, the
|
|
60
|
+
detail's five parts) are the requested content, not an invitation to append unrelated
|
|
61
|
+
operational metadata.
|
|
61
62
|
|
|
62
63
|
## #contract.evidence
|
|
63
64
|
|
|
@@ -90,14 +91,19 @@ Procedure:
|
|
|
90
91
|
|
|
91
92
|
- Run `litclaude-ai rewind --brief --lang <ko|en>` once, `ko` for a Korean
|
|
92
93
|
prompt (or `node <skill-root>/scripts/rewind.mjs --brief --lang <ko|en>` when
|
|
93
|
-
the bin is not on PATH or rejects `--brief`). Pass `--
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
94
|
+
the bin is not on PATH or rejects `--brief`). Pass `--detail` only when the
|
|
95
|
+
user asked for per-session detail (`lit adhd 자세히`, `lit adhd detail`), and
|
|
96
|
+
`--here`, `--since <7d|12h|30m>` or `--max <n>` only when the user asked.
|
|
97
|
+
- Print the KPI board it draws as the reply, exactly as drawn, in its fixed
|
|
98
|
+
order: 🎯 Do this now (one action, why, and what to type or where to go),
|
|
99
|
+
📊 At a glance (✅ done / 🔄 in progress / ⏳ waiting on you / ⬜ left and the
|
|
100
|
+
overall bar), 🏁 Milestones, ✅ Done lately, ⬜ Still to do and 🔔 Don't
|
|
101
|
+
forget, as `Skill(lit-adhd)` defines. With `--detail` the per-session brief
|
|
102
|
+
(cards grouped by worktree and branch, the ended-session table, the roadmap
|
|
103
|
+
and the boxed next step) follows under it.
|
|
104
|
+
- A bar (`█████░░░░░ 9/18 (50%)`) or gauge (`[▉▉▉░░] 3/5`) appears only when
|
|
105
|
+
both numbers are recorded; an unknown total shows the known facts in words.
|
|
106
|
+
Never draw or estimate one.
|
|
101
107
|
- A source the collector could not read is named once at the end; never fill
|
|
102
108
|
it from memory.
|
|
103
109
|
- If the collector fails, reply `BLOCKED:` with its reason and stop.
|
|
@@ -101,19 +101,28 @@ semantic action/root grants, idempotency, locking, and bounded compaction.
|
|
|
101
101
|
Null worktree means canonical cwd only when the authority envelope grants write
|
|
102
102
|
there.
|
|
103
103
|
|
|
104
|
-
No CLI flag may impersonate user approval. When a genuinely new,
|
|
105
|
-
non-forbidden authority boundary
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
104
|
+
No CLI flag may impersonate user approval. When a call reaches a genuinely new,
|
|
105
|
+
non-forbidden authority boundary, only that call is denied and parked; the work
|
|
106
|
+
stays active and every covered call keeps running, so the user can walk away.
|
|
107
|
+
Carry on with the plan's other tasks; mark a task that cannot be done without the
|
|
108
|
+
parked call with a `BLOCKED: <reason>` line under its row. Reading this session's
|
|
109
|
+
own Claude Code folders (spilled tool results, subagent transcripts, the host's
|
|
110
|
+
`tasks` and `scratchpad` folders, memory, `CLAUDE.md`, skills) is never a
|
|
111
|
+
boundary. Secrets and settings (`~/.ssh`, `.env` files, private keys, Claude Code
|
|
112
|
+
settings, git configuration, the start-work state) are refused outright and never
|
|
113
|
+
parked. When every open task waits on a parked call, the turn ends with one list.
|
|
114
|
+
Approval is optional: the whole prompt `lit approve` (or `lit 승인`) grants every
|
|
115
|
+
parked call for this work, and `lit deny` (or `lit 거절`) refuses them; a denied
|
|
116
|
+
path stays refused for the rest of the work. The whole prompt `lit cancel` (or
|
|
117
|
+
`lit 취소`), typed in any session of the project, ends the running work with no
|
|
118
|
+
ids to copy. The exact route stays accepted as an alternative:
|
|
110
119
|
|
|
111
120
|
```text
|
|
112
121
|
/litclaude:start-work resume --work-id <id> --revision <n> --boundary-id <id> --prompt-id <id> --grant-id <id>
|
|
113
122
|
```
|
|
114
123
|
|
|
115
124
|
Only the Claude Code `UserPromptSubmit` hook accepts a whole-prompt token or that
|
|
116
|
-
entire route, matches the active session and
|
|
125
|
+
entire route, matches the active session and a parked boundary, records the grant
|
|
117
126
|
or the refusal, and returns bounded structured context. Explanations, quotes, fences, mixed prompts, stale
|
|
118
127
|
work/revision values, and generic agent CLI calls do not resume. Forbidden
|
|
119
128
|
release, registry, host-config, destructive VCS, commit, push, publish, tag, and
|
|
@@ -25,8 +25,9 @@ export const canonicalSkillResourceManifest = Object.freeze(
|
|
|
25
25
|
["lib/plan-task-rows.mjs", "ca45412631cdfa805102a42dbb3cfc9a43f6f1ecbcdabe1cc5059d2dcb5e58df"],
|
|
26
26
|
["lib/rename-aliases.mjs", "3ee93aec10d0dbe785c554ab3040173ee94fde27da1b440a54b0513e5d11a508"],
|
|
27
27
|
["lib/render_pages.py", "56312e376659a83a8547f60491ca2eac8ef2f3ddd763132cac0016f4d0cce542"],
|
|
28
|
-
["lib/rewind/
|
|
29
|
-
["lib/rewind/
|
|
28
|
+
["lib/rewind/board.mjs", "26e504014d18d77bd7533278a10543d76516cac3300578fe31e6f3b93c4a4f3e"],
|
|
29
|
+
["lib/rewind/brief.mjs", "daac32a2fc00294e13b5e0c08250bfc67ee5ad47f1495e633aedc855f46208bb"],
|
|
30
|
+
["lib/rewind/collect.mjs", "13c08d56ba98aa174521b8fee941307cd719988a838419c65493b7388efb0453"],
|
|
30
31
|
["lib/rewind/gauge.mjs", "347095c1d36492bb996a679b67847261d15388b29962ed2ebaabec3cf0a5d9df"],
|
|
31
32
|
["lib/rewind/next-step.mjs", "75936e3f80ce3328f0a1487a5001dd73c625c996f14d43e4ffbc07c70b56fdd2"],
|
|
32
33
|
["lib/rewind/redact.mjs", "5bff5f69191f2ec07720f2dde20a850730fed884efb47a43f2604d7295a1615a"],
|
|
@@ -135,9 +136,9 @@ export const canonicalSkillResourceManifest = Object.freeze(
|
|
|
135
136
|
["skills/frontend-ui-ux/scripts/search.mjs", "a08531cf2fece7b4cf4a7290cb7afbdbf90b72c0cf6cd0101df86986da86b517"],
|
|
136
137
|
["skills/frontend-ui-ux/scripts/source-replay.mjs", "2c24537a8b9f2161c1d06e42e7d5d44ab921b083f41d93d3e44da835cf932fb8"],
|
|
137
138
|
["skills/frontend-ui-ux/scripts/validate-design-contract.mjs", "f05997c3836764b9f6326efe457b91fe187ca5735bb0ce10f54f14b5b1ca0e3a"],
|
|
138
|
-
["skills/lit-adhd/SKILL.md", "
|
|
139
|
-
["skills/lit-adhd/references/card-examples.md", "
|
|
140
|
-
["skills/lit-adhd/references/status-taxonomy.md", "
|
|
139
|
+
["skills/lit-adhd/SKILL.md", "d0c9e1ef6a1154d28b2a43434821a28d7c33d13436c0d16d929e1717a689f37a"],
|
|
140
|
+
["skills/lit-adhd/references/card-examples.md", "184e0ff1af9922e67042c45015b131a4a9fccd30285423400082811d646c00c4"],
|
|
141
|
+
["skills/lit-adhd/references/status-taxonomy.md", "b1bffe4aa029c2be3160412e4a6a7e719ff105d526181cb151ee29b7406bd00d"],
|
|
141
142
|
["skills/lit-adhd/scripts/rewind.mjs", "23810ec5afaf9b90cfb784d380739d85a752a9405c594052b3dc21af74ecd175"],
|
|
142
143
|
["skills/lit-brainstorm/SKILL.md", "8e8a73eb50a84549e3ec35693f96be07d1c2b5aef3a3e5c8f42200d25d005e0d"],
|
|
143
144
|
["skills/lit-brainstorm/references/idea-lenses.md", "798e4402ab028876367d236f555b5596458a88a1f2cbbaad9c8cbf56ca566ac4"],
|
|
@@ -205,10 +205,16 @@ export const parseBoulder = (state, sessionId) => {
|
|
|
205
205
|
if (!active || !["active", "paused"].includes(active.status) || !workBelongs(active, sessionId)) return { work: null, completed };
|
|
206
206
|
const progress = active.progress && typeof active.progress === "object" ? active.progress : {};
|
|
207
207
|
const total = int(progress.total);
|
|
208
|
+
// A parked step leaves the run going; it waits on the user only when every open task is BLOCKED.
|
|
209
|
+
// A state written before parked steps (`paused` with one pending boundary) waits as before.
|
|
210
|
+
const parked = Array.isArray(active.pending_boundaries) ? active.pending_boundaries : [];
|
|
211
|
+
const legacy = active.status === "paused" ? active.pending_boundary : null;
|
|
212
|
+
const waits = Boolean(legacy) || (parked.length > 0 && !progress.next_task && int(progress.unchecked) > 0);
|
|
208
213
|
return {
|
|
209
214
|
work: {
|
|
210
215
|
id: str(active.work_id, 120) ?? String(state.active_work_id),
|
|
211
|
-
status: active
|
|
216
|
+
status: waits ? "paused" : "active",
|
|
217
|
+
parked: parked.length,
|
|
212
218
|
planName: str(active.plan_name, 200),
|
|
213
219
|
total,
|
|
214
220
|
checked: Math.min(int(progress.checked), total),
|
|
@@ -216,7 +222,7 @@ export const parseBoulder = (state, sessionId) => {
|
|
|
216
222
|
lanes: laneList(active.lanes),
|
|
217
223
|
lastEvent: str(Array.isArray(active.events) ? active.events.at(-1)?.event : null, 60),
|
|
218
224
|
// A paused work waits at a typed boundary (start-work-lifecycle) until the user answers it.
|
|
219
|
-
awaiting:
|
|
225
|
+
awaiting: waits ? str((legacy ?? parked[0])?.boundary_id, 120) : null,
|
|
220
226
|
},
|
|
221
227
|
completed,
|
|
222
228
|
};
|
|
@@ -199,7 +199,8 @@ export const buildWorkflow = ({ snapshot, skills = [], completion = null, now })
|
|
|
199
199
|
if (work && (work.total > 0 || counted)) {
|
|
200
200
|
countOf = counted ? { done: Math.min(counted.n ?? 0, counted.total), total: counted.total, unit: "task" } : { done: work.checked, total: work.total, unit: "task" };
|
|
201
201
|
next = countOf.done === work.checked ? plainText(work.nextTask) : null;
|
|
202
|
-
if (work.
|
|
202
|
+
if (work.awaiting) items.push("paused · approval needed");
|
|
203
|
+
else if (work.parked > 0) items.push(`${work.parked} parked`);
|
|
203
204
|
} else if (goalIsOpen(goal) && goal.criteria.length > 0) {
|
|
204
205
|
countOf = { done: goal.criteria.filter(({ status }) => status === "pass").length, total: goal.criteria.length, unit: "criterion" };
|
|
205
206
|
next = plainText(goal.criteria.find(({ status }) => status !== "pass")?.description);
|
|
@@ -0,0 +1,408 @@
|
|
|
1
|
+
// The lit-adhd KPI board (lit-adhd v2): what a returning reader sees first. Code computes every
|
|
2
|
+
// count, bar, list and reminder from the collector's records (buildBoard) and draws the Markdown
|
|
3
|
+
// (renderBoard), so the model only copies it. Six sections in a fixed order: the one thing to do now
|
|
4
|
+
// and what to type, four bucket counts with an overall bar, a milestone table, the latest finished
|
|
5
|
+
// items, what is left in plan order, and action-shaped reminders. The board never shows a session
|
|
6
|
+
// id, a commit hash, a raw status code or an internal record path; the per-session cards
|
|
7
|
+
// (brief.mjs) stay available under it on request.
|
|
8
|
+
|
|
9
|
+
import { basename } from "node:path";
|
|
10
|
+
|
|
11
|
+
import { bare, code, lastQuestion, plain } from "./brief.mjs";
|
|
12
|
+
import { clipToWidth } from "./gauge.mjs";
|
|
13
|
+
|
|
14
|
+
const CELLS = 10;
|
|
15
|
+
const LIMITS = { milestones: 5, done: 5, remaining: 7, reminders: 5 };
|
|
16
|
+
const LINE_CAP = 40;
|
|
17
|
+
// An open plan nobody changed for this many days is a reminder: resume it or drop it.
|
|
18
|
+
export const STALE_PLAN_DAYS = 7;
|
|
19
|
+
const TEXT_MAX = 80;
|
|
20
|
+
const known = (value) => Number.isInteger(value) && value >= 0;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* `█████░░░░░ 9/18 (50%)`: ten cells, floored, one cell for any progress and never a full bar
|
|
24
|
+
* before the end. Null unless both numbers are real and the total is above zero.
|
|
25
|
+
*/
|
|
26
|
+
export const bar = (done, total, { percent = true } = {}) => {
|
|
27
|
+
if (!known(done) || !known(total) || total === 0) return null;
|
|
28
|
+
const k = Math.min(done, total);
|
|
29
|
+
let filled = Math.floor((k * CELLS) / total);
|
|
30
|
+
if (k > 0 && filled === 0) filled = 1;
|
|
31
|
+
if (k < total && filled === CELLS) filled = CELLS - 1;
|
|
32
|
+
const cells = `${"█".repeat(filled)}${"░".repeat(CELLS - filled)} ${k}/${total}`;
|
|
33
|
+
return percent ? `${cells} (${Math.floor((k * 100) / total)}%)` : cells;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
// A plan's name for a person: its first `# ` heading, else its file name without the date prefix.
|
|
37
|
+
const humanize = (plan) => basename(String(plan ?? "")).replace(/\.md$/u, "").replace(/^\d{4}-\d{2}-\d{2}-/u, "").replace(/[-_]+/gu, " ").trim() || "plan";
|
|
38
|
+
const planName = (plan) => (plan?.title ? plan.title : humanize(plan?.plan));
|
|
39
|
+
const placeOf = (worktree) => (worktree && worktree !== "unknown" ? basename(String(worktree)) : null);
|
|
40
|
+
// A row's words without its Markdown emphasis, so `**T3** add it` reads `T3 add it`.
|
|
41
|
+
const sentence = (text) => clipToWidth(bare(String(text ?? "").replace(/\*\*|__|`/gu, "")), TEXT_MAX);
|
|
42
|
+
|
|
43
|
+
// Lanes at work: another live session that is working, or a herdr agent working or blocked here.
|
|
44
|
+
// A session that waits for an answer is not working; it is a reminder of its own.
|
|
45
|
+
const workingLanes = (data) => {
|
|
46
|
+
const lanes = new Set((data.sessions ?? []).filter((session) => !session.self && session.status === "active").map((session) => session.id8));
|
|
47
|
+
for (const agent of data.herdr?.agents ?? []) {
|
|
48
|
+
if (!agent.self && ["working", "blocked"].includes(agent.status)) lanes.add(agent.id8 ?? agent.pane);
|
|
49
|
+
}
|
|
50
|
+
return lanes.size;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
const milestonesOf = (data) => {
|
|
54
|
+
const works = data.startWork ?? [];
|
|
55
|
+
const workOf = (plan) => works.find((work) => work.plan === plan.plan && work.worktree === plan.worktree);
|
|
56
|
+
const plans = [...(data.roadmap?.plans ?? []), ...(data.finished?.plans ?? [])];
|
|
57
|
+
const seen = new Set();
|
|
58
|
+
const list = [];
|
|
59
|
+
for (const plan of plans) {
|
|
60
|
+
const key = `${plan.worktree}\u0000${plan.plan}`;
|
|
61
|
+
if (seen.has(key)) continue;
|
|
62
|
+
seen.add(key);
|
|
63
|
+
const { done, total } = plan.progress ?? {};
|
|
64
|
+
if (!known(done) || !known(total) || total === 0) continue;
|
|
65
|
+
const work = workOf(plan);
|
|
66
|
+
const status = done >= total ? "done" : work?.status === "paused" ? "waiting" : work?.status === "active" || done > 0 ? "doing" : "todo";
|
|
67
|
+
list.push({
|
|
68
|
+
kind: "plan",
|
|
69
|
+
name: sentence(planName(plan)),
|
|
70
|
+
where: plan.local ? null : placeOf(plan.worktree),
|
|
71
|
+
status,
|
|
72
|
+
done,
|
|
73
|
+
total,
|
|
74
|
+
atMs: Number.isFinite(plan.changedMs) ? plan.changedMs : null,
|
|
75
|
+
current: Boolean(work?.self),
|
|
76
|
+
local: Boolean(plan.local),
|
|
77
|
+
rows: (plan.rows ?? []).map((row) => ({ checked: Boolean(row.checked), text: sentence(row.title) })),
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
// A running start-work whose plan is not listed above is a milestone of its own.
|
|
81
|
+
for (const work of works) {
|
|
82
|
+
if (seen.has(`${work.worktree}\u0000${work.plan}`) || !["active", "paused"].includes(work.status)) continue;
|
|
83
|
+
const { done, total } = work.progress ?? {};
|
|
84
|
+
if (!known(done) || !known(total) || total === 0) continue;
|
|
85
|
+
list.push({
|
|
86
|
+
kind: "run", name: sentence(humanize(work.plan)), where: null, status: work.status === "paused" ? "waiting" : "doing", done, total, atMs: null, current: Boolean(work.self), local: true,
|
|
87
|
+
rows: (work.progress.remaining ?? []).filter((name) => name !== "unknown").map((name) => ({ checked: false, text: sentence(name) })),
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
for (const goal of data.roadmap?.litgoal ?? []) {
|
|
91
|
+
const { done, total } = goal.progress ?? {};
|
|
92
|
+
if (!known(done) || !known(total) || total === 0) continue;
|
|
93
|
+
const status = goal.status === "complete" || done >= total ? "done" : done > 0 ? "doing" : "todo";
|
|
94
|
+
list.push({
|
|
95
|
+
kind: "goal", name: sentence(goal.objective), where: goal.local ? null : placeOf(goal.worktree), status, done, total, atMs: null, current: false, local: Boolean(goal.local),
|
|
96
|
+
rows: (goal.progress.remaining ?? []).filter((name) => name !== "unknown").map((name) => ({ checked: false, text: sentence(name) })),
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
const rank = (item) => (item.current ? -1 : { waiting: 0, doing: 0, todo: 1, done: 2 }[item.status]);
|
|
100
|
+
return list.sort((a, b) => rank(a) - rank(b) || Number(b.local) - Number(a.local) || (b.atMs ?? 0) - (a.atMs ?? 0));
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
// The one thing to do now. The step itself is the collector's (`next`, the same record `go`
|
|
104
|
+
// continues), then the brief's own fallback order; only the words change: an action, a reason, and
|
|
105
|
+
// what to type, or where to go when nothing runs on `go`.
|
|
106
|
+
const doNowOf = (data) => {
|
|
107
|
+
const next = data.next ?? {};
|
|
108
|
+
const target = next.target ?? {};
|
|
109
|
+
const sessions = data.sessions ?? [];
|
|
110
|
+
const nameOfPlan = (path) => {
|
|
111
|
+
const plan = [...(data.roadmap?.plans ?? []), ...(data.finished?.plans ?? [])].find((item) => item.plan === path);
|
|
112
|
+
return sentence(plan ? planName(plan) : humanize(path));
|
|
113
|
+
};
|
|
114
|
+
if (next.kind === "resume-frame") return { kind: "resume", skill: target.skill, stage: target.stage, type: next.say ?? "lit continue" };
|
|
115
|
+
if (next.kind === "approve-boundary") return { kind: "approve", plan: nameOfPlan(target.plan), action: target.action ?? null, root: placeOf(target.root), type: next.say ?? "lit approve", alt: "lit cancel" };
|
|
116
|
+
if (next.kind === "continue-work") {
|
|
117
|
+
const work = (data.startWork ?? []).find((item) => item.plan === target.plan);
|
|
118
|
+
return { kind: "continue", plan: nameOfPlan(target.plan), done: work?.progress?.done ?? null, total: work?.progress?.total ?? null, type: next.say ?? "go" };
|
|
119
|
+
}
|
|
120
|
+
if (next.kind === "start-plan") return { kind: "start-plan", plan: nameOfPlan(target.plan), type: next.say ?? "go" };
|
|
121
|
+
const waiting = sessions.find((session) => session.status === "waiting-on-user" && !session.self && session.waitingReason !== "paused workflow");
|
|
122
|
+
const answer = (session) => ({ kind: "answer", id8: session.id8, where: placeOf(session.worktree) ?? "?", question: lastQuestion(session.result, bare), type: null });
|
|
123
|
+
const lanes = next.wait?.lanes ?? 0;
|
|
124
|
+
if (lanes) return waiting ? answer(waiting) : { kind: "wait", lanes, type: null };
|
|
125
|
+
const handoff = (data.handoffs ?? []).find((item) => item.local && item.next)?.next;
|
|
126
|
+
if (handoff) return { kind: "handoff", item: sentence(handoff), type: null };
|
|
127
|
+
if (waiting) return answer(waiting);
|
|
128
|
+
const paused = (data.workflows ?? []).find((frame) => frame.status === "paused");
|
|
129
|
+
if (paused) {
|
|
130
|
+
const owner = sessions.find((session) => session.id8 === paused.id8);
|
|
131
|
+
return { kind: "resume-there", id8: paused.id8, skill: paused.skill, stage: paused.stage, where: placeOf(owner?.worktree ?? paused.worktree) ?? "?", type: "lit continue" };
|
|
132
|
+
}
|
|
133
|
+
const liveTrees = new Set(sessions.filter((session) => session.status !== "ended").map((session) => session.worktree));
|
|
134
|
+
const open = (data.roadmap?.plans ?? []).filter((item) => item.current);
|
|
135
|
+
const plan = open.find((item) => liveTrees.has(item.worktree)) ?? open.find((item) => item.local) ?? open[0];
|
|
136
|
+
if (plan) return { kind: "plan-item", item: sentence(plan.current), plan: sentence(planName(plan)), where: plan.local ? null : placeOf(plan.worktree), type: plan.local ? `/litclaude:start-work ${plan.plan}` : null };
|
|
137
|
+
const active = sessions.find((session) => session.status === "active" && !session.self);
|
|
138
|
+
if (active) return { kind: "check", id8: active.id8, where: placeOf(active.worktree) ?? "?", goal: sentence(active.title && active.title !== "unknown" ? active.title : active.asked?.[0] ?? ""), type: null };
|
|
139
|
+
const settled = sessions.find((session) => ["done", "idle", "ended"].includes(session.status) && !session.self);
|
|
140
|
+
if (settled?.status === "done") return { kind: "review", id8: settled.id8, where: placeOf(settled.worktree) ?? "?", plan: settled.finishedPlan ? nameOfPlan(settled.finishedPlan) : sentence(settled.title), type: "/litclaude:review-work" };
|
|
141
|
+
if (settled) return { kind: "pick-up", id8: settled.id8, where: placeOf(settled.worktree) ?? "?", goal: sentence(settled.title && settled.title !== "unknown" ? settled.title : settled.asked?.[0] ?? ""), type: null };
|
|
142
|
+
return { kind: "start", type: null };
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
const remindersOf = (data, doNow) => {
|
|
146
|
+
const list = [];
|
|
147
|
+
for (const session of data.sessions ?? []) {
|
|
148
|
+
if (session.status !== "waiting-on-user") continue;
|
|
149
|
+
const where = placeOf(session.worktree) ?? "?";
|
|
150
|
+
if (session.waitingReason === "start-work boundary") {
|
|
151
|
+
if (doNow.kind === "approve") continue;
|
|
152
|
+
const work = (data.startWork ?? []).find((item) => item.id8 === session.id8);
|
|
153
|
+
list.push({ kind: "approve", plan: sentence(work ? humanize(work.plan) : session.title), type: "lit approve", alt: "lit cancel" });
|
|
154
|
+
} else if (session.waitingReason === "paused workflow") {
|
|
155
|
+
if ((session.self && doNow.kind === "resume") || (doNow.kind === "resume-there" && doNow.id8 === session.id8)) continue;
|
|
156
|
+
const frame = (data.workflows ?? []).find((item) => item.id8 === session.id8 && item.status === "paused");
|
|
157
|
+
list.push({ kind: "paused", where, self: Boolean(session.self), skill: frame?.skill ?? "workflow", stage: frame?.stage ?? null });
|
|
158
|
+
} else if (!session.self && !(doNow.kind === "answer" && doNow.id8 === session.id8)) {
|
|
159
|
+
list.push({ kind: "answer", where, question: lastQuestion(session.result, bare) });
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
for (const tree of data.git ?? []) {
|
|
163
|
+
if (tree.dirty > 0) list.push({ kind: "dirty", where: tree.name, count: tree.dirty });
|
|
164
|
+
}
|
|
165
|
+
for (const tree of data.git ?? []) {
|
|
166
|
+
if (tree.ahead > 0) list.push({ kind: "unpushed", where: tree.name, count: tree.ahead });
|
|
167
|
+
}
|
|
168
|
+
const lanes = workingLanes(data);
|
|
169
|
+
if (lanes) list.push({ kind: "lanes", count: lanes });
|
|
170
|
+
const stale = [...(data.stalePlans ?? [])].sort((a, b) => b.days - a.days);
|
|
171
|
+
if (stale.length) list.push({ kind: "stale", name: sentence(planName(stale[0])), days: stale[0].days, more: stale.length - 1 });
|
|
172
|
+
const handoff = (data.handoffs ?? []).find((item) => item.local && item.next)?.next;
|
|
173
|
+
if (handoff && doNow.kind !== "handoff") list.push({ kind: "handoff", item: sentence(handoff) });
|
|
174
|
+
return { reminders: list.slice(0, LIMITS.reminders), remindersOmitted: Math.max(0, list.length - LIMITS.reminders) };
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
/** The board's structured fields, from the collected records alone. */
|
|
178
|
+
export const buildBoard = (data) => {
|
|
179
|
+
const milestones = milestonesOf(data);
|
|
180
|
+
const done = milestones.reduce((sum, item) => sum + item.done, 0);
|
|
181
|
+
const total = milestones.reduce((sum, item) => sum + item.total, 0);
|
|
182
|
+
const inProgress = milestones.filter((item) => item.status === "doing").length;
|
|
183
|
+
const waitingItems = milestones.filter((item) => item.status === "waiting").length;
|
|
184
|
+
// Sessions that wait on the user count once each; one parked at a start-work boundary is
|
|
185
|
+
// already its milestone's waiting item.
|
|
186
|
+
const waitingSessions = (data.sessions ?? []).filter((session) => session.status === "waiting-on-user" && session.waitingReason !== "start-work boundary").length;
|
|
187
|
+
const remainingRows = [];
|
|
188
|
+
for (const item of milestones) {
|
|
189
|
+
if (item.status === "done") continue;
|
|
190
|
+
item.rows.filter((row) => !row.checked).forEach((row, index) => {
|
|
191
|
+
remainingRows.push({ text: row.text, state: index === 0 && item.status !== "todo" ? item.status : "todo" });
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
const finished = [
|
|
195
|
+
...(data.finished?.runs ?? []).map((run) => ({ kind: "run", text: sentence(planName([...(data.finished?.plans ?? []), ...(data.roadmap?.plans ?? [])].find((plan) => plan.plan === run.plan && plan.worktree === run.worktree) ?? run)), atMs: Date.parse(run.at) })),
|
|
196
|
+
...milestones.filter((item) => item.kind === "plan").flatMap((item) => item.rows.filter((row) => row.checked).reverse().map((row) => ({ kind: "row", text: row.text, atMs: item.atMs ?? 0 }))),
|
|
197
|
+
].sort((a, b) => (b.atMs || 0) - (a.atMs || 0));
|
|
198
|
+
const doNow = doNowOf(data);
|
|
199
|
+
return {
|
|
200
|
+
version: 1,
|
|
201
|
+
doNow,
|
|
202
|
+
counts: { done, inProgress, waiting: waitingItems + waitingSessions, remaining: Math.max(0, total - done - inProgress - waitingItems) },
|
|
203
|
+
overall: { done, total, percent: total ? Math.floor((done * 100) / total) : null, bar: bar(done, total) },
|
|
204
|
+
milestones: milestones.slice(0, LIMITS.milestones).map(({ rows: _rows, current: _current, local: _local, ...item }) => item),
|
|
205
|
+
milestonesOmitted: Math.max(0, milestones.length - LIMITS.milestones),
|
|
206
|
+
doneLately: finished.slice(0, LIMITS.done).map(({ kind, text }) => ({ kind, text })),
|
|
207
|
+
doneOmitted: Math.max(0, finished.length - LIMITS.done),
|
|
208
|
+
remaining: remainingRows.slice(0, LIMITS.remaining),
|
|
209
|
+
remainingOmitted: Math.max(0, remainingRows.length - LIMITS.remaining),
|
|
210
|
+
...remindersOf(data, doNow),
|
|
211
|
+
};
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
const WORDS = {
|
|
215
|
+
ko: {
|
|
216
|
+
heads: ["🎯 지금 할 일", "📊 한눈에 보기", "🏁 마일스톤", "✅ 최근 끝낸 일", "⬜ 남은 일", "🔔 잊지 말 것"],
|
|
217
|
+
buckets: ["✅ 끝남", "🔄 진행 중", "⏳ 나를 기다림", "⬜ 남음"],
|
|
218
|
+
status: { done: "✅ 끝남", doing: "🔄 진행 중", waiting: "⏳ 나를 기다림", todo: "⬜ 남음" },
|
|
219
|
+
tableHead: ["마일스톤", "상태", "진행", "최근"],
|
|
220
|
+
overall: "전체 진행",
|
|
221
|
+
noItems: "기록된 계획 항목이 없어요",
|
|
222
|
+
more: (n) => `…외 ${n}개`,
|
|
223
|
+
empty: { milestones: "열린 계획이나 목표가 없어요", done: "아직 끝낸 일이 없어요", remaining: "남은 일이 없어요", reminders: "잊지 말 일이 없어요" },
|
|
224
|
+
goal: (name) => `목표: ${name}`,
|
|
225
|
+
runDone: (name) => `${name}: start-work로 끝까지 실행함`,
|
|
226
|
+
type: (text) => `👉 입력: ${code(text)}`,
|
|
227
|
+
typeOr: (text, alt) => `👉 입력: ${code(text)} (끝내려면 ${code(alt)})`,
|
|
228
|
+
typeThere: (text, where) => `👉 ${plain(where)} 세션에서 입력: ${code(text)}`,
|
|
229
|
+
goThere: (where) => `👉 그 세션(${plain(where)})으로 가서 답하기`,
|
|
230
|
+
wait: (n) => `👉 기다리기: 레인 ${n}개가 끝날 때까지 (끝나면 ${code("lit adhd")})`,
|
|
231
|
+
sayIt: "👉 저절로 실행되지 않아요: 시작하라고 직접 말해 주세요",
|
|
232
|
+
openThere: (where) => `👉 ${plain(where)} 세션 화면을 열어 확인하기`,
|
|
233
|
+
pickThere: (where) => `👉 ${plain(where)} 세션을 다시 열거나, 이어 할 일을 말해 주세요`,
|
|
234
|
+
tellMe: "👉 할 일을 말해 주세요",
|
|
235
|
+
workTree: (where) => `👉 ${plain(where)} 워크트리에서 이어 하기`,
|
|
236
|
+
doNow: {
|
|
237
|
+
resume: ({ skill, stage }) => [`멈춘 ${skill}를 ${stage} 단계부터 이어 하기`, "이 세션에서 하던 일이 그 단계에서 멈춰 있어요"],
|
|
238
|
+
approve: ({ plan, action, root }) => [`${plan}: 보류된 단계를 허용할지 정하기`, `남은 일이 모두 ${[root, action].filter(Boolean).join(" ")} 권한을 기다려요`],
|
|
239
|
+
continue: ({ plan, done, total }) => [`${plan} 이어서 진행하기`, known(done) && known(total) ? `이 세션의 start-work가 ${done}/${total}까지 왔어요` : "이 세션의 start-work가 진행 중이에요"],
|
|
240
|
+
"start-plan": ({ plan }) => [`${plan} 시작하기`, "열린 계획이 이것 하나이고 돌고 있는 작업이 없어요"],
|
|
241
|
+
answer: ({ where, question }) => [`${where} 세션의 질문에 답하기`, question ? `“${question}”` : "그 세션이 답을 기다려요"],
|
|
242
|
+
wait: ({ lanes }) => ["다른 레인이 끝날 때까지 기다리기", `레인 ${lanes}개가 아직 일하는 중이라 지금 시작하면 겹칠 수 있어요`],
|
|
243
|
+
handoff: ({ item }) => [item, "HANDOFF에 적어 둔 다음 할 일이에요"],
|
|
244
|
+
"resume-there": ({ where, skill, stage }) => [`${where} 세션의 ${skill} 이어 하기${stage ? ` (${stage})` : ""}`, "그 세션이 그 단계에서 멈춰 있어요"],
|
|
245
|
+
"plan-item": ({ item, plan }) => [item, `${plan}의 다음 항목이에요`],
|
|
246
|
+
check: ({ where, goal }) => [`${where} 세션 확인하기`, goal ? `“${goal}” 작업이 아직 돌고 있어요` : "그 세션이 아직 일하는 중이에요"],
|
|
247
|
+
review: ({ where, plan }) => [`${where} 세션이 끝낸 ${plan} 검토하기`, "start-work가 끝까지 실행했어요"],
|
|
248
|
+
"pick-up": ({ where, goal }) => [`${where} 세션의 일 이어받기${goal ? `: ${goal}` : ""}`, "가장 최근에 멈춘 세션이에요"],
|
|
249
|
+
start: () => ["시작할 일 정하기", "이 기간에 세션도 계획도 없어요"],
|
|
250
|
+
},
|
|
251
|
+
reminder: {
|
|
252
|
+
approve: ({ plan, type, alt }) => `⏳ ${plain(plan)}: start-work가 보류한 단계 → ${code(type)} 또는 ${code(alt)}`,
|
|
253
|
+
paused: ({ where, self, skill, stage }) => `⏳ ${self ? "이 세션" : `${plain(where)} 세션`}의 ${plain(skill)}${stage ? `(${plain(stage)})` : ""}가 멈춰 있음 → ${self ? "레인이 끝나면" : "그 세션에서"} ${code("lit continue")}`,
|
|
254
|
+
answer: ({ where, question }) => `⏳ ${plain(where)} 세션이 묻고 있어요${question ? `: “${plain(question)}”` : ""} → 그 세션으로 가서 답하기`,
|
|
255
|
+
dirty: ({ where, count }) => `💾 커밋 안 된 변경 ${count}개 (${plain(where)}) → 확인하고 커밋하거나 정리하기`,
|
|
256
|
+
unpushed: ({ where, count }) => `⬆️ 푸시 안 된 커밋 ${count}개 (${plain(where)}) → 준비되면 ${code("git push")}`,
|
|
257
|
+
lanes: ({ count }) => `🏃 아직 일하는 레인 ${count}개 → 끝날 때까지 ${code("go")} 치지 않기`,
|
|
258
|
+
stale: ({ name, days, more }) => `🕰️ ${days}일째 멈춘 계획: ${plain(name)}${more ? ` (외 ${more}개)` : ""} → 이어 할지, 접을지 정하기`,
|
|
259
|
+
handoff: ({ item }) => `📝 HANDOFF의 다음 항목: ${plain(item)} → 오늘 할 일인지 정하기`,
|
|
260
|
+
},
|
|
261
|
+
moreReminders: (n) => `…알림 ${n}개 더`,
|
|
262
|
+
when: { now: "방금", minutes: (n) => `${n}분 전`, today: (t) => `오늘 ${t}`, yesterday: (t) => `어제 ${t}`, days: (n) => `${n}일 전`, none: "—" },
|
|
263
|
+
unread: (list) => `읽지 못함: ${list}.`,
|
|
264
|
+
sources: { transcripts: "세션 기록", plans: "계획", git: "git" },
|
|
265
|
+
budget: "오래된 기록 일부는 읽지 않았어요(읽기 예산 소진).",
|
|
266
|
+
detail: `세션별 자세한 내용: ${code("lit adhd 자세히")}`,
|
|
267
|
+
},
|
|
268
|
+
en: {
|
|
269
|
+
heads: ["🎯 Do this now", "📊 At a glance", "🏁 Milestones", "✅ Done lately", "⬜ Still to do", "🔔 Don't forget"],
|
|
270
|
+
buckets: ["✅ Done", "🔄 In progress", "⏳ Waiting on you", "⬜ Left"],
|
|
271
|
+
status: { done: "✅ Done", doing: "🔄 In progress", waiting: "⏳ Waiting on you", todo: "⬜ Not started" },
|
|
272
|
+
tableHead: ["Milestone", "Status", "Progress", "Last change"],
|
|
273
|
+
overall: "Overall",
|
|
274
|
+
noItems: "no plan items on record",
|
|
275
|
+
more: (n) => `…and ${n} more`,
|
|
276
|
+
empty: { milestones: "No open plan or goal", done: "Nothing finished yet", remaining: "Nothing left", reminders: "Nothing to remember" },
|
|
277
|
+
goal: (name) => `Goal: ${name}`,
|
|
278
|
+
runDone: (name) => `${name}: start-work ran it to the end`,
|
|
279
|
+
type: (text) => `👉 Type: ${code(text)}`,
|
|
280
|
+
typeOr: (text, alt) => `👉 Type: ${code(text)} (or ${code(alt)} to end the run)`,
|
|
281
|
+
typeThere: (text, where) => `👉 In the ${plain(where)} session, type: ${code(text)}`,
|
|
282
|
+
goThere: (where) => `👉 Go to that session (${plain(where)}) and answer there`,
|
|
283
|
+
wait: (n) => `👉 Wait: until the ${n} ${n === 1 ? "lane finishes" : "lanes finish"} (then ${code("lit adhd")})`,
|
|
284
|
+
sayIt: "👉 Nothing runs on its own here: say that you want to start it",
|
|
285
|
+
openThere: (where) => `👉 Open the ${plain(where)} session and look`,
|
|
286
|
+
pickThere: (where) => `👉 Reopen the ${plain(where)} session, or say what to continue`,
|
|
287
|
+
tellMe: "👉 Say what to work on",
|
|
288
|
+
workTree: (where) => `👉 Continue in the ${plain(where)} worktree`,
|
|
289
|
+
doNow: {
|
|
290
|
+
resume: ({ skill, stage }) => [`Resume the paused ${skill} at ${stage}`, "This session stopped there and waits for you"],
|
|
291
|
+
approve: ({ plan, action, root }) => [`${plan}: decide on the parked steps`, `Every open task waits for ${[action, root ? `access to ${root}` : "access"].filter(Boolean).join(" ")}`],
|
|
292
|
+
continue: ({ plan, done, total }) => [`Keep going with ${plan}`, known(done) && known(total) ? `This session's start-work is at ${done}/${total}` : "This session's start-work is running"],
|
|
293
|
+
"start-plan": ({ plan }) => [`Start ${plan}`, "It is the only open plan and nothing else is running"],
|
|
294
|
+
answer: ({ where, question }) => [`Answer the question in the ${where} session`, question ? `“${question}”` : "That session waits for your answer"],
|
|
295
|
+
wait: ({ lanes }) => ["Wait for the other lanes to finish", `${lanes} ${lanes === 1 ? "lane is" : "lanes are"} still working, so starting now could collide`],
|
|
296
|
+
handoff: ({ item }) => [item, "It is the next item in your HANDOFF"],
|
|
297
|
+
"resume-there": ({ where, skill, stage }) => [`Resume ${skill} in the ${where} session${stage ? ` (${stage})` : ""}`, "That session stopped there"],
|
|
298
|
+
"plan-item": ({ item, plan }) => [item, `It is next in ${plan}`],
|
|
299
|
+
check: ({ where, goal }) => [`Check on the ${where} session`, goal ? `“${goal}” is still running` : "It is still working"],
|
|
300
|
+
review: ({ where, plan }) => [`Review what the ${where} session finished: ${plan}`, "start-work ran it to the end"],
|
|
301
|
+
"pick-up": ({ where, goal }) => [`Pick up the ${where} session${goal ? `: ${goal}` : ""}`, "It is the most recent session that stopped"],
|
|
302
|
+
start: () => ["Decide what to start", "No session or plan in this window"],
|
|
303
|
+
},
|
|
304
|
+
reminder: {
|
|
305
|
+
approve: ({ plan, type, alt }) => `⏳ ${plain(plan)}: start-work parked some steps → ${code(type)} or ${code(alt)}`,
|
|
306
|
+
paused: ({ where, self, skill, stage }) => `⏳ ${plain(skill)}${stage ? ` (${plain(stage)})` : ""} is paused in ${self ? "this session" : `the ${plain(where)} session`} → ${self ? "once the lanes finish," : "there,"} ${code("lit continue")}`,
|
|
307
|
+
answer: ({ where, question }) => `⏳ The ${plain(where)} session asks${question ? `: “${plain(question)}”` : " you something"} → answer it there`,
|
|
308
|
+
dirty: ({ where, count }) => `💾 ${count} uncommitted ${count === 1 ? "change" : "changes"} (${plain(where)}) → review, then commit or clean up`,
|
|
309
|
+
unpushed: ({ where, count }) => `⬆️ ${count} unpushed ${count === 1 ? "commit" : "commits"} (${plain(where)}) → ${code("git push")} when ready`,
|
|
310
|
+
lanes: ({ count }) => `🏃 ${count} ${count === 1 ? "lane is" : "lanes are"} still working → do not type ${code("go")} until ${count === 1 ? "it finishes" : "they finish"}`,
|
|
311
|
+
stale: ({ name, days, more }) => `🕰️ A plan untouched for ${days} days: ${plain(name)}${more ? ` (+${more} more)` : ""} → decide to resume or drop it`,
|
|
312
|
+
handoff: ({ item }) => `📝 Next in your HANDOFF: ${plain(item)} → decide if it is today's work`,
|
|
313
|
+
},
|
|
314
|
+
moreReminders: (n) => `…${n} more ${n === 1 ? "reminder" : "reminders"}`,
|
|
315
|
+
when: { now: "just now", minutes: (n) => `${n}m ago`, today: (t) => `today ${t}`, yesterday: (t) => `yesterday ${t}`, days: (n) => `${n}d ago`, none: "—" },
|
|
316
|
+
unread: (list) => `Not read: ${list}.`,
|
|
317
|
+
sources: { transcripts: "session records", plans: "plans", git: "git" },
|
|
318
|
+
budget: "Some older records were not read (read budget used up).",
|
|
319
|
+
detail: `Per-session detail: ${code("lit adhd detail")}`,
|
|
320
|
+
},
|
|
321
|
+
};
|
|
322
|
+
|
|
323
|
+
// `10분 전`, `오늘 14:02`, `어제 09:30`, `3일 전`, in the machine's local time.
|
|
324
|
+
const whenOf = (atMs, now, w) => {
|
|
325
|
+
if (!Number.isFinite(atMs)) return w.when.none;
|
|
326
|
+
const minutes = Math.max(0, Math.floor((now - atMs) / 60_000));
|
|
327
|
+
if (minutes < 1) return w.when.now;
|
|
328
|
+
if (minutes < 60) return w.when.minutes(minutes);
|
|
329
|
+
const at = new Date(atMs);
|
|
330
|
+
const today = new Date(now);
|
|
331
|
+
const hhmm = `${String(at.getHours()).padStart(2, "0")}:${String(at.getMinutes()).padStart(2, "0")}`;
|
|
332
|
+
const dayStart = new Date(today.getFullYear(), today.getMonth(), today.getDate()).getTime();
|
|
333
|
+
if (atMs >= dayStart) return w.when.today(hhmm);
|
|
334
|
+
if (atMs >= dayStart - 86_400_000) return w.when.yesterday(hhmm);
|
|
335
|
+
return w.when.days(Math.max(1, Math.round((dayStart - atMs) / 86_400_000)));
|
|
336
|
+
};
|
|
337
|
+
|
|
338
|
+
const typeLine = (doNow, w) => {
|
|
339
|
+
if (doNow.kind === "approve") return w.typeOr(doNow.type, doNow.alt);
|
|
340
|
+
if (doNow.kind === "resume-there") return w.typeThere(doNow.type, doNow.where);
|
|
341
|
+
if (doNow.kind === "answer") return w.goThere(doNow.where);
|
|
342
|
+
if (doNow.kind === "wait") return w.wait(doNow.lanes);
|
|
343
|
+
if (doNow.kind === "plan-item" && !doNow.type) return w.workTree(doNow.where ?? "?");
|
|
344
|
+
if (doNow.type) return w.type(doNow.type);
|
|
345
|
+
if (doNow.kind === "handoff") return w.sayIt;
|
|
346
|
+
if (doNow.kind === "check") return w.openThere(doNow.where);
|
|
347
|
+
if (doNow.kind === "pick-up") return w.pickThere(doNow.where);
|
|
348
|
+
return w.tellMe;
|
|
349
|
+
};
|
|
350
|
+
|
|
351
|
+
const draw = (board, data, now, w, limits) => {
|
|
352
|
+
const out = [];
|
|
353
|
+
const [action, why] = w.doNow[board.doNow.kind](board.doNow);
|
|
354
|
+
out.push(`## ${w.heads[0]}`, `**${plain(action)}** — ${plain(why)} `, typeLine(board.doNow, w), "");
|
|
355
|
+
const { done, inProgress, waiting, remaining } = board.counts;
|
|
356
|
+
out.push(`## ${w.heads[1]}`, `| ${w.buckets.join(" | ")} |`, "|:--:|:--:|:--:|:--:|", `| ${done} | ${inProgress} | ${waiting} | ${remaining} |`, "", `${w.overall} ${board.overall.bar ?? w.noItems}`, "");
|
|
357
|
+
out.push(`## ${w.heads[2]}`);
|
|
358
|
+
const milestones = board.milestones.slice(0, limits.milestones);
|
|
359
|
+
if (milestones.length) {
|
|
360
|
+
out.push(`| ${w.tableHead.join(" | ")} |`, "|---|---|---|---|");
|
|
361
|
+
for (const item of milestones) {
|
|
362
|
+
const name = item.kind === "goal" ? w.goal(item.name) : item.name;
|
|
363
|
+
out.push(`| ${plain(item.where ? `${name} (${item.where})` : name)} | ${w.status[item.status]} | ${bar(item.done, item.total, { percent: false })} | ${whenOf(item.atMs, now, w)} |`);
|
|
364
|
+
}
|
|
365
|
+
const omitted = board.milestonesOmitted + board.milestones.length - milestones.length;
|
|
366
|
+
if (omitted > 0) out.push(`| ${w.more(omitted)} | | | |`);
|
|
367
|
+
} else out.push(w.empty.milestones);
|
|
368
|
+
out.push("", `## ${w.heads[3]}`);
|
|
369
|
+
const finished = board.doneLately.slice(0, limits.done);
|
|
370
|
+
if (finished.length) for (const item of finished) out.push(`- ${plain(item.kind === "run" ? w.runDone(item.text) : item.text)}`);
|
|
371
|
+
else out.push(w.empty.done);
|
|
372
|
+
out.push("", `## ${w.heads[4]}`);
|
|
373
|
+
const left = board.remaining.slice(0, limits.remaining);
|
|
374
|
+
if (left.length) {
|
|
375
|
+
left.forEach((item, index) => out.push(`${index + 1}. ${item.state === "doing" ? "🔄 " : item.state === "waiting" ? "⏳ " : ""}${plain(item.text)}`));
|
|
376
|
+
const omitted = board.remainingOmitted + board.remaining.length - left.length;
|
|
377
|
+
if (omitted > 0) out.push(w.more(omitted));
|
|
378
|
+
} else out.push(w.empty.remaining);
|
|
379
|
+
out.push("", `## ${w.heads[5]}`);
|
|
380
|
+
if (board.reminders.length) {
|
|
381
|
+
for (const item of board.reminders) out.push(`- ${w.reminder[item.kind](item)}`);
|
|
382
|
+
if (board.remindersOmitted > 0) out.push(`- ${w.moreReminders(board.remindersOmitted)}`);
|
|
383
|
+
} else out.push(w.empty.reminders);
|
|
384
|
+
// Only a source whose absence changes what the board can say is named; the full list is in the detail.
|
|
385
|
+
const unread = Object.entries(w.sources).filter(([key]) => data.sources?.[key] && data.sources[key] !== "ok").map(([, label]) => label);
|
|
386
|
+
const notes = [unread.length ? w.unread(unread.join(", ")) : null, data.budget?.exhausted || data.roadmap?.plansSkipped > 0 ? w.budget : null].filter(Boolean);
|
|
387
|
+
out.push("", ...notes.map((note) => `*${note}*`), `*${w.detail}*`);
|
|
388
|
+
return out;
|
|
389
|
+
};
|
|
390
|
+
|
|
391
|
+
/**
|
|
392
|
+
* The board as Markdown, at most forty lines: when every list is full, still-to-do, then done
|
|
393
|
+
* lately, then the milestone table give up rows (counted in their `…외 N개`) until it fits.
|
|
394
|
+
*/
|
|
395
|
+
export const renderBoard = (data, { lang = "en", now = Date.parse(data.generatedAt) || Date.now() } = {}) => {
|
|
396
|
+
const w = WORDS[lang] ?? WORDS.en;
|
|
397
|
+
const board = buildBoard(data);
|
|
398
|
+
const limits = { ...LIMITS };
|
|
399
|
+
let lines = draw(board, data, now, w, limits);
|
|
400
|
+
while (lines.length > LINE_CAP) {
|
|
401
|
+
if (limits.remaining > 3) limits.remaining -= 1;
|
|
402
|
+
else if (limits.done > 3) limits.done -= 1;
|
|
403
|
+
else if (limits.milestones > 3) limits.milestones -= 1;
|
|
404
|
+
else break;
|
|
405
|
+
lines = draw(board, data, now, w, limits);
|
|
406
|
+
}
|
|
407
|
+
return `${lines.join("\n")}\n`;
|
|
408
|
+
};
|
|
@@ -40,7 +40,7 @@ const WORDS = {
|
|
|
40
40
|
self: "this session",
|
|
41
41
|
answer: (q) => `answer its question: “${q}”`,
|
|
42
42
|
resume: (skill, stage, self) => `resume ${skill} at ${stage} (\`lit continue\`${self ? "" : " there"})`,
|
|
43
|
-
approve: "
|
|
43
|
+
approve: "start-work waits on parked steps: allow them (`lit approve`) or end the run (`lit cancel`)",
|
|
44
44
|
planNow: (plan, item) => `${plan} → ${item}`,
|
|
45
45
|
nothing: "nothing pending on record",
|
|
46
46
|
roadmap: "Roadmap",
|
|
@@ -106,7 +106,7 @@ const WORDS = {
|
|
|
106
106
|
self: "이 세션",
|
|
107
107
|
answer: (q) => `질문에 답하기: “${q}”`,
|
|
108
108
|
resume: (skill, stage, self) => `${skill}(${stage}) 이어가기 (${self ? "" : "그 세션에서 "}\`lit continue\`)`,
|
|
109
|
-
approve: "start-work
|
|
109
|
+
approve: "start-work가 보류한 단계를 기다림: 허용(`lit approve`) 또는 종료(`lit cancel`)",
|
|
110
110
|
planNow: (plan, item) => `${plan} → ${item}`,
|
|
111
111
|
nothing: "기록된 남은 일 없음",
|
|
112
112
|
roadmap: "로드맵",
|
|
@@ -165,15 +165,15 @@ const stamp = (iso) => {
|
|
|
165
165
|
return `${two(at.getMonth() + 1)}-${two(at.getDate())} ${two(at.getHours())}:${two(at.getMinutes())}`;
|
|
166
166
|
};
|
|
167
167
|
// Inline code that cannot be broken by a backtick inside the data.
|
|
168
|
-
const code = (text) => `\`${stripControls(text).replace(/`/gu, "'")}\``;
|
|
168
|
+
export const code = (text) => `\`${stripControls(text).replace(/`/gu, "'")}\``;
|
|
169
169
|
// One line of data as Markdown text: no line breaks, no tags, and its emphasis marks escaped.
|
|
170
170
|
// Every value printed passes through here or `code`, so a control sequence the collector missed
|
|
171
171
|
// (an older record, a hand-made fixture) still cannot reach the terminal.
|
|
172
|
-
const bare = (text) => stripControls(text).replace(/\s+/gu, " ").trim();
|
|
173
|
-
const plain = (text) => bare(text).replace(/[<>`]/gu, (ch) => ({ "<": "‹", ">": "›", "`": "'" }[ch])).replace(/[*_|[\]\\]/gu, (ch) => `\\${ch}`);
|
|
172
|
+
export const bare = (text) => stripControls(text).replace(/\s+/gu, " ").trim();
|
|
173
|
+
export const plain = (text) => bare(text).replace(/[<>`]/gu, (ch) => ({ "<": "‹", ">": "›", "`": "'" }[ch])).replace(/[*_|[\]\\]/gu, (ch) => `\\${ch}`);
|
|
174
174
|
|
|
175
175
|
// The last question the session asked, from its last assistant words.
|
|
176
|
-
const lastQuestion = (result, escape = plain) => {
|
|
176
|
+
export const lastQuestion = (result, escape = plain) => {
|
|
177
177
|
const text = String(result ?? "");
|
|
178
178
|
const found = [...text.matchAll(/[^.!?。?\n]{4,}[??]/gu)].at(-1)?.[0];
|
|
179
179
|
return found ? escape(clipToWidth(bare(found), 90)) : null;
|