dsh-jira-work-overview 0.16.1 → 0.16.2

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/CHANGELOG.md CHANGED
@@ -6,6 +6,19 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.16.2] - 2026-11-23
10
+
11
+ ### Fixed
12
+
13
+ - **左栏工作区的右键菜单里「关联 Jira 项目…」会整页消失(绑定选项没了)。** 浏览器侧的插件入口是
14
+ **并发创建**的(`dsh-client-modules` 用 `Promise.all` 同时 `create` 每个插件),本插件只 inject
15
+ `slots` / `remote`,而 `contextMenus` 服务自己还要等 `locale`、`shortcuts` —— 所以 `apply()` 时它
16
+ 经常还没 `provide`。旧代码在这里只 `ctx.get('contextMenus')` 拿一次,拿不到就跳过注册,这一页就
17
+ 再也没有「关联 / 取消关联 Jira 项目」——面板、角标都正常,只有右键菜单少东西。现在改用
18
+ `ctx.inject(['contextMenus'], child => …)` 等服务出现再注册(官方 `dsh-client-ui-file-actions`
19
+ 同款写法);老基座没有 `ctx.inject` 时退回直接注册。新增离线套件
20
+ `test/dsh-jira-workspace-menu.mjs` 专门模拟「服务晚到」。
21
+
9
22
  ## [0.16.1] - 2026-11-22
10
23
 
11
24
  ### Fixed
package/README.md CHANGED
@@ -277,6 +277,7 @@ The current version is **0.16.0** (2026-11-20). The changelog records 30 version
277
277
  | 0.14.0 | 2026-11-19 | feature | highlight follows **Jira's own priority order**; **first npm release** |
278
278
  | 0.15.0 | 2026-11-19 | feature | transitions update **in place**, your own changes no longer notify you, typed failure hints |
279
279
  | 0.15.1 | 2026-11-19 | **fix** | the four `/api` routes were never registered in a real host (404) |
280
+ | 0.16.2 | 2026-11-23 | **fix** | the workspace context menu's **Link Jira project…** could vanish for a whole page (client startup race); covered by a new offline suite |
280
281
  | 0.16.1 | 2026-11-22 | fix | Windows notifications and *Show in file manager*, the Linux editor picker, UNC patch paths; three-OS CI and the release preflight; a planning walkthrough in both READMEs |
281
282
  | 0.16.0 | 2026-11-20 | feature | **site-wide search**, **group by epic**, the **计划** (plan) button on every row |
282
283
 
