fix(reset): clear document entries while preserving scaffolds (#580)

* fix(reset): clear document entries while preserving scaffolds

* fix(reset): preserve scaffolds across Bash versions

* docs(reset): keep document inventory before presentation heading
This commit is contained in:
Rudy Mizrahi Celekli authored and GitHub committed 2026-10-18 07:33:41 +02:00
1 parent 3b16f80595
commit d590aa1b10
4 files changed
+170 -20

No files matched your search

+26 -11
View File
@@ -86,7 +86,11 @@ cv/main_example.tex. This scope covers skill files only.
### If scope includes `documents`:
Use Glob to list all files present in `documents/cv/`, `documents/linkedin/`, `documents/diplomas/`, `documents/references/`, `documents/projects/`, `documents/postings/`, and `documents/applications/`. Present as:
Use Glob to list all files present in `documents/cv/`, `documents/linkedin/`, `documents/diplomas/`, `documents/references/`, `documents/projects/`, `documents/postings/`, and `documents/applications/`.
Include nested and hidden user entries in the inventory. Each subfolder's tracked `.gitkeep` is a scaffold placeholder: exclude it from the deletion list and from the empty/non-empty decision, and preserve it.
Present as:
```
## Documents reset will delete:
@@ -251,16 +255,27 @@ Leave the rest of the file intact: the portal-CLI and WebSearch-fallback explana
### Documents reset
For each non-empty document subfolder, delete all files within it using Bash `rm`. Do not delete the folder itself, and do not delete `documents/README.md`.
For each non-empty document subfolder, delete all user entries, including nested folders and hidden files. Preserve the seven top-level subfolders, their `.gitkeep` placeholders, and `documents/README.md`. Run the following Bash block only after the confirmation above; its glob settings stay inside the subshell. If `documents/` or any of its seven roots is a symbolic link, stop before deleting anything and ask the user to replace that linked root with a local document folder.
```bash
rm -f documents/cv/*
rm -f documents/linkedin/*
rm -f documents/diplomas/*
rm -f documents/references/*
rm -f documents/projects/*
rm -f documents/postings/*
rm -rf documents/applications/*/
(
set -e
for directory in documents documents/{cv,linkedin,diplomas,references,projects,postings,applications}; do
if [ -L "$directory" ]; then
printf 'Reset stopped: %s is a symbolic link.\n' "$directory" >&2
exit 1
fi
done
unset GLOBIGNORE
shopt -s dotglob nullglob
for directory in documents/cv documents/linkedin documents/diplomas documents/references documents/projects documents/postings documents/applications; do
for entry in "$directory"/*; do
if [ "${entry##*/}" != ".gitkeep" ]; then
rm -rf -- "$entry"
fi
done
done
)
```
---
@@ -287,7 +302,7 @@ Then tell the user what to do next based on what was reset:
> Note that `CLAUDE.md` and `cv/main_example.tex` are outside the `profile` scope and still hold your personal data. If you are handing this fork over or making it public, clear them by hand.
**If documents were reset:**
> The `documents/` folder is now empty. Add your career documents and run `/setup` to populate your profile. See `documents/README.md` for instructions on what to put where.
> Your user documents are now cleared. The folder structure, `.gitkeep` placeholders, and `documents/README.md` are preserved. Add your career documents and run `/setup` to populate your profile.
**If both were reset:**
> Both your profile files and documents folder are now empty. Add documents to `documents/` (or skip and use the CV import / interview path), then run `/setup`.
> Your profile data and user documents are now cleared; the document folders, `.gitkeep` placeholders, and `documents/README.md` are preserved. Add documents to `documents/` (or skip and use the CV import / interview path), then run `/setup`.