@fractary/codex-cli 0.5.0 → 0.6.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 +39 -27
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +39 -27
- package/dist/cli.js.map +1 -1
- package/package.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -383,7 +383,7 @@ var init_codex_client = __esm({
|
|
|
383
383
|
const { readYamlConfig: readYamlConfig2 } = await Promise.resolve().then(() => (init_migrate_config(), migrate_config_exports));
|
|
384
384
|
const { resolveEnvVarsInConfig: resolveEnvVarsInConfig2 } = await Promise.resolve().then(() => (init_config_types(), config_types_exports));
|
|
385
385
|
try {
|
|
386
|
-
const configPath = path4.join(process.cwd(), ".fractary", "codex.yaml");
|
|
386
|
+
const configPath = path4.join(process.cwd(), ".fractary", "codex", "config.yaml");
|
|
387
387
|
let config;
|
|
388
388
|
try {
|
|
389
389
|
config = await readYamlConfig2(configPath);
|
|
@@ -980,7 +980,7 @@ function migrateCommand() {
|
|
|
980
980
|
cmd.description("Migrate legacy JSON configuration to v3.0 YAML format").option("--dry-run", "Show migration plan without executing").option("--no-backup", "Skip creating backup of old config").option("--json", "Output as JSON").action(async (options) => {
|
|
981
981
|
try {
|
|
982
982
|
const legacyConfigPath = path4.join(process.cwd(), ".fractary", "plugins", "codex", "config.json");
|
|
983
|
-
const newConfigPath = path4.join(process.cwd(), ".fractary", "codex.yaml");
|
|
983
|
+
const newConfigPath = path4.join(process.cwd(), ".fractary", "codex", "config.yaml");
|
|
984
984
|
if (!await fileExists2(legacyConfigPath)) {
|
|
985
985
|
if (options.json) {
|
|
986
986
|
console.log(JSON.stringify({
|
|
@@ -1091,7 +1091,7 @@ function migrateCommand() {
|
|
|
1091
1091
|
console.log(chalk8.dim(` Storage Providers: ${migrationResult.yamlConfig.storage?.length || 0}`));
|
|
1092
1092
|
console.log("");
|
|
1093
1093
|
console.log(chalk8.bold("Next Steps:"));
|
|
1094
|
-
console.log(chalk8.dim(" 1. Review the new configuration: .fractary/codex.yaml"));
|
|
1094
|
+
console.log(chalk8.dim(" 1. Review the new configuration: .fractary/codex/config.yaml"));
|
|
1095
1095
|
console.log(chalk8.dim(' 2. Set your GitHub token: export GITHUB_TOKEN="your_token"'));
|
|
1096
1096
|
console.log(chalk8.dim(" 3. Test fetching: fractary codex fetch codex://org/project/path"));
|
|
1097
1097
|
if (migrationResult.backupPath) {
|
|
@@ -1306,7 +1306,7 @@ async function fileExists3(filePath) {
|
|
|
1306
1306
|
}
|
|
1307
1307
|
}
|
|
1308
1308
|
async function checkConfiguration() {
|
|
1309
|
-
const configPath = path4.join(process.cwd(), ".fractary", "codex.yaml");
|
|
1309
|
+
const configPath = path4.join(process.cwd(), ".fractary", "codex", "config.yaml");
|
|
1310
1310
|
const legacyConfigPath = path4.join(process.cwd(), ".fractary", "plugins", "codex", "config.json");
|
|
1311
1311
|
try {
|
|
1312
1312
|
if (!await fileExists3(configPath)) {
|
|
@@ -1414,7 +1414,7 @@ async function checkCache() {
|
|
|
1414
1414
|
}
|
|
1415
1415
|
}
|
|
1416
1416
|
async function checkStorage() {
|
|
1417
|
-
const configPath = path4.join(process.cwd(), ".fractary", "codex.yaml");
|
|
1417
|
+
const configPath = path4.join(process.cwd(), ".fractary", "codex", "config.yaml");
|
|
1418
1418
|
try {
|
|
1419
1419
|
const config = await readYamlConfig(configPath);
|
|
1420
1420
|
const providers = config.storage || [];
|
|
@@ -1423,7 +1423,7 @@ async function checkStorage() {
|
|
|
1423
1423
|
name: "Storage",
|
|
1424
1424
|
status: "warn",
|
|
1425
1425
|
message: "No storage providers configured",
|
|
1426
|
-
details: "Configure at least one provider in .fractary/codex.yaml"
|
|
1426
|
+
details: "Configure at least one provider in .fractary/codex/config.yaml"
|
|
1427
1427
|
};
|
|
1428
1428
|
}
|
|
1429
1429
|
const providerTypes = providers.map((p) => p.type).join(", ");
|
|
@@ -1572,7 +1572,7 @@ function syncCommand() {
|
|
|
1572
1572
|
const cmd = new Command("sync");
|
|
1573
1573
|
cmd.description("Sync single project with codex repository").argument("[name]", "Project name (auto-detected if not provided)").option("--env <env>", "Target environment (dev/test/staging/prod)", "prod").option("--dry-run", "Show what would sync without executing").option("--direction <dir>", "Sync direction (to-codex/from-codex/bidirectional)", "bidirectional").option("--include <pattern>", "Include files matching pattern (can be used multiple times)", (val, prev) => prev.concat([val]), []).option("--exclude <pattern>", "Exclude files matching pattern (can be used multiple times)", (val, prev) => prev.concat([val]), []).option("--force", "Force sync without checking timestamps").option("--json", "Output as JSON").action(async (name, options) => {
|
|
1574
1574
|
try {
|
|
1575
|
-
const configPath = path4.join(process.cwd(), ".fractary", "codex.yaml");
|
|
1575
|
+
const configPath = path4.join(process.cwd(), ".fractary", "codex", "config.yaml");
|
|
1576
1576
|
let config;
|
|
1577
1577
|
try {
|
|
1578
1578
|
config = await readYamlConfig(configPath);
|
|
@@ -1608,34 +1608,46 @@ function syncCommand() {
|
|
|
1608
1608
|
config: config.sync,
|
|
1609
1609
|
manifestPath: path4.join(process.cwd(), ".fractary", ".codex-sync-manifest.json")
|
|
1610
1610
|
});
|
|
1611
|
-
const
|
|
1611
|
+
const defaultToCodexPatterns = [
|
|
1612
1612
|
"docs/**/*.md",
|
|
1613
1613
|
"specs/**/*.md",
|
|
1614
1614
|
".fractary/standards/**",
|
|
1615
1615
|
".fractary/templates/**"
|
|
1616
1616
|
];
|
|
1617
|
-
const
|
|
1617
|
+
const syncConfig = config.sync;
|
|
1618
|
+
const configIncludePatterns = syncConfig?.to_codex || defaultToCodexPatterns;
|
|
1619
|
+
const includePatterns = options.include.length > 0 ? options.include : configIncludePatterns;
|
|
1618
1620
|
const excludePatterns = [
|
|
1619
|
-
...
|
|
1621
|
+
...syncConfig?.exclude || [],
|
|
1620
1622
|
...options.exclude
|
|
1621
1623
|
];
|
|
1622
1624
|
const sourceDir = process.cwd();
|
|
1623
|
-
const
|
|
1624
|
-
const
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
}
|
|
1625
|
+
const { glob: globSync } = await import('glob');
|
|
1626
|
+
const matchedFilePaths = /* @__PURE__ */ new Set();
|
|
1627
|
+
for (const pattern of includePatterns) {
|
|
1628
|
+
try {
|
|
1629
|
+
const matches = await globSync(pattern, {
|
|
1630
|
+
cwd: sourceDir,
|
|
1631
|
+
dot: true,
|
|
1632
|
+
nodir: true,
|
|
1633
|
+
ignore: excludePatterns
|
|
1634
|
+
});
|
|
1635
|
+
matches.forEach((match) => matchedFilePaths.add(match));
|
|
1636
|
+
} catch (error) {
|
|
1637
|
+
console.error(chalk8.yellow(`Warning: Invalid pattern "${pattern}": ${error.message}`));
|
|
1636
1638
|
}
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
+
}
|
|
1640
|
+
const targetFiles = await Promise.all(
|
|
1641
|
+
Array.from(matchedFilePaths).map(async (filePath) => {
|
|
1642
|
+
const fullPath = path4.join(sourceDir, filePath);
|
|
1643
|
+
const stats = await import('fs/promises').then((fs7) => fs7.stat(fullPath));
|
|
1644
|
+
return {
|
|
1645
|
+
path: filePath,
|
|
1646
|
+
size: stats.size,
|
|
1647
|
+
mtime: stats.mtimeMs
|
|
1648
|
+
};
|
|
1649
|
+
})
|
|
1650
|
+
);
|
|
1639
1651
|
const syncOptions = {
|
|
1640
1652
|
direction,
|
|
1641
1653
|
dryRun: options.dryRun,
|
|
@@ -2076,7 +2088,7 @@ function typesAddCommand() {
|
|
|
2076
2088
|
console.log(chalk8.dim("Examples: 30m, 24h, 7d"));
|
|
2077
2089
|
process.exit(1);
|
|
2078
2090
|
}
|
|
2079
|
-
const configPath = path4.join(process.cwd(), ".fractary", "codex.yaml");
|
|
2091
|
+
const configPath = path4.join(process.cwd(), ".fractary", "codex", "config.yaml");
|
|
2080
2092
|
const config = await readYamlConfig(configPath);
|
|
2081
2093
|
if (!config.types) {
|
|
2082
2094
|
config.types = { custom: {} };
|
|
@@ -2145,7 +2157,7 @@ function typesRemoveCommand() {
|
|
|
2145
2157
|
process.exit(1);
|
|
2146
2158
|
}
|
|
2147
2159
|
const typeInfo = registry.get(name);
|
|
2148
|
-
const configPath = path4.join(process.cwd(), ".fractary", "codex.yaml");
|
|
2160
|
+
const configPath = path4.join(process.cwd(), ".fractary", "codex", "config.yaml");
|
|
2149
2161
|
const config = await readYamlConfig(configPath);
|
|
2150
2162
|
if (!config.types?.custom?.[name]) {
|
|
2151
2163
|
console.error(chalk8.red("Error:"), `Custom type "${name}" not found in configuration.`);
|