Skip to content
Merged
5 changes: 0 additions & 5 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,3 @@ If any of the above commands fail or show errors:
- `api.workflow.*` - Workflow CRUD and operations (create, update, delete, deploy, execute, etc.)
- **No Barrel Files**: Do not create barrel/index files that re-export from other files

## Plugin Guidelines
- **No SDK Dependencies**: Plugin step files must use `fetch` directly instead of SDK client libraries. Do not add npm package dependencies for API integrations.
- **No dependencies field**: Do not use the `dependencies` field in plugin `index.ts` files. All API calls should use native `fetch`.
- **Why**: Using `fetch` instead of SDKs reduces supply chain attack surface. SDKs have transitive dependencies that could be compromised.

1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ Visit [http://localhost:3000](http://localhost:3000) to get started.

<!-- PLUGINS:START - Do not remove. Auto-generated by discover-plugins -->
- **AI Gateway**: Generate Text, Generate Image
- **Clerk**: Get User, Create User, Update User, Delete User
- **Firecrawl**: Scrape URL, Search Web
- **Linear**: Create Ticket, Find Issues
- **Resend**: Send Email
Expand Down
3 changes: 3 additions & 0 deletions app/api/ai/generate/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,9 @@ Edge structure:
"type": "default"
}

TEMPLATE VARIABLES: To reference data from another node, use {{@nodeId:Label.field}}
Example: If node id="create-user" label="Create User" returns {user: {id: "..."}}, reference it as {{@create-user:Create User.user.id}}

WORKFLOW FLOW:
- Trigger connects to first action
- Actions connect in sequence or to multiple branches
Expand Down
54 changes: 54 additions & 0 deletions app/api/integrations/[integrationId]/test/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ export async function POST(
integration.config.superagentApiKey
);
break;
case "clerk":
result = await testClerkConnection(integration.config.clerkSecretKey);
break;
default:
return NextResponse.json(
{ error: "Invalid integration type" },
Expand Down Expand Up @@ -375,3 +378,54 @@ async function testSuperagentConnection(
};
}
}

async function testClerkConnection(
secretKey?: string
): Promise<TestConnectionResult> {
try {
if (!secretKey) {
return {
status: "error",
message: "Secret key is required",
};
}

// Validate key format
if (
!(secretKey.startsWith("sk_live_") || secretKey.startsWith("sk_test_"))
) {
return {
status: "error",
message:
"Invalid secret key format. Must start with sk_live_ or sk_test_",
};
}

// Test by fetching users list
const response = await fetch("https://api.clerk.com/v1/users?limit=1", {
headers: {
Authorization: `Bearer ${secretKey}`,
"Content-Type": "application/json",
"User-Agent": "workflow-builder.dev",
},
});

if (!response.ok) {
const error = await response.json().catch(() => ({}));
return {
status: "error",
message: error.errors?.[0]?.message || "Authentication failed",
};
}

return {
status: "success",
message: "Connection successful",
};
} catch (error) {
return {
status: "error",
message: error instanceof Error ? error.message : "Connection failed",
};
}
}
Loading