@fractary/codex-cli 0.6.5 → 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
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  'use strict';
3
3
 
4
- var fs = require('fs/promises');
4
+ var fs$1 = require('fs/promises');
5
5
  var path3 = require('path');
6
6
  var yaml = require('js-yaml');
7
7
  var codex = require('@fractary/codex');
@@ -10,6 +10,8 @@ var child_process = require('child_process');
10
10
  var commander = require('commander');
11
11
  var chalk8 = require('chalk');
12
12
  var crypto = require('crypto');
13
+ var fs = require('fs');
14
+ var url = require('url');
13
15
 
14
16
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
15
17
 
@@ -31,7 +33,7 @@ function _interopNamespace(e) {
31
33
  return Object.freeze(n);
32
34
  }
33
35
 
34
- var fs__namespace = /*#__PURE__*/_interopNamespace(fs);
36
+ var fs__namespace = /*#__PURE__*/_interopNamespace(fs$1);
35
37
  var path3__namespace = /*#__PURE__*/_interopNamespace(path3);
36
38
  var yaml__namespace = /*#__PURE__*/_interopNamespace(yaml);
37
39
  var os__namespace = /*#__PURE__*/_interopNamespace(os);
@@ -55,8 +57,11 @@ var __export = (target, all) => {
55
57
  };
56
58
 
57
59
  // ../node_modules/tsup/assets/cjs_shims.js
60
+ var getImportMetaUrl, importMetaUrl;
58
61
  var init_cjs_shims = __esm({
59
62
  "../node_modules/tsup/assets/cjs_shims.js"() {
63
+ getImportMetaUrl = () => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.tagName.toUpperCase() === "SCRIPT" ? document.currentScript.src : new URL("main.js", document.baseURI).href;
64
+ importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
60
65
  }
61
66
  });
62
67
 
@@ -1645,10 +1650,28 @@ function syncCommand() {
1645
1650
  ".fractary/templates/**"
1646
1651
  ];
1647
1652
  const syncConfig = config.sync;
1648
- const configIncludePatterns = syncConfig?.to_codex || defaultToCodexPatterns;
1653
+ let configIncludePatterns;
1654
+ let configExcludePatterns = [];
1655
+ if (syncConfig?.to_codex) {
1656
+ const toCodex = syncConfig.to_codex;
1657
+ if (typeof toCodex === "object" && !Array.isArray(toCodex)) {
1658
+ const directionalConfig = toCodex;
1659
+ configIncludePatterns = directionalConfig.include || defaultToCodexPatterns;
1660
+ configExcludePatterns = directionalConfig.exclude || [];
1661
+ } else if (Array.isArray(toCodex)) {
1662
+ configIncludePatterns = toCodex;
1663
+ configExcludePatterns = syncConfig.exclude || [];
1664
+ } else {
1665
+ configIncludePatterns = defaultToCodexPatterns;
1666
+ configExcludePatterns = [];
1667
+ }
1668
+ } else {
1669
+ configIncludePatterns = defaultToCodexPatterns;
1670
+ configExcludePatterns = syncConfig?.exclude || [];
1671
+ }
1649
1672
  const includePatterns = options.include.length > 0 ? options.include : configIncludePatterns;
1650
1673
  const excludePatterns = [
1651
- ...syncConfig?.exclude || [],
1674
+ ...configExcludePatterns,
1652
1675
  ...options.exclude
1653
1676
  ];
1654
1677
  const sourceDir = process.cwd();
@@ -2242,11 +2265,13 @@ function typesCommand() {
2242
2265
  cmd.addCommand(typesRemoveCommand());
2243
2266
  return cmd;
2244
2267
  }
2245
-
2246
- // src/cli.ts
2268
+ var __filename2 = url.fileURLToPath(importMetaUrl);
2269
+ var __dirname$1 = path3.dirname(__filename2);
2270
+ var packageJson = JSON.parse(fs.readFileSync(path3.join(__dirname$1, "../package.json"), "utf-8"));
2271
+ var VERSION = packageJson.version;
2247
2272
  function createCLI() {
2248
2273
  const program = new commander.Command("fractary-codex");
2249
- program.description("Centralized knowledge management and distribution for AI agents").version("0.3.0");
2274
+ program.description("Centralized knowledge management and distribution for AI agents").version(VERSION);
2250
2275
  program.addCommand(documentCommand());
2251
2276
  program.addCommand(configCommand());
2252
2277
  program.addCommand(cacheCommand());