Repository navigation
Conversation
Global MCP configs (Cursor, Codex, pi, ...) launch `figmog serve` from whatever project the agent is in, so the cwd-relative `.figmog` default scatters a store per project and forces a wrapper script to `cd` first. `FIGMOG_ROOT` sets the default root for both `serve --figmog-root` and the CLI's own root derivation (`<root>/<key>/db`, `<root>/current`, `<root>/serve.sock`), so one env line in any client's mcp.json gives each agent a stable store. Precedence: explicit flag > env > `.figmog`. No new dependencies: clap's `env` feature isn't enabled, so the flag uses `default_value_os_t` with the same `cli::socket::default_root()` the CLI reads, keeping serve and CLI on one root by construction. README gains a generic MCP-client config block; SPEC 6a documents the precedence; one e2e test pins pull-then-read across two cwds.
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.
Why
Connecting figmog from a global MCP config (Cursor, Codex, pi, Claude Code's user scope, …) launches
figmog servefrom whatever project the agent happens to be in. The cwd-relative.figmogdefault then leaves a stray store in every project, and the only workaround is a shell wrapper thatcds somewhere stable first.What
FIGMOG_ROOTsets the default root for both sides:figmog serve—--figmog-rootnow defaults to$FIGMOG_ROOT, else.figmogpull/ socket routing —<root>/<key>/db,<root>/current,<root>/serve.sockall derive from the samecli::socket::default_root()Precedence: explicit
--figmog-root/--db>FIGMOG_ROOT>.figmog. Unset → byte-identical behaviour to today.Any MCP client can then use the plain stdio shape with no wrapper:
{ "command": "/path/to/figmog", "args": ["serve"], "env": { "FIGMA_TOKEN": "figd_…", "FIGMOG_ROOT": "/Users/you/.figmog" } }Notes for review
envfeature isn't enabled; the flag usesdefault_value_os_t = socket::default_root()so serve and CLI share one function by construction rather than two constants that must agree.--figmog-rootwashide = true; it's now visible since it has a user-facing default. Happy to keep it hidden if you'd rather.serve-per-root caveat for concurrent agents.figmog_root_env_relocates_default_root—pullunder cwd A lands in$FIGMOG_ROOT(and notA/.figmog),pagesfrom cwd B finds it.Gates:
cargo test(244 pass),clippy --all-targets -D warnings,fmt --check,cargo doc --no-depsall clean.