@fractary/codex-cli 0.3.1 → 0.4.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/README.md +3 -13
- package/dist/cli.cjs +58 -31
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +58 -31
- package/dist/cli.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -42,7 +42,7 @@ Options:
|
|
|
42
42
|
**Example:**
|
|
43
43
|
```bash
|
|
44
44
|
fractary-codex init
|
|
45
|
-
# Creates .fractary/codex.yaml and .codex
|
|
45
|
+
# Creates .fractary/codex/config.yaml and .fractary/codex/cache/
|
|
46
46
|
```
|
|
47
47
|
|
|
48
48
|
### `fetch` - Fetch Documents
|
|
@@ -234,11 +234,11 @@ Options:
|
|
|
234
234
|
|
|
235
235
|
## Configuration
|
|
236
236
|
|
|
237
|
-
Codex uses `.fractary/codex.yaml` for configuration:
|
|
237
|
+
Codex uses `.fractary/codex/config.yaml` for configuration:
|
|
238
238
|
|
|
239
239
|
```yaml
|
|
240
240
|
organization: myorg
|
|
241
|
-
cacheDir: .codex
|
|
241
|
+
cacheDir: .fractary/codex/cache
|
|
242
242
|
|
|
243
243
|
storage:
|
|
244
244
|
- type: github
|
|
@@ -328,16 +328,6 @@ All commands use lazy-loading to avoid SDK initialization overhead for simple op
|
|
|
328
328
|
|
|
329
329
|
MIT
|
|
330
330
|
|
|
331
|
-
## Documentation
|
|
332
|
-
|
|
333
|
-
- [Command Reference](../docs/guides/command-reference.md) - Complete command reference for all interfaces
|
|
334
|
-
- [API Reference](../docs/guides/api-reference.md) - Complete API documentation
|
|
335
|
-
- [CLI Integration Guide](../docs/guides/cli-integration.md) - How to integrate into CLI applications
|
|
336
|
-
- [Configuration Guide](../docs/guides/configuration.md) - Configuration reference
|
|
337
|
-
- [Naming Conventions](../docs/guides/naming-conventions.md) - Naming standards across all interfaces
|
|
338
|
-
- [MCP Migration Guide](../docs/guides/mcp-migration-guide.md) - Migrating to new MCP tool names
|
|
339
|
-
- [Troubleshooting](../docs/guides/troubleshooting.md) - Common issues and solutions
|
|
340
|
-
|
|
341
331
|
## Links
|
|
342
332
|
|
|
343
333
|
- [GitHub Repository](https://github.com/fractary/codex)
|
package/dist/cli.cjs
CHANGED
|
@@ -90,7 +90,7 @@ async function migrateConfig(legacyConfigPath, options) {
|
|
|
90
90
|
organization: legacy.organization || legacy.organizationSlug || "default"
|
|
91
91
|
};
|
|
92
92
|
if (legacy.cache) {
|
|
93
|
-
yamlConfig.cacheDir = legacy.cache.directory || ".codex
|
|
93
|
+
yamlConfig.cacheDir = legacy.cache.directory || ".fractary/codex/cache";
|
|
94
94
|
}
|
|
95
95
|
if (legacy.storage?.providers) {
|
|
96
96
|
yamlConfig.storage = [];
|
|
@@ -199,7 +199,7 @@ async function writeYamlConfig(config, outputPath) {
|
|
|
199
199
|
function getDefaultYamlConfig(organization) {
|
|
200
200
|
return {
|
|
201
201
|
organization,
|
|
202
|
-
cacheDir: ".codex
|
|
202
|
+
cacheDir: ".fractary/codex/cache",
|
|
203
203
|
storage: [
|
|
204
204
|
{
|
|
205
205
|
type: "local",
|
|
@@ -767,24 +767,18 @@ function initCommand() {
|
|
|
767
767
|
console.log(chalk8__default.default.dim(`Organization: ${chalk8__default.default.cyan(org)}
|
|
768
768
|
`));
|
|
769
769
|
}
|
|
770
|
-
const configDir = path3__namespace.join(process.cwd(), ".fractary");
|
|
771
|
-
const configPath = path3__namespace.join(configDir, "
|
|
770
|
+
const configDir = path3__namespace.join(process.cwd(), ".fractary", "codex");
|
|
771
|
+
const configPath = path3__namespace.join(configDir, "config.yaml");
|
|
772
772
|
const configExists = await fileExists(configPath);
|
|
773
|
-
const legacyConfigPath = path3__namespace.join(process.cwd(), ".fractary", "plugins", "codex", "config.json");
|
|
774
|
-
const legacyExists = await fileExists(legacyConfigPath);
|
|
775
773
|
if (configExists && !options.force) {
|
|
776
|
-
console.log(chalk8__default.default.yellow("\u26A0 Configuration already exists at .fractary/codex.yaml"));
|
|
774
|
+
console.log(chalk8__default.default.yellow("\u26A0 Configuration already exists at .fractary/codex/config.yaml"));
|
|
777
775
|
console.log(chalk8__default.default.dim("Use --force to overwrite"));
|
|
778
776
|
process.exit(1);
|
|
779
777
|
}
|
|
780
|
-
if (legacyExists && !configExists) {
|
|
781
|
-
console.log(chalk8__default.default.yellow("\u26A0 Legacy configuration detected at .fractary/plugins/codex/config.json"));
|
|
782
|
-
console.log(chalk8__default.default.dim('Run "fractary codex migrate" to upgrade to YAML format\n'));
|
|
783
|
-
}
|
|
784
778
|
console.log("Creating directory structure...");
|
|
785
779
|
const dirs = [
|
|
786
|
-
".fractary",
|
|
787
|
-
".codex
|
|
780
|
+
".fractary/codex",
|
|
781
|
+
".fractary/codex/cache"
|
|
788
782
|
];
|
|
789
783
|
for (const dir of dirs) {
|
|
790
784
|
await fs__namespace.mkdir(path3__namespace.join(process.cwd(), dir), { recursive: true });
|
|
@@ -796,12 +790,12 @@ function initCommand() {
|
|
|
796
790
|
config.mcp.enabled = true;
|
|
797
791
|
}
|
|
798
792
|
await writeYamlConfig(config, configPath);
|
|
799
|
-
console.log(chalk8__default.default.green("\u2713"), chalk8__default.default.dim(".fractary/codex.yaml"));
|
|
800
|
-
console.log(chalk8__default.default.green("\n\u2713 Codex
|
|
793
|
+
console.log(chalk8__default.default.green("\u2713"), chalk8__default.default.dim(".fractary/codex/config.yaml"));
|
|
794
|
+
console.log(chalk8__default.default.green("\n\u2713 Codex v4.0 initialized successfully!\n"));
|
|
801
795
|
console.log(chalk8__default.default.bold("Configuration:"));
|
|
802
796
|
console.log(chalk8__default.default.dim(` Organization: ${org}`));
|
|
803
|
-
console.log(chalk8__default.default.dim(` Cache: .codex
|
|
804
|
-
console.log(chalk8__default.default.dim(` Config: .fractary/codex.yaml`));
|
|
797
|
+
console.log(chalk8__default.default.dim(` Cache: .fractary/codex/cache/`));
|
|
798
|
+
console.log(chalk8__default.default.dim(` Config: .fractary/codex/config.yaml`));
|
|
805
799
|
if (options.mcp) {
|
|
806
800
|
console.log(chalk8__default.default.dim(` MCP Server: Enabled (port 3000)`));
|
|
807
801
|
}
|
|
@@ -811,13 +805,9 @@ function initCommand() {
|
|
|
811
805
|
console.log(chalk8__default.default.dim(" - HTTP endpoint"));
|
|
812
806
|
console.log(chalk8__default.default.bold("\nNext steps:"));
|
|
813
807
|
console.log(chalk8__default.default.dim(' 1. Set your GitHub token: export GITHUB_TOKEN="your_token"'));
|
|
814
|
-
console.log(chalk8__default.default.dim(" 2. Edit .fractary/codex.yaml to configure storage providers"));
|
|
808
|
+
console.log(chalk8__default.default.dim(" 2. Edit .fractary/codex/config.yaml to configure storage providers"));
|
|
815
809
|
console.log(chalk8__default.default.dim(" 3. Fetch a document: fractary codex fetch codex://org/project/path"));
|
|
816
810
|
console.log(chalk8__default.default.dim(" 4. Check cache: fractary codex cache list"));
|
|
817
|
-
if (legacyExists) {
|
|
818
|
-
console.log(chalk8__default.default.yellow("\n\u26A0 Legacy config detected:"));
|
|
819
|
-
console.log(chalk8__default.default.dim(' Run "fractary codex migrate" to convert your existing config'));
|
|
820
|
-
}
|
|
821
811
|
} catch (error) {
|
|
822
812
|
console.error(chalk8__default.default.red("Error:"), error.message);
|
|
823
813
|
process.exit(1);
|
|
@@ -1450,7 +1440,7 @@ function syncCommand() {
|
|
|
1450
1440
|
let projectName = name;
|
|
1451
1441
|
if (!projectName) {
|
|
1452
1442
|
const detected = detectCurrentProject();
|
|
1453
|
-
projectName = detected.project ||
|
|
1443
|
+
projectName = detected.project || void 0;
|
|
1454
1444
|
}
|
|
1455
1445
|
if (!projectName) {
|
|
1456
1446
|
console.error(chalk8__default.default.red("Error:"), "Could not determine project name.");
|
|
@@ -1473,7 +1463,7 @@ function syncCommand() {
|
|
|
1473
1463
|
config: config.sync,
|
|
1474
1464
|
manifestPath: path3__namespace.join(process.cwd(), ".fractary", ".codex-sync-manifest.json")
|
|
1475
1465
|
});
|
|
1476
|
-
const defaultPatterns =
|
|
1466
|
+
const defaultPatterns = [
|
|
1477
1467
|
"docs/**/*.md",
|
|
1478
1468
|
"specs/**/*.md",
|
|
1479
1469
|
".fractary/standards/**",
|
|
@@ -1508,13 +1498,36 @@ function syncCommand() {
|
|
|
1508
1498
|
include: includePatterns,
|
|
1509
1499
|
exclude: excludePatterns
|
|
1510
1500
|
};
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1501
|
+
let plan;
|
|
1502
|
+
let routingScan;
|
|
1503
|
+
if (direction === "from-codex") {
|
|
1504
|
+
const codexRepoPath = config.cacheDir || path3__namespace.join(process.cwd(), ".fractary", "codex-cache");
|
|
1505
|
+
if (options.json) {
|
|
1506
|
+
console.log(JSON.stringify({
|
|
1507
|
+
info: "Routing-aware sync: scanning entire codex repository for files targeting this project",
|
|
1508
|
+
codexPath: codexRepoPath
|
|
1509
|
+
}, null, 2));
|
|
1510
|
+
} else {
|
|
1511
|
+
console.log(chalk8__default.default.blue("\u2139 Using routing-aware sync"));
|
|
1512
|
+
console.log(chalk8__default.default.dim(" Scanning entire codex for files routing to this project...\n"));
|
|
1513
|
+
}
|
|
1514
|
+
const planWithRouting = await syncManager.createRoutingAwarePlan(
|
|
1515
|
+
config.organization,
|
|
1516
|
+
projectName,
|
|
1517
|
+
codexRepoPath,
|
|
1518
|
+
syncOptions
|
|
1519
|
+
);
|
|
1520
|
+
plan = planWithRouting;
|
|
1521
|
+
routingScan = planWithRouting.routingScan;
|
|
1522
|
+
} else {
|
|
1523
|
+
plan = await syncManager.createPlan(
|
|
1524
|
+
config.organization,
|
|
1525
|
+
projectName,
|
|
1526
|
+
sourceDir,
|
|
1527
|
+
targetFiles,
|
|
1528
|
+
syncOptions
|
|
1529
|
+
);
|
|
1530
|
+
}
|
|
1518
1531
|
if (plan.totalFiles === 0) {
|
|
1519
1532
|
if (options.json) {
|
|
1520
1533
|
console.log(JSON.stringify({
|
|
@@ -1577,6 +1590,20 @@ function syncCommand() {
|
|
|
1577
1590
|
if (plan.estimatedTime) {
|
|
1578
1591
|
console.log(` Est. time: ${chalk8__default.default.dim(formatDuration(plan.estimatedTime))}`);
|
|
1579
1592
|
}
|
|
1593
|
+
if (routingScan) {
|
|
1594
|
+
console.log("");
|
|
1595
|
+
console.log(chalk8__default.default.bold("Routing Statistics\n"));
|
|
1596
|
+
console.log(` Scanned: ${chalk8__default.default.cyan(routingScan.stats.totalScanned.toString())} files`);
|
|
1597
|
+
console.log(` Matched: ${chalk8__default.default.cyan(routingScan.stats.totalMatched.toString())} files`);
|
|
1598
|
+
console.log(` Source projects: ${chalk8__default.default.cyan(routingScan.stats.sourceProjects.length.toString())}`);
|
|
1599
|
+
if (routingScan.stats.sourceProjects.length > 0) {
|
|
1600
|
+
console.log(chalk8__default.default.dim(` ${routingScan.stats.sourceProjects.slice(0, 5).join(", ")}`));
|
|
1601
|
+
if (routingScan.stats.sourceProjects.length > 5) {
|
|
1602
|
+
console.log(chalk8__default.default.dim(` ... and ${routingScan.stats.sourceProjects.length - 5} more`));
|
|
1603
|
+
}
|
|
1604
|
+
}
|
|
1605
|
+
console.log(` Scan time: ${chalk8__default.default.dim(formatDuration(routingScan.stats.durationMs))}`);
|
|
1606
|
+
}
|
|
1580
1607
|
console.log("");
|
|
1581
1608
|
if (plan.conflicts.length > 0) {
|
|
1582
1609
|
console.log(chalk8__default.default.yellow(`\u26A0 ${plan.conflicts.length} conflicts detected:`));
|