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
+73
View File
@@ -0,0 +1,73 @@
//
// "Workflows" section: every run in the repository, grouped by workflow file.
// Servers without the workflow runs API fall back to a flat "Recent Runs" list.
//
const builders = require("./builders.js");
const nodes = require("./nodes.js");
const { NodeProvider } = require("./provider.js");
const { node, message, errorNode } = nodes;
class WorkflowsProvider extends NodeProvider {
roots() {
const store = this.store;
if (!store.hasAnyToken) {
return [message("No token stored. Run “Gitea → Set Token…” to sign in.")];
}
if (!store.repos.length) {
return [message(store.loading ? "Loading…" : "No Gitea repositories found.")];
}
const sections = store.repos.map((repo) => this.repoSection(repo));
return store.repos.length === 1 ? sections[0].children : sections;
}
repoSection(repo) {
const { runs, error, legacy } = this.store.runsFor(repo.key);
let children;
if (error) children = [errorNode(error)];
else if (!runs.length) children = [message("No workflow runs.")];
else if (legacy) children = runs.map((run) => builders.runNode(this.store, repo, run));
else children = this.groupByWorkflow(repo, runs);
return node("repo", repo.fullName, {
identifier: `wf-repo-${repo.key}`,
description: legacy ? "recent runs" : `${runs.length} runs`,
tooltip: repo.htmlUrl,
contextValue: "repo",
repo: repo,
data: { repoKey: repo.key },
expanded: true,
children: children,
});
}
groupByWorkflow(repo, runs) {
const groups = new Map();
for (const run of runs) {
const key = nodes.workflowKey(run);
if (!groups.has(key)) {
groups.set(key, { label: nodes.workflowLabel(run), runs: [] });
}
groups.get(key).runs.push(run);
}
return [...groups.entries()].map(([key, group]) => {
const latest = group.runs[0];
return node("workflow", group.label, {
identifier: `wf-${repo.key}-${key}`,
description: `${nodes.glyphFor(nodes.runState(latest))} ${group.runs.length}`,
tooltip: `${key}\nMost recent: ${nodes.runTitle(latest)}`,
contextValue: "workflow",
repo: repo,
data: { workflowPath: key, run: latest, repoKey: repo.key },
children: group.runs.map((run) => builders.runNode(this.store, repo, run)),
});
});
}
}
exports.WorkflowsProvider = WorkflowsProvider;