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