npm package: @gogd-core/ggd
Description: GoGoodDev workspace CLI
Latest version: 0.1.9

# @gogd-core/ggd

GoGoodDev workspace CLI — a unified command-line tool for environment management, git workflows, and Jenkins CI integration.

## Install

```bash
npm install -g @gogd-core/ggd
```

Shell tab-completion is auto-installed on `npm install -g` (bash, zsh, powershell).

## Requirements

- Node.js 20+

## Commands

### `ggd env` — Environment Management

```bash
ggd env use <name>    # Switch to a named environment
```

### `ggd run` — Execute Shell Commands

```bash
ggd run <command...>  # Run any shell command via cross-platform executor
```

### `ggd rsh` — Git Reset Hard (Safe)

Reset current branch to `origin/<branch>` with safety checks.

```bash
ggd rsh
```

Shows current branch name and uncommitted change count before prompting for confirmation. Prevents accidental data loss.

### `ggd mt` — Merge Tool

Merge current branch into a target branch with automatic branch management.

```bash
ggd mt <target-branch>
```

Switches to the target branch (re-creates from origin if it exists locally), then merges the source branch with confirmation.

### `ggd jenkins` — Jenkins CI Integration

Trigger and monitor Jenkins builds from the terminal.

#### Setup

```bash
# Interactive setup (manual entry)
ggd jenkins setup

# Setup with a team preset file (recommended)
ggd jenkins setup --preset <path-to-preset.json>
```

Saves config to `~/.ggd/jenkins.json`. Re-running setup preserves existing values.

#### Build

```bash
# List available build targets
ggd jenkins build

# Trigger a build with defaults
ggd jenkins build <target>

# Override parameters
ggd jenkins build <target> --KEY=value --KEY2=value2

# Trigger without watching (detached mode)
ggd jenkins build <target> --detach
```

The build command will:
1. Trigger the Jenkins job via REST API (with CSRF crumb support)
2. Poll the queue until the build starts
3. Stream console output (last 5 lines) in real-time
4. Send a desktop notification when done (Windows/macOS/Linux)

Use `--help` to see all targets with their default parameters:

```bash
ggd jenkins build --help
```

#### View Config

```bash
ggd jenkins config    # Print current config as JSON
```

### `ggd completion` — Shell Completion

Tab-completion is auto-installed globally. To manually output the script:

```bash
ggd completion          # Auto-detect shell
ggd completion bash
ggd completion zsh
ggd completion powershell
```

## Preset Files

Teams can share Jenkins configuration via preset files. These are JSON files that define environments, job paths, and build targets:

```json
{
  "url": "http://jenkins.example.com",
  "environments": {
    "staging": {
      "ui": "staging/job/frontend",
      "api": "staging/job/api"
    },
    "production": {
      "ui": "production/job/frontend",
      "api": "production/job/api"
    }
  },
  "targets": [
    {
      "name": "ui",
      "displayName": "UI (Frontend)",
      "jobPathKey": "ui",
      "defaults": {
        "COMMIT_HASH": "a-staging",
        "SITE": "acc"
      }
    }
  ]
}
```

Load with: `ggd jenkins setup --preset <file>`

## Configuration

All config is stored at `~/.ggd/jenkins.json`. No environment variables required.

## License

Private