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

> Configure OfficeCLI auto-update settings easily with the config command. Learn how to toggle updates in this quick guide to keep your OfficeCLI up to date.

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

---

**Run `officecli config autoupdate true` or `officecli config autoupdate false` to toggle automatic background updates, which are stored in `~/.officecli/config.json` and read by the `UpdateChecker` class before spawning update threads.**

OfficeCLI provides a built-in configuration system that lets you control whether the tool automatically checks for and applies new releases in the background. The `config` command modifies a persistent JSON file located in your home directory, giving you fine-grained control over the auto-update behavior without manual file editing.

## Understanding the Auto-Update Configuration Architecture

OfficeCLI persists runtime settings in `~/.officecli/config.json`. The **AutoUpdate** field within this JSON object determines whether the binary periodically polls for newer releases and applies them silently.

When you invoke `officecli config`, the entry point in [`src/officecli/Program.cs`](https://github.com/iOfficeAI/OfficeCLI/blob/main/src/officecli/Program.cs) detects the sub-command and delegates execution to `UpdateChecker.HandleConfigCommand`. This handler uses `LoadConfig()` to read the existing configuration into memory and `SaveConfig()` to persist changes back to disk.

The configuration structure includes version tracking metadata alongside the boolean flag:

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

```

Only the `AutoUpdate` property controls the automatic upgrade path; the remaining fields are managed internally by the update checker.

## How the Config Command Works

The `HandleConfigCommand` method in [`src/officecli/Core/UpdateChecker.cs`](https://github.com/iOfficeAI/OfficeCLI/blob/main/src/officecli/Core/UpdateChecker.cs) implements a simple key-value interface:

- **Reading**: Supply only the key (`autoupdate`) to print the current value
- **Writing**: Supply a second argument to update the value using `ParseHelpers.IsTruthy` for boolean parsing

The `IsTruthy` helper (located in [`src/officecli/Core/ParseHelpers.cs`](https://github.com/iOfficeAI/OfficeCLI/blob/main/src/officecli/Core/ParseHelpers.cs)) accepts multiple affirmative inputs such as `true`, `1`, `yes`, or `on`, making the command flexible across different scripting environments.

## Step-by-Step Configuration Examples

### Checking Current Settings

To verify whether auto-updates are currently enabled without changing anything:

```bash
officecli config autoupdate

```

The output displays the raw boolean value (`true` or `false`) stored in the `AppConfig.AutoUpdate` property.

### Disabling Auto-Updates

To prevent OfficeCLI from checking for updates in the background:

```bash
officecli config autoupdate false

```

This updates the JSON file immediately and takes effect on the next process start. The `UpdateChecker.CheckInBackground()` method consults this flag before spawning any background refresh threads.

### Re-enabling Auto-Updates

To restore automatic background checks:

```bash
officecli config autoupdate true

```

Alternatively, you can use truthy synonyms accepted by the parser:

```bash
officecli config autoupdate yes
officecli config autoupdate 1

```

### Manual File Editing for Bulk Changes

When you need to modify multiple settings simultaneously, edit the raw JSON directly:

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

```

Example configuration with logging enabled but auto-updates disabled:

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

```

## How Auto-Update Affects Background Behavior

The `CheckInBackground()` method in [`src/officecli/Core/UpdateChecker.cs`](https://github.com/iOfficeAI/OfficeCLI/blob/main/src/officecli/Core/UpdateChecker.cs) evaluates `config.AutoUpdate` before initiating any network requests or download operations. If the property is set to `false`, the method returns immediately, effectively disabling the silent upgrade mechanism while preserving the ability to trigger manual updates through explicit commands.

This design ensures that corporate environments or air-gapped systems can pin a specific version without the risk of unexpected background modifications, while still maintaining the configuration infrastructure for future manual updates.

## Summary

- OfficeCLI stores auto-update preferences in `~/.officecli/config.json` under the **AutoUpdate** boolean field
- Use `officecli config autoupdate [true|false]` to toggle the setting from the command line
- The `HandleConfigCommand` function in [`UpdateChecker.cs`](https://github.com/iOfficeAI/OfficeCLI/blob/main/UpdateChecker.cs) handles argument parsing via `ParseHelpers.IsTruthy`
- When disabled, `CheckInBackground()` skips automatic version checks entirely
- Manual editing of the JSON file is safe for bulk configuration changes

## Frequently Asked Questions

### Where is the OfficeCLI configuration file stored?

The configuration file is located at `~/.officecli/config.json` within the current user's home directory. OfficeCLI creates this file automatically after the first run if it does not exist.

### What values are accepted for the autoupdate setting?

The command accepts any truthy value recognized by `ParseHelpers.IsTruthy`, including `true`, `1`, `yes`, and `on` to enable updates, or `false`, `0`, `no`, and `off` to disable them. All inputs are case-insensitive during parsing.

### Does disabling auto-update prevent manual updates?

No. Setting `autoupdate` to `false` only stops the `CheckInBackground()` method from running automatically. You can still trigger manual updates through explicit command invocations or by temporarily re-enabling the setting.

### Can I configure other settings using the same command?

Yes. The `config` command also manages the **Log** setting. For example, `officecli config log clear` wipes the log file, and `officecli config log true` enables persistent logging to disk alongside the auto-update configuration.