MCPcopy Create free account
hub / github.com/MemTensor/MemOS / writeCompanionFiles

Function writeCompanionFiles

packages/memos-core/src/client/skill-sync.ts:198–207  ·  view source on GitHub ↗
(dirPath: string, root: "scripts" | "references", files: Array<{ filename: string; content: string }>)

Source from the content-addressed store, hash-verified

196}
197
198function writeCompanionFiles(dirPath: string, root: "scripts" | "references", files: Array<{ filename: string; content: string }>): void {
199 if (files.length === 0) return;
200 const rootDir = path.join(dirPath, root);
201 fs.mkdirSync(rootDir, { recursive: true });
202 for (const file of files) {
203 const target = path.join(rootDir, file.filename);
204 fs.mkdirSync(path.dirname(target), { recursive: true });
205 fs.writeFileSync(target, file.content, "utf8");
206 }
207}
208
209function sanitizeName(input: string): string {
210 return input.trim().replace(/[^A-Za-z0-9._-]+/g, "-").replace(/^-+|-+$/g, "");

Callers 1

Calls 1

joinMethod · 0.45

Tested by

no test coverage detected