@any-sync/cli 0.2.5 → 0.2.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/lib/config.js CHANGED
@@ -35,7 +35,7 @@ function findConfig() {
35
35
  * Expand ~ to home directory in a path.
36
36
  */
37
37
  function expandTilde(p) {
38
- if (p.startsWith('~/') || p === '~') {
38
+ if (p === '~' || p.startsWith('~/') || p.startsWith('~' + path.sep)) {
39
39
  return path.join(os.homedir(), p.slice(1));
40
40
  }
41
41
  return p;
package/lib/onboard.js CHANGED
@@ -13,8 +13,9 @@ const { pull } = require('./pull');
13
13
  // ── Helpers ──────────────────────────────────────────────────────────────────
14
14
 
15
15
  function isToolInstalled(name) {
16
+ const cmd = process.platform === 'win32' ? 'where' : 'which';
16
17
  try {
17
- execFileSync('which', [name], { stdio: 'pipe' });
18
+ execFileSync(cmd, [name], { stdio: 'pipe' });
18
19
  return true;
19
20
  } catch {
20
21
  return false;
@@ -266,18 +267,54 @@ async function _runWizard({ rl, output, configPath, branch, doPull, opts }) {
266
267
  write(output, '\nNext steps:\n');
267
268
 
268
269
  if (presets.includes('claude')) {
269
- const instructions =
270
- 'Run these commands inside Claude Code:\n' +
271
- ' /plugin marketplace add imink/any-sync\n' +
272
- ' /plugin install any-sync@any-sync-marketplace';
273
- write(output, `\n Claude Code plugin:\n ${instructions.split('\n').join('\n ')}\n`);
274
- result.pluginInstructions.push({ tool: 'claude', instructions });
270
+ if (tools.claude) {
271
+ write(output, '\n Installing Claude Code plugin...\n');
272
+ try {
273
+ execFileSync('claude', ['plugin', 'marketplace', 'add', 'imink/any-sync'], {
274
+ stdio: 'pipe',
275
+ encoding: 'utf8',
276
+ });
277
+ execFileSync('claude', ['plugin', 'install', 'any-sync@any-sync-marketplace'], {
278
+ stdio: 'pipe',
279
+ encoding: 'utf8',
280
+ });
281
+ write(output, ' Any Sync plugin installed successfully.\n');
282
+ result.pluginInstructions.push({ tool: 'claude', installed: true });
283
+ } catch (err) {
284
+ write(output, ` Install failed: ${err.message}\n`);
285
+ write(output, ' Install manually inside Claude Code:\n');
286
+ write(output, ' /plugin marketplace add imink/any-sync\n');
287
+ write(output, ' /plugin install any-sync@any-sync-marketplace\n');
288
+ result.pluginInstructions.push({ tool: 'claude', installed: false });
289
+ }
290
+ } else {
291
+ write(output, '\n Claude Code not found. Install the plugin manually inside Claude Code:\n');
292
+ write(output, ' /plugin marketplace add imink/any-sync\n');
293
+ write(output, ' /plugin install any-sync@any-sync-marketplace\n');
294
+ result.pluginInstructions.push({ tool: 'claude', installed: false });
295
+ }
275
296
  }
276
297
 
277
298
  if (presets.includes('openclaw')) {
278
- const instructions = 'Run: openclaw plugins install any-sync';
279
- write(output, `\n OpenClaw plugin:\n ${instructions}\n`);
280
- result.pluginInstructions.push({ tool: 'openclaw', instructions });
299
+ if (tools.openclaw) {
300
+ write(output, '\n Installing OpenClaw plugin...\n');
301
+ try {
302
+ execFileSync('openclaw', ['plugins', 'install', 'any-sync'], {
303
+ stdio: 'pipe',
304
+ encoding: 'utf8',
305
+ });
306
+ write(output, ' Any Sync plugin installed successfully.\n');
307
+ result.pluginInstructions.push({ tool: 'openclaw', installed: true });
308
+ } catch (err) {
309
+ write(output, ` Install failed: ${err.message}\n`);
310
+ write(output, ' Install manually: openclaw plugins install any-sync\n');
311
+ result.pluginInstructions.push({ tool: 'openclaw', installed: false });
312
+ }
313
+ } else {
314
+ write(output, '\n OpenClaw not found. Install the plugin manually:\n');
315
+ write(output, ' openclaw plugins install any-sync\n');
316
+ result.pluginInstructions.push({ tool: 'openclaw', installed: false });
317
+ }
281
318
  }
282
319
 
283
320
  if (installVscode) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@any-sync/cli",
3
- "version": "0.2.5",
3
+ "version": "0.2.7",
4
4
  "description": "CLI and core library for Any Sync — bidirectional GitHub file sync",
5
5
  "main": "lib/index.js",
6
6
  "exports": {