cloving 0.3.1 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -313,6 +313,11 @@ class ChatManager {
313
313
  try {
314
314
  this.contextFiles = await (0, command_utils_1.addFileOrDirectoryToContext)(filePath, this.contextFiles, this.options);
315
315
  console.log(`\nAdded ${colors_1.default.bold(colors_1.default.green(filePath))} to this chat session's context`);
316
+ // Update the chat history with the new context
317
+ const updatedSystemPrompt = (0, command_utils_1.generateCodegenPrompt)(this.contextFiles);
318
+ this.chatHistory[0] = { role: 'user', content: updatedSystemPrompt };
319
+ // Log the update
320
+ console.log(colors_1.default.yellow(`Updated chat context with new file(s)`));
316
321
  }
317
322
  catch (error) {
318
323
  console.error(`Failed to add ${colors_1.default.bold(colors_1.default.red(filePath))} to this chat session's context:`, error);
@@ -323,6 +328,10 @@ class ChatManager {
323
328
  }
324
329
  this.rl.prompt();
325
330
  }
331
+ refreshContext() {
332
+ const updatedSystemPrompt = (0, command_utils_1.generateCodegenPrompt)(this.contextFiles);
333
+ this.chatHistory[0] = { role: 'user', content: updatedSystemPrompt };
334
+ }
326
335
  isRemoveCommand(command) {
327
336
  return command.startsWith('rm ');
328
337
  }
@@ -461,6 +470,7 @@ class ChatManager {
461
470
  this.isProcessing = true;
462
471
  this.chunkManager = new ChunkManager_1.default();
463
472
  try {
473
+ this.refreshContext(); // make sure the context is up-to-date
464
474
  this.initializeChatHistory(input);
465
475
  this.prompt = this.generatePrompt(input);
466
476
  const responseStream = await this.gpt.streamText({ prompt: this.prompt, messages: this.chatHistory });
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cloving",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "packageManager": "yarn@1.22.22",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cloving",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "packageManager": "yarn@1.22.22",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",