Imported from gsmlg-dev/gsmlg-cli (
AGENTS.md). Install upstream withnpx skills add gsmlg-dev/gsmlg-cli. Copyright stays with the author.
Agents & Concurrency Architecture
This document describes the logical agents, background processes, concurrent systems, and external plugin supervisors active within the gsmlg-cli ecosystem.
1. Agent Registry
| Logical Entity | Implementation Module | Lifecycle | Role / Description |
|---|---|---|---|
| HTTP Requester | github.com/gsmlg-dev/gsmlg-golang/req.Requester |
Temporary | Sends concurrent HTTP requests to a target URL, emitting metrics. |
| Stream Report Collector | github.com/gsmlg-dev/gsmlg-golang/req.StreamReport |
Temporary | Receives, aggregates, and stores live performance metrics from the Requester. |
| Terminal Printer | github.com/gsmlg-dev/gsmlg-golang/req.Printer |
Temporary | Renders real-time metrics progress bar and terminal tables. |
| Semantic Release Orchestrator | github.com/gsmlg-dev/gsmlg-cli/cmd (semanticReleaseCmdHandler) |
Temporary | Coordinates the release pipeline; acts as supervisor to external plugins. |
| Plugin Subprocess (Generic) | github.com/hashicorp/go-plugin.Client |
Transient | Supervised external processes performing specialized release tasks (e.g., git provider, changelog). |
| DNS Command Client | github.com/gsmlg-dev/gsmlg-cli/cmd (dnsCmd, dnsRrCmd, dnsZoneCmd) |
Temporary | Interacts with multiple DNS providers (Cloudflare, Route53) via unified interfaces. |
| OPNsense Command Client | github.com/gsmlg-dev/gsmlg-cli/cmd (opnsenseCmd) |
Temporary | Interacts with OPNsense router management APIs. |
2. State & Transformations
In accordance with functional programming paradigms, agents are modeled as state-holding processes that transition their state by responding to messages/events over channels, rather than mutating object-oriented state fields.
HTTP Benchmarking Engine
- State Structure:
req.Requester: Holds the request configuration (req.ClientOpt), target concurrency size (int), and remaining requests (int64).req.StreamReport: Accumulates a map of status code frequencies (map[string]int), latency distributions, and total throughput metrics.
- Transformations:
req.NewRequester: Initializes the worker state pool.req.Requester.Run: Spawns concurrent worker goroutines that send HTTP requests. It acts as a state generator, emitting raw metric records to the result channel.req.StreamReport.Collect: Listens to incoming metric records overreq.Requester.RecordChan(), transforming the previous aggregated report state with each new data point.req.StreamReport.Snapshot: Returns a read-only view of the aggregated metrics state.
Semantic Release Supervision Tree
- State Structure:
go-semantic-release/pkg/config.Config: Contains CLI execution flags, target paths, and dry-run toggles.semrel.Releaseandsemrel.Commit: Holds parsed historical VCS states used to compute version transitions.
- Transformations:
manager.New: Configures and initializes the HashiCorpgo-pluginmanager state.semrel.GetNewVersion: Pure functional state transition mapping input commits and the current release state to the next semantic version string.updater.Apply: Transforms targeted files on disk to reflect the updated release version.
Unified DNS Client
- State Structure:
- Configuration map (
dns.providers) is stored in$HOME/.config/gsmlg/cli.yamland loaded into the Viper runtime memory.
- Configuration map (
- Transformations:
viper.Set: Transitions local config when adding new providers viadns add-provider.getProviders: Dynamically instantiates the slice ofDnsProviderclients (Cloudflare / Route53) from Viper configurations or environment fallbacks.
3. Orchestration & Topology
HTTP Benchmark Topology
The benchmark system operates with three concurrent processes linked together by Go channels.
graph TD
Host["HTTP Benchmark Command (cmd/httpbenchmark.go)"]
Requester["HTTP Requester Engine (go requester.Run)"]
Report["Stream Report Collector (go report.Collect)"]
Printer["Printer UI Loop (printer.PrintLoop)"]
Host -->|Spawn| Requester
Host -->|Spawn| Report
Host -->|Spawn| Printer
Requester -->|Sends req.Record events over channel| Report
Printer -->|Polls Snapshot state| Report
Report -.->|Signals Done| Printer
Semantic Release Plugin Supervision Tree
The host process supervises external plugin subprocesses launched via HashiCorp go-plugin. The communication channel relies on a multiplexed connection (Yamux) over stdin/stdout.
graph TD
Host["Release Host Process (cmd/semanticRelease.go)"]
Manager["Plugin Manager (pkg/plugin/manager)"]
subgraph Subprocesses ["Supervised OS Subprocesses"]
CI["CI Condition Plugin"]
Provider["VCS Provider Plugin"]
Analyzer["Commit Analyzer Plugin"]
Changelog["Changelog Generator Plugin"]
Updater["Files Updater Plugin"]
Hooks["Hooks Executor Plugin"]
end
Host -->|Configures| Manager
Manager -->|Spawns & Monitors| CI
Manager -->|Spawns & Monitors| Provider
Manager -->|Spawns & Monitors| Analyzer
Manager -->|Spawns & Monitors| Changelog
Manager -->|Spawns & Monitors| Updater
Manager -->|Spawns & Monitors| Hooks
Host -.->|gRPC / RPC over Yamux| CI
Host -.->|gRPC / RPC over Yamux| Provider
Host -.->|gRPC / RPC over Yamux| Analyzer
Host -.->|gRPC / RPC over Yamux| Changelog
Host -.->|gRPC / RPC over Yamux| Updater
Host -.->|gRPC / RPC over Yamux| Hooks
4. Fault Tolerance
- Goroutine Isolation: The HTTP Requester's worker goroutines run independently. If an HTTP request fails, times out, or encounters a TLS verification issue, the error is captured and formatted as a
req.Recordfailure rather than panicking. The worker process continues executing subsequent requests. - Plugin Process Cleanup: Under
cmd/semanticRelease.go, signal trapping (signal.Notify) listens foros.Interruptandsyscall.SIGTERM. On intercept, the host executes itsexitHandlerto invokepluginManager.Stop(), which terminates all child subprocesses cleanly, preventing orphaned zombie processes. - Graceful Command Termination: If a command-level failure occurs, the custom error handler
errorhandler.CreateExitIfErrorhandles system cleanup and triggersos.Exitwith the corresponding exit code (e.g., exit code 65 for no-change conditions in non-dry-runs).
5. Capabilities (Tooling)
Logical entities in gsmlg-cli have access to the following APIs, system capabilities, and credentials:
| Entity | Allowed Functions / Resources | Security Context / Credentials |
|---|---|---|
| DNS Client | DnsProvider operations (ListZones, ListRecords, AddRecord, ReplaceRecord, DeleteRecord) |
Reads provider settings from dns.providers in cli.yaml or environment fallbacks. |
| OPNsense Client | Reconfigures and queries external OPNsense routers. | Reads API credentials and base URL from opnsense.token and opnsense.server_url in cli.yaml. |
| Blog Client | blog.Fetch, blog.FetchOne |
Fetches public blog feeds from gsmlg.com without authentication. |
| HTTP Benchmark | req.NewRequester, req.NewStreamReport, req.NewPrinter |
Bounded resource usage via flags (--concurrency, --timeout, --dial-timeout). |