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

Function ClassifyBashCommand

tools/bash/semantics.go:164–196  ·  view source on GitHub ↗
(commandLine string)

Source from the content-addressed store, hash-verified

162}
163
164func ClassifyBashCommand(commandLine string) string {
165 segments := SplitPipeline(commandLine)
166 categories := mapset.NewSet[string]()
167 for _, seg := range segments {
168 base, _ := ParseBase(seg)
169 if semanticNeutralCommands.Contains(base) {
170 continue
171 }
172 if searchCommands.Contains(base) {
173 categories.Add("search")
174 } else if readCommands.Contains(base) {
175 categories.Add("read")
176 } else if listCommands.Contains(base) {
177 categories.Add("list")
178 } else {
179 categories.Add("write")
180 }
181 }
182
183 if categories.Contains("write") {
184 return "write"
185 }
186 if categories.Contains("search") && categories.Difference(mapset.NewSet[string]("search", "read")).Cardinality() == 0 {
187 return "search"
188 }
189 if categories.Contains("read") {
190 return "read"
191 }
192 if categories.Contains("list") {
193 return "list"
194 }
195 return "unknown"
196}

Callers

nothing calls this directly

Calls 3

SplitPipelineFunction · 0.85
ParseBaseFunction · 0.85
AddMethod · 0.80

Tested by

no test coverage detected