MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / formatCwd

Function formatCwd

cli/src/utils/path-helpers.ts:14–22  ·  view source on GitHub ↗
(cwd: string | undefined, env?: CliEnv)

Source from the content-addressed store, hash-verified

12 * @param env - Optional environment object (defaults to CLI env)
13 */
14export function formatCwd(cwd: string | undefined, env?: CliEnv): string {
15 if (!cwd) return ''
16 const resolvedEnv = env ?? getCliEnv()
17 const homeDir = resolvedEnv.HOME || resolvedEnv.USERPROFILE || os.homedir()
18 if (homeDir && cwd.startsWith(homeDir)) {
19 return '~' + cwd.slice(homeDir.length)
20 }
21 return cwd
22}
23
24/**
25 * Get relative path from the project root

Callers 4

AppFunction · 0.90
ProjectPickerScreenFunction · 0.90
top-banner.tsxFile · 0.90
message-block.tsxFile · 0.90

Calls 1

getCliEnvFunction · 0.90

Tested by

no test coverage detected