@fractary/codex-mcp 0.5.0 → 0.7.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 CHANGED
@@ -2828,11 +2828,11 @@ init_cjs_shims();
2828
2828
  // src/server.ts
2829
2829
  init_cjs_shims();
2830
2830
 
2831
- // node_modules/@fractary/codex/dist/index.js
2831
+ // ../../sdk/js/dist/index.js
2832
2832
  init_cjs_shims();
2833
+ var import_micromatch = __toESM(require_micromatch(), 1);
2833
2834
  var import_path = __toESM(require("path"), 1);
2834
2835
  var import_child_process = require("child_process");
2835
- var import_micromatch = __toESM(require_micromatch(), 1);
2836
2836
 
2837
2837
  // ../../node_modules/zod/index.js
2838
2838
  init_cjs_shims();
@@ -9481,7 +9481,85 @@ var safeLoad = renamed("safeLoad", "load");
9481
9481
  var safeLoadAll = renamed("safeLoadAll", "loadAll");
9482
9482
  var safeDump = renamed("safeDump", "dump");
9483
9483
 
9484
- // node_modules/@fractary/codex/dist/index.js
9484
+ // ../../sdk/js/dist/index.js
9485
+ var __defProp2 = Object.defineProperty;
9486
+ var __getOwnPropNames2 = Object.getOwnPropertyNames;
9487
+ var __esm2 = (fn, res) => function __init() {
9488
+ return fn && (res = (0, fn[__getOwnPropNames2(fn)[0]])(fn = 0)), res;
9489
+ };
9490
+ var __export2 = (target, all) => {
9491
+ for (var name in all)
9492
+ __defProp2(target, name, { get: all[name], enumerable: true });
9493
+ };
9494
+ function matchPattern(pattern, value) {
9495
+ if (pattern === value) return true;
9496
+ return import_micromatch.default.isMatch(value, pattern);
9497
+ }
9498
+ var init_matcher = __esm2({
9499
+ "src/core/patterns/matcher.ts"() {
9500
+ }
9501
+ });
9502
+ var directional_patterns_exports = {};
9503
+ __export2(directional_patterns_exports, {
9504
+ expandPlaceholders: () => expandPlaceholders,
9505
+ extractProjectFromCodexPath: () => extractProjectFromCodexPath,
9506
+ getRelativePath: () => getRelativePath,
9507
+ matchFromCodexPattern: () => matchFromCodexPattern,
9508
+ matchToCodexPattern: () => matchToCodexPattern
9509
+ });
9510
+ function matchToCodexPattern(filePath, patterns) {
9511
+ if (!patterns || patterns.length === 0) {
9512
+ return false;
9513
+ }
9514
+ return patterns.some((pattern) => matchPattern(pattern, filePath));
9515
+ }
9516
+ function matchFromCodexPattern(codexFilePath, patterns, targetProject) {
9517
+ if (!patterns || patterns.length === 0) {
9518
+ return false;
9519
+ }
9520
+ return patterns.some((pattern) => {
9521
+ if (pattern.startsWith("projects/")) {
9522
+ return matchPattern(pattern, codexFilePath);
9523
+ }
9524
+ const projectSeparatorIndex = pattern.indexOf("/");
9525
+ if (projectSeparatorIndex === -1) {
9526
+ const fullPattern = `${targetProject}/${pattern}`;
9527
+ return matchPattern(fullPattern, codexFilePath);
9528
+ }
9529
+ const firstSegment = pattern.substring(0, projectSeparatorIndex);
9530
+ if (firstSegment.includes(".")) {
9531
+ return matchPattern(pattern, codexFilePath);
9532
+ } else {
9533
+ const fullPattern = `${targetProject}/${pattern}`;
9534
+ return matchPattern(fullPattern, codexFilePath);
9535
+ }
9536
+ });
9537
+ }
9538
+ function extractProjectFromCodexPath(codexFilePath) {
9539
+ const firstSlashIndex = codexFilePath.indexOf("/");
9540
+ if (firstSlashIndex === -1) {
9541
+ return null;
9542
+ }
9543
+ return codexFilePath.substring(0, firstSlashIndex);
9544
+ }
9545
+ function getRelativePath(codexFilePath) {
9546
+ const firstSlashIndex = codexFilePath.indexOf("/");
9547
+ if (firstSlashIndex === -1) {
9548
+ return null;
9549
+ }
9550
+ return codexFilePath.substring(firstSlashIndex + 1);
9551
+ }
9552
+ function expandPlaceholders(patterns, targetProject) {
9553
+ if (!patterns) {
9554
+ return patterns;
9555
+ }
9556
+ return patterns.map((pattern) => pattern.replace(/{project}/g, targetProject));
9557
+ }
9558
+ var init_directional_patterns = __esm2({
9559
+ "src/sync/directional-patterns.ts"() {
9560
+ init_matcher();
9561
+ }
9562
+ });
9485
9563
  var FORBIDDEN_PATTERNS = [
9486
9564
  /^\//,
9487
9565
  // Absolute paths
@@ -9794,6 +9872,16 @@ var SyncRulesSchema = external_exports.object({
9794
9872
  defaultInclude: external_exports.array(external_exports.string()).optional(),
9795
9873
  defaultExclude: external_exports.array(external_exports.string()).optional()
9796
9874
  });
9875
+ var DirectionalSyncSchema = external_exports.object({
9876
+ // Patterns for files to push from this project to codex
9877
+ to_codex: external_exports.array(external_exports.string()).optional(),
9878
+ // Patterns for files to pull from codex to this project
9879
+ // Format: "project-name/path/pattern" or "project-name/**"
9880
+ from_codex: external_exports.array(external_exports.string()).optional(),
9881
+ // Org-level defaults (only in codex repository config)
9882
+ default_to_codex: external_exports.array(external_exports.string()).optional(),
9883
+ default_from_codex: external_exports.array(external_exports.string()).optional()
9884
+ });
9797
9885
  var CodexConfigSchema = external_exports.object({
9798
9886
  organizationSlug: external_exports.string(),
9799
9887
  directories: external_exports.object({
@@ -9801,8 +9889,12 @@ var CodexConfigSchema = external_exports.object({
9801
9889
  target: external_exports.string().optional(),
9802
9890
  systems: external_exports.string().optional()
9803
9891
  }).optional(),
9804
- rules: SyncRulesSchema.optional()
9892
+ rules: SyncRulesSchema.optional(),
9893
+ // Directional sync configuration
9894
+ sync: DirectionalSyncSchema.optional()
9805
9895
  }).strict();
9896
+ init_matcher();
9897
+ init_matcher();
9806
9898
  var DEFAULT_FETCH_OPTIONS = {
9807
9899
  timeout: 3e4,
9808
9900
  // 30 seconds