projectops 4.104.6 → 4.104.8

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 (85) hide show
  1. package/README.md +1 -1
  2. package/bin/projectops.js +4 -4
  3. package/package.json +1 -1
  4. package/src/cli/args.js +43 -43
  5. package/src/cli/errors.js +8 -8
  6. package/src/cli/help.js +4 -4
  7. package/src/commands/doctor.js +39 -39
  8. package/src/commands/full.js +29 -29
  9. package/src/commands/interactive.js +86 -86
  10. package/src/commands/issues.js +5 -5
  11. package/src/commands/skills.js +13 -13
  12. package/src/commands/version.js +8 -8
  13. package/src/commands/workflows.js +23 -22
  14. package/src/context.js +24 -24
  15. package/src/core/agent-guide.js +5 -5
  16. package/src/core/assets.js +11 -11
  17. package/src/core/baseline.js +24 -24
  18. package/src/core/branch-sub.js +23 -23
  19. package/src/core/breaking-check.js +21 -21
  20. package/src/core/breaking.js +6 -6
  21. package/src/core/ci-minutes-sub.js +13 -13
  22. package/src/core/constants.js +17 -17
  23. package/src/core/copy/coderabbit.js +10 -10
  24. package/src/core/copy/gitignore.js +9 -9
  25. package/src/core/copy/readme.js +7 -7
  26. package/src/core/copy/simple.js +35 -35
  27. package/src/core/copy/util.js +9 -9
  28. package/src/core/copy/workflows.js +99 -99
  29. package/src/core/detect-fs.js +21 -21
  30. package/src/core/detect.js +12 -12
  31. package/src/core/development-branch.js +11 -11
  32. package/src/core/exclusions.js +12 -12
  33. package/src/core/fsutil.js +9 -9
  34. package/src/core/git-branch.js +11 -11
  35. package/src/core/ide/adapter.js +23 -23
  36. package/src/core/ide/adapters/claude.js +12 -12
  37. package/src/core/ide/adapters/codex.js +4 -4
  38. package/src/core/ide/adapters/copilot.js +12 -12
  39. package/src/core/ide/adapters/cursor.js +7 -7
  40. package/src/core/ide/adapters/gemini.js +5 -5
  41. package/src/core/ide/adapters/pi-common.js +12 -12
  42. package/src/core/ide/adapters/pi-harness.js +7 -7
  43. package/src/core/ide/adapters/pi.js +3 -3
  44. package/src/core/ide/home-skills.js +6 -6
  45. package/src/core/ide/legacy.js +8 -8
  46. package/src/core/ide/registry.js +6 -6
  47. package/src/core/ide/runner.js +15 -15
  48. package/src/core/ide/skills-copy.js +34 -34
  49. package/src/core/ide/stable-entry.js +11 -11
  50. package/src/core/ide/util.js +4 -4
  51. package/src/core/incoming.js +13 -13
  52. package/src/core/label-style.js +12 -12
  53. package/src/core/migration-guide.js +19 -19
  54. package/src/core/migrations/index.js +16 -16
  55. package/src/core/migrations/registry.js +39 -39
  56. package/src/core/migrations/rules/legacy-dirs.js +6 -6
  57. package/src/core/migrations/rules/obsolete-workflows.js +4 -4
  58. package/src/core/migrations/rules/root-files.js +3 -3
  59. package/src/core/migrations/rules/settings-extractors.js +8 -8
  60. package/src/core/options-ask.js +104 -104
  61. package/src/core/options-schema.js +23 -23
  62. package/src/core/orphan-workflows.js +14 -14
  63. package/src/core/paths-resolve.js +54 -54
  64. package/src/core/paths.js +2 -2
  65. package/src/core/placeholder-triggers.js +10 -10
  66. package/src/core/repo-language.js +10 -10
  67. package/src/core/resolve-options.js +30 -30
  68. package/src/core/run-trace.js +54 -54
  69. package/src/core/store-locales-hint.js +13 -13
  70. package/src/core/verify.js +27 -27
  71. package/src/core/version-yml.js +117 -116
  72. package/src/core/wizard-env.js +42 -42
  73. package/src/core/wizard-labels.js +31 -31
  74. package/src/core/workflow-groups.js +14 -14
  75. package/src/i18n/core.en.js +1 -1
  76. package/src/i18n/doctor.en.js +1 -1
  77. package/src/i18n/ide.en.js +1 -1
  78. package/src/i18n/migrate.en.js +1 -1
  79. package/src/i18n/options.en.js +1 -1
  80. package/src/index.js +60 -60
  81. package/src/ui/ansi.js +5 -5
  82. package/src/ui/env-plan.js +44 -44
  83. package/src/ui/prompts.js +21 -21
  84. package/src/ui/readline-engine.js +38 -38
  85. package/src/ui/skills-prompts.js +4 -4
@@ -1,4 +1,4 @@
1
- // PI 공용 경로·상태 로직 (pi 어댑터와 pi-harness 어댑터가 공유).
1
+ // Shared PI paths and status logic (shared by the pi and pi-harness adapters).
2
2
  import { join } from "node:path";
3
3
  import { existsSync, readFileSync, writeFileSync, rmSync } from "node:fs";
4
4
  import { t } from "../../../i18n/index.js";
@@ -6,15 +6,15 @@ import { TEMPLATE_REPO_OWNER, TEMPLATE_REPO_WEB_URL } from "../../paths.js";
6
6
 
7
7
  export const PI_PACKAGE_URL = TEMPLATE_REPO_WEB_URL;
8
8
 
9
- // 'pi list' 출력에 우리 레포가 잡히면 설치됨. (구 레포명·프로젝트명 모두 허용)
9
+ // Installed if 'pi list' output shows our repo. (Both old repo names and the project name are accepted)
10
10
  export function piInstalled(io) {
11
11
  if (!io.which("pi")) return false;
12
- const r = io.run("pi", ["list"]); // pi는 일부 출력을 stderr로 보냄 → 둘 다 검사
12
+ const r = io.run("pi", ["list"]); // pi sends some output to stderr → check both
13
13
  const out = (r.stdout || "") + (r.stderr || "");
14
14
  return /SUH-DEVOPS-TEMPLATE|projectops/i.test(out);
15
15
  }
