Skip to content

Replace Tabs with OsAwareTabs for terminal commands using named slots - #123

Merged
David Pine (IEvangelist) merged 5 commits into
mainfrom
copilot/replace-tabs-with-osaware-tabs
Dec 11, 2025
Merged

David Pine (IEvangelist) merged 5 commits into
mainfrom
copilot/replace-tabs-with-osaware-tabs

Conversation

Copilot AI commented Dec 6, 2025 •

Copy link
Copy Markdown
Contributor

All Tabs components with syncKey="terminal" now use the OsAwareTabs component, which automatically selects PowerShell tabs for Windows users and Bash tabs for others. The component has been refactored to use named slots to reduce code duplication and improve maintainability.

Changes

  • Replaced 27 instances of <Tabs syncKey="terminal"> with <OsAwareTabs syncKey="terminal"> across 14 files
  • Refactored OsAwareTabs component to include TabItem wrappers and use named slots (unix and windows)
  • Updated all usage sites to use Fragment components with named slots instead of TabItem declarations
  • Updated imports: added OsAwareTabs and Fragment, removed unused Tabs and TabItem references
  • Files affected:
    • 1 Astro component (OsAwareTabs.astro - the component itself)
    • 1 Astro component (InstallAspireCLI.astro)
    • 13 MDX documentation files (dashboard, CLI reference, get-started, and whats-new sections)

Example

Before:

import { Tabs, TabItem } from '@astrojs/starlight/components';

<Tabs syncKey="terminal">
  <TabItem label="Bash" icon="seti:shell">
    {/* bash commands */}
  </TabItem>
  <TabItem label="PowerShell" icon="seti:powershell">
    {/* powershell commands */}
  </TabItem>
</Tabs>

After:

import { Fragment } from 'astro:components';
import OsAwareTabs from '@components/OsAwareTabs.astro';

<OsAwareTabs syncKey="terminal">
  <Fragment slot="unix">
    {/* bash commands */}
  </Fragment>
  <Fragment slot="windows">
    {/* powershell commands */}
  </Fragment>
</OsAwareTabs>

OsAwareTabs Component:

import { Tabs, TabItem } from "@astrojs/starlight/components";

<Tabs syncKey={syncKey}>
  <TabItem label="Bash" icon="seti:shell">
    <slot name="unix" />
  </TabItem>
  <TabItem label="PowerShell" icon="seti:powershell">
    <slot name="windows" />
  </TabItem>
</Tabs>

Benefits

  • Reduced code duplication: TabItem declarations with labels and icons are now centralized in the component
  • Improved maintainability: Changes to tab structure only need to be made in one place
  • Less fragile: Fewer repetitive declarations mean fewer opportunities for inconsistencies
Original prompt

For all of the places in mdx and astro files where a syncKey="terminal" is used with Tabs component, replace them with the newly created OsAwareTabs and be sure to import OsAwareTabs from '@components/OsAwareTabs.astro'; this component where needed. Please remove the import for the Tabs component if it's not used anywhere else.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: IEvangelist <7679720+IEvangelist@users.noreply.github.com>
Copilot AI changed the title [WIP] Replace Tabs component with OsAwareTabs in mdx and astro files Replace Tabs with OsAwareTabs for terminal commands Dec 6, 2025
@IEvangelist

Copy link
Copy Markdown
Member

Nice! But Copilot now I'm realizing that we're still duplicating a ton of code and it's still fragile, as the single <slot /> in the new OsAwareTabs isn't doing the work of providing the TabItem where the label/key is set, could you please also update the OsAwareTabs component so that it adds the <TabItem label="Bash" icon="seti:shell"></TabItem> and <TabItem label="PowerShell" icon="seti:powershell"></TabItem> and use named slots? https://docs.astro.build/en/basics/astro-components/#named-slots Then you'll need to update the usages. In the OsAwareTabs create two named slots: <slot name="windows" /> and <slot name="unix" />.

Co-authored-by: IEvangelist <7679720+IEvangelist@users.noreply.github.com>

Copilot AI commented Dec 6, 2025 •

Copy link
Copy Markdown
Contributor Author

