Files
WorldTeacher/QUICKREF.md
2025-11-04 15:28:26 +01:00

146 lines
3.7 KiB
Markdown

# GitRepoSetup - Quick Reference
## Installation
```bash
# Python
cd python && uv sync
# Rust
cd rust && cargo build --release
# Go
cd go && go build
```
## Basic Usage
```bash
gitreposetup --owner <ORG> --name <REPO>
```
## CLI Arguments
| Argument | Type | Default | Description |
|----------|------|---------|-------------|
| `--owner` | string | (config) | Repository owner/org |
| `--name` | string | (config) | Repository name |
| `--license` | enum | MIT | MIT, GPLv3, AGPLv3, Unlicense |
| `--develop-branch-name` | string | dev | Dev branch name |
| `--default-gitignore` | bool | true | Use default .gitignore |
| `--default-git-url` | string | (config) | Git remote URL template |
| `--force` | flag | false | Force overwrite LICENSE |
| `--deploy-type` | enum | - | docker, pypi, cargo, go |
## Config File
**Location**: `~/.config/GMS/.config.yaml` (Windows: `%USERPROFILE%\.config\GMS\.config.yaml`)
```yaml
owner: MyOrg
name: ""
license: MIT
develop_branch: dev
default_gitignore: true
default_git_url: "https://git.theprivateserver.de/{owner}/{repo}.git"
```
## What It Does
1. Init/detect git repo
2. Set `main` as default branch
3. **Remove all remotes**
4. Set `origin` to templated URL
5. Add LICENSE (if missing or `--force`)
6. Add/overwrite `.gitignore`
7. Commit ("Initial commit")
8. Create & checkout `dev` branch
9. Try push; warn if fails
10. Set up `.gitea/workflows/` structure
## Examples
```bash
# Basic
gitreposetup --owner PHB --name WorldTeacher
# Custom license
gitreposetup --owner MyOrg --name App --license GPLv3
# Python package
gitreposetup --owner MyOrg --name lib --deploy-type pypi
# Docker project
gitreposetup --owner MyOrg --name api --deploy-type docker
# Force license change
gitreposetup --owner MyOrg --name old --license MIT --force
```
## Deploy Types
| Type | Workflows | Requires | Secrets |
|------|-----------|----------|---------|
| `pypi` | test-python, python_package-release | pyproject.toml | TOKEN, GITEA_TOKEN |
| `docker` | test-{lang}, test-{lang}-docker-build, docker-release | Dockerfile | REGISTRY, DOCKER_USERNAME, TOKEN, GITEA_TOKEN |
| `cargo` | test-rust, cargo-release | Cargo.toml | TOKEN, GITEA_TOKEN |
| `go` | test-go, go-release | go.mod | TOKEN, GITEA_TOKEN |
## Warnings
⚠️ **Removes all existing git remotes**
⚠️ **Requires remote repo to exist in Gitea before pushing**
⚠️ **Docker workflows need root Dockerfile**
⚠️ **Secrets must be configured in Gitea before workflows work**
## After Running
1. Create remote repo in Gitea: `https://git.theprivateserver.de/{owner}/{repo}`
2. If push failed, run manually:
```bash
git push -u origin main
git push -u origin dev
```
3. Configure secrets in Gitea user/org settings
4. Add Dockerfile if using `--deploy-type docker`
## Troubleshooting
| Issue | Solution |
|-------|----------|
| "PyYAML is required" | `uv add pyyaml` or `pip install pyyaml` |
| "owner and name are required" | Add to config or pass as CLI args |
| "Could not push to remote" | Create repo in Gitea first, then push manually |
| "Docker workflows require Dockerfile" | Add Dockerfile to repo root |
## Files Created
```
.gitea/
changelog_config.json
workflows/
test-python.yml
test-rust.yml
test-go.yml
test-*-docker-build.yml
*-release.yml
.gitignore (if enabled)
LICENSE (if missing or --force)
```
## Documentation
- `README.md` - Full usage guide
- `BUILD.md` - Build instructions
- `EXAMPLES.md` - Usage examples
- `STATUS.md` - Implementation status
- `SUMMARY.md` - Implementation overview
- `QUICKREF.md` - This file
## Links
- Licenses: `licenses/MIT.txt`, `GPL-3.0.txt`, `AGPL-3.0.txt`, `Unlicense.txt`
- Python: `python/main.py`
- Rust: `rust/src/main.rs`
- Go: `go/main.go`