Skip to content

Commit 6df2efd

Browse files
committed
feat: use heredoc for GraphQL queries in skill and add search example
1 parent f8efda7 commit 6df2efd

2 files changed

Lines changed: 36 additions & 18 deletions

File tree

skills/linear-cli/SKILL.md

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -124,22 +124,31 @@ grep -A 30 "^type Issue " "${TMPDIR:-/tmp}/linear-schema.graphql"
124124

125125
### Make a GraphQL request
126126

127+
**Important:** GraphQL queries containing non-null type markers (e.g. `String` followed by an exclamation mark) must be passed via heredoc stdin to avoid escaping issues. Simple queries without those markers can be passed inline.
128+
127129
```bash
128-
# Simple query
130+
# Simple query (no type markers, so inline is fine)
129131
linear api '{ viewer { id name email } }'
130132

131-
# Query with variables (coerces types: booleans, numbers, null)
132-
linear api 'query($teamId: String!) { team(id: $teamId) { name } }' --variable teamId=abc123
133+
# Query with variables — use heredoc to avoid escaping issues
134+
linear api --variable teamId=abc123 <<'GRAPHQL'
135+
query($teamId: String!) { team(id: $teamId) { name } }
136+
GRAPHQL
137+
138+
# Search issues by text
139+
linear api --variable term=onboarding <<'GRAPHQL'
140+
query($term: String!) { searchIssues(term: $term, first: 20) { nodes { identifier title state { name } } } }
141+
GRAPHQL
133142

134143
# Numeric and boolean variables
135-
linear api 'query($first: Int!) { issues(first: $first) { nodes { title } } }' --variable first=5
144+
linear api --variable first=5 <<'GRAPHQL'
145+
query($first: Int!) { issues(first: $first) { nodes { title } } }
146+
GRAPHQL
136147

137148
# Complex variables via JSON
138-
linear api 'query($filter: IssueFilter!) { issues(filter: $filter) { nodes { title } } }' \
139-
--variables-json '{"filter": {"state": {"name": {"eq": "In Progress"}}}}'
140-
141-
# Read query from stdin
142-
echo '{ viewer { id } }' | linear api
149+
linear api --variables-json '{"filter": {"state": {"name": {"eq": "In Progress"}}}}' <<'GRAPHQL'
150+
query($filter: IssueFilter!) { issues(filter: $filter) { nodes { title } } }
151+
GRAPHQL
143152

144153
# Pipe to jq for filtering
145154
linear api '{ issues(first: 5) { nodes { identifier title } } }' | jq '.data.issues.nodes[].title'

skills/linear-cli/SKILL.template.md

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -98,22 +98,31 @@ grep -A 30 "^type Issue " "${TMPDIR:-/tmp}/linear-schema.graphql"
9898

9999
### Make a GraphQL request
100100

101+
**Important:** GraphQL queries containing non-null type markers (e.g. `String` followed by an exclamation mark) must be passed via heredoc stdin to avoid escaping issues. Simple queries without those markers can be passed inline.
102+
101103
```bash
102-
# Simple query
104+
# Simple query (no type markers, so inline is fine)
103105
linear api '{ viewer { id name email } }'
104106

105-
# Query with variables (coerces types: booleans, numbers, null)
106-
linear api 'query($teamId: String!) { team(id: $teamId) { name } }' --variable teamId=abc123
107+
# Query with variables — use heredoc to avoid escaping issues
108+
linear api --variable teamId=abc123 <<'GRAPHQL'
109+
query($teamId: String!) { team(id: $teamId) { name } }
110+
GRAPHQL
111+
112+
# Search issues by text
113+
linear api --variable term=onboarding <<'GRAPHQL'
114+
query($term: String!) { searchIssues(term: $term, first: 20) { nodes { identifier title state { name } } } }
115+
GRAPHQL
107116

108117
# Numeric and boolean variables
109-
linear api 'query($first: Int!) { issues(first: $first) { nodes { title } } }' --variable first=5
118+
linear api --variable first=5 <<'GRAPHQL'
119+
query($first: Int!) { issues(first: $first) { nodes { title } } }
120+
GRAPHQL
110121

111122
# Complex variables via JSON
112-
linear api 'query($filter: IssueFilter!) { issues(filter: $filter) { nodes { title } } }' \
113-
--variables-json '{"filter": {"state": {"name": {"eq": "In Progress"}}}}'
114-
115-
# Read query from stdin
116-
echo '{ viewer { id } }' | linear api
123+
linear api --variables-json '{"filter": {"state": {"name": {"eq": "In Progress"}}}}' <<'GRAPHQL'
124+
query($filter: IssueFilter!) { issues(filter: $filter) { nodes { title } } }
125+
GRAPHQL
117126

118127
# Pipe to jq for filtering
119128
linear api '{ issues(first: 5) { nodes { identifier title } } }' | jq '.data.issues.nodes[].title'

0 commit comments

Comments
 (0)