Skip to content

An AI-powered task-management system you can drop into Cursor, Lovable, Windsurf, Roo, and others.

fix: stop aliasing hamster/ham to task-master (#1676)

Ralph Khreish6a11438de285
diff --git a/.changeset/fix-hamster-aliasing.md b/.changeset/fix-hamster-aliasing.md
new file mode 100644
index 00000000..d0e98913
--- /dev/null
+++ b/.changeset/fix-hamster-aliasing.md
@@ -0,0 +1,5 @@
+---
+"task-master-ai": patch
+---
+
+Stop setting up `hamster` and `ham` shell aliases during `task-master init`. Existing aliases are automatically cleaned up.
diff --git a/assets/rules/taskmaster.mdc b/assets/rules/taskmaster.mdc
index da265164..212b38f2 100644
--- a/assets/rules/taskmaster.mdc
+++ b/assets/rules/taskmaster.mdc
@@ -36,7 +36,7 @@ This document provides a detailed reference for interacting with Taskmaster, cov
* `projectVersion`: `Set the initial version for your project, e.g., '0.1.0'.` (CLI: `--version <version>`)
* `authorName`: `Author name.` (CLI: `--author <author>`)
* `skipInstall`: `Skip installing dependencies. Default is false.` (CLI: `--skip-install`)
- * `addAliases`: `Add shell aliases tm, taskmaster, hamster, and ham. Default is false.` (CLI: `--aliases`)
+ * `addAliases`: `Add shell aliases tm and taskmaster. Default is false.` (CLI: `--aliases`)
* `yes`: `Skip prompts and use defaults/provided arguments. Default is false.` (CLI: `-y, --yes`)
* **Usage:** Run this once at the beginning of a new project, typically via an integrated tool like Cursor. Operates on the current working directory of the MCP server.
* **Important:** Once complete, you *MUST* parse a prd in order to generate tasks. There will be no tasks files until then. The next step after initializing should be to create a PRD using the example PRD in .taskmaster/templates/example_prd.txt.
diff --git a/index.js b/index.js
index 271821e9..3cea3349 100644
--- a/index.js
+++ b/index.js
@@ -82,8 +82,8 @@ if (import.meta.url === `file://${process.argv[1]}`) {
.option('-a, --author <author>', 'Author name')
.option('--skip-install', 'Skip installing dependencies')
.option('--dry-run', 'Show what would be done without making changes')
- .option('--aliases', 'Add shell aliases (tm, taskmaster, hamster, ham)')
- .option('--no-aliases', 'Skip shell aliases (tm, taskmaster, hamster, ham)')
+ .option('--aliases', 'Add shell aliases (tm, taskmaster)')
+ .option('--no-aliases', 'Skip shell aliases (tm, taskmaster)')
.option('--git', 'Initialize Git repository')
.option('--no-git', 'Skip Git repository initialization')
.option('--git-tasks', 'Store tasks in Git')
diff --git a/mcp-server/src/tools/initialize-project.js b/mcp-server/src/tools/initialize-project.js
index 6a68787a..3b89cdb0 100644
--- a/mcp-server/src/tools/initialize-project.js
+++ b/mcp-server/src/tools/initialize-project.js
@@ -24,9 +24,7 @@ export function registerInitializeProjectTool(server) {
.boolean()
.optional()
.default(true)
- .describe(
- 'Add shell aliases (tm, taskmaster, hamster, ham) to shell config file.'
- ),
+ .describe('Add shell aliases (tm, taskmaster) to shell config file.'),
initGit: z
.boolean()
.optional()
diff --git a/scripts/init.js b/scripts/init.js
index bc876356..dc0f073f 100755
--- a/scripts/init.js
+++ b/scripts/init.js
@@ -149,17 +149,42 @@ function addShellAliases() {
const configContent = fs.readFileSync(shellConfigFile, 'utf8');
- // Define all aliases we want
+ // Define aliases we want (hamster/ham aliases are managed by Hamster CLI, not Task Master)
const aliases = [
{ name: 'tm', line: "alias tm='task-master'" },
- { name: 'taskmaster', line: "alias taskmaster='task-master'" },
- { name: 'hamster', line: "alias hamster='task-master'" },
- { name: 'ham', line: "alias ham='task-master'" }
+ { name: 'taskmaster', line: "alias taskmaster='task-master'" }
];
+ // Self-healing: remove any stale hamster/ham aliases that point to task-master
+ const staleAliasPatterns = [
+ /alias hamster='task-master'\n?/g,
+ /alias ham='task-master'\n?/g
+ ];
+
+ let cleanedContent = configContent;
+ for (const pattern of staleAliasPatterns) {
+ cleanedContent = cleanedContent.replace(pattern, '');
+ }
+ const removedStale = cleanedContent !== configContent;
+
+ // Clean up empty "Task Master aliases" comment blocks left behind
+ cleanedContent = cleanedContent.replace(
+ /\n# Task Master aliases added on [^\n]*\n(?=\s*\n|$)/g,
+ '\n'
+ );
+
+ if (removedStale) {
+ fs.writeFileSync(shellConfigFile, cleanedContent);
+ log(
+ 'debug',
+ 'Removed stale hamster/ham aliases pointing to task-master (these are managed by Hamster CLI)'
+ );
+ }
+
// Check which aliases are missing
+ const currentContent = removedStale ? cleanedContent : configContent;
const missingAliases = aliases.filter(
- (alias) => !configContent.includes(alias.line)
+ (alias) => !currentContent.includes(alias.line)
);
if (missingAliases.length === 0) {
diff --git a/scripts/modules/commands.js b/scripts/modules/commands.js
index e1851ca5..7e1f6413 100644
--- a/scripts/modules/commands.js
+++ b/scripts/modules/commands.js
@@ -3555,8 +3555,8 @@ ${result.result}
)
.option('--skip-install', 'Skip installing dependencies')
.option('--dry-run', 'Show what would be done without making changes')
- .option('--aliases', 'Add shell aliases (tm, taskmaster, hamster, ham)')
- .option('--no-aliases', 'Skip shell aliases (tm, taskmaster, hamster, ham)')
+ .option('--aliases', 'Add shell aliases (tm, taskmaster)')
+ .option('--no-aliases', 'Skip shell aliases (tm, taskmaster)')
.option('--git', 'Initialize Git repository')
.option('--no-git', 'Skip Git repository initialization')
.option('--git-tasks', 'Store tasks in Git')