-
Notifications
You must be signed in to change notification settings - Fork 646
Fixes #158 - Setup copilot instructions #226
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
vivganes
wants to merge
2
commits into
github:main
Choose a base branch
from
vivganes:setup-instructions
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+53
−0
Open
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| # GitHub Copilot SDK — Assistant Instructions | ||
|
|
||
| **Quick purpose:** Help contributors and AI coding agents quickly understand this mono-repo and be productive (build, test, add SDK features, add E2E tests). ✅ | ||
|
|
||
| ## Big picture 🔧 | ||
|
|
||
| - The repo implements language SDKs (Node/TS, Python, Go, .NET) that speak to the **Copilot CLI** via **JSON‑RPC** (see `README.md` and `nodejs/src/client.ts`). | ||
| - Typical flow: your App → SDK client → JSON-RPC → Copilot CLI (server mode). The CLI must be installed or you can connect to an external CLI server via `cli_url`. | ||
|
|
||
| ## Most important files to read first 📚 | ||
|
|
||
| - Top-level: `README.md` (architecture + quick start) | ||
| - Language entry points: `nodejs/src/client.ts`, `python/README.md`, `go/README.md`, `dotnet/README.md` | ||
| - Test harness & E2E: `test/harness/*`, Python harness wrapper `python/e2e/testharness/proxy.py` | ||
| - Schemas & type generation: `nodejs/scripts/generate-session-types.ts` | ||
| - Session snapshots used by E2E: `test/snapshots/` (used by the replay proxy) | ||
|
|
||
| ## Developer workflows (commands you’ll use often) ▶️ | ||
|
|
||
| - Monorepo helpers: use `just` tasks from repo root: | ||
| - Install deps: `just install` (runs npm ci, uv pip install -e, go mod download, dotnet restore) | ||
| - Format all: `just format` | Lint all: `just lint` | Test all: `just test` | ||
| - Per-language: | ||
| - Node: `cd nodejs && npm ci` → `npm test` (Vitest), `npm run generate:session-types` to regenerate session-event types | ||
| - Python: `cd python && uv pip install -e "[dev]"` → `uv run pytest` (E2E tests use the test harness) | ||
vivganes marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| - Go: `cd go && go test ./...` | ||
| - .NET: `cd dotnet && dotnet test test/GitHub.Copilot.SDK.Test.csproj` | ||
|
|
||
| ## Testing & E2E tips ⚙️ | ||
|
|
||
| - E2E runs against a local **replaying CAPI proxy** (see `test/harness/server.ts`). Most language E2E harnesses spawn that server automatically (see `python/e2e/testharness/proxy.py`). | ||
| - Tests rely on YAML snapshot exchanges under `test/snapshots/` — to add/testing scenarios add or edit appropriate YAML files and update tests. | ||
vivganes marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| - The harness prints `Listening: http://...` — tests parse this URL to configure CLI or proxy. | ||
|
|
||
| ## Project-specific conventions & patterns ✅ | ||
|
|
||
| - Tools: each SDK has helper APIs to expose functions as tools; prefer the language's `DefineTool`/`@define_tool`/`AIFunctionFactory.Create` patterns (see language READMEs). | ||
| - Infinite sessions are enabled by default and persist workspace state to `~/.copilot/session-state/{sessionId}`; compaction events are emitted (`session.compaction_start`, `session.compaction_complete`). See language READMEs for usage. | ||
| - Streaming: when `streaming`/`Streaming=true` you receive delta events (`assistant.message_delta`, `assistant.reasoning_delta`) and final events (`assistant.message`, `assistant.reasoning`) — tests expect this behavior. | ||
| - Type generation is centralized in `nodejs/scripts/generate-session-types.ts` and requires the `@github/copilot` schema to be present (often via `npm link` or installed package). | ||
|
|
||
| ## Integration & environment notes ⚠️ | ||
|
|
||
| - The SDK requires a Copilot CLI installation or an external server reachable via `cli_url`/`COPILOT_CLI_PATH`. | ||
vivganes marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| - Some scripts (typegen, formatting) call external tools: `go fmt`, `dotnet format`, `npx/tsx`, `quicktype`, `prettier`. Ensure these are available in CI / developer machines. | ||
vivganes marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| - Tests may assume `node >= 18`, `python >= 3.9`, platform differences handled (Windows uses `shell=True` for npx in harness). | ||
|
|
||
| ## Where to add new code or tests 🧭 | ||
|
|
||
| - SDK code: `nodejs/src`, `python/copilot`, `go`, `dotnet/src` | ||
| - Unit tests: `nodejs/test`, `python/*`, `go/*`, `dotnet/test` | ||
| - E2E tests: `*/e2e/` folders that use the shared replay proxy and `test/snapshots/` | ||
| - Generated types: update schema in `@github/copilot` then run `cd nodejs && npm run generate:session-types` and commit generated files in `src/generated` or language generated location. | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.