@icebreakers/monorepo 5.4.9 → 5.5.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.
@@ -1,6 +1,6 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.mjs";
2
2
  import { i as getWorkspacePackages, n as getWorkspaceData, r as getWorkspacePackageSummaries } from "./workspace-MCKewElu.mjs";
3
- import { b as fs$1, c as devDependencies$1, d as localize, h as logger, i as packageDir, n as assetsDir, o as templatesDir, p as resolveRepoctlLocale, s as dependencies, t as initToolingTargets, u as version$1, x as isIgnorableFsError } from "./types-C-aVvG6i.mjs";
3
+ import { b as isIgnorableFsError, c as package_default$1, f as resolveRepoctlLocale, i as packageDir, l as version$1, m as logger, n as assetsDir, o as templatesDir, t as initToolingTargets, u as localize, y as fs$1 } from "./types-B7zNkQpy.mjs";
4
4
  import { a as loadMonorepoConfig, c as resolveToolingConfig, i as getRepoctlConfigCandidates, o as loadMonorepoConfigDetails, s as resolveCommandConfig } from "./config-p842Knhq.mjs";
5
5
  import { f as defineTsconfigConfig } from "./tooling-BfXlmCi-.mjs";
6
6
  import gitUrlParse from "git-url-parse";
@@ -682,11 +682,21 @@ function isMatch(str, arr) {
682
682
  /**
683
683
  * 内置 skills 目录名称。
684
684
  */
685
- const skillName = "icebreakers-monorepo-cli";
685
+ const skillName = "repoctl";
686
+ /**
687
+ * 历史 skill 目录名称,同步时删除以免过期副本继续被加载。
688
+ */
689
+ const legacySkillName = "icebreakers-monorepo-cli";
686
690
  /**
687
691
  * 当前支持的 skills 同步目标。
688
692
  */
689
- const skillTargets = ["codex", "claude"];
693
+ const skillTargets = [
694
+ "codex",
695
+ "claude",
696
+ "cursor",
697
+ "agents",
698
+ "grok"
699
+ ];
690
700
  /**
691
701
  * 包内 skills 模板源目录。
692
702
  */
@@ -698,8 +708,20 @@ const skillSourceDir = path.join(packageDir, "resources", "skills", skillName);
698
708
  */
699
709
  function getSkillTargetPaths(homeDir = os.homedir()) {
700
710
  return {
711
+ agents: path.join(homeDir, ".agents", "skills", skillName),
712
+ claude: path.join(homeDir, ".claude", "skills", skillName),
701
713
  codex: path.join(homeDir, ".codex", "skills", skillName),
702
- claude: path.join(homeDir, ".claude", "skills", skillName)
714
+ cursor: path.join(homeDir, ".cursor", "skills", skillName),
715
+ grok: path.join(homeDir, ".grok", "skills", skillName)
716
+ };
717
+ }
718
+ function getLegacySkillTargetPaths(homeDir = os.homedir()) {
719
+ return {
720
+ agents: path.join(homeDir, ".agents", "skills", legacySkillName),
721
+ claude: path.join(homeDir, ".claude", "skills", legacySkillName),
722
+ codex: path.join(homeDir, ".codex", "skills", legacySkillName),
723
+ cursor: path.join(homeDir, ".cursor", "skills", legacySkillName),
724
+ grok: path.join(homeDir, ".grok", "skills", legacySkillName)
703
725
  };
704
726
  }
705
727
  function normalizeTargets(values) {
@@ -729,9 +751,11 @@ async function syncSkills(options = {}) {
729
751
  }));
730
752
  if (!targets?.length) return [];
731
753
  const targetPaths = getSkillTargetPaths();
754
+ const legacyPaths = getLegacySkillTargetPaths();
732
755
  const results = [];
