chore: bump version to 10.0.2

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Alex Newman
2026-02-11 15:25:50 -05:00
parent 77579669f2
commit 0b214a59a1
15 changed files with 1235 additions and 50 deletions
+33
View File
@@ -0,0 +1,33 @@
import { existsSync, readFileSync, writeFileSync, renameSync, mkdirSync } from 'fs';
import { dirname } from 'path';
import { replaceTaggedContent } from './claude-md-utils.js';
import { logger } from './logger.js';
/**
* Write AGENTS.md with claude-mem context, preserving user content outside tags.
* Uses atomic write to prevent partial writes.
*/
export function writeAgentsMd(agentsPath: string, context: string): void {
if (!agentsPath) return;
const dir = dirname(agentsPath);
if (!existsSync(dir)) {
mkdirSync(dir, { recursive: true });
}
let existingContent = '';
if (existsSync(agentsPath)) {
existingContent = readFileSync(agentsPath, 'utf-8');
}
const contentBlock = `# Memory Context\n\n${context}`;
const finalContent = replaceTaggedContent(existingContent, contentBlock);
const tempFile = `${agentsPath}.tmp`;
try {
writeFileSync(tempFile, finalContent);
renameSync(tempFile, agentsPath);
} catch (error) {
logger.error('AGENTS_MD', 'Failed to write AGENTS.md', { agentsPath }, error as Error);
}
}