@alphalawyer/alpha-classic-cli 0.1.3 → 0.1.4

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 CHANGED
@@ -118,7 +118,7 @@ alpha-classic-cli install
118
118
  默认安装 Codex Skill:
119
119
 
120
120
  ```text
121
- ~/.codex/skills/alpha-classic-cli/SKILL.md
121
+ ~/.codex/skills/alpha-classic/SKILL.md
122
122
  ```
123
123
 
124
124
  用户也可以选择安装目标:
@@ -139,10 +139,12 @@ alpha-classic-cli uninstall --agent alphaclaw
139
139
  alpha-classic-cli uninstall --agent all
140
140
  ```
141
141
 
142
- Alpha-claw 安装方式会跟随 CLI 构建环境,例如 dev 构建安装到:
142
+ Alpha-claw 安装方式会写入所有已经存在的 AlphaClaw workspace,不会主动创建未安装的环境目录:
143
143
 
144
144
  ```text
145
- ~/.openclaw-devalphaclaw/workspace/skills/alpha-classic-cli/SKILL.md
145
+ ~/.openclaw-devalphaclaw/workspace/skills/alpha-classic/SKILL.md
146
+ ~/.openclaw-testalphaclaw/workspace/skills/alpha-classic/SKILL.md
147
+ ~/.openclaw-alphaclaw/workspace/skills/alpha-classic/SKILL.md
146
148
  ```
147
149
 
148
150
  Claude Code 安装方式:
@@ -1,5 +1,5 @@
1
1
  ---
2
- name: alpha-classic-cli
2
+ name: alpha-classic
3
3
  description: 使用 alpha-classic-cli 查询 Alpha 律所管理系统里的项目、审批等数据。先运行 doctor,优先使用稳定 CLI 命令,不自行猜 REST API。
4
4
  ---
5
5
 
@@ -7,7 +7,7 @@ description: 使用 alpha-classic-cli 查询 Alpha 律所管理系统里的项
7
7
 
8
8
  当用户询问 Alpha 律所管理系统里的项目、审批等数据时,优先使用 `alpha-classic-cli`。
9
9
 
10
- 如果用户同时安装了 `e-alpha-cli` 项目的 `agent-assistant` skill 和本项目的 `alpha-classic-cli` skill,必须优先使用 `agent-assistant` 及其通过 `alpha-cli skills update` 拉取的服务端动态 skills;只有在这些 skills 不适用、不可用或明确缺少所需能力时,才使用本项目 skill。
10
+ 如果用户同时安装了 `e-alpha-cli` 项目的 `alpha-oa` skill 和本项目的 `alpha-classic` skill,必须优先使用 `alpha-oa` 及其通过 `alpha-cli skills update` 拉取的服务端动态 skills;只有在这些 skills 不适用、不可用或明确缺少所需能力时,才使用本项目 skill。
11
11
 
12
12
  ## 使用顺序
13
13
 
@@ -2,8 +2,8 @@
2
2
 
3
3
  ## Skill 优先级
4
4
 
5
- - 如果用户同时安装了 `e-alpha-cli` 项目的 `agent-assistant` skill 和本项目的 `alpha-classic-cli` skill,优先使用 `agent-assistant` 及其通过 `alpha-cli skills update` 拉取的服务端动态 skills。
6
- - 只有在 `agent-assistant` 及服务端动态 skills 不适用、不可用或明确缺少所需能力时,才使用本项目 skill。
5
+ - 如果用户同时安装了 `e-alpha-cli` 项目的 `alpha-oa` skill 和本项目的 `alpha-classic` skill,优先使用 `alpha-oa` 及其通过 `alpha-cli skills update` 拉取的服务端动态 skills。
6
+ - 只有在 `alpha-oa` 及服务端动态 skills 不适用、不可用或明确缺少所需能力时,才使用本项目 skill。
7
7
 
8
8
  ## 登录与环境
9
9
 
package/dist/index.js CHANGED
@@ -2049,7 +2049,7 @@ async function runCapabilities(version, sessionStore) {
2049
2049
  "\u5378\u8F7D Claude Code": "alpha-classic-cli uninstall --agent claude",
2050
2050
  "\u5378\u8F7D Alpha-claw": "alpha-classic-cli uninstall --agent alphaclaw",
2051
2051
  "\u5378\u8F7D\u5168\u90E8": "alpha-classic-cli uninstall --agent all",
2052
- "\u8BF4\u660E": "\u7528\u6237\u81EA\u884C\u9009\u62E9\u5B89\u88C5\u76EE\u6807\uFF1BAlpha-claw \u4F1A\u6309\u5F53\u524D CLI \u73AF\u5883\u5B89\u88C5\u5230\u5BF9\u5E94 .openclaw-<env>alphaclaw \u5DE5\u4F5C\u533A\u3002"
2052
+ "\u8BF4\u660E": "\u7528\u6237\u81EA\u884C\u9009\u62E9\u5B89\u88C5\u76EE\u6807\uFF1BAlpha-claw \u4F1A\u5B89\u88C5\u5230\u6240\u6709\u5DF2\u5B58\u5728\u7684 dev\u3001test\u3001prod AlphaClaw workspace\u3002"
2053
2053
  },
2054
2054
  "\u8F93\u51FA\u534F\u8BAE": {
2055
2055
  "\u6210\u529F": { "ok": true, "data": "\u4E1A\u52A1\u6570\u636E" },
@@ -2349,7 +2349,7 @@ import fs from "fs/promises";
2349
2349
  import path from "path";
2350
2350
  import { fileURLToPath } from "url";
2351
2351
  var __dirname = path.dirname(fileURLToPath(import.meta.url));
2352
- var SKILL_NAME = "alpha-classic-cli";
2352
+ var SKILL_NAME = "alpha-classic";
2353
2353
  var SKILL_TEMPLATE_ROOT = resolveAssetPath("alpha-classic-skill");
2354
2354
  var CLAUDE_GUIDE_TEMPLATE = path.join(
2355
2355
  resolveAssetPath("claude"),
@@ -2380,9 +2380,20 @@ async function copyDirectory(source, target) {
2380
2380
  }
2381
2381
 
2382
2382
  // src/install/install.ts
2383
+ var ALPHA_CLAW_SKILL_ROOTS = [
2384
+ ".openclaw-devalphaclaw/workspace/skills",
2385
+ ".openclaw-testalphaclaw/workspace/skills",
2386
+ ".openclaw-alphaclaw/workspace/skills"
2387
+ ];
2388
+ var LEGACY_SKILL_NAMES = ["alpha-classic-cli"];
2383
2389
  function resolveCodexSkillPath(homeDir = os2.homedir()) {
2384
2390
  return path2.join(homeDir, ".codex", "skills", SKILL_NAME);
2385
2391
  }
2392
+ function resolveLegacyCodexSkillPaths(homeDir = os2.homedir()) {
2393
+ return LEGACY_SKILL_NAMES.map(
2394
+ (skillName) => path2.join(homeDir, ".codex", "skills", skillName)
2395
+ );
2396
+ }
2386
2397
  function resolveClaudeGuidePath(homeDir = os2.homedir()) {
2387
2398
  return path2.join(homeDir, ".claude", "alpha-classic-cli.md");
2388
2399
  }
@@ -2390,14 +2401,50 @@ function resolveClaudeMemoryPath(homeDir = os2.homedir()) {
2390
2401
  return path2.join(homeDir, ".claude", "CLAUDE.md");
2391
2402
  }
2392
2403
  function resolveAlphaClawSkillPath(homeDir = os2.homedir(), environmentName = DEFAULT_ENVIRONMENT_NAME) {
2404
+ const environmentRoots = {
2405
+ dev: ".openclaw-devalphaclaw/workspace/skills",
2406
+ test: ".openclaw-testalphaclaw/workspace/skills",
2407
+ prod: ".openclaw-alphaclaw/workspace/skills"
2408
+ };
2409
+ const skillRoot = environmentName === "local" ? environmentRoots.prod : environmentRoots[environmentName];
2393
2410
  return path2.join(
2394
2411
  homeDir,
2395
- `.openclaw-${environmentName}alphaclaw`,
2396
- "workspace",
2397
- "skills",
2412
+ skillRoot,
2398
2413
  SKILL_NAME
2399
2414
  );
2400
2415
  }
2416
+ function resolveAlphaClawSkillPaths(homeDir = os2.homedir()) {
2417
+ return ALPHA_CLAW_SKILL_ROOTS.map(
2418
+ (skillRoot) => path2.join(homeDir, skillRoot, SKILL_NAME)
2419
+ );
2420
+ }
2421
+ async function resolveExistingAlphaClawSkillRoots(homeDir = os2.homedir()) {
2422
+ const skillRoots = ALPHA_CLAW_SKILL_ROOTS.map(
2423
+ (skillRoot) => path2.join(homeDir, skillRoot)
2424
+ );
2425
+ const existingRoots = [];
2426
+ for (const skillRoot of skillRoots) {
2427
+ try {
2428
+ const stat = await fs2.stat(skillRoot);
2429
+ if (stat.isDirectory()) {
2430
+ existingRoots.push(skillRoot);
2431
+ }
2432
+ } catch (error) {
2433
+ const nodeError = error;
2434
+ if (nodeError.code !== "ENOENT") {
2435
+ throw error;
2436
+ }
2437
+ }
2438
+ }
2439
+ return existingRoots;
2440
+ }
2441
+ async function removeLegacySkillDirs(skillRoot) {
2442
+ await Promise.all(
2443
+ LEGACY_SKILL_NAMES.map(
2444
+ (skillName) => fs2.rm(path2.join(skillRoot, skillName), { recursive: true, force: true })
2445
+ )
2446
+ );
2447
+ }
2401
2448
  async function installAgentGuides(options) {
2402
2449
  const agent = options?.agent ?? "codex";
2403
2450
  const result = {
@@ -2417,7 +2464,8 @@ async function installAgentGuides(options) {
2417
2464
  result.claudeMemoryUpdated = claudeResult.claudeMemoryUpdated;
2418
2465
  }
2419
2466
  if (agent === "alphaclaw" || agent === "all") {
2420
- const alphaClawResult = await installAlphaClawSkill(options);
2467
+ const alphaClawResult = await installAlphaClawSkills(options);
2468
+ result.alphaClawSkillPaths = alphaClawResult.alphaClawSkillPaths;
2421
2469
  result.alphaClawSkillPath = alphaClawResult.alphaClawSkillPath;
2422
2470
  result.alphaClawSkillInstalled = alphaClawResult.alphaClawSkillInstalled;
2423
2471
  }
@@ -2431,6 +2479,11 @@ async function uninstallAgentGuides(options) {
2431
2479
  };
2432
2480
  if (agent === "codex" || agent === "all") {
2433
2481
  await fs2.rm(resolveCodexSkillPath(options?.homeDir), { recursive: true, force: true });
2482
+ await Promise.all(
2483
+ resolveLegacyCodexSkillPaths(options?.homeDir).map(
2484
+ (skillPath) => fs2.rm(skillPath, { recursive: true, force: true })
2485
+ )
2486
+ );
2434
2487
  result.codexSkillInstalled = false;
2435
2488
  }
2436
2489
  if (agent === "claude" || agent === "all") {
@@ -2441,8 +2494,18 @@ async function uninstallAgentGuides(options) {
2441
2494
  result.claudeMemoryUpdated = claudeResult.claudeMemoryUpdated;
2442
2495
  }
2443
2496
  if (agent === "alphaclaw" || agent === "all") {
2444
- await fs2.rm(resolveAlphaClawSkillPath(options?.homeDir, options?.environmentName), { recursive: true, force: true });
2445
- result.alphaClawSkillPath = resolveAlphaClawSkillPath(options?.homeDir, options?.environmentName);
2497
+ const alphaClawSkillPaths = resolveAlphaClawSkillPaths(options?.homeDir);
2498
+ await Promise.all(
2499
+ alphaClawSkillPaths.concat(
2500
+ ALPHA_CLAW_SKILL_ROOTS.flatMap(
2501
+ (skillRoot) => LEGACY_SKILL_NAMES.map(
2502
+ (skillName) => path2.join(options?.homeDir ?? os2.homedir(), skillRoot, skillName)
2503
+ )
2504
+ )
2505
+ ).map((skillPath) => fs2.rm(skillPath, { recursive: true, force: true }))
2506
+ );
2507
+ result.alphaClawSkillPaths = alphaClawSkillPaths;
2508
+ result.alphaClawSkillPath = alphaClawSkillPaths[0];
2446
2509
  result.alphaClawSkillInstalled = false;
2447
2510
  }
2448
2511
  return result;
@@ -2450,21 +2513,34 @@ async function uninstallAgentGuides(options) {
2450
2513
  async function installCodexSkill(options) {
2451
2514
  const skillPath = resolveCodexSkillPath(options?.homeDir);
2452
2515
  await fs2.rm(skillPath, { recursive: true, force: true });
2516
+ await Promise.all(
2517
+ resolveLegacyCodexSkillPaths(options?.homeDir).map(
2518
+ (legacySkillPath) => fs2.rm(legacySkillPath, { recursive: true, force: true })
2519
+ )
2520
+ );
2453
2521
  await copyDirectory(SKILL_TEMPLATE_ROOT, skillPath);
2454
2522
  return {
2455
2523
  codexSkillPath: skillPath,
2456
2524
  codexSkillInstalled: true
2457
2525
  };
2458
2526
  }
2459
- async function installAlphaClawSkill(options) {
2460
- const skillPath = resolveAlphaClawSkillPath(options?.homeDir, options?.environmentName);
2461
- await fs2.rm(skillPath, { recursive: true, force: true });
2462
- await copyDirectory(SKILL_TEMPLATE_ROOT, skillPath);
2527
+ async function installAlphaClawSkills(options) {
2528
+ const homeDir = options?.homeDir ?? os2.homedir();
2529
+ const skillRoots = await resolveExistingAlphaClawSkillRoots(homeDir);
2530
+ const skillPaths = [];
2531
+ for (const skillRoot of skillRoots) {
2532
+ const skillPath = path2.join(skillRoot, SKILL_NAME);
2533
+ await fs2.rm(skillPath, { recursive: true, force: true });
2534
+ await removeLegacySkillDirs(skillRoot);
2535
+ await copyDirectory(SKILL_TEMPLATE_ROOT, skillPath);
2536
+ skillPaths.push(skillPath);
2537
+ }
2463
2538
  return {
2464
2539
  codexSkillPath: resolveCodexSkillPath(options?.homeDir),
2465
2540
  codexSkillInstalled: false,
2466
- alphaClawSkillPath: skillPath,
2467
- alphaClawSkillInstalled: true
2541
+ alphaClawSkillPaths: skillPaths,
2542
+ alphaClawSkillPath: skillPaths[0],
2543
+ alphaClawSkillInstalled: skillPaths.length > 0
2468
2544
  };
2469
2545
  }
2470
2546
  async function installClaudeGuide(options) {
@@ -2514,20 +2590,28 @@ async function inspectInstallState(options) {
2514
2590
  } catch {
2515
2591
  claudeGuideInstalled = false;
2516
2592
  }
2517
- const alphaClawSkillPath = resolveAlphaClawSkillPath(options?.homeDir, options?.environmentName);
2593
+ const alphaClawSkillPath = resolveAlphaClawSkillPath(
2594
+ options?.homeDir,
2595
+ options?.environmentName
2596
+ );
2597
+ const alphaClawSkillPaths = resolveAlphaClawSkillPaths(options?.homeDir);
2598
+ const installedAlphaClawSkillPaths = [];
2518
2599
  let alphaClawSkillInstalled = false;
2519
- try {
2520
- await fs2.access(path2.join(alphaClawSkillPath, "SKILL.md"));
2521
- alphaClawSkillInstalled = true;
2522
- } catch {
2523
- alphaClawSkillInstalled = false;
2600
+ for (const skillPath2 of alphaClawSkillPaths) {
2601
+ try {
2602
+ await fs2.access(path2.join(skillPath2, "SKILL.md"));
2603
+ installedAlphaClawSkillPaths.push(skillPath2);
2604
+ } catch {
2605
+ }
2524
2606
  }
2607
+ alphaClawSkillInstalled = installedAlphaClawSkillPaths.length > 0;
2525
2608
  return {
2526
2609
  codexSkillPath: skillPath,
2527
2610
  codexSkillInstalled: installed,
2528
2611
  claudeGuidePath,
2529
2612
  claudeGuideInstalled,
2530
2613
  claudeMemoryPath: resolveClaudeMemoryPath(options?.homeDir),
2614
+ alphaClawSkillPaths: installedAlphaClawSkillPaths,
2531
2615
  alphaClawSkillPath,
2532
2616
  alphaClawSkillInstalled
2533
2617
  };
@@ -4121,10 +4205,13 @@ async function main() {
4121
4205
  }
4122
4206
  function parseAgentInstallTarget(value) {
4123
4207
  const target = (value ?? "codex").trim().toLowerCase();
4208
+ if (target === "alpha-claw") {
4209
+ return "alphaclaw";
4210
+ }
4124
4211
  if (target === "codex" || target === "claude" || target === "alphaclaw" || target === "all") {
4125
4212
  return target;
4126
4213
  }
4127
- throw new Error(`Invalid agent target: ${value}. Supported: codex, claude, alphaclaw, all`);
4214
+ throw new Error(`Invalid agent target: ${value}. Supported: codex, claude, alphaclaw, alpha-claw, all`);
4128
4215
  }
4129
4216
  main().catch((error) => {
4130
4217
  printError("runtime", error instanceof Error ? error.message : String(error));