Skip to content

Commit 7f875ea

Browse files
committed
shell-docs: add Deploy section with inlined AgentCore content
Replaces the upstream-synced <Content /> stub at /deploy/agentcore with the full inlined guide using the new <AgentCoreCommandTabs /> component for the auth-mode-aware command examples. Wires the Deploy section into the root nav. - New component: agentcore-command-tabs.tsx - New section meta: deploy/meta.json - Root meta.json adds Deploy as a top-level group - mdx-registry.tsx registers the component
1 parent 7f997a9 commit 7f875ea

5 files changed

Lines changed: 455 additions & 1 deletion

File tree

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
"use client";
2+
3+
// <AgentCoreCommandTabs> — framework-aware code-block tabs for AgentCore
4+
// quickstart commands. Ported from the upstream `docs/components/content/`
5+
// version, but rewritten on top of shell-docs's own <Tabs>/<Tab> primitives
6+
// (the upstream component depends on fumadocs-ui, which shell-docs doesn't
7+
// install).
8+
//
9+
// Usage in MDX:
10+
// <AgentCoreCommandTabs
11+
// lgCommand="npx copilotkit@latest create -f agentcore-langgraph"
12+
// stCommand="npx copilotkit@latest create -f agentcore-strands"
13+
// />
14+
//
15+
// With no `framework` prop the component shows both LangGraph and Strands
16+
// tabs (the canonical shell-docs page lets the user pick). Passing
17+
// `framework="langgraph"` or `framework="strands"` collapses to a single
18+
// tab; we keep that prop for parity with the upstream API even though
19+
// the canonical shell-docs page doesn't use it.
20+
//
21+
// Each command renders inside the same figure chrome that <Snippet> uses
22+
// (figcaption with a copy button + hljs-highlighted bash) so AgentCore
23+
// commands match the visual treatment of every other code block in the
24+
// docs instead of dropping to bare unstyled <pre> output.
25+
26+
import React from "react";
27+
import hljs from "highlight.js";
28+
import { Tabs, Tab } from "@/components/docs-tabs";
29+
import { CopyButton } from "@/components/copy-button";
30+
31+
interface AgentCoreCommandTabsProps {
32+
framework?: "langgraph" | "strands";
33+
lgCommand: string;
34+
stCommand: string;
35+
}
36+
37+
function CommandBlock({ command }: { command: string }) {
38+
// Highlight inline rather than relying on rehype-highlight (which only
39+
// runs on MDX code fences, not on hand-rolled JSX). github /
40+
// github-dark-dimmed themes are loaded globally in app/globals.css, so
41+
// the `hljs language-bash` className picks up theming automatically.
42+
let html: string;
43+
try {
44+
html = hljs.highlight(command, {
45+
language: "bash",
46+
ignoreIllegals: true,
47+
}).value;
48+
} catch {
49+
html = escapeHtml(command);
50+
}
51+
52+
return (
53+
<figure className="my-3 rounded-lg border border-[var(--border)] overflow-hidden bg-[var(--bg-surface)]">
54+
<figcaption className="flex items-center justify-end px-3 py-2 border-b border-[var(--border)] bg-[var(--bg-elevated)]">
55+
<CopyButton text={command} />
56+
</figcaption>
57+
<pre className="text-[12.5px] leading-[1.55] overflow-x-auto p-4 m-0">
58+
<code
59+
className="hljs language-bash"
60+
dangerouslySetInnerHTML={{ __html: html }}
61+
/>
62+
</pre>
63+
</figure>
64+
);
65+
}
66+
67+
function escapeHtml(s: string): string {
68+
return s
69+
.replace(/&/g, "&amp;")
70+
.replace(/</g, "&lt;")
71+
.replace(/>/g, "&gt;")
72+
.replace(/"/g, "&quot;")
73+
.replace(/'/g, "&#39;");
74+
}
75+
76+
export function AgentCoreCommandTabs({
77+
framework,
78+
lgCommand,
79+
stCommand,
80+
}: AgentCoreCommandTabsProps) {
81+
const items =
82+
framework === "langgraph"
83+
? ["LangGraph"]
84+
: framework === "strands"
85+
? ["Strands"]
86+
: ["LangGraph", "Strands"];
87+
88+
return (
89+
<Tabs groupId="agentcore-framework" items={items}>
90+
{(framework === "langgraph" || !framework) && (
91+
<Tab value="LangGraph">
92+
<CommandBlock command={lgCommand} />
93+
</Tab>
94+
)}
95+
{(framework === "strands" || !framework) && (
96+
<Tab value="Strands">
97+
<CommandBlock command={stCommand} />
98+
</Tab>
99+
)}
100+
</Tabs>
101+
);
102+
}

0 commit comments

Comments
 (0)