projectops 4.110.0 → 4.110.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 CHANGED
@@ -150,7 +150,7 @@ If you only need one piece of this, a smaller tool may suit you better ([full co
150
150
  - **Frequent releases.** `latest` follows `main`; `npx projectops@<version>` pins the installer only, not the workflow templates.
151
151
  - **Server deploys assume a Docker host reachable over SSH.** A personal access token is optional ([setup](https://cassiiopeia.github.io/projectops/getting-started)).
152
152
 
153
- Supported types: `spring`, `flutter`, `react` (incl. Next.js), `node`, `python`, `react-native`, `react-native-expo`, `basic`. Comment commands such as `@projectops server build` and `@projectops build app`: [PR Preview](https://cassiiopeia.github.io/projectops/pr-preview), [Flutter builds](https://cassiiopeia.github.io/projectops/flutter-test-build-trigger), [Issue automation](https://cassiiopeia.github.io/projectops/issue-automation).
153
+ Supported types: <!-- generated: project-types:types-list -->`flutter`, `spring`, `python`, `react`, `react-native`, `react-native-expo`, `node`, `basic`<!-- /generated --> (`react` includes Next.js). Comment commands such as `@projectops server build` and `@projectops build app`: [PR Preview](https://cassiiopeia.github.io/projectops/pr-preview), [Flutter builds](https://cassiiopeia.github.io/projectops/flutter-test-build-trigger), [Issue automation](https://cassiiopeia.github.io/projectops/issue-automation).
154
154
 
155
155
  ## Community
156
156
 
@@ -163,7 +163,7 @@ Supported types: `spring`, `flutter`, `react` (incl. Next.js), `node`, `python`,
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.110.0 (2026-11-21)
166
+ ## Latest version : v4.110.1 (2026-11-21)
167
167
 
168
168
  [View full version history](CHANGELOG.md)
169
169
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "projectops",
3
- "version": "4.110.0",
3
+ "version": "4.110.1",
4
4
  "description": "One npx install for GitHub release automation: semantic versioning, changelogs, release PRs, CI/CD workflows and AI agent skills",
5
5
  "keywords": [
6
6
  "github-actions",
package/src/cli/help.js CHANGED
@@ -5,6 +5,23 @@
5
5
  // Value lists and per-flag details live in src/core/options-schema.js (source of truth); `--mode options --json` prints them as is.
6
6
  // Every flag in args.js must appear in both the English and Korean help texts — add new flags to both.
7
7
  import { getLang } from "../i18n/index.js";
8
+ import { VALID_TYPES } from "../core/project-types.js";
9
+
10
+ // Help column where option descriptions start
11
+ const HELP_DESCRIPTION_INDENT = " ".repeat(27);
12
+ // Type ids per help line (keeps lines under 80 columns)
13
+ const TYPES_PER_HELP_LINE = 4;
14
+
15
+ // "supported:" list from the registry, wrapped and aligned under the first id
16
+ function typeListLines(prefix) {
17
+ const lines = [];
18
+ for (let index = 0; index < VALID_TYPES.length; index += TYPES_PER_HELP_LINE) {
19
+ // Hangul and other wide characters take two terminal columns
20
+ const lead = index === 0 ? prefix : " ".repeat(prefix.length + (prefix.match(/[^\x00-\x7f]/g) || []).length);
21
+ lines.push(HELP_DESCRIPTION_INDENT + lead + VALID_TYPES.slice(index, index + TYPES_PER_HELP_LINE).join(" "));
22
+ }
23
+ return lines.join("\n");
24
+ }
8
25
 
9
26
  const HELP_EN = `projectops — installs and updates GitHub automation (versioning, release notes, CI/CD, issue templates, agent skills)
10
27
 
@@ -34,8 +51,7 @@ Modes (-m, --mode MODE)
34
51
 
35
52
  Options
36
53
  -t, --type CSV project types, comma separated, first = primary (e.g. spring,react,python)
37
- supported: spring flutter react react-native
38
- react-native-expo node python basic
54
+ ${typeListLines("supported: ")}
39
55
  omitted: auto-detected from files in the repo root (nothing found = basic)
40
56
  (next was merged into react: use react for Next.js)
41
57
  --project-version V initial version, only when version.yml does not exist yet (an existing value is always kept)
@@ -120,8 +136,7 @@ AI agent 나 CI 는 항상 이렇게 실행한다: npx projectops --mode <
120
136
 
121
137
  옵션
122
138
  -t, --type CSV 프로젝트 타입 csv, 첫 항목이 primary (예: spring,react,python)
123
- 지원: spring flutter react react-native
124
- react-native-expo node python basic
139
+ ${typeListLines("지원: ")}
125
140
  생략: 레포 루트의 파일로 자동 감지 (못 찾으면 basic)
126
141
  (next는 react로 흡수됨 — Next.js 프로젝트는 react 사용)
127
142
  --project-version V 초기 버전. version.yml 이 아직 없을 때만 쓰인다 (기존 값은 항상 유지)
package/src/context.js CHANGED
@@ -1,9 +1,7 @@
1
1
  // Wizard global state made explicit as one object (replaces the bash global variables)
2
2
  // The next type was merged into react in v4.1.0 (breaking)
3
- export const VALID_TYPES = [
4
- "spring", "flutter", "react",
5
- "react-native", "react-native-expo", "node", "python", "basic",
6
- ];
3
+ // Project types come from the registry (src/core/project-types.json, #1244)
4
+ export { VALID_TYPES } from "./core/project-types.js";
7
5
 
8
6
  export const DEFAULT_VERSION = "1.3.14"; // When the template version is unknown (banner fallback — not used for breaking comparison)
9
7
 
@@ -13,6 +13,7 @@
13
13
  // 7) CI minutes saver (#1114): with ciMinutesSaver, ci-minutes-sub.js (before branch substitution, on the raw template)
14
14
 
15
15
  import { substituteCiMinutesSaver } from "./ci-minutes-sub.js";
16
+ import { deployTriggerWorkflows } from "./project-types.js";
16
17
 
17
18
  // main (default branch) substitutions
18
19
  function subDefault(s, db) {
@@ -33,15 +34,10 @@ function subDeploy(s, dev) {
33
34
 
34
35
  // Workflows that deploy when pushed (exact file name match). Used only in repos that split the default and deploy branches.
35
36
  // Common workflows (version bump · README version · release notes · issue close) are not here: they follow the default branch.
36
- // Add new deploy workflows to this table too (otherwise that file deploys from the default branch)
37
- export const DEPLOY_TRIGGER_WORKFLOWS = new Set([
38
- "PROJECT-FLUTTER-ANDROID-FIREBASE-CICD.yaml", "PROJECT-FLUTTER-ANDROID-PLAYSTORE-CICD.yaml",
39
- "PROJECT-FLUTTER-ANDROID-SELFHOSTED-CICD.yaml", "PROJECT-FLUTTER-IOS-TESTFLIGHT.yaml",
40
- "PROJECT-REACT-NATIVE-EXPO-ANDROID-PLAYSTORE-CICD.yaml", "PROJECT-REACT-NATIVE-EXPO-IOS-TESTFLIGHT.yaml",
41
- "PROJECT-SPRING-SIMPLE-CICD.yaml", "PROJECT-PYTHON-SIMPLE-CICD.yaml", "PROJECT-REACT-CICD.yaml",
42
- "PROJECT-COMMON-VERCEL-DEPLOY.yaml", "PROJECT-NODE-NPM-PUBLISH.yaml",
43
- "PROJECT-SPRING-NEXUS-PUBLISH.yml", "PROJECT-SPRING-GITHUB-PACKAGES-PUBLISH.yml",
44
- ]);
37
+ // Type-owned files come from the registry (deploy_trigger_workflows); a missing file deploys from the default branch.
38
+ // Vercel is the only type-independent one
39
+ const TYPE_INDEPENDENT_DEPLOY_WORKFLOWS = ["PROJECT-COMMON-VERCEL-DEPLOY.yaml"];
40
+ export const DEPLOY_TRIGGER_WORKFLOWS = new Set([...deployTriggerWorkflows(), ...TYPE_INDEPENDENT_DEPLOY_WORKFLOWS]);
45
41
 
46
42
  // Deploy trigger branch substitution: main in triggers · checkout ref · pull · run conditions
47
43
  function subDeployTrigger(s, trigger) {
@@ -6,6 +6,7 @@ import { execFileSync } from "node:child_process";
6
6
  import { detectTypesFromMarkers, detectVersionFromFiles, suggestTypesByExtScan } from "./detect.js";
7
7
  import { parseExisting, convertLegacySingularType } from "./version-yml.js";
8
8
  import { VALID_TYPES } from "../context.js";
9
+ import { PROJECT_TYPES } from "./project-types.js";
9
10
 
10
11
  const hasFile = (root) => (rel) => existsSync(join(root, rel));
11
12
  const readFile = (root) => (rel) => {
@@ -48,8 +49,8 @@ export function listScanFiles(root, maxDepth = 3) {
48
49
 
49
50
  // Monorepo marker scan: folders up to 2 levels down, a folder with markers is a project (not descended into) (#1243)
50
51
  const MONOREPO_MARKER_DEPTH = 2;
51
- // detectTypesFromMarkers push order
52
- const MARKER_TYPE_ORDER = ["flutter", "spring", "python", "react", "react-native", "react-native-expo", "node"];
52
+ // Registry order = root scan order (first = primary type)
53
+ const MARKER_TYPE_ORDER = VALID_TYPES;
53
54
  export function detectTypesInSubfolders(root, maxDepth = MONOREPO_MARKER_DEPTH) {
54
55
  const found = [];
55
56
  const walk = (rel, depth) => {
@@ -171,8 +172,8 @@ export function makeResolvers(root, repoName, paths) {
171
172
  return f ? f.split("/").slice(0, -1).join("/") : "";
172
173
  },
173
174
  "spring-app-yml-path": (t) => findSpringAppYml(root, springBase(t)) || "",
174
- "flutter-root": () => paths.get("flutter") || ".",
175
- // Expo app folder (#1240) — APP_ROOT of the react-native-expo workflows
176
- "expo-root": () => paths.get("react-native-expo") || ".",
175
+ // Type folder resolvers (APP_ROOT of app workflows): registry root_resolver names, e.g. flutter-root, expo-root
176
+ ...Object.fromEntries(PROJECT_TYPES.filter((type) => type.root_resolver)
177
+ .map((type) => [type.root_resolver, () => paths.get(type.id) || "."])),
177
178
  };
178
179
  }
@@ -1,35 +1,77 @@
1
- // Classify package.json content — substring matching on the raw file text.
2
- // Checks raw text rather than parsing dependencies (works even on broken JSON).
3
- // Input is the raw package.json string. Order matters.
4
- export function classifyPackageText(raw) {
5
- const s = String(raw || "");
6
- if (s.includes("@react-native") || s.includes("react-native")) {
7
- return s.includes("expo") ? "react-native-expo" : "react-native";
1
+ import { PROJECT_TYPES, typeById } from "./project-types.js";
2
+
3
+ // Types decided by package.json (registry entries with a package_json rule or fallback_only)
4
+ const PACKAGE_TYPES = PROJECT_TYPES.filter((type) => type.detect.package_json || type.detect.fallback_only);
5
+
6
+ // Dependency keys of a parsed package.json (dependencies + devDependencies; peer and optional are ignored)
7
+ function dependencyNames(packageJson) {
8
+ return Object.keys({ ...(packageJson?.dependencies || {}), ...(packageJson?.devDependencies || {}) });
9
+ }
10
+
11
+ // One registry package_json rule against a dependency name list
12
+ function matchesPackageRule(rule, names) {
13
+ const hasName = (name) => names.includes(name);
14
+ const hasPrefix = (prefix) => names.some((name) => name.startsWith(prefix));
15
+ if ((rule.requires_all || []).some((name) => !hasName(name))) return false;
16
+ const anyNames = rule.requires_any || [];
17
+ const anyPrefixes = rule.requires_any_prefix || [];
18
+ if ((anyNames.length || anyPrefixes.length) && !anyNames.some(hasName) && !anyPrefixes.some(hasPrefix)) return false;
19
+ if ((rule.excludes_any || []).some(hasName)) return false;
20
+ if ((rule.excludes_any_prefix || []).some(hasPrefix)) return false;
21
+ return true;
22
+ }
23
+
24
+ // Broken JSON: substring rule on the raw text, so detection never fails on a half-written file
25
+ function classifyBrokenPackageText(raw) {
26
+ if (raw.includes("@react-native") || raw.includes("react-native")) {
27
+ return raw.includes("expo") ? "react-native-expo" : "react-native";
8
28
  }
9
- // The next type was merged into react in v4.1.0 — a "next" dependency still classifies as react
10
- if (s.includes('"react"') || s.includes('"next"')) return "react";
29
+ if (raw.includes('"react"') || raw.includes('"next"')) return "react";
11
30
  return "node";
12
31
  }
13
32
 
33
+ /**
34
+ * Raw package.json text > package type id (registry dependency rules; fallback_only type when none match)
35
+ */
36
+ export function classifyPackageText(raw) {
37
+ const text = String(raw || "");
38
+ let packageJson;
39
+ try {
40
+ packageJson = JSON.parse(text);
41
+ } catch {
42
+ return classifyBrokenPackageText(text);
43
+ }
44
+ const names = dependencyNames(packageJson);
45
+ const matched = PACKAGE_TYPES.find((type) => type.detect.package_json && matchesPackageRule(type.detect.package_json, names));
46
+ return (matched || PACKAGE_TYPES.find((type) => type.detect.fallback_only)).id;
47
+ }
48
+
14
49
  // Convenience: for a parsed object, re-serialize to text and apply the rules above
15
50
  export function classifyPackageJson(pkgOrRaw) {
16
51
  const raw = typeof pkgOrRaw === "string" ? pkgOrRaw : JSON.stringify(pkgOrRaw || {});
17
52
  return classifyPackageText(raw);
18
53
  }
19
54
 
20
- // Marker scan (behavior spec §3.1). Injects has(relpath)=>bool. node is not added when another type exists.
21
- // Receives raw package.json via read(relpath)=>string|null and passes it to classifyPackageText.
55
+ /**
56
+ * Marker scan of one folder > type ids in registry order (["basic"] when nothing matches)
57
+ * has(relpath)=>bool, read(relpath)=>raw text|null. A fallback_only type counts only when nothing else matched.
58
+ */
22
59
  export function detectTypesFromMarkers({ has, read }) {
23
60
  const types = [];
24
- if (has("pubspec.yaml")) types.push("flutter");
25
- if (has("build.gradle") || has("build.gradle.kts") || has("pom.xml")) types.push("spring");
26
- if (has("pyproject.toml") || has("setup.py") || has("requirements.txt")) types.push("python");
27
- if (has("package.json")) {
28
- const cls = classifyPackageText(read ? read("package.json") : "");
29
- if (cls === "node") { if (types.length === 0) types.push("node"); }
30
- else types.push(cls);
61
+ let packageTypeId = null;
62
+ for (const type of PROJECT_TYPES) {
63
+ if (!type.detect.markers.some((marker) => has(marker))) continue;
64
+ if (type.detect.package_json || type.detect.fallback_only) {
65
+ // All package types share package.json: classify once, at the position of the first package type
66
+ if (packageTypeId === null) packageTypeId = classifyPackageText(read ? read("package.json") : "");
67
+ if (packageTypeId === type.id) types.push(type.id);
68
+ continue;
69
+ }
70
+ types.push(type.id);
31
71
  }
32
- return types.length ? [...new Set(types)] : ["basic"];
72
+ const fallbackIds = new Set(PROJECT_TYPES.filter((type) => type.detect.fallback_only).map((type) => type.id));
73
+ const result = types.length > 1 ? types.filter((id) => !fallbackIds.has(id)) : types;
74
+ return result.length ? [...new Set(result)] : ["basic"];
33
75
  }
34
76
 
35
77
  const VERSION_RE = /^\d+\.\d+\.\d+$/;
@@ -53,26 +95,24 @@ export function detectVersionFromFiles({ read, readJson, hasJq, gitTag }) {
53
95
  return "0.0.1";
54
96
  }
55
97
 
98
+ // Main marker file of a type for path display and search (first path_search file; package.json when the type has none)
56
99
  export function markerForType(type) {
57
- return { flutter: "pubspec.yaml", "react-native-expo": "app.json", python: "pyproject.toml", spring: "build.gradle" }[type] || "package.json";
100
+ return typeById(type)?.path_search.files[0] ?? "package.json";
58
101
  }
59
102
 
103
+ // Secondary marker files of a type (spring build.gradle.kts/pom.xml, python setup.py/requirements.txt)
60
104
  export function extraMarkers(type) {
61
- return { python: ["setup.py", "requirements.txt"], spring: ["build.gradle.kts", "pom.xml"] }[type] || [];
105
+ return typeById(type)?.path_search.files.slice(1) ?? [];
62
106
  }
63
107
 
64
108
  // Extension frequency scan recommendation (step 2 when there are no markers, #458).
65
109
  // Secondary recommendation used only when there are no markers at all (= basic fallback). files = pruned relative paths.
66
- // Thresholds: dart≥1→flutter, java+kt+gradle≥3→spring, tsx+jsx≥3→react, py≥3→python,
67
- // none of those and ts+js≥3→node. Returned in menu definition order.
110
+ // Thresholds come from registry detect.extensions; a fallback_only type is suggested only when nothing else is.
68
111
  export function suggestTypesByExtScan(files) {
69
- const count = (re) => files.filter((f) => re.test(f)).length;
70
- const found = new Set();
71
- if (count(/\.dart$/) >= 1) found.add("flutter");
72
- if (count(/\.java$/) + count(/\.kt$/) + count(/\.gradle$/) >= 3) found.add("spring");
73
- if (count(/\.tsx$/) + count(/\.jsx$/) >= 3) found.add("react");
74
- if (count(/\.py$/) >= 3) found.add("python");
75
- if (found.size === 0 && count(/\.ts$/) + count(/\.js$/) >= 3) found.add("node");
76
- const order = ["spring", "flutter", "react", "react-native", "react-native-expo", "node", "python"];
77
- return order.filter((t) => found.has(t));
112
+ const countMatches = (patterns) => patterns.reduce(
113
+ (total, pattern) => total + files.filter((file) => new RegExp(pattern).test(file)).length, 0);
114
+ const meetsThreshold = (type) => type.detect.extensions && countMatches(type.detect.extensions.patterns) >= type.detect.extensions.min_count;
115
+ const found = PROJECT_TYPES.filter((type) => !type.detect.fallback_only && meetsThreshold(type)).map((type) => type.id);
116
+ if (found.length) return found;
117
+ return PROJECT_TYPES.filter((type) => type.detect.fallback_only && meetsThreshold(type)).map((type) => type.id);
78
118
  }
@@ -17,10 +17,10 @@ const OWNED_SKILL_NAME = /^(pro|suh)-/;
17
17
  const SHARED_SCRIPTS_MARKER = join("common", "__init__.py");
18
18
  export const SHARED_SCRIPTS_DIR_NAME = "scripts";
19
19
  const PYTHON_CACHE_DIR_NAME = "__pycache__";
20
- // 3 top-level shared Python entries used only by repo maintainers: guide doc, troubleshooting index generator, extras copy sync (#988)
20
+ // Top-level shared entries used only by repo maintainers: guide doc, troubleshooting index generator, extras copy sync (#988), project type generator (#1244)
21
21
  // Why an exclude list, not an allow list: missing a new runtime module kills skills on import,
22
22
  // while missing a new dev file only ships one extra file. test/ide-home-install-e2e.test.js catches runtime entries landing here
23
- export const SHARED_SCRIPTS_DEV_ONLY = new Set(["README.md", "build_troubleshooting.py", "sync_extras.py"]);
23
+ export const SHARED_SCRIPTS_DEV_ONLY = new Set(["README.md", "build_troubleshooting.py", "sync_extras.py", "build_project_types.mjs"]);
24
24
 
25
25
  // Skill source: downloaded template (TEMP)/skills first, else local skills/
26
26
  export function resolveSkillsSrc(ctx = {}) {
@@ -13,6 +13,7 @@ import { t as msg } from "../i18n/index.js";
13
13
  import { parseTemplateOptions, inferIntent } from "./version-yml.js";
14
14
  import { branchStatus, createBranch, pushBranch } from "./git-branch.js";
15
15
  import { DEPLOY_TARGETS, PUBLISH_TARGETS, CHANGELOG_PROVIDERS, DEFAULT_CODE_REVIEW_CODERABBIT } from "./constants.js";
16
+ import { PROJECT_TYPES } from "./project-types.js";
16
17
 
17
18
  // Check the development (release) branch exists + offer to create it (#477) — interactive only.
18
19
  // If missing locally and missing (or unknown) on the remote, offer to create it from the default branch, then ask whether to push.
@@ -71,29 +72,12 @@ export { DEPLOY_TARGETS, PUBLISH_TARGETS, CHANGELOG_PROVIDERS };
71
72
  // (Play Store/TestFlight/Firebase, etc.) workflows in the type itself, so the server deploy axis does not
72
73
  // apply and there is no registry publish either. If only types with both axes empty are selected, the questions are skipped.
73
74
  // Server types keep all current choices (behavior unchanged — per-type refinement is follow-up work).
74
- export const TYPE_DEPLOY_TARGETS = {
75
- spring: ["docker-ssh", "vercel"],
76
- react: ["docker-ssh", "vercel"],
77
- node: ["docker-ssh", "vercel"],
78
- python: ["docker-ssh", "vercel"],
79
- flutter: [],
80
- "react-native": [],
81
- "react-native-expo": [],
82
- basic: [],
83
- };
84
- export const TYPE_PUBLISH_TARGETS = {
85
- spring: ["nexus", "npm", "github-packages"],
86
- react: ["nexus", "npm", "github-packages"],
87
- node: ["nexus", "npm", "github-packages"],
88
- python: ["nexus", "npm", "github-packages"],
89
- flutter: [],
90
- "react-native": [],
91
- "react-native-expo": [],
92
- basic: [],
93
- };
75
+ // Values come from the registry axes (src/core/project-types.json).
76
+ export const TYPE_DEPLOY_TARGETS = Object.fromEntries(PROJECT_TYPES.map((type) => [type.id, [...type.axes.deploy]]));
77
+ export const TYPE_PUBLISH_TARGETS = Object.fromEntries(PROJECT_TYPES.map((type) => [type.id, [...type.axes.publish]]));
94
78
 
95
79
  // Applicable targets = union over the selected types (#498). 'none' is always allowed, so it is left out of the list.
96
- // Undeclared types allow everything conservatively (question kept) — when adding a new type, add its declaration above too.
80
+ // Undeclared types allow everything conservatively (question kept); registered types always declare their axes.
97
81
  export function applicableTargets(types = []) {
98
82
  const deployAll = DEPLOY_TARGETS.filter((t) => t !== "none");
99
83
  return {
@@ -10,6 +10,7 @@ import { existsSync, readdirSync } from "node:fs";
10
10
  import { join } from "node:path";
11
11
  import { t as msg } from "../i18n/index.js";
12
12
  import { markerForType as baseMarkerForType, extraMarkers } from "./detect.js";
13
+ import { PROJECT_TYPES, typeById } from "./project-types.js";
13
14
  import { normalizePath } from "../cli/args.js";
14
15
 
15
16
  // Cancel (ESC/Ctrl+C) is the CANCEL symbol — judged only by symbol identity, without importing ui (avoids a core→ui back reference)
@@ -17,9 +18,7 @@ const isCancel = (v) => typeof v === "symbol";
17
18
 
18
19
  // Main marker file name of a type.
19
20
  // detect.js returns package.json for unknown types by default — wrapped here so it becomes an empty string.
20
- const KNOWN_MARKER_TYPES = new Set([
21
- "flutter", "react", "node", "react-native", "react-native-expo", "python", "spring",
22
- ]);
21
+ const KNOWN_MARKER_TYPES = new Set(PROJECT_TYPES.filter((type) => type.path_search.files.length).map((type) => type.id));
23
22
  export function markerForType(type) {
24
23
  return KNOWN_MARKER_TYPES.has(type) ? baseMarkerForType(type) : "";
25
24
  }
@@ -64,10 +63,13 @@ function walkFindDirs(root, { prune, match, maxDepth = 3 }) {
64
63
  // Search marker file candidates per type.
65
64
  // Returns an array of candidate directory relative paths (root is ".").
66
65
  export function findTypePathCandidates(root, type) {
66
+ const search = typeById(type)?.path_search;
67
+ if (!search || !search.files.length) return [];
68
+
67
69
  // ── Spring multi-module: collapse to the settings.gradle(.kts) folder = module root ──
68
70
  // version_manager updates every build.gradle under that folder, so submodules are not expanded.
69
71
  // settings.gradle under android/ (Flutter/RN) is not spring, so prune it.
70
- if (type === "spring") {
72
+ if (search.gradle_settings_root) {
71
73
  const mm = walkFindDirs(root, {
72
74
  prune: new Set(["node_modules", ".git", "build", "dist", ".gradle", "android", "ios"]),
73
75
  match: (n) => n === "settings.gradle" || n === "settings.gradle.kts",
@@ -76,39 +78,22 @@ export function findTypePathCandidates(root, type) {
76
78
  // No settings.gradle → single module, fall back to build.gradle below
77
79
  }
78
80
 
79
- const namesByType = {
80
- flutter: ["pubspec.yaml"],
81
- react: ["package.json"], node: ["package.json"],
82
- "react-native": ["package.json"],
83
- "react-native-expo": ["app.json"],
84
- python: ["pyproject.toml", "setup.py", "requirements.txt"],
85
- spring: ["build.gradle", "build.gradle.kts", "pom.xml"],
86
- };
87
- const names = namesByType[type];
88
- if (!names) return [];
89
-
90
81
  const prune = new Set([
91
82
  "node_modules", ".git", "build", "dist", ".dart_tool", "android", "ios",
92
83
  ".gradle", "venv", ".venv", "__pycache__",
93
84
  ]);
94
85
  // If found by a higher-priority marker, use only that
95
86
  let found = [];
96
- for (const n of names) {
87
+ for (const n of search.files) {
97
88
  found = walkFindDirs(root, { prune, match: (name) => name === n });
98
89
  if (found.length) break;
99
90
  }
100
91
 
101
92
  return found.filter((d) => {
102
- if (type === "flutter") {
103
- // Exclude example/ + require lib/ alongside — avoids false hits
104
- if (d.includes("example")) return false;
105
- const libDir = d === "." ? join(root, "lib") : join(root, d, "lib");
106
- if (!existsSync(libDir)) return false;
107
- }
108
- if (type === "spring") {
109
- // Exclude false hits on android/build.gradle from Flutter/RN
110
- if (d.includes("android")) return false;
111
- }
93
+ // Exclude false hits: example apps (flutter), android/build.gradle of app projects (spring)
94
+ if ((search.exclude_parts || []).some((part) => d.includes(part))) return false;
95
+ // Required sibling folder (flutter lib/) — avoids false hits
96
+ if (search.require_dir && !existsSync(d === "." ? join(root, search.require_dir) : join(root, d, search.require_dir))) return false;
112
97
  return true;
113
98
  });
114
99
  }
@@ -0,0 +1,98 @@
1
+ // Project type registry (#1244): src/core/project-types.json is the only source of type facts.
2
+ // User repos and skills get generated copies (scripts/build_project_types.mjs); array order = detection and primary order.
3
+ import { readFileSync } from "node:fs";
4
+
5
+ // Allowed keys per level. Unknown keys are errors so a typo cannot silently do nothing
6
+ const ENTRY_KEYS = ["id", "label", "description", "detect", "path_search", "version", "axes", "is_app",
7
+ "launch_kinds", "root_resolver", "deploy_trigger_workflows"];
8
+ const DETECT_KEYS = ["markers", "package_json", "fallback_only", "extensions", "secondary"];
9
+ const PACKAGE_JSON_KEYS = ["requires_any", "requires_any_prefix", "requires_all", "excludes_any", "excludes_any_prefix"];
10
+ const EXTENSIONS_KEYS = ["patterns", "min_count"];
11
+ const PATH_SEARCH_KEYS = ["files", "require_dir", "exclude_parts", "gradle_settings_root"];
12
+ const VERSION_KEYS = ["format", "build_number", "display", "comment", "example"];
13
+ const AXES_KEYS = ["deploy", "publish"];
14
+ // Type id shape: lowercase words joined by hyphens (also the workflow folder name)
15
+ const TYPE_ID_PATTERN = /^[a-z][a-z0-9]*(-[a-z0-9]+)*$/;
16
+
17
+ // Keys of `value` not in `allowedKeys` > one problem line each
18
+ function unknownKeyProblems(value, allowedKeys, where) {
19
+ if (!value || typeof value !== "object" || Array.isArray(value)) return [`${where}: must be an object`];
20
+ return Object.keys(value).filter((key) => !allowedKeys.includes(key)).map((key) => `${where}: unknown field "${key}"`);
21
+ }
22
+
23
+ function isStringList(value) {
24
+ return Array.isArray(value) && value.every((item) => typeof item === "string");
25
+ }
26
+
27
+ /**
28
+ * Registry entries > problem list (empty = valid): fields, required values, unique ids
29
+ */
30
+ export function validateRegistry(entries) {
31
+ if (!Array.isArray(entries) || entries.length === 0) return ["registry: must be a non-empty array"];
32
+ const problems = [];
33
+ const seenIds = new Set();
34
+ for (const [index, entry] of entries.entries()) {
35
+ const where = `type ${entry?.id ?? `#${index}`}`;
36
+ problems.push(...unknownKeyProblems(entry, ENTRY_KEYS, where));
37
+ if (!entry || typeof entry !== "object") continue;
38
+ // Required scalar fields
39
+ if (!TYPE_ID_PATTERN.test(entry.id ?? "")) problems.push(`${where}: id must be lowercase words joined by hyphens`);
40
+ if (seenIds.has(entry.id)) problems.push(`${where}: duplicate id`);
41
+ seenIds.add(entry.id);
42
+ for (const key of ["label", "description"]) {
43
+ if (typeof entry[key] !== "string" || !entry[key]) problems.push(`${where}: ${key} is required`);
44
+ }
45
+ if (typeof entry.is_app !== "boolean") problems.push(`${where}: is_app must be true or false`);
46
+ // @wizard auto:<name> resolver for the type folder (APP_ROOT), or null
47
+ if (entry.root_resolver !== null && !/^[a-z]+-root$/.test(entry.root_resolver ?? "")) {
48
+ problems.push(`${where}: root_resolver must be null or a name like "flutter-root"`);
49
+ }
50
+ for (const key of ["launch_kinds", "deploy_trigger_workflows"]) {
51
+ if (!isStringList(entry[key])) problems.push(`${where}: ${key} must be a list of strings`);
52
+ }
53
+ // Nested objects (detect, path_search, version, axes)
54
+ problems.push(...unknownKeyProblems(entry.detect, DETECT_KEYS, `${where}.detect`));
55
+ if (entry.detect && !isStringList(entry.detect.markers)) problems.push(`${where}.detect: markers must be a list of strings`);
56
+ if (entry.detect?.package_json !== undefined) {
57
+ problems.push(...unknownKeyProblems(entry.detect.package_json, PACKAGE_JSON_KEYS, `${where}.detect.package_json`));
58
+ }
59
+ if (entry.detect?.extensions !== undefined) {
60
+ problems.push(...unknownKeyProblems(entry.detect.extensions, EXTENSIONS_KEYS, `${where}.detect.extensions`));
61
+ }
62
+ problems.push(...unknownKeyProblems(entry.path_search, PATH_SEARCH_KEYS, `${where}.path_search`));
63
+ if (entry.path_search && !isStringList(entry.path_search.files)) problems.push(`${where}.path_search: files must be a list of strings`);
64
+ problems.push(...unknownKeyProblems(entry.version, VERSION_KEYS, `${where}.version`));
65
+ for (const key of ["display", "comment", "example"]) {
66
+ if (entry.version && typeof entry.version[key] !== "string") problems.push(`${where}.version: ${key} is required`);
67
+ }
68
+ problems.push(...unknownKeyProblems(entry.axes, AXES_KEYS, `${where}.axes`));
69
+ if (entry.axes && !(isStringList(entry.axes.deploy) && isStringList(entry.axes.publish))) {
70
+ problems.push(`${where}.axes: deploy and publish must be lists of strings`);
71
+ }
72
+ }
73
+ return problems;
74
+ }
75
+
76
+ /**
77
+ * src/core/project-types.json > validated, frozen entries (throws with every problem)
78
+ */
79
+ function loadRegistry() {
80
+ const entries = JSON.parse(readFileSync(new URL("./project-types.json", import.meta.url), "utf8"));
81
+ const problems = validateRegistry(entries);
82
+ if (problems.length) throw new Error(`project type registry is invalid:\n- ${problems.join("\n- ")}`);
83
+ return Object.freeze(entries.map((entry) => Object.freeze(entry)));
84
+ }
85
+
86
+ export const PROJECT_TYPES = loadRegistry();
87
+ export const VALID_TYPES = Object.freeze(PROJECT_TYPES.map((type) => type.id));
88
+
89
+ export function typeById(typeId) {
90
+ return PROJECT_TYPES.find((type) => type.id === typeId);
91
+ }
92
+
93
+ /**
94
+ * Push-to-deploy workflow file names owned by types (branch-sub.js adds the type-independent ones)
95
+ */
96
+ export function deployTriggerWorkflows() {
97
+ return PROJECT_TYPES.flatMap((type) => type.deploy_trigger_workflows);
98
+ }
@@ -0,0 +1,215 @@
1
+ [
2
+ {
3
+ "id": "flutter",
4
+ "label": "Flutter",
5
+ "description": "Flutter",
6
+ "detect": {
7
+ "markers": ["pubspec.yaml"],
8
+ "extensions": { "patterns": ["\\.dart$"], "min_count": 1 },
9
+ "secondary": "`lib/` directory"
10
+ },
11
+ "path_search": { "files": ["pubspec.yaml"], "require_dir": "lib", "exclude_parts": ["example"] },
12
+ "version": {
13
+ "format": "pubspec",
14
+ "build_number": null,
15
+ "display": "pubspec.yaml",
16
+ "comment": "pubspec.yaml (version: x.y.z+i, includes buildNumber)",
17
+ "example": "version: 1.0.0+1"
18
+ },
19
+ "axes": { "deploy": [], "publish": [] },
20
+ "is_app": true,
21
+ "launch_kinds": ["app"],
22
+ "root_resolver": "flutter-root",
23
+ "deploy_trigger_workflows": [
24
+ "PROJECT-FLUTTER-ANDROID-FIREBASE-CICD.yaml",
25
+ "PROJECT-FLUTTER-ANDROID-PLAYSTORE-CICD.yaml",
26
+ "PROJECT-FLUTTER-ANDROID-SELFHOSTED-CICD.yaml",
27
+ "PROJECT-FLUTTER-IOS-TESTFLIGHT.yaml"
28
+ ]
29
+ },
30
+ {
31
+ "id": "spring",
32
+ "label": "Spring Boot",
33
+ "description": "Spring Boot",
34
+ "detect": {
35
+ "markers": ["build.gradle", "build.gradle.kts", "pom.xml"],
36
+ "extensions": { "patterns": ["\\.java$", "\\.kt$", "\\.gradle$"], "min_count": 3 },
37
+ "secondary": "`src/main/java/`, Spring dependencies"
38
+ },
39
+ "path_search": {
40
+ "files": ["build.gradle", "build.gradle.kts", "pom.xml"],
41
+ "exclude_parts": ["android"],
42
+ "gradle_settings_root": true
43
+ },
44
+ "version": {
45
+ "format": "gradle",
46
+ "build_number": null,
47
+ "display": "build.gradle",
48
+ "comment": "build.gradle (version = \"x.y.z\")",
49
+ "example": "version = '1.0.0'"
50
+ },
51
+ "axes": { "deploy": ["docker-ssh", "vercel"], "publish": ["nexus", "npm", "github-packages"] },
52
+ "is_app": false,
53
+ "launch_kinds": ["server"],
54
+ "root_resolver": null,
55
+ "deploy_trigger_workflows": [
56
+ "PROJECT-SPRING-SIMPLE-CICD.yaml",
57
+ "PROJECT-SPRING-NEXUS-PUBLISH.yml",
58
+ "PROJECT-SPRING-GITHUB-PACKAGES-PUBLISH.yml"
59
+ ]
60
+ },
61
+ {
62
+ "id": "python",
63
+ "label": "Python",
64
+ "description": "FastAPI/Django",
65
+ "detect": {
66
+ "markers": ["pyproject.toml", "setup.py", "requirements.txt"],
67
+ "extensions": { "patterns": ["\\.py$"], "min_count": 3 },
68
+ "secondary": "`manage.py` (Django), `main.py` (FastAPI)"
69
+ },
70
+ "path_search": { "files": ["pyproject.toml", "setup.py", "requirements.txt"] },
71
+ "version": {
72
+ "format": "pyproject",
73
+ "build_number": null,
74
+ "display": "pyproject.toml",
75
+ "comment": "pyproject.toml (version = \"x.y.z\")",
76
+ "example": "version = \"1.0.0\""
77
+ },
78
+ "axes": { "deploy": ["docker-ssh", "vercel"], "publish": ["nexus", "npm", "github-packages"] },
79
+ "is_app": false,
80
+ "launch_kinds": ["server"],
81
+ "root_resolver": null,
82
+ "deploy_trigger_workflows": ["PROJECT-PYTHON-SIMPLE-CICD.yaml"]
83
+ },
84
+ {
85
+ "id": "react",
86
+ "label": "React / Next.js",
87
+ "description": "React.js / Next.js",
88
+ "detect": {
89
+ "markers": ["package.json"],
90
+ "package_json": {
91
+ "requires_any": ["react", "next"],
92
+ "excludes_any": ["react-native"],
93
+ "excludes_any_prefix": ["@react-native/"]
94
+ },
95
+ "extensions": { "patterns": ["\\.tsx$", "\\.jsx$"], "min_count": 3 },
96
+ "secondary": "`src/` or `app/`, `tsconfig.json`, `next.config.js`"
97
+ },
98
+ "path_search": { "files": ["package.json"] },
99
+ "version": {
100
+ "format": "package_json",
101
+ "build_number": null,
102
+ "display": "package.json",
103
+ "comment": "package.json (\"version\": \"x.y.z\")",
104
+ "example": "\"version\": \"1.0.0\""
105
+ },
106
+ "axes": { "deploy": ["docker-ssh", "vercel"], "publish": ["nexus", "npm", "github-packages"] },
107
+ "is_app": false,
108
+ "launch_kinds": ["web"],
109
+ "root_resolver": null,
110
+ "deploy_trigger_workflows": ["PROJECT-REACT-CICD.yaml"]
111
+ },
112
+ {
113
+ "id": "react-native",
114
+ "label": "React Native CLI",
115
+ "description": "React Native CLI (no app workflows)",
116
+ "detect": {
117
+ "markers": ["package.json"],
118
+ "package_json": {
119
+ "requires_any": ["react-native"],
120
+ "requires_any_prefix": ["@react-native/"],
121
+ "excludes_any": ["expo"]
122
+ },
123
+ "secondary": "`android/`, `ios/` directories"
124
+ },
125
+ "path_search": { "files": ["package.json"] },
126
+ "version": {
127
+ "format": "rn_native",
128
+ "build_number": "rn_native",
129
+ "display": "Info.plist + build.gradle",
130
+ "comment": "iOS Info.plist or Android build.gradle",
131
+ "example": "CFBundleShortVersionString / versionName"
132
+ },
133
+ "axes": { "deploy": [], "publish": [] },
134
+ "is_app": true,
135
+ "launch_kinds": ["app"],
136
+ "root_resolver": null,
137
+ "deploy_trigger_workflows": []
138
+ },
139
+ {
140
+ "id": "react-native-expo",
141
+ "label": "React Native (Expo)",
142
+ "description": "Expo",
143
+ "detect": {
144
+ "markers": ["package.json"],
145
+ "package_json": {
146
+ "requires_all": ["expo"],
147
+ "requires_any": ["react-native"],
148
+ "requires_any_prefix": ["@react-native/"]
149
+ },
150
+ "secondary": "`expo` key in `app.json`; `android/` and `ios/` may be absent"
151
+ },
152
+ "path_search": { "files": ["app.json"] },
153
+ "version": {
154
+ "format": "expo_app_json",
155
+ "build_number": "expo_android_version_code",
156
+ "display": "app.json",
157
+ "comment": "app.json (expo.version)",
158
+ "example": "\"version\": \"1.0.0\""
159
+ },
160
+ "axes": { "deploy": [], "publish": [] },
161
+ "is_app": true,
162
+ "launch_kinds": ["app"],
163
+ "root_resolver": "expo-root",
164
+ "deploy_trigger_workflows": [
165
+ "PROJECT-REACT-NATIVE-EXPO-ANDROID-PLAYSTORE-CICD.yaml",
166
+ "PROJECT-REACT-NATIVE-EXPO-IOS-TESTFLIGHT.yaml"
167
+ ]
168
+ },
169
+ {
170
+ "id": "node",
171
+ "label": "Node.js",
172
+ "description": "Node.js",
173
+ "detect": {
174
+ "markers": ["package.json"],
175
+ "fallback_only": true,
176
+ "extensions": { "patterns": ["\\.ts$", "\\.js$"], "min_count": 3 },
177
+ "secondary": "`express`, `fastify`, and so on"
178
+ },
179
+ "path_search": { "files": ["package.json"] },
180
+ "version": {
181
+ "format": "package_json",
182
+ "build_number": null,
183
+ "display": "package.json",
184
+ "comment": "package.json (\"version\": \"x.y.z\")",
185
+ "example": "\"version\": \"1.0.0\""
186
+ },
187
+ "axes": { "deploy": ["docker-ssh", "vercel"], "publish": ["nexus", "npm", "github-packages"] },
188
+ "is_app": false,
189
+ "launch_kinds": ["web", "server"],
190
+ "root_resolver": null,
191
+ "deploy_trigger_workflows": ["PROJECT-NODE-NPM-PUBLISH.yaml"]
192
+ },
193
+ {
194
+ "id": "basic",
195
+ "label": "Basic",
196
+ "description": "General purpose",
197
+ "detect": {
198
+ "markers": [],
199
+ "secondary": "Only `version.yml` exists"
200
+ },
201
+ "path_search": { "files": [] },
202
+ "version": {
203
+ "format": null,
204
+ "build_number": null,
205
+ "display": "version.yml only",
206
+ "comment": "version.yml only",
207
+ "example": "-"
208
+ },
209
+ "axes": { "deploy": [], "publish": [] },
210
+ "is_app": false,
211
+ "launch_kinds": [],
212
+ "root_resolver": null,
213
+ "deploy_trigger_workflows": []
214
+ }
215
+ ]
@@ -4,6 +4,7 @@ import { execFileSync } from "node:child_process";
4
4
  import { readFileSync } from "node:fs";
5
5
  import { DEPLOY_TARGETS, LABEL_STYLES } from "./constants.js";
6
6
  import { REPO_LANGUAGES } from "./repo-language.js";
7
+ import { PROJECT_TYPES } from "./project-types.js";
7
8
 
8
9
  // Match patterns built from the value lists — adding a language or style to a list makes the parser read it automatically.
9
10
  // (Hardcoding languages in the pattern means a newly saved language is unreadable on the next update and reverts to ko.)
@@ -13,6 +14,9 @@ const DEPLOY_TRIGGER_BRANCH_RE = /^\s+deploy_trigger_branch:\s*["']?([A-Za-z0-9.
13
14
  const CI_MINUTES_SAVER_RE = /^\s+ci_minutes_saver:\s*["']?(true|false)["']?/;
14
15
  const LABEL_STYLE_RE = new RegExp(`^\\s+label_style:\\s*["']?(${alt(LABEL_STYLES)})["']?`);
15
16
 
17
+ // "Files synced per project type" lines, one per registry type (language-neutral, both headers)
18
+ const TYPE_SYNC_LINES = PROJECT_TYPES.map((type) => `# - ${type.id}: ${type.version.comment}`).join("\n");
19
+
16
20
  const HEADER_EN = `# ===================================================================
17
21
  # Project version management file
18
22
  # ===================================================================
@@ -37,13 +41,7 @@ const HEADER_EN = `# ===========================================================
37
41
  # - You may edit the version value by hand regardless of the rules above
38
42
  #
39
43
  # Files synced per project type:
40
- # - spring: build.gradle (version = "x.y.z")
41
- # - flutter: pubspec.yaml (version: x.y.z+i, includes buildNumber)
42
- # - react/node: package.json ("version": "x.y.z")
43
- # - react-native: iOS Info.plist or Android build.gradle
44
- # - react-native-expo: app.json (expo.version)
45
- # - python: pyproject.toml (version = "x.y.z")
46
- # - basic/other: only this version.yml file is used
44
+ ${TYPE_SYNC_LINES}
47
45
  #
48
46
  # Related workflows:
49
47
  # - .github/workflows/PROJECT-VERSION-CONTROL.yaml
@@ -82,13 +80,7 @@ const HEADER_KO = `# ===========================================================
82
80
  # - 위 판정과 무관하게 version 값을 직접 수정해도 됩니다
83
81
  #
84
82
  # 프로젝트 타입별 동기화 파일:
85
- # - spring: build.gradle (version = "x.y.z")
86
- # - flutter: pubspec.yaml (version: x.y.z+i, buildNumber 포함)
87
- # - react/node: package.json ("version": "x.y.z")
88
- # - react-native: iOS Info.plist 또는 Android build.gradle
89
- # - react-native-expo: app.json (expo.version)
90
- # - python: pyproject.toml (version = "x.y.z")
91
- # - basic/기타: version.yml 파일만 사용
83
+ ${TYPE_SYNC_LINES}
92
84
  #
93
85
  # 연관된 워크플로우:
94
86
  # - .github/workflows/PROJECT-VERSION-CONTROL.yaml
package/src/ui/prompts.js CHANGED
@@ -3,6 +3,7 @@
3
3
  // Cancel (ESC/Ctrl+C) makes each function return the CANCEL symbol → the caller exits normally (exit 0).
4
4
  import * as engine from "./readline-engine.js";
5
5
  import { t } from "../i18n/index.js";
6
+ import { VALID_TYPES } from "../core/project-types.js";
6
7
 
7
8
  export const CANCEL = engine.CANCEL;
8
9
 
@@ -65,7 +66,7 @@ export async function editMenu({ showOptional = false, axes = null } = {}) {
65
66
 
66
67
  // Type multiselect.
67
68
  export async function selectTypes(current = []) {
68
- const all = ["spring", "flutter", "react", "react-native", "react-native-expo", "node", "python", "basic"];
69
+ const all = VALID_TYPES;
69
70
  return engine.multiselect({
70
71
  message: t("types.prompt"),
71
72
  options: all.map((t) => ({ value: t, label: t })),