dsh-requirement-dev-workbench 4.5.11 → 4.5.12

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
@@ -5,22 +5,20 @@ AI Native 工作台(包名 `dsh-requirement-dev-workbench`)的版本变更
5
5
 
6
6
  ---
7
7
 
8
- ## v4.5.11 — 2026-11-20
8
+ ## v4.5.12 — 2026-11-20
9
9
 
10
- - **模块工作区真的决定读哪张表**:以前只改了目录,表还停在当前项目上;现在模块没贴链接时,会去它自己的目录里找需求源。
11
- - **目录里没配需求源时说清楚**:不再笼统报「项目里没配」,而是告诉你「这个模块的工作区是 X,那里没有配需求源」,并提示可以点 🔗 直接贴链接。
10
+ - **「AI 直接创建」失败会明说,不再像点了没反应**:以前落盘目录解析不到时,模型其实已经把角色写完了,界面却只改了一行小字;现在红色提示写清原因,并把 AI 写好的草稿摆出来可复制。
11
+ - **通用专家现在找得到家**:宿主通常不注入 DSH_HOME,只给 profile 目录,工作台按它反推;顺手把 `agents` 同级的 `skills` 建好,写完立刻能在专家库里扫到。
12
+ - **关联记录 / 查找引用字段显示名字**:详情里不再出现 `{"id":"rec..."}`,显示的是被引用的那条记录的名字。
12
13
 
13
- ## v4.5.10 — 2026-11-19
14
+ ## v4.5.11 — 2026-11-20
14
15
 
15
- - **每个模块的工作区真正各自独立**:左栏模块名旁新增 📁,改的是这个模块自己的项目目录,别的模块一点不动;留空才跟随当前项目。
16
+ - **模块工作区真正决定读哪张表**:以前只改了目录,表还停在当前项目上;现在模块没贴链接时,会去它自己的目录里找需求源。
17
+ - **目录里没配需求源时说清楚**:不再笼统报「项目里没配」,而是告诉你「这个模块的工作区是 X,那里没有配需求源」,并提示可以点 🔗 直接贴链接。
18
+ - **每个模块的工作区各自独立**:左栏模块名旁新增 📁,改的是这个模块自己的项目目录,别的模块一点不动;留空才跟随当前项目。
16
19
  - **页头的目录按钮改成「只改这个模块」**:以前点它写的是全局项目设置,一改所有模块跟着换;现在只改当前模块,并顺带弹出这个模块的工作区对话框。
17
20
  - **开发指令和执行记录跟着模块自己的目录走**:指令里的「工作目录」、执行记录里的项目目录,都取当前模块的工作区。
18
-
19
- ## v4.5.9 — 2026-11-19
20
-
21
- - **「开发需求」模板在列名不一样的表上也能用了**:以前模板只认真叫「需求标题 / 负责人 / 期望完成时间」的列,换成叫「页面 / 开发顾问 / 开发|配置计划结束时间」的表就只剩状态和优先级两列;现在按别名自动认,照样给齐标题 / 状态 / 优先级 / 负责人 / 期望完成时间。
22
- - **认不到的列直接跳过,不再摊空列**:表里确实没有的列不会硬塞,之后在「设置」里手动补一列即可。
23
- - **「开发任务」模板同样按别名认列**(任务标题 / 负责人 / 预估工时 / 任务类型)。
21
+ - **「开发需求 / 开发任务」模板在列名不一样的表上也能用**:按别名自动认页面 / 开发顾问 / 计划结束时间这类列名,认不到的列直接跳过,不再摊空列。
24
22
 
25
23
  ## v4.5.8 — 2026-11-19
26
24
 
package/dsh/index.js CHANGED
@@ -14,7 +14,7 @@ import { createHash } from 'node:crypto'
14
14
  import { existsSync, readFileSync } from 'node:fs'
15
15
  import { homedir, tmpdir } from 'node:os'
16
16
  import { readFile, mkdir, readdir, rm, stat, writeFile, appendFile } from 'node:fs/promises'
17
- import { dirname, join, relative, resolve, sep } from 'node:path'
17
+ import { basename, dirname, join, relative, resolve, sep } from 'node:path'
18
18
  import { fileURLToPath } from 'node:url'
19
19
  import Schema from '@deepseek-ai/schemastery'
20
20
 