733
756
  for (const target of targets) {
734
757
  const dest = targetPaths[target];
758
+ await fs$1.remove(legacyPaths[target]);
735
759
  await fs$1.remove(dest);
736
760
  await fs$1.ensureDir(path.dirname(dest));
737
761
  await fs$1.copy(skillSourceDir, dest);
@@ -1817,155 +1841,122 @@ async function setReadme_default(ctx, options = {}) {
1817
1841
  }
1818
1842
  //#endregion
1819
1843
  //#region ../../package.json
1820
- var devDependencies = {
1821
- "@commitlint/cli": "^21.2.2",
1822
- "@eslint/config-inspector": "^3.4.0",
1823
- "@eslint/eslintrc": "^3.3.7",
1824
- "@icebreakers/commitlint-config": "workspace:*",
1825
- "@icebreakers/eslint-config": "workspace:*",
1826
- "@icebreakers/monorepo": "workspace:*",
1827
- "@icebreakers/stylelint-config": "workspace:*",
1828
- "@next/eslint-plugin-next": "^16.3.4",
1829
- "@prettier/plugin-xml": "^3.4.2",
1830
- "@tanstack/eslint-plugin-query": "^5.102.8",
1831
- "@types/eslint-plugin-tailwindcss": "^3.17.0",
1832
- "@types/fs-extra": "^11.0.4",
1833
- "@types/lodash": "^4.17.25",
1834
- "@types/lodash-es": "^4.17.12",
1835
- "@types/micromatch": "^4.0.10",
1836
- "@types/node": "^26.5.0",
1837
- "@types/semver": "^7.8.0",
1838
- "@types/set-value": "^4.0.3",
1839
- "@typescript-eslint/types": "^8.70.0",
1840
- "@unocss/eslint-plugin": "66.10.0",
1841
- "@vitest/coverage-v8": "~5.0.0",
1842
- "astro-eslint-parser": "^3.1.0",
1843
- "ci-info": "^4.4.0",
1844
- "cross-env": "^10.1.0",
1845
- "defu": "^6.1.7",
1846
- "es-toolkit": "^1.52.0",
1847
- "eslint": "^10.10.0",
1848
- "eslint-plugin-astro": "^3.1.0",
1849
- "eslint-plugin-mdx": "3.8.1",
1850
- "eslint-plugin-svelte": "^3.23.0",
1851
- "execa": "^10.0.1",
1852
- "fast-glob": "^3.3.3",
1853
- "fs-extra": "^11.4.0",
1854
- "get-value": "^4.1.0",
1855
- "husky": "^9.1.7",
1856
- "jiti": "^2.7.0",
1857
- "lint-staged": "^17.5.0",
1858
- "lodash": "^4.18.1",
1859
- "lodash-es": "^4.18.1",
1860
- "micromatch": "^4.0.8",
1861
- "only-allow": "^1.2.2",
1862
- "pathe": "^2.0.3",
1863
- "pkg-types": "^2.3.3",
1864
- "prettier": "^3.9.6",
1865
- "prettier-plugin-astro": "^0.14.1",
1866
- "repoctl": "workspace:*",
1867
- "rimraf": "^6.1.3",
1868
- "set-value": "^4.1.0",
1869
- "stylelint": "^17.15.0",
1870
- "svelte": "^5.57.0",
1871
- "svelte-eslint-parser": "^1.8.1",
1872
- "tailwindcss": "^4.3.3",
1873
- "tsd": "^0.33.0",
1874
- "tsdown": "0.23.0",
1875
- "tslib": "^2.8.1",
1876
- "tsup": "^8.5.1",
1877
- "tsx": "^4.23.13",
1878
- "turbo": "^2.10.12",
1879
- "type-fest": "^5.9.0",
1880
- "typescript": "^6.0.3",
1881
- "unbuild": "^3.6.1",
1882
- "vitest": "~5.0.0",
1883
- "yaml": "^2.9.0"
1844
+ var package_default = {
1845
+ name: "repoctl-workspace",
1846
+ type: "module",
1847
+ version: "0.0.0",
1848
+ "private": true,
1849
+ packageManager: "pnpm@12.3.4",
1850
+ description: "Source workspace for repoctl and Icebreaker's shared development packages",
1851
+ author: "ice breaker <hi@sonofmagic.top>",
1852
+ license: "MIT",
1853
+ homepage: "https://repoctl.icebreaker.top",
1854
+ repository: {
1855
+ "type": "git",
1856
+ "url": "git+https://github.com/sonofmagic/repoctl.git"
1857
+ },
1858
+ bugs: { "url": "https://github.com/sonofmagic/repoctl/issues" },
1859
+ keywords: [
1860
+ "repoctl",
1861
+ "monorepo",
1862
+ "pnpm",
1863
+ "turborepo",
1864
+ "typescript"
1865
+ ],
1866
+ engines: { "node": ">=22.13.0" },
1867
+ scripts: {
1868
+ "build": "turbo run build",
1869
+ "tooling:build": "turbo run build --filter=@icebreakers/monorepo --filter=repoctl",
1870
+ "dev": "turbo run dev --parallel",
1871
+ "test": "node -e \"require('node:fs').mkdirSync('coverage/.tmp', { recursive: true })\" && pnpm check:no-tracked-build-artifacts && vitest run && pnpm test:types",
1872
+ "test:packaged-doctor": "node scripts/smoke-packaged-doctor.mjs",
1873
+ "test:worker-types": "node scripts/worker-types/index.mjs",
1874
+ "test:dev": "node -e \"require('node:fs').mkdirSync('coverage/.tmp', { recursive: true })\" && pnpm check:no-tracked-build-artifacts && vitest",
1875
+ "lint": "pnpm run tooling:build && turbo run lint",
1876
+ "tsd": "turbo run tsd",
1877
+ "test:types": "turbo run test:types",
1878
+ "check:no-tracked-build-artifacts": "node ./scripts/check-no-tracked-build-artifacts.mjs",
1879
+ "check:workflows": "node ./scripts/check-workflows.mjs",
1880
+ "audit": "pnpm audit --audit-level=moderate",
1881
+ "audit:fix": "pnpm audit --fix",
1882
+ "cf-typegen": "pnpm --filter @icebreakers/client --filter @icebreakers/server run cf-typegen",
1883
+ "cf-typegen:check": "pnpm --filter @icebreakers/client --filter @icebreakers/server run cf-typegen:check",
1884
+ "typecheck": "turbo run typecheck",
1885
+ "format": "eslint . --fix",
1886
+ "validate": "pnpm run build && pnpm run lint && pnpm run typecheck && pnpm run tsd && pnpm run test",
1887
+ "release": "pnpm change",
1888
+ "version-packages": "pnpm version -r",
1889
+ "publish-packages": "repo release stable publish",
1890
+ "release:pre": "repo release pre publish",
1891
+ "------": "--------------",
1892
+ "preinstall": "npx only-allow pnpm",
1893
+ "prepare": "husky",
1894
+ "postinstall": "pnpm run build",
1895
+ "commit": "commit",
1896
+ "commitlint": "commitlint --edit",
1897
+ "sync": "turbo run sync",
1898
+ "inspector": "npx @eslint/config-inspector",
1899
+ "build:inspector": "pnpm build && npx @eslint/config-inspector build",
1900
+ "-------": "---------------",
1901
+ "repo:init": "repo init",
1902
+ "repo:new": "repo new",
1903
+ "repo:check": "repo check",
1904
+ "repo:doctor": "repo doctor",
1905
+ "------simple": "--------------",
1906
+ "pr:alpha": "repo release pre enter alpha",
1907
+ "pr:beta": "repo release pre enter beta",
1908
+ "pr:rc": "repo release pre enter rc",
1909
+ "pr:next": "repo release pre enter next",
1910
+ "pr:exit": "repo release pre exit",
1911
+ "--------": "----------------"
1912
+ },
1913
+ devDependencies: {
1914
+ "@commitlint/cli": "^21.2.2",
1915
+ "@eslint/config-inspector": "^3.4.1",
1916
+ "@icebreakers/commitlint-config": "workspace:*",
1917
+ "@icebreakers/eslint-config": "workspace:*",
1918
+ "@icebreakers/monorepo": "workspace:*",
1919
+ "@icebreakers/stylelint-config": "workspace:*",
1920
+ "@types/node": "^26.5.1",
1921
+ "@vitest/coverage-v8": "~5.0.0",
1922
+ "eslint": "^10.10.0",
1923
+ "execa": "^10.0.1",
1924
+ "husky": "^9.1.7",
1925
+ "lint-staged": "^17.5.1",
1926
+ "only-allow": "^1.2.2",
1927
+ "repoctl": "workspace:*",
1928
+ "stylelint": "^17.15.0",
1929
+ "tailwindcss": "^4.3.3",
1930
+ "tsd": "^0.33.0",
1931
+ "tsdown": "0.23.0",
1932
+ "turbo": "^2.10.12",
1933
+ "typescript": "^6.0.3",
1934
+ "vitest": "~5.0.0",
1935
+ "yaml": "^2.9.0"
1936
+ },
1937
+ publishConfig: {
1938
+ "access": "public",
1939
+ "registry": "https://registry.npmjs.org"
1940
+ }
1884
1941
  };
1885
1942
  //#endregion
1886
1943
  //#region src/commands/init/tooling/presets.ts
1944
+ function isConcreteNpmSpecifier(version) {
1945
+ return !version.startsWith("catalog:") && !version.startsWith("workspace:");
1946
+ }
1947
+ function collectConcreteDependencyVersions(pkg) {
1948
+ const versions = {};
1949
+ for (const group of [pkg.dependencies, pkg.devDependencies]) for (const [name, version] of Object.entries(group ?? {})) if (typeof version === "string" && version.length > 0 && isConcreteNpmSpecifier(version)) versions[name] = version;
1950
+ return versions;
1951
+ }
1887
1952
  const packageDependencies = {
1888
- ...{
1889
- name: "repoctl-workspace",
1890
- type: "module",
1891
- version: "0.0.0",
1892
- "private": true,
1893
- packageManager: "pnpm@12.3.4",
1894
- description: "Source workspace for repoctl and Icebreaker's shared development packages",
1895
- author: "ice breaker <hi@sonofmagic.top>",
1896
- homepage: "https://repoctl.icebreaker.top",
1897
- repository: {
1898
- "type": "git",
1899
- "url": "git+https://github.com/sonofmagic/repoctl.git"
1900
- },
1901
- bugs: { "url": "https://github.com/sonofmagic/repoctl/issues" },
1902
- keywords: [
1903
- "repoctl",
1904
- "monorepo",
1905
- "pnpm",
1906
- "turborepo",
1907
- "typescript"
1908
- ],
1909
- engines: { "node": ">=22.13.0" },
1910
- scripts: {
1911
- "build": "turbo run build",
1912
- "tooling:build": "turbo run build --filter=@icebreakers/monorepo --filter=repoctl",
1913
- "dev": "turbo run dev --parallel",
1914
- "test": "node -e \"require('node:fs').mkdirSync('coverage/.tmp', { recursive: true })\" && pnpm check:no-tracked-build-artifacts && vitest run && pnpm test:types",
1915
- "test:packaged-doctor": "node scripts/smoke-packaged-doctor.mjs",
1916
- "test:worker-types": "node scripts/worker-types/index.mjs",
1917
- "test:dev": "node -e \"require('node:fs').mkdirSync('coverage/.tmp', { recursive: true })\" && pnpm check:no-tracked-build-artifacts && vitest",
1918
- "lint": "pnpm run tooling:build && turbo run lint",
1919
- "tsd": "turbo run tsd",
1920
- "test:types": "turbo run test:types",
1921
- "check:no-tracked-build-artifacts": "node ./scripts/check-no-tracked-build-artifacts.mjs",
1922
- "check:workflows": "node ./scripts/check-workflows.mjs",
1923
- "audit": "pnpm audit --audit-level=moderate",
1924
- "audit:fix": "pnpm audit --fix",
1925
- "cf-typegen": "pnpm --filter @icebreakers/client --filter @icebreakers/server run cf-typegen",
1926
- "cf-typegen:check": "pnpm --filter @icebreakers/client --filter @icebreakers/server run cf-typegen:check",
1927
- "typecheck": "turbo run typecheck",
1928
- "format": "eslint . --fix",
1929
- "validate": "pnpm run build && pnpm run lint && pnpm run typecheck && pnpm run tsd && pnpm run test",
1930
- "release": "pnpm change",
1931
- "version-packages": "pnpm version -r",
1932
- "publish-packages": "repo release stable publish",
1933
- "release:pre": "repo release pre publish",
1934
- "------": "--------------",
1935
- "preinstall": "npx only-allow pnpm",
1936
- "prepare": "husky",
1937
- "postinstall": "pnpm run build",
1938
- "commit": "commit",
1939
- "commitlint": "commitlint --edit",
1940
- "sync": "turbo run sync",
1941
- "inspector": "npx @eslint/config-inspector",
1942
- "build:inspector": "pnpm build && npx @eslint/config-inspector build",
1943
- "-------": "---------------",
1944
- "repo:init": "repo init",
1945
- "repo:new": "repo new",
1946
- "repo:check": "repo check",
1947
- "repo:doctor": "repo doctor",
1948
- "------simple": "--------------",
1949
- "pr:alpha": "repo release pre enter alpha",
1950
- "pr:beta": "repo release pre enter beta",
1951
- "pr:rc": "repo release pre enter rc",
1952
- "pr:next": "repo release pre enter next",
1953
- "pr:exit": "repo release pre exit",
1954
- "--------": "----------------"
1955
- },
1956
- devDependencies,
1957
- publishConfig: {
1958
- "access": "public",
1959
- "registry": "https://registry.npmjs.org"
1960
- }
1961
- }.dependencies ?? {},
1962
- ...devDependencies ?? {},
1963
- ...dependencies ?? {},
1964
- ...devDependencies$1 ?? {}
1953
+ ...collectConcreteDependencyVersions(package_default),
1954
+ ...collectConcreteDependencyVersions(package_default$1)
1965
1955
  };
1966
1956
  function getDependencyVersion(name) {
1967
1957
  const version = packageDependencies[name];
1968
1958
  if (!version) throw new Error(localize(`No version information was found for dependency ${name}.`, `未找到依赖 ${name} 的版本信息。`));
1959
+ if (!isConcreteNpmSpecifier(version)) throw new Error(localize(`Dependency ${name} must use a concrete version, not ${version}.`, `依赖 ${name} 必须使用具体版本,不能使用 ${version}。`));
1969
1960
  return version;
1970
1961
  }
1971
1962
  function getToolingPackageVersion() {
@@ -2165,8 +2156,8 @@ async function ensureRootPackageJson(cwd) {
2165
2156
  type: "module",
2166
2157
  version: "0.0.0",
2167
2158
  private: true,
2168
- packageManager: "pnpm@10.0.0",
2169
- engines: { node: ">=20.0.0" },
2159
+ packageManager: "pnpm@12.3.4",
2160
+ engines: { node: ">=22.13.0" },
2170
2161
  scripts: {},
2171
2162
  devDependencies: {}
2172
2163
  };
@@ -2979,11 +2970,17 @@ var GitHubClient = class {
2979
2970
  repository;
2980
2971
  apiUrl;
2981
2972
  requestFetch;
2973
+ retryAttempts;
2974
+ retryDelay;
2975
+ sleep;
2982
2976
  constructor(options = {}) {
2983
2977
  this.token = options.token ?? process.env["GITHUB_TOKEN"];
2984
2978
  this.repository = options.repository ?? process.env["GITHUB_REPOSITORY"];
2985
2979
  this.apiUrl = (options.apiUrl ?? process.env["GITHUB_API_URL"] ?? "https://api.github.com").replace(/\/$/, "");
2986
2980
  this.requestFetch = options.fetch ?? globalThis.fetch;
2981
+ this.retryAttempts = Math.max(1, options.retryAttempts ?? 3);
2982
+ this.retryDelay = Math.max(0, options.retryDelay ?? 1e3);
2983
+ this.sleep = options.sleep ?? ((milliseconds) => new Promise((resolve) => setTimeout(resolve, milliseconds)));
2987
2984
  }
2988
2985
  getRepository() {
2989
2986
  if (!this.token) throw new GitHubApiError("GITHUB_TOKEN is required for GitHub release orchestration", 0);
@@ -2992,36 +2989,47 @@ var GitHubClient = class {
2992
2989
  }
2993
2990
  async request(method, endpoint, body) {
2994
2991
  const repository = this.getRepository();
2995
- let response;
2996
- try {
2997
- response = await this.requestFetch(`${this.apiUrl}/repos/${repository}${endpoint}`, {
2998
- method,
2999
- headers: {
3000
- "Accept": "application/vnd.github+json",
3001
- "Authorization": `Bearer ${this.token}`,
3002
- "X-GitHub-Api-Version": "2022-11-28",
3003
- ...body === void 0 ? {} : { "Content-Type": "application/json" }
3004
- },
3005
- ...body === void 0 ? {} : { body: JSON.stringify(body) }
3006
- });
3007
- } catch (error) {
3008
- throw new GitHubApiError(`GitHub API request ${method} ${endpoint} failed: ${error instanceof Error ? error.message : String(error)}. Check network access and GITHUB_API_URL.`, 0);
3009
- }
3010
- const text = await response.text();
3011
- let data;
3012
- if (text) try {
3013
- data = JSON.parse(text);
3014
- } catch {
3015
- throw new GitHubApiError(`GitHub API returned invalid JSON for ${method} ${endpoint}`, response.status, text);
3016
- }
3017
- if (!response.ok) {
3018
- const message = typeof data === "object" && data !== null && "message" in data ? String(data.message) : text || response.statusText;
3019
- throw new GitHubApiError(`GitHub API ${method} ${endpoint} failed (${response.status}): ${message}`, response.status, text);
2992
+ for (let attempt = 1; attempt <= this.retryAttempts; attempt += 1) {
2993
+ let response;
2994
+ try {
2995
+ response = await this.requestFetch(`${this.apiUrl}/repos/${repository}${endpoint}`, {
2996
+ method,
2997
+ headers: {
2998
+ "Accept": "application/vnd.github+json",
2999
+ "Authorization": `Bearer ${this.token}`,
3000
+ "X-GitHub-Api-Version": "2022-11-28",
3001
+ ...body === void 0 ? {} : { "Content-Type": "application/json" }
3002
+ },
3003
+ ...body === void 0 ? {} : { body: JSON.stringify(body) }
3004
+ });
3005
+ } catch (error) {
3006
+ if (attempt < this.retryAttempts) {
3007
+ await this.sleep(this.retryDelay * 2 ** (attempt - 1));
3008
+ continue;
3009
+ }
3010
+ throw new GitHubApiError(`GitHub API request ${method} ${endpoint} failed: ${error instanceof Error ? error.message : String(error)}. Check network access and GITHUB_API_URL.`, 0);
3011
+ }
3012
+ const text = await response.text();
3013
+ let data;
3014
+ if (text) try {
3015
+ data = JSON.parse(text);
3016
+ } catch {
3017
+ throw new GitHubApiError(`GitHub API returned invalid JSON for ${method} ${endpoint}`, response.status, text);
3018
+ }
3019
+ if (!response.ok) {
3020
+ const message = typeof data === "object" && data !== null && "message" in data ? String(data.message) : text || response.statusText;
3021
+ if ((response.status === 429 || response.status >= 500) && attempt < this.retryAttempts) {
3022
+ await this.sleep(this.retryDelay * 2 ** (attempt - 1));
3023
+ continue;
3024
+ }
3025
+ throw new GitHubApiError(`GitHub API ${method} ${endpoint} failed (${response.status}): ${message}`, response.status, text);
3026
+ }
3027
+ return {
3028
+ status: response.status,
3029
+ data
3030
+ };
3020
3031
  }
3021
- return {
3022
- status: response.status,
3023
- data
3024
- };
3032
+ throw new GitHubApiError(`GitHub API request ${method} ${endpoint} exhausted retries`, 0);
3025
3033
  }
3026
3034
  getRequest() {
3027
3035
  return this.request.bind(this);
@@ -3054,7 +3062,21 @@ var GitHubClient = class {
3054
3062
  if (!created.data) throw new GitHubApiError("GitHub did not return the created pull request", created.status);
3055
3063
  return created.data;
3056
3064
  } catch (error) {
3057
- if (!(error instanceof GitHubApiError) || error.status !== 422) throw error;
3065
+ if (!(error instanceof GitHubApiError) || ![
3066
+ 0,
3067
+ 429,
3068
+ 500,
3069
+ 502,
3070
+ 503,
3071
+ 504,
3072
+ 505,
3073
+ 506,
3074
+ 507,
3075
+ 508,
3076
+ 509,
3077
+ 510,
3078
+ 511
3079
+ ].includes(error.status) && error.status !== 422) throw error;
3058
3080
  const recovered = await this.request("GET", `/pulls?${query.toString()}`);
3059
3081
  if (recovered.data?.[0]) return recovered.data[0];
3060
3082
  throw error;
@@ -3408,6 +3430,90 @@ async function exitPrerelease(options) {
3408
3430
  await runLane("main", options);
3409
3431
  }
3410
3432
  //#endregion
3433
+ //#region src/commands/release/reconcile.ts
3434
+ function remoteTagExists$1(tag, options) {
3435
+ return (options.spawn ?? spawnSync)("git", [
3436
+ "ls-remote",
3437
+ "--exit-code",
3438
+ "--refs",
3439
+ "origin",
3440
+ `refs/tags/${tag}`
3441
+ ], {
3442
+ cwd: options.cwd,
3443
+ encoding: "utf8",
3444
+ shell: false,
3445
+ stdio: "ignore"
3446
+ }).status === 0;
3447
+ }
3448
+ function resolveTarget$1(options) {
3449
+ return getReleaseEnv(options)["GITHUB_SHA"]?.trim() || capture("git", ["rev-parse", "HEAD"], options);
3450
+ }
3451
+ function isPublished(pkg, options) {
3452
+ const result = (options.spawn ?? spawnSync)("npm", [
3453
+ "view",
3454
+ `${pkg.name}@${pkg.version}`,
3455
+ "version"
3456
+ ], {
3457
+ cwd: options.cwd,
3458
+ encoding: "utf8",
3459
+ shell: false,
3460
+ stdio: [
3461
+ "ignore",
3462
+ "pipe",
3463
+ "ignore"
3464
+ ]
3465
+ });
3466
+ return result.status === 0 && String(result.stdout ?? "").trim() === pkg.version;
3467
+ }
3468
+ async function reconcileRelease(options) {
3469
+ const github = options.github ?? new GitHubClient();
3470
+ if (!github.listReleases || !github.ensureRelease) throw new Error("GitHub release reconcile requires listReleases and ensureRelease operations");
3471
+ const releases = await github.listReleases();
3472
+ const existing = new Map(releases.map((release) => [release.tag_name, release]));
3473
+ const packages = (await getWorkspacePackages(options.cwd)).flatMap(({ manifest }) => typeof manifest.name === "string" && typeof manifest.version === "string" ? [{
3474
+ name: manifest.name,
3475
+ version: manifest.version
3476
+ }] : []).filter((pkg) => (!options.packageName || pkg.name === options.packageName) && (!options.packageVersion || pkg.version === options.packageVersion)).filter((pkg) => isPublished(pkg, options));
3477
+ const env = getReleaseEnv(options);
3478
+ const metadata = {};
3479
+ if (env["GITHUB_REPOSITORY"]) metadata.repository = env["GITHUB_REPOSITORY"];
3480
+ if (env["GITHUB_SERVER_URL"]) metadata.serverUrl = env["GITHUB_SERVER_URL"];
3481
+ const document = await buildReleaseNoteDocument(options.cwd, void 0, metadata, new Set(packages.map((pkg) => pkg.name)));
3482
+ const repaired = [];
3483
+ const pending = [];
3484
+ for (const pkg of packages) {
3485
+ const tag = `${pkg.name}@${pkg.version}`;
3486
+ const release = existing.get(tag);
3487
+ const body = renderGitHubRelease({
3488
+ ...document,
3489
+ packages: document.packages.filter((item) => item.name === pkg.name && item.version === pkg.version),
3490
+ entries: document.entries.filter((entry) => entry.packageName === pkg.name && entry.version === pkg.version),
3491
+ compareUrls: document.compareUrls.filter((url) => url.includes(encodeURIComponent(`${pkg.name}@`)))
3492
+ });
3493
+ const needsTag = !remoteTagExists$1(tag, options);
3494
+ const needsRelease = !release || release.name !== tag || release.body !== body;
3495
+ if (!needsTag && !needsRelease) continue;
3496
+ pending.push(tag);
3497
+ if (options.dryRun) continue;
3498
+ if (needsTag && github.ensureTag) await github.ensureTag({
3499
+ tag,
3500
+ target: resolveTarget$1(options)
3501
+ });
3502
+ await github.ensureRelease({
3503
+ tag,
3504
+ target: resolveTarget$1(options),
3505
+ name: tag,
3506
+ body
3507
+ });
3508
+ repaired.push(tag);
3509
+ }
3510
+ return {
3511
+ repaired,
3512
+ pending,
3513
+ skipped: packages.filter((pkg) => !pending.includes(`${pkg.name}@${pkg.version}`)).map((pkg) => `${pkg.name}@${pkg.version}`)
3514
+ };
3515
+ }
3516
+ //#endregion
3411
3517
  //#region src/commands/release/stable.ts
3412
3518
  async function prepareStable(options) {
3413
3519
  const branch = resolveBranch(options);
@@ -3779,7 +3885,11 @@ async function releaseCi(options) {
3779
3885
  return packages;
3780
3886
  }
3781
3887
  if (mode === "publish-unpublished") return recoverUnpublished(options);
3782
- if (mode !== "auto") throw new ReleaseCommandError(`unknown release CI mode ${mode}; expected auto, prepare, publish, or publish-unpublished`);
3888
+ if (mode === "reconcile") return reconcileRelease({
3889
+ ...options,
3890
+ dryRun: options.dryRun ?? getReleaseEnv(options)["REPO_RELEASE_DRY_RUN"] === "true"
3891
+ });
3892
+ if (mode !== "auto") throw new ReleaseCommandError(`unknown release CI mode ${mode}; expected auto, prepare, publish, publish-unpublished, or reconcile`);
3783
3893
  const eventName = getReleaseEnv(options)["GITHUB_EVENT_NAME"]?.trim();
3784
3894
  if (eventName && eventName !== "workflow_dispatch") {
3785
3895
  if (!shouldRunRelease(await readReleaseTriggerContext(options))) {
@@ -4243,6 +4353,9 @@ const scriptsEntries = Object.entries({
4243
4353
  //#endregion
4244
4354
  //#region src/commands/upgrade/pkg-json.ts
4245
4355
  const NON_OVERRIDABLE_PREFIXES = ["workspace:", "catalog:"];
4356
+ function isCatalogSpecifier(version) {
4357
+ return version.startsWith("catalog:");
4358
+ }
4246
4359
  const legacyToolPackageName = "@icebreakers/monorepo";
4247
4360
  const legacyReleaseDependencies = ["@changesets/cli", "@icebreakers/changelog-github"];
4248
4361
  function parseVersion(input) {
@@ -4281,6 +4394,7 @@ function setPkgJson(sourcePkgJson, targetPkgJson, options) {
4281
4394
  if (packageManager && !targetPkgJson.packageManager) targetPkgJson.packageManager = packageManager;
4282
4395
  for (const [depName, depVersion] of Object.entries(sourceDeps)) {
4283
4396
  if (typeof depVersion !== "string") continue;
4397
+ if (isCatalogSpecifier(depVersion)) continue;
4284
4398
  const targetVersion = targetDeps[depName];
4285
4399
  if (hasNonOverridablePrefix(targetVersion)) continue;
4286
4400
  if (shouldAssignVersion(targetVersion, depVersion)) targetDeps[depName] = depVersion;
@@ -4288,6 +4402,7 @@ function setPkgJson(sourcePkgJson, targetPkgJson, options) {
4288
4402
  if (Object.keys(targetDeps).length) targetPkgJson.dependencies = targetDeps;
4289
4403
  for (const [depName, depVersion] of Object.entries(sourceDevDeps)) {
4290
4404
  if (typeof depVersion !== "string") continue;
4405
+ if (isCatalogSpecifier(depVersion)) continue;
4291
4406
  if (depName === "repoctl") {
4292
4407
  const nextVersion = `^${version$1}`;
4293
4408
  const targetVersion = targetDevDeps[depName];
@@ -4647,6 +4762,7 @@ var commands_exports = /* @__PURE__ */ __exportAll({
4647
4762
  parsePublishSummary: () => parsePublishSummary,
4648
4763
  prepareStable: () => prepareStable,
4649
4764
  publishStable: () => publishStable,
4765
+ reconcileRelease: () => reconcileRelease,
4650
4766
  recoverUnpublished: () => recoverUnpublished,
4651
4767
  releaseCi: () => releaseCi,
4652
4768
  releasePrerelease: () => releasePrerelease,
@@ -4668,4 +4784,4 @@ var commands_exports = /* @__PURE__ */ __exportAll({
4668
4784
  verifyStagedTypecheck: () => verifyStagedTypecheck
4669
4785
  });
4670
4786
  //#endregion
4671
- export { verifyPreCommit as $, getCreateChoices as A, isMatch as B, collectEnvInfo as C, runDoctor as D, collectEnvSupportBundle as E, cleanProjects as F, toPublishGitignorePath as G, getFileHash as H, getSkillTargetPaths as I, getKnownRepoCheckCommands as J, toWorkspaceGitignorePath as K, skillTargets as L, resolveCreateNewProjectPlan as M, templateMap as N, createNewProject as O, inspectMonorepoConfig as P, verifyCommitMsg as Q, syncSkills as R, createContext as S, collectEnvSnapshot as T, isFileChanged as U, setByPath as V, isGitignoreFile as W, resolveRecommendedCheckPlan as X, resolveFullWorkspaceCheckPlan as Y, runRecommendedCheck as Z, setVscodeBinaryMirror as _, createReleasePullRequest as a, generateAgenticTemplates as at, initTooling as b, prepareStable as c, enterPrerelease as d, verifyPrePush as et, exitPrerelease as f, parsePublishSummary as g, GitHubClient as h, repairReleaseNotes as i, generateAgenticTemplate as it, getTemplateMap as j, defaultTemplate as k, publishStable as l, GitHubApiError as m, upgradeMonorepo as n, createTimestampFolderName as nt, recoverUnpublished as o, loadAgenticTasks as ot, releasePrerelease as p, updateIssueTemplateConfig as q, checkTemplates as r, defaultAgenticBaseDir as rt, releaseCi as s, GitClient as st, commands_exports as t, verifyStagedTypecheck as tt, releaseStable as u, init as v, collectEnvPaths as w, normalizeInitToolingTargets as x, initMetadata as y, escapeStringRegexp as z };
4787
+ export { verifyCommitMsg as $, defaultTemplate as A, escapeStringRegexp as B, createContext as C, collectEnvSupportBundle as D, collectEnvSnapshot as E, inspectMonorepoConfig as F, isGitignoreFile as G, setByPath as H, cleanProjects as I, updateIssueTemplateConfig as J, toPublishGitignorePath as K, getSkillTargetPaths as L, getTemplateMap as M, resolveCreateNewProjectPlan as N, runDoctor as O, templateMap as P, runRecommendedCheck as Q, skillTargets as R, normalizeInitToolingTargets as S, collectEnvPaths as T, getFileHash as U, isMatch as V, isFileChanged as W, resolveFullWorkspaceCheckPlan as X, getKnownRepoCheckCommands as Y, resolveRecommendedCheckPlan as Z, parsePublishSummary as _, createReleasePullRequest as a, generateAgenticTemplate as at, initMetadata as b, prepareStable as c, GitClient as ct, reconcileRelease as d, verifyPreCommit as et, enterPrerelease as f, GitHubClient as g, GitHubApiError as h, repairReleaseNotes as i, defaultAgenticBaseDir as it, getCreateChoices as j, createNewProject as k, publishStable as l, releasePrerelease as m, upgradeMonorepo as n, verifyStagedTypecheck as nt, recoverUnpublished as o, generateAgenticTemplates as ot, exitPrerelease as p, toWorkspaceGitignorePath as q, checkTemplates as r, createTimestampFolderName as rt, releaseCi as s, loadAgenticTasks as st, commands_exports as t, verifyPrePush as tt, releaseStable as u, setVscodeBinaryMirror as v, collectEnvInfo as w, initTooling as x, init as y, syncSkills as z };
@@ -1,5 +1,5 @@
1
- import { A as getCreateChoices, M as resolveCreateNewProjectPlan, O as createNewProject, k as defaultTemplate } from "./commands-ChVgQ-MD.mjs";
2
- import { b as fs, d as localize, h as logger } from "./types-C-aVvG6i.mjs";
1
+ import { A as defaultTemplate, N as resolveCreateNewProjectPlan, j as getCreateChoices, k as createNewProject } from "./commands-CtYIB-DG.mjs";
2
+ import { m as logger, u as localize, y as fs } from "./types-B7zNkQpy.mjs";
3
3
  import { s as resolveCommandConfig } from "./config-p842Knhq.mjs";
4
4
  import path from "pathe";
5
5
  import process from "node:process";