@eddydesk/core

中文文档
0.13.4发布于 2026/09/16MITTypeScriptESM + CJS近 30 天下载 4603

Core utilities and types for EddyDesk QA platform

原始使用文档
文档目录10 节
  1. Installation
  2. Usage
  3. Configuration
  4. AppContext
  5. Automatic Context Capture
  6. Manual Capture (framework authors)
  7. Client Methods
  8. Types
  9. Issue Tracking
  10. For Framework Authors

@eddydesk/core

Core client and utilities for EddyDesk QA platform.

Note: Most users should install @eddydesk/react or @eddydesk/react-native instead, which include this package automatically.

Installation

npm install @eddydesk/core

Usage

import { createEddyDesk } from '@eddydesk/core';

const eddydesk = createEddyDesk({
  projectId: 'your-project-id',
  getCurrentUser: async () => ({
    id: 'user-123',
    email: '[email protected]',
    name: 'Jane Doe', // Optional, used for reporter identity
  }),
});

// Submit a report
await eddydesk.submitReport({
  type: 'bug',
  description: 'Button does not work',
  severity: 'high',
  appContext: { currentRoute: '/dashboard' },
});

// Check if user is a tester
const isTester = await eddydesk.isTester();

// Get assigned test cases
const assignments = await eddydesk.getAssignedTests();

Configuration

interface EddyDeskConfig {
  // Required
  projectId: string;
  getCurrentUser: () => Promise<{ id: string; email: string; name?: string } | null>;

  // Optional — context
  getAppContext?: () => AppContext;          // Rich app context (userRole, etc.)
  getNavigationHistory?: () => string[];    // Custom navigation tracking

  // Optional — callbacks
  onReportSubmitted?: (report: EddyDeskReport) => void;
  onNavigate?: (route: string) => void;     // Deep linking from test cases

  // Optional — self-hosted
  supabaseUrl?: string;
  supabaseAnonKey?: string;
}

AppContext

Provide getAppContext to attach rich context to every bug report. This helps the developer fixing the bug understand the user's state:

const eddydesk = createEddyDesk({
  projectId: 'your-project-id',
  getCurrentUser: async () => ({ id: user.id, email: user.email }),
  getAppContext: () => ({
    currentRoute: window.location.pathname,
    userRole: currentUser?.role,       // e.g. 'owner', 'manager', 'guest'
    propertyId: currentProperty?.id,   // App-specific context
    custom: {                          // Any additional context
      theme: 'dark',
      locale: 'en-US',
    },
  }),
});

Automatic Context Capture

EddyDesk automatically captures debugging context when initialized via EddyDeskProvider (React or React Native). No manual setup required.

What's captured automatically:

DataDetails
Console logsLast 50 console.log/warn/error/info calls
Network requestsLast 20 fetch() calls with method, URL, status, duration
Failed response bodiesFirst 500 chars of response body for 4xx/5xx errors
Navigation historyLast 20 route changes (via pushState/replaceState/popstate)
Performance metricsPage load time, memory usage (Chrome)
EnvironmentLanguage, timezone, online status, cookies, localStorage

This data is attached to every bug report as enhanced_context and is available to the MCP server's get_report_context tool.

Manual Capture (framework authors)

If you're not using EddyDeskProvider, start capture manually:

import { contextCapture } from '@eddydesk/core';

// Start capturing (call once at app init)
contextCapture.startCapture();

// For React Native: manually track screen changes
contextCapture.trackNavigation('/home');
contextCapture.trackNavigation('/settings');

// Get captured data (automatically included in submitReport)
const context = contextCapture.getEnhancedContext();

Client Methods

MethodDescription
submitReport(report)Submit a bug report, feedback, or test result
isTester()Check if current user is a registered tester
isQAEnabled()Check if QA mode is enabled for the project
shouldShowWidget()Check if widget should be visible (QA enabled + is tester)
getTesterInfo()Get current tester's info
getAssignedTests()Get test cases assigned to current tester
getAppContext()Get current app context (uses config callback or auto-captured)
getNavigationHistory()Get navigation history (config callback > manual > auto-captured)
trackNavigation(route)Manually track a route change
getIssueCounts()Get issue counts by category (open, done, reopened)
getIssues(category)Get enriched issue list with verification proof and original bug context
uploadScreenshot(file)Upload a screenshot

