File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -46,7 +46,7 @@ export namespace App {
4646 const data = path . join (
4747 Global . Path . data ,
4848 "project" ,
49- git ? git . split ( path . sep ) . filter ( Boolean ) . join ( "-" ) : "global" ,
49+ git ? directory ( git ) : "global" ,
5050 )
5151 const stateFile = Bun . file ( path . join ( data , APP_JSON ) )
5252 const state = ( await stateFile . json ( ) . catch ( ( ) => ( { } ) ) ) as {
@@ -133,4 +133,13 @@ export namespace App {
133133 } ) ,
134134 )
135135 }
136+
137+ function directory ( input : string ) : string {
138+ return input
139+ . split ( path . sep )
140+ . filter ( Boolean )
141+ . join ( "-" )
142+ . replace ( / [ ^ A - Z a - z 0 - 9 _ ] / g, "-" )
143+ }
136144}
145+
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import { Server } from "./server/server"
44import fs from "fs/promises"
55import path from "path"
66import { Share } from "./share/share"
7+ import url from "node:url"
78import { Global } from "./global"
89import yargs from "yargs"
910import { hideBin } from "yargs/helpers"
@@ -63,7 +64,7 @@ const cli = yargs(hideBin(process.argv))
6364 const server = Server . listen ( )
6465
6566 let cmd = [ "go" , "run" , "./main.go" ]
66- let cwd = new URL ( "../../tui/cmd/opencode" , import . meta. url ) . pathname
67+ let cwd = url . fileURLToPath ( new URL ( "../../tui/cmd/opencode" , import . meta. url ) )
6768 if ( Bun . embeddedFiles . length > 0 ) {
6869 const blob = Bun . embeddedFiles [ 0 ] as File
6970 const binary = path . join ( Global . Path . cache , "tui" , blob . name )
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ export namespace Log {
1919 await fs . mkdir ( dir , { recursive : true } )
2020 cleanup ( dir )
2121 if ( options . print ) return
22- logpath = path . join ( dir , new Date ( ) . toISOString ( ) . split ( "." ) [ 0 ] + ".log" )
22+ logpath = path . join ( dir , new Date ( ) . toISOString ( ) . split ( "." ) [ 0 ] . replace ( / : / g , "" ) + ".log" )
2323 const logfile = Bun . file ( logpath )
2424 await fs . truncate ( logpath ) . catch ( ( ) => { } )
2525 const writer = logfile . writer ( )
Original file line number Diff line number Diff line change 66 "fmt"
77 "image/color"
88 "os"
9+ "path"
910 "path/filepath"
1011 "strings"
1112
@@ -42,7 +43,7 @@ func LoadThemesFromJSON() error {
4243 continue
4344 }
4445 themeName := strings .TrimSuffix (entry .Name (), ".json" )
45- data , err := themesFS .ReadFile (filepath .Join ("themes" , entry .Name ()))
46+ data , err := themesFS .ReadFile (path .Join ("themes" , entry .Name ()))
4647 if err != nil {
4748 return fmt .Errorf ("failed to read theme file %s: %w" , entry .Name (), err )
4849 }
Original file line number Diff line number Diff line change 1+ @ echo off
2+
3+ if not exist " .git" (
4+ exit /b 0
5+ )
6+
7+ if not exist " .git\hooks" (
8+ mkdir " .git\hooks"
9+ )
10+
11+ (
12+ echo #!/bin/sh
13+ echo bun run typecheck
14+ ) > " .git\hooks\pre-push"
15+
16+ echo ✅ Pre-push hook installed
You can’t perform that action at this time.
0 commit comments