@rhseung/ps-cli 1.0.0 → 1.2.1
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 +60 -7
- package/dist/chunk-3TMQ74SA.js +65 -0
- package/dist/{chunk-KFQFQJYT.js → chunk-63CK6URL.js} +67 -2
- package/dist/commands/config.js +37 -7
- package/dist/commands/fetch.js +7 -6
- package/dist/commands/init.js +1635 -0
- package/dist/commands/run.js +4 -2
- package/dist/commands/stats.js +3 -3
- package/dist/commands/submit.js +7 -6
- package/dist/commands/test.js +4 -2
- package/package.json +6 -2
- package/dist/chunk-OOTPZD7O.js +0 -42
package/dist/commands/run.js
CHANGED
|
@@ -4,8 +4,9 @@ import {
|
|
|
4
4
|
} from "../chunk-EIFFWFLS.js";
|
|
5
5
|
import {
|
|
6
6
|
detectProblemIdFromPath,
|
|
7
|
+
getProblemDirPath,
|
|
7
8
|
getProblemId
|
|
8
|
-
} from "../chunk-
|
|
9
|
+
} from "../chunk-3TMQ74SA.js";
|
|
9
10
|
import {
|
|
10
11
|
detectLanguageFromFile,
|
|
11
12
|
getSupportedLanguages,
|
|
@@ -14,6 +15,7 @@ import {
|
|
|
14
15
|
import {
|
|
15
16
|
LoadingSpinner
|
|
16
17
|
} from "../chunk-IJLJBKLK.js";
|
|
18
|
+
import "../chunk-63CK6URL.js";
|
|
17
19
|
import "../chunk-FYS2JH42.js";
|
|
18
20
|
|
|
19
21
|
// src/commands/run.tsx
|
|
@@ -111,7 +113,7 @@ async function findInputFile(problemDir) {
|
|
|
111
113
|
}
|
|
112
114
|
async function runCommand(problemId, language, inputFile) {
|
|
113
115
|
const currentPathProblemId = detectProblemIdFromPath(process.cwd());
|
|
114
|
-
const problemDir = problemId && currentPathProblemId !== problemId ?
|
|
116
|
+
const problemDir = problemId && currentPathProblemId !== problemId ? getProblemDirPath(problemId) : process.cwd();
|
|
115
117
|
const inputPath = inputFile ? join(problemDir, inputFile) : await findInputFile(problemDir);
|
|
116
118
|
const files = await readdir(problemDir);
|
|
117
119
|
const solutionFile = files.find((f) => f.startsWith("solution."));
|
package/dist/commands/stats.js
CHANGED
|
@@ -5,12 +5,12 @@ import {
|
|
|
5
5
|
getUserStats,
|
|
6
6
|
source_default
|
|
7
7
|
} from "../chunk-2E4VSP6O.js";
|
|
8
|
-
import {
|
|
9
|
-
getSolvedAcHandle
|
|
10
|
-
} from "../chunk-KFQFQJYT.js";
|
|
11
8
|
import {
|
|
12
9
|
LoadingSpinner
|
|
13
10
|
} from "../chunk-IJLJBKLK.js";
|
|
11
|
+
import {
|
|
12
|
+
getSolvedAcHandle
|
|
13
|
+
} from "../chunk-63CK6URL.js";
|
|
14
14
|
import "../chunk-FYS2JH42.js";
|
|
15
15
|
|
|
16
16
|
// src/commands/stats.tsx
|
package/dist/commands/submit.js
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
getBojSessionCookie,
|
|
4
|
-
getCodeOpen
|
|
5
|
-
} from "../chunk-KFQFQJYT.js";
|
|
6
2
|
import {
|
|
7
3
|
detectProblemIdFromPath,
|
|
4
|
+
getProblemDirPath,
|
|
8
5
|
getProblemId
|
|
9
|
-
} from "../chunk-
|
|
6
|
+
} from "../chunk-3TMQ74SA.js";
|
|
10
7
|
import {
|
|
11
8
|
detectLanguageFromFile,
|
|
12
9
|
getLanguageConfig,
|
|
@@ -16,6 +13,10 @@ import {
|
|
|
16
13
|
import {
|
|
17
14
|
LoadingSpinner
|
|
18
15
|
} from "../chunk-IJLJBKLK.js";
|
|
16
|
+
import {
|
|
17
|
+
getBojSessionCookie,
|
|
18
|
+
getCodeOpen
|
|
19
|
+
} from "../chunk-63CK6URL.js";
|
|
19
20
|
import "../chunk-FYS2JH42.js";
|
|
20
21
|
|
|
21
22
|
// src/commands/submit.tsx
|
|
@@ -410,7 +411,7 @@ async function detectSolutionFile(problemDir) {
|
|
|
410
411
|
}
|
|
411
412
|
async function submitCommand(problemId, language, dryRun = false) {
|
|
412
413
|
const currentPathProblemId = detectProblemIdFromPath(process.cwd());
|
|
413
|
-
const problemDir = currentPathProblemId === problemId ? process.cwd() :
|
|
414
|
+
const problemDir = currentPathProblemId === problemId ? process.cwd() : getProblemDirPath(problemId);
|
|
414
415
|
const sourcePath = await detectSolutionFile(problemDir);
|
|
415
416
|
const detectedLanguage = language ?? detectLanguageFromFile(sourcePath);
|
|
416
417
|
if (!detectedLanguage) {
|
package/dist/commands/test.js
CHANGED
|
@@ -4,8 +4,9 @@ import {
|
|
|
4
4
|
} from "../chunk-EIFFWFLS.js";
|
|
5
5
|
import {
|
|
6
6
|
detectProblemIdFromPath,
|
|
7
|
+
getProblemDirPath,
|
|
7
8
|
getProblemId
|
|
8
|
-
} from "../chunk-
|
|
9
|
+
} from "../chunk-3TMQ74SA.js";
|
|
9
10
|
import {
|
|
10
11
|
detectLanguageFromFile,
|
|
11
12
|
getSupportedLanguages,
|
|
@@ -14,6 +15,7 @@ import {
|
|
|
14
15
|
import {
|
|
15
16
|
LoadingSpinner
|
|
16
17
|
} from "../chunk-IJLJBKLK.js";
|
|
18
|
+
import "../chunk-63CK6URL.js";
|
|
17
19
|
import "../chunk-FYS2JH42.js";
|
|
18
20
|
|
|
19
21
|
// src/commands/test.tsx
|
|
@@ -335,7 +337,7 @@ async function detectLanguage(problemDir) {
|
|
|
335
337
|
}
|
|
336
338
|
async function testCommand(options = {}) {
|
|
337
339
|
const currentPathProblemId = detectProblemIdFromPath(process.cwd());
|
|
338
|
-
const problemDir = options.id && currentPathProblemId !== options.id ?
|
|
340
|
+
const problemDir = options.id && currentPathProblemId !== options.id ? getProblemDirPath(options.id) : process.cwd();
|
|
339
341
|
const language = options.language ?? await detectLanguage(problemDir);
|
|
340
342
|
return new Promise((resolve) => {
|
|
341
343
|
const { unmount } = render(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rhseung/ps-cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"description": "백준(BOJ) 문제 해결을 위한 통합 CLI 도구",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -13,7 +13,10 @@
|
|
|
13
13
|
"scripts": {
|
|
14
14
|
"build": "tsup && node scripts/add-shebang.js",
|
|
15
15
|
"dev": "tsup --watch",
|
|
16
|
-
"typecheck": "tsc --noEmit"
|
|
16
|
+
"typecheck": "tsc --noEmit",
|
|
17
|
+
"release:patch": "npm version patch && bun publish --access=public",
|
|
18
|
+
"release:minor": "npm version minor && bun publish --access=public",
|
|
19
|
+
"release:major": "npm version major && bun publish --access=public"
|
|
17
20
|
},
|
|
18
21
|
"keywords": [
|
|
19
22
|
"boj",
|
|
@@ -43,6 +46,7 @@
|
|
|
43
46
|
"ink": "^5.0.1",
|
|
44
47
|
"ink-select-input": "^5.0.0",
|
|
45
48
|
"ink-spinner": "^5.0.0",
|
|
49
|
+
"ink-text-input": "^6.0.0",
|
|
46
50
|
"meow": "^14.0.0",
|
|
47
51
|
"react": "^18.3.1"
|
|
48
52
|
},
|
package/dist/chunk-OOTPZD7O.js
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
// src/utils/problem-id.ts
|
|
4
|
-
function detectProblemIdFromPath(cwd = process.cwd()) {
|
|
5
|
-
const normalizedPath = cwd.replace(/\\/g, "/");
|
|
6
|
-
const problemsIndex = normalizedPath.indexOf("/problems/");
|
|
7
|
-
if (problemsIndex === -1) {
|
|
8
|
-
return null;
|
|
9
|
-
}
|
|
10
|
-
const afterProblems = normalizedPath.substring(
|
|
11
|
-
problemsIndex + "/problems/".length
|
|
12
|
-
);
|
|
13
|
-
if (!afterProblems) {
|
|
14
|
-
return null;
|
|
15
|
-
}
|
|
16
|
-
const firstSegment = afterProblems.split("/")[0];
|
|
17
|
-
if (!firstSegment) {
|
|
18
|
-
return null;
|
|
19
|
-
}
|
|
20
|
-
const problemId = parseInt(firstSegment, 10);
|
|
21
|
-
if (isNaN(problemId) || problemId <= 0) {
|
|
22
|
-
return null;
|
|
23
|
-
}
|
|
24
|
-
if (firstSegment !== problemId.toString()) {
|
|
25
|
-
return null;
|
|
26
|
-
}
|
|
27
|
-
return problemId;
|
|
28
|
-
}
|
|
29
|
-
function getProblemId(args, cwd = process.cwd()) {
|
|
30
|
-
if (args.length > 0 && args[0]) {
|
|
31
|
-
const problemId = parseInt(args[0], 10);
|
|
32
|
-
if (!isNaN(problemId) && problemId > 0) {
|
|
33
|
-
return problemId;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
return detectProblemIdFromPath(cwd);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export {
|
|
40
|
-
detectProblemIdFromPath,
|
|
41
|
-
getProblemId
|
|
42
|
-
};
|