Skip to content

keep GitHub language stats focused on TypeScript#389

Merged
ndycode merged 2 commits intomainfrom
feat/typescript-language-bar
Apr 10, 2026
Merged

keep GitHub language stats focused on TypeScript#389
ndycode merged 2 commits intomainfrom
feat/typescript-language-bar

Conversation

@ndycode
Copy link
Copy Markdown
Owner

@ndycode ndycode commented Apr 10, 2026

Summary

  • keep GitHub Linguist stats focused on authored TypeScript instead of auxiliary script formats

What Changed

  • added .gitattributes rules that keep *.ts detectable while marking *.js, *.mjs, *.sh, and *.html as non-detectable for repo language stats
  • added a test/documentation.test.ts assertion so the Linguist override contract stays explicit in repo governance coverage

Validation

  • npm run lint
  • npm run typecheck
  • npm test
  • npm test -- test/documentation.test.ts
  • npm run build

Docs and Governance Checklist

  • README updated (if user-visible behavior changed)
  • docs/getting-started.md updated (if onboarding flow changed)
  • docs/features.md updated (if capability surface changed)
  • relevant docs/reference/* pages updated (if commands/settings/paths changed)
  • docs/upgrade.md updated (if migration behavior changed)
  • SECURITY.md and CONTRIBUTING.md reviewed for alignment

Risk and Rollback

  • Risk level: low; metadata-only Linguist override plus governance coverage
  • Rollback plan: revert d7ff9c7

Additional Notes

  • gh api repos/ndycode/codex-multi-auth/languages currently reports TypeScript, JavaScript, HTML, and Shell; this change is intended to stop the non-TypeScript helper files from counting toward the repo language bar after merge
  • full npm test is still red on inherited test/proactive-refresh.test.ts timeouts (does not log when all accounts return no_refresh_token, refreshes multiple accounts in parallel, handles mixed success and failure results); the same three failures reproduce on a clean detached origin/main worktree

note: greptile review for oc-chatgpt-multi-auth. cite files like lib/foo.ts:123. confirm regression tests + windows concurrency/token redaction coverage.

Greptile Summary

adds .gitattributes linguist overrides to exclude .js, .mjs, .sh, and .html files from github language stats, and locks the contract in test/documentation.test.ts with an exact-match governance assertion.

the implementation is clean and the test handles windows \ \ line endings correctly via split(/\ ?\ /).

Confidence Score: 5/5

safe to merge — metadata-only change with a single P2 observation about vendor .d.ts over-inclusion that doesn't affect correctness

both changed files are clean: the .gitattributes achieves the stated goal and the governance test is correctly implemented with proper windows line-ending handling. the only finding is a P2 style note about vendor .d.ts files being force-included, which doesn't break anything.

.gitattributes — the *.ts linguist-detectable glob catches vendor declaration files; worth a follow-up if accurate attribution matters

Important Files Changed

Filename Overview
.gitattributes new file that sets linguist-detectable overrides; *.ts linguist-detectable will also force-include vendor/*.d.ts declaration files which linguist would normally exclude as vendor code
test/documentation.test.ts adds governance test that reads and normalizes .gitattributes, asserting exact ordered content; handles windows line endings; correctly uses the existing read() helper scoped to projectRoot

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[GitHub Linguist scans repo] --> B{File extension?}
    B -->|*.ts| C[linguist-detectable = true\nall .ts files counted\nincl. vendor/*.d.ts + test/*.ts]
    B -->|*.js / *.mjs| D[-linguist-detectable\nexcluded from stats]
    B -->|*.sh| E[-linguist-detectable\nexcluded from stats]
    B -->|*.html| F[-linguist-detectable\nexcluded from stats]
    C --> G[Language bar: TypeScript only]
    D --> G
    E --> G
    F --> G
Loading

Fix All in Codex

Prompt To Fix All With AI
This is a comment left during a code review.
Path: .gitattributes
Line: 2

Comment:
**`*.ts linguist-detectable` will include vendored declaration files**

the pattern catches every `.ts` file in the repo, including the three vendored declaration files under `vendor/codex-ai-plugin/dist/` and `vendor/codex-ai-sdk/dist/`. linguist would normally exclude `vendor/` paths from language stats; the explicit `linguist-detectable` override re-admits them. they still count as TypeScript so the bar stays correct, but it contradicts the header comment "authored TypeScript sources." if you want vendored declarations excluded, add:

```
vendor/**/*.ts linguist-vendored
```

below the `*.ts` rule — later rules take precedence and will re-exclude those paths.

How can I resolve this? If you propose a fix, please make it concise.

Reviews (2): Last reviewed commit: "Tighten the linguist override regression..." | Re-trigger Greptile

The runtime wrappers and maintenance scripts stay in JavaScript, but GitHub's
repository language bar should reflect the authored product source instead of
auxiliary script formats. This adds Linguist detectability overrides in
`.gitattributes` and locks them in the documentation governance suite.

Constraint: Wrapper and maintenance scripts must remain directly executable without build pipeline changes
Rejected: Convert scripts and wrappers to TypeScript | would widen runtime and packaging scope beyond a metadata-only change
Confidence: high
Scope-risk: narrow
Directive: If a non-TypeScript repo artifact should count toward the language bar later, update `.gitattributes` and `test/documentation.test.ts` together
Tested: `git check-attr linguist-detectable -- index.ts scripts/codex.js scripts/check-pack-budget.mjs scripts/test-all-models.sh lib/oauth-success.html`; `npm test -- test/documentation.test.ts`; `npm run lint`; `npm run typecheck`; `npm run build`
Not-tested: Full `npm test` remains red on inherited `test/proactive-refresh.test.ts` timeouts reproduced on clean `origin/main`
@chatgpt-codex-connector
Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 10, 2026

📝 Walkthrough

Walkthrough

adds a .gitattributes file to configure github linguist, marking typescript files as detectable while excluding javascript, shell, and html files from language statistics. includes a test to validate the file's presence and content.

Changes

Cohort / File(s) Summary
Linguist Configuration
.gitattributes, test/documentation.test.ts
adds linguist detection rules via .gitattributes to bias repo language stats toward typescript. test validates file existence and substring patterns at test/documentation.test.ts:line ~N using vitest assertions.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes


Notes for review

the test at test/documentation.test.ts validates only substring presence, not actual linguist behavior or statistical impact on github. consider whether you need regression tests that confirm linguist actually respects the overrides (e.g., by checking github api or simulating linguist locally).

.gitattributes itself is platform-agnostic, but flag: are there any windows-specific line ending concerns with this file's deployment? typically git handles it, but worth confirming in your ci pipeline if you have mixed-os contributors.

no concurrency or logic risks here. straightforward configuration addition.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed title follows conventional commits format with lowercase type prefix and imperative summary under 72 chars, clearly describing the main change.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description check ✅ Passed PR description follows the template structure with all required sections completed: summary explains the goal, what changed details both files, validation checkboxes show test status, governance checklist present, risk/rollback clearly stated, and additional notes provided.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/typescript-language-bar
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch feat/typescript-language-bar

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@test/documentation.test.ts`:
- Around line 620-624: The test currently uses substring assertions on the
generated .gitattributes content (variable content) which allows contradictory
rules to coexist; update test/documentation.test.ts to assert the exact override
contract by either (1) asserting full-line matches for each glob using regex
with multiline anchors (e.g., expect(content).toMatch(/^\*\.ts
linguist-detectable$/m) for "*.ts") or (2) parse the content into lines and
assert that for each extension (".ts", ".js", ".mjs", ".sh", ".html") there is
exactly one rule and that it equals the expected token ("linguist-detectable" or
"-linguist-detectable"), and fail if both variants exist; replace the current
expect(content).toContain(...) calls with these stricter checks on the content
variable so the test fails if contradictory rules are introduced.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: d3268f61-a3ab-480f-ad52-b0846437cd9e

