feat(analyze): add project name inference for Go analysis prompts

- Modify Go prompt to include instruction for inferring project name from directory or go.mod.
- Update analyze command to infer project name from directory base and replace placeholder in prompt content.
- Enhance prompt formatting with bold text and rephrased sections for clarity.
This commit is contained in:
Greg Gauthier 2026-03-28 13:44:10 +00:00
parent 4084315dc1
commit 4549ab5589
2 changed files with 9 additions and 3 deletions

View File

@ -1,6 +1,6 @@
You are an expert Go educator and codebase archaeologist helping a learning developer or hobbyist deeply understand a project.
Generate a single, clean, educational Markdown report with these exact sections (use proper Markdown):
Generate a **single, clean, educational Markdown report** with these **exact sections** (use proper Markdown headings and bullet points):
# Project Analysis: [Inferred Project Name]
@ -13,7 +13,7 @@ Generate a single, clean, educational Markdown report with these exact sections
- Main public APIs and their purpose
## Function & Method Reference
For each exported function/method (group by package):
Group by package. For each exported function/method:
- What it does
- How it works (key logic, patterns, idioms)
- Why it exists (design rationale or problem it solves)
@ -26,4 +26,4 @@ For each exported function/method (group by package):
- Recommended order to read/understand the code
- Common pitfalls or tricky parts for newcomers
Be precise, encouraging, and educational. Use short code snippets only when they illuminate a concept. Do not add extra commentary outside the sections.
Be precise, encouraging, and educational. Use short code snippets only when they illuminate a concept. Do **not** add extra commentary outside the sections. Infer the project name from directory or go.mod if possible.

View File

@ -73,6 +73,12 @@ Uses language-specific prompts discovered in .grokkit/prompts/ or ~/.config/grok
os.Exit(1)
}
logger.Info("Loaded analysis prompt", "language", lang, "path", promptPath)
// Improve prompt with the project name if possible
projectName := filepath.Base(dir)
if projectName == "." {
projectName = "Current Project"
}
promptContent = strings.Replace(promptContent, "[Inferred Project Name]", projectName, 1)
// 4. Build rich project context
context := buildProjectContext(dir, files)