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

Function writeToDisk

source code/utils/plugins/pluginFlagging.ts:88–112  ·  view source on GitHub ↗
(
  plugins: Record<string, FlaggedPlugin>,
)

Source from the content-addressed store, hash-verified

86}
87
88async function writeToDisk(
89 plugins: Record<string, FlaggedPlugin>,
90): Promise<void> {
91 const filePath = getFlaggedPluginsPath()
92 const tempPath = `${filePath}.${randomBytes(8).toString('hex')}.tmp`
93
94 try {
95 await getFsImplementation().mkdir(getPluginsDirectory())
96
97 const content = jsonStringify({ plugins }, null, 2)
98 await writeFile(tempPath, content, {
99 encoding: 'utf-8',
100 mode: 0o600,
101 })
102 await rename(tempPath, filePath)
103 cache = plugins
104 } catch (error) {
105 logError(error)
106 try {
107 await unlink(tempPath)
108 } catch {
109 // Ignore cleanup errors
110 }
111 }
112}
113
114/**
115 * Load flagged plugins from disk into the module cache.

Callers 4

loadFlaggedPluginsFunction · 0.85
addFlaggedPluginFunction · 0.85
markFlaggedPluginsSeenFunction · 0.85
removeFlaggedPluginFunction · 0.85

Calls 8

getFlaggedPluginsPathFunction · 0.85
getFsImplementationFunction · 0.85
getPluginsDirectoryFunction · 0.85
jsonStringifyFunction · 0.85
renameFunction · 0.85
unlinkFunction · 0.85
toStringMethod · 0.65
logErrorFunction · 0.50

Tested by

no test coverage detected