ccem 2.0.0-beta.2 → 2.0.0-beta.3
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/index.js +34 -10
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -9,7 +9,7 @@ import Table3 from "cli-table3";
|
|
|
9
9
|
import { spawn as spawn3 } from "child_process";
|
|
10
10
|
import * as fs8 from "fs";
|
|
11
11
|
import * as path6 from "path";
|
|
12
|
-
import { fileURLToPath } from "url";
|
|
12
|
+
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
13
13
|
|
|
14
14
|
// ../../packages/core/dist/chunk-YO7HO5AS.js
|
|
15
15
|
var ENV_PRESETS = {
|
|
@@ -338,6 +338,9 @@ import * as fsPromises from "fs/promises";
|
|
|
338
338
|
import * as path2 from "path";
|
|
339
339
|
import * as os from "os";
|
|
340
340
|
import * as readline from "readline";
|
|
341
|
+
import { fileURLToPath } from "url";
|
|
342
|
+
var __filename = fileURLToPath(import.meta.url);
|
|
343
|
+
var __dirname = path2.dirname(__filename);
|
|
341
344
|
var CLAUDE_PROJECTS_DIR = path2.join(os.homedir(), ".claude", "projects");
|
|
342
345
|
var CCEM_DIR = path2.join(os.homedir(), ".ccem");
|
|
343
346
|
var CACHE_VERSION = 1;
|
|
@@ -1379,7 +1382,8 @@ async function launchClaude(options) {
|
|
|
1379
1382
|
return new Promise((resolve2) => {
|
|
1380
1383
|
const child = spawn("claude", args, {
|
|
1381
1384
|
stdio: "inherit",
|
|
1382
|
-
shell:
|
|
1385
|
+
shell: false,
|
|
1386
|
+
// 直接执行二进制,避免 shell 注入风险
|
|
1383
1387
|
env
|
|
1384
1388
|
});
|
|
1385
1389
|
child.on("exit", (code) => {
|
|
@@ -2143,7 +2147,9 @@ import crypto3 from "crypto";
|
|
|
2143
2147
|
import chalk6 from "chalk";
|
|
2144
2148
|
import Conf from "conf";
|
|
2145
2149
|
var config = new Conf({
|
|
2146
|
-
projectName: "claude-code-env-manager"
|
|
2150
|
+
projectName: "claude-code-env-manager",
|
|
2151
|
+
cwd: getCcemConfigDir()
|
|
2152
|
+
// 使用统一的配置目录
|
|
2147
2153
|
});
|
|
2148
2154
|
var decryptWithSecret = (encryptedBase64, secret) => {
|
|
2149
2155
|
const key = crypto3.scryptSync(secret, "ccem-salt", 32);
|
|
@@ -2171,7 +2177,11 @@ var loadFromRemote = async (url, secret) => {
|
|
|
2171
2177
|
console.log(chalk6.gray("Fetching from remote..."));
|
|
2172
2178
|
let response;
|
|
2173
2179
|
try {
|
|
2174
|
-
response = await fetch(url
|
|
2180
|
+
response = await fetch(url, {
|
|
2181
|
+
headers: {
|
|
2182
|
+
"X-CCEM-Key": secret
|
|
2183
|
+
}
|
|
2184
|
+
});
|
|
2175
2185
|
} catch (err) {
|
|
2176
2186
|
console.error(chalk6.red("Error: Failed to connect to server"));
|
|
2177
2187
|
console.error(chalk6.gray(err.message));
|
|
@@ -2241,6 +2251,7 @@ Loaded ${results.length} environment(s) from remote:`));
|
|
|
2241
2251
|
}
|
|
2242
2252
|
}
|
|
2243
2253
|
console.log(chalk6.gray("\nRun 'ccem ls' to see all environments."));
|
|
2254
|
+
return results;
|
|
2244
2255
|
};
|
|
2245
2256
|
|
|
2246
2257
|
// src/cron-skill.ts
|
|
@@ -2386,8 +2397,8 @@ Replace \\\`TARGET_ID\\\` or \\\`TARGET_NAME\\\` with the user's selection.
|
|
|
2386
2397
|
`;
|
|
2387
2398
|
|
|
2388
2399
|
// src/index.ts
|
|
2389
|
-
var
|
|
2390
|
-
var __dirname2 = path6.dirname(
|
|
2400
|
+
var __filename2 = fileURLToPath2(import.meta.url);
|
|
2401
|
+
var __dirname2 = path6.dirname(__filename2);
|
|
2391
2402
|
var pkgPath = path6.resolve(__dirname2, "..", "package.json");
|
|
2392
2403
|
var pkg = JSON.parse(fs8.readFileSync(pkgPath, "utf-8"));
|
|
2393
2404
|
var program = new Command();
|
|
@@ -2879,10 +2890,21 @@ skillCmd.command("ls").description("\u5217\u51FA\u5DF2\u5B89\u88C5\u7684 skills"
|
|
|
2879
2890
|
skillCmd.command("rm <name>").description("\u5220\u9664\u5DF2\u5B89\u88C5\u7684 skill").action((name) => {
|
|
2880
2891
|
removeSkill(name);
|
|
2881
2892
|
});
|
|
2882
|
-
program.command("load <url>").description("\u4ECE\u8FDC\u7A0B\u670D\u52A1\u5668\u52A0\u8F7D\u73AF\u5883\u914D\u7F6E").requiredOption("--secret <secret>", "\u89E3\u5BC6\u5BC6\u94A5").action(async (url, options) => {
|
|
2883
|
-
await loadFromRemote(url, options.secret);
|
|
2893
|
+
program.command("load <url>").description("\u4ECE\u8FDC\u7A0B\u670D\u52A1\u5668\u52A0\u8F7D\u73AF\u5883\u914D\u7F6E").requiredOption("--secret <secret>", "\u89E3\u5BC6\u5BC6\u94A5").option("--json", "\u4EE5 JSON \u683C\u5F0F\u8F93\u51FA\u7ED3\u679C\uFF08\u4F9B\u7A0B\u5E8F\u8C03\u7528\uFF09").action(async (url, options) => {
|
|
2894
|
+
const results = await loadFromRemote(url, options.secret);
|
|
2895
|
+
if (options.json) {
|
|
2896
|
+
console.log(JSON.stringify({
|
|
2897
|
+
count: results.length,
|
|
2898
|
+
environments: results.map((r) => ({
|
|
2899
|
+
name: r.name,
|
|
2900
|
+
original_name: r.originalName,
|
|
2901
|
+
// 使用 snake_case 匹配 Rust 结构体
|
|
2902
|
+
renamed: r.renamed
|
|
2903
|
+
}))
|
|
2904
|
+
}));
|
|
2905
|
+
}
|
|
2884
2906
|
});
|
|
2885
|
-
program.command("launch").description(false).option("--env <name>", "\u73AF\u5883\u540D\u79F0").option("--perm <mode>", "\u6743\u9650\u6A21\u5F0F").option("--session-id <id>", "\u4F1A\u8BDD ID").option("--resume-session <id>", "\u6062\u590D\u4F1A\u8BDD ID").option("--working-dir <path>", "\u5DE5\u4F5C\u76EE\u5F55").action(async function() {
|
|
2907
|
+
program.command("launch").description(false).option("--env <name>", "\u73AF\u5883\u540D\u79F0").option("--perm <mode>", "\u6743\u9650\u6A21\u5F0F").option("--session-id <id>", "\u4F1A\u8BDD ID").option("--resume-session <id>", "\u6062\u590D\u4F1A\u8BDD ID").option("--working-dir <path>", "\u5DE5\u4F5C\u76EE\u5F55").option("--proxy-base-url <url>", "Desktop internal override for ANTHROPIC_BASE_URL").option("--anthropic-base-url <url>", "Deprecated alias for --proxy-base-url").action(async function() {
|
|
2886
2908
|
const opts = this.opts();
|
|
2887
2909
|
const envName = opts.env || config2.get("current");
|
|
2888
2910
|
const registries = config2.get("registries");
|
|
@@ -2891,8 +2913,10 @@ program.command("launch").description(false).option("--env <name>", "\u73AF\u588
|
|
|
2891
2913
|
console.error(chalk7.red(`Environment '${envName}' not found.`));
|
|
2892
2914
|
process.exit(1);
|
|
2893
2915
|
}
|
|
2916
|
+
const proxyBaseUrl = opts.proxyBaseUrl || opts.anthropicBaseUrl;
|
|
2917
|
+
const launchEnvConfig = proxyBaseUrl ? { ...envConfig, ANTHROPIC_BASE_URL: proxyBaseUrl } : envConfig;
|
|
2894
2918
|
await launchClaude({
|
|
2895
|
-
envConfig,
|
|
2919
|
+
envConfig: launchEnvConfig,
|
|
2896
2920
|
permMode: opts.perm,
|
|
2897
2921
|
workingDir: opts.workingDir,
|
|
2898
2922
|
sessionId: opts.sessionId,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ccem",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Claude Code Environment Manager",
|
|
6
6
|
"author": {
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"tsup": "^8.0.2",
|
|
37
37
|
"typescript": "^5.3.3",
|
|
38
38
|
"vitest": "^4.0.18",
|
|
39
|
-
"@ccem/core": "2.0.0-beta.
|
|
39
|
+
"@ccem/core": "2.0.0-beta.3"
|
|
40
40
|
},
|
|
41
41
|
"scripts": {
|
|
42
42
|
"generate-logo": "bash scripts/generate-logo.sh",
|