Skip to content
Source
Sign inSign up
TanStack/markdown

fix: support shared package manager commands #12

MergedLadyBluenotes(GitHub profile, opens in a new tab)merged 1 commit intomain fromfix/frameworkless-package-manager-tabsmerged by tannerlinsley

Description

Package-manager tabs currently ignore lines without a framework prefix. Accept those lines as shared commands so framework-independent tools do not need the same commands repeated for each framework. Each source line remains a separate command group:

<!-- ::start:tabs variant="package-manager" mode="local-install" -->

@tanstack/intent@latest list
@tanstack/intent@latest validate
@tanstack/intent@latest review

<!-- ::end:tabs -->

Shared groups use the empty key in the existing packagesByFramework metadata and precede named groups. Named groups include shared lines in source order. This works with tanstack.com's existing native package-manager component and fallback selection; no new public attribute or framework name is required.

The change preserves existing prefixed commands, prefix whitespace handling, and install modes. Regression coverage includes mixed shared/framework lines and literal arguments inside fenced text. The docs describe the authoring syntax and renderer contract.

Companion website PR: https://github.com/TanStack/tanstack.com/pull/1225. It remains draft until this fix is released and the website dependency is updated.

Verification

  • Rebased on current main; the null-prototype map is retained and the constructor / __proto__ regression test still passes.
  • A framework prefix is a [\w-]+ name followed by a colon that is not directly followed by / or ., so https://host/pkg.tgz, file:../pkg, and git+ssh:// specifiers stay shared while react:pkg and react: pkg remain framework lines. This is documented and covered by a regression test.
  • Bundle ceilings are unchanged. The growth is offset by simplifications in the tabs and shared helpers. Margins under the current ceilings (min / gzip / brotli bytes): docs preset -138 / -19 / -14, tabs transforms -138 / -15 / -6, ./extensions/tabs -138 / -14 / -2, ./extensions/docs -138 / -19 / -24.
  • pnpm run verify passed: 252 tests, typecheck, build, docs and skill checks, conformance, size measurements, benchmarks, and package dry run.
  • node --import tsx scripts/audit-external-corpus.ts passed: 10,517 Markdown files audited and 813 MDX files inventoried across 20 pinned repositories.
  • Verified the locally packed parser with tanstack.com's native package-manager tabs: four package managers, eight framework/no-framework routes, three command lines per block, synchronized blocks, and persisted selection after reload.
    1. coderabbitai[bot](GitHub profile, opens in a new tab)commented
      Review Change StackReview Change Stack

      No actionable comments were generated in the recent review. 🎉

      ℹ️ Recent review info
      ⚙️ Run configuration

      Configuration used: defaults

      Review profile: CHILL

      Plan: Advanced

      Run ID: cf82dbe6-377c-4e16-a8c0-9237e17fa6d2

      📥 Commits

      Reviewing files that changed from the base of the PR and between 8697aef8f9b256cac8166ab219533e40d5835ccb and 2f4b2a9ba93211ad0c40da46a214ca97f7def2d7.

      📒 Files selected for processing (7)
      • docs/guides/docs-preset.md
      • docs/reference/extensions.md
      • skills/docs-features/SKILL.md
      • skills/docs-features/references/docs-metadata.md
      • src/extensions/shared.ts
      • src/extensions/tabs.ts
      • tests/docs-extensions.test.ts

      Included review availability: Your plan provides up to 2 included reviews per hour; 1 remains after this review.


      📝 Walkthrough

      Walkthrough

      The package-manager tabs transformation now accepts shared, unprefixed package commands. It stores shared commands under the empty framework key and merges them into named framework groups. Tests and documentation cover ordering, whitespace, install modes, protocol URLs, and special characters. Tab slug and heading utility handling also changed.

      Changes

      Package-manager tab transformation

      Layer / File(s)Summary
      Parse and validate shared commands
      src/extensions/tabs.ts, tests/docs-extensions.test.ts
      The transformer parses shared commands, merges them with framework-specific commands, emits shared metadata, and validates ordering, whitespace, install modes, protocol URLs, and special characters.
      Align tab metadata and section slugs
      src/extensions/tabs.ts, src/extensions/shared.ts
      Bundler metadata and slugs now use section names and computed tab slugs. Heading sections explicitly allow undefined IDs, heading-less input is processed, and slug whitespace and hyphen runs collapse together.
      Document shared command behavior
      docs/guides/docs-preset.md, docs/reference/extensions.md, skills/docs-features/SKILL.md, skills/docs-features/references/docs-metadata.md
      The documentation describes shared command syntax, metadata structure, fallback behavior, source ordering, protocol URL handling, and fenced text blocks for literal Markdown characters.

      Priority: ⬇️ Low

      Estimated code review effort: 3 (Moderate) | ~20 minutes

      Change: Feature

      Suggested reviewers: tannerlinsley

      Sequence Diagram(s)

      sequenceDiagram
        participant TabsBlock
        participant transformPackageManagerTabs
        participant PackageManagerMeta
        participant DocsTests
        TabsBlock->>transformPackageManagerTabs: provide shared and framework-specific package lines
        transformPackageManagerTabs->>PackageManagerMeta: emit shared and framework command groups
        DocsTests->>transformPackageManagerTabs: verify ordering, modes, URLs, and special characters

      Merge Risk: ⚪ Minimal · up to 2f4b2

      No actionable merge-blocking risk remains in the shared package-manager command changes.

      🚥 Pre-merge checks | ✅ 4 | ❌ 1

      ❌ Failed checks (1 warning)

      Check nameStatusExplanationResolution
      Docstring Coverage⚠️ WarningDocstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 3 files. (4 skipped: 4 …Write docstrings for the functions missing them to satisfy the coverage threshold.
      ✅ Passed checks (4 passed)
      Check nameStatusExplanation
      Linked Issues check✅ PassedCheck skipped because no linked issues were found for this pull request.
      Out of Scope Changes check✅ PassedCheck skipped because no linked issues were found for this pull request.
      Description Check✅ PassedCheck skipped - CodeRabbit’s high-level summary is enabled.
      Title check✅ PassedThe title clearly and concisely describes the main change: support for shared package-manager commands without framework prefixes.
      Full details: Docstring Coverage

      Explanation

      Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 3 files. (4 skipped: 4 unsupported.)

      • Fix all pre-merge checks with AI
      ✨ Finishing Touches 💡 1
      📝 Generate docstrings 💡
      • Create stacked PR
      • Commit on current branch
      🧪 Generate unit tests (beta)
      • Create PR with unit tests
      • Commit unit tests in branch `fix/frameworkless-package-manager-tabs`

      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.
    2. tannerlinsley requested changes

      Shared package-manager commands are useful, so I am keeping this open. A few things need to be resolved before merging:

      1. Shared package specs can still be parsed as framework names. I reproduced https://example.com/package.tgz becoming the https framework with //example.com/package.tgz as its package, and file:../local-package becoming the file framework. Please define and test the distinction between a framework prefix and a package protocol while preserving existing react:package syntax.
      2. Update against current main and retain its Object.create(null) map. The current PR snapshot throws on constructor: example; main already fixed that case, so it must survive the update.
      3. The extension size increase needs review. Using the current esbuild measurement settings and preserving the null-prototype map, this change takes the docs preset from 2,292 to 2,383 gzip bytes (+91), tabs transforms from 1,221 to 1,326 (+105), and the full tabs export from 1,338 to 1,447 (+109). The parser stays unchanged. These exceed the current extension ceilings, so please look for offsetting simplifications rather than raising the budgets automatically.

      After that, run the current pnpm run verify and external corpus audit. This is not part of the 0.0.15 release already in progress.

    3. Shared package-manager commands are useful, so I am keeping this open. A few things need to be resolved before merging:

      1. Shared package specs can still be parsed as framework names. I reproduced https://example.com/package.tgz becoming the https framework with //example.com/package.tgz as its package, and file:../local-package becoming the file framework. Please define and test the distinction between a framework prefix and a package protocol while preserving existing react:package syntax.

      2. Update against current main and retain its Object.create(null) map. The current PR snapshot throws on constructor: example; main already fixed that case, so it must survive the update.

      3. The extension size increase needs review. Using the current esbuild measurement settings and preserving the null-prototype map, this change takes the docs preset from 2,292 to 2,383 gzip bytes (+91), tabs transforms from 1,221 to 1,326 (+105), and the full tabs export from 1,338 to 1,447 (+109). The parser stays unchanged. These exceed the current extension ceilings, so please look for offsetting simplifications rather than raising the budgets automatically.

      After that, run the current pnpm run verify and external corpus audit. This is not part of the 0.0.15 release already in progress.

      Done!

    4. tannerlinsley merged thisf2cc666

    5. tannerlinsley closed this

Sign in to join this conversation.