@nocobase/cli 2.1.4-rc.1 → 2.1.4-rc.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.
|
@@ -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';
|
|
@@ -17,6 +17,7 @@ export default class SkillsInstall extends Command {
|
|
|
17
17
|
'<%= config.bin %> <%= command.id %>',
|
|
18
18
|
'<%= config.bin %> <%= command.id %> --yes',
|
|
19
19
|
'<%= config.bin %> <%= command.id %> --version 1.0.4',
|
|
20
|
+
'<%= config.bin %> <%= command.id %> --verbose',
|
|
20
21
|
'<%= config.bin %> <%= command.id %> --json',
|
|
21
22
|
];
|
|
22
23
|
static flags = {
|
|
@@ -55,9 +56,20 @@ export default class SkillsInstall extends Command {
|
|
|
55
56
|
return;
|
|
56
57
|
}
|
|
57
58
|
}
|
|
59
|
+
const shouldShowLoading = !flags.json && !flags.verbose;
|
|
60
|
+
if (shouldShowLoading) {
|
|
61
|
+
startTask(flags.version
|
|
62
|
+
? `Installing NocoBase AI coding skills ${flags.version}...`
|
|
63
|
+
: 'Installing NocoBase AI coding skills...');
|
|
64
|
+
}
|
|
58
65
|
const result = await installNocoBaseSkills({
|
|
59
66
|
targetVersion: flags.version,
|
|
60
67
|
verbose: flags.verbose,
|
|
68
|
+
onProgress: shouldShowLoading ? updateTask : undefined,
|
|
69
|
+
}).finally(() => {
|
|
70
|
+
if (shouldShowLoading) {
|
|
71
|
+
stopTask();
|
|
72
|
+
}
|
|
61
73
|
});
|
|
62
74
|
if (flags.json) {
|
|
63
75
|
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';
|
|
@@ -17,6 +17,7 @@ export default class SkillsUpdate extends Command {
|
|
|
17
17
|
'<%= config.bin %> <%= command.id %>',
|
|
18
18
|
'<%= config.bin %> <%= command.id %> --yes',
|
|
19
19
|
'<%= config.bin %> <%= command.id %> --version 1.0.4',
|
|
20
|
+
'<%= config.bin %> <%= command.id %> --verbose',
|
|
20
21
|
'<%= config.bin %> <%= command.id %> --json',
|
|
21
22
|
];
|
|
22
23
|
static flags = {
|
|
@@ -64,6 +65,7 @@ export default class SkillsUpdate extends Command {
|
|
|
64
65
|
const result = await updateNocoBaseSkills({
|
|
65
66
|
targetVersion: flags.version,
|
|
66
67
|
verbose: flags.verbose,
|
|
68
|
+
onProgress: shouldShowLoading ? updateTask : undefined,
|
|
67
69
|
}).finally(() => {
|
|
68
70
|
if (shouldShowLoading) {
|
|
69
71
|
stopTask();
|
|
@@ -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 =
|
|
25
|
-
const SKILLS_ADD_TIMEOUT_MS =
|
|
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
|
-
|
|
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),
|