-
Notifications
You must be signed in to change notification settings - Fork 294
add gitea support #150
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
add gitea support #150
Conversation
|
@henryxwong is attempting to deploy a commit to the Goshen Labs Team on Vercel. A member of the Team first needs to authorize it. |
|
Related Documentation 1 document(s) may need updating based on files changed in this PR: Goshen Labs's Space Improved Error Handling and Dependency ChecksView 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.Note: You must be authenticated to accept/decline updates. |
Greptile OverviewGreptile SummaryThis PR adds a new Key integrations are:
However, the current wiring has a few concrete breakages (notably parallel-mode issue sync still calling the GitHub path, and tea Confidence Score: 2/5
Important Files Changed
Sequence DiagramsequenceDiagram
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
|
There was a problem hiding this 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
| // 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 { |
There was a problem hiding this comment.
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.| if (prdSource === "gitea") { | ||
| await syncPrdToGiteaIssue(options.prdFile, syncIssue, workDir, { | ||
| repo: giteaRepo, | ||
| }); | ||
| } else { | ||
| await syncPrdToIssue(options.prdFile, syncIssue, workDir); | ||
| } |
There was a problem hiding this comment.
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.
Additional Comments (2)
Prompt To Fix With AIThis 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.
A safer pattern is to prepend Prompt To Fix With AIThis 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. |
Add Gitea support and update documentations.