diff --git a/01-plans/new-repo/provisioning-cli-plan.md b/01-plans/new-repo/provisioning-cli-plan.md index 6c70367..b64c9fb 100644 --- a/01-plans/new-repo/provisioning-cli-plan.md +++ b/01-plans/new-repo/provisioning-cli-plan.md @@ -1,17 +1,23 @@ --- type: plan -status: active +status: superseded +superseded_by: ~/Config/home/scripts/new-repo.py project: new-repo tags: - gitea - github - - rust + - python - automation - cli - sops --- # 📋 Implementation Plan — `new-repo` Provisioning CLI +> [!NOTE] +> **Architecture Pivot (2026-10-09)**: +> This plan's compiled Rust approach was evaluated and superseded by a lightweight, zero-dependency Python 3 implementation located in `~/Config/home/scripts/new-repo.py`. This eliminated cargo build steps while preserving strict typing (Pyright), linting (Ruff), and in-memory SOPS security. + + ## 🎯 Objective Build a fast, type-safe, and self-contained Rust command-line tool (`new-repo`) to provision repositories across self-hosted Gitea and GitHub with automated push mirroring, template generation, and zero plaintext secret leakage. diff --git a/06-projects/new-repo/README.md b/06-projects/new-repo/README.md index 64ae331..d98a394 100644 --- a/06-projects/new-repo/README.md +++ b/06-projects/new-repo/README.md @@ -4,20 +4,21 @@ status: active tags: - gitea - github - - rust + - python - automation - cli - homelab + - sops --- # 🚀 new-repo — Automated Repository Provisioning CLI ## 🎯 Overview -`new-repo` is a lightweight native Rust command-line utility designed to automate the creation of new repositories across a hybrid Git topology: +`new-repo` is a lightweight, zero-dependency Python 3 command-line utility integrated directly into the laptop's workstation configuration (`~/Config/home/scripts/new-repo.py`). It automates the creation of new repositories across a hybrid Git topology: - **Primary Forge**: Self-hosted Gitea instance (`gitea.roadtotech.me`). - **Offsite Backup Forge**: GitHub (`github.com`) via automated push mirroring. -It eliminates repetitive manual setup by providing sensible defaults (Gitea as primary, automated GitHub push mirroring, `UNLICENSE` default, private visibility) while supporting Gitea repository templates and optional standalone configurations. +It eliminates repetitive manual setup by providing sensible defaults (Gitea as primary, automated GitHub push mirroring, `UNLICENSE` default, private visibility, auto-clone to `$PWD/`) while supporting Gitea repository templates and optional standalone configurations. --- @@ -27,7 +28,7 @@ It eliminates repetitive manual setup by providing sensible defaults (Gitea as p sequenceDiagram autonumber actor User as Developer (Laptop) - participant CLI as new-repo (Rust) + participant CLI as new-repo (Python 3) participant SOPS as sops (RAM Decrypt) participant Gitea as Gitea API (Primary) participant GitHub as GitHub API (Backup) @@ -44,15 +45,15 @@ sequenceDiagram end opt Mirroring Enabled (Default) - CLI->>SOPS: sops -d --extract ["github_mirror_token"] - SOPS-->>CLI: In-Memory Token (SecretStr) - CLI->>GitHub: POST /user/repos (create target repo) + CLI->>SOPS: sops -d --extract ["system"]["gh_repo_token"] + SOPS-->>CLI: In-Memory Token + CLI->>GitHub: POST /user/repos (create empty target repo) GitHub-->>CLI: 201 Created CLI->>Gitea: POST /repos/{owner}/{repo}/push_mirrors Gitea-->>CLI: Push Mirror Registered end - opt Auto-clone Enabled (-c / --clone) + opt Auto-clone Enabled (Default, override with --no-clone) CLI->>Git: git clone git@gitea.roadtotech.me:user/repo.git Git-->>CLI: Working tree ready end @@ -62,13 +63,14 @@ sequenceDiagram ## 🔒 Security Model -1. **In-Memory Token Handling**: The GitHub Personal Access Token (`github_mirror_token`) is decrypted strictly in-memory from `secrets.yaml` using `sops`. -2. **Zero Command-Line Leaks**: Secrets are transmitted exclusively via native HTTPS request headers (`Authorization: token ...`), preventing token visibility in `/proc/$PID/cmdline` or system process listings (`ps`). -3. **Memory Hygiene**: Secret buffers are scrubbed from memory after use. +1. **In-Memory Token Handling**: Tokens are extracted strictly in-memory using `sops -d --extract` from `~/Config/secrets.yaml` (falling back to tea config and Homelab secrets). +2. **Zero Command-Line Leaks**: Secrets are transmitted exclusively via native HTTPS request headers (`Authorization: token ...` / `Authorization: Bearer ...`), preventing token visibility in `/proc/$PID/cmdline` or system process listings (`ps`). +3. **Decoupled Workstation Secrets**: Encryption is managed via `~/Config/.sops.yaml` with the laptop's Age key, decoupling laptop provisioning from Homelab server infrastructure. --- ## 📑 Project Documents & Plans -- [**Repository Provisioning CLI Plan**](../../01-plans/new-repo/provisioning-cli-plan.md) — Comprehensive functional specification, trait architecture, API contracts, and implementation milestones. -- **Local Implementation Tree**: `/home/kiskaadee/Projects/active/new-repo` +- [**Repository Provisioning CLI Plan**](../../01-plans/new-repo/provisioning-cli-plan.md) — Specification and evolution record. +- **Implementation**: `/home/kiskaadee/Config/home/scripts/new-repo.py` (exposed as `~/.local/bin/new-repo`). +