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,15 +1,15 @@
1
- // 건너뛴 워크플로의 새 템플릿 보관소 (#654).
2
- // 사용자가 수정한 워크플로는 덮어쓰지 않고 유지한다. 대신 "새 템플릿이 어떻게 다른지"를
3
- // 비교할 수 있도록 추적되지 않는 자리에 사본을 남긴다.
4
- // 절대 .github/workflows 에 쓰지 않는다 — 거기 생긴 파일은 GitHub 이 실제 워크플로로 실행한다.
1
+ // Store for new templates of skipped workflows (#654).
2
+ // Workflows the user modified are kept, not overwritten. Instead, a copy goes to an untracked place
3
+ // so the user can compare how the new template differs.
4
+ // Never write to .github/workflows — files there run as real workflows on GitHub.
5
5
  import { join } from "node:path";
6
6
  import { writeText } from "./fsutil.js";
7
7
 
8
8
  export const INCOMING_DIR = ".github/.projectops/incoming";
9
- // 폴더가 스스로 추적 제외 규칙을 들고 다닌다 (logs/.gitignore 와 같은 방식, 루트 .gitignore 무수정)
9
+ // The folder carries its own ignore rule (same as logs/.gitignore; the root .gitignore is untouched)
10
10
  export const INCOMING_GITIGNORE = [
11
- "# projectops 가 건너뛴 워크플로의 새 템플릿 사본 — 저장소에 추적하지 않습니다.",
12
- "# 병합 검토용 임시 자료이며 실행할 때마다 최신으로 덮어씁니다.",
11
+ "# New template copies of workflows projectops skipped — not tracked in the repository.",
12
+ "# Temporary material for merge review, overwritten with the latest on every run.",
13
13
  "*",
14
14
  "!.gitignore",
15
15
  "",
@@ -17,23 +17,23 @@ export const INCOMING_GITIGNORE = [
17
17
 
18
18
  const toLines = (s) => {
19
19
  const lines = String(s).split(/\r?\n/);
20
- if (lines.length && lines[lines.length - 1] === "") lines.pop(); // 끝 개행이 만드는 빈 줄 제외
20
+ if (lines.length && lines[lines.length - 1] === "") lines.pop(); // Drop the empty line made by the trailing newline
21
21
  return lines;
22
22
  };
23
23
 
24
- // 줄 단위 추가/삭제 개수. LCS 기반이라 줄이 이동만 한 경우도 과대 계상하지 않는다.
25
- // removed: 사용자본에만 있는 줄, added: 새 템플릿에만 있는 줄.
24
+ // Count of added/removed lines. LCS-based, so lines that only moved are not overcounted.
25
+ // removed: lines only in the user copy, added: lines only in the new template.
26
26
  export function lineDiffCounts(userText, incomingText) {
27
27
  const a = toLines(userText);
28
28
  const b = toLines(incomingText);
29
- // 공통 접두/접미는 LCS에서 뺀다 (워크플로 대부분이 같아 표가 작아진다)
29
+ // Trim the common prefix/suffix before LCS (most of a workflow is identical, so the table stays small)
30
30
  let s = 0;
31
31
  while (s < a.length && s < b.length && a[s] === b[s]) s++;
32
32
  let ea = a.length; let eb = b.length;
33
33
  while (ea > s && eb > s && a[ea - 1] === b[eb - 1]) { ea--; eb--; }
34
34
  const x = a.slice(s, ea); const y = b.slice(s, eb);
35
35
  if (x.length * y.length > 25_000_000) {
36
- // 비정상적으로 큰 파일 — 정확도 대신 크기 차이로 근사한다 (실패시키지 않는다)
36
+ // Abnormally large file — approximate by size difference instead of exactness (never fail)
37
37
  return { added: y.length, removed: x.length };
38
38
  }
39
39
  let prev = new Array(y.length + 1).fill(0);
@@ -48,7 +48,7 @@ export function lineDiffCounts(userText, incomingText) {
48
48
  return { added: y.length - common, removed: x.length - common };
49
49
  }
50
50
 
51
- // incoming 폴더에 새 템플릿을 저장한다. 반환: 대상 기준 상대 경로(항상 '/').
51
+ // Save the new template into the incoming folder. Returns a path relative to the target (always '/').
52
52
  export function saveIncoming(targetRoot, filename, content) {
53
53
  writeText(join(targetRoot, INCOMING_DIR, ".gitignore"), INCOMING_GITIGNORE);
54
54
  writeText(join(targetRoot, INCOMING_DIR, filename), content);
@@ -1,12 +1,12 @@
1
- // 상태 라벨 표기(#776): 영문 표준("en")과 기존 한글("ko").
2
- // 템플릿 원본은 영문 하나다. 한글 모드는 복사 직후 이름만 되돌려 만든다 —
3
- // 한글 사본을 따로 두면 두 벌이 어긋난다.
1
+ // Status label style (#776): English standard ("en") and legacy Korean ("ko").
2
+ // The template source is English only. Korean mode renames back right after copying —
3
+ // a separate Korean copy would drift from the English one.
4
4
  import { join } from "node:path";
5
5
  import { existsSync, readFileSync, writeFileSync, readdirSync } from "node:fs";
6
6
 
7
7
  export const LABEL_STYLES = ["en", "ko"];
8
8
 
9
- // [영문 표준, 한글 기존]
9
+ // [English standard, legacy Korean]
10
10
  export const LABEL_PAIRS = [
11
11
  ["status: todo", "작업전"],
12
12
  ["status: in progress", "작업중"],
@@ -20,8 +20,8 @@ export const LABEL_PAIRS = [
20
20
  ];
21
21
  const EN_TO_KO = new Map(LABEL_PAIRS);
22
22
 
23
- // version.yml 에 저장값이 없을 때의 결정. 신규 설치는 영문, 이미 설치된 레포는 한글 유지.
24
- // 이미 쓰는 레포의 라벨 이름이 업데이트만으로 바뀌면 Projects 보드 매핑이 조용히 멈추기 때문이다.
23
+ // Decision when version.yml has no saved value. New installs get English; existing installs keep Korean.
24
+ // Renaming labels in a repo already using them just through an update would silently break the Projects board mapping.
25
25
  export function resolveLabelStyle({ flag, stored, existing }) {
26
26
  if (LABEL_STYLES.includes(flag)) return flag;
27
27
  if (LABEL_STYLES.includes(stored)) return stored;
@@ -39,14 +39,14 @@ function rewrite(file, fn) {
39
39
 
40
40
  const quoted = (s) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
41
41
 
42
- // 한글 모드: 복사된 파일의 라벨 이름을 한글로 되돌린다. 영문 모드는 아무것도 하지 않는다.
43
- // 반환: 바뀐 파일의 상대경로 목록.
42
+ // Korean mode: rename labels in copied files back to Korean. English mode does nothing.
43
+ // Returns the relative paths of changed files.
44
44
  export function applyLabelStyle(targetRoot, style) {
45
45
  if (style !== "ko") return [];
46
46
  const changed = [];
47
47
  const gh = join(targetRoot, ".github");
48
48
 
49
- // 라벨 정의: name 줄만 바꾸고, 이름 변경용 from_name 줄은 지운다(이미 한글이라 필요 없다).
49
+ // Label definitions: change only the name line and drop the from_name rename line (already Korean, not needed).
50
50
  const labelsFile = join(gh, "config", "issue-labels.yml");
51
51
  if (rewrite(labelsFile, (txt) => {
52
52
  let out = txt.replace(/^\s*from_name:.*\n/gm, "");
@@ -56,7 +56,7 @@ export function applyLabelStyle(targetRoot, style) {
56
56
  return out;
57
57
  })) changed.push(".github/config/issue-labels.yml");
58
58
 
59
- // 이슈 템플릿 기본 라벨: front matter 의 labels 줄만 대상으로 한다.
59
+ // Issue template default labels: only the labels line in the front matter.
60
60
  const tplDir = join(gh, "ISSUE_TEMPLATE");
61
61
  if (existsSync(tplDir)) {
62
62
  for (const name of readdirSync(tplDir).filter((f) => f.endsWith(".md"))) {
@@ -69,7 +69,7 @@ export function applyLabelStyle(targetRoot, style) {
69
69
  }
70
70
  }
71
71
 
72
- // Discussion 템플릿 기본 라벨 (#988): 맨 위 labels: 목록의 "- 이름" 줄만 대상
72
+ // Discussion template default labels (#988): only the "- name" lines of the top labels: list
73
73
  const discussionDir = join(gh, "DISCUSSION_TEMPLATE");
74
74
  if (existsSync(discussionDir)) {
75
75
  for (const name of readdirSync(discussionDir).filter((f) => /\.ya?ml$/.test(f))) {
@@ -84,7 +84,7 @@ export function applyLabelStyle(targetRoot, style) {
84
84
  }
85
85
  }
86
86
 
87
- // QA 이슈 생성 봇이 붙이는 기본 라벨
87
+ // Default labels attached by the QA issue bot
88
88
  const bot = join(gh, "workflows", "PROJECT-COMMON-QA-ISSUE-CREATION-BOT.yaml");
89
89
  if (rewrite(bot, (txt) => txt.replace(/labels:\s*\['status: todo'\]/g, `labels: ['${EN_TO_KO.get("status: todo")}']`))) {
90
90
  changed.push(".github/workflows/PROJECT-COMMON-QA-ISSUE-CREATION-BOT.yaml");
@@ -1,7 +1,7 @@
1
- // 마이그레이션 가이드 (#493) — Layer 1 큐레이션 문서.
2
- // 마법사(full/workflows) 실행이 끝나면 대상 레포의 .github/.projectops/logs/PROJECTOPS-MIGRATION-GUIDE.md에
3
- // "고정 헤더(최초 1회) + 실행 엔트리(append-only)"를 남긴다. 사람용 동적 체크리스트와
4
- // AI Agent용 yaml 메타데이터를 한 엔트리에 담고, run-trace(#494)의 events를 단일 소스로 소비한다.
1
+ // Migration guide (#493) — Layer 1 curated document.
2
+ // When a wizard run (full/workflows) ends, writes to the target repo's .github/.projectops/logs/PROJECTOPS-MIGRATION-GUIDE.md
3
+ // "a fixed header (first time only) + a run entry (append-only)". Each entry holds a dynamic checklist for people
4
+ // and yaml metadata for AI agents, consuming run-trace (#494) events as the single source.
5
5
  import { join } from "node:path";
6
6
  import { existsSync, readFileSync, appendFileSync } from "node:fs";
7
7
  import { writeText } from "./fsutil.js";
@@ -10,7 +10,7 @@ import { MIGRATION_DIR } from "./run-trace.js";
10
10
  export const GUIDE_FILE = `${MIGRATION_DIR}/PROJECTOPS-MIGRATION-GUIDE.md`;
11
11
  export const GUIDE_SCHEMA = 1;
12
12
 
13
- // 고정 헤더 — 문서 목적 + AI Agent 해석 가이드라인. 최초 생성 시 1회만 쓴다 (엔트리와 분리).
13
+ // Fixed header — document purpose + AI agent reading guidelines. Written once on first creation (separate from entries).
14
14
  const HEADER = `# ProjectOps Migration Guide
15
15
 
16
16
  This document is **written automatically every time a run finishes** by the projectops wizard (\`npx projectops\`).
@@ -41,18 +41,18 @@ Parse the \`\`\`yaml metadata block (\`# projectops-migration\`) of each entry a
41
41
  - When there are several entries, the **latest entry** is the reference for the current state. Older entries are history.
42
42
  `;
43
43
 
44
- // ── yaml 렌더 헬퍼 (외부 의존성 없이 수동 직렬화 — version-yml.js와 동일 원칙) ──
44
+ // ── yaml render helpers (manual serialization with no external dependencies — same principle as version-yml.js) ──
45
45
  const yq = (s) => `"${String(s ?? "").replaceAll('"', '\\"')}"`;
46
46
  const ylist = (arr) => (arr && arr.length ? `[${arr.map(yq).join(", ")}]` : "[]");
47
47
 
48
- // trace events → 가이드용 파일 목록 파생 (단일 소스 — 이벤트에서 유도).
48
+ // trace events → derive the file list for the guide (single source — derived from events).
49
49
  export function deriveWorkflowLists(events = []) {
50
50
  const pick = (action) => events.filter((e) => e.phase === "copy" && e.action === action).map((e) => e.target);
51
51
  return {
52
52
  added: pick("copied"),
53
53
  replacedBak: pick("replaced-bak"),
54
54
  skippedConflict: pick("skipped-conflict"),
55
- // #654 — 건너뛴 파일별 새 템플릿 사본 경로와 diff 줄 수 (이벤트 detail에서 파생)
55
+ // #654 — per skipped file, the new template copy path and diff line counts (derived from event detail)
56
56
  skippedConflictDetails: events.filter((e) => e.phase === "copy" && e.action === "skipped-conflict")
57
57
  .map((e) => ({ file: e.target, incoming: e.detail?.incoming ?? "", added: e.detail?.added ?? null, removed: e.detail?.removed ?? null })),
58
58
  templateAdded: pick("template-added"),
@@ -60,7 +60,7 @@ export function deriveWorkflowLists(events = []) {
60
60
  };
61
61
  }
62
62
 
63
- // trace events → 타입별 적용 env 값 파생.
63
+ // trace events → derive the applied env values per type.
64
64
  export function deriveEnvApplied(events = []) {
65
65
  const byType = new Map();
66
66
  for (const e of events) {
@@ -72,10 +72,10 @@ export function deriveEnvApplied(events = []) {
72
72
  return byType;
73
73
  }
74
74
 
75
- // 실행 엔트리 렌더링. report:
75
+ // Render a run entry. report:
76
76
  // { now, mode, types, repoName, templateFrom, templateTo,
77
77
  // options: {deploy, publish, secretBackup, coderabbit, changelogProvider, intent},
78
- // branches: {defaultBranch, deployBranch, ready, created, result}, // result: #715 비대화형 생성 결과 | null
78
+ // branches: {defaultBranch, deployBranch, ready, created, result}, // result: #715 non-interactive creation result | null
79
79
  // breaking: {current, target, critical:[], warnings:[]} | null,
80
80
  // migrations: {applied:[], confirmPending:[], askPending:[]} | null,
81
81
  // orphans: {cleaned:[], pending:[]} | null,
@@ -102,7 +102,7 @@ export function renderGuideEntry(report) {
102
102
  L.push(`- Workflows: ${wf.added.length + wf.replacedBak.length} new/updated, ${(r.counters?.skipped ?? 0)} kept (unchanged or skipped on conflict)`);
103
103
  L.push("");
104
104
 
105
- // ── 확인 체크리스트 (동적 — 실제 발생분만) ──
105
+ // ── Check list (dynamic — only what actually happened) ──
106
106
  const checklist = [];
107
107
  if (leftoverOldGen.length) {
108
108
  checklist.push(`- [ ] **Switch to the new workflow, then delete ${leftoverOldGen.length} old-generation deploy workflow(s)** (they may be live deployments, so the wizard left them alone):`);
@@ -115,7 +115,7 @@ export function renderGuideEntry(report) {
115
115
  }
116
116
  if (wf.skippedConflict.length) {
117
117
  checklist.push(`- [ ] **Kept ${wf.skippedConflict.length} modified file(s), review a merge with the new template**: ${wf.skippedConflict.map((f) => `\`${f}\``).join(", ")}`);
118
- // #654 — 새 템플릿 사본이 있으면 비교 방법까지 적는다
118
+ // #654 — when a new template copy exists, also explain how to compare
119
119
  for (const d of wf.skippedConflictDetails.filter((x) => x.incoming)) {
120
120
  const cnt = d.added != null && d.removed != null ? ` (+${d.added} / -${d.removed} lines)` : "";
121
121
  checklist.push(` - \`${d.file}\`${cnt}: \`diff -u .github/workflows/${d.file} ${d.incoming}\``);
@@ -130,14 +130,14 @@ export function renderGuideEntry(report) {
130
130
  for (const [k, v] of kv) checklist.push(` - ${t} \`${k}\` = \`${v}\``);
131
131
  }
132
132
  }
133
- // #843 — 다국어 스토어인데 store_locales 미설정. 안내만 (키는 쓰지 않는다)
133
+ // #843 — multi-language store but store_locales unset. Notice only (the key is not written)
134
134
  const storeHint = r.storeLocalesHint ?? null;
135
135
  if (storeHint) {
136
136
  checklist.push(`- [ ] **Decide whether to turn on per-language store release notes**: ${storeHint.locales.length} store languages found (${storeHint.locales.map((l) => `\`${l}\``).join(", ")}) but \`store_locales\` is not set, so every language gets the same text. To use per-language text from \`store_notes\` in CHANGELOG.json, add \`metadata.template.options.store_locales: ["ko-KR", "en-US", ...]\` to version.yml (first = default language). Found in:`);
137
137
  for (const s of storeHint.signals) checklist.push(` - \`${s.path}\` (${s.source}: ${s.locales.join(", ")})`);
138
138
  }
139
139
  const devBranch = r.branches?.deployBranch ?? "develop";
140
- const devBranchResult = r.branches?.result ?? null; // #715 --create-development-branch 결과
140
+ const devBranchResult = r.branches?.result ?? null; // #715 --create-development-branch result
141
141
  if (devBranchResult?.status === "created") {
142
142
  checklist.push(`- [x] Development (release source) branch \`${devBranch}\`: created from \`${devBranchResult.base || "HEAD"}\` and pushed (--create-development-branch)`);
143
143
  } else if (devBranchResult?.status === "skipped") {
@@ -156,7 +156,7 @@ export function renderGuideEntry(report) {
156
156
  L.push("");
157
157
  }
158
158
 
159
- // ── 버전 점프에서 통과한 호환성 변경 (조치 방법 전문 — 터미널에서 스킵해도 여기 남는다) ──
159
+ // ── Compatibility changes passed in the version jump (full action steps — kept here even if skipped in the terminal) ──
160
160
  if (breakingAll.length) {
161
161
  L.push(`### Breaking changes passed through (v${breaking.current} → v${breaking.target})`);
162
162
  L.push("");
@@ -168,7 +168,7 @@ export function renderGuideEntry(report) {
168
168
  }
169
169
  }
170
170
 
171
- // ── AI 메타데이터 ──
171
+ // ── AI metadata ──
172
172
  L.push("### AI metadata");
173
173
  L.push("");
174
174
  L.push("```yaml");
@@ -235,7 +235,7 @@ export function renderGuideEntry(report) {
235
235
  return L.join("\n");
236
236
  }
237
237
 
238
- // 가이드 파일에 엔트리 append (파일 없으면 헤더부터 생성). 반환: { guidePath, created }.
238
+ // Append an entry to the guide file (creates it with the header if missing). Returns { guidePath, created }.
239
239
  export function appendGuideEntry(targetRoot, report) {
240
240
  const guidePath = join(targetRoot, GUIDE_FILE);
241
241
  const entry = renderGuideEntry(report);
@@ -243,7 +243,7 @@ export function appendGuideEntry(targetRoot, report) {
243
243
  if (created) {
244
244
  writeText(guidePath, HEADER + "\n" + entry);
245
245
  } else {
246
- // append-only — 기존 엔트리 불변 (이력 보존 계약)
246
+ // append-only — existing entries never change (history preservation contract)
247
247
  const prev = readFileSync(guidePath, "utf8");
248
248
  appendFileSync(guidePath, (prev.endsWith("\n") ? "" : "\n") + entry);
249
249
  }
@@ -1,23 +1,23 @@
1
- // 레거시 마이그레이션 진입점 (#470) — 신호 기반·멱등.
2
- // 감지(registry × rules) → 계획 표시 → safe 티어 확인 1회 → 적용 → confirm 티어 안내.
3
- // 버전 번호를 믿지 않는다: 절반의 레거시 레포는 version.yml에 template 메타가 없다(실측).
1
+ // Legacy migration entry point (#470) — signal-based and idempotent.
2
+ // Detect (registry × rules) → show plan → confirm safe tier once → apply → notice for the confirm tier.
3
+ // Version numbers are not trusted: half of legacy repos have no template metadata in version.yml (measured).
4
4
  import { MIGRATIONS } from "./registry.js";
5
5
  import { t } from "../../i18n/index.js";
6
6
  import * as workflowRule from "./rules/obsolete-workflows.js";
7
7
  import * as rootFileRule from "./rules/root-files.js";
8
8
  import * as legacyDirRule from "./rules/legacy-dirs.js";
9
9
 
10
- // 사유는 화면 언어로 번역(reasonKey), 키가 없으면 원문 그대로
10
+ // Reasons are translated to the screen language (reasonKey); without a key, the original text as is
11
11
  const reasonOf = (e) => (e.reasonKey ? t(e.reasonKey) : e.reason);
12
12
 
13
13
  const RULES = {
14
14
  workflow: workflowRule,
15
15
  "root-file": rootFileRule,
16
16
  "legacy-dir": legacyDirRule,
17
- "util-file": rootFileRule, // #500 — util 모듈 내 폐기 파일: 정확 경로 삭제 (root-file rule 재사용)
17
+ "util-file": rootFileRule, // #500 — obsolete files inside util modules: exact-path delete (reuses the root-file rule)
18
18
  };
19
19
 
20
- // 대상 레포에서 레거시 잔재 감지. 반환: { safe: [entry], confirm: [entry], ask: [entry] }
20
+ // Detect legacy leftovers in the target repo. Returns { safe: [entry], confirm: [entry], ask: [entry] }
21
21
  export function detectMigrations(targetRoot = ".") {
22
22
  const safe = [];
23
23
  const confirm = [];
@@ -32,7 +32,7 @@ export function detectMigrations(targetRoot = ".") {
32
32
  return { safe, confirm, ask };
33
33
  }
34
34
 
35
- // 항목 일괄 적용 실행기 (safe·ask 티어 공용). 실패해도 나머지는 계속(부분 실패 허용 — 멱등이라 재실행으로 복구).
35
+ // Batch apply runner for entries (shared by the safe and ask tiers). Continues on failure (partial failure allowed — idempotent, so a re-run recovers).
36
36
  export function applySafeMigrations(targetRoot, entries) {
37
37
  const results = [];
38
38
  for (const entry of entries) {
@@ -45,12 +45,12 @@ export function applySafeMigrations(targetRoot, entries) {
45
45
  return results;
46
46
  }
47
47
 
48
- // 마법사 배선 진입점.
49
- // askYesNo - async(msg, defaultYes)→bool. null이면 비대화형(--force): safe 자동 적용
50
- // log - 한 줄 출력 함수 (기본 console.log)
51
- // removeLegacy - true면 confirm 티어(구세대 배포 워크플로우)도 .bak 무해화 (--remove-legacy, #809)
52
- // 반환: { applied: [결과], confirmPending: [entry], askPending: [entry] }
53
- // 폐기 워크플로에서 옮긴 설정 > 화면과 실행 기록용 줄 (사용자가 설정이 옮겨졌는지 확인, #1060)
48
+ // Wizard wiring entry point.
49
+ // askYesNo - async(msg, defaultYes)→bool. null means non-interactive (--force): safe applied automatically
50
+ // log - one-line output function (default console.log)
51
+ // removeLegacy - when true, also neutralize the confirm tier (old-generation deploy workflows) as .bak (--remove-legacy, #809)
52
+ // Returns { applied: [results], confirmPending: [entry], askPending: [entry] }
53
+ // Settings moved from obsolete workflows > lines for the screen and run log (lets the user confirm settings moved, #1060)
54
54
  export function describeCarriedSettings(results) {
55
55
  const lines = [];
56
56
  for (const result of results) {
@@ -89,7 +89,7 @@ export async function runMigrations({ targetRoot = ".", askYesNo = null, log = c
89
89
  }
90
90
  }
91
91
 
92
- // ask 티어 (#476) — 사용자 문서가 담긴 구명칭 폴더: 대화형은 확인 후 이동, 비대화형은 안내만
92
+ // ask tier (#476) — old-name folders holding user documents: interactive moves after confirmation, non-interactive only notifies
93
93
  let askPending = [];
94
94
  if (ask.length > 0) {
95
95
  log(t("migrate.dir.found", { n: ask.length }));
@@ -122,8 +122,8 @@ export async function runMigrations({ targetRoot = ".", askYesNo = null, log = c
122
122
  const arrow = e.replacedBy ? t("migrate.confirm.newer", { name: e.replacedBy }) : "";
123
123
  log(` • ${e.file}${arrow}: ${reasonOf(e)}`);
124
124
  }
125
- // 신·구 세대가 함께 돌면 같은 이벤트에 두 번 반응한다 (#809 — PR 닫힘마다 PREVIEW 두 벌).
126
- // 현역 배포일 수 있어 기본은 손대지 않되, 명시 플래그나 대화형 확인이 있으면 .bak 으로 치운다(복원 가능).
125
+ // When old and new generations run together, they react twice to the same event (#809 — two PREVIEWs on every PR close).
126
+ // It may be the live deploy, so it is left alone by default, but moved aside as .bak (restorable) with the explicit flag or interactive confirmation.
127
127
  const yes = removeLegacy
128
128
  ? true
129
129
  : askYesNo ? await askYesNo(t("migrate.confirm.ask", { n: confirm.length }), false) : false;
@@ -1,34 +1,34 @@
1
- // 레거시 마이그레이션 단일 레지스트리 (#470) — 유일한 관리 지점.
1
+ // Single registry for legacy migrations (#470) — the only place to manage them.
2
2
  //
3
- // ⚠️ 템플릿에서 워크플로우/루트 파일을 리네임·폐기하면 반드시 여기에 구 이름을 한 줄 추가한다.
4
- // (test/migrations.test.js가 "레지스트리 항목이 현행 배포 세트와 겹치지 않는지" 자동 검증)
3
+ // ⚠️ When the template renames or retires a workflow/root file, always add the old name here in one line.
4
+ // (test/migrations.test.js automatically checks "registry entries do not overlap the current shipped set")
5
5
  //
6
- // 항목 스키마:
7
- // id - 고유 식별자 (kebab-case)
8
- // category - "workflow" | "root-file" | "legacy-dir" | "util-file" (rules/ 폴더의 구현이 detect/apply 담당)
9
- // util-file: .github/util/ 모듈 안의 폐기 파일 — root-file rule 재사용(정확 경로 삭제).
10
- // util 복사(copy/util.js)는 overlay라 구 파일을 지우지 않는다 — 정리는 여기가 유일 경로.
11
- // tier - "safe" : 신형이 같은 기능을 대체(순수 리네임). 공존 시 이중 트리거 실해
12
- // → 확인 1회 후 자동 무해화(.bak) / 삭제
13
- // "confirm" : 배포 파이프라인일 수 있음(그 레포의 유일한 현역 배포 가능성)
14
- // → 기본은 건드리지 않고 완료 요약·doctor 에 목록만 안내한다.
15
- // --remove-legacy(비대화형) 또는 대화형 확인(기본 아니오)이 있을 때만 .bak 으로 무해화 (#809)
16
- // "ask" : 사용자 콘텐츠가 담긴 폴더 등 — 손실 없는 이동이지만 사용자 소유물 (#476)
17
- // → 대화형: 확인 후 이동 / 비대화형: 자동 조치 없이 안내만
18
- // file - 정확한 파일명 (글롭 금지 — 사용자 커스텀 보호의 핵심)
19
- // replacedBy - 대체 신형 파일명 (없으면 null)
20
- // since - 구 파일이 폐기된 템플릿 버전(참고용)
21
- // reason - 계획 카드에 표시할 사유
22
- // contentMarker - (선택) 파일명이 범용적일 때 오탐 방지용 내용 마커 — 이 문자열이
23
- // 파일 내용에 있을 때만 템플릿 소유로 판정
24
- // settingsExtractor - (선택) 무해화 직전 실행할 설정 이관기 이름
25
- // (rules/settings-extractors.js의 EXTRACTORS 키)
6
+ // Entry schema:
7
+ // id - unique identifier (kebab-case)
8
+ // category - "workflow" | "root-file" | "legacy-dir" | "util-file" (implementations in rules/ handle detect/apply)
9
+ // util-file: obsolete files inside .github/util/ modules — reuses the root-file rule (exact-path delete).
10
+ // The util copy (copy/util.js) is an overlay and does not delete old files — this is the only cleanup path.
11
+ // tier - "safe" : the new file replaces the same function (pure rename). Coexisting causes real double triggers
12
+ // → auto-neutralize (.bak) / delete after one confirmation
13
+ // "confirm" : may be a deploy pipeline (possibly the repo's only live deploy)
14
+ // → left alone by default; only listed in the finish summary and doctor.
15
+ // Neutralized as .bak only with --remove-legacy (non-interactive) or interactive confirmation (default no) (#809)
16
+ // "ask" : folders holding user content etc. — a lossless move, but owned by the user (#476)
17
+ // → interactive: move after confirmation / non-interactive: notice only, no automatic action
18
+ // file - exact file name (no globs — key to protecting user customizations)
19
+ // replacedBy - replacement new file name (null if none)
20
+ // since - template version that retired the old file (reference)
21
+ // reason - reason shown on the plan card
22
+ // contentMarker - (optional) content marker to avoid false hits when the file name is generic — owned by the
23
+ // template only when this string is in the file content
24
+ // settingsExtractor - (optional) name of the settings migrator to run right before neutralizing
25
+ // (key of EXTRACTORS in rules/settings-extractors.js)
26
26
  //
27
- // 데이터 출처: git 히스토리 삭제/리네임 전수 + 실제 통합 레포 14개 스캔 (2026-07-11, 설계 문서 참조)
27
+ // Data sources: full git history of deletes/renames + scan of 14 real integrated repos (2026-07-11, see design doc)
28
28
  import { tEn } from "../../i18n/index.js";
29
29
 
30
30
  export const MIGRATIONS = [
31
- // ── workflow / safe — 순수 리네임·대체 (공존 시 중복 실행 실해) ──────────────
31
+ // ── workflow / safe — pure renames/replacements (coexisting causes real duplicate runs) ──────────────
32
32
  { id: "wf-version-control", category: "workflow", tier: "safe",
33
33
  file: "PROJECT-VERSION-CONTROL.yaml", replacedBy: "PROJECT-COMMON-VERSION-CONTROL.yaml",
34
34
  since: "2.x", reasonKey: "migrate.reason.gen1VersionControl" },
@@ -53,7 +53,7 @@ export const MIGRATIONS = [
53
53
  { id: "wf-issue-helper-module", category: "workflow", tier: "safe",
54
54
  file: "PROJECT-COMMON-SUH-ISSUE-HELPER-MODULE.yml", replacedBy: "PROJECT-COMMON-SUH-ISSUE-HELPER.yaml",
55
55
  since: "4.3.0", reasonKey: "migrate.reason.helperModule",
56
- settingsExtractor: "suh-issue-helper-module" }, // 무해화 전 with: 커스텀 값을 version.yml로 이관
56
+ settingsExtractor: "suh-issue-helper-module" }, // Move with: custom values to version.yml before neutralizing
57
57
  { id: "wf-auto-changelog-v1", category: "workflow", tier: "safe",
58
58
  file: "PROJECT-AUTO-CHANGELOG-CONTROL.yaml", replacedBy: "PROJECT-COMMON-RELEASE-CHANGELOG.yaml",
59
59
  since: "2.x", reasonKey: "migrate.reason.releaseGen1" },
@@ -85,7 +85,7 @@ export const MIGRATIONS = [
85
85
  file: "PROJECT-FLUTTER-ANDROID-PR-CI.yaml", replacedBy: "PROJECT-FLUTTER-CI.yaml",
86
86
  since: "3.x", reasonKey: "migrate.reason.mergedCi" },
87
87
 
88
- // ── workflow / confirm — 배포/업로드 계열 (현역 배포일 수 있어 자동 조치 금지) ──
88
+ // ── workflow / confirm — deploy/upload kind (may be the live deploy, so no automatic action) ──
89
89
  { id: "wf-syn-spring-simple", category: "workflow", tier: "confirm",
90
90
  file: "PROJECT-SPRING-SYNOLOGY-SIMPLE-CICD.yaml", replacedBy: "PROJECT-SPRING-SIMPLE-CICD.yaml",
91
91
  since: "3.0.137", reasonKey: "migrate.reason.synSsh" },
@@ -107,10 +107,10 @@ export const MIGRATIONS = [
107
107
  { id: "wf-syn-secret-upload", category: "workflow", tier: "confirm",
108
108
  file: "PROJECT-COMMON-SYNOLOGY-SECRET-FILE-UPLOAD.yaml", replacedBy: "PROJECT-COMMON-SECRET-FILE-UPLOAD.yaml",
109
109
  since: "3.0.137", reasonKey: "migrate.reason.synSecret" },
110
- // #661 — 템플릿에서 사라졌는데 레거시로 잡히지 않던 릴리스 워크플로우. 이 파일의 trunk-based 분기는
111
- // 지금은 없는 `changelog_manager.py ai-summary` 를 불러 릴리스 때 실패한다. 그 레포의 유일한
112
- // 릴리스 경로일 수 있어 자동으로 건드리지 않고 안내만 한다. 같은 파일명을 쓰는 사용자 파일을
113
- // 오탐하지 않도록 내용 마커로 한 번 더 확인한다.
110
+ // #661 — release workflow gone from the template but not caught as legacy. Its trunk-based branch
111
+ // calls `changelog_manager.py ai-summary`, which no longer exists, and fails on release. It may be the repo's only
112
+ // release path, so it is not touched automatically, only reported. A content marker double-checks it so a user file
113
+ // with the same name is not misdetected.
114
114
  { id: "wf-release-publish-v1", category: "workflow", tier: "confirm",
115
115
  file: "PROJECT-COMMON-RELEASE-PUBLISH.yaml", replacedBy: "PROJECT-COMMON-RELEASE-CHANGELOG.yaml",
116
116
  since: "2.x", reasonKey: "migrate.reason.releasePublish1", contentMarker: "ai-summary" },
@@ -160,23 +160,23 @@ export const MIGRATIONS = [
160
160
  file: "PROJECT-DEPLOY-TRIGGER.yaml", replacedBy: null,
161
161
  since: "3.x", reasonKey: "migrate.reason.deployTrigger" },
162
162
 
163
- // ── root-file / safe — 구 설치 가이드 (사용자가 매번 수동 삭제하던 것) ─────────
163
+ // ── root-file / safe — old setup guides (the ones users deleted by hand every time) ─────────
164
164
  { id: "root-setup-guide-v2", category: "root-file", tier: "safe",
165
165
  file: "SUH-DEVOPS-TEMPLATE-SETUP-GUIDE.md", replacedBy: "PROJECTOPS-SETUP-GUIDE.md",
166
166
  since: "4.3.0", reasonKey: "migrate.reason.guideRebrand" },
167
167
  { id: "root-setup-guide-v1", category: "root-file", tier: "safe",
168
168
  file: "SETUP-GUIDE.md", replacedBy: "PROJECTOPS-SETUP-GUIDE.md",
169
169
  since: "2.x", reasonKey: "migrate.reason.guideOld",
170
- contentMarker: "SUH" }, // 범용 파일명이라 내용에 템플릿 마커가 있을 때만 소유 판정
170
+ contentMarker: "SUH" }, // Generic file name, so owned only when the content has the template marker
171
171
 
172
- // ── legacy-dir / ask — 구명칭 산출물 폴더 (사용자 문서 보존 이동, #476) ────────
172
+ // ── legacy-dir / ask — old-name output folders (moved, keeping user documents, #476) ────────
173
173
  { id: "dir-docs-suh-template", category: "legacy-dir", tier: "ask",
174
174
  file: "docs/suh-template", replacedBy: "docs/projectops",
175
175
  since: "4.2.9", reasonKey: "migrate.reason.docsDir" },
176
176
 
177
- // ── util-file / safe — Flutter 마법사 스크립트 Python 단일화 (#500) ──────────
178
- // 로컬 실행 도구라 CI 중복 실행 위험은 없지만, 신형 py와 공존 시 사용자가 구 스크립트를
179
- // 실행해 갈라진 동작을 볼 수 있다. 마법사 폴더에 사용자 상태가 없어 삭제가 기대 동작.
177
+ // ── util-file / safe — Flutter wizard scripts unified into Python (#500) ──────────
178
+ // Local tools, so no risk of duplicate CI runs, but alongside the new py a user could run an old script
179
+ // and see diverging behavior. The wizard folders hold no user state, so deletion is the expected behavior.
180
180
  { id: "util-playstore-setup-sh", category: "util-file", tier: "safe",
181
181
  file: ".github/util/flutter/playstore-wizard/playstore-wizard-setup.sh", replacedBy: "playstore-wizard.py",
182
182
  since: "4.3.0", reasonKey: "migrate.reason.wizSetup" },
@@ -215,8 +215,8 @@ export const MIGRATIONS = [
215
215
  since: "4.3.0", reasonKey: "migrate.reason.wizSetup" },
216
216
  ];
217
217
 
218
- // 사유는 영문 정본(tEn)으로 노출해 실행 로그·가이드에 그대로 쓰고,
219
- // 화면 표시는 reasonKey를 t()로 번역해 쓴다.
218
+ // Reasons are exposed as the English source (tEn) and used as is in run logs and guides;
219
+ // the screen translates reasonKey with t().
220
220
  for (const m of MIGRATIONS) {
221
221
  Object.defineProperty(m, "reason", { enumerable: true, get: () => tEn(m.reasonKey) });
222
222
  }
@@ -1,6 +1,6 @@
1
- // legacy-dir 카테고리 규칙 (#476) — 구명칭 산출물 폴더를 신명칭으로 이동.
2
- // 폴더 안은 사용자가 작성한 문서(이슈·보고서)라 삭제·무해화 대상이 아니다 — 손실 없는 이동만 한다.
3
- // 대상 폴더가 이미 있으면 재귀 병합하되 충돌 파일은 원위치에 남긴다(사용자 판단 존중).
1
+ // legacy-dir category rule (#476) — move old-name output folders to the new name.
2
+ // The folder holds user-written documents (issues, reports), so it is never deleted or neutralized — lossless move only.
3
+ // If the target folder exists, merge recursively, leaving conflicting files in place (respects the user's judgment).
4
4
  import { existsSync, statSync, readdirSync, renameSync, mkdirSync, rmdirSync } from "node:fs";
5
5
  import { join } from "node:path";
6
6
 
@@ -10,7 +10,7 @@ export function detect(targetRoot, entry) {
10
10
  catch { return false; }
11
11
  }
12
12
 
13
- // 재귀 병합: 파일은 대상에 없을 때만 이동, 하위 폴더는 재귀. 다 비운 원본 폴더는 제거.
13
+ // Recursive merge: files move only when absent at the target, subfolders recurse. Source folders emptied completely are removed.
14
14
  function mergeDir(from, to) {
15
15
  mkdirSync(to, { recursive: true });
16
16
  let moved = 0, skipped = 0;
@@ -21,12 +21,12 @@ function mergeDir(from, to) {
21
21
  const r = mergeDir(s, d);
22
22
  moved += r.moved; skipped += r.skipped;
23
23
  } else if (existsSync(d)) {
24
- skipped++; // 동명 파일 충돌 — 원위치에 남긴다
24
+ skipped++; // Same-name file conflict — leave it in place
25
25
  } else {
26
26
  renameSync(s, d); moved++;
27
27
  }
28
28
  }
29
- try { rmdirSync(from); } catch { /* 충돌 잔여로 비어있지 않으면 남긴다 */ }
29
+ try { rmdirSync(from); } catch { /* Not empty due to leftover conflicts — leave it */ }
30
30
  return { moved, skipped };
31
31
  }
32
32
 
@@ -1,5 +1,5 @@
1
- // workflow 카테고리 규칙 (#470) — .github/workflows/의 구 템플릿 워크플로우를 .bak으로 무해화.
2
- // GitHub Actions는 .yaml/.yml만 실행하므로 .bak 리네임 = 즉시 무해화 + 복원 가능.
1
+ // workflow category rule (#470) — neutralize old template workflows in .github/workflows/ as .bak.
2
+ // GitHub Actions runs only .yaml/.yml, so a .bak rename = instant neutralization + restorable.
3
3
  import { existsSync, readFileSync, renameSync, rmSync } from "node:fs";
4
4
  import { join } from "node:path";
5
5
  import { EXTRACTORS } from "./settings-extractors.js";
@@ -21,7 +21,7 @@ export function detect(targetRoot, entry) {
21
21
  }
22
22
 
23
23
  export function apply(targetRoot, entry) {
24
- // 무해화 전 설정 이관 (실패해도 무해화는 진행 — 부분 실패 허용 원칙)
24
+ // Migrate settings before neutralizing (neutralization proceeds even on failure — partial failure allowed)
25
25
  let carried = [];
26
26
  let carryFailed = null;
27
27
  if (entry.settingsExtractor && EXTRACTORS[entry.settingsExtractor]) {
@@ -30,7 +30,7 @@ export function apply(targetRoot, entry) {
30
30
  }
31
31
  const src = target(targetRoot, entry);
32
32
  const bak = `${src}.bak`;
33
- if (existsSync(bak)) rmSync(bak, { force: true }); // Windows rename은 대상 존재 시 실패
33
+ if (existsSync(bak)) rmSync(bak, { force: true }); // Windows rename fails when the target exists
34
34
  renameSync(src, bak);
35
35
  const result = { action: "bak", from: entry.file, to: `${entry.file}.bak` };
36
36
  if (carried.length > 0) result.carried = carried;
@@ -1,5 +1,5 @@
1
- // root-file 카테고리 규칙 (#470) — 레포 루트의 구 템플릿 문서를 삭제.
2
- // 문서라 무해화가 필요 없고, 사용자가 매번 수동 삭제하던 잔재라 delete가 기대 동작.
1
+ // root-file category rule (#470) — delete old template docs at the repo root.
2
+ // They are docs, so no neutralization is needed; users deleted these leftovers by hand every time, so delete is expected.
3
3
  import { existsSync, readFileSync, rmSync } from "node:fs";
4
4
  import { join } from "node:path";
5
5
 
@@ -10,7 +10,7 @@ function target(targetRoot, entry) {
10
10
  export function detect(targetRoot, entry) {
11
11
  const p = target(targetRoot, entry);
12
12
  if (!existsSync(p)) return false;
13
- // 범용 파일명 오탐 방지 — contentMarker가 있으면 내용까지 확인해야 템플릿 소유로 판정
13
+ // Avoid false hits on generic file names — with a contentMarker, the content must also match to count as template-owned
14
14
  if (entry.contentMarker) {
15
15
  try { return readFileSync(p, "utf8").includes(entry.contentMarker); }
16
16
  catch { return false; }