From 26903018338b9f1f8f6f579e30a93ce0440b257c Mon Sep 17 00:00:00 2001 From: justsisyphus Date: Thu, 22 Jan 2026 22:48:06 +0900 Subject: [PATCH] fix(tools): minor ast-grep improvements Small fixes to AST-grep constants, tools, and utility functions. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus --- src/tools/ast-grep/constants.ts | 8 ++++---- src/tools/ast-grep/tools.ts | 6 +++--- src/tools/ast-grep/utils.ts | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/tools/ast-grep/constants.ts b/src/tools/ast-grep/constants.ts index baa43539..af9d15ec 100644 --- a/src/tools/ast-grep/constants.ts +++ b/src/tools/ast-grep/constants.ts @@ -233,9 +233,9 @@ export function formatEnvironmentCheck(result: EnvironmentCheckResult): string { // CLI status if (result.cli.available) { - lines.push(`✓ CLI: Available (${result.cli.path})`) + lines.push(`[OK] CLI: Available (${result.cli.path})`) } else { - lines.push(`✗ CLI: Not available`) + lines.push(`[X] CLI: Not available`) if (result.cli.error) { lines.push(` Error: ${result.cli.error}`) } @@ -244,9 +244,9 @@ export function formatEnvironmentCheck(result: EnvironmentCheckResult): string { // NAPI status if (result.napi.available) { - lines.push(`✓ NAPI: Available`) + lines.push(`[OK] NAPI: Available`) } else { - lines.push(`✗ NAPI: Not available`) + lines.push(`[X] NAPI: Not available`) if (result.napi.error) { lines.push(` Error: ${result.napi.error}`) } diff --git a/src/tools/ast-grep/tools.ts b/src/tools/ast-grep/tools.ts index 415838a2..ec3de1ee 100644 --- a/src/tools/ast-grep/tools.ts +++ b/src/tools/ast-grep/tools.ts @@ -15,17 +15,17 @@ function getEmptyResultHint(pattern: string, lang: CliLanguage): string | null { if (lang === "python") { if (src.startsWith("class ") && src.endsWith(":")) { const withoutColon = src.slice(0, -1) - return `💡 Hint: Remove trailing colon. Try: "${withoutColon}"` + return `Hint: Remove trailing colon. Try: "${withoutColon}"` } if ((src.startsWith("def ") || src.startsWith("async def ")) && src.endsWith(":")) { const withoutColon = src.slice(0, -1) - return `💡 Hint: Remove trailing colon. Try: "${withoutColon}"` + return `Hint: Remove trailing colon. Try: "${withoutColon}"` } } if (["javascript", "typescript", "tsx"].includes(lang)) { if (/^(export\s+)?(async\s+)?function\s+\$[A-Z_]+\s*$/i.test(src)) { - return `💡 Hint: Function patterns need params and body. Try "function $NAME($$$) { $$$ }"` + return `Hint: Function patterns need params and body. Try "function $NAME($$$) { $$$ }"` } } diff --git a/src/tools/ast-grep/utils.ts b/src/tools/ast-grep/utils.ts index a7f27b87..99eb33ca 100644 --- a/src/tools/ast-grep/utils.ts +++ b/src/tools/ast-grep/utils.ts @@ -17,7 +17,7 @@ export function formatSearchResult(result: SgResult): string { : result.truncatedReason === "max_output_bytes" ? "output exceeded 1MB limit" : "search timed out" - lines.push(`⚠️ Results truncated (${reason})\n`) + lines.push(`[TRUNCATED] Results truncated (${reason})\n`) } lines.push(`Found ${result.matches.length} match(es)${result.truncated ? ` (truncated from ${result.totalMatches})` : ""}:\n`) @@ -50,7 +50,7 @@ export function formatReplaceResult(result: SgResult, isDryRun: boolean): string : result.truncatedReason === "max_output_bytes" ? "output exceeded 1MB limit" : "search timed out" - lines.push(`⚠️ Results truncated (${reason})\n`) + lines.push(`[TRUNCATED] Results truncated (${reason})\n`) } lines.push(`${prefix}${result.matches.length} replacement(s):\n`)