pub fn run(emit: bool, reference: bool) {
if emit {
print_skill_file();
} else if reference {
print_reference();
} else {
print_guide();
}
}
fn print_guide() {
println!(
r#"rigg AI Skill Setup
====================
rigg is a configuration-as-code tool for Azure AI Search and Microsoft
Foundry. A skill helps AI agents manage search indexes, Foundry agents,
knowledge bases, and other Azure AI resources.
To create the skill file, run:
rigg ai skill --emit > ~/.claude/skills/rigg.md
Or ask your AI agent:
"Use `rigg ai skill --emit` to set up a skill for managing Azure AI Search"
The skill instructs the AI agent to run `rigg ai skill --reference` at
runtime to fetch full documentation, so the agent always has up-to-date
command details and workflow patterns without bloating the skill file itself.
Note: rigg also provides an MCP server for direct tool integration:
rigg mcp install claude-code
"#
);
}
fn print_skill_file() {
print!(
r#"---
name: rigg
description: Configuration-as-code for Azure AI Search and Microsoft Foundry — manage search indexes, indexers, skillsets, knowledge bases, knowledge sources, Foundry agents, and more.
---
# rigg — Azure AI Search & Foundry Config-as-Code
Use this skill when the user is working with rigg, Azure AI Search, or
Microsoft Foundry configuration. A rigg workspace (`rigg.yaml`) holds
environments; projects (`projects/<name>/`) own resource definitions as JSON
files. Pull, push, and diff operate on whole projects.
## Getting detailed reference
Run this command for comprehensive documentation:
```
rigg ai skill --reference
```
It prints the complete CLI command tree and the MCP tool table, generated
from the installed binary, so it always matches the version on this machine.
Run `rigg concepts` for the workspace/project model.
## MCP server
If the rigg MCP server is available, prefer using MCP tools for structured
operations: `rigg_status`, `rigg_describe`, `rigg_env_list`, `rigg_validate`,
`rigg_diff`, `rigg_pull`, `rigg_push`, `rigg_promote`, `rigg_delete`,
`rigg_indexer_run`, `rigg_indexer_status`, `rigg_query`, `rigg_ask`,
`rigg_verify`.
Mutating tools (pull, push, promote, delete) use a two-step pattern: call
without `force` for a preview, then with `force: true` to execute.
## Quick command reference
| Task | Command |
|------|---------|
| Workspace status | `rigg status` |
| Describe the workspace | `rigg describe` |
| Validate local files | `rigg validate --strict` |
| Diff against Azure | `rigg diff --all` |
| Pull from Azure | `rigg pull --all` |
| Preview a push | `rigg push --all --dry-run` |
| Push to Azure | `rigg push --all` |
| Prove the stack works | `rigg verify <project>` |
| Adopt unmanaged resources | `rigg adopt <project> <selector>` |
| Promote an environment | `rigg promote <project> --from dev --to prod` |
| New project | `rigg new project <name>` |
| New resource | `rigg new <kind> <name> --project <project>` |
| Scaffold a RAG pipeline | `rigg new pipeline <name> --project <project>` |
| Delete from Azure | `rigg delete <project> --remote` |
| List environments | `rigg env list` |
| Check Azure auth | `rigg auth doctor` |
## Safety rules
- Never write secrets into project files; rigg uses identity-based access
(`ResourceId=` connection strings, `ProjectManagedIdentity`).
- Remote deletion is always explicit: `rigg push --prune` for orphans, or
`rigg delete <project> --remote`.
- Protected environments need `--confirm-env <env>`.
"#
);
}
fn print_reference() {
print!(
"<!-- Generated by `rigg ai skill --reference` — do not edit by hand. -->\n\
Two sections follow: every rigg command, argument and option read off\n\
this binary's own command tree, then the tools the `rigg mcp serve`\n\
server exposes.\n\n"
);
print!("{}", crate::commands::docgen::cli_reference_markdown());
print!("\n## MCP tools\n\n");
print!("{}", crate::mcp::tools_markdown());
}