Skip to content

feat: support folder-scoped git status - #4527

Draft
liruifengv wants to merge 8 commits into
mainfrom
feat/session-context-panels
Draft

liruifengv wants to merge 8 commits into
mainfrom
feat/session-context-panels

Conversation

@liruifengv

Copy link
Copy Markdown
Collaborator

Requirement or Bug

Allow desktop session information to query Git status independently for every folder in a multi-root workspace.

Bug Reproduction Steps

N/A

Root Cause

N/A

Code Changes

Git status request
  ├── no root: keep the existing primary-workspace behavior
  └── root present
      ├── validate that root is a directory inside the workspace
      ├── resolve its containing workspace and runtime, including additional dirs
      ├── run Git status and numstat only for that folder
      └── resolve the branch and PR, preserving draft state

The request schema now accepts an optional root. Existing callers that omit it retain the current primary-workspace semantics and file filters.

Behavior Changes and Affected Users

Behavior Before After Who relies on the old behavior Escape hatch
Git status without root Uses the primary workspace root and existing file filters Unchanged Existing daemon clients and the current Changes panel Existing behavior and tests remain in place
Git status with root The field was ignored, so additional folders reused primary-root data Selects and scopes the requested folder, including additional workspace dirs New desktop folder-level session information Not applicable
Numstat for a selected root Included changes from the whole repository Includes only changes under the selected root Desktop users comparing multiple folders in one repository Omit root to retain repository-wide primary status
Draft PRs Reported as open Reported as draft when isDraft is true PR status consumers Other PR states are unchanged
Additional-dir runtime resolution Could report that the workspace was not materialized Resolves the workspace containing the requested directory Multi-root workspaces Primary-root resolution is unchanged

Verification

  • pnpm --filter @moonshot-ai/agent-core-v2 exec vitest run test/app/git/gitService.test.ts test/app/git/gitParsers.test.ts test/workspace/workspaceFs/fsService.test.ts — 130 tests passed.
  • pnpm --filter @moonshot-ai/kap-server exec vitest run test/fs.test.ts — 67 tests passed, including a real REST request for an additional root.
  • pnpm --filter @moonshot-ai/agent-core-v2 run typecheck — passed.
  • pnpm --filter @moonshot-ai/kap-server run typecheck — passed.

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue (no issue was provided).
  • I have added tests that prove my feature works.
  • The behavior-change table above is complete; no behavior removal or flipped default is introduced.
  • Evaluated gen-changesets: no changeset is needed because this is an internal protocol capability with no direct CLI-user-visible behavior change.
  • Evaluated documentation needs: no documentation update is required for this internal protocol addition.

Copilot AI balanced review requested due to automatic review settings October 29, 2026 12:36

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@changeset-bot

changeset-bot Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: ef0b51d

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@moonshot-ai/agent-core-v2 Patch
@moonshot-ai/kap-server Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

This branch has not been deployed

No deployments
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.

2 participants