Skip to content

Commit c53c4cc

Browse files
committed
Initial project setup with CLI, docs, and workflows
Add core CLI structure, command implementations, documentation (README, CONTRIBUTING, DEVELOPMENT, examples), Makefile, linter and gitignore configs, and CI/CD workflows for MayR Labs CLI. Includes support for multiple commands, cross-platform builds, and comprehensive usage instructions.
1 parent a9efc3a commit c53c4cc

32 files changed

Lines changed: 4131 additions & 10 deletions

.github/agents/README.md

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
# MayR Labs CLI - Copilot Agent Instructions
2+
3+
## Project Overview
4+
MayR Labs CLI is a lightweight, cross-platform command-line tool built with Go to streamline common development, configuration, and automation tasks across projects.
5+
6+
## Tech Stack
7+
- **Language:** Go 1.17+
8+
- **CLI Framework:** Cobra
9+
- **Build:** Single static binary
10+
- **Platforms:** macOS, Linux, Windows
11+
12+
## Project Structure
13+
```
14+
.
15+
├── cmd/ # CLI commands (Cobra)
16+
│ └── root.go # Root command and app initialization
17+
├── internal/ # Private application code
18+
│ ├── commands/ # Command implementations
19+
│ ├── utils/ # Utility functions
20+
│ └── config/ # Configuration handling
21+
├── pkg/ # Public libraries (if any)
22+
├── tests/ # Integration tests
23+
├── .github/
24+
│ └── workflows/ # CI/CD workflows
25+
└── main.go # Application entry point
26+
```
27+
28+
## Development Guidelines
29+
30+
### Building and Testing
31+
```bash
32+
# Build the project
33+
go build -o mayrlabs main.go
34+
35+
# Run tests
36+
go test ./... -v
37+
38+
# Run tests with coverage
39+
go test ./... -cover -coverprofile=coverage.out
40+
41+
# Run linter
42+
go vet ./...
43+
golangci-lint run
44+
```
45+
46+
### Adding New Commands
47+
1. Create command file in `internal/commands/`
48+
2. Implement command logic with proper error handling
49+
3. Add command to root command in `cmd/root.go`
50+
4. Write unit tests in corresponding `_test.go` file
51+
5. Update documentation if needed
52+
53+
### Code Style
54+
- Follow standard Go formatting (`gofmt`)
55+
- Use meaningful variable and function names
56+
- Add comments for exported functions and complex logic
57+
- Keep functions small and focused
58+
- Handle errors explicitly, don't ignore them
59+
60+
### Testing Requirements
61+
- Write unit tests for all public functions
62+
- Aim for >80% code coverage
63+
- Include edge cases and error scenarios
64+
- Use table-driven tests where appropriate
65+
66+
### CI/CD
67+
- All PRs must pass CI checks (build, test, lint)
68+
- Code must be formatted with `gofmt`
69+
- All tests must pass
70+
- No security vulnerabilities
71+
72+
## Common Tasks
73+
74+
### Working with Cobra Commands
75+
Commands are organized hierarchically. Use `cobra-cli` or create manually:
76+
```go
77+
var myCmd = &cobra.Command{
78+
Use: "mycommand",
79+
Short: "Brief description",
80+
Long: "Detailed description",
81+
RunE: func(cmd *cobra.Command, args []string) error {
82+
// Implementation
83+
return nil
84+
},
85+
}
86+
```
87+
88+
### Cross-Platform Considerations
89+
- Use `filepath.Join()` for paths
90+
- Use `os.PathSeparator` when needed
91+
- Test on multiple platforms if modifying platform-specific code
92+
- Use build tags for platform-specific code: `// +build windows`
93+
94+
## Dependencies
95+
- `github.com/spf13/cobra` - CLI framework
96+
- `github.com/spf13/viper` - Configuration management
97+
- Additional dependencies as needed for specific features
98+
99+
## Security Considerations
100+
- Never commit sensitive data (API keys, passwords, etc.)
101+
- Validate all user inputs
102+
- Use secure random generation for passwords/tokens
103+
- Be careful with file operations (path traversal attacks)
104+
105+
## Documentation
106+
- Keep README.md updated with new commands
107+
- Add inline comments for complex logic
108+
- Document all exported functions and types
109+
- Include usage examples in help text
110+
111+
## Getting Help
112+
- Check existing issues on GitHub
113+
- Refer to Cobra documentation: https://cobra.dev/
114+
- Follow Go best practices: https://golang.org/doc/effective_go.html

