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.
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.
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.
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
Change the editor in
utils/dsa-cli/user_files/temp_settings.json
TODO: Add more usage examples
Commiting a code and pushing it to HEAD
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
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:
- Unique Term Identification: Each flashcard gets a unique 8-character hash based on its content (term + description + example)
- Completion Tracking: Every time you successfully complete a flashcard, the system increments its completion count
- Smart Selection: When selecting terms for study, the system prioritizes cards with fewer completions by randomnly choosing a sample of
sample_sizecards (configurale atsrc/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 testsTODO Explain the process of adding flashcards individually, or using the modules to add flashcards in bulk. (or even automatically)
mcli term
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.
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
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'
]
};module_path- Unique identifier for the module (must match folder name)ABOUT.title- Display name shown in deck selectionABOUT.skill_category- Category for filtering and organizationABOUT.author- Module author name
CACHE_CONTENT- Whether to cache markdown files locally (default:true)EXTERNAL_CONTENT_FOLDERS- Array of paths to external markdown foldersCONTENT_FOLDERS- Array of relative paths within the module folderCONTENT_FILES- Array of specific markdown files to includeUSE_FILE_AS_MODULE- Treat module as single deck (default:false)SORT_OPTION- Control term order during study sessions (default:'reversed')
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)
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'
]
};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")
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 answerFormat 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)
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
};Once created, your module will automatically appear in:
mcli ses- Study session deck selection- Daily deck generation
- Quiz selection
The system will:
- Load markdown files from specified folders
- Parse them into flashcard terms
- Cache them for faster subsequent loads
- Apply your configured sort option during study sessions
Math Problems:
mcli math
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
- Run
mastery --helpfor all commands - Each command has detailed prompts to guide you
- Settings are explained when you first run the tool
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\
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
index.js- Main entry pointsrc/constants.js- Configuration constantssrc/extensions/dsa-cli/- All algorithm-related codesrc/user_data/settings.json- User preferences
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
- Create a new extension in
src/extensions/ - Export your commands from the extension
- The main CLI will automatically discover them
TODO Explain this part better
- Create a new directory in
src/extensions/for your extension - Add your code files to this directory
- Export your commands from the extension
- The main CLI will automatically discover them

