Fall 2026
  • Discord
  • Gradescope
  • Syllabus

On this page

  • Start
  • Inspect the Folder
  • Locate the Flag
  • Write the Cleanup
  • Count the Remaining Work
  • Save the Inventory
  • Practice a Clean Project
  • The Same Commands in Project 3
  • Submit
  • Grading Rubric

Lab: The Messy Repo

Due: Wednesday, October 21 at 11:59pm (one week after it is assigned) · Worth: 8 points

A classmate is inheriting a repository full of scattered homework, old notes, and build output. Organize the files, record what remains in answers.txt, and save a script that repeats the cleanup.

Dilbert 'Computer Holy Wars' strip: a bearded, suspender-wearing Unix guru tells the necktied manager, 'you're one of those condescending Unix computer users! Here's a nickel, kid. Get yourself a better computer.'

Start

Create lab-shell from the starter template and clone your copy. Use a Bash terminal; on Windows, choose Terminal → Select Default Profile → Git Bash and open a new terminal. Git Bash comes with the Git installation from course setup; the default macOS terminal also works.

From the repository root, create a work folder and generate the practice files inside it:

$ mkdir messy-repo
$ cd messy-repo
$ bash ../make_mess.sh

make_mess.sh writes the practice files into the current folder. Keep your work inside messy-repo, without initializing another Git repository there.

Inspect the Folder

Use pwd, ls, and ls -a to check your location and the folder’s contents. Visit docs, list its contents, then return with cd ... Read README.md with cat. The reading explains paths and navigation.

Practice making a backup: copy lab04.py to lab04.py.bak, confirm both exist, then remove the backup. Use cp and rm from the reading’s file commands. Check the filename before deleting it: rm has no trash can.

Locate the Flag

One file contains a secret string of the form FLAG{...}. Find its path and line number with grep. The -r option searches subdirectories, and -n prints line numbers; the reading shows how to combine them. Quote the search pattern and search from . so you include the whole work folder. Record the location for answers.txt.

Write the Cleanup

Before moving files, predict which names each wildcard matches, then check:

$ ls hw?.py
$ ls hw*.py

Which pattern includes hw10.py? Use that pattern to move all four homework files with one mv command. The cleanup must:

Preview each wildcard with ls before using it with mv or rm. Save your cleanup commands in messy-repo/tidy.sh, in the order they should run.

Test the script on a fresh copy of the mess in a separate folder outside messy-repo: run make_mess.sh there, then run bash with the path to your tidy.sh. Check the resulting files against the three requirements above. The script only needs to work on a fresh mess; running it twice may report missing files. Return to your cleaned messy-repo before counting.

Count the Remaining Work

Use pipes and redirection to answer these questions after the cleanup:

  1. How many lines are in the top-level Python files? Combine their contents with cat and pass the result to wc -l.
  2. How many lines contain TODO anywhere in the tree? Search recursively and count the matching lines.
  3. How many Python files remain at the top level? Count the filenames, not their contents.

As a check, the top level should contain the three lab files. Explain to yourself why the first and third counts exclude homework/, while the second includes it. Keep extra test copies outside this folder so they do not affect recursive searches.

Save the Inventory

Write answers.txt inside messy-repo, using > for the first line and >> to append the rest. Label all four results: the flag’s path and line number, top-level Python line count, unfinished-marker count, and top-level Python file count.

Use labels such as “flag location” and “unfinished markers”; do not put the literal FLAG{ or TODO in this file, or it will change later search results.

Practice a Clean Project

The docchat project will need a new repository and a private API key. For ungraded practice, create a sibling folder named docchat-practice outside lab-shell and initialize it with git init. Use the reading’s project setup as a reference.

An API key authorizes requests to a service and may bill them to your account. Use echo and redirection to put the placeholder GROQ_API_KEY=gsk_your_key_goes_here in .env. Create .gitignore with .env on its first line, then append __pycache__/ on a second line. Check both files with cat, then return to lab-shell/messy-repo. No real key or API call is needed for this practice.

Never commit a real key: deleting it later leaves earlier versions in Git’s history.

'Pepperidge Farm Remembers' meme: an elderly man holding a box of cookies, captioned 'remember when you hard coded credentials -- git remembers.'

The Same Commands in Project 3

Project 3 gives a language model tools named ls, cat, and grep to inspect files before answering a question. You will implement those commands as Python tools for the agent.

The Spider-Man-pointing meme: the grep you ran by hand today meets the grep tool your agent calls in Project 3.

Submit

Commit and sync messy-repo/answers.txt and messy-repo/tidy.sh. If a command did not work as expected locally, describe the problem in one sentence in answers.txt. On Gradescope, choose GitHub and submit your lab-shell repository and branch. The first lab explains the submission workflow.

Grading Rubric

Gradescope checks each item separately and adds the points earned.

Total: 8 points.