mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-10-20 09:09:35 +02:00
- Drop GH_TOKEN / GITHUB_TOKEN from env.allowedKeys. The allowlist is one global list with no mode context, so they were settable on every session. COPILOT_GITHUB_TOKEN is already admitted by the COPILOT_ prefix. - Declare capabilities.mcpConfig (copilot-json, COPILOT_HOME relocation) so Settings does not list Copilot as unsupported while the sync-only target also lists it. The sync-only row is skipped while the run mode is enabled. - Require a leading alphanumeric on the resume id (path-segment in the registry, matching regex in the schema): --resume's value is optional, so `--resume --yolo` made --yolo its own flag and bypassed the allowAll clamp. Golden cases added; "ids only" wording corrected. - Remove the unread overlays.credStore line and document signing in inside a Docker container. - Add the zh-CN "Run GitHub Copilot" string, pin the new declarations in tests and update the MCP registry expectations.
47 lines
2.0 KiB
TypeScript
47 lines
2.0 KiB
TypeScript
import { describe, it, expect } from 'vitest';
|
|
import { STOCK_CLIS } from '../src/config/cli-registry/stock.js';
|
|
|
|
const copilot = STOCK_CLIS.find((c) => (c.id as string) === 'copilot')!;
|
|
|
|
describe('GitHub Copilot custom endpoint (BYOK)', () => {
|
|
it('injects its COPILOT_PROVIDER_* variables, with the /v1 suffix an OpenAI route needs', () => {
|
|
expect(copilot.capabilities.customModelInjection).toEqual({
|
|
kind: 'env',
|
|
baseUrlVar: 'COPILOT_PROVIDER_BASE_URL',
|
|
apiKeyVar: 'COPILOT_PROVIDER_API_KEY',
|
|
modelVars: ['COPILOT_MODEL'],
|
|
appendV1Suffix: true,
|
|
});
|
|
});
|
|
|
|
it('keeps every injected variable privileged, so a non-granted owner cannot set them by hand', () => {
|
|
const injection = copilot.capabilities.customModelInjection;
|
|
if (injection.kind !== 'env') throw new Error('expected env injection');
|
|
for (const name of [injection.baseUrlVar, injection.apiKeyVar, ...injection.modelVars]) {
|
|
expect(copilot.capabilities.privilegedEnvKeys).toContain(name);
|
|
expect(name.startsWith('COPILOT_')).toBe(true); // reachable through the prefix allowlist
|
|
}
|
|
});
|
|
});
|
|
|
|
describe('GitHub Copilot environment and sync declarations', () => {
|
|
it('admits only its own COPILOT_ namespace, never the shared GitHub token names', () => {
|
|
// The env allowlist is one global list with no mode context, so a foreign key here would be
|
|
// settable on every session. COPILOT_GITHUB_TOKEN is already reachable through the prefix.
|
|
expect(copilot.env.allowedPrefixes).toEqual(['COPILOT_']);
|
|
expect(copilot.env.allowedKeys).toEqual([]);
|
|
});
|
|
|
|
it('declares its own MCP config so Settings does not list it as unsupported', () => {
|
|
expect(copilot.capabilities.mcpConfig).toEqual({
|
|
path: '.copilot/mcp-config.json',
|
|
format: 'copilot-json',
|
|
relocation: { envVar: 'COPILOT_HOME', path: 'mcp-config.json' },
|
|
});
|
|
});
|
|
|
|
it('seeds no credentials into a Docker case', () => {
|
|
expect(copilot.overlays?.credStore).toBeUndefined();
|
|
});
|
|
});
|