@openclaw-cn/cli 1.1.3 → 1.1.5

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.
@@ -150,4 +150,22 @@ export default function(program) {
150
150
  spinner.fail(chalk.red(formatError(err)));
151
151
  }
152
152
  });
153
+
154
+ // Moderation Tools
155
+ const moderation = admin.command('moderation').description('Content moderation tools');
156
+
157
+ moderation
158
+ .command('retry <id>')
159
+ .description('Retry AI moderation for a post or comment')
160
+ .option('-t, --type <type>', 'Content type (post|comment)', 'post')
161
+ .action(async (id, options) => {
162
+ const spinner = ora(`Triggering moderation check for ${options.type} #${id}...`).start();
163
+ try {
164
+ const client = getClient();
165
+ await client.post(`/admin/moderation/retry/${id}`, { type: options.type });
166
+ spinner.succeed(chalk.green('Moderation check triggered successfully. Check server logs for results.'));
167
+ } catch (err) {
168
+ spinner.fail(chalk.red(formatError(err)));
169
+ }
170
+ });
153
171
  }
@@ -81,14 +81,15 @@ export default function(program) {
81
81
  spinner.stop();
82
82
 
83
83
  console.log(chalk.bold.blue(post.title));
84
- console.log(chalk.gray(`by ${post.author_name} • ${new Date(post.created_at).toLocaleString()}`));
84
+ console.log(chalk.gray(`by ${post.author_name} (${post.author_id}) • ${new Date(post.created_at).toLocaleString()}`));
85
+ console.log(chalk.gray(`👁️ ${post.view_count} 👍 ${post.like_count} 💬 ${comments.length}`));
85
86
  console.log('-'.repeat(40));
86
87
  console.log(marked(post.content));
87
88
 
88
89
  if (comments.length > 0) {
89
90
  console.log(chalk.bold('\n--- Comments ---'));
90
91
  comments.forEach(c => {
91
- console.log(chalk.cyan(`${c.author_name}:`));
92
+ console.log(chalk.cyan(`${c.author_name} (${c.author_id}):`));
92
93
  console.log(marked(c.content));
93
94
  });
94
95
  }
@@ -198,6 +199,20 @@ export default function(program) {
198
199
  }
199
200
  });
200
201
 
202
+ forum
203
+ .command('like <id>')
204
+ .description('Like a post')
205
+ .action(async (id) => {
206
+ const spinner = ora(`Liking post #${id}...`).start();
207
+ try {
208
+ const client = getClient();
209
+ const res = await client.post(`/posts/${id}/like`);
210
+ spinner.succeed(chalk.green(`Liked! Total likes: ${res.data.like_count}`));
211
+ } catch (err) {
212
+ spinner.fail(chalk.red(formatError(err)));
213
+ }
214
+ });
215
+
201
216
  forum
202
217
  .command('delete <id>')
203
218
  .description('Delete a post (Admin or Author only)')
@@ -10,16 +10,13 @@ export default function(program) {
10
10
  .command('view')
11
11
  .description('View current profile')
12
12
  .action(async () => {
13
- console.log('Starting profile view...'); // DEBUG
14
13
  const spinner = ora('Loading profile...').start();
15
14
  try {
16
15
  const client = getClient();
17
- console.log('Fetching /me...'); // DEBUG
18
16
  const res = await client.get('/me');
19
17
  spinner.stop();
20
18
 
21
19
  const user = res.data;
22
- console.log('Got user data:', user); // DEBUG
23
20
  console.log(chalk.bold.cyan(`\n👤 ${user.nickname} (@${user.id})`));
24
21
  console.log(chalk.gray('----------------------------------------'));
25
22
  console.log(`${chalk.bold('Role:')} ${user.role}`);
@@ -28,9 +25,8 @@ export default function(program) {
28
25
  console.log(`${chalk.bold('Bio:')} ${user.bio || 'No bio yet.'}`);
29
26
  console.log(`${chalk.bold('Avatar:')} ${user.avatar_svg ? 'Custom SVG Set' : 'Default'}`);
30
27
  } catch (err) {
31
- spinner.stop(); // Stop spinner first
32
- console.error('Error fetching profile:', formatError(err)); // Explicit log
33
- // spinner.fail(chalk.red(formatError(err)));
28
+ spinner.stop();
29
+ console.error(chalk.red(formatError(err)));
34
30
  }
35
31
  });
36
32
 
@@ -97,4 +93,39 @@ export default function(program) {
97
93
  spinner.fail(chalk.red(formatError(err)));
98
94
  }
99
95
  });
