divekit init

The ‘init’ command sets up a new Divekit project environment, generating the necessary configuration files with sensible defaults.

Initializes a new Divekit distribution by creating the necessary configuration files with the simplified Version 2.0 format under .divekit/.

Usage

divekit init [flags]

Flags

  • --help: Show help information
  • No other flags; the command is interactive

Description

The divekit init command guides you through setting up a new or editing/copying an existing distribution configuration. It creates the .divekit/distributions/<name>/config.json file with sensible defaults and allows customization through an interactive flow. All generated files are placed under the .divekit/ directory to ensure consistency and avoid root-level clutter.

Key features:

  • Interactive initialization with validation and clear error messages
  • Options to create new, edit existing, or copy from another distribution
  • Automatic linking between main and test targets if secure pipeline is enabled
  • Copy of additional files like individualization.json, variation.json, individuals.json (with prompts)
  • Input validation for group IDs, paths, etc.
  • Defaults to configuration version 2.0

Initialization Flow

  1. Choose Action: Create new distribution, edit existing, or copy from another
  2. Distribution Name: Prompt for name (checks for conflicts)
  3. Repository Template: Customize naming pattern (e.g., assignment-{{uuid}})
  4. Group IDs: Enter GitLab group ID for code repositories
  5. Secure Pipeline: Optional (y/N); if enabled, prompt for test group ID
  6. Members: Path to members.json (defaults to $DIVEKIT_MEMBERS/members.json) and permissions (developer/maintainer)
  7. Save: Creates .divekit/distributions/<name>/config.json and optional files

Examples

Create a new distribution (interactive)

$ divekit init

Welcome to Divekit! This will help you create a new distribution.

What do you want to do?
> Create new distribution
  Edit existing distribution
  Copy from another distribution

? Distribution name: my-assignment
? Repository name template: assignment-{{uuid}}
? GitLab group ID for code repositories: 123456
? Enable secure pipeline? (y/N): y
? GitLab group ID for test repositories: 234567
? Path to members file: $DIVEKIT_MEMBERS/members.json
? Member permissions (developer/maintainer): developer

Configuration created at ./.divekit/distributions/my-assignment/config.json
Updating project index...

Edit an existing distribution

$ divekit init

What do you want to do?
  Create new distribution
> Edit existing distribution
  Copy from another distribution

Select distribution:
> my-assignment
  ws2024-java

Loaded ./.divekit/distributions/my-assignment/config.json
# You will be prompted for the same fields and can update values.
Saving configuration...
Updating project index...

Copy from another distribution (with optional file copy)

$ divekit init

What do you want to do?
  Create new distribution
  Edit existing distribution
> Copy from another distribution

Select source distribution:
> ws2024-java
  ws2023-java

? New distribution name: ws2024-java-b
? Copy individualization/variation configs if present? (y/N): y
? Copy individuals.json from source distribution? (y/N): n

Created:
- ./.divekit/distributions/ws2024-java-b/config.json
- ./.divekit/distributions/ws2024-java-b/variation.json (copied)
- ./.divekit/distributions/ws2024-java-b/individualization.json (copied)

Updating project index...

Generated Files

  • .divekit/distributions/<name>/config.json: Main configuration
  • Optional: .divekit/distributions/<name>/individualization.json, variation.json, individuals.json
  • No root-level files or directories like config/ or origin/ are created

Generated Configuration Example

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

Notes

  • No config/, origin/, or root-level members.json directories/files are created; everything under .divekit/
  • The CLI validates inputs and writes the distribution config by default
  • After saving, the CLI updates the local project index if available
  • For copy operations, confirm copying of sensitive files like individuals.json
  • If secure pipeline is enabled, automatic linking from main to test is added