@fractary/codex 0.11.0 → 0.11.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/index.d.cts CHANGED
@@ -450,18 +450,51 @@ declare const CodexConfigSchema: z.ZodObject<{
450
450
  defaultExclude?: string[] | undefined;
451
451
  }>>;
452
452
  sync: z.ZodOptional<z.ZodObject<{
453
- to_codex: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
454
- from_codex: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
453
+ to_codex: z.ZodOptional<z.ZodObject<{
454
+ include: z.ZodArray<z.ZodString, "many">;
455
+ exclude: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
456
+ }, "strip", z.ZodTypeAny, {
457
+ include: string[];
458
+ exclude?: string[] | undefined;
459
+ }, {
460
+ include: string[];
461
+ exclude?: string[] | undefined;
462
+ }>>;
463
+ from_codex: z.ZodOptional<z.ZodObject<{
464
+ include: z.ZodArray<z.ZodString, "many">;
465
+ exclude: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
466
+ }, "strip", z.ZodTypeAny, {
467
+ include: string[];
468
+ exclude?: string[] | undefined;
469
+ }, {
470
+ include: string[];
471
+ exclude?: string[] | undefined;
472
+ }>>;
473
+ exclude: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
455
474
  default_to_codex: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
456
475
  default_from_codex: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
457
476
  }, "strip", z.ZodTypeAny, {
458
- to_codex?: string[] | undefined;
459
- from_codex?: string[] | undefined;
477
+ exclude?: string[] | undefined;
478
+ to_codex?: {
479
+ include: string[];
480
+ exclude?: string[] | undefined;
481
+ } | undefined;
482
+ from_codex?: {
483
+ include: string[];
484
+ exclude?: string[] | undefined;
485
+ } | undefined;
460
486
  default_to_codex?: string[] | undefined;
461
487
  default_from_codex?: string[] | undefined;
462
488
  }, {
463
- to_codex?: string[] | undefined;
464
- from_codex?: string[] | undefined;
489
+ exclude?: string[] | undefined;
490
+ to_codex?: {
491
+ include: string[];
492
+ exclude?: string[] | undefined;
493
+ } | undefined;
494
+ from_codex?: {
495
+ include: string[];
496
+ exclude?: string[] | undefined;
497
+ } | undefined;
465
498
  default_to_codex?: string[] | undefined;
466
499
  default_from_codex?: string[] | undefined;
467
500
  }>>;
@@ -592,8 +625,15 @@ declare const CodexConfigSchema: z.ZodObject<{
592
625
  defaultExclude?: string[] | undefined;
593
626
  } | undefined;
594
627
  sync?: {
595
- to_codex?: string[] | undefined;
596
- from_codex?: string[] | undefined;
628
+ exclude?: string[] | undefined;
629
+ to_codex?: {
630
+ include: string[];
631
+ exclude?: string[] | undefined;
632
+ } | undefined;
633
+ from_codex?: {
634
+ include: string[];
635
+ exclude?: string[] | undefined;
636
+ } | undefined;
597
637
  default_to_codex?: string[] | undefined;
598
638
  default_from_codex?: string[] | undefined;
599
639
  } | undefined;
@@ -644,8 +684,15 @@ declare const CodexConfigSchema: z.ZodObject<{
644
684
  defaultExclude?: string[] | undefined;
645
685
  } | undefined;
646
686
  sync?: {
647
- to_codex?: string[] | undefined;
648
- from_codex?: string[] | undefined;
687
+ exclude?: string[] | undefined;
688
+ to_codex?: {
689
+ include: string[];
690
+ exclude?: string[] | undefined;
691
+ } | undefined;
692
+ from_codex?: {
693
+ include: string[];
694
+ exclude?: string[] | undefined;
695
+ } | undefined;
649
696
  default_to_codex?: string[] | undefined;
650
697
  default_from_codex?: string[] | undefined;
651
698
  } | undefined;
@@ -866,18 +913,51 @@ declare const UnifiedConfigSchema: z.ZodObject<{
866
913
  defaultExclude?: string[] | undefined;
867
914
  }>>;
