Appearance
Projects
A project is a name pointing at a directory that contains a managed.yaml. Once you register a project, you can run any managed command from anywhere, no need to cd into the project directory first.
This is useful when you manage more than one stack (feeder, staging, personal, …) from the same machine.
How a project gets selected
Every managed command resolves a working directory before it runs. The first matching rule wins:
-C <path>/--directory <path>, explicit directory (highest priority).-P <name>/--project <name>, registered project, by name.MANAGED_PROJECTenvironment variable, typically set bymanaged project switch(see below).- The current directory contains
managed.yaml, stay where you are. - The default project (if one is configured), chdir into it.
If none of those apply, the command runs in your current directory and falls back to whatever errors that produces (usually "no managed.yaml here").
The registry
Projects are stored in ~/.config/managed/projects.json. The file is a small JSON document:
json
{
"projects": {
"feeder": "/Users/you/code/feeder-infra",
"staging": "/Users/you/code/staging-infra"
},
"default": "feeder"
}You can edit it by hand, but the managed project commands handle it for you.
Registering a project
cd into the project's directory and run:
bash
managed project save feeder # register cwd as "feeder"
managed project save feeder --default # also make it the defaultThe path is stored as an absolute path, so moving the directory later means re-running save.
You can also register without cd-ing:
bash
managed -C ~/code/feeder-infra project save feederSwitching projects in your shell
managed project switch doesn't actually change anything by itself, a child process can't mutate its parent shell's environment. Instead it prints export MANAGED_PROJECT=<name> so the shell can apply it via eval:
bash
eval $(managed project switch feeder)Every subsequent managed command in that shell now uses the feeder project (unless you override with -P, -C, or by being inside another project's directory).
If you forget the eval and run managed project switch feeder directly, it prints the export line plus a reminder showing the full command.
A common shell alias keeps it tidy:
bash
alias mpswitch='function _mp(){ eval "$(managed project switch $1)"; }; _mp'Picking a default
The default is used when no other rule has chosen a project, typically when you open a fresh terminal in your home directory and want managed status to "just work".
bash
managed project default feederYou can also set it during save with --default.
Listing and removing
bash
managed project list # show every registered project
managed project remove feeder # forget about a project (no files touched)list marks the default project and, if MANAGED_PROJECT is set in your shell, tells you which project is currently active.
One-off override with --project
For a single command, -P / --project selects a project without changing the default or your shell environment:
bash
managed --project staging status
managed -P staging ssh connect db-1