1// 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 (
9 "context"
10)
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}
26
27type sessionIDCtxKeyType string
28
29const sessionIDCtxKey sessionIDCtxKeyType = "sessionID"
30
31func WithSessionID(ctx context.Context, sessionID string) context.Context {
32 return context.WithValue(ctx, sessionIDCtxKey, sessionID)
33}
34
35func SessionID(ctx context.Context) string {
36 sessionID, _ := ctx.Value(sessionIDCtxKey).(string)
37 return sessionID
38}