Skip to content

Your assistant to improve as a programmer. Flashcards, DSA Practice, Statistics, and habit hooks.

n3wang/mastery-cli

Repository files navigation

Mastery CLI

Docs: https://nenewang.github.io/mastery-cli/ compiled build: https://k00.fr/lak37m7l

Mastery CLI: Your Command Line Assistant for Programmer Development"

Mastery CLI is a ghost tool* designed to boost your programming/engineering skills. It features flashcards, DSA practice, statistics, and habit hooks. For instance, every commit now triggers a random flashcard or suggests a DSA problem to solve, fostering continuous learning.

features img
Convert your Markdown Notes into Flashcards alt text
Upgrade your skills, and keep record of your progress with Mastery CLI. alt text
Auto flashcards deck sort algorithm that prioritizes the ones you need to study most using "least practiced first" algorithm add image
Pushing Code and Flashcards Hook - Taking a page from cd ci pipelines, upgrade your skills by doing 2-3 flashcards after every commit or push with mcli coa "message" (git add --all, git commit -m "message" ) or mcli poh (push origin HEAD)
mcli dsa --all - checkout over more than 150+ offline data structures and algorithms problems, with a built-in compiler and offline tests. alt text
cli dsa - Use our algorithmic path to learn and master neetcode 150 problems one b one alt text
mcli ses - Create a session for mastery an entire flashcards decks. (useful for studying for exams) alt text

Key Highlights:

  • Easily track personal project goals, such as daily commits.
  • Access over 150 offline programming problems with accompanying offline tests and a built-in compiler.
  • Utilize an offline algorithm that identifies weaknesses and generates quick flashcards for memory refresh.
  • Preloaded with flascard decks from Computer Science Architecture, Networking, AWS, System Design, Design Patterns classes.

Install and Test.

npm install -g mastery-cli
mcli report
mcli quiz
mcli report
  • You need to install nvim for the dsa option to work
  • Eventually you would be able to select your own editor.

Currently under development.

  • We are cleaning up the codebase, and adding more features.
  • Currently 100% offline. So that this can be used in corporate environments. (not sending any data to the cloud, and all is local)
  • We are removing unused libraries to keep it as clean as possible, some libraries use local ones that you might need to install using:
npm install file:custom_modules/node-json-db-1.0.1
npm install file:custom_modules/terminal-charter-master

Setup your editor in utils/dsa-cli/user_files/temp_settings.json to use your preferred editor for DSA problems.

Help

We support multiple ways to call the cli, for instance, you can use mastery-cli, mastery, or mcli to access the tool.

Supported calls:

mcli
mastery
m-cli

Settings.

Change the editor in

utils/dsa-cli/user_files/temp_settings.json

Usage

TODO: Add more usage examples

Commiting a code and pushing it to HEAD

Skills Integration

Now you can track locally the type of cards you are studying, and the type of problems you are solving. You will be able to see the progress of your skills, and the type of problems you are solving.

mcli skill

TODO Explain the skill system and the skill leveling up system, as well as how the skills report distributes by dates and the type of problems you are solving.

TODO add images of skill report with arrows explaining.

TODO Add the

Smart Term Selection - Train cards and distribute them based on practice history

an intelligent term selection system that remembers which flashcards you've practiced and prioritizes the ones you need to study most.

How It Works:

The system uses content-based hashing to track your practice history:

  1. Unique Term Identification: Each flashcard gets a unique 8-character hash based on its content (term + description + example)
  2. Completion Tracking: Every time you successfully complete a flashcard, the system increments its completion count
  3. Smart Selection: When selecting terms for study, the system prioritizes cards with fewer completions by randomnly choosing a sample of sample_size cards (configurale at src/user_data/settings.json) and selecting the one with the least completions. Can be enabled/disabled

Run the tests:

npx mocha tests/test_hash_storage.test.js          
#  Hash storage tests

npx mocha tests/test_quizzler.test.js              
# Quizzer integration tests

Flashcards

TODO Explain the process of adding flashcards individually, or using the modules to add flashcards in bulk. (or even automatically)

mcli term

Creating Custom Term Modules

Term modules allow you to organize flashcards into reusable decks. Each module is a folder in src/data/user_data/terms_modules/ with an index.js configuration file.

Module Structure

src/data/user_data/terms_modules/
└── your-module-name/
    ├── index.js           # Module configuration
    ├── cache.json         # Cached terms (auto-generated)
    └── cache_md/          # Cached markdown files (auto-generated)
        └── *.md

Basic Module Configuration

Create an index.js file with the following structure:

const ABOUT = {
	title: 'Your Module Title',
	skill_category: 'category-name',
	author: 'your-name'
};

module.exports = {
	module_path: 'your-module-name',
	ABOUT: ABOUT,
	CACHE_CONTENT: true,
	EXTERNAL_CONTENT_FOLDERS: [
		'path/to/your/markdown/files'
	]
};

Configuration Options

Required Fields

  • module_path - Unique identifier for the module (must match folder name)
  • ABOUT.title - Display name shown in deck selection
  • ABOUT.skill_category - Category for filtering and organization
  • ABOUT.author - Module author name

Optional Fields

  • CACHE_CONTENT - Whether to cache markdown files locally (default: true)
  • EXTERNAL_CONTENT_FOLDERS - Array of paths to external markdown folders
  • CONTENT_FOLDERS - Array of relative paths within the module folder
  • CONTENT_FILES - Array of specific markdown files to include
  • USE_FILE_AS_MODULE - Treat module as single deck (default: false)
  • SORT_OPTION - Control term order during study sessions (default: 'reversed')

Sort Options

