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
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text eol=lf
1 change: 1 addition & 0 deletions .github/workflows/lint_test.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: lint_test
on:
push:
branches: [main]
pull_request:

jobs:
Expand Down
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
default_install_hook_types: [pre-commit, pre-push]
default_stages: [commit, push]
default_stages: [pre-commit, pre-push]
repos:
- repo: local
hooks:
Expand All @@ -18,9 +18,9 @@ repos:
entry: ec
language: system
pass_filenames: false
- id: bats
name: bats
- id: make-test
name: make test
entry: make test
language: system
pass_filenames: false
stages: [push]
stages: [pre-push]
1 change: 1 addition & 0 deletions CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @Monynha-Softwares
4 changes: 4 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Code of Conduct

This project follows the [Contributor Covenant](https://www.contributor-covenant.org/).
By participating, you are expected to uphold this code.
19 changes: 19 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Contributing

Thank you for considering contributing!

## Development setup

```bash
make install-dev
```

## Style & tests

* Format: `make fmt`
* Lint: `make lint`
* Test: `make test`

Please run the above before submitting a PR.

See [docs/contributing.md](docs/contributing.md) for more details.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ fmt:
shfmt -w bin modules recipes tests

lint:
shellcheck -x bin/mona modules/**/*.sh
bash -O globstar -c 'shellcheck -x bin/mona modules/**/*.sh'
shfmt -d bin modules recipes tests

test:
Expand Down
111 changes: 42 additions & 69 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,100 +1,73 @@
# MonaRepo — Monynha Softwares
# MonaRepo TUI

**Version:** v0.1.0
[![CI](https://github.com/Monynha-Softwares/MonaRepoTui/actions/workflows/lint_test.yml/badge.svg)](https://github.com/Monynha-Softwares/MonaRepoTui/actions/workflows/lint_test.yml)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)

A base monorepo (Bash-first) to automate VM/server bootstrap with an optional TUI powered by [`bashsimplecurses`](https://github.com/metal3d/bashsimplecurses).
Use this as the starting point for Codex/agents to extend modules and recipes.
Base tooling for Monynha server automation with an optional TUI.

## TL;DR

```bash
git clone https://github.com/Monynha-Softwares/MonaRepoTui.git monarepo && cd monarepo
make install-dev
sudo ./bin/mona
```

## Features
- Single entrypoint: `bin/mona` — interactive TUI (↑/↓, Enter, Q) with a heart header ❤
- Flows: Quick Start, Distro Upgrade, Network (Netplan), Users & SSH, Hostname/hosts, Run Recipe
- Dry-run mode (`--dry-run`) to preview actions
- CI ready (ShellCheck + BATS), Makefile targets
- Cloud-init template for first-boot provisioning
- Bash modules & recipes
- Interactive TUI
- Dry-run mode
- CI ready (shfmt, shellcheck, bats)

## Getting Started
## Install

```bash
# clone
git clone <your-repo> monarepo && cd monarepo
Clone the repo and install dev deps:

# install development dependencies and git hooks
```bash
git clone https://github.com/Monynha-Softwares/MonaRepoTui.git
cd MonaRepoTui
make install-dev
```

# run full test suite
make test
## Quickstart

Run the TUI (root recommended):

# run TUI (recommended with sudo/root)
```bash
sudo ./bin/mona
```

### Local hooks

This repository uses [pre-commit](https://pre-commit.com/) hooks. Formatting
(`shfmt`) and linting (`shellcheck`, `editorconfig-checker`) run on every
commit. The BATS tests run automatically on `git push`. Hooks are installed by
`make install-dev`. You can manually trigger them for all files with:
## Usage

```bash
pre-commit run --all-files
./bin/mona --help
```

### Run CI tasks locally
## Development

The same checks used in GitHub Actions can be executed locally:
Format and lint:

```bash
make fmt
make lint
make test
```

### Non-interactive/CI flags
- `--version` : prints version and exits
- `--help` : prints help and exits
- `--dry-run` : prints actions instead of applying
- `MONA_NONINTERACTIVE=1` : single-shot non-interactive mode (no curses, no actions)

### Directory Layout
## Testing

```
bin/ # entrypoints
lib/ # shared helpers (future work for agents)
modules/ # idempotent modules (base, docker, ...)
recipes/ # orchestration of modules per "role"
templates/ # cloud-init and systemd
tests/ # bats tests
ui/ # optional bashsimplecurses submodule (or runtime fetch)
.github/workflows/ci.yml
```bash
make test
```

## Cloud-init quick start
Use `templates/cloud-init/user-data.yaml` as user-data for new VMs. It clones your repo into `/opt/monarepo` and runs a recipe.

## Contributing
- Lint Shell: `make lint` (ShellCheck)
- Tests: `make test` (BATS)
- Keep modules idempotent: **probe → apply → verify**
- Prefer `apply` helper (respects `--dry-run`).

## License
MIT — see [LICENSE](LICENSE).
See [CONTRIBUTING.md](CONTRIBUTING.md) and [docs/contributing.md](docs/contributing.md).

## Security
See [SECURITY.md](SECURITY.md).

## Included Recipes (examples)
- `recipes/coolify-node.sh` — base + docker + coolify bootstrap (network/dirs)
- `recipes/monitoring-node.sh` — base + docker + node_exporter + cAdvisor
- `recipes/supabase-node.sh` — base + docker (hook para Supabase)

## Project Installer (Wizard)
Use the TUI option **“Instalar/Configurar Projeto (GitHub/Docker)”** to:
- List or select a GitHub repo (Monynha-Softwares by default) and clone it
- Or pull/run a Docker image quickly
- Then MonaRepo detects common post‑clone actions (e.g., copy `.env.example`, `docker compose up -d`, `npm/pnpm/yarn install`, `make setup`, `supabase start`) and lets you run them step‑by‑step while logging output.
## License
MIT © Monynha Softwares

Logs are stored in `~/.mona/logs` (or `$MONA_LOG_DIR`). `--dry-run` prints commands without executing.
### Monynha Way
Inclusive, accessible and developer‑first.

### Installer extras (v0.4.0)
- **GitHub PAT**: set `GITHUB_TOKEN` to avoid rate limits and access private repos.
- **Interactive `.env`**: when a project has `.env.example`, choose “Criar .env interativo” to fill values key-by-key.
- **Docker Compose advanced**: auto-detects `docker compose` (plugin) or `docker-compose`; offers `pull`, `up -d --remove-orphans`, `ps`, `logs -f`.
- **TUI README viewer** (experimental): set `MONA_USE_TUI_READER=1` to view README inside the TUI; otherwise falls back to `less`.
[Leia em Português](README.pt-BR.md)
67 changes: 67 additions & 0 deletions README.pt-BR.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# MonaRepo TUI

[![CI](https://github.com/Monynha-Softwares/MonaRepoTui/actions/workflows/lint_test.yml/badge.svg)](https://github.com/Monynha-Softwares/MonaRepoTui/actions/workflows/lint_test.yml)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)

Ferramenta base da Monynha para automação de servidores com TUI opcional.

## Resumo

```bash
git clone https://github.com/Monynha-Softwares/MonaRepoTui.git monarepo && cd monarepo
make install-dev
sudo ./bin/mona
```

## Funcionalidades
- Módulos Bash e receitas
- TUI interativo
- Modo dry-run
- CI pronta (shfmt, shellcheck, bats)

## Instalação

```bash
git clone https://github.com/Monynha-Softwares/MonaRepoTui.git
cd MonaRepoTui
make install-dev
```

## Início rápido

```bash
sudo ./bin/mona
```

## Uso

```bash
./bin/mona --help
```

## Desenvolvimento

```bash
make fmt
make lint
```

## Testes

```bash
make test
```

## Contribuindo
Veja [CONTRIBUTING.md](CONTRIBUTING.md) e [docs/contributing.md](docs/contributing.md).

## Segurança
Consulte [SECURITY.md](SECURITY.md).

## Licença
MIT © Monynha Softwares

### Jeito Monynha
Inclusivo, acessível e focado em DX.

[Read in English](README.md)
4 changes: 4 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Security Policy

If you discover a security issue, please email security@monynha.dev or open a private issue.
We will respond as soon as possible.
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.4.0
20 changes: 14 additions & 6 deletions bin/mona
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env bash
# MonaRepo — Interactive TUI bootstrapper
set -euo pipefail
set -Eeuo pipefail
IFS=$'\n\t'

# Determine repo root early so other scripts can source helpers safely
export MONA_BIN_PATH="$(readlink -f "$0")"
Expand All @@ -9,7 +10,7 @@ export MONA_DIR="$(cd "$(dirname "$MONA_BIN_PATH")/.." && pwd)"
# shellcheck source=../lib/common.sh
. "$MONA_DIR/lib/common.sh"

VERSION="0.4.0"
VERSION="$(cat "$MONA_DIR/VERSION")"

# ------------------------------ Globals ------------------------------------
export MONA_DRY_RUN="${MONA_DRY_RUN:-false}"
Expand All @@ -31,8 +32,8 @@ Env:
EOF
}

for a in "$@"; do
case "$a" in
while [[ $# -gt 0 ]]; do
case "$1" in
--help)
show_help
exit 0
Expand All @@ -41,9 +42,16 @@ for a in "$@"; do
echo "$VERSION"
exit 0
;;
--dry-run) MONA_DRY_RUN=true ;;
*) ;;
--dry-run)
MONA_DRY_RUN=true
;;
*)
log_error "Flag desconhecida: $1"
show_help
exit 1
;;
esac
shift
done

MONA_TMP_DIR="${TMPDIR:-/tmp}/mona"
Expand Down
9 changes: 9 additions & 0 deletions docs/architecture.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Architecture

```
bin/ # entrypoint scripts
lib/ # shared helpers
modules/ # idempotent modules
recipes/ # orchestration of modules
tests/ # BATS tests
```
7 changes: 7 additions & 0 deletions docs/cli-usage.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# CLI Usage

```bash
./bin/mona --help
./bin/mona --version
MONA_NONINTERACTIVE=1 ./bin/mona --version
```
17 changes: 17 additions & 0 deletions docs/contributing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Contributing Guide

## Setup

```bash
make install-dev
```

## Workflow

1. Create a focused branch.
2. Format: `make fmt`
3. Lint: `make lint`
4. Test: `make test`
5. Commit using Conventional Commits.

Obrigado!
Loading