Home CLI guides Index Advisor CLI

Index Advisor CLI

Last updated on May 07, 2026

Current Status

There is no first-class Index Advisor command group in the current CLI implementation.

Index diagnostics are still part of the Firestruct product model, but the CLI does not yet expose the same query-shape parser, index sync controls, or remediation actions that the macOS workspace shows. Treat this page as the operator note for automation planning: it explains what can be inspected today, which GUI workflow owns the behavior, and what a future terminal interface should preserve when index checks become scriptable.

GUI-Only Coverage Today

Use the macOS Index Advisor module for:

  • query-index error explanation
  • index sync and comparison
  • copy/open/create index remediation helpers
  • deterministic query shape checks

When a Firestore query fails because a composite index is missing, capture the raw Firebase error message, the collection or collection-group target, every filter, every order clause, and the selected Firebase project/database. Open the same project in Firestruct, run or paste the query shape in Index Advisor, then use the table, tree, JSON, and logs output modes to compare the required index against current synced indexes.

For repeatable support work, keep the query definition beside the CLI command that triggered the error. That gives future CLI implementation a clear contract: accept the same path, filters, order clauses, database ID, and optional captured error, then return deterministic evidence before offering any deploy or create action.

Future CLI Shape

Expected future commands:

index-advisor explain --error error.json
index-advisor check --collection users --where "role == admin" --order-by "createdAt desc"
index-advisor sync
index-advisor copy-spec --query query.json

Future write-like behavior, such as creating an index or deploying an index file, must keep the same safety defaults as the app. The command should label the target project and environment, refuse read-only projects, require explicit confirmation for production changes, and route longer deploy work through the task system when execution is added.

Source Anchors

  • Sources/FirestructCore/IndexAdvisorService.swift
  • Sources/FirestructCore/FirestoreIndexCreationLinkSummary.swift