Skip to content

Rename .apply REPL command to .scenario#1828

Merged
pmcelhaney merged 3 commits intomainfrom
copilot/rename-apply-to-scenario
Apr 11, 2026
Merged

Rename .apply REPL command to .scenario#1828
pmcelhaney merged 3 commits intomainfrom
copilot/rename-apply-to-scenario

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 11, 2026

Summary

Renames the .apply REPL command to .scenario across the entire codebase — runtime, tab-completion, generated scaffold comments, tests, feature docs, and the ADR. Also fixes leftover "apply script" wording in the ADR and replaces generic placeholder examples in the docs with realistic petstore-themed names.

Original Prompt

Rename the .apply REPL command to .scenario. Update all references in code, tests, and documentation.

Do update the ADR.
Do not update the change log file.

Manual acceptance tests

  • Typing .scenario soldPets in the REPL applies the named scenario function and prints Applied soldPets
  • Typing .scenario (trailing space) and pressing Tab shows available scenario names and file prefixes
  • Typing .apply in the REPL produces no output / command not found (command is gone)
  • The REPL docs page (docs/features/repl.md) shows .scenario everywhere .apply appeared
  • Existing REPL features (proxy, counterfact help, route builder tab-completion) behave unchanged

Tasks

  • Renamed defineCommand("apply", …)"scenario" and updated usage message, help text, and tab-completion regex (/^\.scenario\s+/) in src/repl/repl.ts
  • Updated JSDoc comments in the generated scenarios/index.ts scaffold (src/typescript-generator/generate.ts)
  • Updated all test call sites (callAsync("scenario", …)), describe labels, and completion fixture strings in test/repl/repl.test.ts
  • Updated docs/features/repl.md and docs/adr/001-apply-command-with-function-injection.md
  • Fixed leftover "An apply script" → "A scenario script" wording in the ADR
  • Replaced foo/bar/baz path-resolution table examples in docs/features/repl.md with realistic petstore-themed names (soldPets, pets/resetAll, pets/orders/pending)
  • Added patch changeset

Copilot AI linked an issue Apr 11, 2026 that may be closed by this pull request
Copilot AI changed the title [WIP] Rename .apply REPL command to .scenario Rename .apply REPL command to .scenario Apr 11, 2026
Copilot AI requested a review from pmcelhaney April 11, 2026 10:48
**Solution 1 (Minimalist Function Injection) is selected.**

An apply script is a TypeScript file with one or more named function exports. When `.apply <path>` is run, Counterfact splits the argument on `/`, uses the last segment as the function name and the rest as the file path (relative to `<basePath>/repl/`), dynamically imports the module, and calls the named function with a live `ApplyContext` (`$`) object:
An apply script is a TypeScript file with one or more named function exports. When `.scenario <path>` is run, Counterfact splits the argument on `/`, uses the last segment as the function name and the rest as the file path (relative to `<basePath>/repl/`), dynamically imports the module, and calls the named function with a live `ApplyContext` (`$`) object:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Scenario script

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in a80ee5d — "An apply script" is now "A scenario script".

Comment on lines +71 to +73
| `.scenario foo` | `scenarios/index.ts` | `foo` |
| `.scenario foo/bar` | `scenarios/foo.ts` | `bar` |
| `.scenario foo/bar/baz` | `scenarios/foo/bar.ts` | `baz` |
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change foo, bar, and baz to something more realistic.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated in a80ee5d with petstore-flavoured examples:

Command File Function
.scenario soldPets scenarios/index.ts soldPets
.scenario pets/resetAll scenarios/pets.ts resetAll
.scenario pets/orders/pending scenarios/pets/orders.ts pending

… in repl.md table

Agent-Logs-Url: https://github.com/counterfact/api-simulator/sessions/b37bee49-842a-4c64-ad79-e29c8cdd03bb

Co-authored-by: pmcelhaney <51504+pmcelhaney@users.noreply.github.com>
Copilot AI requested a review from pmcelhaney April 11, 2026 11:37
@pmcelhaney pmcelhaney marked this pull request as ready for review April 11, 2026 12:11
@pmcelhaney pmcelhaney enabled auto-merge April 11, 2026 12:11
@pmcelhaney pmcelhaney added this pull request to the merge queue Apr 11, 2026
Merged via the queue into main with commit b6917f6 Apr 11, 2026
8 of 10 checks passed
@pmcelhaney pmcelhaney deleted the copilot/rename-apply-to-scenario branch April 11, 2026 12:19
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.

Rename .apply to .scenario

2 participants