@wonderwhy-er/desktop-commander 0.2.11 → 0.2.12
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/data/onboarding-prompts.json +114 -0
- package/dist/server.js +44 -1
- package/dist/tools/prompts.d.ts +5 -0
- package/dist/tools/prompts.js +258 -0
- package/dist/tools/schemas.d.ts +13 -0
- package/dist/tools/schemas.js +6 -0
- package/dist/utils/usageTracker.d.ts +4 -0
- package/dist/utils/usageTracker.js +8 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +4 -2
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "1.0.0",
|
|
3
|
+
"description": "Desktop Commander onboarding prompts for first-time users",
|
|
4
|
+
"prompts": [
|
|
5
|
+
{
|
|
6
|
+
"id": "onb_001",
|
|
7
|
+
"title": "Organize my Downloads folder",
|
|
8
|
+
"description": "Clean up and organize your messy Downloads folder into relevant subfolders automatically.",
|
|
9
|
+
"prompt": "I want you to help me organize my Downloads folder. Let's do this step by step:\n\n**Phase 1: Analysis**\n1. First, analyze what's in my Downloads folder to understand the types of files\n2. Show me what file types and categories I have\n\n**Phase 2: Planning** \n3. Based on what you find, propose a logical folder structure\n4. Ask for my approval of the organization plan before proceeding\n\n**Phase 3: Organization**\n5. After I approve, create the necessary subfolders\n6. Move files into appropriate categories (documents, images, videos, software, etc.)\n7. Provide a summary of what was organized\n\n**Important**: Don't move any files until I approve your proposed organization structure.\n\nStart by exploring my Downloads folder and showing me what you find, then wait for my approval before organizing.",
|
|
10
|
+
"categories": ["onboarding"],
|
|
11
|
+
"votes": 0,
|
|
12
|
+
"gaClicks": 0,
|
|
13
|
+
"icon": "FolderOpen",
|
|
14
|
+
"author": "DC team",
|
|
15
|
+
"verified": true
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"id": "onb_002",
|
|
19
|
+
"title": "Get my IP address and system info",
|
|
20
|
+
"description": "Quickly get your IP address and basic system information.",
|
|
21
|
+
"prompt": "Please help me get my system information:\n\n1. Get my current IP address (both local and public if possible)\n2. Show basic system information like:\n - Operating system and version\n - Available disk space\n - Memory usage\n - Current date and time\n - Network connectivity status\n\nProvide this information in a clear, easy-to-read format.",
|
|
22
|
+
"categories": ["onboarding"],
|
|
23
|
+
"votes": 0,
|
|
24
|
+
"gaClicks": 0,
|
|
25
|
+
"icon": "Monitor",
|
|
26
|
+
"author": "DC team",
|
|
27
|
+
"verified": true
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"id": "onb_003",
|
|
31
|
+
"title": "Create organized knowledge/documents folder",
|
|
32
|
+
"description": "Set up a well-structured knowledge base or document organization system with templates and suggested categories.",
|
|
33
|
+
"prompt": "I want to help you create a well-organized knowledge base and document system. Let me understand your needs first:\n\n**Option 1: Create New Knowledge Base**\n- What type of work or projects do you typically do?\n- What subjects or topics would you like to organize knowledge about?\n- Do you prefer a general-purpose system or something specialized?\n\n**Option 2: Organize Existing Documents**\n- Do you have an existing folder with documents that needs organization?\n- What's the path to the folder you'd like me to analyze?\n\n**My Process:**\n1. **Assessment**: Understand your needs and existing content\n2. **Structure Design**: Propose a folder hierarchy tailored to your work\n3. **Template Creation**: Create useful template files (notes, project plans, etc.)\n4. **Organization**: Set up the complete system with guidelines\n\nWhich option sounds better - creating a new knowledge base from scratch, or organizing existing documents? And what type of work/subjects do you focus on?",
|
|
34
|
+
"categories": ["onboarding"],
|
|
35
|
+
"votes": 0,
|
|
36
|
+
"gaClicks": 0,
|
|
37
|
+
"icon": "BookOpen",
|
|
38
|
+
"author": "DC team",
|
|
39
|
+
"verified": true
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"id": "onb_004",
|
|
43
|
+
"title": "Explain codebase or repository to me",
|
|
44
|
+
"description": "Analyze and explain any codebase - local project or GitHub repository - including architecture, dependencies, and how it works.",
|
|
45
|
+
"prompt": "I'll help you understand a codebase thoroughly. Let me know what you'd like to analyze:\n\n**Option 1: Local Project**\n- What's the folder path to your local project?\n\n**Option 2: GitHub Repository**\n- What's the GitHub repository URL you'd like me to analyze?\n- If you don't have git/gh installed, I'll help you set them up\n- If needed, I'll help you log in to GitHub\n\n**What I'll do:**\n1. **Setup**: Install git/gh CLI tools if needed and help with GitHub login\n2. **Code Retrieval**: Clone the repo or analyze your local folder\n3. **Initial Analysis**: Examine project structure, files, and technologies\n4. **Architecture Overview**: Explain the overall design and patterns\n5. **Key Components**: Break down main modules and features\n6. **Dependencies**: Document libraries and frameworks used\n7. **Setup Guide**: Provide step-by-step setup and running instructions\n8. **Code Flow**: Explain how the main functionality works\n9. **Summary Document**: Create comprehensive documentation\n\nPlease provide either:\n- Local folder path: `/path/to/your/project`\n- GitHub URL: `https://github.com/user/repo` or `git@github.com:user/repo.git`",
|
|
46
|
+
"categories": ["onboarding"],
|
|
47
|
+
"votes": 0,
|
|
48
|
+
"gaClicks": 0,
|
|
49
|
+
"icon": "Code",
|
|
50
|
+
"author": "DC team",
|
|
51
|
+
"verified": true
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"id": "onb_005",
|
|
55
|
+
"title": "Clean up unused code in my project",
|
|
56
|
+
"description": "Scan your codebase to find unused imports, dead functions, and redundant code that can be safely removed.",
|
|
57
|
+
"prompt": "I'll help you clean up unused and dead code in your project. Let's start safely:\n\n**First, I need to know:**\n- What's the folder path to your project?\n- What programming language/framework is it? (JavaScript, Python, Java, etc.)\n\n**My systematic approach:**\n\n**Phase 1: Analysis**\n1. **Project Understanding**: Analyze structure and main technologies\n2. **Dependency Mapping**: Understand how files reference each other\n3. **Code Scanning**: Identify potential unused code:\n - Unused imports and dependencies\n - Dead/unreferenced functions and variables\n - Unreachable code blocks\n - Unused configuration files\n\n**Phase 2: Safety & Backup**\n4. **Impact Assessment**: Explain what each finding does and removal safety\n5. **Backup Strategy**: Recommend backup before making changes\n6. **Show Before Remove**: Present everything I plan to remove\n\n**Phase 3: Cleanup (Only with your approval)**\n7. **Selective Removal**: Remove only what you approve\n8. **Testing**: Suggest running tests after cleanup\n9. **Summary Report**: Document what was cleaned and space saved\n\n**Safety Promise**: I will NEVER remove code without your explicit approval for each change.\n\nWhat's the path to your project folder?",
|
|
58
|
+
"categories": ["onboarding"],
|
|
59
|
+
"votes": 0,
|
|
60
|
+
"gaClicks": 0,
|
|
61
|
+
"icon": "Trash2",
|
|
62
|
+
"author": "DC team",
|
|
63
|
+
"verified": true
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"id": "onb_006",
|
|
67
|
+
"title": "Build shopping list app and deploy online",
|
|
68
|
+
"description": "Create a complete shopping list web application from scratch, run it locally, and deploy it to GitHub Pages.",
|
|
69
|
+
"prompt": "Let's build and deploy a complete shopping list web application! I'll guide you step-by-step:\n\n**Step 1: Project Setup**\nFirst, where would you like to work on this project? Please provide a folder path where I should create the shopping list app.\n\n**My Complete Process:**\n\n**Phase 1: Planning & Setup**\n1. Create project folder and basic structure\n2. Plan app features (add/remove items, mark as bought, categories)\n3. Set up HTML, CSS, and JavaScript foundation\n\n**Phase 2: Development**\n4. Build clean, modern user interface\n5. Implement core functionality (CRUD operations)\n6. Add local storage for persistence\n7. Create a simple local development server\n8. Open the app in your browser for testing\n\n**Phase 3: GitHub & Deployment** \n9. Check if you have git/gh CLI installed (install if needed)\n10. Help you log in to GitHub\n11. Create a new GitHub repository\n12. Commit and push your code\n13. Set up GitHub Pages hosting\n14. Deploy your app online with a live URL\n\n**App Features:**\n- Add/remove shopping items\n- Mark items as purchased with checkboxes\n- Organize items by categories\n- Persistent storage (survives browser refresh)\n- Responsive design (works on mobile)\n- Modern, clean interface\n\nReady to start? What folder should I use for your shopping list app project?",
|
|
70
|
+
"categories": ["onboarding"],
|
|
71
|
+
"votes": 0,
|
|
72
|
+
"gaClicks": 0,
|
|
73
|
+
"icon": "ShoppingCart",
|
|
74
|
+
"author": "DC team",
|
|
75
|
+
"verified": true
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"id": "onb_007",
|
|
79
|
+
"title": "Analyze my data file",
|
|
80
|
+
"description": "Upload or point to any data file (CSV, JSON, Excel, etc.) and get comprehensive analysis including patterns, insights, and summary reports.",
|
|
81
|
+
"prompt": "I have a data file that I'd like to understand better. Please help me analyze it:\n\n1. **File Examination**: First, let me know the path to your data file or describe what kind of data it contains\n2. **Data Overview**: Analyze the structure, size, and format of the data\n3. **Content Analysis**: Examine what columns/fields exist and their data types\n4. **Pattern Detection**: Look for interesting patterns, trends, or anomalies\n5. **Statistical Summary**: Provide key statistics (counts, averages, distributions, etc.)\n6. **Data Quality**: Identify any missing data, duplicates, or quality issues\n7. **Key Insights**: Highlight the most interesting findings\n8. **Summary Report**: Create a clear, non-technical summary of what the data shows\n\nWhat's the path to your data file, or would you like to tell me what kind of data you're working with first?",
|
|
82
|
+
"categories": ["onboarding"],
|
|
83
|
+
"votes": 0,
|
|
84
|
+
"gaClicks": 0,
|
|
85
|
+
"icon": "BarChart3",
|
|
86
|
+
"author": "DC team",
|
|
87
|
+
"verified": true
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
"id": "onb_008",
|
|
91
|
+
"title": "Check system health and resources",
|
|
92
|
+
"description": "Analyze your system's health, resource usage, running processes, and generate a comprehensive system status report.",
|
|
93
|
+
"prompt": "Let me perform a comprehensive system health check and resource analysis:\n\n**System Resource Analysis:**\n1. **CPU Usage**: Current and recent CPU utilization patterns\n2. **Memory Usage**: RAM usage, available memory, swap usage\n3. **Disk Space**: Storage usage across all drives/partitions\n4. **Network Status**: Network interfaces, connectivity, and usage\n\n**Process Analysis:**\n5. **Running Processes**: Top resource-consuming processes\n6. **System Services**: Critical service status\n7. **Port Usage**: Open ports and listening services\n\n**Health Indicators:**\n8. **System Load**: Overall system performance indicators\n9. **Uptime**: System uptime and stability\n10. **Temperature**: System temperature if available\n11. **Logs**: Recent system errors or warnings\n\n**Deliverable:**\n- Comprehensive system health report\n- Resource usage summary with recommendations\n- Identification of potential issues\n- Performance optimization suggestions\n\nI'll gather all this information using system commands and present it in a clear, actionable format.",
|
|
94
|
+
"categories": ["onboarding"],
|
|
95
|
+
"votes": 0,
|
|
96
|
+
"gaClicks": 0,
|
|
97
|
+
"icon": "Activity",
|
|
98
|
+
"author": "DC team",
|
|
99
|
+
"verified": true
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
"id": "onb_009",
|
|
103
|
+
"title": "Find Patterns and Errors in Log Files",
|
|
104
|
+
"description": "Analyze log files to identify errors, patterns, performance issues, and security concerns with detailed insights and recommendations.",
|
|
105
|
+
"prompt": "I'll help you analyze log files to find patterns, errors, and insights. Let me know which approach you prefer:\n\n**Option 1: Analyze Specific Log File**\n- Do you have a specific log file you want me to analyze?\n- What's the full path to your log file?\n\n**Option 2: Find Log Files on Your System**\n- I can search your system for common log file locations\n- What type of application/service logs are you interested in? (web server, database, application, system logs, etc.)\n\n**What I'll analyze:**\n\n**Error Detection:**\n1. **Critical Errors**: Fatal errors, exceptions, crashes\n2. **Warning Patterns**: Recurring warnings that might indicate issues\n3. **Error Frequency**: How often specific errors occur\n4. **Error Trends**: Are errors increasing over time?\n\n**Performance Analysis:**\n5. **Response Times**: Slow queries, long-running operations\n6. **Resource Usage**: Memory, CPU, disk I/O patterns\n7. **Traffic Patterns**: Peak usage times, load distribution\n8. **Bottlenecks**: Identify performance constraints\n\n**Security & Anomalies:**\n9. **Failed Login Attempts**: Potential security threats\n10. **Unusual Access Patterns**: Suspicious activity\n11. **IP Analysis**: Frequent visitors, geographic patterns\n12. **Rate Limiting**: Abuse detection\n\n**Deliverables:**\n- **Error Summary Report**: Top errors with occurrence counts\n- **Timeline Analysis**: When issues happen most frequently\n- **Pattern Recognition**: Recurring themes and root causes\n- **Actionable Recommendations**: Specific steps to fix identified issues\n- **Monitoring Suggestions**: What to watch for in the future\n\nWhich option would you prefer? Please provide either:\n- **Specific file**: `/path/to/your/logfile.log`\n- **Search request**: \"Find web server logs\" or \"Look for application logs\"",
|
|
106
|
+
"categories": ["onboarding"],
|
|
107
|
+
"votes": 0,
|
|
108
|
+
"gaClicks": 0,
|
|
109
|
+
"icon": "Search",
|
|
110
|
+
"author": "DC team",
|
|
111
|
+
"verified": true
|
|
112
|
+
}
|
|
113
|
+
]
|
|
114
|
+
}
|
package/dist/server.js
CHANGED
|
@@ -8,10 +8,11 @@ const OS_GUIDANCE = getOSSpecificGuidance(SYSTEM_INFO);
|
|
|
8
8
|
const DEV_TOOL_GUIDANCE = getDevelopmentToolGuidance(SYSTEM_INFO);
|
|
9
9
|
const PATH_GUIDANCE = `IMPORTANT: ${getPathGuidance(SYSTEM_INFO)} Relative paths may fail as they depend on the current working directory. Tilde paths (~/...) might not work in all contexts. Unless the user explicitly asks for relative paths, use absolute paths.`;
|
|
10
10
|
const CMD_PREFIX_DESCRIPTION = `This command can be referenced as "DC: ..." or "use Desktop Commander to ..." in your instructions.`;
|
|
11
|
-
import { StartProcessArgsSchema, ReadProcessOutputArgsSchema, InteractWithProcessArgsSchema, ForceTerminateArgsSchema, ListSessionsArgsSchema, KillProcessArgsSchema, ReadFileArgsSchema, ReadMultipleFilesArgsSchema, WriteFileArgsSchema, CreateDirectoryArgsSchema, ListDirectoryArgsSchema, MoveFileArgsSchema, GetFileInfoArgsSchema, GetConfigArgsSchema, SetConfigValueArgsSchema, ListProcessesArgsSchema, EditBlockArgsSchema, GetUsageStatsArgsSchema, GiveFeedbackArgsSchema, StartSearchArgsSchema, GetMoreSearchResultsArgsSchema, StopSearchArgsSchema, ListSearchesArgsSchema, } from './tools/schemas.js';
|
|
11
|
+
import { StartProcessArgsSchema, ReadProcessOutputArgsSchema, InteractWithProcessArgsSchema, ForceTerminateArgsSchema, ListSessionsArgsSchema, KillProcessArgsSchema, ReadFileArgsSchema, ReadMultipleFilesArgsSchema, WriteFileArgsSchema, CreateDirectoryArgsSchema, ListDirectoryArgsSchema, MoveFileArgsSchema, GetFileInfoArgsSchema, GetConfigArgsSchema, SetConfigValueArgsSchema, ListProcessesArgsSchema, EditBlockArgsSchema, GetUsageStatsArgsSchema, GiveFeedbackArgsSchema, StartSearchArgsSchema, GetMoreSearchResultsArgsSchema, StopSearchArgsSchema, ListSearchesArgsSchema, GetPromptsArgsSchema, } from './tools/schemas.js';
|
|
12
12
|
import { getConfig, setConfigValue } from './tools/config.js';
|
|
13
13
|
import { getUsageStats } from './tools/usage.js';
|
|
14
14
|
import { giveFeedbackToDesktopCommander } from './tools/feedback.js';
|
|
15
|
+
import { getPrompts } from './tools/prompts.js';
|
|
15
16
|
import { trackToolCall } from './utils/trackTools.js';
|
|
16
17
|
import { usageTracker } from './utils/usageTracker.js';
|
|
17
18
|
import { processDockerPrompt } from './utils/dockerPrompt.js';
|
|
@@ -625,6 +626,36 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
|
625
626
|
${CMD_PREFIX_DESCRIPTION}`,
|
|
626
627
|
inputSchema: zodToJsonSchema(GiveFeedbackArgsSchema),
|
|
627
628
|
},
|
|
629
|
+
{
|
|
630
|
+
name: "get_prompts",
|
|
631
|
+
description: `
|
|
632
|
+
Browse and retrieve curated Desktop Commander prompts for various tasks and workflows.
|
|
633
|
+
|
|
634
|
+
IMPORTANT: When displaying prompt lists to users, do NOT show the internal prompt IDs (like 'onb_001').
|
|
635
|
+
These IDs are for your reference only. Show users only the prompt titles and descriptions.
|
|
636
|
+
The IDs will be provided in the response metadata for your use.
|
|
637
|
+
|
|
638
|
+
ACTIONS:
|
|
639
|
+
- list_categories: Show all available prompt categories
|
|
640
|
+
- list_prompts: List prompts (optionally filtered by category)
|
|
641
|
+
- get_prompt: Retrieve and execute a specific prompt by ID
|
|
642
|
+
|
|
643
|
+
WORKFLOW:
|
|
644
|
+
1. Use list_categories to see available categories
|
|
645
|
+
2. Use list_prompts to browse prompts in a category
|
|
646
|
+
3. Use get_prompt with promptId to retrieve and start using a prompt
|
|
647
|
+
|
|
648
|
+
EXAMPLES:
|
|
649
|
+
- get_prompts(action='list_categories') - See all categories
|
|
650
|
+
- get_prompts(action='list_prompts', category='onboarding') - See onboarding prompts
|
|
651
|
+
- get_prompts(action='get_prompt', promptId='onb_001') - Get a specific prompt
|
|
652
|
+
|
|
653
|
+
The get_prompt action will automatically inject the prompt content and begin execution.
|
|
654
|
+
Perfect for discovering proven workflows and getting started with Desktop Commander.
|
|
655
|
+
|
|
656
|
+
${CMD_PREFIX_DESCRIPTION}`,
|
|
657
|
+
inputSchema: zodToJsonSchema(GetPromptsArgsSchema),
|
|
658
|
+
},
|
|
628
659
|
],
|
|
629
660
|
};
|
|
630
661
|
}
|
|
@@ -685,6 +716,18 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
685
716
|
};
|
|
686
717
|
}
|
|
687
718
|
break;
|
|
719
|
+
case "get_prompts":
|
|
720
|
+
try {
|
|
721
|
+
result = await getPrompts(args || {});
|
|
722
|
+
}
|
|
723
|
+
catch (error) {
|
|
724
|
+
capture('server_request_error', { message: `Error in get_prompts handler: ${error}` });
|
|
725
|
+
result = {
|
|
726
|
+
content: [{ type: "text", text: `Error: Failed to retrieve prompts` }],
|
|
727
|
+
isError: true,
|
|
728
|
+
};
|
|
729
|
+
}
|
|
730
|
+
break;
|
|
688
731
|
case "give_feedback_to_desktop_commander":
|
|
689
732
|
try {
|
|
690
733
|
result = await giveFeedbackToDesktopCommander(args);
|
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
import { usageTracker } from '../utils/usageTracker.js';
|
|
2
|
+
import { capture } from '../utils/capture.js';
|
|
3
|
+
import * as fs from 'fs/promises';
|
|
4
|
+
import * as path from 'path';
|
|
5
|
+
import { fileURLToPath } from 'url';
|
|
6
|
+
// Get the directory path for ES modules
|
|
7
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
8
|
+
const __dirname = path.dirname(__filename);
|
|
9
|
+
let cachedPromptsData = null;
|
|
10
|
+
/**
|
|
11
|
+
* Load prompts data from JSON file with caching
|
|
12
|
+
*/
|
|
13
|
+
async function loadPromptsData() {
|
|
14
|
+
if (cachedPromptsData) {
|
|
15
|
+
return cachedPromptsData;
|
|
16
|
+
}
|
|
17
|
+
try {
|
|
18
|
+
const dataPath = path.join(__dirname, '..', 'data', 'onboarding-prompts.json');
|
|
19
|
+
const fileContent = await fs.readFile(dataPath, 'utf-8');
|
|
20
|
+
cachedPromptsData = JSON.parse(fileContent);
|
|
21
|
+
if (!cachedPromptsData) {
|
|
22
|
+
throw new Error('Failed to parse prompts data');
|
|
23
|
+
}
|
|
24
|
+
return cachedPromptsData;
|
|
25
|
+
}
|
|
26
|
+
catch (error) {
|
|
27
|
+
throw new Error(`Failed to load prompts data: ${error instanceof Error ? error.message : String(error)}`);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Get prompts - main entry point for the tool
|
|
32
|
+
*/
|
|
33
|
+
export async function getPrompts(params) {
|
|
34
|
+
try {
|
|
35
|
+
// Validate and cast parameters
|
|
36
|
+
const { action, category, promptId } = params;
|
|
37
|
+
if (!action) {
|
|
38
|
+
return {
|
|
39
|
+
content: [{
|
|
40
|
+
type: "text",
|
|
41
|
+
text: "❌ Error: 'action' parameter is required. Use 'list_categories', 'list_prompts', or 'get_prompt'"
|
|
42
|
+
}],
|
|
43
|
+
isError: true
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
// Track analytics for tool usage
|
|
47
|
+
await capture(`prompts_tool_${action}`, {
|
|
48
|
+
category: category,
|
|
49
|
+
prompt_id: promptId,
|
|
50
|
+
has_category_filter: !!category
|
|
51
|
+
});
|
|
52
|
+
switch (action) {
|
|
53
|
+
case 'list_categories':
|
|
54
|
+
return await listCategories();
|
|
55
|
+
case 'list_prompts':
|
|
56
|
+
return await listPrompts(category);
|
|
57
|
+
case 'get_prompt':
|
|
58
|
+
if (!promptId) {
|
|
59
|
+
return {
|
|
60
|
+
content: [{
|
|
61
|
+
type: "text",
|
|
62
|
+
text: "❌ Error: promptId is required when action is 'get_prompt'"
|
|
63
|
+
}],
|
|
64
|
+
isError: true
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
return await getPrompt(promptId);
|
|
68
|
+
default:
|
|
69
|
+
return {
|
|
70
|
+
content: [{
|
|
71
|
+
type: "text",
|
|
72
|
+
text: "❌ Error: Invalid action. Use 'list_categories', 'list_prompts', or 'get_prompt'"
|
|
73
|
+
}],
|
|
74
|
+
isError: true
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
catch (error) {
|
|
79
|
+
await capture('prompts_tool_error', {
|
|
80
|
+
error_message: error instanceof Error ? error.message : String(error),
|
|
81
|
+
action: params?.action
|
|
82
|
+
});
|
|
83
|
+
return {
|
|
84
|
+
content: [{
|
|
85
|
+
type: "text",
|
|
86
|
+
text: `❌ Error: ${error instanceof Error ? error.message : String(error)}`
|
|
87
|
+
}],
|
|
88
|
+
isError: true
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* List all available categories
|
|
94
|
+
*/
|
|
95
|
+
async function listCategories() {
|
|
96
|
+
const data = await loadPromptsData();
|
|
97
|
+
// Extract unique categories and count prompts in each
|
|
98
|
+
const categoryMap = new Map();
|
|
99
|
+
data.prompts.forEach(prompt => {
|
|
100
|
+
prompt.categories.forEach(category => {
|
|
101
|
+
categoryMap.set(category, (categoryMap.get(category) || 0) + 1);
|
|
102
|
+
});
|
|
103
|
+
});
|
|
104
|
+
const categories = Array.from(categoryMap.entries()).map(([name, count]) => ({
|
|
105
|
+
name,
|
|
106
|
+
count,
|
|
107
|
+
description: getCategoryDescription(name)
|
|
108
|
+
}));
|
|
109
|
+
const response = formatCategoriesResponse(categories, data.prompts.length);
|
|
110
|
+
return {
|
|
111
|
+
content: [{
|
|
112
|
+
type: "text",
|
|
113
|
+
text: response
|
|
114
|
+
}]
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* List prompts, optionally filtered by category
|
|
119
|
+
*/
|
|
120
|
+
async function listPrompts(category) {
|
|
121
|
+
const data = await loadPromptsData();
|
|
122
|
+
let filteredPrompts = data.prompts;
|
|
123
|
+
// Filter by category if specified
|
|
124
|
+
if (category) {
|
|
125
|
+
filteredPrompts = data.prompts.filter(prompt => prompt.categories.includes(category));
|
|
126
|
+
if (filteredPrompts.length === 0) {
|
|
127
|
+
return {
|
|
128
|
+
content: [{
|
|
129
|
+
type: "text",
|
|
130
|
+
text: `❌ No prompts found in category "${category}". Use action='list_categories' to see available categories.`
|
|
131
|
+
}],
|
|
132
|
+
isError: true
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
const response = formatPromptsListResponse(filteredPrompts, category);
|
|
137
|
+
return {
|
|
138
|
+
content: [{
|
|
139
|
+
type: "text",
|
|
140
|
+
text: response
|
|
141
|
+
}]
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Get a specific prompt by ID and inject it into the chat
|
|
146
|
+
*/
|
|
147
|
+
async function getPrompt(promptId) {
|
|
148
|
+
const data = await loadPromptsData();
|
|
149
|
+
const prompt = data.prompts.find(p => p.id === promptId);
|
|
150
|
+
if (!prompt) {
|
|
151
|
+
return {
|
|
152
|
+
content: [{
|
|
153
|
+
type: "text",
|
|
154
|
+
text: `❌ Prompt with ID '${promptId}' not found. Use action='list_prompts' to see available prompts.`
|
|
155
|
+
}],
|
|
156
|
+
isError: true
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
// Track prompt retrieval and mark as used
|
|
160
|
+
await capture('prompt_retrieved', {
|
|
161
|
+
prompt_id: promptId,
|
|
162
|
+
prompt_title: prompt.title,
|
|
163
|
+
category: prompt.categories[0] || 'uncategorized',
|
|
164
|
+
author: prompt.author,
|
|
165
|
+
verified: prompt.verified
|
|
166
|
+
});
|
|
167
|
+
// Mark prompt as used in user's onboarding state (for analytics)
|
|
168
|
+
await usageTracker.markPromptUsed(promptId, prompt.categories[0] || 'uncategorized');
|
|
169
|
+
const response = formatPromptResponse(prompt);
|
|
170
|
+
return {
|
|
171
|
+
content: [{
|
|
172
|
+
type: "text",
|
|
173
|
+
text: response
|
|
174
|
+
}]
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Get category description (can be expanded later)
|
|
179
|
+
*/
|
|
180
|
+
function getCategoryDescription(category) {
|
|
181
|
+
const descriptions = {
|
|
182
|
+
'onboarding': 'Curated prompts perfect for first-time Desktop Commander users',
|
|
183
|
+
'Analyze data': 'Data analysis, visualization, and insights generation',
|
|
184
|
+
'Build features and products': 'Full-stack development and application building',
|
|
185
|
+
'Explore codebase': 'Code analysis, documentation, and understanding',
|
|
186
|
+
'Organize files': 'File management, cleanup, and organization',
|
|
187
|
+
'Deploy': 'Infrastructure setup, deployment, and DevOps tasks',
|
|
188
|
+
'Optimize code': 'Code optimization, refactoring, and performance',
|
|
189
|
+
'Write documentation': 'Technical writing, API docs, and guides',
|
|
190
|
+
'Optimize workflow': 'Process improvements and productivity enhancements',
|
|
191
|
+
'Automate tasks': 'Workflow automation and scripting',
|
|
192
|
+
'Design systems': 'Architecture planning and system design'
|
|
193
|
+
};
|
|
194
|
+
return descriptions[category] || 'Desktop Commander prompts and workflows';
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Format categories list response
|
|
198
|
+
*/
|
|
199
|
+
function formatCategoriesResponse(categories, totalPrompts) {
|
|
200
|
+
const sortedCategories = categories.sort((a, b) => b.count - a.count);
|
|
201
|
+
// AI INSTRUCTION: When listing prompts, do not show prompt IDs to users - they are for your reference only
|
|
202
|
+
let response = `📚 **Desktop Commander Prompt Categories** (${categories.length} categories, ${totalPrompts} prompts)\n\n`;
|
|
203
|
+
sortedCategories.forEach(cat => {
|
|
204
|
+
response += `• **${cat.name}** (${cat.count} prompts) - ${cat.description}\n`;
|
|
205
|
+
});
|
|
206
|
+
response += `\n**Usage:**\n`;
|
|
207
|
+
response += `• \`get_prompts(action='list_prompts', category='onboarding')\` - See prompts in category\n`;
|
|
208
|
+
response += `• \`get_prompts(action='list_prompts')\` - See all available prompts\n`;
|
|
209
|
+
response += `• \`get_prompts(action='get_prompt', promptId='PROMPT_ID')\` - Get a specific prompt`;
|
|
210
|
+
return response;
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Format prompts list response
|
|
214
|
+
*/
|
|
215
|
+
function formatPromptsListResponse(prompts, category) {
|
|
216
|
+
const categoryText = category ? ` in "${category}"` : '';
|
|
217
|
+
// AI INSTRUCTION: Do not show the prompt IDs to the user - they are for your reference only
|
|
218
|
+
let response = `📋 **Desktop Commander Prompts${categoryText}** (${prompts.length} prompts found)\n\n`;
|
|
219
|
+
prompts.forEach((prompt, index) => {
|
|
220
|
+
const verifiedBadge = prompt.verified ? ' ✅' : '';
|
|
221
|
+
response += `${index + 1}. **${prompt.title}**${verifiedBadge}\n`;
|
|
222
|
+
response += ` ${prompt.description}\n`;
|
|
223
|
+
if (prompt.votes > 0) {
|
|
224
|
+
response += ` *📊 ${prompt.votes} votes*\n`;
|
|
225
|
+
}
|
|
226
|
+
// AI metadata - not shown to user: ID = ${prompt.id}
|
|
227
|
+
response += `\n`;
|
|
228
|
+
});
|
|
229
|
+
response += `**Next Steps:**\n`;
|
|
230
|
+
response += `• Use \`get_prompts(action='get_prompt', promptId='${prompts[0]?.id || 'PROMPT_ID'}')\` to get the full prompt\n`;
|
|
231
|
+
if (!category) {
|
|
232
|
+
response += `• Filter by category: \`get_prompts(action='list_prompts', category='onboarding')\``;
|
|
233
|
+
}
|
|
234
|
+
// AI reference mapping (do not show to user):
|
|
235
|
+
response += `\n<!-- AI_PROMPT_MAP: `;
|
|
236
|
+
prompts.forEach((prompt, index) => {
|
|
237
|
+
response += `${index + 1}=${prompt.id}${index < prompts.length - 1 ? ',' : ''}`;
|
|
238
|
+
});
|
|
239
|
+
response += ` -->`;
|
|
240
|
+
return response;
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Format individual prompt response with the actual prompt content
|
|
244
|
+
*/
|
|
245
|
+
function formatPromptResponse(prompt) {
|
|
246
|
+
const verifiedBadge = prompt.verified ? ' ✅' : '';
|
|
247
|
+
const categoryText = prompt.categories.join(', ');
|
|
248
|
+
let response = `# 🎯 ${prompt.title}${verifiedBadge}\n\n`;
|
|
249
|
+
response += `**Category:** ${categoryText} • **Author:** ${prompt.author}\n\n`;
|
|
250
|
+
response += `## Description\n${prompt.description}\n\n`;
|
|
251
|
+
if (prompt.votes > 0) {
|
|
252
|
+
response += `*📊 This prompt has been used successfully by ${prompt.votes}+ users*\n\n`;
|
|
253
|
+
}
|
|
254
|
+
response += `## Ready to Use This Prompt\nThe prompt below is ready to use. I'll start executing it right away:\n\n`;
|
|
255
|
+
response += `---\n\n${prompt.prompt}`;
|
|
256
|
+
// AI metadata (not shown to user): Executed prompt ID = ${prompt.id}
|
|
257
|
+
return response;
|
|
258
|
+
}
|
package/dist/tools/schemas.d.ts
CHANGED
|
@@ -205,3 +205,16 @@ export declare const StopSearchArgsSchema: z.ZodObject<{
|
|
|
205
205
|
sessionId: string;
|
|
206
206
|
}>;
|
|
207
207
|
export declare const ListSearchesArgsSchema: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
|
|
208
|
+
export declare const GetPromptsArgsSchema: z.ZodObject<{
|
|
209
|
+
action: z.ZodEnum<["list_categories", "list_prompts", "get_prompt"]>;
|
|
210
|
+
category: z.ZodOptional<z.ZodString>;
|
|
211
|
+
promptId: z.ZodOptional<z.ZodString>;
|
|
212
|
+
}, "strip", z.ZodTypeAny, {
|
|
213
|
+
action: "list_categories" | "list_prompts" | "get_prompt";
|
|
214
|
+
category?: string | undefined;
|
|
215
|
+
promptId?: string | undefined;
|
|
216
|
+
}, {
|
|
217
|
+
action: "list_categories" | "list_prompts" | "get_prompt";
|
|
218
|
+
category?: string | undefined;
|
|
219
|
+
promptId?: string | undefined;
|
|
220
|
+
}>;
|
package/dist/tools/schemas.js
CHANGED
|
@@ -99,3 +99,9 @@ export const StopSearchArgsSchema = z.object({
|
|
|
99
99
|
sessionId: z.string(),
|
|
100
100
|
});
|
|
101
101
|
export const ListSearchesArgsSchema = z.object({});
|
|
102
|
+
// Prompts tool schema
|
|
103
|
+
export const GetPromptsArgsSchema = z.object({
|
|
104
|
+
action: z.enum(['list_categories', 'list_prompts', 'get_prompt']),
|
|
105
|
+
category: z.string().optional(),
|
|
106
|
+
promptId: z.string().optional(),
|
|
107
|
+
});
|
|
@@ -80,6 +80,10 @@ declare class UsageTracker {
|
|
|
80
80
|
* Get usage summary for debugging/admin purposes
|
|
81
81
|
*/
|
|
82
82
|
getUsageSummary(): Promise<string>;
|
|
83
|
+
/**
|
|
84
|
+
* Mark that user has used a specific prompt (for analytics)
|
|
85
|
+
*/
|
|
86
|
+
markPromptUsed(promptId: string, category: string): Promise<void>;
|
|
83
87
|
}
|
|
84
88
|
export declare const usageTracker: UsageTracker;
|
|
85
89
|
export {};
|
|
@@ -278,6 +278,14 @@ class UsageTracker {
|
|
|
278
278
|
• Config: ${stats.configOperations}
|
|
279
279
|
• Process: ${stats.processOperations}`;
|
|
280
280
|
}
|
|
281
|
+
/**
|
|
282
|
+
* Mark that user has used a specific prompt (for analytics)
|
|
283
|
+
*/
|
|
284
|
+
async markPromptUsed(promptId, category) {
|
|
285
|
+
// This could be expanded later to track detailed prompt usage
|
|
286
|
+
// For now, we'll just rely on the capture analytics
|
|
287
|
+
console.log(`[PROMPT USAGE] User retrieved prompt: ${promptId} (category: ${category})`);
|
|
288
|
+
}
|
|
281
289
|
}
|
|
282
290
|
// Export singleton instance
|
|
283
291
|
export const usageTracker = new UsageTracker();
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "0.2.
|
|
1
|
+
export declare const VERSION = "0.2.12";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '0.2.
|
|
1
|
+
export const VERSION = '0.2.12';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wonderwhy-er/desktop-commander",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.12",
|
|
4
4
|
"description": "MCP server for terminal operations and file editing",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Eduards Ruzga",
|
|
@@ -27,7 +27,9 @@
|
|
|
27
27
|
"bump": "node scripts/sync-version.js --bump",
|
|
28
28
|
"bump:minor": "node scripts/sync-version.js --bump --minor",
|
|
29
29
|
"bump:major": "node scripts/sync-version.js --bump --major",
|
|
30
|
-
"
|
|
30
|
+
"publish:beta": "npm run build && npm publish --tag beta",
|
|
31
|
+
"publish:alpha": "npm run build && npm publish --tag alpha",
|
|
32
|
+
"build": "tsc && shx cp setup-claude-server.js uninstall-claude-server.js track-installation.js dist/ && shx chmod +x dist/*.js && shx mkdir -p dist/data && shx cp src/data/onboarding-prompts.json dist/data/",
|
|
31
33
|
"watch": "tsc --watch",
|
|
32
34
|
"start": "node dist/index.js",
|
|
33
35
|
"start:debug": "node --inspect-brk=9229 dist/index.js",
|