dsh-github-flow 0.1.7 β†’ 0.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.en.md CHANGED
@@ -5,11 +5,12 @@
5
5
  <a href="https://www.npmjs.com/package/dsh-github-flow"><img src="https://img.shields.io/npm/dm/dsh-github-flow.svg?style=flat-square&color=2ea043" alt="npm downloads" /></a>
6
6
  <a href="./LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square" alt="license" /></a>
7
7
  <a href="https://deepseek-harness.github.io/deepseek-harness/"><img src="https://img.shields.io/badge/Cordis-Compatible-8957e5.svg?style=flat-square" alt="Cordis" /></a>
8
+ <img src="https://img.shields.io/badge/Platform-macOS%20%7C%20Windows%20%7C%20Linux-informational.svg?style=flat-square" alt="Platform" />
8
9
  </p>
9
10
 
10
11
  <p align="center">
11
- <b>Modern, native GitHub workflow integration plugin for DeepSeek Harness (DSH) powered by GitHub CLI (<code>gh</code>).</b><br>
12
- Deeply connects local Git repository development with remote GitHub collaboration (PRs, Issues, Actions CI diagnosis, and code reviews), featuring Agent model tools, human slash commands, and dual native Web UI views.
12
+ <b>Give DeepSeek Harness Agents native hands and feet to operate GitHub, crafting an immersive collaboration cockpit for developers.</b><br>
13
+ Natively reuses host <code>gh</code> CLI login credentials to eliminate Personal Access Token (PAT) leaks; deeply bridges local Git workspaces with remote GitHub collaboration, equipped with <b>5 core domain Agent tools</b>, <b>human slash commands</b>, <b>Web UI visual cockpits</b>, and <b>cross-platform one-click seamless upgrades</b>.
13
14
  </p>
14
15
 
15
16
  <p align="center">
@@ -18,122 +19,254 @@
18
19
 
19
20
  ---
20
21
 
