Skip to content

Add CLI command to send task input#423

Open
finallylly wants to merge 6 commits into
cline:mainfrom
finallylly:feat/task-send-cli
Open

Add CLI command to send task input#423
finallylly wants to merge 6 commits into
cline:mainfrom
finallylly:feat/task-send-cli

Conversation

@finallylly

Copy link
Copy Markdown

Summary

  • Add kanban task send for sending follow-up input to running task sessions
  • Support --text, stdin input, --project-path, and --no-submit
  • Preserve Cline SDK message semantics while submitting terminal-backed agents with carriage return

Test plan

  • npm run typecheck
  • npm run test:precommit

@finallylly

Copy link
Copy Markdown
Author

Usage examples:

# Send a follow-up prompt and submit it to the running task session
kanban task send \
  --project-path /path/to/workspace \
  --task-id <task-id> \
  --text "Please continue from the previous result"

# Type text into a terminal-backed session without pressing Enter
kanban task send \
  --project-path /path/to/workspace \
  --task-id <task-id> \
  --text "npm test" \
  --no-submit

# Read the follow-up text from stdin
printf 'What is 1+10?' | kanban task send \
  --project-path /path/to/workspace \
  --task-id <task-id>

@greptile-apps

greptile-apps Bot commented Apr 28, 2026

Copy link
Copy Markdown

Greptile Summary

This PR adds a kanban task send CLI subcommand that delivers follow-up text to a running task session, with special handling for Cline (SDK message semantics — no carriage return) vs. terminal-backed agents (appends to submit). Previous review issues (stdin trailing-newline trim, empty --text guard) have been addressed.

Confidence Score: 5/5

Safe to merge — no blocking issues found; previously raised concerns have been addressed.

All code paths are guarded correctly (empty text, TTY stdin, trailing newline), agent-specific submit semantics are well-tested, and the two previously flagged issues (stdin double-submit and silent empty-text fall-through) are fixed.

No files require special attention.

Important Files Changed

Filename Overview
src/commands/task.ts Adds readStdinText, resolveSendTaskText, sendTaskInput, and the send subcommand registration; logic is sound with proper guards for empty text, TTY stdin, and Cline vs terminal-agent submission semantics.
test/runtime/task-command.test.ts New test file covering the happy path, --no-submit, Cline skip-CR path, stdin trimming, and empty --text rejection — good coverage of the introduced code.

Sequence Diagram

sequenceDiagram
    participant CLI as CLI (task send)
    participant RST as resolveSendTaskText
    participant Stdin as process.stdin
    participant RT as runtimeClient

    CLI->>RST: resolve text (--text or stdin)
    alt --text provided and non-empty
        RST-->>CLI: text value
    else --text "" (empty)
        RST-->>CLI: throw Error
    else stdin (non-TTY)
        RST->>Stdin: read chunks
        Stdin-->>RST: raw bytes
        RST-->>CLI: text (trailing \n trimmed)
    else TTY, no --text
        RST-->>CLI: throw Error
    end

    CLI->>RT: sendTaskSessionInput(text, appendNewline=false)
    RT-->>CLI: {ok, summary: {agentId, ...}}

    alt submit=false OR agentId=cline
        CLI-->>User: {ok, submitted: input.submit}
    else terminal agent, submit=true
        CLI->>RT: sendTaskSessionInput("\r", appendNewline=false)
        RT-->>CLI: {ok, summary}
        CLI-->>User: {ok, submitted: true}
    end
Loading

Reviews (4): Last reviewed commit: "Merge branch 'main' into feat/task-send-..." | Re-trigger Greptile

Comment thread src/commands/task.ts Outdated
Comment thread src/commands/task.ts
@finallylly

Copy link
Copy Markdown
Author

@greptile-apps please re-review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant