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
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
// breaking-changes
|
|
2
|
-
// collectBreaking(
|
|
1
|
+
// Wiring for the breaking-changes check flow.
|
|
2
|
+
// collectBreaking (pure comparison) lives in breaking.js — this module handles loading (remote → cloned copy fallback), display and the confirm gate.
|
|
3
3
|
import { readFileSync, existsSync } from "node:fs";
|
|
4
4
|
import { join } from "node:path";
|
|
5
5
|
import { collectBreaking, localizeBreakingEntry } from "./breaking.js";
|
|
@@ -9,33 +9,33 @@ import { TEMPLATE_RAW_URL } from "./paths.js";
|
|
|
9
9
|
|
|
10
10
|
const BC_URL = `${TEMPLATE_RAW_URL}/.github/config/breaking-changes.json`;
|
|
11
11
|
|
|
12
|
-
//
|
|
12
|
+
// Remote first (3s timeout) → bundled copy in the cloned template → null if both fail (skip silently)
|
|
13
13
|
export async function loadBreakingJson(tempDir) {
|
|
14
14
|
try {
|
|
15
15
|
const res = await fetch(BC_URL, { signal: AbortSignal.timeout(3000) });
|
|
16
16
|
if (res.ok) return await res.json();
|
|
17
|
-
} catch { /*
|
|
17
|
+
} catch { /* Remote failed — fall back */ }
|
|
18
18
|
try {
|
|
19
19
|
const p = join(tempDir, ".github", "config", "breaking-changes.json");
|
|
20
20
|
if (existsSync(p)) return JSON.parse(readFileSync(p, "utf8"));
|
|
21
|
-
} catch { /*
|
|
21
|
+
} catch { /* Fallback failed — skip */ }
|
|
22
22
|
return null;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
//
|
|
25
|
+
// Returns true = proceed, false = cancelled by the user.
|
|
26
26
|
// opts:
|
|
27
|
-
// cwd -
|
|
28
|
-
// tempDir -
|
|
29
|
-
// templateVersion -
|
|
30
|
-
// askYesNo - async(message, defaultYes)→bool. null
|
|
31
|
-
// loader -
|
|
32
|
-
// onItems - (#493)
|
|
33
|
-
//
|
|
27
|
+
// cwd - integration target root (reads the current template version from the existing version.yml)
|
|
28
|
+
// tempDir - cloned template (for the bundled fallback)
|
|
29
|
+
// templateVersion - template version being installed (not the fixed DEFAULT_VERSION — design D2)
|
|
30
|
+
// askYesNo - async(message, defaultYes)→bool. null means non-interactive: print a warning and proceed
|
|
31
|
+
// loader - test injection (default loadBreakingJson)
|
|
32
|
+
// onItems - (#493) callback with the entries in range ({current, target, critical, warnings}) —
|
|
33
|
+
// the migration guide embeds the full action steps from it (called whether or not shown)
|
|
34
34
|
export async function runBreakingCheck({ cwd, tempDir, templateVersion, askYesNo = null, loader = loadBreakingJson, onItems = null }) {
|
|
35
35
|
const vy = join(cwd, "version.yml");
|
|
36
|
-
if (!existsSync(vy)) return true; //
|
|
36
|
+
if (!existsSync(vy)) return true; // New integration — nothing to compare with
|
|
37
37
|
const { templateVersion: current } = parseExisting(readFileSync(vy, "utf8"));
|
|
38
|
-
if (!current) return true; //
|
|
38
|
+
if (!current) return true; // No template metadata (unknown) — skip
|
|
39
39
|
|
|
40
40
|
const json = await loader(tempDir);
|
|
41
41
|
if (!json) return true;
|
|
@@ -44,10 +44,10 @@ export async function runBreakingCheck({ cwd, tempDir, templateVersion, askYesNo
|
|
|
44
44
|
if (critical.length || warnings.length) onItems?.({ current, target: templateVersion, critical, warnings });
|
|
45
45
|
if (critical.length === 0 && warnings.length === 0) return true;
|
|
46
46
|
|
|
47
|
-
//
|
|
48
|
-
//
|
|
47
|
+
// Show a summary list (#473 — dumping the full text made a wall of text so CRITICAL went unread,
|
|
48
|
+
// and wrapping long bodies broke the ║ box borders. One line per version and title; full text on request.)
|
|
49
49
|
const e = (s = "") => process.stderr.write(s + "\n");
|
|
50
|
-
//
|
|
50
|
+
// Screen text uses the screen language (entries passed to onItems for the guide stay in English — the run log is English)
|
|
51
51
|
const localized = (item) => localizeBreakingEntry(item, getLang());
|
|
52
52
|
e("");
|
|
53
53
|
e(t("breaking.title", { current, target: templateVersion, critical: critical.length, warnings: warnings.length }));
|
|
@@ -57,7 +57,7 @@ export async function runBreakingCheck({ cwd, tempDir, templateVersion, askYesNo
|
|
|
57
57
|
e("");
|
|
58
58
|
|
|
59
59
|
if (askYesNo) {
|
|
60
|
-
//
|
|
60
|
+
// Interactive: expand the full text (action steps) only when asked
|
|
61
61
|
const detail = await askYesNo(t("breaking.askDetail"), false);
|
|
62
62
|
if (detail === true) {
|
|
63
63
|
for (const it of [...critical, ...warnings]) {
|
|
@@ -76,11 +76,11 @@ export async function runBreakingCheck({ cwd, tempDir, templateVersion, askYesNo
|
|
|
76
76
|
|
|
77
77
|
if (critical.length > 0) {
|
|
78
78
|
if (askYesNo) {
|
|
79
|
-
//
|
|
79
|
+
// Interactive: stop without explicit confirmation (default N)
|
|
80
80
|
const ok = await askYesNo(t("breaking.askContinue"), false);
|
|
81
81
|
if (ok !== true) return false;
|
|
82
82
|
} else {
|
|
83
|
-
//
|
|
83
|
+
// Non-interactive (--force): warn and proceed instead of killing CI at the gate (CI friendly)
|
|
84
84
|
e(t("breaking.nonInteractive"));
|
|
85
85
|
}
|
|
86
86
|
}
|
package/src/core/breaking.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//
|
|
1
|
+
// Version compare: strip v prefix, compare 3 numeric parts, missing part = 0
|
|
2
2
|
export function compareVersions(a, b) {
|
|
3
3
|
const parse = (v) => String(v).replace(/^v/, "").split(".").map((n) => parseInt(n, 10) || 0);
|
|
4
4
|
const pa = parse(a), pb = parse(b);
|
|
@@ -10,9 +10,9 @@ export function compareVersions(a, b) {
|
|
|
10
10
|
return 0;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
// breaking-changes.json
|
|
14
|
-
// ⚠️ target
|
|
15
|
-
//
|
|
13
|
+
// Collect breaking-changes.json entries in the range current < ver <= target.
|
|
14
|
+
// ⚠️ target is the real templateVersion, not a hardcoded 1.3.14 (D2).
|
|
15
|
+
// Skip keys starting with _ (meta). severity: critical / anything else (warning).
|
|
16
16
|
export function collectBreaking(json, current, target) {
|
|
17
17
|
const critical = [], warnings = [];
|
|
18
18
|
for (const [ver, entry] of Object.entries(json || {})) {
|
|
@@ -25,8 +25,8 @@ export function collectBreaking(json, current, target) {
|
|
|
25
25
|
return { critical, warnings };
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
//
|
|
29
|
-
//
|
|
28
|
+
// Entry text > screen language: ko uses title_ko/message_ko; missing or other languages use the English original (title/message)
|
|
29
|
+
// English keys are the source of truth — old CLIs read only title/message from this file on main (#988)
|
|
30
30
|
export function localizeBreakingEntry(entry, lang) {
|
|
31
31
|
const pickField = (field) => {
|
|
32
32
|
const koreanText = lang === "ko" ? entry?.[`${field}_ko`] : null;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
// CI
|
|
2
|
-
//
|
|
3
|
-
//
|
|
4
|
-
//
|
|
1
|
+
// CI minutes saver substitution (#1114) — only with version.yml options.ci_minutes_saver: true.
|
|
2
|
+
// Private repos pay for Actions minutes. Cuts CI that runs twice on the same commit, CI on doc-only changes, and macOS runners (10x per minute).
|
|
3
|
+
// Not called when off (install output byte-identical). If a pattern is not found (user-edited file), only that transform is skipped.
|
|
4
|
+
// Runs before branch substitution — patterns match the raw template (develop).
|
|
5
5
|
|
|
6
|
-
//
|
|
6
|
+
// Skip CI for PRs that change only docs (paths that select code differ per repo, so the template cannot decide them)
|
|
7
7
|
const DOCS_ONLY_PATHS_IGNORE = ` paths-ignore: ["**/*.md", "docs/**", "LICENSE"] # ci_minutes_saver: docs-only changes skip CI\n`;
|
|
8
8
|
|
|
9
|
-
//
|
|
9
|
+
// push: event block under on: (child lines indented 4+). Removed only when the block holds just a branches filter
|
|
10
10
|
const PUSH_BLOCK_RE = /^ {2}push:[ \t]*\n((?: {4,}.*\n|[ \t]*\n)*)/m;
|
|
11
11
|
|
|
12
|
-
//
|
|
12
|
+
// CI running twice for the same change via PR and push > drop push (PR only)
|
|
13
13
|
function dropPushTrigger(s) {
|
|
14
14
|
const pushBlock = s.match(PUSH_BLOCK_RE);
|
|
15
15
|
if (!pushBlock) return s;
|
|
@@ -18,27 +18,27 @@ function dropPushTrigger(s) {
|
|
|
18
18
|
return isBranchFilterOnly ? s.replace(PUSH_BLOCK_RE, "") : s;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
//
|
|
21
|
+
// Add doc path exclusions right under the events (pull_request · push)
|
|
22
22
|
function addDocsPathsIgnore(s, event) {
|
|
23
23
|
const re = new RegExp(`^( {2}${event}:[ \\t]*\\n)`, "m");
|
|
24
24
|
if (!re.test(s) || s.includes("ci_minutes_saver: docs-only")) return s;
|
|
25
25
|
return s.replace(re, `$1${DOCS_ONLY_PATHS_IGNORE}`);
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
// iOS(macOS
|
|
28
|
+
// Turn off automatic iOS (macOS runner) builds — enabled only via the manual input enable_ios
|
|
29
29
|
function disableIosByDefault(s) {
|
|
30
|
-
//
|
|
30
|
+
// Eat one trailing space for each added character to keep the comment column aligned
|
|
31
31
|
return s.replace(/^( {2}ENABLE_IOS: )"true" ?/m, `$1"false"`);
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
//
|
|
34
|
+
// File name (exact match) > transforms to apply. Store deploys and comment-triggered builds are not included
|
|
35
35
|
export const CI_MINUTES_SAVER_RULES = new Map([
|
|
36
36
|
["PROJECT-FLUTTER-CI.yaml", [dropPushTrigger, (s) => addDocsPathsIgnore(s, "pull_request"), disableIosByDefault]],
|
|
37
37
|
["PROJECT-PYTHON-CI.yaml", [dropPushTrigger, (s) => addDocsPathsIgnore(s, "pull_request")]],
|
|
38
38
|
["PROJECT-SPRING-NEXUS-CI.yml", [dropPushTrigger, (s) => addDocsPathsIgnore(s, "pull_request")]],
|
|
39
|
-
// PR
|
|
39
|
+
// No PR trigger, so keep push and filter only doc changes
|
|
40
40
|
["PROJECT-REACT-CI.yaml", [(s) => addDocsPathsIgnore(s, "push")]],
|
|
41
|
-
//
|
|
41
|
+
// Jobs unrelated to pushes > manual runs only
|
|
42
42
|
["PROJECT-COMMON-SECRET-FILE-UPLOAD.yaml", [dropPushTrigger]],
|
|
43
43
|
]);
|
|
44
44
|
|
package/src/core/constants.js
CHANGED
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
//
|
|
1
|
+
// Source of truth for value lists that several files must share.
|
|
2
2
|
//
|
|
3
|
-
//
|
|
4
|
-
//
|
|
5
|
-
//
|
|
6
|
-
//
|
|
7
|
-
// (deploy: project-types/common/deploy
|
|
3
|
+
// Why one place: the deploy/publish lists were written separately in five places: CLI arg checks (args.js), wizard questions (options-ask.js),
|
|
4
|
+
// the copy engine (copy/workflows.js), the version.yml parser (version-yml.js) and the option table (options-schema.js).
|
|
5
|
+
// Fixing only one causes silent mismatches like "the CLI accepts it but the parser drops it".
|
|
6
|
+
// To add a value, change one line here and create the workflow folder for that value
|
|
7
|
+
// (deploy: project-types/common/deploy/<value>/ · publish: project-types/<type>/publish/<value>/).
|
|
8
8
|
//
|
|
9
|
-
//
|
|
10
|
-
//
|
|
9
|
+
// This file imports nothing — so it never causes a circular import wherever it is loaded.
|
|
10
|
+
// The repo text language list is owned by REPO_LANGUAGES in repo-language.js (checked together with the translation files).
|
|
11
11
|
|
|
12
|
-
/**
|
|
12
|
+
/** Where the build output is deployed — pick one (#439) */
|
|
13
13
|
export const DEPLOY_TARGETS = Object.freeze(["docker-ssh", "vercel", "none"]);
|
|
14
14
|
|
|
15
|
-
/**
|
|
15
|
+
/** Which registries a library is published to — 0..n (#439) */
|
|
16
16
|
export const PUBLISH_TARGETS = Object.freeze(["nexus", "npm", "github-packages"]);
|
|
17
17
|
|
|
18
|
-
/**
|
|
18
|
+
/** Project nature — drives the deploy/publish questions (#485) */
|
|
19
19
|
export const INTENT_VALUES = Object.freeze(["app", "library", "both", "none", "manual"]);
|
|
20
20
|
|
|
21
|
-
/**
|
|
21
|
+
/** Status label style — en: `status: todo`, ko: legacy Korean `작업전` (#776) */
|
|
22
22
|
export const LABEL_STYLES = Object.freeze(["en", "ko"]);
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
25
|
+
* Default for installing the CodeRabbit code review config when nothing is saved (#832).
|
|
26
|
+
* Off — CodeRabbit needs a separate GitHub app, so turning it on without that leaves a config file and no reviewer.
|
|
27
|
+
* Interactive (version/issues modes that do not ask) and non-interactive each had their own default and split into `true`/`false`; now in one place.
|
|
28
28
|
*/
|
|
29
29
|
export const DEFAULT_CODE_REVIEW_CODERABBIT = false;
|
|
30
30
|
|
|
31
31
|
/**
|
|
32
|
-
*
|
|
33
|
-
*
|
|
32
|
+
* Release note generator (#455, #566). Default is commit — no external dependency, so it produces a result anywhere.
|
|
33
|
+
* The implementations live in .github/scripts/changelog_providers/; a test checks this list matches them.
|
|
34
34
|
*/
|
|
35
35
|
export const CHANGELOG_PROVIDERS = Object.freeze(["copilot", "coderabbit", "openai", "gemini", "claude", "groq", "mistral", "ollama", "commit"]);
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
// .coderabbit.yaml
|
|
2
|
-
// SP2-B
|
|
1
|
+
// Copy .coderabbit.yaml (force path).
|
|
2
|
+
// SP2-B implements only the force/non-interactive path. The interactive overwrite/skip menu is SP2-C.
|
|
3
3
|
import { join } from "node:path";
|
|
4
4
|
import { exists, copyFileSync } from "../fsutil.js";
|
|
5
5
|
|
|
6
|
-
//
|
|
7
|
-
// opts: { force, tty, enabled } — SP2-B
|
|
8
|
-
// enabled=false
|
|
9
|
-
// enabled
|
|
6
|
+
// Returns 'skip-disabled' | 'skip-no-src' | 'copied-new' | 'overwritten-backup' | 'skip-non-tty'
|
|
7
|
+
// opts: { force, tty, enabled } — SP2-B verification uses the force:true path.
|
|
8
|
+
// enabled=false (#457, CodeRabbit not used) does not copy the file at all.
|
|
9
|
+
// enabled unset (undefined) keeps the old behavior (copy) — backward compat for old callers.
|
|
10
10
|
export function copyCoderabbit(tempDir, { force = false, tty = false, enabled } = {}, targetRoot = ".") {
|
|
11
11
|
if (enabled === false) return "skip-disabled";
|
|
12
12
|
const src = join(tempDir, ".coderabbit.yaml");
|
|
@@ -15,14 +15,14 @@ export function copyCoderabbit(tempDir, { force = false, tty = false, enabled }
|
|
|
15
15
|
|
|
16
16
|
if (exists(dst)) {
|
|
17
17
|
if (force) {
|
|
18
|
-
copyFileSync(dst, dst + ".bak"); //
|
|
18
|
+
copyFileSync(dst, dst + ".bak"); // Back up, then overwrite
|
|
19
19
|
copyFileSync(src, dst);
|
|
20
20
|
return "overwritten-backup";
|
|
21
21
|
}
|
|
22
|
-
if (!tty) return "skip-non-tty"; //
|
|
23
|
-
//
|
|
22
|
+
if (!tty) return "skip-non-tty"; // Non-TTY & !force → keep
|
|
23
|
+
// The interactive menu is SP2-C — here, keep unless force
|
|
24
24
|
return "skip-non-tty";
|
|
25
25
|
}
|
|
26
|
-
copyFileSync(src, dst); //
|
|
26
|
+
copyFileSync(src, dst); // New file
|
|
27
27
|
return "copied-new";
|
|
28
28
|
}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
// .gitignore
|
|
1
|
+
// Ensure .gitignore (normalize entries > check missing > add).
|
|
2
2
|
import { join } from "node:path";
|
|
3
3
|
import { existsSync, readFileSync, writeFileSync } from "node:fs";
|
|
4
4
|
|
|
5
5
|
const REQUIRED_ENTRIES = ["/.idea", "/.claude/settings.local.json"];
|
|
6
6
|
|
|
7
|
-
//
|
|
7
|
+
// Normalize an entry: strip comment, trim, drop leading /, leading ./ and trailing /. Original if empty.
|
|
8
8
|
export function normalizeGitignoreEntry(entry) {
|
|
9
9
|
let e = String(entry);
|
|
10
|
-
e = e.replace(/#.*$/, ""); //
|
|
11
|
-
e = e.trim(); //
|
|
12
|
-
e = e.replace(/^\//, ""); //
|
|
13
|
-
e = e.replace(/^\.\//, ""); //
|
|
14
|
-
e = e.replace(/\/$/, ""); //
|
|
10
|
+
e = e.replace(/#.*$/, ""); // Strip comment
|
|
11
|
+
e = e.trim(); // Trim whitespace
|
|
12
|
+
e = e.replace(/^\//, ""); // Leading /
|
|
13
|
+
e = e.replace(/^\.\//, ""); // Leading ./
|
|
14
|
+
e = e.replace(/\/$/, ""); // Trailing /
|
|
15
15
|
return e === "" ? String(entry) : e;
|
|
16
16
|
}
|
|
17
17
|
|
|
@@ -32,7 +32,7 @@ const NEW_FILE_CONTENT =
|
|
|
32
32
|
"# Claude AI Settings\n" +
|
|
33
33
|
"/.claude/settings.local.json\n";
|
|
34
34
|
|
|
35
|
-
//
|
|
35
|
+
// Returns {created, added:[...]}
|
|
36
36
|
export function ensureGitignore(targetRoot = ".") {
|
|
37
37
|
const p = join(targetRoot, ".gitignore");
|
|
38
38
|
if (!existsSync(p)) {
|
|
@@ -43,7 +43,7 @@ export function ensureGitignore(targetRoot = ".") {
|
|
|
43
43
|
const toAdd = REQUIRED_ENTRIES.filter((e) => !entryExists(e, content));
|
|
44
44
|
if (toAdd.length === 0) return { created: false, added: [] };
|
|
45
45
|
|
|
46
|
-
//
|
|
46
|
+
// Add a newline if the file does not end with one
|
|
47
47
|
if (content.length > 0 && !content.endsWith("\n")) content += "\n";
|
|
48
48
|
content += "\n";
|
|
49
49
|
content += "# ====================================================================\n";
|
package/src/core/copy/readme.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
// README
|
|
1
|
+
// Add the README version section.
|
|
2
2
|
import { join } from "node:path";
|
|
3
3
|
import { existsSync, readFileSync, appendFileSync } from "node:fs";
|
|
4
4
|
|
|
5
5
|
const MARKER = "<!-- AUTO-VERSION-SECTION";
|
|
6
|
-
// ## (최신 버전|최신버전|Latest version|Version|버전) : vX.Y.Z (
|
|
6
|
+
// ## (최신 버전|최신버전|Latest version|Version|버전) : vX.Y.Z (case-insensitive)
|
|
7
7
|
const VERSION_LINE_RE = /##\s*(최신\s*버전|최신버전|Latest\s+version|Version|버전)\s*:\s*v[0-9]+\.[0-9]+\.[0-9]+/i;
|
|
8
8
|
|
|
9
|
-
//
|
|
9
|
+
// Section text per repo language (same values as readme.version_heading in .github/scripts/i18n)
|
|
10
10
|
const SECTION_TEXT = {
|
|
11
11
|
en: { heading: "Latest version", changelogLink: "View the full version history" },
|
|
12
12
|
ko: { heading: "최신 버전", changelogLink: "전체 버전 기록 보기" },
|
|
13
13
|
};
|
|
14
14
|
|
|
15
|
-
// README.md
|
|
16
|
-
//
|
|
17
|
-
// language
|
|
15
|
+
// Skip if README.md is missing. Skip if the marker or a version line exists. Otherwise append at the end of the file.
|
|
16
|
+
// Returns 'skip-no-readme' | 'skip-marker' | 'skip-version-line' | 'added'
|
|
17
|
+
// language defaults to ko — keeps results unchanged for existing callers that pass no language
|
|
18
18
|
export function addVersionSectionToReadme(version, targetRoot = ".", language = "ko") {
|
|
19
19
|
const p = join(targetRoot, "README.md");
|
|
20
20
|
if (!existsSync(p)) return "skip-no-readme";
|
|
@@ -23,7 +23,7 @@ export function addVersionSectionToReadme(version, targetRoot = ".", language =
|
|
|
23
23
|
if (VERSION_LINE_RE.test(content)) return "skip-version-line";
|
|
24
24
|
|
|
25
25
|
const text = SECTION_TEXT[language] ?? SECTION_TEXT.ko;
|
|
26
|
-
//
|
|
26
|
+
// The appended body starts with a blank line + "---" (assumes the original file ends with a newline).
|
|
27
27
|
const section =
|
|
28
28
|
"\n" +
|
|
29
29
|
"---\n" +
|
package/src/core/copy/simple.js
CHANGED
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
//
|
|
1
|
+
// Simple copy functions (always-overwrite kind): scripts, config, issue, discussion, setup guide.
|
|
2
2
|
import { join, basename } from "node:path";
|
|
3
3
|
import { chmodSync, readdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
4
4
|
import { PATHS } from "../paths.js";
|
|
5
5
|
import { exists, copyFileSync, copyDirSync } from "../fsutil.js";
|
|
6
6
|
|
|
7
|
-
//
|
|
8
|
-
// version_manager
|
|
9
|
-
// changelog provider
|
|
10
|
-
//
|
|
11
|
-
// issue_helper.py
|
|
7
|
+
// Always overwrite only the version management/release note scripts + chmod +x.
|
|
8
|
+
// version_manager is a .sh (delegating shim) + .py (real logic) pair — both must be copied to work (#448).
|
|
9
|
+
// The changelog provider ladder (5 .py files, #455) is called by the RELEASE-CHANGELOG workflow fallback-summary,
|
|
10
|
+
// so it must be copied too for release note generation to work in user projects.
|
|
11
|
+
// issue_helper.py is called by the SUH-ISSUE-HELPER workflow — must be copied with it (#478).
|
|
12
12
|
export function copyScripts(tempDir, targetRoot = ".") {
|
|
13
13
|
const scripts = [
|
|
14
14
|
"version_manager.sh", "version_manager.py",
|
|
15
15
|
"changelog_manager.py",
|
|
16
16
|
"truncate_release_notes.sh", "truncate_release_notes.py",
|
|
17
17
|
"issue_helper.py",
|
|
18
|
-
// GitHub REST
|
|
19
|
-
// close_issues_on_release
|
|
18
|
+
// Shared GitHub REST calls (#914). issue_helper, changelog_notice, pr_summary_comment, dispatch_downstream,
|
|
19
|
+
// close_issues_on_release and store_deploy_config import it, so without it all those workflows break.
|
|
20
20
|
"github_api.py",
|
|
21
|
-
//
|
|
21
|
+
// Called when the release workflow merges without a PAT and then wakes follow-up workflows (#551).
|
|
22
22
|
"dispatch_downstream.py",
|
|
23
|
-
// AI PR SUMMARY
|
|
23
|
+
// Called when the AI PR SUMMARY workflow writes or updates the summary comment (#553).
|
|
24
24
|
"pr_summary_comment.py",
|
|
25
|
-
//
|
|
25
|
+
// Called when the QA issue bot builds its post text (#787). Language is options.language in version.yml.
|
|
26
26
|
"qa_bot_messages.py",
|
|
27
|
-
//
|
|
27
|
+
// Reports how the release notes were made and suggests alternatives when AI was unavailable (#566).
|
|
28
28
|
"changelog_notice.py",
|
|
29
|
-
// Flutter
|
|
30
|
-
//
|
|
29
|
+
// Called when the Flutter build workflow settles .env and dart-define in one place (#603).
|
|
30
|
+
// Does nothing in repos without the config (.github/config/build-profile.json).
|
|
31
31
|
"apply_build_profile.py",
|
|
32
|
-
// iOS/Android
|
|
32
|
+
// Build number rules for iOS/Android test builds and iOS releases (#643). The only home of the numbering rules.
|
|
33
33
|
"build_number.py",
|
|
34
|
-
// App Store Connect
|
|
34
|
+
// App Store Connect lookups (#643). Used by ios_release.py, so it must be copied with it.
|
|
35
35
|
"asc_client.py",
|
|
36
|
-
// iOS
|
|
36
|
+
// iOS version pre-check, upload rejection classification, retries from archive to upload (#643).
|
|
37
37
|
"ios_release.py",
|
|
38
|
-
// Flutter iOS
|
|
38
|
+
// Xcode selection for Flutter iOS builds (empty = latest on the runner) and missing SDK diagnosis (#758). The only home of the selection rules.
|
|
39
39
|
"select_xcode.py",
|
|
40
|
-
//
|
|
40
|
+
// Closes issues labelled done when a release is merged (#771). Works only in repos with the close_on_release option on.
|
|
41
41
|
"close_issues_on_release.py",
|
|
42
|
-
// Play Store/TestFlight
|
|
42
|
+
// Reads the Play Store/TestFlight deploy mode from the code config (.github/config/store-deploy.json) (#767).
|
|
43
43
|
"store_deploy_config.py",
|
|
44
|
-
//
|
|
44
|
+
// Prepares store release notes per language (#829). Does nothing without store_locales in version.yml.
|
|
45
45
|
"store_notes.py",
|
|
46
46
|
"changelog_providers/_common.py", "changelog_providers/ladder.py",
|
|
47
47
|
"changelog_providers/commit.py", "changelog_providers/copilot.py",
|
|
@@ -53,16 +53,16 @@ export function copyScripts(tempDir, targetRoot = ".") {
|
|
|
53
53
|
if (exists(src)) {
|
|
54
54
|
const dst = join(targetRoot, PATHS.scriptsDir, s);
|
|
55
55
|
copyFileSync(src, dst);
|
|
56
|
-
try { chmodSync(dst, 0o755); } catch { /*
|
|
56
|
+
try { chmodSync(dst, 0o755); } catch { /* chmod is meaningless on Windows etc. */ }
|
|
57
57
|
copied++;
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
|
-
//
|
|
61
|
-
//
|
|
60
|
+
// Message catalog (#787): scripts read it at runtime. Copying the whole folder instead of a list
|
|
61
|
+
// lets a translator add a single json file without changing anything else.
|
|
62
62
|
const i18nSrc = join(tempDir, PATHS.scriptsDir, "i18n");
|
|
63
63
|
if (exists(i18nSrc)) {
|
|
64
64
|
for (const f of readdirSync(i18nSrc)) {
|
|
65
|
-
if (!/\.(py|json|cjs)$/.test(f)) continue; // __pycache__
|
|
65
|
+
if (!/\.(py|json|cjs)$/.test(f)) continue; // Skip __pycache__ etc. (cjs: workflow comment runtime)
|
|
66
66
|
copyFileSync(join(i18nSrc, f), join(targetRoot, PATHS.scriptsDir, "i18n", f));
|
|
67
67
|
copied++;
|
|
68
68
|
}
|
|
@@ -70,7 +70,7 @@ export function copyScripts(tempDir, targetRoot = ".") {
|
|
|
70
70
|
return copied;
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
// .github/config
|
|
73
|
+
// Overwrite the whole .github/config folder. Skip if missing.
|
|
74
74
|
export function copyConfigFolder(tempDir, targetRoot = ".") {
|
|
75
75
|
const src = join(tempDir, ".github", "config");
|
|
76
76
|
if (!exists(src)) return false;
|
|
@@ -78,11 +78,11 @@ export function copyConfigFolder(tempDir, targetRoot = ".") {
|
|
|
78
78
|
return true;
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
//
|
|
82
|
-
//
|
|
83
|
-
//
|
|
84
|
-
//
|
|
85
|
-
//
|
|
81
|
+
// Remove the assignees line from issue templates copied into the user repo (#782).
|
|
82
|
+
// The source names this repo's owner, who must not become the assignee of new issues in someone else's repo.
|
|
83
|
+
// Assignees are set by the issue helper and QA bot from version.yml settings.
|
|
84
|
+
// Only lines in the front matter (between the first and second ---) — the same text in the body is left alone.
|
|
85
|
+
// Returns repo-root relative paths of changed files. Must be called after the overlay is applied (the overlay puts it back).
|
|
86
86
|
export function stripIssueTemplateAssignees(targetRoot = ".") {
|
|
87
87
|
const dir = join(targetRoot, ".github", "ISSUE_TEMPLATE");
|
|
88
88
|
if (!exists(dir)) return [];
|
|
@@ -100,16 +100,16 @@ export function stripIssueTemplateAssignees(targetRoot = ".") {
|
|
|
100
100
|
return changed;
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
-
// .github/ISSUE_TEMPLATE/
|
|
103
|
+
// Overwrite all of .github/ISSUE_TEMPLATE/ + PULL_REQUEST_TEMPLATE.md.
|
|
104
104
|
export function copyIssueTemplates(tempDir, targetRoot = ".") {
|
|
105
105
|
const srcIssue = join(tempDir, ".github", "ISSUE_TEMPLATE");
|
|
106
|
-
// `projectops-`
|
|
106
|
+
// Files starting with `projectops-` are this repo's (projectops itself) issue forms and are not copied to user repos (#797).
|
|
107
107
|
if (exists(srcIssue)) copyDirSync(srcIssue, join(targetRoot, ".github", "ISSUE_TEMPLATE"), { filter: (src) => !basename(src).startsWith("projectops-") });
|
|
108
108
|
const srcPr = join(tempDir, ".github", "PULL_REQUEST_TEMPLATE.md");
|
|
109
109
|
if (exists(srcPr)) copyFileSync(srcPr, join(targetRoot, ".github", "PULL_REQUEST_TEMPLATE.md"));
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
-
// .github/DISCUSSION_TEMPLATE
|
|
112
|
+
// All of .github/DISCUSSION_TEMPLATE/. Skip if missing.
|
|
113
113
|
export function copyDiscussionTemplates(tempDir, targetRoot = ".") {
|
|
114
114
|
const src = join(tempDir, ".github", "DISCUSSION_TEMPLATE");
|
|
115
115
|
if (!exists(src)) return false;
|
|
@@ -117,7 +117,7 @@ export function copyDiscussionTemplates(tempDir, targetRoot = ".") {
|
|
|
117
117
|
return true;
|
|
118
118
|
}
|
|
119
119
|
|
|
120
|
-
// PROJECTOPS-SETUP-GUIDE.md
|
|
120
|
+
// Overwrite PROJECTOPS-SETUP-GUIDE.md at the root. Skip if missing.
|
|
121
121
|
export const SETUP_GUIDE_NAME = "PROJECTOPS-SETUP-GUIDE.md";
|
|
122
122
|
export function copySetupGuide(tempDir, targetRoot = ".") {
|
|
123
123
|
const src = join(tempDir, SETUP_GUIDE_NAME);
|
package/src/core/copy/util.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
// util
|
|
2
|
-
// tempDir/.github/util/<type>/
|
|
1
|
+
// Copy util modules (force path).
|
|
2
|
+
// If tempDir/.github/util/<type>/ exists, (force) copy all of it to .github/util/<type>/ and count modules.
|
|
3
3
|
import { join } from "node:path";
|
|
4
4
|
import { readdirSync } from "node:fs";
|
|
5
5
|
import { exists, copyDirSync } from "../fsutil.js";
|
|
6
6
|
|
|
7
|
-
//
|
|
8
|
-
// ⚠️ overlay
|
|
9
|
-
//
|
|
7
|
+
// Returns {copied:bool, moduleCount:number}. Skipped when not force (non-TTY).
|
|
8
|
+
// ⚠️ This is an overlay copy — old files deleted/renamed in the template are not removed here.
|
|
9
|
+
// Cleaning up old util files is the job of the migrations registry (util-file category) (#500).
|
|
10
10
|
export function copyUtilModules(tempDir, type, { force = false } = {}, targetRoot = ".") {
|
|
11
11
|
const src = join(tempDir, ".github", "util", type);
|
|
12
12
|
if (!exists(src)) return { copied: false, moduleCount: 0 };
|
|
13
|
-
if (!force) return { copied: false, moduleCount: 0 }; // SP2-B: force
|
|
13
|
+
if (!force) return { copied: false, moduleCount: 0 }; // SP2-B: force path only
|
|
14
14
|
|
|
15
15
|
const dst = join(targetRoot, ".github", "util", type);
|
|
16
16
|
copyDirSync(src, dst);
|
|
17
17
|
|
|
18
|
-
//
|
|
19
|
-
// `_`
|
|
20
|
-
// (
|
|
18
|
+
// Number of subdirectories = number of modules
|
|
19
|
+
// Folders starting with `_` are not modules but assets shared by modules
|
|
20
|
+
// (e.g. flutter/_shared — CSS/JS shared by the 3 wizards). Excluded from the count.
|
|
21
21
|
let moduleCount = 0;
|
|
22
22
|
for (const e of readdirSync(dst, { withFileTypes: true })) {
|
|
23
23
|
if (e.isDirectory() && !e.name.startsWith("_")) moduleCount++;
|