Skip to content

feat(docs-sync): render the skill token table from measured_tokens stamps - #203

Merged
potiuk merged 1 commit into
apache:mainfrom
potiuk:feat/mode-economics-token-table
Sep 26, 2026
Merged

potiuk merged 1 commit into
apache:mainfrom
potiuk:feat/mode-economics-token-table

Conversation

@potiuk

@potiuk potiuk commented Sep 26, 2026

Copy link
Copy Markdown
Member

Summary

apache/magpie#1394 stopped committing the per-skill token table in docs/mode-economics.md. That table's shared header lines changed on every regeneration, so any two skill PRs conflicted. Each skill now carries its own count as a generated measured_tokens: frontmatter line, and the page carries a marker instead of the table. Without this PR the website's mode-economics page shows no table at all.

  • New scripts/gen-skill-tokens.mjs reads each skill's measured_tokens: stamp and replaces the <!-- SKILL TOKEN TABLE … --> marker with the rendered table. No tokenizer runs on the site: the numbers are the stamps apache/magpie's skill-token-count --check already verified in CI.
  • sync-docs.sh runs it after the docs are copied and before the link rewrite, so the table's ../skills/<name>/SKILL.md links are rewritten to GitHub exactly like the old committed table's were.
  • A page without the marker (an older framework checkout) is left as synced. An unstamped skill is warned about and skipped rather than failing the build.

Test plan

  • node --test scripts/gen-skill-tokens.test.mjs — 9 tests:
    • reads the stamp from frontmatter only
    • rejects a missing or malformed stamp
    • renders thousands separators and framework-relative links
    • matches the exact marker apache/magpie ships
    • fills only the marker
    • leaves a marker-less page untouched
    • inserts $-patterns literally
    • collects rows in order and reports unstamped skills
  • End to end: bash scripts/sync-docs.sh against apache/magpie main (with #1394) rendered all 75 counts into src/content/docs/mode-economics.md, the marker is gone, and rows link to https://github.com/apache/magpie/blob/main/skills/<name>/SKILL.md.
  • prek passes on the changed files.

🤖 Generated with Claude Code

…amps

apache/magpie#1394 moved each skill's token count into its own
measured_tokens frontmatter stamp and replaced the committed table in
docs/mode-economics.md with a marker. Render the table from the stamps
during sync-docs, before the link rewrite, so the page keeps its table
and the rows link to GitHub as before.

Generated-by: Claude Opus 5
@potiuk
potiuk merged commit 08724c3 into apache:main Sep 26, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant