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

Function parsePluginsData

src/utils/plugins/pluginFlagging.ts:40–73  ·  view source on GitHub ↗
(content: string)

Source from the content-addressed store, hash-verified

38}
39
40function parsePluginsData(content: string): Record<string, FlaggedPlugin> {
41 const parsed = jsonParse(content) as unknown
42 if (
43 typeof parsed !== 'object' ||
44 parsed === null ||
45 !('plugins' in parsed) ||
46 typeof (parsed as { plugins: unknown }).plugins !== 'object' ||
47 (parsed as { plugins: unknown }).plugins === null
48 ) {
49 return {}
50 }
51 const plugins = (parsed as { plugins: Record<string, unknown> }).plugins
52 const result: Record<string, FlaggedPlugin> = {}
53 for (const [id, entry] of Object.entries(plugins)) {
54 if (
55 entry &&
56 typeof entry === 'object' &&
57 'flaggedAt' in entry &&
58 typeof (entry as { flaggedAt: unknown }).flaggedAt === 'string'
59 ) {
60 const parsed: FlaggedPlugin = {
61 flaggedAt: (entry as { flaggedAt: string }).flaggedAt,
62 }
63 if (
64 'seenAt' in entry &&
65 typeof (entry as { seenAt: unknown }).seenAt === 'string'
66 ) {
67 parsed.seenAt = (entry as { seenAt: string }).seenAt
68 }
69 result[id] = parsed
70 }
71 }
72 return result
73}
74
75async function readFromDisk(): Promise<Record<string, FlaggedPlugin>> {
76 try {

Callers 1

readFromDiskFunction · 0.85

Calls 2

jsonParseFunction · 0.85
entriesMethod · 0.80

Tested by

no test coverage detected