Nice! But Copilot now I'm realizing that we're still duplicating a ton of code and it's still fragile, as the single <slot /> in the new OsAwareTabs isn't doing the work of providing the `TabItem...

Done! Updated the OsAwareTabs component to include the TabItem wrappers and use named slots (unix and windows). All 14 usage files have been refactored to use Fragment components with the named slots, eliminating code duplication. See commit a16a2ff.

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:

  • telemetry.astro.build
    • Triggering command: /usr/local/bin/node node /home/REDACTED/.npm/_npx/aa98e6899c6baff3/node_modules/.bin/astro build (dns block)
    • Triggering command: /usr/local/bin/node node /home/REDACTED/work/aspire.dev/aspire.dev/src/frontend/node_modules/.bin/astro build (dns block)

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

Copilot AI changed the title Replace Tabs with OsAwareTabs for terminal commands Replace Tabs with OsAwareTabs for terminal commands using named slots Dec 6, 2025
@IEvangelist
David Pine (IEvangelist) marked this pull request as ready for review December 8, 2025 14:18
Copilot AI review requested due to automatic review settings December 8, 2025 14:18

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This pull request refactors terminal command examples across the documentation by replacing the generic Tabs component with a new OsAwareTabs component that automatically selects the appropriate tab (PowerShell for Windows, Bash for others) based on the user's operating system. The refactoring also introduces a cleaner pattern using named slots.

Key Changes

  • Created/enhanced OsAwareTabs component with TabItem wrappers and named slots (unix and windows)
  • Replaced 27 instances of <Tabs syncKey="terminal"> with <OsAwareTabs syncKey="terminal"> across 14 files
  • Updated component script with is:inline directive and improved cross-browser OS detection logic

Reviewed changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/frontend/src/components/OsAwareTabs.astro Refactored to include TabItem wrappers with named slots; improved platform detection script
src/frontend/src/components/InstallAspireCLI.astro Updated to use OsAwareTabs with direct slot attributes on Code components
src/frontend/src/content/docs/whats-new/aspire-13.mdx Replaced Tabs with OsAwareTabs using Code components with slot attributes
src/frontend/src/content/docs/reference/cli/install-script.mdx Replaced Tabs with OsAwareTabs using div wrappers for markdown code blocks
src/frontend/src/content/docs/reference/cli/configuration.mdx Replaced Tabs with OsAwareTabs; contains unused imports
src/frontend/src/content/docs/get-started/prerequisites.mdx Updated terminal examples to use OsAwareTabs with direct slot attributes
src/frontend/src/content/docs/get-started/install-cli.mdx Replaced Tabs with OsAwareTabs using mixed patterns (direct slots and div wrappers)
src/frontend/src/content/docs/dashboard/standalone.mdx Updated Docker command examples to use OsAwareTabs with div wrappers
src/frontend/src/content/docs/dashboard/standalone-for-python.mdx Updated terminal examples to use OsAwareTabs
src/frontend/src/content/docs/dashboard/standalone-for-nodejs.mdx Updated Docker commands to use OsAwareTabs; contains unused import
src/frontend/src/content/docs/dashboard/security-considerations.mdx Updated Docker examples with OsAwareTabs
src/frontend/src/content/docs/dashboard/overview.mdx Updated Docker run commands to use OsAwareTabs
src/frontend/src/content/docs/dashboard/microsoft-collected-dashboard-telemetry.mdx Updated environment variable examples to use OsAwareTabs
src/frontend/src/content/docs/dashboard/explore.mdx Updated terminal examples to use OsAwareTabs
src/frontend/src/content/docs/dashboard/enable-browser-telemetry.mdx Updated Docker commands to use OsAwareTabs
src/frontend/src/content/docs/dashboard/configuration.mdx Updated Docker configuration examples to use OsAwareTabs

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

@eerhardt Eric Erhardt (eerhardt) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM. Honestly I just spot checked. I'm not sure exactly how this stuff works.

@IEvangelist
David Pine (IEvangelist) merged commit a249cd1 into main Dec 11, 2025
7 checks passed
@IEvangelist
David Pine (IEvangelist) deleted the copilot/replace-tabs-with-osaware-tabs branch December 11, 2025 20:27
David Pine (IEvangelist) added a commit that referenced this pull request Dec 11, 2025
…#123)

* Initial plan

* Replace all Tabs with syncKey="terminal" with OsAwareTabs component

Co-authored-by: IEvangelist <7679720+IEvangelist@users.noreply.github.com>

* Update OsAwareTabs to use named slots and reduce code duplication

Co-authored-by: IEvangelist <7679720+IEvangelist@users.noreply.github.com>

* refactor: replace Fragment with div in OsAwareTabs usage for improved readability

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: IEvangelist <7679720+IEvangelist@users.noreply.github.com>
Co-authored-by: David Pine <david.pine@microsoft.com>
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.

4 participants