Delete .cursor
Browse files
.cursor/plans/split_site_vs_dataset_+_hebrew_portal_8ab84509.plan.md
DELETED
|
@@ -1,136 +0,0 @@
|
|
| 1 |
-
---
|
| 2 |
-
name: Split site vs dataset + Hebrew portal
|
| 3 |
-
overview: Split publishing cleanly between Hugging Face Dataset and Space repos, then fix the Gradio portal (navigation/search/ZIP download/file-type handling) and localize the UI to full Hebrew + RTL.
|
| 4 |
-
todos:
|
| 5 |
-
- id: secure-token
|
| 6 |
-
content: Remove hardcoded HF tokens; rely on Hugging Face CLI login (user cache) and revoke leaked tokens.
|
| 7 |
-
status: pending
|
| 8 |
-
- id: split-publishing
|
| 9 |
-
content: Ensure dataset uploads exclude site folder; space uploads only cs26-portal.
|
| 10 |
-
status: pending
|
| 11 |
-
- id: fix-portal-nav
|
| 12 |
-
content: Fix handle_click output mismatch; verify folder navigation renders files.
|
| 13 |
-
status: pending
|
| 14 |
-
- id: filetypes-zip-hebrew
|
| 15 |
-
content: Improve file-type open/download behavior, directory ZIP download robustness, responsive UI polish, and full Hebrew+RTL localization.
|
| 16 |
-
status: pending
|
| 17 |
-
isProject: false
|
| 18 |
-
---
|
| 19 |
-
|
| 20 |
-
# Revision history
|
| 21 |
-
| Date (UTC) | Changes |
|
| 22 |
-
| --- | --- |
|
| 23 |
-
| 2026-04-25 | • Updated plan to use Hugging Face CLI login (no tokens in repo)\n• Clarified that the non-`.pdf` issue is a portal open/download behavior problem (not the uploader) |
|
| 24 |
-
| 2026-04-25 | • Added rollback strategy (tag + backup branch) and “deploy + browser-verify after each change” loop\n• Declared HF Space git repo as source of truth for the site |
|
| 25 |
-
|
| 26 |
-
# Split site vs dataset + Hebrew portal
|
| 27 |
-
|
| 28 |
-
## Scope (based on your answers)
|
| 29 |
-
- Publish to **two Hugging Face repos only**:
|
| 30 |
-
- **Dataset**: `CS26/Computer-Science`
|
| 31 |
-
- **Space (site)**: `CS26/cs26-portal`
|
| 32 |
-
- Make the site **fully Hebrew + RTL** (all strings + direction/layout).
|
| 33 |
-
- Treat the **Hugging Face Space git repo** (`CS26/cs26-portal`) as the **source of truth** for the site code (commits live there).
|
| 34 |
-
|
| 35 |
-
## Rollback / “always go back to current state”
|
| 36 |
-
- Before any edits, create **both**:
|
| 37 |
-
- a **git tag** on the current state (e.g. `backup-before-portal-fixes`)
|
| 38 |
-
- a **backup branch** (e.g. `backup/current-state`)
|
| 39 |
-
- Apply this rollback safety in:
|
| 40 |
-
- your local repo (`C:\\GitRepos\\Computer-Science`) for scripts and any local-only tooling changes
|
| 41 |
-
- the HF Space repo (`CS26/cs26-portal`) for the portal/site changes
|
| 42 |
-
|
| 43 |
-
## Critical security fix (do this first)
|
| 44 |
-
- Your message included Hugging Face access tokens. **Revoke any token that was pasted into chat** and keep tokens out of repos.
|
| 45 |
-
- Use **Hugging Face CLI login** so credentials live in your **user profile cache**, not in code:
|
| 46 |
-
- `huggingface-cli login`
|
| 47 |
-
- Verify: `python -c "from huggingface_hub import whoami; print(whoami())"`
|
| 48 |
-
- In code, remove `TOKEN = "..."` entirely and rely on `huggingface_hub`’s normal auth resolution (CLI token cache). If auth is missing, fail fast with a clear message telling you to run `huggingface-cli login`.
|
| 49 |
-
|
| 50 |
-
## Repo split (publishing split, without changing your local repo structure)
|
| 51 |
-
- **Dataset uploader (`upload_to_hf.py`)**
|
| 52 |
-
- Update to upload only dataset content and exclude the site folder and scripts:
|
| 53 |
-
- Exclude: `cs26-portal/**`, `.git/**`, `upload_to_hf.py`, `upload_space.py`, plus any other local-only tooling.
|
| 54 |
-
- Decide on one upload strategy:
|
| 55 |
-
- **Option A (recommended)**: `HfApi.upload_large_folder(...)` for resumable multi-threaded uploads.
|
| 56 |
-
- **Option B**: “10 files per batch” logic (commit/upload loop). This is slower and hits commit limits more often, but matches your original requirement.
|
| 57 |
-
- Add support for **all suffixes** (`.pptx`, `.docx`, `.zip`, etc.) by ensuring the uploader preserves the original relative paths and filenames exactly (no suffix assumptions anywhere).
|
| 58 |
-
- Ensure `.gitignore`/HF ignore rules are respected by using explicit ignore patterns (and optionally a `.hfignore` file in repo root if you want HF-side ignores).
|
| 59 |
-
- Note on your reported “suffix isn’t .pdf” issue: the **portal** should not assume `.pdf` when generating file links or deciding open-vs-download; the **uploader** should stay extension-agnostic and only preserve paths faithfully.
|
| 60 |
-
|
| 61 |
-
- **Space uploader (`upload_space.py`)**
|
| 62 |
-
- Keep it uploading **only** the `cs26-portal/` directory.
|
| 63 |
-
- Rely on Hugging Face CLI login credentials (no token in code).
|
| 64 |
-
- Because the Space repo is the site’s source of truth, prefer a workflow where we **commit to the Space repo** and let HF rebuild the Space from `main`.
|
| 65 |
-
|
| 66 |
-
## Change workflow (don’t proceed until it works)
|
| 67 |
-
- Make **one small change at a time**, then:
|
| 68 |
-
- push to the HF Space repo (site) or HF Dataset repo (data/scripts) as relevant
|
| 69 |
-
- wait for rebuild (Space) if applicable
|
| 70 |
-
- verify the specific behavior in the **browser** (not just locally)
|
| 71 |
-
- Only proceed to the next change after the browser check passes.
|
| 72 |
-
|
| 73 |
-
## Portal fixes (`cs26-portal/app.py`)
|
| 74 |
-
|
| 75 |
-
### 1) Fix directory navigation showing empty / files not displayed
|
| 76 |
-
- There is an **outputs mismatch bug** in `handle_click()`:
|
| 77 |
-
- In the early-return branch it returns **3 values**, but Gradio `hidden_path_input.change(...)` expects **4 outputs**.
|
| 78 |
-
- Fix to always return exactly 4 outputs: `(current_path_state, search_box, drive_view, zip_file)`.
|
| 79 |
-
- Verify that clicking a folder updates `current_path_state` and re-renders the list for that folder.
|
| 80 |
-
|
| 81 |
-
### 2) Ensure directory names display correctly (no full path)
|
| 82 |
-
- Your HTML already uses `os.path.basename(d)` for display; keep that.
|
| 83 |
-
- Make sure **search results** and **non-search listing** both use the same “display name vs full path” pattern.
|
| 84 |
-
|
| 85 |
-
### 3) Search UX and scope
|
| 86 |
-
- Keep the current behavior: search is scoped to `current_path` (already implemented via `prefix` filtering).
|
| 87 |
-
- Improve UX details:
|
| 88 |
-
- Clear Hebrew placeholder text (RTL-friendly).
|
| 89 |
-
- Enter-to-search remains.
|
| 90 |
-
|
| 91 |
-
### 4) Directory download as ZIP
|
| 92 |
-
- You already have `prepare_zip()` using `snapshot_download(...allow_patterns=pattern)` and `zipfile`.
|
| 93 |
-
- Fix/extend the edge cases you called out:
|
| 94 |
-
- **ZIP suffix reliability**: ensure returned download file path always ends with `.zip` and the Gradio `File` component preserves that name.
|
| 95 |
-
- **Top-level zip name**: for root use a Hebrew-friendly name (or `CS26_All.zip`).
|
| 96 |
-
- **Performance**: avoid zipping `.huggingface` / `.git` content (already filtered), and confirm correct `arcname` for nested folders.
|
| 97 |
-
|
| 98 |
-
### 5) Non-PDF file-type handling (pptx/docx/zip/etc)
|
| 99 |
-
- Update the file “open” behavior to be correct for all extensions:
|
| 100 |
-
- For previewable formats (pdf/images/text): open in new tab.
|
| 101 |
-
- For office/archives/unknown: trigger **direct download** (still via HF `resolve/main/...`) rather than relying on the browser to preview.
|
| 102 |
-
- Expand icons mapping beyond pdf/doc/images:
|
| 103 |
-
- `.pptx`/`.ppt`, `.xlsx`/`.xls`, `.zip`/`.rar`/`.7z`, `.py`, `.ipynb`, `.txt`, etc.
|
| 104 |
-
|
| 105 |
-
### 6) Responsive layout polish
|
| 106 |
-
- Make the search row responsive so the button size matches the textbox:
|
| 107 |
-
- Prefer CSS flex rules in the HTML `<style>` plus Gradio layout tweaks (`scale`, `min_width`, and/or `elem_classes`).
|
| 108 |
-
- Ensure good mobile behavior in the existing `@media (max-width: 600px)` block.
|
| 109 |
-
|
| 110 |
-
### 7) Full Hebrew + RTL
|
| 111 |
-
- Apply RTL direction at the page/container level:
|
| 112 |
-
- CSS: `direction: rtl;` and `text-align: right;` for relevant containers.
|
| 113 |
-
- Fix breadcrumb separator direction and ordering if needed.
|
| 114 |
-
- Translate all visible strings in `app.py`:
|
| 115 |
-
- Title, headings, “Folders/Files”, “Refresh”, “Prepare Folder ZIP”, “Download Ready”, “This folder is empty”, “Search Results for …”, placeholders.
|
| 116 |
-
- Confirm Hebrew rendering for path segments that are already Hebrew in the dataset.
|
| 117 |
-
|
| 118 |
-
## Verification checklist (manual, but deterministic)
|
| 119 |
-
- Folder click shows correct file listing for that folder.
|
| 120 |
-
- Search:
|
| 121 |
-
- Works when typing fast, only runs on Enter / Search button.
|
| 122 |
-
- Returns both folders + files under current path.
|
| 123 |
-
- Clicking files:
|
| 124 |
-
- `.pdf` and images open correctly.
|
| 125 |
-
- `.pptx`, `.docx`, and `.zip` download/open correctly (no suffix assumptions).
|
| 126 |
-
- ZIP download:
|
| 127 |
-
- Root zip and nested-folder zip both download with `.zip` suffix and correct contents.
|
| 128 |
-
- Hebrew:
|
| 129 |
-
- All UI text is Hebrew.
|
| 130 |
-
- Layout is RTL and looks correct on desktop + mobile widths.
|
| 131 |
-
|
| 132 |
-
## Files to touch
|
| 133 |
-
- `upload_to_hf.py`
|
| 134 |
-
- `upload_space.py`
|
| 135 |
-
- `cs26-portal/app.py`
|
| 136 |
-
- (optional) `cs26-portal/requirements.txt` if we need extra deps for better MIME/preview handling
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|