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/commands/full.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
// full
|
|
2
|
-
//
|
|
3
|
-
// util(
|
|
1
|
+
// full mode orchestrator.
|
|
2
|
+
// Copy order: version.yml → readme → workflows → (deploy block) → scripts → config →
|
|
3
|
+
// util (per type) → issue → discussion → coderabbit → gitignore → setup_guide → (save options)
|
|
4
4
|
import { join } from "node:path";
|
|
5
5
|
import { existsSync, readFileSync } from "node:fs";
|
|
6
6
|
import { writeText } from "../core/fsutil.js";
|
|
@@ -25,87 +25,87 @@ import { toTemplateOptions } from "../core/resolve-options.js";
|
|
|
25
25
|
|
|
26
26
|
// context: { version, types, paths:Map, branch, versionCode, deployTarget, publishTargets, includeSecretBackup,
|
|
27
27
|
// force, repoName, resolvers, now, today }
|
|
28
|
-
// tempDir:
|
|
28
|
+
// tempDir: the fetched template. targetRoot: the integration target.
|
|
29
29
|
export function runFull(context, tempDir, targetRoot = ".", hooks = {}) {
|
|
30
|
-
//
|
|
30
|
+
// Option values are decided by resolveOptions and put in context — defaults are not picked again here
|
|
31
31
|
const { version, types = [], paths = new Map(), branch = "main", versionCode = 1,
|
|
32
32
|
force = true, now, today, templateVersion, deployBranch = "",
|
|
33
33
|
deployTarget, publishTargets, codeReviewCoderabbit, labelStyle, language } = context;
|
|
34
34
|
|
|
35
|
-
// project_paths
|
|
35
|
+
// project_paths marker computation (main marker names)
|
|
36
36
|
const pathMarkers = new Map();
|
|
37
37
|
for (const [t] of paths) pathMarkers.set(t, markerForType(t));
|
|
38
38
|
|
|
39
|
-
// 3.
|
|
40
|
-
// hooks.decisions:
|
|
39
|
+
// 3. Copy workflows (+ env substitution) — collects the ask values for the deploy block.
|
|
40
|
+
// hooks.decisions: Map of interactive 3-way conflict decisions (unset = skip — current force behavior)
|
|
41
41
|
const step = (name, fn, d) => (hooks.trace ? hooks.trace.step(name, fn, d) : fn());
|
|
42
42
|
const wfCounters = step("copy-workflows", () => copyWorkflows(context, tempDir, targetRoot, hooks),
|
|
43
43
|
{ types, deploy: deployTarget, publish: publishTargets });
|
|
44
|
-
//
|
|
44
|
+
// Keep the deploy values of the existing version.yml (#670) — it is fully regenerated, so without reading them user edits vanish.
|
|
45
45
|
const vyFile = join(targetRoot, PATHS.versionFile);
|
|
46
46
|
const deployValues = mergeDeployValues(existsSync(vyFile) ? readFileSync(vyFile, "utf8") : "",
|
|
47
47
|
wfCounters.deployValues || new Map()); // Map<type, Map<key,value>
|
|
48
48
|
|
|
49
|
-
// 1. version.yml
|
|
49
|
+
// 1. Generate version.yml (full regeneration — metadata → deploy → template order)
|
|
50
50
|
step("write-version-yml", () => writeText(join(targetRoot, PATHS.versionFile),
|
|
51
51
|
buildVersionYml({
|
|
52
52
|
version, types, paths, pathMarkers, branch, deployBranch, versionCode, now, today,
|
|
53
53
|
deployValues,
|
|
54
|
-
//
|
|
54
|
+
// Keep keys the generator does not know (issue_helper, etc.) — version.yml is rewritten every time, so otherwise they vanish on every update (#835)
|
|
55
55
|
...customYml(vyFile),
|
|
56
56
|
updatedBy: resolveUpdatedBy(existsSync(vyFile) ? readFileSync(vyFile, "utf8") : "", targetRoot), // #811
|
|
57
57
|
templateOptions: toTemplateOptions(context, { mode: "full", optionsDate: today }),
|
|
58
58
|
})), { version, versionCode });
|
|
59
59
|
|
|
60
|
-
// 2. README
|
|
60
|
+
// 2. README version section
|
|
61
61
|
step("update-readme", () => addVersionSectionToReadme(version, targetRoot, language), { version });
|
|
62
62
|
|
|
63
63
|
// 5. scripts / config
|
|
64
|
-
//
|
|
64
|
+
// Areas outside workflows are recorded too (#561) — so the log alone shows "were my scripts updated".
|
|
65
65
|
step("copy-scripts", () => copyScripts(tempDir, targetRoot));
|
|
66
66
|
step("copy-config", () => copyConfigFolder(tempDir, targetRoot));
|
|
67
67
|
|
|
68
|
-
// 6. util (
|
|
68
|
+
// 6. util (per type)
|
|
69
69
|
for (const t of types) step("copy-util", () => copyUtilModules(tempDir, t, { force }, targetRoot), { type: t });
|
|
70
70
|
|
|
71
|
-
// 7. issue / discussion
|
|
71
|
+
// 7. issue / discussion templates
|
|
72
72
|
step("copy-templates", () => {
|
|
73
73
|
copyIssueTemplates(tempDir, targetRoot);
|
|
74
|
-
// Discussion
|
|
74
|
+
// Discussion templates are overlay targets too (#988) — must be copied before the overlay so the Korean version covers them
|
|
75
75
|
copyDiscussionTemplates(tempDir, targetRoot);
|
|
76
|
-
//
|
|
77
|
-
//
|
|
76
|
+
// Template language (#769) — the source is English, so Korean repos are covered by the overlay right after copying.
|
|
77
|
+
// Must come before the label style conversion (apply-label-style).
|
|
78
78
|
const { changed: overlaid, failed: overlayFailed } = applyRepoLanguage(tempDir, targetRoot, language);
|
|
79
79
|
hooks.trace?.event("copy", "repo-language", language, { overlaid: overlaid.length, failed: overlayFailed.length });
|
|
80
80
|
for (const f of overlayFailed) hooks.trace?.event("copy", "overlay-failed", f.file, { reason: f.error });
|
|
81
|
-
//
|
|
81
|
+
// Remove the fixed assignee (#782) — done after the overlay, since the overlay puts it back.
|
|
82
82
|
hooks.trace?.event("copy", "strip-assignees", "", { files: stripIssueTemplateAssignees(targetRoot).length });
|
|
83
83
|
if (overlayFailed.length) console.error(t("language.overlayFailed", { n: overlayFailed.length, files: overlayFailed.map((f) => f.file).join(", ") }));
|
|
84
84
|
});
|
|
85
85
|
|
|
86
86
|
// 8. coderabbit / gitignore / setup guide
|
|
87
|
-
// CodeRabbit
|
|
87
|
+
// If CodeRabbit code review is not used (#457), .coderabbit.yaml is not copied.
|
|
88
88
|
step("copy-coderabbit", () => copyCoderabbit(tempDir, { force, enabled: codeReviewCoderabbit }, targetRoot),
|
|
89
89
|
{ enabled: codeReviewCoderabbit });
|
|
90
90
|
step("ensure-gitignore", () => ensureGitignore(targetRoot));
|
|
91
91
|
step("copy-setup-guide", () => copySetupGuide(tempDir, targetRoot));
|
|
92
|
-
step("install-agent-guide", () => installAgentGuide(targetRoot, templateVersion)); //
|
|
92
|
+
step("install-agent-guide", () => installAgentGuide(targetRoot, templateVersion)); // Tells agents how to check options
|
|
93
93
|
|
|
94
|
-
//
|
|
94
|
+
// Status label style (#776) — the template source is English, so Korean repos rename back after copying is done.
|
|
95
95
|
step("apply-label-style", () => applyLabelStyle(targetRoot, labelStyle), { labelStyle });
|
|
96
96
|
|
|
97
|
-
// 9.
|
|
98
|
-
//
|
|
99
|
-
//
|
|
97
|
+
// 9. Post-install verification (#549) — rereads the final result written to disk.
|
|
98
|
+
// Substitution happens scattered per file and auto tokens depend on resolver results,
|
|
99
|
+
// so looking at the final content is the only way to see what will actually deploy.
|
|
100
100
|
const verification = step("verify-install", () => verifyInstall(targetRoot));
|
|
101
|
-
// detail
|
|
102
|
-
//
|
|
103
|
-
// "
|
|
101
|
+
// Mind the detail key names: the run-trace sensitive value guard filters pat|token|secret|password|credential
|
|
102
|
+
// out of keys (#494). These values are not secrets but "substitution placeholder names" and
|
|
103
|
+
// "key names that need registering", so names that do not trip the guard are used — the guard itself is not bypassed.
|
|
104
104
|
hooks.trace?.event("verify", "scan", "", {
|
|
105
105
|
unresolved: verification.unresolved.length,
|
|
106
106
|
requiredKeys: verification.secrets.size,
|
|
107
107
|
});
|
|
108
|
-
//
|
|
108
|
+
// Unreplaced values are spots that will fail at deploy time — log which file and line.
|
|
109
109
|
for (const u of verification.unresolved) {
|
|
110
110
|
hooks.trace?.event("verify", "unresolved", u.filename, { line: u.line, placeholder: u.token });
|
|
111
111
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
//
|
|
2
|
-
// io
|
|
3
|
-
//
|
|
4
|
-
//
|
|
1
|
+
// Interactive wizard (#446 UI, 5 layers).
|
|
2
|
+
// Testable via io injection. A real run passes the src/ui/prompts.js functions as io.
|
|
3
|
+
// The new visual layers (banner/detectionLog/analysisCard/ideStatus/installKind/summary) and the low-level engine (engineIo) are
|
|
4
|
+
// "optional members" of io — if a stub omits one, only that layer is skipped and the run contract stays the same.
|
|
5
5
|
import { resolveOptions } from "../core/resolve-options.js";
|
|
6
6
|
import { detectStoreLocalesHint } from "../core/store-locales-hint.js";
|
|
7
7
|
import { join } from "node:path";
|
|
@@ -37,56 +37,56 @@ import { printSummary } from "../ui/summary.js";
|
|
|
37
37
|
const CANCEL = prompts.CANCEL;
|
|
38
38
|
const isCancel = (v) => v === CANCEL || typeof v === "symbol";
|
|
39
39
|
|
|
40
|
-
// io
|
|
41
|
-
// skills = runSkills
|
|
40
|
+
// io default = real prompts. Tests inject a stub io.
|
|
41
|
+
// skills = injection point for runSkills (so tests do not touch real IDE CLIs). Default is the real runSkills.
|
|
42
42
|
export async function runInteractive(baseCtx, { cwd = process.cwd(), source = { type: "git" }, clock, io = prompts, skills = runSkills } = {}) {
|
|
43
43
|
const tempDir = join(cwd, PATHS.tempDir);
|
|
44
|
-
//
|
|
44
|
+
// Run trace (#494) — the terminal mirror is on only in the real CLI (io=prompts) (test stub io records events only).
|
|
45
45
|
const trace = createRunTrace();
|
|
46
|
-
// Ctrl+C
|
|
46
|
+
// The record stays even when cut off with Ctrl+C (#561) — people often stop the interactive wizard midway.
|
|
47
47
|
const disarmSignals = trace.armSignals({ targetRoot: cwd, now: clock?.now || "" });
|
|
48
|
-
//
|
|
48
|
+
// Values used when recording in finally — kept outside because a cancel may come before try settles them (#561).
|
|
49
49
|
let traceFrom = "";
|
|
50
50
|
let traceTo = "";
|
|
51
|
-
//
|
|
51
|
+
// Whether this mode leaves record files — false by default since a cancel may come before mode selection.
|
|
52
52
|
let recordArtifacts = false;
|
|
53
|
-
//
|
|
54
|
-
//
|
|
53
|
+
// true only when ending without a record (normal finish of version/issues modes).
|
|
54
|
+
// Cancels and exceptions are recorded regardless of mode — when cut off is exactly when "how far did it get" matters most.
|
|
55
55
|
let skipRecord = false;
|
|
56
56
|
if (io === prompts) trace.mirrorStart();
|
|
57
57
|
try {
|
|
58
|
-
//
|
|
59
|
-
//
|
|
58
|
+
// Fetch the template first — the banner shows the real template version
|
|
59
|
+
// Interactive also installs/updates skills at the end > keep scripts/common (#994)
|
|
60
60
|
trace.step("acquire-template", () => acquireTemplate({ tempDir, source, keep: [SHARED_SCRIPTS_DIR_NAME] }), { source: source?.type || "git" });
|
|
61
61
|
const templateVersion = readTemplateVersion(tempDir);
|
|
62
62
|
traceTo = templateVersion;
|
|
63
63
|
|
|
64
|
-
//
|
|
64
|
+
// Layer 1 — start banner (#446 settled mockup A). Stubs have no banner → intro fallback.
|
|
65
65
|
if (io.banner) io.banner({ version: templateVersion, modeLabel: t("banner.interactive") });
|
|
66
66
|
else io.intro?.(`projectops, ${t("banner.interactive")}`);
|
|
67
67
|
|
|
68
|
-
//
|
|
68
|
+
// Existing version.yml — single source of truth for keeping version/version_code/paths/options
|
|
69
69
|
const vyPath = join(cwd, "version.yml");
|
|
70
70
|
const existing = existsSync(vyPath) ? parseExisting(readFileSync(vyPath, "utf8")) : null;
|
|
71
71
|
traceFrom = existing?.templateVersion || "";
|
|
72
72
|
|
|
73
|
-
//
|
|
73
|
+
// Layer 4 — current IDE skills status · Layer 5 — new vs. update (#446)
|
|
74
74
|
io.installKind?.({ currentTemplateVersion: existing?.templateVersion || "", templateVersion });
|
|
75
75
|
|
|
76
|
-
// 1)
|
|
76
|
+
// 1) Mode selection — for an already integrated repo, show the update item at the top (#502)
|
|
77
77
|
const updateInfo = existing?.templateVersion ? { from: existing.templateVersion, to: templateVersion } : null;
|
|
78
|
-
//
|
|
78
|
+
// Run boundary (#561) — for interactive, what the person chose is the key record.
|
|
79
79
|
trace.event("run", "start", "interactive", { templateVersion, isUpdate: !!updateInfo });
|
|
80
80
|
const picked = await io.selectMode(updateInfo ? { update: updateInfo } : {});
|
|
81
81
|
trace.event("prompt", "mode", String(picked ?? ""), { update: !!updateInfo });
|
|
82
82
|
if (picked === CANCEL || picked == null) { trace.event("run", "cancelled", "mode-select", { reason: "user-cancel" }); io.cancelMessage?.(t("flow.cancelInstall")); return 0; }
|
|
83
|
-
//
|
|
84
|
-
//
|
|
83
|
+
// Update mode (#502): re-runs the saved integration scope (templateMode, full if missing),
|
|
84
|
+
// and the updateRun branches below minimize questions ("apply the saved settings as is" is the contract).
|
|
85
85
|
const updateRun = picked === "update";
|
|
86
86
|
const mode = updateRun ? (existing?.templateMode || "full") : picked;
|
|
87
87
|
|
|
88
|
-
// Breaking
|
|
89
|
-
let breakingReport = null; // #493 —
|
|
88
|
+
// Breaking changes gate (all modes; interactive asks for confirmation)
|
|
89
|
+
let breakingReport = null; // #493 — embeds the full action steps of entries in range into the guide
|
|
90
90
|
const proceed = await trace.stepAsync("breaking-check", () => runBreakingCheck({
|
|
91
91
|
cwd, tempDir, templateVersion,
|
|
92
92
|
askYesNo: (msg, def) => io.askYesNo(msg, def),
|
|
@@ -94,7 +94,7 @@ export async function runInteractive(baseCtx, { cwd = process.cwd(), source = {
|
|
|
94
94
|
}));
|
|
95
95
|
if (!proceed) { trace.event("run", "cancelled", "breaking-gate", { reason: "user-declined" }); io.cancelMessage?.(t("flow.cancelBreaking")); return 0; }
|
|
96
96
|
|
|
97
|
-
// skills
|
|
97
|
+
// skills mode — install IDE skills (no template integration). Runs interactively.
|
|
98
98
|
if (mode === "skills") {
|
|
99
99
|
io.ideStatus?.();
|
|
100
100
|
await skills({ templateVersion, tempDir, interactive: true });
|
|
@@ -102,10 +102,10 @@ export async function runInteractive(baseCtx, { cwd = process.cwd(), source = {
|
|
|
102
102
|
return 0;
|
|
103
103
|
}
|
|
104
104
|
|
|
105
|
-
// issues
|
|
105
|
+
// issues mode runs right away without gathering info
|
|
106
106
|
if (mode === "issues") {
|
|
107
|
-
//
|
|
108
|
-
// runIssues
|
|
107
|
+
// Existing repos keep the saved template language and label style. Starting from an empty baseCtx would make both null,
|
|
108
|
+
// applying runIssues' default (en) and silently switching existing Korean repos without the key to English (#769).
|
|
109
109
|
const ctx = createContext({
|
|
110
110
|
...baseCtx, mode, force: true,
|
|
111
111
|
language: resolveRepoLanguage({ flag: null, stored: existing?.options?.language, existing: !!existing }),
|
|
@@ -117,9 +117,9 @@ export async function runInteractive(baseCtx, { cwd = process.cwd(), source = {
|
|
|
117
117
|
return 0;
|
|
118
118
|
}
|
|
119
119
|
|
|
120
|
-
// full/version/workflows —
|
|
120
|
+
// full/version/workflows — detection (version: existing version.yml first)
|
|
121
121
|
let types = detectTypes(cwd);
|
|
122
|
-
//
|
|
122
|
+
// Update mode — saved types first (so re-detection does not shake the type set, #502)
|
|
123
123
|
if (updateRun && existing?.types?.length) {
|
|
124
124
|
const saved = existing.types.filter((t) => VALID_TYPES.includes(t));
|
|
125
125
|
if (saved.length) types = saved;
|
|
@@ -127,9 +127,9 @@ export async function runInteractive(baseCtx, { cwd = process.cwd(), source = {
|
|
|
127
127
|
let version = (existing?.version) || detectVersion(cwd);
|
|
128
128
|
let branch = detectDefaultBranch(cwd);
|
|
129
129
|
const repoName = detectRepoName(cwd);
|
|
130
|
-
const versionCode = existing?.versionCode ?? 1; //
|
|
131
|
-
//
|
|
132
|
-
//
|
|
130
|
+
const versionCode = existing?.versionCode ?? 1; // Keep the existing build number
|
|
131
|
+
// Initial option values come from resolve-options.js, same as non-interactive (#851).
|
|
132
|
+
// Modes that skip questions (version, etc.) record these values as is, so they must already include the type applicability cleanup.
|
|
133
133
|
const { values: init, sources: initSources } = resolveOptions({ existing, types, cwd });
|
|
134
134
|
let deployTarget = init.deployTarget;
|
|
135
135
|
let publishTargets = init.publishTargets;
|
|
@@ -138,20 +138,20 @@ export async function runInteractive(baseCtx, { cwd = process.cwd(), source = {
|
|
|
138
138
|
let codeReviewCoderabbit = init.codeReviewCoderabbit;
|
|
139
139
|
let changelogProvider = init.changelogProvider;
|
|
140
140
|
let changelogBaseUrl = init.changelogBaseUrl;
|
|
141
|
-
let deployBranch = init.deployBranch; // #456 —
|
|
142
|
-
let deployBranchReady = null; // #490 —
|
|
143
|
-
let deployBranchCreated = null; // #493 —
|
|
144
|
-
let intent = init.intent; // #485
|
|
145
|
-
//
|
|
141
|
+
let deployBranch = init.deployBranch; // #456 — not recorded when empty. Only a value picked in the question is kept
|
|
142
|
+
let deployBranchReady = null; // #490 — whether the development branch was confirmed/created in this run
|
|
143
|
+
let deployBranchCreated = null; // #493 — whether the wizard created it (for the guide record)
|
|
144
|
+
let intent = init.intent; // #485 project nature
|
|
145
|
+
// Values not asked — the saved-value rule lives in resolve-options.js
|
|
146
146
|
const { semverAuto, appRelease, closeOnRelease, excludedWorkflows, storeLocales, storeLocalesIos, storeLocalesPlay, projectsSync, deployTriggerBranch, ciMinutesSaver } = init;
|
|
147
147
|
const semverAutoNewlyOn = initSources.semverAutoNewlyOn;
|
|
148
|
-
//
|
|
148
|
+
// Repo text language (#769) and label style (#776): existing repos get the English switch offered only once (below).
|
|
149
149
|
let language = init.language;
|
|
150
150
|
let labelStyle = init.labelStyle;
|
|
151
151
|
const showOptional = mode === "full" || mode === "workflows";
|
|
152
152
|
const realTty = process.stdout.isTTY === true;
|
|
153
|
-
//
|
|
154
|
-
//
|
|
153
|
+
// Existing repos with Korean labels get the English standard switch offered only once (#776). If declined, Korean is saved so it is not asked again.
|
|
154
|
+
// from_name in the label definitions carries over the labels attached to issues, so issue history is kept.
|
|
155
155
|
if (existing && !existing.options?.labelStyle && realTty && showOptional && io.askYesNo) {
|
|
156
156
|
const adopt = await io.askYesNo(t("labelStyle.propose"), false);
|
|
157
157
|
labelStyle = adopt ? "en" : "ko";
|
|
@@ -161,10 +161,10 @@ export async function runInteractive(baseCtx, { cwd = process.cwd(), source = {
|
|
|
161
161
|
language = adopt ? "en" : "ko";
|
|
162
162
|
}
|
|
163
163
|
|
|
164
|
-
//
|
|
164
|
+
// Layer 2 — detection log (#446)
|
|
165
165
|
io.detectionLog?.({ types, version, branch });
|
|
166
166
|
|
|
167
|
-
//
|
|
167
|
+
// Deploy/publish axes + secret backup questions (#439 — full/workflows only)
|
|
168
168
|
if (showOptional) {
|
|
169
169
|
const r = await askAllOptionalWorkflows({
|
|
170
170
|
tempDir, types, targetRoot: cwd, defaultBranch: branch,
|
|
@@ -188,7 +188,7 @@ export async function runInteractive(baseCtx, { cwd = process.cwd(), source = {
|
|
|
188
188
|
publishTargets = r.publish;
|
|
189
189
|
includeSecretBackup = r.secretBackup;
|
|
190
190
|
codeReviewCoderabbit = r.codeReviewCoderabbit;
|
|
191
|
-
aiPrSummary = r.aiPrSummary; // #851 —
|
|
191
|
+
aiPrSummary = r.aiPrSummary; // #851 — was missing, so the PR summary choice was dropped
|
|
192
192
|
changelogProvider = r.changelogProvider;
|
|
193
193
|
changelogBaseUrl = r.changelogBaseUrl;
|
|
194
194
|
deployBranch = r.deployBranch;
|
|
@@ -197,10 +197,10 @@ export async function runInteractive(baseCtx, { cwd = process.cwd(), source = {
|
|
|
197
197
|
intent = r.intent;
|
|
198
198
|
}
|
|
199
199
|
|
|
200
|
-
//
|
|
200
|
+
// Confirm/edit loop — ESC means 'stay' (only an explicit 'no' exits)
|
|
201
201
|
let paths = new Map();
|
|
202
202
|
let confirmed = false;
|
|
203
|
-
//
|
|
203
|
+
// Update mode — show the card but skip the confirm loop (#502: changing settings belongs to the existing modes)
|
|
204
204
|
if (updateRun) {
|
|
205
205
|
if (io.analysisCard) {
|
|
206
206
|
io.analysisCard({ mode, modeLabel: t("flow.updateScope", { scope: modeLabel(mode) }), types, version, branch, deployTarget, publishTargets, includeSecretBackup, showOptional, paths });
|
|
@@ -210,7 +210,7 @@ export async function runInteractive(baseCtx, { cwd = process.cwd(), source = {
|
|
|
210
210
|
confirmed = true;
|
|
211
211
|
}
|
|
212
212
|
while (!confirmed) {
|
|
213
|
-
//
|
|
213
|
+
// Layer 3 — project analysis overview card (#446). Missing in stubs → note fallback.
|
|
214
214
|
if (io.analysisCard) {
|
|
215
215
|
io.analysisCard({ mode, modeLabel: modeLabel(mode), types, version, branch, deployTarget, publishTargets, includeSecretBackup, showOptional, paths });
|
|
216
216
|
} else {
|
|
@@ -218,19 +218,19 @@ export async function runInteractive(baseCtx, { cwd = process.cwd(), source = {
|
|
|
218
218
|
}
|
|
219
219
|
const choice = await io.confirmProjectMenu();
|
|
220
220
|
if (choice === "cancel") { trace.event("run", "cancelled", "confirm-loop", { reason: "user-cancel" }); io.cancelMessage?.(t("flow.cancelInstall")); return 0; }
|
|
221
|
-
if (isCancel(choice) || choice == null) continue; // ESC =
|
|
221
|
+
if (isCancel(choice) || choice == null) continue; // ESC = stay (redraw the loop)
|
|
222
222
|
if (choice === "continue") { confirmed = true; break; }
|
|
223
|
-
// edit
|
|
223
|
+
// edit loop
|
|
224
224
|
let editing = true;
|
|
225
225
|
while (editing) {
|
|
226
|
-
// #498 —
|
|
226
|
+
// #498 — hide deploy axis items that do not apply to the types (shown again from the next entry if types change)
|
|
227
227
|
const what = await io.editMenu({ showOptional, axes: applicableTargets(types) });
|
|
228
228
|
if (isCancel(what) || what === "done") { editing = false; break; }
|
|
229
229
|
if (what === "type") {
|
|
230
230
|
const t = await io.selectTypes(types);
|
|
231
231
|
trace.event("prompt", "types", (Array.isArray(t) ? t : []).join(",") || "", { before: types });
|
|
232
232
|
if (!isCancel(t) && Array.isArray(t) && t.length) {
|
|
233
|
-
//
|
|
233
|
+
// When the type set really changes, reset it for path re-resolution (sorted set comparison)
|
|
234
234
|
const oldSorted = [...types].sort().join(",");
|
|
235
235
|
types = t.filter((x) => VALID_TYPES.includes(x));
|
|
236
236
|
if ([...types].sort().join(",") !== oldSorted) paths = new Map();
|
|
@@ -238,7 +238,7 @@ export async function runInteractive(baseCtx, { cwd = process.cwd(), source = {
|
|
|
238
238
|
} else if (what === "version") {
|
|
239
239
|
const v = await io.askText(t("flow.askVersion"), version);
|
|
240
240
|
if (!isCancel(v) && v !== version) {
|
|
241
|
-
// semver
|
|
241
|
+
// semver format check
|
|
242
242
|
if (/^\d+\.\d+\.\d+$/.test(v)) version = v;
|
|
243
243
|
else io.note?.(t("flow.badVersion"), t("flow.badVersionTitle"));
|
|
244
244
|
}
|
|
@@ -246,7 +246,7 @@ export async function runInteractive(baseCtx, { cwd = process.cwd(), source = {
|
|
|
246
246
|
const b = await io.askText(t("flow.askBranch"), branch);
|
|
247
247
|
if (!isCancel(b) && b) branch = b;
|
|
248
248
|
} else if (OPTION_AXES.includes(what)) {
|
|
249
|
-
// #483 —
|
|
249
|
+
// #483 — re-ask only the one chosen axis (scope). Other options keep their current values.
|
|
250
250
|
const r = await askAllOptionalWorkflows({
|
|
251
251
|
tempDir, types, targetRoot: cwd, defaultBranch: branch,
|
|
252
252
|
current: {
|
|
@@ -276,22 +276,22 @@ export async function runInteractive(baseCtx, { cwd = process.cwd(), source = {
|
|
|
276
276
|
}
|
|
277
277
|
}
|
|
278
278
|
|
|
279
|
-
//
|
|
279
|
+
// Settle paths (full/version only. saved values, candidate scan, questions)
|
|
280
280
|
if (mode === "full" || mode === "version") {
|
|
281
281
|
paths = await resolveProjectPaths({
|
|
282
282
|
root: cwd, types, paths, existingPaths: existing?.paths ?? new Map(),
|
|
283
283
|
force: false, tty: realTty, io: io.engineIo ?? {},
|
|
284
284
|
});
|
|
285
|
-
//
|
|
285
|
+
// Type escape hatch (#487) — types excluded at the path step are dropped from version.yml, copy and env steps
|
|
286
286
|
types = filterExcludedTypes(types, paths);
|
|
287
287
|
} else {
|
|
288
288
|
for (const t of types) if (t !== "basic" && !paths.has(t)) paths.set(t, existing?.paths.get(t) || ".");
|
|
289
289
|
}
|
|
290
290
|
|
|
291
|
-
// @wizard env
|
|
292
|
-
//
|
|
291
|
+
// @wizard env plan questions (full/workflows only).
|
|
292
|
+
// Skipped in update mode — new files get defaults; replaced files carry over existing values via carryover below.
|
|
293
293
|
const resolvers = makeResolvers(cwd, repoName, paths);
|
|
294
|
-
//
|
|
294
|
+
// Multi-language store with store_locales unset: notice only (#843) — judged on the state before copying
|
|
295
295
|
const storeLocalesHint = detectStoreLocalesHint({ root: cwd, existing, paths, trace });
|
|
296
296
|
let envValues = new Map(), envUseDefaults = true;
|
|
297
297
|
if (showOptional && !updateRun) {
|
|
@@ -303,9 +303,9 @@ export async function runInteractive(baseCtx, { cwd = process.cwd(), source = {
|
|
|
303
303
|
envUseDefaults = plan.useDefaults;
|
|
304
304
|
}
|
|
305
305
|
|
|
306
|
-
//
|
|
307
|
-
//
|
|
308
|
-
//
|
|
306
|
+
// Update mode conflict handling (#502) — one bulk confirmation (default Y: .bak backup then replace) instead of a 3-way choice per type.
|
|
307
|
+
// When replacing, real env values are extracted from the existing install and carried over into the new file —
|
|
308
|
+
// the key to keeping values the user filled in (FIREBASE_APP_ID, etc.) from being reset by default re-substitution.
|
|
309
309
|
let updateDecisions = null;
|
|
310
310
|
if (showOptional && updateRun) {
|
|
311
311
|
const liteCtx = { types, paths, deployTarget, publishTargets, repoName, resolvers, branch, deployBranch };
|
|
@@ -335,13 +335,13 @@ export async function runInteractive(baseCtx, { cwd = process.cwd(), source = {
|
|
|
335
335
|
aiPrSummary, codeReviewCoderabbit, changelogProvider, changelogBaseUrl, deployBranch, intent, semverAuto, appRelease, labelStyle, closeOnRelease, projectsSync, language, excludedWorkflows, storeLocales, storeLocalesIos, storeLocalesPlay,
|
|
336
336
|
deployTriggerBranch, ciMinutesSaver,
|
|
337
337
|
repoName, templateVersion, resolvers, envValues, envUseDefaults, now, today,
|
|
338
|
-
// #502 — version
|
|
338
|
+
// #502 — keeps version mode from downgrading an existing full record (full wins)
|
|
339
339
|
recordMode: init.recordMode,
|
|
340
340
|
});
|
|
341
341
|
ctx.templateVersion = templateVersion;
|
|
342
342
|
|
|
343
|
-
//
|
|
344
|
-
//
|
|
343
|
+
// 3-way choice for existing workflow conflicts — one decision per type, cached and applied to its files
|
|
344
|
+
// Update mode decided in bulk above (updateDecisions), so the 3-way choice is skipped (#502).
|
|
345
345
|
let hooks = updateDecisions ? { decisions: updateDecisions } : {};
|
|
346
346
|
if (showOptional && io.engineIo?.select && !updateRun) {
|
|
347
347
|
const conflicts = listWorkflowConflicts(ctx, tempDir, cwd);
|
|
@@ -358,7 +358,7 @@ export async function runInteractive(baseCtx, { cwd = process.cwd(), source = {
|
|
|
358
358
|
{ value: "template", label: t("flow.opt.template") },
|
|
359
359
|
],
|
|
360
360
|
});
|
|
361
|
-
perType.set(type, isCancel(sel) || sel == null ? "skip" : sel); // ESC =
|
|
361
|
+
perType.set(type, isCancel(sel) || sel == null ? "skip" : sel); // ESC = skip
|
|
362
362
|
}
|
|
363
363
|
decisions.set(filename, perType.get(type));
|
|
364
364
|
}
|
|
@@ -366,8 +366,8 @@ export async function runInteractive(baseCtx, { cwd = process.cwd(), source = {
|
|
|
366
366
|
}
|
|
367
367
|
}
|
|
368
368
|
|
|
369
|
-
//
|
|
370
|
-
let migrationsResult = null; // #493 —
|
|
369
|
+
// Legacy migration (#470) — only in modes that touch workflows. Interactive confirms the safe tier once.
|
|
370
|
+
let migrationsResult = null; // #493 — for the guide record
|
|
371
371
|
if (mode === "full" || mode === "workflows") {
|
|
372
372
|
migrationsResult = await runMigrations({
|
|
373
373
|
targetRoot: cwd,
|
|
@@ -377,11 +377,11 @@ export async function runInteractive(baseCtx, { cwd = process.cwd(), source = {
|
|
|
377
377
|
for (const e of migrationsResult.confirmPending ?? []) trace.event("legacy", "leftover-old-gen", e.file, { replacement: e.replacedBy ?? "", reason: e.reason ?? "" });
|
|
378
378
|
}
|
|
379
379
|
|
|
380
|
-
//
|
|
381
|
-
const orphanReport = { cleaned: [], pending: [] }; // #493 —
|
|
380
|
+
// Orphan type workflow cleanup (#487) — leftover workflows of types dropped from the selection by a type change
|
|
381
|
+
const orphanReport = { cleaned: [], pending: [] }; // #493 — for the guide record
|
|
382
382
|
if (mode === "full" || mode === "workflows") {
|
|
383
383
|
const orphans = detectOrphanWorkflows({ tempDir, targetRoot: cwd, selectedTypes: types,
|
|
384
|
-
//
|
|
384
|
+
// Also catch workflows that were turned off but remain and keep running (#566)
|
|
385
385
|
options: { includeSecretBackup, aiPrSummary: aiPrSummary !== false, projectsSync, deployTarget } });
|
|
386
386
|
if (orphans.length > 0) {
|
|
387
387
|
io.note?.(
|
|
@@ -408,8 +408,8 @@ export async function runInteractive(baseCtx, { cwd = process.cwd(), source = {
|
|
|
408
408
|
else if (mode === "version") result = trace.step("install-version", () => runVersion(ctx, tempDir, cwd));
|
|
409
409
|
else if (mode === "workflows") result = trace.step("install-workflows", () => runWorkflows(ctx, tempDir, cwd, { ...hooks, trace }));
|
|
410
410
|
|
|
411
|
-
//
|
|
412
|
-
//
|
|
411
|
+
// IDE skills offer after integration (gate question first, default N)
|
|
412
|
+
// Update mode (#502): update only already-installed IDE skills without asking (IDEs not installed are left alone)
|
|
413
413
|
if (updateRun) {
|
|
414
414
|
await skills({ templateVersion, tempDir, interactive: false, installedOnly: true });
|
|
415
415
|
} else {
|
|
@@ -417,10 +417,10 @@ export async function runInteractive(baseCtx, { cwd = process.cwd(), source = {
|
|
|
417
417
|
if (wantSkills === true) { io.ideStatus?.(); await skills({ templateVersion, tempDir, interactive: true }); }
|
|
418
418
|
}
|
|
419
419
|
|
|
420
|
-
//
|
|
420
|
+
// Migration record (#493/#494) — Layer 2/3 trace files + Layer 1 guide entry (full/workflows only)
|
|
421
421
|
let migrationGuidePath = null;
|
|
422
422
|
recordArtifacts = mode === "full" || mode === "workflows";
|
|
423
|
-
//
|
|
423
|
+
// Compute paths first and delay the actual write until after the finish screen — so the summary is captured in the terminal mirror (#561)
|
|
424
424
|
const files = recordArtifacts
|
|
425
425
|
? trace.paths({ fromVersion: existing?.templateVersion || "", toVersion: templateVersion, now })
|
|
426
426
|
: null;
|
|
@@ -429,7 +429,7 @@ export async function runInteractive(baseCtx, { cwd = process.cwd(), source = {
|
|
|
429
429
|
now, mode, types, repoName,
|
|
430
430
|
templateFrom: existing?.templateVersion || "", templateTo: templateVersion,
|
|
431
431
|
options: { deploy: deployTarget, publish: publishTargets, secretBackup: includeSecretBackup, coderabbit: codeReviewCoderabbit, changelogProvider, intent, semverAuto , appRelease, labelStyle, closeOnRelease, projectsSync, language, excludedWorkflows, storeLocales, storeLocalesIos, storeLocalesPlay },
|
|
432
|
-
storeLocalesHint, // #843
|
|
432
|
+
storeLocalesHint, // #843 one checklist item
|
|
433
433
|
branches: { defaultBranch: branch, deployBranch, ready: deployBranchReady, created: deployBranchCreated },
|
|
434
434
|
breaking: breakingReport, migrations: migrationsResult, orphans: orphanReport,
|
|
435
435
|
events: trace.events, counters: { skipped: result?.workflows?.skipped ?? 0 },
|
|
@@ -437,19 +437,19 @@ export async function runInteractive(baseCtx, { cwd = process.cwd(), source = {
|
|
|
437
437
|
}).guidePath;
|
|
438
438
|
}
|
|
439
439
|
|
|
440
|
-
//
|
|
440
|
+
// Finish summary
|
|
441
441
|
const summaryCtx = {
|
|
442
442
|
mode, types, version, deployBranch, deployBranchReady, migrationGuidePath,
|
|
443
443
|
counters: { workflows: result?.workflows?.copied ?? 0, workflowFiles: result?.workflows?.copiedFiles ?? [], utilModules: 0 },
|
|
444
|
-
skippedConflicts: result?.workflows?.skippedConflicts ?? [], // #654
|
|
445
|
-
replacedBak: result?.workflows?.replacedBak ?? [], // #673
|
|
446
|
-
legacyLeftover: migrationsResult?.confirmPending ?? [], // #809
|
|
447
|
-
notInstalled: result?.workflows?.notInstalled ?? [], // #810
|
|
444
|
+
skippedConflicts: result?.workflows?.skippedConflicts ?? [], // #654 merge notice
|
|
445
|
+
replacedBak: result?.workflows?.replacedBak ?? [], // #673 notice for files replaced without a reference point
|
|
446
|
+
legacyLeftover: migrationsResult?.confirmPending ?? [], // #809 notice for old and new generations running together
|
|
447
|
+
notInstalled: result?.workflows?.notInstalled ?? [], // #810 notice for workflows not installed
|
|
448
448
|
semverAutoNewlyOn,
|
|
449
|
-
storeLocalesHint, // #843
|
|
450
|
-
verification: result?.verification, // #549
|
|
451
|
-
aiPrSummary, codeReviewCoderabbit, // #569 —
|
|
452
|
-
logDir: files ? MIGRATION_DIR : null, // #561
|
|
449
|
+
storeLocalesHint, // #843 multi-language store notice
|
|
450
|
+
verification: result?.verification, // #549 install verification result
|
|
451
|
+
aiPrSummary, codeReviewCoderabbit, // #569 — mention only what was picked
|
|
452
|
+
logDir: files ? MIGRATION_DIR : null, // #561 record location notice
|
|
453
453
|
logFile: files?.logFile ?? null,
|
|
454
454
|
traceFile: files?.traceFile ?? null,
|
|
455
455
|
};
|
|
@@ -462,7 +462,7 @@ export async function runInteractive(baseCtx, { cwd = process.cwd(), source = {
|
|
|
462
462
|
}
|
|
463
463
|
io.outro?.(t("flow.done", { mode }));
|
|
464
464
|
|
|
465
|
-
//
|
|
465
|
+
// Close in finally after printing the finish screen (#561) — closing here would drop the screen below from the record.
|
|
466
466
|
trace.event("run", "end", mode || "", {
|
|
467
467
|
workflowsCopied: result?.workflows?.copied ?? 0,
|
|
468
468
|
workflowsSkipped: result?.workflows?.skipped ?? 0,
|
|
@@ -476,8 +476,8 @@ export async function runInteractive(baseCtx, { cwd = process.cwd(), source = {
|
|
|
476
476
|
});
|
|
477
477
|
throw err;
|
|
478
478
|
} finally {
|
|
479
|
-
//
|
|
480
|
-
//
|
|
479
|
+
// Leave a record however it exits (#561) — including mid-run cancel, exceptions and Ctrl+C.
|
|
480
|
+
// The finish screen output must be inside try so it is captured in the mirror before closing here.
|
|
481
481
|
if (skipRecord) trace.mirrorStop();
|
|
482
482
|
else trace.finalize({ targetRoot: cwd, fromVersion: traceFrom, toVersion: traceTo, now: clock?.now || "" });
|
|
483
483
|
disarmSignals();
|
package/src/commands/issues.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
// issues
|
|
2
|
-
//
|
|
1
|
+
// issues mode (installs issue/PR templates only).
|
|
2
|
+
// Copies only issue/PR templates + Discussion templates.
|
|
3
3
|
import { applyLabelStyle } from "../core/label-style.js";
|
|
4
4
|
import { applyRepoLanguage } from "../core/repo-language.js";
|
|
5
5
|
import { t } from "../i18n/index.js";
|
|
@@ -7,9 +7,9 @@ import { copyIssueTemplates, copyDiscussionTemplates, stripIssueTemplateAssignee
|
|
|
7
7
|
|
|
8
8
|
export function runIssues(context, tempDir, targetRoot = ".") {
|
|
9
9
|
copyIssueTemplates(tempDir, targetRoot);
|
|
10
|
-
copyDiscussionTemplates(tempDir, targetRoot); // #988 —
|
|
11
|
-
const { failed } = applyRepoLanguage(tempDir, targetRoot, context.language ?? "en"); // #769 —
|
|
10
|
+
copyDiscussionTemplates(tempDir, targetRoot); // #988 — overlay and label conversion targets, so before them
|
|
11
|
+
const { failed } = applyRepoLanguage(tempDir, targetRoot, context.language ?? "en"); // #769 — before the label conversion
|
|
12
12
|
if (failed.length) console.error(t("language.overlayFailed", { n: failed.length, files: failed.map((f) => f.file).join(", ") }));
|
|
13
|
-
stripIssueTemplateAssignees(targetRoot); // #782 —
|
|
13
|
+
stripIssueTemplateAssignees(targetRoot); // #782 — the overlay puts it back, so after it
|
|
14
14
|
applyLabelStyle(targetRoot, context.labelStyle ?? "en"); // #776
|
|
15
15
|
}
|