projectops 4.97.4 → 4.98.0
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/cli/args.js +10 -0
- package/src/cli/help.js +4 -0
- package/src/context.js +1 -0
- package/src/core/branch-sub.js +29 -2
- package/src/core/copy/workflows.js +12 -12
- package/src/core/options-schema.js +11 -0
- package/src/core/resolve-options.js +3 -0
- package/src/core/version-yml.js +14 -3
- package/src/core/wizard-env.js +1 -1
- package/src/index.js +1 -1
package/README.md
CHANGED
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
**Status: actively maintained.** npm `latest` is exactly what is on the `main` branch; work in progress on `develop` is never published. Versions can still ship several times a day. Note that `npx projectops@<version>` pins the installer only (workflow templates always come from the current `main`) ([releases](https://github.com/Cassiiopeia/projectops/releases)).
|
|
31
31
|
|
|
32
32
|
<!-- AUTO-VERSION-SECTION: DO NOT EDIT MANUALLY -->
|
|
33
|
-
## Latest version : v4.
|
|
33
|
+
## Latest version : v4.98.0 (2026-11-10)
|
|
34
34
|
|
|
35
35
|
[View full version history](CHANGELOG.md)
|
|
36
36
|
|
package/package.json
CHANGED
package/src/cli/args.js
CHANGED
|
@@ -28,6 +28,7 @@ export function parseArgs(argv) {
|
|
|
28
28
|
deployTarget: null, // 배포 축 (#439): docker-ssh|vercel|none, null=미설정
|
|
29
29
|
publishTargets: null, // publish 축 (#439): 타겟 배열, null=미설정
|
|
30
30
|
deployBranch: "", // 릴리스 PR head 브랜치 (#456): --deploy-branch, 빈 값=미지정
|
|
31
|
+
deployTriggerBranch: "", // 배포 워크플로가 트리거되는 브랜치 (#1114): --deploy-trigger-branch, 빈 값=기본 브랜치
|
|
31
32
|
language: null, // 레포 문구 언어 (#769): --language en|ko (화면 언어 --lang 과 다르다)
|
|
32
33
|
labelStyle: null, // 상태 라벨 표기 (#776): --label-style en|ko
|
|
33
34
|
intent: null, // 프로젝트 성격 (#485): --intent app|library|both|none|manual, null=미설정(역추론)
|
|
@@ -131,6 +132,15 @@ export function parseArgs(argv) {
|
|
|
131
132
|
if (v) result.deployBranch = v;
|
|
132
133
|
break;
|
|
133
134
|
}
|
|
135
|
+
case "--deploy-trigger-branch": {
|
|
136
|
+
// 푸시되면 배포가 도는 브랜치 (#1114). 기본 브랜치와 나눌 때만 쓴다. 워크플로 yaml에 그대로 들어가므로 --deploy-branch 와 같은 검사.
|
|
137
|
+
const v = (args.shift() ?? "").trim();
|
|
138
|
+
if (v && (!BRANCH_RE.test(v) || v.includes("..") || v.endsWith("/") || v.endsWith(".lock"))) {
|
|
139
|
+
throw new CliError(t("args.deployBranch", { v }));
|
|
140
|
+
}
|
|
141
|
+
if (v) result.deployTriggerBranch = v;
|
|
142
|
+
break;
|
|
143
|
+
}
|
|
134
144
|
case "--intent": {
|
|
135
145
|
// 프로젝트 성격 (#485). 미지정이면 --deploy/--publish에서 역추론.
|
|
136
146
|
const v = (args.shift() ?? "").trim();
|
package/src/cli/help.js
CHANGED
|
@@ -42,6 +42,8 @@ Options
|
|
|
42
42
|
--paths "t=p,..." per-type project folders for monorepos, e.g. flutter=app,react=client. Folders must exist inside the repo
|
|
43
43
|
--intent KIND app | library | both | none | manual. Decides which deploy/publish questions exist.
|
|
44
44
|
omitted: inferred from --deploy/--publish
|
|
45
|
+
--deploy-trigger-branch NAME
|
|
46
|
+
Branch whose push runs the deploy workflows, when it is not the default branch. Omitted: the default branch
|
|
45
47
|
--label-style STYLE en = 'status: todo' labels, ko = legacy Korean names. New installs en, existing installs keep ko
|
|
46
48
|
--language LANG en | ko. Language of issue/PR templates, bot comments and version.yml comments written into the repo
|
|
47
49
|
(not the CLI screen — that is --lang). New installs en, existing installs keep the stored value
|
|
@@ -124,6 +126,8 @@ AI agent 나 CI 는 항상 이렇게 실행한다: npx projectops --mode <
|
|
|
124
126
|
--paths "t=p,..." 타입별 프로젝트 폴더(모노레포). 예: flutter=app,react=client. 폴더는 레포 안에 있어야 한다
|
|
125
127
|
--intent KIND app | library | both | none | manual. 배포·publish 질문을 어떻게 할지 정한다.
|
|
126
128
|
생략: --deploy/--publish 에서 추정
|
|
129
|
+
--deploy-trigger-branch NAME
|
|
130
|
+
Branch whose push runs the deploy workflows, when it is not the default branch. Omitted: the default branch
|
|
127
131
|
--label-style STYLE en = 'status: todo' 라벨, ko = 기존 한글 이름. 신규 en, 기존 설치는 ko 유지
|
|
128
132
|
--language LANG en | ko. 레포에 쓰이는 이슈/PR 템플릿·봇 댓글·version.yml 주석의 언어
|
|
129
133
|
(CLI 화면 언어는 --lang 이다). 신규 en, 기존 설치는 저장값 유지
|
package/src/context.js
CHANGED
|
@@ -26,6 +26,7 @@ export function createContext(overrides = {}) {
|
|
|
26
26
|
changelogBaseUrl: null, // ollama일 때만 값
|
|
27
27
|
codeReviewCoderabbit: null,
|
|
28
28
|
deployBranch: "", // 릴리스 PR head 브랜치 (#456). 빈 값=metadata.development_branch 미출력
|
|
29
|
+
deployTriggerBranch: "", // 푸시되면 배포가 도는 브랜치 (#1114). 빈 값=기본 브랜치와 같음(워크플로 그대로)
|
|
29
30
|
intent: null, // 프로젝트 성격 (#485 — app/library/both/none/manual). null=미설정(역추론)
|
|
30
31
|
semverAuto: null, // semver 자동 승격 (#546). null=미설정 → 신규·기존 모두 true (#814). 명시적 false 만 끈다
|
|
31
32
|
closeOnRelease: null, // 릴리스 시 완료 이슈 닫기 (#771). null=미설정(신규 true / 기존 레포 키 없음)
|
package/src/core/branch-sub.js
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
// 2) 트리거 멀티라인: " - main" / " - develop" 단독 라인 (뒤 주석 허용)
|
|
9
9
|
// 3) 릴리스 가드: == 'develop' (RELEASE-CHANGELOG automerge head 가드)
|
|
10
10
|
// 4) step 내부: git fetch origin main (RELEASE-CHANGELOG 커밋 분석)
|
|
11
|
+
// 5) 배포 트리거(#1114): 배포 워크플로 파일만, main > deployTriggerBranch (아래 DEPLOY_TRIGGER_WORKFLOWS)
|
|
11
12
|
|
|
12
13
|
// main(기본 브랜치) 계열 치환
|
|
13
14
|
function subDefault(s, db) {
|
|
@@ -25,17 +26,43 @@ function subDeploy(s, dev) {
|
|
|
25
26
|
return s;
|
|
26
27
|
}
|
|
27
28
|
|
|
29
|
+
// 푸시되면 배포가 도는 워크플로 (파일 이름 정확 일치). 기본 브랜치와 배포 브랜치를 나눈 레포에서만 쓴다.
|
|
30
|
+
// 공통 워크플로(버전 올림 · README 버전 · 릴리스 노트 · 이슈 닫기)는 여기 없다: 기본 브랜치를 따른다.
|
|
31
|
+
// 배포 워크플로를 추가하면 이 표에도 넣는다 (안 넣으면 그 파일은 기본 브랜치에서 배포가 돈다)
|
|
32
|
+
export const DEPLOY_TRIGGER_WORKFLOWS = new Set([
|
|
33
|
+
"PROJECT-FLUTTER-ANDROID-FIREBASE-CICD.yaml", "PROJECT-FLUTTER-ANDROID-PLAYSTORE-CICD.yaml",
|
|
34
|
+
"PROJECT-FLUTTER-ANDROID-SELFHOSTED-CICD.yaml", "PROJECT-FLUTTER-IOS-TESTFLIGHT.yaml",
|
|
35
|
+
"PROJECT-SPRING-SIMPLE-CICD.yaml", "PROJECT-PYTHON-SIMPLE-CICD.yaml", "PROJECT-REACT-CICD.yaml",
|
|
36
|
+
"PROJECT-COMMON-VERCEL-DEPLOY.yaml", "PROJECT-NODE-NPM-PUBLISH.yaml",
|
|
37
|
+
"PROJECT-SPRING-NEXUS-PUBLISH.yml", "PROJECT-SPRING-GITHUB-PACKAGES-PUBLISH.yml",
|
|
38
|
+
]);
|
|
39
|
+
|
|
40
|
+
// 배포 트리거 브랜치 치환: 트리거 · 체크아웃 ref · pull · 실행 조건의 main
|
|
41
|
+
function subDeployTrigger(s, trigger) {
|
|
42
|
+
s = s.replace(/^(\s*branches:\s*\[\s*["']?)main(["']?\s*\])/gm, `$1${trigger}$2`);
|
|
43
|
+
s = s.replace(/^(\s*-\s*)main(\s*(?:#.*)?)$/gm, `$1${trigger}$2`);
|
|
44
|
+
s = s.replace(/^(\s*ref:\s*)main(\s*(?:#.*)?)$/gm, `$1${trigger}$2`);
|
|
45
|
+
s = s.replace(/\bgit pull origin main\b/g, `git pull origin ${trigger}`);
|
|
46
|
+
s = s.replace(/refs\/heads\/main\b/g, `refs/heads/${trigger}`);
|
|
47
|
+
return s;
|
|
48
|
+
}
|
|
49
|
+
|
|
28
50
|
// content에 브랜치 설정을 적용한 결과를 반환. branches 미지정/표준값이면 원본 그대로.
|
|
29
51
|
// 플레이스홀더 2단 치환: 값 충돌 방지 (예: 기본 브랜치=develop인 레포에서 main→develop 치환 결과가
|
|
30
52
|
// 곧이어 develop→X 치환에 다시 걸리는 연쇄 오염을 차단).
|
|
31
|
-
|
|
53
|
+
// filename: 배포 트리거 치환(#1114)이 배포 워크플로 파일에만 걸리게 하는 기준. 없으면 배포 트리거 치환은 건너뛴다.
|
|
54
|
+
export function substituteBranches(content, branches = null, filename = "") {
|
|
32
55
|
if (!branches) return content;
|
|
33
56
|
const db = branches.defaultBranch || "main";
|
|
34
57
|
const dev = branches.deployBranch || "develop";
|
|
58
|
+
const trigger = branches.deployTriggerBranch || "";
|
|
35
59
|
let s = String(content);
|
|
36
60
|
const T_DB = "__PJOPS_DEFAULT__";
|
|
37
61
|
const T_DEV = "__PJOPS_DEPLOY__";
|
|
62
|
+
const T_TRIGGER = "__PJOPS_TRIGGER__";
|
|
63
|
+
// 배포 워크플로의 main 은 기본 브랜치가 아니라 배포 트리거 브랜치로 간다 (먼저 자리표시자로 빼 둠)
|
|
64
|
+
if (trigger && DEPLOY_TRIGGER_WORKFLOWS.has(filename)) s = subDeployTrigger(s, T_TRIGGER);
|
|
38
65
|
if (dev !== "develop") s = subDeploy(s, T_DEV);
|
|
39
66
|
if (db !== "main") s = subDefault(s, T_DB);
|
|
40
|
-
return s.replaceAll(T_DEV, dev).replaceAll(T_DB, db);
|
|
67
|
+
return s.replaceAll(T_TRIGGER, trigger).replaceAll(T_DEV, dev).replaceAll(T_DB, db);
|
|
41
68
|
}
|
|
@@ -71,7 +71,7 @@ function classify(srcDir, workflowsDir, envOpts, baseline = null) {
|
|
|
71
71
|
if (existsSync(dst)) {
|
|
72
72
|
const tpl = readFileSync(src, "utf8");
|
|
73
73
|
const inst = readFileSync(dst, "utf8");
|
|
74
|
-
if (isUnchanged(tpl, inst, envOpts)) { result.unchanged.push(filename); continue; }
|
|
74
|
+
if (isUnchanged(tpl, inst, { ...envOpts, filename })) { result.unchanged.push(filename); continue; }
|
|
75
75
|
// 여기 왔다는 건 "지금 템플릿 렌더 결과 ≠ 설치본" — 사용자 수정이거나 업스트림 변경이다.
|
|
76
76
|
// baseline이 그 둘을 가른다.
|
|
77
77
|
const modified = isUserModified(baseline, filename, inst);
|
|
@@ -92,7 +92,7 @@ function classify(srcDir, workflowsDir, envOpts, baseline = null) {
|
|
|
92
92
|
// hooks: { decisions?: Map<filename, 'skip'|'backup'|'template'> } — 기존 파일(changed) 충돌 결정.
|
|
93
93
|
// 반환: {copied, skipped, templateAdded, optionalCopied, copiedFiles[]} — copiedFiles는 실제 복사·교체된 파일명 (#473 요약용)
|
|
94
94
|
export function copyWorkflows(context, tempDir, targetRoot = ".", hooks = {}) {
|
|
95
|
-
const { types = [], paths = new Map(), deployTarget = "docker-ssh", publishTargets = [], includeSecretBackup = false, aiPrSummary = true, projectsSync = true, repoName = "", resolvers = {}, envValues = new Map(), envUseDefaults = true, branch = "", deployBranch = "" } = context;
|
|
95
|
+
const { types = [], paths = new Map(), deployTarget = "docker-ssh", publishTargets = [], includeSecretBackup = false, aiPrSummary = true, projectsSync = true, repoName = "", resolvers = {}, envValues = new Map(), envUseDefaults = true, branch = "", deployBranch = "", deployTriggerBranch = "" } = context;
|
|
96
96
|
const decisions = hooks.decisions instanceof Map ? hooks.decisions : new Map();
|
|
97
97
|
const trace = hooks.trace ?? null; // #494 — 실행 트레이스 (null-safe: 미주입이면 전 이벤트 no-op)
|
|
98
98
|
const workflowsDir = join(targetRoot, PATHS.workflowsDir);
|
|
@@ -107,7 +107,7 @@ export function copyWorkflows(context, tempDir, targetRoot = ".", hooks = {}) {
|
|
|
107
107
|
const deployValues = new Map(); // Map<type, Map<key,value>> — deploy 블록용 ask 값
|
|
108
108
|
counters.deployValues = deployValues;
|
|
109
109
|
// 브랜치 전략 (#477) — 표준(main/develop)이면 치환·가상비교 모두 no-op
|
|
110
|
-
const branches = { defaultBranch: branch || "main", deployBranch: deployBranch || "develop" };
|
|
110
|
+
const branches = { defaultBranch: branch || "main", deployBranch: deployBranch || "develop", deployTriggerBranch: deployTriggerBranch || "" };
|
|
111
111
|
// values/useDefaults는 치환 경로에서만 의미 (isUnchanged는 내부에서 useDefaults:true 강제 — 가상 비교 무손상)
|
|
112
112
|
const envOptsFor = (type) => ({ type, projectPath: paths.get(type) || ".", repoName, resolvers, values: envValues, useDefaults: envUseDefaults, branches });
|
|
113
113
|
|
|
@@ -139,7 +139,7 @@ export function copyWorkflows(context, tempDir, targetRoot = ".", hooks = {}) {
|
|
|
139
139
|
try {
|
|
140
140
|
// 마음이 바뀌면 cp 한 번으로 되살릴 수 있게 렌더본을 incoming 에 남긴다
|
|
141
141
|
const rendered = substituteBranches(substituteEnv(readFileSync(join(srcDir, filename), "utf8"),
|
|
142
|
-
{ ...envOptsFor(group.split("/")[0]), useDefaults: true }), branches);
|
|
142
|
+
{ ...envOptsFor(group.split("/")[0]), useDefaults: true }), branches, filename);
|
|
143
143
|
info.incoming = saveIncoming(targetRoot, filename, rendered);
|
|
144
144
|
} catch { /* 안내만 빠진다 */ }
|
|
145
145
|
notInstalled.push(info);
|
|
@@ -155,7 +155,7 @@ export function copyWorkflows(context, tempDir, targetRoot = ".", hooks = {}) {
|
|
|
155
155
|
try {
|
|
156
156
|
// 설치 때와 같은 렌더(기본값 치환 + 브랜치 치환)를 거쳐야 diff가 "진짜 차이"만 보여준다
|
|
157
157
|
const rendered = substituteBranches(
|
|
158
|
-
substituteEnv(readFileSync(join(srcDir, filename), "utf8"), { ...envOptsFor(type), useDefaults: true }), branches);
|
|
158
|
+
substituteEnv(readFileSync(join(srcDir, filename), "utf8"), { ...envOptsFor(type), useDefaults: true }), branches, filename);
|
|
159
159
|
info.incoming = saveIncoming(targetRoot, filename, rendered);
|
|
160
160
|
const d = lineDiffCounts(readFileSync(join(workflowsDir, filename), "utf8"), rendered);
|
|
161
161
|
info.added = d.added; info.removed = d.removed;
|
|
@@ -248,7 +248,7 @@ export function copyWorkflows(context, tempDir, targetRoot = ".", hooks = {}) {
|
|
|
248
248
|
trace?.event("copy", "copied", filename, { group: group.copyLabel });
|
|
249
249
|
continue;
|
|
250
250
|
}
|
|
251
|
-
if (existsSync(dst) && isUnchanged(readFileSync(src, "utf8"), readFileSync(dst, "utf8"), envOptsFor("common"))) {
|
|
251
|
+
if (existsSync(dst) && isUnchanged(readFileSync(src, "utf8"), readFileSync(dst, "utf8"), { ...envOptsFor("common"), filename })) {
|
|
252
252
|
counters.skipped++;
|
|
253
253
|
trace?.event("copy", "skipped-unchanged", filename, { group: group.copyLabel });
|
|
254
254
|
continue;
|
|
@@ -267,15 +267,15 @@ export function copyWorkflows(context, tempDir, targetRoot = ".", hooks = {}) {
|
|
|
267
267
|
|
|
268
268
|
// (6) 브랜치 치환 post-pass (#477) — 표준과 다른 브랜치 전략일 때만 복사된 파일에 적용.
|
|
269
269
|
// isUnchanged 가상 비교에도 같은 branches가 들어가므로 다음 업데이트에서 재복사 churn이 없다.
|
|
270
|
-
if (branches.defaultBranch !== "main" || branches.deployBranch !== "develop") {
|
|
270
|
+
if (branches.defaultBranch !== "main" || branches.deployBranch !== "develop" || branches.deployTriggerBranch) {
|
|
271
271
|
for (const f of counters.copiedFiles) {
|
|
272
272
|
const p = join(workflowsDir, f);
|
|
273
273
|
if (!existsSync(p)) continue;
|
|
274
274
|
const before = readFileSync(p, "utf8");
|
|
275
|
-
const after = substituteBranches(before, branches);
|
|
275
|
+
const after = substituteBranches(before, branches, f);
|
|
276
276
|
if (after !== before) {
|
|
277
277
|
writeFileSync(p, after);
|
|
278
|
-
trace?.event("env", "branch-substituted", f, { defaultBranch: branches.defaultBranch, deployBranch: branches.deployBranch });
|
|
278
|
+
trace?.event("env", "branch-substituted", f, { defaultBranch: branches.defaultBranch, deployBranch: branches.deployBranch, deployTriggerBranch: branches.deployTriggerBranch });
|
|
279
279
|
}
|
|
280
280
|
}
|
|
281
281
|
}
|
|
@@ -348,13 +348,13 @@ function applyDecision(decision, srcDir, workflowsDir, filename, counters, trace
|
|
|
348
348
|
// 대상 워크플로우 디렉토리에서 changed(충돌) 파일 목록만 뽑는다 — 마법사(commands/interactive.js)가 쓴다.
|
|
349
349
|
// copyWorkflows 본체와 동일한 classify 기준을 써야 결정 Map이 실제 처리 대상과 1:1로 맞는다.
|
|
350
350
|
export function listWorkflowConflicts(context, tempDir, targetRoot = ".") {
|
|
351
|
-
const { types = [], paths = new Map(), deployTarget = "docker-ssh", repoName = "", resolvers = {}, branch = "", deployBranch = "" } = context;
|
|
351
|
+
const { types = [], paths = new Map(), deployTarget = "docker-ssh", repoName = "", resolvers = {}, branch = "", deployBranch = "", deployTriggerBranch = "" } = context;
|
|
352
352
|
const workflowsDir = join(targetRoot, PATHS.workflowsDir);
|
|
353
353
|
// 설치 시점 기준점(#557) — 없으면 null이고 classify가 종전 2-way로 폴백한다.
|
|
354
354
|
const baseline = readBaseline(targetRoot);
|
|
355
355
|
const projectTypesDir = join(tempDir, PATHS.workflowsDir, PATHS.projectTypesDir);
|
|
356
356
|
const conflicts = []; // [{ filename, type }] — 엔진 처리 순서와 동일 (common → 타입 순회 → server-deploy)
|
|
357
|
-
const branches = { defaultBranch: branch || "main", deployBranch: deployBranch || "develop" }; // #477 — 엔진과 동일 기준
|
|
357
|
+
const branches = { defaultBranch: branch || "main", deployBranch: deployBranch || "develop", deployTriggerBranch: deployTriggerBranch || "" }; // #477 — 엔진과 동일 기준
|
|
358
358
|
|
|
359
359
|
// common (#560) — 사용자가 손댄 것이 "확인된" 파일만 질문 대상이다.
|
|
360
360
|
// 기준점이 없어 판정 불가인 파일은 엔진이 .bak을 남기고 덮어쓰므로 질문하지 않는다.
|
|
@@ -429,7 +429,7 @@ function copyWorkflowsForType(type, projectTypesDir, workflowsDir, ctx, counters
|
|
|
429
429
|
for (const filename of listYamlFiles(pubDir)) {
|
|
430
430
|
const src = join(pubDir, filename);
|
|
431
431
|
const dst = join(workflowsDir, filename);
|
|
432
|
-
if (existsSync(dst) && isUnchanged(readFileSync(src, "utf8"), readFileSync(dst, "utf8"), envOpts)) {
|
|
432
|
+
if (existsSync(dst) && isUnchanged(readFileSync(src, "utf8"), readFileSync(dst, "utf8"), { ...envOpts, filename })) {
|
|
433
433
|
counters.skipped++;
|
|
434
434
|
trace?.event("copy", "skipped-unchanged", filename, { group: `${type}/publish/${target}` });
|
|
435
435
|
continue;
|
|
@@ -48,6 +48,8 @@ export const FLAGS = [
|
|
|
48
48
|
description: "Registries a library is published to. Several allowed.", versionYml: "metadata.template.options.publish" },
|
|
49
49
|
{ flag: "--deploy-branch", value: "NAME", default: "develop",
|
|
50
50
|
description: "Development branch: the head of the release PR. Not the repository default branch.", versionYml: "metadata.development_branch" },
|
|
51
|
+
{ flag: "--deploy-trigger-branch", value: "NAME", default: "the default branch",
|
|
52
|
+
description: "Branch whose push runs the deploy workflows. Only when it differs from the default branch.", versionYml: "metadata.template.options.deploy_trigger_branch" },
|
|
51
53
|
{ flag: "--create-development-branch", default: "off",
|
|
52
54
|
description: "Non-interactive runs: create the development branch from the default branch and push it to origin when it does not exist." },
|
|
53
55
|
{ flag: "--language", value: "LANG", values: [...REPO_LANGUAGES], default: "en for new installs, ko for existing installs",
|
|
@@ -103,6 +105,8 @@ export const VERSION_YML = [
|
|
|
103
105
|
{ path: "metadata.template.options.close_on_release", parserKey: "closeOnRelease", type: "boolean", default: "true for new installs; missing for existing installs",
|
|
104
106
|
description: "A release merge closes issues that carry the done label and are referenced by a release commit.", edit: "by hand" },
|
|
105
107
|
{ path: "metadata.template.options.language", parserKey: "language", type: "enum", values: [...REPO_LANGUAGES], description: "Issue/PR template and bot message language.", edit: "wizard (--language)" },
|
|
108
|
+
{ path: "metadata.template.options.deploy_trigger_branch", parserKey: "deployTriggerBranch", type: "string", default: "the default branch",
|
|
109
|
+
description: "Branch whose push runs the deploy workflows (app store, server, package publish).", edit: "wizard (--deploy-trigger-branch)" },
|
|
106
110
|
{ path: "metadata.template.options.label_style", parserKey: "labelStyle", type: "enum", values: [...LABEL_STYLES], description: "Status label names.", edit: "wizard (--label-style)" },
|
|
107
111
|
{ path: "metadata.template.options.projects_sync", parserKey: "projectsSync", type: "boolean", description: "Projects status sync workflow installed.", edit: "wizard (--projects-sync)" },
|
|
108
112
|
{ path: "metadata.template.options.app_release", parserKey: "appRelease", type: "boolean",
|
|
@@ -183,6 +187,12 @@ export const FLAG_DETAILS = {
|
|
|
183
187
|
omitted: "No publish workflow.",
|
|
184
188
|
example: "npx projectops --mode workflows --force --type node --publish npm",
|
|
185
189
|
},
|
|
190
|
+
"--deploy-trigger-branch": {
|
|
191
|
+
when: "Only if deploys must run from a branch other than the default branch (for example develop > main > deploy).",
|
|
192
|
+
effect: "Writes metadata.template.options.deploy_trigger_branch and rewrites main to that branch in the deploy workflows only: push trigger, checkout ref, git pull, branch check. Version bump, README version, release notes and issue closing keep following the default branch. Create the branch yourself first.",
|
|
193
|
+
omitted: "The deploy workflows follow the default branch, unchanged.",
|
|
194
|
+
example: "npx projectops --mode workflows --force --deploy-trigger-branch deploy",
|
|
195
|
+
},
|
|
186
196
|
"--deploy-branch": {
|
|
187
197
|
when: "Only if your development branch is not named develop.",
|
|
188
198
|
effect: "Writes metadata.development_branch (and the old deploy_branch with the same value) and rewrites the branch name inside the installed workflows (release PR head, CI triggers, PR summary base). The branch is NOT created by this flag (use --create-development-branch).",
|
|
@@ -279,6 +289,7 @@ export const KEY_DETAILS = {
|
|
|
279
289
|
"metadata.template.options.semver_auto": { when: "Set false only if you want every release to be a patch bump.", effect: "true: the release PR and direct pushes to the default branch pick the bump from commit titles ('type!:' major, 'feat:' minor, otherwise patch). false: always patch.", omitted: "true (also for existing installs when the key is missing).", caution: "A repo that switches from patch-only to true can jump a minor version on its next release; the update summary warns about it." },
|
|
280
290
|
"metadata.template.options.close_on_release": { when: "Set false to keep finished issues open after a release.", effect: "A release merge closes issues that carry the done label and are referenced by a release commit.", omitted: "true for new installs; off (key missing) for existing installs." },
|
|
281
291
|
"metadata.template.options.language": { when: "Edit via --language.", effect: "Language of issue/PR templates, bot comments and version.yml comments.", omitted: "en for new installs, ko for existing ones." },
|
|
292
|
+
"metadata.template.options.deploy_trigger_branch": { when: "Edit via --deploy-trigger-branch.", effect: "Branch whose push runs the deploy workflows; the installed deploy workflows trigger on it instead of the default branch.", omitted: "The default branch." },
|
|
282
293
|
"metadata.template.options.label_style": { when: "Edit via --label-style.", effect: "Status label names (en 'status: todo' or legacy ko).", omitted: "en for new installs, ko for existing ones." },
|
|
283
294
|
"metadata.template.options.projects_sync": { when: "Edit via --projects-sync.", effect: "Whether the Projects status sync workflow is installed.", omitted: "false for new installs; kept if installed." },
|
|
284
295
|
"metadata.template.options.app_release": { when: "Set true by hand for repos whose releases go through App Store / Play Store review.", effect: "The deploy skill (pro-changelog-deploy) treats releases as going through store review: release notes get a review warning banner and are checked more strictly, and the release PR always waits for manual approval instead of automerging.", omitted: "Not set. Never enabled automatically.", caution: "Do not set it on repos that do not ship to a store." },
|
|
@@ -57,6 +57,8 @@ export function resolveOptions({ flags = {}, existing = null, types = [], cwd =
|
|
|
57
57
|
recordMode: existing?.templateMode === "full" ? "full" : "version",
|
|
58
58
|
// #456 — 비어 있으면 version.yml 에 쓰지 않는다 (스킬이 develop 으로 폴백). 사용자가 고르거나 플래그로 준 것만 기록.
|
|
59
59
|
deployBranch: flags.deployBranch || stored.deployBranch || "",
|
|
60
|
+
// #1114 — 비어 있으면 워크플로를 바꾸지 않고 version.yml 에도 쓰지 않는다 (기존 레포 무변화)
|
|
61
|
+
deployTriggerBranch: flags.deployTriggerBranch || stored.deployTriggerBranch || "",
|
|
60
62
|
// #455 — null 이 흘러 provider:"null" 로 기록되던 버그 방지
|
|
61
63
|
changelogProvider: migrateProvider(stored.changelogProvider) ?? "commit",
|
|
62
64
|
changelogBaseUrl: stored.changelogBaseUrl ?? "",
|
|
@@ -96,6 +98,7 @@ const TEMPLATE_OPTION_FIELDS = [
|
|
|
96
98
|
"intent", "deployTarget", "publishTargets", "includeSecretBackup", "aiPrSummary", "projectsSync",
|
|
97
99
|
"changelogProvider", "changelogBaseUrl", "codeReviewCoderabbit", "semverAuto", "appRelease",
|
|
98
100
|
"excludedWorkflows", "storeLocales", "storeLocalesIos", "storeLocalesPlay", "closeOnRelease", "language", "labelStyle",
|
|
101
|
+
"deployTriggerBranch",
|
|
99
102
|
];
|
|
100
103
|
|
|
101
104
|
/** 실행 context(resolveOptions 값이 펼쳐진 것) > buildVersionYml templateOptions */
|
package/src/core/version-yml.js
CHANGED
|
@@ -9,6 +9,7 @@ import { REPO_LANGUAGES } from "./repo-language.js";
|
|
|
9
9
|
// (언어를 패턴에 박아 두면 새 언어를 저장한 뒤 다음 업데이트에서 못 읽고 ko 로 되돌아간다.)
|
|
10
10
|
const alt = (values) => values.map((v) => v.replace(/[.*+?^${}()|[\]\\-]/g, "\\$&")).join("|");
|
|
11
11
|
const LANGUAGE_RE = new RegExp(`^\\s+language:\\s*["']?(${alt(REPO_LANGUAGES)})["']?`);
|
|
12
|
+
const DEPLOY_TRIGGER_BRANCH_RE = /^\s+deploy_trigger_branch:\s*["']?([A-Za-z0-9._\/-]+)["']?/;
|
|
12
13
|
const LABEL_STYLE_RE = new RegExp(`^\\s+label_style:\\s*["']?(${alt(LABEL_STYLES)})["']?`);
|
|
13
14
|
|
|
14
15
|
const HEADER_EN = `# ===================================================================
|
|
@@ -112,6 +113,7 @@ const COMMENTS = {
|
|
|
112
113
|
closeOnRelease: "close issues labelled done when a release is merged (false or missing means do not close)",
|
|
113
114
|
language: "issue/PR template language (en | ko)",
|
|
114
115
|
labelStyle: "status label style (en: status: todo / ko: Korean names)",
|
|
116
|
+
deployTriggerBranch: "branch whose push runs the deploy workflows (missing = the default branch)",
|
|
115
117
|
appRelease: "whether releases go through App Store / Play Store review",
|
|
116
118
|
deploy: "deploy settings remembered by the wizard (non-sensitive, safe to edit by hand)",
|
|
117
119
|
excluded: "workflow files the update must never install (safe to edit by hand)",
|
|
@@ -130,6 +132,7 @@ const COMMENTS = {
|
|
|
130
132
|
closeOnRelease: "릴리스 머지 때 완료 라벨 이슈를 닫는다 (false/미기재면 닫지 않음)",
|
|
131
133
|
language: "이슈/PR 템플릿 언어 (en | ko)",
|
|
132
134
|
labelStyle: "상태 라벨 표기 (en: status: todo / ko: 작업전)",
|
|
135
|
+
deployTriggerBranch: "branch whose push runs the deploy workflows (missing = the default branch)",
|
|
133
136
|
appRelease: "앱스토어·플레이스토어 심사로 이어지는 배포인가",
|
|
134
137
|
deploy: "마법사가 기억하는 배포 설정 (비민감 / 직접 수정 가능)",
|
|
135
138
|
excluded: "업데이트가 절대 설치하지 않을 워크플로우 파일 (직접 수정 가능)",
|
|
@@ -164,7 +167,7 @@ export function resolveUpdatedBy(existingContent = "", cwd = ".") {
|
|
|
164
167
|
export function parseTemplateOptions(content) {
|
|
165
168
|
const out = { deploy: null, publish: null, secretBackup: null,
|
|
166
169
|
changelogProvider: null, changelogBaseUrl: null, codeReviewCoderabbit: null, aiPrSummary: null, projectsSync: null,
|
|
167
|
-
deployBranch: null, intent: null, semverAuto: null, appRelease: null, labelStyle: null, closeOnRelease: null, language: null, excludedWorkflows: null, storeLocales: null, storeLocalesIos: null, storeLocalesPlay: null };
|
|
170
|
+
deployBranch: null, deployTriggerBranch: null, intent: null, semverAuto: null, appRelease: null, labelStyle: null, closeOnRelease: null, language: null, excludedWorkflows: null, storeLocales: null, storeLocalesIos: null, storeLocalesPlay: null };
|
|
168
171
|
// 개발 브랜치는 metadata 직속(#456) — template.options 밖이라 별도로 스캔한다.
|
|
169
172
|
out.deployBranch = readDevelopmentBranch(content);
|
|
170
173
|
let legacyNexus = null;
|
|
@@ -250,6 +253,12 @@ export function parseTemplateOptions(content) {
|
|
|
250
253
|
out.labelStyle = m[1];
|
|
251
254
|
continue;
|
|
252
255
|
}
|
|
256
|
+
// 배포 트리거 브랜치(#1114) — 미기재면 기본 브랜치와 같다.
|
|
257
|
+
m = line.match(DEPLOY_TRIGGER_BRANCH_RE);
|
|
258
|
+
if (m) {
|
|
259
|
+
out.deployTriggerBranch = m[1];
|
|
260
|
+
continue;
|
|
261
|
+
}
|
|
253
262
|
// Projects 보드 동기화(#716). null(미기재)이면 호출부가 "이미 설치돼 있으면 유지, 아니면 제외"로 해석한다.
|
|
254
263
|
m = line.match(/^\s+projects_sync:\s*["']?(true|false)["']?/);
|
|
255
264
|
if (m) {
|
|
@@ -438,7 +447,7 @@ const OWNED_TOP = new Set(["version", "version_code", "project_types", "project_
|
|
|
438
447
|
// buildVersionYml 이 쓰는 6칸 키와 같아야 한다 — 빠지면 재실행마다 그 키가 두 번 쓰인다 (대조: test/version-yml-preserve.test.js).
|
|
439
448
|
// nexus · npm_publish · synology 는 옛 키다 — 파서가 신형(publish · secret_backup)으로 바꿔 쓰므로 그대로 두면 이중 기록이 된다.
|
|
440
449
|
export const OWNED_OPTION_KEYS = new Set(["intent", "deploy", "publish", "secret_backup", "semver_auto", "projects_sync", "close_on_release",
|
|
441
|
-
"language", "label_style", "app_release", "excluded_workflows", "store_locales", "store_locales_ios", "store_locales_play",
|
|
450
|
+
"language", "label_style", "deploy_trigger_branch", "app_release", "excluded_workflows", "store_locales", "store_locales_ios", "store_locales_play",
|
|
442
451
|
"code_review", "changelog",
|
|
443
452
|
"nexus", "npm_publish", "synology"]);
|
|
444
453
|
|
|
@@ -586,7 +595,7 @@ export function buildVersionYml({ version, types = [], paths = new Map(), pathMa
|
|
|
586
595
|
if (templateOptions) {
|
|
587
596
|
const { templateVersion = "unknown", deployTarget = "docker-ssh", publishTargets = [], includeSecretBackup = false, optionsDate = today,
|
|
588
597
|
changelogProvider = "commit", changelogBaseUrl = "", codeReviewCoderabbit = true, aiPrSummary = true, intent = null, mode = null,
|
|
589
|
-
semverAuto = true, appRelease = null, labelStyle = null, closeOnRelease = null, projectsSync = null, language = null, excludedWorkflows = null, storeLocales = null, storeLocalesIos = null, storeLocalesPlay = null } = templateOptions;
|
|
598
|
+
semverAuto = true, appRelease = null, labelStyle = null, deployTriggerBranch = "", closeOnRelease = null, projectsSync = null, language = null, excludedWorkflows = null, storeLocales = null, storeLocalesIos = null, storeLocalesPlay = null } = templateOptions;
|
|
590
599
|
const publishJson = `[${publishTargets.map((t) => `"${t}"`).join(",")}]`;
|
|
591
600
|
// intent(프로젝트 성격, #485) — 미지정이면 deploy/publish에서 역추론해 기록 (재통합 시 진입 질문 생략용)
|
|
592
601
|
const intentVal = intent || inferIntent(deployTarget, publishTargets) || "manual";
|
|
@@ -618,6 +627,8 @@ export function buildVersionYml({ version, types = [], paths = new Map(), pathMa
|
|
|
618
627
|
if (storeLocalesPlay && storeLocalesPlay.length) out += ` store_locales_play: [${storeLocalesPlay.map((l) => `"${l}"`).join(", ")}] # Play: ${C.storeLocalesStore}\n`;
|
|
619
628
|
if (language) out += ` language: ${language} # ${C.language}\n`;
|
|
620
629
|
if (labelStyle) out += ` label_style: ${labelStyle} # ${C.labelStyle}\n`;
|
|
630
|
+
// 배포 트리거 브랜치(#1114) — 미지정이면 키를 쓰지 않는다(기존 레포 무변화).
|
|
631
|
+
if (deployTriggerBranch) out += ` deploy_trigger_branch: "${deployTriggerBranch}" # ${C.deployTriggerBranch}\n`;
|
|
621
632
|
// 앱 심사 배포 레포 여부(#553) — 미지정이면 키를 쓰지 않는다(기존 레포 무변화).
|
|
622
633
|
if (appRelease !== null) {
|
|
623
634
|
out += ` app_release: ${appRelease} # ${C.appRelease}\n`;
|
package/src/core/wizard-env.js
CHANGED
|
@@ -134,7 +134,7 @@ export function isUnchanged(templateContent, installedContent, opts = {}) {
|
|
|
134
134
|
// 재복사(.bak churn)되는 것을 막는다. opts.branches 미지정/표준값이면 no-op.
|
|
135
135
|
const virtual = substituteBranches(
|
|
136
136
|
substituteEnv(templateContent, { ...opts, useDefaults: true }),
|
|
137
|
-
opts.branches ?? null,
|
|
137
|
+
opts.branches ?? null, opts.filename ?? "",
|
|
138
138
|
);
|
|
139
139
|
return virtual === installedContent;
|
|
140
140
|
}
|
package/src/index.js
CHANGED
|
@@ -197,7 +197,7 @@ async function runCore(argv, { cwd = process.cwd(), source = { type: "git" }, cl
|
|
|
197
197
|
flags: {
|
|
198
198
|
intent: opts.intent, deployTarget: opts.deployTarget, publishTargets: opts.publishTargets,
|
|
199
199
|
includeSecretBackup: opts.includeSecretBackup, aiPrSummary: opts.aiPrSummary, projectsSync: opts.projectsSync,
|
|
200
|
-
deployBranch: opts.deployBranch, codeReviewCoderabbit: opts.codeReviewCoderabbit,
|
|
200
|
+
deployBranch: opts.deployBranch, deployTriggerBranch: opts.deployTriggerBranch, codeReviewCoderabbit: opts.codeReviewCoderabbit,
|
|
201
201
|
language: opts.language, labelStyle: opts.labelStyle,
|
|
202
202
|
},
|
|
203
203
|
existing, types, cwd,
|