21
- ## 🌟 Key Features
22
-
23
- 1. **Zero-Configuration Authentication**:
24
- - Seamlessly reuses existing host credentials from `gh auth login` (OAuth tokens / system Keyrings) without exposing plain-text Personal Access Tokens (PATs) in DSH.
25
- 2. **Deep Workspace Affinity & Zero-Config Detection**:
26
- - Automatically scopes commands to the active session workspace by natively reading local `.git/config` and mapping DSH `workspace.json`. Enhanced with Git repository validation, parent-child directory auto-penetration, and session ID propagation to eliminate misidentification, so neither models nor humans need to supply redundant `owner/repo` arguments.
27
- 3. **High Signal-to-Noise Ratio & Token Budget Protection**:
28
- - Consolidates over 70+ scattered micro-tools into **5 focused domain tools**.
29
- - Queries use `--json <fields>` projections by default; long diffs and failed CI logs are safely truncated (default 24KB) to protect the model's context window.
30
- - All tool outputs are defensively normalized into root objects to strictly comply with DSH Tool Gateway schema validation.
31
- 4. **Dual Native Web UI Views & Multi-Dimensional Task Governance**:
32
- - **Global Cockpit** (`sidebar.panellist`, Order 20): Account-wide repository overview, local workspace matrix mapping, and a reconstructed **3-dimensional Issue aggregation engine** ("User Reported" / "Assigned to Me" / "Created by Me") featuring 4-state filter pills and role badges.
33
- - **Right Sidebar Panel** (`sidebarRightTabs`, Order 40): Shows current repository status, PR list with CI check pills, **active workspace issues list** (with author attribution, role badges, labels, and external links), Actions pipelines, and quick action shortcuts (Open Repo, View All Issues, View All PRs, Create PR, New Issue) with zero popup dependencies.
34
- - **Native Light/Dark Dual-Theme Adaptation**: Deeply aligned with DSH official DSW (DeepSeek Web) design tokens, seamlessly reacting to `body[data-ds-dark-theme]` without lag or flickering.
35
- 5. **Robust Environment Diagnosis & Three-State Setup Engine**:
36
- - Zero-guesswork onboarding: Accurately differentiates `NOT_INSTALLED` (`Missing`), `NOT_LOGGED_IN` (`Required`), and `AUTHENTICATED` (`Active`).
37
- - OS-aware installation guides: Auto-detects platform (Windows/macOS/Linux) and suggests native package manager commands (`winget install --id GitHub.cli`, `brew install gh`) with official installer links.
38
- - Interactive helpers: One-click command copying and security-whitelisted terminal launcher.
39
- - **Focus Auto-Recovery**: Automatically detects authorization completion when returning to the DSH window, transitioning to full workspace view without manual page reloads.
40
- 6. **Standard Cordis Microkernel Compliance**:
41
- - Exposes native `GitHubService` (`ctx.github`) for ecosystem extensibility;
42
- - Strongly typed runtime validation via Standard Schema (`Config`);
43
- - Domain event broadcasting (`github/pr:create`, `github/issue:create`).
22
+ ## 🎯 Why `dsh-github-flow`?
23
+
24
+ When using AI Agents for collaborative coding, developers frequently hit these fragmentation friction points:
25
+
26
+ | Collaborative Scenario | Traditional Approach (Friction-Heavy) | `dsh-github-flow` (Native Experience) |
27
+ | :--- | :--- | :--- |
28
+ | **Agent PRs & Code Review** | Manually push branch in browser, click through GitHub web pages to open PRs, breaking autonomous loops. | **Autonomous PRs & Reviews**: Just tell the Agent *"Create a PR for this branch"*; Agent calls `github_pr` to publish and review diffs automatically. |
29
+ | **CI / Actions Failure Debugging** | Sifting through pages of Actions logs in a browser, copying stack traces to chat for debugging. | **Pinpoint Error Extraction**: Tell the Agent *"Why did CI fail?"*; Agent calls `github_run(log_failed)` to grab failed step logs and patch code instantly. |
30
+ | **Security & Token Management** | Pasting plain-text Personal Access Tokens (PATs) in plugin configs, risking token leaks and permission sprawl. | **Zero Token Exposure**: Directly reuses local `gh auth login` credentials via native OS Keychains/Keyrings securely. |
31
+ | **Context Switching Overhead** | Jumping back and forth between VS Code, browser GitHub tabs, and DSH chat windows. | **Immersive Dual Cockpit**: Live PR status, Actions pipelines, and 3D issue matrices right inside DSH. |
32
+ | **First-Screen Latency & Loading** | Staring at full-screen spinners for 8~15s while waiting for heavy background `gh` processes. | **SWR 0ms Instant Render**: Instantly displays local persistent snapshots; dedicated settings modal to customize sync intervals and manual mode. |
33
+ | **Plugin Upgrades & Maintenance** | Manually checking npm registry versions, complicated commands, fear of breaking configs. | **Idle Silent Detection + One-Click Upgrade**: Dual-registry acceleration, auto macOS/Windows adaptation, upgrade with one click. |
34
+
35
+ ---
36
+
37
+ ## πŸ€– Core Agent Tools: Equipping Agents with Native GitHub Powers
38
+
39
+ Consolidates scattered GitHub endpoints into **5 core domain tools**, featuring **Token Budget Protection (default 24KB intelligent truncation)** and **Zero-argument CWD auto-binding**.
40
+
41
+ ### 1. `github_pr`: Pull Request Lifecycle & Automated Code Review
42
+ > **Example Agent Prompts**:
43
+ > - *"Check if there are any open PRs awaiting my review in this repository."*
44
+ > - *"Create a PR for the current branch titled 'feat: add dark mode' with a brief summary of changes."*
45
+ > - *"Review code diffs in PR #12 and provide security and refactoring suggestions."*
46
+ > - *"Did CI checks pass for PR #8? If so, squash merge it and delete the source branch."*
47
+
48
+ * **Supported Actions**:
49
+ * `list`: List open PRs with author, review decisions, and CI status;
50
+ * `view`: Inspect PR description, metadata, and mergeability;
51
+ * `diff`: Retrieve complete code diffs (safely truncated against token limits);
52
+ * `checks`: Audit CI status check rollups and test suites;
53
+ * `create`: Auto-create PRs (supports draft mode & `--dry-run`);
54
+ * `review`: Submit code reviews (`APPROVE`, `REQUEST_CHANGES`, `COMMENT`);
55
+ * `merge`: Merge pull requests (`squash` / `merge` / `rebase`, optional `delete_branch`).
56
+
57
+ ---
58
+
59
+ ### 2. `github_run`: Actions CI Pipeline & Failure Diagnostics (Agent Auto-Fix Core)
60
+ > **Example Agent Prompts**:
61
+ > - *"Why did the latest Actions workflow fail? Extract failed step logs and fix the code."*
62
+ > - *"Show me the status of the last 5 CI runs in this repository."*
63
+ > - *"Rerun the failed workflow from earlier."*
64
+
65
+ * **Supported Actions**:
66
+ * `log_failed` (πŸ”₯ **Killer Feature**): **Optimized for Agents**; automatically extracts isolated error logs from failed steps for instant root-cause analysis;
67
+ * `list`: View recent workflow runs and conclusions;
68
+ * `view`: Inspect jobs and steps for a specific run ID;
69
+ * `rerun`: Re-trigger failed CI runs;
70
+ * `cancel`: Cancel in-progress workflows.
71
+
72
+ ---
73
+
74
+ ### 3. `github_issue`: Issue Tracking & Closed-Loop Tasks
75
+ > **Example Agent Prompts**:
76
+ > - *"File an issue for the memory leak we just reproduced, labeled 'bug' and 'backend'."*
77
+ > - *"List all open issues assigned to me."*
78
+ > - *"Comment on Issue #45: 'Fixed on master branch, awaiting verification'."*
79
+ > - *"Close Issue #45."*
80
+
81
+ * **Supported Actions**:
82
+ * `list`: Query issues with flexible filters;
83
+ * `view`: Read issue body and discussion history;
84
+ * `create`: Create new issues (title, body, labels, assignees);
85
+ * `comment`: Append debugging updates or notes;
86
+ * `close` / `reopen`: Manage issue lifecycle states.
87
+
88
+ ---
89
+
90
+ ### 4. `github_repo`: Repository Exploration & Cross-Repo Code Search
91
+ > **Example Agent Prompts**:
92
+ > - *"Search for usages of 'createPrTool' across this repository."*
93
+ > - *"Search GitHub for popular open-source repositories related to 'dsh-plugin'."*
94
+ > - *"Show repository metadata and star count for cli/cli."*
95
+
96
+ * **Supported Actions**:
97
+ * `view`: View repository metadata (default branch, stars, description, visibility);
98
+ * `search_code`: Search code symbols in current or specified repositories;
99
+ * `search_repos`: Search open-source GitHub repositories globally.
100
+
101
+ ---
102
+
103
+ ### 5. `github_api`: Low-Level Escape Hatch
104
+ > **Example Agent Prompts**:
105
+ > - *"Call GitHub API to fetch latest releases of current repository and parse tag names with jq."*
106
+
107
+ * **Core Strength**: Call any GitHub REST or GraphQL API using local credentials with `--jq` filtering and `raw` text mode.
44
108
 
