Skip to content

feat(ai): add external CLI workflows for commits, analysis, and branches - #2900

Open
DJ-Huang wants to merge 7 commits into
sourcegit-org:developfrom
DJ-Huang:codex/sourcegit-ai-workflows
Open

DJ-Huang wants to merge 7 commits into
sourcegit-org:developfrom
DJ-Huang:codex/sourcegit-ai-workflows

Conversation

@DJ-Huang

@DJ-Huang DJ-Huang commented Nov 25, 2026 •

Copy link
Copy Markdown

Summary

  • AI Chat opens from the repository toolbar. The AI → Add to AI Chat menu attaches commits, a selection of changed files, or lines from a diff. AI → Analysis prepares a new chat with the selection and a suggested question.
  • Choose a CLI and, when the profile defines them, a model and reasoning effort. Press Enter to send or Shift+Enter for a new line. Sending clears the composer. Stop or a CLI error brings back the draft and its attachments.
  • Type / in the composer to find skills provided by the current CLI profile. Select one to apply it to the next message alongside any Git attachments. The user message records the chosen skill in the conversation.
  • Answers use Markdown and code blocks. Expand tool and reasoning events when the provider supplies them. History reopens saved conversations per worktree, with the original Git snapshots available for follow-ups.
  • The commit assistant offers API and CLI. Generate and apply a one-line subject from the staged changes or the staged files selected in the context menu. Amend uses the parent commit as its baseline.
  • Create branch and commit previews the branch name and subject, then uses SourceGit's existing commit workflow. If a hook rejects the commit, the branch and staged changes remain available for retry.

Setup

Add an external CLI profile in Preferences → AI. Configure its executable, individual arguments and tasks. Profiles accept UTF-8 stdin or a temporary prompt file, and read plain stdout or SourceGit JSONL. JSONL adapters can also restore saved sessions. SourceGit waits for the command until it exits or the user stops it. Configuration guide and examples

For the slash menu, configure the profile’s skill list command and invocation arguments. The included Codely adapter is one example. Configure a CLI skill catalog

Screenshots

English SourceGit UI, captured with a temporary Git repository and an example CLI.

AI Chat with a working-copy diff and a Markdown answer

Docked AI Chat showing attached files, a right-aligned question, collapsible activity, and a Markdown answer with a code block

Compose a question with staged and unstaged attachments

The AI Chat composer shows staged and unstaged attachments, CLI selection, model, and reasoning effort

Search CLI skills from the composer

English AI Chat with the slash menu showing matching CLI skills, descriptions, and sources

Attach a skill to a draft

English AI Chat with Code review selected alongside staged and unstaged Git context

CLI commit subject and editable branch suggestion

Commit assistant with the API and CLI tabs, a generated subject, an editable branch proposal, and the branch-and-commit action

Verification

  • Built on Windows with .NET 10 and passed dotnet format --verify-no-changes.

  • Replayed opening the dock, attaching changes, routing model and effort, sending with Enter, clearing the composer, restoring the draft after an error or cancellation, and using the narrow-window fallback.

  • Reopened worktree history after restarting and verified CLI session reuse, isolation, and delayed completion. Local Git and CLI fixtures also covered amend, staged-file scope, and retry after a commit hook failure.

  • Verified discovery, filtering, keyboard selection, and saved skill context with a controlled CLI. Also verified that Codely activates the selected workspace skill in read-only mode.

Refs #2855.

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.

1 participant