Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
aatmmr committed Jan 23, 2025
0 parents commit 41c72fd
Show file tree
Hide file tree
Showing 6 changed files with 1,216 additions and 0 deletions.
42 changes: 42 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Node.js
node_modules/
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# macOS
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon

# Thumbnails
._*

# Files that might appear on external disk
.Spotlight-V100
.Trashes

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

# Windows
Thumbs.db
ehthumbs.db
Desktop.ini
$RECYCLE.BIN/

# Windows image file caches
*.stackdump

# Folder config file
[Dd]esktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/
45 changes: 45 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# GitHub Copilot Extension Backend Template

This is a template for creating a backend for the GitHub Copilot Extension. It is a simple Node.js server that listens for requests from the extension and responds with the appropriate data.

## Stack

The template uses `node.js` as a base and `express.js` as the web server. It comes also with `octokit.js` to interact with the GitHub API. The template also includes the [`@copilot-extensions/preview-sdk`](https://github.com/copilot-extensions/preview-sdk.js) package that helps simplifying the process of building an extension as agent.

- `node.js`
- `express.js`
- `octokit.js`
- `@copilot-extensions/preview-sdk`

## Getting Started

After cloning the repository, you need to install the dependencies by running:

```bash
npm install
```

Then, you can start the server by running:

```bash
npm start
```

Start creating your extension by adding code to `src/index.js` on line 13:

```js
app.post('/agent', (req, res) => {
// Your agent code starts here
});
```

From there on it is up to you to implement the logic for your extension.

## Devcontainer

This template comes with a `devcontainer.json` file that allows you to use Visual Studio Code's Remote - Containers extension to develop the extension in a containerized environment.

The container definition contains some settings for your convenience:

- GitHub Copilot is installed
- The port `3000` is exposed when the container is started. This way you can used the codespace as server to run your backend. Read more on how to do it in [this article](https://aatmmr.dev/posts/create-a-basic-agent-with-github-copilot-extensions/).
19 changes: 19 additions & 0 deletions devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "github-copilot-extension-backend-template",
"image": "mcr.microsoft.com/devcontainers/typescript-node:1-22-bookworm",
"forwardPorts": [
3000
],
"postStartCommand": "export CODESPACE_NAME=$(gh codespace view --json name -q .name); gh codespace ports visibility 3000:public -c $CODESPACE_NAME",
"features": {
"ghcr.io/devcontainers/features/github-cli:1": {}
},
"customizations": {
"vscode": {
"extensions": [
"github.copilot",
"github.copilot-chat"
]
}
}
}
Loading

0 comments on commit 41c72fd

Please sign in to comment.