@releasekit/version 0.7.46 → 0.7.47

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 {
2
2
  BaseVersionError
3
- } from "./chunk-3FG6RVHS.js";
3
+ } from "./chunk-Q3FHZORY.js";
4
4
  export {
5
5
  BaseVersionError
6
6
  };
@@ -0,0 +1,89 @@
1
+ // ../core/dist/index.js
2
+ import * as fs from "fs";
3
+ import * as path from "path";
4
+ import { fileURLToPath } from "url";
5
+ import chalk from "chalk";
6
+ function readPackageVersion(importMetaUrl) {
7
+ try {
8
+ const dir = path.dirname(fileURLToPath(importMetaUrl));
9
+ const packageJsonPath = path.resolve(dir, "../package.json");
10
+ const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf-8"));
11
+ return packageJson.version ?? "0.0.0";
12
+ } catch {
13
+ return "0.0.0";
14
+ }
15
+ }
16
+ var LOG_LEVELS = {
17
+ error: 0,
18
+ warn: 1,
19
+ info: 2,
20
+ debug: 3,
21
+ trace: 4
22
+ };
23
+ var PREFIXES = {
24
+ error: "[ERROR]",
25
+ warn: "[WARN]",
26
+ info: "[INFO]",
27
+ debug: "[DEBUG]",
28
+ trace: "[TRACE]"
29
+ };
30
+ var COLORS = {
31
+ error: chalk.red,
32
+ warn: chalk.yellow,
33
+ info: chalk.blue,
34
+ debug: chalk.gray,
35
+ trace: chalk.dim
36
+ };
37
+ var currentLevel = "info";
38
+ var quietMode = false;
39
+ function shouldLog(level) {
40
+ if (quietMode && level !== "error") return false;
41
+ return LOG_LEVELS[level] <= LOG_LEVELS[currentLevel];
42
+ }
43
+ function log(message, level = "info") {
44
+ if (!shouldLog(level)) return;
45
+ const formatted = COLORS[level](`${PREFIXES[level]} ${message}`);
46
+ console.error(formatted);
47
+ }
48
+ var ReleaseKitError = class _ReleaseKitError extends Error {
49
+ constructor(message) {
50
+ super(message);
51
+ this.name = this.constructor.name;
52
+ }
53
+ logError() {
54
+ log(this.message, "error");
55
+ if (this.suggestions.length > 0) {
56
+ log("\nSuggested solutions:", "info");
57
+ for (const [i, suggestion] of this.suggestions.entries()) {
58
+ log(`${i + 1}. ${suggestion}`, "info");
59
+ }
60
+ }
61
+ }
62
+ static isReleaseKitError(error2) {
63
+ return error2 instanceof _ReleaseKitError;
64
+ }
65
+ };
66
+ function sanitizePackageName(name) {
67
+ return name.startsWith("@") ? name.slice(1).replace(/\//g, "-") : name;
68
+ }
69
+
70
+ // src/errors/baseError.ts
71
+ var BaseVersionError = class _BaseVersionError extends ReleaseKitError {
72
+ code;
73
+ suggestions;
74
+ constructor(message, code, suggestions) {
75
+ super(message);
76
+ this.code = code;
77
+ this.suggestions = suggestions ?? [];
78
+ }
79
+ static isVersionError(error) {
80
+ return error instanceof _BaseVersionError;
81
+ }
82
+ };
83
+
84
+ export {
85
+ readPackageVersion,
86
+ ReleaseKitError,
87
+ sanitizePackageName,
88
+ BaseVersionError
89
+ };
@@ -1,13 +1,413 @@
1
1
  import {
2
- BaseVersionError
3
- } from "./chunk-3FG6RVHS.js";
2
+ BaseVersionError,
3
+ ReleaseKitError,
4
+ sanitizePackageName
5
+ } from "./chunk-Q3FHZORY.js";
4
6
  import {
5
7
  execAsync,
6
8
  execSync
7
9
  } from "./chunk-LMPZV35Z.js";
8
10
 
