Skip to content

feat: extend datumctl with installable service plugins#198

Draft
scotwells wants to merge 19 commits into
mainfrom
worktree-agent-aaa7004d0f14304c6
Draft

feat: extend datumctl with installable service plugins#198
scotwells wants to merge 19 commits into
mainfrom
worktree-agent-aaa7004d0f14304c6

Conversation

@scotwells
Copy link
Copy Markdown
Contributor

@scotwells scotwells commented May 22, 2026

Closes #197

Summary

Operators can now install service plugins into datumctl that work exactly like built-in commands — with tab completion, help text, and automatic credential forwarding. This ships the foundation for the Datum Cloud CLI extension ecosystem.

What's new

For operators:

  • Install any Datum-compatible plugin from GitHub Releases: datumctl plugin install datumctl-dns
  • Plugins invoke seamlessly as native subcommands: datumctl dns zones list
  • Unknown commands prompt you to install the matching plugin automatically
  • Tab-complete plugin names, subcommands, and flags just like built-in commands
  • datumctl plugin list shows installed plugins and flags available updates
  • datumctl plugin search discovers community plugins via GitHub topics
  • Credentials are forwarded securely — tokens are never stored in the environment

For plugin authors:

  • Go SDK (go.datum.net/datumctl/plugin) with Context(), Token(), ServeManifest(), and NewRootCmd() helpers
  • Reference implementation in examples/plugin-dns/ showing a working end-to-end integration
  • Manifest protocol (--plugin-manifest) for compatibility checks at install and invocation time

Test plan

  • go build ./... passes
  • go test ./internal/pluginstore/... ./internal/plugindispatch/... ./internal/cmd/plugin/... ./plugin/... passes (43 tests)
  • Build and install examples/plugin-dns/, run datumctl dns zones list end-to-end
  • Verify built-in commands cannot be shadowed by a plugin with the same name
  • Verify unmanaged plugin on PATH triggers a warning

🤖 Generated with Claude Code

scotwells and others added 3 commits May 22, 2026 14:08
Closes #197

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
scotwells added a commit to datum-cloud/compute that referenced this pull request May 22, 2026
Adds the datumctl-compute plugin binary with commands for deploying and
managing containerized workloads on Datum Cloud via the developer CLI.

Commands:
- deploy     — create or update a workload from flags or a manifest file
- destroy    — delete a workload and clean up its revision history
- status     — show health, placement summary, and recent revision info
- instances  — list and describe running instances across cities
- scale      — adjust minimum replica count across placements
- rollout    — watch live progress, view history, and roll back revisions
- restart    — trigger a rolling restart of a workload or specific city
- quota      — inspect per-city instance usage and quota headroom

Closes #98. Depends on datum-cloud/datumctl#198.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Cobra rejects unknown flags before RunE fires, which caused plugin
subcommand flags (e.g. --image, --city) to be dropped or rejected when
invoking a plugin with subcommands.

Adds ForwardPlugin, which mirrors the ForwardHelp/ForwardCompletion
pattern: after the command tree is fully built, if os.Args[1] resolves
to a managed plugin binary and is not a built-in command, the process
is replaced via syscall.Exec before cobra.Execute() runs. This passes
all original args — including plugin-owned flags — through unchanged.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
scotwells and others added 2 commits May 22, 2026 17:21
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
scotwells and others added 9 commits May 22, 2026 17:50
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Also fixes plugin list showing blank version for manually-placed binaries.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
ForwardCompletion now accepts a *client.DatumCloudFactory and calls
BuildEnv to overlay the six DATUM_* variables onto the child process
environment. Without this, plugin completion handlers that call the
Datum API (e.g. CompleteWorkloadNames) silently failed because
DATUM_API_HOST and DATUM_CREDENTIALS_HELPER were absent.

The factory is now created before ForwardCompletion in root.go so the
credentials are available at completion time.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Also improves install error messages to be less technical.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
plugin list now shows "update" in the STATUS column when a newer
version is available in the local index. plugin search saves its
results to the index cache so subsequent list invocations reflect
the latest discovery. A hint line is printed on TTY when any
updates are found.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Wraps any ValidArgsFunction so the command's flags surface as
completion candidates on plain <TAB>, without requiring the user to
type "--" first.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@scotwells scotwells changed the title feat: install and invoke datumctl service extensions feat: extend datumctl with installable service plugins May 25, 2026
scotwells and others added 4 commits May 26, 2026 16:30
Auto-install prompt now registers the plugin in plugins.json so
plugin list and remove work after one-command installs.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…hors

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

Extend datumctl with service-specific commands

1 participant