fix: add missing formatItem and program imports in cli.test.ts#1266
fix: add missing formatItem and program imports in cli.test.ts#1266
Conversation
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Adds GitHub Copilot enterprise (GHEC/GHES) routing support to the api-proxy sidecar, expands CLI warnings around Copilot API targets, and documents enterprise setup.
Changes:
- Auto-derive Copilot upstream target in
api-proxyfromGITHUB_SERVER_URL(with explicit override viaCOPILOT_API_TARGET). - Extend CLI API-target allowlist warnings to include Copilot and add corresponding unit tests.
- Add enterprise configuration documentation and link it from the README.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/docker-manager.test.ts | Adds coverage for passing COPILOT_API_TARGET into the api-proxy compose env. |
| src/cli.ts | Introduces DEFAULT_COPILOT_API_TARGET and includes Copilot in API-target allowlist warnings. |
| src/cli.test.ts | Tests default Copilot target constant + new warning behaviors. |
| README.md | Links to the new enterprise configuration guide. |
| docs/enterprise-configuration.md | New guide for GHEC/GHES configuration, allowlists, and troubleshooting. |
| containers/api-proxy/server.test.js | Unit tests for Copilot target derivation behavior. |
| containers/api-proxy/server.js | Implements GHEC/GHES Copilot target derivation and exports it for tests. |
| containers/api-proxy/logging.js | Clarifies logging sanitization behavior in comments. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const copilotTargetWarning = validateApiTargetInAllowedDomains( | ||
| config.copilotApiTarget ?? DEFAULT_COPILOT_API_TARGET, | ||
| DEFAULT_COPILOT_API_TARGET, | ||
| '--copilot-api-target', | ||
| allowedDomains | ||
| ); |
| sudo -E awf \ | ||
| --allow-domains ${{ github.server_url_hostname }},api.${{ github.server_url_hostname }},raw.githubusercontent.com \ | ||
| --enable-api-proxy \ | ||
| -- npx @github/copilot@latest --prompt "generate tests" | ||
| ``` | ||
|
|
||
| **Note:** Use `${{ github.server_url_hostname }}` to dynamically get your GHEC hostname (e.g., `acme.ghe.com`). |
| # View the derived endpoint in startup logs | ||
| docker logs awf-api-proxy | grep "Copilot proxy" | ||
|
|
||
| # Expected for GHEC: | ||
| # Copilot proxy listening on port 10002 (target: api.acme.ghe.com) | ||
|
|
||
| # Expected for GHES: | ||
| # Copilot proxy listening on port 10002 (target: api.enterprise.githubcopilot.com) |
| // Check if this is a GHEC tenant (*.ghe.com) | ||
| if (hostname.endsWith('.ghe.com')) { | ||
| // Extract subdomain: mycompany.ghe.com → mycompany | ||
| const subdomain = hostname.slice(0, -8); // Remove '.ghe.com' |
🏗️ Build Test Suite Results
Overall: 7/8 ecosystems passed — ❌ FAIL ❌ Failure DetailsJava (gson, caffeine) — Both projects failed at The
|
src/cli.test.tsfailed to compile because tests forformatItemandprogram(added in a recent commit) referenced those names without importing them — both are exported fromsrc/cli.tsbut were omitted from the import statement.Change
Added
formatItemandprogramto the existing import from./cli:This restores
cli.test.tsfrom a compile-time suite failure (0 tests run) to fully passing (219 tests).Original prompt
📍 Connect Copilot coding agent with Jira, Azure Boards or Linear to delegate work to Copilot in one click without leaving your project management tool.