/**
 * TypeScriptStrategy - Warm-up strategy for TypeScript projects
 *
 * @see spec.md US-001: Language-Aware Warm-up
 * @satisfies AC-US1-01, AC-US1-02
 */
const MAX_FILES = 10;
/**
 * Get directory from file path (cross-platform)
 */
function getDirectory(filePath) {
    const lastSlash = Math.max(filePath.lastIndexOf('/'), filePath.lastIndexOf('\\'));
    return lastSlash > 0 ? filePath.substring(0, lastSlash) : filePath;
}
export class TypeScriptStrategy {
    constructor(fs) {
        this.language = 'typescript';
        this.fs = fs;
    }
    async detectProjectRoot(startDir) {
        const tsconfigPath = await this.fs.findUp('tsconfig.json', startDir);
        if (tsconfigPath) {
            this.projectRoot = getDirectory(tsconfigPath);
            return this.projectRoot;
        }
        const packagePath = await this.fs.findUp('package.json', startDir);
        if (packagePath) {
            this.projectRoot = getDirectory(packagePath);
            return this.projectRoot;
        }
        return null;
    }
    async getFilesToOpen(projectRoot) {
        const files = await this.fs.glob('*.ts', projectRoot);
        return files.slice(0, MAX_FILES);
    }
}
//# sourceMappingURL=typescript.js.map