divekit config

The ‘config’ command manages CLI configuration settings, similar to ‘git config’, allowing you to customize the CLI behavior.

Usage

divekit config <command> [flags]

Available Commands

  • get [key] - Get a configuration value
  • set [key] [value] - Set a configuration value

Flags

  • --token <value> - Set the access token directly (for host URLs, only in set command; usually resolved from OS credential manager)
  • --help - Show help information

Description

The divekit config command allows you to view and modify your Divekit configuration settings using subcommands get and set. It supports aliases for targeting different configuration files and provides validation for all changes.

Key features:

  • Configuration management
  • CLI access for getting and setting values
  • Schema validation
  • Security best practices for sensitive data
  • Environment variable override support (e.g., DIVEKIT_MEMBERS)
$ divekit config

Usage:
  divekit config <command>

Available Commands:
  get          Get configuration values
  set          Set configuration values

For more information about a command, run:
  divekit config <command> --help

Configuration Aliases

The divekit config command uses special aliases to target different configuration files:

  • @hosts: Targets the global hosts.json file for GitLab remote configurations
  • @origin.<distribution>: Targets the config.json for a specific distribution
  • @origin.<distribution>.remotes.*: Targets the remotes.json for that distribution

Examples

Managing GitLab Hosts

Simplified Hosts Syntax

# Set up a new GitLab host (automatic token prompt)
divekit config set @hosts git-nrw https://gitlab.git.nrw/

# With direct token
divekit config set @hosts git-nrw https://gitlab.git.nrw/ --token glpat-xxx...

# Get host information
divekit config get @hosts.git-nrw

Traditional Syntax

# Set host URL
divekit config set @hosts.git-nrw.host https://gitlab.git.nrw/

# Set token
divekit config set @hosts.git-nrw.token glpat-xxx...

Managing Distribution Configuration

# Set repository name template
divekit config set @origin.my-distribution.name "assignment-{{uuid}}"

# Get current group ID
divekit config get @origin.my-distribution.groupId

# Update member permissions
divekit config set @origin.my-distribution.members.permissions "maintainer"

# Set remote URL for distribution
divekit config set @origin.main.remotes.gitlab.url https://gitlab.com/my-group/my-project

Managing Members

Members are typically managed through the members.json file referenced in your distribution configuration. The file should contain an array of member objects:

{
  "members": [
    {"username": "alice", "name": "Alice Johnson"},
    {"username": "bob", "name": "Bob Smith"},
    {"username": "charlie", "name": "Charlie Brown"}
  ]
}

Credentials and Security

  • Tokens are stored in your operating system’s credential manager (macOS Keychain, Windows Credential Manager, Linux Secret Service). They are NOT written to hosts.json.
  • The file ~/.divekit/hosts.json stores only host metadata and a token-key reference (the key used to retrieve the token from the OS credential store).
  • Configure hosts using:
    # Prompts for token and stores it in the OS credential manager
    divekit config set @hosts git-nrw https://gitlab.git.nrw/
    
    # Or provide the token explicitly (useful for non-interactive setups)
    divekit config set @hosts git-nrw https://gitlab.git.nrw/ --token glpat-xxx...
    
  • Optional: DIVEKIT_MEMBERS can be used to provide a global default path to your members.json (can also be configured per distribution):
    export DIVEKIT_MEMBERS="/path/to/members.json"
    

Configuration Migration (Planned)

  • Automatic migration from v1.0 to v2.0 format when reading legacy files
  • Schema validation and auto-migration capabilities
  • Security warnings for sensitive member data placement with suggested secure alternatives

Configuration File Structure

The config.json file uses the Version 2.0 flat format:

{
  "version": "2.0",
  "remote": "default",
  "groupId": 123456,
  "name": "assignment-{{uuid}}",
  "members": {
    "path": "$DIVEKIT_MEMBERS/members.json",
    "permissions": "developer"
  },
  "securePipeline": {
    "enabled": true,
    "groupId": 234567
  }
}

Notes

  • Supports dot notation for nested keys (e.g., members.permissions)
  • Invalid values trigger specific error messages with correction guidance
  • Automatic backup of configuration files before modifications
  • Environment variable overrides for CI/CD scenarios