graphstore-cli
Advanced tools
+14
-10
@@ -54,4 +54,4 @@ #!/usr/bin/env node | ||
| } | ||
| var p = new Command().name("graphstore").alias("gs").description("Agent-first graph storage CLI").option("--json", "emit JSON").option("--quiet", "emit only the primary value").option("--url <url>", "Graphstore API base URL").option("--key <key>", "graph API key"); | ||
| var auth = p.command("auth"); | ||
| var p = new Command().name("graphstore").alias("gs").description("Agent-first graph storage CLI").addHelpText("after", "\nAgent quickstart:\n export GRAPHSTORE_URL=https://graphstore.helixdata.workers.dev\n export GRAPHSTORE_API_KEY=gsk_live_...\n gs data hello\n\nRun `gs <command> --help` for command-specific examples.").option("--json", "emit JSON").option("--quiet", "emit only the primary value").option("--url <url>", "Graphstore API base URL").option("--key <key>", "graph API key"); | ||
| var auth = p.command("auth").description("Sign in, sign out, and manage sessions"); | ||
| auth.command("login").requiredOption("--email <email>").action(async (o) => { | ||
@@ -84,3 +84,3 @@ const c = await config(); | ||
| auth.command("session-revoke <id>").action(async (id) => print(await request(`/auth/sessions/${id}`, { method: "DELETE" }), { json: p.opts().json })); | ||
| var graph = p.command("graph"); | ||
| var graph = p.command("graph").description("Manage graphs and scoped API keys"); | ||
| graph.command("list").action(async () => print(await request("/account/graphs"), { json: p.opts().json })); | ||
@@ -109,4 +109,4 @@ graph.command("create <name>").option("--slug <slug>").option("--description <text>").action(async (name, o) => print(await request("/account/graphs", { method: "POST", body: { name, slug: o.slug, description: o.description } }), { json: p.opts().json })); | ||
| graph.command("key-revoke <id>").action(async (id) => print(await request(`/account/keys/${id}`, { method: "DELETE" }), { json: p.opts().json })); | ||
| var data = p.command("data"); | ||
| data.command("hello").action(async () => print(await request("/v1/hello"), { json: p.opts().json })); | ||
| var data = p.command("data").description("Read and write the graph selected by the API key"); | ||
| data.command("hello").description("Orient an agent: guide, node types, relationships, indexes, and limits").action(async () => print(await request("/v1/hello"), { json: p.opts().json })); | ||
| data.command("guide").option("--set <text>").option("--append <text>").action(async (o) => print(await request("/v1/guide", o.set ? { method: "PUT", body: { guide: o.set } } : o.append ? { method: "PATCH", body: { append: o.append } } : { method: "GET" }), { json: p.opts().json })); | ||
@@ -116,3 +116,3 @@ data.command("guide-revisions").action(async () => print(await request("/v1/guide/revisions"), { json: p.opts().json })); | ||
| data.command("stats").action(async () => print(await request("/v1/stats"), { json: p.opts().json })); | ||
| data.command("node-create").requiredOption("--type <type>").option("--body <body>").option("--prop <pairs...>").action(async (o) => { | ||
| data.command("node-create").description("Create a node").requiredOption("--type <type>", "node type from the graph guide").option("--body <body>", "searchable long-form content").option("--prop <pairs...>", "property assignments such as status=open priority=5").addHelpText("after", '\nExample:\n gs data node-create --type task --body "Ship it" --prop status=open priority=5').action(async (o) => { | ||
| const props = Object.fromEntries((o.prop || []).map((x) => { | ||
@@ -124,3 +124,3 @@ const i = x.indexOf("="); | ||
| }); | ||
| data.command("node-list").option("--type <type>").option("--cursor <cursor>").option("--limit <n>", "page size").action(async (o) => print(await request("/v1/nodes?" + new URLSearchParams(Object.fromEntries(Object.entries({ type: o.type, cursor: o.cursor, limit: o.limit }).filter(([, v]) => v)))), { json: p.opts().json })); | ||
| data.command("node-list").description("List graph nodes with cursor pagination").option("--type <type>", "filter by node type").option("--cursor <cursor>", "cursor returned by the previous page").option("--limit <n>", "page size, maximum 500").action(async (o) => print(await request("/v1/nodes?" + new URLSearchParams(Object.fromEntries(Object.entries({ type: o.type, cursor: o.cursor, limit: o.limit }).filter(([, v]) => v)))), { json: p.opts().json })); | ||
| data.command("node-get <id>").action(async (id) => print(await request(`/v1/nodes/${id}`), { json: p.opts().json })); | ||
@@ -137,7 +137,11 @@ data.command("node-update <id>").option("--type <type>").option("--body <body>").option("--prop <pairs...>").action(async (id, o) => { | ||
| data.command("edge-list").option("--src <id>").option("--dst <id>").option("--rel <rel>").action(async (o) => print(await request("/v1/edges?" + new URLSearchParams(Object.fromEntries(Object.entries(o).filter(([, v]) => v)))), { json: p.opts().json })); | ||
| data.command("search <text>").action(async (text) => print(await request("/v1/search?" + new URLSearchParams({ q: text })), { json: p.opts().json })); | ||
| data.command("search <text>").description("Full-text search node bodies and properties").action(async (text) => print(await request("/v1/search?" + new URLSearchParams({ q: text })), { json: p.opts().json })); | ||
| data.command("index-list").action(async () => print(await request("/v1/indexes"), { json: p.opts().json })); | ||
| data.command("index-create <path>").option("--type <type>", "text, number, integer, or boolean", "text").action(async (path, o) => print(await request("/v1/indexes", { method: "POST", body: { path, type: o.type } }), { json: p.opts().json })); | ||
| data.command("index-delete <id>").action(async (id) => print(await request(`/v1/indexes/${id}`, { method: "DELETE" }), { json: p.opts().json })); | ||
| data.command("query [file]").option("--stdin", "read query JSON from standard input").option("--json-query <json>", "inline query JSON").action(async (file2, o) => { | ||
| data.command("query [file]").description("Run a structured JSON filter or traversal query").option("--stdin", "read query JSON from standard input (recommended for LLMs)").option("--json-query <json>", "inline query JSON").addHelpText("after", ` | ||
| LLM/pipeline example: | ||
| printf '%s' '{"type":"task","where":[{"path":"$.status","op":"eq","value":"open"}]}' | gs data query --stdin | ||
| Operators: eq, neq, gt, gte, lt, lte, in, contains, exists, starts_with`).action(async (file2, o) => { | ||
| const sources = [Boolean(file2), Boolean(o.stdin), Boolean(o.jsonQuery)].filter(Boolean).length; | ||
@@ -162,3 +166,3 @@ if (sources !== 1) throw Error("Provide exactly one of a file, --stdin, or --json-query"); | ||
| data.command("import <file>").action(async (file2) => print(await request("/v1/import", { method: "POST", body: JSON.parse(await readFile(file2, "utf8")) }), { json: p.opts().json })); | ||
| var account = p.command("account"); | ||
| var account = p.command("account").description("Manage members, audit records, and backups"); | ||
| account.command("members").action(async () => print(await request("/account/members"), { json: p.opts().json })); | ||
@@ -165,0 +169,0 @@ account.command("invite <email>").option("--role <role>", "member or admin", "member").action(async (email, o) => print(await request("/account/members/invite", { method: "POST", body: { email, role: o.role } }), { json: p.opts().json })); |
+1
-1
| { | ||
| "name": "graphstore-cli", | ||
| "version": "0.1.3", | ||
| "version": "0.1.4", | ||
| "description": "CLI for the Graphstore agent-first graph database", | ||
@@ -5,0 +5,0 @@ "type": "module", |
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
16094
8.89%183
2.81%4
33.33%