File tree Expand file tree Collapse file tree 4 files changed +34
-0
lines changed
Expand file tree Collapse file tree 4 files changed +34
-0
lines changed Original file line number Diff line number Diff line change 11package main
22
33import (
4+ "context"
45 "encoding/json"
56 "flag"
67 "io"
@@ -63,6 +64,7 @@ The commands are:
6364 search search for results on Sourcegraph
6465 search-jobs manages search jobs
6566 serve-git serves your local git repositories over HTTP for Sourcegraph to pull
67+ tool exposes tools for AI agents to interact with Sourcegraph (EXPERIMENTAL)
6668 users,user manages users
6769 codeowners manages code ownership information
6870 version display and compare the src-cli version against the recommended version for your instance
@@ -90,6 +92,14 @@ func main() {
9092 log .SetFlags (0 )
9193 log .SetPrefix ("" )
9294
95+ // "tool" does not use the legacy commander cli framework and uses urfave/cli v3 instead
96+ if len (os .Args ) >= 2 && os .Args [1 ] == "tool" {
97+ if err := toolCmd .Run (context .Background (), os .Args [1 :]); err != nil {
98+ log .Fatal (err )
99+ }
100+ return
101+ }
102+
93103 commands .run (flag .CommandLine , "src" , usageText , normalizeDashHelp (os .Args [1 :]))
94104}
95105
Original file line number Diff line number Diff line change 1+ package main
2+
3+ import (
4+ "context"
5+ "fmt"
6+ "os"
7+
8+ "github.com/urfave/cli/v3"
9+ )
10+
11+ var toolCmd = & cli.Command {
12+ Name : "src tool" ,
13+ Usage : "Exposes tools for AI agents to interact with Sourcegraph (EXPERIMENTAL)" ,
14+ Description : "The tool subcommand exposes tools that can be used by AI agents to perform tasks against Sourcegraph instances." ,
15+ Commands : []* cli.Command {},
16+ Writer : os .Stdout ,
17+ Action : func (ctx context.Context , c * cli.Command ) error {
18+ fmt .Println ("Not implemented" )
19+ return nil
20+ },
21+ }
Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ require (
2929 github.com/sourcegraph/scip v0.6.1
3030 github.com/sourcegraph/sourcegraph/lib v0.0.0-20240709083501-1af563b61442
3131 github.com/stretchr/testify v1.11.1
32+ github.com/urfave/cli/v3 v3.6.1
3233 golang.org/x/net v0.44.0
3334 golang.org/x/sync v0.17.0
3435 google.golang.org/api v0.132.0
Original file line number Diff line number Diff line change @@ -451,6 +451,8 @@ github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD
451451github.com/tetratelabs/wazero v1.3.0 h1:nqw7zCldxE06B8zSZAY0ACrR9OH5QCcPwYmYlwtcwtE =
452452github.com/tetratelabs/wazero v1.3.0 /go.mod h1:wYx2gNRg8/WihJfSDxA1TIL8H+GkfLYm+bIfbblu9VQ =
453453github.com/urfave/cli v1.22.12 /go.mod h1:sSBEIC79qR6OvcmsD4U3KABeOTxDqQtdDnaFuUN30b8 =
454+ github.com/urfave/cli/v3 v3.6.1 h1:j8Qq8NyUawj/7rTYdBGrxcH7A/j7/G8Q5LhWEW4G3Mo =
455+ github.com/urfave/cli/v3 v3.6.1 /go.mod h1:ysVLtOEmg2tOy6PknnYVhDoouyC/6N42TMeoMzskhso =
454456github.com/vbatts/tar-split v0.11.3 h1:hLFqsOLQ1SsppQNTMpkpPXClLDfC2A3Zgy9OUU+RVck =
455457github.com/vbatts/tar-split v0.11.3 /go.mod h1:9QlHN18E+fEH7RdG+QAJJcuya3rqT7eXSTY7wGrAokY =
456458github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM =
You can’t perform that action at this time.
0 commit comments