Repository navigation
feat: add base build/clean/status/doctor and colcon arg passthrough - #20
Merged
Merged
Conversation
Harden the base workspace commands, which previously offered only `base update` (git pull + non-sourced colcon build): - `base build`: rebuild the base workspace without pulling. - `base clean`: remove base build artifacts (build/, install/, log/) with a confirmation prompt (`--yes` to skip), since every worktree overlays the base install. `cwm ws clean --base` is now deprecated in favour of `cwm base clean` (still functional). - `base status`: show whether the base is built/dirty (`--json`). - `base doctor`: detect stale build dirs whose CMakeCache.txt points at a source that no longer exists (moved/deleted packages), which otherwise fail the next build with a CMake error; `--fix` deletes only those dirs (`--json` supported). `base update` and `base build` now source the ROS 2 underlay via run_colcon_sourced, symmetric with the worktree build path, and validate <underlay>/setup.bash up front with an explicit error. Both forward extra arguments to colcon build (e.g. `cwm base build -- --continue-on-error`). Shared helpers extracted along the way: suppress_completion in completion.py (replaces per-command lambdas) and _print_base_status in status_cmd.py (reused by `base status`).
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
Hardens the base workspace commands (R6 of the review roadmap,
docs/review-and-proposals-ja.md§3.3 / §5.2). Previouslycwm baseoffered onlyupdate(git pull + non-sourced colcon build), which left several real-world frictions unaddressed: no pull-less rebuild, manual cleanup of stale CMakeCache dirs, no colcon arg passthrough, and a build path asymmetric with the worktree side.New commands
cwm base build [-- <colcon args>]cwm base clean [--yes]cwm base status [--json]cwm base doctor [--fix] [--json]--fixdelete) stale build dirs pointing at missing sourcesChanges to existing behaviour
base update/base buildnow source the ROS 2 underlay (underlayin.cwm/config.yaml) viarun_colcon_sourced, symmetric with the worktree build path.<underlay>/setup.bashis validated up front with an explicit error instead of relying on the caller's environment.--are forwarded tocolcon build(e.g.cwm base build -- --continue-on-error).cwm ws clean --baseis deprecated in favour ofcwm base clean; it still works and prints a notice to stderr (removal deferred to a future major).Implementation notes
base doctorparsesbuild/<pkg>/CMakeCache.txt(CMAKE_HOME_DIRECTORY) and flags build dirs whose source no longer exists — the moved/deleted-package case that otherwise fails the next build with a CMake error.--fixdeletes only those dirs; dirs without a cache (e.g. pure-Python packages) are ignored.run_colcon_sourced(generalised in refactor: generalize sourced colcon runner and extract changeset pipeline #16),_artifact_dirs(clean_cmd),_collect_base(status_cmd).suppress_completionincompletion.py(replaces per-command lambdas in build/test/base) and_print_base_statusinstatus_cmd.py(shared byws statusandbase status).Additive only — no breaking CLI/config changes ⇒ minor, v6.3.0 after merge.
Test plan
tests/unit/test_base_cmd.py(sourced build, underlay validation, arg passthrough, clean confirmation, deprecation notice, doctor detection/--fix/--json)uv run python -m pytest tests/ -q)cwm base build -- --continue-on-error,cwm base doctor --fixagainst a moved package