Skip to content

Add Sparkscan CLI#1

Merged
Quantumlyy merged 4 commits intomainfrom
Quantumlyy/sparkscan-cli
Apr 4, 2026
Merged

Add Sparkscan CLI#1
Quantumlyy merged 4 commits intomainfrom
Quantumlyy/sparkscan-cli

Conversation

@Quantumlyy
Copy link
Copy Markdown
Member

@Quantumlyy Quantumlyy commented Apr 4, 2026

Summary

  • Implements a full CLI wrapping sparkscan-api-go with commands for addresses, tokens, and transactions on the Spark network
  • All commands support --output json for structured output and --network for MAINNET/REGTEST selection
  • Includes mock-based tests across all command packages (race-clean)
  • Adds release pipeline via GoReleaser with CI/CD workflows and a curl-pipe installer
  • API key configurable via --api-key flag or SPARKSCAN_API_KEY environment variable

Test plan

  • go test -race ./... passes
  • go vet ./... clean
  • go build ./cmd produces working binary
  • sparkscan version prints version info
  • sparkscan --help shows all command groups

Implements a CLI wrapping sparkscan-api-go for querying addresses, tokens,
transactions, and network stats on the Spark network. Includes mock-based
tests, goreleaser config, CI/CD workflows, and a curl-pipe installer.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
return err
}

return output.PrintResult(cmd, resp, func(w io.Writer) error {
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This command accepts --cursor, but the text renderer never surfaces resp.NextCursor. Against the live API, token list --limit 1 returned a non-null nextCursor in JSON and only the row table in text mode, which means the default output cannot paginate past the first page. The same pattern is present in the address history subcommands.

Annotations: map[string]string{
"skipClient": "true",
},
Run: func(cmd *cobra.Command, _ []string) {
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The root command exposes --output json globally, but this command bypasses output.PrintResult, so sparkscan version --output json still emits plain text (dev (commit: unknown, built: unknown) in my repro) instead of valid JSON. That breaks the PR contract that commands support structured JSON output.

Quantumlyy and others added 3 commits April 4, 2026 16:24
The version command now uses output.PrintResult so `--output json`
emits valid JSON instead of plain text. Cursor-paginated commands
(token list, address history net-worth/sats/token) now print the
next cursor in text mode so users can paginate past the first page.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@Quantumlyy Quantumlyy merged commit dd93b8f into main Apr 4, 2026
2 checks passed
@Quantumlyy Quantumlyy deleted the Quantumlyy/sparkscan-cli branch April 4, 2026 14:36
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