Skip to content

Commit 3eca5cf

Browse files
authored
Merge pull request #417 from rajbos/copilot/convert-prompt-to-md-file
feat: move workflow prompts to .github/prompts/ as VS Code-compatible prompt files
2 parents 2d5c79a + fe5dba7 commit 3eca5cf

File tree

4 files changed

+131
-4
lines changed

4 files changed

+131
-4
lines changed
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
---
2+
mode: 'agent'
3+
description: 'Update src/tokenEstimators.json and src/modelPricing.json with missing models found in GitHub Copilot documentation.'
4+
tools: ['fetch', 'read_file', 'write_file', 'search_files']
5+
---
6+
7+
# Sync Copilot Model Data
8+
9+
Update `src/tokenEstimators.json` and `src/modelPricing.json` with missing models found in GitHub Copilot documentation.
10+
11+
## Requirements
12+
13+
1. Fetch and parse the GitHub Copilot supported models documentation page:
14+
- URL: https://docs.github.com/en/copilot/reference/ai-models/supported-models
15+
- Extract all model names from the "Supported AI models in Copilot" section
16+
- Model names should be normalized (lowercase, hyphens instead of spaces)
17+
2. Compare the extracted models list to:
18+
- `src/tokenEstimators.json` - contains character-to-token ratio estimators
19+
- `src/modelPricing.json` - contains pricing data (cost per million tokens)
20+
3. For each model from the documentation that is missing from either JSON file:
21+
- Add it to the appropriate JSON file(s)
22+
- Use sensible defaults based on existing similar models
23+
24+
> **IMPORTANT**: Only add models that are **explicitly listed** on the documentation page above. Do NOT add models based on your own knowledge of AI models, third-party sources, or speculation about what models might exist. If a model is not present on that specific documentation page, it must not be added.
25+
26+
## Token Estimators (`src/tokenEstimators.json`)
27+
28+
For missing models in tokenEstimators.json:
29+
- Add new entry to the `estimators` object
30+
- Use a default ratio of `0.25` (4 characters per token) unless you can infer from model family:
31+
- GPT-4 models: `0.25`
32+
- GPT-3.5 models: `0.25`
33+
- Claude models: `0.25`
34+
- o1 models: `0.25`
35+
- Format example:
36+
```json
37+
"gpt-4o": 0.25
38+
```
39+
- Maintain alphabetical ordering within model families
40+
- Group related models together (e.g., all gpt-4 variants, all claude variants)
41+
42+
## Model Pricing (`src/modelPricing.json`)
43+
44+
For missing models in modelPricing.json:
45+
- Add new entry to the `pricing` object
46+
- Structure:
47+
```json
48+
"model-name": {
49+
"input": 0.00,
50+
"output": 0.00
51+
}
52+
```
53+
- Where `input` and `output` are cost per million tokens
54+
- Use `0.00` as default (pricing will need manual verification later)
55+
- Add a note to the PR body that pricing needs verification
56+
- Maintain alphabetical ordering within model families
57+
- Group related models together
58+
59+
## Metadata Updates
60+
61+
- **ONLY** update `lastUpdated` field in `src/modelPricing.json` to today's date (YYYY-MM-DD format) **if you added new models to the pricing file**
62+
- If no models were added, do NOT update the `lastUpdated` field
63+
- Do NOT modify the `sources` section unless you have specific pricing data
64+
- Do NOT add models that are not explicitly listed on the documentation page — if a model is not on that page, skip it entirely
65+
66+
## Output Format
67+
68+
1. Make all necessary changes to both JSON files
69+
2. Ensure proper JSON formatting (2-space indentation)
70+
3. Maintain existing structure and patterns
71+
4. If no changes are needed, do nothing
72+
73+
## Constraints
74+
75+
- **Only add models that appear on the GitHub Copilot supported models documentation page** (`https://docs.github.com/en/copilot/reference/ai-models/supported-models`). Do NOT add models from any other source, from your own training knowledge, or that you believe might exist — only what is explicitly listed on that page.
76+
- Only modify `src/tokenEstimators.json` and `src/modelPricing.json`
77+
- Do not open a PR (the workflow will handle that)
78+
- Preserve all existing entries and formatting conventions
79+
- Use consistent spacing and indentation with existing file style
80+
- Models should be normalized (lowercase, hyphens instead of spaces)
81+
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
---
2+
mode: 'agent'
3+
description: 'Scan microsoft/vscode-copilot-chat for model-facing tool identifiers and update src/toolNames.json with any missing entries.'
4+
tools: ['read_file', 'write_file', 'search_files', 'run_in_terminal']
5+
---
6+
7+
# Sync Tool Names from vscode-copilot-chat
8+
9+
Scan `microsoft/vscode-copilot-chat` repo for model-facing tool identifiers, compare them to the existing `src/toolnames.json` in our repo in the `current` folder. Only make changes in our current folder.
10+
11+
## Requirements
12+
13+
1. The `microsoft/vscode-copilot-chat` repository has been checked out and is available in the workspace in the folder `vscode-copilot-chat`. Use the paths provided in the Context Paths section below.
14+
2. In the vscode-copilot-chat repo, treat `src/extension/tools/common/toolNames.ts` as the source of truth for tool IDs.
15+
- Extract tool IDs from:
16+
- `export enum ToolName { ... }` (string literal values)
17+
- `export enum ContributedToolName { ... }` (string literal values)
18+
- Ignore TypeScript keys (enum member names). Only collect the **string values** (the model-facing tool names).
19+
3. In *this* repo, load the existing mapping file `src/toolNames.json`. Treat its top-level keys as the set of already-known tool IDs.
20+
4. Compute `missing = (upstreamToolIds - existingMappingKeys)`.
21+
- Deduplicate.
22+
- Sort ascending (stable, locale-insensitive).
23+
5. For each missing tool ID, generate a default friendly name:
24+
- Replace `_` / `-` / `.` with spaces.
25+
- Split camelCase / PascalCase boundaries into words.
26+
- Uppercase words (Title Case).
27+
- Preserve known acronyms in ALL CAPS: `VSCODE`, `MCP`, `GITHUB`, `API`, `URL`, `JSON`, `HTTP`, `HTTPS`, `CLI`, `UI`, `IO`, `ID`.
28+
- Examples:
29+
- `github_api_tool``GitHub API Tool`
30+
- `copilot_readFile``Copilot Read File`
31+
- `mcp.io.github.git``MCP IO GitHub Git`
32+
- `search_subagent``Search Subagent`
33+
- `run_in_terminal``Run In Terminal`
34+
- `vscode_command``VSCode Command`
35+
6. Inject **only** the missing entries into our existing mapping object in the current repository, using the same style as the mapping (leading comma with space on each line), e.g.:
36+
```
37+
, "some_tool": "Some Tool"
38+
```
39+
7. Inject the missing entries inside the json object, matching the organic grouping of locically related tools if possible (e.g. if there are existing entries with the same prefix, group the new entry with them). If no related entries exist, add the new entry at the end of the file, but before the closing `}`.
40+
8. Also print (as plain text, after the delta or NO_DELTA) the upstream commit SHA used for the scan and the exact file path scanned in upstream, for traceability.
41+
42+
## Constraints
43+
- Only modify our toolNames.json file.
44+
- Do not open a PR.
45+
- Do not include tools in the list that are not model-facing (only those defined in upstream `ToolName` / `ContributedToolName` string values).
46+
- Be resilient to minor refactors (enum order changes, added comments, etc.).

