MCPcopy Index your code
hub / github.com/codeaashu/claude-code / filterAppsForDescription

Function filterAppsForDescription

src/utils/computerUse/appNames.ts:168–196  ·  view source on GitHub ↗
(
  installed: readonly InstalledAppLike[],
  homeDir: string | undefined,
)

Source from the content-addressed store, hash-verified

166 * attacker-installed); still length-capped, deduped, sorted.
167 */
168export function filterAppsForDescription(
169 installed: readonly InstalledAppLike[],
170 homeDir: string | undefined,
171): string[] {
172 const { alwaysKept, rest } = installed.reduce<{
173 alwaysKept: string[]
174 rest: string[]
175 }>(
176 (acc, app) => {
177 if (ALWAYS_KEEP_BUNDLE_IDS.has(app.bundleId)) {
178 acc.alwaysKept.push(app.displayName)
179 } else if (
180 isUserFacingPath(app.path, homeDir) &&
181 !isNoisyName(app.displayName)
182 ) {
183 acc.rest.push(app.displayName)
184 }
185 return acc
186 },
187 { alwaysKept: [], rest: [] },
188 )
189
190 const sanitizedAlways = sanitizeTrustedNames(alwaysKept)
191 const alwaysSet = new Set(sanitizedAlways)
192 return [
193 ...sanitizedAlways,
194 ...sanitizeAppNames(rest).filter(n => !alwaysSet.has(n)),
195 ]
196}
197

Callers 1

tryGetInstalledAppNamesFunction · 0.85

Calls 6

isUserFacingPathFunction · 0.85
isNoisyNameFunction · 0.85
sanitizeTrustedNamesFunction · 0.85
sanitizeAppNamesFunction · 0.85
hasMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected