@team-semicolon/semo-cli 4.0.5 → 4.1.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/index.js +139 -22
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -772,6 +772,7 @@ program
|
|
|
772
772
|
.option("--no-gitignore", ".gitignore 수정 생략")
|
|
773
773
|
.option("--migrate", "레거시 환경 강제 마이그레이션")
|
|
774
774
|
.option("--seed-skills", "semo-system/semo-skills/ → semo.skills DB 초기 시딩")
|
|
775
|
+
.option("--credentials-gist <gistId>", "Private GitHub Gist에서 팀 DB 접속정보 자동 가져오기")
|
|
775
776
|
.action(async (options) => {
|
|
776
777
|
console.log(chalk_1.default.cyan.bold("\n🚀 SEMO 설치 시작\n"));
|
|
777
778
|
console.log(chalk_1.default.gray("Gemini 하이브리드 전략: White Box + Black Box\n"));
|
|
@@ -822,8 +823,8 @@ program
|
|
|
822
823
|
}
|
|
823
824
|
// 7. Hooks 설치 (대화 로깅)
|
|
824
825
|
await setupHooks(cwd, false);
|
|
825
|
-
// 7.5. ~/.semo.env
|
|
826
|
-
|
|
826
|
+
// 7.5. ~/.semo.env DB 접속 설정 (자동 감지 → Gist → 프롬프트)
|
|
827
|
+
await setupSemoEnv(options.credentialsGist);
|
|
827
828
|
// 8. CLAUDE.md 생성
|
|
828
829
|
await setupClaudeMd(cwd, [], options.force);
|
|
829
830
|
// 9. 설치 검증
|
|
@@ -849,11 +850,11 @@ program
|
|
|
849
850
|
console.log(chalk_1.default.gray(" ✓ semo-agents (14개 페르소나 Agent)"));
|
|
850
851
|
console.log(chalk_1.default.gray(" ✓ semo-scripts (자동화 스크립트)"));
|
|
851
852
|
console.log(chalk_1.default.cyan("\n다음 단계:"));
|
|
852
|
-
console.log(chalk_1.default.gray(" 1.
|
|
853
|
-
console.log(chalk_1.default.gray("
|
|
854
|
-
console.log(chalk_1.default.gray("
|
|
855
|
-
console.log(
|
|
856
|
-
console.log(chalk_1.default.gray("
|
|
853
|
+
console.log(chalk_1.default.gray(" 1. Claude Code에서 프로젝트 열기 (SessionStart 훅이 자동 sync)"));
|
|
854
|
+
console.log(chalk_1.default.gray(" 2. 자연어로 요청하기 (예: \"댓글 기능 구현해줘\")"));
|
|
855
|
+
console.log(chalk_1.default.gray(" 3. /SEMO:help로 도움말 확인"));
|
|
856
|
+
console.log();
|
|
857
|
+
console.log(chalk_1.default.gray(" DB 접속정보 변경: nano ~/.semo.env"));
|
|
857
858
|
console.log();
|
|
858
859
|
});
|
|
859
860
|
// === Standard 설치 (DB 기반) ===
|
|
@@ -1385,30 +1386,93 @@ const BASE_MCP_SERVERS = [
|
|
|
1385
1386
|
args: ["-y", "@modelcontextprotocol/server-github"],
|
|
1386
1387
|
},
|
|
1387
1388
|
];
|
|
1388
|
-
// === ~/.semo.env
|
|
1389
|
-
function
|
|
1389
|
+
// === ~/.semo.env 설정 (자동 감지 → Gist → 프롬프트) ===
|
|
1390
|
+
function writeSemoEnvFile(dbUrl, slackWebhook = "") {
|
|
1390
1391
|
const envFile = path.join(os.homedir(), ".semo.env");
|
|
1391
|
-
|
|
1392
|
-
return; // 이미 존재하면 건너뜀
|
|
1393
|
-
const template = `# SEMO 환경변수 — 모든 컨텍스트에서 자동 로드됨
|
|
1392
|
+
const content = `# SEMO 환경변수 — 모든 컨텍스트에서 자동 로드됨
|
|
1394
1393
|
# (Claude Code 앱, OpenClaw LaunchAgent, cron 등 비인터랙티브 환경 포함)
|
|
1395
|
-
#
|
|
1396
|
-
# 팀 Core DB 접속 정보를 여기에 입력하세요.
|
|
1397
|
-
# 설정 후 Claude Code 세션을 재시작하면 자동으로 context sync가 동작합니다.
|
|
1398
1394
|
|
|
1399
|
-
DATABASE_URL=''
|
|
1395
|
+
DATABASE_URL='${dbUrl}'
|
|
1400
1396
|
|
|
1401
1397
|
# Slack 알림 Webhook (선택 — bot-ops 채널 dead-letter 감지용)
|
|
1402
|
-
SLACK_WEBHOOK=''
|
|
1398
|
+
SLACK_WEBHOOK='${slackWebhook}'
|
|
1403
1399
|
`;
|
|
1400
|
+
fs.writeFileSync(envFile, content, { mode: 0o600 });
|
|
1401
|
+
}
|
|
1402
|
+
function readSemoEnvDbUrl() {
|
|
1403
|
+
const envFile = path.join(os.homedir(), ".semo.env");
|
|
1404
|
+
if (!fs.existsSync(envFile))
|
|
1405
|
+
return null;
|
|
1406
|
+
const content = fs.readFileSync(envFile, "utf-8");
|
|
1407
|
+
const match = content.match(/^DATABASE_URL='([^']+)'/m) || content.match(/^DATABASE_URL="([^"]+)"/m);
|
|
1408
|
+
return match ? match[1] : null;
|
|
1409
|
+
}
|
|
1410
|
+
function fetchDbUrlFromGist(gistId) {
|
|
1404
1411
|
try {
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1412
|
+
const raw = (0, child_process_1.execSync)(`gh gist view ${gistId} --raw`, {
|
|
1413
|
+
encoding: "utf-8",
|
|
1414
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
1415
|
+
timeout: 8000,
|
|
1416
|
+
});
|
|
1417
|
+
// Gist 파일 형식: DATABASE_URL=<url> 또는 단순 URL
|
|
1418
|
+
const match = raw.match(/DATABASE_URL=['"]?([^'"\s]+)['"]?/) || raw.match(/^(postgres(?:ql)?:\/\/[^\s]+)/m);
|
|
1419
|
+
return match ? match[1].trim() : null;
|
|
1409
1420
|
}
|
|
1410
1421
|
catch {
|
|
1411
|
-
|
|
1422
|
+
return null;
|
|
1423
|
+
}
|
|
1424
|
+
}
|
|
1425
|
+
async function setupSemoEnv(credentialsGist) {
|
|
1426
|
+
const envFile = path.join(os.homedir(), ".semo.env");
|
|
1427
|
+
console.log(chalk_1.default.cyan("\n🔑 DB 접속 설정"));
|
|
1428
|
+
// 1. 이미 env var로 설정됨
|
|
1429
|
+
if (process.env.DATABASE_URL) {
|
|
1430
|
+
console.log(chalk_1.default.green(" ✅ DATABASE_URL (환경변수)"));
|
|
1431
|
+
if (!readSemoEnvDbUrl()) {
|
|
1432
|
+
writeSemoEnvFile(process.env.DATABASE_URL);
|
|
1433
|
+
console.log(chalk_1.default.gray(` → ~/.semo.env 에 저장됨 (비인터랙티브 환경용)`));
|
|
1434
|
+
}
|
|
1435
|
+
return;
|
|
1436
|
+
}
|
|
1437
|
+
// 2. ~/.semo.env 에 이미 있음
|
|
1438
|
+
const existing = readSemoEnvDbUrl();
|
|
1439
|
+
if (existing) {
|
|
1440
|
+
console.log(chalk_1.default.green(" ✅ DATABASE_URL (~/.semo.env)"));
|
|
1441
|
+
return;
|
|
1442
|
+
}
|
|
1443
|
+
// 3. Private GitHub Gist 자동 fetch
|
|
1444
|
+
const gistId = credentialsGist || process.env.SEMO_CREDENTIALS_GIST;
|
|
1445
|
+
if (gistId) {
|
|
1446
|
+
console.log(chalk_1.default.gray(" GitHub Gist에서 팀 접속정보 가져오는 중..."));
|
|
1447
|
+
const url = fetchDbUrlFromGist(gistId);
|
|
1448
|
+
if (url) {
|
|
1449
|
+
writeSemoEnvFile(url);
|
|
1450
|
+
console.log(chalk_1.default.green(` ✅ Gist (${gistId.slice(0, 8)}...)에서 DATABASE_URL 설정됨`));
|
|
1451
|
+
return;
|
|
1452
|
+
}
|
|
1453
|
+
console.log(chalk_1.default.yellow(" ⚠️ Gist fetch 실패 — 수동 입력으로 전환"));
|
|
1454
|
+
}
|
|
1455
|
+
// 4. 인터랙티브 프롬프트
|
|
1456
|
+
console.log(chalk_1.default.gray(" 팀 Core DB URL을 붙여넣으세요 (나중에 ~/.semo.env에서 수정 가능)"));
|
|
1457
|
+
const { dbUrl } = await inquirer_1.default.prompt([
|
|
1458
|
+
{
|
|
1459
|
+
type: "password",
|
|
1460
|
+
name: "dbUrl",
|
|
1461
|
+
message: "DATABASE_URL:",
|
|
1462
|
+
mask: "*",
|
|
1463
|
+
},
|
|
1464
|
+
]);
|
|
1465
|
+
if (dbUrl && dbUrl.trim()) {
|
|
1466
|
+
writeSemoEnvFile(dbUrl.trim());
|
|
1467
|
+
console.log(chalk_1.default.green(" ✅ ~/.semo.env 저장됨 (권한: 600)"));
|
|
1468
|
+
console.log(chalk_1.default.gray(` 파일: ${envFile}`));
|
|
1469
|
+
}
|
|
1470
|
+
else {
|
|
1471
|
+
// 빈 템플릿 생성
|
|
1472
|
+
if (!fs.existsSync(envFile)) {
|
|
1473
|
+
writeSemoEnvFile("");
|
|
1474
|
+
}
|
|
1475
|
+
console.log(chalk_1.default.yellow(" ⚠️ 건너뜀 — ~/.semo.env에서 DATABASE_URL을 직접 입력하세요"));
|
|
1412
1476
|
}
|
|
1413
1477
|
}
|
|
1414
1478
|
// === Claude MCP 서버 존재 여부 확인 ===
|
|
@@ -2309,6 +2373,59 @@ program
|
|
|
2309
2373
|
console.log(chalk_1.default.cyan("\n새 환경 설치를 위해 'semo init'을 실행하세요.\n"));
|
|
2310
2374
|
}
|
|
2311
2375
|
});
|
|
2376
|
+
// === config 명령어 (설치 후 설정 변경) ===
|
|
2377
|
+
const configCmd = program.command("config").description("SEMO 설정 관리");
|
|
2378
|
+
configCmd
|
|
2379
|
+
.command("db")
|
|
2380
|
+
.description("팀 Core DB 접속정보 설정 (DATABASE_URL → ~/.semo.env)")
|
|
2381
|
+
.option("--credentials-gist <gistId>", "Private GitHub Gist에서 자동 가져오기")
|
|
2382
|
+
.action(async (options) => {
|
|
2383
|
+
console.log(chalk_1.default.cyan.bold("\n🔑 DB 접속정보 설정\n"));
|
|
2384
|
+
// 기존 값 확인
|
|
2385
|
+
const existing = readSemoEnvDbUrl();
|
|
2386
|
+
if (existing) {
|
|
2387
|
+
const { overwrite } = await inquirer_1.default.prompt([
|
|
2388
|
+
{
|
|
2389
|
+
type: "confirm",
|
|
2390
|
+
name: "overwrite",
|
|
2391
|
+
message: `기존 DATABASE_URL이 있습니다. 덮어쓰시겠습니까?`,
|
|
2392
|
+
default: false,
|
|
2393
|
+
},
|
|
2394
|
+
]);
|
|
2395
|
+
if (!overwrite) {
|
|
2396
|
+
console.log(chalk_1.default.gray("취소됨"));
|
|
2397
|
+
return;
|
|
2398
|
+
}
|
|
2399
|
+
}
|
|
2400
|
+
// Gist 또는 프롬프트로 가져오기
|
|
2401
|
+
const gistId = options.credentialsGist || process.env.SEMO_CREDENTIALS_GIST;
|
|
2402
|
+
if (gistId) {
|
|
2403
|
+
console.log(chalk_1.default.gray("GitHub Gist에서 접속정보 가져오는 중..."));
|
|
2404
|
+
const url = fetchDbUrlFromGist(gistId);
|
|
2405
|
+
if (url) {
|
|
2406
|
+
writeSemoEnvFile(url);
|
|
2407
|
+
console.log(chalk_1.default.green("✅ ~/.semo.env 업데이트 완료"));
|
|
2408
|
+
return;
|
|
2409
|
+
}
|
|
2410
|
+
console.log(chalk_1.default.yellow("⚠️ Gist fetch 실패 — 수동 입력"));
|
|
2411
|
+
}
|
|
2412
|
+
const { dbUrl } = await inquirer_1.default.prompt([
|
|
2413
|
+
{
|
|
2414
|
+
type: "password",
|
|
2415
|
+
name: "dbUrl",
|
|
2416
|
+
message: "DATABASE_URL:",
|
|
2417
|
+
mask: "*",
|
|
2418
|
+
},
|
|
2419
|
+
]);
|
|
2420
|
+
if (dbUrl && dbUrl.trim()) {
|
|
2421
|
+
writeSemoEnvFile(dbUrl.trim());
|
|
2422
|
+
console.log(chalk_1.default.green("✅ ~/.semo.env 저장됨 (권한: 600)"));
|
|
2423
|
+
console.log(chalk_1.default.gray(" 다음 Claude Code 세션부터 자동으로 적용됩니다."));
|
|
2424
|
+
}
|
|
2425
|
+
else {
|
|
2426
|
+
console.log(chalk_1.default.yellow("취소됨"));
|
|
2427
|
+
}
|
|
2428
|
+
});
|
|
2312
2429
|
// === doctor 명령어 (설치 상태 진단) ===
|
|
2313
2430
|
program
|
|
2314
2431
|
.command("doctor")
|