INNER CODE UNIT · Python

_is_slash_command

ApodexAI/FrontierAgent · apodex/tui/app.py:132

def _is_slash_command(value: str) -> bool:
    """Whether ``value`` is a slash command rather than text that starts with "/".

    ``@`` completion is deliberately off inside commands: ``/attach`` takes a
    raw path, so offering a mention there would corrupt the argument. But an
    ordinary message can also begin with "/" — ``/outputs/report.md summarise
    @notes`` — and that one must keep file completion, so the leading "/" alone
    is not enough; the first word has to name a real command.
    """
    if not value.startswith("/"):
        return False
    head, separator, _rest = value.partition(" ")
    return not separator or head in _COMMAND_NAMES


def _shared_completion(candidates: list[str], fragment: str) -> str:
    """Longest prefix every candidate shares — never shorter than ``fragment``.

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…