Background
There is no interactive REPL with the app's DI container, EF context, services, and modules already wired up. Today, ad-hoc inspection means writing a throwaway endpoint or a one-off console project. Laravel Tinker drops you straight into a fully-bootstrapped session.
Motivation
- Quick one-off queries:
db.Users.Count(), notifier.SendAsync(...), cache.SetAsync(...)
- Reproduce bug states fast
- Onboarding tool — devs poke at the framework live
Design sketch
New CLI command sm tinker:
- Uses
dotnet-script (or Microsoft.CodeAnalysis.CSharp.Scripting directly)
- Boots the host (
Host.CreateApplicationBuilder().Build()) so DI is identical to runtime
- Pre-imports common namespaces (
SimpleModule.Core, all module Contracts, System.Linq)
- Pre-binds well-known services to globals:
db, notifier, cache, events, currentUser (impersonate via flag)
- Multiline editor with history (Ctrl+R), tab-completion, color output
--exec "<expr>" for non-interactive single-shot execution
--user <id> to impersonate a user / tenant
Safety:
- Refuses to run against production unless
--allow-prod and env var SM_TINKER_ALLOW_PROD=1
Acceptance criteria
References
Background
There is no interactive REPL with the app's DI container, EF context, services, and modules already wired up. Today, ad-hoc inspection means writing a throwaway endpoint or a one-off console project. Laravel Tinker drops you straight into a fully-bootstrapped session.
Motivation
db.Users.Count(),notifier.SendAsync(...),cache.SetAsync(...)Design sketch
New CLI command
sm tinker:dotnet-script(orMicrosoft.CodeAnalysis.CSharp.Scriptingdirectly)Host.CreateApplicationBuilder().Build()) so DI is identical to runtimeSimpleModule.Core, all module Contracts,System.Linq)db,notifier,cache,events,currentUser(impersonate via flag)--exec "<expr>"for non-interactive single-shot execution--user <id>to impersonate a user / tenantSafety:
--allow-prodand env varSM_TINKER_ALLOW_PROD=1Acceptance criteria
sm tinkercommand incli/SimpleModule.Cli~/.simplemodule/tinker_history--execnon-interactive modeReferences