Skip to content
Merged
Show file tree
Hide file tree
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: 10 additions & 0 deletions cmd/src/main.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package main

import (
"context"
"encoding/json"
"flag"
"io"
Expand Down Expand Up @@ -63,6 +64,7 @@ The commands are:
search search for results on Sourcegraph
search-jobs manages search jobs
serve-git serves your local git repositories over HTTP for Sourcegraph to pull
tool exposes tools for AI agents to interact with Sourcegraph (EXPERIMENTAL)
users,user manages users
codeowners manages code ownership information
version display and compare the src-cli version against the recommended version for your instance
Expand Down Expand Up @@ -90,6 +92,14 @@ func main() {
log.SetFlags(0)
log.SetPrefix("")

// "tool" does not use the legacy commander cli framework and uses urfave/cli v3 instead
if len(os.Args) >= 2 && os.Args[1] == "tool" {
if err := toolCmd.Run(context.Background(), os.Args[1:]); err != nil {
log.Fatal(err)
}
return
}

commands.run(flag.CommandLine, "src", usageText, normalizeDashHelp(os.Args[1:]))
}

Expand Down
21 changes: 21 additions & 0 deletions cmd/src/tool.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package main

import (
"context"
"fmt"
"os"

"github.com/urfave/cli/v3"
)

var toolCmd = &cli.Command{
Name: "src tool",
Usage: "Exposes tools for AI agents to interact with Sourcegraph (EXPERIMENTAL)",
Description: "The tool subcommand exposes tools that can be used by AI agents to perform tasks against Sourcegraph instances.",
Commands: []*cli.Command{},
Writer: os.Stdout,
Action: func(ctx context.Context, c *cli.Command) error {
fmt.Println("Not implemented")
return nil
},
}
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ require (
github.com/sourcegraph/scip v0.6.1
github.com/sourcegraph/sourcegraph/lib v0.0.0-20240709083501-1af563b61442
github.com/stretchr/testify v1.11.1
github.com/urfave/cli/v3 v3.6.1
golang.org/x/net v0.44.0
golang.org/x/sync v0.17.0
google.golang.org/api v0.132.0
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,8 @@ github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD
github.com/tetratelabs/wazero v1.3.0 h1:nqw7zCldxE06B8zSZAY0ACrR9OH5QCcPwYmYlwtcwtE=
github.com/tetratelabs/wazero v1.3.0/go.mod h1:wYx2gNRg8/WihJfSDxA1TIL8H+GkfLYm+bIfbblu9VQ=
github.com/urfave/cli v1.22.12/go.mod h1:sSBEIC79qR6OvcmsD4U3KABeOTxDqQtdDnaFuUN30b8=
github.com/urfave/cli/v3 v3.6.1 h1:j8Qq8NyUawj/7rTYdBGrxcH7A/j7/G8Q5LhWEW4G3Mo=
github.com/urfave/cli/v3 v3.6.1/go.mod h1:ysVLtOEmg2tOy6PknnYVhDoouyC/6N42TMeoMzskhso=
github.com/vbatts/tar-split v0.11.3 h1:hLFqsOLQ1SsppQNTMpkpPXClLDfC2A3Zgy9OUU+RVck=
github.com/vbatts/tar-split v0.11.3/go.mod h1:9QlHN18E+fEH7RdG+QAJJcuya3rqT7eXSTY7wGrAokY=
github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM=
Expand Down
Loading