Skip to content

feat: Forge-agnostic CLI abstraction for DAG workflows (gh → tea → bb → jira) #6

@tazmon95

Description

@tazmon95

Problem

DAG workflows (e.g. archon-fix-github-issue) use gh CLI commands directly in bash nodes:

- id: fetch-issue
  bash: |
    gh issue view "$ISSUE_NUM" --json title,body,labels,comments,state,url,author

gh issue view --json uses GitHub's GraphQL API internally. When the same workflow runs against a Gitea repository, it fails:

HTTP 405: 405 Method Not Allowed (https://gitea.jtpa.net/api/graphql)

This blocks ALL DAG workflows on Gitea repos. The same problem will occur for Bitbucket and Jira when those adapters are built.

Current State

  • The Gitea adapter (packages/adapters/src/community/forge/gitea/) handles webhooks and comments correctly via REST API
  • The tea CLI is the Gitea equivalent of gh and is already used by the adapter
  • But DAG workflow YAML files hardcode gh commands — there's no abstraction layer
  • The workflows don't know what forge they're running against

Proposed Solution

Forge CLI Abstraction Layer

Introduce a thin abstraction that workflows use instead of gh/tea/bb directly.

Option A: Environment variable + wrapper script
The isolation/runner layer sets FORGE_CLI based on the repo's forge type (GitHub → gh, Gitea → tea, Bitbucket → bb) with a wrapper script that normalizes output.

Option B: Forge-agnostic helper command
A single archon-forge binary/script that detects forge type from git remote URL or env var, dispatches to the right CLI, and normalizes JSON output to a common schema.

Option C: API-first (no CLI dependency)
Skip CLIs entirely — use curl against the forge's REST API. The runner injects FORGE_API_URL, FORGE_TOKEN, REPO_OWNER, REPO_NAME as env vars.

Operations That Need Abstraction

Operation gh command tea equivalent
View issue gh issue view N --json ... tea issue view N or REST API
List issues gh issue list --json ... tea issue list or REST API
Create PR gh pr create --draft tea pr create or REST API
View PR gh pr view --json ... tea pr view or REST API
Add comment gh issue comment N tea comment create or REST API

Affected Workflows

All default DAG workflows with gh commands in bash nodes:

  • archon-fix-github-issue.yamlfetch-issue node
  • archon-issue-review-full.yaml
  • archon-pr-review-scope.yaml
  • Any workflow with gh issue, gh pr, gh api

Reproduction

  1. Create an issue on a Gitea repo connected to Archon
  2. Comment @raca archon-fix-github-issue-dag
  3. Observe: fetch-issue node fails with HTTP 405

We're happy to take this on and submit a PR. The Gitea adapter was contributed by us (PR #653).

— Fitzy 🐾

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions