Skip to content

refactor(mode): replace config-based mode setting with runtime detection#196

Open
ayeshurun wants to merge 10 commits intomicrosoft:mainfrom
ayeshurun:copilot/remove-mode-settings
Open

refactor(mode): replace config-based mode setting with runtime detection#196
ayeshurun wants to merge 10 commits intomicrosoft:mainfrom
ayeshurun:copilot/remove-mode-settings

Conversation

@ayeshurun
Copy link
Collaborator

📥 Pull Request

✨ Description of new changes

The CLI mode (interactive/command_line) was persisted in ~/.config/fab/config.json and required fab config set mode interactive to enter REPL. Mode is now determined purely at runtime — no config entry, no explicit switching.

What changed

  • Runtime detectionfab_constant exposes set_runtime_mode()/get_runtime_mode(). InteractiveCLI sets FAB_MODE_INTERACTIVE on start and resets it on exit. Everything else reads get_runtime_mode() instead of the config file.

  • Config migrationinit_defaults() silently removes the legacy mode key from existing config.json on first run.

  • Backward compatconfig get mode and config set mode <value> now print a deprecation warning and return cleanly instead of erroring.

  • Context persistence_should_use_context_file() now calls get_runtime_mode() instead of fab_state_config.get_config(FAB_MODE). Context files are still skipped in REPL (in-memory context is sufficient).

  • main.py — removed the post-login block that auto-started REPL when mode=interactive was stored in config.

  • Docsmodes.md rewritten to reflect the new runtime model; mode row removed from settings.md.

Entry points now

Invocation Mode
fab REPL (interactive)
fab <command> Command-line
Original prompt

I want to get rid of the mode settings, where I will only have the command line and REPL modes, but not through settings. If I'm in REPL mode I want know that I'm in the context because there are some behaviors depend on that (today it is called interactive mode). I want you to also update the docs and support backward compatibility.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

ayeshurun and others added 9 commits March 17, 2026 12:14
This script benchmarks the startup performance of the CLI by measuring module import times, CLI invocation times, and heavy dependency loading. It allows comparisons against a baseline branch or tag.
Co-authored-by: ayeshurun <98805507+ayeshurun@users.noreply.github.com>
- Move runtime mode into Context class (singleton instance methods)
- Graduated deprecation: 'config set mode interactive' still launches REPL with warning
- Graduated deprecation: 'config get mode' returns runtime mode with warning
- Add regression tests: runtime mode (6), config deprecation (7), init defaults (4),
  MAP removal (6), session-per-request (3), context persistence mock updates (10)
- Consolidate test files into test_fab_context.py, test_config.py, test_fab_state_config.py

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Resolved conflicts in main.py and test_fab_state_config.py.
Re-removed ItemType.MAP, _shared_session/_get_session, and MAP references
in command_support.yaml, fab_item.py, and test conftest that upstream
re-introduced.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@ayeshurun ayeshurun requested a review from a team as a code owner March 22, 2026 10:36
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.

2 participants