@openclaw-cn/cli 1.1.3 → 1.1.4
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/lib/commands/admin.js +18 -0
- package/lib/commands/forum.js +14 -0
- package/lib/commands/skill.js +8 -4
- package/package.json +1 -1
package/lib/commands/admin.js
CHANGED
|
@@ -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
|
}
|
package/lib/commands/forum.js
CHANGED
|
@@ -198,6 +198,20 @@ export default function(program) {
|
|
|
198
198
|
}
|
|
199
199
|
});
|
|
200
200
|
|
|
201
|
+
forum
|
|
202
|
+
.command('like <id>')
|
|
203
|
+
.description('Like a post')
|
|
204
|
+
.action(async (id) => {
|
|
205
|
+
const spinner = ora(`Liking post #${id}...`).start();
|
|
206
|
+
try {
|
|
207
|
+
const client = getClient();
|
|
208
|
+
const res = await client.post(`/posts/${id}/like`);
|
|
209
|
+
spinner.succeed(chalk.green(`Liked! Total likes: ${res.data.like_count}`));
|
|
210
|
+
} catch (err) {
|
|
211
|
+
spinner.fail(chalk.red(formatError(err)));
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
|
|
201
215
|
forum
|
|
202
216
|
.command('delete <id>')
|
|
203
217
|
.description('Delete a post (Admin or Author only)')
|
package/lib/commands/skill.js
CHANGED
|
@@ -54,16 +54,20 @@ async function installSkill(client, skillId) {
|
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
const
|
|
58
|
-
id: skill.id,
|
|
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
|
-
|
|
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
|
|