pushwork 1.0.4 → 1.0.7
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/README.md +87 -328
- package/dist/.pushwork/automerge/3P/Dm3ekE2pmjGnWvDaG3vSR7ww98/snapshot/aa2349c94955ea561f698720142f9d884a6872d9f82dc332d578c216beb0df0e +0 -0
- package/dist/.pushwork/automerge/st/orage-adapter-id +1 -0
- package/dist/.pushwork/config.json +15 -0
- package/dist/.pushwork/snapshot.json +7 -0
- package/dist/cli.js +231 -170
- package/dist/cli.js.map +1 -1
- package/dist/commands.d.ts +51 -0
- package/dist/commands.d.ts.map +1 -0
- package/dist/commands.js +799 -0
- package/dist/commands.js.map +1 -0
- package/dist/core/change-detection.d.ts +6 -19
- package/dist/core/change-detection.d.ts.map +1 -1
- package/dist/core/change-detection.js +101 -80
- package/dist/core/change-detection.js.map +1 -1
- package/dist/{config/index.d.ts → core/config.d.ts} +13 -3
- package/dist/core/config.d.ts.map +1 -0
- package/dist/{config/index.js → core/config.js} +55 -73
- package/dist/core/config.js.map +1 -0
- package/dist/core/index.d.ts +1 -0
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +1 -1
- package/dist/core/index.js.map +1 -1
- package/dist/core/move-detection.d.ts +12 -50
- package/dist/core/move-detection.d.ts.map +1 -1
- package/dist/core/move-detection.js +58 -139
- package/dist/core/move-detection.js.map +1 -1
- package/dist/core/snapshot.d.ts +0 -4
- package/dist/core/snapshot.d.ts.map +1 -1
- package/dist/core/snapshot.js +2 -11
- package/dist/core/snapshot.js.map +1 -1
- package/dist/core/sync-engine.d.ts +5 -11
- package/dist/core/sync-engine.d.ts.map +1 -1
- package/dist/core/sync-engine.js +220 -362
- package/dist/core/sync-engine.js.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -6
- package/dist/index.js.map +1 -1
- package/dist/types/config.d.ts +43 -67
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/config.js +6 -0
- package/dist/types/config.js.map +1 -1
- package/dist/types/documents.d.ts +15 -3
- package/dist/types/documents.d.ts.map +1 -1
- package/dist/types/documents.js.map +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +0 -3
- package/dist/types/index.js.map +1 -1
- package/dist/types/snapshot.d.ts +3 -21
- package/dist/types/snapshot.d.ts.map +1 -1
- package/dist/types/snapshot.js +0 -14
- package/dist/types/snapshot.js.map +1 -1
- package/dist/utils/content.d.ts.map +1 -1
- package/dist/utils/content.js +2 -6
- package/dist/utils/content.js.map +1 -1
- package/dist/utils/directory.d.ts +10 -0
- package/dist/utils/directory.d.ts.map +1 -0
- package/dist/utils/directory.js +37 -0
- package/dist/utils/directory.js.map +1 -0
- package/dist/utils/fs.d.ts +15 -2
- package/dist/utils/fs.d.ts.map +1 -1
- package/dist/utils/fs.js +63 -53
- package/dist/utils/fs.js.map +1 -1
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -4
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/mime-types.d.ts.map +1 -1
- package/dist/utils/mime-types.js +11 -4
- package/dist/utils/mime-types.js.map +1 -1
- package/dist/utils/network-sync.d.ts +0 -6
- package/dist/utils/network-sync.d.ts.map +1 -1
- package/dist/utils/network-sync.js +55 -99
- package/dist/utils/network-sync.js.map +1 -1
- package/dist/utils/output.d.ts +129 -0
- package/dist/utils/output.d.ts.map +1 -0
- package/dist/utils/output.js +375 -0
- package/dist/utils/output.js.map +1 -0
- package/dist/utils/repo-factory.d.ts +2 -6
- package/dist/utils/repo-factory.d.ts.map +1 -1
- package/dist/utils/repo-factory.js +8 -22
- package/dist/utils/repo-factory.js.map +1 -1
- package/dist/utils/string-similarity.d.ts +14 -0
- package/dist/utils/string-similarity.d.ts.map +1 -0
- package/dist/utils/string-similarity.js +43 -0
- package/dist/utils/string-similarity.js.map +1 -0
- package/dist/utils/trace.d.ts +19 -0
- package/dist/utils/trace.d.ts.map +1 -0
- package/dist/utils/trace.js +68 -0
- package/dist/utils/trace.js.map +1 -0
- package/package.json +17 -12
- package/src/cli.ts +326 -252
- package/src/commands.ts +988 -0
- package/src/core/change-detection.ts +199 -162
- package/src/{config/index.ts → core/config.ts} +65 -82
- package/src/core/index.ts +1 -1
- package/src/core/move-detection.ts +74 -180
- package/src/core/snapshot.ts +2 -12
- package/src/core/sync-engine.ts +248 -499
- package/src/index.ts +0 -10
- package/src/types/config.ts +50 -72
- package/src/types/documents.ts +16 -3
- package/src/types/index.ts +0 -5
- package/src/types/snapshot.ts +1 -23
- package/src/utils/content.ts +2 -6
- package/src/utils/directory.ts +50 -0
- package/src/utils/fs.ts +67 -56
- package/src/utils/index.ts +1 -6
- package/src/utils/mime-types.ts +12 -4
- package/src/utils/network-sync.ts +79 -137
- package/src/utils/output.ts +450 -0
- package/src/utils/repo-factory.ts +13 -31
- package/src/utils/string-similarity.ts +54 -0
- package/src/utils/trace.ts +70 -0
- package/test/integration/exclude-patterns.test.ts +6 -15
- package/test/integration/fuzzer.test.ts +308 -391
- package/test/integration/init-sync.test.ts +89 -0
- package/test/integration/sync-deletion.test.ts +2 -61
- package/test/integration/sync-flow.test.ts +4 -24
- package/test/jest.setup.ts +34 -0
- package/test/unit/deletion-behavior.test.ts +3 -14
- package/test/unit/enhanced-mime-detection.test.ts +0 -22
- package/test/unit/snapshot.test.ts +2 -29
- package/test/unit/sync-convergence.test.ts +3 -198
- package/test/unit/sync-timing.test.ts +0 -44
- package/test/unit/utils.test.ts +0 -2
- package/tsconfig.json +3 -3
- package/dist/browser/browser-sync-engine.d.ts +0 -64
- package/dist/browser/browser-sync-engine.d.ts.map +0 -1
- package/dist/browser/browser-sync-engine.js +0 -303
- package/dist/browser/browser-sync-engine.js.map +0 -1
- package/dist/browser/filesystem-adapter.d.ts +0 -84
- package/dist/browser/filesystem-adapter.d.ts.map +0 -1
- package/dist/browser/filesystem-adapter.js +0 -413
- package/dist/browser/filesystem-adapter.js.map +0 -1
- package/dist/browser/index.d.ts +0 -36
- package/dist/browser/index.d.ts.map +0 -1
- package/dist/browser/index.js +0 -90
- package/dist/browser/index.js.map +0 -1
- package/dist/browser/types.d.ts +0 -70
- package/dist/browser/types.d.ts.map +0 -1
- package/dist/browser/types.js +0 -6
- package/dist/browser/types.js.map +0 -1
- package/dist/cli/commands.d.ts +0 -77
- package/dist/cli/commands.d.ts.map +0 -1
- package/dist/cli/commands.js +0 -904
- package/dist/cli/commands.js.map +0 -1
- package/dist/cli/index.d.ts +0 -2
- package/dist/cli/index.d.ts.map +0 -1
- package/dist/cli/index.js +0 -19
- package/dist/cli/index.js.map +0 -1
- package/dist/config/index.d.ts.map +0 -1
- package/dist/config/index.js.map +0 -1
- package/dist/core/isomorphic-snapshot.d.ts +0 -58
- package/dist/core/isomorphic-snapshot.d.ts.map +0 -1
- package/dist/core/isomorphic-snapshot.js +0 -204
- package/dist/core/isomorphic-snapshot.js.map +0 -1
- package/dist/platform/browser-filesystem.d.ts +0 -26
- package/dist/platform/browser-filesystem.d.ts.map +0 -1
- package/dist/platform/browser-filesystem.js +0 -91
- package/dist/platform/browser-filesystem.js.map +0 -1
- package/dist/platform/filesystem.d.ts +0 -29
- package/dist/platform/filesystem.d.ts.map +0 -1
- package/dist/platform/filesystem.js +0 -65
- package/dist/platform/filesystem.js.map +0 -1
- package/dist/platform/node-filesystem.d.ts +0 -21
- package/dist/platform/node-filesystem.d.ts.map +0 -1
- package/dist/platform/node-filesystem.js +0 -93
- package/dist/platform/node-filesystem.js.map +0 -1
- package/dist/utils/content-similarity.d.ts +0 -53
- package/dist/utils/content-similarity.d.ts.map +0 -1
- package/dist/utils/content-similarity.js +0 -155
- package/dist/utils/content-similarity.js.map +0 -1
- package/dist/utils/fs-browser.d.ts +0 -57
- package/dist/utils/fs-browser.d.ts.map +0 -1
- package/dist/utils/fs-browser.js +0 -311
- package/dist/utils/fs-browser.js.map +0 -1
- package/dist/utils/fs-node.d.ts +0 -53
- package/dist/utils/fs-node.d.ts.map +0 -1
- package/dist/utils/fs-node.js +0 -220
- package/dist/utils/fs-node.js.map +0 -1
- package/dist/utils/isomorphic.d.ts +0 -29
- package/dist/utils/isomorphic.d.ts.map +0 -1
- package/dist/utils/isomorphic.js +0 -139
- package/dist/utils/isomorphic.js.map +0 -1
- package/dist/utils/pure.d.ts +0 -25
- package/dist/utils/pure.d.ts.map +0 -1
- package/dist/utils/pure.js +0 -112
- package/dist/utils/pure.js.map +0 -1
- package/src/cli/commands.ts +0 -1207
- package/src/cli/index.ts +0 -2
- package/src/utils/content-similarity.ts +0 -194
- package/test/README-TESTING-GAPS.md +0 -174
- package/test/unit/content-similarity.test.ts +0 -236
package/dist/cli.js
CHANGED
|
@@ -4,225 +4,286 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
5
|
};
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
const
|
|
7
|
+
const extra_typings_1 = require("@commander-js/extra-typings");
|
|
8
8
|
const chalk_1 = __importDefault(require("chalk"));
|
|
9
|
-
const commands_1 = require("./
|
|
10
|
-
/**
|
|
11
|
-
* Wrapper for command actions with consistent error handling
|
|
12
|
-
*/
|
|
13
|
-
function withErrorHandling(fn) {
|
|
14
|
-
return async (...args) => {
|
|
15
|
-
try {
|
|
16
|
-
await fn(...args);
|
|
17
|
-
}
|
|
18
|
-
catch (error) {
|
|
19
|
-
console.error(chalk_1.default.red(`Error: ${error}`));
|
|
20
|
-
process.exit(1);
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
const program = new commander_1.Command();
|
|
25
|
-
// get the version from the package.json
|
|
9
|
+
const commands_1 = require("./commands");
|
|
26
10
|
const version = require("../package.json").version;
|
|
27
|
-
program
|
|
11
|
+
const program = new extra_typings_1.Command()
|
|
28
12
|
.name("pushwork")
|
|
29
13
|
.description("Bidirectional directory synchronization using Automerge CRDTs")
|
|
30
|
-
.version(version);
|
|
14
|
+
.version(version, "-V, --version", "output the version number");
|
|
31
15
|
// Init command
|
|
32
16
|
program
|
|
33
17
|
.command("init")
|
|
34
|
-
.
|
|
35
|
-
.argument("
|
|
36
|
-
.option("--sync-server <url>", "Custom sync server URL
|
|
37
|
-
.
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
pushwork init ./my-folder --sync-server ws://localhost:3030 --sync-server-storage-id 1d89eba7-f7a4-4e8e-80f2-5f4e2406f507
|
|
42
|
-
|
|
43
|
-
Note: Custom sync server options must always be used together.`)
|
|
44
|
-
.action(withErrorHandling(async (path, options) => {
|
|
45
|
-
// Validate that both sync server options are provided together
|
|
46
|
-
const hasSyncServer = !!options.syncServer;
|
|
47
|
-
const hasSyncServerStorageId = !!options.syncServerStorageId;
|
|
48
|
-
if (hasSyncServer && !hasSyncServerStorageId) {
|
|
49
|
-
console.error(chalk_1.default.red("Error: --sync-server requires --sync-server-storage-id"));
|
|
50
|
-
console.error(chalk_1.default.yellow("Both arguments must be provided together."));
|
|
51
|
-
process.exit(1);
|
|
52
|
-
}
|
|
53
|
-
if (hasSyncServerStorageId && !hasSyncServer) {
|
|
54
|
-
console.error(chalk_1.default.red("Error: --sync-server-storage-id requires --sync-server"));
|
|
55
|
-
console.error(chalk_1.default.yellow("Both arguments must be provided together."));
|
|
56
|
-
process.exit(1);
|
|
57
|
-
}
|
|
58
|
-
await (0, commands_1.init)(path, options.syncServer, options.syncServerStorageId);
|
|
59
|
-
}));
|
|
18
|
+
.summary("Initialize sync in a directory")
|
|
19
|
+
.argument("[path]", "Directory path to initialize (default: current directory)", ".")
|
|
20
|
+
.option("--sync-server <url> <storage-id...>", "Custom sync server URL and storage ID")
|
|
21
|
+
.action(async (path, opts) => {
|
|
22
|
+
const [syncServer, syncServerStorageId] = validateSyncServer(opts.syncServer);
|
|
23
|
+
await (0, commands_1.init)(path, { syncServer, syncServerStorageId });
|
|
24
|
+
});
|
|
60
25
|
// Clone command
|
|
61
26
|
program
|
|
62
27
|
.command("clone")
|
|
63
|
-
.
|
|
64
|
-
.argument("<url>", "AutomergeUrl of root directory to clone")
|
|
28
|
+
.summary("Clone an existing synced directory")
|
|
29
|
+
.argument("<url>", "AutomergeUrl of root directory to clone (format: automerge:XXXXX)")
|
|
65
30
|
.argument("<path>", "Target directory path")
|
|
66
|
-
.option("--force", "Overwrite existing directory")
|
|
67
|
-
.option("--sync-server <url>", "Custom sync server URL
|
|
68
|
-
.option("
|
|
69
|
-
.
|
|
70
|
-
|
|
71
|
-
pushwork clone automerge:abc123 ./my-clone
|
|
72
|
-
pushwork clone automerge:abc123 ./my-clone --force
|
|
73
|
-
pushwork clone automerge:abc123 ./my-clone --sync-server ws://localhost:3030 --sync-server-storage-id 1d89eba7-f7a4-4e8e-80f2-5f4e2406f507
|
|
74
|
-
|
|
75
|
-
Note: Custom sync server options must always be used together.`)
|
|
76
|
-
.action(withErrorHandling(async (url, path, options) => {
|
|
77
|
-
// Validate that both sync server options are provided together
|
|
78
|
-
const hasSyncServer = !!options.syncServer;
|
|
79
|
-
const hasSyncServerStorageId = !!options.syncServerStorageId;
|
|
80
|
-
if (hasSyncServer && !hasSyncServerStorageId) {
|
|
81
|
-
console.error(chalk_1.default.red("Error: --sync-server requires --sync-server-storage-id"));
|
|
82
|
-
console.error(chalk_1.default.yellow("Both arguments must be provided together."));
|
|
83
|
-
process.exit(1);
|
|
84
|
-
}
|
|
85
|
-
if (hasSyncServerStorageId && !hasSyncServer) {
|
|
86
|
-
console.error(chalk_1.default.red("Error: --sync-server-storage-id requires --sync-server"));
|
|
87
|
-
console.error(chalk_1.default.yellow("Both arguments must be provided together."));
|
|
88
|
-
process.exit(1);
|
|
89
|
-
}
|
|
31
|
+
.option("-f, --force", "Overwrite existing directory", false)
|
|
32
|
+
.option("--sync-server <url> <storage-id...>", "Custom sync server URL and storage ID")
|
|
33
|
+
.option("-v, --verbose", "Verbose output", false)
|
|
34
|
+
.action(async (url, path, opts) => {
|
|
35
|
+
const [syncServer, syncServerStorageId] = validateSyncServer(opts.syncServer);
|
|
90
36
|
await (0, commands_1.clone)(url, path, {
|
|
91
|
-
force:
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
syncServerStorageId: options.syncServerStorageId,
|
|
37
|
+
force: opts.force,
|
|
38
|
+
verbose: opts.verbose,
|
|
39
|
+
syncServer,
|
|
40
|
+
syncServerStorageId,
|
|
96
41
|
});
|
|
97
|
-
})
|
|
42
|
+
});
|
|
98
43
|
// Commit command
|
|
99
44
|
program
|
|
100
45
|
.command("commit")
|
|
101
|
-
.
|
|
102
|
-
.argument("[path]", "Directory path to commit", ".")
|
|
103
|
-
.
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
}));
|
|
46
|
+
.summary("Save local changes to Automerge documents")
|
|
47
|
+
.argument("[path]", "Directory path to commit (default: current directory)", ".")
|
|
48
|
+
.action(async (path, _opts) => {
|
|
49
|
+
await (0, commands_1.commit)(path);
|
|
50
|
+
});
|
|
107
51
|
// Sync command
|
|
108
52
|
program
|
|
109
53
|
.command("sync")
|
|
110
|
-
.
|
|
111
|
-
.
|
|
112
|
-
.option("-
|
|
113
|
-
.
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
54
|
+
.summary("Run full bidirectional synchronization")
|
|
55
|
+
.argument("[path]", "Directory path to sync (default: current directory)", ".")
|
|
56
|
+
.option("--dry-run", "Show what would be done without applying changes", false)
|
|
57
|
+
.option("-v, --verbose", "Verbose output", false)
|
|
58
|
+
.action(async (path, opts) => {
|
|
59
|
+
await (0, commands_1.sync)(path, {
|
|
60
|
+
dryRun: opts.dryRun,
|
|
61
|
+
verbose: opts.verbose,
|
|
117
62
|
});
|
|
118
|
-
})
|
|
63
|
+
});
|
|
119
64
|
// Diff command
|
|
120
65
|
program
|
|
121
66
|
.command("diff")
|
|
122
|
-
.
|
|
123
|
-
.argument("[path]", "Limit diff to specific path", ".")
|
|
124
|
-
.option("--
|
|
125
|
-
.
|
|
126
|
-
.action(withErrorHandling(async (path, options) => {
|
|
67
|
+
.summary("Show changes in working directory")
|
|
68
|
+
.argument("[path]", "Limit diff to specific path (default: current directory)", ".")
|
|
69
|
+
.option("--name-only", "Show only changed file names", false)
|
|
70
|
+
.action(async (path, opts) => {
|
|
127
71
|
await (0, commands_1.diff)(path, {
|
|
128
|
-
|
|
129
|
-
nameOnly: options.nameOnly || false,
|
|
130
|
-
dryRun: false,
|
|
131
|
-
verbose: false,
|
|
72
|
+
nameOnly: opts.nameOnly,
|
|
132
73
|
});
|
|
133
|
-
})
|
|
74
|
+
});
|
|
134
75
|
// Status command
|
|
135
76
|
program
|
|
136
77
|
.command("status")
|
|
137
|
-
.
|
|
138
|
-
.
|
|
139
|
-
|
|
140
|
-
|
|
78
|
+
.summary("Show sync status summary")
|
|
79
|
+
.argument("[path]", "Directory path (default: current directory)", ".")
|
|
80
|
+
.option("-v, --verbose", "Show detailed status including document info and all tracked files", false)
|
|
81
|
+
.action(async (path, opts) => {
|
|
82
|
+
await (0, commands_1.status)(path, {
|
|
83
|
+
verbose: opts.verbose,
|
|
84
|
+
});
|
|
85
|
+
});
|
|
141
86
|
// Log command
|
|
142
87
|
program
|
|
143
88
|
.command("log")
|
|
144
|
-
.
|
|
145
|
-
.argument("[path]", "Show history for specific file or directory", ".")
|
|
146
|
-
.option("--oneline", "Compact one-line per sync format")
|
|
89
|
+
.summary("Show sync history (experimental)")
|
|
90
|
+
.argument("[path]", "Show history for specific file or directory (default: current directory)", ".")
|
|
91
|
+
.option("--oneline", "Compact one-line per sync format", false)
|
|
147
92
|
.option("--since <date>", "Show syncs since date")
|
|
148
93
|
.option("--limit <n>", "Limit number of syncs shown", "10")
|
|
149
|
-
.action(
|
|
94
|
+
.action(async (path, opts) => {
|
|
150
95
|
await (0, commands_1.log)(path, {
|
|
151
|
-
oneline:
|
|
152
|
-
since:
|
|
153
|
-
limit: parseInt(
|
|
154
|
-
dryRun: false,
|
|
155
|
-
verbose: false,
|
|
96
|
+
oneline: opts.oneline,
|
|
97
|
+
since: opts.since,
|
|
98
|
+
limit: parseInt(opts.limit),
|
|
156
99
|
});
|
|
157
|
-
})
|
|
100
|
+
});
|
|
158
101
|
// Checkout command
|
|
159
102
|
program
|
|
160
103
|
.command("checkout")
|
|
161
|
-
.
|
|
104
|
+
.summary("Restore to previous sync (experimental)")
|
|
162
105
|
.argument("<sync-id>", "Sync ID to restore to")
|
|
163
|
-
.argument("[path]", "Specific path to restore", ".")
|
|
164
|
-
.option("-f, --force", "Force checkout even if there are uncommitted changes")
|
|
165
|
-
.action(
|
|
106
|
+
.argument("[path]", "Specific path to restore (default: current directory)", ".")
|
|
107
|
+
.option("-f, --force", "Force checkout even if there are uncommitted changes", false)
|
|
108
|
+
.action(async (syncId, path, opts) => {
|
|
166
109
|
await (0, commands_1.checkout)(syncId, path, {
|
|
167
|
-
force:
|
|
168
|
-
dryRun: false,
|
|
169
|
-
verbose: false,
|
|
110
|
+
force: opts.force,
|
|
170
111
|
});
|
|
171
|
-
})
|
|
112
|
+
});
|
|
172
113
|
// URL command
|
|
173
114
|
program
|
|
174
115
|
.command("url")
|
|
175
|
-
.
|
|
176
|
-
.argument("[path]", "Directory path", ".")
|
|
177
|
-
.
|
|
178
|
-
Examples:
|
|
179
|
-
pushwork url # Show URL for current directory
|
|
180
|
-
pushwork url ./repo # Show URL for specific directory
|
|
181
|
-
|
|
182
|
-
Note: This command outputs only the URL, making it useful for scripts.`)
|
|
183
|
-
.action(withErrorHandling(async (path) => {
|
|
116
|
+
.summary("Show the Automerge root URL")
|
|
117
|
+
.argument("[path]", "Directory path (default: current directory)", ".")
|
|
118
|
+
.action(async (path) => {
|
|
184
119
|
await (0, commands_1.url)(path);
|
|
185
|
-
})
|
|
186
|
-
//
|
|
120
|
+
});
|
|
121
|
+
// Remove command
|
|
187
122
|
program
|
|
188
|
-
.command("
|
|
189
|
-
.
|
|
190
|
-
.argument("[path]", "Directory path", ".")
|
|
191
|
-
.
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
.action(
|
|
201
|
-
await (0, commands_1.
|
|
202
|
-
verbose:
|
|
123
|
+
.command("rm")
|
|
124
|
+
.summary("Remove local pushwork data")
|
|
125
|
+
.argument("[path]", "Directory path (default: current directory)", ".")
|
|
126
|
+
.action(async (path) => {
|
|
127
|
+
await (0, commands_1.rm)(path);
|
|
128
|
+
});
|
|
129
|
+
// List command
|
|
130
|
+
program
|
|
131
|
+
.command("ls")
|
|
132
|
+
.summary("List tracked files")
|
|
133
|
+
.argument("[path]", "Directory path (default: current directory)", ".")
|
|
134
|
+
.option("-v, --verbose", "Show with Automerge URLs", false)
|
|
135
|
+
.action(async (path, opts) => {
|
|
136
|
+
await (0, commands_1.ls)(path, {
|
|
137
|
+
verbose: opts.verbose,
|
|
138
|
+
});
|
|
139
|
+
});
|
|
140
|
+
// Config command
|
|
141
|
+
program
|
|
142
|
+
.command("config")
|
|
143
|
+
.summary("View or edit configuration")
|
|
144
|
+
.argument("[path]", "Directory path (default: current directory)", ".")
|
|
145
|
+
.option("--list", "Show full configuration", false)
|
|
146
|
+
.option("--get <key>", "Get specific config value (dot notation, e.g., sync.move_detection_threshold)")
|
|
147
|
+
.action(async (path, opts) => {
|
|
148
|
+
await (0, commands_1.config)(path, {
|
|
149
|
+
list: opts.list,
|
|
150
|
+
get: opts.get,
|
|
151
|
+
});
|
|
152
|
+
});
|
|
153
|
+
// Watch command
|
|
154
|
+
program
|
|
155
|
+
.command("watch")
|
|
156
|
+
.summary("Watch directory for changes, build, and sync")
|
|
157
|
+
.argument("[path]", "Directory path to sync (default: current directory)", ".")
|
|
158
|
+
.option("--script <command>", "Build script to run before syncing", "pnpm build")
|
|
159
|
+
.option("--dir <dir>", "Directory to watch for changes (relative to working directory)", "src")
|
|
160
|
+
.option("-v, --verbose", "Show build script output", false)
|
|
161
|
+
.action(async (path, opts) => {
|
|
162
|
+
await (0, commands_1.watch)(path, {
|
|
163
|
+
script: opts.script,
|
|
164
|
+
watchDir: opts.dir,
|
|
165
|
+
verbose: opts.verbose,
|
|
203
166
|
});
|
|
204
|
-
}));
|
|
205
|
-
// Global error handler
|
|
206
|
-
process.on("unhandledRejection", (reason, promise) => {
|
|
207
|
-
console.error(chalk_1.default.red("Unhandled Rejection at:"), promise, chalk_1.default.red("reason:"), reason);
|
|
208
|
-
process.exit(1);
|
|
209
167
|
});
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
168
|
+
// Completion command (hidden from help)
|
|
169
|
+
program.command("completion", { hidden: true }).action(() => {
|
|
170
|
+
// Generate completion dynamically from registered commands
|
|
171
|
+
const commands = program.commands
|
|
172
|
+
.filter((cmd) => cmd.name() !== "completion") // Exclude self
|
|
173
|
+
.map((cmd) => {
|
|
174
|
+
const name = cmd.name();
|
|
175
|
+
const desc = (cmd.summary() || cmd.description() || "").replace(/'/g, "\\'");
|
|
176
|
+
return `'${name}:${desc}'`;
|
|
177
|
+
})
|
|
178
|
+
.join(" ");
|
|
179
|
+
// Generate option completions for each command
|
|
180
|
+
const commandCases = program.commands
|
|
181
|
+
.filter((cmd) => cmd.name() !== "completion")
|
|
182
|
+
.map((cmd) => {
|
|
183
|
+
const options = cmd.options
|
|
184
|
+
.filter((opt) => opt.flags !== "-h, --help") // Exclude help
|
|
185
|
+
.map((opt) => {
|
|
186
|
+
// Parse flags like "-v, --verbose" or "--dry-run"
|
|
187
|
+
const flags = opt.flags.split(",").map((f) => f.trim());
|
|
188
|
+
const desc = (opt.description || "")
|
|
189
|
+
.replace(/'/g, "\\'")
|
|
190
|
+
.replace(/\n/g, " ");
|
|
191
|
+
// For options with arguments like "--sync-server <url>"
|
|
192
|
+
// Extract just the flag part
|
|
193
|
+
const cleanFlags = flags.map((f) => f.split(/\s+/)[0]);
|
|
194
|
+
if (cleanFlags.length > 1) {
|
|
195
|
+
// Multiple flags (short and long): '(-v --verbose)'{-v,--verbose}'[description]'
|
|
196
|
+
const short = cleanFlags[0];
|
|
197
|
+
const long = cleanFlags[1];
|
|
198
|
+
return `'(${short} ${long})'{${short},${long}}'[${desc}]'`;
|
|
199
|
+
}
|
|
200
|
+
else {
|
|
201
|
+
// Single flag: '--flag[description]'
|
|
202
|
+
return `'${cleanFlags[0]}[${desc}]'`;
|
|
203
|
+
}
|
|
204
|
+
})
|
|
205
|
+
.join(" \\\n ");
|
|
206
|
+
return options
|
|
207
|
+
? ` ${cmd.name()})
|
|
208
|
+
_arguments \\
|
|
209
|
+
${options}
|
|
210
|
+
;;`
|
|
211
|
+
: "";
|
|
212
|
+
})
|
|
213
|
+
.filter(Boolean)
|
|
214
|
+
.join("\n");
|
|
215
|
+
const completionScript = `
|
|
216
|
+
# pushwork completion for zsh
|
|
217
|
+
_pushwork() {
|
|
218
|
+
local -a commands
|
|
219
|
+
commands=(${commands})
|
|
220
|
+
|
|
221
|
+
_arguments -C \\
|
|
222
|
+
'1: :->command' \\
|
|
223
|
+
'*::arg:->args'
|
|
224
|
+
|
|
225
|
+
case $state in
|
|
226
|
+
command)
|
|
227
|
+
_describe 'command' commands
|
|
228
|
+
;;
|
|
229
|
+
args)
|
|
230
|
+
case $words[1] in
|
|
231
|
+
${commandCases}
|
|
232
|
+
esac
|
|
233
|
+
;;
|
|
234
|
+
esac
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
compdef _pushwork pushwork
|
|
238
|
+
`.trim();
|
|
239
|
+
console.log(completionScript);
|
|
240
|
+
});
|
|
241
|
+
// Helper to validate and extract sync server options
|
|
242
|
+
function validateSyncServer(syncServerOpt) {
|
|
243
|
+
if (!syncServerOpt) {
|
|
244
|
+
return [undefined, undefined];
|
|
245
|
+
}
|
|
246
|
+
if (syncServerOpt.length < 2) {
|
|
247
|
+
console.error(chalk_1.default.red("Error: --sync-server requires both URL and storage ID"));
|
|
248
|
+
process.exit(1);
|
|
249
|
+
}
|
|
250
|
+
const [syncServer, syncServerStorageId] = syncServerOpt;
|
|
251
|
+
return [syncServer, syncServerStorageId];
|
|
252
|
+
}
|
|
253
|
+
process.on("unhandledRejection", (error) => {
|
|
254
|
+
console.log(chalk_1.default.bgRed.white(" ERROR "));
|
|
255
|
+
if (error instanceof Error && error.stack) {
|
|
256
|
+
console.log(chalk_1.default.red(error.stack));
|
|
257
|
+
}
|
|
258
|
+
else {
|
|
259
|
+
console.error(chalk_1.default.red(error));
|
|
218
260
|
}
|
|
219
|
-
console.error(chalk_1.default.red("Uncaught Exception:"), error);
|
|
220
261
|
process.exit(1);
|
|
221
262
|
});
|
|
222
|
-
//
|
|
223
|
-
program
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
263
|
+
// Configure help colors using Commander v13's built-in color support
|
|
264
|
+
program
|
|
265
|
+
.configureHelp({
|
|
266
|
+
styleTitle: (str) => chalk_1.default.bold(str),
|
|
267
|
+
styleCommandText: (str) => chalk_1.default.white(str),
|
|
268
|
+
styleCommandDescription: (str) => chalk_1.default.dim(str),
|
|
269
|
+
styleOptionText: (str) => chalk_1.default.green(str),
|
|
270
|
+
styleArgumentText: (str) => chalk_1.default.cyan(str),
|
|
271
|
+
subcommandTerm: (cmd) => {
|
|
272
|
+
const opts = cmd.options
|
|
273
|
+
.filter((opt) => opt.flags !== "-h, --help")
|
|
274
|
+
.map((opt) => opt.short || opt.long)
|
|
275
|
+
.join(", ");
|
|
276
|
+
const name = chalk_1.default.white(cmd.name());
|
|
277
|
+
const args = cmd.registeredArguments
|
|
278
|
+
.map((arg) => arg.required
|
|
279
|
+
? chalk_1.default.cyan(`<${arg.name()}>`)
|
|
280
|
+
: chalk_1.default.dim(`[${arg.name()}]`))
|
|
281
|
+
.join(" ");
|
|
282
|
+
return [name, args, opts && chalk_1.default.dim(`[${opts}]`)]
|
|
283
|
+
.filter(Boolean)
|
|
284
|
+
.join(" ");
|
|
285
|
+
},
|
|
286
|
+
})
|
|
287
|
+
.addHelpText("after", chalk_1.default.dim('\nEnable tab completion by adding this to your ~/.zshrc:\neval "$(pushwork completion)"'));
|
|
288
|
+
program.parseAsync();
|
|
228
289
|
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;;;;;AAGA,+DAAsD;AACtD,kDAA0B;AAC1B,yCAcoB;AAEpB,MAAM,OAAO,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC,OAAO,CAAC;AACnD,MAAM,OAAO,GAAG,IAAI,uBAAO,EAAE;KAC1B,IAAI,CAAC,UAAU,CAAC;KAChB,WAAW,CAAC,+DAA+D,CAAC;KAC5E,OAAO,CAAC,OAAO,EAAE,eAAe,EAAE,2BAA2B,CAAC,CAAC;AAElE,eAAe;AACf,OAAO;KACJ,OAAO,CAAC,MAAM,CAAC;KACf,OAAO,CAAC,gCAAgC,CAAC;KACzC,QAAQ,CACP,QAAQ,EACR,2DAA2D,EAC3D,GAAG,CACJ;KACA,MAAM,CACL,qCAAqC,EACrC,uCAAuC,CACxC;KACA,MAAM,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE;IAC3B,MAAM,CAAC,UAAU,EAAE,mBAAmB,CAAC,GAAG,kBAAkB,CAC1D,IAAI,CAAC,UAAU,CAChB,CAAC;IACF,MAAM,IAAA,eAAI,EAAC,IAAI,EAAE,EAAE,UAAU,EAAE,mBAAmB,EAAE,CAAC,CAAC;AACxD,CAAC,CAAC,CAAC;AAEL,gBAAgB;AAChB,OAAO;KACJ,OAAO,CAAC,OAAO,CAAC;KAChB,OAAO,CAAC,oCAAoC,CAAC;KAC7C,QAAQ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}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { CloneOptions, SyncOptions, DiffOptions, LogOptions, CheckoutOptions, InitOptions, ConfigOptions, StatusOptions, WatchOptions, CommandOptions } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* Initialize sync in a directory
|
|
4
|
+
*/
|
|
5
|
+
export declare function init(targetPath: string, options?: InitOptions): Promise<void>;
|
|
6
|
+
/**
|
|
7
|
+
* Run bidirectional sync
|
|
8
|
+
*/
|
|
9
|
+
export declare function sync(targetPath: string | undefined, options: SyncOptions): Promise<void>;
|
|
10
|
+
/**
|
|
11
|
+
* Show differences between local and remote
|
|
12
|
+
*/
|
|
13
|
+
export declare function diff(targetPath: string | undefined, options: DiffOptions): Promise<void>;
|
|
14
|
+
/**
|
|
15
|
+
* Show sync status
|
|
16
|
+
*/
|
|
17
|
+
export declare function status(targetPath?: string, options?: StatusOptions): Promise<void>;
|
|
18
|
+
/**
|
|
19
|
+
* Show sync history
|
|
20
|
+
*/
|
|
21
|
+
export declare function log(targetPath: string | undefined, _options: LogOptions): Promise<void>;
|
|
22
|
+
/**
|
|
23
|
+
* Checkout/restore from previous sync
|
|
24
|
+
*/
|
|
25
|
+
export declare function checkout(syncId: string, targetPath: string | undefined, _options: CheckoutOptions): Promise<void>;
|
|
26
|
+
/**
|
|
27
|
+
* Clone an existing synced directory from an AutomergeUrl
|
|
28
|
+
*/
|
|
29
|
+
export declare function clone(rootUrl: string, targetPath: string, options: CloneOptions): Promise<void>;
|
|
30
|
+
/**
|
|
31
|
+
* Get the root URL for the current pushwork repository
|
|
32
|
+
*/
|
|
33
|
+
export declare function url(targetPath?: string): Promise<void>;
|
|
34
|
+
/**
|
|
35
|
+
* Remove local pushwork data and log URL for recovery
|
|
36
|
+
*/
|
|
37
|
+
export declare function rm(targetPath?: string): Promise<void>;
|
|
38
|
+
export declare function commit(targetPath: string, _options?: CommandOptions): Promise<void>;
|
|
39
|
+
/**
|
|
40
|
+
* List tracked files
|
|
41
|
+
*/
|
|
42
|
+
export declare function ls(targetPath?: string, options?: CommandOptions): Promise<void>;
|
|
43
|
+
/**
|
|
44
|
+
* View or edit configuration
|
|
45
|
+
*/
|
|
46
|
+
export declare function config(targetPath?: string, options?: ConfigOptions): Promise<void>;
|
|
47
|
+
/**
|
|
48
|
+
* Watch a directory and sync after build script completes
|
|
49
|
+
*/
|
|
50
|
+
export declare function watch(targetPath?: string, options?: WatchOptions): Promise<void>;
|
|
51
|
+
//# sourceMappingURL=commands.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../src/commands.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,YAAY,EACZ,WAAW,EACX,WAAW,EACX,UAAU,EACV,eAAe,EACf,WAAW,EACX,aAAa,EACb,aAAa,EACb,YAAY,EAGZ,cAAc,EACf,MAAM,SAAS,CAAC;AAwHjB;;GAEG;AACH,wBAAsB,IAAI,CACxB,UAAU,EAAE,MAAM,EAClB,OAAO,GAAE,WAAgB,GACxB,OAAO,CAAC,IAAI,CAAC,CA2Df;AAED;;GAEG;AACH,wBAAsB,IAAI,CACxB,UAAU,oBAAM,EAChB,OAAO,EAAE,WAAW,GACnB,OAAO,CAAC,IAAI,CAAC,CAiGf;AAED;;GAEG;AACH,wBAAsB,IAAI,CACxB,UAAU,oBAAM,EAChB,OAAO,EAAE,WAAW,GACnB,OAAO,CAAC,IAAI,CAAC,CAgGf;AAED;;GAEG;AACH,wBAAsB,MAAM,CAC1B,UAAU,GAAE,MAAY,EACxB,OAAO,GAAE,aAAkB,GAC1B,OAAO,CAAC,IAAI,CAAC,CAyEf;AAED;;GAEG;AACH,wBAAsB,GAAG,CACvB,UAAU,oBAAM,EAChB,QAAQ,EAAE,UAAU,GACnB,OAAO,CAAC,IAAI,CAAC,CAqBf;AAED;;GAEG;AACH,wBAAsB,QAAQ,CAC5B,MAAM,EAAE,MAAM,EACd,UAAU,oBAAM,EAChB,QAAQ,EAAE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