Skip to content

Commit 1b4e50f

Browse files
MajorTalclaude
andcommitted
feat: add run402 projects keys <id> command
Prints anon_key and service_key as JSON for a single project, avoiding the need to scan `projects list` or check projects.json. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 8aeb06b commit 1b4e50f

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

cli/lib/projects.mjs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Subcommands:
1111
use <id> Set the active project (used as default for other commands)
1212
list List all your projects (IDs, URLs, active marker)
1313
info <id> Show project details: REST URL, keys
14+
keys <id> Print anon_key and service_key as JSON
1415
sql <id> "<query>" Run a SQL query against a project's Postgres DB
1516
rest <id> <table> [params] Query a table via the REST API (PostgREST)
1617
usage <id> Show compute/storage usage for a project
@@ -108,6 +109,11 @@ async function info(projectId) {
108109
}, null, 2));
109110
}
110111

112+
async function keys(projectId) {
113+
const p = findProject(projectId);
114+
console.log(JSON.stringify({ project_id: projectId, anon_key: p.anon_key, service_key: p.service_key }, null, 2));
115+
}
116+
111117
async function sqlCmd(projectId, query) {
112118
const p = findProject(projectId);
113119
const res = await fetch(`${API}/projects/v1/admin/${projectId}/sql`, { method: "POST", headers: { "Authorization": `Bearer ${p.service_key}`, "Content-Type": "text/plain" }, body: query });
@@ -185,6 +191,7 @@ export async function run(sub, args) {
185191
case "use": await use(args[0]); break;
186192
case "list": await list(); break;
187193
case "info": await info(args[0]); break;
194+
case "keys": await keys(args[0]); break;
188195
case "sql": await sqlCmd(args[0], args[1]); break;
189196
case "rest": await rest(args[0], args[1], args[2]); break;
190197
case "usage": await usage(args[0]); break;

sync.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ const SURFACE: Capability[] = [
193193
{ id: "list_projects", endpoint: "GET /wallets/v1/:wallet/projects", mcp: "list_projects", cli: "projects:list", openclaw: "projects:list" },
194194
{ id: "project_info", endpoint: "(local)", mcp: null, cli: "projects:info", openclaw: "projects:info" },
195195
{ id: "project_use", endpoint: "(local)", mcp: null, cli: "projects:use", openclaw: "projects:use" },
196+
{ id: "project_keys", endpoint: "(local)", mcp: null, cli: "projects:keys", openclaw: "projects:keys" },
196197

197198
// ── Image generation ─────────────────────────────────────────────────────
198199
{ id: "generate_image", endpoint: "POST /generate-image/v1", mcp: "generate_image", cli: "image:generate", openclaw: "image:generate" },

0 commit comments

Comments
 (0)