OfficeCLI Configuration File Location and JSON Format Explained

OfficeCLI stores its configuration in ~/.officecli/config.json as a plain UTF-8 JSON file containing camel-cased properties like autoUpdate, log, and timestamps.

The OfficeCLI runtime creates and manages a lightweight configuration system for per-user settings. This guide maps the exact storage location, schema, and serialization logic used by the tool based on the iOfficeAI/OfficeCLI source code.

Where OfficeCLI Configuration Is Stored

OfficeCLI resolves its configuration directory at runtime using a cross-platform pattern that respects the user's home folder.

Component Path Source
Configuration directory ~/.officecli UpdateChecker.ConfigDir concatenates Environment.SpecialFolder.UserProfile with .officecli
Full file path ~/.officecli/config.json Path.Combine(ConfigDir, "config.json")

The path construction happens in [src/officecli/Core/UpdateChecker.cs](https://github.com/iOfficeAI/OfficeCLI/blob/main/src/officecli/Core/UpdateChecker.cs), lines 28–30:

// From UpdateChecker.cs
private static string ConfigDir => Path.Combine(
    Environment.GetFolderPath(Environment.SpecialFolder.UserProfile),
    ".officecli"
);
private static string ConfigPath => Path.Combine(ConfigDir, "config.json");

If the directory or file does not exist, UpdateChecker.LoadConfig() creates both automatically with an empty JSON object {}.

config.json Format and Schema

The OfficeCLI config.json file uses camel-case property names serialized via System.Text.Json with the AppConfigContext source generator. The schema mirrors the AppConfig class found in the generated AppConfig.g.cs file.

Supported Configuration Properties

Property Type Purpose
autoUpdate boolean Enables or disables the daily automatic update check
log boolean Activates internal file logging to officecli.log in the same directory
lastUpdateCheck ISO-8601 string Timestamp of the most recent background update check
latestVersion string Latest version discovered by the updater mechanism
lastSkillRefreshVersion string Version of the binary that last refreshed skills
installedBinaryVersion string Version of the most recently installed binary

All properties are optional with sensible defaults handled by the CLI.

Sample config.json File

{
  "autoUpdate": true,
  "log": false,
  "lastUpdateCheck": "2024-01-15T09:30:00Z",
  "latestVersion": "1.4.2",
  "lastSkillRefreshVersion": "1.4.0",
  "installedBinaryVersion": "1.4.1"
}

How to Read and Modify OfficeCLI Configuration

Using the CLI Command

OfficeCLI provides a native config subcommand for inspection and updates:


# Display current configuration (pretty-printed JSON)

officecli config

# Enable automatic updates

officecli config autoUpdate true

# Disable file logging

officecli config log false

# Update a timestamp field directly

officecli config lastUpdateCheck "2024-01-20T14:00:00Z"

The config command handler in src/officecli/Program.cs parses arguments and delegates to UpdateChecker.SaveConfig() to persist changes.

Direct File Inspection

Since the format is plain JSON, you can read or edit the file directly:


# View raw configuration

cat "$HOME/.officecli/config.json"

# Pretty-print with jq

jq . "$HOME/.officecli/config.json"

# Edit with your preferred editor

nano "$HOME/.officecli/config.json"

Programmatic Access (C#)

For extension development or testing, access the configuration through the same API the CLI uses:

using OfficeCLI.Core;

// Load existing or create default configuration
var config = UpdateChecker.LoadConfig();

// Read properties
if (config.AutoUpdate)
{
    Console.WriteLine($"Update check scheduled. Last run: {config.LastUpdateCheck}");
}

// Modify and save
config.Log = true;
config.LastUpdateCheck = DateTime.UtcNow.ToString("O");
UpdateChecker.SaveConfig(config);

Key Source Files for Configuration Logic

File Responsibility
src/officecli/Core/UpdateChecker.cs Defines ConfigDir, ConfigPath, LoadConfig(), and SaveConfig(); contains AppConfig data model
src/officecli/Core/AppConfig.g.cs Source-generated AppConfig class with System.Text.Json serialization attributes
src/officecli/Program.cs Implements officecli config <key> [value] argument parsing and invocation
src/officecli/Core/CliLogger.cs Consumes the log property to conditionally write to ~/.officecli/officecli.log

The serialization uses System.Text.Json with default options, meaning no custom naming policy is applied—property names match the C# property declarations exactly in camel case.

Summary

  • OfficeCLI configuration lives at ~/.officecli/config.json, resolved via Environment.SpecialFolder.UserProfile
  • The file is UTF-8 JSON with camel-cased properties managed by System.Text.Json
  • Six properties control auto-updates, logging, and version tracking
  • Modify settings via officecli config commands or direct file editing
  • UpdateChecker.cs (lines 28–30 and beyond) implements all read/write logic

Frequently Asked Questions

What happens if config.json is deleted or corrupted?

OfficeCLI recreates the file automatically on next startup. UpdateChecker.LoadConfig() detects missing or invalid files and returns a default AppConfig instance with all properties set to their zero values (false, null). The file is rewritten with valid JSON on the next SaveConfig() call.

Can I change the configuration directory location?

No—the path is hardcoded in UpdateChecker.cs as .officecli under UserProfile. There is no environment variable or command-line flag to override this location in the current implementation.

Does OfficeCLI support configuration profiles or multiple configs?

The current implementation supports only a single user-level configuration. There is no built-in mechanism for project-specific or environment-specific profiles. All invocations of officecli share the same ~/.officecli/config.json file regardless of working directory.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →