UNPKG

hackages

Version:

CLI tool for learning software development concepts through test-driven development

93 lines (92 loc) 4.36 kB
import { TechnologyConfig, ExerciseFiles, LearningGoal } from "../types/index.js"; export declare function createDirectories(): void; export declare function generateImplementationTemplate(tech: string, goal: string): string; export declare function createExerciseFiles(goal: string, exerciseContent: { testContent: string; srcContent: string; }, techConfig: TechnologyConfig): ExerciseFiles; export declare function getImplementationFile(): string | null; /** * Gets all source files from the src directory for code review * @returns Object containing all source files with their content */ export declare function getAllSourceFiles(): { [filename: string]: string; } | null; export declare function exerciseFilesExist(): boolean; /** * Elegantly displays feedback in the terminal, supporting markdown-like headers, code blocks, and lists. * @param feedback The feedback string to display */ export declare function displayFeedback(feedback: string): void; /** * Saves feedback to a markdown file in the user's ~/.hackages directory. * The file is unique per learning session (by identifier). * Code blocks in the feedback are tagged with the technology for syntax highlighting. * * @param feedback The feedback string to save * @param technology The technology name (e.g., 'typescript', 'javascript') for code block highlighting * @param identifier A unique identifier for the learning session (e.g., exercise name, timestamp, or hash) * @returns The path to the saved markdown file */ export declare function saveFeedbackToMarkdown(feedback: string, technology: string, identifier: string): string; /** * Clones a repository template for the given technology * @param techConfig Technology configuration with repository URLs * @param exerciseName Name for the exercise directory * @returns Path to the cloned repository */ export declare function cloneRepositoryTemplate(techConfig: TechnologyConfig, exerciseName: string): string; /** * Creates exercise files in a cloned repository template * @param goal Learning goal * @param exerciseContent Generated exercise content * @param techConfig Technology configuration * @param repoPath Path to the cloned repository * @returns Exercise files information */ export declare function createExerciseFilesInRepository(goal: string, exerciseContent: { testContent: string; srcContent: string; }, techConfig: TechnologyConfig, repoPath: string): ExerciseFiles; export declare function getLearningInformation(): LearningGoal; /** * Find the directory containing exercise files (either current directory or a subdirectory) * @returns Path to the directory containing exercise files, or current directory if not found */ export declare function findExerciseDirectory(): string; /** * Saves feedback to the template folder's feedback directory * @param feedback The feedback string to save * @param exerciseNumber The exercise number (default: 1) * @returns Path to the saved feedback file */ export declare function saveFeedbackToTemplate(feedback: string, exerciseNumber: number | undefined, selectedTech: string): string | null; /** * Generates a beautiful HTML page for displaying feedback * @param feedback The feedback content * @param exerciseNumber The exercise number (default: 1) * @returns Path to the generated HTML file */ export declare function generateFeedbackHTML(feedback: string, exerciseNumber?: number): string; /** * Opens the feedback HTML page in the default browser * @param htmlFilePath Path to the HTML file */ export declare function openFeedbackHTML(htmlFilePath: string): void; /** * Creates the next exercise in the same repository * @param learningGoal The learning goal for the next exercise * @param exerciseNumber The exercise number (e.g., 2 for exercise-2) */ export declare function createNextExercise(learningGoal: LearningGoal, exerciseNumber: number): Promise<void>; /** * Checks if there's previous feedback available for the current exercise * @returns Array of learning suggestions if feedback exists, null otherwise */ export declare function getPreviousLearningSuggestions(): string[] | null; /** * Handles the next learning flow with prompts and exercise generation * @param suggestions Array of learning suggestions */ export declare function handleNextLearning(suggestions: string[]): Promise<void>;