feat: enable file indexing by default
File indexing only adds ~3 seconds to the indexing process, so enable it by default to make the get_file tool work out of the box. - MCP index_revision tool now indexes files automatically - CLI flag changed from --files to --no-files (opt-out) - Update README examples Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -217,12 +217,19 @@ func (s *Server) makeIndexHandler(indexer *nixos.Indexer) ToolHandler {
|
||||
return ErrorContent(fmt.Errorf("indexing failed: %w", err)), nil
|
||||
}
|
||||
|
||||
// Index files by default
|
||||
fileCount, err := indexer.IndexFiles(ctx, result.Revision.ID, result.Revision.GitHash)
|
||||
if err != nil {
|
||||
s.logger.Printf("Warning: file indexing failed: %v", err)
|
||||
}
|
||||
|
||||
var sb strings.Builder
|
||||
sb.WriteString(fmt.Sprintf("Indexed revision: %s\n", result.Revision.GitHash))
|
||||
if result.Revision.ChannelName != "" {
|
||||
sb.WriteString(fmt.Sprintf("Channel: %s\n", result.Revision.ChannelName))
|
||||
}
|
||||
sb.WriteString(fmt.Sprintf("Options: %d\n", result.OptionCount))
|
||||
sb.WriteString(fmt.Sprintf("Files: %d\n", fileCount))
|
||||
sb.WriteString(fmt.Sprintf("Duration: %s\n", result.Duration.Round(time.Millisecond)))
|
||||
|
||||
return CallToolResult{
|
||||
|
||||
Reference in New Issue
Block a user