Skip to content

Commit ddb1754

Browse files
committed
feat(cli)!: rename 'beans query' to 'beans graphql'
- Rename cmd/query.go to cmd/graphql.go - Update command name from 'query' to 'graphql' - Keep 'query' as an alias for backwards compatibility - Update help text and examples BREAKING CHANGE: The primary command name is now 'graphql' instead of 'query'. The old 'query' name still works as an alias.
1 parent dc02402 commit ddb1754

File tree

2 files changed

+22
-21
lines changed

2 files changed

+22
-21
lines changed

.beans/beans-b4yj--rename-beans-query-to-beans-graphql.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
---
22
title: Rename 'beans query' to 'beans graphql'
3-
status: todo
3+
status: completed
44
type: feature
55
priority: normal
66
created_at: 2025-12-12T22:38:27Z
7-
updated_at: 2025-12-12T23:04:42Z
7+
updated_at: 2025-12-12T23:32:32Z
88
parent: beans-xnp8
99
---
1010

cmd/query.go renamed to cmd/graphql.go

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -25,35 +25,36 @@ var (
2525
querySchemaOnly bool
2626
)
2727

28-
var queryCmd = &cobra.Command{
29-
Use: "query <graphql>",
30-
Short: "Execute a GraphQL query",
31-
Long: `Execute a GraphQL query against the beans data.
28+
var graphqlCmd = &cobra.Command{
29+
Use: "graphql <query>",
30+
Aliases: []string{"query"},
31+
Short: "Execute a GraphQL query or mutation",
32+
Long: `Execute a GraphQL query or mutation against the beans data.
3233
33-
The query argument should be a valid GraphQL query string.
34+
The argument should be a valid GraphQL query or mutation string.
3435
3536
Examples:
3637
# List all beans
37-
beans query '{ beans { id title status } }'
38+
beans graphql '{ beans { id title status } }'
3839
3940
# Get a specific bean
40-
beans query '{ bean(id: "abc") { title status body } }'
41+
beans graphql '{ bean(id: "abc") { title status body } }'
4142
4243
# Filter beans by status
43-
beans query '{ beans(filter: { status: ["todo", "in-progress"] }) { id title } }'
44+
beans graphql '{ beans(filter: { status: ["todo", "in-progress"] }) { id title } }'
4445
4546
# Get beans with relationships
46-
beans query '{ beans { id title blockedBy { id title } children { id title } } }'
47+
beans graphql '{ beans { id title blockedBy { id title } children { id title } } }'
4748
4849
# Use variables
49-
beans query -v '{"id": "abc"}' 'query GetBean($id: ID!) { bean(id: $id) { title } }'
50+
beans graphql -v '{"id": "abc"}' 'query GetBean($id: ID!) { bean(id: $id) { title } }'
5051
51-
# Read query from stdin (useful for complex queries or escaping issues)
52-
echo '{ beans { id title } }' | beans query
53-
cat query.graphql | beans query
52+
# Read from stdin (useful for complex queries or escaping issues)
53+
echo '{ beans { id title } }' | beans graphql
54+
cat query.graphql | beans graphql
5455
5556
# Print the schema
56-
beans query --schema`,
57+
beans graphql --schema`,
5758
Args: func(cmd *cobra.Command, args []string) error {
5859
if querySchemaOnly {
5960
return nil
@@ -206,9 +207,9 @@ func GetGraphQLSchema() string {
206207
}
207208

208209
func init() {
209-
queryCmd.Flags().BoolVar(&queryJSON, "json", false, "Output raw JSON (no formatting)")
210-
queryCmd.Flags().StringVarP(&queryVariables, "variables", "v", "", "Query variables as JSON string")
211-
queryCmd.Flags().StringVarP(&queryOperation, "operation", "o", "", "Operation name (for multi-operation documents)")
212-
queryCmd.Flags().BoolVar(&querySchemaOnly, "schema", false, "Print the GraphQL schema and exit")
213-
rootCmd.AddCommand(queryCmd)
210+
graphqlCmd.Flags().BoolVar(&queryJSON, "json", false, "Output raw JSON (no formatting)")
211+
graphqlCmd.Flags().StringVarP(&queryVariables, "variables", "v", "", "Query variables as JSON string")
212+
graphqlCmd.Flags().StringVarP(&queryOperation, "operation", "o", "", "Operation name (for multi-operation documents)")
213+
graphqlCmd.Flags().BoolVar(&querySchemaOnly, "schema", false, "Print the GraphQL schema and exit")
214+
rootCmd.AddCommand(graphqlCmd)
214215
}

0 commit comments

Comments
 (0)