#!/usr/bin/env tsx /** * Check and display release configuration and project status * * This script displays: * - Environment variables and their values * - Repository information * - Git tags and latest version * - Commits since last tag * - Configuration files status * * Usage: * tsx check-config.ts */ import type { ExecSyncOptions } from 'node:child_process'; import { existsSync, readFileSync } from 'node:fs'; export interface CheckConfigDeps { execSync: (command: string, options?: ExecSyncOptions) => Buffer | string; existsSync: typeof existsSync; readFileSync: typeof readFileSync; getEnv: (key: string) => string | undefined; log: (message: string) => void; } export declare function safeExec(command: string, deps: CheckConfigDeps): string | null; export declare function getEnvVar(name: string, deps: CheckConfigDeps, defaultValue?: string): string; export interface CheckConfigResult { envVars: Record; repoUrl: string | null; currentBranch: string | null; latestTag: string | null; commitCount: number; filesStatus: Record; npmUsername: string | null; } /** * Get current git branch */ export declare function getCurrentBranch(deps: CheckConfigDeps): string | null; /** * Get latest git tag */ export declare function getLatestTag(deps: CheckConfigDeps): string | null; /** * Get commit count since tag (or all commits if no tag) */ export declare function getCommitCount(deps: CheckConfigDeps, latestTag: string | null): number; /** * Get files status (existence check) */ export declare function getFilesStatus(deps: CheckConfigDeps): Record; /** * Get npm username (if logged in) */ export declare function getNpmUsername(deps: CheckConfigDeps): string | null; /** * Get all environment variables with defaults */ export declare function getEnvironmentVariables(deps: CheckConfigDeps): Record; export declare function checkConfig(deps: CheckConfigDeps): CheckConfigResult; export declare function displayEnvironmentVariables(envVars: Record): void; export declare function displayRepositoryInfo(deps: CheckConfigDeps, repoUrl: string | null, currentBranch: string | null): void; export declare function displayVersionAndTags(deps: CheckConfigDeps, latestTag: string | null): void; export declare function displayCommitsSinceLastTag(deps: CheckConfigDeps, latestTag: string | null): void; export declare function displayConfigurationFiles(deps: CheckConfigDeps, filesStatus: Record): void; export declare function displayNpmStatus(deps: CheckConfigDeps, npmUsername: string | null): void;