Feat/add GitHub copilot subscription#384
Feat/add GitHub copilot subscription#384yashksaini-coder wants to merge 26 commits intoNano-Collective:mainfrom
Conversation
…als and adding login command
…idation in provider factory
Add manual context length override for models not listed on models.dev. Resolution order: session override > env variable > models.dev > null. Closes Nano-Collective#379
…tion Ollama users configuring 127.0.0.1 instead of localhost experienced connection failures and misleading errors. Added shared isLocalURL() utility and replaced broad 'connect' substring match with specific error codes to prevent misclassifying "disconnect"/"reconnect" as connection failures. Closes Nano-Collective#366
There was a problem hiding this comment.
Pull request overview
Adds GitHub Copilot subscription-backed support to nanocoder by introducing device-flow auth + credential storage and wiring a new sdkProvider: 'github-copilot' through templates, provider factory, commands, and CLI.
Changes:
- Add Copilot provider template + config validation/test cases and extend
SdkProviderunion with'github-copilot'. - Implement Copilot device-flow login UI/command + CLI entrypoint and store a user-scoped Copilot credential.
- Add provider-factory support that injects Copilot-specific auth headers and token refresh behavior.
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| source/wizards/validation.spec.ts | Adds config-building test coverage for sdkProvider: 'github-copilot'. |
| source/wizards/templates/provider-templates.ts | Introduces “GitHub Copilot” provider template and config builder. |
| source/wizards/templates/provider-templates.spec.ts | Tests Copilot template defaults and sdkProvider value. |
| source/types/config.ts | Extends SdkProvider union to include github-copilot. |
| source/hooks/useAppInitialization.tsx | Registers the new copilot-login command. |
| source/config/copilot-credentials.ts | Implements user-level persistence for Copilot credentials. |
| source/config/copilot-credentials.spec.ts | Adds tests for Copilot credential store round-trips. |
| source/commands/index.ts | Exports Copilot login command from commands barrel. |
| source/commands/copilot-login.tsx | Adds Ink UI component for device-flow login + polling. |
| source/commands/copilot-login.spec.tsx | Tests command handler returns CopilotLogin element and props. |
| source/commands/copilot-login-command.tsx | Adds /copilot-login command wiring to render the login UI. |
| source/client-factory.ts | Updates connection validation to require Copilot credential instead of apiKey. |
| source/cli.tsx | Adds nanocoder copilot login CLI path to run device-flow without rendering the full App. |
| source/auth/github-copilot.ts | Implements Copilot OAuth device flow + token acquisition/caching helpers. |
| source/auth/github-copilot.spec.ts | Adds tests for URL generation and token caching behavior. |
| source/ai-sdk-client/providers/provider-factory.ts | Adds provider factory branch for github-copilot with custom fetch and auth headers. |
| source/ai-sdk-client/providers/provider-factory.spec.ts | Adds test ensuring missing Copilot credential throws. |
| scripts/test-copilot.sh | Adds a helper script intended to sanity-check build outputs + credential storage. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
… instead of refresh token; enhance credential storage and testing
|
Hey @yashksaini-coder, nice work on this! The overall structure is solid and follows existing patterns well. I've got some feedback before this is ready to merge: Security stuff:
Naming:
Code duplication:
Robustness:
Tests:
Minor:
Overall the feature design is good - the main blockers are the |
|
Hey @yashksaini-coder, just continuing to test and found a few more issues to address: 1. The
This is an architectural mismatch. The component needs to render as a live component (using 2. The CLI path ( |
…on and clear token cache on credential removal
Description
Adds first-class support for the GitHub Copilot subscription as a model provider in nanocoder. This allows users with Copilot Pro/Pro+/Business subscriptions to use their Copilot allowance via nanocoder, not only the GitHub Models API (which uses token-based billing). The integration includes new authentication (OAuth device flow), token refresh, and a Copilot-compatible provider template. User configuration and provider factory now support Copilot as a subscription-backed OpenAI-compatible provider.
Type of Change
Testing
Automated Tests
.spec.ts/tsxfilespnpm test:allcompletes successfully)Manual Testing
Checklist
Summary of main changes
sdkProvider: 'github-copilot'@will-lamerton Hi I've add copilot integration support to the best of my ability, would like to see if it passes the integration support layer properly for nanocoder, tests have also been add, This is first time working on such a change,