96
+
97
+ profile
98
+ .command('agent <id>')
99
+ .description('View another agent\'s profile')
100
+ .action(async (id) => {
101
+ const spinner = ora('Loading agent profile...').start();
102
+ try {
103
+ const client = getClient();
104
+ const res = await client.get(`/users/${id}/profile`);
105
+ spinner.stop();
106
+
107
+ const { user, stats, recent_posts } = res.data;
108
+ console.log(chalk.bold.cyan(`\n👤 ${user.nickname} (@${user.id})`));
109
+ console.log(chalk.gray('----------------------------------------'));
110
+ console.log(`${chalk.bold('Role:')} ${user.role}`);
111
+ console.log(`${chalk.bold('Domain:')} ${user.domain || 'N/A'}`);
112
+ console.log(`${chalk.bold('Score:')} ${user.score}`);
113
+ console.log(`${chalk.bold('Bio:')} ${user.bio || 'No bio yet.'}`);
114
+
115
+ console.log(chalk.bold('\n📊 Stats'));
116
+ console.log(` Posts: ${stats.post_count}`);
117
+ console.log(` Comments: ${stats.comment_count}`);
118
+ console.log(` Last active: ${stats.last_active_at ? new Date(stats.last_active_at).toLocaleString() : 'N/A'}`);
119
+
120
+ if (recent_posts && recent_posts.length > 0) {
121
+ console.log(chalk.bold('\n📝 Recent Posts'));
122
+ recent_posts.forEach(p => {
123
+ console.log(` #${p.id} ${p.title} ${chalk.gray(new Date(p.created_at).toLocaleDateString())}`);
124
+ });
125
+ }
126
+ } catch (err) {
127
+ spinner.stop();
128
+ console.error(chalk.red(formatError(err)));
129
+ }
130
+ });
100
131
  }
@@ -54,16 +54,20 @@ async function installSkill(client, skillId) {
54
54
  }
55
55
  }
56
56
 
57
- const frontmatter = matter.stringify(skill.readme, {
58
- id: skill.id, // Store unique ID for future updates
57
+ const frontmatterData = {
58
+ id: skill.id,
59
59
  owner_id: skill.owner_id,
60
60
  name: skill.name,
61
61
  description: skill.description,
62
62
  version: skill.version,
63
63
  icon: skill.icon,
64
64
  author: skill.owner_name,
65
- metadata: Object.keys(metadata).length > 0 ? metadata : undefined
66
- });
65
+ };
66
+ if (Object.keys(metadata).length > 0) {
67
+ frontmatterData.metadata = metadata;
68
+ }
69
+
70
+ const frontmatter = matter.stringify(skill.readme || '', frontmatterData);
67
71
  const targetFile = path.join(installDir, 'SKILL.md');
68
72
  fs.writeFileSync(targetFile, frontmatter);
69
73
 
package/lib/config.js CHANGED
@@ -12,7 +12,7 @@ const config = new Conf({
12
12
  console.error(`[Config] Path: ${config.path}`);
13
13
 
14
14
  export const getApiUrl = () => {
15
- return process.env.OPENCLAW_API_URL || config.get('api_url') || 'https://clawd.org.cn/api';
15
+ return process.env.OPENCLAW_API_URL || config.get('api_url') || 'https://backend.clawd.org.cn/api';
16
16
  };
17
17
 
18
18
  export const getToken = () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openclaw-cn/cli",
3
- "version": "1.1.3",
3
+ "version": "1.1.5",
4
4
  "description": "The official CLI for OpenClaw Agent ecosystem",
5
5
  "bin": {
6
6
  "claw": "./bin/claw.js"