@@ -12,7 +12,7 @@ import * as Log from "@opencode-ai/core/util/log"
1212import { sanitizedProcessEnv } from "@opencode-ai/core/util/opencode-process"
1313import { which } from "@/util/which"
1414import { zod } from "@/util/effect-zod"
15- import { withStatics } from "@/util/schema"
15+ import { NonNegativeInt , withStatics } from "@/util/schema"
1616
1717const log = Log . create ( { service : "ripgrep" } )
1818const VERSION = "15.1.0"
@@ -27,19 +27,19 @@ const PLATFORM = {
2727} as const
2828
2929const TimeStats = Schema . Struct ( {
30- secs : Schema . Number ,
31- nanos : Schema . Number ,
30+ secs : NonNegativeInt ,
31+ nanos : NonNegativeInt ,
3232 human : Schema . String ,
3333} )
3434
3535const Stats = Schema . Struct ( {
3636 elapsed : TimeStats ,
37- searches : Schema . Number ,
38- searches_with_match : Schema . Number ,
39- bytes_searched : Schema . Number ,
40- bytes_printed : Schema . Number ,
41- matched_lines : Schema . Number ,
42- matches : Schema . Number ,
37+ searches : NonNegativeInt ,
38+ searches_with_match : NonNegativeInt ,
39+ bytes_searched : NonNegativeInt ,
40+ bytes_printed : NonNegativeInt ,
41+ matched_lines : NonNegativeInt ,
42+ matches : NonNegativeInt ,
4343} )
4444
4545const PathText = Schema . Struct ( {
@@ -58,15 +58,15 @@ export const SearchMatch = Schema.Struct({
5858 lines : Schema . Struct ( {
5959 text : Schema . String ,
6060 } ) ,
61- line_number : Schema . Number ,
62- absolute_offset : Schema . Number ,
61+ line_number : NonNegativeInt ,
62+ absolute_offset : NonNegativeInt ,
6363 submatches : Schema . Array (
6464 Schema . Struct ( {
6565 match : Schema . Struct ( {
6666 text : Schema . String ,
6767 } ) ,
68- start : Schema . Number ,
69- end : Schema . Number ,
68+ start : NonNegativeInt ,
69+ end : NonNegativeInt ,
7070 } ) ,
7171 ) ,
7272} ) . pipe ( withStatics ( ( s ) => ( { zod : zod ( s ) } ) ) )
@@ -80,7 +80,7 @@ const End = Schema.Struct({
8080 type : Schema . Literal ( "end" ) ,
8181 data : Schema . Struct ( {
8282 path : PathText ,
83- binary_offset : Schema . NullOr ( Schema . Number ) ,
83+ binary_offset : Schema . NullOr ( NonNegativeInt ) ,
8484 stats : Stats ,
8585 } ) ,
8686} )
0 commit comments