Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions cmd/analyze.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ Use --no-files to skip writing graph files.`,
if len(args) > 0 {
dir = args[0]
}
if err := analyze.Run(cmd.Context(), cfg, dir, opts); err != nil {
return err
}
if cfg.FilesEnabled() && !noFiles {
return files.Generate(cmd.Context(), cfg, dir, files.GenerateOptions{})
// File mode: Generate handles the full pipeline (API call +
// cache + sidecars) in a single upload. Running analyze.Run
// first would duplicate the API call.
return files.Generate(cmd.Context(), cfg, dir, files.GenerateOptions{Force: opts.Force})
Comment on lines 39 to +43
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

This makes the default analyze path serve stale results after the first run.

files.Generate only checks whether .supermodel/graph.json exists when --force is false (internal/files/handler.go:50-81). It never fingerprints or hashes the current repo the way analyze.Run does (internal/analyze/handler.go:33-69). Easy repro: run analyze once, edit any source file, run it again, and this branch will still reuse the old sidecar cache instead of analyzing the new repo. To keep the single-upload win, this path needs the same content-based cache validation before trusting .supermodel/graph.json.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@cmd/analyze.go` around lines 39 - 43, The current branch returns
files.Generate(...) early which trusts .supermodel/graph.json and can serve
stale results because files.Generate only checks file existence when --force is
false; instead compute the same repo fingerprint/content hash and cache
validation used by analyze.Run (see internal/analyze/handler.go fingerprinting
logic) before calling files.Generate, and if the fingerprint indicates the cache
is valid let files.Generate proceed, otherwise invalidate or regenerate the
graph (or pass a Force-equivalent) so files.Generate does not reuse stale
.supermodel/graph.json; update cmd/analyze.go to invoke the same
fingerprinting/check routine (or extract it into a helper used by both
analyze.Run and files.Generate) so files.Generate only runs when content-based
validation passes.

}
return nil
return analyze.Run(cmd.Context(), cfg, dir, opts)
Comment on lines 39 to +45
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Skipping analyze.Run also drops two analyze behaviors users already have.

analyze.Run is the thing that prints the requested summary/JSON and writes the content-hash cache advertised in this command’s help (internal/analyze/handler.go:21-92). files.Generate only renders sidecars and persists .supermodel/graph.json (internal/files/handler.go:82-132). So in the default mode, supermodel analyze -o json no longer behaves like JSON output, and this path never warms the shared cache for follow-up analysis commands.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@cmd/analyze.go` around lines 39 - 45, When cfg.FilesEnabled() && !noFiles
causes an early return to files.Generate, it skips analyze.Run's
responsibilities (printing summary/JSON and writing the content-hash cache).
Update the branch so that after calling files.Generate(cmd.Context(), cfg, dir,
files.GenerateOptions{Force: opts.Force}) you also invoke
analyze.Run(cmd.Context(), cfg, dir, opts) (or otherwise call the functions in
analyze.Run that emit JSON/summary and persist the cache) and ensure the command
output/exit behavior still reflects analyze.Run's result; keep references to
cfg.FilesEnabled, noFiles, files.Generate, files.GenerateOptions, and
analyze.Run to locate and implement the change.

},
}

Expand Down
Loading