@rhseung/ps-cli 1.8.0 → 1.9.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 +39 -9
- package/dist/chunk-2YSOO6AM.js +370 -0
- package/dist/chunk-3H74PQRX.js +251 -0
- package/dist/chunk-457JZK3K.js +210 -0
- package/dist/chunk-INRLWS2O.js +414 -0
- package/dist/{chunk-4ISG24GW.js → chunk-LR64BN3N.js} +173 -15
- package/dist/chunk-OBO5XU4N.js +288 -0
- package/dist/{chunk-JPDN34C7.js → chunk-Q5NECGFA.js} +972 -116
- package/dist/{chunk-VIHXBCOZ.js → chunk-YZUGYJA4.js} +1 -1
- package/dist/commands/archive.js +6 -206
- package/dist/commands/config.js +74 -242
- package/dist/commands/fetch.js +7 -396
- package/dist/commands/init.js +50 -10
- package/dist/commands/open.js +6 -137
- package/dist/commands/run.js +45 -33
- package/dist/commands/search.js +269 -130
- package/dist/commands/stats.js +249 -82
- package/dist/commands/submit.js +7 -247
- package/dist/commands/test.js +7 -371
- package/dist/index.js +13 -50
- package/package.json +2 -1
- package/dist/chunk-3LR2NGRC.js +0 -55
- package/dist/chunk-7MQMPJ3X.js +0 -88
- package/dist/chunk-ASMT3CRD.js +0 -500
- package/dist/chunk-PY6GW22W.js +0 -13
- package/dist/chunk-QB2R47PW.js +0 -61
|
@@ -1,11 +1,37 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
9
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
28
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
29
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
30
|
+
if (decorator = decorators[i])
|
|
31
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
32
|
+
if (kind && result) __defProp(target, key, result);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
9
35
|
|
|
10
36
|
// node_modules/ajv/dist/compile/codegen/code.js
|
|
11
37
|
var require_code = __commonJS({
|
|
@@ -2847,20 +2873,20 @@ var require_compile = __commonJS({
|
|
|
2847
2873
|
var util_1 = require_util();
|
|
2848
2874
|
var validate_1 = require_validate();
|
|
2849
2875
|
var SchemaEnv = class {
|
|
2850
|
-
constructor(
|
|
2876
|
+
constructor(env3) {
|
|
2851
2877
|
var _a;
|
|
2852
2878
|
this.refs = {};
|
|
2853
2879
|
this.dynamicAnchors = {};
|
|
2854
2880
|
let schema;
|
|
2855
|
-
if (typeof
|
|
2856
|
-
schema =
|
|
2857
|
-
this.schema =
|
|
2858
|
-
this.schemaId =
|
|
2859
|
-
this.root =
|
|
2860
|
-
this.baseId = (_a =
|
|
2861
|
-
this.schemaPath =
|
|
2862
|
-
this.localRefs =
|
|
2863
|
-
this.meta =
|
|
2881
|
+
if (typeof env3.schema == "object")
|
|
2882
|
+
schema = env3.schema;
|
|
2883
|
+
this.schema = env3.schema;
|
|
2884
|
+
this.schemaId = env3.schemaId;
|
|
2885
|
+
this.root = env3.root || this;
|
|
2886
|
+
this.baseId = (_a = env3.baseId) !== null && _a !== void 0 ? _a : (0, resolve_1.normalizeId)(schema === null || schema === void 0 ? void 0 : schema[env3.schemaId || "$id"]);
|
|
2887
|
+
this.schemaPath = env3.schemaPath;
|
|
2888
|
+
this.localRefs = env3.localRefs;
|
|
2889
|
+
this.meta = env3.meta;
|
|
2864
2890
|
this.$async = schema === null || schema === void 0 ? void 0 : schema.$async;
|
|
2865
2891
|
this.refs = {};
|
|
2866
2892
|
}
|
|
@@ -3044,15 +3070,15 @@ var require_compile = __commonJS({
|
|
|
3044
3070
|
baseId = (0, resolve_1.resolveUrl)(this.opts.uriResolver, baseId, schId);
|
|
3045
3071
|
}
|
|
3046
3072
|
}
|
|
3047
|
-
let
|
|
3073
|
+
let env3;
|
|
3048
3074
|
if (typeof schema != "boolean" && schema.$ref && !(0, util_1.schemaHasRulesButRef)(schema, this.RULES)) {
|
|
3049
3075
|
const $ref = (0, resolve_1.resolveUrl)(this.opts.uriResolver, baseId, schema.$ref);
|
|
3050
|
-
|
|
3076
|
+
env3 = resolveSchema.call(this, root, $ref);
|
|
3051
3077
|
}
|
|
3052
3078
|
const { schemaId } = this.opts;
|
|
3053
|
-
|
|
3054
|
-
if (
|
|
3055
|
-
return
|
|
3079
|
+
env3 = env3 || new SchemaEnv({ schema, schemaId, root, baseId });
|
|
3080
|
+
if (env3.schema !== env3.root.schema)
|
|
3081
|
+
return env3;
|
|
3056
3082
|
return void 0;
|
|
3057
3083
|
}
|
|
3058
3084
|
}
|
|
@@ -4342,13 +4368,13 @@ var require_core = __commonJS({
|
|
|
4342
4368
|
}, warn() {
|
|
4343
4369
|
}, error() {
|
|
4344
4370
|
} };
|
|
4345
|
-
function getLogger(
|
|
4346
|
-
if (
|
|
4371
|
+
function getLogger(logger2) {
|
|
4372
|
+
if (logger2 === false)
|
|
4347
4373
|
return noLogs;
|
|
4348
|
-
if (
|
|
4374
|
+
if (logger2 === void 0)
|
|
4349
4375
|
return console;
|
|
4350
|
-
if (
|
|
4351
|
-
return
|
|
4376
|
+
if (logger2.log && logger2.warn && logger2.error)
|
|
4377
|
+
return logger2;
|
|
4352
4378
|
throw new Error("logger must implement log, warn and error methods");
|
|
4353
4379
|
}
|
|
4354
4380
|
var KEYWORD_NAME = /^[a-z_$][a-z0-9_$:-]*$/i;
|
|
@@ -4453,8 +4479,8 @@ var require_ref = __commonJS({
|
|
|
4453
4479
|
schemaType: "string",
|
|
4454
4480
|
code(cxt) {
|
|
4455
4481
|
const { gen, schema: $ref, it } = cxt;
|
|
4456
|
-
const { baseId, schemaEnv:
|
|
4457
|
-
const { root } =
|
|
4482
|
+
const { baseId, schemaEnv: env3, validateName, opts, self } = it;
|
|
4483
|
+
const { root } = env3;
|
|
4458
4484
|
if (($ref === "#" || $ref === "#/") && baseId === root.baseId)
|
|
4459
4485
|
return callRootRef();
|
|
4460
4486
|
const schOrEnv = compile_1.resolveRef.call(self, root, baseId, $ref);
|
|
@@ -4464,8 +4490,8 @@ var require_ref = __commonJS({
|
|
|
4464
4490
|
return callValidate(schOrEnv);
|
|
4465
4491
|
return inlineRefSchema(schOrEnv);
|
|
4466
4492
|
function callRootRef() {
|
|
4467
|
-
if (
|
|
4468
|
-
return callRef(cxt, validateName,
|
|
4493
|
+
if (env3 === root)
|
|
4494
|
+
return callRef(cxt, validateName, env3, env3.$async);
|
|
4469
4495
|
const rootName = gen.scopeValue("root", { ref: root });
|
|
4470
4496
|
return callRef(cxt, (0, codegen_1._)`${rootName}.validate`, root, root.$async);
|
|
4471
4497
|
}
|
|
@@ -4495,14 +4521,14 @@ var require_ref = __commonJS({
|
|
|
4495
4521
|
exports.getValidate = getValidate;
|
|
4496
4522
|
function callRef(cxt, v, sch, $async) {
|
|
4497
4523
|
const { gen, it } = cxt;
|
|
4498
|
-
const { allErrors, schemaEnv:
|
|
4524
|
+
const { allErrors, schemaEnv: env3, opts } = it;
|
|
4499
4525
|
const passCxt = opts.passContext ? names_1.default.this : codegen_1.nil;
|
|
4500
4526
|
if ($async)
|
|
4501
4527
|
callAsyncRef();
|
|
4502
4528
|
else
|
|
4503
4529
|
callSyncRef();
|
|
4504
4530
|
function callAsyncRef() {
|
|
4505
|
-
if (!
|
|
4531
|
+
if (!env3.$async)
|
|
4506
4532
|
throw new Error("async schema referenced by sync schema");
|
|
4507
4533
|
const valid = gen.let("valid");
|
|
4508
4534
|
gen.try(() => {
|
|
@@ -8661,42 +8687,14 @@ var require_semver2 = __commonJS({
|
|
|
8661
8687
|
}
|
|
8662
8688
|
});
|
|
8663
8689
|
|
|
8664
|
-
// src/core/
|
|
8665
|
-
import { render } from "ink";
|
|
8666
|
-
import { jsx } from "react/jsx-runtime";
|
|
8667
|
-
var Command = class {
|
|
8668
|
-
/**
|
|
8669
|
-
* 뷰 렌더링 헬퍼 메서드
|
|
8670
|
-
* React 컴포넌트를 렌더링하고 완료 시 정리합니다.
|
|
8671
|
-
* @param Component - 렌더링할 React 컴포넌트 (함수 컴포넌트 또는 클래스 필드로 정의된 화살표 함수)
|
|
8672
|
-
* @param props - 컴포넌트에 전달할 props (onComplete는 자동으로 추가됨)
|
|
8673
|
-
*/
|
|
8674
|
-
async renderView(Component, props) {
|
|
8675
|
-
return new Promise((resolve) => {
|
|
8676
|
-
const componentProps = {
|
|
8677
|
-
...props,
|
|
8678
|
-
onComplete: () => {
|
|
8679
|
-
resolve();
|
|
8680
|
-
}
|
|
8681
|
-
};
|
|
8682
|
-
const { unmount } = render(/* @__PURE__ */ jsx(Component, { ...componentProps }));
|
|
8683
|
-
const originalResolve = resolve;
|
|
8684
|
-
resolve = () => {
|
|
8685
|
-
unmount();
|
|
8686
|
-
originalResolve();
|
|
8687
|
-
};
|
|
8688
|
-
});
|
|
8689
|
-
}
|
|
8690
|
-
};
|
|
8691
|
-
|
|
8692
|
-
// src/utils/config.ts
|
|
8690
|
+
// src/core/config.ts
|
|
8693
8691
|
import { readFileSync, existsSync } from "fs";
|
|
8694
8692
|
import { join, dirname } from "path";
|
|
8695
8693
|
|
|
8696
8694
|
// node_modules/conf/dist/source/index.js
|
|
8697
8695
|
import { isDeepStrictEqual } from "util";
|
|
8698
8696
|
import process7 from "process";
|
|
8699
|
-
import { Buffer } from "buffer";
|
|
8697
|
+
import { Buffer as Buffer2 } from "buffer";
|
|
8700
8698
|
import fs2 from "fs";
|
|
8701
8699
|
import path4 from "path";
|
|
8702
8700
|
import crypto from "crypto";
|
|
@@ -9768,7 +9766,7 @@ var Conf = class {
|
|
|
9768
9766
|
const initializationVector = data.slice(0, 16);
|
|
9769
9767
|
const password = crypto.pbkdf2Sync(__classPrivateFieldGet(this, _Conf_encryptionKey, "f"), initializationVector.toString(), 1e4, 32, "sha512");
|
|
9770
9768
|
const decipher = crypto.createDecipheriv(encryptionAlgorithm, password, initializationVector);
|
|
9771
|
-
return
|
|
9769
|
+
return Buffer2.concat([decipher.update(Buffer2.from(data.slice(17))), decipher.final()]).toString("utf8");
|
|
9772
9770
|
} catch {
|
|
9773
9771
|
}
|
|
9774
9772
|
return data.toString();
|
|
@@ -9807,7 +9805,7 @@ var Conf = class {
|
|
|
9807
9805
|
const initializationVector = crypto.randomBytes(16);
|
|
9808
9806
|
const password = crypto.pbkdf2Sync(__classPrivateFieldGet(this, _Conf_encryptionKey, "f"), initializationVector.toString(), 1e4, 32, "sha512");
|
|
9809
9807
|
const cipher = crypto.createCipheriv(encryptionAlgorithm, password, initializationVector);
|
|
9810
|
-
data =
|
|
9808
|
+
data = Buffer2.concat([initializationVector, Buffer2.from(":"), cipher.update(Buffer2.from(data)), cipher.final()]);
|
|
9811
9809
|
}
|
|
9812
9810
|
if (process7.env.SNAP) {
|
|
9813
9811
|
fs2.writeFileSync(this.path, data, { mode: __classPrivateFieldGet(this, _Conf_options, "f").configFileMode });
|
|
@@ -9912,7 +9910,97 @@ var Conf = class {
|
|
|
9912
9910
|
}
|
|
9913
9911
|
};
|
|
9914
9912
|
|
|
9915
|
-
// src/
|
|
9913
|
+
// src/core/config.ts
|
|
9914
|
+
var getConfigMetadata = () => [
|
|
9915
|
+
{
|
|
9916
|
+
key: "default-language",
|
|
9917
|
+
property: "defaultLanguage",
|
|
9918
|
+
label: "\uAE30\uBCF8 \uC5B8\uC5B4",
|
|
9919
|
+
description: `\uAE30\uBCF8\uC73C\uB85C \uC0AC\uC6A9\uD560 \uD504\uB85C\uADF8\uB798\uBC0D \uC5B8\uC5B4\uC785\uB2C8\uB2E4.`,
|
|
9920
|
+
placeholder: "\uC5B8\uC5B4 \uC785\uB825 (python, javascript, typescript, cpp)",
|
|
9921
|
+
type: "select",
|
|
9922
|
+
suggestions: ["python", "javascript", "typescript", "cpp"]
|
|
9923
|
+
},
|
|
9924
|
+
{
|
|
9925
|
+
key: "editor",
|
|
9926
|
+
property: "editor",
|
|
9927
|
+
label: "\uC5D0\uB514\uD130",
|
|
9928
|
+
description: "\uBB38\uC81C\uB97C \uAC00\uC838\uC628 \uD6C4 \uC790\uB3D9\uC73C\uB85C \uC5F4 \uC5D0\uB514\uD130 \uBA85\uB839\uC5B4\uC785\uB2C8\uB2E4.",
|
|
9929
|
+
placeholder: "\uC5D0\uB514\uD130 \uBA85\uB839\uC5B4 \uC785\uB825 (\uC608: code, cursor, vim, nano)",
|
|
9930
|
+
type: "string",
|
|
9931
|
+
suggestions: ["code", "cursor", "vim", "nano"]
|
|
9932
|
+
},
|
|
9933
|
+
{
|
|
9934
|
+
key: "auto-open-editor",
|
|
9935
|
+
property: "autoOpenEditor",
|
|
9936
|
+
label: "\uC790\uB3D9 \uC5D0\uB514\uD130 \uC5F4\uAE30",
|
|
9937
|
+
description: "fetch \uBA85\uB839 \uC2E4\uD589 \uD6C4 \uC790\uB3D9\uC73C\uB85C \uC5D0\uB514\uD130\uB97C \uC5F4\uC9C0 \uC5EC\uBD80\uC785\uB2C8\uB2E4.",
|
|
9938
|
+
placeholder: "true \uB610\uB294 false \uC785\uB825",
|
|
9939
|
+
type: "boolean",
|
|
9940
|
+
suggestions: ["true", "false"]
|
|
9941
|
+
},
|
|
9942
|
+
{
|
|
9943
|
+
key: "solved-ac-handle",
|
|
9944
|
+
property: "solvedAcHandle",
|
|
9945
|
+
label: "Solved.ac \uD578\uB4E4",
|
|
9946
|
+
description: "\uC0AC\uC6A9\uC790\uC758 Solved.ac \uD578\uB4E4\uC785\uB2C8\uB2E4 (\uD1B5\uACC4 \uC870\uD68C\uC6A9).",
|
|
9947
|
+
placeholder: "\uD578\uB4E4 \uC785\uB825",
|
|
9948
|
+
type: "string"
|
|
9949
|
+
},
|
|
9950
|
+
{
|
|
9951
|
+
key: "archive-dir",
|
|
9952
|
+
property: "archiveDir",
|
|
9953
|
+
label: "\uC544\uCE74\uC774\uBE0C \uB514\uB809\uD1A0\uB9AC",
|
|
9954
|
+
description: "\uD574\uACB0\uD55C \uBB38\uC81C\uB97C \uBCF4\uAD00\uD560 \uB514\uB809\uD1A0\uB9AC \uACBD\uB85C\uC785\uB2C8\uB2E4.",
|
|
9955
|
+
placeholder: "\uB514\uB809\uD1A0\uB9AC \uACBD\uB85C \uC785\uB825 (\uAE30\uBCF8\uAC12: problems)",
|
|
9956
|
+
type: "string",
|
|
9957
|
+
suggestions: ["problems", ".", ""]
|
|
9958
|
+
},
|
|
9959
|
+
{
|
|
9960
|
+
key: "solving-dir",
|
|
9961
|
+
property: "solvingDir",
|
|
9962
|
+
label: "Solving \uB514\uB809\uD1A0\uB9AC",
|
|
9963
|
+
description: "\uD604\uC7AC \uD480\uACE0 \uC788\uB294 \uBB38\uC81C\uB97C \uB2F4\uC744 \uB514\uB809\uD1A0\uB9AC \uACBD\uB85C\uC785\uB2C8\uB2E4.",
|
|
9964
|
+
placeholder: "\uB514\uB809\uD1A0\uB9AC \uACBD\uB85C \uC785\uB825 (\uAE30\uBCF8\uAC12: solving)",
|
|
9965
|
+
type: "string",
|
|
9966
|
+
suggestions: ["solving", ".", ""]
|
|
9967
|
+
},
|
|
9968
|
+
{
|
|
9969
|
+
key: "archive-strategy",
|
|
9970
|
+
property: "archiveStrategy",
|
|
9971
|
+
label: "\uC544\uCE74\uC774\uBE59 \uC804\uB7B5",
|
|
9972
|
+
description: "\uBB38\uC81C\uB97C \uC544\uCE74\uC774\uBE0C\uD560 \uB54C\uC758 \uB514\uB809\uD1A0\uB9AC \uAD6C\uC870 \uC804\uB7B5\uC785\uB2C8\uB2E4.",
|
|
9973
|
+
placeholder: "\uC804\uB7B5 \uC785\uB825 (flat, by-range, by-tier, by-tag)",
|
|
9974
|
+
type: "select",
|
|
9975
|
+
suggestions: ["flat", "by-range", "by-tier", "by-tag"]
|
|
9976
|
+
},
|
|
9977
|
+
{
|
|
9978
|
+
key: "archive-auto-commit",
|
|
9979
|
+
property: "archiveAutoCommit",
|
|
9980
|
+
label: "\uC790\uB3D9 Git \uCEE4\uBC0B",
|
|
9981
|
+
description: "\uC544\uCE74\uC774\uBE0C \uC2DC \uC790\uB3D9\uC73C\uB85C Git \uCEE4\uBC0B\uC744 \uC218\uD589\uD560\uC9C0 \uC5EC\uBD80\uC785\uB2C8\uB2E4.",
|
|
9982
|
+
placeholder: "true \uB610\uB294 false \uC785\uB825",
|
|
9983
|
+
type: "boolean",
|
|
9984
|
+
suggestions: ["true", "false"]
|
|
9985
|
+
},
|
|
9986
|
+
{
|
|
9987
|
+
key: "archive-commit-message",
|
|
9988
|
+
property: "archiveCommitMessage",
|
|
9989
|
+
label: "\uCEE4\uBC0B \uBA54\uC2DC\uC9C0 \uD15C\uD50C\uB9BF",
|
|
9990
|
+
description: "\uC544\uCE74\uC774\uBE0C \uC2DC \uC0AC\uC6A9\uD560 Git \uCEE4\uBC0B \uBA54\uC2DC\uC9C0 \uD15C\uD50C\uB9BF\uC785\uB2C8\uB2E4.",
|
|
9991
|
+
placeholder: "\uBA54\uC2DC\uC9C0 \uD15C\uD50C\uB9BF \uC785\uB825 ({id}, {title} \uC0AC\uC6A9 \uAC00\uB2A5)",
|
|
9992
|
+
type: "string"
|
|
9993
|
+
},
|
|
9994
|
+
{
|
|
9995
|
+
key: "include-tag",
|
|
9996
|
+
property: "includeTag",
|
|
9997
|
+
label: "\uD0DC\uADF8 \uD3EC\uD568 \uC5EC\uBD80",
|
|
9998
|
+
description: "README \uC0DD\uC131 \uC2DC \uC54C\uACE0\uB9AC\uC998 \uBD84\uB958(\uD0DC\uADF8)\uB97C \uD3EC\uD568\uD560\uC9C0 \uC5EC\uBD80\uC785\uB2C8\uB2E4.",
|
|
9999
|
+
placeholder: "true \uB610\uB294 false \uC785\uB825",
|
|
10000
|
+
type: "boolean",
|
|
10001
|
+
suggestions: ["true", "false"]
|
|
10002
|
+
}
|
|
10003
|
+
];
|
|
9916
10004
|
var config = new Conf({
|
|
9917
10005
|
projectName: "ps-cli",
|
|
9918
10006
|
defaults: {
|
|
@@ -9928,7 +10016,8 @@ var config = new Conf({
|
|
|
9928
10016
|
// 기본값: problems 디렉토리
|
|
9929
10017
|
solvingDir: "solving",
|
|
9930
10018
|
// 기본값: solving 디렉토리
|
|
9931
|
-
archiveAutoCommit: true
|
|
10019
|
+
archiveAutoCommit: true,
|
|
10020
|
+
includeTag: true
|
|
9932
10021
|
}
|
|
9933
10022
|
});
|
|
9934
10023
|
var projectConfigCache = null;
|
|
@@ -10049,8 +10138,59 @@ function getArchiveCommitMessage() {
|
|
|
10049
10138
|
}
|
|
10050
10139
|
return config.get("archiveCommitMessage");
|
|
10051
10140
|
}
|
|
10141
|
+
function getIncludeTag() {
|
|
10142
|
+
const projectConfig = getProjectConfigSync();
|
|
10143
|
+
if (projectConfig?.includeTag !== void 0) {
|
|
10144
|
+
return projectConfig.includeTag;
|
|
10145
|
+
}
|
|
10146
|
+
return config.get("includeTag") ?? true;
|
|
10147
|
+
}
|
|
10148
|
+
|
|
10149
|
+
// src/core/language.ts
|
|
10150
|
+
var SUPPORTED_LANGUAGES = ["python", "cpp"];
|
|
10151
|
+
function getSupportedLanguages() {
|
|
10152
|
+
return [...SUPPORTED_LANGUAGES];
|
|
10153
|
+
}
|
|
10154
|
+
function getSupportedLanguagesString() {
|
|
10155
|
+
return SUPPORTED_LANGUAGES.join(", ");
|
|
10156
|
+
}
|
|
10157
|
+
var LANGUAGE_CONFIGS = {
|
|
10158
|
+
python: {
|
|
10159
|
+
extension: "py",
|
|
10160
|
+
templateFile: "solution.py",
|
|
10161
|
+
runCommand: "python3",
|
|
10162
|
+
bojLangId: 28
|
|
10163
|
+
// Python 3
|
|
10164
|
+
},
|
|
10165
|
+
cpp: {
|
|
10166
|
+
extension: "cpp",
|
|
10167
|
+
templateFile: "solution.cpp",
|
|
10168
|
+
// 절대 경로로 에러를 표시해서 에디터에서 문제 디렉토리의 파일로 바로 이동할 수 있도록 함
|
|
10169
|
+
compileCommand: "g++ -fdiagnostics-absolute-paths -o solution solution.cpp",
|
|
10170
|
+
runCommand: "./solution",
|
|
10171
|
+
bojLangId: 84
|
|
10172
|
+
// C++17
|
|
10173
|
+
}
|
|
10174
|
+
};
|
|
10175
|
+
function getLanguageConfig(language) {
|
|
10176
|
+
return LANGUAGE_CONFIGS[language];
|
|
10177
|
+
}
|
|
10178
|
+
function detectLanguageFromFile(filename) {
|
|
10179
|
+
const ext = filename.split(".").pop()?.toLowerCase();
|
|
10180
|
+
if (!ext) return null;
|
|
10181
|
+
switch (ext) {
|
|
10182
|
+
case "py":
|
|
10183
|
+
return "python";
|
|
10184
|
+
case "cpp":
|
|
10185
|
+
case "cc":
|
|
10186
|
+
case "cxx":
|
|
10187
|
+
return "cpp";
|
|
10188
|
+
default:
|
|
10189
|
+
return null;
|
|
10190
|
+
}
|
|
10191
|
+
}
|
|
10052
10192
|
|
|
10053
|
-
// src/
|
|
10193
|
+
// src/core/tier.ts
|
|
10054
10194
|
import gradient from "gradient-string";
|
|
10055
10195
|
var TIER_NAMES = [
|
|
10056
10196
|
void 0,
|
|
@@ -10287,8 +10427,32 @@ function getTierImageUrl(level) {
|
|
|
10287
10427
|
return `${TIER_IMAGE_BASE_URL}/${level}.svg`;
|
|
10288
10428
|
}
|
|
10289
10429
|
|
|
10290
|
-
// src/
|
|
10430
|
+
// src/core/problem.ts
|
|
10431
|
+
import { readFile } from "fs/promises";
|
|
10291
10432
|
import { join as join2 } from "path";
|
|
10433
|
+
function parseTimeLimitToMs(timeLimit) {
|
|
10434
|
+
if (!timeLimit) return void 0;
|
|
10435
|
+
const match = timeLimit.match(/([\d.]+)/);
|
|
10436
|
+
if (!match) return void 0;
|
|
10437
|
+
const seconds = parseFloat(match[1]);
|
|
10438
|
+
if (Number.isNaN(seconds)) return void 0;
|
|
10439
|
+
return Math.round(seconds * 1e3);
|
|
10440
|
+
}
|
|
10441
|
+
async function getProblemTimeLimitMs(problemDir) {
|
|
10442
|
+
try {
|
|
10443
|
+
const metaPath = join2(problemDir, "meta.json");
|
|
10444
|
+
const metaRaw = await readFile(metaPath, "utf-8");
|
|
10445
|
+
const meta = JSON.parse(metaRaw);
|
|
10446
|
+
if (typeof meta.timeLimitMs === "number") {
|
|
10447
|
+
return meta.timeLimitMs;
|
|
10448
|
+
}
|
|
10449
|
+
if (typeof meta.timeLimit === "string") {
|
|
10450
|
+
return parseTimeLimitToMs(meta.timeLimit);
|
|
10451
|
+
}
|
|
10452
|
+
} catch {
|
|
10453
|
+
}
|
|
10454
|
+
return void 0;
|
|
10455
|
+
}
|
|
10292
10456
|
function sanitizeFileName(name) {
|
|
10293
10457
|
return name.replace(/[<>:"/\\|?*]/g, "").replace(/\s+/g, "-").toLowerCase().trim();
|
|
10294
10458
|
}
|
|
@@ -10446,7 +10610,7 @@ function getSolvingDirPath(problemId, cwd = process.cwd(), _) {
|
|
|
10446
10610
|
return join2(baseDir, solvingDir, problemId.toString());
|
|
10447
10611
|
}
|
|
10448
10612
|
|
|
10449
|
-
// src/
|
|
10613
|
+
// src/core/execution-context.ts
|
|
10450
10614
|
import { access } from "fs/promises";
|
|
10451
10615
|
import { readdir } from "fs/promises";
|
|
10452
10616
|
import { join as join3 } from "path";
|
|
@@ -10522,6 +10686,717 @@ async function findSolutionFile(problemDir) {
|
|
|
10522
10686
|
return join3(problemDir, solutionFile);
|
|
10523
10687
|
}
|
|
10524
10688
|
|
|
10689
|
+
// src/core/base-command.tsx
|
|
10690
|
+
import { render } from "ink";
|
|
10691
|
+
import { jsx } from "react/jsx-runtime";
|
|
10692
|
+
var Command = class {
|
|
10693
|
+
/**
|
|
10694
|
+
* 뷰 렌더링 헬퍼 메서드
|
|
10695
|
+
* React 컴포넌트를 렌더링하고 완료 시 정리합니다.
|
|
10696
|
+
* @param Component - 렌더링할 React 컴포넌트 (함수 컴포넌트 또는 클래스 필드로 정의된 화살표 함수)
|
|
10697
|
+
* @param props - 컴포넌트에 전달할 props (onComplete는 자동으로 추가됨)
|
|
10698
|
+
*/
|
|
10699
|
+
async renderView(Component, props) {
|
|
10700
|
+
return new Promise((resolve) => {
|
|
10701
|
+
const componentProps = {
|
|
10702
|
+
...props,
|
|
10703
|
+
onComplete: () => {
|
|
10704
|
+
resolve();
|
|
10705
|
+
}
|
|
10706
|
+
};
|
|
10707
|
+
const { unmount } = render(/* @__PURE__ */ jsx(Component, { ...componentProps }));
|
|
10708
|
+
const originalResolve = resolve;
|
|
10709
|
+
resolve = () => {
|
|
10710
|
+
unmount();
|
|
10711
|
+
originalResolve();
|
|
10712
|
+
};
|
|
10713
|
+
});
|
|
10714
|
+
}
|
|
10715
|
+
};
|
|
10716
|
+
|
|
10717
|
+
// node_modules/chalk/source/vendor/ansi-styles/index.js
|
|
10718
|
+
var ANSI_BACKGROUND_OFFSET = 10;
|
|
10719
|
+
var wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
|
|
10720
|
+
var wrapAnsi256 = (offset = 0) => (code) => `\x1B[${38 + offset};5;${code}m`;
|
|
10721
|
+
var wrapAnsi16m = (offset = 0) => (red, green, blue) => `\x1B[${38 + offset};2;${red};${green};${blue}m`;
|
|
10722
|
+
var styles = {
|
|
10723
|
+
modifier: {
|
|
10724
|
+
reset: [0, 0],
|
|
10725
|
+
// 21 isn't widely supported and 22 does the same thing
|
|
10726
|
+
bold: [1, 22],
|
|
10727
|
+
dim: [2, 22],
|
|
10728
|
+
italic: [3, 23],
|
|
10729
|
+
underline: [4, 24],
|
|
10730
|
+
overline: [53, 55],
|
|
10731
|
+
inverse: [7, 27],
|
|
10732
|
+
hidden: [8, 28],
|
|
10733
|
+
strikethrough: [9, 29]
|
|
10734
|
+
},
|
|
10735
|
+
color: {
|
|
10736
|
+
black: [30, 39],
|
|
10737
|
+
red: [31, 39],
|
|
10738
|
+
green: [32, 39],
|
|
10739
|
+
yellow: [33, 39],
|
|
10740
|
+
blue: [34, 39],
|
|
10741
|
+
magenta: [35, 39],
|
|
10742
|
+
cyan: [36, 39],
|
|
10743
|
+
white: [37, 39],
|
|
10744
|
+
// Bright color
|
|
10745
|
+
blackBright: [90, 39],
|
|
10746
|
+
gray: [90, 39],
|
|
10747
|
+
// Alias of `blackBright`
|
|
10748
|
+
grey: [90, 39],
|
|
10749
|
+
// Alias of `blackBright`
|
|
10750
|
+
redBright: [91, 39],
|
|
10751
|
+
greenBright: [92, 39],
|
|
10752
|
+
yellowBright: [93, 39],
|
|
10753
|
+
blueBright: [94, 39],
|
|
10754
|
+
magentaBright: [95, 39],
|
|
10755
|
+
cyanBright: [96, 39],
|
|
10756
|
+
whiteBright: [97, 39]
|
|
10757
|
+
},
|
|
10758
|
+
bgColor: {
|
|
10759
|
+
bgBlack: [40, 49],
|
|
10760
|
+
bgRed: [41, 49],
|
|
10761
|
+
bgGreen: [42, 49],
|
|
10762
|
+
bgYellow: [43, 49],
|
|
10763
|
+
bgBlue: [44, 49],
|
|
10764
|
+
bgMagenta: [45, 49],
|
|
10765
|
+
bgCyan: [46, 49],
|
|
10766
|
+
bgWhite: [47, 49],
|
|
10767
|
+
// Bright color
|
|
10768
|
+
bgBlackBright: [100, 49],
|
|
10769
|
+
bgGray: [100, 49],
|
|
10770
|
+
// Alias of `bgBlackBright`
|
|
10771
|
+
bgGrey: [100, 49],
|
|
10772
|
+
// Alias of `bgBlackBright`
|
|
10773
|
+
bgRedBright: [101, 49],
|
|
10774
|
+
bgGreenBright: [102, 49],
|
|
10775
|
+
bgYellowBright: [103, 49],
|
|
10776
|
+
bgBlueBright: [104, 49],
|
|
10777
|
+
bgMagentaBright: [105, 49],
|
|
10778
|
+
bgCyanBright: [106, 49],
|
|
10779
|
+
bgWhiteBright: [107, 49]
|
|
10780
|
+
}
|
|
10781
|
+
};
|
|
10782
|
+
var modifierNames = Object.keys(styles.modifier);
|
|
10783
|
+
var foregroundColorNames = Object.keys(styles.color);
|
|
10784
|
+
var backgroundColorNames = Object.keys(styles.bgColor);
|
|
10785
|
+
var colorNames = [...foregroundColorNames, ...backgroundColorNames];
|
|
10786
|
+
function assembleStyles() {
|
|
10787
|
+
const codes = /* @__PURE__ */ new Map();
|
|
10788
|
+
for (const [groupName, group] of Object.entries(styles)) {
|
|
10789
|
+
for (const [styleName, style] of Object.entries(group)) {
|
|
10790
|
+
styles[styleName] = {
|
|
10791
|
+
open: `\x1B[${style[0]}m`,
|
|
10792
|
+
close: `\x1B[${style[1]}m`
|
|
10793
|
+
};
|
|
10794
|
+
group[styleName] = styles[styleName];
|
|
10795
|
+
codes.set(style[0], style[1]);
|
|
10796
|
+
}
|
|
10797
|
+
Object.defineProperty(styles, groupName, {
|
|
10798
|
+
value: group,
|
|
10799
|
+
enumerable: false
|
|
10800
|
+
});
|
|
10801
|
+
}
|
|
10802
|
+
Object.defineProperty(styles, "codes", {
|
|
10803
|
+
value: codes,
|
|
10804
|
+
enumerable: false
|
|
10805
|
+
});
|
|
10806
|
+
styles.color.close = "\x1B[39m";
|
|
10807
|
+
styles.bgColor.close = "\x1B[49m";
|
|
10808
|
+
styles.color.ansi = wrapAnsi16();
|
|
10809
|
+
styles.color.ansi256 = wrapAnsi256();
|
|
10810
|
+
styles.color.ansi16m = wrapAnsi16m();
|
|
10811
|
+
styles.bgColor.ansi = wrapAnsi16(ANSI_BACKGROUND_OFFSET);
|
|
10812
|
+
styles.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET);
|
|
10813
|
+
styles.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET);
|
|
10814
|
+
Object.defineProperties(styles, {
|
|
10815
|
+
rgbToAnsi256: {
|
|
10816
|
+
value(red, green, blue) {
|
|
10817
|
+
if (red === green && green === blue) {
|
|
10818
|
+
if (red < 8) {
|
|
10819
|
+
return 16;
|
|
10820
|
+
}
|
|
10821
|
+
if (red > 248) {
|
|
10822
|
+
return 231;
|
|
10823
|
+
}
|
|
10824
|
+
return Math.round((red - 8) / 247 * 24) + 232;
|
|
10825
|
+
}
|
|
10826
|
+
return 16 + 36 * Math.round(red / 255 * 5) + 6 * Math.round(green / 255 * 5) + Math.round(blue / 255 * 5);
|
|
10827
|
+
},
|
|
10828
|
+
enumerable: false
|
|
10829
|
+
},
|
|
10830
|
+
hexToRgb: {
|
|
10831
|
+
value(hex) {
|
|
10832
|
+
const matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex.toString(16));
|
|
10833
|
+
if (!matches) {
|
|
10834
|
+
return [0, 0, 0];
|
|
10835
|
+
}
|
|
10836
|
+
let [colorString] = matches;
|
|
10837
|
+
if (colorString.length === 3) {
|
|
10838
|
+
colorString = [...colorString].map((character) => character + character).join("");
|
|
10839
|
+
}
|
|
10840
|
+
const integer = Number.parseInt(colorString, 16);
|
|
10841
|
+
return [
|
|
10842
|
+
/* eslint-disable no-bitwise */
|
|
10843
|
+
integer >> 16 & 255,
|
|
10844
|
+
integer >> 8 & 255,
|
|
10845
|
+
integer & 255
|
|
10846
|
+
/* eslint-enable no-bitwise */
|
|
10847
|
+
];
|
|
10848
|
+
},
|
|
10849
|
+
enumerable: false
|
|
10850
|
+
},
|
|
10851
|
+
hexToAnsi256: {
|
|
10852
|
+
value: (hex) => styles.rgbToAnsi256(...styles.hexToRgb(hex)),
|
|
10853
|
+
enumerable: false
|
|
10854
|
+
},
|
|
10855
|
+
ansi256ToAnsi: {
|
|
10856
|
+
value(code) {
|
|
10857
|
+
if (code < 8) {
|
|
10858
|
+
return 30 + code;
|
|
10859
|
+
}
|
|
10860
|
+
if (code < 16) {
|
|
10861
|
+
return 90 + (code - 8);
|
|
10862
|
+
}
|
|
10863
|
+
let red;
|
|
10864
|
+
let green;
|
|
10865
|
+
let blue;
|
|
10866
|
+
if (code >= 232) {
|
|
10867
|
+
red = ((code - 232) * 10 + 8) / 255;
|
|
10868
|
+
green = red;
|
|
10869
|
+
blue = red;
|
|
10870
|
+
} else {
|
|
10871
|
+
code -= 16;
|
|
10872
|
+
const remainder = code % 36;
|
|
10873
|
+
red = Math.floor(code / 36) / 5;
|
|
10874
|
+
green = Math.floor(remainder / 6) / 5;
|
|
10875
|
+
blue = remainder % 6 / 5;
|
|
10876
|
+
}
|
|
10877
|
+
const value = Math.max(red, green, blue) * 2;
|
|
10878
|
+
if (value === 0) {
|
|
10879
|
+
return 30;
|
|
10880
|
+
}
|
|
10881
|
+
let result = 30 + (Math.round(blue) << 2 | Math.round(green) << 1 | Math.round(red));
|
|
10882
|
+
if (value === 2) {
|
|
10883
|
+
result += 60;
|
|
10884
|
+
}
|
|
10885
|
+
return result;
|
|
10886
|
+
},
|
|
10887
|
+
enumerable: false
|
|
10888
|
+
},
|
|
10889
|
+
rgbToAnsi: {
|
|
10890
|
+
value: (red, green, blue) => styles.ansi256ToAnsi(styles.rgbToAnsi256(red, green, blue)),
|
|
10891
|
+
enumerable: false
|
|
10892
|
+
},
|
|
10893
|
+
hexToAnsi: {
|
|
10894
|
+
value: (hex) => styles.ansi256ToAnsi(styles.hexToAnsi256(hex)),
|
|
10895
|
+
enumerable: false
|
|
10896
|
+
}
|
|
10897
|
+
});
|
|
10898
|
+
return styles;
|
|
10899
|
+
}
|
|
10900
|
+
var ansiStyles = assembleStyles();
|
|
10901
|
+
var ansi_styles_default = ansiStyles;
|
|
10902
|
+
|
|
10903
|
+
// node_modules/chalk/source/vendor/supports-color/index.js
|
|
10904
|
+
import process8 from "process";
|
|
10905
|
+
import os2 from "os";
|
|
10906
|
+
import tty from "tty";
|
|
10907
|
+
function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : process8.argv) {
|
|
10908
|
+
const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
|
|
10909
|
+
const position = argv.indexOf(prefix + flag);
|
|
10910
|
+
const terminatorPosition = argv.indexOf("--");
|
|
10911
|
+
return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
|
|
10912
|
+
}
|
|
10913
|
+
var { env: env2 } = process8;
|
|
10914
|
+
var flagForceColor;
|
|
10915
|
+
if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) {
|
|
10916
|
+
flagForceColor = 0;
|
|
10917
|
+
} else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) {
|
|
10918
|
+
flagForceColor = 1;
|
|
10919
|
+
}
|
|
10920
|
+
function envForceColor() {
|
|
10921
|
+
if ("FORCE_COLOR" in env2) {
|
|
10922
|
+
if (env2.FORCE_COLOR === "true") {
|
|
10923
|
+
return 1;
|
|
10924
|
+
}
|
|
10925
|
+
if (env2.FORCE_COLOR === "false") {
|
|
10926
|
+
return 0;
|
|
10927
|
+
}
|
|
10928
|
+
return env2.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env2.FORCE_COLOR, 10), 3);
|
|
10929
|
+
}
|
|
10930
|
+
}
|
|
10931
|
+
function translateLevel(level) {
|
|
10932
|
+
if (level === 0) {
|
|
10933
|
+
return false;
|
|
10934
|
+
}
|
|
10935
|
+
return {
|
|
10936
|
+
level,
|
|
10937
|
+
hasBasic: true,
|
|
10938
|
+
has256: level >= 2,
|
|
10939
|
+
has16m: level >= 3
|
|
10940
|
+
};
|
|
10941
|
+
}
|
|
10942
|
+
function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
|
|
10943
|
+
const noFlagForceColor = envForceColor();
|
|
10944
|
+
if (noFlagForceColor !== void 0) {
|
|
10945
|
+
flagForceColor = noFlagForceColor;
|
|
10946
|
+
}
|
|
10947
|
+
const forceColor = sniffFlags ? flagForceColor : noFlagForceColor;
|
|
10948
|
+
if (forceColor === 0) {
|
|
10949
|
+
return 0;
|
|
10950
|
+
}
|
|
10951
|
+
if (sniffFlags) {
|
|
10952
|
+
if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) {
|
|
10953
|
+
return 3;
|
|
10954
|
+
}
|
|
10955
|
+
if (hasFlag("color=256")) {
|
|
10956
|
+
return 2;
|
|
10957
|
+
}
|
|
10958
|
+
}
|
|
10959
|
+
if ("TF_BUILD" in env2 && "AGENT_NAME" in env2) {
|
|
10960
|
+
return 1;
|
|
10961
|
+
}
|
|
10962
|
+
if (haveStream && !streamIsTTY && forceColor === void 0) {
|
|
10963
|
+
return 0;
|
|
10964
|
+
}
|
|
10965
|
+
const min = forceColor || 0;
|
|
10966
|
+
if (env2.TERM === "dumb") {
|
|
10967
|
+
return min;
|
|
10968
|
+
}
|
|
10969
|
+
if (process8.platform === "win32") {
|
|
10970
|
+
const osRelease = os2.release().split(".");
|
|
10971
|
+
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
|
|
10972
|
+
return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
10973
|
+
}
|
|
10974
|
+
return 1;
|
|
10975
|
+
}
|
|
10976
|
+
if ("CI" in env2) {
|
|
10977
|
+
if (["GITHUB_ACTIONS", "GITEA_ACTIONS", "CIRCLECI"].some((key) => key in env2)) {
|
|
10978
|
+
return 3;
|
|
10979
|
+
}
|
|
10980
|
+
if (["TRAVIS", "APPVEYOR", "GITLAB_CI", "BUILDKITE", "DRONE"].some((sign) => sign in env2) || env2.CI_NAME === "codeship") {
|
|
10981
|
+
return 1;
|
|
10982
|
+
}
|
|
10983
|
+
return min;
|
|
10984
|
+
}
|
|
10985
|
+
if ("TEAMCITY_VERSION" in env2) {
|
|
10986
|
+
return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env2.TEAMCITY_VERSION) ? 1 : 0;
|
|
10987
|
+
}
|
|
10988
|
+
if (env2.COLORTERM === "truecolor") {
|
|
10989
|
+
return 3;
|
|
10990
|
+
}
|
|
10991
|
+
if (env2.TERM === "xterm-kitty") {
|
|
10992
|
+
return 3;
|
|
10993
|
+
}
|
|
10994
|
+
if (env2.TERM === "xterm-ghostty") {
|
|
10995
|
+
return 3;
|
|
10996
|
+
}
|
|
10997
|
+
if (env2.TERM === "wezterm") {
|
|
10998
|
+
return 3;
|
|
10999
|
+
}
|
|
11000
|
+
if ("TERM_PROGRAM" in env2) {
|
|
11001
|
+
const version = Number.parseInt((env2.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
|
|
11002
|
+
switch (env2.TERM_PROGRAM) {
|
|
11003
|
+
case "iTerm.app": {
|
|
11004
|
+
return version >= 3 ? 3 : 2;
|
|
11005
|
+
}
|
|
11006
|
+
case "Apple_Terminal": {
|
|
11007
|
+
return 2;
|
|
11008
|
+
}
|
|
11009
|
+
}
|
|
11010
|
+
}
|
|
11011
|
+
if (/-256(color)?$/i.test(env2.TERM)) {
|
|
11012
|
+
return 2;
|
|
11013
|
+
}
|
|
11014
|
+
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env2.TERM)) {
|
|
11015
|
+
return 1;
|
|
11016
|
+
}
|
|
11017
|
+
if ("COLORTERM" in env2) {
|
|
11018
|
+
return 1;
|
|
11019
|
+
}
|
|
11020
|
+
return min;
|
|
11021
|
+
}
|
|
11022
|
+
function createSupportsColor(stream, options = {}) {
|
|
11023
|
+
const level = _supportsColor(stream, {
|
|
11024
|
+
streamIsTTY: stream && stream.isTTY,
|
|
11025
|
+
...options
|
|
11026
|
+
});
|
|
11027
|
+
return translateLevel(level);
|
|
11028
|
+
}
|
|
11029
|
+
var supportsColor = {
|
|
11030
|
+
stdout: createSupportsColor({ isTTY: tty.isatty(1) }),
|
|
11031
|
+
stderr: createSupportsColor({ isTTY: tty.isatty(2) })
|
|
11032
|
+
};
|
|
11033
|
+
var supports_color_default = supportsColor;
|
|
11034
|
+
|
|
11035
|
+
// node_modules/chalk/source/utilities.js
|
|
11036
|
+
function stringReplaceAll(string, substring, replacer) {
|
|
11037
|
+
let index = string.indexOf(substring);
|
|
11038
|
+
if (index === -1) {
|
|
11039
|
+
return string;
|
|
11040
|
+
}
|
|
11041
|
+
const substringLength = substring.length;
|
|
11042
|
+
let endIndex = 0;
|
|
11043
|
+
let returnValue = "";
|
|
11044
|
+
do {
|
|
11045
|
+
returnValue += string.slice(endIndex, index) + substring + replacer;
|
|
11046
|
+
endIndex = index + substringLength;
|
|
11047
|
+
index = string.indexOf(substring, endIndex);
|
|
11048
|
+
} while (index !== -1);
|
|
11049
|
+
returnValue += string.slice(endIndex);
|
|
11050
|
+
return returnValue;
|
|
11051
|
+
}
|
|
11052
|
+
function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index) {
|
|
11053
|
+
let endIndex = 0;
|
|
11054
|
+
let returnValue = "";
|
|
11055
|
+
do {
|
|
11056
|
+
const gotCR = string[index - 1] === "\r";
|
|
11057
|
+
returnValue += string.slice(endIndex, gotCR ? index - 1 : index) + prefix + (gotCR ? "\r\n" : "\n") + postfix;
|
|
11058
|
+
endIndex = index + 1;
|
|
11059
|
+
index = string.indexOf("\n", endIndex);
|
|
11060
|
+
} while (index !== -1);
|
|
11061
|
+
returnValue += string.slice(endIndex);
|
|
11062
|
+
return returnValue;
|
|
11063
|
+
}
|
|
11064
|
+
|
|
11065
|
+
// node_modules/chalk/source/index.js
|
|
11066
|
+
var { stdout: stdoutColor, stderr: stderrColor } = supports_color_default;
|
|
11067
|
+
var GENERATOR = /* @__PURE__ */ Symbol("GENERATOR");
|
|
11068
|
+
var STYLER = /* @__PURE__ */ Symbol("STYLER");
|
|
11069
|
+
var IS_EMPTY = /* @__PURE__ */ Symbol("IS_EMPTY");
|
|
11070
|
+
var levelMapping = [
|
|
11071
|
+
"ansi",
|
|
11072
|
+
"ansi",
|
|
11073
|
+
"ansi256",
|
|
11074
|
+
"ansi16m"
|
|
11075
|
+
];
|
|
11076
|
+
var styles2 = /* @__PURE__ */ Object.create(null);
|
|
11077
|
+
var applyOptions = (object, options = {}) => {
|
|
11078
|
+
if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {
|
|
11079
|
+
throw new Error("The `level` option should be an integer from 0 to 3");
|
|
11080
|
+
}
|
|
11081
|
+
const colorLevel = stdoutColor ? stdoutColor.level : 0;
|
|
11082
|
+
object.level = options.level === void 0 ? colorLevel : options.level;
|
|
11083
|
+
};
|
|
11084
|
+
var chalkFactory = (options) => {
|
|
11085
|
+
const chalk2 = (...strings) => strings.join(" ");
|
|
11086
|
+
applyOptions(chalk2, options);
|
|
11087
|
+
Object.setPrototypeOf(chalk2, createChalk.prototype);
|
|
11088
|
+
return chalk2;
|
|
11089
|
+
};
|
|
11090
|
+
function createChalk(options) {
|
|
11091
|
+
return chalkFactory(options);
|
|
11092
|
+
}
|
|
11093
|
+
Object.setPrototypeOf(createChalk.prototype, Function.prototype);
|
|
11094
|
+
for (const [styleName, style] of Object.entries(ansi_styles_default)) {
|
|
11095
|
+
styles2[styleName] = {
|
|
11096
|
+
get() {
|
|
11097
|
+
const builder = createBuilder(this, createStyler(style.open, style.close, this[STYLER]), this[IS_EMPTY]);
|
|
11098
|
+
Object.defineProperty(this, styleName, { value: builder });
|
|
11099
|
+
return builder;
|
|
11100
|
+
}
|
|
11101
|
+
};
|
|
11102
|
+
}
|
|
11103
|
+
styles2.visible = {
|
|
11104
|
+
get() {
|
|
11105
|
+
const builder = createBuilder(this, this[STYLER], true);
|
|
11106
|
+
Object.defineProperty(this, "visible", { value: builder });
|
|
11107
|
+
return builder;
|
|
11108
|
+
}
|
|
11109
|
+
};
|
|
11110
|
+
var getModelAnsi = (model, level, type, ...arguments_) => {
|
|
11111
|
+
if (model === "rgb") {
|
|
11112
|
+
if (level === "ansi16m") {
|
|
11113
|
+
return ansi_styles_default[type].ansi16m(...arguments_);
|
|
11114
|
+
}
|
|
11115
|
+
if (level === "ansi256") {
|
|
11116
|
+
return ansi_styles_default[type].ansi256(ansi_styles_default.rgbToAnsi256(...arguments_));
|
|
11117
|
+
}
|
|
11118
|
+
return ansi_styles_default[type].ansi(ansi_styles_default.rgbToAnsi(...arguments_));
|
|
11119
|
+
}
|
|
11120
|
+
if (model === "hex") {
|
|
11121
|
+
return getModelAnsi("rgb", level, type, ...ansi_styles_default.hexToRgb(...arguments_));
|
|
11122
|
+
}
|
|
11123
|
+
return ansi_styles_default[type][model](...arguments_);
|
|
11124
|
+
};
|
|
11125
|
+
var usedModels = ["rgb", "hex", "ansi256"];
|
|
11126
|
+
for (const model of usedModels) {
|
|
11127
|
+
styles2[model] = {
|
|
11128
|
+
get() {
|
|
11129
|
+
const { level } = this;
|
|
11130
|
+
return function(...arguments_) {
|
|
11131
|
+
const styler = createStyler(getModelAnsi(model, levelMapping[level], "color", ...arguments_), ansi_styles_default.color.close, this[STYLER]);
|
|
11132
|
+
return createBuilder(this, styler, this[IS_EMPTY]);
|
|
11133
|
+
};
|
|
11134
|
+
}
|
|
11135
|
+
};
|
|
11136
|
+
const bgModel = "bg" + model[0].toUpperCase() + model.slice(1);
|
|
11137
|
+
styles2[bgModel] = {
|
|
11138
|
+
get() {
|
|
11139
|
+
const { level } = this;
|
|
11140
|
+
return function(...arguments_) {
|
|
11141
|
+
const styler = createStyler(getModelAnsi(model, levelMapping[level], "bgColor", ...arguments_), ansi_styles_default.bgColor.close, this[STYLER]);
|
|
11142
|
+
return createBuilder(this, styler, this[IS_EMPTY]);
|
|
11143
|
+
};
|
|
11144
|
+
}
|
|
11145
|
+
};
|
|
11146
|
+
}
|
|
11147
|
+
var proto = Object.defineProperties(() => {
|
|
11148
|
+
}, {
|
|
11149
|
+
...styles2,
|
|
11150
|
+
level: {
|
|
11151
|
+
enumerable: true,
|
|
11152
|
+
get() {
|
|
11153
|
+
return this[GENERATOR].level;
|
|
11154
|
+
},
|
|
11155
|
+
set(level) {
|
|
11156
|
+
this[GENERATOR].level = level;
|
|
11157
|
+
}
|
|
11158
|
+
}
|
|
11159
|
+
});
|
|
11160
|
+
var createStyler = (open, close, parent) => {
|
|
11161
|
+
let openAll;
|
|
11162
|
+
let closeAll;
|
|
11163
|
+
if (parent === void 0) {
|
|
11164
|
+
openAll = open;
|
|
11165
|
+
closeAll = close;
|
|
11166
|
+
} else {
|
|
11167
|
+
openAll = parent.openAll + open;
|
|
11168
|
+
closeAll = close + parent.closeAll;
|
|
11169
|
+
}
|
|
11170
|
+
return {
|
|
11171
|
+
open,
|
|
11172
|
+
close,
|
|
11173
|
+
openAll,
|
|
11174
|
+
closeAll,
|
|
11175
|
+
parent
|
|
11176
|
+
};
|
|
11177
|
+
};
|
|
11178
|
+
var createBuilder = (self, _styler, _isEmpty) => {
|
|
11179
|
+
const builder = (...arguments_) => applyStyle(builder, arguments_.length === 1 ? "" + arguments_[0] : arguments_.join(" "));
|
|
11180
|
+
Object.setPrototypeOf(builder, proto);
|
|
11181
|
+
builder[GENERATOR] = self;
|
|
11182
|
+
builder[STYLER] = _styler;
|
|
11183
|
+
builder[IS_EMPTY] = _isEmpty;
|
|
11184
|
+
return builder;
|
|
11185
|
+
};
|
|
11186
|
+
var applyStyle = (self, string) => {
|
|
11187
|
+
if (self.level <= 0 || !string) {
|
|
11188
|
+
return self[IS_EMPTY] ? "" : string;
|
|
11189
|
+
}
|
|
11190
|
+
let styler = self[STYLER];
|
|
11191
|
+
if (styler === void 0) {
|
|
11192
|
+
return string;
|
|
11193
|
+
}
|
|
11194
|
+
const { openAll, closeAll } = styler;
|
|
11195
|
+
if (string.includes("\x1B")) {
|
|
11196
|
+
while (styler !== void 0) {
|
|
11197
|
+
string = stringReplaceAll(string, styler.close, styler.open);
|
|
11198
|
+
styler = styler.parent;
|
|
11199
|
+
}
|
|
11200
|
+
}
|
|
11201
|
+
const lfIndex = string.indexOf("\n");
|
|
11202
|
+
if (lfIndex !== -1) {
|
|
11203
|
+
string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex);
|
|
11204
|
+
}
|
|
11205
|
+
return openAll + string + closeAll;
|
|
11206
|
+
};
|
|
11207
|
+
Object.defineProperties(createChalk.prototype, styles2);
|
|
11208
|
+
var chalk = createChalk();
|
|
11209
|
+
var chalkStderr = createChalk({ level: stderrColor ? stderrColor.level : 0 });
|
|
11210
|
+
var source_default = chalk;
|
|
11211
|
+
|
|
11212
|
+
// src/utils/icons.ts
|
|
11213
|
+
var icons = {
|
|
11214
|
+
// Problem status
|
|
11215
|
+
solved: "\uF00C",
|
|
11216
|
+
// f00c
|
|
11217
|
+
solving: "\uF444",
|
|
11218
|
+
// f444
|
|
11219
|
+
// Actions
|
|
11220
|
+
open: "\u{F059F}",
|
|
11221
|
+
// f05a1
|
|
11222
|
+
editor: "\u{F0171}",
|
|
11223
|
+
// f0171
|
|
11224
|
+
fetch: "\u{F01DA}",
|
|
11225
|
+
// f01da
|
|
11226
|
+
test: "\uF499",
|
|
11227
|
+
// f499
|
|
11228
|
+
submit: "\u{F0B79}",
|
|
11229
|
+
// f0b79
|
|
11230
|
+
archive: "\uF187",
|
|
11231
|
+
// f187
|
|
11232
|
+
run: "\u{F040A}",
|
|
11233
|
+
// f040a
|
|
11234
|
+
// Views / Navigation
|
|
11235
|
+
workbook: "\uF02D",
|
|
11236
|
+
// f02d
|
|
11237
|
+
search: "\uF002",
|
|
11238
|
+
// f002
|
|
11239
|
+
stats: "\u{F012B}",
|
|
11240
|
+
// f012b
|
|
11241
|
+
user: "\uF007",
|
|
11242
|
+
// f0007
|
|
11243
|
+
trophy: "\uF091",
|
|
11244
|
+
// f091
|
|
11245
|
+
config: "\u2699",
|
|
11246
|
+
// f013
|
|
11247
|
+
init: "\u{F0B79}",
|
|
11248
|
+
// f0b79
|
|
11249
|
+
back: "\u{F004D}",
|
|
11250
|
+
// f044d
|
|
11251
|
+
next: "\u{F0054}",
|
|
11252
|
+
// f0454
|
|
11253
|
+
// Feedback / Status
|
|
11254
|
+
success: "\uF058",
|
|
11255
|
+
// f058
|
|
11256
|
+
error: "\uF057",
|
|
11257
|
+
// f057
|
|
11258
|
+
warning: "\uF071",
|
|
11259
|
+
// f071
|
|
11260
|
+
info: "\uF05A",
|
|
11261
|
+
// f05a
|
|
11262
|
+
spinner: "\u{F144A}",
|
|
11263
|
+
// f0c4a
|
|
11264
|
+
clipboard: "\u{F018F}",
|
|
11265
|
+
// f018f
|
|
11266
|
+
tip: "\u{F0335}",
|
|
11267
|
+
// f0315
|
|
11268
|
+
sparkle: "\u{F140B}"
|
|
11269
|
+
// f040b
|
|
11270
|
+
};
|
|
11271
|
+
|
|
11272
|
+
// src/utils/logger.ts
|
|
11273
|
+
import gradient2 from "gradient-string";
|
|
11274
|
+
var colors = {
|
|
11275
|
+
primary: "#007AFF",
|
|
11276
|
+
secondary: "#5856D6",
|
|
11277
|
+
success: "#34C759",
|
|
11278
|
+
warning: "#FF9500",
|
|
11279
|
+
error: "#FF3B30",
|
|
11280
|
+
info: "#5AC8FA",
|
|
11281
|
+
gray: "#8E8E93"
|
|
11282
|
+
};
|
|
11283
|
+
var psGradient = gradient2([colors.primary, colors.secondary]);
|
|
11284
|
+
var logger = {
|
|
11285
|
+
error(message, ...args) {
|
|
11286
|
+
console.error(
|
|
11287
|
+
`${source_default.hex(colors.error)(icons.error)} ${source_default.bold.hex(colors.error)("\uC624\uB958:")} ${message}`,
|
|
11288
|
+
...args
|
|
11289
|
+
);
|
|
11290
|
+
},
|
|
11291
|
+
warn(message, ...args) {
|
|
11292
|
+
console.warn(
|
|
11293
|
+
`${source_default.hex(colors.warning)(icons.warning)} ${source_default.bold.hex(colors.warning)("\uACBD\uACE0:")} ${message}`,
|
|
11294
|
+
...args
|
|
11295
|
+
);
|
|
11296
|
+
},
|
|
11297
|
+
success(message, ...args) {
|
|
11298
|
+
console.log(
|
|
11299
|
+
`${source_default.hex(colors.success)(icons.success)} ${source_default.bold.hex(colors.success)("\uC131\uACF5:")} ${message}`,
|
|
11300
|
+
...args
|
|
11301
|
+
);
|
|
11302
|
+
},
|
|
11303
|
+
info(message, ...args) {
|
|
11304
|
+
console.log(
|
|
11305
|
+
`${source_default.hex(colors.info)(icons.info)} ${source_default.bold.hex(colors.info)("\uC815\uBCF4:")} ${message}`,
|
|
11306
|
+
...args
|
|
11307
|
+
);
|
|
11308
|
+
},
|
|
11309
|
+
tip(message, ...args) {
|
|
11310
|
+
console.log(
|
|
11311
|
+
`${source_default.hex(colors.primary)(icons.tip)} ${source_default.bold.hex(colors.primary)("\uD301:")} ${message}`,
|
|
11312
|
+
...args
|
|
11313
|
+
);
|
|
11314
|
+
},
|
|
11315
|
+
ps(message) {
|
|
11316
|
+
console.log(psGradient.multiline(message));
|
|
11317
|
+
},
|
|
11318
|
+
bold: source_default.bold,
|
|
11319
|
+
dim: source_default.dim,
|
|
11320
|
+
italic: source_default.italic,
|
|
11321
|
+
hex: source_default.hex
|
|
11322
|
+
};
|
|
11323
|
+
|
|
11324
|
+
// src/utils/help.ts
|
|
11325
|
+
function generateGlobalHelp(commands) {
|
|
11326
|
+
const title = psGradient.multiline(`
|
|
11327
|
+
|
|
11328
|
+
\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2557 \u2588\u2588\u2557
|
|
11329
|
+
\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D \u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D\u2588\u2588\u2551 \u2588\u2588\u2551
|
|
11330
|
+
\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551
|
|
11331
|
+
\u2588\u2588\u2554\u2550\u2550\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551
|
|
11332
|
+
\u2588\u2588\u2551 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551 \u255A\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2551
|
|
11333
|
+
\u255A\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u255D\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D\u255A\u2550\u255D
|
|
11334
|
+
`);
|
|
11335
|
+
const usage = `
|
|
11336
|
+
${logger.bold("\uC0AC\uC6A9\uBC95:")}
|
|
11337
|
+
$ ps ${source_default.hex(colors.primary)("<\uBA85\uB839\uC5B4>")} [\uC778\uC790] [\uC635\uC158]
|
|
11338
|
+
`;
|
|
11339
|
+
const commandLines = Array.from(commands.values()).sort((a, b) => a.name.localeCompare(b.name)).map((cmd) => {
|
|
11340
|
+
const icon = icons[cmd.name] || " ";
|
|
11341
|
+
return ` ${source_default.hex(colors.primary)(cmd.name.padEnd(12))} ${source_default.dim(icon)} ${cmd.metadata?.description.split("\n")[0]}`;
|
|
11342
|
+
}).join("\n");
|
|
11343
|
+
const commandsSection = `
|
|
11344
|
+
${logger.bold("\uBA85\uB839\uC5B4:")}
|
|
11345
|
+
${commandLines}
|
|
11346
|
+
${source_default.hex(colors.primary)("help".padEnd(12))} ${source_default.dim(icons.info)} \uB3C4\uC6C0\uB9D0 \uD45C\uC2DC
|
|
11347
|
+
`;
|
|
11348
|
+
const quickStart = `
|
|
11349
|
+
${logger.bold("\uBE60\uB978 \uC2DC\uC791:")}
|
|
11350
|
+
$ ps ${source_default.hex(colors.primary)("init")} ${source_default.dim(icons.init)} \uD504\uB85C\uC81D\uD2B8 \uCD08\uAE30\uD654
|
|
11351
|
+
$ ps ${source_default.hex(colors.primary)("fetch")} 1000 ${source_default.dim(icons.fetch)} \uBB38\uC81C \uAC00\uC838\uC624\uAE30
|
|
11352
|
+
$ ps ${source_default.hex(colors.primary)("test")} ${source_default.dim(icons.test)} \uD14C\uC2A4\uD2B8 \uC2E4\uD589
|
|
11353
|
+
$ ps ${source_default.hex(colors.primary)("submit")} ${source_default.dim(icons.submit)} \uC81C\uCD9C
|
|
11354
|
+
`;
|
|
11355
|
+
const moreInfo = `
|
|
11356
|
+
${logger.bold("\uC790\uC138\uD55C \uB3C4\uC6C0\uB9D0:")}
|
|
11357
|
+
$ ps ${source_default.hex(colors.primary)("<\uBA85\uB839\uC5B4>")} --help
|
|
11358
|
+
`;
|
|
11359
|
+
return [title, usage, commandsSection, quickStart, moreInfo].map((s) => s.trim()).join("\n\n");
|
|
11360
|
+
}
|
|
11361
|
+
function generateCommandHelp(metadata) {
|
|
11362
|
+
const usage = `
|
|
11363
|
+
${logger.bold("\uC0AC\uC6A9\uBC95:")}
|
|
11364
|
+
$ ps ${source_default.hex(colors.primary)(metadata.name)}${metadata.requireProblemId ? ` ${source_default.hex(colors.secondary)("<\uBB38\uC81C\uBC88\uD638>")}` : metadata.autoDetectProblemId !== false ? ` ${source_default.dim("[\uBB38\uC81C\uBC88\uD638]")}` : ""} [\uC635\uC158]
|
|
11365
|
+
`;
|
|
11366
|
+
const description = `
|
|
11367
|
+
${logger.bold("\uC124\uBA85:")}
|
|
11368
|
+
${metadata.description.split("\n").map((line) => ` ${line}`).join("\n")}
|
|
11369
|
+
`;
|
|
11370
|
+
let flagsSection = "";
|
|
11371
|
+
if (metadata.flags && metadata.flags.length > 0) {
|
|
11372
|
+
const flagLines = metadata.flags.map((flag) => {
|
|
11373
|
+
const name = `--${flag.name}`;
|
|
11374
|
+
const short = flag.options?.shortFlag ? `, -${flag.options.shortFlag}` : "";
|
|
11375
|
+
const desc = flag.options?.description ? ` ${flag.options.description}` : "";
|
|
11376
|
+
return ` ${source_default.hex(colors.primary)((name + short).padEnd(20))}${source_default.dim(desc)}`;
|
|
11377
|
+
}).join("\n");
|
|
11378
|
+
flagsSection = `
|
|
11379
|
+
${logger.bold("\uC635\uC158:")}
|
|
11380
|
+
${flagLines}
|
|
11381
|
+
${source_default.hex(colors.primary)("--help, -h".padEnd(20))}${source_default.dim(" \uB3C4\uC6C0\uB9D0 \uD45C\uC2DC")}
|
|
11382
|
+
`;
|
|
11383
|
+
} else {
|
|
11384
|
+
flagsSection = `
|
|
11385
|
+
${logger.bold("\uC635\uC158:")}
|
|
11386
|
+
${source_default.hex(colors.primary)("--help, -h".padEnd(20))}${source_default.dim(" \uB3C4\uC6C0\uB9D0 \uD45C\uC2DC")}
|
|
11387
|
+
`;
|
|
11388
|
+
}
|
|
11389
|
+
let examplesSection = "";
|
|
11390
|
+
if (metadata.examples && metadata.examples.length > 0) {
|
|
11391
|
+
const exampleLines = metadata.examples.map((ex) => ` $ ps ${ex}`).join("\n");
|
|
11392
|
+
examplesSection = `
|
|
11393
|
+
${logger.bold("\uC608\uC81C:")}
|
|
11394
|
+
${exampleLines}
|
|
11395
|
+
`;
|
|
11396
|
+
}
|
|
11397
|
+
return [usage, description, flagsSection, examplesSection].filter((s) => s.trim().length > 0).map((s) => s.trim()).join("\n\n");
|
|
11398
|
+
}
|
|
11399
|
+
|
|
10525
11400
|
// src/core/command-builder.ts
|
|
10526
11401
|
var commandMetadataMap = /* @__PURE__ */ new Map();
|
|
10527
11402
|
function CommandDef(metadata) {
|
|
@@ -10543,21 +11418,19 @@ var CommandBuilder = class {
|
|
|
10543
11418
|
"Command \uBA54\uD0C0\uB370\uC774\uD130\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4. @Command() \uB370\uCF54\uB808\uC774\uD130\uB97C \uC0AC\uC6A9\uD558\uAC70\uB098 metadata\uB97C \uC81C\uACF5\uD558\uC138\uC694."
|
|
10544
11419
|
);
|
|
10545
11420
|
}
|
|
10546
|
-
const help =
|
|
11421
|
+
const help = generateCommandHelp(finalMetadata);
|
|
10547
11422
|
const wrappedExecute = async (args, flags) => {
|
|
10548
11423
|
if (flags.help) {
|
|
10549
11424
|
console.log(help.trim());
|
|
10550
11425
|
process.exit(0);
|
|
10551
11426
|
return;
|
|
10552
11427
|
}
|
|
10553
|
-
if (finalMetadata.autoDetectProblemId !== false) {
|
|
10554
|
-
}
|
|
10555
11428
|
if (finalMetadata.autoDetectLanguage && flags.language) {
|
|
10556
11429
|
const validLanguages = getSupportedLanguages();
|
|
10557
11430
|
const language = flags.language;
|
|
10558
11431
|
if (!validLanguages.includes(language)) {
|
|
10559
|
-
|
|
10560
|
-
`\
|
|
11432
|
+
logger.error(
|
|
11433
|
+
`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 \uC5B8\uC5B4\uC785\uB2C8\uB2E4. (${getSupportedLanguagesString()})`
|
|
10561
11434
|
);
|
|
10562
11435
|
process.exit(1);
|
|
10563
11436
|
return;
|
|
@@ -10572,45 +11445,6 @@ var CommandBuilder = class {
|
|
|
10572
11445
|
metadata: finalMetadata
|
|
10573
11446
|
};
|
|
10574
11447
|
}
|
|
10575
|
-
/**
|
|
10576
|
-
* Help 문자열 생성
|
|
10577
|
-
*/
|
|
10578
|
-
static generateHelp(metadata) {
|
|
10579
|
-
const lines = [];
|
|
10580
|
-
lines.push(` \uC0AC\uC6A9\uBC95:`);
|
|
10581
|
-
lines.push(
|
|
10582
|
-
` $ ps ${metadata.name}${metadata.requireProblemId ? " <\uBB38\uC81C\uBC88\uD638>" : " [\uBB38\uC81C\uBC88\uD638]"} [\uC635\uC158]`
|
|
10583
|
-
);
|
|
10584
|
-
lines.push("");
|
|
10585
|
-
lines.push(` \uC124\uBA85:`);
|
|
10586
|
-
const descriptionLines = metadata.description.split("\n");
|
|
10587
|
-
for (const line of descriptionLines) {
|
|
10588
|
-
lines.push(` ${line}`);
|
|
10589
|
-
}
|
|
10590
|
-
lines.push("");
|
|
10591
|
-
if (metadata.flags && metadata.flags.length > 0) {
|
|
10592
|
-
lines.push(` \uC635\uC158:`);
|
|
10593
|
-
for (const flag of metadata.flags) {
|
|
10594
|
-
const flagLine = [];
|
|
10595
|
-
flagLine.push(` --${flag.name}`);
|
|
10596
|
-
if (flag.options?.shortFlag) {
|
|
10597
|
-
flagLine.push(`, -${flag.options.shortFlag}`);
|
|
10598
|
-
}
|
|
10599
|
-
if (flag.options?.description) {
|
|
10600
|
-
flagLine.push(` ${flag.options.description}`);
|
|
10601
|
-
}
|
|
10602
|
-
lines.push(flagLine.join(""));
|
|
10603
|
-
}
|
|
10604
|
-
lines.push("");
|
|
10605
|
-
}
|
|
10606
|
-
if (metadata.examples && metadata.examples.length > 0) {
|
|
10607
|
-
lines.push(` \uC608\uC81C:`);
|
|
10608
|
-
for (const example of metadata.examples) {
|
|
10609
|
-
lines.push(` $ ps ${example}`);
|
|
10610
|
-
}
|
|
10611
|
-
}
|
|
10612
|
-
return lines.join("\n");
|
|
10613
|
-
}
|
|
10614
11448
|
/**
|
|
10615
11449
|
* 간편한 Command 정의 헬퍼
|
|
10616
11450
|
*/
|
|
@@ -10648,8 +11482,17 @@ var CommandBuilder = class {
|
|
|
10648
11482
|
}
|
|
10649
11483
|
};
|
|
10650
11484
|
|
|
11485
|
+
// src/types/command.ts
|
|
11486
|
+
function defineFlags(schema) {
|
|
11487
|
+
return Object.entries(schema).map(([name, options]) => ({
|
|
11488
|
+
name,
|
|
11489
|
+
options
|
|
11490
|
+
}));
|
|
11491
|
+
}
|
|
11492
|
+
|
|
10651
11493
|
export {
|
|
10652
|
-
|
|
11494
|
+
__decorateClass,
|
|
11495
|
+
getConfigMetadata,
|
|
10653
11496
|
findProjectRoot,
|
|
10654
11497
|
getDefaultLanguage,
|
|
10655
11498
|
getEditor,
|
|
@@ -10660,18 +11503,31 @@ export {
|
|
|
10660
11503
|
getArchiveStrategy,
|
|
10661
11504
|
getArchiveAutoCommit,
|
|
10662
11505
|
getArchiveCommitMessage,
|
|
11506
|
+
getIncludeTag,
|
|
11507
|
+
getSupportedLanguages,
|
|
11508
|
+
getSupportedLanguagesString,
|
|
11509
|
+
getLanguageConfig,
|
|
11510
|
+
TIER_COLORS,
|
|
10663
11511
|
getNextTierMinRating,
|
|
10664
11512
|
calculateTierProgress,
|
|
10665
11513
|
getTierName,
|
|
10666
11514
|
getTierShortName,
|
|
10667
11515
|
getTierColor,
|
|
10668
11516
|
getTierImageUrl,
|
|
11517
|
+
parseTimeLimitToMs,
|
|
11518
|
+
getProblemTimeLimitMs,
|
|
10669
11519
|
detectProblemIdFromPath,
|
|
10670
11520
|
getArchiveDirPath,
|
|
10671
11521
|
getSolvingDirPath,
|
|
10672
11522
|
resolveProblemContext,
|
|
10673
11523
|
resolveLanguage,
|
|
10674
11524
|
findSolutionFile,
|
|
11525
|
+
Command,
|
|
11526
|
+
source_default,
|
|
11527
|
+
icons,
|
|
11528
|
+
logger,
|
|
11529
|
+
generateGlobalHelp,
|
|
10675
11530
|
CommandDef,
|
|
10676
|
-
CommandBuilder
|
|
11531
|
+
CommandBuilder,
|
|
11532
|
+
defineFlags
|
|
10677
11533
|
};
|