opencode-sync-plugin 0.2.0 → 0.2.2
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/cli.js +40 -13
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -8,7 +8,20 @@ import {
|
|
|
8
8
|
// src/cli.ts
|
|
9
9
|
import { readFileSync, existsSync } from "fs";
|
|
10
10
|
import { homedir } from "os";
|
|
11
|
-
import { join } from "path";
|
|
11
|
+
import { join, dirname } from "path";
|
|
12
|
+
import { createInterface } from "readline";
|
|
13
|
+
import { fileURLToPath } from "url";
|
|
14
|
+
function getVersion() {
|
|
15
|
+
try {
|
|
16
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
17
|
+
const __dirname = dirname(__filename);
|
|
18
|
+
const pkgPath = join(__dirname, "..", "package.json");
|
|
19
|
+
const pkg = JSON.parse(readFileSync(pkgPath, "utf8"));
|
|
20
|
+
return pkg.version || "unknown";
|
|
21
|
+
} catch {
|
|
22
|
+
return "unknown";
|
|
23
|
+
}
|
|
24
|
+
}
|
|
12
25
|
var args = process.argv.slice(2);
|
|
13
26
|
var command = args[0];
|
|
14
27
|
async function main() {
|
|
@@ -28,6 +41,16 @@ async function main() {
|
|
|
28
41
|
case "config":
|
|
29
42
|
showConfig();
|
|
30
43
|
break;
|
|
44
|
+
case "version":
|
|
45
|
+
case "-v":
|
|
46
|
+
case "--version":
|
|
47
|
+
console.log(`opencode-sync-plugin v${getVersion()}`);
|
|
48
|
+
break;
|
|
49
|
+
case "help":
|
|
50
|
+
case "-h":
|
|
51
|
+
case "--help":
|
|
52
|
+
help();
|
|
53
|
+
break;
|
|
31
54
|
default:
|
|
32
55
|
help();
|
|
33
56
|
}
|
|
@@ -177,17 +200,20 @@ function showConfig() {
|
|
|
177
200
|
console.log();
|
|
178
201
|
}
|
|
179
202
|
function help() {
|
|
203
|
+
const version = getVersion();
|
|
180
204
|
console.log(`
|
|
181
|
-
OpenSync CLI
|
|
205
|
+
OpenSync CLI v${version}
|
|
182
206
|
|
|
183
207
|
Usage: opencode-sync <command>
|
|
184
208
|
|
|
185
209
|
Commands:
|
|
186
|
-
login
|
|
187
|
-
verify
|
|
188
|
-
logout
|
|
189
|
-
status
|
|
190
|
-
config
|
|
210
|
+
login Configure with Convex URL and API Key
|
|
211
|
+
verify Verify credentials and OpenCode config
|
|
212
|
+
logout Clear stored credentials
|
|
213
|
+
status Show current authentication status
|
|
214
|
+
config Show current configuration
|
|
215
|
+
version Show version number
|
|
216
|
+
help Show this help message
|
|
191
217
|
|
|
192
218
|
Setup:
|
|
193
219
|
1. Go to your OpenSync dashboard Settings page
|
|
@@ -200,12 +226,13 @@ function help() {
|
|
|
200
226
|
}
|
|
201
227
|
function prompt(question) {
|
|
202
228
|
return new Promise((resolve) => {
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
229
|
+
const rl = createInterface({
|
|
230
|
+
input: process.stdin,
|
|
231
|
+
output: process.stdout
|
|
232
|
+
});
|
|
233
|
+
rl.question(question, (answer) => {
|
|
234
|
+
rl.close();
|
|
235
|
+
resolve(answer.trim());
|
|
209
236
|
});
|
|
210
237
|
});
|
|
211
238
|
}
|