pushwork 1.2.2 → 1.2.4
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/dist/browser/browser-sync-engine.d.ts +64 -0
- package/dist/browser/browser-sync-engine.d.ts.map +1 -0
- package/dist/browser/browser-sync-engine.js +303 -0
- package/dist/browser/browser-sync-engine.js.map +1 -0
- package/dist/browser/filesystem-adapter.d.ts +84 -0
- package/dist/browser/filesystem-adapter.d.ts.map +1 -0
- package/dist/browser/filesystem-adapter.js +413 -0
- package/dist/browser/filesystem-adapter.js.map +1 -0
- package/dist/browser/index.d.ts +36 -0
- package/dist/browser/index.d.ts.map +1 -0
- package/dist/browser/index.js +90 -0
- package/dist/browser/index.js.map +1 -0
- package/dist/browser/types.d.ts +70 -0
- package/dist/browser/types.d.ts.map +1 -0
- package/dist/browser/types.js +6 -0
- package/dist/browser/types.js.map +1 -0
- package/dist/cli/commands.d.ts +77 -0
- package/dist/cli/commands.d.ts.map +1 -0
- package/dist/cli/commands.js +904 -0
- package/dist/cli/commands.js.map +1 -0
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +19 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/output.d.ts +75 -0
- package/dist/cli/output.d.ts.map +1 -0
- package/dist/cli/output.js +182 -0
- package/dist/cli/output.js.map +1 -0
- package/dist/cli.js +0 -0
- package/dist/config/index.d.ts +71 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +314 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/remote-manager.d.ts +65 -0
- package/dist/config/remote-manager.d.ts.map +1 -0
- package/dist/config/remote-manager.js +243 -0
- package/dist/config/remote-manager.js.map +1 -0
- package/dist/config.d.ts +16 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +83 -0
- package/dist/config.js.map +1 -0
- package/dist/core/isomorphic-snapshot.d.ts +58 -0
- package/dist/core/isomorphic-snapshot.d.ts.map +1 -0
- package/dist/core/isomorphic-snapshot.js +204 -0
- package/dist/core/isomorphic-snapshot.js.map +1 -0
- package/dist/fs-tree.d.ts +6 -0
- package/dist/fs-tree.d.ts.map +1 -0
- package/dist/fs-tree.js +99 -0
- package/dist/fs-tree.js.map +1 -0
- package/dist/ignore.d.ts +6 -0
- package/dist/ignore.d.ts.map +1 -0
- package/dist/ignore.js +74 -0
- package/dist/ignore.js.map +1 -0
- package/dist/log.d.ts +3 -0
- package/dist/log.d.ts.map +1 -0
- package/dist/log.js +14 -0
- package/dist/log.js.map +1 -0
- package/dist/platform/browser-filesystem.d.ts +26 -0
- package/dist/platform/browser-filesystem.d.ts.map +1 -0
- package/dist/platform/browser-filesystem.js +91 -0
- package/dist/platform/browser-filesystem.js.map +1 -0
- package/dist/platform/filesystem.d.ts +29 -0
- package/dist/platform/filesystem.d.ts.map +1 -0
- package/dist/platform/filesystem.js +65 -0
- package/dist/platform/filesystem.js.map +1 -0
- package/dist/platform/node-filesystem.d.ts +21 -0
- package/dist/platform/node-filesystem.d.ts.map +1 -0
- package/dist/platform/node-filesystem.js +93 -0
- package/dist/platform/node-filesystem.js.map +1 -0
- package/dist/polyfill-node-window.d.ts +13 -0
- package/dist/polyfill-node-window.d.ts.map +1 -0
- package/dist/polyfill-node-window.js +17 -0
- package/dist/polyfill-node-window.js.map +1 -0
- package/dist/pushwork.d.ts +97 -0
- package/dist/pushwork.d.ts.map +1 -0
- package/dist/pushwork.js +726 -0
- package/dist/pushwork.js.map +1 -0
- package/dist/repo.d.ts +14 -0
- package/dist/repo.d.ts.map +1 -0
- package/dist/repo.js +60 -0
- package/dist/repo.js.map +1 -0
- package/dist/shapes/custom.d.ts +3 -0
- package/dist/shapes/custom.d.ts.map +1 -0
- package/dist/shapes/custom.js +57 -0
- package/dist/shapes/custom.js.map +1 -0
- package/dist/shapes/file.d.ts +20 -0
- package/dist/shapes/file.d.ts.map +1 -0
- package/dist/shapes/file.js +140 -0
- package/dist/shapes/file.js.map +1 -0
- package/dist/shapes/index.d.ts +10 -0
- package/dist/shapes/index.d.ts.map +1 -0
- package/dist/shapes/index.js +35 -0
- package/dist/shapes/index.js.map +1 -0
- package/dist/shapes/patchwork-folder.d.ts +3 -0
- package/dist/shapes/patchwork-folder.d.ts.map +1 -0
- package/dist/shapes/patchwork-folder.js +160 -0
- package/dist/shapes/patchwork-folder.js.map +1 -0
- package/dist/shapes/types.d.ts +38 -0
- package/dist/shapes/types.d.ts.map +1 -0
- package/dist/shapes/types.js +52 -0
- package/dist/shapes/types.js.map +1 -0
- package/dist/shapes/vfs.d.ts +3 -0
- package/dist/shapes/vfs.d.ts.map +1 -0
- package/dist/shapes/vfs.js +92 -0
- package/dist/shapes/vfs.js.map +1 -0
- package/dist/snarf.d.ts +21 -0
- package/dist/snarf.d.ts.map +1 -0
- package/dist/snarf.js +117 -0
- package/dist/snarf.js.map +1 -0
- package/dist/utils/content-similarity.d.ts +53 -0
- package/dist/utils/content-similarity.d.ts.map +1 -0
- package/dist/utils/content-similarity.js +155 -0
- package/dist/utils/content-similarity.js.map +1 -0
- package/dist/utils/fs-browser.d.ts +57 -0
- package/dist/utils/fs-browser.d.ts.map +1 -0
- package/dist/utils/fs-browser.js +311 -0
- package/dist/utils/fs-browser.js.map +1 -0
- package/dist/utils/fs-node.d.ts +53 -0
- package/dist/utils/fs-node.d.ts.map +1 -0
- package/dist/utils/fs-node.js +220 -0
- package/dist/utils/fs-node.js.map +1 -0
- package/dist/utils/isomorphic.d.ts +29 -0
- package/dist/utils/isomorphic.d.ts.map +1 -0
- package/dist/utils/isomorphic.js +139 -0
- package/dist/utils/isomorphic.js.map +1 -0
- package/dist/utils/node-polyfills.d.ts +9 -0
- package/dist/utils/node-polyfills.d.ts.map +1 -0
- package/dist/utils/node-polyfills.js +9 -0
- package/dist/utils/node-polyfills.js.map +1 -0
- package/dist/utils/pure.d.ts +25 -0
- package/dist/utils/pure.d.ts.map +1 -0
- package/dist/utils/pure.js +112 -0
- package/dist/utils/pure.js.map +1 -0
- package/dist/version.d.ts +11 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +93 -0
- package/dist/version.js.map +1 -0
- package/package.json +96 -98
- package/scripts/roundtrip-test.sh +0 -0
- package/test/integration/clone-test.sh +0 -0
- package/test/integration/conflict-resolution-test.sh +0 -0
- package/test/integration/deletion-behavior-test.sh +0 -0
- package/test/integration/deletion-sync-test-simple.sh +0 -0
- package/test/integration/deletion-sync-test.sh +0 -0
- package/test/integration/full-integration-test.sh +0 -0
- package/test/integration/manual-sync-test.sh +0 -0
- package/test/run-tests.sh +0 -0
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.ConfigManager = void 0;
|
|
37
|
+
const fs = __importStar(require("fs/promises"));
|
|
38
|
+
const path = __importStar(require("path"));
|
|
39
|
+
const os = __importStar(require("os"));
|
|
40
|
+
const utils_1 = require("../utils");
|
|
41
|
+
/**
|
|
42
|
+
* Configuration manager for pushwork
|
|
43
|
+
*/
|
|
44
|
+
class ConfigManager {
|
|
45
|
+
constructor(workingDir) {
|
|
46
|
+
this.workingDir = workingDir;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Get global configuration path
|
|
50
|
+
*/
|
|
51
|
+
getGlobalConfigPath() {
|
|
52
|
+
return path.join(os.homedir(), ConfigManager.GLOBAL_CONFIG_DIR, ConfigManager.CONFIG_FILENAME);
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Get local configuration path
|
|
56
|
+
*/
|
|
57
|
+
getLocalConfigPath() {
|
|
58
|
+
if (!this.workingDir) {
|
|
59
|
+
throw new Error("Working directory not set for local config");
|
|
60
|
+
}
|
|
61
|
+
return path.join(this.workingDir, ConfigManager.LOCAL_CONFIG_DIR, ConfigManager.CONFIG_FILENAME);
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Load global configuration
|
|
65
|
+
*/
|
|
66
|
+
async loadGlobal() {
|
|
67
|
+
try {
|
|
68
|
+
const configPath = this.getGlobalConfigPath();
|
|
69
|
+
if (!(await (0, utils_1.pathExists)(configPath))) {
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
72
|
+
const content = await fs.readFile(configPath, "utf8");
|
|
73
|
+
return JSON.parse(content);
|
|
74
|
+
}
|
|
75
|
+
catch (error) {
|
|
76
|
+
console.warn(`Failed to load global config: ${error}`);
|
|
77
|
+
return null;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Save global configuration
|
|
82
|
+
*/
|
|
83
|
+
async saveGlobal(config) {
|
|
84
|
+
try {
|
|
85
|
+
const configPath = this.getGlobalConfigPath();
|
|
86
|
+
await (0, utils_1.ensureDirectoryExists)(path.dirname(configPath));
|
|
87
|
+
const content = JSON.stringify(config, null, 2);
|
|
88
|
+
await fs.writeFile(configPath, content, "utf8");
|
|
89
|
+
}
|
|
90
|
+
catch (error) {
|
|
91
|
+
throw new Error(`Failed to save global config: ${error}`);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Load local/directory configuration
|
|
96
|
+
*/
|
|
97
|
+
async load() {
|
|
98
|
+
if (!this.workingDir) {
|
|
99
|
+
return null;
|
|
100
|
+
}
|
|
101
|
+
try {
|
|
102
|
+
const configPath = this.getLocalConfigPath();
|
|
103
|
+
if (!(await (0, utils_1.pathExists)(configPath))) {
|
|
104
|
+
return null;
|
|
105
|
+
}
|
|
106
|
+
const content = await fs.readFile(configPath, "utf8");
|
|
107
|
+
return JSON.parse(content);
|
|
108
|
+
}
|
|
109
|
+
catch (error) {
|
|
110
|
+
console.warn(`Failed to load local config: ${error}`);
|
|
111
|
+
return null;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Save local/directory configuration
|
|
116
|
+
*/
|
|
117
|
+
async save(config) {
|
|
118
|
+
if (!this.workingDir) {
|
|
119
|
+
throw new Error("Working directory not set for local config");
|
|
120
|
+
}
|
|
121
|
+
try {
|
|
122
|
+
const configPath = this.getLocalConfigPath();
|
|
123
|
+
await (0, utils_1.ensureDirectoryExists)(path.dirname(configPath));
|
|
124
|
+
const content = JSON.stringify(config, null, 2);
|
|
125
|
+
await fs.writeFile(configPath, content, "utf8");
|
|
126
|
+
}
|
|
127
|
+
catch (error) {
|
|
128
|
+
throw new Error(`Failed to save local config: ${error}`);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Get merged configuration (global + local)
|
|
133
|
+
*/
|
|
134
|
+
async getMerged() {
|
|
135
|
+
const globalConfig = await this.loadGlobal();
|
|
136
|
+
const localConfig = await this.load();
|
|
137
|
+
// Create default configuration
|
|
138
|
+
const defaultConfig = {
|
|
139
|
+
sync_enabled: true,
|
|
140
|
+
sync_server_storage_id: "3760df37-a4c6-4f66-9ecd-732039a9385d",
|
|
141
|
+
defaults: {
|
|
142
|
+
exclude_patterns: [".git", "node_modules", "*.tmp", ".pushwork"],
|
|
143
|
+
large_file_threshold: "100MB",
|
|
144
|
+
},
|
|
145
|
+
diff: {
|
|
146
|
+
show_binary: false,
|
|
147
|
+
},
|
|
148
|
+
sync: {
|
|
149
|
+
move_detection_threshold: 0.8,
|
|
150
|
+
prompt_threshold: 0.5,
|
|
151
|
+
auto_sync: false,
|
|
152
|
+
parallel_operations: 4,
|
|
153
|
+
},
|
|
154
|
+
};
|
|
155
|
+
// Merge configurations: default < global < local
|
|
156
|
+
let merged = { ...defaultConfig };
|
|
157
|
+
if (globalConfig) {
|
|
158
|
+
merged = this.mergeConfigs(merged, globalConfig);
|
|
159
|
+
}
|
|
160
|
+
if (localConfig) {
|
|
161
|
+
merged = this.mergeConfigs(merged, localConfig);
|
|
162
|
+
}
|
|
163
|
+
return merged;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Merge two configuration objects
|
|
167
|
+
*/
|
|
168
|
+
mergeConfigs(base, override) {
|
|
169
|
+
const merged = { ...base };
|
|
170
|
+
if ("sync_server" in override && override.sync_server !== undefined) {
|
|
171
|
+
merged.sync_server = override.sync_server;
|
|
172
|
+
}
|
|
173
|
+
if ("sync_server_storage_id" in override &&
|
|
174
|
+
override.sync_server_storage_id !== undefined) {
|
|
175
|
+
merged.sync_server_storage_id = override.sync_server_storage_id;
|
|
176
|
+
}
|
|
177
|
+
if ("sync_enabled" in override && override.sync_enabled !== undefined) {
|
|
178
|
+
merged.sync_enabled = override.sync_enabled;
|
|
179
|
+
}
|
|
180
|
+
// Handle GlobalConfig structure
|
|
181
|
+
if ("exclude_patterns" in override && override.exclude_patterns) {
|
|
182
|
+
merged.defaults.exclude_patterns = override.exclude_patterns;
|
|
183
|
+
}
|
|
184
|
+
if ("large_file_threshold" in override && override.large_file_threshold) {
|
|
185
|
+
merged.defaults.large_file_threshold = override.large_file_threshold;
|
|
186
|
+
}
|
|
187
|
+
// Handle DirectoryConfig structure
|
|
188
|
+
if ("defaults" in override && override.defaults) {
|
|
189
|
+
merged.defaults = { ...merged.defaults, ...override.defaults };
|
|
190
|
+
}
|
|
191
|
+
if ("diff" in override && override.diff) {
|
|
192
|
+
// Merge diff settings, ensuring show_binary has a default
|
|
193
|
+
merged.diff = {
|
|
194
|
+
...merged.diff,
|
|
195
|
+
...override.diff,
|
|
196
|
+
show_binary: override.diff.show_binary ?? merged.diff.show_binary,
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
if ("sync" in override && override.sync) {
|
|
200
|
+
merged.sync = { ...merged.sync, ...override.sync };
|
|
201
|
+
}
|
|
202
|
+
return merged;
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Create default global configuration
|
|
206
|
+
*/
|
|
207
|
+
async createDefaultGlobal() {
|
|
208
|
+
const defaultGlobal = {
|
|
209
|
+
exclude_patterns: [
|
|
210
|
+
".git",
|
|
211
|
+
"node_modules",
|
|
212
|
+
"*.tmp",
|
|
213
|
+
".DS_Store",
|
|
214
|
+
".pushwork",
|
|
215
|
+
],
|
|
216
|
+
large_file_threshold: "100MB",
|
|
217
|
+
sync_server: "wss://sync3.automerge.org",
|
|
218
|
+
sync_server_storage_id: "3760df37-a4c6-4f66-9ecd-732039a9385d",
|
|
219
|
+
diff: {
|
|
220
|
+
show_binary: false,
|
|
221
|
+
},
|
|
222
|
+
sync: {
|
|
223
|
+
move_detection_threshold: 0.8,
|
|
224
|
+
prompt_threshold: 0.5,
|
|
225
|
+
auto_sync: false,
|
|
226
|
+
parallel_operations: 4,
|
|
227
|
+
},
|
|
228
|
+
};
|
|
229
|
+
await this.saveGlobal(defaultGlobal);
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Check if global configuration exists
|
|
233
|
+
*/
|
|
234
|
+
async globalConfigExists() {
|
|
235
|
+
return await (0, utils_1.pathExists)(this.getGlobalConfigPath());
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Check if local configuration exists
|
|
239
|
+
*/
|
|
240
|
+
async localConfigExists() {
|
|
241
|
+
if (!this.workingDir)
|
|
242
|
+
return false;
|
|
243
|
+
return await (0, utils_1.pathExists)(this.getLocalConfigPath());
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Get configuration value by path (e.g., 'sync.auto_sync')
|
|
247
|
+
*/
|
|
248
|
+
async getValue(keyPath) {
|
|
249
|
+
const config = await this.getMerged();
|
|
250
|
+
const keys = keyPath.split(".");
|
|
251
|
+
let value = config;
|
|
252
|
+
for (const key of keys) {
|
|
253
|
+
if (value && typeof value === "object" && key in value) {
|
|
254
|
+
value = value[key];
|
|
255
|
+
}
|
|
256
|
+
else {
|
|
257
|
+
return undefined;
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
return value;
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* Set configuration value by path
|
|
264
|
+
*/
|
|
265
|
+
async setValue(keyPath, value) {
|
|
266
|
+
const config = (await this.load()) || {};
|
|
267
|
+
const keys = keyPath.split(".");
|
|
268
|
+
let current = config;
|
|
269
|
+
// Navigate to the parent of the target key
|
|
270
|
+
for (let i = 0; i < keys.length - 1; i++) {
|
|
271
|
+
const key = keys[i];
|
|
272
|
+
if (!(key in current) || typeof current[key] !== "object") {
|
|
273
|
+
current[key] = {};
|
|
274
|
+
}
|
|
275
|
+
current = current[key];
|
|
276
|
+
}
|
|
277
|
+
// Set the value
|
|
278
|
+
const finalKey = keys[keys.length - 1];
|
|
279
|
+
current[finalKey] = value;
|
|
280
|
+
await this.save(config);
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* Validate configuration
|
|
284
|
+
*/
|
|
285
|
+
validate(config) {
|
|
286
|
+
const errors = [];
|
|
287
|
+
if (config.sync?.move_detection_threshold !== undefined) {
|
|
288
|
+
if (config.sync.move_detection_threshold < 0 ||
|
|
289
|
+
config.sync.move_detection_threshold > 1) {
|
|
290
|
+
errors.push("move_detection_threshold must be between 0 and 1");
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
if (config.sync?.prompt_threshold !== undefined) {
|
|
294
|
+
if (config.sync.prompt_threshold < 0 ||
|
|
295
|
+
config.sync.prompt_threshold > 1) {
|
|
296
|
+
errors.push("prompt_threshold must be between 0 and 1");
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
if (config.sync?.parallel_operations !== undefined) {
|
|
300
|
+
if (config.sync.parallel_operations < 1) {
|
|
301
|
+
errors.push("parallel_operations must be at least 1");
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
return {
|
|
305
|
+
valid: errors.length === 0,
|
|
306
|
+
errors,
|
|
307
|
+
};
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
exports.ConfigManager = ConfigManager;
|
|
311
|
+
ConfigManager.GLOBAL_CONFIG_DIR = ".pushwork";
|
|
312
|
+
ConfigManager.CONFIG_FILENAME = "config.json";
|
|
313
|
+
ConfigManager.LOCAL_CONFIG_DIR = ".pushwork";
|
|
314
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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manages multiple remotes for a pushwork directory
|
|
5
|
+
*/
|
|
6
|
+
export declare class RemoteManager {
|
|
7
|
+
private workingDir;
|
|
8
|
+
private configManager;
|
|
9
|
+
private static readonly REMOTES_DIR;
|
|
10
|
+
constructor(workingDir: string, configManager: ConfigManager);
|
|
11
|
+
/**
|
|
12
|
+
* Get path to remotes directory
|
|
13
|
+
*/
|
|
14
|
+
private getRemotesDir;
|
|
15
|
+
/**
|
|
16
|
+
* Get path to a specific remote's directory
|
|
17
|
+
*/
|
|
18
|
+
private getRemoteDir;
|
|
19
|
+
/**
|
|
20
|
+
* Get path to a remote's snapshot file
|
|
21
|
+
*/
|
|
22
|
+
getRemoteSnapshotPath(remoteName: string): string;
|
|
23
|
+
/**
|
|
24
|
+
* Get path to a remote's automerge storage
|
|
25
|
+
*/
|
|
26
|
+
getRemoteAutomergePath(remoteName: string): string;
|
|
27
|
+
/**
|
|
28
|
+
* Add a new remote
|
|
29
|
+
*/
|
|
30
|
+
addRemote(remote: RemoteConfig): Promise<void>;
|
|
31
|
+
/**
|
|
32
|
+
* Remove a remote
|
|
33
|
+
*/
|
|
34
|
+
removeRemote(remoteName: string): Promise<void>;
|
|
35
|
+
/**
|
|
36
|
+
* List all remotes
|
|
37
|
+
*/
|
|
38
|
+
listRemotes(): Promise<RemoteConfig[]>;
|
|
39
|
+
/**
|
|
40
|
+
* Get a specific remote by name
|
|
41
|
+
*/
|
|
42
|
+
getRemote(remoteName: string): Promise<RemoteConfig | null>;
|
|
43
|
+
/**
|
|
44
|
+
* Get current remote
|
|
45
|
+
*/
|
|
46
|
+
getCurrentRemote(): Promise<RemoteConfig | null>;
|
|
47
|
+
/**
|
|
48
|
+
* Get current remote name
|
|
49
|
+
*/
|
|
50
|
+
getCurrentRemoteName(): Promise<string | null>;
|
|
51
|
+
/**
|
|
52
|
+
* Switch to a different remote
|
|
53
|
+
*/
|
|
54
|
+
switchRemote(remoteName: string): Promise<void>;
|
|
55
|
+
/**
|
|
56
|
+
* Check if remotes are configured
|
|
57
|
+
*/
|
|
58
|
+
hasRemotes(): Promise<boolean>;
|
|
59
|
+
/**
|
|
60
|
+
* Migrate legacy single-remote setup to new multi-remote format
|
|
61
|
+
* This converts the old root_directory_url to an "origin" remote
|
|
62
|
+
*/
|
|
63
|
+
migrateLegacyConfig(): Promise<boolean>;
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=remote-manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remote-manager.d.ts","sourceRoot":"","sources":["../../src/config/remote-manager.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAmB,MAAM,UAAU,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAGxC;;GAEG;AACH,qBAAa,aAAa;IAItB,OAAO,CAAC,UAAU;IAClB,OAAO,CAAC,aAAa;IAJvB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,WAAW,CAAa;gBAGtC,UAAU,EAAE,MAAM,EAClB,aAAa,EAAE,aAAa;IAGtC;;OAEG;IACH,OAAO,CAAC,aAAa;IAIrB;;OAEG;IACH,OAAO,CAAC,YAAY;IAIpB;;OAEG;IACH,qBAAqB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM;IAIjD;;OAEG;IACH,sBAAsB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM;IAIlD;;OAEG;IACG,SAAS,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAiCpD;;OAEG;IACG,YAAY,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IA6BrD;;OAEG;IACG,WAAW,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC;IAS5C;;OAEG;IACG,SAAS,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC;IASjE;;OAEG;IACG,gBAAgB,IAAI,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC;IAStD;;OAEG;IACG,oBAAoB,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAKpD;;OAEG;IACG,YAAY,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAoBrD;;OAEG;IACG,UAAU,IAAI,OAAO,CAAC,OAAO,CAAC;IAKpC;;;OAGG;IACG,mBAAmB,IAAI,OAAO,CAAC,OAAO,CAAC;CAkE9C"}
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.RemoteManager = void 0;
|
|
37
|
+
const fs = __importStar(require("fs/promises"));
|
|
38
|
+
const path = __importStar(require("path"));
|
|
39
|
+
const utils_1 = require("../utils");
|
|
40
|
+
/**
|
|
41
|
+
* Manages multiple remotes for a pushwork directory
|
|
42
|
+
*/
|
|
43
|
+
class RemoteManager {
|
|
44
|
+
constructor(workingDir, configManager) {
|
|
45
|
+
this.workingDir = workingDir;
|
|
46
|
+
this.configManager = configManager;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Get path to remotes directory
|
|
50
|
+
*/
|
|
51
|
+
getRemotesDir() {
|
|
52
|
+
return path.join(this.workingDir, ".pushwork", RemoteManager.REMOTES_DIR);
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Get path to a specific remote's directory
|
|
56
|
+
*/
|
|
57
|
+
getRemoteDir(remoteName) {
|
|
58
|
+
return path.join(this.getRemotesDir(), remoteName);
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Get path to a remote's snapshot file
|
|
62
|
+
*/
|
|
63
|
+
getRemoteSnapshotPath(remoteName) {
|
|
64
|
+
return path.join(this.getRemoteDir(remoteName), "snapshot.json");
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Get path to a remote's automerge storage
|
|
68
|
+
*/
|
|
69
|
+
getRemoteAutomergePath(remoteName) {
|
|
70
|
+
return path.join(this.getRemoteDir(remoteName), "automerge");
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Add a new remote
|
|
74
|
+
*/
|
|
75
|
+
async addRemote(remote) {
|
|
76
|
+
const config = await this.configManager.load();
|
|
77
|
+
if (!config) {
|
|
78
|
+
throw new Error("No configuration found. Run 'pushwork init' first.");
|
|
79
|
+
}
|
|
80
|
+
// Initialize remotes object if it doesn't exist
|
|
81
|
+
if (!config.remotes) {
|
|
82
|
+
config.remotes = {};
|
|
83
|
+
}
|
|
84
|
+
// Check if remote already exists
|
|
85
|
+
if (config.remotes[remote.name]) {
|
|
86
|
+
throw new Error(`Remote '${remote.name}' already exists.`);
|
|
87
|
+
}
|
|
88
|
+
// Add the remote
|
|
89
|
+
config.remotes[remote.name] = remote;
|
|
90
|
+
// Set as current remote if it's the first one
|
|
91
|
+
if (!config.current_remote) {
|
|
92
|
+
config.current_remote = remote.name;
|
|
93
|
+
}
|
|
94
|
+
// Create remote directory structure
|
|
95
|
+
const remoteDir = this.getRemoteDir(remote.name);
|
|
96
|
+
await (0, utils_1.ensureDirectoryExists)(remoteDir);
|
|
97
|
+
await (0, utils_1.ensureDirectoryExists)(this.getRemoteAutomergePath(remote.name));
|
|
98
|
+
// Save updated config
|
|
99
|
+
await this.configManager.save(config);
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Remove a remote
|
|
103
|
+
*/
|
|
104
|
+
async removeRemote(remoteName) {
|
|
105
|
+
const config = await this.configManager.load();
|
|
106
|
+
if (!config || !config.remotes) {
|
|
107
|
+
throw new Error("No remotes configured.");
|
|
108
|
+
}
|
|
109
|
+
if (!config.remotes[remoteName]) {
|
|
110
|
+
throw new Error(`Remote '${remoteName}' does not exist.`);
|
|
111
|
+
}
|
|
112
|
+
// Can't remove current remote without switching first
|
|
113
|
+
if (config.current_remote === remoteName) {
|
|
114
|
+
throw new Error(`Cannot remove current remote '${remoteName}'. Switch to another remote first.`);
|
|
115
|
+
}
|
|
116
|
+
// Remove remote from config
|
|
117
|
+
delete config.remotes[remoteName];
|
|
118
|
+
// Remove remote directory
|
|
119
|
+
const remoteDir = this.getRemoteDir(remoteName);
|
|
120
|
+
if (await (0, utils_1.pathExists)(remoteDir)) {
|
|
121
|
+
await fs.rm(remoteDir, { recursive: true, force: true });
|
|
122
|
+
}
|
|
123
|
+
await this.configManager.save(config);
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* List all remotes
|
|
127
|
+
*/
|
|
128
|
+
async listRemotes() {
|
|
129
|
+
const config = await this.configManager.load();
|
|
130
|
+
if (!config || !config.remotes) {
|
|
131
|
+
return [];
|
|
132
|
+
}
|
|
133
|
+
return Object.values(config.remotes);
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Get a specific remote by name
|
|
137
|
+
*/
|
|
138
|
+
async getRemote(remoteName) {
|
|
139
|
+
const config = await this.configManager.load();
|
|
140
|
+
if (!config || !config.remotes) {
|
|
141
|
+
return null;
|
|
142
|
+
}
|
|
143
|
+
return config.remotes[remoteName] || null;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Get current remote
|
|
147
|
+
*/
|
|
148
|
+
async getCurrentRemote() {
|
|
149
|
+
const config = await this.configManager.load();
|
|
150
|
+
if (!config || !config.current_remote || !config.remotes) {
|
|
151
|
+
return null;
|
|
152
|
+
}
|
|
153
|
+
return config.remotes[config.current_remote] || null;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Get current remote name
|
|
157
|
+
*/
|
|
158
|
+
async getCurrentRemoteName() {
|
|
159
|
+
const config = await this.configManager.load();
|
|
160
|
+
return config?.current_remote || null;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Switch to a different remote
|
|
164
|
+
*/
|
|
165
|
+
async switchRemote(remoteName) {
|
|
166
|
+
const config = await this.configManager.load();
|
|
167
|
+
if (!config) {
|
|
168
|
+
throw new Error("No configuration found.");
|
|
169
|
+
}
|
|
170
|
+
if (!config.remotes || !config.remotes[remoteName]) {
|
|
171
|
+
throw new Error(`Remote '${remoteName}' does not exist.`);
|
|
172
|
+
}
|
|
173
|
+
// Ensure remote directory exists
|
|
174
|
+
const remoteDir = this.getRemoteDir(remoteName);
|
|
175
|
+
await (0, utils_1.ensureDirectoryExists)(remoteDir);
|
|
176
|
+
await (0, utils_1.ensureDirectoryExists)(this.getRemoteAutomergePath(remoteName));
|
|
177
|
+
// Update current remote
|
|
178
|
+
config.current_remote = remoteName;
|
|
179
|
+
await this.configManager.save(config);
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Check if remotes are configured
|
|
183
|
+
*/
|
|
184
|
+
async hasRemotes() {
|
|
185
|
+
const config = await this.configManager.load();
|
|
186
|
+
return !!(config?.remotes && Object.keys(config.remotes).length > 0);
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Migrate legacy single-remote setup to new multi-remote format
|
|
190
|
+
* This converts the old root_directory_url to an "origin" remote
|
|
191
|
+
*/
|
|
192
|
+
async migrateLegacyConfig() {
|
|
193
|
+
const config = await this.configManager.load();
|
|
194
|
+
if (!config) {
|
|
195
|
+
return false;
|
|
196
|
+
}
|
|
197
|
+
// Check if migration is needed
|
|
198
|
+
if (config.remotes && Object.keys(config.remotes).length > 0) {
|
|
199
|
+
return false; // Already migrated
|
|
200
|
+
}
|
|
201
|
+
if (!config.root_directory_url) {
|
|
202
|
+
return false; // Nothing to migrate
|
|
203
|
+
}
|
|
204
|
+
// Create origin remote from legacy config
|
|
205
|
+
const originRemote = {
|
|
206
|
+
name: "origin",
|
|
207
|
+
rootFolderUrl: config.root_directory_url,
|
|
208
|
+
syncServer: config.sync_server,
|
|
209
|
+
syncServerStorageId: config.sync_server_storage_id,
|
|
210
|
+
};
|
|
211
|
+
// Initialize remotes
|
|
212
|
+
config.remotes = {
|
|
213
|
+
origin: originRemote,
|
|
214
|
+
};
|
|
215
|
+
config.current_remote = "origin";
|
|
216
|
+
// Migrate legacy snapshot and automerge data to origin remote
|
|
217
|
+
const legacySnapshotPath = path.join(this.workingDir, ".pushwork", "snapshot.json");
|
|
218
|
+
const legacyAutomergePath = path.join(this.workingDir, ".pushwork", "automerge");
|
|
219
|
+
// Create origin remote directory
|
|
220
|
+
const originDir = this.getRemoteDir("origin");
|
|
221
|
+
await (0, utils_1.ensureDirectoryExists)(originDir);
|
|
222
|
+
// Move snapshot if it exists
|
|
223
|
+
if (await (0, utils_1.pathExists)(legacySnapshotPath)) {
|
|
224
|
+
const newSnapshotPath = this.getRemoteSnapshotPath("origin");
|
|
225
|
+
await fs.rename(legacySnapshotPath, newSnapshotPath);
|
|
226
|
+
}
|
|
227
|
+
// Move automerge data if it exists
|
|
228
|
+
if (await (0, utils_1.pathExists)(legacyAutomergePath)) {
|
|
229
|
+
const newAutomergePath = this.getRemoteAutomergePath("origin");
|
|
230
|
+
// Remove new path if it exists (shouldn't happen but be safe)
|
|
231
|
+
if (await (0, utils_1.pathExists)(newAutomergePath)) {
|
|
232
|
+
await fs.rm(newAutomergePath, { recursive: true, force: true });
|
|
233
|
+
}
|
|
234
|
+
await fs.rename(legacyAutomergePath, newAutomergePath);
|
|
235
|
+
}
|
|
236
|
+
// Save migrated config
|
|
237
|
+
await this.configManager.save(config);
|
|
238
|
+
return true;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
exports.RemoteManager = RemoteManager;
|
|
242
|
+
RemoteManager.REMOTES_DIR = "remotes";
|
|
243
|
+
//# sourceMappingURL=remote-manager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remote-manager.js","sourceRoot":"","sources":["../../src/config/remote-manager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAAkC;AAClC,2CAA6B;AAG7B,oCAA6D;AAE7D;;GAEG;AACH,MAAa,aAAa;IAGxB,YACU,UAAkB,EAClB,aAA4B;QAD5B,eAAU,GAAV,UAAU,CAAQ;QAClB,kBAAa,GAAb,aAAa,CAAe;IACnC,CAAC;IAEJ;;OAEG;IACK,aAAa;QACnB,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,WAAW,EAAE,aAAa,CAAC,WAAW,CAAC,CAAC;I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AC,EAAE,CAAC,gBAAgB,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;YAClE,CAAC;YACD,MAAM,EAAE,CAAC,MAAM,CAAC,mBAAmB,EAAE,gBAAgB,CAAC,CAAC;QACzD,CAAC;QAED,uBAAuB;QACvB,MAAM,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAEtC,OAAO,IAAI,CAAC;IACd,CAAC;;AAxPH,sCAyPC;AAxPyB,yBAAW,GAAG,SAAS,CAAC"}
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { AutomergeUrl } from "@automerge/automerge-repo";
|
|
2
|
+
export type Backend = "legacy" | "subduction";
|
|
3
|
+
export declare const CONFIG_VERSION = 4;
|
|
4
|
+
export interface PushworkConfig {
|
|
5
|
+
version: typeof CONFIG_VERSION;
|
|
6
|
+
rootUrl: AutomergeUrl;
|
|
7
|
+
backend: Backend;
|
|
8
|
+
shape: string;
|
|
9
|
+
artifactDirectories: string[];
|
|
10
|
+
}
|
|
11
|
+
export declare const pushworkDir: (root: string) => string;
|
|
12
|
+
export declare const storageDir: (root: string) => string;
|
|
13
|
+
export declare function readConfig(root: string): Promise<PushworkConfig>;
|
|
14
|
+
export declare function writeConfig(root: string, config: PushworkConfig): Promise<void>;
|
|
15
|
+
export declare function configExists(root: string): Promise<boolean>;
|
|
16
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAE9D,MAAM,MAAM,OAAO,GAAG,QAAQ,GAAG,YAAY,CAAC;AAE9C,eAAO,MAAM,cAAc,IAAI,CAAC;AAEhC,MAAM,WAAW,cAAc;IAC9B,OAAO,EAAE,OAAO,cAAc,CAAC;IAC/B,OAAO,EAAE,YAAY,CAAC;IACtB,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,mBAAmB,EAAE,MAAM,EAAE,CAAC;CAC9B;AAMD,eAAO,MAAM,WAAW,GAAI,MAAM,MAAM,WAAyB,CAAC;AAClE,eAAO,MAAM,UAAU,GAAI,MAAM,MAAM,WAAkC,CAAC;AAE1E,wBAAsB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,CAkBtE;AAED,wBAAsB,WAAW,CAChC,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,cAAc,GACpB,OAAO,CAAC,IAAI,CAAC,CAMf;AAED,wBAAsB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAOjE"}
|