Skip to content
Projetos

Sobre

Local web UI for code review

Ferramentas de desenvolvimento

Como estes números são medidos

Crescimento medido de estrelas

em 24 h
+2
em 7 dias
+13
em 15 dias
Coletando histórico
em 1 mês
Coletando histórico

Variações líquidas em períodos sobrepostos, não totais diários. Medições ausentes ficam em branco. Estrelas indicam interesse, não qualidade.

README.md

Original

skepsis

σκέψις: viewing, perception by the senses. Examination, speculation, consideration.

A fast, fully local code review UI for the browser and terminal. Review your (or your agent's) diff before inflicting it on the world.

  • Fast even with huge diffs
  • Runs in the browser or in the terminal (standalone or as a jj/git pager)
  • GitHub-style split or unified diff view with syntax highlighting
  • Mark files as viewed
  • Inline review comments are written directly into source files as code comments or piped to a specified command
  • Works with jj and git (tries jj first, falls back to git)
  • Vim-style navigation shortcuts (press ? to see the list)

https://github.com/user-attachments/assets/698365ab-964c-4e38-a605-82bec4879f60

Setup

Requires Node.js v22+.

Run without installing (add @latest to bypass the npx cache):

npx @oxide/skepsis

Or install globally:

npm install --global @oxide/skepsis
skepsis

Either way, you may want a shorter alias like alias sk="skepsis" (or alias sk="npx @oxide/skepsis").

Optional: TUI mode as diff pager

With skepsis installed globally, you can use --tui as your diff pager for jj or git (see In the terminal for details). Non-patch output (like --stat or --summary) is printed as-is without paging. If stdout isn't a terminal, the patch is passed through unchanged.

In jj, add it as a scoped pager only for diff commands so jj log keeps your usual pager:

[ui]
diff-formatter = ":git"

[[--scope]]
--when.commands = ["diff", "show", "interdiff"]
[--scope.ui]
pager = ["skepsis", "--tui"]

In git:

git config --global pager.diff 'skepsis --tui'
git config --global pager.show 'skepsis --tui'

Set SKEPSIS_SEND (or pass --send) to send comments straight to a coding agent from either the browser or the TUI.

Usage

Takes -r/--revision, -f/--from, and -t/--to flags for specifying the commit range. The VCS is auto-detected. In jj mode, the flags are passed straight to jj diff. In git mode, they have to be translated slightly. See the examples below.

  • Each invocation picks a free port by default, so you can run multiple instances simultaneously. Pass --port/-p (e.g. skepsis --port 8080) for a specific port, and --host as well if the server needs to be reachable from another machine (skepsis --host 0.0.0.0 --port 8080). In --dev mode, --port sets the browser-facing Vite port; the proxied API server continues to use a free port.
  • skepsis opens the page in a browser when it starts on localhost. Pass --no-open to skip that, for example when a script starts it in the background. Once the server is listening, it prints the URL to stdout. The URL ends in #token=…, a secret generated for each run. On the first pageload, the page exchanges the token for a cookie, so reloads and new tabs on the same address work in that browser.
  • To open it some other way, such as in a particular browser or a window of its own, pass --open-cmd <command> (or set SKEPSIS_OPEN in the environment). skepsis runs it with sh -c and passes the URL as $1 (or appends it as the last argument if the command doesn't mention $1), e.g. skepsis --open-cmd 'open -na "Google Chrome" --args --app="$1"'. --dev mode ignores --open-cmd because Vite opens the page itself.
  • Tabs are two columns wide by default. Pass --tab-size <columns> (or set SKEPSIS_TAB_SIZE in the environment) to change that.

jj examples

The examples use skepsis, the installed bin name. An sk alias works the same way.

skepsis                          # review branch vs trunk, GitHub PR style
                                 # (jj diff --from 'fork_point(trunk() | @)')
skepsis -r @                     # review working copy only
skepsis -r 'mybranch..@'         # review a range
skepsis -f main -t @             # diff between two revisions
skepsis --interdiff -f mybranch@origin -t mybranch
                                 # review changes to a commit since push
                                 # (jj interdiff)

In jj repos, --interdiff (with -f, -t, or both) runs jj interdiff, showing only what changed in a commit across an amend/rebase rather than upstream changes. Description changes appear as JJ-COMMIT-DESCRIPTION, and conflicts from rebasing --from show as removed lines. Line expansion and inline comments are disabled for interdiffs (--send still works).

git examples

Ranges passed with -r are passed through verbatim to git diff.

skepsis                          # review branch + working tree vs origin
                                 # (git diff --merge-base origin/HEAD; falls
                                 # back to origin/main, origin/master, main,
                                 # master)
skepsis -f main                  # diff since main: git diff main HEAD
skepsis -r main..my-branch       # review commits on my-branch
skepsis -r HEAD~5..HEAD          # review the last 5 commits
skepsis -f v1.2.0 -t v1.3.0      # compare two tags
skepsis --git                    # force git in a jj-colocated repo

In the terminal

Side-by-side TUI diff view

Pass --tui to review diffs in the terminal instead of a browser. It works as a standalone command with the same diff flags as the web UI (-r, -f, -t, --git, paths), or as a pager reading a patch from stdin.

Press ? for shortcuts. Beyond vim-style navigation, folding, and search, the TUI supports side-by-side diffs (s, automatic at 160+ columns), a files panel (b), a fuzzy file picker (ctrl-p), inline PNG diffs in kitty-graphics terminals, and light/dark themes (t, matched to the terminal background by default).

File viewed marks (v) are shared with the web UI; V marks a single hunk. Comments (c) work on cursor lines, x-selected lines, or mouse-selected text: they write <review> blocks into the working copy (press R on a <review> block to resolve it), or send JSON to --send. When both are available, Enter sends and Ctrl-S writes to the file. When diffing the working copy, r reloads the diff in place and background polling shows a notice when files change on disk (pass --no-poll to disable). As a pager for jj diff, jj show, or jj interdiff (on Linux, or macOS with Node 26+), skepsis inspects its parent process so r, polling, and --send metadata work just like standalone mode and the web UI.

Browser-only flags (--host, --port, --no-open, --open-cmd, and --dev) can't be combined with --tui. See Optional: TUI mode as diff pager above for jj and git pager setup.

Sending comments to another program

--send <command> (or SKEPSIS_SEND in the environment) adds a Send button to the comment box, which pipes the comment to a shell command instead of writing it into the file. Use it to pass review comments straight to a coding agent, a tmux pane, or a log. There is no chat UI in skepsis (yet) so replies from the agent will appear in that session, wherever it is. Send works in some cases that inline comments can't (because there is no file to write): on removed lines, and on diffs that don't end at the working copy. The Comment button continues to write a <review> marker in the file as usual. When you send a comment on selected text, the message includes where the selection starts and ends.

The command can only be set with --send or SKEPSIS_SEND, never from the repo itself. Only the page skepsis opened can trigger a send (see Security below).

skepsis runs the command with sh -c in the directory it was started in. The command inherits skepsis's environment (which is how the agent samples find their session), plus SKEPSIS_URL (the page's address, web UI only) and SKEPSIS_ROOT (the directory skepsis was started in). It gets the comment on stdin as one line of JSON whose prompt field is the whole comment as a message. Some sample commands to start from:

# Claude Code. CLAUDE_CODE_MESSAGING_SOCKET is only set in commands the session
# runs; from any other shell, use the session's socket path instead
# (/tmp/cc-socks/<pid of claude>.sock)
SKEPSIS_SEND='jq -c "{type:\"user\",message:{role:\"user\",content:.prompt}}" | nc -U "$CLAUDE_CODE_MESSAGING_SOCKET"'

# Codex. CODEX_THREAD_ID is likewise only set inside the session
SKEPSIS_SEND='codex queue --thread "$CODEX_THREAD_ID" --message "$(jq -r .prompt)"'

# a tmux pane named review, pasted so newlines don't submit early
SKEPSIS_SEND='jq -r .prompt | tmux load-buffer -b skepsis - && tmux paste-buffer -p -d -b skepsis -t review && tmux send-keys -t review Enter'

# a log file
SKEPSIS_SEND='jq -c . >> ~/review-comments.jsonl'
JSON format and exit status

The JSON sent to stdin looks like this:

{
  "version": 1,
  "root": "/home/me/project",
  "diff": { "command": "jj diff -r @-", "toWorkingCopy": false },
  "file": "src/a.ts",
  "side": "additions",
  "lines": [42, 45],
  "columns": null,
  "code": [{ "lines": [41, 46], "text": "const z = 0\nconst a = 1\n…" }],
  "changes": [
    {
      "deletions": [42, 42],
      "additions": [42, 43],
      "diff": "-const a = 0\n+const a = 1\n+const b = 2"
    }
  ],
  "blob": "9daeafb",
  "text": "why two?",
  "prompt": "Review comment on src/a.ts, lines 42–45 (new side of `jj diff -r @-`), in lines 41–46:\n\n```\nconst z = 0\nconst a = 1\n…\n```\n\nOld line 42 became new lines 42–43:\n\n```diff\n-const a = 0\n+const a = 1\n+const b = 2\n```\n\nwhy two?"
}
  • side and lines: additions or deletions, and the 1-based inclusive line range in that side's numbering.
  • columns: set for text selections (0-based [start, end) UTF-16 code units in the first and last line), or null for whole lines. prompt marks selected text with ⟦ and ⟧.
  • code: excerpt of that side around the commented lines, split into separate runs if the range spans hidden lines.
  • changes: change runs touching the commented lines, or null if they are all context. Each entry has deletions and additions line ranges (null when that side has none) plus a unified diff snippet, capped at 12 lines per side with … for omitted lines.
  • blob: git object ID of the file version shown when commenting (which may be older than disk if the file changed before a refresh), or null when there is none (e.g. an added file's old side or a pure rename).
  • prompt: the full comment formatted as plain text, for consumers that only want a message.

Exit 0 means the comment was delivered, and the page keeps the comment in the diff, under the line it was on, until you dismiss it or reload. skepsis ignores stdout. Any other exit, or running past 10 seconds, is a failure: the page shows stderr (or the exit status) and keeps the comment in the box. Sends run one at a time, in the order they were submitted.

Notes on security

A request to /api/send can't set the command, but it does pipe arbitrary text to it, so lock down who is allowed to hit the endpoint by requiring a token. The token is generated per run of the server and passed to the page in the #token= fragment of the URL it opens. The page keeps it in localStorage, which only pages on that host and port can read. This keeps out other websites in the browser and anything coming in through a forwarded port. It doesn't keep out other users on the machine or other processes running as you.

As a backup, --send also requires a loopback --host, and /api/send rejects requests whose Host isn't a loopback name or whose Origin isn't the page's own.

How it works

The CLI starts a local HTTP server that shells out to jj diff or git diff, then serves the diff to a React frontend that uses @pierre/diffs to render it with syntax highlighting. In --tui mode, it skips the server and renders directly in the terminal using @pierre/highlights.

While the page is visible, it reruns the diff every few seconds in the background, and again as soon as you come back to the tab. When the diff has changed, it shows a toast with a Refresh button and a list of which files changed and by how many lines. The displayed diff never changes under you on its own. Pass --no-poll to turn this off.

The npm package ships compiled CLI/server JavaScript plus a prebuilt frontend bundle, so installing or running with npx does not build anything. In dev mode (--dev), a Vite dev server runs alongside the API server with hot reload from a source checkout.

Comments

Review comments are inserted into the source files, so they show up in your VCS diff and are visible to coding agents. They can be resolved (deleted) from the UI. Comments are only enabled when the diff includes the working copy (e.g., a revset ending in @ for jj, or an open-ended range ending at the working tree for git), since that's where the inserted lines land. The default diff in both modes ends at the working copy, so comments are enabled by default.

A comment goes in right after the line it's on. A comment on several lines goes after the last of them, and its open tag says how many it covers, counting up from the tag:

const start = Number(match[1])
const end = Number(match[2])
// <review covers="2 lines above">
// What about NaN?
// </review>

Selecting text in the diff opens the comment box for that selection (while the box is empty, ⌘C still copies the selection) and quotes it in the open tag, eliding the middle if long: <review on="Number(match[1])">.

Marking files viewed

Viewed state is stored per file in ~/.local/share/skepsis/ using the file's content hash (the git object ID from the diff header). If the file changes, the hash no longer matches and it automatically shows as unviewed again.

In --tui mode, v toggles a file's viewed mark (shared with the web UI), and V toggles a single hunk. Marking every hunk in a file marks the file itself. Files and hunks marked viewed start folded when you open a diff. The web UI doesn't support hunk-level viewed state yet.

Embedding

A Node server can mount the review page under any URL prefix, serving any number of diffs in one process:

import { createApp } from '@oxide/skepsis'

const app = await createApp({
  cwd, // absolute path of the repository root; jj or git runs here
  revisions: 'abc', // or from and to, as for the CLI's -r, -f, and -t
  send: async (payload, signal) => { ... }, // payload.prompt is the message; throw to report an error
})

// In the host's handler for requests under `${prefix}/`, where prefix has no trailing slash
const url = new URL(request.url)
url.pathname = url.pathname.slice(prefix.length)
const res = await app.fetch(new Request(url, request))

// The URL to open in the browser
const page = `http://localhost:${port}${prefix}/#token=${app.token}`
Options, routing, and security

createApp takes the same diff options as the CLI: revisions, or from and to, plus interdiff and files. It uses the CLI's default diff when revisions, from, and to are all left out. vcs is 'jj' or 'git', detected when left out. cwd has to be the root of the jj workspace or git worktree, not a directory below it. createApp rejects if cwd isn't a root, on a combination of options the CLI refuses, or if a first run of the diff command fails.

The page makes every request relative to its own URL, so it works at any path ending in /. The host removes its prefix before calling app.fetch. On Node 26.11 or later, a host served by @hono/node-server older than 2.1.8 gets "Illegal invocation" from new Request(url, request) (honojs/node-server#408). A host that bundles its own server has to leave @oxide/skepsis out of the bundle, since the library finds the page's files relative to its own module.

send is called with the JSON payload and an AbortSignal. An error it throws is shown in the page. Sends run one at a time, in order. After 10 s (sendTimeoutMs), skepsis reports a timeout, aborts the signal, and goes on to the next send. It can't stop the function, so one that ignores the signal may still deliver its comment, possibly after a later one. Pass the signal to fetch or whatever else does the delivery. Without send, the page has no Send button.

The app is guarded the way the CLI's server is unless guard is false. Leave the guard on unless the host checks requests itself. With it on:

  • API requests need app.token, which the page reads from #token= in the URL it is opened at.
  • /api/send also needs a loopback Host and an Origin of http:// plus that host. Send only works when the host is reached on loopback over plain http.
  • Each createApp call makes a new token. Keep the app for as long as its page may be open, since a page opened with an earlier app's token gets a 401.

A host that checks requests itself passes guard: false. app.token is then null, and the page's URL needs no fragment.

Development

Clone the repo when working on skepsis itself:

git clone https://github.com/oxidecomputer/skepsis.git
cd skepsis && npm install

Running from a checkout requires Node v22.18+, since the CLI runs as TypeScript directly via Node's built-in type stripping. Point an alias at the clone to run it from any repo:

alias sk="node ~/repos/skepsis/cli.ts"

--dev runs a Vite dev server with hot reload alongside the API server:

sk --dev

Before committing changes, run:

npm run ci

Versioning

  • patch — bug fixes, dependency bumps, internal changes
  • minor — new features: flags, keyboard shortcuts, UI capabilities
  • major — breaking changes to anything scriptable or on disk: removed or renamed flags, changed flag defaults, changed <review> comment or viewed-state formats, removed or changed fields in the --send JSON (adding a field is minor)

While the package is 0.x, the library API may change in a minor version.

Releases

Publishing releases and canaries

To publish a release, bump the version and land the change on main:

npm version patch --no-git-tag-version   # or minor/major — bumps package.json
jj commit -m 'v0.1.1'                    # land the bump on main via PR

On every push to main, CI checks whether the package.json version is already on the registry. If not, the Release workflow pauses in a "waiting for review" state. A required reviewer must approve the release environment deployment from the workflow run before the publish proceeds. After publishing, it creates a matching GitHub release like v0.1.1 with auto-generated notes listing the PRs merged since the previous release.

To publish a canary build of a PR, go to the Release workflow, click "Run workflow", and enter the PR number. It publishes the PR's head as <version>-canary.<pr>.<sha> under the canary dist-tag and comments the version on the PR. The dispatched workflow requires the same release environment approval before publishing, and only accepts PRs from branches in this repo, not forks.

Explore projetos relacionados

Carregando…