Conversation
…case event names Adds LuaEventBusForwarder (subscribes to the IEvent catch-all channel and forwards every event to the Lua bridge as snake_case names with snake_case payload keys), the events.subscribe function alongside events.on, a RegisterLuaEvents() registration helper, and serialized closure invocation in the bridge (bus events arrive on arbitrary threads).
…scriptions Also demos events.subscribe in the ScriptingLua sample and documents the snake_case event naming convention.
feat: engine lifecycle events on the bus with Lua events.subscribe
…d quoted tokenizer
…ddConsoleCommands
…om the reference design
- feat(generators): ConsoleCommandRegistrationGenerator emitting RegisterGeneratedConsoleCommands with singleton registration and deferred RegisterCommand wiring via DryIoc RegisterInitializer - feat(generators): SQDGEN006 diagnostic for unsupported console command classes - feat(samples): SquidStd.Samples.ConsoleCommands with attribute, delegate and builtin command usage - test(generators): ConsoleCommandRegistrationGeneratorTests covering generation, description fallback, no-op and diagnostics - docs: SquidStd.ConsoleCommands package README, docfx article and toc entry
…ries on redefine, single log stream in the sample
feat: SquidStd.ConsoleCommands - interactive console commands with a fixed prompt
…t note in the README
feat(bootstrap): shared shutdown lifetime (ISquidStdLifetime)
|
|
||
| Assert.Equal("MyApp:5:true", script.Globals.Get("captured").String); | ||
|
|
||
| forwarder.Dispose(); |
|
|
||
| Assert.Equal(200, (int)script.Globals.Get("counter").Number); | ||
|
|
||
| forwarder.Dispose(); |
Comment on lines
+56
to
+73
| foreach (var alias in aliases) | ||
| { | ||
| if (!_commands.TryAdd(alias, entry)) | ||
| { | ||
| _logger.Warning("Console command '{Command}' redefined", alias); | ||
| var displaced = _commands[alias]; | ||
| _commands[alias] = entry; | ||
|
|
||
| // Keep help output truthful: drop every other key that still points at the | ||
| // displaced entry, so its stale alias list is no longer reported. | ||
| foreach (var staleKey in _commands.Where(pair => ReferenceEquals(pair.Value, displaced)) | ||
| .Select(pair => pair.Key) | ||
| .ToArray()) | ||
| { | ||
| _commands.TryRemove(staleKey, out _); | ||
| } | ||
| } | ||
| } |
Comment on lines
+161
to
+165
| catch (Exception ex) | ||
| { | ||
| _logger.Error(ex, "Console command '{Command}' failed", name); | ||
| writeLine($"Command '{name}' failed: {ex.Message}"); | ||
| } |
Comment on lines
+87
to
+91
| catch (Exception ex) | ||
| { | ||
| Log.ForContext<LuaEventBusForwarder>() | ||
| .Warning(ex, "Failed to forward event {EventType} to Lua", eventData.GetType().Name); | ||
| } |
| { | ||
| private readonly List<(Type ConfigType, Action<object> Apply)> _configHooks = []; | ||
| private readonly List<Action<IConfigManagerService>> _configReadyCallbacks = []; | ||
| private readonly SquidStdLifetimeService _lifetime = new(); |
Comment on lines
+217
to
+218
| catch (OperationCanceledException) when (cancellationToken.IsCancellationRequested | ||
| || _lifetime.ShutdownToken.IsCancellationRequested) { } |
Comment on lines
+357
to
+360
| catch (Exception ex) | ||
| { | ||
| logger.Warning(ex, "EngineStoppedEvent publish failed"); | ||
| } |
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.
Release
Promotes develop to main. Expected version: 0.20.0 (all feat/fix/refactor, no breaking markers).
Included
EngineStartingEvent/EngineStartedEvent/EngineStoppedEvent, guarded, empty bootstrap unaffected).events.subscribe("engine_started", fn)- catch-all bus forwarder with snake_case event names and payload keys, serialized closure invocation,RegisterLuaEvents().SquidStd.ConsoleCommands- interactive prompt (locked mode, TAB autocomplete, history, logs above the prompt via the container sink hook), command registry with aliases and quoted args, builtins help/clear/exit,[RegisterConsoleCommand]+ source generator, sample and docs.ISquidStdLifetimeshared shutdown signal -RequestShutdown()endsRunAsync, graceful Ctrl+C, ConsoleCommandsexitterminates a RunAsync host cleanly.Full suite 1064/1064; docfx 0 warnings.