9
- // src/config.ts
10
- import { loadConfig as loadReleaseKitConfig } from "@releasekit/config";
11
+ // ../config/dist/index.js
12
+ import * as fs from "fs";
13
+ import * as path from "path";
14
+ import * as TOML from "smol-toml";
15
+ import * as fs3 from "fs";
16
+ import * as path3 from "path";
17
+ import { z as z2 } from "zod";
18
+ import { z } from "zod";
19
+ import * as fs2 from "fs";
20
+ import * as os from "os";
21
+ import * as path2 from "path";
22
+ function parseCargoToml(cargoPath) {
23
+ const content = fs.readFileSync(cargoPath, "utf-8");
24
+ return TOML.parse(content);
25
+ }
26
+ function isCargoToml(filePath) {
27
+ return path.basename(filePath) === "Cargo.toml";
28
+ }
29
+ var ConfigError = class extends ReleaseKitError {
30
+ code = "CONFIG_ERROR";
31
+ suggestions;
32
+ constructor(message, suggestions) {
33
+ super(message);
34
+ this.suggestions = suggestions ?? [
35
+ "Check that releasekit.config.json exists and is valid JSON",
36
+ "Run with --verbose for more details"
37
+ ];
38
+ }
39
+ };
40
+ var MAX_JSONC_LENGTH = 1e5;
41
+ function parseJsonc(content) {
42
+ if (content.length > MAX_JSONC_LENGTH) {
43
+ throw new Error(`JSONC content too long: ${content.length} characters (max ${MAX_JSONC_LENGTH})`);
44
+ }
45
+ try {
46
+ return JSON.parse(content);
47
+ } catch {
48
+ const cleaned = content.replace(/\/\/[^\r\n]{0,10000}$/gm, "").replace(/\/\*[\s\S]{0,50000}?\*\//g, "").trim();
49
+ return JSON.parse(cleaned);
50
+ }
51
+ }
52
+ var GitConfigSchema = z.object({
53
+ remote: z.string().default("origin"),
54
+ branch: z.string().default("main"),
55
+ pushMethod: z.enum(["auto", "ssh", "https"]).default("auto"),
56
+ /**
57
+ * Optional env var name containing a GitHub token for HTTPS pushes.
58
+ * When set, publish steps can use this token without mutating git remotes.
59
+ */
60
+ httpsTokenEnv: z.string().optional(),
61
+ push: z.boolean().optional(),
62
+ skipHooks: z.boolean().optional()
63
+ });
64
+ var MonorepoConfigSchema = z.object({
65
+ mode: z.enum(["root", "packages", "both"]).optional(),
66
+ rootPath: z.string().optional(),
67
+ packagesPath: z.string().optional(),
68
+ mainPackage: z.string().optional()
69
+ });
70
+ var BranchPatternSchema = z.object({
71
+ pattern: z.string(),
72
+ releaseType: z.enum(["major", "minor", "patch", "prerelease"])
73
+ });
74
+ var VersionCargoConfigSchema = z.object({
75
+ enabled: z.boolean().default(true),
76
+ paths: z.array(z.string()).optional()
77
+ });
78
+ var VersionConfigSchema = z.object({
79
+ tagTemplate: z.string().default("v{version}"),
80
+ packageSpecificTags: z.boolean().default(false),
81
+ preset: z.string().default("conventional"),
82
+ sync: z.boolean().default(true),
83
+ packages: z.array(z.string()).default([]),
84
+ mainPackage: z.string().optional(),
85
+ updateInternalDependencies: z.enum(["major", "minor", "patch", "no-internal-update"]).default("minor"),
86
+ skip: z.array(z.string()).optional(),
87
+ commitMessage: z.string().optional(),
88
+ versionStrategy: z.enum(["branchPattern", "commitMessage"]).default("commitMessage"),
89
+ branchPatterns: z.array(BranchPatternSchema).optional(),
90
+ defaultReleaseType: z.enum(["major", "minor", "patch", "prerelease"]).optional(),
91
+ mismatchStrategy: z.enum(["error", "warn", "ignore", "prefer-package", "prefer-git"]).default("warn"),
92
+ versionPrefix: z.string().default(""),
93
+ prereleaseIdentifier: z.string().optional(),
94
+ strictReachable: z.boolean().default(false),
95
+ cargo: VersionCargoConfigSchema.optional()
96
+ });
97
+ var NpmConfigSchema = z.object({
98
+ enabled: z.boolean().default(true),
99
+ auth: z.enum(["auto", "oidc", "token"]).default("auto"),
100
+ provenance: z.boolean().default(true),
101
+ access: z.enum(["public", "restricted"]).default("public"),
102
+ registry: z.string().default("https://registry.npmjs.org"),
103
+ copyFiles: z.array(z.string()).default(["LICENSE"]),
104
+ tag: z.string().default("latest")
105
+ });
106
+ var CargoPublishConfigSchema = z.object({
107
+ enabled: z.boolean().default(false),
108
+ noVerify: z.boolean().default(false),
109
+ publishOrder: z.array(z.string()).default([]),
110
+ clean: z.boolean().default(false)
111
+ });
112
+ var PublishGitConfigSchema = z.object({
113
+ push: z.boolean().default(true),
114
+ pushMethod: z.enum(["auto", "ssh", "https"]).optional(),
115
+ remote: z.string().optional(),
116
+ branch: z.string().optional(),
117
+ httpsTokenEnv: z.string().optional(),
118
+ skipHooks: z.boolean().optional()
119
+ });
120
+ var GitHubReleaseConfigSchema = z.object({
121
+ enabled: z.boolean().default(true),
122
+ draft: z.boolean().default(true),
123
+ perPackage: z.boolean().default(true),
124
+ prerelease: z.union([z.literal("auto"), z.boolean()]).default("auto"),
125
+ /**
126
+ * Controls the source for the GitHub release body.
127
+ * - 'auto': Use release notes if enabled, else changelog, else GitHub auto-generated.
128
+ * - 'releaseNotes': Use LLM-generated release notes (requires notes.releaseNotes.enabled: true).
129
+ * - 'changelog': Use formatted changelog entries.
130
+ * - 'generated': Use GitHub's auto-generated notes.
131
+ * - 'none': No body.
132
+ */
133
+ body: z.enum(["auto", "releaseNotes", "changelog", "generated", "none"]).default("auto"),
134
+ /**
135
+ * Template string for the GitHub release title when a package name is resolved.
136
+ * Available variables: ${packageName} (original scoped name), ${version} (e.g. "v1.0.0").
137
+ * Version-only tags (e.g. "v1.0.0") always use the tag as-is.
138
+ */
139
+ /* biome-ignore lint/suspicious/noTemplateCurlyInString: default template value */
140
+ titleTemplate: z.string().default("${packageName}: ${version}")
141
+ });
142
+ var VerifyRegistryConfigSchema = z.object({
143
+ enabled: z.boolean().default(true),
144
+ maxAttempts: z.number().int().positive().default(5),
145
+ initialDelay: z.number().int().positive().default(15e3),
146
+ backoffMultiplier: z.number().positive().default(2)
147
+ });
148
+ var VerifyConfigSchema = z.object({
149
+ npm: VerifyRegistryConfigSchema.default({
150
+ enabled: true,
151
+ maxAttempts: 5,
152
+ initialDelay: 15e3,
153
+ backoffMultiplier: 2
154
+ }),
155
+ cargo: VerifyRegistryConfigSchema.default({
156
+ enabled: true,
157
+ maxAttempts: 10,
158
+ initialDelay: 3e4,
159
+ backoffMultiplier: 2
160
+ })
161
+ });
162
+ var PublishConfigSchema = z.object({
163
+ git: PublishGitConfigSchema.optional(),
164
+ npm: NpmConfigSchema.default({
165
+ enabled: true,
166
+ auth: "auto",
167
+ provenance: true,
168
+ access: "public",
169
+ registry: "https://registry.npmjs.org",
170
+ copyFiles: ["LICENSE"],
171
+ tag: "latest"
172
+ }),
173
+ cargo: CargoPublishConfigSchema.default({
174
+ enabled: false,
175
+ noVerify: false,
176
+ publishOrder: [],
177
+ clean: false
178
+ }),
179
+ githubRelease: GitHubReleaseConfigSchema.default({
180
+ enabled: true,
181
+ draft: true,
182
+ perPackage: true,
183
+ prerelease: "auto",
184
+ body: "auto",
185
+ /* biome-ignore lint/suspicious/noTemplateCurlyInString: default template value */
186
+ titleTemplate: "${packageName}: ${version}"
187
+ }),
188
+ verify: VerifyConfigSchema.default({
189
+ npm: {
190
+ enabled: true,
191
+ maxAttempts: 5,
192
+ initialDelay: 15e3,
193
+ backoffMultiplier: 2
194
+ },
195
+ cargo: {
196
+ enabled: true,
197
+ maxAttempts: 10,
198
+ initialDelay: 3e4,
199
+ backoffMultiplier: 2
200
+ }
201
+ })
202
+ });
203
+ var TemplateConfigSchema = z.object({
204
+ path: z.string().optional(),
205
+ engine: z.enum(["handlebars", "liquid", "ejs"]).optional()
206
+ });
207
+ var LocationModeSchema = z.enum(["root", "packages", "both"]);
208
+ var ChangelogConfigSchema = z.object({
209
+ mode: LocationModeSchema.optional(),
210
+ file: z.string().optional(),
211
+ templates: TemplateConfigSchema.optional()
212
+ });
213
+ var LLMOptionsSchema = z.object({
214
+ timeout: z.number().optional(),
215
+ maxTokens: z.number().optional(),
216
+ temperature: z.number().optional()
217
+ });
218
+ var LLMRetryConfigSchema = z.object({
219
+ maxAttempts: z.number().int().positive().optional(),
220
+ initialDelay: z.number().nonnegative().optional(),
221
+ maxDelay: z.number().positive().optional(),
222
+ backoffFactor: z.number().positive().optional()
223
+ });
224
+ var LLMTasksConfigSchema = z.object({
225
+ summarize: z.boolean().optional(),
226
+ enhance: z.boolean().optional(),
227
+ categorize: z.boolean().optional(),
228
+ releaseNotes: z.boolean().optional()
229
+ });
230
+ var LLMCategorySchema = z.object({
231
+ name: z.string(),
232
+ description: z.string(),
233
+ scopes: z.array(z.string()).optional()
234
+ });
235
+ var ScopeRulesSchema = z.object({
236
+ allowed: z.array(z.string()).optional(),
237
+ caseSensitive: z.boolean().default(false),
238
+ invalidScopeAction: z.enum(["remove", "keep", "fallback"]).default("remove"),
239
+ fallbackScope: z.string().optional()
240
+ });
241
+ var ScopeConfigSchema = z.object({
242
+ mode: z.enum(["restricted", "packages", "none", "unrestricted"]).default("unrestricted"),
243
+ rules: ScopeRulesSchema.optional()
244
+ });
245
+ var LLMPromptOverridesSchema = z.object({
246
+ enhance: z.string().optional(),
247
+ categorize: z.string().optional(),
248
+ enhanceAndCategorize: z.string().optional(),
249
+ summarize: z.string().optional(),
250
+ releaseNotes: z.string().optional()
251
+ });
252
+ var LLMPromptsConfigSchema = z.object({
253
+ instructions: LLMPromptOverridesSchema.optional(),
254
+ templates: LLMPromptOverridesSchema.optional()
255
+ });
256
+ var LLMConfigSchema = z.object({
257
+ provider: z.string(),
258
+ model: z.string(),
259
+ baseURL: z.string().optional(),
260
+ apiKey: z.string().optional(),
261
+ options: LLMOptionsSchema.optional(),
262
+ concurrency: z.number().int().positive().optional(),
263
+ retry: LLMRetryConfigSchema.optional(),
264
+ tasks: LLMTasksConfigSchema.optional(),
265
+ categories: z.array(LLMCategorySchema).optional(),
266
+ style: z.string().optional(),
267
+ scopes: ScopeConfigSchema.optional(),
268
+ prompts: LLMPromptsConfigSchema.optional()
269
+ });
270
+ var ReleaseNotesConfigSchema = z.object({
271
+ mode: LocationModeSchema.optional(),
272
+ file: z.string().optional(),
273
+ templates: TemplateConfigSchema.optional(),
274
+ llm: LLMConfigSchema.optional()
275
+ });
276
+ var NotesInputConfigSchema = z.object({
277
+ source: z.string().optional(),
278
+ file: z.string().optional()
279
+ });
280
+ var NotesConfigSchema = z.object({
281
+ changelog: z.union([z.literal(false), ChangelogConfigSchema]).optional(),
282
+ releaseNotes: z.union([z.literal(false), ReleaseNotesConfigSchema]).optional(),
283
+ updateStrategy: z.enum(["prepend", "regenerate"]).optional()
284
+ });
285
+ var CILabelsConfigSchema = z.object({
286
+ stable: z.string().default("release:stable"),
287
+ prerelease: z.string().default("release:prerelease"),
288
+ skip: z.string().default("release:skip"),
289
+ major: z.string().default("release:major"),
290
+ minor: z.string().default("release:minor"),
291
+ patch: z.string().default("release:patch")
292
+ });
293
+ var CIConfigSchema = z.object({
294
+ releaseStrategy: z.enum(["manual", "direct", "standing-pr", "scheduled"]).default("direct"),
295
+ releaseTrigger: z.enum(["commit", "label"]).default("label"),
296
+ prPreview: z.boolean().default(true),
297
+ autoRelease: z.boolean().default(false),
298
+ /**
299
+ * Commit message prefixes that should not trigger a release.
300
+ * Defaults to `['chore: release ']` to match the release commit template
301
+ * (`chore: release ${packageName} v${version}`) and provide a
302
+ * secondary loop-prevention guard alongside `[skip ci]`.
303
+ */
304
+ skipPatterns: z.array(z.string()).default(["chore: release "]),
305
+ minChanges: z.number().int().positive().default(1),
306
+ labels: CILabelsConfigSchema.default({
307
+ stable: "release:stable",
308
+ prerelease: "release:prerelease",
309
+ skip: "release:skip",
310
+ major: "release:major",
311
+ minor: "release:minor",
312
+ patch: "release:patch"
313
+ })
314
+ });
315
+ var ReleaseCIConfigSchema = z.object({
316
+ skipPatterns: z.array(z.string().min(1)).optional(),
317
+ minChanges: z.number().int().positive().optional(),
318
+ /** Set to `false` to disable GitHub release creation in CI. */
319
+ githubRelease: z.literal(false).optional(),
320
+ /** Set to `false` to disable changelog generation in CI. */
321
+ notes: z.literal(false).optional()
322
+ });
323
+ var ReleaseConfigSchema = z.object({
324
+ /**
325
+ * Optional steps to enable. The version step always runs; only 'notes' and
326
+ * 'publish' can be opted out. Omitting a step is equivalent to --skip-<step>.
327
+ */
328
+ steps: z.array(z.enum(["notes", "publish"])).min(1).optional(),
329
+ ci: ReleaseCIConfigSchema.optional()
330
+ });
331
+ var ReleaseKitConfigSchema = z.object({
332
+ git: GitConfigSchema.optional(),
333
+ monorepo: MonorepoConfigSchema.optional(),
334
+ version: VersionConfigSchema.optional(),
335
+ publish: PublishConfigSchema.optional(),
336
+ notes: NotesConfigSchema.optional(),
337
+ ci: CIConfigSchema.optional(),
338
+ release: ReleaseConfigSchema.optional()
339
+ });
340
+ var MAX_INPUT_LENGTH = 1e4;
341
+ function substituteVariables(value) {
342
+ if (value.length > MAX_INPUT_LENGTH) {
343
+ throw new Error(`Input too long: ${value.length} characters (max ${MAX_INPUT_LENGTH})`);
344
+ }
345
+ const envPattern = /\{env:([^}]{1,1000})\}/g;
346
+ const filePattern = /\{file:([^}]{1,1000})\}/g;
347
+ let result = value;
348
+ result = result.replace(envPattern, (_, varName) => {
349
+ return process.env[varName] ?? "";
350
+ });
351
+ result = result.replace(filePattern, (_, filePath) => {
352
+ const expandedPath = filePath.startsWith("~") ? path2.join(os.homedir(), filePath.slice(1)) : filePath;
353
+ try {
354
+ return fs2.readFileSync(expandedPath, "utf-8").trim();
355
+ } catch {
356
+ return "";
357
+ }
358
+ });
359
+ return result;
360
+ }
361
+ var SOLE_REFERENCE_PATTERN = /^\{(?:env|file):[^}]+\}$/;
362
+ function substituteInObject(obj) {
363
+ if (typeof obj === "string") {
364
+ const result = substituteVariables(obj);
365
+ if (result === "" && SOLE_REFERENCE_PATTERN.test(obj)) {
366
+ return void 0;
367
+ }
368
+ return result;
369
+ }
370
+ if (Array.isArray(obj)) {
371
+ return obj.map((item) => substituteInObject(item));
372
+ }
373
+ if (obj && typeof obj === "object") {
374
+ const result = {};
375
+ for (const [key, value] of Object.entries(obj)) {
376
+ result[key] = substituteInObject(value);
377
+ }
378
+ return result;
379
+ }
380
+ return obj;
381
+ }
382
+ var AUTH_DIR = path2.join(os.homedir(), ".config", "releasekit");
383
+ var AUTH_FILE = path2.join(AUTH_DIR, "auth.json");
384
+ var CONFIG_FILE = "releasekit.config.json";
385
+ function loadConfigFile(configPath) {
386
+ if (!fs3.existsSync(configPath)) {
387
+ return {};
388
+ }
389
+ try {
390
+ const content = fs3.readFileSync(configPath, "utf-8");
391
+ const parsed = parseJsonc(content);
392
+ const substituted = substituteInObject(parsed);
393
+ return ReleaseKitConfigSchema.parse(substituted);
394
+ } catch (error) {
395
+ if (error instanceof z2.ZodError) {
396
+ const issues = error.issues.map((i) => ` ${i.path.join(".")}: ${i.message}`).join("\n");
397
+ throw new ConfigError(`Config validation errors:
398
+ ${issues}`);
399
+ }
400
+ if (error instanceof SyntaxError) {
401
+ throw new ConfigError(`Invalid JSON in config file: ${error.message}`);
402
+ }
403
+ throw error;
404
+ }
405
+ }
406
+ function loadConfig(options) {
407
+ const cwd3 = options?.cwd ?? process.cwd();
408
+ const configPath = options?.configPath ?? path3.join(cwd3, CONFIG_FILE);
409
+ return loadConfigFile(configPath);
410
+ }
11
411
 
