Overview
This node integrates with the GitHub Copilot CLI to provide AI-powered code and shell command suggestions, explanations, and shell command generation. It is particularly useful for developers who want to quickly generate or understand code snippets and shell commands without leaving their workflow automation environment.
For the Shell operation specifically, the node helps generate shell command suggestions based on a user prompt and optional context. It supports different categories of shell commands such as general commands, Git commands, Docker commands, npm/yarn commands, and file operations. This can be beneficial when automating tasks that require dynamic shell command generation or when users need help crafting complex shell commands.
Practical examples:
- Generating a Docker command to build and run a container based on a description.
- Suggesting Git commands to perform specific version control operations.
- Creating npm or yarn commands for package management tasks.
- Producing file operation commands like copying, moving, or deleting files with constraints.
Properties
| Name | Meaning |
|---|---|
| Prompt | The main request or question you want GitHub Copilot to assist with. For example, "Create a Docker command to run a Node.js app." |
| GitHub Token (Optional) | An optional API token generated by the GitHub CLI (gh auth token) used for authentication. If not provided, the node uses local CLI authentication configured via gh auth login. Personal Access Tokens from GitHub website do not work. |
| Filter Output | When enabled, removes the GitHub Copilot CLI header and footer from the response, keeping only the useful suggestion text. |
| Command Type | Specifies the category of shell commands to suggest. Options are: - General - Git - Docker - npm/yarn - File Operations |
| Additional Context | Optional extra information or constraints to provide better and more relevant suggestions. For example, "Use only commands compatible with Ubuntu 20.04." |
Output
The node outputs JSON data with the following structure:
operation: The operation performed, here always"shell".prompt: The original prompt string provided by the user.context: Any additional context provided.authMethod: Indicates whether authentication was done using a manual token or local CLI.tokenUsed: Boolean indicating if a manual token was used.tokenPrefix: First few characters of the token used (for reference, not full token).commandType: The selected shell command category.output: The filtered or raw output from the GitHub Copilot CLI containing the suggested shell command(s).cliRawOutput: The complete raw stdout from the CLI command.cliStderr: Any stderr output from the CLI command.timestamp: ISO timestamp of when the execution occurred.
If Filter Output is enabled, the output field contains only the cleaned-up suggestion without CLI headers/footers. Otherwise, it includes the full CLI response.
No binary data is produced by this node.
Dependencies
- Requires the GitHub Copilot CLI (
gh copilot) installed and accessible at/usr/bin/gh. - Optionally requires a valid GitHub CLI-generated token (
gh auth token) or prior authentication viagh auth loginon the host machine. - Runs shell commands using Node.js child process execution.
- Environment variable
HOMEis set internally for CLI execution context.
Troubleshooting
Authentication errors (HTTP 401 Unauthorized):
Occur if the token is missing, invalid, or not generated by the GitHub CLI.
Resolution: Usegh auth loginfollowed bygh auth tokento get a valid token, or ensure local CLI authentication is properly configured.Access denied errors (HTTP 403 Forbidden):
Usually means the GitHub account does not have an active Copilot subscription.
Resolution: Verify your GitHub Copilot subscription status.Server errors (HTTP 500 Internal Server Error):
Indicate temporary issues on GitHub's side.
Resolution: Retry after some time.Malformed request errors (HTTP 400 Bad Request):
Could be caused by invalid prompts or command construction.
Resolution: Check the prompt and parameters for correctness.Timeouts or no output:
The CLI command has a 30-second timeout and 1MB buffer limit. Large or slow responses may cause failures.
Resolution: Simplify prompts or check network connectivity.Token usage warnings:
Only tokens generated by the GitHub CLI itself work; personal access tokens from the GitHub website will not authenticate correctly.