---
title: "Set gitops repo"
description: "Writes the gitops.repo field on an env entry in ~/.log10x/envs.json so configure_engine can open cap-CSV PRs."
icon: material/source-branch-plus
---

Targeted writer for the `gitops.repo` field on an env entry in `~/.log10x/envs.json`.

Call this when [Engine PR](configure-engine.md) reports a missing gitops repo and the agent wants to avoid re-running [Configure env](../account/configure-env.md), which insists on a live backend re-validation.

After writing, the MCP server must restart to pick up the change.

## :material-code-braces: Example

!!! tenx-ask "You"

    set gitops repo acme/log10x-config

!!! tenx-answer "Log10x"

    gitops.repo set to `acme/log10x-config` on env "prod".

    Restart the MCP server, then re-run configure_engine.

## :material-chat-question-outline: More to ask

- *"point gitops at acme-corp/platform-config on env staging"*
- *"override the cap-CSV path to pipelines/run/receive/rate/prod-caps.csv"*
- *"update gitops repo on the default env"*

## :material-check-decagram-outline: Prerequisites

An env entry must already exist in `~/.log10x/envs.json`. Run [Configure env](../account/configure-env.md) first if the file is missing or empty.

## :material-code-json: Schema and samples

??? tenx-input-example "Input example"

    Representative call (synthetic, not captured from the live demo env).

    ```json
    {
      "gitops_repo": "acme/log10x-config",
      "confirm": "set-now"
    }
    ```

??? tenx-input-schema "Input schema"

    Agent-facing JSON Schema (the canonical shape the MCP server publishes via `tools/list`):

    ```json
    {
      "type": "object",
      "properties": {
        "gitops_repo": {
          "type": "string",
          "pattern": "^[^/\\s]+\\/[^/\\s]+$",
          "description": "GitHub repo where configure_engine will open cap-CSV PRs. Format: `owner/repo` (e.g. `acme-corp/platform-config`). Must match the repo your team uses for gitops. configure_engine will create a branch and PR here."
        },
        "environment": {
          "type": "string",
          "description": "Nickname of the env entry to update (from `~/.log10x/envs.json`). Omit to update the default env (the entry with `isDefault: true`, or the only entry if there is just one)."
        },
        "gitops_lookup_path": {
          "type": "string",
          "description": "Override the path inside the repo where configure_engine looks for the cap-CSV (default: `pipelines/run/receive/rate/caps.csv`). Omit to keep the default."
        },
        "confirm": {
          "type": "string",
          "const": "set-now",
          "description": "Safety gate: must be the literal string `\"set-now\"` to write. This prevents accidental invocations from an agent chain that threads the args wrong."
        }
      },
      "required": [
        "gitops_repo",
        "confirm"
      ],
      "additionalProperties": false
    }
    ```

    Source: [`src/tools/set-gitops-repo.ts`](https://github.com/log-10x/log10x-mcp/blob/main/src/tools/set-gitops-repo.ts).

??? tenx-output-example "Output example"

    Representative envelope (synthetic, not captured from the live demo env). `view: "summary"` returns the full `StructuredOutput` with typed `data`.

    Headline (the 1-line agent-facing answer):

    > _gitops.repo set to `acme/log10x-config` on env "prod"._

    ```json
    {
      "schema_version": "1.0",
      "schema_epoch": "2026-05-25",
      "tool": "log10x_set_gitops_repo",
      "generated_at": "2026-06-05T12:00:00.000Z",
      "view": "summary",
      "summary": {
        "headline": "gitops.repo set to `acme/log10x-config` on env \"prod\"."
      },
      "data": {
        "ok": true,
        "action": "set",
        "nickname": "prod",
        "gitops_repo": "acme/log10x-config",
        "gitops_lookup_path": null,
        "envs_json_path": "/home/agent/.log10x/envs.json",
        "previous_gitops_repo": null,
        "restart_required": true,
        "human_summary": "gitops.repo set to `acme/log10x-config` on env \"prod\".\n\nenvs.json written at /home/agent/.log10x/envs.json.\nThe MCP server must restart to pick up the change.\nRun log10x_dev_restart, or restart the MCP server process manually.\nAfter restart, retry log10x_configure_engine. It will resolve gitops_repo from the updated env."
      },
      "actions": [],
      "truncated": false,
      "warnings": []
    }
    ```

??? tenx-output-schema "Output schema"

    The `data` block inside the [StructuredOutput envelope](../index.md#json-by-default-output):

    ```typescript
    interface ToolData {
      ok: boolean;
      action?: 'set' | 'updated';
      nickname?: string;
      gitops_repo?: string;
      gitops_lookup_path?: string | null;
      envs_json_path?: string;
      previous_gitops_repo?: string | null;
      restart_required?: boolean;
      human_summary?: string;
      error?: string;
    }
    ```

    Envelope-level fields the agent should also read: `summary.headline` (1-line answer), `actions[]` (next-call chain hints as `{tool, args, reason}`), `truncated: boolean`, `images[]` (PNG attachments where applicable), `schema_epoch` (engine-ID stability boundary).
