# How to Configure Auto-Update Settings for OfficeCLI Using the Config Command

> Easily configure OfficeCLI auto-update settings with the config command. Enable or disable background updates to keep your CLI current. Learn how now.

- Repository: [OfficeAI/OfficeCLI](https://github.com/iofficeai/OfficeCLI)
- Tags: how-to-guide
- Published: 2026-07-17

---

**Use `officecli config autoupdate true` to enable automatic background updates, or `officecli config autoupdate false` to disable them, with settings persisted in `~/.officecli/config.json`.**

The iOfficeAI/OfficeCLI repository provides a built-in configuration system that lets you control automatic update behavior through simple command-line arguments. Understanding how to configure auto-update settings for OfficeCLI ensures you can maintain security patches on schedule or freeze versions for reproducible environments.

## Understanding the Auto-Update Configuration

OfficeCLI stores its runtime configuration in a JSON file located at `~/.officecli/config.json` within the current user’s home directory. The **`AutoUpdate`** field in this file determines whether the binary periodically checks for newer releases and applies them in the background.

### Configuration File Structure

The configuration file tracks several properties, but only `AutoUpdate` controls the automatic upgrade path:

```json
{
  "AutoUpdate": true,
  "Log": false,
  "InstalledBinaryVersion": "1.0.137",
  "LastUpdateCheck": "2026-07-17T12:34:56Z",
  "LatestVersion": "1.0.150"
}

```

When `AutoUpdate` is set to `false`, the background check is skipped entirely, allowing you to control updates manually.

### Command Routing in Program.cs

When you run `officecli config …`, the program parses arguments in **[`src/officecli/Program.cs`](https://github.com/iOfficeAI/OfficeCLI/blob/main/src/officecli/Program.cs)** within the `if (args.Length >= 2 && args[0] == "config")` block. This detection logic delegates the work to `UpdateChecker.HandleConfigCommand`, which handles the actual reading and writing of configuration values.

## Reading and Modifying Auto-Update Settings

The `HandleConfigCommand` method in [`src/officecli/Core/UpdateChecker.cs`](https://github.com/iOfficeAI/OfficeCLI/blob/main/src/officecli/Core/UpdateChecker.cs) reads the current configuration via `LoadConfig()` and supports both read and write operations.

### Check Current Auto-Update Status

To view the current setting without changing it, supply only the configuration key:

```bash
officecli config autoupdate

# → true   (or false, depending on your current config)

```

This prints the stored value for the `autoupdate` key directly from the JSON configuration.

### Enable or Disable Automatic Updates

To modify the setting, provide a second argument with the desired boolean value:

```bash

# Disable automatic updates

officecli config autoupdate false

# Output: autoupdate = false

# Re-enable automatic updates

officecli config autoupdate true

# Output: autoupdate = true

```

When writing values, the command updates the `AppConfig.AutoUpdate` property and persists the change using `SaveConfig()`.

### Truthy Value Parsing

The configuration parser uses **`ParseHelpers.IsTruthy`** from [`src/officecli/Core/ParseHelpers.cs`](https://github.com/iOfficeAI/OfficeCLI/blob/main/src/officecli/Core/ParseHelpers.cs) to interpret values. This accepts multiple representations of boolean truth, including `true`, `1`, `yes`, and `on`, making the command flexible for different scripting environments.

## How Auto-Update Works Under the Hood

The actual update logic resides in `UpdateChecker.CheckInBackground()`, which consults `config.AutoUpdate` before spawning a background refresh. If the property is set to `false`, the background check is bypassed entirely, preventing any network calls to check for newer versions.

According to the source code in [`src/officecli/Core/UpdateChecker.cs`](https://github.com/iOfficeAI/OfficeCLI/blob/main/src/officecli/Core/UpdateChecker.cs) (lines 30-48), this check occurs early in the application lifecycle, ensuring that disabled updates impose no network overhead.

## Manual Configuration Methods

While the CLI command is the recommended approach, you can also edit the configuration directly for batch changes or automation scripts.

### View Raw Configuration

Inspect the current settings by reading the JSON file directly:

```bash
cat ~/.officecli/config.json

```

### Edit Configuration Manually

For environments where you need to change multiple keys simultaneously, open the file in your preferred editor:

```bash
$EDITOR ~/.officecli/config.json

```

Example manual configuration:

```json
{
  "AutoUpdate": false,
  "Log": true,
  "InstalledBinaryVersion": "1.0.137",
  "LastUpdateCheck": "2026-07-17T12:34:56Z",
  "LatestVersion": "1.0.150"
}

```

After saving, subsequent OfficeCLI invocations will respect the new `AutoUpdate` value immediately without requiring a restart.

## Summary

- **Configuration location**: `~/.officecli/config.json` stores the `AutoUpdate` boolean field that controls background updates.
- **Command syntax**: `officecli config autoupdate [value]` reads or writes the setting, with values parsed by `ParseHelpers.IsTruthy`.
- **Source implementation**: [`src/officecli/Program.cs`](https://github.com/iOfficeAI/OfficeCLI/blob/main/src/officecli/Program.cs) routes config commands to `UpdateChecker.HandleConfigCommand`, which uses `LoadConfig()` and `SaveConfig()` to persist changes.
- **Background behavior**: `UpdateChecker.CheckInBackground()` checks `config.AutoUpdate` before attempting network updates; setting it to `false` disables automatic checks entirely.
- **Flexibility**: Both CLI commands and direct JSON editing are supported, with changes taking effect immediately on the next command execution.

## Frequently Asked Questions

### Where does OfficeCLI store its auto-update configuration?

OfficeCLI persists settings in `~/.officecli/config.json` within the current user's home directory. This JSON file contains the `AutoUpdate` field alongside version tracking and logging preferences. The file is created automatically after the first run if it does not exist.

### What values can I use when setting autoupdate via the command line?

The `officecli config autoupdate` command accepts any truthy value recognized by `ParseHelpers.IsTruthy`, including `true`, `1`, `yes`, or `on` to enable updates, and `false`, `0`, `no`, or `off` to disable them. The parser is case-insensitive for these inputs.

### Does disabling auto-update prevent me from manually updating OfficeCLI?

No. Setting `autoupdate` to `false` only stops the background check in `UpdateChecker.CheckInBackground()`. You can still trigger manual updates through explicit update commands or by reinstalling the binary. The setting merely controls the automatic background behavior.

### How do I verify that my auto-update configuration change was applied successfully?

Run `officecli config autoupdate` without a value argument to read the current setting, or execute `cat ~/.officecli/config.json` to inspect the raw JSON. The change takes effect immediately, and the next command execution will respect the new value without requiring an application restart.