@collectui/cli 0.2.5 → 0.2.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/cli",
3
- "version": "0.2.5",
3
+ "version": "0.2.7",
4
4
  "description": "One CLI for every shadcn library on CollectUI Dash — login once, configure registries & MCP, scaffold agent-ready projects.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -104,7 +104,11 @@ function addViaRegistry({ flags, reporter, lib, rawComponents, root, cliKey, fil
104
104
 
105
105
  const command = ["npx", ...args].join(" ");
106
106
  if (flags.print) {
107
- reporter.result({ command, components: names, scopes, env: Object.keys(env), missingScopes: missing });
107
+ if (reporter.headless) {
108
+ reporter.result({ command, components: names, scopes, env: Object.keys(env), missingScopes: missing });
109
+ } else {
110
+ reporter.info(command);
111
+ }
108
112
  return { command };
109
113
  }
110
114
 
@@ -13,15 +13,23 @@ export async function loginCmd(flags, rest, reporter) {
13
13
  skipVerify: Boolean(flags["no-verify"]),
14
14
  pat: Boolean(flags.pat),
15
15
  });
16
- reporter.result({
17
- account: me?.account ?? null,
18
- libraries: (me?.sites ?? []).map((s) => s.slug),
19
- keys: (me?.keys ?? []).length,
20
- });
16
+ // 交互模式:账号已在 success 行里,数量并入 outro 即可,不再画框;
17
+ // --json / headless 才给完整结构(Agent 消费 uid / 库清单 / key 数)
18
+ if (reporter.headless) {
19
+ reporter.result({
20
+ account: {
21
+ uid: me?.account?.uid ?? null,
22
+ username: me?.account?.username ?? null,
23
+ },
24
+ libraries: (me?.sites ?? []).map((s) => s.slug),
25
+ keys: (me?.keys ?? []).length,
26
+ });
27
+ }
21
28
  }
22
29
 
23
30
  export function logoutCmd(flags, rest, reporter) {
24
31
  logout({ reporter });
25
- reporter.result({ loggedOut: true });
32
+ // info 行 + outro 已把话说完,Result 框只留给 --json
33
+ if (reporter.headless) reporter.result({ loggedOut: true });
26
34
  reporter.outro("Logged out.");
27
35
  }
@@ -210,7 +210,12 @@ export async function runSetup({ flags, rest = [], reporter, mode }) {
210
210
  "collectui doctor",
211
211
  ].filter(Boolean),
212
212
  };
213
- reporter.result(summary);
213
+ if (reporter.headless) {
214
+ reporter.result(summary);
215
+ } else {
216
+ // TTY 下不画 Result 大框;下一步行动指引是 summary 里唯一对人有用的
217
+ reporter.note("Next steps", summary.next.join("\n"));
218
+ }
214
219
  reporter.outro(
215
220
  flags["dry-run"]
216
221
  ? "Dry run complete. Re-run without --dry-run to apply."
@@ -21,6 +21,7 @@ export async function skillCmd(flags, rest, reporter) {
21
21
  });
22
22
  cs.write(target, content, { summary: "install the CollectUI agent skill" });
23
23
  await cs.apply();
24
- reporter.result({ path: target, scope: global ? "global" : "project" });
24
+ if (reporter.headless) reporter.result({ path: target, scope: global ? "global" : "project" });
25
+ else reporter.info(`Skill written to ${target}.`);
25
26
  reporter.outro("Skill installed. Claude Code picks it up automatically.");
26
27
  }
@@ -14,7 +14,7 @@ export async function updateCmd(flags, _rest, reporter) {
14
14
  throw new CliError("--off and --on are mutually exclusive.", { code: 2 });
15
15
  }
16
16
  const next = writeConfig({ autoUpdate: !flags.off });
17
- reporter.result({ autoUpdate: next.autoUpdate !== false });
17
+ if (reporter.headless) reporter.result({ autoUpdate: next.autoUpdate !== false });
18
18
  reporter.outro(next.autoUpdate !== false ? "Auto-update enabled." : "Auto-update disabled (still notifies on new versions).");
19
19
  return;
20
20
  }
@@ -25,13 +25,13 @@ export async function updateCmd(flags, _rest, reporter) {
25
25
  const summary = { current: CLI_VERSION, latest, updateAvailable: cmp > 0 };
26
26
 
27
27
  if (cmp <= 0) {
28
- reporter.result(summary);
28
+ if (reporter.headless) reporter.result(summary);
29
29
  reporter.outro(`Already on the latest version (${CLI_VERSION}).`);
30
30
  return;
31
31
  }
32
32
 
33
33
  if (flags.check) {
34
- reporter.result(summary);
34
+ if (reporter.headless) reporter.result(summary);
35
35
  reporter.outro(`Update available: ${CLI_VERSION} → ${latest} (re-run without --check to install).`);
36
36
  return;
37
37
  }
@@ -43,6 +43,6 @@ export async function updateCmd(flags, _rest, reporter) {
43
43
  hint: "Run `npm i -g @collectui/cli` manually to see the npm error; check global-prefix permissions (sudo/nvm).",
44
44
  });
45
45
  }
46
- reporter.result({ ...summary, updated: true });
46
+ if (reporter.headless) reporter.result({ ...summary, updated: true });
47
47
  reporter.outro(`Updated to ${latest}. Re-run commands to pick it up.`);
48
48
  }
package/src/login.mjs CHANGED
@@ -26,7 +26,7 @@ export function saveSession(token, me, { reporter } = {}) {
26
26
  });
27
27
  reporter?.success(
28
28
  account?.username
29
- ? `Logged in as ${account.username} (${account.uid}).`
29
+ ? `Logged in as ${account.username}.`
30
30
  : "Logged in. Token saved locally."
31
31
  );
32
32
  return account;