@@ -659,17 +659,21 @@ export async function findTable(config, settings, key, view = null) {
659
659
  // 没配链接、且(目录不同 或 传的是自己的模块 key)时才去模块自己的目录里找表。
660
660
  const byModuleKey = `module:${module.key}` === wanted || module.key === wanted
661
661
  if (ownDir && (byModuleKey || ownDir !== currentDir) && !module.source) {
662
- const scoped = await listTables(config, { ...settings, projectDir: ownDir }, view)
663
- if (scoped.tables.length) {
664
- // 只在「这个目录里确实有一张和这个模块对得上的表」时才换过去:
665
- // 拿别人的表顶上,会让模块静默显示别的项目的需求。
666
- const own = scoped.tables.find((table) => table.key === wanted) ??
667
- scoped.tables.find((table) => table.sourceName === wanted) ??
668
- scoped.tables.find((table) => table.tableId === wanted) ??
669
- (scoped.tables.length === 1 ? scoped.tables[0] : null)
670
- if (own) return { table: own, tables: scoped.tables, module, requirementConfig: scoped.requirementConfig, taskConfig: scoped.taskConfig }
671
- }
662
+ const scoped = await listTables(config, { ...settings, projectDir: ownDir }, view)
663
+ if (scoped.tables.length) {
664
+ // 匹配顺序:模块 key / 源名 / 表 id 都对不上时,再看这个目录是不是正好一个需求源
665
+ // (「每个项目一个需求表」是最常见的情况)。目录里有多张又对不上,就不猜 ——
666
+ // 拿别人的表顶上会让模块静默显示别的项目的需求。
667
+ const own = scoped.tables.find((table) => table.key === wanted) ??
668
+ scoped.tables.find((table) => table.sourceName === wanted) ??
669
+ scoped.tables.find((table) => table.tableId === wanted) ??
670
+ (scoped.tables.filter((table) => table.kind === 'requirement').length === 1
671
+ ? scoped.tables.find((table) => table.kind === 'requirement')
672
+ : null) ??
673
+ (scoped.tables.length === 1 ? scoped.tables[0] : null)
674
+ if (own) return { table: own, tables: scoped.tables, module, requirementConfig: scoped.requirementConfig, taskConfig: scoped.taskConfig }
672
675
  }
676
+ }
673
677
  }
674
678
  return { table: wanted ? found ?? null : tables[0] ?? null, tables, module, requirementConfig, taskConfig }
675
679
  }
