@fractary/codex 0.12.4 → 0.12.6

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
@@ -563,52 +563,12 @@ declare const CodexConfigSchema: z.ZodObject<{
563
563
  fallback_to_public?: boolean | undefined;
564
564
  } | undefined;
565
565
  }>>;
566
- dependencies: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
567
- sources: z.ZodRecord<z.ZodString, z.ZodObject<{
568
- type: z.ZodEnum<["github", "s3", "http", "local"]>;
569
- token_env: z.ZodOptional<z.ZodString>;
570
- token: z.ZodOptional<z.ZodString>;
571
- branch: z.ZodOptional<z.ZodString>;
572
- base_url: z.ZodOptional<z.ZodString>;
573
- bucket: z.ZodOptional<z.ZodString>;
574
- prefix: z.ZodOptional<z.ZodString>;
575
- }, "strip", z.ZodTypeAny, {
576
- type: "local" | "github" | "http" | "s3";
577
- token?: string | undefined;
578
- branch?: string | undefined;
579
- bucket?: string | undefined;
580
- prefix?: string | undefined;
581
- token_env?: string | undefined;
582
- base_url?: string | undefined;
583
- }, {
584
- type: "local" | "github" | "http" | "s3";
585
- token?: string | undefined;
586
- branch?: string | undefined;
587
- bucket?: string | undefined;
588
- prefix?: string | undefined;
589
- token_env?: string | undefined;
590
- base_url?: string | undefined;
591
- }>>;
566
+ remotes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
567
+ token: z.ZodOptional<z.ZodString>;
592
568
  }, "strip", z.ZodTypeAny, {
593
- sources: Record<string, {
594
- type: "local" | "github" | "http" | "s3";
595
- token?: string | undefined;
596
- branch?: string | undefined;
597
- bucket?: string | undefined;
598
- prefix?: string | undefined;
599
- token_env?: string | undefined;
600
- base_url?: string | undefined;
601
- }>;
569
+ token?: string | undefined;
602
570
  }, {
603
- sources: Record<string, {
604
- type: "local" | "github" | "http" | "s3";
605
- token?: string | undefined;
606
- branch?: string | undefined;
607
- bucket?: string | undefined;
608
- prefix?: string | undefined;
609
- token_env?: string | undefined;
610
- base_url?: string | undefined;
611
- }>;
571
+ token?: string | undefined;
612
572
  }>>>;
613
573
  }, "strict", z.ZodTypeAny, {
614
574
  organizationSlug: string;
@@ -658,16 +618,8 @@ declare const CodexConfigSchema: z.ZodObject<{
658
618
  fallback_to_public?: boolean | undefined;
659
619
  } | undefined;
660
620
  } | undefined;
661
- dependencies?: Record<string, {
662
- sources: Record<string, {
663
- type: "local" | "github" | "http" | "s3";
664
- token?: string | undefined;
665
- branch?: string | undefined;
666
- bucket?: string | undefined;
667
- prefix?: string | undefined;
668
- token_env?: string | undefined;
669
- base_url?: string | undefined;
670
- }>;
621
+ remotes?: Record<string, {
622
+ token?: string | undefined;
671
623
  }> | undefined;
672
624
  }, {
673
625
  organizationSlug: string;
@@ -717,16 +669,8 @@ declare const CodexConfigSchema: z.ZodObject<{
717
669
  fallback_to_public?: boolean | undefined;
718
670
  } | undefined;
719
671
  } | undefined;
720
- dependencies?: Record<string, {
721
- sources: Record<string, {
722
- type: "local" | "github" | "http" | "s3";
723
- token?: string | undefined;
724
- branch?: string | undefined;
725
- bucket?: string | undefined;
726
- prefix?: string | undefined;
727
- token_env?: string | undefined;
728
- base_url?: string | undefined;
729
- }>;
672
+ remotes?: Record<string, {
673
+ token?: string | undefined;
730
674
  }> | undefined;
731
675
  }>;
732
676
  type CodexConfig = z.infer<typeof CodexConfigSchema>;
@@ -824,6 +768,7 @@ declare const UnifiedConfigSchema: z.ZodObject<{
824
768
  region?: string | undefined;
825
769
  }>>;
