Skip to content

fix: allow mining directories without local mempalace.yaml - #173

Closed
mvanhorn wants to merge 2 commits into
MemPalace:mainfrom
mvanhorn:fix/14-mine-no-yaml
Closed

fix: allow mining directories without local mempalace.yaml#173
mvanhorn wants to merge 2 commits into
MemPalace:mainfrom
mvanhorn:fix/14-mine-no-yaml

Conversation

@mvanhorn

@mvanhorn mvanhorn commented Apr 7, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Changes load_config() in miner.py to return sensible defaults instead of sys.exit(1) when no mempalace.yaml exists in the source directory.

The bug: mempalace mine ~/chats/ fails with ERROR: No mempalace.yaml found when the user init'd in a different directory (~/projects/myapp). The miner requires mempalace.yaml in every source directory, but users expect to init once and mine from anywhere.

The fix: when no yaml is found, derive a wing name from the directory basename and use a single "general" room. Prints an informational message instead of crashing.

Closes #14.

How to test

# Create a directory with no mempalace.yaml
mkdir /tmp/test-mine
echo "some content" > /tmp/test-mine/file.txt
mempalace mine /tmp/test-mine
# Should work instead of crashing

Or run the new test:

pytest tests/test_miner.py::test_load_config_uses_defaults_when_yaml_missing -v

Checklist

  • Tests pass (python -m pytest tests/ -v)
  • No hardcoded paths
  • Linter passes (ruff check .)

This contribution was developed with AI assistance (Codex).

mvanhorn added 2 commits April 7, 2026 16:36
When no mempalace.yaml or mempal.yaml exists in the source directory,
return a default config (wing = directory name, room = general) instead
of calling sys.exit(1). This lets users mine any directory into their
palace without requiring init first.

Closes MemPalace#14.
@neocybereth

Copy link
Copy Markdown

"The fix: when no yaml is found, derive a wing name from the directory basename and use a single "general" room. Prints an informational message instead of crashing." -- what does the general informational message look like out of curiosity?

@mvanhorn

mvanhorn commented Apr 9, 2026

Copy link
Copy Markdown
Contributor Author

It prints:

  No mempalace.yaml found in /path/to/project — using auto-detected defaults

Then uses the directory basename as the wing name and a single "general" room with all project files.

@bensig

bensig commented Apr 11, 2026

Copy link
Copy Markdown
Contributor

Conflicts with main. If the mining-without-yaml feature is still needed, a rebased PR against current main would be welcome.

@bensig bensig closed this Apr 11, 2026
@mvanhorn

Copy link
Copy Markdown
Contributor Author

Rebased onto current main and resolved the import conflict in tests/test_miner.py. All 14 miner tests pass and ruff check is clean.

Opened #604 with the rebased branch (couldn't reopen this one). Happy to close it and reopen here instead if you'd prefer. Thanks @bensig!

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.

Setup is throwing an error

3 participants