MCPcopy Create free account
hub / github.com/Noumena-Network/code / removePathFromRepo

Function removePathFromRepo

src/utils/githubRepoPathMapping.ts:133–162  ·  view source on GitHub ↗
(repo: string, pathToRemove: string)

Source from the content-addressed store, hash-verified

131 * @param pathToRemove The path to remove from tracking
132 */
133export function removePathFromRepo(repo: string, pathToRemove: string): void {
134 const config = getGlobalConfig()
135 const repoKey = repo.toLowerCase()
136 const existingPaths = config.githubRepoPaths?.[repoKey] ?? []
137
138 const updatedPaths = existingPaths.filter(path => path !== pathToRemove)
139
140 if (updatedPaths.length === existingPaths.length) {
141 // Path wasn't in the list, nothing to do
142 return
143 }
144
145 const updatedMapping = { ...config.githubRepoPaths }
146
147 if (updatedPaths.length === 0) {
148 // Remove the repo key entirely if no paths remain
149 delete updatedMapping[repoKey]
150 } else {
151 updatedMapping[repoKey] = updatedPaths
152 }
153
154 saveGlobalConfig(current => ({
155 ...current,
156 githubRepoPaths: updatedMapping,
157 }))
158
159 logForDebugging(
160 `Removed ${pathToRemove} from tracked paths for repo ${repoKey}`,
161 )
162}

Callers 1

Calls 3

getGlobalConfigFunction · 0.70
saveGlobalConfigFunction · 0.70
logForDebuggingFunction · 0.70

Tested by

no test coverage detected