Composable command chaining: auto-pass folder between extract/compare/organize
Problem
The primary workflow requires users to manually copy-paste the output folder path between three commands:
notepad-cleanup extract
# Output: C:\Users\Extreme\Desktop\notepad-cleanup-2026-03-15_07-13-30
# User must copy-paste the path:
notepad-cleanup compare "C:\Users\Extreme\Desktop\notepad-cleanup-2026-03-15_07-13-30" -s "..."
# And again:
notepad-cleanup organize "C:\Users\Extreme\Desktop\notepad-cleanup-2026-03-15_07-13-30"
This friction is unnecessary -- extract knows the output path, and the subsequent commands need exactly that path. The existing run command already chains extract->organize internally, but uses a fragile "find most recent folder on Desktop" heuristic that doesn't account for custom output dirs or additional search directories.
Similarly, --search-dirs and --diff-tool must be re-specified on every invocation despite being stable user preferences.
Proposed solution
Two complementary mechanisms:
1. Config-based state persistence (~/.notepad-cleanup.json):
{
"last_extract": "C:\\Users\\Extreme\\Desktop\\notepad-cleanup-2026-03-15_07-13-30",
"search_dirs": ["C:\\Users\\Extreme\\Desktop\\Notepad Organize"],
"diff_tool": "bcomp"
}
After extract completes, it saves last_extract to config. Then compare and organize can be called with no positional argument -- they read from config and print what they're using:
notepad-cleanup extract
# Saved last extraction path to config.
notepad-cleanup compare
# Using last extraction: C:\...\notepad-cleanup-2026-03-15_07-13-30
# Using saved search dirs: C:\Users\Extreme\Desktop\Notepad Organize
notepad-cleanup organize
# Using last extraction: C:\...\notepad-cleanup-2026-03-15_07-13-30
2. Extended run command with --compare and --pause:
notepad-cleanup run --compare --pause --diff
# Runs: extract -> compare (with saved search dirs) -> [pauses for user review] -> organize
3. New config command for persistent preferences:
notepad-cleanup config --search-dir "C:\Users\Extreme\Desktop\Notepad Organize"
notepad-cleanup config --diff-tool bcomp
notepad-cleanup config --show # display current config
Config persistence design
The config file (~/.notepad-cleanup.json) already exists from the diff-tool work in dedup.py (load_config()/save_config()). This extends it with:
| Key |
Set by |
Used by |
Example |
last_extract |
extract (auto) |
compare, organize |
"C:\\...\\notepad-cleanup-2026-..." |
search_dirs |
config --search-dir |
compare |
["C:\\...\\Notepad Organize"] |
diff_tool |
config --diff-tool |
compare --diff |
"bcomp" |
When FOLDER is provided explicitly, it overrides last_extract. The config value is a fallback, not a mandate.
Implementation approach
Phase 1 (this issue):
- Make
FOLDER argument optional on compare and organize (fallback to last_extract)
extract saves last_extract to config after successful save
- Add
config subcommand for --search-dir, --diff-tool, --show
- Extend
run with --compare and --pause flags
Files affected:
notepad_cleanup/cli.py -- optional FOLDER, config command, run extension
notepad_cleanup/dedup.py -- extend load_config()/save_config() (already exist)
notepad_cleanup/saver.py -- save last_extract after extraction
Acceptance criteria
Related issues
Analysis
See 2026-03-15__07-12-44__composable-command-chaining.md for detailed analysis.
Composable command chaining: auto-pass folder between extract/compare/organize
Problem
The primary workflow requires users to manually copy-paste the output folder path between three commands:
This friction is unnecessary --
extractknows the output path, and the subsequent commands need exactly that path. The existingruncommand already chains extract->organize internally, but uses a fragile "find most recent folder on Desktop" heuristic that doesn't account for custom output dirs or additional search directories.Similarly,
--search-dirsand--diff-toolmust be re-specified on every invocation despite being stable user preferences.Proposed solution
Two complementary mechanisms:
1. Config-based state persistence (
~/.notepad-cleanup.json):{ "last_extract": "C:\\Users\\Extreme\\Desktop\\notepad-cleanup-2026-03-15_07-13-30", "search_dirs": ["C:\\Users\\Extreme\\Desktop\\Notepad Organize"], "diff_tool": "bcomp" }After
extractcompletes, it saveslast_extractto config. Thencompareandorganizecan be called with no positional argument -- they read from config and print what they're using:2. Extended
runcommand with--compareand--pause:notepad-cleanup run --compare --pause --diff # Runs: extract -> compare (with saved search dirs) -> [pauses for user review] -> organize3. New
configcommand for persistent preferences:Config persistence design
The config file (
~/.notepad-cleanup.json) already exists from the diff-tool work in dedup.py (load_config()/save_config()). This extends it with:last_extractextract(auto)compare,organize"C:\\...\\notepad-cleanup-2026-..."search_dirsconfig --search-dircompare["C:\\...\\Notepad Organize"]diff_toolconfig --diff-toolcompare --diff"bcomp"When
FOLDERis provided explicitly, it overrideslast_extract. The config value is a fallback, not a mandate.Implementation approach
Phase 1 (this issue):
FOLDERargument optional oncompareandorganize(fallback tolast_extract)extractsaveslast_extractto config after successful saveconfigsubcommand for--search-dir,--diff-tool,--showrunwith--compareand--pauseflagsFiles affected:
notepad_cleanup/cli.py-- optional FOLDER,configcommand,runextensionnotepad_cleanup/dedup.py-- extendload_config()/save_config()(already exist)notepad_cleanup/saver.py-- savelast_extractafter extractionAcceptance criteria
notepad-cleanup extractsaveslast_extractpath to~/.notepad-cleanup.jsonnotepad-cleanup comparewith no FOLDER arg readslast_extractfrom confignotepad-cleanup organizewith no FOLDER arg readslast_extractfrom confignotepad-cleanup config --search-dir PATHpersists to confignotepad-cleanup config --diff-tool NAMEpersists to confignotepad-cleanup config --showdisplays current confignotepad-cleanup run --comparechains extract -> compare -> organizenotepad-cleanup run --compare --pausepauses after compare for user reviewlast_extractin configRelated issues
comparecommand and the three-step workflowAnalysis
See
2026-03-15__07-12-44__composable-command-chaining.mdfor detailed analysis.