mirror of
https://github.com/CopilotKit/CopilotKit.git
synced 2026-09-14 16:26:20 +08:00
a805a8468f
Replace the LangGraph-flavoured <InstallSDKSnippet> / <InstallPythonSDK>
pattern with a package-owned setup mechanism:
- <FrameworkSetup concept="X" /> resolves
showcase/integrations/<framework>/docs/setup/X.mdx at render
time and returns null when the file is missing (silent absence).
- <DemoCode file="..." region="..." /> embedded in a concept file
pulls a live source excerpt from the same integration package, with
Shiki highlighting via the existing rehype-code pipeline (a static
source-rewrite pass expands the JSX into a fenced markdown block
before MDXRemote sees it).
- currentFramework is bound by DocsPageView's per-render override on
the components map - same pattern as MdxFrameworkOverview. Mirrored
in the framework-root after-features.mdx render.
- 6 agnostic root pages instrumented with one <FrameworkSetup> slot
each (frontend-tools, shared-state, human-in-the-loop, agent-config,
programmatic-control, multi-agent/subagents).
- LGP ships docs/setup/copilot-middleware.mdx as the proof-point with
a # region: middleware marker on src/agents/frontend_tools.py;
other frameworks ship nothing (slot renders silently).
Concept files resolve per package (not per docs folder) - LangGraph
variants share docs CONTENT under content/docs/integrations/langgraph/,
but each package owns its own source tree and therefore its own
docs/setup/ files. LGTS / Fastapi ship their own concept files when
their owners audit.
New Vitest setup in shell-docs covers extractRegion language dispatch,
duplicate-region handling, unterminated-region throws, resolveSetupConcept
path-traversal guards, and the rewriteDemoCode static-prop pre-expansion.
32 tests, all green.
The 18 legacy <InstallSDKSnippet> / <InstallPythonSDK> callers stay on
the old mechanism; the migration is a separate PR.
--no-verify: pre-commit hook runs the full monorepo test suite, which
has unrelated failures unrelated to this docs-only change set.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
22 lines
559 B
TypeScript
22 lines
559 B
TypeScript
import { defineConfig } from "vitest/config";
|
|
import path from "node:path";
|
|
|
|
export default defineConfig({
|
|
test: {
|
|
environment: "node",
|
|
include: ["src/**/*.test.{ts,tsx}"],
|
|
exclude: ["node_modules/**", ".next/**"],
|
|
},
|
|
resolve: {
|
|
alias: [
|
|
// Match `@/anything` so transitive imports through registry.ts /
|
|
// docs-render.tsx use the in-package src/ rather than tripping
|
|
// vite's package resolver.
|
|
{
|
|
find: /^@\/(.*)$/,
|
|
replacement: path.resolve(__dirname, "./src") + "/$1",
|
|
},
|
|
],
|
|
},
|
|
});
|