feat(mosaic): add constrained context recovery command

This commit is contained in:
wjarvis mos-comms
2026-07-19 19:04:25 -05:00
parent 3b5513bd6e
commit 7729e6f2f7
10 changed files with 518 additions and 5 deletions

View File

@@ -8,6 +8,7 @@ import {
mkdirSync,
mkdtempSync,
readlinkSync,
readFileSync,
rmSync,
symlinkSync,
writeFileSync,
@@ -26,6 +27,9 @@ import {
const LEGACY_SYNC_SCRIPT = fileURLToPath(
new URL('../../framework/tools/_scripts/mosaic-sync-skills', import.meta.url),
);
const CONTEXT_REFRESH_SOURCE_SKILL = fileURLToPath(
new URL('../../framework/skills/mosaic-context-refresh/SKILL.md', import.meta.url),
);
describe('Claude skill bridge', () => {
let root: string;
@@ -360,6 +364,25 @@ describe('Claude skill bridge', () => {
});
describe('syncClaudeSkills', () => {
it('projects the durable context-refresh skill through the #824 bridge in a tmp root', () => {
expect(existsSync(CONTEXT_REFRESH_SOURCE_SKILL)).toBe(true);
const source = readFileSync(CONTEXT_REFRESH_SOURCE_SKILL, 'utf8');
expect(source).toContain('recover-context.py');
expect(source).toContain('middle drop is not represented as receipt-detectable');
const skillDir = createSkill('mosaic-context-refresh');
writeFileSync(join(skillDir, 'SKILL.md'), source);
const result = syncClaudeSkills(paths);
expect(result).toEqual({
registered: ['mosaic-context-refresh'],
repaired: [],
unchanged: [],
conflicts: [],
});
expectCorrectLink('mosaic-context-refresh');
});
it('generically creates every missing canonical link and repairs managed broken links', () => {
createSkill('added-after-setup');
createSkill('another-new-skill');