Skip to content

refactor(cni): rename cmd/galactic to cmd/galactic-cni and simplify to pure CNI plugin#117

Merged
privateip merged 1 commit into
mainfrom
refactor/galactic-cni-simplify
Jun 17, 2026
Merged

refactor(cni): rename cmd/galactic to cmd/galactic-cni and simplify to pure CNI plugin#117
privateip merged 1 commit into
mainfrom
refactor/galactic-cni-simplify

Conversation

@privateip

Copy link
Copy Markdown
Contributor

Summary

  • Renames cmd/galactic/ to cmd/galactic-cni/ to match the binary name
  • Strips the entire cobra CLI layer from galactic-cni: the binary is always invoked by the container runtime with CNI_COMMAND set, so the root command, cni/version subcommands, and env-var dispatch were dead code
  • main() is now three lines — import and call cni.RunPlugin()
  • Updates CNI "type" from "galactic" to "galactic-cni" in all NADs and test fixtures to match the installed binary name
  • Removes internal/cmd/cni (a pass-through cobra wrapper with no purpose) and NewCommand() from internal/cmd/version

Test plan

  • task build produces bin/galactic-cni and file confirms it's an ELF binary
  • go test ./internal/cni/... passes
  • go build ./... clean
  • Verify NAD "type": "galactic-cni" matches the binary installed by install.sh at /opt/cni/bin/galactic-cni

🤖 Generated with Claude Code

…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>
@privateip privateip requested a review from a team as a code owner June 17, 2026 02:22
@scotwells

Copy link
Copy Markdown
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

@privateip

Copy link
Copy Markdown
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.

@privateip privateip merged commit 1d17915 into main Jun 17, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants