blob: d95a5e45d18817b8156e63797814175a787b0366 [file] [log] [blame]
Earl Lee2e463fb2025-04-17 11:22:22 -07001// Package claudetool provides tools for Claude AI models.
2//
3// When adding, removing, or modifying tools in this package,
4// remember to update the tool display template in termui/termui.go
5// to ensure proper tool output formatting.
6package claudetool
7
8import (
Earl Lee2e463fb2025-04-17 11:22:22 -07009 "context"
Earl Lee2e463fb2025-04-17 11:22:22 -070010)
11
12type workingDirCtxKeyType string
13
14const workingDirCtxKey workingDirCtxKeyType = "workingDir"
15
16func WithWorkingDir(ctx context.Context, wd string) context.Context {
17 return context.WithValue(ctx, workingDirCtxKey, wd)
18}
19
20func WorkingDir(ctx context.Context) string {
21 // If cmd.Dir is empty, it uses the current working directory,
22 // so we can use that as a fallback.
23 wd, _ := ctx.Value(workingDirCtxKey).(string)
24 return wd
25}