Skip to content

Commit

Permalink
refactor: Restructure commands in .vscode/cody.json (#561)
Browse files Browse the repository at this point in the history
PR created by Cody 😎 

Refactor: Restructure commands in .vscode/cody.json

This commit refactors the commands defined in .vscode/cody.json:

- Removes the "Generate README.md for Current Directory" command
- Renames "Compare Files in Opened Tabs" to "Compare Open Tabs" and adds
a `slashCommand`
- Renames "Summarize the Last Cody Release" to "Summarize the latest
Cody Release"
- Updates the prompt for "Summarize the latest Cody Release"
- Makes minor formatting changes

These changes streamline and clarify the commands for an improved user
experience. The README generation command was removed as it is not
essential functionality.

## Test plan

<!-- Required. See
https://docs.sourcegraph.com/dev/background-information/testing_principles.
-->

json update.
  • Loading branch information
abeatrix authored Aug 3, 2023
1 parent 3afabbc commit 6f402ef
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 30 deletions.
31 changes: 12 additions & 19 deletions .vscode/cody.json
Original file line number Diff line number Diff line change
@@ -1,35 +1,28 @@
{
"commands": {
"Generate README.md for Current Directory": {
"prompt": "Write a detailed README.md introduction for this project. If possible, briefly explain what the directory is and its key features. Use Markdown formatting. Focus on clarity and being beginner-friendly. Surround the answer with a code block to indicate that it is code.",
"context": {
"currentDir": true,
"selection": false
}
},
"Commit Message for Current Changes": {
"Commit Message Suggestion": {
"prompt": "Suggest a informative commit message by summarizing code changes from the shared command output. The commit message should follow the conventional commit format and provide meaningful context for future readers.",
"context": {
"selection": false,
"command": "git diff"
},
"info": "You must have git installed and authenticated to use this recipe"
},
"Debug last error from Cody app": {
"prompt": "Tell me about the most recent error in log and how I can resolve it.",
"context": {
"selection": false,
"command": "tail -n 30 ~/Library/Logs/com.sourcegraph.cody/Cody.log"
},
"info": "You must have Cody app installed to use this recipe"
"note": "You must have git installed and authenticated to use this command. Runs this command before staging."
},
"Compare Files in Opened Tabs": {
"Compare Open Tabs": {
"prompt": "Please examine the code in the opened tabs. Then explain the relationship between the code samples by answering these questions: 1. What are the main tasks or functions the code is performing? 2. Are there any similarities in functions or logic across the samples? 3. Does one code snippet call or import another? If so, how do they interact? 4. Are there any notable differences in how they approach similar problems? 5. Overall, how are the code snippets related - do they work together as part of a larger program, solve variants of the same problem, or serve entirely different purposes?",
"slashCommand": "compare",
"context": {
"openTabs": true,
"selection": false
},
"info": "This recipe lets Cody analyze code from open tabs to provide insights on how they relate to each other."
"note": "This command lets Cody analyze code from open tabs to provide insights on how they relate to each other."
},
"Summarize the latest Cody Release": {
"prompt": "What is the latest stable version of Cody? Can you briefly summarize the changes that were included in that release based on this CHANGELOG excerpt?",
"context": {
"selection": false,
"command": "curl https://raw.githubusercontent.com/sourcegraph/cody/main/vscode/CHANGELOG.md | head -n 50"
}
}
}
}
16 changes: 8 additions & 8 deletions vscode/resources/samples/user-cody.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@
"description": "This file showcases how to build custom commandss for Cody by Sourcegraph in VS Code.",
"doc": "For more information, see https://sourcegraph.com/notebooks/Tm90ZWJvb2s6MzA1NQ==",
"commands": {
"(example) Compare Files in Opened Tabs": {
"(example) Compare Open Tabs": {
"prompt": "Please examine the code in the opened tabs. Then explain the relationship between the code samples by answering these questions: 1. What are the main tasks or functions the code is performing? 2. Are there any similarities in functions or logic across the samples? 3. Does one code snippet call or import another? If so, how do they interact? 4. Are there any notable differences in how they approach similar problems? 5. Overall, how are the code snippets related - do they work together as part of a larger program, solve variants of the same problem, or serve entirely different purposes?",
"slashCommand": "compare",
"prompt": "Examine the code in the opened tabs. Then explain the relationship between the code samples by answering these questions: 1. What are the main tasks or functions the code is performing? 2. Are there any similarities in functions or logic across the samples? 3. Does one code snippet call or import another? If so, how do they interact? 4. Are there any notable differences in how they approach similar problems? 5. Overall, how are the code snippets related - do they work together as part of a larger program, solve variants of the same problem, or serve entirely different purposes?",
"context": {
"openTabs": true,
"selection": false
}
},
"note": "This command lets Cody analyze code from open tabs to provide insights on how they relate to each other."
},
"(example) Debug last error from Cody app": {
"prompt": "Tell me about the most recent error in log and how I can resolve it.",
"(example) Summarize the Last Cody Release": {
"prompt": "What is the latest stable version of Cody? Can you briefly summarize the changes that were included in that release based on this CHANGELOG excerpt?",
"context": {
"selection": false,
"command": "tail -n 30 ~/Library/Logs/com.sourcegraph.cody/Cody.log"
},
"note": "You must have Cody app installed to use this recipe"
"command": "curl https://raw.githubusercontent.com/sourcegraph/cody/main/vscode/CHANGELOG.md | head -n 50"
}
}
}
}
6 changes: 3 additions & 3 deletions vscode/resources/samples/workspace-cody.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@
"doc": "For more information, see https://sourcegraph.com/notebooks/Tm90ZWJvb2s6MzA1NQ==",
"commands": {
"(example) Generate README.md for Current Directory": {
"prompt": "Write a detailed README.md file to document the code located in the same directory as my current selection. Summarize what the code in this directory is meant to accomplish. Explain the key files, functions, classes, and features. Use Markdown formatting for headings, code blocks, lists, etc. to make the it organized and readable. Aim for a beginner-friendly explanation that gives a developer unfamiliar with the code a good starting point to understand it. Make sure to include: - Overview of directory purpose - Functionality explanations - Relevant diagrams or visuals if helpful. Write the README content clearly and concisely using complete sentences and paragraphs based on the shared context. Use proper spelling, grammar, and punctuation throughout. Surround your full README text with triple backticks so it renders properly as a code block. Do not make assumptions or fabricating additional details.",
"prompt": "Write a detailed README.md file to document the code in the same directory as my current selection. Summarize what the code in this directory is meant to accomplish. Explain the key files, functions, classes, and features. Use Markdown formatting for headings, code blocks, lists, etc. to make it organized and readable. Aim for a beginner-friendly explanation that gives a developer unfamiliar with the code a good starting point to understand it. Ensure to include: - Overview of directory purpose - Functionality explanations - Relevant diagrams or visuals if helpful. Write the README content clearly and concisely using complete sentences and paragraphs based on the shared context. Use proper spelling, grammar, and punctuation throughout. Surround your full README text with triple backticks so it renders properly as a code block. Do not make assumptions or fabricate additional details.",
"context": {
"currentDir": true,
"selection": true
}
},
"(example) Commit Message for Current Changes": {
"(example) Commit Message Suggestion": {
"slashCommand": "commit",
"prompt": "Suggest a informative commit message by summarizing code changes from the shared command output. The commit message should follow the conventional commit format and provide meaningful context for future readers.",
"context": {
"selection": false,
"command": "git diff"
},
"note": "You must have git installed and authenticated to use this recipe"
"note": "You must have git installed and authenticated to use this command. Runs this command before staging."
}
}
}

0 comments on commit 6f402ef

Please sign in to comment.