Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 14 additions & 8 deletions .github/workflows/generate-toolkit-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ on:
repository_dispatch:
types: [porter_deploy_succeeded]
workflow_dispatch:
# 11:00 UTC = 3 AM PST / 4 AM PDT — late enough that DST drift doesn't matter.
schedule:
- cron: "0 11 * * *"

permissions:
contents: write
Expand All @@ -27,8 +30,6 @@ jobs:

- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9

- name: Setup Node.js
uses: actions/setup-node@v4
Expand All @@ -45,11 +46,14 @@ jobs:

- name: Generate toolkit docs
run: |
pnpm start generate \
pnpm dlx tsx src/cli/index.ts generate \
--all \
--skip-unchanged \
--engine-api-url "$ENGINE_API_URL" \
--engine-api-key "$ENGINE_API_KEY" \
--require-complete \
--verbose \
--api-source tool-metadata \
--tool-metadata-url "$ENGINE_API_URL" \
--tool-metadata-key "$ENGINE_API_KEY" \
--llm-provider openai \
--llm-model "$OPENAI_MODEL" \
--llm-api-key "$OPENAI_API_KEY" \
Expand All @@ -62,7 +66,7 @@ jobs:
OPENAI_MODEL: ${{ secrets.OPENAI_MODEL || 'gpt-4o-mini' }}

- name: Sync toolkit sidebar navigation
run: pnpm dlx tsx toolkit-docs-generator/scripts/sync-toolkit-sidebar.ts --prune --verbose
run: pnpm dlx tsx toolkit-docs-generator/scripts/sync-toolkit-sidebar.ts --remove-empty-sections=false --verbose

- name: Check for changes
id: check-changes
Expand All @@ -76,10 +80,12 @@ jobs:
- name: Create pull request
if: steps.check-changes.outputs.has_changes == 'true'
uses: peter-evans/create-pull-request@v7
env:
HUSKY: 0
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "chore: update toolkit docs after Porter deploy"
title: "Update toolkit docs after Porter deploy"
commit-message: "[AUTO] Adding MCP Servers docs update"
title: "[AUTO] Adding MCP Servers docs update"
body: |
This PR was generated after a Porter deploy succeeded.

Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ styles/write-good/

# Toolkit overview input files
toolkit-docs-generator/overview-input/
toolkit-docs-generator-verification/logs/

# Generated toolkit markdown (built at build time, not committed)
public/toolkit-markdown/
53 changes: 36 additions & 17 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ if git diff --cached --name-only | grep -q "next.config.ts"; then
fi

# --- Lint Staged (formatting) ---
pnpm dlx lint-staged
pnpm exec lint-staged

# --- Stash + Format ---
# Skip this block during merge/rebase: git stash --keep-index destroys
Expand All @@ -150,17 +150,43 @@ STAGED_HASH=$(git diff --cached | sha256sum | cut -d' ' -f1)
STAGED_FILES=$(git diff --cached --name-only --diff-filter=ACMR)
PARTIALLY_STAGED=$(git diff --name-only)

# If a file is both staged and unstaged, stash/pop can produce conflicts.
# In that case rely on lint-staged only, which already ran above.
if [ -n "$PARTIALLY_STAGED" ] && [ -n "$STAGED_FILES" ]; then
for file in $PARTIALLY_STAGED; do
if [ -f "$file" ] && echo "$STAGED_FILES" | grep -qxF "$file"; then
echo "⏭️ Skipping stash+format (partially staged files detected)"
exit 0
fi
done
fi

# Stash unstaged changes to preserve working directory
# --keep-index keeps staged changes in working tree
git stash push --quiet --keep-index --message "pre-commit-stash" || true
STASHED=$?
STASH_CREATED=false
STASH_MESSAGE="pre-commit-stash-$$-$(date +%s)"
if ! git diff --quiet; then
git stash push --quiet --keep-index --message "$STASH_MESSAGE"
TOP_STASH_SUBJECT="$(git stash list -1 --format='%s' || true)"
case "$TOP_STASH_SUBJECT" in
*"$STASH_MESSAGE")
STASH_CREATED=true
;;
esac
fi