826
770
  }, "strip", z.ZodTypeAny, {
771
+ schema_version: string;
827
772
  sources: Record<string, {
828
773
  local: {
829
774
  base_path: string;
@@ -840,8 +785,8 @@ declare const UnifiedConfigSchema: z.ZodObject<{
840
785
  } | undefined;
841
786
  region?: string | undefined;
842
787
  }>;
843
- schema_version: string;
844
788
  }, {
789
+ schema_version: string;
845
790
  sources: Record<string, {
846
791
  local: {
847
792
  base_path: string;
@@ -858,7 +803,6 @@ declare const UnifiedConfigSchema: z.ZodObject<{
858
803
  } | undefined;
859
804
  region?: string | undefined;
860
805
  }>;
861
- schema_version: string;
862
806
  }>>;
863
807
  codex: z.ZodOptional<z.ZodObject<{
864
808
  organizationSlug: z.ZodString;
@@ -1032,52 +976,12 @@ declare const UnifiedConfigSchema: z.ZodObject<{
1032
976
  fallback_to_public?: boolean | undefined;
1033
977
  } | undefined;
1034
978
  }>>;
1035
- dependencies: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
1036
- sources: z.ZodRecord<z.ZodString, z.ZodObject<{
1037
- type: z.ZodEnum<["github", "s3", "http", "local"]>;
1038
- token_env: z.ZodOptional<z.ZodString>;
1039
- token: z.ZodOptional<z.ZodString>;
1040
- branch: z.ZodOptional<z.ZodString>;
1041
- base_url: z.ZodOptional<z.ZodString>;
1042
- bucket: z.ZodOptional<z.ZodString>;
1043
- prefix: z.ZodOptional<z.ZodString>;
1044
- }, "strip", z.ZodTypeAny, {
1045
- type: "local" | "github" | "http" | "s3";
1046
- token?: string | undefined;
1047
- branch?: string | undefined;
1048
- bucket?: string | undefined;
1049
- prefix?: string | undefined;
1050
- token_env?: string | undefined;
1051
- base_url?: string | undefined;
1052
- }, {
1053
- type: "local" | "github" | "http" | "s3";
1054
- token?: string | undefined;
1055
- branch?: string | undefined;
1056
- bucket?: string | undefined;
1057
- prefix?: string | undefined;
1058
- token_env?: string | undefined;
1059
- base_url?: string | undefined;
1060
- }>>;
979
+ remotes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
980
+ token: z.ZodOptional<z.ZodString>;
1061
981
  }, "strip", z.ZodTypeAny, {
1062
- sources: Record<string, {
1063
- type: "local" | "github" | "http" | "s3";
1064
- token?: string | undefined;
1065
- branch?: string | undefined;
1066
- bucket?: string | undefined;
1067
- prefix?: string | undefined;
1068
- token_env?: string | undefined;
1069
- base_url?: string | undefined;
1070
- }>;
982
+ token?: string | undefined;
1071
983
  }, {
1072
- sources: Record<string, {
1073
- type: "local" | "github" | "http" | "s3";
1074
- token?: string | undefined;
1075
- branch?: string | undefined;
1076
- bucket?: string | undefined;
1077
- prefix?: string | undefined;
1078
- token_env?: string | undefined;
1079
- base_url?: string | undefined;
1080
- }>;
984
+ token?: string | undefined;
1081
985
  }>>>;
1082
986
  }, "strict", z.ZodTypeAny, {
1083
987
  organizationSlug: string;
@@ -1127,16 +1031,8 @@ declare const UnifiedConfigSchema: z.ZodObject<{
1127
1031
  fallback_to_public?: boolean | undefined;
1128
1032
  } | undefined;
1129
1033
  } | undefined;
1130
- dependencies?: Record<string, {
1131
- sources: Record<string, {
1132
- type: "local" | "github" | "http" | "s3";
1133
- token?: string | undefined;
1134
- branch?: string | undefined;
1135
- bucket?: string | undefined;
1136
- prefix?: string | undefined;
1137
- token_env?: string | undefined;
1138
- base_url?: string | undefined;
1139
- }>;
1034
+ remotes?: Record<string, {
1035
+ token?: string | undefined;
1140
1036
  }> | undefined;
1141
1037
  }, {
1142
1038
  organizationSlug: string;
@@ -1186,20 +1082,13 @@ declare const UnifiedConfigSchema: z.ZodObject<{
1186
1082
  fallback_to_public?: boolean | undefined;
1187
1083
  } | undefined;
1188
1084
  } | undefined;
