@nocobase/cli 2.1.4-test.4 → 2.1.4-test.6

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.
@@ -109,8 +109,8 @@ export default class PromptsStages extends Command {
109
109
  values: presetValues,
110
110
  pageTitle: 'nb prompts-stages — Web UI',
111
111
  documentHeading: 'nb prompts-stages — `stages` demo',
112
- onServerStart: ({ host, port, url }) => {
113
- this.log(`Local Web UI (multi-stage) ready — ${url} (listening on ${host}:${port}). Submit the form in the browser to continue.`);
112
+ onServerStart: ({ listenHost, port, url }) => {
113
+ this.log(`Local Web UI (multi-stage) ready — ${url} (listening on ${listenHost}:${port}). Submit the form in the browser to continue.`);
114
114
  },
115
115
  onOpenBrowserError: (url, err) => {
116
116
  this.log(`Open this URL in a browser: ${url} (${err instanceof Error ? err.message : String(err)})`);
@@ -139,8 +139,8 @@ export default class PromptsTest extends Command {
139
139
  values: presetValues,
140
140
  pageTitle: 'nb prompts-test — UI',
141
141
  documentHeading: 'nb prompts-test',
142
- onServerStart: ({ host, port, url }) => {
143
- this.log(`Local Web UI ready — ${url} (listening on ${host}:${port}). Submit the form in the browser to continue.`);
142
+ onServerStart: ({ listenHost, port, url }) => {
143
+ this.log(`Local Web UI ready — ${url} (listening on ${listenHost}:${port}). Submit the form in the browser to continue.`);
144
144
  },
145
145
  onOpenBrowserError: (url, err) => {
146
146
  this.log(`Open this URL in a browser: ${url} (${err instanceof Error ? err.message : String(err)})`);
@@ -471,7 +471,7 @@ Prompt modes:
471
471
  default: false,
472
472
  }),
473
473
  'ui-host': Flags.string({
474
- description: 'Host for the local --ui setup server (default: 127.0.0.1)',
474
+ description: 'Browser-accessible host for the --ui setup page URL (default: 127.0.0.1)',
475
475
  }),
476
476
  'ui-port': Flags.integer({
477
477
  description: 'Port for the local --ui setup server; 0 lets the OS choose an available port',
@@ -8,7 +8,7 @@
8
8
  */
9
9
  import { Command, Flags } from '@oclif/core';
10
10
  import { confirm } from "../../lib/inquirer.js";
11
- import { setVerboseMode } from '../../lib/ui.js';
11
+ import { setVerboseMode, startTask, stopTask, updateTask } from '../../lib/ui.js';
12
12
  import { installNocoBaseSkills } from '../../lib/skills-manager.js';
13
13
  export default class SkillsInstall extends Command {
14
14
  static summary = 'Install the NocoBase AI coding skills globally';
@@ -55,9 +55,20 @@ export default class SkillsInstall extends Command {
55
55
  return;
56
56
  }
57
57
  }
58
+ const shouldShowLoading = !flags.json && !flags.verbose;
59
+ if (shouldShowLoading) {
60
+ startTask(flags.version
61
+ ? `Installing NocoBase AI coding skills ${flags.version}...`
62
+ : 'Installing NocoBase AI coding skills...');
63
+ }
58
64
  const result = await installNocoBaseSkills({
59
65
  targetVersion: flags.version,
60
66
  verbose: flags.verbose,
67
+ onProgress: shouldShowLoading ? updateTask : undefined,
68
+ }).finally(() => {
69
+ if (shouldShowLoading) {
70
+ stopTask();
71
+ }
61
72
  });
62
73
  if (flags.json) {
63
74
  this.log(JSON.stringify({
@@ -8,7 +8,7 @@
8
8
  */
9
9
  import { Command, Flags } from '@oclif/core';
10
10
  import { confirm } from "../../lib/inquirer.js";
11
- import { setVerboseMode, startTask, stopTask } from '../../lib/ui.js';
11
+ import { setVerboseMode, startTask, stopTask, updateTask } from '../../lib/ui.js';
12
12
  import { updateNocoBaseSkills } from '../../lib/skills-manager.js';
13
13
  export default class SkillsUpdate extends Command {
14
14
  static summary = 'Update the globally installed NocoBase AI coding skills';
@@ -64,6 +64,7 @@ export default class SkillsUpdate extends Command {
64
64
  const result = await updateNocoBaseSkills({
65
65
  targetVersion: flags.version,
66
66
  verbose: flags.verbose,
67
+ onProgress: shouldShowLoading ? updateTask : undefined,
67
68
  }).finally(() => {
68
69
  if (shouldShowLoading) {
69
70
  stopTask();
@@ -19,7 +19,8 @@ export const PWC_FORM_META_STEP = '_pwcStep';
19
19
  /** Form POST JSON meta field: current field key when validating a single field. */
20
20
  export const PWC_FORM_META_FIELD = '_pwcField';
21
21
  const DEFAULT_TIMEOUT_MS = 30 * 60 * 1000;
22
- const DEFAULT_HOST = '127.0.0.1';
22
+ const DEFAULT_PUBLIC_HOST = '127.0.0.1';
23
+ const LISTEN_HOST = '0.0.0.0';
23
24
  function resolveUiText(text, locale, fallback = '') {
24
25
  return resolveLocalizedText(text, { locale, fallback });
25
26
  }
@@ -705,7 +706,7 @@ function runPromptCatalogWebUIImpl(options) {
705
706
  const initialShow = reflowWebFormState(merged, Object.fromEntries(Object.entries(formDefaults).map(([k, v]) => [k, v])), userSeed).show;
706
707
  const submitPath = options.submitPath ?? DEFAULT_SUBMIT;
707
708
  const reflowPath = options.reflowPath ?? DEFAULT_REFLOW;
708
- const host = options.host ?? DEFAULT_HOST;
709
+ const publicHost = options.host ?? DEFAULT_PUBLIC_HOST;
709
710
  const timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS;
710
711
  const pageTitle = resolveUiText(options.pageTitle, locale, t('promptCatalog.web.pageTitle'));
711
712
  const h1 = resolveUiText(options.documentHeading, locale, t('promptCatalog.web.documentHeading'));
@@ -753,7 +754,7 @@ function runPromptCatalogWebUIImpl(options) {
753
754
  }
754
755
  };
755
756
  const servePage = (port) => {
756
- const base = `http://${host}:${port}`;
757
+ const base = `http://${publicHost}:${port}`;
757
758
  const formInner = buildPwcFormHtml(catalog, formDefaults, initialShow, pwcStepDefs, 0, pwcNSteps, locale, uiText);
758
759
  const wizardClientJson = JSON.stringify({ n: pwcNSteps, stepDefs: pwcStepDefs });
759
760
  const pwcValStepUrl = pwcNSteps > 1 ? JSON.stringify(base + resolveValidateStepPath) : 'null';
@@ -2207,15 +2208,15 @@ function runPromptCatalogWebUIImpl(options) {
2207
2208
  }
2208
2209
  res.writeHead(404).end();
2209
2210
  });
2210
- server.listen(options.port ?? 0, '0.0.0.0', () => {
2211
+ server.listen(options.port ?? 0, LISTEN_HOST, () => {
2211
2212
  const addr = server?.address();
2212
2213
  if (typeof addr !== 'object' || !addr) {
2213
2214
  rejectAndClose(new Error('Failed to bind HTTP server'));
2214
2215
  return;
2215
2216
  }
2216
2217
  const port = addr.port;
2217
- const startUrl = `http://${host}:${port}/`;
2218
- options.onServerStart?.({ host, port, url: startUrl });
2218
+ const startUrl = `http://${publicHost}:${port}/`;
2219
+ options.onServerStart?.({ host: publicHost, listenHost: LISTEN_HOST, port, url: startUrl });
2219
2220
  const onOpenBrowserError = options.onOpenBrowserError ?? ((u, err) => console.warn(String(err), u));
2220
2221
  try {
2221
2222
  openUrlInDefaultBrowser(startUrl, onOpenBrowserError);
@@ -21,8 +21,8 @@ const NOCOBASE_SKILLS_NAME_PREFIX = 'nocobase-';
21
21
  // resolves and boots the package, even when the local skills installation is healthy.
22
22
  const SKILLS_LIST_TIMEOUT_MS = 15000;
23
23
  const SKILLS_NPM_VIEW_TIMEOUT_MS = 3000;
24
- const SKILLS_PACK_TIMEOUT_MS = 30000;
25
- const SKILLS_ADD_TIMEOUT_MS = 20000;
24
+ const SKILLS_PACK_TIMEOUT_MS = 120000;
25
+ const SKILLS_ADD_TIMEOUT_MS = 120000;
26
26
  const NPM_REGISTRY_UNAVAILABLE_PATTERNS = [
27
27
  'enotfound',
28
28
  'eai_again',
@@ -279,6 +279,7 @@ async function prepareLocalSkillsPackage(globalRoot, options = {}, targetVersion
279
279
  const cachedVersion = await readCachedSkillsVersion(cacheRoot);
280
280
  await fsp.mkdir(cacheRoot, { recursive: true });
281
281
  if (targetVersion && cachedVersion && compareVersions(cachedVersion, targetVersion) === 0) {
282
+ options.onProgress?.(`Using cached ${NOCOBASE_SKILLS_PACKAGE_NAME}@${targetVersion}...`);
282
283
  return {
283
284
  packageDir,
284
285
  cleanup: async () => undefined,
@@ -287,12 +288,14 @@ async function prepareLocalSkillsPackage(globalRoot, options = {}, targetVersion
287
288
  await fsp.rm(packRoot, { recursive: true, force: true });
288
289
  await fsp.mkdir(packRoot, { recursive: true });
289
290
  try {
290
- await (options.runFn ?? run)('npm', ['pack', '--silent', packageSpec], {
291
+ options.onProgress?.(`Downloading ${packageSpec}...`);
292
+ await (options.runFn ?? run)('npm', ['pack', ...(options.verbose ? [] : ['--silent']), packageSpec], {
291
293
  cwd: packRoot,
292
294
  stdio: options.verbose ? 'inherit' : 'ignore',
293
295
  errorName: 'npm pack',
294
296
  timeoutMs: SKILLS_PACK_TIMEOUT_MS,
295
297
  });
298
+ options.onProgress?.(`Extracting ${NOCOBASE_SKILLS_PACKAGE_NAME}...`);
296
299
  const tarballPath = await resolvePackedSkillsTarball(packRoot);
297
300
  await extractPackedSkillsTarball(tarballPath, cacheRoot, targetVersion);
298
301
  }
@@ -385,6 +388,7 @@ async function persistManagedSkillsState(globalRoot, options = {}, installedVers
385
388
  async function reinstallManagedSkills(globalRoot, options = {}, targetVersion) {
386
389
  const prepared = await prepareLocalSkillsPackage(globalRoot, options, targetVersion);
387
390
  try {
391
+ options.onProgress?.('Installing NocoBase AI coding skills globally...');
388
392
  await (options.runFn ?? run)('npx', ['-y', 'skills', 'add', prepared.packageDir, '-g', '-y', '--skill', '*'], {
389
393
  cwd: globalRoot,
390
394
  stdio: options.verbose ? 'inherit' : 'ignore',
@@ -407,6 +411,7 @@ async function removeObsoleteManagedSkills(globalRoot, installedSkillNames, opti
407
411
  const packageSkillNames = await readCachedPackageSkillNames(globalRoot);
408
412
  const obsoleteSkillNames = pickObsoleteManagedSkillNames(installedSkillNames, packageSkillNames);
409
413
  for (const skillName of obsoleteSkillNames) {
414
+ options.onProgress?.(`Removing obsolete skill ${skillName}...`);
410
415
  await (options.runFn ?? run)('npx', ['-y', 'skills', 'remove', skillName, '-g', '-y'], {
411
416
  cwd: globalRoot,
412
417
  stdio: options.verbose ? 'inherit' : 'ignore',
@@ -416,6 +421,7 @@ async function removeObsoleteManagedSkills(globalRoot, installedSkillNames, opti
416
421
  }
417
422
  export async function installNocoBaseSkills(options = {}) {
418
423
  const globalRoot = resolveSkillsRoot(options);
424
+ options.onProgress?.('Checking installed NocoBase AI coding skills...');
419
425
  const status = await inspectSkillsStatus({
420
426
  globalRoot,
421
427
  commandOutputFn: options.commandOutputFn,
@@ -437,6 +443,7 @@ export async function installNocoBaseSkills(options = {}) {
437
443
  await reinstallManagedSkills(globalRoot, options, installVersion);
438
444
  }
439
445
  await removeObsoleteManagedSkills(globalRoot, status.installedSkillNames, options);
446
+ options.onProgress?.('Verifying installed NocoBase AI coding skills...');
440
447
  return {
441
448
  action: 'installed',
442
449
  status: await persistManagedSkillsState(globalRoot, options, targetVersion),
@@ -444,6 +451,7 @@ export async function installNocoBaseSkills(options = {}) {
444
451
  }
445
452
  export async function updateNocoBaseSkills(options = {}) {
446
453
  const globalRoot = resolveSkillsRoot(options);
454
+ options.onProgress?.('Checking installed NocoBase AI coding skills...');
447
455
  const status = await inspectSkillsStatus({
448
456
  globalRoot,
449
457
  commandOutputFn: options.commandOutputFn,
@@ -487,6 +495,7 @@ export async function updateNocoBaseSkills(options = {}) {
487
495
  await reinstallManagedSkills(globalRoot, options, installVersion);
488
496
  }
489
497
  await removeObsoleteManagedSkills(globalRoot, status.installedSkillNames, options);
498
+ options.onProgress?.('Verifying installed NocoBase AI coding skills...');
490
499
  return {
491
500
  action: 'updated',
492
501
  status: await persistManagedSkillsState(globalRoot, options, targetVersion),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/cli",
3
- "version": "2.1.4-test.4",
3
+ "version": "2.1.4-test.6",
4
4
  "description": "NocoBase Command Line Tool",
5
5
  "type": "module",
6
6
  "main": "dist/generated/command-registry.js",