45
109
  ---
46
110
 
47
- ## πŸ“Έ UI Previews
111
+ ## πŸ–₯️ Native Web UI Workspace & Sync Preferences
48
112
 
49
- ### Global Cockpit (Main Navigation)
50
- Overview of account-wide repositories, local workspace matrix mapping, and multi-dimensional categorized issues (supports filter pills across All, User Reported, Assigned, and Created with status badges):
113
+ No more window switching! Seamlessly integrated into DSH with DSW design tokens and instant light/dark theme adaptation.
114
+
115
+ ### 1. Global Cockpit (Main Navigation Slot)
116
+ Access via the GitHub icon in the main left navigation:
117
+ * **⚑ 0ms Instant Render (SWR Persistent Cache)**: Powered by local snapshot persistence; say goodbye to full-screen 8~15s spinner freezes and enjoy instant dashboard loading;
118
+ * **πŸ“¦ Live Freshness Status Pill**: Transparently communicates data freshness right next to the title (`[πŸ“¦ Local Snapshot (21m ago)]` βž” `[⏳ Syncing in background...]` βž” `[βœ… Up to date (15:30)]` βž” `[⚠️ Timeout, cached data preserved]`);
119
+ * **Account-Wide Overview**: Live view of all cloud repositories, default branches, and star counts;
120
+ * **Local Workspace Matrix**: Automatically detects open projects and bridges local directories with remote repos;
121
+ * **3D Issue Governance Matrix**: Categorizes issues into *"πŸ“₯ User Reported"*, *"🎯 Assigned to Me"*, and *"✍️ Created by Me"* with responsive pill filters;
122
+ * **Update Notification Banner**: Smoothly glides down when an update is available with one-click automated upgrade.
51
123
 