@@ -1010,8 +1014,13 @@ function toPlain(value) {
1010
1014
  if (typeof value === 'number' || typeof value === 'boolean') return String(value)
1011
1015
  if (Array.isArray(value)) return value.map(toPlain).filter(Boolean).join('、')
1012
1016
  if (typeof value === 'object') {
1013
- for (const key of ['text', 'name', 'value', 'link', 'en_name']) {
1014
- if (key in value) return toPlain(value[key])
1017
+ // 关联记录 / 查找引用:lark-cli 给的是 { id, display_name }(或 { record_id, text }),
1018
+ // 以前只认 text/name,认不到就 JSON.stringify,界面于是显示成 {"id":"rec..."}。
1019
+ for (const key of ['text', 'name', 'display_name', 'displayName', 'en_name', 'value', 'link', 'title', 'record_id']) {
1020
+ if (key in value) {
1021
+ const got = toPlain(value[key])
1022
+ if (got) return got
1023
+ }
1015
1024
  }
1016
1025
  if ('file_token' in value) return '[附件]'
1017
1026
  try {
@@ -1645,8 +1654,8 @@ async function collectSkillsInRoot(root, items) {
1645
1654
  }
1646
1655
 
1647
1656
  /** DeepSeek Harness 通用技能根(跨项目可用);没有就返回空。 */
1648
- function harnessSkillDir() {
1649
- const dshHome = process.env.DSH_HOME
1657
+ function harnessSkillDir(settings = null) {
1658
+ const dshHome = dshHomeDir(settings)
1650
1659
  return dshHome ? join(dshHome, 'skills') : ''
1651
1660
  }
1652
1661
 
@@ -1690,7 +1699,7 @@ async function createSkill(config, settings, body) {
1690
1699
  if (!projectDir) return { ok: false, error: '还没选项目目录,先选一个再创建项目内技能' }
1691
1700
  dir = join(projectDir, '.claude', 'skills', name)
1692
1701
  } else {
1693
- const root = harnessSkillDir()
1702
+ const root = harnessSkillDir(settings)
1694
1703
  if (!root) return { ok: false, error: '取不到 DSH_HOME,定位不到 DeepSeek Harness 技能目录' }
1695
1704
  dir = join(root, name)
1696
1705
  }
@@ -1745,8 +1754,12 @@ const SKILL_CONVENTIONS = [
1745
1754
  ]
1746
1755
 
1747
1756
  /** 用户级(全局)技能目录:环境变量可以改根,和 DSH 技能管理器保持一致。 */
1757
+ /** 当前这次列表调用所属的设置(只用于环境隔离,如测试把家目录指向临时目录)。 */
1758
+ let settingsHomeDir = ''
1759
+
1748
1760
  function globalSkillDirs() {
1749
- const home = process.env.USERPROFILE || process.env.HOME || ''
1761
+ // 测试或多套 Harness 并存时,用工作台设置把「用户家目录」换掉,避免写到真机目录
1762
+ const home = process.env.USERPROFILE || process.env.HOME || settingsHomeDir || ''
1750
1763
  if (!home) return []
1751
1764
  const pick = (envName, fallback) => process.env[envName] || join(home, fallback)
1752
1765
  return [
@@ -1762,6 +1775,7 @@ function globalSkillDirs() {
1762
1775
  }
1763
1776
 
1764
1777
  function skillRootsFor(config, settings) {
1778
+ settingsHomeDir = String(settings?.homeDir ?? '')
1765
1779
  const roots = []
1766
1780
  const push = (scope, convention, label, path, note = '') => {
1767
1781
  if (!path) return
@@ -1770,7 +1784,7 @@ function skillRootsFor(config, settings) {
1770
1784
  roots.push({ scope, convention, label, path, note, exists: existsSync(path) })
1771
1785
  }
1772
1786
  // 1) DeepSeek Harness 自己的技能根:跨项目通用,也是「新建技能」默认写入的位置
1773
- const harness = harnessSkillDir()
1787
+ const harness = harnessSkillDir(settings)
1774
1788
  if (harness) push('harness', '', 'DeepSeek Harness · 通用技能', harness, 'DSH 全局技能根,任何项目都能用')
1775
1789
  // 2) 全局(用户级)约定目录
1776
1790
  for (const entry of globalSkillDirs()) push('global', entry.convention, entry.label, entry.path)
@@ -1816,7 +1830,7 @@ async function listSkills(config, settings) {
1816
1830
  items,
1817
1831
  docs,
1818
1832
  projectDir: settings.projectDir,
1819
- harnessSkillDir: harnessSkillDir(),
1833
+ harnessSkillDir: harnessSkillDir(settings),
1820
1834
  summary: Object.values(summary),
1821
1835
  }
1822
1836
  }
@@ -1838,6 +1852,26 @@ async function readSkillFile(config, settings, target) {
1838
1852
 
1839
1853
  /* -------------------------------------------- 专家 / 专家团(参考 WorkBuddy) */
1840
1854
 
1855
+ /**
1856
+ * DSH_HOME 落在哪:宿主进程通常不注入这个环境变量,但一定会注入 DSH_PROFILE_DIR
1857
+ * (用户级 profile 目录,通常就是 <DSH_HOME>/profiles/<name>)。
1858
+ * 这里按这个关系反推,避免「AI 直接创建」完稿了却写不进盘。
1859
+ */
1860
+ function dshHomeDir(settings = null) {
1861
+ const explicit = String(process.env.DSH_HOME ?? '').trim()
1862
+ if (explicit) return explicit
1863
+ const profileDir = String(process.env.DSH_PROFILE_DIR ?? '').trim()
1864
+ if (profileDir) {
1865
+ const parent = dirname(profileDir)
1866
+ if (basename(parent) === 'profiles') return dirname(parent)
1867
+ }
1868
+ // 工作台设置里的 dshHome 优先(测试、或多套 Harness 并存时靠它指路)
1869
+ const configured = String(settings?.dshHome ?? '').trim()
1870
+ if (configured) return configured
1871
+ const home = String(process.env.USERPROFILE || process.env.HOME || settingsHomeDir || '').trim()
1872
+ return home ? join(home, '.dsh') : ''
1873
+ }
1874
+
1841
1875
  /** 专家文件放哪:通用 = DSH_HOME/agents;项目 = <项目>/<约定>/agents(默认 .claude)。 */
1842
1876
  function expertDirFor(scope, convention, settings) {
1843
1877
  if (scope === 'project') {
@@ -1846,7 +1880,8 @@ function expertDirFor(scope, convention, settings) {
1846
1880
  const safe = SKILL_CONVENTIONS.some((entry) => entry.dir && entry.dir === convention) ? convention : '.claude'
1847
1881
  return join(projectDir, safe, 'agents')
1848
1882
  }
1849
- return process.env.DSH_HOME ? join(process.env.DSH_HOME, 'agents') : ''
1883
+ const home = dshHomeDir(settings)
1884
+ return home ? join(home, 'agents') : ''
1850
1885
  }
1851
1886
 
1852
1887
  function expertTargets(config, settings) {
@@ -1860,7 +1895,8 @@ function expertTargets(config, settings) {
1860
1895
  function teamFiles(config, settings) {
1861
1896
  const projectDir = String(settings.projectDir ?? '').trim()
1862
1897
  const list = []
1863
- if (process.env.DSH_HOME) list.push({ scope: 'harness', path: join(process.env.DSH_HOME, 'experts', 'teams.json'), label: 'DeepSeek Harness 通用专家团' })
1898
+ const dshHome = dshHomeDir(settings)
1899
+ if (dshHome) list.push({ scope: 'harness', path: join(dshHome, 'experts', 'teams.json'), label: 'DeepSeek Harness 通用专家团' })
1864
1900
  if (projectDir) list.push({ scope: 'project', path: join(projectDir, '.dsh', 'experts', 'teams.json'), label: '当前项目专家团' })
1865
1901
  return list
1866
1902
  }
@@ -1962,6 +1998,12 @@ async function createExpert(config, settings, body) {
1962
1998
  const scope = body?.scope === 'project' ? 'project' : 'harness'
1963
1999
  const dir = expertDirFor(scope, String(body?.convention || '.claude'), settings)
1964
2000
  if (!dir) return { ok: false, error: scope === 'project' ? '还没选项目目录,选一个再创建项目专家' : '取不到 DSH_HOME,定位不到通用专家目录' }
2001
+ // 兜底:通用专家写进 <DSH_HOME>/agents,但工作台是从「同级 skills 目录」反推专家目录的。
2002
+ // DSH_HOME 下没有 skills 时,写完会扫不到、界面看着像「没创建」——这里顺手建一个空目录。
2003
+ if (scope === 'harness') {
2004
+ const skillsDir = join(dirname(dir), 'skills')
2005
+ if (!existsSync(skillsDir)) await mkdir(skillsDir, { recursive: true }).catch(() => {})
2006
+ }
1965
2007
  const convention = scope === 'project' ? String(body?.convention || '.claude') : ''
1966
2008
  const file = join(dir, `${id}.md`)
1967
2009
  if (existsSync(file) && !body?.overwrite) return { ok: false, error: `专家「${id}」已存在,换个标识或先删掉它`, path: file, exists: true }
package/lib/client.js CHANGED
@@ -13,7 +13,7 @@ window.__ModuleLoader__.load({
13
13
  const { useCallback, useEffect, useMemo, useRef, useState } = React
14
14
 
15
15
  const API = '/api/requirement-dev-workbench'
16
- const WORKBENCH_VERSION = '4.5.11'
16
+ const WORKBENCH_VERSION = '4.5.12'
17
17
  const STYLE_ID = 'rdw-business-panel-styles'
18
18
 
19
19
  const CSS = `
@@ -3139,6 +3139,9 @@ window.__ModuleLoader__.load({
3139
3139
  const [aiPrompt, setAiPrompt] = useState('')
3140
3140
  const [aiBusy, setAiBusy] = useState(false)
3141
3141
  const [aiResult, setAiResult] = useState(null)
3142
+ // 失败要说清楚(ChatGPT 说的「点了没反应」多半是这里只改小字提示)
3143
+ const [aiNoteTone, setAiNoteTone] = useState('')
3144
+ const [aiFailure, setAiFailure] = useState(null)
3142
3145
  const settings = state?.settings ?? {}
3143
3146
  const live = expertData ?? data
3144
3147
 
@@ -3185,6 +3188,8 @@ window.__ModuleLoader__.load({
3185
3188
  /** 打开「交给 AI 完善」面板(专家/专家团)。 */
3186
3189
  const openAi = (kind) => {
3187
3190
  setAiNote('')
3191
+ setAiNoteTone('')
3192
+ setAiFailure(null)
3188
3193
  setAiPrompt('')
3189
3194
  setAiResult(null)
3190
3195
  setToast('')
@@ -3207,11 +3212,13 @@ window.__ModuleLoader__.load({
3207
3212
  const description = String(aiDraft.description ?? '').trim()
3208
3213
  if (!description) {
3209
3214
  setAiNote('先用一句话说清你要谁(比如「一个盯支付对账的后端专家」),剩下的 AI 补齐。')
3215
+ setAiNoteTone('error')
3210
3216
  return
3211
3217
  }
3212
3218
  setAiBusy(true)
3213
3219
  setAiResult(null)
3214
3220
  setAiNote('AI 正在按专业流程完善…(这个页面会直接出结果,不用管右侧对话)')
3221
+ setAiNoteTone('')
3215
3222
  try {
3216
3223
  const result = await api('/ai/create', {
3217
3224
  method: 'POST',
@@ -3225,9 +3232,16 @@ window.__ModuleLoader__.load({
3225
3232
  })
3226
3233
  setAiResult(result)
3227
3234
  setAiNote(`✓ 已创建:${result.name || result.id}`)
3235
+ setAiNoteTone('ok')
3228
3236
  if (refresh) await refresh()
3229
3237
  } catch (error) {
3230
- setAiNote(`页面里直接创建没成功:${error.message}。可以用右边「发到对话里做」,或「我自己填(高级)」。`)
3238
+ // 失败一定要看得出来:以前这条只改了小字提示,AI 明明写出了完整草稿却因为落盘目录
3239
+ // 解析不到而失败时,界面看上去像「点了没反应」。
3240
+ const message = String(error?.message ?? error)
3241
+ const detail = error?.payload ?? null
3242
+ setAiNote(`没创建成功:${message}`)
3243
+ setAiNoteTone('error')
3244
+ setAiFailure({ message, detail })
3231
3245
  } finally {
3232
3246
  setAiBusy(false)
3233
3247
  }
@@ -3402,7 +3416,31 @@ window.__ModuleLoader__.load({
3402
3416
  h('button', { className: 'rdw-btn', onClick: () => setAiTab('') }, '取消'),
3403
3417
  ),
3404
3418
  h('div', { className: 'rdw-note', style: { marginTop: 4 } }, '「AI 直接创建」在这个页面里就完成(工作台自己调模型并落盘),不需要去外面复制任何提示词。'),
3405
- aiNote ? h('div', { className: 'rdw-note', style: { marginTop: 8 } }, aiNote) : null,
3419
+ aiNote
3420
+ ? h(
3421
+ 'div',
3422
+ {
3423
+ className: 'rdw-note',
3424
+ style: {
3425
+ marginTop: 8,
3426
+ ...(aiNoteTone === 'error'
3427
+ ? { color: '#ff8a80', border: '1px solid rgba(255,110,100,.45)', borderRadius: 8, padding: '8px 10px', background: 'rgba(255,110,100,.08)' }
3428
+ : aiNoteTone === 'ok'
3429
+ ? { color: '#7ee2a8' }
3430
+ : {}),
3431
+ },
3432
+ },
3433
+ aiNote,
3434
+ )
3435
+ : null,
3436
+ aiFailure?.detail
3437
+ ? h(
3438
+ 'div',
3439
+ { className: 'rdw-card', style: { marginTop: 8, borderColor: 'rgba(255,110,100,.35)' } },
3440
+ h('div', { className: 'rdw-note' }, '模型已经把角色写出来了,只是没落盘。原文如下,可复制到「我自己填(高级)」里用:'),
3441
+ h('pre', { className: 'rdw-pre', style: { maxHeight: 220, overflow: 'auto' } }, String(aiFailure.detail.draft ? JSON.stringify(aiFailure.detail.draft, null, 2) : aiFailure.detail.raw ?? '')),
3442
+ )
3443
+ : null,
3406
3444
  aiResult
3407
3445
  ? h(
3408
3446
  'div',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-requirement-dev-workbench",
3
- "version": "4.5.11",
3
+ "version": "4.5.12",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "AI Native 工作台:把「拿任务 → 开发 → 验收」串成一条流水线。跨多张飞书多维表格看开发任务与进度,拉取飞书文档信息,用专家/专家团跑完整流程(需求分析 → 代码开发 → 代码评审 → QA 测试),选中本地项目后一键生成开发指令,并可浏览项目/全局 skill 与开发规范。模块可扩展。",