📥 Commits

Reviewing files that changed from the base of the PR and between f28c079 and d7ff9c7.

📒 Files selected for processing (2)
  • .gitattributes
  • test/documentation.test.ts
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Greptile Review
🧰 Additional context used
📓 Path-based instructions (1)
test/**

⚙️ CodeRabbit configuration file

tests must stay deterministic and use vitest. demand regression cases that reproduce concurrency bugs, token refresh races, and windows filesystem behavior. reject changes that mock real secrets or skip assertions.

Files:

  • test/documentation.test.ts
🔇 Additional comments (1)
.gitattributes (1)

1-6: linguist override block is clear and scoped.

this rule set is minimal and matches the stated goal, and it is guarded by test/documentation.test.ts:612-625.

Comment thread test/documentation.test.ts Outdated
The first pass only checked substring presence, which meant the test could stay
green even if conflicting `.gitattributes` rules were added later. This switches
that guardrail to an exact normalized line match for the override block.

Constraint: Keep the fix scoped to the single actionable CodeRabbit finding on PR #389
Rejected: Add broader parser helpers or extra metadata tests | unnecessary for a five-line override contract
Confidence: high
Scope-risk: narrow
Directive: Keep this assertion exact; if the override block changes, update the expected normalized lines in one place
Tested: `npm test -- test/documentation.test.ts`; `npm run lint`; `npm run typecheck`
Not-tested: Full `npm test` remains red on inherited `test/proactive-refresh.test.ts` timeouts reproduced earlier on clean `origin/main`
@ndycode ndycode merged commit 1f639d3 into main Apr 10, 2026
2 checks passed
@ndycode ndycode deleted the feat/typescript-language-bar branch April 12, 2026 06:00
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