Files
deepseek-harness/packages/experimental/client-ui-forge/src/client/WorktreeToggle.module.css
T
LegGasai 0c8078e196 feat(forge): name worktree branches, start them from remote branches, and show changes being read (#8536)
* feat(forge): name worktree branches, start them from remote branches, and show changes being read

The New Session worktree option's base menu now searches local branches and
each remote's branches, pins the current branch and every remote's default
branch, and names each remote group by its repository. Its last row opens a
dialog that names the new branch, starting from `worktreePrefix` and checking
Git's branch-name rules; the Host refuses an invalid or taken name. A request
records the full ref of its base and the optional name; every attempt uses the
name.

A remote-tracking base is fetched first: the worktree service gains a
`fetch` request field and a `fetch` phase, fetching only that branch without
tags. A failed fetch leaves the message waiting with Retry, Use the last
fetched version, and Continue without a worktree; a taken name offers Rename.

While the changes view reads changes it has not shown yet, it says
"Reading changes" above file card placeholders, and the files menu names no
count.

* fix(worktree): forward only the declared create_worktree arguments

The create_worktree parameter object is open, and the tool passed it to the
worktree runtime unchanged. Now that a runtime request can ask to fetch, an
undeclared `fetch: true` from the model would have fetched, or refused a local
`from`. The tool now forwards only `name` and `from`, so it never fetches.

* docs(forge): say that only generated worktree branch names come from the Session id

* fix(forge): keep the collapsed change request status on one line

In the Session panel the collapsed card's number line kept every part at
full width inside a clipping row, so a narrow panel cut the most urgent
flag off without an ellipsis, such as "有冲突" after "3 项检查失败".

The number and status now form one MarqueeText line as wide as the row.
While the line with failed checks does not fit, they take the shorter
wording without their count; a line that still does not fit ends in an
ellipsis and crawls into view with the title while the pointer rests on
the card's head. The line measures again when its width or the fonts
change. Expanded cards keep their branch names as before.

* fix(forge): hide remote credentials and read the branch a tag shares its name with

The base menu named an unrecognized remote's group by its fetch URL as
`git remote -v` prints it, so a token in the URL, such as
`https://oauth2:[email protected]/...`, reached the browser and showed
in the menu. The group now shows the URL without its user name and password.

Inspection read the checked-out branch with `symbolic-ref --short HEAD`,
which prints `heads/main` while a tag is also named `main`; the New Session
option then requested `refs/heads/heads/main` and every worktree attempt
failed. Inspection now reads the full ref and takes the name under
`refs/heads/`, so the option, the pinned current branch, and the checkout
row name `main`. HEAD that names a ref outside `refs/heads/` reads as no
branch.

* test(worktree): set up nested remotes and line endings the CI runners' Git accepts

Git 2.55 on the CI runners refuses `git remote add team` next to an
existing `team/fork` remote; the check runs only in `git remote add`, so
the longest-remote case now writes the second remote with `git config`, as
configuration written earlier or by hand holds it. The test clone also
turns off `core.autocrlf`, as `repository` does, because the Windows
runner's global setting checked the fetched file out with CRLF.
2026-11-16 16:13:00 +00:00

277 lines
4.5 KiB
CSS

/* Worktree option at the right of the New Session row: the compact 28px chip
geometry and secondary ink of the composer mode controls. */
.root {
display: inline-flex;
flex: none;
align-items: center;
gap: 2px;
min-width: 0;
}
.toggle,
.base,
.current {
display: inline-flex;
align-items: center;
gap: 6px;
min-width: 0;
height: 28px;
padding: 0 8px;
border: none;
border-radius: var(--dsw-radius-sm);
background: transparent;
color: var(--dsw-alias-label-secondary);
font-size: 13px;
font-weight: 500;
line-height: 20px;
white-space: nowrap;
cursor: pointer;
}
@media (hover: hover) {
.toggle:hover:not([data-disabled]),
.base:hover:not(:disabled) {
background: var(--dsw-alias-interactive-bg-hover);
}
}
.toggle[data-disabled] {
color: var(--dsw-alias-label-dimmed);
cursor: default;
}
.base {
gap: 4px;
max-width: 200px;
padding-right: 4px;
}
/* A chosen name leads; the base after it gives way first. */
.named {
max-width: 280px;
}
.nameLabel {
flex: 0 1 auto;
min-width: 4em;
overflow: hidden;
color: var(--dsw-alias-label-primary);
text-overflow: ellipsis;
}
.fromLabel {
flex: 0 100 auto;
min-width: 0;
overflow: hidden;
color: var(--dsw-alias-label-tertiary);
text-overflow: ellipsis;
}
.current {
box-sizing: content-box;
max-width: 200px;
font-family: inherit;
}
.current svg {
flex: none;
}
.base:focus-visible,
.current:focus-visible,
.toggle:has(.checkbox:focus-visible) {
outline: var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color, var(--dsw-alias-state-business-primary));
outline-offset: 2px;
}
.base:disabled {
cursor: progress;
}
.checkbox {
flex: none;
width: 14px;
height: 14px;
margin: 0;
accent-color: var(--dsw-alias-brand-primary);
cursor: inherit;
}
.checkbox:focus-visible {
outline: none;
}
.baseLabel {
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
}
.chevron {
flex: none;
color: var(--dsw-alias-label-tertiary);
transition: transform 120ms ease;
}
.chevronOpen {
transform: rotate(180deg);
}
/* The base menu: the changes view's BaseMenu search, rows, and labels, with a footer row that names the branch. */
.anchor {
flex: none;
min-width: 0;
}
.menu {
width: min(360px, calc(100vw - 24px));
}
.menuRoot {
display: flex;
flex-direction: column;
box-sizing: border-box;
width: 100%;
min-width: 0;
min-height: 0;
color: var(--dsw-alias-label-primary);
font-size: 12px;
}
.search {
padding: 8px;
}
.searchInput {
box-sizing: border-box;
width: 100%;
max-width: 100%;
}
.searchInput input::placeholder {
color: var(--dsw-alias-label-secondary);
}
.rows {
max-height: 300px;
overflow: auto;
padding: 0 0 2px;
}
.groupLabel {
display: flex;
align-items: baseline;
gap: 8px;
min-width: 0;
padding: 6px 8px 4px;
color: var(--dsw-alias-label-tertiary);
font-size: 11px;
line-height: 15px;
}
.groupName {
flex: none;
}
.groupRepository {
min-width: 0;
margin-left: auto;
overflow: hidden;
font-family: var(--ds-font-family-code);
text-overflow: ellipsis;
white-space: nowrap;
}
.option {
display: flex;
flex: 1;
align-items: center;
gap: 8px;
min-width: 0;
}
.optionName {
min-width: 0;
overflow: hidden;
font-family: var(--ds-font-family-code);
text-overflow: ellipsis;
white-space: nowrap;
}
.remotePrefix {
color: var(--dsw-alias-label-tertiary);
}
.tag {
flex: none;
padding: 0 5px;
border-radius: var(--dsw-radius-xs);
background: var(--dsw-alias-interactive-bg-hover);
color: var(--dsw-alias-label-secondary);
font-size: 11px;
line-height: 16px;
}
.check {
flex: none;
margin-left: auto;
color: var(--dsw-alias-state-business-primary);
}
.status {
display: flex;
align-items: center;
gap: 8px;
padding: 12px 8px;
color: var(--dsw-alias-label-secondary);
}
.footer {
display: flex;
flex-direction: column;
margin-top: 3px;
padding-top: 3px;
border-top: 0.5px solid var(--dsw-alias-border-l2);
}
.footerLabel {
flex: none;
}
.footerValue {
min-width: 0;
margin-left: auto;
overflow: hidden;
color: var(--dsw-alias-label-tertiary);
text-overflow: ellipsis;
white-space: nowrap;
}
.footerName {
font-family: var(--ds-font-family-code);
}
@media (pointer: coarse) {
.search input {
font-size: 16px;
}
}
@media (max-width: 600px) {
.root {
flex-direction: column;
align-items: flex-end;
gap: 0;
}
.base,
.named,
.current {
max-width: 120px;
}
.fromLabel {
display: none;
}
}