Skip to content

Commit 867157f

Browse files
committed
updates
1 parent 6f1c6b5 commit 867157f

File tree

4 files changed

+18
-18
lines changed

4 files changed

+18
-18
lines changed

project.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
//> using scala 3.7.0-RC4
1+
//> using scala 3.7.1
22
//> using platform scala-native
3-
//> using nativeVersion 0.5.7
3+
//> using nativeVersion 0.5.8
44

55
//> using dep com.github.lolgab::magnum::1.3.1
66
//> using dep com.github.lolgab::scala-native-jdbc-sqlite::0.0.3
@@ -10,9 +10,9 @@
1010
//> using dep com.outr::scribe::3.16.1
1111
//> using dep com.lihaoyi::os-lib::0.11.4
1212
//> using dep com.lihaoyi::pprint::0.9.0
13-
//> using dep com.lihaoyi::upickle::4.1.0
13+
//> using dep com.lihaoyi::upickle::4.2.1
1414
//> using dep com.indoorvivants::trigs::0.0.2
1515
//> using dep com.indoorvivants::decline-completion::0.1.0
16-
//> using dep com.indoorvivants::mcp::0.0.3
16+
//> using dep com.indoorvivants::mcp-quick::0.1.3
1717
//> using resourceDir ./resources
1818
//> using nativeEmbedResources

src/cli.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,20 +32,20 @@ enum CLI derives CommandApplication:
3232
@Help("Start MCP server on stdin") case MCP
3333

3434
@Name("search-code") @Help(
35-
"search code "
35+
"search code of snippet files using trigam search"
3636
) case SearchCode(
3737
@Short("q") query: Option[String],
3838
@Short("l") limit: Option[Int]
3939
)
4040

41-
case Sync
41+
@Help("Synchronise code search index with contents on disk") case Sync
4242

4343
@Name("print-config") @Help(
44-
"(for debugging) pretty print the configuration"
44+
"pretty print the configuration"
4545
) case PrintConfig(@Short("l") location: Boolean)
4646

4747
@Name("test-template") @Help(
48-
"(for debugging) test templates specified in configuration"
48+
" test templates specified in configuration"
4949
) case TestTemplate(
5050
@Short("n") name: Option[String],
5151
@Short("a") all: Boolean

src/command.alfred.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def commandAlfred(ctx: Context, cli: AlfredCommand): Result =
6868
end handleNew
6969

7070
def handleOpen(args: Seq[String]) =
71-
val all = ctx.db.getAll()
71+
val all = ctx.db.getAll().sortBy(_.id).reverse
7272
val query = args.mkString(" ").toLowerCase.trim
7373
val filtered = all.filter(snip =>
7474
query.isEmpty() || snip.description.toLowerCase().contains(query)

src/commandMCP.scala

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ import mcp.*
55
def commandMCP(context: Context): Result =
66
val mcp = MCPBuilder
77
.create()
8-
.handleRequest(initialize): req =>
8+
.handle(initialize): req =>
99
InitializeResult(
1010
capabilities =
1111
ServerCapabilities(tools = Some(ServerCapabilities.Tools())),
12-
protocolVersion = req.params.protocolVersion,
12+
protocolVersion = req.protocolVersion,
1313
serverInfo = Implementation("sniper-mcp", "0.0.1")
1414
)
15-
.handleRequest(tools.list): req =>
15+
.handle(tools.list): req =>
1616
ListToolsResult(
1717
Seq(
1818
Tool(
@@ -52,22 +52,22 @@ def commandMCP(context: Context): Result =
5252
)
5353
)
5454
)
55-
.handleRequest(tools.call): req =>
56-
req.params.name match
55+
.handle(tools.call): req =>
56+
req.name match
5757
case "sniper_list" =>
5858
CallToolResult(
5959
Seq(TextContent(listSnippets(context)))
6060
)
6161
case "sniper_code_search" =>
62-
val query = req.params.arguments.get.obj("query").str
62+
val query = req.arguments.get.obj("query").str
6363
val results = searchResults(context, query)
6464
CallToolResult(
6565
Seq(TextContent(upickle.default.write(results)))
6666
)
6767

6868
case "sniper_read_file" =>
69-
val snippetId = req.params.arguments.get.obj("snippetId").num.toLong
70-
val filePath = req.params.arguments.get.obj("filePath").str
69+
val snippetId = req.arguments.get.obj("snippetId").num.toLong
70+
val filePath = req.arguments.get.obj("filePath").str
7171
if !context.db.get(snippetId).nonEmpty then
7272
Error(ErrorCode.InvalidRequest, s"Snippet $snippetId not found")
7373
else if !context.db.getFiles(snippetId).exists(_.filename == filePath)
@@ -87,7 +87,7 @@ def commandMCP(context: Context): Result =
8787
)
8888
)
8989
end if
90-
.process(System.in)
90+
.run(SyncTransport.default)
9191
Result.None
9292
end commandMCP
9393

0 commit comments

Comments
 (0)