@fractary/codex 0.12.2 → 0.12.5

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.ts CHANGED
@@ -460,7 +460,7 @@ declare const CodexConfigSchema: z.ZodObject<{
460
460
  include: string[];
461
461
  exclude?: string[] | undefined;
462
462
  }>>;
463
- from_codex: z.ZodOptional<z.ZodObject<{
463
+ from_codex: z.ZodOptional<z.ZodEffects<z.ZodObject<{
464
464
  include: z.ZodArray<z.ZodString, "many">;
465
465
  exclude: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
466
466
  }, "strip", z.ZodTypeAny, {
@@ -469,6 +469,12 @@ declare const CodexConfigSchema: z.ZodObject<{
469
469
  }, {
470
470
  include: string[];
471
471
  exclude?: string[] | undefined;
472
+ }>, {
473
+ include: string[];
474
+ exclude?: string[] | undefined;
475
+ }, {
476
+ include: string[];
477
+ exclude?: string[] | undefined;
472
478
  }>>;
473
479
  exclude: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
474
480
  default_to_codex: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
@@ -557,52 +563,12 @@ declare const CodexConfigSchema: z.ZodObject<{
557
563
  fallback_to_public?: boolean | undefined;
558
564
  } | undefined;
559
565
  }>>;
560
- dependencies: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
561
- sources: z.ZodRecord<z.ZodString, z.ZodObject<{
562
- type: z.ZodEnum<["github", "s3", "http", "local"]>;
563
- token_env: z.ZodOptional<z.ZodString>;
564
- token: z.ZodOptional<z.ZodString>;
565
- branch: z.ZodOptional<z.ZodString>;
566
- base_url: z.ZodOptional<z.ZodString>;
567
- bucket: z.ZodOptional<z.ZodString>;
568
- prefix: z.ZodOptional<z.ZodString>;
569
- }, "strip", z.ZodTypeAny, {
570
- type: "local" | "github" | "http" | "s3";
571
- token?: string | undefined;
572
- branch?: string | undefined;
573
- bucket?: string | undefined;
574
- prefix?: string | undefined;
575
- token_env?: string | undefined;
576
- base_url?: string | undefined;
577
- }, {
578
- type: "local" | "github" | "http" | "s3";
579
- token?: string | undefined;
580
- branch?: string | undefined;
581
- bucket?: string | undefined;
582
- prefix?: string | undefined;
583
- token_env?: string | undefined;
584
- base_url?: string | undefined;
585
- }>>;
566
+ remotes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
567
+ token: z.ZodOptional<z.ZodString>;
586
568
  }, "strip", z.ZodTypeAny, {
587
- sources: Record<string, {
588
- type: "local" | "github" | "http" | "s3";
589
- token?: string | undefined;
590
- branch?: string | undefined;
591
- bucket?: string | undefined;
592
- prefix?: string | undefined;
593
- token_env?: string | undefined;
594
- base_url?: string | undefined;
595
- }>;
569
+ token?: string | undefined;
596
570
  }, {
597
- sources: Record<string, {
598
- type: "local" | "github" | "http" | "s3";
599
- token?: string | undefined;
600
- branch?: string | undefined;
601
- bucket?: string | undefined;
602
- prefix?: string | undefined;
603
- token_env?: string | undefined;
604
- base_url?: string | undefined;
605
- }>;
571
+ token?: string | undefined;
606
572
  }>>>;
607
573
  }, "strict", z.ZodTypeAny, {
608
574
  organizationSlug: string;
@@ -652,16 +618,8 @@ declare const CodexConfigSchema: z.ZodObject<{
652
618
  fallback_to_public?: boolean | undefined;
653
619
  } | undefined;
654
620
  } | undefined;
655
- dependencies?: Record<string, {
656
- sources: Record<string, {
657
- type: "local" | "github" | "http" | "s3";
658
- token?: string | undefined;
659
- branch?: string | undefined;
660
- bucket?: string | undefined;
661
- prefix?: string | undefined;
662
- token_env?: string | undefined;
663
- base_url?: string | undefined;
664
- }>;
621
+ remotes?: Record<string, {
622
+ token?: string | undefined;
665
623
  }> | undefined;
666
624
  }, {
667
625
  organizationSlug: string;
@@ -711,16 +669,8 @@ declare const CodexConfigSchema: z.ZodObject<{
711
669
  fallback_to_public?: boolean | undefined;
712
670
  } | undefined;
713
671
  } | undefined;
714
- dependencies?: Record<string, {
715
- sources: Record<string, {
716
- type: "local" | "github" | "http" | "s3";
717
- token?: string | undefined;
718
- branch?: string | undefined;
719
- bucket?: string | undefined;
720
- prefix?: string | undefined;
721
- token_env?: string | undefined;
722
- base_url?: string | undefined;
723
- }>;
672
+ remotes?: Record<string, {
673
+ token?: string | undefined;
724
674
  }> | undefined;
725
675
  }>;
726
676
  type CodexConfig = z.infer<typeof CodexConfigSchema>;
@@ -818,6 +768,7 @@ declare const UnifiedConfigSchema: z.ZodObject<{
818
768
  region?: string | undefined;
819
769
  }>>;
