# Grading with `ldcli`
1. Install [`ldcli`](https://github.com/FullstackAcademy/ldcli)
2. Login using the command `ldcli auth`
- Your credentials will be the ones you use to login to LMS with as these use the same API
## Background
The main commands that are used are:
- `clone-checkpoints` and it takes 2 arguments
- A cohort slug (i.e., 2006-fsa-rm-web-ft)
- A checkpoint slug (something you create in `src/checkpoints.js` in the `ldcli codebase`. Instructions below)
- `review code .`
- This opens up a website on `localhost:7085` where we can see a list of all the students' projects
## JPFP
The JPFP needs to be added to LMS as a checkpoint so we can generate the slug. We also need to manually add that ID to the `ldcli` codebase
1. Make a directory to download all the checkpoints/JPFP to
2. Grab the checkpoint hash from LMS
- Going to the "Checkpoints" tab on LMS
- Clicking on edit
- The slug is the hash in the URL (see image)

3. Go to `src/checkpoints.js` in the `ldcli` codebase and add to the `CHECKPOINTS` object:

4. Run `clone-checkpoints 2006-fsa-rm-web-ft jpfp-2006-rm`
NOTE: **The tool uses `ssh` to download everything. So, you may need to configure ssh for your Github. And since you will be cloning a lot of projects, you may want add your `ssh` key to the `ssh-agent` which basically prevents you from having to enter your password every clone**
- [Configure `ssh`](https://docs.github.com/en/github/authenticating-to-github/connecting-to-github-with-ssh)
- [Add key to `ssh-agent`](https://docs.github.com/en/github/authenticating-to-github/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent)
NOTE: **We can clone the checkpoints from students even if they haven't finished. This can be used to checkin with students during the project**
### Grading
1. Go into directory to grade and run:`ldcli review-code .`
Your directory should look like this:

The hash after the students' names is their LMS ID
2. It will open up something port 7085

3. Click on "review-code"

4. Click on the student you want to see

This page shows their commit history
5. Click on one of the commits. In this case, the most recent one.

This page shows different icons that show the metrics of the codebase. These metrics look for code patterns based on what we have taught them throughout Junior Phase. So, if we click on the `GET` icon, we can see all their `GET` routes

`ldcli` will look for the `router.get` pattern inside the server directory
NOTE: **This is very useful for getting a bird's eye view of the codebase but shouldn't be looked as a one-all end-all**