mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-19 09:33:53 +00:00
Plumb extension context filenames through for /memory refresh (#1312)
This commit is contained in:
@@ -210,4 +210,34 @@ describe('Configuration Integration Tests', () => {
|
|||||||
expect(config.getCheckpointingEnabled()).toBe(true);
|
expect(config.getCheckpointingEnabled()).toBe(true);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('Extension Context Files', () => {
|
||||||
|
it('should have an empty array for extension context files by default', () => {
|
||||||
|
const configParams: ConfigParameters = {
|
||||||
|
cwd: '/tmp',
|
||||||
|
contentGeneratorConfig: TEST_CONTENT_GENERATOR_CONFIG,
|
||||||
|
embeddingModel: 'test-embedding-model',
|
||||||
|
sandbox: false,
|
||||||
|
targetDir: tempDir,
|
||||||
|
debugMode: false,
|
||||||
|
};
|
||||||
|
const config = new Config(configParams);
|
||||||
|
expect(config.getExtensionContextFilePaths()).toEqual([]);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should correctly store and return extension context file paths', () => {
|
||||||
|
const contextFiles = ['/path/to/file1.txt', '/path/to/file2.js'];
|
||||||
|
const configParams: ConfigParameters = {
|
||||||
|
cwd: '/tmp',
|
||||||
|
contentGeneratorConfig: TEST_CONTENT_GENERATOR_CONFIG,
|
||||||
|
embeddingModel: 'test-embedding-model',
|
||||||
|
sandbox: false,
|
||||||
|
targetDir: tempDir,
|
||||||
|
debugMode: false,
|
||||||
|
extensionContextFilePaths: contextFiles,
|
||||||
|
};
|
||||||
|
const config = new Config(configParams);
|
||||||
|
expect(config.getExtensionContextFilePaths()).toEqual(contextFiles);
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -244,6 +244,7 @@ export async function loadCliConfig(
|
|||||||
fileDiscoveryService: fileService,
|
fileDiscoveryService: fileService,
|
||||||
bugCommand: settings.bugCommand,
|
bugCommand: settings.bugCommand,
|
||||||
model: argv.model!,
|
model: argv.model!,
|
||||||
|
extensionContextFilePaths,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -183,6 +183,7 @@ const App = ({ config, settings, startupWarnings = [] }: AppProps) => {
|
|||||||
process.cwd(),
|
process.cwd(),
|
||||||
config.getDebugMode(),
|
config.getDebugMode(),
|
||||||
config.getFileService(),
|
config.getFileService(),
|
||||||
|
config.getExtensionContextFilePaths(),
|
||||||
);
|
);
|
||||||
config.setUserMemory(memoryContent);
|
config.setUserMemory(memoryContent);
|
||||||
config.setGeminiMdFileCount(fileCount);
|
config.setGeminiMdFileCount(fileCount);
|
||||||
|
|||||||
@@ -118,6 +118,7 @@ export interface ConfigParameters {
|
|||||||
bugCommand?: BugCommandSettings;
|
bugCommand?: BugCommandSettings;
|
||||||
model: string;
|
model: string;
|
||||||
disableDataCollection?: boolean;
|
disableDataCollection?: boolean;
|
||||||
|
extensionContextFilePaths?: string[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export class Config {
|
export class Config {
|
||||||
@@ -155,6 +156,7 @@ export class Config {
|
|||||||
private readonly bugCommand: BugCommandSettings | undefined;
|
private readonly bugCommand: BugCommandSettings | undefined;
|
||||||
private readonly model: string;
|
private readonly model: string;
|
||||||
private readonly disableDataCollection: boolean;
|
private readonly disableDataCollection: boolean;
|
||||||
|
private readonly extensionContextFilePaths: string[];
|
||||||
|
|
||||||
constructor(params: ConfigParameters) {
|
constructor(params: ConfigParameters) {
|
||||||
this.sessionId = params.sessionId;
|
this.sessionId = params.sessionId;
|
||||||
@@ -196,6 +198,7 @@ export class Config {
|
|||||||
this.model = params.model;
|
this.model = params.model;
|
||||||
this.disableDataCollection =
|
this.disableDataCollection =
|
||||||
params.telemetry?.disableDataCollection ?? true;
|
params.telemetry?.disableDataCollection ?? true;
|
||||||
|
this.extensionContextFilePaths = params.extensionContextFilePaths ?? [];
|
||||||
|
|
||||||
if (params.contextFileName) {
|
if (params.contextFileName) {
|
||||||
setGeminiMdFilename(params.contextFileName);
|
setGeminiMdFilename(params.contextFileName);
|
||||||
@@ -387,6 +390,10 @@ export class Config {
|
|||||||
return this.disableDataCollection;
|
return this.disableDataCollection;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getExtensionContextFilePaths(): string[] {
|
||||||
|
return this.extensionContextFilePaths;
|
||||||
|
}
|
||||||
|
|
||||||
async getGitService(): Promise<GitService> {
|
async getGitService(): Promise<GitService> {
|
||||||
if (!this.gitService) {
|
if (!this.gitService) {
|
||||||
this.gitService = new GitService(this.targetDir);
|
this.gitService = new GitService(this.targetDir);
|
||||||
|
|||||||
Reference in New Issue
Block a user