Skip to content

Commit 3ef6757

Browse files
docs(cli): document project binding precedence and deep doctor workflow
1 parent 7f38306 commit 3ef6757

2 files changed

Lines changed: 57 additions & 11 deletions

File tree

README.md

Lines changed: 34 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ The command model is intentionally layered:
2121
- `project` for remote Agora resources and env export
2222
- `auth` for login and session inspection
2323
- `config` for local CLI defaults
24-
- `add` hidden and reserved for future in-place integrations into an existing codebase
2524

2625
## Install / Build
2726

@@ -107,10 +106,6 @@ Handles login, logout, and current session inspection.
107106

108107
Reads and updates local CLI defaults such as output mode, log level, and browser behavior.
109108

110-
### `add`
111-
112-
Hidden and reserved for future in-place integrations into an existing application. It is intentionally not part of the normal help surface today.
113-
114109
## Common Workflows
115110

116111
### Onboard a new demo
@@ -176,6 +171,38 @@ The CLI also writes repo-local project metadata to:
176171

177172
That allows the CLI to detect which Agora project a cloned demo is bound to even when you are working inside the repo later.
178173

174+
## Repo-Local Project Binding
175+
176+
Project resolution precedence is consistent across commands:
177+
1. explicit `--project` or positional project argument
178+
2. repo-local `.agora/project.json` resolved from the target repo path
179+
3. global CLI context from `agora project use`
180+
181+
The `.agora/project.json` file is created or updated by:
182+
- `agora init`
183+
- `agora quickstart create ... --project ...`
184+
- `agora quickstart env write ...`
185+
186+
It stores durable non-secret metadata:
187+
- `projectId`
188+
- `projectName`
189+
- `region`
190+
- `template`
191+
- `envPath`
192+
193+
Examples:
194+
195+
```bash
196+
# Inside a bound quickstart repo
197+
./agora project show --json
198+
199+
# From any directory, target a repo path directly
200+
./agora quickstart env write /abs/path/to/my-go-demo --json
201+
202+
# Rebind a repo to a different project
203+
./agora quickstart env write /abs/path/to/my-go-demo --project my-other-project --json
204+
```
205+
179206
## Automation / Agent Usage
180207

181208
For scripts, CI, and agentic workflows:
@@ -260,14 +287,11 @@ Quickstart env injection requires a project with an app certificate. If the sele
260287
If a command needs a project and none is currently selected, either:
261288

262289
```bash
290+
./agora quickstart env write my-go-demo --project my-project
263291
./agora project use my-project
264292
```
265293

266-
or pass `--project` explicitly:
267-
268-
```bash
269-
./agora quickstart env write my-go-demo --project my-project
270-
```
294+
or run it inside a repo that already has `.agora/project.json`.
271295

272296
## Migration
273297

docs/automation.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,25 @@ Use this guide for:
1717
- Use `agora project doctor --json` for readiness checks before continuing with automated setup.
1818
- In JSON mode, both success and failure return the same top-level envelope shape.
1919

20+
Primary command groups:
21+
- `init`
22+
- `quickstart`
23+
- `project`
24+
- `auth`
25+
- `config`
26+
27+
## Project Resolution Precedence
28+
29+
Commands that require a project resolve context in this order:
30+
1. explicit `--project` or positional project argument
31+
2. repo-local `.agora/project.json` from the target repo path
32+
3. global CLI context selected by `agora project use`
33+
34+
Agent guidance:
35+
- prefer explicit `--project` for deterministic cross-repo operations
36+
- rely on repo-local binding when operating repeatedly inside one bound quickstart
37+
- keep `metadataPath` from command results if you need to validate or audit project bindings
38+
2039
## JSON Envelope
2140

2241
Commands that support structured output return a JSON envelope in this shape:
@@ -328,7 +347,7 @@ Safe branch fields:
328347
Example:
329348

330349
```bash
331-
./agora quickstart env write my-python-demo --json
350+
./agora quickstart env write /abs/path/to/my-python-demo --json
332351
```
333352

334353
Required `data` fields:
@@ -382,6 +401,8 @@ Required `data` fields:
382401
Optional fields:
383402
- `project`
384403
Nil during auth or project-selection failure paths.
404+
- `workspace`
405+
Present in deep mode with repo-local binding and env consistency details.
385406

386407
Safe branch fields:
387408
- `healthy`
@@ -395,6 +416,7 @@ Recommended agent behavior:
395416
- branch first on `status`
396417
- use `healthy` as a fast readiness boolean
397418
- inspect `blockingIssues[].suggestedCommand` for recovery suggestions
419+
- for repo-bound validation, run `project doctor --deep --json`
398420

399421
### `auth status`
400422

0 commit comments

Comments
 (0)