@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
|
@@ -11,6 +11,7 @@ import { basename, join, resolve, sep } from "node:path";
|
|
|
11
11
|
|
|
12
12
|
import { parsePlanTaskRows } from "../plan-task-rows.mjs";
|
|
13
13
|
import { resolveProjectStateRoot } from "../project-state-root.mjs";
|
|
14
|
+
import { buildBoard, renderBoard, STALE_PLAN_DAYS } from "./board.mjs";
|
|
14
15
|
import { renderBrief } from "./brief.mjs";
|
|
15
16
|
import { aggregateProgress, clipToWidth, displayWidth, progressOf } from "./gauge.mjs";
|
|
16
17
|
import { chooseNextStep, writeNextStep } from "./next-step.mjs";
|
|
@@ -134,6 +135,17 @@ const laneRecordsOf = (root, name, text, budget, redact) => {
|
|
|
134
135
|
};
|
|
135
136
|
const share = (progress) => progress.done / progress.total;
|
|
136
137
|
|
|
138
|
+
// A plan's own name: its first `# ` heading outside a code fence, within its first 40 lines.
|
|
139
|
+
const planTitle = (text, redact) => {
|
|
140
|
+
let fenced = false;
|
|
141
|
+
for (const line of text.split("\n").slice(0, 40)) {
|
|
142
|
+
if (/^\s*(?:```|~~~)/u.test(line)) fenced = !fenced;
|
|
143
|
+
const match = fenced ? null : /^#\s+(.+?)\s*#*\s*$/u.exec(line);
|
|
144
|
+
if (match) return clipToWidth(redact(match[1]), 70);
|
|
145
|
+
}
|
|
146
|
+
return null;
|
|
147
|
+
};
|
|
148
|
+
|
|
137
149
|
// A plan met after the read budget ran out is counted in `skipped.count`, so the brief can say so.
|
|
138
150
|
const plansIn = (root, budget, redact, local, skipped = { count: 0 }) => {
|
|
139
151
|
const list = entries(join(root, "plans"));
|
|
@@ -160,6 +172,7 @@ const plansIn = (root, budget, redact, local, skipped = { count: 0 }) => {
|
|
|
160
172
|
return [{
|
|
161
173
|
worktree: redact(root),
|
|
162
174
|
plan: `plans/${entry.name}`,
|
|
175
|
+
title: planTitle(text, redact),
|
|
163
176
|
local,
|
|
164
177
|
complete: best.progress.done === best.progress.total,
|
|
165
178
|
changedMs: mtimeOf(join(root, "plans", entry.name)),
|
|
@@ -257,14 +270,21 @@ const startWorkOf = (root, budget, redact) => {
|
|
|
257
270
|
const progress = rows.length
|
|
258
271
|
? progressOf(rows.length - open.length, rows.length, open.map((row) => clipToWidth(redact(row.text), NAME_MAX)))
|
|
259
272
|
: progressOf(work.progress?.checked, work.progress?.total, work.progress?.next_task ? [clipToWidth(redact(work.progress.next_task), NAME_MAX)] : undefined);
|
|
273
|
+
// A parked step leaves the run going; it waits on the user only when every open task is BLOCKED.
|
|
274
|
+
// A state written before parked steps (`paused` with one pending boundary) waits as before.
|
|
275
|
+
const parked = Array.isArray(work.pending_boundaries) ? work.pending_boundaries : [];
|
|
276
|
+
const legacy = work.status === "paused" ? work.pending_boundary : null;
|
|
277
|
+
const allBlocked = rows.length ? open.length > 0 && open.every((row) => row.blocked) : !work.progress?.next_task && work.progress?.unchecked > 0;
|
|
278
|
+
const waiting = legacy ?? (parked.length && allBlocked ? parked[0] : null);
|
|
260
279
|
return [{
|
|
261
280
|
worktree: redact(root),
|
|
262
281
|
workId: work.work_id,
|
|
263
282
|
plan: typeof work.plan_name === "string" ? `plans/${work.plan_name}` : "unknown",
|
|
264
|
-
status: work.status,
|
|
283
|
+
status: waiting ? "paused" : work.status === "paused" ? "active" : work.status,
|
|
265
284
|
sessionId: work.root_session_id ?? null,
|
|
266
285
|
id8: typeof work.root_session_id === "string" ? work.root_session_id.slice(0, 8) : "unknown",
|
|
267
|
-
...(
|
|
286
|
+
...(waiting ? { pendingBoundary: { action: waiting.action, root: redact(waiting.root) } } : {}),
|
|
287
|
+
...(parked.length ? { parked: parked.length } : {}),
|
|
268
288
|
progress,
|
|
269
289
|
}];
|
|
270
290
|
};
|
|
@@ -325,6 +345,26 @@ const herdrOf = (env, exec, redact, roots) => {
|
|
|
325
345
|
}
|
|
326
346
|
};
|
|
327
347
|
|
|
348
|
+
// How many changes wait to be committed and commits wait to be pushed in one worktree; `ahead` is
|
|
349
|
+
// null without an upstream. A worktree git cannot read is left out, never guessed. LitClaude's own
|
|
350
|
+
// `.litclaude/` state (this collector writes its next-step record there) is not the user's change.
|
|
351
|
+
const gitStateOf = (root, exec, redact) => {
|
|
352
|
+
try {
|
|
353
|
+
const dirty = exec("git", ["status", "--porcelain=v1", "--untracked-files=normal"], { cwd: root, timeout: GIT_TIMEOUT_MS }).split("\n")
|
|
354
|
+
.filter((line) => line.trim() && !/^.. "?\.litclaude\//u.test(line)).length;
|
|
355
|
+
let ahead = null;
|
|
356
|
+
try {
|
|
357
|
+
const count = Number.parseInt(exec("git", ["rev-list", "--count", "@{upstream}..HEAD"], { cwd: root, timeout: GIT_TIMEOUT_MS }).trim(), 10);
|
|
358
|
+
ahead = Number.isInteger(count) && count >= 0 ? count : null;
|
|
359
|
+
} catch {
|
|
360
|
+
ahead = null;
|
|
361
|
+
}
|
|
362
|
+
return [{ worktree: redact(root), name: clipToWidth(redact(basename(root)), 40), dirty, ahead }];
|
|
363
|
+
} catch {
|
|
364
|
+
return null;
|
|
365
|
+
}
|
|
366
|
+
};
|
|
367
|
+
|
|
328
368
|
const known = (list) => (list === null ? "unknown" : "ok");
|
|
329
369
|
const statusRank = { "waiting-on-user": 0, active: 1, idle: 2, done: 2, ended: 3, unknown: 4 };
|
|
330
370
|
// The Stop hook writes `idle` just after the turn's last transcript line, so a record this much older
|
|
@@ -390,6 +430,7 @@ export const collectRewind = ({
|
|
|
390
430
|
}
|
|
391
431
|
|
|
392
432
|
const commits = collectEach((root) => commitsOf(root, sinceMs, now, exec, redact));
|
|
433
|
+
const gitState = collectEach((root) => gitStateOf(root, exec, redact));
|
|
393
434
|
const herdr = herdrOf(env, exec, redact, roots.map((root) => resolve(root)));
|
|
394
435
|
|
|
395
436
|
// A session waits on the user when it asked something, or holds a paused frame or boundary.
|
|
@@ -478,8 +519,12 @@ export const collectRewind = ({
|
|
|
478
519
|
// Finished inside the window: completed start-work runs and plans with every row ticked.
|
|
479
520
|
finished: {
|
|
480
521
|
runs: recentRuns.map(({ worktree, plan, atMs }) => ({ worktree, plan, at: new Date(atMs).toISOString() })),
|
|
481
|
-
plans: (plans ?? []).filter((plan) => plan.complete && recent(plan)).map(({ worktree, plan, local, progress, recordedIn }) => ({ worktree, plan, local, gauge: progress.gauge, ...(recordedIn ? { recordedIn } : {}) })),
|
|
522
|
+
plans: (plans ?? []).filter((plan) => plan.complete && recent(plan)).map(({ worktree, plan, title, local, progress, rows, changedMs, recordedIn }) => ({ worktree, plan, title, local, gauge: progress.gauge, progress, rows, changedMs, ...(recordedIn ? { recordedIn } : {}) })),
|
|
482
523
|
},
|
|
524
|
+
// Open plans nobody changed for a week or more, whatever the window: a reminder to decide on.
|
|
525
|
+
stalePlans: (plans ?? []).filter((plan) => !plan.complete && plan.changedMs !== null && now - plan.changedMs >= STALE_PLAN_DAYS * 86_400_000)
|
|
526
|
+
.map(({ worktree, plan, title, local, changedMs }) => ({ worktree, plan, title, local, days: Math.floor((now - changedMs) / 86_400_000) })),
|
|
527
|
+
git: gitState ?? [],
|
|
483
528
|
workflows: (workflows ?? []).map((frame) => ({ ...frame, self: Boolean(sessionId) && frame.sessionId === sessionId })),
|
|
484
529
|
startWork: startWork ?? [],
|
|
485
530
|
handoffs,
|
|
@@ -502,6 +547,7 @@ export const collectRewind = ({
|
|
|
502
547
|
work.self = Boolean(sessionId) && work.sessionId === sessionId;
|
|
503
548
|
delete work.sessionId;
|
|
504
549
|
}
|
|
550
|
+
data.board = buildBoard(data);
|
|
505
551
|
return data;
|
|
506
552
|
};
|
|
507
553
|
|
|
@@ -546,16 +592,18 @@ export const renderRewind = (data, width = 100) => {
|
|
|
546
592
|
};
|
|
547
593
|
|
|
548
594
|
/**
|
|
549
|
-
* `litclaude-ai rewind [--brief [--lang ko|en] | --json] [--here] [--since 7d] [--max 12] [--session <id>] [--width N]`.
|
|
550
|
-
* `--brief` prints the
|
|
595
|
+
* `litclaude-ai rewind [--brief [--detail] [--lang ko|en] | --json] [--here] [--since 7d] [--max 12] [--session <id>] [--width N]`.
|
|
596
|
+
* `--brief` prints the KPI board the lit-adhd skill copies, `--detail` adds the per-session brief
|
|
597
|
+
* under it, and `--json` prints the data under both.
|
|
551
598
|
*/
|
|
552
599
|
export const runRewindCli = (args, cwd = process.cwd(), { env = process.env, stdout = process.stdout, stderr = process.stderr } = {}) => {
|
|
553
600
|
const options = { cwd, env, here: false, since: DEFAULT_SINCE, max: DEFAULT_MAX, sessionId: env.CLAUDE_CODE_SESSION_ID || null };
|
|
554
601
|
let json = false;
|
|
555
602
|
let brief = false;
|
|
603
|
+
let detail = false;
|
|
556
604
|
let lang = "en";
|
|
557
605
|
let width = Number(stdout.columns) || 100;
|
|
558
|
-
const usage = "Usage: litclaude-ai rewind [--brief [--lang ko|en] | --json] [--here] [--since 7d] [--max 12] [--session <id>] [--width N]";
|
|
606
|
+
const usage = "Usage: litclaude-ai rewind [--brief [--detail] [--lang ko|en] | --json] [--here] [--since 7d] [--max 12] [--session <id>] [--width N]";
|
|
559
607
|
if (args.some((arg) => arg === "--help" || arg === "-h")) {
|
|
560
608
|
stdout.write(`${usage}\n`);
|
|
561
609
|
return 0;
|
|
@@ -564,6 +612,7 @@ export const runRewindCli = (args, cwd = process.cwd(), { env = process.env, std
|
|
|
564
612
|
const arg = args[index];
|
|
565
613
|
if (arg === "--json") json = true;
|
|
566
614
|
else if (arg === "--brief") brief = true;
|
|
615
|
+
else if (arg === "--detail") detail = true;
|
|
567
616
|
else if (arg === "--lang" && ["ko", "en"].includes(args[index + 1])) lang = args[++index];
|
|
568
617
|
else if (arg === "--here") options.here = true;
|
|
569
618
|
else if (arg === "--since" && parseSince(args[index + 1])) options.since = args[++index];
|
|
@@ -576,6 +625,7 @@ export const runRewindCli = (args, cwd = process.cwd(), { env = process.env, std
|
|
|
576
625
|
}
|
|
577
626
|
}
|
|
578
627
|
const data = collectRewind(options);
|
|
579
|
-
|
|
628
|
+
const board = () => renderBoard(data, { lang });
|
|
629
|
+
stdout.write(json ? `${JSON.stringify(data, null, 2)}\n` : brief ? (detail ? `${board()}\n---\n\n${renderBrief(data, { lang })}` : board()) : renderRewind(data, width));
|
|
580
630
|
return 0;
|
|
581
631
|
};
|
|
@@ -19,7 +19,7 @@ Commands:
|
|
|
19
19
|
pre-tool-use Classify one Claude PreToolUse JSON input against active authority.
|
|
20
20
|
pause Pause only at a new non-forbidden authority boundary.
|
|
21
21
|
cancel Cancel the active work as a terminal transition.
|
|
22
|
-
complete Complete active verified work;
|
|
22
|
+
complete Complete active verified work; open plan tasks keep it running.
|
|
23
23
|
|
|
24
24
|
Resume is intentionally not a generic CLI mutation. A user must submit exactly:
|
|
25
25
|
/litclaude:start-work resume --work-id <id> --revision <n> --boundary-id <id> --prompt-id <id> --grant-id <id>
|