Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions internal/cli/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,20 @@ import (
// stalled connection cannot hang the command indefinitely.
const queryTimeout = 2 * time.Minute

// queryCmd implements the explicit `sting query` subcommand. It reuses the
// same runQuery and flag set as the root command's direct-invocation style
// (e.g. `sting --author foo`), so both forms work and the README example
// `sting query --author ...` is satisfied.
var queryCmd = &cobra.Command{
Use: "query",
Short: "Query a GitHub or GitLab user's commits over a time window",
Long: "Prints a Markdown or JSON commit report.\n\n" +
"This is the primary CLI surface for ad-hoc queries; the identical " +
"engine powers the MCP get_commits tool. All query flags are also " +
"accepted directly on the root command for brevity.",
RunE: runQuery,
}

// registerQueryFlags attaches the per-query flags to cmd. They are local flags
// (not bound to viper) because they are request inputs that override the
// resolved config defaults for a single invocation.
Expand Down
8 changes: 6 additions & 2 deletions internal/cli/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ var rootCmd = &cobra.Command{
Use: "sting",
Short: "Query a GitHub or GitLab user's commits over a time window",
Long: "sting reports a GitHub or GitLab user's commits over a time window for an LLM agent or a terminal.\n\n" +
"Run with query flags to print a report, `sting mcp` to serve the read-only get_commits tool over stdio, " +
"Run `sting query` (or supply query flags directly) to print a report, " +
"`sting mcp` to serve the read-only get_commits tool over stdio, " +
"or `sting install` to register that server with your agent runtimes.",
SilenceUsage: true,
SilenceErrors: true,
Expand Down Expand Up @@ -60,8 +61,11 @@ func init() {
must(v.BindPFlag("max_commits", pf.Lookup("max-commits")))

registerQueryFlags(rootCmd)
// Also register on the query subcommand so `sting query --author ...` works
// with the exact same flag surface (and satisfies documented usage).
registerQueryFlags(queryCmd)
Comment on lines 63 to +66

rootCmd.AddCommand(mcpCmd, installCmd, uninstallCmd, versionCmd, authCmd, initCmd)
rootCmd.AddCommand(queryCmd, mcpCmd, installCmd, uninstallCmd, versionCmd, authCmd, initCmd)
}

// initConfig seeds defaults, wires environment overrides, and reads the config
Expand Down
Loading