52
124
  <p align="center">
53
125
  <img src="./docs/images/1.png" alt="GitHub Global Cockpit" width="100%" />
54
126
  </p>
55
127
 
56
- ### Session Right Sidebar Panel (In-Session Collaboration)
57
- Automatically detects current workspace repository, displaying live PR checks, workspace open issues list, Actions pipelines, and quick action shortcuts:
128
+ ### 2. Session Right Sidebar Panel (Workspace Drawer)
129
+ Located in the right drawer of every chat workspace:
130
+ * **Context Auto-Binding**: Automatically locks onto the active Git repository;
131
+ * **Freshness Pill Alignment**: Compact indicator `[πŸ“¦ Local Snapshot (2m ago)]` with live `[πŸ”„ Refresh]` button, 100% aligned with global rules;
132
+ * **PR Status Pills**: Live PR inspection with CI checks and review badges;
133
+ * **Workspace Open Issues List**: Direct issue task review with author badges and external links;
134
+ * **Latest Actions Pipeline**: Real-time CI workflow status tracking;
135
+ * **Quick Action Grid**: Open repo in browser, jump to Issues/PRs, create PRs with one click.
58
136
 
59
137
  <p align="center">
60
138
  <img src="./docs/images/2.png" alt="Session Right Sidebar Panel" width="100%" />
61
139
  </p>
62
140
 
141
+ ### 3. Data Sync & Cache Settings (Sync Preferences Modal)
142
+ Click **`[βš™οΈ Sync Settings]`** in the top right of the Cockpit to adjust synchronization:
143
+ * **Three Flexible Sync Strategies**:
144
+ * **⚑ Instant Render (SWR, Recommended)**: Instantly displays local cache (0ms), silently syncing latest state in background;
145
+ * **πŸ“‹ Manual Only (Energy Saver)**: Browse local cache only; zero background `gh` processes triggered;
146
+ * **⏱️ Periodic Auto Poll**: Background polling according to custom intervals while cockpit is open.
147
+ * **Custom Polling Intervals**: Choose from 1 min / 5 mins (Default) / 15 mins / 30 mins (Energy Saver) / 1 hour / Never;
148
+ * **Visual Cache Management**: Real-time snapshot size and timestamp visibility with one-click `[πŸ—‘οΈ Clear Cache]`.
149
+
150
+ <p align="center">
151
+ <img src="./docs/images/3.png" alt="Data Sync Settings Modal" width="85%" />
152
+ </p>
153
+
63
154
  ---
64
155
 
65
- ## πŸš€ Installation
156
+ ## πŸš€ Installation Guide
157
+
158
+ ### Step 1: Prerequisites
159
+ Ensure GitHub CLI (`gh`) is installed and authenticated:
160
+ ```bash
161
+ # Windows
162
+ winget install --id GitHub.cli
163
+
164
+ # macOS
165
+ brew install gh
166
+
167
+ # Login (one-time setup)
168
+ gh auth login
169
+ ```
170
+
171
+ ### Step 2: Install into DSH
66
172
 
67
- Run in your DSH terminal to install directly from npm:
173
+ Run in your DSH environment:
68
174
 
69
175
  ```bash
70
- # Install to desktop profile
176
+ # Scenario A: DSH Desktop Edition (Desktop Profile)
71
177
  dsh plugin --profile desktop add dsh-github-flow
72
178
 
73
- # Or install to web profile
74
- dsh plugin --profile web add dsh-github-flow
179
+ # Scenario B: DSH Web / CLI Environment
180
+ pnpm dsh plugin add dsh-github-flow
75
181
  ```
76
182
 
77
183
  ---
78
184
 
