Artifact ed815010cc42627a2aae8720fe0d0f02e0262d3e9516a36d2a037f250968578f:
- File
cli/repo.go
— part of check-in
[7572f7d420]
at
2026-07-19 18:31:37
on branch trunk
— cli: add repo serve command wiring the xfer HTTP server (#72)
* cli: add repo serve command wiring the xfer HTTP server
Repo.ServeHTTP has always been public, but nothing in the CLI called it, so a repo created or cloned with this tool could only ever be a clone leaf. Add `libfossil repo serve` as a thin adapter: open the repo, build the bind address, translate process interrupt into the context cancellation ServeHTTP already honors, and call it. No new server or shutdown logic.
Binds to 127.0.0.1:8080 by default; --addr overrides host and/or port. Verified against a stock fossil client (canonical binary, not just this library's own transport) cloning over an actual TCP round trip.
* cli: address review nits on serve interop test
Document why TestRepoServeCmdRun and TestRepoServeCmdCanonicalFossilClone are allowed to send a real SIGINT to the test process (no t.Parallel(), no competing signal handlers in package cli_test), so a future test in this package doesn't silently break that assumption.
Also log the canonical fossil binary path and version the interop test actually exercised. A skip and a pass read identically in a non-verbose CI log; if the apt install step that puts fossil on PATH is ever removed or reordered, this line is what would tell us the test stopped proving anything instead of just staying green. (user: [email protected], size: 3166) [annotate] [blame] [check-ins using]
package cli // RepoCmd is the top-level command group for repository operations. // Embed this in your CLI struct alongside Globals for a complete fossil CLI. type RepoCmd struct { New RepoNewCmd `cmd:"" help:"Create a new repository"` Clone RepoCloneCmd `cmd:"" help:"Clone a remote repository"` Ci RepoCiCmd `cmd:"" help:"Checkin file changes"` Co RepoCoCmd `cmd:"" help:"Checkout a version"` Ls RepoLsCmd `cmd:"" help:"List files in a version"` Timeline RepoTimelineCmd `cmd:"" help:"Show repository history"` Cat RepoCatCmd `cmd:"" help:"Output artifact content"` Info RepoInfoCmd `cmd:"" help:"Repository statistics"` Hash RepoHashCmd `cmd:"" help:"Hash files (SHA1 or SHA3)"` Delta RepoDeltaCmd `cmd:"" help:"Delta create/apply operations"` Config RepoConfigCmd `cmd:"" help:"Repository configuration"` Query RepoQueryCmd `cmd:"" help:"Execute SQL against repository"` Verify RepoVerifyCmd `cmd:"" help:"Verify repository integrity"` Resolve RepoResolveCmd `cmd:"" help:"Resolve symbolic name to UUID"` Extract RepoExtractCmd `cmd:"" help:"Extract files from a version"` Wiki RepoWikiCmd `cmd:"" help:"Wiki page operations"` Tag RepoTagCmd `cmd:"" help:"Tag operations"` Open RepoOpenCmd `cmd:"" help:"Open a checkout in a directory"` Status RepoStatusCmd `cmd:"" help:"Show working directory changes"` Add RepoAddCmd `cmd:"" help:"Stage files for addition"` Rm RepoRmCmd `cmd:"" help:"Stage files for removal"` Rename RepoRenameCmd `cmd:"" help:"Rename a tracked file"` Revert RepoRevertCmd `cmd:"" help:"Undo staging changes"` Diff RepoDiffCmd `cmd:"" help:"Show changes vs a version"` Merge RepoMergeCmd `cmd:"" help:"Merge a divergent version"` Conflicts RepoConflictsCmd `cmd:"" help:"List/manage unresolved conflicts"` MarkResolved RepoMergeResolveCmd `cmd:"" name:"mark-resolved" help:"Mark a conflict as resolved"` Undo RepoUndoCmd `cmd:"" help:"Undo last operation"` Redo RepoRedoCmd `cmd:"" help:"Redo undone operation"` Stash RepoStashCmd `cmd:"" help:"Stash working changes"` Bisect RepoBisectCmd `cmd:"" help:"Binary search for bugs"` Annotate RepoAnnotateCmd `cmd:"" help:"Annotate file lines with version history"` Blame RepoBlameCmd `cmd:"" help:"Alias for annotate"` Branch RepoBranchCmd `cmd:"" help:"Branch operations"` UV RepoUVCmd `cmd:"" name:"uv" help:"Unversioned file operations"` Schema RepoSchemaCmd `cmd:"" help:"Synced table schema operations"` User RepoUserCmd `cmd:"" help:"User management"` Invite RepoInviteCmd `cmd:"" help:"Generate invite token for a user"` Serve RepoServeCmd `cmd:"" help:"Serve repository over HTTP for sync/clone"` }