Skip to content

feat: expose linked worktree context in project list json - #15

Merged
mateodelnorte merged 1 commit into
mainfrom
tasks--harmony-680
May 19, 2026
Merged

mateodelnorte merged 1 commit into
mainfrom
tasks--harmony-680

Conversation

@mateodelnorte

@mateodelnorte mateodelnorte commented May 19, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Add an optional worktree object to meta project list --recursive --json.
  • Include linked=true, physical_root, canonical_root, and name for linked worktree invocations.
  • Preserve root as the canonical meta root and cwd as the actual invocation directory.

Task: [[tasks/harmony-680]]

Tests

  • cargo fmt
  • cargo test -p meta_project_cli --lib --quiet
  • cargo test --workspace

Summary by CodeRabbit

Release Notes

  • New Features

    • meta project list JSON output now includes linked worktree context information.
    • Enhanced path canonicalization for consistent output values.
  • Tests

    • Added regression test for linked worktree handling.

Review Change Stack

@coderabbitai

coderabbitai Bot commented May 19, 2026 •

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: c4b640f4-88c7-4b71-b3c9-2e6052665a79

📥 Commits

Reviewing files that changed from the base of the PR and between 9b3e9c8 and 11a71d6.

📒 Files selected for processing (1)
  • src/lib.rs

Walkthrough

meta project list JSON output now optionally includes linked worktree metadata. The change introduces a ProjectListWorktree type, extends the JSON schema with a new worktree field, detects whether the working directory is in a linked worktree, computes canonical paths from that context, and includes a regression test that verifies end-to-end behavior.

Changes

Linked Worktree JSON Output

Layer / File(s) Summary
Worktree Schema and Imports
src/lib.rs
meta_cli::worktree module is imported. New ProjectListWorktree struct carries linked, physical_root, canonical_root, and name fields. ProjectListOutput is extended with an optional worktree: Option<ProjectListWorktree> field that skips serialization when absent.
Worktree Detection and JSON Population
src/lib.rs
During JSON generation, the code derives abs_cwd_string from the canonicalized working directory. Linked worktree detection runs; when detected, a canonical root is computed from the worktree context and the worktree object is populated. Root and cwd paths in the JSON output are adjusted to use the detected canonical root and the canonicalized path string.
Regression Test for Linked Worktree
src/lib.rs
Path normalization helpers enable stable cross-platform test assertions. A new unit test creates a git repository, initializes a linked worktree, invokes project list with the working directory inside the worktree, and asserts the JSON worktree object and canonicalized root/cwd values match expected paths.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 A worktree springs to life, so bright,
With branches linked in canonical light,
The JSON now knows where it's bound—
Physical roots and paths profound!
Meta project sees the whole ground.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 71.43% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: expose linked worktree context in project list json' directly and accurately summarizes the main change: adding optional worktree context information to the project list JSON output.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch tasks--harmony-680

Comment @coderabbitai help to get the list of available commands and usage tips.

@mateodelnorte
mateodelnorte merged commit 5016ebf into main May 19, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant