Skip to content

refactor: apply code readability guidelines #1270

Closed

Description

Summary

Apply the Code Readability guidelines in AGENTS.md to the existing source. This is a no-behavior-change cleanup: generated docs output, site rendering, and the bun test regression suite must stay identical. Findings are grouped by guideline. Generated regions and CHANGELOG.md were skipped.

No comments above modules or files

  • scripts/generate-provider-docs.mjs:2-29 - file header block (purpose, usage, env vars). Move the usage and env-var facts into AGENTS.md or the Taskfile description, then delete the header.
  • scripts/generate-provider-docs.test.mjs:1-5 - file header describing the regression net.

No inline comments inside function bodies

  • scripts/generate-provider-docs.mjs:277-279 - comment inside injectRegion explaining the duplicate-marker check. Extract the check into a named function (for example assertSingleRegion).
  • scripts/generate-provider-docs.mjs:45-47, 90-92, 173-175, 266-268, 305-307 - section banner comments (// ----- Schema loading ----- and similar). Remove them, or split the script into smaller modules if the grouping matters.
  • scripts/generate-provider-docs.mjs:359 - comment above the import.meta.main guard. The guard is self-explanatory, so delete it.

Doc comments at most 5 lines

  • scripts/generate-provider-docs.mjs:198-203 - the renderAdkProviderTable doc comment is 6 lines.

Named constants over magic numbers and strings

  • scripts/generate-provider-docs.mjs:148, 217, 247 - the auth type 'none' is repeated. Use a named constant (for example AUTH_TYPE_NONE).
  • scripts/generate-provider-docs.mjs:181 - the minimum column width 3 in formatTable. Name it (the markdown separator's minimum dash count).
  • scripts/generate-provider-docs.mjs:51 - name.length + 3 (the length of -- plus =). Name it or slice by the prefix string's length.
  • scripts/generate-provider-docs.mjs:272-273 and scripts/generate-provider-docs.test.mjs:34-35 - the GENERATED:${key} START / END marker format is built in two places. Share one helper or constant.
  • scripts/generate-provider-docs.test.mjs:39 - the start + 2 / end - 1 offsets, which mirror the blank-line padding added in injectRegion. Name the padding.
  • .vitepress/theme/components/QuickStartTerminal.vue:19, 25 - the -1 "nothing copied" sentinel and the 2000 ms reset delay. Use named constants.
  • .vitepress/config.ts:66 - titleTemplate hardcodes Inference Gateway instead of using SITE_NAME.
  • .vitepress/config.ts:111, 373 - the brand color #7c3aed appears in both theme-color and the mermaid primaryBorderColor. Use one named constant.
  • .vitepress/config.ts:130-131 - the OG image size 1200 / 630. Name it next to OG_IMAGE.

No semicolons in documentation prose

  • scripts/generate-provider-docs.mjs:28 - "Requires Bun (for Bun.YAML.parse); no packages to install." (goes away with the file header).
  • Markdown pages - these files have lines matching [a-z)\]; [a-zA-Z`], which flags semicolon-joined sentences (some hits are inside code blocks and are fine): cli.md(120),typescript-adk.md(94),sdks.md(62),adk.md(43),api-reference.md(40),rust-adk.md(39),adl-cli.md(27),github-action.md(22),desktop.md(20),configuration.md(16),cli-speech-to-text.md(14),operator.md(14),cli-skills.md(12),cli-text-to-video.md(12),authentication.md(11),opentask.md(11),observability.md(9),cli-judge-mode.md(8),mcp.md(8),troubleshooting.md(7),browser-agent.md(6),n8n-agent.md(6),mock-agent.md(5),cli-hooks.md(4),documentation-agent.md(4),grafana-agent.md(4),a2a.md(3),cli-channels.md(3),cli-text-to-speech.md(3), plus 1-2 lines each ina2a-debugger.md, adl.md, architecture-overview.md, cli-scheduling.md, model-routing.md, registry.md, skills.md, supported-providers.md. Reproduce with git grep -n -E "[a-z)`]; [a-zA-Z`]" -- ".md" ":!CHANGELOG.md". Text inside GENERATED:regions must be fixed inscripts/provider-overrides.json` or the generator, not by hand.

Other

  • .vitepress/config.ts:78 - srcExclude still lists CLAUDE.md, but the repository has no CLAUDE.md (agent instructions live only in AGENTS.md). Drop the entry.
  • .vitepress/theme/components/FlowDiagram.vue:241, 352 - CSS comments explaining layout. Keep them only if a class name cannot carry the intent.

Not checked

  • The repository has no examples/ directory. The code snippets in the docs pages were not run against the tokenless mock gateway in this audit, so a separate pass should check that every snippet runs as written.

Acceptance Criteria

  • Every finding above is fixed or explicitly kept with a reason
  • bun test, bun run lint:md, bun run format:check, and bun run build pass
  • Generated docs output and rendered pages are unchanged (no behavior change)

Activity

  1. edenreich commented on Nov 17, 2026

    @edenreich
    Contributor

    @claude can you work on this? use /ponytail:ponytail

  2. inference-gateway-maintainer commented on Nov 17, 2026

    @inference-gateway-maintainer
    ContributorAuthor

    Claude finished @edenreich's task in 3m 56s —— View job • refactor/issue-1270-20261117-2100 • [Create PR ➔](https://github.com/inference-gateway/docs/compare/main...refactor/issue-1270-20261117-2100?quick_pull=1&title=Issue%20%231270%3A%20Changes%20from%20Claude&body=This%20PR%20addresses%20issue%20%231270%0A%0AGenerated%20with%20%5BClaude%20Code%5D(https%3A%2F%2Fclaude.ai%2Fcode)


    Applied the code readability guidelines - PR #1271

    • Gather context
    • Generator script + test cleanup
    • .vitepress config + components
    • Markdown semicolons
    • Validate: bun test, lint:md, format:check, build all pass
    • Commit + open PR (refactor: apply code readability guidelines #1271, board status set to QA)

    Generator: removed the file headers, section banners, and guard comment. The schema env vars are now documented in AGENTS.md. The duplicate-marker check is now its own function, assertSingleRegion. The renderAdkProviderTable doc comment is down to 4 lines. Magic values are now named constants: AUTH_TYPE_NONE, MIN_SEPARATOR_DASHES and REGION_PADDING. argValue slices by the prefix length. The generator and the test now share one startMarker/endMarker helper. bun test still compares every generated region byte-for-byte, so generated output is unchanged.

    Site: titleTemplate and author now use SITE_NAME. New constants: BRAND_COLOR, OG_IMAGE_WIDTH/OG_IMAGE_HEIGHT, and in QuickStartTerminal.vue the copy-state sentinel and the reset delay. Dropped CLAUDE.md from srcExclude.

    Kept with reason: the two CSS comments in FlowDiagram.vue. They explain layout choices that a class name can't carry.

    Markdown: split every semicolon-joined sentence in prose (outside code, inline code and GENERATED:* regions) into two sentences. A semicolon inside parentheses became - instead, since a period there would break the parenthetical. The git grep hits that remain are all inside YAML/shell code comments or a literal CLI output string. This was a scripted pass over about 570 lines, and I only spot-checked it, so it's worth skimming the diff for awkward capitalisation, for example an identifier without backticks starting a sentence.

    Not done: running the doc snippets against the tokenless mock gateway. The issue scopes that as a separate pass.
    · Branch

  3. moved this from Todo to In progress in 2026on Nov 17, 2026
  4. moved this from In progress to QA in 2026on Nov 17, 2026
  5. moved this from QA to Done in 2026on Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    refactor

    Type

    No type

    Projects

    • Status
      Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions