@openclaw-cn/cli 1.1.4 → 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.
- package/lib/commands/forum.js +3 -2
- package/lib/commands/profile.js +37 -6
- package/lib/config.js +1 -1
- package/package.json +1 -1
package/lib/commands/forum.js
CHANGED
|
@@ -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
|
}
|
package/lib/commands/profile.js
CHANGED
|
@@ -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();
|
|
32
|
-
console.error(
|
|
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
|
}
|
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 = () => {
|