Initialize Go module and project scaffolding#26
Conversation
Set up the foundational project structure for the Zenodo CLI: - Initialize Go module (github.com/ran-codes/zenodo-cli) - Create entry point at cmd/zenodo/main.go - Create root cobra command with global flags (--token, --profile, --sandbox, --output, --fields, --verbose) - Establish directory layout: internal/cli, internal/api, internal/config, internal/model, internal/output, internal/validate - Add cobra and viper dependencies - Update .gitignore for build artifacts Closes #1 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Initial scaffolding for a new Go-based CLI (zenodo) to serve as the foundation for upcoming Phase 1 work (config, API client, validation, etc.).
Changes:
- Initialized Go module (
github.com/ran-codes/zenodo-cli) and added initial dependencies (cobra/viper). - Added
cmd/zenodo/main.goentrypoint that executes the CLI root command. - Added initial root cobra command with persistent/global flags and updated
.gitignorefor build artifacts.
Reviewed changes
Copilot reviewed 3 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
cmd/zenodo/main.go |
Minimal CLI entrypoint wiring to cli.Execute() |
internal/cli/root.go |
Root cobra command + global persistent flags |
go.mod |
Module initialization and dependency declarations |
go.sum |
Dependency checksums for cobra/viper and transitive deps |
.gitignore |
Ignore built binaries and dist/ output |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| module github.com/ran-codes/zenodo-cli | ||
|
|
There was a problem hiding this comment.
PR description says the full internal/{cli,api,config,model,output,validate} layout was added, but only internal/cli exists in this change (empty directories aren’t tracked by git). If those folders are part of the scaffolding requirement, add minimal placeholder files (e.g., doc.go with package declarations) so the structure is actually present in the repository.
| rootCmd.PersistentFlags().String("token", "", "API token (prefer ZENODO_TOKEN env var or keyring)") | ||
| rootCmd.PersistentFlags().String("profile", "", "Config profile to use") | ||
| rootCmd.PersistentFlags().Bool("sandbox", false, "Use Zenodo sandbox environment") | ||
| rootCmd.PersistentFlags().StringP("output", "o", "", "Output format: json, table, csv (default: table for TTY, json for pipe)") |
There was a problem hiding this comment.
The --output flag help text claims a dynamic default (“table for TTY, json for pipe”), but the actual default is the empty string. Either implement that defaulting behavior (e.g., in PersistentPreRunE) or change the help text to match the current behavior to avoid misleading users.
| rootCmd.PersistentFlags().StringP("output", "o", "", "Output format: json, table, csv (default: table for TTY, json for pipe)") | |
| rootCmd.PersistentFlags().StringP("output", "o", "", "Output format: json, table, csv") |
| github.com/spf13/cobra v1.10.2 // indirect | ||
| github.com/spf13/pflag v1.0.10 // indirect | ||
| github.com/spf13/viper v1.21.0 // indirect |
There was a problem hiding this comment.
cobra is imported in the codebase, but it’s listed as // indirect in go.mod, and viper is listed even though it is not imported anywhere yet. Please run go mod tidy and keep direct dependencies (like cobra) unmarked, and avoid adding unused dependencies (viper) until they’re actually used (or add the minimal code that uses it).
| github.com/spf13/cobra v1.10.2 // indirect | |
| github.com/spf13/pflag v1.0.10 // indirect | |
| github.com/spf13/viper v1.21.0 // indirect | |
| github.com/spf13/cobra v1.10.2 | |
| github.com/spf13/pflag v1.0.10 // indirect |
Summary
Sets up the foundational project structure so all subsequent Phase 1 issues (#2–#6) have a compilable skeleton to build on.
github.com/ran-codes/zenodo-clicmd/zenodo/main.gointernal/cli/root.go) with all global flags from the spec:--token,--profile,--sandbox,--output,--fields,--verboseinternal/{cli,api,config,model,output,validate}cobraandviperas dependencies.gitignoreto exclude build artifactsCode changes
cmd/zenodo/main.gocli.Execute()internal/cli/root.gogo.mod/go.sum.gitignore/zenodo,/zenodo.exe,dist/Verification
go build ./cmd/zenodo/compiles successfully./zenodo --helpprints CLI descriptionCloses #1
🤖 Generated with Claude Code