# Run formatter on the staged files
pnpm dlx ultracite fix
FORMAT_EXIT_CODE=$?
if [ -n "$STAGED_FILES" ]; then
for file in $STAGED_FILES; do
if [ -f "$file" ]; then
pnpm exec ultracite fix "$file"
fi
done
fi
FORMAT_EXIT_CODE=0

# Restore working directory state
if [ $STASHED -eq 0 ]; then
if [ "$STASH_CREATED" = true ]; then
# Re-stage the formatted files
if [ -n "$STAGED_FILES" ]; then
echo "$STAGED_FILES" | while IFS= read -r file; do
Expand All @@ -171,17 +197,10 @@ if [ $STASHED -eq 0 ]; then
fi

# Restore unstaged changes
git stash pop --quiet || true

# Restore partial staging if files were partially staged
if [ -n "$PARTIALLY_STAGED" ]; then
for file in $PARTIALLY_STAGED; do
if [ -f "$file" ] && echo "$STAGED_FILES" | grep -q "^$file$"; then
# File was partially staged - need to unstage the unstaged parts
git restore --staged "$file" 2>/dev/null || true
git add -p "$file" < /dev/null 2>/dev/null || git add "$file"
fi
done
if ! git stash pop --quiet; then
echo "❌ Failed to restore stashed changes during pre-commit."
echo " Resolve conflicts, then re-stage files and commit again."
exit 1
fi
else
# No stash was created, just re-add the formatted files
Expand Down
18 changes: 9 additions & 9 deletions app/_components/toolkit-docs/components/toolkit-page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -583,6 +583,15 @@ export function ToolkitPage({ data }: ToolkitPageProps) {
<h1 className="mb-6 font-bold text-4xl text-foreground tracking-tight">
{data.label}
</h1>
<ToolkitHeader
auth={data.auth}
description={data.description}
id={data.id}
label={data.label}
metadata={metadata}
toolStats={toolStats}
version={data.version}
/>
<DocumentationChunkRenderer
chunks={documentationChunks}
location="header"
Expand All @@ -593,15 +602,6 @@ export function ToolkitPage({ data }: ToolkitPageProps) {
location="description"
position="before"
/>
<ToolkitHeader
auth={data.auth}
description={data.description}
id={data.id}
label={data.label}
metadata={metadata}
toolStats={toolStats}
version={data.version}
/>
<DocumentationChunkRenderer
chunks={documentationChunks}
location="description"
Expand Down
45 changes: 43 additions & 2 deletions app/_lib/toolkit-static-params.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { readdir, readFile } from "node:fs/promises";
import { createRequire } from "node:module";
import { join } from "node:path";
import { TOOLKITS as DESIGN_SYSTEM_TOOLKITS } from "@arcadeai/design-system";
import { pathToFileURL } from "node:url";
import { readToolkitData, readToolkitIndex } from "./toolkit-data";
import { getToolkitSlug, normalizeToolkitId } from "./toolkit-slug";

Expand Down Expand Up @@ -31,6 +32,45 @@ export type ToolkitRouteEntry = {
category: IntegrationCategory;
};

const require = createRequire(import.meta.url);
let cachedDesignSystemToolkits: ToolkitCatalogEntry[] | null = null;

const isToolkitCatalogEntry = (
value: unknown
): value is ToolkitCatalogEntry => {
if (typeof value !== "object" || value === null || Array.isArray(value)) {
return false;
}
const entry = value as Record<string, unknown>;
return typeof entry.id === "string";
};

const loadDesignSystemToolkits = async (): Promise<ToolkitCatalogEntry[]> => {
if (cachedDesignSystemToolkits) {
return cachedDesignSystemToolkits;
}

try {
const designSystemEntry = require.resolve("@arcadeai/design-system");
const designSystem = (await import(
pathToFileURL(designSystemEntry).href
)) as {
TOOLKITS?: unknown;
};
const toolkits = Array.isArray(designSystem.TOOLKITS)
? designSystem.TOOLKITS
: [];

cachedDesignSystemToolkits = toolkits.flatMap((toolkit) =>
isToolkitCatalogEntry(toolkit) ? [toolkit] : []
);
} catch {
cachedDesignSystemToolkits = [];
}

return cachedDesignSystemToolkits;
};

function normalizeCategory(
value: string | null | undefined
): IntegrationCategory {
Expand Down Expand Up @@ -150,7 +190,8 @@ export async function listToolkitRoutes(options?: {
return await listToolkitRoutesFromDataDir(options);
}

const toolkitsCatalog = options?.toolkitsCatalog ?? DESIGN_SYSTEM_TOOLKITS;
const toolkitsCatalog =
options?.toolkitsCatalog ?? (await loadDesignSystemToolkits());
const catalogByNormalizedId = new Map(
toolkitsCatalog.map((toolkit) => [normalizeToolkitId(toolkit.id), toolkit])
);
Expand Down
3 changes: 3 additions & 0 deletions app/en/resources/integrations/_meta.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ const meta: MetaRecord = {
sales: {
title: "Sales",
},
databases: {
title: "Databases",
},
"customer-support": {
title: "Customer Support",
},
Expand Down
10 changes: 10 additions & 0 deletions app/en/resources/integrations/databases/_meta.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import type { MetaRecord } from "nextra";

const meta: MetaRecord = {
"weaviate-api": {
title: "Weaviate API",
href: "/en/resources/integrations/databases/weaviate-api",
},
};

export default meta;
4 changes: 0 additions & 4 deletions app/en/resources/integrations/development/_meta.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,6 @@ const meta: MetaRecord = {
title: "Vercel API",
href: "/en/resources/integrations/development/vercel-api",
},
"weaviate-api": {
title: "Weaviate API",
href: "/en/resources/integrations/development/weaviate-api",
},
};

export default meta;
1 change: 1 addition & 0 deletions biome.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@
"!build",
"!node_modules",
"!public",
"!toolkit-docs-generator/data/toolkits",
"!scripts",
"!agents",
"!.vscode",
Expand Down
2 changes: 1 addition & 1 deletion next-env.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />
import "./.next/dev/types/routes.d.ts";
import "./.next/types/routes.d.ts";

// NOTE: This file should not be edited
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
"dev": "next dev --webpack",
"build": "pnpm run toolkit-markdown && next build --webpack && pnpm run custompagefind",
"start": "next start",
"lint": "pnpm dlx ultracite check",
"format": "pnpm dlx ultracite fix",
"lint": "pnpm exec ultracite check",
"format": "pnpm exec ultracite fix",
"prepare": "husky install",
"toolkit-markdown": "pnpm dlx tsx toolkit-docs-generator/scripts/generate-toolkit-markdown.ts",
"postbuild": "if [ \"$SKIP_POSTBUILD\" != \"true\" ]; then pnpm run generate:markdown && pnpm run custompagefind; fi",
Expand Down Expand Up @@ -42,7 +42,7 @@
},
"homepage": "https://arcade.dev/",
"dependencies": {
"@arcadeai/design-system": "^3.26.1",
"@arcadeai/design-system": "^3.27.7",
"@mdx-js/mdx": "^3.1.1",
"@mdx-js/react": "^3.1.1",
"@next/third-parties": "16.0.1",
Expand Down Expand Up @@ -112,7 +112,7 @@
},
"lint-staged": {
"!(examples)/**/*.{js,jsx,ts,tsx,json,jsonc,css,scss,md,mdx}": [
"pnpm dlx ultracite fix "
"pnpm exec ultracite fix"
]
},
"packageManager": "pnpm@10.11.0",
Expand Down
12 changes: 6 additions & 6 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading