fix(vscode): avoid writing null agent config fields

Omit unset agent fields on create
Delete cleared agent fields in VS Code config updates
Cover null field removal with a regression test
This commit is contained in:
Bohdan Triapitsyn
2026-06-29 11:56:40 +03:00
parent c48d57bfaf
commit 00fd15c356
4 changed files with 73 additions and 4 deletions
+4 -1
View File
@@ -409,7 +409,10 @@ function createAgent(agentName, config, workingDirectory, scope) {
targetScope = AGENT_SCOPE.USER;
}
const { prompt, scope: _scopeFromConfig, ...frontmatter } = config;
const { prompt, scope: _scopeFromConfig, ...rawFrontmatter } = config;
const frontmatter = Object.fromEntries(
Object.entries(rawFrontmatter).filter(([, value]) => value !== null && value !== undefined)
);
writeMdFile(targetPath, frontmatter, prompt || '');
console.log(`Created new agent: ${agentName} (scope: ${targetScope}, path: ${targetPath})`);