MCPcopy Create free account
hub / github.com/AnukarOP/claude-code-leaked / parsePluginsData

Function parsePluginsData

source code/utils/plugins/pluginFlagging.ts:42–75  ·  view source on GitHub ↗
(content: string)

Source from the content-addressed store, hash-verified

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

Callers 1

readFromDiskFunction · 0.85

Calls 2

jsonParseFunction · 0.85
entriesMethod · 0.80

Tested by

no test coverage detected