MCPcopy Index your code
hub / github.com/larksuite/cli / LoadAutoApproveSet

Function LoadAutoApproveSet

internal/registry/loader.go:223–262  ·  view source on GitHub ↗

LoadAutoApproveSet returns the set of auto-approve scope names. Sources (merged): recommend=="true" in scope_priorities.json + explicit allow/deny in scope_overrides.json.

()

Source from the content-addressed store, hash-verified

221// Sources (merged): recommend=="true" in scope_priorities.json
222// + explicit allow/deny in scope_overrides.json.
223func LoadAutoApproveSet() map[string]bool {
224 if cachedAutoApproveSet != nil {
225 return cachedAutoApproveSet
226 }
227
228 m := make(map[string]bool)
229
230 // 1. From scope_priorities.json (Recommend == "true")
231 if data, err := registryFS.ReadFile("scope_priorities.json"); err == nil {
232 var entries []scopePriorityEntry
233 if json.Unmarshal(data, &entries) == nil {
234 for _, entry := range entries {
235 if entry.Recommend == "true" {
236 m[entry.ScopeName] = true
237 }
238 }
239 }
240 }
241
242 // 2. From scope_overrides.json (recommend.allow/deny lists)
243 if data, err := registryFS.ReadFile("scope_overrides.json"); err == nil {
244 var wrapper struct {
245 AutoApprove struct {
246 Allow []string `json:"allow"`
247 Deny []string `json:"deny"`
248 } `json:"recommend"`
249 }
250 if json.Unmarshal(data, &wrapper) == nil {
251 for _, s := range wrapper.AutoApprove.Allow {
252 m[s] = true
253 }
254 for _, s := range wrapper.AutoApprove.Deny {
255 delete(m, s)
256 }
257 }
258 }
259
260 cachedAutoApproveSet = m
261 return cachedAutoApproveSet
262}
263
264// LoadPlatformAutoApproveSet returns scopes with AutoApprove rule on the platform
265// (from scope_priorities.json only, before overrides).

Callers 4

diagBuildFunction · 0.92
IsAutoApproveScopeFunction · 0.85
FilterAutoApproveScopesFunction · 0.85
TestLoadAutoApproveSetFunction · 0.85

Calls 1

ReadFileMethod · 0.65

Tested by 2

diagBuildFunction · 0.74
TestLoadAutoApproveSetFunction · 0.68