UNPKG

@dollhousemcp/mcp-server

Version:

DollhouseMCP - A Model Context Protocol (MCP) server that enables dynamic AI persona management from markdown files, allowing Claude and other compatible AI assistants to activate and switch between different behavioral personas.

82 lines 3.23 kB
/** * Portfolio configuration utilities * Handles repository name configuration for portfolio sync */ /** * Validates a GitHub repository name against GitHub's naming requirements. * * GitHub repository names must: * - Contain only alphanumeric characters, hyphens, underscores, and dots * - Not contain slashes (use PORTFOLIO_REPOSITORY_NAME instead of owner/repo format) * - Not be empty or only whitespace * * @param name - The repository name to validate * @returns The trimmed repository name if valid * @throws Error if the repository name is invalid with guidance on how to fix it * * @example * // Valid repository names * validateRepositoryName('dollhouse-portfolio'); // 'dollhouse-portfolio' * validateRepositoryName('my_repo.test'); // 'my_repo.test' * validateRepositoryName(' repo-123 '); // 'repo-123' (trimmed) * * @example * // Invalid repository names (throw errors) * validateRepositoryName('owner/repo'); // Error: contains slash * validateRepositoryName(''); // Error: empty * validateRepositoryName('repo@name'); // Error: invalid character */ export declare function validateRepositoryName(name: string | undefined): string; /** * Get the configured portfolio repository name. * * Priority order: * 1. PORTFOLIO_REPOSITORY_NAME environment variable (preferred, dedicated config) * 2. GITHUB_REPOSITORY environment variable (legacy, deprecated for portfolio use) * - Only used if it doesn't contain '/' (not in GitHub Actions "owner/repo" format) * - Shows deprecation warning * 3. TEST_GITHUB_REPO environment variable (deprecated, backward compatibility) * 4. GITHUB_TEST_REPO environment variable (deprecated, backward compatibility) * 5. TEST_PORTFOLIO_REPO environment variable (deprecated, backward compatibility) * 6. Default: 'dollhouse-portfolio' * * @returns The configured portfolio repository name (validated) * @throws Error if any configured name is invalid * * @example * // Default usage (no env vars set) * const repo = getPortfolioRepositoryName(); // 'dollhouse-portfolio' * * @example * // With PORTFOLIO_REPOSITORY_NAME (preferred) * process.env.PORTFOLIO_REPOSITORY_NAME = 'my-portfolio'; * const repo = getPortfolioRepositoryName(); // 'my-portfolio' * * @example * // With legacy GITHUB_REPOSITORY (shows deprecation warning) * process.env.GITHUB_REPOSITORY = 'my-portfolio'; * const repo = getPortfolioRepositoryName(); // 'my-portfolio' + warning * * @example * // Error: GITHUB_REPOSITORY in GitHub Actions format * process.env.GITHUB_REPOSITORY = 'owner/repo'; * getPortfolioRepositoryName(); // throws Error with migration guidance */ export declare function getPortfolioRepositoryName(): string; /** * Check if we're in a test environment * * @example * // When NODE_ENV=test * process.env.NODE_ENV = 'test'; * const isTest = isTestEnvironment(); // true * * @example * // In production environment * process.env.NODE_ENV = 'production'; * const isTest = isTestEnvironment(); // false * * @returns {boolean} True if running in a test environment */ export declare function isTestEnvironment(): boolean; //# sourceMappingURL=portfolioConfig.d.ts.map