SuperAPI AI 工具集

codebase-explorer

编程与开发

查看项目

更新于 10-15 18:45

技能介绍

用途:帮助用户理解 Empathy Ledger 代码库的架构、数据流与系统关系,回答“X 在哪里”“X 如何连接到 Y”等问题。

主要能力:解释数据库模式(表、关系、迁移);梳理数据流(Supabase → Services → API Routes → Components);说明服务层业务逻辑模式;列出 API 路由及用途;指出各领域类型定义位置;解释多租户隔离。

关键结构:类型文件按领域划分,如用户 profile 在 src/types/database/user-profile.ts,组织在 organization-tenant.ts,项目在 project-management.ts,故事内容在 content-media.ts,分发在 story-ownership.ts,文化安全在 cultural-sensitivity.ts,位置在 location-events.ts,分析在 analysis-support.ts。Supabase 客户端分浏览器 client.ts、服务端 client-ssr.ts、服务角色 service-role-client.ts(绕过 RLS)。核心服务位于 src/lib/services/,如 consent、distribution、revocation、embed、organization、audit、gdpr、webhook。API 路由位于 src/app/api/,涵盖 stories、consent、distributions、revoke、storytellers、projects、transcripts、embed、admin 等。

数据流:用户操作(React 组件)→ fetch('/api/endpoint') → API 路由 → 服务层 → Supabase 客户端(RLS)→ PostgreSQL 迁移。

多租户:查询按 tenant_id 过滤,示例代码为 const profile = await supabase.from('profiles').select('tenant_id').eq('id', user.id).single() 以及 query = query.eq('tenant_id', profile.tenant_id)。角色层级从高到低为 elder(100)、cultural_keeper(90)、admin(70)、project_leader(60)、storyteller(50)、community_member(40)、guest(10)。

常用探索命令保持原样:ls src/lib/services/;ls src/app/api/stories/;cat src/types/database/index.ts;ls -la supabase/migrations/ | tail -5;grep -r "from('stories')" src/;ls src/components/stories/。

输出格式:提供带链接的文件位置、表/服务关键关系、模式代码片段、ASCII 或 markdown 表格图示。限制:资料仅针对 Empathy Ledger 这一特定代码库,命令均以该仓库目录结构为前提;未提供其他代码库适用性、安装步骤、收费或价格信息。