Skip to content

Commit ad2015e

Browse files
Fix leading-comment read query routing and skills skill id.
Strip SQL comments before classifying read queries and align skills_cli_automation_skill with AGENTS.md. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 90ed4ed commit ad2015e

3 files changed

Lines changed: 5 additions & 2 deletions

File tree

internal/cmd/agentguide/agentguide.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const (
1414
SkillsRepoURL = "https://github.com/planetscale/skills"
1515
SkillsSetupCmd = "git clone https://github.com/planetscale/skills.git && cd skills && script/setup"
1616
SkillsNPXInstall = "npx skills add planetscale/skills -g -y"
17-
SkillsCLIAutomation = "planetscale-pscale-cli-automation"
17+
SkillsCLIAutomation = "14-pscale-cli-automation"
1818
)
1919

2020
type response struct {

internal/sqlquery/sqlquery.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ func queryPostgres(ctx context.Context, ch *cmdutil.Helper, opts Options, pgDB s
271271
var readQueryPrefixes = []string{"SELECT", "SHOW", "DESCRIBE", "DESC", "EXPLAIN", "TABLE"}
272272

273273
func isReadQuery(query string) bool {
274-
q := strings.TrimSpace(query)
274+
q := strings.TrimSpace(stripSQLGuardIgnoredText(query))
275275
upper := strings.ToUpper(q)
276276
if hasKeywordPrefix(upper, "WITH") {
277277
afterCTEs, ok := queryAfterCTEs(q)

internal/sqlquery/sqlquery_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ func TestIsReadQuery(t *testing.T) {
1515
want bool
1616
}{
1717
{name: "select", query: "SELECT 1", want: true},
18+
{name: "leading line comment select", query: "-- load users\nSELECT 1", want: true},
19+
{name: "leading hash comment select", query: "# load users\nSELECT 1", want: true},
20+
{name: "leading block comment select", query: "/* load users */ SELECT 1", want: true},
1821
{name: "with select", query: " with x as (select 1) select * from x", want: true},
1922
{name: "with multiple ctes select", query: "WITH a AS (SELECT 1), b AS (SELECT 2) SELECT * FROM b", want: true},
2023
{name: "with string containing paren", query: "WITH x AS (SELECT ')' AS val) SELECT * FROM x", want: true},

0 commit comments

Comments
 (0)