# Google Drive folder → local project import

Use when the user says a project/app folder exists in Google Drive and should be stored locally or used as source for a Git import.

## Pattern

1. Locate the parent folder with `gog drive search "name = '<folder>'" --json --results-only --no-input` using the configured account and sourced keyring env.
2. List child folders/files with `gog drive ls --parent <folder_id> --json --results-only --no-input` before downloading.
3. Recursively download into a neutral cache such as `~/projects/<domain>_sources/<folder-name>/`.
4. Preserve folder structure and filenames, but skip non-source artifacts by default:
   - `.venv/`, `venv/`, `env/`
   - `.git/`
   - `__pycache__/`, `.pytest_cache/`, `.mypy_cache/`
   - `node_modules/`, `dist/`, `build/`
   - compiled binaries/caches where not the deliverable: `*.pyc`, `*.pyo`, `*.exe`, `*.dll`, `*.so`
5. Export Google-native files to useful formats when needed:
   - Docs → `.docx`
   - Sheets → `.xlsx`
   - Slides → `.pptx`
   - Drawings → `.png`
6. After download, verify with file counts, `du -sh`, and a shallow file listing.
7. If the source will be pushed to Git, copy from the neutral cache into a separate clean repo directory and do a second hygiene pass there. Do not commit private `.env` files, old virtualenvs, cache directories, or huge/generated test artifacts unless the user explicitly asks.
8. Write a short local README/manifest in the source cache describing origin, skipped folders, and any security notes.

## Notes

- Keep credentials in environment/secret files only; never hard-code OAuth, Basic Auth, or PAT values in scripts.
- For large folders, skipping virtual environments is essential; otherwise Drive downloads can time out and flood the context with dependency files.
- A successful Drive import is not the same as a Git import: report both separately (local cache path vs. remote-backed repo path/commit).