Skip to content

feat(cli): add the change workflow - #3

Merged
PiquelChips merged 1 commit into
mainfrom
feat/local-cli
Nov 4, 2026
Merged

PiquelChips merged 1 commit into
mainfrom
feat/local-cli

Conversation

@PiquelChips

@PiquelChips PiquelChips commented Oct 14, 2026 •

Copy link
Copy Markdown
Member

The old CLI was built on commits and branches, which v2 removes.

What it adds:

  • origin init. It creates the node key in ~/.config/origin (or $ORIGIN_CONFIG_DIR), a signed policy target naming this node the authority of policy and main, an empty main, and a first change.
  • No commit, no staging area. The working copy is always on a revision of the current change. Every command that reads it snapshots it first, using the stat cache and parallel hashing, and writes new objects in one durable batch.
  • Drafts. A snapshot alone is a draft. status, diff, show, log and evolog show it without recording anything. The commands that build on the change (new, describe, edit, abandon, converge) record it as a new revision first, so a change's history holds the points that mattered rather than every command run while editing.
  • Commands: new, describe, edit, status, diff, show, log, evolog, abandon, converge and index rebuild. Changes are named by any unique id prefix, and divergence shows in status, log and show.
  • Closed pipes. A closed output pipe (origin log | head) ends a command quietly instead of panicking.

Benchmarks (20k files, durable):

origin git
First snapshot about 400 ms 1.47 s
status, nothing changed about 31 ms 23 ms
status, 100 files edited about 57 ms 24 ms

status with edits still writes the new objects in one durable batch, but no longer records a revision. That took it from 70.7 ± 4.4 ms to 57.0 ± 4.8 ms (hyperfine, 40 runs). With nothing changed it stays at about 30 ms.

Review fixes: a crash's leftover temporary key no longer blocks init, init loads the key before creating .origin, the README gives the full config lookup order, and bench-git honors CARGO_TARGET_DIR and quotes the paths it hands to sh. Proved with two new tests that fail without their fix, just (320 tests), and bench-git run against a target path holding a space and a '.

Reviewed with review-loop: 1 round with 2× GPT-6.1 Sol and Claude Opus 5.5. Verdict: approved

Note

Written by Claude Opus 5.5 in Claude Code, reviewed by GPT-6.1 Sol and Claude Opus 5.5 over three review rounds (via T3 Code).

🤖 Generated with Claude Code

@PiquelChips
PiquelChips added this pull request to stack #7 October 14, 2026 14:38
@PiquelChips PiquelChips self-assigned this Oct 14, 2026
@PiquelChips PiquelChips added the enhancement New feature or request label Oct 14, 2026
@PiquelChips PiquelChips added this to the 0.1 milestone Oct 14, 2026
@PiquelChips PiquelChips moved this from Needs Triage to In Progress in sourceorigin.dev Oct 14, 2026
@PiquelChips
PiquelChips force-pushed the feat/local-cli branch 6 times, most recently from 9f980dc to da4eb3a Compare October 14, 2026 21:46
@PiquelChips
PiquelChips force-pushed the feat/local-cli branch 2 times, most recently from ca7c586 to 6b92dcd Compare October 14, 2026 22:00
@PiquelChips PiquelChips moved this from In Progress to Ready in sourceorigin.dev Oct 15, 2026
@coderabbitai

coderabbitai Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 29 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 55b8e830-70ef-4ccd-a403-387debc32fed
Commits

Reviewing files that changed from the base of the PR and between 0c0c7e2 and c21e9be.

