codecane 1.0.149 → 1.0.152
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 +1 -1
- package/dist/chat-storage.js +3 -1
- package/dist/chat-storage.js.map +1 -1
- package/dist/cli.d.ts +2 -1
- package/dist/cli.js +49 -9
- package/dist/cli.js.map +1 -1
- package/dist/client.d.ts +3 -1
- package/dist/client.js +38 -20
- package/dist/client.js.map +1 -1
- package/dist/common/actions.d.ts +13 -3
- package/dist/common/browser-actions.d.ts +4386 -0
- package/dist/common/browser-actions.js +327 -0
- package/dist/common/browser-actions.js.map +1 -0
- package/dist/common/constants.d.ts +3 -1
- package/dist/common/constants.js +4 -3
- package/dist/common/constants.js.map +1 -1
- package/dist/common/logger.d.ts +1 -0
- package/dist/common/logger.js +7 -0
- package/dist/common/logger.js.map +1 -0
- package/dist/common/util/constants.d.ts +1 -0
- package/dist/common/util/constants.js +7 -0
- package/dist/common/util/constants.js.map +1 -0
- package/dist/common/util/file.d.ts +3 -0
- package/dist/common/util/file.js +1 -0
- package/dist/common/util/file.js.map +1 -1
- package/dist/common/util/messages.d.ts +1 -0
- package/dist/common/util/messages.js +7 -0
- package/dist/common/util/messages.js.map +1 -0
- package/dist/common/websockets/websocket-schema.d.ts +38 -10
- package/dist/create-template-project.d.ts +1 -0
- package/dist/create-template-project.js +117 -0
- package/dist/create-template-project.js.map +1 -0
- package/dist/index.js +53 -20
- package/dist/index.js.map +1 -1
- package/dist/menu.d.ts +2 -0
- package/dist/menu.js +22 -1
- package/dist/menu.js.map +1 -1
- package/dist/project-files.d.ts +2 -0
- package/dist/project-files.js +37 -2
- package/dist/project-files.js.map +1 -1
- package/dist/utils/terminal.d.ts +3 -1
- package/dist/utils/terminal.js +182 -139
- package/dist/utils/terminal.js.map +1 -1
- package/package.json +1 -1
- package/dist/__tests__/tool-handlers.test.d.ts +0 -1
- package/dist/__tests__/tool-handlers.test.js +0 -33
- package/dist/__tests__/tool-handlers.test.js.map +0 -1
|
@@ -189,6 +189,7 @@ export declare const CLIENT_MESSAGE_SCHEMAS: {
|
|
|
189
189
|
fileTree: z.ZodArray<z.ZodType<import("../util/file").FileTreeNode, z.ZodTypeDef, import("../util/file").FileTreeNode>, "many">;
|
|
190
190
|
fileTokenScores: z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodNumber>>;
|
|
191
191
|
knowledgeFiles: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
192
|
+
userKnowledgeFiles: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
192
193
|
gitChanges: z.ZodObject<{
|
|
193
194
|
status: z.ZodString;
|
|
194
195
|
diff: z.ZodString;
|
|
@@ -264,6 +265,7 @@ export declare const CLIENT_MESSAGE_SCHEMAS: {
|
|
|
264
265
|
path: string;
|
|
265
266
|
content: string;
|
|
266
267
|
}[][];
|
|
268
|
+
userKnowledgeFiles?: Record<string, string> | undefined;
|
|
267
269
|
}, {
|
|
268
270
|
currentWorkingDirectory: string;
|
|
269
271
|
fileTree: import("../util/file").FileTreeNode[];
|
|
@@ -289,6 +291,7 @@ export declare const CLIENT_MESSAGE_SCHEMAS: {
|
|
|
289
291
|
path: string;
|
|
290
292
|
content: string;
|
|
291
293
|
}[][];
|
|
294
|
+
userKnowledgeFiles?: Record<string, string> | undefined;
|
|
292
295
|
}>;
|
|
293
296
|
changesAlreadyApplied: z.ZodArray<z.ZodObject<{
|
|
294
297
|
type: z.ZodEnum<["patch", "file"]>;
|
|
@@ -303,7 +306,7 @@ export declare const CLIENT_MESSAGE_SCHEMAS: {
|
|
|
303
306
|
content: string;
|
|
304
307
|
filePath: string;
|
|
305
308
|
}>, "many">;
|
|
306
|
-
costMode: z.ZodDefault<z.ZodOptional<z.ZodEnum<["lite", "normal", "
|
|
309
|
+
costMode: z.ZodDefault<z.ZodOptional<z.ZodEnum<["lite", "normal", "max"]>>>;
|
|
307
310
|
}, "strip", z.ZodTypeAny, {
|
|
308
311
|
type: "user-input";
|
|
309
312
|
fingerprintId: string;
|
|
@@ -358,13 +361,14 @@ export declare const CLIENT_MESSAGE_SCHEMAS: {
|
|
|
358
361
|
path: string;
|
|
359
362
|
content: string;
|
|
360
363
|
}[][];
|
|
364
|
+
userKnowledgeFiles?: Record<string, string> | undefined;
|
|
361
365
|
};
|
|
362
366
|
changesAlreadyApplied: {
|
|
363
367
|
type: "patch" | "file";
|
|
364
368
|
content: string;
|
|
365
369
|
filePath: string;
|
|
366
370
|
}[];
|
|
367
|
-
costMode: "lite" | "normal" | "
|
|
371
|
+
costMode: "lite" | "normal" | "max";
|
|
368
372
|
authToken?: string | undefined;
|
|
369
373
|
}, {
|
|
370
374
|
type: "user-input";
|
|
@@ -420,6 +424,7 @@ export declare const CLIENT_MESSAGE_SCHEMAS: {
|
|
|
420
424
|
path: string;
|
|
421
425
|
content: string;
|
|
422
426
|
}[][];
|
|
427
|
+
userKnowledgeFiles?: Record<string, string> | undefined;
|
|
423
428
|
};
|
|
424
429
|
changesAlreadyApplied: {
|
|
425
430
|
type: "patch" | "file";
|
|
@@ -427,7 +432,7 @@ export declare const CLIENT_MESSAGE_SCHEMAS: {
|
|
|
427
432
|
filePath: string;
|
|
428
433
|
}[];
|
|
429
434
|
authToken?: string | undefined;
|
|
430
|
-
costMode?: "lite" | "normal" | "
|
|
435
|
+
costMode?: "lite" | "normal" | "max" | undefined;
|
|
431
436
|
}>, z.ZodObject<{
|
|
432
437
|
type: z.ZodLiteral<"read-files-response">;
|
|
433
438
|
files: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodNull]>>;
|
|
@@ -446,6 +451,7 @@ export declare const CLIENT_MESSAGE_SCHEMAS: {
|
|
|
446
451
|
fileTree: z.ZodArray<z.ZodType<import("../util/file").FileTreeNode, z.ZodTypeDef, import("../util/file").FileTreeNode>, "many">;
|
|
447
452
|
fileTokenScores: z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodNumber>>;
|
|
448
453
|
knowledgeFiles: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
454
|
+
userKnowledgeFiles: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
449
455
|
gitChanges: z.ZodObject<{
|
|
450
456
|
status: z.ZodString;
|
|
451
457
|
diff: z.ZodString;
|
|
@@ -521,6 +527,7 @@ export declare const CLIENT_MESSAGE_SCHEMAS: {
|
|
|
521
527
|
path: string;
|
|
522
528
|
content: string;
|
|
523
529
|
}[][];
|
|
530
|
+
userKnowledgeFiles?: Record<string, string> | undefined;
|
|
524
531
|
}, {
|
|
525
532
|
currentWorkingDirectory: string;
|
|
526
533
|
fileTree: import("../util/file").FileTreeNode[];
|
|
@@ -546,6 +553,7 @@ export declare const CLIENT_MESSAGE_SCHEMAS: {
|
|
|
546
553
|
path: string;
|
|
547
554
|
content: string;
|
|
548
555
|
}[][];
|
|
556
|
+
userKnowledgeFiles?: Record<string, string> | undefined;
|
|
549
557
|
}>;
|
|
550
558
|
}, "strip", z.ZodTypeAny, {
|
|
551
559
|
type: "init";
|
|
@@ -575,6 +583,7 @@ export declare const CLIENT_MESSAGE_SCHEMAS: {
|
|
|
575
583
|
path: string;
|
|
576
584
|
content: string;
|
|
577
585
|
}[][];
|
|
586
|
+
userKnowledgeFiles?: Record<string, string> | undefined;
|
|
578
587
|
};
|
|
579
588
|
authToken?: string | undefined;
|
|
580
589
|
}, {
|
|
@@ -605,6 +614,7 @@ export declare const CLIENT_MESSAGE_SCHEMAS: {
|
|
|
605
614
|
path: string;
|
|
606
615
|
content: string;
|
|
607
616
|
}[][];
|
|
617
|
+
userKnowledgeFiles?: Record<string, string> | undefined;
|
|
608
618
|
};
|
|
609
619
|
authToken?: string | undefined;
|
|
610
620
|
}>, z.ZodObject<{
|
|
@@ -733,13 +743,14 @@ export declare const CLIENT_MESSAGE_SCHEMAS: {
|
|
|
733
743
|
path: string;
|
|
734
744
|
content: string;
|
|
735
745
|
}[][];
|
|
746
|
+
userKnowledgeFiles?: Record<string, string> | undefined;
|
|
736
747
|
};
|
|
737
748
|
changesAlreadyApplied: {
|
|
738
749
|
type: "patch" | "file";
|
|
739
750
|
content: string;
|
|
740
751
|
filePath: string;
|
|
741
752
|
}[];
|
|
742
|
-
costMode: "lite" | "normal" | "
|
|
753
|
+
costMode: "lite" | "normal" | "max";
|
|
743
754
|
authToken?: string | undefined;
|
|
744
755
|
} | {
|
|
745
756
|
type: "read-files-response";
|
|
@@ -772,6 +783,7 @@ export declare const CLIENT_MESSAGE_SCHEMAS: {
|
|
|
772
783
|
path: string;
|
|
773
784
|
content: string;
|
|
774
785
|
}[][];
|
|
786
|
+
userKnowledgeFiles?: Record<string, string> | undefined;
|
|
775
787
|
};
|
|
776
788
|
authToken?: string | undefined;
|
|
777
789
|
} | {
|
|
@@ -855,6 +867,7 @@ export declare const CLIENT_MESSAGE_SCHEMAS: {
|
|
|
855
867
|
path: string;
|
|
856
868
|
content: string;
|
|
857
869
|
}[][];
|
|
870
|
+
userKnowledgeFiles?: Record<string, string> | undefined;
|
|
858
871
|
};
|
|
859
872
|
changesAlreadyApplied: {
|
|
860
873
|
type: "patch" | "file";
|
|
@@ -862,7 +875,7 @@ export declare const CLIENT_MESSAGE_SCHEMAS: {
|
|
|
862
875
|
filePath: string;
|
|
863
876
|
}[];
|
|
864
877
|
authToken?: string | undefined;
|
|
865
|
-
costMode?: "lite" | "normal" | "
|
|
878
|
+
costMode?: "lite" | "normal" | "max" | undefined;
|
|
866
879
|
} | {
|
|
867
880
|
type: "read-files-response";
|
|
868
881
|
files: Record<string, string | null>;
|
|
@@ -894,6 +907,7 @@ export declare const CLIENT_MESSAGE_SCHEMAS: {
|
|
|
894
907
|
path: string;
|
|
895
908
|
content: string;
|
|
896
909
|
}[][];
|
|
910
|
+
userKnowledgeFiles?: Record<string, string> | undefined;
|
|
897
911
|
};
|
|
898
912
|
authToken?: string | undefined;
|
|
899
913
|
} | {
|
|
@@ -1108,6 +1122,7 @@ export declare const CLIENT_MESSAGE_SCHEMA: z.ZodUnion<[z.ZodObject<{
|
|
|
1108
1122
|
fileTree: z.ZodArray<z.ZodType<import("../util/file").FileTreeNode, z.ZodTypeDef, import("../util/file").FileTreeNode>, "many">;
|
|
1109
1123
|
fileTokenScores: z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodNumber>>;
|
|
1110
1124
|
knowledgeFiles: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
1125
|
+
userKnowledgeFiles: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
1111
1126
|
gitChanges: z.ZodObject<{
|
|
1112
1127
|
status: z.ZodString;
|
|
1113
1128
|
diff: z.ZodString;
|
|
@@ -1183,6 +1198,7 @@ export declare const CLIENT_MESSAGE_SCHEMA: z.ZodUnion<[z.ZodObject<{
|
|
|
1183
1198
|
path: string;
|
|
1184
1199
|
content: string;
|
|
1185
1200
|
}[][];
|
|
1201
|
+
userKnowledgeFiles?: Record<string, string> | undefined;
|
|
1186
1202
|
}, {
|
|
1187
1203
|
currentWorkingDirectory: string;
|
|
1188
1204
|
fileTree: import("../util/file").FileTreeNode[];
|
|
@@ -1208,6 +1224,7 @@ export declare const CLIENT_MESSAGE_SCHEMA: z.ZodUnion<[z.ZodObject<{
|
|
|
1208
1224
|
path: string;
|
|
1209
1225
|
content: string;
|
|
1210
1226
|
}[][];
|
|
1227
|
+
userKnowledgeFiles?: Record<string, string> | undefined;
|
|
1211
1228
|
}>;
|
|
1212
1229
|
changesAlreadyApplied: z.ZodArray<z.ZodObject<{
|
|
1213
1230
|
type: z.ZodEnum<["patch", "file"]>;
|
|
@@ -1222,7 +1239,7 @@ export declare const CLIENT_MESSAGE_SCHEMA: z.ZodUnion<[z.ZodObject<{
|
|
|
1222
1239
|
content: string;
|
|
1223
1240
|
filePath: string;
|
|
1224
1241
|
}>, "many">;
|
|
1225
|
-
costMode: z.ZodDefault<z.ZodOptional<z.ZodEnum<["lite", "normal", "
|
|
1242
|
+
costMode: z.ZodDefault<z.ZodOptional<z.ZodEnum<["lite", "normal", "max"]>>>;
|
|
1226
1243
|
}, "strip", z.ZodTypeAny, {
|
|
1227
1244
|
type: "user-input";
|
|
1228
1245
|
fingerprintId: string;
|
|
@@ -1277,13 +1294,14 @@ export declare const CLIENT_MESSAGE_SCHEMA: z.ZodUnion<[z.ZodObject<{
|
|
|
1277
1294
|
path: string;
|
|
1278
1295
|
content: string;
|
|
1279
1296
|
}[][];
|
|
1297
|
+
userKnowledgeFiles?: Record<string, string> | undefined;
|
|
1280
1298
|
};
|
|
1281
1299
|
changesAlreadyApplied: {
|
|
1282
1300
|
type: "patch" | "file";
|
|
1283
1301
|
content: string;
|
|
1284
1302
|
filePath: string;
|
|
1285
1303
|
}[];
|
|
1286
|
-
costMode: "lite" | "normal" | "
|
|
1304
|
+
costMode: "lite" | "normal" | "max";
|
|
1287
1305
|
authToken?: string | undefined;
|
|
1288
1306
|
}, {
|
|
1289
1307
|
type: "user-input";
|
|
@@ -1339,6 +1357,7 @@ export declare const CLIENT_MESSAGE_SCHEMA: z.ZodUnion<[z.ZodObject<{
|
|
|
1339
1357
|
path: string;
|
|
1340
1358
|
content: string;
|
|
1341
1359
|
}[][];
|
|
1360
|
+
userKnowledgeFiles?: Record<string, string> | undefined;
|
|
1342
1361
|
};
|
|
1343
1362
|
changesAlreadyApplied: {
|
|
1344
1363
|
type: "patch" | "file";
|
|
@@ -1346,7 +1365,7 @@ export declare const CLIENT_MESSAGE_SCHEMA: z.ZodUnion<[z.ZodObject<{
|
|
|
1346
1365
|
filePath: string;
|
|
1347
1366
|
}[];
|
|
1348
1367
|
authToken?: string | undefined;
|
|
1349
|
-
costMode?: "lite" | "normal" | "
|
|
1368
|
+
costMode?: "lite" | "normal" | "max" | undefined;
|
|
1350
1369
|
}>, z.ZodObject<{
|
|
1351
1370
|
type: z.ZodLiteral<"read-files-response">;
|
|
1352
1371
|
files: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodNull]>>;
|
|
@@ -1365,6 +1384,7 @@ export declare const CLIENT_MESSAGE_SCHEMA: z.ZodUnion<[z.ZodObject<{
|
|
|
1365
1384
|
fileTree: z.ZodArray<z.ZodType<import("../util/file").FileTreeNode, z.ZodTypeDef, import("../util/file").FileTreeNode>, "many">;
|
|
1366
1385
|
fileTokenScores: z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodNumber>>;
|
|
1367
1386
|
knowledgeFiles: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
1387
|
+
userKnowledgeFiles: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
1368
1388
|
gitChanges: z.ZodObject<{
|
|
1369
1389
|
status: z.ZodString;
|
|
1370
1390
|
diff: z.ZodString;
|
|
@@ -1440,6 +1460,7 @@ export declare const CLIENT_MESSAGE_SCHEMA: z.ZodUnion<[z.ZodObject<{
|
|
|
1440
1460
|
path: string;
|
|
1441
1461
|
content: string;
|
|
1442
1462
|
}[][];
|
|
1463
|
+
userKnowledgeFiles?: Record<string, string> | undefined;
|
|
1443
1464
|
}, {
|
|
1444
1465
|
currentWorkingDirectory: string;
|
|
1445
1466
|
fileTree: import("../util/file").FileTreeNode[];
|
|
@@ -1465,6 +1486,7 @@ export declare const CLIENT_MESSAGE_SCHEMA: z.ZodUnion<[z.ZodObject<{
|
|
|
1465
1486
|
path: string;
|
|
1466
1487
|
content: string;
|
|
1467
1488
|
}[][];
|
|
1489
|
+
userKnowledgeFiles?: Record<string, string> | undefined;
|
|
1468
1490
|
}>;
|
|
1469
1491
|
}, "strip", z.ZodTypeAny, {
|
|
1470
1492
|
type: "init";
|
|
@@ -1494,6 +1516,7 @@ export declare const CLIENT_MESSAGE_SCHEMA: z.ZodUnion<[z.ZodObject<{
|
|
|
1494
1516
|
path: string;
|
|
1495
1517
|
content: string;
|
|
1496
1518
|
}[][];
|
|
1519
|
+
userKnowledgeFiles?: Record<string, string> | undefined;
|
|
1497
1520
|
};
|
|
1498
1521
|
authToken?: string | undefined;
|
|
1499
1522
|
}, {
|
|
@@ -1524,6 +1547,7 @@ export declare const CLIENT_MESSAGE_SCHEMA: z.ZodUnion<[z.ZodObject<{
|
|
|
1524
1547
|
path: string;
|
|
1525
1548
|
content: string;
|
|
1526
1549
|
}[][];
|
|
1550
|
+
userKnowledgeFiles?: Record<string, string> | undefined;
|
|
1527
1551
|
};
|
|
1528
1552
|
authToken?: string | undefined;
|
|
1529
1553
|
}>, z.ZodObject<{
|
|
@@ -1652,13 +1676,14 @@ export declare const CLIENT_MESSAGE_SCHEMA: z.ZodUnion<[z.ZodObject<{
|
|
|
1652
1676
|
path: string;
|
|
1653
1677
|
content: string;
|
|
1654
1678
|
}[][];
|
|
1679
|
+
userKnowledgeFiles?: Record<string, string> | undefined;
|
|
1655
1680
|
};
|
|
1656
1681
|
changesAlreadyApplied: {
|
|
1657
1682
|
type: "patch" | "file";
|
|
1658
1683
|
content: string;
|
|
1659
1684
|
filePath: string;
|
|
1660
1685
|
}[];
|
|
1661
|
-
costMode: "lite" | "normal" | "
|
|
1686
|
+
costMode: "lite" | "normal" | "max";
|
|
1662
1687
|
authToken?: string | undefined;
|
|
1663
1688
|
} | {
|
|
1664
1689
|
type: "read-files-response";
|
|
@@ -1691,6 +1716,7 @@ export declare const CLIENT_MESSAGE_SCHEMA: z.ZodUnion<[z.ZodObject<{
|
|
|
1691
1716
|
path: string;
|
|
1692
1717
|
content: string;
|
|
1693
1718
|
}[][];
|
|
1719
|
+
userKnowledgeFiles?: Record<string, string> | undefined;
|
|
1694
1720
|
};
|
|
1695
1721
|
authToken?: string | undefined;
|
|
1696
1722
|
} | {
|
|
@@ -1774,6 +1800,7 @@ export declare const CLIENT_MESSAGE_SCHEMA: z.ZodUnion<[z.ZodObject<{
|
|
|
1774
1800
|
path: string;
|
|
1775
1801
|
content: string;
|
|
1776
1802
|
}[][];
|
|
1803
|
+
userKnowledgeFiles?: Record<string, string> | undefined;
|
|
1777
1804
|
};
|
|
1778
1805
|
changesAlreadyApplied: {
|
|
1779
1806
|
type: "patch" | "file";
|
|
@@ -1781,7 +1808,7 @@ export declare const CLIENT_MESSAGE_SCHEMA: z.ZodUnion<[z.ZodObject<{
|
|
|
1781
1808
|
filePath: string;
|
|
1782
1809
|
}[];
|
|
1783
1810
|
authToken?: string | undefined;
|
|
1784
|
-
costMode?: "lite" | "normal" | "
|
|
1811
|
+
costMode?: "lite" | "normal" | "max" | undefined;
|
|
1785
1812
|
} | {
|
|
1786
1813
|
type: "read-files-response";
|
|
1787
1814
|
files: Record<string, string | null>;
|
|
@@ -1813,6 +1840,7 @@ export declare const CLIENT_MESSAGE_SCHEMA: z.ZodUnion<[z.ZodObject<{
|
|
|
1813
1840
|
path: string;
|
|
1814
1841
|
content: string;
|
|
1815
1842
|
}[][];
|
|
1843
|
+
userKnowledgeFiles?: Record<string, string> | undefined;
|
|
1816
1844
|
};
|
|
1817
1845
|
authToken?: string | undefined;
|
|
1818
1846
|
} | {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function createTemplateProject(template: string, projectDir: string, projectName?: string): Promise<void>;
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.createTemplateProject = createTemplateProject;
|
|
37
|
+
const child_process_1 = require("child_process");
|
|
38
|
+
const path_1 = require("path");
|
|
39
|
+
const fs = __importStar(require("fs"));
|
|
40
|
+
const os = __importStar(require("os"));
|
|
41
|
+
const picocolors_1 = require("picocolors");
|
|
42
|
+
async function createTemplateProject(template, projectDir, projectName = template) {
|
|
43
|
+
console.log(`Creating project from ${template} template in ${projectDir}/${projectName}`);
|
|
44
|
+
// Validate template name contains only alphanumeric chars, dash and underscore
|
|
45
|
+
if (!/^[a-zA-Z0-9-_]+$/.test(template)) {
|
|
46
|
+
console.error('Template name can only contain letters, numbers, dash and underscore');
|
|
47
|
+
process.exit(1);
|
|
48
|
+
}
|
|
49
|
+
// Validate project name
|
|
50
|
+
if (!/^[a-zA-Z0-9-_]+$/.test(projectName)) {
|
|
51
|
+
console.error('Project name can only contain letters, numbers, dash and underscore');
|
|
52
|
+
process.exit(1);
|
|
53
|
+
}
|
|
54
|
+
const projectPath = (0, path_1.join)(projectDir, projectName);
|
|
55
|
+
// Check if directory already exists
|
|
56
|
+
if (fs.existsSync(projectPath)) {
|
|
57
|
+
console.error(`Directory ${projectPath} already exists`);
|
|
58
|
+
process.exit(1);
|
|
59
|
+
}
|
|
60
|
+
try {
|
|
61
|
+
console.log('\nDownloading template...');
|
|
62
|
+
// Clone the community repo to a temp directory
|
|
63
|
+
const tempDir = fs.mkdtempSync((0, path_1.join)(os.tmpdir(), 'codebuff-starter-'));
|
|
64
|
+
(0, child_process_1.execSync)('git clone --depth 1 https://github.com/CodebuffAI/codebuff-community.git .', {
|
|
65
|
+
cwd: tempDir,
|
|
66
|
+
stdio: 'pipe',
|
|
67
|
+
});
|
|
68
|
+
// Check if template exists in starter-templates or showcase directory
|
|
69
|
+
const starterTemplateDir = (0, path_1.join)(tempDir, 'starter-templates', template);
|
|
70
|
+
const showcaseDir = (0, path_1.join)(tempDir, 'showcase', template);
|
|
71
|
+
let templateDir;
|
|
72
|
+
if (fs.existsSync(starterTemplateDir)) {
|
|
73
|
+
templateDir = starterTemplateDir;
|
|
74
|
+
}
|
|
75
|
+
else if (fs.existsSync(showcaseDir)) {
|
|
76
|
+
templateDir = showcaseDir;
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
console.error(`Template ${template} not found in starter-templates/ or showcase/`);
|
|
80
|
+
fs.rmSync(tempDir, { recursive: true, force: true });
|
|
81
|
+
process.exit(1);
|
|
82
|
+
}
|
|
83
|
+
// Create parent directory if it doesn't exist
|
|
84
|
+
if (projectDir) {
|
|
85
|
+
fs.mkdirSync(projectDir, { recursive: true });
|
|
86
|
+
}
|
|
87
|
+
// Copy template to new directory
|
|
88
|
+
fs.mkdirSync(projectPath);
|
|
89
|
+
fs.cpSync(templateDir, projectPath, { recursive: true });
|
|
90
|
+
// Remove .git directory if it exists
|
|
91
|
+
const gitDir = (0, path_1.join)(projectPath, '.git');
|
|
92
|
+
if (fs.existsSync(gitDir)) {
|
|
93
|
+
fs.rmSync(gitDir, { recursive: true, force: true });
|
|
94
|
+
}
|
|
95
|
+
// Initialize new git repo
|
|
96
|
+
console.log('\nInitializing git repo...');
|
|
97
|
+
(0, child_process_1.execSync)('git init', { cwd: projectPath, stdio: 'pipe' });
|
|
98
|
+
// Clean up temp directory
|
|
99
|
+
fs.rmSync(tempDir, { recursive: true, force: true });
|
|
100
|
+
// Install dependencies
|
|
101
|
+
if (fs.existsSync((0, path_1.join)(projectPath, 'package-lock.json'))) {
|
|
102
|
+
console.log('\nInstalling dependencies...');
|
|
103
|
+
(0, child_process_1.execSync)('npm install', { cwd: projectPath, stdio: 'inherit' });
|
|
104
|
+
}
|
|
105
|
+
console.log((0, picocolors_1.green)(`\nSuccessfully created new project in ${projectPath}\n`));
|
|
106
|
+
// Change into the new project directory and run codebuff
|
|
107
|
+
process.chdir(projectPath);
|
|
108
|
+
console.log('Starting Codebuff in the new project...\n');
|
|
109
|
+
console.log('--------------------------------\n');
|
|
110
|
+
(0, child_process_1.execSync)('codebuff', { stdio: 'inherit' });
|
|
111
|
+
}
|
|
112
|
+
catch (error) {
|
|
113
|
+
console.error('Failed to initialize project:', error);
|
|
114
|
+
process.exit(1);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
//# sourceMappingURL=create-template-project.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-template-project.js","sourceRoot":"","sources":["../src/create-template-project.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,sDAqGC;AA3GD,iDAAwC;AACxC,+BAA2B;AAC3B,uCAAwB;AACxB,uCAAwB;AACxB,2CAAkC;AAE3B,KAAK,UAAU,qBAAqB,CACzC,QAAgB,EAChB,UAAkB,EAClB,cAAsB,QAAQ;IAE9B,OAAO,CAAC,GAAG,CACT,yBAAyB,QAAQ,gBAAgB,UAAU,IAAI,WAAW,EAAE,CAC7E,CAAA;IAED,+EAA+E;IAC/E,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,QAAQ,CAAC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,CAAC,IAAA,WAAI,EAAC,WAAW,EAAE,mBAAmB,CAAC,CAAC,EAAE,CAAC;YAC1D,OAAO,CAAC,GAAG,CAAC,8BAA8B,CAAC,CAAA;YAC3C,IAAA,wBAAQ,EAAC,aAAa,EAAE,EAAE,GAAG,EAAE,WAAW,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAA;QACjE,CAAC;QAED,OAAO,CAAC,GAAG,CAAC,IAAA,kBAAK,EAAC,yCAAyC,WAAW,IAAI,CAAC,CAAC,CAAA;QAE5E,yDAAyD;QACzD,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,CAAA;QAC1B,OAAO,CAAC,GAAG,CAAC,2CAA2C,CAAC,CAAA;QACxD,OAAO,CAAC,GAAG,CAAC,oCAAoC,CAAC,CAAA;QACjD,IAAA,wBAAQ,EAAC,UAAU,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAA;IAC5C,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,+BAA+B,EAAE,KAAK,CAAC,CAAA;QACrD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACjB,CAAC;AACH,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -8,36 +8,47 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
8
8
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
9
9
|
};
|
|
10
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
-
const fs_1 = __importDefault(require("fs"));
|
|
12
|
-
const path_1 = __importDefault(require("path"));
|
|
13
11
|
const picocolors_1 = require("picocolors");
|
|
12
|
+
const package_json_1 = __importDefault(require("../package.json"));
|
|
14
13
|
const cli_1 = require("./cli");
|
|
15
14
|
const project_files_1 = require("./project-files");
|
|
16
15
|
const update_codebuff_1 = require("./update-codebuff");
|
|
17
16
|
const terminal_1 = require("./utils/terminal");
|
|
17
|
+
const create_template_project_1 = require("./create-template-project");
|
|
18
18
|
async function codebuff(projectDir, { initialInput, git, costMode }) {
|
|
19
19
|
const dir = (0, project_files_1.setProjectRoot)(projectDir);
|
|
20
|
-
(0, terminal_1.
|
|
20
|
+
(0, terminal_1.recreateShell)();
|
|
21
21
|
const updatePromise = (0, update_codebuff_1.updateCodebuff)();
|
|
22
22
|
const initFileContextPromise = (0, project_files_1.initProjectFileContextWithWorker)(dir);
|
|
23
23
|
const readyPromise = Promise.all([updatePromise, initFileContextPromise]);
|
|
24
24
|
const cli = new cli_1.CLI(readyPromise, { git, costMode });
|
|
25
|
-
|
|
26
|
-
lite: (0, picocolors_1.bold)((0, picocolors_1.yellow)('Lite mode ✨ enabled')),
|
|
27
|
-
normal: '',
|
|
28
|
-
pro: (0, picocolors_1.bold)((0, picocolors_1.blueBright)('Pro mode️ ⚡ enabled')),
|
|
29
|
-
};
|
|
30
|
-
console.log(`${costModeDescription[costMode]}`);
|
|
31
|
-
console.log(`Codebuff will read and write files in "${dir}". Type "help" for a list of commands.`);
|
|
32
|
-
const gitDir = path_1.default.join(dir, '.git');
|
|
33
|
-
if (!fs_1.default.existsSync(gitDir)) {
|
|
34
|
-
console.warn((0, picocolors_1.yellow)('Warning: No .git directory found. Make sure you are at the top level of your project.'));
|
|
35
|
-
}
|
|
36
|
-
cli.printInitialPrompt(initialInput);
|
|
25
|
+
await cli.printInitialPrompt(initialInput);
|
|
37
26
|
}
|
|
38
27
|
if (require.main === module) {
|
|
39
28
|
const args = process.argv.slice(2);
|
|
40
29
|
const help = args.includes('--help') || args.includes('-h');
|
|
30
|
+
const version = args.includes('--version') || args.includes('-v');
|
|
31
|
+
if (version) {
|
|
32
|
+
console.log(`Codebuff v${package_json_1.default.version}`);
|
|
33
|
+
process.exit(0);
|
|
34
|
+
}
|
|
35
|
+
// Handle --create flag before other flags
|
|
36
|
+
const createIndex = args.indexOf('--create');
|
|
37
|
+
if (createIndex !== -1) {
|
|
38
|
+
const template = args[createIndex + 1];
|
|
39
|
+
const projectDir = args[0] !== '--create' ? args[0] : '.';
|
|
40
|
+
const projectName = args[createIndex + 2] || template;
|
|
41
|
+
if (!template) {
|
|
42
|
+
console.error('Please specify a template name');
|
|
43
|
+
console.log('Available templates:');
|
|
44
|
+
console.log(' nextjs - Next.js starter template');
|
|
45
|
+
console.log('\nSee all templates at:');
|
|
46
|
+
console.log(' https://github.com/CodebuffAI/codebuff-community/tree/main/starter-templates');
|
|
47
|
+
process.exit(1);
|
|
48
|
+
}
|
|
49
|
+
(0, create_template_project_1.createTemplateProject)(template, projectDir, projectName);
|
|
50
|
+
process.exit(0);
|
|
51
|
+
}
|
|
41
52
|
const gitArg = args.indexOf('--git');
|
|
42
53
|
const git = gitArg !== -1 && args[gitArg + 1] === 'stage'
|
|
43
54
|
? 'stage'
|
|
@@ -50,21 +61,43 @@ if (require.main === module) {
|
|
|
50
61
|
costMode = 'lite';
|
|
51
62
|
args.splice(args.indexOf('--lite'), 1);
|
|
52
63
|
}
|
|
53
|
-
else if (args.includes('--pro')
|
|
54
|
-
|
|
55
|
-
args.
|
|
64
|
+
else if (args.includes('--pro') ||
|
|
65
|
+
args.includes('--o1') ||
|
|
66
|
+
args.includes('--max')) {
|
|
67
|
+
costMode = 'max';
|
|
68
|
+
// Remove whichever flag was used
|
|
69
|
+
if (args.includes('--pro')) {
|
|
70
|
+
args.splice(args.indexOf('--pro'), 1);
|
|
71
|
+
console.error((0, picocolors_1.red)('Warning: The --pro flag is deprecated. Please restart codebuff and use the --max option instead.'));
|
|
72
|
+
process.exit(1);
|
|
73
|
+
}
|
|
74
|
+
if (args.includes('--o1'))
|
|
75
|
+
args.splice(args.indexOf('--o1'), 1);
|
|
76
|
+
if (args.includes('--max'))
|
|
77
|
+
args.splice(args.indexOf('--max'), 1);
|
|
56
78
|
}
|
|
57
79
|
const projectPath = args[0];
|
|
58
80
|
const initialInput = args.slice(1).join(' ');
|
|
59
81
|
if (help) {
|
|
60
82
|
console.log('Usage: codebuff [project-directory] [initial-prompt]');
|
|
61
83
|
console.log('Both arguments are optional.');
|
|
84
|
+
console.log();
|
|
85
|
+
console.log('Version:');
|
|
86
|
+
console.log(' --version, -v Show version number');
|
|
62
87
|
console.log('If no project directory is specified, Codebuff will use the current directory.');
|
|
63
88
|
console.log('If an initial prompt is provided, it will be sent as the first user input.');
|
|
64
89
|
console.log();
|
|
65
|
-
console.log('
|
|
90
|
+
console.log('Project Creation:');
|
|
91
|
+
console.log(' --create <template> [name] Create new project from template');
|
|
92
|
+
console.log(' Example: codebuff --create nextjs my-app');
|
|
93
|
+
console.log(' See all templates at:');
|
|
94
|
+
console.log(' https://github.com/CodebuffAI/codebuff-community/tree/main/starter-templates');
|
|
95
|
+
console.log();
|
|
96
|
+
console.log('Performance Options:');
|
|
66
97
|
console.log(' --lite Use budget models & fetch fewer files');
|
|
67
|
-
console.log(' --
|
|
98
|
+
console.log(' --max Use higher quality models and fetch more files');
|
|
99
|
+
console.log();
|
|
100
|
+
console.log('Git Integration:');
|
|
68
101
|
console.log(' --git stage Stage changes from last message');
|
|
69
102
|
console.log();
|
|
70
103
|
console.log('Codebuff allows you to interact with your codebase using natural language.');
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;AAGA,2CAAgC;AAChC,mEAAyC;AAEzC,+BAA2B;AAC3B,mDAGwB;AACxB,uDAAkD;AAElD,+CAAgD;AAChD,uEAAiE;AAEjE,KAAK,UAAU,QAAQ,CACrB,UAA8B,EAC9B,EAAE,YAAY,EAAE,GAAG,EAAE,QAAQ,EAAc;IAE3C,MAAM,GAAG,GAAG,IAAA,8BAAc,EAAC,UAAU,CAAC,CAAA;IACtC,IAAA,wBAAa,GAAE,CAAA;IAEf,MAAM,aAAa,GAAG,IAAA,gCAAc,GAAE,CAAA;IACtC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AG,CACT,oEAAoE,CACrE,CAAA;QACD,OAAO,CAAC,GAAG,CACT,4EAA4E,CAC7E,CAAA;QACD,OAAO,CAAC,GAAG,CAAC,yDAAyD,CAAC,CAAA;QACtE,OAAO,CAAC,GAAG,CACT,gHAAgH,CACjH,CAAA;QACD,OAAO,CAAC,GAAG,EAAE,CAAA;QACb,OAAO,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAA;QACnC,OAAO,CAAC,GAAG,CACT,yEAAyE,CAC1E,CAAA;QACD,OAAO,CAAC,GAAG,CACT,kFAAkF,CACnF,CAAA;QACD,OAAO,CAAC,GAAG,EAAE,CAAA;QACb,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAA;QAC/B,OAAO,CAAC,GAAG,CACT,mEAAmE,CACpE,CAAA;QACD,OAAO,CAAC,GAAG,EAAE,CAAA;QACb,OAAO,CAAC,GAAG,CACT,4EAA4E,CAC7E,CAAA;QACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACjB,CAAC;IAED,QAAQ,CAAC,WAAW,EAAE,EAAE,YAAY,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAC,CAAA;AACxD,CAAC"}
|
package/dist/menu.d.ts
CHANGED
package/dist/menu.js
CHANGED
|
@@ -32,12 +32,18 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
32
32
|
return result;
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
35
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.displayGreeting = displayGreeting;
|
|
36
40
|
exports.displayMenu = displayMenu;
|
|
37
41
|
const constants_1 = require("./common/constants");
|
|
38
42
|
const project_files_1 = require("./project-files");
|
|
39
43
|
const picocolors_1 = __importStar(require("picocolors"));
|
|
40
44
|
const picocolors_2 = require("picocolors");
|
|
45
|
+
const path_1 = __importDefault(require("path"));
|
|
46
|
+
const fs = __importStar(require("fs"));
|
|
41
47
|
const getRandomColors = () => {
|
|
42
48
|
const allColors = ['red', 'green', 'yellow', 'blue', 'magenta', 'cyan'];
|
|
43
49
|
const colors = [];
|
|
@@ -49,6 +55,21 @@ const getRandomColors = () => {
|
|
|
49
55
|
}
|
|
50
56
|
return colors;
|
|
51
57
|
};
|
|
58
|
+
function displayGreeting(costMode, username) {
|
|
59
|
+
// Show extra info only for logged in users
|
|
60
|
+
const costModeDescription = {
|
|
61
|
+
lite: (0, picocolors_2.bold)((0, picocolors_1.yellow)('Lite mode ✨ enabled')),
|
|
62
|
+
normal: '',
|
|
63
|
+
max: (0, picocolors_2.bold)((0, picocolors_1.blueBright)('Max mode️ ⚡ enabled')),
|
|
64
|
+
};
|
|
65
|
+
console.log(`${costModeDescription[costMode]}`);
|
|
66
|
+
console.log(`Codebuff will read and write files in "${(0, project_files_1.getProjectRoot)()}". Type "help" for a list of commands.`);
|
|
67
|
+
const gitDir = path_1.default.join((0, project_files_1.getProjectRoot)(), '.git');
|
|
68
|
+
if (!fs.existsSync(gitDir)) {
|
|
69
|
+
console.info((0, picocolors_1.magenta)("Just fyi, this project doesn't contain a .git directory (are you at the top level of your project?). Codebuff works best with a git repo!"));
|
|
70
|
+
}
|
|
71
|
+
console.log(`\nWelcome${username ? ` back ${username}` : ''}! What would you like to do?`);
|
|
72
|
+
}
|
|
52
73
|
function displayMenu() {
|
|
53
74
|
const selectedColors = getRandomColors();
|
|
54
75
|
const getRandomColor = () => {
|
|
@@ -95,7 +116,7 @@ ${colorizeRandom(' ╚═════╝')}${colorizeRandom(' ╚═════
|
|
|
95
116
|
console.log('- Type "login" to log into Codebuff');
|
|
96
117
|
console.log('- Type "exit" or press Ctrl+C twice to exit Codebuff');
|
|
97
118
|
console.log('- Type "diff" or "d" to show changes from the last assistant response');
|
|
98
|
-
console.log('- Start codebuff with --lite for efficient, budget responses or --
|
|
119
|
+
console.log('- Start codebuff with --lite for efficient, budget responses or --max for higher quality responses');
|
|
99
120
|
console.log(`- Redeem a referral code by simply pasting it here.`);
|
|
100
121
|
console.log('-', (0, picocolors_2.bold)((0, picocolors_2.green)(`Refer new users and each of you will earn ${constants_1.CREDITS_REFERRAL_BONUS} credits per month: ${process.env.NEXT_PUBLIC_APP_URL}/referrals`)));
|
|
101
122
|
console.log('\nAny files in .gitignore are not read by Codebuff. You can ignore further files with .codebuffignore');
|
package/dist/menu.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"menu.js","sourceRoot":"","sources":["../src/menu.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"menu.js","sourceRoot":"","sources":["../src/menu.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmBA,0CAwBC;AAED,kCAqFC;AAlID,gDAAmE;AACnE,mDAAgD;AAChD,yDAA0E;AAC1E,2CAAwC;AACxC,gDAAuB;AACvB,uCAAwB;AAExB,MAAM,eAAe,GAAG,GAAG,EAAE;IAC3B,MAAM,SAAS,GAAG,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,CAAC,CAAA;IACvE,MAAM,MAAM,GAAa,EAAE,CAAA;IAC3B,OAAO,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACzB,MAAM,KAAK,GAAG,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC,CAAA;QACrE,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;YAC5B,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QACpB,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAA;AACf,CAAC,CAAA;AAED,SAAgB,eAAe,CAAC,QAAkB,EAAE,QAAuB;IACzE,2CAA2C;IAC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