@fractary/codex 0.9.0 → 0.9.1
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.cjs +89 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +264 -12
- package/dist/index.d.ts +264 -12
- package/dist/index.js +89 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -393,6 +393,7 @@ declare const SyncRulesSchema: z.ZodObject<{
|
|
|
393
393
|
type SyncRules = z.infer<typeof SyncRulesSchema>;
|
|
394
394
|
declare const CodexConfigSchema: z.ZodObject<{
|
|
395
395
|
organizationSlug: z.ZodString;
|
|
396
|
+
project: z.ZodOptional<z.ZodString>;
|
|
396
397
|
directories: z.ZodOptional<z.ZodObject<{
|
|
397
398
|
source: z.ZodOptional<z.ZodString>;
|
|
398
399
|
target: z.ZodOptional<z.ZodString>;
|
|
@@ -501,8 +502,78 @@ declare const CodexConfigSchema: z.ZodObject<{
|
|
|
501
502
|
prefix?: string | undefined;
|
|
502
503
|
}>;
|
|
503
504
|
}>>;
|
|
505
|
+
auth: z.ZodOptional<z.ZodObject<{
|
|
506
|
+
github: z.ZodOptional<z.ZodObject<{
|
|
507
|
+
default_token_env: z.ZodOptional<z.ZodString>;
|
|
508
|
+
fallback_to_public: z.ZodOptional<z.ZodBoolean>;
|
|
509
|
+
}, "strip", z.ZodTypeAny, {
|
|
510
|
+
default_token_env?: string | undefined;
|
|
511
|
+
fallback_to_public?: boolean | undefined;
|
|
512
|
+
}, {
|
|
513
|
+
default_token_env?: string | undefined;
|
|
514
|
+
fallback_to_public?: boolean | undefined;
|
|
515
|
+
}>>;
|
|
516
|
+
}, "strip", z.ZodTypeAny, {
|
|
517
|
+
github?: {
|
|
518
|
+
default_token_env?: string | undefined;
|
|
519
|
+
fallback_to_public?: boolean | undefined;
|
|
520
|
+
} | undefined;
|
|
521
|
+
}, {
|
|
522
|
+
github?: {
|
|
523
|
+
default_token_env?: string | undefined;
|
|
524
|
+
fallback_to_public?: boolean | undefined;
|
|
525
|
+
} | undefined;
|
|
526
|
+
}>>;
|
|
527
|
+
dependencies: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
528
|
+
sources: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
529
|
+
type: z.ZodEnum<["github", "s3", "http", "local"]>;
|
|
530
|
+
token_env: z.ZodOptional<z.ZodString>;
|
|
531
|
+
token: z.ZodOptional<z.ZodString>;
|
|
532
|
+
branch: z.ZodOptional<z.ZodString>;
|
|
533
|
+
base_url: z.ZodOptional<z.ZodString>;
|
|
534
|
+
bucket: z.ZodOptional<z.ZodString>;
|
|
535
|
+
prefix: z.ZodOptional<z.ZodString>;
|
|
536
|
+
}, "strip", z.ZodTypeAny, {
|
|
537
|
+
type: "local" | "github" | "http" | "s3";
|
|
538
|
+
token?: string | undefined;
|
|
539
|
+
branch?: string | undefined;
|
|
540
|
+
bucket?: string | undefined;
|
|
541
|
+
prefix?: string | undefined;
|
|
542
|
+
token_env?: string | undefined;
|
|
543
|
+
base_url?: string | undefined;
|
|
544
|
+
}, {
|
|
545
|
+
type: "local" | "github" | "http" | "s3";
|
|
546
|
+
token?: string | undefined;
|
|
547
|
+
branch?: string | undefined;
|
|
548
|
+
bucket?: string | undefined;
|
|
549
|
+
prefix?: string | undefined;
|
|
550
|
+
token_env?: string | undefined;
|
|
551
|
+
base_url?: string | undefined;
|
|
552
|
+
}>>;
|
|
553
|
+
}, "strip", z.ZodTypeAny, {
|
|
554
|
+
sources: Record<string, {
|
|
555
|
+
type: "local" | "github" | "http" | "s3";
|
|
556
|
+
token?: string | undefined;
|
|
557
|
+
branch?: string | undefined;
|
|
558
|
+
bucket?: string | undefined;
|
|
559
|
+
prefix?: string | undefined;
|
|
560
|
+
token_env?: string | undefined;
|
|
561
|
+
base_url?: string | undefined;
|
|
562
|
+
}>;
|
|
563
|
+
}, {
|
|
564
|
+
sources: Record<string, {
|
|
565
|
+
type: "local" | "github" | "http" | "s3";
|
|
566
|
+
token?: string | undefined;
|
|
567
|
+
branch?: string | undefined;
|
|
568
|
+
bucket?: string | undefined;
|
|
569
|
+
prefix?: string | undefined;
|
|
570
|
+
token_env?: string | undefined;
|
|
571
|
+
base_url?: string | undefined;
|
|
572
|
+
}>;
|
|
573
|
+
}>>>;
|
|
504
574
|
}, "strict", z.ZodTypeAny, {
|
|
505
575
|
organizationSlug: string;
|
|
576
|
+
project?: string | undefined;
|
|
506
577
|
directories?: {
|
|
507
578
|
source?: string | undefined;
|
|
508
579
|
systems?: string | undefined;
|
|
@@ -535,8 +606,26 @@ declare const CodexConfigSchema: z.ZodObject<{
|
|
|
535
606
|
prefix?: string | undefined;
|
|
536
607
|
}>;
|
|
537
608
|
} | undefined;
|
|
609
|
+
auth?: {
|
|
610
|
+
github?: {
|
|
611
|
+
default_token_env?: string | undefined;
|
|
612
|
+
fallback_to_public?: boolean | undefined;
|
|
613
|
+
} | undefined;
|
|
614
|
+
} | undefined;
|
|
615
|
+
dependencies?: Record<string, {
|
|
616
|
+
sources: Record<string, {
|
|
617
|
+
type: "local" | "github" | "http" | "s3";
|
|
618
|
+
token?: string | undefined;
|
|
619
|
+
branch?: string | undefined;
|
|
620
|
+
bucket?: string | undefined;
|
|
621
|
+
prefix?: string | undefined;
|
|
622
|
+
token_env?: string | undefined;
|
|
623
|
+
base_url?: string | undefined;
|
|
624
|
+
}>;
|
|
625
|
+
}> | undefined;
|
|
538
626
|
}, {
|
|
539
627
|
organizationSlug: string;
|
|
628
|
+
project?: string | undefined;
|
|
540
629
|
directories?: {
|
|
541
630
|
source?: string | undefined;
|
|
542
631
|
systems?: string | undefined;
|
|
@@ -569,6 +658,23 @@ declare const CodexConfigSchema: z.ZodObject<{
|
|
|
569
658
|
prefix?: string | undefined;
|
|
570
659
|
}>;
|
|
571
660
|
} | undefined;
|
|
661
|
+
auth?: {
|
|
662
|
+
github?: {
|
|
663
|
+
default_token_env?: string | undefined;
|
|
664
|
+
fallback_to_public?: boolean | undefined;
|
|
665
|
+
} | undefined;
|
|
666
|
+
} | undefined;
|
|
667
|
+
dependencies?: Record<string, {
|
|
668
|
+
sources: Record<string, {
|
|
669
|
+
type: "local" | "github" | "http" | "s3";
|
|
670
|
+
token?: string | undefined;
|
|
671
|
+
branch?: string | undefined;
|
|
672
|
+
bucket?: string | undefined;
|
|
673
|
+
prefix?: string | undefined;
|
|
674
|
+
token_env?: string | undefined;
|
|
675
|
+
base_url?: string | undefined;
|
|
676
|
+
}>;
|
|
677
|
+
}> | undefined;
|
|
572
678
|
}>;
|
|
573
679
|
type CodexConfig = z.infer<typeof CodexConfigSchema>;
|
|
574
680
|
declare const UnifiedConfigSchema: z.ZodObject<{
|
|
@@ -614,10 +720,10 @@ declare const UnifiedConfigSchema: z.ZodObject<{
|
|
|
614
720
|
} | undefined;
|
|
615
721
|
bucket?: string | undefined;
|
|
616
722
|
prefix?: string | undefined;
|
|
617
|
-
region?: string | undefined;
|
|
618
723
|
auth?: {
|
|
619
724
|
profile?: string | undefined;
|
|
620
725
|
} | undefined;
|
|
726
|
+
region?: string | undefined;
|
|
621
727
|
}, {
|
|
622
728
|
local: {
|
|
623
729
|
base_path: string;
|
|
@@ -629,10 +735,10 @@ declare const UnifiedConfigSchema: z.ZodObject<{
|
|
|
629
735
|
} | undefined;
|
|
630
736
|
bucket?: string | undefined;
|
|
631
737
|
prefix?: string | undefined;
|
|
632
|
-
region?: string | undefined;
|
|
633
738
|
auth?: {
|
|
634
739
|
profile?: string | undefined;
|
|
635
740
|
} | undefined;
|
|
741
|
+
region?: string | undefined;
|
|
636
742
|
}>, {
|
|
637
743
|
local: {
|
|
638
744
|
base_path: string;
|
|
@@ -644,10 +750,10 @@ declare const UnifiedConfigSchema: z.ZodObject<{
|
|
|
644
750
|
} | undefined;
|
|
645
751
|
bucket?: string | undefined;
|
|
646
752
|
prefix?: string | undefined;
|
|
647
|
-
region?: string | undefined;
|
|
648
753
|
auth?: {
|
|
649
754
|
profile?: string | undefined;
|
|
650
755
|
} | undefined;
|
|
756
|
+
region?: string | undefined;
|
|
651
757
|
}, {
|
|
652
758
|
local: {
|
|
653
759
|
base_path: string;
|
|
@@ -659,13 +765,12 @@ declare const UnifiedConfigSchema: z.ZodObject<{
|
|
|
659
765
|
} | undefined;
|
|
660
766
|
bucket?: string | undefined;
|
|
661
767
|
prefix?: string | undefined;
|
|
662
|
-
region?: string | undefined;
|
|
663
768
|
auth?: {
|
|
664
769
|
profile?: string | undefined;
|
|
665
770
|
} | undefined;
|
|
771
|
+
region?: string | undefined;
|
|
666
772
|
}>>;
|
|
667
773
|
}, "strip", z.ZodTypeAny, {
|
|
668
|
-
schema_version: string;
|
|
669
774
|
sources: Record<string, {
|
|
670
775
|
local: {
|
|
671
776
|
base_path: string;
|
|
@@ -677,13 +782,13 @@ declare const UnifiedConfigSchema: z.ZodObject<{
|
|
|
677
782
|
} | undefined;
|
|
678
783
|
bucket?: string | undefined;
|
|
679
784
|
prefix?: string | undefined;
|
|
680
|
-
region?: string | undefined;
|
|
681
785
|
auth?: {
|
|
682
786
|
profile?: string | undefined;
|
|
683
787
|
} | undefined;
|
|
788
|
+
region?: string | undefined;
|
|
684
789
|
}>;
|
|
685
|
-
}, {
|
|
686
790
|
schema_version: string;
|
|
791
|
+
}, {
|
|
687
792
|
sources: Record<string, {
|
|
688
793
|
local: {
|
|
689
794
|
base_path: string;
|
|
@@ -695,14 +800,16 @@ declare const UnifiedConfigSchema: z.ZodObject<{
|
|
|
695
800
|
} | undefined;
|
|
696
801
|
bucket?: string | undefined;
|
|
697
802
|
prefix?: string | undefined;
|
|
698
|
-
region?: string | undefined;
|
|
699
803
|
auth?: {
|
|
700
804
|
profile?: string | undefined;
|
|
701
805
|
} | undefined;
|
|
806
|
+
region?: string | undefined;
|
|
702
807
|
}>;
|
|
808
|
+
schema_version: string;
|
|
703
809
|
}>>;
|
|
704
810
|
codex: z.ZodOptional<z.ZodObject<{
|
|
705
811
|
organizationSlug: z.ZodString;
|
|
812
|
+
project: z.ZodOptional<z.ZodString>;
|
|
706
813
|
directories: z.ZodOptional<z.ZodObject<{
|
|
707
814
|
source: z.ZodOptional<z.ZodString>;
|
|
708
815
|
target: z.ZodOptional<z.ZodString>;
|
|
@@ -811,8 +918,78 @@ declare const UnifiedConfigSchema: z.ZodObject<{
|
|
|
811
918
|
prefix?: string | undefined;
|
|
812
919
|
}>;
|
|
813
920
|
}>>;
|
|
921
|
+
auth: z.ZodOptional<z.ZodObject<{
|
|
922
|
+
github: z.ZodOptional<z.ZodObject<{
|
|
923
|
+
default_token_env: z.ZodOptional<z.ZodString>;
|
|
924
|
+
fallback_to_public: z.ZodOptional<z.ZodBoolean>;
|
|
925
|
+
}, "strip", z.ZodTypeAny, {
|
|
926
|
+
default_token_env?: string | undefined;
|
|
927
|
+
fallback_to_public?: boolean | undefined;
|
|
928
|
+
}, {
|
|
929
|
+
default_token_env?: string | undefined;
|
|
930
|
+
fallback_to_public?: boolean | undefined;
|
|
931
|
+
}>>;
|
|
932
|
+
}, "strip", z.ZodTypeAny, {
|
|
933
|
+
github?: {
|
|
934
|
+
default_token_env?: string | undefined;
|
|
935
|
+
fallback_to_public?: boolean | undefined;
|
|
936
|
+
} | undefined;
|
|
937
|
+
}, {
|
|
938
|
+
github?: {
|
|
939
|
+
default_token_env?: string | undefined;
|
|
940
|
+
fallback_to_public?: boolean | undefined;
|
|
941
|
+
} | undefined;
|
|
942
|
+
}>>;
|
|
943
|
+
dependencies: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
944
|
+
sources: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
945
|
+
type: z.ZodEnum<["github", "s3", "http", "local"]>;
|
|
946
|
+
token_env: z.ZodOptional<z.ZodString>;
|
|
947
|
+
token: z.ZodOptional<z.ZodString>;
|
|
948
|
+
branch: z.ZodOptional<z.ZodString>;
|
|
949
|
+
base_url: z.ZodOptional<z.ZodString>;
|
|
950
|
+
bucket: z.ZodOptional<z.ZodString>;
|
|
951
|
+
prefix: z.ZodOptional<z.ZodString>;
|
|
952
|
+
}, "strip", z.ZodTypeAny, {
|
|
953
|
+
type: "local" | "github" | "http" | "s3";
|
|
954
|
+
token?: string | undefined;
|
|
955
|
+
branch?: string | undefined;
|
|
956
|
+
bucket?: string | undefined;
|
|
957
|
+
prefix?: string | undefined;
|
|
958
|
+
token_env?: string | undefined;
|
|
959
|
+
base_url?: string | undefined;
|
|
960
|
+
}, {
|
|
961
|
+
type: "local" | "github" | "http" | "s3";
|
|
962
|
+
token?: string | undefined;
|
|
963
|
+
branch?: string | undefined;
|
|
964
|
+
bucket?: string | undefined;
|
|
965
|
+
prefix?: string | undefined;
|
|
966
|
+
token_env?: string | undefined;
|
|
967
|
+
base_url?: string | undefined;
|
|
968
|
+
}>>;
|
|
969
|
+
}, "strip", z.ZodTypeAny, {
|
|
970
|
+
sources: Record<string, {
|
|
971
|
+
type: "local" | "github" | "http" | "s3";
|
|
972
|
+
token?: string | undefined;
|
|
973
|
+
branch?: string | undefined;
|
|
974
|
+
bucket?: string | undefined;
|
|
975
|
+
prefix?: string | undefined;
|
|
976
|
+
token_env?: string | undefined;
|
|
977
|
+
base_url?: string | undefined;
|
|
978
|
+
}>;
|
|
979
|
+
}, {
|
|
980
|
+
sources: Record<string, {
|
|
981
|
+
type: "local" | "github" | "http" | "s3";
|
|
982
|
+
token?: string | undefined;
|
|
983
|
+
branch?: string | undefined;
|
|
984
|
+
bucket?: string | undefined;
|
|
985
|
+
prefix?: string | undefined;
|
|
986
|
+
token_env?: string | undefined;
|
|
987
|
+
base_url?: string | undefined;
|
|
988
|
+
}>;
|
|
989
|
+
}>>>;
|
|
814
990
|
}, "strict", z.ZodTypeAny, {
|
|
815
991
|
organizationSlug: string;
|
|
992
|
+
project?: string | undefined;
|
|
816
993
|
directories?: {
|
|
817
994
|
source?: string | undefined;
|
|
818
995
|
systems?: string | undefined;
|
|
@@ -845,8 +1022,26 @@ declare const UnifiedConfigSchema: z.ZodObject<{
|
|
|
845
1022
|
prefix?: string | undefined;
|
|
846
1023
|
}>;
|
|
847
1024
|
} | undefined;
|
|
1025
|
+
auth?: {
|
|
1026
|
+
github?: {
|
|
1027
|
+
default_token_env?: string | undefined;
|
|
1028
|
+
fallback_to_public?: boolean | undefined;
|
|
1029
|
+
} | undefined;
|
|
1030
|
+
} | undefined;
|
|
1031
|
+
dependencies?: Record<string, {
|
|
1032
|
+
sources: Record<string, {
|
|
1033
|
+
type: "local" | "github" | "http" | "s3";
|
|
1034
|
+
token?: string | undefined;
|
|
1035
|
+
branch?: string | undefined;
|
|
1036
|
+
bucket?: string | undefined;
|
|
1037
|
+
prefix?: string | undefined;
|
|
1038
|
+
token_env?: string | undefined;
|
|
1039
|
+
base_url?: string | undefined;
|
|
1040
|
+
}>;
|
|
1041
|
+
}> | undefined;
|
|
848
1042
|
}, {
|
|
849
1043
|
organizationSlug: string;
|
|
1044
|
+
project?: string | undefined;
|
|
850
1045
|
directories?: {
|
|
851
1046
|
source?: string | undefined;
|
|
852
1047
|
systems?: string | undefined;
|
|
@@ -879,10 +1074,26 @@ declare const UnifiedConfigSchema: z.ZodObject<{
|
|
|
879
1074
|
prefix?: string | undefined;
|
|
880
1075
|
}>;
|
|
881
1076
|
} | undefined;
|
|
1077
|
+
auth?: {
|
|
1078
|
+
github?: {
|
|
1079
|
+
default_token_env?: string | undefined;
|
|
1080
|
+
fallback_to_public?: boolean | undefined;
|
|
1081
|
+
} | undefined;
|
|
1082
|
+
} | undefined;
|
|
1083
|
+
dependencies?: Record<string, {
|
|
1084
|
+
sources: Record<string, {
|
|
1085
|
+
type: "local" | "github" | "http" | "s3";
|
|
1086
|
+
token?: string | undefined;
|
|
1087
|
+
branch?: string | undefined;
|
|
1088
|
+
bucket?: string | undefined;
|
|
1089
|
+
prefix?: string | undefined;
|
|
1090
|
+
token_env?: string | undefined;
|
|
1091
|
+
base_url?: string | undefined;
|
|
1092
|
+
}>;
|
|
1093
|
+
}> | undefined;
|
|
882
1094
|
}>>;
|
|
883
1095
|
}, "strip", z.ZodTypeAny, {
|
|
884
1096
|
file?: {
|
|
885
|
-
schema_version: string;
|
|
886
1097
|
sources: Record<string, {
|
|
887
1098
|
local: {
|
|
888
1099
|
base_path: string;
|
|
@@ -894,14 +1105,16 @@ declare const UnifiedConfigSchema: z.ZodObject<{
|
|
|
894
1105
|
} | undefined;
|
|
895
1106
|
bucket?: string | undefined;
|
|
896
1107
|
prefix?: string | undefined;
|
|
897
|
-
region?: string | undefined;
|
|
898
1108
|
auth?: {
|
|
899
1109
|
profile?: string | undefined;
|
|
900
1110
|
} | undefined;
|
|
1111
|
+
region?: string | undefined;
|
|
901
1112
|
}>;
|
|
1113
|
+
schema_version: string;
|
|
902
1114
|
} | undefined;
|
|
903
1115
|
codex?: {
|
|
904
1116
|
organizationSlug: string;
|
|
1117
|
+
project?: string | undefined;
|
|
905
1118
|
directories?: {
|
|
906
1119
|
source?: string | undefined;
|
|
907
1120
|
systems?: string | undefined;
|
|
@@ -934,10 +1147,26 @@ declare const UnifiedConfigSchema: z.ZodObject<{
|
|
|
934
1147
|
prefix?: string | undefined;
|
|
935
1148
|
}>;
|
|
936
1149
|
} | undefined;
|
|
1150
|
+
auth?: {
|
|
1151
|
+
github?: {
|
|
1152
|
+
default_token_env?: string | undefined;
|
|
1153
|
+
fallback_to_public?: boolean | undefined;
|
|
1154
|
+
} | undefined;
|
|
1155
|
+
} | undefined;
|
|
1156
|
+
dependencies?: Record<string, {
|
|
1157
|
+
sources: Record<string, {
|
|
1158
|
+
type: "local" | "github" | "http" | "s3";
|
|
1159
|
+
token?: string | undefined;
|
|
1160
|
+
branch?: string | undefined;
|
|
1161
|
+
bucket?: string | undefined;
|
|
1162
|
+
prefix?: string | undefined;
|
|
1163
|
+
token_env?: string | undefined;
|
|
1164
|
+
base_url?: string | undefined;
|
|
1165
|
+
}>;
|
|
1166
|
+
}> | undefined;
|
|
937
1167
|
} | undefined;
|
|
938
1168
|
}, {
|
|
939
1169
|
file?: {
|
|
940
|
-
schema_version: string;
|
|
941
1170
|
sources: Record<string, {
|
|
942
1171
|
local: {
|
|
943
1172
|
base_path: string;
|
|
@@ -949,14 +1178,16 @@ declare const UnifiedConfigSchema: z.ZodObject<{
|
|
|
949
1178
|
} | undefined;
|
|
950
1179
|
bucket?: string | undefined;
|
|
951
1180
|
prefix?: string | undefined;
|
|
952
|
-
region?: string | undefined;
|
|
953
1181
|
auth?: {
|
|
954
1182
|
profile?: string | undefined;
|
|
955
1183
|
} | undefined;
|
|
1184
|
+
region?: string | undefined;
|
|
956
1185
|
}>;
|
|
1186
|
+
schema_version: string;
|
|
957
1187
|
} | undefined;
|
|
958
1188
|
codex?: {
|
|
959
1189
|
organizationSlug: string;
|
|
1190
|
+
project?: string | undefined;
|
|
960
1191
|
directories?: {
|
|
961
1192
|
source?: string | undefined;
|
|
962
1193
|
systems?: string | undefined;
|
|
@@ -989,6 +1220,23 @@ declare const UnifiedConfigSchema: z.ZodObject<{
|
|
|
989
1220
|
prefix?: string | undefined;
|
|
990
1221
|
}>;
|
|
991
1222
|
} | undefined;
|
|
1223
|
+
auth?: {
|
|
1224
|
+
github?: {
|
|
1225
|
+
default_token_env?: string | undefined;
|
|
1226
|
+
fallback_to_public?: boolean | undefined;
|
|
1227
|
+
} | undefined;
|
|
1228
|
+
} | undefined;
|
|
1229
|
+
dependencies?: Record<string, {
|
|
1230
|
+
sources: Record<string, {
|
|
1231
|
+
type: "local" | "github" | "http" | "s3";
|
|
1232
|
+
token?: string | undefined;
|
|
1233
|
+
branch?: string | undefined;
|
|
1234
|
+
bucket?: string | undefined;
|
|
1235
|
+
prefix?: string | undefined;
|
|
1236
|
+
token_env?: string | undefined;
|
|
1237
|
+
base_url?: string | undefined;
|
|
1238
|
+
}>;
|
|
1239
|
+
}> | undefined;
|
|
992
1240
|
} | undefined;
|
|
993
1241
|
}>;
|
|
994
1242
|
type UnifiedConfig = z.infer<typeof UnifiedConfigSchema>;
|
|
@@ -1181,11 +1429,15 @@ interface StorageManagerConfig {
|
|
|
1181
1429
|
filePlugin?: FilePluginStorageOptions;
|
|
1182
1430
|
priority?: StorageProviderType[];
|
|
1183
1431
|
enableCaching?: boolean;
|
|
1432
|
+
codexConfig?: CodexConfig;
|
|
1184
1433
|
}
|
|
1185
1434
|
declare class StorageManager {
|
|
1186
1435
|
private providers;
|
|
1187
1436
|
private priority;
|
|
1437
|
+
private codexConfig?;
|
|
1188
1438
|
constructor(config?: StorageManagerConfig);
|
|
1439
|
+
private resolveToken;
|
|
1440
|
+
private resolveFetchOptions;
|
|
1189
1441
|
registerProvider(provider: StorageProvider): void;
|
|
1190
1442
|
removeProvider(type: StorageProviderType): boolean;
|
|
1191
1443
|
getProvider(type: StorageProviderType): StorageProvider | undefined;
|
package/dist/index.js
CHANGED
|
@@ -883,8 +883,40 @@ var ArchiveProjectConfigSchema = z.object({
|
|
|
883
883
|
var ArchiveConfigSchema = z.object({
|
|
884
884
|
projects: z.record(ArchiveProjectConfigSchema)
|
|
885
885
|
});
|
|
886
|
+
var GitHubAuthConfigSchema = z.object({
|
|
887
|
+
/** Default token environment variable name (default: GITHUB_TOKEN) */
|
|
888
|
+
default_token_env: z.string().optional(),
|
|
889
|
+
/** Fallback to public access if authentication fails */
|
|
890
|
+
fallback_to_public: z.boolean().optional()
|
|
891
|
+
});
|
|
892
|
+
var AuthConfigSchema = z.object({
|
|
893
|
+
/** GitHub authentication configuration */
|
|
894
|
+
github: GitHubAuthConfigSchema.optional()
|
|
895
|
+
});
|
|
896
|
+
var SourceConfigSchema = z.object({
|
|
897
|
+
/** Source type */
|
|
898
|
+
type: z.enum(["github", "s3", "http", "local"]),
|
|
899
|
+
/** Environment variable containing the authentication token */
|
|
900
|
+
token_env: z.string().optional(),
|
|
901
|
+
/** Direct token value (not recommended, use token_env instead) */
|
|
902
|
+
token: z.string().optional(),
|
|
903
|
+
/** Branch to fetch from (for GitHub sources) */
|
|
904
|
+
branch: z.string().optional(),
|
|
905
|
+
/** Base URL (for HTTP sources) */
|
|
906
|
+
base_url: z.string().optional(),
|
|
907
|
+
/** Bucket name (for S3 sources) */
|
|
908
|
+
bucket: z.string().optional(),
|
|
909
|
+
/** Prefix/path within bucket (for S3 sources) */
|
|
910
|
+
prefix: z.string().optional()
|
|
911
|
+
});
|
|
912
|
+
var DependencyConfigSchema = z.object({
|
|
913
|
+
/** Sources within this dependency */
|
|
914
|
+
sources: z.record(SourceConfigSchema)
|
|
915
|
+
});
|
|
886
916
|
var CodexConfigSchema = z.object({
|
|
887
917
|
organizationSlug: z.string(),
|
|
918
|
+
/** Project name (optional) */
|
|
919
|
+
project: z.string().optional(),
|
|
888
920
|
directories: z.object({
|
|
889
921
|
source: z.string().optional(),
|
|
890
922
|
target: z.string().optional(),
|
|
@@ -894,7 +926,11 @@ var CodexConfigSchema = z.object({
|
|
|
894
926
|
// Directional sync configuration
|
|
895
927
|
sync: DirectionalSyncSchema.optional(),
|
|
896
928
|
// Archive configuration
|
|
897
|
-
archive: ArchiveConfigSchema.optional()
|
|
929
|
+
archive: ArchiveConfigSchema.optional(),
|
|
930
|
+
// Authentication configuration
|
|
931
|
+
auth: AuthConfigSchema.optional(),
|
|
932
|
+
// Dependencies configuration (external projects)
|
|
933
|
+
dependencies: z.record(DependencyConfigSchema).optional()
|
|
898
934
|
}).strict();
|
|
899
935
|
var FileSourceSchema = z.object({
|
|
900
936
|
type: z.enum(["s3", "r2", "gcs", "local"]),
|
|
@@ -2269,7 +2305,9 @@ var S3ArchiveStorage = class {
|
|
|
2269
2305
|
var StorageManager = class {
|
|
2270
2306
|
providers = /* @__PURE__ */ new Map();
|
|
2271
2307
|
priority;
|
|
2308
|
+
codexConfig;
|
|
2272
2309
|
constructor(config = {}) {
|
|
2310
|
+
this.codexConfig = config.codexConfig;
|
|
2273
2311
|
this.providers.set("local", new LocalStorage(config.local));
|
|
2274
2312
|
this.providers.set("github", new GitHubStorage(config.github));
|
|
2275
2313
|
this.providers.set("http", new HttpStorage(config.http));
|
|
@@ -2281,6 +2319,48 @@ var StorageManager = class {
|
|
|
2281
2319
|
}
|
|
2282
2320
|
this.priority = config.priority || (config.filePlugin && config.s3Archive ? ["file-plugin", "local", "s3-archive", "github", "http"] : config.filePlugin ? ["file-plugin", "local", "github", "http"] : config.s3Archive ? ["local", "s3-archive", "github", "http"] : ["local", "github", "http"]);
|
|
2283
2321
|
}
|
|
2322
|
+
/**
|
|
2323
|
+
* Resolve authentication token for a reference
|
|
2324
|
+
*
|
|
2325
|
+
* Looks up dependency-specific authentication or falls back to default
|
|
2326
|
+
*/
|
|
2327
|
+
resolveToken(reference) {
|
|
2328
|
+
if (!this.codexConfig) {
|
|
2329
|
+
return void 0;
|
|
2330
|
+
}
|
|
2331
|
+
const dependencyKey = `${reference.org}/${reference.project}`;
|
|
2332
|
+
if (this.codexConfig.dependencies?.[dependencyKey]) {
|
|
2333
|
+
const dependency = this.codexConfig.dependencies[dependencyKey];
|
|
2334
|
+
for (const [, sourceConfig] of Object.entries(dependency.sources)) {
|
|
2335
|
+
if (sourceConfig.type === "github") {
|
|
2336
|
+
if (sourceConfig.token_env) {
|
|
2337
|
+
const token = process.env[sourceConfig.token_env];
|
|
2338
|
+
if (token) {
|
|
2339
|
+
return token;
|
|
2340
|
+
}
|
|
2341
|
+
}
|
|
2342
|
+
if (sourceConfig.token) {
|
|
2343
|
+
return sourceConfig.token;
|
|
2344
|
+
}
|
|
2345
|
+
}
|
|
2346
|
+
}
|
|
2347
|
+
}
|
|
2348
|
+
const defaultTokenEnv = this.codexConfig.auth?.github?.default_token_env || "GITHUB_TOKEN";
|
|
2349
|
+
return process.env[defaultTokenEnv];
|
|
2350
|
+
}
|
|
2351
|
+
/**
|
|
2352
|
+
* Resolve fetch options with authentication
|
|
2353
|
+
*
|
|
2354
|
+
* Merges reference-specific authentication with provided options
|
|
2355
|
+
*/
|
|
2356
|
+
resolveFetchOptions(reference, options) {
|
|
2357
|
+
const token = this.resolveToken(reference);
|
|
2358
|
+
return {
|
|
2359
|
+
...options,
|
|
2360
|
+
token: options?.token || token
|
|
2361
|
+
// Explicit option overrides resolved token
|
|
2362
|
+
};
|
|
2363
|
+
}
|
|
2284
2364
|
/**
|
|
2285
2365
|
* Register a custom storage provider
|
|
2286
2366
|
*/
|
|
@@ -2321,8 +2401,10 @@ var StorageManager = class {
|
|
|
2321
2401
|
* Fetch content for a reference
|
|
2322
2402
|
*
|
|
2323
2403
|
* Tries providers in priority order until one succeeds.
|
|
2404
|
+
* Automatically resolves authentication based on dependency configuration.
|
|
2324
2405
|
*/
|
|
2325
2406
|
async fetch(reference, options) {
|
|
2407
|
+
const resolvedOptions = this.resolveFetchOptions(reference, options);
|
|
2326
2408
|
const errors = [];
|
|
2327
2409
|
for (const type of this.priority) {
|
|
2328
2410
|
const provider = this.providers.get(type);
|
|
@@ -2330,7 +2412,7 @@ var StorageManager = class {
|
|
|
2330
2412
|
continue;
|
|
2331
2413
|
}
|
|
2332
2414
|
try {
|
|
2333
|
-
return await provider.fetch(reference,
|
|
2415
|
+
return await provider.fetch(reference, resolvedOptions);
|
|
2334
2416
|
} catch (error) {
|
|
2335
2417
|
errors.push(error instanceof Error ? error : new Error(String(error)));
|
|
2336
2418
|
}
|
|
@@ -2351,15 +2433,17 @@ var StorageManager = class {
|
|
|
2351
2433
|
* Check if content exists for a reference
|
|
2352
2434
|
*
|
|
2353
2435
|
* Returns true if any provider reports the content exists.
|
|
2436
|
+
* Automatically resolves authentication based on dependency configuration.
|
|
2354
2437
|
*/
|
|
2355
2438
|
async exists(reference, options) {
|
|
2439
|
+
const resolvedOptions = this.resolveFetchOptions(reference, options);
|
|
2356
2440
|
for (const type of this.priority) {
|
|
2357
2441
|
const provider = this.providers.get(type);
|
|
2358
2442
|
if (!provider || !provider.canHandle(reference)) {
|
|
2359
2443
|
continue;
|
|
2360
2444
|
}
|
|
2361
2445
|
try {
|
|
2362
|
-
if (await provider.exists(reference,
|
|
2446
|
+
if (await provider.exists(reference, resolvedOptions)) {
|
|
2363
2447
|
return true;
|
|
2364
2448
|
}
|
|
2365
2449
|
} catch {
|
|
@@ -2379,6 +2463,8 @@ var StorageManager = class {
|
|
|
2379
2463
|
}
|
|
2380
2464
|
/**
|
|
2381
2465
|
* Fetch multiple references in parallel
|
|
2466
|
+
*
|
|
2467
|
+
* Automatically resolves authentication for each reference based on dependency configuration.
|
|
2382
2468
|
*/
|
|
2383
2469
|
async fetchMany(references, options) {
|
|
2384
2470
|
const results = /* @__PURE__ */ new Map();
|