868
915
  sync: z.ZodOptional<z.ZodObject<{
869
- to_codex: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
870
- from_codex: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
916
+ to_codex: z.ZodOptional<z.ZodObject<{
917
+ include: z.ZodArray<z.ZodString, "many">;
918
+ exclude: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
919
+ }, "strip", z.ZodTypeAny, {
920
+ include: string[];
921
+ exclude?: string[] | undefined;
922
+ }, {
923
+ include: string[];
924
+ exclude?: string[] | undefined;
925
+ }>>;
926
+ from_codex: z.ZodOptional<z.ZodObject<{
927
+ include: z.ZodArray<z.ZodString, "many">;
928
+ exclude: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
929
+ }, "strip", z.ZodTypeAny, {
930
+ include: string[];
931
+ exclude?: string[] | undefined;
932
+ }, {
933
+ include: string[];
934
+ exclude?: string[] | undefined;
935
+ }>>;
936
+ exclude: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
871
937
  default_to_codex: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
872
938
  default_from_codex: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
873
939
  }, "strip", z.ZodTypeAny, {
874
- to_codex?: string[] | undefined;
875
- from_codex?: string[] | undefined;
940
+ exclude?: string[] | undefined;
941
+ to_codex?: {
942
+ include: string[];
943
+ exclude?: string[] | undefined;
944
+ } | undefined;
945
+ from_codex?: {
946
+ include: string[];
947
+ exclude?: string[] | undefined;
948
+ } | undefined;
876
949
  default_to_codex?: string[] | undefined;
877
950
  default_from_codex?: string[] | undefined;
878
951
  }, {
879
- to_codex?: string[] | undefined;
880
- from_codex?: string[] | undefined;
952
+ exclude?: string[] | undefined;
953
+ to_codex?: {
954
+ include: string[];
955
+ exclude?: string[] | undefined;
956
+ } | undefined;
957
+ from_codex?: {
958
+ include: string[];
959
+ exclude?: string[] | undefined;
960
+ } | undefined;
881
961
  default_to_codex?: string[] | undefined;
882
962
  default_from_codex?: string[] | undefined;
883
963
  }>>;
@@ -1008,8 +1088,15 @@ declare const UnifiedConfigSchema: z.ZodObject<{
1008
1088
  defaultExclude?: string[] | undefined;
1009
1089
  } | undefined;
1010
1090
  sync?: {
1011
- to_codex?: string[] | undefined;
1012
- from_codex?: string[] | undefined;
1091
+ exclude?: string[] | undefined;
1092
+ to_codex?: {
1093
+ include: string[];
1094
+ exclude?: string[] | undefined;
1095
+ } | undefined;
1096
+ from_codex?: {
1097
+ include: string[];
1098
+ exclude?: string[] | undefined;
1099
+ } | undefined;
1013
1100
  default_to_codex?: string[] | undefined;
1014
1101
  default_from_codex?: string[] | undefined;
1015
1102
  } | undefined;
@@ -1060,8 +1147,15 @@ declare const UnifiedConfigSchema: z.ZodObject<{
1060
1147
  defaultExclude?: string[] | undefined;
1061
1148
  } | undefined;
1062
1149
  sync?: {
1063
- to_codex?: string[] | undefined;
1064
- from_codex?: string[] | undefined;
1150
+ exclude?: string[] | undefined;
1151
+ to_codex?: {
1152
+ include: string[];
1153
+ exclude?: string[] | undefined;
1154
+ } | undefined;
1155
+ from_codex?: {
1156
+ include: string[];
1157
+ exclude?: string[] | undefined;
1158
+ } | undefined;
1065
1159
  default_to_codex?: string[] | undefined;
1066
1160
  default_from_codex?: string[] | undefined;
1067
1161
  } | undefined;
@@ -1133,8 +1227,15 @@ declare const UnifiedConfigSchema: z.ZodObject<{
1133
1227
  defaultExclude?: string[] | undefined;
1134
1228
  } | undefined;
1135
1229
  sync?: {
1136
- to_codex?: string[] | undefined;
1137
- from_codex?: string[] | undefined;
1230
+ exclude?: string[] | undefined;
1231
+ to_codex?: {
1232
+ include: string[];
1233
+ exclude?: string[] | undefined;
1234
+ } | undefined;
1235
+ from_codex?: {
1236
+ include: string[];
1237
+ exclude?: string[] | undefined;
1238
+ } | undefined;
1138
1239
  default_to_codex?: string[] | undefined;
1139
1240
  default_from_codex?: string[] | undefined;
1140
1241
  } | undefined;
@@ -1206,8 +1307,15 @@ declare const UnifiedConfigSchema: z.ZodObject<{
1206
1307
  defaultExclude?: string[] | undefined;
1207
1308
  } | undefined;
1208
1309
  sync?: {
1209
- to_codex?: string[] | undefined;
1210
- from_codex?: string[] | undefined;
1310
+ exclude?: string[] | undefined;
1311
+ to_codex?: {
1312
+ include: string[];
1313
+ exclude?: string[] | undefined;
1314
+ } | undefined;
1315
+ from_codex?: {
1316
+ include: string[];
1317
+ exclude?: string[] | undefined;
1318
+ } | undefined;
1211
1319
  default_to_codex?: string[] | undefined;
1212
1320
  default_from_codex?: string[] | undefined;
1213
1321
  } | undefined;
@@ -1637,6 +1745,12 @@ interface SyncOptions {
1637
1745
  maxFiles?: number;
1638
1746
  timeout?: number;
1639
1747
  onProgress?: (current: number, total: number, file: string) => void;
1748
+ sourceFiles?: Array<{
1749
+ path: string;
1750
+ size: number;
1751
+ mtime: number;
1752
+ hash?: string;
1753
+ }>;
1640
1754
  }
1641
1755
  interface SyncRule {
1642
1756
  pattern: string;
package/dist/index.d.ts CHANGED
@@ -450,18 +450,51 @@ declare const CodexConfigSchema: z.ZodObject<{
450
450
  defaultExclude?: string[] | undefined;
451
451
  }>>;
452
452
  sync: z.ZodOptional<z.ZodObject<{
453
- to_codex: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
454
- from_codex: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
453
+ to_codex: z.ZodOptional<z.ZodObject<{
454
+ include: z.ZodArray<z.ZodString, "many">;
455
+ exclude: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
456
+ }, "strip", z.ZodTypeAny, {
457
+ include: string[];
458
+ exclude?: string[] | undefined;
459
+ }, {
460
+ include: string[];
461
+ exclude?: string[] | undefined;
462
+ }>>;
463
+ from_codex: z.ZodOptional<z.ZodObject<{
464
+ include: z.ZodArray<z.ZodString, "many">;
465
+ exclude: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
466
+ }, "strip", z.ZodTypeAny, {
467
+ include: string[];
468
+ exclude?: string[] | undefined;
469
+ }, {
470
+ include: string[];
471
+ exclude?: string[] | undefined;
472
+ }>>;
473
+ exclude: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
455
474
  default_to_codex: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
456
475
  default_from_codex: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
457
476
  }, "strip", z.ZodTypeAny, {
458
- to_codex?: string[] | undefined;
459
- from_codex?: string[] | undefined;
477
+ exclude?: string[] | undefined;
478
+ to_codex?: {
479
+ include: string[];
480
+ exclude?: string[] | undefined;
481
+ } | undefined;
482
+ from_codex?: {
483
+ include: string[];
484
+ exclude?: string[] | undefined;
485
+ } | undefined;
460
486
  default_to_codex?: string[] | undefined;
461
487
  default_from_codex?: string[] | undefined;
462
488
  }, {
463
- to_codex?: string[] | undefined;
464
- from_codex?: string[] | undefined;
489
+ exclude?: string[] | undefined;
490
+ to_codex?: {
491
+ include: string[];
492
+ exclude?: string[] | undefined;
493
+ } | undefined;
494
+ from_codex?: {
495
+ include: string[];
496
+ exclude?: string[] | undefined;
497
+ } | undefined;
465
498
  default_to_codex?: string[] | undefined;
466
499
  default_from_codex?: string[] | undefined;
467
500
  }>>;
@@ -592,8 +625,15 @@ declare const CodexConfigSchema: z.ZodObject<{
592
625
  defaultExclude?: string[] | undefined;
593
626
  } | undefined;
594
627
  sync?: {
595
- to_codex?: string[] | undefined;
596
- from_codex?: string[] | undefined;
628
+ exclude?: string[] | undefined;
629
+ to_codex?: {
630
+ include: string[];
631
+ exclude?: string[] | undefined;
632
+ } | undefined;
633
+ from_codex?: {
634
+ include: string[];
635
+ exclude?: string[] | undefined;
636
+ } | undefined;
597
637
  default_to_codex?: string[] | undefined;
598
638
  default_from_codex?: string[] | undefined;
599
639
  } | undefined;
@@ -644,8 +684,15 @@ declare const CodexConfigSchema: z.ZodObject<{
644
684
  defaultExclude?: string[] | undefined;
645
685
  } | undefined;
646
686
  sync?: {
647
- to_codex?: string[] | undefined;
648
- from_codex?: string[] | undefined;
687
+ exclude?: string[] | undefined;
688
+ to_codex?: {
689
+ include: string[];
690
+ exclude?: string[] | undefined;
691
+ } | undefined;
692
+ from_codex?: {
693
+ include: string[];
694
+ exclude?: string[] | undefined;
695
+ } | undefined;
649
696
  default_to_codex?: string[] | undefined;
650
697
  default_from_codex?: string[] | undefined;
651
698
  } | undefined;
@@ -866,18 +913,51 @@ declare const UnifiedConfigSchema: z.ZodObject<{
866
913
  defaultExclude?: string[] | undefined;
867
914
  }>>;
868
915
  sync: z.ZodOptional<z.ZodObject<{
869
- to_codex: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
870
- from_codex: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
916
+ to_codex: z.ZodOptional<z.ZodObject<{
917
+ include: z.ZodArray<z.ZodString, "many">;
918
+ exclude: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
919
+ }, "strip", z.ZodTypeAny, {
920
+ include: string[];
921
+ exclude?: string[] | undefined;
922
+ }, {
923
+ include: string[];
924
+ exclude?: string[] | undefined;
925
+ }>>;
926
+ from_codex: z.ZodOptional<z.ZodObject<{
927
+ include: z.ZodArray<z.ZodString, "many">;
928
+ exclude: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
929
+ }, "strip", z.ZodTypeAny, {
930
+ include: string[];
931
+ exclude?: string[] | undefined;
932
+ }, {
933
+ include: string[];
934
+ exclude?: string[] | undefined;
935
+ }>>;
936
+ exclude: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
871
937
  default_to_codex: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
872
938
  default_from_codex: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
873
939
  }, "strip", z.ZodTypeAny, {
874
- to_codex?: string[] | undefined;
875
- from_codex?: string[] | undefined;
940
+ exclude?: string[] | undefined;
941
+ to_codex?: {
942
+ include: string[];
943
+ exclude?: string[] | undefined;
944
+ } | undefined;
945
+ from_codex?: {
946
+ include: string[];
947
+ exclude?: string[] | undefined;
948
+ } | undefined;
876
949
  default_to_codex?: string[] | undefined;
877
950
  default_from_codex?: string[] | undefined;
878
951
  }, {
879
- to_codex?: string[] | undefined;
880
- from_codex?: string[] | undefined;
952
+ exclude?: string[] | undefined;
953
+ to_codex?: {
954
+ include: string[];
955
+ exclude?: string[] | undefined;
956
+ } | undefined;
957
+ from_codex?: {
958
+ include: string[];
959
+ exclude?: string[] | undefined;
960
+ } | undefined;
881
961
  default_to_codex?: string[] | undefined;
882
962
  default_from_codex?: string[] | undefined;
883
963
  }>>;
@@ -1008,8 +1088,15 @@ declare const UnifiedConfigSchema: z.ZodObject<{
1008
1088
  defaultExclude?: string[] | undefined;
1009
1089
  } | undefined;
1010
1090
  sync?: {
1011
- to_codex?: string[] | undefined;
1012
- from_codex?: string[] | undefined;
1091
+ exclude?: string[] | undefined;
1092
+ to_codex?: {
1093
+ include: string[];
1094
+ exclude?: string[] | undefined;
1095
+ } | undefined;
1096
+ from_codex?: {
1097
+ include: string[];
1098
+ exclude?: string[] | undefined;
1099
+ } | undefined;
1013
1100
  default_to_codex?: string[] | undefined;
1014
1101
  default_from_codex?: string[] | undefined;
1015
1102
  } | undefined;
@@ -1060,8 +1147,15 @@ declare const UnifiedConfigSchema: z.ZodObject<{
1060
1147
  defaultExclude?: string[] | undefined;
1061
1148
  } | undefined;
1062
1149
  sync?: {
1063
- to_codex?: string[] | undefined;
1064
- from_codex?: string[] | undefined;
1150
+ exclude?: string[] | undefined;
1151
+ to_codex?: {
1152
+ include: string[];
1153
+ exclude?: string[] | undefined;
1154
+ } | undefined;
1155
+ from_codex?: {
1156
+ include: string[];
1157
+ exclude?: string[] | undefined;
1158
+ } | undefined;
1065
1159
  default_to_codex?: string[] | undefined;
1066
1160
  default_from_codex?: string[] | undefined;
1067
1161
  } | undefined;
@@ -1133,8 +1227,15 @@ declare const UnifiedConfigSchema: z.ZodObject<{
1133
1227
  defaultExclude?: string[] | undefined;
1134
1228
  } | undefined;
1135
1229
  sync?: {
1136
- to_codex?: string[] | undefined;
1137
- from_codex?: string[] | undefined;
1230
+ exclude?: string[] | undefined;
1231
+ to_codex?: {
1232
+ include: string[];
1233
+ exclude?: string[] | undefined;
1234
+ } | undefined;
1235
+ from_codex?: {
1236
+ include: string[];
1237
+ exclude?: string[] | undefined;
1238
+ } | undefined;
1138
1239
  default_to_codex?: string[] | undefined;
1139
1240
  default_from_codex?: string[] | undefined;
1140
1241
  } | undefined;
@@ -1206,8 +1307,15 @@ declare const UnifiedConfigSchema: z.ZodObject<{
1206
1307
  defaultExclude?: string[] | undefined;
1207
1308
  } | undefined;
1208
1309
  sync?: {
1209
- to_codex?: string[] | undefined;
1210
- from_codex?: string[] | undefined;
1310
+ exclude?: string[] | undefined;
1311
+ to_codex?: {
1312
+ include: string[];
1313
+ exclude?: string[] | undefined;
1314
+ } | undefined;
1315
+ from_codex?: {
1316
+ include: string[];
1317
+ exclude?: string[] | undefined;
1318
+ } | undefined;
1211
1319
  default_to_codex?: string[] | undefined;
1212
1320
  default_from_codex?: string[] | undefined;
1213
1321
  } | undefined;
@@ -1637,6 +1745,12 @@ interface SyncOptions {
1637
1745
  maxFiles?: number;
1638
1746
  timeout?: number;
1639
1747
  onProgress?: (current: number, total: number, file: string) => void;
1748
+ sourceFiles?: Array<{
1749
+ path: string;
1750
+ size: number;
1751
+ mtime: number;
1752
+ hash?: string;
1753
+ }>;
1640
1754
  }
1641
1755
  interface SyncRule {
1642
1756
  pattern: string;
package/dist/index.js CHANGED
@@ -863,12 +863,21 @@ var SyncRulesSchema = z.object({
863
863
  defaultInclude: z.array(z.string()).optional(),
864
864
  defaultExclude: z.array(z.string()).optional()
865
865
  });
866
+ var DirectionalSyncConfigSchema = z.object({
867
+ /** Patterns to include (required) */
868
+ include: z.array(z.string()),
869
+ /** Patterns to exclude (optional) */
870
+ exclude: z.array(z.string()).optional()
871
+ });
866
872
  var DirectionalSyncSchema = z.object({
873
+ // New format (v0.7.0+) - Recommended
867
874
  // Patterns for files to push from this project to codex
868
- to_codex: z.array(z.string()).optional(),
875
+ to_codex: DirectionalSyncConfigSchema.optional(),
869
876
  // Patterns for files to pull from codex to this project
870
- // Format: "project-name/path/pattern" or "project-name/**"
871
- from_codex: z.array(z.string()).optional(),
877
+ from_codex: DirectionalSyncConfigSchema.optional(),
878
+ // Global exclude patterns (applied to both directions)
879
+ exclude: z.array(z.string()).optional(),
880
+ // Legacy format (deprecated, backward compatible)
872
881
  // Org-level defaults (only in codex repository config)
873
882
  default_to_codex: z.array(z.string()).optional(),
874
883
  default_from_codex: z.array(z.string()).optional()
@@ -3760,14 +3769,19 @@ var SyncManager = class {
3760
3769
  * @param options - Sync options
3761
3770
  */
3762
3771
  async createPlan(_org, _project, sourceDir, targetFiles, options) {
3763
- let sourceFiles = await this.listLocalFiles(sourceDir);
3764
- if (options?.direction === "to-codex") {
3765
- const toCodexPatterns = this.resolveToCodexPatterns();
3766
- if (toCodexPatterns.length > 0) {
3767
- const { matchToCodexPattern: matchToCodexPattern2 } = await Promise.resolve().then(() => (init_directional_patterns(), directional_patterns_exports));
3768
- sourceFiles = sourceFiles.filter(
3769
- (file) => matchToCodexPattern2(file.path, toCodexPatterns)
3770
- );
3772
+ let sourceFiles;
3773
+ if (options?.sourceFiles && options.sourceFiles.length > 0) {
3774
+ sourceFiles = options.sourceFiles;
3775
+ } else {
3776
+ sourceFiles = await this.listLocalFiles(sourceDir);
3777
+ if (options?.direction === "to-codex") {
3778
+ const toCodexPatterns = this.resolveToCodexPatterns();
3779
+ if (toCodexPatterns.length > 0) {
3780
+ const { matchToCodexPattern: matchToCodexPattern2 } = await Promise.resolve().then(() => (init_directional_patterns(), directional_patterns_exports));
3781
+ sourceFiles = sourceFiles.filter(
3782
+ (file) => matchToCodexPattern2(file.path, toCodexPatterns)
3783
+ );
3784
+ }
3771
3785
  }
3772
3786
  }
3773
3787
  const plan = createSyncPlan(