The SORT_OPTION controls how terms are presented during study sessions:

  • 'reversed' (default) - Terms in reverse order (newest first, best for reviewing recent additions)
  • 'ordered' - Terms in original order (oldest first, best for sequential learning)
  • 'random' - Terms shuffled randomly (best for testing knowledge without patterns)
  • 'duplicate' - Terms appear twice: first ordered, then reversed (best for intensive practice)

Example with Sort Option

module.exports = {
	module_path: 'exam-prep',
	ABOUT: {
		title: 'Exam Preparation',
		skill_category: 'exam',
		author: 'student'
	},
	SORT_OPTION: 'random', // Randomize for better testing
	EXTERNAL_CONTENT_FOLDERS: [
		'E:\\Documents\\study-notes\\exam-review'
	]
};

Nested Deck Support

Modules support hierarchical organization through folder structures:

your-module-name/
└── cache_md/
    ├── chapter1.md
    ├── chapter2.md
    └── advanced/
        ├── topic1.md
        └── topic2.md
            └── subtopic/
                └── details.md

Each folder level creates a nested deck, allowing you to:

  • Organize content by topic/chapter
  • Select entire sections or individual sub-topics
  • See nested deck count in selection UI (e.g., "Module - 100 cards - 3N")

Markdown Format

Flashcards use a specific markdown format:

# Module Title

## Category Header

Description paragraph

:p Question or prompt

??x
Multi-line answer
x??

## Another Term

term::short answer

#### Titled Entry

Description here

:p What is this?

?x
Single line answer

Format elements:

  • ## - Section headers
  • #### - Creates titled flashcard entries
  • :p - Question/prompt marker
  • ??x...x?? - Multi-line answer block
  • ?x - Single-line answer
  • :: - Inline format (term::answer)

Complete Example

const ABOUT = {
	title: 'Computer Science Fundamentals',
	skill_category: 'cs-fundamentals',
	author: 'n3wang'
};

const EXTERNAL_CONTENT_FOLDERS = [
	'E:\\Documents\\obsidian\\cs-notes\\algorithms',
	'E:\\Documents\\obsidian\\cs-notes\\data-structures'
];

module.exports = {
	module_path: 'cs-fundamentals',
	ABOUT: ABOUT,
	CACHE_CONTENT: true,
	EXTERNAL_CONTENT_FOLDERS: EXTERNAL_CONTENT_FOLDERS,
	SORT_OPTION: 'reversed', // Show newest terms first
	USE_FILE_AS_MODULE: false
};

Using Your Module

Once created, your module will automatically appear in:

  • mcli ses - Study session deck selection
  • Daily deck generation
  • Quiz selection

The system will:

  1. Load markdown files from specified folders
  2. Parse them into flashcard terms
  3. Cache them for faster subsequent loads
  4. Apply your configured sort option during study sessions

Math Problems:

mcli math

Data Structures and Algorithms

By default we include a datastructure algorithms module with over 150+ problems, and a built-in compiler to test your code. For more information about how to use it please refer to EXTERNAL_DSA_PROBLEMS.md

TODO Explain in depth the dsa system. And how to add new problems to the collection.

TODO Explain the Cloze Demo, Cloze Sessions and others.

We have a collection of DSA problems that you can solve.

View DSA problems:

mcli dsa
  • We keep track of solved problems, as well as new problems.

View all DSA Problems

mcli dsa --all

Need Help?

  • Run mastery --help for all commands
  • Each command has detailed prompts to guide you
  • Settings are explained when you first run the tool

For Developers

Feel free to take a card at: https://github.com/users/n3wang/projects/3/views/2 And contribute

git update-index --assume-unchanged src\extensions\dsa-cli\user_files\

Project Structure

src/
├── extensions/          # Feature modules
│   └── dsa-cli/        # Algorithm practice features
├── terms_data/         # Built-in flashcard content
├── user_data/          # Your personal settings and progress
└── utils/              # Helper functions

Key Files

  • index.js - Main entry point
  • src/constants.js - Configuration constants
  • src/extensions/dsa-cli/ - All algorithm-related code
  • src/user_data/settings.json - User preferences

Queue Configuration

You can customize queue lengths and behavior for various core features by modifying src/user_data/settings.json:

{
  "queue_configurations": {
    "quizzer_repetitive_limit": 3,           // Max repetitive questions in Quizzer
    "quizzer_force_learn_limit": 2,          // Force learn limit in Quizzer  
    "quizzer_force_learn_last_three": 3,     // Last items to process in force learn mode
    "term_scheduler_working_set_length": 5,  // Working set size for Terms Scheduler
    "mini_term_scheduler_working_set_length": 3, // Working set size for Mini Term Scheduler
    "quiz_allow_reattempts": 3,              // Number of allowed reattempts for quiz questions
    "hash_based_selection": {
      "enabled": true,                       // Enable smart term selection
      "sample_size": 15,                     // Terms to sample for selection (10-20 recommended)
      "hash_length": 8                       // Hash length for term identification
    }
  }
}

These settings control the behavior of:

  • Quizzer.js (src/Quizzer.js): Controls repetitive questions, force learning modes, and smart term selection
  • HashStorage (src/HashStorage.js): Manages hash-based term completion tracking and intelligent selection
  • TermScheduler (src/termScheduler.js): Manages working set length for term learning
  • MiniTermScheduler (src/MiniTermScheduler.js): Controls working set for mini term sessions

Adding New Features

  1. Create a new extension in src/extensions/
  2. Export your commands from the extension
  3. The main CLI will automatically discover them

Adding Extensions

TODO Explain this part better

  1. Create a new directory in src/extensions/ for your extension
  2. Add your code files to this directory
  3. Export your commands from the extension
  4. The main CLI will automatically discover them

About

Your assistant to improve as a programmer. Flashcards, DSA Practice, Statistics, and habit hooks.

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •