dsh-github-flow 0.4.0 → 0.5.0
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 +75 -8
- package/README.md +75 -8
- package/docs/UPGRADE-NOTES.md +9 -12
- package/docs/architecture.md +39 -21
- package/lib/api/routes-actions.js +132 -0
- package/lib/client.d.ts +4 -3
- package/lib/client.js +1436 -80
- package/lib/commands/gh.d.ts +6 -1
- package/lib/commands/gh.js +144 -71
- package/lib/executor/git-parser.d.ts +33 -1
- package/lib/executor/git-parser.js +116 -4
- package/lib/executor.d.ts +27 -2
- package/lib/executor.js +189 -5
- package/lib/main.js +28 -4
- package/lib/renderers/agent-task.d.ts +16 -0
- package/lib/renderers/agent-task.js +107 -0
- package/lib/renderers/codespace.d.ts +16 -0
- package/lib/renderers/codespace.js +103 -0
- package/lib/renderers/discussion.d.ts +16 -0
- package/lib/renderers/discussion.js +101 -0
- package/lib/renderers/markdown.d.ts +4 -0
- package/lib/renderers/markdown.js +4 -0
- package/lib/renderers/project.d.ts +20 -0
- package/lib/renderers/project.js +128 -0
- package/lib/renderers/skill.d.ts +30 -0
- package/lib/renderers/skill.js +180 -0
- package/lib/renderers/status.d.ts +5 -0
- package/lib/renderers/status.js +52 -0
- package/lib/telemetry.d.ts +70 -0
- package/lib/telemetry.js +161 -0
- package/lib/tools/agent-task.d.ts +54 -0
- package/lib/tools/agent-task.js +135 -0
- package/lib/tools/codespace.d.ts +51 -0
- package/lib/tools/codespace.js +154 -0
- package/lib/tools/discussion.d.ts +70 -0
- package/lib/tools/discussion.js +195 -0
- package/lib/tools/help.js +109 -9
- package/lib/tools/project.d.ts +80 -0
- package/lib/tools/project.js +241 -0
- package/lib/tools/repo.js +13 -1
- package/lib/tools/skill.d.ts +24 -1
- package/lib/tools/skill.js +115 -5
- package/lib/tools/status.d.ts +3 -2
- package/lib/tools/status.js +9 -4
- package/lib/types.d.ts +5 -0
- package/lib/ui/commit-modal.js +144 -14
- package/lib/ui/help-modal.d.ts +15 -0
- package/lib/ui/help-modal.js +202 -0
- package/lib/ui/storage.d.ts +9 -0
- package/lib/ui/storage.js +24 -0
- package/lib/ui/styles.d.ts +1 -1
- package/lib/ui/styles.js +259 -0
- package/lib/ui/sync-settings-modal.js +1 -1
- package/lib/ui/upgrade-card.js +39 -14
- package/lib/ui/utils.d.ts +35 -0
- package/lib/ui/utils.js +160 -0
- package/lib/ui/workspace-panel.js +30 -5
- package/lib/upgrade-manager.d.ts +5 -1
- package/lib/upgrade-manager.js +24 -1
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +2 -2
package/README.en.md
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
<p align="center">
|
|
12
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>
|
|
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>18 core domain Agent tools (104 actions covering PR review/Issue tracking/Actions workflow & cache governance/clone-free file reads/branch ruleset policy diagnosis/Gist snippets/labels & global status dashboards/secrets & variables/agent tasks/discussions/projects v2/codespaces/runtime telemetry)</b>, <b>human slash commands</b>, <b>Web UI visual cockpits</b>, and <b>cross-platform one-click seamless upgrades</b>.
|
|
14
14
|
</p>
|
|
15
15
|
|
|
16
16
|
<p align="center">
|
|
@@ -73,7 +73,7 @@ dsh plugin --profile web add dsh-github-flow
|
|
|
73
73
|
|
|
74
74
|
## 🤖 Core Agent Tools: Equipping Agents with Native GitHub Powers
|
|
75
75
|
|
|
76
|
-
Consolidates scattered GitHub endpoints into **
|
|
76
|
+
Consolidates scattered GitHub endpoints into **18 core domain tools (104 actions)** with an official command coverage of **87% (104/120)**, featuring **Token Budget Protection (default 24KB intelligent truncation)**, **High-density Native Markdown Rendering (70%+ list output token reduction)**, **OAuth Scope self-healing guidance**, and **Zero-argument CWD auto-binding**.
|
|
77
77
|
|
|
78
78
|
### 1. `github_pr`: Pull Request Lifecycle & Automated Code Review
|
|
79
79
|
> **Example Agent Prompts**:
|
|
@@ -205,7 +205,9 @@ Consolidates scattered GitHub endpoints into **14 core domain tools (85+ actions
|
|
|
205
205
|
* `search`: Discover compliant Agent skills across open-source GitHub repositories;
|
|
206
206
|
* `preview`: Preview `SKILL.md` rule instructions without installing;
|
|
207
207
|
* `install`: Install skills locally (`scope: 'project'` or `'user'`; requires `confirm: true`);
|
|
208
|
-
* `list`: Inspect installed skills in the current environment
|
|
208
|
+
* `list`: Inspect installed skills in the current environment;
|
|
209
|
+
* `publish`: 🆕 **Skill Compliance Validation & Publishing Loop**: Safe `--dry-run` inspection against agentskills.io specifications, `--fix` metadata stripping, and release publishing with required `tag` and `confirm: true`;
|
|
210
|
+
* `update`: 🆕 **Batch Inspection & Sync Updates**: Safe `--dry-run` check comparing local and remote tree SHAs, with `--all` batch synchronization.
|
|
209
211
|
|
|
210
212
|
---
|
|
211
213
|
|
|
@@ -216,11 +218,11 @@ Consolidates scattered GitHub endpoints into **14 core domain tools (85+ actions
|
|
|
216
218
|
> - *"How do I debug 'authentication failed' errors from gh?"*
|
|
217
219
|
|
|
218
220
|
* **Supported Actions**:
|
|
219
|
-
* `overview`: Complete toolbox navigation and summary table (
|
|
221
|
+
* `overview`: Complete toolbox navigation and summary table (18 core tools);
|
|
220
222
|
* `mapping`: **Official gh Command ↔ Tool Action Mapping Table**, detailing exact tool calls and REST/GraphQL fallback routes;
|
|
221
223
|
* `search_syntax`: Date ranges, qualifiers, and boolean query syntax;
|
|
222
224
|
* `troubleshooting`: Self-healing recipes for authentication loss, timeouts, SOCKS5 proxy configs, and permissions;
|
|
223
|
-
* Domain guides: In-depth usage guides for `pr`, `issue`, `run`, `repo`, `release`, `secret`, `skill`, `label`, `ruleset`, `cache`, `gist`, and `
|
|
225
|
+
* Domain guides: In-depth usage guides for `pr`, `issue`, `run`, `repo`, `release`, `secret`, `skill`, `label`, `ruleset`, `cache`, `gist`, `status`, `agent_task`, `discussion`, `project`, and `codespace`;
|
|
224
226
|
* `gh_command`: Direct pass-through lookup of official gh manual entries (e.g. `gh_command: 'ruleset'`).
|
|
225
227
|
|
|
226
228
|
---
|
|
@@ -290,13 +292,78 @@ Consolidates scattered GitHub endpoints into **14 core domain tools (85+ actions
|
|
|
290
292
|
|
|
291
293
|
---
|
|
292
294
|
|
|
293
|
-
### 14. `github_status`: Cross-Repository Todo &
|
|
295
|
+
### 14. `github_status`: Cross-Repository Todo & Runtime Health Dashboard
|
|
294
296
|
> **Example Agent Prompts**:
|
|
295
297
|
> - *"What tasks and pull requests need my attention on GitHub today?"*
|
|
296
298
|
> - *"Check recent @mentions and activity across all repositories I follow."*
|
|
299
|
+
> - *"Audit the runtime health score and degradation rate report of our GitHub tools."*
|
|
297
300
|
|
|
298
301
|
* **Supported Actions**:
|
|
299
|
-
* `view`: **Account-level global status cockpit
|
|
302
|
+
* `view`: **Account-level global status cockpit** (default), aggregating Assigned Issues, Assigned PRs, Review Requests, Mentions, and Repository Activity across all subscribed repositories without needing repository context; supports `-o` org filtering and `-e` noise repository exclusion;
|
|
303
|
+
* `health`: 🆕 **Toolchain Runtime Health & Degradation Audit Report**: Powered by Cordis `tools/result` event telemetry, audits total calls, success rates, comprehensive health score (0-100), API degradation rates, and actionable self-healing upgrade suggestions across all 18 tools.
|
|
304
|
+
|
|
305
|
+
---
|
|
306
|
+
|
|
307
|
+
### 15. `github_agent_task`: Cloud Coding Agent Session Governance
|
|
308
|
+
> **Example Agent Prompts**:
|
|
309
|
+
> - *"List all GitHub Copilot Coding Agent task sessions assigned under my account."*
|
|
310
|
+
> - *"View task 'e2fa49d2' details and fetch its execution logs."*
|
|
311
|
+
> - *"Dispatch a task to the cloud Agent: 'Refactor network layer with retry support', based on branch develop."*
|
|
312
|
+
|
|
313
|
+
* **Supported Actions**:
|
|
314
|
+
* `list`: List agent tasks (supports `-L/--limit` and `-R/--repo`);
|
|
315
|
+
* `view`: View task session details and logs (supports `--log`, strictly requires `task_id` to prevent TTY hangs);
|
|
316
|
+
* `create`: Create and dispatch a cloud agent coding task (supports `-b/--base` and `-a/--custom-agent`).
|
|
317
|
+
|
|
318
|
+
---
|
|
319
|
+
|
|
320
|
+
### 16. `github_discussion`: Team Discussions & Open-Source RFC Loop
|
|
321
|
+
> **Example Agent Prompts**:
|
|
322
|
+
> - *"List open discussions in category 'Ideas' for this repository."*
|
|
323
|
+
> - *"View discussion #101 body and comment thread."*
|
|
324
|
+
> - *"Start a discussion under 'RFC': 'Proposal on telemetry observability'."*
|
|
325
|
+
> - *"Post a reply comment to discussion #101."*
|
|
326
|
+
|
|
327
|
+
* **Supported Actions**:
|
|
328
|
+
* `list`: Query discussions (supports `-c/--category`, `-s/--state`, `--labels`, and `-S/--search`);
|
|
329
|
+
* `view`: Read discussion body and replies (supports `--comments`, requires `discussion_number`);
|
|
330
|
+
* `create`: Start a discussion (requires `category`, `title`, and `body`);
|
|
331
|
+
* `edit`: Update discussion title or body;
|
|
332
|
+
* `comment`: Post a comment reply to an existing discussion.
|
|
333
|
+
|
|
334
|
+
---
|
|
335
|
+
|
|
336
|
+
### 17. `github_project`: Projects v2 Board & Item Planning
|
|
337
|
+
> **Example Agent Prompts**:
|
|
338
|
+
> - *"List all Projects v2 boards under my account."*
|
|
339
|
+
> - *"View items in project board #1 with filter query 'is:open'."*
|
|
340
|
+
> - *"Add Issue 'https://github.com/owner/repo/issues/10' to project board #1."*
|
|
341
|
+
> - *"Create a draft issue item in project #1 titled 'Review unit test coverage'."*
|
|
342
|
+
|
|
343
|
+
* **Supported Actions**:
|
|
344
|
+
* `list`: List user or organization projects (default `owner: '@me'`, natively handles `--format json`);
|
|
345
|
+
* `view`: Inspect project metadata, visibility, description, and README;
|
|
346
|
+
* `item-list`: Inspect board items (supports Projects query filter syntax `--query`, e.g., `is:open assignee:@me`);
|
|
347
|
+
* `item-add`: Associate existing Issue/PR URLs to a project board;
|
|
348
|
+
* `item-create`: Create draft issue items;
|
|
349
|
+
* `item-delete`: Remove items from board (guarded by required `confirm: true`);
|
|
350
|
+
* 🔑 **Scope Self-Healing**: Automatically renders a single-line self-healing command card (`gh auth refresh -s read:project`) when permissions are missing.
|
|
351
|
+
|
|
352
|
+
---
|
|
353
|
+
|
|
354
|
+
### 18. `github_codespace`: Cloud Remote Development Environment (MVP)
|
|
355
|
+
> **Example Agent Prompts**:
|
|
356
|
+
> - *"Check which cloud Codespace environments are currently running."*
|
|
357
|
+
> - *"Inspect instance specs and idle timeout for 'fuzzy-spoon-69vj'."*
|
|
358
|
+
> - *"Stop 'fuzzy-spoon-69vj' to avoid billable core-hour consumption."*
|
|
359
|
+
> - *"Permanently delete an unused temporary Codespace."*
|
|
360
|
+
|
|
361
|
+
* **Supported Actions**:
|
|
362
|
+
* `list`: List Codespaces under current user or organization;
|
|
363
|
+
* `view`: Inspect environment specs, DevContainer path, and status (requires `codespace` name);
|
|
364
|
+
* `stop`: Stop running instances to halt billing immediately;
|
|
365
|
+
* `delete`: Safely delete instances (requires `confirm: true`, passes `-f` for non-interactive execution);
|
|
366
|
+
* 🔑 **Scope Self-Healing**: Automatically renders a single-line self-healing command card (`gh auth refresh -h github.com -s codespace`) when missing required scopes.
|
|
300
367
|
|
|
301
368
|
---
|
|
302
369
|
|
|
@@ -426,7 +493,7 @@ Initial Mount (0ms) ──────────> Instantly render local persi
|
|
|
426
493
|
|
|
427
494
|
Enter in any DSH chat window:
|
|
428
495
|
|
|
429
|
-
* `/gh status`: Diagnostics for GitHub CLI auth status, scopes, active workspace repository, and
|
|
496
|
+
* `/gh status`: Diagnostics for GitHub CLI auth status, scopes, active workspace repository, plugin version, and **runtime toolchain telemetry (health score & degradation rates)**;
|
|
430
497
|
* `/gh upgrade`: Check the latest npm release and output platform-tailored upgrade instructions (macOS / Windows / Linux);
|
|
431
498
|
* `/gh help`: View help documentation and example Agent dialogue recipes.
|
|
432
499
|
|
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
<p align="center">
|
|
12
12
|
<b>让 DeepSeek Harness Agent 拥有操作 GitHub 的原生手和脚,为人机协作打造沉浸式 GitHub 工作台。</b><br>
|
|
13
|
-
原生复用宿主机 <code>gh</code> CLI 安全登录凭据,告别 Personal Access Token 泄露;深度打通本地 Git 工作区与云端仓库协作,兼具 <b>
|
|
13
|
+
原生复用宿主机 <code>gh</code> CLI 安全登录凭据,告别 Personal Access Token 泄露;深度打通本地 Git 工作区与云端仓库协作,兼具 <b>18 大领域 Agent 核心工具(104 个 action,覆盖 PR 审查/Issue 任务/Actions 工作流与构建缓存治理/免 clone 读文件/分支规则集策略排障/代码片段 Gist/标签与全局待办大盘/密钥与变量管理/智能体任务会话/社区 Discussions 讨论/Projects v2 看板/云端 Codespaces/运行时遥测与自愈健康度)</b>、<b>人类 Slash 快捷指令</b>、<b>Web UI 全景工作台</b> 与 <b>一键自动跨平台无缝升级</b>。
|
|
14
14
|
</p>
|
|
15
15
|
|
|
16
16
|
<p align="center">
|
|
@@ -73,7 +73,7 @@ dsh plugin --profile web add dsh-github-flow
|
|
|
73
73
|
|
|
74
74
|
## 🤖 核心工具集 (Agent Tools):给 Agent 装上 GitHub 的手和脚
|
|
75
75
|
|
|
76
|
-
本插件精选聚合为 **
|
|
76
|
+
本插件精选聚合为 **18 大领域核心工具(104 个 action)**,官方命令语义化覆盖率高达 **87%(104/120)**,拒绝几十个无用微型工具撑爆 Agent 上下文,原生搭载 **Token 防溢出保护(默认 24KB 智能二分截断)**、**高密度 Markdown 原生渲染(列表输出压缩 70%+ Token)**、**OAuth Scope 缺失单行自愈引导** 与 **零参数 CWD 智能绑定**。
|
|
77
77
|
|
|
78
78
|
### 1. `github_pr`:PR 全生命周期管理与自动化代码审查
|
|
79
79
|
> **典型对话指令**:
|
|
@@ -205,7 +205,9 @@ dsh plugin --profile web add dsh-github-flow
|
|
|
205
205
|
* `search`:跨 GitHub 开源仓库检索符合规范的 Agent Skills;
|
|
206
206
|
* `preview`:免安装直接在线预览指定 Skill 的 `SKILL.md` 规则与行为指令;
|
|
207
207
|
* `install`:一键安装指定 Skill 至本地环境(支持 `scope: 'project'` 或 `'user'`,需 `confirm: true`);
|
|
208
|
-
* `list`:查看当前环境已安装的 Skills
|
|
208
|
+
* `list`:查看当前环境已安装的 Skills 清单;
|
|
209
|
+
* `publish`:🆕 **Agent 技能自检与发布闭环**:默认 `--dry-run` 模式进行 agentskills.io 规范体检,支持 `--fix` 自动剔除安装残留元数据,正式发版强制要求指定版本 `tag` 并附带 `confirm: true` 自动创建 GitHub Release;
|
|
210
|
+
* `update`:🆕 **批量检查与同步更新**:默认 `--dry-run` 只读比对本地与远端 SHA 差异,支持 `--all` 批量同步更新已安装技能。
|
|
209
211
|
|
|
210
212
|
---
|
|
211
213
|
|
|
@@ -216,11 +218,11 @@ dsh plugin --profile web add dsh-github-flow
|
|
|
216
218
|
> - *"调用 gh 命令报错 'authentication failed',该怎么排查?"*
|
|
217
219
|
|
|
218
220
|
* **支持操作 (`topic` / `gh_command`)**:
|
|
219
|
-
* `overview`:输出全景工具箱导航与核心职责速查(
|
|
221
|
+
* `overview`:输出全景工具箱导航与核心职责速查(18 大工具矩阵全景);
|
|
220
222
|
* `mapping`:**官方命令映射总表**,精准指示任意 `gh <command>` 对应哪个插件工具,以及未覆盖域对应的 GitHub REST/GraphQL 端点;
|
|
221
223
|
* `search_syntax`:日期区间、状态筛选与高级布尔搜索语法指南;
|
|
222
224
|
* `troubleshooting`:常见错误自愈配方(认证失效、网络超时、SOCKS5 代理配置、权限不足等);
|
|
223
|
-
* 领域速查:`pr` / `issue` / `run` / `repo` / `release` / `secret` / `skill` / `label` / `ruleset` / `cache` / `gist` / `status` 专项高阶用法;
|
|
225
|
+
* 领域速查:`pr` / `issue` / `run` / `repo` / `release` / `secret` / `skill` / `label` / `ruleset` / `cache` / `gist` / `status` / `agent_task` / `discussion` / `project` / `codespace` 专项高阶用法;
|
|
224
226
|
* `gh_command`:直接透传查询官方原生手册(如 `gh_command: 'ruleset'`)。
|
|
225
227
|
|
|
226
228
|
---
|
|
@@ -290,13 +292,78 @@ dsh plugin --profile web add dsh-github-flow
|
|
|
290
292
|
|
|
291
293
|
---
|
|
292
294
|
|
|
293
|
-
### 14. `github_status
|
|
295
|
+
### 14. `github_status`:跨仓库待办与运行时健康度大盘
|
|
294
296
|
> **典型对话指令**:
|
|
295
297
|
> - *"帮我看看今天在 GitHub 上有哪些需要我处理的事情?"*
|
|
296
298
|
> - *"查看当前账号在所有订阅仓库中的最新动态与 @提及"*
|
|
299
|
+
> - *"查看当前工具链的运行健康度与 API 降级率报表"*
|
|
297
300
|
|
|
298
301
|
* **支持操作 (`action`)**:
|
|
299
|
-
* `view
|
|
302
|
+
* `view`:**账号维度跨仓一站式聚合大盘**(默认),汇总展示「指派给我的 Issue」、「指派给我的 PR」、「等待我评审的 PR (Review Requests)」、「提及我的消息 (Mentions)」以及「订阅仓库近期动态 (Repository Activity)」,无需绑定单仓即可一览全局工作台;支持 `-o` 组织过滤与 `-e` 排除噪音仓库;
|
|
303
|
+
* `health`:🆕 **工具链运行时健康度与降级率审计报表**:基于 Cordis `tools/result` 事件切面,实时审计全插件 18 大核心工具的调用总量、成功率、综合健康分(0~100 分)、API 降级率与智能自愈建议。
|
|
304
|
+
|
|
305
|
+
---
|
|
306
|
+
|
|
307
|
+
### 15. `github_agent_task`:云端编码智能体任务会话治理
|
|
308
|
+
> **典型对话指令**:
|
|
309
|
+
> - *"查阅我名下所有的 GitHub Copilot 智能体任务会话列表"*
|
|
310
|
+
> - *"检视任务 'e2fa49d2' 的执行状态,并抓取详细会话日志"*
|
|
311
|
+
> - *"向云端 Agent 发起新任务:'重构网络通信模块以支持自动重试',基于 develop 分支"*
|
|
312
|
+
|
|
313
|
+
* **支持操作 (`action`)**:
|
|
314
|
+
* `list`:列出当前用户关联的智能体任务(支持 `-L/--limit` 与 `-R/--repo`);
|
|
315
|
+
* `view`:查看任务详情与会话执行日志(支持 `--log`,强制校验 `task_id` 防交互挂起);
|
|
316
|
+
* `create`:向云端 Agent 派发新编码/重构任务(支持 `-b/--base` 指定基准分支,`-a/--custom-agent` 指定仓库智能体定义)。
|
|
317
|
+
|
|
318
|
+
---
|
|
319
|
+
|
|
320
|
+
### 16. `github_discussion`:团队技术研讨与开源社区 RFC 闭环
|
|
321
|
+
> **典型对话指令**:
|
|
322
|
+
> - *"查看当前仓库分类为 'Ideas' 的开放讨论列表"*
|
|
323
|
+
> - *"查看讨论 #101 的正文内容与回复楼层"*
|
|
324
|
+
> - *"在 'RFC' 分类下发起新讨论:'关于接入自动化遥测系统的提案'"*
|
|
325
|
+
> - *"向讨论 #101 发表回复评论"*
|
|
326
|
+
|
|
327
|
+
* **支持操作 (`action`)**:
|
|
328
|
+
* `list`:查阅 Discussions 列表(支持 `-c/--category`、`-s/--state`、`--labels` 与 `-S/--search` 过滤);
|
|
329
|
+
* `view`:查看讨论正文与多楼层评论(支持 `--comments`,强制校验 `discussion_number`);
|
|
330
|
+
* `create`:发起新讨论(`category`、`title`、`body` 三项必填,缺少给出友好指引);
|
|
331
|
+
* `edit`:编辑现有讨论的标题或正文;
|
|
332
|
+
* `comment`:向指定讨论追加发表评论回复。
|
|
333
|
+
|
|
334
|
+
---
|
|
335
|
+
|
|
336
|
+
### 17. `github_project`:Projects v2 项目看板与任务规划
|
|
337
|
+
> **典型对话指令**:
|
|
338
|
+
> - *"列出我名下的所有 Projects v2 项目看板"*
|
|
339
|
+
> - *"查看项目 #1 看板中的所有任务条目,筛选 open 状态"*
|
|
340
|
+
> - *"将 Issue 'https://github.com/owner/repo/issues/10' 添加到项目 #1 看板中"*
|
|
341
|
+
> - *"在项目 #1 看板中创建一个草稿条目:'完成单元测试覆盖'"*
|
|
342
|
+
|
|
343
|
+
* **支持操作 (`action`)**:
|
|
344
|
+
* `list`:查看用户或组织的项目列表(默认 `owner: '@me'`,底层自动适配 `--format json` 勘误);
|
|
345
|
+
* `view`:查看项目元数据、可见性、描述与 README;
|
|
346
|
+
* `item-list`:查看看板条目(支持 Projects 过滤查询语法 `--query`,如 `is:open assignee:@me`);
|
|
347
|
+
* `item-add`:关联已有 Issue/PR URL 进看板;
|
|
348
|
+
* `item-create`:在项目中创建草稿条目(Draft Issue);
|
|
349
|
+
* `item-delete`:从看板移除条目(强制 `confirm: true` 拦截);
|
|
350
|
+
* 🔑 **权限自愈**:检测到缺少 `read:project` 权限时自动输出单行自愈授权卡片(`gh auth refresh -s read:project`)。
|
|
351
|
+
|
|
352
|
+
---
|
|
353
|
+
|
|
354
|
+
### 18. `github_codespace`:云端远程开发环境管控 (MVP)
|
|
355
|
+
> **典型对话指令**:
|
|
356
|
+
> - *"查看我当前有哪些运行中的 Codespace 云端开发机?"*
|
|
357
|
+
> - *"检视实例 'fuzzy-spoon-69vj' 的机器规格与空闲停机策略"*
|
|
358
|
+
> - *"把开发机 'fuzzy-spoon-69vj' 关机停止运行,防止扣除核时费用"*
|
|
359
|
+
> - *"销毁已经用完的临时 Codespace 实例"*
|
|
360
|
+
|
|
361
|
+
* **支持操作 (`action`)**:
|
|
362
|
+
* `list`:列出当前用户或组织名下的 Codespace 环境(展示状态、机器规格与上次使用时间);
|
|
363
|
+
* `view`:检视环境详细配置与 DevContainer 路径(强制校验 `codespace` 名称防交互挂起);
|
|
364
|
+
* `stop`:发送停机指令,立即停止计算资源计费;
|
|
365
|
+
* `delete`:安全销毁实例(物理销毁不可逆,强制 `confirm: true` 拦截,底层传 `-f` 保证无交互幂等删除);
|
|
366
|
+
* 🔑 **权限自愈**:检测到缺少 `codespace` 权限时自动输出单行自愈授权卡片(`gh auth refresh -h github.com -s codespace`)。
|
|
300
367
|
|
|
301
368
|
---
|
|
302
369
|
|
|
@@ -429,7 +496,7 @@ dsh plugin --profile web add dsh-github-flow
|
|
|
429
496
|
|
|
430
497
|
在 DSH 任意聊天窗口输入:
|
|
431
498
|
|
|
432
|
-
* `/gh status`:一键诊断当前 GitHub CLI
|
|
499
|
+
* `/gh status`:一键诊断当前 GitHub CLI 账号认证状态、作用域、当前工作区关联仓库、插件版本与**工具链运行时可观测性(健康分与 API 降级率)**;
|
|
433
500
|
* `/gh upgrade`:主动检测 npm 最新版本,自适应输出当前操作系统(macOS / Windows / Linux)的最佳升级指引;
|
|
434
501
|
* `/gh help`:查看帮助说明与 Agent 典型对话范例。
|
|
435
502
|
|
package/docs/UPGRADE-NOTES.md
CHANGED
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
|
|
11
11
|
| # | 文件 | 位置 | 当前值 | 说明 |
|
|
12
12
|
|---|---|---|---|---|
|
|
13
|
-
| 1 | [package.json](../package.json) | 第 3 行 `"version": "0.
|
|
14
|
-
| 2 | [src/version.ts](../src/version.ts) | 第 9 行 `CURRENT_PLUGIN_VERSION = '0.
|
|
13
|
+
| 1 | [package.json](../package.json) | 第 3 行 `"version": "0.5.0"` | `0.5.0` | npm 发布版本、CI 取版来源 |
|
|
14
|
+
| 2 | [src/version.ts](../src/version.ts) | 第 9 行 `CURRENT_PLUGIN_VERSION = '0.5.0'` | `'0.5.0'` | 运行时版本比较基准(假横幅的教训来源) |
|
|
15
15
|
|
|
16
16
|
**两处必须同值**。`pnpm run build` 会硬校验([scripts/build.mjs](../scripts/build.mjs) 的
|
|
17
17
|
`assertVersionConsistency`),不一致直接构建失败——但不要依赖拦截,发版前手动核对。
|
|
@@ -41,31 +41,28 @@
|
|
|
41
41
|
| # | 机制 | 说明 |
|
|
42
42
|
|---|---|---|
|
|
43
43
|
| 9 | CI 取版(.github/workflows/npm-publish.yml:62) | `VERSION=$(node -p "require('./package.json').version")`——从 package.json 读,无硬编码 |
|
|
44
|
-
| 10 | Git tag | `git tag v0.
|
|
44
|
+
| 10 | Git tag | `git tag v0.5.0` 手动打,值必须 = package.json 版本(tag 与 package.json 不一致时:CI 发布的 npm 版本以 package.json 为准,GitHub Release 标题以 tag 为准,出现两者错位) |
|
|
45
45
|
|
|
46
46
|
## 五、发版完整流程(含版本修改)
|
|
47
47
|
|
|
48
48
|
```powershell
|
|
49
49
|
# 1. 改版本(两处同值)
|
|
50
|
-
# package.json → "version": "0.
|
|
51
|
-
# src/version.ts → CURRENT_PLUGIN_VERSION = '0.
|
|
50
|
+
# package.json → "version": "0.5.0"
|
|
51
|
+
# src/version.ts → CURRENT_PLUGIN_VERSION = '0.5.0'
|
|
52
52
|
|
|
53
53
|
# 2. 文档已用占位符(npm-publish-guide 示例、README 安装命令),发版无需改文档版本号
|
|
54
54
|
|
|
55
55
|
# 3. 构建(版本一致性校验在此拦截漏改)+ 全量测试
|
|
56
56
|
pnpm run build
|
|
57
|
-
pnpm test #
|
|
57
|
+
pnpm test # 全量测试全绿
|
|
58
58
|
|
|
59
59
|
# 4. 本机 e2e(必须先重启 DSH 桌面进程——Node 模块缓存,软链重建不注入运行中进程)
|
|
60
|
-
# 重启后验证:GET /api/github/check-update 的 currentVersion = 0.
|
|
60
|
+
# 重启后验证:GET /api/github/check-update 的 currentVersion = 0.5.0
|
|
61
61
|
|
|
62
62
|
# 5. 提交 + 打 tag + 推送(tag 值 = package.json 版本)
|
|
63
63
|
git add -A
|
|
64
|
-
git commit -m "chore(release): v0.
|
|
65
|
-
git tag v0.
|
|
66
|
-
git push origin master --tags
|
|
67
|
-
# CI(npm-publish.yml)自动:构建→发布 npm→创建 GitHub Release
|
|
68
|
-
git tag v0.3.0
|
|
64
|
+
git commit -m "chore(release): v0.5.0"
|
|
65
|
+
git tag v0.5.0
|
|
69
66
|
git push origin master --tags
|
|
70
67
|
# CI(npm-publish.yml)自动:构建→发布 npm→创建 GitHub Release
|
|
71
68
|
|
package/docs/architecture.md
CHANGED
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
│ │ │ │ │
|
|
36
36
|
│ ▼ ▼ ▼ │
|
|
37
37
|
│ ┌──────────────────┐ ┌──────────────────┐ ┌───────────────────────┐ │
|
|
38
|
-
│ │
|
|
38
|
+
│ │ 18 大 Agent 工具 │ │ 人类 Slash 指令 │ │ Host HTTP WebServer │ │
|
|
39
39
|
│ │ (defineTool DSL)│ │ /gh status │ │ (Effect Disposer 清理)│ │
|
|
40
40
|
│ │ - pr (+attach) │ │ /gh upgrade │ │ - /api/github/overview│ │
|
|
41
41
|
│ │ - issue (+attach│ │ /gh help │ │ - /api/github/action │ │
|
|
@@ -44,25 +44,36 @@
|
|
|
44
44
|
│ │ - api (逃生门) │ (workflow_enable/disable │ │ - /branch-switch │ │
|
|
45
45
|
│ │ - release │ 启停·list/view·download) │ - /api/github/git- │ │
|
|
46
46
|
│ │ - secret & var │ │ watch (定向监听) │ │
|
|
47
|
-
│ │ - skill
|
|
47
|
+
│ │ - skill (+pub/up│ (search 三域=issues/prs/ │ - /check-update (并行)│ │
|
|
48
48
|
│ │ - label (CRUD/cl│ commits; read_file/dir) │ - /upgrade (一键自动) │ │
|
|
49
49
|
│ │ - ruleset(check)│ │ - /update-settings │ │
|
|
50
50
|
│ │ - cache (治理) │ │ - /proxy (全局代理) │ │
|
|
51
51
|
│ │ - gist (分享) │ │ - /auth (轻量探针) │ │
|
|
52
|
-
│ │ - status (
|
|
53
|
-
│ │ -
|
|
54
|
-
│
|
|
55
|
-
│
|
|
56
|
-
│
|
|
57
|
-
│
|
|
58
|
-
│
|
|
59
|
-
│
|
|
60
|
-
│
|
|
61
|
-
│ │
|
|
62
|
-
│ │
|
|
63
|
-
│ │
|
|
64
|
-
│ │ -
|
|
65
|
-
│
|
|
52
|
+
│ │ - status (健康) │ └──────────┬────────────┘ │
|
|
53
|
+
│ │ - agent_task │ │ │
|
|
54
|
+
│ │ - discussion │ ▼ │
|
|
55
|
+
│ │ - project (v2) │ ┌───────────────────────────┐ │
|
|
56
|
+
│ │ - codespace(MVP)│ │ git-watcher (独立服务) │ │
|
|
57
|
+
│ │ - help (元指南) │ │ - .git/HEAD & index │ │
|
|
58
|
+
│ └────────┬─────────┘ │ - 800ms 防抖/35s 超时 │ │
|
|
59
|
+
│ │ └───────────────────────────┘ │
|
|
60
|
+
│ ▼ │ │
|
|
61
|
+
│ ┌──────────────────────────────────┐ │ │
|
|
62
|
+
│ │ Markdown 渲染引擎 (renderers/) │ │ │
|
|
63
|
+
│ │ - common.ts: 单元格清洗/通用徽章 │ │ │
|
|
64
|
+
│ │ - 15领域模块: pr/issue/run/repo/ │ │ │
|
|
65
|
+
│ │ release/skill/label/ruleset/ │ │ │
|
|
66
|
+
│ │ cache/gist/status/agent-task/ │ │ │
|
|
67
|
+
│ │ discussion/project/codespace │ │ │
|
|
68
|
+
│ │ - 统一门面出口 markdown.ts 兼容 │ │ │
|
|
69
|
+
│ └──────────────────────────────────┘ │ │
|
|
70
|
+
│ │ │ │
|
|
71
|
+
│ ▼ ▼ │
|
|
72
|
+
│ ┌───────────────────────────────────────────────────────────────────────┐ │
|
|
73
|
+
│ │ 遥测审计系统 (src/telemetry.ts ➔ Cordis tools/result 事件切面) │ │
|
|
74
|
+
│ │ - TelemetryRingBuffer (固定 200 条无锁环形队列,常驻内存 <200KB) │ │
|
|
75
|
+
│ │ - 实时计算 API 降级率 (Degradation Rate) 与工具链健康分 (0-100 分) │ │
|
|
76
|
+
│ └───────────────────────────────────────────────────────────────────────┘ │
|
|
66
77
|
└─────────────────────────────────────────────────────────────┬───────────────┘
|
|
67
78
|
│
|
|
68
79
|
┌─────────────────────────────────────────────────────────────┼───────────────┐
|
|
@@ -110,7 +121,7 @@
|
|
|
110
121
|
- **AI_AGENT 识别信号注入**:每次 gh 子进程启动注入 `AI_AGENT=dsh`(gh detect.go 最高优先级通用信号)——gh ≥2.99 自动切换 text-only spinner、≥2.100 命令误用时打印完整 help(模型可据此自我纠正)、telemetry 归因到 dsh;旧版 gh 忽略该变量零副作用。经 `agentEnvInjection` 配置开关(默认开启)可恢复 gh 原生行为。
|
|
111
122
|
|
|
112
123
|
### 2.3.1 高危操作确认与敏感值安全通道 (Safety Confirmation & Secret stdin Channel)
|
|
113
|
-
- 不可逆写操作(`merge` / `close` / `issue delete`(物理删除)/ `issue transfer`(跨仓库迁移)/ `pr revert`(远端创建反向 PR)/ `release delete` / clobber 覆盖上传 / `secret delete` / `skill install` / `label delete`(物理删除且解绑)/ `cache delete all`(全量清空缓存)/ `gist delete
|
|
124
|
+
- 不可逆写操作(`merge` / `close` / `issue delete`(物理删除)/ `issue transfer`(跨仓库迁移)/ `pr revert`(远端创建反向 PR)/ `release delete` / clobber 覆盖上传 / `secret delete` / `skill install` / `skill publish`(创建 Release)/ `label delete`(物理删除且解绑)/ `cache delete all`(全量清空缓存)/ `gist delete`(代码片段永久删除)/ `codespace delete`(销毁开发机)/ `project item-delete`(移除看板条目))强制要求 `confirm: true` 显式参数,未确认时仅返回影响评估卡片,不产生任何远端或本地副作用;
|
|
114
125
|
- 密钥明文仅经子进程标准输入传递(`spawnWithStdin` 通道:`spawn` + `stdin.end(data)` 半关闭写入),全程不出现在命令行参数、进程列表与工具输出中;渲染层对 secret 输出采用独立实现,从结构上隔离「绝不渲染 value 字段」这条安全红线。
|
|
115
126
|
|
|
116
127
|
### 2.3.2 产物落盘纪律 (Artifact Download Discipline)
|
|
@@ -132,9 +143,9 @@
|
|
|
132
143
|
- [src/executor/platform-guide.ts](../src/executor/platform-guide.ts):跨平台 CLI 安装引导与升级命令文本生成。
|
|
133
144
|
|
|
134
145
|
### 3.2 渲染层领域化细分 (`src/renderers/`)
|
|
135
|
-
- [src/renderers/markdown.ts](../src/renderers/markdown.ts)
|
|
146
|
+
- [src/renderers/markdown.ts](../src/renderers/markdown.ts):门面出口,统一聚合 Re-export 全部领域子模块;
|
|
136
147
|
- [src/renderers/common.ts](../src/renderers/common.ts):表格单元格字符净化、各类状态药丸 Emoji 徽章、API 降级透明注解;
|
|
137
|
-
-
|
|
148
|
+
- 15 大领域独立渲染模块:`pr.ts` / `issue.ts` / `run.ts` / `repo.ts` / `release.ts` / `skill.ts` / `label.ts` / `ruleset.ts` / `cache.ts` / `gist.ts` / `status.ts` / `agent-task.ts` / `discussion.ts` / `project.ts` / `codespace.ts`,彻底实现高内聚低耦合,避免跨工具改动冲突。
|
|
138
149
|
|
|
139
150
|
### 3.3 本地 Git 元数据监听服务 (`src/git-watcher.ts`)
|
|
140
151
|
- 独立底层服务模块,彻底剥离路由控制器内部的物理文件系统监听与定时器杂糅;
|
|
@@ -158,7 +169,7 @@
|
|
|
158
169
|
|
|
159
170
|
## 4. 自动化测试体系 (Test Suite)
|
|
160
171
|
|
|
161
|
-
项目配备了
|
|
172
|
+
项目配备了 **20 个独立阶段的全量自动化回归测试套件(`test/run-all.mjs`)**,覆盖 **880+ 项全量自动化测试断言**:
|
|
162
173
|
- `phase1`:Issue / Run / PR / Repo / Help 命令装配与确认门禁;
|
|
163
174
|
- `phase2`:Native Markdown 渲染与 Token 压缩率实测(>60% 降幅);
|
|
164
175
|
- `phase3`:Release 资产交付、Secret 密文管道与 Skills 检索;
|
|
@@ -171,4 +182,11 @@
|
|
|
171
182
|
- `phase10`:版本守卫降级链(runGuarded)、AI_AGENT 注入与命令白名单;
|
|
172
183
|
- `phase11`:右侧栏五 Tab 响应式互斥、Git 提交记录与滑动分页;
|
|
173
184
|
- `phase12`:工作区物理所有权隔离、SWR 离线快照防抹杀与安全分支切换;
|
|
174
|
-
- `phase13`:云端定时自动同步生命周期、三选一互斥设置模型与右侧栏独占本地 git-watch
|
|
185
|
+
- `phase13`:云端定时自动同步生命周期、三选一互斥设置模型与右侧栏独占本地 git-watch 监听;
|
|
186
|
+
- `phase14`:github_label(标签体系CRUD与克隆)与 github_ruleset(保护策略排障);
|
|
187
|
+
- `phase15`:github_cache(构建缓存治理)与 github_gist(代码片段与排障留痕);
|
|
188
|
+
- `phase16`:github_status(全局待办大盘)与 attach_images(图片附件上传通道);
|
|
189
|
+
- `phase17`:github_skill publish(agentskills.io 规范自检、--fix 修复与发布闭环);
|
|
190
|
+
- `phase18`:github_agent_task(云端编码智能体会话)与 github_discussion(社区讨论与RFC);
|
|
191
|
+
- `phase19`:github_project(Projects v2 看板)、github_codespace(云端开发机)与 skill update;
|
|
192
|
+
- `phase20`:TelemetryRingBuffer、Cordis tools/result 事件总线运行时遥测、降级率统计与健康度看板。
|
|
@@ -243,6 +243,27 @@ export function registerActionRoutes(deps, executor, cacheMap, globalCache) {
|
|
|
243
243
|
sendJson(res, 200, { ok: true, currentBranch: r.currentBranch, message: `已成功切换到分支 ${r.currentBranch}` });
|
|
244
244
|
break;
|
|
245
245
|
}
|
|
246
|
+
case 'file_diff':
|
|
247
|
+
case 'get_file_diff': {
|
|
248
|
+
const fileTarget = typeof payload.file === 'string' ? payload.file.trim() : (typeof payload.filePath === 'string' ? payload.filePath.trim() : '');
|
|
249
|
+
if (!fileTarget) {
|
|
250
|
+
sendJson(res, 400, { ok: false, error: '缺少目标文件路径' });
|
|
251
|
+
return;
|
|
252
|
+
}
|
|
253
|
+
const resolvedCwd = executor.resolveWorkspaceCwd(cwd);
|
|
254
|
+
const r = await executor.getFileDiff(resolvedCwd, fileTarget);
|
|
255
|
+
sendJson(res, 200, { ok: r.ok, data: r, error: r.error });
|
|
256
|
+
break;
|
|
257
|
+
}
|
|
258
|
+
case 'uncommitted_files':
|
|
259
|
+
case 'get_uncommitted_files': {
|
|
260
|
+
const limit = Math.min(Math.max(1, Number(payload.limit) || 15), 100);
|
|
261
|
+
const skip = Math.max(0, Number(payload.skip) || 0);
|
|
262
|
+
const resolvedCwd = executor.resolveWorkspaceCwd(cwd);
|
|
263
|
+
const r = await executor.getUncommittedFiles(resolvedCwd, limit, skip);
|
|
264
|
+
sendJson(res, 200, { ok: true, data: r });
|
|
265
|
+
break;
|
|
266
|
+
}
|
|
246
267
|
default:
|
|
247
268
|
sendJson(res, 400, { ok: false, message: `未知的操作类型: ${payload.action}` });
|
|
248
269
|
}
|
|
@@ -353,4 +374,115 @@ export function registerActionRoutes(deps, executor, cacheMap, globalCache) {
|
|
|
353
374
|
}
|
|
354
375
|
},
|
|
355
376
|
});
|
|
377
|
+
// 6. 纯本地 Git 状态毫秒级轻量查询(专供工作区改动时的局部定向刷新)
|
|
378
|
+
// 严格安全与性能纪律:
|
|
379
|
+
// 1. 动静解耦:仅执行本地 getLocalGitStatus、getGitCommitLog 与 getGitBranches;
|
|
380
|
+
// 2. 100% 零网络调用、零远端 GitHub API 请求、零 Token 额度消耗,耗时仅 5~10ms;
|
|
381
|
+
// 3. 彻底与 PR/Issue/Run 远端数据解耦,切断因修改本地文件误触发远端全量网络风暴与超时报错的恶性循环。
|
|
382
|
+
bindRoute({
|
|
383
|
+
kind: 'exact',
|
|
384
|
+
path: '/api/github/local-git-status',
|
|
385
|
+
handler: async (req, res) => {
|
|
386
|
+
if (req.method !== 'GET') {
|
|
387
|
+
sendJson(res, 405, { ok: false, message: '仅支持 GET 请求' });
|
|
388
|
+
return;
|
|
389
|
+
}
|
|
390
|
+
const url = new URL(req.url || '', 'http://127.0.0.1');
|
|
391
|
+
const cwd = url.searchParams.get('cwd');
|
|
392
|
+
if (!cwd || !hasGitDir(cwd)) {
|
|
393
|
+
sendJson(res, 400, { ok: false, error: '非 Git 仓库,无法获取本地 Git 状态' });
|
|
394
|
+
return;
|
|
395
|
+
}
|
|
396
|
+
try {
|
|
397
|
+
const gitStatus = await executor.getLocalGitStatus(cwd).catch(() => null);
|
|
398
|
+
const commitLog = await executor
|
|
399
|
+
.getGitCommitLog(cwd, gitStatus ? gitStatus.hasUpstream : false)
|
|
400
|
+
.catch(() => null);
|
|
401
|
+
const branches = await executor.getGitBranches(cwd).catch(() => null);
|
|
402
|
+
// 同步就地更新内存缓存中的本地元数据,保证后续全量请求也能自然拿到最新的本地状态
|
|
403
|
+
const cached = cacheMap.getFallback(cwd) || cacheMap.get(cwd, Date.now());
|
|
404
|
+
if (cached) {
|
|
405
|
+
if (gitStatus)
|
|
406
|
+
cached.gitStatus = gitStatus;
|
|
407
|
+
if (commitLog)
|
|
408
|
+
cached.commitLog = commitLog;
|
|
409
|
+
if (branches)
|
|
410
|
+
cached.branches = branches;
|
|
411
|
+
}
|
|
412
|
+
sendJson(res, 200, {
|
|
413
|
+
ok: true,
|
|
414
|
+
data: {
|
|
415
|
+
gitStatus,
|
|
416
|
+
commitLog,
|
|
417
|
+
branches,
|
|
418
|
+
},
|
|
419
|
+
cwd,
|
|
420
|
+
});
|
|
421
|
+
}
|
|
422
|
+
catch (err) {
|
|
423
|
+
sendJson(res, 500, { ok: false, error: err?.message || '获取本地 Git 状态失败' });
|
|
424
|
+
}
|
|
425
|
+
},
|
|
426
|
+
});
|
|
427
|
+
// 7. 单个未提交文件的 Git Diff 差异查询(供右侧栏 FileDiffModal 调用)
|
|
428
|
+
bindRoute({
|
|
429
|
+
kind: 'exact',
|
|
430
|
+
path: '/api/github/file-diff',
|
|
431
|
+
handler: async (req, res) => {
|
|
432
|
+
if (req.method !== 'GET') {
|
|
433
|
+
sendJson(res, 405, { ok: false, message: '仅支持 GET 请求' });
|
|
434
|
+
return;
|
|
435
|
+
}
|
|
436
|
+
try {
|
|
437
|
+
const url = new URL(req.url || '', 'http://127.0.0.1');
|
|
438
|
+
const cwd = url.searchParams.get('cwd') || undefined;
|
|
439
|
+
const file = url.searchParams.get('file');
|
|
440
|
+
if (!file || !file.trim()) {
|
|
441
|
+
sendJson(res, 400, { ok: false, error: '缺少必需的 file 参数' });
|
|
442
|
+
return;
|
|
443
|
+
}
|
|
444
|
+
const resolvedCwd = executor.resolveWorkspaceCwd(cwd);
|
|
445
|
+
if (!hasGitDir(resolvedCwd)) {
|
|
446
|
+
sendJson(res, 400, { ok: false, error: '当前工作区不是 Git 仓库' });
|
|
447
|
+
return;
|
|
448
|
+
}
|
|
449
|
+
const diffResult = await executor.getFileDiff(resolvedCwd, file.trim());
|
|
450
|
+
if (!diffResult.ok) {
|
|
451
|
+
sendJson(res, 400, { ok: false, error: diffResult.error || '获取文件差异失败' });
|
|
452
|
+
return;
|
|
453
|
+
}
|
|
454
|
+
sendJson(res, 200, { ok: true, data: diffResult });
|
|
455
|
+
}
|
|
456
|
+
catch (err) {
|
|
457
|
+
sendJson(res, 500, { ok: false, error: err?.message || '获取文件差异失败' });
|
|
458
|
+
}
|
|
459
|
+
},
|
|
460
|
+
});
|
|
461
|
+
// 8. 本地未提交文件列表轻量流式分页查询(供右侧栏滑动加载调用)
|
|
462
|
+
bindRoute({
|
|
463
|
+
kind: 'exact',
|
|
464
|
+
path: '/api/github/uncommitted-files',
|
|
465
|
+
handler: async (req, res) => {
|
|
466
|
+
if (req.method !== 'GET') {
|
|
467
|
+
sendJson(res, 405, { ok: false, message: '仅支持 GET 请求' });
|
|
468
|
+
return;
|
|
469
|
+
}
|
|
470
|
+
try {
|
|
471
|
+
const url = new URL(req.url || '', 'http://127.0.0.1');
|
|
472
|
+
const cwd = url.searchParams.get('cwd') || undefined;
|
|
473
|
+
const limit = Math.min(Math.max(1, Number(url.searchParams.get('limit')) || 15), 100);
|
|
474
|
+
const skip = Math.max(0, Number(url.searchParams.get('skip')) || 0);
|
|
475
|
+
const resolvedCwd = executor.resolveWorkspaceCwd(cwd);
|
|
476
|
+
if (!hasGitDir(resolvedCwd)) {
|
|
477
|
+
sendJson(res, 400, { ok: false, error: '当前工作区不是 Git 仓库' });
|
|
478
|
+
return;
|
|
479
|
+
}
|
|
480
|
+
const result = await executor.getUncommittedFiles(resolvedCwd, limit, skip);
|
|
481
|
+
sendJson(res, 200, { ok: true, data: result });
|
|
482
|
+
}
|
|
483
|
+
catch (err) {
|
|
484
|
+
sendJson(res, 500, { ok: false, error: err?.message || '获取未提交文件列表失败' });
|
|
485
|
+
}
|
|
486
|
+
},
|
|
487
|
+
});
|
|
356
488
|
}
|
package/lib/client.d.ts
CHANGED
|
@@ -8,10 +8,10 @@ declare global {
|
|
|
8
8
|
};
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
|
-
import { formatRelativeTime, rollupCiStatus, reviewDecisionBadge, eventLabel } from './ui/utils.js';
|
|
11
|
+
import { formatRelativeTime, rollupCiStatus, reviewDecisionBadge, eventLabel, parseGitStatText } from './ui/utils.js';
|
|
12
12
|
import { GITHUB_PANEL_CSS, injectStyles } from './ui/styles.js';
|
|
13
13
|
import { renderOctocat, renderGitIcon, renderOctocatBadge, renderPluginBadge } from './ui/icons.js';
|
|
14
|
-
import { getLocalSyncSettings, saveLocalSyncSettings, getStoredGlobalOverview, saveStoredGlobalOverview, clearStoredGlobalOverview, getCacheStorageMeta, getRightbarStorageKey, getStoredRightbarSnapshot, saveStoredRightbarData } from './ui/storage.js';
|
|
14
|
+
import { getLocalSyncSettings, saveLocalSyncSettings, getStoredGlobalOverview, saveStoredGlobalOverview, clearStoredGlobalOverview, getCacheStorageMeta, getRightbarStorageKey, getStoredRightbarSnapshot, saveStoredRightbarData, getStoredHeaderCardsVisible, saveStoredHeaderCardsVisible, HEADER_CARDS_STORAGE_KEY } from './ui/storage.js';
|
|
15
15
|
import { BranchSelectorDropdown } from './ui/branch-selector.js';
|
|
16
16
|
import { AuthGuideCard } from './ui/auth-guide-card.js';
|
|
17
17
|
import { UpgradeNotificationCard } from './ui/upgrade-card.js';
|
|
@@ -19,5 +19,6 @@ import { NetworkAlertBanner } from './ui/network-banner.js';
|
|
|
19
19
|
import { SyncStatusBadge } from './ui/sync-status-badge.js';
|
|
20
20
|
import { CommitDetailModal } from './ui/commit-modal.js';
|
|
21
21
|
import { GlobalSyncSettingsModal } from './ui/sync-settings-modal.js';
|
|
22
|
+
import { GithubHelpModal } from './ui/help-modal.js';
|
|
22
23
|
import { GithubWorkspacePanel } from './ui/workspace-panel.js';
|
|
23
|
-
export { formatRelativeTime, rollupCiStatus, reviewDecisionBadge, eventLabel, GITHUB_PANEL_CSS, injectStyles, renderOctocat, renderGitIcon, renderOctocatBadge, renderPluginBadge, getLocalSyncSettings, saveLocalSyncSettings, getStoredGlobalOverview, saveStoredGlobalOverview, clearStoredGlobalOverview, getCacheStorageMeta, getRightbarStorageKey, getStoredRightbarSnapshot, saveStoredRightbarData, BranchSelectorDropdown, AuthGuideCard, UpgradeNotificationCard, NetworkAlertBanner, SyncStatusBadge, CommitDetailModal, GlobalSyncSettingsModal, GithubWorkspacePanel, };
|
|
24
|
+
export { formatRelativeTime, rollupCiStatus, reviewDecisionBadge, eventLabel, parseGitStatText, GITHUB_PANEL_CSS, injectStyles, renderOctocat, renderGitIcon, renderOctocatBadge, renderPluginBadge, getLocalSyncSettings, saveLocalSyncSettings, getStoredGlobalOverview, saveStoredGlobalOverview, clearStoredGlobalOverview, getCacheStorageMeta, getRightbarStorageKey, getStoredRightbarSnapshot, saveStoredRightbarData, getStoredHeaderCardsVisible, saveStoredHeaderCardsVisible, HEADER_CARDS_STORAGE_KEY, BranchSelectorDropdown, AuthGuideCard, UpgradeNotificationCard, NetworkAlertBanner, SyncStatusBadge, CommitDetailModal, GlobalSyncSettingsModal, GithubHelpModal, GithubWorkspacePanel, };
|