mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-04-29 04:00:36 +00:00
fix(cli): keep AGENTS.md in default context file set
This commit is contained in:
parent
9d8921db5f
commit
0c155768df
2 changed files with 44 additions and 3 deletions
|
|
@ -548,6 +548,43 @@ describe('loadCliConfig', () => {
|
|||
vi.restoreAllMocks();
|
||||
});
|
||||
|
||||
it('should reset context file names to QWEN.md and AGENTS.md by default', async () => {
|
||||
process.argv = ['node', 'script.js'];
|
||||
const argv = await parseArguments();
|
||||
const settings: Settings = {};
|
||||
const setGeminiMdFilenameSpy = vi.spyOn(
|
||||
ServerConfig,
|
||||
'setGeminiMdFilename',
|
||||
);
|
||||
|
||||
await loadCliConfig(settings, argv);
|
||||
|
||||
expect(setGeminiMdFilenameSpy).toHaveBeenCalledTimes(1);
|
||||
expect(setGeminiMdFilenameSpy).toHaveBeenCalledWith([
|
||||
ServerConfig.DEFAULT_CONTEXT_FILENAME,
|
||||
ServerConfig.AGENT_CONTEXT_FILENAME,
|
||||
]);
|
||||
});
|
||||
|
||||
it('should use configured context file name when settings.context.fileName is set', async () => {
|
||||
process.argv = ['node', 'script.js'];
|
||||
const argv = await parseArguments();
|
||||
const settings: Settings = {
|
||||
context: {
|
||||
fileName: 'CUSTOM_AGENTS.md',
|
||||
},
|
||||
};
|
||||
const setGeminiMdFilenameSpy = vi.spyOn(
|
||||
ServerConfig,
|
||||
'setGeminiMdFilename',
|
||||
);
|
||||
|
||||
await loadCliConfig(settings, argv);
|
||||
|
||||
expect(setGeminiMdFilenameSpy).toHaveBeenCalledTimes(1);
|
||||
expect(setGeminiMdFilenameSpy).toHaveBeenCalledWith('CUSTOM_AGENTS.md');
|
||||
});
|
||||
|
||||
it('should propagate stream-json formats to config', async () => {
|
||||
process.argv = [
|
||||
'node',
|
||||
|
|
|
|||
|
|
@ -6,12 +6,13 @@
|
|||
|
||||
import {
|
||||
ApprovalMode,
|
||||
AGENT_CONTEXT_FILENAME,
|
||||
AuthType,
|
||||
Config,
|
||||
DEFAULT_CONTEXT_FILENAME,
|
||||
DEFAULT_QWEN_EMBEDDING_MODEL,
|
||||
FileDiscoveryService,
|
||||
FileEncoding,
|
||||
getCurrentGeminiMdFilename,
|
||||
loadServerHierarchicalMemory,
|
||||
setGeminiMdFilename as setServerGeminiMdFilename,
|
||||
resolveTelemetrySettings,
|
||||
|
|
@ -688,8 +689,11 @@ export async function loadCliConfig(
|
|||
if (settings.context?.fileName) {
|
||||
setServerGeminiMdFilename(settings.context.fileName);
|
||||
} else {
|
||||
// Reset to default if not provided in settings.
|
||||
setServerGeminiMdFilename(getCurrentGeminiMdFilename());
|
||||
// Reset to default context filenames if not provided in settings.
|
||||
setServerGeminiMdFilename([
|
||||
DEFAULT_CONTEXT_FILENAME,
|
||||
AGENT_CONTEXT_FILENAME,
|
||||
]);
|
||||
}
|
||||
|
||||
// Automatically load output-language.md if it exists
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue