dsh-jira-work-overview 0.16.2 → 0.16.4

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,31 @@ 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.4] - 2026-11-23
8
+
9
+ ### Fixed
10
+
11
+ - **第一次配置时只点「保存并验证」,站点地址没跟着保存,列表一直是空的。** 全新安装(或换了 profile)
12
+ 时 `baseUrl` 还没写过:用户在配置页把邮箱、令牌、站点地址一起填好、只点了「保存并验证」这条通道
13
+ 当时只提交 `token` + `email`,地址留在输入框里没落盘,于是面板一直报「还没有配置 Jira 站点地址」。
14
+ 现在令牌保存会带上输入框里的站点地址、先拿它做 `/myself` 验证再一起写进 profile(地址非法整条拒绝、
15
+ 不写入);配置保存成功后还会让面板自动重拉一次列表(以前配置完关掉弹窗,看到的仍是旧错误页,
16
+ 得手动点「重试」);profile 没有 settings 服务、只能本次运行生效时也会明确提示。
17
+
18
+ ## [0.16.3] - 2026-11-23
19
+
20
+ ### Added
21
+
22
+ - **配置页「Jira 连接」里的服务地址现在是可编辑输入框。** 输入框默认留空、placeholder 显示当前生效的
23
+ 地址;填好点「保存地址」(或回车)就写进当前 profile 的 Cordis patch(`baseUrl` 改成 volatile 字段),
24
+ 保存后立刻生效,不用重装插件。只接受完整的 `http(s)` 地址(自动去掉尾部斜杠),空值 / 其它协议直接
25
+ 拒绝并在页面上报错;「其余配置写在 cordis.patch.yml 里,这个页面只改令牌」的说明也同步改掉了。
26
+
27
+ ### Fixed
28
+
29
+ - **没配令牌时失败提示里的「去配置」按钮看不清。** 它原来用 `.jmw-btn.primary` 的
30
+ `--dsw-alias-brand-primary` 当底色,浅色 / 深色主题下会变成白底白字;现在改成和配置页「保存并验证」
31
+ 完全一致的 `.jmw-cred-btn primary` + 内联深底白字(`#4d6bfe`),并删掉了已无用的 `.jmw-btn.primary` 规则。
8
32
 
9
33
  ## [0.16.2] - 2026-11-23
10
34
 
package/README.md CHANGED
@@ -277,6 +277,8 @@ 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.4 | 2026-11-23 | **fix** | on a fresh profile, filling email + token + site URL and clicking only **Save & verify** left the URL unsaved, so the panel always said there was no site URL; the panel now also reloads automatically after a successful save |
281
+ | 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
282
  | 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
283
  | 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
284
  | 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,8 @@ 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.4 | 2026-11-23 | **修复** | 全新 profile 上把邮箱、令牌、站点地址一起填好、只点「保存并验证」时地址没落盘,面板一直说没配站点地址;配置保存成功后还会自动重拉列表 |
535
+ | 0.16.3 | 2026-11-23 | **修复** | 配置页「Jira 连接」的服务地址改成可编辑输入框(placeholder = 当前地址,写进 profile 的 Cordis patch);失败提示里的「去配置」按钮和「保存并验证」同款样式 |
533
536
  | 0.16.2 | 2026-11-23 | **修复** | 左栏工作区右键菜单的「关联 Jira 项目…」会整页消失(客户端启动竞态);新增离线套件守住 |
534
537
  | 0.16.1 | 2026-11-22 | 修复 | Windows 通知与「在文件管理器中显示」、Linux 编辑器直选、UNC 路径;三平台 CI 与发版预检;README 补计划会话图解 |
535
538
  | 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: '看板',
@@ -261,6 +267,8 @@ window.__ModuleLoader__.load({
261
267
  credConfirmClear: '确认清除?',
262
268
  credSaved: '已保存到 DSH 凭据库({key}),立即生效',
263
269
  credSavedEmail: '账号邮箱已更新为 {email}',
270
+ credSavedBaseUrl: '站点地址已更新为 {baseUrl}',
271
+ baseUrlSavedLocal: '站点地址已应用({baseUrl}),但没能写进 profile 的 Cordis patch({reason}),重启后会丢',
264
272
  credSavedOffline: '已保存到 DSH 凭据库({key});这次没能验证成功({message})',
265
273
  credSavedAs: '已验证账号:{account}',
266
274
  credCleared: '已从凭据库删除 {key}',
@@ -269,7 +277,7 @@ window.__ModuleLoader__.load({
269
277
  credClearFailed: '删除失败:{message}',
270
278
  credTokensLink: '在 Atlassian 里新建 / 吊销令牌',
271
279
  credNote: '令牌只写进 DSH 凭据库,界面永远只显示打码首尾;换完立刻生效,不用重启 DSH。',
272
- credOther: '其余配置(baseUrl、邮箱、监视间隔等)写在 profile 的 cordis.patch.yml 里;这个页面只改令牌。',
280
+ credOther: '其余配置(超时、项目、看板等)写在 profile 的 cordis.patch.yml 里;这个页面改令牌、邮箱、站点地址与监视设置。',
273
281
  credOpen: '配置',
274
282
  credClose: '收起令牌设置',
275
283
  patchTitle: '配置文件',
@@ -442,6 +450,12 @@ window.__ModuleLoader__.load({
442
450
  credGroupQuery: 'Query',
443
451
  credGroupWatch: 'Background watch',
444
452
  fBaseUrl: 'Base URL',
453
+ baseUrlSave: 'Save URL',
454
+ baseUrlSaving: 'Saving…',
455
+ baseUrlSaved: 'Jira site URL updated to {baseUrl}; effective immediately.',
456
+ baseUrlSaveFailed: 'Saving the site URL failed: {message}',
457
+ 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.',
458
+ baseUrlPlaceholderFallback: 'https://your-site.atlassian.net',
445
459
  fEmail: 'Account email',
446
460
  fProject: 'Project',
447
461
  fBoard: 'Board',
@@ -489,6 +503,8 @@ window.__ModuleLoader__.load({
489
503
  credConfirmClear: 'Clear it?',
490
504
  credSaved: 'Saved to the DSH credential store ({key}); effective immediately',
491
505
  credSavedEmail: 'Account email updated to {email}',
506
+ credSavedBaseUrl: 'Site URL updated to {baseUrl}',
507
+ baseUrlSavedLocal: 'Site URL applied ({baseUrl}) but could not be written into this profile\'s Cordis patch ({reason}); it is lost after a restart',
492
508
  credSavedOffline: 'Saved to the DSH credential store ({key}); verification failed this time ({message})',
493
509
  credSavedAs: 'Verified account: {account}',
494
510
  credCleared: 'Removed {key} from the credential store',
@@ -497,7 +513,7 @@ window.__ModuleLoader__.load({
497
513
  credClearFailed: 'Removing failed: {message}',
498
514
  credTokensLink: 'Create or revoke tokens at Atlassian',
499
515
  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.',
516
+ 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
517
  credOpen: 'Configure',
502
518
  credClose: 'Hide token settings',
503
519
  patchTitle: 'Configuration file',
@@ -1881,8 +1897,6 @@ window.__ModuleLoader__.load({
1881
1897
  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
1898
  border-radius:var(--dsw-radius-sm,8px)}
1883
1899
  .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
1900
  .jmw-skel{height:13px;margin:12px 40px;border-radius:7px;
1887
1901
  background:linear-gradient(90deg,transparent,var(--dsw-alias-interactive-bg-hover,rgba(38,49,72,.08)),transparent);
1888
1902
  background-size:220px 100%;animation:jmw-pulse 1.1s ease-in-out infinite}
@@ -2706,7 +2720,10 @@ window.__ModuleLoader__.load({
2706
2720
  actions.push(h('button', {
2707
2721
  key: 'config',
2708
2722
  type: 'button',
2709
- className: 'jmw-btn primary',
2723
+ // 和配置页里的「保存并验证」用同一套按钮样式(类 + 内联兜底色),
2724
+ // 别再用 .jmw-btn.primary —— 它在浅色/深色主题下会跟着品牌色变成白底白字。
2725
+ className: 'jmw-cred-btn primary',
2726
+ style: BTN_PRIMARY,
2710
2727
  onClick: () => setCredOpen(true),
2711
2728
  }, t('failOpenConfig')));
2712
2729
  }
@@ -3036,7 +3053,13 @@ window.__ModuleLoader__.load({
3036
3053
  onClick: () => setCredOpen(false),
3037
3054
  }, h(CloseGlyph)),
3038
3055
  ]),
3039
- h(CredentialSettings, { key: 'body', view: 'page' }),
3056
+ // 保存成功就让面板重拉一次列表:否则配置完关掉弹窗,后面还是那张
3057
+ // 「没有配置 / 加载失败」的旧错误页,用户以为没生效。
3058
+ h(CredentialSettings, {
3059
+ key: 'body',
3060
+ view: 'page',
3061
+ onChanged: () => { if (state.open) void load(snapshot.scope); },
3062
+ }),
3040
3063
  ]))
3041
3064
  : null;
3042
3065
 
@@ -3120,6 +3143,11 @@ window.__ModuleLoader__.load({
3120
3143
  // 账号邮箱是可改字段,和令牌一起保存(Basic 认证 = 邮箱 + 令牌)。
3121
3144
  email: '',
3122
3145
  emailTouched: false,
3146
+ // Jira 站点地址:输入框默认留空、placeholder 显示当前生效地址;填了才写。
3147
+ baseUrlDraft: '',
3148
+ baseUrlBusy: false,
3149
+ baseUrlMessage: '',
3150
+ baseUrlError: '',
3123
3151
  busy: '',
3124
3152
  message: '',
3125
3153
  error: '',
@@ -3139,6 +3167,7 @@ window.__ModuleLoader__.load({
3139
3167
  let watchDebounce = null;
3140
3168
  let watchFlashTimer = null;
3141
3169
  let patchFlashTimer = null;
3170
+ let baseUrlFlashTimer = null;
3142
3171
 
3143
3172
  function readWatch(payload, previous) {
3144
3173
  const watch = payload?.watch ?? previous?.watch ?? null;
@@ -3193,34 +3222,45 @@ window.__ModuleLoader__.load({
3193
3222
 
3194
3223
  async function save() {
3195
3224
  // 令牌与邮箱是一对:有令牌就用新令牌,没令牌时用当前生效的那把(只改邮箱的场景)。
3225
+ // 站点地址也一并带上:用户在同一张表单里刚填的地址不该要求他先单独点一次「保存地址」,
3226
+ // 否则他只点「保存并验证」时地址根本没落盘,列表照样报 no_base_url。
3196
3227
  const token = state.input.trim();
3197
3228
  const email = state.email.trim();
3198
- if (!token && !emailChanged()) return;
3229
+ const baseUrl = state.baseUrlDraft.trim();
3230
+ if (!token && !emailChanged() && !baseUrl) return;
3199
3231
  setState((prev) => ({ ...prev, busy: 'save', message: '', error: '' }));
3200
3232
  try {
3201
3233
  const response = await watchFetch(CREDENTIAL_PATH, {
3202
3234
  method: 'POST',
3203
3235
  headers: { accept: 'application/json', 'content-type': 'application/json' },
3204
- body: JSON.stringify({ token, email }),
3236
+ body: JSON.stringify(baseUrl ? { token, email, baseUrl } : { token, email }),
3205
3237
  });
3206
3238
  const payload = await response.json().catch(() => null);
3207
3239
  if (payload?.ok !== true) throw new Error(payload?.error || `HTTP ${response.status}`);
3208
3240
  const offline = payload.verification && payload.verification.ok === false;
3209
3241
  const account = payload.verification?.account ? ` ${t('credSavedAs', { account: payload.verification.account })}` : '';
3210
3242
  const emailNote = payload.emailSaved ? ` ${t('credSavedEmail', { email: payload.email ?? email })}` : '';
3243
+ const baseUrlNote = payload.baseUrlSaved
3244
+ ? ` ${payload.baseUrlPersisted === false
3245
+ ? t('baseUrlSavedLocal', { baseUrl: String(payload.baseUrl ?? baseUrl), reason: String(payload.baseUrlReason ?? '') })
3246
+ : t('credSavedBaseUrl', { baseUrl: String(payload.baseUrl ?? baseUrl) })}`
3247
+ : '';
3211
3248
  setState((prev) => ({
3212
3249
  ...prev,
3213
3250
  busy: '',
3214
3251
  input: '',
3215
3252
  email: String(payload.email ?? prev.email),
3216
3253
  emailTouched: false,
3254
+ // 地址已经落盘:清空草稿,placeholder 变成新地址。
3255
+ baseUrlDraft: payload.baseUrlSaved ? '' : prev.baseUrlDraft,
3217
3256
  status: payload,
3218
3257
  error: '',
3219
3258
  // 账号只跟着这次保存的消息显示;不要把验证结果留在 state 里,否则下一条消息也会挂上它。
3220
3259
  message: (offline
3221
3260
  ? t('credSavedOffline', { key: payload.credentialKey, message: payload.verification.message ?? '' })
3222
- : t('credSaved', { key: payload.credentialKey })) + emailNote + account,
3261
+ : t('credSaved', { key: payload.credentialKey })) + emailNote + baseUrlNote + account,
3223
3262
  }));
3263
+ props?.onChanged?.();
3224
3264
  } catch (error) {
3225
3265
  setState((prev) => ({ ...prev, busy: '', error: t('credSaveFailed', { message: String(error?.message ?? error) }) }));
3226
3266
  }
@@ -3232,6 +3272,41 @@ window.__ModuleLoader__.load({
3232
3272
  return state.email.trim() !== current;
3233
3273
  }
3234
3274
 
3275
+ // 站点地址:写进当前 profile 的 Cordis patch(volatile 字段),下一次请求就用新地址。
3276
+ // 输入框本身留空、placeholder 显示当前值;空输入不发请求(= 不修改)。
3277
+ async function saveBaseUrl() {
3278
+ const value = state.baseUrlDraft.trim();
3279
+ if (!value) return;
3280
+ clearTimeout(baseUrlFlashTimer);
3281
+ setState((prev) => ({ ...prev, baseUrlBusy: true, baseUrlMessage: '', baseUrlError: '' }));
3282
+ try {
3283
+ const response = await watchFetch(SETTINGS_PATH, {
3284
+ method: 'POST',
3285
+ headers: { accept: 'application/json', 'content-type': 'application/json' },
3286
+ body: JSON.stringify({ baseUrl: value }),
3287
+ });
3288
+ const payload = await response.json().catch(() => null);
3289
+ if (payload?.ok !== true) throw new Error(payload?.error || `HTTP ${response.status}`);
3290
+ setState((prev) => ({
3291
+ ...prev,
3292
+ baseUrlBusy: false,
3293
+ baseUrlDraft: '',
3294
+ baseUrlError: '',
3295
+ baseUrlMessage: payload?.persisted === false
3296
+ ? t('baseUrlSavedLocal', { baseUrl: String(payload?.applied?.baseUrl ?? value), reason: String(payload?.reason ?? '') })
3297
+ : t('baseUrlSaved', { baseUrl: String(payload?.applied?.baseUrl ?? value) }),
3298
+ // 保存成功顺带刷新一遍状态:placeholder 立刻显示新的生效地址。
3299
+ ...readWatch(payload, prev),
3300
+ }));
3301
+ baseUrlFlashTimer = setTimeout(() => setState((prev) => ({ ...prev, baseUrlMessage: '' })), 2600);
3302
+ if (typeof baseUrlFlashTimer?.unref === 'function') baseUrlFlashTimer.unref();
3303
+ props?.onChanged?.();
3304
+ void refresh();
3305
+ } catch (error) {
3306
+ setState((prev) => ({ ...prev, baseUrlBusy: false, baseUrlError: t('baseUrlSaveFailed', { message: String(error?.message ?? error) }) }));
3307
+ }
3308
+ }
3309
+
3235
3310
  // 监视设置「改了就生效」:开关一拨、间隔一改就写进当前 profile 的 Cordis patch,
3236
3311
  // 不需要「保存」按钮(只有令牌那种敏感值才需要显式确认后再落库)。
3237
3312
  async function pushWatch(patch) {
@@ -3417,6 +3492,7 @@ window.__ModuleLoader__.load({
3417
3492
  const payload = await response.json().catch(() => null);
3418
3493
  if (payload?.ok !== true) throw new Error(payload?.error || `HTTP ${response.status}`);
3419
3494
  setState((prev) => ({ ...prev, busy: '', status: payload, error: '', message: t('credCleared', { key: payload.credentialKey }) }));
3495
+ props?.onChanged?.();
3420
3496
  } catch (error) {
3421
3497
  setState((prev) => ({ ...prev, busy: '', error: t('credClearFailed', { message: String(error?.message ?? error) }) }));
3422
3498
  }
@@ -3509,7 +3585,43 @@ window.__ModuleLoader__.load({
3509
3585
  h('a', { key: 'tokens', className: 'jmw-cred-link', href: TOKENS_URL, target: '_blank', rel: 'noreferrer' }, t('credTokensLink')),
3510
3586
  ]),
3511
3587
  credGroup('connection', t('credGroupConnection'), [
3512
- credPair('baseUrl', t('fBaseUrl'), settings.baseUrl),
3588
+ // 站点地址改成可编辑输入框:留空 = 不修改,placeholder 显示当前生效的地址。
3589
+ h('div', { key: 'baseUrl', className: 'jmw-cred-form' }, [
3590
+ h('label', { key: 'label', className: 'jmw-cred-label', htmlFor: 'jmw-base-url' }, t('fBaseUrl')),
3591
+ h('input', {
3592
+ key: 'input',
3593
+ id: 'jmw-base-url',
3594
+ className: 'jmw-cred-input',
3595
+ type: 'url',
3596
+ inputMode: 'url',
3597
+ autoComplete: 'off',
3598
+ spellCheck: false,
3599
+ placeholder: String(settings.baseUrl ?? '') || t('baseUrlPlaceholderFallback'),
3600
+ value: state.baseUrlDraft,
3601
+ onInput: (event) => setState((prev) => ({
3602
+ ...prev,
3603
+ baseUrlDraft: event?.target?.value ?? '',
3604
+ baseUrlMessage: '',
3605
+ baseUrlError: '',
3606
+ })),
3607
+ onKeyDown: (event) => {
3608
+ if (event?.key === 'Enter') void saveBaseUrl();
3609
+ },
3610
+ }),
3611
+ h('div', { key: 'actions', className: 'jmw-cred-actions' }, [
3612
+ h('button', {
3613
+ key: 'save',
3614
+ type: 'button',
3615
+ className: 'jmw-cred-btn primary',
3616
+ style: BTN_PRIMARY,
3617
+ disabled: state.baseUrlBusy === true || state.baseUrlDraft.trim() === '',
3618
+ onClick: () => { void saveBaseUrl(); },
3619
+ }, state.baseUrlBusy ? t('baseUrlSaving') : t('baseUrlSave')),
3620
+ ]),
3621
+ h('div', { key: 'hint', className: 'jmw-cred-hint' }, t('baseUrlHint')),
3622
+ state.baseUrlMessage ? h('div', { key: 'message', className: 'jmw-cred-msg ok' }, state.baseUrlMessage) : null,
3623
+ state.baseUrlError ? h('div', { key: 'error', className: 'jmw-cred-msg err' }, state.baseUrlError) : null,
3624
+ ]),
3513
3625
  ]),
3514
3626
  credGroup('query', t('credGroupQuery'), [
3515
3627
  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,
@@ -2276,12 +2309,13 @@ async function resolveToken(ctx, settings) {
2276
2309
 
2277
2310
  /**
2278
2311
  * 拿候选「邮箱 + 令牌」试一次 /myself:能分清「这个组合不对」(401/403)与「网络不通」。
2279
- * email 省略时用当前生效的邮箱。
2312
+ * email / site 省略时用当前生效值;site 允许传「还没落盘的候选地址」,免得用户
2313
+ * 在同一张表单里刚填的站点地址要先保存一次才能验证。
2280
2314
  */
2281
- async function verifyCredential(settings, token, signal, email) {
2315
+ async function verifyCredential(settings, token, signal, email, site) {
2282
2316
  const account = typeof email === 'string' && email ? email : liveSetting(settings, 'email', '');
2283
2317
  const auth = Buffer.from(`${account}:${token}`, 'utf8').toString('base64');
2284
- const response = await fetch(`${settings.baseUrl}/rest/api/3/myself`, {
2318
+ const response = await fetch(`${site || baseUrlOf(settings)}/rest/api/3/myself`, {
2285
2319
  headers: { Authorization: `Basic ${auth}`, Accept: 'application/json' },
2286
2320
  signal,
2287
2321
  });
@@ -2344,9 +2378,21 @@ function registerCredentialRoute(ctx, jira, settings) {
2344
2378
  // 令牌与邮箱是一对:都从 payload 里取,缺的那一半用当前生效值。
2345
2379
  const token = typeof payload?.token === 'string' ? payload.token.trim() : '';
2346
2380
  const rawEmail = typeof payload?.email === 'string' ? payload.email.trim() : '';
2381
+ const rawBaseUrl = typeof payload?.baseUrl === 'string' ? payload.baseUrl.trim() : '';
2347
2382
  const current = await resolveToken(ctx, settings);
2348
2383
  const currentEmail = String(liveSetting(settings, 'email', '') ?? '').trim();
2349
2384
  const nextEmail = rawEmail || currentEmail;
2385
+ // 站点地址也能和令牌一起提交:同一张表单里刚填的地址不必先单独保存一次,
2386
+ // 否则用户只点「保存并验证」时地址根本没落盘,列表照样是 no_base_url。
2387
+ let nextBaseUrl = baseUrlOf(settings);
2388
+ if (rawBaseUrl) {
2389
+ try {
2390
+ nextBaseUrl = normalizeBaseUrl(rawBaseUrl);
2391
+ } catch (error) {
2392
+ return jsonResponse({ ok: false, error: String(error?.message ?? error) }, 400);
2393
+ }
2394
+ }
2395
+ if (!nextBaseUrl) return jsonResponse({ ok: false, error: t('err.noBaseUrl') }, 400);
2350
2396
 
2351
2397
  if (!nextEmail) return jsonResponse({ ok: false, error: t('err.needEmail') }, 400);
2352
2398
  if (rawEmail && !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(rawEmail)) {
@@ -2360,7 +2406,7 @@ function registerCredentialRoute(ctx, jira, settings) {
2360
2406
  // 网络层失败照存但提示(同令牌单独保存时的策略)。
2361
2407
  let verification = { skipped: true, reason: t('verify.skipped') };
2362
2408
  try {
2363
- const probe = await verifyCredential(settings, candidate, request.signal, nextEmail);
2409
+ const probe = await verifyCredential(settings, candidate, request.signal, nextEmail, nextBaseUrl);
2364
2410
  verification = probe;
2365
2411
  if (probe.ok === false && (probe.status === 401 || probe.status === 403)) {
2366
2412
  return jsonResponse({
@@ -2384,8 +2430,29 @@ function registerCredentialRoute(ctx, jira, settings) {
2384
2430
  await writeSettings(ctx, settings, { email: nextEmail });
2385
2431
  emailSaved = true;
2386
2432
  }
2433
+ let baseUrlSaved = false;
2434
+ let baseUrlPersisted = true;
2435
+ let baseUrlReason;
2436
+ if (rawBaseUrl) {
2437
+ // 验证已经用的是这个地址;这里只负责落盘,失败要把原因回给界面。
2438
+ const written = await writeSettings(ctx, settings, { baseUrl: nextBaseUrl });
2439
+ baseUrlSaved = true;
2440
+ baseUrlPersisted = written?.persisted !== false;
2441
+ baseUrlReason = written?.reason;
2442
+ }
2387
2443
  const status = await credentialStatus(ctx, settings);
2388
- return jsonResponse({ ok: true, saved: true, tokenSaved: Boolean(token), emailSaved, verification, ...status });
2444
+ return jsonResponse({
2445
+ ok: true,
2446
+ saved: true,
2447
+ tokenSaved: Boolean(token),
2448
+ emailSaved,
2449
+ baseUrlSaved,
2450
+ baseUrlPersisted,
2451
+ baseUrlReason,
2452
+ baseUrl: baseUrlOf(settings),
2453
+ verification,
2454
+ ...status,
2455
+ });
2389
2456
  } catch (error) {
2390
2457
  return jsonResponse({ ok: false, error: String(error?.message ?? error) }, 400);
2391
2458
  }
@@ -2435,6 +2502,10 @@ async function writeSettings(ctx, settings, patch) {
2435
2502
  if (typeof patch?.email === 'string' && patch.email.trim()) {
2436
2503
  ops.push({ op: 'set', path: ['email'], value: patch.email.trim() });
2437
2504
  }
2505
+ // 站点地址(配置页里的可编辑输入框):必须是完整的 http(s) URL,否则抛错、不写。
2506
+ if (Object.prototype.hasOwnProperty.call(patch ?? {}, 'baseUrl')) {
2507
+ ops.push({ op: 'set', path: ['baseUrl'], value: normalizeBaseUrl(patch.baseUrl) });
2508
+ }
2438
2509
  const language = String(unwrapValue(patch?.language) ?? '').trim().toLowerCase();
2439
2510
  if (language === 'auto' || language === 'zh' || language === 'en') {
2440
2511
  ops.push({ op: 'set', path: ['language'], value: language });
@@ -3086,7 +3157,7 @@ async function fetchPlanIssue(jira, key, signal) {
3086
3157
  parentSummary: String(fields.parent?.fields?.summary ?? '').trim(),
3087
3158
  hasDescription: hasPlanDescription(fields.description),
3088
3159
  links: Array.isArray(fields.issuelinks) ? fields.issuelinks.length : 0,
3089
- url: `${jira.settings.baseUrl}/browse/${body?.key ?? key}`,
3160
+ url: `${jira.site()}/browse/${body?.key ?? key}`,
3090
3161
  };
3091
3162
  }
3092
3163
 
@@ -3528,7 +3599,7 @@ function transitionTool(jira, settings) {
3528
3599
  return [
3529
3600
  t('transition.updated', { key }),
3530
3601
  t('transition.updatedLine', { from: info.current || '—', to: result.status, id: match.id, name: match.name }),
3531
- `- ${jira.settings.baseUrl}/browse/${key}`,
3602
+ `- ${jira.site()}/browse/${key}`,
3532
3603
  ].join('\n');
3533
3604
  },
3534
3605
  };
@@ -3684,7 +3755,7 @@ function renderWorkList(issues, jql, scope, jira, limitHit) {
3684
3755
  t('list.header', { scope: scopeLabel(scope), count: issues.length }),
3685
3756
  '',
3686
3757
  t('list.meta', {
3687
- baseUrl: settings.baseUrl,
3758
+ baseUrl: baseUrlOf(settings),
3688
3759
  project: projectSummary(issues, settings.projectKey),
3689
3760
  account: liveSetting(settings, 'email', '') || t('list.accountMissing'),
3690
3761
  }),
@@ -3981,7 +4052,7 @@ function buildItemJson(issue, jira, ranks) {
3981
4052
  sprintState: typeof sprint?.state === 'string' ? sprint.state : '',
3982
4053
  sprintStart: typeof sprint?.startDate === 'string' ? sprint.startDate.slice(0, 10) : '',
3983
4054
  sprintEnd: typeof sprint?.endDate === 'string' ? sprint.endDate.slice(0, 10) : '',
3984
- url: key ? `${jira.settings.baseUrl}/browse/${key}` : jira.settings.baseUrl,
4055
+ url: key ? `${jira.site()}/browse/${key}` : jira.site(),
3985
4056
  };
3986
4057
  }
3987
4058
 
@@ -4027,7 +4098,7 @@ function renderIssue(issue, options) {
4027
4098
  if (typeof fields.updated === 'string') meta.push(t('issue.meta.updated', { value: fields.updated.replace('T', ' ').slice(0, 16) }));
4028
4099
 
4029
4100
  if (meta.length) lines.push('', meta.join(' · '));
4030
- if (issue?.key) lines.push('', t('issue.link', { url: `${options.settings.baseUrl}/browse/${issue.key}` }));
4101
+ if (issue?.key) lines.push('', t('issue.link', { url: `${baseUrlOf(options.settings)}/browse/${issue.key}` }));
4031
4102
 
4032
4103
  lines.push('', t('issue.descriptionHeader'), '', adfToText(fields.description).trim() || t('issue.noDescription'));
4033
4104
 
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.4",
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,74 @@ 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
+ }
694
+ // 站点地址与令牌一起提交:同一张表单里填的地址要跟着「保存并验证」一起落盘,
695
+ // 否则用户只点那个按钮时地址根本没保存,列表还是 no_base_url。
696
+ {
697
+ const beforeWrites = settingsWrites.length;
698
+ const beforeCalls = myselfCalls.length;
699
+ const response = await credentialFetch(CRED_PATH, {
700
+ method: 'POST',
701
+ headers: { 'content-type': 'application/json' },
702
+ body: JSON.stringify({ token: GOOD, email: 'someone@example.com', baseUrl: 'https://saved-with-token.atlassian.net/' }),
703
+ });
704
+ const body = await response.json().catch(() => ({}));
705
+ const write = settingsWrites[settingsWrites.length - 1];
706
+ const baseOp = write?.ops?.find((op) => op.path[0] === 'baseUrl');
707
+ const probe = myselfCalls[myselfCalls.length - 1];
708
+ const okSave = body.ok === true && body.baseUrlSaved === true && body.baseUrl === 'https://saved-with-token.atlassian.net';
709
+ const okWrite = settingsWrites.length > beforeWrites && baseOp?.value === 'https://saved-with-token.atlassian.net';
710
+ const okProbe = myselfCalls.length > beforeCalls && String(probe?.url ?? '').startsWith('https://saved-with-token.atlassian.net/rest/api/3/myself');
711
+ console.log('\n令牌 + 站点地址一次保存: ok:', body.ok === true, '| baseUrlSaved:', body.baseUrlSaved, '| baseUrl:', body.baseUrl);
712
+ console.log(' profile patch 写入:', okWrite, '| /myself 用新地址验证:', okProbe, '(', probe?.url, ')');
713
+ if (!okSave || !okWrite || !okProbe) process.exitCode = 1;
714
+
715
+ const beforeBad = settingsWrites.length;
716
+ const bad = await credentialFetch(CRED_PATH, {
717
+ method: 'POST',
718
+ headers: { 'content-type': 'application/json' },
719
+ body: JSON.stringify({ token: GOOD, email: 'someone@example.com', baseUrl: 'not a url' }),
720
+ });
721
+ const badBody = await bad.json().catch(() => ({}));
722
+ console.log(' 非法站点地址一起提交 → 被拒:', badBody.ok === false, '| 未写入:', settingsWrites.length === beforeBad,
723
+ '| 文案:', badBody.error);
724
+ if (badBody.ok !== false || settingsWrites.length !== beforeBad) process.exitCode = 1;
725
+
726
+ // 还原:后面的用例还要用配置里的站点地址。
727
+ await settingsFetch(SETTINGS_PATH, {
728
+ method: 'POST',
729
+ headers: { 'content-type': 'application/json' },
730
+ body: JSON.stringify({ baseUrl: env.JIRA_BASE_URL }),
731
+ });
732
+ }
665
733
  // 界面语言:三个 chip(自动 / 中文 / English),点了立刻写进 profile 的 Cordis patch
666
734
  // 迷你 React 不保留 key,所以按「文本是三种语言名之一」来找(配置页里不会同时出现状态下拉的 chip)
667
735
  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();