Instructions to use Wellz1000/hermes-2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- HERMES
How to use Wellz1000/hermes-2 with HERMES:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- Notebooks
- Google Colab
- Kaggle
Download hermes_cli/web_routers/git.py from Wellz1000/hermes-2: direct link, hf CLI and curl.
- Browser
- Download file 4.68 kB
-
https://huggingface.co/Wellz1000/hermes-2/resolve/main/hermes_cli/web_routers/git.py
- Command line
-
hf download hf://Wellz1000/hermes-2/hermes_cli/web_routers/git.py
-
curl -L -o git.py https://huggingface.co/Wellz1000/hermes-2/resolve/main/hermes_cli/web_routers/git.py
4.68 kB
| """Git dashboard routes (extracted verbatim from web_server.py). | |
| Handler bodies are byte-identical to their previous in-web_server form; the | |
| helpers they call (``_git_op``, ``_git_path``) still live in web_server and are | |
| reached via the late-binding seam in :mod:`hermes_cli.web_deps`, so | |
| ``monkeypatch.setattr(web_server, ...)`` keeps working. | |
| """ | |
| from typing import Optional | |
| from fastapi import APIRouter | |
| from hermes_cli import web_git as _web_git # noqa: F401 — used by handlers | |
| from hermes_cli.web_deps import late | |
| from hermes_cli.web_models import ( | |
| GitPathBody, | |
| GitFileBody, | |
| GitCommitBody, | |
| GitWorktreeAddBody, | |
| GitWorktreeRemoveBody, | |
| GitBranchSwitchBody, | |
| ) | |
| router = APIRouter() | |
| # Late-bound web_server helpers (resolved at call time; cycle-safe, | |
| # monkeypatch-transparent). | |
| _git_op = late("_git_op") | |
| _git_path = late("_git_path") | |
| async def git_status_route(path: str): | |
| return await _git_op(_web_git.repo_status, _git_path(path)) | |
| async def git_worktrees_route(path: str): | |
| return {"worktrees": await _git_op(_web_git.worktree_list, _git_path(path))} | |
| async def git_branches_route(path: str): | |
| return {"branches": await _git_op(_web_git.branch_list, _git_path(path))} | |
| async def git_base_branches_route(path: str): | |
| return {"branches": await _git_op(_web_git.base_branch_list, _git_path(path))} | |
| async def git_review_list_route(path: str, scope: str = "uncommitted", base: Optional[str] = None): | |
| return await _git_op(_web_git.review_list, _git_path(path), scope, base) | |
| async def git_review_diff_route( | |
| path: str, file: str, scope: str = "uncommitted", base: Optional[str] = None, staged: bool = False | |
| ): | |
| return {"diff": await _git_op(_web_git.review_diff, _git_path(path), file, scope, base, staged)} | |
| async def git_file_diff_route(path: str, file: str): | |
| return {"diff": await _git_op(_web_git.file_diff_vs_head, _git_path(path), file)} | |
| async def git_commit_context_route(path: str): | |
| return await _git_op(_web_git.review_commit_context, _git_path(path)) | |
| async def git_rev_parse_route(path: str, ref: Optional[str] = None): | |
| return {"sha": await _git_op(_web_git.review_rev_parse, _git_path(path), ref)} | |
| async def git_ship_info_route(path: str): | |
| return await _git_op(_web_git.review_ship_info, _git_path(path)) | |
| async def git_stage_route(body: GitFileBody): | |
| return await _git_op(_web_git.review_stage, _git_path(body.path), body.file) | |
| async def git_unstage_route(body: GitFileBody): | |
| return await _git_op(_web_git.review_unstage, _git_path(body.path), body.file) | |
| async def git_revert_route(body: GitFileBody): | |
| return await _git_op(_web_git.review_revert, _git_path(body.path), body.file) | |
| async def git_commit_route(body: GitCommitBody): | |
| return await _git_op(_web_git.review_commit, _git_path(body.path), body.message, body.push) | |
| async def git_push_route(body: GitPathBody): | |
| return await _git_op(_web_git.review_push, _git_path(body.path)) | |
| async def git_create_pr_route(body: GitPathBody): | |
| return await _git_op(_web_git.review_create_pr, _git_path(body.path)) | |
| async def git_worktree_add_route(body: GitWorktreeAddBody): | |
| options = { | |
| key: value | |
| for key, value in { | |
| "name": body.name, | |
| "branch": body.branch, | |
| "base": body.base, | |
| "existingBranch": body.existingBranch, | |
| }.items() | |
| if value | |
| } | |
| return await _git_op(_web_git.worktree_add, _git_path(body.path), options) | |
| async def git_worktree_remove_route(body: GitWorktreeRemoveBody): | |
| return await _git_op( | |
| _web_git.worktree_remove, _git_path(body.path), _git_path(body.worktreePath), body.force | |
| ) | |
| async def git_branch_switch_route(body: GitBranchSwitchBody): | |
| return await _git_op(_web_git.branch_switch, _git_path(body.path), body.branch) | |