12
412
  // src/types.ts
13
413
  function toVersionConfig(config, gitConfig) {
@@ -48,8 +448,8 @@ function toVersionConfig(config, gitConfig) {
48
448
  }
49
449
 
50
450
  // src/config.ts
51
- function loadConfig(options) {
52
- const fullConfig = loadReleaseKitConfig(options);
451
+ function loadConfig2(options) {
452
+ const fullConfig = loadConfig(options);
53
453
  return toVersionConfig(fullConfig.version, fullConfig.git);
54
454
  }
55
455
 
@@ -111,7 +511,7 @@ function createVersionError(code, details) {
111
511
  }
112
512
 
113
513
  // src/utils/jsonOutput.ts
114
- import fs from "fs";
514
+ import fs4 from "fs";
115
515
  var _jsonOutputMode = false;
116
516
  var _pendingWrites = [];
117
517
  var _jsonData = {
@@ -131,14 +531,14 @@ function enableJsonOutput(dryRun = false) {
131
531
  _jsonData.commitMessage = void 0;
132
532
  _pendingWrites.length = 0;
133
533
  }
134
- function recordPendingWrite(path7, content) {
534
+ function recordPendingWrite(path10, content) {
135
535
  if (!_jsonOutputMode) return;
136
- _pendingWrites.push({ path: path7, content });
536
+ _pendingWrites.push({ path: path10, content });
137
537
  }
138
538
  function flushPendingWrites() {
139
539
  try {
140
- for (const { path: path7, content } of _pendingWrites) {
141
- fs.writeFileSync(path7, content);
540
+ for (const { path: path10, content } of _pendingWrites) {
541
+ fs4.writeFileSync(path10, content);
142
542
  }
143
543
  } finally {
144
544
  _pendingWrites.length = 0;
@@ -182,13 +582,12 @@ function printJsonOutput() {
182
582
 
183
583
  // src/core/versionCalculator.ts
184
584
  import { cwd } from "process";
185
- import { sanitizePackageName as sanitizePackageName2 } from "@releasekit/core";
186
585
  import { Bumper } from "conventional-recommended-bump";
187
586
  import semver3 from "semver";
188
587
 
189
588
  // src/git/repository.ts
190
- import { existsSync, statSync } from "fs";
191
- import { join } from "path";
589
+ import { existsSync as existsSync3, statSync } from "fs";
590
+ import { join as join3 } from "path";
192
591
  function getCurrentBranch() {
193
592
  const result = execSync("git", ["rev-parse", "--abbrev-ref", "HEAD"]);
194
593
  return result.toString().trim();
@@ -198,9 +597,6 @@ function getCurrentBranch() {
198
597
  import { getSemverTags } from "git-semver-tags";
199
598
  import semver from "semver";
200
599
 
201
- // src/utils/formatting.ts
202
- import { sanitizePackageName } from "@releasekit/core";
203
-
204
600
  // src/utils/logging.ts
205
601
  import chalk from "chalk";
206
602
  import figlet from "figlet";
@@ -410,16 +806,15 @@ async function getLatestTagForPackage(packageName, versionPrefix, options) {
410
806
  }
411
807
 
412
808
  // src/utils/manifestHelpers.ts
413
- import fs3 from "fs";
414
- import path2 from "path";
809
+ import fs6 from "fs";
810
+ import path5 from "path";
415
811
 
416
812
  // src/cargo/cargoHandler.ts
417
- import fs2 from "fs";
418
- import path from "path";
419
- import { isCargoToml, parseCargoToml } from "@releasekit/config";
420
- import * as TOML from "smol-toml";
813
+ import fs5 from "fs";
814
+ import path4 from "path";
815
+ import * as TOML2 from "smol-toml";
421
816
  function getCargoInfo(cargoPath) {
422
- if (!fs2.existsSync(cargoPath)) {
817
+ if (!fs5.existsSync(cargoPath)) {
423
818
  log(`Cargo.toml file not found at: ${cargoPath}`, "error");
424
819
  throw new Error(`Cargo.toml file not found at: ${cargoPath}`);
425
820
  }
@@ -433,7 +828,7 @@ function getCargoInfo(cargoPath) {
433
828
  name: cargo.package.name,
434
829
  version: cargo.package.version || "0.0.0",
435
830
  path: cargoPath,
436
- dir: path.dirname(cargoPath),
831
+ dir: path4.dirname(cargoPath),
437
832
  content: cargo
438
833
  };
439
834
  } catch (error) {
@@ -457,11 +852,11 @@ function updateCargoVersion(cargoPath, version, dryRun = false) {
457
852
  } else {
458
853
  cargo.package.version = version;
459
854
  }
460
- const updatedContent = TOML.stringify(cargo);
855
+ const updatedContent = TOML2.stringify(cargo);
461
856
  if (dryRun) {
462
857
  recordPendingWrite(cargoPath, updatedContent);
463
858
  } else {
464
- fs2.writeFileSync(cargoPath, updatedContent);
859
+ fs5.writeFileSync(cargoPath, updatedContent);
465
860
  }
466
861
  addPackageUpdate(packageName, version, cargoPath);
467
862
  log(`${dryRun ? "[DRY RUN] Would update" : "Updated"} Cargo.toml at ${cargoPath} to version ${version}`, "success");
@@ -476,11 +871,11 @@ function updateCargoVersion(cargoPath, version, dryRun = false) {
476
871
 
477
872
  // src/utils/manifestHelpers.ts
478
873
  function getVersionFromManifests(packageDir) {
479
- const packageJsonPath = path2.join(packageDir, "package.json");
480
- const cargoTomlPath = path2.join(packageDir, "Cargo.toml");
481
- if (fs3.existsSync(packageJsonPath)) {
874
+ const packageJsonPath = path5.join(packageDir, "package.json");
875
+ const cargoTomlPath = path5.join(packageDir, "Cargo.toml");
876
+ if (fs6.existsSync(packageJsonPath)) {
482
877
  try {
483
- const packageJson = JSON.parse(fs3.readFileSync(packageJsonPath, "utf-8"));
878
+ const packageJson = JSON.parse(fs6.readFileSync(packageJsonPath, "utf-8"));
484
879
  if (packageJson.version) {
485
880
  log(`Found version ${packageJson.version} in package.json`, "debug");
486
881
  return {
@@ -496,7 +891,7 @@ function getVersionFromManifests(packageDir) {
496
891
  log(`Error reading package.json: ${errMsg}`, "warning");
497
892
  }
498
893
  }
499
- if (fs3.existsSync(cargoTomlPath)) {
894
+ if (fs6.existsSync(cargoTomlPath)) {
500
895
  try {
501
896
  const cargoInfo = getCargoInfo(cargoTomlPath);
502
897
  if (cargoInfo.version) {
@@ -523,8 +918,7 @@ function getVersionFromManifests(packageDir) {
523
918
  }
524
919
 
525
920
  // src/utils/versionUtils.ts
526
- import fs4 from "fs";
527
- import { parseCargoToml as parseCargoToml2 } from "@releasekit/config";
921
+ import fs7 from "fs";
528
922
  import semver2 from "semver";
529
923
 
530
924
  // src/git/tagVerification.ts
@@ -766,7 +1160,7 @@ async function calculateVersion(config, options) {
766
1160
  try {
767
1161
  let buildTagStripPattern2 = function(packageName, prefix) {
768
1162
  if (!packageName) return escapeRegExp(prefix);
769
- const sanitized = sanitizePackageName2(packageName);
1163
+ const sanitized = sanitizePackageName(packageName);
770
1164
  const escapedRaw = escapeRegExp(`${packageName}@${prefix}`);
771
1165
  const escapedDash = escapeRegExp(`${sanitized}-${prefix}`);
772
1166
  return `(?:${escapedRaw}|${escapedDash})`;
@@ -899,8 +1293,8 @@ async function calculateVersion(config, options) {
899
1293
  }
900
1294
 
901
1295
  // src/package/packageProcessor.ts
902
- import * as fs6 from "fs";
903
- import path4 from "path";
1296
+ import * as fs9 from "fs";
1297
+ import path7 from "path";
904
1298
 
905
1299
  // src/changelog/commitParser.ts
906
1300
  var CONVENTIONAL_COMMIT_REGEX = /^(\w+)(?:\(([^)]+)\))?(!)?: (.+)(?:\n\n([\s\S]*))?/;
@@ -1104,15 +1498,15 @@ function shouldProcessPackage(packageName, skip = []) {
1104
1498
  }
1105
1499
 
1106
1500
  // src/package/packageManagement.ts
1107
- import fs5 from "fs";
1108
- import path3 from "path";
1501
+ import fs8 from "fs";
1502
+ import path6 from "path";
1109
1503
  function updatePackageVersion(packagePath, version, dryRun = false) {
1110
1504
  if (isCargoToml(packagePath)) {
1111
1505
  updateCargoVersion(packagePath, version, dryRun);
1112
1506
  return;
1113
1507
  }
1114
1508
  try {
1115
- const packageContent = fs5.readFileSync(packagePath, "utf8");
1509
+ const packageContent = fs8.readFileSync(packagePath, "utf8");
1116
1510
  const packageJson = JSON.parse(packageContent);
1117
1511
  const packageName = packageJson.name;
1118
1512
  const updatedContent = `${JSON.stringify({ ...packageJson, version }, null, 2)}
@@ -1120,7 +1514,7 @@ function updatePackageVersion(packagePath, version, dryRun = false) {
1120
1514
  if (dryRun) {
1121
1515
  recordPendingWrite(packagePath, updatedContent);
1122
1516
  } else {
1123
- fs5.writeFileSync(packagePath, updatedContent);
1517
+ fs8.writeFileSync(packagePath, updatedContent);
1124
1518
  }
1125
1519
  addPackageUpdate(packageName, version, packagePath);
1126
1520
  log(
@@ -1290,9 +1684,9 @@ var PackageProcessor = class {
1290
1684
  }
1291
1685
  let repoUrl;
1292
1686
  try {
1293
- const packageJsonPath2 = path4.join(pkgPath, "package.json");
1294
- if (fs6.existsSync(packageJsonPath2)) {
1295
- const packageJson = JSON.parse(fs6.readFileSync(packageJsonPath2, "utf8"));
1687
+ const packageJsonPath2 = path7.join(pkgPath, "package.json");
1688
+ if (fs9.existsSync(packageJsonPath2)) {
1689
+ const packageJson = JSON.parse(fs9.readFileSync(packageJsonPath2, "utf8"));
1296
1690
  if (packageJson.repository) {
1297
1691
  if (typeof packageJson.repository === "string") {
1298
1692
  repoUrl = packageJson.repository;
@@ -1318,8 +1712,8 @@ var PackageProcessor = class {
1318
1712
  repoUrl: repoUrl || null,
1319
1713
  entries: changelogEntries
1320
1714
  });
1321
- const packageJsonPath = path4.join(pkgPath, "package.json");
1322
- if (fs6.existsSync(packageJsonPath)) {
1715
+ const packageJsonPath = path7.join(pkgPath, "package.json");
1716
+ if (fs9.existsSync(packageJsonPath)) {
1323
1717
  updatePackageVersion(packageJsonPath, nextVersion, this.dryRun);
1324
1718
  }
1325
1719
  const cargoEnabled = this.fullConfig.cargo?.enabled !== false;
@@ -1329,9 +1723,9 @@ var PackageProcessor = class {
1329
1723
  log(`Cargo paths config for ${name}: ${JSON.stringify(cargoPaths)}`, "debug");
1330
1724
  if (cargoPaths && cargoPaths.length > 0) {
1331
1725
  for (const cargoPath of cargoPaths) {
1332
- const resolvedCargoPath = path4.resolve(pkgPath, cargoPath, "Cargo.toml");
1726
+ const resolvedCargoPath = path7.resolve(pkgPath, cargoPath, "Cargo.toml");
1333
1727
  log(`Checking cargo path for ${name}: ${resolvedCargoPath}`, "debug");
1334
- if (fs6.existsSync(resolvedCargoPath)) {
1728
+ if (fs9.existsSync(resolvedCargoPath)) {
1335
1729
  log(`Found Cargo.toml for ${name} at ${resolvedCargoPath}, updating...`, "debug");
1336
1730
  updatePackageVersion(resolvedCargoPath, nextVersion, this.dryRun);
1337
1731
  } else {
@@ -1339,9 +1733,9 @@ var PackageProcessor = class {
1339
1733
  }
1340
1734
  }
1341
1735
  } else {
1342
- const cargoTomlPath = path4.join(pkgPath, "Cargo.toml");
1736
+ const cargoTomlPath = path7.join(pkgPath, "Cargo.toml");
1343
1737
  log(`Checking default cargo path for ${name}: ${cargoTomlPath}`, "debug");
1344
- if (fs6.existsSync(cargoTomlPath)) {
1738
+ if (fs9.existsSync(cargoTomlPath)) {
1345
1739
  log(`Found Cargo.toml for ${name} at ${cargoTomlPath}, updating...`, "debug");
1346
1740
  updatePackageVersion(cargoTomlPath, nextVersion, this.dryRun);
1347
1741
  } else {
@@ -1407,8 +1801,8 @@ var PackageProcessor = class {
1407
1801
  };
1408
1802
 
1409
1803
  // src/core/versionStrategies.ts
1410
- import fs7 from "fs";
1411
- import * as path5 from "path";
1804
+ import fs10 from "fs";
1805
+ import * as path8 from "path";
1412
1806
  function shouldProcessPackage2(pkg, config) {
1413
1807
  const pkgName = pkg.packageJson.name;
1414
1808
  return shouldProcessPackage(pkgName, config.skip);
@@ -1422,15 +1816,15 @@ function updateCargoFiles(packageDir, version, cargoConfig, dryRun = false) {
1422
1816
  const cargoPaths = cargoConfig?.paths;
1423
1817
  if (cargoPaths && cargoPaths.length > 0) {
1424
1818
  for (const cargoPath of cargoPaths) {
1425
- const resolvedCargoPath = path5.resolve(packageDir, cargoPath, "Cargo.toml");
1426
- if (fs7.existsSync(resolvedCargoPath)) {
1819
+ const resolvedCargoPath = path8.resolve(packageDir, cargoPath, "Cargo.toml");
1820
+ if (fs10.existsSync(resolvedCargoPath)) {
1427
1821
  updatePackageVersion(resolvedCargoPath, version, dryRun);
1428
1822
  updatedFiles.push(resolvedCargoPath);
1429
1823
  }
1430
1824
  }
1431
1825
  } else {
1432
- const cargoTomlPath = path5.join(packageDir, "Cargo.toml");
1433
- if (fs7.existsSync(cargoTomlPath)) {
1826
+ const cargoTomlPath = path8.join(packageDir, "Cargo.toml");
1827
+ if (fs10.existsSync(cargoTomlPath)) {
1434
1828
  updatePackageVersion(cargoTomlPath, version, dryRun);
1435
1829
  updatedFiles.push(cargoTomlPath);
1436
1830
  }
@@ -1510,8 +1904,8 @@ function createSyncStrategy(config) {
1510
1904
  const processedPaths = /* @__PURE__ */ new Set();
1511
1905
  try {
1512
1906
  if (packages.root) {
1513
- const rootPkgPath = path5.join(packages.root, "package.json");
1514
- if (fs7.existsSync(rootPkgPath)) {
1907
+ const rootPkgPath = path8.join(packages.root, "package.json");
1908
+ if (fs10.existsSync(rootPkgPath)) {
1515
1909
  updatePackageVersion(rootPkgPath, nextVersion, dryRun);
1516
1910
  files.push(rootPkgPath);
1517
1911
  updatedPackages.push("root");
@@ -1530,7 +1924,7 @@ function createSyncStrategy(config) {
1530
1924
  if (!shouldProcessPackage2(pkg, config)) {
1531
1925
  continue;
1532
1926
  }
1533
- const packageJsonPath = path5.join(pkg.dir, "package.json");
1927
+ const packageJsonPath = path8.join(pkg.dir, "package.json");
1534
1928
  if (processedPaths.has(packageJsonPath)) {
1535
1929
  continue;
1536
1930
  }
@@ -1589,9 +1983,9 @@ function createSyncStrategy(config) {
1589
1983
  let repoUrl = null;
1590
1984
  for (const searchPath of [mainPkgPath, versionSourcePath].filter(Boolean)) {
1591
1985
  try {
1592
- const pkgJsonPath = path5.join(searchPath, "package.json");
1593
- if (fs7.existsSync(pkgJsonPath)) {
1594
- const pkgJson = JSON.parse(fs7.readFileSync(pkgJsonPath, "utf8"));
1986
+ const pkgJsonPath = path8.join(searchPath, "package.json");
1987
+ if (fs10.existsSync(pkgJsonPath)) {
1988
+ const pkgJson = JSON.parse(fs10.readFileSync(pkgJsonPath, "utf8"));
1595
1989
  let url;
1596
1990
  if (typeof pkgJson.repository === "string") {
1597
1991
  url = pkgJson.repository;
@@ -1758,9 +2152,9 @@ function createSingleStrategy(config) {
1758
2152
  }
1759
2153
  let repoUrl;
1760
2154
  try {
1761
- const packageJsonPath2 = path5.join(pkgPath, "package.json");
1762
- if (fs7.existsSync(packageJsonPath2)) {
1763
- const packageJson = JSON.parse(fs7.readFileSync(packageJsonPath2, "utf8"));
2155
+ const packageJsonPath2 = path8.join(pkgPath, "package.json");
2156
+ if (fs10.existsSync(packageJsonPath2)) {
2157
+ const packageJson = JSON.parse(fs10.readFileSync(packageJsonPath2, "utf8"));
1764
2158
  if (packageJson.repository) {
1765
2159
  if (typeof packageJson.repository === "string") {
1766
2160
  repoUrl = packageJson.repository;
@@ -1786,7 +2180,7 @@ function createSingleStrategy(config) {
1786
2180
  repoUrl: repoUrl || null,
1787
2181
  entries: changelogEntries
1788
2182
  });
1789
- const packageJsonPath = path5.join(pkgPath, "package.json");
2183
+ const packageJsonPath = path8.join(pkgPath, "package.json");
1790
2184
  updatePackageVersion(packageJsonPath, nextVersion, dryRun);
1791
2185
  const filesToCommit = [packageJsonPath];
1792
2186
  const cargoFiles = updateCargoFiles(pkgPath, nextVersion, config.cargo, dryRun);
@@ -1892,7 +2286,7 @@ var GitError = class extends BaseVersionError {
1892
2286
  };
1893
2287
 
1894
2288
  // src/utils/packageFiltering.ts
1895
- import path6 from "path";
2289
+ import path9 from "path";
1896
2290
  import { minimatch as minimatch2 } from "minimatch";
1897
2291
  function filterPackagesByConfig(packages, configTargets, workspaceRoot) {
1898
2292
  if (configTargets.length === 0) {
@@ -1918,7 +2312,7 @@ function filterByDirectoryPattern(packages, pattern, workspaceRoot) {
1918
2312
  }
1919
2313
  const normalizedPattern = pattern.replace(/\\/g, "/");
1920
2314
  return packages.filter((pkg) => {
1921
- const relativePath = path6.relative(workspaceRoot, pkg.dir);
2315
+ const relativePath = path9.relative(workspaceRoot, pkg.dir);
1922
2316
  const normalizedRelativePath = relativePath.replace(/\\/g, "/");
1923
2317
  if (normalizedPattern === normalizedRelativePath) {
1924
2318
  return true;
@@ -2079,7 +2473,7 @@ function createVersionCommand() {
2079
2473
  );
2080
2474
  }
2081
2475
  }
2082
- const config = loadConfig({ cwd: options.projectDir, configPath: options.config });
2476
+ const config = loadConfig2({ cwd: options.projectDir, configPath: options.config });
2083
2477
  log(`Loaded configuration from ${options.config || "releasekit.config.json"}`, "info");
2084
2478
  if (options.dryRun) config.dryRun = true;
2085
2479
  if (options.sync) config.sync = true;
@@ -2123,7 +2517,7 @@ function createVersionCommand() {
2123
2517
  log("Versioning process completed.", "success");
2124
2518
  printJsonOutput();
2125
2519
  } catch (error) {
2126
- const { BaseVersionError: BaseVersionError2 } = await import("./baseError-6PKATI6Z.js");
2520
+ const { BaseVersionError: BaseVersionError2 } = await import("./baseError-DQHIJACF.js");
2127
2521
  if (BaseVersionError2.isVersionError(error)) {
2128
2522
  error.logError();
2129
2523
  } else {
@@ -2135,7 +2529,7 @@ function createVersionCommand() {
2135
2529
  }
2136
2530
 
2137
2531
  export {
2138
- loadConfig,
2532
+ loadConfig2 as loadConfig,
2139
2533
  VersionErrorCode,
2140
2534
  createVersionError,
2141
2535
  enableJsonOutput,
package/dist/cli.js CHANGED
@@ -1,14 +1,15 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  createVersionCommand
4
- } from "./chunk-V44UWRAP.js";
5
- import "./chunk-3FG6RVHS.js";
4
+ } from "./chunk-UBCKZYTO.js";
5
+ import {
6
+ readPackageVersion
7
+ } from "./chunk-Q3FHZORY.js";
6
8
  import "./chunk-LMPZV35Z.js";
7
9
 
8
10
  // src/cli.ts
9
11
  import * as fs from "fs";
10
12
  import { fileURLToPath } from "url";
11
- import { readPackageVersion } from "@releasekit/core";
12
13
  import { Command } from "commander";
13
14
  var isMain = (() => {
14
15
  try {
package/dist/index.js CHANGED
@@ -12,10 +12,10 @@ import {
12
12
  flushPendingWrites,
13
13
  getJsonData,
14
14
  loadConfig
15
- } from "./chunk-V44UWRAP.js";
15
+ } from "./chunk-UBCKZYTO.js";
16
16
  import {
17
17
  BaseVersionError
18
- } from "./chunk-3FG6RVHS.js";
18
+ } from "./chunk-Q3FHZORY.js";
19
19
  import "./chunk-LMPZV35Z.js";
20
20
  export {
21
21
  BaseVersionError,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@releasekit/version",
3
- "version": "0.7.46",
3
+ "version": "0.7.47",
4
4
  "description": "Semantic versioning based on Git history and conventional commits",
5
5
  "type": "module",
6
6
  "module": "./dist/index.js",
@@ -1,18 +0,0 @@
1
- // src/errors/baseError.ts
2
- import { ReleaseKitError } from "@releasekit/core";
3
- var BaseVersionError = class _BaseVersionError extends ReleaseKitError {
4
- code;
5
- suggestions;
6
- constructor(message, code, suggestions) {
7
- super(message);
8
- this.code = code;
9
- this.suggestions = suggestions ?? [];
10
- }
11
- static isVersionError(error) {
12
- return error instanceof _BaseVersionError;
13
- }
14
- };
15
-
16
- export {
17
- BaseVersionError
18
- };