refactor(cni): rename cmd/galactic to cmd/galactic-cni and simplify to pure CNI plugin#117
Merged
Merged
Conversation
…o pure CNI plugin Rename the source directory from cmd/galactic to cmd/galactic-cni to match the binary name. Strip the CLI layer entirely: galactic-cni is always invoked by the container runtime with CNI_COMMAND set, so the cobra root command, cni/version subcommands, and CNI_COMMAND env-var dispatch were all dead code. - Replace NewCommand() in internal/cni with RunPlugin(); main() calls it directly - Delete internal/cmd/cni (pass-through cobra wrapper) - Remove NewCommand() and cobra import from internal/cmd/version - Update CNI type from "galactic" to "galactic-cni" in all NADs and test fixtures - Remove TestGalacticBinaryVersion e2e test (tested the deleted version subcommand) - Update ARCHITECTURE.md, CONVENTIONS.md, AGENTS.md, and Taskfile to match Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
scotwells
approved these changes
Jun 17, 2026
Contributor
|
Should we consider having CNI and agent be sub commands of the galactic binary instead? Then we'd only need to build a single binary artifact and release |
Contributor
Author
|
We could combine this into a single binary however CNI doesn't invoke subcommands so you end up bypassing your command CLI command loop anyway. You end up with an implementation that looks something like: func main() {
if os.Getenv("CNI_COMMAND") != "" {
// Run CNI loop
}
// Normal CLI mode with subcommands
rootCmd := &cobra.Command{
// Normal CLI loop with subcommands
}
}So the code paths diverge the moment the binary is run which feels off to me. |
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.
Summary
cmd/galactic/tocmd/galactic-cni/to match the binary namegalactic-cni: the binary is always invoked by the container runtime withCNI_COMMANDset, so the root command,cni/versionsubcommands, and env-var dispatch were dead codemain()is now three lines — import and callcni.RunPlugin()"type"from"galactic"to"galactic-cni"in all NADs and test fixtures to match the installed binary nameinternal/cmd/cni(a pass-through cobra wrapper with no purpose) andNewCommand()frominternal/cmd/versionTest plan
task buildproducesbin/galactic-cniandfileconfirms it's an ELF binarygo test ./internal/cni/...passesgo build ./...clean"type": "galactic-cni"matches the binary installed byinstall.shat/opt/cni/bin/galactic-cni🤖 Generated with Claude Code