@clazic/urban 0.2.11 → 0.2.13

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clazic/urban",
3
- "version": "0.2.11",
3
+ "version": "0.2.13",
4
4
  "description": "도시계획연구 보고서 자동 수집·지식베이스 데몬",
5
5
  "type": "module",
6
6
  "engines": {
package/src/cli.js CHANGED
@@ -51,20 +51,19 @@ async function run() {
51
51
  break;
52
52
  }
53
53
  case 'start': {
54
- let result = await startDaemon();
55
- if (!result.ok) {
56
- // 태스크 미등록 자동 install 후 재시도
54
+ // 등록 여부 먼저 확인 — 미등록이면 install 후 시작
55
+ const statusCheck = await statusDaemon();
56
+ if (statusCheck.message === '데몬 미등록') {
57
57
  console.log('데몬이 등록되지 않았습니다. 자동 등록을 시도합니다...');
58
58
  const installResult = await installDaemon();
59
- if (installResult.ok) {
60
- console.log(`✅ ${installResult.message}`);
61
- result = await startDaemon();
62
- } else {
59
+ if (!installResult.ok) {
63
60
  console.log(`❌ 등록 실패: ${installResult.message}`);
64
- console.log(" 수동 등록: urban install && urban start");
61
+ console.log(' 수동 등록: urban install && urban start');
65
62
  break;
66
63
  }
64
+ console.log(`✅ ${installResult.message}`);
67
65
  }
66
+ const result = await startDaemon();
68
67
  console.log(result.ok ? `✅ ${result.message}` : `❌ 데몬 시작 실패: ${result.message}`);
69
68
  break;
70
69
  }
@@ -312,8 +312,13 @@ export async function statusDaemon() {
312
312
  }
313
313
  } else if (isWindows) {
314
314
  try {
315
- const result = execSync(`powershell -NoProfile -Command "Get-ScheduledTask -TaskName 'Urban' | Select-Object -ExpandProperty State"`, { encoding: 'utf8', shell: true, stdio: 'pipe' });
315
+ // -ErrorAction SilentlyContinue: 미등록 문자열 반환 (throw 없음)
316
+ const result = execSync(
317
+ `powershell -NoProfile -Command "(Get-ScheduledTask -TaskName 'Urban' -ErrorAction SilentlyContinue)?.State"`,
318
+ { encoding: 'utf8', shell: true, stdio: 'pipe' }
319
+ );
316
320
  const state = result.trim();
321
+ if (!state) return { running: false, message: '데몬 미등록' };
317
322
  const running = state === 'Running';
318
323
  return { running, message: `상태: ${state}` };
319
324
  } catch {