Skip to content
5 changes: 5 additions & 0 deletions cecli/commands/compact.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ async def execute(cls, io, coder, args, **kwargs):
message = args.strip() if args else ""
await coder.compact_context_if_needed(force=True, message=message)

# CLI-71: compaction is a command, so run_one() returns early after it.
# Set the drain flag so any queued prompts process automatically once
# compaction finishes, instead of stalling until a manual /run-queue.
coder._drain_queue_after_command = True

@classmethod
def get_help(cls) -> str:
return "Force compaction of the chat history context."
5 changes: 3 additions & 2 deletions cecli/commands/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@
class Commands:
scraper = None

# Commands that receive their full argument text for nested completion.
FULL_ARGS_COMPLETION_COMMANDS = ("/queue", "/insert-queue")
# Commands that receive their full argument text for completion (nested
# hosts and subcommand commands whose names take an argument).
FULL_ARGS_COMPLETION_COMMANDS = ("/queue", "/insert-queue", "/workflows")

def _get_coder(self):
"""Return coder via weak reference, or None if collected."""
Expand Down
12 changes: 11 additions & 1 deletion cecli/commands/workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,19 @@ def get_help(cls) -> str:
@classmethod
def get_completions(cls, io, coder, args) -> list:
"""Complete subcommands, then workflow names for the name-taking ones."""
partial = (args or "").strip()
raw = args or ""
partial = raw.strip()

if " " not in partial:
# A trailing space means the subcommand is settled and the caller
# is now completing its argument, so offer the workflow names
# (when the subcommand takes one) instead of the subcommand list.
if raw and raw[-1].isspace():
if partial.lower() in cls.NAME_SUBCOMMANDS:
return sorted(wf.name for wf in cls._workflows(coder))

return []

return [s for s in cls.SUBCOMMANDS if s.startswith(partial)] or list(cls.SUBCOMMANDS)

sub, _, rest = partial.partition(" ")
Expand Down
Loading
Loading