Skip to content

Commit a143a40

Browse files
universe-hcyclaude
andcommitted
docs: 为 push/pop/digest 命令与回调补充 docstring
给 CodeRabbit docstring 覆盖率检查涉及的顶层 handler 补齐 JSDoc: push/pop/digest 三个命令的 call、REPL 的 openMessageSelector、 askCompactStrategy(行注释转 JSDoc)、onAbort。 Co-Authored-By: claude-opus-4-8[1m] <noreply@anthropic.com>
1 parent a322dc7 commit a143a40

4 files changed

Lines changed: 29 additions & 3 deletions

File tree

src/commands/digest/digest.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
import type { LocalCommandResult } from '../../commands.js'
22
import type { ToolUseContext } from '../../Tool.js'
33

4+
/**
5+
* `/digest` handler. Opens the message selector in 'digest' mode so the user
6+
* picks a start message; everything from there to the end is distilled into a
7+
* digest (a retroactive `/push`+`/pop`). Interactive-only.
8+
*/
49
export async function call(
510
_args: string,
611
context: ToolUseContext,

src/commands/pop/pop.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,12 @@ export function parsePopArgs(args: string): PopOptions | string {
4949
return opts
5050
}
5151

52+
/**
53+
* `/pop` handler. Parses flags, validates the target marker against the current
54+
* stack, then hands off to the interactive `applyPop` callback which distills
55+
* the branch into a digest and rewinds. Errors out (no state mutation) on an
56+
* empty stack, an out-of-range `--to`, or a non-interactive session.
57+
*/
5258
export async function call(
5359
args: string,
5460
context: ToolUseContext,

src/commands/push/push.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ function renderStackList(stack: readonly PushMarker[]): string {
2828
return `Push stack (${stack.length}):\n${lines.join('\n')}`
2929
}
3030

31+
/**
32+
* `/push [note]` (alias `/stack`) handler. `--list`/`-l` renders the current
33+
* stack locally (no fork); otherwise marks a new push point via the interactive
34+
* `pushContextMark` callback. Errors out in non-interactive sessions since the
35+
* marker lives in REPL state (§4.7).
36+
*/
3137
export async function call(
3238
args: string,
3339
context: ToolUseContext,

src/screens/REPL.tsx

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3068,6 +3068,12 @@ export function REPL({
30683068
return { ...prev, attribution: updated };
30693069
});
30703070
},
3071+
/**
3072+
* Opens the message selector overlay. 'rewind' (default) restores the
3073+
* conversation to an earlier message; 'digest' distills from the chosen
3074+
* message to the end (retroactive /push+/pop). No-op when input is
3075+
* disabled (e.g. a tool is mid-flight).
3076+
*/
30713077
openMessageSelector: (mode: 'rewind' | 'digest' = 'rewind') => {
30723078
if (!disabled) {
30733079
messageSelectorModeRef.current = mode;
@@ -3494,9 +3500,11 @@ export function REPL({
34943500
[setAppState],
34953501
);
34963502

3497-
// Suspends the query loop (autoCompactIfNeeded awaits this) until the user
3498-
// picks a compaction strategy from the dialog (§4.2). Same suspend/resume
3499-
// shape as tool-permission prompts. Abort → nearest push point (safe default).
3503+
/**
3504+
* Suspends the query loop (autoCompactIfNeeded awaits this) until the user
3505+
* picks a compaction strategy from the dialog (§4.2). Same suspend/resume
3506+
* shape as tool-permission prompts. Abort → nearest push point (safe default).
3507+
*/
35003508
const askCompactStrategy = useCallback(
35013509
(opts: { markers: ReadonlyArray<CompactStrategyMarker>; signal: AbortSignal }): Promise<CompactStrategyChoice> => {
35023510
return new Promise<CompactStrategyChoice>(resolve => {
@@ -3507,6 +3515,7 @@ export function REPL({
35073515
resolve(fallback);
35083516
return;
35093517
}
3518+
/** Abort handler: tear down the dialog and resolve with the safe fallback choice. */
35103519
const onAbort = () => {
35113520
setCompactStrategyRequest(null);
35123521
resolve(fallback);

0 commit comments

Comments
 (0)