Types

interface EddyDeskReport {
  type: 'bug' | 'feedback' | 'suggestion' | 'test_pass' | 'test_fail';
  description: string;
  title?: string;
  severity?: 'critical' | 'high' | 'medium' | 'low';
  screenshots?: string[];
  appContext?: AppContext;
  enhancedContext?: EnhancedBugContext;
}

interface AppContext {
  currentRoute: string;
  screenName?: string;
  userRole?: string;
  propertyId?: string;
  custom?: Record<string, unknown>;
}

interface TesterInfo {
  id: string;
  name: string;
  email: string;
  assignedTests: number;
  completedTests: number;
}

interface TestAssignment {
  id: string;
  status: string;
  testCase: {
    id: string;
    title: string;
    description: string;
    steps: TestStep[];
    expectedResult: string;
    priority: string;
  };
}

type IssueCategory = 'open' | 'done' | 'reopened';

interface IssueCounts {
  open: number;
  done: number;
  reopened: number;
}

interface TesterIssue {
  id: string;
  title: string;
  description: string;
  reportType: ReportType;
  severity: Severity | null;
  status: ReportStatus;
  screenshotUrls: string[];
  route?: string;
  reporterName?: string;
  createdAt: string;
  updatedAt: string;
  verifiedByName?: string;   // Who retested (done issues)
  verifiedAt?: string;       // When verification passed (done issues)
  originalBugId?: string;    // Original report ID (reopened issues)
  originalBugTitle?: string; // Original bug title (reopened issues)
}

Issue Tracking

The SDK provides methods for testers to track their bug lifecycle:

// Get counts for issue cards (open, done, reopened)
const counts = await eddydesk.getIssueCounts();
// { open: 3, done: 12, reopened: 1 }

// Get enriched issue list by category
const openIssues = await eddydesk.getIssues('open');
const doneIssues = await eddydesk.getIssues('done');
const reopenedIssues = await eddydesk.getIssues('reopened');

// Done issues include verification proof
doneIssues[0].verifiedByName;  // "Jane Doe"
doneIssues[0].verifiedAt;      // "2026-02-05T12:00:00Z"

// Reopened issues include original bug context
reopenedIssues[0].originalBugTitle;  // "Login button unresponsive"
reopenedIssues[0].originalBugId;     // "uuid-of-original-report"

For Framework Authors

If you're building a EddyDesk integration for a different framework (Vue, Svelte, etc.), use this package as the foundation:

import { EddyDeskClient, createEddyDesk, contextCapture, EddyDeskConfig } from '@eddydesk/core';

// Start context capture at app init
contextCapture.startCapture();

// Create your framework-specific wrapper around the client
const client = createEddyDesk(config);

版本与发布记录

@eddydesk/core 共发布 7 个版本,首次发布于 2026/05/01;过去 12 个月发布了 7 个版本。

版本发布日期距今
0.13.4latest2026/09/161 个月前
0.13.32026/09/141 个月前
0.13.22026/08/083 个月前
0.13.12026/08/073 个月前
0.13.02026/08/063 个月前
0.12.02026/05/215 个月前

关于 @eddydesk/core 的常见问题

@eddydesk/core 是什么?

Core utilities and types for EddyDesk QA platform

如何安装 @eddydesk/core?

在项目目录运行 npm install @eddydesk/core,或使用 pnpm add / yarn add / bun add。

@eddydesk/core 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@eddydesk/core 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@eddydesk/core 可以商用吗?

@eddydesk/core 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@eddydesk/core 的下载量有多少?

根据 npm 官方下载统计,@eddydesk/core 在 2026/10/13 – 2026/11/11 这 30 天内被下载 4,603 次,日均约 153 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@eddydesk/core 还在维护吗?

最新版本 0.13.4 发布于 2026/09/16(1 个月前);至今共发布 7 个版本,其中过去 12 个月发布了 7 个;首次发布于 2026/05/01。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。