zcf 2.9.6 → 2.9.7
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 +7 -0
- package/dist/chunks/simple-config.mjs +10 -48
- package/dist/cli.mjs +0 -3
- package/dist/index.mjs +0 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -515,6 +515,13 @@ If you find this project helpful, please consider sponsoring its development. Yo
|
|
|
515
515
|
</tr>
|
|
516
516
|
</table>
|
|
517
517
|
|
|
518
|
+
### Our Sponsors
|
|
519
|
+
|
|
520
|
+
A huge thank you to all our sponsors for their generous support!
|
|
521
|
+
|
|
522
|
+
- Tc (first sponsor)
|
|
523
|
+
- 16°C 咖啡 (My best friend🤪, offered Claude Code max $200 package)
|
|
524
|
+
|
|
518
525
|
## 📄 License
|
|
519
526
|
|
|
520
527
|
MIT License
|
|
@@ -8,17 +8,14 @@ import { exec } from 'tinyexec';
|
|
|
8
8
|
import { exec as exec$1 } from 'child_process';
|
|
9
9
|
import { promisify } from 'util';
|
|
10
10
|
import ora from 'ora';
|
|
11
|
-
import { readFile as readFile$1, writeFile as writeFile$1, mkdir } from 'fs/promises';
|
|
12
|
-
import { join as join$1 } from 'path';
|
|
13
|
-
import { homedir as homedir$1 } from 'os';
|
|
14
11
|
import semver from 'semver';
|
|
15
|
-
import { rm, mkdir
|
|
12
|
+
import { rm, mkdir, copyFile as copyFile$1 } from 'node:fs/promises';
|
|
16
13
|
import { exec as exec$2 } from 'node:child_process';
|
|
17
14
|
import { promisify as promisify$1 } from 'node:util';
|
|
18
15
|
import { homedir, platform } from 'node:os';
|
|
19
|
-
import { join as join$
|
|
16
|
+
import { join as join$1 } from 'node:path';
|
|
20
17
|
|
|
21
|
-
const version = "2.9.
|
|
18
|
+
const version = "2.9.7";
|
|
22
19
|
const homepage = "https://github.com/UfoMiao/zcf";
|
|
23
20
|
|
|
24
21
|
const common$1 = {
|
|
@@ -2051,27 +2048,6 @@ function format(template, replacements) {
|
|
|
2051
2048
|
}
|
|
2052
2049
|
|
|
2053
2050
|
const execAsync$3 = promisify(exec$1);
|
|
2054
|
-
const CACHE_DIR = join$1(homedir$1(), ".claude", "cache");
|
|
2055
|
-
const CACHE_FILE = join$1(CACHE_DIR, "version-cache.json");
|
|
2056
|
-
const CACHE_DURATION = 24 * 60 * 60 * 1e3;
|
|
2057
|
-
async function ensureCacheDir() {
|
|
2058
|
-
try {
|
|
2059
|
-
await mkdir(CACHE_DIR, { recursive: true });
|
|
2060
|
-
} catch (error) {
|
|
2061
|
-
}
|
|
2062
|
-
}
|
|
2063
|
-
async function readCache() {
|
|
2064
|
-
try {
|
|
2065
|
-
const content = await readFile$1(CACHE_FILE, "utf-8");
|
|
2066
|
-
return JSON.parse(content);
|
|
2067
|
-
} catch {
|
|
2068
|
-
return {};
|
|
2069
|
-
}
|
|
2070
|
-
}
|
|
2071
|
-
async function writeCache(cache) {
|
|
2072
|
-
await ensureCacheDir();
|
|
2073
|
-
await writeFile$1(CACHE_FILE, JSON.stringify(cache, null, 2));
|
|
2074
|
-
}
|
|
2075
2051
|
async function getInstalledVersion(command) {
|
|
2076
2052
|
try {
|
|
2077
2053
|
let stdout;
|
|
@@ -2088,24 +2064,10 @@ async function getInstalledVersion(command) {
|
|
|
2088
2064
|
return null;
|
|
2089
2065
|
}
|
|
2090
2066
|
}
|
|
2091
|
-
async function getLatestVersion(packageName
|
|
2092
|
-
if (useCache) {
|
|
2093
|
-
const cache = await readCache();
|
|
2094
|
-
const cached = cache[packageName];
|
|
2095
|
-
if (cached && Date.now() - cached.checkedAt < CACHE_DURATION) {
|
|
2096
|
-
return cached.version;
|
|
2097
|
-
}
|
|
2098
|
-
}
|
|
2067
|
+
async function getLatestVersion(packageName) {
|
|
2099
2068
|
try {
|
|
2100
2069
|
const { stdout } = await execAsync$3(`npm view ${packageName} version`);
|
|
2101
|
-
|
|
2102
|
-
const cache = await readCache();
|
|
2103
|
-
cache[packageName] = {
|
|
2104
|
-
version,
|
|
2105
|
-
checkedAt: Date.now()
|
|
2106
|
-
};
|
|
2107
|
-
await writeCache(cache);
|
|
2108
|
-
return version;
|
|
2070
|
+
return stdout.trim();
|
|
2109
2071
|
} catch {
|
|
2110
2072
|
return null;
|
|
2111
2073
|
}
|
|
@@ -2497,7 +2459,7 @@ async function installWorkflowWithDependencies(config, configLang, scriptLang) {
|
|
|
2497
2459
|
\u{1F4E6} ${i18n.workflow.installingWorkflow}: ${workflowName}...`));
|
|
2498
2460
|
const commandsDir = join(CLAUDE_DIR, "commands", "zcf");
|
|
2499
2461
|
if (!existsSync(commandsDir)) {
|
|
2500
|
-
await mkdir
|
|
2462
|
+
await mkdir(commandsDir, { recursive: true });
|
|
2501
2463
|
}
|
|
2502
2464
|
for (const commandFile of config.commands) {
|
|
2503
2465
|
const commandSource = join(rootDir, "templates", configLang, "workflow", config.category, "commands", commandFile);
|
|
@@ -2519,7 +2481,7 @@ async function installWorkflowWithDependencies(config, configLang, scriptLang) {
|
|
|
2519
2481
|
if (config.autoInstallAgents && config.agents.length > 0) {
|
|
2520
2482
|
const agentsCategoryDir = join(CLAUDE_DIR, "agents", "zcf", config.category);
|
|
2521
2483
|
if (!existsSync(agentsCategoryDir)) {
|
|
2522
|
-
await mkdir
|
|
2484
|
+
await mkdir(agentsCategoryDir, { recursive: true });
|
|
2523
2485
|
}
|
|
2524
2486
|
for (const agent of config.agents) {
|
|
2525
2487
|
const agentSource = join(rootDir, "templates", configLang, "workflow", config.category, "agents", agent.filename);
|
|
@@ -2796,8 +2758,8 @@ function getFallbackPresets() {
|
|
|
2796
2758
|
}
|
|
2797
2759
|
|
|
2798
2760
|
const execAsync = promisify$1(exec$2);
|
|
2799
|
-
const CCR_CONFIG_DIR = join$
|
|
2800
|
-
const CCR_CONFIG_FILE = join$
|
|
2761
|
+
const CCR_CONFIG_DIR = join$1(homedir(), ".claude-code-router");
|
|
2762
|
+
const CCR_CONFIG_FILE = join$1(CCR_CONFIG_DIR, "config.json");
|
|
2801
2763
|
const CCR_BACKUP_DIR = CCR_CONFIG_DIR;
|
|
2802
2764
|
function ensureCcrConfigDir() {
|
|
2803
2765
|
if (!existsSync(CCR_CONFIG_DIR)) {
|
|
@@ -2812,7 +2774,7 @@ function backupCcrConfig(scriptLang) {
|
|
|
2812
2774
|
}
|
|
2813
2775
|
const timestamp = dayjs().format("YYYY-MM-DDTHH-mm-ss-SSS") + "Z";
|
|
2814
2776
|
const backupFileName = `config.json.${timestamp}.bak`;
|
|
2815
|
-
const backupPath = join$
|
|
2777
|
+
const backupPath = join$1(CCR_BACKUP_DIR, backupFileName);
|
|
2816
2778
|
console.log(ansis.cyan(`${i18n.ccr.backupCcrConfig}`));
|
|
2817
2779
|
copyFileSync(CCR_CONFIG_FILE, backupPath);
|
|
2818
2780
|
console.log(ansis.green(`\u2714 ${i18n.ccr.ccrBackupSuccess.replace("{path}", backupPath)}`));
|
package/dist/cli.mjs
CHANGED
package/dist/index.mjs
CHANGED
package/package.json
CHANGED