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:
@@ -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})`);
|
||||
|
||||
Reference in New Issue
Block a user