Brain Structural Validation / Validate Markdown Structure & Links (push) Successful in 8s
- Update project hub overview, sequence diagram, and security model to reflect zero-dependency Python 3 CLI in ~/Config/home/scripts/new-repo.py. - Mark compiled Rust implementation plan as superseded.
2.9 KiB
2.9 KiB
type, status, tags
| type | status | tags | |||||||
|---|---|---|---|---|---|---|---|---|---|
| project | active |
|
🚀 new-repo — Automated Repository Provisioning CLI
🎯 Overview
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, auto-clone to $PWD/<name>) while supporting Gitea repository templates and optional standalone configurations.
🏛️ System Architecture & Workflow
sequenceDiagram
autonumber
actor User as Developer (Laptop)
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)
participant Git as Local Git
User->>CLI: new-repo <repo-name> [flags]
alt Using Template (-t <template>)
CLI->>Gitea: POST /repos/{owner}/{template}/generate
Gitea-->>CLI: Repo created from template
else Standard Repo
CLI->>Gitea: POST /user/repos (with license & init)
Gitea-->>CLI: Repo created
end
opt Mirroring Enabled (Default)
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 (Default, override with --no-clone)
CLI->>Git: git clone git@gitea.roadtotech.me:user/repo.git
Git-->>CLI: Working tree ready
end
🔒 Security Model
- In-Memory Token Handling: Tokens are extracted strictly in-memory using
sops -d --extractfrom~/Config/secrets.yaml(falling back to tea config and Homelab secrets). - Zero Command-Line Leaks: Secrets are transmitted exclusively via native HTTPS request headers (
Authorization: token .../Authorization: Bearer ...), preventing token visibility in/proc/$PID/cmdlineor system process listings (ps). - Decoupled Workstation Secrets: Encryption is managed via
~/Config/.sops.yamlwith the laptop's Age key, decoupling laptop provisioning from Homelab server infrastructure.
📑 Project Documents & Plans
- Repository Provisioning CLI Plan — Specification and evolution record.
- Implementation:
/home/kiskaadee/Config/home/scripts/new-repo.py(exposed as~/.local/bin/new-repo).