blob: 310044c65431a5a721f33683dc2532cebf21034c [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}
Josh Bleecher Snyder112b9232025-05-23 11:26:33 -070026
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}