.github/workflows/ci.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Go CI
2+
3+
on:
4+
push:
5+
branches: [ main, develop ]
6+
pull_request:
7+
branches: [ main, develop ]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v5
14+
15+
- name: Set up Go
16+
uses: actions/setup-go@v6
17+
with:
18+
go-version: stable
19+
20+
- name: Install dependencies
21+
run: go mod download
22+
23+
- name: Run tests
24+
run: go test -v ./...
25+
26+
- name: Build
27+
run: go build -v ./...
28+
29+
- name: Run linter
30+
uses: golangci/golangci-lint-action@v8
31+
with:
32+
version: v2.1

.github/workflows/release.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
release:
13+
name: Create Release
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0
21+
22+
- name: Set up Go
23+
uses: actions/setup-go@v6
24+
with:
25+
go-version: latest
26+
27+
- name: Run tests
28+
run: go test -v ./...
29+
30+
- name: Build for multiple platforms
31+
run: |
32+
# Linux AMD64
33+
GOOS=linux GOARCH=amd64 go build -o mayrlabs-linux-amd64 ./main.go
34+
35+
# Linux ARM64
36+
GOOS=linux GOARCH=arm64 go build -o mayrlabs-linux-arm64 ./main.go
37+
38+
# macOS AMD64
39+
GOOS=darwin GOARCH=amd64 go build -o mayrlabs-darwin-amd64 ./main.go
40+
41+
# macOS ARM64 (Apple Silicon)
42+
GOOS=darwin GOARCH=arm64 go build -o mayrlabs-darwin-arm64 ./main.go
43+
44+
# Windows AMD64
45+
GOOS=windows GOARCH=amd64 go build -o mayrlabs-windows-amd64.exe ./main.go
46+
47+
- name: Create Release
48+
uses: softprops/action-gh-release@v1
49+
with:
50+
files: |
51+
mayrlabs-linux-amd64
52+
mayrlabs-linux-arm64
53+
mayrlabs-darwin-amd64
54+
mayrlabs-darwin-arm64
55+
mayrlabs-windows-amd64.exe
56+
draft: false
57+
prerelease: false
58+
generate_release_notes: true
59+
env:
60+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Binaries for programs and plugins
2+
*.exe
3+
*.exe~
4+
*.dll
5+
*.so
6+
*.dylib
7+
8+
# Test binary, built with `go test -c`
9+
*.test
10+
11+
# Output of the go coverage tool
12+
*.out
13+
coverage.out
14+
coverage.html
15+
16+
# Go workspace file
17+
go.work
18+
19+
# Build artifacts
20+
mayrlabs
21+
mayrlabs-cli
22+
dist/
23+
build/
24+
25+
# IDE and editor files
26+
.idea/
27+
.vscode/
28+
*.swp
29+
*.swo
30+
*~
31+
.DS_Store
32+
33+
# Dependency directories
34+
vendor/
35+
36+
# Temporary files
37+
tmp/
38+
temp/
39+
*.tmp
40+
41+
# Environment files (may contain secrets)
42+
.env
43+
.env.local
44+
.env.*.local
45+
46+
# Debug files
47+
debug
48+
__debug_bin
49+
50+
# goreleaser
51+
.goreleaser.yml

.golangci.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
version: "2"
2+
3+
linters:
4+
enable:
5+
- errcheck
6+
- govet
7+
- ineffassign
8+
- staticcheck
9+
- unused
10+
- misspell
11+
- goconst
12+
- gocritic
13+
- gocyclo
14+
- unconvert
15+
- dupl
16+
17+
issues:
18+
max-issues-per-linter: 50
19+
max-same-issues: 3
20+
new: false
21+
fix: false
22+
uniq-by-line: true
23+
whole-files: false
24+
25+
run:
26+
timeout: 5m
27+
tests: true
28+

0 commit comments

Comments
 (0)