use serde_json::{Value, json};
use super::tool;
pub(super) fn project_tools() -> Vec<Value> {
vec![
tool(
"project_list",
"List all projects registered in the project registry. Returns a JSON \
array of project objects, each with `name`, `repo_url`, \
`default_branch`, and optional `stack_hint`, `tags`, `description`, \
and `gh_user` (the project's preferred GitHub account login, #2081).",
json!({
"type": "object",
"properties": {},
"additionalProperties": false
}),
),
tool(
"project_register",
"Register or update a project in the project registry. Registration \
is idempotent — calling with the same `name` updates the existing \
entry rather than creating a duplicate. Returns the registered \
project record.",
json!({
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "Short name used as the registry key (e.g. `trusty-tools`)."
},
"repo_url": {
"type": "string",
"description": "Full repository URL (e.g. `https://github.com/owner/trusty-tools`)."
},
"default_branch": {
"type": "string",
"description": "Default branch for session spawns. Defaults to `main` when omitted."
},
"stack_hint": {
"type": "string",
"description": "Optional technology-stack hint (e.g. `rust`, `python`)."
},
"tags": {
"type": "array",
"items": { "type": "string" },
"description": "Optional classification tags (e.g. [\"backend\", \"production\"])."
},
"description": {
"type": "string",
"description": "Optional free-form human-readable description."
},
"gh_user": {
"type": "string",
"description": "Optional preferred GitHub account login for `gh` \
operations on this project (#2081). When set, `gh` \
calls for this project should be scoped to this \
account rather than whatever identity is ambient."
},
"gh_account": {
"type": "string",
"description": "Optional GitHub account login pinned for THIS \
project's spawned sessions (#3025). When set, every \
session spawn/relaunch resolves `gh auth token -u \
<gh_account>` and injects GH_TOKEN/GH_USER into the \
session's environment, so `gh` identity is \
deterministic regardless of the global `gh auth \
switch` state."
}
},
"required": ["name", "repo_url"],
"additionalProperties": false
}),
),
tool(
"project_get",
"Look up a single project by name. Returns the project record \
(`name`, `repo_url`, `default_branch`, and optional fields including \
`gh_user`, the project's preferred GitHub account login) or an \
error when the name is not found in the registry.",
json!({
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "Project name to look up."
}
},
"required": ["name"],
"additionalProperties": false
}),
),
tool(
"project_resolve",
"Resolve a natural-language query to the best-matching registered \
project. Accepts free-text task descriptions, GitHub URLs, ticket \
IDs (e.g. PROJ-123), project names, keywords, or tags. Returns a \
`primary` match with confidence score and reason, a \
`needs_disambiguation` flag (true when multiple candidates score \
above the disambiguation floor), and a ranked `matches` list. \
Confidence is always in [0.0, 1.0]. On no match, `primary` is null \
and an `error` field explains the failure.",
json!({
"type": "object",
"properties": {
"query": {
"type": "string",
"description": "Free-text query: project name, GitHub URL, \
ticket ID, keyword, or any natural-language \
task description."
}
},
"required": ["query"],
"additionalProperties": false
}),
),
]
}