Files
ai-code-assistant/cmd/indexer/indexer.go
Michael Powers 25f8cae8cb Code Cleanup and Quality of Life
Checks to make sure repo is indexed before generating code.
Don't generate tests for changes to tests.
Remove unused code.
Fix bootstrapping issue with langchaingo tables.
2025-04-20 08:31:26 -04:00

42 lines
893 B
Go

package indexer
import (
"ai-code-assistant/pkg/indexer"
"context"
"github.com/urfave/cli/v3"
)
func Command() *cli.Command {
return &cli.Command{
Name: "indexer",
Usage: "this command will index a local git repository to build context for the llm",
Action: run,
Flags: []cli.Flag{
&cli.StringFlag{
Name: "repo",
Usage: "path to git repository",
Required: true,
},
&cli.IntFlag{
Name: "chunk-size",
Usage: "number of bytes to chunk files into, should be roughly 4x the number of tokens",
Value: 512 * 4,
},
&cli.BoolFlag{
Name: "force",
Usage: "force re-indexing of the repository",
},
},
}
}
func run(ctx context.Context, cmd *cli.Command) error {
idx := indexer.New(ctx, cmd.String("repo"), int(cmd.Int("chunk-size")), cmd.Bool("force"))
if err := idx.Index(ctx); err != nil {
return err
}
return nil
}