@team-semicolon/semo-cli 1.0.0 → 1.2.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.
Files changed (2) hide show
  1. package/dist/index.js +46 -8
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -53,10 +53,26 @@ Object.defineProperty(exports, "__esModule", { value: true });
53
53
  const commander_1 = require("commander");
54
54
  const chalk_1 = __importDefault(require("chalk"));
55
55
  const ora_1 = __importDefault(require("ora"));
56
+ const inquirer_1 = __importDefault(require("inquirer"));
56
57
  const child_process_1 = require("child_process");
57
58
  const fs = __importStar(require("fs"));
58
59
  const path = __importStar(require("path"));
59
- const VERSION = "1.0.0";
60
+ const VERSION = "1.2.0";
61
+ // === 유틸리티: 덮어쓰기 확인 ===
62
+ async function confirmOverwrite(itemName, itemPath) {
63
+ if (!fs.existsSync(itemPath)) {
64
+ return true; // 파일이 없으면 진행
65
+ }
66
+ const { shouldOverwrite } = await inquirer_1.default.prompt([
67
+ {
68
+ type: "confirm",
69
+ name: "shouldOverwrite",
70
+ message: chalk_1.default.yellow(`${itemName} 이미 존재합니다. SEMO 기준으로 덮어쓰시겠습니까?`),
71
+ default: false,
72
+ },
73
+ ]);
74
+ return shouldOverwrite;
75
+ }
60
76
  const SEMO_REPO = "https://github.com/semicolon-devteam/semo.git";
61
77
  const program = new commander_1.Command();
62
78
  program
@@ -113,10 +129,16 @@ async function setupWhiteBox(cwd, force) {
113
129
  const semoSystemDir = path.join(cwd, "semo-system");
114
130
  console.log(chalk_1.default.cyan("\n📚 White Box 설정 (Git Subtree)"));
115
131
  console.log(chalk_1.default.gray(" 에이전트가 읽고 학습할 지식 베이스\n"));
116
- // semo-system 디렉토리 확인
132
+ // semo-system 디렉토리 확인 - force가 아니면 사용자에게 확인
117
133
  if (fs.existsSync(semoSystemDir) && !force) {
118
- console.log(chalk_1.default.yellow("semo-system/ 이미 존재. --force로 덮어쓰기 가능"));
119
- return;
134
+ const shouldOverwrite = await confirmOverwrite("semo-system/", semoSystemDir);
135
+ if (!shouldOverwrite) {
136
+ console.log(chalk_1.default.gray(" → semo-system/ 건너뜀"));
137
+ return;
138
+ }
139
+ // 기존 디렉토리 삭제
140
+ (0, child_process_1.execSync)(`rm -rf ${semoSystemDir}`, { stdio: "pipe" });
141
+ console.log(chalk_1.default.green(" ✓ 기존 semo-system/ 삭제됨"));
120
142
  }
121
143
  const spinner = (0, ora_1.default)("semo-core, semo-skills 다운로드 중...").start();
122
144
  try {
@@ -155,6 +177,14 @@ async function setupWhiteBox(cwd, force) {
155
177
  fs.symlinkSync("../semo-system/semo-skills", skillsLink);
156
178
  console.log(chalk_1.default.green(" ✓ .claude/skills → semo-system/semo-skills"));
157
179
  }
180
+ // commands 심볼릭 링크 생성
181
+ const commandsDir = path.join(claudeDir, "commands");
182
+ fs.mkdirSync(commandsDir, { recursive: true });
183
+ const semoCommandsLink = path.join(commandsDir, "SEMO");
184
+ if (!fs.existsSync(semoCommandsLink)) {
185
+ fs.symlinkSync("../../semo-system/semo-core/commands/SEMO", semoCommandsLink);
186
+ console.log(chalk_1.default.green(" ✓ .claude/commands/SEMO → semo-system/semo-core/commands/SEMO"));
187
+ }
158
188
  }
159
189
  catch (error) {
160
190
  spinner.fail("White Box 설정 실패");
@@ -166,9 +196,13 @@ async function setupBlackBox(cwd, force) {
166
196
  console.log(chalk_1.default.cyan("\n🔧 Black Box 설정 (MCP Server)"));
167
197
  console.log(chalk_1.default.gray(" 토큰이 격리된 외부 연동 도구\n"));
168
198
  const settingsPath = path.join(cwd, ".claude", "settings.json");
199
+ // 기존 설정 파일 확인 - force가 아니면 사용자에게 확인
169
200
  if (fs.existsSync(settingsPath) && !force) {
170
- console.log(chalk_1.default.yellow(".claude/settings.json 이미 존재. --force로 덮어쓰기 가능"));
171
- return;
201
+ const shouldOverwrite = await confirmOverwrite(".claude/settings.json", settingsPath);
202
+ if (!shouldOverwrite) {
203
+ console.log(chalk_1.default.gray(" → settings.json 건너뜀"));
204
+ return;
205
+ }
172
206
  }
173
207
  const settings = {
174
208
  mcpServers: {
@@ -289,9 +323,13 @@ _SEMO 기본 규칙의 예외 사항을 여기에 추가하세요._
289
323
  async function setupClaudeMd(cwd, force) {
290
324
  console.log(chalk_1.default.cyan("\n📄 CLAUDE.md 설정"));
291
325
  const claudeMdPath = path.join(cwd, ".claude", "CLAUDE.md");
326
+ // 기존 CLAUDE.md 확인 - force가 아니면 사용자에게 확인
292
327
  if (fs.existsSync(claudeMdPath) && !force) {
293
- console.log(chalk_1.default.yellow("CLAUDE.md 이미 존재. --force로 덮어쓰기 가능"));
294
- return;
328
+ const shouldOverwrite = await confirmOverwrite("CLAUDE.md", claudeMdPath);
329
+ if (!shouldOverwrite) {
330
+ console.log(chalk_1.default.gray(" → CLAUDE.md 건너뜀"));
331
+ return;
332
+ }
295
333
  }
296
334
  const claudeMdContent = `# SEMO Project Configuration
297
335
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@team-semicolon/semo-cli",
3
- "version": "1.0.0",
3
+ "version": "1.2.0",
4
4
  "description": "SEMO CLI - AI Agent Orchestration Framework Installer",
5
5
  "main": "dist/index.js",
6
6
  "bin": {