79
- ## πŸ› οΈ Agent Tools Reference
185
+ ## ⚑ Smart Upgrades & Cross-Platform Engine
186
+
187
+ Never miss an update! Built-in industrial-grade update management:
188
+
189
+ 1. **Business-First, Idle Background Detection**:
190
+ - Primary PR/Issue data loads and renders **instantly in milliseconds**;
191
+ - Update checks run **1.5 seconds later during idle periods**, ensuring zero impact on user workflows.
192
+ 2. **Dual-Registry Acceleration**:
193
+ - Prioritizes npmmirror for ultra-fast checks (50~150ms in mainland regions) with seamless fallback to official npmjs.
194
+ 3. **Cross-Platform One-Click Upgrade**:
195
+ - **Click to Upgrade**: Click **`[⚑ Upgrade]`** in the UI to update in the background;
196
+ - **Auto OS Adaptation**: Differentiates macOS and Windows; auto-injects Homebrew PATH variables on macOS GUI launches;
197
+ - **Source Protection**: Automatically aborts npm overwrites when running in local Git linked development mode (`link:`);
198
+ - **Restart Guidance**: Clearly notifies users to restart DSH service to reload backend tools, with instant web refresh options.
199
+
200
+ ---
201
+
202
+ ## ⏱️ SWR Instant Render & Sync Rhythm Control
203
+
204
+ Why did the Global Cockpit take several seconds to load in earlier releases? Because it concurrently executes a dozen `gh` processes scanning multiple repositories and workspaces. This plugin integrates the **Stale-While-Revalidate (SWR)** caching pattern, putting total control back in your hands:
205
+
206
+ ```
207
+ Initial Mount (0ms) ──────────> Instantly render local persistent snapshot
208
+ β”‚
209
+ β”œβ”€β”€ SWR Mode: Idle 300ms delay, silently revalidate in background
210
+ β”œβ”€β”€ Manual Mode: Browse offline snapshot, only fetch on click [πŸ”„ Refresh]
211
+ └── Auto Poll: Periodically update according to chosen interval (e.g., 5m/30m)
212
+ ```
213
+
214
+ ### Strategy Comparison & Recommendations:
80
215
 
81
- | Tool Name | Actions | Typical Use Cases |
82
- |---|---|---|
83
- | `github_pr` | `list`, `view`, `create`, `diff`, `checks`, `review`, `merge` | Inspect PR details, verify CI checks, conduct code reviews, merge pull requests |
84
- | `github_issue` | `list`, `view`, `create`, `comment`, `close`, `reopen` | Search and view issues, create issues, add comments |
85
- | `github_run` | `list`, `view`, `log_failed`, `rerun`, `cancel` | Monitor Actions workflows; `log_failed` extracts failure logs for automatic fixes |
86
- | `github_repo` | `view`, `search_code`, `search_repos` | Query repository metadata, search cross-repo code |
87
- | `github_api` | Any GitHub REST / GraphQL endpoint | Universal escape hatch for custom queries (supports `--jq`, plus a `raw` response-body mode) |
216
+ | Sync Strategy | Mechanism | Recommended Use Case |
217
+ | :--- | :--- | :--- |
218
+ | **⚑ Instant Render (SWR, Default)** | **0ms instantaneous mount** from local cache, silently revalidating in background. | **Recommended for all developers**. Eliminates spinner freezes, delivering seamless UX. |
219
+ | **πŸ“‹ Manual Only (Energy Saver)** | Browse local cache only; zero automated background `gh` processes. | **Battery-powered laptops, low-spec hardware, or metered networks**. Zero background waste. |
220
+ | **⏱️ Periodic Auto Poll** | Background polls status at user-specified intervals (1m to 1h). | **Maintainer workstations & dedicated monitoring setups**. Keep tasks strictly up to date. |
221
+
222
+ * **Offline Resilience (Fail-Safe)**: Even when disconnected or hitting network timeouts, **your dashboard preserves the complete snapshot for searching, navigation, and reviewβ€”zero blank screens or crash popups!**
88
223
 
89
224
  ---
90
225
 
91
226
  ## πŸ’¬ Human Slash Commands
92
227
 
