@wenrwa/marketplace-cli 0.1.0 → 0.2.0
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/README.md +14 -0
- package/dist/__tests__/agent.test.d.ts +1 -0
- package/dist/__tests__/agent.test.js +138 -0
- package/dist/__tests__/apps.test.d.ts +1 -0
- package/dist/__tests__/apps.test.js +160 -0
- package/dist/__tests__/auth.test.d.ts +1 -0
- package/dist/__tests__/auth.test.js +94 -0
- package/dist/__tests__/bounty.test.d.ts +1 -0
- package/dist/__tests__/bounty.test.js +185 -0
- package/dist/__tests__/client.test.d.ts +1 -0
- package/dist/__tests__/client.test.js +106 -0
- package/dist/__tests__/config.test.d.ts +1 -0
- package/dist/__tests__/config.test.js +99 -0
- package/dist/__tests__/dashboard-helpers.test.d.ts +1 -0
- package/dist/__tests__/dashboard-helpers.test.js +123 -0
- package/dist/__tests__/format.test.d.ts +1 -0
- package/dist/__tests__/format.test.js +144 -0
- package/dist/__tests__/helpers.d.ts +7 -0
- package/dist/__tests__/helpers.js +12 -0
- package/dist/__tests__/treasury.test.d.ts +1 -0
- package/dist/__tests__/treasury.test.js +122 -0
- package/dist/__tests__/websocket.test.d.ts +1 -0
- package/dist/__tests__/websocket.test.js +61 -0
- package/dist/__tests__/workspace.test.d.ts +1 -0
- package/dist/__tests__/workspace.test.js +105 -0
- package/dist/commands/agent.d.ts +0 -0
- package/dist/commands/agent.js +0 -0
- package/dist/commands/apps.d.ts +2 -0
- package/dist/commands/apps.js +174 -0
- package/dist/commands/auth.d.ts +0 -0
- package/dist/commands/auth.js +0 -0
- package/dist/commands/bounty.d.ts +0 -0
- package/dist/commands/bounty.js +8 -0
- package/dist/commands/dashboard.d.ts +31 -0
- package/dist/commands/dashboard.js +5 -0
- package/dist/commands/treasury.d.ts +0 -0
- package/dist/commands/treasury.js +2 -2
- package/dist/commands/webhook.d.ts +2 -0
- package/dist/commands/webhook.js +131 -0
- package/dist/commands/workspace.d.ts +0 -0
- package/dist/commands/workspace.js +160 -13
- package/dist/index.d.ts +0 -0
- package/dist/index.js +4 -0
- package/dist/utils/client.d.ts +1 -0
- package/dist/utils/client.js +3 -0
- package/dist/utils/config.d.ts +0 -0
- package/dist/utils/config.js +0 -0
- package/dist/utils/format.d.ts +0 -1
- package/dist/utils/format.js +2 -11
- package/dist/utils/websocket.d.ts +0 -0
- package/dist/utils/websocket.js +0 -0
- package/package.json +5 -2
|
@@ -9,10 +9,10 @@ const chalk_1 = __importDefault(require("chalk"));
|
|
|
9
9
|
const client_1 = require("../utils/client");
|
|
10
10
|
const format_1 = require("../utils/format");
|
|
11
11
|
const websocket_1 = require("../utils/websocket");
|
|
12
|
-
exports.workspaceCommand = new commander_1.Command('workspace').description('Workspace
|
|
12
|
+
exports.workspaceCommand = new commander_1.Command('workspace').description('Workspace management');
|
|
13
13
|
exports.workspaceCommand
|
|
14
14
|
.command('list')
|
|
15
|
-
.description('List
|
|
15
|
+
.description('List workspaces you own or belong to')
|
|
16
16
|
.action(async () => {
|
|
17
17
|
try {
|
|
18
18
|
const client = (0, client_1.getClient)();
|
|
@@ -22,13 +22,155 @@ exports.workspaceCommand
|
|
|
22
22
|
console.log('No workspaces found.');
|
|
23
23
|
return;
|
|
24
24
|
}
|
|
25
|
-
console.log((0, format_1.makeTable)(['ID', 'Name', '
|
|
25
|
+
console.log((0, format_1.makeTable)(['ID', 'Name', 'Visibility', 'Mode', 'Agents', 'Tags', 'Created'], workspaces.map((ws) => [
|
|
26
26
|
(0, format_1.shorten)(ws.id),
|
|
27
27
|
ws.name,
|
|
28
|
+
ws.visibility || 'private',
|
|
28
29
|
ws.mode || 'open',
|
|
29
|
-
String(ws.
|
|
30
|
-
|
|
31
|
-
ws.
|
|
30
|
+
String((ws.agentWallets || ws.agents || []).length),
|
|
31
|
+
(ws.tags || []).join(', ') || '—',
|
|
32
|
+
ws.createdAt ? new Date(ws.createdAt).toLocaleDateString() : '',
|
|
33
|
+
])));
|
|
34
|
+
}
|
|
35
|
+
catch (err) {
|
|
36
|
+
(0, format_1.error)(err.message);
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
exports.workspaceCommand
|
|
40
|
+
.command('create')
|
|
41
|
+
.description('Create a new workspace')
|
|
42
|
+
.requiredOption('--name <name>', 'Workspace name')
|
|
43
|
+
.option('--description <description>', 'Workspace description')
|
|
44
|
+
.option('--visibility <visibility>', 'Visibility: public or private', 'private')
|
|
45
|
+
.option('--tags <tags>', 'Comma-separated tags')
|
|
46
|
+
.action(async (opts) => {
|
|
47
|
+
try {
|
|
48
|
+
const client = (0, client_1.getClient)();
|
|
49
|
+
const body = { name: opts.name };
|
|
50
|
+
if (opts.description)
|
|
51
|
+
body.description = opts.description;
|
|
52
|
+
if (opts.visibility)
|
|
53
|
+
body.visibility = opts.visibility;
|
|
54
|
+
if (opts.tags)
|
|
55
|
+
body.tags = opts.tags.split(',').map((t) => t.trim());
|
|
56
|
+
const data = await client.post('/workspaces', body);
|
|
57
|
+
const ws = data.workspace;
|
|
58
|
+
(0, format_1.heading)('Workspace Created');
|
|
59
|
+
console.log(` ID: ${ws.id}`);
|
|
60
|
+
console.log(` Name: ${ws.name}`);
|
|
61
|
+
console.log(` Visibility: ${ws.visibility}`);
|
|
62
|
+
if (ws.description)
|
|
63
|
+
console.log(` Description: ${ws.description}`);
|
|
64
|
+
if (ws.tags?.length)
|
|
65
|
+
console.log(` Tags: ${ws.tags.join(', ')}`);
|
|
66
|
+
}
|
|
67
|
+
catch (err) {
|
|
68
|
+
(0, format_1.error)(err.message);
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
exports.workspaceCommand
|
|
72
|
+
.command('explore')
|
|
73
|
+
.description('Browse public workspaces')
|
|
74
|
+
.option('--search <query>', 'Search by name or description')
|
|
75
|
+
.option('--tags <tags>', 'Filter by comma-separated tags')
|
|
76
|
+
.option('--limit <n>', 'Max results', '20')
|
|
77
|
+
.action(async (opts) => {
|
|
78
|
+
try {
|
|
79
|
+
const client = (0, client_1.getClient)();
|
|
80
|
+
const params = new URLSearchParams();
|
|
81
|
+
if (opts.search)
|
|
82
|
+
params.set('search', opts.search);
|
|
83
|
+
if (opts.tags)
|
|
84
|
+
params.set('tags', opts.tags);
|
|
85
|
+
params.set('limit', opts.limit);
|
|
86
|
+
const query = params.toString();
|
|
87
|
+
const data = await client.get(`/workspaces/explore${query ? `?${query}` : ''}`);
|
|
88
|
+
const workspaces = data.workspaces || [];
|
|
89
|
+
if (workspaces.length === 0) {
|
|
90
|
+
console.log('No public workspaces found.');
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
(0, format_1.heading)(`Public Workspaces (${data.total} total)`);
|
|
94
|
+
console.log((0, format_1.makeTable)(['ID', 'Name', 'Description', 'Tags', 'Agents'], workspaces.map((ws) => [
|
|
95
|
+
(0, format_1.shorten)(ws.id),
|
|
96
|
+
ws.name,
|
|
97
|
+
(ws.description || '').slice(0, 40) || '—',
|
|
98
|
+
(ws.tags || []).join(', ') || '—',
|
|
99
|
+
String((ws.agentWallets || ws.agents || []).length),
|
|
100
|
+
])));
|
|
101
|
+
}
|
|
102
|
+
catch (err) {
|
|
103
|
+
(0, format_1.error)(err.message);
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
exports.workspaceCommand
|
|
107
|
+
.command('join')
|
|
108
|
+
.argument('<target>', 'Workspace ID or invite token')
|
|
109
|
+
.option('--invite', 'Treat target as an invite token')
|
|
110
|
+
.description('Join a public workspace or redeem an invite')
|
|
111
|
+
.action(async (target, opts) => {
|
|
112
|
+
try {
|
|
113
|
+
const client = (0, client_1.getClient)();
|
|
114
|
+
if (opts.invite) {
|
|
115
|
+
const data = await client.post(`/workspaces/invites/${target}/redeem`, {});
|
|
116
|
+
console.log(chalk_1.default.green(`Joined workspace: ${data.workspace.name} (${data.workspace.id})`));
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
const data = await client.post(`/workspaces/${target}/join`, {});
|
|
120
|
+
console.log(chalk_1.default.green(`Joined workspace: ${data.workspace.name} (${data.workspace.id})`));
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
catch (err) {
|
|
124
|
+
(0, format_1.error)(err.message);
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
exports.workspaceCommand
|
|
128
|
+
.command('invite-create')
|
|
129
|
+
.argument('<workspace-id>', 'Workspace ID')
|
|
130
|
+
.option('--max-uses <n>', 'Maximum number of uses')
|
|
131
|
+
.option('--expires <date>', 'Expiration date (ISO 8601)')
|
|
132
|
+
.description('Create an invite link for a workspace')
|
|
133
|
+
.action(async (workspaceId, opts) => {
|
|
134
|
+
try {
|
|
135
|
+
const client = (0, client_1.getClient)();
|
|
136
|
+
const body = {};
|
|
137
|
+
if (opts.maxUses)
|
|
138
|
+
body.maxUses = parseInt(opts.maxUses, 10);
|
|
139
|
+
if (opts.expires)
|
|
140
|
+
body.expiresAt = opts.expires;
|
|
141
|
+
const data = await client.post(`/workspaces/${workspaceId}/invites`, body);
|
|
142
|
+
const invite = data.invite;
|
|
143
|
+
(0, format_1.heading)('Invite Created');
|
|
144
|
+
console.log(` Token: ${invite.token}`);
|
|
145
|
+
console.log(` Max Uses: ${invite.maxUses ?? 'unlimited'}`);
|
|
146
|
+
console.log(` Expires: ${invite.expiresAt ?? 'never'}`);
|
|
147
|
+
console.log('');
|
|
148
|
+
console.log(chalk_1.default.cyan(` Share: wenrwa workspace join ${invite.token} --invite`));
|
|
149
|
+
}
|
|
150
|
+
catch (err) {
|
|
151
|
+
(0, format_1.error)(err.message);
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
exports.workspaceCommand
|
|
155
|
+
.command('invite-list')
|
|
156
|
+
.argument('<workspace-id>', 'Workspace ID')
|
|
157
|
+
.description('List invites for a workspace')
|
|
158
|
+
.action(async (workspaceId) => {
|
|
159
|
+
try {
|
|
160
|
+
const client = (0, client_1.getClient)();
|
|
161
|
+
const data = await client.get(`/workspaces/${workspaceId}/invites`);
|
|
162
|
+
const invites = data.invites || [];
|
|
163
|
+
if (invites.length === 0) {
|
|
164
|
+
console.log('No invites found.');
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
console.log((0, format_1.makeTable)(['ID', 'Token', 'Uses', 'Max Uses', 'Expires', 'Created'], invites.map((inv) => [
|
|
168
|
+
(0, format_1.shorten)(inv.id),
|
|
169
|
+
inv.token.slice(0, 12) + '...',
|
|
170
|
+
String(inv.useCount),
|
|
171
|
+
inv.maxUses != null ? String(inv.maxUses) : 'unlimited',
|
|
172
|
+
inv.expiresAt ? new Date(inv.expiresAt).toLocaleDateString() : 'never',
|
|
173
|
+
new Date(inv.createdAt).toLocaleDateString(),
|
|
32
174
|
])));
|
|
33
175
|
}
|
|
34
176
|
catch (err) {
|
|
@@ -45,10 +187,15 @@ exports.workspaceCommand
|
|
|
45
187
|
const data = await client.get(`/workspaces/${workspaceId}`);
|
|
46
188
|
const ws = data.workspace;
|
|
47
189
|
(0, format_1.heading)(`Workspace: ${ws.name}`);
|
|
48
|
-
console.log(` ID:
|
|
49
|
-
console.log(` Mode:
|
|
50
|
-
console.log(`
|
|
51
|
-
console.log(`
|
|
190
|
+
console.log(` ID: ${ws.id}`);
|
|
191
|
+
console.log(` Mode: ${ws.mode}`);
|
|
192
|
+
console.log(` Visibility: ${ws.visibility || 'private'}`);
|
|
193
|
+
console.log(` Escrow: ${ws.use_escrow || ws.useEscrow ? 'Yes' : 'No'}`);
|
|
194
|
+
if (ws.description)
|
|
195
|
+
console.log(` Description: ${ws.description}`);
|
|
196
|
+
if (ws.tags?.length)
|
|
197
|
+
console.log(` Tags: ${ws.tags.join(', ')}`);
|
|
198
|
+
console.log(` Created: ${ws.createdAt || ws.created_at}`);
|
|
52
199
|
// Fetch bounties for this workspace
|
|
53
200
|
const bountyData = await client.get(`/bounties?workspaceId=${workspaceId}`);
|
|
54
201
|
const bounties = bountyData.bounties || [];
|
|
@@ -57,9 +204,9 @@ exports.workspaceCommand
|
|
|
57
204
|
console.log((0, format_1.makeTable)(['Title', 'Status', 'Assignee', 'Reward', 'Blocked By'], bounties.map((b) => [
|
|
58
205
|
b.title.slice(0, 30),
|
|
59
206
|
(0, format_1.statusColor)(b.status),
|
|
60
|
-
b.assignee_wallet ? (0, format_1.shorten)(b.assignee_wallet) : '—',
|
|
61
|
-
(0, format_1.formatReward)(b.reward_amount, b.reward_symbol),
|
|
62
|
-
b.blocked_by?.length ? b.blocked_by.map((id) => (0, format_1.shorten)(id)).join(', ') : '—',
|
|
207
|
+
b.assignee_wallet || b.assigneeWallet ? (0, format_1.shorten)(b.assignee_wallet || b.assigneeWallet) : '—',
|
|
208
|
+
(0, format_1.formatReward)(b.reward_amount || b.rewardAmount, b.reward_symbol || b.rewardSymbol),
|
|
209
|
+
(b.blocked_by || b.blockedBy)?.length ? (b.blocked_by || b.blockedBy).map((id) => (0, format_1.shorten)(id)).join(', ') : '—',
|
|
63
210
|
])));
|
|
64
211
|
}
|
|
65
212
|
// Fetch treasury
|
package/dist/index.d.ts
CHANGED
|
File without changes
|
package/dist/index.js
CHANGED
|
@@ -8,6 +8,8 @@ const bounty_1 = require("./commands/bounty");
|
|
|
8
8
|
const agent_1 = require("./commands/agent");
|
|
9
9
|
const treasury_1 = require("./commands/treasury");
|
|
10
10
|
const dashboard_1 = require("./commands/dashboard");
|
|
11
|
+
const webhook_1 = require("./commands/webhook");
|
|
12
|
+
const apps_1 = require("./commands/apps");
|
|
11
13
|
const program = new commander_1.Command();
|
|
12
14
|
program
|
|
13
15
|
.name('wen-market')
|
|
@@ -19,4 +21,6 @@ program.addCommand(bounty_1.bountyCommand);
|
|
|
19
21
|
program.addCommand(agent_1.agentCommand);
|
|
20
22
|
program.addCommand(treasury_1.treasuryCommand);
|
|
21
23
|
program.addCommand(dashboard_1.dashboardCommand);
|
|
24
|
+
program.addCommand(webhook_1.webhookCommand);
|
|
25
|
+
program.addCommand(apps_1.appsCommand);
|
|
22
26
|
program.parse();
|
package/dist/utils/client.d.ts
CHANGED
package/dist/utils/client.js
CHANGED
package/dist/utils/config.d.ts
CHANGED
|
File without changes
|
package/dist/utils/config.js
CHANGED
|
File without changes
|
package/dist/utils/format.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export declare function statusColor(status: string): string;
|
|
2
2
|
export declare function shorten(s: string, len?: number): string;
|
|
3
|
-
export declare function formatSol(lamports: string | number): string;
|
|
4
3
|
export declare function formatUsdc(amount: string | number): string;
|
|
5
4
|
export declare function formatReward(amount: string | number, symbol?: string): string;
|
|
6
5
|
export declare function formatTimestamp(ts: string): string;
|
package/dist/utils/format.js
CHANGED
|
@@ -5,7 +5,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.statusColor = statusColor;
|
|
7
7
|
exports.shorten = shorten;
|
|
8
|
-
exports.formatSol = formatSol;
|
|
9
8
|
exports.formatUsdc = formatUsdc;
|
|
10
9
|
exports.formatReward = formatReward;
|
|
11
10
|
exports.formatTimestamp = formatTimestamp;
|
|
@@ -49,20 +48,12 @@ function shorten(s, len = 12) {
|
|
|
49
48
|
return s;
|
|
50
49
|
return `${s.slice(0, 4)}...${s.slice(-4)}`;
|
|
51
50
|
}
|
|
52
|
-
function formatSol(lamports) {
|
|
53
|
-
const val = Number(lamports) / 1e9;
|
|
54
|
-
return val.toFixed(4);
|
|
55
|
-
}
|
|
56
51
|
function formatUsdc(amount) {
|
|
57
52
|
const val = Number(amount) / 1e6;
|
|
58
53
|
return val.toFixed(2);
|
|
59
54
|
}
|
|
60
|
-
function formatReward(amount, symbol) {
|
|
61
|
-
|
|
62
|
-
return `${formatUsdc(amount)} USDC`;
|
|
63
|
-
if (symbol === 'SOL')
|
|
64
|
-
return `${formatSol(amount)} SOL`;
|
|
65
|
-
return `${amount} ${symbol || ''}`.trim();
|
|
55
|
+
function formatReward(amount, symbol = 'USDC') {
|
|
56
|
+
return `${formatUsdc(amount)} ${symbol}`;
|
|
66
57
|
}
|
|
67
58
|
function formatTimestamp(ts) {
|
|
68
59
|
return new Date(ts).toISOString().slice(11, 19);
|
|
File without changes
|
package/dist/utils/websocket.js
CHANGED
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wenrwa/marketplace-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "CLI tool for the Wenrwa Agent Marketplace — monitor bounties, agents, workspaces, and treasury from your terminal",
|
|
5
5
|
"author": "Wenrwa <dev@wenrwa.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"build": "tsc",
|
|
35
35
|
"dev": "ts-node src/index.ts",
|
|
36
36
|
"prepublishOnly": "npm run build",
|
|
37
|
-
"test": "
|
|
37
|
+
"test": "jest"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"commander": "^12.0.0",
|
|
@@ -45,6 +45,9 @@
|
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"typescript": "^5.5.0",
|
|
47
47
|
"@types/node": "^20.0.0",
|
|
48
|
+
"@types/jest": "^29.5.0",
|
|
49
|
+
"jest": "^29.7.0",
|
|
50
|
+
"ts-jest": "^29.2.0",
|
|
48
51
|
"ts-node": "^10.9.0"
|
|
49
52
|
}
|
|
50
53
|
}
|