Skip to content

Commit 3fb2dc3

Browse files
committed
Some tweaks in tool docs
1 parent 2eacf15 commit 3fb2dc3

18 files changed

Lines changed: 1221 additions & 1026 deletions

File tree

Lines changed: 161 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
1+
name: Check toolkit coverage
2+
# Runs on every PR to main. Never fails — surfaces gaps as GitHub warnings
3+
# and a PR comment so authors are informed without being blocked.
4+
#
5+
# Checks:
6+
# 1. API toolkits missing a JSON data file in toolkit-docs-generator/data/toolkits/
7+
# 2. JSON data files with no matching API toolkit (stale orphans)
8+
# 3. API toolkits present in JSON but absent from any sidebar _meta.tsx
9+
10+
on:
11+
workflow_dispatch:
12+
pull_request:
13+
types: [opened, synchronize, reopened]
14+
branches:
15+
- main
16+
17+
permissions:
18+
contents: read
19+
pull-requests: write
20+
21+
jobs:
22+
coverage:
23+
name: Toolkit coverage check
24+
runs-on: ubuntu-latest
25+
26+
steps:
27+
- name: Checkout repository
28+
uses: actions/checkout@v4
29+
30+
- name: Install pnpm
31+
uses: pnpm/action-setup@v4
32+
33+
- name: Setup Node.js
34+
uses: actions/setup-node@v4
35+
with:
36+
node-version: "22"
37+
cache: pnpm
38+
39+
- name: Install dependencies
40+
run: pnpm install
41+
42+
- name: Run toolkit coverage check
43+
id: coverage
44+
run: |
45+
pnpm run check:toolkit-coverage 2>&1 | tee coverage-output.txt
46+
if grep -q "⚠️ Toolkit coverage warnings" coverage-output.txt; then
47+
echo "has_warnings=true" >> "$GITHUB_OUTPUT"
48+
else
49+
echo "has_warnings=false" >> "$GITHUB_OUTPUT"
50+
fi
51+
env:
52+
ENGINE_API_URL: ${{ secrets.ENGINE_API_URL }}
53+
ENGINE_API_KEY: ${{ secrets.ENGINE_API_KEY }}
54+
55+
- name: Emit GitHub warning annotations
56+
if: steps.coverage.outputs.has_warnings == 'true'
57+
run: |
58+
# Emit one ::warning:: annotation per gap category so GitHub surfaces
59+
# a yellow warning badge on the check without marking it as failed.
60+
if grep -q "📁 In API but missing JSON" coverage-output.txt; then
61+
missing=$(grep -A 100 "📁 In API but missing JSON" coverage-output.txt \
62+
| grep "^ [A-Z]" | sed 's/^ //' | paste -sd ', ')
63+
echo "::warning::Toolkits in API with no JSON data file: ${missing}"
64+
fi
65+
66+
if grep -q "🗑️ JSON files with no matching" coverage-output.txt; then
67+
stale=$(grep -A 100 "🗑️ JSON files with no matching" coverage-output.txt \
68+
| grep "^ [a-z]" | sed 's/^ //' | paste -sd ', ')
69+
echo "::warning::Stale JSON files (no matching API toolkit): ${stale}"
70+
fi
71+
72+
if grep -q "🗂️ In API + JSON but missing from sidebar" coverage-output.txt; then
73+
sidebar=$(grep -A 100 "🗂️ In API + JSON but missing from sidebar" coverage-output.txt \
74+
| grep "^ [A-Z]" | sed 's/^ //' | paste -sd ', ')
75+
echo "::warning::Toolkits missing from sidebar _meta.tsx: ${sidebar}"
76+
fi
77+
78+
- name: Write job summary
79+
if: always()
80+
run: |
81+
if [ "$(cat coverage-output.txt | grep -c '⚠️ Toolkit coverage warnings')" -gt 0 ]; then
82+
echo "## ⚠️ Toolkit coverage — gaps found" >> "$GITHUB_STEP_SUMMARY"
83+
else
84+
echo "## ✅ Toolkit coverage — all clear" >> "$GITHUB_STEP_SUMMARY"
85+
fi
86+
echo "" >> "$GITHUB_STEP_SUMMARY"
87+
echo '```' >> "$GITHUB_STEP_SUMMARY"
88+
cat coverage-output.txt >> "$GITHUB_STEP_SUMMARY"
89+
echo '```' >> "$GITHUB_STEP_SUMMARY"
90+
91+
- name: Post or update PR comment
92+
if: always()
93+
uses: actions/github-script@v7
94+
with:
95+
script: |
96+
const fs = require('fs');
97+
const output = fs.readFileSync('coverage-output.txt', 'utf8');
98+
const hasWarnings = output.includes('⚠️ Toolkit coverage warnings');
99+
const marker = '<!-- toolkit-coverage-check -->';
100+
101+
const { data: comments } = await github.rest.issues.listComments({
102+
owner: context.repo.owner,
103+
repo: context.repo.repo,
104+
issue_number: context.issue.number,
105+
});
106+
107+
const existing = comments.find(c =>
108+
c.user.type === 'Bot' && c.body.includes(marker)
109+
);
110+
111+
if (!hasWarnings) {
112+
if (existing) {
113+
await github.rest.issues.deleteComment({
114+
owner: context.repo.owner,
115+
repo: context.repo.repo,
116+
comment_id: existing.id,
117+
});
118+
}
119+
return;
120+
}
121+
122+
const body = `${marker}
123+
## ⚠️ Toolkit coverage gaps detected
124+
125+
The coverage check found gaps between the Arcade API and the local toolkit data files. These are **warnings only** — this PR is not blocked from merging.
126+
127+
<details>
128+
<summary>📋 Full report</summary>
129+
130+
\`\`\`
131+
${output}
132+
\`\`\`
133+
134+
</details>
135+
136+
### What each warning means
137+
138+
| Warning | Cause | Fix |
139+
|---|---|---|
140+
| **In API but missing JSON** | A toolkit is published in the API but has no docs data file | Run the toolkit docs generator for those toolkits |
141+
| **Stale JSON files** | A JSON data file exists locally but has no matching toolkit in the API | Delete the file or verify the toolkit is still published |
142+
| **Missing from sidebar** | A toolkit has JSON but isn't listed in any \`_meta.tsx\` | Run \`npx tsx toolkit-docs-generator/scripts/sync-toolkit-sidebar.ts\` |
143+
144+
---
145+
*This comment updates automatically when the PR is pushed. It is removed when all gaps are resolved.*`;
146+
147+
if (existing) {
148+
await github.rest.issues.updateComment({
149+
owner: context.repo.owner,
150+
repo: context.repo.repo,
151+
comment_id: existing.id,
152+
body,
153+
});
154+
} else {
155+
await github.rest.issues.createComment({
156+
owner: context.repo.owner,
157+
repo: context.repo.repo,
158+
issue_number: context.issue.number,
159+
body,
160+
});
161+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import type { MetaRecord } from "nextra";
2+
3+
type ToolkitType =
4+
| "arcade"
5+
| "arcade_starter"
6+
| "community"
7+
| "verified"
8+
| "auth";
9+
10+
export type CategoryEntry = {
11+
slug: string;
12+
title: string;
13+
href: string;
14+
type: ToolkitType;
15+
};
16+
17+
/**
18+
* Builds a Nextra MetaRecord for an integration category, automatically
19+
* inserting "Optimized" and "Starter" separator headings based on toolkit type.
20+
*
21+
* - "Optimized" group: any entry whose type is not "arcade_starter"
22+
* - "Starter" group: entries with type "arcade_starter"
23+
*
24+
* A separator is only emitted when its group is non-empty, so categories
25+
* with a single type do not show an unnecessary heading.
26+
*/
27+
export function createCategoryMeta(entries: CategoryEntry[]): MetaRecord {
28+
const optimized = entries.filter((e) => e.type !== "arcade_starter");
29+
const starter = entries.filter((e) => e.type === "arcade_starter");
30+
31+
const result: MetaRecord = {};
32+
33+
if (optimized.length > 0) {
34+
result["-- Optimized"] = { type: "separator", title: "Optimized" };
35+
for (const entry of optimized) {
36+
result[entry.slug] = { title: entry.title, href: entry.href };
37+
}
38+
}
39+
40+
if (starter.length > 0) {
41+
result["-- Starter"] = { type: "separator", title: "Starter" };
42+
for (const entry of starter) {
43+
result[entry.slug] = { title: entry.title, href: entry.href };
44+
}
45+
}
46+
47+
return result;
48+
}
Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,40 @@
1-
import type { MetaRecord } from "nextra";
1+
import { createCategoryMeta } from "../create-category-meta";
22

3-
const meta: MetaRecord = {
4-
"-- Optimized": {
5-
type: "separator",
6-
title: "Optimized",
7-
},
8-
zendesk: {
3+
export default createCategoryMeta([
4+
{
5+
slug: "zendesk",
96
title: "Zendesk",
107
href: "/en/resources/integrations/customer-support/zendesk",
8+
type: "arcade",
119
},
12-
"-- Starter": {
13-
type: "separator",
14-
title: "Starter",
15-
},
16-
"customerio-api": {
10+
{
11+
slug: "customerio-api",
1712
title: "Customer.io API",
1813
href: "/en/resources/integrations/customer-support/customerio-api",
14+
type: "arcade_starter",
1915
},
20-
"customerio-pipelines-api": {
16+
{
17+
slug: "customerio-pipelines-api",
2118
title: "Customer.io Pipelines API",
2219
href: "/en/resources/integrations/customer-support/customerio-pipelines-api",
20+
type: "arcade_starter",
2321
},
24-
"customerio-track-api": {
22+
{
23+
slug: "customerio-track-api",
2524
title: "Customer.io Track API",
2625
href: "/en/resources/integrations/customer-support/customerio-track-api",
26+
type: "arcade_starter",
2727
},
28-
"freshservice-api": {
28+
{
29+
slug: "freshservice-api",
2930
title: "Freshservice API",
3031
href: "/en/resources/integrations/customer-support/freshservice-api",
32+
type: "arcade_starter",
3133
},
32-
"intercom-api": {
34+
{
35+
slug: "intercom-api",
3336
title: "Intercom API",
3437
href: "/en/resources/integrations/customer-support/intercom-api",
38+
type: "arcade_starter",
3539
},
36-
};
37-
38-
export default meta;
40+
]);
Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,34 @@
1-
import type { MetaRecord } from "nextra";
1+
import { createCategoryMeta } from "../create-category-meta";
22

3-
const meta: MetaRecord = {
4-
"-- Optimized": {
5-
type: "separator",
6-
title: "Optimized",
7-
},
8-
clickhouse: {
3+
export default createCategoryMeta([
4+
{
5+
slug: "clickhouse",
96
title: "Clickhouse",
107
href: "/en/resources/integrations/databases/clickhouse",
8+
type: "community",
119
},
12-
mongodb: {
10+
{
11+
slug: "mongodb",
1312
title: "MongoDB",
1413
href: "/en/resources/integrations/databases/mongodb",
14+
type: "community",
1515
},
16-
postgres: {
16+
{
17+
slug: "postgres",
1718
title: "Postgres",
1819
href: "/en/resources/integrations/databases/postgres",
20+
type: "community",
1921
},
20-
"-- Starter": {
21-
type: "separator",
22-
title: "Starter",
23-
},
24-
"weaviate-api": {
22+
{
23+
slug: "weaviate-api",
2524
title: "Weaviate API",
2625
href: "/en/resources/integrations/databases/weaviate-api",
26+
type: "arcade_starter",
2727
},
28-
yugabytedb: {
28+
{
29+
slug: "yugabytedb",
2930
title: "YugabyteDB",
3031
href: "/en/resources/integrations/databases/yugabytedb",
32+
type: "arcade_starter",
3133
},
32-
};
33-
34-
export default meta;
34+
]);

0 commit comments

Comments
 (0)