@upshiftfinance/cli 0.0.0-stage → 0.1.2
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 +185 -2
- package/lib/bin.d.ts +2 -0
- package/lib/bin.js +19 -0
- package/lib/commands/chain.d.ts +2 -0
- package/lib/commands/chain.js +42 -0
- package/lib/commands/config.d.ts +2 -0
- package/lib/commands/config.js +107 -0
- package/lib/commands/docs.d.ts +2 -0
- package/lib/commands/docs.js +407 -0
- package/lib/commands/init.d.ts +2 -0
- package/lib/commands/init.js +124 -0
- package/lib/commands/login.d.ts +2 -0
- package/lib/commands/login.js +57 -0
- package/lib/commands/ops.d.ts +2 -0
- package/lib/commands/ops.js +149 -0
- package/lib/commands/points.d.ts +2 -0
- package/lib/commands/points.js +52 -0
- package/lib/commands/profile.d.ts +2 -0
- package/lib/commands/profile.js +82 -0
- package/lib/commands/rpc.d.ts +11 -0
- package/lib/commands/rpc.js +93 -0
- package/lib/commands/skill.d.ts +2 -0
- package/lib/commands/skill.js +83 -0
- package/lib/commands/user.d.ts +2 -0
- package/lib/commands/user.js +93 -0
- package/lib/commands/vault.d.ts +2 -0
- package/lib/commands/vault.js +326 -0
- package/lib/commands/whoami.d.ts +2 -0
- package/lib/commands/whoami.js +45 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +9 -0
- package/lib/lib/flags.d.ts +14 -0
- package/lib/lib/flags.js +46 -0
- package/lib/lib/output.d.ts +7 -0
- package/lib/lib/output.js +218 -0
- package/lib/lib/prompts.d.ts +24 -0
- package/lib/lib/prompts.js +51 -0
- package/lib/lib/resolve-vault.d.ts +10 -0
- package/lib/lib/resolve-vault.js +137 -0
- package/lib/lib/version.d.ts +2 -0
- package/lib/lib/version.js +27 -0
- package/lib/lib/watch.d.ts +4 -0
- package/lib/lib/watch.js +38 -0
- package/lib/main.d.ts +3 -0
- package/lib/main.js +55 -0
- package/lib/notify-update.d.ts +1 -0
- package/lib/notify-update.js +38 -0
- package/package.json +66 -3
- package/skills/upshift.md +212 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export declare function promptPassphrase(opts: {
|
|
2
|
+
message: string;
|
|
3
|
+
confirmMessage?: string;
|
|
4
|
+
}): Promise<string>;
|
|
5
|
+
export declare function promptText(opts: {
|
|
6
|
+
message: string;
|
|
7
|
+
default?: string;
|
|
8
|
+
required?: boolean;
|
|
9
|
+
}): Promise<string>;
|
|
10
|
+
export declare function promptConfirm(opts: {
|
|
11
|
+
message: string;
|
|
12
|
+
default?: boolean;
|
|
13
|
+
}): Promise<boolean>;
|
|
14
|
+
export declare function promptSelect<T extends string>(opts: {
|
|
15
|
+
message: string;
|
|
16
|
+
choices: {
|
|
17
|
+
name: string;
|
|
18
|
+
value: T;
|
|
19
|
+
description?: string;
|
|
20
|
+
}[];
|
|
21
|
+
default?: T;
|
|
22
|
+
}): Promise<T>;
|
|
23
|
+
export declare function tell(message: string): void;
|
|
24
|
+
export declare function banner(title: string): void;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.promptPassphrase = promptPassphrase;
|
|
7
|
+
exports.promptText = promptText;
|
|
8
|
+
exports.promptConfirm = promptConfirm;
|
|
9
|
+
exports.promptSelect = promptSelect;
|
|
10
|
+
exports.tell = tell;
|
|
11
|
+
exports.banner = banner;
|
|
12
|
+
const prompts_1 = require("@inquirer/prompts");
|
|
13
|
+
const kleur_1 = __importDefault(require("kleur"));
|
|
14
|
+
async function promptPassphrase(opts) {
|
|
15
|
+
const pw = await (0, prompts_1.password)({
|
|
16
|
+
message: opts.message,
|
|
17
|
+
mask: true,
|
|
18
|
+
validate: (v) => v.length >= 8 || 'Passphrase must be at least 8 characters.',
|
|
19
|
+
});
|
|
20
|
+
if (opts.confirmMessage) {
|
|
21
|
+
const again = await (0, prompts_1.password)({ message: opts.confirmMessage, mask: true });
|
|
22
|
+
if (again !== pw)
|
|
23
|
+
throw new Error('Passphrases did not match.');
|
|
24
|
+
}
|
|
25
|
+
return pw;
|
|
26
|
+
}
|
|
27
|
+
async function promptText(opts) {
|
|
28
|
+
const raw = await (0, prompts_1.input)({
|
|
29
|
+
message: opts.message,
|
|
30
|
+
default: opts.default,
|
|
31
|
+
validate: (v) => !opts.required || v.trim().length > 0 || 'A value is required.',
|
|
32
|
+
});
|
|
33
|
+
return raw.trim();
|
|
34
|
+
}
|
|
35
|
+
async function promptConfirm(opts) {
|
|
36
|
+
return (0, prompts_1.confirm)({ message: opts.message, default: opts.default ?? false });
|
|
37
|
+
}
|
|
38
|
+
async function promptSelect(opts) {
|
|
39
|
+
return (0, prompts_1.select)({
|
|
40
|
+
message: opts.message,
|
|
41
|
+
choices: opts.choices,
|
|
42
|
+
default: opts.default,
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
function tell(message) {
|
|
46
|
+
process.stderr.write(message + '\n');
|
|
47
|
+
}
|
|
48
|
+
function banner(title) {
|
|
49
|
+
tell(kleur_1.default.bold().cyan(`\n${title}`));
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=prompts.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { chainIdFromSubgraphSlug, listKnownVaults } from '@upshiftfinance/config';
|
|
2
|
+
export { chainIdFromSubgraphSlug, listKnownVaults };
|
|
3
|
+
export interface ResolvedVault {
|
|
4
|
+
address: string;
|
|
5
|
+
chainId: number;
|
|
6
|
+
symbol?: string;
|
|
7
|
+
source: 'address' | 'name' | 'prefixed-name';
|
|
8
|
+
}
|
|
9
|
+
export declare const CHAIN_PREFIX_TO_ID: Readonly<Record<string, number>>;
|
|
10
|
+
export declare function resolveVault(input: string, defaultChainId: number): Promise<ResolvedVault>;
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CHAIN_PREFIX_TO_ID = exports.listKnownVaults = exports.chainIdFromSubgraphSlug = void 0;
|
|
4
|
+
exports.resolveVault = resolveVault;
|
|
5
|
+
const config_1 = require("@upshiftfinance/config");
|
|
6
|
+
Object.defineProperty(exports, "chainIdFromSubgraphSlug", { enumerable: true, get: function () { return config_1.chainIdFromSubgraphSlug; } });
|
|
7
|
+
Object.defineProperty(exports, "listKnownVaults", { enumerable: true, get: function () { return config_1.listKnownVaults; } });
|
|
8
|
+
const sdk_1 = require("@upshiftfinance/sdk");
|
|
9
|
+
exports.CHAIN_PREFIX_TO_ID = {
|
|
10
|
+
eth: 1,
|
|
11
|
+
ethereum: 1,
|
|
12
|
+
mainnet: 1,
|
|
13
|
+
base: 8453,
|
|
14
|
+
arb: 42161,
|
|
15
|
+
arbitrum: 42161,
|
|
16
|
+
op: 10,
|
|
17
|
+
optimism: 10,
|
|
18
|
+
avax: 43114,
|
|
19
|
+
avalanche: 43114,
|
|
20
|
+
bsc: 56,
|
|
21
|
+
bnb: 56,
|
|
22
|
+
polygon: 137,
|
|
23
|
+
matic: 137,
|
|
24
|
+
hyperevm: 999,
|
|
25
|
+
hyper: 999,
|
|
26
|
+
monad: 143,
|
|
27
|
+
mezo: 31612,
|
|
28
|
+
plasma: 9745,
|
|
29
|
+
ink: 57073,
|
|
30
|
+
flare: 14,
|
|
31
|
+
tempo: 4217,
|
|
32
|
+
};
|
|
33
|
+
const EVM_ADDRESS = /^0x[0-9a-fA-F]{40}$/;
|
|
34
|
+
const SOLANA_ADDRESS = /^[1-9A-HJ-NP-Za-km-z]{32,44}$/;
|
|
35
|
+
const SUI_ADDRESS = /^0x[0-9a-fA-F]{64}$/;
|
|
36
|
+
async function resolveVault(input, defaultChainId) {
|
|
37
|
+
const raw = input.trim();
|
|
38
|
+
if (EVM_ADDRESS.test(raw)) {
|
|
39
|
+
return {
|
|
40
|
+
address: raw.toLowerCase(),
|
|
41
|
+
chainId: defaultChainId,
|
|
42
|
+
source: 'address',
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
if (SUI_ADDRESS.test(raw)) {
|
|
46
|
+
return {
|
|
47
|
+
address: raw.toLowerCase(),
|
|
48
|
+
chainId: defaultChainId,
|
|
49
|
+
source: 'address',
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
if (SOLANA_ADDRESS.test(raw)) {
|
|
53
|
+
return { address: raw, chainId: defaultChainId, source: 'address' };
|
|
54
|
+
}
|
|
55
|
+
const prefixMatch = raw.match(/^([a-z]+)-(.+)$/i);
|
|
56
|
+
let pinnedChainId;
|
|
57
|
+
let symbolKey = raw.toLowerCase();
|
|
58
|
+
let prefixed = false;
|
|
59
|
+
if (prefixMatch) {
|
|
60
|
+
const prefix = prefixMatch[1].toLowerCase();
|
|
61
|
+
const rest = prefixMatch[2];
|
|
62
|
+
const maybeChain = exports.CHAIN_PREFIX_TO_ID[prefix];
|
|
63
|
+
if (maybeChain !== undefined) {
|
|
64
|
+
pinnedChainId = maybeChain;
|
|
65
|
+
symbolKey = rest.toLowerCase();
|
|
66
|
+
prefixed = true;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
const metadata = await (0, sdk_1.fetchVaultMetadata)();
|
|
70
|
+
const direct = metadata[symbolKey];
|
|
71
|
+
const matches = [];
|
|
72
|
+
if (direct) {
|
|
73
|
+
matches.push({
|
|
74
|
+
key: symbolKey,
|
|
75
|
+
item: direct,
|
|
76
|
+
chainId: (0, config_1.chainIdFromSubgraphSlug)(direct.subgraph),
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
for (const [key, item] of Object.entries(metadata)) {
|
|
81
|
+
if (key === symbolKey ||
|
|
82
|
+
item.symbol?.toLowerCase() === symbolKey) {
|
|
83
|
+
matches.push({
|
|
84
|
+
key,
|
|
85
|
+
item,
|
|
86
|
+
chainId: (0, config_1.chainIdFromSubgraphSlug)(item.subgraph),
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
if (matches.length === 0) {
|
|
92
|
+
throw new config_1.UpshiftConfigError('VAULT_NAME_NOT_FOUND', `No vault matches "${input}".`, 'Run `upshift vault list` to see known names, or pass the raw 0x address.');
|
|
93
|
+
}
|
|
94
|
+
let chosen;
|
|
95
|
+
if (pinnedChainId !== undefined) {
|
|
96
|
+
const onChain = matches.filter((m) => m.chainId === pinnedChainId);
|
|
97
|
+
if (onChain.length === 0) {
|
|
98
|
+
const available = Array.from(new Set(matches.map((m) => m.chainId).filter((c) => c !== undefined))).join(', ');
|
|
99
|
+
throw new config_1.UpshiftConfigError('VAULT_NAME_NOT_FOUND', `Vault "${symbolKey}" exists, but not on chain ${pinnedChainId}.`, available
|
|
100
|
+
? `Available on chain(s): ${available}. Drop the prefix or pick a matching one.`
|
|
101
|
+
: 'Run `upshift vault list` to see known names.');
|
|
102
|
+
}
|
|
103
|
+
chosen = onChain[0];
|
|
104
|
+
}
|
|
105
|
+
else if (matches.length === 1) {
|
|
106
|
+
chosen = matches[0];
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
const sameChain = matches.filter((m) => m.chainId === defaultChainId);
|
|
110
|
+
if (sameChain.length === 1) {
|
|
111
|
+
chosen = sameChain[0];
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
const chains = Array.from(new Set(matches.map((m) => m.chainId).filter((c) => c !== undefined))).join(', ');
|
|
115
|
+
throw new config_1.UpshiftConfigError('VAULT_NAME_AMBIGUOUS', `Vault name "${symbolKey}" matches multiple chains (${chains || 'unknown'}).`, 'Prefix the name with a chain (e.g. `eth-coreusdc`) or pass `--chain <id>`.');
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
const chainId = pinnedChainId ?? chosen.chainId;
|
|
119
|
+
if (chainId === undefined) {
|
|
120
|
+
if (defaultChainId !== undefined && defaultChainId !== null) {
|
|
121
|
+
return {
|
|
122
|
+
address: chosen.item.address.toLowerCase(),
|
|
123
|
+
chainId: defaultChainId,
|
|
124
|
+
symbol: chosen.item.symbol,
|
|
125
|
+
source: prefixed ? 'prefixed-name' : 'name',
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
throw new config_1.UpshiftConfigError('VAULT_CHAIN_UNKNOWN', `Cannot infer chain for vault "${chosen.item.symbol ?? symbolKey}".`, 'Pass `--chain <id>` or prefix the name (e.g. `eth-<symbol>`).');
|
|
129
|
+
}
|
|
130
|
+
return {
|
|
131
|
+
address: chosen.item.address.toLowerCase(),
|
|
132
|
+
chainId,
|
|
133
|
+
symbol: chosen.item.symbol,
|
|
134
|
+
source: prefixed ? 'prefixed-name' : 'name',
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
//# sourceMappingURL=resolve-vault.js.map
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getCliVersion = getCliVersion;
|
|
4
|
+
exports.getSdkVersion = getSdkVersion;
|
|
5
|
+
const node_fs_1 = require("node:fs");
|
|
6
|
+
const node_path_1 = require("node:path");
|
|
7
|
+
function getCliVersion() {
|
|
8
|
+
try {
|
|
9
|
+
const pkgPath = (0, node_path_1.join)(__dirname, '..', '..', 'package.json');
|
|
10
|
+
const parsed = JSON.parse((0, node_fs_1.readFileSync)(pkgPath, 'utf8'));
|
|
11
|
+
return typeof parsed.version === 'string' ? parsed.version : '0.0.0';
|
|
12
|
+
}
|
|
13
|
+
catch {
|
|
14
|
+
return '0.0.0';
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
function getSdkVersion() {
|
|
18
|
+
try {
|
|
19
|
+
const pkg = require.resolve('@upshiftfinance/sdk/package.json');
|
|
20
|
+
const parsed = JSON.parse((0, node_fs_1.readFileSync)(pkg, 'utf8'));
|
|
21
|
+
return typeof parsed.version === 'string' ? parsed.version : 'unknown';
|
|
22
|
+
}
|
|
23
|
+
catch {
|
|
24
|
+
return 'unknown';
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=version.js.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { GlobalFlags } from './flags';
|
|
3
|
+
export declare function parseWatchSeconds(raw: unknown): number | undefined;
|
|
4
|
+
export declare function runWatched<TSchema extends z.ZodTypeAny>(command: string, schema: TSchema, flags: GlobalFlags, rawWatch: unknown, handler: () => Promise<z.infer<TSchema>>): Promise<void>;
|
package/lib/lib/watch.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseWatchSeconds = parseWatchSeconds;
|
|
4
|
+
exports.runWatched = runWatched;
|
|
5
|
+
const config_1 = require("@upshiftfinance/config");
|
|
6
|
+
const output_1 = require("./output");
|
|
7
|
+
function parseWatchSeconds(raw) {
|
|
8
|
+
if (raw === undefined)
|
|
9
|
+
return undefined;
|
|
10
|
+
const n = Number(raw);
|
|
11
|
+
if (!Number.isFinite(n) || n < 1) {
|
|
12
|
+
throw new config_1.UpshiftConfigError('INVALID_INPUT', `--watch expects a number of seconds >= 1, got "${String(raw)}".`);
|
|
13
|
+
}
|
|
14
|
+
return n;
|
|
15
|
+
}
|
|
16
|
+
async function runWatched(command, schema, flags, rawWatch, handler) {
|
|
17
|
+
let seconds;
|
|
18
|
+
try {
|
|
19
|
+
seconds = parseWatchSeconds(rawWatch);
|
|
20
|
+
}
|
|
21
|
+
catch (err) {
|
|
22
|
+
(0, output_1.printError)(command, err, flags);
|
|
23
|
+
process.exitCode = 1;
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
if (!seconds) {
|
|
27
|
+
await (0, output_1.runCommand)(command, schema, flags, handler);
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
for (;;) {
|
|
31
|
+
if (!flags.json && !flags.csv && process.stdout.isTTY) {
|
|
32
|
+
process.stdout.write('\x1b[2J\x1b[H');
|
|
33
|
+
}
|
|
34
|
+
await (0, output_1.runCommand)(command, schema, flags, handler);
|
|
35
|
+
await new Promise((resolve) => setTimeout(resolve, seconds * 1000));
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=watch.js.map
|
package/lib/main.d.ts
ADDED
package/lib/main.js
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildProgram = buildProgram;
|
|
4
|
+
exports.main = main;
|
|
5
|
+
const commander_1 = require("commander");
|
|
6
|
+
const flags_1 = require("./lib/flags");
|
|
7
|
+
const version_1 = require("./lib/version");
|
|
8
|
+
const chain_1 = require("./commands/chain");
|
|
9
|
+
const config_1 = require("./commands/config");
|
|
10
|
+
const init_1 = require("./commands/init");
|
|
11
|
+
const login_1 = require("./commands/login");
|
|
12
|
+
const ops_1 = require("./commands/ops");
|
|
13
|
+
const points_1 = require("./commands/points");
|
|
14
|
+
const profile_1 = require("./commands/profile");
|
|
15
|
+
const rpc_1 = require("./commands/rpc");
|
|
16
|
+
const docs_1 = require("./commands/docs");
|
|
17
|
+
const skill_1 = require("./commands/skill");
|
|
18
|
+
const user_1 = require("./commands/user");
|
|
19
|
+
const vault_1 = require("./commands/vault");
|
|
20
|
+
const whoami_1 = require("./commands/whoami");
|
|
21
|
+
function buildProgram() {
|
|
22
|
+
const program = new commander_1.Command()
|
|
23
|
+
.name('upshift')
|
|
24
|
+
.description('Read-only command-line client for Upshift vaults and pools.')
|
|
25
|
+
.version((0, version_1.getCliVersion)(), '-v, --version', 'print the CLI version');
|
|
26
|
+
(0, flags_1.registerGlobalOptions)(program);
|
|
27
|
+
(0, init_1.registerInit)(program);
|
|
28
|
+
(0, login_1.registerLogin)(program);
|
|
29
|
+
(0, whoami_1.registerWhoami)(program);
|
|
30
|
+
(0, config_1.registerConfig)(program);
|
|
31
|
+
(0, profile_1.registerProfile)(program);
|
|
32
|
+
(0, chain_1.registerChain)(program);
|
|
33
|
+
(0, rpc_1.registerRpc)(program);
|
|
34
|
+
(0, vault_1.registerVault)(program);
|
|
35
|
+
(0, user_1.registerUser)(program);
|
|
36
|
+
(0, points_1.registerPoints)(program);
|
|
37
|
+
(0, docs_1.registerDocs)(program);
|
|
38
|
+
(0, ops_1.registerOps)(program);
|
|
39
|
+
(0, skill_1.registerSkill)(program);
|
|
40
|
+
program.addHelpText('after', [
|
|
41
|
+
'',
|
|
42
|
+
'Get started:',
|
|
43
|
+
' $ upshift init # one-time setup',
|
|
44
|
+
' $ upshift whoami # confirm your config',
|
|
45
|
+
' $ upshift vault apy <addr> --chain 8453',
|
|
46
|
+
'',
|
|
47
|
+
'Docs: https://docs.upshift.finance',
|
|
48
|
+
].join('\n'));
|
|
49
|
+
return program;
|
|
50
|
+
}
|
|
51
|
+
async function main(argv = process.argv) {
|
|
52
|
+
const program = buildProgram();
|
|
53
|
+
await program.parseAsync(argv);
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=main.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function notifyOfUpdate(): void;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.notifyOfUpdate = notifyOfUpdate;
|
|
7
|
+
const node_fs_1 = require("node:fs");
|
|
8
|
+
const node_path_1 = require("node:path");
|
|
9
|
+
const update_notifier_1 = __importDefault(require("update-notifier"));
|
|
10
|
+
function readOwnPkg() {
|
|
11
|
+
try {
|
|
12
|
+
const pkgPath = (0, node_path_1.join)(__dirname, '..', 'package.json');
|
|
13
|
+
const raw = (0, node_fs_1.readFileSync)(pkgPath, 'utf8');
|
|
14
|
+
const parsed = JSON.parse(raw);
|
|
15
|
+
if (typeof parsed.name !== 'string' || typeof parsed.version !== 'string') {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
return { name: parsed.name, version: parsed.version };
|
|
19
|
+
}
|
|
20
|
+
catch {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
function notifyOfUpdate() {
|
|
25
|
+
try {
|
|
26
|
+
const pkg = readOwnPkg();
|
|
27
|
+
if (!pkg)
|
|
28
|
+
return;
|
|
29
|
+
const notifier = (0, update_notifier_1.default)({
|
|
30
|
+
pkg,
|
|
31
|
+
updateCheckInterval: 1000 * 60 * 60 * 24,
|
|
32
|
+
});
|
|
33
|
+
notifier.notify();
|
|
34
|
+
}
|
|
35
|
+
catch {
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=notify-update.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,69 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@upshiftfinance/cli",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.1.2",
|
|
4
|
+
"main": "lib/index.js",
|
|
5
|
+
"types": "lib/index.d.ts",
|
|
6
|
+
"bin": {
|
|
7
|
+
"upshift": "lib/bin.js"
|
|
8
|
+
},
|
|
9
|
+
"engines": {
|
|
10
|
+
"node": ">=22.23.4 <23.0.0 || >=24.22.1 <25.0.0 || >=26.12.1"
|
|
11
|
+
},
|
|
12
|
+
"keywords": [
|
|
13
|
+
"upshift",
|
|
14
|
+
"upshiftfinance",
|
|
15
|
+
"sdk",
|
|
16
|
+
"js",
|
|
17
|
+
"cli",
|
|
18
|
+
"institutional",
|
|
19
|
+
"defi"
|
|
20
|
+
],
|
|
21
|
+
"author": "Upshift",
|
|
22
|
+
"license": "MIT",
|
|
23
|
+
"description": "CLI powering the Upshift ecosystem.",
|
|
24
|
+
"lint-staged": {
|
|
25
|
+
"*": [
|
|
26
|
+
"biome check --write --no-errors-on-unmatched --files-ignore-unknown=true"
|
|
27
|
+
]
|
|
28
|
+
},
|
|
29
|
+
"files": [
|
|
30
|
+
"lib/**/*.js",
|
|
31
|
+
"lib/**/*.d.ts",
|
|
32
|
+
"lib/**/*.json",
|
|
33
|
+
"skills/*.md"
|
|
34
|
+
],
|
|
35
|
+
"publishConfig": {
|
|
36
|
+
"access": "public"
|
|
37
|
+
},
|
|
38
|
+
"dependencies": {
|
|
39
|
+
"@inquirer/prompts": "^8.5.2",
|
|
40
|
+
"cli-table3": "^0.6.5",
|
|
41
|
+
"commander": "^12.1.0",
|
|
42
|
+
"kleur": "^4.1.5",
|
|
43
|
+
"update-notifier": "^5.1.0",
|
|
44
|
+
"zod": "^3.23.0",
|
|
45
|
+
"@upshiftfinance/config": "0.1.2",
|
|
46
|
+
"@upshiftfinance/sdk": "0.2.0"
|
|
47
|
+
},
|
|
48
|
+
"devDependencies": {
|
|
49
|
+
"@types/jest": "^30.0.0",
|
|
50
|
+
"@types/node": "^22.10.0",
|
|
51
|
+
"@types/update-notifier": "^6.0.8",
|
|
52
|
+
"jest": "^30.5.2",
|
|
53
|
+
"ts-jest": "^29.1.0"
|
|
54
|
+
},
|
|
55
|
+
"repository": {
|
|
56
|
+
"type": "git",
|
|
57
|
+
"url": "git+https://github.com/upshift-protocol/upshift-sdk.git",
|
|
58
|
+
"directory": "packages/cli"
|
|
59
|
+
},
|
|
60
|
+
"scripts": {
|
|
61
|
+
"build": "tsc",
|
|
62
|
+
"test": "jest",
|
|
63
|
+
"test:watch": "jest --watch",
|
|
64
|
+
"test:coverage": "jest --coverage",
|
|
65
|
+
"clean": "rm -rf ./lib",
|
|
66
|
+
"format": "biome check --write .",
|
|
67
|
+
"lint-cli": "lint-staged"
|
|
68
|
+
}
|
|
6
69
|
}
|