feat(cmd): add analyze command for project analysis
Introduces a new Cobra command `analyze` that performs deep project analysis, discovers files, builds context, streams to Grok for report generation, and handles output with confirmation.
This commit is contained in:
parent
643b904db4
commit
78379aa557
19
cmd/analyze.go
Normal file
19
cmd/analyze.go
Normal file
@ -0,0 +1,19 @@
|
||||
var analyzeCmd = &cobra.Command{
|
||||
Use: "analyze [flags]",
|
||||
Short: "Deep project analysis → educational Markdown report",
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
dir := viper.GetString("dir") // or flag
|
||||
output := viper.GetString("output")
|
||||
|
||||
// 1. Discover files via internal/linter
|
||||
files, err := linter.DiscoverFiles(dir)
|
||||
// 2. Build context (tree, git remote, go.mod, etc.)
|
||||
context := buildProjectContext(dir, files)
|
||||
// 3. Send to Grok (silent stream)
|
||||
report := grokClient.StreamSilent(buildAnalyzePrompt(context), model)
|
||||
// 4. Clean + preview (unified diff style against existing analyze.md if present)
|
||||
// 5. Confirm unless --yes
|
||||
// 6. Write or print
|
||||
},
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user