@collectui/bdui 0.1.6 → 0.1.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@collectui/bdui",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "description": "Add BoardUI components to your project.",
5
5
  "license": "MIT",
6
6
  "type": "module",
package/src/cli.js CHANGED
@@ -89,6 +89,10 @@ export async function run(argv) {
89
89
  )
90
90
  .option("-p, --path <dir>", "custom directory to install the skill into")
91
91
  .option("-f, --force", "overwrite an existing install (how you update)")
92
+ .option(
93
+ "-k, --key <key>",
94
+ "license key when the skill entry is Pro (single command, nothing is saved)"
95
+ )
92
96
  .action(cmdSkill);
93
97
 
94
98
  await program.parseAsync(argv, { from: "user" });
package/src/registry.js CHANGED
@@ -9,8 +9,13 @@ export const proRegistryBaseUrl = () => `${BASE}/api/pro/r`;
9
9
 
10
10
  async function fetchJson(url, headers) {
11
11
  const response = await fetch(url, { headers });
12
- if (!response.ok)
13
- throw new Error(`Registry request failed (${response.status}) for ${url}`);
12
+ if (!response.ok) {
13
+ const error = new Error(
14
+ `Registry request failed (${response.status}) for ${url}`
15
+ );
16
+ error.status = response.status;
17
+ throw error;
18
+ }
14
19
  return response.json();
15
20
  }
16
21
 
@@ -32,7 +37,10 @@ export async function fetchIndex(includePro = false) {
32
37
  export async function fetchItem(name, key) {
33
38
  try {
34
39
  return await fetchJson(`${registryBaseUrl()}/${name}.json`);
35
- } catch {
40
+ } catch (error) {
41
+ // 仅公共端 404(条目确不在免费层)才视为 Pro;网络/5xx 原样抛出,
42
+ // 否则会把上游抖动误诊成"Pro 组件需要 key",误导用户。
43
+ if (error?.status !== 404) throw error;
36
44
  if (!key) {
37
45
  throw new Error(
38
46
  `"${name}" is a BoardUI Pro component. Pass --key <license-key> to install it (CLI), or start the MCP server with --key <key>. The key is distributed by your platform or administrator.`
package/src/skill.js CHANGED
@@ -8,12 +8,14 @@ export async function cmdSkill(flags) {
8
8
  // -g → ~/.claude/skills; -c → ~/.agents/skills (codex/gemini);默认项目内 .claude/skills
9
9
  const home = process.env.HOME;
10
10
  let target;
11
- if (flags.global) target = path.join(home, ".claude", "skills", "boardui");
11
+ if (flags.path) target = path.resolve(flags.path);
12
+ else if (flags.global)
13
+ target = path.join(home, ".claude", "skills", "boardui");
12
14
  else if (flags.client)
13
15
  target = path.join(home, ".agents", "skills", "boardui");
14
16
  else target = path.join(process.cwd(), ".claude", "skills", "boardui");
15
17
 
16
- const skill = await fetchItem("skill");
18
+ const skill = await fetchItem("skill", flags.key);
17
19
  if (existsSync(target) && !flags.force) {
18
20
  throw new Error(
19
21
  `${target} already exists — pass --force to overwrite (how you update).`