feat: port the cli/config/data/history refactor - #224
Merged
Conversation
…nfig-history-cli Splits the monolithic main.py workout() into main.py (REPL), cli.py (argparse entry point and flags), config.py (~/.pyworkout/config.json, deep-merged over built-in defaults), data.py (single source of truth for groups/exercises/reps), and history.py (~/.pyworkout/history.json). The refactor-data-config-history-cli branch shares no git history with main (disjoint roots), so this ports its actual end state - identified via `git diff origin/main origin/refactor-data-config-history-cli` and isolating the branch's one real commit (fd8953b "feat: refactor") from unrelated CI/dependabot/docs-restructuring noise picked up along its own, differently-rewritten history. Ported: cli.py, config.py, data.py, history.py, main.py, __init__.py, __main__.py, tests/{conftest,test_cli,test_config,test_history,test_main}.py, docs/config.sample.json (new). Reconciled by hand: pyproject.toml (kept main's [tool.bandit] section, added version bump/keywords/entry point/ py-modules), setup.cfg (dropped [metadata]/[options.entry_points], now superseded by pyproject.toml), setup.py removed, CHANGELOG.md (new v1.3.0 entry above v1.2.0), docs/internal/known-issues.md (issues #2 skip/stats, #3 drifted help text, and #4 video needing source edits are resolved by this split; #1 GPL banner remains open; noted that README/usage/commands/configuration docs still describe the pre-refactor model and need a follow-up pass). Fixes real bugs along the way: triceps `list` showing glutes exercises, `start` always reporting 0% progress, an off-by-one on five-exercise groups, and `stats` breaking after `skip`. Not touched: main's docs/ house-contract site (mkdocs structure, README.md, usage/commands/configuration/installation pages), health files (CODE_OF_CONDUCT/CONTRIBUTING/SECURITY/PLANNING), CLAUDE.md, CI workflows - these diverged from the refactor branch independently and reconciling their content would mean guessing at documentation house style rather than porting code. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Y38yxr1x54TZQgwdcHUbtE
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Ports the
refactor-data-config-history-clibranch onto currentmain. That branch shares no git history withmain(disjoint root commits —main's history was rewritten/squashed after the branch was cut), sogh pr createagainst it fails with "no history in common" and a normal merge/rebase isn't possible.Instead of replaying the branch's own unrelated history, I diffed the two tips directly (
git diff origin/main origin/refactor-data-config-history-cli) and found the branch is really just its old fork point plus one real commit,fd8953b "feat: refactor". Everything else the raw tree diff showed (CI bumps, an old docs restructuring) was noise the branch picked up from a stale ancestor, not part of the refactor. This PR ports that one real commit's content onto today'smain.main.pyworkout()into:main.py— the interactive REPLcli.py— argparse entry point (-g/--group,--list,--history,--init-config,--config,--version)config.py—~/.pyworkout/config.json, deep-merged over built-in defaultsdata.py— single source of truth for groups/exercises/repshistory.py—~/.pyworkout/history.json, plus the newhistorycommandpyproject.toml(setup.pyremoved,setup.cfgtrimmed to just the pytest config); version bumped 1.2.0 → 1.3.0.CHANGELOG.md: added the v1.3.0 entry above the existing v1.2.0 one.docs/internal/known-issues.md: marked issues Get the Percentages to Work #2 (skip/statsmutual exclusion), Update README #3 (drifted duplicate help text), and Create a CONTRIBUTING file #4 (video needing source edits) as resolved by this split, with notes on what changed. Issue Fix Timer #1 (GPL-style banner text) is not fixed — the ported code keeps the same wording.listshowing glutes exercises,startalways reporting 0%, an off-by-one on five-exercise groups, andstatsbreaking afterskip.Deliberately not touched:
main's docs site (README.md,docs/usage.md,docs/commands.md,docs/configuration.md, mkdocs structure), health files (CODE_OF_CONDUCT.md/CONTRIBUTING.md/SECURITY.md/PLANNING.md),CLAUDE.md, and CI workflows. These diverged from the refactor branch independently (main did its own "house contract" docs rewrite after the branch was cut), andmain's ownknown-issues.mdalready documents that its docs are drifted from the code. Reconciling that content would mean guessing at intended doc house-style rather than porting code, so it's flagged as a follow-up inknown-issues.mdinstead of attempted here.Test plan
Actions minutes are exhausted, so everything below was run locally against a fresh venv (Python 3.14.7), mirroring
.github/workflows/tests.ymlandpylint.yml:pip install -r requirements.txt pylintthenpytest tests/ -v --cov=. --cov-report=term-missing→ 53 passed, no failurespylint $(git ls-files '*.py')→ 10.00/10python -m build --wheel→ builds cleanly with the newpy-moduleslist andpyworkout = "cli:main"entry pointpyworkout --version,pyworkout --list abs,pyworkout --init-config,pyworkout --historyall work as expectedCo-Authored-By: Claude Sonnet 5 noreply@anthropic.com
https://claude.ai/code/session_01Y38yxr1x54TZQgwdcHUbtE