feat: integrate learning module
This commit is contained in:
@@ -94,6 +94,17 @@ describe('project-owned contact configuration', () => {
|
||||
expect('templateId' in normalized).toBe(false);
|
||||
});
|
||||
|
||||
it('strips the retired game-engine Skill from project-owned Agent configuration', () => {
|
||||
const config = createProjectConfig();
|
||||
const normalized = normalizeProjectConfig({
|
||||
...config,
|
||||
initialized: true,
|
||||
agents: [createContact({ skillIds: ['game-engine', 'grilling', 'game-engine'] })],
|
||||
});
|
||||
|
||||
expect(normalized.agents[0]?.skillIds).toEqual(['grilling']);
|
||||
});
|
||||
|
||||
it('preserves a valid compressed custom avatar and drops unsafe avatar data', () => {
|
||||
const customAvatar = 'data:image/webp;base64,YXZhdGFy';
|
||||
const config = createProjectConfig();
|
||||
@@ -197,6 +208,33 @@ describe('project-owned contact configuration', () => {
|
||||
expect(markdown).toContain('主动调用 `frontend-slides`');
|
||||
expect(markdown).toContain('主动调用 `grilling`');
|
||||
expect(markdown).toContain('主动调用 `planning-with-files`');
|
||||
expect(markdown).toContain('当前项目根目录直接维护');
|
||||
expect(markdown).not.toContain('在 `.niancode/agent-planning/` 中维护');
|
||||
});
|
||||
|
||||
it('migrates retired game-engine permissions out of existing project files', async () => {
|
||||
const projectPath = await mkdtemp(path.join(tmpdir(), 'makelore-project-config-retired-skill-'));
|
||||
const initial = await createInitialProjectConfig(projectPath);
|
||||
await writeFile(
|
||||
path.join(projectPath, '.niancode', 'project.json'),
|
||||
`${JSON.stringify({
|
||||
...initial,
|
||||
initialized: true,
|
||||
agents: [createContact({ skillIds: ['game-engine', 'planning-with-files'] })],
|
||||
}, null, 2)}\n`,
|
||||
'utf8',
|
||||
);
|
||||
|
||||
const loaded = await readProjectConfig(projectPath);
|
||||
expect(loaded).toMatchObject({
|
||||
status: 'valid',
|
||||
config: { agents: [{ skillIds: ['planning-with-files'] }] },
|
||||
});
|
||||
const persisted = JSON.parse(await readFile(path.join(projectPath, '.niancode', 'project.json'), 'utf8')) as { agents: ProjectAgentConfig[] };
|
||||
expect(persisted.agents[0]?.skillIds).toEqual(['planning-with-files']);
|
||||
const markdown = await readFile(path.join(projectPath, '.opencode', 'agent', 'agent-test.md'), 'utf8');
|
||||
expect(markdown).not.toContain('game-engine');
|
||||
expect(markdown).toContain('planning-with-files: allow');
|
||||
});
|
||||
|
||||
it('denies unselected skills when a contact has selected skills', async () => {
|
||||
|
||||
Reference in New Issue
Block a user