@@ -299,6 +300,7 @@ Every user-visible defect, newest first (implementation detail is in the matchin
299
300
 
300
301
  | Version | Symptom | Cause / fix |
301
302
  | --- | --- | --- |
303
+ | 0.16.2 | The workspace right-click menu lost **Link Jira project…** (so there was no way to bind a project), while the panel itself kept working | Browser-side plugins are created concurrently, and this one only waits for `slots` / `remote`; `contextMenus` waits for `locale` / `shortcuts` too, so a single `ctx.get('contextMenus')` in `apply()` could see it missing and skip the registration for the whole page. It now registers through `ctx.inject(['contextMenus'], …)` once the service appears; an older host without `ctx.inject` falls back to the direct path |
302
304
  | 0.16.1 | On Windows, new assignments and status changes produced **no notification at all** | A Windows toast must be posted under a **registered** AUMID; an unregistered one makes `CreateToastNotifier()` throw `Element not found (0x80070490)`, which was swallowed. It now tries `DSH_NOTIFY_AUMID` → `DeepSeek Harness` → `com.deepseek.harness` → the built-in PowerShell AUMID in order; the script statements are joined with newlines (`{; try … }` is a PowerShell syntax error, so nothing ran) |
303
305
  | 0.16.1 | On Windows, *Show in file manager* opened Explorer but still reported a failure | `explorer.exe /select,` exits with code 1 even on success. That branch now tolerates a non-zero exit; only a process that never starts counts as a failure |
304
306
  | 0.16.1 | With the profile on a network share, the config file was treated as an unknown path | Absolute-path detection only accepted `/…` and `C:\…`. It now also accepts UNC paths (`\\server\share\…`) |
package/README.zh.md CHANGED
@@ -530,6 +530,7 @@ Zed(`zed`)、Sublime Text(`subl`)、gedit(`gedit`)——**找到可
530
530
  | 0.14.0 | 2026-11-19 | 功能 | 高亮挂到 **Jira 自己的优先级名次**;**首次发布到 npm** |
531
531
  | 0.15.0 | 2026-11-19 | 功能 | 改状态**不再全量重拉**、自己改的状态不再通知自己、失败提示按类型 |
532
532
  | 0.15.1 | 2026-11-19 | **修复** | 四条 `/api` 路由在真宿主里没注册(404) |
533
+ | 0.16.2 | 2026-11-23 | **修复** | 左栏工作区右键菜单的「关联 Jira 项目…」会整页消失(客户端启动竞态);新增离线套件守住 |
533
534
  | 0.16.1 | 2026-11-22 | 修复 | Windows 通知与「在文件管理器中显示」、Linux 编辑器直选、UNC 路径;三平台 CI 与发版预检;README 补计划会话图解 |
534
535
  | 0.16.0 | 2026-11-20 | 功能 | **整站搜索**、**按 epic 分组**、任务行**「计划」**(plan 模式会话) |
535
536
 
@@ -553,6 +554,7 @@ plugin_manager install_bundle(target="dsh-jira-work-overview") # 已装过则
553
554
 
554
555
  | 版本 | 现象 | 原因 / 处理 |
555
556
  | --- | --- | --- |
557
+ | 0.16.2 | 左栏工作区的右键菜单里「关联 Jira 项目…」整页消失,没法给工作区绑项目;面板本身正常 | 浏览器侧插件是**并发创建**的,本插件只等 `slots` / `remote`,而 `contextMenus` 还要等 `locale` / `shortcuts`:`apply()` 里只 `ctx.get('contextMenus')` 拿一次,没拿到就跳过注册,这一页就再也没有这条菜单。现在改用 `ctx.inject(['contextMenus'], …)` 等服务出现再注册;老基座没有 `ctx.inject` 时退回直接注册 |
556
558
  | 0.16.1 | Windows 上新任务 / 状态变化**一条通知都没有**(macOS 正常) | Windows 的 Toast 必须挂在一个**已注册的** AUMID 上,未注册时 `CreateToastNotifier()` 抛 `Element not found (0x80070490)`,而它被静默吞掉了。现在按 `DSH_NOTIFY_AUMID` → `DeepSeek Harness` → `com.deepseek.harness` → 系统自带的 PowerShell AUMID 依次试;脚本里的语句改用换行拼接(`{; try … }` 是 PowerShell 语法错误,整段都不执行) |
557
559
  | 0.16.1 | Windows 上「在文件管理器中显示」明明已打开,却报 `打开失败` | `explorer.exe /select,` 成功时也返回退出码 1,被当成了失败。现在这个分支允许非零退出码,只有进程根本起不来才算失败 |
558
560
  | 0.16.1 | profile 放在网络共享盘上时,配置文件被当成「路径未知」,打开 / 显示全都用不了 | 绝对路径判定只认 `/…` 与 `C:\…`。现在也认 UNC(`\\server\share\…`) |
package/client.js CHANGED
@@ -3740,15 +3740,21 @@ window.__ModuleLoader__.load({
3740
3740
  }, CredentialSettings));
3741
3741
 
3742
3742
  // 左栏「工作区」行的右键菜单:关联 / 取消关联 Jira 项目。
