@fractary/codex-cli 0.6.5 → 0.8.0

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.js CHANGED
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import * as path4 from 'path';
3
- import 'url';
3
+ import { dirname, join } from 'path';
4
+ import { fileURLToPath } from 'url';
4
5
  import * as fs from 'fs/promises';
5
6
  import * as yaml from 'js-yaml';
6
7
  import { ValidationError, PermissionDeniedError, ConfigurationError, CodexError } from '@fractary/codex';
@@ -9,6 +10,7 @@ import { spawn } from 'child_process';
9
10
  import { Command } from 'commander';
10
11
  import chalk8 from 'chalk';
11
12
  import * as crypto from 'crypto';
13
+ import { readFileSync } from 'fs';
12
14
 
13
15
  var __defProp = Object.defineProperty;
14
16
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -1615,10 +1617,28 @@ function syncCommand() {
1615
1617
  ".fractary/templates/**"
1616
1618
  ];
1617
1619
  const syncConfig = config.sync;
1618
- const configIncludePatterns = syncConfig?.to_codex || defaultToCodexPatterns;
1620
+ let configIncludePatterns;
1621
+ let configExcludePatterns = [];
1622
+ if (syncConfig?.to_codex) {
1623
+ const toCodex = syncConfig.to_codex;
1624
+ if (typeof toCodex === "object" && !Array.isArray(toCodex)) {
1625
+ const directionalConfig = toCodex;
1626
+ configIncludePatterns = directionalConfig.include || defaultToCodexPatterns;
1627
+ configExcludePatterns = directionalConfig.exclude || [];
1628
+ } else if (Array.isArray(toCodex)) {
1629
+ configIncludePatterns = toCodex;
1630
+ configExcludePatterns = syncConfig.exclude || [];
1631
+ } else {
1632
+ configIncludePatterns = defaultToCodexPatterns;
1633
+ configExcludePatterns = [];
1634
+ }
1635
+ } else {
1636
+ configIncludePatterns = defaultToCodexPatterns;
1637
+ configExcludePatterns = syncConfig?.exclude || [];
1638
+ }
1619
1639
  const includePatterns = options.include.length > 0 ? options.include : configIncludePatterns;
1620
1640
  const excludePatterns = [
1621
- ...syncConfig?.exclude || [],
1641
+ ...configExcludePatterns,
1622
1642
  ...options.exclude
1623
1643
  ];
1624
1644
  const sourceDir = process.cwd();
@@ -2212,11 +2232,13 @@ function typesCommand() {
2212
2232
  cmd.addCommand(typesRemoveCommand());
2213
2233
  return cmd;
2214
2234
  }
2215
-
2216
- // src/cli.ts
2235
+ var __filename2 = fileURLToPath(import.meta.url);
2236
+ var __dirname2 = dirname(__filename2);
2237
+ var packageJson = JSON.parse(readFileSync(join(__dirname2, "../package.json"), "utf-8"));
2238
+ var VERSION = packageJson.version;
2217
2239
  function createCLI() {
2218
2240
  const program = new Command("fractary-codex");
2219
- program.description("Centralized knowledge management and distribution for AI agents").version("0.3.0");
2241
+ program.description("Centralized knowledge management and distribution for AI agents").version(VERSION);
2220
2242
  program.addCommand(documentCommand());
2221
2243
  program.addCommand(configCommand());
2222
2244
  program.addCommand(cacheCommand());