@claude-sync/cli 0.1.10 → 0.1.12
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/bin/claude-sync.js +60 -6
- package/dist/bin/claude-sync.js.map +1 -1
- package/dist/src/index.js +60 -6
- package/dist/src/index.js.map +1 -1
- package/package.json +1 -1
package/dist/src/index.js
CHANGED
|
@@ -4345,7 +4345,7 @@ var require_validation = __commonJS({
|
|
|
4345
4345
|
"use strict";
|
|
4346
4346
|
init_esm_shims();
|
|
4347
4347
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4348
|
-
exports.updateProfileSchema = exports.oauthExchangeSchema = exports.refreshTokenSchema = exports.syncCompleteSchema = exports.downloadUrlSchema = exports.uploadUrlSchema = exports.pullRequestSchema = exports.pushManifestSchema = exports.updateDeviceSchema = exports.createDeviceSchema = exports.registerSchema = exports.loginSchema = void 0;
|
|
4348
|
+
exports.createFeatureRequestCommentSchema = exports.updateFeatureRequestStatusSchema = exports.updateFeatureRequestSchema = exports.createFeatureRequestSchema = exports.featureRequestStatusSchema = exports.featureRequestTypeSchema = exports.updateProfileSchema = exports.oauthExchangeSchema = exports.refreshTokenSchema = exports.syncCompleteSchema = exports.downloadUrlSchema = exports.uploadUrlSchema = exports.pullRequestSchema = exports.pushManifestSchema = exports.updateDeviceSchema = exports.createDeviceSchema = exports.registerSchema = exports.loginSchema = void 0;
|
|
4349
4349
|
var zod_1 = require_zod();
|
|
4350
4350
|
exports.loginSchema = zod_1.z.object({
|
|
4351
4351
|
email: zod_1.z.string().email(),
|
|
@@ -4415,6 +4415,23 @@ var require_validation = __commonJS({
|
|
|
4415
4415
|
name: zod_1.z.string().min(1).max(100).optional(),
|
|
4416
4416
|
avatarUrl: zod_1.z.string().url().nullable().optional()
|
|
4417
4417
|
});
|
|
4418
|
+
exports.featureRequestTypeSchema = zod_1.z.enum(["bug", "feature", "help"]);
|
|
4419
|
+
exports.featureRequestStatusSchema = zod_1.z.enum(["open", "in_progress", "resolved", "closed"]);
|
|
4420
|
+
exports.createFeatureRequestSchema = zod_1.z.object({
|
|
4421
|
+
title: zod_1.z.string().min(5).max(200),
|
|
4422
|
+
body: zod_1.z.string().min(10).max(5e3),
|
|
4423
|
+
type: exports.featureRequestTypeSchema
|
|
4424
|
+
});
|
|
4425
|
+
exports.updateFeatureRequestSchema = zod_1.z.object({
|
|
4426
|
+
title: zod_1.z.string().min(5).max(200).optional(),
|
|
4427
|
+
body: zod_1.z.string().min(10).max(5e3).optional()
|
|
4428
|
+
});
|
|
4429
|
+
exports.updateFeatureRequestStatusSchema = zod_1.z.object({
|
|
4430
|
+
status: exports.featureRequestStatusSchema
|
|
4431
|
+
});
|
|
4432
|
+
exports.createFeatureRequestCommentSchema = zod_1.z.object({
|
|
4433
|
+
body: zod_1.z.string().min(1).max(2e3)
|
|
4434
|
+
});
|
|
4418
4435
|
}
|
|
4419
4436
|
});
|
|
4420
4437
|
|
|
@@ -5148,7 +5165,7 @@ __export(sync_exports, {
|
|
|
5148
5165
|
});
|
|
5149
5166
|
import { Command as Command4 } from "commander";
|
|
5150
5167
|
import { select as select2, isCancel as isCancel3 } from "@clack/prompts";
|
|
5151
|
-
import { readFile as readFile2, writeFile as writeFile2, mkdir as mkdir2, lstat as lstat2, symlink, unlink } from "fs/promises";
|
|
5168
|
+
import { readFile as readFile2, writeFile as writeFile2, mkdir as mkdir2, lstat as lstat2, symlink, unlink, rename } from "fs/promises";
|
|
5152
5169
|
import { join as join3, dirname as dirname2 } from "path";
|
|
5153
5170
|
import { homedir as homedir4 } from "os";
|
|
5154
5171
|
async function runSync(options) {
|
|
@@ -5312,6 +5329,10 @@ async function handleFirstRun(client, config, cwd, ctx, manifest, projectDir, pr
|
|
|
5312
5329
|
});
|
|
5313
5330
|
if (isCancel3(projectChoice)) return "cancelled";
|
|
5314
5331
|
const selectedProject = projects.find((p) => p.id === projectChoice);
|
|
5332
|
+
const existingCheck = await handleExistingSessionDir(projectsDir, ctx.encodedPath);
|
|
5333
|
+
if (existingCheck === "cancelled") {
|
|
5334
|
+
return "cancelled";
|
|
5335
|
+
}
|
|
5315
5336
|
const downloaded = await crossMachinePull(
|
|
5316
5337
|
client,
|
|
5317
5338
|
config.deviceId,
|
|
@@ -5338,6 +5359,43 @@ async function handleFirstRun(client, config, cwd, ctx, manifest, projectDir, pr
|
|
|
5338
5359
|
}
|
|
5339
5360
|
return "pulled";
|
|
5340
5361
|
}
|
|
5362
|
+
async function handleExistingSessionDir(projectsDir, localEncoded) {
|
|
5363
|
+
const symlinkPath = join3(projectsDir, localEncoded);
|
|
5364
|
+
try {
|
|
5365
|
+
const stats = await lstat2(symlinkPath);
|
|
5366
|
+
if (stats.isSymbolicLink()) {
|
|
5367
|
+
return "continue";
|
|
5368
|
+
}
|
|
5369
|
+
if (stats.isDirectory()) {
|
|
5370
|
+
printInfo(brand("Local session directory already exists"));
|
|
5371
|
+
printInfo(dim(symlinkPath));
|
|
5372
|
+
const choice = await select2({
|
|
5373
|
+
message: brand("What would you like to do?"),
|
|
5374
|
+
options: [
|
|
5375
|
+
{
|
|
5376
|
+
value: "backup",
|
|
5377
|
+
label: "Backup and continue",
|
|
5378
|
+
hint: dim("Move existing to .bak and sync from remote")
|
|
5379
|
+
},
|
|
5380
|
+
{
|
|
5381
|
+
value: "cancel",
|
|
5382
|
+
label: "Stop sync",
|
|
5383
|
+
hint: dim("Keep existing local sessions")
|
|
5384
|
+
}
|
|
5385
|
+
]
|
|
5386
|
+
});
|
|
5387
|
+
if (isCancel3(choice) || choice === "cancel") {
|
|
5388
|
+
return "cancelled";
|
|
5389
|
+
}
|
|
5390
|
+
const backupPath = `${symlinkPath}.bak.${Date.now()}`;
|
|
5391
|
+
await rename(symlinkPath, backupPath);
|
|
5392
|
+
printSuccess(`Backed up to: ${dim(backupPath)}`);
|
|
5393
|
+
return "continue";
|
|
5394
|
+
}
|
|
5395
|
+
} catch {
|
|
5396
|
+
}
|
|
5397
|
+
return "continue";
|
|
5398
|
+
}
|
|
5341
5399
|
async function createProjectSymlink(projectsDir, localEncoded, foreignEncoded) {
|
|
5342
5400
|
const symlinkPath = join3(projectsDir, localEncoded);
|
|
5343
5401
|
await mkdir2(projectsDir, { recursive: true });
|
|
@@ -5345,10 +5403,6 @@ async function createProjectSymlink(projectsDir, localEncoded, foreignEncoded) {
|
|
|
5345
5403
|
const stats = await lstat2(symlinkPath);
|
|
5346
5404
|
if (stats.isSymbolicLink()) {
|
|
5347
5405
|
await unlink(symlinkPath);
|
|
5348
|
-
} else if (stats.isDirectory()) {
|
|
5349
|
-
printError(`Local session directory already exists. Back it up first:
|
|
5350
|
-
mv "${symlinkPath}" "${symlinkPath}.bak"`);
|
|
5351
|
-
return;
|
|
5352
5406
|
}
|
|
5353
5407
|
} catch {
|
|
5354
5408
|
}
|