File size: 3,272 Bytes
c8016f6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
# 04 - Terminal Command Cheatsheet

This file lists common commands in the order a team member is most likely to
use them.

## Start Work

```bash
cd UWaterlooManagedRetreatChatbot
source venv/bin/activate
git status
git pull origin main
git checkout -b your-branch-name
```

## Run the Website

```bash
streamlit run app/app.py
```

## Check Python Syntax

```bash
python3 -m py_compile app/app.py
python3 -m py_compile rag/pipeline.py
python3 -m py_compile rag/retriever.py
```

## Rebuild All Ingested Case Data

Use this after changing many pipeline outputs:

```bash
python3 ingest/ingest_pipeline_outputs.py
python3 ingest/create_summary_chunks.py
python3 ingest/embed_and_index.py
```

## Rebuild One Case

Replace `CS124` with the case ID:

```bash
python3 ingest/ingest_pipeline_outputs.py --case-id CS124
python3 ingest/create_summary_chunks.py
python3 ingest/embed_and_index.py
```

## Run One New Case Through the Pipeline

```bash
python3 -m case_study_pipeline.run_case_study \
  --case-folder data/raw/CS124 \
  --case-id CS124 \
  --llm-provider claude \
  --max-chars-per-source 150000 \
  --force
```

Then:

```bash
python3 -m case_study_pipeline.select_best_run --case-id CS124
python3 ingest/ingest_pipeline_outputs.py --case-id CS124
python3 ingest/create_summary_chunks.py
python3 ingest/embed_and_index.py
```

## Download Papers from a Registered Case Drive Folder

This uses `case_study_pipeline/drive_folders.json`.

```bash
python3 -m case_study_pipeline.download_drive_papers --case-id CS124
```

## Sort a Downloaded PDF into a Case Folder

```bash
python3 -m case_study_pipeline.sort_inbox --list
```

Then:

```bash
python3 -m case_study_pipeline.sort_inbox \
  --filename "Downloaded Paper.pdf" \
  --case-id CS124 \
  --rename "Author_Year_Short_Title.pdf"
```

## Upload the Current Code to Hugging Face

Preferred if your Hugging Face remote exists:

```bash
git push uwrfr-chatbot HEAD:main
```

If the remote does not exist:

```bash
git remote add uwrfr-chatbot https://huggingface.co/spaces/UWRFR/UWaterlooRFRChatBot
git push uwrfr-chatbot HEAD:main
```

Alternative using the Hugging Face CLI:

```bash
hf upload UWRFR/UWaterlooRFRChatBot . \
  --type space \
  --exclude ".git/*" \
  --exclude ".github/*" \
  --exclude ".venv/*" \
  --exclude "venv/*" \
  --exclude "__pycache__/*" \
  --exclude "data/raw/*" \
  --exclude "*.pdf" \
  --commit-message "Update website"
```

## Push to Shared GitHub

```bash
git push shared-github HEAD:main
```

If the remote does not exist:

```bash
git remote add shared-github https://github.com/rfrraguwaterloo-cmyk/UWaterlooManagedRetreatChatbot.git
git push shared-github HEAD:main
```

## Check Hugging Face Space Status

```bash
hf spaces info UWRFR/UWaterlooRFRChatBot
```

Look for:

- `sha` - deployed commit.
- `runtime.stage` - whether it is running, building, or failed.
- `host` - public app URL.

## See Recent Git History

```bash
git log --oneline -10
```

## See What Changed

```bash
git status
git diff --stat
```

## Undo an Uncommitted Edit to One File

Only do this if you are sure you do not want your local changes to that file:

```bash
git restore path/to/file.py
```

Do not use broad destructive commands like `git reset --hard` unless the team
explicitly agrees.