16
16
 
17
- // pi 클론 경로(harness loader가 사는 곳). 레포명 변경 전 구 경로 하위호환.
17
+ // pi clone path (where the harness loader lives). Backward compatible with the old path from before the repo rename.
18
18
  export function piCloneDir(io) {
19
19
  const base = join(io.home(), ".pi/agent/git/github.com", TEMPLATE_REPO_OWNER);
20
20
  const newDir = join(base, "projectops");
@@ -25,7 +25,7 @@ export function piCloneDir(io) {
25
25
  export function harnessLoaderPath(io) { return join(piCloneDir(io), "harness/harness-loader.ts"); }
26
26
  export function piSettingsPath(io) { return join(io.home(), ".pi/agent/settings.json"); }
27
27
 
28
- // settings.json의 extensions 배열에 loader가 등록돼 있는가.
28
+ // Is the loader registered in the extensions array of settings.json?
29
29
  export function harnessEnabled(io) {
30
30
  const settings = piSettingsPath(io), loader = harnessLoaderPath(io);
31
31
  if (!existsSync(settings)) return false;
@@ -35,13 +35,13 @@ export function harnessEnabled(io) {
35
35
  } catch { return false; }
36
36
  }
37
37
 
38
- // extensions에 loader 추가(중복 방지). {ok, reason}.
38
+ // Add the loader to extensions (no duplicates). {ok, reason}.
39
39
  export function harnessAdd(io) {
40
40
  const settings = piSettingsPath(io), loader = harnessLoaderPath(io);
41
41
  if (!existsSync(settings)) return { ok: false, reason: "no-settings" };
42
42
  if (!existsSync(loader)) return { ok: false, reason: "no-loader" };
43
43
  let s;
44
- // 해석 실패 시 덮어쓰지 않음 ({} 로 쓰면 사용자 설정 키가 전부 지워진다)
44
+ // Do not overwrite on a parse failure (writing {} would wipe every user settings key)
45
45
  try { s = JSON.parse(readFileSync(settings, "utf8")); } catch { return { ok: false, reason: "invalid-settings" }; }
46
46
  if (s === null || typeof s !== "object" || Array.isArray(s)) return { ok: false, reason: "invalid-settings" };
47
47
  const exts = (Array.isArray(s.extensions) ? s.extensions : []).filter(Boolean);
@@ -51,7 +51,7 @@ export function harnessAdd(io) {
51
51
  return { ok: true };
52
52
  }
53
53
 
54
- // extensions에서 loader 제거. {ok}.
54
+ // Remove the loader from extensions. {ok}.
55
55
  export function harnessRemove(io) {
56
56
  const settings = piSettingsPath(io), loader = harnessLoaderPath(io);
57
57
  if (!existsSync(settings)) return { ok: true };
@@ -64,8 +64,8 @@ export function harnessRemove(io) {
64
64
  return { ok: true };
65
65
  }
66
66
 
67
- // 신·구 clone 공존 시 옛 SUH-DEVOPS-TEMPLATE clone 제거 + settings.json에서 그 loader 경로 제거.
68
- // 공존일 때만 정리(옛것만 있으면 pi install이 신규를 만들 때까지 그대로 둔다). 실패 무해.
67
+ // When old and new clones coexist, remove the old SUH-DEVOPS-TEMPLATE clone + its loader path from settings.json.
68
+ // Clean up only when both exist (if only the old one exists, leave it until pi install makes the new one). Failure is harmless.
69
69
  export function migratePiLegacy(io) {
70
70
  const base = join(io.home(), ".pi/agent/git/github.com", TEMPLATE_REPO_OWNER);
71
71
  const oldDir = join(base, "SUH-DEVOPS-TEMPLATE");
@@ -80,7 +80,7 @@ export function migratePiLegacy(io) {
80
80
  s.extensions = s.extensions.filter((e) => e && e !== oldLoader);
81
81
  writeFileSync(settings, JSON.stringify(s, null, 2));
82
82
  }
83
- } catch { /* 무시 */ }
83
+ } catch { /* ignore */ }
84
84
  }
85
- try { rmSync(oldDir, { recursive: true, force: true }); io.log(t("ide.pi.legacyClone")); } catch { /* 무시 */ }
85
+ try { rmSync(oldDir, { recursive: true, force: true }); io.log(t("ide.pi.legacyClone")); } catch { /* ignore */ }
86
86
  }
@@ -1,10 +1,10 @@
1
- // PI Persona Harness 어댑터 (켜기·끄기·상태 조회).
2
- // PI skill과 독립 — skill은 그대로 두고 harness 등록(settings.json extensions)만 켜고/끈다.
1
+ // PI Persona Harness adapter (enable, disable, status).
2
+ // Independent of the PI skill — leaves the skill alone and only toggles the harness registration (settings.json extensions).
3
3
  import { existsSync } from "node:fs";
4
4
  import { harnessEnabled, harnessAdd, harnessRemove, harnessLoaderPath, piSettingsPath } from "./pi-common.js";
5
5
  import { t } from "../../../i18n/index.js";
6
6
 
7
- // 이 어댑터는 "설치 가능" 여부가 pi 존재 + loader 파일 존재에 달림.
7
+ // For this adapter, "installable" depends on pi existing + the loader file existing.
8
8
  function available(io) { return !!io.which("pi") && existsSync(harnessLoaderPath(io)); }
9
9
 
10
10
  function detect(io) {
@@ -13,7 +13,7 @@ function detect(io) {
13
13
  return { installed: harnessEnabled(io), version: null, cliMissing: false, note: t(harnessEnabled(io) ? "ide.harness.enabled" : "ide.harness.disabled") };
14
14
  }
15
15
 
16
- // apply = harness 활성화 (skill은 안 건드림).
16
+ // apply = enable the harness (skill untouched).
17
17
  function apply(io) {
18
18
  if (!available(io)) { io.log(t("ide.harness.needPi")); return false; }
19
19
  if (harnessEnabled(io)) { io.log(t("ide.harness.already")); return true; }
@@ -24,7 +24,7 @@ function apply(io) {
24
24
  return false;
25
25
  }
26
26
 
27
- // remove = harness만 해제 (PI skill 보존).
27
+ // remove = disable only the harness (PI skill kept).
28
28
  function remove(io) {
29
29
  if (!harnessEnabled(io)) { io.log(t("ide.harness.removeNone")); return true; }
30
30
  io.log(t("ide.harness.keepSkill"));
@@ -35,11 +35,11 @@ function remove(io) {
35
35
 
36
36
  function manualHint() { return t("ide.harness.manual"); }
37
37
 
38
- // harness 설명 (프롬프트에서 재사용).
38
+ // Harness description (reused in prompts).
39
39
  export const harnessDesc = () => t("ide.harness.desc");
40
40
 
41
41
  export const piHarnessAdapter = {
42
42
  id: "pi-harness", label: "PI Persona Harness", order: 60,
43
- optional: true, // 감지된 경우에만 메뉴 노출 (registry 순회 시 참고)
43
+ optional: true, // Shown in the menu only when detected (consulted when iterating the registry)
44
44
  detect, apply, remove, manualHint,
45
45
  };
@@ -1,5 +1,5 @@
1
- // PI 패키지 어댑터 (설치·제거).
2
- // pi install/update/remove. skill은 복사되지 않고 pi가 startup마다 스캔 → 설치 검증은 'pi list'.
1
+ // PI package adapter (install/remove).
2
+ // pi install/update/remove. Skills are not copied; pi scans them at every startup → install check is 'pi list'.
3
3
  import { PI_PACKAGE_URL, piInstalled, harnessEnabled, harnessRemove, migratePiLegacy } from "./pi-common.js";
4
4
  import { migrateConfigRoot } from "../legacy.js";
5
5
  import { t } from "../../../i18n/index.js";
@@ -36,7 +36,7 @@ function remove(io) {
36
36
  io.run("pi", ["remove", PI_PACKAGE_URL]);
37
37
  if (piInstalled(io)) io.log(t("ide.pi.stillThere"));
38
38
  else io.log(t("ide.pi.removed"));
39
- // package 클론이 사라지면 harness loader 경로가 허공을 가리킴 → 함께 해제
39
+ // If the package clone disappears, the harness loader path points at nothing → disable it too
40
40
  if (harnessEnabled(io)) { io.log(t("ide.pi.harnessAlso")); harnessRemove(io); }
41
41
  return true;
42
42
  }
@@ -1,5 +1,5 @@
1
- // 홈 복사형 IDE(Cursor·Copilot) 설치·제거 흐름 공용: 소스 찾기 > 복사 > 진입점 > 로그
2
- // 메시지는 어댑터별 키 묶음(<messagePrefix>.copying 등)을 쓴다.
1
+ // Shared install/remove flow for home-copy IDEs (Cursor, Copilot): find source > copy > entry points > log
2
+ // Messages use per-adapter key sets (<messagePrefix>.copying, etc.).
3
3
  import { existsSync } from "node:fs";
4
4
  import { join } from "node:path";
5
5
  import { t } from "../../i18n/index.js";
@@ -7,7 +7,7 @@ import { resolveSkillsSrc, resolveScriptsSrc, installHomeSkills, removeOwnedEntr
7
7
  import { refreshStableEntrypoints, projectopsHomeOf } from "./stable-entry.js";
8
8
 
9
9
  /**
10
- * 설치·업데이트: 스킬 소스 확인 > 스킬·공용 파이썬 복사 > 고정 진입점 > 결과 로그
10
+ * Install/update: check skill source > copy skills and shared Python > stable entry points > result log
11
11
  * options: { skillsDest, metaFileName, messagePrefix }
12
12
  */
13
13
  export function applyHomeSkills(io, ctx, { skillsDest, metaFileName, messagePrefix }) {
@@ -20,7 +20,7 @@ export function applyHomeSkills(io, ctx, { skillsDest, metaFileName, messagePref
20
20
  skillsSrc, scriptsSrc, skillsDest, metaFileName, templateVersion: ctx.templateVersion,
21
21
  });
22
22
  for (const name of obsoleteNames) io.log(t("ide.skillsCopy.obsolete", { name }));
23
- // 공용 파이썬이 없으면 스킬 CLI 가 import 에 실패 → 알림만 (문서형 스킬은 동작)
23
+ // Without the shared Python, skill CLIs fail on import → notify only (doc-only skills still work)
24
24
  if (!hasSharedScripts) io.log(t("ide.skillsCopy.noScripts"));
25
25
  io.log(t(`${messagePrefix}.installed`, { dest: skillsDest, version: ctx.templateVersion || "unknown" }));
26
26
  } catch (e) {
@@ -32,7 +32,7 @@ export function applyHomeSkills(io, ctx, { skillsDest, metaFileName, messagePref
32
32
  return true;
33
33
  }
34
34
 
35
- // 진입점 실패는 설치 실패가 아니다 (CLI 첫 실행 때 파이썬이 다시 깐다)
35
+ // An entry point failure is not an install failure (Python reinstalls it on the first CLI run)
36
36
  function installStableEntrypoints(io, skillsSrc, scriptsSrc) {
37
37
  try {
38
38
  const projectopsHome = projectopsHomeOf(io);
@@ -42,7 +42,7 @@ function installStableEntrypoints(io, skillsSrc, scriptsSrc) {
42
42
  } catch { io.log(t("ide.skillsCopy.entrypointFailed")); }
43
43
  }
44
44
 
45
- // 제거: 메타 없으면 건너뜀 > 우리 항목·공용 파이썬만 삭제 (남의 스킬이 남으면 폴더 유지)
45
+ // Remove: skip if no meta > delete only our entries and the shared Python (keep the folder if others' skills remain)
46
46
  export function removeHomeSkills(io, ctx, { skillsDest, metaFileName, messagePrefix }) {
47
47
  if (!existsSync(join(skillsDest, metaFileName))) { io.log(t(`${messagePrefix}.removeNone`)); return true; }
48
48
  try {
@@ -1,18 +1,18 @@
1
- // IDE 어댑터 공용 레거시 유틸 — 버전 판정 + config 루트 이관.
2
- // 리브랜딩(#459) 전 설치본(cassiiopeia/SUH-DEVOPS-TEMPLATE)을 신규(projectops)로 넘길 때 공용.
1
+ // Shared legacy utilities for IDE adapters — version check + config root migration.
2
+ // Shared when moving pre-rebrand (#459) installs (cassiiopeia/SUH-DEVOPS-TEMPLATE) to the new one (projectops).
3
3
  import { join } from "node:path";
4
4
  import { existsSync, readFileSync } from "node:fs";
5
5
  import { copyFileSync } from "../fsutil.js";
6
6
  import { compareCacheName } from "./util.js";
7
7
  import { t } from "../../i18n/index.js";
8
8
 
9
- // version <= maxLegacy 이면 레거시. null/빈문자열은 판정 불가 → false(안전).
9
+ // Legacy if version <= maxLegacy. null/empty string cannot be judged → false (safe).
10
10
  export function isLegacyVersion(version, maxLegacy) {
11
11
  if (!version || !maxLegacy) return false;
12
12
  return compareCacheName(String(version), String(maxLegacy)) <= 0;
13
13
  }
14
14
 
15
- // 파일이 존재하고 JSON 파싱되며 최소 1개 키가 있으면 true.
15
+ // true if the file exists, parses as JSON and has at least 1 key.
16
16
  export function hasNonEmptyJson(path) {
17
17
  if (!path || !existsSync(path)) return false;
18
18
  try {
@@ -21,14 +21,14 @@ export function hasNonEmptyJson(path) {
21
21
  } catch { return false; }
22
22
  }
23
23
 
24
- // config 루트 이관: 타겟(~/.projectops/config/config.json)이 비었을 때만 옛 경로에서 복사.
25
- // 옛 파일은 삭제하지 않음(민감값 보존). idempotent.
24
+ // Config root migration: copy from the old path only when the target (~/.projectops/config/config.json) is empty.
25
+ // The old file is not deleted (keeps sensitive values). Idempotent.
26
26
  export function migrateConfigRoot(io) {
27
27
  const target = join(io.home(), ".projectops", "config", "config.json");
28
28
  if (hasNonEmptyJson(target)) return { migrated: false, reason: "target-exists" };
29
29
  const sources = [
30
- join(io.home(), ".suh-template", "config", "config.json"), // 2세대 우선
31
- join(io.home(), ".cassiiopeia", "config.json"), // 1세대 폴백
30
+ join(io.home(), ".suh-template", "config", "config.json"), // 2nd generation first
31
+ join(io.home(), ".cassiiopeia", "config.json"), // 1st generation fallback
32
32
  ];
33
33
  const src = sources.find(hasNonEmptyJson);
34
34
  if (!src) return { migrated: false, reason: "no-source" };
@@ -1,9 +1,9 @@
1
- // IDE 어댑터 레지스트리 — 유일한 확장 지점.
1
+ // IDE adapter registry — the only extension point.
2
2
  //
3
- // 새 IDE를 지원하려면:
4
- // 1) src/core/ide/adapters/<name>.js 에 어댑터 객체(adapter.js 계약) 작성
5
- // 2) 아래에 import 추가하고 ADAPTERS 배열에 넣기
6
- // 오케스트레이터·프롬프트·index 라우팅은 이 배열만 순회하므로 다른 파일은 손대지 않는다.
3
+ // To support a new IDE:
4
+ // 1) write an adapter object (adapter.js contract) in src/core/ide/adapters/<name>.js
5
+ // 2) add the import below and put it in the ADAPTERS array
6
+ // The orchestrator, prompts and index routing only iterate this array, so no other file needs changes.
7
7
  import { assertAdapter } from "./adapter.js";
8
8
  import { claudeAdapter } from "./adapters/claude.js";
9
9
  import { cursorAdapter } from "./adapters/cursor.js";
@@ -13,7 +13,7 @@ import { copilotAdapter } from "./adapters/copilot.js";
13
13
  import { piAdapter } from "./adapters/pi.js";
14
14
  import { piHarnessAdapter } from "./adapters/pi-harness.js";
15
15
 
16
- // order 오름차순 정렬 + 계약 검증.
16
+ // Sort by order ascending + check the contract.
17
17
  export const ADAPTERS = [
18
18
  claudeAdapter,
19
19
  cursorAdapter,
@@ -1,12 +1,12 @@
1
- // 외부 CLI 실행·감지 래퍼.
2
- // 전부 주입 가능 — 테스트는 stub runner/which/home 를 넘겨 실제 CLI 없이 검증한다.
1
+ // Wrapper for running and detecting external CLIs.
2
+ // Everything is injectable — tests pass stub runner/which/home to verify without real CLIs.
3
3
  import { spawnSync } from "node:child_process";
4
4
  import { delimiter, join } from "node:path";
5
5
  import { existsSync } from "node:fs";
6
6
  import { homedir } from "node:os";
7
7
 
8
- // which(cmd) → 실행 파일 절대경로 or null. PATH를 직접 스캔 (execa 없이 내장만).
9
- // Windows는 PATHEXT 확장자(.cmd/.exe/.bat 등)까지 시도.
8
+ // which(cmd) → absolute path of the executable or null. Scans PATH directly (built-ins only, no execa).
9
+ // On Windows, also tries PATHEXT extensions (.cmd/.exe/.bat, etc.).
10
10
  export function which(cmd) {
11
11
  const paths = (process.env.PATH || "").split(delimiter).filter(Boolean);
12
12
  const exts = process.platform === "win32"
@@ -21,13 +21,13 @@ export function which(cmd) {
21
21
  return null;
22
22
  }
23
23
 
24
- // run(cmd, args, opts) → {code, stdout, stderr}. 동기 실행.
25
- // opts.cwd, opts.env 지원. 실행 자체 실패(파일 없음 등)면 code=127.
24
+ // run(cmd, args, opts) → {code, stdout, stderr}. Synchronous.
25
+ // Supports opts.cwd and opts.env. If the launch itself fails (no file, etc.), code=127.
26
26
  //
27
- // Windows: claude/gemini/codex/pi 는 .cmd/.ps1 셸 런처라 spawnSync가 직접 못 띄운다.
28
- // shell:true + args 배열은 DEP0190(인자 미이스케이프) 경고 → cmd.exe에 안전 인용한 단일
29
- // 명령 문자열을 넘긴다. args는 우리가 만든 하드코딩 값 + URL/scope뿐이라 신뢰 가능하지만,
30
- // 그래도 큰따옴표로 감싸 공백·특수문자를 방어한다.
27
+ // Windows: claude/gemini/codex/pi are .cmd/.ps1 shell launchers that spawnSync cannot start directly.
28
+ // shell:true + an args array triggers the DEP0190 (unescaped args) warning → pass cmd.exe a single safely quoted
29
+ // command string. args are only our hardcoded values + URL/scope, so they are trusted,
30
+ // but they are still wrapped in double quotes to guard against spaces and special characters.
31
31
  export function run(cmd, args = [], opts = {}) {
32
32
  const common = { cwd: opts.cwd, env: opts.env || process.env, encoding: "utf8", windowsHide: true };
33
33
  let r;
@@ -35,27 +35,27 @@ export function run(cmd, args = [], opts = {}) {
35
35
  const line = [cmd, ...args].map(winQuote).join(" ");
36
36
  r = spawnSync(line, { ...common, shell: true });
37
37
  } else {
38
- r = spawnSync(cmd, args, common); // POSIX는 shell 불필요(안전)
38
+ r = spawnSync(cmd, args, common); // POSIX needs no shell (safe)
39
39
  }
40
40
  if (r.error) return { code: 127, stdout: "", stderr: String(r.error.message || r.error) };
41
41
  return { code: r.status ?? 0, stdout: r.stdout || "", stderr: r.stderr || "" };
42
42
  }
43
43
 
44
- // cmd.exe용 인용: 이미 안전한 토큰(영숫자·경로·URL 문자)이면 그대로, 아니면 "..." 로 감싸고 내부 " 이스케이프.
44
+ // Quoting for cmd.exe: tokens already safe (alphanumerics, path and URL characters) as is, else wrap in "..." and escape inner ".
45
45
  function winQuote(s) {
46
46
  if (/^[A-Za-z0-9_./:@=-]+$/.test(s)) return s;
47
47
  return '"' + String(s).replace(/"/g, '\\"') + '"';
48
48
  }
49
49
 
50
- // IDE 실행 컨텍스트 기본값. 테스트는 이 shape을 스텁으로 대체.
50
+ // Default IDE run context. Tests replace this shape with a stub.
51
51
  // which(cmd)→path|null, run(cmd,args)→{code,stdout,stderr}, home()→string, log(msg)
52
52
  export function defaultIo() {
53
53
  return {
54
54
  which,
55
55
  run,
56
56
  home: () => homedir(),
57
- // 파이썬 stable_entry 와 같은 규칙: PROJECTOPS_HOME > ~/.projectops
57
+ // Same rule as Python stable_entry: PROJECTOPS_HOME > ~/.projectops
58
58
  projectopsHome: () => process.env.PROJECTOPS_HOME || join(homedir(), ".projectops"),
59
- log: (msg) => console.error(msg), // 안내는 stderr로 (stdout 파이프 오염 방지)
59
+ log: (msg) => console.error(msg), // Notices go to stderr (keeps the stdout pipe clean)
60
60
  };
61
61
  }
@@ -1,35 +1,35 @@
1
- // 스킬 폴더 복사 공용 (Cursor·Copilot): skills/ + 공용 파이썬 scripts/ > 홈 설치 루트, 테스트 제외, 폐기 정리, 메타 기록
2
- // 마켓플레이스 없이 SKILL.md 폴더를 그대로 읽는 IDE 가 같은 규칙을 쓰도록 한 곳에 둔다.
3
- // 설치 모양은 플러그인 캐시와 같다: <설치 루트>/skills/pro-*/scripts/x_cli.py + <설치 루트>/scripts/common
4
- // (스킬 CLI bootstrap 이 x_cli.py 기준 3단계 위의 scripts/ 를 import 경로로 쓴다)
1
+ // Shared skill folder copy (Cursor, Copilot): skills/ + shared Python scripts/ > home install root, tests excluded, obsolete cleanup, meta record
2
+ // Kept in one place so IDEs that read SKILL.md folders directly without a marketplace use the same rules.
3
+ // Install layout matches the plugin cache: <install root>/skills/pro-*/scripts/x_cli.py + <install root>/scripts/common
4
+ // (the skill CLI bootstrap uses scripts/ three levels above x_cli.py as an import path)
5
5
  import { dirname, join, relative } from "node:path";
6
6
  import { existsSync, readFileSync, mkdirSync, rmSync, writeFileSync, readdirSync } from "node:fs";
7
7
  import { copyPathSync } from "../fsutil.js";
8
8
  import { TEMPLATE_REPO_WEB_URL } from "../paths.js";
9
9
 
10
- // 스킬을 쓰는 사람에게 필요 없는 것. projectops 자신을 검사하는 테스트다.
11
- // skills/ 는 통째로 복사되므로 여기서 걸러내지 않으면 사용자 홈에 그대로 쌓인다.
10
+ // Not needed by skill users. These are tests that check projectops itself.
11
+ // skills/ is copied whole, so without filtering here they pile up in the user's home.
12
12
  export const SKIP_IN_COPY = new Set(["conftest.py", "pytest.ini"]);
13
13
  export const TEST_PATH = /(^|[\\/])(tests?|__pycache__)([\\/]|$)/;
14
- // 우리 스킬 접두사: pro- 현행, suh- 옛 이름
14
+ // Our skill prefixes: pro- current, suh- old name
15
15
  const OWNED_SKILL_NAME = /^(pro|suh)-/;
16
- // 공용 파이썬 패키지 표식: scripts/common/__init__.py
16
+ // Shared Python package marker: scripts/common/__init__.py
17
17
  const SHARED_SCRIPTS_MARKER = join("common", "__init__.py");
18
18
  export const SHARED_SCRIPTS_DIR_NAME = "scripts";
19
19
  const PYTHON_CACHE_DIR_NAME = "__pycache__";
20
- // 공용 파이썬 중 저장소 관리자만 쓰는 최상위 항목 3개: 안내 문서, 트러블슈팅 색인 생성기, extras 사본 동기화 (#988)
21
- // 허용 목록이 아니라 제외 목록인 이유: 새 런타임 모듈을 빠뜨리면 스킬이 import 에서 죽지만,
22
- // 새 개발 파일을 빠뜨리면 파일 하나가 더 갈 뿐이다. 런타임이 쓰는 항목이 여기 들어오면 test/ide-home-install-e2e.test.js 가 잡는다
20
+ // 3 top-level shared Python entries used only by repo maintainers: guide doc, troubleshooting index generator, extras copy sync (#988)
21
+ // Why an exclude list, not an allow list: missing a new runtime module kills skills on import,
22
+ // while missing a new dev file only ships one extra file. test/ide-home-install-e2e.test.js catches runtime entries landing here
23
23
  export const SHARED_SCRIPTS_DEV_ONLY = new Set(["README.md", "build_troubleshooting.py", "sync_extras.py"]);
24
24
 
25
- // 스킬 소스: 다운로드된 템플릿(TEMP)/skills 우선, 없으면 로컬 skills/
25
+ // Skill source: downloaded template (TEMP)/skills first, else local skills/
26
26
  export function resolveSkillsSrc(ctx = {}) {
27
27
  const cands = [ctx.sourceSkillsDir, ctx.tempDir && join(ctx.tempDir, "skills"), "skills"].filter(Boolean);
28
28
  for (const c of cands) if (existsSync(c)) return c;
29
29
  return "";
30
30
  }
31
31
 
32
- // 공용 파이썬 소스: 직접 지정 > 템플릿(TEMP)/scripts > 스킬 소스 옆 scripts/ (같은 레포)
32
+ // Shared Python source: explicit > template (TEMP)/scripts > scripts/ next to the skill source (same repo)
33
33
  export function resolveScriptsSrc(ctx = {}, skillsSrc = "") {
34
34
  const cands = [ctx.sourceScriptsDir, ctx.tempDir && join(ctx.tempDir, SHARED_SCRIPTS_DIR_NAME),
35
35
  skillsSrc && join(dirname(skillsSrc), SHARED_SCRIPTS_DIR_NAME)].filter(Boolean);
@@ -37,7 +37,7 @@ export function resolveScriptsSrc(ctx = {}, skillsSrc = "") {
37
37
  return "";
38
38
  }
39
39
 
40
- // 메타 파일 > {installed, version, sharedScripts} (손상된 메타는 설치됐다고 봄)
40
+ // Meta file > {installed, version, sharedScripts} (corrupt meta counts as installed)
41
41
  export function readSkillsMeta(metaFile) {
42
42
  if (!existsSync(metaFile)) return { installed: false, version: null, sharedScripts: [] };
43
43
  try {
@@ -46,15 +46,15 @@ export function readSkillsMeta(metaFile) {
46
46
  } catch { return { installed: true, version: null, sharedScripts: [] }; }
47
47
  }
48
48
 
49
- // 소스 최상위 항목 복사 (테스트·conftest 제외). 필터는 소스 기준 상대경로로 본다 —
50
- // 절대경로로 보면 소스가 ~/test/... 아래에 있을 때 전부 걸러진다.
51
- // skipNames: 추가로 빼는 최상위 이름 (공용 파이썬의 개발 전용 항목)
49
+ // Copy top-level source entries (tests and conftest excluded). The filter uses paths relative to the source —
50
+ // with absolute paths, everything would be filtered when the source sits under ~/test/....
51
+ // skipNames: extra top-level names to leave out (dev-only shared Python entries)
52
52
  function copyEntriesWithoutTests(src, dest, skipNames = new Set()) {
53
53
  mkdirSync(dest, { recursive: true });
54
54
  const copiedNames = [];
55
55
  for (const e of readdirSync(src, { withFileTypes: true })) {
56
56
  if (SKIP_IN_COPY.has(e.name) || TEST_PATH.test(e.name) || skipNames.has(e.name)) continue;
57
- // 이 저장소 자기 코드를 검사하는 테스트는 남의 컴퓨터로 나갈 이유가 없다 (#591).
57
+ // Tests that check this repo's own code have no reason to go to someone else's computer (#591).
58
58
  copyPathSync(join(src, e.name), join(dest, e.name), (p) => !TEST_PATH.test(relative(src, p)));
59
59
  copiedNames.push(e.name);
60
60
  }
@@ -62,13 +62,13 @@ function copyEntriesWithoutTests(src, dest, skipNames = new Set()) {
62
62
  }
63
63
 
64
64
  /**
65
- * 스킬 복사: 소스 > dest (테스트 제외) > 소스에서 사라진 우리 스킬 제거
66
- * 폐기한 스킬 이름 목록 반환. 복사 실패는 예외로 올린다 (호출부가 로그·false 처리).
65
+ * Copy skills: source > dest (tests excluded) > remove our skills that vanished from the source
66
+ * Returns the list of obsolete skill names. Copy failures are thrown (the caller logs and returns false).
67
67
  */
68
68
  export function copySkillsTree(src, dest, metaFileName) {
69
69
  copyEntriesWithoutTests(src, dest);
70
- // 복사는 overlay 라 덮어쓰기만 하면 **폐기한 스킬이 남의 컴퓨터에 영영 남아** 계속 잡힌다 (#500).
71
- // 남의 스킬은 접두사로 걸러 건드리지 않는다.
70
+ // The copy is an overlay, so overwriting alone leaves **obsolete skills on users' computers forever**, still picked up (#500).
71
+ // Others' skills are filtered out by prefix and left untouched.
72
72
  const srcNames = new Set(readdirSync(src));
73
73
  const obsoleteNames = [];
74
74
  for (const name of readdirSync(dest)) {
@@ -77,21 +77,21 @@ export function copySkillsTree(src, dest, metaFileName) {
77
77
  try {
78
78
  rmSync(join(dest, name), { recursive: true, force: true });
79
79
  obsoleteNames.push(name);
80
- } catch { /* 무시 — 지우지 못해도 설치는 계속한다 */ }
80
+ } catch { /* ignore — keep installing even if it cannot be deleted */ }
81
81
  }
82
82
  return obsoleteNames;
83
83
  }
84
84
 
85
- // 공용 파이썬 교체 복사: 지난 설치 항목 제거 > 런타임 항목만 복사 (폐기 모듈·예전에 깔린 개발 파일이 남지 않게). 복사한 항목 이름 반환
85
+ // Replace-copy the shared Python: remove last install's entries > copy runtime entries only (so obsolete modules and old dev files do not linger). Returns copied entry names
86
86
  function replaceSharedScripts(scriptsSrc, scriptsDest, previousNames) {
87
87
  removeNamedEntries(scriptsDest, previousNames);
88
88
  return copyEntriesWithoutTests(scriptsSrc, scriptsDest, SHARED_SCRIPTS_DEV_ONLY);
89
89
  }
90
90
 
91
- // 이름 목록 + 파이썬 실행이 만든 __pycache__ 삭제 > 폴더가 비면 폴더도 삭제
91
+ // Delete the name list + __pycache__ made by Python runs > delete the folder too if empty
92
92
  function removeNamedEntries(dir, names) {
93
93
  for (const name of [...names, PYTHON_CACHE_DIR_NAME]) {
94
- // 메타에서 읽은 이름이라 경로 이동(../) 차단
94
+ // Names come from meta, so block path traversal (../)
95
95
  if (!name || name.includes("/") || name.includes("\\") || name === "..") continue;
96
96
  rmSync(join(dir, name), { recursive: true, force: true });
97
97
  }
@@ -99,8 +99,8 @@ function removeNamedEntries(dir, names) {
99
99
  }
100
100
 
101
101
  /**
102
- * 홈 설치 1회: 스킬 복사 > 공용 파이썬 교체 복사 > 메타 기록
103
- * {obsoleteNames, hasSharedScripts} 반환. 실패는 예외로 올린다.
102
+ * One home install: copy skills > replace-copy shared Python > record meta
103
+ * Returns {obsoleteNames, hasSharedScripts}. Failures are thrown.
104
104
  */
105
105
  export function installHomeSkills({ skillsSrc, scriptsSrc, skillsDest, metaFileName, templateVersion }) {
106
106
  const metaFile = join(skillsDest, metaFileName);
@@ -112,18 +112,18 @@ export function installHomeSkills({ skillsSrc, scriptsSrc, skillsDest, metaFileN
112
112
  return { obsoleteNames, hasSharedScripts: !!scriptsSrc };
113
113
  }
114
114
 
115
- // projectops 가 이 폴더에 설치했다고 볼 항목: 소스 폴더명 ∪ pro-/suh- 접두사 ∪ 메타 파일
116
- // 접두어 없는 폴더(somansa-tools 등 남의 스킬)는 제외 → 보존
115
+ // Entries considered installed here by projectops: source folder names ∪ pro-/suh- prefixes ∪ meta file
116
+ // Folders without the prefix (others' skills like somansa-tools) are excluded → kept
117
117
  export function ownedEntries(dir, ctx, metaFileName) {
118
118
  if (!existsSync(dir)) return [];
119
119
  let srcNames = new Set();
120
120
  const src = resolveSkillsSrc(ctx);
121
121
  if (src && existsSync(src)) srcNames = new Set(readdirSync(src));
122
- // 폐기한 스킬은 소스에 없으므로 srcNames 로는 잡히지 않는다 (#619).
122
+ // Obsolete skills are not in the source, so srcNames does not catch them (#619).
123
123
  return readdirSync(dir).filter((name) => srcNames.has(name) || OWNED_SKILL_NAME.test(name) || name === metaFileName);
124
124
  }
125
125
 
126
- // 우리 항목만 삭제 (메타에 적힌 공용 파이썬 포함) > 폴더가 비면 폴더도 삭제. 실패는 예외로 올린다.
126
+ // Delete only our entries (including shared Python listed in meta) > delete the folder too if empty. Failures are thrown.
127
127
  export function removeOwnedEntries(dir, ctx, metaFileName) {
128
128
  const { sharedScripts } = readSkillsMeta(join(dir, metaFileName));
129
129
  for (const name of ownedEntries(dir, ctx, metaFileName)) rmSync(join(dir, name), { recursive: true, force: true });
@@ -132,13 +132,13 @@ export function removeOwnedEntries(dir, ctx, metaFileName) {
132
132
  if (sharedScripts.length && existsSync(scriptsDest)) removeNamedEntries(scriptsDest, sharedScripts);
133
133
  }
134
134
 
135
- // 메타 기록: 버전 추적용 (installedAt 은 첫 설치 시각 유지). extraFields: sharedScripts 등
135
+ // Record meta: for version tracking (installedAt keeps the first install time). extraFields: sharedScripts, etc.
136
136
  export function writeSkillsMeta(destDir, metaFileName, templateVersion, extraFields = {}) {
137
137
  const version = templateVersion || "unknown";
138
138
  const now = new Date().toISOString().replace(/\.\d+Z$/, "Z");
139
139
  const file = join(destDir, metaFileName);
140
140
  let installedAt = now;
141
- if (existsSync(file)) { try { installedAt = JSON.parse(readFileSync(file, "utf8")).installedAt || now; } catch { /* 무해 */ } }
141
+ if (existsSync(file)) { try { installedAt = JSON.parse(readFileSync(file, "utf8")).installedAt || now; } catch { /* harmless */ } }
142
142
  const meta = {
143
143
  name: "projectops", version, scope: "user",
144
144
  source: TEMPLATE_REPO_WEB_URL,
@@ -1,20 +1,20 @@
1
- // 고정 진입점 설치: ~/.projectops/bin/{projectops_cli.py, launch_cli.py} (#942·#897)
2
- // SKILL.md 는 이 진입점을 먼저 부른다. 파이썬 쪽은 CLI 를 한 번 실행해야 진입점을 깔므로,
3
- // 홈 복사 설치(Cursor·Copilot)는 첫 호출부터 길을 찾도록 설치 때 깐다 (#200).
4
- // 규칙은 파이썬 refresh_stable_entrypoint 와 같다: 소스 RESOLVER_REVISION 이 깔린 것보다 높을 때만 덮는다.
1
+ // Install stable entry points: ~/.projectops/bin/{projectops_cli.py, launch_cli.py} (#942·#897)
2
+ // SKILL.md calls these entry points first. The Python side installs them only after a CLI runs once, so
3
+ // home-copy installs (Cursor, Copilot) lay them down at install time so the first call finds its way (#200).
4
+ // Same rule as Python refresh_stable_entrypoint: overwrite only when the source RESOLVER_REVISION is higher than the installed one.
5
5
  import { join } from "node:path";
6
6
  import { existsSync, readFileSync, mkdirSync, writeFileSync, chmodSync, renameSync } from "node:fs";
7
7
 
8
8
  const REVISION_PATTERN = /^RESOLVER_REVISION = (\d+)/m;
9
- // 진입점 권한: 직접 실행 가능 (rwxr-xr-x)
9
+ // Entry point permissions: directly executable (rwxr-xr-x)
10
10
  const STABLE_ENTRYPOINT_MODE = 0o755;
11
- // 진입점 2종: (설치 이름, 소스 경로 계산)
11
+ // 2 entry points: (install name, source path computation)
12
12
  const STABLE_ENTRYPOINTS = [
13
13
  { name: "projectops_cli.py", source: ({ scriptsSrc }) => scriptsSrc && join(scriptsSrc, "projectops_cli.py") },
14
14
  { name: "launch_cli.py", source: ({ skillsSrc }) => skillsSrc && join(skillsSrc, "pro-launch", "scripts", "launch_resolver.py") },
15
15
  ];
16
16
 
17
- // 파일 > 내용 번호 (없거나 못 읽으면 -1)
17
+ // File > content revision (-1 if missing or unreadable)
18
18
  function readRevision(file) {
19
19
  try {
20
20
  const match = REVISION_PATTERN.exec(readFileSync(file, "utf8"));
@@ -23,8 +23,8 @@ function readRevision(file) {
23
23
  }
24
24
 
25
25
  /**
26
- * 진입점 갱신: 소스 번호 > 깔린 번호일 때만 임시 파일 > 권한 > 교체
27
- * 바꾼 진입점 이름 목록 반환. 실패는 예외로 올린다.
26
+ * Refresh entry points: only when source revision > installed revision: temp file > permissions > replace
27
+ * Returns the names of replaced entry points. Failures are thrown.
28
28
  */
29
29
  export function refreshStableEntrypoints(projectopsHome, sources) {
30
30
  const binDir = join(projectopsHome, "bin");
@@ -35,7 +35,7 @@ export function refreshStableEntrypoints(projectopsHome, sources) {
35
35
  const target = join(binDir, entry.name);
36
36
  if (readRevision(sourceFile) <= readRevision(target)) continue;
37
37
  mkdirSync(binDir, { recursive: true });
38
- // 다른 세션이 동시에 읽어도 반쯤 쓴 파일을 보지 않게
38
+ // So another session reading at the same time never sees a half-written file
39
39
  const temporary = `${target}.${process.pid}.tmp`;
40
40
  writeFileSync(temporary, readFileSync(sourceFile, "utf8"));
41
41
  chmodSync(temporary, STABLE_ENTRYPOINT_MODE);
@@ -45,7 +45,7 @@ export function refreshStableEntrypoints(projectopsHome, sources) {
45
45
  return updatedNames;
46
46
  }
47
47
 
48
- // projectops 홈: io 가 주면 그 값 (테스트 격리), 아니면 ~/.projectops
48
+ // projectops home: the io value if given (test isolation), else ~/.projectops
49
49
  export function projectopsHomeOf(io) {
50
50
  return typeof io.projectopsHome === "function" ? io.projectopsHome() : join(io.home(), ".projectops");
51
51
  }
@@ -1,6 +1,6 @@
1
- // IDE 어댑터 공용 유틸.
1
+ // Shared utilities for IDE adapters.
2
2
 
3
- // sort -V 근사: 버전형 디렉토리/문자열 비교기. "3.0.9" < "3.0.10" 을 올바로 정렬.
3
+ // Approximation of sort -V: comparator for version-like directories/strings. Sorts "3.0.9" < "3.0.10" correctly.
4
4
  export function compareCacheName(a, b) {
5
5
  const pa = a.split(".").map((n) => parseInt(n, 10) || 0);
6
6
  const pb = b.split(".").map((n) => parseInt(n, 10) || 0);
@@ -11,8 +11,8 @@ export function compareCacheName(a, b) {
11
11
  return a.localeCompare(b);
12
12
  }
13
13
 
14
- // 상태 → 표시 태그 (" ✓ 최신" / " → 업데이트 가능: vX"). templateVersion 없으면 빈 문자열.
14
+ // Status → display tag (" ✓ latest" / " → update available: vX"). Empty string without templateVersion.
15
15
  export function versionTag(installedVersion, templateVersion) {
16
16
  if (!templateVersion || !installedVersion) return "";
17
- return installedVersion === templateVersion ? " ✓ 최신" : ` → 업데이트 가능: v${templateVersion}`;
17
+ return installedVersion === templateVersion ? " ✓ latest" : ` → update available: v${templateVersion}`;
18
18
  }