coder-agent 2.7.3 → 2.8.1

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.
package/dist/agent.js CHANGED
@@ -831,9 +831,10 @@ ${JSON.stringify(allMessages.slice(1).map(m => ({ role: m.role, content: m.conte
831
831
 
832
832
  Instructions:
833
833
  1. Review the conversation history and extract any important new project setup details, style preferences, build/test commands, package quirks, or persistent instructions that should be remembered for future sessions.
834
- 2. Integrate these new learnings into the existing memory structure. Keep existing useful learnings/preferences, but clean up duplicates or obsolete info.
835
- 3. Keep the content concise, clean, and formatted in Markdown.
836
- 4. If there are no new learnings, setup details, or instructions in the conversation, output EXACTLY the existing memory content. Do not add conversational text, just output the updated/existing markdown content.`;
834
+ 2. Maintain and update the "## File-to-Data Map" section. If any files were read, modified, created, or discussed, verify if they are listed in the map. If not, add them with their relative path and a brief 1-sentence description of the data, logic, or functions they contain. If they are already listed but their content/purpose changed, update their description.
835
+ 3. Integrate these new learnings and file catalog updates into the existing memory structure. Keep existing useful learnings/preferences, but clean up duplicates or obsolete info.
836
+ 4. Keep the content concise, clean, and formatted in Markdown.
837
+ 5. If there are no new learnings, setup details, file updates, or instructions in the conversation, output EXACTLY the existing memory content. Do not add conversational text, just output the updated/existing markdown content.`;
837
838
  const responseObj = await callGeminiAPIWithRotation(this.apiKey, {
838
839
  model: this.model,
839
840
  messages: [{ role: "user", content: prompt }],
package/dist/config.js CHANGED
@@ -80,3 +80,16 @@ export async function saveGeminiApiKey(geminiApiKey) {
80
80
  config.geminiApiKey = geminiApiKey;
81
81
  await writeConfig(config);
82
82
  }
83
+ export async function getLastUsedInfo() {
84
+ const config = await readConfig();
85
+ return {
86
+ lastUsedVersion: config.lastUsedVersion,
87
+ lastUsedTime: config.lastUsedTime,
88
+ };
89
+ }
90
+ export async function saveLastUsedInfo(version, time) {
91
+ const config = await readConfig();
92
+ config.lastUsedVersion = version;
93
+ config.lastUsedTime = time;
94
+ await writeConfig(config);
95
+ }
package/dist/index.js CHANGED
@@ -3,7 +3,8 @@ import * as readline from "readline";
3
3
  import chalk from "chalk";
4
4
  import figlet from "figlet";
5
5
  import { Agent } from "./agent.js";
6
- import { getStoredApiKey, saveApiKey, getStoredModel, saveModel } from "./config.js";
6
+ import { getStoredApiKey, saveApiKey, getStoredModel, saveModel, getLastUsedInfo, saveLastUsedInfo } from "./config.js";
7
+ const CURRENT_VERSION = "2.7.3";
7
8
  const VALID_MODELS = [
8
9
  "gemini-2.5-flash",
9
10
  "gemini-2.5-pro",
@@ -37,7 +38,7 @@ function printBanner(modelName) {
37
38
  });
38
39
  console.log('');
39
40
  console.log(' ' + chalk.white.bold('coder-agent') +
40
- chalk.dim(' v1.1.0'));
41
+ chalk.dim(' v' + CURRENT_VERSION));
41
42
  console.log('');
42
43
  console.log(chalk.dim(' ─────────────────────────────────────'));
43
44
  console.log('');
@@ -55,7 +56,7 @@ function printBanner(modelName) {
55
56
  console.log('');
56
57
  }
57
58
  function printHelp() {
58
- console.log(chalk.white.bold("\n Coder CLI v1.1\n"));
59
+ console.log(chalk.white.bold(`\n Coder CLI v${CURRENT_VERSION}\n`));
59
60
  console.log(chalk.gray(" Usage:"));
60
61
  console.log(chalk.white(" coder-agent — Start the interactive REPL"));
61
62
  console.log(chalk.white(" coder-agent [options] — Run with config options"));
@@ -151,7 +152,7 @@ async function main() {
151
152
  process.exit(0);
152
153
  }
153
154
  else if (args[i] === "-v" || args[i] === "--version") {
154
- console.log("coder-agent v1.1.0");
155
+ console.log(`coder-agent v${CURRENT_VERSION}`);
155
156
  process.exit(0);
156
157
  }
157
158
  else {
@@ -269,12 +270,46 @@ async function main() {
269
270
  process.exit(0);
270
271
  }
271
272
  // Interactive REPL Mode
273
+ const lastUsedInfo = await getLastUsedInfo();
274
+ const INACTIVE_THRESHOLD_MS = 7 * 24 * 60 * 60 * 1000; // 7 days
275
+ const isNewUser = !lastUsedInfo.lastUsedTime;
276
+ const isInactive = lastUsedInfo.lastUsedTime ? (Date.now() - lastUsedInfo.lastUsedTime > INACTIVE_THRESHOLD_MS) : false;
277
+ const isNewVersion = lastUsedInfo.lastUsedVersion !== CURRENT_VERSION;
278
+ const showWelcomeCommands = isNewUser || isInactive || isNewVersion;
279
+ // Save/update last used info immediately
280
+ await saveLastUsedInfo(CURRENT_VERSION, Date.now());
272
281
  printBanner(modelToUse);
282
+ if (showWelcomeCommands) {
283
+ console.log(chalk.white.bold(" 💡 Get started with interactive slash commands:"));
284
+ console.log(` ${chalk.hex('#0a84ff')('/model')} ${chalk.gray('[name]')} — View active model or switch to [name]`);
285
+ console.log(` ${chalk.hex('#0a84ff')('/clear')} — Wipe conversation memory`);
286
+ console.log(` ${chalk.hex('#0a84ff')('/status')} — Show active model and memory usage`);
287
+ console.log(` ${chalk.hex('#0a84ff')('/help')} — Show help screen with configuration details`);
288
+ console.log(` ${chalk.hex('#0a84ff')('/exit')} — Exit Coder`);
289
+ console.log();
290
+ }
273
291
  rl = readline.createInterface({
274
292
  input: process.stdin,
275
293
  output: process.stdout,
276
294
  terminal: true,
277
295
  });
296
+ process.stdin.on("keypress", (char, key) => {
297
+ if (isHijacked || !rl)
298
+ return;
299
+ setImmediate(() => {
300
+ if (rl && rl.line === "/") {
301
+ console.log();
302
+ console.log(chalk.dim(" Available Commands:"));
303
+ console.log(` ${chalk.hex('#0a84ff')('/model')} ${chalk.gray('[name]')} ${chalk.dim('— View active model or switch to [name]')}`);
304
+ console.log(` ${chalk.hex('#0a84ff')('/clear')} ${chalk.dim('— Wipe conversation memory')}`);
305
+ console.log(` ${chalk.hex('#0a84ff')('/status')} ${chalk.dim('— Show active model and memory usage')}`);
306
+ console.log(` ${chalk.hex('#0a84ff')('/help')} ${chalk.dim('— Show help screen')}`);
307
+ console.log(` ${chalk.hex('#0a84ff')('/exit')} ${chalk.dim('— Exit Coder')}`);
308
+ console.log();
309
+ rl._refreshLine();
310
+ }
311
+ });
312
+ });
278
313
  let inputBuffer = "";
279
314
  let pasteTimeout = null;
280
315
  let lineCountInBurst = 0;
package/dist/memory.js CHANGED
@@ -315,7 +315,7 @@ export async function loadAgentMemoryPrompt(agentType, scope) {
315
315
  }
316
316
  catch {
317
317
  // Create default template
318
- const defaultTemplate = `# Persistent Agent Memory\n\nUse this section to write general rules, project setup details, style preferences, or learnings. Update this file using your write_file/patch_file tools to persist memories.\n\n## Learnings & Guidelines\n- (No memories stored yet. Add your learnings here.)\n`;
318
+ const defaultTemplate = `# Persistent Agent Memory\n\nUse this section to write general rules, project setup details, style preferences, or learnings. Update this file using your write_file/patch_file tools to persist memories.\n\n## Learnings & Guidelines\n- (No memories stored yet. Add your learnings here.)\n\n## File-to-Data Map\n- (List of files and what data/logic they contain. This helps the agent know what file has what data.)\n`;
319
319
  try {
320
320
  await fs.writeFile(memoryFile, defaultTemplate, "utf-8");
321
321
  memoryContent = defaultTemplate;
@@ -333,13 +333,13 @@ export async function loadAgentMemoryPrompt(agentType, scope) {
333
333
  let scopeNote = "";
334
334
  switch (scope) {
335
335
  case "user":
336
- scopeNote = "- Since this memory has 'user' scope, keep learnings general since they apply across all of the user's projects.";
336
+ scopeNote = "- Since this memory has 'user' scope, keep learnings and cataloging general since they apply across all of the user's projects.";
337
337
  break;
338
338
  case "project":
339
- scopeNote = "- Since this memory has 'project' scope and is shared with the team via version control, tailor memories specifically to this project.";
339
+ scopeNote = "- Since this memory has 'project' scope and is shared with the team via version control, tailor memories and file cataloging specifically to this project.";
340
340
  break;
341
341
  case "local":
342
- scopeNote = "- Since this memory has 'local' scope (not checked into version control), tailor memories specifically to this machine and project.";
342
+ scopeNote = "- Since this memory has 'local' scope (not checked into version control), tailor memories and file cataloging specifically to this machine and project.";
343
343
  break;
344
344
  }
345
345
  return `
@@ -349,8 +349,9 @@ This memory is loaded at the start of every session and injected into your syste
349
349
 
350
350
  ### Guidelines for Memory Usage:
351
351
  1. Read the memory contents below to see existing learnings, project instructions, or user preferences.
352
- 2. If you learn something new that would be useful for future sessions (e.g., build commands, package quirks, style guidelines, API details, tool workarounds), update this file directly using your \`write_file\` or \`patch_file\` tools targeting the file path: \`${memoryFile}\`.
353
- 3. Keep the content concise, clean, and organized.
352
+ 2. Refer to the '## File-to-Data Map' section to quickly find which files contain what data, features, logic, or configurations.
353
+ 3. If you learn something new that would be useful for future sessions (e.g., build commands, package quirks, style guidelines, API details, tool workarounds), or if you create/modify files, update this file directly using your \`write_file\` or \`patch_file\` tools targeting the file path: \`${memoryFile}\`.
354
+ 4. Keep the content concise, clean, and organized.
354
355
  ${scopeNote}
355
356
 
356
357
  ### Current Memory Contents:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "coder-agent",
3
- "version": "2.7.3",
3
+ "version": "2.8.1",
4
4
  "description": "CLI coding agent powered by Google Gemini",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",