feat(agent): add system fact collection and display#223
Merged
Conversation
Replace all gen type usage in CLI commands with SDK domain types. HandleError uses errors.As() for typed error handling. All 22 cmd files, audit export package, and CLI UI helpers updated. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Design for extensible fact gathering per agent, stored in a separate facts KV bucket with typed fields for common facts and a flexible map for pluggable collectors (cloud metadata, local facts). 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
10-task TDD implementation plan covering types, config, collector interface, facts KV infrastructure, fact writer, merging, OpenAPI spec, and documentation. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Remove Collector interface. Route all fact gathering through the existing provider layer (extend host.Provider, new netinfo.Provider). Add documentation update tasks for configuration reference, feature pages, architecture pages, and CLI docs. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Add NetworkInterface and FactsRegistration types for the agent facts collection system. Extend AgentInfo with facts fields (architecture, kernel version, CPU count, FQDN, service/package managers, network interfaces, and arbitrary facts map). 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Add NATSFacts struct for configuring the agent facts KV bucket (bucket, TTL, storage, replicas) and AgentFacts struct for configuring the facts collection interval. Wire both into the NATS and AgentConfig parent structs. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Add six new methods to the host.Provider interface for system fact collection: GetArchitecture, GetKernelVersion, GetFQDN, GetCPUCount, GetServiceManager, and GetPackageManager. Implemented for Ubuntu and Darwin providers with testable function variables (HostnameFn, NumCPUFn, StatFn, LookPathFn). Linux provider has stub implementations. All methods follow existing patterns with table-driven tests covering success and error paths. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Add a new provider that retrieves non-loopback, up network interfaces with name, IPv4, and MAC address. Uses InterfacesFn struct field for testability, matching the pattern used by the host provider. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Wire up the NATS KV bucket for storing agent facts. Add BuildFactsKVConfig helper, create the bucket in setupJetStream, pass factsKV through natsBundle and job client Options, and include it in the health metrics KV bucket list. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Add IPv6 field to NetworkInterface type and update netinfo provider to extract both IPv4 and IPv6 addresses from network interfaces. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Add facts writer that runs alongside the heartbeat in the agent, collecting system facts via host and netinfo providers and writing them to the agent-facts KV bucket on a 60-second interval. - Create facts.go with startFacts/writeFacts/factsKey functions - Add factsKV and netinfoProvider fields to Agent struct - Update New() constructor and CreateProviders() factory - Wire startFacts() into Start() lifecycle - Pass factsKV and netinfo provider from cmd/agent_helpers.go - Update all existing test files for new constructor signature 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Add Family field ("inet", "inet6", "dual") computed from which
addresses are present on the interface.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Add mergeFacts helper that reads from the facts KV bucket and enriches AgentInfo with architecture, kernel version, CPU count, FQDN, service manager, package manager, network interfaces, and custom facts. Called in both ListAgents and GetAgent after building info from registration. Gracefully degrades when factsKV is nil or Get returns an error. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Add architecture, kernel_version, cpu_count, fqdn, service_mgr, package_mgr, interfaces, and facts fields to the AgentInfo OpenAPI schema. Add NetworkInterfaceResponse schema with name, ipv4, ipv6, mac, and family fields. Update buildAgentInfo to map new domain fields to the generated API types. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Add nats.facts (bucket, TTL, storage) and agent.facts (interval) configuration sections. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Add package comment to netinfo, rename unused params to _, fix goimports formatting. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Add AddrsFn to Netinfo struct to make address resolution mockable, enabling test cases for IPv4/IPv6/dual/no-address interfaces and non-IPNet address types. Add ExecNotFoundError.Error() assertion to the host package manager test table. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Add architecture, kernel, CPUs, FQDN, service/package manager, and network interfaces to `agent get` CLI output. Add mergeFacts invalid JSON test for 100% coverage. Update local config with facts KV bucket. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Contributor
|
Thank you for contributing to this project! 😊🕹️ |
🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## main #223 +/- ##
========================================
Coverage 99.98% 99.98%
========================================
Files 137 157 +20
Lines 5083 5293 +210
========================================
+ Hits 5082 5292 +210
Misses 1 1
Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
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.
for network interfaces with IPv4/IPv6/MAC/family support. Linux + Darwin implementations.