@rhseung/ps-cli 1.4.0 → 1.6.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/dist/chunk-AG6KWWHS.js +342 -0
- package/dist/{chunk-NB4OIWND.js → chunk-ASMT3CRD.js} +1 -142
- package/dist/chunk-GCOFFYJ3.js +47 -0
- package/dist/chunk-NH36IFWR.js +255 -0
- package/dist/{chunk-7SVCS23X.js → chunk-RVD22OUQ.js} +53 -25
- package/dist/commands/config.js +1 -1
- package/dist/commands/fetch.js +14 -256
- package/dist/commands/init.js +77 -22
- package/dist/commands/open.js +4 -44
- package/dist/commands/run.js +1 -1
- package/dist/commands/search.js +510 -0
- package/dist/commands/solve.js +163 -0
- package/dist/commands/stats.js +30 -16
- package/dist/commands/submit.js +1 -1
- package/dist/commands/test.js +1 -1
- package/package.json +2 -2
package/dist/commands/stats.js
CHANGED
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
|
+
source_default
|
|
4
|
+
} from "../chunk-ASMT3CRD.js";
|
|
5
|
+
import {
|
|
6
|
+
calculateTierProgress,
|
|
7
|
+
getNextTierMinRating,
|
|
3
8
|
getTierColor,
|
|
4
9
|
getTierName,
|
|
5
|
-
getUserStats
|
|
6
|
-
|
|
7
|
-
} from "../chunk-NB4OIWND.js";
|
|
10
|
+
getUserStats
|
|
11
|
+
} from "../chunk-NH36IFWR.js";
|
|
8
12
|
import {
|
|
9
13
|
Command,
|
|
10
14
|
CommandBuilder,
|
|
11
15
|
CommandDef,
|
|
12
16
|
getSolvedAcHandle
|
|
13
|
-
} from "../chunk-
|
|
17
|
+
} from "../chunk-RVD22OUQ.js";
|
|
14
18
|
import {
|
|
15
19
|
__decorateClass
|
|
16
20
|
} from "../chunk-7MQMPJ3X.js";
|
|
@@ -18,8 +22,7 @@ import {
|
|
|
18
22
|
// src/commands/stats.tsx
|
|
19
23
|
import { Alert } from "@inkjs/ui";
|
|
20
24
|
import { Spinner } from "@inkjs/ui";
|
|
21
|
-
import
|
|
22
|
-
import { Box, Text } from "ink";
|
|
25
|
+
import { Box, Text, Transform } from "ink";
|
|
23
26
|
|
|
24
27
|
// src/hooks/use-user-stats.ts
|
|
25
28
|
import { useEffect, useState } from "react";
|
|
@@ -56,6 +59,16 @@ function useUserStats({
|
|
|
56
59
|
|
|
57
60
|
// src/commands/stats.tsx
|
|
58
61
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
62
|
+
function ProgressBarWithColor({ value, colorFn }) {
|
|
63
|
+
const width = process.stdout.columns || 40;
|
|
64
|
+
const barWidth = Math.max(10, Math.min(30, width - 20));
|
|
65
|
+
const filled = Math.round(value / 100 * barWidth);
|
|
66
|
+
const empty = barWidth - filled;
|
|
67
|
+
const filledBar = "\u2588".repeat(filled);
|
|
68
|
+
const emptyBar = "\u2591".repeat(empty);
|
|
69
|
+
const barText = filledBar + emptyBar;
|
|
70
|
+
return /* @__PURE__ */ jsx(Transform, { transform: (output) => colorFn(output), children: /* @__PURE__ */ jsx(Text, { children: barText }) });
|
|
71
|
+
}
|
|
59
72
|
function StatsView({ handle, onComplete }) {
|
|
60
73
|
const { status, user, error } = useUserStats({
|
|
61
74
|
handle,
|
|
@@ -72,16 +85,22 @@ function StatsView({ handle, onComplete }) {
|
|
|
72
85
|
}
|
|
73
86
|
if (user) {
|
|
74
87
|
const tierName = getTierName(user.tier);
|
|
75
|
-
const
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
])(tierName) : source_default.hex(getTierColor(user.tier))(tierName);
|
|
88
|
+
const tierColor = getTierColor(user.tier);
|
|
89
|
+
const tierColorFn = typeof tierColor === "string" ? source_default.hex(tierColor) : tierColor.multiline;
|
|
90
|
+
const nextTierMin = getNextTierMinRating(user.tier);
|
|
91
|
+
const progress = user.tier === 31 ? 100 : calculateTierProgress(user.rating, user.tier);
|
|
80
92
|
return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", children: [
|
|
81
93
|
/* @__PURE__ */ jsx(Box, { marginBottom: 1, children: /* @__PURE__ */ jsxs(Text, { color: "cyan", bold: true, children: [
|
|
82
94
|
"\u2728 ",
|
|
83
95
|
user.handle
|
|
84
96
|
] }) }),
|
|
97
|
+
/* @__PURE__ */ jsx(Box, { marginBottom: 1, flexDirection: "row", gap: 1, children: /* @__PURE__ */ jsxs(Text, { children: [
|
|
98
|
+
tierColorFn(tierName),
|
|
99
|
+
" ",
|
|
100
|
+
/* @__PURE__ */ jsx(Text, { bold: true, children: tierColorFn(user.rating.toLocaleString()) }),
|
|
101
|
+
nextTierMin !== null && /* @__PURE__ */ jsx(Text, { bold: true, children: " / " + nextTierMin.toLocaleString() })
|
|
102
|
+
] }) }),
|
|
103
|
+
/* @__PURE__ */ jsx(Box, { flexDirection: "column", marginBottom: 1, children: /* @__PURE__ */ jsx(ProgressBarWithColor, { value: progress, colorFn: tierColorFn }) }),
|
|
85
104
|
/* @__PURE__ */ jsx(
|
|
86
105
|
Box,
|
|
87
106
|
{
|
|
@@ -90,11 +109,6 @@ function StatsView({ handle, onComplete }) {
|
|
|
90
109
|
borderColor: "gray",
|
|
91
110
|
alignSelf: "flex-start",
|
|
92
111
|
children: /* @__PURE__ */ jsxs(Box, { paddingX: 1, paddingY: 0, flexDirection: "column", children: [
|
|
93
|
-
/* @__PURE__ */ jsxs(Text, { children: [
|
|
94
|
-
tierDisplay,
|
|
95
|
-
" ",
|
|
96
|
-
/* @__PURE__ */ jsx(Text, { bold: true, children: user.rating.toLocaleString() })
|
|
97
|
-
] }),
|
|
98
112
|
/* @__PURE__ */ jsxs(Text, { children: [
|
|
99
113
|
"\uD574\uACB0\uD55C \uBB38\uC81C:",
|
|
100
114
|
" ",
|
package/dist/commands/submit.js
CHANGED
package/dist/commands/test.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rhseung/ps-cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"description": "백준(BOJ) 문제 해결을 위한 통합 CLI 도구",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"dev": "tsup --watch",
|
|
16
16
|
"typecheck": "tsc --noEmit",
|
|
17
17
|
"lint": "eslint",
|
|
18
|
-
"format": "prettier",
|
|
18
|
+
"format": "prettier --check .",
|
|
19
19
|
"check": "prettier --write . && eslint --fix",
|
|
20
20
|
"patch": "npm version patch && bun publish --access=public",
|
|
21
21
|
"minor": "npm version minor && bun publish --access=public",
|