Files ignored due to path filters: 1
  • Cargo.lock is excluded by !**/*.lock
Files selected for processing: 26
  • .cargo/config.toml
  • .gitignore
  • AGENTS.md
  • Cargo.toml
  • README.md
  • apps/origin-src/Cargo.toml
  • apps/origin-src/benches/snapshot.rs
  • apps/origin-src/src/cli.rs
  • apps/origin-src/src/config.rs
  • apps/origin-src/src/fixture.rs
  • apps/origin-src/src/index.rs
  • apps/origin-src/src/lib.rs
  • apps/origin-src/src/main.rs
  • apps/origin-src/src/output.rs
  • apps/origin-src/src/store/mod.rs
  • apps/origin-src/src/tree.rs
  • apps/origin-src/src/workspace.rs
  • apps/origin-src/src/worktree.rs
  • apps/origin-src/tests/cli.rs
  • crates/origin-shared/src/id.rs
  • crates/origin-shared/src/object/acceptance.rs
  • crates/origin-shared/src/object/tree.rs
  • docs/benchmarks.md
  • justfile
  • tools/xtask/Cargo.toml
  • tools/xtask/src/main.rs
Walkthrough

The change adds an origin CLI for repository initialization, working-copy status and diffs, change management, and history. It adds configuration and node-key handling, tree snapshots and diffs, end-to-end tests, and snapshot and Git benchmark tooling.

Changes: Origin working-copy CLI and benchmarking

Layer / File(s) Summary
Configuration and shared object contracts
Cargo.toml, apps/origin-src/Cargo.toml, apps/origin-src/src/config.rs, apps/origin-src/src/index.rs, apps/origin-src/src/lib.rs, crates/origin-shared/src/id.rs, crates/origin-shared/src/object/*
Configuration loading and node-key creation are added. Shared object helpers and display behavior are exposed, and Index::find_change resolves change-ID prefixes.
Working-tree snapshots and tree diffs
apps/origin-src/src/tree.rs, apps/origin-src/src/worktree.rs, apps/origin-src/src/store.rs, AGENTS.md
Tree diffs and working-tree snapshots are added. Snapshotting uses a stat cache; checkout applies file changes while preserving symlinks and executable permissions. Tests cover snapshots, cache behavior, and checkout.
Workspace operations and CLI
apps/origin-src/src/workspace.rs, apps/origin-src/src/cli.rs, apps/origin-src/src/output.rs, apps/origin-src/src/main.rs, apps/origin-src/tests/cli.rs, README.md, .gitignore, AGENTS.md
The workspace implements repository initialization and discovery, revision persistence, change operations, status, diffs, and history. The CLI dispatches these operations. End-to-end tests exercise repository workflows and command output.
Snapshot and Git benchmark tooling
.cargo/config.toml, Cargo.toml, apps/origin-src/Cargo.toml, apps/origin-src/src/fixture.rs, apps/origin-src/benches/snapshot.rs, tools/xtask/*, justfile, docs/benchmarks.md, README.md, AGENTS.md
Synthetic fixtures and snapshot benchmarks are added. cargo xtask bench-git runs four Origin-versus-Git scenarios and writes results to docs/benchmarks.md.

Estimated code review effort: 4 (Complex) | ~60 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  actor User
  participant Cli as origin CLI
  participant Config as UserConfig
  participant Workspace
  participant Worktree
  participant Store
  User->>Cli: run status
  Cli->>Config: load user configuration
  Cli->>Workspace: discover repository
  Workspace->>Worktree: snapshot working tree
  Worktree->>Store: write changed blobs and trees
  Worktree-->>Workspace: return tree ID and stat cache
  Workspace-->>Cli: print status
  Cli-->>User: display command result
Loading
Merge Risk: Moderate · previous review 0c0c7

If an edit, abandon or converge is interrupted partway through, the next command can silently save a mix of two changes' files as a new revision of the wrong change. That revision could later be landed. Smaller issues: a failed origin init can leave a repository that blocks retrying, a rare leftover temp file can stop node-key creation, and the git benchmark task fails with custom target directories or paths containing spaces. Address the checkout ordering before merging, or accept it explicitly.

Pre-merge checks: Passed 4
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly summarizes the main change: adding a CLI workflow for managing changes.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Finishing Touches
Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

A rabbit checks the paths at dawn
Then stores each change before moving on
A stat cache keeps the quiet files
While diffs line up across the miles
Benchmarks race through fields of green
And carrots mark each snapshot seen

@PiquelChips
PiquelChips removed this pull request from stack #7 October 18, 2026 16:03
@PiquelChips PiquelChips changed the title feat(cli): add the local workflow feat(cli): add the change workflow Oct 18, 2026
@PiquelChips
PiquelChips changed the base branch from feat/object-store to feat/index October 18, 2026 16:04
@PiquelChips
PiquelChips added this pull request to stack #18 October 18, 2026 16:04
@PiquelChips PiquelChips moved this from Ready to In Progress in sourceorigin.dev Oct 18, 2026
@PiquelChips
PiquelChips force-pushed the feat/local-cli branch 2 times, most recently from 432bc36 to 555b40d Compare November 2, 2026 13:53
@PiquelChips PiquelChips moved this from In Progress to Ready in sourceorigin.dev Nov 2, 2026
@PiquelChips
PiquelChips force-pushed the feat/local-cli branch 2 times, most recently from 2be0349 to fb2ffe5 Compare November 4, 2026 17:58
@PiquelChips
PiquelChips removed this pull request from stack #18 November 4, 2026 18:00
@PiquelChips
PiquelChips added this pull request to stack #38 November 4, 2026 18:00
@PiquelChips
PiquelChips force-pushed the feat/local-cli branch 6 times, most recently from acf77a0 to 7922f78 Compare November 4, 2026 20:07
Base automatically changed from feat/index to main November 4, 2026 20:15
The local command line on the change model. `origin init` creates the
repository with the node's key (in ~/.config/origin or
$ORIGIN_CONFIG_DIR), a signed `policy` target naming the node authority of
`policy` and `main`, an empty `main`, and a first change.

There is no commit: the working copy is always a revision of the current
change, and every command that reads it snapshots it, with the stat cache
and parallel snapshots, writing the new objects in one durable batch.
`new`, `describe`, `edit`, `status`, `diff`, `show`, `log`, `evolog`,
`abandon` (a core.abandon statement), `converge` and `index rebuild` work
on changes, named by unique id prefixes. Divergence, detected by the
index, shows in `status`, `log` and `show`.

Benchmarks: divan snapshot benchmarks, and `just bench-git` timing origin
against git with hyperfine, `origin new` standing in for a commit.

A closed output pipe, as in `origin log | head`, ends a command quietly
instead of panicking.
@PiquelChips
PiquelChips merged commit 80a1961 into main Nov 4, 2026
12 of 16 checks passed
@PiquelChips
PiquelChips deleted the feat/local-cli branch November 4, 2026 20:50
@github-project-automation github-project-automation Bot moved this from Ready to Done in sourceorigin.dev Nov 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/cli The local command line: changes, workspaces, the op log enhancement New feature or request

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant