feat(changes): AI commit-message suggestion + push/pull in the git lens
Port PR #434's two Git-panel features onto the current dev structure. The PR's third commit (file-tree context-menu rename) is dropped: dev already has it (#550,e39ea92) with a different `fs.rename` payload contract (`name`, not `newName`) and its own i18n keys, so keeping it would break the route and duplicate dictionary keys (TS1117). Why this is a rewrite rather than the PR's diff applied: - The client carrier moved. `src/client/GitView.tsx` was deleted by24a3813(the unified "changes" tab), so the client half lands in `src/client/changes/GitLens.tsx` and follows that file's conventions: the bar's single `actionError` status line instead of a second `remoteError` channel, `runAction` for the git mutations, the kit's `IconButton`, and the host's own `IconSparkleRegular` rather than a new react-icons import. - The host route could not read `Session.events` at all: it was renamed to `snapshotEvents()` in DSH 0.1.2-alpha.4, and 0.2.0-rc.1 marks it `new calls are prohibited`. `git.suggest-message` resolves its provider/model from the incrementally folded `Session.requestHeader()` — the same `request/header` record the PR was after, but O(new events) instead of a full reverse scan. `SidebarSessionStore` gains that face; `snapshotEvents()` is marked deprecated there. - Message source is the plugin's own producer kind (`plugin:dsh-better-sidebar`, the existing `MessageSourceMap` augmentation): a bare `plugin` kind is rejected outright in session format v4. - The commit row stays where dev put it. PR moved it to the top of the panel because it was buried between the two file lists; dev's commit bar is already a `position: sticky` footer, so that problem is gone — and `changes-tab.spec.tsx` pins the bar's status line to the message row. Beyond the port, the route reads `assembler.finish` so a provider-side failure is reported with the provider's own reason instead of "the model returned an empty message", bounds the call with a 30s deadline, and truncates the diff at 12K characters. Refs #434 Co-authored-by: Ahdong&Shouey <131278957+LiuStar656@users.noreply.github.com>
This commit is contained in:
1 parent
3bd5e1947b
commit
7cf3d609ff
30 files changed
+1155
-6
No files matched your search
+16
@@ -488,3 +488,19 @@ export async function revert(cwd: string, hash: string, selected?: string): Prom
|
||||
export async function cherryPick(cwd: string, hash: string, selected?: string): Promise<void> {
|
||||
await runGit(await repoRoot(cwd, selected), ['cherry-pick', '--end-of-options', hash])
|
||||
}
|
||||
|
||||
/** Push the current branch to its upstream (`git push`). A branch without a
|
||||
* tracking remote fails loudly with git's own message — the panel shows it and
|
||||
* the user fixes the tracking in a terminal. No operands, so there is nothing
|
||||
* for a caller-supplied value to smuggle in as an option. */
|
||||
export async function push(cwd: string, selected?: string): Promise<void> {
|
||||
await runGit(await repoRoot(cwd, selected), ['push'])
|
||||
}
|
||||
|
||||
/** Pull upstream changes into the current branch (`git pull --ff-only`).
|
||||
* Fast-forward-only keeps a headless panel out of merge/conflict editors: a
|
||||
* diverged branch fails with git's own message instead of opening an
|
||||
* interactive merge, so the user resolves it in a terminal. */
|
||||
export async function pull(cwd: string, selected?: string): Promise<void> {
|
||||
await runGit(await repoRoot(cwd, selected), ['pull', '--ff-only'])
|
||||
}
|
||||
Reference in new issue
Block a user