projectops 4.104.6 → 4.104.7
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/README.md +1 -1
- package/bin/projectops.js +4 -4
- package/package.json +1 -1
- package/src/cli/args.js +43 -43
- package/src/cli/errors.js +8 -8
- package/src/cli/help.js +4 -4
- package/src/commands/doctor.js +39 -39
- package/src/commands/full.js +29 -29
- package/src/commands/interactive.js +86 -86
- package/src/commands/issues.js +5 -5
- package/src/commands/skills.js +13 -13
- package/src/commands/version.js +8 -8
- package/src/commands/workflows.js +19 -19
- package/src/context.js +24 -24
- package/src/core/agent-guide.js +5 -5
- package/src/core/assets.js +11 -11
- package/src/core/baseline.js +24 -24
- package/src/core/branch-sub.js +23 -23
- package/src/core/breaking-check.js +21 -21
- package/src/core/breaking.js +6 -6
- package/src/core/ci-minutes-sub.js +13 -13
- package/src/core/constants.js +17 -17
- package/src/core/copy/coderabbit.js +10 -10
- package/src/core/copy/gitignore.js +9 -9
- package/src/core/copy/readme.js +7 -7
- package/src/core/copy/simple.js +35 -35
- package/src/core/copy/util.js +9 -9
- package/src/core/copy/workflows.js +99 -99
- package/src/core/detect-fs.js +21 -21
- package/src/core/detect.js +12 -12
- package/src/core/development-branch.js +11 -11
- package/src/core/exclusions.js +12 -12
- package/src/core/fsutil.js +9 -9
- package/src/core/git-branch.js +11 -11
- package/src/core/ide/adapter.js +23 -23
- package/src/core/ide/adapters/claude.js +12 -12
- package/src/core/ide/adapters/codex.js +4 -4
- package/src/core/ide/adapters/copilot.js +12 -12
- package/src/core/ide/adapters/cursor.js +7 -7
- package/src/core/ide/adapters/gemini.js +5 -5
- package/src/core/ide/adapters/pi-common.js +12 -12
- package/src/core/ide/adapters/pi-harness.js +7 -7
- package/src/core/ide/adapters/pi.js +3 -3
- package/src/core/ide/home-skills.js +6 -6
- package/src/core/ide/legacy.js +8 -8
- package/src/core/ide/registry.js +6 -6
- package/src/core/ide/runner.js +15 -15
- package/src/core/ide/skills-copy.js +34 -34
- package/src/core/ide/stable-entry.js +11 -11
- package/src/core/ide/util.js +4 -4
- package/src/core/incoming.js +13 -13
- package/src/core/label-style.js +12 -12
- package/src/core/migration-guide.js +19 -19
- package/src/core/migrations/index.js +16 -16
- package/src/core/migrations/registry.js +39 -39
- package/src/core/migrations/rules/legacy-dirs.js +6 -6
- package/src/core/migrations/rules/obsolete-workflows.js +4 -4
- package/src/core/migrations/rules/root-files.js +3 -3
- package/src/core/migrations/rules/settings-extractors.js +8 -8
- package/src/core/options-ask.js +104 -104
- package/src/core/options-schema.js +23 -23
- package/src/core/orphan-workflows.js +14 -14
- package/src/core/paths-resolve.js +54 -54
- package/src/core/paths.js +2 -2
- package/src/core/placeholder-triggers.js +10 -10
- package/src/core/repo-language.js +10 -10
- package/src/core/resolve-options.js +30 -30
- package/src/core/run-trace.js +54 -54
- package/src/core/store-locales-hint.js +13 -13
- package/src/core/verify.js +27 -27
- package/src/core/version-yml.js +115 -115
- package/src/core/wizard-env.js +42 -42
- package/src/core/wizard-labels.js +31 -31
- package/src/core/workflow-groups.js +14 -14
- package/src/i18n/core.en.js +1 -1
- package/src/i18n/doctor.en.js +1 -1
- package/src/i18n/ide.en.js +1 -1
- package/src/i18n/migrate.en.js +1 -1
- package/src/i18n/options.en.js +1 -1
- package/src/index.js +60 -60
- package/src/ui/ansi.js +5 -5
- package/src/ui/env-plan.js +44 -44
- package/src/ui/prompts.js +21 -21
- package/src/ui/readline-engine.js +38 -38
- package/src/ui/skills-prompts.js +4 -4
package/src/core/incoming.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
//
|
|
2
|
-
//
|
|
3
|
-
//
|
|
4
|
-
//
|
|
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
|
-
//
|
|
9
|
+
// The folder carries its own ignore rule (same as logs/.gitignore; the root .gitignore is untouched)
|
|
10
10
|
export const INCOMING_GITIGNORE = [
|
|
11
|
-
"#
|
|
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
|
-
//
|
|
25
|
-
// removed:
|
|
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
|
-
//
|
|
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);
|
package/src/core/label-style.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
|
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
|
-
//
|
|
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
|
-
//
|
|
2
|
-
//
|
|
3
|
-
// "
|
|
4
|
-
//
|
|
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
|
-
//
|
|
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
|
|
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 —
|
|
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 →
|
|
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
|
-
//
|
|
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
|
|
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 —
|
|
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
|
-
//
|
|
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
|
-
//
|
|
2
|
-
//
|
|
3
|
-
//
|
|
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
|
-
//
|
|
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 —
|
|
17
|
+
"util-file": rootFileRule, // #500 — obsolete files inside util modules: exact-path delete (reuses the root-file rule)
|
|
18
18
|
};
|
|
19
19
|
|
|
20
|
-
//
|
|
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
|
-
//
|
|
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
|
|
50
|
-
// log -
|
|
51
|
-
// removeLegacy - true
|
|
52
|
-
//
|
|
53
|
-
//
|
|
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
|
|
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
|
-
//
|
|
126
|
-
//
|
|
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
|
-
//
|
|
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 -
|
|
8
|
-
// category - "workflow" | "root-file" | "legacy-dir" | "util-file" (rules/
|
|
9
|
-
// util-file: .github/util/
|
|
10
|
-
// util
|
|
11
|
-
// tier - "safe" :
|
|
12
|
-
// →
|
|
13
|
-
// "confirm" :
|
|
14
|
-
// →
|
|
15
|
-
// --remove-legacy(
|
|
16
|
-
// "ask" :
|
|
17
|
-
// →
|
|
18
|
-
// file -
|
|
19
|
-
// replacedBy -
|
|
20
|
-
// since -
|
|
21
|
-
// reason -
|
|
22
|
-
// contentMarker - (
|
|
23
|
-
//
|
|
24
|
-
// settingsExtractor - (
|
|
25
|
-
// (rules/settings-extractors.js
|
|
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
|
-
//
|
|
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" }, //
|
|
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 —
|
|
111
|
-
//
|
|
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 —
|
|
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
|
|
178
|
-
//
|
|
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
|
-
//
|
|
219
|
-
//
|
|
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
|
|
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
|
|
2
|
-
// GitHub Actions
|
|
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
|
|
2
|
-
//
|
|
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
|
-
//
|
|
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; }
|