dsh-jira-work-overview 0.16.2 → 0.16.3

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
@@ -4,7 +4,20 @@ All notable changes to **dsh-jira-work-overview** are documented here.
4
4
 
5
5
  The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and the project uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html). The first 25 releases were built in a single day, so the dates are real but the cadence was not: each entry lists what changed, not how long it took.
6
6
 
7
- ## [Unreleased]
7
+ ## [0.16.3] - 2026-11-23
8
+
9
+ ### Added
10
+
11
+ - **配置页「Jira 连接」里的服务地址现在是可编辑输入框。** 输入框默认留空、placeholder 显示当前生效的
12
+ 地址;填好点「保存地址」(或回车)就写进当前 profile 的 Cordis patch(`baseUrl` 改成 volatile 字段),
13
+ 保存后立刻生效,不用重装插件。只接受完整的 `http(s)` 地址(自动去掉尾部斜杠),空值 / 其它协议直接
14
+ 拒绝并在页面上报错;「其余配置写在 cordis.patch.yml 里,这个页面只改令牌」的说明也同步改掉了。
15
+
16
+ ### Fixed
17
+
18
+ - **没配令牌时失败提示里的「去配置」按钮看不清。** 它原来用 `.jmw-btn.primary` 的
19
+ `--dsw-alias-brand-primary` 当底色,浅色 / 深色主题下会变成白底白字;现在改成和配置页「保存并验证」
20
+ 完全一致的 `.jmw-cred-btn primary` + 内联深底白字(`#4d6bfe`),并删掉了已无用的 `.jmw-btn.primary` 规则。
8
21
 
9
22
  ## [0.16.2] - 2026-11-23
10
23
 
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.3 | 2026-11-23 | **fix** | the Jira site URL is now an editable field in the config page (placeholder = current URL, saved to the profile Cordis patch); the failure hint's **Configure** button matches **Save and verify** |
280
281
  | 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 |
281
282
  | 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 |
282
283
  | 0.16.0 | 2026-11-20 | feature | **site-wide search**, **group by epic**, the **计划** (plan) button on every row |
