@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/cli.cjs CHANGED
@@ -5583,11 +5583,11 @@ var {
5583
5583
  Help
5584
5584
  } = import_index.default;
5585
5585
 
5586
- // node_modules/@fractary/codex/dist/index.js
5586
+ // ../../sdk/js/dist/index.js
5587
5587
  init_cjs_shims();
5588
+ var import_micromatch = __toESM(require_micromatch(), 1);
5588
5589
  var import_path = __toESM(require("path"), 1);
5589
5590
  var import_child_process = require("child_process");
5590
- var import_micromatch = __toESM(require_micromatch(), 1);
5591
5591
 
5592
5592
  // ../../node_modules/zod/index.js
5593
5593
  init_cjs_shims();
@@ -12236,8 +12236,86 @@ var safeLoad = renamed("safeLoad", "load");
12236
12236
  var safeLoadAll = renamed("safeLoadAll", "loadAll");
12237
12237
  var safeDump = renamed("safeDump", "dump");
12238
12238
 
12239
- // node_modules/@fractary/codex/dist/index.js
12239
+ // ../../sdk/js/dist/index.js
12240
12240
  var import_promises = __toESM(require("fs/promises"), 1);
12241
+ var __defProp2 = Object.defineProperty;
12242
+ var __getOwnPropNames2 = Object.getOwnPropertyNames;
12243
+ var __esm2 = (fn, res) => function __init() {
12244
+ return fn && (res = (0, fn[__getOwnPropNames2(fn)[0]])(fn = 0)), res;
12245
+ };
12246
+ var __export2 = (target, all) => {
12247
+ for (var name in all)
12248
+ __defProp2(target, name, { get: all[name], enumerable: true });
12249
+ };
12250
+ function matchPattern(pattern, value) {
12251
+ if (pattern === value) return true;
12252
+ return import_micromatch.default.isMatch(value, pattern);
12253
+ }
12254
+ var init_matcher = __esm2({
12255
+ "src/core/patterns/matcher.ts"() {
12256
+ }
12257
+ });
12258
+ var directional_patterns_exports = {};
12259
+ __export2(directional_patterns_exports, {
12260
+ expandPlaceholders: () => expandPlaceholders,
12261
+ extractProjectFromCodexPath: () => extractProjectFromCodexPath,
12262
+ getRelativePath: () => getRelativePath,
12263
+ matchFromCodexPattern: () => matchFromCodexPattern,
12264
+ matchToCodexPattern: () => matchToCodexPattern
12265
+ });
12266
+ function matchToCodexPattern(filePath, patterns) {
12267
+ if (!patterns || patterns.length === 0) {
12268
+ return false;
12269
+ }
12270
+ return patterns.some((pattern) => matchPattern(pattern, filePath));
12271
+ }
12272
+ function matchFromCodexPattern(codexFilePath, patterns, targetProject) {
12273
+ if (!patterns || patterns.length === 0) {
12274
+ return false;
12275
+ }
12276
+ return patterns.some((pattern) => {
12277
+ if (pattern.startsWith("projects/")) {
12278
+ return matchPattern(pattern, codexFilePath);
12279
+ }
12280
+ const projectSeparatorIndex = pattern.indexOf("/");
12281
+ if (projectSeparatorIndex === -1) {
12282
+ const fullPattern = `${targetProject}/${pattern}`;
12283
+ return matchPattern(fullPattern, codexFilePath);
12284
+ }
12285
+ const firstSegment = pattern.substring(0, projectSeparatorIndex);
12286
+ if (firstSegment.includes(".")) {
12287
+ return matchPattern(pattern, codexFilePath);
12288
+ } else {
12289
+ const fullPattern = `${targetProject}/${pattern}`;
12290
+ return matchPattern(fullPattern, codexFilePath);
12291
+ }
12292
+ });
12293
+ }
12294
+ function extractProjectFromCodexPath(codexFilePath) {
12295
+ const firstSlashIndex = codexFilePath.indexOf("/");
12296
+ if (firstSlashIndex === -1) {
12297
+ return null;
12298
+ }
12299
+ return codexFilePath.substring(0, firstSlashIndex);
12300
+ }
12301
+ function getRelativePath(codexFilePath) {
12302
+ const firstSlashIndex = codexFilePath.indexOf("/");
12303
+ if (firstSlashIndex === -1) {
12304
+ return null;
12305
+ }
12306
+ return codexFilePath.substring(firstSlashIndex + 1);
12307
+ }
12308
+ function expandPlaceholders(patterns, targetProject) {
12309
+ if (!patterns) {
12310
+ return patterns;
12311
+ }
12312
+ return patterns.map((pattern) => pattern.replace(/{project}/g, targetProject));
12313
+ }
12314
+ var init_directional_patterns = __esm2({
12315
+ "src/sync/directional-patterns.ts"() {
12316
+ init_matcher();
12317
+ }
12318
+ });
12241
12319
  var FORBIDDEN_PATTERNS = [
12242
12320
  /^\//,
12243
12321
  // Absolute paths
@@ -12550,6 +12628,16 @@ var SyncRulesSchema = external_exports.object({
12550
12628
  defaultInclude: external_exports.array(external_exports.string()).optional(),
12551
12629
  defaultExclude: external_exports.array(external_exports.string()).optional()
12552
12630
  });
12631
+ var DirectionalSyncSchema = external_exports.object({
12632
+ // Patterns for files to push from this project to codex
12633
+ to_codex: external_exports.array(external_exports.string()).optional(),
12634
+ // Patterns for files to pull from codex to this project
12635
+ // Format: "project-name/path/pattern" or "project-name/**"
12636
+ from_codex: external_exports.array(external_exports.string()).optional(),
12637
+ // Org-level defaults (only in codex repository config)
12638
+ default_to_codex: external_exports.array(external_exports.string()).optional(),
12639
+ default_from_codex: external_exports.array(external_exports.string()).optional()
12640
+ });
12553
12641
  var CodexConfigSchema = external_exports.object({
12554
12642
  organizationSlug: external_exports.string(),
12555
12643
  directories: external_exports.object({
@@ -12557,8 +12645,12 @@ var CodexConfigSchema = external_exports.object({
12557
12645
  target: external_exports.string().optional(),
12558
12646
  systems: external_exports.string().optional()
12559
12647
  }).optional(),
12560
- rules: SyncRulesSchema.optional()
12648
+ rules: SyncRulesSchema.optional(),
12649
+ // Directional sync configuration
12650
+ sync: DirectionalSyncSchema.optional()
12561
12651
  }).strict();
12652
+ init_matcher();
12653
+ init_matcher();
12562
12654
  var DEFAULT_FETCH_OPTIONS = {
12563
12655
  timeout: 3e4,
12564
12656
  // 30 seconds