3743
- // 结构化菜单是抽象贡献(不是 React 组件),只能在 ctx.contextMenus 上注册(dsh-client-ui-context-menu)。
3744
- const contextMenus = typeof ctx.get === 'function' ? ctx.get('contextMenus') : undefined;
3745
- if (contextMenus && typeof contextMenus.register === 'function') {
3743
+ // 结构化菜单是抽象贡献(不是 React 组件),只能注册在 dsh-client-ui-context-menu 的
3744
+ // `contextMenus` 服务上。**这个服务不保证在本插件 apply 时已经就绪**:浏览器侧的插件入口
3745
+ // 是并发创建的,本插件只 inject 了 slots / remote,而 contextMenus 自己还要等 locale、
3746
+ // shortcuts(0.16.1 及以前这里直接 ctx.get 一次,拿到 undefined 就整页都没有这条菜单 ——
3747
+ // 「关联 Jira 项目…」随机消失就是这么来的)。现在用 ctx.inject 等它出现再注册;
3748
+ // 老基座没有 ctx.inject 时退回直接注册。
3749
+ function registerWorkspaceProjectMenu(host) {
3750
+ const contextMenus = typeof host.get === 'function' ? host.get('contextMenus') : undefined;
3751
+ if (!contextMenus || typeof contextMenus.register !== 'function') return;
3746
3752
  try {
3747
- ctx.effect?.(() => contextMenus.register({
3753
+ host.effect?.(() => contextMenus.register({
3748
3754
  id: `${PLUGIN_ID}.workspace-project`,
3749
3755
  target: 'workspace',
3750
3756
  order: 500,
3751
- observe: () => [runtime.ctx && ctx.get('workspaces') ? ctx.get('workspaces').list : undefined].filter(Boolean),
3757
+ observe: () => [host.get('workspaces')?.list].filter(Boolean),
3752
3758
  resolve: (target) => {
3753
3759
  const entries = [projectMenuEntry(target)];
3754
3760
  const unlink = projectUnlinkEntry(target);
@@ -3760,6 +3766,21 @@ window.__ModuleLoader__.load({
3760
3766
  console.warn(`${NS}: workspace menu unavailable`, error);
3761
3767
  }
3762
3768
  }
3769
+ if (typeof ctx.inject === 'function') {
3770
+ ctx.inject(['contextMenus'], (child) => {
3771
+ try {
3772
+ registerWorkspaceProjectMenu(child);
3773
+ } catch (error) {
3774
+ console.warn(`${NS}: workspace menu unavailable`, error);
3775
+ }
3776
+ });
3777
+ } else {
3778
+ try {
3779
+ registerWorkspaceProjectMenu(ctx);
3780
+ } catch (error) {
3781
+ console.warn(`${NS}: workspace menu unavailable`, error);
3782
+ }
3783
+ }
3763
3784
 
3764
3785
  // 侧栏会话行:角标(工作区关联的项目)与 hover 卡片一行。两个都是可选的洞,缺了不影响面板。
3765
3786
  ctx.slots.inject('sidebar.session.row.trailing', () => ctx.slots.register({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-jira-work-overview",
3
- "version": "0.16.1",
3
+ "version": "0.16.2",
4
4
  "description": "Show your Jira work items and their workflow status inside DeepSeek Harness (DSH) · 在 DSH 里查看我的 Jira 工作项与完成状态",
5
5
  "license": "MIT",
6
6
  "author": "Zhaohong Fei",
package/test/README.md CHANGED
@@ -50,6 +50,7 @@ skip without `JIRA_*` credentials (no secrets are configured on purpose — this
50
50
  | `dsh-jira-visual.mjs` | no | rendering: grouping, collapse, project tabs, status filter, header total, priority highlight, **virtualization** (windowed DOM vs. placeholder height), **in-place status change** (no `/jira` re-fetch, local row + counts), fallback when `@tanstack/react-virtual` is missing |
51
51
  | `dsh-jira-selfwatch.mjs` | no | the watch loop's diff: someone else's status change notifies, a change **you** made (panel POST or `jira_transition`) is swallowed and its baseline advanced, a colleague changing it right afterwards still notifies, a failed write leaves no stale expectation |
52
52
  | `dsh-jira-plan.mjs` | no | the per-row **「计划」 button** end to end: a planning session is created in the project's linked workspace, `/plan` runs before the first message, that message carries the `JIRA_PLAN_SESSION:<KEY>` token plus the "only report the changes to make" / "stop if the issue is unclear" rules, a second click reuses the same session (local binding, then a token search through the session log), gaps are listed for a thin issue, and a missing workspace / plan-mode policy fails loudly |
53
+ | `dsh-jira-workspace-menu.mjs` | no | the workspace context menu **when `contextMenus` arrives late**: the plugin waits for the service via `ctx.inject` (a single `ctx.get` at apply used to lose the 「关联 Jira 项目…」 entry for the whole page), then registers a `workspace` contribution whose entry opens the panel and reads the link mapping; also covers the older host without `ctx.inject` |
53
54
  | `dsh-jira-credential.mjs` | no | configure dialog + all six fetch routes: token/email save, verification and rejection, masked value, two-step clear, watch/language/fetch-size writes, paging (`--limit=0`, safety cap) |
54
55
  | `dsh-jira-i18n.mjs` | no | language matrix (`DSH_JIRA_LANG`, `--lang`, `?lang`, config, host preference), Jira data kept verbatim, dictionary parity (zh/en key sets), host paging assertions, the "open `cordis.patch.yml`" route |
55
56
  | `dsh-jira-platform.mjs` | no | **platform dispatch, verified without a VM**: forces `process.platform` and puts fake `cmd.exe` / `explorer.exe` / `rundll32.exe` / `powershell.exe` / `where` / `xdg-open` / `notify-send` shims on `PATH` that only log their `argv`, so every platform branch really spawns something and the test asserts the exact command + arguments (open / reveal / choose / custom app / editor picker / Unix `PATH` split / `X_OK` check / UNC patch path / `explorer.exe` exit code 1 / toast script and its AUMID fallback list) |
@@ -0,0 +1,170 @@
1
+ /**
2
+ * 离线回归:左侧栏「工作区」右键菜单里的「关联 Jira 项目…」。
3
+ *
4
+ * 浏览器侧的插件入口是**并发创建**的:本插件的 apply 只等 slots / remote,而 `contextMenus`
5
+ * 服务还要等 locale、shortcuts,所以 apply 时它常常还没就绪。0.16.1 及以前这里直接
6
+ * `ctx.get('contextMenus')` 拿一次,拿不到就整页都没有这条菜单 —— 表现就是「绑定选项消失了」。
7
+ * 现在改成 `ctx.inject(['contextMenus'], …)` 等它出现再注册;这个套件把「晚到」这件事真的模拟出来:
8
+ * 1. apply 时没有 contextMenus → 一个贡献都不注册,但已经在等这个服务;
9
+ * 2. 服务出现后 → 注册 target 'workspace' 的贡献;
10
+ * 3. 该贡献 resolve 出一个「关联 Jira 项目…」条目,点它会打开面板并去读/写映射;
11
+ * 4. 老基座没有 ctx.inject 时退回直接注册(服务当时在就注册)。
12
+ */
13
+ import { dirname } from 'node:path';
14
+ import { fileURLToPath, pathToFileURL } from 'node:url';
15
+
16
+ const WS = dirname(dirname(fileURLToPath(import.meta.url)));
17
+
18
+ let failed = 0;
19
+ const check = (ok, label, detail) => {
20
+ console.log(`${ok ? 'PASS' : 'FAIL'} ${label}${detail === undefined ? '' : ` | ${detail}`}`);
21
+ if (!ok) failed += 1;
22
+ };
23
+
24
+ /* ------------------------------------------------------- 浏览器最小环境 */
25
+
26
+ const loaded = [];
27
+ const styleTags = [];
28
+ const fakeDocument = {
29
+ querySelector: () => null,
30
+ createElement: () => ({ dataset: {}, style: {}, textContent: '', remove() {} }),
31
+ head: { appendChild: (tag) => styleTags.push(tag) },
32
+ };
33
+ Object.defineProperty(globalThis, 'document', { value: fakeDocument, configurable: true });
34
+ Object.defineProperty(globalThis, 'navigator', { value: { language: 'zh-CN', languages: ['zh-CN'] }, configurable: true });
35
+
36
+ const fetchCalls = [];
37
+ const fakeWindow = {
38
+ __ModuleLoader__: { load: (spec) => { loaded.push(spec); } },
39
+ __DSH_TRANSPORT__: {
40
+ fetch: async (url, init) => {
41
+ const path = String(url).split('?')[0];
42
+ fetchCalls.push({ path, method: String(init?.method ?? 'GET').toUpperCase() });
43
+ const json = (payload) => ({ ok: true, status: 200, async json() { return payload; } });
44
+ if (path === '/api/jira-work-overview/project-workspace') {
45
+ return json({ ok: true, mapping: {}, workspaces: {}, items: [] });
46
+ }
47
+ await new Promise((resolve) => setTimeout(resolve, 200));
48
+ return json({ ok: true, watch: { enabled: false, counts: { new: 0, status: 0, closed: 0, total: 0 }, changes: [] } });
49
+ },
50
+ },
51
+ };
52
+ Object.defineProperty(globalThis, 'window', { value: fakeWindow, configurable: true });
53
+
54
+ const React = {
55
+ createElement: (type, props, ...children) => ({ type, props, children }),
56
+ useState: (value) => [typeof value === 'function' ? value() : value, () => {}],
57
+ useEffect: () => {}, useRef: (value) => ({ current: value }), useMemo: (fn) => fn(),
58
+ useCallback: (fn) => fn, useLayoutEffect: () => {},
59
+ };
60
+ const modules = {
61
+ react: React,
62
+ 'react-dom': { createPortal: (node) => node },
63
+ '@tanstack/react-virtual': {
64
+ useVirtualizer: () => ({ getTotalSize: () => 0, getVirtualItems: () => [], measureElement() {}, scrollToIndex() {} }),
65
+ },
66
+ };
67
+
68
+ /** 一个够 apply 跑完的上下文;`inject` 只记下回调,等测试手动放行。 */
69
+ function makeCtx(options = {}) {
70
+ const injected = [];
71
+ const ctx = {
72
+ injected,
73
+ get(name) {
74
+ if (name === 'sessions') {
75
+ return { list: { getSnapshot: () => ({ byId: { 'sess-1': { id: 'sess-1', retainedBy: { mainView: 1 } } } }) } };
76
+ }
77
+ if (name === 'workspaces') {
78
+ return { list: { getSnapshot: () => ({ items: [{ workspaceId: 'ws-1', sessionIds: ['sess-1'] }] }) } };
79
+ }
80
+ if (name === 'remote.commands') {
81
+ return {
82
+ async execute() {
83
+ return {
84
+ ok: true,
85
+ value: {
86
+ result: {
87
+ kind: 'success',
88
+ text: JSON.stringify({
89
+ ok: true, project: 'APP', counts: { new: 0, indeterminate: 0, done: 0, total: 0 },
90
+ total: 0, projectTotals: {}, statusOptions: [], items: [], sprints: [],
91
+ }),
92
+ },
93
+ },
94
+ };
95
+ },
96
+ };
97
+ }
98
+ return undefined;
99
+ },
100
+ on() { return () => {}; },
101
+ effect(fn) { const off = fn(); return () => { if (typeof off === 'function') off(); }; },
102
+ slots: { inject(name, factory) { factory(); }, register() { return () => {}; } },
103
+ };
104
+ if (options.inject !== false) {
105
+ ctx.inject = (deps, callback) => { injected.push({ deps: [...deps], callback }); };
106
+ }
107
+ if (options.contextMenus) ctx.get = ((base) => (name) => (name === 'contextMenus' ? options.contextMenus : base(name)))(ctx.get);
108
+ return ctx;
109
+ }
110
+
111
+ const menuService = () => {
112
+ const contributions = [];
113
+ return {
114
+ contributions,
115
+ register(contribution) { contributions.push(contribution); return () => {}; },
116
+ };
117
+ };
118
+
119
+ /** 一个只要求 get / effect 的子上下文(ctx.inject 回调拿到的就是这种上下文)。 */
120
+ const childOf = (ctx, service) => ({
121
+ get: (name) => (name === 'contextMenus' ? service : ctx.get(name)),
122
+ effect: ctx.effect,
123
+ slots: ctx.slots,
124
+ });
125
+
126
+ await import(pathToFileURL(`${WS}/client.js`).href);
127
+ const spec = loaded[0];
128
+ check(Boolean(spec && spec.factory), 'client 半边的 bundle 能加载');
129
+
130
+ /* --------------------------------------------- 1) 服务晚到:等它出现再注册 */
131
+
132
+ const late = makeCtx();
133
+ spec.factory((name) => modules[name]).apply(late);
134
+ check(late.injected.length === 1 && late.injected[0].deps.includes('contextMenus'),
135
+ 'apply 时先等 contextMenus 服务(不直接 ctx.get 一次就放弃)',
136
+ late.injected.map((row) => row.deps.join(',')).join(' | '));
137
+
138
+ const service = menuService();
139
+ check(service.contributions.length === 0, '服务还没出现时一个菜单贡献都不注册');
140
+ late.injected[0].callback(childOf(late, service));
141
+ check(service.contributions.length === 1, '服务晚到后补注册了菜单贡献', String(service.contributions.length));
142
+
143
+ const contribution = service.contributions[0];
144
+ check(contribution.target === 'workspace' && contribution.id.endsWith('.workspace-project'),
145
+ '注册的是「工作区」这一族的菜单贡献', `${contribution.target} / ${contribution.id}`);
146
+ check(Array.isArray(contribution.observe({ workspaceId: 'ws-1' })) && contribution.observe({ workspaceId: 'ws-1' }).length === 1,
147
+ 'observe 把工作区列表作为响应式输入');
148
+
149
+ /* --------------------------------------------- 2) resolve / 点击后的行为 */
150
+
151
+ const before = fetchCalls.length;
152
+ const actions = contribution.resolve({ workspaceId: 'ws-1', path: '/tmp/ws', displayTitle: 'ws' });
153
+ check(Array.isArray(actions) && actions.length >= 1, 'resolve 至少返回一条菜单项', String(actions?.length));
154
+ check(actions?.some((action) => action.label === '关联 Jira 项目…'),
155
+ '菜单里有「关联 Jira 项目…」', actions?.map((action) => action.label).join(' | '));
156
+
157
+ await actions[0].run();
158
+ await new Promise((resolve) => setTimeout(resolve, 60));
159
+ check(fetchCalls.slice(before).some((call) => call.path === '/api/jira-work-overview/project-workspace' && call.method === 'GET'),
160
+ '点「关联 Jira 项目…」会去读一次映射并打开面板');
161
+
162
+ /* --------------------------------------------- 3) 老基座:没有 ctx.inject 时直接注册 */
163
+
164
+ const early = makeCtx({ inject: false, contextMenus: menuService() });
165
+ spec.factory((name) => modules[name]).apply(early);
166
+ check(early.get('contextMenus')?.contributions?.length === 1,
167
+ '没有 ctx.inject 的老基座:服务当时就在时直接注册');
168
+
169
+ console.log(failed === 0 ? '\n全部通过' : `\n失败 ${failed} 项`);
170
+ process.exit(failed === 0 ? 0 : 1);
@@ -13,7 +13,7 @@ const RELEASE = process.argv.includes('--release');
13
13
 
14
14
  // 真站点套件(status / transition / sprint / smoke*)在没凭据时会自己 SKIP 并 exit 0。
15
15
  const SUITES = [
16
- 'bundle-id', 'release', 'platform', 'visual', 'credential', 'plan', 'i18n',
16
+ 'bundle-id', 'release', 'platform', 'visual', 'credential', 'plan', 'workspace-menu', 'i18n',
17
17
  'search', 'epic', 'selfwatch', 'json', 'smoke', 'smoke3', 'due', 'sprint', 'status', 'transition',
18
18
  ];
19
19