1189
- dependencies?: Record<string, {
1190
- sources: Record<string, {
1191
- type: "local" | "github" | "http" | "s3";
1192
- token?: string | undefined;
1193
- branch?: string | undefined;
1194
- bucket?: string | undefined;
1195
- prefix?: string | undefined;
1196
- token_env?: string | undefined;
1197
- base_url?: string | undefined;
1198
- }>;
1085
+ remotes?: Record<string, {
1086
+ token?: string | undefined;
1199
1087
  }> | undefined;
1200
1088
  }>>;
1201
1089
  }, "strip", z.ZodTypeAny, {
1202
1090
  file?: {
1091
+ schema_version: string;
1203
1092
  sources: Record<string, {
1204
1093
  local: {
1205
1094
  base_path: string;
@@ -1216,7 +1105,6 @@ declare const UnifiedConfigSchema: z.ZodObject<{
1216
1105
  } | undefined;
1217
1106
  region?: string | undefined;
1218
1107
  }>;
1219
- schema_version: string;
1220
1108
  } | undefined;
1221
1109
  codex?: {
1222
1110
  organizationSlug: string;
@@ -1266,20 +1154,13 @@ declare const UnifiedConfigSchema: z.ZodObject<{
1266
1154
  fallback_to_public?: boolean | undefined;
1267
1155
  } | undefined;
1268
1156
  } | undefined;
1269
- dependencies?: Record<string, {
1270
- sources: Record<string, {
1271
- type: "local" | "github" | "http" | "s3";
1272
- token?: string | undefined;
1273
- branch?: string | undefined;
1274
- bucket?: string | undefined;
1275
- prefix?: string | undefined;
1276
- token_env?: string | undefined;
1277
- base_url?: string | undefined;
1278
- }>;
1157
+ remotes?: Record<string, {
1158
+ token?: string | undefined;
1279
1159
  }> | undefined;
1280
1160
  } | undefined;
1281
1161
  }, {
1282
1162
  file?: {
1163
+ schema_version: string;
1283
1164
  sources: Record<string, {
1284
1165
  local: {
1285
1166
  base_path: string;
@@ -1296,7 +1177,6 @@ declare const UnifiedConfigSchema: z.ZodObject<{
1296
1177
  } | undefined;
1297
1178
  region?: string | undefined;
1298
1179
  }>;
1299
- schema_version: string;
1300
1180
  } | undefined;
1301
1181
  codex?: {
1302
1182
  organizationSlug: string;
@@ -1346,16 +1226,8 @@ declare const UnifiedConfigSchema: z.ZodObject<{
1346
1226
  fallback_to_public?: boolean | undefined;
1347
1227
  } | undefined;
1348
1228
  } | undefined;
1349
- dependencies?: Record<string, {
1350
- sources: Record<string, {
1351
- type: "local" | "github" | "http" | "s3";
1352
- token?: string | undefined;
1353
- branch?: string | undefined;
1354
- bucket?: string | undefined;
1355
- prefix?: string | undefined;
1356
- token_env?: string | undefined;
1357
- base_url?: string | undefined;
1358
- }>;
1229
+ remotes?: Record<string, {
1230
+ token?: string | undefined;
1359
1231
  }> | undefined;
1360
1232
  } | undefined;
1361
1233
  }>;
@@ -1410,6 +1282,41 @@ interface LoadConfigOptions {
1410
1282
  }
1411
1283
  declare function loadConfig(options?: LoadConfigOptions): CodexConfig;
1412
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
+
1413
1320
  interface ShouldSyncOptions {
1414
1321
  filePath: string;
1415
1322
  fileMetadata: Metadata;
@@ -1556,6 +1463,7 @@ declare class StorageManager {
1556
1463
  private priority;
1557
1464
  private codexConfig?;
1558
1465
  constructor(config?: StorageManagerConfig);
1466
+ private resolveTokenValue;
1559
1467
  private resolveToken;
1560
1468
  private resolveFetchOptions;
1561
1469
  registerProvider(provider: StorageProvider): void;
@@ -2249,4 +2157,4 @@ declare function formatSeconds(seconds: number): string;
2249
2157
  declare function isValidDuration(value: string): boolean;
2250
2158
  declare function isValidSize(value: string): boolean;
2251
2159
 
2252
- 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
@@ -944,25 +944,9 @@ var AuthConfigSchema = z.object({
944
944
  /** GitHub authentication configuration */
945
945
  github: GitHubAuthConfigSchema.optional()
946
946
  });
947
- var SourceConfigSchema = z.object({
948
- /** Source type */
949
- type: z.enum(["github", "s3", "http", "local"]),
950
- /** Environment variable containing the authentication token */
951
- token_env: z.string().optional(),
952
- /** Direct token value (not recommended, use token_env instead) */
953
- token: z.string().optional(),
954
- /** Branch to fetch from (for GitHub sources) */
955
- branch: z.string().optional(),
956
- /** Base URL (for HTTP sources) */
957
- base_url: z.string().optional(),
958
- /** Bucket name (for S3 sources) */
959
- bucket: z.string().optional(),
960
- /** Prefix/path within bucket (for S3 sources) */
961
- prefix: z.string().optional()
962
- });
963
- var DependencyConfigSchema = z.object({
964
- /** Sources within this dependency */
965
- 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()
966
950
  });
967
951
  var CodexConfigSchema = z.object({
968
952
  organizationSlug: z.string(),
@@ -980,8 +964,9 @@ var CodexConfigSchema = z.object({
980
964
  archive: ArchiveConfigSchema.optional(),
981
965
  // Authentication configuration
982
966
  auth: AuthConfigSchema.optional(),
983
- // Dependencies configuration (external projects)
984
- 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()
985
970
  }).strict();
986
971
  var FileSourceSchema = z.object({
987
972
  type: z.enum(["s3", "r2", "gcs", "local"]),
@@ -1226,6 +1211,99 @@ function mergeConfigs(base, override) {
1226
1211
  };
1227
1212
  }
1228
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
+
1229
1307
  // src/core/routing/evaluator.ts
1230
1308
  init_matcher();
1231
1309
  function shouldSyncToRepo(options) {
@@ -2370,30 +2448,31 @@ var StorageManager = class {
2370
2448
  }
2371
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"]);
2372
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
+ }
2373
2462
  /**
2374
2463
  * Resolve authentication token for a reference
2375
2464
  *
2376
- * Looks up dependency-specific authentication or falls back to default
2465
+ * Looks up remote-specific authentication or falls back to default
2377
2466
  */
2378
2467
  resolveToken(reference) {
2379
2468
  if (!this.codexConfig) {
2380
2469
  return void 0;
2381
2470
  }
2382
- const dependencyKey = `${reference.org}/${reference.project}`;
2383
- if (this.codexConfig.dependencies?.[dependencyKey]) {
2384
- const dependency = this.codexConfig.dependencies[dependencyKey];
2385
- for (const [, sourceConfig] of Object.entries(dependency.sources)) {
2386
- if (sourceConfig.type === "github") {
2387
- if (sourceConfig.token_env) {
2388
- const token = process.env[sourceConfig.token_env];
2389
- if (token) {
2390
- return token;
2391
- }
2392
- }
2393
- if (sourceConfig.token) {
2394
- return sourceConfig.token;
2395
- }
2396
- }
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;
2397
2476
  }
2398
2477
  }
2399
2478
  const defaultTokenEnv = this.codexConfig.auth?.github?.default_token_env || "GITHUB_TOKEN";
@@ -2452,7 +2531,7 @@ var StorageManager = class {
2452
2531
  * Fetch content for a reference
2453
2532
  *
2454
2533
  * Tries providers in priority order until one succeeds.
2455
- * Automatically resolves authentication based on dependency configuration.
2534
+ * Automatically resolves authentication based on remote configuration.
2456
2535
  */
2457
2536
  async fetch(reference, options) {
2458
2537
  const resolvedOptions = this.resolveFetchOptions(reference, options);
@@ -2484,7 +2563,7 @@ var StorageManager = class {
2484
2563
  * Check if content exists for a reference
2485
2564
  *
2486
2565
  * Returns true if any provider reports the content exists.
2487
- * Automatically resolves authentication based on dependency configuration.
2566
+ * Automatically resolves authentication based on remote configuration.
2488
2567
  */
2489
2568
  async exists(reference, options) {
2490
2569
  const resolvedOptions = this.resolveFetchOptions(reference, options);
@@ -5127,6 +5206,6 @@ function isValidSize(value) {
5127
5206
  return /^\d+(?:\.\d+)?\s*(B|KB|MB|GB|TB)$/i.test(value);
5128
5207
  }
5129
5208
 
5130
- 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 };
5131
5210
  //# sourceMappingURL=index.js.map
5132
5211
  //# sourceMappingURL=index.js.map