feat(cli): interactive shell UX improvements#1159
Conversation
…ployment modules Reorganize flat `app/cli/` helpers into focused subpackages: - `app/cli/interactive_shell/` (renamed from `app/cli/repl/`) with new `cli_agent.py`, `cli_help.py`, and `router.py` for the interactive terminal loop - `app/cli/support/` for CLI infrastructure (args, constants, context, errors, exit_codes, health_view, layout, prompt_support, update) - `app/cli/investigation/` for alert/investigation entrypoints (alert_templates, investigate, investigate_input, payload) Reorganize `app/deployment/` by concern: - `app/deployment/methods/` for how we ship (railway, langsmith) - `app/deployment/operations/` for runtime/infra around a deployment (ec2_config, health, provider_config) Update all imports and tests (including e2e/deploy paths) to the new module locations. Made-with: Cursor
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
Greptile SummaryThis PR reorganizes flat Confidence Score: 5/5Safe to merge — refactoring is complete and all import paths are correctly updated with no broken references remaining. All 97 files are updated consistently; no stale app.cli.repl imports remain anywhere in the codebase; backward-compatible re-exporting init.py files ensure downstream callers are unaffected. The three remaining findings are all P2 style/naming suggestions that do not affect runtime behavior. No files require special attention. Minor terminology cleanup in router.py docstring and loop.py public symbol name would be nice-to-have follow-ups. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
Input["User input (text)"] --> R{router.classify_input}
R -->|starts with /| Slash["dispatch_slash()\napp/cli/interactive_shell/commands.py"]
R -->|bare alias e.g. help/exit| Slash
R -->|CLI how-to pattern| CLIHelp["answer_cli_help()\napp/cli/interactive_shell/cli_help.py"]
R -->|no prior state + incident vocab| NewAlert["_run_new_alert()\nLangGraph investigation pipeline"]
R -->|short question + prior state| FollowUp["answer_follow_up()\napp/cli/interactive_shell/follow_up.py"]
R -->|long/alert text + prior state| NewAlert
R -->|chat / general| CLIAgent["answer_cli_agent()\napp/cli/interactive_shell/cli_agent.py"]
CLIHelp -->|grounding=reference_only| CLIAgent
CLIAgent --> LLM["get_llm_for_reasoning()\napp/services/llm_client.py"]
NewAlert --> LangGraph["LangGraph pipeline\napp/cli/investigation/"]
subgraph new_subpackages ["New subpackages (this PR)"]
direction LR
IS["app/cli/interactive_shell/\nloop · router · cli_agent\ncli_help · commands · session"]
INV["app/cli/investigation/\ninvestigate · payload\nalert_templates"]
SUP["app/cli/support/\nargs · context · errors\nexit_codes · health_view · update"]
DM["app/deployment/methods/\nrailway · langsmith"]
DO["app/deployment/operations/\nec2_config · health · provider_config"]
end
|
| @@ -0,0 +1,218 @@ | |||
| """Classify REPL input: slash, CLI help, LangGraph-free agent, investigation, or follow-up.""" | |||
There was a problem hiding this comment.
Stale REPL terminology in module docstring
The module docstring and several internal docstrings still reference "REPL" (lines 1, 179, 184) despite the explicit goal of this PR to replace that term with "interactive shell." The system-prompt in cli_agent.py even instructs the LLM to never say "REPL" to users (issue #604), so the mismatch with the source code docstrings is worth cleaning up.
| """Classify REPL input: slash, CLI help, LangGraph-free agent, investigation, or follow-up.""" | |
| """Classify interactive-shell input: slash, CLI help, LangGraph-free agent, investigation, or follow-up.""" |
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
|
|
||
| # Cap stored (user, assistant) pairs; list holds 2 entries per turn. | ||
| _MAX_CLI_AGENT_TURNS = 12 | ||
| _GroundingMode = Literal["reference_only", "conversational"] |
There was a problem hiding this comment.
_GroundingMode should be declared as a TypeAlias
Assigning a Literal to a plain variable makes mypy and pyright treat it as a type[Literal[...]] value, not a type alias. This can cause unexpected type-narrowing issues when the variable is used in annotation positions.
| _GroundingMode = Literal["reference_only", "conversational"] | |
| _GroundingMode: TypeAlias = Literal["reference_only", "conversational"] |
|
Hey @davincios, really impressive refactor — the separation into A couple of small observations while reading through:
Really clean work — the direction is clearly right. 🙏 |
Made-with: Cursor
Thanks @Ghraven that is very kind of you :) |
Made-with: Cursor
Made-with: Cursor
|
😤 @davincios said "I will fix this" and then actually fixed it. Legendary behavior. 👋 Join us on Discord - OpenSRE : hang out, contribute, or hunt for features and issues. Everyone's welcome. |
Resolves conflicts in auto-generated bot files: docs/daily-updates/overview.mdx, docs/daily-updates/2026-04-30.mdx, docs/daily-updates/2026-05-01.mdx, and README.md (contributors section). All four are produced by scheduled bot workflows in main and have no relationship to this PR; resolved by accepting the upstream main version verbatim. Pulls in 35+ commits from main since this PR was opened, including: refactor of integrations module (Tracer-Cloud#1165), Splunk integration (Tracer-Cloud#791), interactive shell improvements (Tracer-Cloud#1159, Tracer-Cloud#1167), Claude Code CLI provider (Tracer-Cloud#1168), and CI quality gate restoration. None of these touch the OpenSearch wizard, detect_sources, or the validation modules this PR modifies. Refs: Tracer-Cloud#1143

Summary
Reorganizes flat modules in
app/cli/andapp/deployment/into focused subpackages so each area has one clear purpose, and renames the terminal loop from REPL to interactive_shell.app/cli/interactive_shell/(renamed fromapp/cli/repl/) now hosts the interactive terminal loop, plus newcli_agent.py,cli_help.py, androuter.py.app/cli/support/centralizes CLI infrastructure (args,constants,context,errors,exit_codes,health_view,layout,prompt_support,update).app/cli/investigation/groups alert/investigation entrypoints (alert_templates,investigate,investigate_input,payload).app/deployment/methods/holds how we ship (railway,langsmith);app/deployment/operations/holds runtime/infra around a deployment (ec2_config,health,provider_config).tests/cli/interactive_shell/) updated to the new locations.Test plan
make lintmake format-checkmake typecheckmake test-covopensreinteractive shell locallyMade with Cursor