Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion packages/opencode/src/cli/cmd/debug/snapshot.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { Snapshot } from "../../../snapshot"
import { Instance } from "../../../project/instance"
import { bootstrap } from "../../bootstrap"
import { cmd } from "../cmd"

export const SnapshotCommand = cmd({
command: "snapshot",
describe: "snapshot debugging utilities",
builder: (yargs) => yargs.command(TrackCommand).command(PatchCommand).command(DiffCommand).demandCommand(),
builder: (yargs) =>
yargs.command(TrackCommand).command(PruneCommand).command(PatchCommand).command(DiffCommand).demandCommand(),
async handler() {},
})

Expand All @@ -19,6 +21,19 @@ const TrackCommand = cmd({
},
})

const PruneCommand = cmd({
command: "prune",
describe: "prune snapshot state",
async handler() {
await Instance.provide({
directory: process.cwd(),
fn: async () => {
console.log(await Snapshot.cleanup())
},
})
},
})

const PatchCommand = cmd({
command: "patch <hash>",
describe: "show patch for a snapshot hash",
Expand Down
Loading