From d11917385708d4478ca52911e21df34177c55fca Mon Sep 17 00:00:00 2001 From: Sakib Raza Date: Sun, 18 Oct 2026 18:23:12 +0530 Subject: [PATCH] Add Rename Pet command --- CHANGELOG.md | 7 +++++++ extension.js | 21 +++++++++++++++++++++ package.json | 5 +++++ 3 files changed, 33 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d1d149d..e5288c0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,13 @@ Format based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). --- +## [Unreleased] + +### ✨ Added +- New command: **CodeCritter: Rename Pet ✏️** to rename your pet. + +--- + ## [2.0.0] - 2026-09-25 *The massive Companion Update! Bringing new pet species, a persistent sidebar view, wearables, and interactivity to CodeCritter.* diff --git a/extension.js b/extension.js index e270404..d83a295 100644 --- a/extension.js +++ b/extension.js @@ -269,6 +269,26 @@ function activate(context) { } }); + /** Rename the pet using an input box */ + const cmdRenamePet = vscode.commands.registerCommand('codecritter.petName', async () => { + const current = petName(); + const val = await vscode.window.showInputBox({ + title: 'CodeCritter — Rename Pet Name', + prompt: 'What would you like to name your pet?', + value: current, + validateInput: v => { + if (v.trim() === '') return 'Pet name cannot be empty.'; + if (v.trim().length > 20) return 'Pet name must be 20 characters max.'; + return null; + } + }); + if (val !== undefined) { + const newName = val.trim(); + await cfg().update('petName', newName, vscode.ConfigurationTarget.Global); + vscode.window.showInformationMessage(`✏️ Your pet has been renamed to ${newName}!`); + } + }); + // ── Event: File Saved ── const onSave = vscode.workspace.onDidSaveTextDocument(() => { lastActivity = Date.now(); @@ -429,6 +449,7 @@ function activate(context) { cmdChooseTheme, cmdExportStats, cmdImportStats, + cmdRenamePet, onSave, onChange, onDiagnostics, diff --git a/package.json b/package.json index 0adc507..bfe2e80 100644 --- a/package.json +++ b/package.json @@ -71,6 +71,11 @@ "command": "codecritter.playPet", "title": "CodeCritter: Play with Pet 🎾", "category": "CodeCritter" + }, + { + "command": "codecritter.petName", + "title": "CodeCritter: Rename Pet ✏️", + "category": "CodeCritter" } ], "viewsContainers": {