Skip to content

Add JSDoc comments to core library functions #16

@BunsDev

Description

@BunsDev

Problem

Core files in lib/opentrust/ lack documentation comments. This makes it harder to:

  • Understand function contracts without reading the implementation
  • Get useful IntelliSense/hover info in editors
  • Onboard new contributors

Scope

Add JSDoc comments to all exported functions in:

  • lib/opentrust/db.ts — connection management, query helpers
  • lib/opentrust/memory-api.ts — search, inspect, promote operations
  • lib/opentrust/memory-entries.ts — CRUD operations and versioning
  • lib/opentrust/auth.ts — auth config, verification, credential checking
  • lib/opentrust/api-contract.ts — request parsing and response helpers
  • lib/opentrust/semantic.ts — embedding and chunking
  • lib/opentrust/import-openclaw.ts — session ingestion
  • lib/opentrust/import-cron.ts — cron workflow ingestion
  • lib/opentrust/ingestion-state.ts — cursor state management
  • lib/opentrust/search.ts — FTS search
  • lib/types.ts — shared TypeScript interfaces

JSDoc Format

/**
 * Searches memory entries using full-text and optional semantic search.
 *
 * @param query - The search query string (supports FTS5 syntax)
 * @param options - Optional filters: status, retention class, date range
 * @returns Paginated list of matching memory entries with relevance scores
 * @throws {DatabaseError} If the search query is malformed
 *
 * @example
 * const results = await memorySearch("authentication flow", { status: "approved" });
 */

Acceptance Criteria

  • All exported functions have JSDoc with description, @param, and @returns
  • Complex functions include @example usage
  • Functions that throw include @throws
  • pnpm typecheck still passes

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentationdxDeveloper experiencegood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions