@nextxai/cli 0.3.1 → 0.3.2

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/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.3.2
4
+
5
+ - `tools list`, the MCP sign-in and help examples follow the modules your product offers.
6
+
3
7
  ## 0.3.1
4
8
 
5
9
  - Help examples (`keys create --scopes`, `ci policy`) show permission codes of your own product.
package/README.md CHANGED
@@ -25,7 +25,7 @@ irm https://developers.nextx.vn/install.ps1 | iex
25
25
  Homebrew:
26
26
 
27
27
  ```bash
28
- brew install nextx-organization/tap/nextx
28
+ brew install nextx-organization/nextx/nextx
29
29
  ```
30
30
 
31
31
  npm (Node 20+):
@@ -2,7 +2,7 @@
2
2
  // MCP resource (RFC 8707): public client identified by its metadata document URL, PKCE + loopback, one consent
3
3
  // in the browser, then refresh tokens.
4
4
  import { fetch } from "undici";
5
- import { brand } from "../core/brand.js";
5
+ import { brand, visibleModule } from "../core/brand.js";
6
6
  import { context } from "../core/context.js";
7
7
  import { CliError, Exit } from "../core/errors.js";
8
8
  import { tr } from "../core/i18n.js";
@@ -54,8 +54,7 @@ async function discover() {
54
54
  export const cliClientId = () => `${context().endpoints.docs}/cli/oauth-client.json`;
55
55
  /** Scopes to ask for: everything the server offers, limited to the brand's modules. */
56
56
  function wantedScopes(offered) {
57
- const mods = brand().modules;
58
- return offered.filter((s) => !mods || mods.includes(s.split(":")[0])).join(" ");
57
+ return offered.filter((s) => visibleModule(s)).join(" ");
59
58
  }
60
59
  export async function authorizeMcp(opts = {}) {
61
60
  const { resource, as, asUrl } = await discover();
@@ -1,6 +1,6 @@
1
1
  import { Option } from "commander";
2
2
  import { readFileSync } from "node:fs";
3
- import { brand, envVar } from "../core/brand.js";
3
+ import { brand, envVar, visibleModule } from "../core/brand.js";
4
4
  import { CliError, Exit } from "../core/errors.js";
5
5
  import { currentLang, tr } from "../core/i18n.js";
6
6
  import { c, emit, info, json, ok, table } from "../core/output.js";
@@ -12,7 +12,7 @@ import { browserAvailable } from "./auth.js";
12
12
  let publicCache;
13
13
  export async function publicTools() {
14
14
  publicCache ??= (await loadPublicTools())
15
- .filter((t) => !brand().modules || brand().modules.includes(t.module));
15
+ .filter((t) => visibleModule(t.module));
16
16
  return publicCache;
17
17
  }
18
18
  async function loadPublicTools() {
@@ -93,7 +93,7 @@ export function registerTools(program) {
93
93
  });
94
94
  tools.command("list", { isDefault: true })
95
95
  .description(tr("danh sách công cụ", "list tools"))
96
- .option("--module <m>", tr("lọc theo phân hệ (crm, sales, gym…)", "filter by module (crm, sales, gym…)"))
96
+ .option("--module <m>", tr(`lọc theo phân hệ (${brand().examples.modules})`, `filter by module (${brand().examples.modules})`))
97
97
  .addOption(new Option("--kind <k>", tr("lọc theo loại", "filter by kind")).choices(["read", "proposal", "export"]))
98
98
  .option("--public", tr("danh mục công khai (không cần đăng nhập)", "public catalog (no login)"))
99
99
  .action(async (o) => {
@@ -10,11 +10,12 @@ const NEXTX = {
10
10
  clientId: "nextx-cli",
11
11
  envPrefix: "NEXTX",
12
12
  mobileApp: "NextX",
13
- examples: { scopes: "crm.contacts.view,sales.orders.view", ciKinds: "crm.tasks.create" },
13
+ examples: { scopes: "crm.contacts.view,sales.orders.view", ciKinds: "crm.tasks.create", modules: "crm, sales, dms…" },
14
14
  example: { vi: "doanh thu hôm qua", en: "yesterday's revenue" },
15
15
  apiExample: "GET /crm/contacts -f q=Minh",
16
16
  ciSettings: { vi: "Thiết lập › Ứng dụng & API › CI", en: "Settings › Apps & API › CI" },
17
17
  modules: null,
18
+ hiddenModules: ["gym", "golf"],
18
19
  env: {
19
20
  prod: {
20
21
  api: "https://api.nextx.vn",
@@ -52,3 +53,9 @@ export function envVar(name) {
52
53
  const v = process.env[`${current.envPrefix}_${name}`];
53
54
  return v === undefined || v === "" ? undefined : v;
54
55
  }
56
+ /** Whether a module (or `module:scope`, `module.resource.action`) is shown by the current brand. */
57
+ export function visibleModule(code) {
58
+ const m = code.split(/[.:]/)[0].toLowerCase();
59
+ const b = brand();
60
+ return !b.hiddenModules.includes(m) && (!b.modules || b.modules.includes(m));
61
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nextxai/cli",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "description": "NextX in your terminal: chat with NextX AI on your workspace data, call the API, manage keys and webhooks",
5
5
  "keywords": [
6
6
  "nextx",