Preface

In DSH Web, Chat and Trajectory are primarily oriented towards sessions and execution trajectories. When viewing the Git history of the current workspace, the common practice is to switch to the terminal or open another Git graphical tool in the browser.

WhitePlusMS/dsh-git-graph is a DSH Web plugin that provides a dedicated Git Graph entry next to Chat and Trajectory for viewing the Git history of the current workspace. When refreshing this view, it does not create session messages or tool trace entries.

What is this

The repository path for dsh-git-graph is WhitePlusMS/dsh-git-graph, the license is MIT, and the currently installable version is v0.0.2.

It solves specific problems: viewing the Git commit topology, branch references, commit details, file changes, and uncommitted changes of the current session workspace directly in DSH Web.

The current release version is read-only. It does not create, delete, rename, merge, rebase, push, pull, fetch, create tags, stash, or reset Git data.

Core Features

Commit Topology and References

The plugin displays a Git Graph in the Web interface, including:

  • Commit topology;
  • Branch relationships;
  • Merge relationships;
  • Parent commit relationships;
  • Local branches;
  • Remote branches;
  • Tags;
  • HEAD reference tags.

The graph header displays the current workspace status: clean or dirty.

Search, Filter, and Sort

The plugin supports full-range search of commits, covering:

  • commit hash;
  • subject;
  • author;
  • email;
  • reference name;
  • date.

It also supports the following filtering and sorting capabilities:

  • Branch-name glob filtering;
  • Reference type filtering;
  • Include all refs option;
  • date sorting;
  • author-date sorting;
  • topological sorting;
  • first-parent mode.

The find bar in results supports case sensitivity, regex, and previous/next navigation.

Commit Details and File Diff

After selecting a commit, details can be expanded inline below the commit line, including:

  • hash;
  • author;
  • committer;
  • date;
  • parents;
  • signature status;
  • references.

File changes support tree or list views and display:

  • Change type coloring;
  • Add or delete statistics.

Clicking on a file allows viewing line-by-line diff, including old line numbers, new line numbers, and addition/deletion highlights.

Uncommitted Changes, Comparison, and Display Settings

The plugin also includes these entries:

  • Expanding Uncommitted Changes to check workspace files and file-by-file diffs;
  • Comparing file changes between any two commits;
  • A metadata bar listing repository tags and stashes;
  • A display settings panel including date column, author column, hash column, date format, and graph style, persisted per repository;
  • Keyboard shortcuts: up and down arrows to move selection, Ctrl+F to find, Ctrl+Shift+F to open settings;
  • Loading more commits on demand, up to 500 commits.

If the current directory is not a Git repository or the repository has no commits, the page displays an empty state instead of a repository error.

Installation and Enablement

The following introduces the steps for installation, restart, and uninstallation.

1. Install or Update

Install v0.0.2 from GitHub:

dsh plugin --profile web add https://github.com/WhitePlusMS/dsh-git-graph/archive/refs/tags/v0.0.2.tar.gz

This command is used for installation and can also be used to update an existing installation.

2. Restart DSH Web

After installing or updating, you need to restart dsh web so that the Host entry and browser client load the new version.

3. Open Git Graph

After opening DSH Web, click Git Graph next to Chat and Trajectory in the view switcher.

4. Uninstall

If removal is needed, use:

dsh plugin --profile web remove dsh-git-graph

Typical Usage

View Current Workspace Git History

After installing and restarting DSH Web, enter Git Graph from the view switcher. The page reads the current session workspace and displays the commit topology, references, and change content of the current repository.

Using Model Tool Parameters

The plugin provides model tool parameters. Common parameters are:

git_graph({
  path?: string,          // Repository directory; defaults to the current session workspace
  max_commits?: number,   // 1..500, defaults to 100
  all?: boolean,          // Include all reachable refs, defaults to true
  first_parent?: boolean, // Follow only the first parent, defaults to false
  glob?: string[],        // Branch-name glob filters
  search?: string,        // Full-range search: hash, subject, author, email, ref name, date
  sort?: string           // Commit ordering: date, author-date, or topological; defaults to date
})

Default values:

  • max_commits range is 1 to 500, default 100;
  • all defaults to true;
  • first_parent defaults to false;
  • sort defaults to date.

Refresh and Empty State

When refreshing the current repository, it is not rendered as a session tool card, nor does it append a refresh event to the trajectory.

If the current directory is not a Git repository or the repository has no commits, the page shows an empty state.

Suitable Scenarios and Notes

Suitable for scenarios like:

  • Viewing Git history of the current workspace in DSH Web;
  • Viewing commit topology, branches, remote branches, tags, and HEAD references;
  • Viewing a specific commit’s parent commit, author, committer, date, and signature status;
  • Viewing file changes, line-by-line diffs, uncommitted changes, and differences between commits;
  • Wishing to refresh the Git Graph without generating session messages or tool trace entries.

Usage notes:

  • The current release version is read-only, does not modify Git data;
  • Host reads Git data via fixed subprocess parameters, does not use shell;
  • path is only used as the Git subprocess working directory and does not inject shell commands;
  • File read requests are validated to stay within the repository;
  • The plugin runs with the current dsh process permissions, check source code and license before installing;
  • License is MIT;
  • The directory page here is the DSH community plugin directory, not equivalent to the official app store.

Links

  • Directory page: https://www.skillhub.cn/plugins/WhitePlusMS/dsh-git-graph
  • GitHub: https://github.com/WhitePlusMS/dsh-git-graph