Skip to content

fix(install.sh): never replace a ~/.moshcode that holds the operator's files - #506

Merged
ralyodio merged 1 commit into
mainfrom
fix/installer-config-dir
Sep 13, 2026
Merged

ralyodio merged 1 commit into
mainfrom
fix/installer-config-dir

Conversation

@ralyodio

Copy link
Copy Markdown
Contributor

What

moshcoding.com/install.sh keeps the package under $MOSHCODE_HOME/pkg and uses $MOSHCODE_HOME itself for aliases.json, credentials.json, herd/, news.opml and sync.json. This installer replaces $MOSHCODE_HOME wholesale. Run by hand on a box the other one had set up, it removed every alias, the account login and the herd's ledger in one rm -rf (seen today). The only reason moshcode upgrade never did this is that it exports MOSHCODE_HOME to the package dir it runs from.

fetch_and_unpack now looks before it removes: a pkg/ package, or any of the operator's files, means the directory is the config dir, and the package goes under pkg/ beneath it, with the wrapper following. An empty or package-only directory keeps today's flat layout, so a fresh install and moshcode upgrade are unchanged.

Verified

  • test/install-config-dir.test.mjs drives the real script three ways: a config dir with aliases, credentials and a herd is kept and the package lands in pkg/; an existing pkg/ is upgraded in place with its neighbours untouched; an empty ~/.moshcode gets the flat layout as before.
  • Full suite: 2974 tests, 0 failures.

Follows #505. Like it, this is fetched from raw main by moshcode upgrade, so no version bump is needed.

🤖 Generated with Claude Code

https://claude.ai/code/session_014HMV1QDcVY1xiaWWrZQM4S

…s files

moshcoding.com/install.sh keeps the package under $MOSHCODE_HOME/pkg and
uses $MOSHCODE_HOME itself for aliases.json, credentials.json, herd/,
news.opml and sync.json. This installer replaces $MOSHCODE_HOME wholesale.
Run by hand on a box the other one had set up, it removed every alias, the
account login and the herd's ledger in one rm -rf (seen 2026-09-13; the
only reason `moshcode upgrade` never did this is that it exports
MOSHCODE_HOME to the package dir it runs from).

fetch_and_unpack now looks before it removes: a pkg/ package, or any of the
operator's files, means the directory is the config dir, and the package
goes under pkg/ beneath it — the wrapper follows. An empty or package-only
directory keeps today's flat layout, so a fresh install and `moshcode
upgrade` are unchanged.

test/install-config-dir.test.mjs drives the real script three ways: a config
dir with aliases, credentials and a herd is kept and the package lands in
pkg/; an existing pkg/ is upgraded in place with its neighbours untouched;
an empty ~/.moshcode gets the flat layout as before.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014HMV1QDcVY1xiaWWrZQM4S
@github-actions

Copy link
Copy Markdown

ThreatCrush Security Scan

5 finding(s) in the 2 file(s) this pull request changes.

HIGH/CRITICAL: 5

Severity Rule Location
HIGH sh-remote-script-execution install.sh:86
HIGH sh-remote-script-execution install.sh:90
HIGH sh-remote-script-execution install.sh:248
HIGH sh-remote-script-execution install.sh:259
HIGH sh-remote-script-execution install.sh:265
88 pre-existing finding(s) elsewhere in the repository — **HIGH/CRITICAL**: 3 | **MEDIUM**: 75 | **LOW**: 10

Not introduced by this pull request. The full set is in the Security tab.

Severity Rule Location
HIGH js-ssrf-outbound-request apps/pwa/public/sw.js:45
HIGH tls-verification-disabled apps/pwa/src/lib/moshpit-gateway.mjs:299
HIGH tls-verification-disabled src/dns.mjs:766
MEDIUM sql-template-interpolation apps/pwa/src/moshpit.mjs:139
MEDIUM sql-template-interpolation apps/pwa/src/moshpit.mjs:153
MEDIUM sql-template-interpolation apps/pwa/src/moshpit.mjs:179
MEDIUM sql-template-interpolation apps/pwa/src/moshpit.mjs:373
MEDIUM sql-template-interpolation apps/pwa/src/moshpit.mjs:377
MEDIUM sql-template-interpolation apps/pwa/src/moshpit.mjs:422
MEDIUM sql-template-interpolation apps/pwa/src/moshpit.mjs:671
MEDIUM sql-template-interpolation apps/pwa/src/moshpit.mjs:867
MEDIUM sql-template-interpolation apps/pwa/src/moshpit.mjs:869
MEDIUM sql-template-interpolation apps/pwa/src/moshpit.mjs:928
MEDIUM sql-template-interpolation apps/pwa/src/moshpit.mjs:974
MEDIUM sql-template-interpolation apps/pwa/src/moshpit.mjs:1044
MEDIUM sql-template-interpolation apps/pwa/src/moshpit.mjs:1147
MEDIUM sql-template-interpolation apps/pwa/src/moshpit.mjs:1170
MEDIUM sql-template-interpolation apps/pwa/src/moshpit.mjs:1192
MEDIUM sql-template-interpolation apps/pwa/src/moshpit.mjs:1391
MEDIUM sql-template-interpolation apps/pwa/src/moshpit.mjs:1541

…and 68 more. Full results in the Security tab.

Snippets are redacted; ThreatCrush never prints matched credential material.

@ralyodio
ralyodio merged commit c2ee5a9 into main Sep 13, 2026
6 checks passed
@ralyodio
ralyodio deleted the fix/installer-config-dir branch September 13, 2026 07:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant