Jump to content

From Manual GitOps to Agentic Automation: Why I Forked Gogs-CLI

From JOHNWICK

How a simple Bash script became part of an AI-native developer workflow

gogs-cli usage image

If you want your AI agents to build, test, and deploy code as teammates, they need proper tools — not privileges.”

When I first looked at the original Gogs-CLI bash script, I admired its simplicity.
It exposed just enough of Gogs’ REST API to automate basic repository and team management.
But it wasn’t ready for a world of *agentic workflows* — where autonomous LLM-based agents need to **open issues, comment on pull requests, and manage tokens** safely from within their own toolchain. That’s why I forked it. 
The result is gogs-cli— a drop-in command-line interface designed not just for humans, but also for AI agents that interact programmatically with private Gogs instances.

🧠 The Philosophy Behind the Fork

Agentic development is about giving intelligent systems agency — the ability to plan, act, and reflect through real tools.
The forked `gogs-cli` plays a critical role in that ecosystem: - Human developers use it to script and test repository automation.
- AI agents use it to create issues, submit pull requests, and document progress inside your private Gogs server — no browser required.

This aligns with the broader principle of Tactical Agentic Coding(TAC):
we don’t need to fine-tune massive LLMs for every task — we need well-defined, composable tools that agents can orchestrate.

⚙️ Installing the Fork

bash
git clone https://github.com/meirm/gogs-cli.git
cd gogs-cli
chmod +x gogs
sudo cp gogs /usr/local/bin/

You’ll also need curl, jq, and optionally gpg for encrypted tokens.

Create your config file:

echo "https://gogs.example.com" > ~/.config/gogs/url
echo "your_api_token_here" > ~/.config/gogs/token

Or use environment variables:

export GOGS_URL=https://gogs.example.com
export GOGS_TOKEN=your_api_token_here

If you prefer secure storage:

gpg -c ~/.config/gogs/token
rm ~/.config/gogs/token

🪄 Example Commands

Create a repository

gogs create_repo my-new-project - private

List issues

gogs list_issues my-org/my-repo

Comment on a pull request

gogs comment_pr my-org/my-repo 42 "LGTM - merge when ready."

Create an API token for an agent

gogs token_create "autoagent" - scopes=repo,write:issues

🤖 Using gogs-cli in Agentic Workflows

1. Define it as a “tool” for your agent In your agent configuration (Autogen, LangChain, or your own MCP server):

tools:
 - name: gogs
 type: bash
 command: gogs
 description: |
 CLI wrapper for Gogs REST API. Allows agents to create issues,
 comment, and manage repos programmatically.

Now your agent can run shell commands like:

gogs create_issue my-org/my-repo "Investigate failed deployment" - body "See logs in /var/log/deploy"

2. Track development with tickets Agents can:
• Open a ticket when a test fails
• Comment with traceback summaries
• Create PRs after patching files
• Notify team channels via webhooks This turns your private Gogs server into an Agentic Collaboration Hub — where both humans and machines contribute asynchronously.

🔐 Safety and Auditability

Unlike direct API calls hard-coded into agents, gogs-cli keeps credentials decoupled from runtime environments:
• Tokens stored locally or via GPG encryption
• Human oversight via dry-run mode
• Easy revocation of access tokens Every action is logged by Gogs’ native audit trail — ideal for controlled environments or classified deployments.

🚀 Real-World Use Case

At CyborgFi, we use gogs-cli inside a Taskmaster loop — a pipeline where agents propose code fixes, open PRs, and await human review.
Each AI agent runs within a container with limited privileges, using its own Gogs token.
This structure enforces accountability while keeping workflows fluid and self-documenting.

🧩 Final Thoughts

Agentic development is not about replacing developers — it’s about giving both humans and machines a shared workspace, with traceability, structure, and trust.
With gogs-cli, the humble Bash script becomes part of the cognitive infrastructure of AI-augmented software engineering. “Every new tool changes how we think.
The goal is to make our agents think with us — not for us*.”

📦 Repository: github.com/meirm/gogs-cli

Read the full article here: https://medium.com/@meirgotroot/from-manual-gitops-to-agentic-automation-why-i-forked-gogs-cli-13a6d0df6b39