projectops 4.119.0 → 4.120.1
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/package.json +1 -1
- package/src/commands/doctor.js +38 -3
- package/src/commands/interactive.js +17 -3
- package/src/commands/skills.js +4 -0
- package/src/core/detect-fs.js +7 -2
- package/src/core/run-trace.js +11 -2
- package/src/i18n/doctor.en.js +4 -0
- package/src/i18n/doctor.ko.js +4 -0
- package/src/i18n/en.js +5 -0
- package/src/i18n/ko.js +5 -0
- package/src/index.js +9 -2
- package/src/ui/cancel-notice.js +23 -0
- package/src/ui/readline-engine.js +19 -4
package/README.md
CHANGED
|
@@ -163,7 +163,7 @@ Supported types: <!-- generated: project-types:types-list -->`flutter`, `spring`
|
|
|
163
163
|
Everything is on the **[docs site](https://cassiiopeia.github.io/projectops/)**, in English and [Korean](https://cassiiopeia.github.io/projectops/ko/): [Getting started](https://cassiiopeia.github.io/projectops/getting-started) · [CLI](https://cassiiopeia.github.io/projectops/cli) · [Agent Skills](https://cassiiopeia.github.io/projectops/skills) · [Versioning](https://cassiiopeia.github.io/projectops/version-control) · [Changelog](https://cassiiopeia.github.io/projectops/changelog-automation) · [SSH + Docker deploy](https://cassiiopeia.github.io/projectops/ssh-docker-deployment-guide) · [Flutter CI/CD](https://cassiiopeia.github.io/projectops/flutter-cicd-overview) · [Troubleshooting](https://cassiiopeia.github.io/projectops/troubleshooting)
|
|
164
164
|
|
|
165
165
|
<!-- AUTO-VERSION-SECTION: DO NOT EDIT MANUALLY -->
|
|
166
|
-
## Latest version : v4.
|
|
166
|
+
## Latest version : v4.120.1 (2026-11-26)
|
|
167
167
|
|
|
168
168
|
[View full version history](CHANGELOG.md)
|
|
169
169
|
|
package/package.json
CHANGED
package/src/commands/doctor.js
CHANGED
|
@@ -18,7 +18,7 @@ import { PATHS } from "../core/paths.js";
|
|
|
18
18
|
import { parseExisting } from "../core/version-yml.js";
|
|
19
19
|
import { verifyInstall } from "../core/verify.js";
|
|
20
20
|
import { readBaseline } from "../core/baseline.js";
|
|
21
|
-
import { detectRepoName } from "../core/detect-fs.js";
|
|
21
|
+
import { detectRepoName, isValidBranchName } from "../core/detect-fs.js";
|
|
22
22
|
import { detectMigrations } from "../core/migrations/index.js";
|
|
23
23
|
import { scanPlaceholderTriggers } from "../core/placeholder-triggers.js";
|
|
24
24
|
import { t } from "../i18n/index.js";
|
|
@@ -55,6 +55,27 @@ function detectSlug(cwd) {
|
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
+
// Optional keys that polish release notes with AI: workflows name them, but nothing requires them (#569)
|
|
59
|
+
const AI_KEY_NAMES = ["GEMINI_API_KEY", "OPENAI_API_KEY", "ANTHROPIC_API_KEY", "GROQ_API_KEY", "MISTRAL_API_KEY"];
|
|
60
|
+
|
|
61
|
+
// version.yml branch keys and workflow `branches:` entries whose value is not a usable branch name > [{ file, line, text }]
|
|
62
|
+
const BRANCH_KEY_LINE_RE = /^\s*(default_branch|development_branch|deploy_branch|deploy_trigger_branch):\s*"?([^"#]*?)"?\s*(#.*)?$/;
|
|
63
|
+
const GIT_REMOTE_PLACEHOLDER = "(unknown)";
|
|
64
|
+
function findInvalidBranchLines(wfDir, workflowFiles, versionFilePath) {
|
|
65
|
+
const found = [];
|
|
66
|
+
const readLines = (path) => { try { return readFileSync(path, "utf8").split(/\r?\n/); } catch { return []; } };
|
|
67
|
+
readLines(versionFilePath).forEach((text, index) => {
|
|
68
|
+
const match = text.match(BRANCH_KEY_LINE_RE);
|
|
69
|
+
if (match && match[2] && !isValidBranchName(match[2])) found.push({ file: PATHS.versionFile, line: index + 1, text: text.trim() });
|
|
70
|
+
});
|
|
71
|
+
for (const file of workflowFiles) {
|
|
72
|
+
readLines(join(wfDir, file)).forEach((text, index) => {
|
|
73
|
+
if (!/^\s*#/.test(text) && text.includes(GIT_REMOTE_PLACEHOLDER)) found.push({ file, line: index + 1, text: text.trim() });
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
return found;
|
|
77
|
+
}
|
|
78
|
+
|
|
58
79
|
// ── Local checks ─────────────────────────────────────────────────────────
|
|
59
80
|
export function localChecks(cwd = ".") {
|
|
60
81
|
const rows = [];
|
|
@@ -116,7 +137,22 @@ export function localChecks(cwd = ".") {
|
|
|
116
137
|
] : null,
|
|
117
138
|
});
|
|
118
139
|
|
|
119
|
-
|
|
140
|
+
// Branch names that cannot be real branches (#1236): saved in version.yml or substituted into workflow triggers
|
|
141
|
+
const invalidBranchLines = findInvalidBranchLines(wfDir, files, vyPath);
|
|
142
|
+
add({
|
|
143
|
+
name: t("doctor.br.name"), purpose: t("doctor.br.purpose"),
|
|
144
|
+
status: invalidBranchLines.length ? "WARN" : "OK",
|
|
145
|
+
value: invalidBranchLines.length ? t("doctor.cases", { n: invalidBranchLines.length }) : t("doctor.none"),
|
|
146
|
+
detail: invalidBranchLines.length ? [
|
|
147
|
+
t("doctor.br.l1"),
|
|
148
|
+
...invalidBranchLines.slice(0, 8).map((found) => ` ${found.file}:${found.line} ${found.text}`),
|
|
149
|
+
...(invalidBranchLines.length > 8 ? [t("doctor.unres.more", { n: invalidBranchLines.length - 8 })] : []),
|
|
150
|
+
t("doctor.br.fix"),
|
|
151
|
+
] : null,
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
// AI summary keys are optional and explained in their own row below, so they stay out of this list (#1237)
|
|
155
|
+
const secretNames = [...v.secrets.keys()].filter((n) => !AI_KEY_NAMES.includes(n));
|
|
120
156
|
add({
|
|
121
157
|
name: t("doctor.sec.name"), purpose: t("doctor.sec.purpose"),
|
|
122
158
|
status: "INFO", value: secretNames.length ? t("doctor.count", { n: secretNames.length }) : t("doctor.none"),
|
|
@@ -129,7 +165,6 @@ export function localChecks(cwd = ".") {
|
|
|
129
165
|
// AI summary keys (#569) — there was no way to check "I registered it, does it work?".
|
|
130
166
|
// Repo secrets cannot be read locally, so this tells which names to use
|
|
131
167
|
// and that not registering is fine. Whether they are actually registered is checked remotely.
|
|
132
|
-
const AI_KEY_NAMES = ["GEMINI_API_KEY", "OPENAI_API_KEY", "ANTHROPIC_API_KEY", "GROQ_API_KEY", "MISTRAL_API_KEY"];
|
|
133
168
|
const hasSummaryWf = files.some((f) => /AI-PR-SUMMARY|RELEASE-CHANGELOG/.test(f));
|
|
134
169
|
if (hasSummaryWf) {
|
|
135
170
|
add({
|
|
@@ -17,7 +17,7 @@ import { runMigrations } from "../core/migrations/index.js";
|
|
|
17
17
|
import { detectOrphanWorkflows, applyOrphanCleanup } from "../core/orphan-workflows.js";
|
|
18
18
|
import { resolveProjectPaths, filterExcludedTypes } from "../core/paths-resolve.js";
|
|
19
19
|
import { askAllOptionalWorkflows, OPTION_AXES, applicableTargets } from "../core/options-ask.js";
|
|
20
|
-
import { createRunTrace, MIGRATION_DIR } from "../core/run-trace.js";
|
|
20
|
+
import { createRunTrace, MIGRATION_DIR, yieldToSignals } from "../core/run-trace.js";
|
|
21
21
|
import { appendGuideEntry } from "../core/migration-guide.js";
|
|
22
22
|
import { promptEnvPlan } from "../ui/env-plan.js";
|
|
23
23
|
import { listWorkflowConflicts } from "../core/copy/workflows.js";
|
|
@@ -33,6 +33,7 @@ import { t, getLang, withLang } from "../i18n/index.js";
|
|
|
33
33
|
import { resolveLabelStyle } from "../core/label-style.js";
|
|
34
34
|
import { resolveRepoLanguage } from "../core/repo-language.js";
|
|
35
35
|
import { printSummary } from "../ui/summary.js";
|
|
36
|
+
import { printCancelNotice } from "../ui/cancel-notice.js";
|
|
36
37
|
import { listUnappliedBranchValues } from "../core/branch-report.js";
|
|
37
38
|
|
|
38
39
|
const CANCEL = prompts.CANCEL;
|
|
@@ -45,10 +46,16 @@ export async function runInteractive(baseCtx, { cwd = process.cwd(), source = {
|
|
|
45
46
|
// Run trace (#494) — the terminal mirror is on only in the real CLI (io=prompts) (test stub io records events only).
|
|
46
47
|
const trace = createRunTrace();
|
|
47
48
|
// The record stays even when cut off with Ctrl+C (#561) — people often stop the interactive wizard midway.
|
|
48
|
-
const disarmSignals = trace.armSignals({ targetRoot: cwd, now: clock?.now || "" });
|
|
49
49
|
// Values used when recording in finally — kept outside because a cancel may come before try settles them (#561).
|
|
50
50
|
let traceFrom = "";
|
|
51
51
|
let traceTo = "";
|
|
52
|
+
// Timestamp in the record file names: one value for the announced paths and the files written (#1275)
|
|
53
|
+
let recordNow = clock?.now || "";
|
|
54
|
+
const recordOptions = () => ({ targetRoot: cwd, fromVersion: traceFrom, toVersion: traceTo, now: recordNow });
|
|
55
|
+
const disarmSignals = trace.armSignals(() => ({
|
|
56
|
+
...recordOptions(),
|
|
57
|
+
onCancel: () => { remove(tempDir); printCancelNotice(trace.events); },
|
|
58
|
+
}));
|
|
52
59
|
// Whether this mode leaves record files — false by default since a cancel may come before mode selection.
|
|
53
60
|
let recordArtifacts = false;
|
|
54
61
|
// true only when ending without a record (normal finish of version/issues modes).
|
|
@@ -335,6 +342,7 @@ export async function runInteractive(baseCtx, { cwd = process.cwd(), source = {
|
|
|
335
342
|
}
|
|
336
343
|
|
|
337
344
|
const { now, today } = clock || utcNow();
|
|
345
|
+
recordNow = now;
|
|
338
346
|
const ctx = createContext({
|
|
339
347
|
mode, force: true, types, version, versionCode, branch, paths, deployTarget, publishTargets, includeSecretBackup,
|
|
340
348
|
aiPrSummary, codeReviewCoderabbit, changelogProvider, changelogBaseUrl, deployBranch, intent, semverAuto, appRelease, labelStyle, closeOnRelease, projectsSync, language, excludedWorkflows, storeLocales, storeLocalesIos, storeLocalesPlay,
|
|
@@ -408,6 +416,8 @@ export async function runInteractive(baseCtx, { cwd = process.cwd(), source = {
|
|
|
408
416
|
}
|
|
409
417
|
}
|
|
410
418
|
|
|
419
|
+
// Last point where a Ctrl+C pressed during the questions stops the run before files are written (#1275)
|
|
420
|
+
await yieldToSignals();
|
|
411
421
|
let result = null;
|
|
412
422
|
if (mode === "full") result = trace.step("install-full", () => runFull(ctx, tempDir, cwd, { ...hooks, trace }));
|
|
413
423
|
else if (mode === "version") result = trace.step("install-version", () => runVersion(ctx, tempDir, cwd));
|
|
@@ -419,6 +429,7 @@ export async function runInteractive(baseCtx, { cwd = process.cwd(), source = {
|
|
|
419
429
|
workflowsResult: result?.workflows, isBranchRecorded: result?.isBranchRecorded !== false, trace,
|
|
420
430
|
}) : [];
|
|
421
431
|
|
|
432
|
+
await yieldToSignals();
|
|
422
433
|
// IDE skills offer after integration (gate question first, default N)
|
|
423
434
|
// Update mode (#502): update only already-installed IDE skills without asking (IDEs not installed are left alone)
|
|
424
435
|
if (updateRun) {
|
|
@@ -428,6 +439,7 @@ export async function runInteractive(baseCtx, { cwd = process.cwd(), source = {
|
|
|
428
439
|
if (wantSkills === true) { io.ideStatus?.(); await skills({ templateVersion, tempDir, interactive: true }); }
|
|
429
440
|
}
|
|
430
441
|
|
|
442
|
+
await yieldToSignals();
|
|
431
443
|
// Migration record (#493/#494) — Layer 2/3 trace files + Layer 1 guide entry (full/workflows only)
|
|
432
444
|
let migrationGuidePath = null;
|
|
433
445
|
recordArtifacts = mode === "full" || mode === "workflows";
|
|
@@ -492,7 +504,9 @@ export async function runInteractive(baseCtx, { cwd = process.cwd(), source = {
|
|
|
492
504
|
// Leave a record however it exits (#561) — including mid-run cancel, exceptions and Ctrl+C.
|
|
493
505
|
// The finish screen output must be inside try so it is captured in the mirror before closing here.
|
|
494
506
|
if (skipRecord) trace.mirrorStop();
|
|
495
|
-
else trace.finalize(
|
|
507
|
+
else trace.finalize(recordOptions());
|
|
508
|
+
// A Ctrl+C that arrived during the last sync steps is handled here instead of being dropped by disarming
|
|
509
|
+
await yieldToSignals();
|
|
496
510
|
disarmSignals();
|
|
497
511
|
remove(tempDir);
|
|
498
512
|
}
|
package/src/commands/skills.js
CHANGED
|
@@ -6,6 +6,7 @@ import { versionTag } from "../core/ide/util.js";
|
|
|
6
6
|
import { defaultIo } from "../core/ide/runner.js";
|
|
7
7
|
import * as skillsPrompts from "../ui/skills-prompts.js";
|
|
8
8
|
import { t } from "../i18n/index.js";
|
|
9
|
+
import { yieldToSignals } from "../core/run-trace.js";
|
|
9
10
|
|
|
10
11
|
// Collect status → [{adapter, status}]. Optional adapters are left out when undetectable (cliMissing).
|
|
11
12
|
export function collectStatuses(io) {
|
|
@@ -51,6 +52,8 @@ export async function runSkills(opts = {}) {
|
|
|
51
52
|
for (const { adapter, status } of rows) {
|
|
52
53
|
if (opts.installedOnly && !status.installed) continue;
|
|
53
54
|
safe(() => adapter.apply(io, ctx), false);
|
|
55
|
+
// Each adapter runs synchronously (spawnSync, file copies): let a Ctrl+C stop the run before the next one (#1275)
|
|
56
|
+
await yieldToSignals();
|
|
54
57
|
}
|
|
55
58
|
return 0;
|
|
56
59
|
}
|
|
@@ -82,6 +85,7 @@ export async function runSkills(opts = {}) {
|
|
|
82
85
|
io.log("");
|
|
83
86
|
io.log(t(action === "apply" ? "skills.header.apply" : "skills.header.remove", { label: adapter.label }));
|
|
84
87
|
safe(() => (action === "apply" ? adapter.apply(io, ctx) : adapter.remove(io, ctx)), false);
|
|
88
|
+
await yieldToSignals();
|
|
85
89
|
}
|
|
86
90
|
return 0;
|
|
87
91
|
}
|
package/src/core/detect-fs.js
CHANGED
|
@@ -105,13 +105,18 @@ export function detectVersion(root, { hasJq } = {}) {
|
|
|
105
105
|
return detectVersionFromFiles({ read, readJson, hasJq: jq, gitTag });
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
-
//
|
|
108
|
+
// Not a usable branch name: characters git forbids in a ref, plus parentheses —
|
|
109
|
+
// an empty remote makes `git remote show origin` print the placeholder `HEAD branch: (unknown)` (#1236)
|
|
110
|
+
const INVALID_BRANCH_NAME_RE = /[\s~^:?*[\\()]|\.\.|@\{/;
|
|
111
|
+
export const isValidBranchName = (name) => Boolean(name) && !INVALID_BRANCH_NAME_RE.test(name);
|
|
112
|
+
|
|
113
|
+
// Default branch detection — symbolic-ref → remote show → current branch → main.
|
|
109
114
|
export function detectDefaultBranch(root) {
|
|
110
115
|
let b = gitOut(root, ["symbolic-ref", "refs/remotes/origin/HEAD"]);
|
|
111
116
|
if (b) return b.replace(/^refs\/remotes\/origin\//, "");
|
|
112
117
|
const show = gitOut(root, ["remote", "show", "origin"]);
|
|
113
118
|
const m = show.match(/HEAD branch:\s*(\S+)/);
|
|
114
|
-
if (m) return m[1];
|
|
119
|
+
if (m && isValidBranchName(m[1])) return m[1];
|
|
115
120
|
// Local repo without origin (#477) — the current HEAD branch is the best guess (fixable in the interactive edit menu)
|
|
116
121
|
const head = gitOut(root, ["branch", "--show-current"]);
|
|
117
122
|
if (head) return head;
|
package/src/core/run-trace.js
CHANGED
|
@@ -94,6 +94,11 @@ export function stampFromNow(now) {
|
|
|
94
94
|
return `${digits.slice(0, 8)}_${digits.slice(8, 14)}`;
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
+
// Let a pending Ctrl+C be handled between synchronous steps (#1275).
|
|
98
|
+
// Signal handlers run only when the event loop turns; a run of sync steps (file copies, spawnSync) up to
|
|
99
|
+
// disarming would drop the signal, and the cancelled run would finish as a success.
|
|
100
|
+
export const yieldToSignals = () => new Promise((resolve) => setImmediate(resolve));
|
|
101
|
+
|
|
97
102
|
// Trace factory. clockIso can be injected (test determinism) — default is the real UTC.
|
|
98
103
|
export function createRunTrace({ clockIso = null } = {}) {
|
|
99
104
|
const events = [];
|
|
@@ -183,7 +188,8 @@ export function createRunTrace({ clockIso = null } = {}) {
|
|
|
183
188
|
// Leave a record even on forced exit (Ctrl+C) (#561).
|
|
184
189
|
// If SIGINT's default kills the process, finally never runs — yet when the user cuts it off is exactly when
|
|
185
190
|
// "how far did it get" matters most, so missing it here halves the log's value.
|
|
186
|
-
// The handler
|
|
191
|
+
// The handler records, shows the cancel notice (opts.onCancel), then exits as before.
|
|
192
|
+
// opts may be a function: versions and the timestamp settle after arming, so they are read at signal time (#1275).
|
|
187
193
|
armSignals(opts = {}) {
|
|
188
194
|
if (signalsArmed) return () => {};
|
|
189
195
|
signalsArmed = true;
|
|
@@ -191,8 +197,11 @@ export function createRunTrace({ clockIso = null } = {}) {
|
|
|
191
197
|
const handlers = [];
|
|
192
198
|
for (const sig of ["SIGINT", "SIGTERM"]) {
|
|
193
199
|
const h = () => {
|
|
200
|
+
const { onCancel, ...finalizeOptions } = typeof opts === "function" ? opts() : opts;
|
|
194
201
|
self.event("run", "cancelled", sig, { reason: "user forced exit (signal received)" });
|
|
195
|
-
|
|
202
|
+
// Before finalize, so the notice is captured in the .log mirror. A failing notice must not block the exit
|
|
203
|
+
try { onCancel?.(sig); } catch { /* exit anyway */ }
|
|
204
|
+
self.finalize(finalizeOptions);
|
|
196
205
|
process.removeListener(sig, h);
|
|
197
206
|
process.kill(process.pid, sig); // Hand over to the original exit behavior
|
|
198
207
|
};
|
package/src/i18n/doctor.en.js
CHANGED
|
@@ -24,6 +24,10 @@ export default {
|
|
|
24
24
|
"doctor.ph.purpose": "Workflows that fail on every trigger until configured",
|
|
25
25
|
"doctor.ph.l1": "These workflows run automatically (push, labels and so on) but still hold example values, so each trigger can create a failed run.",
|
|
26
26
|
"doctor.ph.fix": "Fix: fill in the real values, or delete the workflows you do not use.",
|
|
27
|
+
"doctor.br.name": "Branch names",
|
|
28
|
+
"doctor.br.purpose": "Branches the workflows trigger on",
|
|
29
|
+
"doctor.br.l1": "These lines hold a value that cannot be a branch name, so the workflows that trigger on it never run.",
|
|
30
|
+
"doctor.br.fix": "Fix: run npx projectops again (it now falls back to the current branch), or edit these lines by hand.",
|
|
27
31
|
"doctor.sec.name": "Required secrets",
|
|
28
32
|
"doctor.sec.purpose": "Values the installed workflows require",
|
|
29
33
|
"doctor.sec.line": " {name} <- {n} workflow(s)",
|
package/src/i18n/doctor.ko.js
CHANGED
|
@@ -24,6 +24,10 @@ export default {
|
|
|
24
24
|
"doctor.ph.purpose": "설정 전까지 실행될 때마다 실패하는 워크플로우",
|
|
25
25
|
"doctor.ph.l1": "아래 워크플로우는 자동으로 실행되는데(push, 라벨 등) 예시 값이 그대로 남아 있어, 실행될 때마다 실패 런이 생길 수 있습니다.",
|
|
26
26
|
"doctor.ph.fix": "조치: 실제 값을 채우거나, 쓰지 않는 워크플로우는 삭제하세요.",
|
|
27
|
+
"doctor.br.name": "브랜치 이름",
|
|
28
|
+
"doctor.br.purpose": "워크플로우가 실행되는 브랜치",
|
|
29
|
+
"doctor.br.l1": "아래 줄에 브랜치 이름이 될 수 없는 값이 들어 있어, 그 값으로 실행되는 워크플로우가 돌지 않습니다.",
|
|
30
|
+
"doctor.br.fix": "조치: npx projectops 를 다시 실행하거나(현재 브랜치로 대체됩니다), 해당 줄을 직접 고치세요.",
|
|
27
31
|
"doctor.sec.name": "필요한 Secret",
|
|
28
32
|
"doctor.sec.purpose": "설치된 워크플로우가 요구하는 값",
|
|
29
33
|
"doctor.sec.line": " {name} ← {n}개 워크플로우",
|
package/src/i18n/en.js
CHANGED
|
@@ -104,6 +104,11 @@ export default {
|
|
|
104
104
|
|
|
105
105
|
// interactive flow
|
|
106
106
|
"flow.cancelInstall": "Installation cancelled.",
|
|
107
|
+
"flow.cancelCtrlC": "Stopped by Ctrl+C. Nothing more will be changed.",
|
|
108
|
+
"flow.cancelUntouched": "No project files were changed.",
|
|
109
|
+
"flow.cancelPartial": "Some files in this repository were already changed before the stop.",
|
|
110
|
+
"flow.cancelReview": "Review them with `git status` and `git diff`. Undo: `git restore <path>` for edited files, delete the new ones.",
|
|
111
|
+
"flow.cancelLog": "Run log: {dir}",
|
|
107
112
|
"flow.cancelBreaking": "Cancelled safely, nothing was changed.",
|
|
108
113
|
"flow.doneSkills": "AI skills installed.",
|
|
109
114
|
"flow.doneIssues": "Issue and PR templates installed.",
|
package/src/i18n/ko.js
CHANGED
|
@@ -97,6 +97,11 @@ export default {
|
|
|
97
97
|
|
|
98
98
|
// interactive flow
|
|
99
99
|
"flow.cancelInstall": "설치를 취소했습니다.",
|
|
100
|
+
"flow.cancelCtrlC": "Ctrl+C 로 중단했습니다. 더 이상 변경하지 않습니다.",
|
|
101
|
+
"flow.cancelUntouched": "프로젝트 파일은 변경되지 않았습니다.",
|
|
102
|
+
"flow.cancelPartial": "중단 전에 이 저장소의 일부 파일이 이미 변경되었습니다.",
|
|
103
|
+
"flow.cancelReview": "`git status` 와 `git diff` 로 확인하세요. 되돌리기: 수정된 파일은 `git restore <경로>`, 새로 생긴 파일은 삭제.",
|
|
104
|
+
"flow.cancelLog": "실행 기록: {dir}",
|
|
100
105
|
"flow.cancelBreaking": "통합을 안전하게 취소했습니다.",
|
|
101
106
|
"flow.doneSkills": "AI 스킬 설치를 마쳤습니다.",
|
|
102
107
|
"flow.doneIssues": "이슈·PR 템플릿을 설치했습니다.",
|
package/src/index.js
CHANGED
|
@@ -17,7 +17,7 @@ import { parseExisting } from "./core/version-yml.js";
|
|
|
17
17
|
import { runBreakingCheck } from "./core/breaking-check.js";
|
|
18
18
|
import { runMigrations } from "./core/migrations/index.js";
|
|
19
19
|
import { detectOrphanWorkflows } from "./core/orphan-workflows.js";
|
|
20
|
-
import { createRunTrace, MIGRATION_DIR } from "./core/run-trace.js";
|
|
20
|
+
import { createRunTrace, MIGRATION_DIR, yieldToSignals } from "./core/run-trace.js";
|
|
21
21
|
import { appendGuideEntry } from "./core/migration-guide.js";
|
|
22
22
|
import { resolveProjectPaths, markerForType } from "./core/paths-resolve.js";
|
|
23
23
|
import { resolveOptions } from "./core/resolve-options.js";
|
|
@@ -26,6 +26,7 @@ import { runDevelopmentBranchStep } from "./core/development-branch.js";
|
|
|
26
26
|
import { listUnappliedBranchValues } from "./core/branch-report.js";
|
|
27
27
|
import { printBannerCompact } from "./ui/banner.js";
|
|
28
28
|
import { printSummary } from "./ui/summary.js";
|
|
29
|
+
import { printCancelNotice } from "./ui/cancel-notice.js";
|
|
29
30
|
import { runFull } from "./commands/full.js";
|
|
30
31
|
import { runVersion } from "./commands/version.js";
|
|
31
32
|
import { runWorkflows } from "./commands/workflows.js";
|
|
@@ -101,12 +102,16 @@ async function runCore(argv, { cwd = process.cwd(), source = { type: "git" }, cl
|
|
|
101
102
|
if (opts.mode === "skills") {
|
|
102
103
|
const tempDir = join(cwd, PATHS.tempDir);
|
|
103
104
|
const interactive = !opts.force && process.stdout.isTTY;
|
|
105
|
+
// Ctrl+C at a prompt exits the process directly (no trace armed in this mode): still drop the template copy (#1275)
|
|
106
|
+
const removeTempDirOnExit = () => remove(tempDir);
|
|
107
|
+
process.once("exit", removeTempDirOnExit);
|
|
104
108
|
try {
|
|
105
109
|
// skills mode: skill CLIs import scripts/common > keep it out of the exclusions (#994)
|
|
106
110
|
acquireTemplate({ tempDir, source, keep: [SHARED_SCRIPTS_DIR_NAME] });
|
|
107
111
|
const templateVersion = readTemplateVersion(tempDir);
|
|
108
112
|
return await runSkills({ templateVersion, tempDir, interactive });
|
|
109
113
|
} finally {
|
|
114
|
+
process.removeListener("exit", removeTempDirOnExit);
|
|
110
115
|
remove(tempDir);
|
|
111
116
|
}
|
|
112
117
|
}
|
|
@@ -132,7 +137,7 @@ async function runCore(argv, { cwd = process.cwd(), source = { type: "git" }, cl
|
|
|
132
137
|
trace.mirrorStart();
|
|
133
138
|
// Even when cut off with Ctrl+C, the record up to here stays (#561). The path is settled below, but
|
|
134
139
|
// a signal can come at any time, so arm with targetRoot alone first.
|
|
135
|
-
disarmSignals = trace.armSignals({ targetRoot: cwd, now: "" });
|
|
140
|
+
disarmSignals = trace.armSignals({ targetRoot: cwd, now: "", onCancel: () => printCancelNotice(trace.events) });
|
|
136
141
|
}
|
|
137
142
|
|
|
138
143
|
// Load the existing version.yml — single source of truth for keeping version/version_code/project_paths
|
|
@@ -387,6 +392,8 @@ async function runCore(argv, { cwd = process.cwd(), source = { type: "git" }, cl
|
|
|
387
392
|
} else {
|
|
388
393
|
trace.mirrorStop();
|
|
389
394
|
}
|
|
395
|
+
// A Ctrl+C that arrived during the sync steps is handled here instead of being dropped by disarming (#1275)
|
|
396
|
+
await yieldToSignals();
|
|
390
397
|
disarmSignals();
|
|
391
398
|
remove(tempDir);
|
|
392
399
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// Screen shown when the user cuts the run off with Ctrl+C (#1275):
|
|
2
|
+
// says the run stopped, whether repository files were already changed, and how to review them.
|
|
3
|
+
import { MIGRATION_DIR } from "../core/run-trace.js";
|
|
4
|
+
import { t } from "../i18n/index.js";
|
|
5
|
+
|
|
6
|
+
// Trace events that mean a file in the target repository was written (install step, old workflow renamed to .bak)
|
|
7
|
+
const isRepoWriteEvent = (event) =>
|
|
8
|
+
(event.phase === "step" && event.action === "start" && String(event.target).startsWith("install-"))
|
|
9
|
+
|| ((event.phase === "legacy" || event.phase === "orphan") && event.action === "neutralized");
|
|
10
|
+
|
|
11
|
+
export const hasChangedRepoFiles = (events) => events.some(isRepoWriteEvent);
|
|
12
|
+
|
|
13
|
+
export function printCancelNotice(events, write = (line) => process.stdout.write(`${line}\n`)) {
|
|
14
|
+
write("");
|
|
15
|
+
write(t("flow.cancelCtrlC"));
|
|
16
|
+
if (hasChangedRepoFiles(events)) {
|
|
17
|
+
write(t("flow.cancelPartial"));
|
|
18
|
+
write(t("flow.cancelReview"));
|
|
19
|
+
} else {
|
|
20
|
+
write(t("flow.cancelUntouched"));
|
|
21
|
+
}
|
|
22
|
+
write(t("flow.cancelLog", { dir: MIGRATION_DIR }));
|
|
23
|
+
}
|
|
@@ -3,7 +3,9 @@
|
|
|
3
3
|
// and freezes (confirmed by measurement). node:readline keypress events work fine on Windows.
|
|
4
4
|
// Zero external dependencies → safe on internal networks too.
|
|
5
5
|
//
|
|
6
|
-
// Contract:
|
|
6
|
+
// Contract: ESC returns the CANCEL symbol (callers treat it as "skip / keep the default").
|
|
7
|
+
// Ctrl+C stops the whole run (#1275) — it used to return CANCEL too, so the wizard kept going with defaults.
|
|
8
|
+
// Every function is async.
|
|
7
9
|
import { emitKeypressEvents } from "node:readline";
|
|
8
10
|
import { stdin, stdout } from "node:process";
|
|
9
11
|
import { visualWidth } from "./ansi.js";
|
|
@@ -11,6 +13,17 @@ import { t } from "../i18n/index.js";
|
|
|
11
13
|
|
|
12
14
|
export const CANCEL = Symbol("cancel");
|
|
13
15
|
|
|
16
|
+
// Exit code of a run stopped by Ctrl+C (128 + SIGINT 2)
|
|
17
|
+
const INTERRUPTED_EXIT_CODE = 130;
|
|
18
|
+
|
|
19
|
+
// Ctrl+C at a prompt: raw mode swallows the real signal, so hand it to the armed SIGINT handler
|
|
20
|
+
// (run log + cancel notice, src/core/run-trace.js). With no handler armed, say so and exit here.
|
|
21
|
+
function stopRunOnCtrlC() {
|
|
22
|
+
if (process.emit("SIGINT")) return;
|
|
23
|
+
cancelMessage();
|
|
24
|
+
process.exit(INTERRUPTED_EXIT_CODE);
|
|
25
|
+
}
|
|
26
|
+
|
|
14
27
|
// ── ANSI helpers (replaces picocolors — zero dependencies) ───────────────────────────
|
|
15
28
|
const ESC = "\x1b[";
|
|
16
29
|
const c = {
|
|
@@ -77,8 +90,9 @@ function keySession(renderFn, onKey) {
|
|
|
77
90
|
|
|
78
91
|
const handler = (str, key) => {
|
|
79
92
|
key = key || {};
|
|
80
|
-
//
|
|
81
|
-
if (
|
|
93
|
+
// Ctrl+C stops the run (the prompt never resolves) · ESC cancels this prompt only
|
|
94
|
+
if (key.ctrl && key.name === "c") { cleanup(); stopRunOnCtrlC(); return; }
|
|
95
|
+
if (key.name === "escape") {
|
|
82
96
|
cleanup();
|
|
83
97
|
resolve(CANCEL);
|
|
84
98
|
return;
|
|
@@ -223,7 +237,8 @@ export async function text({ message, defaultValue = "" }) {
|
|
|
223
237
|
|
|
224
238
|
const handler = (str, key) => {
|
|
225
239
|
key = key || {};
|
|
226
|
-
if (
|
|
240
|
+
if (key.ctrl && key.name === "c") { cleanup(); stopRunOnCtrlC(); return; }
|
|
241
|
+
if (key.name === "escape") { cleanup(); resolve(CANCEL); return; }
|
|
227
242
|
if (key.name === "return" || key.name === "enter") {
|
|
228
243
|
cleanup();
|
|
229
244
|
resolve(buf.length ? buf : defaultValue);
|