@figs-so/cli 0.1.15 → 0.1.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -4
- package/figs.mjs +11 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -34,9 +34,8 @@ better. Figs is the human-facing layer on top: the one place a whole team can se
|
|
|
34
34
|
Run these from your agent's repo (or have the agent run them):
|
|
35
35
|
|
|
36
36
|
```bash
|
|
37
|
-
npx @figs-so/cli@latest login # opens your browser
|
|
38
|
-
npx @figs-so/cli@latest
|
|
39
|
-
npx @figs-so/cli@latest init --workspace <slug> # scaffolds .figs/ (identity + a charter template)
|
|
37
|
+
npx @figs-so/cli@latest login # opens your browser — sign up & approve (the agent never sees a token)
|
|
38
|
+
npx @figs-so/cli@latest init # scaffolds .figs/ — uses your only workspace (--workspace <slug> to pick)
|
|
40
39
|
# fill in .figs/agent.json — its name, mandate, what it owns (figs doctor flags any placeholders)
|
|
41
40
|
npx @figs-so/cli@latest push # publish → it appears in your org chart
|
|
42
41
|
```
|
|
@@ -72,7 +71,7 @@ are shorthand for exactly that (always current, no version drift). Prefer a real
|
|
|
72
71
|
|---|---|
|
|
73
72
|
| `figs login` / `logout` | device-flow browser approve / remove local token |
|
|
74
73
|
| `figs workspaces [--json]` | list your workspaces (create one in the web app) |
|
|
75
|
-
| `figs init --workspace <slug
|
|
74
|
+
| `figs init [--workspace <slug>]` | generate identity + write `.figs/` (omit the flag: uses your only workspace, else lists them) |
|
|
76
75
|
| `figs doctor` | validate `.figs/` against the contract before pushing |
|
|
77
76
|
| `figs push` | one-way publish of `.figs/` |
|
|
78
77
|
| `figs status [--json]` | login / workspace / agent state |
|
package/figs.mjs
CHANGED
|
@@ -91,7 +91,7 @@ const COMMANDS = {
|
|
|
91
91
|
desc: "scaffold .figs/ here (identity + charter/contract/guide templates)",
|
|
92
92
|
more: [
|
|
93
93
|
"--workspace takes a slug (resolved to its UUID) or a raw UUID — get it from `figs workspaces`.",
|
|
94
|
-
"Omit --workspace and (logged in) it
|
|
94
|
+
"Omit --workspace and (logged in) it uses your only workspace, or lists them so you can re-run with one.",
|
|
95
95
|
"Never clobbers: an existing agent.json / CONTRACT.md / GUIDE.md / outbox is left exactly as-is.",
|
|
96
96
|
],
|
|
97
97
|
eg: "figs init --workspace acme-corp",
|
|
@@ -361,6 +361,7 @@ async function login(token) {
|
|
|
361
361
|
if (status === "approved" && r.data.token) {
|
|
362
362
|
saveToken(r.data.token)
|
|
363
363
|
console.log("figs: ✓ authorized — token saved to ~/.figs/credentials.json")
|
|
364
|
+
console.log("figs: next — run `figs init` to scaffold .figs/ here")
|
|
364
365
|
return
|
|
365
366
|
}
|
|
366
367
|
if (status === "denied") die("authorization denied")
|
|
@@ -614,9 +615,10 @@ function findPlaceholders(obj) {
|
|
|
614
615
|
* Resolve which workspace this `.figs/` belongs to. `--workspace` is optional:
|
|
615
616
|
* - given a UUID → use it as-is (no network).
|
|
616
617
|
* - given a slug → resolve to its UUID via the API (needs auth).
|
|
617
|
-
* - omitted → reuse the one already in config.json (idempotent re-init)
|
|
618
|
-
* else
|
|
619
|
-
*
|
|
618
|
+
* - omitted → reuse the one already in config.json (idempotent re-init);
|
|
619
|
+
* else use the user's only workspace (logged, so it's visible);
|
|
620
|
+
* else list them and have the agent re-run with one (when
|
|
621
|
+
* there's a real choice, the agent drives it — we never guess).
|
|
620
622
|
* Returns the workspace UUID, or exits with an actionable message.
|
|
621
623
|
*/
|
|
622
624
|
async function resolveWorkspaceId(workspaceArg, endpoint) {
|
|
@@ -639,7 +641,7 @@ async function resolveWorkspaceId(workspaceArg, endpoint) {
|
|
|
639
641
|
const existing = readJson(join(repoDir, "config.json"), null)
|
|
640
642
|
if (existing?.workspaceId) return existing.workspaceId
|
|
641
643
|
|
|
642
|
-
// First-time init with no workspace named —
|
|
644
|
+
// First-time init with no workspace named — use the only one, else list them.
|
|
643
645
|
if (!getToken()) {
|
|
644
646
|
die("which workspace? run `figs login` first so I can list them, then `figs init --workspace <slug>` (or pass a workspace UUID directly)")
|
|
645
647
|
}
|
|
@@ -649,6 +651,10 @@ async function resolveWorkspaceId(workspaceArg, endpoint) {
|
|
|
649
651
|
if (list.length === 0) {
|
|
650
652
|
die(`no workspaces yet — create one at ${endpoint}, then re-run \`figs init --workspace <slug>\``)
|
|
651
653
|
}
|
|
654
|
+
if (list.length === 1) {
|
|
655
|
+
console.log(`figs: using workspace ${list[0].slug} (${list[0].name})`)
|
|
656
|
+
return list[0].id
|
|
657
|
+
}
|
|
652
658
|
console.log("figs: which workspace? re-run init with one of these:")
|
|
653
659
|
for (const w of list) console.log(` figs init --workspace ${w.slug} (${w.name})`)
|
|
654
660
|
process.exit(1)
|