820
770
  }, "strip", z.ZodTypeAny, {
771
+ schema_version: string;
821
772
  sources: Record<string, {
822
773
  local: {
823
774
  base_path: string;
@@ -834,8 +785,8 @@ declare const UnifiedConfigSchema: z.ZodObject<{
834
785
  } | undefined;
835
786
  region?: string | undefined;
836
787
  }>;
837
- schema_version: string;
838
788
  }, {
789
+ schema_version: string;
839
790
  sources: Record<string, {
840
791
  local: {
841
792
  base_path: string;
@@ -852,7 +803,6 @@ declare const UnifiedConfigSchema: z.ZodObject<{
852
803
  } | undefined;
853
804
  region?: string | undefined;
854
805
  }>;
855
- schema_version: string;
856
806
  }>>;
857
807
  codex: z.ZodOptional<z.ZodObject<{
858
808
  organizationSlug: z.ZodString;
@@ -923,7 +873,7 @@ declare const UnifiedConfigSchema: z.ZodObject<{
923
873
  include: string[];
924
874
  exclude?: string[] | undefined;
925
875
  }>>;
926
- from_codex: z.ZodOptional<z.ZodObject<{
876
+ from_codex: z.ZodOptional<z.ZodEffects<z.ZodObject<{
927
877
  include: z.ZodArray<z.ZodString, "many">;
928
878
  exclude: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
929
879
  }, "strip", z.ZodTypeAny, {
@@ -932,6 +882,12 @@ declare const UnifiedConfigSchema: z.ZodObject<{
932
882
  }, {
933
883
  include: string[];
934
884
  exclude?: string[] | undefined;
885
+ }>, {
886
+ include: string[];
887
+ exclude?: string[] | undefined;
888
+ }, {
889
+ include: string[];
890
+ exclude?: string[] | undefined;
935
891
  }>>;
936
892
  exclude: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
937
893
  default_to_codex: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
@@ -1020,52 +976,12 @@ declare const UnifiedConfigSchema: z.ZodObject<{
1020
976
  fallback_to_public?: boolean | undefined;
1021
977
  } | undefined;
1022
978
  }>>;
1023
- dependencies: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
1024
- sources: z.ZodRecord<z.ZodString, z.ZodObject<{
1025
- type: z.ZodEnum<["github", "s3", "http", "local"]>;
1026
- token_env: z.ZodOptional<z.ZodString>;
1027
- token: z.ZodOptional<z.ZodString>;
1028
- branch: z.ZodOptional<z.ZodString>;
1029
- base_url: z.ZodOptional<z.ZodString>;
1030
- bucket: z.ZodOptional<z.ZodString>;
1031
- prefix: z.ZodOptional<z.ZodString>;
1032
- }, "strip", z.ZodTypeAny, {
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
- type: "local" | "github" | "http" | "s3";
1042
- token?: string | undefined;
1043
- branch?: string | undefined;
1044
- bucket?: string | undefined;
1045
- prefix?: string | undefined;
1046
- token_env?: string | undefined;
1047
- base_url?: string | undefined;
1048
- }>>;
979
+ remotes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
980
+ token: z.ZodOptional<z.ZodString>;
1049
981
  }, "strip", z.ZodTypeAny, {
1050
- sources: Record<string, {
1051
- type: "local" | "github" | "http" | "s3";
1052
- token?: string | undefined;
1053
- branch?: string | undefined;
1054
- bucket?: string | undefined;
1055
- prefix?: string | undefined;
1056
- token_env?: string | undefined;
1057
- base_url?: string | undefined;
1058
- }>;
982
+ token?: string | undefined;
1059
983
  }, {
1060
- sources: Record<string, {
1061
- type: "local" | "github" | "http" | "s3";
1062
- token?: string | undefined;
1063
- branch?: string | undefined;
1064
- bucket?: string | undefined;
1065
- prefix?: string | undefined;
1066
- token_env?: string | undefined;
1067
- base_url?: string | undefined;
1068
- }>;
984
+ token?: string | undefined;
1069
985
  }>>>;
1070
986
  }, "strict", z.ZodTypeAny, {
1071
987
  organizationSlug: string;
@@ -1115,16 +1031,8 @@ declare const UnifiedConfigSchema: z.ZodObject<{
1115
1031
  fallback_to_public?: boolean | undefined;
1116
1032
  } | undefined;
1117
1033
  } | undefined;
1118
- dependencies?: Record<string, {
1119
- sources: Record<string, {
1120
- type: "local" | "github" | "http" | "s3";
1121
- token?: string | undefined;
1122
- branch?: string | undefined;
1123
- bucket?: string | undefined;
1124
- prefix?: string | undefined;
1125
- token_env?: string | undefined;
1126
- base_url?: string | undefined;
1127
- }>;
1034
+ remotes?: Record<string, {
1035
+ token?: string | undefined;
1128
1036
  }> | undefined;
1129
1037
  }, {
1130
1038
  organizationSlug: string;
@@ -1174,20 +1082,13 @@ declare const UnifiedConfigSchema: z.ZodObject<{
1174
1082
  fallback_to_public?: boolean | undefined;
1175
1083
  } | undefined;
1176
1084
  } | undefined;
1177
- dependencies?: Record<string, {
1178
- sources: Record<string, {
1179
- type: "local" | "github" | "http" | "s3";
1180
- token?: string | undefined;
1181
- branch?: string | undefined;
1182
- bucket?: string | undefined;
1183
- prefix?: string | undefined;
1184
- token_env?: string | undefined;
1185
- base_url?: string | undefined;
1186
- }>;
1085
+ remotes?: Record<string, {
1086
+ token?: string | undefined;
1187
1087
  }> | undefined;
1188
1088
  }>>;
1189
1089
  }, "strip", z.ZodTypeAny, {
1190
1090
  file?: {
1091
+ schema_version: string;
1191
1092
  sources: Record<string, {
1192
1093
  local: {
1193
1094
  base_path: string;
@@ -1204,7 +1105,6 @@ declare const UnifiedConfigSchema: z.ZodObject<{
1204
1105
  } | undefined;
1205
1106
  region?: string | undefined;
1206
1107
  }>;
1207
- schema_version: string;
1208
1108
  } | undefined;
1209
1109
  codex?: {
1210
1110
  organizationSlug: string;
@@ -1254,20 +1154,13 @@ declare const UnifiedConfigSchema: z.ZodObject<{
1254
1154
  fallback_to_public?: boolean | undefined;
1255
1155
  } | undefined;
1256
1156
  } | undefined;
1257
- dependencies?: Record<string, {
1258
- sources: Record<string, {
1259
- type: "local" | "github" | "http" | "s3";
1260
- token?: string | undefined;
1261
- branch?: string | undefined;
1262
- bucket?: string | undefined;
1263
- prefix?: string | undefined;
1264
- token_env?: string | undefined;
1265
- base_url?: string | undefined;
1266
- }>;
1157
+ remotes?: Record<string, {
1158
+ token?: string | undefined;
1267
1159
  }> | undefined;
1268
1160
  } | undefined;
1269
1161
  }, {
1270
1162
  file?: {
1163
+ schema_version: string;
1271
1164
  sources: Record<string, {
1272
1165
  local: {
1273
1166
  base_path: string;
@@ -1284,7 +1177,6 @@ declare const UnifiedConfigSchema: z.ZodObject<{
1284
1177
  } | undefined;
1285
1178
  region?: string | undefined;
1286
1179
  }>;
1287
- schema_version: string;
1288
1180
  } | undefined;
1289
1181
  codex?: {
1290
1182
  organizationSlug: string;
@@ -1334,16 +1226,8 @@ declare const UnifiedConfigSchema: z.ZodObject<{
1334
1226
  fallback_to_public?: boolean | undefined;
1335
1227
  } | undefined;
1336
1228
  } | undefined;
1337
- dependencies?: Record<string, {
1338
- sources: Record<string, {
1339
- type: "local" | "github" | "http" | "s3";
1340
- token?: string | undefined;
1341
- branch?: string | undefined;
1342
- bucket?: string | undefined;
1343
- prefix?: string | undefined;
1344
- token_env?: string | undefined;
1345
- base_url?: string | undefined;
1346
- }>;
1229
+ remotes?: Record<string, {
1230
+ token?: string | undefined;
1347
1231
  }> | undefined;
1348
1232
  } | undefined;
1349
1233
  }>;
@@ -1398,6 +1282,41 @@ interface LoadConfigOptions {
1398
1282
  }
1399
1283
  declare function loadConfig(options?: LoadConfigOptions): CodexConfig;
1400
1284
 
1285
+ declare const CONFIG_SCHEMA_VERSION: "2.0";
1286
+ interface SyncPresetConfig {
1287
+ to_codex: {
1288
+ include: string[];
1289
+ exclude?: string[];
1290
+ };
1291
+ from_codex: {
1292
+ include: string[];
1293
+ exclude?: string[];
1294
+ };
1295
+ }
1296
+ interface SyncPreset {
1297
+ readonly name: string;
1298
+ readonly description: string;
1299
+ readonly config: {
1300
+ readonly to_codex: {
1301
+ readonly include: readonly string[];
1302
+ readonly exclude?: readonly string[];
1303
+ };
1304
+ readonly from_codex: {
1305
+ readonly include: readonly string[];
1306
+ readonly exclude?: readonly string[];
1307
+ };
1308
+ };
1309
+ }
1310
+ declare const SYNC_PATTERN_PRESETS: Record<string, SyncPreset>;
1311
+ declare const DEFAULT_GLOBAL_EXCLUDES: readonly ["**/.git/**", "**/node_modules/**", "**/.env", "**/.env.*", "**/*.log", "**/dist/**", "**/build/**", "**/.DS_Store", "**/credentials.json", "**/*secret*", "**/*password*"];
1312
+ declare function getSyncPreset(name: string): SyncPreset | undefined;
1313
+ declare function getSyncPresetNames(): string[];
1314
+ declare function substitutePatternPlaceholders(patterns: readonly string[], org: string, codexRepo: string): string[];
1315
+ interface GenerateSyncConfigOptions {
1316
+ includeGlobalExcludes?: boolean;
1317
+ }
1318
+ declare function generateSyncConfigFromPreset(presetName: string, org: string, codexRepo: string, options?: GenerateSyncConfigOptions): SyncPresetConfig | undefined;
1319
+
1401
1320
  interface ShouldSyncOptions {
1402
1321
  filePath: string;
1403
1322
  fileMetadata: Metadata;
@@ -1544,6 +1463,7 @@ declare class StorageManager {
1544
1463
  private priority;
1545
1464
  private codexConfig?;
1546
1465
  constructor(config?: StorageManagerConfig);
1466
+ private resolveTokenValue;
1547
1467
  private resolveToken;
1548
1468
  private resolveFetchOptions;
1549
1469
  registerProvider(provider: StorageProvider): void;
@@ -2237,4 +2157,4 @@ declare function formatSeconds(seconds: number): string;
2237
2157
  declare function isValidDuration(value: string): boolean;
2238
2158
  declare function isValidSize(value: string): boolean;
2239
2159
 
2240
- export { type ArchiveConfig, type ArtifactType, type AutoSyncPattern, AutoSyncPatternSchema, BUILT_IN_TYPES, CODEX_URI_PREFIX, type CacheEntry, type CacheEntryMetadata, type CacheEntryStatus, type CacheLookupResult, CacheManager, type CacheManagerConfig, CachePersistence, type CachePersistenceOptions, type CacheStats, type CodexConfig, CodexConfigSchema, CodexError, type CodexYamlConfig, CommonRules, ConfigurationError, type ConversionOptions, type ConvertedReference, type CustomSyncDestination, type CustomTypeConfig$1 as CustomTypeConfig, CustomTypeSchema, DEFAULT_CACHE_DIR, DEFAULT_FETCH_OPTIONS, DEFAULT_MIGRATION_OPTIONS, DEFAULT_PERMISSION_CONFIG, DEFAULT_SYNC_CONFIG, DEFAULT_TYPE, type DirectionalSyncConfig, type EvaluationResult, type EvaluationSummary, type ExpandEnvOptions, type FetchOptions, type FetchResult, type FileConfig, type FileInfo, FilePluginFileNotFoundError, type FilePluginFileNotFoundErrorOptions, FilePluginStorage, type FilePluginStorageOptions, type FileSyncStatus, GitHubStorage, type GitHubStorageOptions, HttpStorage, type HttpStorageOptions, LEGACY_PATTERNS, LEGACY_REF_PREFIX, type LegacyAutoSyncPattern, type LegacyCodexConfig, type LoadConfigOptions, LocalStorage, type LocalStorageOptions, type Metadata, MetadataSchema, type MigrationChange, type MigrationOptions, type MigrationResult, type ModernCodexConfig, type ModernSyncPattern, PERMISSION_LEVEL_ORDER, type ParseMetadataOptions, type ParseOptions, type ParseResult, type ParsedReference, type PermissionAction, type PermissionConfig, type PermissionContext, PermissionDeniedError, type PermissionLevel$1 as PermissionLevel, PermissionManager, type PermissionManagerConfig, type PermissionResult, type PermissionRule$1 as PermissionRule, type PermissionScope, type PlanStats, type ReadConfigOptions, type ReferenceConversionResult, type ResolveOptions, type ResolveOrgOptions, type ResolvedReference, type SerializedCacheEntry, type ShouldSyncOptions, StorageManager, type StorageManagerConfig, type StorageProvider, type StorageProviderConfig$1 as StorageProviderConfig, type StorageProviderType$1 as StorageProviderType, type SyncConfig$1 as SyncConfig, type SyncDirection, SyncManager, type SyncManagerConfig, type SyncManifest, type SyncManifestEntry, type SyncOperation, type SyncOptions, type SyncPlan, type SyncResult, type SyncRule$1 as SyncRule, type SyncRules, SyncRulesSchema, TTL, TypeRegistry, type TypeRegistryOptions, type TypesConfig$1 as TypesConfig, TypesConfigSchema, type UnifiedConfig, ValidationError, type VersionDetectionResult, type CacheConfig as YamlCacheConfig, type CustomTypeConfig as YamlCustomTypeConfig, type GitHubStorageConfig as YamlGitHubStorageConfig, type HttpStorageConfig as YamlHttpStorageConfig, type LocalStorageConfig as YamlLocalStorageConfig, type McpConfig as YamlMcpConfig, type PermissionLevel as YamlPermissionLevel, type PermissionRule as YamlPermissionRule, type PermissionsConfig as YamlPermissionsConfig, type S3StorageConfig as YamlS3StorageConfig, type StorageProviderConfig as YamlStorageProviderConfig, type StorageProviderType as YamlStorageProviderType, type SyncConfig as YamlSyncConfig, type SyncRule as YamlSyncRule, type TypesConfig as YamlTypesConfig, buildUri, calculateCachePath, calculateContentHash, convertLegacyReference, convertLegacyReferences, convertToUri, createCacheEntry, createCacheManager, createCachePersistence, createDefaultRegistry, createEmptyModernConfig, createEmptySyncPlan, createGitHubStorage, createHttpStorage, createLocalStorage, createPermissionManager, createRule, createRulesFromPatterns, createStorageManager, createSyncManager, createSyncPlan, deserializeCacheEntry, detectContentType, detectCurrentProject, detectVersion, estimateSyncTime, evaluatePath, evaluatePaths, evaluatePatterns, evaluatePermission, evaluatePermissions, expandEnvVars, expandEnvVarsInConfig, extendType, extractEnvVarNames, extractOrgFromRepoName, extractRawFrontmatter, filterByPatterns, filterByPermission, filterPlanOperations, filterSyncablePaths, findLegacyReferences, formatBytes, formatDuration, formatPlanSummary, formatSeconds, generateMigrationReport, generateReferenceMigrationSummary, getBuiltInType, getBuiltInTypeNames, getCacheEntryAge, getCacheEntryStatus, getCurrentContext, getCustomSyncDestinations, getDefaultCacheManager, getDefaultConfig, getDefaultDirectories, getDefaultPermissionManager, getDefaultRules, getDefaultStorageManager, getDirectory, getExtension, getFilename, getMigrationRequirements, getPlanStats, getRelativeCachePath, getRemainingTtl, getTargetRepos, hasContentChanged, hasEnvVars, hasFrontmatter, hasLegacyReferences, hasPermission as hasPermissionLevel, isBuiltInType, isCacheEntryFresh, isCacheEntryValid, isCurrentProjectUri, isLegacyConfig, isLegacyReference, isModernConfig, isAllowed as isPermissionAllowed, isUnifiedConfig, isValidDuration, isValidSize, isValidUri, levelGrants, loadConfig, loadCustomTypes, matchAnyPattern, matchPattern, maxLevel, mergeFetchOptions, mergeRules, mergeTypes, migrateConfig, migrateFileReferences, minLevel, needsMigration, parseCustomDestination, parseDuration, parseMetadata, parseReference, parseSize, parseTtl, readCodexConfig, readUnifiedConfig, resolveOrganization, resolveReference, resolveReferences, ruleMatchesAction, ruleMatchesContext, ruleMatchesPath, sanitizePath, serializeCacheEntry, setDefaultCacheManager, setDefaultPermissionManager, setDefaultStorageManager, shouldSyncToRepo, summarizeEvaluations, touchCacheEntry, validateCustomTypes, validateMetadata, validateMigratedConfig, validateOrg, validatePath, validateRules as validatePermissionRules, validateProject, validateRules$1 as validateRules, validateUri };
2160
+ export { type ArchiveConfig, type ArtifactType, type AutoSyncPattern, AutoSyncPatternSchema, BUILT_IN_TYPES, CODEX_URI_PREFIX, CONFIG_SCHEMA_VERSION, type CacheEntry, type CacheEntryMetadata, type CacheEntryStatus, type CacheLookupResult, CacheManager, type CacheManagerConfig, CachePersistence, type CachePersistenceOptions, type CacheStats, type CodexConfig, CodexConfigSchema, CodexError, type CodexYamlConfig, CommonRules, ConfigurationError, type ConversionOptions, type ConvertedReference, type CustomSyncDestination, type CustomTypeConfig$1 as CustomTypeConfig, CustomTypeSchema, DEFAULT_CACHE_DIR, DEFAULT_FETCH_OPTIONS, DEFAULT_GLOBAL_EXCLUDES, DEFAULT_MIGRATION_OPTIONS, DEFAULT_PERMISSION_CONFIG, DEFAULT_SYNC_CONFIG, DEFAULT_TYPE, type DirectionalSyncConfig, type EvaluationResult, type EvaluationSummary, type ExpandEnvOptions, type FetchOptions, type FetchResult, type FileConfig, type FileInfo, FilePluginFileNotFoundError, type FilePluginFileNotFoundErrorOptions, FilePluginStorage, type FilePluginStorageOptions, type FileSyncStatus, type GenerateSyncConfigOptions, GitHubStorage, type GitHubStorageOptions, HttpStorage, type HttpStorageOptions, LEGACY_PATTERNS, LEGACY_REF_PREFIX, type LegacyAutoSyncPattern, type LegacyCodexConfig, type LoadConfigOptions, LocalStorage, type LocalStorageOptions, type Metadata, MetadataSchema, type MigrationChange, type MigrationOptions, type MigrationResult, type ModernCodexConfig, type ModernSyncPattern, PERMISSION_LEVEL_ORDER, type ParseMetadataOptions, type ParseOptions, type ParseResult, type ParsedReference, type PermissionAction, type PermissionConfig, type PermissionContext, PermissionDeniedError, type PermissionLevel$1 as PermissionLevel, PermissionManager, type PermissionManagerConfig, type PermissionResult, type PermissionRule$1 as PermissionRule, type PermissionScope, type PlanStats, type ReadConfigOptions, type ReferenceConversionResult, type ResolveOptions, type ResolveOrgOptions, type ResolvedReference, SYNC_PATTERN_PRESETS, type SerializedCacheEntry, type ShouldSyncOptions, StorageManager, type StorageManagerConfig, type StorageProvider, type StorageProviderConfig$1 as StorageProviderConfig, type StorageProviderType$1 as StorageProviderType, type SyncConfig$1 as SyncConfig, type SyncDirection, SyncManager, type SyncManagerConfig, type SyncManifest, type SyncManifestEntry, type SyncOperation, type SyncOptions, type SyncPlan, type SyncPreset, type SyncPresetConfig, type SyncResult, type SyncRule$1 as SyncRule, type SyncRules, SyncRulesSchema, TTL, TypeRegistry, type TypeRegistryOptions, type TypesConfig$1 as TypesConfig, TypesConfigSchema, type UnifiedConfig, ValidationError, type VersionDetectionResult, type CacheConfig as YamlCacheConfig, type CustomTypeConfig as YamlCustomTypeConfig, type GitHubStorageConfig as YamlGitHubStorageConfig, type HttpStorageConfig as YamlHttpStorageConfig, type LocalStorageConfig as YamlLocalStorageConfig, type McpConfig as YamlMcpConfig, type PermissionLevel as YamlPermissionLevel, type PermissionRule as YamlPermissionRule, type PermissionsConfig as YamlPermissionsConfig, type S3StorageConfig as YamlS3StorageConfig, type StorageProviderConfig as YamlStorageProviderConfig, type StorageProviderType as YamlStorageProviderType, type SyncConfig as YamlSyncConfig, type SyncRule as YamlSyncRule, type TypesConfig as YamlTypesConfig, buildUri, calculateCachePath, calculateContentHash, convertLegacyReference, convertLegacyReferences, convertToUri, createCacheEntry, createCacheManager, createCachePersistence, createDefaultRegistry, createEmptyModernConfig, createEmptySyncPlan, createGitHubStorage, createHttpStorage, createLocalStorage, createPermissionManager, createRule, createRulesFromPatterns, createStorageManager, createSyncManager, createSyncPlan, deserializeCacheEntry, detectContentType, detectCurrentProject, detectVersion, estimateSyncTime, evaluatePath, evaluatePaths, evaluatePatterns, evaluatePermission, evaluatePermissions, expandEnvVars, expandEnvVarsInConfig, extendType, extractEnvVarNames, extractOrgFromRepoName, extractRawFrontmatter, filterByPatterns, filterByPermission, filterPlanOperations, filterSyncablePaths, findLegacyReferences, formatBytes, formatDuration, formatPlanSummary, formatSeconds, generateMigrationReport, generateReferenceMigrationSummary, generateSyncConfigFromPreset, getBuiltInType, getBuiltInTypeNames, getCacheEntryAge, getCacheEntryStatus, getCurrentContext, getCustomSyncDestinations, getDefaultCacheManager, getDefaultConfig, getDefaultDirectories, getDefaultPermissionManager, getDefaultRules, getDefaultStorageManager, getDirectory, getExtension, getFilename, getMigrationRequirements, getPlanStats, getRelativeCachePath, getRemainingTtl, getSyncPreset, getSyncPresetNames, getTargetRepos, hasContentChanged, hasEnvVars, hasFrontmatter, hasLegacyReferences, hasPermission as hasPermissionLevel, isBuiltInType, isCacheEntryFresh, isCacheEntryValid, isCurrentProjectUri, isLegacyConfig, isLegacyReference, isModernConfig, isAllowed as isPermissionAllowed, isUnifiedConfig, isValidDuration, isValidSize, isValidUri, levelGrants, loadConfig, loadCustomTypes, matchAnyPattern, matchPattern, maxLevel, mergeFetchOptions, mergeRules, mergeTypes, migrateConfig, migrateFileReferences, minLevel, needsMigration, parseCustomDestination, parseDuration, parseMetadata, parseReference, parseSize, parseTtl, readCodexConfig, readUnifiedConfig, resolveOrganization, resolveReference, resolveReferences, ruleMatchesAction, ruleMatchesContext, ruleMatchesPath, sanitizePath, serializeCacheEntry, setDefaultCacheManager, setDefaultPermissionManager, setDefaultStorageManager, shouldSyncToRepo, substitutePatternPlaceholders, summarizeEvaluations, touchCacheEntry, validateCustomTypes, validateMetadata, validateMigratedConfig, validateOrg, validatePath, validateRules as validatePermissionRules, validateProject, validateRules$1 as validateRules, validateUri };
package/dist/index.js CHANGED
@@ -899,12 +899,24 @@ var DirectionalSyncConfigSchema = z.object({
899
899
  /** Patterns to exclude (optional) */
900
900
  exclude: z.array(z.string()).optional()
901
901
  });
902
+ var FromCodexSyncConfigSchema = DirectionalSyncConfigSchema.refine(
903
+ (config) => {
904
+ const includeValid = config.include.every(
905
+ (pattern) => pattern.startsWith("codex://")
906
+ );
907
+ const excludeValid = !config.exclude || config.exclude.every((pattern) => pattern.startsWith("codex://"));
908
+ return includeValid && excludeValid;
909
+ },
910
+ {
911
+ message: 'from_codex patterns must use codex:// URI format (e.g., "codex://{org}/{codex_repo}/docs/**"). Plain paths like "docs/**" are not valid for from_codex.'
912
+ }
913
+ );
902
914
  var DirectionalSyncSchema = z.object({
903
915
  // New format (v0.7.0+) - Recommended
904
- // Patterns for files to push from this project to codex
916
+ // Patterns for files to push from this project to codex (plain paths)
905
917
  to_codex: DirectionalSyncConfigSchema.optional(),
906
- // Patterns for files to pull from codex to this project
907
- from_codex: DirectionalSyncConfigSchema.optional(),
918
+ // Patterns for files to pull from codex to this project (codex:// URIs required)
919
+ from_codex: FromCodexSyncConfigSchema.optional(),
908
920
  // Global exclude patterns (applied to both directions)
909
921
  exclude: z.array(z.string()).optional(),
910
922
  // Legacy format (deprecated, backward compatible)
@@ -932,25 +944,9 @@ var AuthConfigSchema = z.object({
932
944
  /** GitHub authentication configuration */
933
945
  github: GitHubAuthConfigSchema.optional()
934
946
  });
935
- var SourceConfigSchema = z.object({
936
- /** Source type */
937
- type: z.enum(["github", "s3", "http", "local"]),
938
- /** Environment variable containing the authentication token */
939
- token_env: z.string().optional(),
940
- /** Direct token value (not recommended, use token_env instead) */
941
- token: z.string().optional(),
942
- /** Branch to fetch from (for GitHub sources) */
943
- branch: z.string().optional(),
944
- /** Base URL (for HTTP sources) */
945
- base_url: z.string().optional(),
946
- /** Bucket name (for S3 sources) */
947
- bucket: z.string().optional(),
948
- /** Prefix/path within bucket (for S3 sources) */
949
- prefix: z.string().optional()
950
- });
951
- var DependencyConfigSchema = z.object({
952
- /** Sources within this dependency */
953
- sources: z.record(SourceConfigSchema)
947
+ var RemoteConfigSchema = z.object({
948
+ /** Authentication token - can be direct value or ${ENV_VAR} reference */
949
+ token: z.string().optional()
954
950
  });
955
951
  var CodexConfigSchema = z.object({
956
952
  organizationSlug: z.string(),
@@ -968,8 +964,9 @@ var CodexConfigSchema = z.object({
968
964
  archive: ArchiveConfigSchema.optional(),
969
965
  // Authentication configuration
970
966
  auth: AuthConfigSchema.optional(),
971
- // Dependencies configuration (external projects)
972
- dependencies: z.record(DependencyConfigSchema).optional()
967
+ // Remote repositories configuration (external projects)
968
+ // Keys are org/project identifiers, values configure authentication
969
+ remotes: z.record(RemoteConfigSchema).optional()
973
970
  }).strict();
974
971
  var FileSourceSchema = z.object({
975
972
  type: z.enum(["s3", "r2", "gcs", "local"]),
@@ -1214,6 +1211,99 @@ function mergeConfigs(base, override) {
1214
1211
  };
1215
1212
  }
1216
1213
 
1214
+ // src/core/config/sync-presets.ts
1215
+ var CONFIG_SCHEMA_VERSION = "2.0";
1216
+ var SYNC_PATTERN_PRESETS = {
1217
+ standard: {
1218
+ name: "standard",
1219
+ description: "Standard configuration with docs, README, and CLAUDE.md",
1220
+ config: {
1221
+ to_codex: {
1222
+ include: ["docs/**", "README.md", "CLAUDE.md"],
1223
+ exclude: ["*.tmp"]
1224
+ },
1225
+ from_codex: {
1226
+ include: ["codex://{org}/{codex_repo}/docs/**"]
1227
+ }
1228
+ }
1229
+ },
1230
+ minimal: {
1231
+ name: "minimal",
1232
+ description: "Minimal configuration with just docs and README",
1233
+ config: {
1234
+ to_codex: {
1235
+ include: ["docs/**", "README.md"]
1236
+ },
1237
+ from_codex: {
1238
+ include: ["codex://{org}/{codex_repo}/docs/**"]
1239
+ }
1240
+ }
1241
+ }
1242
+ };
1243
+ var DEFAULT_GLOBAL_EXCLUDES = [
1244
+ "**/.git/**",
1245
+ "**/node_modules/**",
1246
+ "**/.env",
1247
+ "**/.env.*",
1248
+ "**/*.log",
1249
+ "**/dist/**",
1250
+ "**/build/**",
1251
+ "**/.DS_Store",
1252
+ "**/credentials.json",
1253
+ "**/*secret*",
1254
+ "**/*password*"
1255
+ ];
1256
+ function getSyncPreset(name) {
1257
+ return SYNC_PATTERN_PRESETS[name];
1258
+ }
1259
+ function getSyncPresetNames() {
1260
+ return Object.keys(SYNC_PATTERN_PRESETS);
1261
+ }
1262
+ function substitutePatternPlaceholders(patterns, org, codexRepo) {
1263
+ if (!org || typeof org !== "string" || org.trim() === "") {
1264
+ throw new ValidationError("org must be a non-empty string");
1265
+ }
1266
+ if (!codexRepo || typeof codexRepo !== "string" || codexRepo.trim() === "") {
1267
+ throw new ValidationError("codexRepo must be a non-empty string");
1268
+ }
1269
+ return patterns.map(
1270
+ (pattern) => pattern.replace(/\{org\}/g, org).replace(/\{codex_repo\}/g, codexRepo)
1271
+ );
1272
+ }
1273
+ function generateSyncConfigFromPreset(presetName, org, codexRepo, options) {
1274
+ const preset = getSyncPreset(presetName);
1275
+ if (!preset) {
1276
+ return void 0;
1277
+ }
1278
+ let toCodexExclude;
1279
+ if (options?.includeGlobalExcludes) {
1280
+ toCodexExclude = [
1281
+ ...preset.config.to_codex.exclude || [],
1282
+ ...DEFAULT_GLOBAL_EXCLUDES
1283
+ ];
1284
+ } else if (preset.config.to_codex.exclude) {
1285
+ toCodexExclude = [...preset.config.to_codex.exclude];
1286
+ }
1287
+ return {
1288
+ to_codex: {
1289
+ include: [...preset.config.to_codex.include],
1290
+ exclude: toCodexExclude
1291
+ },
1292
+ from_codex: {
1293
+ include: substitutePatternPlaceholders(
1294
+ preset.config.from_codex.include,
1295
+ org,
1296
+ codexRepo
1297
+ ),
1298
+ exclude: preset.config.from_codex.exclude ? substitutePatternPlaceholders(
1299
+ preset.config.from_codex.exclude,
1300
+ org,
1301
+ codexRepo
1302
+ ) : void 0
1303
+ }
1304
+ };
1305
+ }
1306
+
1217
1307
  // src/core/routing/evaluator.ts
1218
1308
  init_matcher();
1219
1309
  function shouldSyncToRepo(options) {
@@ -2358,30 +2448,31 @@ var StorageManager = class {
2358
2448
  }
2359
2449
  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"]);
2360
2450
  }
2451
+ /**
2452
+ * Resolve a token value, expanding ${VAR} references to environment variables
2453
+ */
2454
+ resolveTokenValue(token) {
2455
+ const envVarMatch = token.match(/^\$\{([^}]+)\}$/);
2456
+ if (envVarMatch && envVarMatch[1]) {
2457
+ const envVarName = envVarMatch[1];
2458
+ return process.env[envVarName];
2459
+ }
2460
+ return token;
2461
+ }
2361
2462
  /**
2362
2463
  * Resolve authentication token for a reference
2363
2464
  *
2364
- * Looks up dependency-specific authentication or falls back to default
2465
+ * Looks up remote-specific authentication or falls back to default
2365
2466
  */
2366
2467
  resolveToken(reference) {
2367
2468
  if (!this.codexConfig) {
2368
2469
  return void 0;
2369
2470
  }
2370
- const dependencyKey = `${reference.org}/${reference.project}`;
2371
- if (this.codexConfig.dependencies?.[dependencyKey]) {
2372
- const dependency = this.codexConfig.dependencies[dependencyKey];
2373
- for (const [, sourceConfig] of Object.entries(dependency.sources)) {
2374
- if (sourceConfig.type === "github") {
2375
- if (sourceConfig.token_env) {
2376
- const token = process.env[sourceConfig.token_env];
2377
- if (token) {
2378
- return token;
2379
- }
2380
- }
2381
- if (sourceConfig.token) {
2382
- return sourceConfig.token;
2383
- }
2384
- }
2471
+ const remoteKey = `${reference.org}/${reference.project}`;
2472
+ if (this.codexConfig.remotes?.[remoteKey]?.token) {
2473
+ const token = this.resolveTokenValue(this.codexConfig.remotes[remoteKey].token);
2474
+ if (token) {
2475
+ return token;
2385
2476
  }
2386
2477
  }
2387
2478
  const defaultTokenEnv = this.codexConfig.auth?.github?.default_token_env || "GITHUB_TOKEN";
@@ -2440,7 +2531,7 @@ var StorageManager = class {
2440
2531
  * Fetch content for a reference
2441
2532
  *
2442
2533
  * Tries providers in priority order until one succeeds.
2443
- * Automatically resolves authentication based on dependency configuration.
2534
+ * Automatically resolves authentication based on remote configuration.
2444
2535
  */
2445
2536
  async fetch(reference, options) {
2446
2537
  const resolvedOptions = this.resolveFetchOptions(reference, options);
@@ -2472,7 +2563,7 @@ var StorageManager = class {
2472
2563
  * Check if content exists for a reference
2473
2564
  *
2474
2565
  * Returns true if any provider reports the content exists.
2475
- * Automatically resolves authentication based on dependency configuration.
2566
+ * Automatically resolves authentication based on remote configuration.
2476
2567
  */
2477
2568
  async exists(reference, options) {
2478
2569
  const resolvedOptions = this.resolveFetchOptions(reference, options);
@@ -5115,6 +5206,6 @@ function isValidSize(value) {
5115
5206
  return /^\d+(?:\.\d+)?\s*(B|KB|MB|GB|TB)$/i.test(value);
5116
5207
  }
5117
5208
 
5118
- export { AutoSyncPatternSchema, BUILT_IN_TYPES, CODEX_URI_PREFIX, CacheManager, CachePersistence, CodexConfigSchema, CodexError, CommonRules, ConfigurationError, CustomTypeSchema, DEFAULT_CACHE_DIR, DEFAULT_FETCH_OPTIONS, DEFAULT_MIGRATION_OPTIONS, DEFAULT_PERMISSION_CONFIG, DEFAULT_SYNC_CONFIG, DEFAULT_TYPE, FilePluginFileNotFoundError, FilePluginStorage, GitHubStorage, HttpStorage, LEGACY_PATTERNS, LEGACY_REF_PREFIX, LocalStorage, MetadataSchema, PERMISSION_LEVEL_ORDER, PermissionDeniedError, PermissionManager, StorageManager, SyncManager, SyncRulesSchema, TTL, TypeRegistry, TypesConfigSchema, ValidationError, buildUri, calculateCachePath, calculateContentHash, convertLegacyReference, convertLegacyReferences, convertToUri, createCacheEntry, createCacheManager, createCachePersistence, createDefaultRegistry, createEmptyModernConfig, createEmptySyncPlan, createGitHubStorage, createHttpStorage, createLocalStorage, createPermissionManager, createRule, createRulesFromPatterns, createStorageManager, createSyncManager, createSyncPlan, deserializeCacheEntry, detectContentType, detectCurrentProject, detectVersion, estimateSyncTime, evaluatePath, evaluatePaths, evaluatePatterns, evaluatePermission, evaluatePermissions, expandEnvVars, expandEnvVarsInConfig, extendType, extractEnvVarNames, extractOrgFromRepoName, extractRawFrontmatter, filterByPatterns, filterByPermission, filterPlanOperations, filterSyncablePaths, findLegacyReferences, formatBytes2 as formatBytes, formatDuration, formatPlanSummary, formatSeconds, generateMigrationReport, generateReferenceMigrationSummary, getBuiltInType, getBuiltInTypeNames, getCacheEntryAge, getCacheEntryStatus, getCurrentContext, getCustomSyncDestinations, getDefaultCacheManager, getDefaultConfig, getDefaultDirectories, getDefaultPermissionManager, getDefaultRules, getDefaultStorageManager, getDirectory, getExtension, getFilename, getMigrationRequirements, getPlanStats, getRelativeCachePath, getRemainingTtl, getTargetRepos, hasContentChanged, hasEnvVars, hasFrontmatter, hasLegacyReferences, hasPermission as hasPermissionLevel, isBuiltInType, isCacheEntryFresh, isCacheEntryValid, isCurrentProjectUri, isLegacyConfig, isLegacyReference, isModernConfig, isAllowed as isPermissionAllowed, isUnifiedConfig, isValidDuration, isValidSize, isValidUri, levelGrants, loadConfig, loadCustomTypes, matchAnyPattern, matchPattern, maxLevel, mergeFetchOptions, mergeRules, mergeTypes, migrateConfig, migrateFileReferences, minLevel, needsMigration, parseCustomDestination, parseDuration, parseMetadata, parseReference, parseSize, parseTtl, readCodexConfig, readUnifiedConfig, resolveOrganization, resolveReference, resolveReferences, ruleMatchesAction, ruleMatchesContext, ruleMatchesPath, sanitizePath, serializeCacheEntry, setDefaultCacheManager, setDefaultPermissionManager, setDefaultStorageManager, shouldSyncToRepo, summarizeEvaluations, touchCacheEntry, validateCustomTypes, validateMetadata, validateMigratedConfig, validateOrg, validatePath, validateRules2 as validatePermissionRules, validateProject, validateRules, validateUri };
5209
+ export { AutoSyncPatternSchema, BUILT_IN_TYPES, CODEX_URI_PREFIX, CONFIG_SCHEMA_VERSION, CacheManager, CachePersistence, CodexConfigSchema, CodexError, CommonRules, ConfigurationError, CustomTypeSchema, DEFAULT_CACHE_DIR, DEFAULT_FETCH_OPTIONS, DEFAULT_GLOBAL_EXCLUDES, DEFAULT_MIGRATION_OPTIONS, DEFAULT_PERMISSION_CONFIG, DEFAULT_SYNC_CONFIG, DEFAULT_TYPE, FilePluginFileNotFoundError, FilePluginStorage, GitHubStorage, HttpStorage, LEGACY_PATTERNS, LEGACY_REF_PREFIX, LocalStorage, MetadataSchema, PERMISSION_LEVEL_ORDER, PermissionDeniedError, PermissionManager, SYNC_PATTERN_PRESETS, StorageManager, SyncManager, SyncRulesSchema, TTL, TypeRegistry, TypesConfigSchema, ValidationError, buildUri, calculateCachePath, calculateContentHash, convertLegacyReference, convertLegacyReferences, convertToUri, createCacheEntry, createCacheManager, createCachePersistence, createDefaultRegistry, createEmptyModernConfig, createEmptySyncPlan, createGitHubStorage, createHttpStorage, createLocalStorage, createPermissionManager, createRule, createRulesFromPatterns, createStorageManager, createSyncManager, createSyncPlan, deserializeCacheEntry, detectContentType, detectCurrentProject, detectVersion, estimateSyncTime, evaluatePath, evaluatePaths, evaluatePatterns, evaluatePermission, evaluatePermissions, expandEnvVars, expandEnvVarsInConfig, extendType, extractEnvVarNames, extractOrgFromRepoName, extractRawFrontmatter, filterByPatterns, filterByPermission, filterPlanOperations, filterSyncablePaths, findLegacyReferences, formatBytes2 as formatBytes, formatDuration, formatPlanSummary, formatSeconds, generateMigrationReport, generateReferenceMigrationSummary, generateSyncConfigFromPreset, getBuiltInType, getBuiltInTypeNames, getCacheEntryAge, getCacheEntryStatus, getCurrentContext, getCustomSyncDestinations, getDefaultCacheManager, getDefaultConfig, getDefaultDirectories, getDefaultPermissionManager, getDefaultRules, getDefaultStorageManager, getDirectory, getExtension, getFilename, getMigrationRequirements, getPlanStats, getRelativeCachePath, getRemainingTtl, getSyncPreset, getSyncPresetNames, getTargetRepos, hasContentChanged, hasEnvVars, hasFrontmatter, hasLegacyReferences, hasPermission as hasPermissionLevel, isBuiltInType, isCacheEntryFresh, isCacheEntryValid, isCurrentProjectUri, isLegacyConfig, isLegacyReference, isModernConfig, isAllowed as isPermissionAllowed, isUnifiedConfig, isValidDuration, isValidSize, isValidUri, levelGrants, loadConfig, loadCustomTypes, matchAnyPattern, matchPattern, maxLevel, mergeFetchOptions, mergeRules, mergeTypes, migrateConfig, migrateFileReferences, minLevel, needsMigration, parseCustomDestination, parseDuration, parseMetadata, parseReference, parseSize, parseTtl, readCodexConfig, readUnifiedConfig, resolveOrganization, resolveReference, resolveReferences, ruleMatchesAction, ruleMatchesContext, ruleMatchesPath, sanitizePath, serializeCacheEntry, setDefaultCacheManager, setDefaultPermissionManager, setDefaultStorageManager, shouldSyncToRepo, substitutePatternPlaceholders, summarizeEvaluations, touchCacheEntry, validateCustomTypes, validateMetadata, validateMigratedConfig, validateOrg, validatePath, validateRules2 as validatePermissionRules, validateProject, validateRules, validateUri };
5119
5210
  //# sourceMappingURL=index.js.map
5120
5211
  //# sourceMappingURL=index.js.map