Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
name: Bug Report
about: Report a bug to help us improve
title: "[BUG] "
labels: bug
assignees: ''
---

## Describe the Bug

<!-- A clear and concise description of what the bug is. -->

## Steps to Reproduce

1.
2.
3.

## Expected Behavior

<!-- What you expected to happen. -->

## Actual Behavior

<!-- What actually happened. -->

## Environment

- OS:
- Version:
- Go version (if applicable):

## Additional Context

<!-- Add any other context, logs, or screenshots. -->
23 changes: 23 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
name: Feature Request
about: Suggest an idea for this project
title: "[FEATURE] "
labels: enhancement
assignees: ''
---

## Problem Statement

<!-- A clear description of what problem this feature would solve. -->

## Proposed Solution

<!-- Describe the solution you'd like. -->

## Alternatives Considered

<!-- Any alternative solutions or features you've considered. -->

## Additional Context

<!-- Add any other context or mockups. -->
27 changes: 27 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
## Description

<!-- Briefly describe the change and its motivation. -->

## Type of Change

- [ ] Bug fix (non-breaking change that fixes an issue)
- [ ] New feature (non-breaking change that adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
- [ ] Documentation update
- [ ] Refactoring (no functional changes)
- [ ] CI/CD or tooling change

## Testing

<!-- Describe the tests you ran and how to reproduce them. -->

- [ ] Unit tests pass (`make test`)
- [ ] Integration tests pass (if applicable)
- [ ] Manual verification completed

## Checklist

- [ ] My code follows the project's coding conventions
- [ ] I have updated documentation as needed
- [ ] I have added tests that prove my fix/feature works
- [ ] All new and existing tests pass
37 changes: 37 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,40 @@
/ocm
/ocm-*
/.idea

# === Additional patterns for agent-readiness ===
# Binaries
*.exe
*.exe~
*.dll
*.so
*.dylib

# Test binary, built with `go test -c`
*.test

# Output of the go coverage tool
*.out
*.prof

# Go workspace file
go.work
go.work.sum

# IDE and editor files
.idea/
.vscode/
*.swp
*.swo
*~
.project
.settings/

# OS files
.DS_Store
Thumbs.db
Desktop.ini

# Build output
/bin/
/dist/
15 changes: 15 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
args: ['--allow-multiple-documents']
- id: check-added-large-files
args: ['--maxkb=500']
- id: check-merge-conflict
- repo: https://github.com/golangci/golangci-lint
rev: v2.1.2
hooks:
- id: golangci-lint
50 changes: 50 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# AGENTS.md

This file provides guidance to AI coding assistants when working with this repository.

## Project Overview

OCM CLI (`ocm`) is a command-line tool for interacting with the OpenShift Cluster Manager (OCM) API. Built in Go with Cobra for command structure and the OCM SDK (`ocm-sdk-go`) for type-safe API interactions.

## Build & Test Commands

```bash
make # Build all command binaries
make install # Install ocm binary to $GOPATH/bin
make test # Run all tests (Ginkgo)
make lint # Run golangci-lint via container
make fmt # Format Go source code
make clean # Remove build artifacts
```

## Architecture

### Command Structure (`cmd/ocm/`)
- **Core API**: `get`, `post`, `patch`, `delete` — direct API interaction
- **Resource management**: `create`, `edit`, `describe`, `list` — higher-level operations
- **Authentication**: `login`, `logout`, `token`, `whoami`
- **Cluster operations**: `cluster/` subcommands for cluster lifecycle
- **Account management**: `account/` subcommands for organizations, users, roles
- **Utilities**: `config`, `completion`, `version`, `tunnel`

### Key Packages
- **pkg/ocm/** — Core OCM SDK connection and authentication handling
- **pkg/arguments/** — Command-line argument parsing and interactive prompts
- **pkg/config/** — Configuration file management (`~/.config/ocm/ocm.json`)
- **pkg/output/** — Output formatting (JSON, table) with YAML table definitions
- **pkg/cluster/** — Cluster-specific operations and utilities
- **pkg/plugin/** — Plugin discovery and execution (`ocm-` prefix binaries in PATH)

### Connection & Auth
- OCM SDK connections built through `pkg/ocm/connection-builder/`
- Multiple auth methods supported; environment variable `OCM_CONFIG` for alternate config
- Keyring support via `OCM_KEYRING` for secure credential storage
- Automatic token refresh and session management

## Key Conventions

- Module path: `github.com/openshift-online/ocm-cli`
- Ginkgo/Gomega for testing (tests in `tests/` directory)
- Use `podman` over `docker` (configurable via `container_runner` Make variable)
- Static binaries (CGO disabled)
- Plugin extensions use `ocm-` prefix naming convention
Loading