Skip to content

feat: per-project config scope for one init#78

Merged
moekatib merged 2 commits intomainfrom
feat/project-scoped-config
Apr 9, 2026
Merged

feat: per-project config scope for one init#78
moekatib merged 2 commits intomainfrom
feat/project-scoped-config

Conversation

@moekatib
Copy link
Copy Markdown
Contributor

@moekatib moekatib commented Apr 9, 2026

Summary

  • one init now picks between global (~/.one/config.json) and project (~/.one/projects/<slug>/config.json) scope via an interactive picker — project config wins at read time, global is the fallback
  • New resolveConfig() in src/lib/config.ts centralizes the project→global lookup; all existing accessors route through it so every command becomes scope-aware for free
  • New one config path command (human + --agent JSON) prints the active scope and full fallback chain so it's obvious which config is being used
  • Scope-aware prompts in init ([project] / [global] tags) and a completion screen that explains the resolution order in plain English
  • Docs + version bump to 1.29.0 (README, guide-content, SKILL.md)

Test plan

  • Fresh machine with only ~/.one/config.json — behavior identical to before, no project dir created
  • In a new project dir, one init defaults the picker to project when a global already exists
  • After picking project: ~/.one/projects/<slug>/config.json is created with 0600, one config path reports scope: project
  • cd to an unrelated directory — one config path reports scope: global and one list uses the global key
  • Delete the project config — automatic fallback to global
  • one init --global / --project skip the picker (for scripts / agents)

🤖 Generated with Claude Code

`one init` now asks whether the setup should live globally
(~/.one/config.json) or per-project (~/.one/projects/<slug>/config.json).
At read time the CLI prefers the project config and falls back to global,
so users can have different API keys / connections per folder without
touching their default setup. Adds `one config path` to show the active
scope and full fallback chain.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Comment thread skills/one/SKILL.md Outdated

You have access to the One CLI which lets you interact with 250+ third-party platforms through their APIs. Always include the `--agent` flag right after `one` for structured JSON output.

## Config scopes
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need for this in the skill - no need to overload the skill.
Maybe add a reference for scoping to help the agent walks the user on how to do it using the init (better than the .onerc)

Comment thread src/lib/guide-content.ts Outdated
## Setup

1. Run \`one init\` to configure your API key
1. Run \`one init\` to configure your API key. It asks whether to save the config globally (\`~/.one/config.json\`, applies everywhere) or per-project (\`~/.one/projects/<slug>/config.json\`, applies only inside that folder). Project configs take precedence over the global config when running \`one\` inside the project; otherwise the global config is used as a fallback.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

too much details - not needed

- SKILL.md: drop inline config-scopes section, replace with a pointer to a new references/scoping.md that teaches the agent to walk users through `one init` (not .onerc) when they want project-scoped setups
- guide-content.ts: trim the setup step back to one line

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@moekatib moekatib merged commit 0240dd1 into main Apr 9, 2026
@moekatib moekatib deleted the feat/project-scoped-config branch April 9, 2026 01:42
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.

1 participant