@collectui/bdui 0.2.0 → 0.2.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@collectui/bdui",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Add BoardUI components to your project.",
5
5
  "license": "MIT",
6
6
  "type": "module",
package/src/add.js CHANGED
@@ -182,7 +182,7 @@ export async function cmdAdd(names, flags) {
182
182
  if (flags.key && !readSavedKey()) {
183
183
  console.log(
184
184
  c.dim(
185
- `\nTip: run \`bdui login --key <key>\` once — future commands won't need --key on this machine.`
185
+ `\nTip: run \`bdui login <key>\` once — future commands won't need --key on this machine.`
186
186
  )
187
187
  );
188
188
  }
package/src/auth.js CHANGED
@@ -82,8 +82,9 @@ async function verifyKey(key) {
82
82
  }
83
83
  }
84
84
 
85
- export async function cmdLogin(flags) {
86
- let key = flags.key?.trim();
85
+ /** 官方同款形态:位置参数 `bdui login <key>`(--key 为别名);省略时交互输入 */
86
+ export async function cmdLogin(positional, flags = {}) {
87
+ let key = (positional ?? flags.key)?.trim();
87
88
  if (!key && process.stdin.isTTY) {
88
89
  const r = await prompts({
89
90
  type: "password",
@@ -92,8 +93,7 @@ export async function cmdLogin(flags) {
92
93
  });
93
94
  key = r?.key?.trim();
94
95
  }
95
- if (!key)
96
- throw new Error("No key provided — run: bdui login --key <license-key>");
96
+ if (!key) throw new Error("No key provided — run: bdui login <license-key>");
97
97
 
98
98
  const replaced = Boolean(readSavedKey());
99
99
  console.log(`${c.cyan("login")} verifying key…`);
package/src/cli.js CHANGED
@@ -40,11 +40,11 @@ export async function run(argv) {
40
40
  .action(cmdInit);
41
41
 
42
42
  program
43
- .command("login")
43
+ .command("login [key]")
44
44
  .description(
45
45
  "Save your BoardUI license key once (verified, 0600, this machine only) — add/skill/mcp then work without --key."
46
46
  )
47
- .option("-k, --key <key>", "license key (prompts for it when omitted)")
47
+ .option("-k, --key <key>", "license key (same as the positional argument)")
48
48
  .action(cmdLogin);
49
49
 
50
50
  program
package/src/mcp.js CHANGED
@@ -138,7 +138,7 @@ async function dispatch(name, args, captured, serverKey) {
138
138
  "3. get_usage_examples — working code for an item.",
139
139
  "4. install_components — writes files, resolves internal deps recursively, installs npm deps.",
140
140
  "",
141
- "Pro items need a license key. Recommended: save it once with `npx -y @collectui/bdui login --key <key>` — stored at ~/.config/bdui/license.json (0600, this machine only), and every later CLI command and MCP session is unlocked without passing anything.",
141
+ "Pro items need a license key. Recommended: save it once with `npx -y @collectui/bdui login <key>` (official-style positional argument) — stored at ~/.config/bdui/license.json (0600, this machine only), and every later CLI command and MCP session is unlocked without passing anything.",
142
142
  "Alternatives (nothing stored): pass `key` per call to install_components (same as the CLI's `add --key <license-key>`), or start this server with `npx -y @collectui/bdui mcp --key <key>` (embed it in the args block of your MCP config).",
143
143
  "CLI equivalents: npx @collectui/bdui init | list | add <name> [--key <key>] | skill | mcp [--key <key>] | login | logout.",
144
144
  ].join("\n");
package/src/registry.js CHANGED
@@ -43,7 +43,7 @@ export async function fetchItem(name, key) {
43
43
  if (error?.status !== 404 && error?.status !== 401) throw error;
44
44
  if (!key) {
45
45
  throw new Error(
46
- `"${name}" is a BoardUI Pro component. Run \`bdui login --key <license-key>\` once to save your key on this machine, or pass --key <license-key> to this command. The key is distributed by your platform or administrator.`
46
+ `"${name}" is a BoardUI Pro component. Run \`bdui login <license-key>\` once to save your key on this machine, or pass --key <license-key> to this command. The key is distributed by your platform or administrator.`
47
47
  );
48
48
  }
49
49
  const response = await fetch(`${proRegistryBaseUrl()}/${name}`, {