Rename .apply REPL command to .scenario#1828
Merged
pmcelhaney merged 3 commits intomainfrom Apr 11, 2026
Merged
Conversation
Copilot
AI
changed the title
[WIP] Rename .apply REPL command to .scenario
Rename .apply REPL command to .scenario
Apr 11, 2026
pmcelhaney
requested changes
Apr 11, 2026
| **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: |
Contributor
Author
There was a problem hiding this comment.
Fixed in a80ee5d — "An apply script" is now "A scenario script".
docs/features/repl.md
Outdated
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` | |
Collaborator
There was a problem hiding this comment.
Change foo, bar, and baz to something more realistic.
Contributor
Author
There was a problem hiding this comment.
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>
pmcelhaney
approved these changes
Apr 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Renames the
.applyREPL command to.scenarioacross 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
.scenario soldPetsin the REPL applies the named scenario function and printsApplied soldPets.scenario(trailing space) and pressing Tab shows available scenario names and file prefixes.applyin the REPL produces no output / command not found (command is gone)docs/features/repl.md) shows.scenarioeverywhere.applyappearedTasks
defineCommand("apply", …)→"scenario"and updated usage message, help text, and tab-completion regex (/^\.scenario\s+/) insrc/repl/repl.tsscenarios/index.tsscaffold (src/typescript-generator/generate.ts)callAsync("scenario", …)), describe labels, and completion fixture strings intest/repl/repl.test.tsdocs/features/repl.mdanddocs/adr/001-apply-command-with-function-injection.mdfoo/bar/bazpath-resolution table examples indocs/features/repl.mdwith realistic petstore-themed names (soldPets,pets/resetAll,pets/orders/pending)