@trust-ethos/cli 0.0.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/LICENSE +21 -0
- package/README.md +1791 -0
- package/bin/dev.cmd +3 -0
- package/bin/dev.js +5 -0
- package/bin/run.cmd +3 -0
- package/bin/run.js +5 -0
- package/dist/commands/auction/active.d.ts +10 -0
- package/dist/commands/auction/active.js +39 -0
- package/dist/commands/auction/info.d.ts +16 -0
- package/dist/commands/auction/info.js +46 -0
- package/dist/commands/auction/list.d.ts +14 -0
- package/dist/commands/auction/list.js +61 -0
- package/dist/commands/broker/info.d.ts +16 -0
- package/dist/commands/broker/info.js +37 -0
- package/dist/commands/broker/list.d.ts +15 -0
- package/dist/commands/broker/list.js +62 -0
- package/dist/commands/config/get.d.ts +9 -0
- package/dist/commands/config/get.js +29 -0
- package/dist/commands/config/path.d.ts +6 -0
- package/dist/commands/config/path.js +12 -0
- package/dist/commands/config/set.d.ts +9 -0
- package/dist/commands/config/set.js +28 -0
- package/dist/commands/listing/info.d.ts +13 -0
- package/dist/commands/listing/info.js +41 -0
- package/dist/commands/listing/list.d.ts +13 -0
- package/dist/commands/listing/list.js +46 -0
- package/dist/commands/listing/voters.d.ts +19 -0
- package/dist/commands/listing/voters.js +48 -0
- package/dist/commands/market/featured.d.ts +10 -0
- package/dist/commands/market/featured.js +34 -0
- package/dist/commands/market/holders.d.ts +14 -0
- package/dist/commands/market/holders.js +46 -0
- package/dist/commands/market/info.d.ts +14 -0
- package/dist/commands/market/info.js +48 -0
- package/dist/commands/market/list.d.ts +16 -0
- package/dist/commands/market/list.js +55 -0
- package/dist/commands/nft/list.d.ts +15 -0
- package/dist/commands/nft/list.js +64 -0
- package/dist/commands/review/info.d.ts +17 -0
- package/dist/commands/review/info.js +49 -0
- package/dist/commands/review/list.d.ts +16 -0
- package/dist/commands/review/list.js +68 -0
- package/dist/commands/review/votes.d.ts +21 -0
- package/dist/commands/review/votes.js +91 -0
- package/dist/commands/score/status.d.ts +13 -0
- package/dist/commands/score/status.js +54 -0
- package/dist/commands/slash/info.d.ts +16 -0
- package/dist/commands/slash/info.js +42 -0
- package/dist/commands/slash/list.d.ts +15 -0
- package/dist/commands/slash/list.js +50 -0
- package/dist/commands/slash/votes.d.ts +21 -0
- package/dist/commands/slash/votes.js +91 -0
- package/dist/commands/user/activity.d.ts +15 -0
- package/dist/commands/user/activity.js +71 -0
- package/dist/commands/user/info.d.ts +14 -0
- package/dist/commands/user/info.js +51 -0
- package/dist/commands/user/invitations.d.ts +16 -0
- package/dist/commands/user/invitations.js +73 -0
- package/dist/commands/user/search.d.ts +15 -0
- package/dist/commands/user/search.js +59 -0
- package/dist/commands/user/summary.d.ts +14 -0
- package/dist/commands/user/summary.js +134 -0
- package/dist/commands/validator/info.d.ts +13 -0
- package/dist/commands/validator/info.js +53 -0
- package/dist/commands/validator/list.d.ts +13 -0
- package/dist/commands/validator/list.js +64 -0
- package/dist/commands/validator/sales.d.ts +12 -0
- package/dist/commands/validator/sales.js +52 -0
- package/dist/commands/vouch/info.d.ts +17 -0
- package/dist/commands/vouch/info.js +53 -0
- package/dist/commands/vouch/list.d.ts +18 -0
- package/dist/commands/vouch/list.js +89 -0
- package/dist/commands/vouch/mutual.d.ts +15 -0
- package/dist/commands/vouch/mutual.js +68 -0
- package/dist/commands/vouch/votes.d.ts +21 -0
- package/dist/commands/vouch/votes.js +91 -0
- package/dist/commands/xp/rank.d.ts +15 -0
- package/dist/commands/xp/rank.js +74 -0
- package/dist/commands/xp/seasons.d.ts +10 -0
- package/dist/commands/xp/seasons.js +42 -0
- package/dist/hooks/init.d.ts +3 -0
- package/dist/hooks/init.js +40 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/lib/api/echo-client.d.ts +624 -0
- package/dist/lib/api/echo-client.js +408 -0
- package/dist/lib/config/index.d.ts +6 -0
- package/dist/lib/config/index.js +32 -0
- package/dist/lib/errors/cli-error.d.ts +23 -0
- package/dist/lib/errors/cli-error.js +57 -0
- package/dist/lib/formatting/colors.d.ts +13 -0
- package/dist/lib/formatting/colors.js +22 -0
- package/dist/lib/formatting/error.d.ts +1 -0
- package/dist/lib/formatting/error.js +64 -0
- package/dist/lib/formatting/output.d.ts +45 -0
- package/dist/lib/formatting/output.js +753 -0
- package/dist/lib/help.d.ts +4 -0
- package/dist/lib/help.js +28 -0
- package/dist/lib/update/index.d.ts +37 -0
- package/dist/lib/update/index.js +286 -0
- package/dist/lib/validation/userkey.d.ts +11 -0
- package/dist/lib/validation/userkey.js +81 -0
- package/oclif.manifest.json +2224 -0
- package/package.json +87 -0
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { Args, Command, Flags } from '@oclif/core';
|
|
2
|
+
import { EchoClient } from '../../lib/api/echo-client.js';
|
|
3
|
+
import { formatError } from '../../lib/formatting/error.js';
|
|
4
|
+
import { formatVotes, formatVoteStats, output } from '../../lib/formatting/output.js';
|
|
5
|
+
export default class VouchVotes extends Command {
|
|
6
|
+
static args = {
|
|
7
|
+
id: Args.integer({
|
|
8
|
+
description: 'Vouch ID',
|
|
9
|
+
required: true,
|
|
10
|
+
}),
|
|
11
|
+
};
|
|
12
|
+
static description = 'Show votes on a vouch';
|
|
13
|
+
static examples = [
|
|
14
|
+
'<%= config.bin %> <%= command.id %> 182',
|
|
15
|
+
'<%= config.bin %> <%= command.id %> 182 --stats',
|
|
16
|
+
'<%= config.bin %> <%= command.id %> 182 --upvotes',
|
|
17
|
+
'<%= config.bin %> <%= command.id %> 182 --json',
|
|
18
|
+
];
|
|
19
|
+
static flags = {
|
|
20
|
+
json: Flags.boolean({
|
|
21
|
+
char: 'j',
|
|
22
|
+
description: 'Output as JSON',
|
|
23
|
+
default: false,
|
|
24
|
+
}),
|
|
25
|
+
verbose: Flags.boolean({
|
|
26
|
+
char: 'v',
|
|
27
|
+
description: 'Show detailed error information',
|
|
28
|
+
default: false,
|
|
29
|
+
}),
|
|
30
|
+
stats: Flags.boolean({
|
|
31
|
+
char: 's',
|
|
32
|
+
description: 'Show vote statistics only',
|
|
33
|
+
default: false,
|
|
34
|
+
}),
|
|
35
|
+
upvotes: Flags.boolean({
|
|
36
|
+
description: 'Show only upvotes',
|
|
37
|
+
exclusive: ['downvotes'],
|
|
38
|
+
}),
|
|
39
|
+
downvotes: Flags.boolean({
|
|
40
|
+
description: 'Show only downvotes',
|
|
41
|
+
exclusive: ['upvotes'],
|
|
42
|
+
}),
|
|
43
|
+
limit: Flags.integer({
|
|
44
|
+
char: 'l',
|
|
45
|
+
description: 'Max results per request',
|
|
46
|
+
default: 10,
|
|
47
|
+
}),
|
|
48
|
+
offset: Flags.integer({
|
|
49
|
+
char: 'o',
|
|
50
|
+
description: 'Number of results to skip',
|
|
51
|
+
default: 0,
|
|
52
|
+
}),
|
|
53
|
+
};
|
|
54
|
+
async run() {
|
|
55
|
+
const { args, flags } = await this.parse(VouchVotes);
|
|
56
|
+
const client = new EchoClient();
|
|
57
|
+
try {
|
|
58
|
+
if (flags.stats) {
|
|
59
|
+
const stats = await client.getVoteStats(args.id, 'vouch');
|
|
60
|
+
if (flags.json) {
|
|
61
|
+
this.log(output(stats));
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
this.log(formatVoteStats(stats, 'vouch', args.id));
|
|
65
|
+
}
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
const params = {
|
|
69
|
+
limit: flags.limit,
|
|
70
|
+
offset: flags.offset,
|
|
71
|
+
};
|
|
72
|
+
if (flags.upvotes)
|
|
73
|
+
params.isUpvote = true;
|
|
74
|
+
if (flags.downvotes)
|
|
75
|
+
params.isUpvote = false;
|
|
76
|
+
const response = await client.getVotes(args.id, 'vouch', params);
|
|
77
|
+
if (flags.json) {
|
|
78
|
+
this.log(output(response));
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
this.log(formatVotes(response.values, response.total, 'vouch'));
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
catch (error) {
|
|
85
|
+
if (error instanceof Error) {
|
|
86
|
+
this.log(formatError(error, flags.verbose));
|
|
87
|
+
this.exit(1);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
export default class XpRank extends Command {
|
|
3
|
+
static aliases: string[];
|
|
4
|
+
static args: {
|
|
5
|
+
identifier: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
6
|
+
};
|
|
7
|
+
static description: string;
|
|
8
|
+
static examples: string[];
|
|
9
|
+
static flags: {
|
|
10
|
+
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
11
|
+
season: import("@oclif/core/interfaces").OptionFlag<number | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
+
verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
13
|
+
};
|
|
14
|
+
run(): Promise<void>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { Args, Command, Flags } from '@oclif/core';
|
|
2
|
+
import { EchoClient } from '../../lib/api/echo-client.js';
|
|
3
|
+
import { formatError } from '../../lib/formatting/error.js';
|
|
4
|
+
import { formatRank, output } from '../../lib/formatting/output.js';
|
|
5
|
+
export default class XpRank extends Command {
|
|
6
|
+
static aliases = ['rank'];
|
|
7
|
+
static args = {
|
|
8
|
+
identifier: Args.string({
|
|
9
|
+
description: 'Twitter username, ETH address, or ENS name',
|
|
10
|
+
required: true,
|
|
11
|
+
}),
|
|
12
|
+
};
|
|
13
|
+
static description = 'Show leaderboard rank for a user';
|
|
14
|
+
static examples = [
|
|
15
|
+
'<%= config.bin %> <%= command.id %> 0xNowater',
|
|
16
|
+
'<%= config.bin %> <%= command.id %> 0xNowater --season 2',
|
|
17
|
+
'<%= config.bin %> <%= command.id %> 0xNowater --json',
|
|
18
|
+
];
|
|
19
|
+
static flags = {
|
|
20
|
+
json: Flags.boolean({
|
|
21
|
+
char: 'j',
|
|
22
|
+
description: 'Output as JSON',
|
|
23
|
+
default: false,
|
|
24
|
+
}),
|
|
25
|
+
season: Flags.integer({
|
|
26
|
+
char: 's',
|
|
27
|
+
description: 'Show XP for specific season',
|
|
28
|
+
}),
|
|
29
|
+
verbose: Flags.boolean({
|
|
30
|
+
char: 'v',
|
|
31
|
+
description: 'Show detailed error information',
|
|
32
|
+
default: false,
|
|
33
|
+
}),
|
|
34
|
+
};
|
|
35
|
+
async run() {
|
|
36
|
+
const { args, flags } = await this.parse(XpRank);
|
|
37
|
+
const client = new EchoClient();
|
|
38
|
+
try {
|
|
39
|
+
const user = await client.resolveUser(args.identifier);
|
|
40
|
+
const userkey = client.getPrimaryUserkey(user);
|
|
41
|
+
if (!userkey) {
|
|
42
|
+
throw new Error('User has no valid userkey for XP lookup');
|
|
43
|
+
}
|
|
44
|
+
const rankIndex = await client.getLeaderboardRank(userkey);
|
|
45
|
+
const rank = rankIndex + 1;
|
|
46
|
+
let seasonXp;
|
|
47
|
+
if (flags.season) {
|
|
48
|
+
seasonXp = await client.getXpBySeason(userkey, flags.season);
|
|
49
|
+
}
|
|
50
|
+
if (flags.json) {
|
|
51
|
+
const output_data = { rank, user: user.username || user.displayName, userkey };
|
|
52
|
+
if (seasonXp !== undefined) {
|
|
53
|
+
output_data.seasonXp = seasonXp;
|
|
54
|
+
output_data.season = flags.season;
|
|
55
|
+
}
|
|
56
|
+
this.log(output(output_data));
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
const formatData = { rank, userkey, username: user.username || user.displayName };
|
|
60
|
+
if (seasonXp !== undefined) {
|
|
61
|
+
formatData.seasonXp = seasonXp;
|
|
62
|
+
formatData.season = flags.season;
|
|
63
|
+
}
|
|
64
|
+
this.log(formatRank(formatData));
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
catch (error) {
|
|
68
|
+
if (error instanceof Error) {
|
|
69
|
+
this.log(formatError(error, flags.verbose));
|
|
70
|
+
this.exit(1);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
export default class XpSeasons extends Command {
|
|
3
|
+
static description: string;
|
|
4
|
+
static examples: string[];
|
|
5
|
+
static flags: {
|
|
6
|
+
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
7
|
+
verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
8
|
+
};
|
|
9
|
+
run(): Promise<void>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Command, Flags } from '@oclif/core';
|
|
2
|
+
import { EchoClient } from '../../lib/api/echo-client.js';
|
|
3
|
+
import { formatError } from '../../lib/formatting/error.js';
|
|
4
|
+
import { formatSeasons, output } from '../../lib/formatting/output.js';
|
|
5
|
+
export default class XpSeasons extends Command {
|
|
6
|
+
static description = 'List all XP seasons';
|
|
7
|
+
static examples = [
|
|
8
|
+
'<%= config.bin %> <%= command.id %>',
|
|
9
|
+
'<%= config.bin %> <%= command.id %> --json',
|
|
10
|
+
];
|
|
11
|
+
static flags = {
|
|
12
|
+
json: Flags.boolean({
|
|
13
|
+
char: 'j',
|
|
14
|
+
description: 'Output as JSON',
|
|
15
|
+
default: false,
|
|
16
|
+
}),
|
|
17
|
+
verbose: Flags.boolean({
|
|
18
|
+
char: 'v',
|
|
19
|
+
description: 'Show detailed error information',
|
|
20
|
+
default: false,
|
|
21
|
+
}),
|
|
22
|
+
};
|
|
23
|
+
async run() {
|
|
24
|
+
const { flags } = await this.parse(XpSeasons);
|
|
25
|
+
const client = new EchoClient();
|
|
26
|
+
try {
|
|
27
|
+
const response = await client.getSeasons();
|
|
28
|
+
if (flags.json) {
|
|
29
|
+
this.log(output(response));
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
this.log(formatSeasons(response.seasons, response.currentSeason));
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
catch (error) {
|
|
36
|
+
if (error instanceof Error) {
|
|
37
|
+
this.log(formatError(error, flags.verbose));
|
|
38
|
+
this.exit(1);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { execSync } from 'child_process';
|
|
2
|
+
import pc from 'picocolors';
|
|
3
|
+
import { applyPendingUpdate, checkForUpdate, detectInstallMethod, downloadUpdateInBackground, getPendingUpdate, } from '../lib/update/index.js';
|
|
4
|
+
const hook = async function () {
|
|
5
|
+
const pending = getPendingUpdate();
|
|
6
|
+
if (pending) {
|
|
7
|
+
const applied = applyPendingUpdate();
|
|
8
|
+
if (applied) {
|
|
9
|
+
this.log(pc.green(`Updated to v${pending.version}`));
|
|
10
|
+
const args = process.argv.slice(2);
|
|
11
|
+
try {
|
|
12
|
+
execSync(`"${process.execPath}" ${args.map(a => `"${a}"`).join(' ')}`, {
|
|
13
|
+
stdio: 'inherit',
|
|
14
|
+
env: { ...process.env, ETHOS_SKIP_UPDATE_CHECK: '1' },
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
catch { }
|
|
18
|
+
process.exit(0);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
if (process.env.ETHOS_SKIP_UPDATE_CHECK === '1')
|
|
22
|
+
return;
|
|
23
|
+
const installInfo = detectInstallMethod();
|
|
24
|
+
checkForUpdate()
|
|
25
|
+
.then((info) => {
|
|
26
|
+
if (!info.updateAvailable)
|
|
27
|
+
return;
|
|
28
|
+
if (installInfo.supportsAutoUpdate && info.downloadUrl) {
|
|
29
|
+
downloadUpdateInBackground(info.downloadUrl, info.latestVersion);
|
|
30
|
+
}
|
|
31
|
+
else if (installInfo.method !== 'dev') {
|
|
32
|
+
this.log('');
|
|
33
|
+
this.log(pc.yellow(`Update available: v${info.currentVersion} → v${info.latestVersion}`));
|
|
34
|
+
this.log(pc.dim(`Run: ${installInfo.updateCommand}`));
|
|
35
|
+
this.log('');
|
|
36
|
+
}
|
|
37
|
+
})
|
|
38
|
+
.catch(() => { });
|
|
39
|
+
};
|
|
40
|
+
export default hook;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { run } from '@oclif/core';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { run } from '@oclif/core';
|