dsh-config-manager 0.1.14 → 0.1.16
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 +9 -1
- package/README.zh-CN.md +9 -1
- package/lib/client.js +96 -87
- package/lib/client.js.map +1 -1
- package/lib/index.js +1 -1
- package/package.json +1 -1
- package/src/client/run-store.test.ts +16 -0
- package/src/client/run-store.ts +15 -6
- package/src/index.ts +1 -1
package/README.md
CHANGED
|
@@ -184,7 +184,15 @@ Every import creates a **safety snapshot** first. If something feels off afterwa
|
|
|
184
184
|
|
|
185
185
|
**GUI**: Settings → "Backup & Migration" → **Snapshots & Restore** tab → pick a snapshot → preview the plan (dry-run, zero writes) → confirm.
|
|
186
186
|
|
|
187
|
-
**CLI** (offline, no DSH runtime needed)
|
|
187
|
+
**CLI** (offline, no DSH runtime needed) — it is a standalone npm tool, **installed separately from the plugin**:
|
|
188
|
+
|
|
189
|
+
```bash
|
|
190
|
+
# install the CLI once on the machine where you want to restore snapshots
|
|
191
|
+
# (--omit=peer: the offline CLI only needs js-yaml, not the DSH peer packages)
|
|
192
|
+
npm install -g dsh-config-manager@latest --omit=peer
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
> ⚠️ Installing/updating the plugin (`dsh plugin --profile web add ...`) only enables the GUI — it does **not** create the `dsh-config-manager` command. Run the install command above, then:
|
|
188
196
|
|
|
189
197
|
```bash
|
|
190
198
|
# list snapshots (newest first)
|
package/README.zh-CN.md
CHANGED
|
@@ -184,7 +184,15 @@ dsh plugin --profile web add dsh-config-manager@latest --config.auto-install-pee
|
|
|
184
184
|
|
|
185
185
|
**GUI**:设置 → 「备份与迁移」→「快照恢复」tab → 选择快照 → 预览恢复计划(dry-run,零写入)→ 确认执行。
|
|
186
186
|
|
|
187
|
-
**CLI**(纯离线,无需 DSH
|
|
187
|
+
**CLI**(纯离线,无需 DSH 运行时)——它是独立的 npm 命令行工具,**需单独安装**(与插件安装是两回事):
|
|
188
|
+
|
|
189
|
+
```bash
|
|
190
|
+
# 在想恢复快照的那台机器上安装一次 CLI
|
|
191
|
+
# (--omit=peer:离线 CLI 只需要 js-yaml,不需要 DSH 的 peer 依赖包)
|
|
192
|
+
npm install -g dsh-config-manager@latest --omit=peer
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
> ⚠️ 只安装/更新插件(`dsh plugin --profile web add ...`)只启用 GUI,**不会**产生 `dsh-config-manager` 命令。请先执行上面这条安装命令,然后:
|
|
188
196
|
|
|
189
197
|
```bash
|
|
190
198
|
# 列出快照(最新在前)
|
package/lib/client.js
CHANGED
|
@@ -1220,17 +1220,26 @@ var RunStore = class {
|
|
|
1220
1220
|
this.state = defaultState();
|
|
1221
1221
|
this.load();
|
|
1222
1222
|
}
|
|
1223
|
-
/**
|
|
1224
|
-
subscribe
|
|
1223
|
+
/**
|
|
1224
|
+
* 订阅 store 变化(useSyncExternalStore 的 subscribe)。
|
|
1225
|
+
*
|
|
1226
|
+
* 必须为箭头函数类字段:React 以裸引用(`runStore.subscribe`)调用它,
|
|
1227
|
+
* 无接收者,若为原型方法则 `this` 为 undefined,`this.listeners` 直接崩溃。
|
|
1228
|
+
*/
|
|
1229
|
+
subscribe = (listener) => {
|
|
1225
1230
|
this.listeners.add(listener);
|
|
1226
1231
|
return () => {
|
|
1227
1232
|
this.listeners.delete(listener);
|
|
1228
1233
|
};
|
|
1229
|
-
}
|
|
1230
|
-
/**
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
+
};
|
|
1235
|
+
/**
|
|
1236
|
+
* 当前完整快照(引用稳定:仅在 patch 后替换,适合 useSyncExternalStore)。
|
|
1237
|
+
*
|
|
1238
|
+
* 必须为箭头函数类字段:React 以裸引用(`runStore.getSnapshot`)调用它,
|
|
1239
|
+
* 无接收者,若为原型方法则 `this` 为 undefined,`this.state` 抛 TypeError,
|
|
1240
|
+
* 导致整个 settings.section 槽位渲染崩溃(备份与迁移页空白)。
|
|
1241
|
+
*/
|
|
1242
|
+
getSnapshot = () => this.state;
|
|
1234
1243
|
notify() {
|
|
1235
1244
|
for (const listener of this.listeners) listener();
|
|
1236
1245
|
}
|
|
@@ -1587,102 +1596,102 @@ if (typeof document !== "undefined" && document.querySelector("style[data-tag=\"
|
|
|
1587
1596
|
document.head.appendChild(tag);
|
|
1588
1597
|
}
|
|
1589
1598
|
var config_manager_module_css_default = {
|
|
1599
|
+
"modeTab": "_367UGW_modeTab",
|
|
1600
|
+
"primaryButton": "_367UGW_primaryButton",
|
|
1601
|
+
"groupLabel": "_367UGW_groupLabel",
|
|
1602
|
+
"formError": "_367UGW_formError",
|
|
1603
|
+
"optionsCard": "_367UGW_optionsCard",
|
|
1604
|
+
"viewTabs": "_367UGW_viewTabs",
|
|
1605
|
+
"rowActions": "_367UGW_rowActions",
|
|
1590
1606
|
"groupNote": "_367UGW_groupNote",
|
|
1607
|
+
"conflictHead": "_367UGW_conflictHead",
|
|
1608
|
+
"progressBadge": "_367UGW_progressBadge",
|
|
1609
|
+
"categoryName": "_367UGW_categoryName",
|
|
1610
|
+
"snapshotRowHeader": "_367UGW_snapshotRowHeader",
|
|
1611
|
+
"badgeWarn": "_367UGW_badgeWarn",
|
|
1612
|
+
"input": "_367UGW_input",
|
|
1613
|
+
"badgeInfo": "_367UGW_badgeInfo",
|
|
1614
|
+
"progressMeta": "_367UGW_progressMeta",
|
|
1615
|
+
"rollbackBox": "_367UGW_rollbackBox",
|
|
1616
|
+
"progressBlock": "_367UGW_progressBlock",
|
|
1617
|
+
"errorBanner": "_367UGW_errorBanner",
|
|
1618
|
+
"dangerButton": "_367UGW_dangerButton",
|
|
1591
1619
|
"reportView": "_367UGW_reportView",
|
|
1592
|
-
"
|
|
1593
|
-
"
|
|
1594
|
-
"
|
|
1595
|
-
"
|
|
1596
|
-
"dshCmSpin": "_367UGW_dshCmSpin",
|
|
1597
|
-
"reportFooter": "_367UGW_reportFooter",
|
|
1620
|
+
"modeHint": "_367UGW_modeHint",
|
|
1621
|
+
"ghostButton": "_367UGW_ghostButton",
|
|
1622
|
+
"progressBadgeSection": "_367UGW_progressBadgeSection",
|
|
1623
|
+
"errorList": "_367UGW_errorList",
|
|
1598
1624
|
"conflictId": "_367UGW_conflictId",
|
|
1599
|
-
"
|
|
1600
|
-
"card": "_367UGW_card",
|
|
1625
|
+
"pathMappingList": "_367UGW_pathMappingList",
|
|
1601
1626
|
"sectionHeader": "_367UGW_sectionHeader",
|
|
1627
|
+
"progressBarDone": "_367UGW_progressBarDone",
|
|
1628
|
+
"categoryItem": "_367UGW_categoryItem",
|
|
1602
1629
|
"errorTitle": "_367UGW_errorTitle",
|
|
1603
|
-
"
|
|
1630
|
+
"actionRow": "_367UGW_actionRow",
|
|
1631
|
+
"statRow": "_367UGW_statRow",
|
|
1632
|
+
"conflictItem": "_367UGW_conflictItem",
|
|
1633
|
+
"severityError": "_367UGW_severityError",
|
|
1634
|
+
"progressTrack": "_367UGW_progressTrack",
|
|
1635
|
+
"badgeOk": "_367UGW_badgeOk",
|
|
1636
|
+
"errorReason": "_367UGW_errorReason",
|
|
1604
1637
|
"conflictDetail": "_367UGW_conflictDetail",
|
|
1605
|
-
"
|
|
1606
|
-
"
|
|
1607
|
-
"rowActions": "_367UGW_rowActions",
|
|
1608
|
-
"progressBlock": "_367UGW_progressBlock",
|
|
1638
|
+
"pathIssueKind": "_367UGW_pathIssueKind",
|
|
1639
|
+
"warnText": "_367UGW_warnText",
|
|
1609
1640
|
"kindTag": "_367UGW_kindTag",
|
|
1610
|
-
"reportList": "_367UGW_reportList",
|
|
1611
|
-
"statRow": "_367UGW_statRow",
|
|
1612
|
-
"dshCmIndeterminate": "_367UGW_dshCmIndeterminate",
|
|
1613
|
-
"dangerButton": "_367UGW_dangerButton",
|
|
1614
|
-
"progressBar": "_367UGW_progressBar",
|
|
1615
|
-
"badgeInfo": "_367UGW_badgeInfo",
|
|
1616
|
-
"groupCard": "_367UGW_groupCard",
|
|
1617
|
-
"hint": "_367UGW_hint",
|
|
1618
1641
|
"warnList": "_367UGW_warnList",
|
|
1619
|
-
"errorAction": "_367UGW_errorAction",
|
|
1620
|
-
"spinnerWrap": "_367UGW_spinnerWrap",
|
|
1621
|
-
"spinnerLabel": "_367UGW_spinnerLabel",
|
|
1622
|
-
"warnText": "_367UGW_warnText",
|
|
1623
|
-
"viewTab": "_367UGW_viewTab",
|
|
1624
|
-
"errorReason": "_367UGW_errorReason",
|
|
1625
|
-
"conflictOptions": "_367UGW_conflictOptions",
|
|
1626
1642
|
"sectionTitleBlock": "_367UGW_sectionTitleBlock",
|
|
1627
|
-
"
|
|
1628
|
-
"
|
|
1629
|
-
"
|
|
1630
|
-
"
|
|
1631
|
-
"
|
|
1632
|
-
"
|
|
1633
|
-
"errorLine": "_367UGW_errorLine",
|
|
1634
|
-
"conflictList": "_367UGW_conflictList",
|
|
1635
|
-
"modeTabs": "_367UGW_modeTabs",
|
|
1636
|
-
"errorFooter": "_367UGW_errorFooter",
|
|
1637
|
-
"badge": "_367UGW_badge",
|
|
1638
|
-
"modeTab": "_367UGW_modeTab",
|
|
1639
|
-
"groupItems": "_367UGW_groupItems",
|
|
1643
|
+
"sectionTitle": "_367UGW_sectionTitle",
|
|
1644
|
+
"progressBadgeCount": "_367UGW_progressBadgeCount",
|
|
1645
|
+
"secretsList": "_367UGW_secretsList",
|
|
1646
|
+
"pathNew": "_367UGW_pathNew",
|
|
1647
|
+
"spinner": "_367UGW_spinner",
|
|
1648
|
+
"badgeError": "_367UGW_badgeError",
|
|
1640
1649
|
"groupList": "_367UGW_groupList",
|
|
1641
|
-
"sectionSubtitle": "_367UGW_sectionSubtitle",
|
|
1642
|
-
"secretFields": "_367UGW_secretFields",
|
|
1643
|
-
"categoryName": "_367UGW_categoryName",
|
|
1644
1650
|
"checkboxRow": "_367UGW_checkboxRow",
|
|
1645
|
-
"categoryItem": "_367UGW_categoryItem",
|
|
1646
|
-
"severityError": "_367UGW_severityError",
|
|
1647
|
-
"conflictItem": "_367UGW_conflictItem",
|
|
1648
|
-
"snapshotList": "_367UGW_snapshotList",
|
|
1649
|
-
"progressMeta": "_367UGW_progressMeta",
|
|
1650
|
-
"pathValue": "_367UGW_pathValue",
|
|
1651
|
-
"badgeWarn": "_367UGW_badgeWarn",
|
|
1652
|
-
"progressBadge": "_367UGW_progressBadge",
|
|
1653
|
-
"badgeError": "_367UGW_badgeError",
|
|
1654
|
-
"modeHint": "_367UGW_modeHint",
|
|
1655
|
-
"rollbackBox": "_367UGW_rollbackBox",
|
|
1656
|
-
"empty": "_367UGW_empty",
|
|
1657
|
-
"fieldLabel": "_367UGW_fieldLabel",
|
|
1658
1651
|
"reportText": "_367UGW_reportText",
|
|
1659
|
-
"
|
|
1652
|
+
"errorActionLabel": "_367UGW_errorActionLabel",
|
|
1653
|
+
"modeTabs": "_367UGW_modeTabs",
|
|
1654
|
+
"conflictOptions": "_367UGW_conflictOptions",
|
|
1655
|
+
"spinnerWrap": "_367UGW_spinnerWrap",
|
|
1660
1656
|
"progressLabel": "_367UGW_progressLabel",
|
|
1661
|
-
"
|
|
1662
|
-
"
|
|
1663
|
-
"
|
|
1664
|
-
"
|
|
1665
|
-
"
|
|
1657
|
+
"dshCmSpin": "_367UGW_dshCmSpin",
|
|
1658
|
+
"progressIndeterminate": "_367UGW_progressIndeterminate",
|
|
1659
|
+
"empty": "_367UGW_empty",
|
|
1660
|
+
"pathOld": "_367UGW_pathOld",
|
|
1661
|
+
"card": "_367UGW_card",
|
|
1662
|
+
"fieldLabel": "_367UGW_fieldLabel",
|
|
1663
|
+
"groupCard": "_367UGW_groupCard",
|
|
1664
|
+
"dshCmIndeterminate": "_367UGW_dshCmIndeterminate",
|
|
1665
|
+
"secretFields": "_367UGW_secretFields",
|
|
1666
|
+
"banner": "_367UGW_banner",
|
|
1667
|
+
"viewTab": "_367UGW_viewTab",
|
|
1668
|
+
"groupHeader": "_367UGW_groupHeader",
|
|
1669
|
+
"errorAction": "_367UGW_errorAction",
|
|
1670
|
+
"progressDetail": "_367UGW_progressDetail",
|
|
1671
|
+
"pathValue": "_367UGW_pathValue",
|
|
1672
|
+
"spinnerLabel": "_367UGW_spinnerLabel",
|
|
1673
|
+
"categoryDesc": "_367UGW_categoryDesc",
|
|
1674
|
+
"snapshotRow": "_367UGW_snapshotRow",
|
|
1675
|
+
"badge": "_367UGW_badge",
|
|
1676
|
+
"errorLine": "_367UGW_errorLine",
|
|
1677
|
+
"errorFooter": "_367UGW_errorFooter",
|
|
1666
1678
|
"errorItem": "_367UGW_errorItem",
|
|
1667
|
-
"
|
|
1679
|
+
"conflictList": "_367UGW_conflictList",
|
|
1668
1680
|
"pathRow": "_367UGW_pathRow",
|
|
1669
|
-
"
|
|
1670
|
-
"snapshotRow": "_367UGW_snapshotRow",
|
|
1681
|
+
"sectionBody": "_367UGW_sectionBody",
|
|
1671
1682
|
"hiddenFile": "_367UGW_hiddenFile",
|
|
1672
|
-
"
|
|
1673
|
-
"
|
|
1674
|
-
"
|
|
1675
|
-
"
|
|
1676
|
-
"
|
|
1677
|
-
"
|
|
1678
|
-
"
|
|
1679
|
-
"
|
|
1680
|
-
"
|
|
1681
|
-
"
|
|
1682
|
-
"
|
|
1683
|
-
"
|
|
1684
|
-
"pathNew": "_367UGW_pathNew",
|
|
1685
|
-
"optionsCard": "_367UGW_optionsCard"
|
|
1683
|
+
"hint": "_367UGW_hint",
|
|
1684
|
+
"section": "_367UGW_section",
|
|
1685
|
+
"field": "_367UGW_field",
|
|
1686
|
+
"reportFooter": "_367UGW_reportFooter",
|
|
1687
|
+
"snapshotList": "_367UGW_snapshotList",
|
|
1688
|
+
"sectionSubtitle": "_367UGW_sectionSubtitle",
|
|
1689
|
+
"progressPercent": "_367UGW_progressPercent",
|
|
1690
|
+
"progressBar": "_367UGW_progressBar",
|
|
1691
|
+
"groupItems": "_367UGW_groupItems",
|
|
1692
|
+
"reportList": "_367UGW_reportList",
|
|
1693
|
+
"radioLabel": "_367UGW_radioLabel",
|
|
1694
|
+
"viewBody": "_367UGW_viewBody"
|
|
1686
1695
|
};
|
|
1687
1696
|
//#endregion
|
|
1688
1697
|
//#region src/client/common/ui.tsx
|