@releasekit/version 0.2.0 → 0.2.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,13 +1,352 @@
1
1
  import {
2
- BaseVersionError
3
- } from "./chunk-GQLJ7JQY.js";
2
+ BaseVersionError,
3
+ ReleaseKitError
4
+ } from "./chunk-PVBHVUZB.js";
4
5
  import {
5
6
  execAsync,
6
7
  execSync
7
8
  } from "./chunk-LMPZV35Z.js";
8
9
 
9
- // src/config.ts
10
- import { loadConfig as loadReleaseKitConfig } from "@releasekit/config";
10
+ // ../config/dist/index.js
11
+ import * as fs from "fs";
12
+ import * as path from "path";
13
+ import * as TOML from "smol-toml";
14
+ import * as fs3 from "fs";
15
+ import * as path3 from "path";
16
+ import { z as z2 } from "zod";
17
+ import { z } from "zod";
18
+ import * as fs2 from "fs";
19
+ import * as os from "os";
20
+ import * as path2 from "path";
21
+ function parseCargoToml(cargoPath) {
22
+ const content = fs.readFileSync(cargoPath, "utf-8");
23
+ return TOML.parse(content);
24
+ }
25
+ function isCargoToml(filePath) {
26
+ return path.basename(filePath) === "Cargo.toml";
27
+ }
28
+ var ConfigError = class extends ReleaseKitError {
29
+ code = "CONFIG_ERROR";
30
+ suggestions;
31
+ constructor(message, suggestions) {
32
+ super(message);
33
+ this.suggestions = suggestions ?? [
34
+ "Check that releasekit.config.json exists and is valid JSON",
35
+ "Run with --verbose for more details"
36
+ ];
37
+ }
38
+ };
39
+ var MAX_JSONC_LENGTH = 1e5;
40
+ function parseJsonc(content) {
41
+ if (content.length > MAX_JSONC_LENGTH) {
42
+ throw new Error(`JSONC content too long: ${content.length} characters (max ${MAX_JSONC_LENGTH})`);
43
+ }
44
+ try {
45
+ return JSON.parse(content);
46
+ } catch {
47
+ const cleaned = content.replace(/\/\/[^\r\n]{0,10000}$/gm, "").replace(/\/\*[\s\S]{0,50000}?\*\//g, "").trim();
48
+ return JSON.parse(cleaned);
49
+ }
50
+ }
51
+ var GitConfigSchema = z.object({
52
+ remote: z.string().default("origin"),
53
+ branch: z.string().default("main"),
54
+ pushMethod: z.enum(["auto", "ssh", "https"]).default("auto"),
55
+ /**
56
+ * Optional env var name containing a GitHub token for HTTPS pushes.
57
+ * When set, publish steps can use this token without mutating git remotes.
58
+ */
59
+ httpsTokenEnv: z.string().optional(),
60
+ push: z.boolean().optional(),
61
+ skipHooks: z.boolean().optional()
62
+ });
63
+ var MonorepoConfigSchema = z.object({
64
+ mode: z.enum(["root", "packages", "both"]).optional(),
65
+ rootPath: z.string().optional(),
66
+ packagesPath: z.string().optional(),
67
+ mainPackage: z.string().optional()
68
+ });
69
+ var BranchPatternSchema = z.object({
70
+ pattern: z.string(),
71
+ releaseType: z.enum(["major", "minor", "patch", "prerelease"])
72
+ });
73
+ var VersionCargoConfigSchema = z.object({
74
+ enabled: z.boolean().default(true),
75
+ paths: z.array(z.string()).optional()
76
+ });
77
+ var VersionConfigSchema = z.object({
78
+ tagTemplate: z.string().default("v{version}"),
79
+ packageSpecificTags: z.boolean().default(false),
80
+ preset: z.string().default("conventional"),
81
+ sync: z.boolean().default(true),
82
+ packages: z.array(z.string()).default([]),
83
+ mainPackage: z.string().optional(),
84
+ updateInternalDependencies: z.enum(["major", "minor", "patch", "no-internal-update"]).default("minor"),
85
+ skip: z.array(z.string()).optional(),
86
+ commitMessage: z.string().optional(),
87
+ versionStrategy: z.enum(["branchPattern", "commitMessage"]).default("commitMessage"),
88
+ branchPatterns: z.array(BranchPatternSchema).optional(),
89
+ defaultReleaseType: z.enum(["major", "minor", "patch", "prerelease"]).optional(),
90
+ mismatchStrategy: z.enum(["error", "warn", "ignore", "prefer-package", "prefer-git"]).default("warn"),
91
+ versionPrefix: z.string().default(""),
92
+ prereleaseIdentifier: z.string().optional(),
93
+ strictReachable: z.boolean().default(false),
94
+ cargo: VersionCargoConfigSchema.optional()
95
+ });
96
+ var NpmConfigSchema = z.object({
97
+ enabled: z.boolean().default(true),
98
+ auth: z.enum(["auto", "oidc", "token"]).default("auto"),
99
+ provenance: z.boolean().default(true),
100
+ access: z.enum(["public", "restricted"]).default("public"),
101
+ registry: z.string().default("https://registry.npmjs.org"),
102
+ copyFiles: z.array(z.string()).default(["LICENSE"]),
103
+ tag: z.string().default("latest")
104
+ });
105
+ var CargoPublishConfigSchema = z.object({
106
+ enabled: z.boolean().default(false),
107
+ noVerify: z.boolean().default(false),
108
+ publishOrder: z.array(z.string()).default([]),
109
+ clean: z.boolean().default(false)
110
+ });
111
+ var PublishGitConfigSchema = z.object({
112
+ push: z.boolean().default(true),
113
+ pushMethod: z.enum(["auto", "ssh", "https"]).optional(),
114
+ remote: z.string().optional(),
115
+ branch: z.string().optional(),
116
+ httpsTokenEnv: z.string().optional(),
117
+ skipHooks: z.boolean().optional()
118
+ });
119
+ var GitHubReleaseConfigSchema = z.object({
120
+ enabled: z.boolean().default(true),
121
+ draft: z.boolean().default(true),
122
+ perPackage: z.boolean().default(true),
123
+ prerelease: z.union([z.literal("auto"), z.boolean()]).default("auto"),
124
+ /**
125
+ * Controls how release notes are sourced for GitHub releases.
126
+ * - 'auto': Use RELEASE_NOTES.md if it exists, then per-package changelog
127
+ * data from the version output, then GitHub's auto-generated notes.
128
+ * - 'github': Always use GitHub's auto-generated notes.
129
+ * - 'none': No notes body.
130
+ * - Any other string: Treated as a file path to read notes from.
131
+ */
132
+ releaseNotes: z.union([z.literal("auto"), z.literal("github"), z.literal("none"), z.string()]).default("auto")
133
+ });
134
+ var VerifyRegistryConfigSchema = z.object({
135
+ enabled: z.boolean().default(true),
136
+ maxAttempts: z.number().int().positive().default(5),
137
+ initialDelay: z.number().int().positive().default(15e3),
138
+ backoffMultiplier: z.number().positive().default(2)
139
+ });
140
+ var VerifyConfigSchema = z.object({
141
+ npm: VerifyRegistryConfigSchema.default({
142
+ enabled: true,
143
+ maxAttempts: 5,
144
+ initialDelay: 15e3,
145
+ backoffMultiplier: 2
146
+ }),
147
+ cargo: VerifyRegistryConfigSchema.default({
148
+ enabled: true,
149
+ maxAttempts: 10,
150
+ initialDelay: 3e4,
151
+ backoffMultiplier: 2
152
+ })
153
+ });
154
+ var PublishConfigSchema = z.object({
155
+ git: PublishGitConfigSchema.optional(),
156
+ npm: NpmConfigSchema.default({
157
+ enabled: true,
158
+ auth: "auto",
159
+ provenance: true,
160
+ access: "public",
161
+ registry: "https://registry.npmjs.org",
162
+ copyFiles: ["LICENSE"],
163
+ tag: "latest"
164
+ }),
165
+ cargo: CargoPublishConfigSchema.default({
166
+ enabled: false,
167
+ noVerify: false,
168
+ publishOrder: [],
169
+ clean: false
170
+ }),
171
+ githubRelease: GitHubReleaseConfigSchema.default({
172
+ enabled: true,
173
+ draft: true,
174
+ perPackage: true,
175
+ prerelease: "auto",
176
+ releaseNotes: "auto"
177
+ }),
178
+ verify: VerifyConfigSchema.default({
179
+ npm: {
180
+ enabled: true,
181
+ maxAttempts: 5,
182
+ initialDelay: 15e3,
183
+ backoffMultiplier: 2
184
+ },
185
+ cargo: {
186
+ enabled: true,
187
+ maxAttempts: 10,
188
+ initialDelay: 3e4,
189
+ backoffMultiplier: 2
190
+ }
191
+ })
192
+ });
193
+ var TemplateConfigSchema = z.object({
194
+ path: z.string().optional(),
195
+ engine: z.enum(["handlebars", "liquid", "ejs"]).optional()
196
+ });
197
+ var OutputConfigSchema = z.object({
198
+ format: z.enum(["markdown", "github-release", "json"]),
199
+ file: z.string().optional(),
200
+ options: z.record(z.string(), z.unknown()).optional(),
201
+ templates: TemplateConfigSchema.optional()
202
+ });
203
+ var LLMOptionsSchema = z.object({
204
+ timeout: z.number().optional(),
205
+ maxTokens: z.number().optional(),
206
+ temperature: z.number().optional()
207
+ });
208
+ var LLMRetryConfigSchema = z.object({
209
+ maxAttempts: z.number().int().positive().optional(),
210
+ initialDelay: z.number().nonnegative().optional(),
211
+ maxDelay: z.number().positive().optional(),
212
+ backoffFactor: z.number().positive().optional()
213
+ });
214
+ var LLMTasksConfigSchema = z.object({
215
+ summarize: z.boolean().optional(),
216
+ enhance: z.boolean().optional(),
217
+ categorize: z.boolean().optional(),
218
+ releaseNotes: z.boolean().optional()
219
+ });
220
+ var LLMCategorySchema = z.object({
221
+ name: z.string(),
222
+ description: z.string(),
223
+ scopes: z.array(z.string()).optional()
224
+ });
225
+ var ScopeRulesSchema = z.object({
226
+ allowed: z.array(z.string()).optional(),
227
+ caseSensitive: z.boolean().default(false),
228
+ invalidScopeAction: z.enum(["remove", "keep", "fallback"]).default("remove"),
229
+ fallbackScope: z.string().optional()
230
+ });
231
+ var ScopeConfigSchema = z.object({
232
+ mode: z.enum(["restricted", "packages", "none", "unrestricted"]).default("unrestricted"),
233
+ rules: ScopeRulesSchema.optional()
234
+ });
235
+ var LLMPromptOverridesSchema = z.object({
236
+ enhance: z.string().optional(),
237
+ categorize: z.string().optional(),
238
+ enhanceAndCategorize: z.string().optional(),
239
+ summarize: z.string().optional(),
240
+ releaseNotes: z.string().optional()
241
+ });
242
+ var LLMPromptsConfigSchema = z.object({
243
+ instructions: LLMPromptOverridesSchema.optional(),
244
+ templates: LLMPromptOverridesSchema.optional()
245
+ });
246
+ var LLMConfigSchema = z.object({
247
+ provider: z.string(),
248
+ model: z.string(),
249
+ baseURL: z.string().optional(),
250
+ apiKey: z.string().optional(),
251
+ options: LLMOptionsSchema.optional(),
252
+ concurrency: z.number().int().positive().optional(),
253
+ retry: LLMRetryConfigSchema.optional(),
254
+ tasks: LLMTasksConfigSchema.optional(),
255
+ categories: z.array(LLMCategorySchema).optional(),
256
+ style: z.string().optional(),
257
+ scopes: ScopeConfigSchema.optional(),
258
+ prompts: LLMPromptsConfigSchema.optional()
259
+ });
260
+ var NotesInputConfigSchema = z.object({
261
+ source: z.string().optional(),
262
+ file: z.string().optional()
263
+ });
264
+ var NotesConfigSchema = z.object({
265
+ input: NotesInputConfigSchema.optional(),
266
+ output: z.array(OutputConfigSchema).default([{ format: "markdown", file: "CHANGELOG.md" }]),
267
+ monorepo: MonorepoConfigSchema.optional(),
268
+ templates: TemplateConfigSchema.optional(),
269
+ llm: LLMConfigSchema.optional(),
270
+ updateStrategy: z.enum(["prepend", "regenerate"]).default("prepend")
271
+ });
272
+ var ReleaseKitConfigSchema = z.object({
273
+ git: GitConfigSchema.optional(),
274
+ monorepo: MonorepoConfigSchema.optional(),
275
+ version: VersionConfigSchema.optional(),
276
+ publish: PublishConfigSchema.optional(),
277
+ notes: NotesConfigSchema.optional()
278
+ });
279
+ var MAX_INPUT_LENGTH = 1e4;
280
+ function substituteVariables(value) {
281
+ if (value.length > MAX_INPUT_LENGTH) {
282
+ throw new Error(`Input too long: ${value.length} characters (max ${MAX_INPUT_LENGTH})`);
283
+ }
284
+ const envPattern = /\{env:([^}]{1,1000})\}/g;
285
+ const filePattern = /\{file:([^}]{1,1000})\}/g;
286
+ let result = value;
287
+ result = result.replace(envPattern, (_, varName) => {
288
+ return process.env[varName] ?? "";
289
+ });
290
+ result = result.replace(filePattern, (_, filePath) => {
291
+ const expandedPath = filePath.startsWith("~") ? path2.join(os.homedir(), filePath.slice(1)) : filePath;
292
+ try {
293
+ return fs2.readFileSync(expandedPath, "utf-8").trim();
294
+ } catch {
295
+ return "";
296
+ }
297
+ });
298
+ return result;
299
+ }
300
+ var SOLE_REFERENCE_PATTERN = /^\{(?:env|file):[^}]+\}$/;
301
+ function substituteInObject(obj) {
302
+ if (typeof obj === "string") {
303
+ const result = substituteVariables(obj);
304
+ if (result === "" && SOLE_REFERENCE_PATTERN.test(obj)) {
305
+ return void 0;
306
+ }
307
+ return result;
308
+ }
309
+ if (Array.isArray(obj)) {
310
+ return obj.map((item) => substituteInObject(item));
311
+ }
312
+ if (obj && typeof obj === "object") {
313
+ const result = {};
314
+ for (const [key, value] of Object.entries(obj)) {
315
+ result[key] = substituteInObject(value);
316
+ }
317
+ return result;
318
+ }
319
+ return obj;
320
+ }
321
+ var AUTH_DIR = path2.join(os.homedir(), ".config", "releasekit");
322
+ var AUTH_FILE = path2.join(AUTH_DIR, "auth.json");
323
+ var CONFIG_FILE = "releasekit.config.json";
324
+ function loadConfigFile(configPath) {
325
+ if (!fs3.existsSync(configPath)) {
326
+ return {};
327
+ }
328
+ try {
329
+ const content = fs3.readFileSync(configPath, "utf-8");
330
+ const parsed = parseJsonc(content);
331
+ const substituted = substituteInObject(parsed);
332
+ return ReleaseKitConfigSchema.parse(substituted);
333
+ } catch (error) {
334
+ if (error instanceof z2.ZodError) {
335
+ const issues = error.issues.map((i) => ` ${i.path.join(".")}: ${i.message}`).join("\n");
336
+ throw new ConfigError(`Config validation errors:
337
+ ${issues}`);
338
+ }
339
+ if (error instanceof SyntaxError) {
340
+ throw new ConfigError(`Invalid JSON in config file: ${error.message}`);
341
+ }
342
+ throw error;
343
+ }
344
+ }
345
+ function loadConfig(options) {
346
+ const cwd3 = options?.cwd ?? process.cwd();
347
+ const configPath = options?.configPath ?? path3.join(cwd3, CONFIG_FILE);
348
+ return loadConfigFile(configPath);
349
+ }
11
350
 
12
351
  // src/types.ts
13
352
  function toVersionConfig(config, gitConfig) {
@@ -20,8 +359,7 @@ function toVersionConfig(config, gitConfig) {
20
359
  packages: [],
21
360
  updateInternalDependencies: "minor",
22
361
  versionPrefix: "",
23
- baseBranch: gitConfig?.branch,
24
- skipHooks: gitConfig?.skipHooks
362
+ baseBranch: gitConfig?.branch
25
363
  };
26
364
  }
27
365
  return {
@@ -40,7 +378,6 @@ function toVersionConfig(config, gitConfig) {
40
378
  releaseType: bp.releaseType
41
379
  })),
42
380
  defaultReleaseType: config.defaultReleaseType,
43
- skipHooks: gitConfig?.skipHooks,
44
381
  mismatchStrategy: config.mismatchStrategy,
45
382
  versionPrefix: config.versionPrefix ?? "",
46
383
  prereleaseIdentifier: config.prereleaseIdentifier,
@@ -50,8 +387,8 @@ function toVersionConfig(config, gitConfig) {
50
387
  }
51
388
 
52
389
  // src/config.ts
53
- function loadConfig(options) {
54
- const fullConfig = loadReleaseKitConfig(options);
390
+ function loadConfig2(options) {
391
+ const fullConfig = loadConfig(options);
55
392
  return toVersionConfig(fullConfig.version, fullConfig.git);
56
393
  }
57
394
 
@@ -185,14 +522,11 @@ function log(message, level = "info") {
185
522
  default:
186
523
  chalkFn = chalk.blue;
187
524
  }
525
+ const formattedMessage = level === "debug" ? `[DEBUG] ${message}` : message;
188
526
  if (isJsonOutputMode()) {
189
- if (level === "error") {
190
- chalkFn(message);
191
- console.error(message);
192
- }
527
+ console.error(chalkFn(formattedMessage));
193
528
  return;
194
529
  }
195
- const formattedMessage = level === "debug" ? `[DEBUG] ${message}` : message;
196
530
  if (level === "error") {
197
531
  console.error(chalkFn(formattedMessage));
198
532
  } else {
@@ -206,24 +540,8 @@ import { Bumper } from "conventional-recommended-bump";
206
540
  import semver3 from "semver";
207
541
 
208
542
  // src/git/repository.ts
209
- import { existsSync, statSync } from "fs";
210
- import { join } from "path";
211
- function isGitRepository(directory) {
212
- const gitDir = join(directory, ".git");
213
- if (!existsSync(gitDir)) {
214
- return false;
215
- }
216
- const stats = statSync(gitDir);
217
- if (!stats.isDirectory()) {
218
- return false;
219
- }
220
- try {
221
- execSync("git", ["rev-parse", "--is-inside-work-tree"], { cwd: directory });
222
- return true;
223
- } catch (_error) {
224
- return false;
225
- }
226
- }
543
+ import { existsSync as existsSync3, statSync } from "fs";
544
+ import { join as join3 } from "path";
227
545
  function getCurrentBranch() {
228
546
  const result = execSync("git", ["rev-parse", "--abbrev-ref", "HEAD"]);
229
547
  return result.toString().trim();
@@ -476,16 +794,15 @@ async function getLatestTagForPackage(packageName, versionPrefix, options) {
476
794
  }
477
795
 
478
796
  // src/utils/manifestHelpers.ts
479
- import fs2 from "fs";
480
- import path2 from "path";
797
+ import fs5 from "fs";
798
+ import path5 from "path";
481
799
 
482
800
  // src/cargo/cargoHandler.ts
483
- import fs from "fs";
484
- import path from "path";
485
- import { isCargoToml, parseCargoToml } from "@releasekit/config";
486
- import * as TOML from "smol-toml";
801
+ import fs4 from "fs";
802
+ import path4 from "path";
803
+ import * as TOML2 from "smol-toml";
487
804
  function getCargoInfo(cargoPath) {
488
- if (!fs.existsSync(cargoPath)) {
805
+ if (!fs4.existsSync(cargoPath)) {
489
806
  log(`Cargo.toml file not found at: ${cargoPath}`, "error");
490
807
  throw new Error(`Cargo.toml file not found at: ${cargoPath}`);
491
808
  }
@@ -499,7 +816,7 @@ function getCargoInfo(cargoPath) {
499
816
  name: cargo.package.name,
500
817
  version: cargo.package.version || "0.0.0",
501
818
  path: cargoPath,
502
- dir: path.dirname(cargoPath),
819
+ dir: path4.dirname(cargoPath),
503
820
  content: cargo
504
821
  };
505
822
  } catch (error) {
@@ -524,8 +841,8 @@ function updateCargoVersion(cargoPath, version, dryRun = false) {
524
841
  } else {
525
842
  cargo.package.version = version;
526
843
  }
527
- const updatedContent = TOML.stringify(cargo);
528
- fs.writeFileSync(cargoPath, updatedContent);
844
+ const updatedContent = TOML2.stringify(cargo);
845
+ fs4.writeFileSync(cargoPath, updatedContent);
529
846
  }
530
847
  addPackageUpdate(packageName, version, cargoPath);
531
848
  log(`${dryRun ? "[DRY RUN] Would update" : "Updated"} Cargo.toml at ${cargoPath} to version ${version}`, "success");
@@ -540,11 +857,11 @@ function updateCargoVersion(cargoPath, version, dryRun = false) {
540
857
 
541
858
  // src/utils/manifestHelpers.ts
542
859
  function getVersionFromManifests(packageDir) {
543
- const packageJsonPath = path2.join(packageDir, "package.json");
544
- const cargoTomlPath = path2.join(packageDir, "Cargo.toml");
545
- if (fs2.existsSync(packageJsonPath)) {
860
+ const packageJsonPath = path5.join(packageDir, "package.json");
861
+ const cargoTomlPath = path5.join(packageDir, "Cargo.toml");
862
+ if (fs5.existsSync(packageJsonPath)) {
546
863
  try {
547
- const packageJson = JSON.parse(fs2.readFileSync(packageJsonPath, "utf-8"));
864
+ const packageJson = JSON.parse(fs5.readFileSync(packageJsonPath, "utf-8"));
548
865
  if (packageJson.version) {
549
866
  log(`Found version ${packageJson.version} in package.json`, "debug");
550
867
  return {
@@ -560,7 +877,7 @@ function getVersionFromManifests(packageDir) {
560
877
  log(`Error reading package.json: ${errMsg}`, "warning");
561
878
  }
562
879
  }
563
- if (fs2.existsSync(cargoTomlPath)) {
880
+ if (fs5.existsSync(cargoTomlPath)) {
564
881
  try {
565
882
  const cargoInfo = getCargoInfo(cargoTomlPath);
566
883
  if (cargoInfo.version) {
@@ -587,18 +904,17 @@ function getVersionFromManifests(packageDir) {
587
904
  }
588
905
 
589
906
  // src/utils/versionUtils.ts
590
- import fs3 from "fs";
591
- import { parseCargoToml as parseCargoToml2 } from "@releasekit/config";
907
+ import fs6 from "fs";
592
908
  import semver2 from "semver";
593
909
 
594
910
  // src/git/tagVerification.ts
595
- function verifyTag(tagName, cwd4) {
911
+ function verifyTag(tagName, cwd3) {
596
912
  if (!tagName || tagName.trim() === "") {
597
913
  return { exists: false, reachable: false, error: "Empty tag name" };
598
914
  }
599
915
  try {
600
916
  execSync("git", ["rev-parse", "--verify", tagName], {
601
- cwd: cwd4,
917
+ cwd: cwd3,
602
918
  stdio: "ignore"
603
919
  });
604
920
  return { exists: true, reachable: true };
@@ -695,11 +1011,11 @@ var VersionMismatchError = class extends Error {
695
1011
  this.name = "VersionMismatchError";
696
1012
  }
697
1013
  };
698
- async function getBestVersionSource(tagName, packageVersion, cwd4, mismatchStrategy = "error", strictReachable = false) {
1014
+ async function getBestVersionSource(tagName, packageVersion, cwd3, mismatchStrategy = "error", strictReachable = false) {
699
1015
  if (!tagName?.trim()) {
700
1016
  return packageVersion ? { source: "package", version: packageVersion, reason: "No git tag provided" } : { source: "initial", version: "0.1.0", reason: "No git tag or package version available" };
701
1017
  }
702
- const verification = verifyTag(tagName, cwd4);
1018
+ const verification = verifyTag(tagName, cwd3);
703
1019
  if (!verification.exists || !verification.reachable) {
704
1020
  if (strictReachable) {
705
1021
  throw new Error(
@@ -964,9 +1280,8 @@ async function calculateVersion(config, options) {
964
1280
  }
965
1281
 
966
1282
  // src/package/packageProcessor.ts
967
- import * as fs5 from "fs";
968
- import path4 from "path";
969
- import { exit } from "process";
1283
+ import * as fs8 from "fs";
1284
+ import path7 from "path";
970
1285
 
971
1286
  // src/changelog/commitParser.ts
972
1287
  var CONVENTIONAL_COMMIT_REGEX = /^(\w+)(?:\(([^)]+)\))?(!)?: (.+)(?:\n\n([\s\S]*))?/;
@@ -1140,168 +1455,6 @@ function extractIssueIds(body) {
1140
1455
  return issueIds;
1141
1456
  }
1142
1457
 
1143
- // src/git/commands.ts
1144
- import { cwd as cwd2 } from "process";
1145
-
1146
- // src/errors/gitError.ts
1147
- var GitError = class extends BaseVersionError {
1148
- };
1149
- function createGitError(code, details) {
1150
- const messages = {
1151
- ["NOT_GIT_REPO" /* NOT_GIT_REPO */]: "Not a git repository",
1152
- ["GIT_PROCESS_ERROR" /* GIT_PROCESS_ERROR */]: "Failed to create new version",
1153
- ["NO_FILES" /* NO_FILES */]: "No files specified for commit",
1154
- ["NO_COMMIT_MESSAGE" /* NO_COMMIT_MESSAGE */]: "Commit message is required",
1155
- ["GIT_ERROR" /* GIT_ERROR */]: "Git operation failed",
1156
- ["TAG_ALREADY_EXISTS" /* TAG_ALREADY_EXISTS */]: "Git tag already exists"
1157
- };
1158
- const suggestions = {
1159
- ["NOT_GIT_REPO" /* NOT_GIT_REPO */]: [
1160
- "Initialize git repository with: git init",
1161
- "Ensure you are in the correct directory"
1162
- ],
1163
- ["TAG_ALREADY_EXISTS" /* TAG_ALREADY_EXISTS */]: [
1164
- "Delete the existing tag: git tag -d <tag-name>",
1165
- "Use a different version by incrementing manually",
1166
- "Check if this version was already released"
1167
- ],
1168
- ["GIT_PROCESS_ERROR" /* GIT_PROCESS_ERROR */]: void 0,
1169
- ["NO_FILES" /* NO_FILES */]: void 0,
1170
- ["NO_COMMIT_MESSAGE" /* NO_COMMIT_MESSAGE */]: void 0,
1171
- ["GIT_ERROR" /* GIT_ERROR */]: void 0
1172
- };
1173
- const baseMessage = messages[code];
1174
- const fullMessage = details ? `${baseMessage}: ${details}` : baseMessage;
1175
- return new GitError(fullMessage, code, suggestions[code]);
1176
- }
1177
-
1178
- // src/git/commands.ts
1179
- async function gitAdd(files) {
1180
- return execAsync("git", ["add", ...files]);
1181
- }
1182
- async function gitCommit(options) {
1183
- const args = ["commit"];
1184
- if (options.amend) {
1185
- args.push("--amend");
1186
- }
1187
- if (options.author) {
1188
- args.push("--author", options.author);
1189
- }
1190
- if (options.date) {
1191
- args.push("--date", options.date);
1192
- }
1193
- if (options.skipHooks) {
1194
- args.push("--no-verify");
1195
- }
1196
- args.push("-m", options.message);
1197
- return execAsync("git", args);
1198
- }
1199
- async function createGitTag(options) {
1200
- const { tag, message = "" } = options;
1201
- const args = ["tag", "-a", "-m", message, tag];
1202
- try {
1203
- return await execAsync("git", args);
1204
- } catch (error) {
1205
- const errorMessage = error instanceof Error ? error.message : String(error);
1206
- if (errorMessage.includes("already exists")) {
1207
- throw createGitError(
1208
- "TAG_ALREADY_EXISTS" /* TAG_ALREADY_EXISTS */,
1209
- `Tag '${tag}' already exists in the repository. Please use a different version or delete the existing tag first.`
1210
- );
1211
- }
1212
- throw createGitError("GIT_ERROR" /* GIT_ERROR */, errorMessage);
1213
- }
1214
- }
1215
- async function gitProcess(options) {
1216
- const { files, nextTag, commitMessage, skipHooks, dryRun } = options;
1217
- if (!isGitRepository(cwd2())) {
1218
- throw createGitError("NOT_GIT_REPO" /* NOT_GIT_REPO */);
1219
- }
1220
- try {
1221
- if (!dryRun) {
1222
- await gitAdd(files);
1223
- await gitCommit({
1224
- message: commitMessage,
1225
- skipHooks
1226
- });
1227
- if (nextTag) {
1228
- const tagMessage = `New Version ${nextTag} generated at ${(/* @__PURE__ */ new Date()).toISOString()}`;
1229
- await createGitTag({
1230
- tag: nextTag,
1231
- message: tagMessage
1232
- });
1233
- }
1234
- } else {
1235
- log("[DRY RUN] Would add files:", "info");
1236
- for (const file of files) {
1237
- log(` - ${file}`, "info");
1238
- }
1239
- log(`[DRY RUN] Would commit with message: "${commitMessage}"`, "info");
1240
- if (nextTag) {
1241
- log(`[DRY RUN] Would create tag: ${nextTag}`, "info");
1242
- }
1243
- }
1244
- } catch (err) {
1245
- const errorMessage = err instanceof Error ? err.message : String(err);
1246
- if (errorMessage.includes("already exists") && nextTag) {
1247
- log(`Tag '${nextTag}' already exists in the repository.`, "error");
1248
- throw createGitError(
1249
- "TAG_ALREADY_EXISTS" /* TAG_ALREADY_EXISTS */,
1250
- `Tag '${nextTag}' already exists in the repository. Please use a different version or delete the existing tag first.`
1251
- );
1252
- }
1253
- log(`Git process error: ${errorMessage}`, "error");
1254
- if (err instanceof Error && err.stack) {
1255
- console.error("Git process stack trace:");
1256
- console.error(err.stack);
1257
- }
1258
- throw createGitError("GIT_PROCESS_ERROR" /* GIT_PROCESS_ERROR */, errorMessage);
1259
- }
1260
- }
1261
- async function createGitCommitAndTag(files, nextTag, commitMessage, skipHooks, dryRun) {
1262
- try {
1263
- if (!files || files.length === 0) {
1264
- throw createGitError("NO_FILES" /* NO_FILES */);
1265
- }
1266
- if (!commitMessage) {
1267
- throw createGitError("NO_COMMIT_MESSAGE" /* NO_COMMIT_MESSAGE */);
1268
- }
1269
- setCommitMessage(commitMessage);
1270
- if (nextTag) {
1271
- addTag(nextTag);
1272
- }
1273
- await gitProcess({
1274
- files,
1275
- nextTag,
1276
- commitMessage,
1277
- skipHooks,
1278
- dryRun
1279
- });
1280
- if (!dryRun) {
1281
- log(`Created tag: ${nextTag}`, "success");
1282
- }
1283
- } catch (error) {
1284
- if (error instanceof GitError) {
1285
- throw error;
1286
- }
1287
- const errorMessage = error instanceof Error ? error.message : String(error);
1288
- log(`Failed to create git commit and tag: ${errorMessage}`, "error");
1289
- if (error instanceof Error) {
1290
- console.error("Git operation error details:");
1291
- console.error(error.stack || error.message);
1292
- if (errorMessage.includes("Command failed:")) {
1293
- const cmdOutput = errorMessage.split("Command failed:")[1];
1294
- if (cmdOutput) {
1295
- console.error("Git command output:", cmdOutput.trim());
1296
- }
1297
- }
1298
- } else {
1299
- console.error("Unknown git error:", error);
1300
- }
1301
- throw new GitError(`Git operation failed: ${errorMessage}`, "GIT_ERROR" /* GIT_ERROR */);
1302
- }
1303
- }
1304
-
1305
1458
  // src/utils/packageMatching.ts
1306
1459
  import micromatch from "micromatch";
1307
1460
  function matchesPackageTarget(packageName, target) {
@@ -1336,20 +1489,20 @@ function shouldProcessPackage(packageName, skip = []) {
1336
1489
  }
1337
1490
 
1338
1491
  // src/package/packageManagement.ts
1339
- import fs4 from "fs";
1340
- import path3 from "path";
1492
+ import fs7 from "fs";
1493
+ import path6 from "path";
1341
1494
  function updatePackageVersion(packagePath, version, dryRun = false) {
1342
1495
  if (isCargoToml(packagePath)) {
1343
1496
  updateCargoVersion(packagePath, version, dryRun);
1344
1497
  return;
1345
1498
  }
1346
1499
  try {
1347
- const packageContent = fs4.readFileSync(packagePath, "utf8");
1500
+ const packageContent = fs7.readFileSync(packagePath, "utf8");
1348
1501
  const packageJson = JSON.parse(packageContent);
1349
1502
  const packageName = packageJson.name;
1350
1503
  if (!dryRun) {
1351
1504
  packageJson.version = version;
1352
- fs4.writeFileSync(packagePath, `${JSON.stringify(packageJson, null, 2)}
1505
+ fs7.writeFileSync(packagePath, `${JSON.stringify(packageJson, null, 2)}
1353
1506
  `);
1354
1507
  }
1355
1508
  addPackageUpdate(packageName, version, packagePath);
@@ -1373,7 +1526,6 @@ var PackageProcessor = class {
1373
1526
  tagTemplate;
1374
1527
  commitMessageTemplate;
1375
1528
  dryRun;
1376
- skipHooks;
1377
1529
  getLatestTag;
1378
1530
  config;
1379
1531
  // Config for version calculation
@@ -1384,7 +1536,6 @@ var PackageProcessor = class {
1384
1536
  this.tagTemplate = options.tagTemplate;
1385
1537
  this.commitMessageTemplate = options.commitMessageTemplate || "";
1386
1538
  this.dryRun = options.dryRun || false;
1387
- this.skipHooks = options.skipHooks || false;
1388
1539
  this.getLatestTag = options.getLatestTag;
1389
1540
  this.config = options.config;
1390
1541
  this.fullConfig = options.fullConfig;
@@ -1519,9 +1670,9 @@ var PackageProcessor = class {
1519
1670
  }
1520
1671
  let repoUrl;
1521
1672
  try {
1522
- const packageJsonPath2 = path4.join(pkgPath, "package.json");
1523
- if (fs5.existsSync(packageJsonPath2)) {
1524
- const packageJson = JSON.parse(fs5.readFileSync(packageJsonPath2, "utf8"));
1673
+ const packageJsonPath2 = path7.join(pkgPath, "package.json");
1674
+ if (fs8.existsSync(packageJsonPath2)) {
1675
+ const packageJson = JSON.parse(fs8.readFileSync(packageJsonPath2, "utf8"));
1525
1676
  if (packageJson.repository) {
1526
1677
  if (typeof packageJson.repository === "string") {
1527
1678
  repoUrl = packageJson.repository;
@@ -1547,8 +1698,8 @@ var PackageProcessor = class {
1547
1698
  repoUrl: repoUrl || null,
1548
1699
  entries: changelogEntries
1549
1700
  });
1550
- const packageJsonPath = path4.join(pkgPath, "package.json");
1551
- if (fs5.existsSync(packageJsonPath)) {
1701
+ const packageJsonPath = path7.join(pkgPath, "package.json");
1702
+ if (fs8.existsSync(packageJsonPath)) {
1552
1703
  updatePackageVersion(packageJsonPath, nextVersion, this.dryRun);
1553
1704
  }
1554
1705
  const cargoEnabled = this.fullConfig.cargo?.enabled !== false;
@@ -1558,9 +1709,9 @@ var PackageProcessor = class {
1558
1709
  log(`Cargo paths config for ${name}: ${JSON.stringify(cargoPaths)}`, "debug");
1559
1710
  if (cargoPaths && cargoPaths.length > 0) {
1560
1711
  for (const cargoPath of cargoPaths) {
1561
- const resolvedCargoPath = path4.resolve(pkgPath, cargoPath, "Cargo.toml");
1712
+ const resolvedCargoPath = path7.resolve(pkgPath, cargoPath, "Cargo.toml");
1562
1713
  log(`Checking cargo path for ${name}: ${resolvedCargoPath}`, "debug");
1563
- if (fs5.existsSync(resolvedCargoPath)) {
1714
+ if (fs8.existsSync(resolvedCargoPath)) {
1564
1715
  log(`Found Cargo.toml for ${name} at ${resolvedCargoPath}, updating...`, "debug");
1565
1716
  updatePackageVersion(resolvedCargoPath, nextVersion, this.dryRun);
1566
1717
  } else {
@@ -1568,9 +1719,9 @@ var PackageProcessor = class {
1568
1719
  }
1569
1720
  }
1570
1721
  } else {
1571
- const cargoTomlPath = path4.join(pkgPath, "Cargo.toml");
1722
+ const cargoTomlPath = path7.join(pkgPath, "Cargo.toml");
1572
1723
  log(`Checking default cargo path for ${name}: ${cargoTomlPath}`, "debug");
1573
- if (fs5.existsSync(cargoTomlPath)) {
1724
+ if (fs8.existsSync(cargoTomlPath)) {
1574
1725
  log(`Found Cargo.toml for ${name} at ${cargoTomlPath}, updating...`, "debug");
1575
1726
  updatePackageVersion(cargoTomlPath, nextVersion, this.dryRun);
1576
1727
  } else {
@@ -1587,19 +1738,12 @@ var PackageProcessor = class {
1587
1738
  this.tagTemplate,
1588
1739
  this.fullConfig.packageSpecificTags
1589
1740
  );
1590
- const tagMessage = `chore(release): ${name} ${nextVersion}`;
1591
1741
  addTag(packageTag);
1592
1742
  tags.push(packageTag);
1593
- if (!this.dryRun) {
1594
- try {
1595
- await createGitTag({ tag: packageTag, message: tagMessage });
1596
- log(`Created tag: ${packageTag}`, "success");
1597
- } catch (tagError) {
1598
- log(`Failed to create tag ${packageTag} for ${name}: ${tagError.message}`, "error");
1599
- log(tagError.stack || "No stack trace available", "error");
1600
- }
1601
- } else {
1743
+ if (this.dryRun) {
1602
1744
  log(`[DRY RUN] Would create tag: ${packageTag}`, "info");
1745
+ } else {
1746
+ log(`Version ${nextVersion} prepared (tag: ${packageTag})`, "success");
1603
1747
  }
1604
1748
  updatedPackagesInfo.push({ name, version: nextVersion, path: pkgPath });
1605
1749
  }
@@ -1607,30 +1751,6 @@ var PackageProcessor = class {
1607
1751
  log("No packages required a version update.", "info");
1608
1752
  return { updatedPackages: [], tags };
1609
1753
  }
1610
- const filesToCommit = [];
1611
- for (const info of updatedPackagesInfo) {
1612
- const packageJsonPath = path4.join(info.path, "package.json");
1613
- if (fs5.existsSync(packageJsonPath)) {
1614
- filesToCommit.push(packageJsonPath);
1615
- }
1616
- const cargoEnabled = this.fullConfig.cargo?.enabled !== false;
1617
- if (cargoEnabled) {
1618
- const cargoPaths = this.fullConfig.cargo?.paths;
1619
- if (cargoPaths && cargoPaths.length > 0) {
1620
- for (const cargoPath of cargoPaths) {
1621
- const resolvedCargoPath = path4.resolve(info.path, cargoPath, "Cargo.toml");
1622
- if (fs5.existsSync(resolvedCargoPath)) {
1623
- filesToCommit.push(resolvedCargoPath);
1624
- }
1625
- }
1626
- } else {
1627
- const cargoTomlPath = path4.join(info.path, "Cargo.toml");
1628
- if (fs5.existsSync(cargoTomlPath)) {
1629
- filesToCommit.push(cargoTomlPath);
1630
- }
1631
- }
1632
- }
1633
- }
1634
1754
  const packageNames = updatedPackagesInfo.map((p) => p.name).join(", ");
1635
1755
  const representativeVersion = updatedPackagesInfo[0]?.version || "multiple";
1636
1756
  let commitMessage = this.commitMessageTemplate || "chore(release): publish packages";
@@ -1647,21 +1767,7 @@ var PackageProcessor = class {
1647
1767
  commitMessage = `chore(release): ${packageNames} ${representativeVersion}`;
1648
1768
  }
1649
1769
  setCommitMessage(commitMessage);
1650
- if (!this.dryRun) {
1651
- try {
1652
- await gitAdd(filesToCommit);
1653
- await gitCommit({ message: commitMessage, skipHooks: this.skipHooks });
1654
- log(`Created commit for targeted release: ${packageNames}`, "success");
1655
- } catch (commitError) {
1656
- log("Failed to create commit for targeted release.", "error");
1657
- console.error(commitError);
1658
- exit(1);
1659
- }
1660
- } else {
1661
- log("[DRY RUN] Would add files:", "info");
1662
- for (const file of filesToCommit) {
1663
- log(` - ${file}`, "info");
1664
- }
1770
+ if (this.dryRun) {
1665
1771
  log(`[DRY RUN] Would commit with message: "${commitMessage}"`, "info");
1666
1772
  }
1667
1773
  return {
@@ -1673,8 +1779,8 @@ var PackageProcessor = class {
1673
1779
  };
1674
1780
 
1675
1781
  // src/core/versionStrategies.ts
1676
- import fs6 from "fs";
1677
- import * as path5 from "path";
1782
+ import fs9 from "fs";
1783
+ import * as path8 from "path";
1678
1784
  function shouldProcessPackage2(pkg, config) {
1679
1785
  const pkgName = pkg.packageJson.name;
1680
1786
  return shouldProcessPackage(pkgName, config.skip);
@@ -1688,15 +1794,15 @@ function updateCargoFiles(packageDir, version, cargoConfig, dryRun = false) {
1688
1794
  const cargoPaths = cargoConfig?.paths;
1689
1795
  if (cargoPaths && cargoPaths.length > 0) {
1690
1796
  for (const cargoPath of cargoPaths) {
1691
- const resolvedCargoPath = path5.resolve(packageDir, cargoPath, "Cargo.toml");
1692
- if (fs6.existsSync(resolvedCargoPath)) {
1797
+ const resolvedCargoPath = path8.resolve(packageDir, cargoPath, "Cargo.toml");
1798
+ if (fs9.existsSync(resolvedCargoPath)) {
1693
1799
  updatePackageVersion(resolvedCargoPath, version, dryRun);
1694
1800
  updatedFiles.push(resolvedCargoPath);
1695
1801
  }
1696
1802
  }
1697
1803
  } else {
1698
- const cargoTomlPath = path5.join(packageDir, "Cargo.toml");
1699
- if (fs6.existsSync(cargoTomlPath)) {
1804
+ const cargoTomlPath = path8.join(packageDir, "Cargo.toml");
1805
+ if (fs9.existsSync(cargoTomlPath)) {
1700
1806
  updatePackageVersion(cargoTomlPath, version, dryRun);
1701
1807
  updatedFiles.push(cargoTomlPath);
1702
1808
  }
@@ -1714,7 +1820,6 @@ function createSyncStrategy(config) {
1714
1820
  commitMessage = `chore(release): v\${version}`,
1715
1821
  prereleaseIdentifier,
1716
1822
  dryRun,
1717
- skipHooks,
1718
1823
  mainPackage
1719
1824
  } = config;
1720
1825
  const formattedPrefix = formatVersionPrefix(versionPrefix || "v");
@@ -1767,8 +1872,8 @@ function createSyncStrategy(config) {
1767
1872
  const processedPaths = /* @__PURE__ */ new Set();
1768
1873
  try {
1769
1874
  if (packages.root) {
1770
- const rootPkgPath = path5.join(packages.root, "package.json");
1771
- if (fs6.existsSync(rootPkgPath)) {
1875
+ const rootPkgPath = path8.join(packages.root, "package.json");
1876
+ if (fs9.existsSync(rootPkgPath)) {
1772
1877
  updatePackageVersion(rootPkgPath, nextVersion, dryRun);
1773
1878
  files.push(rootPkgPath);
1774
1879
  updatedPackages.push("root");
@@ -1787,7 +1892,7 @@ function createSyncStrategy(config) {
1787
1892
  if (!shouldProcessPackage2(pkg, config)) {
1788
1893
  continue;
1789
1894
  }
1790
- const packageJsonPath = path5.join(pkg.dir, "package.json");
1895
+ const packageJsonPath = path8.join(pkg.dir, "package.json");
1791
1896
  if (processedPaths.has(packageJsonPath)) {
1792
1897
  continue;
1793
1898
  }
@@ -1864,7 +1969,13 @@ function createSyncStrategy(config) {
1864
1969
  config.packageSpecificTags || false
1865
1970
  );
1866
1971
  const formattedCommitMessage = formatCommitMessage(commitMessage, nextVersion, commitPackageName, void 0);
1867
- await createGitCommitAndTag(files, nextTag, formattedCommitMessage, skipHooks, dryRun);
1972
+ addTag(nextTag);
1973
+ setCommitMessage(formattedCommitMessage);
1974
+ if (!dryRun) {
1975
+ log(`Version ${nextVersion} prepared (tag: ${nextTag})`, "success");
1976
+ } else {
1977
+ log(`Would create tag: ${nextTag}`, "info");
1978
+ }
1868
1979
  } catch (error) {
1869
1980
  if (BaseVersionError.isVersionError(error)) {
1870
1981
  log(`Synced Strategy failed: ${error.message} (${error.code})`, "error");
@@ -1879,14 +1990,7 @@ function createSyncStrategy(config) {
1879
1990
  function createSingleStrategy(config) {
1880
1991
  return async (packages) => {
1881
1992
  try {
1882
- const {
1883
- mainPackage,
1884
- versionPrefix,
1885
- tagTemplate,
1886
- commitMessage = `chore(release): \${version}`,
1887
- dryRun,
1888
- skipHooks
1889
- } = config;
1993
+ const { mainPackage, versionPrefix, tagTemplate, commitMessage = `chore(release): \${version}`, dryRun } = config;
1890
1994
  let packageName;
1891
1995
  if (mainPackage) {
1892
1996
  packageName = mainPackage;
@@ -1970,9 +2074,9 @@ function createSingleStrategy(config) {
1970
2074
  }
1971
2075
  let repoUrl;
1972
2076
  try {
1973
- const packageJsonPath2 = path5.join(pkgPath, "package.json");
1974
- if (fs6.existsSync(packageJsonPath2)) {
1975
- const packageJson = JSON.parse(fs6.readFileSync(packageJsonPath2, "utf8"));
2077
+ const packageJsonPath2 = path8.join(pkgPath, "package.json");
2078
+ if (fs9.existsSync(packageJsonPath2)) {
2079
+ const packageJson = JSON.parse(fs9.readFileSync(packageJsonPath2, "utf8"));
1976
2080
  if (packageJson.repository) {
1977
2081
  if (typeof packageJson.repository === "string") {
1978
2082
  repoUrl = packageJson.repository;
@@ -1998,7 +2102,7 @@ function createSingleStrategy(config) {
1998
2102
  repoUrl: repoUrl || null,
1999
2103
  entries: changelogEntries
2000
2104
  });
2001
- const packageJsonPath = path5.join(pkgPath, "package.json");
2105
+ const packageJsonPath = path8.join(pkgPath, "package.json");
2002
2106
  updatePackageVersion(packageJsonPath, nextVersion, dryRun);
2003
2107
  const filesToCommit = [packageJsonPath];
2004
2108
  const cargoFiles = updateCargoFiles(pkgPath, nextVersion, config.cargo, dryRun);
@@ -2006,9 +2110,10 @@ function createSingleStrategy(config) {
2006
2110
  log(`Updated package ${packageName} to version ${nextVersion}`, "success");
2007
2111
  const tagName = formatTag(nextVersion, formattedPrefix, packageName, tagTemplate, config.packageSpecificTags);
2008
2112
  const commitMsg = formatCommitMessage(commitMessage, nextVersion, packageName);
2113
+ addTag(tagName);
2114
+ setCommitMessage(commitMsg);
2009
2115
  if (!dryRun) {
2010
- await createGitCommitAndTag(filesToCommit, tagName, commitMsg, skipHooks, dryRun);
2011
- log(`Created tag: ${tagName}`, "success");
2116
+ log(`Version ${nextVersion} prepared (tag: ${tagName})`, "success");
2012
2117
  } else {
2013
2118
  log(`Would create tag: ${tagName}`, "info");
2014
2119
  }
@@ -2033,7 +2138,6 @@ function createAsyncStrategy(config) {
2033
2138
  tagTemplate: config.tagTemplate,
2034
2139
  commitMessageTemplate: config.commitMessage || "",
2035
2140
  dryRun: config.dryRun || false,
2036
- skipHooks: config.skipHooks || false,
2037
2141
  getLatestTag: dependencies.getLatestTag,
2038
2142
  fullConfig: config,
2039
2143
  // Extract common version configuration properties
@@ -2096,11 +2200,15 @@ function createStrategyMap(config) {
2096
2200
  }
2097
2201
 
2098
2202
  // src/core/versionEngine.ts
2099
- import { cwd as cwd3 } from "process";
2203
+ import { cwd as cwd2 } from "process";
2100
2204
  import { getPackagesSync } from "@manypkg/get-packages";
2101
2205
 
2206
+ // src/errors/gitError.ts
2207
+ var GitError = class extends BaseVersionError {
2208
+ };
2209
+
2102
2210
  // src/utils/packageFiltering.ts
2103
- import path6 from "path";
2211
+ import path9 from "path";
2104
2212
  import micromatch2 from "micromatch";
2105
2213
  function filterPackagesByConfig(packages, configTargets, workspaceRoot) {
2106
2214
  if (configTargets.length === 0) {
@@ -2126,7 +2234,7 @@ function filterByDirectoryPattern(packages, pattern, workspaceRoot) {
2126
2234
  }
2127
2235
  const normalizedPattern = pattern.replace(/\\/g, "/");
2128
2236
  return packages.filter((pkg) => {
2129
- const relativePath = path6.relative(workspaceRoot, pkg.dir);
2237
+ const relativePath = path9.relative(workspaceRoot, pkg.dir);
2130
2238
  const normalizedRelativePath = relativePath.replace(/\\/g, "/");
2131
2239
  if (normalizedPattern === normalizedRelativePath) {
2132
2240
  return true;
@@ -2204,13 +2312,13 @@ var VersionEngine = class {
2204
2312
  if (this.workspaceCache) {
2205
2313
  return this.workspaceCache;
2206
2314
  }
2207
- const pkgsResult = getPackagesSync(cwd3());
2315
+ const pkgsResult = getPackagesSync(cwd2());
2208
2316
  if (!pkgsResult || !pkgsResult.packages) {
2209
2317
  throw createVersionError("PACKAGES_NOT_FOUND" /* PACKAGES_NOT_FOUND */);
2210
2318
  }
2211
2319
  if (!pkgsResult.root) {
2212
2320
  log("Root path is undefined in packages result, setting to current working directory", "warning");
2213
- pkgsResult.root = cwd3();
2321
+ pkgsResult.root = cwd2();
2214
2322
  }
2215
2323
  if (this.config.packages && this.config.packages.length > 0) {
2216
2324
  const originalCount = pkgsResult.packages.length;
@@ -2274,7 +2382,7 @@ var VersionEngine = class {
2274
2382
  };
2275
2383
 
2276
2384
  export {
2277
- loadConfig,
2385
+ loadConfig2 as loadConfig,
2278
2386
  VersionErrorCode,
2279
2387
  createVersionError,
2280
2388
  enableJsonOutput,