opencode-github-sync 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +353 -0
- package/README.zh-CN.md +332 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +334 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/render.d.ts +45 -0
- package/dist/cli/render.d.ts.map +1 -0
- package/dist/cli/render.js +167 -0
- package/dist/cli/render.js.map +1 -0
- package/dist/cli/theme.d.ts +45 -0
- package/dist/cli/theme.d.ts.map +1 -0
- package/dist/cli/theme.js +88 -0
- package/dist/cli/theme.js.map +1 -0
- package/dist/core/fsx.d.ts +81 -0
- package/dist/core/fsx.d.ts.map +1 -0
- package/dist/core/fsx.js +353 -0
- package/dist/core/fsx.js.map +1 -0
- package/dist/core/git.d.ts +48 -0
- package/dist/core/git.d.ts.map +1 -0
- package/dist/core/git.js +133 -0
- package/dist/core/git.js.map +1 -0
- package/dist/core/host.d.ts +20 -0
- package/dist/core/host.d.ts.map +1 -0
- package/dist/core/host.js +50 -0
- package/dist/core/host.js.map +1 -0
- package/dist/core/index.d.ts +16 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +16 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/jsonc.d.ts +20 -0
- package/dist/core/jsonc.d.ts.map +1 -0
- package/dist/core/jsonc.js +115 -0
- package/dist/core/jsonc.js.map +1 -0
- package/dist/core/lock.d.ts +14 -0
- package/dist/core/lock.d.ts.map +1 -0
- package/dist/core/lock.js +111 -0
- package/dist/core/lock.js.map +1 -0
- package/dist/core/overrides.d.ts +30 -0
- package/dist/core/overrides.d.ts.map +1 -0
- package/dist/core/overrides.js +126 -0
- package/dist/core/overrides.js.map +1 -0
- package/dist/core/paths.d.ts +36 -0
- package/dist/core/paths.d.ts.map +1 -0
- package/dist/core/paths.js +55 -0
- package/dist/core/paths.js.map +1 -0
- package/dist/core/repo.d.ts +57 -0
- package/dist/core/repo.d.ts.map +1 -0
- package/dist/core/repo.js +184 -0
- package/dist/core/repo.js.map +1 -0
- package/dist/core/reporter.d.ts +50 -0
- package/dist/core/reporter.d.ts.map +1 -0
- package/dist/core/reporter.js +63 -0
- package/dist/core/reporter.js.map +1 -0
- package/dist/core/sessions.d.ts +61 -0
- package/dist/core/sessions.d.ts.map +1 -0
- package/dist/core/sessions.js +321 -0
- package/dist/core/sessions.js.map +1 -0
- package/dist/core/settings.d.ts +59 -0
- package/dist/core/settings.d.ts.map +1 -0
- package/dist/core/settings.js +120 -0
- package/dist/core/settings.js.map +1 -0
- package/dist/core/setup.d.ts +48 -0
- package/dist/core/setup.d.ts.map +1 -0
- package/dist/core/setup.js +186 -0
- package/dist/core/setup.js.map +1 -0
- package/dist/core/sqlite.d.ts +37 -0
- package/dist/core/sqlite.d.ts.map +1 -0
- package/dist/core/sqlite.js +106 -0
- package/dist/core/sqlite.js.map +1 -0
- package/dist/core/stage.d.ts +44 -0
- package/dist/core/stage.d.ts.map +1 -0
- package/dist/core/stage.js +297 -0
- package/dist/core/stage.js.map +1 -0
- package/dist/core/sync.d.ts +50 -0
- package/dist/core/sync.d.ts.map +1 -0
- package/dist/core/sync.js +360 -0
- package/dist/core/sync.js.map +1 -0
- package/dist/plugin/index.d.ts +31 -0
- package/dist/plugin/index.d.ts.map +1 -0
- package/dist/plugin/index.js +132 -0
- package/dist/plugin/index.js.map +1 -0
- package/package.json +67 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export * from "./fsx.js";
|
|
2
|
+
export * from "./git.js";
|
|
3
|
+
export * from "./host.js";
|
|
4
|
+
export * from "./jsonc.js";
|
|
5
|
+
export * from "./lock.js";
|
|
6
|
+
export * from "./overrides.js";
|
|
7
|
+
export * from "./paths.js";
|
|
8
|
+
export * from "./repo.js";
|
|
9
|
+
export * from "./reporter.js";
|
|
10
|
+
export * from "./sessions.js";
|
|
11
|
+
export * from "./settings.js";
|
|
12
|
+
export * from "./sqlite.js";
|
|
13
|
+
export * from "./stage.js";
|
|
14
|
+
export * from "./sync.js";
|
|
15
|
+
export * from "./setup.js";
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dependency-free JSONC support.
|
|
3
|
+
*
|
|
4
|
+
* OpenCode config files are JSON with comments and trailing commas. We cannot
|
|
5
|
+
* pull in a parser dependency because this module is loaded inside the OpenCode
|
|
6
|
+
* runtime, so the stripping is done by hand. String literals are copied
|
|
7
|
+
* verbatim so `//` or `/*` inside a value is never mistaken for a comment.
|
|
8
|
+
*/
|
|
9
|
+
export declare function parseJsonc<T = any>(text: string): T;
|
|
10
|
+
export declare function tryParseJsonc<T = any>(text: string): T | undefined;
|
|
11
|
+
/**
|
|
12
|
+
* Recursively merge `patch` into `base`, returning a new object.
|
|
13
|
+
*
|
|
14
|
+
* - Plain objects merge key by key.
|
|
15
|
+
* - Arrays and scalars are replaced wholesale (an override should be able to
|
|
16
|
+
* shorten a list, which a concat-merge could never express).
|
|
17
|
+
* - An explicit `null` in the patch deletes the key.
|
|
18
|
+
*/
|
|
19
|
+
export declare function deepMerge<T extends Record<string, any>>(base: T, patch: Record<string, any>): T;
|
|
20
|
+
//# sourceMappingURL=jsonc.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsonc.d.ts","sourceRoot":"","sources":["../../src/core/jsonc.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,wBAAgB,UAAU,CAAC,CAAC,GAAG,GAAG,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC,CAyEnD;AAED,wBAAgB,aAAa,CAAC,CAAC,GAAG,GAAG,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS,CAMlE;AAMD;;;;;;;GAOG;AACH,wBAAgB,SAAS,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,CAAC,CAe/F"}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dependency-free JSONC support.
|
|
3
|
+
*
|
|
4
|
+
* OpenCode config files are JSON with comments and trailing commas. We cannot
|
|
5
|
+
* pull in a parser dependency because this module is loaded inside the OpenCode
|
|
6
|
+
* runtime, so the stripping is done by hand. String literals are copied
|
|
7
|
+
* verbatim so `//` or `/*` inside a value is never mistaken for a comment.
|
|
8
|
+
*/
|
|
9
|
+
export function parseJsonc(text) {
|
|
10
|
+
let s = String(text);
|
|
11
|
+
if (s.charCodeAt(0) === 0xfeff)
|
|
12
|
+
s = s.slice(1);
|
|
13
|
+
let out = "";
|
|
14
|
+
let i = 0;
|
|
15
|
+
const n = s.length;
|
|
16
|
+
// Index in `out` of a comma that may turn out to be a trailing comma.
|
|
17
|
+
let lastComma = -1;
|
|
18
|
+
while (i < n) {
|
|
19
|
+
const ch = s[i];
|
|
20
|
+
const next = i + 1 < n ? s[i + 1] : "";
|
|
21
|
+
// String literal — copy verbatim, honouring escapes.
|
|
22
|
+
if (ch === '"') {
|
|
23
|
+
out += ch;
|
|
24
|
+
i++;
|
|
25
|
+
while (i < n) {
|
|
26
|
+
const cc = s[i];
|
|
27
|
+
out += cc;
|
|
28
|
+
if (cc === "\\" && i + 1 < n) {
|
|
29
|
+
out += s[i + 1];
|
|
30
|
+
i += 2;
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
33
|
+
i++;
|
|
34
|
+
if (cc === '"')
|
|
35
|
+
break;
|
|
36
|
+
}
|
|
37
|
+
lastComma = -1;
|
|
38
|
+
continue;
|
|
39
|
+
}
|
|
40
|
+
// Line comment.
|
|
41
|
+
if (ch === "/" && next === "/") {
|
|
42
|
+
i += 2;
|
|
43
|
+
while (i < n && s[i] !== "\n")
|
|
44
|
+
i++;
|
|
45
|
+
continue;
|
|
46
|
+
}
|
|
47
|
+
// Block comment.
|
|
48
|
+
if (ch === "/" && next === "*") {
|
|
49
|
+
i += 2;
|
|
50
|
+
while (i < n && !(s[i] === "*" && s[i + 1] === "/"))
|
|
51
|
+
i++;
|
|
52
|
+
i += 2;
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
// Whitespace keeps a pending comma alive.
|
|
56
|
+
if (ch === " " || ch === "\t" || ch === "\r" || ch === "\n") {
|
|
57
|
+
out += ch;
|
|
58
|
+
i++;
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
// A closing bracket retroactively deletes a pending trailing comma.
|
|
62
|
+
if (ch === "}" || ch === "]") {
|
|
63
|
+
if (lastComma !== -1) {
|
|
64
|
+
out = out.slice(0, lastComma) + out.slice(lastComma + 1);
|
|
65
|
+
lastComma = -1;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
out += ch;
|
|
69
|
+
lastComma = ch === "," ? out.length - 1 : -1;
|
|
70
|
+
i++;
|
|
71
|
+
}
|
|
72
|
+
try {
|
|
73
|
+
return JSON.parse(out);
|
|
74
|
+
}
|
|
75
|
+
catch (e) {
|
|
76
|
+
throw new Error(`JSONC parse error: ${e.message}`);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
export function tryParseJsonc(text) {
|
|
80
|
+
try {
|
|
81
|
+
return parseJsonc(text);
|
|
82
|
+
}
|
|
83
|
+
catch {
|
|
84
|
+
return undefined;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
function isPlainObject(value) {
|
|
88
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Recursively merge `patch` into `base`, returning a new object.
|
|
92
|
+
*
|
|
93
|
+
* - Plain objects merge key by key.
|
|
94
|
+
* - Arrays and scalars are replaced wholesale (an override should be able to
|
|
95
|
+
* shorten a list, which a concat-merge could never express).
|
|
96
|
+
* - An explicit `null` in the patch deletes the key.
|
|
97
|
+
*/
|
|
98
|
+
export function deepMerge(base, patch) {
|
|
99
|
+
const result = { ...base };
|
|
100
|
+
for (const [key, value] of Object.entries(patch)) {
|
|
101
|
+
if (value === null) {
|
|
102
|
+
delete result[key];
|
|
103
|
+
continue;
|
|
104
|
+
}
|
|
105
|
+
const current = result[key];
|
|
106
|
+
if (isPlainObject(current) && isPlainObject(value)) {
|
|
107
|
+
result[key] = deepMerge(current, value);
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
result[key] = value;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
return result;
|
|
114
|
+
}
|
|
115
|
+
//# sourceMappingURL=jsonc.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsonc.js","sourceRoot":"","sources":["../../src/core/jsonc.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,UAAU,UAAU,CAAU,IAAY;IAC9C,IAAI,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;IACrB,IAAI,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,MAAM;QAAE,CAAC,GAAG,CAAC,CAAC,KA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E,CAAC;AACH,CAAC;AAED,MAAM,UAAU,aAAa,CAAU,IAAY;IACjD,IAAI,CAAC;QACH,OAAO,UAAU,CAAI,IAAI,CAAC,CAAC;IAC7B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC;AAED,SAAS,aAAa,CAAC,KAAc;IACnC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,SAAS,CAAgC,IAAO,EAAE,KAA0B;IAC1F,MAAM,MAAM,GAAwB,EAAE,GAAG,IAAI,EAAE,CAAC;IAChD,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACjD,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;YACnB,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC;YACnB,SAAS;QACX,CAAC;QACD,MAAM,OAAO,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;QAC5B,IAAI,aAAa,CAAC,OAAO,CAAC,IAAI,aAAa,CAAC,KAAK,CAAC,EAAE,CAAC;YACnD,MAAM,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QAC1C,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;QACtB,CAAC;IACH,CAAC;IACD,OAAO,MAAW,CAAC;AACrB,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface SyncLock {
|
|
2
|
+
dir: string;
|
|
3
|
+
id: string;
|
|
4
|
+
}
|
|
5
|
+
export interface AcquireOptions {
|
|
6
|
+
/** How long to wait for an existing holder. Default: fail immediately. */
|
|
7
|
+
waitMs?: number;
|
|
8
|
+
pollMs?: number;
|
|
9
|
+
}
|
|
10
|
+
export declare function acquireSyncLock(configRoot: string, options?: AcquireOptions): SyncLock | null;
|
|
11
|
+
export declare function releaseSyncLock(lock: SyncLock | null): void;
|
|
12
|
+
/** Run `fn` while holding the lock, always releasing it. */
|
|
13
|
+
export declare function withSyncLock<T>(configRoot: string, options: AcquireOptions, fn: () => Promise<T> | T): Promise<T>;
|
|
14
|
+
//# sourceMappingURL=lock.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lock.d.ts","sourceRoot":"","sources":["../../src/core/lock.ts"],"names":[],"mappings":"AAmBA,MAAM,WAAW,QAAQ;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,MAAM,WAAW,cAAc;IAC7B,0EAA0E;IAC1E,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAeD,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,GAAE,cAAmB,GAAG,QAAQ,GAAG,IAAI,CA2BjG;AAiCD,wBAAgB,eAAe,CAAC,IAAI,EAAE,QAAQ,GAAG,IAAI,GAAG,IAAI,CAS3D;AAED,4DAA4D;AAC5D,wBAAsB,YAAY,CAAC,CAAC,EAClC,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,cAAc,EACvB,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,GACvB,OAAO,CAAC,CAAC,CAAC,CAUZ"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { randomUUID } from "node:crypto";
|
|
2
|
+
import fs from "node:fs";
|
|
3
|
+
import os from "node:os";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
/**
|
|
6
|
+
* Cross-process advisory lock.
|
|
7
|
+
*
|
|
8
|
+
* `mkdir` is atomic on every platform we target, which makes it a better
|
|
9
|
+
* primitive than an exclusive file open (Windows leaves the file behind after a
|
|
10
|
+
* hard kill and the next process can never acquire it).
|
|
11
|
+
*
|
|
12
|
+
* A stale lock is reclaimed in two situations:
|
|
13
|
+
* - the recorded pid no longer exists, or
|
|
14
|
+
* - the lock is unreadable/corrupt and older than the grace period.
|
|
15
|
+
*/
|
|
16
|
+
const MALFORMED_GRACE_MS = 30_000;
|
|
17
|
+
function lockDir(configRoot) {
|
|
18
|
+
return path.join(configRoot, ".opencode-sync.lock");
|
|
19
|
+
}
|
|
20
|
+
function readOwner(dir) {
|
|
21
|
+
return JSON.parse(fs.readFileSync(path.join(dir, "owner.json"), "utf8"));
|
|
22
|
+
}
|
|
23
|
+
function sleepSync(ms) {
|
|
24
|
+
if (ms <= 0)
|
|
25
|
+
return;
|
|
26
|
+
Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, ms);
|
|
27
|
+
}
|
|
28
|
+
export function acquireSyncLock(configRoot, options = {}) {
|
|
29
|
+
const { waitMs = 0, pollMs = 250 } = options;
|
|
30
|
+
const dir = lockDir(configRoot);
|
|
31
|
+
const deadline = Date.now() + waitMs;
|
|
32
|
+
for (;;) {
|
|
33
|
+
try {
|
|
34
|
+
const id = randomUUID();
|
|
35
|
+
fs.mkdirSync(dir, { recursive: false });
|
|
36
|
+
fs.writeFileSync(path.join(dir, "owner.json"), JSON.stringify({
|
|
37
|
+
id,
|
|
38
|
+
pid: process.pid,
|
|
39
|
+
hostname: os.hostname(),
|
|
40
|
+
startedAt: new Date().toISOString(),
|
|
41
|
+
}));
|
|
42
|
+
return { dir, id };
|
|
43
|
+
}
|
|
44
|
+
catch (err) {
|
|
45
|
+
if (err?.code !== "EEXIST")
|
|
46
|
+
throw err;
|
|
47
|
+
if (reclaimIfStale(dir))
|
|
48
|
+
continue;
|
|
49
|
+
if (Date.now() >= deadline)
|
|
50
|
+
return null;
|
|
51
|
+
sleepSync(Math.min(pollMs, Math.max(0, deadline - Date.now())));
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
function reclaimIfStale(dir) {
|
|
56
|
+
try {
|
|
57
|
+
const owner = readOwner(dir);
|
|
58
|
+
if (!Number.isInteger(owner.pid) || owner.pid <= 0) {
|
|
59
|
+
throw new SyntaxError("invalid lock owner");
|
|
60
|
+
}
|
|
61
|
+
// Signal 0 performs the permission/existence check without delivering.
|
|
62
|
+
process.kill(owner.pid, 0);
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
catch (err) {
|
|
66
|
+
if (err?.code === "ESRCH") {
|
|
67
|
+
fs.rmSync(dir, { recursive: true, force: true });
|
|
68
|
+
return true;
|
|
69
|
+
}
|
|
70
|
+
const malformed = err instanceof SyntaxError || err?.code === "ENOENT" || err?.code === "ENOTDIR";
|
|
71
|
+
if (malformed) {
|
|
72
|
+
try {
|
|
73
|
+
if (Date.now() - fs.statSync(dir).mtimeMs > MALFORMED_GRACE_MS) {
|
|
74
|
+
fs.rmSync(dir, { recursive: true, force: true });
|
|
75
|
+
return true;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
catch {
|
|
79
|
+
// Lock vanished underneath us — retry the acquire.
|
|
80
|
+
return true;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
export function releaseSyncLock(lock) {
|
|
87
|
+
if (!lock)
|
|
88
|
+
return;
|
|
89
|
+
try {
|
|
90
|
+
if (readOwner(lock.dir).id === lock.id) {
|
|
91
|
+
fs.rmSync(lock.dir, { recursive: true, force: true });
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
catch {
|
|
95
|
+
// Already released or reclaimed by someone else.
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
/** Run `fn` while holding the lock, always releasing it. */
|
|
99
|
+
export async function withSyncLock(configRoot, options, fn) {
|
|
100
|
+
const lock = acquireSyncLock(configRoot, options);
|
|
101
|
+
if (!lock) {
|
|
102
|
+
throw new Error("Another opencode-sync operation is already running. Wait for it to finish.");
|
|
103
|
+
}
|
|
104
|
+
try {
|
|
105
|
+
return await fn();
|
|
106
|
+
}
|
|
107
|
+
finally {
|
|
108
|
+
releaseSyncLock(lock);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
//# sourceMappingURL=lock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lock.js","sourceRoot":"","sources":["../../src/core/lock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B;;;;;;;;;;GAUG;AAEH,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAalC,SAAS,OAAO,CAAC,UAAkB;IACjC,OAAO,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,qBAAqB,CAAC,CAAC;AACtD,CAAC;AAED,SAAS,SAAS,CAAC,GAAW;IAC5B,OAAO,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,YAAY,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;AAC3E,CAAC;AAED,SAAS,SAAS,CAAC,EAAU;IAC3B,IAAI,EAAE,IAAI,CAAC;QAAE,OAAO;IACpB,OAAO,CAAC,IAAI,CAAC,IAAI,UAAU,CAAC,IAAI,iBAAiB,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;AACnE,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,UAAkB,EAAE,UAA0B,EAAE;IAC9E,MAAM,EAAE,MAAM,GAAG,CAAC,EAAE,MAAM,GAAG,GAAG,EAAE,GAAG,OAAO,CAAC;IAC7C,MAAM,GAAG,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IAChC,MAAM,QAAQ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ACxD,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;QACP,iDAAiD;IACnD,CAAC;AACH,CAAC;AAED,4DAA4D;AAC5D,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,UAAkB,EAClB,OAAuB,EACvB,EAAwB;IAExB,MAAM,IAAI,GAAG,eAAe,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IAClD,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,MAAM,IAAI,KAAK,CAAC,4EAA4E,CAAC,CAAC;IAChG,CAAC;IACD,IAAI,CAAC;QACH,OAAO,MAAM,EAAE,EAAE,CAAC;IACpB,CAAC;YAAS,CAAC;QACT,eAAe,CAAC,IAAI,CAAC,CAAC;IACxB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/** Locate the OpenCode config file inside a directory, if there is one. */
|
|
2
|
+
export declare function findConfigFile(dir: string): string | undefined;
|
|
3
|
+
export declare function hasOverrides(configRoot: string): boolean;
|
|
4
|
+
export declare function loadOverrides(configRoot: string): Record<string, any>;
|
|
5
|
+
/**
|
|
6
|
+
* Merge the local overrides into the config file after a pull.
|
|
7
|
+
*
|
|
8
|
+
* Returns true when the file was rewritten.
|
|
9
|
+
*/
|
|
10
|
+
export declare function applyOverrides(configRoot: string): boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Remove override-owned keys from an effective config so it can be pushed.
|
|
13
|
+
*
|
|
14
|
+
* `previous` is the version currently stored in the repository; the values it
|
|
15
|
+
* holds for overridden keys are what gets restored. Keys the repository has
|
|
16
|
+
* never seen are dropped.
|
|
17
|
+
*/
|
|
18
|
+
export declare function stripOverrides(effective: Record<string, any>, overrides: Record<string, any>, previous: Record<string, any> | undefined): Record<string, any>;
|
|
19
|
+
/**
|
|
20
|
+
* Produce the text that should be committed for the config file.
|
|
21
|
+
*
|
|
22
|
+
* `previousText` is the version currently recorded in the repository. It has to
|
|
23
|
+
* be read out of git rather than off disk, because the worktree *is* the config
|
|
24
|
+
* directory — the file on disk is the effective config, overrides and all, so
|
|
25
|
+
* using it as the baseline would quietly publish this machine's overrides.
|
|
26
|
+
*
|
|
27
|
+
* Returns `undefined` when the file can be committed as-is.
|
|
28
|
+
*/
|
|
29
|
+
export declare function configTextForRepo(configRoot: string, previousText: string | undefined): string | undefined;
|
|
30
|
+
//# sourceMappingURL=overrides.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"overrides.d.ts","sourceRoot":"","sources":["../../src/core/overrides.ts"],"names":[],"mappings":"AA+BA,2EAA2E;AAC3E,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAM9D;AAED,wBAAgB,YAAY,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAKxD;AAED,wBAAgB,aAAa,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CASrE;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAa1D;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAC5B,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC9B,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC9B,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,SAAS,GACxC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAqBrB;AAMD;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,MAAM,GAAG,SAAS,GAC/B,MAAM,GAAG,SAAS,CAWpB"}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { deepMerge, parseJsonc } from "./jsonc.js";
|
|
4
|
+
import { OVERRIDES_FILE, overridesPath } from "./settings.js";
|
|
5
|
+
/**
|
|
6
|
+
* Per-machine configuration overrides.
|
|
7
|
+
*
|
|
8
|
+
* A synced repository makes every machine identical, which is wrong for the
|
|
9
|
+
* settings that are genuinely machine-specific: a corporate proxy, a local
|
|
10
|
+
* toolchain path, an MCP server that only exists on one box. Overrides restore
|
|
11
|
+
* that freedom by splitting the config into two layers.
|
|
12
|
+
*
|
|
13
|
+
* repo `opencode.jsonc` shared baseline, committed
|
|
14
|
+
* local `opencode-sync.overrides.jsonc` this machine only, never committed
|
|
15
|
+
* ─────────────────────────────── deep merge
|
|
16
|
+
* effective `opencode.jsonc` what OpenCode actually reads
|
|
17
|
+
*
|
|
18
|
+
* The interesting half is push. Because the effective file is what lives on
|
|
19
|
+
* disk, a naive push would upload this machine's overrides to everyone. So on
|
|
20
|
+
* push any key that the overrides file claims is restored to the value the
|
|
21
|
+
* repository already had (or removed entirely if the repository never had it).
|
|
22
|
+
* Overridden keys therefore become invisible to sync in both directions.
|
|
23
|
+
*
|
|
24
|
+
* When no overrides file exists the config is copied byte for byte, which keeps
|
|
25
|
+
* comments and formatting untouched. The structural rewrite only happens for
|
|
26
|
+
* users who actually opted into overrides.
|
|
27
|
+
*/
|
|
28
|
+
const CONFIG_FILENAMES = ["opencode.jsonc", "opencode.json"];
|
|
29
|
+
/** Locate the OpenCode config file inside a directory, if there is one. */
|
|
30
|
+
export function findConfigFile(dir) {
|
|
31
|
+
for (const name of CONFIG_FILENAMES) {
|
|
32
|
+
const candidate = path.join(dir, name);
|
|
33
|
+
if (fs.existsSync(candidate))
|
|
34
|
+
return candidate;
|
|
35
|
+
}
|
|
36
|
+
return undefined;
|
|
37
|
+
}
|
|
38
|
+
export function hasOverrides(configRoot) {
|
|
39
|
+
const file = overridesPath(configRoot);
|
|
40
|
+
if (!fs.existsSync(file))
|
|
41
|
+
return false;
|
|
42
|
+
const parsed = loadOverrides(configRoot);
|
|
43
|
+
return Object.keys(parsed).length > 0;
|
|
44
|
+
}
|
|
45
|
+
export function loadOverrides(configRoot) {
|
|
46
|
+
const file = overridesPath(configRoot);
|
|
47
|
+
if (!fs.existsSync(file))
|
|
48
|
+
return {};
|
|
49
|
+
try {
|
|
50
|
+
const parsed = parseJsonc(fs.readFileSync(file, "utf8"));
|
|
51
|
+
return parsed && typeof parsed === "object" ? parsed : {};
|
|
52
|
+
}
|
|
53
|
+
catch (e) {
|
|
54
|
+
throw new Error(`Cannot read ${OVERRIDES_FILE}: ${e.message}`);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Merge the local overrides into the config file after a pull.
|
|
59
|
+
*
|
|
60
|
+
* Returns true when the file was rewritten.
|
|
61
|
+
*/
|
|
62
|
+
export function applyOverrides(configRoot) {
|
|
63
|
+
const overrides = loadOverrides(configRoot);
|
|
64
|
+
if (Object.keys(overrides).length === 0)
|
|
65
|
+
return false;
|
|
66
|
+
const configFile = findConfigFile(configRoot);
|
|
67
|
+
if (!configFile)
|
|
68
|
+
return false;
|
|
69
|
+
const base = parseJsonc(fs.readFileSync(configFile, "utf8"));
|
|
70
|
+
const merged = deepMerge(base, overrides);
|
|
71
|
+
const next = `${JSON.stringify(merged, null, 2)}\n`;
|
|
72
|
+
if (fs.readFileSync(configFile, "utf8") === next)
|
|
73
|
+
return false;
|
|
74
|
+
fs.writeFileSync(configFile, next);
|
|
75
|
+
return true;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Remove override-owned keys from an effective config so it can be pushed.
|
|
79
|
+
*
|
|
80
|
+
* `previous` is the version currently stored in the repository; the values it
|
|
81
|
+
* holds for overridden keys are what gets restored. Keys the repository has
|
|
82
|
+
* never seen are dropped.
|
|
83
|
+
*/
|
|
84
|
+
export function stripOverrides(effective, overrides, previous) {
|
|
85
|
+
const result = { ...effective };
|
|
86
|
+
for (const [key, overrideValue] of Object.entries(overrides)) {
|
|
87
|
+
const previousValue = previous?.[key];
|
|
88
|
+
const isNestedMerge = isPlainObject(overrideValue) && isPlainObject(result[key]) && isPlainObject(previousValue);
|
|
89
|
+
if (isNestedMerge) {
|
|
90
|
+
result[key] = stripOverrides(result[key], overrideValue, previousValue);
|
|
91
|
+
continue;
|
|
92
|
+
}
|
|
93
|
+
if (previous && Object.hasOwn(previous, key)) {
|
|
94
|
+
result[key] = previousValue;
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
delete result[key];
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return result;
|
|
101
|
+
}
|
|
102
|
+
function isPlainObject(value) {
|
|
103
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Produce the text that should be committed for the config file.
|
|
107
|
+
*
|
|
108
|
+
* `previousText` is the version currently recorded in the repository. It has to
|
|
109
|
+
* be read out of git rather than off disk, because the worktree *is* the config
|
|
110
|
+
* directory — the file on disk is the effective config, overrides and all, so
|
|
111
|
+
* using it as the baseline would quietly publish this machine's overrides.
|
|
112
|
+
*
|
|
113
|
+
* Returns `undefined` when the file can be committed as-is.
|
|
114
|
+
*/
|
|
115
|
+
export function configTextForRepo(configRoot, previousText) {
|
|
116
|
+
const overrides = loadOverrides(configRoot);
|
|
117
|
+
if (Object.keys(overrides).length === 0)
|
|
118
|
+
return undefined;
|
|
119
|
+
const configFile = findConfigFile(configRoot);
|
|
120
|
+
if (!configFile)
|
|
121
|
+
return undefined;
|
|
122
|
+
const effective = parseJsonc(fs.readFileSync(configFile, "utf8"));
|
|
123
|
+
const previous = previousText ? parseJsonc(previousText) : undefined;
|
|
124
|
+
return `${JSON.stringify(stripOverrides(effective, overrides, previous), null, 2)}\n`;
|
|
125
|
+
}
|
|
126
|
+
//# sourceMappingURL=overrides.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"overrides.js","sourceRoot":"","sources":["../../src/core/overrides.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAA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S,CAAC;IAE1F,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,SAAS,EAAE,SAAS,EAAE,QAAQ,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC;AACxF,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolve every directory opencode-github-sync knows about.
|
|
3
|
+
*
|
|
4
|
+
* Each root can be overridden with an environment variable, which is what the
|
|
5
|
+
* test-suite uses to run against a scratch directory instead of the real
|
|
6
|
+
* machine.
|
|
7
|
+
*/
|
|
8
|
+
export interface Roots {
|
|
9
|
+
/** `~/.config/opencode` — also the git worktree for the sync repo. */
|
|
10
|
+
config: string;
|
|
11
|
+
/** `~/.local/share/opencode` — auth, account, sqlite database. */
|
|
12
|
+
data: string;
|
|
13
|
+
/** `~/.local/state/opencode` — frecency, kv store, model cache. */
|
|
14
|
+
state: string;
|
|
15
|
+
/** `~/.agents/skills` — skills installed by the `skills` CLI. */
|
|
16
|
+
agents: string;
|
|
17
|
+
/** `~/.cache/opencode` — plugin package cache. */
|
|
18
|
+
cache: string;
|
|
19
|
+
}
|
|
20
|
+
export declare function getConfigRoot(): string;
|
|
21
|
+
export declare function getDataRoot(): string;
|
|
22
|
+
export declare function getStateRoot(): string;
|
|
23
|
+
export declare function getAgentsRoot(): string;
|
|
24
|
+
export declare function getCacheRoot(): string;
|
|
25
|
+
export declare function getRoots(): Roots;
|
|
26
|
+
/** Path of the OpenCode SQLite database that holds all sessions. */
|
|
27
|
+
export declare function getDatabasePath(roots?: Roots): string;
|
|
28
|
+
/** Directory inside the sync repo where session shards are written. */
|
|
29
|
+
export declare const SESSIONS_DIR = "_sessions";
|
|
30
|
+
/** Directory inside the sync repo mirroring the OpenCode data root. */
|
|
31
|
+
export declare const DATA_DIR = "_data";
|
|
32
|
+
/** Directory inside the sync repo mirroring the OpenCode state root. */
|
|
33
|
+
export declare const STATE_DIR = "_state";
|
|
34
|
+
/** Directory inside the sync repo mirroring `~/.agents/skills`. */
|
|
35
|
+
export declare const AGENTS_DIR = "_agents";
|
|
36
|
+
//# sourceMappingURL=paths.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../../src/core/paths.ts"],"names":[],"mappings":"AAGA;;;;;;GAMG;AACH,MAAM,WAAW,KAAK;IACpB,sEAAsE;IACtE,MAAM,EAAE,MAAM,CAAC;IACf,kEAAkE;IAClE,IAAI,EAAE,MAAM,CAAC;IACb,mEAAmE;IACnE,KAAK,EAAE,MAAM,CAAC;IACd,iEAAiE;IACjE,MAAM,EAAE,MAAM,CAAC;IACf,kDAAkD;IAClD,KAAK,EAAE,MAAM,CAAC;CACf;AAQD,wBAAgB,aAAa,IAAI,MAAM,CAGtC;AAED,wBAAgB,WAAW,IAAI,MAAM,CAGpC;AAED,wBAAgB,YAAY,IAAI,MAAM,CAGrC;AAED,wBAAgB,aAAa,IAAI,MAAM,CAGtC;AAED,wBAAgB,YAAY,IAAI,MAAM,CAGrC;AAED,wBAAgB,QAAQ,IAAI,KAAK,CAQhC;AAED,oEAAoE;AACpE,wBAAgB,eAAe,CAAC,KAAK,GAAE,KAAkB,GAAG,MAAM,CAEjE;AAED,uEAAuE;AACvE,eAAO,MAAM,YAAY,cAAc,CAAC;AACxC,uEAAuE;AACvE,eAAO,MAAM,QAAQ,UAAU,CAAC;AAChC,wEAAwE;AACxE,eAAO,MAAM,SAAS,WAAW,CAAC;AAClC,mEAAmE;AACnE,eAAO,MAAM,UAAU,YAAY,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import os from "node:os";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
function xdg(envVar, ...fallback) {
|
|
4
|
+
const fromEnv = process.env[envVar];
|
|
5
|
+
if (fromEnv)
|
|
6
|
+
return fromEnv;
|
|
7
|
+
return path.join(os.homedir(), ...fallback);
|
|
8
|
+
}
|
|
9
|
+
export function getConfigRoot() {
|
|
10
|
+
if (process.env.SYNC_CONFIG_ROOT)
|
|
11
|
+
return process.env.SYNC_CONFIG_ROOT;
|
|
12
|
+
return path.join(xdg("XDG_CONFIG_HOME", ".config"), "opencode");
|
|
13
|
+
}
|
|
14
|
+
export function getDataRoot() {
|
|
15
|
+
if (process.env.SYNC_DATA_ROOT)
|
|
16
|
+
return process.env.SYNC_DATA_ROOT;
|
|
17
|
+
return path.join(xdg("XDG_DATA_HOME", ".local", "share"), "opencode");
|
|
18
|
+
}
|
|
19
|
+
export function getStateRoot() {
|
|
20
|
+
if (process.env.SYNC_STATE_ROOT)
|
|
21
|
+
return process.env.SYNC_STATE_ROOT;
|
|
22
|
+
return path.join(xdg("XDG_STATE_HOME", ".local", "state"), "opencode");
|
|
23
|
+
}
|
|
24
|
+
export function getAgentsRoot() {
|
|
25
|
+
if (process.env.SYNC_AGENTS_ROOT)
|
|
26
|
+
return process.env.SYNC_AGENTS_ROOT;
|
|
27
|
+
return path.join(os.homedir(), ".agents", "skills");
|
|
28
|
+
}
|
|
29
|
+
export function getCacheRoot() {
|
|
30
|
+
if (process.env.SYNC_CACHE_ROOT)
|
|
31
|
+
return process.env.SYNC_CACHE_ROOT;
|
|
32
|
+
return path.join(xdg("XDG_CACHE_HOME", ".cache"), "opencode");
|
|
33
|
+
}
|
|
34
|
+
export function getRoots() {
|
|
35
|
+
return {
|
|
36
|
+
config: getConfigRoot(),
|
|
37
|
+
data: getDataRoot(),
|
|
38
|
+
state: getStateRoot(),
|
|
39
|
+
agents: getAgentsRoot(),
|
|
40
|
+
cache: getCacheRoot(),
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
/** Path of the OpenCode SQLite database that holds all sessions. */
|
|
44
|
+
export function getDatabasePath(roots = getRoots()) {
|
|
45
|
+
return path.join(roots.data, "opencode.db");
|
|
46
|
+
}
|
|
47
|
+
/** Directory inside the sync repo where session shards are written. */
|
|
48
|
+
export const SESSIONS_DIR = "_sessions";
|
|
49
|
+
/** Directory inside the sync repo mirroring the OpenCode data root. */
|
|
50
|
+
export const DATA_DIR = "_data";
|
|
51
|
+
/** Directory inside the sync repo mirroring the OpenCode state root. */
|
|
52
|
+
export const STATE_DIR = "_state";
|
|
53
|
+
/** Directory inside the sync repo mirroring `~/.agents/skills`. */
|
|
54
|
+
export const AGENTS_DIR = "_agents";
|
|
55
|
+
//# sourceMappingURL=paths.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paths.js","sourceRoot":"","sources":["../../src/core/paths.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAsB7B,SAAS,GAAG,CAAC,MAAc,EAAE,GAAG,QAAkB;IAChD,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACpC,IAAI,OAAO;QAAE,OAAO,OAAO,CAAC;IAC5B,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,GAAG,QAAQ,CAAC,CAAC;AAC9C,CAAC;AAED,MAAM,UAAU,aAAa;IAC3B,IAAI,OAAO,CAAC,GAAG,CAAC,gBAAgB;QAAE,OAAO,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC;IACtE,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,iBAAiB,EAAE,SAAS,CAAC,EAAE,UAAU,CAAC,CAAC;AAClE,CAAC;AAED,MAAM,UAAU,WAAW;IACzB,IAAI,OAAO,CAAC,GAAG,CAAC,cAAc;QAAE,OAAO,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC;IAClE,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,eAAe,EAAE,QAAQ,EAAE,OAAO,CAAC,EAAE,UAAU,CAAC,CAAC;AACxE,CAAC;AAED,MAAM,UAAU,YAAY;IAC1B,IAAI,OAAO,CAAC,GAAG,CAAC,eAAe;QAAE,OAAO,OA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|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Files the sync repository must never track.
|
|
3
|
+
*
|
|
4
|
+
* Three categories:
|
|
5
|
+
* - local-only settings (`opencode-sync*.jsonc`)
|
|
6
|
+
* - the SQLite database and its journals, which are gigabytes and are
|
|
7
|
+
* represented instead by the shards in `_sessions/`
|
|
8
|
+
* - caches, logs and OS junk
|
|
9
|
+
*/
|
|
10
|
+
export declare const DEFAULT_GITIGNORE = "# opencode-github-sync \u2014 machine-local, never committed\nopencode-sync.jsonc\nopencode-sync.overrides.jsonc\n.opencode-sync.lock\n\n# Runtime / generated\nnode_modules/\nbun.lock\nlogs/\n**/__pycache__/\n*.pyc\n\n# Session storage lives in _sessions/ as portable shards.\n# The raw database is far too large for git and cannot be merged.\n_data/opencode.db\n_data/opencode.db-shm\n_data/opencode.db-wal\n_data/bin/\n_data/log/\n_data/tool-output/\n_data/snapshot/\n_data/storage/session\n_data/storage/session_diff\n\n# Machine-local UI state\n_state/session.json\n\n# Empty directories recreated by OpenCode at runtime\nplugin/\n\n# OS files\n.DS_Store\nThumbs.db\ndesktop.ini\n";
|
|
11
|
+
export declare const DEFAULT_GITATTRIBUTES = "# Store and check out everything with LF.\n# \"text=auto\" alone would rewrite files to CRLF on Windows, which silently\n# breaks shell scripts shipped inside skills and makes every cross-platform\n# pull look like a whole-file change.\n* text=auto eol=lf\n\n# Append-only history files merge cleanly by taking both sides\n_state/prompt-history.jsonl text eol=lf merge=union\n\n# Session shards are gzipped JSON \u2014 binary, and never line-merged\n_sessions/*.json.gz binary\n";
|
|
12
|
+
/**
|
|
13
|
+
* Paths that exist inside the worktree but must stay out of every commit.
|
|
14
|
+
*
|
|
15
|
+
* These are runtime artefacts of the machine, not configuration. They are
|
|
16
|
+
* excluded from `add`, from stashing and from `clean`, so a sync can never
|
|
17
|
+
* delete a user's local database or tool output.
|
|
18
|
+
*/
|
|
19
|
+
export declare const LOCAL_RUNTIME_PATHS: string[];
|
|
20
|
+
export declare function isLocalRuntimePath(candidate: string): boolean;
|
|
21
|
+
export declare function excludePathspecs(): string[];
|
|
22
|
+
/** Unstage runtime paths in a single git call — subprocesses are slow on Windows. */
|
|
23
|
+
export declare function unstageLocalRuntimePaths(root: string): void;
|
|
24
|
+
export interface EnsureRepoOptions {
|
|
25
|
+
root: string;
|
|
26
|
+
remote: string;
|
|
27
|
+
branch: string;
|
|
28
|
+
}
|
|
29
|
+
export type RepoState = "ready" | "adopted" | "fresh";
|
|
30
|
+
/** Configure identity and metadata files. Safe to call repeatedly. */
|
|
31
|
+
export declare function ensureGitIdentity(root: string): void;
|
|
32
|
+
export declare function writeRepoMetadata(root: string): void;
|
|
33
|
+
/**
|
|
34
|
+
* Make `root` a git worktree pointing at `remote`.
|
|
35
|
+
*
|
|
36
|
+
* Returns `adopted` when the remote already had commits (they become the local
|
|
37
|
+
* state) and `fresh` when the remote exists but is empty.
|
|
38
|
+
*/
|
|
39
|
+
export declare function initRepo(options: EnsureRepoOptions): RepoState;
|
|
40
|
+
export declare function ensureRepo(options: EnsureRepoOptions): RepoState;
|
|
41
|
+
/** Fail fast when the remote is unreachable, distinguishing auth from network. */
|
|
42
|
+
export declare function assertRemoteReachable(root: string, branch: string, operation: string, allowMissingBranch?: boolean): void;
|
|
43
|
+
/**
|
|
44
|
+
* Verify the commit really landed on the remote.
|
|
45
|
+
*
|
|
46
|
+
* `git push` can exit zero against a misconfigured proxy or a stale credential
|
|
47
|
+
* helper without the remote actually moving, so success is confirmed by reading
|
|
48
|
+
* the remote head back.
|
|
49
|
+
*/
|
|
50
|
+
export declare function assertPushLanded(root: string, branch: string, operation: string): void;
|
|
51
|
+
export declare const REPO_DIRS: {
|
|
52
|
+
DATA_DIR: string;
|
|
53
|
+
STATE_DIR: string;
|
|
54
|
+
AGENTS_DIR: string;
|
|
55
|
+
SESSIONS_DIR: string;
|
|
56
|
+
};
|
|
57
|
+
//# sourceMappingURL=repo.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1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