From 78379aa557c7323e0e0b1218e4a71dba6e6aed89 Mon Sep 17 00:00:00 2001 From: Greg Gauthier Date: Sat, 28 Mar 2026 12:16:17 +0000 Subject: [PATCH] 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. --- cmd/analyze.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 cmd/analyze.go diff --git a/cmd/analyze.go b/cmd/analyze.go new file mode 100644 index 0000000..bdb600a --- /dev/null +++ b/cmd/analyze.go @@ -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 + }, +} +