Profile scoped config dir
Skill kjuhwa/skills-hub/skills/cli/profile-scoped-config-dir
Per-profile CLI config directories (~/.myapp/profiles/<name>/) so users can run multiple environments (prod, staging, worktrees) side-by-side without collisions.From its SKILL.md
npx -y skills add kjuhwa/skills-hub --skill profile-scoped-config-dirAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
3.4 KB, 657 tokens by cl100k_base, as published. Nobody here has run it
When to use
- CLI that manages long-lived background state (daemon PID, local token, workspace roots).
- Users want to point at cloud and a self-host at the same time, or run multiple dev environments.
Steps
- Define a profile root per-profile, everything in it is scoped:
~/.myapp/ config.json # default profile (legacy / implicit) daemon.pid # default daemon PID profiles/ staging/ config.json daemon.pid daemon.log dev-feat-auth-347/ config.json daemon.pid workspaces/ # per-profile work dir - Accept
--profile <name>on every command that reads/writes profile state. Without it, use the default root:profile, _ := cmd.Flags().GetString("profile") cfgDir := defaultConfigDir() if profile != "" { cfgDir = filepath.Join(defaultConfigDir(), "profiles", profile) } - Derive per-profile ports deterministically from the profile name:
func profileHealthPort(profile string) int { if profile == "" { return defaultHealthPort } h := fnv.New32a(); h.Write([]byte(profile)) return defaultHealthPort + 1 + int(h.Sum32()%1000) } - Include the profile name in log lines and in any daemon-registered runtime display name, so "which daemon is this?" is obvious from UI.
- Document the isolation table in CONTRIBUTING:
Resource Default Profile mode Config ~/.myapp/config.json~/.myapp/profiles/<name>/config.jsonDaemon PID ~/.myapp/daemon.pid~/.myapp/profiles/<name>/daemon.pidHealth port e.g. 19514 19514 + 1 + hash(name)%1000 Workspaces dir ~/myapp_workspaces/~/myapp_workspaces_<name>/
Example
Concurrent environments:
myapp setup # default profile → cloud
myapp setup self-host # default profile → now localhost (overwrites!)
myapp setup self-host --profile staging # staging profile → staging server
myapp daemon start --profile staging # staging daemon
myapp daemon status --profile staging # only reports this daemon
myapp daemon logs -f # default daemon's logs, unaffected
Caveats
- Commands MUST error loud if a profile name doesn't exist, rather than silently falling back to default — users trust the flag to be strict.
- Before
setupoverwrites an existing profile config, prompt "continue? y/N" unless--force. - When building
PATHfor the daemon's child processes, prepend the daemon's own binary dir so agent-spawnedmyappcalls hit the same binary.
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.