.github/workflows/check-models.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
push:
66
paths:
77
- .github/workflows/check-models.yml
8-
- .github/workflows/prompts/sync-models-prompt.md
8+
- .github/prompts/sync-models.prompt.md
99
- src/tokenEstimators.json
1010
- src/modelPricing.json
1111

@@ -78,7 +78,7 @@ jobs:
7878
COPILOT_GITHUB_TOKEN: ${{ secrets.GH_PAT }}
7979
run: |
8080
# Read the prompt from the file
81-
PROMPT=$(cat .github/workflows/prompts/sync-models-prompt.md)
81+
PROMPT=$(cat .github/prompts/sync-models.prompt.md)
8282
8383
# Get the paths to relevant files
8484
ESTIMATORS_PATH="${GITHUB_WORKSPACE}/src/tokenEstimators.json"

.github/workflows/sync-toolnames.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
push:
88
paths:
99
- .github/workflows/sync-toolnames.yml
10-
- .github/workflows/prompts/sync-toolnames-prompt.md
10+
- .github/prompts/sync-toolnames.prompt.md
1111

1212
permissions:
1313
contents: read
@@ -85,7 +85,7 @@ jobs:
8585
COPILOT_GITHUB_TOKEN: ${{ secrets.GH_PAT }}
8686
run: |
8787
# Read the prompt from the file
88-
PROMPT=$(cat .github/workflows/prompts/sync-toolnames-prompt.md)
88+
PROMPT=$(cat .github/prompts/sync-toolnames.prompt.md)
8989
9090
# Get the path to the vscode-copilot-chat repo
9191
UPSTREAM_PATH="${GITHUB_WORKSPACE}/vscode-copilot-chat"

0 commit comments

Comments
 (0)