fix(install.sh): never replace a ~/.moshcode that holds the operator's files - #506
Merged
Merged
Conversation
…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
ThreatCrush Security Scan5 finding(s) in the 2 file(s) this pull request changes. HIGH/CRITICAL: 5
88 pre-existing finding(s) elsewhere in the repository — **HIGH/CRITICAL**: 3 | **MEDIUM**: 75 | **LOW**: 10Not introduced by this pull request. The full set is in the Security tab.
…and 68 more. Full results in the Security tab. Snippets are redacted; ThreatCrush never prints matched credential material. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
moshcoding.com/install.sh keeps the package under
$MOSHCODE_HOME/pkgand uses$MOSHCODE_HOMEitself foraliases.json,credentials.json,herd/,news.opmlandsync.json. This installer replaces$MOSHCODE_HOMEwholesale. 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 onerm -rf(seen today). The only reasonmoshcode upgradenever did this is that it exportsMOSHCODE_HOMEto the package dir it runs from.fetch_and_unpacknow looks before it removes: apkg/package, or any of the operator's files, means the directory is the config dir, and the package goes underpkg/beneath it, with the wrapper following. An empty or package-only directory keeps today's flat layout, so a fresh install andmoshcode upgradeare unchanged.Verified
test/install-config-dir.test.mjsdrives the real script three ways: a config dir with aliases, credentials and a herd is kept and the package lands inpkg/; an existingpkg/is upgraded in place with its neighbours untouched; an empty~/.moshcodegets the flat layout as before.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