Skip to content

Conversation

@henryxwong
Copy link

Add Gitea support and update documentations.

@vercel
Copy link

vercel bot commented Feb 11, 2026

@henryxwong is attempting to deploy a commit to the Goshen Labs Team on Vercel.

A member of the Team first needs to authorize it.

@dosubot
Copy link

dosubot bot commented Feb 11, 2026

Related Documentation

1 document(s) may need updating based on files changed in this PR:

Goshen Labs's Space

Improved Error Handling and Dependency Checks
View Suggested Changes
@@ -1,49 +1,63 @@
-Recent enhancements to the ralphy bash script significantly improve Linux compatibility and error messaging, making setup and troubleshooting more straightforward for users.
+Recent updates to the ralphy project have expanded its capabilities and improved the user experience by providing robust error handling, dependency checks, and actionable guidance for both GitHub and Gitea workflows.
 
-**jq Hard Requirement and Installation**
+**Mandatory Dependencies and Installation Guidance**
 
-The script now enforces `jq` as a mandatory dependency for JSON parsing. If `jq` is not installed, the script exits with a clear error and provides Linux-specific installation instructions:
+The script enforces the presence of required tools such as `jq` for JSON parsing, `git` for version control, and the appropriate CLI for your chosen issue source (`gh` for GitHub, `tea` for Gitea). If a required tool is missing, the script exits with a clear error message and provides installation instructions tailored for Linux distributions:
 
 ```bash
 jq is required but not installed. On Linux, install with: apt-get install jq (Debian/Ubuntu) or yum install jq (RHEL/CentOS)
+git is required but not installed. Install git before running Ralphy.
+Gitea tea CLI (tea) is required. Install from: https://gitea.com/gitea/tea
+GitHub CLI (gh) is required for --create-pr. Install from https://cli.github.com/
 ```
 
-This ensures users are immediately informed of the missing dependency and how to resolve it, reducing confusion and setup friction. See the implementation [here](https://github.com/michaelshimeles/ralphy/blob/fc2df589969b5fe16d31eccb4e7ff91314e31776/ralphy.sh#L9-L1862).
+This ensures users are immediately informed of missing dependencies and how to resolve them, streamlining setup and reducing confusion.
 
-**Git Repository Presence Checks**
+**Repository and Environment Checks**
 
-The script checks for both the presence of the `git` command and whether the current directory is a git repository. If either check fails, execution stops with a descriptive error:
+The script verifies that it is running inside a git repository and that the necessary environment is present for the selected workflow. If not, execution stops with a descriptive error:
 
 ```bash
-git is required but not installed. Install git before running Ralphy.
 Not a git repository. Ralphy requires a git repository to track changes.
 ```
 
-This prevents accidental use outside of version control, ensuring that all changes are tracked and recoverable. See [source](https://github.com/michaelshimeles/ralphy/blob/fc2df589969b5fe16d31eccb4e7ff91314e31776/ralphy.sh#L9-L1862).
-
-**Bash Version Requirements**
-
-While the script does not explicitly check the bash version, it uses features such as `set -euo pipefail` and arrays, which require a modern bash environment. Users running outdated shells may encounter syntax errors, implicitly signaling the need for an upgrade. This approach encourages use of a compatible shell without intrusive checks. See [source](https://github.com/michaelshimeles/ralphy/blob/fc2df589969b5fe16d31eccb4e7ff91314e31776/ralphy.sh#L9-L1862).
-
-**OS Detection and Linux-Specific Guidance**
-
-The script provides Linux-specific installation instructions for missing dependencies like `jq` and GitHub CLI. When a required tool is missing, the error message includes commands tailored for Debian/Ubuntu and RHEL/CentOS systems. This implicit OS detection streamlines the setup process for Linux users by offering actionable, relevant guidance. See [source](https://github.com/michaelshimeles/ralphy/blob/fc2df589969b5fe16d31eccb4e7ff91314e31776/ralphy.sh#L9-L1862).
-
-**Improved AI CLI Error Messages**
-
-Error handling for AI CLI tools (such as Claude, OpenCode, Codex, Cursor, Qwen, Droid, and Copilot) has been enhanced. The script checks for the presence of the selected AI CLI and provides targeted installation instructions if it is missing. When an AI CLI returns an error, the script parses the output for error types and extracts meaningful messages to display to the user. For example:
+For Gitea workflows, the script checks for authentication with the `tea` CLI and prompts the user to log in if needed:
 
 ```bash
-OpenCode CLI not found.
-Install from: https://opencode.ai/docs/
+tea CLI is not authenticated. Run 'tea login' or configure tea before using --gitea.
 ```
 
-Additionally, the script retries failed AI CLI calls up to a maximum count, logging errors with context to aid in troubleshooting. See [source](https://github.com/michaelshimeles/ralphy/blob/fc2df589969b5fe16d31eccb4e7ff91314e31776/ralphy.sh#L9-L1862).
+**Bash and Shell Compatibility**
 
-**Root User Detection**
+The script uses modern bash features such as `set -euo pipefail` and arrays. While it does not explicitly check the bash version, users running outdated shells may encounter syntax errors, indicating the need for an upgrade.
 
-The script detects if it is running as the root user. For certain AI engines (Claude and Cursor), running as root is explicitly disallowed, and the script exits with a clear error and guidance to switch to a non-root user or use a different engine. For other engines, a warning is issued about potential limitations. This prevents subtle permission issues and security risks. See [source](https://github.com/michaelshimeles/ralphy/blob/fc2df589969b5fe16d31eccb4e7ff91314e31776/ralphy.sh#L9-L1862).
+**Gitea and GitHub Issue Source Support**
 
-**How These Changes Help Users**
+Users can now fetch and manage tasks from either GitHub or Gitea issues. The script provides dedicated options for each source:
 
-These enhancements provide immediate, actionable feedback when common setup issues occur. By checking for required tools, verifying the execution environment, and surfacing clear, OS-specific instructions, the script helps users quickly diagnose and resolve problems. Improved error parsing and messaging for AI CLIs further reduce ambiguity, making troubleshooting faster and more effective. This results in a smoother setup experience and fewer support requests.
+- `--github owner/repo` and `--github-label TAG` for GitHub
+- `--gitea org/repo` and `--gitea-label TAG` for Gitea (requires `tea` CLI)
+
+When using Gitea, all relevant commands (task fetching, marking complete, syncing PRD to issues, and PR creation) are routed through the `tea` CLI. The script checks for the presence and authentication status of `tea`, and provides actionable errors if requirements are not met.
+
+**Pull Request Creation and Syncing**
+
+The script supports automated pull request creation for both GitHub and Gitea. It checks for the appropriate CLI (`gh` or `tea`) based on the selected issue source, and provides clear error messages if the required tool is missing. For example:
+
+```bash
+tea CLI (tea) is required for --create-pr with --gitea. Install tea first.
+```
+
+The `--sync-issue` option now works with both GitHub and Gitea, syncing the PRD file to the corresponding issue body using the appropriate CLI. Errors encountered during syncing are reported with context, helping users quickly identify and resolve problems.
+
+**AI CLI Error Handling and Guidance**
+
+The script checks for the presence of the selected AI CLI (Claude, OpenCode, Codex, Cursor, Qwen, Droid, Copilot, etc.) and provides targeted installation instructions if it is missing. When an AI CLI returns an error, the script parses the output for meaningful messages and displays them to the user. It also retries failed AI CLI calls up to a maximum count, logging errors with context to aid troubleshooting.
+
+**Root User Detection and Warnings**
+
+The script detects if it is running as the root user. For certain AI engines (Claude and Cursor), running as root is explicitly disallowed, and the script exits with a clear error and guidance to switch to a non-root user or use a different engine. For other engines, a warning is issued about potential limitations.
+
+**How These Improvements Help Users**
+
+By enforcing required dependencies, verifying the execution environment, and surfacing clear, actionable error messages for both GitHub and Gitea workflows, the script helps users quickly diagnose and resolve common setup issues. OS-specific installation instructions and authentication checks further reduce friction. Enhanced error parsing and retry logic for AI CLIs, along with root user detection, provide a smoother, more reliable experience and minimize support needs.

[Accept] [Decline]

Note: You must be authenticated to accept/decline updates.

How did I do? Any feedback?  Join Discord

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 11, 2026

Greptile Overview

Greptile Summary

This PR adds a new gitea task source backed by the tea CLI, plus routing to support syncing PRD progress to Gitea issues and creating Gitea PRs when running sequentially. It also updates the docs and shell wrapper to expose --gitea/--gitea-label and to clarify that --sync-issue now targets the current provider.

Key integrations are:

  • cli/src/tasks/gitea.ts + cli/src/gitea/tea.ts for listing/closing issues via tea.
  • cli/src/gitea/issue-sync.ts and cli/src/gitea/pr.ts for PRD→issue sync and PR creation.
  • cli/src/execution/sequential.ts and cli/src/execution/parallel.ts for provider-specific routing.

However, the current wiring has a few concrete breakages (notably parallel-mode issue sync still calling the GitHub path, and tea --repo argument ordering) that should be fixed before merging.

Confidence Score: 2/5

  • Not safe to merge as-is due to provider routing and tea invocation bugs.
  • Parallel mode doesn’t correctly receive/pass provider context for --sync-issue, so Gitea runs can still attempt GitHub sync. Additionally, the tea wrapper appends --repo at the end of args, which can break tea command parsing for subcommands with required positionals (issue edit, PR create). These are functional regressions for the new Gitea feature.
  • cli/src/cli/commands/run.ts, cli/src/execution/parallel.ts, cli/src/gitea/tea.ts

Important Files Changed

Filename Overview
README.md Docs: add Gitea flags and clarify sync-issue meaning across providers.
cli/README.md Docs: add Gitea usage snippets and dependency note for tea CLI.
cli/src/cli/args.ts CLI args: adds --gitea/--gitea-label and extends prdSource union.
cli/src/cli/commands/run.ts Runtime routing: wires task source repo/label based on prdSource, but current logic forwards gitea repo/label for all non-GitHub sources.
cli/src/config/types.ts Config: extends RuntimeOptions with giteaRepo/giteaLabel and prdSource includes gitea.
cli/src/execution/parallel.ts Parallel execution: attempts to route syncIssue to Gitea, but prdSource/giteaRepo aren’t actually passed/typed into runParallel options.
cli/src/execution/sequential.ts Sequential execution: adds Gitea issue sync + PR creation paths; giteaRepo/prdSource are optional and may be undefined in Gitea mode.
cli/src/gitea/issue-sync.test.ts Tests: covers tea unavailable and issues edit invocation for PRD sync.
cli/src/gitea/issue-sync.ts Gitea: implements PRD→issue sync via tea issues edit --description with file read and CLI availability checks.
cli/src/gitea/pr.ts Gitea: implements PR creation via tea after pushing branch; parses JSON/url output.
cli/src/gitea/tea.ts Gitea tea wrapper: exec + parsing helpers; appends --repo at end which can break tea flag parsing for some subcommands.
cli/src/tasks/gitea.test.ts Tests: validates tea output parsing and GiteaTaskSource mapping/closing/counting behavior.
cli/src/tasks/gitea.ts Tasks: adds GiteaTaskSource backed by tea issues list/close with small caching layer.
cli/src/tasks/index.ts Task factory: exports gitea and adds createTaskSource case for type=gitea.
cli/src/tasks/types.ts Types: extends TaskSourceType union with gitea.
ralphy.sh Shell wrapper: adds --gitea flags, tea requirements, Gitea task source functions, and routes sync/pr creation based on source.

Sequence Diagram

sequenceDiagram
  participant U as User
  participant CLI as ralphy CLI
  participant Cfg as Config/Args
  participant Gitea as Gitea API
  participant Git as Local git

  U->>CLI: ralphy run ...
  CLI->>Cfg: parse args + load config
  Cfg-->>CLI: repo provider (github|gitlab|gitea) + credentials
  CLI->>Git: inspect repo/branches
  Git-->>CLI: metadata
  CLI->>Gitea: list PRs / issues
  Gitea-->>CLI: PR/issue data
  CLI->>CLI: plan tasks (parallel/sequential)
  CLI-->>U: execute tasks + report results
Loading

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

16 files reviewed, 4 comments

Edit Code Review Agent Settings | Greptile

Comment on lines 605 to +612
// Sync PRD to GitHub issue once per batch (after all tasks processed)
// This prevents multiple concurrent syncs and reduces API calls
if (syncIssue && prdFile && result.tasksCompleted > 0) {
await syncPrdToIssue(prdFile, syncIssue, workDir);
if (prdSource === "gitea") {
await syncPrdToGiteaIssue(prdFile, syncIssue, workDir, {
repo: options.giteaRepo,
});
} else {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing provider context
runParallel routes --sync-issue based on prdSource === "gitea", but options passed from runLoop never includes prdSource, and giteaRepo is only passed (as a comment) without being declared on the runParallel options type. As a result, Gitea runs will still call syncPrdToIssue (GitHub) in parallel mode, and options.giteaRepo will be a type error / always undefined at runtime.

Also appears in cli/src/cli/commands/run.ts where runParallel({ ... }) omits prdSource/giteaRepo while runSequential({ ... }) includes them.

Prompt To Fix With AI
This is a comment left during a code review.
Path: cli/src/execution/parallel.ts
Line: 605:612

Comment:
**Missing provider context**
`runParallel` routes `--sync-issue` based on `prdSource === "gitea"`, but `options` passed from `runLoop` never includes `prdSource`, and `giteaRepo` is only passed (as a comment) without being declared on the `runParallel` options type. As a result, Gitea runs will still call `syncPrdToIssue` (GitHub) in parallel mode, and `options.giteaRepo` will be a type error / always `undefined` at runtime.

Also appears in `cli/src/cli/commands/run.ts` where `runParallel({ ... })` omits `prdSource`/`giteaRepo` while `runSequential({ ... })` includes them.

How can I resolve this? If you propose a fix, please make it concise.

Comment on lines +193 to +199
if (prdSource === "gitea") {
await syncPrdToGiteaIssue(options.prdFile, syncIssue, workDir, {
repo: giteaRepo,
});
} else {
await syncPrdToIssue(options.prdFile, syncIssue, workDir);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gitea sync may use undefined repo
In the Gitea path you pass { repo: giteaRepo } to syncPrdToGiteaIssue, but giteaRepo is optional and there’s no validation in runSequential that it’s set when prdSource === "gitea". This makes the tea calls run without --repo, which can sync the wrong repository depending on the user’s tea context.

This is user-visible when running --gitea ... --sync-issue N in sequential mode without also providing/propagating giteaRepo into runSequential options.

Prompt To Fix With AI
This is a comment left during a code review.
Path: cli/src/execution/sequential.ts
Line: 193:199

Comment:
**Gitea sync may use undefined repo**
In the Gitea path you pass `{ repo: giteaRepo }` to `syncPrdToGiteaIssue`, but `giteaRepo` is optional and there’s no validation in `runSequential` that it’s set when `prdSource === "gitea"`. This makes the `tea` calls run without `--repo`, which can sync the wrong repository depending on the user’s tea context.

This is user-visible when running `--gitea ... --sync-issue N` in sequential mode without also providing/propagating `giteaRepo` into `runSequential` options.

How can I resolve this? If you propose a fix, please make it concise.

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 11, 2026

Additional Comments (2)

cli/src/cli/commands/run.ts
Wrong label/repo routing
createTaskSource({ type: options.prdSource, ... }) always sets repo/label to the Gitea values for any non-GitHub source. That means --json/--yaml/--markdown runs will silently pass empty repo/label and, more importantly, if options.giteaRepo is set in the environment/config it would be incorrectly forwarded to non-Gitea sources. This should only route repo/label when prdSource === "github" or prdSource === "gitea"; other sources should pass undefined/omit these fields entirely.

Prompt To Fix With AI
This is a comment left during a code review.
Path: cli/src/cli/commands/run.ts
Line: 69:76

Comment:
**Wrong label/repo routing**
`createTaskSource({ type: options.prdSource, ... })` always sets `repo/label` to the Gitea values for any non-GitHub source. That means `--json/--yaml/--markdown` runs will silently pass empty `repo/label` and, more importantly, if `options.giteaRepo` is set in the environment/config it would be incorrectly forwarded to non-Gitea sources. This should only route repo/label when `prdSource === "github"` or `prdSource === "gitea"`; other sources should pass `undefined`/omit these fields entirely.

How can I resolve this? If you propose a fix, please make it concise.

cli/src/gitea/tea.ts
tea flag position bug
withTeaContextArgs appends --repo <repo> to the end of the argument list. For several tea subcommands, flags must appear before positional arguments; e.g. tea issues edit <index> --description ... can misparse if --repo is placed after the description payload. This will break Gitea issue sync / PR creation in those cases.

A safer pattern is to prepend --repo right after the subcommand (or before all positionals), rather than always pushing it to the end.

Prompt To Fix With AI
This is a comment left during a code review.
Path: cli/src/gitea/tea.ts
Line: 516:521

Comment:
**tea flag position bug**
`withTeaContextArgs` appends `--repo <repo>` to the end of the argument list. For several tea subcommands, flags must appear before positional arguments; e.g. `tea issues edit <index> --description ...` can misparse if `--repo` is placed after the description payload. This will break Gitea issue sync / PR creation in those cases.

A safer pattern is to prepend `--repo` right after the subcommand (or before all positionals), rather than always pushing it to the end.

How can I resolve this? If you propose a fix, please make it concise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant