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

Function parseCommandOutputAsSettings

src/utils/settings/mdm/settings.ts:183–199  ·  view source on GitHub ↗
(
  stdout: string,
  sourcePath: string,
)

Source from the content-addressed store, hash-verified

181 * doesn't cause the entire MDM settings to be rejected.
182 */
183export function parseCommandOutputAsSettings(
184 stdout: string,
185 sourcePath: string,
186): { settings: SettingsJson; errors: ValidationError[] } {
187 const data = safeParseJSON(stdout, false)
188 if (!data || typeof data !== 'object') {
189 return { settings: {}, errors: [] }
190 }
191
192 const ruleWarnings = filterInvalidPermissionRules(data, sourcePath)
193 const parseResult = SettingsSchema().safeParse(data)
194 if (!parseResult.success) {
195 const errors = formatZodError(parseResult.error, sourcePath)
196 return { settings: {}, errors: [...ruleWarnings, ...errors] }
197 }
198 return { settings: parseResult.data, errors: ruleWarnings }
199}
200
201/**
202 * Parse reg query stdout to extract a registry string value.

Callers 1

consumeRawReadResultFunction · 0.85

Calls 2

formatZodErrorFunction · 0.85

Tested by

no test coverage detected