Skip to content

feat: migrate CLI to cobra and add roadmap#236

Merged
ernado merged 1 commit into
mainfrom
feat/cobra-cli-roadmap
Jun 12, 2026
Merged

feat: migrate CLI to cobra and add roadmap#236
ernado merged 1 commit into
mainfrom
feat/cobra-cli-roadmap

Conversation

@ernado

@ernado ernado commented Jun 12, 2026

Copy link
Copy Markdown
Member

Summary

Replaces urfave/cli/v2 with spf13/cobra for the command surface and lands the agent-automatable CLI ROADMAP.md. This is the first Phase 0 foundation item from the roadmap.

CLI migration (cobra)

  • Root command with persistent global flags (--config/-c, --debug-invoker, --test), command groups, and flag-name normalization preserving old aliases (--staging--test, --target--peer, --msg--message, --as--type).
  • init/send/upload ported to cobra with rich Short/Long/Example help; the old Before hook moved into PersistentPreRunE.
  • Thorough autocomplete: tg completion bash|zsh|fish|powershell, dynamic completion for --peer (self aliases for now, with a TODO to read the peer cache once it lands) and enum completion for --type. The enum flag is reimplemented as a pflag.Value for validation + completion.
  • Rich documentation: hidden tg docs command generating Markdown/man pages from the command tree.

Error handling

  • Switched from golang.org/x/xerrors to github.com/go-faster/errors, using the Wrap/Wrapf house style (govet-clean); dropped the stdlib errors import where go-faster's Is suffices.

Roadmap

  • Adds ROADMAP.md describing the phased plan for an agent-automatable Telegram CLI, with the cobra decision recorded in Phase 0 and the technical notes.

Verification

  • go build ./..., go vet ./..., and golangci-lint run ./... (0 issues) all pass.
  • Smoke-tested help/groups/examples, __complete for peer and enum flags, enum validation, all flag aliases, init, docs generation, and error paths.

🤖 Generated with Claude Code

Replace urfave/cli/v2 with spf13/cobra for the command surface, giving
first-class shell completion and doc generation:

- Root command with persistent global flags, command groups, and flag-name
  normalization preserving old aliases (--staging/--target/--msg/--as).
- init/send/upload ported to cobra with rich Short/Long/Example help.
- Dynamic completion for --peer (self aliases for now) and enum completion
  for --type; enum flag reimplemented as a pflag.Value.
- Hidden `docs` command generating Markdown/man pages from the tree.
- Switch error handling from golang.org/x/xerrors to go-faster/errors
  (Wrap/Wrapf house style).

Also add ROADMAP.md describing the agent-automatable CLI plan.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@ernado ernado merged commit c8227b8 into main Jun 12, 2026
3 checks passed
@ernado ernado deleted the feat/cobra-cli-roadmap branch June 12, 2026 21:08
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.

1 participant