Skip to content

feat: add /repeat command and --repeat CLI flag#14

Merged
igorcosta merged 4 commits intomainfrom
igorcosta/add-repeat-command
Mar 12, 2026
Merged

feat: add /repeat command and --repeat CLI flag#14
igorcosta merged 4 commits intomainfrom
igorcosta/add-repeat-command

Conversation

@igorcosta
Copy link
Copy Markdown
Contributor

Summary

  • Fix cursor positioning on narrow terminals (status row overflow)
  • Improve Shift+Enter detection for xterm modifyOtherKeys level 2
  • Add /repeat slash command with RepeatManager, maxRuns, custom expiry, and interval disambiguation
  • Add --repeat CLI flag for non-interactive recurring mode

Test plan

  • 67 repeat command tests passing
  • 34 repeatCli tests passing
  • 3 formatPromptStatusRow tests passing

…+Enter handling

Status row text (e.g. "Update available! Run: curl ...") was never
truncated on the right side, causing terminal wrapping on narrow
windows. This broke the moveUp cursor calculation and left the cursor
outside the composer box. Now the right part is clipped to fit the
terminal width before gap calculations.

Also adds support for xterm modifyOtherKeys level 2 Shift+Enter
sequences (ESC[27;modifier;13~) and broadens residual fragment
detection so stray CSI codes don't leak into the text buffer.
Introduces a new /repeat command that lets users schedule prompts to
run on a recurring cadence. The command uses LLM-first parsing with
regex fallback to extract intervals from natural language input.

Key features:
- RepeatManager with in-process setInterval scheduling and auto-expiry
- LLM parses schedule, prompt, maxRuns, and custom expiry from input
- maxRuns support: auto-cancels after N executions (e.g. "only 10 times")
- Custom expiry: override default 3-day limit (e.g. "for the next week")
- Disambiguation rule: when conflicting intervals exist, the most
  specific one wins and the broader becomes expiry context
- /repeat list and /repeat cancel subcommands
- promptInterrupt mechanism for injecting repeat prompts into the
  idle input loop without polling
Adds parseRepeatFlag() and buildRepeatRunConfig() for the --repeat
CLI flag, enabling headless recurring prompts without the interactive
shell. Supports two-arg form (interval + prompt) and single-string
natural language parsing with automatic interval extraction.

Handles --max-runs and --expires options, validates interval formats,
preserves technical content like shell commands and file paths in
prompts, and falls back to a 5-minute default when no interval is
detected.
@igorcosta igorcosta merged commit 5dfbb17 into main Mar 12, 2026
1 of 2 checks passed
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