LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
  • Overview
  • Agent
  • Middleware
  • Backends
  • Sandboxes
  • Skills
  • Subagents
  • Configuration
  • Types
Modal
Daytona
Deno
Node VFS
Sandbox Standard Tests
  • Vitest
⌘I

LangChain Assistant

Ask a question to get started

Enter to send•Shift+Enter new line

Menu

OverviewAgentMiddlewareBackendsSandboxesSkillsSubagentsConfigurationTypes
Modal
Daytona
Deno
Node VFS
Sandbox Standard Tests
Vitest
Language
Theme
JavaScriptdeepagentsconfigfindProjectRoot
Function●Since v1.4

findProjectRoot

Find the project root by looking for .git directory.

Walks up the directory tree from startPath (or cwd) looking for a .git directory, which indicates the project root.

Copy
findProjectRoot(startPath: string): string | null

Parameters

NameTypeDescription
startPathstring

Directory to start searching from. Defaults to current working directory.

View source on GitHub