93
- In any DSH chat prompt:
94
- - `/gh status`: Check current GitHub CLI authentication status, granted scopes, and active repository;
95
- - `/gh help`: Display quick reference and help information.
228
+ Type directly into the DSH chat box:
229
+
230
+ * `/gh status`: Diagnostics for GitHub account authentication, scopes, repository binding, and plugin version;
231
+ * `/gh upgrade`: Check latest npm version with platform-adapted upgrade commands;
232
+ * `/gh help`: View command usage and Agent prompt examples.
96
233
 
97
234
  ---
98
235
 
99
- ## βš™οΈ Configuration
236
+ ## βš™οΈ Configuration (`cordis.patch.yml`)
100
237
 
101
- Customize options in your `cordis.patch.yml` or profile:
238
+ Works out of the box, with optional tweaks in `cordis.patch.yml` or your profile:
102
239
 
103
240
  ```yaml
104
241
  - insert:
105
242
  - id: github-flow
106
243
  name: dsh-github-flow
107
244
  config:
108
- ghPath: 'gh' # Custom path to gh binary
109
- defaultTimeoutMs: 30000 # Timeout in milliseconds
110
- maxOutputChars: 24000 # Maximum characters per output (Token guard)
111
- maxOutputBytes: 96000 # Hard UTF-8 byte ceiling per output, defaults to maxOutputChars * 4
112
- cacheTtlMs: 15000 # Single-repo overview cache TTL (ms); the global cockpit caches for 20x this, floor 5 minutes
113
- defaultListLimit: 20 # Default page size
245
+ ghPath: 'gh' # GitHub CLI executable path
246
+ defaultTimeoutMs: 30000 # Command timeout in milliseconds (default 30s)
247
+ maxOutputChars: 24000 # Safe output character ceiling (Token protection)
248
+ maxOutputBytes: 96000 # Safe UTF-8 byte ceiling (default maxOutputChars * 4)
249
+ cacheTtlMs: 15000 # Repository overview cache TTL (default 15s)
250
+ checkUpdate: true # Enable automatic update checks (default true)
251
+ updateCheckIntervalMs: 86400000 # Check interval in ms (default 24h)
252
+ registryUrl: '' # Custom private npm registry URL
114
253
  ```
115
254
 
116
- > On Web panel refresh cadence: a global cockpit refresh runs a dozen or so `gh` calls
117
- > (measured 8-13 s on a local machine), so it caches for 5 minutes and re-fetches when you
118
- > click "πŸ”„ Refresh global data". The workspace matrix only reads local `.git/config` to
119
- > identify repository ownership and makes no network requests. The `/gh status` command
120
- > always bypasses the auth cache, so you see the real state immediately after `gh auth login`.
121
-
122
255
  ---
123
256
 
124
- ## πŸ”Œ Ecosystem Service Extension (Cordis Service)
257
+ ## πŸ”Œ Ecosystem Extensibility (Cordis Service)
125
258
 
126
- Other DSH plugins can consume GitHub CLI capabilities via dependency injection:
259
+ Provides standard Cordis service `ctx.github`. Other plugins can reuse it directly:
127
260
 
128
- ```ts
261
+ ```typescript
129
262
  import type { Context } from '@deepseek-ai/cordis';
130
263
 
131
264
  export const inject = ['github'];
132
265
 
133
266
  export function apply(ctx: Context) {
134
- // Directly invoke the underlying secure execution engine via ctx.github
135
267
  const auth = await ctx.github.checkAuth();
136
268
  const repo = await ctx.github.getRepoMetadata();
269
+ const prs = await ctx.github.run(['pr', 'list', '--json', 'number,title']);
137
270
  }
138
271
  ```
139
272
 
@@ -141,11 +274,11 @@ export function apply(ctx: Context) {
141
274
 
142
275
  ## πŸ“š Documentation
143
276
 
144
- - [npm Publishing & Maintenance Guide](./docs/npm-publish-guide.md)
145
- - [Architecture & Design Specifications](./docs/architecture.md)
277
+ - [npm Publishing & Automated CI Guide](./docs/npm-publish-guide.md)
278
+ - [Architecture & Technical Specifications](./docs/architecture.md)
146
279
 
147
280
  ---
148
281
 
149
282
  ## πŸ“„ License
150
283
 
151
- This project is licensed under the [MIT License](./LICENSE).
284
+ Open-sourced under the [MIT License](./LICENSE). Contributions, PRs, and Issues are welcome!