From 6800550cd540d8ed6841f0c7d30266a4fc0e3509 Mon Sep 17 00:00:00 2001 From: Andrey Epifancev Date: Sun, 25 Oct 2026 12:29:30 +0400 Subject: [PATCH] =?UTF-8?q?fix(dsh):=20O-2=20=E2=80=94=20WARN=20=D0=B8=20?= =?UTF-8?q?=D0=B2=20install=5Fglobal,=20=D0=B0=D1=81=D1=81=D0=B5=D1=80?= =?UTF-8?q?=D1=82=D1=8B=20=D0=B0=D1=80=D1=82=D0=B5=D1=84=D0=B0=D0=BA=D1=82?= =?UTF-8?q?=D0=BE=D0=B2=20(#62)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dsh/install.sh | 1 + dsh/tests/install.test.mjs | 15 +++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/dsh/install.sh b/dsh/install.sh index 8e7af16..f9f9cf8 100755 --- a/dsh/install.sh +++ b/dsh/install.sh @@ -372,6 +372,7 @@ check() { } install_global() { + warn_mixed_dsh_home mkdir -p "$DSH_HOME" local target="$DSH_HOME/AGENTS.md" if [ -f "$target" ]; then diff --git a/dsh/tests/install.test.mjs b/dsh/tests/install.test.mjs index ad4e4e8..d43c708 100644 --- a/dsh/tests/install.test.mjs +++ b/dsh/tests/install.test.mjs @@ -666,6 +666,21 @@ test('--skills and --roles warn when DSH_HOME exists while HOME is isolated (O-2 const rolesOut = roles.stdout + roles.stderr assert.equal(roles.status, 0, rolesOut) assert.ok(rolesOut.includes(warn), rolesOut) + assert.ok(existsSync(join(sharedDsh, 'roles', 'dev.md')), 'roles land in the warned DSH_HOME') + + // --global overwrites AGENTS.md (after a backup): the destructive step must + // warn too (T3.1). + const global = runInstaller(home, ['--global'], { DSH_HOME: sharedDsh }) + const globalOut = global.stdout + global.stderr + assert.equal(global.status, 0, globalOut) + assert.ok(globalOut.includes(warn), globalOut) + assert.ok(existsSync(join(sharedDsh, 'AGENTS.md')), 'AGENTS.md is installed after the warning') + + // One run touching several steps warns exactly once (T3.2). + const combined = runInstaller(home, ['--skills', '--roles', '--superpowers-from', src], { DSH_HOME: sharedDsh }) + const combinedOut = combined.stdout + combined.stderr + assert.equal(combined.status, 0, combinedOut) + assert.equal((combinedOut.match(/WARN: DSH_HOME=/g) ?? []).length, 1, combinedOut) // Isolated together ($DSH_HOME=$HOME/.dsh): no warning. const normal = runInstaller(home, ['--skills', '--superpowers-from', src])