MCPcopy Create free account
hub / github.com/GongShichen/LuminaCode / GetSimpleCommandPrefix

Function GetSimpleCommandPrefix

tools/bash/permissions.go:57–74  ·  view source on GitHub ↗
(command string)

Source from the content-addressed store, hash-verified

55}
56
57func GetSimpleCommandPrefix(command string) string {
58 cleaned := StripAllSafeEnvPrefixes(command)
59 tokens := Tokenize(cleaned, false)
60 if len(tokens) == 0 {
61 return ""
62 }
63 base := tokens[0]
64 if idx := strings.LastIndex(base, "/"); idx >= 0 {
65 base = base[idx+1:]
66 }
67 if blockedRulePrefixes[base] || len(tokens) < 2 || strings.HasPrefix(tokens[1], "-") {
68 if base == "git" && len(tokens) >= 4 && tokens[1] == "-c" {
69 return "git " + tokens[3]
70 }
71 return ""
72 }
73 return base + " " + tokens[1]
74}
75
76func AggregateCompoundPermissions(subResults []PermissionResult) PermissionResult {
77 if len(subResults) == 0 {

Calls 2

StripAllSafeEnvPrefixesFunction · 0.85
TokenizeFunction · 0.85