@@ -44,14 +44,6 @@ export function startNewChat() {
4444 return currentChatId
4545}
4646
47- export function isDir ( p : string ) : boolean {
48- try {
49- return statSync ( p ) . isDirectory ( )
50- } catch {
51- return false
52- }
53- }
54-
5547// Get the project-specific data directory
5648export function getProjectDataDir ( ) : string {
5749 const root = getProjectRoot ( )
@@ -73,10 +65,6 @@ export function getCurrentChatDir(): string {
7365 return dir
7466}
7567
76- export function isValidProjectRoot ( dir : string ) : boolean {
77- return ! isSubdir ( dir , os . homedir ( ) )
78- }
79-
8068const execAsync = promisify ( exec )
8169
8270let projectRoot : string
@@ -159,24 +147,6 @@ export function toAbsolutePath(filepath: string, projectRoot: string): string {
159147 return path . normalize ( path . resolve ( projectRoot , filepath ) )
160148}
161149
162- /**
163- * Returns true if the `toPath` is a subdirectory of `fromPath`.
164- */
165- export function isSubdir ( fromPath : string , toPath : string ) {
166- const resolvedFrom = path . resolve ( fromPath )
167- const resolvedTo = path . resolve ( toPath )
168-
169- if ( process . platform === 'win32' ) {
170- const fromDrive = path . parse ( resolvedFrom ) . root . toLowerCase ( )
171- const toDrive = path . parse ( resolvedTo ) . root . toLowerCase ( )
172- if ( fromDrive !== toDrive ) {
173- return false
174- }
175- }
176-
177- return ! path . relative ( resolvedFrom , resolvedTo ) . startsWith ( '..' )
178- }
179-
180150let cachedProjectFileContext : ProjectFileContext | undefined
181151
182152export function initProjectFileContextWithWorker (
@@ -229,7 +199,7 @@ export function initProjectFileContextWithWorker(
229199export const getProjectFileContext = async (
230200 projectRoot : string ,
231201 lastFileVersion : Record < string , string >
232- ) => {
202+ ) : Promise < ProjectFileContext > => {
233203 const gitChanges = await getGitChanges ( )
234204 const changesSinceLastChat = getChangesSinceLastFileVersion ( lastFileVersion )
235205
0 commit comments