package/README.zh.md CHANGED
@@ -308,7 +308,8 @@ Jira Cloud **没有**给第三方 issue 事件的 websocket / SSE 长连接(
308
308
  - **后台监视**:开关 + 检查间隔(按秒填,最小 15)+ 通知开关,下面有小字说明。
309
309
  **这三个是「改了就生效」**:拨开关立刻写、间隔输入后失焦 / 回车立刻写(输入过程中 700ms 防抖),
310
310
  **没有保存按钮**——只有令牌那种敏感值才需要点按钮确认落库(详见「配置」一节)。
311
- - 页面按功能分成四组,每组是「标题 + 内容」:**认证令牌**(邮箱 + 令牌都能改)/ **Jira 连接**(服务地址,只读)/
311
+ - 页面按功能分成四组,每组是「标题 + 内容」:**认证令牌**(邮箱 + 令牌都能改)/ **Jira 连接**(服务地址可改:
312
+ 输入框留空 = 不修改,placeholder 显示当前生效地址,点「保存地址」立刻写进 profile 并生效)/
312
313
  **查询**(每次拉取条数可改 + 请求超时只读)/ **后台监视**(开关 + 间隔 + 通知,改了就生效)。
313
314
  (项目名与看板 id 不再出现在配置页——面板上方的项目 tab 已经能自由切换项目了。)
314
315
  - 页面底部说明「令牌只写进 DSH 凭据库 + 界面只显示打码首尾」,并给一条去 Atlassian 新建/吊销令牌的链接。
@@ -489,8 +490,8 @@ Zed(`zed`)、Sublime Text(`subl`)、gedit(`gedit`)——**找到可
489
490
  **其余字段**:上面这张表是 profile 的 `cordis.patch.yml` 里那一行 `config:` 的字段(`apiToken` 除外,
490
491
  它只为兼容旧版明文配置保留)。宿主**不会**自动给第三方插件渲染设置表单——Host 设置文档
491
492
  (`ConfigForm` / `settingsSchema`)里也没有 secret 字段类型,所以插件自己贡献了那一行的配置页
492
- (见上面「换令牌」一节):配置页负责**换令牌**与上面三项监视设置,`maxResults`(**0 = 不限制**,正数 10–5000)
493
- 也在这里改,`baseUrl` / `email` / 超时在「Jira 连接 / 查询」两组里只读列出;要改只读项,
493
+ (见上面「换令牌」一节):配置页负责**换令牌**、**站点地址**、**邮箱**与上面三项监视设置,`maxResults`
494
+ (**0 = 不限制**,正数 10–5000)也在这里改;只有超时在「查询」组里只读列出。要改只读项,
494
495
  直接改 `cordis.patch.yml` 那一行(或让 agent 改)后重新加载插件。
495
496
 
496
497
  ## 版本与升级
@@ -530,6 +531,7 @@ Zed(`zed`)、Sublime Text(`subl`)、gedit(`gedit`)——**找到可
530
531
  | 0.14.0 | 2026-11-19 | 功能 | 高亮挂到 **Jira 自己的优先级名次**;**首次发布到 npm** |
531
532
  | 0.15.0 | 2026-11-19 | 功能 | 改状态**不再全量重拉**、自己改的状态不再通知自己、失败提示按类型 |
532
533
  | 0.15.1 | 2026-11-19 | **修复** | 四条 `/api` 路由在真宿主里没注册(404) |
534
+ | 0.16.3 | 2026-11-23 | **修复** | 配置页「Jira 连接」的服务地址改成可编辑输入框(placeholder = 当前地址,写进 profile 的 Cordis patch);失败提示里的「去配置」按钮和「保存并验证」同款样式 |
533
535
  | 0.16.2 | 2026-11-23 | **修复** | 左栏工作区右键菜单的「关联 Jira 项目…」会整页消失(客户端启动竞态);新增离线套件守住 |
534
536
  | 0.16.1 | 2026-11-22 | 修复 | Windows 通知与「在文件管理器中显示」、Linux 编辑器直选、UNC 路径;三平台 CI 与发版预检;README 补计划会话图解 |
535
537
  | 0.16.0 | 2026-11-20 | 功能 | **整站搜索**、**按 epic 分组**、任务行**「计划」**(plan 模式会话) |
package/client.js CHANGED
@@ -214,6 +214,12 @@ window.__ModuleLoader__.load({
214
214
  credGroupQuery: '查询',
215
215
  credGroupWatch: '后台监视',
216
216
  fBaseUrl: '服务地址',
217
+ baseUrlSave: '保存地址',
218
+ baseUrlSaving: '保存中…',
219
+ baseUrlSaved: 'Jira 站点地址已更新为 {baseUrl},立刻生效。',
220
+ baseUrlSaveFailed: '保存站点地址失败:{message}',
221
+ baseUrlHint: '改完点「保存地址」立刻生效(写进当前 profile 的 Cordis patch),不用重装插件;输入框留空 = 不修改。',
222
+ baseUrlPlaceholderFallback: 'https://your-site.atlassian.net',
217
223
  fEmail: '账号邮箱',
218
224
  fProject: '项目',
219
225
  fBoard: '看板',
@@ -269,7 +275,7 @@ window.__ModuleLoader__.load({
269
275
  credClearFailed: '删除失败:{message}',
270
276
  credTokensLink: '在 Atlassian 里新建 / 吊销令牌',
271
277
  credNote: '令牌只写进 DSH 凭据库,界面永远只显示打码首尾;换完立刻生效,不用重启 DSH。',
272
- credOther: '其余配置(baseUrl、邮箱、监视间隔等)写在 profile 的 cordis.patch.yml 里;这个页面只改令牌。',
278
+ credOther: '其余配置(超时、项目、看板等)写在 profile 的 cordis.patch.yml 里;这个页面改令牌、邮箱、站点地址与监视设置。',
273
279
  credOpen: '配置',
274
280
  credClose: '收起令牌设置',
275
281
  patchTitle: '配置文件',
@@ -442,6 +448,12 @@ window.__ModuleLoader__.load({
442
448
  credGroupQuery: 'Query',
443
449
  credGroupWatch: 'Background watch',
444
450
  fBaseUrl: 'Base URL',
451
+ baseUrlSave: 'Save URL',
452
+ baseUrlSaving: 'Saving…',
453
+ baseUrlSaved: 'Jira site URL updated to {baseUrl}; effective immediately.',
454
+ baseUrlSaveFailed: 'Saving the site URL failed: {message}',
455
+ baseUrlHint: 'Click "Save URL" to apply it immediately (it is written into the current profile\'s Cordis patch) — no reinstall needed; leave the field empty to keep the current value.',
456
+ baseUrlPlaceholderFallback: 'https://your-site.atlassian.net',
445
457
  fEmail: 'Account email',
446
458
  fProject: 'Project',
447
459
  fBoard: 'Board',
@@ -497,7 +509,7 @@ window.__ModuleLoader__.load({
497
509
  credClearFailed: 'Removing failed: {message}',
498
510
  credTokensLink: 'Create or revoke tokens at Atlassian',
499
511
  credNote: 'The token goes into the DSH credential store only, and the UI ever shows the masked head and tail; a saved token takes effect at once, no restart needed.',
500
- credOther: 'The rest of the configuration (baseUrl, email, watch interval…) lives in the profile\'s cordis.patch.yml; this page only changes the token.',
512
+ credOther: 'The rest of the configuration (timeout, project, board…) lives in the profile\'s cordis.patch.yml; this page changes the token, email, site URL and watch settings.',
501
513
  credOpen: 'Configure',
502
514
  credClose: 'Hide token settings',
503
515
  patchTitle: 'Configuration file',
@@ -1881,8 +1893,6 @@ window.__ModuleLoader__.load({
1881
1893
  background:var(--dsw-alias-interactive-bg-hover,rgba(38,49,72,.06));border:1px solid var(--dsw-alias-border-l2,rgba(0,0,0,.1));
1882
1894
  border-radius:var(--dsw-radius-sm,8px)}
1883
1895
  .jmw-btn:hover{background:var(--dsw-alias-interactive-bg-hover,rgba(38,49,72,.1))}
1884
- .jmw-btn.primary{color:#fff;background:var(--dsw-alias-brand-primary,#4d6bfe);border-color:transparent}
1885
- .jmw-btn.primary:hover{background:color-mix(in srgb,var(--dsw-alias-brand-primary,#4d6bfe) 86%,#000)}
1886
1896
  .jmw-skel{height:13px;margin:12px 40px;border-radius:7px;
1887
1897
  background:linear-gradient(90deg,transparent,var(--dsw-alias-interactive-bg-hover,rgba(38,49,72,.08)),transparent);
1888
1898
  background-size:220px 100%;animation:jmw-pulse 1.1s ease-in-out infinite}
@@ -2706,7 +2716,10 @@ window.__ModuleLoader__.load({
2706
2716
  actions.push(h('button', {
2707
2717
  key: 'config',
2708
2718
  type: 'button',
2709
- className: 'jmw-btn primary',
2719
+ // 和配置页里的「保存并验证」用同一套按钮样式(类 + 内联兜底色),
2720
+ // 别再用 .jmw-btn.primary —— 它在浅色/深色主题下会跟着品牌色变成白底白字。
2721
+ className: 'jmw-cred-btn primary',
2722
+ style: BTN_PRIMARY,
2710
2723
  onClick: () => setCredOpen(true),
2711
2724
  }, t('failOpenConfig')));
2712
2725
  }
@@ -3120,6 +3133,11 @@ window.__ModuleLoader__.load({
3120
3133
  // 账号邮箱是可改字段,和令牌一起保存(Basic 认证 = 邮箱 + 令牌)。
3121
3134
  email: '',
3122
3135
  emailTouched: false,
3136
+ // Jira 站点地址:输入框默认留空、placeholder 显示当前生效地址;填了才写。
3137
+ baseUrlDraft: '',
3138
+ baseUrlBusy: false,
3139
+ baseUrlMessage: '',
3140
+ baseUrlError: '',
3123
3141
  busy: '',
3124
3142
  message: '',
3125
3143
  error: '',
@@ -3139,6 +3157,7 @@ window.__ModuleLoader__.load({
3139
3157
  let watchDebounce = null;
3140
3158
  let watchFlashTimer = null;
3141
3159
  let patchFlashTimer = null;
3160
+ let baseUrlFlashTimer = null;
3142
3161
 
3143
3162
  function readWatch(payload, previous) {
3144
3163
  const watch = payload?.watch ?? previous?.watch ?? null;
@@ -3232,6 +3251,38 @@ window.__ModuleLoader__.load({
3232
3251
  return state.email.trim() !== current;
3233
3252
  }
3234
3253
 
3254
+ // 站点地址:写进当前 profile 的 Cordis patch(volatile 字段),下一次请求就用新地址。
3255
+ // 输入框本身留空、placeholder 显示当前值;空输入不发请求(= 不修改)。
3256
+ async function saveBaseUrl() {
3257
+ const value = state.baseUrlDraft.trim();
3258
+ if (!value) return;
3259
+ clearTimeout(baseUrlFlashTimer);
3260
+ setState((prev) => ({ ...prev, baseUrlBusy: true, baseUrlMessage: '', baseUrlError: '' }));
3261
+ try {
3262
+ const response = await watchFetch(SETTINGS_PATH, {
3263
+ method: 'POST',
3264
+ headers: { accept: 'application/json', 'content-type': 'application/json' },
3265
+ body: JSON.stringify({ baseUrl: value }),
3266
+ });
3267
+ const payload = await response.json().catch(() => null);
3268
+ if (payload?.ok !== true) throw new Error(payload?.error || `HTTP ${response.status}`);
3269
+ setState((prev) => ({
3270
+ ...prev,
3271
+ baseUrlBusy: false,
3272
+ baseUrlDraft: '',
3273
+ baseUrlError: '',
3274
+ baseUrlMessage: t('baseUrlSaved', { baseUrl: String(payload?.applied?.baseUrl ?? value) }),
3275
+ // 保存成功顺带刷新一遍状态:placeholder 立刻显示新的生效地址。
3276
+ ...readWatch(payload, prev),
3277
+ }));
3278
+ baseUrlFlashTimer = setTimeout(() => setState((prev) => ({ ...prev, baseUrlMessage: '' })), 2600);
3279
+ if (typeof baseUrlFlashTimer?.unref === 'function') baseUrlFlashTimer.unref();
3280
+ void refresh();
3281
+ } catch (error) {
3282
+ setState((prev) => ({ ...prev, baseUrlBusy: false, baseUrlError: t('baseUrlSaveFailed', { message: String(error?.message ?? error) }) }));
3283
+ }
3284
+ }
3285
+
3235
3286
  // 监视设置「改了就生效」:开关一拨、间隔一改就写进当前 profile 的 Cordis patch,
3236
3287
  // 不需要「保存」按钮(只有令牌那种敏感值才需要显式确认后再落库)。
3237
3288
  async function pushWatch(patch) {
@@ -3509,7 +3560,43 @@ window.__ModuleLoader__.load({
3509
3560
  h('a', { key: 'tokens', className: 'jmw-cred-link', href: TOKENS_URL, target: '_blank', rel: 'noreferrer' }, t('credTokensLink')),
3510
3561
  ]),
3511
3562
  credGroup('connection', t('credGroupConnection'), [
3512
- credPair('baseUrl', t('fBaseUrl'), settings.baseUrl),
3563
+ // 站点地址改成可编辑输入框:留空 = 不修改,placeholder 显示当前生效的地址。
3564
+ h('div', { key: 'baseUrl', className: 'jmw-cred-form' }, [
3565
+ h('label', { key: 'label', className: 'jmw-cred-label', htmlFor: 'jmw-base-url' }, t('fBaseUrl')),
3566
+ h('input', {
3567
+ key: 'input',
3568
+ id: 'jmw-base-url',
3569
+ className: 'jmw-cred-input',
3570
+ type: 'url',
3571
+ inputMode: 'url',
3572
+ autoComplete: 'off',
3573
+ spellCheck: false,
3574
+ placeholder: String(settings.baseUrl ?? '') || t('baseUrlPlaceholderFallback'),
3575
+ value: state.baseUrlDraft,
3576
+ onInput: (event) => setState((prev) => ({
3577
+ ...prev,
3578
+ baseUrlDraft: event?.target?.value ?? '',
3579
+ baseUrlMessage: '',
3580
+ baseUrlError: '',
3581
+ })),
3582
+ onKeyDown: (event) => {
3583
+ if (event?.key === 'Enter') void saveBaseUrl();
3584
+ },
3585
+ }),
3586
+ h('div', { key: 'actions', className: 'jmw-cred-actions' }, [
3587
+ h('button', {
3588
+ key: 'save',
3589
+ type: 'button',
3590
+ className: 'jmw-cred-btn primary',
3591
+ style: BTN_PRIMARY,
3592
+ disabled: state.baseUrlBusy === true || state.baseUrlDraft.trim() === '',
3593
+ onClick: () => { void saveBaseUrl(); },
3594
+ }, state.baseUrlBusy ? t('baseUrlSaving') : t('baseUrlSave')),
3595
+ ]),
3596
+ h('div', { key: 'hint', className: 'jmw-cred-hint' }, t('baseUrlHint')),
3597
+ state.baseUrlMessage ? h('div', { key: 'message', className: 'jmw-cred-msg ok' }, state.baseUrlMessage) : null,
3598
+ state.baseUrlError ? h('div', { key: 'error', className: 'jmw-cred-msg err' }, state.baseUrlError) : null,
3599
+ ]),
3513
3600
  ]),
3514
3601
  credGroup('query', t('credGroupQuery'), [
3515
3602
  h('div', { key: 'results', className: 'jmw-cred-row' }, [
package/index.js CHANGED
@@ -295,6 +295,8 @@ const TEXT = {
295
295
  'err.noCredential': 'Jira 凭据缺失:请把 {key} 写进 DSH 凭据库、设为环境变量,或填进插件配置的 apiToken。',
296
296
  'err.credentialUnreadable': '读不出 DSH 凭据库里的 {key}:{message}',
297
297
  'err.noBaseUrl': '还没有配置 Jira 站点地址:打开面板标题右侧的「配置」填上 baseUrl(例如 https://your-site.atlassian.net),或在 profile 的 cordis.patch.yml 那一行里加 baseUrl。',
298
+ 'err.baseUrlRequired': '请填上 Jira 站点地址(例如 https://your-site.atlassian.net)。',
299
+ 'err.invalidBaseUrl': '「{value}」不是有效的 Jira 站点地址:要完整的 http(s) 地址,例如 https://your-site.atlassian.net。',
298
300
  'err.noEmail': 'Jira 配置缺少 email:Basic 认证需要登录邮箱。',
299
301
  'err.network': '连不上 {baseUrl}({path}):{cause}',
300
302
  'err.http': 'Jira {status} {statusText}({path}):{detail}',
@@ -496,6 +498,8 @@ const TEXT = {
496
498
  'err.noCredential': 'Missing Jira credential: put {key} into the DSH credential store, set it as an environment variable, or fill apiToken in the plugin config.',
497
499
  'err.credentialUnreadable': 'Could not read {key} from the DSH credential store: {message}',
498
500
  'err.noBaseUrl': 'No Jira site URL yet: open the "Configure" dialog in the panel header and set baseUrl (for example https://your-site.atlassian.net), or add baseUrl to this profile\'s cordis.patch.yml row.',
501
+ 'err.baseUrlRequired': 'Enter the Jira site URL (for example https://your-site.atlassian.net).',
502
+ 'err.invalidBaseUrl': '"{value}" is not a valid Jira site URL: use a full http(s) address such as https://your-site.atlassian.net.',
499
503
  'err.noEmail': 'Missing email in the Jira config: Basic auth requires a login email.',
500
504
  'err.network': 'Cannot reach {baseUrl} ({path}): {cause}',
501
505
  'err.http': 'Jira {status} {statusText} ({path}): {detail}',
@@ -723,8 +727,12 @@ export const inject = ['tools'];
723
727
  * `apiToken` 只为兼容旧版明文配置保留,首次加载后会迁移走。
724
728
  */
725
729
  export const Config = Schema.object({
730
+ // 站点地址是「运行时可改」的:配置页里是一个可编辑输入框,改完立刻生效(不用重装插件)。
731
+ // 因此和邮箱 / 监视设置一样标成 volatile —— 只有 volatile 字段才能经宿主 settings 服务写回
732
+ // 当前 profile 的 Cordis patch,并由 Loader 提交到运行中的引用。
726
733
  baseUrl: Schema.string()
727
734
  .default(DEFAULTS.baseUrl)
735
+ .volatile()
728
736
  .description(t('config.baseUrl')),
729
737
  email: Schema.string().default('').volatile().description(t('config.email')),
730
738
  credentialKey: Schema.string()
@@ -1046,6 +1054,31 @@ function limitOf(settings) {
1046
1054
  return normalizeLimit(liveSetting(settings, 'maxResults', DEFAULTS.maxResults));
1047
1055
  }
1048
1056
 
1057
+ /**
1058
+ * 站点根地址(volatile,配置页可改):每次现读,去首尾空白、去尾部斜杠。
1059
+ * 改成 volatile 之后 `settings.baseUrl` 在运行时是引用对象,必须走 liveSetting 脱壳。
1060
+ */
1061
+ function baseUrlOf(settings) {
1062
+ const value = liveSetting(settings, 'baseUrl', '');
1063
+ return typeof value === 'string' ? value.trim().replace(/\/+$/, '') : '';
1064
+ }
1065
+
1066
+ /** 配置页写入的站点地址必须是完整的 http(s) URL;空串 / 其它协议一律拒绝。 */
1067
+ function normalizeBaseUrl(value) {
1068
+ const text = String(unwrapValue(value) ?? '').trim().replace(/\/+$/, '');
1069
+ if (!text) throw new Error(t('err.baseUrlRequired'));
1070
+ let url;
1071
+ try {
1072
+ url = new URL(text);
1073
+ } catch {
1074
+ throw new Error(t('err.invalidBaseUrl', { value: text }));
1075
+ }
1076
+ if (url.protocol !== 'http:' && url.protocol !== 'https:') {
1077
+ throw new Error(t('err.invalidBaseUrl', { value: text }));
1078
+ }
1079
+ return text;
1080
+ }
1081
+
1049
1082
  function normalizeConfig(config) {
1050
1083
  const raw = config && typeof config === 'object' ? config : {};
1051
1084
  const settings = { ...DEFAULTS };
@@ -1108,9 +1141,9 @@ function createJira(ctx, settings) {
1108
1141
  /** 优先级顺序缓存 `{ ranks: Map, expires: number }`;见 priorityRanks()。 */
1109
1142
  priorityCache: null,
1110
1143
 
1111
- /** 站点地址(必填,装完要在面板「配置」里填)。baseUrl 不是 volatile,读启动期快照即可。 */
1144
+ /** 站点地址(必填):每次现读 volatile 值,配置页改完立刻生效。 */
1112
1145
  site() {
1113
- return String(settings.baseUrl || '').trim();
1146
+ return baseUrlOf(settings);
1114
1147
  },
1115
1148
 
1116
1149
  /** 每个入口(工具 / 命令 / 路由 / 轮询)开工前同步一次语言。 */
@@ -1170,7 +1203,7 @@ function createJira(ctx, settings) {
1170
1203
  query.set(name, String(value));
1171
1204
  }
1172
1205
  const qs = query.toString();
1173
- const url = `${settings.baseUrl}${path}${qs ? `?${qs}` : ''}`;
1206
+ const url = `${this.site()}${path}${qs ? `?${qs}` : ''}`;
1174
1207
 
1175
1208
  const auth = Buffer.from(`${this.email()}:${token}`, 'utf8').toString('base64');
1176
1209
  let response;
@@ -1185,7 +1218,7 @@ function createJira(ctx, settings) {
1185
1218
  // 这里把 cause 里的真实原因带出来,方便自查。
1186
1219
  if (signal?.aborted) throw error;
1187
1220
  const cause = error?.cause?.code ?? error?.cause?.message ?? error?.message ?? error;
1188
- throw new JiraError('network', t('err.network', { baseUrl: settings.baseUrl, path, cause }));
1221
+ throw new JiraError('network', t('err.network', { baseUrl: this.site(), path, cause }));
1189
1222
  }
1190
1223
  const text = await response.text();
1191
1224
 
@@ -1212,7 +1245,7 @@ function createJira(ctx, settings) {
1212
1245
 
1213
1246
  let response;
1214
1247
  try {
1215
- response = await fetch(`${settings.baseUrl}${path}`, {
1248
+ response = await fetch(`${this.site()}${path}`, {
1216
1249
  method: 'POST',
1217
1250
  headers: {
1218
1251
  Authorization: `Basic ${auth}`,
@@ -1225,7 +1258,7 @@ function createJira(ctx, settings) {
1225
1258
  } catch (error) {
1226
1259
  if (signal?.aborted) throw error;
1227
1260
  const cause = error?.cause?.code ?? error?.cause?.message ?? error?.message ?? error;
1228
- throw new JiraError('network', t('err.network', { baseUrl: settings.baseUrl, path, cause }));
1261
+ throw new JiraError('network', t('err.network', { baseUrl: this.site(), path, cause }));
1229
1262
  }
1230
1263
 
1231
1264
  const text = await response.text();
@@ -2149,7 +2182,7 @@ function registerTransitionRoute(ctx, jira) {
2149
2182
  */
2150
2183
  function publicSettings(settings) {
2151
2184
  return {
2152
- baseUrl: settings.baseUrl,
2185
+ baseUrl: baseUrlOf(settings),
2153
2186
  email: liveSetting(settings, 'email', '') || t('err.emailNotSet'),
2154
2187
  projectKey: settings.projectKey,
2155
2188
  boardId: settings.boardId,
@@ -2281,7 +2314,7 @@ async function resolveToken(ctx, settings) {
2281
2314
  async function verifyCredential(settings, token, signal, email) {
2282
2315
  const account = typeof email === 'string' && email ? email : liveSetting(settings, 'email', '');
2283
2316
  const auth = Buffer.from(`${account}:${token}`, 'utf8').toString('base64');
2284
- const response = await fetch(`${settings.baseUrl}/rest/api/3/myself`, {
2317
+ const response = await fetch(`${baseUrlOf(settings)}/rest/api/3/myself`, {
2285
2318
  headers: { Authorization: `Basic ${auth}`, Accept: 'application/json' },
2286
2319
  signal,
2287
2320
  });
@@ -2435,6 +2468,10 @@ async function writeSettings(ctx, settings, patch) {
2435
2468
  if (typeof patch?.email === 'string' && patch.email.trim()) {
2436
2469
  ops.push({ op: 'set', path: ['email'], value: patch.email.trim() });
2437
2470
  }
2471
+ // 站点地址(配置页里的可编辑输入框):必须是完整的 http(s) URL,否则抛错、不写。
2472
+ if (Object.prototype.hasOwnProperty.call(patch ?? {}, 'baseUrl')) {
2473
+ ops.push({ op: 'set', path: ['baseUrl'], value: normalizeBaseUrl(patch.baseUrl) });
2474
+ }
2438
2475
  const language = String(unwrapValue(patch?.language) ?? '').trim().toLowerCase();
2439
2476
  if (language === 'auto' || language === 'zh' || language === 'en') {
2440
2477
  ops.push({ op: 'set', path: ['language'], value: language });
@@ -3086,7 +3123,7 @@ async function fetchPlanIssue(jira, key, signal) {
3086
3123
  parentSummary: String(fields.parent?.fields?.summary ?? '').trim(),
3087
3124
  hasDescription: hasPlanDescription(fields.description),
3088
3125
  links: Array.isArray(fields.issuelinks) ? fields.issuelinks.length : 0,
3089
- url: `${jira.settings.baseUrl}/browse/${body?.key ?? key}`,
3126
+ url: `${jira.site()}/browse/${body?.key ?? key}`,
3090
3127
  };
3091
3128
  }
3092
3129
 
@@ -3528,7 +3565,7 @@ function transitionTool(jira, settings) {
3528
3565
  return [
3529
3566
  t('transition.updated', { key }),
3530
3567
  t('transition.updatedLine', { from: info.current || '—', to: result.status, id: match.id, name: match.name }),
3531
- `- ${jira.settings.baseUrl}/browse/${key}`,
3568
+ `- ${jira.site()}/browse/${key}`,
3532
3569
  ].join('\n');
3533
3570
  },
3534
3571
  };
@@ -3684,7 +3721,7 @@ function renderWorkList(issues, jql, scope, jira, limitHit) {
3684
3721
  t('list.header', { scope: scopeLabel(scope), count: issues.length }),
3685
3722
  '',
3686
3723
  t('list.meta', {
3687
- baseUrl: settings.baseUrl,
3724
+ baseUrl: baseUrlOf(settings),
3688
3725
  project: projectSummary(issues, settings.projectKey),
3689
3726
  account: liveSetting(settings, 'email', '') || t('list.accountMissing'),
3690
3727
  }),
@@ -3981,7 +4018,7 @@ function buildItemJson(issue, jira, ranks) {
3981
4018
  sprintState: typeof sprint?.state === 'string' ? sprint.state : '',
3982
4019
  sprintStart: typeof sprint?.startDate === 'string' ? sprint.startDate.slice(0, 10) : '',
3983
4020
  sprintEnd: typeof sprint?.endDate === 'string' ? sprint.endDate.slice(0, 10) : '',
3984
- url: key ? `${jira.settings.baseUrl}/browse/${key}` : jira.settings.baseUrl,
4021
+ url: key ? `${jira.site()}/browse/${key}` : jira.site(),
3985
4022
  };
3986
4023
  }
3987
4024
 
@@ -4027,7 +4064,7 @@ function renderIssue(issue, options) {
4027
4064
  if (typeof fields.updated === 'string') meta.push(t('issue.meta.updated', { value: fields.updated.replace('T', ' ').slice(0, 16) }));
4028
4065
 
4029
4066
  if (meta.length) lines.push('', meta.join(' · '));
4030
- if (issue?.key) lines.push('', t('issue.link', { url: `${options.settings.baseUrl}/browse/${issue.key}` }));
4067
+ if (issue?.key) lines.push('', t('issue.link', { url: `${baseUrlOf(options.settings)}/browse/${issue.key}` }));
4031
4068
 
4032
4069
  lines.push('', t('issue.descriptionHeader'), '', adfToText(fields.description).trim() || t('issue.noDescription'));
4033
4070
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-jira-work-overview",
3
- "version": "0.16.2",
3
+ "version": "0.16.3",
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",
@@ -560,7 +560,7 @@ console.log('未配置时显示:', field(page, 'jmw-cred-none') !== undefined, '
560
560
  console.log('输入框存在:', field(page, 'jmw-cred-input') !== undefined, '| 邮箱输入框:', field(page, 'jmw-cred-email') !== undefined,
561
561
  '| 邮箱回填:', field(page, 'jmw-cred-email')?.props?.value);
562
562
  console.log('保存按钮禁用(没输入、邮箱也没改):', buttonByText(page, '保存并验证')?.props.disabled === true);
563
- console.log('只读项在「Jira 连接 / 查询」两组里:', collect(page, (row) => String(row.props?.className ?? '') === 'jmw-cred-groupbody').length === 4, '| 键值对:', collect(page, (row) => String(row.props?.className ?? '') === 'jmw-cred-pair').map((row) => text(row)).join(' ').slice(0, 90));
563
+ console.log('站点地址是可编辑输入框:', collect(page, (row) => row.type === 'input' && row.props?.id === 'jmw-base-url').length === 1, '| 键值对(只读项):', collect(page, (row) => String(row.props?.className ?? '') === 'jmw-cred-pair').map((row) => text(row)).join(' ').slice(0, 90));
564
564
  console.log('页面上有凭据库键说明:', text(page).includes('JIRA_API_TOKEN'), '| 有 Atlassian 链接:', collect(page, (row) => row.type === 'a' && String(row.props.href).includes('api-tokens')).length === 1);
565
565
 
566
566
  const input = field(page, 'jmw-cred-input');
@@ -662,6 +662,35 @@ if (resultsInput) {
662
662
  console.log('输入 0 → 自动写入:', settingsWrites.length > beforeZero, '| maxResults:', zeroWrite?.ops.find((op) => op.path[0] === 'maxResults')?.value, '(期望 0 = 不限制)');
663
663
  credPage = renderCred('page');
664
664
  }
665
+ // 站点地址:可编辑输入框,placeholder 显示当前生效地址;填了就写进 profile 的 Cordis patch
666
+ const baseUrlInput = () => collect(credPage, (row) => row.type === 'input' && row.props?.id === 'jmw-base-url')[0];
667
+ console.log('站点地址输入框:', baseUrlInput() !== undefined, '| 初始值:', JSON.stringify(baseUrlInput()?.props?.value ?? null),
668
+ '| placeholder = 当前地址:', baseUrlInput()?.props?.placeholder);
669
+ console.log('空输入时保存按钮禁用:', buttonByText(credPage, '保存地址')?.props?.disabled === true);
670
+ if (baseUrlInput()) {
671
+ baseUrlInput().props.onInput({ target: { value: 'https://new-site.atlassian.net/' } });
672
+ credPage = renderCred('page');
673
+ console.log('输入后保存按钮可用:', buttonByText(credPage, '保存地址')?.props?.disabled === false);
674
+ const beforeBaseUrl = settingsWrites.length;
675
+ buttonByText(credPage, '保存地址').props.onClick();
676
+ await wait(200);
677
+ credPage = renderCred('page');
678
+ const baseUrlWrite = settingsWrites[settingsWrites.length - 1];
679
+ console.log('保存地址 → 写入 profile patch:', settingsWrites.length > beforeBaseUrl,
680
+ '| baseUrl:', baseUrlWrite?.ops.find((op) => op.path[0] === 'baseUrl')?.value, '(尾斜杠应去掉)');
681
+ console.log(' placeholder 已更新为新地址:', baseUrlInput()?.props?.placeholder);
682
+ console.log(' 输入框已清空:', (baseUrlInput()?.props?.value ?? '') === '');
683
+ console.log(' 成功提示:', collect(credPage, (row) => classNameOf(row).includes('jmw-cred-msg') && classNameOf(row).includes('ok')).map((row) => text(row).trim()).join(' | ') || '(没有)');
684
+ // 非法地址:host 拒绝,界面报错且不写入
685
+ baseUrlInput().props.onInput({ target: { value: 'not a url' } });
686
+ credPage = renderCred('page');
687
+ const beforeBad = settingsWrites.length;
688
+ buttonByText(credPage, '保存地址').props.onClick();
689
+ await wait(200);
690
+ credPage = renderCred('page');
691
+ console.log('非法地址 → 被拒:', settingsWrites.length === beforeBad,
692
+ '| 错误文案:', collect(credPage, (row) => classNameOf(row).includes('jmw-cred-msg') && classNameOf(row).includes('err')).map((row) => text(row).trim()).join(' | '));
693
+ }
665
694
  // 界面语言:三个 chip(自动 / 中文 / English),点了立刻写进 profile 的 Cordis patch
666
695
  // 迷你 React 不保留 key,所以按「文本是三种语言名之一」来找(配置页里不会同时出现状态下拉的 chip)
667
696
  const LANG_LABELS = ['自动', '中文', 'English'];
@@ -803,7 +803,9 @@ const failureNode = (name) => collect(panel, (row) => clsOf(row) === name)[0];
803
803
  const failTitle = () => text(failureNode('jmw-failure-title')).trim();
804
804
  const failHint = () => text(failureNode('jmw-failure-hint')).trim();
805
805
  const failDetails = () => collect(panel, (row) => clsOf(row) === 'jmw-failure-detail');
806
- const failButtons = () => collect(panel, (row) => clsOf(row).split(' ')[0] === 'jmw-btn').map((row) => text(row).trim());
806
+ // 失败态的按钮既可能是 .jmw-btn(重试),也可能是 .jmw-cred-btn(去配置,和配置页「保存并验证」同款)。
807
+ const isActionBtn = (row) => row.type === 'button' && /^jmw-(cred-)?btn(\s|$)/.test(clsOf(row));
808
+ const failButtons = () => collect(panel, isActionBtn).map((row) => text(row).trim());
807
809
  const refreshBtn = () => collect(panel, (row) => row.type === 'button' && row.props?.['aria-label'] === '刷新')[0];
808
810
 
809
811
  activeFailure.current = { code: 'no_credential', message: 'Missing Jira credential: put JIRA_API_TOKEN into the DSH credential store…' };
@@ -820,7 +822,13 @@ check(
820
822
  'I 无令牌 → 提示文字 + 去配置 / 重试,且不显示原始报错',
821
823
  `${failTitle()} / ${failButtons().join(',')}`,
822
824
  );
823
- const openConfig = collect(panel, (row) => clsOf(row).split(' ')[0] === 'jmw-btn' && text(row).trim() === '去配置')[0];
825
+ const openConfig = collect(panel, (row) => isActionBtn(row) && text(row).trim() === '去配置')[0];
826
+ check(
827
+ /\bprimary\b/.test(clsOf(openConfig)) && openConfig?.props?.style?.background === '#4d6bfe'
828
+ && openConfig?.props?.style?.color === '#ffffff',
829
+ 'I 「去配置」用和「保存并验证」一致的按钮样式(深底白字 + primary 类)',
830
+ `class=${clsOf(openConfig)} style=${JSON.stringify(openConfig?.props?.style)}`,
831
+ );
824
832
  openConfig.props.onClick();
825
833
  panel = renderPanel();
826
834
  check(
@@ -842,7 +850,7 @@ check(
842
850
  'I 401 → 「邮箱 / 令牌不被接受」+ 原始信息收在详情里',
843
851
  failTitle(),
844
852
  );
845
- const retryBtn = collect(panel, (row) => clsOf(row).split(' ')[0] === 'jmw-btn' && text(row).trim() === '重试')[0];
853
+ const retryBtn = collect(panel, (row) => isActionBtn(row) && text(row).trim() === '重试')[0];
846
854
  activeFailure.current = null;
847
855
  retryBtn.props.onClick();
848
856
  await settle();