Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions cmd/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ func init() {
schema.Register(schema.CommandSchema{
Command: "search",
Description: "Search for content in your Glean instance via the platform API (POST /api/search); responses use its snake_case shape. Falls back to the classic API with a warning when the platform API is not enabled; GLEAN_LEGACY_APIS=1 forces the classic API. Results are JSON.",
WhenToUse: "Find documents, messages, and content across all connected datasources. Start here for any 'find X' task.",
Surface: schema.SurfacePlatform,
Flags: map[string]schema.FlagSchema{
"--json": {Type: "string", Description: "Complete JSON request body in the platform shape: query, page_size, cursor, datasources, datasource_instances, filters, time_range (overrides individual flags). With GLEAN_LEGACY_APIS=1, parsed as the classic shape", Required: false},
"--query": {Type: "string", Description: "Search query (positional arg)", Required: true},
Expand All @@ -39,6 +41,8 @@ glean search --json '{"query":"Q1 reports","page_size":5,"datasources":["conflue
schema.Register(schema.CommandSchema{
Command: "chat",
Description: "Have a conversation with Glean AI. Streams response to stdout.",
WhenToUse: "Ask Glean AI a question that needs a synthesized, cited answer reasoned over company knowledge, rather than a raw list of results.",
Surface: schema.SurfaceLegacy,
Flags: map[string]schema.FlagSchema{
"--json": {Type: "string", Description: "Complete JSON chat request body (overrides individual flags)"},
"--message": {Type: "string", Description: "Chat message (positional arg)", Required: true},
Expand All @@ -53,6 +57,8 @@ glean chat --json '{"messages":[{"author":"USER","messageType":"CONTENT","fragme
schema.Register(schema.CommandSchema{
Command: "api",
Description: "Make a raw authenticated HTTP request to any Glean REST API endpoint.",
WhenToUse: "Escape hatch: call any Glean API endpoint directly when no dedicated subcommand exists.",
Surface: schema.SurfaceRaw,
Flags: map[string]schema.FlagSchema{
"--method": {Type: "enum", Enum: []string{"GET", "POST", "PUT", "DELETE", "PATCH"}, Default: "GET", Description: "HTTP method"},
"--raw-field": {Type: "string", Description: "JSON request body as a string"},
Expand All @@ -68,13 +74,17 @@ glean chat --json '{"messages":[{"author":"USER","messageType":"CONTENT","fragme
schema.Register(schema.CommandSchema{
Command: "version",
Description: "Print the glean CLI version string.",
WhenToUse: "Check the installed CLI version, e.g. before reporting a bug or verifying an upgrade.",
Surface: schema.SurfaceLocal,
Flags: map[string]schema.FlagSchema{},
Example: `glean version`,
})

schema.Register(schema.CommandSchema{
Command: "shortcuts",
Description: "Manage Glean shortcuts (go-links). Subcommands: list, get, create, update, delete.",
WhenToUse: "Create or resolve go-links (short memorable URLs like go/roadmap).",
Surface: schema.SurfaceLegacy,
Flags: map[string]schema.FlagSchema{
"--json": {Type: "string", Description: "JSON request body (see Glean API docs for shape)"},
"--output": {Type: "enum", Enum: []string{"json", "ndjson", "text"}, Default: "json"},
Expand All @@ -87,6 +97,8 @@ glean shortcuts create --json '{"data":{"inputAlias":"test/link","destinationUrl
schema.Register(schema.CommandSchema{
Command: "agents",
Description: "Manage and run Glean agents via the platform API (/api/agents/...). list/get/schemas fall back to the classic API when the platform API is not enabled; run does not (its body shape differs per surface). GLEAN_LEGACY_APIS=1 forces the classic API. Subcommands: list, get, schemas, run.",
WhenToUse: "Discover and execute Glean agents (AI workflows). Use schemas first to learn an agent's expected input, then run.",
Surface: schema.SurfacePlatform,
Flags: map[string]schema.FlagSchema{
"--json": {Type: "string", Description: "JSON request body. get/schemas: {\"agent_id\":\"<id>\"}. run: {\"agent_id\":\"<id>\"} plus input (map) or messages ([{role, content:[{type:\"text\",text}]}])"},
"--output": {Type: "enum", Enum: []string{"json", "ndjson", "text"}, Default: "json"},
Expand All @@ -99,6 +111,8 @@ glean agents run --json '{"agent_id":"my-agent","input":{"query":"test"}}'`,
schema.Register(schema.CommandSchema{
Command: "documents",
Description: "Retrieve and summarize Glean documents. Subcommands: get, get-by-facets, get-permissions, summarize.",
WhenToUse: "Fetch full metadata, permissions, or an AI summary for documents you already identified (e.g. from search results).",
Surface: schema.SurfaceLegacy,
Flags: map[string]schema.FlagSchema{
"--json": {Type: "string", Description: "JSON request body"},
"--output": {Type: "enum", Enum: []string{"json", "ndjson", "text"}, Default: "json"},
Expand All @@ -110,6 +124,8 @@ glean agents run --json '{"agent_id":"my-agent","input":{"query":"test"}}'`,
schema.Register(schema.CommandSchema{
Command: "entities",
Description: "List and read Glean entities and people. Subcommands: list, read-people.",
WhenToUse: "Look up people (org info, contact details) or other structured entities.",
Surface: schema.SurfaceLegacy,
Flags: map[string]schema.FlagSchema{
"--json": {Type: "string", Description: "JSON request body", Required: true},
"--output": {Type: "enum", Enum: []string{"json", "ndjson", "text"}, Default: "json"},
Expand All @@ -120,6 +136,8 @@ glean agents run --json '{"agent_id":"my-agent","input":{"query":"test"}}'`,
schema.Register(schema.CommandSchema{
Command: "collections",
Description: "Manage Glean collections. Subcommands: create, delete, update, add-items, delete-item.",
WhenToUse: "Curate sets of documents into named collections.",
Surface: schema.SurfaceLegacy,
Flags: map[string]schema.FlagSchema{
"--json": {Type: "string", Description: "JSON request body"},
"--output": {Type: "enum", Enum: []string{"json", "ndjson", "text"}, Default: "json"},
Expand All @@ -131,6 +149,8 @@ glean agents run --json '{"agent_id":"my-agent","input":{"query":"test"}}'`,
schema.Register(schema.CommandSchema{
Command: "pins",
Description: "Manage Glean pins. Subcommands: list, get, create, update, remove.",
WhenToUse: "Pin a document to a search query so it always surfaces for that query.",
Surface: schema.SurfaceLegacy,
Flags: map[string]schema.FlagSchema{
"--json": {Type: "string", Description: "JSON request body"},
"--output": {Type: "enum", Enum: []string{"json", "ndjson", "text"}, Default: "json"},
Expand All @@ -142,6 +162,8 @@ glean agents run --json '{"agent_id":"my-agent","input":{"query":"test"}}'`,
schema.Register(schema.CommandSchema{
Command: "answers",
Description: "Manage Glean answers. Subcommands: list, get, create, update, delete.",
WhenToUse: "Manage curated Q&A answer cards shown for matching queries.",
Surface: schema.SurfaceLegacy,
Flags: map[string]schema.FlagSchema{
"--json": {Type: "string", Description: "JSON request body"},
"--output": {Type: "enum", Enum: []string{"json", "ndjson", "text"}, Default: "json"},
Expand All @@ -153,6 +175,8 @@ glean agents run --json '{"agent_id":"my-agent","input":{"query":"test"}}'`,
schema.Register(schema.CommandSchema{
Command: "tools",
Description: "List and run Glean tools. Subcommands: list, run.",
WhenToUse: "Discover and execute Glean tools (actions) such as creating tickets or sending messages.",
Surface: schema.SurfaceLegacy,
Flags: map[string]schema.FlagSchema{
"--json": {Type: "string", Description: "JSON request body"},
"--output": {Type: "enum", Enum: []string{"json", "ndjson", "text"}, Default: "json"},
Expand All @@ -164,6 +188,8 @@ glean agents run --json '{"agent_id":"my-agent","input":{"query":"test"}}'`,
schema.Register(schema.CommandSchema{
Command: "verification",
Description: "Manage document verification. Subcommands: list, verify, remind.",
WhenToUse: "Track and update document freshness verification (verify docs, send reminders).",
Surface: schema.SurfaceLegacy,
Flags: map[string]schema.FlagSchema{
"--json": {Type: "string", Description: "JSON request body"},
"--output": {Type: "enum", Enum: []string{"json", "ndjson", "text"}, Default: "json"},
Expand All @@ -175,6 +201,8 @@ glean agents run --json '{"agent_id":"my-agent","input":{"query":"test"}}'`,
schema.Register(schema.CommandSchema{
Command: "activity",
Description: "Report user activity and feedback. Subcommands: report, feedback.",
WhenToUse: "Report page-view activity events or submit result feedback to improve ranking.",
Surface: schema.SurfaceLegacy,
Flags: map[string]schema.FlagSchema{
"--json": {Type: "string", Description: "JSON request body (required)", Required: true},
"--dry-run": {Type: "boolean", Default: false},
Expand All @@ -185,6 +213,8 @@ glean agents run --json '{"agent_id":"my-agent","input":{"query":"test"}}'`,
schema.Register(schema.CommandSchema{
Command: "insights",
Description: "Retrieve Glean usage insights. Subcommands: get.",
WhenToUse: "Retrieve aggregate usage analytics (search/AI adoption metrics) for the deployment.",
Surface: schema.SurfaceLegacy,
Flags: map[string]schema.FlagSchema{
"--json": {Type: "string", Description: "JSON request body (required)", Required: true},
"--output": {Type: "enum", Enum: []string{"json", "ndjson", "text"}, Default: "json"},
Expand All @@ -196,6 +226,8 @@ glean agents run --json '{"agent_id":"my-agent","input":{"query":"test"}}'`,
schema.Register(schema.CommandSchema{
Command: "messages",
Description: "Retrieve Glean messages. Subcommands: get.",
WhenToUse: "Fetch a specific chat/communication message by ID.",
Surface: schema.SurfaceLegacy,
Flags: map[string]schema.FlagSchema{
"--json": {Type: "string", Description: "JSON request body (required)", Required: true},
"--output": {Type: "enum", Enum: []string{"json", "ndjson", "text"}, Default: "json"},
Expand All @@ -206,6 +238,8 @@ glean agents run --json '{"agent_id":"my-agent","input":{"query":"test"}}'`,
schema.Register(schema.CommandSchema{
Command: "announcements",
Description: "Manage Glean announcements. Subcommands: create, update, delete.",
WhenToUse: "Publish or manage company announcements surfaced in Glean.",
Surface: schema.SurfaceLegacy,
Flags: map[string]schema.FlagSchema{
"--json": {Type: "string", Description: "JSON request body (required)", Required: true},
"--output": {Type: "enum", Enum: []string{"json", "ndjson", "text"}, Default: "json"},
Expand Down
Loading