@team-semicolon/semo-cli 3.0.5 → 3.0.7
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/index.js +99 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -59,7 +59,50 @@ const child_process_1 = require("child_process");
|
|
|
59
59
|
const fs = __importStar(require("fs"));
|
|
60
60
|
const path = __importStar(require("path"));
|
|
61
61
|
const os = __importStar(require("os"));
|
|
62
|
-
const VERSION = "3.0.
|
|
62
|
+
const VERSION = "3.0.7";
|
|
63
|
+
const PACKAGE_NAME = "@team-semicolon/semo-cli";
|
|
64
|
+
// === 버전 비교 유틸리티 ===
|
|
65
|
+
/**
|
|
66
|
+
* npm registry에서 최신 버전을 가져옴
|
|
67
|
+
*/
|
|
68
|
+
async function getLatestVersion() {
|
|
69
|
+
try {
|
|
70
|
+
const result = (0, child_process_1.execSync)(`npm view ${PACKAGE_NAME} version`, {
|
|
71
|
+
stdio: "pipe",
|
|
72
|
+
encoding: "utf-8",
|
|
73
|
+
timeout: 10000, // 10초 타임아웃
|
|
74
|
+
});
|
|
75
|
+
return result.trim();
|
|
76
|
+
}
|
|
77
|
+
catch {
|
|
78
|
+
return null;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* 시맨틱 버전 비교 (v1이 v2보다 낮으면 true)
|
|
83
|
+
* 예: isVersionLower("1.0.0", "1.0.1") => true
|
|
84
|
+
*/
|
|
85
|
+
function isVersionLower(current, latest) {
|
|
86
|
+
// alpha, beta 등 pre-release 태그 제거 후 비교
|
|
87
|
+
const cleanVersion = (v) => v.replace(/-.*$/, "");
|
|
88
|
+
const currentParts = cleanVersion(current).split(".").map(Number);
|
|
89
|
+
const latestParts = cleanVersion(latest).split(".").map(Number);
|
|
90
|
+
for (let i = 0; i < 3; i++) {
|
|
91
|
+
const c = currentParts[i] || 0;
|
|
92
|
+
const l = latestParts[i] || 0;
|
|
93
|
+
if (c < l)
|
|
94
|
+
return true;
|
|
95
|
+
if (c > l)
|
|
96
|
+
return false;
|
|
97
|
+
}
|
|
98
|
+
// 숫자가 같으면 pre-release 여부 확인
|
|
99
|
+
// current가 pre-release이고 latest가 정식이면 낮은 버전
|
|
100
|
+
const currentIsPrerelease = current.includes("-");
|
|
101
|
+
const latestIsPrerelease = latest.includes("-");
|
|
102
|
+
if (currentIsPrerelease && !latestIsPrerelease)
|
|
103
|
+
return true;
|
|
104
|
+
return false;
|
|
105
|
+
}
|
|
63
106
|
// === Windows 지원 유틸리티 ===
|
|
64
107
|
const isWindows = os.platform() === "win32";
|
|
65
108
|
/**
|
|
@@ -201,7 +244,48 @@ const program = new commander_1.Command();
|
|
|
201
244
|
program
|
|
202
245
|
.name("semo")
|
|
203
246
|
.description("SEMO CLI - AI Agent Orchestration Framework")
|
|
204
|
-
.version(VERSION);
|
|
247
|
+
.version(VERSION, "-V, --version-simple", "버전 번호만 출력");
|
|
248
|
+
// === version 명령어 (상세 버전 정보) ===
|
|
249
|
+
program
|
|
250
|
+
.command("version")
|
|
251
|
+
.description("버전 정보 및 업데이트 확인")
|
|
252
|
+
.action(async () => {
|
|
253
|
+
await showVersionInfo();
|
|
254
|
+
});
|
|
255
|
+
/**
|
|
256
|
+
* 상세 버전 정보 표시 및 업데이트 확인
|
|
257
|
+
*/
|
|
258
|
+
async function showVersionInfo() {
|
|
259
|
+
console.log(chalk_1.default.cyan.bold("\n📦 SEMO CLI 버전 정보\n"));
|
|
260
|
+
// 현재 버전 표시
|
|
261
|
+
console.log(chalk_1.default.white(` 현재 버전: ${chalk_1.default.green.bold(VERSION)}`));
|
|
262
|
+
// 최신 버전 확인
|
|
263
|
+
const spinner = (0, ora_1.default)(" 최신 버전 확인 중...").start();
|
|
264
|
+
const latestVersion = await getLatestVersion();
|
|
265
|
+
if (latestVersion === null) {
|
|
266
|
+
spinner.warn(" 최신 버전 확인 실패 (네트워크 오류)");
|
|
267
|
+
console.log(chalk_1.default.gray(" npm registry에 접속할 수 없습니다.\n"));
|
|
268
|
+
return;
|
|
269
|
+
}
|
|
270
|
+
spinner.stop();
|
|
271
|
+
console.log(chalk_1.default.white(` 최신 버전: ${chalk_1.default.blue.bold(latestVersion)}`));
|
|
272
|
+
// 버전 비교 및 업데이트 권유
|
|
273
|
+
if (isVersionLower(VERSION, latestVersion)) {
|
|
274
|
+
console.log();
|
|
275
|
+
console.log(chalk_1.default.yellow.bold(" ⚠️ 새로운 버전이 있습니다!"));
|
|
276
|
+
console.log();
|
|
277
|
+
console.log(chalk_1.default.white(" 업데이트 방법:"));
|
|
278
|
+
console.log(chalk_1.default.cyan(` npm update -g ${PACKAGE_NAME}`));
|
|
279
|
+
console.log();
|
|
280
|
+
console.log(chalk_1.default.gray(" 또는 프로젝트 내 SEMO 업데이트:"));
|
|
281
|
+
console.log(chalk_1.default.gray(" semo update"));
|
|
282
|
+
}
|
|
283
|
+
else {
|
|
284
|
+
console.log();
|
|
285
|
+
console.log(chalk_1.default.green(" ✓ 최신 버전을 사용 중입니다."));
|
|
286
|
+
}
|
|
287
|
+
console.log();
|
|
288
|
+
}
|
|
205
289
|
// === 유틸리티 함수들 ===
|
|
206
290
|
async function confirmOverwrite(itemName, itemPath) {
|
|
207
291
|
if (!fs.existsSync(itemPath)) {
|
|
@@ -436,6 +520,8 @@ async function downloadExtensions(cwd, packages, force) {
|
|
|
436
520
|
continue;
|
|
437
521
|
}
|
|
438
522
|
removeRecursive(destPath);
|
|
523
|
+
// 상위 디렉토리 생성 (biz/discovery -> biz/ 먼저 생성)
|
|
524
|
+
fs.mkdirSync(path.dirname(destPath), { recursive: true });
|
|
439
525
|
copyRecursive(srcPath, destPath);
|
|
440
526
|
}
|
|
441
527
|
}
|
|
@@ -1567,4 +1653,14 @@ program
|
|
|
1567
1653
|
}
|
|
1568
1654
|
console.log(chalk_1.default.green.bold("\n✅ SEMO 업데이트 완료!\n"));
|
|
1569
1655
|
});
|
|
1570
|
-
program.parse
|
|
1656
|
+
// === -v 옵션 처리 (program.parse 전에 직접 처리) ===
|
|
1657
|
+
async function main() {
|
|
1658
|
+
const args = process.argv.slice(2);
|
|
1659
|
+
// semo -v 또는 semo --version-info 처리
|
|
1660
|
+
if (args.length === 1 && (args[0] === "-v" || args[0] === "--version-info")) {
|
|
1661
|
+
await showVersionInfo();
|
|
1662
|
+
process.exit(0);
|
|
1663
|
+
}
|
|
1664
|
+
program.parse();
|
|
1665
|
+
}
|
|
1666
|
+
main();
|