@iprep/shared

v1.1.4

Published

Shared types and constants for iPrep

Downloads

41

Readme

@iprep/shared

Shared constants, utilities, and path resolvers used across all iPrep packages and applications.

Contents

Constants

  • TUTORS — tutor IDs (english-coach, interview-prep, client-communication)
  • DEFAULT_TUTORS — default tutor config objects
  • ROLES — message roles (user, assistant, system)
  • MESSAGE_TYPES — message type constants
  • CLAUDE_TIMEOUT_MS — timeout for Claude CLI calls
  • API and config constants

Path Resolver

  • IPREP_HOME — resolved path to ~/.iprep/ (cross-platform)
  • IprepPaths — canonical paths for all iPrep user data:
    • IprepPaths.root~/.iprep/
    • IprepPaths.aitutors~/.iprep/aitutors/
    • IprepPaths.database~/.iprep/database/
    • IprepPaths.dbFile~/.iprep/database/iprep.db
    • IprepPaths.docs~/.iprep/docs/

Utilities

  • isValidTutorId(id) — validates a tutor ID against known tutors
  • isValidUserId(id) — validates a user ID string
  • formatters — shared formatting helpers
  • logger — shared logger instance

Usage

import { TUTORS, ROLES, MESSAGE_TYPES, IprepPaths, isValidTutorId } from '@iprep/shared';

// Constants
console.log(TUTORS.ENGLISH_COACH); // 'english-coach'

// Path resolver (works on Windows, macOS, Linux)
console.log(IprepPaths.dbFile);    // e.g. /home/user/.iprep/database/iprep.db

// Validation
if (!isValidTutorId(tutorId)) throw new Error('Invalid tutor');

Why IprepPaths?

Both the CLI and the server need to agree on where user data lives. IprepPaths is the single source of truth — import it instead of constructing paths manually.