Implement the Gitea extension

The repository was a bare Nova scaffold. This builds it out to match the
capabilities of the official Gitea VS Code extension.

Sidebar sections:
  - Current Branch: pull requests and workflow runs for the checked-out
    branch, with a current/all/pinned branch filter
  - Workflows: runs grouped by workflow file, expanding into jobs, steps,
    and artifacts
  - Pull Requests: open pull requests across repositories, expanding into
    reviews, review comments, and changed files
  - Settings: per-instance connection state, plus repository Actions
    secrets and variables

Commands cover run control (re-run, re-run failed jobs, re-run a job,
cancel), job logs, artifact download/reveal/open, pull request overview,
diff, checkout, creation, merge and close, the full review cycle, and
secret and variable management. Multiple instances are supported, routed
by git remote host, with tokens held per instance in the Keychain.

Nova exposes no webview, diff editor, editor decorations, or extension
status bar, so four features are shaped differently from the VS Code
original: the pull request timeline renders as Markdown, diffs open as
unified .diff documents, review comments are published through an
IssueCollection so they appear in the gutter and the Issues sidebar, and
a failed run posts a notification. OAuth and insecureSkipVerify have no
Nova equivalent and are omitted. README.md records all of this.

Endpoints were taken from Gitea's published swagger.v1.json. Servers
predating the workflow runs API fall back to /actions/tasks.

Tests/ runs the extension's real code under Node against a stubbed Nova
runtime and a canned Gitea instance: 88 checks, no install step and no
network. Images are generated by Tools/make-icons.py.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01MQuusXgZC2dzwpJJ1qhtti
This commit is contained in:
2026-08-28 19:55:54 -03:00
co-authored by Claude Opus 5
commit 694609a3cc
58 changed files with 6231 additions and 0 deletions
+71
View File
@@ -0,0 +1,71 @@
//
// "Open in Browser" and "Copy URL" for whatever is selected in the sidebar.
//
const selection = require("./selection.js");
const ui = require("../ui.js");
/** Best web URL for a node, walking up to its repository as a last resort. */
function urlFor(node) {
if (!node) return null;
const data = node.data || {};
// Most specific first: a job page beats its run's, a comment beats its
// pull request's. Anything without a page of its own falls back to the
// repository.
const direct =
(data.comment && data.comment.html_url) ||
(data.review && data.review.html_url) ||
(data.file && data.file.html_url) ||
(data.job && data.job.html_url) ||
(data.pull && data.pull.html_url) ||
(data.run && data.run.html_url) ||
null;
if (direct) return direct;
if (node.kind === "workflow") {
const repo = selection.repoOf(node);
return repo ? `${repo.htmlUrl}/actions?workflow=${encodeURIComponent(node.name)}` : null;
}
if (node.kind === "instance" && data.baseUrl) return data.baseUrl;
if (node.kind === "secretsFolder" || node.kind === "secret") {
const repo = selection.repoOf(node);
return repo ? `${repo.htmlUrl}/settings/actions/secrets` : null;
}
if (node.kind === "variablesFolder" || node.kind === "variable") {
const repo = selection.repoOf(node);
return repo ? `${repo.htmlUrl}/settings/actions/variables` : null;
}
return repoUrl(node);
}
function repoUrl(node) {
const repo = selection.repoOf(node);
return repo ? repo.htmlUrl : null;
}
function register() {
nova.commands.register("gitea.openInBrowser", (argument) => {
const url = urlFor(selection.selectedNode(argument));
if (!url) {
ui.warn("There is no web page for that item.");
return;
}
nova.openURL(url);
});
nova.commands.register("gitea.copyUrl", (argument) => {
const url = urlFor(selection.selectedNode(argument));
if (!url) {
ui.warn("There is no URL for that item.");
return;
}
nova.clipboard.writeText(url);
ui.info(`Copied ${url}`);
});
}
exports.register = register;
exports.urlFor = urlFor;