Skip to content

repl: update .scenario tab completion for group-qualified multi-API usage#1922

Merged
pmcelhaney merged 3 commits intomainfrom
copilot/update-tab-completion-scenario
Apr 17, 2026
Merged

repl: update .scenario tab completion for group-qualified multi-API usage#1922
pmcelhaney merged 3 commits intomainfrom
copilot/update-tab-completion-scenario

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 16, 2026

Summary

Refactors .scenario REPL completion to match group-qualified multi-API syntax while preserving single-API behavior. Multi-runner completion now resolves in two stages: group selection first, then group-scoped scenario path/function completion.

  • Completion flow
    • .scenario <Tab> (multi-API): suggests configured API groups
    • .scenario <group> <Tab>: suggests scenario functions/path prefixes from that group’s scenario registry
    • Unknown groups return empty completions without throwing
  • Compatibility
    • Existing single-runner .scenario <path> completion logic is retained
  • Coverage
    • REPL completion tests now cover multi-runner group suggestions, group-scoped nested path completion, unknown-group fallback, and existing single-runner behavior
  • Docs + release note
    • REPL docs updated to describe single vs multi-API tab completion behavior
    • Added patch changeset entry
// Multi-API completer wiring
createCompleter(
  rootBinding.registry,
  builtinCompleter,
  rootBinding.openApiDocument,
  rootBinding.scenarioRegistry,
  {
    billing: billingScenarioRegistry,
    inventory: inventoryScenarioRegistry,
  },
);

// Expected UX:
// .scenario <Tab>            -> ["billing", "inventory"]
// .scenario billing <Tab>    -> ["setup", "pets/", ...]
Original Prompt

This section details on the original issue you should resolve

Issue title: repl: update tab completion for group-qualified .scenario

Issue description:
Update REPL tab completion so .scenario completions reflect the new multi-API qualifier syntax while preserving the current single-API experience.

Context

Current completion assumes .scenario <path>. With multiple runners, users need completions for:

  1. available group keys after .scenario
  2. scenario paths/functions after .scenario <group>

Proposed change

Refactor the .scenario completer to operate in two stages for multi-runner mode and keep existing path/function completion for single-runner mode.

Acceptance criteria

  • In multi-runner mode, typing .scenario offers available group keys
  • In multi-runner mode, typing .scenario <group> offers scenario path/function completions scoped to that group
  • Invalid groups do not crash completion and fall back gracefully
  • In single-runner mode, existing .scenario <path> completions are preserved
  • REPL tests assert completion behavior for both modes and nested scenario paths

Manual acceptance tests

  • In a single-API REPL session, typing .scenario then pressing Tab suggests scenario functions and path prefixes from the default scenario registry
  • In a multi-API REPL session, typing .scenario then pressing Tab suggests configured API groups
  • In a multi-API REPL session, typing .scenario billing then pressing Tab suggests only billing scenarios (and not scenarios from other groups)
  • In a multi-API REPL session, typing .scenario billing pets/orders/p then pressing Tab suggests nested scoped matches (for example, pets/orders/pending)
  • In a multi-API REPL session, typing .scenario unknown then pressing Tab does not crash and yields no completions

Tasks

  • Refactored .scenario completion logic to support multi-API staged completion (group -> scenario path/function)
  • Extended createCompleter to accept grouped scenario registries for multi-runner completion routing
  • Wired grouped scenario registries from REPL startup into completer initialization
  • Added/updated REPL tests for:
    • group suggestions after .scenario
    • group-scoped scenario suggestions after .scenario <group>
    • nested path completion within selected group
    • unknown-group graceful fallback
    • preserved single-runner completion behavior
  • Updated REPL docs for .scenario tab-completion behavior in single- vs multi-API sessions
  • Added patch changeset for user-facing completion behavior update

Copilot AI changed the title [WIP] Update REPL tab completion for group-qualified .scenario repl: update .scenario tab completion for group-qualified multi-API usage Apr 16, 2026
Copilot AI requested a review from pmcelhaney April 16, 2026 19:31
@pmcelhaney pmcelhaney marked this pull request as ready for review April 16, 2026 21:50
@pmcelhaney pmcelhaney added this pull request to the merge queue Apr 17, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Apr 17, 2026
@pmcelhaney pmcelhaney added this pull request to the merge queue Apr 17, 2026
Merged via the queue into main with commit 4602815 Apr 17, 2026
9 of 16 checks passed
@pmcelhaney pmcelhaney deleted the copilot/update-tab-completion-scenario branch April 17, 2026 12:20
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.

repl: update tab completion for group-qualified .scenario

2 participants