docs(integrations): add integration architecture guide and CLAUDE.md section#1044
docs(integrations): add integration architecture guide and CLAUDE.md section#1044
Conversation
nhopeatall
left a comment
There was a problem hiding this comment.
Summary
Documentation-only PR that adds a comprehensive integration architecture guide. The content is well-structured and mostly accurate against the source code. However, the Step 4 webhook route example shows a pattern that does not match the actual router implementation, which would mislead developers following the guide.
Should Fix
1. Inaccurate webhook route example (src/integrations/README.md, Step 4, lines ~229-242)
The Step 4 webhook route example shows:
app.post('/webhook/trello', verifyWebhookSignature('trello'), async (c) => {
const payload = await c.req.json();
return processRouterWebhook(c, 'trello', payload, trelloAdapter, triggerRegistry);
});But the actual implementation in src/router/index.ts uses a completely different pattern:
app.post('/trello/webhook', createWebhookHandler({
source: 'trello',
parsePayload: parseTrelloPayload,
verifySignature: verifyTrelloWebhookSignature,
processWebhook: async (payload) => {
const adapter = new TrelloRouterAdapter();
const result = await processRouterWebhook(adapter, payload, triggerRegistry);
return { processed: result.shouldProcess, projectId: result.projectId, decisionReason: result.decisionReason };
},
}));Three specific inaccuracies:
- URL paths are
/<provider>/webhook(e.g./trello/webhook), not/webhook/<provider> - Handler pattern uses
createWebhookHandler()with a config object (fromsrc/webhook/webhookHandlers.ts), not inlineverifyWebhookSignature()middleware processRouterWebhook()signature is(adapter, payload, triggerRegistry)— there is no Hono contextcor type string parameter
A developer following this guide would produce code that does not compile.
2. Stale "Adding New Triggers" section (CLAUDE.md, lines 655-659)
The pre-existing "Adding New Triggers" section says "Register in src/triggers/index.ts" but the new guide (correctly) says to register in src/triggers/builtins.ts. Now that this PR adds a detailed integration guide with the correct information, the old section is inconsistent. Consider updating it to match, or replacing it with a reference to the new guide.
🕵️ claude-code · claude-opus-4-6 · run details
…r registration reference - Correct webhook route pattern in README Step 4: URL is /<provider>/webhook (not /webhook/<provider>), handler uses createWebhookHandler() config object, and processRouterWebhook() signature is (adapter, payload, triggerRegistry) with no Hono context or type string parameter - Update CLAUDE.md "Adding New Triggers" to reference src/triggers/builtins.ts (via registerBuiltInTriggers()) instead of the stale src/triggers/index.ts, and add a cross-reference to the new README guide Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
nhopeatall
left a comment
There was a problem hiding this comment.
Summary
LGTM — thorough and accurate integration architecture documentation. All file paths, interface signatures, registry APIs, bootstrap patterns, and trigger registration patterns verified against the actual source code.
Minor Notes
One small inaccuracy in src/integrations/README.md Step 4: the guide states webhook URL paths follow /<provider>/webhook, but Sentry actually uses /sentry/webhook/:projectId (project-scoped URLs). This is a trivial documentation gap and doesn't affect usability — a developer adding a new integration would discover this from the router code and the Sentry adapter reference. Not worth blocking the PR.
The update to the "Adding New Triggers" section in CLAUDE.md (changing src/triggers/index.ts → src/triggers/builtins.ts and src/triggers/ → src/triggers/<provider>/) correctly reflects the actual codebase structure.
🕵️ claude-code · claude-opus-4-6 · run details
Summary
src/integrations/README.md— comprehensive "Adding a New Integration" guide covering all extension points: interface implementation, credential roles, bootstrap registration, webhook routes, router adapters, trigger handlers, and gadgetsCLAUDE.md— addedsrc/integrations/to Key Directories and a new "Integration Architecture" section describing theIntegrationModule→IntegrationRegistrypattern, categories (PM/SCM/Alerting), credential roles, and a reference to the README guideDetails
src/integrations/README.mdNew guide structured as:
PMIntegration), SCM (SCMIntegration), Alerting (AlertingIntegration) with method-level detailPMIntegration/SCMIntegration/AlertingIntegration)registerCredentialRoles()src/integrations/bootstrap.tssrc/router/index.tsRouterPlatformAdapterinsrc/router/adapters/<provider>.tssrc/triggers/<provider>/and wire intobuiltins.tsCLAUDE.mdsrc/integrations/bullet to Key DirectoriesIntegrationModulebase contract,IntegrationRegistryAPI, credential roles, bootstrap, and a link to the README guideTest plan
npm run lint— passes (documentation only, no code changes)npm run typecheck— passes (no TypeScript changes)src/integrations/,src/pm/trello/,src/github/scm-integration.ts,src/sentry/alerting-integration.ts,src/router/adapters/trello.ts,src/triggers/builtins.ts)Trello card: https://trello.com/c/69c1b0699e15862ec755e502
🤖 Generated with Claude Code
🕵️ claude-code · claude-sonnet-4-6 · run details