mirror of
https://github.com/sst/opencode.git
synced 2025-08-09 15:58:03 +00:00
add snapshot
field in config to disable snapshots
This commit is contained in:
parent
b00b2ded4f
commit
28a4517ec6
2 changed files with 4 additions and 0 deletions
|
@ -233,6 +233,7 @@ export namespace Config {
|
||||||
theme: z.string().optional().describe("Theme name to use for the interface"),
|
theme: z.string().optional().describe("Theme name to use for the interface"),
|
||||||
keybinds: Keybinds.optional().describe("Custom keybind configurations"),
|
keybinds: Keybinds.optional().describe("Custom keybind configurations"),
|
||||||
plugin: z.string().array().optional(),
|
plugin: z.string().array().optional(),
|
||||||
|
snapshot: z.boolean().optional(),
|
||||||
share: z
|
share: z
|
||||||
.enum(["manual", "auto", "disabled"])
|
.enum(["manual", "auto", "disabled"])
|
||||||
.optional()
|
.optional()
|
||||||
|
|
|
@ -5,6 +5,7 @@ import fs from "fs/promises"
|
||||||
import { Log } from "../util/log"
|
import { Log } from "../util/log"
|
||||||
import { Global } from "../global"
|
import { Global } from "../global"
|
||||||
import { z } from "zod"
|
import { z } from "zod"
|
||||||
|
import { Config } from "../config/config"
|
||||||
|
|
||||||
export namespace Snapshot {
|
export namespace Snapshot {
|
||||||
const log = Log.create({ service: "snapshot" })
|
const log = Log.create({ service: "snapshot" })
|
||||||
|
@ -26,6 +27,8 @@ export namespace Snapshot {
|
||||||
export async function track() {
|
export async function track() {
|
||||||
const app = App.info()
|
const app = App.info()
|
||||||
if (!app.git) return
|
if (!app.git) return
|
||||||
|
const cfg = await Config.get()
|
||||||
|
if (cfg.snapshot === false) return
|
||||||
const git = gitdir()
|
const git = gitdir()
|
||||||
if (await fs.mkdir(git, { recursive: true })) {
|
if (await fs.mkdir(git, { recursive: true })) {
|
||||||
await $`git init`
|
await $`git init`
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue