Skip to content

docs: generate model alias & multiplier reference tables from JSON data#30256

Merged
pelikhan merged 7 commits intomainfrom
copilot/add-docs-build-script-tables
May 5, 2026
Merged

docs: generate model alias & multiplier reference tables from JSON data#30256
pelikhan merged 7 commits intomainfrom
copilot/add-docs-build-script-tables

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 5, 2026

Adds a documentation build script that reads the built-in model alias map and per-model Effective Token multipliers from JSON and renders them as readable reference tables in a new docs page.

New files

  • pkg/workflow/data/model_aliases.json — single source of truth for the built-in model alias map, embedded in Go via //go:embed and read by the docs generation script
  • scripts/generate-model-tables.js — reads model_aliases.json + model_multipliers.json, emits docs/src/content/docs/reference/model-tables.md with:
    • Vendor aliases table (alias → ordered glob patterns)
    • Meta-aliases table (recursive expansion chain)
    • Token class weights table
    • Per-model multipliers split by provider (Anthropic / OpenAI / OpenAI Reasoning / Google)
    • > [!CAUTION] callout that multiplier values are approximations, may be inaccurate, and may be out of date
  • docs/src/content/docs/reference/model-tables.md — generated output, checked in and regenerated each build

Changes to existing files

  • pkg/workflow/model_aliases.go — replaced the hardcoded map[string][]string literal in BuiltinModelAliases() with a //go:embed data/model_aliases.json directive and json.Unmarshal call; the alias data now lives only in the JSON file
  • scripts/generate-model-tables.js — added readJSON() helper with try/catch + process.exit(1) for clear CI diagnostics on missing or malformed JSON files; fixed "normalising" → "normalizing" spelling
  • .github/workflows/daily-model-inventory.md — updated all references from pkg/workflow/model_aliases.go to pkg/workflow/data/model_aliases.json; the Step 5 alias proposal format now uses a JSON snippet targeting the canonical file; recompiled lock file

Wiring

  • docs/package.json — adds generate-model-tables script, runs it in prebuild alongside generate-agent-factory
  • docs/astro.config.mjs — adds Cost Management (Model Tables) sidebar entry under /reference/model-tables/

@pelikhan pelikhan marked this pull request as ready for review May 5, 2026 02:31
Copilot AI review requested due to automatic review settings May 5, 2026 02:31
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a docs-generation pipeline for publishing the built-in model alias map and Effective Token (ET) multiplier reference tables as a checked-in docs page.

Changes:

  • Introduces a Node.js generator (scripts/generate-model-tables.js) that reads JSON data and emits docs/src/content/docs/reference/model-tables.md.
  • Adds pkg/cli/data/model_aliases.json as a JSON representation of the built-in alias map for doc tooling consumption.
  • Wires the docs build to regenerate the page on prebuild and adds a new sidebar entry for the page.
Show a summary per file
File Description
scripts/generate-model-tables.js New generator script that reads alias/multiplier JSON and renders markdown tables.
pkg/cli/data/model_aliases.json New JSON source for built-in model aliases to drive docs generation.
docs/src/content/docs/reference/model-tables.md Generated documentation page containing alias + multiplier reference tables.
docs/package.json Runs model table generation during docs prebuild and adds a script entry.
docs/astro.config.mjs Adds sidebar navigation entry for the new reference page.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comments suppressed due to low confidence (1)

scripts/generate-model-tables.js:62

  • The generated markdown ordering depends on object insertion order in the JSON files. To keep model-tables.md diffs stable across regenerations, consider sorting aliases and multiplier rows (e.g., by alias/model name) before emitting tables.
function classifyAliases(aliasMap) {
  const vendor = [];
  const meta = [];
  for (const [alias, patterns] of Object.entries(aliasMap)) {
    const isMetaOnly = patterns.every((p) => !p.includes("/"));
    if (isMetaOnly) {
      meta.push({ alias, resolves: patterns });
    } else {
      vendor.push({ alias, patterns });
    }
  }
  return { vendor, meta };
}
  • Files reviewed: 5/5 changed files
  • Comments generated: 4

Comment thread scripts/generate-model-tables.js Outdated
Comment on lines +34 to +36
const aliasesData = JSON.parse(fs.readFileSync(ALIASES_PATH, "utf-8"));
const multipliersData = JSON.parse(fs.readFileSync(MULTIPLIERS_PATH, "utf-8"));

Comment thread scripts/generate-model-tables.js Outdated
// Approximation callout
lines.push("> [!CAUTION]");
lines.push(
"> The multiplier values shown on this page are **approximations**. They are used solely for the purpose of normalising token usage across models into a single comparable metric (Effective Tokens) and do **not** represent precise cost ratios. Values may be inaccurate for specific model versions and may become out of date as providers update their offerings. Do not use these numbers for billing or financial calculations."
Comment thread pkg/cli/data/model_aliases.json Outdated
Comment on lines +1 to +8
{
"version": "1",
"description": "Built-in model alias map for GitHub Agentic Workflows. Each key is an alias name; the value is an ordered list of model patterns tried in sequence until one resolves.",
"aliases": {
"sonnet": [
"copilot/*sonnet*",
"anthropic/*sonnet*"
],
Comment thread docs/package.json
Comment on lines +8 to 16
"prebuild": "npm run generate-agent-factory && npm run generate-model-tables && npm run build:slides",
"build": "astro build",
"build:slides": "mkdir -p public/js && cp node_modules/mermaid/dist/mermaid.min.js public/js/ && npx @marp-team/marp-cli slides/index.md --html --allow-local-files --theme slides/gh-aw-theme.css -o public/slides/index.html && mkdir -p public/slides && cp slides/*.pdf public/slides/",
"preview": "astro preview",
"astro": "astro",
"validate-links": "astro build",
"generate-agent-factory": "cd .. && node scripts/generate-agent-factory.js",
"generate-model-tables": "cd .. && node scripts/generate-model-tables.js",
"test": "playwright test",
@pelikhan
Copy link
Copy Markdown
Collaborator

pelikhan commented May 5, 2026

@copilot remove the duplication in pkg/workflow/model_aliases.go. Convert that file to json, embed in go and read from JavaScript

Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 5, 2026

@copilot remove the duplication in pkg/workflow/model_aliases.go. Convert that file to json, embed in go and read from JavaScript

Done in commit d46fabe. pkg/workflow/model_aliases.go no longer hardcodes the alias map — it embeds pkg/workflow/data/model_aliases.json via //go:embed and parses it at startup. The docs generation script now reads from that same canonical file, so there's only one source of truth. pkg/cli/data/model_aliases.json has been removed.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/repos/actions/github-script/git/ref/tags/v9
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v9 --jq [.object.sha, .object.type] | @tsv (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI requested a review from pelikhan May 5, 2026 03:12
@pelikhan
Copy link
Copy Markdown
Collaborator

pelikhan commented May 5, 2026

@copilot update daily model alias updater agentic workflow work new file location

…odel_aliases.json

Agent-Logs-Url: https://github.com/github/gh-aw/sessions/16c63ed4-91e0-4d2d-a95b-62a4266f7d9b

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 5, 2026

@copilot update daily model alias updater agentic workflow work new file location

Done in commit 44e20ed. Updated all references in .github/workflows/daily-model-inventory.md:

  • The allowed bash tool "cat pkg/workflow/model_aliases.go""cat pkg/workflow/data/model_aliases.json"
  • All prose references to the Go source file now point to pkg/workflow/data/model_aliases.json
  • Step 5 now asks the agent to produce a JSON snippet (instead of YAML) for the aliases object in that file

The lock file has been recompiled.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/repos/actions/github-script/git/ref/tags/v9
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v9 --jq [.object.sha, .object.type] | @tsv (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title docs: generate model alias & multiplier reference tables from JSON data docs: generate model alias &amp; multiplier reference tables from JSON data May 5, 2026
@pelikhan
Copy link
Copy Markdown
Collaborator

pelikhan commented May 5, 2026

@copilot merge main and recompile

Copilot AI and others added 2 commits May 5, 2026 04:44
…d-script-tables

# Conflicts:
#	.github/workflows/daily-model-inventory.lock.yml

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 5, 2026

@copilot merge main and recompile

Done in commit e75a689. Merged main, resolved a repoConfigLog redeclaration conflict in compiler_repo_config.go (renamed to compilerRepoConfigLog), rebuilt the binary, and recompiled all 213 workflows successfully.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/graphql
    • Triggering command: /usr/bin/gh /usr/bin/gh api graphql -f query=query($owner: String!, $name: String!) { repository(owner: $owner, name: $name) { hasDiscussionsEnabled } } -f owner=github -f name=gh-aw (http block)
    • Triggering command: /usr/bin/gh /usr/bin/gh api graphql -f query=query($owner: String!, $name: String!) { repository(owner: $owner, name: $name) { hasDiscussionsEnabled } } -f owner=github -f name=gh-aw util (http block)
  • https://api.github.com/repos/actions/checkout/git/ref/tags/v6
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v6 --jq [.object.sha, .object.type] | @tsv (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v6 --jq [.object.sha, .object.type] | @tsv get --local me: String!) { repository(owner: $owner, name: $name) { hasDiscussionsEnabled } } gpg.program (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v6 --jq [.object.sha, .object.type] | @tsv get --local me: String!) { repository(owner: $owner, name: $name) { hasDiscussionsEnabled } } commit.gpgsign (http block)
  • https://api.github.com/repos/actions/download-artifact/git/ref/tags/v8
    • Triggering command: /usr/bin/gh gh api /repos/actions/download-artifact/git/ref/tags/v8 --jq [.object.sha, .object.type] | @tsv (http block)
  • https://api.github.com/repos/actions/github-script/git/ref/tags/v9
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v9 --jq [.object.sha, .object.type] | @tsv -c=4 -nolocalimports -importcfg /tmp/go-build2924313925/b345/importcfg -embedcfg /tmp/go-build2924313925/b345/embedcfg -pack (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v9 --jq [.object.sha, .object.type] | @tsv (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v9 --jq [.object.sha, .object.type] | @tsv pkg/actionpins/data/action_pins.json; \ cp .github/aw/actions-lock.json pkg/workflow/data/action_pins.json; \ echo &#34;��� Action pins synced successfully&#34;; \ else \ echo &#34;��� (http block)
  • https://api.github.com/repos/actions/setup-node/git/ref/tags/v6
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-node/git/ref/tags/v6 --jq [.object.sha, .object.type] | @tsv (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-node/git/ref/tags/v6 --jq [.object.sha, .object.type] | @tsv /ref/tags/v9 --local sv commit.gpgsign (http block)
  • https://api.github.com/repos/astral-sh/setup-uv/git/ref/tags/eac588ad8def6316056a12d4907a9d4d84ff7a3b
    • Triggering command: /usr/bin/gh gh api /repos/astral-sh/setup-uv/git/ref/tags/eac588ad8def6316056a12d4907a9d4d84ff7a3b --jq [.object.sha, .object.type] | @tsv (http block)
  • https://api.github.com/repos/docker/metadata-action/git/ref/tags/v6
    • Triggering command: /usr/bin/gh gh api /repos/docker/metadata-action/git/ref/tags/v6 --jq [.object.sha, .object.type] | @tsv (http block)
  • https://api.github.com/repos/docker/setup-buildx-action/git/ref/tags/v4
    • Triggering command: /usr/bin/gh gh api /repos/docker/setup-buildx-action/git/ref/tags/v4 --jq [.object.sha, .object.type] | @tsv (http block)
  • https://api.github.com/repos/github/gh-aw
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw --jq .default_branch get --local iptables copilot.originalgit (http block)

If you need me to access, download, or install something from one of these locations, you can either:

@pelikhan
Copy link
Copy Markdown
Collaborator

pelikhan commented May 5, 2026

@copilot merge main, fix conflicts, recompile

…d-script-tables

# Conflicts:
#	pkg/workflow/compiler_repo_config.go

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 5, 2026

@copilot merge main, fix conflicts, recompile

Done in commit f825bfb. Merged main, resolved the compiler_repo_config.go conflict by accepting main's fix (removing the duplicate local logger declaration and reusing the package-level repoConfigLog). Build clean, all 213 workflows recompiled successfully.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/graphql
    • Triggering command: /usr/bin/gh /usr/bin/gh api graphql -f query=query($owner: String!, $name: String!) { repository(owner: $owner, name: $name) { hasDiscussionsEnabled } } -f owner=github -f name=gh-aw (http block)
    • Triggering command: /usr/bin/gh /usr/bin/gh api graphql -f query=query($owner: String!, $name: String!) { repository(owner: $owner, name: $name) { hasDiscussionsEnabled } } -f owner=github -f name=gh-aw jMWPDURmM_pf (http block)
    • Triggering command: /usr/bin/gh /usr/bin/gh api graphql -f query=query($owner: String!, $name: String!) { repository(owner: $owner, name: $name) { hasDiscussionsEnabled } } -f owner=github -f name=gh-aw g2vQBge/NGMvY-1D-1 (http block)
  • https://api.github.com/repos/actions/checkout/git/ref/tags/v6
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v6 --jq [.object.sha, .object.type] | @tsv (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v6 --jq [.object.sha, .object.type] | @tsv get --local me: String!) { repository(owner: $owner, name: $name) { hasDiscussionsEnabled } } user.email (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v6 --jq [.object.sha, .object.type] | @tsv get --local repository(owner: $owner, name:-f committer.name (http block)
  • https://api.github.com/repos/actions/download-artifact/git/ref/tags/v8
    • Triggering command: /usr/bin/gh gh api /repos/actions/download-artifact/git/ref/tags/v8 --jq [.object.sha, .object.type] | @tsv (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/download-artifact/git/ref/tags/v8 --jq [.object.sha, .object.type] | @tsv json r r: $owner, name: $name) { hasDiscussionsEnabled } } (http block)
  • https://api.github.com/repos/actions/github-script/git/ref/tags/v9
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v9 --jq [.object.sha, .object.type] | @tsv (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v9 --jq [.object.sha, .object.type] | @tsv pkg/actionpins/data/action_pins.json; \ cp .github/aw/actions-lock.json pkg/workflow/data/action_pins.json; \ echo &#34;��� Action pins synced successfully&#34;; \ else \ echo &#34;��� (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v9 --jq [.object.sha, .object.type] | @tsv s/data/action_pins.json and pkg/workflow/data/action_pins.json...&#34; (http block)
  • https://api.github.com/repos/actions/setup-node/git/ref/tags/v6
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-node/git/ref/tags/v6 --jq [.object.sha, .object.type] | @tsv (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-node/git/ref/tags/v6 --jq [.object.sha, .object.type] | @tsv /ref/tags/v9 --local sv user.email (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-node/git/ref/tags/v6 --jq [.object.sha, .object.type] | @tsv ithub/workflows --local l copilot.originalinfocmp (http block)
  • https://api.github.com/repos/astral-sh/setup-uv/git/ref/tags/eac588ad8def6316056a12d4907a9d4d84ff7a3b
    • Triggering command: /usr/bin/gh gh api /repos/astral-sh/setup-uv/git/ref/tags/eac588ad8def6316056a12d4907a9d4d84ff7a3b --jq [.object.sha, .object.type] | @tsv (http block)
    • Triggering command: /usr/bin/gh gh api /repos/astral-sh/setup-uv/git/ref/tags/eac588ad8def6316056a12d4907a9d4d84ff7a3b --jq [.object.sha, .object.type] | @tsv k/gh-aw/gh-aw (http block)
    • Triggering command: /usr/bin/gh gh api /repos/astral-sh/setup-uv/git/ref/tags/eac588ad8def6316056a12d4907a9d4d84ff7a3b --jq [.object.sha, .object.type] | @tsv /ref/tags/v9 (http block)
  • https://api.github.com/repos/docker/metadata-action/git/ref/tags/v6
    • Triggering command: /usr/bin/gh gh api /repos/docker/metadata-action/git/ref/tags/v6 --jq [.object.sha, .object.type] | @tsv (http block)
  • https://api.github.com/repos/docker/setup-buildx-action/git/ref/tags/v4
    • Triggering command: /usr/bin/gh gh api /repos/docker/setup-buildx-action/git/ref/tags/v4 --jq [.object.sha, .object.type] | @tsv (http block)
  • https://api.github.com/repos/github/gh-aw
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw --jq .default_branch get --local lock.yml commit.gpgsign (http block)

If you need me to access, download, or install something from one of these locations, you can either:

@pelikhan pelikhan merged commit f67a584 into main May 5, 2026
@pelikhan pelikhan deleted the copilot/add-docs-build-script-tables branch May 5, 2026 05:08
github-actions Bot added a commit that referenced this pull request May 5, 2026
- Add Model Alias entry (from new model-tables reference, PR #30256)
- Update Observability entry with gh-aw.detection.conclusion and
  gh-aw.detection.reason span attributes (from PR #30273)
- Fix broken link: parameterising → parameterizing (from PR #30265)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants