Metadata-Version: 2.4
Name: lnp-devopscli
Version: 2.0.2
Summary: DevOps CLI — workspace sync (GDrive, git, GPG, systemd timers) + GitLab/Bitwarden tooling
Author-email: Lucas Neves Pires <npires.lucas@gmail.com>
License: MIT
Project-URL: Homepage, https://gitlab.com/lnp-consulting-ti/devops/devops-cli
Project-URL: Repository, https://gitlab.com/lnp-consulting-ti/devops/devops-cli
Project-URL: Issues, https://gitlab.com/lnp-consulting-ti/devops/devops-cli/-/issues
Keywords: devops,workspace-sync,rclone,gdrive,gitlab,bitwarden,systemd
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: System Administrators
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: System :: Systems Administration
Classifier: Topic :: Utilities
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: click>=8.0
Requires-Dist: pyyaml>=6.0
Requires-Dist: requests>=2.28
Requires-Dist: rich>=13.0
Requires-Dist: fastapi>=0.115
Requires-Dist: uvicorn[standard]>=0.32
Requires-Dist: sse-starlette>=2.1
Requires-Dist: pydantic>=2.0

# lnp-devopscli

DevOps CLI for workspace sync (Google Drive + git + GPG + systemd timers) and
GitLab/Bitwarden tooling.

## Install

### Via PyPI (recommended)

```bash
pipx install lnp-devopscli
# or
pip install --user lnp-devopscli
```

Provides two equivalent commands: `devopscli` and `dc`.

### From source

```bash
git clone https://gitlab.com/lnp-consulting-ti/devops/devops-cli.git ~/bin/devops-cli
cd ~/bin/devops-cli && make setup
```

### Bootstrap on a new PC

For a full workspace bootstrap (rclone + GPG + git-crypt + 10 repos + systemd
timers), use the public bootstrap launcher:

```bash
bash <(curl -fsSL https://gitlab.com/-/snippets/6003334/raw/main/bootstrap.sh)
```

See [MIGRATION-RUNBOOK.md](https://gitlab.com/lnpires/ai/workspace-personal/-/blob/main/MIGRATION-RUNBOOK.md)
for the complete migration procedure.

## Commands

```bash
devopscli ws sync             # full bidirectional sync (pull → git → push)
devopscli ws push             # sync local → GDrive (13 categories)
devopscli ws pull             # sync GDrive → local
devopscli ws doctor           # health check (deps, configs, timers, repos)
devopscli ws ai-sync          # git pull/commit/push for ai_workspaces
devopscli ws repos-sync       # git pull/commit/push for repos_sync
devopscli ws gpg-backup       # export GPG key + encrypt + send to GDrive
devopscli ws gpg-restore      # download GPG key from GDrive + decrypt + import
devopscli ws install-timers   # install systemd user timers (replaces cron)
devopscli ws uninstall-timers # remove systemd timers
```

See `devopscli ws --help` for the full list.

## Security

The CLI is open source but never accesses your data without your credentials:

- **Google OAuth** protects access to your GDrive (rclone config)
- **GPG passphrase** protects the GPG key backup
- **git-crypt** protects `.env` files inside synced repos
- **GitLab/SSH keys** protect access to private repositories

Anyone can `pip install` the CLI — but without your credentials, they cannot
access your data.

## Configuration

Edit `~/bin/config.yaml` (synced via `ws push` step 7):

```yaml
ai_workspaces:
  - name: "workspace-personal"
    path: "~/workspace-personal"
    clone_url: "git@gitlab.com:user/repo.git"
    remote: "origin"
    branch: "main"
    auto_commit: true
    commit_message: "chore(auto-sync): snapshot via ws ai-sync"

repos_sync:
  - name: "devops-cli"
    path: "~/bin/devops-cli"
    clone_url: "git@gitlab.com:lnp-consulting-ti/devops/devops-cli.git"
    remote: "origin"
    branch: "main"
    auto_commit: true
    commit_message: "chore(auto-sync): snapshot via ws repos-sync"
```

## Release

To publish a new version to PyPI:

```bash
# 1. Bump version in pyproject.toml
git commit -am "chore(release): v1.0.1"

# 2. Tag and push
git tag v1.0.1
git push origin main v1.0.1
```

The GitLab CI pipeline auto-publishes when a tag matches `v*.*.*`.

Setup once: add `PYPI_TOKEN` to GitLab CI/CD Variables (Settings > CI/CD).

## License

MIT
