MCPcopy Create free account
hub / github.com/diillson/chatcli / NewPolicyManager

Function NewPolicyManager

cli/coder/policy_manager.go:43–58  ·  view source on GitHub ↗
(logger *zap.Logger)

Source from the content-addressed store, hash-verified

41}
42
43func NewPolicyManager(logger *zap.Logger) (*PolicyManager, error) {
44 home, err := utils.GetHomeDir()
45 if err != nil {
46 return nil, err
47 }
48
49 configPath := filepath.Join(home, ".chatcli", "coder_policy.json")
50
51 pm := &PolicyManager{
52 Rules: make([]Rule, 0),
53 configPath: configPath,
54 logger: logger,
55 }
56 pm.load()
57 return pm, nil
58}
59
60func (pm *PolicyManager) Check(toolName, args string) Action {
61 pm.mu.RLock()

Calls 2

loadMethod · 0.95
GetHomeDirFunction · 0.92