dsh-vscode-mode 0.38.0 → 0.40.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +38 -33
- package/lib/client.js +87 -68
- package/lib/client.js.map +1 -1
- package/lib/index.js +11406 -4920
- package/lib/index.js.map +1 -1
- package/package.json +3 -2
- package/skills/dsh-vscodemode-html-plan/SKILL.md +44 -42
- package/skills/dsh-vscodemode-test-check/SKILL.md +82 -0
- package/src/archiveDb.ts +24 -0
- package/src/attachmentBytes.ts +84 -0
- package/src/client/htmlPlan/HtmlPlanModeChip.ts +181 -0
- package/src/client/htmlPlan/HtmlPlanPanel.ts +230 -61
- package/src/client/htmlPlan/planActions.ts +38 -8
- package/src/client/htmlPlan/planPage.ts +111 -9
- package/src/client/index.ts +9 -0
- package/src/client/openReceipt.ts +5 -2
- package/src/client/planBridge.ts +27 -2
- package/src/client/planState.ts +51 -4
- package/src/client/sidebar/panels/TestCheckPanel.ts +485 -0
- package/src/client/sidebar/panels/useTestCheckData.ts +414 -0
- package/src/client/sidebar/types.ts +2 -0
- package/src/client/state/diffSummary.ts +3 -0
- package/src/client/styles/editor.css +91 -0
- package/src/client/testCheck/TestCheckChip.ts +181 -0
- package/src/client/testCheck/TestCheckPanel.ts +339 -0
- package/src/client/testCheckPanelState.ts +173 -0
- package/src/client/ui/EditorView.ts +77 -7
- package/src/client/ui/McpSettings.ts +2 -2
- package/src/client/ui/OfficialReview.ts +6 -4
- package/src/htmlPlanAttachments.ts +4 -1
- package/src/htmlPlanCommand.ts +87 -235
- package/src/htmlPlanGuidance.ts +67 -0
- package/src/htmlPlanMode.ts +547 -0
- package/src/index.ts +28 -55
- package/src/officialCapture.ts +58 -9
- package/src/pending/externalCapture.ts +195 -401
- package/src/pending/kernel.ts +24 -1
- package/src/pending/persist.ts +109 -22
- package/src/pending/provenance.ts +5 -28
- package/src/pending/store.ts +109 -100
- package/src/pending/tracking.ts +81 -0
- package/src/pendingCompat.ts +26 -1
- package/src/pendingRpc.ts +8 -56
- package/src/planAutoPage.ts +306 -0
- package/src/planPagePack.ts +148 -0
- package/src/registry.ts +7 -2
- package/src/reviewDb.ts +1 -1
- package/src/reviewRpc.ts +14 -6
- package/src/rpc.ts +34 -0
- package/src/shared/htmlPlanMode.ts +26 -0
- package/src/shared/pendingReview.ts +15 -7
- package/src/shared/review.ts +5 -0
- package/src/shared/rpc.ts +53 -7
- package/src/shared/testCheck.ts +759 -0
- package/src/shared/testCheckHtml.ts +276 -0
- package/src/shared/testCheckPolicyDefault.ts +37 -0
- package/src/shared/testCheckSnippets.ts +197 -0
- package/src/store.ts +17 -1
- package/src/testCheckCommand.ts +287 -0
- package/src/testCheckGuidance.ts +79 -0
- package/src/testCheckMode.ts +654 -0
- package/src/testCheckPolicy.ts +141 -0
- package/src/testCheckRpc.ts +196 -0
- package/src/testCheckStore.ts +822 -0
- package/src/pending/externalAlign.ts +0 -297
- package/src/pending/vcs.ts +0 -584
|
@@ -45,6 +45,7 @@ import { clampZoom, clearZoomMem, dataUrlOf, isImagePath, isSvgPath, recallZoom,
|
|
|
45
45
|
import { isMarkdownPath } from '../markdownPreview.js'
|
|
46
46
|
import { hasOfficialHtmlPreview, isHtmlPath } from '../htmlPreview.js'
|
|
47
47
|
import { HtmlPlanPanel } from '../htmlPlan/HtmlPlanPanel.js'
|
|
48
|
+
import { TestCheckPanel } from '../testCheck/TestCheckPanel.js'
|
|
48
49
|
import { isExcelPath } from '../excel/model.js'
|
|
49
50
|
import { isUniverPath, isOfficePath } from '../../shared/univer.js'
|
|
50
51
|
import { routesUniver } from '../univer/routing.js'
|
|
@@ -301,10 +302,18 @@ export function EditorView(props) {
|
|
|
301
302
|
const planHostRef = React.useRef(null)
|
|
302
303
|
// 进入只读计划预览前的磁盘选中页签,关闭该计划页签时恢复,避免跳到第一个页签。
|
|
303
304
|
const planReturnRef = React.useRef(null)
|
|
304
|
-
|
|
305
|
+
// 测试验收单:与计划页签同一套虚拟页签轨道(只存内存,不落磁盘、不进保存/差异/LSP 流程)。
|
|
306
|
+
const [sheetTabs, setSheetTabs] = React.useState([])
|
|
307
|
+
const [sheetActive, setSheetActive] = React.useState(null)
|
|
308
|
+
const sheetActiveRef = React.useRef(null)
|
|
309
|
+
sheetActiveRef.current = sheetActive
|
|
310
|
+
const sheetHostRef = React.useRef(null)
|
|
311
|
+
const sheetReturnRef = React.useRef(null)
|
|
312
|
+
React.useEffect(() => { setPlanTabs([]); setPlanActive(null); setSheetTabs([]); setSheetActive(null) }, [sessionId, cwd])
|
|
305
313
|
/** @private @author ddj 2026年10月08号 @param path Disk tab selection. Leave read-only plan mode before any disk navigation. */
|
|
306
314
|
function setActive(path) {
|
|
307
315
|
setPlanActive(null)
|
|
316
|
+
setSheetActive(null)
|
|
308
317
|
setDiskActive(path)
|
|
309
318
|
setWorkbench((current) => syncTabs(current, tabsRef.current, path))
|
|
310
319
|
}
|
|
@@ -4269,6 +4278,7 @@ export function EditorView(props) {
|
|
|
4269
4278
|
|
|
4270
4279
|
/** 关闭当前活动页签(Ctrl+F4 与菜单动作共用;无页签时提示)。 */
|
|
4271
4280
|
const closeActiveTab = () => {
|
|
4281
|
+
if (sheetActiveRef.current) { closeSheet(sheetActiveRef.current); return }
|
|
4272
4282
|
if (planActiveRef.current) { closePlan(planActiveRef.current); return }
|
|
4273
4283
|
if (!activeRef.current) { setStatus('无打开的文件'); return }
|
|
4274
4284
|
closeTab(activeRef.current)
|
|
@@ -4466,8 +4476,32 @@ export function EditorView(props) {
|
|
|
4466
4476
|
planReturnRef.current = null
|
|
4467
4477
|
setActive(tabsRef.current.some((tab) => tab.path === previous) ? previous : (tabsRef.current[0]?.path ?? null))
|
|
4468
4478
|
}
|
|
4479
|
+
/** @private @author ddj 2026年11月25号 @param sheet 验收单身份。打开只读虚拟页签,不碰磁盘/保存/LSP。 */
|
|
4480
|
+
function openSheetDoc(sheet) {
|
|
4481
|
+
const id = typeof sheet?.id === 'string' ? sheet.id.trim() : ''
|
|
4482
|
+
if (!id) return
|
|
4483
|
+
flushSave()
|
|
4484
|
+
saveViewState(active)
|
|
4485
|
+
if (!sheetActiveRef.current) sheetReturnRef.current = active
|
|
4486
|
+
setDiskActive(null)
|
|
4487
|
+
const title = typeof sheet?.title === 'string' && sheet.title ? sheet.title : '验收单 · ' + id
|
|
4488
|
+
setSheetTabs((prev) => [...prev.filter((item) => item.id !== id), { id, title }].slice(-8))
|
|
4489
|
+
setSheetActive(id)
|
|
4490
|
+
setError(null)
|
|
4491
|
+
setStatus('验收单 · 数据自动刷新')
|
|
4492
|
+
}
|
|
4493
|
+
/** @private @author ddj 2026年11月25号 @param id 验收单 id。 @param event 可选的关闭点击。只移除内存页签。 */
|
|
4494
|
+
function closeSheet(id, event) {
|
|
4495
|
+
event?.stopPropagation()
|
|
4496
|
+
setSheetTabs((prev) => prev.filter((item) => item.id !== id))
|
|
4497
|
+
if (sheetActiveRef.current !== id) return
|
|
4498
|
+
const previous = sheetReturnRef.current
|
|
4499
|
+
sheetReturnRef.current = null
|
|
4500
|
+
setActive(tabsRef.current.some((tab) => tab.path === previous) ? previous : (tabsRef.current[0]?.path ?? null))
|
|
4501
|
+
}
|
|
4469
4502
|
/** @private @author ddj 2026年10月08号 @param request Claimed disk or virtual open. Flushes saves without replacing dirty models. */
|
|
4470
4503
|
function openReceiptFile(request) {
|
|
4504
|
+
if (request.sheet) { openSheetDoc(request.sheet); return }
|
|
4471
4505
|
if (request.plan) { openPlanDoc(request.plan); return }
|
|
4472
4506
|
if (!request.path) return
|
|
4473
4507
|
let path = receiptTabPath(request.path, cwd)
|
|
@@ -4523,6 +4557,8 @@ export function EditorView(props) {
|
|
|
4523
4557
|
const host = viewRootRef.current?.querySelector('.edrv-uv-host')
|
|
4524
4558
|
return request.sessionId === sessionId && sameFile(active, request.path) && host?.getAttribute('data-univer-path') === active
|
|
4525
4559
|
}
|
|
4560
|
+
if (request.sheet) return request.sessionId === sessionId && sheetActive === request.sheet.id
|
|
4561
|
+
&& sheetHostRef.current?.getAttribute('data-sheet-id') === request.sheet.id
|
|
4526
4562
|
if (request.plan) return request.sessionId === sessionId && planActive === request.plan.address
|
|
4527
4563
|
&& planTabs.some((item) => item.address === request.plan.address && item.markdown === request.plan.markdown)
|
|
4528
4564
|
&& planHostRef.current?.getAttribute('data-plan-address') === request.plan.address
|
|
@@ -4530,6 +4566,7 @@ export function EditorView(props) {
|
|
|
4530
4566
|
}
|
|
4531
4567
|
/** @private @author ddj 2026年09月28号 @param request Claimed target. @returns Only its current load/render error. */
|
|
4532
4568
|
function receiptError(request) {
|
|
4569
|
+
if (request.sheet) return request.sheet.id ? null : '验收单 id 无效'
|
|
4533
4570
|
if (request.plan) return planDocument(request.plan.address, request.plan) ? null : '计划内容或资源地址无效'
|
|
4534
4571
|
return receiptErrorFor(request, receiptView(request))
|
|
4535
4572
|
}
|
|
@@ -4847,9 +4884,9 @@ export function EditorView(props) {
|
|
|
4847
4884
|
// 页面工具列固定在行尾(滚动区之外,横滚不带走)。焦点落在浮窗时,这一行仍留在页面分组上,
|
|
4848
4885
|
// 避免整条工具栏跟着搬进浮窗;页签缓存 ref 只认页面上的这条行。
|
|
4849
4886
|
const chrome = !floating && id === rowOwner
|
|
4850
|
-
//
|
|
4851
|
-
const hideDiskActive = Boolean(planActive) && (chrome || focused)
|
|
4852
|
-
return React.createElement(EditorPane, { key: id, group, focused, dirty: dirtyMap, suppressActive: hideDiskActive, previewActive: chrome ? planActive : undefined, tabsRef: chrome ? tabsHostRef : undefined, extras: chrome ?
|
|
4887
|
+
// 计划预览 / 验收单占用的正文只会在焦点组里;承载页签行的组同时收起磁盘选中态,保证整屏只有一条下划线。
|
|
4888
|
+
const hideDiskActive = Boolean(planActive || sheetActive) && (chrome || focused)
|
|
4889
|
+
return React.createElement(EditorPane, { key: id, group, focused, dirty: dirtyMap, suppressActive: hideDiskActive, previewActive: chrome ? (planActive ?? sheetActive) : undefined, tabsRef: chrome ? tabsHostRef : undefined, extras: chrome ? tabExtras : undefined, tools: chrome ? rowTools : undefined, onSelect: selectGroup, onClose: closeTab, onMenu: paneMenu, onDrag: dragTab, consumeClick: consumeDrag },
|
|
4853
4890
|
focused ? React.createElement('div', { className: 'edrv-full-slot', ref: mountFull }) : React.createElement(React.Fragment, null,
|
|
4854
4891
|
React.createElement(GroupPathbar, { path: group.active, onFocus: () => selectGroup(id) }),
|
|
4855
4892
|
React.createElement(PassiveEditor, { key: JSON.stringify([scope, sessionId, group.active]), path: group.active, groupId: id, mount: passiveMount })))
|
|
@@ -4870,12 +4907,27 @@ export function EditorView(props) {
|
|
|
4870
4907
|
}, React.createElement('span', { className: 'edrv-group-tab-name' }, plan.title),
|
|
4871
4908
|
React.createElement('span', { className: 'edrv-tab-x', title: '关闭', onClick: (event) => closePlan(plan.address, event) }, '×')))
|
|
4872
4909
|
: null
|
|
4910
|
+
const sheetTabExtras = sheetTabs.length
|
|
4911
|
+
? sheetTabs.map((sheet) => React.createElement('div', {
|
|
4912
|
+
key: 'sheet:' + sheet.id, className: 'edrv-tab edrv-tab-plan edrv-tab-sheet' + (sheet.id === sheetActive ? ' edrv-tab-active' : ''),
|
|
4913
|
+
title: sheet.title + '(测试验收单 · 数据自动刷新)', onClick: () => openSheetDoc(sheet),
|
|
4914
|
+
}, React.createElement('span', { className: 'edrv-group-tab-name' }, sheet.title),
|
|
4915
|
+
React.createElement('span', { className: 'edrv-tab-x', title: '关闭', onClick: (event) => closeSheet(sheet.id, event) }, '×')))
|
|
4916
|
+
: null
|
|
4917
|
+
// 计划页签与验收单页签共用同一条滚动区(EditorPane 的 extras):整块工作台仍然只有一行页签。
|
|
4918
|
+
const tabExtras = (planTabExtras || sheetTabExtras)
|
|
4919
|
+
? React.createElement(React.Fragment, null, planTabExtras, sheetTabExtras)
|
|
4920
|
+
: null
|
|
4873
4921
|
const openControl = openInput
|
|
4874
4922
|
? React.createElement('input', { className: 'edrv-path-input', autoFocus: true, placeholder: '输入工作区相对/绝对路径,回车打开', value: pathDraft, onChange: (e) => setPathDraft(e.target.value), onKeyDown: (e) => { if (e.key === 'Enter') openPath(); if (e.key === 'Escape') setOpenInput(false) } })
|
|
4875
4923
|
: React.createElement('button', { className: 'edrv-tab-add', title: '打开文件(输入路径)', onClick: () => setOpenInput(true) }, '+')
|
|
4876
4924
|
|
|
4877
4925
|
const activePlan = planTabs.find((plan) => plan.address === planActive)
|
|
4878
|
-
const
|
|
4926
|
+
const activeSheet = sheetTabs.find((sheet) => sheet.id === sheetActive)
|
|
4927
|
+
const pathBar = activeSheet ? React.createElement('div', { className: 'edrv-pathbar', title: 'test-check://' + activeSheet.id },
|
|
4928
|
+
React.createElement('span', { className: 'edrv-pb-name' }, activeSheet.title),
|
|
4929
|
+
React.createElement('span', { className: 'edrv-pb-meta' }, '测试验收单 · 结果随 events/ 自动刷新'))
|
|
4930
|
+
: activePlan ? React.createElement('div', { className: 'edrv-pathbar', title: activePlan.address },
|
|
4879
4931
|
React.createElement('span', { className: 'edrv-pb-name' }, activePlan.title),
|
|
4880
4932
|
React.createElement('span', { className: 'edrv-pb-meta' }, '计划预览 · 只读 · 审批请使用对话中的官方控件'))
|
|
4881
4933
|
: React.createElement('div', { className: 'edrv-pathbar', title: active || '' },
|
|
@@ -5082,10 +5134,24 @@ export function EditorView(props) {
|
|
|
5082
5134
|
return React.createElement('div', { className: 'edrv-mdview-stage' }, React.createElement('div', { className: 'edrv-mdview-doc' }, render))
|
|
5083
5135
|
}
|
|
5084
5136
|
|
|
5137
|
+
/** HTML 计划模式:自动页/作者页都失败时,按计划地址回落到官方 Markdown 预览。 */
|
|
5138
|
+
const [planMarkdownFallback, setPlanMarkdownFallback] = React.useState('')
|
|
5139
|
+
|
|
5085
5140
|
let body
|
|
5086
|
-
if (
|
|
5141
|
+
if (activeSheet) {
|
|
5142
|
+
body = React.createElement('div', { className: 'edrv-testcheck-host', ref: sheetHostRef, 'data-sheet-id': activeSheet.id },
|
|
5143
|
+
React.createElement(TestCheckPanel, {
|
|
5144
|
+
key: activeSheet.id,
|
|
5145
|
+
sessionId,
|
|
5146
|
+
cwd,
|
|
5147
|
+
id: activeSheet.id,
|
|
5148
|
+
title: activeSheet.title,
|
|
5149
|
+
}))
|
|
5150
|
+
} else if (activePlan) {
|
|
5151
|
+
const planPanelAllowed = Boolean(activePlan.htmlPath || activePlan.htmlPlanMode)
|
|
5152
|
+
const planFallenBack = planMarkdownFallback === activePlan.address
|
|
5087
5153
|
body = React.createElement('div', { className: 'edrv-mdview', ref: planHostRef, 'data-plan-address': activePlan.address },
|
|
5088
|
-
|
|
5154
|
+
planPanelAllowed && !planFallenBack
|
|
5089
5155
|
? React.createElement(HtmlPlanPanel, {
|
|
5090
5156
|
key: activePlan.address,
|
|
5091
5157
|
sessionId,
|
|
@@ -5093,7 +5159,9 @@ export function EditorView(props) {
|
|
|
5093
5159
|
address: activePlan.address,
|
|
5094
5160
|
title: activePlan.title,
|
|
5095
5161
|
htmlPath: activePlan.htmlPath,
|
|
5162
|
+
htmlPlanMode: activePlan.htmlPlanMode,
|
|
5096
5163
|
markdown: activePlan.markdown,
|
|
5164
|
+
onMarkdownFallback: () => setPlanMarkdownFallback(activePlan.address),
|
|
5097
5165
|
})
|
|
5098
5166
|
: planMarkdownBody(activePlan))
|
|
5099
5167
|
} else if (pageChanged === pageIdentity && largeCandidate === pageIdentity) {
|
|
@@ -5346,6 +5414,8 @@ export function EditorView(props) {
|
|
|
5346
5414
|
sessionId,
|
|
5347
5415
|
// 当前会话工作区(反应式 cwd;规则面板项目 Tab 自动匹配)
|
|
5348
5416
|
cwd: cwd ?? null,
|
|
5417
|
+
// 编辑器里正开着的验收单:测试验收面板据此认定「当前验收项」
|
|
5418
|
+
testCheckId: activeSheet?.id,
|
|
5349
5419
|
// 状态作用域键(工作区优先,无 cwd 回退会话;面板持久化统一走它)
|
|
5350
5420
|
scope,
|
|
5351
5421
|
openFile: (p) => openFile(p, false),
|
|
@@ -374,13 +374,13 @@ function GeneralSettings({ registry, getShortcuts }) {
|
|
|
374
374
|
React.createElement('section', { className: 'vsm-panel' },
|
|
375
375
|
React.createElement('h3', { className: 'vsm-panel-title' }, '改动捕获'),
|
|
376
376
|
React.createElement('div', { className: 'vsm-panel-body' },
|
|
377
|
-
React.createElement(SettingRow, { label: '
|
|
377
|
+
React.createElement(SettingRow, { label: '实时跟随', description: '只跟随 AI 文件工具动过的文件:AI 一改就开窗,窗口内的保存与脚本改动都并进同一条差异;没被 AI 动过的文件不产生记录。' },
|
|
378
378
|
React.createElement('input', {
|
|
379
379
|
type: 'checkbox', checked: extWatchOn,
|
|
380
380
|
disabled: loading || unavailable || notReady || busy || snapshot?.writable === false,
|
|
381
381
|
onChange: (event) => saveToggle('externalWatch', event.target.checked, setExtWatchOn),
|
|
382
382
|
})),
|
|
383
|
-
React.createElement(SettingRow, { label: '
|
|
383
|
+
React.createElement(SettingRow, { label: '定期校准', description: '启动时与每 10 分钟把开窗文件与磁盘对齐一次,补齐漏掉的监听事件;关闭后仍可手动校准。' },
|
|
384
384
|
React.createElement('input', {
|
|
385
385
|
type: 'checkbox', checked: extScanOn,
|
|
386
386
|
disabled: loading || unavailable || notReady || busy || snapshot?.writable === false,
|
|
@@ -40,14 +40,16 @@ export function ReviewLedger(props: { sessionId: string; first: ReviewPage | nul
|
|
|
40
40
|
else setError(result.error)
|
|
41
41
|
} catch (cause) { if (!controller.signal.aborted) setError(String(cause)) }
|
|
42
42
|
}
|
|
43
|
-
/** @private @author ddj 2026年11月
|
|
43
|
+
/** @private @author ddj 2026年11月25号 @description 手动校准:把已开窗的文件与磁盘对齐一次,补齐漏掉的改动。 */
|
|
44
44
|
async function align(): Promise<void> {
|
|
45
45
|
if (aligning) return
|
|
46
46
|
setAligning(true)
|
|
47
47
|
try {
|
|
48
48
|
const result = await rpc('edrv.pending.align', { sessionId: props.sessionId })
|
|
49
49
|
if (!result.ok) { setAlignNote(result.error); return }
|
|
50
|
-
setAlignNote(result.
|
|
50
|
+
setAlignNote(result.folded
|
|
51
|
+
? `检查了 ${result.checked} 个追踪中文件,折入 ${result.folded} 条改动`
|
|
52
|
+
: `检查了 ${result.checked} 个追踪中文件,没有新改动`)
|
|
51
53
|
refreshReview(props.sessionId)
|
|
52
54
|
} catch (cause) { setAlignNote(String(cause)) }
|
|
53
55
|
finally { setAligning(false) }
|
|
@@ -56,8 +58,8 @@ export function ReviewLedger(props: { sessionId: string; first: ReviewPage | nul
|
|
|
56
58
|
return h('div', { style: { marginTop: 8 } },
|
|
57
59
|
h('div', { style: { display: 'flex', gap: 8, alignItems: 'center' } },
|
|
58
60
|
h('label', null, h('input', { type: 'checkbox', checked: history, onChange: () => { setHistory(!history); setCursor(0) } }), '显示已处理及被替换的历史'),
|
|
59
|
-
h('button', { type: 'button', disabled: aligning, title: '
|
|
60
|
-
aligning ? '
|
|
61
|
+
h('button', { type: 'button', disabled: aligning, title: '把已开窗的文件与磁盘对齐一次,补齐漏掉的改动', onClick: () => { void align() } },
|
|
62
|
+
aligning ? '校准中…' : '校准一次')),
|
|
61
63
|
alignNote ? h('small', { role: 'status', style: { display: 'block', marginTop: 4 } }, alignNote) : null,
|
|
62
64
|
error ? h('div', { role: 'alert' }, error) : null,
|
|
63
65
|
!page ? h('p', { role: 'status' }, '正在读取官方审查记录…') : null,
|
|
@@ -55,6 +55,8 @@ export interface AttachmentStageDeps {
|
|
|
55
55
|
readFile: (ref: unknown, signal?: AbortSignal) => Promise<Uint8Array>
|
|
56
56
|
/** 写一个附件(参数是工作区相对路径)。 */
|
|
57
57
|
write: (relativePath: string, bytes: Uint8Array) => Promise<void>
|
|
58
|
+
/** 落盘根目录(工作区相对路径);缺省 `plans/<slug>`,测试验收模式用它指到 `.dsh/test-check/<id>`。 */
|
|
59
|
+
root?: string
|
|
58
60
|
/** 单文件上限,默认 25 MB。 */
|
|
59
61
|
maxBytes?: number
|
|
60
62
|
/** 附件数量上限,默认 12 个。 */
|
|
@@ -287,7 +289,8 @@ function refOf(block: unknown): AttachmentRefView | null {
|
|
|
287
289
|
*/
|
|
288
290
|
export async function stageAttachments(deps: AttachmentStageDeps): Promise<AttachmentStage> {
|
|
289
291
|
const slug = String(deps.slug ?? '')
|
|
290
|
-
const
|
|
292
|
+
const root = typeof deps.root === 'string' && deps.root.trim() ? deps.root.trim().replace(/\/+$/, '') : 'plans/' + slug
|
|
293
|
+
const dir = root + '/' + ATTACHMENTS_DIR
|
|
291
294
|
const maxBytes = deps.maxBytes ?? MAX_ATTACHMENT_BYTES
|
|
292
295
|
const maxCount = deps.maxCount ?? MAX_ATTACHMENTS
|
|
293
296
|
const files: StagedAttachment[] = []
|