Skip to content

Commit 0240dd1

Browse files
authored
feat: per-project config scope for one init (#78)
1 parent eb1dd8f commit 0240dd1

9 files changed

Lines changed: 423 additions & 62 deletions

File tree

README.md

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,15 +124,22 @@ Set up your API key and install the MCP server into your AI agents.
124124
one init
125125
```
126126

127-
Supports Claude Code, Claude Desktop, Cursor, Windsurf, Codex, and Kiro. Installs globally by default, or per-project with `-p` so your team can share configs (each person uses their own API key).
127+
Supports Claude Code, Claude Desktop, Cursor, Windsurf, Codex, and Kiro.
128128

129-
If you've already set up, `one init` shows your current status and lets you update your key, install to more agents, or reconfigure.
129+
**Global vs. project scope.** `one init` is interactive and asks where the setup should live:
130+
131+
- **Global** (`~/.one/config.json`) — applies to every folder. Best when you only need one workspace / API key.
132+
- **Project** (`~/.one/projects/<slug>/config.json`) — scoped to the current project, stored under your home directory so secrets never land in git. Use this when different projects need different API keys, connections, or access control.
133+
134+
When you run `one` in a project, it uses the project config if one exists and falls back to the global config otherwise. Use `one config path` to see which config is active and the full resolution order.
135+
136+
If you've already set up, `one init` shows your current status for the active scope and lets you update your key, install to more agents, or reconfigure.
130137

131138
| Flag | What it does |
132139
|------|-------------|
133140
| `-y` | Skip confirmations |
134-
| `-g` | Install globally (default) |
135-
| `-p` | Install for current project only |
141+
| `-g` | Non-interactive: write the One config globally (`~/.one/config.json`) |
142+
| `-p` | Non-interactive: write the One config for this project (`~/.one/projects/<slug>/config.json`) |
136143

137144
### `one add <platform>`
138145

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@withone/cli",
3-
"version": "1.28.0",
3+
"version": "1.29.0",
44
"description": "CLI for managing One",
55
"type": "module",
66
"files": [

skills/one/SKILL.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ description: |
2222

2323
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.
2424

25+
If the user wants a separate API key / connections for a specific project (vs. their default), walk them through running `one init` from that project folder and picking the "project" scope — see `references/scoping.md`.
26+
2527
## Core Workflow: search -> knowledge -> execute
2628

2729
Always follow this sequence when the user wants to do something on a connected platform:

skills/one/references/scoping.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Project vs. global config
2+
3+
The One CLI can be configured at two scopes:
4+
5+
- **Global**`~/.one/config.json`. Applies everywhere the user runs `one`.
6+
- **Project**`~/.one/projects/<slug>/config.json`, where `<slug>` is the project root path with slashes replaced by dashes (e.g. `/Users/jane/acme``-Users-jane-acme`). Only applies when running `one` from inside that project folder.
7+
8+
**Resolution order:** env vars → `.onerc` in cwd → project config → global config. Project config wins when present; otherwise the CLI falls back to the global config.
9+
10+
## When to suggest project scope
11+
12+
Suggest project scope when the user wants any of the following for a specific folder only, without changing their default setup:
13+
14+
- A different One API key (e.g. sandbox workspace for a client project)
15+
- A different set of connections / connection keys
16+
- Different access control (permissions, scoped connections, knowledge-only mode)
17+
18+
## How to set it up
19+
20+
Do **not** hand-edit `.onerc` or config files. Walk the user through the interactive init:
21+
22+
```bash
23+
cd /path/to/the/project
24+
one init
25+
```
26+
27+
When `init` asks "Where should this setup live?", pick **"This project only"**. Init will write the config to `~/.one/projects/<slug>/config.json` and everything else (skill install, MCP) stays untouched.
28+
29+
To see which config is currently active and the full fallback chain:
30+
31+
```bash
32+
one --agent config path
33+
```
34+
35+
To switch an existing project back to using the global config, delete its project config file — the CLI will automatically fall back to global on the next run.

0 commit comments

Comments
 (0)