openresearch-cli
Use the `orx` CLI to run local OpenResearch projects from a terminal — create experiment branches, launch and supervise compute, inspect logs and evidence, and manage the experiment tree. Read this before driving `orx` programmatically.
Safety scan
A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.
Check it deeper on your machine
It has changed since its scan on 17 Nov 2026.
As a Claude Code plugin, install it and then ask Claude Code:
/plugin marketplace add keithmackay/mackayi/plugin install scanskillsafety@mackayiDo a deep scan of https://github.com/alphaXiv/OpenResearch with scanskillsafety
Or from a terminal, clone it and run it:
git clone https://github.com/keithmackay/scanskillsafety-skill ~/.claude/skills/scanskillsafetynode ~/.claude/skills/scanskillsafety/cli.cjs --deep 'https://github.com/alphaXiv/OpenResearch'
It checks the exact commit: every file, its packages against OSV (api.osv.dev), how it compares with this page's scan (findsafeskills.com receives the repository's address), and, if you agree, Claude reading every file with your own Claude subscription. It never runs the code.
Badge for your README
Markdown
[](/listings/alphaxiv--openresearch)HTML
<a href="/listings/alphaxiv--openresearch"><img src="/api/listings/alphaxiv--openresearch/badge.svg" alt="findsafeskills safety rating" /></a>Install
What was scanned
The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.
SKILL.md · Manifest · 167 lines
- ---
- name: openresearch-cli
- description: Use the `orx` CLI to run local OpenResearch projects from a terminal — create experiment branches, launch and supervise compute, inspect logs and evidence, and manage the experiment tree. Read this before driving `orx` programmatically.
- ---
- # OpenResearch CLI (`orx`)
- `orx up` owns projects, experiment branches, and execution in a local Git
- repository and local database. Use the local session worktree to read, diff,
- and edit code (see `orx-git`).
- This overview is deliberately short: it carries the cardinal rules and a command
- quick-reference, then points at focused **modules** for everything else. Load a
- module with `orx skill <name>` (the bundled index is printed at the end of `orx
- skill` output).
- ## Cardinal rules — read before doing anything else
- These four govern everything below. Breaking any one silently invalidates your
- results — they are not style preferences. The `orx-experiment-tree` module
- expands on the why; these are the non-negotiables.
- 1. **Never edit a node once a run has answered it.** A node freezes the moment
- a run establishes its baseline or tests its hypothesis — that includes the
- root — and freezing is permanent: a disappointing result is still a result.
- Until then it is **provisional**: seeding it, fixing its deps, and making it
- run all happen on its own branch (`orx-experiment-tree`). To test a new
- hypothesis, branch a **child** and edit the child.
- 2. **The run command *and* the environment are a fixed contract — identical on
- every node.** A child inherits its parent's run command verbatim; leave it
- alone. Do **not** give nodes different start commands, and do **not** vary
- behavior through environment variables or env-prefixed commands
- (`LR=3e-4 python …`). The *only* thing that may differ between nodes is the
- **committed code/config** on the node's git branch. Set the local project's
- command once with `orx project edit <projectId> --run-command '<cmd>'`.
- 3. **Vary code, not knobs-in-the-command.** Encode hyperparameters in the
- code/config files and branch a child per variant — never sweep them by editing
- the run command or passing env vars. Every node runs the *same* command over
- *different code*, so their logged result summaries stay comparable.
- 4. **Grow the tree downward, not sideways.** Fan a little *within* a round (the
- options of one decision), then **descend onto that round's winner** for the
- next round. A root with a long row of direct children and no grandchildren is
- the failure mode. See "Shape the tree" in the `orx-experiment-tree` module.
- If you're ever tempted to change the command, pass an env var, or pile another
- node onto the root instead of branching a child, editing its branch, and
- descending — stop. That's the anti-pattern, not a shortcut.
- ## Setup
- ```sh
- orx login # opens a browser, stores a token at ~/.config/openresearch/credentials.json
- orx logout # remove the stored token
- ```
- - The API base URL resolves from `--api-url` → `OPENRESEARCH_API_URL` → a built-in
- default. Set `OPENRESEARCH_API_URL` for non-local use.
- - Local project and run commands do not require a token. OpenResearch compute,
- instance provisioning, and account settings require `orx login`.
- ## Command quick-reference
- Project-scoped commands take a **project id**; experiment-scoped commands take an
- **experiment id**; run-scoped commands take a **run id**. Don't mix them — get
- ids from `orx projects`, `orx project view`, and `orx runs` respectively. Each
- group below has a module (`orx skill <name>`) with the full flags and rules.
- ### Auth
- | Command | What it does |
- |---|---|
- | `orx login [--api-url <url>] [--device]` | Open a browser, do loopback OAuth, store a token. `--device` (the default over SSH) prints a link and code to approve on any device. |
- | `orx logout` | Remove the stored token. |
- ### Discover (project- and experiment-scoped)
- | Command | What it does |
- |---|---|
- | `orx projects [--json]` | List projects in the local `orx` store. |
- | `orx orgs [--json]` | List organization ids available for OpenResearch compute (login required). |
- | `orx project view <projectId>` | Show a local project's details and experiment tree. **Experiment ids come from here.** |
- | `orx runs <projectId> [--experiment <id>]` | List runs as a table, newest first. **Run ids come from here.** |
- ### Run evidence (run-scoped) — module `orx-logs`
- | Command | What it does |
- |---|---|
- | `orx logs <runId>` | Show the local log path, size, and short preview; inspect the file for full evidence. |
- ### Create and run experiments (write) — modules `orx-create`, `orx-compute`, `orx-git`
- | Command | What it does |
- |---|---|
- | `orx up` | Open the local dashboard to import or create a local project. |
- | `orx project edit <localProjectId> [--name "<n>"] [--run-command "<cmd>"]` | Edit a local project's name or fixed run command. |
- | `orx project share <localProjectId> [--out <file> \| --publish] [--chat <chatId>... \| --no-chats] [--no-logs] [--no-artifacts]` | Only when the user asks: save the project's code, experiment tree, finished runs, logs, artifacts and chats as a `.orx` file to send to a collaborator. `--chat` narrows it to the named chats. `--publish` (only when the user asks for a link) uploads it to openresearch.sh and prints a link anyone can open; publishing again updates the same link. |
- | `orx project unpublish <localProjectId>` | Delete the project's published link and its file. |
- | `orx project import <file.orx \| link> [--path <dir>]` | Open a shared `.orx` file or an `openresearch.sh/p/...` link as a new local project with its tree, runs and chosen chats. |
- | `orx create-experiment <localProjectId> --title "<t>" [...]` | Add a local experiment node; prints its Git branch. |
- | `orx compute status` / `show <backend>` / `test <backend>` | Inspect machine-wide compute configuration and readiness. |
- | `orx compute configure <backend> --help` / `default set <backend>` / `connect <backend>` | Configure compute or authenticate; load `orx-compute`. |
- | `orx compute instructions show --json` | Read the machine-wide custom recipe and its revision before configuring or launching. |
- | `orx compute [--gpu <id>] [--count <n>] [--provider <name>]` / `orx compute --cpu` | List the GPU/CPU compute catalog. |
- | `orx instance create <orgId> (--gpu <id> … \| --cpu <flavor> …)` | Spin up a standalone instance in an org; see `orx-instances`. |
- | `orx exp status/run/cancel/wait/wake <localExpId>` | Inspect, run, cancel, wait on, or register a wake-up for a local experiment node. |
- | `orx exp move/archive/unarchive/delete <localExpId>` | Re-parent, hide, restore, or permanently delete experiment nodes; see `orx-experiment-tree`. |
- | `orx exp desc <expId> [--set "<text>" \| --stdin]` | Read or overwrite the experiment's description. |
- To **read or edit** a node's code—including diffing what a run changed—use plain
- Git in the local session worktree. See the `orx-git` module.
- ### Literature & papers — alphaXiv / OpenAlex / bioRxiv / PubMed (no login required) — module `orx-lit-review`
- Use before any web search for academic/research queries (paper, author, blog, model release).
- | Command | What it does |
- |---|---|
- | `orx discover keyword "<query>"` | Call the alphaXiv full-text retrieval primitive with match snippets. |
- | `orx discover embedding "<query>"` | Call the alphaXiv semantic retrieval primitive. The main agent ranks candidates and decides focused follow-ups; see `orx-lit-review`. |
- | `orx discover openalex "<query>"` | Search the cross-disciplinary OpenAlex scholarly graph. |
- | `orx discover biorxiv "<query>"` | Search bioRxiv preprints through OpenAlex's bioRxiv index. |
- | `orx discover pubmed "<query>"` | Search PubMed biomedical literature through NCBI E-utilities. |
- | `orx paper <id\|url> [--source <source>] [--full]` | Fetch a paper: alphaXiv report with automatic full-text fallback (`--full` forces raw text), or OpenAlex/bioRxiv/PubMed metadata+abstract. Source auto-detected from the id. |
- ### Skills & templates — module `orx-customize`
- | Command | What it does |
- |---|---|
- | `orx skills add <path>` | Save a reusable skill from a `SKILL.md` file or skill ZIP across projects. |
- | `orx templates add <path>` | Save a reusable LaTeX template from a `.tex` file or template ZIP across projects. |
- ### Meta
- | Command | What it does |
- |---|---|
- | `orx skill [name[/resource]]` | Print this overview, one bundled module, or a lazily loaded module resource such as `compute/hf`. |
- | `orx feedback --kind <bug\|feature_request\|frustration> --summary <summary> --details <details>` | Report a meaningful OpenResearch bug, feature request, or user frustration to its maintainers. See the `orx-feedback` module. |
- ## Modules
- The detail lives in focused modules — load one with `orx skill <name>` (the bundled
- list, with one-line descriptions, is printed at the end of `orx skill` output):
- - **orx-experiment-tree** — the experiment-tree model, the auto-research loop, and `orx exp desc`.
- - **orx-create** — initialize a local project and add local experiment nodes.
- - **orx-compute** — launch and monitor runs; after resolving the backend, read its bundled reference.
- - **orx-instances** — create persistent standalone machines for manual work.
- - **orx-git** — read, edit, and diff a node's code with plain git.
- - **orx-agent-delegation** — delegate to other models and chats with orx's MCP tools.
- - **orx-logs** — retrieve persisted run output for progress, debugging, or measurements.
- - **orx-results** — interpret, compare, and summarize measured experiment outcomes.
- - **orx-reports** — write durable research outputs into the project's artifacts directory.
- - **orx-figures** — publication-quality figures in matplotlib or TikZ. Load it **before** writing any plotting code, then read the one reference for that figure type.
- - **orx-customize** — add reusable skills and LaTeX templates across projects; add model endpoints and fix how agents and providers present (`orx agents`).
- - **orx-paper** — draft a paper or preprint as LaTeX that renders and compiles to PDF.
- - **orx-feedback** — report meaningful OpenResearch bugs, feature requests, and user frustration without leaking research details.
- - **orx-lit-review** — main-agent cross-corpus retrieval, source-selective follow-up policy, and paper content; the preferred starting point for academic/research queries.
- ## Typical workflow
- Orienting in a project (read-only discovery):
- ```sh
- orx projects # find the project id
- orx project view <projectId> # see the tree, pick an experiment id
- orx skill experiment-tree # the model + the auto-research loop
- orx runs <projectId> # find a run id
- orx logs <runId> # locate its log, then inspect the file
- ```
- To actually **drive** a project toward a goal — edit each node's code on its Git
- branch and keep the round moving — follow the auto-research loop in
- the `orx-experiment-tree` module. Every completed run is a decision point with
- four moves: **repair** the same node when a run answered nothing, **refill**
- the round with another sibling, **promote** the winner and descend, or **stop**.
README.md · README · 111 lines · 1 finding marked
- <div align="center">
- <h1><img src=".github/readme-assets/openresearch.svg" alt="" width="56" align="absmiddle" /> OpenResearch</h1>
- The local-first harness & workspace for research agents.
- <p><em>an <a href="https://alphaxiv.org"><img src=".github/readme-assets/alphaxiv.svg" alt="" width="18" height="18" align="absmiddle" /> alphaXiv</a> project</em></p>
- <p>
- <a href="https://github.com/alphaXiv/OpenResearch/releases/latest"><img src="https://img.shields.io/github/v/release/alphaXiv/OpenResearch?style=flat-square" alt="Latest release" /></a>
- <a href="https://github.com/alphaXiv/OpenResearch/blob/main/LICENSE"><img src="https://img.shields.io/github/license/alphaXiv/OpenResearch?style=flat-square" alt="License" /></a>
- </p>
- <p><a href="README.md">English</a> · <a href="README.es.md">Español</a> · <a href="README.ko.md">한국어</a> · <a href="README.zh.md">简体中文</a> · <a href="README.ja.md">日本語</a> · <a href="README.ru.md">Русский</a> · <a href="README.tr.md">Türkçe</a></p>
- <p><img src=".github/readme-assets/openresearch-demo.gif" alt="OpenResearch desktop app: an agent searches alphaXiv to diagnose a training run, then opens its Trackio charts and result figures" width="680" /></p>
- <hr />
- <p>Whether you’re looking for a copilot or an autoresearch tool, OpenResearch will accelerate your work. Launch research agents that can review literature, develop hypotheses, run experiments, and produce research artifacts.</p>
- <p>
- <a href="https://github.com/alphaXiv/OpenResearch/releases/latest/download/OpenResearch.dmg"><picture><source media="(prefers-color-scheme: dark)" srcset=".github/readme-assets/download-macos-dark.svg"><img src=".github/readme-assets/download-macos.svg" alt="Download OpenResearch for macOS" width="220" height="44" /></picture></a>
- <a href="https://github.com/alphaXiv/OpenResearch/releases/latest/download/OpenResearch-Setup.exe"><picture><source media="(prefers-color-scheme: dark)" srcset=".github/readme-assets/download-windows-dark.svg"><img src=".github/readme-assets/download-windows.svg" alt="Download OpenResearch for Windows (Beta)" width="220" height="44" /></picture></a>
- <a href="https://github.com/alphaXiv/OpenResearch/releases/latest/download/OpenResearch-x86_64.AppImage"><picture><source media="(prefers-color-scheme: dark)" srcset=".github/readme-assets/download-linux-dark.svg"><img src=".github/readme-assets/download-linux.svg" alt="Download OpenResearch for Linux" width="220" height="44" /></picture></a>
- </p>
- <p>
- <a href="https://openresearch.sh/docs"><img src=".github/readme-assets/action-documentation.svg" alt="Documentation" width="132" height="24" /></a><img src=".github/readme-assets/action-separator.svg" alt=" · " width="12" height="24" />
- <a href="https://github.com/alphaXiv/OpenResearch/releases"><img src=".github/readme-assets/action-releases.svg" alt="Releases" width="78" height="24" /></a>
- </p>
- <p><sub>macOS 11+ · Windows beta requires <a href="https://gitforwindows.org">Git for Windows</a> · <a href="https://openresearch.sh/docs/install">Linux</a> app needs glibc 2.35+</sub></p>
- <p><a href="https://trendshift.io/repositories/89363"><img src="https://trendshift.io/api/badge/repositories/89363" alt="GitHub Trending: #1 Repository of the Day" width="250" height="55" /></a>
- <a href="https://trendshift.io/repositories/89363?utm_source=trendshift-badge&utm_medium=badge&utm_campaign=badge-trendshift-89363" target="_blank" rel="noopener noreferrer"><img src="https://trendshift.io/api/badge/trendshift/repositories/89363/daily?language=Rust" alt="alphaXiv/OpenResearch | Trendshift" width="250" height="55" /></a></p>
- </div>
- ## Get started
- **We recommend using the OpenResearch desktop app.** Download it for your platform:
- - [macOS](https://github.com/alphaXiv/OpenResearch/releases/latest/download/OpenResearch.dmg)
- - [Windows (Beta)](https://github.com/alphaXiv/OpenResearch/releases/latest/download/OpenResearch-Setup.exe)
- - Linux: [x86_64](https://github.com/alphaXiv/OpenResearch/releases/latest/download/OpenResearch-x86_64.AppImage) · [ARM64](https://github.com/alphaXiv/OpenResearch/releases/latest/download/OpenResearch-aarch64.AppImage)
- <details>
- <summary>Prefer the standalone CLI? Install on macOS or Linux</summary>
- ```sh
- curl -LsSf https://openresearch.sh/install.sh | sh
- Note: Pipes a downloaded script directly into a shell (curl | sh / wget | bash)
- Line 52 on GitHub
- orx up
- ```
- `orx up` opens the local dashboard at `http://127.0.0.1:4791`.
- On a managed Mac, device-management policies may block the CLI installed by
- `install.sh` because it is not yet signed. Use the signed and notarized desktop
- app instead. You can also install `orx` for your terminal from the app's
- Settings → Updates → **Install the `orx` command**.
- </details>
- Create an account at [openresearch.sh](https://openresearch.sh) to receive email
- updates and use managed OpenResearch compute.
- ## How it works
- **Use your favorite coding agent.** OpenResearch works natively with <img src=".github/readme-assets/claude.svg" alt="" width="18" height="18" align="texttop" /> Claude Code,
- <img src=".github/readme-assets/codex.svg" alt="" width="18" height="18" align="texttop" /> Codex,
- <img src=".github/readme-assets/opencode.svg" alt="" width="18" height="18" align="texttop" /> OpenCode,
- <img src=".github/readme-assets/cursor.svg" alt="" width="18" height="18" align="texttop" /> Cursor, and
- <img src=".github/readme-assets/antigravity.svg" alt="" width="18" height="18" align="texttop" /> Google Antigravity.
- You can also [use a local model](https://openresearch.sh/docs/agents) with OpenCode through
- <img src=".github/readme-assets/lmstudio.svg" alt="" width="18" height="18" align="texttop" /> LM Studio,
- <img src=".github/readme-assets/omlx.svg" alt="" width="18" height="18" align="texttop" /> oMLX,
- <img src=".github/readme-assets/rapid-mlx.svg" alt="" width="18" height="18" align="texttop" /> Rapid-MLX,
- <img src=".github/readme-assets/ollama.svg" alt="" width="18" height="18" align="texttop" /> Ollama, or a custom endpoint.
- **Ground research hypotheses in the latest literature.** OpenResearch integrates with <img src=".github/readme-assets/alphaxiv.svg" alt="" width="18" height="18" align="absmiddle" /> alphaXiv, <img src=".github/readme-assets/biorxiv.svg" alt="" width="18" height="18" align="absmiddle" /> bioRxiv, and <img src=".github/readme-assets/pubmed.svg" alt="" width="18" height="18" align="absmiddle" /> PubMed so agents can find relevant papers, develop informed hypotheses, and connect their experiments to existing research.
- **Choose your compute.** Run experiments locally or use SSH,
- Slurm,
- <img src=".github/readme-assets/kubernetes.svg" alt="" width="18" height="18" align="texttop" /> Kubernetes,
- <img src=".github/readme-assets/modal.svg" alt="" width="18" height="18" align="texttop" /> Modal,
- <img src=".github/readme-assets/thinking-machines.svg" alt="" width="18" height="18" align="texttop" /> Tinker,
- <img src=".github/readme-assets/ray.svg" alt="" width="18" height="18" align="texttop" /> Ray,
- <img src=".github/readme-assets/huggingface.svg" alt="" width="18" height="18" align="texttop" /> Hugging Face Jobs, and
- managed OpenResearch compute.
- **Give agents a memory of every experiment.** OpenResearch records every experiment in a local SQL database and keeps its logs, code,
- and artifacts on your machine so that agents can
- learn from past results and decide what to try next. The desktop app makes it
- easy to see what your agents have done and inspect the evidence behind each result.
- **Keep and own your research.** Run entirely locally. We don't collect your code or agent traces. Your projects,
- conversations, experiments, logs, and artifacts stay on your machine, under your
- control.
- ## Usage analytics
- Official release builds send opt-out, coarse product analytics events and detailed agent feedback in the background tied to a random
- installation ID. Your code, prompts, file contents or paths,
- repository names, tokens, emails, or project and experiment identifiers are not collected. Anonymized token/message counts are used to identify
- which models are being used across OpenResearch and can be seen at https://openresearch.sh/rankings. Feedback reports from the agent are sent for
- bug reports, feature requests, and general frustrations about OpenResearch. Agents are
- instructed to sanitize reports to exclude any sensitive information about your research or code.
- You can turn off all usage analytics and agent feedback in the desktop app's
- Settings or with `orx telemetry off`.
scripts/test_release_notes.py · Bundled script · 137 lines · 1 finding marked
- import unittest
- import subprocess
- import os
- import tempfile
- from unittest.mock import patch
- from release_notes import compose, fixed_issues, refresh_downloads, DESKTOP_ASSETS, main, previous_stable_release, remote_install
- class ReleaseNotesTest(unittest.TestCase):
- def test_generated_notes_start_at_the_previous_stable_release(self):
- releases = [[{"tag_name": "v0.2.21", "draft": False, "prerelease": False}]]
- with tempfile.TemporaryDirectory() as directory, \
- patch.dict(os.environ, {"GITHUB_REPOSITORY": "alphaXiv/OpenResearch"}), \
- patch("sys.argv", ["release_notes.py", "v0.2.22", "new-commit", os.path.join(directory, "notes")]), \
- patch("release_notes.gh", side_effect=[releases, {"status": "ahead"}, {"body": "Changes."}]) as api:
- main()
- self.assertEqual(api.call_args_list[0].args, ("repos/alphaXiv/OpenResearch/releases?per_page=100", "--paginate", "--slurp"))
- self.assertEqual(api.call_args_list[1].args, ("repos/alphaXiv/OpenResearch/compare/v0.2.21...new-commit",))
- self.assertIn("previous_tag_name=v0.2.21", api.call_args_list[2].args)
- def test_recovered_release_uses_an_earlier_stable_ancestor(self):
- def release(tag, *, draft=False, prerelease=False):
- return {"tag_name": tag, "draft": draft, "prerelease": prerelease}
- releases = [
- [release("v0.2.23"), release("canary-20261027.1", prerelease=True), release("v0.2.20")],
- [release("v0.2.19"), release("v0.2.21", draft=True), release("v0.2.9")],
- ]
- with patch("release_notes.gh", side_effect=[releases, {"status": "diverged"}, {"status": "ahead"}]) as api:
- previous = previous_stable_release("alphaXiv/OpenResearch", "v0.2.21", "old-commit")
- self.assertEqual(previous, "v0.2.19")
- self.assertEqual(api.call_args_list[1].args, ("repos/alphaXiv/OpenResearch/compare/v0.2.20...old-commit",))
- self.assertEqual(api.call_args_list[2].args, ("repos/alphaXiv/OpenResearch/compare/v0.2.19...old-commit",))
- def test_release_without_a_stable_ancestor_fails_closed(self):
- releases = [[{"tag_name": "v0.2.20", "draft": False, "prerelease": False}]]
- with patch("release_notes.gh", side_effect=[releases, {"status": "behind"}]):
- with self.assertRaisesRegex(ValueError, "No earlier stable release"):
- previous_stable_release("alphaXiv/OpenResearch", "v0.2.21", "old-commit")
- def test_linked_issues_and_order(self):
- notes = (
- "## What's Changed\n"
- "* Fix paper in https://github.com/alphaXiv/OpenResearch/pull/417\n"
- "* Follow-up in https://github.com/alphaXiv/OpenResearch/pull/418\n\n"
- "**Full Changelog**: https://github.com/alphaXiv/OpenResearch/compare/v1...v2\n"
- )
- issue = {"title": "Handle [arXiv] links", "url": "https://github.com/alphaXiv/OpenResearch/issues/457", "state": "CLOSED"}
- open_issue = {"title": "Still open", "url": "https://github.com/alphaXiv/OpenResearch/issues/999", "state": "OPEN"}
- response = {"data": {"repository": {"pullRequest": {"closingIssuesReferences": {"nodes": [issue, open_issue]}}}}}
- with patch("release_notes.gh", return_value=response) as api:
- issues = fixed_issues(notes, "alphaXiv/OpenResearch")
- self.assertEqual(api.call_count, 2)
- self.assertEqual(len(issues), 1)
- rendered = compose(notes, issues, "")
- self.assertLess(rendered.index("## Download OpenResearch"), rendered.index("## What's Changed"))
- self.assertLess(rendered.index("## What's Changed"), rendered.index("## Fixed issues"))
- self.assertLess(rendered.index("## Fixed issues"), rendered.index("**Full Changelog**"))
- self.assertIn("[Handle \\[arXiv\\] links]", rendered)
- self.assertNotIn("Still open", rendered)
- def test_desktop_downloads_only_link_uploaded_assets(self):
- assets = [
- {"name": name, "browser_download_url": f"https://github.com/alphaXiv/OpenResearch/releases/download/v0.2.14/{name}"}
- for name, _, _ in DESKTOP_ASSETS
- ]
- assets.append({"name": "openresearch-cli-installer.sh", "browser_download_url": "https://example.com/installer.sh"})
- body = compose("## What's Changed\n\nChanges.", [], "")
- self.assertIn("https://openresearch.sh/", body)
- self.assertNotIn("openresearch-cli", body)
- partial = refresh_downloads(body, assets[:1])
- self.assertIn("OpenResearch.dmg", partial)
- self.assertNotIn("OpenResearch-Setup.exe", partial)
- refreshed = refresh_downloads(partial, assets)
- for name, _, _ in DESKTOP_ASSETS:
- self.assertIn(name, refreshed)
- self.assertEqual(refreshed.count('<picture>'), 4)
- self.assertIn('download-macos-dark.svg', refreshed)
- self.assertIn('alt="Download for Linux (x86)"', refreshed)
- self.assertIn('download-linux-arm64-dark.svg', refreshed)
- self.assertIn('alt="Download for Linux (ARM64)"', refreshed)
- self.assertNotIn("installer.sh", refreshed)
- self.assertNotIn("https://openresearch.sh/", refreshed)
- self.assertTrue(refreshed.endswith("## What's Changed\n\nChanges.\n"))
- self.assertEqual(refresh_downloads(refreshed, assets), refreshed)
- legacy = "Older notes without a managed section"
- self.assertEqual(refresh_downloads(legacy, assets), legacy)
- for malformed in ("<!-- desktop-downloads:start -->", "<!-- desktop-downloads:end -->"):
- with self.assertRaises(ValueError):
- refresh_downloads(malformed, assets)
- def test_refresh_patches_only_the_selected_release_body(self):
- body = compose("## What's Changed\n\nChanges.", [], "")
- assets = [{"name": "OpenResearch.dmg", "browser_download_url": "https://example.com/OpenResearch.dmg"}]
- release = {"id": 123, "body": body, "assets": assets}
- with patch.dict(os.environ, {"GITHUB_REPOSITORY": "alphaXiv/OpenResearch"}), \
- patch("sys.argv", ["release_notes.py", "--refresh-downloads", "v0.2.14"]), \
- patch("release_notes.gh", side_effect=[release, {}]) as api:
- main()
- self.assertEqual(api.call_args_list[0].args, ("repos/alphaXiv/OpenResearch/releases/tags/v0.2.14",))
- self.assertEqual(api.call_args_list[1].args, (
- "repos/alphaXiv/OpenResearch/releases/123", "-X", "PATCH", "-f",
- "body=" + refresh_downloads(body, assets),
- ))
- def test_refresh_does_not_patch_legacy_or_unchanged_notes(self):
- for body in ("Older release notes", compose("Changes.", [], "")):
- with patch.dict(os.environ, {"GITHUB_REPOSITORY": "alphaXiv/OpenResearch"}), \
- patch("sys.argv", ["release_notes.py", "--refresh-downloads", "v0.2.14"]), \
- patch("release_notes.gh", return_value={"id": 123, "body": body, "assets": []}) as api:
- main()
- self.assertEqual(api.call_count, 1)
- def test_remote_install_is_collapsed_and_versioned(self):
- remote = remote_install("alphaXiv/OpenResearch", "v0.2.14")
- body = compose("## What's Changed\n\nChanges.", [], remote)
- self.assertIn("<details>\n<summary>Install ORX on a remote machine</summary>", body)
- self.assertIn("curl --proto '=https' --tlsv1.2 -LsSf https://github.com/alphaXiv/OpenResearch/releases/download/v0.2.14/openresearch-cli-installer.sh | sh", body)
- Note: Pipes a downloaded script directly into a shell (curl | sh / wget | bash)
- Line 119 on GitHub
- self.assertLess(body.index("## Download OpenResearch"), body.index("<details>"))
- self.assertLess(body.index("</details>"), body.index("## What's Changed"))
- self.assertIn(remote, refresh_downloads(body, []))
- def test_issue_lookup_failure_keeps_other_issues(self):
- notes = (
- "* First in https://github.com/alphaXiv/OpenResearch/pull/1\n"
- "* Second in https://github.com/alphaXiv/OpenResearch/pull/2"
- )
- issue = {"title": "Fixed", "url": "https://github.com/alphaXiv/OpenResearch/issues/3", "state": "CLOSED"}
- response = {"data": {"repository": {"pullRequest": {"closingIssuesReferences": {"nodes": [issue]}}}}}
- with patch("release_notes.gh", side_effect=[subprocess.CalledProcessError(1, "gh"), response]):
- issues = fixed_issues(notes, "alphaXiv/OpenResearch")
- self.assertEqual(len(issues), 1)
- if __name__ == "__main__":
- unittest.main()
Ratings and comments
Sign in to rate this skill.
Sign inFree to use. If it’s helped, pass it on.