@blocklet/cli 1.17.3-beta-20251126-121502-d0926972 → 1.17.3-beta-20251128-095123-a76cb6bc

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.
@@ -1,10 +1,12 @@
1
1
  const { checkAndKillOrphanProcesses } = require('@abtnode/util/lib/pm2/check-orphan-processes');
2
2
  const { DAEMON_SCRIPT_PATH, SERVICE_SCRIPT_PATH } = require('@abtnode/constant');
3
+ const { forEachComponentV2Sync, isInProgress } = require('@blocklet/meta/lib/util');
4
+ const { BlockletStatus } = require('@blocklet/constant');
3
5
 
4
6
  const { printSuccess, printError, printInfo, printWarning } = require('../../util');
5
7
  const { getNode } = require('../../node');
6
8
 
7
- exports.run = async ({ target }) => {
9
+ exports.run = async ({ target, appId }) => {
8
10
  // Handle orphan-process cleanup without requiring node instance
9
11
  if (target === 'orphan-process') {
10
12
  printInfo('Checking for orphan daemon/service processes...');
@@ -65,6 +67,34 @@ exports.run = async ({ target }) => {
65
67
  process.exit(0);
66
68
  }
67
69
 
70
+ if (target === 'stuck-components') {
71
+ if (!appId) {
72
+ printError('Please provide `--app-id` when cleanup stuck components');
73
+ process.exit(1);
74
+ }
75
+ const blocklet = await node.getBlocklet({ did: appId });
76
+ if (!blocklet) {
77
+ printError(`Blocklet ${appId} not found`);
78
+ process.exit(1);
79
+ }
80
+
81
+ const componentDids = [];
82
+ forEachComponentV2Sync(blocklet, (x) => {
83
+ if (isInProgress(x.status) || isInProgress(x.greenStatus)) {
84
+ componentDids.push(x.meta.did);
85
+ }
86
+ });
87
+
88
+ if (componentDids.length > 0) {
89
+ await node.states.blocklet.setBlockletStatus(blocklet.meta.did, BlockletStatus.error, { componentDids });
90
+ await node.stopBlocklet({ did: blocklet.meta.did, componentDids });
91
+ printSuccess(`Stuck components for blocklet ${appId} cleared`);
92
+ } else {
93
+ printWarning(`No stuck components found for blocklet ${appId}`);
94
+ }
95
+ process.exit(0);
96
+ }
97
+
68
98
  printError(`Unknown cleanup target: ${target}`);
69
99
  process.exit(1);
70
100
  });
@@ -126,8 +126,9 @@ module.exports = (parentCommand = '') => {
126
126
  .command('cleanup')
127
127
  .option(
128
128
  '--target <target>',
129
- 'Which target to cleanup, available options: cache, maintenance-status, blacklist, blacklist-expired, orphan-process'
129
+ 'Which target to cleanup, available options: cache, maintenance-status, blacklist, blacklist-expired, orphan-process, stuck-components'
130
130
  )
131
+ .option('--app-id <did>', 'Which blocklet to cleanup stuck components')
131
132
  .description('Do some server level cleanup work')
132
133
  .action(parseOptions(cleanup.run));
133
134
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blocklet/cli",
3
- "version": "1.17.3-beta-20251126-121502-d0926972",
3
+ "version": "1.17.3-beta-20251128-095123-a76cb6bc",
4
4
  "description": "Command line tools to manage Blocklet Server",
5
5
  "homepage": "https://www.arcblock.io/docs/blocklet-cli",
6
6
  "bin": {
@@ -33,28 +33,28 @@
33
33
  "url": "https://github.com/ArcBlock/blocklet-server/issues"
34
34
  },
35
35
  "dependencies": {
36
- "@abtnode/blocklet-services": "1.17.3-beta-20251126-121502-d0926972",
37
- "@abtnode/constant": "1.17.3-beta-20251126-121502-d0926972",
38
- "@abtnode/core": "1.17.3-beta-20251126-121502-d0926972",
39
- "@abtnode/db-cache": "1.17.3-beta-20251126-121502-d0926972",
40
- "@abtnode/logger": "1.17.3-beta-20251126-121502-d0926972",
41
- "@abtnode/models": "1.17.3-beta-20251126-121502-d0926972",
42
- "@abtnode/router-provider": "1.17.3-beta-20251126-121502-d0926972",
43
- "@abtnode/util": "1.17.3-beta-20251126-121502-d0926972",
44
- "@abtnode/webapp": "1.17.3-beta-20251126-121502-d0926972",
36
+ "@abtnode/blocklet-services": "1.17.3-beta-20251128-095123-a76cb6bc",
37
+ "@abtnode/constant": "1.17.3-beta-20251128-095123-a76cb6bc",
38
+ "@abtnode/core": "1.17.3-beta-20251128-095123-a76cb6bc",
39
+ "@abtnode/db-cache": "1.17.3-beta-20251128-095123-a76cb6bc",
40
+ "@abtnode/logger": "1.17.3-beta-20251128-095123-a76cb6bc",
41
+ "@abtnode/models": "1.17.3-beta-20251128-095123-a76cb6bc",
42
+ "@abtnode/router-provider": "1.17.3-beta-20251128-095123-a76cb6bc",
43
+ "@abtnode/util": "1.17.3-beta-20251128-095123-a76cb6bc",
44
+ "@abtnode/webapp": "1.17.3-beta-20251128-095123-a76cb6bc",
45
45
  "@arcblock/did": "^1.27.12",
46
46
  "@arcblock/event-hub": "^1.27.12",
47
47
  "@arcblock/ipfs-only-hash": "^0.0.2",
48
48
  "@arcblock/jwt": "^1.27.12",
49
49
  "@arcblock/ws": "^1.27.12",
50
- "@blocklet/constant": "1.17.3-beta-20251126-121502-d0926972",
50
+ "@blocklet/constant": "1.17.3-beta-20251128-095123-a76cb6bc",
51
51
  "@blocklet/error": "^0.3.3",
52
52
  "@blocklet/form-collector": "^0.1.8",
53
- "@blocklet/images": "1.17.3-beta-20251126-121502-d0926972",
54
- "@blocklet/meta": "1.17.3-beta-20251126-121502-d0926972",
55
- "@blocklet/resolver": "1.17.3-beta-20251126-121502-d0926972",
56
- "@blocklet/server-js": "1.17.3-beta-20251126-121502-d0926972",
57
- "@blocklet/store": "1.17.3-beta-20251126-121502-d0926972",
53
+ "@blocklet/images": "1.17.3-beta-20251128-095123-a76cb6bc",
54
+ "@blocklet/meta": "1.17.3-beta-20251128-095123-a76cb6bc",
55
+ "@blocklet/resolver": "1.17.3-beta-20251128-095123-a76cb6bc",
56
+ "@blocklet/server-js": "1.17.3-beta-20251128-095123-a76cb6bc",
57
+ "@blocklet/store": "1.17.3-beta-20251128-095123-a76cb6bc",
58
58
  "@blocklet/theme-builder": "^0.4.8",
59
59
  "@ocap/client": "^1.27.12",
60
60
  "@ocap/mcrypto": "^1.27.12",
@@ -153,7 +153,7 @@
153
153
  "engines": {
154
154
  "node": ">=14"
155
155
  },
156
- "gitHead": "7039cacaad2a14a9573371e24e57cbbd6b6525c8",
156
+ "gitHead": "8d279ee5bfc3d025f164664bc43a16ff60860297",
157
157
  "devDependencies": {
158
158
  "@types/fs-extra": "^11.0.4"
159
159
  }