@mrrisega/dsh-remote 0.3.2 → 0.3.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.
Files changed (2) hide show
  1. package/dsh-setup.mjs +19 -2
  2. package/package.json +1 -1
package/dsh-setup.mjs CHANGED
@@ -512,6 +512,21 @@ function stripPluginEntries(patch) {
512
512
  return out.join("\n").replace(/\n{3,}/g, "\n\n").trimEnd() + "\n";
513
513
  }
514
514
 
515
+ /**
516
+ * 归一化 patch 基座:去掉 dsh 新 profile 默认的空文档占位行 `[]`。
517
+ * 默认 cordis.patch.yml 是「顶部注释 + []」,若保留 [] 再往下拼 `- insert:`,
518
+ * YAML 会报 “end of the stream or a document separator is expected”(dsh web 启动即崩)。
519
+ * 返回内容不含结尾换行;[] 行只在独立成行时视为占位,不影响真正的条目。
520
+ */
521
+ function normalizePatchBase(patch) {
522
+ return String(patch ?? "")
523
+ .split("\n")
524
+ .filter((l) => !/^\[\s*\]\s*$/.test(l))
525
+ .join("\n")
526
+ .replace(/\n{3,}/g, "\n\n")
527
+ .trimEnd();
528
+ }
529
+
515
530
  /** 在 profile 目录执行依赖安装(pnpm 优先)。 */
516
531
  function installProfileDeps(profileDir) {
517
532
  const pm = sh("command -v pnpm >/dev/null 2>&1 && echo pnpm || echo npm").stdout.trim() || "npm";
@@ -568,10 +583,12 @@ async function pluginCmd(argv) {
568
583
  pkg.dependencies["dsh-remote-ui"] = `link:${pluginDir}`;
569
584
  fs.writeFileSync(pkgFile, JSON.stringify(pkg, null, 2) + "\n");
570
585
 
571
- // 先清掉旧条目(含旧版无标记条目),再写入带标记的新块,保证不重复
586
+ // 先清掉旧条目(含旧版无标记条目),再写入带标记的新块,保证不重复。
587
+ // 关键:先清除默认的 [] 空文档占位行,否则拼接出的 YAML 非法,dsh web 启动即崩。
572
588
  const stripped = stripPluginEntries(patch);
589
+ const base = normalizePatchBase(stripped);
573
590
  const block = pluginBlock(CONFIG_DIR);
574
- fs.writeFileSync(patchFile, stripped + block + "\n");
591
+ fs.writeFileSync(patchFile, (base ? base + "\n" : "") + block + "\n");
575
592
  console.log(`✅ 已写入 ${patchFile}`);
576
593
  console.log(" 执行依赖更新(pnpm install)...");
577
594
  const r = installProfileDeps(profileDir);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mrrisega/dsh-remote",
3
- "version": "0.3.2",
3
+ "version": "0.3.3",
4
4
  "description": "手机远程控制 DeepSeek Harness · Remote control DeepSeek Harness (dsh web) from any phone browser — 100% 全功能 App 级体验:发消息、看工具执行、审批权限、改设置、管凭据,含特权操作,免内网穿透。一条命令安装 npx @mrrisega/dsh-remote。Mobile remote control for DSH, self-host or SaaS, no server needed on LAN.",
5
5
  "keywords": [
6
6
  "deepseek-harness",