Redesign Zed Gist sync workflow

This commit is contained in:
2026-07-30 12:53:31 +08:00
parent f19466a5df
commit 4263d6a25d
14 changed files with 1490 additions and 792 deletions
+15
View File
@@ -22,6 +22,21 @@ if [ ! -f "$target/scripts/settings-sync.json" ]; then
cp "$source_dir/scripts/settings-sync.json" "$target/scripts/settings-sync.json"
fi
node - "$target/scripts/settings-sync.json" <<'NODE_STATE'
const fs = require("node:fs");
const statePath = process.argv[2];
const source = JSON.parse(fs.readFileSync(statePath, "utf8"));
const state = {
gist_id: typeof source.gist_id === "string" ? source.gist_id : "",
last_synced_hash: typeof source.last_synced_hash === "string" ? source.last_synced_hash : "",
auto_sync: source.auto_sync === true,
interval_minutes: Number.isInteger(source.interval_minutes) && source.interval_minutes >= 5 ? source.interval_minutes : 15,
last_run_at: typeof source.last_run_at === "string" ? source.last_run_at : "",
last_result: typeof source.last_result === "string" ? source.last_result : "",
};
fs.writeFileSync(statePath, `${JSON.stringify(state, null, 2)}\n`, "utf8");
NODE_STATE
node - "$source_dir/tasks.json" "$target/tasks.json" "$target/scripts/toggle-file-scan-exclusions.mjs" "$target/scripts/zed-settings-sync.mjs" <<'NODE'
const fs = require("node:fs");
const [source, target, toggleScript, syncScript] = process.argv.slice(2);